@wordpress/components 28.4.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 +113 -1
- 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/autocomplete/autocompleter-ui.js +2 -0
- package/build/autocomplete/autocompleter-ui.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/styles/base-control-styles.js +8 -8
- package/build/base-control/styles/base-control-styles.js.map +1 -1
- package/build/base-control/types.js.map +1 -1
- package/build/border-control/styles.js +18 -24
- 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/index.js +1 -1
- package/build/color-palette/index.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/index.js +37 -14
- package/build/custom-select-control/index.js.map +1 -1
- 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/custom-select-control-v2/styles.js +9 -9
- package/build/custom-select-control-v2/styles.js.map +1 -1
- package/build/date-time/index.js +0 -7
- package/build/date-time/index.js.map +1 -1
- package/build/date-time/time/index.js +77 -41
- package/build/date-time/time/index.js.map +1 -1
- package/build/date-time/time/styles.js +11 -11
- package/build/date-time/time/styles.js.map +1 -1
- package/build/date-time/{time-input → time/time-input}/index.js +7 -7
- package/build/date-time/time/time-input/index.js.map +1 -0
- 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/form-toggle/index.js +24 -24
- package/build/form-toggle/index.js.map +1 -1
- package/build/guide/index.js +2 -0
- package/build/guide/index.js.map +1 -1
- package/build/heading/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/modal/index.js +18 -11
- package/build/modal/index.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 +6 -7
- package/build/query-controls/index.js.map +1 -1
- package/build/query-controls/types.js.map +1 -1
- package/build/radio-control/index.js +43 -15
- package/build/radio-control/index.js.map +1 -1
- package/build/radio-control/types.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 +21 -8
- package/build/select-control/index.js.map +1 -1
- package/build/select-control/types.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 +2 -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 +35 -25
- 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 +7 -1
- 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/component.js +6 -1
- package/build/toggle-group-control/toggle-group-control-option/component.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/toggle-group-control/toggle-group-control-option-icon/component.js +14 -14
- package/build/toggle-group-control/toggle-group-control-option-icon/component.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 +14 -2
- package/build/tooltip/index.js.map +1 -1
- package/build/tree-select/index.js +20 -8
- 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 +10 -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/autocomplete/autocompleter-ui.js +2 -0
- package/build-module/autocomplete/autocompleter-ui.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/styles/base-control-styles.js +8 -8
- package/build-module/base-control/styles/base-control-styles.js.map +1 -1
- package/build-module/base-control/types.js.map +1 -1
- package/build-module/border-control/styles.js +13 -23
- 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/index.js +1 -1
- package/build-module/color-palette/index.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/index.js +38 -14
- package/build-module/custom-select-control/index.js.map +1 -1
- 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/custom-select-control-v2/styles.js +9 -9
- package/build-module/custom-select-control-v2/styles.js.map +1 -1
- package/build-module/date-time/index.js +1 -2
- package/build-module/date-time/index.js.map +1 -1
- package/build-module/date-time/time/index.js +77 -41
- package/build-module/date-time/time/index.js.map +1 -1
- package/build-module/date-time/time/styles.js +11 -11
- package/build-module/date-time/time/styles.js.map +1 -1
- package/build-module/date-time/{time-input → time/time-input}/index.js +7 -7
- package/build-module/date-time/time/time-input/index.js.map +1 -0
- 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/form-toggle/index.js +23 -22
- package/build-module/form-toggle/index.js.map +1 -1
- package/build-module/guide/index.js +2 -0
- package/build-module/guide/index.js.map +1 -1
- package/build-module/heading/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/modal/index.js +17 -11
- package/build-module/modal/index.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 +6 -7
- 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 +44 -17
- package/build-module/radio-control/index.js.map +1 -1
- package/build-module/radio-control/types.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 +21 -8
- package/build-module/select-control/index.js.map +1 -1
- package/build-module/select-control/types.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 +2 -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 +34 -24
- 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 +7 -1
- 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/component.js +6 -1
- package/build-module/toggle-group-control/toggle-group-control-option/component.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/toggle-group-control/toggle-group-control-option-icon/component.js +14 -14
- package/build-module/toggle-group-control/toggle-group-control-option-icon/component.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 +14 -2
- package/build-module/tooltip/index.js.map +1 -1
- package/build-module/tree-select/index.js +20 -8
- 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 +10 -3
- package/build-module/utils/config-values.js.map +1 -1
- package/build-style/style-rtl.css +79 -33
- package/build-style/style.css +79 -33
- 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/autocomplete/autocompleter-ui.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/border-control/styles.d.ts.map +1 -1
- package/build-types/button/stories/e2e/index.story.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/index.d.ts.map +1 -1
- package/build-types/color-palette/styles.d.ts +2 -2
- 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 +3 -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/index.d.ts +2 -2
- package/build-types/custom-select-control/index.d.ts.map +1 -1
- package/build-types/custom-select-control/stories/index.story.d.ts +3 -3
- package/build-types/custom-select-control/stories/index.story.d.ts.map +1 -1
- package/build-types/custom-select-control/types.d.ts +7 -7
- 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/custom-select-control-v2/styles.d.ts +16 -28
- package/build-types/custom-select-control-v2/styles.d.ts.map +1 -1
- package/build-types/date-time/date/styles.d.ts +2 -2
- package/build-types/date-time/date-time/index.d.ts +1 -1
- package/build-types/date-time/index.d.ts +1 -2
- package/build-types/date-time/index.d.ts.map +1 -1
- package/build-types/date-time/stories/time.story.d.ts +5 -0
- package/build-types/date-time/stories/time.story.d.ts.map +1 -1
- package/build-types/date-time/time/index.d.ts +4 -1
- package/build-types/date-time/time/index.d.ts.map +1 -1
- package/build-types/date-time/time/styles.d.ts.map +1 -1
- package/build-types/date-time/{time-input → time/time-input}/index.d.ts +1 -1
- package/build-types/date-time/time/time-input/index.d.ts.map +1 -0
- package/build-types/date-time/time/time-input/test/index.d.ts.map +1 -0
- 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 +24 -42
- 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/form-toggle/index.d.ts +2 -5
- package/build-types/form-toggle/index.d.ts.map +1 -1
- package/build-types/guide/index.d.ts.map +1 -1
- package/build-types/heading/component.d.ts +1 -1
- package/build-types/heading/types.d.ts +1 -1
- package/build-types/heading/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/modal/index.d.ts.map +1 -1
- package/build-types/navigation/styles/navigation-styles.d.ts +2 -2
- 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/palette-edit/styles.d.ts +2 -2
- 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-control/stories/index.story.d.ts +1 -0
- package/build-types/radio-control/stories/index.story.d.ts.map +1 -1
- package/build-types/radio-control/test/index.d.ts +2 -0
- package/build-types/radio-control/test/index.d.ts.map +1 -0
- package/build-types/radio-control/types.d.ts +4 -0
- package/build-types/radio-control/types.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 +4 -1
- package/build-types/select-control/index.d.ts.map +1 -1
- package/build-types/select-control/stories/index.story.d.ts +13 -5
- package/build-types/select-control/stories/index.story.d.ts.map +1 -1
- package/build-types/select-control/types.d.ts +27 -27
- package/build-types/select-control/types.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/styles.d.ts +8 -14
- package/build-types/tabs/styles.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 +1 -0
- 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 +3 -9
- 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 +6 -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/component.d.ts +6 -1
- package/build-types/toggle-group-control/toggle-group-control-option/component.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control-option-icon/component.d.ts +14 -14
- package/build-types/tooltip/index.d.ts.map +1 -1
- package/build-types/tooltip/test/utils/index.d.ts +1 -5
- package/build-types/tooltip/test/utils/index.d.ts.map +1 -1
- package/build-types/tree-select/index.d.ts +1 -1
- package/build-types/tree-select/index.d.ts.map +1 -1
- package/build-types/utils/config-values.d.ts +10 -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/alignment-matrix-control/test/index.tsx +1 -3
- package/src/angle-picker-control/styles/angle-picker-control-styles.tsx +2 -2
- package/src/autocomplete/autocompleter-ui.tsx +2 -0
- package/src/autocomplete/style.scss +0 -6
- package/src/base-control/README.md +5 -2
- package/src/base-control/index.tsx +61 -41
- package/src/base-control/styles/base-control-styles.ts +1 -1
- 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 -6
- package/src/button/README.md +7 -0
- package/src/button/stories/e2e/index.story.tsx +103 -21
- package/src/button/style.scss +51 -23
- package/src/button/test/index.tsx +18 -40
- 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/test/index.tsx +1 -4
- package/src/circular-option-picker/types.ts +2 -3
- package/src/color-indicator/style.scss +1 -1
- package/src/color-palette/index.tsx +22 -20
- 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/legacy/test/index.tsx +2 -18
- 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/index.tsx +55 -25
- package/src/custom-select-control/test/index.tsx +172 -30
- package/src/custom-select-control/types.ts +7 -7
- package/src/custom-select-control-v2/custom-select.tsx +2 -1
- package/src/custom-select-control-v2/styles.ts +7 -6
- package/src/custom-select-control-v2/test/index.tsx +15 -19
- package/src/date-time/index.ts +1 -2
- package/src/date-time/stories/time.story.tsx +17 -0
- package/src/date-time/time/index.tsx +72 -28
- package/src/date-time/time/styles.ts +1 -0
- package/src/date-time/{time-input → time/time-input}/index.tsx +9 -9
- 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 +35 -32
- package/src/dropdown-menu-v2/test/index.tsx +1 -4
- 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/font-size-picker/test/index.tsx +50 -43
- package/src/form-file-upload/README.md +8 -0
- package/src/form-file-upload/types.ts +6 -0
- package/src/form-toggle/index.tsx +23 -21
- package/src/form-token-field/README.md +1 -0
- package/src/guide/index.tsx +2 -0
- package/src/guide/style.scss +0 -1
- package/src/heading/types.ts +1 -4
- 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/index.tsx +21 -20
- 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 +15 -3
- 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 +10 -7
- package/src/query-controls/types.ts +2 -1
- package/src/radio-control/index.tsx +62 -13
- package/src/radio-control/stories/index.story.tsx +23 -0
- package/src/radio-control/style.scss +38 -3
- package/src/radio-control/test/index.tsx +277 -0
- package/src/radio-control/types.ts +4 -0
- 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 +16 -1
- package/src/select-control/index.tsx +34 -22
- package/src/select-control/stories/index.story.tsx +8 -5
- package/src/select-control/test/select-control.tsx +155 -5
- package/src/select-control/types.ts +70 -65
- 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/tab-panel/test/index.tsx +1 -8
- package/src/tabs/index.tsx +2 -1
- package/src/tabs/tablist.tsx +6 -4
- package/src/tabs/tabpanel.tsx +6 -2
- package/src/tabs/test/index.tsx +68 -84
- package/src/text/styles.ts +1 -1
- package/src/text-control/README.md +9 -0
- package/src/text-control/index.tsx +2 -0
- package/src/text-control/stories/index.story.tsx +3 -1
- package/src/text-control/style.scss +5 -0
- 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/README.md +9 -0
- package/src/toggle-control/index.tsx +34 -22
- package/src/toggle-control/stories/index.story.tsx +1 -0
- package/src/toggle-control/style.scss +2 -1
- package/src/toggle-control/test/index.tsx +7 -1
- package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +14 -30
- package/src/toggle-group-control/test/index.tsx +5 -7
- package/src/toggle-group-control/toggle-group-control/README.md +20 -1
- package/src/toggle-group-control/toggle-group-control/as-radio-group.tsx +2 -1
- package/src/toggle-group-control/toggle-group-control/component.tsx +7 -1
- package/src/toggle-group-control/toggle-group-control/styles.ts +1 -1
- package/src/toggle-group-control/toggle-group-control-option/README.md +6 -1
- package/src/toggle-group-control/toggle-group-control-option/component.tsx +6 -1
- package/src/toggle-group-control/toggle-group-control-option-base/styles.ts +2 -2
- package/src/toggle-group-control/toggle-group-control-option-icon/README.md +1 -1
- package/src/toggle-group-control/toggle-group-control-option-icon/component.tsx +14 -14
- package/src/toolbar/toolbar/style.scss +2 -2
- package/src/tools-panel/styles.ts +1 -1
- package/src/tooltip/index.tsx +16 -2
- package/src/tooltip/style.scss +1 -1
- package/src/tooltip/test/index.tsx +0 -5
- package/src/tooltip/test/utils/index.tsx +5 -5
- package/src/tree-select/index.tsx +17 -7
- 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 +10 -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/date-time/time-input/index.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/date-time/time-input/index.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/date-time/stories/time-input.story.d.ts +0 -12
- package/build-types/date-time/stories/time-input.story.d.ts.map +0 -1
- package/build-types/date-time/time-input/index.d.ts.map +0 -1
- package/build-types/date-time/time-input/test/index.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/date-time/stories/time-input.story.tsx +0 -36
- 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
- /package/build-types/date-time/{time-input → time/time-input}/test/index.d.ts +0 -0
- /package/src/date-time/{time-input → time/time-input}/test/index.tsx +0 -0
|
@@ -17,6 +17,18 @@ import type { ColorObject, ColorPaletteProps, PaletteObject } from './types';
|
|
|
17
17
|
|
|
18
18
|
extend( [ namesPlugin, a11yPlugin ] );
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Checks if a color value is a simple CSS color.
|
|
22
|
+
*
|
|
23
|
+
* @param value The color value to check.
|
|
24
|
+
* @return A boolean indicating whether the color value is a simple CSS color.
|
|
25
|
+
*/
|
|
26
|
+
const isSimpleCSSColor = ( value: string ): boolean => {
|
|
27
|
+
const valueIsCssVariable = /var\(/.test( value ?? '' );
|
|
28
|
+
const valueIsColorMix = /color-mix\(/.test( value ?? '' );
|
|
29
|
+
return ! valueIsCssVariable && ! valueIsColorMix;
|
|
30
|
+
};
|
|
31
|
+
|
|
20
32
|
export const extractColorNameFromCurrentValue = (
|
|
21
33
|
currentValue?: ColorPaletteProps[ 'value' ],
|
|
22
34
|
colors: ColorPaletteProps[ 'colors' ] = [],
|
|
@@ -25,11 +37,12 @@ export const extractColorNameFromCurrentValue = (
|
|
|
25
37
|
if ( ! currentValue ) {
|
|
26
38
|
return '';
|
|
27
39
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
40
|
+
const currentValueIsSimpleColor = currentValue
|
|
41
|
+
? isSimpleCSSColor( currentValue )
|
|
42
|
+
: false;
|
|
43
|
+
const normalizedCurrentValue = currentValueIsSimpleColor
|
|
44
|
+
? colord( currentValue ).toHex()
|
|
45
|
+
: currentValue;
|
|
33
46
|
|
|
34
47
|
// Normalize format of `colors` to simplify the following loop
|
|
35
48
|
type normalizedPaletteObject = { colors: ColorObject[] };
|
|
@@ -38,9 +51,9 @@ export const extractColorNameFromCurrentValue = (
|
|
|
38
51
|
: [ { colors: colors as ColorObject[] } ];
|
|
39
52
|
for ( const { colors: paletteColors } of colorPalettes ) {
|
|
40
53
|
for ( const { name: colorName, color: colorValue } of paletteColors ) {
|
|
41
|
-
const normalizedColorValue =
|
|
42
|
-
? colorValue
|
|
43
|
-
:
|
|
54
|
+
const normalizedColorValue = currentValueIsSimpleColor
|
|
55
|
+
? colord( colorValue ).toHex()
|
|
56
|
+
: colorValue;
|
|
44
57
|
|
|
45
58
|
if ( normalizedCurrentValue === normalizedColorValue ) {
|
|
46
59
|
return colorName;
|
|
@@ -79,9 +92,9 @@ export const normalizeColorValue = (
|
|
|
79
92
|
value: string | undefined,
|
|
80
93
|
element: HTMLElement | null
|
|
81
94
|
) => {
|
|
82
|
-
const
|
|
95
|
+
const valueIsSimpleColor = value ? isSimpleCSSColor( value ) : false;
|
|
83
96
|
|
|
84
|
-
if (
|
|
97
|
+
if ( valueIsSimpleColor || element === null ) {
|
|
85
98
|
return value;
|
|
86
99
|
}
|
|
87
100
|
|
|
@@ -118,6 +118,14 @@ Custom renderer invoked for each option in the suggestion list. The render prop
|
|
|
118
118
|
- Type: `( args: { item: object } ) => ReactNode`
|
|
119
119
|
- Required: No
|
|
120
120
|
|
|
121
|
+
#### __next40pxDefaultSize
|
|
122
|
+
|
|
123
|
+
Start opting into the larger default height that will become the default size in a future version.
|
|
124
|
+
|
|
125
|
+
- Type: `Boolean`
|
|
126
|
+
- Required: No
|
|
127
|
+
- Default: `false`
|
|
128
|
+
|
|
121
129
|
#### __nextHasNoMarginBottom
|
|
122
130
|
|
|
123
131
|
Start opting into the new margin-free styles that will become the default in a future version.
|
|
@@ -320,6 +320,7 @@ function ComboboxControl( props: ComboboxControlProps ) {
|
|
|
320
320
|
<DetectOutside onFocusOutside={ onFocusOutside }>
|
|
321
321
|
<BaseControl
|
|
322
322
|
__nextHasNoMarginBottom={ __nextHasNoMarginBottom }
|
|
323
|
+
__associatedWPComponentName="ComboboxControl"
|
|
323
324
|
className={ clsx( className, 'components-combobox-control' ) }
|
|
324
325
|
label={ label }
|
|
325
326
|
id={ `components-form-token-input-${ instanceId }` }
|
|
@@ -76,6 +76,7 @@ const Template: StoryFn< typeof ComboboxControl > = ( {
|
|
|
76
76
|
};
|
|
77
77
|
export const Default = Template.bind( {} );
|
|
78
78
|
Default.args = {
|
|
79
|
+
__nextHasNoMarginBottom: true,
|
|
79
80
|
allowReset: false,
|
|
80
81
|
label: 'Select a country',
|
|
81
82
|
options: countryOptions,
|
|
@@ -135,8 +136,7 @@ const optionsWithDisabledOptions = countryOptions.map( ( option, index ) => ( {
|
|
|
135
136
|
} ) );
|
|
136
137
|
|
|
137
138
|
WithDisabledOptions.args = {
|
|
138
|
-
|
|
139
|
-
label: 'Select a country',
|
|
139
|
+
...Default.args,
|
|
140
140
|
options: optionsWithDisabledOptions,
|
|
141
141
|
};
|
|
142
142
|
|
|
@@ -148,8 +148,7 @@ WithDisabledOptions.args = {
|
|
|
148
148
|
export const NotExpandOnFocus = Template.bind( {} );
|
|
149
149
|
|
|
150
150
|
NotExpandOnFocus.args = {
|
|
151
|
-
|
|
152
|
-
label: 'Select a country',
|
|
151
|
+
...Default.args,
|
|
153
152
|
options: countryOptions,
|
|
154
153
|
expandOnFocus: false,
|
|
155
154
|
};
|
|
@@ -12,7 +12,7 @@ import { useState } from '@wordpress/element';
|
|
|
12
12
|
/**
|
|
13
13
|
* Internal dependencies
|
|
14
14
|
*/
|
|
15
|
-
import
|
|
15
|
+
import _ComboboxControl from '..';
|
|
16
16
|
import type { ComboboxControlOption, ComboboxControlProps } from '../types';
|
|
17
17
|
|
|
18
18
|
const timezones = [
|
|
@@ -57,6 +57,10 @@ const getAllOptions = () => screen.getAllByRole( 'option' );
|
|
|
57
57
|
const getOptionSearchString = ( option: ComboboxControlOption ) =>
|
|
58
58
|
option.label.substring( 0, 11 );
|
|
59
59
|
|
|
60
|
+
const ComboboxControl = ( props: ComboboxControlProps ) => {
|
|
61
|
+
return <_ComboboxControl { ...props } __nextHasNoMarginBottom />;
|
|
62
|
+
};
|
|
63
|
+
|
|
60
64
|
const ControlledComboboxControl = ( {
|
|
61
65
|
value: valueProp,
|
|
62
66
|
onChange,
|
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
# `Composite`
|
|
2
|
+
|
|
3
|
+
<div class="callout callout-alert">
|
|
4
|
+
This feature is still experimental. “Experimental” means this is an early implementation subject to drastic and breaking changes.
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
`Composite` provides a single tab stop on the page and allows navigation through the focusable descendants with arrow keys. This abstract component is based on the [WAI-ARIA Composite Role](https://w3c.github.io/aria/#composite).
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```jsx
|
|
12
|
+
import { Composite, useCompositeStore } from '@wordpress/components';
|
|
13
|
+
|
|
14
|
+
const store = useCompositeStore();
|
|
15
|
+
<Composite store={store}>
|
|
16
|
+
<Composite.Group>
|
|
17
|
+
<Composite.GroupLabel>Label</Composite.GroupLabel>
|
|
18
|
+
<Composite.Item>Item 1</Composite.Item>
|
|
19
|
+
<Composite.Item>Item 2</Composite.Item>
|
|
20
|
+
</CompositeGroup>
|
|
21
|
+
</Composite>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Hooks
|
|
25
|
+
|
|
26
|
+
### `useCompositeStore`
|
|
27
|
+
|
|
28
|
+
Creates a composite store.
|
|
29
|
+
|
|
30
|
+
#### Props
|
|
31
|
+
|
|
32
|
+
##### `activeId`: `string | null`
|
|
33
|
+
|
|
34
|
+
The current active item `id`. The active item is the element within the composite widget that has either DOM or virtual focus (in case the `virtualFocus` prop is enabled).
|
|
35
|
+
|
|
36
|
+
- `null` represents the base composite element (the one with a [composite role](https://w3c.github.io/aria/#composite)). Users will be able to navigate out of it using arrow keys.
|
|
37
|
+
- If `activeId` is initially set to `null`, the base composite element itself will have focus and users will be able to navigate to it using arrow keys.
|
|
38
|
+
|
|
39
|
+
- Required: no
|
|
40
|
+
|
|
41
|
+
##### `defaultActiveId`: `string | null`
|
|
42
|
+
|
|
43
|
+
The composite item id that should be active by default when the composite widget is rendered. If `null`, the composite element itself will have focus and users will be able to navigate to it using arrow keys. If `undefined`, the first enabled item will be focused.
|
|
44
|
+
|
|
45
|
+
- Required: no
|
|
46
|
+
|
|
47
|
+
##### `setActiveId`: `((activeId: string | null | undefined) => void)`
|
|
48
|
+
|
|
49
|
+
A callback that gets called when the `activeId` state changes.
|
|
50
|
+
|
|
51
|
+
- Required: no
|
|
52
|
+
|
|
53
|
+
##### `focusLoop`: `boolean | 'horizontal' | 'vertical' | 'both'`
|
|
54
|
+
|
|
55
|
+
Determines how the focus behaves when the user reaches the end of the composite widget.
|
|
56
|
+
|
|
57
|
+
On one-dimensional composite widgets:
|
|
58
|
+
|
|
59
|
+
- `true` loops from the last item to the first item and vice-versa.
|
|
60
|
+
- `horizontal` loops only if `orientation` is `horizontal` or not set.
|
|
61
|
+
- `vertical` loops only if `orientation` is `vertical` or not set.
|
|
62
|
+
- If `activeId` is initially set to `null`, the composite element will be focused in between the last and first items.
|
|
63
|
+
|
|
64
|
+
On two-dimensional composite widgets (ie. when using `CompositeRow`):
|
|
65
|
+
|
|
66
|
+
- `true` loops from the last row/column item to the first item in the same row/column and vice-versa. If it's the last item in the last row, it moves to the first item in the first row and vice-versa.
|
|
67
|
+
- `horizontal` loops only from the last row item to the first item in the same row.
|
|
68
|
+
- `vertical` loops only from the last column item to the first item in the column row.
|
|
69
|
+
- If `activeId` is initially set to `null`, vertical loop will have no effect as moving down from the last row or up from the first row will focus on the composite element.
|
|
70
|
+
- If `focusWrap` matches the value of `focusLoop`, it'll wrap between the last item in the last row or column and the first item in the first row or column and vice-versa.
|
|
71
|
+
|
|
72
|
+
- Required: no
|
|
73
|
+
- Default: `false`
|
|
74
|
+
|
|
75
|
+
##### `focusShift`: `boolean`
|
|
76
|
+
|
|
77
|
+
**Works only on two-dimensional composite widgets**.
|
|
78
|
+
|
|
79
|
+
If enabled, moving up or down when there's no next item or when the next item is disabled will shift to the item right before it.
|
|
80
|
+
|
|
81
|
+
- Required: no
|
|
82
|
+
- Default: `false`
|
|
83
|
+
|
|
84
|
+
##### `focusWrap`: `boolean`
|
|
85
|
+
|
|
86
|
+
**Works only on two-dimensional composite widgets**.
|
|
87
|
+
|
|
88
|
+
If enabled, moving to the next item from the last one in a row or column
|
|
89
|
+
will focus on the first item in the next row or column and vice-versa.
|
|
90
|
+
|
|
91
|
+
- `true` wraps between rows and columns.
|
|
92
|
+
- `horizontal` wraps only between rows.
|
|
93
|
+
- `vertical` wraps only between columns.
|
|
94
|
+
- If `focusLoop` matches the value of `focusWrap`, it'll wrap between the
|
|
95
|
+
last item in the last row or column and the first item in the first row or
|
|
96
|
+
column and vice-versa.
|
|
97
|
+
|
|
98
|
+
- Required: no
|
|
99
|
+
- Default: `false`
|
|
100
|
+
|
|
101
|
+
##### `virtualFocus`: `boolean`
|
|
102
|
+
|
|
103
|
+
If enabled, the composite element will act as an [`aria-activedescendant`](https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/#kbd_focus_activedescendant)
|
|
104
|
+
container instead of [roving tabindex](https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/#kbd_roving_tabindex). DOM focus will remain on the composite element while its items receive
|
|
105
|
+
virtual focus.
|
|
106
|
+
|
|
107
|
+
In both scenarios, the item in focus will carry the `data-active-item` attribute.
|
|
108
|
+
|
|
109
|
+
- Required: no
|
|
110
|
+
- Default: `false`
|
|
111
|
+
|
|
112
|
+
##### `orientation`: `'horizontal' | 'vertical' | 'both'`
|
|
113
|
+
|
|
114
|
+
Defines the orientation of the composite widget. If the composite has a single row or column (one-dimensional), the `orientation` value determines which arrow keys can be used to move focus:
|
|
115
|
+
|
|
116
|
+
- `both`: all arrow keys work.
|
|
117
|
+
- `horizontal`: only left and right arrow keys work.
|
|
118
|
+
- `vertical`: only up and down arrow keys work.
|
|
119
|
+
|
|
120
|
+
It doesn't have any effect on two-dimensional composites.
|
|
121
|
+
|
|
122
|
+
- Required: no
|
|
123
|
+
- Default: `both`
|
|
124
|
+
|
|
125
|
+
##### `rtl`: `boolean`
|
|
126
|
+
|
|
127
|
+
Determines how the `store`'s `next` and `previous` functions will behave. If `rtl` is set to `true`, they will be inverted.
|
|
128
|
+
|
|
129
|
+
This only affects the composite widget behavior. You still need to set `dir="rtl"` on HTML/CSS.
|
|
130
|
+
|
|
131
|
+
- Required: no
|
|
132
|
+
- Default: `false`
|
|
133
|
+
|
|
134
|
+
## Components
|
|
135
|
+
|
|
136
|
+
### `Composite`
|
|
137
|
+
|
|
138
|
+
Renders a composite widget.
|
|
139
|
+
|
|
140
|
+
#### Props
|
|
141
|
+
|
|
142
|
+
##### `store`: `CompositeStore<CompositeStoreItem>`
|
|
143
|
+
|
|
144
|
+
Object returned by the `useCompositeStore` hook.
|
|
145
|
+
|
|
146
|
+
- Required: yes
|
|
147
|
+
|
|
148
|
+
##### `render`: `RenderProp<React.HTMLAttributes<any> & { ref?: React.Ref<any> | undefined; }> | React.ReactElement<any, string | React.JSXElementConstructor<any>>`
|
|
149
|
+
|
|
150
|
+
Allows the component to be rendered as a different HTML element or React component. The value can be a React element or a function that takes in the original component props and gives back a React element with the props merged.
|
|
151
|
+
|
|
152
|
+
- Required: no
|
|
153
|
+
|
|
154
|
+
##### `focusable`: `boolean`
|
|
155
|
+
|
|
156
|
+
Makes the component a focusable element. When this element gains keyboard focus, it gets a `data-focus-visible` attribute and triggers the `onFocusVisible` prop.
|
|
157
|
+
|
|
158
|
+
The component supports the `disabled` prop even for those elements not supporting the native `disabled` attribute. Disabled elements may be still accessible via keyboard by using the the `accessibleWhenDisabled` prop.
|
|
159
|
+
|
|
160
|
+
Non-native focusable elements will lose their focusability entirely. However, native focusable elements will retain their inherent focusability.
|
|
161
|
+
|
|
162
|
+
- Required: no
|
|
163
|
+
|
|
164
|
+
##### `disabled`: `boolean`
|
|
165
|
+
|
|
166
|
+
Determines if the element is disabled. This sets the `aria-disabled` attribute accordingly, enabling support for all elements, including those that don't support the native `disabled` attribute.
|
|
167
|
+
|
|
168
|
+
This feature can be combined with the `accessibleWhenDisabled` prop to
|
|
169
|
+
make disabled elements still accessible via keyboard.
|
|
170
|
+
|
|
171
|
+
**Note**: For this prop to work, the `focusable` prop must be set to
|
|
172
|
+
`true`, if it's not set by default.
|
|
173
|
+
|
|
174
|
+
- Required: no
|
|
175
|
+
- Default: `false`
|
|
176
|
+
|
|
177
|
+
##### `accessibleWhenDisabled`: `boolean`
|
|
178
|
+
|
|
179
|
+
Indicates whether the element should be focusable even when it is
|
|
180
|
+
`disabled`.
|
|
181
|
+
|
|
182
|
+
This is important when discoverability is a concern. For example:
|
|
183
|
+
|
|
184
|
+
> A toolbar in an editor contains a set of special smart paste functions
|
|
185
|
+
> that are disabled when the clipboard is empty or when the function is not
|
|
186
|
+
> applicable to the current content of the clipboard. It could be helpful to
|
|
187
|
+
> keep the disabled buttons focusable if the ability to discover their
|
|
188
|
+
> functionality is primarily via their presence on the toolbar.
|
|
189
|
+
|
|
190
|
+
Learn more on [Focusability of disabled
|
|
191
|
+
controls](https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/#focusabilityofdisabledcontrols).
|
|
192
|
+
|
|
193
|
+
- Required: no
|
|
194
|
+
|
|
195
|
+
##### `onFocusVisible`: `(event: SyntheticEvent<HTMLElement>) => void`
|
|
196
|
+
|
|
197
|
+
Custom event handler invoked when the element gains focus through keyboard interaction or a key press occurs while the element is in focus. This is the programmatic equivalent of the `data-focus-visible` attribute.
|
|
198
|
+
|
|
199
|
+
**Note**: For this prop to work, the `focusable` prop must be set to `true` if it's not set by default.
|
|
200
|
+
|
|
201
|
+
- Required: no
|
|
202
|
+
|
|
203
|
+
##### `children`: `React.ReactNode`
|
|
204
|
+
|
|
205
|
+
The contents of the component.
|
|
206
|
+
|
|
207
|
+
- Required: no
|
|
208
|
+
|
|
209
|
+
### `Composite.Group`
|
|
210
|
+
|
|
211
|
+
Renders a group element for composite items.
|
|
212
|
+
|
|
213
|
+
##### `render`: `RenderProp<React.HTMLAttributes<any> & { ref?: React.Ref<any> | undefined; }> | React.ReactElement<any, string | React.JSXElementConstructor<any>>`
|
|
214
|
+
|
|
215
|
+
Allows the component to be rendered as a different HTML element or React component. The value can be a React element or a function that takes in the original component props and gives back a React element with the props merged.
|
|
216
|
+
|
|
217
|
+
- Required: no
|
|
218
|
+
|
|
219
|
+
##### `children`: `React.ReactNode`
|
|
220
|
+
|
|
221
|
+
The contents of the component.
|
|
222
|
+
|
|
223
|
+
- Required: no
|
|
224
|
+
|
|
225
|
+
### `Composite.GroupLabel`
|
|
226
|
+
|
|
227
|
+
Renders a label in a composite group. This component must be wrapped with `Composite.Group` so the `aria-labelledby` prop is properly set on the composite group element.
|
|
228
|
+
|
|
229
|
+
##### `render`: `RenderProp<React.HTMLAttributes<any> & { ref?: React.Ref<any> | undefined; }> | React.ReactElement<any, string | React.JSXElementConstructor<any>>`
|
|
230
|
+
|
|
231
|
+
Allows the component to be rendered as a different HTML element or React component. The value can be a React element or a function that takes in the original component props and gives back a React element with the props merged.
|
|
232
|
+
|
|
233
|
+
- Required: no
|
|
234
|
+
|
|
235
|
+
##### `children`: `React.ReactNode`
|
|
236
|
+
|
|
237
|
+
The contents of the component.
|
|
238
|
+
|
|
239
|
+
- Required: no
|
|
240
|
+
|
|
241
|
+
### `Composite.Item`
|
|
242
|
+
|
|
243
|
+
Renders a composite item.
|
|
244
|
+
|
|
245
|
+
##### `accessibleWhenDisabled`: `boolean`
|
|
246
|
+
|
|
247
|
+
Indicates whether the element should be focusable even when it is
|
|
248
|
+
`disabled`.
|
|
249
|
+
|
|
250
|
+
This is important when discoverability is a concern. For example:
|
|
251
|
+
|
|
252
|
+
> A toolbar in an editor contains a set of special smart paste functions
|
|
253
|
+
> that are disabled when the clipboard is empty or when the function is not
|
|
254
|
+
> applicable to the current content of the clipboard. It could be helpful to
|
|
255
|
+
> keep the disabled buttons focusable if the ability to discover their
|
|
256
|
+
> functionality is primarily via their presence on the toolbar.
|
|
257
|
+
|
|
258
|
+
Learn more on [Focusability of disabled
|
|
259
|
+
controls](https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/#focusabilityofdisabledcontrols).
|
|
260
|
+
|
|
261
|
+
- Required: no
|
|
262
|
+
|
|
263
|
+
##### `render`: `RenderProp<React.HTMLAttributes<any> & { ref?: React.Ref<any> | undefined; }> | React.ReactElement<any, string | React.JSXElementConstructor<any>>`
|
|
264
|
+
|
|
265
|
+
Allows the component to be rendered as a different HTML element or React component. The value can be a React element or a function that takes in the original component props and gives back a React element with the props merged.
|
|
266
|
+
|
|
267
|
+
- Required: no
|
|
268
|
+
|
|
269
|
+
##### `children`: `React.ReactNode`
|
|
270
|
+
|
|
271
|
+
The contents of the component.
|
|
272
|
+
|
|
273
|
+
- Required: no
|
|
274
|
+
|
|
275
|
+
### `Composite.Row`
|
|
276
|
+
|
|
277
|
+
Renders a composite row. Wrapping `Composite.Item` elements within `Composite.Row` will create a two-dimensional composite widget, such as a grid.
|
|
278
|
+
|
|
279
|
+
##### `render`: `RenderProp<React.HTMLAttributes<any> & { ref?: React.Ref<any> | undefined; }> | React.ReactElement<any, string | React.JSXElementConstructor<any>>`
|
|
280
|
+
|
|
281
|
+
Allows the component to be rendered as a different HTML element or React component. The value can be a React element or a function that takes in the original component props and gives back a React element with the props merged.
|
|
282
|
+
|
|
283
|
+
- Required: no
|
|
284
|
+
|
|
285
|
+
##### `children`: `React.ReactNode`
|
|
286
|
+
|
|
287
|
+
The contents of the component.
|
|
288
|
+
|
|
289
|
+
- Required: no
|
|
290
|
+
|
|
291
|
+
### `Composite.Hover`
|
|
292
|
+
|
|
293
|
+
Renders an element in a composite widget that receives focus on mouse move and loses focus to the composite base element on mouse leave. This should be combined with the `Composite.Item` component.
|
|
294
|
+
|
|
295
|
+
##### `render`: `RenderProp<React.HTMLAttributes<any> & { ref?: React.Ref<any> | undefined; }> | React.ReactElement<any, string | React.JSXElementConstructor<any>>`
|
|
296
|
+
|
|
297
|
+
Allows the component to be rendered as a different HTML element or React component. The value can be a React element or a function that takes in the original component props and gives back a React element with the props merged.
|
|
298
|
+
|
|
299
|
+
- Required: no
|
|
300
|
+
|
|
301
|
+
##### `children`: `React.ReactNode`
|
|
302
|
+
|
|
303
|
+
The contents of the component.
|
|
304
|
+
|
|
305
|
+
- Required: no
|
|
306
|
+
|
|
307
|
+
### `Composite.Typeahead`
|
|
308
|
+
|
|
309
|
+
Renders a component that adds typeahead functionality to composite components. Hitting printable character keys will move focus to the next composite item that begins with the input characters.
|
|
310
|
+
|
|
311
|
+
##### `render`: `RenderProp<React.HTMLAttributes<any> & { ref?: React.Ref<any> | undefined; }> | React.ReactElement<any, string | React.JSXElementConstructor<any>>`
|
|
312
|
+
|
|
313
|
+
Allows the component to be rendered as a different HTML element or React component. The value can be a React element or a function that takes in the original component props and gives back a React element with the props merged.
|
|
314
|
+
|
|
315
|
+
- Required: no
|
|
316
|
+
|
|
317
|
+
##### `children`: `React.ReactNode`
|
|
318
|
+
|
|
319
|
+
The contents of the component.
|
|
320
|
+
|
|
321
|
+
- Required: no
|
|
322
|
+
|
|
323
|
+
### `Composite.Context`
|
|
324
|
+
|
|
325
|
+
The React context used by the composite components. It can be used by to access the composite store, and to forward the context when composite sub-components are rendered across portals (ie. `SlotFill` components) that would not otherwise forward the context to the `Fill` children.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { createContext, useContext } from '@wordpress/element';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import type { CompositeContextProps } from './types';
|
|
10
|
+
|
|
11
|
+
export const CompositeContext =
|
|
12
|
+
createContext< CompositeContextProps >( undefined );
|
|
13
|
+
|
|
14
|
+
export const useCompositeContext = () => useContext( CompositeContext );
|