@wordpress/components 28.10.0 → 28.11.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 +35 -0
- package/build/autocomplete/autocompleter-ui.js +2 -6
- package/build/autocomplete/autocompleter-ui.js.map +1 -1
- package/build/autocomplete/autocompleter-ui.native.js +2 -4
- package/build/autocomplete/autocompleter-ui.native.js.map +1 -1
- package/build/autocomplete/index.js +4 -5
- package/build/autocomplete/index.js.map +1 -1
- package/build/base-control/types.js.map +1 -1
- package/build/border-box-control/border-box-control/component.js +1 -0
- package/build/border-box-control/border-box-control/component.js.map +1 -1
- package/build/border-box-control/border-box-control/hook.js +6 -0
- package/build/border-box-control/border-box-control/hook.js.map +1 -1
- package/build/border-control/border-control/component.js +1 -0
- package/build/border-control/border-control/component.js.map +1 -1
- package/build/border-control/border-control/hook.js +6 -0
- package/build/border-control/border-control/hook.js.map +1 -1
- package/build/border-control/border-control-dropdown/component.js +12 -12
- package/build/border-control/border-control-dropdown/component.js.map +1 -1
- package/build/color-palette/index.js +1 -1
- package/build/color-palette/index.js.map +1 -1
- package/build/color-palette/index.native.js +1 -2
- package/build/color-palette/index.native.js.map +1 -1
- package/build/color-picker/index.native.js +0 -1
- package/build/color-picker/index.native.js.map +1 -1
- package/build/composite/legacy/index.js +5 -2
- package/build/composite/legacy/index.js.map +1 -1
- package/build/custom-gradient-picker/gradient-bar/control-points.js +1 -1
- package/build/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
- package/build/date-time/date/index.js +0 -1
- package/build/date-time/date/index.js.map +1 -1
- package/build/font-size-picker/index.native.js +6 -6
- package/build/font-size-picker/index.native.js.map +1 -1
- package/build/form-token-field/index.js +0 -3
- package/build/form-token-field/index.js.map +1 -1
- package/build/form-token-field/suggestions-list.js +7 -3
- package/build/form-token-field/suggestions-list.js.map +1 -1
- package/build/{dropdown-menu-v2 → menu}/checkbox-item.js +8 -8
- package/build/menu/checkbox-item.js.map +1 -0
- package/build/{dropdown-menu-v2 → menu}/context.js +2 -2
- package/build/menu/context.js.map +1 -0
- package/build/{dropdown-menu-v2 → menu}/group-label.js +5 -5
- package/build/menu/group-label.js.map +1 -0
- package/build/{dropdown-menu-v2 → menu}/group.js +5 -5
- package/build/menu/group.js.map +1 -0
- package/build/{dropdown-menu-v2 → menu}/index.js +38 -38
- package/build/menu/index.js.map +1 -0
- package/build/{dropdown-menu-v2 → menu}/item-help-text.js +3 -3
- package/build/menu/item-help-text.js.map +1 -0
- package/build/{dropdown-menu-v2 → menu}/item-label.js +3 -3
- package/build/menu/item-label.js.map +1 -0
- package/build/{dropdown-menu-v2 → menu}/item.js +7 -7
- package/build/menu/item.js.map +1 -0
- package/build/{dropdown-menu-v2 → menu}/radio-item.js +8 -8
- package/build/menu/radio-item.js.map +1 -0
- package/build/{dropdown-menu-v2 → menu}/separator.js +6 -6
- package/build/menu/separator.js.map +1 -0
- package/build/menu/styles.js +150 -0
- package/build/menu/styles.js.map +1 -0
- package/build/menu/types.js.map +1 -0
- package/build/menu/use-temporary-focus-visible-fix.js.map +1 -0
- package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +3 -5
- package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js.map +1 -1
- package/build/mobile/bottom-sheet/range-cell.native.js +1 -1
- package/build/mobile/bottom-sheet/range-cell.native.js.map +1 -1
- package/build/mobile/bottom-sheet/stepper-cell/index.native.js +1 -1
- package/build/mobile/bottom-sheet/stepper-cell/index.native.js.map +1 -1
- package/build/mobile/bottom-sheet/sub-sheet/index.native.js +1 -3
- package/build/mobile/bottom-sheet/sub-sheet/index.native.js.map +1 -1
- package/build/mobile/bottom-sheet-select-control/index.native.js +2 -2
- package/build/mobile/bottom-sheet-select-control/index.native.js.map +1 -1
- package/build/mobile/color-settings/index.native.js +1 -3
- package/build/mobile/color-settings/index.native.js.map +1 -1
- package/build/mobile/color-settings/picker-screen.native.js +1 -3
- package/build/mobile/color-settings/picker-screen.native.js.map +1 -1
- package/build/mobile/image/index.native.js +1 -3
- package/build/mobile/image/index.native.js.map +1 -1
- package/build/mobile/keyboard-avoiding-view/index.ios.js +1 -3
- package/build/mobile/keyboard-avoiding-view/index.ios.js.map +1 -1
- package/build/mobile/link-picker/link-picker-results.native.js +2 -5
- package/build/mobile/link-picker/link-picker-results.native.js.map +1 -1
- package/build/mobile/link-picker/link-picker-screen.native.js +1 -3
- package/build/mobile/link-picker/link-picker-screen.native.js.map +1 -1
- package/build/mobile/link-settings/index.native.js +6 -18
- package/build/mobile/link-settings/index.native.js.map +1 -1
- package/build/mobile/link-settings/link-settings-screen.native.js +1 -3
- package/build/mobile/link-settings/link-settings-screen.native.js.map +1 -1
- package/build/mobile/segmented-control/index.native.js +2 -6
- package/build/mobile/segmented-control/index.native.js.map +1 -1
- package/build/mobile/utils/use-unit-converter-to-mobile.native.js +2 -6
- package/build/mobile/utils/use-unit-converter-to-mobile.native.js.map +1 -1
- package/build/navigation/index.js +1 -2
- package/build/navigation/index.js.map +1 -1
- package/build/navigation/item/use-navigation-tree-item.js +2 -2
- package/build/navigation/item/use-navigation-tree-item.js.map +1 -1
- package/build/navigation/menu/menu-title-search.js +2 -2
- package/build/navigation/menu/menu-title-search.js.map +1 -1
- package/build/navigation/menu/use-navigation-tree-menu.js +2 -2
- package/build/navigation/menu/use-navigation-tree-menu.js.map +1 -1
- package/build/palette-edit/index.js +4 -2
- package/build/palette-edit/index.js.map +1 -1
- package/build/palette-edit/styles.js +13 -28
- package/build/palette-edit/styles.js.map +1 -1
- package/build/private-apis.js +4 -4
- package/build/private-apis.js.map +1 -1
- package/build/radio-group/index.js +3 -1
- package/build/radio-group/index.js.map +1 -1
- package/build/sandbox/index.js +3 -6
- package/build/sandbox/index.js.map +1 -1
- package/build/sandbox/index.native.js +1 -3
- package/build/sandbox/index.native.js.map +1 -1
- package/build/search-control/index.native.js +1 -3
- package/build/search-control/index.native.js.map +1 -1
- package/build/slot-fill/bubbles-virtually/slot.js +1 -2
- package/build/slot-fill/bubbles-virtually/slot.js.map +1 -1
- package/build/slot-fill/fill.js +3 -6
- package/build/slot-fill/fill.js.map +1 -1
- package/build/spacer/hook.js +5 -3
- package/build/spacer/hook.js.map +1 -1
- package/build/tab-panel/index.js +4 -1
- package/build/tab-panel/index.js.map +1 -1
- package/build/tabs/index.js +48 -113
- package/build/tabs/index.js.map +1 -1
- package/build/tabs/styles.js +12 -12
- package/build/tabs/styles.js.map +1 -1
- package/build/tabs/tab.js +23 -6
- package/build/tabs/tab.js.map +1 -1
- package/build/tabs/tablist.js +24 -12
- package/build/tabs/tablist.js.map +1 -1
- package/build/tabs/types.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/component.js +2 -1
- package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
- package/build/toolbar/toolbar/index.js +3 -0
- package/build/toolbar/toolbar/index.js.map +1 -1
- package/build/tools-panel/tools-panel-header/component.js +1 -1
- package/build/tools-panel/tools-panel-header/component.js.map +1 -1
- package/build/tools-panel/tools-panel-item/hook.js +0 -2
- package/build/tools-panel/tools-panel-item/hook.js.map +1 -1
- package/build/tooltip/index.native.js +5 -15
- package/build/tooltip/index.native.js.map +1 -1
- package/build/unit-control/index.native.js +2 -6
- package/build/unit-control/index.native.js.map +1 -1
- package/build/utils/deprecated-36px-size.js +27 -0
- package/build/utils/deprecated-36px-size.js.map +1 -0
- package/build/utils/element-rect.js +13 -2
- package/build/utils/element-rect.js.map +1 -1
- package/build/utils/hooks/use-animated-offset-rect.js +3 -2
- package/build/utils/hooks/use-animated-offset-rect.js.map +1 -1
- package/build/utils/hooks/use-update-effect.js +0 -2
- package/build/utils/hooks/use-update-effect.js.map +1 -1
- package/build-module/autocomplete/autocompleter-ui.js +2 -6
- package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
- package/build-module/autocomplete/autocompleter-ui.native.js +2 -4
- package/build-module/autocomplete/autocompleter-ui.native.js.map +1 -1
- package/build-module/autocomplete/index.js +4 -5
- package/build-module/autocomplete/index.js.map +1 -1
- package/build-module/base-control/types.js.map +1 -1
- package/build-module/border-box-control/border-box-control/component.js +1 -0
- 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 +6 -0
- package/build-module/border-box-control/border-box-control/hook.js.map +1 -1
- package/build-module/border-control/border-control/component.js +1 -0
- package/build-module/border-control/border-control/component.js.map +1 -1
- package/build-module/border-control/border-control/hook.js +7 -0
- package/build-module/border-control/border-control/hook.js.map +1 -1
- package/build-module/border-control/border-control-dropdown/component.js +12 -12
- package/build-module/border-control/border-control-dropdown/component.js.map +1 -1
- package/build-module/color-palette/index.js +1 -1
- package/build-module/color-palette/index.js.map +1 -1
- package/build-module/color-palette/index.native.js +1 -2
- package/build-module/color-palette/index.native.js.map +1 -1
- package/build-module/color-picker/index.native.js +0 -1
- package/build-module/color-picker/index.native.js.map +1 -1
- package/build-module/composite/legacy/index.js +5 -2
- package/build-module/composite/legacy/index.js.map +1 -1
- package/build-module/custom-gradient-picker/gradient-bar/control-points.js +1 -1
- package/build-module/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
- package/build-module/date-time/date/index.js +0 -1
- package/build-module/date-time/date/index.js.map +1 -1
- package/build-module/font-size-picker/index.native.js +7 -7
- package/build-module/font-size-picker/index.native.js.map +1 -1
- package/build-module/form-token-field/index.js +0 -3
- package/build-module/form-token-field/index.js.map +1 -1
- package/build-module/form-token-field/suggestions-list.js +7 -3
- package/build-module/form-token-field/suggestions-list.js.map +1 -1
- package/build-module/{dropdown-menu-v2 → menu}/checkbox-item.js +8 -8
- package/build-module/menu/checkbox-item.js.map +1 -0
- package/build-module/{dropdown-menu-v2 → menu}/context.js +1 -1
- package/build-module/menu/context.js.map +1 -0
- package/build-module/{dropdown-menu-v2 → menu}/group-label.js +5 -5
- package/build-module/menu/group-label.js.map +1 -0
- package/build-module/menu/group.js +21 -0
- package/build-module/menu/group.js.map +1 -0
- package/build-module/{dropdown-menu-v2 → menu}/index.js +46 -46
- package/build-module/menu/index.js.map +1 -0
- package/build-module/{dropdown-menu-v2 → menu}/item-help-text.js +2 -2
- package/build-module/menu/item-help-text.js.map +1 -0
- package/build-module/{dropdown-menu-v2 → menu}/item-label.js +2 -2
- package/build-module/menu/item-label.js.map +1 -0
- package/build-module/{dropdown-menu-v2 → menu}/item.js +7 -7
- package/build-module/menu/item.js.map +1 -0
- package/build-module/{dropdown-menu-v2 → menu}/radio-item.js +8 -8
- package/build-module/menu/radio-item.js.map +1 -0
- package/build-module/menu/separator.js +22 -0
- package/build-module/menu/separator.js.map +1 -0
- package/build-module/menu/styles.js +143 -0
- package/build-module/menu/styles.js.map +1 -0
- package/build-module/menu/types.js.map +1 -0
- package/build-module/menu/use-temporary-focus-visible-fix.js.map +1 -0
- package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +3 -5
- package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/range-cell.native.js +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 +1 -1
- package/build-module/mobile/bottom-sheet/stepper-cell/index.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/sub-sheet/index.native.js +1 -3
- package/build-module/mobile/bottom-sheet/sub-sheet/index.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet-select-control/index.native.js +2 -2
- package/build-module/mobile/bottom-sheet-select-control/index.native.js.map +1 -1
- package/build-module/mobile/color-settings/index.native.js +1 -3
- package/build-module/mobile/color-settings/index.native.js.map +1 -1
- package/build-module/mobile/color-settings/picker-screen.native.js +1 -3
- package/build-module/mobile/color-settings/picker-screen.native.js.map +1 -1
- package/build-module/mobile/image/index.native.js +1 -3
- package/build-module/mobile/image/index.native.js.map +1 -1
- package/build-module/mobile/keyboard-avoiding-view/index.ios.js +1 -3
- package/build-module/mobile/keyboard-avoiding-view/index.ios.js.map +1 -1
- package/build-module/mobile/link-picker/link-picker-results.native.js +2 -5
- package/build-module/mobile/link-picker/link-picker-results.native.js.map +1 -1
- package/build-module/mobile/link-picker/link-picker-screen.native.js +1 -3
- package/build-module/mobile/link-picker/link-picker-screen.native.js.map +1 -1
- package/build-module/mobile/link-settings/index.native.js +6 -18
- package/build-module/mobile/link-settings/index.native.js.map +1 -1
- package/build-module/mobile/link-settings/link-settings-screen.native.js +1 -3
- package/build-module/mobile/link-settings/link-settings-screen.native.js.map +1 -1
- package/build-module/mobile/segmented-control/index.native.js +2 -6
- package/build-module/mobile/segmented-control/index.native.js.map +1 -1
- package/build-module/mobile/utils/use-unit-converter-to-mobile.native.js +2 -6
- package/build-module/mobile/utils/use-unit-converter-to-mobile.native.js.map +1 -1
- package/build-module/navigation/index.js +1 -2
- package/build-module/navigation/index.js.map +1 -1
- package/build-module/navigation/item/use-navigation-tree-item.js +2 -2
- package/build-module/navigation/item/use-navigation-tree-item.js.map +1 -1
- package/build-module/navigation/menu/menu-title-search.js +2 -2
- package/build-module/navigation/menu/menu-title-search.js.map +1 -1
- package/build-module/navigation/menu/use-navigation-tree-menu.js +2 -2
- package/build-module/navigation/menu/use-navigation-tree-menu.js.map +1 -1
- package/build-module/palette-edit/index.js +6 -4
- package/build-module/palette-edit/index.js.map +1 -1
- package/build-module/palette-edit/styles.js +13 -29
- package/build-module/palette-edit/styles.js.map +1 -1
- package/build-module/private-apis.js +3 -3
- package/build-module/private-apis.js.map +1 -1
- package/build-module/radio-group/index.js +3 -1
- package/build-module/radio-group/index.js.map +1 -1
- package/build-module/sandbox/index.js +3 -6
- package/build-module/sandbox/index.js.map +1 -1
- package/build-module/sandbox/index.native.js +1 -3
- package/build-module/sandbox/index.native.js.map +1 -1
- package/build-module/search-control/index.native.js +1 -3
- package/build-module/search-control/index.native.js.map +1 -1
- package/build-module/slot-fill/bubbles-virtually/slot.js +1 -2
- package/build-module/slot-fill/bubbles-virtually/slot.js.map +1 -1
- package/build-module/slot-fill/fill.js +3 -6
- package/build-module/slot-fill/fill.js.map +1 -1
- package/build-module/spacer/hook.js +5 -3
- package/build-module/spacer/hook.js.map +1 -1
- package/build-module/tab-panel/index.js +4 -1
- package/build-module/tab-panel/index.js.map +1 -1
- package/build-module/tabs/index.js +47 -112
- package/build-module/tabs/index.js.map +1 -1
- package/build-module/tabs/styles.js +11 -11
- package/build-module/tabs/styles.js.map +1 -1
- package/build-module/tabs/tab.js +21 -6
- package/build-module/tabs/tab.js.map +1 -1
- package/build-module/tabs/tablist.js +24 -12
- package/build-module/tabs/tablist.js.map +1 -1
- package/build-module/tabs/types.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control/component.js +2 -1
- package/build-module/toggle-group-control/toggle-group-control/component.js.map +1 -1
- package/build-module/toolbar/toolbar/index.js +3 -0
- package/build-module/toolbar/toolbar/index.js.map +1 -1
- package/build-module/tools-panel/tools-panel-header/component.js +1 -1
- package/build-module/tools-panel/tools-panel-header/component.js.map +1 -1
- package/build-module/tools-panel/tools-panel-item/hook.js +0 -2
- package/build-module/tools-panel/tools-panel-item/hook.js.map +1 -1
- package/build-module/tooltip/index.native.js +5 -15
- package/build-module/tooltip/index.native.js.map +1 -1
- package/build-module/unit-control/index.native.js +2 -6
- package/build-module/unit-control/index.native.js.map +1 -1
- package/build-module/utils/deprecated-36px-size.js +19 -0
- package/build-module/utils/deprecated-36px-size.js.map +1 -0
- package/build-module/utils/element-rect.js +13 -2
- package/build-module/utils/element-rect.js.map +1 -1
- package/build-module/utils/hooks/use-animated-offset-rect.js +3 -2
- package/build-module/utils/hooks/use-animated-offset-rect.js.map +1 -1
- package/build-module/utils/hooks/use-update-effect.js +0 -2
- package/build-module/utils/hooks/use-update-effect.js.map +1 -1
- package/build-style/style-rtl.css +6 -6
- package/build-style/style.css +6 -6
- package/build-types/animate/stories/index.story.d.ts.map +1 -1
- package/build-types/autocomplete/autocompleter-ui.d.ts.map +1 -1
- package/build-types/autocomplete/index.d.ts.map +1 -1
- package/build-types/base-control/stories/index.story.d.ts.map +1 -1
- package/build-types/base-control/types.d.ts +3 -0
- package/build-types/base-control/types.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control/component.d.ts +1 -0
- 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.map +1 -1
- package/build-types/border-control/border-control/component.d.ts +1 -0
- package/build-types/border-control/border-control/component.d.ts.map +1 -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.map +1 -1
- package/build-types/border-control/stories/index.story.d.ts.map +1 -1
- package/build-types/button/stories/index.story.d.ts.map +1 -1
- package/build-types/card/stories/index.story.d.ts.map +1 -1
- package/build-types/composite/legacy/index.d.ts.map +1 -1
- package/build-types/composite/stories/index.story.d.ts.map +1 -1
- package/build-types/date-time/date/index.d.ts.map +1 -1
- package/build-types/disabled/stories/index.story.d.ts.map +1 -1
- package/build-types/draggable/stories/index.story.d.ts.map +1 -1
- 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/item-group/stories/index.story.d.ts +1 -1
- package/build-types/item-group/stories/index.story.d.ts.map +1 -1
- package/build-types/keyboard-shortcuts/stories/index.story.d.ts.map +1 -1
- package/build-types/menu/checkbox-item.d.ts +3 -0
- package/build-types/menu/checkbox-item.d.ts.map +1 -0
- package/build-types/menu/context.d.ts +6 -0
- package/build-types/menu/context.d.ts.map +1 -0
- package/build-types/menu/group-label.d.ts +3 -0
- package/build-types/menu/group-label.d.ts.map +1 -0
- package/build-types/menu/group.d.ts +3 -0
- package/build-types/menu/group.d.ts.map +1 -0
- package/build-types/menu/index.d.ts +40 -0
- package/build-types/menu/index.d.ts.map +1 -0
- package/build-types/{dropdown-menu-v2 → menu}/item-help-text.d.ts +1 -1
- package/build-types/menu/item-help-text.d.ts.map +1 -0
- package/build-types/{dropdown-menu-v2 → menu}/item-label.d.ts +1 -1
- package/build-types/menu/item-label.d.ts.map +1 -0
- package/build-types/menu/item.d.ts +3 -0
- package/build-types/menu/item.d.ts.map +1 -0
- package/build-types/menu/radio-item.d.ts +3 -0
- package/build-types/menu/radio-item.d.ts.map +1 -0
- package/build-types/menu/separator.d.ts +3 -0
- package/build-types/menu/separator.d.ts.map +1 -0
- package/build-types/menu/stories/index.story.d.ts +16 -0
- package/build-types/menu/stories/index.story.d.ts.map +1 -0
- package/build-types/{dropdown-menu-v2 → menu}/styles.d.ts +13 -13
- package/build-types/menu/styles.d.ts.map +1 -0
- package/build-types/menu/test/index.d.ts.map +1 -0
- package/build-types/{dropdown-menu-v2 → menu}/types.d.ts +22 -21
- package/build-types/menu/types.d.ts.map +1 -0
- package/build-types/menu/use-temporary-focus-visible-fix.d.ts.map +1 -0
- package/build-types/navigable-container/stories/navigable-menu.story.d.ts.map +1 -1
- package/build-types/navigable-container/stories/tabbable-container.story.d.ts.map +1 -1
- package/build-types/navigation/index.d.ts.map +1 -1
- package/build-types/palette-edit/index.d.ts.map +1 -1
- package/build-types/palette-edit/styles.d.ts +0 -256
- package/build-types/palette-edit/styles.d.ts.map +1 -1
- package/build-types/panel/stories/index.story.d.ts.map +1 -1
- package/build-types/radio-group/index.d.ts.map +1 -1
- package/build-types/resizable-box/stories/index.story.d.ts.map +1 -1
- package/build-types/sandbox/index.d.ts.map +1 -1
- package/build-types/sandbox/stories/index.story.d.ts.map +1 -1
- package/build-types/scroll-lock/stories/index.story.d.ts.map +1 -1
- package/build-types/shortcut/stories/index.story.d.ts.map +1 -1
- package/build-types/slot-fill/bubbles-virtually/slot.d.ts.map +1 -1
- package/build-types/slot-fill/fill.d.ts.map +1 -1
- package/build-types/slot-fill/stories/index.story.d.ts.map +1 -1
- package/build-types/spacer/hook.d.ts.map +1 -1
- package/build-types/tab-panel/index.d.ts.map +1 -1
- package/build-types/tab-panel/stories/index.story.d.ts.map +1 -1
- package/build-types/tabs/index.d.ts +21 -8
- package/build-types/tabs/index.d.ts.map +1 -1
- package/build-types/tabs/stories/index.story.d.ts +1 -1
- package/build-types/tabs/stories/index.story.d.ts.map +1 -1
- package/build-types/tabs/styles.d.ts +6 -3
- package/build-types/tabs/styles.d.ts.map +1 -1
- package/build-types/tabs/tab.d.ts +0 -3
- package/build-types/tabs/tab.d.ts.map +1 -1
- package/build-types/tabs/tablist.d.ts.map +1 -1
- package/build-types/tabs/types.d.ts +85 -48
- package/build-types/tabs/types.d.ts.map +1 -1
- package/build-types/theme/stories/index.story.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control/component.d.ts.map +1 -1
- package/build-types/toolbar/toolbar/index.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
- package/build-types/utils/deprecated-36px-size.d.ts +6 -0
- package/build-types/utils/deprecated-36px-size.d.ts.map +1 -0
- package/build-types/utils/element-rect.d.ts +1 -1
- package/build-types/utils/element-rect.d.ts.map +1 -1
- package/build-types/utils/hooks/use-animated-offset-rect.d.ts +8 -1
- package/build-types/utils/hooks/use-animated-offset-rect.d.ts.map +1 -1
- package/build-types/utils/hooks/use-update-effect.d.ts.map +1 -1
- package/build-types/visually-hidden/stories/index.story.d.ts.map +1 -1
- package/package.json +20 -19
- package/src/alignment-matrix-control/README.md +1 -2
- package/src/angle-picker-control/README.md +1 -2
- package/src/animate/stories/index.story.tsx +2 -1
- package/src/autocomplete/autocompleter-ui.native.js +2 -4
- package/src/autocomplete/autocompleter-ui.tsx +2 -6
- package/src/autocomplete/index.tsx +4 -5
- package/src/base-control/README.md +58 -47
- package/src/base-control/docs-manifest.json +12 -0
- package/src/base-control/stories/index.story.tsx +4 -0
- package/src/base-control/types.ts +3 -0
- package/src/border-box-control/border-box-control/README.md +1 -0
- package/src/border-box-control/border-box-control/component.tsx +1 -0
- package/src/border-box-control/border-box-control/hook.ts +7 -0
- package/src/border-box-control/stories/index.story.tsx +1 -0
- package/src/border-box-control/test/index.tsx +1 -0
- package/src/border-control/border-control/README.md +1 -0
- package/src/border-control/border-control/component.tsx +1 -0
- package/src/border-control/border-control/hook.ts +7 -1
- package/src/border-control/border-control-dropdown/component.tsx +24 -12
- package/src/border-control/stories/index.story.tsx +1 -0
- package/src/border-control/test/index.js +1 -0
- package/src/button/stories/index.story.tsx +2 -1
- package/src/card/stories/index.story.tsx +2 -1
- package/src/color-palette/index.native.js +1 -2
- package/src/color-palette/index.tsx +1 -1
- package/src/color-palette/style.scss +2 -4
- package/src/color-picker/index.native.js +0 -1
- package/src/composite/legacy/index.tsx +5 -2
- package/src/composite/stories/index.story.tsx +2 -1
- package/src/custom-gradient-picker/gradient-bar/control-points.tsx +1 -1
- package/src/date-time/date/index.tsx +0 -1
- package/src/disabled/stories/index.story.tsx +2 -1
- package/src/draggable/stories/index.story.tsx +2 -1
- package/src/font-size-picker/index.native.js +7 -7
- package/src/form-token-field/index.tsx +0 -3
- package/src/form-token-field/style.scss +4 -1
- package/src/form-token-field/suggestions-list.tsx +6 -0
- package/src/item-group/stories/index.story.tsx +8 -4
- package/src/keyboard-shortcuts/stories/index.story.tsx +2 -1
- package/src/{dropdown-menu-v2 → menu}/README.md +34 -34
- package/src/{dropdown-menu-v2 → menu}/checkbox-item.tsx +14 -14
- package/src/menu/context.tsx +13 -0
- package/src/{dropdown-menu-v2 → menu}/group-label.tsx +8 -8
- package/src/menu/group.tsx +26 -0
- package/src/{dropdown-menu-v2 → menu}/index.tsx +65 -70
- package/src/{dropdown-menu-v2 → menu}/item-help-text.tsx +3 -7
- package/src/{dropdown-menu-v2 → menu}/item-label.tsx +3 -7
- package/src/{dropdown-menu-v2 → menu}/item.tsx +13 -13
- package/src/{dropdown-menu-v2 → menu}/radio-item.tsx +14 -14
- package/src/menu/separator.tsx +27 -0
- package/src/menu/stories/index.story.tsx +542 -0
- package/src/{dropdown-menu-v2 → menu}/styles.ts +17 -17
- package/src/{dropdown-menu-v2 → menu}/test/index.tsx +145 -225
- package/src/{dropdown-menu-v2 → menu}/types.ts +24 -23
- package/src/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +3 -5
- package/src/mobile/bottom-sheet/range-cell.native.js +1 -1
- package/src/mobile/bottom-sheet/stepper-cell/index.native.js +1 -1
- package/src/mobile/bottom-sheet/sub-sheet/index.native.js +1 -3
- package/src/mobile/bottom-sheet-select-control/index.native.js +2 -2
- package/src/mobile/color-settings/index.native.js +1 -3
- package/src/mobile/color-settings/picker-screen.native.js +1 -3
- package/src/mobile/image/index.native.js +1 -3
- package/src/mobile/keyboard-avoiding-view/index.ios.js +1 -3
- package/src/mobile/link-picker/link-picker-results.native.js +2 -5
- package/src/mobile/link-picker/link-picker-screen.native.js +1 -3
- package/src/mobile/link-settings/index.native.js +6 -18
- package/src/mobile/link-settings/link-settings-screen.native.js +1 -3
- package/src/mobile/segmented-control/index.native.js +2 -6
- package/src/mobile/utils/use-unit-converter-to-mobile.native.js +2 -6
- package/src/navigable-container/stories/navigable-menu.story.tsx +2 -1
- package/src/navigable-container/stories/tabbable-container.story.tsx +2 -1
- package/src/navigation/index.tsx +1 -2
- package/src/navigation/item/use-navigation-tree-item.tsx +2 -2
- package/src/navigation/menu/menu-title-search.tsx +2 -2
- package/src/navigation/menu/use-navigation-tree-menu.tsx +2 -2
- package/src/palette-edit/index.tsx +4 -5
- package/src/palette-edit/styles.ts +1 -67
- package/src/panel/stories/index.story.tsx +2 -1
- package/src/private-apis.ts +3 -3
- package/src/radio-group/index.tsx +2 -0
- package/src/resizable-box/stories/index.story.tsx +2 -1
- package/src/sandbox/index.native.js +1 -3
- package/src/sandbox/index.tsx +3 -6
- package/src/sandbox/stories/index.story.tsx +2 -1
- package/src/scroll-lock/stories/index.story.tsx +2 -1
- package/src/search-control/index.native.js +1 -3
- package/src/shortcut/stories/index.story.tsx +2 -1
- package/src/slot-fill/bubbles-virtually/slot.tsx +1 -2
- package/src/slot-fill/fill.ts +3 -6
- package/src/slot-fill/stories/index.story.tsx +2 -1
- package/src/spacer/hook.ts +3 -2
- package/src/tab-panel/index.tsx +3 -0
- package/src/tab-panel/stories/index.story.tsx +2 -1
- package/src/tab-panel/style.scss +1 -3
- package/src/tabs/README.md +63 -21
- package/src/tabs/index.tsx +112 -189
- package/src/tabs/stories/index.story.tsx +5 -2
- package/src/tabs/styles.ts +13 -5
- package/src/tabs/tab.tsx +23 -3
- package/src/tabs/tablist.tsx +31 -15
- package/src/tabs/test/index.tsx +131 -118
- package/src/tabs/types.ts +89 -49
- package/src/theme/stories/index.story.tsx +2 -1
- package/src/toggle-group-control/toggle-group-control/component.tsx +1 -0
- package/src/toolbar/toolbar/index.tsx +3 -0
- package/src/tools-panel/tools-panel-header/component.tsx +1 -1
- package/src/tools-panel/tools-panel-item/hook.ts +0 -2
- package/src/tooltip/index.native.js +5 -15
- package/src/unit-control/index.native.js +2 -6
- package/src/utils/deprecated-36px-size.ts +24 -0
- package/src/utils/element-rect.ts +14 -2
- package/src/utils/hooks/use-animated-offset-rect.ts +13 -1
- package/src/utils/hooks/use-update-effect.js +0 -2
- package/src/visually-hidden/stories/index.story.tsx +2 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/build/dropdown-menu-v2/checkbox-item.js.map +0 -1
- package/build/dropdown-menu-v2/context.js.map +0 -1
- package/build/dropdown-menu-v2/group-label.js.map +0 -1
- package/build/dropdown-menu-v2/group.js.map +0 -1
- package/build/dropdown-menu-v2/index.js.map +0 -1
- package/build/dropdown-menu-v2/item-help-text.js.map +0 -1
- package/build/dropdown-menu-v2/item-label.js.map +0 -1
- package/build/dropdown-menu-v2/item.js.map +0 -1
- package/build/dropdown-menu-v2/radio-item.js.map +0 -1
- package/build/dropdown-menu-v2/separator.js.map +0 -1
- package/build/dropdown-menu-v2/styles.js +0 -150
- package/build/dropdown-menu-v2/styles.js.map +0 -1
- package/build/dropdown-menu-v2/types.js.map +0 -1
- package/build/dropdown-menu-v2/use-temporary-focus-visible-fix.js.map +0 -1
- package/build-module/dropdown-menu-v2/checkbox-item.js.map +0 -1
- package/build-module/dropdown-menu-v2/context.js.map +0 -1
- package/build-module/dropdown-menu-v2/group-label.js.map +0 -1
- package/build-module/dropdown-menu-v2/group.js +0 -21
- package/build-module/dropdown-menu-v2/group.js.map +0 -1
- package/build-module/dropdown-menu-v2/index.js.map +0 -1
- package/build-module/dropdown-menu-v2/item-help-text.js.map +0 -1
- package/build-module/dropdown-menu-v2/item-label.js.map +0 -1
- package/build-module/dropdown-menu-v2/item.js.map +0 -1
- package/build-module/dropdown-menu-v2/radio-item.js.map +0 -1
- package/build-module/dropdown-menu-v2/separator.js +0 -22
- package/build-module/dropdown-menu-v2/separator.js.map +0 -1
- package/build-module/dropdown-menu-v2/styles.js +0 -143
- package/build-module/dropdown-menu-v2/styles.js.map +0 -1
- package/build-module/dropdown-menu-v2/types.js.map +0 -1
- package/build-module/dropdown-menu-v2/use-temporary-focus-visible-fix.js.map +0 -1
- package/build-types/dropdown-menu-v2/checkbox-item.d.ts +0 -3
- package/build-types/dropdown-menu-v2/checkbox-item.d.ts.map +0 -1
- package/build-types/dropdown-menu-v2/context.d.ts +0 -6
- package/build-types/dropdown-menu-v2/context.d.ts.map +0 -1
- package/build-types/dropdown-menu-v2/group-label.d.ts +0 -3
- package/build-types/dropdown-menu-v2/group-label.d.ts.map +0 -1
- package/build-types/dropdown-menu-v2/group.d.ts +0 -3
- package/build-types/dropdown-menu-v2/group.d.ts.map +0 -1
- package/build-types/dropdown-menu-v2/index.d.ts +0 -40
- package/build-types/dropdown-menu-v2/index.d.ts.map +0 -1
- package/build-types/dropdown-menu-v2/item-help-text.d.ts.map +0 -1
- package/build-types/dropdown-menu-v2/item-label.d.ts.map +0 -1
- package/build-types/dropdown-menu-v2/item.d.ts +0 -3
- package/build-types/dropdown-menu-v2/item.d.ts.map +0 -1
- package/build-types/dropdown-menu-v2/radio-item.d.ts +0 -3
- package/build-types/dropdown-menu-v2/radio-item.d.ts.map +0 -1
- package/build-types/dropdown-menu-v2/separator.d.ts +0 -3
- package/build-types/dropdown-menu-v2/separator.d.ts.map +0 -1
- package/build-types/dropdown-menu-v2/stories/index.story.d.ts +0 -16
- package/build-types/dropdown-menu-v2/stories/index.story.d.ts.map +0 -1
- package/build-types/dropdown-menu-v2/styles.d.ts.map +0 -1
- package/build-types/dropdown-menu-v2/test/index.d.ts.map +0 -1
- package/build-types/dropdown-menu-v2/types.d.ts.map +0 -1
- package/build-types/dropdown-menu-v2/use-temporary-focus-visible-fix.d.ts.map +0 -1
- package/src/dropdown-menu-v2/context.tsx +0 -13
- package/src/dropdown-menu-v2/group.tsx +0 -26
- package/src/dropdown-menu-v2/separator.tsx +0 -27
- package/src/dropdown-menu-v2/stories/index.story.tsx +0 -639
- /package/build/{dropdown-menu-v2 → menu}/types.js +0 -0
- /package/build/{dropdown-menu-v2 → menu}/use-temporary-focus-visible-fix.js +0 -0
- /package/build-module/{dropdown-menu-v2 → menu}/types.js +0 -0
- /package/build-module/{dropdown-menu-v2 → menu}/use-temporary-focus-visible-fix.js +0 -0
- /package/build-types/{dropdown-menu-v2 → menu}/test/index.d.ts +0 -0
- /package/build-types/{dropdown-menu-v2 → menu}/use-temporary-focus-visible-fix.d.ts +0 -0
- /package/src/{dropdown-menu-v2 → menu}/use-temporary-focus-visible-fix.ts +0 -0
package/src/tabs/test/index.tsx
CHANGED
|
@@ -13,7 +13,7 @@ import { useEffect, useState } from '@wordpress/element';
|
|
|
13
13
|
/**
|
|
14
14
|
* Internal dependencies
|
|
15
15
|
*/
|
|
16
|
-
import Tabs from '..';
|
|
16
|
+
import { Tabs } from '..';
|
|
17
17
|
import type { TabsProps } from '../types';
|
|
18
18
|
|
|
19
19
|
type Tab = {
|
|
@@ -129,7 +129,11 @@ const ControlledTabs = ( {
|
|
|
129
129
|
) ) }
|
|
130
130
|
</Tabs.TabList>
|
|
131
131
|
{ tabs.map( ( tabObj ) => (
|
|
132
|
-
<Tabs.TabPanel
|
|
132
|
+
<Tabs.TabPanel
|
|
133
|
+
key={ tabObj.tabId }
|
|
134
|
+
tabId={ tabObj.tabId }
|
|
135
|
+
focusable={ tabObj.tabpanel?.focusable }
|
|
136
|
+
>
|
|
133
137
|
{ tabObj.content }
|
|
134
138
|
</Tabs.TabPanel>
|
|
135
139
|
) ) }
|
|
@@ -191,6 +195,8 @@ describe( 'Tabs', () => {
|
|
|
191
195
|
it( 'should focus on the related TabPanel when pressing the Tab key', async () => {
|
|
192
196
|
await render( <UncontrolledTabs tabs={ TABS } /> );
|
|
193
197
|
|
|
198
|
+
expect( await getSelectedTab() ).toHaveTextContent( 'Alpha' );
|
|
199
|
+
|
|
194
200
|
const selectedTabPanel = await screen.findByRole( 'tabpanel' );
|
|
195
201
|
|
|
196
202
|
// Tab should initially focus the first tab in the tablist, which
|
|
@@ -224,6 +230,8 @@ describe( 'Tabs', () => {
|
|
|
224
230
|
<UncontrolledTabs tabs={ TABS_WITH_ALPHA_FOCUSABLE_FALSE } />
|
|
225
231
|
);
|
|
226
232
|
|
|
233
|
+
expect( await getSelectedTab() ).toHaveTextContent( 'Alpha' );
|
|
234
|
+
|
|
227
235
|
const alphaButton = await screen.findByRole( 'button', {
|
|
228
236
|
name: /alpha button/i,
|
|
229
237
|
} );
|
|
@@ -240,7 +248,7 @@ describe( 'Tabs', () => {
|
|
|
240
248
|
expect( alphaButton ).toHaveFocus();
|
|
241
249
|
} );
|
|
242
250
|
|
|
243
|
-
it(
|
|
251
|
+
it( "should focus the first tab, even if disabled, when the current selected tab id doesn't match an existing one", async () => {
|
|
244
252
|
const TABS_WITH_ALPHA_DISABLED = TABS.map( ( tabObj ) =>
|
|
245
253
|
tabObj.tabId === 'alpha'
|
|
246
254
|
? {
|
|
@@ -256,11 +264,26 @@ describe( 'Tabs', () => {
|
|
|
256
264
|
await render(
|
|
257
265
|
<ControlledTabs
|
|
258
266
|
tabs={ TABS_WITH_ALPHA_DISABLED }
|
|
259
|
-
selectedTabId=
|
|
267
|
+
selectedTabId="non-existing-tab"
|
|
260
268
|
/>
|
|
261
269
|
);
|
|
262
270
|
|
|
271
|
+
// No tab should be selected i.e. it doesn't fall back to first tab.
|
|
272
|
+
await waitFor( () =>
|
|
273
|
+
expect(
|
|
274
|
+
screen.queryByRole( 'tab', { selected: true } )
|
|
275
|
+
).not.toBeInTheDocument()
|
|
276
|
+
);
|
|
277
|
+
|
|
278
|
+
// No tabpanel should be rendered either
|
|
279
|
+
expect( screen.queryByRole( 'tabpanel' ) ).not.toBeInTheDocument();
|
|
280
|
+
|
|
263
281
|
await press.Tab();
|
|
282
|
+
expect(
|
|
283
|
+
await screen.findByRole( 'tab', { name: 'Alpha' } )
|
|
284
|
+
).toHaveFocus();
|
|
285
|
+
|
|
286
|
+
await press.ArrowRight();
|
|
264
287
|
expect(
|
|
265
288
|
await screen.findByRole( 'tab', { name: 'Beta' } )
|
|
266
289
|
).toHaveFocus();
|
|
@@ -335,6 +358,8 @@ describe( 'Tabs', () => {
|
|
|
335
358
|
<UncontrolledTabs tabs={ TABS } onSelect={ mockOnSelect } />
|
|
336
359
|
);
|
|
337
360
|
|
|
361
|
+
expect( await getSelectedTab() ).toHaveTextContent( 'Alpha' );
|
|
362
|
+
|
|
338
363
|
// onSelect gets called on the initial render. It should be called
|
|
339
364
|
// with the first enabled tab, which is alpha.
|
|
340
365
|
expect( mockOnSelect ).toHaveBeenCalledTimes( 1 );
|
|
@@ -370,12 +395,14 @@ describe( 'Tabs', () => {
|
|
|
370
395
|
<UncontrolledTabs tabs={ TABS } onSelect={ mockOnSelect } />
|
|
371
396
|
);
|
|
372
397
|
|
|
398
|
+
expect( await getSelectedTab() ).toHaveTextContent( 'Alpha' );
|
|
399
|
+
expect( await getSelectedTab() ).not.toHaveFocus();
|
|
400
|
+
|
|
373
401
|
// onSelect gets called on the initial render.
|
|
374
402
|
expect( mockOnSelect ).toHaveBeenCalledTimes( 1 );
|
|
403
|
+
expect( mockOnSelect ).toHaveBeenLastCalledWith( 'alpha' );
|
|
375
404
|
|
|
376
405
|
// Tab to focus the tablist. Make sure Alpha is focused.
|
|
377
|
-
expect( await getSelectedTab() ).toHaveTextContent( 'Alpha' );
|
|
378
|
-
expect( await getSelectedTab() ).not.toHaveFocus();
|
|
379
406
|
await press.Tab();
|
|
380
407
|
expect( await getSelectedTab() ).toHaveFocus();
|
|
381
408
|
|
|
@@ -403,14 +430,14 @@ describe( 'Tabs', () => {
|
|
|
403
430
|
<UncontrolledTabs tabs={ TABS } onSelect={ mockOnSelect } />
|
|
404
431
|
);
|
|
405
432
|
|
|
406
|
-
|
|
407
|
-
|
|
433
|
+
expect( await getSelectedTab() ).toHaveTextContent( 'Alpha' );
|
|
434
|
+
expect( await getSelectedTab() ).not.toHaveFocus();
|
|
435
|
+
|
|
436
|
+
// onSelect gets called on the initial render.
|
|
408
437
|
expect( mockOnSelect ).toHaveBeenCalledTimes( 1 );
|
|
409
438
|
expect( mockOnSelect ).toHaveBeenLastCalledWith( 'alpha' );
|
|
410
439
|
|
|
411
|
-
// Tab to focus the tablist. Make sure
|
|
412
|
-
expect( await getSelectedTab() ).toHaveTextContent( 'Alpha' );
|
|
413
|
-
expect( await getSelectedTab() ).not.toHaveFocus();
|
|
440
|
+
// Tab to focus the tablist. Make sure Alpha is focused.
|
|
414
441
|
await press.Tab();
|
|
415
442
|
expect( await getSelectedTab() ).toHaveFocus();
|
|
416
443
|
|
|
@@ -502,16 +529,17 @@ describe( 'Tabs', () => {
|
|
|
502
529
|
/>
|
|
503
530
|
);
|
|
504
531
|
|
|
505
|
-
|
|
506
|
-
|
|
532
|
+
expect( await getSelectedTab() ).toHaveTextContent( 'Alpha' );
|
|
533
|
+
expect( await getSelectedTab() ).not.toHaveFocus();
|
|
534
|
+
|
|
535
|
+
// onSelect gets called on the initial render.
|
|
507
536
|
expect( mockOnSelect ).toHaveBeenCalledTimes( 1 );
|
|
508
537
|
expect( mockOnSelect ).toHaveBeenLastCalledWith( 'alpha' );
|
|
509
538
|
|
|
510
539
|
// Tab to focus the tablist. Make sure Alpha is focused.
|
|
511
|
-
expect( await getSelectedTab() ).toHaveTextContent( 'Alpha' );
|
|
512
|
-
expect( await getSelectedTab() ).not.toHaveFocus();
|
|
513
540
|
await press.Tab();
|
|
514
541
|
expect( await getSelectedTab() ).toHaveFocus();
|
|
542
|
+
|
|
515
543
|
// Confirm onSelect has not been re-called
|
|
516
544
|
expect( mockOnSelect ).toHaveBeenCalledTimes( 1 );
|
|
517
545
|
|
|
@@ -550,6 +578,9 @@ describe( 'Tabs', () => {
|
|
|
550
578
|
it( 'should not focus the next tab when the Tab key is pressed', async () => {
|
|
551
579
|
await render( <UncontrolledTabs tabs={ TABS } /> );
|
|
552
580
|
|
|
581
|
+
expect( await getSelectedTab() ).toHaveTextContent( 'Alpha' );
|
|
582
|
+
expect( await getSelectedTab() ).not.toHaveFocus();
|
|
583
|
+
|
|
553
584
|
// Tab should initially focus the first tab in the tablist, which
|
|
554
585
|
// is Alpha.
|
|
555
586
|
await press.Tab();
|
|
@@ -579,8 +610,10 @@ describe( 'Tabs', () => {
|
|
|
579
610
|
/>
|
|
580
611
|
);
|
|
581
612
|
|
|
582
|
-
|
|
583
|
-
|
|
613
|
+
expect( await getSelectedTab() ).toHaveTextContent( 'Alpha' );
|
|
614
|
+
expect( await getSelectedTab() ).not.toHaveFocus();
|
|
615
|
+
|
|
616
|
+
// onSelect gets called on the initial render.
|
|
584
617
|
expect( mockOnSelect ).toHaveBeenCalledTimes( 1 );
|
|
585
618
|
expect( mockOnSelect ).toHaveBeenLastCalledWith( 'alpha' );
|
|
586
619
|
|
|
@@ -635,39 +668,20 @@ describe( 'Tabs', () => {
|
|
|
635
668
|
await screen.findByRole( 'tabpanel', { name: 'Alpha' } )
|
|
636
669
|
).toBeInTheDocument();
|
|
637
670
|
} );
|
|
638
|
-
it( 'should
|
|
671
|
+
it( 'should not have a selected tab if the currently selected tab is removed', async () => {
|
|
639
672
|
const { rerender } = await render(
|
|
640
673
|
<UncontrolledTabs tabs={ TABS } />
|
|
641
674
|
);
|
|
642
675
|
|
|
643
|
-
// Remove first item from `TABS` array
|
|
644
|
-
await rerender( <UncontrolledTabs tabs={ TABS.slice( 1 ) } /> );
|
|
645
|
-
expect( await getSelectedTab() ).toHaveTextContent( 'Beta' );
|
|
646
|
-
} );
|
|
647
|
-
it( 'should not load any tab if the active tab is removed and there are no enabled tabs', async () => {
|
|
648
|
-
const TABS_WITH_BETA_GAMMA_DISABLED = TABS.map( ( tabObj ) =>
|
|
649
|
-
tabObj.tabId !== 'alpha'
|
|
650
|
-
? {
|
|
651
|
-
...tabObj,
|
|
652
|
-
tab: {
|
|
653
|
-
...tabObj.tab,
|
|
654
|
-
disabled: true,
|
|
655
|
-
},
|
|
656
|
-
}
|
|
657
|
-
: tabObj
|
|
658
|
-
);
|
|
659
|
-
|
|
660
|
-
const { rerender } = await render(
|
|
661
|
-
<UncontrolledTabs tabs={ TABS_WITH_BETA_GAMMA_DISABLED } />
|
|
662
|
-
);
|
|
663
676
|
expect( await getSelectedTab() ).toHaveTextContent( 'Alpha' );
|
|
677
|
+
expect( await getSelectedTab() ).not.toHaveFocus();
|
|
664
678
|
|
|
665
|
-
//
|
|
666
|
-
await
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
);
|
|
679
|
+
// Tab to focus the tablist. Make sure Alpha is focused.
|
|
680
|
+
await press.Tab();
|
|
681
|
+
expect( await getSelectedTab() ).toHaveFocus();
|
|
682
|
+
|
|
683
|
+
// Remove first item from `TABS` array
|
|
684
|
+
await rerender( <UncontrolledTabs tabs={ TABS.slice( 1 ) } /> );
|
|
671
685
|
|
|
672
686
|
// No tab should be selected i.e. it doesn't fall back to first tab.
|
|
673
687
|
await waitFor( () =>
|
|
@@ -715,6 +729,8 @@ describe( 'Tabs', () => {
|
|
|
715
729
|
<UncontrolledTabs tabs={ TABS } defaultTabId="beta" />
|
|
716
730
|
);
|
|
717
731
|
|
|
732
|
+
expect( await getSelectedTab() ).toHaveTextContent( 'Beta' );
|
|
733
|
+
|
|
718
734
|
await rerender(
|
|
719
735
|
<UncontrolledTabs tabs={ TABS } defaultTabId="alpha" />
|
|
720
736
|
);
|
|
@@ -722,7 +738,7 @@ describe( 'Tabs', () => {
|
|
|
722
738
|
expect( await getSelectedTab() ).toHaveTextContent( 'Beta' );
|
|
723
739
|
} );
|
|
724
740
|
|
|
725
|
-
it( 'should
|
|
741
|
+
it( 'should not have any selected tabs if the currently selected tab is removed, even if a tab is matching the defaultTabId', async () => {
|
|
726
742
|
const mockOnSelect = jest.fn();
|
|
727
743
|
|
|
728
744
|
const { rerender } = await render(
|
|
@@ -747,10 +763,20 @@ describe( 'Tabs', () => {
|
|
|
747
763
|
/>
|
|
748
764
|
);
|
|
749
765
|
|
|
750
|
-
|
|
766
|
+
// No tab should be selected i.e. it doesn't fall back to first tab.
|
|
767
|
+
await waitFor( () =>
|
|
768
|
+
expect(
|
|
769
|
+
screen.queryByRole( 'tab', { selected: true } )
|
|
770
|
+
).not.toBeInTheDocument()
|
|
771
|
+
);
|
|
772
|
+
|
|
773
|
+
// No tabpanel should be rendered either
|
|
774
|
+
expect(
|
|
775
|
+
screen.queryByRole( 'tabpanel' )
|
|
776
|
+
).not.toBeInTheDocument();
|
|
751
777
|
} );
|
|
752
778
|
|
|
753
|
-
it( 'should
|
|
779
|
+
it( 'should keep the currently selected tab even if it becomes disabled', async () => {
|
|
754
780
|
const mockOnSelect = jest.fn();
|
|
755
781
|
|
|
756
782
|
const { rerender } = await render(
|
|
@@ -765,6 +791,8 @@ describe( 'Tabs', () => {
|
|
|
765
791
|
|
|
766
792
|
await click( screen.getByRole( 'tab', { name: 'Alpha' } ) );
|
|
767
793
|
expect( await getSelectedTab() ).toHaveTextContent( 'Alpha' );
|
|
794
|
+
|
|
795
|
+
expect( mockOnSelect ).toHaveBeenCalledTimes( 1 );
|
|
768
796
|
expect( mockOnSelect ).toHaveBeenLastCalledWith( 'alpha' );
|
|
769
797
|
|
|
770
798
|
const TABS_WITH_ALPHA_DISABLED = TABS.map( ( tabObj ) =>
|
|
@@ -787,7 +815,8 @@ describe( 'Tabs', () => {
|
|
|
787
815
|
/>
|
|
788
816
|
);
|
|
789
817
|
|
|
790
|
-
expect( await getSelectedTab() ).toHaveTextContent( '
|
|
818
|
+
expect( await getSelectedTab() ).toHaveTextContent( 'Alpha' );
|
|
819
|
+
expect( mockOnSelect ).toHaveBeenCalledTimes( 1 );
|
|
791
820
|
} );
|
|
792
821
|
|
|
793
822
|
it( 'should have no active tabs when the tab associated to `defaultTabId` is removed while being the active tab', async () => {
|
|
@@ -821,9 +850,16 @@ describe( 'Tabs', () => {
|
|
|
821
850
|
<UncontrolledTabs tabs={ TABS } defaultTabId="delta" />
|
|
822
851
|
);
|
|
823
852
|
|
|
824
|
-
//
|
|
853
|
+
// No tab should be selected i.e. it doesn't fall back to first tab.
|
|
854
|
+
await waitFor( () =>
|
|
855
|
+
expect(
|
|
856
|
+
screen.queryByRole( 'tab', { selected: true } )
|
|
857
|
+
).not.toBeInTheDocument()
|
|
858
|
+
);
|
|
859
|
+
|
|
860
|
+
// No tabpanel should be rendered either
|
|
825
861
|
expect(
|
|
826
|
-
screen.queryByRole( '
|
|
862
|
+
screen.queryByRole( 'tabpanel' )
|
|
827
863
|
).not.toBeInTheDocument();
|
|
828
864
|
|
|
829
865
|
await rerender(
|
|
@@ -861,6 +897,8 @@ describe( 'Tabs', () => {
|
|
|
861
897
|
/>
|
|
862
898
|
);
|
|
863
899
|
|
|
900
|
+
expect( await getSelectedTab() ).toHaveTextContent( 'Alpha' );
|
|
901
|
+
|
|
864
902
|
expect(
|
|
865
903
|
screen.getByRole( 'tab', { name: 'Delta' } )
|
|
866
904
|
).toHaveAttribute( 'aria-disabled', 'true' );
|
|
@@ -918,7 +956,7 @@ describe( 'Tabs', () => {
|
|
|
918
956
|
expect( await getSelectedTab() ).toHaveTextContent( 'Beta' );
|
|
919
957
|
} );
|
|
920
958
|
|
|
921
|
-
it( 'should select
|
|
959
|
+
it( 'should select the tab associated to `defaultTabId` even if the tab is disabled', async () => {
|
|
922
960
|
const TABS_ONLY_GAMMA_ENABLED = TABS.map( ( tabObj ) =>
|
|
923
961
|
tabObj.tabId !== 'gamma'
|
|
924
962
|
? {
|
|
@@ -939,7 +977,7 @@ describe( 'Tabs', () => {
|
|
|
939
977
|
|
|
940
978
|
// As alpha (first tab), and beta (the initial tab), are both
|
|
941
979
|
// disabled the first enabled tab should be gamma.
|
|
942
|
-
expect( await getSelectedTab() ).toHaveTextContent( '
|
|
980
|
+
expect( await getSelectedTab() ).toHaveTextContent( 'Beta' );
|
|
943
981
|
|
|
944
982
|
// Re-enable all tabs
|
|
945
983
|
await rerender(
|
|
@@ -948,10 +986,10 @@ describe( 'Tabs', () => {
|
|
|
948
986
|
|
|
949
987
|
// Even if the initial tab becomes enabled again, the selected tab doesn't
|
|
950
988
|
// change.
|
|
951
|
-
expect( await getSelectedTab() ).toHaveTextContent( '
|
|
989
|
+
expect( await getSelectedTab() ).toHaveTextContent( 'Beta' );
|
|
952
990
|
} );
|
|
953
991
|
|
|
954
|
-
it( 'should
|
|
992
|
+
it( 'should keep the currently tab as selected even when it becomes disabled', async () => {
|
|
955
993
|
const mockOnSelect = jest.fn();
|
|
956
994
|
const { rerender } = await render(
|
|
957
995
|
<UncontrolledTabs tabs={ TABS } onSelect={ mockOnSelect } />
|
|
@@ -981,21 +1019,19 @@ describe( 'Tabs', () => {
|
|
|
981
1019
|
/>
|
|
982
1020
|
);
|
|
983
1021
|
|
|
984
|
-
expect( await getSelectedTab() ).toHaveTextContent( '
|
|
985
|
-
expect( mockOnSelect ).toHaveBeenCalledTimes(
|
|
986
|
-
expect( mockOnSelect ).toHaveBeenLastCalledWith( 'beta' );
|
|
1022
|
+
expect( await getSelectedTab() ).toHaveTextContent( 'Alpha' );
|
|
1023
|
+
expect( mockOnSelect ).toHaveBeenCalledTimes( 1 );
|
|
987
1024
|
|
|
988
1025
|
// Re-enable all tabs
|
|
989
1026
|
await rerender(
|
|
990
1027
|
<UncontrolledTabs tabs={ TABS } onSelect={ mockOnSelect } />
|
|
991
1028
|
);
|
|
992
1029
|
|
|
993
|
-
expect( await getSelectedTab() ).toHaveTextContent( '
|
|
994
|
-
expect( mockOnSelect ).toHaveBeenCalledTimes(
|
|
995
|
-
expect( mockOnSelect ).toHaveBeenLastCalledWith( 'beta' );
|
|
1030
|
+
expect( await getSelectedTab() ).toHaveTextContent( 'Alpha' );
|
|
1031
|
+
expect( mockOnSelect ).toHaveBeenCalledTimes( 1 );
|
|
996
1032
|
} );
|
|
997
1033
|
|
|
998
|
-
it( 'should select the
|
|
1034
|
+
it( 'should select the tab associated to `defaultTabId` even when disabled', async () => {
|
|
999
1035
|
const mockOnSelect = jest.fn();
|
|
1000
1036
|
|
|
1001
1037
|
const { rerender } = await render(
|
|
@@ -1029,9 +1065,7 @@ describe( 'Tabs', () => {
|
|
|
1029
1065
|
/>
|
|
1030
1066
|
);
|
|
1031
1067
|
|
|
1032
|
-
expect( await getSelectedTab() ).toHaveTextContent( '
|
|
1033
|
-
expect( mockOnSelect ).toHaveBeenCalledTimes( 1 );
|
|
1034
|
-
expect( mockOnSelect ).toHaveBeenLastCalledWith( 'alpha' );
|
|
1068
|
+
expect( await getSelectedTab() ).toHaveTextContent( 'Gamma' );
|
|
1035
1069
|
|
|
1036
1070
|
// Re-enable all tabs
|
|
1037
1071
|
await rerender(
|
|
@@ -1044,8 +1078,8 @@ describe( 'Tabs', () => {
|
|
|
1044
1078
|
|
|
1045
1079
|
// Confirm that alpha is still selected, and that onSelect has
|
|
1046
1080
|
// not been called again.
|
|
1047
|
-
expect( await getSelectedTab() ).toHaveTextContent( '
|
|
1048
|
-
expect( mockOnSelect ).
|
|
1081
|
+
expect( await getSelectedTab() ).toHaveTextContent( 'Gamma' );
|
|
1082
|
+
expect( mockOnSelect ).not.toHaveBeenCalled();
|
|
1049
1083
|
} );
|
|
1050
1084
|
} );
|
|
1051
1085
|
} );
|
|
@@ -1072,7 +1106,7 @@ describe( 'Tabs', () => {
|
|
|
1072
1106
|
|
|
1073
1107
|
expect( await getSelectedTab() ).toHaveTextContent( 'Gamma' );
|
|
1074
1108
|
} );
|
|
1075
|
-
it( 'should not
|
|
1109
|
+
it( 'should not have a selected tab if `selectedTabId` does not match any known tab', async () => {
|
|
1076
1110
|
await render(
|
|
1077
1111
|
<ControlledTabs
|
|
1078
1112
|
tabs={ TABS_WITH_DELTA }
|
|
@@ -1087,11 +1121,13 @@ describe( 'Tabs', () => {
|
|
|
1087
1121
|
// No tabpanel should be rendered either
|
|
1088
1122
|
expect( screen.queryByRole( 'tabpanel' ) ).not.toBeInTheDocument();
|
|
1089
1123
|
} );
|
|
1090
|
-
it( 'should not
|
|
1124
|
+
it( 'should not have a selected tab if the active tab is removed, but should select a tab that gets added if it matches the selectedTabId', async () => {
|
|
1091
1125
|
const { rerender } = await render(
|
|
1092
1126
|
<ControlledTabs tabs={ TABS } selectedTabId="beta" />
|
|
1093
1127
|
);
|
|
1094
1128
|
|
|
1129
|
+
expect( await getSelectedTab() ).toHaveTextContent( 'Beta' );
|
|
1130
|
+
|
|
1095
1131
|
// Remove beta
|
|
1096
1132
|
await rerender(
|
|
1097
1133
|
<ControlledTabs
|
|
@@ -1110,6 +1146,7 @@ describe( 'Tabs', () => {
|
|
|
1110
1146
|
screen.queryByRole( 'tab', { selected: true } )
|
|
1111
1147
|
).not.toBeInTheDocument()
|
|
1112
1148
|
);
|
|
1149
|
+
|
|
1113
1150
|
// No tabpanel should be rendered either
|
|
1114
1151
|
expect( screen.queryByRole( 'tabpanel' ) ).not.toBeInTheDocument();
|
|
1115
1152
|
|
|
@@ -1118,17 +1155,11 @@ describe( 'Tabs', () => {
|
|
|
1118
1155
|
<ControlledTabs tabs={ TABS } selectedTabId="beta" />
|
|
1119
1156
|
);
|
|
1120
1157
|
|
|
1121
|
-
|
|
1122
|
-
// removed tab.
|
|
1123
|
-
expect(
|
|
1124
|
-
screen.queryByRole( 'tab', { selected: true } )
|
|
1125
|
-
).not.toBeInTheDocument();
|
|
1126
|
-
// No tabpanel should be rendered either
|
|
1127
|
-
expect( screen.queryByRole( 'tabpanel' ) ).not.toBeInTheDocument();
|
|
1158
|
+
expect( await getSelectedTab() ).toHaveTextContent( 'Beta' );
|
|
1128
1159
|
} );
|
|
1129
1160
|
|
|
1130
1161
|
describe( 'Disabled tab', () => {
|
|
1131
|
-
it( 'should
|
|
1162
|
+
it( 'should `selectedTabId` refers to a disabled tab', async () => {
|
|
1132
1163
|
const TABS_WITH_DELTA_WITH_BETA_DISABLED = TABS_WITH_DELTA.map(
|
|
1133
1164
|
( tabObj ) =>
|
|
1134
1165
|
tabObj.tabId === 'beta'
|
|
@@ -1149,18 +1180,9 @@ describe( 'Tabs', () => {
|
|
|
1149
1180
|
/>
|
|
1150
1181
|
);
|
|
1151
1182
|
|
|
1152
|
-
|
|
1153
|
-
await waitFor( () => {
|
|
1154
|
-
expect(
|
|
1155
|
-
screen.queryByRole( 'tab', { selected: true } )
|
|
1156
|
-
).not.toBeInTheDocument();
|
|
1157
|
-
} );
|
|
1158
|
-
// No tabpanel should be rendered either
|
|
1159
|
-
expect(
|
|
1160
|
-
screen.queryByRole( 'tabpanel' )
|
|
1161
|
-
).not.toBeInTheDocument();
|
|
1183
|
+
expect( await getSelectedTab() ).toHaveTextContent( 'Beta' );
|
|
1162
1184
|
} );
|
|
1163
|
-
it( 'should
|
|
1185
|
+
it( 'should keep the currently selected tab as selected even when it becomes disabled', async () => {
|
|
1164
1186
|
const { rerender } = await render(
|
|
1165
1187
|
<ControlledTabs tabs={ TABS } selectedTabId="beta" />
|
|
1166
1188
|
);
|
|
@@ -1185,33 +1207,15 @@ describe( 'Tabs', () => {
|
|
|
1185
1207
|
selectedTabId="beta"
|
|
1186
1208
|
/>
|
|
1187
1209
|
);
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
// throwing a 'not wrapped in `act()`' error.
|
|
1191
|
-
await waitFor( () => {
|
|
1192
|
-
expect(
|
|
1193
|
-
screen.queryByRole( 'tab', { selected: true } )
|
|
1194
|
-
).not.toBeInTheDocument();
|
|
1195
|
-
} );
|
|
1196
|
-
// No tabpanel should be rendered either
|
|
1197
|
-
expect(
|
|
1198
|
-
screen.queryByRole( 'tabpanel' )
|
|
1199
|
-
).not.toBeInTheDocument();
|
|
1210
|
+
|
|
1211
|
+
expect( await getSelectedTab() ).toHaveTextContent( 'Beta' );
|
|
1200
1212
|
|
|
1201
1213
|
// re-enable all tabs
|
|
1202
1214
|
await rerender(
|
|
1203
1215
|
<ControlledTabs tabs={ TABS } selectedTabId="beta" />
|
|
1204
1216
|
);
|
|
1205
1217
|
|
|
1206
|
-
|
|
1207
|
-
// be reselected.
|
|
1208
|
-
expect(
|
|
1209
|
-
screen.queryByRole( 'tab', { selected: true } )
|
|
1210
|
-
).not.toBeInTheDocument();
|
|
1211
|
-
// No tabpanel should be rendered either
|
|
1212
|
-
expect(
|
|
1213
|
-
screen.queryByRole( 'tabpanel' )
|
|
1214
|
-
).not.toBeInTheDocument();
|
|
1218
|
+
expect( await getSelectedTab() ).toHaveTextContent( 'Beta' );
|
|
1215
1219
|
} );
|
|
1216
1220
|
} );
|
|
1217
1221
|
describe( 'When `selectedId` is changed by the controlling component', () => {
|
|
@@ -1227,14 +1231,18 @@ describe( 'Tabs', () => {
|
|
|
1227
1231
|
/>
|
|
1228
1232
|
);
|
|
1229
1233
|
|
|
1234
|
+
expect( await getSelectedTab() ).toHaveTextContent(
|
|
1235
|
+
'Beta'
|
|
1236
|
+
);
|
|
1237
|
+
|
|
1230
1238
|
// Tab key should focus the currently selected tab, which is Beta.
|
|
1231
1239
|
await press.Tab();
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
'Beta'
|
|
1235
|
-
)
|
|
1240
|
+
expect( await getSelectedTab() ).toHaveTextContent(
|
|
1241
|
+
'Beta'
|
|
1236
1242
|
);
|
|
1237
|
-
expect(
|
|
1243
|
+
expect(
|
|
1244
|
+
screen.getByRole( 'tab', { name: 'Beta' } )
|
|
1245
|
+
).toHaveFocus();
|
|
1238
1246
|
|
|
1239
1247
|
await rerender(
|
|
1240
1248
|
<ControlledTabs
|
|
@@ -1244,12 +1252,10 @@ describe( 'Tabs', () => {
|
|
|
1244
1252
|
/>
|
|
1245
1253
|
);
|
|
1246
1254
|
|
|
1247
|
-
// When the selected tab is changed,
|
|
1248
|
-
|
|
1255
|
+
// When the selected tab is changed, focus should not be changed.
|
|
1249
1256
|
expect( await getSelectedTab() ).toHaveTextContent(
|
|
1250
1257
|
'Gamma'
|
|
1251
1258
|
);
|
|
1252
|
-
|
|
1253
1259
|
expect(
|
|
1254
1260
|
screen.getByRole( 'tab', { name: 'Beta' } )
|
|
1255
1261
|
).toHaveFocus();
|
|
@@ -1273,13 +1279,19 @@ describe( 'Tabs', () => {
|
|
|
1273
1279
|
</>
|
|
1274
1280
|
);
|
|
1275
1281
|
|
|
1282
|
+
expect( await getSelectedTab() ).toHaveTextContent(
|
|
1283
|
+
'Beta'
|
|
1284
|
+
);
|
|
1285
|
+
|
|
1276
1286
|
// Tab key should focus the currently selected tab, which is Beta.
|
|
1277
1287
|
await press.Tab();
|
|
1278
1288
|
await press.Tab();
|
|
1279
1289
|
expect( await getSelectedTab() ).toHaveTextContent(
|
|
1280
1290
|
'Beta'
|
|
1281
1291
|
);
|
|
1282
|
-
expect(
|
|
1292
|
+
expect(
|
|
1293
|
+
screen.getByRole( 'tab', { name: 'Beta' } )
|
|
1294
|
+
).toHaveFocus();
|
|
1283
1295
|
|
|
1284
1296
|
await rerender(
|
|
1285
1297
|
<>
|
|
@@ -1293,7 +1305,6 @@ describe( 'Tabs', () => {
|
|
|
1293
1305
|
);
|
|
1294
1306
|
|
|
1295
1307
|
// When the selected tab is changed, it should not automatically receive focus.
|
|
1296
|
-
|
|
1297
1308
|
expect( await getSelectedTab() ).toHaveTextContent(
|
|
1298
1309
|
'Gamma'
|
|
1299
1310
|
);
|
|
@@ -1332,6 +1343,8 @@ describe( 'Tabs', () => {
|
|
|
1332
1343
|
<ControlledTabs tabs={ TABS } selectedTabId="beta" />
|
|
1333
1344
|
);
|
|
1334
1345
|
|
|
1346
|
+
expect( await getSelectedTab() ).toHaveTextContent( 'Beta' );
|
|
1347
|
+
|
|
1335
1348
|
await press.Tab();
|
|
1336
1349
|
|
|
1337
1350
|
// Tab key should focus the currently selected tab, which is Beta.
|