@wordpress/components 28.2.0 → 28.3.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 +48 -0
- package/build/animation/index.js.map +1 -1
- package/build/autocomplete/autocompleter-ui.js +1 -0
- package/build/autocomplete/autocompleter-ui.js.map +1 -1
- package/build/autocomplete/index.js.map +1 -1
- package/build/base-control/index.js +14 -7
- package/build/base-control/index.js.map +1 -1
- package/build/border-box-control/border-box-control-visualizer/component.js +0 -4
- package/build/border-box-control/border-box-control-visualizer/component.js.map +1 -1
- package/build/button/index.js +5 -3
- package/build/button/index.js.map +1 -1
- package/build/button/types.js.map +1 -1
- package/build/combobox-control/index.js +4 -1
- package/build/combobox-control/index.js.map +1 -1
- package/build/composite/current/index.js.map +1 -1
- package/build/custom-select-control-v2/custom-select.js +57 -33
- package/build/custom-select-control-v2/custom-select.js.map +1 -1
- package/build/custom-select-control-v2/default-component/index.js +0 -1
- package/build/custom-select-control-v2/default-component/index.js.map +1 -1
- package/build/custom-select-control-v2/item.js +2 -0
- package/build/custom-select-control-v2/item.js.map +1 -1
- package/build/custom-select-control-v2/legacy-component/index.js +18 -6
- package/build/custom-select-control-v2/legacy-component/index.js.map +1 -1
- package/build/custom-select-control-v2/styles.js +90 -78
- package/build/custom-select-control-v2/styles.js.map +1 -1
- package/build/custom-select-control-v2/types.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/date-time/index.js +7 -0
- package/build/date-time/index.js.map +1 -1
- package/build/date-time/time/index.js +62 -145
- package/build/date-time/time/index.js.map +1 -1
- package/build/date-time/time-input/index.js +159 -0
- package/build/date-time/time-input/index.js.map +1 -0
- package/build/date-time/types.js.map +1 -1
- package/build/date-time/utils.js +64 -0
- package/build/date-time/utils.js.map +1 -1
- package/build/disclosure/index.js +0 -1
- package/build/disclosure/index.js.map +1 -1
- package/build/divider/component.js +0 -1
- package/build/divider/component.js.map +1 -1
- package/build/divider/types.js.map +1 -1
- package/build/dropdown-menu/index.js +1 -0
- package/build/dropdown-menu/index.js.map +1 -1
- package/build/dropdown-menu-v2/index.js +0 -1
- package/build/dropdown-menu-v2/index.js.map +1 -1
- package/build/dropdown-menu-v2/styles.js +15 -16
- package/build/dropdown-menu-v2/styles.js.map +1 -1
- package/build/dropdown-menu-v2/types.js.map +1 -1
- package/build/font-size-picker/font-size-picker-select.js +2 -2
- package/build/font-size-picker/font-size-picker-select.js.map +1 -1
- package/build/font-size-picker/index.js +1 -1
- package/build/font-size-picker/index.js.map +1 -1
- package/build/font-size-picker/utils.js +0 -4
- package/build/font-size-picker/utils.js.map +1 -1
- package/build/form-token-field/token.js +4 -1
- package/build/form-token-field/token.js.map +1 -1
- package/build/higher-order/with-spoken-messages/index.js +1 -2
- package/build/higher-order/with-spoken-messages/index.js.map +1 -1
- package/build/menu-items-choice/types.js.map +1 -1
- package/build/popover/index.js +0 -4
- package/build/popover/index.js.map +1 -1
- package/build/popover/utils.js +0 -1
- package/build/popover/utils.js.map +1 -1
- package/build/private-apis.js +2 -4
- package/build/private-apis.js.map +1 -1
- package/build/progress-bar/styles.js +19 -13
- package/build/progress-bar/styles.js.map +1 -1
- package/build/radio-group/context.js +0 -1
- package/build/radio-group/context.js.map +1 -1
- package/build/radio-group/index.js +0 -1
- package/build/radio-group/index.js.map +1 -1
- package/build/radio-group/radio.js +0 -1
- package/build/radio-group/radio.js.map +1 -1
- package/build/range-control/index.js +4 -1
- package/build/range-control/index.js.map +1 -1
- package/build/range-control/styles/range-control-styles.js +34 -28
- package/build/range-control/styles/range-control-styles.js.map +1 -1
- package/build/resizable-box/resize-tooltip/utils.js.map +1 -1
- package/build/select-control/index.js +1 -2
- package/build/select-control/index.js.map +1 -1
- package/build/select-control/styles/select-control-styles.js +13 -8
- package/build/select-control/styles/select-control-styles.js.map +1 -1
- package/build/tab-panel/index.js +0 -1
- package/build/tab-panel/index.js.map +1 -1
- package/build/tabs/index.js +0 -1
- package/build/tabs/index.js.map +1 -1
- package/build/tabs/styles.js +3 -5
- package/build/tabs/styles.js.map +1 -1
- package/build/tabs/tablist.js +148 -37
- package/build/tabs/tablist.js.map +1 -1
- package/build/tabs/types.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/as-radio-group.js +0 -2
- package/build/toggle-group-control/toggle-group-control/as-radio-group.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/component.js +0 -2
- package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control-option-base/component.js +0 -4
- package/build/toggle-group-control/toggle-group-control-option-base/component.js.map +1 -1
- package/build/toolbar/toolbar/toolbar-container.js +0 -1
- package/build/toolbar/toolbar/toolbar-container.js.map +1 -1
- package/build/toolbar/toolbar/types.js.map +1 -1
- package/build/toolbar/toolbar-button/index.js +27 -19
- package/build/toolbar/toolbar-button/index.js.map +1 -1
- package/build/toolbar/toolbar-button/types.js.map +1 -1
- package/build/toolbar/toolbar-context/index.js +0 -1
- package/build/toolbar/toolbar-context/index.js.map +1 -1
- package/build/toolbar/toolbar-item/index.js +1 -1
- package/build/toolbar/toolbar-item/index.js.map +1 -1
- package/build/tooltip/index.js +3 -2
- package/build/tooltip/index.js.map +1 -1
- package/build/tooltip/types.js.map +1 -1
- package/build/unit-control/index.js +3 -3
- package/build/unit-control/index.js.map +1 -1
- package/build/unit-control/styles/unit-control-styles.js +7 -7
- package/build/unit-control/styles/unit-control-styles.js.map +1 -1
- package/build/utils/hooks/use-update-effect.js +4 -1
- package/build/utils/hooks/use-update-effect.js.map +1 -1
- package/build-module/animation/index.js +0 -1
- package/build-module/animation/index.js.map +1 -1
- package/build-module/autocomplete/autocompleter-ui.js +1 -0
- package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
- package/build-module/autocomplete/index.js.map +1 -1
- package/build-module/base-control/index.js +13 -6
- package/build-module/base-control/index.js.map +1 -1
- package/build-module/border-box-control/border-box-control-visualizer/component.js +0 -4
- package/build-module/border-box-control/border-box-control-visualizer/component.js.map +1 -1
- package/build-module/button/index.js +5 -3
- package/build-module/button/index.js.map +1 -1
- package/build-module/button/types.js.map +1 -1
- package/build-module/combobox-control/index.js +4 -1
- package/build-module/combobox-control/index.js.map +1 -1
- package/build-module/composite/current/index.js +0 -3
- package/build-module/composite/current/index.js.map +1 -1
- package/build-module/custom-select-control-v2/custom-select.js +58 -35
- package/build-module/custom-select-control-v2/custom-select.js.map +1 -1
- package/build-module/custom-select-control-v2/default-component/index.js +0 -1
- package/build-module/custom-select-control-v2/default-component/index.js.map +1 -1
- package/build-module/custom-select-control-v2/item.js +2 -0
- package/build-module/custom-select-control-v2/item.js.map +1 -1
- package/build-module/custom-select-control-v2/legacy-component/index.js +18 -6
- package/build-module/custom-select-control-v2/legacy-component/index.js.map +1 -1
- package/build-module/custom-select-control-v2/styles.js +88 -76
- package/build-module/custom-select-control-v2/styles.js.map +1 -1
- package/build-module/custom-select-control-v2/types.js.map +1 -1
- package/build-module/date-time/date-time/index.js +4 -1
- package/build-module/date-time/date-time/index.js.map +1 -1
- package/build-module/date-time/index.js +2 -1
- package/build-module/date-time/index.js.map +1 -1
- package/build-module/date-time/time/index.js +65 -149
- package/build-module/date-time/time/index.js.map +1 -1
- package/build-module/date-time/time-input/index.js +151 -0
- package/build-module/date-time/time-input/index.js.map +1 -0
- package/build-module/date-time/types.js.map +1 -1
- package/build-module/date-time/utils.js +61 -0
- package/build-module/date-time/utils.js.map +1 -1
- package/build-module/disclosure/index.js +0 -1
- package/build-module/disclosure/index.js.map +1 -1
- package/build-module/divider/component.js +0 -1
- package/build-module/divider/component.js.map +1 -1
- package/build-module/divider/types.js.map +1 -1
- package/build-module/dropdown-menu/index.js +1 -0
- package/build-module/dropdown-menu/index.js.map +1 -1
- package/build-module/dropdown-menu-v2/index.js +0 -1
- package/build-module/dropdown-menu-v2/index.js.map +1 -1
- package/build-module/dropdown-menu-v2/styles.js +14 -15
- package/build-module/dropdown-menu-v2/styles.js.map +1 -1
- package/build-module/dropdown-menu-v2/types.js.map +1 -1
- package/build-module/font-size-picker/font-size-picker-select.js +1 -1
- package/build-module/font-size-picker/font-size-picker-select.js.map +1 -1
- package/build-module/font-size-picker/index.js +1 -1
- package/build-module/font-size-picker/index.js.map +1 -1
- package/build-module/font-size-picker/utils.js +0 -4
- package/build-module/font-size-picker/utils.js.map +1 -1
- package/build-module/form-token-field/token.js +4 -1
- package/build-module/form-token-field/token.js.map +1 -1
- package/build-module/higher-order/with-spoken-messages/index.js +1 -2
- package/build-module/higher-order/with-spoken-messages/index.js.map +1 -1
- package/build-module/menu-items-choice/types.js.map +1 -1
- package/build-module/popover/index.js +0 -3
- package/build-module/popover/index.js.map +1 -1
- package/build-module/popover/utils.js +0 -1
- package/build-module/popover/utils.js.map +1 -1
- package/build-module/private-apis.js +2 -4
- package/build-module/private-apis.js.map +1 -1
- package/build-module/progress-bar/styles.js +21 -13
- package/build-module/progress-bar/styles.js.map +1 -1
- package/build-module/radio-group/context.js +0 -1
- package/build-module/radio-group/context.js.map +1 -1
- package/build-module/radio-group/index.js +0 -1
- package/build-module/radio-group/index.js.map +1 -1
- package/build-module/radio-group/radio.js +0 -1
- package/build-module/radio-group/radio.js.map +1 -1
- package/build-module/range-control/index.js +4 -1
- package/build-module/range-control/index.js.map +1 -1
- package/build-module/range-control/styles/range-control-styles.js +34 -28
- package/build-module/range-control/styles/range-control-styles.js.map +1 -1
- package/build-module/resizable-box/resize-tooltip/utils.js.map +1 -1
- package/build-module/select-control/index.js +2 -3
- package/build-module/select-control/index.js.map +1 -1
- package/build-module/select-control/styles/select-control-styles.js +12 -7
- package/build-module/select-control/styles/select-control-styles.js.map +1 -1
- package/build-module/tab-panel/index.js +0 -1
- package/build-module/tab-panel/index.js.map +1 -1
- package/build-module/tabs/index.js +0 -1
- package/build-module/tabs/index.js.map +1 -1
- package/build-module/tabs/styles.js +3 -4
- package/build-module/tabs/styles.js.map +1 -1
- package/build-module/tabs/tablist.js +149 -38
- package/build-module/tabs/tablist.js.map +1 -1
- package/build-module/tabs/types.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control/as-radio-group.js +0 -1
- package/build-module/toggle-group-control/toggle-group-control/as-radio-group.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control/component.js +0 -1
- package/build-module/toggle-group-control/toggle-group-control/component.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control-option-base/component.js +0 -2
- package/build-module/toggle-group-control/toggle-group-control-option-base/component.js.map +1 -1
- package/build-module/toolbar/toolbar/toolbar-container.js +0 -1
- package/build-module/toolbar/toolbar/toolbar-container.js.map +1 -1
- package/build-module/toolbar/toolbar/types.js.map +1 -1
- package/build-module/toolbar/toolbar-button/index.js +27 -19
- package/build-module/toolbar/toolbar-button/index.js.map +1 -1
- package/build-module/toolbar/toolbar-button/types.js.map +1 -1
- package/build-module/toolbar/toolbar-context/index.js +0 -1
- package/build-module/toolbar/toolbar-context/index.js.map +1 -1
- package/build-module/toolbar/toolbar-item/index.js +1 -1
- package/build-module/toolbar/toolbar-item/index.js.map +1 -1
- package/build-module/tooltip/index.js +3 -2
- package/build-module/tooltip/index.js.map +1 -1
- package/build-module/tooltip/types.js.map +1 -1
- package/build-module/unit-control/index.js +3 -3
- package/build-module/unit-control/index.js.map +1 -1
- package/build-module/unit-control/styles/unit-control-styles.js +7 -7
- package/build-module/unit-control/styles/unit-control-styles.js.map +1 -1
- package/build-module/utils/hooks/use-update-effect.js +4 -1
- package/build-module/utils/hooks/use-update-effect.js.map +1 -1
- package/build-style/style-rtl.css +18 -0
- package/build-style/style.css +18 -0
- package/build-types/animation/index.d.ts.map +1 -1
- package/build-types/autocomplete/autocompleter-ui.d.ts.map +1 -1
- package/build-types/autocomplete/index.d.ts.map +1 -1
- package/build-types/base-control/index.d.ts +6 -20
- package/build-types/base-control/index.d.ts.map +1 -1
- package/build-types/base-control/stories/index.story.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control-visualizer/component.d.ts.map +1 -1
- package/build-types/button/deprecated.d.ts +4 -4
- package/build-types/button/index.d.ts.map +1 -1
- package/build-types/button/stories/e2e/index.story.d.ts.map +1 -1
- package/build-types/button/types.d.ts +27 -10
- package/build-types/button/types.d.ts.map +1 -1
- package/build-types/combobox-control/index.d.ts.map +1 -1
- package/build-types/composite/current/index.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/custom-select.d.ts +2 -2
- package/build-types/custom-select-control-v2/custom-select.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/default-component/index.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/item.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/legacy-component/index.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/stories/default.story.d.ts +6 -3
- package/build-types/custom-select-control-v2/stories/default.story.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/styles.d.ts +18 -26
- package/build-types/custom-select-control-v2/styles.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/types.d.ts +12 -2
- package/build-types/custom-select-control-v2/types.d.ts.map +1 -1
- package/build-types/date-time/date-time/index.d.ts.map +1 -1
- package/build-types/date-time/index.d.ts +2 -1
- package/build-types/date-time/index.d.ts.map +1 -1
- package/build-types/date-time/stories/time-input.story.d.ts +12 -0
- package/build-types/date-time/stories/time-input.story.d.ts.map +1 -0
- package/build-types/date-time/time/index.d.ts +1 -1
- package/build-types/date-time/time/index.d.ts.map +1 -1
- package/build-types/date-time/time-input/index.d.ts +5 -0
- package/build-types/date-time/time-input/index.d.ts.map +1 -0
- package/build-types/date-time/time-input/test/index.d.ts +2 -0
- package/build-types/date-time/time-input/test/index.d.ts.map +1 -0
- package/build-types/date-time/types.d.ts +54 -0
- package/build-types/date-time/types.d.ts.map +1 -1
- package/build-types/date-time/utils.d.ts +40 -0
- package/build-types/date-time/utils.d.ts.map +1 -1
- package/build-types/disclosure/index.d.ts.map +1 -1
- package/build-types/divider/component.d.ts.map +1 -1
- package/build-types/divider/types.d.ts.map +1 -1
- package/build-types/dropdown-menu/index.d.ts.map +1 -1
- package/build-types/dropdown-menu-v2/index.d.ts.map +1 -1
- package/build-types/dropdown-menu-v2/styles.d.ts.map +1 -1
- package/build-types/dropdown-menu-v2/types.d.ts.map +1 -1
- package/build-types/font-size-picker/styles.d.ts +1 -1
- package/build-types/font-size-picker/utils.d.ts.map +1 -1
- package/build-types/form-token-field/token.d.ts.map +1 -1
- package/build-types/higher-order/with-spoken-messages/index.d.ts +1 -2
- package/build-types/higher-order/with-spoken-messages/index.d.ts.map +1 -1
- package/build-types/menu-items-choice/types.d.ts +1 -1
- package/build-types/menu-items-choice/types.d.ts.map +1 -1
- package/build-types/navigator/navigator-back-button/component.d.ts +1 -1
- package/build-types/navigator/navigator-back-button/hook.d.ts +1 -1
- package/build-types/navigator/navigator-button/component.d.ts +1 -1
- package/build-types/navigator/navigator-button/hook.d.ts +1 -1
- package/build-types/navigator/navigator-to-parent-button/component.d.ts +1 -1
- package/build-types/popover/index.d.ts.map +1 -1
- package/build-types/popover/utils.d.ts.map +1 -1
- package/build-types/private-apis.d.ts.map +1 -1
- package/build-types/progress-bar/styles.d.ts.map +1 -1
- package/build-types/radio-group/context.d.ts.map +1 -1
- package/build-types/radio-group/index.d.ts.map +1 -1
- package/build-types/radio-group/radio.d.ts.map +1 -1
- package/build-types/range-control/index.d.ts.map +1 -1
- package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
- package/build-types/resizable-box/resize-tooltip/utils.d.ts +2 -2
- package/build-types/resizable-box/resize-tooltip/utils.d.ts.map +1 -1
- package/build-types/select-control/index.d.ts.map +1 -1
- package/build-types/select-control/styles/select-control-styles.d.ts +5 -0
- package/build-types/select-control/styles/select-control-styles.d.ts.map +1 -1
- package/build-types/tab-panel/index.d.ts.map +1 -1
- package/build-types/tabs/index.d.ts.map +1 -1
- package/build-types/tabs/stories/index.story.d.ts.map +1 -1
- package/build-types/tabs/styles.d.ts.map +1 -1
- package/build-types/tabs/tablist.d.ts.map +1 -1
- package/build-types/tabs/types.d.ts.map +1 -1
- package/build-types/theme/stories/index.story.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control/as-radio-group.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control/component.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control-option-base/component.d.ts.map +1 -1
- package/build-types/toolbar/toolbar/toolbar-container.d.ts.map +1 -1
- package/build-types/toolbar/toolbar/types.d.ts +6 -0
- package/build-types/toolbar/toolbar/types.d.ts.map +1 -1
- package/build-types/toolbar/toolbar-button/index.d.ts +3 -96
- package/build-types/toolbar/toolbar-button/index.d.ts.map +1 -1
- package/build-types/toolbar/toolbar-button/types.d.ts +18 -0
- package/build-types/toolbar/toolbar-button/types.d.ts.map +1 -1
- package/build-types/toolbar/toolbar-context/index.d.ts.map +1 -1
- package/build-types/toolbar/toolbar-item/index.d.ts +1 -3
- package/build-types/toolbar/toolbar-item/index.d.ts.map +1 -1
- package/build-types/tooltip/index.d.ts.map +1 -1
- package/build-types/tooltip/types.d.ts +4 -0
- package/build-types/tooltip/types.d.ts.map +1 -1
- package/build-types/unit-control/index.d.ts.map +1 -1
- package/build-types/unit-control/styles/unit-control-styles.d.ts.map +1 -1
- package/build-types/utils/hooks/use-update-effect.d.ts +1 -1
- package/build-types/utils/hooks/use-update-effect.d.ts.map +1 -1
- package/package.json +19 -19
- package/src/animation/index.tsx +0 -1
- package/src/autocomplete/autocompleter-ui.tsx +1 -0
- package/src/autocomplete/index.tsx +0 -1
- package/src/base-control/index.tsx +16 -6
- package/src/base-control/stories/index.story.tsx +0 -1
- package/src/border-box-control/border-box-control-visualizer/component.tsx +0 -5
- package/src/button/README.md +13 -0
- package/src/button/index.tsx +6 -4
- package/src/button/stories/e2e/index.story.tsx +2 -1
- package/src/button/test/index.tsx +17 -2
- package/src/button/types.ts +27 -10
- package/src/combobox-control/index.tsx +2 -0
- package/src/composite/current/index.ts +0 -2
- package/src/custom-select-control/test/index.js +42 -6
- package/src/custom-select-control-v2/custom-select.tsx +57 -22
- package/src/custom-select-control-v2/default-component/index.tsx +0 -1
- package/src/custom-select-control-v2/item.tsx +5 -1
- package/src/custom-select-control-v2/legacy-component/index.tsx +28 -7
- package/src/custom-select-control-v2/legacy-component/test/index.tsx +44 -8
- package/src/custom-select-control-v2/styles.ts +153 -83
- package/src/custom-select-control-v2/test/index.tsx +35 -5
- package/src/custom-select-control-v2/types.ts +18 -6
- package/src/date-time/README.md +8 -0
- package/src/date-time/date-time/index.tsx +2 -1
- package/src/date-time/index.ts +2 -1
- package/src/date-time/stories/time-input.story.tsx +36 -0
- package/src/date-time/time/index.tsx +77 -194
- package/src/date-time/time/test/index.tsx +61 -0
- package/src/date-time/time-input/index.tsx +196 -0
- package/src/date-time/time-input/test/index.tsx +171 -0
- package/src/date-time/types.ts +63 -0
- package/src/date-time/utils.ts +69 -0
- package/src/dimension-control/test/__snapshots__/index.test.js.snap +116 -96
- package/src/disclosure/index.tsx +0 -1
- package/src/divider/component.tsx +0 -1
- package/src/divider/types.ts +0 -1
- package/src/dropdown-menu/index.tsx +1 -0
- package/src/dropdown-menu-v2/index.tsx +0 -1
- package/src/dropdown-menu-v2/styles.ts +0 -1
- package/src/dropdown-menu-v2/types.ts +0 -1
- package/src/font-size-picker/font-size-picker-select.tsx +1 -1
- package/src/font-size-picker/index.tsx +1 -1
- package/src/font-size-picker/test/index.tsx +6 -6
- package/src/font-size-picker/utils.ts +0 -5
- package/src/form-token-field/token.tsx +2 -0
- package/src/higher-order/navigate-regions/style.scss +25 -13
- package/src/higher-order/with-spoken-messages/index.tsx +1 -2
- package/src/menu-items-choice/types.ts +2 -1
- package/src/palette-edit/test/index.tsx +1 -0
- package/src/popover/index.tsx +0 -2
- package/src/popover/utils.ts +0 -1
- package/src/private-apis.ts +2 -5
- package/src/progress-bar/styles.ts +18 -9
- package/src/radio-group/context.tsx +0 -1
- package/src/radio-group/index.tsx +0 -1
- package/src/radio-group/radio.tsx +0 -1
- package/src/range-control/index.tsx +2 -0
- package/src/range-control/styles/range-control-styles.ts +6 -2
- package/src/resizable-box/resize-tooltip/utils.ts +1 -1
- package/src/select-control/index.tsx +3 -4
- package/src/select-control/styles/select-control-styles.ts +17 -6
- package/src/tab-panel/index.tsx +0 -1
- package/src/tabs/index.tsx +0 -1
- package/src/tabs/stories/index.story.tsx +25 -18
- package/src/tabs/styles.ts +18 -14
- package/src/tabs/tablist.tsx +187 -43
- package/src/tabs/types.ts +0 -1
- package/src/theme/stories/index.story.tsx +2 -0
- package/src/toggle-group-control/toggle-group-control/as-radio-group.tsx +0 -1
- package/src/toggle-group-control/toggle-group-control/component.tsx +0 -2
- package/src/toggle-group-control/toggle-group-control-option-base/component.tsx +0 -2
- package/src/toolbar/toolbar/README.md +9 -0
- package/src/toolbar/toolbar/style.scss +7 -0
- package/src/toolbar/toolbar/toolbar-container.tsx +0 -1
- package/src/toolbar/toolbar/types.ts +6 -0
- package/src/toolbar/toolbar-button/index.tsx +30 -17
- package/src/toolbar/toolbar-button/types.ts +19 -0
- package/src/toolbar/toolbar-context/index.ts +0 -1
- package/src/toolbar/toolbar-item/index.tsx +1 -1
- package/src/tooltip/index.tsx +3 -2
- package/src/tooltip/test/index.tsx +18 -0
- package/src/tooltip/types.ts +4 -0
- package/src/unit-control/index.tsx +3 -2
- package/src/unit-control/styles/unit-control-styles.ts +10 -4
- package/src/utils/hooks/use-update-effect.js +8 -1
- package/tsconfig.tsbuildinfo +1 -1
package/src/button/README.md
CHANGED
|
@@ -115,6 +115,17 @@ The presence of a `href` prop determines whether an `anchor` element is rendered
|
|
|
115
115
|
|
|
116
116
|
Props not included in this set will be applied to the `a` or `button` element.
|
|
117
117
|
|
|
118
|
+
#### `accessibleWhenDisabled`: `boolean`
|
|
119
|
+
|
|
120
|
+
Whether to keep the button focusable when disabled.
|
|
121
|
+
|
|
122
|
+
In most cases, it is recommended to set this to `true`. Disabling a control without maintaining focusability can cause accessibility issues, by hiding their presence from screen reader users, or by preventing focus from returning to a trigger element.
|
|
123
|
+
|
|
124
|
+
Learn more about the [focusability of disabled controls](https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/#focusabilityofdisabledcontrols) in the WAI-ARIA Authoring Practices Guide.
|
|
125
|
+
|
|
126
|
+
- Required: No
|
|
127
|
+
- Default: `false`
|
|
128
|
+
|
|
118
129
|
#### `children`: `ReactNode`
|
|
119
130
|
|
|
120
131
|
The button's children.
|
|
@@ -137,6 +148,8 @@ An accessible description for the button.
|
|
|
137
148
|
|
|
138
149
|
Whether the button is disabled. If `true`, this will force a `button` element to be rendered, even when an `href` is given.
|
|
139
150
|
|
|
151
|
+
In most cases, it is recommended to also set the `accessibleWhenDisabled` prop to `true`.
|
|
152
|
+
|
|
140
153
|
- Required: No
|
|
141
154
|
|
|
142
155
|
#### `href`: `string`
|
package/src/button/index.tsx
CHANGED
|
@@ -29,6 +29,7 @@ import { positionToPlacement } from '../popover/utils';
|
|
|
29
29
|
const disabledEventsOnDisabledButton = [ 'onMouseDown', 'onClick' ] as const;
|
|
30
30
|
|
|
31
31
|
function useDeprecatedProps( {
|
|
32
|
+
__experimentalIsFocusable,
|
|
32
33
|
isDefault,
|
|
33
34
|
isPrimary,
|
|
34
35
|
isSecondary,
|
|
@@ -43,7 +44,8 @@ function useDeprecatedProps( {
|
|
|
43
44
|
let computedSize = size;
|
|
44
45
|
let computedVariant = variant;
|
|
45
46
|
|
|
46
|
-
const newProps
|
|
47
|
+
const newProps = {
|
|
48
|
+
accessibleWhenDisabled: __experimentalIsFocusable,
|
|
47
49
|
// @todo Mark `isPressed` as deprecated
|
|
48
50
|
'aria-pressed': isPressed,
|
|
49
51
|
};
|
|
@@ -91,6 +93,7 @@ export function UnforwardedButton(
|
|
|
91
93
|
) {
|
|
92
94
|
const {
|
|
93
95
|
__next40pxDefaultSize,
|
|
96
|
+
accessibleWhenDisabled,
|
|
94
97
|
isBusy,
|
|
95
98
|
isDestructive,
|
|
96
99
|
className,
|
|
@@ -106,7 +109,6 @@ export function UnforwardedButton(
|
|
|
106
109
|
size = 'default',
|
|
107
110
|
text,
|
|
108
111
|
variant,
|
|
109
|
-
__experimentalIsFocusable: isFocusable,
|
|
110
112
|
describedBy,
|
|
111
113
|
...buttonOrAnchorProps
|
|
112
114
|
} = useDeprecatedProps( props );
|
|
@@ -159,7 +161,7 @@ export function UnforwardedButton(
|
|
|
159
161
|
'has-icon': !! icon,
|
|
160
162
|
} );
|
|
161
163
|
|
|
162
|
-
const trulyDisabled = disabled && !
|
|
164
|
+
const trulyDisabled = disabled && ! accessibleWhenDisabled;
|
|
163
165
|
const Tag = href !== undefined && ! trulyDisabled ? 'a' : 'button';
|
|
164
166
|
const buttonProps: ComponentPropsWithoutRef< 'button' > =
|
|
165
167
|
Tag === 'button'
|
|
@@ -177,7 +179,7 @@ export function UnforwardedButton(
|
|
|
177
179
|
const disableEventProps: {
|
|
178
180
|
[ key: string ]: ( event: MouseEvent ) => void;
|
|
179
181
|
} = {};
|
|
180
|
-
if ( disabled &&
|
|
182
|
+
if ( disabled && accessibleWhenDisabled ) {
|
|
181
183
|
// In this case, the button will be disabled, but still focusable and
|
|
182
184
|
// perceivable by screen reader users.
|
|
183
185
|
buttonProps[ 'aria-disabled' ] = true;
|
|
@@ -39,12 +39,13 @@ export const VariantStates: StoryFn< typeof Button > = (
|
|
|
39
39
|
key={ variant ?? 'undefined' }
|
|
40
40
|
>
|
|
41
41
|
<Button { ...props } variant={ variant } />
|
|
42
|
+
{ /* eslint-disable-next-line no-restricted-syntax */ }
|
|
42
43
|
<Button { ...props } variant={ variant } disabled />
|
|
43
44
|
<Button
|
|
44
45
|
{ ...props }
|
|
45
46
|
variant={ variant }
|
|
46
47
|
disabled
|
|
47
|
-
|
|
48
|
+
accessibleWhenDisabled
|
|
48
49
|
/>
|
|
49
50
|
<Button { ...props } variant={ variant } isBusy />
|
|
50
51
|
<Button { ...props } variant={ variant } isDestructive />
|
|
@@ -235,13 +235,14 @@ describe( 'Button', () => {
|
|
|
235
235
|
} );
|
|
236
236
|
|
|
237
237
|
it( 'should add a disabled prop to the button', () => {
|
|
238
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
238
239
|
render( <Button disabled /> );
|
|
239
240
|
|
|
240
241
|
expect( screen.getByRole( 'button' ) ).toBeDisabled();
|
|
241
242
|
} );
|
|
242
243
|
|
|
243
244
|
it( 'should add only aria-disabled attribute when disabled and isFocusable are true', () => {
|
|
244
|
-
render( <Button disabled
|
|
245
|
+
render( <Button disabled accessibleWhenDisabled /> );
|
|
245
246
|
const button = screen.getByRole( 'button' );
|
|
246
247
|
|
|
247
248
|
expect( button ).toBeEnabled();
|
|
@@ -536,6 +537,7 @@ describe( 'Button', () => {
|
|
|
536
537
|
|
|
537
538
|
it( 'should become a button again when disabled is supplied', () => {
|
|
538
539
|
// @ts-expect-error - a button should not have `href`
|
|
540
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
539
541
|
render( <Button href="https://wordpress.org/" disabled /> );
|
|
540
542
|
|
|
541
543
|
expect( screen.getByRole( 'button' ) ).toBeVisible();
|
|
@@ -617,6 +619,15 @@ describe( 'Button', () => {
|
|
|
617
619
|
'mixed'
|
|
618
620
|
);
|
|
619
621
|
} );
|
|
622
|
+
|
|
623
|
+
it( 'should not break when the legacy __experimentalIsFocusable prop is passed', () => {
|
|
624
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
625
|
+
render( <Button disabled __experimentalIsFocusable /> );
|
|
626
|
+
const button = screen.getByRole( 'button' );
|
|
627
|
+
|
|
628
|
+
expect( button ).toBeEnabled();
|
|
629
|
+
expect( button ).toHaveAttribute( 'aria-disabled' );
|
|
630
|
+
} );
|
|
620
631
|
} );
|
|
621
632
|
|
|
622
633
|
describe( 'static typing', () => {
|
|
@@ -624,15 +635,19 @@ describe( 'Button', () => {
|
|
|
624
635
|
<Button href="foo" />
|
|
625
636
|
{ /* @ts-expect-error - `target` requires `href` */ }
|
|
626
637
|
<Button target="foo" />
|
|
638
|
+
|
|
639
|
+
{ /* eslint-disable no-restricted-syntax */ }
|
|
627
640
|
{ /* @ts-expect-error - `disabled` is only for buttons */ }
|
|
628
641
|
<Button href="foo" disabled />
|
|
642
|
+
{ /* eslint-enable no-restricted-syntax */ }
|
|
643
|
+
|
|
629
644
|
<Button href="foo" type="image/png" />
|
|
630
645
|
{ /* @ts-expect-error - if button, type must be submit/reset/button */ }
|
|
631
646
|
<Button type="image/png" />
|
|
632
647
|
{ /* @ts-expect-error */ }
|
|
633
648
|
<Button type="invalidtype" />
|
|
634
649
|
{ /* @ts-expect-error - although the runtime behavior will allow this to be an anchor, this is probably a mistake. */ }
|
|
635
|
-
<Button disabled
|
|
650
|
+
<Button disabled accessibleWhenDisabled href="foo" />
|
|
636
651
|
</>;
|
|
637
652
|
} );
|
|
638
653
|
} );
|
package/src/button/types.ts
CHANGED
|
@@ -25,6 +25,19 @@ type BaseButtonProps = {
|
|
|
25
25
|
* @default false
|
|
26
26
|
*/
|
|
27
27
|
__next40pxDefaultSize?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Whether to keep the button focusable when disabled.
|
|
30
|
+
*
|
|
31
|
+
* In most cases, it is recommended to set this to `true`. Disabling a control without maintaining focusability
|
|
32
|
+
* can cause accessibility issues, by hiding their presence from screen reader users,
|
|
33
|
+
* or by preventing focus from returning to a trigger element.
|
|
34
|
+
*
|
|
35
|
+
* Learn more about the [focusability of disabled controls](https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/#focusabilityofdisabledcontrols)
|
|
36
|
+
* in the WAI-ARIA Authoring Practices Guide.
|
|
37
|
+
*
|
|
38
|
+
* @default false
|
|
39
|
+
*/
|
|
40
|
+
accessibleWhenDisabled?: boolean;
|
|
28
41
|
/**
|
|
29
42
|
* The button's children.
|
|
30
43
|
*/
|
|
@@ -105,28 +118,24 @@ type BaseButtonProps = {
|
|
|
105
118
|
* 'link' (the link button styles)
|
|
106
119
|
*/
|
|
107
120
|
variant?: 'primary' | 'secondary' | 'tertiary' | 'link';
|
|
108
|
-
/**
|
|
109
|
-
* Whether to keep the button focusable when disabled.
|
|
110
|
-
*
|
|
111
|
-
* @default false
|
|
112
|
-
*/
|
|
113
|
-
__experimentalIsFocusable?: boolean;
|
|
114
121
|
};
|
|
115
122
|
|
|
116
123
|
type _ButtonProps = {
|
|
117
124
|
/**
|
|
118
|
-
* Whether the button is disabled.
|
|
125
|
+
* Whether the button is disabled. If `true`, this will force a `button` element
|
|
126
|
+
* to be rendered, even when an `href` is given.
|
|
119
127
|
*
|
|
120
|
-
*
|
|
128
|
+
* In most cases, it is recommended to also set the `accessibleWhenDisabled` prop to `true`.
|
|
121
129
|
*/
|
|
122
130
|
disabled?: boolean;
|
|
123
131
|
};
|
|
124
132
|
|
|
125
133
|
type AnchorProps = {
|
|
126
134
|
/**
|
|
127
|
-
* Whether the button is disabled.
|
|
135
|
+
* Whether the button is disabled. If `true`, this will force a `button` element
|
|
136
|
+
* to be rendered, even when an `href` is given.
|
|
128
137
|
*
|
|
129
|
-
*
|
|
138
|
+
* In most cases, it is recommended to also set the `accessibleWhenDisabled` prop to `true`.
|
|
130
139
|
*/
|
|
131
140
|
disabled?: false;
|
|
132
141
|
/**
|
|
@@ -140,6 +149,14 @@ type AnchorProps = {
|
|
|
140
149
|
};
|
|
141
150
|
|
|
142
151
|
export type DeprecatedButtonProps = {
|
|
152
|
+
/**
|
|
153
|
+
* Whether to keep the button focusable when disabled.
|
|
154
|
+
*
|
|
155
|
+
* @default false
|
|
156
|
+
* @deprecated Use the `accessibleWhenDisabled` prop instead.
|
|
157
|
+
* @ignore
|
|
158
|
+
*/
|
|
159
|
+
__experimentalIsFocusable?: boolean;
|
|
143
160
|
/**
|
|
144
161
|
* Gives the button a default style.
|
|
145
162
|
*
|
|
@@ -346,6 +346,8 @@ function ComboboxControl( props: ComboboxControlProps ) {
|
|
|
346
346
|
<Button
|
|
347
347
|
className="components-combobox-control__reset"
|
|
348
348
|
icon={ closeSmall }
|
|
349
|
+
// Disable reason: Focus returns to input field when reset is clicked.
|
|
350
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
349
351
|
disabled={ ! value }
|
|
350
352
|
onClick={ handleOnReset }
|
|
351
353
|
label={ __( 'Reset' ) }
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
* @see https://ariakit.org/components/composite
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
/* eslint-disable-next-line no-restricted-imports */
|
|
12
11
|
export {
|
|
13
12
|
Composite,
|
|
14
13
|
CompositeGroup,
|
|
@@ -18,5 +17,4 @@ export {
|
|
|
18
17
|
useCompositeStore,
|
|
19
18
|
} from '@ariakit/react';
|
|
20
19
|
|
|
21
|
-
/* eslint-disable-next-line no-restricted-imports */
|
|
22
20
|
export type { CompositeStore, CompositeStoreProps } from '@ariakit/react';
|
|
@@ -190,14 +190,14 @@ describe.each( [
|
|
|
190
190
|
await user.keyboard( '{enter}' );
|
|
191
191
|
expect(
|
|
192
192
|
screen.getByRole( 'listbox', {
|
|
193
|
-
name:
|
|
193
|
+
name: props.label,
|
|
194
194
|
} )
|
|
195
195
|
).toBeVisible();
|
|
196
196
|
|
|
197
197
|
await user.keyboard( '{escape}' );
|
|
198
198
|
expect(
|
|
199
199
|
screen.queryByRole( 'listbox', {
|
|
200
|
-
name:
|
|
200
|
+
name: props.label,
|
|
201
201
|
} )
|
|
202
202
|
).not.toBeInTheDocument();
|
|
203
203
|
|
|
@@ -440,6 +440,16 @@ describe.each( [
|
|
|
440
440
|
);
|
|
441
441
|
} );
|
|
442
442
|
|
|
443
|
+
it( 'Should label the component correctly even when the label is not visible', () => {
|
|
444
|
+
render( <Component { ...props } hideLabelFromVision /> );
|
|
445
|
+
|
|
446
|
+
expect(
|
|
447
|
+
screen.getByRole( 'button', {
|
|
448
|
+
name: props.label,
|
|
449
|
+
} )
|
|
450
|
+
).toBeVisible();
|
|
451
|
+
} );
|
|
452
|
+
|
|
443
453
|
describe( 'Keyboard behavior and accessibility', () => {
|
|
444
454
|
it( 'Captures the keypress event and does not let it propagate', async () => {
|
|
445
455
|
const user = userEvent.setup();
|
|
@@ -460,7 +470,7 @@ describe.each( [
|
|
|
460
470
|
await user.click( currentSelectedItem );
|
|
461
471
|
|
|
462
472
|
const customSelect = screen.getByRole( 'listbox', {
|
|
463
|
-
name:
|
|
473
|
+
name: props.label,
|
|
464
474
|
} );
|
|
465
475
|
await user.type( customSelect, '{enter}' );
|
|
466
476
|
|
|
@@ -482,7 +492,7 @@ describe.each( [
|
|
|
482
492
|
await user.keyboard( '{enter}' );
|
|
483
493
|
expect(
|
|
484
494
|
screen.getByRole( 'listbox', {
|
|
485
|
-
name:
|
|
495
|
+
name: props.label,
|
|
486
496
|
} )
|
|
487
497
|
).toHaveFocus();
|
|
488
498
|
|
|
@@ -507,7 +517,7 @@ describe.each( [
|
|
|
507
517
|
await user.keyboard( '{enter}' );
|
|
508
518
|
expect(
|
|
509
519
|
screen.getByRole( 'listbox', {
|
|
510
|
-
name:
|
|
520
|
+
name: props.label,
|
|
511
521
|
} )
|
|
512
522
|
).toHaveFocus();
|
|
513
523
|
|
|
@@ -533,7 +543,7 @@ describe.each( [
|
|
|
533
543
|
|
|
534
544
|
expect(
|
|
535
545
|
screen.queryByRole( 'listbox', {
|
|
536
|
-
name:
|
|
546
|
+
name: props.label,
|
|
537
547
|
hidden: true,
|
|
538
548
|
} )
|
|
539
549
|
).not.toBeInTheDocument();
|
|
@@ -542,6 +552,32 @@ describe.each( [
|
|
|
542
552
|
expect( currentSelectedItem ).toHaveTextContent( 'aquamarine' );
|
|
543
553
|
} );
|
|
544
554
|
|
|
555
|
+
it( 'Can change selection with a focused input and closed dropdown while pressing arrow keys', async () => {
|
|
556
|
+
const user = userEvent.setup();
|
|
557
|
+
|
|
558
|
+
render( <Component { ...props } /> );
|
|
559
|
+
|
|
560
|
+
const currentSelectedItem = screen.getByRole( 'button', {
|
|
561
|
+
expanded: false,
|
|
562
|
+
} );
|
|
563
|
+
|
|
564
|
+
await user.tab();
|
|
565
|
+
expect( currentSelectedItem ).toHaveFocus();
|
|
566
|
+
expect( currentSelectedItem ).toHaveTextContent(
|
|
567
|
+
props.options[ 0 ].name
|
|
568
|
+
);
|
|
569
|
+
|
|
570
|
+
await user.keyboard( '{arrowdown}' );
|
|
571
|
+
await user.keyboard( '{arrowdown}' );
|
|
572
|
+
expect(
|
|
573
|
+
screen.queryByRole( 'listbox', { name: props.label } )
|
|
574
|
+
).not.toBeInTheDocument();
|
|
575
|
+
|
|
576
|
+
expect( currentSelectedItem ).toHaveTextContent(
|
|
577
|
+
props.options[ 2 ].name
|
|
578
|
+
);
|
|
579
|
+
} );
|
|
580
|
+
|
|
545
581
|
it( 'Should have correct aria-selected value for selections', async () => {
|
|
546
582
|
const user = userEvent.setup();
|
|
547
583
|
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import * as Ariakit from '@ariakit/react';
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* WordPress dependencies
|
|
3
8
|
*/
|
|
4
|
-
import { createContext, useMemo } from '@wordpress/element';
|
|
9
|
+
import { createContext, useCallback, useMemo } from '@wordpress/element';
|
|
5
10
|
import { __, sprintf } from '@wordpress/i18n';
|
|
6
11
|
|
|
7
12
|
/**
|
|
@@ -14,11 +19,12 @@ import type {
|
|
|
14
19
|
CustomSelectStore,
|
|
15
20
|
CustomSelectButtonProps,
|
|
16
21
|
CustomSelectButtonSize,
|
|
22
|
+
_CustomSelectInternalProps,
|
|
17
23
|
_CustomSelectProps,
|
|
18
24
|
} from './types';
|
|
19
|
-
import type { WordPressComponentProps } from '../context';
|
|
20
25
|
import InputBase from '../input-control/input-base';
|
|
21
26
|
import SelectControlChevronDown from '../select-control/chevron-down';
|
|
27
|
+
import BaseControl from '../base-control';
|
|
22
28
|
|
|
23
29
|
export const CustomSelectContext =
|
|
24
30
|
createContext< CustomSelectContextType >( undefined );
|
|
@@ -50,11 +56,10 @@ const CustomSelectButton = ( {
|
|
|
50
56
|
store,
|
|
51
57
|
...restProps
|
|
52
58
|
}: Omit<
|
|
53
|
-
|
|
54
|
-
CustomSelectButtonProps &
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
>,
|
|
59
|
+
React.ComponentProps< typeof Ariakit.Select > &
|
|
60
|
+
CustomSelectButtonProps &
|
|
61
|
+
CustomSelectButtonSize &
|
|
62
|
+
CustomSelectStore,
|
|
58
63
|
'onChange'
|
|
59
64
|
> ) => {
|
|
60
65
|
const { value: currentValue } = store.useState();
|
|
@@ -70,9 +75,6 @@ const CustomSelectButton = ( {
|
|
|
70
75
|
size={ size }
|
|
71
76
|
hasCustomRenderProp={ !! renderSelectedValue }
|
|
72
77
|
store={ store }
|
|
73
|
-
// to match legacy behavior where using arrow keys
|
|
74
|
-
// move selection rather than open the popover
|
|
75
|
-
showOnKeyDown={ false }
|
|
76
78
|
>
|
|
77
79
|
{ computedRenderSelectedValue( currentValue ) }
|
|
78
80
|
</Styled.Select>
|
|
@@ -80,7 +82,10 @@ const CustomSelectButton = ( {
|
|
|
80
82
|
};
|
|
81
83
|
|
|
82
84
|
function _CustomSelect(
|
|
83
|
-
props:
|
|
85
|
+
props: _CustomSelectInternalProps &
|
|
86
|
+
_CustomSelectProps &
|
|
87
|
+
CustomSelectStore &
|
|
88
|
+
CustomSelectButtonSize
|
|
84
89
|
) {
|
|
85
90
|
const {
|
|
86
91
|
children,
|
|
@@ -88,18 +93,40 @@ function _CustomSelect(
|
|
|
88
93
|
label,
|
|
89
94
|
size,
|
|
90
95
|
store,
|
|
96
|
+
className,
|
|
97
|
+
isLegacy = false,
|
|
91
98
|
...restProps
|
|
92
99
|
} = props;
|
|
93
100
|
|
|
101
|
+
const onSelectPopoverKeyDown: React.KeyboardEventHandler< HTMLDivElement > =
|
|
102
|
+
useCallback(
|
|
103
|
+
( e ) => {
|
|
104
|
+
if ( isLegacy ) {
|
|
105
|
+
e.stopPropagation();
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
[ isLegacy ]
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
const contextValue = useMemo( () => ( { store, size } ), [ store, size ] );
|
|
112
|
+
|
|
94
113
|
return (
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
114
|
+
// Where should `restProps` be forwarded to?
|
|
115
|
+
<div className={ className }>
|
|
116
|
+
<Ariakit.SelectLabel
|
|
117
|
+
store={ store }
|
|
118
|
+
render={
|
|
119
|
+
hideLabelFromVision ? (
|
|
120
|
+
// @ts-expect-error `children` are passed via the render prop
|
|
121
|
+
<VisuallyHidden />
|
|
122
|
+
) : (
|
|
123
|
+
// @ts-expect-error `children` are passed via the render prop
|
|
124
|
+
<BaseControl.VisualLabel as="div" />
|
|
125
|
+
)
|
|
126
|
+
}
|
|
127
|
+
>
|
|
128
|
+
{ label }
|
|
129
|
+
</Ariakit.SelectLabel>
|
|
103
130
|
<InputBase
|
|
104
131
|
__next40pxDefaultSize
|
|
105
132
|
size={ size }
|
|
@@ -109,14 +136,22 @@ function _CustomSelect(
|
|
|
109
136
|
{ ...restProps }
|
|
110
137
|
size={ size }
|
|
111
138
|
store={ store }
|
|
139
|
+
// Match legacy behavior (move selection rather than open the popover)
|
|
140
|
+
showOnKeyDown={ ! isLegacy }
|
|
112
141
|
/>
|
|
113
|
-
<Styled.SelectPopover
|
|
114
|
-
|
|
142
|
+
<Styled.SelectPopover
|
|
143
|
+
gutter={ 12 }
|
|
144
|
+
store={ store }
|
|
145
|
+
sameWidth
|
|
146
|
+
slide={ false }
|
|
147
|
+
onKeyDown={ onSelectPopoverKeyDown }
|
|
148
|
+
>
|
|
149
|
+
<CustomSelectContext.Provider value={ contextValue }>
|
|
115
150
|
{ children }
|
|
116
151
|
</CustomSelectContext.Provider>
|
|
117
152
|
</Styled.SelectPopover>
|
|
118
153
|
</InputBase>
|
|
119
|
-
|
|
154
|
+
</div>
|
|
120
155
|
);
|
|
121
156
|
}
|
|
122
157
|
|
|
@@ -17,7 +17,11 @@ export function CustomSelectItem( {
|
|
|
17
17
|
}: WordPressComponentProps< CustomSelectItemProps, 'div', false > ) {
|
|
18
18
|
const customSelectContext = useContext( CustomSelectContext );
|
|
19
19
|
return (
|
|
20
|
-
<Styled.SelectItem
|
|
20
|
+
<Styled.SelectItem
|
|
21
|
+
store={ customSelectContext?.store }
|
|
22
|
+
size={ customSelectContext?.size ?? 'default' }
|
|
23
|
+
{ ...props }
|
|
24
|
+
>
|
|
21
25
|
{ children ?? props.value }
|
|
22
26
|
<Styled.SelectedItemCheck>
|
|
23
27
|
<Icon icon={ check } />
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
// eslint-disable-next-line no-restricted-imports
|
|
5
4
|
import * as Ariakit from '@ariakit/react';
|
|
5
|
+
import clsx from 'clsx';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Internal dependencies
|
|
@@ -21,6 +21,7 @@ function CustomSelectControl( props: LegacyCustomSelectProps ) {
|
|
|
21
21
|
onChange,
|
|
22
22
|
size = 'default',
|
|
23
23
|
value,
|
|
24
|
+
className: classNameProp,
|
|
24
25
|
...restProps
|
|
25
26
|
} = props;
|
|
26
27
|
|
|
@@ -62,12 +63,15 @@ function CustomSelectControl( props: LegacyCustomSelectProps ) {
|
|
|
62
63
|
const children = options.map(
|
|
63
64
|
( { name, key, __experimentalHint, style, className } ) => {
|
|
64
65
|
const withHint = (
|
|
65
|
-
<Styled.
|
|
66
|
+
<Styled.WithHintItemWrapper>
|
|
66
67
|
<span>{ name }</span>
|
|
67
|
-
<Styled.
|
|
68
|
+
<Styled.WithHintItemHint
|
|
69
|
+
// TODO: Legacy classname. Add V1 styles are removed from the codebase
|
|
70
|
+
// className="components-custom-select-control__item-hint"
|
|
71
|
+
>
|
|
68
72
|
{ __experimentalHint }
|
|
69
|
-
</Styled.
|
|
70
|
-
</Styled.
|
|
73
|
+
</Styled.WithHintItemHint>
|
|
74
|
+
</Styled.WithHintItemWrapper>
|
|
71
75
|
);
|
|
72
76
|
|
|
73
77
|
return (
|
|
@@ -76,7 +80,15 @@ function CustomSelectControl( props: LegacyCustomSelectProps ) {
|
|
|
76
80
|
value={ name }
|
|
77
81
|
children={ __experimentalHint ? withHint : name }
|
|
78
82
|
style={ style }
|
|
79
|
-
className={
|
|
83
|
+
className={ clsx(
|
|
84
|
+
// TODO: Legacy classname. Add V1 styles are removed from the codebase
|
|
85
|
+
// 'components-custom-select-control__item',
|
|
86
|
+
className
|
|
87
|
+
// TODO: Legacy classname. Add V1 styles are removed from the codebase
|
|
88
|
+
// {
|
|
89
|
+
// 'has-hint': __experimentalHint,
|
|
90
|
+
// }
|
|
91
|
+
) }
|
|
80
92
|
/>
|
|
81
93
|
);
|
|
82
94
|
}
|
|
@@ -92,7 +104,10 @@ function CustomSelectControl( props: LegacyCustomSelectProps ) {
|
|
|
92
104
|
return (
|
|
93
105
|
<Styled.SelectedExperimentalHintWrapper>
|
|
94
106
|
{ currentValue }
|
|
95
|
-
<Styled.SelectedExperimentalHintItem
|
|
107
|
+
<Styled.SelectedExperimentalHintItem
|
|
108
|
+
// TODO: Legacy classname. Add V1 styles are removed from the codebase
|
|
109
|
+
// className="components-custom-select-control__hint"
|
|
110
|
+
>
|
|
96
111
|
{ currentHint?.__experimentalHint }
|
|
97
112
|
</Styled.SelectedExperimentalHintItem>
|
|
98
113
|
</Styled.SelectedExperimentalHintWrapper>
|
|
@@ -122,6 +137,12 @@ function CustomSelectControl( props: LegacyCustomSelectProps ) {
|
|
|
122
137
|
}
|
|
123
138
|
size={ translatedSize }
|
|
124
139
|
store={ store }
|
|
140
|
+
className={ clsx(
|
|
141
|
+
// TODO: Legacy classname. Add V1 styles are removed from the codebase
|
|
142
|
+
// 'components-custom-select-control',
|
|
143
|
+
classNameProp
|
|
144
|
+
) }
|
|
145
|
+
isLegacy
|
|
125
146
|
{ ...restProps }
|
|
126
147
|
>
|
|
127
148
|
{ children }
|