@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
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { text, number } from '@storybook/addon-knobs';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -17,20 +12,19 @@ import Guide from '../';
|
|
|
17
12
|
export default {
|
|
18
13
|
title: 'Components/Guide',
|
|
19
14
|
component: Guide,
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
argTypes: {
|
|
16
|
+
contentLabel: { control: 'text' },
|
|
17
|
+
finishButtonText: { control: 'text' },
|
|
18
|
+
onFinish: { action: 'onFinish' },
|
|
22
19
|
},
|
|
23
20
|
};
|
|
24
21
|
|
|
25
|
-
const
|
|
22
|
+
const Template = ( { onFinish, ...props } ) => {
|
|
26
23
|
const [ isOpen, setOpen ] = useState( false );
|
|
27
24
|
|
|
28
25
|
const openGuide = () => setOpen( true );
|
|
29
26
|
const closeGuide = () => setOpen( false );
|
|
30
27
|
|
|
31
|
-
const loremIpsum =
|
|
32
|
-
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.';
|
|
33
|
-
|
|
34
28
|
return (
|
|
35
29
|
<>
|
|
36
30
|
<Button variant="secondary" onClick={ openGuide }>
|
|
@@ -39,40 +33,19 @@ const ModalExample = ( { numberOfPages, ...props } ) => {
|
|
|
39
33
|
{ isOpen && (
|
|
40
34
|
<Guide
|
|
41
35
|
{ ...props }
|
|
42
|
-
onFinish={
|
|
43
|
-
|
|
44
|
-
(
|
|
45
|
-
|
|
46
|
-
<>
|
|
47
|
-
<h1>
|
|
48
|
-
Page { page + 1 } of { numberOfPages }
|
|
49
|
-
</h1>
|
|
50
|
-
<p>{ loremIpsum }</p>
|
|
51
|
-
</>
|
|
52
|
-
),
|
|
53
|
-
} )
|
|
54
|
-
) }
|
|
36
|
+
onFinish={ ( ...finishArgs ) => {
|
|
37
|
+
closeGuide( ...finishArgs );
|
|
38
|
+
onFinish( ...finishArgs );
|
|
39
|
+
} }
|
|
55
40
|
/>
|
|
56
41
|
) }
|
|
57
42
|
</>
|
|
58
43
|
);
|
|
59
44
|
};
|
|
60
45
|
|
|
61
|
-
export const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
min: 1,
|
|
67
|
-
max: 10,
|
|
68
|
-
step: 1,
|
|
69
|
-
} );
|
|
70
|
-
|
|
71
|
-
const modalProps = {
|
|
72
|
-
finishButtonText,
|
|
73
|
-
contentLabel,
|
|
74
|
-
numberOfPages,
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
return <ModalExample { ...modalProps } />;
|
|
46
|
+
export const Default = Template.bind( {} );
|
|
47
|
+
Default.args = {
|
|
48
|
+
pages: Array.from( { length: 3 } ).map( ( _, page ) => ( {
|
|
49
|
+
content: <p>{ `Page ${ page + 1 }` }</p>,
|
|
50
|
+
} ) ),
|
|
78
51
|
};
|
package/src/guide/test/index.js
CHANGED
|
@@ -9,8 +9,6 @@ import userEvent from '@testing-library/user-event';
|
|
|
9
9
|
*/
|
|
10
10
|
import Guide from '../';
|
|
11
11
|
|
|
12
|
-
jest.useFakeTimers();
|
|
13
|
-
|
|
14
12
|
describe( 'Guide', () => {
|
|
15
13
|
it( 'renders nothing when there are no pages', () => {
|
|
16
14
|
render( <Guide pages={ [] } /> );
|
|
@@ -54,9 +52,7 @@ describe( 'Guide', () => {
|
|
|
54
52
|
} );
|
|
55
53
|
|
|
56
54
|
it( 'shows back button and shows finish button on the last page', async () => {
|
|
57
|
-
const user = userEvent.setup(
|
|
58
|
-
advanceTimers: jest.advanceTimersByTime,
|
|
59
|
-
} );
|
|
55
|
+
const user = userEvent.setup();
|
|
60
56
|
render(
|
|
61
57
|
<Guide
|
|
62
58
|
pages={ [
|
|
@@ -89,9 +85,7 @@ describe( 'Guide', () => {
|
|
|
89
85
|
} );
|
|
90
86
|
|
|
91
87
|
it( 'calls onFinish when the finish button is clicked', async () => {
|
|
92
|
-
const user = userEvent.setup(
|
|
93
|
-
advanceTimers: jest.advanceTimersByTime,
|
|
94
|
-
} );
|
|
88
|
+
const user = userEvent.setup();
|
|
95
89
|
const onFinish = jest.fn();
|
|
96
90
|
render(
|
|
97
91
|
<Guide
|
|
@@ -105,9 +99,7 @@ describe( 'Guide', () => {
|
|
|
105
99
|
} );
|
|
106
100
|
|
|
107
101
|
it( 'calls onFinish when the modal is closed', async () => {
|
|
108
|
-
const user = userEvent.setup(
|
|
109
|
-
advanceTimers: jest.advanceTimersByTime,
|
|
110
|
-
} );
|
|
102
|
+
const user = userEvent.setup();
|
|
111
103
|
const onFinish = jest.fn();
|
|
112
104
|
render(
|
|
113
105
|
<Guide
|
|
@@ -158,9 +150,7 @@ describe( 'Guide', () => {
|
|
|
158
150
|
} );
|
|
159
151
|
|
|
160
152
|
it( 'sets the current page when a button is clicked', async () => {
|
|
161
|
-
const user = userEvent.setup(
|
|
162
|
-
advanceTimers: jest.advanceTimersByTime,
|
|
163
|
-
} );
|
|
153
|
+
const user = userEvent.setup();
|
|
164
154
|
|
|
165
155
|
render(
|
|
166
156
|
<Guide
|
|
@@ -202,9 +192,7 @@ describe( 'Guide', () => {
|
|
|
202
192
|
} );
|
|
203
193
|
|
|
204
194
|
it( 'allows navigating through the pages with the left and right arrows', async () => {
|
|
205
|
-
const user = userEvent.setup(
|
|
206
|
-
advanceTimers: jest.advanceTimersByTime,
|
|
207
|
-
} );
|
|
195
|
+
const user = userEvent.setup();
|
|
208
196
|
|
|
209
197
|
render(
|
|
210
198
|
<Guide
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { render, waitFor } from '@testing-library/react';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -13,8 +13,6 @@ import { addFilter, removeAllFilters, removeFilter } from '@wordpress/hooks';
|
|
|
13
13
|
*/
|
|
14
14
|
import withFilters from '..';
|
|
15
15
|
|
|
16
|
-
jest.useFakeTimers();
|
|
17
|
-
|
|
18
16
|
describe( 'withFilters', () => {
|
|
19
17
|
const hookName = 'EnhancedComponent';
|
|
20
18
|
const MyComponent = () => <div>My component</div>;
|
|
@@ -65,7 +63,7 @@ describe( 'withFilters', () => {
|
|
|
65
63
|
expect( container ).toMatchSnapshot();
|
|
66
64
|
} );
|
|
67
65
|
|
|
68
|
-
it( 'should not re-render component when new filter added before component was mounted', () => {
|
|
66
|
+
it( 'should not re-render component when new filter added before component was mounted', async () => {
|
|
69
67
|
const SpiedComponent = jest.fn( () => <div>Spied component</div> );
|
|
70
68
|
addFilter(
|
|
71
69
|
hookName,
|
|
@@ -81,13 +79,13 @@ describe( 'withFilters', () => {
|
|
|
81
79
|
|
|
82
80
|
const { container } = render( <EnhancedComponent /> );
|
|
83
81
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
82
|
+
await waitFor( () =>
|
|
83
|
+
expect( SpiedComponent ).toHaveBeenCalledTimes( 1 )
|
|
84
|
+
);
|
|
87
85
|
expect( container ).toMatchSnapshot();
|
|
88
86
|
} );
|
|
89
87
|
|
|
90
|
-
it( 'should re-render component once when new filter added after component was mounted', () => {
|
|
88
|
+
it( 'should re-render component once when new filter added after component was mounted', async () => {
|
|
91
89
|
const SpiedComponent = jest.fn( () => <div>Spied component</div> );
|
|
92
90
|
const EnhancedComponent = withFilters( hookName )( SpiedComponent );
|
|
93
91
|
|
|
@@ -106,13 +104,13 @@ describe( 'withFilters', () => {
|
|
|
106
104
|
)
|
|
107
105
|
);
|
|
108
106
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
107
|
+
await waitFor( () =>
|
|
108
|
+
expect( SpiedComponent ).toHaveBeenCalledTimes( 1 )
|
|
109
|
+
);
|
|
112
110
|
expect( container ).toMatchSnapshot();
|
|
113
111
|
} );
|
|
114
112
|
|
|
115
|
-
it( 'should re-render component once when two filters added in the same animation frame', () => {
|
|
113
|
+
it( 'should re-render component once when two filters added in the same animation frame', async () => {
|
|
116
114
|
const SpiedComponent = jest.fn( () => <div>Spied component</div> );
|
|
117
115
|
const EnhancedComponent = withFilters( hookName )( SpiedComponent );
|
|
118
116
|
|
|
@@ -141,13 +139,13 @@ describe( 'withFilters', () => {
|
|
|
141
139
|
)
|
|
142
140
|
);
|
|
143
141
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
142
|
+
await waitFor( () =>
|
|
143
|
+
expect( SpiedComponent ).toHaveBeenCalledTimes( 1 )
|
|
144
|
+
);
|
|
147
145
|
expect( container ).toMatchSnapshot();
|
|
148
146
|
} );
|
|
149
147
|
|
|
150
|
-
it( 'should re-render component twice when new filter added and removed in two different animation frames', () => {
|
|
148
|
+
it( 'should re-render component twice when new filter added and removed in two different animation frames', async () => {
|
|
151
149
|
const SpiedComponent = jest.fn( () => <div>Spied component</div> );
|
|
152
150
|
const EnhancedComponent = withFilters( hookName )( SpiedComponent );
|
|
153
151
|
const { container } = render( <EnhancedComponent /> );
|
|
@@ -165,17 +163,19 @@ describe( 'withFilters', () => {
|
|
|
165
163
|
)
|
|
166
164
|
);
|
|
167
165
|
|
|
168
|
-
|
|
166
|
+
await waitFor( () =>
|
|
167
|
+
expect( SpiedComponent ).toHaveBeenCalledTimes( 1 )
|
|
168
|
+
);
|
|
169
169
|
|
|
170
170
|
removeFilter( hookName, 'test/enhanced-component-spy' );
|
|
171
171
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
172
|
+
await waitFor( () =>
|
|
173
|
+
expect( SpiedComponent ).toHaveBeenCalledTimes( 2 )
|
|
174
|
+
);
|
|
175
175
|
expect( container ).toMatchSnapshot();
|
|
176
176
|
} );
|
|
177
177
|
|
|
178
|
-
it( 'should re-render both components once each when one filter added', () => {
|
|
178
|
+
it( 'should re-render both components once each when one filter added', async () => {
|
|
179
179
|
const SpiedComponent = jest.fn( () => <div>Spied component</div> );
|
|
180
180
|
const EnhancedComponent = withFilters( hookName )( SpiedComponent );
|
|
181
181
|
|
|
@@ -200,9 +200,9 @@ describe( 'withFilters', () => {
|
|
|
200
200
|
)
|
|
201
201
|
);
|
|
202
202
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
203
|
+
await waitFor( () =>
|
|
204
|
+
expect( SpiedComponent ).toHaveBeenCalledTimes( 2 )
|
|
205
|
+
);
|
|
206
206
|
expect( container ).toMatchSnapshot();
|
|
207
207
|
} );
|
|
208
208
|
} );
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { render, screen } from '@testing-library/react';
|
|
4
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
5
5
|
import userEvent from '@testing-library/user-event';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -14,8 +14,6 @@ import { Component } from '@wordpress/element';
|
|
|
14
14
|
*/
|
|
15
15
|
import withFocusOutside from '../';
|
|
16
16
|
|
|
17
|
-
jest.useFakeTimers();
|
|
18
|
-
|
|
19
17
|
let onFocusOutside;
|
|
20
18
|
|
|
21
19
|
describe( 'withFocusOutside', () => {
|
|
@@ -57,7 +55,7 @@ describe( 'withFocusOutside', () => {
|
|
|
57
55
|
document.hasFocus = origHasFocus;
|
|
58
56
|
} );
|
|
59
57
|
|
|
60
|
-
it( 'should not call handler if focus shifts to element within component', () => {
|
|
58
|
+
it( 'should not call handler if focus shifts to element within component', async () => {
|
|
61
59
|
render( <TestComponent onFocusOutside={ onFocusOutside } /> );
|
|
62
60
|
|
|
63
61
|
const input = screen.getByRole( 'textbox' );
|
|
@@ -67,15 +65,11 @@ describe( 'withFocusOutside', () => {
|
|
|
67
65
|
input.blur();
|
|
68
66
|
button.focus();
|
|
69
67
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
expect( onFocusOutside ).not.toHaveBeenCalled();
|
|
68
|
+
await waitFor( () => expect( onFocusOutside ).not.toHaveBeenCalled() );
|
|
73
69
|
} );
|
|
74
70
|
|
|
75
71
|
it( 'should not call handler if focus transitions via click to button', async () => {
|
|
76
|
-
const user = userEvent.setup(
|
|
77
|
-
advanceTimers: jest.advanceTimersByTime,
|
|
78
|
-
} );
|
|
72
|
+
const user = userEvent.setup();
|
|
79
73
|
render( <TestComponent onFocusOutside={ onFocusOutside } /> );
|
|
80
74
|
|
|
81
75
|
const input = screen.getByRole( 'textbox' );
|
|
@@ -84,24 +78,20 @@ describe( 'withFocusOutside', () => {
|
|
|
84
78
|
input.focus();
|
|
85
79
|
await user.click( button );
|
|
86
80
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
expect( onFocusOutside ).not.toHaveBeenCalled();
|
|
81
|
+
await waitFor( () => expect( onFocusOutside ).not.toHaveBeenCalled() );
|
|
90
82
|
} );
|
|
91
83
|
|
|
92
|
-
it( 'should call handler if focus doesn’t shift to element within component', () => {
|
|
84
|
+
it( 'should call handler if focus doesn’t shift to element within component', async () => {
|
|
93
85
|
render( <TestComponent onFocusOutside={ onFocusOutside } /> );
|
|
94
86
|
|
|
95
87
|
const input = screen.getByRole( 'textbox' );
|
|
96
88
|
input.focus();
|
|
97
89
|
input.blur();
|
|
98
90
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
expect( onFocusOutside ).toHaveBeenCalled();
|
|
91
|
+
await waitFor( () => expect( onFocusOutside ).toHaveBeenCalled() );
|
|
102
92
|
} );
|
|
103
93
|
|
|
104
|
-
it( 'should not call handler if focus shifts outside the component when the document does not have focus', () => {
|
|
94
|
+
it( 'should not call handler if focus shifts outside the component when the document does not have focus', async () => {
|
|
105
95
|
render( <TestComponent onFocusOutside={ onFocusOutside } /> );
|
|
106
96
|
|
|
107
97
|
// Force document.hasFocus() to return false to simulate the window/document losing focus
|
|
@@ -112,12 +102,10 @@ describe( 'withFocusOutside', () => {
|
|
|
112
102
|
input.focus();
|
|
113
103
|
input.blur();
|
|
114
104
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
expect( onFocusOutside ).not.toHaveBeenCalled();
|
|
105
|
+
await waitFor( () => expect( onFocusOutside ).not.toHaveBeenCalled() );
|
|
118
106
|
} );
|
|
119
107
|
|
|
120
|
-
it( 'should cancel check when unmounting while queued', () => {
|
|
108
|
+
it( 'should cancel check when unmounting while queued', async () => {
|
|
121
109
|
const { rerender } = render(
|
|
122
110
|
<TestComponent onFocusOutside={ onFocusOutside } />
|
|
123
111
|
);
|
|
@@ -128,8 +116,6 @@ describe( 'withFocusOutside', () => {
|
|
|
128
116
|
|
|
129
117
|
rerender( <div /> );
|
|
130
118
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
expect( onFocusOutside ).not.toHaveBeenCalled();
|
|
119
|
+
await waitFor( () => expect( onFocusOutside ).not.toHaveBeenCalled() );
|
|
134
120
|
} );
|
|
135
121
|
} );
|
|
@@ -14,8 +14,6 @@ import { Component } from '@wordpress/element';
|
|
|
14
14
|
*/
|
|
15
15
|
import withFocusReturn from '../';
|
|
16
16
|
|
|
17
|
-
jest.useFakeTimers();
|
|
18
|
-
|
|
19
17
|
class Test extends Component {
|
|
20
18
|
render() {
|
|
21
19
|
const { className, focusHistory } = this.props;
|
|
@@ -86,9 +84,7 @@ describe( 'withFocusReturn()', () => {
|
|
|
86
84
|
} );
|
|
87
85
|
|
|
88
86
|
it( 'should switch focus back when unmounted while having focus', async () => {
|
|
89
|
-
const user = userEvent.setup(
|
|
90
|
-
advanceTimers: jest.advanceTimersByTime,
|
|
91
|
-
} );
|
|
87
|
+
const user = userEvent.setup();
|
|
92
88
|
|
|
93
89
|
const { unmount } = render( <Composite />, {
|
|
94
90
|
container: document.body.appendChild(
|
package/src/index.js
CHANGED
|
@@ -155,12 +155,14 @@ export {
|
|
|
155
155
|
ToggleGroupControlOption as __experimentalToggleGroupControlOption,
|
|
156
156
|
ToggleGroupControlOptionIcon as __experimentalToggleGroupControlOptionIcon,
|
|
157
157
|
} from './toggle-group-control';
|
|
158
|
-
export {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
158
|
+
export {
|
|
159
|
+
Toolbar,
|
|
160
|
+
ToolbarButton,
|
|
161
|
+
ToolbarContext as __experimentalToolbarContext,
|
|
162
|
+
ToolbarDropdownMenu,
|
|
163
|
+
ToolbarGroup,
|
|
164
|
+
ToolbarItem,
|
|
165
|
+
} from './toolbar';
|
|
164
166
|
export {
|
|
165
167
|
ToolsPanel as __experimentalToolsPanel,
|
|
166
168
|
ToolsPanelItem as __experimentalToolsPanelItem,
|
package/src/index.native.js
CHANGED
|
@@ -15,12 +15,14 @@ export { default as Dashicon } from './dashicon';
|
|
|
15
15
|
export { default as Dropdown } from './dropdown';
|
|
16
16
|
export { default as DropdownMenu } from './dropdown-menu';
|
|
17
17
|
export { default as FocalPointPicker } from './focal-point-picker';
|
|
18
|
-
export {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
export {
|
|
19
|
+
Toolbar,
|
|
20
|
+
ToolbarButton,
|
|
21
|
+
ToolbarContext as __experimentalToolbarContext,
|
|
22
|
+
ToolbarDropdownMenu,
|
|
23
|
+
ToolbarGroup,
|
|
24
|
+
ToolbarItem,
|
|
25
|
+
} from './toolbar';
|
|
24
26
|
export { default as Tooltip } from './tooltip';
|
|
25
27
|
export { default as Icon } from './icon';
|
|
26
28
|
export { default as Spinner } from './spinner';
|
|
@@ -226,7 +226,9 @@ function InputField(
|
|
|
226
226
|
onMouseDown={ handleOnMouseDown }
|
|
227
227
|
ref={ ref }
|
|
228
228
|
inputSize={ size }
|
|
229
|
-
|
|
229
|
+
// Fallback to `''` to avoid "uncontrolled to controlled" warning.
|
|
230
|
+
// See https://github.com/WordPress/gutenberg/pull/47250 for details.
|
|
231
|
+
value={ value ?? '' }
|
|
230
232
|
type={ type }
|
|
231
233
|
/>
|
|
232
234
|
);
|
|
@@ -14,12 +14,7 @@ import { useState } from '@wordpress/element';
|
|
|
14
14
|
*/
|
|
15
15
|
import BaseInputControl from '../';
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const setupUser = () =>
|
|
20
|
-
userEvent.setup( {
|
|
21
|
-
advanceTimers: jest.advanceTimersByTime,
|
|
22
|
-
} );
|
|
17
|
+
const setupUser = () => userEvent.setup();
|
|
23
18
|
|
|
24
19
|
const getInput = () => screen.getByTestId( 'input' );
|
|
25
20
|
|
|
@@ -9,13 +9,9 @@ import userEvent from '@testing-library/user-event';
|
|
|
9
9
|
*/
|
|
10
10
|
import IsolatedEventContainer from '../';
|
|
11
11
|
|
|
12
|
-
jest.useFakeTimers();
|
|
13
|
-
|
|
14
12
|
describe( 'IsolatedEventContainer', () => {
|
|
15
13
|
it( 'should pass props to container', async () => {
|
|
16
|
-
const user = userEvent.setup(
|
|
17
|
-
advanceTimers: jest.advanceTimersByTime,
|
|
18
|
-
} );
|
|
14
|
+
const user = userEvent.setup();
|
|
19
15
|
const clickHandler = jest.fn();
|
|
20
16
|
render(
|
|
21
17
|
<IsolatedEventContainer
|
|
@@ -47,9 +43,7 @@ describe( 'IsolatedEventContainer', () => {
|
|
|
47
43
|
} );
|
|
48
44
|
|
|
49
45
|
it( 'should stop event propagation only for mousedown, but not for keydown', async () => {
|
|
50
|
-
const user = userEvent.setup(
|
|
51
|
-
advanceTimers: jest.advanceTimersByTime,
|
|
52
|
-
} );
|
|
46
|
+
const user = userEvent.setup();
|
|
53
47
|
|
|
54
48
|
const mousedownHandler = jest.fn();
|
|
55
49
|
const keydownHandler = jest.fn();
|
|
@@ -11,7 +11,7 @@ import { useItem } from './hook';
|
|
|
11
11
|
import { contextConnect, WordPressComponentProps } from '../../ui/context';
|
|
12
12
|
import { View } from '../../view';
|
|
13
13
|
|
|
14
|
-
function
|
|
14
|
+
function UnconnectedItem(
|
|
15
15
|
props: WordPressComponentProps< ItemProps, 'div' >,
|
|
16
16
|
forwardedRef: ForwardedRef< any >
|
|
17
17
|
) {
|
|
@@ -24,4 +24,28 @@ function Item(
|
|
|
24
24
|
);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
/**
|
|
28
|
+
* `Item` is used in combination with `ItemGroup` to display a list of items
|
|
29
|
+
* grouped and styled together.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```jsx
|
|
33
|
+
* import {
|
|
34
|
+
* __experimentalItemGroup as ItemGroup,
|
|
35
|
+
* __experimentalItem as Item,
|
|
36
|
+
* } from '@wordpress/components';
|
|
37
|
+
*
|
|
38
|
+
* function Example() {
|
|
39
|
+
* return (
|
|
40
|
+
* <ItemGroup>
|
|
41
|
+
* <Item>Code</Item>
|
|
42
|
+
* <Item>is</Item>
|
|
43
|
+
* <Item>Poetry</Item>
|
|
44
|
+
* </ItemGroup>
|
|
45
|
+
* );
|
|
46
|
+
* }
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export const Item = contextConnect( UnconnectedItem, 'Item' );
|
|
50
|
+
|
|
51
|
+
export default Item;
|
|
@@ -12,7 +12,7 @@ import { ItemGroupContext, useItemGroupContext } from '../context';
|
|
|
12
12
|
import { View } from '../../view';
|
|
13
13
|
import type { ItemGroupProps } from '../types';
|
|
14
14
|
|
|
15
|
-
function
|
|
15
|
+
function UnconnectedItemGroup(
|
|
16
16
|
props: WordPressComponentProps< ItemGroupProps, 'div' >,
|
|
17
17
|
forwardedRef: ForwardedRef< any >
|
|
18
18
|
) {
|
|
@@ -40,4 +40,27 @@ function ItemGroup(
|
|
|
40
40
|
);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
/**
|
|
44
|
+
* `ItemGroup` displays a list of `Item`s grouped and styled together.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```jsx
|
|
48
|
+
* import {
|
|
49
|
+
* __experimentalItemGroup as ItemGroup,
|
|
50
|
+
* __experimentalItem as Item,
|
|
51
|
+
* } from '@wordpress/components';
|
|
52
|
+
*
|
|
53
|
+
* function Example() {
|
|
54
|
+
* return (
|
|
55
|
+
* <ItemGroup>
|
|
56
|
+
* <Item>Code</Item>
|
|
57
|
+
* <Item>is</Item>
|
|
58
|
+
* <Item>Poetry</Item>
|
|
59
|
+
* </ItemGroup>
|
|
60
|
+
* );
|
|
61
|
+
* }
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export const ItemGroup = contextConnect( UnconnectedItemGroup, 'ItemGroup' );
|
|
65
|
+
|
|
66
|
+
export default ItemGroup;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { ItemGroup } from '../item-group/component';
|
|
10
|
+
import { Item } from '../item/component';
|
|
11
|
+
|
|
12
|
+
type ItemProps = React.ComponentPropsWithoutRef< typeof Item >;
|
|
13
|
+
|
|
14
|
+
const meta: ComponentMeta< typeof ItemGroup > = {
|
|
15
|
+
component: ItemGroup,
|
|
16
|
+
title: 'Components (Experimental)/ItemGroup',
|
|
17
|
+
subcomponents: { Item },
|
|
18
|
+
argTypes: {
|
|
19
|
+
as: { control: { type: null } },
|
|
20
|
+
children: { control: { type: null } },
|
|
21
|
+
},
|
|
22
|
+
parameters: {
|
|
23
|
+
controls: { expanded: true },
|
|
24
|
+
docs: { source: { state: 'open' } },
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
export default meta;
|
|
28
|
+
|
|
29
|
+
const mapPropsToItem = ( props: ItemProps, index: number ) => (
|
|
30
|
+
<Item { ...props } key={ index } />
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
const Template: ComponentStory< typeof ItemGroup > = ( props ) => (
|
|
34
|
+
<ItemGroup { ...props } />
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
export const Default: ComponentStory< typeof ItemGroup > = Template.bind( {} );
|
|
38
|
+
Default.args = {
|
|
39
|
+
children: (
|
|
40
|
+
[
|
|
41
|
+
{
|
|
42
|
+
children: 'First item',
|
|
43
|
+
// eslint-disable-next-line no-alert
|
|
44
|
+
onClick: () => alert( 'First item clicked' ),
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
children: 'Second item',
|
|
48
|
+
// eslint-disable-next-line no-alert
|
|
49
|
+
onClick: () => alert( 'Second item clicked' ),
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
children: 'Third item',
|
|
53
|
+
// eslint-disable-next-line no-alert
|
|
54
|
+
onClick: () => alert( 'Third item clicked' ),
|
|
55
|
+
},
|
|
56
|
+
] as ItemProps[]
|
|
57
|
+
).map( mapPropsToItem ),
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const NonClickableItems: ComponentStory< typeof ItemGroup > =
|
|
61
|
+
Template.bind( {} );
|
|
62
|
+
NonClickableItems.args = {
|
|
63
|
+
children: (
|
|
64
|
+
[
|
|
65
|
+
{
|
|
66
|
+
children:
|
|
67
|
+
"This <Item /> is not click-able because it doesn't have an `onClick` prop",
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
children:
|
|
71
|
+
"This <Item /> is also not click-able because it doesn't have an `onClick` prop",
|
|
72
|
+
},
|
|
73
|
+
] as ItemProps[]
|
|
74
|
+
).map( mapPropsToItem ),
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export const CustomItemSize: ComponentStory< typeof ItemGroup > = Template.bind(
|
|
78
|
+
{}
|
|
79
|
+
);
|
|
80
|
+
CustomItemSize.args = {
|
|
81
|
+
children: (
|
|
82
|
+
[
|
|
83
|
+
{
|
|
84
|
+
children:
|
|
85
|
+
'This <Item /> will inherit the size from <ItemGroup /> (try changing the size prop)',
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
children:
|
|
89
|
+
'This <Item /> has a hardcoded size="large", regardless of <ItemGroup />\'s size',
|
|
90
|
+
size: 'large',
|
|
91
|
+
},
|
|
92
|
+
] as ItemProps[]
|
|
93
|
+
).map( mapPropsToItem ),
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export const WithBorder: ComponentStory< typeof ItemGroup > = Template.bind(
|
|
97
|
+
{}
|
|
98
|
+
);
|
|
99
|
+
WithBorder.args = {
|
|
100
|
+
...Default.args,
|
|
101
|
+
isBordered: true,
|
|
102
|
+
isSeparated: true,
|
|
103
|
+
};
|