@wordpress/components 23.0.0 → 23.2.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 +29 -0
- package/CONTRIBUTING.md +0 -21
- package/LICENSE.md +1 -1
- package/build/autocomplete/index.js +1 -3
- package/build/autocomplete/index.js.map +1 -1
- package/build/border-box-control/border-box-control/component.js +0 -3
- package/build/border-box-control/border-box-control/component.js.map +1 -1
- package/build/border-box-control/border-box-control/hook.js +0 -2
- package/build/border-box-control/border-box-control/hook.js.map +1 -1
- package/build/border-box-control/border-box-control-split-controls/component.js +0 -2
- package/build/border-box-control/border-box-control-split-controls/component.js.map +1 -1
- package/build/border-box-control/border-box-control-split-controls/hook.js +0 -2
- package/build/border-box-control/border-box-control-split-controls/hook.js.map +1 -1
- package/build/border-control/border-control/component.js +0 -2
- package/build/border-control/border-control/component.js.map +1 -1
- package/build/border-control/border-control/hook.js +0 -2
- package/build/border-control/border-control/hook.js.map +1 -1
- package/build/border-control/border-control-dropdown/component.js +6 -11
- package/build/border-control/border-control-dropdown/component.js.map +1 -1
- package/build/border-control/border-control-dropdown/hook.js +0 -2
- package/build/border-control/border-control-dropdown/hook.js.map +1 -1
- package/build/color-palette/index.js +5 -8
- package/build/color-palette/index.js.map +1 -1
- 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/dimension-control/index.js.map +1 -1
- package/build/dropdown/index.js +45 -10
- 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/gradient-picker/index.js +1 -2
- package/build/gradient-picker/index.js.map +1 -1
- package/build/higher-order/navigate-regions/index.js +4 -3
- package/build/higher-order/navigate-regions/index.js.map +1 -1
- package/build/index.js +7 -25
- package/build/index.js.map +1 -1
- package/build/index.native.js +8 -18
- package/build/index.native.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/mobile/bottom-sheet/picker-cell.native.js +1 -9
- package/build/mobile/bottom-sheet/picker-cell.native.js.map +1 -1
- package/build/mobile/global-styles-context/utils.native.js +30 -12
- package/build/mobile/global-styles-context/utils.native.js.map +1 -1
- package/build/panel/row.js +5 -3
- package/build/panel/row.js.map +1 -1
- package/build/query-controls/index.js +1 -0
- package/build/query-controls/index.js.map +1 -1
- 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/tab-panel/index.js +15 -9
- 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 +3 -3
- package/build/tree-grid/index.js.map +1 -1
- package/build-module/autocomplete/index.js +1 -2
- package/build-module/autocomplete/index.js.map +1 -1
- package/build-module/border-box-control/border-box-control/component.js +0 -3
- package/build-module/border-box-control/border-box-control/component.js.map +1 -1
- package/build-module/border-box-control/border-box-control/hook.js +0 -2
- package/build-module/border-box-control/border-box-control/hook.js.map +1 -1
- package/build-module/border-box-control/border-box-control-split-controls/component.js +0 -2
- package/build-module/border-box-control/border-box-control-split-controls/component.js.map +1 -1
- package/build-module/border-box-control/border-box-control-split-controls/hook.js +0 -2
- package/build-module/border-box-control/border-box-control-split-controls/hook.js.map +1 -1
- package/build-module/border-control/border-control/component.js +0 -2
- package/build-module/border-control/border-control/component.js.map +1 -1
- package/build-module/border-control/border-control/hook.js +0 -2
- package/build-module/border-control/border-control/hook.js.map +1 -1
- package/build-module/border-control/border-control-dropdown/component.js +6 -11
- package/build-module/border-control/border-control-dropdown/component.js.map +1 -1
- package/build-module/border-control/border-control-dropdown/hook.js +0 -2
- package/build-module/border-control/border-control-dropdown/hook.js.map +1 -1
- package/build-module/color-palette/index.js +5 -8
- package/build-module/color-palette/index.js.map +1 -1
- 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/dimension-control/index.js +1 -2
- package/build-module/dimension-control/index.js.map +1 -1
- package/build-module/dropdown/index.js +44 -10
- 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/gradient-picker/index.js +1 -2
- package/build-module/gradient-picker/index.js.map +1 -1
- package/build-module/higher-order/navigate-regions/index.js +4 -3
- package/build-module/higher-order/navigate-regions/index.js.map +1 -1
- package/build-module/index.js +1 -7
- 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/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/mobile/bottom-sheet/picker-cell.native.js +1 -8
- package/build-module/mobile/bottom-sheet/picker-cell.native.js.map +1 -1
- package/build-module/mobile/global-styles-context/utils.native.js +31 -13
- package/build-module/mobile/global-styles-context/utils.native.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/index.js +1 -0
- package/build-module/query-controls/index.js.map +1 -1
- 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/tab-panel/index.js +15 -8
- 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 +3 -3
- package/build-module/tree-grid/index.js.map +1 -1
- package/build-style/style-rtl.css +19 -32
- package/build-style/style.css +19 -32
- package/build-types/border-box-control/border-box-control/component.d.ts +1 -1
- package/build-types/border-box-control/border-box-control/component.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control/hook.d.ts +0 -1
- package/build-types/border-box-control/border-box-control/hook.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control-split-controls/component.d.ts +1 -1
- package/build-types/border-box-control/border-box-control-split-controls/component.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +0 -1
- package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts.map +1 -1
- package/build-types/border-box-control/stories/index.d.ts +1 -1
- package/build-types/border-control/border-control/component.d.ts +1 -1
- package/build-types/border-control/border-control/component.d.ts.map +1 -1
- package/build-types/border-control/border-control/hook.d.ts +0 -1
- package/build-types/border-control/border-control/hook.d.ts.map +1 -1
- package/build-types/border-control/border-control-dropdown/component.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 +0 -1
- package/build-types/border-control/border-control-dropdown/hook.d.ts.map +1 -1
- package/build-types/border-control/stories/index.d.ts +6 -6
- package/build-types/border-control/stories/index.d.ts.map +1 -1
- package/build-types/border-control/types.d.ts +1 -1
- package/build-types/border-control/types.d.ts.map +1 -1
- package/build-types/color-palette/index.d.ts +2 -3
- package/build-types/color-palette/index.d.ts.map +1 -1
- package/build-types/color-palette/stories/index.d.ts +2 -9
- package/build-types/color-palette/stories/index.d.ts.map +1 -1
- package/build-types/color-palette/types.d.ts +3 -16
- package/build-types/color-palette/types.d.ts.map +1 -1
- package/build-types/color-picker/component.d.ts.map +1 -1
- 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/disabled/stories/index.d.ts.map +1 -1
- package/build-types/dropdown/index.d.ts +29 -1
- package/build-types/dropdown/index.d.ts.map +1 -1
- package/build-types/dropdown/stories/index.d.ts +23 -0
- package/build-types/dropdown/stories/index.d.ts.map +1 -0
- package/build-types/dropdown/test/index.d.ts +2 -0
- package/build-types/dropdown/test/index.d.ts.map +1 -0
- package/build-types/dropdown/types.d.ts +101 -0
- 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/icon/stories/index.d.ts +22 -0
- package/build-types/icon/stories/index.d.ts.map +1 -0
- 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/radio-context/index.d.ts +6 -0
- package/build-types/radio-context/index.d.ts.map +1 -0
- 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/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 +10 -4
- package/build-types/tab-panel/types.d.ts.map +1 -1
- package/package.json +17 -17
- package/src/autocomplete/index.js +1 -3
- package/src/autocomplete/test/index.js +2 -0
- package/src/base-control/test/index.tsx +1 -0
- package/src/border-box-control/border-box-control/component.tsx +0 -7
- package/src/border-box-control/border-box-control/hook.ts +0 -2
- package/src/border-box-control/border-box-control-split-controls/component.tsx +0 -2
- package/src/border-box-control/border-box-control-split-controls/hook.ts +0 -2
- package/src/border-box-control/test/index.js +2 -0
- package/src/border-control/border-control/component.tsx +0 -4
- package/src/border-control/border-control/hook.ts +0 -2
- package/src/border-control/border-control-dropdown/component.tsx +11 -17
- package/src/border-control/border-control-dropdown/hook.ts +0 -2
- package/src/border-control/stories/index.tsx +0 -1
- package/src/border-control/test/index.js +70 -67
- package/src/border-control/types.ts +1 -4
- package/src/box-control/test/index.js +2 -0
- package/src/checkbox-control/test/index.tsx +2 -0
- package/src/color-palette/index.tsx +12 -12
- package/src/color-palette/stories/index.tsx +0 -13
- package/src/color-palette/test/index.tsx +2 -0
- package/src/color-palette/types.ts +3 -17
- 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 +2 -0
- package/src/combobox-control/index.js +9 -1
- package/src/combobox-control/test/index.js +2 -0
- package/src/confirm-dialog/test/index.js +2 -0
- package/src/dashicon/types.ts +0 -6
- package/src/date-time/date/test/index.tsx +2 -0
- package/src/date-time/time/test/index.tsx +2 -0
- package/src/dimension-control/index.js +2 -3
- package/src/dimension-control/test/index.test.js +2 -0
- package/src/disabled/stories/index.tsx +6 -2
- package/src/disabled/test/index.tsx +2 -0
- package/src/dropdown/README.md +41 -46
- package/src/dropdown/{index.js → index.tsx} +57 -13
- package/src/dropdown/stories/{index.js → index.tsx} +21 -8
- package/src/dropdown/test/{index.js → index.tsx} +9 -9
- package/src/dropdown/types.ts +107 -0
- package/src/dropdown-menu/README.md +2 -3
- package/src/dropdown-menu/test/index.js +2 -0
- package/src/external-link/test/index.tsx +2 -0
- package/src/focal-point-picker/stories/index.tsx +1 -1
- package/src/focal-point-picker/test/index.js +2 -0
- package/src/focal-point-picker/utils.ts +4 -1
- package/src/font-size-picker/test/index.tsx +2 -0
- package/src/form-file-upload/test/index.tsx +2 -0
- package/src/form-toggle/test/index.tsx +2 -0
- package/src/form-token-field/test/index.tsx +3 -0
- package/src/gradient-picker/index.js +1 -2
- package/src/gradient-picker/stories/index.js +0 -1
- package/src/guide/stories/index.js +14 -41
- package/src/guide/test/index.js +2 -0
- package/src/higher-order/navigate-regions/index.js +5 -2
- package/src/higher-order/navigate-regions/style.scss +13 -39
- package/src/higher-order/with-filters/test/index.js +70 -74
- package/src/higher-order/with-focus-outside/test/index.js +2 -0
- package/src/higher-order/with-focus-return/test/index.js +2 -0
- package/src/higher-order/with-notices/test/index.js +1 -0
- package/src/icon/stories/index.tsx +103 -0
- package/src/index.js +8 -7
- package/src/index.native.js +8 -6
- package/src/input-control/test/index.js +3 -0
- package/src/isolated-event-container/test/index.js +2 -0
- 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/mobile/bottom-sheet/picker-cell.native.js +1 -6
- package/src/mobile/global-styles-context/utils.native.js +17 -16
- package/src/modal/test/index.tsx +1 -3
- package/src/navigable-container/test/navigable-menu.js +2 -0
- package/src/navigable-container/test/tababble-container.js +2 -0
- package/src/navigation/test/index.js +2 -0
- package/src/navigator/test/index.tsx +2 -0
- package/src/notice/stories/index.js +30 -58
- package/src/notice/test/index.js +8 -3
- package/src/number-control/test/index.tsx +2 -0
- package/src/panel/row.js +3 -3
- package/src/panel/stories/index.js +62 -80
- package/src/panel/test/__snapshots__/body.js.snap +9 -0
- package/src/panel/test/body.js +71 -62
- package/src/placeholder/style.scss +1 -1
- package/src/placeholder/test/index.tsx +3 -0
- package/src/query-controls/index.js +1 -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 +2 -0
- package/src/slot-fill/stories/index.js +12 -17
- package/src/style.scss +3 -3
- package/src/tab-panel/README.md +1 -0
- package/src/tab-panel/index.tsx +20 -7
- package/src/tab-panel/stories/index.tsx +20 -0
- package/src/tab-panel/test/index.tsx +91 -0
- package/src/tab-panel/types.ts +10 -4
- package/src/text-highlight/test/index.tsx +1 -0
- package/src/toggle-group-control/test/index.tsx +2 -0
- package/src/toolbar/index.js +6 -52
- package/src/toolbar/stories/index.js +2 -9
- package/src/{toolbar-button/stories/index.js → toolbar/stories/toolbar-button.js} +1 -2
- package/src/{toolbar-group/stories/index.js → toolbar/stories/toolbar-group.js} +1 -1
- package/src/toolbar/test/index.js +1 -2
- package/src/{toolbar-group/test/index.js → toolbar/test/toolbar-group.js} +3 -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} +1 -1
- 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/tooltip/stories/index.js +68 -78
- package/src/tooltip/test/index.js +2 -0
- package/src/tree-grid/index.js +2 -4
- package/src/unit-control/test/index.tsx +3 -0
- package/src/utils/hooks/test/use-latest-ref.js +2 -0
- package/tsconfig.json +0 -7
- 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/icon/stories/index.js +0 -128
- package/src/item-group/stories/index.js +0 -270
- package/src/resizable-box/stories/index.js +0 -97
|
@@ -13,6 +13,8 @@ import { addFilter, removeAllFilters, removeFilter } from '@wordpress/hooks';
|
|
|
13
13
|
*/
|
|
14
14
|
import withFilters from '..';
|
|
15
15
|
|
|
16
|
+
jest.useFakeTimers();
|
|
17
|
+
|
|
16
18
|
describe( 'withFilters', () => {
|
|
17
19
|
const hookName = 'EnhancedComponent';
|
|
18
20
|
const MyComponent = () => <div>My component</div>;
|
|
@@ -79,14 +81,13 @@ describe( 'withFilters', () => {
|
|
|
79
81
|
|
|
80
82
|
const { container } = render( <EnhancedComponent /> );
|
|
81
83
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
jest.runAllTimers();
|
|
84
|
+
act( () => jest.runAllTimers() );
|
|
85
85
|
|
|
86
86
|
expect( SpiedComponent ).toHaveBeenCalledTimes( 1 );
|
|
87
|
+
expect( container ).toMatchSnapshot();
|
|
87
88
|
} );
|
|
88
89
|
|
|
89
|
-
it( 'should re-render component once when new filter added after component was mounted',
|
|
90
|
+
it( 'should re-render component once when new filter added after component was mounted', () => {
|
|
90
91
|
const SpiedComponent = jest.fn( () => <div>Spied component</div> );
|
|
91
92
|
const EnhancedComponent = withFilters( hookName )( SpiedComponent );
|
|
92
93
|
|
|
@@ -94,25 +95,24 @@ describe( 'withFilters', () => {
|
|
|
94
95
|
|
|
95
96
|
SpiedComponent.mockClear();
|
|
96
97
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
(
|
|
102
|
-
|
|
103
|
-
<
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
} );
|
|
98
|
+
addFilter(
|
|
99
|
+
hookName,
|
|
100
|
+
'test/enhanced-component-spy-1',
|
|
101
|
+
( FilteredComponent ) => () =>
|
|
102
|
+
(
|
|
103
|
+
<blockquote>
|
|
104
|
+
<FilteredComponent />
|
|
105
|
+
</blockquote>
|
|
106
|
+
)
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
act( () => jest.runAllTimers() );
|
|
110
110
|
|
|
111
111
|
expect( SpiedComponent ).toHaveBeenCalledTimes( 1 );
|
|
112
112
|
expect( container ).toMatchSnapshot();
|
|
113
113
|
} );
|
|
114
114
|
|
|
115
|
-
it( 'should re-render component once when two filters added in the same animation frame',
|
|
115
|
+
it( 'should re-render component once when two filters added in the same animation frame', () => {
|
|
116
116
|
const SpiedComponent = jest.fn( () => <div>Spied component</div> );
|
|
117
117
|
const EnhancedComponent = withFilters( hookName )( SpiedComponent );
|
|
118
118
|
|
|
@@ -120,65 +120,62 @@ describe( 'withFilters', () => {
|
|
|
120
120
|
|
|
121
121
|
SpiedComponent.mockClear();
|
|
122
122
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
(
|
|
128
|
-
|
|
129
|
-
<
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
(
|
|
138
|
-
|
|
139
|
-
<
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
} );
|
|
123
|
+
addFilter(
|
|
124
|
+
hookName,
|
|
125
|
+
'test/enhanced-component-spy-1',
|
|
126
|
+
( FilteredComponent ) => () =>
|
|
127
|
+
(
|
|
128
|
+
<blockquote>
|
|
129
|
+
<FilteredComponent />
|
|
130
|
+
</blockquote>
|
|
131
|
+
)
|
|
132
|
+
);
|
|
133
|
+
addFilter(
|
|
134
|
+
hookName,
|
|
135
|
+
'test/enhanced-component-spy-2',
|
|
136
|
+
( FilteredComponent ) => () =>
|
|
137
|
+
(
|
|
138
|
+
<section>
|
|
139
|
+
<FilteredComponent />
|
|
140
|
+
</section>
|
|
141
|
+
)
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
act( () => jest.runAllTimers() );
|
|
146
145
|
|
|
147
146
|
expect( SpiedComponent ).toHaveBeenCalledTimes( 1 );
|
|
148
147
|
expect( container ).toMatchSnapshot();
|
|
149
148
|
} );
|
|
150
149
|
|
|
151
|
-
it( 'should re-render component twice when new filter added and removed in two different animation frames',
|
|
150
|
+
it( 'should re-render component twice when new filter added and removed in two different animation frames', () => {
|
|
152
151
|
const SpiedComponent = jest.fn( () => <div>Spied component</div> );
|
|
153
152
|
const EnhancedComponent = withFilters( hookName )( SpiedComponent );
|
|
154
153
|
const { container } = render( <EnhancedComponent /> );
|
|
155
154
|
|
|
156
155
|
SpiedComponent.mockClear();
|
|
157
156
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
(
|
|
163
|
-
|
|
164
|
-
<
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
jest.runAllTimers();
|
|
175
|
-
} );
|
|
157
|
+
addFilter(
|
|
158
|
+
hookName,
|
|
159
|
+
'test/enhanced-component-spy',
|
|
160
|
+
( FilteredComponent ) => () =>
|
|
161
|
+
(
|
|
162
|
+
<div>
|
|
163
|
+
<FilteredComponent />
|
|
164
|
+
</div>
|
|
165
|
+
)
|
|
166
|
+
);
|
|
167
|
+
|
|
168
|
+
act( () => jest.runAllTimers() );
|
|
169
|
+
|
|
170
|
+
removeFilter( hookName, 'test/enhanced-component-spy' );
|
|
171
|
+
|
|
172
|
+
act( () => jest.runAllTimers() );
|
|
176
173
|
|
|
177
174
|
expect( SpiedComponent ).toHaveBeenCalledTimes( 2 );
|
|
178
175
|
expect( container ).toMatchSnapshot();
|
|
179
176
|
} );
|
|
180
177
|
|
|
181
|
-
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', () => {
|
|
182
179
|
const SpiedComponent = jest.fn( () => <div>Spied component</div> );
|
|
183
180
|
const EnhancedComponent = withFilters( hookName )( SpiedComponent );
|
|
184
181
|
|
|
@@ -192,19 +189,18 @@ describe( 'withFilters', () => {
|
|
|
192
189
|
|
|
193
190
|
SpiedComponent.mockClear();
|
|
194
191
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
(
|
|
200
|
-
|
|
201
|
-
<
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
} );
|
|
192
|
+
addFilter(
|
|
193
|
+
hookName,
|
|
194
|
+
'test/enhanced-component-spy-1',
|
|
195
|
+
( FilteredComponent ) => () =>
|
|
196
|
+
(
|
|
197
|
+
<blockquote>
|
|
198
|
+
<FilteredComponent />
|
|
199
|
+
</blockquote>
|
|
200
|
+
)
|
|
201
|
+
);
|
|
202
|
+
|
|
203
|
+
act( () => jest.runAllTimers() );
|
|
208
204
|
|
|
209
205
|
expect( SpiedComponent ).toHaveBeenCalledTimes( 2 );
|
|
210
206
|
expect( container ).toMatchSnapshot();
|
|
@@ -101,6 +101,7 @@ describe( 'withNotices operations', () => {
|
|
|
101
101
|
act( () => {
|
|
102
102
|
handle.current.createErrorNotice( message );
|
|
103
103
|
} );
|
|
104
|
+
// eslint-disable-next-line testing-library/no-node-access
|
|
104
105
|
expect( getByText( message )?.closest( '.is-error' ) ).not.toBeNull();
|
|
105
106
|
} );
|
|
106
107
|
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { SVG, Path } from '@wordpress/primitives';
|
|
10
|
+
import { wordpress } from '@wordpress/icons';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Internal dependencies
|
|
14
|
+
*/
|
|
15
|
+
import Icon from '..';
|
|
16
|
+
import { VStack } from '../../v-stack';
|
|
17
|
+
|
|
18
|
+
const meta: ComponentMeta< typeof Icon > = {
|
|
19
|
+
title: 'Components/Icon',
|
|
20
|
+
component: Icon,
|
|
21
|
+
parameters: {
|
|
22
|
+
controls: { expanded: true },
|
|
23
|
+
docs: { source: { state: 'open' } },
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
export default meta;
|
|
27
|
+
|
|
28
|
+
const Template: ComponentStory< typeof Icon > = ( args ) => (
|
|
29
|
+
<Icon { ...args } />
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
export const Default = Template.bind( {} );
|
|
33
|
+
Default.args = {
|
|
34
|
+
icon: wordpress,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const FillColor: ComponentStory< typeof Icon > = ( args ) => {
|
|
38
|
+
return (
|
|
39
|
+
<div
|
|
40
|
+
style={ {
|
|
41
|
+
fill: 'blue',
|
|
42
|
+
} }
|
|
43
|
+
>
|
|
44
|
+
<Icon { ...args } />
|
|
45
|
+
</div>
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
FillColor.args = {
|
|
49
|
+
...Default.args,
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const WithAFunction = Template.bind( {} );
|
|
53
|
+
WithAFunction.args = {
|
|
54
|
+
...Default.args,
|
|
55
|
+
icon: () => (
|
|
56
|
+
<SVG>
|
|
57
|
+
<Path d="M5 4v3h5.5v12h3V7H19V4z" />
|
|
58
|
+
</SVG>
|
|
59
|
+
),
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const MyIconComponent = () => (
|
|
63
|
+
<SVG>
|
|
64
|
+
<Path d="M5 4v3h5.5v12h3V7H19V4z" />
|
|
65
|
+
</SVG>
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
export const WithAComponent = Template.bind( {} );
|
|
69
|
+
WithAComponent.args = {
|
|
70
|
+
...Default.args,
|
|
71
|
+
icon: MyIconComponent,
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const WithAnSVG = Template.bind( {} );
|
|
75
|
+
WithAnSVG.args = {
|
|
76
|
+
...Default.args,
|
|
77
|
+
icon: (
|
|
78
|
+
<SVG>
|
|
79
|
+
<Path d="M5 4v3h5.5v12h3V7H19V4z" />
|
|
80
|
+
</SVG>
|
|
81
|
+
),
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Although it's preferred to use icons from the `@wordpress/icons` package, Dashicons are still supported,
|
|
86
|
+
* as long as you are in a context where the Dashicons stylesheet is loaded. To simulate that here,
|
|
87
|
+
* use the Global CSS Injector in the Storybook toolbar at the top and select the "WordPress" preset.
|
|
88
|
+
*/
|
|
89
|
+
export const WithADashicon: ComponentStory< typeof Icon > = ( args ) => {
|
|
90
|
+
return (
|
|
91
|
+
<VStack>
|
|
92
|
+
<Icon { ...args } />
|
|
93
|
+
<small>
|
|
94
|
+
This won’t show an icon if the Dashicons stylesheet isn’t
|
|
95
|
+
loaded.
|
|
96
|
+
</small>
|
|
97
|
+
</VStack>
|
|
98
|
+
);
|
|
99
|
+
};
|
|
100
|
+
WithADashicon.args = {
|
|
101
|
+
...Default.args,
|
|
102
|
+
icon: 'wordpress',
|
|
103
|
+
};
|
package/src/index.js
CHANGED
|
@@ -148,7 +148,6 @@ export { Text as __experimentalText } from './text';
|
|
|
148
148
|
export { default as TextControl } from './text-control';
|
|
149
149
|
export { default as TextareaControl } from './textarea-control';
|
|
150
150
|
export { default as TextHighlight } from './text-highlight';
|
|
151
|
-
export { default as __experimentalTheme } from './theme';
|
|
152
151
|
export { default as Tip } from './tip';
|
|
153
152
|
export { default as ToggleControl } from './toggle-control';
|
|
154
153
|
export {
|
|
@@ -156,12 +155,14 @@ export {
|
|
|
156
155
|
ToggleGroupControlOption as __experimentalToggleGroupControlOption,
|
|
157
156
|
ToggleGroupControlOptionIcon as __experimentalToggleGroupControlOptionIcon,
|
|
158
157
|
} from './toggle-group-control';
|
|
159
|
-
export {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
158
|
+
export {
|
|
159
|
+
Toolbar,
|
|
160
|
+
ToolbarButton,
|
|
161
|
+
ToolbarContext as __experimentalToolbarContext,
|
|
162
|
+
ToolbarDropdownMenu,
|
|
163
|
+
ToolbarGroup,
|
|
164
|
+
ToolbarItem,
|
|
165
|
+
} from './toolbar';
|
|
165
166
|
export {
|
|
166
167
|
ToolsPanel as __experimentalToolsPanel,
|
|
167
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';
|
|
@@ -14,6 +14,8 @@ import { useState } from '@wordpress/element';
|
|
|
14
14
|
*/
|
|
15
15
|
import BaseInputControl from '../';
|
|
16
16
|
|
|
17
|
+
jest.useFakeTimers();
|
|
18
|
+
|
|
17
19
|
const setupUser = () =>
|
|
18
20
|
userEvent.setup( {
|
|
19
21
|
advanceTimers: jest.advanceTimersByTime,
|
|
@@ -65,6 +67,7 @@ describe( 'InputControl', () => {
|
|
|
65
67
|
const help = screen.getByRole( 'link', { name: 'My help text' } );
|
|
66
68
|
|
|
67
69
|
expect(
|
|
70
|
+
// eslint-disable-next-line testing-library/no-node-access
|
|
68
71
|
help.closest( `#${ input.getAttribute( 'aria-details' ) }` )
|
|
69
72
|
).toBeVisible();
|
|
70
73
|
} );
|
|
@@ -9,6 +9,8 @@ import userEvent from '@testing-library/user-event';
|
|
|
9
9
|
*/
|
|
10
10
|
import IsolatedEventContainer from '../';
|
|
11
11
|
|
|
12
|
+
jest.useFakeTimers();
|
|
13
|
+
|
|
12
14
|
describe( 'IsolatedEventContainer', () => {
|
|
13
15
|
it( 'should pass props to container', async () => {
|
|
14
16
|
const user = userEvent.setup( {
|
|
@@ -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
|
+
};
|
package/src/item-group/styles.ts
CHANGED
|
@@ -11,8 +11,8 @@ Snapshot Diff:
|
|
|
11
11
|
role="listitem"
|
|
12
12
|
>
|
|
13
13
|
<div
|
|
14
|
-
- class="components-item css-
|
|
15
|
-
+ class="components-item css-
|
|
14
|
+
- class="components-item css-ufjlmj-View-medium-item-spacedAround e19lxcc00"
|
|
15
|
+
+ class="components-item css-17haj95-View-large-item-spacedAround e19lxcc00"
|
|
16
16
|
data-wp-c16t="true"
|
|
17
17
|
data-wp-component="Item"
|
|
18
18
|
>
|
|
@@ -24,8 +24,8 @@ Snapshot Diff:
|
|
|
24
24
|
role="listitem"
|
|
25
25
|
>
|
|
26
26
|
<div
|
|
27
|
-
- class="components-item css-
|
|
28
|
-
+ class="components-item css-
|
|
27
|
+
- class="components-item css-ufjlmj-View-medium-item-spacedAround e19lxcc00"
|
|
28
|
+
+ class="components-item css-17haj95-View-large-item-spacedAround e19lxcc00"
|
|
29
29
|
data-wp-c16t="true"
|
|
30
30
|
data-wp-component="Item"
|
|
31
31
|
>
|
|
@@ -44,8 +44,8 @@ Snapshot Diff:
|
|
|
44
44
|
role="listitem"
|
|
45
45
|
>
|
|
46
46
|
<div
|
|
47
|
-
- class="components-item css-
|
|
48
|
-
+ class="components-item css-
|
|
47
|
+
- class="components-item css-cl593w-View-medium-item e19lxcc00"
|
|
48
|
+
+ class="components-item css-1yvqxd-View-large-item e19lxcc00"
|
|
49
49
|
data-wp-c16t="true"
|
|
50
50
|
data-wp-component="Item"
|
|
51
51
|
>
|
|
@@ -75,6 +75,7 @@ exports[`ItemGroup ItemGroup component should render correctly 1`] = `
|
|
|
75
75
|
|
|
76
76
|
.emotion-3 {
|
|
77
77
|
padding: calc((36px - calc(13px * 1.2) - 2px) / 2) 12px;
|
|
78
|
+
box-sizing: border-box;
|
|
78
79
|
width: 100%;
|
|
79
80
|
display: block;
|
|
80
81
|
margin: 0;
|
|
@@ -124,8 +125,8 @@ Snapshot Diff:
|
|
|
124
125
|
role="listitem"
|
|
125
126
|
>
|
|
126
127
|
<div
|
|
127
|
-
- class="components-item css-
|
|
128
|
-
+ class="components-item css-
|
|
128
|
+
- class="components-item css-ufjlmj-View-medium-item-spacedAround e19lxcc00"
|
|
129
|
+
+ class="components-item css-cl593w-View-medium-item e19lxcc00"
|
|
129
130
|
data-wp-c16t="true"
|
|
130
131
|
data-wp-component="Item"
|
|
131
132
|
>
|
|
@@ -152,8 +153,8 @@ Snapshot Diff:
|
|
|
152
153
|
role="listitem"
|
|
153
154
|
>
|
|
154
155
|
<div
|
|
155
|
-
- class="components-item css-
|
|
156
|
-
+ class="components-item css-
|
|
156
|
+
- class="components-item css-ufjlmj-View-medium-item-spacedAround e19lxcc00"
|
|
157
|
+
+ class="components-item css-cl593w-View-medium-item e19lxcc00"
|
|
157
158
|
data-wp-c16t="true"
|
|
158
159
|
data-wp-component="Item"
|
|
159
160
|
>
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { find } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* Internal dependencies
|
|
8
3
|
*/
|
|
@@ -23,7 +18,7 @@ export default function BottomSheetPickerCell( props ) {
|
|
|
23
18
|
onChangeValue( newValue );
|
|
24
19
|
};
|
|
25
20
|
|
|
26
|
-
const option = find(
|
|
21
|
+
const option = options.find( ( opt ) => opt.value === value );
|
|
27
22
|
const label = option ? option.label : value;
|
|
28
23
|
|
|
29
24
|
return (
|