@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
|
@@ -5,6 +5,11 @@
|
|
|
5
5
|
* tab stop for the whole Composite element. This means that it can behave as
|
|
6
6
|
* a roving tabindex or aria-activedescendant container.
|
|
7
7
|
*
|
|
8
|
+
* This file aims at providing components that are as close as possible to the
|
|
9
|
+
* original `reakit`-based implementation (which was removed from the codebase),
|
|
10
|
+
* although it is recommended that consumers of the package switch to the stable,
|
|
11
|
+
* un-prefixed, `ariakit`-based version of `Composite`.
|
|
12
|
+
*
|
|
8
13
|
* @see https://ariakit.org/components/composite
|
|
9
14
|
*/
|
|
10
15
|
|
|
@@ -16,7 +21,7 @@ import { forwardRef } from '@wordpress/element';
|
|
|
16
21
|
/**
|
|
17
22
|
* Internal dependencies
|
|
18
23
|
*/
|
|
19
|
-
import
|
|
24
|
+
import { Composite as Current, useCompositeStore } from '..';
|
|
20
25
|
import { useInstanceId } from '@wordpress/compose';
|
|
21
26
|
|
|
22
27
|
type Orientation = 'horizontal' | 'vertical';
|
|
@@ -73,7 +78,7 @@ export interface LegacyStateOptions {
|
|
|
73
78
|
|
|
74
79
|
type Component = React.FunctionComponent< any >;
|
|
75
80
|
|
|
76
|
-
type CompositeStore = ReturnType< typeof
|
|
81
|
+
type CompositeStore = ReturnType< typeof useCompositeStore >;
|
|
77
82
|
type CompositeStoreState = { store: CompositeStore };
|
|
78
83
|
export type CompositeState = CompositeStoreState &
|
|
79
84
|
Required< Pick< LegacyStateOptions, 'baseId' > >;
|
|
@@ -93,9 +98,9 @@ type CompositeComponent< C extends Component > = (
|
|
|
93
98
|
) => React.ReactElement;
|
|
94
99
|
type CompositeComponentProps = CompositeState &
|
|
95
100
|
(
|
|
96
|
-
| ComponentProps< typeof Current.
|
|
97
|
-
| ComponentProps< typeof Current.
|
|
98
|
-
| ComponentProps< typeof Current.
|
|
101
|
+
| ComponentProps< typeof Current.Group >
|
|
102
|
+
| ComponentProps< typeof Current.Item >
|
|
103
|
+
| ComponentProps< typeof Current.Row >
|
|
99
104
|
);
|
|
100
105
|
|
|
101
106
|
function mapLegacyStatePropsToComponentProps(
|
|
@@ -145,19 +150,15 @@ function proxyComposite< C extends Component >(
|
|
|
145
150
|
// provided role, and returning the appropriate component.
|
|
146
151
|
const unproxiedCompositeGroup = forwardRef<
|
|
147
152
|
any,
|
|
148
|
-
React.ComponentPropsWithoutRef<
|
|
149
|
-
typeof Current.CompositeGroup | typeof Current.CompositeRow
|
|
150
|
-
>
|
|
153
|
+
React.ComponentPropsWithoutRef< typeof Current.Group | typeof Current.Row >
|
|
151
154
|
>( ( { role, ...props }, ref ) => {
|
|
152
|
-
const Component =
|
|
153
|
-
role === 'row' ? Current.CompositeRow : Current.CompositeGroup;
|
|
155
|
+
const Component = role === 'row' ? Current.Row : Current.Group;
|
|
154
156
|
return <Component ref={ ref } role={ role } { ...props } />;
|
|
155
157
|
} );
|
|
156
|
-
unproxiedCompositeGroup.displayName = 'CompositeGroup';
|
|
157
158
|
|
|
158
|
-
export const Composite = proxyComposite( Current
|
|
159
|
+
export const Composite = proxyComposite( Current, { baseId: 'id' } );
|
|
159
160
|
export const CompositeGroup = proxyComposite( unproxiedCompositeGroup );
|
|
160
|
-
export const CompositeItem = proxyComposite( Current.
|
|
161
|
+
export const CompositeItem = proxyComposite( Current.Item, {
|
|
161
162
|
focusable: 'accessibleWhenDisabled',
|
|
162
163
|
} );
|
|
163
164
|
|
|
@@ -178,7 +179,7 @@ export function useCompositeState(
|
|
|
178
179
|
|
|
179
180
|
return {
|
|
180
181
|
baseId: useInstanceId( Composite, 'composite', baseId ),
|
|
181
|
-
store:
|
|
182
|
+
store: useCompositeStore( {
|
|
182
183
|
defaultActiveId,
|
|
183
184
|
rtl,
|
|
184
185
|
orientation,
|
|
@@ -8,6 +8,25 @@ import type { StoryContext } from '@storybook/react';
|
|
|
8
8
|
*/
|
|
9
9
|
import type { LegacyStateOptions } from '..';
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Renders a composite widget.
|
|
13
|
+
*
|
|
14
|
+
* This unstable component is deprecated. Use `Composite` instead.
|
|
15
|
+
*
|
|
16
|
+
* ```jsx
|
|
17
|
+
* import {
|
|
18
|
+
* __unstableUseCompositeState as useCompositeState,
|
|
19
|
+
* __unstableComposite as Composite,
|
|
20
|
+
* __unstableCompositeItem as CompositeItem,
|
|
21
|
+
* } from '@wordpress/components';
|
|
22
|
+
*
|
|
23
|
+
* const state = useCompositeState();
|
|
24
|
+
* <Composite state={ state }>
|
|
25
|
+
* <CompositeItem>Item 1</CompositeItem>
|
|
26
|
+
* <CompositeItem>Item 2</CompositeItem>
|
|
27
|
+
* </Composite>;
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
11
30
|
export function UseCompositeStatePlaceholder( props: LegacyStateOptions ) {
|
|
12
31
|
return (
|
|
13
32
|
<dl>
|
|
@@ -0,0 +1,466 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { Meta, StoryFn } from '@storybook/react';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { isRTL } from '@wordpress/i18n';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Internal dependencies
|
|
13
|
+
*/
|
|
14
|
+
import { Composite, useCompositeStore } from '..';
|
|
15
|
+
import { UseCompositeStorePlaceholder, transform } from './utils';
|
|
16
|
+
|
|
17
|
+
const meta: Meta< typeof UseCompositeStorePlaceholder > = {
|
|
18
|
+
title: 'Components/Composite (V2)',
|
|
19
|
+
component: UseCompositeStorePlaceholder,
|
|
20
|
+
subcomponents: {
|
|
21
|
+
// @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
|
|
22
|
+
Composite,
|
|
23
|
+
// @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
|
|
24
|
+
'Composite.Group': Composite.Group,
|
|
25
|
+
// @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
|
|
26
|
+
'Composite.GroupLabel': Composite.GroupLabel,
|
|
27
|
+
// @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
|
|
28
|
+
'Composite.Row': Composite.Row,
|
|
29
|
+
// @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
|
|
30
|
+
'Composite.Item': Composite.Item,
|
|
31
|
+
// @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
|
|
32
|
+
'Composite.Hover': Composite.Hover,
|
|
33
|
+
// @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
|
|
34
|
+
'Composite.Typeahead': Composite.Typeahead,
|
|
35
|
+
},
|
|
36
|
+
argTypes: {
|
|
37
|
+
activeId: { control: 'text' },
|
|
38
|
+
defaultActiveId: { control: 'text' },
|
|
39
|
+
setActiveId: { control: { type: null } },
|
|
40
|
+
focusLoop: {
|
|
41
|
+
control: 'select',
|
|
42
|
+
options: [ true, false, 'horizontal', 'vertical', 'both' ],
|
|
43
|
+
},
|
|
44
|
+
focusShift: { control: 'boolean' },
|
|
45
|
+
focusWrap: { control: 'boolean' },
|
|
46
|
+
virtualFocus: { control: 'boolean' },
|
|
47
|
+
rtl: { control: 'boolean' },
|
|
48
|
+
orientation: {
|
|
49
|
+
control: 'select',
|
|
50
|
+
options: [ 'horizontal', 'vertical', 'both' ],
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
tags: [ 'status-private' ],
|
|
54
|
+
parameters: {
|
|
55
|
+
controls: { expanded: true },
|
|
56
|
+
docs: {
|
|
57
|
+
canvas: { sourceState: 'shown' },
|
|
58
|
+
source: { transform },
|
|
59
|
+
extractArgTypes: ( component: React.FunctionComponent ) => {
|
|
60
|
+
const commonArgTypes = {
|
|
61
|
+
render: {
|
|
62
|
+
name: 'render',
|
|
63
|
+
description:
|
|
64
|
+
'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.',
|
|
65
|
+
table: {
|
|
66
|
+
type: {
|
|
67
|
+
summary:
|
|
68
|
+
'RenderProp<React.HTMLAttributes<any> & { ref?: React.Ref<any> | undefined; }> | React.ReactElement<any, string | React.JSXElementConstructor<any>>',
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
children: {
|
|
73
|
+
name: 'children',
|
|
74
|
+
description: 'The contents of the component.',
|
|
75
|
+
table: { type: { summary: 'React.ReactNode' } },
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
const accessibleWhenDisabled = {
|
|
79
|
+
name: 'accessibleWhenDisabled',
|
|
80
|
+
description: `Indicates whether the element should be focusable even when it is
|
|
81
|
+
\`disabled\`.
|
|
82
|
+
|
|
83
|
+
This is important when discoverability is a concern. For example:
|
|
84
|
+
|
|
85
|
+
> A toolbar in an editor contains a set of special smart paste functions
|
|
86
|
+
> that are disabled when the clipboard is empty or when the function is not
|
|
87
|
+
> applicable to the current content of the clipboard. It could be helpful to
|
|
88
|
+
> keep the disabled buttons focusable if the ability to discover their
|
|
89
|
+
> functionality is primarily via their presence on the toolbar.
|
|
90
|
+
|
|
91
|
+
Learn more on [Focusability of disabled
|
|
92
|
+
controls](https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/#focusabilityofdisabledcontrols).`,
|
|
93
|
+
table: {
|
|
94
|
+
type: {
|
|
95
|
+
summary: 'boolean',
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const argTypes = {
|
|
101
|
+
useCompositeStore: {
|
|
102
|
+
activeId: {
|
|
103
|
+
name: 'activeId',
|
|
104
|
+
description: `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).
|
|
105
|
+
- \`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.
|
|
106
|
+
- 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.`,
|
|
107
|
+
table: { type: { summary: 'string | null' } },
|
|
108
|
+
},
|
|
109
|
+
defaultActiveId: {
|
|
110
|
+
name: 'defaultActiveId',
|
|
111
|
+
description:
|
|
112
|
+
'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.',
|
|
113
|
+
table: { type: { summary: 'string | null' } },
|
|
114
|
+
},
|
|
115
|
+
setActiveId: {
|
|
116
|
+
name: 'setActiveId',
|
|
117
|
+
description:
|
|
118
|
+
'A callback that gets called when the `activeId` state changes.',
|
|
119
|
+
table: {
|
|
120
|
+
type: {
|
|
121
|
+
summary:
|
|
122
|
+
'((activeId: string | null | undefined) => void)',
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
focusLoop: {
|
|
127
|
+
name: 'focusLoop',
|
|
128
|
+
description: `On one-dimensional composite widgets:
|
|
129
|
+
|
|
130
|
+
- \`true\` loops from the last item to the first item and vice-versa.
|
|
131
|
+
- \`horizontal\` loops only if \`orientation\` is \`horizontal\` or not set.
|
|
132
|
+
- \`vertical\` loops only if \`orientation\` is \`vertical\` or not set.
|
|
133
|
+
- If \`activeId\` is initially set to \`null\`, the composite element will be focused in between the last and first items.
|
|
134
|
+
|
|
135
|
+
On two-dimensional composite widgets (ie. when using \`CompositeRow\`):
|
|
136
|
+
|
|
137
|
+
- \`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.
|
|
138
|
+
- \`horizontal\` loops only from the last row item to the first item in the same row.
|
|
139
|
+
- \`vertical\` loops only from the last column item to the first item in the column row.
|
|
140
|
+
- 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.
|
|
141
|
+
- 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.`,
|
|
142
|
+
table: {
|
|
143
|
+
defaultValue: {
|
|
144
|
+
summary: 'false',
|
|
145
|
+
},
|
|
146
|
+
type: {
|
|
147
|
+
summary:
|
|
148
|
+
"boolean | 'horizontal' | 'vertical' | 'both'",
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
focusShift: {
|
|
153
|
+
name: 'focusShift',
|
|
154
|
+
description: `**Works only on two-dimensional composite widgets**.
|
|
155
|
+
|
|
156
|
+
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.`,
|
|
157
|
+
table: {
|
|
158
|
+
defaultValue: {
|
|
159
|
+
summary: 'false',
|
|
160
|
+
},
|
|
161
|
+
type: {
|
|
162
|
+
summary: 'boolean',
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
focusWrap: {
|
|
167
|
+
name: 'focusWrap',
|
|
168
|
+
description: `**Works only on two-dimensional composite widgets**.
|
|
169
|
+
|
|
170
|
+
If enabled, moving to the next item from the last one in a row or column
|
|
171
|
+
will focus on the first item in the next row or column and vice-versa.
|
|
172
|
+
|
|
173
|
+
- \`true\` wraps between rows and columns.
|
|
174
|
+
- \`horizontal\` wraps only between rows.
|
|
175
|
+
- \`vertical\` wraps only between columns.
|
|
176
|
+
- If \`focusLoop\` matches the value of \`focusWrap\`, it'll wrap between the
|
|
177
|
+
last item in the last row or column and the first item in the first row or
|
|
178
|
+
column and vice-versa.`,
|
|
179
|
+
table: {
|
|
180
|
+
defaultValue: {
|
|
181
|
+
summary: 'false',
|
|
182
|
+
},
|
|
183
|
+
type: {
|
|
184
|
+
summary: 'boolean',
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
virtualFocus: {
|
|
189
|
+
name: 'virtualFocus',
|
|
190
|
+
description: `If enabled, the composite element will act as an [\`aria-activedescendant\`](https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/#kbd_focus_activedescendant)
|
|
191
|
+
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
|
|
192
|
+
virtual focus.
|
|
193
|
+
|
|
194
|
+
In both scenarios, the item in focus will carry the \`data-active-item\` attribute.`,
|
|
195
|
+
table: {
|
|
196
|
+
defaultValue: {
|
|
197
|
+
summary: 'false',
|
|
198
|
+
},
|
|
199
|
+
type: {
|
|
200
|
+
summary: 'boolean',
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
orientation: {
|
|
205
|
+
name: 'orientation',
|
|
206
|
+
description: `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:
|
|
207
|
+
|
|
208
|
+
- \`both\`: all arrow keys work.
|
|
209
|
+
- \`horizontal\`: only left and right arrow keys work.
|
|
210
|
+
- \`vertical\`: only up and down arrow keys work.
|
|
211
|
+
|
|
212
|
+
It doesn't have any effect on two-dimensional composites.`,
|
|
213
|
+
table: {
|
|
214
|
+
defaultValue: {
|
|
215
|
+
summary: "'both'",
|
|
216
|
+
},
|
|
217
|
+
type: {
|
|
218
|
+
summary:
|
|
219
|
+
"'horizontal' | 'vertical' | 'both'",
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
rtl: {
|
|
224
|
+
name: 'rtl',
|
|
225
|
+
description: `Determines how the \`store\`'s \`next\` and \`previous\` functions will behave. If \`rtl\` is set to \`true\`, they will be inverted.
|
|
226
|
+
|
|
227
|
+
This only affects the composite widget behavior. You still need to set \`dir="rtl"\` on HTML/CSS.`,
|
|
228
|
+
table: {
|
|
229
|
+
defaultValue: {
|
|
230
|
+
summary: 'false',
|
|
231
|
+
},
|
|
232
|
+
type: {
|
|
233
|
+
summary: 'boolean',
|
|
234
|
+
},
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
Composite: {
|
|
239
|
+
...commonArgTypes,
|
|
240
|
+
store: {
|
|
241
|
+
name: 'store',
|
|
242
|
+
description:
|
|
243
|
+
'Object returned by the `useCompositeStore` hook.',
|
|
244
|
+
table: {
|
|
245
|
+
type: {
|
|
246
|
+
summary:
|
|
247
|
+
'CompositeStore<CompositeStoreItem>',
|
|
248
|
+
},
|
|
249
|
+
},
|
|
250
|
+
type: { required: true },
|
|
251
|
+
},
|
|
252
|
+
focusable: {
|
|
253
|
+
name: 'focusable',
|
|
254
|
+
description: `Makes the component a focusable element. When this element gains keyboard focus, it gets a \`data-focus-visible\` attribute and triggers the \`onFocusVisible\` prop.
|
|
255
|
+
|
|
256
|
+
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.
|
|
257
|
+
|
|
258
|
+
Non-native focusable elements will lose their focusability entirely. However, native focusable elements will retain their inherent focusability.`,
|
|
259
|
+
table: {
|
|
260
|
+
type: {
|
|
261
|
+
summary: 'boolean',
|
|
262
|
+
},
|
|
263
|
+
},
|
|
264
|
+
},
|
|
265
|
+
disabled: {
|
|
266
|
+
name: 'disabled',
|
|
267
|
+
description: `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.
|
|
268
|
+
|
|
269
|
+
This feature can be combined with the \`accessibleWhenDisabled\` prop to
|
|
270
|
+
make disabled elements still accessible via keyboard.
|
|
271
|
+
|
|
272
|
+
**Note**: For this prop to work, the \`focusable\` prop must be set to
|
|
273
|
+
\`true\`, if it's not set by default.`,
|
|
274
|
+
table: {
|
|
275
|
+
defaultValue: {
|
|
276
|
+
summary: 'false',
|
|
277
|
+
},
|
|
278
|
+
type: {
|
|
279
|
+
summary: 'boolean',
|
|
280
|
+
},
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
accessibleWhenDisabled,
|
|
284
|
+
onFocusVisible: {
|
|
285
|
+
name: 'onFocusVisible',
|
|
286
|
+
description: `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.
|
|
287
|
+
|
|
288
|
+
**Note**: For this prop to work, the \`focusable\` prop must be set to \`true\` if it's not set by default.`,
|
|
289
|
+
table: {
|
|
290
|
+
type: {
|
|
291
|
+
summary:
|
|
292
|
+
'(event: SyntheticEvent<HTMLElement>) => void',
|
|
293
|
+
},
|
|
294
|
+
},
|
|
295
|
+
},
|
|
296
|
+
},
|
|
297
|
+
'Composite.Group': commonArgTypes,
|
|
298
|
+
'Composite.GroupLabel': commonArgTypes,
|
|
299
|
+
'Composite.Row': commonArgTypes,
|
|
300
|
+
'Composite.Item': {
|
|
301
|
+
...commonArgTypes,
|
|
302
|
+
accessibleWhenDisabled,
|
|
303
|
+
},
|
|
304
|
+
'Composite.Hover': commonArgTypes,
|
|
305
|
+
'Composite.Typeahead': commonArgTypes,
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
const name = component.displayName ?? '';
|
|
309
|
+
|
|
310
|
+
return name in argTypes
|
|
311
|
+
? argTypes[ name as keyof typeof argTypes ]
|
|
312
|
+
: {};
|
|
313
|
+
},
|
|
314
|
+
},
|
|
315
|
+
},
|
|
316
|
+
decorators: [
|
|
317
|
+
( Story ) => {
|
|
318
|
+
return (
|
|
319
|
+
<>
|
|
320
|
+
{ /* Visually style the active composite item */ }
|
|
321
|
+
<style>{ `
|
|
322
|
+
[data-active-item] {
|
|
323
|
+
background-color: #ffc0b5;
|
|
324
|
+
}
|
|
325
|
+
` }</style>
|
|
326
|
+
<Story />
|
|
327
|
+
<div
|
|
328
|
+
style={ {
|
|
329
|
+
marginTop: '2em',
|
|
330
|
+
fontSize: '12px',
|
|
331
|
+
fontStyle: 'italic',
|
|
332
|
+
} }
|
|
333
|
+
>
|
|
334
|
+
{ /* eslint-disable-next-line no-restricted-syntax */ }
|
|
335
|
+
<p id="list-title">Notes</p>
|
|
336
|
+
<ul aria-labelledby="list-title">
|
|
337
|
+
<li>
|
|
338
|
+
The active composite item is highlighted with a
|
|
339
|
+
different background color;
|
|
340
|
+
</li>
|
|
341
|
+
<li>
|
|
342
|
+
A composite item can be the active item even
|
|
343
|
+
when it doesn't have keyboard focus.
|
|
344
|
+
</li>
|
|
345
|
+
</ul>
|
|
346
|
+
</div>
|
|
347
|
+
</>
|
|
348
|
+
);
|
|
349
|
+
},
|
|
350
|
+
],
|
|
351
|
+
};
|
|
352
|
+
export default meta;
|
|
353
|
+
|
|
354
|
+
export const Default: StoryFn< typeof UseCompositeStorePlaceholder > = (
|
|
355
|
+
storeProps
|
|
356
|
+
) => {
|
|
357
|
+
const rtl = isRTL();
|
|
358
|
+
const store = useCompositeStore( { rtl, ...storeProps } );
|
|
359
|
+
|
|
360
|
+
return (
|
|
361
|
+
<Composite store={ store }>
|
|
362
|
+
<Composite.Item>Item one</Composite.Item>
|
|
363
|
+
<Composite.Item>Item two</Composite.Item>
|
|
364
|
+
<Composite.Item>Item three</Composite.Item>
|
|
365
|
+
</Composite>
|
|
366
|
+
);
|
|
367
|
+
};
|
|
368
|
+
|
|
369
|
+
export const Groups: StoryFn< typeof UseCompositeStorePlaceholder > = (
|
|
370
|
+
storeProps
|
|
371
|
+
) => {
|
|
372
|
+
const rtl = isRTL();
|
|
373
|
+
const store = useCompositeStore( { rtl, ...storeProps } );
|
|
374
|
+
|
|
375
|
+
return (
|
|
376
|
+
<Composite store={ store }>
|
|
377
|
+
<Composite.Group>
|
|
378
|
+
<Composite.GroupLabel>Group one</Composite.GroupLabel>
|
|
379
|
+
<Composite.Item>Item 1.1</Composite.Item>
|
|
380
|
+
<Composite.Item>Item 1.2</Composite.Item>
|
|
381
|
+
</Composite.Group>
|
|
382
|
+
<Composite.Group>
|
|
383
|
+
<Composite.GroupLabel>Group two</Composite.GroupLabel>
|
|
384
|
+
<Composite.Item>Item 2.1</Composite.Item>
|
|
385
|
+
<Composite.Item>Item 2.1</Composite.Item>
|
|
386
|
+
</Composite.Group>
|
|
387
|
+
</Composite>
|
|
388
|
+
);
|
|
389
|
+
};
|
|
390
|
+
|
|
391
|
+
export const Grid: StoryFn< typeof UseCompositeStorePlaceholder > = (
|
|
392
|
+
storeProps
|
|
393
|
+
) => {
|
|
394
|
+
const rtl = isRTL();
|
|
395
|
+
const store = useCompositeStore( { rtl, ...storeProps } );
|
|
396
|
+
|
|
397
|
+
return (
|
|
398
|
+
<Composite role="grid" store={ store } aria-label="Composite">
|
|
399
|
+
<Composite.Row role="row">
|
|
400
|
+
<Composite.Item role="gridcell">Item A1</Composite.Item>
|
|
401
|
+
<Composite.Item role="gridcell">Item A2</Composite.Item>
|
|
402
|
+
<Composite.Item role="gridcell">Item A3</Composite.Item>
|
|
403
|
+
</Composite.Row>
|
|
404
|
+
<Composite.Row role="row">
|
|
405
|
+
<Composite.Item role="gridcell">Item B1</Composite.Item>
|
|
406
|
+
<Composite.Item role="gridcell">Item B2</Composite.Item>
|
|
407
|
+
<Composite.Item role="gridcell">Item B3</Composite.Item>
|
|
408
|
+
</Composite.Row>
|
|
409
|
+
<Composite.Row role="row">
|
|
410
|
+
<Composite.Item role="gridcell">Item C1</Composite.Item>
|
|
411
|
+
<Composite.Item role="gridcell">Item C2</Composite.Item>
|
|
412
|
+
<Composite.Item role="gridcell">Item C3</Composite.Item>
|
|
413
|
+
</Composite.Row>
|
|
414
|
+
</Composite>
|
|
415
|
+
);
|
|
416
|
+
};
|
|
417
|
+
|
|
418
|
+
export const Hover: StoryFn< typeof UseCompositeStorePlaceholder > = (
|
|
419
|
+
storeProps
|
|
420
|
+
) => {
|
|
421
|
+
const rtl = isRTL();
|
|
422
|
+
const store = useCompositeStore( { rtl, ...storeProps } );
|
|
423
|
+
|
|
424
|
+
return (
|
|
425
|
+
<Composite store={ store }>
|
|
426
|
+
<Composite.Hover render={ <Composite.Item /> }>
|
|
427
|
+
Hover item one
|
|
428
|
+
</Composite.Hover>
|
|
429
|
+
<Composite.Hover render={ <Composite.Item /> }>
|
|
430
|
+
Hover item two
|
|
431
|
+
</Composite.Hover>
|
|
432
|
+
<Composite.Hover render={ <Composite.Item /> }>
|
|
433
|
+
Hover item three
|
|
434
|
+
</Composite.Hover>
|
|
435
|
+
</Composite>
|
|
436
|
+
);
|
|
437
|
+
};
|
|
438
|
+
Hover.parameters = {
|
|
439
|
+
docs: {
|
|
440
|
+
description: {
|
|
441
|
+
story: 'Elements in the composite widget will receive focus on mouse move and lose focus to the composite base element on mouse leave.',
|
|
442
|
+
},
|
|
443
|
+
},
|
|
444
|
+
};
|
|
445
|
+
|
|
446
|
+
export const Typeahead: StoryFn< typeof UseCompositeStorePlaceholder > = (
|
|
447
|
+
storeProps
|
|
448
|
+
) => {
|
|
449
|
+
const rtl = isRTL();
|
|
450
|
+
const store = useCompositeStore( { rtl, ...storeProps } );
|
|
451
|
+
|
|
452
|
+
return (
|
|
453
|
+
<Composite store={ store } render={ <Composite.Typeahead /> }>
|
|
454
|
+
<Composite.Item>Apple</Composite.Item>
|
|
455
|
+
<Composite.Item>Banana</Composite.Item>
|
|
456
|
+
<Composite.Item>Peach</Composite.Item>
|
|
457
|
+
</Composite>
|
|
458
|
+
);
|
|
459
|
+
};
|
|
460
|
+
Typeahead.parameters = {
|
|
461
|
+
docs: {
|
|
462
|
+
description: {
|
|
463
|
+
story: 'When focus in on the composite widget, hitting printable character keys will move focus to the next composite item that begins with the input characters.',
|
|
464
|
+
},
|
|
465
|
+
},
|
|
466
|
+
};
|
|
@@ -6,8 +6,23 @@ import type { StoryContext } from '@storybook/react';
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
8
8
|
*/
|
|
9
|
-
import type { CompositeStoreProps } from '
|
|
9
|
+
import type { CompositeStoreProps } from '../types';
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Renders a widget based on the WAI-ARIA [`composite`](https://w3c.github.io/aria/#composite)
|
|
13
|
+
* role, which provides a single tab stop on the page and arrow key navigation
|
|
14
|
+
* through the focusable descendants.
|
|
15
|
+
*
|
|
16
|
+
* ```jsx
|
|
17
|
+
* import { Composite, useCompositeStore } from '@wordpress/components';
|
|
18
|
+
*
|
|
19
|
+
* const store = useCompositeStore();
|
|
20
|
+
* <Composite store={ store }>
|
|
21
|
+
* <Composite.Item>Item 1</Composite.Item>
|
|
22
|
+
* <Composite.Item>Item 2</Composite.Item>
|
|
23
|
+
* </Composite>
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
11
26
|
export function UseCompositeStorePlaceholder( props: CompositeStoreProps ) {
|
|
12
27
|
return (
|
|
13
28
|
<dl>
|
|
@@ -22,17 +37,17 @@ export function UseCompositeStorePlaceholder( props: CompositeStoreProps ) {
|
|
|
22
37
|
}
|
|
23
38
|
UseCompositeStorePlaceholder.displayName = 'useCompositeStore';
|
|
24
39
|
|
|
40
|
+
// The output generated by Storybook for these components is
|
|
41
|
+
// messy, so we apply this transform to make it more useful
|
|
42
|
+
// for anyone reading the docs.
|
|
25
43
|
export function transform( code: string, context: StoryContext ) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
// for anyone reading the docs.
|
|
29
|
-
const config = ` ${ JSON.stringify( context.args, null, 2 ) } `;
|
|
30
|
-
const state = config.replace( ' {} ', '' );
|
|
44
|
+
const storeConfig = ` ${ JSON.stringify( context.args, null, 2 ) } `;
|
|
45
|
+
const formattedStoreConfig = storeConfig.replace( ' {} ', '' );
|
|
31
46
|
return [
|
|
32
47
|
// Include a setup line, showing how to make use of
|
|
33
48
|
// `useCompositeStore` to convert store options into
|
|
34
49
|
// a composite store prop.
|
|
35
|
-
`const store = useCompositeStore(${
|
|
50
|
+
`const store = useCompositeStore(${ formattedStoreConfig });`,
|
|
36
51
|
'',
|
|
37
52
|
'return (',
|
|
38
53
|
' ' +
|