@wordpress/components 28.5.0 → 28.6.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 +82 -0
- package/CONTRIBUTING.md +155 -64
- package/build/alignment-matrix-control/cell.js +2 -2
- package/build/alignment-matrix-control/cell.js.map +1 -1
- package/build/alignment-matrix-control/index.js +6 -5
- package/build/alignment-matrix-control/index.js.map +1 -1
- package/build/alignment-matrix-control/styles/alignment-matrix-control-styles.js +8 -17
- package/build/alignment-matrix-control/styles/alignment-matrix-control-styles.js.map +1 -1
- package/build/angle-picker-control/styles/angle-picker-control-styles.js +4 -4
- package/build/angle-picker-control/styles/angle-picker-control-styles.js.map +1 -1
- package/build/base-control/index.js +54 -41
- package/build/base-control/index.js.map +1 -1
- package/build/base-control/types.js.map +1 -1
- package/build/border-control/styles.js +13 -13
- package/build/border-control/styles.js.map +1 -1
- package/build/checkbox-control/index.js +1 -0
- package/build/checkbox-control/index.js.map +1 -1
- package/build/circular-option-picker/circular-option-picker-option.js +4 -4
- package/build/circular-option-picker/circular-option-picker-option.js.map +1 -1
- package/build/circular-option-picker/circular-option-picker.js +3 -3
- package/build/circular-option-picker/circular-option-picker.js.map +1 -1
- package/build/circular-option-picker/types.js.map +1 -1
- package/build/color-palette/utils.js +17 -5
- package/build/color-palette/utils.js.map +1 -1
- package/build/color-picker/input-with-slider.js +1 -0
- package/build/color-picker/input-with-slider.js.map +1 -1
- package/build/combobox-control/index.js +1 -0
- package/build/combobox-control/index.js.map +1 -1
- package/build/composite/context.js +19 -0
- package/build/composite/context.js.map +1 -0
- package/build/composite/index.js +287 -9
- package/build/composite/index.js.map +1 -1
- package/build/composite/legacy/index.js +10 -8
- package/build/composite/legacy/index.js.map +1 -1
- package/build/composite/types.js +6 -0
- package/build/composite/types.js.map +1 -0
- package/build/custom-select-control/types.js.map +1 -1
- package/build/custom-select-control-v2/custom-select.js +3 -2
- package/build/custom-select-control-v2/custom-select.js.map +1 -1
- package/build/date-time/time/index.js +11 -3
- package/build/date-time/time/index.js.map +1 -1
- package/build/date-time/types.js.map +1 -1
- package/build/dimension-control/index.js +25 -8
- package/build/dimension-control/index.js.map +1 -1
- package/build/dimension-control/types.js.map +1 -1
- package/build/dropdown-menu-v2/index.js +3 -2
- package/build/dropdown-menu-v2/index.js.map +1 -1
- package/build/dropdown-menu-v2/styles.js +23 -21
- package/build/dropdown-menu-v2/styles.js.map +1 -1
- package/build/focal-point-picker/controls.js +1 -3
- package/build/focal-point-picker/controls.js.map +1 -1
- package/build/focal-point-picker/index.js +1 -2
- package/build/focal-point-picker/index.js.map +1 -1
- package/build/focal-point-picker/styles/focal-point-picker-style.js +11 -11
- package/build/focal-point-picker/styles/focal-point-picker-style.js.map +1 -1
- package/build/focal-point-picker/types.js.map +1 -1
- package/build/form-file-upload/types.js.map +1 -1
- package/build/index.js +5 -5
- package/build/index.js.map +1 -1
- package/build/item-group/styles.js +11 -11
- package/build/item-group/styles.js.map +1 -1
- package/build/mobile/utils/alignments.native.js +1 -1
- package/build/mobile/utils/alignments.native.js.map +1 -1
- package/build/navigator/navigator-back-button/component.js +1 -1
- package/build/navigator/navigator-back-button/component.js.map +1 -1
- package/build/navigator/navigator-back-button/hook.js +3 -9
- package/build/navigator/navigator-back-button/hook.js.map +1 -1
- package/build/navigator/navigator-provider/component.js +17 -9
- package/build/navigator/navigator-provider/component.js.map +1 -1
- package/build/navigator/navigator-to-parent-button/component.js +13 -40
- package/build/navigator/navigator-to-parent-button/component.js.map +1 -1
- package/build/navigator/types.js.map +1 -1
- package/build/palette-edit/styles.js +11 -11
- package/build/palette-edit/styles.js.map +1 -1
- package/build/popover/index.js +6 -1
- package/build/popover/index.js.map +1 -1
- package/build/private-apis.js +6 -6
- package/build/private-apis.js.map +1 -1
- package/build/progress-bar/styles.js +5 -5
- package/build/progress-bar/styles.js.map +1 -1
- package/build/query-controls/index.js +5 -6
- package/build/query-controls/index.js.map +1 -1
- package/build/query-controls/types.js.map +1 -1
- package/build/radio-control/index.js +20 -19
- package/build/radio-control/index.js.map +1 -1
- package/build/radio-group/radio.js +3 -2
- package/build/radio-group/radio.js.map +1 -1
- package/build/range-control/index.js +32 -9
- package/build/range-control/index.js.map +1 -1
- package/build/range-control/styles/range-control-styles.js +29 -29
- package/build/range-control/styles/range-control-styles.js.map +1 -1
- package/build/search-control/index.js +5 -4
- package/build/search-control/index.js.map +1 -1
- package/build/select-control/index.js +1 -0
- package/build/select-control/index.js.map +1 -1
- package/build/tab-panel/index.js +3 -2
- package/build/tab-panel/index.js.map +1 -1
- package/build/tabs/index.js +3 -2
- package/build/tabs/index.js.map +1 -1
- package/build/tabs/tablist.js +6 -4
- package/build/tabs/tablist.js.map +1 -1
- package/build/tabs/tabpanel.js +6 -1
- package/build/tabs/tabpanel.js.map +1 -1
- package/build/text/styles.js +7 -7
- package/build/text/styles.js.map +1 -1
- package/build/text-control/index.js +1 -0
- package/build/text-control/index.js.map +1 -1
- package/build/textarea-control/index.js +1 -0
- package/build/textarea-control/index.js.map +1 -1
- package/build/textarea-control/styles/textarea-control-styles.js +8 -2
- package/build/textarea-control/styles/textarea-control-styles.js.map +1 -1
- package/build/toggle-control/index.js +9 -1
- package/build/toggle-control/index.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/as-radio-group.js +3 -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 +1 -0
- package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/styles.js +7 -7
- package/build/toggle-group-control/toggle-group-control/styles.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control-option-base/styles.js +9 -9
- package/build/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
- package/build/tools-panel/styles.js +13 -13
- package/build/tools-panel/styles.js.map +1 -1
- package/build/tooltip/index.js +3 -2
- package/build/tooltip/index.js.map +1 -1
- package/build/tree-select/index.js +19 -6
- package/build/tree-select/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/config-values.js +4 -3
- package/build/utils/config-values.js.map +1 -1
- package/build-module/alignment-matrix-control/cell.js +2 -2
- package/build-module/alignment-matrix-control/cell.js.map +1 -1
- package/build-module/alignment-matrix-control/index.js +4 -3
- package/build-module/alignment-matrix-control/index.js.map +1 -1
- package/build-module/alignment-matrix-control/styles/alignment-matrix-control-styles.js +9 -18
- package/build-module/alignment-matrix-control/styles/alignment-matrix-control-styles.js.map +1 -1
- package/build-module/angle-picker-control/styles/angle-picker-control-styles.js +4 -4
- package/build-module/angle-picker-control/styles/angle-picker-control-styles.js.map +1 -1
- package/build-module/base-control/index.js +54 -42
- package/build-module/base-control/index.js.map +1 -1
- package/build-module/base-control/types.js.map +1 -1
- package/build-module/border-control/styles.js +13 -13
- package/build-module/border-control/styles.js.map +1 -1
- package/build-module/checkbox-control/index.js +1 -0
- package/build-module/checkbox-control/index.js.map +1 -1
- package/build-module/circular-option-picker/circular-option-picker-option.js +4 -4
- package/build-module/circular-option-picker/circular-option-picker-option.js.map +1 -1
- package/build-module/circular-option-picker/circular-option-picker.js +1 -1
- package/build-module/circular-option-picker/circular-option-picker.js.map +1 -1
- package/build-module/circular-option-picker/types.js.map +1 -1
- package/build-module/color-palette/utils.js +17 -5
- package/build-module/color-palette/utils.js.map +1 -1
- package/build-module/color-picker/input-with-slider.js +1 -0
- package/build-module/color-picker/input-with-slider.js.map +1 -1
- package/build-module/combobox-control/index.js +1 -0
- package/build-module/combobox-control/index.js.map +1 -1
- package/build-module/composite/context.js +12 -0
- package/build-module/composite/context.js.map +1 -0
- package/build-module/composite/index.js +284 -6
- package/build-module/composite/index.js.map +1 -1
- package/build-module/composite/legacy/index.js +10 -6
- package/build-module/composite/legacy/index.js.map +1 -1
- package/build-module/composite/types.js +2 -0
- package/build-module/composite/types.js.map +1 -0
- package/build-module/custom-select-control/types.js.map +1 -1
- package/build-module/custom-select-control-v2/custom-select.js +2 -1
- package/build-module/custom-select-control-v2/custom-select.js.map +1 -1
- package/build-module/date-time/time/index.js +11 -3
- package/build-module/date-time/time/index.js.map +1 -1
- package/build-module/date-time/types.js.map +1 -1
- package/build-module/dimension-control/index.js +25 -8
- package/build-module/dimension-control/index.js.map +1 -1
- package/build-module/dimension-control/types.js.map +1 -1
- package/build-module/dropdown-menu-v2/index.js +2 -1
- package/build-module/dropdown-menu-v2/index.js.map +1 -1
- package/build-module/dropdown-menu-v2/styles.js +23 -21
- package/build-module/dropdown-menu-v2/styles.js.map +1 -1
- package/build-module/focal-point-picker/controls.js +1 -3
- package/build-module/focal-point-picker/controls.js.map +1 -1
- package/build-module/focal-point-picker/index.js +1 -2
- package/build-module/focal-point-picker/index.js.map +1 -1
- package/build-module/focal-point-picker/styles/focal-point-picker-style.js +11 -11
- package/build-module/focal-point-picker/styles/focal-point-picker-style.js.map +1 -1
- package/build-module/focal-point-picker/types.js.map +1 -1
- package/build-module/form-file-upload/types.js.map +1 -1
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/item-group/styles.js +11 -11
- package/build-module/item-group/styles.js.map +1 -1
- package/build-module/mobile/utils/alignments.native.js +1 -1
- package/build-module/mobile/utils/alignments.native.js.map +1 -1
- package/build-module/navigator/navigator-back-button/component.js +1 -1
- package/build-module/navigator/navigator-back-button/component.js.map +1 -1
- package/build-module/navigator/navigator-back-button/hook.js +3 -9
- package/build-module/navigator/navigator-back-button/hook.js.map +1 -1
- package/build-module/navigator/navigator-provider/component.js +17 -9
- package/build-module/navigator/navigator-provider/component.js.map +1 -1
- package/build-module/navigator/navigator-to-parent-button/component.js +12 -41
- package/build-module/navigator/navigator-to-parent-button/component.js.map +1 -1
- package/build-module/navigator/types.js.map +1 -1
- package/build-module/palette-edit/styles.js +11 -11
- package/build-module/palette-edit/styles.js.map +1 -1
- package/build-module/popover/index.js +6 -1
- package/build-module/popover/index.js.map +1 -1
- package/build-module/private-apis.js +6 -6
- package/build-module/private-apis.js.map +1 -1
- package/build-module/progress-bar/styles.js +5 -5
- package/build-module/progress-bar/styles.js.map +1 -1
- package/build-module/query-controls/index.js +5 -6
- package/build-module/query-controls/index.js.map +1 -1
- package/build-module/query-controls/types.js.map +1 -1
- package/build-module/radio-control/index.js +20 -19
- package/build-module/radio-control/index.js.map +1 -1
- package/build-module/radio-group/radio.js +2 -1
- package/build-module/radio-group/radio.js.map +1 -1
- package/build-module/range-control/index.js +32 -9
- package/build-module/range-control/index.js.map +1 -1
- package/build-module/range-control/styles/range-control-styles.js +29 -29
- package/build-module/range-control/styles/range-control-styles.js.map +1 -1
- package/build-module/search-control/index.js +5 -4
- package/build-module/search-control/index.js.map +1 -1
- package/build-module/select-control/index.js +1 -0
- package/build-module/select-control/index.js.map +1 -1
- package/build-module/tab-panel/index.js +2 -1
- package/build-module/tab-panel/index.js.map +1 -1
- package/build-module/tabs/index.js +2 -1
- package/build-module/tabs/index.js.map +1 -1
- package/build-module/tabs/tablist.js +5 -3
- package/build-module/tabs/tablist.js.map +1 -1
- package/build-module/tabs/tabpanel.js +6 -2
- package/build-module/tabs/tabpanel.js.map +1 -1
- package/build-module/text/styles.js +7 -7
- package/build-module/text/styles.js.map +1 -1
- package/build-module/text-control/index.js +1 -0
- package/build-module/text-control/index.js.map +1 -1
- package/build-module/textarea-control/index.js +1 -0
- package/build-module/textarea-control/index.js.map +1 -1
- package/build-module/textarea-control/styles/textarea-control-styles.js +9 -2
- package/build-module/textarea-control/styles/textarea-control-styles.js.map +1 -1
- package/build-module/toggle-control/index.js +9 -1
- package/build-module/toggle-control/index.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control/as-radio-group.js +2 -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 +1 -0
- package/build-module/toggle-group-control/toggle-group-control/component.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control/styles.js +7 -7
- package/build-module/toggle-group-control/toggle-group-control/styles.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js +9 -9
- package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
- package/build-module/tools-panel/styles.js +13 -13
- package/build-module/tools-panel/styles.js.map +1 -1
- package/build-module/tooltip/index.js +2 -1
- package/build-module/tooltip/index.js.map +1 -1
- package/build-module/tree-select/index.js +19 -6
- package/build-module/tree-select/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/config-values.js +4 -3
- package/build-module/utils/config-values.js.map +1 -1
- package/build-style/style-rtl.css +19 -9
- package/build-style/style.css +19 -9
- package/build-types/alignment-matrix-control/index.d.ts.map +1 -1
- package/build-types/alignment-matrix-control/styles/alignment-matrix-control-styles.d.ts.map +1 -1
- package/build-types/angle-picker-control/styles/angle-picker-control-styles.d.ts.map +1 -1
- package/build-types/base-control/hooks.d.ts +1 -0
- package/build-types/base-control/hooks.d.ts.map +1 -1
- package/build-types/base-control/index.d.ts +44 -0
- package/build-types/base-control/index.d.ts.map +1 -1
- package/build-types/base-control/types.d.ts +7 -0
- package/build-types/base-control/types.d.ts.map +1 -1
- package/build-types/checkbox-control/index.d.ts.map +1 -1
- package/build-types/checkbox-control/stories/index.story.d.ts.map +1 -1
- package/build-types/circular-option-picker/circular-option-picker-option.d.ts.map +1 -1
- package/build-types/circular-option-picker/types.d.ts +2 -3
- package/build-types/circular-option-picker/types.d.ts.map +1 -1
- package/build-types/color-palette/utils.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.map +1 -1
- package/build-types/combobox-control/index.d.ts.map +1 -1
- package/build-types/combobox-control/stories/index.story.d.ts.map +1 -1
- package/build-types/composite/context.d.ts +7 -0
- package/build-types/composite/context.d.ts.map +1 -0
- package/build-types/composite/index.d.ts +181 -1
- package/build-types/composite/index.d.ts.map +1 -1
- package/build-types/composite/legacy/index.d.ts +7 -2
- package/build-types/composite/legacy/index.d.ts.map +1 -1
- package/build-types/composite/legacy/stories/utils.d.ts +19 -0
- package/build-types/composite/legacy/stories/utils.d.ts.map +1 -1
- package/build-types/composite/stories/index.story.d.ts +13 -0
- package/build-types/composite/stories/index.story.d.ts.map +1 -0
- package/build-types/composite/stories/utils.d.ts +29 -0
- package/build-types/composite/stories/utils.d.ts.map +1 -0
- package/build-types/composite/types.d.ts +288 -0
- package/build-types/composite/types.d.ts.map +1 -0
- package/build-types/custom-select-control/types.d.ts +3 -3
- package/build-types/custom-select-control/types.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/custom-select.d.ts.map +1 -1
- package/build-types/date-time/date-time/index.d.ts +1 -1
- 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/types.d.ts +7 -1
- package/build-types/date-time/types.d.ts.map +1 -1
- package/build-types/dimension-control/index.d.ts +1 -0
- package/build-types/dimension-control/index.d.ts.map +1 -1
- package/build-types/dimension-control/stories/index.story.d.ts +8 -1
- package/build-types/dimension-control/stories/index.story.d.ts.map +1 -1
- package/build-types/dimension-control/types.d.ts +2 -7
- package/build-types/dimension-control/types.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/focal-point-picker/controls.d.ts +1 -1
- package/build-types/focal-point-picker/controls.d.ts.map +1 -1
- package/build-types/focal-point-picker/index.d.ts +1 -1
- package/build-types/focal-point-picker/index.d.ts.map +1 -1
- package/build-types/focal-point-picker/stories/index.story.d.ts.map +1 -1
- package/build-types/focal-point-picker/types.d.ts +2 -2
- package/build-types/focal-point-picker/types.d.ts.map +1 -1
- package/build-types/form-file-upload/types.d.ts +6 -0
- package/build-types/form-file-upload/types.d.ts.map +1 -1
- package/build-types/index.d.ts +1 -1
- package/build-types/index.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 +2 -2
- package/build-types/navigator/navigator-back-button/hook.d.ts.map +1 -1
- package/build-types/navigator/navigator-provider/component.d.ts.map +1 -1
- package/build-types/navigator/navigator-to-parent-button/component.d.ts +6 -0
- package/build-types/navigator/navigator-to-parent-button/component.d.ts.map +1 -1
- package/build-types/navigator/types.d.ts +45 -9
- package/build-types/navigator/types.d.ts.map +1 -1
- package/build-types/popover/index.d.ts +1 -1
- package/build-types/popover/index.d.ts.map +1 -1
- package/build-types/popover/stories/e2e/index.story.d.ts +1 -1
- package/build-types/private-apis.d.ts.map +1 -1
- package/build-types/query-controls/index.d.ts +1 -1
- package/build-types/query-controls/index.d.ts.map +1 -1
- package/build-types/query-controls/types.d.ts +2 -1
- package/build-types/query-controls/types.d.ts.map +1 -1
- package/build-types/radio-control/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/stories/index.story.d.ts.map +1 -1
- package/build-types/search-control/index.d.ts.map +1 -1
- package/build-types/search-control/stories/index.story.d.ts.map +1 -1
- package/build-types/select-control/index.d.ts.map +1 -1
- package/build-types/select-control/stories/index.story.d.ts +4 -2
- package/build-types/select-control/stories/index.story.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/tablist.d.ts.map +1 -1
- package/build-types/tabs/tabpanel.d.ts +0 -3
- package/build-types/tabs/tabpanel.d.ts.map +1 -1
- package/build-types/text-control/index.d.ts.map +1 -1
- package/build-types/text-control/stories/index.story.d.ts.map +1 -1
- package/build-types/textarea-control/index.d.ts.map +1 -1
- package/build-types/textarea-control/styles/textarea-control-styles.d.ts.map +1 -1
- package/build-types/toggle-control/index.d.ts.map +1 -1
- package/build-types/toggle-control/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/tooltip/index.d.ts.map +1 -1
- package/build-types/tree-select/index.d.ts.map +1 -1
- package/build-types/utils/config-values.d.ts +4 -3
- package/package.json +20 -20
- package/src/alignment-matrix-control/cell.tsx +3 -3
- package/src/alignment-matrix-control/index.tsx +5 -4
- package/src/alignment-matrix-control/styles/alignment-matrix-control-styles.ts +2 -2
- package/src/angle-picker-control/styles/angle-picker-control-styles.tsx +2 -2
- package/src/base-control/README.md +5 -2
- package/src/base-control/index.tsx +61 -41
- package/src/base-control/types.ts +7 -0
- package/src/border-box-control/border-box-control/README.md +7 -0
- package/src/border-control/border-control/README.md +7 -0
- package/src/border-control/styles.ts +1 -1
- package/src/button/README.md +7 -0
- package/src/button/style.scss +2 -2
- package/src/button-group/style.scss +2 -2
- package/src/checkbox-control/index.tsx +1 -0
- package/src/checkbox-control/stories/index.story.tsx +1 -0
- package/src/checkbox-control/test/index.tsx +8 -1
- package/src/circular-option-picker/circular-option-picker-option.tsx +8 -6
- package/src/circular-option-picker/circular-option-picker.tsx +1 -1
- package/src/circular-option-picker/style.scss +3 -3
- package/src/circular-option-picker/types.ts +2 -3
- package/src/color-indicator/style.scss +1 -1
- package/src/color-palette/style.scss +2 -2
- package/src/color-palette/utils.ts +23 -10
- package/src/color-picker/input-with-slider.tsx +1 -0
- package/src/combobox-control/README.md +8 -0
- package/src/combobox-control/index.tsx +1 -0
- package/src/combobox-control/stories/index.story.tsx +3 -4
- package/src/combobox-control/test/index.tsx +5 -1
- package/src/composite/README.md +325 -0
- package/src/composite/context.ts +14 -0
- package/src/composite/index.tsx +341 -0
- package/src/composite/legacy/index.tsx +15 -14
- package/src/composite/legacy/stories/utils.tsx +19 -0
- package/src/composite/stories/index.story.tsx +466 -0
- package/src/composite/{current/stories → stories}/utils.tsx +22 -7
- package/src/composite/types.ts +298 -0
- package/src/custom-gradient-picker/style.scss +2 -2
- package/src/custom-select-control/README.md +7 -0
- package/src/custom-select-control/test/index.tsx +125 -0
- package/src/custom-select-control/types.ts +3 -3
- package/src/custom-select-control-v2/custom-select.tsx +2 -1
- package/src/date-time/time/index.tsx +26 -12
- package/src/date-time/types.ts +11 -1
- package/src/dimension-control/README.md +17 -0
- package/src/dimension-control/index.tsx +26 -9
- package/src/dimension-control/stories/index.story.tsx +1 -0
- package/src/dimension-control/test/__snapshots__/index.test.js.snap +0 -16
- package/src/dimension-control/test/index.test.js +5 -1
- package/src/dimension-control/types.ts +5 -7
- package/src/drop-zone/style.scss +1 -1
- package/src/dropdown-menu-v2/index.tsx +5 -3
- package/src/dropdown-menu-v2/styles.ts +17 -15
- package/src/focal-point-picker/README.md +9 -1
- package/src/focal-point-picker/controls.tsx +1 -3
- package/src/focal-point-picker/index.tsx +1 -2
- package/src/focal-point-picker/stories/index.story.tsx +3 -0
- package/src/focal-point-picker/styles/focal-point-picker-style.ts +1 -1
- package/src/focal-point-picker/test/index.tsx +5 -1
- package/src/focal-point-picker/types.ts +2 -2
- package/src/font-size-picker/README.md +7 -0
- package/src/form-file-upload/README.md +8 -0
- package/src/form-file-upload/types.ts +6 -0
- package/src/form-token-field/README.md +1 -0
- package/src/guide/style.scss +0 -1
- package/src/index.ts +1 -1
- package/src/input-control/README.md +8 -0
- package/src/item-group/styles.ts +1 -1
- package/src/mobile/utils/alignments.native.js +1 -0
- package/src/modal/style.scss +3 -3
- package/src/navigator/navigator-back-button/component.tsx +1 -1
- package/src/navigator/navigator-back-button/hook.ts +6 -10
- package/src/navigator/navigator-provider/README.md +38 -36
- package/src/navigator/navigator-provider/component.tsx +13 -7
- package/src/navigator/navigator-screen/README.md +13 -1
- package/src/navigator/navigator-to-parent-button/README.md +2 -0
- package/src/navigator/navigator-to-parent-button/component.tsx +14 -43
- package/src/navigator/test/index.tsx +136 -6
- package/src/navigator/types.ts +45 -10
- package/src/number-control/README.md +8 -0
- package/src/palette-edit/styles.ts +5 -5
- package/src/placeholder/style.scss +4 -1
- package/src/popover/index.tsx +9 -3
- package/src/popover/style.scss +2 -2
- package/src/popover/test/index.tsx +34 -0
- package/src/private-apis.ts +6 -12
- package/src/progress-bar/styles.ts +2 -2
- package/src/query-controls/README.md +7 -0
- package/src/query-controls/index.tsx +5 -6
- package/src/query-controls/types.ts +2 -1
- package/src/radio-control/index.tsx +28 -20
- package/src/radio-control/style.scss +13 -2
- package/src/radio-control/test/index.tsx +43 -40
- package/src/radio-group/radio.tsx +2 -1
- package/src/range-control/README.md +7 -0
- package/src/range-control/index.tsx +39 -9
- package/src/range-control/stories/index.story.tsx +7 -0
- package/src/range-control/styles/range-control-styles.ts +2 -2
- package/src/range-control/test/index.tsx +54 -14
- package/src/search-control/index.tsx +7 -4
- package/src/search-control/stories/index.story.tsx +1 -0
- package/src/search-control/test/index.tsx +1 -0
- package/src/select-control/README.md +8 -0
- package/src/select-control/index.tsx +1 -0
- package/src/select-control/stories/index.story.tsx +8 -5
- package/src/select-control/test/select-control.tsx +12 -6
- package/src/snackbar/style.scss +2 -2
- package/src/tab-panel/index.tsx +4 -1
- package/src/tab-panel/style.scss +1 -1
- package/src/tabs/index.tsx +2 -1
- package/src/tabs/tablist.tsx +6 -4
- package/src/tabs/tabpanel.tsx +6 -2
- package/src/text/styles.ts +1 -1
- package/src/text-control/README.md +8 -0
- package/src/text-control/index.tsx +1 -0
- package/src/text-control/stories/index.story.tsx +3 -1
- package/src/text-control/test/text-control.tsx +5 -1
- package/src/textarea-control/index.tsx +1 -0
- package/src/textarea-control/stories/index.story.tsx +2 -0
- package/src/textarea-control/styles/textarea-control-styles.ts +75 -2
- package/src/toggle-control/index.tsx +9 -0
- package/src/toggle-control/stories/index.story.tsx +1 -0
- package/src/toggle-control/test/index.tsx +7 -1
- package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +8 -24
- package/src/toggle-group-control/test/index.tsx +5 -1
- package/src/toggle-group-control/toggle-group-control/README.md +7 -0
- package/src/toggle-group-control/toggle-group-control/as-radio-group.tsx +2 -1
- package/src/toggle-group-control/toggle-group-control/component.tsx +1 -0
- package/src/toggle-group-control/toggle-group-control/styles.ts +1 -1
- package/src/toggle-group-control/toggle-group-control-option-base/styles.ts +2 -2
- package/src/toolbar/toolbar/style.scss +2 -2
- package/src/tools-panel/styles.ts +1 -1
- package/src/tooltip/index.tsx +2 -1
- package/src/tooltip/style.scss +1 -1
- package/src/tree-select/index.tsx +16 -5
- package/src/tree-select/stories/index.story.tsx +1 -0
- package/src/unit-control/README.md +7 -0
- package/src/unit-control/styles/unit-control-styles.ts +1 -1
- package/src/utils/config-values.js +4 -3
- package/tsconfig.tsbuildinfo +1 -1
- package/build/composite/current/index.js +0 -43
- package/build/composite/current/index.js.map +0 -1
- package/build/composite/v2.js +0 -17
- package/build/composite/v2.js.map +0 -1
- package/build/utils/input/base.js +0 -20
- package/build/utils/input/base.js.map +0 -1
- package/build/utils/input/index.js +0 -17
- package/build/utils/input/index.js.map +0 -1
- package/build/utils/input/input-control.js +0 -21
- package/build/utils/input/input-control.js.map +0 -1
- package/build-module/composite/current/index.js +0 -12
- package/build-module/composite/current/index.js.map +0 -1
- package/build-module/composite/v2.js +0 -5
- package/build-module/composite/v2.js.map +0 -1
- package/build-module/utils/input/base.js +0 -13
- package/build-module/utils/input/base.js.map +0 -1
- package/build-module/utils/input/index.js +0 -2
- package/build-module/utils/input/index.js.map +0 -1
- package/build-module/utils/input/input-control.js +0 -14
- package/build-module/utils/input/input-control.js.map +0 -1
- package/build-types/composite/current/index.d.ts +0 -12
- package/build-types/composite/current/index.d.ts.map +0 -1
- package/build-types/composite/current/stories/index.story.d.ts +0 -13
- package/build-types/composite/current/stories/index.story.d.ts.map +0 -1
- package/build-types/composite/current/stories/utils.d.ts +0 -14
- package/build-types/composite/current/stories/utils.d.ts.map +0 -1
- package/build-types/composite/v2.d.ts +0 -2
- package/build-types/composite/v2.d.ts.map +0 -1
- package/build-types/utils/input/base.d.ts +0 -3
- package/build-types/utils/input/base.d.ts.map +0 -1
- package/build-types/utils/input/index.d.ts +0 -2
- package/build-types/utils/input/index.d.ts.map +0 -1
- package/build-types/utils/input/input-control.d.ts +0 -2
- package/build-types/utils/input/input-control.d.ts.map +0 -1
- package/src/composite/current/index.ts +0 -20
- package/src/composite/current/stories/index.story.tsx +0 -86
- package/src/composite/index.ts +0 -7
- package/src/composite/v2.ts +0 -4
- package/src/utils/input/base.js +0 -30
- package/src/utils/input/index.js +0 -1
- package/src/utils/input/input-control.js +0 -63
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type * as Ariakit from '@ariakit/react';
|
|
5
|
+
|
|
6
|
+
export type CompositeContextProps =
|
|
7
|
+
| {
|
|
8
|
+
/**
|
|
9
|
+
* Object returned by the `useCompositeStore` hook.
|
|
10
|
+
*/
|
|
11
|
+
store: Ariakit.CompositeStore;
|
|
12
|
+
}
|
|
13
|
+
| undefined;
|
|
14
|
+
|
|
15
|
+
export type CompositeStoreProps = {
|
|
16
|
+
/**
|
|
17
|
+
* The current active item `id`. The active item is the element within the
|
|
18
|
+
* composite widget that has either DOM or virtual focus (in case
|
|
19
|
+
* the `virtualFocus` prop is enabled).
|
|
20
|
+
* - `null` represents the base composite element (the one with a [composite
|
|
21
|
+
* role](https://w3c.github.io/aria/#composite)). Users will be able to
|
|
22
|
+
* navigate out of it using arrow keys.
|
|
23
|
+
* - If `activeId` is initially set to `null`, the base composite element
|
|
24
|
+
* itself will have focus and users will be able to navigate to it using
|
|
25
|
+
* arrow keys.
|
|
26
|
+
*/
|
|
27
|
+
activeId?: Ariakit.CompositeStoreProps[ 'activeId' ];
|
|
28
|
+
/**
|
|
29
|
+
* The composite item id that should be active by default when the composite
|
|
30
|
+
* widget is rendered. If `null`, the composite element itself will have focus
|
|
31
|
+
* and users will be able to navigate to it using arrow keys. If `undefined`,
|
|
32
|
+
* the first enabled item will be focused.
|
|
33
|
+
*/
|
|
34
|
+
defaultActiveId?: Ariakit.CompositeStoreProps[ 'defaultActiveId' ];
|
|
35
|
+
/**
|
|
36
|
+
* A callback that gets called when the `activeId` state changes.
|
|
37
|
+
*/
|
|
38
|
+
setActiveId?: Ariakit.CompositeStoreProps[ 'setActiveId' ];
|
|
39
|
+
/**
|
|
40
|
+
* Determines how the focus behaves when the user reaches the end of the
|
|
41
|
+
* composite widget.
|
|
42
|
+
*
|
|
43
|
+
* On one-dimensional composite widgets:
|
|
44
|
+
* - `true` loops from the last item to the first item and vice-versa.
|
|
45
|
+
* - `horizontal` loops only if `orientation` is `horizontal` or not set.
|
|
46
|
+
* - `vertical` loops only if `orientation` is `vertical` or not set.
|
|
47
|
+
* - If `activeId` is initially set to `null`, the composite element will
|
|
48
|
+
* be focused in between the last and first items.
|
|
49
|
+
*
|
|
50
|
+
* On two-dimensional composite widgets (ie. when using `CompositeRow`):
|
|
51
|
+
* - `true` loops from the last row/column item to the first item in the same
|
|
52
|
+
* row/column and vice-versa. If it's the last item in the last row, it
|
|
53
|
+
* moves to the first item in the first row and vice-versa.
|
|
54
|
+
* - `horizontal` loops only from the last row item to the first item in the
|
|
55
|
+
* same row.
|
|
56
|
+
* - `vertical` loops only from the last column item to the first item in the
|
|
57
|
+
* column row.
|
|
58
|
+
* - If `activeId` is initially set to `null`, vertical loop will have no
|
|
59
|
+
* effect as moving down from the last row or up from the first row will
|
|
60
|
+
* focus on the composite element.
|
|
61
|
+
* - If `focusWrap` matches the value of `focusLoop`, it'll wrap between the
|
|
62
|
+
* last item in the last row or column and the first item in the first row or
|
|
63
|
+
* column and vice-versa.
|
|
64
|
+
*
|
|
65
|
+
* @default false
|
|
66
|
+
*/
|
|
67
|
+
focusLoop?: Ariakit.CompositeStoreProps[ 'focusLoop' ];
|
|
68
|
+
/**
|
|
69
|
+
* **Works only on two-dimensional composite widgets**.
|
|
70
|
+
*
|
|
71
|
+
* If enabled, moving to the next item from the last one in a row or column
|
|
72
|
+
* will focus on the first item in the next row or column and vice-versa.
|
|
73
|
+
* - `true` wraps between rows and columns.
|
|
74
|
+
* - `horizontal` wraps only between rows.
|
|
75
|
+
* - `vertical` wraps only between columns.
|
|
76
|
+
* - If `focusLoop` matches the value of `focusWrap`, it'll wrap between the
|
|
77
|
+
* last item in the last row or column and the first item in the first row or
|
|
78
|
+
* column and vice-versa.
|
|
79
|
+
*
|
|
80
|
+
* @default false
|
|
81
|
+
*/
|
|
82
|
+
focusWrap?: Ariakit.CompositeStoreProps[ 'focusWrap' ];
|
|
83
|
+
/**
|
|
84
|
+
* **Works only on two-dimensional composite widgets**.
|
|
85
|
+
*
|
|
86
|
+
* If enabled, moving up or down when there's no next item or when the next
|
|
87
|
+
* item is disabled will shift to the item right before it.
|
|
88
|
+
*
|
|
89
|
+
* @default false
|
|
90
|
+
*/
|
|
91
|
+
focusShift?: Ariakit.CompositeStoreProps[ 'focusShift' ];
|
|
92
|
+
/**
|
|
93
|
+
* If enabled, the composite element will act as an
|
|
94
|
+
* [`aria-activedescendant`](https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/#kbd_focus_activedescendant)
|
|
95
|
+
* container instead of [roving
|
|
96
|
+
* tabindex](https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/#kbd_roving_tabindex).
|
|
97
|
+
* DOM focus will remain on the composite element while its items receive
|
|
98
|
+
* virtual focus.
|
|
99
|
+
*
|
|
100
|
+
* In both scenarios, the item in focus will carry the `data-active-item`
|
|
101
|
+
* attribute.
|
|
102
|
+
*
|
|
103
|
+
* @default false
|
|
104
|
+
*/
|
|
105
|
+
virtualFocus?: Ariakit.CompositeStoreProps[ 'virtualFocus' ];
|
|
106
|
+
/**
|
|
107
|
+
* Defines the orientation of the composite widget. If the composite has a
|
|
108
|
+
* single row or column (one-dimensional), the `orientation` value determines
|
|
109
|
+
* which arrow keys can be used to move focus:
|
|
110
|
+
* - `both`: all arrow keys work.
|
|
111
|
+
* - `horizontal`: only left and right arrow keys work.
|
|
112
|
+
* - `vertical`: only up and down arrow keys work.
|
|
113
|
+
*
|
|
114
|
+
* It doesn't have any effect on two-dimensional composites.
|
|
115
|
+
*
|
|
116
|
+
* @default "both"
|
|
117
|
+
*/
|
|
118
|
+
orientation?: Ariakit.CompositeStoreProps[ 'orientation' ];
|
|
119
|
+
/**
|
|
120
|
+
* Determines how the `store`'s `next` and `previous` functions will behave.
|
|
121
|
+
* If `rtl` is set to `true`, they will be inverted.
|
|
122
|
+
*
|
|
123
|
+
* This only affects the composite widget behavior. You still need to set
|
|
124
|
+
* `dir="rtl"` on HTML/CSS.
|
|
125
|
+
*
|
|
126
|
+
* @default false
|
|
127
|
+
*/
|
|
128
|
+
rtl?: Ariakit.CompositeStoreProps[ 'rtl' ];
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export type CompositeProps = {
|
|
132
|
+
/**
|
|
133
|
+
* Object returned by the `useCompositeStore` hook.
|
|
134
|
+
*/
|
|
135
|
+
store: Ariakit.CompositeStore;
|
|
136
|
+
/**
|
|
137
|
+
* Allows the component to be rendered as a different HTML element or React
|
|
138
|
+
* component. The value can be a React element or a function that takes in the
|
|
139
|
+
* original component props and gives back a React element with the props
|
|
140
|
+
* merged.
|
|
141
|
+
*/
|
|
142
|
+
render?: Ariakit.CompositeProps[ 'render' ];
|
|
143
|
+
/**
|
|
144
|
+
* Makes the component a focusable element. When this element gains keyboard
|
|
145
|
+
* focus, it gets a `data-focus-visible` attribute and triggers the
|
|
146
|
+
* `onFocusVisible` prop.
|
|
147
|
+
* The component supports the `disabled` prop even for those elements not
|
|
148
|
+
* supporting the native `disabled` attribute. Disabled elements may be
|
|
149
|
+
* still accessible via keyboard by using the the `accessibleWhenDisabled`
|
|
150
|
+
* prop.
|
|
151
|
+
* Non-native focusable elements will lose their focusability entirely.
|
|
152
|
+
* However, native focusable elements will retain their inherent focusability.
|
|
153
|
+
*/
|
|
154
|
+
focusable?: Ariakit.CompositeProps[ 'focusable' ];
|
|
155
|
+
/**
|
|
156
|
+
* Determines if the element is disabled. This sets the `aria-disabled`
|
|
157
|
+
* attribute accordingly, enabling support for all elements, including those
|
|
158
|
+
* that don't support the native `disabled` attribute.
|
|
159
|
+
*
|
|
160
|
+
* This feature can be combined with the `accessibleWhenDisabled` prop to
|
|
161
|
+
* make disabled elements still accessible via keyboard.
|
|
162
|
+
*
|
|
163
|
+
* **Note**: For this prop to work, the `focusable` prop must be set to
|
|
164
|
+
* `true`, if it's not set by default.
|
|
165
|
+
*
|
|
166
|
+
* @default false
|
|
167
|
+
*/
|
|
168
|
+
disabled?: Ariakit.CompositeProps[ 'disabled' ];
|
|
169
|
+
/**
|
|
170
|
+
* Indicates whether the element should be focusable even when it is
|
|
171
|
+
* `disabled`.
|
|
172
|
+
*
|
|
173
|
+
* This is important when discoverability is a concern. For example:
|
|
174
|
+
*
|
|
175
|
+
* > A toolbar in an editor contains a set of special smart paste functions
|
|
176
|
+
* that are disabled when the clipboard is empty or when the function is not
|
|
177
|
+
* applicable to the current content of the clipboard. It could be helpful to
|
|
178
|
+
* keep the disabled buttons focusable if the ability to discover their
|
|
179
|
+
* functionality is primarily via their presence on the toolbar.
|
|
180
|
+
*
|
|
181
|
+
* Learn more on [Focusability of disabled
|
|
182
|
+
* controls](https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/#focusabilityofdisabledcontrols).
|
|
183
|
+
*/
|
|
184
|
+
accessibleWhenDisabled?: Ariakit.CompositeProps[ 'accessibleWhenDisabled' ];
|
|
185
|
+
/**
|
|
186
|
+
* Custom event handler invoked when the element gains focus through keyboard
|
|
187
|
+
* interaction or a key press occurs while the element is in focus. This is
|
|
188
|
+
* the programmatic equivalent of the `data-focus-visible` attribute.
|
|
189
|
+
*
|
|
190
|
+
* **Note**: For this prop to work, the `focusable` prop must be set to `true`
|
|
191
|
+
* if it's not set by default.
|
|
192
|
+
*/
|
|
193
|
+
onFocusVisible?: Ariakit.CompositeProps[ 'onFocusVisible' ];
|
|
194
|
+
/**
|
|
195
|
+
* The contents of the component.
|
|
196
|
+
*/
|
|
197
|
+
children?: Ariakit.CompositeProps[ 'children' ];
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
export type CompositeGroupProps = {
|
|
201
|
+
/**
|
|
202
|
+
* Allows the component to be rendered as a different HTML element or React
|
|
203
|
+
* component. The value can be a React element or a function that takes in the
|
|
204
|
+
* original component props and gives back a React element with the props
|
|
205
|
+
* merged.
|
|
206
|
+
*/
|
|
207
|
+
render?: Ariakit.CompositeGroupProps[ 'render' ];
|
|
208
|
+
/**
|
|
209
|
+
* The contents of the component.
|
|
210
|
+
*/
|
|
211
|
+
children?: Ariakit.CompositeGroupProps[ 'children' ];
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
export type CompositeGroupLabelProps = {
|
|
215
|
+
/**
|
|
216
|
+
* Allows the component to be rendered as a different HTML element or React
|
|
217
|
+
* component. The value can be a React element or a function that takes in the
|
|
218
|
+
* original component props and gives back a React element with the props
|
|
219
|
+
* merged.
|
|
220
|
+
*/
|
|
221
|
+
render?: Ariakit.CompositeGroupLabelProps[ 'render' ];
|
|
222
|
+
/**
|
|
223
|
+
* The contents of the component.
|
|
224
|
+
*/
|
|
225
|
+
children?: Ariakit.CompositeGroupLabelProps[ 'children' ];
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
export type CompositeItemProps = {
|
|
229
|
+
/**
|
|
230
|
+
* Allows the component to be rendered as a different HTML element or React
|
|
231
|
+
* component. The value can be a React element or a function that takes in the
|
|
232
|
+
* original component props and gives back a React element with the props
|
|
233
|
+
* merged.
|
|
234
|
+
*/
|
|
235
|
+
render?: Ariakit.CompositeItemProps[ 'render' ];
|
|
236
|
+
/**
|
|
237
|
+
* The contents of the component.
|
|
238
|
+
*/
|
|
239
|
+
children?: Ariakit.CompositeItemProps[ 'children' ];
|
|
240
|
+
/**
|
|
241
|
+
* Indicates whether the element should be focusable even when it is
|
|
242
|
+
* `disabled`.
|
|
243
|
+
*
|
|
244
|
+
* This is important when discoverability is a concern. For example:
|
|
245
|
+
*
|
|
246
|
+
* > A toolbar in an editor contains a set of special smart paste functions
|
|
247
|
+
* that are disabled when the clipboard is empty or when the function is not
|
|
248
|
+
* applicable to the current content of the clipboard. It could be helpful to
|
|
249
|
+
* keep the disabled buttons focusable if the ability to discover their
|
|
250
|
+
* functionality is primarily via their presence on the toolbar.
|
|
251
|
+
*
|
|
252
|
+
* Learn more on [Focusability of disabled
|
|
253
|
+
* controls](https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/#focusabilityofdisabledcontrols).
|
|
254
|
+
*/
|
|
255
|
+
accessibleWhenDisabled?: Ariakit.CompositeItemProps[ 'accessibleWhenDisabled' ];
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
export type CompositeRowProps = {
|
|
259
|
+
/**
|
|
260
|
+
* Allows the component to be rendered as a different HTML element or React
|
|
261
|
+
* component. The value can be a React element or a function that takes in the
|
|
262
|
+
* original component props and gives back a React element with the props
|
|
263
|
+
* merged.
|
|
264
|
+
*/
|
|
265
|
+
render?: Ariakit.CompositeRowProps[ 'render' ];
|
|
266
|
+
/**
|
|
267
|
+
* The contents of the component.
|
|
268
|
+
*/
|
|
269
|
+
children?: Ariakit.CompositeRowProps[ 'children' ];
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
export type CompositeHoverProps = {
|
|
273
|
+
/**
|
|
274
|
+
* Allows the component to be rendered as a different HTML element or React
|
|
275
|
+
* component. The value can be a React element or a function that takes in the
|
|
276
|
+
* original component props and gives back a React element with the props
|
|
277
|
+
* merged.
|
|
278
|
+
*/
|
|
279
|
+
render?: Ariakit.CompositeHoverProps[ 'render' ];
|
|
280
|
+
/**
|
|
281
|
+
* The contents of the component.
|
|
282
|
+
*/
|
|
283
|
+
children?: Ariakit.CompositeHoverProps[ 'children' ];
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
export type CompositeTypeaheadProps = {
|
|
287
|
+
/**
|
|
288
|
+
* Allows the component to be rendered as a different HTML element or React
|
|
289
|
+
* component. The value can be a React element or a function that takes in the
|
|
290
|
+
* original component props and gives back a React element with the props
|
|
291
|
+
* merged.
|
|
292
|
+
*/
|
|
293
|
+
render?: Ariakit.CompositeTypeaheadProps[ 'render' ];
|
|
294
|
+
/**
|
|
295
|
+
* The contents of the component.
|
|
296
|
+
*/
|
|
297
|
+
children?: Ariakit.CompositeTypeaheadProps[ 'children' ];
|
|
298
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
$components-custom-gradient-picker__padding: $grid-unit-20; // 48px container, 16px handles inside, that leaves 32px padding, half of which is 1å6.
|
|
2
2
|
|
|
3
3
|
.components-custom-gradient-picker__gradient-bar {
|
|
4
|
-
border-radius: $radius-
|
|
4
|
+
border-radius: $radius-small;
|
|
5
5
|
width: 100%;
|
|
6
6
|
height: $grid-unit-60;
|
|
7
7
|
position: relative;
|
|
@@ -112,7 +112,7 @@ $components-custom-gradient-picker__padding: $grid-unit-20; // 48px container, 1
|
|
|
112
112
|
&.is-pressed {
|
|
113
113
|
> svg {
|
|
114
114
|
background: $white;
|
|
115
|
-
border:
|
|
115
|
+
border: $border-width solid $gray-600;
|
|
116
116
|
border-radius: 2px;
|
|
117
117
|
}
|
|
118
118
|
}
|
|
@@ -142,6 +142,13 @@ A handler for `blur` events on the trigger button.
|
|
|
142
142
|
|
|
143
143
|
- Required: No
|
|
144
144
|
|
|
145
|
+
#### `__next40pxDefaultSize`: `boolean`
|
|
146
|
+
|
|
147
|
+
Start opting into the larger default height that will become the default size in a future version.
|
|
148
|
+
|
|
149
|
+
- Required: No
|
|
150
|
+
- Default: `false`
|
|
151
|
+
|
|
145
152
|
## Related components
|
|
146
153
|
|
|
147
154
|
- Like this component, but implemented using a native `<select>` for when custom styling is not necessary, the `SelectControl` component.
|
|
@@ -689,3 +689,128 @@ describe.each( [
|
|
|
689
689
|
} );
|
|
690
690
|
} );
|
|
691
691
|
} );
|
|
692
|
+
|
|
693
|
+
describe( 'Type checking', () => {
|
|
694
|
+
// eslint-disable-next-line jest/expect-expect
|
|
695
|
+
it( 'should infer the value type from available `options`, but not the `value` or `onChange` prop', () => {
|
|
696
|
+
const options = [
|
|
697
|
+
{
|
|
698
|
+
key: 'narrow',
|
|
699
|
+
name: 'Narrow',
|
|
700
|
+
},
|
|
701
|
+
{
|
|
702
|
+
key: 'value',
|
|
703
|
+
name: 'Value',
|
|
704
|
+
},
|
|
705
|
+
];
|
|
706
|
+
const optionsReadOnly = [
|
|
707
|
+
{
|
|
708
|
+
key: 'narrow',
|
|
709
|
+
name: 'Narrow',
|
|
710
|
+
},
|
|
711
|
+
{
|
|
712
|
+
key: 'value',
|
|
713
|
+
name: 'Value',
|
|
714
|
+
},
|
|
715
|
+
] as const;
|
|
716
|
+
|
|
717
|
+
const onChange = (): void => {};
|
|
718
|
+
|
|
719
|
+
<UncontrolledCustomSelectControl
|
|
720
|
+
label="Label"
|
|
721
|
+
options={ options }
|
|
722
|
+
value={ {
|
|
723
|
+
key: 'narrow',
|
|
724
|
+
name: 'Narrow',
|
|
725
|
+
} }
|
|
726
|
+
onChange={ onChange }
|
|
727
|
+
/>;
|
|
728
|
+
|
|
729
|
+
<UncontrolledCustomSelectControl
|
|
730
|
+
label="Label"
|
|
731
|
+
options={ options }
|
|
732
|
+
value={ {
|
|
733
|
+
key: 'random string is also accepted for non-readonly options',
|
|
734
|
+
name: 'Narrow',
|
|
735
|
+
} }
|
|
736
|
+
onChange={ onChange }
|
|
737
|
+
/>;
|
|
738
|
+
|
|
739
|
+
<UncontrolledCustomSelectControl
|
|
740
|
+
label="Label"
|
|
741
|
+
options={ options }
|
|
742
|
+
value={ {
|
|
743
|
+
key: 'narrow',
|
|
744
|
+
name: 'Narrow',
|
|
745
|
+
// @ts-expect-error: the option type should not be inferred from `value`
|
|
746
|
+
foo: 'foo',
|
|
747
|
+
} }
|
|
748
|
+
onChange={ onChange }
|
|
749
|
+
/>;
|
|
750
|
+
|
|
751
|
+
<UncontrolledCustomSelectControl
|
|
752
|
+
label="Label"
|
|
753
|
+
options={ options }
|
|
754
|
+
value={ {
|
|
755
|
+
key: 'narrow',
|
|
756
|
+
name: 'Narrow',
|
|
757
|
+
} }
|
|
758
|
+
// To ensure the type inferring is working correctly, but this is not a common use case.
|
|
759
|
+
// @ts-expect-error: the option type should not be inferred from `onChange`
|
|
760
|
+
onChange={
|
|
761
|
+
onChange as ( obj: {
|
|
762
|
+
selectedItem: { key: string; name: string; foo: string };
|
|
763
|
+
} ) => void
|
|
764
|
+
}
|
|
765
|
+
/>;
|
|
766
|
+
|
|
767
|
+
<UncontrolledCustomSelectControl
|
|
768
|
+
label="Label"
|
|
769
|
+
options={ optionsReadOnly }
|
|
770
|
+
value={ {
|
|
771
|
+
key: 'narrow',
|
|
772
|
+
name: 'Narrow',
|
|
773
|
+
} }
|
|
774
|
+
onChange={ onChange }
|
|
775
|
+
/>;
|
|
776
|
+
|
|
777
|
+
<UncontrolledCustomSelectControl
|
|
778
|
+
label="Label"
|
|
779
|
+
options={ optionsReadOnly }
|
|
780
|
+
value={ {
|
|
781
|
+
// @ts-expect-error: random string is not accepted for immutable options
|
|
782
|
+
key: 'random string is not accepted for readonly options',
|
|
783
|
+
name: 'Narrow',
|
|
784
|
+
} }
|
|
785
|
+
onChange={ onChange }
|
|
786
|
+
/>;
|
|
787
|
+
|
|
788
|
+
<UncontrolledCustomSelectControl
|
|
789
|
+
label="Label"
|
|
790
|
+
options={ optionsReadOnly }
|
|
791
|
+
value={ {
|
|
792
|
+
key: 'narrow',
|
|
793
|
+
name: 'Narrow',
|
|
794
|
+
// @ts-expect-error: the option type should not be inferred from `value`
|
|
795
|
+
foo: 'foo',
|
|
796
|
+
} }
|
|
797
|
+
onChange={ onChange }
|
|
798
|
+
/>;
|
|
799
|
+
|
|
800
|
+
<UncontrolledCustomSelectControl
|
|
801
|
+
label="Label"
|
|
802
|
+
options={ optionsReadOnly }
|
|
803
|
+
value={ {
|
|
804
|
+
key: 'narrow',
|
|
805
|
+
name: 'Narrow',
|
|
806
|
+
} }
|
|
807
|
+
// To ensure the type inferring is working correctly, but this is not a common use case.
|
|
808
|
+
// @ts-expect-error: the option type should not be inferred from `onChange`
|
|
809
|
+
onChange={
|
|
810
|
+
onChange as ( obj: {
|
|
811
|
+
selectedItem: { key: string; name: string; foo: string };
|
|
812
|
+
} ) => void
|
|
813
|
+
}
|
|
814
|
+
/>;
|
|
815
|
+
} );
|
|
816
|
+
} );
|
|
@@ -55,7 +55,7 @@ export type CustomSelectProps< T extends CustomSelectOption > = {
|
|
|
55
55
|
* Function called with the control's internal state changes. The `selectedItem`
|
|
56
56
|
* property contains the next selected item.
|
|
57
57
|
*/
|
|
58
|
-
onChange?: ( newValue: CustomSelectChangeObject< T > ) => void;
|
|
58
|
+
onChange?: ( newValue: CustomSelectChangeObject< NoInfer< T > > ) => void;
|
|
59
59
|
/**
|
|
60
60
|
* A handler for `blur` events on the trigger button.
|
|
61
61
|
*
|
|
@@ -83,7 +83,7 @@ export type CustomSelectProps< T extends CustomSelectOption > = {
|
|
|
83
83
|
/**
|
|
84
84
|
* The list of options that can be chosen from.
|
|
85
85
|
*/
|
|
86
|
-
options:
|
|
86
|
+
options: ReadonlyArray< T >;
|
|
87
87
|
/**
|
|
88
88
|
* The size of the control.
|
|
89
89
|
*
|
|
@@ -93,7 +93,7 @@ export type CustomSelectProps< T extends CustomSelectOption > = {
|
|
|
93
93
|
/**
|
|
94
94
|
* Can be used to externally control the value of the control.
|
|
95
95
|
*/
|
|
96
|
-
value?: T
|
|
96
|
+
value?: NoInfer< T >;
|
|
97
97
|
/**
|
|
98
98
|
* Use the `showSelectedHint` property instead.
|
|
99
99
|
* @deprecated
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import * as Ariakit from '@ariakit/react';
|
|
5
|
+
import { useStoreState } from '@ariakit/react';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* WordPress dependencies
|
|
@@ -62,7 +63,7 @@ const CustomSelectButton = ( {
|
|
|
62
63
|
CustomSelectStore,
|
|
63
64
|
'onChange'
|
|
64
65
|
> ) => {
|
|
65
|
-
const { value: currentValue } = store
|
|
66
|
+
const { value: currentValue } = useStoreState( store );
|
|
66
67
|
|
|
67
68
|
const computedRenderSelectedValue = useMemo(
|
|
68
69
|
() => renderSelectedValue ?? defaultRenderSelectedValue,
|
|
@@ -13,6 +13,7 @@ import { __ } from '@wordpress/i18n';
|
|
|
13
13
|
* Internal dependencies
|
|
14
14
|
*/
|
|
15
15
|
import BaseControl from '../../base-control';
|
|
16
|
+
import { VisuallyHidden } from '../../visually-hidden';
|
|
16
17
|
import SelectControl from '../../select-control';
|
|
17
18
|
import TimeZone from './timezone';
|
|
18
19
|
import type { TimeInputValue, TimePickerProps } from '../types';
|
|
@@ -61,6 +62,7 @@ export function TimePicker( {
|
|
|
61
62
|
currentTime,
|
|
62
63
|
onChange,
|
|
63
64
|
dateOrder: dateOrderProp,
|
|
65
|
+
hideLabelFromVision = false,
|
|
64
66
|
}: TimePickerProps ) {
|
|
65
67
|
const [ date, setDate ] = useState( () =>
|
|
66
68
|
// Truncate the date at the minutes, see: #15495.
|
|
@@ -219,12 +221,18 @@ export function TimePicker( {
|
|
|
219
221
|
className="components-datetime__time" // Unused, for backwards compatibility.
|
|
220
222
|
>
|
|
221
223
|
<Fieldset>
|
|
222
|
-
|
|
223
|
-
as="legend"
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
224
|
+
{ hideLabelFromVision ? (
|
|
225
|
+
<VisuallyHidden as="legend">
|
|
226
|
+
{ __( 'Time' ) }
|
|
227
|
+
</VisuallyHidden>
|
|
228
|
+
) : (
|
|
229
|
+
<BaseControl.VisualLabel
|
|
230
|
+
as="legend"
|
|
231
|
+
className="components-datetime__time-legend" // Unused, for backwards compatibility.
|
|
232
|
+
>
|
|
233
|
+
{ __( 'Time' ) }
|
|
234
|
+
</BaseControl.VisualLabel>
|
|
235
|
+
) }
|
|
228
236
|
<HStack
|
|
229
237
|
className="components-datetime__time-wrapper" // Unused, for backwards compatibility.
|
|
230
238
|
>
|
|
@@ -241,12 +249,18 @@ export function TimePicker( {
|
|
|
241
249
|
</HStack>
|
|
242
250
|
</Fieldset>
|
|
243
251
|
<Fieldset>
|
|
244
|
-
|
|
245
|
-
as="legend"
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
252
|
+
{ hideLabelFromVision ? (
|
|
253
|
+
<VisuallyHidden as="legend">
|
|
254
|
+
{ __( 'Date' ) }
|
|
255
|
+
</VisuallyHidden>
|
|
256
|
+
) : (
|
|
257
|
+
<BaseControl.VisualLabel
|
|
258
|
+
as="legend"
|
|
259
|
+
className="components-datetime__time-legend" // Unused, for backwards compatibility.
|
|
260
|
+
>
|
|
261
|
+
{ __( 'Date' ) }
|
|
262
|
+
</BaseControl.VisualLabel>
|
|
263
|
+
) }
|
|
250
264
|
<HStack
|
|
251
265
|
className="components-datetime__time-wrapper" // Unused, for backwards compatibility.
|
|
252
266
|
>
|
package/src/date-time/types.ts
CHANGED
|
@@ -29,6 +29,13 @@ export type TimePickerProps = {
|
|
|
29
29
|
* time as an argument.
|
|
30
30
|
*/
|
|
31
31
|
onChange?: ( time: string ) => void;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* If true, the label will only be visible to screen readers.
|
|
35
|
+
*
|
|
36
|
+
* @default false
|
|
37
|
+
*/
|
|
38
|
+
hideLabelFromVision?: boolean;
|
|
32
39
|
};
|
|
33
40
|
|
|
34
41
|
export type TimeInputValue = {
|
|
@@ -130,7 +137,10 @@ export type DatePickerProps = {
|
|
|
130
137
|
};
|
|
131
138
|
|
|
132
139
|
export type DateTimePickerProps = Omit< DatePickerProps, 'onChange' > &
|
|
133
|
-
Omit<
|
|
140
|
+
Omit<
|
|
141
|
+
TimePickerProps,
|
|
142
|
+
'currentTime' | 'onChange' | 'hideLabelFromVision'
|
|
143
|
+
> & {
|
|
134
144
|
/**
|
|
135
145
|
* The function called when a new date or time has been selected. It is
|
|
136
146
|
* passed the date and time as an argument.
|
|
@@ -17,6 +17,7 @@ export default function MyCustomDimensionControl() {
|
|
|
17
17
|
|
|
18
18
|
return (
|
|
19
19
|
<DimensionControl
|
|
20
|
+
__nextHasNoMarginBottom
|
|
20
21
|
label={ 'Padding' }
|
|
21
22
|
icon={ 'desktop' }
|
|
22
23
|
onChange={ ( value ) => setPaddingSize( value ) }
|
|
@@ -91,3 +92,19 @@ A callback which is triggered when a spacing size value changes (is selected/cli
|
|
|
91
92
|
- **Required:** No
|
|
92
93
|
|
|
93
94
|
A string of classes to be added to the control component.
|
|
95
|
+
|
|
96
|
+
### `__next40pxDefaultSize`
|
|
97
|
+
|
|
98
|
+
- **Type:** `Boolean`
|
|
99
|
+
- **Required:** No
|
|
100
|
+
- **Default:** `false`
|
|
101
|
+
|
|
102
|
+
Start opting into the larger default height that will become the default size in a future version.
|
|
103
|
+
|
|
104
|
+
### `__nextHasNoMarginBottom`
|
|
105
|
+
|
|
106
|
+
- **Type:** `Boolean`
|
|
107
|
+
- **Required:** No
|
|
108
|
+
- **Default:** `false`
|
|
109
|
+
|
|
110
|
+
Start opting into the new margin-free styles that will become the default in a future version.
|
|
@@ -16,6 +16,15 @@ import SelectControl from '../select-control';
|
|
|
16
16
|
import sizesTable, { findSizeBySlug } from './sizes';
|
|
17
17
|
import type { DimensionControlProps, Size } from './types';
|
|
18
18
|
import type { SelectControlSingleSelectionProps } from '../select-control/types';
|
|
19
|
+
import { ContextSystemProvider } from '../context';
|
|
20
|
+
|
|
21
|
+
const CONTEXT_VALUE = {
|
|
22
|
+
BaseControl: {
|
|
23
|
+
// Temporary during deprecation grace period: Overrides the underlying `__associatedWPComponentName`
|
|
24
|
+
// via the context system to override the value set by SelectControl.
|
|
25
|
+
_overrides: { __associatedWPComponentName: 'DimensionControl' },
|
|
26
|
+
},
|
|
27
|
+
};
|
|
19
28
|
|
|
20
29
|
/**
|
|
21
30
|
* `DimensionControl` is a component designed to provide a UI to control spacing and/or dimensions.
|
|
@@ -31,6 +40,7 @@ import type { SelectControlSingleSelectionProps } from '../select-control/types'
|
|
|
31
40
|
*
|
|
32
41
|
* return (
|
|
33
42
|
* <DimensionControl
|
|
43
|
+
* __nextHasNoMarginBottom
|
|
34
44
|
* label={ 'Padding' }
|
|
35
45
|
* icon={ 'desktop' }
|
|
36
46
|
* onChange={ ( value ) => setPaddingSize( value ) }
|
|
@@ -43,6 +53,7 @@ import type { SelectControlSingleSelectionProps } from '../select-control/types'
|
|
|
43
53
|
export function DimensionControl( props: DimensionControlProps ) {
|
|
44
54
|
const {
|
|
45
55
|
__next40pxDefaultSize = false,
|
|
56
|
+
__nextHasNoMarginBottom = false,
|
|
46
57
|
label,
|
|
47
58
|
value,
|
|
48
59
|
sizes = sizesTable,
|
|
@@ -85,15 +96,21 @@ export function DimensionControl( props: DimensionControlProps ) {
|
|
|
85
96
|
);
|
|
86
97
|
|
|
87
98
|
return (
|
|
88
|
-
<
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
99
|
+
<ContextSystemProvider value={ CONTEXT_VALUE }>
|
|
100
|
+
<SelectControl
|
|
101
|
+
__next40pxDefaultSize={ __next40pxDefaultSize }
|
|
102
|
+
__nextHasNoMarginBottom={ __nextHasNoMarginBottom }
|
|
103
|
+
className={ clsx(
|
|
104
|
+
className,
|
|
105
|
+
'block-editor-dimension-control'
|
|
106
|
+
) }
|
|
107
|
+
label={ selectLabel }
|
|
108
|
+
hideLabelFromVision={ false }
|
|
109
|
+
value={ value }
|
|
110
|
+
onChange={ onChangeSpacingSize }
|
|
111
|
+
options={ formatSizesAsOptions( sizes ) }
|
|
112
|
+
/>
|
|
113
|
+
</ContextSystemProvider>
|
|
97
114
|
);
|
|
98
115
|
}
|
|
99
116
|
|