@wordpress/components 28.1.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 +179 -120
- 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 +58 -36
- 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 +33 -15
- package/build/custom-select-control-v2/legacy-component/index.js.map +1 -1
- package/build/custom-select-control-v2/styles.js +92 -65
- 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/drop-zone/index.js +16 -79
- package/build/drop-zone/index.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/lock-unlock.js +1 -1
- package/build/lock-unlock.js.map +1 -1
- package/build/menu-items-choice/types.js.map +1 -1
- package/build/palette-edit/index.js +30 -38
- package/build/palette-edit/index.js.map +1 -1
- package/build/palette-edit/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 +59 -38
- 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 +33 -16
- package/build-module/custom-select-control-v2/legacy-component/index.js.map +1 -1
- package/build-module/custom-select-control-v2/styles.js +90 -63
- 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/drop-zone/index.js +17 -80
- package/build-module/drop-zone/index.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/lock-unlock.js +1 -1
- package/build-module/lock-unlock.js.map +1 -1
- package/build-module/menu-items-choice/types.js.map +1 -1
- package/build-module/palette-edit/index.js +31 -39
- package/build-module/palette-edit/index.js.map +1 -1
- package/build-module/palette-edit/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 +46 -6
- package/build-style/style.css +46 -6
- 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/stories/index.story.d.ts +15 -0
- package/build-types/custom-select-control/stories/index.story.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 -22
- package/build-types/custom-select-control-v2/styles.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/types.d.ts +13 -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/drop-zone/index.d.ts +3 -0
- package/build-types/drop-zone/index.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/palette-edit/index.d.ts.map +1 -1
- package/build-types/palette-edit/types.d.ts +1 -3
- package/build-types/palette-edit/types.d.ts.map +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/stories/index.story.tsx +32 -3
- package/src/custom-select-control/test/index.js +247 -28
- package/src/custom-select-control-v2/custom-select.tsx +58 -23
- 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 +45 -16
- package/src/custom-select-control-v2/legacy-component/test/index.tsx +261 -43
- package/src/custom-select-control-v2/styles.ts +156 -74
- package/src/custom-select-control-v2/test/index.tsx +35 -5
- package/src/custom-select-control-v2/types.ts +19 -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/drop-zone/index.tsx +17 -76
- package/src/drop-zone/style.scss +51 -16
- 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/lock-unlock.js +1 -1
- package/src/menu-items-choice/types.ts +2 -1
- package/src/palette-edit/index.tsx +33 -45
- package/src/palette-edit/test/index.tsx +3 -4
- package/src/palette-edit/types.ts +1 -3
- 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
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { render, screen } from '@testing-library/react';
|
|
5
|
+
import userEvent from '@testing-library/user-event';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
import TimeInput from '..';
|
|
11
|
+
|
|
12
|
+
describe( 'TimeInput', () => {
|
|
13
|
+
it( 'should call onChange with updated values | 24-hours format', async () => {
|
|
14
|
+
const user = userEvent.setup();
|
|
15
|
+
|
|
16
|
+
const timeInputValue = { hours: 0, minutes: 0 };
|
|
17
|
+
const onChangeSpy = jest.fn();
|
|
18
|
+
|
|
19
|
+
render(
|
|
20
|
+
<TimeInput
|
|
21
|
+
defaultValue={ timeInputValue }
|
|
22
|
+
onChange={ onChangeSpy }
|
|
23
|
+
/>
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
const hoursInput = screen.getByRole( 'spinbutton', { name: 'Hours' } );
|
|
27
|
+
const minutesInput = screen.getByRole( 'spinbutton', {
|
|
28
|
+
name: 'Minutes',
|
|
29
|
+
} );
|
|
30
|
+
|
|
31
|
+
await user.clear( minutesInput );
|
|
32
|
+
await user.type( minutesInput, '35' );
|
|
33
|
+
await user.keyboard( '{Tab}' );
|
|
34
|
+
|
|
35
|
+
expect( onChangeSpy ).toHaveBeenCalledWith( { hours: 0, minutes: 35 } );
|
|
36
|
+
onChangeSpy.mockClear();
|
|
37
|
+
|
|
38
|
+
await user.clear( hoursInput );
|
|
39
|
+
await user.type( hoursInput, '12' );
|
|
40
|
+
await user.keyboard( '{Tab}' );
|
|
41
|
+
|
|
42
|
+
expect( onChangeSpy ).toHaveBeenCalledWith( {
|
|
43
|
+
hours: 12,
|
|
44
|
+
minutes: 35,
|
|
45
|
+
} );
|
|
46
|
+
onChangeSpy.mockClear();
|
|
47
|
+
|
|
48
|
+
await user.clear( hoursInput );
|
|
49
|
+
await user.type( hoursInput, '23' );
|
|
50
|
+
await user.keyboard( '{Tab}' );
|
|
51
|
+
|
|
52
|
+
expect( onChangeSpy ).toHaveBeenCalledWith( {
|
|
53
|
+
hours: 23,
|
|
54
|
+
minutes: 35,
|
|
55
|
+
} );
|
|
56
|
+
onChangeSpy.mockClear();
|
|
57
|
+
|
|
58
|
+
await user.clear( minutesInput );
|
|
59
|
+
await user.type( minutesInput, '0' );
|
|
60
|
+
await user.keyboard( '{Tab}' );
|
|
61
|
+
|
|
62
|
+
expect( onChangeSpy ).toHaveBeenCalledWith( { hours: 23, minutes: 0 } );
|
|
63
|
+
} );
|
|
64
|
+
|
|
65
|
+
it( 'should call onChange with updated values | 12-hours format', async () => {
|
|
66
|
+
const user = userEvent.setup();
|
|
67
|
+
|
|
68
|
+
const timeInputValue = { hours: 0, minutes: 0 };
|
|
69
|
+
const onChangeSpy = jest.fn();
|
|
70
|
+
|
|
71
|
+
render(
|
|
72
|
+
<TimeInput
|
|
73
|
+
is12Hour
|
|
74
|
+
defaultValue={ timeInputValue }
|
|
75
|
+
onChange={ onChangeSpy }
|
|
76
|
+
/>
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
const hoursInput = screen.getByRole( 'spinbutton', { name: 'Hours' } );
|
|
80
|
+
const minutesInput = screen.getByRole( 'spinbutton', {
|
|
81
|
+
name: 'Minutes',
|
|
82
|
+
} );
|
|
83
|
+
const amButton = screen.getByRole( 'button', { name: 'AM' } );
|
|
84
|
+
const pmButton = screen.getByRole( 'button', { name: 'PM' } );
|
|
85
|
+
|
|
86
|
+
// TODO: Update assert these states through the accessibility tree rather than through styles, see: https://github.com/WordPress/gutenberg/issues/61163
|
|
87
|
+
expect( amButton ).toHaveClass( 'is-primary' );
|
|
88
|
+
expect( pmButton ).not.toHaveClass( 'is-primary' );
|
|
89
|
+
expect( hoursInput ).not.toHaveValue( 0 );
|
|
90
|
+
expect( hoursInput ).toHaveValue( 12 );
|
|
91
|
+
|
|
92
|
+
await user.clear( minutesInput );
|
|
93
|
+
await user.type( minutesInput, '35' );
|
|
94
|
+
await user.keyboard( '{Tab}' );
|
|
95
|
+
|
|
96
|
+
expect( onChangeSpy ).toHaveBeenCalledWith( { hours: 0, minutes: 35 } );
|
|
97
|
+
expect( amButton ).toHaveClass( 'is-primary' );
|
|
98
|
+
|
|
99
|
+
await user.clear( hoursInput );
|
|
100
|
+
await user.type( hoursInput, '12' );
|
|
101
|
+
await user.keyboard( '{Tab}' );
|
|
102
|
+
|
|
103
|
+
expect( onChangeSpy ).toHaveBeenCalledWith( { hours: 0, minutes: 35 } );
|
|
104
|
+
|
|
105
|
+
await user.click( pmButton );
|
|
106
|
+
expect( onChangeSpy ).toHaveBeenCalledWith( {
|
|
107
|
+
hours: 12,
|
|
108
|
+
minutes: 35,
|
|
109
|
+
} );
|
|
110
|
+
expect( pmButton ).toHaveClass( 'is-primary' );
|
|
111
|
+
} );
|
|
112
|
+
|
|
113
|
+
it( 'should call onChange with defined minutes steps', async () => {
|
|
114
|
+
const user = userEvent.setup();
|
|
115
|
+
|
|
116
|
+
const timeInputValue = { hours: 0, minutes: 0 };
|
|
117
|
+
const onChangeSpy = jest.fn();
|
|
118
|
+
|
|
119
|
+
render(
|
|
120
|
+
<TimeInput
|
|
121
|
+
defaultValue={ timeInputValue }
|
|
122
|
+
minutesProps={ { step: 5 } }
|
|
123
|
+
onChange={ onChangeSpy }
|
|
124
|
+
/>
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
const minutesInput = screen.getByRole( 'spinbutton', {
|
|
128
|
+
name: 'Minutes',
|
|
129
|
+
} );
|
|
130
|
+
|
|
131
|
+
await user.clear( minutesInput );
|
|
132
|
+
await user.keyboard( '{ArrowUp}' );
|
|
133
|
+
|
|
134
|
+
expect( minutesInput ).toHaveValue( 5 );
|
|
135
|
+
|
|
136
|
+
await user.keyboard( '{ArrowUp}' );
|
|
137
|
+
await user.keyboard( '{ArrowUp}' );
|
|
138
|
+
|
|
139
|
+
expect( minutesInput ).toHaveValue( 15 );
|
|
140
|
+
|
|
141
|
+
await user.keyboard( '{ArrowDown}' );
|
|
142
|
+
|
|
143
|
+
expect( minutesInput ).toHaveValue( 10 );
|
|
144
|
+
|
|
145
|
+
await user.clear( minutesInput );
|
|
146
|
+
await user.type( minutesInput, '44' );
|
|
147
|
+
await user.keyboard( '{Tab}' );
|
|
148
|
+
|
|
149
|
+
expect( minutesInput ).toHaveValue( 45 );
|
|
150
|
+
|
|
151
|
+
await user.clear( minutesInput );
|
|
152
|
+
await user.type( minutesInput, '51' );
|
|
153
|
+
await user.keyboard( '{Tab}' );
|
|
154
|
+
|
|
155
|
+
expect( minutesInput ).toHaveValue( 50 );
|
|
156
|
+
} );
|
|
157
|
+
|
|
158
|
+
it( 'should reflect changes to the value prop', () => {
|
|
159
|
+
const { rerender } = render(
|
|
160
|
+
<TimeInput value={ { hours: 0, minutes: 0 } } />
|
|
161
|
+
);
|
|
162
|
+
rerender( <TimeInput value={ { hours: 1, minutes: 2 } } /> );
|
|
163
|
+
|
|
164
|
+
expect(
|
|
165
|
+
screen.getByRole( 'spinbutton', { name: 'Hours' } )
|
|
166
|
+
).toHaveValue( 1 );
|
|
167
|
+
expect(
|
|
168
|
+
screen.getByRole( 'spinbutton', { name: 'Minutes' } )
|
|
169
|
+
).toHaveValue( 2 );
|
|
170
|
+
} );
|
|
171
|
+
} );
|
package/src/date-time/types.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { MinutesInput } from './time/styles';
|
|
5
|
+
|
|
1
6
|
export type TimePickerProps = {
|
|
2
7
|
/**
|
|
3
8
|
* The initial current time the time picker should render.
|
|
@@ -11,6 +16,14 @@ export type TimePickerProps = {
|
|
|
11
16
|
*/
|
|
12
17
|
is12Hour?: boolean;
|
|
13
18
|
|
|
19
|
+
/**
|
|
20
|
+
* The order of day, month, and year. This prop overrides the time format
|
|
21
|
+
* determined by `is12Hour` prop.
|
|
22
|
+
*
|
|
23
|
+
* @default 'dmy'
|
|
24
|
+
*/
|
|
25
|
+
dateOrder?: 'dmy' | 'mdy' | 'ymd';
|
|
26
|
+
|
|
14
27
|
/**
|
|
15
28
|
* The function called when a new time has been selected. It is passed the
|
|
16
29
|
* time as an argument.
|
|
@@ -18,6 +31,56 @@ export type TimePickerProps = {
|
|
|
18
31
|
onChange?: ( time: string ) => void;
|
|
19
32
|
};
|
|
20
33
|
|
|
34
|
+
export type TimeInputValue = {
|
|
35
|
+
/**
|
|
36
|
+
* The hours value in 24-hour format.
|
|
37
|
+
*/
|
|
38
|
+
hours: number;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The minutes value.
|
|
42
|
+
*/
|
|
43
|
+
minutes: number;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export type TimeInputProps = {
|
|
47
|
+
/**
|
|
48
|
+
* Whether we use a 12-hour clock. With a 12-hour clock, an AM/PM widget is
|
|
49
|
+
* displayed
|
|
50
|
+
*/
|
|
51
|
+
is12Hour?: boolean;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* The time input object with hours and minutes values.
|
|
55
|
+
*
|
|
56
|
+
* - hours: number (24-hour format)
|
|
57
|
+
* - minutes: number
|
|
58
|
+
*/
|
|
59
|
+
value?: TimeInputValue;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* An optional default value for the control when used in uncontrolled mode.
|
|
63
|
+
* If left `undefined`, the current time will be used.
|
|
64
|
+
*/
|
|
65
|
+
defaultValue?: TimeInputValue;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* The props to pass down to the minutes input.
|
|
69
|
+
*/
|
|
70
|
+
minutesProps?: React.ComponentProps< typeof MinutesInput >;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* The label for the time input.
|
|
74
|
+
*/
|
|
75
|
+
label?: string;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* The function is called when a new time has been selected.
|
|
79
|
+
* Passing hours and minutes as an object properties.
|
|
80
|
+
*/
|
|
81
|
+
onChange?: ( time: TimeInputValue ) => void;
|
|
82
|
+
};
|
|
83
|
+
|
|
21
84
|
export type DatePickerEvent = {
|
|
22
85
|
/**
|
|
23
86
|
* The date of the event.
|
package/src/date-time/utils.ts
CHANGED
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { toDate } from 'date-fns';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import type { InputState } from '../input-control/reducer/state';
|
|
10
|
+
import type { InputAction } from '../input-control/reducer/actions';
|
|
11
|
+
import { COMMIT, PRESS_DOWN, PRESS_UP } from '../input-control/reducer/actions';
|
|
12
|
+
|
|
6
13
|
/**
|
|
7
14
|
* Like date-fn's toDate, but tries to guess the format when a string is
|
|
8
15
|
* given.
|
|
@@ -15,3 +22,65 @@ export function inputToDate( input: Date | string | number ): Date {
|
|
|
15
22
|
}
|
|
16
23
|
return toDate( input );
|
|
17
24
|
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Converts a 12-hour time to a 24-hour time.
|
|
28
|
+
* @param hours
|
|
29
|
+
* @param isPm
|
|
30
|
+
*/
|
|
31
|
+
export function from12hTo24h( hours: number, isPm: boolean ) {
|
|
32
|
+
return isPm ? ( ( hours % 12 ) + 12 ) % 24 : hours % 12;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Converts a 24-hour time to a 12-hour time.
|
|
37
|
+
* @param hours
|
|
38
|
+
*/
|
|
39
|
+
export function from24hTo12h( hours: number ) {
|
|
40
|
+
return hours % 12 || 12;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Creates an InputControl reducer used to pad an input so that it is always a
|
|
45
|
+
* given width. For example, the hours and minutes inputs are padded to 2 so
|
|
46
|
+
* that '4' appears as '04'.
|
|
47
|
+
*
|
|
48
|
+
* @param pad How many digits the value should be.
|
|
49
|
+
*/
|
|
50
|
+
export function buildPadInputStateReducer( pad: number ) {
|
|
51
|
+
return ( state: InputState, action: InputAction ) => {
|
|
52
|
+
const nextState = { ...state };
|
|
53
|
+
if (
|
|
54
|
+
action.type === COMMIT ||
|
|
55
|
+
action.type === PRESS_UP ||
|
|
56
|
+
action.type === PRESS_DOWN
|
|
57
|
+
) {
|
|
58
|
+
if ( nextState.value !== undefined ) {
|
|
59
|
+
nextState.value = nextState.value
|
|
60
|
+
.toString()
|
|
61
|
+
.padStart( pad, '0' );
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return nextState;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Validates the target of a React event to ensure it is an input element and
|
|
70
|
+
* that the input is valid.
|
|
71
|
+
* @param event
|
|
72
|
+
*/
|
|
73
|
+
export function validateInputElementTarget( event: React.SyntheticEvent ) {
|
|
74
|
+
// `instanceof` checks need to get the instance definition from the
|
|
75
|
+
// corresponding window object — therefore, the following logic makes
|
|
76
|
+
// the component work correctly even when rendered inside an iframe.
|
|
77
|
+
const HTMLInputElementInstance =
|
|
78
|
+
( event.target as HTMLInputElement )?.ownerDocument.defaultView
|
|
79
|
+
?.HTMLInputElement ?? HTMLInputElement;
|
|
80
|
+
|
|
81
|
+
if ( ! ( event.target instanceof HTMLInputElementInstance ) ) {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return event.target.validity.valid;
|
|
86
|
+
}
|