@wordpress/components 33.1.1-next.v.202605131006.0 → 34.0.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 +30 -1
- package/build/autocomplete/index.cjs +5 -4
- package/build/autocomplete/index.cjs.map +3 -3
- package/build/border-control/border-control-dropdown/component.cjs +33 -33
- package/build/border-control/border-control-dropdown/component.cjs.map +3 -3
- package/build/box-control/index.cjs +0 -6
- package/build/box-control/index.cjs.map +2 -2
- package/build/box-control/utils.cjs +0 -38
- package/build/box-control/utils.cjs.map +3 -3
- package/build/custom-gradient-picker/gradient-bar/index.cjs.map +2 -2
- package/build/disabled/index.cjs +1 -1
- package/build/disabled/index.cjs.map +2 -2
- package/build/draggable/index.cjs +101 -7
- package/build/draggable/index.cjs.map +3 -3
- package/build/form-token-field/index.cjs +41 -7
- package/build/form-token-field/index.cjs.map +2 -2
- package/build/higher-order/with-notices/index.cjs +3 -15
- package/build/higher-order/with-notices/index.cjs.map +2 -2
- package/build/index.cjs +0 -17
- package/build/index.cjs.map +2 -2
- package/build/input-control/input-base.cjs +31 -34
- package/build/input-control/input-base.cjs.map +2 -2
- package/build/notice/index.cjs +33 -35
- package/build/notice/index.cjs.map +2 -2
- package/build/popover/index.cjs +12 -0
- package/build/popover/index.cjs.map +2 -2
- package/build/responsive-wrapper/index.cjs +4 -3
- package/build/responsive-wrapper/index.cjs.map +2 -2
- package/build/tabs/styles.cjs +5 -5
- package/build/tabs/styles.cjs.map +2 -2
- package/build/tooltip/index.cjs +2 -1
- package/build/tooltip/index.cjs.map +2 -2
- package/build-module/autocomplete/index.mjs +6 -5
- package/build-module/autocomplete/index.mjs.map +2 -2
- package/build-module/border-control/border-control-dropdown/component.mjs +34 -34
- package/build-module/border-control/border-control-dropdown/component.mjs.map +2 -2
- package/build-module/box-control/index.mjs +0 -2
- package/build-module/box-control/index.mjs.map +2 -2
- package/build-module/box-control/utils.mjs +0 -27
- package/build-module/box-control/utils.mjs.map +2 -2
- package/build-module/custom-gradient-picker/gradient-bar/index.mjs.map +2 -2
- package/build-module/disabled/index.mjs +1 -1
- package/build-module/disabled/index.mjs.map +2 -2
- package/build-module/draggable/index.mjs +101 -7
- package/build-module/draggable/index.mjs.map +3 -3
- package/build-module/form-token-field/index.mjs +41 -7
- package/build-module/form-token-field/index.mjs.map +2 -2
- package/build-module/higher-order/with-notices/index.mjs +4 -16
- package/build-module/higher-order/with-notices/index.mjs.map +2 -2
- package/build-module/index.mjs +87 -99
- package/build-module/index.mjs.map +2 -2
- package/build-module/input-control/input-base.mjs +31 -34
- package/build-module/input-control/input-base.mjs.map +2 -2
- package/build-module/notice/index.mjs +34 -36
- package/build-module/notice/index.mjs.map +2 -2
- package/build-module/popover/index.mjs +12 -0
- package/build-module/popover/index.mjs.map +2 -2
- package/build-module/responsive-wrapper/index.mjs +4 -3
- package/build-module/responsive-wrapper/index.mjs.map +2 -2
- package/build-module/tabs/styles.mjs +5 -5
- package/build-module/tabs/styles.mjs.map +2 -2
- package/build-module/tooltip/index.mjs +2 -1
- package/build-module/tooltip/index.mjs.map +2 -2
- package/build-style/style-rtl.css +64 -66
- package/build-style/style.css +64 -66
- package/build-types/autocomplete/index.d.ts.map +1 -1
- package/build-types/badge/stories/e2e/index.story.d.ts +7 -0
- package/build-types/badge/stories/e2e/index.story.d.ts.map +1 -0
- package/build-types/border-box-control/border-box-control/hook.d.ts +24 -10
- package/build-types/border-box-control/border-box-control/hook.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts +26 -12
- package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +24 -10
- package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts +25 -11
- package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts.map +1 -1
- package/build-types/border-control/border-control/hook.d.ts +24 -10
- 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/border-control-dropdown/hook.d.ts +23 -9
- package/build-types/border-control/border-control-dropdown/hook.d.ts.map +1 -1
- package/build-types/box-control/index.d.ts +0 -1
- package/build-types/box-control/index.d.ts.map +1 -1
- package/build-types/box-control/styles/box-control-styles.d.ts +3 -4
- package/build-types/box-control/styles/box-control-styles.d.ts.map +1 -1
- package/build-types/box-control/utils.d.ts +0 -13
- package/build-types/box-control/utils.d.ts.map +1 -1
- package/build-types/button/stories/e2e/index.story.d.ts +1 -0
- package/build-types/button/stories/e2e/index.story.d.ts.map +1 -1
- package/build-types/card/card/hook.d.ts +25 -11
- package/build-types/card/card/hook.d.ts.map +1 -1
- package/build-types/card/card-body/hook.d.ts +25 -11
- package/build-types/card/card-body/hook.d.ts.map +1 -1
- package/build-types/card/card-divider/hook.d.ts +26 -12
- package/build-types/card/card-divider/hook.d.ts.map +1 -1
- package/build-types/card/card-footer/hook.d.ts +25 -11
- package/build-types/card/card-footer/hook.d.ts.map +1 -1
- package/build-types/card/card-header/hook.d.ts +25 -11
- package/build-types/card/card-header/hook.d.ts.map +1 -1
- package/build-types/card/card-media/hook.d.ts +25 -11
- package/build-types/card/card-media/hook.d.ts.map +1 -1
- package/build-types/color-picker/styles.d.ts +3 -4
- package/build-types/color-picker/styles.d.ts.map +1 -1
- package/build-types/composite/stories/index.story.d.ts.map +1 -1
- package/build-types/custom-gradient-picker/gradient-bar/index.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/styles.d.ts +4 -12
- package/build-types/custom-select-control-v2/styles.d.ts.map +1 -1
- package/build-types/date-time/time-picker/styles.d.ts +4 -4
- package/build-types/draggable/index.d.ts.map +1 -1
- package/build-types/draggable/stories/index.story.d.ts +4 -5
- package/build-types/draggable/stories/index.story.d.ts.map +1 -1
- package/build-types/draggable/types.d.ts +4 -0
- package/build-types/draggable/types.d.ts.map +1 -1
- package/build-types/elevation/hook.d.ts +25 -11
- package/build-types/elevation/hook.d.ts.map +1 -1
- package/build-types/flex/flex/hook.d.ts +25 -11
- package/build-types/flex/flex/hook.d.ts.map +1 -1
- package/build-types/flex/flex-block/hook.d.ts +25 -11
- package/build-types/flex/flex-block/hook.d.ts.map +1 -1
- package/build-types/flex/flex-item/hook.d.ts +25 -11
- package/build-types/flex/flex-item/hook.d.ts.map +1 -1
- package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +1 -1
- package/build-types/form-token-field/index.d.ts.map +1 -1
- package/build-types/grid/hook.d.ts +25 -11
- package/build-types/grid/hook.d.ts.map +1 -1
- package/build-types/h-stack/hook.d.ts +25 -11
- package/build-types/h-stack/hook.d.ts.map +1 -1
- package/build-types/heading/hook.d.ts +25 -11
- package/build-types/heading/hook.d.ts.map +1 -1
- package/build-types/higher-order/with-fallback-styles/index.d.ts +1 -3
- package/build-types/higher-order/with-filters/index.d.ts +1 -6
- package/build-types/higher-order/with-filters/index.d.ts.map +1 -1
- package/build-types/higher-order/with-notices/index.d.ts +2 -4
- package/build-types/higher-order/with-notices/index.d.ts.map +1 -1
- package/build-types/icon/stories/index.story.d.ts +0 -6
- package/build-types/icon/stories/index.story.d.ts.map +1 -1
- package/build-types/index.d.ts +1 -6
- package/build-types/index.d.ts.map +1 -1
- package/build-types/input-control/reducer/reducer.d.ts +1 -1
- package/build-types/item-group/item/hook.d.ts +25 -11
- package/build-types/item-group/item/hook.d.ts.map +1 -1
- package/build-types/item-group/item-group/hook.d.ts +25 -11
- package/build-types/item-group/item-group/hook.d.ts.map +1 -1
- package/build-types/menu/stories/index.story.d.ts.map +1 -1
- package/build-types/menu/styles.d.ts +7 -21
- package/build-types/menu/styles.d.ts.map +1 -1
- package/build-types/modal/use-modal-exit-animation.d.ts +1 -1
- package/build-types/navigator/navigator-back-button/hook.d.ts +26 -12
- package/build-types/navigator/navigator-back-button/hook.d.ts.map +1 -1
- package/build-types/navigator/navigator-button/hook.d.ts +26 -12
- package/build-types/navigator/navigator-button/hook.d.ts.map +1 -1
- package/build-types/notice/index.d.ts.map +1 -1
- package/build-types/notice/types.d.ts +1 -2
- package/build-types/notice/types.d.ts.map +1 -1
- package/build-types/number-control/index.d.ts +1 -1
- package/build-types/number-control/index.d.ts.map +1 -1
- package/build-types/number-control/stories/index.story.d.ts +1 -1
- package/build-types/number-control/stories/index.story.d.ts.map +1 -1
- package/build-types/popover/index.d.ts.map +1 -1
- package/build-types/popover/types.d.ts +2 -2
- package/build-types/popover/types.d.ts.map +1 -1
- package/build-types/range-control/index.d.ts +2 -3
- package/build-types/range-control/index.d.ts.map +1 -1
- package/build-types/range-control/stories/index.story.d.ts.map +1 -1
- package/build-types/range-control/styles/range-control-styles.d.ts +1 -1
- package/build-types/range-control/types.d.ts +1 -5
- package/build-types/range-control/types.d.ts.map +1 -1
- package/build-types/responsive-wrapper/index.d.ts.map +1 -1
- package/build-types/scrollable/hook.d.ts +25 -11
- package/build-types/scrollable/hook.d.ts.map +1 -1
- package/build-types/snackbar/index.d.ts +2 -2
- package/build-types/snackbar/types.d.ts +2 -2
- package/build-types/snackbar/types.d.ts.map +1 -1
- package/build-types/spacer/hook.d.ts +25 -11
- package/build-types/spacer/hook.d.ts.map +1 -1
- package/build-types/surface/hook.d.ts +25 -11
- package/build-types/surface/hook.d.ts.map +1 -1
- package/build-types/tab-panel/stories/index.story.d.ts +0 -6
- package/build-types/tab-panel/stories/index.story.d.ts.map +1 -1
- package/build-types/tabs/stories/index.story.d.ts +0 -6
- package/build-types/tabs/stories/index.story.d.ts.map +1 -1
- package/build-types/tabs/styles.d.ts +3 -9
- package/build-types/tabs/styles.d.ts.map +1 -1
- package/build-types/text/hook.d.ts +25 -11
- package/build-types/text/hook.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel/hook.d.ts +25 -11
- package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel-header/hook.d.ts +25 -11
- package/build-types/tools-panel/tools-panel-header/hook.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel-item/hook.d.ts +25 -11
- package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
- package/build-types/tooltip/index.d.ts.map +1 -1
- package/build-types/truncate/hook.d.ts +25 -11
- package/build-types/truncate/hook.d.ts.map +1 -1
- package/build-types/unit-control/index.d.ts +1 -1
- package/build-types/unit-control/index.d.ts.map +1 -1
- package/build-types/unit-control/styles/unit-control-styles.d.ts +1 -1
- package/build-types/utils/get-node-text.d.ts.map +1 -1
- package/build-types/v-stack/hook.d.ts +25 -11
- package/build-types/v-stack/hook.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/number-control.d.ts +1 -1
- package/build-types/validated-form-controls/components/number-control.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/range-control.d.ts +2 -3
- package/build-types/validated-form-controls/components/range-control.d.ts.map +1 -1
- package/build-types/validated-form-controls/control-with-error.d.ts +4 -1
- package/build-types/validated-form-controls/control-with-error.d.ts.map +1 -1
- package/package.json +27 -25
- package/src/autocomplete/README.md +1 -1
- package/src/autocomplete/index.tsx +25 -7
- package/src/badge/stories/e2e/index.story.tsx +21 -0
- package/src/border-control/border-control-dropdown/component.tsx +36 -37
- package/src/box-control/index.tsx +0 -1
- package/src/box-control/utils.ts +0 -43
- package/src/button/stories/e2e/index.story.tsx +11 -0
- package/src/composite/stories/index.story.tsx +0 -1
- package/src/custom-gradient-picker/gradient-bar/index.tsx +1 -1
- package/src/disabled/index.tsx +1 -1
- package/src/draggable/index.tsx +32 -10
- package/src/draggable/stories/index.story.tsx +11 -6
- package/src/draggable/style.module.scss +29 -0
- package/src/draggable/types.ts +4 -0
- package/src/form-file-upload/README.md +1 -1
- package/src/form-token-field/index.tsx +84 -8
- package/src/form-token-field/test/index.tsx +189 -0
- package/src/h-stack/hook.tsx +1 -1
- package/src/higher-order/with-notices/index.tsx +4 -21
- package/src/higher-order/with-notices/test/index.tsx +0 -18
- package/src/icon/stories/index.story.tsx +2 -14
- package/src/index.ts +0 -6
- package/src/input-control/input-base.tsx +2 -2
- package/src/menu/README.md +7 -7
- package/src/menu/stories/index.story.tsx +0 -1
- package/src/menu/test/index.tsx +9 -4
- package/src/modal/style.scss +2 -1
- package/src/notice/README.md +1 -2
- package/src/notice/index.tsx +57 -64
- package/src/notice/style.scss +49 -41
- package/src/notice/test/__snapshots__/index.tsx.snap +23 -23
- package/src/notice/test/index.tsx +5 -5
- package/src/notice/types.ts +1 -2
- package/src/popover/index.tsx +29 -1
- package/src/popover/test/index.tsx +138 -1
- package/src/popover/types.ts +2 -4
- package/src/range-control/stories/index.story.tsx +0 -1
- package/src/range-control/types.ts +1 -5
- package/src/responsive-wrapper/index.tsx +7 -3
- package/src/snackbar/README.md +1 -1
- package/src/snackbar/types.ts +2 -2
- package/src/style.scss +0 -1
- package/src/tab-panel/stories/index.story.tsx +2 -13
- package/src/tab-panel/style.scss +36 -14
- package/src/tabs/README.md +1 -1
- package/src/tabs/stories/index.story.tsx +2 -14
- package/src/tabs/styles.ts +3 -8
- package/src/tabs/tablist.tsx +1 -1
- package/src/tooltip/index.tsx +7 -1
- package/src/tree-grid/test/cell.tsx +0 -1
- package/src/tree-grid/test/roving-tab-index-item.tsx +0 -1
- package/src/tree-select/README.md +1 -1
- package/src/utils/get-node-text.ts +7 -1
- package/src/validated-form-controls/control-with-error.tsx +6 -1
- package/build/navigation/back-button/index.cjs +0 -86
- package/build/navigation/back-button/index.cjs.map +0 -7
- package/build/navigation/constants.cjs +0 -34
- package/build/navigation/constants.cjs.map +0 -7
- package/build/navigation/context.cjs +0 -58
- package/build/navigation/context.cjs.map +0 -7
- package/build/navigation/group/context.cjs +0 -38
- package/build/navigation/group/context.cjs.map +0 -7
- package/build/navigation/group/index.cjs +0 -88
- package/build/navigation/group/index.cjs.map +0 -7
- package/build/navigation/index.cjs +0 -113
- package/build/navigation/index.cjs.map +0 -7
- package/build/navigation/item/base-content.cjs +0 -44
- package/build/navigation/item/base-content.cjs.map +0 -7
- package/build/navigation/item/base.cjs +0 -66
- package/build/navigation/item/base.cjs.map +0 -7
- package/build/navigation/item/index.cjs +0 -119
- package/build/navigation/item/index.cjs.map +0 -7
- package/build/navigation/item/use-navigation-tree-item.cjs +0 -64
- package/build/navigation/item/use-navigation-tree-item.cjs.map +0 -7
- package/build/navigation/menu/context.cjs +0 -39
- package/build/navigation/menu/context.cjs.map +0 -7
- package/build/navigation/menu/index.cjs +0 -114
- package/build/navigation/menu/index.cjs.map +0 -7
- package/build/navigation/menu/menu-title-search.cjs +0 -111
- package/build/navigation/menu/menu-title-search.cjs.map +0 -7
- package/build/navigation/menu/menu-title.cjs +0 -104
- package/build/navigation/menu/menu-title.cjs.map +0 -7
- package/build/navigation/menu/search-no-results-found.cjs +0 -48
- package/build/navigation/menu/search-no-results-found.cjs.map +0 -7
- package/build/navigation/menu/use-navigation-tree-menu.cjs +0 -51
- package/build/navigation/menu/use-navigation-tree-menu.cjs.map +0 -7
- package/build/navigation/styles/navigation-styles.cjs +0 -170
- package/build/navigation/styles/navigation-styles.cjs.map +0 -7
- package/build/navigation/types.cjs +0 -19
- package/build/navigation/types.cjs.map +0 -7
- package/build/navigation/use-create-navigation-tree.cjs +0 -103
- package/build/navigation/use-create-navigation-tree.cjs.map +0 -7
- package/build/navigation/use-navigation-tree-nodes.cjs +0 -60
- package/build/navigation/use-navigation-tree-nodes.cjs.map +0 -7
- package/build/navigation/utils.cjs +0 -45
- package/build/navigation/utils.cjs.map +0 -7
- package/build-module/navigation/back-button/index.mjs +0 -51
- package/build-module/navigation/back-button/index.mjs.map +0 -7
- package/build-module/navigation/constants.mjs +0 -8
- package/build-module/navigation/constants.mjs.map +0 -7
- package/build-module/navigation/context.mjs +0 -32
- package/build-module/navigation/context.mjs.map +0 -7
- package/build-module/navigation/group/context.mjs +0 -12
- package/build-module/navigation/group/context.mjs.map +0 -7
- package/build-module/navigation/group/index.mjs +0 -53
- package/build-module/navigation/group/index.mjs.map +0 -7
- package/build-module/navigation/index.mjs +0 -78
- package/build-module/navigation/index.mjs.map +0 -7
- package/build-module/navigation/item/base-content.mjs +0 -23
- package/build-module/navigation/item/base-content.mjs.map +0 -7
- package/build-module/navigation/item/base.mjs +0 -35
- package/build-module/navigation/item/base.mjs.map +0 -7
- package/build-module/navigation/item/index.mjs +0 -84
- package/build-module/navigation/item/index.mjs.map +0 -7
- package/build-module/navigation/item/use-navigation-tree-item.mjs +0 -39
- package/build-module/navigation/item/use-navigation-tree-item.mjs.map +0 -7
- package/build-module/navigation/menu/context.mjs +0 -13
- package/build-module/navigation/menu/context.mjs.map +0 -7
- package/build-module/navigation/menu/index.mjs +0 -79
- package/build-module/navigation/menu/index.mjs.map +0 -7
- package/build-module/navigation/menu/menu-title-search.mjs +0 -80
- package/build-module/navigation/menu/menu-title-search.mjs.map +0 -7
- package/build-module/navigation/menu/menu-title.mjs +0 -73
- package/build-module/navigation/menu/menu-title.mjs.map +0 -7
- package/build-module/navigation/menu/search-no-results-found.mjs +0 -27
- package/build-module/navigation/menu/search-no-results-found.mjs.map +0 -7
- package/build-module/navigation/menu/use-navigation-tree-menu.mjs +0 -26
- package/build-module/navigation/menu/use-navigation-tree-menu.mjs.map +0 -7
- package/build-module/navigation/styles/navigation-styles.mjs +0 -124
- package/build-module/navigation/styles/navigation-styles.mjs.map +0 -7
- package/build-module/navigation/types.mjs +0 -1
- package/build-module/navigation/types.mjs.map +0 -7
- package/build-module/navigation/use-create-navigation-tree.mjs +0 -78
- package/build-module/navigation/use-create-navigation-tree.mjs.map +0 -7
- package/build-module/navigation/use-navigation-tree-nodes.mjs +0 -35
- package/build-module/navigation/use-navigation-tree-nodes.mjs.map +0 -7
- package/build-module/navigation/utils.mjs +0 -9
- package/build-module/navigation/utils.mjs.map +0 -7
- package/build-types/navigation/back-button/index.d.ts +0 -7
- package/build-types/navigation/back-button/index.d.ts.map +0 -1
- package/build-types/navigation/constants.d.ts +0 -3
- package/build-types/navigation/constants.d.ts.map +0 -1
- package/build-types/navigation/context.d.ts +0 -4
- package/build-types/navigation/context.d.ts.map +0 -1
- package/build-types/navigation/group/context.d.ts +0 -7
- package/build-types/navigation/group/context.d.ts.map +0 -1
- package/build-types/navigation/group/index.d.ts +0 -7
- package/build-types/navigation/group/index.d.ts.map +0 -1
- package/build-types/navigation/index.d.ts +0 -46
- package/build-types/navigation/index.d.ts.map +0 -1
- package/build-types/navigation/item/base-content.d.ts +0 -3
- package/build-types/navigation/item/base-content.d.ts.map +0 -1
- package/build-types/navigation/item/base.d.ts +0 -3
- package/build-types/navigation/item/base.d.ts.map +0 -1
- package/build-types/navigation/item/index.d.ts +0 -7
- package/build-types/navigation/item/index.d.ts.map +0 -1
- package/build-types/navigation/item/use-navigation-tree-item.d.ts +0 -3
- package/build-types/navigation/item/use-navigation-tree-item.d.ts.map +0 -1
- package/build-types/navigation/menu/context.d.ts +0 -7
- package/build-types/navigation/menu/context.d.ts.map +0 -1
- package/build-types/navigation/menu/index.d.ts +0 -7
- package/build-types/navigation/menu/index.d.ts.map +0 -1
- package/build-types/navigation/menu/menu-title-search.d.ts +0 -3
- package/build-types/navigation/menu/menu-title-search.d.ts.map +0 -1
- package/build-types/navigation/menu/menu-title.d.ts +0 -3
- package/build-types/navigation/menu/menu-title.d.ts.map +0 -1
- package/build-types/navigation/menu/search-no-results-found.d.ts +0 -3
- package/build-types/navigation/menu/search-no-results-found.d.ts.map +0 -1
- package/build-types/navigation/menu/use-navigation-tree-menu.d.ts +0 -3
- package/build-types/navigation/menu/use-navigation-tree-menu.d.ts.map +0 -1
- package/build-types/navigation/stories/index.story.d.ts +0 -23
- package/build-types/navigation/stories/index.story.d.ts.map +0 -1
- package/build-types/navigation/stories/utils/controlled-state.d.ts +0 -7
- package/build-types/navigation/stories/utils/controlled-state.d.ts.map +0 -1
- package/build-types/navigation/stories/utils/default.d.ts +0 -10
- package/build-types/navigation/stories/utils/default.d.ts.map +0 -1
- package/build-types/navigation/stories/utils/group.d.ts +0 -10
- package/build-types/navigation/stories/utils/group.d.ts.map +0 -1
- package/build-types/navigation/stories/utils/hide-if-empty.d.ts +0 -10
- package/build-types/navigation/stories/utils/hide-if-empty.d.ts.map +0 -1
- package/build-types/navigation/stories/utils/more-examples.d.ts +0 -10
- package/build-types/navigation/stories/utils/more-examples.d.ts.map +0 -1
- package/build-types/navigation/stories/utils/search.d.ts +0 -10
- package/build-types/navigation/stories/utils/search.d.ts.map +0 -1
- package/build-types/navigation/styles/navigation-styles.d.ts +0 -55
- package/build-types/navigation/styles/navigation-styles.d.ts.map +0 -1
- package/build-types/navigation/test/index.d.ts +0 -2
- package/build-types/navigation/test/index.d.ts.map +0 -1
- package/build-types/navigation/types.d.ts +0 -266
- package/build-types/navigation/types.d.ts.map +0 -1
- package/build-types/navigation/use-create-navigation-tree.d.ts +0 -15
- package/build-types/navigation/use-create-navigation-tree.d.ts.map +0 -1
- package/build-types/navigation/use-navigation-tree-nodes.d.ts +0 -10
- package/build-types/navigation/use-navigation-tree-nodes.d.ts.map +0 -1
- package/build-types/navigation/utils.d.ts +0 -3
- package/build-types/navigation/utils.d.ts.map +0 -1
- package/src/draggable/style.scss +0 -21
- package/src/navigation/README.md +0 -267
- package/src/navigation/back-button/index.tsx +0 -73
- package/src/navigation/constants.tsx +0 -2
- package/src/navigation/context.tsx +0 -40
- package/src/navigation/group/context.tsx +0 -16
- package/src/navigation/group/index.tsx +0 -73
- package/src/navigation/index.tsx +0 -152
- package/src/navigation/item/base-content.tsx +0 -31
- package/src/navigation/item/base.tsx +0 -42
- package/src/navigation/item/index.tsx +0 -112
- package/src/navigation/item/use-navigation-tree-item.tsx +0 -47
- package/src/navigation/menu/context.tsx +0 -20
- package/src/navigation/menu/index.tsx +0 -105
- package/src/navigation/menu/menu-title-search.tsx +0 -99
- package/src/navigation/menu/menu-title.tsx +0 -100
- package/src/navigation/menu/search-no-results-found.tsx +0 -34
- package/src/navigation/menu/use-navigation-tree-menu.tsx +0 -29
- package/src/navigation/stories/index.story.tsx +0 -62
- package/src/navigation/stories/style.css +0 -25
- package/src/navigation/stories/utils/controlled-state.tsx +0 -149
- package/src/navigation/stories/utils/default.tsx +0 -92
- package/src/navigation/stories/utils/group.tsx +0 -61
- package/src/navigation/stories/utils/hide-if-empty.tsx +0 -66
- package/src/navigation/stories/utils/more-examples.tsx +0 -162
- package/src/navigation/stories/utils/search.tsx +0 -91
- package/src/navigation/styles/navigation-styles.tsx +0 -197
- package/src/navigation/test/index.tsx +0 -347
- package/src/navigation/types.ts +0 -325
- package/src/navigation/use-create-navigation-tree.tsx +0 -110
- package/src/navigation/use-navigation-tree-nodes.tsx +0 -31
- package/src/navigation/utils.tsx +0 -11
|
@@ -1,347 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { render, screen } from '@testing-library/react';
|
|
5
|
-
import userEvent from '@testing-library/user-event';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* WordPress dependencies
|
|
9
|
-
*/
|
|
10
|
-
import { useState } from '@wordpress/element';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Internal dependencies
|
|
14
|
-
*/
|
|
15
|
-
import Navigation from '..';
|
|
16
|
-
import NavigationItem from '../item';
|
|
17
|
-
import NavigationMenu from '../menu';
|
|
18
|
-
|
|
19
|
-
const TestNavigation = ( {
|
|
20
|
-
activeItem,
|
|
21
|
-
rootTitle,
|
|
22
|
-
showBadge,
|
|
23
|
-
}: {
|
|
24
|
-
activeItem?: string;
|
|
25
|
-
rootTitle?: string;
|
|
26
|
-
showBadge?: boolean;
|
|
27
|
-
} ) => (
|
|
28
|
-
<Navigation activeItem={ activeItem }>
|
|
29
|
-
<NavigationMenu title={ rootTitle }>
|
|
30
|
-
<NavigationItem
|
|
31
|
-
badge={ showBadge ? 21 : undefined }
|
|
32
|
-
item="item-1"
|
|
33
|
-
title="Item 1"
|
|
34
|
-
/>
|
|
35
|
-
<NavigationItem
|
|
36
|
-
href="http://example.com"
|
|
37
|
-
item="item-2"
|
|
38
|
-
target="_blank"
|
|
39
|
-
title="Item 2"
|
|
40
|
-
/>
|
|
41
|
-
<NavigationItem
|
|
42
|
-
navigateToMenu="category"
|
|
43
|
-
item="category"
|
|
44
|
-
title="Category"
|
|
45
|
-
/>
|
|
46
|
-
<NavigationItem item="item-3">
|
|
47
|
-
<span>customize me</span>
|
|
48
|
-
</NavigationItem>
|
|
49
|
-
</NavigationMenu>
|
|
50
|
-
<NavigationMenu
|
|
51
|
-
backButtonLabel="Home"
|
|
52
|
-
menu="category"
|
|
53
|
-
parentMenu="root"
|
|
54
|
-
title="Category"
|
|
55
|
-
>
|
|
56
|
-
<NavigationItem item="child-1" title="Child 1" />
|
|
57
|
-
<NavigationItem item="child-2" title="Child 2" />
|
|
58
|
-
</NavigationMenu>
|
|
59
|
-
</Navigation>
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
const TestNavigationControlled = () => {
|
|
63
|
-
const [ activeItem, setActiveItem ] = useState( 'item-1' );
|
|
64
|
-
const [ activeMenu, setActiveMenu ] = useState( 'root' );
|
|
65
|
-
|
|
66
|
-
const onMockLinkClick: React.MouseEventHandler< HTMLAnchorElement > = (
|
|
67
|
-
event
|
|
68
|
-
) => {
|
|
69
|
-
event.preventDefault();
|
|
70
|
-
const item = ( event.target as HTMLAnchorElement ).href.replace(
|
|
71
|
-
'https://example.com/',
|
|
72
|
-
''
|
|
73
|
-
);
|
|
74
|
-
setActiveItem( item );
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
return (
|
|
78
|
-
<>
|
|
79
|
-
<Navigation
|
|
80
|
-
activeItem={ activeItem }
|
|
81
|
-
activeMenu={ activeMenu }
|
|
82
|
-
className="navigation-story"
|
|
83
|
-
onActivateMenu={ setActiveMenu }
|
|
84
|
-
>
|
|
85
|
-
<NavigationMenu title="Home">
|
|
86
|
-
<NavigationItem
|
|
87
|
-
item="item-1"
|
|
88
|
-
title="Item 1"
|
|
89
|
-
href="https://example.com/item-1"
|
|
90
|
-
onClick={ onMockLinkClick }
|
|
91
|
-
/>
|
|
92
|
-
<NavigationItem
|
|
93
|
-
item="item-2"
|
|
94
|
-
title="Item 2"
|
|
95
|
-
href="https://example.com/item-2"
|
|
96
|
-
onClick={ onMockLinkClick }
|
|
97
|
-
/>
|
|
98
|
-
<NavigationItem
|
|
99
|
-
item="item-sub-menu"
|
|
100
|
-
navigateToMenu="sub-menu"
|
|
101
|
-
title="Sub-Menu"
|
|
102
|
-
/>
|
|
103
|
-
</NavigationMenu>
|
|
104
|
-
<NavigationMenu
|
|
105
|
-
menu="sub-menu"
|
|
106
|
-
parentMenu="root"
|
|
107
|
-
title="Sub-Menu"
|
|
108
|
-
>
|
|
109
|
-
<NavigationItem
|
|
110
|
-
item="child-1"
|
|
111
|
-
onClick={ () => setActiveItem( 'child-1' ) }
|
|
112
|
-
title="Child 1"
|
|
113
|
-
/>
|
|
114
|
-
<NavigationItem
|
|
115
|
-
item="child-2"
|
|
116
|
-
onClick={ () => setActiveItem( 'child-2' ) }
|
|
117
|
-
title="Child 2"
|
|
118
|
-
/>
|
|
119
|
-
<NavigationItem
|
|
120
|
-
item="child-nested-sub-menu"
|
|
121
|
-
navigateToMenu="nested-sub-menu"
|
|
122
|
-
title="Nested Sub-Menu"
|
|
123
|
-
/>
|
|
124
|
-
</NavigationMenu>
|
|
125
|
-
<NavigationMenu
|
|
126
|
-
menu="nested-sub-menu"
|
|
127
|
-
parentMenu="sub-menu"
|
|
128
|
-
title="Nested Sub-Menu"
|
|
129
|
-
>
|
|
130
|
-
<NavigationItem
|
|
131
|
-
item="sub-child-1"
|
|
132
|
-
onClick={ () => setActiveItem( 'sub-child-1' ) }
|
|
133
|
-
title="Sub-Child 1"
|
|
134
|
-
/>
|
|
135
|
-
<NavigationItem
|
|
136
|
-
item="sub-child-2"
|
|
137
|
-
onClick={ () => setActiveItem( 'sub-child-2' ) }
|
|
138
|
-
title="Sub-Child 2"
|
|
139
|
-
/>
|
|
140
|
-
</NavigationMenu>
|
|
141
|
-
</Navigation>
|
|
142
|
-
|
|
143
|
-
<div className="navigation-story__aside">
|
|
144
|
-
<p>
|
|
145
|
-
Menu <code>{ activeMenu }</code> is active.
|
|
146
|
-
<br />
|
|
147
|
-
Item <code>{ activeItem }</code> is active.
|
|
148
|
-
</p>
|
|
149
|
-
<p>
|
|
150
|
-
<button
|
|
151
|
-
onClick={ () => {
|
|
152
|
-
setActiveMenu( 'nested-sub-menu' );
|
|
153
|
-
} }
|
|
154
|
-
>
|
|
155
|
-
Open the Nested Sub-Menu menu
|
|
156
|
-
</button>
|
|
157
|
-
</p>
|
|
158
|
-
<p>
|
|
159
|
-
<button
|
|
160
|
-
onClick={ () => {
|
|
161
|
-
setActiveItem( 'child-2' );
|
|
162
|
-
setActiveMenu( 'sub-menu' );
|
|
163
|
-
} }
|
|
164
|
-
>
|
|
165
|
-
Navigate to Child 2 item
|
|
166
|
-
</button>
|
|
167
|
-
</p>
|
|
168
|
-
</div>
|
|
169
|
-
</>
|
|
170
|
-
);
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
describe( 'Navigation', () => {
|
|
174
|
-
it( 'should render the panes and active item', async () => {
|
|
175
|
-
render( <TestNavigation activeItem="item-2" /> );
|
|
176
|
-
|
|
177
|
-
const menuItems = screen.getAllByRole( 'listitem' );
|
|
178
|
-
|
|
179
|
-
expect( console ).toHaveWarnedWith(
|
|
180
|
-
'wp.components.Navigation (and all subcomponents) is deprecated since version 6.8 and will be removed in version 7.1. Please use wp.components.Navigator instead.'
|
|
181
|
-
);
|
|
182
|
-
|
|
183
|
-
expect( menuItems ).toHaveLength( 4 );
|
|
184
|
-
expect( menuItems[ 0 ] ).toHaveTextContent( 'Item 1' );
|
|
185
|
-
expect( menuItems[ 1 ] ).toHaveTextContent( 'Item 2' );
|
|
186
|
-
expect( menuItems[ 2 ] ).toHaveTextContent( 'Category' );
|
|
187
|
-
expect( menuItems[ 3 ] ).toHaveTextContent( 'customize me' );
|
|
188
|
-
|
|
189
|
-
expect(
|
|
190
|
-
screen.getByRole( 'link', { current: 'page' } )
|
|
191
|
-
).toHaveTextContent( 'Item 2' );
|
|
192
|
-
} );
|
|
193
|
-
|
|
194
|
-
it( 'should render anchor links when menu item supplies an href', () => {
|
|
195
|
-
render( <TestNavigation /> );
|
|
196
|
-
|
|
197
|
-
const linkItem = screen.getByRole( 'link', { name: 'Item 2' } );
|
|
198
|
-
|
|
199
|
-
expect( linkItem ).toBeInTheDocument();
|
|
200
|
-
expect( linkItem ).toHaveAttribute( 'target', '_blank' );
|
|
201
|
-
} );
|
|
202
|
-
|
|
203
|
-
it( 'should render a custom component when menu item supplies one', () => {
|
|
204
|
-
render( <TestNavigation /> );
|
|
205
|
-
|
|
206
|
-
expect( screen.getByText( 'customize me' ) ).toBeInTheDocument();
|
|
207
|
-
} );
|
|
208
|
-
|
|
209
|
-
it( 'should set an active category on click', async () => {
|
|
210
|
-
const user = userEvent.setup();
|
|
211
|
-
|
|
212
|
-
render( <TestNavigation /> );
|
|
213
|
-
|
|
214
|
-
await user.click( screen.getByRole( 'button', { name: 'Category' } ) );
|
|
215
|
-
|
|
216
|
-
expect( screen.getByRole( 'heading' ) ).toHaveTextContent( 'Category' );
|
|
217
|
-
const menuItems = screen.getAllByRole( 'listitem' );
|
|
218
|
-
expect( menuItems ).toHaveLength( 2 );
|
|
219
|
-
expect( menuItems[ 0 ] ).toHaveTextContent( 'Child 1' );
|
|
220
|
-
expect( menuItems[ 1 ] ).toHaveTextContent( 'Child 2' );
|
|
221
|
-
} );
|
|
222
|
-
|
|
223
|
-
it( 'should render the root title', () => {
|
|
224
|
-
const { rerender } = render( <TestNavigation /> );
|
|
225
|
-
|
|
226
|
-
expect( screen.queryByRole( 'heading' ) ).not.toBeInTheDocument();
|
|
227
|
-
|
|
228
|
-
rerender( <TestNavigation rootTitle="Home" /> );
|
|
229
|
-
|
|
230
|
-
expect( screen.getByRole( 'heading' ) ).toBeInTheDocument();
|
|
231
|
-
expect( screen.getByRole( 'heading' ) ).toHaveTextContent( 'Home' );
|
|
232
|
-
} );
|
|
233
|
-
|
|
234
|
-
it( 'should render badges', () => {
|
|
235
|
-
render( <TestNavigation showBadge /> );
|
|
236
|
-
|
|
237
|
-
const menuItem = screen.getAllByRole( 'listitem' );
|
|
238
|
-
expect( menuItem[ 0 ] ).toHaveTextContent( 'Item 1' + '21' );
|
|
239
|
-
} );
|
|
240
|
-
|
|
241
|
-
it( 'should render menu titles when items exist', () => {
|
|
242
|
-
const { rerender } = render( <Navigation></Navigation> );
|
|
243
|
-
|
|
244
|
-
expect( screen.queryByText( 'Menu title' ) ).not.toBeInTheDocument();
|
|
245
|
-
|
|
246
|
-
rerender( <TestNavigation rootTitle="Menu title" /> );
|
|
247
|
-
|
|
248
|
-
expect( screen.getByText( 'Menu title' ) ).toBeInTheDocument();
|
|
249
|
-
} );
|
|
250
|
-
|
|
251
|
-
it( 'should navigate up a level when clicking the back button', async () => {
|
|
252
|
-
const user = userEvent.setup();
|
|
253
|
-
|
|
254
|
-
render( <TestNavigation rootTitle="Home" /> );
|
|
255
|
-
|
|
256
|
-
await user.click( screen.getByRole( 'button', { name: 'Category' } ) );
|
|
257
|
-
|
|
258
|
-
expect( screen.getByRole( 'heading' ) ).toHaveTextContent( 'Category' );
|
|
259
|
-
|
|
260
|
-
await user.click( screen.getByRole( 'button', { name: 'Home' } ) );
|
|
261
|
-
|
|
262
|
-
expect( screen.getByRole( 'heading' ) ).toHaveTextContent( 'Home' );
|
|
263
|
-
} );
|
|
264
|
-
|
|
265
|
-
it( 'should navigate correctly when controlled', async () => {
|
|
266
|
-
const user = userEvent.setup();
|
|
267
|
-
|
|
268
|
-
render( <TestNavigationControlled /> );
|
|
269
|
-
|
|
270
|
-
// check root menu is shown and item 1 is selected
|
|
271
|
-
expect(
|
|
272
|
-
screen.getByRole( 'heading', { name: 'Home' } )
|
|
273
|
-
).toBeInTheDocument();
|
|
274
|
-
expect(
|
|
275
|
-
screen.getByRole( 'link', { current: 'page' } )
|
|
276
|
-
).toHaveTextContent( 'Item 1' );
|
|
277
|
-
|
|
278
|
-
// click Item 2, check it's selected
|
|
279
|
-
await user.click( screen.getByRole( 'link', { name: 'Item 2' } ) );
|
|
280
|
-
expect(
|
|
281
|
-
screen.getByRole( 'link', { current: 'page' } )
|
|
282
|
-
).toHaveTextContent( 'Item 2' );
|
|
283
|
-
|
|
284
|
-
// click sub-menu, check new menu is shown
|
|
285
|
-
await user.click( screen.getByRole( 'button', { name: 'Sub-Menu' } ) );
|
|
286
|
-
expect(
|
|
287
|
-
screen.getByRole( 'heading', { name: 'Sub-Menu' } )
|
|
288
|
-
).toBeInTheDocument();
|
|
289
|
-
|
|
290
|
-
// click Child 1, check it's selected
|
|
291
|
-
await user.click( screen.getByRole( 'button', { name: 'Child 1' } ) );
|
|
292
|
-
expect(
|
|
293
|
-
screen.getByRole( 'button', { current: 'page' } )
|
|
294
|
-
).toHaveTextContent( 'Child 1' );
|
|
295
|
-
|
|
296
|
-
// click nested sub-menu, check nested sub-menu is shown
|
|
297
|
-
await user.click(
|
|
298
|
-
screen.getByRole( 'button', { name: 'Nested Sub-Menu' } )
|
|
299
|
-
);
|
|
300
|
-
expect(
|
|
301
|
-
screen.getByRole( 'heading', { name: 'Nested Sub-Menu' } )
|
|
302
|
-
).toBeInTheDocument();
|
|
303
|
-
|
|
304
|
-
// click Sub Child 2, check it's selected
|
|
305
|
-
await user.click(
|
|
306
|
-
screen.getByRole( 'button', { name: 'Sub-Child 2' } )
|
|
307
|
-
);
|
|
308
|
-
expect(
|
|
309
|
-
screen.getByRole( 'button', { current: 'page' } )
|
|
310
|
-
).toHaveTextContent( 'Sub-Child 2' );
|
|
311
|
-
|
|
312
|
-
// click back, check sub-menu is shown
|
|
313
|
-
await user.click( screen.getByRole( 'button', { name: 'Sub-Menu' } ) );
|
|
314
|
-
expect(
|
|
315
|
-
screen.getByRole( 'heading', { name: 'Sub-Menu' } )
|
|
316
|
-
).toBeInTheDocument();
|
|
317
|
-
|
|
318
|
-
// click back, check root menu is shown
|
|
319
|
-
await user.click( screen.getByRole( 'button', { name: 'Home' } ) );
|
|
320
|
-
expect(
|
|
321
|
-
screen.getByRole( 'heading', { name: 'Home' } )
|
|
322
|
-
).toBeInTheDocument();
|
|
323
|
-
|
|
324
|
-
// click the programmatic nested sub-menu button, check nested sub menu is shown
|
|
325
|
-
await user.click(
|
|
326
|
-
screen.getByRole( 'button', {
|
|
327
|
-
name: 'Open the Nested Sub-Menu menu',
|
|
328
|
-
} )
|
|
329
|
-
);
|
|
330
|
-
expect(
|
|
331
|
-
screen.getByRole( 'heading', { name: 'Nested Sub-Menu' } )
|
|
332
|
-
).toBeInTheDocument();
|
|
333
|
-
|
|
334
|
-
// click navigate to child2 item button, check the correct menu is shown and the item is selected
|
|
335
|
-
await user.click(
|
|
336
|
-
screen.getByRole( 'button', {
|
|
337
|
-
name: 'Navigate to Child 2 item',
|
|
338
|
-
} )
|
|
339
|
-
);
|
|
340
|
-
expect(
|
|
341
|
-
screen.getByRole( 'heading', { name: 'Sub-Menu' } )
|
|
342
|
-
).toBeInTheDocument();
|
|
343
|
-
expect(
|
|
344
|
-
screen.getByRole( 'button', { current: 'page' } )
|
|
345
|
-
).toHaveTextContent( 'Child 2' );
|
|
346
|
-
} );
|
|
347
|
-
} );
|
package/src/navigation/types.ts
DELETED
|
@@ -1,325 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Internal dependencies
|
|
3
|
-
*/
|
|
4
|
-
import type { ButtonProps } from '../button/types';
|
|
5
|
-
|
|
6
|
-
type IfDiscriminantDefinedBothRequired< TDiscriminant, TOther > =
|
|
7
|
-
// When props in TDiscriminant are specified,
|
|
8
|
-
// then props from TOther are required too
|
|
9
|
-
| {
|
|
10
|
-
[ K in keyof ( TDiscriminant & TOther ) ]: NonNullable<
|
|
11
|
-
( TDiscriminant & TOther )[ K ]
|
|
12
|
-
>;
|
|
13
|
-
}
|
|
14
|
-
// When props in TDiscriminant are not specified,
|
|
15
|
-
// then props from TOther are optional
|
|
16
|
-
| ( {
|
|
17
|
-
[ K in keyof TDiscriminant ]?: never;
|
|
18
|
-
} & {
|
|
19
|
-
[ K in keyof TOther ]?: TOther[ K ];
|
|
20
|
-
} );
|
|
21
|
-
|
|
22
|
-
// React Components
|
|
23
|
-
|
|
24
|
-
export type NavigationProps = {
|
|
25
|
-
/**
|
|
26
|
-
* The active item slug.
|
|
27
|
-
*/
|
|
28
|
-
activeItem?: string;
|
|
29
|
-
/**
|
|
30
|
-
* The active menu slug.
|
|
31
|
-
*
|
|
32
|
-
* @default 'root'
|
|
33
|
-
*/
|
|
34
|
-
activeMenu?: string;
|
|
35
|
-
/**
|
|
36
|
-
* The children components.
|
|
37
|
-
*/
|
|
38
|
-
children?: React.ReactNode;
|
|
39
|
-
/**
|
|
40
|
-
* Optional classname for the component.
|
|
41
|
-
*/
|
|
42
|
-
className?: string;
|
|
43
|
-
/**
|
|
44
|
-
* Callback used to sync the active menu between the external state
|
|
45
|
-
* and the Navigation's internal state.
|
|
46
|
-
*/
|
|
47
|
-
onActivateMenu?: ( activeMenuSlug: string ) => void;
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
// When `onSearch` is specified, `search` should be specified too
|
|
51
|
-
type _NavigationMenuSearchProps = IfDiscriminantDefinedBothRequired<
|
|
52
|
-
{
|
|
53
|
-
/**
|
|
54
|
-
* When the `hasSearch` prop is `true`, this callback handles the search
|
|
55
|
-
* input's `onChange` event, making it controlled from the outside.
|
|
56
|
-
* When using this prop, the `search` prop should be also set.
|
|
57
|
-
*/
|
|
58
|
-
onSearch: ( searchString: string ) => void;
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
/**
|
|
62
|
-
* When the `hasSearch` is `true` and the `onSearch` prop is provided, this
|
|
63
|
-
* prop controls the value of the search input.
|
|
64
|
-
* Required when the `onSearch` prop is provided.
|
|
65
|
-
*/
|
|
66
|
-
search: string;
|
|
67
|
-
}
|
|
68
|
-
>;
|
|
69
|
-
|
|
70
|
-
export type NavigationMenuProps = _NavigationMenuSearchProps & {
|
|
71
|
-
/**
|
|
72
|
-
* The back button label used in nested menus.
|
|
73
|
-
* If not provided, the label will be inferred from the parent menu's title.
|
|
74
|
-
* If the parent menu's title is not available then it will default to "Back".
|
|
75
|
-
*
|
|
76
|
-
* @default parentMenuTitle ?? 'Back'
|
|
77
|
-
*/
|
|
78
|
-
backButtonLabel?: string;
|
|
79
|
-
/**
|
|
80
|
-
* A callback to handle clicking on the back button.
|
|
81
|
-
* If this prop is provided then the back button will be shown.
|
|
82
|
-
*/
|
|
83
|
-
onBackButtonClick?: React.MouseEventHandler< HTMLElement >;
|
|
84
|
-
/**
|
|
85
|
-
* The children components.
|
|
86
|
-
*/
|
|
87
|
-
children?: React.ReactNode;
|
|
88
|
-
/**
|
|
89
|
-
* Optional classname for the component.
|
|
90
|
-
*/
|
|
91
|
-
className?: string;
|
|
92
|
-
/**
|
|
93
|
-
* When `true`, enables the search feature on the menu title.
|
|
94
|
-
*/
|
|
95
|
-
hasSearch?: boolean;
|
|
96
|
-
/**
|
|
97
|
-
* Indicates whether the menu is empty or not. Used together with the
|
|
98
|
-
* `hideIfTargetMenuEmpty` prop of `NavigationItem`.
|
|
99
|
-
*/
|
|
100
|
-
isEmpty?: boolean;
|
|
101
|
-
/**
|
|
102
|
-
* Indicates whether the search is debouncing or not. In case of `true`, the
|
|
103
|
-
* "No results found." text is omitted. Used to prevent showing the
|
|
104
|
-
* "No results found." text between debounced searches.
|
|
105
|
-
*/
|
|
106
|
-
isSearchDebouncing?: boolean;
|
|
107
|
-
/**
|
|
108
|
-
* The unique identifier of the menu.
|
|
109
|
-
* The root menu can omit this prop, and it will default to "root".
|
|
110
|
-
* All other menus need to specify it.
|
|
111
|
-
*
|
|
112
|
-
* @default 'root'
|
|
113
|
-
*/
|
|
114
|
-
menu?: string;
|
|
115
|
-
/**
|
|
116
|
-
* The parent menu slug; used by nested menus to indicate their parent menu.
|
|
117
|
-
*/
|
|
118
|
-
parentMenu?: string;
|
|
119
|
-
/**
|
|
120
|
-
* The menu title. It's also the field used by the menu search function.
|
|
121
|
-
*/
|
|
122
|
-
title?: string;
|
|
123
|
-
/**
|
|
124
|
-
* Use this prop to render additional actions in the menu title.
|
|
125
|
-
*/
|
|
126
|
-
titleAction?: React.ReactNode;
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
export type NavigationGroupProps = {
|
|
130
|
-
/**
|
|
131
|
-
* Optional classname for the component.
|
|
132
|
-
*/
|
|
133
|
-
className?: string;
|
|
134
|
-
/**
|
|
135
|
-
* The group title.
|
|
136
|
-
*/
|
|
137
|
-
title?: string;
|
|
138
|
-
/**
|
|
139
|
-
* The children components.
|
|
140
|
-
*/
|
|
141
|
-
children: React.ReactNode;
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
type _NavigationItemButtonProps =
|
|
145
|
-
| ( ButtonProps & {
|
|
146
|
-
/**
|
|
147
|
-
* If set to `true` the menu item will only act as a text-only item,
|
|
148
|
-
* rather than a `<button />` or `<a />` element.
|
|
149
|
-
*/
|
|
150
|
-
isText?: false;
|
|
151
|
-
} )
|
|
152
|
-
| {
|
|
153
|
-
/**
|
|
154
|
-
* If set to `true` the menu item will only act as a text-only item,
|
|
155
|
-
* rather than a `<button />` or `<a />` element.
|
|
156
|
-
*/
|
|
157
|
-
isText: true;
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
export type NavigationItemBaseProps = {
|
|
161
|
-
/**
|
|
162
|
-
* The item badge content.
|
|
163
|
-
*/
|
|
164
|
-
badge?: string | number;
|
|
165
|
-
/**
|
|
166
|
-
* The children components. When not specified, the item will render the
|
|
167
|
-
* default item UI.
|
|
168
|
-
*/
|
|
169
|
-
children?: React.ReactNode;
|
|
170
|
-
/**
|
|
171
|
-
* Optional classname for the component.
|
|
172
|
-
*/
|
|
173
|
-
className?: string;
|
|
174
|
-
/**
|
|
175
|
-
* If provided, causes the component to render an `<a />` element
|
|
176
|
-
* instead of a `<button />` element.
|
|
177
|
-
*/
|
|
178
|
-
href?: string;
|
|
179
|
-
/**
|
|
180
|
-
* If no `children` are passed, this prop allows to specify a custom icon for
|
|
181
|
-
* the menu item.
|
|
182
|
-
*/
|
|
183
|
-
icon?: React.JSX.Element;
|
|
184
|
-
/**
|
|
185
|
-
* The unique identifier of the item.
|
|
186
|
-
*/
|
|
187
|
-
item?: string;
|
|
188
|
-
/**
|
|
189
|
-
* The child menu slug. If provided, clicking on the item will navigate
|
|
190
|
-
* to the target menu.
|
|
191
|
-
*/
|
|
192
|
-
navigateToMenu?: string;
|
|
193
|
-
/**
|
|
194
|
-
* Indicates whether this item should be hidden if the menu specified in
|
|
195
|
-
* `navigateToMenu` is marked as empty in the `isEmpty` prop.
|
|
196
|
-
* Used together with the `isEmpty` prop of `NavigationMenu`.
|
|
197
|
-
*/
|
|
198
|
-
hideIfTargetMenuEmpty?: boolean;
|
|
199
|
-
/**
|
|
200
|
-
* A callback to handle clicking on a menu item.
|
|
201
|
-
*
|
|
202
|
-
* @default noop
|
|
203
|
-
*/
|
|
204
|
-
onClick?: React.MouseEventHandler;
|
|
205
|
-
/**
|
|
206
|
-
* The item title.
|
|
207
|
-
*/
|
|
208
|
-
title?: string;
|
|
209
|
-
};
|
|
210
|
-
|
|
211
|
-
export type NavigationItemProps = _NavigationItemButtonProps &
|
|
212
|
-
NavigationItemBaseProps;
|
|
213
|
-
|
|
214
|
-
export type NavigationItemBaseContentProps = Pick<
|
|
215
|
-
NavigationItemProps,
|
|
216
|
-
'badge' | 'title'
|
|
217
|
-
>;
|
|
218
|
-
|
|
219
|
-
export type NavigationBackButtonProps = {
|
|
220
|
-
/**
|
|
221
|
-
* The text displayed for the button
|
|
222
|
-
*/
|
|
223
|
-
backButtonLabel?: string;
|
|
224
|
-
/**
|
|
225
|
-
* Optional classname for the component.
|
|
226
|
-
*/
|
|
227
|
-
className?: string;
|
|
228
|
-
/**
|
|
229
|
-
* If provided, causes the component to render an `<a />` element
|
|
230
|
-
* instead of a `<button />` element.
|
|
231
|
-
*/
|
|
232
|
-
href?: string;
|
|
233
|
-
/**
|
|
234
|
-
* Callback function called when the button is clicked.
|
|
235
|
-
*/
|
|
236
|
-
onClick?: React.MouseEventHandler;
|
|
237
|
-
/**
|
|
238
|
-
* Id of the parent menu
|
|
239
|
-
*/
|
|
240
|
-
parentMenu?: string;
|
|
241
|
-
};
|
|
242
|
-
|
|
243
|
-
export type NavigationMenuTitleSearchProps = Pick<
|
|
244
|
-
NavigationMenuProps,
|
|
245
|
-
'onSearch' | 'search' | 'title'
|
|
246
|
-
> & {
|
|
247
|
-
// @see `speak` function from `@wordpress/a11y`
|
|
248
|
-
debouncedSpeak: (
|
|
249
|
-
message: string,
|
|
250
|
-
ariaLive?: 'off' | 'polite' | 'assertive'
|
|
251
|
-
) => void;
|
|
252
|
-
onCloseSearch: () => void;
|
|
253
|
-
};
|
|
254
|
-
|
|
255
|
-
export type NavigationMenuTitleProps = Pick<
|
|
256
|
-
NavigationMenuProps,
|
|
257
|
-
'hasSearch' | 'onSearch' | 'search' | 'title' | 'titleAction'
|
|
258
|
-
>;
|
|
259
|
-
|
|
260
|
-
export type NavigationSearchNoResultsFoundProps = Pick<
|
|
261
|
-
NavigationMenuProps,
|
|
262
|
-
'search'
|
|
263
|
-
>;
|
|
264
|
-
|
|
265
|
-
// Data objects & context
|
|
266
|
-
|
|
267
|
-
export type Item = Omit< NavigationItemBaseProps, 'children' > & {
|
|
268
|
-
/**
|
|
269
|
-
* The group id
|
|
270
|
-
*/
|
|
271
|
-
group?: string;
|
|
272
|
-
/**
|
|
273
|
-
* The menu id
|
|
274
|
-
*/
|
|
275
|
-
menu?: string;
|
|
276
|
-
/**
|
|
277
|
-
* True is the item is currently visible (ie. the item is part
|
|
278
|
-
* of the active menu, and — if there is a search query — its title
|
|
279
|
-
* matches the search query).
|
|
280
|
-
*/
|
|
281
|
-
_isVisible: boolean;
|
|
282
|
-
};
|
|
283
|
-
|
|
284
|
-
export type Menu = Omit< NavigationMenuProps, 'children' > & {
|
|
285
|
-
menu: string;
|
|
286
|
-
};
|
|
287
|
-
|
|
288
|
-
export type NavigationGroupContext = {
|
|
289
|
-
/**
|
|
290
|
-
* The unique id of the group
|
|
291
|
-
*/
|
|
292
|
-
group?: string;
|
|
293
|
-
};
|
|
294
|
-
|
|
295
|
-
export type NavigationMenuContext = {
|
|
296
|
-
menu?: string;
|
|
297
|
-
search?: string;
|
|
298
|
-
};
|
|
299
|
-
|
|
300
|
-
export type NavigationContext = {
|
|
301
|
-
activeItem?: string;
|
|
302
|
-
activeMenu: string;
|
|
303
|
-
setActiveMenu: (
|
|
304
|
-
parentMenu: string,
|
|
305
|
-
animationDirection?: 'left' | 'right'
|
|
306
|
-
) => void;
|
|
307
|
-
|
|
308
|
-
navigationTree: {
|
|
309
|
-
items: Record< string, Item >;
|
|
310
|
-
getItem: ( itemId: string ) => Item | undefined;
|
|
311
|
-
addItem: ( itemId: string, itemProps: Item ) => void;
|
|
312
|
-
removeItem: ( itemId: string ) => void;
|
|
313
|
-
|
|
314
|
-
menus: Record< string, Menu >;
|
|
315
|
-
getMenu: ( menuId: string ) => Menu | undefined;
|
|
316
|
-
addMenu: ( menuId: string, menuProps: Menu ) => void;
|
|
317
|
-
removeMenu: ( menuId: string ) => void;
|
|
318
|
-
childMenu: Record< string, string[] >;
|
|
319
|
-
traverseMenu: (
|
|
320
|
-
startMenu: string,
|
|
321
|
-
callback: ( menuObject: Menu ) => boolean | undefined
|
|
322
|
-
) => void;
|
|
323
|
-
isMenuEmpty: ( menuId: string ) => boolean;
|
|
324
|
-
};
|
|
325
|
-
};
|