@wordpress/components 19.13.0 → 19.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -1
- package/build/alignment-matrix-control/utils.js +1 -7
- package/build/alignment-matrix-control/utils.js.map +1 -1
- package/build/autocomplete/autocompleter-ui.js +4 -2
- package/build/autocomplete/autocompleter-ui.js.map +1 -1
- package/build/autocomplete/autocompleter-ui.native.js +9 -3
- package/build/autocomplete/autocompleter-ui.native.js.map +1 -1
- package/build/autocomplete/index.js +4 -2
- package/build/autocomplete/index.js.map +1 -1
- package/build/border-box-control/border-box-control/component.js +2 -1
- package/build/border-box-control/border-box-control/component.js.map +1 -1
- package/build/border-box-control/border-box-control-split-controls/component.js +2 -1
- package/build/border-box-control/border-box-control-split-controls/component.js.map +1 -1
- package/build/border-control/border-control/component.js +40 -4
- package/build/border-control/border-control/component.js.map +1 -1
- package/build/box-control/utils.js +3 -3
- package/build/box-control/utils.js.map +1 -1
- package/build/color-indicator/index.js +27 -10
- package/build/color-indicator/index.js.map +1 -1
- package/build/color-indicator/types.js +6 -0
- package/build/color-indicator/types.js.map +1 -0
- package/build/color-palette/index.js +2 -1
- package/build/color-palette/index.js.map +1 -1
- package/build/color-picker/component.js +6 -9
- package/build/color-picker/component.js.map +1 -1
- package/build/color-picker/input-with-slider.js +1 -2
- package/build/color-picker/input-with-slider.js.map +1 -1
- package/build/color-picker/styles.js +34 -16
- package/build/color-picker/styles.js.map +1 -1
- package/build/custom-gradient-picker/index.js +8 -8
- package/build/custom-gradient-picker/index.js.map +1 -1
- package/build/custom-gradient-picker/index.native.js +8 -9
- package/build/custom-gradient-picker/index.native.js.map +1 -1
- package/build/custom-gradient-picker/serializer.js +4 -7
- package/build/custom-gradient-picker/serializer.js.map +1 -1
- package/build/date-time/date/index.js +3 -1
- package/build/date-time/date/index.js.map +1 -1
- package/build/date-time/date-time/index.js +3 -1
- package/build/date-time/date-time/index.js.map +1 -1
- package/build/duotone-picker/duotone-picker.js +42 -29
- package/build/duotone-picker/duotone-picker.js.map +1 -1
- package/build/elevation/hook.js +13 -13
- package/build/elevation/hook.js.map +1 -1
- package/build/focal-point-picker/index.native.js +4 -4
- package/build/focal-point-picker/index.native.js.map +1 -1
- package/build/form-toggle/index.js +28 -5
- package/build/form-toggle/index.js.map +1 -1
- package/build/form-toggle/types.js +6 -0
- package/build/form-toggle/types.js.map +1 -0
- package/build/h-stack/utils.js +3 -3
- package/build/h-stack/utils.js.map +1 -1
- package/build/heading/component.js +0 -1
- package/build/heading/component.js.map +1 -1
- package/build/heading/hook.js.map +1 -1
- package/build/heading/types.js +6 -0
- package/build/heading/types.js.map +1 -0
- package/build/mobile/bottom-sheet/keyboard-avoiding-view.native.js +0 -1
- package/build/mobile/bottom-sheet/keyboard-avoiding-view.native.js.map +1 -1
- package/build/mobile/link-picker/index.native.js +4 -4
- package/build/mobile/link-picker/index.native.js.map +1 -1
- package/build/mobile/segmented-control/index.native.js +2 -4
- package/build/mobile/segmented-control/index.native.js.map +1 -1
- package/build/navigation/group/index.js +4 -7
- package/build/navigation/group/index.js.map +1 -1
- package/build/navigation/item/base.js +3 -3
- package/build/navigation/item/base.js.map +1 -1
- package/build/navigation/item/use-navigation-tree-item.js +2 -1
- package/build/navigation/item/use-navigation-tree-item.js.map +1 -1
- package/build/navigation/menu/menu-title-search.js +1 -7
- package/build/navigation/menu/menu-title-search.js.map +1 -1
- package/build/navigation/menu/search-no-results-found.js +1 -7
- package/build/navigation/menu/search-no-results-found.js.map +1 -1
- package/build/navigation/use-navigation-tree-nodes.js +18 -10
- package/build/navigation/use-navigation-tree-nodes.js.map +1 -1
- package/build/navigation/utils.js +4 -2
- package/build/navigation/utils.js.map +1 -1
- package/build/range-control/index.js +3 -3
- package/build/range-control/index.js.map +1 -1
- package/build/range-control/utils.js +3 -7
- package/build/range-control/utils.js.map +1 -1
- package/build/spacer/component.js +5 -5
- package/build/spacer/component.js.map +1 -1
- package/build/spinner/index.js +26 -13
- package/build/spinner/index.js.map +1 -1
- package/build/spinner/styles.js +10 -10
- package/build/spinner/styles.js.map +1 -1
- package/build/truncate/component.js +7 -8
- package/build/truncate/component.js.map +1 -1
- package/build/truncate/hook.js +3 -10
- package/build/truncate/hook.js.map +1 -1
- package/build/truncate/index.js.map +1 -1
- package/build/truncate/styles.js +1 -1
- package/build/truncate/styles.js.map +1 -1
- package/build/truncate/utils.js +3 -16
- package/build/truncate/utils.js.map +1 -1
- package/build/utils/math.js +17 -7
- package/build/utils/math.js.map +1 -1
- package/build/v-stack/component.js +9 -9
- package/build/v-stack/component.js.map +1 -1
- package/build/v-stack/hook.js +0 -5
- package/build/v-stack/hook.js.map +1 -1
- package/build/v-stack/index.js.map +1 -1
- package/build-module/alignment-matrix-control/utils.js +1 -6
- package/build-module/alignment-matrix-control/utils.js.map +1 -1
- package/build-module/autocomplete/autocompleter-ui.js +4 -2
- package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
- package/build-module/autocomplete/autocompleter-ui.native.js +9 -3
- package/build-module/autocomplete/autocompleter-ui.native.js.map +1 -1
- package/build-module/autocomplete/index.js +4 -2
- package/build-module/autocomplete/index.js.map +1 -1
- package/build-module/border-box-control/border-box-control/component.js +2 -1
- package/build-module/border-box-control/border-box-control/component.js.map +1 -1
- package/build-module/border-box-control/border-box-control-split-controls/component.js +2 -1
- package/build-module/border-box-control/border-box-control-split-controls/component.js.map +1 -1
- package/build-module/border-control/border-control/component.js +38 -3
- package/build-module/border-control/border-control/component.js.map +1 -1
- package/build-module/box-control/utils.js +4 -4
- package/build-module/box-control/utils.js.map +1 -1
- package/build-module/color-indicator/index.js +29 -8
- package/build-module/color-indicator/index.js.map +1 -1
- package/build-module/color-indicator/types.js +2 -0
- package/build-module/color-indicator/types.js.map +1 -0
- package/build-module/color-palette/index.js +2 -1
- package/build-module/color-palette/index.js.map +1 -1
- package/build-module/color-picker/component.js +7 -8
- package/build-module/color-picker/component.js.map +1 -1
- package/build-module/color-picker/input-with-slider.js +1 -2
- package/build-module/color-picker/input-with-slider.js.map +1 -1
- package/build-module/color-picker/styles.js +28 -14
- package/build-module/color-picker/styles.js.map +1 -1
- package/build-module/custom-gradient-picker/index.js +8 -7
- package/build-module/custom-gradient-picker/index.js.map +1 -1
- package/build-module/custom-gradient-picker/index.native.js +8 -8
- package/build-module/custom-gradient-picker/index.native.js.map +1 -1
- package/build-module/custom-gradient-picker/serializer.js +4 -6
- package/build-module/custom-gradient-picker/serializer.js.map +1 -1
- package/build-module/date-time/date/index.js +3 -1
- package/build-module/date-time/date/index.js.map +1 -1
- package/build-module/date-time/date-time/index.js +3 -1
- package/build-module/date-time/date-time/index.js.map +1 -1
- package/build-module/duotone-picker/duotone-picker.js +42 -29
- package/build-module/duotone-picker/duotone-picker.js.map +1 -1
- package/build-module/elevation/hook.js +12 -12
- package/build-module/elevation/hook.js.map +1 -1
- package/build-module/focal-point-picker/index.native.js +1 -1
- package/build-module/focal-point-picker/index.native.js.map +1 -1
- package/build-module/form-toggle/index.js +30 -6
- package/build-module/form-toggle/index.js.map +1 -1
- package/build-module/form-toggle/types.js +2 -0
- package/build-module/form-toggle/types.js.map +1 -0
- package/build-module/h-stack/utils.js +3 -3
- package/build-module/h-stack/utils.js.map +1 -1
- package/build-module/heading/component.js +0 -1
- package/build-module/heading/component.js.map +1 -1
- package/build-module/heading/hook.js.map +1 -1
- package/build-module/heading/types.js +2 -0
- package/build-module/heading/types.js.map +1 -0
- package/build-module/mobile/bottom-sheet/keyboard-avoiding-view.native.js +0 -1
- package/build-module/mobile/bottom-sheet/keyboard-avoiding-view.native.js.map +1 -1
- package/build-module/mobile/link-picker/index.native.js +4 -3
- package/build-module/mobile/link-picker/index.native.js.map +1 -1
- package/build-module/mobile/segmented-control/index.native.js +2 -3
- package/build-module/mobile/segmented-control/index.native.js.map +1 -1
- package/build-module/navigation/group/index.js +3 -6
- package/build-module/navigation/group/index.js.map +1 -1
- package/build-module/navigation/item/base.js +2 -2
- package/build-module/navigation/item/base.js.map +1 -1
- package/build-module/navigation/item/use-navigation-tree-item.js +2 -1
- package/build-module/navigation/item/use-navigation-tree-item.js.map +1 -1
- package/build-module/navigation/menu/menu-title-search.js +1 -6
- package/build-module/navigation/menu/menu-title-search.js.map +1 -1
- package/build-module/navigation/menu/search-no-results-found.js +1 -6
- package/build-module/navigation/menu/search-no-results-found.js.map +1 -1
- package/build-module/navigation/use-navigation-tree-nodes.js +18 -9
- package/build-module/navigation/use-navigation-tree-nodes.js.map +1 -1
- package/build-module/navigation/utils.js +2 -2
- package/build-module/navigation/utils.js.map +1 -1
- package/build-module/range-control/index.js +1 -1
- package/build-module/range-control/index.js.map +1 -1
- package/build-module/range-control/utils.js +1 -5
- package/build-module/range-control/utils.js.map +1 -1
- package/build-module/spacer/component.js +3 -4
- package/build-module/spacer/component.js.map +1 -1
- package/build-module/spinner/index.js +22 -13
- package/build-module/spinner/index.js.map +1 -1
- package/build-module/spinner/styles.js +10 -10
- package/build-module/spinner/styles.js.map +1 -1
- package/build-module/truncate/component.js +7 -8
- package/build-module/truncate/component.js.map +1 -1
- package/build-module/truncate/hook.js +3 -10
- package/build-module/truncate/hook.js.map +1 -1
- package/build-module/truncate/index.js.map +1 -1
- package/build-module/truncate/styles.js +1 -1
- package/build-module/truncate/styles.js.map +1 -1
- package/build-module/truncate/utils.js +3 -16
- package/build-module/truncate/utils.js.map +1 -1
- package/build-module/utils/math.js +15 -6
- package/build-module/utils/math.js.map +1 -1
- package/build-module/v-stack/component.js +9 -9
- package/build-module/v-stack/component.js.map +1 -1
- package/build-module/v-stack/hook.js +0 -5
- package/build-module/v-stack/hook.js.map +1 -1
- package/build-module/v-stack/index.js.map +1 -1
- package/build-style/style-rtl.css +16 -0
- package/build-style/style.css +16 -0
- package/build-types/border-box-control/border-box-control/component.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control-split-controls/component.d.ts.map +1 -1
- package/build-types/border-control/border-control/component.d.ts +36 -2
- package/build-types/border-control/border-control/component.d.ts.map +1 -1
- package/build-types/border-control/stories/index.d.ts +33 -0
- package/build-types/border-control/stories/index.d.ts.map +1 -0
- package/build-types/color-indicator/index.d.ts +16 -5
- package/build-types/color-indicator/index.d.ts.map +1 -1
- package/build-types/color-indicator/stories/index.d.ts +12 -0
- package/build-types/color-indicator/stories/index.d.ts.map +1 -0
- package/build-types/color-indicator/test/index.d.ts +2 -0
- package/build-types/color-indicator/test/index.d.ts.map +1 -0
- package/build-types/color-indicator/types.d.ts +12 -0
- package/build-types/color-indicator/types.d.ts.map +1 -0
- package/build-types/color-palette/index.d.ts.map +1 -1
- package/build-types/color-palette/styles.d.ts +4 -2
- package/build-types/color-palette/styles.d.ts.map +1 -1
- package/build-types/color-picker/component.d.ts.map +1 -1
- package/build-types/color-picker/styles.d.ts +17 -0
- package/build-types/color-picker/styles.d.ts.map +1 -1
- package/build-types/date-time/date/index.d.ts +1 -1
- package/build-types/date-time/date/index.d.ts.map +1 -1
- package/build-types/date-time/date-time/index.d.ts.map +1 -1
- package/build-types/date-time/types.d.ts +6 -0
- package/build-types/date-time/types.d.ts.map +1 -1
- package/build-types/form-toggle/index.d.ts +29 -0
- package/build-types/form-toggle/index.d.ts.map +1 -0
- package/build-types/form-toggle/stories/index.d.ts +12 -0
- package/build-types/form-toggle/stories/index.d.ts.map +1 -0
- package/build-types/form-toggle/test/index.d.ts +2 -0
- package/build-types/form-toggle/test/index.d.ts.map +1 -0
- package/build-types/form-toggle/types.d.ts +22 -0
- package/build-types/form-toggle/types.d.ts.map +1 -0
- package/build-types/form-token-field/test/lib/token-field-wrapper.d.ts +3 -0
- package/build-types/form-token-field/test/lib/token-field-wrapper.d.ts.map +1 -1
- package/build-types/heading/component.d.ts +1 -2
- package/build-types/heading/component.d.ts.map +1 -1
- package/build-types/heading/hook.d.ts +1 -28
- package/build-types/heading/hook.d.ts.map +1 -1
- package/build-types/heading/stories/index.d.ts.map +1 -1
- package/build-types/heading/test/index.d.ts +2 -0
- package/build-types/heading/test/index.d.ts.map +1 -0
- package/build-types/heading/types.d.ts +16 -0
- package/build-types/heading/types.d.ts.map +1 -0
- package/build-types/range-control/utils.d.ts.map +1 -1
- package/build-types/spacer/component.d.ts +2 -3
- package/build-types/spacer/component.d.ts.map +1 -1
- package/build-types/spacer/stories/index.d.ts +12 -0
- package/build-types/spacer/stories/index.d.ts.map +1 -0
- package/build-types/spinner/index.d.ts +16 -15
- package/build-types/spinner/index.d.ts.map +1 -1
- package/build-types/spinner/stories/index.d.ts +13 -0
- package/build-types/spinner/stories/index.d.ts.map +1 -0
- package/build-types/spinner/styles.d.ts +4 -3
- package/build-types/spinner/styles.d.ts.map +1 -1
- package/build-types/text/types.d.ts +1 -1
- package/build-types/text/types.d.ts.map +1 -1
- package/build-types/truncate/component.d.ts +3 -3
- package/build-types/truncate/component.d.ts.map +1 -1
- package/build-types/truncate/hook.d.ts +5 -2
- package/build-types/truncate/hook.d.ts.map +1 -1
- package/build-types/truncate/index.d.ts +2 -2
- package/build-types/truncate/index.d.ts.map +1 -1
- package/build-types/truncate/stories/index.d.ts +13 -0
- package/build-types/truncate/stories/index.d.ts.map +1 -0
- package/build-types/truncate/styles.d.ts +1 -1
- package/build-types/truncate/styles.d.ts.map +1 -1
- package/build-types/truncate/test/index.d.ts +2 -0
- package/build-types/truncate/test/index.d.ts.map +1 -0
- package/build-types/truncate/types.d.ts +22 -11
- package/build-types/truncate/types.d.ts.map +1 -1
- package/build-types/truncate/utils.d.ts +17 -28
- package/build-types/truncate/utils.d.ts.map +1 -1
- package/build-types/ui/form-group/use-form-group.d.ts +2 -2
- package/build-types/utils/math.d.ts +10 -0
- package/build-types/utils/math.d.ts.map +1 -1
- package/build-types/v-stack/component.d.ts +5 -4
- package/build-types/v-stack/component.d.ts.map +1 -1
- package/build-types/v-stack/hook.d.ts +5 -3
- package/build-types/v-stack/hook.d.ts.map +1 -1
- package/build-types/v-stack/index.d.ts +2 -2
- package/build-types/v-stack/index.d.ts.map +1 -1
- package/build-types/v-stack/stories/index.d.ts +9 -0
- package/build-types/v-stack/stories/index.d.ts.map +1 -0
- package/build-types/v-stack/test/index.d.ts +2 -0
- package/build-types/v-stack/test/index.d.ts.map +1 -0
- package/build-types/v-stack/types.d.ts +21 -1
- package/build-types/v-stack/types.d.ts.map +1 -1
- package/package.json +18 -17
- package/src/alignment-matrix-control/utils.js +1 -6
- package/src/autocomplete/autocompleter-ui.js +4 -1
- package/src/autocomplete/autocompleter-ui.native.js +8 -2
- package/src/autocomplete/index.js +4 -8
- package/src/border-box-control/border-box-control/component.tsx +1 -0
- package/src/border-box-control/border-box-control-split-controls/component.tsx +1 -0
- package/src/border-control/border-control/component.tsx +41 -4
- package/src/border-control/stories/index.tsx +150 -0
- package/src/box-control/utils.js +4 -4
- package/src/color-indicator/README.md +7 -9
- package/src/color-indicator/index.tsx +47 -0
- package/src/color-indicator/stories/index.tsx +37 -0
- package/src/color-indicator/test/__snapshots__/index.tsx.snap +11 -0
- package/src/color-indicator/test/{index.js → index.tsx} +4 -4
- package/src/color-indicator/types.ts +12 -0
- package/src/color-palette/index.js +5 -1
- package/src/color-picker/component.tsx +12 -11
- package/src/color-picker/input-with-slider.tsx +2 -2
- package/src/color-picker/styles.ts +20 -1
- package/src/custom-gradient-picker/index.js +4 -11
- package/src/custom-gradient-picker/index.native.js +3 -11
- package/src/custom-gradient-picker/serializer.js +5 -11
- package/src/date-time/README.md +7 -0
- package/src/date-time/date/index.tsx +2 -0
- package/src/date-time/date-time/index.tsx +2 -0
- package/src/date-time/types.ts +7 -0
- package/src/dimension-control/README.md +5 -2
- package/src/dimension-control/test/index.test.js +7 -7
- package/src/duotone-picker/duotone-picker.js +58 -37
- package/src/duotone-picker/style.scss +19 -0
- package/src/elevation/hook.js +8 -8
- package/src/flex/flex/README.md +5 -10
- package/src/flex/flex-item/README.md +1 -1
- package/src/focal-point-picker/index.native.js +1 -1
- package/src/form-toggle/README.md +10 -11
- package/src/form-toggle/index.tsx +71 -0
- package/src/form-toggle/stories/index.tsx +52 -0
- package/src/form-toggle/test/__snapshots__/index.tsx.snap +54 -0
- package/src/form-toggle/test/index.tsx +102 -0
- package/src/form-toggle/types.ts +22 -0
- package/src/form-token-field/test/index.js +6 -9
- package/src/form-token-field/test/lib/token-field-wrapper.tsx +2 -2
- package/src/h-stack/utils.js +3 -3
- package/src/heading/README.md +4 -3
- package/src/heading/component.tsx +2 -2
- package/src/heading/hook.ts +1 -42
- package/src/heading/stories/index.tsx +5 -1
- package/src/heading/test/__snapshots__/{index.js.snap → index.tsx.snap} +0 -0
- package/src/heading/test/index.tsx +68 -0
- package/src/heading/types.ts +29 -0
- package/src/input-control/test/index.js +106 -31
- package/src/mobile/bottom-sheet/keyboard-avoiding-view.native.js +2 -7
- package/src/mobile/link-picker/index.native.js +2 -3
- package/src/mobile/segmented-control/index.native.js +6 -5
- package/src/navigation/group/index.js +8 -3
- package/src/navigation/item/base.js +3 -2
- package/src/navigation/item/use-navigation-tree-item.js +2 -0
- package/src/navigation/menu/menu-title-search.js +3 -6
- package/src/navigation/menu/search-no-results-found.js +3 -6
- package/src/navigation/use-navigation-tree-nodes.js +11 -10
- package/src/navigation/utils.js +2 -2
- package/src/number-control/stories/index.js +24 -24
- package/src/range-control/index.js +1 -1
- package/src/range-control/utils.js +1 -4
- package/src/slot-fill/test/slot.js +2 -3
- package/src/spacer/component.tsx +3 -4
- package/src/spacer/stories/index.tsx +70 -0
- package/src/spinner/{index.js → index.tsx} +23 -9
- package/src/spinner/stories/index.tsx +32 -0
- package/src/spinner/{styles.js → styles.ts} +0 -0
- package/src/style.scss +1 -0
- package/src/text/types.ts +1 -1
- package/src/truncate/README.md +16 -12
- package/src/truncate/{component.js → component.tsx} +13 -9
- package/src/truncate/{hook.js → hook.ts} +8 -10
- package/src/truncate/{index.js → index.ts} +0 -0
- package/src/truncate/stories/index.tsx +49 -0
- package/src/truncate/{styles.js → styles.ts} +0 -0
- package/src/truncate/test/{index.js → index.tsx} +4 -4
- package/src/truncate/types.ts +28 -10
- package/src/truncate/{utils.js → utils.ts} +19 -19
- package/src/utils/math.js +14 -5
- package/src/utils/test/math.js +22 -1
- package/src/v-stack/README.md +6 -18
- package/src/v-stack/{component.js → component.tsx} +15 -10
- package/src/v-stack/{hook.js → hook.ts} +5 -6
- package/src/v-stack/{index.js → index.ts} +0 -0
- package/src/v-stack/stories/index.tsx +41 -0
- package/src/v-stack/test/__snapshots__/{index.js.snap → index.tsx.snap} +0 -0
- package/src/v-stack/test/{index.js → index.tsx} +0 -0
- package/src/v-stack/types.ts +21 -1
- package/tsconfig.json +1 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/src/border-control/stories/index.js +0 -119
- package/src/color-indicator/index.js +0 -16
- package/src/color-indicator/stories/index.js +0 -22
- package/src/color-indicator/test/__snapshots__/index.js.snap +0 -13
- package/src/form-toggle/index.js +0 -38
- package/src/form-toggle/stories/index.js +0 -28
- package/src/form-toggle/test/index.js +0 -74
- package/src/heading/test/index.js +0 -67
- package/src/spacer/stories/index.js +0 -59
- package/src/spinner/stories/index.js +0 -43
- package/src/truncate/stories/index.js +0 -38
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { flattenDeep } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -28,7 +23,7 @@ export const ALIGNMENT_LABEL = {
|
|
|
28
23
|
};
|
|
29
24
|
|
|
30
25
|
// Transforms GRID into a flat Array of values.
|
|
31
|
-
export const ALIGNMENTS =
|
|
26
|
+
export const ALIGNMENTS = GRID.flat();
|
|
32
27
|
|
|
33
28
|
/**
|
|
34
29
|
* Parses and transforms an incoming value to better match the alignment values
|
|
@@ -39,7 +39,10 @@ export function getAutoCompleterUI( autocompleter ) {
|
|
|
39
39
|
|
|
40
40
|
useLayoutEffect( () => {
|
|
41
41
|
onChangeOptions( items );
|
|
42
|
-
|
|
42
|
+
// Temporarily disabling exhaustive-deps to avoid introducing unexpected side effecst.
|
|
43
|
+
// See https://github.com/WordPress/gutenberg/pull/41820
|
|
44
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
45
|
+
}, [ items ] );
|
|
43
46
|
|
|
44
47
|
if ( ! items.length > 0 ) {
|
|
45
48
|
return null;
|
|
@@ -71,7 +71,10 @@ export function getAutoCompleterUI( autocompleter ) {
|
|
|
71
71
|
} else if ( isVisible && text.length === 0 ) {
|
|
72
72
|
startAnimation( false );
|
|
73
73
|
}
|
|
74
|
-
|
|
74
|
+
// Temporarily disabling exhaustive-deps to avoid introducing unexpected side effecst.
|
|
75
|
+
// See https://github.com/WordPress/gutenberg/pull/41820
|
|
76
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
77
|
+
}, [ items, isVisible, text ] );
|
|
75
78
|
|
|
76
79
|
const activeItemStyles = usePreferredColorSchemeStyle(
|
|
77
80
|
styles[ 'components-autocomplete__item-active' ],
|
|
@@ -111,7 +114,10 @@ export function getAutoCompleterUI( autocompleter ) {
|
|
|
111
114
|
}
|
|
112
115
|
} );
|
|
113
116
|
},
|
|
114
|
-
|
|
117
|
+
// Temporarily disabling exhaustive-deps to avoid introducing unexpected side effecst.
|
|
118
|
+
// See https://github.com/WordPress/gutenberg/pull/41820
|
|
119
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
120
|
+
[ isVisible ]
|
|
115
121
|
);
|
|
116
122
|
|
|
117
123
|
const contentStyles = {
|
|
@@ -375,14 +375,10 @@ function useAutocomplete( {
|
|
|
375
375
|
: AutocompleterUI
|
|
376
376
|
);
|
|
377
377
|
setFilterValue( query );
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
completers,
|
|
383
|
-
record,
|
|
384
|
-
filteredOptions.length,
|
|
385
|
-
] );
|
|
378
|
+
// Temporarily disabling exhaustive-deps to avoid introducing unexpected side effecst.
|
|
379
|
+
// See https://github.com/WordPress/gutenberg/pull/41820
|
|
380
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
381
|
+
}, [ textContent ] );
|
|
386
382
|
|
|
387
383
|
const { key: selectedKey = '' } = filteredOptions[ selectedIndex ] || {};
|
|
388
384
|
const { className } = autocompleter || {};
|
|
@@ -27,8 +27,8 @@ const BorderLabel = ( props: LabelProps ) => {
|
|
|
27
27
|
);
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
const
|
|
31
|
-
props: WordPressComponentProps< BorderControlProps, 'div' >,
|
|
30
|
+
const UnconnectedBorderControl = (
|
|
31
|
+
props: WordPressComponentProps< BorderControlProps, 'div', false >,
|
|
32
32
|
forwardedRef: React.ForwardedRef< any >
|
|
33
33
|
) => {
|
|
34
34
|
const {
|
|
@@ -109,6 +109,43 @@ const BorderControl = (
|
|
|
109
109
|
);
|
|
110
110
|
};
|
|
111
111
|
|
|
112
|
-
|
|
112
|
+
/**
|
|
113
|
+
* The `BorderControl` brings together internal sub-components which allow users to
|
|
114
|
+
* set the various properties of a border. The first sub-component, a
|
|
115
|
+
* `BorderDropdown` contains options representing border color and style. The
|
|
116
|
+
* border width is controlled via a `UnitControl` and an optional `RangeControl`.
|
|
117
|
+
*
|
|
118
|
+
* Border radius is not covered by this control as it may be desired separate to
|
|
119
|
+
* color, style, and width. For example, the border radius may be absorbed under
|
|
120
|
+
* a "shape" abstraction.
|
|
121
|
+
*
|
|
122
|
+
* ```jsx
|
|
123
|
+
* import { __experimentalBorderControl as BorderControl } from '@wordpress/components';
|
|
124
|
+
* import { __ } from '@wordpress/i18n';
|
|
125
|
+
*
|
|
126
|
+
* const colors = [
|
|
127
|
+
* { name: 'Blue 20', color: '#72aee6' },
|
|
128
|
+
* // ...
|
|
129
|
+
* ];
|
|
130
|
+
*
|
|
131
|
+
* const MyBorderControl = () => {
|
|
132
|
+
* const [ border, setBorder ] = useState();
|
|
133
|
+
* const onChange = ( newBorder ) => setBorder( newBorder );
|
|
134
|
+
*
|
|
135
|
+
* return (
|
|
136
|
+
* <BorderControl
|
|
137
|
+
* colors={ colors }
|
|
138
|
+
* label={ __( 'Border' ) }
|
|
139
|
+
* onChange={ onChange }
|
|
140
|
+
* value={ border }
|
|
141
|
+
* />
|
|
142
|
+
* );
|
|
143
|
+
* };
|
|
144
|
+
* ```
|
|
145
|
+
*/
|
|
146
|
+
export const BorderControl = contextConnect(
|
|
147
|
+
UnconnectedBorderControl,
|
|
148
|
+
'BorderControl'
|
|
149
|
+
);
|
|
113
150
|
|
|
114
|
-
export default
|
|
151
|
+
export default BorderControl;
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
5
|
+
import type { ComponentProps } from 'react';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* WordPress dependencies
|
|
9
|
+
*/
|
|
10
|
+
import { useState } from '@wordpress/element';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Internal dependencies
|
|
14
|
+
*/
|
|
15
|
+
import { BorderControl } from '..';
|
|
16
|
+
import { Provider as SlotFillProvider } from '../../slot-fill';
|
|
17
|
+
import Popover from '../../popover';
|
|
18
|
+
import type { Border } from '../types';
|
|
19
|
+
|
|
20
|
+
const meta: ComponentMeta< typeof BorderControl > = {
|
|
21
|
+
title: 'Components (Experimental)/BorderControl',
|
|
22
|
+
component: BorderControl,
|
|
23
|
+
argTypes: {
|
|
24
|
+
onChange: {
|
|
25
|
+
action: 'onChange',
|
|
26
|
+
},
|
|
27
|
+
width: { control: { type: 'text' } },
|
|
28
|
+
value: { control: { type: null } },
|
|
29
|
+
},
|
|
30
|
+
parameters: {
|
|
31
|
+
controls: { expanded: true },
|
|
32
|
+
docs: { source: { state: 'open' } },
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
export default meta;
|
|
36
|
+
|
|
37
|
+
// Available border colors.
|
|
38
|
+
const colors = [
|
|
39
|
+
{ name: 'Blue', color: '#72aee6' },
|
|
40
|
+
{ name: 'Red', color: '#e65054' },
|
|
41
|
+
{ name: 'Yellow', color: '#f2d675' },
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
// Multiple origin colors.
|
|
45
|
+
const multipleOriginColors = [
|
|
46
|
+
{
|
|
47
|
+
name: 'Default',
|
|
48
|
+
colors: [
|
|
49
|
+
{ name: 'Gray 20', color: '#a7aaad' },
|
|
50
|
+
{ name: 'Gray 70', color: '#3c434a' },
|
|
51
|
+
],
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: 'Theme',
|
|
55
|
+
colors: [
|
|
56
|
+
{ name: 'Blue 20', color: '#72aee6' },
|
|
57
|
+
{ name: 'Blue 40', color: '#3582c4' },
|
|
58
|
+
{ name: 'Blue 70', color: '#0a4b78' },
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
name: 'User',
|
|
63
|
+
colors: [
|
|
64
|
+
{ name: 'Green', color: '#00a32a' },
|
|
65
|
+
{ name: 'Yellow', color: '#f2d675' },
|
|
66
|
+
],
|
|
67
|
+
},
|
|
68
|
+
];
|
|
69
|
+
|
|
70
|
+
const Template: ComponentStory< typeof BorderControl > = ( {
|
|
71
|
+
onChange,
|
|
72
|
+
...props
|
|
73
|
+
} ) => {
|
|
74
|
+
const [ border, setBorder ] = useState< Border >();
|
|
75
|
+
const onChangeMerged: ComponentProps<
|
|
76
|
+
typeof BorderControl
|
|
77
|
+
>[ 'onChange' ] = ( newBorder ) => {
|
|
78
|
+
setBorder( newBorder );
|
|
79
|
+
onChange( newBorder );
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
return (
|
|
83
|
+
<SlotFillProvider>
|
|
84
|
+
<div style={ { maxWidth: '280px' } }>
|
|
85
|
+
<BorderControl
|
|
86
|
+
onChange={ onChangeMerged }
|
|
87
|
+
value={ border }
|
|
88
|
+
{ ...props }
|
|
89
|
+
/>
|
|
90
|
+
</div>
|
|
91
|
+
{ /* @ts-expect-error Ignore until Popover is converted to TS */ }
|
|
92
|
+
<Popover.Slot />
|
|
93
|
+
</SlotFillProvider>
|
|
94
|
+
);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export const Default = Template.bind( {} );
|
|
98
|
+
Default.args = {
|
|
99
|
+
colors,
|
|
100
|
+
label: 'Border',
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Render a slider beside the control.
|
|
105
|
+
*/
|
|
106
|
+
export const WithSlider = Template.bind( {} );
|
|
107
|
+
WithSlider.args = {
|
|
108
|
+
...Default.args,
|
|
109
|
+
withSlider: true,
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* When rendering with a slider, the `width` prop is useful to customize the width of the number input.
|
|
114
|
+
*/
|
|
115
|
+
export const WithSliderCustomWidth = Template.bind( {} );
|
|
116
|
+
WithSliderCustomWidth.args = {
|
|
117
|
+
...Default.args,
|
|
118
|
+
withSlider: true,
|
|
119
|
+
width: '150px',
|
|
120
|
+
};
|
|
121
|
+
WithSliderCustomWidth.storyName = 'With Slider (Custom Width)';
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Restrict the width of the control and prevent it from expanding to take up additional space.
|
|
125
|
+
* When `true`, the `width` prop will be ignored.
|
|
126
|
+
*/
|
|
127
|
+
export const IsCompact = Template.bind( {} );
|
|
128
|
+
IsCompact.args = {
|
|
129
|
+
...Default.args,
|
|
130
|
+
isCompact: true,
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* The `colors` object can contain multiple origins.
|
|
135
|
+
*/
|
|
136
|
+
export const WithMultipleOrigins = Template.bind( {} );
|
|
137
|
+
WithMultipleOrigins.args = {
|
|
138
|
+
...Default.args,
|
|
139
|
+
colors: multipleOriginColors,
|
|
140
|
+
__experimentalHasMultipleOrigins: true,
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Allow the alpha channel to be edited on each color.
|
|
145
|
+
*/
|
|
146
|
+
export const WithAlphaEnabled = Template.bind( {} );
|
|
147
|
+
WithAlphaEnabled.args = {
|
|
148
|
+
...Default.args,
|
|
149
|
+
enableAlpha: true,
|
|
150
|
+
};
|
package/src/box-control/utils.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { isEmpty
|
|
4
|
+
import { isEmpty } from 'lodash';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -82,16 +82,16 @@ export function getAllValue(
|
|
|
82
82
|
: '';
|
|
83
83
|
|
|
84
84
|
/**
|
|
85
|
-
* The
|
|
85
|
+
* The typeof === 'number' check is important. On reset actions, the incoming value
|
|
86
86
|
* may be null or an empty string.
|
|
87
87
|
*
|
|
88
88
|
* Also, the value may also be zero (0), which is considered a valid unit value.
|
|
89
89
|
*
|
|
90
|
-
*
|
|
90
|
+
* typeof === 'number' is more specific for these cases, rather than relying on a
|
|
91
91
|
* simple truthy check.
|
|
92
92
|
*/
|
|
93
93
|
let commonUnit;
|
|
94
|
-
if (
|
|
94
|
+
if ( typeof commonQuantity === 'number' ) {
|
|
95
95
|
commonUnit = mode( allParsedUnits );
|
|
96
96
|
} else {
|
|
97
97
|
// Set meaningful unit selection if no commonQuantity and user has previously
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# ColorIndicator
|
|
2
2
|
|
|
3
|
-
ColorIndicator is a React component that renders a specific color in a
|
|
3
|
+
ColorIndicator is a React component that renders a specific color in a circle. It's often used to summarize a collection of used colors in a child component.
|
|
4
4
|
|
|
5
5
|
### Single component
|
|
6
6
|
|
|
@@ -22,16 +22,14 @@ const MyColorIndicator = () => <ColorIndicator colorValue="#0073aa" />;
|
|
|
22
22
|
|
|
23
23
|
The component accepts the following props:
|
|
24
24
|
|
|
25
|
-
###
|
|
25
|
+
### `className`: `string`
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
Extra classes for the used `<span>` element. By default only `component-color-indicator` is added.
|
|
28
28
|
|
|
29
|
-
-
|
|
30
|
-
- Required: Yes
|
|
29
|
+
- Required: No
|
|
31
30
|
|
|
32
|
-
###
|
|
31
|
+
### `colorValue`: `CSSProperties[ 'background' ]`
|
|
33
32
|
|
|
34
|
-
|
|
33
|
+
The color of the indicator. Any value from the CSS [`background`](https://developer.mozilla.org/en-US/docs/Web/CSS/background) property is supported.
|
|
35
34
|
|
|
36
|
-
-
|
|
37
|
-
- Required: No
|
|
35
|
+
- Required: Yes
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import classnames from 'classnames';
|
|
5
|
+
import type { ForwardedRef } from 'react';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* WordPress dependencies
|
|
9
|
+
*/
|
|
10
|
+
import { forwardRef } from '@wordpress/element';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Internal dependencies
|
|
14
|
+
*/
|
|
15
|
+
import type { WordPressComponentProps } from '../ui/context';
|
|
16
|
+
import type { ColorIndicatorProps } from './types';
|
|
17
|
+
|
|
18
|
+
function UnforwardedColorIndicator(
|
|
19
|
+
props: WordPressComponentProps< ColorIndicatorProps, 'span', false >,
|
|
20
|
+
forwardedRef: ForwardedRef< HTMLSpanElement >
|
|
21
|
+
) {
|
|
22
|
+
const { className, colorValue, ...additionalProps } = props;
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<span
|
|
26
|
+
className={ classnames( 'component-color-indicator', className ) }
|
|
27
|
+
style={ { background: colorValue } }
|
|
28
|
+
ref={ forwardedRef }
|
|
29
|
+
{ ...additionalProps }
|
|
30
|
+
/>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* ColorIndicator is a React component that renders a specific color in a
|
|
36
|
+
* circle. It's often used to summarize a collection of used colors in a child
|
|
37
|
+
* component.
|
|
38
|
+
*
|
|
39
|
+
* ```jsx
|
|
40
|
+
* import { ColorIndicator } from '@wordpress/components';
|
|
41
|
+
*
|
|
42
|
+
* const MyColorIndicator = () => <ColorIndicator colorValue="#0073aa" />;
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export const ColorIndicator = forwardRef( UnforwardedColorIndicator );
|
|
46
|
+
|
|
47
|
+
export default ColorIndicator;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import ColorIndicator from '..';
|
|
10
|
+
|
|
11
|
+
const meta: ComponentMeta< typeof ColorIndicator > = {
|
|
12
|
+
component: ColorIndicator,
|
|
13
|
+
title: 'Components/ColorIndicator',
|
|
14
|
+
argTypes: {
|
|
15
|
+
colorValue: {
|
|
16
|
+
control: { type: 'color' },
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
parameters: {
|
|
20
|
+
controls: {
|
|
21
|
+
expanded: true,
|
|
22
|
+
},
|
|
23
|
+
docs: { source: { state: 'open' } },
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
export default meta;
|
|
27
|
+
|
|
28
|
+
const Template: ComponentStory< typeof ColorIndicator > = ( { ...args } ) => (
|
|
29
|
+
<ColorIndicator { ...args } />
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
export const Default: ComponentStory< typeof ColorIndicator > = Template.bind(
|
|
33
|
+
{}
|
|
34
|
+
);
|
|
35
|
+
Default.args = {
|
|
36
|
+
colorValue: '#0073aa',
|
|
37
|
+
};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { render } from '@testing-library/react';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
8
8
|
*/
|
|
9
|
-
import ColorIndicator from '
|
|
9
|
+
import ColorIndicator from '..';
|
|
10
10
|
|
|
11
11
|
describe( 'ColorIndicator', () => {
|
|
12
12
|
it( 'matches the snapshot', () => {
|
|
13
|
-
const
|
|
13
|
+
const { container } = render(
|
|
14
14
|
<ColorIndicator aria-label="sample label" colorValue="#fff" />
|
|
15
15
|
);
|
|
16
16
|
|
|
17
|
-
expect(
|
|
17
|
+
expect( container ).toMatchSnapshot();
|
|
18
18
|
} );
|
|
19
19
|
} );
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { CSSProperties } from 'react';
|
|
5
|
+
|
|
6
|
+
export type ColorIndicatorProps = {
|
|
7
|
+
/**
|
|
8
|
+
* The color of the indicator. Any value from the CSS `background` property
|
|
9
|
+
* is supported.
|
|
10
|
+
*/
|
|
11
|
+
colorValue: CSSProperties[ 'background' ];
|
|
12
|
+
};
|
|
@@ -118,7 +118,11 @@ export function CustomColorPickerDropdown( { isRenderedInSidebar, ...props } ) {
|
|
|
118
118
|
contentClassName="components-color-palette__custom-color-dropdown-content"
|
|
119
119
|
popoverProps={
|
|
120
120
|
isRenderedInSidebar
|
|
121
|
-
? {
|
|
121
|
+
? {
|
|
122
|
+
placement: 'left-start',
|
|
123
|
+
offset: 20,
|
|
124
|
+
__unstableShift: true,
|
|
125
|
+
}
|
|
122
126
|
: undefined
|
|
123
127
|
}
|
|
124
128
|
{ ...props }
|
|
@@ -20,12 +20,12 @@ import {
|
|
|
20
20
|
contextConnect,
|
|
21
21
|
WordPressComponentProps,
|
|
22
22
|
} from '../ui/context';
|
|
23
|
-
import { HStack } from '../h-stack';
|
|
24
|
-
import { Spacer } from '../spacer';
|
|
25
23
|
import {
|
|
26
24
|
ColorfulWrapper,
|
|
27
25
|
SelectControl,
|
|
28
26
|
AuxiliaryColorArtefactWrapper,
|
|
27
|
+
AuxiliaryColorArtefactHStackHeader,
|
|
28
|
+
ColorInputWrapper,
|
|
29
29
|
} from './styles';
|
|
30
30
|
import { ColorCopyButton } from './color-copy-button';
|
|
31
31
|
import { ColorInput } from './color-input';
|
|
@@ -95,7 +95,7 @@ const ColorPicker = (
|
|
|
95
95
|
enableAlpha={ enableAlpha }
|
|
96
96
|
/>
|
|
97
97
|
<AuxiliaryColorArtefactWrapper>
|
|
98
|
-
<
|
|
98
|
+
<AuxiliaryColorArtefactHStackHeader justify="space-between">
|
|
99
99
|
<SelectControl
|
|
100
100
|
options={ options }
|
|
101
101
|
value={ colorType }
|
|
@@ -109,14 +109,15 @@ const ColorPicker = (
|
|
|
109
109
|
color={ safeColordColor }
|
|
110
110
|
colorType={ copyFormat || colorType }
|
|
111
111
|
/>
|
|
112
|
-
</
|
|
113
|
-
<
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
112
|
+
</AuxiliaryColorArtefactHStackHeader>
|
|
113
|
+
<ColorInputWrapper direction="column" gap={ 2 }>
|
|
114
|
+
<ColorInput
|
|
115
|
+
colorType={ colorType }
|
|
116
|
+
color={ safeColordColor }
|
|
117
|
+
onChange={ handleChange }
|
|
118
|
+
enableAlpha={ enableAlpha }
|
|
119
|
+
/>
|
|
120
|
+
</ColorInputWrapper>
|
|
120
121
|
</AuxiliaryColorArtefactWrapper>
|
|
121
122
|
</ColorfulWrapper>
|
|
122
123
|
);
|
|
@@ -26,7 +26,7 @@ export const InputWithSlider = ( {
|
|
|
26
26
|
value,
|
|
27
27
|
}: InputWithSliderProps ) => {
|
|
28
28
|
return (
|
|
29
|
-
<
|
|
29
|
+
<HStack spacing={ 4 }>
|
|
30
30
|
<NumberControlWrapper
|
|
31
31
|
min={ min }
|
|
32
32
|
max={ max }
|
|
@@ -55,6 +55,6 @@ export const InputWithSlider = ( {
|
|
|
55
55
|
onChange={ onChange }
|
|
56
56
|
withInputField={ false }
|
|
57
57
|
/>
|
|
58
|
-
</
|
|
58
|
+
</HStack>
|
|
59
59
|
);
|
|
60
60
|
};
|
|
@@ -12,6 +12,8 @@ import InnerRangeControl from '../range-control';
|
|
|
12
12
|
import { StyledField } from '../base-control/styles/base-control-styles';
|
|
13
13
|
import { space } from '../ui/utils/space';
|
|
14
14
|
import Button from '../button';
|
|
15
|
+
import { Flex } from '../flex';
|
|
16
|
+
import { HStack } from '../h-stack';
|
|
15
17
|
import {
|
|
16
18
|
BackdropUI,
|
|
17
19
|
Container as InputControlContainer,
|
|
@@ -36,6 +38,7 @@ export const SelectControl = styled( InnerSelectControl )`
|
|
|
36
38
|
|
|
37
39
|
export const RangeControl = styled( InnerRangeControl )`
|
|
38
40
|
flex: 1;
|
|
41
|
+
margin-right: ${ space( 2 ) };
|
|
39
42
|
|
|
40
43
|
${ StyledField } {
|
|
41
44
|
margin-bottom: 0;
|
|
@@ -58,7 +61,22 @@ const interactiveHueStyles = `
|
|
|
58
61
|
}`;
|
|
59
62
|
|
|
60
63
|
export const AuxiliaryColorArtefactWrapper = styled.div`
|
|
61
|
-
padding: ${ space( 2 ) }
|
|
64
|
+
padding-top: ${ space( 2 ) };
|
|
65
|
+
padding-right: 0;
|
|
66
|
+
padding-left: 0;
|
|
67
|
+
padding-bottom: 0;
|
|
68
|
+
`;
|
|
69
|
+
|
|
70
|
+
export const AuxiliaryColorArtefactHStackHeader = styled( HStack )`
|
|
71
|
+
padding-left: ${ space( 4 ) };
|
|
72
|
+
padding-right: ${ space( 4 ) };
|
|
73
|
+
`;
|
|
74
|
+
|
|
75
|
+
export const ColorInputWrapper = styled( Flex )`
|
|
76
|
+
padding-top: ${ space( 4 ) };
|
|
77
|
+
padding-left: ${ space( 4 ) };
|
|
78
|
+
padding-right: ${ space( 3 ) };
|
|
79
|
+
padding-bottom: ${ space( 5 ) };
|
|
62
80
|
`;
|
|
63
81
|
|
|
64
82
|
export const ColorfulWrapper = styled.div`
|
|
@@ -70,6 +88,7 @@ export const ColorfulWrapper = styled.div`
|
|
|
70
88
|
align-items: center;
|
|
71
89
|
width: 216px;
|
|
72
90
|
height: auto;
|
|
91
|
+
overflow: hidden;
|
|
73
92
|
}
|
|
74
93
|
|
|
75
94
|
.react-colorful__saturation {
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { get, omit } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -34,11 +29,8 @@ import {
|
|
|
34
29
|
} from './styles/custom-gradient-picker-styles';
|
|
35
30
|
|
|
36
31
|
const GradientAnglePicker = ( { gradientAST, hasGradient, onChange } ) => {
|
|
37
|
-
const angle =
|
|
38
|
-
gradientAST
|
|
39
|
-
[ 'orientation', 'value' ],
|
|
40
|
-
DEFAULT_LINEAR_GRADIENT_ANGLE
|
|
41
|
-
);
|
|
32
|
+
const angle =
|
|
33
|
+
gradientAST?.orientation?.value ?? DEFAULT_LINEAR_GRADIENT_ANGLE;
|
|
42
34
|
const onAngleChange = ( newAngle ) => {
|
|
43
35
|
onChange(
|
|
44
36
|
serializeGradient( {
|
|
@@ -74,9 +66,10 @@ const GradientTypePicker = ( { gradientAST, hasGradient, onChange } ) => {
|
|
|
74
66
|
};
|
|
75
67
|
|
|
76
68
|
const onSetRadialGradient = () => {
|
|
69
|
+
const { orientation, ...restGradientAST } = gradientAST;
|
|
77
70
|
onChange(
|
|
78
71
|
serializeGradient( {
|
|
79
|
-
...
|
|
72
|
+
...restGradientAST,
|
|
80
73
|
type: 'radial-gradient',
|
|
81
74
|
} )
|
|
82
75
|
);
|