@wordpress/components 26.0.4 → 27.1.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/.stylelintrc.js +2 -2
- package/CHANGELOG.md +45 -0
- package/CONTRIBUTING.md +72 -0
- package/build/autocomplete/index.js +3 -8
- package/build/autocomplete/index.js.map +1 -1
- package/build/base-control/index.native.js.map +1 -1
- package/build/border-box-control/border-box-control/component.js.map +1 -1
- package/build/border-box-control/border-box-control-split-controls/component.js.map +1 -1
- package/build/border-control/border-control-dropdown/component.js.map +1 -1
- package/build/button/index.js +2 -2
- package/build/button/index.js.map +1 -1
- package/build/button/index.native.js.map +1 -1
- package/build/color-picker/component.js +10 -1
- package/build/color-picker/component.js.map +1 -1
- package/build/color-picker/styles.js +8 -9
- package/build/color-picker/styles.js.map +1 -1
- package/build/combobox-control/index.js +4 -9
- package/build/combobox-control/index.js.map +1 -1
- package/build/confirm-dialog/component.js.map +1 -1
- package/build/custom-select-control/index.js +2 -15
- package/build/custom-select-control/index.js.map +1 -1
- package/build/custom-select-control-v2/custom-select-item.js +32 -0
- package/build/custom-select-control-v2/custom-select-item.js.map +1 -0
- package/build/custom-select-control-v2/custom-select.js +91 -0
- package/build/custom-select-control-v2/custom-select.js.map +1 -0
- package/build/custom-select-control-v2/default-component/index.js +41 -0
- package/build/custom-select-control-v2/default-component/index.js.map +1 -0
- package/build/custom-select-control-v2/index.js +13 -82
- package/build/custom-select-control-v2/index.js.map +1 -1
- package/build/custom-select-control-v2/legacy-component/index.js +123 -0
- package/build/custom-select-control-v2/legacy-component/index.js.map +1 -0
- package/build/custom-select-control-v2/styles.js +73 -50
- package/build/custom-select-control-v2/styles.js.map +1 -1
- package/build/custom-select-control-v2/types.js.map +1 -1
- package/build/draggable/index.native.js +2 -2
- package/build/draggable/index.native.js.map +1 -1
- package/build/dropdown-menu/index.native.js.map +1 -1
- package/build/flex/flex/hook.js +1 -1
- package/build/flex/flex/hook.js.map +1 -1
- package/build/font-size-picker/font-size-picker-select.js +0 -1
- package/build/font-size-picker/font-size-picker-select.js.map +1 -1
- package/build/font-size-picker/index.native.js.map +1 -1
- package/build/form-token-field/index.js +3 -8
- package/build/form-token-field/index.js.map +1 -1
- package/build/form-token-field/suggestions-list.js +5 -12
- package/build/form-token-field/suggestions-list.js.map +1 -1
- package/build/h-stack/hook.js +6 -1
- package/build/h-stack/hook.js.map +1 -1
- package/build/mobile/bottom-sheet/button.native.js.map +1 -1
- package/build/mobile/bottom-sheet/index.native.js.map +1 -1
- package/build/mobile/bottom-sheet/range-cell.native.js.map +1 -1
- package/build/mobile/bottom-sheet/stepper-cell/index.native.js.map +1 -1
- package/build/mobile/bottom-sheet-select-control/index.native.js.map +1 -1
- package/build/mobile/bottom-sheet-text-control/index.native.js.map +1 -1
- package/build/mobile/gradient/index.native.js.map +1 -1
- package/build/mobile/image/index.native.js +4 -13
- package/build/mobile/image/index.native.js.map +1 -1
- package/build/mobile/keyboard-aware-flat-list/use-scroll-to-section.native.js +1 -1
- package/build/mobile/keyboard-aware-flat-list/use-scroll-to-section.native.js.map +1 -1
- package/build/mobile/media-edit/index.native.js.map +1 -1
- package/build/modal/index.js +2 -10
- package/build/modal/index.js.map +1 -1
- package/build/palette-edit/index.js.map +1 -1
- package/build/progress-bar/styles.js +5 -5
- package/build/progress-bar/styles.js.map +1 -1
- package/build/query-controls/index.native.js.map +1 -1
- package/build/range-control/index.js.map +1 -1
- package/build/search-control/index.native.js.map +1 -1
- package/build/snackbar/index.js +3 -2
- package/build/snackbar/index.js.map +1 -1
- package/build/snackbar/list.js +2 -1
- package/build/snackbar/list.js.map +1 -1
- package/build/snackbar/types.js.map +1 -1
- package/build/tabs/index.js +7 -7
- package/build/tabs/index.js.map +1 -1
- package/build/tabs/types.js.map +1 -1
- package/build/utils/hooks/index.js +0 -7
- package/build/utils/hooks/index.js.map +1 -1
- package/build/utils/with-ignore-ime-events.js +34 -0
- package/build/utils/with-ignore-ime-events.js.map +1 -0
- package/build-module/autocomplete/index.js +3 -8
- package/build-module/autocomplete/index.js.map +1 -1
- package/build-module/base-control/index.native.js.map +1 -1
- package/build-module/border-box-control/border-box-control/component.js.map +1 -1
- package/build-module/border-box-control/border-box-control-split-controls/component.js.map +1 -1
- package/build-module/border-control/border-control-dropdown/component.js.map +1 -1
- package/build-module/button/index.js +2 -2
- package/build-module/button/index.js.map +1 -1
- package/build-module/button/index.native.js.map +1 -1
- package/build-module/color-picker/component.js +11 -2
- 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 +4 -9
- package/build-module/combobox-control/index.js.map +1 -1
- package/build-module/confirm-dialog/component.js.map +1 -1
- package/build-module/custom-select-control/index.js +2 -15
- package/build-module/custom-select-control/index.js.map +1 -1
- package/build-module/custom-select-control-v2/custom-select-item.js +26 -0
- package/build-module/custom-select-control-v2/custom-select-item.js.map +1 -0
- package/build-module/custom-select-control-v2/custom-select.js +82 -0
- package/build-module/custom-select-control-v2/custom-select.js.map +1 -0
- package/build-module/custom-select-control-v2/default-component/index.js +30 -0
- package/build-module/custom-select-control-v2/default-component/index.js.map +1 -0
- package/build-module/custom-select-control-v2/index.js +2 -74
- package/build-module/custom-select-control-v2/index.js.map +1 -1
- package/build-module/custom-select-control-v2/legacy-component/index.js +111 -0
- package/build-module/custom-select-control-v2/legacy-component/index.js.map +1 -0
- package/build-module/custom-select-control-v2/styles.js +73 -42
- package/build-module/custom-select-control-v2/styles.js.map +1 -1
- package/build-module/custom-select-control-v2/types.js.map +1 -1
- package/build-module/draggable/index.native.js +2 -2
- package/build-module/draggable/index.native.js.map +1 -1
- package/build-module/dropdown-menu/index.native.js.map +1 -1
- package/build-module/flex/flex/hook.js +1 -1
- package/build-module/flex/flex/hook.js.map +1 -1
- package/build-module/font-size-picker/font-size-picker-select.js +0 -1
- package/build-module/font-size-picker/font-size-picker-select.js.map +1 -1
- package/build-module/font-size-picker/index.native.js.map +1 -1
- package/build-module/form-token-field/index.js +3 -8
- package/build-module/form-token-field/index.js.map +1 -1
- package/build-module/form-token-field/suggestions-list.js +5 -12
- package/build-module/form-token-field/suggestions-list.js.map +1 -1
- package/build-module/h-stack/hook.js +6 -1
- package/build-module/h-stack/hook.js.map +1 -1
- package/build-module/mobile/bottom-sheet/button.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/index.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/range-cell.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/stepper-cell/index.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet-select-control/index.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet-text-control/index.native.js.map +1 -1
- package/build-module/mobile/gradient/index.native.js.map +1 -1
- package/build-module/mobile/image/index.native.js +6 -15
- package/build-module/mobile/image/index.native.js.map +1 -1
- package/build-module/mobile/keyboard-aware-flat-list/use-scroll-to-section.native.js +1 -1
- package/build-module/mobile/keyboard-aware-flat-list/use-scroll-to-section.native.js.map +1 -1
- package/build-module/mobile/media-edit/index.native.js.map +1 -1
- package/build-module/modal/index.js +3 -10
- package/build-module/modal/index.js.map +1 -1
- package/build-module/palette-edit/index.js.map +1 -1
- package/build-module/progress-bar/styles.js +5 -5
- package/build-module/progress-bar/styles.js.map +1 -1
- package/build-module/query-controls/index.native.js.map +1 -1
- package/build-module/range-control/index.js.map +1 -1
- package/build-module/search-control/index.native.js.map +1 -1
- package/build-module/snackbar/index.js +3 -2
- package/build-module/snackbar/index.js.map +1 -1
- package/build-module/snackbar/list.js +2 -1
- package/build-module/snackbar/list.js.map +1 -1
- package/build-module/snackbar/types.js.map +1 -1
- package/build-module/tabs/index.js +7 -7
- package/build-module/tabs/index.js.map +1 -1
- package/build-module/tabs/types.js.map +1 -1
- package/build-module/utils/hooks/index.js +0 -1
- package/build-module/utils/hooks/index.js.map +1 -1
- package/build-module/utils/with-ignore-ime-events.js +28 -0
- package/build-module/utils/with-ignore-ime-events.js.map +1 -0
- package/build-style/style-rtl.css +10 -2
- package/build-style/style.css +10 -2
- package/build-types/alignment-matrix-control/stories/index.story.d.ts +1 -1
- package/build-types/angle-picker-control/stories/index.story.d.ts +1 -1
- package/build-types/animate/stories/index.story.d.ts +7 -7
- package/build-types/autocomplete/index.d.ts.map +1 -1
- package/build-types/base-control/stories/index.story.d.ts +1 -1
- package/build-types/border-box-control/stories/index.story.d.ts +1 -1
- package/build-types/border-control/stories/index.story.d.ts +6 -6
- package/build-types/box-control/stories/index.story.d.ts +6 -6
- package/build-types/button/stories/e2e/index.story.d.ts +1 -1
- package/build-types/button/stories/index.story.d.ts +7 -7
- package/build-types/card/stories/index.story.d.ts +2 -2
- package/build-types/circular-option-picker/stories/index.story.d.ts +5 -5
- package/build-types/color-palette/stories/index.story.d.ts +3 -3
- package/build-types/color-picker/component.d.ts.map +1 -1
- package/build-types/color-picker/stories/index.story.d.ts +1 -1
- package/build-types/color-picker/styles.d.ts.map +1 -1
- package/build-types/combobox-control/index.d.ts.map +1 -1
- package/build-types/combobox-control/stories/index.story.d.ts +2 -2
- package/build-types/confirm-dialog/stories/index.story.d.ts +2 -2
- package/build-types/custom-gradient-picker/stories/index.story.d.ts +1 -1
- package/build-types/custom-select-control/index.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/custom-select-item.d.ts +9 -0
- package/build-types/custom-select-control-v2/custom-select-item.d.ts.map +1 -0
- package/build-types/custom-select-control-v2/custom-select.d.ts +6 -0
- package/build-types/custom-select-control-v2/custom-select.d.ts.map +1 -0
- package/build-types/custom-select-control-v2/default-component/index.d.ts +6 -0
- package/build-types/custom-select-control-v2/default-component/index.d.ts.map +1 -0
- package/build-types/custom-select-control-v2/index.d.ts +5 -6
- package/build-types/custom-select-control-v2/index.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/legacy-component/index.d.ts +5 -0
- package/build-types/custom-select-control-v2/legacy-component/index.d.ts.map +1 -0
- package/build-types/custom-select-control-v2/legacy-component/test/index.d.ts +2 -0
- package/build-types/custom-select-control-v2/legacy-component/test/index.d.ts.map +1 -0
- package/build-types/custom-select-control-v2/stories/default.story.d.ts +30 -0
- package/build-types/custom-select-control-v2/stories/default.story.d.ts.map +1 -0
- package/build-types/custom-select-control-v2/stories/legacy.story.d.ts +12 -0
- package/build-types/custom-select-control-v2/stories/legacy.story.d.ts.map +1 -0
- package/build-types/custom-select-control-v2/styles.d.ts +31 -6
- package/build-types/custom-select-control-v2/styles.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/types.d.ts +136 -14
- package/build-types/custom-select-control-v2/types.d.ts.map +1 -1
- package/build-types/dimension-control/stories/index.story.d.ts +2 -2
- package/build-types/drop-zone/stories/index.story.d.ts +1 -1
- package/build-types/dropdown/stories/index.story.d.ts +3 -3
- package/build-types/dropdown-menu/stories/index.story.d.ts +2 -2
- package/build-types/dropdown-menu-v2/stories/index.story.d.ts.map +1 -1
- package/build-types/duotone-picker/stories/duotone-picker.story.d.ts +1 -1
- package/build-types/duotone-picker/stories/duotone-swatch.story.d.ts +3 -3
- package/build-types/flex/flex/hook.d.ts +2 -3
- package/build-types/flex/flex/hook.d.ts.map +1 -1
- package/build-types/focal-point-picker/stories/index.story.d.ts +4 -4
- package/build-types/font-size-picker/font-size-picker-select.d.ts.map +1 -1
- package/build-types/form-file-upload/stories/index.story.d.ts +5 -5
- package/build-types/form-token-field/index.d.ts.map +1 -1
- package/build-types/form-token-field/suggestions-list.d.ts.map +1 -1
- package/build-types/gradient-picker/stories/index.story.d.ts +3 -3
- package/build-types/guide/stories/index.story.d.ts +1 -1
- package/build-types/h-stack/hook.d.ts +2 -4
- package/build-types/h-stack/hook.d.ts.map +1 -1
- package/build-types/icon/stories/index.story.d.ts +4 -4
- package/build-types/input-control/stories/index.story.d.ts +6 -6
- package/build-types/keyboard-shortcuts/stories/index.story.d.ts +1 -1
- package/build-types/menu-group/stories/index.story.d.ts +1 -1
- package/build-types/menu-item/stories/index.story.d.ts +4 -4
- package/build-types/modal/index.d.ts.map +1 -1
- package/build-types/navigation/stories/index.story.d.ts +6 -6
- package/build-types/navigation/stories/utils/hide-if-empty.d.ts.map +1 -1
- package/build-types/notice/stories/index.story.d.ts +4 -4
- package/build-types/number-control/stories/index.story.d.ts +1 -1
- package/build-types/palette-edit/stories/index.story.d.ts +2 -2
- package/build-types/progress-bar/stories/index.story.d.ts.map +1 -1
- package/build-types/query-controls/stories/index.story.d.ts +1 -1
- package/build-types/radio-group/stories/index.story.d.ts.map +1 -1
- package/build-types/resizable-box/stories/index.story.d.ts +2 -2
- package/build-types/responsive-wrapper/stories/index.story.d.ts +1 -1
- package/build-types/sandbox/stories/index.story.d.ts +1 -1
- package/build-types/search-control/stories/index.story.d.ts +2 -2
- package/build-types/select-control/stories/index.story.d.ts +2 -2
- package/build-types/shortcut/stories/index.story.d.ts +1 -1
- package/build-types/snackbar/index.d.ts +5 -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/test/index.d.ts +2 -0
- package/build-types/snackbar/test/index.d.ts.map +1 -0
- package/build-types/snackbar/test/list.d.ts +2 -0
- package/build-types/snackbar/test/list.d.ts.map +1 -0
- package/build-types/snackbar/types.d.ts +18 -2
- package/build-types/snackbar/types.d.ts.map +1 -1
- package/build-types/tab-panel/stories/index.story.d.ts +4 -4
- package/build-types/tabs/index.d.ts +1 -1
- package/build-types/tabs/stories/index.story.d.ts +9 -9
- package/build-types/tabs/stories/index.story.d.ts.map +1 -1
- package/build-types/tabs/types.d.ts +1 -1
- package/build-types/text/stories/index.story.d.ts +3 -3
- package/build-types/theme/stories/index.story.d.ts +1 -1
- package/build-types/theme/stories/index.story.d.ts.map +1 -1
- package/build-types/toggle-control/stories/index.story.d.ts +2 -2
- package/build-types/toolbar/stories/index.story.d.ts +3 -3
- package/build-types/tooltip/stories/index.story.d.ts +1 -1
- package/build-types/tree-grid/stories/index.story.d.ts +1 -1
- package/build-types/tree-select/stories/index.story.d.ts +1 -1
- package/build-types/utils/hooks/index.d.ts +0 -1
- package/build-types/utils/with-ignore-ime-events.d.ts +15 -0
- package/build-types/utils/with-ignore-ime-events.d.ts.map +1 -0
- package/build-types/v-stack/hook.d.ts +2 -4
- package/build-types/v-stack/hook.d.ts.map +1 -1
- package/build-types/v-stack/stories/index.story.d.ts +1 -1
- package/package.json +19 -20
- package/src/alignment-matrix-control/test/index.tsx +3 -1
- package/src/autocomplete/index.tsx +3 -10
- package/src/base-control/index.native.js +1 -1
- package/src/base-control/test/index.tsx +1 -1
- package/src/border-box-control/border-box-control/component.tsx +1 -1
- package/src/border-box-control/border-box-control-split-controls/component.tsx +4 -4
- package/src/border-control/border-control-dropdown/component.tsx +1 -1
- package/src/button/index.native.js +1 -1
- package/src/button/index.tsx +1 -1
- package/src/button/style.scss +1 -3
- package/src/circular-option-picker/test/index.tsx +6 -5
- package/src/color-picker/component.tsx +22 -11
- package/src/color-picker/styles.ts +1 -15
- package/src/combobox-control/index.tsx +33 -41
- package/src/combobox-control/test/index.tsx +1 -1
- package/src/composite/legacy/test/index.tsx +18 -2
- package/src/confirm-dialog/component.tsx +1 -1
- package/src/confirm-dialog/test/index.tsx +5 -21
- package/src/custom-select-control/README.md +0 -10
- package/src/custom-select-control/index.js +3 -22
- package/src/custom-select-control/stories/index.story.js +0 -1
- package/src/custom-select-control/test/index.js +17 -17
- package/src/custom-select-control-v2/README.md +97 -7
- package/src/custom-select-control-v2/custom-select-item.tsx +29 -0
- package/src/custom-select-control-v2/custom-select.tsx +122 -0
- package/src/custom-select-control-v2/default-component/index.tsx +27 -0
- package/src/custom-select-control-v2/index.tsx +2 -102
- package/src/custom-select-control-v2/legacy-component/index.tsx +133 -0
- package/src/custom-select-control-v2/legacy-component/test/index.tsx +457 -0
- package/src/custom-select-control-v2/stories/{index.story.tsx → default.story.tsx} +27 -33
- package/src/custom-select-control-v2/stories/legacy.story.tsx +87 -0
- package/src/custom-select-control-v2/styles.ts +82 -38
- package/src/custom-select-control-v2/test/index.tsx +207 -17
- package/src/custom-select-control-v2/types.ts +147 -20
- package/src/disabled/test/index.tsx +1 -1
- package/src/draggable/index.native.js +2 -2
- package/src/draggable/test/index.native.js +6 -2
- package/src/dropdown-menu/index.native.js +2 -2
- package/src/dropdown-menu-v2/stories/index.story.tsx +1 -0
- package/src/dropdown-menu-v2/test/index.tsx +4 -1
- package/src/flex/flex/hook.ts +1 -1
- package/src/font-size-picker/font-size-picker-select.tsx +0 -1
- package/src/font-size-picker/index.native.js +2 -2
- package/src/form-token-field/index.tsx +4 -11
- package/src/form-token-field/suggestions-list.tsx +5 -17
- package/src/h-stack/hook.tsx +2 -1
- package/src/h-stack/test/index.tsx +10 -0
- package/src/item-group/test/index.js +2 -2
- package/src/mobile/bottom-sheet/bottom-sheet-navigation/test/navigation-container.native.js +10 -15
- package/src/mobile/bottom-sheet/button.native.js +1 -5
- package/src/mobile/bottom-sheet/index.native.js +2 -2
- package/src/mobile/bottom-sheet/range-cell.native.js +1 -1
- package/src/mobile/bottom-sheet/stepper-cell/index.native.js +2 -2
- package/src/mobile/bottom-sheet-select-control/index.native.js +1 -1
- package/src/mobile/bottom-sheet-text-control/index.native.js +1 -1
- package/src/mobile/gradient/index.native.js +1 -1
- package/src/mobile/image/index.native.js +8 -23
- package/src/mobile/keyboard-aware-flat-list/use-scroll-to-section.native.js +1 -1
- package/src/mobile/media-edit/index.native.js +1 -1
- package/src/modal/index.tsx +2 -12
- package/src/modal/style.scss +1 -0
- package/src/modal/test/index.tsx +1 -1
- package/src/navigation/stories/utils/hide-if-empty.tsx +2 -6
- package/src/palette-edit/index.tsx +2 -2
- package/src/popover/test/index.tsx +1 -4
- package/src/progress-bar/stories/index.story.tsx +1 -0
- package/src/progress-bar/styles.ts +2 -2
- package/src/query-controls/index.native.js +2 -2
- package/src/radio-group/stories/index.story.tsx +1 -0
- package/src/range-control/index.tsx +3 -3
- package/src/range-control/test/index.tsx +2 -2
- package/src/search-control/index.native.js +1 -1
- package/src/snackbar/index.tsx +5 -2
- package/src/snackbar/list.tsx +6 -1
- package/src/snackbar/stories/list.story.tsx +0 -3
- package/src/snackbar/test/index.tsx +267 -0
- package/src/snackbar/test/list.tsx +46 -0
- package/src/snackbar/types.ts +31 -3
- package/src/tab-panel/test/index.tsx +8 -1
- package/src/tabs/README.md +18 -18
- package/src/tabs/index.tsx +7 -7
- package/src/tabs/stories/index.story.tsx +2 -1
- package/src/tabs/test/index.tsx +66 -36
- package/src/tabs/types.ts +1 -1
- package/src/theme/stories/index.story.tsx +1 -0
- package/src/toggle-group-control/test/index.tsx +5 -1
- package/src/toolbar/toolbar-group/style.scss +1 -0
- package/src/tools-panel/stories/index.story.tsx +8 -8
- package/src/tools-panel/test/index.tsx +10 -28
- package/src/tooltip/style.scss +2 -1
- package/src/tooltip/test/index.native.js +3 -3
- package/src/tooltip/test/index.tsx +5 -0
- package/src/tree-grid/test/index.tsx +1 -1
- package/src/utils/hooks/index.js +0 -1
- package/src/utils/with-ignore-ime-events.ts +32 -0
- package/src/v-stack/test/index.tsx +10 -0
- package/tsconfig.json +0 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/build/custom-select-control/styles.js +0 -27
- package/build/custom-select-control/styles.js.map +0 -1
- package/build/utils/hooks/use-latest-ref.js +0 -33
- package/build/utils/hooks/use-latest-ref.js.map +0 -1
- package/build-module/custom-select-control/styles.js +0 -18
- package/build-module/custom-select-control/styles.js.map +0 -1
- package/build-module/utils/hooks/use-latest-ref.js +0 -27
- package/build-module/utils/hooks/use-latest-ref.js.map +0 -1
- package/build-types/custom-select-control/styles.d.ts +0 -11
- package/build-types/custom-select-control/styles.d.ts.map +0 -1
- package/build-types/custom-select-control-v2/stories/index.story.d.ts +0 -20
- package/build-types/custom-select-control-v2/stories/index.story.d.ts.map +0 -1
- package/build-types/utils/hooks/use-latest-ref.d.ts +0 -15
- package/build-types/utils/hooks/use-latest-ref.d.ts.map +0 -1
- package/src/custom-select-control/styles.ts +0 -28
- package/src/utils/hooks/test/use-latest-ref.js +0 -119
- package/src/utils/hooks/use-latest-ref.ts +0 -29
|
@@ -182,10 +182,7 @@ describe( 'Popover', () => {
|
|
|
182
182
|
describe( 'focus behavior', () => {
|
|
183
183
|
it( 'should focus the popover container when opened', async () => {
|
|
184
184
|
render(
|
|
185
|
-
<Popover
|
|
186
|
-
focusOnMount={ true }
|
|
187
|
-
data-testid="popover-element"
|
|
188
|
-
>
|
|
185
|
+
<Popover focusOnMount data-testid="popover-element">
|
|
189
186
|
Popover content
|
|
190
187
|
</Popover>
|
|
191
188
|
);
|
|
@@ -30,7 +30,7 @@ export const Track = styled.div`
|
|
|
30
30
|
/* Text color at 10% opacity */
|
|
31
31
|
background-color: color-mix(
|
|
32
32
|
in srgb,
|
|
33
|
-
|
|
33
|
+
${ COLORS.theme.foreground },
|
|
34
34
|
transparent 90%
|
|
35
35
|
);
|
|
36
36
|
border-radius: ${ CONFIG.radiusBlockUi };
|
|
@@ -52,7 +52,7 @@ export const Indicator = styled.div< {
|
|
|
52
52
|
/* Text color at 90% opacity */
|
|
53
53
|
background-color: color-mix(
|
|
54
54
|
in srgb,
|
|
55
|
-
|
|
55
|
+
${ COLORS.theme.foreground },
|
|
56
56
|
transparent 10%
|
|
57
57
|
);
|
|
58
58
|
|
|
@@ -69,7 +69,7 @@ const QueryControls = memo(
|
|
|
69
69
|
value={ `${ orderBy }/${ order }` }
|
|
70
70
|
options={ options }
|
|
71
71
|
onChange={ onChange }
|
|
72
|
-
hideCancelButton
|
|
72
|
+
hideCancelButton
|
|
73
73
|
/>
|
|
74
74
|
) }
|
|
75
75
|
{ onCategoryChange && (
|
|
@@ -79,7 +79,7 @@ const QueryControls = memo(
|
|
|
79
79
|
noOptionLabel={ _x( 'All', 'categories' ) }
|
|
80
80
|
selectedCategoryId={ selectedCategoryId }
|
|
81
81
|
onChange={ onCategoryChange }
|
|
82
|
-
hideCancelButton
|
|
82
|
+
hideCancelButton
|
|
83
83
|
/>
|
|
84
84
|
) }
|
|
85
85
|
{ onNumberOfItemsChange && (
|
|
@@ -16,6 +16,7 @@ import { useState } from '@wordpress/element';
|
|
|
16
16
|
|
|
17
17
|
const meta: Meta< typeof RadioGroup > = {
|
|
18
18
|
title: 'Components (Deprecated)/RadioGroup',
|
|
19
|
+
id: 'components-radiogroup',
|
|
19
20
|
component: RadioGroup,
|
|
20
21
|
// @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
|
|
21
22
|
subcomponents: { Radio },
|
|
@@ -253,7 +253,7 @@ function UnforwardedRangeControl(
|
|
|
253
253
|
value={ inputSliderValue ?? undefined }
|
|
254
254
|
/>
|
|
255
255
|
<RangeRail
|
|
256
|
-
aria-hidden
|
|
256
|
+
aria-hidden
|
|
257
257
|
disabled={ disabled }
|
|
258
258
|
marks={ marks }
|
|
259
259
|
max={ max }
|
|
@@ -263,7 +263,7 @@ function UnforwardedRangeControl(
|
|
|
263
263
|
value={ rangeFillValue }
|
|
264
264
|
/>
|
|
265
265
|
<Track
|
|
266
|
-
aria-hidden
|
|
266
|
+
aria-hidden
|
|
267
267
|
className="components-range-control__track"
|
|
268
268
|
disabled={ disabled }
|
|
269
269
|
style={ { width: fillValueOffset } }
|
|
@@ -275,7 +275,7 @@ function UnforwardedRangeControl(
|
|
|
275
275
|
disabled={ disabled }
|
|
276
276
|
>
|
|
277
277
|
<Thumb
|
|
278
|
-
aria-hidden
|
|
278
|
+
aria-hidden
|
|
279
279
|
isFocused={ isThumbFocused }
|
|
280
280
|
disabled={ disabled }
|
|
281
281
|
/>
|
|
@@ -297,7 +297,7 @@ describe( 'RangeControl', () => {
|
|
|
297
297
|
render(
|
|
298
298
|
<RangeControl
|
|
299
299
|
initialPosition={ 10 }
|
|
300
|
-
allowReset
|
|
300
|
+
allowReset
|
|
301
301
|
onChange={ spy }
|
|
302
302
|
resetFallbackValue={ 33 }
|
|
303
303
|
/>
|
|
@@ -320,7 +320,7 @@ describe( 'RangeControl', () => {
|
|
|
320
320
|
initialPosition={ undefined }
|
|
321
321
|
min={ 0 }
|
|
322
322
|
max={ 100 }
|
|
323
|
-
allowReset
|
|
323
|
+
allowReset
|
|
324
324
|
resetFallbackValue={ undefined }
|
|
325
325
|
/>
|
|
326
326
|
);
|
|
@@ -235,7 +235,7 @@ function SearchControl( {
|
|
|
235
235
|
<Text
|
|
236
236
|
onPress={ onCancel }
|
|
237
237
|
style={ cancelButtonTextStyle }
|
|
238
|
-
accessible
|
|
238
|
+
accessible
|
|
239
239
|
accessibilityRole={ 'button' }
|
|
240
240
|
accessibilityLabel={ __( 'Cancel search' ) }
|
|
241
241
|
accessibilityHint={ __( 'Cancel search' ) }
|
package/src/snackbar/index.tsx
CHANGED
|
@@ -138,9 +138,12 @@ function UnforwardedSnackbar(
|
|
|
138
138
|
className={ classes }
|
|
139
139
|
onClick={ ! explicitDismiss ? dismissMe : undefined }
|
|
140
140
|
tabIndex={ 0 }
|
|
141
|
-
role={ ! explicitDismiss ? 'button' :
|
|
141
|
+
role={ ! explicitDismiss ? 'button' : undefined }
|
|
142
142
|
onKeyPress={ ! explicitDismiss ? dismissMe : undefined }
|
|
143
|
-
aria-label={
|
|
143
|
+
aria-label={
|
|
144
|
+
! explicitDismiss ? __( 'Dismiss this notice' ) : undefined
|
|
145
|
+
}
|
|
146
|
+
data-testid="snackbar"
|
|
144
147
|
>
|
|
145
148
|
<div className={ snackbarContentClassnames }>
|
|
146
149
|
{ icon && (
|
package/src/snackbar/list.tsx
CHANGED
|
@@ -73,7 +73,12 @@ export function SnackbarList( {
|
|
|
73
73
|
( notice: SnackbarListProps[ 'notices' ][ number ] ) => () =>
|
|
74
74
|
onRemove?.( notice.id );
|
|
75
75
|
return (
|
|
76
|
-
<div
|
|
76
|
+
<div
|
|
77
|
+
className={ className }
|
|
78
|
+
tabIndex={ -1 }
|
|
79
|
+
ref={ listRef }
|
|
80
|
+
data-testid="snackbar-list"
|
|
81
|
+
>
|
|
77
82
|
{ children }
|
|
78
83
|
<AnimatePresence>
|
|
79
84
|
{ notices.map( ( notice ) => {
|
|
@@ -70,7 +70,6 @@ Default.args = {
|
|
|
70
70
|
},
|
|
71
71
|
],
|
|
72
72
|
content: 'Post published.',
|
|
73
|
-
isDismissible: true,
|
|
74
73
|
explicitDismiss: false,
|
|
75
74
|
},
|
|
76
75
|
{
|
|
@@ -83,7 +82,6 @@ Default.args = {
|
|
|
83
82
|
},
|
|
84
83
|
],
|
|
85
84
|
content: 'Post updated.',
|
|
86
|
-
isDismissible: true,
|
|
87
85
|
explicitDismiss: false,
|
|
88
86
|
},
|
|
89
87
|
{
|
|
@@ -91,7 +89,6 @@ Default.args = {
|
|
|
91
89
|
spokenMessage: 'All content copied.',
|
|
92
90
|
actions: [],
|
|
93
91
|
content: 'All content copied.',
|
|
94
|
-
isDismissible: true,
|
|
95
92
|
explicitDismiss: false,
|
|
96
93
|
},
|
|
97
94
|
],
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { render, screen, within } from '@testing-library/react';
|
|
5
|
+
import { click } from '@ariakit/test';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* WordPress dependencies
|
|
9
|
+
*/
|
|
10
|
+
import { speak } from '@wordpress/a11y';
|
|
11
|
+
import { SVG, Path } from '@wordpress/primitives';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Internal dependencies
|
|
15
|
+
*/
|
|
16
|
+
import Snackbar from '../index';
|
|
17
|
+
|
|
18
|
+
jest.mock( '@wordpress/a11y', () => ( { speak: jest.fn() } ) );
|
|
19
|
+
const mockedSpeak = jest.mocked( speak );
|
|
20
|
+
|
|
21
|
+
describe( 'Snackbar', () => {
|
|
22
|
+
const testId = 'snackbar';
|
|
23
|
+
|
|
24
|
+
beforeEach( () => {
|
|
25
|
+
mockedSpeak.mockReset();
|
|
26
|
+
} );
|
|
27
|
+
|
|
28
|
+
it( 'should render correctly', () => {
|
|
29
|
+
render( <Snackbar>Message</Snackbar> );
|
|
30
|
+
|
|
31
|
+
const snackbar = screen.getByTestId( testId );
|
|
32
|
+
|
|
33
|
+
expect( snackbar ).toBeVisible();
|
|
34
|
+
expect( snackbar ).toHaveTextContent( 'Message' );
|
|
35
|
+
} );
|
|
36
|
+
|
|
37
|
+
it( 'should render with an additional className', () => {
|
|
38
|
+
render( <Snackbar className="gutenberg">Message</Snackbar> );
|
|
39
|
+
|
|
40
|
+
expect( screen.getByTestId( testId ) ).toHaveClass( 'gutenberg' );
|
|
41
|
+
} );
|
|
42
|
+
|
|
43
|
+
it( 'should render with an icon', () => {
|
|
44
|
+
const testIcon = (
|
|
45
|
+
<SVG data-testid="icon">
|
|
46
|
+
<Path />
|
|
47
|
+
</SVG>
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
render( <Snackbar icon={ testIcon }>Message</Snackbar> );
|
|
51
|
+
|
|
52
|
+
const snackbar = screen.getByTestId( testId );
|
|
53
|
+
const icon = within( snackbar ).getByTestId( 'icon' );
|
|
54
|
+
|
|
55
|
+
expect( icon ).toBeVisible();
|
|
56
|
+
} );
|
|
57
|
+
|
|
58
|
+
it( 'should be dismissible by clicking the snackbar', async () => {
|
|
59
|
+
const onRemove = jest.fn();
|
|
60
|
+
const onDismiss = jest.fn();
|
|
61
|
+
|
|
62
|
+
render(
|
|
63
|
+
<Snackbar onRemove={ onRemove } onDismiss={ onDismiss }>
|
|
64
|
+
Message
|
|
65
|
+
</Snackbar>
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
const snackbar = screen.getByTestId( testId );
|
|
69
|
+
|
|
70
|
+
expect( snackbar ).toHaveAttribute( 'role', 'button' );
|
|
71
|
+
expect( snackbar ).toHaveAttribute(
|
|
72
|
+
'aria-label',
|
|
73
|
+
'Dismiss this notice'
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
await click( snackbar );
|
|
77
|
+
|
|
78
|
+
expect( onRemove ).toHaveBeenCalledTimes( 1 );
|
|
79
|
+
expect( onDismiss ).toHaveBeenCalledTimes( 1 );
|
|
80
|
+
} );
|
|
81
|
+
|
|
82
|
+
it( 'should not be dismissible by clicking the snackbar when the `explicitDismiss` prop is set to `true`', async () => {
|
|
83
|
+
const onRemove = jest.fn();
|
|
84
|
+
const onDismiss = jest.fn();
|
|
85
|
+
|
|
86
|
+
render(
|
|
87
|
+
<Snackbar
|
|
88
|
+
explicitDismiss
|
|
89
|
+
onRemove={ onRemove }
|
|
90
|
+
onDismiss={ onDismiss }
|
|
91
|
+
>
|
|
92
|
+
Message
|
|
93
|
+
</Snackbar>
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
const snackbar = screen.getByTestId( testId );
|
|
97
|
+
|
|
98
|
+
expect( snackbar ).not.toHaveAttribute( 'role', 'button' );
|
|
99
|
+
expect( snackbar ).not.toHaveAttribute(
|
|
100
|
+
'aria-label',
|
|
101
|
+
'Dismiss this notice'
|
|
102
|
+
);
|
|
103
|
+
expect( snackbar ).toHaveClass(
|
|
104
|
+
'components-snackbar-explicit-dismiss'
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
await click( snackbar );
|
|
108
|
+
|
|
109
|
+
expect( onRemove ).not.toHaveBeenCalled();
|
|
110
|
+
expect( onDismiss ).not.toHaveBeenCalled();
|
|
111
|
+
} );
|
|
112
|
+
|
|
113
|
+
it( 'should be dismissible by clicking the close button when the `explicitDismiss` prop is set to `true`', async () => {
|
|
114
|
+
const onRemove = jest.fn();
|
|
115
|
+
const onDismiss = jest.fn();
|
|
116
|
+
|
|
117
|
+
render(
|
|
118
|
+
<Snackbar
|
|
119
|
+
explicitDismiss
|
|
120
|
+
onRemove={ onRemove }
|
|
121
|
+
onDismiss={ onDismiss }
|
|
122
|
+
>
|
|
123
|
+
Message
|
|
124
|
+
</Snackbar>
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
const snackbar = screen.getByTestId( testId );
|
|
128
|
+
const closeButton = within( snackbar ).getByRole( 'button', {
|
|
129
|
+
name: 'Dismiss this notice',
|
|
130
|
+
} );
|
|
131
|
+
|
|
132
|
+
await click( closeButton );
|
|
133
|
+
|
|
134
|
+
expect( onRemove ).toHaveBeenCalledTimes( 1 );
|
|
135
|
+
expect( onDismiss ).toHaveBeenCalledTimes( 1 );
|
|
136
|
+
} );
|
|
137
|
+
|
|
138
|
+
describe( 'actions', () => {
|
|
139
|
+
it( 'should render only the first action with a warning when multiple actions are passed', () => {
|
|
140
|
+
render(
|
|
141
|
+
<Snackbar
|
|
142
|
+
actions={ [
|
|
143
|
+
{ label: 'One', url: 'https://example.com' },
|
|
144
|
+
{ label: 'Two', url: 'https://example.com' },
|
|
145
|
+
{ label: 'Three', url: 'https://example.com' },
|
|
146
|
+
] }
|
|
147
|
+
>
|
|
148
|
+
Message
|
|
149
|
+
</Snackbar>
|
|
150
|
+
);
|
|
151
|
+
|
|
152
|
+
expect( console ).toHaveWarnedWith(
|
|
153
|
+
'Snackbar can only have one action. Use Notice if your message requires many actions.'
|
|
154
|
+
);
|
|
155
|
+
|
|
156
|
+
const snackbar = screen.getByTestId( testId );
|
|
157
|
+
const action = within( snackbar ).getByRole( 'link' );
|
|
158
|
+
|
|
159
|
+
expect( action ).toBeVisible();
|
|
160
|
+
expect( action ).toHaveTextContent( 'One' );
|
|
161
|
+
} );
|
|
162
|
+
|
|
163
|
+
it( 'should be rendered as a link when the `url` prop is set', () => {
|
|
164
|
+
render(
|
|
165
|
+
<Snackbar
|
|
166
|
+
actions={ [
|
|
167
|
+
{ label: 'View post', url: 'https://example.com' },
|
|
168
|
+
] }
|
|
169
|
+
>
|
|
170
|
+
Post updated.
|
|
171
|
+
</Snackbar>
|
|
172
|
+
);
|
|
173
|
+
|
|
174
|
+
const snackbar = screen.getByTestId( testId );
|
|
175
|
+
const link = within( snackbar ).getByRole( 'link', {
|
|
176
|
+
name: 'View post',
|
|
177
|
+
} );
|
|
178
|
+
|
|
179
|
+
expect( link ).toHaveAttribute( 'href', 'https://example.com' );
|
|
180
|
+
} );
|
|
181
|
+
|
|
182
|
+
it( 'should be rendered as a button and call `onClick` when the `onClick` prop is set', async () => {
|
|
183
|
+
const onClick = jest.fn();
|
|
184
|
+
|
|
185
|
+
render(
|
|
186
|
+
<Snackbar actions={ [ { label: 'View post', onClick } ] }>
|
|
187
|
+
Post updated.
|
|
188
|
+
</Snackbar>
|
|
189
|
+
);
|
|
190
|
+
|
|
191
|
+
const snackbar = screen.getByTestId( testId );
|
|
192
|
+
const button = within( snackbar ).getByRole( 'button', {
|
|
193
|
+
name: 'View post',
|
|
194
|
+
} );
|
|
195
|
+
|
|
196
|
+
await click( button );
|
|
197
|
+
|
|
198
|
+
expect( onClick ).toHaveBeenCalledTimes( 1 );
|
|
199
|
+
} );
|
|
200
|
+
|
|
201
|
+
it( 'should be rendered as a link when the `url` prop and the `onClick` are set', () => {
|
|
202
|
+
render(
|
|
203
|
+
<Snackbar
|
|
204
|
+
actions={ [
|
|
205
|
+
{
|
|
206
|
+
label: 'View post',
|
|
207
|
+
url: 'https://example.com',
|
|
208
|
+
onClick: () => {},
|
|
209
|
+
},
|
|
210
|
+
] }
|
|
211
|
+
>
|
|
212
|
+
Post updated.
|
|
213
|
+
</Snackbar>
|
|
214
|
+
);
|
|
215
|
+
|
|
216
|
+
const snackbar = screen.getByTestId( testId );
|
|
217
|
+
const link = within( snackbar ).getByRole( 'link', {
|
|
218
|
+
name: 'View post',
|
|
219
|
+
} );
|
|
220
|
+
expect( link ).toBeVisible();
|
|
221
|
+
} );
|
|
222
|
+
} );
|
|
223
|
+
|
|
224
|
+
describe( 'useSpokenMessage', () => {
|
|
225
|
+
it( 'should speak the given message', () => {
|
|
226
|
+
render( <Snackbar>FYI</Snackbar> );
|
|
227
|
+
|
|
228
|
+
expect( speak ).toHaveBeenCalledWith( 'FYI', 'polite' );
|
|
229
|
+
} );
|
|
230
|
+
|
|
231
|
+
it( 'should speak the given message by explicit politeness', () => {
|
|
232
|
+
render( <Snackbar politeness="assertive">Uh oh!</Snackbar> );
|
|
233
|
+
|
|
234
|
+
expect( speak ).toHaveBeenCalledWith( 'Uh oh!', 'assertive' );
|
|
235
|
+
} );
|
|
236
|
+
|
|
237
|
+
it( 'should coerce a message to a string', () => {
|
|
238
|
+
// This test assumes that `@wordpress/a11y` is capable of handling
|
|
239
|
+
// markup strings appropriately.
|
|
240
|
+
render(
|
|
241
|
+
<Snackbar>
|
|
242
|
+
With <em>emphasis</em> this time.
|
|
243
|
+
</Snackbar>
|
|
244
|
+
);
|
|
245
|
+
|
|
246
|
+
expect( speak ).toHaveBeenCalledWith(
|
|
247
|
+
'With <em>emphasis</em> this time.',
|
|
248
|
+
'polite'
|
|
249
|
+
);
|
|
250
|
+
} );
|
|
251
|
+
|
|
252
|
+
it( 'should not re-speak an effectively equivalent element message', () => {
|
|
253
|
+
const { rerender } = render(
|
|
254
|
+
<Snackbar>
|
|
255
|
+
With <em>emphasis</em> this time.
|
|
256
|
+
</Snackbar>
|
|
257
|
+
);
|
|
258
|
+
rerender(
|
|
259
|
+
<Snackbar>
|
|
260
|
+
With <em>emphasis</em> this time.
|
|
261
|
+
</Snackbar>
|
|
262
|
+
);
|
|
263
|
+
|
|
264
|
+
expect( speak ).toHaveBeenCalledTimes( 1 );
|
|
265
|
+
} );
|
|
266
|
+
} );
|
|
267
|
+
} );
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { render, screen } from '@testing-library/react';
|
|
5
|
+
import { click } from '@ariakit/test';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
import SnackbarList from '../list';
|
|
11
|
+
|
|
12
|
+
window.scrollTo = jest.fn();
|
|
13
|
+
|
|
14
|
+
describe( 'SnackbarList', () => {
|
|
15
|
+
afterEach( () => {
|
|
16
|
+
jest.resetAllMocks();
|
|
17
|
+
} );
|
|
18
|
+
|
|
19
|
+
it( 'should get focus after a snackbar is dismissed', async () => {
|
|
20
|
+
render(
|
|
21
|
+
<SnackbarList
|
|
22
|
+
notices={ [
|
|
23
|
+
{
|
|
24
|
+
id: 'ID_1',
|
|
25
|
+
content: 'Post published.',
|
|
26
|
+
explicitDismiss: true,
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
id: 'ID_2',
|
|
30
|
+
content: 'Post updated.',
|
|
31
|
+
explicitDismiss: true,
|
|
32
|
+
},
|
|
33
|
+
] }
|
|
34
|
+
onRemove={ () => {} }
|
|
35
|
+
/>
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
await click(
|
|
39
|
+
screen.getAllByRole( 'button', {
|
|
40
|
+
name: 'Dismiss this notice',
|
|
41
|
+
} )[ 0 ]
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
expect( screen.getByTestId( 'snackbar-list' ) ).toHaveFocus();
|
|
45
|
+
} );
|
|
46
|
+
} );
|
package/src/snackbar/types.ts
CHANGED
|
@@ -6,7 +6,11 @@ import type { MutableRefObject, ReactNode } from 'react';
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
8
8
|
*/
|
|
9
|
-
import type {
|
|
9
|
+
import type {
|
|
10
|
+
NoticeProps,
|
|
11
|
+
NoticeChildren,
|
|
12
|
+
NoticeAction,
|
|
13
|
+
} from '../notice/types';
|
|
10
14
|
|
|
11
15
|
type SnackbarOnlyProps = {
|
|
12
16
|
/**
|
|
@@ -28,8 +32,32 @@ type SnackbarOnlyProps = {
|
|
|
28
32
|
listRef?: MutableRefObject< HTMLDivElement | null >;
|
|
29
33
|
};
|
|
30
34
|
|
|
31
|
-
export type SnackbarProps =
|
|
32
|
-
|
|
35
|
+
export type SnackbarProps = Pick<
|
|
36
|
+
NoticeProps,
|
|
37
|
+
| 'className'
|
|
38
|
+
| 'children'
|
|
39
|
+
| 'spokenMessage'
|
|
40
|
+
| 'onRemove'
|
|
41
|
+
| 'politeness'
|
|
42
|
+
| 'onDismiss'
|
|
43
|
+
> &
|
|
44
|
+
SnackbarOnlyProps & {
|
|
45
|
+
/**
|
|
46
|
+
* An array of action objects. Each member object should contain:
|
|
47
|
+
*
|
|
48
|
+
* - `label`: `string` containing the text of the button/link
|
|
49
|
+
* - `url`: `string` OR `onClick`: `( event: SyntheticEvent ) => void` to specify
|
|
50
|
+
* what the action does.
|
|
51
|
+
*
|
|
52
|
+
* The default appearance of an action button is inferred based on whether
|
|
53
|
+
* `url` or `onClick` are provided, rendering the button as a link if
|
|
54
|
+
* appropriate. If both props are provided, `url` takes precedence, and the
|
|
55
|
+
* action button will render as an anchor tag.
|
|
56
|
+
*
|
|
57
|
+
* @default []
|
|
58
|
+
*/
|
|
59
|
+
actions?: Pick< NoticeAction, 'label' | 'url' | 'onClick' >[];
|
|
60
|
+
};
|
|
33
61
|
|
|
34
62
|
export type SnackbarListProps = {
|
|
35
63
|
notices: Array<
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { render, screen, waitFor } from '@testing-library/react';
|
|
5
|
-
import { press, hover, click } from '@ariakit/test';
|
|
5
|
+
import { press, hover, click, sleep } from '@ariakit/test';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* WordPress dependencies
|
|
@@ -155,6 +155,7 @@ describe.each( [
|
|
|
155
155
|
// Tab to focus the tablist. Make sure alpha is focused, and that the
|
|
156
156
|
// corresponding tooltip is shown.
|
|
157
157
|
expect( screen.queryByText( 'Alpha' ) ).not.toBeInTheDocument();
|
|
158
|
+
await sleep();
|
|
158
159
|
await press.Tab();
|
|
159
160
|
expect( mockOnSelect ).toHaveBeenCalledTimes( 1 );
|
|
160
161
|
expect( screen.getByText( 'Alpha' ) ).toBeInTheDocument();
|
|
@@ -626,6 +627,7 @@ describe.each( [
|
|
|
626
627
|
// Tab to focus the tablist. Make sure alpha is focused.
|
|
627
628
|
expect( await getSelectedTab() ).toHaveTextContent( 'Alpha' );
|
|
628
629
|
expect( await getSelectedTab() ).not.toHaveFocus();
|
|
630
|
+
await sleep();
|
|
629
631
|
await press.Tab();
|
|
630
632
|
expect( await getSelectedTab() ).toHaveFocus();
|
|
631
633
|
|
|
@@ -663,6 +665,7 @@ describe.each( [
|
|
|
663
665
|
// Tab to focus the tablist. Make sure Alpha is focused.
|
|
664
666
|
expect( await getSelectedTab() ).toHaveTextContent( 'Alpha' );
|
|
665
667
|
expect( await getSelectedTab() ).not.toHaveFocus();
|
|
668
|
+
await sleep();
|
|
666
669
|
await press.Tab();
|
|
667
670
|
expect( await getSelectedTab() ).toHaveFocus();
|
|
668
671
|
|
|
@@ -700,6 +703,7 @@ describe.each( [
|
|
|
700
703
|
// Tab to focus the tablist. Make sure alpha is focused.
|
|
701
704
|
expect( await getSelectedTab() ).toHaveTextContent( 'Alpha' );
|
|
702
705
|
expect( await getSelectedTab() ).not.toHaveFocus();
|
|
706
|
+
await sleep();
|
|
703
707
|
await press.Tab();
|
|
704
708
|
expect( await getSelectedTab() ).toHaveFocus();
|
|
705
709
|
|
|
@@ -795,6 +799,7 @@ describe.each( [
|
|
|
795
799
|
// Tab to focus the tablist. Make sure Alpha is focused.
|
|
796
800
|
expect( await getSelectedTab() ).toHaveTextContent( 'Alpha' );
|
|
797
801
|
expect( await getSelectedTab() ).not.toHaveFocus();
|
|
802
|
+
await sleep();
|
|
798
803
|
await press.Tab();
|
|
799
804
|
expect( await getSelectedTab() ).toHaveFocus();
|
|
800
805
|
expect( mockOnSelect ).toHaveBeenCalledTimes( 1 );
|
|
@@ -836,6 +841,7 @@ describe.each( [
|
|
|
836
841
|
|
|
837
842
|
// Tab should initially focus the first tab in the tablist, which
|
|
838
843
|
// is Alpha.
|
|
844
|
+
await sleep();
|
|
839
845
|
await press.Tab();
|
|
840
846
|
expect(
|
|
841
847
|
await screen.findByRole( 'tab', { name: 'Alpha' } )
|
|
@@ -843,6 +849,7 @@ describe.each( [
|
|
|
843
849
|
|
|
844
850
|
// Because all other tabs should have `tabindex=-1`, pressing Tab
|
|
845
851
|
// should NOT move the focus to the next tab, which is Beta.
|
|
852
|
+
await sleep();
|
|
846
853
|
await press.Tab();
|
|
847
854
|
expect(
|
|
848
855
|
await screen.findByRole( 'tab', { name: 'Beta' } )
|