@wordpress/components 23.1.0 → 23.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +53 -0
- package/CONTRIBUTING.md +1 -1
- package/LICENSE.md +1 -1
- package/build/alignment-matrix-control/utils.js +2 -2
- package/build/alignment-matrix-control/utils.js.map +1 -1
- package/build/autocomplete/autocompleter-ui.js +1 -3
- package/build/autocomplete/autocompleter-ui.js.map +1 -1
- package/build/border-box-control/border-box-control-linked-button/component.js.map +1 -1
- package/build/border-box-control/border-box-control-linked-button/hook.js.map +1 -1
- package/build/border-control/border-control-dropdown/component.js +8 -4
- package/build/border-control/border-control-dropdown/component.js.map +1 -1
- package/build/button/deprecated.js +8 -6
- package/build/button/deprecated.js.map +1 -1
- package/build/button/index.js +52 -23
- package/build/button/index.js.map +1 -1
- package/build/button/types.js +6 -0
- package/build/button/types.js.map +1 -0
- package/build/color-list-picker/index.js.map +1 -1
- package/build/color-list-picker/types.js +6 -0
- package/build/color-list-picker/types.js.map +1 -0
- package/build/color-palette/index.js +9 -61
- package/build/color-palette/index.js.map +1 -1
- package/build/color-palette/index.native.js +24 -9
- package/build/color-palette/index.native.js.map +1 -1
- package/build/color-palette/utils.js +103 -0
- package/build/color-palette/utils.js.map +1 -0
- package/build/color-picker/component.js +1 -0
- package/build/color-picker/component.js.map +1 -1
- package/build/color-picker/styles.js +8 -10
- package/build/color-picker/styles.js.map +1 -1
- package/build/combobox-control/index.js +5 -1
- package/build/combobox-control/index.js.map +1 -1
- package/build/custom-gradient-picker/gradient-bar/utils.js +1 -1
- package/build/custom-gradient-picker/gradient-bar/utils.js.map +1 -1
- package/build/date-time/date/index.js.map +1 -1
- package/build/dropdown/index.js +20 -8
- package/build/dropdown/index.js.map +1 -1
- package/build/focal-point-picker/utils.js +1 -1
- package/build/focal-point-picker/utils.js.map +1 -1
- package/build/form-token-field/token.js +1 -1
- package/build/form-token-field/token.js.map +1 -1
- package/build/gradient-picker/index.js +9 -1
- package/build/gradient-picker/index.js.map +1 -1
- package/build/h-stack/component.js +0 -1
- package/build/h-stack/component.js.map +1 -1
- package/build/index.js +7 -17
- package/build/index.js.map +1 -1
- package/build/index.native.js +8 -18
- package/build/index.native.js.map +1 -1
- package/build/input-control/input-field.js +4 -2
- package/build/input-control/input-field.js.map +1 -1
- package/build/item-group/item/component.js +27 -3
- package/build/item-group/item/component.js.map +1 -1
- package/build/item-group/item-group/component.js +26 -3
- package/build/item-group/item-group/component.js.map +1 -1
- package/build/item-group/styles.js +14 -14
- package/build/item-group/styles.js.map +1 -1
- package/build/keyboard-shortcuts/index.js +44 -16
- package/build/keyboard-shortcuts/index.js.map +1 -1
- package/build/keyboard-shortcuts/types.js +6 -0
- package/build/keyboard-shortcuts/types.js.map +1 -0
- package/build/modal/index.js +1 -1
- package/build/modal/index.js.map +1 -1
- package/build/notice/index.js +16 -18
- package/build/notice/index.js.map +1 -1
- package/build/notice/list.js +23 -8
- package/build/notice/list.js.map +1 -1
- package/build/notice/types.js +6 -0
- package/build/notice/types.js.map +1 -0
- package/build/number-control/index.js +1 -1
- package/build/number-control/index.js.map +1 -1
- package/build/panel/row.js +5 -3
- package/build/panel/row.js.map +1 -1
- package/build/query-controls/author-select.js +7 -3
- package/build/query-controls/author-select.js.map +1 -1
- package/build/query-controls/category-select.js +7 -3
- package/build/query-controls/category-select.js.map +1 -1
- package/build/query-controls/index.js +69 -20
- package/build/query-controls/index.js.map +1 -1
- package/build/query-controls/terms.js +4 -3
- package/build/query-controls/terms.js.map +1 -1
- package/build/query-controls/types.js +6 -0
- package/build/query-controls/types.js.map +1 -0
- package/build/resizable-box/index.js +5 -4
- package/build/resizable-box/index.js.map +1 -1
- package/build/responsive-wrapper/index.js +18 -1
- package/build/responsive-wrapper/index.js.map +1 -1
- package/build/responsive-wrapper/types.js +6 -0
- package/build/responsive-wrapper/types.js.map +1 -0
- package/build/sandbox/index.js +35 -24
- package/build/sandbox/index.js.map +1 -1
- package/build/sandbox/types.js +6 -0
- package/build/sandbox/types.js.map +1 -0
- package/build/slot-fill/bubbles-virtually/fill.js +1 -0
- package/build/slot-fill/bubbles-virtually/fill.js.map +1 -1
- package/build/slot-fill/slot.js +1 -0
- package/build/slot-fill/slot.js.map +1 -1
- package/build/slot-fill/use-slot.js +1 -11
- package/build/slot-fill/use-slot.js.map +1 -1
- package/build/snackbar/index.js.map +1 -1
- package/build/snackbar/list.js.map +1 -1
- package/build/tab-panel/index.js +40 -7
- package/build/tab-panel/index.js.map +1 -1
- package/build/toolbar/index.js +42 -60
- package/build/toolbar/index.js.map +1 -1
- package/build/toolbar/toolbar/index.js +74 -0
- package/build/toolbar/toolbar/index.js.map +1 -0
- package/build/toolbar/{toolbar-container.js → toolbar/toolbar-container.js} +0 -0
- package/build/toolbar/toolbar/toolbar-container.js.map +1 -0
- package/build/toolbar/{toolbar-container.native.js → toolbar/toolbar-container.native.js} +0 -0
- package/build/toolbar/toolbar/toolbar-container.native.js.map +1 -0
- package/build/{toolbar-button → toolbar/toolbar-button}/index.js +1 -1
- package/build/toolbar/toolbar-button/index.js.map +1 -0
- package/build/{toolbar-button → toolbar/toolbar-button}/toolbar-button-container.js +0 -0
- package/build/toolbar/toolbar-button/toolbar-button-container.js.map +1 -0
- package/build/{toolbar-button → toolbar/toolbar-button}/toolbar-button-container.native.js +0 -0
- package/build/toolbar/toolbar-button/toolbar-button-container.native.js.map +1 -0
- package/build/{toolbar-context → toolbar/toolbar-context}/index.js +0 -0
- package/build/toolbar/toolbar-context/index.js.map +1 -0
- package/build/{toolbar-dropdown-menu → toolbar/toolbar-dropdown-menu}/index.js +1 -1
- package/build/toolbar/toolbar-dropdown-menu/index.js.map +1 -0
- package/build/{toolbar-group → toolbar/toolbar-group}/index.js +0 -0
- package/build/toolbar/toolbar-group/index.js.map +1 -0
- package/build/{toolbar-group → toolbar/toolbar-group}/toolbar-group-collapsed.js +1 -1
- package/build/toolbar/toolbar-group/toolbar-group-collapsed.js.map +1 -0
- package/build/{toolbar-group → toolbar/toolbar-group}/toolbar-group-collapsed.native.js +1 -1
- package/build/toolbar/toolbar-group/toolbar-group-collapsed.native.js.map +1 -0
- package/build/{toolbar-group → toolbar/toolbar-group}/toolbar-group-container.js +0 -0
- package/build/toolbar/toolbar-group/toolbar-group-container.js.map +1 -0
- package/build/{toolbar-group → toolbar/toolbar-group}/toolbar-group-container.native.js +0 -0
- package/build/toolbar/toolbar-group/toolbar-group-container.native.js.map +1 -0
- package/build/{toolbar-item → toolbar/toolbar-item}/index.js +0 -0
- package/build/toolbar/toolbar-item/index.js.map +1 -0
- package/build/{toolbar-item → toolbar/toolbar-item}/index.native.js +0 -0
- package/build/toolbar/toolbar-item/index.native.js.map +1 -0
- package/build/tree-grid/index.js +4 -4
- package/build/tree-grid/index.js.map +1 -1
- package/build/tree-select/index.js +2 -6
- package/build/tree-select/index.js.map +1 -1
- package/build-module/alignment-matrix-control/utils.js +2 -2
- package/build-module/alignment-matrix-control/utils.js.map +1 -1
- package/build-module/autocomplete/autocompleter-ui.js +1 -2
- package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
- package/build-module/border-box-control/border-box-control-linked-button/component.js.map +1 -1
- package/build-module/border-box-control/border-box-control-linked-button/hook.js.map +1 -1
- package/build-module/border-control/border-control-dropdown/component.js +7 -4
- package/build-module/border-control/border-control-dropdown/component.js.map +1 -1
- package/build-module/button/deprecated.js +8 -5
- package/build-module/button/deprecated.js.map +1 -1
- package/build-module/button/index.js +51 -22
- package/build-module/button/index.js.map +1 -1
- package/build-module/button/types.js +2 -0
- package/build-module/button/types.js.map +1 -0
- package/build-module/color-list-picker/index.js.map +1 -1
- package/build-module/color-list-picker/types.js +2 -0
- package/build-module/color-list-picker/types.js.map +1 -0
- package/build-module/color-palette/index.js +7 -54
- package/build-module/color-palette/index.js.map +1 -1
- package/build-module/color-palette/index.native.js +24 -8
- package/build-module/color-palette/index.native.js.map +1 -1
- package/build-module/color-palette/utils.js +79 -0
- package/build-module/color-palette/utils.js.map +1 -0
- package/build-module/color-picker/component.js +1 -0
- package/build-module/color-picker/component.js.map +1 -1
- package/build-module/color-picker/styles.js +8 -9
- package/build-module/color-picker/styles.js.map +1 -1
- package/build-module/combobox-control/index.js +5 -1
- package/build-module/combobox-control/index.js.map +1 -1
- package/build-module/custom-gradient-picker/gradient-bar/utils.js +1 -1
- package/build-module/custom-gradient-picker/gradient-bar/utils.js.map +1 -1
- package/build-module/date-time/date/index.js +1 -1
- package/build-module/date-time/date/index.js.map +1 -1
- package/build-module/dropdown/index.js +19 -8
- package/build-module/dropdown/index.js.map +1 -1
- package/build-module/focal-point-picker/utils.js +1 -1
- package/build-module/focal-point-picker/utils.js.map +1 -1
- package/build-module/form-token-field/token.js +1 -1
- package/build-module/form-token-field/token.js.map +1 -1
- package/build-module/gradient-picker/index.js +9 -2
- package/build-module/gradient-picker/index.js.map +1 -1
- package/build-module/h-stack/component.js +0 -1
- package/build-module/h-stack/component.js.map +1 -1
- package/build-module/index.js +1 -6
- package/build-module/index.js.map +1 -1
- package/build-module/index.native.js +1 -6
- package/build-module/index.native.js.map +1 -1
- package/build-module/input-control/input-field.js +4 -2
- package/build-module/input-control/input-field.js.map +1 -1
- package/build-module/item-group/item/component.js +26 -2
- package/build-module/item-group/item/component.js.map +1 -1
- package/build-module/item-group/item-group/component.js +25 -2
- package/build-module/item-group/item-group/component.js.map +1 -1
- package/build-module/item-group/styles.js +14 -14
- package/build-module/item-group/styles.js.map +1 -1
- package/build-module/keyboard-shortcuts/index.js +48 -16
- package/build-module/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/keyboard-shortcuts/types.js +2 -0
- package/build-module/keyboard-shortcuts/types.js.map +1 -0
- package/build-module/modal/index.js +1 -1
- package/build-module/modal/index.js.map +1 -1
- package/build-module/notice/index.js +14 -15
- package/build-module/notice/index.js.map +1 -1
- package/build-module/notice/list.js +23 -8
- package/build-module/notice/list.js.map +1 -1
- package/build-module/notice/types.js +2 -0
- package/build-module/notice/types.js.map +1 -0
- package/build-module/number-control/index.js +1 -1
- package/build-module/number-control/index.js.map +1 -1
- package/build-module/panel/row.js +5 -3
- package/build-module/panel/row.js.map +1 -1
- package/build-module/query-controls/author-select.js +7 -3
- package/build-module/query-controls/author-select.js.map +1 -1
- package/build-module/query-controls/category-select.js +8 -4
- package/build-module/query-controls/category-select.js.map +1 -1
- package/build-module/query-controls/index.js +65 -20
- package/build-module/query-controls/index.js.map +1 -1
- package/build-module/query-controls/terms.js +8 -4
- package/build-module/query-controls/terms.js.map +1 -1
- package/build-module/query-controls/types.js +2 -0
- package/build-module/query-controls/types.js.map +1 -0
- package/build-module/resizable-box/index.js +3 -2
- package/build-module/resizable-box/index.js.map +1 -1
- package/build-module/responsive-wrapper/index.js +20 -1
- package/build-module/responsive-wrapper/index.js.map +1 -1
- package/build-module/responsive-wrapper/types.js +2 -0
- package/build-module/responsive-wrapper/types.js.map +1 -0
- package/build-module/sandbox/index.js +37 -23
- package/build-module/sandbox/index.js.map +1 -1
- package/build-module/sandbox/types.js +2 -0
- package/build-module/sandbox/types.js.map +1 -0
- package/build-module/slot-fill/bubbles-virtually/fill.js +1 -0
- package/build-module/slot-fill/bubbles-virtually/fill.js.map +1 -1
- package/build-module/slot-fill/slot.js +1 -0
- package/build-module/slot-fill/slot.js.map +1 -1
- package/build-module/slot-fill/use-slot.js +2 -12
- package/build-module/slot-fill/use-slot.js.map +1 -1
- package/build-module/snackbar/index.js.map +1 -1
- package/build-module/snackbar/list.js.map +1 -1
- package/build-module/tab-panel/index.js +40 -7
- package/build-module/tab-panel/index.js.map +1 -1
- package/build-module/toolbar/index.js +6 -58
- package/build-module/toolbar/index.js.map +1 -1
- package/build-module/toolbar/toolbar/index.js +59 -0
- package/build-module/toolbar/toolbar/index.js.map +1 -0
- package/build-module/toolbar/{toolbar-container.js → toolbar/toolbar-container.js} +0 -0
- package/{build → build-module/toolbar}/toolbar/toolbar-container.js.map +1 -1
- package/build-module/toolbar/{toolbar-container.native.js → toolbar/toolbar-container.native.js} +0 -0
- package/build-module/toolbar/toolbar/toolbar-container.native.js.map +1 -0
- package/build-module/{toolbar-button → toolbar/toolbar-button}/index.js +1 -1
- package/build-module/toolbar/toolbar-button/index.js.map +1 -0
- package/build-module/{toolbar-button → toolbar/toolbar-button}/toolbar-button-container.js +0 -0
- package/build-module/toolbar/toolbar-button/toolbar-button-container.js.map +1 -0
- package/build-module/{toolbar-button → toolbar/toolbar-button}/toolbar-button-container.native.js +0 -0
- package/build-module/toolbar/toolbar-button/toolbar-button-container.native.js.map +1 -0
- package/build-module/{toolbar-context → toolbar/toolbar-context}/index.js +0 -0
- package/build-module/toolbar/toolbar-context/index.js.map +1 -0
- package/build-module/{toolbar-dropdown-menu → toolbar/toolbar-dropdown-menu}/index.js +1 -1
- package/build-module/toolbar/toolbar-dropdown-menu/index.js.map +1 -0
- package/build-module/{toolbar-group → toolbar/toolbar-group}/index.js +0 -0
- package/build-module/toolbar/toolbar-group/index.js.map +1 -0
- package/build-module/{toolbar-group → toolbar/toolbar-group}/toolbar-group-collapsed.js +1 -1
- package/build-module/toolbar/toolbar-group/toolbar-group-collapsed.js.map +1 -0
- package/build-module/{toolbar-group → toolbar/toolbar-group}/toolbar-group-collapsed.native.js +1 -1
- package/build-module/toolbar/toolbar-group/toolbar-group-collapsed.native.js.map +1 -0
- package/build-module/{toolbar-group → toolbar/toolbar-group}/toolbar-group-container.js +0 -0
- package/build-module/toolbar/toolbar-group/toolbar-group-container.js.map +1 -0
- package/build-module/{toolbar-group → toolbar/toolbar-group}/toolbar-group-container.native.js +0 -0
- package/build-module/toolbar/toolbar-group/toolbar-group-container.native.js.map +1 -0
- package/build-module/{toolbar-item → toolbar/toolbar-item}/index.js +0 -0
- package/build-module/toolbar/toolbar-item/index.js.map +1 -0
- package/build-module/{toolbar-item → toolbar/toolbar-item}/index.native.js +0 -0
- package/build-module/toolbar/toolbar-item/index.native.js.map +1 -0
- package/build-module/tree-grid/index.js +4 -4
- package/build-module/tree-grid/index.js.map +1 -1
- package/build-module/tree-select/index.js +2 -6
- package/build-module/tree-select/index.js.map +1 -1
- package/build-style/style-rtl.css +6 -1
- package/build-style/style.css +6 -1
- package/build-types/border-box-control/border-box-control/hook.d.ts +1 -1
- package/build-types/border-box-control/border-box-control-linked-button/component.d.ts +1 -1
- package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts +171 -160
- package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +1 -1
- package/build-types/border-control/border-control/hook.d.ts +1 -1
- package/build-types/border-control/border-control-dropdown/component.d.ts.map +1 -1
- package/build-types/border-control/border-control-dropdown/hook.d.ts +1 -1
- package/build-types/button/deprecated.d.ts +143 -7
- package/build-types/button/deprecated.d.ts.map +1 -1
- package/build-types/button/index.d.ts +20 -3
- package/build-types/button/index.d.ts.map +1 -1
- package/build-types/button/stories/index.d.ts +20 -0
- package/build-types/button/stories/index.d.ts.map +1 -0
- package/build-types/button/test/index.d.ts +2 -0
- package/build-types/button/test/index.d.ts.map +1 -0
- package/build-types/button/types.d.ts +134 -0
- package/build-types/button/types.d.ts.map +1 -0
- package/build-types/color-list-picker/index.d.ts +5 -0
- package/build-types/color-list-picker/index.d.ts.map +1 -0
- package/build-types/color-list-picker/types.d.ts +42 -0
- package/build-types/color-list-picker/types.d.ts.map +1 -0
- package/build-types/color-palette/index.d.ts +2 -4
- package/build-types/color-palette/index.d.ts.map +1 -1
- package/build-types/color-palette/stories/index.d.ts +2 -2
- package/build-types/color-palette/styles.d.ts +1 -1
- package/build-types/color-palette/types.d.ts +1 -1
- package/build-types/color-palette/types.d.ts.map +1 -1
- package/build-types/color-palette/utils.d.ts +14 -0
- package/build-types/color-palette/utils.d.ts.map +1 -0
- package/build-types/color-picker/component.d.ts.map +1 -1
- package/build-types/color-picker/styles.d.ts +2 -2
- package/build-types/color-picker/styles.d.ts.map +1 -1
- package/build-types/dashicon/types.d.ts +0 -4
- package/build-types/dashicon/types.d.ts.map +1 -1
- package/build-types/date-time/date/index.d.ts.map +1 -1
- package/build-types/date-time/date/styles.d.ts +3 -3
- package/build-types/dropdown/index.d.ts +4 -4
- package/build-types/dropdown/index.d.ts.map +1 -1
- package/build-types/dropdown/stories/index.d.ts.map +1 -1
- package/build-types/dropdown/types.d.ts +9 -10
- package/build-types/dropdown/types.d.ts.map +1 -1
- package/build-types/focal-point-picker/utils.d.ts.map +1 -1
- package/build-types/font-size-picker/styles.d.ts +2 -2
- package/build-types/h-stack/component.d.ts +0 -1
- package/build-types/h-stack/component.d.ts.map +1 -1
- package/build-types/input-control/input-field.d.ts.map +1 -1
- package/build-types/item-group/item/component.d.ts +24 -2
- package/build-types/item-group/item/component.d.ts.map +1 -1
- package/build-types/item-group/item-group/component.d.ts +23 -2
- package/build-types/item-group/item-group/component.d.ts.map +1 -1
- package/build-types/item-group/stories/index.d.ts +15 -0
- package/build-types/item-group/stories/index.d.ts.map +1 -0
- package/build-types/item-group/styles.d.ts.map +1 -1
- package/build-types/keyboard-shortcuts/index.d.ts +38 -0
- package/build-types/keyboard-shortcuts/index.d.ts.map +1 -0
- package/build-types/keyboard-shortcuts/stories/index.d.ts +12 -0
- package/build-types/keyboard-shortcuts/stories/index.d.ts.map +1 -0
- package/build-types/keyboard-shortcuts/test/index.d.ts +2 -0
- package/build-types/keyboard-shortcuts/test/index.d.ts.map +1 -0
- package/build-types/keyboard-shortcuts/types.d.ts +48 -0
- package/build-types/keyboard-shortcuts/types.d.ts.map +1 -0
- package/build-types/modal/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-button/component.d.ts +1 -1
- package/build-types/navigator/navigator-button/hook.d.ts +2 -2
- package/build-types/notice/index.d.ts +16 -0
- package/build-types/notice/index.d.ts.map +1 -0
- package/build-types/notice/list.d.ts +32 -0
- package/build-types/notice/list.d.ts.map +1 -0
- package/build-types/notice/stories/index.d.ts +17 -0
- package/build-types/notice/stories/index.d.ts.map +1 -0
- package/build-types/notice/test/index.d.ts +2 -0
- package/build-types/notice/test/index.d.ts.map +1 -0
- package/build-types/notice/test/list.d.ts +2 -0
- package/build-types/notice/test/list.d.ts.map +1 -0
- package/build-types/notice/types.d.ts +128 -0
- package/build-types/notice/types.d.ts.map +1 -0
- package/build-types/number-control/styles/number-control-styles.d.ts +2 -2
- package/build-types/number-control/styles/number-control-styles.d.ts.map +1 -1
- package/build-types/placeholder/stories/index.d.ts.map +1 -1
- package/build-types/query-controls/author-select.d.ts +4 -0
- package/build-types/query-controls/author-select.d.ts.map +1 -0
- package/build-types/query-controls/category-select.d.ts +4 -0
- package/build-types/query-controls/category-select.d.ts.map +1 -0
- package/build-types/query-controls/index.d.ts +30 -0
- package/build-types/query-controls/index.d.ts.map +1 -0
- package/build-types/query-controls/stories/index.d.ts +13 -0
- package/build-types/query-controls/stories/index.d.ts.map +1 -0
- package/build-types/query-controls/terms.d.ts +13 -0
- package/build-types/query-controls/terms.d.ts.map +1 -0
- package/build-types/query-controls/test/terms.d.ts +2 -0
- package/build-types/query-controls/test/terms.d.ts.map +1 -0
- package/build-types/query-controls/types.d.ts +131 -0
- package/build-types/query-controls/types.d.ts.map +1 -0
- package/build-types/range-control/index.d.ts +1 -1
- package/build-types/resizable-box/index.d.ts +6 -7
- package/build-types/resizable-box/index.d.ts.map +1 -1
- package/build-types/resizable-box/stories/index.d.ts +61 -0
- package/build-types/resizable-box/stories/index.d.ts.map +1 -0
- package/build-types/responsive-wrapper/index.d.ts +24 -0
- package/build-types/responsive-wrapper/index.d.ts.map +1 -0
- package/build-types/responsive-wrapper/stories/index.d.ts +12 -0
- package/build-types/responsive-wrapper/stories/index.d.ts.map +1 -0
- package/build-types/responsive-wrapper/types.d.ts +22 -0
- package/build-types/responsive-wrapper/types.d.ts.map +1 -0
- package/build-types/sandbox/index.d.ts +19 -0
- package/build-types/sandbox/index.d.ts.map +1 -0
- package/build-types/sandbox/stories/index.d.ts +12 -0
- package/build-types/sandbox/stories/index.d.ts.map +1 -0
- package/build-types/sandbox/test/index.d.ts +2 -0
- package/build-types/sandbox/test/index.d.ts.map +1 -0
- package/build-types/sandbox/types.d.ts +36 -0
- package/build-types/sandbox/types.d.ts.map +1 -0
- package/build-types/slot-fill/bubbles-virtually/fill.d.ts.map +1 -1
- package/build-types/slot-fill/use-slot.d.ts.map +1 -1
- package/build-types/snackbar/index.d.ts +9 -2
- package/build-types/snackbar/index.d.ts.map +1 -1
- package/build-types/snackbar/list.d.ts.map +1 -1
- package/build-types/snackbar/types.d.ts +15 -88
- package/build-types/snackbar/types.d.ts.map +1 -1
- package/build-types/tab-panel/index.d.ts.map +1 -1
- package/build-types/tab-panel/stories/index.d.ts +1 -0
- package/build-types/tab-panel/stories/index.d.ts.map +1 -1
- package/build-types/tab-panel/types.d.ts +11 -5
- package/build-types/tab-panel/types.d.ts.map +1 -1
- package/build-types/toggle-group-control/stories/index.d.ts.map +1 -1
- package/build-types/tree-select/index.d.ts.map +1 -1
- package/build-types/ui/form-group/form-group.d.ts +2 -2
- package/package.json +18 -17
- package/src/alignment-matrix-control/utils.tsx +2 -2
- package/src/autocomplete/autocompleter-ui.js +1 -2
- package/src/autocomplete/test/index.js +1 -5
- package/src/border-box-control/border-box-control-linked-button/component.tsx +1 -1
- package/src/border-box-control/border-box-control-linked-button/hook.ts +1 -1
- package/src/border-control/border-control-dropdown/component.tsx +9 -8
- package/src/box-control/test/index.js +11 -35
- package/src/button/README.md +49 -55
- package/src/button/{deprecated.js → deprecated.tsx} +19 -4
- package/src/button/{index.js → index.tsx} +95 -34
- package/src/button/stories/index.tsx +106 -0
- package/src/button/style.scss +3 -2
- package/src/button/test/{index.js → index.tsx} +30 -7
- package/src/button/types.ts +138 -0
- package/src/checkbox-control/test/index.tsx +1 -5
- package/src/color-list-picker/{index.js → index.tsx} +3 -2
- package/src/color-list-picker/types.ts +46 -0
- package/src/color-palette/README.md +1 -1
- package/src/color-palette/index.native.js +11 -4
- package/src/color-palette/index.tsx +11 -67
- package/src/color-palette/test/index.tsx +4 -14
- package/src/color-palette/test/utils.ts +1 -1
- package/src/color-palette/types.ts +1 -1
- package/src/color-palette/utils.ts +98 -0
- package/src/color-picker/component.tsx +1 -0
- package/src/color-picker/stories/index.js +20 -60
- package/src/color-picker/styles.ts +0 -5
- package/src/color-picker/test/index.js +6 -15
- package/src/combobox-control/index.js +9 -1
- package/src/combobox-control/test/index.js +1 -6
- package/src/confirm-dialog/test/index.js +9 -29
- package/src/custom-gradient-picker/gradient-bar/utils.js +1 -1
- package/src/dashicon/types.ts +0 -6
- package/src/date-time/date/index.tsx +2 -1
- package/src/date-time/date/test/index.tsx +2 -8
- package/src/date-time/time/test/index.tsx +9 -29
- package/src/dimension-control/test/index.test.js +2 -8
- package/src/disabled/test/index.tsx +1 -5
- package/src/draggable/test/index.native.js +4 -4
- package/src/dropdown/README.md +1 -8
- package/src/dropdown/index.tsx +17 -6
- package/src/dropdown/stories/index.tsx +3 -3
- package/src/dropdown/test/index.tsx +2 -8
- package/src/dropdown/types.ts +9 -10
- package/src/dropdown-menu/README.md +1 -1
- package/src/dropdown-menu/stories/index.js +96 -27
- package/src/dropdown-menu/test/index.js +2 -8
- package/src/external-link/test/index.tsx +1 -6
- package/src/focal-point-picker/stories/index.tsx +1 -1
- package/src/focal-point-picker/test/index.js +3 -11
- package/src/focal-point-picker/utils.ts +4 -1
- package/src/font-size-picker/test/index.tsx +14 -44
- package/src/form-file-upload/test/index.tsx +2 -17
- package/src/form-toggle/test/index.tsx +1 -5
- package/src/form-token-field/test/index.tsx +80 -163
- package/src/form-token-field/token.tsx +1 -1
- package/src/gradient-picker/index.js +15 -4
- package/src/guide/stories/index.js +14 -41
- package/src/guide/test/index.js +5 -17
- package/src/h-stack/component.tsx +0 -1
- package/src/higher-order/with-filters/test/index.js +24 -24
- package/src/higher-order/with-focus-outside/test/index.js +11 -25
- package/src/higher-order/with-focus-return/test/index.js +1 -5
- package/src/index.js +8 -6
- package/src/index.native.js +8 -6
- package/src/input-control/input-field.tsx +3 -1
- package/src/input-control/test/index.js +1 -6
- package/src/isolated-event-container/test/index.js +2 -8
- package/src/item-group/item/component.tsx +26 -2
- package/src/item-group/item-group/component.tsx +25 -2
- package/src/item-group/stories/index.tsx +103 -0
- package/src/item-group/styles.ts +1 -0
- package/src/item-group/test/__snapshots__/index.js.snap +11 -10
- package/src/keyboard-shortcuts/README.md +1 -1
- package/src/keyboard-shortcuts/index.tsx +93 -0
- package/src/keyboard-shortcuts/stories/index.tsx +60 -0
- package/src/keyboard-shortcuts/test/{index.js → index.tsx} +16 -6
- package/src/keyboard-shortcuts/types.ts +51 -0
- package/src/modal/index.tsx +1 -2
- package/src/navigable-container/test/navigable-menu.js +5 -17
- package/src/navigable-container/test/tababble-container.js +3 -11
- package/src/navigation/test/index.js +3 -11
- package/src/navigator/test/index.tsx +6 -20
- package/src/notice/README.md +89 -42
- package/src/notice/{index.js → index.tsx} +28 -20
- package/src/notice/list.tsx +72 -0
- package/src/notice/stories/index.tsx +119 -0
- package/src/notice/test/__snapshots__/{index.js.snap → index.tsx.snap} +0 -0
- package/src/notice/test/{index.js → index.tsx} +7 -4
- package/src/notice/test/{list.js → list.tsx} +0 -0
- package/src/notice/types.ts +136 -0
- package/src/number-control/index.tsx +1 -1
- package/src/number-control/test/index.tsx +28 -86
- package/src/panel/row.js +3 -3
- package/src/panel/stories/index.js +62 -80
- package/src/panel/test/body.js +2 -8
- package/src/placeholder/stories/index.tsx +1 -0
- package/src/placeholder/style.scss +1 -1
- package/src/query-controls/README.md +56 -56
- package/src/query-controls/author-select.tsx +37 -0
- package/src/query-controls/category-select.tsx +46 -0
- package/src/query-controls/index.tsx +192 -0
- package/src/query-controls/stories/index.tsx +205 -0
- package/src/query-controls/terms.ts +57 -0
- package/src/query-controls/test/{terms.js → terms.ts} +36 -20
- package/src/query-controls/types.ts +150 -0
- package/src/resizable-box/README.md +2 -2
- package/src/resizable-box/index.tsx +7 -6
- package/src/resizable-box/stories/index.tsx +92 -0
- package/src/responsive-wrapper/README.md +29 -0
- package/src/responsive-wrapper/{index.js → index.tsx} +23 -2
- package/src/responsive-wrapper/stories/index.tsx +38 -0
- package/src/responsive-wrapper/types.ts +20 -0
- package/src/sandbox/README.md +45 -2
- package/src/sandbox/{index.js → index.tsx} +47 -24
- package/src/sandbox/stories/index.tsx +32 -0
- package/src/sandbox/test/{index.js → index.tsx} +9 -4
- package/src/sandbox/types.ts +34 -0
- package/src/select-control/test/select-control.tsx +1 -6
- package/src/slot-fill/bubbles-virtually/fill.js +1 -0
- package/src/slot-fill/slot.js +1 -1
- package/src/slot-fill/stories/index.js +12 -17
- package/src/slot-fill/use-slot.js +6 -16
- package/src/snackbar/index.tsx +6 -5
- package/src/snackbar/list.tsx +4 -2
- package/src/snackbar/types.ts +18 -92
- package/src/style.scss +3 -3
- package/src/tab-panel/README.md +1 -0
- package/src/tab-panel/index.tsx +42 -6
- package/src/tab-panel/stories/index.tsx +20 -0
- package/src/tab-panel/style.scss +8 -0
- package/src/tab-panel/test/index.tsx +124 -7
- package/src/tab-panel/types.ts +11 -5
- package/src/theme/test/index.tsx +4 -4
- package/src/toggle-group-control/stories/index.tsx +1 -0
- package/src/toggle-group-control/test/index.tsx +7 -23
- package/src/toolbar/index.js +6 -52
- package/src/toolbar/stories/index.js +71 -75
- package/src/toolbar/test/index.js +1 -2
- package/src/{toolbar-group/test/index.js → toolbar/test/toolbar-group.js} +1 -1
- package/src/toolbar/{README.md → toolbar/README.md} +0 -0
- package/src/toolbar/toolbar/index.js +52 -0
- package/src/toolbar/{style.native.scss → toolbar/style.native.scss} +0 -0
- package/src/toolbar/{style.scss → toolbar/style.scss} +0 -0
- package/src/toolbar/{toolbar-container.js → toolbar/toolbar-container.js} +0 -0
- package/src/toolbar/{toolbar-container.native.js → toolbar/toolbar-container.native.js} +0 -0
- package/src/{toolbar-button → toolbar/toolbar-button}/README.md +0 -0
- package/src/{toolbar-button → toolbar/toolbar-button}/index.js +1 -1
- package/src/{toolbar-button → toolbar/toolbar-button}/style.scss +0 -0
- package/src/{toolbar-button → toolbar/toolbar-button}/toolbar-button-container.js +0 -0
- package/src/{toolbar-button → toolbar/toolbar-button}/toolbar-button-container.native.js +0 -0
- package/src/{toolbar-context → toolbar/toolbar-context}/index.js +0 -0
- package/src/{toolbar-dropdown-menu → toolbar/toolbar-dropdown-menu}/README.md +0 -0
- package/src/{toolbar-dropdown-menu → toolbar/toolbar-dropdown-menu}/index.js +1 -1
- package/src/{toolbar-group → toolbar/toolbar-group}/README.md +0 -0
- package/src/{toolbar-group → toolbar/toolbar-group}/index.js +0 -0
- package/src/{toolbar-group → toolbar/toolbar-group}/style.native.scss +0 -0
- package/src/{toolbar-group → toolbar/toolbar-group}/style.scss +0 -0
- package/src/{toolbar-group → toolbar/toolbar-group}/toolbar-group-collapsed.js +1 -1
- package/src/{toolbar-group → toolbar/toolbar-group}/toolbar-group-collapsed.native.js +1 -1
- package/src/{toolbar-group → toolbar/toolbar-group}/toolbar-group-container.js +0 -0
- package/src/{toolbar-group → toolbar/toolbar-group}/toolbar-group-container.native.js +0 -0
- package/src/{toolbar-item → toolbar/toolbar-item}/README.md +0 -0
- package/src/{toolbar-item → toolbar/toolbar-item}/index.js +0 -0
- package/src/{toolbar-item → toolbar/toolbar-item}/index.native.js +0 -0
- package/src/tools-panel/stories/index.js +3 -0
- package/src/tools-panel/test/index.js +1 -1
- package/src/tree-grid/index.js +3 -5
- package/src/tree-select/index.tsx +3 -6
- package/src/ui/context/test/context-connect.tsx +2 -0
- package/src/ui/context/test/wordpress-component.tsx +2 -0
- package/src/unit-control/test/index.tsx +21 -74
- package/src/utils/hooks/test/use-latest-ref.js +15 -18
- package/tsconfig.json +1 -11
- package/tsconfig.tsbuildinfo +1 -1
- package/build/toolbar/toolbar-container.native.js.map +0 -1
- package/build/toolbar-button/index.js.map +0 -1
- package/build/toolbar-button/toolbar-button-container.js.map +0 -1
- package/build/toolbar-button/toolbar-button-container.native.js.map +0 -1
- package/build/toolbar-context/index.js.map +0 -1
- package/build/toolbar-dropdown-menu/index.js.map +0 -1
- package/build/toolbar-group/index.js.map +0 -1
- package/build/toolbar-group/toolbar-group-collapsed.js.map +0 -1
- package/build/toolbar-group/toolbar-group-collapsed.native.js.map +0 -1
- package/build/toolbar-group/toolbar-group-container.js.map +0 -1
- package/build/toolbar-group/toolbar-group-container.native.js.map +0 -1
- package/build/toolbar-item/index.js.map +0 -1
- package/build/toolbar-item/index.native.js.map +0 -1
- package/build-module/toolbar/toolbar-container.js.map +0 -1
- package/build-module/toolbar/toolbar-container.native.js.map +0 -1
- package/build-module/toolbar-button/index.js.map +0 -1
- package/build-module/toolbar-button/toolbar-button-container.js.map +0 -1
- package/build-module/toolbar-button/toolbar-button-container.native.js.map +0 -1
- package/build-module/toolbar-context/index.js.map +0 -1
- package/build-module/toolbar-dropdown-menu/index.js.map +0 -1
- package/build-module/toolbar-group/index.js.map +0 -1
- package/build-module/toolbar-group/toolbar-group-collapsed.js.map +0 -1
- package/build-module/toolbar-group/toolbar-group-collapsed.native.js.map +0 -1
- package/build-module/toolbar-group/toolbar-group-container.js.map +0 -1
- package/build-module/toolbar-group/toolbar-group-container.native.js.map +0 -1
- package/build-module/toolbar-item/index.js.map +0 -1
- package/build-module/toolbar-item/index.native.js.map +0 -1
- package/src/button/stories/index.js +0 -179
- package/src/item-group/stories/index.js +0 -270
- package/src/keyboard-shortcuts/index.js +0 -56
- package/src/notice/list.js +0 -48
- package/src/notice/stories/index.js +0 -74
- package/src/query-controls/author-select.js +0 -23
- package/src/query-controls/category-select.js +0 -31
- package/src/query-controls/index.js +0 -121
- package/src/query-controls/terms.js +0 -40
- package/src/resizable-box/stories/index.js +0 -97
- package/src/toolbar-button/stories/index.js +0 -33
- package/src/toolbar-group/stories/index.js +0 -33
package/src/tab-panel/index.tsx
CHANGED
|
@@ -19,17 +19,16 @@ import type { WordPressComponentProps } from '../ui/context';
|
|
|
19
19
|
|
|
20
20
|
const TabButton = ( {
|
|
21
21
|
tabId,
|
|
22
|
-
onClick,
|
|
23
22
|
children,
|
|
24
23
|
selected,
|
|
25
24
|
...rest
|
|
26
25
|
}: TabButtonProps ) => (
|
|
27
26
|
<Button
|
|
28
27
|
role="tab"
|
|
29
|
-
tabIndex={ selected ?
|
|
28
|
+
tabIndex={ selected ? undefined : -1 }
|
|
30
29
|
aria-selected={ selected }
|
|
31
30
|
id={ tabId }
|
|
32
|
-
|
|
31
|
+
__experimentalIsFocusable
|
|
33
32
|
{ ...rest }
|
|
34
33
|
>
|
|
35
34
|
{ children }
|
|
@@ -104,11 +103,47 @@ export function TabPanel( {
|
|
|
104
103
|
const selectedTab = tabs.find( ( { name } ) => name === selected );
|
|
105
104
|
const selectedId = `${ instanceId }-${ selectedTab?.name ?? 'none' }`;
|
|
106
105
|
|
|
106
|
+
// Handle selecting the initial tab.
|
|
107
107
|
useEffect( () => {
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
// If there's a selected tab, don't override it.
|
|
109
|
+
if ( selectedTab ) {
|
|
110
|
+
return;
|
|
110
111
|
}
|
|
111
|
-
|
|
112
|
+
|
|
113
|
+
const initialTab = tabs.find( ( tab ) => tab.name === initialTabName );
|
|
114
|
+
|
|
115
|
+
// Wait for the denoted initial tab to be declared before making a
|
|
116
|
+
// selection. This ensures that if a tab is declared lazily it can
|
|
117
|
+
// still receive initial selection.
|
|
118
|
+
if ( initialTabName && ! initialTab ) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if ( initialTab && ! initialTab.disabled ) {
|
|
123
|
+
// Select the initial tab if it's not disabled.
|
|
124
|
+
handleTabSelection( initialTab.name );
|
|
125
|
+
} else {
|
|
126
|
+
// Fallback to the first enabled tab when the initial is disabled.
|
|
127
|
+
const firstEnabledTab = tabs.find( ( tab ) => ! tab.disabled );
|
|
128
|
+
if ( firstEnabledTab ) handleTabSelection( firstEnabledTab.name );
|
|
129
|
+
}
|
|
130
|
+
}, [ tabs, selectedTab, initialTabName, handleTabSelection ] );
|
|
131
|
+
|
|
132
|
+
// Handle the currently selected tab becoming disabled.
|
|
133
|
+
useEffect( () => {
|
|
134
|
+
// This effect only runs when the selected tab is defined and becomes disabled.
|
|
135
|
+
if ( ! selectedTab?.disabled ) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const firstEnabledTab = tabs.find( ( tab ) => ! tab.disabled );
|
|
140
|
+
|
|
141
|
+
// If the currently selected tab becomes disabled, select the first enabled tab.
|
|
142
|
+
// (if there is one).
|
|
143
|
+
if ( firstEnabledTab ) {
|
|
144
|
+
handleTabSelection( firstEnabledTab.name );
|
|
145
|
+
}
|
|
146
|
+
}, [ tabs, selectedTab?.disabled, handleTabSelection ] );
|
|
112
147
|
|
|
113
148
|
return (
|
|
114
149
|
<div className={ className }>
|
|
@@ -134,6 +169,7 @@ export function TabPanel( {
|
|
|
134
169
|
selected={ tab.name === selected }
|
|
135
170
|
key={ tab.name }
|
|
136
171
|
onClick={ () => handleTabSelection( tab.name ) }
|
|
172
|
+
disabled={ tab.disabled }
|
|
137
173
|
label={ tab.icon && tab.title }
|
|
138
174
|
icon={ tab.icon }
|
|
139
175
|
showTooltip={ !! tab.icon }
|
|
@@ -35,3 +35,23 @@ Default.args = {
|
|
|
35
35
|
},
|
|
36
36
|
],
|
|
37
37
|
};
|
|
38
|
+
|
|
39
|
+
export const DisabledTab = Template.bind( {} );
|
|
40
|
+
DisabledTab.args = {
|
|
41
|
+
children: ( tab ) => <p>Selected tab: { tab.title }</p>,
|
|
42
|
+
tabs: [
|
|
43
|
+
{
|
|
44
|
+
name: 'tab1',
|
|
45
|
+
title: 'Tab 1',
|
|
46
|
+
disabled: true,
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: 'tab2',
|
|
50
|
+
title: 'Tab 2',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: 'tab3',
|
|
54
|
+
title: 'Tab 3',
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
};
|
package/src/tab-panel/style.scss
CHANGED
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
&:focus:not(:disabled) {
|
|
25
25
|
position: relative;
|
|
26
26
|
box-shadow: none;
|
|
27
|
+
outline: none;
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
// Tab indicator
|
|
@@ -48,6 +49,10 @@
|
|
|
48
49
|
// Active.
|
|
49
50
|
&.is-active::after {
|
|
50
51
|
height: calc(1 * var(--wp-admin-border-width-focus));
|
|
52
|
+
|
|
53
|
+
// Windows high contrast mode.
|
|
54
|
+
outline: 2px solid transparent;
|
|
55
|
+
outline-offset: -1px;
|
|
51
56
|
}
|
|
52
57
|
|
|
53
58
|
// Focus.
|
|
@@ -71,5 +76,8 @@
|
|
|
71
76
|
|
|
72
77
|
&:focus-visible::before {
|
|
73
78
|
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) $components-color-accent;
|
|
79
|
+
|
|
80
|
+
// Windows high contrast mode.
|
|
81
|
+
outline: 2px solid transparent;
|
|
74
82
|
}
|
|
75
83
|
}
|
|
@@ -9,12 +9,7 @@ import userEvent from '@testing-library/user-event';
|
|
|
9
9
|
*/
|
|
10
10
|
import TabPanel from '..';
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const setupUser = () =>
|
|
15
|
-
userEvent.setup( {
|
|
16
|
-
advanceTimers: jest.advanceTimersByTime,
|
|
17
|
-
} );
|
|
12
|
+
const setupUser = () => userEvent.setup();
|
|
18
13
|
|
|
19
14
|
const TABS = [
|
|
20
15
|
{
|
|
@@ -147,7 +142,7 @@ describe( 'TabPanel', () => {
|
|
|
147
142
|
);
|
|
148
143
|
} );
|
|
149
144
|
|
|
150
|
-
it( 'should select `
|
|
145
|
+
it( 'should select `initialTabName` if defined', () => {
|
|
151
146
|
const mockOnSelect = jest.fn();
|
|
152
147
|
|
|
153
148
|
render(
|
|
@@ -162,6 +157,128 @@ describe( 'TabPanel', () => {
|
|
|
162
157
|
expect( mockOnSelect ).toHaveBeenLastCalledWith( 'beta' );
|
|
163
158
|
} );
|
|
164
159
|
|
|
160
|
+
it( 'waits for the tab with the `initialTabName` to become present in the `tabs` array before selecting it', () => {
|
|
161
|
+
const mockOnSelect = jest.fn();
|
|
162
|
+
|
|
163
|
+
const { rerender } = render(
|
|
164
|
+
<TabPanel
|
|
165
|
+
tabs={ TABS }
|
|
166
|
+
initialTabName="delta"
|
|
167
|
+
children={ () => undefined }
|
|
168
|
+
onSelect={ mockOnSelect }
|
|
169
|
+
/>
|
|
170
|
+
);
|
|
171
|
+
|
|
172
|
+
// There should be no selected tab.
|
|
173
|
+
expect(
|
|
174
|
+
screen.queryByRole( 'tab', { selected: true } )
|
|
175
|
+
).not.toBeInTheDocument();
|
|
176
|
+
|
|
177
|
+
rerender(
|
|
178
|
+
<TabPanel
|
|
179
|
+
tabs={ [
|
|
180
|
+
{ name: 'delta', title: 'Delta', className: 'delta-class' },
|
|
181
|
+
...TABS,
|
|
182
|
+
] }
|
|
183
|
+
initialTabName="delta"
|
|
184
|
+
children={ () => undefined }
|
|
185
|
+
onSelect={ mockOnSelect }
|
|
186
|
+
/>
|
|
187
|
+
);
|
|
188
|
+
|
|
189
|
+
expect( getSelectedTab() ).toHaveTextContent( 'Delta' );
|
|
190
|
+
expect( mockOnSelect ).toHaveBeenLastCalledWith( 'delta' );
|
|
191
|
+
} );
|
|
192
|
+
|
|
193
|
+
it( 'should disable the tab when `disabled` is true', async () => {
|
|
194
|
+
const user = setupUser();
|
|
195
|
+
const mockOnSelect = jest.fn();
|
|
196
|
+
|
|
197
|
+
render(
|
|
198
|
+
<TabPanel
|
|
199
|
+
tabs={ [
|
|
200
|
+
...TABS,
|
|
201
|
+
{
|
|
202
|
+
name: 'delta',
|
|
203
|
+
title: 'Delta',
|
|
204
|
+
className: 'delta-class',
|
|
205
|
+
disabled: true,
|
|
206
|
+
},
|
|
207
|
+
] }
|
|
208
|
+
children={ () => undefined }
|
|
209
|
+
onSelect={ mockOnSelect }
|
|
210
|
+
/>
|
|
211
|
+
);
|
|
212
|
+
|
|
213
|
+
expect( screen.getByRole( 'tab', { name: 'Delta' } ) ).toHaveAttribute(
|
|
214
|
+
'aria-disabled',
|
|
215
|
+
'true'
|
|
216
|
+
);
|
|
217
|
+
|
|
218
|
+
// onSelect gets called on the initial render.
|
|
219
|
+
expect( mockOnSelect ).toHaveBeenCalledTimes( 1 );
|
|
220
|
+
|
|
221
|
+
// onSelect should not be called since the disabled tab is highlighted, but not selected.
|
|
222
|
+
await user.keyboard( '[ArrowLeft]' );
|
|
223
|
+
expect( mockOnSelect ).toHaveBeenCalledTimes( 1 );
|
|
224
|
+
} );
|
|
225
|
+
|
|
226
|
+
it( 'should select the first enabled tab when the inital tab is disabled', () => {
|
|
227
|
+
const mockOnSelect = jest.fn();
|
|
228
|
+
|
|
229
|
+
render(
|
|
230
|
+
<TabPanel
|
|
231
|
+
tabs={ [
|
|
232
|
+
{
|
|
233
|
+
name: 'alpha',
|
|
234
|
+
title: 'Alpha',
|
|
235
|
+
className: 'alpha-class',
|
|
236
|
+
disabled: true,
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
name: 'beta',
|
|
240
|
+
title: 'Beta',
|
|
241
|
+
className: 'beta-class',
|
|
242
|
+
},
|
|
243
|
+
] }
|
|
244
|
+
initialTabName="alpha"
|
|
245
|
+
children={ () => undefined }
|
|
246
|
+
onSelect={ mockOnSelect }
|
|
247
|
+
/>
|
|
248
|
+
);
|
|
249
|
+
|
|
250
|
+
expect( getSelectedTab() ).toHaveTextContent( 'Beta' );
|
|
251
|
+
} );
|
|
252
|
+
|
|
253
|
+
it( 'should select the first enabled tab when the currently selected becomes disabled', () => {
|
|
254
|
+
const mockOnSelect = jest.fn();
|
|
255
|
+
|
|
256
|
+
const { rerender } = render(
|
|
257
|
+
<TabPanel
|
|
258
|
+
tabs={ TABS }
|
|
259
|
+
children={ () => undefined }
|
|
260
|
+
onSelect={ mockOnSelect }
|
|
261
|
+
/>
|
|
262
|
+
);
|
|
263
|
+
|
|
264
|
+
expect( getSelectedTab() ).toHaveTextContent( 'Alpha' );
|
|
265
|
+
|
|
266
|
+
rerender(
|
|
267
|
+
<TabPanel
|
|
268
|
+
tabs={ TABS.map( ( tab ) => {
|
|
269
|
+
if ( tab.name === 'alpha' ) {
|
|
270
|
+
return { ...tab, disabled: true };
|
|
271
|
+
}
|
|
272
|
+
return tab;
|
|
273
|
+
} ) }
|
|
274
|
+
children={ () => undefined }
|
|
275
|
+
onSelect={ mockOnSelect }
|
|
276
|
+
/>
|
|
277
|
+
);
|
|
278
|
+
|
|
279
|
+
expect( getSelectedTab() ).toHaveTextContent( 'Beta' );
|
|
280
|
+
} );
|
|
281
|
+
|
|
165
282
|
describe( 'fallbacks when new tab list invalidates current selection', () => {
|
|
166
283
|
it( 'should select `initialTabName` if defined', async () => {
|
|
167
284
|
const user = setupUser();
|
package/src/tab-panel/types.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import type { ReactNode } from 'react';
|
|
4
|
+
import type { MouseEvent, ReactNode } from 'react';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
8
8
|
*/
|
|
9
9
|
import type { IconType } from '../icon';
|
|
10
10
|
|
|
11
|
-
type Tab = {
|
|
11
|
+
type Tab< IconProps = unknown > = {
|
|
12
12
|
/**
|
|
13
13
|
* The key of the tab.
|
|
14
14
|
*/
|
|
@@ -21,18 +21,24 @@ type Tab = {
|
|
|
21
21
|
* The class name to apply to the tab button.
|
|
22
22
|
*/
|
|
23
23
|
className?: string;
|
|
24
|
+
/**
|
|
25
|
+
* The icon used for the tab button.
|
|
26
|
+
*/
|
|
27
|
+
icon?: IconType< IconProps >;
|
|
28
|
+
/**
|
|
29
|
+
* Determines if the tab button should be disabled.
|
|
30
|
+
*/
|
|
31
|
+
disabled?: boolean;
|
|
24
32
|
} & Record< any, any >;
|
|
25
33
|
|
|
26
34
|
export type TabButtonProps< IconProps = unknown > = {
|
|
27
35
|
children: ReactNode;
|
|
28
|
-
className?: string;
|
|
29
|
-
icon?: IconType< IconProps >;
|
|
30
36
|
label?: string;
|
|
31
37
|
onClick: ( event: MouseEvent ) => void;
|
|
32
38
|
selected: boolean;
|
|
33
39
|
showTooltip?: boolean;
|
|
34
40
|
tabId: string;
|
|
35
|
-
}
|
|
41
|
+
} & Pick< Tab< IconProps >, 'className' | 'icon' | 'disabled' >;
|
|
36
42
|
|
|
37
43
|
export type TabPanelProps = {
|
|
38
44
|
/**
|
package/src/theme/test/index.tsx
CHANGED
|
@@ -26,7 +26,7 @@ const MyThemableComponent = ( props: MyThemableComponentProps ) => {
|
|
|
26
26
|
|
|
27
27
|
describe( 'Theme', () => {
|
|
28
28
|
describe( 'accent color', () => {
|
|
29
|
-
it( '
|
|
29
|
+
it( 'does not define the accent color (and its variations) as a CSS variable when the `accent` prop is undefined', () => {
|
|
30
30
|
render(
|
|
31
31
|
<Theme data-testid="theme">
|
|
32
32
|
<MyThemableComponent>Inner</MyThemableComponent>
|
|
@@ -49,7 +49,7 @@ describe( 'Theme', () => {
|
|
|
49
49
|
} );
|
|
50
50
|
} );
|
|
51
51
|
|
|
52
|
-
it( '
|
|
52
|
+
it( 'defines the accent color (and its variations) as a CSS variable', () => {
|
|
53
53
|
render(
|
|
54
54
|
<Theme accent="#123abc" data-testid="theme">
|
|
55
55
|
<MyThemableComponent>Inner</MyThemableComponent>
|
|
@@ -66,7 +66,7 @@ describe( 'Theme', () => {
|
|
|
66
66
|
} );
|
|
67
67
|
|
|
68
68
|
describe( 'background color', () => {
|
|
69
|
-
it( '
|
|
69
|
+
it( 'does not define the background color (and its dependent colors) as a CSS variable when the `background` prop is undefined', () => {
|
|
70
70
|
render(
|
|
71
71
|
<Theme data-testid="theme">
|
|
72
72
|
<MyThemableComponent>Inner</MyThemableComponent>
|
|
@@ -91,7 +91,7 @@ describe( 'Theme', () => {
|
|
|
91
91
|
} );
|
|
92
92
|
} );
|
|
93
93
|
|
|
94
|
-
it( '
|
|
94
|
+
it( 'defines the background color (and its dependent colors) as a CSS variable', () => {
|
|
95
95
|
render(
|
|
96
96
|
<Theme background="#ffffff" data-testid="theme">
|
|
97
97
|
<MyThemableComponent>Inner</MyThemableComponent>
|
|
@@ -18,8 +18,6 @@ import {
|
|
|
18
18
|
ToggleGroupControlOptionIcon,
|
|
19
19
|
} from '../index';
|
|
20
20
|
|
|
21
|
-
jest.useFakeTimers();
|
|
22
|
-
|
|
23
21
|
function getWrappingPopoverElement( element: HTMLElement ) {
|
|
24
22
|
return element.closest( '.components-popover' );
|
|
25
23
|
}
|
|
@@ -81,9 +79,7 @@ describe( 'ToggleGroupControl', () => {
|
|
|
81
79
|
} );
|
|
82
80
|
} );
|
|
83
81
|
it( 'should call onChange with proper value', async () => {
|
|
84
|
-
const user = userEvent.setup(
|
|
85
|
-
advanceTimers: jest.advanceTimersByTime,
|
|
86
|
-
} );
|
|
82
|
+
const user = userEvent.setup();
|
|
87
83
|
const mockOnChange = jest.fn();
|
|
88
84
|
|
|
89
85
|
render(
|
|
@@ -102,9 +98,7 @@ describe( 'ToggleGroupControl', () => {
|
|
|
102
98
|
} );
|
|
103
99
|
|
|
104
100
|
it( 'should render tooltip where `showTooltip` === `true`', async () => {
|
|
105
|
-
const user = userEvent.setup(
|
|
106
|
-
advanceTimers: jest.advanceTimersByTime,
|
|
107
|
-
} );
|
|
101
|
+
const user = userEvent.setup();
|
|
108
102
|
render(
|
|
109
103
|
<ToggleGroupControl label="Test Toggle Group Control">
|
|
110
104
|
{ optionsWithTooltip }
|
|
@@ -131,9 +125,7 @@ describe( 'ToggleGroupControl', () => {
|
|
|
131
125
|
} );
|
|
132
126
|
|
|
133
127
|
it( 'should not render tooltip', async () => {
|
|
134
|
-
const user = userEvent.setup(
|
|
135
|
-
advanceTimers: jest.advanceTimersByTime,
|
|
136
|
-
} );
|
|
128
|
+
const user = userEvent.setup();
|
|
137
129
|
render(
|
|
138
130
|
<ToggleGroupControl label="Test Toggle Group Control">
|
|
139
131
|
{ optionsWithTooltip }
|
|
@@ -157,9 +149,7 @@ describe( 'ToggleGroupControl', () => {
|
|
|
157
149
|
describe( 'isDeselectable = false', () => {
|
|
158
150
|
it( 'should not be deselectable', async () => {
|
|
159
151
|
const mockOnChange = jest.fn();
|
|
160
|
-
const user = userEvent.setup(
|
|
161
|
-
advanceTimers: jest.advanceTimersByTime,
|
|
162
|
-
} );
|
|
152
|
+
const user = userEvent.setup();
|
|
163
153
|
|
|
164
154
|
render(
|
|
165
155
|
<ToggleGroupControl
|
|
@@ -180,9 +170,7 @@ describe( 'ToggleGroupControl', () => {
|
|
|
180
170
|
} );
|
|
181
171
|
|
|
182
172
|
it( 'should not tab to next radio option', async () => {
|
|
183
|
-
const user = userEvent.setup(
|
|
184
|
-
advanceTimers: jest.advanceTimersByTime,
|
|
185
|
-
} );
|
|
173
|
+
const user = userEvent.setup();
|
|
186
174
|
|
|
187
175
|
render(
|
|
188
176
|
<ToggleGroupControl value="rigas" label="Test">
|
|
@@ -205,9 +193,7 @@ describe( 'ToggleGroupControl', () => {
|
|
|
205
193
|
describe( 'isDeselectable = true', () => {
|
|
206
194
|
it( 'should be deselectable', async () => {
|
|
207
195
|
const mockOnChange = jest.fn();
|
|
208
|
-
const user = userEvent.setup(
|
|
209
|
-
advanceTimers: jest.advanceTimersByTime,
|
|
210
|
-
} );
|
|
196
|
+
const user = userEvent.setup();
|
|
211
197
|
|
|
212
198
|
render(
|
|
213
199
|
<ToggleGroupControl
|
|
@@ -237,9 +223,7 @@ describe( 'ToggleGroupControl', () => {
|
|
|
237
223
|
} );
|
|
238
224
|
|
|
239
225
|
it( 'should tab to the next option button', async () => {
|
|
240
|
-
const user = userEvent.setup(
|
|
241
|
-
advanceTimers: jest.advanceTimersByTime,
|
|
242
|
-
} );
|
|
226
|
+
const user = userEvent.setup();
|
|
243
227
|
|
|
244
228
|
render(
|
|
245
229
|
<ToggleGroupControl
|
package/src/toolbar/index.js
CHANGED
|
@@ -1,52 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { forwardRef } from '@wordpress/element';
|
|
10
|
-
import deprecated from '@wordpress/deprecated';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Internal dependencies
|
|
14
|
-
*/
|
|
15
|
-
import ToolbarGroup from '../toolbar-group';
|
|
16
|
-
import ToolbarContainer from './toolbar-container';
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Renders a toolbar.
|
|
20
|
-
*
|
|
21
|
-
* To add controls, simply pass `ToolbarButton` components as children.
|
|
22
|
-
*
|
|
23
|
-
* @param {Object} props Component props.
|
|
24
|
-
* @param {string} [props.className] Class to set on the container div.
|
|
25
|
-
* @param {string} [props.label] ARIA label for toolbar container.
|
|
26
|
-
* @param {Object} ref React Element ref.
|
|
27
|
-
*/
|
|
28
|
-
function Toolbar( { className, label, ...props }, ref ) {
|
|
29
|
-
if ( ! label ) {
|
|
30
|
-
deprecated( 'Using Toolbar without label prop', {
|
|
31
|
-
since: '5.6',
|
|
32
|
-
alternative: 'ToolbarGroup component',
|
|
33
|
-
link: 'https://developer.wordpress.org/block-editor/components/toolbar/',
|
|
34
|
-
} );
|
|
35
|
-
return <ToolbarGroup { ...props } className={ className } />;
|
|
36
|
-
}
|
|
37
|
-
// `ToolbarGroup` already uses components-toolbar for compatibility reasons.
|
|
38
|
-
const finalClassName = classnames(
|
|
39
|
-
'components-accessible-toolbar',
|
|
40
|
-
className
|
|
41
|
-
);
|
|
42
|
-
return (
|
|
43
|
-
<ToolbarContainer
|
|
44
|
-
className={ finalClassName }
|
|
45
|
-
label={ label }
|
|
46
|
-
ref={ ref }
|
|
47
|
-
{ ...props }
|
|
48
|
-
/>
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export default forwardRef( Toolbar );
|
|
1
|
+
export { default as Toolbar } from './toolbar';
|
|
2
|
+
export { default as ToolbarButton } from './toolbar-button';
|
|
3
|
+
export { default as ToolbarContext } from './toolbar-context';
|
|
4
|
+
export { default as ToolbarDropdownMenu } from './toolbar-dropdown-menu';
|
|
5
|
+
export { default as ToolbarGroup } from './toolbar-group';
|
|
6
|
+
export { default as ToolbarItem } from './toolbar-item';
|
|
@@ -12,22 +12,42 @@ import {
|
|
|
12
12
|
link,
|
|
13
13
|
more,
|
|
14
14
|
paragraph,
|
|
15
|
+
arrowUp,
|
|
16
|
+
arrowDown,
|
|
17
|
+
arrowLeft,
|
|
18
|
+
arrowRight,
|
|
19
|
+
chevronDown,
|
|
15
20
|
} from '@wordpress/icons';
|
|
16
21
|
|
|
17
22
|
/**
|
|
18
23
|
* Internal dependencies
|
|
19
24
|
*/
|
|
20
|
-
import Toolbar from '../';
|
|
21
25
|
import {
|
|
22
|
-
|
|
23
|
-
Path,
|
|
26
|
+
Toolbar,
|
|
24
27
|
ToolbarButton,
|
|
25
28
|
ToolbarGroup,
|
|
26
29
|
ToolbarItem,
|
|
27
|
-
|
|
28
|
-
} from '
|
|
30
|
+
ToolbarDropdownMenu,
|
|
31
|
+
} from '..';
|
|
32
|
+
import { SVG, Path, DropdownMenu } from '../../';
|
|
29
33
|
|
|
30
|
-
export default {
|
|
34
|
+
export default {
|
|
35
|
+
title: 'Components/Toolbar',
|
|
36
|
+
component: Toolbar,
|
|
37
|
+
subcomponents: {
|
|
38
|
+
ToolbarButton,
|
|
39
|
+
ToolbarGroup,
|
|
40
|
+
ToolbarItem,
|
|
41
|
+
ToolbarDropdownMenu,
|
|
42
|
+
},
|
|
43
|
+
argTypes: {
|
|
44
|
+
children: { control: { type: null } },
|
|
45
|
+
},
|
|
46
|
+
parameters: {
|
|
47
|
+
controls: { expanded: true },
|
|
48
|
+
docs: { source: { state: 'open' } },
|
|
49
|
+
},
|
|
50
|
+
};
|
|
31
51
|
|
|
32
52
|
function InlineImageIcon() {
|
|
33
53
|
return (
|
|
@@ -37,13 +57,20 @@ function InlineImageIcon() {
|
|
|
37
57
|
);
|
|
38
58
|
}
|
|
39
59
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
60
|
+
const Template = ( props ) => (
|
|
61
|
+
<div style={ { height: 280 } }>
|
|
62
|
+
<Toolbar { ...props } />
|
|
63
|
+
</div>
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
export const Default = Template.bind( {} );
|
|
67
|
+
Default.args = {
|
|
68
|
+
label: 'Options',
|
|
69
|
+
id: 'options-toolbar',
|
|
70
|
+
children: (
|
|
71
|
+
<>
|
|
45
72
|
<ToolbarGroup>
|
|
46
|
-
<ToolbarButton icon={ paragraph }
|
|
73
|
+
<ToolbarButton icon={ paragraph } text="Paragraph" />
|
|
47
74
|
</ToolbarGroup>
|
|
48
75
|
<ToolbarGroup>
|
|
49
76
|
<ToolbarItem>
|
|
@@ -105,72 +132,41 @@ export const _default = () => {
|
|
|
105
132
|
{ icon: alignRight, title: 'Align right' },
|
|
106
133
|
] }
|
|
107
134
|
/>
|
|
108
|
-
|
|
109
|
-
|
|
135
|
+
<ToolbarDropdownMenu
|
|
136
|
+
icon={ chevronDown }
|
|
137
|
+
label="Select a direction"
|
|
138
|
+
controls={ [
|
|
139
|
+
{
|
|
140
|
+
title: 'Up',
|
|
141
|
+
icon: arrowUp,
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
title: 'Right',
|
|
145
|
+
icon: arrowRight,
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
title: 'Down',
|
|
149
|
+
icon: arrowDown,
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
title: 'Left',
|
|
153
|
+
icon: arrowLeft,
|
|
154
|
+
},
|
|
155
|
+
] }
|
|
156
|
+
/>
|
|
157
|
+
</>
|
|
158
|
+
),
|
|
110
159
|
};
|
|
111
160
|
|
|
112
|
-
export const
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
161
|
+
export const WithoutGroup = Template.bind( {} );
|
|
162
|
+
WithoutGroup.args = {
|
|
163
|
+
label: 'Options',
|
|
164
|
+
id: 'options-toolbar-without-group',
|
|
165
|
+
children: (
|
|
166
|
+
<>
|
|
116
167
|
<ToolbarButton icon={ formatBold } label="Bold" isPressed />
|
|
117
168
|
<ToolbarButton icon={ formatItalic } label="Italic" />
|
|
118
169
|
<ToolbarButton icon={ link } label="Link" />
|
|
119
|
-
|
|
120
|
-
)
|
|
121
|
-
};
|
|
122
|
-
/* eslint-enable no-restricted-syntax */
|
|
123
|
-
|
|
124
|
-
export const toolbars = () => {
|
|
125
|
-
return (
|
|
126
|
-
<div>
|
|
127
|
-
<div style={ { padding: '20px' } }>
|
|
128
|
-
<h2>Icon-only Toolbar</h2>
|
|
129
|
-
<Toolbar>
|
|
130
|
-
<ToolbarButton icon={ formatBold } title="Bold" />
|
|
131
|
-
<ToolbarButton
|
|
132
|
-
icon={ formatItalic }
|
|
133
|
-
title="Italic"
|
|
134
|
-
isActive
|
|
135
|
-
/>
|
|
136
|
-
<ToolbarButton icon={ link } title="Link" />
|
|
137
|
-
</Toolbar>
|
|
138
|
-
</div>
|
|
139
|
-
|
|
140
|
-
<div style={ { padding: '20px' } }>
|
|
141
|
-
<h2>Text-only Toolbar</h2>
|
|
142
|
-
<Toolbar>
|
|
143
|
-
<ToolbarButton>Bold Format</ToolbarButton>
|
|
144
|
-
<ToolbarButton isActive>Italic Format</ToolbarButton>
|
|
145
|
-
<ToolbarButton>Link Format</ToolbarButton>
|
|
146
|
-
</Toolbar>
|
|
147
|
-
</div>
|
|
148
|
-
|
|
149
|
-
<div style={ { padding: '20px' } }>
|
|
150
|
-
<h2>Text and Icon Toolbar</h2>
|
|
151
|
-
<Toolbar>
|
|
152
|
-
<ToolbarButton icon={ formatBold } title="Bold" />
|
|
153
|
-
<ToolbarButton isActive>Bold Format</ToolbarButton>
|
|
154
|
-
<ToolbarButton icon={ formatItalic } title="Italic" />
|
|
155
|
-
<ToolbarButton>Italic Format</ToolbarButton>
|
|
156
|
-
<ToolbarButton icon={ link } title="Link" />
|
|
157
|
-
<ToolbarButton>Link Format</ToolbarButton>
|
|
158
|
-
</Toolbar>
|
|
159
|
-
</div>
|
|
160
|
-
|
|
161
|
-
<div style={ { padding: '20px' } }>
|
|
162
|
-
<h2>Single Icon Button Toolbar</h2>
|
|
163
|
-
<Toolbar>
|
|
164
|
-
<ToolbarButton icon={ formatBold } title="Bold" />
|
|
165
|
-
</Toolbar>
|
|
166
|
-
</div>
|
|
167
|
-
|
|
168
|
-
<div style={ { padding: '20px' } }>
|
|
169
|
-
<h2>Single Text Button toolbar</h2>
|
|
170
|
-
<Toolbar>
|
|
171
|
-
<ToolbarButton>Bold Toolbar</ToolbarButton>
|
|
172
|
-
</Toolbar>
|
|
173
|
-
</div>
|
|
174
|
-
</div>
|
|
175
|
-
);
|
|
170
|
+
</>
|
|
171
|
+
),
|
|
176
172
|
};
|