@wordpress/components 19.14.0 → 19.15.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 +51 -12
- package/build/autocomplete/get-default-use-items.js +5 -1
- package/build/autocomplete/get-default-use-items.js.map +1 -1
- package/build/autocomplete/index.js +5 -1
- package/build/autocomplete/index.js.map +1 -1
- package/build/border-control/border-control/hook.js.map +1 -1
- package/build/box-control/index.js +1 -1
- package/build/box-control/index.js.map +1 -1
- package/build/color-picker/hex-input.js +5 -4
- package/build/color-picker/hex-input.js.map +1 -1
- package/build/color-picker/index.native.js +35 -34
- package/build/color-picker/index.native.js.map +1 -1
- package/build/color-picker/input-with-slider.js +3 -1
- package/build/color-picker/input-with-slider.js.map +1 -1
- package/build/color-picker/styles.js +31 -43
- package/build/color-picker/styles.js.map +1 -1
- package/build/color-picker/use-deprecated-props.js +22 -31
- package/build/color-picker/use-deprecated-props.js.map +1 -1
- package/build/combobox-control/index.js +14 -6
- package/build/combobox-control/index.js.map +1 -1
- package/build/combobox-control/styles.js +39 -0
- package/build/combobox-control/styles.js.map +1 -0
- package/build/dropdown-menu/index.js +5 -5
- package/build/dropdown-menu/index.js.map +1 -1
- package/build/dropdown-menu/index.native.js +5 -5
- package/build/dropdown-menu/index.native.js.map +1 -1
- package/build/elevation/hook.js +5 -5
- package/build/elevation/hook.js.map +1 -1
- package/build/external-link/index.js +1 -3
- package/build/external-link/index.js.map +1 -1
- package/build/focal-point-picker/grid.js +2 -7
- package/build/focal-point-picker/grid.js.map +1 -1
- package/build/focal-point-picker/index.native.js +8 -8
- package/build/focal-point-picker/index.native.js.map +1 -1
- package/build/focal-point-picker/tooltip/index.native.js +11 -12
- package/build/focal-point-picker/tooltip/index.native.js.map +1 -1
- package/build/form-token-field/index.js +22 -7
- package/build/form-token-field/index.js.map +1 -1
- package/build/form-token-field/styles.js +40 -0
- package/build/form-token-field/styles.js.map +1 -0
- package/build/form-token-field/suggestions-list.js +2 -7
- package/build/form-token-field/suggestions-list.js.map +1 -1
- package/build/grid/component.js +7 -8
- package/build/grid/component.js.map +1 -1
- package/build/grid/hook.js +1 -5
- package/build/grid/hook.js.map +1 -1
- package/build/grid/index.js.map +1 -1
- package/build/grid/utils.js +4 -7
- package/build/grid/utils.js.map +1 -1
- package/build/h-stack/component.js +5 -9
- package/build/h-stack/component.js.map +1 -1
- package/build/h-stack/hook.js +8 -10
- package/build/h-stack/hook.js.map +1 -1
- package/build/h-stack/index.js.map +1 -1
- package/build/h-stack/utils.js +7 -18
- package/build/h-stack/utils.js.map +1 -1
- package/build/icon/index.js.map +1 -1
- package/build/menu-item/index.js +1 -3
- package/build/menu-item/index.js.map +1 -1
- package/build/mobile/focal-point-settings-panel/index.native.js +1 -1
- package/build/mobile/focal-point-settings-panel/index.native.js.map +1 -1
- package/build/mobile/image/index.native.js +4 -2
- package/build/mobile/image/index.native.js.map +1 -1
- package/build/modal/index.js +17 -3
- package/build/modal/index.js.map +1 -1
- package/build/navigation/index.js +4 -1
- package/build/navigation/index.js.map +1 -1
- package/build/navigation/item/base.js +3 -0
- package/build/navigation/item/base.js.map +1 -1
- package/build/popover/index.js +4 -4
- package/build/popover/index.js.map +1 -1
- package/build/range-control/index.js +54 -40
- package/build/range-control/index.js.map +1 -1
- package/build/range-control/input-range.js +5 -7
- package/build/range-control/input-range.js.map +1 -1
- package/build/range-control/mark.js +5 -7
- package/build/range-control/mark.js.map +1 -1
- package/build/range-control/rail.js +10 -16
- package/build/range-control/rail.js.map +1 -1
- package/build/range-control/styles/range-control-styles.js +62 -62
- package/build/range-control/styles/range-control-styles.js.map +1 -1
- package/build/range-control/tooltip.js +5 -7
- package/build/range-control/tooltip.js.map +1 -1
- package/build/range-control/types.js +6 -0
- package/build/range-control/types.js.map +1 -0
- package/build/range-control/utils.js +22 -29
- package/build/range-control/utils.js.map +1 -1
- package/build/resizable-box/resize-tooltip/utils.js +2 -7
- package/build/resizable-box/resize-tooltip/utils.js.map +1 -1
- package/build/scrollable/component.js +7 -8
- package/build/scrollable/component.js.map +1 -1
- package/build/scrollable/hook.js +0 -8
- package/build/scrollable/hook.js.map +1 -1
- package/build/scrollable/index.js.map +1 -1
- package/build/scrollable/styles.js +7 -7
- package/build/scrollable/styles.js.map +1 -1
- package/build/shortcut/index.js +2 -8
- package/build/shortcut/index.js.map +1 -1
- package/build/slot-fill/index.native.js +6 -8
- package/build/slot-fill/index.native.js.map +1 -1
- package/build/slot-fill/provider.js +4 -8
- package/build/slot-fill/provider.js.map +1 -1
- package/build/slot-fill/slot.js +4 -8
- package/build/slot-fill/slot.js.map +1 -1
- package/build/spacer/component.js.map +1 -1
- package/build/spacer/hook.js +2 -2
- package/build/spacer/hook.js.map +1 -1
- package/build/spacer/index.js.map +1 -1
- package/build/text-highlight/index.js +22 -5
- package/build/text-highlight/index.js.map +1 -1
- package/build/text-highlight/types.js +6 -0
- package/build/text-highlight/types.js.map +1 -0
- package/build/tip/index.js +5 -11
- package/build/tip/index.js.map +1 -1
- package/build/tip/types.js +6 -0
- package/build/tip/types.js.map +1 -0
- package/build/toolbar-group/index.js +3 -3
- package/build/toolbar-group/index.js.map +1 -1
- package/build/tree-select/index.js +2 -2
- package/build/tree-select/index.js.map +1 -1
- package/build/ui/utils/get-valid-children.js.map +1 -1
- package/build/visually-hidden/component.js +12 -13
- package/build/visually-hidden/component.js.map +1 -1
- package/build/visually-hidden/index.js.map +1 -1
- package/build/visually-hidden/styles.js +3 -1
- package/build/visually-hidden/styles.js.map +1 -1
- package/build/visually-hidden/types.js +6 -0
- package/build/visually-hidden/types.js.map +1 -0
- package/build-module/autocomplete/get-default-use-items.js +3 -2
- package/build-module/autocomplete/get-default-use-items.js.map +1 -1
- package/build-module/autocomplete/index.js +3 -2
- package/build-module/autocomplete/index.js.map +1 -1
- package/build-module/border-control/border-control/hook.js.map +1 -1
- package/build-module/box-control/index.js +1 -1
- package/build-module/box-control/index.js.map +1 -1
- package/build-module/color-picker/hex-input.js +4 -3
- package/build-module/color-picker/hex-input.js.map +1 -1
- package/build-module/color-picker/index.native.js +36 -35
- package/build-module/color-picker/index.native.js.map +1 -1
- package/build-module/color-picker/input-with-slider.js +3 -1
- package/build-module/color-picker/input-with-slider.js.map +1 -1
- package/build-module/color-picker/styles.js +23 -40
- package/build-module/color-picker/styles.js.map +1 -1
- package/build-module/color-picker/use-deprecated-props.js +22 -31
- package/build-module/color-picker/use-deprecated-props.js.map +1 -1
- package/build-module/combobox-control/index.js +14 -7
- package/build-module/combobox-control/index.js.map +1 -1
- package/build-module/combobox-control/styles.js +27 -0
- package/build-module/combobox-control/styles.js.map +1 -0
- package/build-module/dropdown-menu/index.js +5 -4
- package/build-module/dropdown-menu/index.js.map +1 -1
- package/build-module/dropdown-menu/index.native.js +5 -4
- package/build-module/dropdown-menu/index.native.js.map +1 -1
- package/build-module/elevation/hook.js +5 -5
- package/build-module/elevation/hook.js.map +1 -1
- package/build-module/external-link/index.js +1 -2
- package/build-module/external-link/index.js.map +1 -1
- package/build-module/focal-point-picker/grid.js +2 -6
- package/build-module/focal-point-picker/grid.js.map +1 -1
- package/build-module/focal-point-picker/index.native.js +8 -8
- package/build-module/focal-point-picker/index.native.js.map +1 -1
- package/build-module/focal-point-picker/tooltip/index.native.js +11 -12
- package/build-module/focal-point-picker/tooltip/index.native.js.map +1 -1
- package/build-module/form-token-field/index.js +20 -6
- package/build-module/form-token-field/index.js.map +1 -1
- package/build-module/form-token-field/styles.js +28 -0
- package/build-module/form-token-field/styles.js.map +1 -0
- package/build-module/form-token-field/suggestions-list.js +2 -7
- package/build-module/form-token-field/suggestions-list.js.map +1 -1
- package/build-module/grid/component.js +7 -8
- package/build-module/grid/component.js.map +1 -1
- package/build-module/grid/hook.js +1 -5
- package/build-module/grid/hook.js.map +1 -1
- package/build-module/grid/index.js.map +1 -1
- package/build-module/grid/utils.js +3 -8
- package/build-module/grid/utils.js.map +1 -1
- package/build-module/h-stack/component.js +3 -7
- package/build-module/h-stack/component.js.map +1 -1
- package/build-module/h-stack/hook.js +10 -12
- package/build-module/h-stack/hook.js.map +1 -1
- package/build-module/h-stack/index.js.map +1 -1
- package/build-module/h-stack/utils.js +7 -19
- package/build-module/h-stack/utils.js.map +1 -1
- package/build-module/icon/index.js.map +1 -1
- package/build-module/menu-item/index.js +1 -2
- package/build-module/menu-item/index.js.map +1 -1
- package/build-module/mobile/focal-point-settings-panel/index.native.js +2 -2
- package/build-module/mobile/focal-point-settings-panel/index.native.js.map +1 -1
- package/build-module/mobile/image/index.native.js +3 -2
- package/build-module/mobile/image/index.native.js.map +1 -1
- package/build-module/modal/index.js +19 -5
- package/build-module/modal/index.js.map +1 -1
- package/build-module/navigation/index.js +4 -1
- package/build-module/navigation/index.js.map +1 -1
- package/build-module/navigation/item/base.js +3 -0
- package/build-module/navigation/item/base.js.map +1 -1
- package/build-module/popover/index.js +4 -4
- package/build-module/popover/index.js.map +1 -1
- package/build-module/range-control/index.js +54 -40
- package/build-module/range-control/index.js.map +1 -1
- package/build-module/range-control/input-range.js +5 -6
- package/build-module/range-control/input-range.js.map +1 -1
- package/build-module/range-control/mark.js +5 -6
- package/build-module/range-control/mark.js.map +1 -1
- package/build-module/range-control/rail.js +10 -15
- package/build-module/range-control/rail.js.map +1 -1
- package/build-module/range-control/styles/range-control-styles.js +62 -64
- package/build-module/range-control/styles/range-control-styles.js.map +1 -1
- package/build-module/range-control/tooltip.js +5 -6
- package/build-module/range-control/tooltip.js.map +1 -1
- package/build-module/range-control/types.js +2 -0
- package/build-module/range-control/types.js.map +1 -0
- package/build-module/range-control/utils.js +22 -29
- package/build-module/range-control/utils.js.map +1 -1
- package/build-module/resizable-box/resize-tooltip/utils.js +2 -6
- package/build-module/resizable-box/resize-tooltip/utils.js.map +1 -1
- package/build-module/scrollable/component.js +7 -8
- package/build-module/scrollable/component.js.map +1 -1
- package/build-module/scrollable/hook.js +0 -8
- package/build-module/scrollable/hook.js.map +1 -1
- package/build-module/scrollable/index.js.map +1 -1
- package/build-module/scrollable/styles.js +7 -7
- package/build-module/scrollable/styles.js.map +1 -1
- package/build-module/shortcut/index.js +2 -7
- package/build-module/shortcut/index.js.map +1 -1
- package/build-module/slot-fill/index.native.js +6 -7
- package/build-module/slot-fill/index.native.js.map +1 -1
- package/build-module/slot-fill/provider.js +4 -7
- package/build-module/slot-fill/provider.js.map +1 -1
- package/build-module/slot-fill/slot.js +4 -7
- package/build-module/slot-fill/slot.js.map +1 -1
- package/build-module/spacer/component.js.map +1 -1
- package/build-module/spacer/hook.js +2 -2
- package/build-module/spacer/hook.js.map +1 -1
- package/build-module/spacer/index.js.map +1 -1
- package/build-module/text-highlight/index.js +23 -6
- package/build-module/text-highlight/index.js.map +1 -1
- package/build-module/text-highlight/types.js +2 -0
- package/build-module/text-highlight/types.js.map +1 -0
- package/build-module/tip/index.js +6 -10
- package/build-module/tip/index.js.map +1 -1
- package/build-module/tip/types.js +2 -0
- package/build-module/tip/types.js.map +1 -0
- package/build-module/toolbar-group/index.js +3 -2
- package/build-module/toolbar-group/index.js.map +1 -1
- package/build-module/tree-select/index.js +3 -3
- package/build-module/tree-select/index.js.map +1 -1
- package/build-module/ui/utils/get-valid-children.js.map +1 -1
- package/build-module/visually-hidden/component.js +12 -13
- package/build-module/visually-hidden/component.js.map +1 -1
- package/build-module/visually-hidden/index.js.map +1 -1
- package/build-module/visually-hidden/styles.js +3 -1
- package/build-module/visually-hidden/styles.js.map +1 -1
- package/build-module/visually-hidden/types.js +2 -0
- package/build-module/visually-hidden/types.js.map +1 -0
- package/build-style/style-rtl.css +13 -19
- package/build-style/style.css +13 -19
- package/build-types/border-control/border-control/hook.d.ts +1 -1
- package/build-types/border-control/border-control/hook.d.ts.map +1 -1
- package/build-types/color-picker/hex-input.d.ts.map +1 -1
- package/build-types/color-picker/input-with-slider.d.ts.map +1 -1
- package/build-types/color-picker/styles.d.ts +30 -31
- package/build-types/color-picker/styles.d.ts.map +1 -1
- package/build-types/color-picker/use-deprecated-props.d.ts.map +1 -1
- package/build-types/dropdown-menu/index.d.ts.map +1 -1
- package/build-types/external-link/index.d.ts.map +1 -1
- package/build-types/form-token-field/index.d.ts.map +1 -1
- package/build-types/form-token-field/styles.d.ts +14 -0
- package/build-types/form-token-field/styles.d.ts.map +1 -0
- package/build-types/form-token-field/suggestions-list.d.ts.map +1 -1
- package/build-types/form-token-field/types.d.ts +7 -0
- package/build-types/form-token-field/types.d.ts.map +1 -1
- package/build-types/grid/component.d.ts +3 -3
- package/build-types/grid/component.d.ts.map +1 -1
- package/build-types/grid/hook.d.ts +5 -2
- package/build-types/grid/hook.d.ts.map +1 -1
- package/build-types/grid/index.d.ts +2 -2
- package/build-types/grid/index.d.ts.map +1 -1
- package/build-types/grid/stories/index.d.ts +9 -0
- package/build-types/grid/stories/index.d.ts.map +1 -0
- package/build-types/grid/test/grid.d.ts +2 -0
- package/build-types/grid/test/grid.d.ts.map +1 -0
- package/build-types/grid/types.d.ts +16 -15
- package/build-types/grid/types.d.ts.map +1 -1
- package/build-types/grid/utils.d.ts +50 -69
- package/build-types/grid/utils.d.ts.map +1 -1
- package/build-types/h-stack/component.d.ts +3 -2
- package/build-types/h-stack/component.d.ts.map +1 -1
- package/build-types/h-stack/hook.d.ts +5 -3
- package/build-types/h-stack/hook.d.ts.map +1 -1
- package/build-types/h-stack/index.d.ts +2 -2
- package/build-types/h-stack/index.d.ts.map +1 -1
- package/build-types/h-stack/stories/index.d.ts +9 -0
- package/build-types/h-stack/stories/index.d.ts.map +1 -0
- package/build-types/h-stack/test/index.d.ts +2 -0
- package/build-types/h-stack/test/index.d.ts.map +1 -0
- package/build-types/h-stack/utils.d.ts +8 -4
- package/build-types/h-stack/utils.d.ts.map +1 -1
- package/build-types/icon/index.d.ts +1 -1
- package/build-types/icon/index.d.ts.map +1 -1
- package/build-types/menu-item/index.d.ts.map +1 -1
- package/build-types/popover/index.d.ts.map +1 -1
- package/build-types/range-control/index.d.ts +54 -29
- package/build-types/range-control/index.d.ts.map +1 -1
- package/build-types/range-control/input-range.d.ts +7 -10
- package/build-types/range-control/input-range.d.ts.map +1 -1
- package/build-types/range-control/mark.d.ts +4 -7
- package/build-types/range-control/mark.d.ts.map +1 -1
- package/build-types/range-control/rail.d.ts +4 -9
- package/build-types/range-control/rail.d.ts.map +1 -1
- package/build-types/range-control/stories/index.d.ts +48 -0
- package/build-types/range-control/stories/index.d.ts.map +1 -0
- package/build-types/range-control/styles/range-control-styles.d.ts +32 -40
- package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
- package/build-types/range-control/test/index.d.ts +2 -0
- package/build-types/range-control/test/index.d.ts.map +1 -0
- package/build-types/range-control/tooltip.d.ts +4 -11
- package/build-types/range-control/tooltip.d.ts.map +1 -1
- package/build-types/range-control/types.d.ts +302 -0
- package/build-types/range-control/types.d.ts.map +1 -0
- package/build-types/range-control/utils.d.ts +15 -33
- package/build-types/range-control/utils.d.ts.map +1 -1
- package/build-types/resizable-box/resize-tooltip/utils.d.ts.map +1 -1
- package/build-types/scrollable/component.d.ts +3 -3
- package/build-types/scrollable/component.d.ts.map +1 -1
- package/build-types/scrollable/hook.d.ts +5 -2
- package/build-types/scrollable/hook.d.ts.map +1 -1
- package/build-types/scrollable/index.d.ts +2 -2
- package/build-types/scrollable/index.d.ts.map +1 -1
- package/build-types/scrollable/stories/index.d.ts +9 -0
- package/build-types/scrollable/stories/index.d.ts.map +1 -0
- package/build-types/scrollable/styles.d.ts +7 -7
- package/build-types/scrollable/styles.d.ts.map +1 -1
- package/build-types/scrollable/test/index.d.ts +2 -0
- package/build-types/scrollable/test/index.d.ts.map +1 -0
- package/build-types/scrollable/types.d.ts +9 -6
- package/build-types/scrollable/types.d.ts.map +1 -1
- package/build-types/shortcut/index.d.ts.map +1 -1
- package/build-types/slot-fill/provider.d.ts.map +1 -1
- package/build-types/slot-fill/slot.d.ts.map +1 -1
- package/build-types/spacer/component.d.ts +2 -2
- package/build-types/spacer/component.d.ts.map +1 -1
- package/build-types/spacer/hook.d.ts +2 -2
- package/build-types/spacer/hook.d.ts.map +1 -1
- package/build-types/spacer/index.d.ts +1 -1
- package/build-types/spacer/index.d.ts.map +1 -1
- package/build-types/spacer/test/index.d.ts +2 -0
- package/build-types/spacer/test/index.d.ts.map +1 -0
- package/build-types/spacer/types.d.ts +41 -29
- package/build-types/spacer/types.d.ts.map +1 -1
- package/build-types/text-highlight/index.d.ts +23 -0
- package/build-types/text-highlight/index.d.ts.map +1 -0
- package/build-types/text-highlight/stories/index.d.ts +12 -0
- package/build-types/text-highlight/stories/index.d.ts.map +1 -0
- package/build-types/text-highlight/test/index.d.ts +2 -0
- package/build-types/text-highlight/test/index.d.ts.map +1 -0
- package/build-types/text-highlight/types.d.ts +17 -0
- package/build-types/text-highlight/types.d.ts.map +1 -0
- package/build-types/tip/index.d.ts +5 -14
- package/build-types/tip/index.d.ts.map +1 -1
- package/build-types/tip/stories/index.d.ts +12 -0
- package/build-types/tip/stories/index.d.ts.map +1 -0
- package/build-types/tip/types.d.ts +11 -0
- package/build-types/tip/types.d.ts.map +1 -0
- package/build-types/ui/form-group/form-group.d.ts +1 -1
- package/build-types/ui/form-group/types.d.ts +1 -1
- package/build-types/ui/form-group/types.d.ts.map +1 -1
- package/build-types/ui/form-group/use-form-group.d.ts +3 -3
- package/build-types/ui/utils/get-valid-children.d.ts +2 -2
- package/build-types/ui/utils/get-valid-children.d.ts.map +1 -1
- package/build-types/visually-hidden/component.d.ts +8 -10
- package/build-types/visually-hidden/component.d.ts.map +1 -1
- package/build-types/visually-hidden/index.d.ts +1 -1
- package/build-types/visually-hidden/index.d.ts.map +1 -1
- package/build-types/visually-hidden/stories/index.d.ts +14 -0
- package/build-types/visually-hidden/stories/index.d.ts.map +1 -0
- package/build-types/visually-hidden/styles.d.ts +5 -2
- package/build-types/visually-hidden/styles.d.ts.map +1 -1
- package/build-types/visually-hidden/test/index.d.ts +2 -0
- package/build-types/visually-hidden/test/index.d.ts.map +1 -0
- package/build-types/visually-hidden/types.d.ts +11 -0
- package/build-types/visually-hidden/types.d.ts.map +1 -0
- package/package.json +17 -17
- package/src/autocomplete/get-default-use-items.js +3 -2
- package/src/autocomplete/index.js +3 -2
- package/src/border-control/border-control/hook.ts +1 -1
- package/src/box-control/index.js +1 -1
- package/src/button/README.md +1 -1
- package/src/color-picker/hex-input.tsx +3 -2
- package/src/color-picker/index.native.js +20 -27
- package/src/color-picker/input-with-slider.tsx +2 -0
- package/src/color-picker/styles.ts +0 -5
- package/src/color-picker/use-deprecated-props.ts +24 -43
- package/src/combobox-control/index.js +15 -7
- package/src/combobox-control/stories/index.js +3 -2
- package/src/combobox-control/style.scss +1 -1
- package/src/combobox-control/styles.ts +27 -0
- package/src/dropdown-menu/index.js +3 -4
- package/src/dropdown-menu/index.native.js +3 -5
- package/src/elevation/hook.js +3 -3
- package/src/external-link/index.tsx +10 -4
- package/src/focal-point-picker/grid.js +2 -5
- package/src/focal-point-picker/index.native.js +8 -8
- package/src/focal-point-picker/tooltip/index.native.js +10 -11
- package/src/form-token-field/index.tsx +45 -24
- package/src/form-token-field/style.scss +2 -7
- package/src/form-token-field/styles.ts +32 -0
- package/src/form-token-field/suggestions-list.tsx +2 -4
- package/src/form-token-field/types.ts +7 -0
- package/src/grid/README.md +33 -19
- package/src/grid/{component.js → component.tsx} +13 -9
- package/src/grid/{hook.js → hook.ts} +5 -5
- package/src/grid/{index.js → index.ts} +0 -0
- package/src/grid/stories/index.tsx +72 -0
- package/src/grid/test/{grid.js → grid.tsx} +4 -4
- package/src/grid/types.ts +16 -17
- package/src/grid/{utils.js → utils.ts} +9 -7
- package/src/guide/style.scss +1 -0
- package/src/h-stack/{component.js → component.tsx} +8 -8
- package/src/h-stack/{hook.js → hook.tsx} +21 -16
- package/src/h-stack/{index.js → index.ts} +0 -0
- package/src/h-stack/stories/index.tsx +92 -0
- package/src/h-stack/test/__snapshots__/{index.js.snap → index.tsx.snap} +0 -0
- package/src/h-stack/test/{index.js → index.tsx} +0 -0
- package/src/h-stack/{utils.js → utils.ts} +14 -14
- package/src/higher-order/navigate-regions/README.md +4 -1
- package/src/icon/index.tsx +1 -1
- package/src/menu-item/index.js +1 -2
- package/src/mobile/focal-point-settings-panel/index.native.js +2 -2
- package/src/mobile/image/index.native.js +3 -2
- package/src/modal/index.js +21 -2
- package/src/modal/stories/index.js +17 -1
- package/src/modal/style.scss +9 -18
- package/src/navigation/index.js +3 -0
- package/src/navigation/item/base.js +2 -1
- package/src/popover/README.md +2 -2
- package/src/popover/index.js +7 -4
- package/src/range-control/README.md +107 -79
- package/src/range-control/{index.js → index.tsx} +78 -48
- package/src/range-control/{input-range.js → input-range.tsx} +11 -7
- package/src/range-control/{mark.js → mark.tsx} +15 -9
- package/src/range-control/{rail.js → rail.tsx} +40 -23
- package/src/range-control/stories/index.tsx +244 -0
- package/src/range-control/styles/{range-control-styles.js → range-control-styles.ts} +28 -24
- package/src/range-control/test/index.tsx +311 -0
- package/src/range-control/{tooltip.js → tooltip.tsx} +19 -14
- package/src/range-control/types.ts +326 -0
- package/src/range-control/utils.ts +132 -0
- package/src/resizable-box/resize-tooltip/utils.ts +2 -3
- package/src/scrollable/README.md +14 -8
- package/src/scrollable/{component.js → component.tsx} +13 -10
- package/src/scrollable/{hook.js → hook.ts} +5 -7
- package/src/scrollable/{index.js → index.ts} +0 -0
- package/src/scrollable/stories/{index.js → index.tsx} +29 -34
- package/src/scrollable/{styles.js → styles.ts} +0 -0
- package/src/scrollable/test/__snapshots__/{index.js.snap → index.tsx.snap} +1 -0
- package/src/scrollable/test/index.tsx +34 -0
- package/src/scrollable/types.ts +10 -5
- package/src/select-control/test/select-control.tsx +22 -15
- package/src/shortcut/index.js +2 -7
- package/src/slot-fill/index.native.js +2 -7
- package/src/slot-fill/provider.js +3 -7
- package/src/slot-fill/slot.js +21 -24
- package/src/spacer/README.md +43 -37
- package/src/spacer/component.tsx +2 -2
- package/src/spacer/hook.ts +4 -2
- package/src/spacer/index.ts +1 -1
- package/src/spacer/test/__snapshots__/{index.js.snap → index.tsx.snap} +1 -0
- package/src/spacer/test/index.tsx +149 -0
- package/src/spacer/types.ts +41 -29
- package/src/tab-panel/README.md +1 -1
- package/src/text-highlight/README.md +6 -6
- package/src/text-highlight/index.tsx +49 -0
- package/src/text-highlight/stories/index.tsx +33 -0
- package/src/text-highlight/test/index.tsx +93 -0
- package/src/text-highlight/types.ts +16 -0
- package/src/tip/index.tsx +22 -0
- package/src/tip/stories/index.tsx +33 -0
- package/src/tip/types.ts +11 -0
- package/src/toolbar-group/index.js +1 -2
- package/src/tree-select/index.tsx +3 -3
- package/src/ui/form-group/types.ts +1 -1
- package/src/ui/utils/get-valid-children.ts +4 -2
- package/src/visually-hidden/{component.js → component.tsx} +23 -15
- package/src/visually-hidden/{index.js → index.ts} +0 -0
- package/src/visually-hidden/stories/index.tsx +66 -0
- package/src/visually-hidden/{styles.js → styles.ts} +6 -2
- package/src/visually-hidden/test/__snapshots__/{index.js.snap → index.tsx.snap} +0 -0
- package/src/visually-hidden/test/index.tsx +17 -0
- package/src/visually-hidden/types.ts +11 -0
- package/tsconfig.json +1 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/src/grid/stories/index.js +0 -49
- package/src/h-stack/stories/index.js +0 -22
- package/src/range-control/stories/index.js +0 -180
- package/src/range-control/test/index.js +0 -320
- package/src/range-control/utils.js +0 -131
- package/src/scrollable/test/index.js +0 -31
- package/src/spacer/test/index.js +0 -146
- package/src/text-highlight/index.js +0 -28
- package/src/text-highlight/stories/index.js +0 -28
- package/src/text-highlight/test/index.js +0 -120
- package/src/tip/index.js +0 -24
- package/src/tip/stories/index.js +0 -26
- package/src/visually-hidden/stories/index.js +0 -42
- package/src/visually-hidden/test/index.js +0 -19
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-valid-children.d.ts","sourceRoot":"","sources":["../../../src/ui/utils/get-valid-children.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"get-valid-children.d.ts","sourceRoot":"","sources":["../../../src/ui/utils/get-valid-children.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAO/E;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC/B,QAAQ,EAAE,SAAS,GACjB,KAAK,CAAE,UAAU,GAAG,aAAa,GAAG,WAAW,CAAE,CAMnD"}
|
|
@@ -1,22 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
import type { VisuallyHiddenProps } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* `VisuallyHidden` is a component used to render text intended to be visually
|
|
4
4
|
* hidden, but will show for alternate devices, for example a screen reader.
|
|
5
5
|
*
|
|
6
|
-
* @example
|
|
7
6
|
* ```jsx
|
|
8
7
|
* import { VisuallyHidden } from `@wordpress/components`;
|
|
9
8
|
*
|
|
10
9
|
* function Example() {
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
10
|
+
* return (
|
|
11
|
+
* <VisuallyHidden>
|
|
12
|
+
* <label>Code is Poetry</label>
|
|
13
|
+
* </VisuallyHidden>
|
|
14
|
+
* );
|
|
16
15
|
* }
|
|
17
16
|
* ```
|
|
18
17
|
*/
|
|
19
|
-
declare const
|
|
20
|
-
|
|
21
|
-
}, true>;
|
|
18
|
+
export declare const VisuallyHidden: import("../ui/context").WordPressComponent<"div", VisuallyHiddenProps, true>;
|
|
19
|
+
export default VisuallyHidden;
|
|
22
20
|
//# sourceMappingURL=component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../src/visually-hidden/component.
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../src/visually-hidden/component.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAmBnD;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,cAAc,8EAG1B,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default as VisuallyHidden } from
|
|
1
|
+
export { default as VisuallyHidden } from './component';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/visually-hidden/index.
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/visually-hidden/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
5
|
+
/**
|
|
6
|
+
* Internal dependencies
|
|
7
|
+
*/
|
|
8
|
+
import { VisuallyHidden } from '..';
|
|
9
|
+
declare const meta: ComponentMeta<typeof VisuallyHidden>;
|
|
10
|
+
export default meta;
|
|
11
|
+
export declare const Default: ComponentStory<typeof VisuallyHidden>;
|
|
12
|
+
export declare const WithForwardedProps: ComponentStory<typeof VisuallyHidden>;
|
|
13
|
+
export declare const WithAdditionalClassNames: ComponentStory<typeof VisuallyHidden>;
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/visually-hidden/stories/index.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEtE;;GAEG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,IAAI,CAAC;AAEpC,QAAA,MAAM,IAAI,EAAE,aAAa,CAAE,OAAO,cAAc,CAa/C,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,eAAO,MAAM,OAAO,EAAE,cAAc,CAAE,OAAO,cAAc,CAa1D,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,cAAc,CAAE,OAAO,cAAc,CAWrE,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,cAAc,CACpD,OAAO,cAAc,CAUrB,CAAC"}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { CSSProperties } from 'react';
|
|
5
|
+
export declare const visuallyHidden: CSSProperties;
|
|
3
6
|
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../src/visually-hidden/styles.
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../src/visually-hidden/styles.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,eAAO,MAAM,cAAc,EAAE,aAY5B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/visually-hidden/test/index.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/visually-hidden/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,oBAAY,mBAAmB,GAAG;IACjC;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;CACpB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/components",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.15.0",
|
|
4
4
|
"description": "UI components for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -38,21 +38,21 @@
|
|
|
38
38
|
"@emotion/utils": "1.0.0",
|
|
39
39
|
"@floating-ui/react-dom": "0.6.3",
|
|
40
40
|
"@use-gesture/react": "^10.2.6",
|
|
41
|
-
"@wordpress/a11y": "^3.
|
|
42
|
-
"@wordpress/compose": "^5.
|
|
43
|
-
"@wordpress/date": "^4.
|
|
44
|
-
"@wordpress/deprecated": "^3.
|
|
45
|
-
"@wordpress/dom": "^3.
|
|
46
|
-
"@wordpress/element": "^4.
|
|
47
|
-
"@wordpress/escape-html": "^2.
|
|
48
|
-
"@wordpress/hooks": "^3.
|
|
49
|
-
"@wordpress/i18n": "^4.
|
|
50
|
-
"@wordpress/icons": "^9.
|
|
51
|
-
"@wordpress/is-shallow-equal": "^4.
|
|
52
|
-
"@wordpress/keycodes": "^3.
|
|
53
|
-
"@wordpress/primitives": "^3.
|
|
54
|
-
"@wordpress/rich-text": "^5.
|
|
55
|
-
"@wordpress/warning": "^2.
|
|
41
|
+
"@wordpress/a11y": "^3.13.0",
|
|
42
|
+
"@wordpress/compose": "^5.11.0",
|
|
43
|
+
"@wordpress/date": "^4.13.0",
|
|
44
|
+
"@wordpress/deprecated": "^3.13.0",
|
|
45
|
+
"@wordpress/dom": "^3.13.0",
|
|
46
|
+
"@wordpress/element": "^4.11.0",
|
|
47
|
+
"@wordpress/escape-html": "^2.13.0",
|
|
48
|
+
"@wordpress/hooks": "^3.13.0",
|
|
49
|
+
"@wordpress/i18n": "^4.13.0",
|
|
50
|
+
"@wordpress/icons": "^9.4.0",
|
|
51
|
+
"@wordpress/is-shallow-equal": "^4.13.0",
|
|
52
|
+
"@wordpress/keycodes": "^3.13.0",
|
|
53
|
+
"@wordpress/primitives": "^3.11.0",
|
|
54
|
+
"@wordpress/rich-text": "^5.11.0",
|
|
55
|
+
"@wordpress/warning": "^2.13.0",
|
|
56
56
|
"classnames": "^2.3.1",
|
|
57
57
|
"colord": "^2.7.0",
|
|
58
58
|
"dom-scroll-into-view": "^1.2.1",
|
|
@@ -77,5 +77,5 @@
|
|
|
77
77
|
"publishConfig": {
|
|
78
78
|
"access": "public"
|
|
79
79
|
},
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "9d9d33bbdf317a4381b8ca1713e43bb50df653b3"
|
|
81
81
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { debounce,
|
|
4
|
+
import { debounce, escapeRegExp } from 'lodash';
|
|
5
|
+
import removeAccents from 'remove-accents';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* WordPress dependencies
|
|
@@ -20,7 +21,7 @@ function filterOptions( search, options = [], maxResults = 10 ) {
|
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
const isMatch = keywords.some( ( keyword ) =>
|
|
23
|
-
search.test(
|
|
24
|
+
search.test( removeAccents( keyword ) )
|
|
24
25
|
);
|
|
25
26
|
if ( ! isMatch ) {
|
|
26
27
|
continue;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { escapeRegExp, find
|
|
4
|
+
import { escapeRegExp, find } from 'lodash';
|
|
5
|
+
import removeAccents from 'remove-accents';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* WordPress dependencies
|
|
@@ -284,7 +285,7 @@ function useAutocomplete( {
|
|
|
284
285
|
return;
|
|
285
286
|
}
|
|
286
287
|
|
|
287
|
-
const text =
|
|
288
|
+
const text = removeAccents( textContent );
|
|
288
289
|
const textAfterSelection = getTextContent(
|
|
289
290
|
slice( record, undefined, getTextContent( record ).length )
|
|
290
291
|
);
|
package/src/box-control/index.js
CHANGED
|
@@ -117,7 +117,7 @@ export default function BoxControl( {
|
|
|
117
117
|
};
|
|
118
118
|
|
|
119
119
|
return (
|
|
120
|
-
<Root id={ id } role="
|
|
120
|
+
<Root id={ id } role="group" aria-labelledby={ headingId }>
|
|
121
121
|
<Header className="component-box-control__header">
|
|
122
122
|
<FlexItem>
|
|
123
123
|
<Text
|
package/src/button/README.md
CHANGED
|
@@ -62,7 +62,7 @@ Since a high-emphasis button commands the most attention, a layout should contai
|
|
|
62
62
|
|
|
63
63
|
#### Text label
|
|
64
64
|
|
|
65
|
-
All button types use text labels to describe the action that happens when a user taps a button. If there’s no text label, there
|
|
65
|
+
All button types use text labels to describe the action that happens when a user taps a button. If there’s no text label, there needs to be a [label](#label) added and an icon to signify what the button does.
|
|
66
66
|
|
|
67
67
|

|
|
68
68
|
|
|
@@ -11,10 +11,10 @@ import { __ } from '@wordpress/i18n';
|
|
|
11
11
|
/**
|
|
12
12
|
* Internal dependencies
|
|
13
13
|
*/
|
|
14
|
+
import { InputControl } from '../input-control';
|
|
14
15
|
import { Text } from '../text';
|
|
15
16
|
import { Spacer } from '../spacer';
|
|
16
17
|
import { space } from '../ui/utils/space';
|
|
17
|
-
import { ColorHexInputControl } from './styles';
|
|
18
18
|
import { COLORS } from '../utils/colors-values';
|
|
19
19
|
import type { StateReducer } from '../input-control/reducer/state';
|
|
20
20
|
|
|
@@ -49,7 +49,7 @@ export const HexInput = ( { color, onChange, enableAlpha }: HexInputProps ) => {
|
|
|
49
49
|
};
|
|
50
50
|
|
|
51
51
|
return (
|
|
52
|
-
<
|
|
52
|
+
<InputControl
|
|
53
53
|
prefix={
|
|
54
54
|
<Spacer
|
|
55
55
|
as={ Text }
|
|
@@ -66,6 +66,7 @@ export const HexInput = ( { color, onChange, enableAlpha }: HexInputProps ) => {
|
|
|
66
66
|
label={ __( 'Hex color' ) }
|
|
67
67
|
hideLabelFromVision
|
|
68
68
|
__unstableStateReducer={ stateReducer }
|
|
69
|
+
__unstableInputWidth="9em"
|
|
69
70
|
/>
|
|
70
71
|
);
|
|
71
72
|
};
|
|
@@ -8,7 +8,7 @@ import namesPlugin from 'colord/plugins/names';
|
|
|
8
8
|
/**
|
|
9
9
|
* WordPress dependencies
|
|
10
10
|
*/
|
|
11
|
-
import { useState, useEffect
|
|
11
|
+
import { useState, useEffect } from '@wordpress/element';
|
|
12
12
|
import { __ } from '@wordpress/i18n';
|
|
13
13
|
import { BottomSheet } from '@wordpress/components';
|
|
14
14
|
import { usePreferredColorSchemeStyle } from '@wordpress/compose';
|
|
@@ -33,7 +33,6 @@ function ColorPicker( {
|
|
|
33
33
|
onHandleHardwareButtonPress,
|
|
34
34
|
bottomLabelText,
|
|
35
35
|
} ) {
|
|
36
|
-
const didMount = useRef( false );
|
|
37
36
|
const isIOS = Platform.OS === 'ios';
|
|
38
37
|
const hitSlop = { top: 22, bottom: 22, left: 22, right: 22 };
|
|
39
38
|
const {
|
|
@@ -77,19 +76,17 @@ function ColorPicker( {
|
|
|
77
76
|
styles.footerDark
|
|
78
77
|
);
|
|
79
78
|
|
|
80
|
-
const
|
|
81
|
-
h:
|
|
82
|
-
s: sat * 100,
|
|
83
|
-
v: val * 100,
|
|
84
|
-
} ).toHex();
|
|
79
|
+
const combineToHex = ( h = hue, s = sat, v = val ) =>
|
|
80
|
+
colord( { h, s: s * 100, v: v * 100 } ).toHex();
|
|
85
81
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
82
|
+
const currentColor = combineToHex();
|
|
83
|
+
|
|
84
|
+
const updateColor = ( { hue: h, saturation: s, value: v } ) => {
|
|
85
|
+
if ( h !== undefined ) setHue( h );
|
|
86
|
+
if ( s !== undefined ) setSaturation( s );
|
|
87
|
+
if ( v !== undefined ) setValue( v );
|
|
88
|
+
setColor( combineToHex( h, s, v ) );
|
|
89
|
+
};
|
|
93
90
|
|
|
94
91
|
useEffect( () => {
|
|
95
92
|
shouldEnableBottomSheetMaxHeight( false );
|
|
@@ -104,17 +101,13 @@ function ColorPicker( {
|
|
|
104
101
|
if ( onHandleHardwareButtonPress ) {
|
|
105
102
|
onHandleHardwareButtonPress( onButtonPress );
|
|
106
103
|
}
|
|
104
|
+
// TODO: Revisit this to discover if there's a good reason for omitting
|
|
105
|
+
// the hook’s dependencies and running it a single time. Ideally there
|
|
106
|
+
// may be a way to refactor and obviate the disabled lint rule. If not,
|
|
107
|
+
// this comment should be replaced by one that explains the reasoning.
|
|
108
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
107
109
|
}, [] );
|
|
108
110
|
|
|
109
|
-
function onHuePickerChange( { hue: h } ) {
|
|
110
|
-
setHue( h );
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
function onSatValPickerChange( { saturation: s, value: v } ) {
|
|
114
|
-
setSaturation( s );
|
|
115
|
-
setValue( v );
|
|
116
|
-
}
|
|
117
|
-
|
|
118
111
|
function onButtonPress( action ) {
|
|
119
112
|
onNavigationBack();
|
|
120
113
|
onHandleClosingBottomSheet( null );
|
|
@@ -129,16 +122,16 @@ function ColorPicker( {
|
|
|
129
122
|
<>
|
|
130
123
|
<HsvColorPicker
|
|
131
124
|
huePickerHue={ hue }
|
|
132
|
-
onHuePickerDragMove={
|
|
125
|
+
onHuePickerDragMove={ updateColor }
|
|
133
126
|
onHuePickerPress={
|
|
134
|
-
! isBottomSheetContentScrolling &&
|
|
127
|
+
! isBottomSheetContentScrolling && updateColor
|
|
135
128
|
}
|
|
136
129
|
satValPickerHue={ hue }
|
|
137
130
|
satValPickerSaturation={ sat }
|
|
138
131
|
satValPickerValue={ val }
|
|
139
|
-
onSatValPickerDragMove={
|
|
132
|
+
onSatValPickerDragMove={ updateColor }
|
|
140
133
|
onSatValPickerPress={
|
|
141
|
-
! isBottomSheetContentScrolling &&
|
|
134
|
+
! isBottomSheetContentScrolling && updateColor
|
|
142
135
|
}
|
|
143
136
|
onSatValPickerDragStart={ () => {
|
|
144
137
|
shouldEnableBottomSheetScroll( false );
|
|
@@ -19,7 +19,6 @@ import {
|
|
|
19
19
|
Container as InputControlContainer,
|
|
20
20
|
Input,
|
|
21
21
|
} from '../input-control/styles/input-control-styles';
|
|
22
|
-
import InputControl from '../input-control';
|
|
23
22
|
import CONFIG from '../utils/config-values';
|
|
24
23
|
|
|
25
24
|
export const NumberControlWrapper = styled( NumberControl )`
|
|
@@ -140,7 +139,3 @@ export const CopyButton = styled( Button )`
|
|
|
140
139
|
}
|
|
141
140
|
}
|
|
142
141
|
`;
|
|
143
|
-
|
|
144
|
-
export const ColorHexInputControl = styled( InputControl )`
|
|
145
|
-
width: 8em;
|
|
146
|
-
`;
|
|
@@ -16,7 +16,7 @@ import memoize from 'memize';
|
|
|
16
16
|
/**
|
|
17
17
|
* WordPress dependencies
|
|
18
18
|
*/
|
|
19
|
-
import { useCallback
|
|
19
|
+
import { useCallback } from '@wordpress/element';
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* Internal dependencies
|
|
@@ -73,16 +73,14 @@ function isLegacyProps( props: any ): props is LegacyProps {
|
|
|
73
73
|
);
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
function getColorFromLegacyProps(
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
if (
|
|
84
|
-
return props.color.hex;
|
|
85
|
-
}
|
|
76
|
+
function getColorFromLegacyProps(
|
|
77
|
+
color: LegacyProps[ 'color' ]
|
|
78
|
+
): string | undefined {
|
|
79
|
+
if ( color === undefined ) return;
|
|
80
|
+
|
|
81
|
+
if ( typeof color === 'string' ) return color;
|
|
82
|
+
|
|
83
|
+
if ( color.hex ) return color.hex;
|
|
86
84
|
|
|
87
85
|
return undefined;
|
|
88
86
|
}
|
|
@@ -109,41 +107,24 @@ const transformColorStringToLegacyColor = memoize(
|
|
|
109
107
|
export function useDeprecatedProps(
|
|
110
108
|
props: LegacyProps | ColorPickerProps
|
|
111
109
|
): ColorPickerProps {
|
|
112
|
-
const
|
|
110
|
+
const { onChangeComplete } = props as LegacyProps;
|
|
111
|
+
const legacyChangeHandler = useCallback(
|
|
113
112
|
( color: string ) => {
|
|
114
|
-
|
|
115
|
-
return props.onChangeComplete(
|
|
116
|
-
transformColorStringToLegacyColor( color )
|
|
117
|
-
);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
return props.onChange?.( color );
|
|
113
|
+
onChangeComplete( transformColorStringToLegacyColor( color ) );
|
|
121
114
|
},
|
|
122
|
-
[
|
|
123
|
-
( props as LegacyProps ).onChangeComplete,
|
|
124
|
-
( props as ColorPickerProps ).onChange,
|
|
125
|
-
]
|
|
115
|
+
[ onChangeComplete ]
|
|
126
116
|
);
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
:
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
const enableAlpha = useMemo( () => {
|
|
135
|
-
return isLegacyProps( props )
|
|
136
|
-
? ! props.disableAlpha
|
|
137
|
-
: props.enableAlpha;
|
|
138
|
-
}, [
|
|
139
|
-
( props as LegacyProps ).disableAlpha,
|
|
140
|
-
( props as ColorPickerProps ).enableAlpha,
|
|
141
|
-
] );
|
|
142
|
-
|
|
117
|
+
if ( isLegacyProps( props ) ) {
|
|
118
|
+
return {
|
|
119
|
+
color: getColorFromLegacyProps( props.color ),
|
|
120
|
+
enableAlpha: ! props.disableAlpha,
|
|
121
|
+
onChange: legacyChangeHandler,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
143
124
|
return {
|
|
144
|
-
...
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
125
|
+
...props,
|
|
126
|
+
color: props.color as ColorPickerProps[ 'color' ],
|
|
127
|
+
enableAlpha: ( props as ColorPickerProps ).enableAlpha,
|
|
128
|
+
onChange: ( props as ColorPickerProps ).onChange,
|
|
148
129
|
};
|
|
149
130
|
}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import classnames from 'classnames';
|
|
5
|
-
import
|
|
5
|
+
import removeAccents from 'remove-accents';
|
|
6
|
+
|
|
6
7
|
/**
|
|
7
8
|
* WordPress dependencies
|
|
8
9
|
*/
|
|
@@ -22,11 +23,12 @@ import { closeSmall } from '@wordpress/icons';
|
|
|
22
23
|
/**
|
|
23
24
|
* Internal dependencies
|
|
24
25
|
*/
|
|
26
|
+
import { InputWrapperFlex } from './styles';
|
|
25
27
|
import TokenInput from '../form-token-field/token-input';
|
|
26
28
|
import SuggestionsList from '../form-token-field/suggestions-list';
|
|
27
29
|
import BaseControl from '../base-control';
|
|
28
30
|
import Button from '../button';
|
|
29
|
-
import {
|
|
31
|
+
import { FlexBlock, FlexItem } from '../flex';
|
|
30
32
|
import withFocusOutside from '../higher-order/with-focus-outside';
|
|
31
33
|
|
|
32
34
|
const noop = () => {};
|
|
@@ -44,6 +46,7 @@ const DetectOutside = withFocusOutside(
|
|
|
44
46
|
);
|
|
45
47
|
|
|
46
48
|
function ComboboxControl( {
|
|
49
|
+
__next36pxDefaultSize,
|
|
47
50
|
value,
|
|
48
51
|
label,
|
|
49
52
|
options,
|
|
@@ -59,7 +62,10 @@ function ComboboxControl( {
|
|
|
59
62
|
} ) {
|
|
60
63
|
const currentOption = options.find( ( option ) => option.value === value );
|
|
61
64
|
const currentLabel = currentOption?.label ?? '';
|
|
62
|
-
|
|
65
|
+
// Use a custom prefix when generating the `instanceId` to avoid having
|
|
66
|
+
// duplicate input IDs when rendering this component and `FormTokenField`
|
|
67
|
+
// in the same page (see https://github.com/WordPress/gutenberg/issues/42112).
|
|
68
|
+
const instanceId = useInstanceId( ComboboxControl, 'combobox-control' );
|
|
63
69
|
const [ selectedSuggestion, setSelectedSuggestion ] = useState(
|
|
64
70
|
currentOption || null
|
|
65
71
|
);
|
|
@@ -71,9 +77,9 @@ function ComboboxControl( {
|
|
|
71
77
|
const matchingSuggestions = useMemo( () => {
|
|
72
78
|
const startsWithMatch = [];
|
|
73
79
|
const containsMatch = [];
|
|
74
|
-
const match =
|
|
80
|
+
const match = removeAccents( inputValue.toLocaleLowerCase() );
|
|
75
81
|
options.forEach( ( option ) => {
|
|
76
|
-
const index =
|
|
82
|
+
const index = removeAccents( option.label )
|
|
77
83
|
.toLocaleLowerCase()
|
|
78
84
|
.indexOf( match );
|
|
79
85
|
if ( index === 0 ) {
|
|
@@ -225,7 +231,9 @@ function ComboboxControl( {
|
|
|
225
231
|
tabIndex="-1"
|
|
226
232
|
onKeyDown={ onKeyDown }
|
|
227
233
|
>
|
|
228
|
-
<
|
|
234
|
+
<InputWrapperFlex
|
|
235
|
+
__next36pxDefaultSize={ __next36pxDefaultSize }
|
|
236
|
+
>
|
|
229
237
|
<FlexBlock>
|
|
230
238
|
<TokenInput
|
|
231
239
|
className="components-combobox-control__input"
|
|
@@ -257,7 +265,7 @@ function ComboboxControl( {
|
|
|
257
265
|
/>
|
|
258
266
|
</FlexItem>
|
|
259
267
|
) }
|
|
260
|
-
</
|
|
268
|
+
</InputWrapperFlex>
|
|
261
269
|
{ isExpanded && (
|
|
262
270
|
<SuggestionsList
|
|
263
271
|
instanceId={ instanceId }
|
|
@@ -266,17 +266,17 @@ const mapCountryOption = ( country ) => ( {
|
|
|
266
266
|
|
|
267
267
|
const countryOptions = countries.map( mapCountryOption );
|
|
268
268
|
|
|
269
|
-
function CountryCodeComboboxControl(
|
|
269
|
+
function CountryCodeComboboxControl( args ) {
|
|
270
270
|
const [ value, setValue ] = useState( null );
|
|
271
271
|
|
|
272
272
|
return (
|
|
273
273
|
<>
|
|
274
274
|
<ComboboxControl
|
|
275
|
+
{ ...args }
|
|
275
276
|
value={ value }
|
|
276
277
|
onChange={ setValue }
|
|
277
278
|
label="Select a country"
|
|
278
279
|
options={ countryOptions }
|
|
279
|
-
allowReset={ allowReset }
|
|
280
280
|
/>
|
|
281
281
|
<p>Value: { value }</p>
|
|
282
282
|
</>
|
|
@@ -284,5 +284,6 @@ function CountryCodeComboboxControl( { allowReset } ) {
|
|
|
284
284
|
}
|
|
285
285
|
export const _default = CountryCodeComboboxControl.bind( {} );
|
|
286
286
|
_default.args = {
|
|
287
|
+
__next36pxDefaultSize: false,
|
|
287
288
|
allowReset: false,
|
|
288
289
|
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import styled from '@emotion/styled';
|
|
5
|
+
import { css } from '@emotion/react';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
import { Flex } from '../flex';
|
|
11
|
+
import { space } from '../ui/utils/space';
|
|
12
|
+
|
|
13
|
+
const deprecatedDefaultSize = ( { __next36pxDefaultSize } ) =>
|
|
14
|
+
! __next36pxDefaultSize &&
|
|
15
|
+
css`
|
|
16
|
+
height: 28px; // 30px - 2px vertical borders on parent container
|
|
17
|
+
padding-left: ${ space( 1 ) };
|
|
18
|
+
padding-right: ${ space( 1 ) };
|
|
19
|
+
`;
|
|
20
|
+
|
|
21
|
+
export const InputWrapperFlex = styled( Flex )`
|
|
22
|
+
height: 34px; // 36px - 2px vertical borders on parent container
|
|
23
|
+
padding-left: ${ space( 2 ) };
|
|
24
|
+
padding-right: ${ space( 2 ) };
|
|
25
|
+
|
|
26
|
+
${ deprecatedDefaultSize }
|
|
27
|
+
`;
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* External dependencies
|
|
4
4
|
*/
|
|
5
5
|
import classnames from 'classnames';
|
|
6
|
-
import { flatMap, isEmpty } from 'lodash';
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
* WordPress dependencies
|
|
@@ -59,13 +58,13 @@ function DropdownMenu( dropdownMenuProps ) {
|
|
|
59
58
|
noIcons,
|
|
60
59
|
} = dropdownMenuProps;
|
|
61
60
|
|
|
62
|
-
if (
|
|
61
|
+
if ( ! controls?.length && ! isFunction( children ) ) {
|
|
63
62
|
return null;
|
|
64
63
|
}
|
|
65
64
|
|
|
66
65
|
// Normalize controls to nested array of objects (sets of controls)
|
|
67
66
|
let controlSets;
|
|
68
|
-
if (
|
|
67
|
+
if ( controls?.length ) {
|
|
69
68
|
controlSets = controls;
|
|
70
69
|
if ( ! Array.isArray( controlSets[ 0 ] ) ) {
|
|
71
70
|
controlSets = [ controlSets ];
|
|
@@ -146,7 +145,7 @@ function DropdownMenu( dropdownMenuProps ) {
|
|
|
146
145
|
return (
|
|
147
146
|
<NavigableMenu { ...mergedMenuProps } role="menu">
|
|
148
147
|
{ isFunction( children ) ? children( props ) : null }
|
|
149
|
-
{ flatMap(
|
|
148
|
+
{ controlSets?.flatMap( ( controlSet, indexOfSet ) =>
|
|
150
149
|
controlSet.map( ( control, indexOfControl ) => (
|
|
151
150
|
<Button
|
|
152
151
|
key={ [
|