| @@ -1,14 +1,11 @@ | ||
| 1 | 1 | /** |
| 2 | 2 | * WordPress Dependencies |
| 3 | 3 | */ |
| 4 | 4 | import { __ } from "@wordpress/i18n"; |
| 5 | +import { useBlockEditContext } from "@wordpress/block-editor"; | |
| 6 | +import { useColorPalettes } from "./useColorPalettes"; | |
| 5 | 7 | import { |
| 6 | - useBlockEditContext, | |
| 7 | - store as BlockEditorStore, | |
| 8 | -} from "@wordpress/block-editor"; | |
| 9 | -import { useSelect } from "@wordpress/data"; | |
| 10 | -import { | |
| 11 | 8 | __experimentalToolsPanelItem as ToolsPanelItem, |
| 12 | 9 | BorderBoxControl, |
| 13 | 10 | } from "@wordpress/components"; |
| 14 | 11 | import { Border as CSSBorder } from "@wordpress/components/build-types/border-control/types"; |
| @@ -114,15 +111,11 @@ | ||
| 114 | 111 | onDeselect = () => {}, |
| 115 | 112 | }: BorderControlPropTypes) { |
| 116 | 113 | const { clientId } = useBlockEditContext(); |
| 117 | 114 | |
| 118 | - const { defaultColors } = useSelect(select => { | |
| 119 | - return { | |
| 120 | - defaultColors: ( | |
| 121 | - select(BlockEditorStore) as BlockEditorStoreSelectors | |
| 122 | - ).getSettings()?.__experimentalFeatures?.color?.palette?.default, | |
| 123 | - }; | |
| 124 | - }, []); | |
| 115 | + // Reading `color.palette.default` on its own left this picker with the | |
| 116 | + // core swatches and no theme palette at all. | |
| 117 | + const colors = useColorPalettes(); | |
| 125 | 118 | |
| 126 | 119 | if (!resetAllFilter) { |
| 127 | 120 | resetAllFilter = onDeselect; |
| 128 | 121 | } |
| @@ -138,9 +131,9 @@ | ||
| 138 | 131 | > |
| 139 | 132 | <BorderBoxControl |
| 140 | 133 | enableAlpha |
| 141 | 134 | size={"__unstable-large"} |
| 142 | - colors={defaultColors} | |
| 135 | + colors={colors} | |
| 143 | 136 | label={label} |
| 144 | 137 | onChange={newBorders => { |
| 145 | 138 | return onChange(mutateOutgoingBorderValues(newBorders)); |
| 146 | 139 | }} |