@wordpress/components 33.1.1-next.v.202605131032.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,99 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useEffect, useRef } from '@wordpress/element';
|
|
5
|
-
import { __, _n, sprintf } from '@wordpress/i18n';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Internal dependencies
|
|
9
|
-
*/
|
|
10
|
-
import withSpokenMessages from '../../higher-order/with-spoken-messages';
|
|
11
|
-
import { useNavigationMenuContext } from './context';
|
|
12
|
-
import { useNavigationContext } from '../context';
|
|
13
|
-
import { SEARCH_FOCUS_DELAY } from '../constants';
|
|
14
|
-
|
|
15
|
-
import type { NavigationMenuTitleSearchProps } from '../types';
|
|
16
|
-
import SearchControl from '../../search-control';
|
|
17
|
-
import { MenuTitleSearchControlWrapper } from '../styles/navigation-styles';
|
|
18
|
-
|
|
19
|
-
function MenuTitleSearch( {
|
|
20
|
-
debouncedSpeak,
|
|
21
|
-
onCloseSearch,
|
|
22
|
-
onSearch,
|
|
23
|
-
search,
|
|
24
|
-
title,
|
|
25
|
-
}: NavigationMenuTitleSearchProps ) {
|
|
26
|
-
const {
|
|
27
|
-
navigationTree: { items },
|
|
28
|
-
} = useNavigationContext();
|
|
29
|
-
const { menu } = useNavigationMenuContext();
|
|
30
|
-
const inputRef = useRef< HTMLInputElement >( null );
|
|
31
|
-
|
|
32
|
-
// Wait for the slide-in animation to complete before autofocusing the input.
|
|
33
|
-
// This prevents scrolling to the input during the animation.
|
|
34
|
-
useEffect( () => {
|
|
35
|
-
const delayedFocus = setTimeout( () => {
|
|
36
|
-
inputRef.current?.focus();
|
|
37
|
-
}, SEARCH_FOCUS_DELAY );
|
|
38
|
-
|
|
39
|
-
return () => {
|
|
40
|
-
clearTimeout( delayedFocus );
|
|
41
|
-
};
|
|
42
|
-
}, [] );
|
|
43
|
-
|
|
44
|
-
useEffect( () => {
|
|
45
|
-
if ( ! search ) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const count = Object.values( items ).filter(
|
|
50
|
-
( item ) => item._isVisible
|
|
51
|
-
).length;
|
|
52
|
-
const resultsFoundMessage = sprintf(
|
|
53
|
-
/* translators: %d: number of results. */
|
|
54
|
-
_n( '%d result found.', '%d results found.', count ),
|
|
55
|
-
count
|
|
56
|
-
);
|
|
57
|
-
debouncedSpeak( resultsFoundMessage );
|
|
58
|
-
// Not adding deps for now, as it would require either a larger refactor.
|
|
59
|
-
// See https://github.com/WordPress/gutenberg/pull/44090
|
|
60
|
-
}, [ items, search ] );
|
|
61
|
-
|
|
62
|
-
const onClose = () => {
|
|
63
|
-
onSearch?.( '' );
|
|
64
|
-
onCloseSearch();
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
const onKeyDown: React.KeyboardEventHandler< HTMLInputElement > = (
|
|
68
|
-
event
|
|
69
|
-
) => {
|
|
70
|
-
if ( event.code === 'Escape' && ! event.defaultPrevented ) {
|
|
71
|
-
event.preventDefault();
|
|
72
|
-
onClose();
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
const inputId = `components-navigation__menu-title-search-${ menu }`;
|
|
77
|
-
const placeholder = sprintf(
|
|
78
|
-
/* translators: placeholder for menu search box. %s: menu title */
|
|
79
|
-
__( 'Search %s' ),
|
|
80
|
-
title?.toLowerCase() || ''
|
|
81
|
-
).trim();
|
|
82
|
-
|
|
83
|
-
return (
|
|
84
|
-
<MenuTitleSearchControlWrapper>
|
|
85
|
-
<SearchControl
|
|
86
|
-
className="components-navigation__menu-search-input"
|
|
87
|
-
id={ inputId }
|
|
88
|
-
onChange={ ( value ) => onSearch?.( value ) }
|
|
89
|
-
onKeyDown={ onKeyDown }
|
|
90
|
-
placeholder={ placeholder }
|
|
91
|
-
onClose={ onClose }
|
|
92
|
-
ref={ inputRef }
|
|
93
|
-
value={ search }
|
|
94
|
-
/>
|
|
95
|
-
</MenuTitleSearchControlWrapper>
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export default withSpokenMessages( MenuTitleSearch );
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useRef, useState } from '@wordpress/element';
|
|
5
|
-
import { __, sprintf } from '@wordpress/i18n';
|
|
6
|
-
import { Icon, search as searchIcon } from '@wordpress/icons';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Internal dependencies
|
|
10
|
-
*/
|
|
11
|
-
import { getAnimateClassName } from '../../animate';
|
|
12
|
-
import Button from '../../button';
|
|
13
|
-
import MenuTitleSearch from './menu-title-search';
|
|
14
|
-
import {
|
|
15
|
-
GroupTitleUI,
|
|
16
|
-
MenuTitleActionsUI,
|
|
17
|
-
MenuTitleUI,
|
|
18
|
-
} from '../styles/navigation-styles';
|
|
19
|
-
import { useNavigationMenuContext } from './context';
|
|
20
|
-
import { SEARCH_FOCUS_DELAY } from '../constants';
|
|
21
|
-
|
|
22
|
-
import type { NavigationMenuTitleProps } from '../types';
|
|
23
|
-
|
|
24
|
-
export default function NavigationMenuTitle( {
|
|
25
|
-
hasSearch,
|
|
26
|
-
onSearch,
|
|
27
|
-
search,
|
|
28
|
-
title,
|
|
29
|
-
titleAction,
|
|
30
|
-
}: NavigationMenuTitleProps ) {
|
|
31
|
-
const [ isSearching, setIsSearching ] = useState( false );
|
|
32
|
-
const { menu } = useNavigationMenuContext();
|
|
33
|
-
const searchButtonRef = useRef< HTMLElement >( null );
|
|
34
|
-
|
|
35
|
-
if ( ! title ) {
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const onCloseSearch = () => {
|
|
40
|
-
setIsSearching( false );
|
|
41
|
-
|
|
42
|
-
// Wait for the slide-in animation to complete before focusing the search button.
|
|
43
|
-
// eslint-disable-next-line @wordpress/react-no-unsafe-timeout
|
|
44
|
-
setTimeout( () => {
|
|
45
|
-
searchButtonRef.current?.focus();
|
|
46
|
-
}, SEARCH_FOCUS_DELAY );
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
const menuTitleId = `components-navigation__menu-title-${ menu }`;
|
|
50
|
-
/* translators: search button label for menu search box. %s: menu title */
|
|
51
|
-
const searchButtonLabel = sprintf( __( 'Search in %s' ), title );
|
|
52
|
-
|
|
53
|
-
return (
|
|
54
|
-
<MenuTitleUI className="components-navigation__menu-title">
|
|
55
|
-
{ ! isSearching && (
|
|
56
|
-
<GroupTitleUI
|
|
57
|
-
as="h2"
|
|
58
|
-
className="components-navigation__menu-title-heading"
|
|
59
|
-
level={ 3 }
|
|
60
|
-
>
|
|
61
|
-
<span id={ menuTitleId }>{ title }</span>
|
|
62
|
-
|
|
63
|
-
{ ( hasSearch || titleAction ) && (
|
|
64
|
-
<MenuTitleActionsUI>
|
|
65
|
-
{ titleAction }
|
|
66
|
-
|
|
67
|
-
{ hasSearch && (
|
|
68
|
-
<Button
|
|
69
|
-
size="small"
|
|
70
|
-
variant="tertiary"
|
|
71
|
-
label={ searchButtonLabel }
|
|
72
|
-
onClick={ () => setIsSearching( true ) }
|
|
73
|
-
ref={ searchButtonRef }
|
|
74
|
-
>
|
|
75
|
-
<Icon icon={ searchIcon } />
|
|
76
|
-
</Button>
|
|
77
|
-
) }
|
|
78
|
-
</MenuTitleActionsUI>
|
|
79
|
-
) }
|
|
80
|
-
</GroupTitleUI>
|
|
81
|
-
) }
|
|
82
|
-
|
|
83
|
-
{ isSearching && (
|
|
84
|
-
<div
|
|
85
|
-
className={ getAnimateClassName( {
|
|
86
|
-
type: 'slide-in',
|
|
87
|
-
origin: 'left',
|
|
88
|
-
} ) }
|
|
89
|
-
>
|
|
90
|
-
<MenuTitleSearch
|
|
91
|
-
onCloseSearch={ onCloseSearch }
|
|
92
|
-
onSearch={ onSearch }
|
|
93
|
-
search={ search }
|
|
94
|
-
title={ title }
|
|
95
|
-
/>
|
|
96
|
-
</div>
|
|
97
|
-
) }
|
|
98
|
-
</MenuTitleUI>
|
|
99
|
-
);
|
|
100
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { __ } from '@wordpress/i18n';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Internal dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { useNavigationContext } from '../context';
|
|
10
|
-
import { ItemBaseUI, ItemUI } from '../styles/navigation-styles';
|
|
11
|
-
|
|
12
|
-
import type { NavigationSearchNoResultsFoundProps } from '../types';
|
|
13
|
-
|
|
14
|
-
export default function NavigationSearchNoResultsFound( {
|
|
15
|
-
search,
|
|
16
|
-
}: NavigationSearchNoResultsFoundProps ) {
|
|
17
|
-
const {
|
|
18
|
-
navigationTree: { items },
|
|
19
|
-
} = useNavigationContext();
|
|
20
|
-
|
|
21
|
-
const resultsCount = Object.values( items ).filter(
|
|
22
|
-
( item ) => item._isVisible
|
|
23
|
-
).length;
|
|
24
|
-
|
|
25
|
-
if ( ! search || !! resultsCount ) {
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return (
|
|
30
|
-
<ItemBaseUI>
|
|
31
|
-
<ItemUI>{ __( 'No results found.' ) } </ItemUI>
|
|
32
|
-
</ItemBaseUI>
|
|
33
|
-
);
|
|
34
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useEffect } from '@wordpress/element';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Internal dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { useNavigationContext } from '../context';
|
|
10
|
-
import { ROOT_MENU } from '../constants';
|
|
11
|
-
|
|
12
|
-
import type { NavigationMenuProps } from '../types';
|
|
13
|
-
|
|
14
|
-
export const useNavigationTreeMenu = ( props: NavigationMenuProps ) => {
|
|
15
|
-
const {
|
|
16
|
-
navigationTree: { addMenu, removeMenu },
|
|
17
|
-
} = useNavigationContext();
|
|
18
|
-
|
|
19
|
-
const key = props.menu || ROOT_MENU;
|
|
20
|
-
useEffect( () => {
|
|
21
|
-
addMenu( key, { ...props, menu: key } );
|
|
22
|
-
|
|
23
|
-
return () => {
|
|
24
|
-
removeMenu( key );
|
|
25
|
-
};
|
|
26
|
-
// Not adding deps for now, as it would require either a larger refactor
|
|
27
|
-
// See https://github.com/WordPress/gutenberg/pull/44090
|
|
28
|
-
}, [] );
|
|
29
|
-
};
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import type { Meta } from '@storybook/react-vite';
|
|
5
|
-
import { fn } from 'storybook/test';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Internal dependencies
|
|
9
|
-
*/
|
|
10
|
-
import { Navigation } from '..';
|
|
11
|
-
import { NavigationBackButton } from '../back-button';
|
|
12
|
-
import { NavigationGroup } from '../group';
|
|
13
|
-
import { NavigationItem } from '../item';
|
|
14
|
-
import { NavigationMenu } from '../menu';
|
|
15
|
-
import { DefaultStory } from './utils/default';
|
|
16
|
-
import { GroupStory } from './utils/group';
|
|
17
|
-
import { ControlledStateStory } from './utils/controlled-state';
|
|
18
|
-
import { SearchStory } from './utils/search';
|
|
19
|
-
import { MoreExamplesStory } from './utils/more-examples';
|
|
20
|
-
import { HideIfEmptyStory } from './utils/hide-if-empty';
|
|
21
|
-
import './style.css';
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Render a navigation list with optional groupings and hierarchy.
|
|
25
|
-
*
|
|
26
|
-
* This component is deprecated. Consider using `Navigator` instead.
|
|
27
|
-
*/
|
|
28
|
-
const meta: Meta< typeof Navigation > = {
|
|
29
|
-
title: 'Components/Deprecated/Navigation',
|
|
30
|
-
id: 'components-navigation',
|
|
31
|
-
component: Navigation,
|
|
32
|
-
subcomponents: {
|
|
33
|
-
NavigationBackButton,
|
|
34
|
-
NavigationGroup,
|
|
35
|
-
NavigationItem,
|
|
36
|
-
NavigationMenu,
|
|
37
|
-
},
|
|
38
|
-
argTypes: {
|
|
39
|
-
activeItem: { control: false },
|
|
40
|
-
activeMenu: { control: false },
|
|
41
|
-
children: { control: false },
|
|
42
|
-
onActivateMenu: { control: false },
|
|
43
|
-
},
|
|
44
|
-
args: {
|
|
45
|
-
onActivateMenu: fn(),
|
|
46
|
-
},
|
|
47
|
-
parameters: {
|
|
48
|
-
controls: {
|
|
49
|
-
expanded: true,
|
|
50
|
-
},
|
|
51
|
-
docs: { canvas: { sourceState: 'shown' } },
|
|
52
|
-
},
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
export default meta;
|
|
56
|
-
|
|
57
|
-
export const _default = DefaultStory.bind( {} );
|
|
58
|
-
export const ControlledState = ControlledStateStory.bind( {} );
|
|
59
|
-
export const Groups = GroupStory.bind( {} );
|
|
60
|
-
export const Search = SearchStory.bind( {} );
|
|
61
|
-
export const MoreExamples = MoreExamplesStory.bind( {} );
|
|
62
|
-
export const HideIfEmpty = HideIfEmptyStory.bind( {} );
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
.navigation-story {
|
|
2
|
-
max-width: 300px;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.navigation-story__aside {
|
|
6
|
-
margin: 48px 0 0 24px;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.navigation-story__wordpress-icon {
|
|
10
|
-
align-items: center;
|
|
11
|
-
display: inline-flex;
|
|
12
|
-
}
|
|
13
|
-
.navigation-story__wordpress-icon svg {
|
|
14
|
-
fill: #949494;
|
|
15
|
-
margin-right: 8px;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
:root[dir="rtl"] .navigation-story__wordpress-icon svg {
|
|
19
|
-
fill: #949494;
|
|
20
|
-
margin-right: 0;
|
|
21
|
-
margin-left: 8px;
|
|
22
|
-
}
|
|
23
|
-
.navigation-story__wordpress-icon:hover svg {
|
|
24
|
-
fill: #ddd;
|
|
25
|
-
}
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import type { StoryFn } from '@storybook/react-vite';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { useState } from '@wordpress/element';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Internal dependencies
|
|
13
|
-
*/
|
|
14
|
-
import Button from '../../../button';
|
|
15
|
-
import { Navigation } from '../..';
|
|
16
|
-
import { NavigationItem } from '../../item';
|
|
17
|
-
import { NavigationMenu } from '../../menu';
|
|
18
|
-
|
|
19
|
-
export const ControlledStateStory: StoryFn< typeof Navigation > = ( {
|
|
20
|
-
className,
|
|
21
|
-
...props
|
|
22
|
-
} ) => {
|
|
23
|
-
const [ activeItem, setActiveItem ] = useState( 'item-1' );
|
|
24
|
-
const [ activeMenu, setActiveMenu ] = useState( 'root' );
|
|
25
|
-
|
|
26
|
-
// Mock navigation link.
|
|
27
|
-
const MockLink = ( {
|
|
28
|
-
href,
|
|
29
|
-
children,
|
|
30
|
-
}: {
|
|
31
|
-
href: string;
|
|
32
|
-
children: React.ReactNode;
|
|
33
|
-
} ) => (
|
|
34
|
-
<Button
|
|
35
|
-
__next40pxDefaultSize
|
|
36
|
-
href={ href }
|
|
37
|
-
// Since we're not actually navigating pages, simulate it with onClick.
|
|
38
|
-
onClick={
|
|
39
|
-
( ( event ) => {
|
|
40
|
-
event.preventDefault();
|
|
41
|
-
const item = href.replace( 'https://example.com/', '' );
|
|
42
|
-
setActiveItem( item );
|
|
43
|
-
} ) as React.MouseEventHandler< HTMLAnchorElement >
|
|
44
|
-
}
|
|
45
|
-
>
|
|
46
|
-
{ children }
|
|
47
|
-
</Button>
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
return (
|
|
51
|
-
<>
|
|
52
|
-
<Navigation
|
|
53
|
-
{ ...props }
|
|
54
|
-
activeItem={ activeItem }
|
|
55
|
-
activeMenu={ activeMenu }
|
|
56
|
-
className={ [ 'navigation-story', className ]
|
|
57
|
-
.filter( Boolean )
|
|
58
|
-
.join( ' ' ) }
|
|
59
|
-
onActivateMenu={ setActiveMenu }
|
|
60
|
-
>
|
|
61
|
-
<NavigationMenu title="Home">
|
|
62
|
-
<NavigationItem item="item-1" title="Item 1">
|
|
63
|
-
<MockLink href="https://example.com/item-1">
|
|
64
|
-
Item 1
|
|
65
|
-
</MockLink>
|
|
66
|
-
</NavigationItem>
|
|
67
|
-
<NavigationItem item="item-2">
|
|
68
|
-
<MockLink href="https://example.com/item-2">
|
|
69
|
-
Item 2
|
|
70
|
-
</MockLink>
|
|
71
|
-
</NavigationItem>
|
|
72
|
-
<NavigationItem
|
|
73
|
-
item="item-sub-menu"
|
|
74
|
-
navigateToMenu="sub-menu"
|
|
75
|
-
title="Sub-Menu"
|
|
76
|
-
/>
|
|
77
|
-
</NavigationMenu>
|
|
78
|
-
<NavigationMenu
|
|
79
|
-
menu="sub-menu"
|
|
80
|
-
parentMenu="root"
|
|
81
|
-
title="Sub-Menu"
|
|
82
|
-
>
|
|
83
|
-
<NavigationItem
|
|
84
|
-
item="child-1"
|
|
85
|
-
onClick={ () => setActiveItem( 'child-1' ) }
|
|
86
|
-
title="Child 1"
|
|
87
|
-
/>
|
|
88
|
-
<NavigationItem
|
|
89
|
-
item="child-2"
|
|
90
|
-
onClick={ () => setActiveItem( 'child-2' ) }
|
|
91
|
-
title="Child 2"
|
|
92
|
-
/>
|
|
93
|
-
<NavigationItem
|
|
94
|
-
item="child-nested-sub-menu"
|
|
95
|
-
navigateToMenu="nested-sub-menu"
|
|
96
|
-
title="Nested Sub-Menu"
|
|
97
|
-
/>
|
|
98
|
-
</NavigationMenu>
|
|
99
|
-
<NavigationMenu
|
|
100
|
-
menu="nested-sub-menu"
|
|
101
|
-
parentMenu="sub-menu"
|
|
102
|
-
title="Nested Sub-Menu"
|
|
103
|
-
>
|
|
104
|
-
<NavigationItem
|
|
105
|
-
item="sub-child-1"
|
|
106
|
-
onClick={ () => setActiveItem( 'sub-child-1' ) }
|
|
107
|
-
title="Sub-Child 1"
|
|
108
|
-
/>
|
|
109
|
-
<NavigationItem
|
|
110
|
-
item="sub-child-2"
|
|
111
|
-
onClick={ () => setActiveItem( 'sub-child-2' ) }
|
|
112
|
-
title="Sub-Child 2"
|
|
113
|
-
/>
|
|
114
|
-
</NavigationMenu>
|
|
115
|
-
</Navigation>
|
|
116
|
-
|
|
117
|
-
<div className="navigation-story__aside">
|
|
118
|
-
<p>
|
|
119
|
-
Menu <code>{ activeMenu }</code> is active.
|
|
120
|
-
<br />
|
|
121
|
-
Item <code>{ activeItem }</code> is active.
|
|
122
|
-
</p>
|
|
123
|
-
<p>
|
|
124
|
-
<Button
|
|
125
|
-
__next40pxDefaultSize
|
|
126
|
-
variant="secondary"
|
|
127
|
-
onClick={ () => {
|
|
128
|
-
setActiveMenu( 'nested-sub-menu' );
|
|
129
|
-
} }
|
|
130
|
-
>
|
|
131
|
-
Open the Nested Sub-Menu menu
|
|
132
|
-
</Button>
|
|
133
|
-
</p>
|
|
134
|
-
<p>
|
|
135
|
-
<Button
|
|
136
|
-
__next40pxDefaultSize
|
|
137
|
-
variant="secondary"
|
|
138
|
-
onClick={ () => {
|
|
139
|
-
setActiveItem( 'child-2' );
|
|
140
|
-
setActiveMenu( 'sub-menu' );
|
|
141
|
-
} }
|
|
142
|
-
>
|
|
143
|
-
Navigate to Child 2 item
|
|
144
|
-
</Button>
|
|
145
|
-
</p>
|
|
146
|
-
</div>
|
|
147
|
-
</>
|
|
148
|
-
);
|
|
149
|
-
};
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import type { StoryFn } from '@storybook/react-vite';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { useState } from '@wordpress/element';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Internal dependencies
|
|
13
|
-
*/
|
|
14
|
-
import { Navigation } from '../..';
|
|
15
|
-
import { NavigationItem } from '../../item';
|
|
16
|
-
import { NavigationMenu } from '../../menu';
|
|
17
|
-
|
|
18
|
-
export const DefaultStory: StoryFn< typeof Navigation > = ( {
|
|
19
|
-
className,
|
|
20
|
-
...props
|
|
21
|
-
} ) => {
|
|
22
|
-
const [ activeItem, setActiveItem ] = useState( 'item-1' );
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<Navigation
|
|
26
|
-
{ ...props }
|
|
27
|
-
activeItem={ activeItem }
|
|
28
|
-
className={ [ 'navigation-story', className ]
|
|
29
|
-
.filter( Boolean )
|
|
30
|
-
.join( ' ' ) }
|
|
31
|
-
>
|
|
32
|
-
<NavigationMenu title="Home">
|
|
33
|
-
<NavigationItem
|
|
34
|
-
item="item-1"
|
|
35
|
-
onClick={ () => setActiveItem( 'item-1' ) }
|
|
36
|
-
title="Item 1"
|
|
37
|
-
/>
|
|
38
|
-
<NavigationItem
|
|
39
|
-
item="item-2"
|
|
40
|
-
onClick={ () => setActiveItem( 'item-2' ) }
|
|
41
|
-
title="Item 2"
|
|
42
|
-
/>
|
|
43
|
-
<NavigationItem>
|
|
44
|
-
<a
|
|
45
|
-
className="components-button"
|
|
46
|
-
href="http://www.example.com"
|
|
47
|
-
>
|
|
48
|
-
External Link
|
|
49
|
-
</a>
|
|
50
|
-
</NavigationItem>
|
|
51
|
-
<NavigationItem
|
|
52
|
-
item="item-sub-menu"
|
|
53
|
-
navigateToMenu="sub-menu"
|
|
54
|
-
title="Sub-Menu"
|
|
55
|
-
/>
|
|
56
|
-
</NavigationMenu>
|
|
57
|
-
<NavigationMenu menu="sub-menu" parentMenu="root" title="Sub-Menu">
|
|
58
|
-
<NavigationItem
|
|
59
|
-
item="child-1"
|
|
60
|
-
onClick={ () => setActiveItem( 'child-1' ) }
|
|
61
|
-
title="Child 1"
|
|
62
|
-
/>
|
|
63
|
-
<NavigationItem
|
|
64
|
-
item="child-2"
|
|
65
|
-
onClick={ () => setActiveItem( 'child-2' ) }
|
|
66
|
-
title="Child 2"
|
|
67
|
-
/>
|
|
68
|
-
<NavigationItem
|
|
69
|
-
item="child-nested-sub-menu"
|
|
70
|
-
navigateToMenu="nested-sub-menu"
|
|
71
|
-
title="Nested Sub-Menu"
|
|
72
|
-
/>
|
|
73
|
-
</NavigationMenu>
|
|
74
|
-
<NavigationMenu
|
|
75
|
-
menu="nested-sub-menu"
|
|
76
|
-
parentMenu="sub-menu"
|
|
77
|
-
title="Nested Sub-Menu"
|
|
78
|
-
>
|
|
79
|
-
<NavigationItem
|
|
80
|
-
item="sub-child-1"
|
|
81
|
-
onClick={ () => setActiveItem( 'sub-child-1' ) }
|
|
82
|
-
title="Sub-Child 1"
|
|
83
|
-
/>
|
|
84
|
-
<NavigationItem
|
|
85
|
-
item="sub-child-2"
|
|
86
|
-
onClick={ () => setActiveItem( 'sub-child-2' ) }
|
|
87
|
-
title="Sub-Child 2"
|
|
88
|
-
/>
|
|
89
|
-
</NavigationMenu>
|
|
90
|
-
</Navigation>
|
|
91
|
-
);
|
|
92
|
-
};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import type { StoryFn } from '@storybook/react-vite';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { useState } from '@wordpress/element';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Internal dependencies
|
|
13
|
-
*/
|
|
14
|
-
import { Navigation } from '../..';
|
|
15
|
-
import { NavigationItem } from '../../item';
|
|
16
|
-
import { NavigationMenu } from '../../menu';
|
|
17
|
-
import { NavigationGroup } from '../../group';
|
|
18
|
-
|
|
19
|
-
export const GroupStory: StoryFn< typeof Navigation > = ( {
|
|
20
|
-
className,
|
|
21
|
-
...props
|
|
22
|
-
} ) => {
|
|
23
|
-
const [ activeItem, setActiveItem ] = useState( 'item-1' );
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<Navigation
|
|
27
|
-
{ ...props }
|
|
28
|
-
activeItem={ activeItem }
|
|
29
|
-
className={ [ 'navigation-story', className ]
|
|
30
|
-
.filter( Boolean )
|
|
31
|
-
.join( ' ' ) }
|
|
32
|
-
>
|
|
33
|
-
<NavigationMenu title="Home">
|
|
34
|
-
<NavigationGroup title="Group 1">
|
|
35
|
-
<NavigationItem
|
|
36
|
-
item="item-1"
|
|
37
|
-
onClick={ () => setActiveItem( 'item-1' ) }
|
|
38
|
-
title="Item 1"
|
|
39
|
-
/>
|
|
40
|
-
<NavigationItem
|
|
41
|
-
item="item-2"
|
|
42
|
-
onClick={ () => setActiveItem( 'item-2' ) }
|
|
43
|
-
title="Item 2"
|
|
44
|
-
/>
|
|
45
|
-
</NavigationGroup>
|
|
46
|
-
<NavigationGroup title="Group 2">
|
|
47
|
-
<NavigationItem
|
|
48
|
-
item="item-3"
|
|
49
|
-
onClick={ () => setActiveItem( 'item-3' ) }
|
|
50
|
-
title="Item 3"
|
|
51
|
-
/>
|
|
52
|
-
<NavigationItem
|
|
53
|
-
item="item-4"
|
|
54
|
-
onClick={ () => setActiveItem( 'item-4' ) }
|
|
55
|
-
title="Item 4"
|
|
56
|
-
/>
|
|
57
|
-
</NavigationGroup>
|
|
58
|
-
</NavigationMenu>
|
|
59
|
-
</Navigation>
|
|
60
|
-
);
|
|
61
|
-
};
|