@wordpress/components 35.0.0 → 35.0.1
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 +20 -1
- package/build/alignment-matrix-control/cell.cjs +1 -1
- package/build/alignment-matrix-control/cell.cjs.map +2 -2
- package/build/alignment-matrix-control/index.cjs +1 -1
- package/build/alignment-matrix-control/index.cjs.map +2 -2
- package/build/color-palette/index.cjs +3 -0
- package/build/color-palette/index.cjs.map +2 -2
- package/build/custom-gradient-picker/gradient-bar/index.cjs.map +2 -2
- package/build/draggable/index.cjs +1 -1
- package/build/draggable/index.cjs.map +2 -2
- package/build/navigable-container/container.cjs +15 -21
- package/build/navigable-container/container.cjs.map +2 -2
- package/build/unit-control/utils.cjs +33 -35
- package/build/unit-control/utils.cjs.map +2 -2
- package/build-module/alignment-matrix-control/cell.mjs +1 -1
- package/build-module/alignment-matrix-control/cell.mjs.map +2 -2
- package/build-module/alignment-matrix-control/index.mjs +1 -1
- package/build-module/alignment-matrix-control/index.mjs.map +2 -2
- package/build-module/color-palette/index.mjs +3 -0
- package/build-module/color-palette/index.mjs.map +2 -2
- package/build-module/custom-gradient-picker/gradient-bar/index.mjs.map +2 -2
- package/build-module/draggable/index.mjs +1 -1
- package/build-module/draggable/index.mjs.map +2 -2
- package/build-module/navigable-container/container.mjs +16 -22
- package/build-module/navigable-container/container.mjs.map +2 -2
- package/build-module/unit-control/utils.mjs +33 -35
- package/build-module/unit-control/utils.mjs.map +2 -2
- package/build-style/style-rtl.css +41 -10
- package/build-style/style.css +41 -10
- package/build-types/card/context.d.ts +3 -0
- package/build-types/card/context.d.ts.map +1 -0
- package/build-types/color-palette/index.d.ts.map +1 -1
- package/build-types/custom-gradient-picker/gradient-bar/index.d.ts.map +1 -1
- package/build-types/date-time/date/index.d.ts +23 -0
- package/build-types/date-time/date/index.d.ts.map +1 -0
- package/build-types/date-time/date/styles.d.ts +45 -0
- package/build-types/date-time/date/styles.d.ts.map +1 -0
- package/build-types/date-time/date/test/index.d.ts +2 -0
- package/build-types/date-time/date/test/index.d.ts.map +1 -0
- package/build-types/date-time/date/test/use-lilius.d.ts +2 -0
- package/build-types/date-time/date/test/use-lilius.d.ts.map +1 -0
- package/build-types/date-time/date/use-lilius/index.d.ts +169 -0
- package/build-types/date-time/date/use-lilius/index.d.ts.map +1 -0
- package/build-types/date-time/time/index.d.ts +27 -0
- package/build-types/date-time/time/index.d.ts.map +1 -0
- package/build-types/date-time/time/styles.d.ts +93 -0
- package/build-types/date-time/time/styles.d.ts.map +1 -0
- package/build-types/date-time/time/test/index.d.ts +2 -0
- package/build-types/date-time/time/test/index.d.ts.map +1 -0
- package/build-types/date-time/time/time-input/index.d.ts +4 -0
- package/build-types/date-time/time/time-input/index.d.ts.map +1 -0
- package/build-types/date-time/time/time-input/test/index.d.ts +2 -0
- package/build-types/date-time/time/time-input/test/index.d.ts.map +1 -0
- package/build-types/date-time/time/timezone.d.ts +7 -0
- package/build-types/date-time/time/timezone.d.ts.map +1 -0
- package/build-types/navigable-container/container.d.ts.map +1 -1
- package/build-types/navigation/back-button/index.d.ts +7 -0
- package/build-types/navigation/back-button/index.d.ts.map +1 -0
- package/build-types/navigation/constants.d.ts +3 -0
- package/build-types/navigation/constants.d.ts.map +1 -0
- package/build-types/navigation/context.d.ts +4 -0
- package/build-types/navigation/context.d.ts.map +1 -0
- package/build-types/navigation/group/context.d.ts +7 -0
- package/build-types/navigation/group/context.d.ts.map +1 -0
- package/build-types/navigation/group/index.d.ts +7 -0
- package/build-types/navigation/group/index.d.ts.map +1 -0
- package/build-types/navigation/index.d.ts +46 -0
- package/build-types/navigation/index.d.ts.map +1 -0
- package/build-types/navigation/item/base-content.d.ts +3 -0
- package/build-types/navigation/item/base-content.d.ts.map +1 -0
- package/build-types/navigation/item/base.d.ts +3 -0
- package/build-types/navigation/item/base.d.ts.map +1 -0
- package/build-types/navigation/item/index.d.ts +7 -0
- package/build-types/navigation/item/index.d.ts.map +1 -0
- package/build-types/navigation/item/use-navigation-tree-item.d.ts +3 -0
- package/build-types/navigation/item/use-navigation-tree-item.d.ts.map +1 -0
- package/build-types/navigation/menu/context.d.ts +7 -0
- package/build-types/navigation/menu/context.d.ts.map +1 -0
- package/build-types/navigation/menu/index.d.ts +7 -0
- package/build-types/navigation/menu/index.d.ts.map +1 -0
- package/build-types/navigation/menu/menu-title-search.d.ts +3 -0
- package/build-types/navigation/menu/menu-title-search.d.ts.map +1 -0
- package/build-types/navigation/menu/menu-title.d.ts +3 -0
- package/build-types/navigation/menu/menu-title.d.ts.map +1 -0
- package/build-types/navigation/menu/search-no-results-found.d.ts +3 -0
- package/build-types/navigation/menu/search-no-results-found.d.ts.map +1 -0
- package/build-types/navigation/menu/use-navigation-tree-menu.d.ts +3 -0
- package/build-types/navigation/menu/use-navigation-tree-menu.d.ts.map +1 -0
- package/build-types/navigation/stories/index.story.d.ts +23 -0
- package/build-types/navigation/stories/index.story.d.ts.map +1 -0
- package/build-types/navigation/stories/utils/controlled-state.d.ts +7 -0
- package/build-types/navigation/stories/utils/controlled-state.d.ts.map +1 -0
- package/build-types/navigation/stories/utils/default.d.ts +10 -0
- package/build-types/navigation/stories/utils/default.d.ts.map +1 -0
- package/build-types/navigation/stories/utils/group.d.ts +10 -0
- package/build-types/navigation/stories/utils/group.d.ts.map +1 -0
- package/build-types/navigation/stories/utils/hide-if-empty.d.ts +10 -0
- package/build-types/navigation/stories/utils/hide-if-empty.d.ts.map +1 -0
- package/build-types/navigation/stories/utils/more-examples.d.ts +10 -0
- package/build-types/navigation/stories/utils/more-examples.d.ts.map +1 -0
- package/build-types/navigation/stories/utils/search.d.ts +10 -0
- package/build-types/navigation/stories/utils/search.d.ts.map +1 -0
- package/build-types/navigation/styles/navigation-styles.d.ts +55 -0
- package/build-types/navigation/styles/navigation-styles.d.ts.map +1 -0
- package/build-types/navigation/test/index.d.ts +2 -0
- package/build-types/navigation/test/index.d.ts.map +1 -0
- package/build-types/navigation/types.d.ts +266 -0
- package/build-types/navigation/types.d.ts.map +1 -0
- package/build-types/navigation/use-create-navigation-tree.d.ts +15 -0
- package/build-types/navigation/use-create-navigation-tree.d.ts.map +1 -0
- package/build-types/navigation/use-navigation-tree-nodes.d.ts +10 -0
- package/build-types/navigation/use-navigation-tree-nodes.d.ts.map +1 -0
- package/build-types/navigation/utils.d.ts +3 -0
- package/build-types/navigation/utils.d.ts.map +1 -0
- package/build-types/unit-control/utils.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/combobox-control.d.ts +2 -2
- package/build-types/visually-hidden/test/index.d.ts +2 -0
- package/build-types/visually-hidden/test/index.d.ts.map +1 -0
- package/package.json +34 -32
- package/src/card/card/README.md +4 -4
- package/src/checkbox-control/README.md +1 -1
- package/src/clipboard-button/README.md +4 -4
- package/src/color-palette/index.tsx +5 -0
- package/src/color-palette/test/index.tsx +30 -0
- package/src/combobox-control/README.md +1 -1
- package/src/confirm-dialog/README.md +1 -1
- package/src/custom-gradient-picker/gradient-bar/index.tsx +1 -1
- package/src/flex/flex/README.md +1 -1
- package/src/navigable-container/container.tsx +22 -30
- package/src/popover/README.md +1 -1
- package/src/scrollable/README.md +1 -1
- package/src/tooltip/style.scss +1 -1
- package/src/unit-control/utils.ts +33 -52
- package/build/mobile/image/constants.cjs +0 -34
- package/build/mobile/image/constants.cjs.map +0 -7
- package/build-module/mobile/image/constants.mjs +0 -9
- package/build-module/mobile/image/constants.mjs.map +0 -7
- package/src/autocomplete/autocompleter-ui.native.js +0 -211
- package/src/autocomplete/background-view.android.js +0 -25
- package/src/autocomplete/background-view.ios.js +0 -23
- package/src/autocomplete/style.android.scss +0 -7
- package/src/autocomplete/style.native.scss +0 -74
- package/src/base-control/index.native.js +0 -14
- package/src/button/index.native.js +0 -236
- package/src/button/style.native.scss +0 -9
- package/src/color-control/index.native.js +0 -24
- package/src/color-indicator/index.native.js +0 -80
- package/src/color-indicator/style.native.scss +0 -51
- package/src/color-palette/index.native.js +0 -360
- package/src/color-palette/style.native.scss +0 -49
- package/src/color-picker/hsv-color-picker.native.js +0 -88
- package/src/color-picker/hue-picker.native.js +0 -198
- package/src/color-picker/index.native.js +0 -215
- package/src/color-picker/saturation-picker.native.js +0 -167
- package/src/color-picker/style.native.scss +0 -87
- package/src/custom-gradient-picker/index.native.js +0 -110
- package/src/custom-gradient-picker/style.native.scss +0 -3
- package/src/dashicon/index.native.js +0 -18
- package/src/disabled/index.native.js +0 -10
- package/src/draggable/index.native.js +0 -234
- package/src/draggable/style.native.scss +0 -3
- package/src/draggable/test/index.native.js +0 -138
- package/src/dropdown/index.native.js +0 -59
- package/src/dropdown-menu/index.native.js +0 -152
- package/src/external-link/index.native.js +0 -25
- package/src/focal-point-picker/focal-point.native.js +0 -30
- package/src/focal-point-picker/index.native.js +0 -281
- package/src/focal-point-picker/tooltip/index.native.js +0 -144
- package/src/focal-point-picker/tooltip/style.native.scss +0 -42
- package/src/font-size-picker/index.native.js +0 -190
- package/src/font-size-picker/style.native.scss +0 -6
- package/src/footer-message-control/index.native.js +0 -14
- package/src/higher-order/with-focus-outside/index.native.js +0 -38
- package/src/index.native.js +0 -134
- package/src/keyboard-shortcuts/index.native.js +0 -2
- package/src/mobile/README.md +0 -3
- package/src/mobile/autocompletion-items.native.js +0 -11
- package/src/mobile/badge/README.md +0 -31
- package/src/mobile/badge/index.native.js +0 -27
- package/src/mobile/badge/style.scss +0 -18
- package/src/mobile/bottom-sheet/borderStyles.android.scss +0 -8
- package/src/mobile/bottom-sheet/borderStyles.ios.scss +0 -9
- package/src/mobile/bottom-sheet/bottom-sheet-context.native.js +0 -40
- package/src/mobile/bottom-sheet/bottom-sheet-navigation/README.md +0 -101
- package/src/mobile/bottom-sheet/bottom-sheet-navigation/bottom-sheet-navigation-context.native.js +0 -16
- package/src/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +0 -193
- package/src/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +0 -146
- package/src/mobile/bottom-sheet/bottom-sheet-navigation/styles.native.scss +0 -11
- package/src/mobile/bottom-sheet/bottom-sheet-navigation/test/navigation-container.native.js +0 -197
- package/src/mobile/bottom-sheet/button.native.js +0 -19
- package/src/mobile/bottom-sheet/cell.native.js +0 -464
- package/src/mobile/bottom-sheet/cellStyles.android.scss +0 -15
- package/src/mobile/bottom-sheet/cellStyles.ios.scss +0 -19
- package/src/mobile/bottom-sheet/chevron-back.native.js +0 -18
- package/src/mobile/bottom-sheet/color-cell.native.js +0 -35
- package/src/mobile/bottom-sheet/cycle-picker-cell.native.js +0 -31
- package/src/mobile/bottom-sheet/footer-message-cell.native.js +0 -23
- package/src/mobile/bottom-sheet/footer-message-link/README.md +0 -37
- package/src/mobile/bottom-sheet/footer-message-link/footer-message-link.native.js +0 -26
- package/src/mobile/bottom-sheet/footer-message-link/styles.native.scss +0 -7
- package/src/mobile/bottom-sheet/index.native.js +0 -646
- package/src/mobile/bottom-sheet/keyboard-avoiding-view.native.js +0 -125
- package/src/mobile/bottom-sheet/link-cell.native.js +0 -35
- package/src/mobile/bottom-sheet/link-suggestion-item-cell.native.js +0 -92
- package/src/mobile/bottom-sheet/link-suggestion-styles.native.scss +0 -27
- package/src/mobile/bottom-sheet/lock-icon/index.native.js +0 -19
- package/src/mobile/bottom-sheet/lock-icon/styles.native.scss +0 -8
- package/src/mobile/bottom-sheet/nav-bar/README.md +0 -63
- package/src/mobile/bottom-sheet/nav-bar/action-button.native.js +0 -30
- package/src/mobile/bottom-sheet/nav-bar/apply-button.native.js +0 -53
- package/src/mobile/bottom-sheet/nav-bar/back-button.native.js +0 -94
- package/src/mobile/bottom-sheet/nav-bar/heading.native.js +0 -33
- package/src/mobile/bottom-sheet/nav-bar/index.native.js +0 -23
- package/src/mobile/bottom-sheet/nav-bar/styles.native.scss +0 -69
- package/src/mobile/bottom-sheet/picker-cell.native.js +0 -40
- package/src/mobile/bottom-sheet/radio-cell.native.js +0 -39
- package/src/mobile/bottom-sheet/range-cell.native.js +0 -274
- package/src/mobile/bottom-sheet/range-cell.native.scss +0 -40
- package/src/mobile/bottom-sheet/range-text-input.native.js +0 -248
- package/src/mobile/bottom-sheet/ripple.native.js +0 -83
- package/src/mobile/bottom-sheet/ripple.native.scss +0 -11
- package/src/mobile/bottom-sheet/stepper-cell/index.native.js +0 -264
- package/src/mobile/bottom-sheet/stepper-cell/stepper.android.js +0 -78
- package/src/mobile/bottom-sheet/stepper-cell/stepper.ios.js +0 -64
- package/src/mobile/bottom-sheet/stepper-cell/style.native.scss +0 -89
- package/src/mobile/bottom-sheet/styles.native.scss +0 -333
- package/src/mobile/bottom-sheet/sub-sheet/README.md +0 -90
- package/src/mobile/bottom-sheet/sub-sheet/index.native.js +0 -49
- package/src/mobile/bottom-sheet/switch-cell.native.js +0 -75
- package/src/mobile/bottom-sheet/test/index.native.js +0 -24
- package/src/mobile/bottom-sheet/test/range-cell.native.js +0 -73
- package/src/mobile/bottom-sheet-select-control/README.md +0 -97
- package/src/mobile/bottom-sheet-select-control/index.native.js +0 -124
- package/src/mobile/bottom-sheet-select-control/style.native.scss +0 -3
- package/src/mobile/bottom-sheet-text-control/README.md +0 -98
- package/src/mobile/bottom-sheet-text-control/index.native.js +0 -104
- package/src/mobile/bottom-sheet-text-control/styles.scss +0 -25
- package/src/mobile/clipboard/index.native.js +0 -18
- package/src/mobile/color-settings/gradient-picker-screen.native.js +0 -37
- package/src/mobile/color-settings/index.native.js +0 -88
- package/src/mobile/color-settings/palette.screen.native.js +0 -232
- package/src/mobile/color-settings/picker-screen.native.js +0 -60
- package/src/mobile/color-settings/style.native.scss +0 -62
- package/src/mobile/color-settings/utils.native.js +0 -36
- package/src/mobile/cycle-select-control/README.md +0 -3
- package/src/mobile/cycle-select-control/index.native.js +0 -39
- package/src/mobile/dashicons/index.native.js +0 -22
- package/src/mobile/focal-point-settings-panel/index.native.js +0 -84
- package/src/mobile/focal-point-settings-panel/styles.native.scss +0 -3
- package/src/mobile/gradient/index.native.js +0 -188
- package/src/mobile/gradient/style.native.scss +0 -8
- package/src/mobile/gradient/test/index.native.js +0 -114
- package/src/mobile/gridicons/index.native.js +0 -39
- package/src/mobile/html-text-input/index.native.js +0 -169
- package/src/mobile/html-text-input/style.android.scss +0 -8
- package/src/mobile/html-text-input/style.ios.scss +0 -10
- package/src/mobile/html-text-input/style.scss +0 -45
- package/src/mobile/html-text-input/test/__snapshots__/index.native.js.snap +0 -48
- package/src/mobile/html-text-input/test/index.native.js +0 -118
- package/src/mobile/image/constants.js +0 -1
- package/src/mobile/image/icon-customize.native.js +0 -10
- package/src/mobile/image/icon-retry.native.js +0 -11
- package/src/mobile/image/image-editing-button.native.js +0 -63
- package/src/mobile/image/index.native.js +0 -401
- package/src/mobile/image/style.native.scss +0 -179
- package/src/mobile/image/utils/index.native.js +0 -58
- package/src/mobile/keyboard-avoiding-view/index.android.js +0 -8
- package/src/mobile/keyboard-avoiding-view/index.ios.js +0 -143
- package/src/mobile/keyboard-avoiding-view/styles.native.scss +0 -9
- package/src/mobile/keyboard-aware-flat-list/index.android.js +0 -81
- package/src/mobile/keyboard-aware-flat-list/index.ios.js +0 -147
- package/src/mobile/keyboard-aware-flat-list/shared.native.js +0 -26
- package/src/mobile/keyboard-aware-flat-list/styles.native.scss +0 -8
- package/src/mobile/keyboard-aware-flat-list/test/use-keyboard-offset.native.js +0 -203
- package/src/mobile/keyboard-aware-flat-list/test/use-scroll-to-section.native.js +0 -142
- package/src/mobile/keyboard-aware-flat-list/test/use-scroll.native.js +0 -71
- package/src/mobile/keyboard-aware-flat-list/test/use-text-input-caret-position.native.js +0 -82
- package/src/mobile/keyboard-aware-flat-list/test/use-text-input-offset.native.js +0 -147
- package/src/mobile/keyboard-aware-flat-list/use-keyboard-offset.native.js +0 -87
- package/src/mobile/keyboard-aware-flat-list/use-scroll-to-element.native.js +0 -41
- package/src/mobile/keyboard-aware-flat-list/use-scroll-to-section.native.js +0 -100
- package/src/mobile/keyboard-aware-flat-list/use-scroll.native.js +0 -100
- package/src/mobile/keyboard-aware-flat-list/use-text-input-caret-position.native.js +0 -36
- package/src/mobile/keyboard-aware-flat-list/use-text-input-offset.native.js +0 -54
- package/src/mobile/layout-animation/index.native.js +0 -16
- package/src/mobile/link-picker/index.native.js +0 -160
- package/src/mobile/link-picker/link-picker-results.native.js +0 -129
- package/src/mobile/link-picker/link-picker-screen.native.js +0 -60
- package/src/mobile/link-picker/styles.native.scss +0 -45
- package/src/mobile/link-picker/test/performance/index.native.js +0 -35
- package/src/mobile/link-settings/index.native.js +0 -332
- package/src/mobile/link-settings/link-rel.native.js +0 -10
- package/src/mobile/link-settings/link-settings-navigation.native.js +0 -50
- package/src/mobile/link-settings/link-settings-screen.native.js +0 -44
- package/src/mobile/link-settings/style.native.scss +0 -4
- package/src/mobile/link-settings/test/edit.native.js +0 -325
- package/src/mobile/link-settings/test/link-settings-navigation.native.js +0 -94
- package/src/mobile/media-edit/index.native.js +0 -125
- package/src/mobile/picker/index.android.js +0 -104
- package/src/mobile/picker/index.ios.js +0 -96
- package/src/mobile/picker/styles.native.scss +0 -29
- package/src/mobile/segmented-control/index.native.js +0 -186
- package/src/mobile/segmented-control/style.native.scss +0 -99
- package/src/mobile/utils/alignments.native.js +0 -78
- package/src/mobile/utils/get-px-from-css-unit.native.js +0 -329
- package/src/mobile/utils/index.native.js +0 -12
- package/src/mobile/utils/test/get-px-from-css-unit.native.js +0 -172
- package/src/mobile/utils/test/index.native.js +0 -134
- package/src/mobile/utils/use-is-floating-keyboard.native.js +0 -31
- package/src/mobile/utils/use-unit-converter-to-mobile.native.js +0 -90
- package/src/notice/index.native.js +0 -123
- package/src/notice/list.native.js +0 -55
- package/src/notice/style.native.scss +0 -60
- package/src/panel/actions.native.js +0 -46
- package/src/panel/actions.native.scss +0 -12
- package/src/panel/body.native.js +0 -29
- package/src/panel/body.native.scss +0 -11
- package/src/panel/bottom-separator-cover.native.js +0 -27
- package/src/panel/bottom-separator-cover.native.scss +0 -9
- package/src/private-apis.native.js +0 -13
- package/src/query-controls/index.native.js +0 -103
- package/src/radio-control/index.native.js +0 -24
- package/src/range-control/index.native.js +0 -73
- package/src/resizable-box/index.native.js +0 -32
- package/src/resizable-box/style.native.scss +0 -14
- package/src/sandbox/index.native.js +0 -392
- package/src/sandbox/style.native.scss +0 -7
- package/src/search-control/index.native.js +0 -274
- package/src/search-control/platform-style.android.scss +0 -57
- package/src/search-control/platform-style.ios.scss +0 -43
- package/src/search-control/style.native.scss +0 -63
- package/src/select-control/index.native.js +0 -41
- package/src/slot-fill/index.native.js +0 -25
- package/src/spinner/index.native.js +0 -22
- package/src/spinner/style.native.scss +0 -4
- package/src/style-provider/index.native.js +0 -3
- package/src/text/index.native.js +0 -13
- package/src/text/styles/emotion-css.native.js +0 -6
- package/src/text/styles/font-family.native.js +0 -1
- package/src/text/styles/text-mixins.native.js +0 -163
- package/src/text-control/index.native.js +0 -41
- package/src/textarea-control/index.native.js +0 -26
- package/src/toggle-control/index.native.js +0 -31
- package/src/toolbar/toolbar/style.native.scss +0 -11
- package/src/toolbar/toolbar/toolbar-container.native.js +0 -8
- package/src/toolbar/toolbar-button/toolbar-button-container.native.js +0 -8
- package/src/toolbar/toolbar-group/style.native.scss +0 -10
- package/src/toolbar/toolbar-group/toolbar-group-collapsed.native.js +0 -36
- package/src/toolbar/toolbar-group/toolbar-group-container.native.js +0 -26
- package/src/toolbar/toolbar-item/index.native.js +0 -17
- package/src/tooltip/index.native.js +0 -292
- package/src/tooltip/style.native.scss +0 -39
- package/src/tooltip/test/index.native.js +0 -98
- package/src/unit-control/index.native.js +0 -202
- package/src/unit-control/style.native.scss +0 -19
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export declare const NavigationUI: import("@emotion/styled").StyledComponent<{
|
|
2
|
+
theme?: import("@emotion/react").Theme;
|
|
3
|
+
as?: React.ElementType;
|
|
4
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
5
|
+
export declare const MenuUI: import("@emotion/styled").StyledComponent<{
|
|
6
|
+
theme?: import("@emotion/react").Theme;
|
|
7
|
+
as?: React.ElementType;
|
|
8
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
9
|
+
export declare const MenuBackButtonUI: import("@emotion/styled").StyledComponent<((import("../../button/types").ButtonProps & import("../../button/types").DeprecatedButtonProps) & import("react").RefAttributes<any>) & {
|
|
10
|
+
theme?: import("@emotion/react").Theme;
|
|
11
|
+
}, {}, {}>;
|
|
12
|
+
export declare const MenuTitleUI: import("@emotion/styled").StyledComponent<{
|
|
13
|
+
theme?: import("@emotion/react").Theme;
|
|
14
|
+
as?: React.ElementType;
|
|
15
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
16
|
+
export declare const MenuTitleSearchControlWrapper: import("@emotion/styled").StyledComponent<{
|
|
17
|
+
theme?: import("@emotion/react").Theme;
|
|
18
|
+
as?: React.ElementType;
|
|
19
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
20
|
+
export declare const MenuTitleActionsUI: import("@emotion/styled").StyledComponent<{
|
|
21
|
+
theme?: import("@emotion/react").Theme;
|
|
22
|
+
as?: React.ElementType;
|
|
23
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
24
|
+
export declare const GroupTitleUI: import("@emotion/styled").StyledComponent<Omit<import("../../text/types").Props, "color" | "isBlock" | "weight"> & {
|
|
25
|
+
level?: import("../../heading/types").HeadingSize;
|
|
26
|
+
isBlock?: import("../../text/types").Props['isBlock'];
|
|
27
|
+
color?: import("../../text/types").Props['color'];
|
|
28
|
+
weight?: import("../../text/types").Props['weight'];
|
|
29
|
+
} & import("react").RefAttributes<any> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, "ref">, "adjustLineHeightForInnerControls" | "align" | "as" | "children" | "color" | "display" | "ellipsis" | "ellipsizeMode" | "highlightCaseSensitive" | "highlightEscape" | "highlightSanitize" | "highlightWords" | "isBlock" | "isDestructive" | "letterSpacing" | "level" | "limit" | "lineHeight" | "numberOfLines" | "optimizeReadabilityFor" | "size" | "truncate" | "upperCase" | "variant" | "weight" | keyof import("react").RefAttributes<any>> & {
|
|
30
|
+
as?: keyof import("react").JSX.IntrinsicElements | undefined;
|
|
31
|
+
} & {
|
|
32
|
+
theme?: import("@emotion/react").Theme;
|
|
33
|
+
}, {}, {}>;
|
|
34
|
+
export declare const ItemBaseUI: import("@emotion/styled").StyledComponent<{
|
|
35
|
+
theme?: import("@emotion/react").Theme;
|
|
36
|
+
as?: React.ElementType;
|
|
37
|
+
}, import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, {}>;
|
|
38
|
+
export declare const ItemUI: import("@emotion/styled").StyledComponent<{
|
|
39
|
+
theme?: import("@emotion/react").Theme;
|
|
40
|
+
as?: React.ElementType;
|
|
41
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
42
|
+
export declare const ItemIconUI: import("@emotion/styled").StyledComponent<{
|
|
43
|
+
theme?: import("@emotion/react").Theme;
|
|
44
|
+
as?: React.ElementType;
|
|
45
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
46
|
+
export declare const ItemBadgeUI: import("@emotion/styled").StyledComponent<{
|
|
47
|
+
theme?: import("@emotion/react").Theme;
|
|
48
|
+
as?: React.ElementType;
|
|
49
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
50
|
+
export declare const ItemTitleUI: import("@emotion/styled").StyledComponent<import("../../text/types").Props & import("react").RefAttributes<any> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref">, "as" | keyof import("../../text/types").Props | keyof import("react").RefAttributes<any>> & {
|
|
51
|
+
as?: keyof import("react").JSX.IntrinsicElements | undefined;
|
|
52
|
+
} & {
|
|
53
|
+
theme?: import("@emotion/react").Theme;
|
|
54
|
+
}, {}, {}>;
|
|
55
|
+
//# sourceMappingURL=navigation-styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigation-styles.d.ts","sourceRoot":"","sources":["../../../src/navigation/styles/navigation-styles.tsx"],"names":[],"mappings":"AAoBA,eAAO,MAAM,YAAY;;;yGAKxB,CAAC;AAEF,eAAO,MAAM,MAAM;;;yGAiBlB,CAAC;AAEF,eAAO,MAAM,gBAAgB;;UAiB5B,CAAC;AAEF,eAAO,MAAM,WAAW;;;yGAGvB,CAAC;AAEF,eAAO,MAAM,6BAA6B;;;yGAGzC,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;2GAoB9B,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;UAaxB,CAAC;AAEF,eAAO,MAAM,UAAU;;;yGAqCtB,CAAC;AAEF,eAAO,MAAM,MAAM;;;yGAYlB,CAAC;AAEF,eAAO,MAAM,UAAU;;;2GAGtB,CAAC;AAEF,eAAO,MAAM,WAAW;;;2GAmBvB,CAAC;AAEF,eAAO,MAAM,WAAW;;;;UAKvB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/navigation/test/index.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { ButtonProps } from '../button/types';
|
|
5
|
+
type IfDiscriminantDefinedBothRequired<TDiscriminant, TOther> = {
|
|
6
|
+
[K in keyof (TDiscriminant & TOther)]: NonNullable<(TDiscriminant & TOther)[K]>;
|
|
7
|
+
} | ({
|
|
8
|
+
[K in keyof TDiscriminant]?: never;
|
|
9
|
+
} & {
|
|
10
|
+
[K in keyof TOther]?: TOther[K];
|
|
11
|
+
});
|
|
12
|
+
export type NavigationProps = {
|
|
13
|
+
/**
|
|
14
|
+
* The active item slug.
|
|
15
|
+
*/
|
|
16
|
+
activeItem?: string;
|
|
17
|
+
/**
|
|
18
|
+
* The active menu slug.
|
|
19
|
+
*
|
|
20
|
+
* @default 'root'
|
|
21
|
+
*/
|
|
22
|
+
activeMenu?: string;
|
|
23
|
+
/**
|
|
24
|
+
* The children components.
|
|
25
|
+
*/
|
|
26
|
+
children?: React.ReactNode;
|
|
27
|
+
/**
|
|
28
|
+
* Optional classname for the component.
|
|
29
|
+
*/
|
|
30
|
+
className?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Callback used to sync the active menu between the external state
|
|
33
|
+
* and the Navigation's internal state.
|
|
34
|
+
*/
|
|
35
|
+
onActivateMenu?: (activeMenuSlug: string) => void;
|
|
36
|
+
};
|
|
37
|
+
type _NavigationMenuSearchProps = IfDiscriminantDefinedBothRequired<{
|
|
38
|
+
/**
|
|
39
|
+
* When the `hasSearch` prop is `true`, this callback handles the search
|
|
40
|
+
* input's `onChange` event, making it controlled from the outside.
|
|
41
|
+
* When using this prop, the `search` prop should be also set.
|
|
42
|
+
*/
|
|
43
|
+
onSearch: (searchString: string) => void;
|
|
44
|
+
}, {
|
|
45
|
+
/**
|
|
46
|
+
* When the `hasSearch` is `true` and the `onSearch` prop is provided, this
|
|
47
|
+
* prop controls the value of the search input.
|
|
48
|
+
* Required when the `onSearch` prop is provided.
|
|
49
|
+
*/
|
|
50
|
+
search: string;
|
|
51
|
+
}>;
|
|
52
|
+
export type NavigationMenuProps = _NavigationMenuSearchProps & {
|
|
53
|
+
/**
|
|
54
|
+
* The back button label used in nested menus.
|
|
55
|
+
* If not provided, the label will be inferred from the parent menu's title.
|
|
56
|
+
* If the parent menu's title is not available then it will default to "Back".
|
|
57
|
+
*
|
|
58
|
+
* @default parentMenuTitle ?? 'Back'
|
|
59
|
+
*/
|
|
60
|
+
backButtonLabel?: string;
|
|
61
|
+
/**
|
|
62
|
+
* A callback to handle clicking on the back button.
|
|
63
|
+
* If this prop is provided then the back button will be shown.
|
|
64
|
+
*/
|
|
65
|
+
onBackButtonClick?: React.MouseEventHandler<HTMLElement>;
|
|
66
|
+
/**
|
|
67
|
+
* The children components.
|
|
68
|
+
*/
|
|
69
|
+
children?: React.ReactNode;
|
|
70
|
+
/**
|
|
71
|
+
* Optional classname for the component.
|
|
72
|
+
*/
|
|
73
|
+
className?: string;
|
|
74
|
+
/**
|
|
75
|
+
* When `true`, enables the search feature on the menu title.
|
|
76
|
+
*/
|
|
77
|
+
hasSearch?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Indicates whether the menu is empty or not. Used together with the
|
|
80
|
+
* `hideIfTargetMenuEmpty` prop of `NavigationItem`.
|
|
81
|
+
*/
|
|
82
|
+
isEmpty?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Indicates whether the search is debouncing or not. In case of `true`, the
|
|
85
|
+
* "No results found." text is omitted. Used to prevent showing the
|
|
86
|
+
* "No results found." text between debounced searches.
|
|
87
|
+
*/
|
|
88
|
+
isSearchDebouncing?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* The unique identifier of the menu.
|
|
91
|
+
* The root menu can omit this prop, and it will default to "root".
|
|
92
|
+
* All other menus need to specify it.
|
|
93
|
+
*
|
|
94
|
+
* @default 'root'
|
|
95
|
+
*/
|
|
96
|
+
menu?: string;
|
|
97
|
+
/**
|
|
98
|
+
* The parent menu slug; used by nested menus to indicate their parent menu.
|
|
99
|
+
*/
|
|
100
|
+
parentMenu?: string;
|
|
101
|
+
/**
|
|
102
|
+
* The menu title. It's also the field used by the menu search function.
|
|
103
|
+
*/
|
|
104
|
+
title?: string;
|
|
105
|
+
/**
|
|
106
|
+
* Use this prop to render additional actions in the menu title.
|
|
107
|
+
*/
|
|
108
|
+
titleAction?: React.ReactNode;
|
|
109
|
+
};
|
|
110
|
+
export type NavigationGroupProps = {
|
|
111
|
+
/**
|
|
112
|
+
* Optional classname for the component.
|
|
113
|
+
*/
|
|
114
|
+
className?: string;
|
|
115
|
+
/**
|
|
116
|
+
* The group title.
|
|
117
|
+
*/
|
|
118
|
+
title?: string;
|
|
119
|
+
/**
|
|
120
|
+
* The children components.
|
|
121
|
+
*/
|
|
122
|
+
children: React.ReactNode;
|
|
123
|
+
};
|
|
124
|
+
type _NavigationItemButtonProps = (ButtonProps & {
|
|
125
|
+
/**
|
|
126
|
+
* If set to `true` the menu item will only act as a text-only item,
|
|
127
|
+
* rather than a `<button />` or `<a />` element.
|
|
128
|
+
*/
|
|
129
|
+
isText?: false;
|
|
130
|
+
}) | {
|
|
131
|
+
/**
|
|
132
|
+
* If set to `true` the menu item will only act as a text-only item,
|
|
133
|
+
* rather than a `<button />` or `<a />` element.
|
|
134
|
+
*/
|
|
135
|
+
isText: true;
|
|
136
|
+
};
|
|
137
|
+
export type NavigationItemBaseProps = {
|
|
138
|
+
/**
|
|
139
|
+
* The item badge content.
|
|
140
|
+
*/
|
|
141
|
+
badge?: string | number;
|
|
142
|
+
/**
|
|
143
|
+
* The children components. When not specified, the item will render the
|
|
144
|
+
* default item UI.
|
|
145
|
+
*/
|
|
146
|
+
children?: React.ReactNode;
|
|
147
|
+
/**
|
|
148
|
+
* Optional classname for the component.
|
|
149
|
+
*/
|
|
150
|
+
className?: string;
|
|
151
|
+
/**
|
|
152
|
+
* If provided, causes the component to render an `<a />` element
|
|
153
|
+
* instead of a `<button />` element.
|
|
154
|
+
*/
|
|
155
|
+
href?: string;
|
|
156
|
+
/**
|
|
157
|
+
* If no `children` are passed, this prop allows to specify a custom icon for
|
|
158
|
+
* the menu item.
|
|
159
|
+
*/
|
|
160
|
+
icon?: React.JSX.Element;
|
|
161
|
+
/**
|
|
162
|
+
* The unique identifier of the item.
|
|
163
|
+
*/
|
|
164
|
+
item?: string;
|
|
165
|
+
/**
|
|
166
|
+
* The child menu slug. If provided, clicking on the item will navigate
|
|
167
|
+
* to the target menu.
|
|
168
|
+
*/
|
|
169
|
+
navigateToMenu?: string;
|
|
170
|
+
/**
|
|
171
|
+
* Indicates whether this item should be hidden if the menu specified in
|
|
172
|
+
* `navigateToMenu` is marked as empty in the `isEmpty` prop.
|
|
173
|
+
* Used together with the `isEmpty` prop of `NavigationMenu`.
|
|
174
|
+
*/
|
|
175
|
+
hideIfTargetMenuEmpty?: boolean;
|
|
176
|
+
/**
|
|
177
|
+
* A callback to handle clicking on a menu item.
|
|
178
|
+
*
|
|
179
|
+
* @default noop
|
|
180
|
+
*/
|
|
181
|
+
onClick?: React.MouseEventHandler;
|
|
182
|
+
/**
|
|
183
|
+
* The item title.
|
|
184
|
+
*/
|
|
185
|
+
title?: string;
|
|
186
|
+
};
|
|
187
|
+
export type NavigationItemProps = _NavigationItemButtonProps & NavigationItemBaseProps;
|
|
188
|
+
export type NavigationItemBaseContentProps = Pick<NavigationItemProps, 'badge' | 'title'>;
|
|
189
|
+
export type NavigationBackButtonProps = {
|
|
190
|
+
/**
|
|
191
|
+
* The text displayed for the button
|
|
192
|
+
*/
|
|
193
|
+
backButtonLabel?: string;
|
|
194
|
+
/**
|
|
195
|
+
* Optional classname for the component.
|
|
196
|
+
*/
|
|
197
|
+
className?: string;
|
|
198
|
+
/**
|
|
199
|
+
* If provided, causes the component to render an `<a />` element
|
|
200
|
+
* instead of a `<button />` element.
|
|
201
|
+
*/
|
|
202
|
+
href?: string;
|
|
203
|
+
/**
|
|
204
|
+
* Callback function called when the button is clicked.
|
|
205
|
+
*/
|
|
206
|
+
onClick?: React.MouseEventHandler;
|
|
207
|
+
/**
|
|
208
|
+
* Id of the parent menu
|
|
209
|
+
*/
|
|
210
|
+
parentMenu?: string;
|
|
211
|
+
};
|
|
212
|
+
export type NavigationMenuTitleSearchProps = Pick<NavigationMenuProps, 'onSearch' | 'search' | 'title'> & {
|
|
213
|
+
debouncedSpeak: (message: string, ariaLive?: 'off' | 'polite' | 'assertive') => void;
|
|
214
|
+
onCloseSearch: () => void;
|
|
215
|
+
};
|
|
216
|
+
export type NavigationMenuTitleProps = Pick<NavigationMenuProps, 'hasSearch' | 'onSearch' | 'search' | 'title' | 'titleAction'>;
|
|
217
|
+
export type NavigationSearchNoResultsFoundProps = Pick<NavigationMenuProps, 'search'>;
|
|
218
|
+
export type Item = Omit<NavigationItemBaseProps, 'children'> & {
|
|
219
|
+
/**
|
|
220
|
+
* The group id
|
|
221
|
+
*/
|
|
222
|
+
group?: string;
|
|
223
|
+
/**
|
|
224
|
+
* The menu id
|
|
225
|
+
*/
|
|
226
|
+
menu?: string;
|
|
227
|
+
/**
|
|
228
|
+
* True is the item is currently visible (ie. the item is part
|
|
229
|
+
* of the active menu, and — if there is a search query — its title
|
|
230
|
+
* matches the search query).
|
|
231
|
+
*/
|
|
232
|
+
_isVisible: boolean;
|
|
233
|
+
};
|
|
234
|
+
export type Menu = Omit<NavigationMenuProps, 'children'> & {
|
|
235
|
+
menu: string;
|
|
236
|
+
};
|
|
237
|
+
export type NavigationGroupContext = {
|
|
238
|
+
/**
|
|
239
|
+
* The unique id of the group
|
|
240
|
+
*/
|
|
241
|
+
group?: string;
|
|
242
|
+
};
|
|
243
|
+
export type NavigationMenuContext = {
|
|
244
|
+
menu?: string;
|
|
245
|
+
search?: string;
|
|
246
|
+
};
|
|
247
|
+
export type NavigationContext = {
|
|
248
|
+
activeItem?: string;
|
|
249
|
+
activeMenu: string;
|
|
250
|
+
setActiveMenu: (parentMenu: string, animationDirection?: 'left' | 'right') => void;
|
|
251
|
+
navigationTree: {
|
|
252
|
+
items: Record<string, Item>;
|
|
253
|
+
getItem: (itemId: string) => Item | undefined;
|
|
254
|
+
addItem: (itemId: string, itemProps: Item) => void;
|
|
255
|
+
removeItem: (itemId: string) => void;
|
|
256
|
+
menus: Record<string, Menu>;
|
|
257
|
+
getMenu: (menuId: string) => Menu | undefined;
|
|
258
|
+
addMenu: (menuId: string, menuProps: Menu) => void;
|
|
259
|
+
removeMenu: (menuId: string) => void;
|
|
260
|
+
childMenu: Record<string, string[]>;
|
|
261
|
+
traverseMenu: (startMenu: string, callback: (menuObject: Menu) => boolean | undefined) => void;
|
|
262
|
+
isMenuEmpty: (menuId: string) => boolean;
|
|
263
|
+
};
|
|
264
|
+
};
|
|
265
|
+
export {};
|
|
266
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/navigation/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,KAAK,iCAAiC,CAAE,aAAa,EAAE,MAAM,IAG1D;KACE,CAAC,IAAI,MAAM,CAAE,aAAa,GAAG,MAAM,CAAE,GAAI,WAAW,CACrD,CAAE,aAAa,GAAG,MAAM,CAAE,CAAE,CAAC,CAAE,CAC/B;CACA,GAGD,CAAE;KACA,CAAC,IAAI,MAAM,aAAa,CAAE,CAAC,EAAE,KAAK;CACnC,GAAG;KACF,CAAC,IAAI,MAAM,MAAM,CAAE,CAAC,EAAE,MAAM,CAAE,CAAC,CAAE;CAClC,CAAE,CAAC;AAIP,MAAM,MAAM,eAAe,GAAG;IAC7B;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,cAAc,CAAC,EAAE,CAAE,cAAc,EAAE,MAAM,KAAM,IAAI,CAAC;CACpD,CAAC;AAGF,KAAK,0BAA0B,GAAG,iCAAiC,CAClE;IACC;;;;OAIG;IACH,QAAQ,EAAE,CAAE,YAAY,EAAE,MAAM,KAAM,IAAI,CAA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M,CAAE,MAAM,EAAE,IAAI,CAAE,CAAC;QAC9B,OAAO,EAAE,CAAE,MAAM,EAAE,MAAM,KAAM,IAAI,GAAG,SAAS,CAAC;QAChD,OAAO,EAAE,CAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,KAAM,IAAI,CAAC;QACrD,UAAU,EAAE,CAAE,MAAM,EAAE,MAAM,KAAM,IAAI,CAAC;QACvC,SAAS,EAAE,MAAM,CAAE,MAAM,EAAE,MAAM,EAAE,CAAE,CAAC;QACtC,YAAY,EAAE,CACb,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,CAAE,UAAU,EAAE,IAAI,KAAM,OAAO,GAAG,SAAS,KACjD,IAAI,CAAC;QACV,WAAW,EAAE,CAAE,MAAM,EAAE,MAAM,KAAM,OAAO,CAAC;KAC3C,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Item, Menu } from './types';
|
|
2
|
+
export declare const useCreateNavigationTree: () => {
|
|
3
|
+
items: Record<string, Omit<Item, "children">>;
|
|
4
|
+
getItem: (key: string) => Omit<Item, "children">;
|
|
5
|
+
addItem: (key: string, value: Item) => void;
|
|
6
|
+
removeItem: (key: string) => void;
|
|
7
|
+
menus: Record<string, Omit<Menu, "children">>;
|
|
8
|
+
getMenu: (key: string) => Omit<Menu, "children">;
|
|
9
|
+
addMenu: (key: string, value: Menu) => void;
|
|
10
|
+
removeMenu: (key: string) => void;
|
|
11
|
+
childMenu: Record<string, string[]>;
|
|
12
|
+
traverseMenu: (startMenu: string, callback: (menuObject: Menu) => boolean | undefined) => void;
|
|
13
|
+
isMenuEmpty: (menuToCheck: string) => boolean;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=use-create-navigation-tree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-create-navigation-tree.d.ts","sourceRoot":"","sources":["../../src/navigation/use-create-navigation-tree.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAqB,IAAI,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE7D,eAAO,MAAM,uBAAuB;;;;;;;mBAyElB,MAAM,SAAS,IAAI;;;;+BAvBD,MAAM;CA+CzC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare function useNavigationTreeNodes<TNode extends {
|
|
2
|
+
children?: React.ReactNode;
|
|
3
|
+
[key: string]: unknown;
|
|
4
|
+
}>(): {
|
|
5
|
+
nodes: Record<string, Omit<TNode, "children">>;
|
|
6
|
+
getNode: (key: string) => Omit<TNode, "children">;
|
|
7
|
+
addNode: (key: string, value: TNode) => void;
|
|
8
|
+
removeNode: (key: string) => void;
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=use-navigation-tree-nodes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-navigation-tree-nodes.d.ts","sourceRoot":"","sources":["../../src/navigation/use-navigation-tree-nodes.tsx"],"names":[],"mappings":"AAKA,wBAAgB,sBAAsB,CACrC,KAAK,SAAS;IAAE,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAAC,CAAE,GAAG,EAAE,MAAM,GAAI,OAAO,CAAA;CAAE;;mBAM/C,MAAM;mBAEN,MAAM,SAAS,KAAK;;EAgB3C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/navigation/utils.tsx"],"names":[],"mappings":"AAMA,eAAO,MAAM,cAAc,UAAY,MAAM,WACa,CAAC;AAE3D,eAAO,MAAM,gBAAgB,UAAY,MAAM,UAAU,MAAM,YACI,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/unit-control/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/unit-control/utils.ts"],"names":[],"m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;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,cAAc,8CAIxB;IACF,KAAK,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAE,MAAM,EAAE,MAAM,CAAE,CAAC;CACzC,KAAI,iBAAiB,EAgBrB,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,uBAAuB,CACtC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,EAC1B,UAAU,CAAC,EAAE,MAAM,EACnB,KAAK,GAAE,iBAAiB,EAAkB,GACxC,iBAAiB,EAAE,CAkBrB"}
|
|
@@ -2,7 +2,7 @@ import type { ValidatedControlProps } from './types';
|
|
|
2
2
|
export declare const ValidatedComboboxControl: import("react").ForwardRefExoticComponent<Omit<Pick<import("../../base-control/types").BaseControlProps, "__nextHasNoMarginBottom" | "className" | "help" | "hideLabelFromVision" | "label"> & {
|
|
3
3
|
__experimentalRenderItem?: (args: {
|
|
4
4
|
item: import("../../combobox-control/types").ComboboxControlOption;
|
|
5
|
-
}) =>
|
|
5
|
+
}) => import("react").ReactNode;
|
|
6
6
|
__next36pxDefaultSize?: boolean;
|
|
7
7
|
__next40pxDefaultSize?: boolean;
|
|
8
8
|
allowReset?: boolean;
|
|
@@ -10,7 +10,7 @@ export declare const ValidatedComboboxControl: import("react").ForwardRefExoticC
|
|
|
10
10
|
messages?: {
|
|
11
11
|
selected: string;
|
|
12
12
|
};
|
|
13
|
-
onChange?: (value:
|
|
13
|
+
onChange?: (value: string | null | undefined) => void;
|
|
14
14
|
onFilterValueChange?: (value: string) => void;
|
|
15
15
|
options: import("../../combobox-control/types").ComboboxControlOption[];
|
|
16
16
|
value?: string | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/visually-hidden/test/index.tsx"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/components",
|
|
3
|
-
"version": "35.0.
|
|
3
|
+
"version": "35.0.1",
|
|
4
4
|
"description": "UI components for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -43,7 +43,6 @@
|
|
|
43
43
|
"./package.json": "./package.json",
|
|
44
44
|
"./build-style/": "./build-style/"
|
|
45
45
|
},
|
|
46
|
-
"react-native": "src/index",
|
|
47
46
|
"wpScript": true,
|
|
48
47
|
"types": "build-types",
|
|
49
48
|
"sideEffects": [
|
|
@@ -51,49 +50,48 @@
|
|
|
51
50
|
"src/**/*.scss"
|
|
52
51
|
],
|
|
53
52
|
"dependencies": {
|
|
54
|
-
"@ariakit/react": "^0.4.
|
|
53
|
+
"@ariakit/react": "^0.4.21",
|
|
55
54
|
"@date-fns/utc": "^2.1.1",
|
|
56
55
|
"@emotion/cache": "^11.14.0",
|
|
57
56
|
"@emotion/css": "^11.13.5",
|
|
58
|
-
"@emotion/native": "^11.11.0",
|
|
59
57
|
"@emotion/react": "^11.14.0",
|
|
60
58
|
"@emotion/serialize": "^1.3.3",
|
|
61
59
|
"@emotion/styled": "^11.14.1",
|
|
62
60
|
"@emotion/utils": "^1.4.2",
|
|
63
|
-
"@floating-ui/react-dom": "2.0.8",
|
|
64
|
-
"@types/gradient-parser": "1.1.0",
|
|
65
|
-
"@types/highlight-words-core": "1.2.1",
|
|
61
|
+
"@floating-ui/react-dom": "^2.0.8",
|
|
62
|
+
"@types/gradient-parser": "^1.1.0",
|
|
63
|
+
"@types/highlight-words-core": "^1.2.1",
|
|
66
64
|
"@types/react": "^18.3.27",
|
|
67
65
|
"@use-gesture/react": "^10.3.1",
|
|
68
|
-
"@wordpress/a11y": "^4.48.
|
|
69
|
-
"@wordpress/base-styles": "^
|
|
70
|
-
"@wordpress/compose": "^8.1.
|
|
71
|
-
"@wordpress/date": "^5.48.
|
|
72
|
-
"@wordpress/deprecated": "^4.48.
|
|
73
|
-
"@wordpress/dom": "^4.48.
|
|
74
|
-
"@wordpress/element": "^8.0.
|
|
75
|
-
"@wordpress/escape-html": "^3.48.
|
|
76
|
-
"@wordpress/hooks": "^4.48.
|
|
77
|
-
"@wordpress/html-entities": "^4.48.
|
|
78
|
-
"@wordpress/i18n": "^6.21.
|
|
79
|
-
"@wordpress/icons": "^
|
|
80
|
-
"@wordpress/is-shallow-equal": "^5.48.
|
|
81
|
-
"@wordpress/keycodes": "^4.48.
|
|
82
|
-
"@wordpress/primitives": "^4.48.
|
|
83
|
-
"@wordpress/private-apis": "^1.48.
|
|
84
|
-
"@wordpress/rich-text": "^7.48.
|
|
85
|
-
"@wordpress/style-runtime": "^0.4.
|
|
86
|
-
"@wordpress/ui": "^0.15.
|
|
87
|
-
"@wordpress/warning": "^3.48.
|
|
66
|
+
"@wordpress/a11y": "^4.48.1",
|
|
67
|
+
"@wordpress/base-styles": "^10.0.1",
|
|
68
|
+
"@wordpress/compose": "^8.1.1",
|
|
69
|
+
"@wordpress/date": "^5.48.1",
|
|
70
|
+
"@wordpress/deprecated": "^4.48.1",
|
|
71
|
+
"@wordpress/dom": "^4.48.1",
|
|
72
|
+
"@wordpress/element": "^8.0.1",
|
|
73
|
+
"@wordpress/escape-html": "^3.48.1",
|
|
74
|
+
"@wordpress/hooks": "^4.48.1",
|
|
75
|
+
"@wordpress/html-entities": "^4.48.1",
|
|
76
|
+
"@wordpress/i18n": "^6.21.1",
|
|
77
|
+
"@wordpress/icons": "^14.0.1",
|
|
78
|
+
"@wordpress/is-shallow-equal": "^5.48.1",
|
|
79
|
+
"@wordpress/keycodes": "^4.48.1",
|
|
80
|
+
"@wordpress/primitives": "^4.48.1",
|
|
81
|
+
"@wordpress/private-apis": "^1.48.1",
|
|
82
|
+
"@wordpress/rich-text": "^7.48.1",
|
|
83
|
+
"@wordpress/style-runtime": "^0.4.1",
|
|
84
|
+
"@wordpress/ui": "^0.15.1",
|
|
85
|
+
"@wordpress/warning": "^3.48.1",
|
|
88
86
|
"change-case": "^4.1.2",
|
|
89
87
|
"clsx": "^2.1.1",
|
|
90
|
-
"colord": "^2.
|
|
88
|
+
"colord": "^2.9.3",
|
|
91
89
|
"csstype": "^3.2.3",
|
|
92
90
|
"date-fns": "^4.1.0",
|
|
93
|
-
"deepmerge": "^4.3.
|
|
91
|
+
"deepmerge": "^4.3.1",
|
|
94
92
|
"fast-deep-equal": "^3.1.3",
|
|
95
93
|
"framer-motion": "^11.15.0",
|
|
96
|
-
"gradient-parser": "1.1.1",
|
|
94
|
+
"gradient-parser": "^1.1.1",
|
|
97
95
|
"highlight-words-core": "^1.2.2",
|
|
98
96
|
"is-plain-object": "^5.0.0",
|
|
99
97
|
"memize": "^2.1.0",
|
|
@@ -108,9 +106,13 @@
|
|
|
108
106
|
"@ariakit/test": "^0.4.13",
|
|
109
107
|
"@storybook/addon-docs": "^10.2.8",
|
|
110
108
|
"@storybook/react-vite": "^10.2.8",
|
|
109
|
+
"@testing-library/dom": "^10.4.1",
|
|
111
110
|
"@testing-library/jest-dom": "^6.9.1",
|
|
111
|
+
"@testing-library/react": "^16.3.2",
|
|
112
|
+
"@testing-library/user-event": "^14.6.1",
|
|
112
113
|
"@types/jest": "^29.5.14",
|
|
113
|
-
"@
|
|
114
|
+
"@types/react-dom": "^18.3.1",
|
|
115
|
+
"@wordpress/jest-console": "^8.48.1",
|
|
114
116
|
"snapshot-diff": "^0.10.0",
|
|
115
117
|
"storybook": "^10.2.8",
|
|
116
118
|
"timezone-mock": "^1.3.6"
|
|
@@ -122,5 +124,5 @@
|
|
|
122
124
|
"publishConfig": {
|
|
123
125
|
"access": "public"
|
|
124
126
|
},
|
|
125
|
-
"gitHead": "
|
|
127
|
+
"gitHead": "99df7432c5c7cb83ba41146fd1f57f3c19004305"
|
|
126
128
|
}
|
package/src/card/card/README.md
CHANGED
|
@@ -85,9 +85,9 @@ This component provides a collection of sub-component that can be used to compos
|
|
|
85
85
|
|
|
86
86
|
- [`<CardBody />`](/packages/components/src/card/card-body/README.md)
|
|
87
87
|
- [`<CardDivider />`](/packages/components/src/card/card-divider/README.md)
|
|
88
|
-
- [`<CardFooter />`](/packages/components/src/card/card-footer/README.md)
|
|
89
|
-
- [`<CardHeader />`](/packages/components/src/card/card-header/README.md)
|
|
90
|
-
- [`<CardMedia />`](/packages/components/src/card/card-media/README.md)
|
|
88
|
+
- [`<CardFooter />`](/packages/components/src/card/card-footer/README.md)
|
|
89
|
+
- [`<CardHeader />`](/packages/components/src/card/card-header/README.md)
|
|
90
|
+
- [`<CardMedia />`](/packages/components/src/card/card-media/README.md)
|
|
91
91
|
|
|
92
92
|
### Sub-Components Example
|
|
93
93
|
|
|
@@ -165,7 +165,7 @@ const Example = () => (
|
|
|
165
165
|
);
|
|
166
166
|
```
|
|
167
167
|
|
|
168
|
-
These sub-components are designed to be flexible. The Context props can be overridden by the sub-component(s) as required. In the following example, the last `<CardBody />` will render
|
|
168
|
+
These sub-components are designed to be flexible. The Context props can be overridden by the sub-component(s) as required. In the following example, the last `<CardBody />` will render its specified size:
|
|
169
169
|
|
|
170
170
|
```jsx
|
|
171
171
|
import { Card, CardBody } from '@wordpress/components';
|
|
@@ -51,15 +51,15 @@ The text that will be copied to the clipboard.
|
|
|
51
51
|
|
|
52
52
|
The function that will be called when the text is copied.
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
- Type: `() => void`
|
|
55
|
+
- Required: yes
|
|
56
56
|
|
|
57
57
|
### onFinishCopy
|
|
58
58
|
|
|
59
59
|
The function that will be called when the text is copied and the copy animation is finished.
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
- Type: `() => void`
|
|
62
|
+
- Required: no
|
|
63
63
|
|
|
64
64
|
### Inherited props
|
|
65
65
|
|
|
@@ -276,6 +276,11 @@ function UnforwardedColorPalette(
|
|
|
276
276
|
ariaLabelledby
|
|
277
277
|
);
|
|
278
278
|
|
|
279
|
+
// If disableCustomColors is true and colors.length is 0, return null to avoid rendering an empty palette wrapper.
|
|
280
|
+
if ( disableCustomColors && colors.length === 0 && ! actions ) {
|
|
281
|
+
return null;
|
|
282
|
+
}
|
|
283
|
+
|
|
279
284
|
return (
|
|
280
285
|
<VStack spacing={ 3 } ref={ forwardedRef } { ...additionalProps }>
|
|
281
286
|
{ ! disableCustomColors && (
|
|
@@ -151,6 +151,20 @@ describe( 'ColorPalette', () => {
|
|
|
151
151
|
).not.toBeInTheDocument();
|
|
152
152
|
} );
|
|
153
153
|
|
|
154
|
+
it( 'should render nothing when custom colors are disabled, there are no colors, and it is not clearable', () => {
|
|
155
|
+
const onChange = jest.fn();
|
|
156
|
+
const { container } = render(
|
|
157
|
+
<ColorPalette
|
|
158
|
+
colors={ [] }
|
|
159
|
+
disableCustomColors
|
|
160
|
+
clearable={ false }
|
|
161
|
+
onChange={ onChange }
|
|
162
|
+
/>
|
|
163
|
+
);
|
|
164
|
+
|
|
165
|
+
expect( container ).toBeEmptyDOMElement();
|
|
166
|
+
} );
|
|
167
|
+
|
|
154
168
|
it( 'should render dropdown and its content', async () => {
|
|
155
169
|
const user = userEvent.setup();
|
|
156
170
|
const onChange = jest.fn();
|
|
@@ -217,6 +231,22 @@ describe( 'ColorPalette', () => {
|
|
|
217
231
|
).toBeInTheDocument();
|
|
218
232
|
} );
|
|
219
233
|
|
|
234
|
+
it( 'should still show the clear button when colors is empty and custom colors are disabled', () => {
|
|
235
|
+
const onChange = jest.fn();
|
|
236
|
+
|
|
237
|
+
render(
|
|
238
|
+
<ColorPalette
|
|
239
|
+
colors={ [] }
|
|
240
|
+
disableCustomColors
|
|
241
|
+
onChange={ onChange }
|
|
242
|
+
/>
|
|
243
|
+
);
|
|
244
|
+
|
|
245
|
+
expect(
|
|
246
|
+
screen.getByRole( 'button', { name: 'Clear' } )
|
|
247
|
+
).toBeInTheDocument();
|
|
248
|
+
} );
|
|
249
|
+
|
|
220
250
|
it( 'should display the selected color name and value', async () => {
|
|
221
251
|
const user = userEvent.setup();
|
|
222
252
|
|