@wordpress/components 25.14.0 → 25.15.1-next.79a6196f.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 +51 -0
- package/CONTRIBUTING.md +57 -115
- package/LICENSE.md +1 -1
- package/build/base-control/index.js +17 -13
- package/build/base-control/index.js.map +1 -1
- package/build/border-box-control/border-box-control-linked-button/component.js +1 -1
- package/build/border-box-control/border-box-control-linked-button/component.js.map +1 -1
- package/build/border-control/border-control-style-picker/component.js +1 -1
- package/build/border-control/border-control-style-picker/component.js.map +1 -1
- package/build/box-control/index.js +1 -1
- package/build/box-control/index.js.map +1 -1
- package/build/box-control/linked-button.js +1 -1
- package/build/box-control/linked-button.js.map +1 -1
- package/build/button/index.js +1 -1
- package/build/button/index.js.map +1 -1
- package/build/color-palette/index.native.js +11 -7
- package/build/color-palette/index.native.js.map +1 -1
- package/build/color-picker/color-copy-button.js +1 -1
- package/build/color-picker/color-copy-button.js.map +1 -1
- package/build/context/wordpress-component.js.map +1 -1
- package/build/custom-select-control-v2/index.js +11 -10
- package/build/custom-select-control-v2/index.js.map +1 -1
- package/build/date-time/date/styles.js +8 -8
- package/build/date-time/date/styles.js.map +1 -1
- package/build/dropdown-menu-v2/index.js +205 -159
- package/build/dropdown-menu-v2/index.js.map +1 -1
- package/build/dropdown-menu-v2/styles.js +86 -77
- package/build/dropdown-menu-v2/styles.js.map +1 -1
- package/build/dropdown-menu-v2/types.js.map +1 -1
- package/build/duotone-picker/duotone-picker.js +4 -3
- package/build/duotone-picker/duotone-picker.js.map +1 -1
- package/build/font-size-picker/index.js +4 -2
- package/build/font-size-picker/index.js.map +1 -1
- package/build/font-size-picker/index.native.js +6 -3
- package/build/font-size-picker/index.native.js.map +1 -1
- package/build/form-token-field/index.js +10 -5
- package/build/form-token-field/index.js.map +1 -1
- package/build/form-token-field/token.js +1 -0
- package/build/form-token-field/token.js.map +1 -1
- package/build/gradient-picker/index.js +3 -2
- package/build/gradient-picker/index.js.map +1 -1
- package/build/index.native.js +20 -3
- package/build/index.native.js.map +1 -1
- package/build/input-control/styles/input-control-styles.js +32 -29
- package/build/input-control/styles/input-control-styles.js.map +1 -1
- package/build/input-control/types.js.map +1 -1
- package/build/lock-unlock.js +18 -0
- package/build/lock-unlock.js.map +1 -0
- package/build/mobile/bottom-sheet/index.native.js +8 -0
- package/build/mobile/bottom-sheet/index.native.js.map +1 -1
- package/build/mobile/color-settings/palette.screen.native.js +8 -4
- package/build/mobile/color-settings/palette.screen.native.js.map +1 -1
- package/build/mobile/global-styles-context/utils.native.js +26 -13
- package/build/mobile/global-styles-context/utils.native.js.map +1 -1
- package/build/mobile/image/constants.js +12 -0
- package/build/mobile/image/constants.js.map +1 -0
- package/build/mobile/image/index.native.js +26 -18
- package/build/mobile/image/index.native.js.map +1 -1
- package/build/mobile/keyboard-aware-flat-list/index.android.js +40 -8
- package/build/mobile/keyboard-aware-flat-list/index.android.js.map +1 -1
- package/build/mobile/keyboard-aware-flat-list/index.ios.js +44 -68
- package/build/mobile/keyboard-aware-flat-list/index.ios.js.map +1 -1
- package/build/mobile/keyboard-aware-flat-list/use-scroll-to-element.native.js +39 -0
- package/build/mobile/keyboard-aware-flat-list/use-scroll-to-element.native.js.map +1 -0
- package/build/mobile/keyboard-aware-flat-list/{use-scroll-to-text-input.native.js → use-scroll-to-section.native.js} +22 -29
- package/build/mobile/keyboard-aware-flat-list/use-scroll-to-section.native.js.map +1 -0
- package/build/mobile/keyboard-aware-flat-list/use-scroll.native.js +93 -0
- package/build/mobile/keyboard-aware-flat-list/use-scroll.native.js.map +1 -0
- package/build/mobile/utils/get-px-from-css-unit.native.js +302 -0
- package/build/mobile/utils/get-px-from-css-unit.native.js.map +1 -0
- package/build/modal/index.js +18 -13
- package/build/modal/index.js.map +1 -1
- package/build/navigation/menu/menu-title.js +1 -1
- package/build/navigation/menu/menu-title.js.map +1 -1
- package/build/navigator/navigator-provider/component.js +13 -15
- package/build/navigator/navigator-provider/component.js.map +1 -1
- package/build/navigator/navigator-screen/component.js +23 -63
- package/build/navigator/navigator-screen/component.js.map +1 -1
- package/build/navigator/styles.js +52 -0
- package/build/navigator/styles.js.map +1 -0
- package/build/number-control/index.js +4 -8
- package/build/number-control/index.js.map +1 -1
- package/build/number-control/types.js.map +1 -1
- package/build/palette-edit/index.js +15 -54
- package/build/palette-edit/index.js.map +1 -1
- package/build/private-apis.js +11 -26
- package/build/private-apis.js.map +1 -1
- package/build/private-apis.native.js +21 -0
- package/build/private-apis.native.js.map +1 -0
- package/build/radio-control/index.js +1 -0
- package/build/radio-control/index.js.map +1 -1
- package/build/range-control/index.js +1 -1
- package/build/range-control/index.js.map +1 -1
- package/build/select-control/styles/select-control-styles.js +15 -25
- package/build/select-control/styles/select-control-styles.js.map +1 -1
- package/build/slot-fill/index.js +3 -2
- package/build/slot-fill/index.js.map +1 -1
- package/build/slot-fill/types.js.map +1 -1
- package/build/snackbar/types.js.map +1 -1
- package/build/tabs/styles.js +3 -3
- package/build/tabs/styles.js.map +1 -1
- package/build/tabs/tabpanel.js +9 -7
- package/build/tabs/tabpanel.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/component.js +4 -4
- package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/styles.js +29 -15
- package/build/toggle-group-control/toggle-group-control/styles.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control-option-base/styles.js +9 -9
- package/build/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
- package/build/tools-panel/tools-panel/component.js +3 -1
- package/build/tools-panel/tools-panel/component.js.map +1 -1
- package/build/tools-panel/tools-panel-header/component.js +9 -8
- package/build/tools-panel/tools-panel-header/component.js.map +1 -1
- package/build/tools-panel/types.js.map +1 -1
- package/build/tooltip/index.js +34 -10
- package/build/tooltip/index.js.map +1 -1
- package/build/tooltip/types.js.map +1 -1
- package/build/truncate/hook.js +10 -4
- package/build/truncate/hook.js.map +1 -1
- package/build/truncate/types.js.map +1 -1
- package/build/unit-control/index.js +1 -1
- package/build/unit-control/index.js.map +1 -1
- package/build/utils/strings.js +34 -3
- package/build/utils/strings.js.map +1 -1
- package/build-module/base-control/index.js +16 -12
- package/build-module/base-control/index.js.map +1 -1
- package/build-module/border-box-control/border-box-control-linked-button/component.js +1 -1
- package/build-module/border-box-control/border-box-control-linked-button/component.js.map +1 -1
- package/build-module/border-control/border-control-style-picker/component.js +1 -1
- package/build-module/border-control/border-control-style-picker/component.js.map +1 -1
- package/build-module/box-control/index.js +1 -1
- package/build-module/box-control/index.js.map +1 -1
- package/build-module/box-control/linked-button.js +1 -1
- package/build-module/box-control/linked-button.js.map +1 -1
- package/build-module/button/index.js +1 -1
- package/build-module/button/index.js.map +1 -1
- package/build-module/color-palette/index.native.js +11 -7
- package/build-module/color-palette/index.native.js.map +1 -1
- package/build-module/color-picker/color-copy-button.js +1 -1
- package/build-module/color-picker/color-copy-button.js.map +1 -1
- package/build-module/context/wordpress-component.js.map +1 -1
- package/build-module/custom-select-control-v2/index.js +11 -10
- package/build-module/custom-select-control-v2/index.js.map +1 -1
- package/build-module/date-time/date/styles.js +8 -8
- package/build-module/date-time/date/styles.js.map +1 -1
- package/build-module/dropdown-menu-v2/index.js +201 -154
- package/build-module/dropdown-menu-v2/index.js.map +1 -1
- package/build-module/dropdown-menu-v2/styles.js +68 -61
- package/build-module/dropdown-menu-v2/styles.js.map +1 -1
- package/build-module/dropdown-menu-v2/types.js.map +1 -1
- package/build-module/duotone-picker/duotone-picker.js +4 -3
- package/build-module/duotone-picker/duotone-picker.js.map +1 -1
- package/build-module/font-size-picker/index.js +4 -2
- package/build-module/font-size-picker/index.js.map +1 -1
- package/build-module/font-size-picker/index.native.js +5 -2
- package/build-module/font-size-picker/index.native.js.map +1 -1
- package/build-module/form-token-field/index.js +10 -5
- package/build-module/form-token-field/index.js.map +1 -1
- package/build-module/form-token-field/token.js +1 -0
- package/build-module/form-token-field/token.js.map +1 -1
- package/build-module/gradient-picker/index.js +3 -2
- package/build-module/gradient-picker/index.js.map +1 -1
- package/build-module/index.native.js +6 -1
- package/build-module/index.native.js.map +1 -1
- package/build-module/input-control/styles/input-control-styles.js +31 -29
- package/build-module/input-control/styles/input-control-styles.js.map +1 -1
- package/build-module/input-control/types.js.map +1 -1
- package/build-module/lock-unlock.js +9 -0
- package/build-module/lock-unlock.js.map +1 -0
- package/build-module/mobile/bottom-sheet/index.native.js +9 -1
- package/build-module/mobile/bottom-sheet/index.native.js.map +1 -1
- package/build-module/mobile/color-settings/palette.screen.native.js +8 -4
- package/build-module/mobile/color-settings/palette.screen.native.js.map +1 -1
- package/build-module/mobile/global-styles-context/utils.native.js +25 -13
- package/build-module/mobile/global-styles-context/utils.native.js.map +1 -1
- package/build-module/mobile/image/constants.js +5 -0
- package/build-module/mobile/image/constants.js.map +1 -0
- package/build-module/mobile/image/index.native.js +25 -16
- package/build-module/mobile/image/index.native.js.map +1 -1
- package/build-module/mobile/keyboard-aware-flat-list/index.android.js +40 -6
- package/build-module/mobile/keyboard-aware-flat-list/index.android.js.map +1 -1
- package/build-module/mobile/keyboard-aware-flat-list/index.ios.js +46 -68
- package/build-module/mobile/keyboard-aware-flat-list/index.ios.js.map +1 -1
- package/build-module/mobile/keyboard-aware-flat-list/use-scroll-to-element.native.js +33 -0
- package/build-module/mobile/keyboard-aware-flat-list/use-scroll-to-element.native.js.map +1 -0
- package/build-module/mobile/keyboard-aware-flat-list/{use-scroll-to-text-input.native.js → use-scroll-to-section.native.js} +21 -27
- package/build-module/mobile/keyboard-aware-flat-list/use-scroll-to-section.native.js.map +1 -0
- package/build-module/mobile/keyboard-aware-flat-list/use-scroll.native.js +86 -0
- package/build-module/mobile/keyboard-aware-flat-list/use-scroll.native.js.map +1 -0
- package/build-module/mobile/utils/get-px-from-css-unit.native.js +294 -0
- package/build-module/mobile/utils/get-px-from-css-unit.native.js.map +1 -0
- package/build-module/modal/index.js +18 -13
- package/build-module/modal/index.js.map +1 -1
- package/build-module/navigation/menu/menu-title.js +1 -1
- package/build-module/navigation/menu/menu-title.js.map +1 -1
- package/build-module/navigator/navigator-provider/component.js +3 -16
- package/build-module/navigator/navigator-provider/component.js.map +1 -1
- package/build-module/navigator/navigator-screen/component.js +16 -70
- package/build-module/navigator/navigator-screen/component.js.map +1 -1
- package/build-module/navigator/styles.js +47 -0
- package/build-module/navigator/styles.js.map +1 -0
- package/build-module/number-control/index.js +4 -8
- package/build-module/number-control/index.js.map +1 -1
- package/build-module/number-control/types.js.map +1 -1
- package/build-module/palette-edit/index.js +15 -51
- package/build-module/palette-edit/index.js.map +1 -1
- package/build-module/private-apis.js +10 -23
- package/build-module/private-apis.js.map +1 -1
- package/build-module/private-apis.native.js +14 -0
- package/build-module/private-apis.native.js.map +1 -0
- package/build-module/radio-control/index.js +1 -0
- package/build-module/radio-control/index.js.map +1 -1
- package/build-module/range-control/index.js +1 -1
- package/build-module/range-control/index.js.map +1 -1
- package/build-module/select-control/styles/select-control-styles.js +15 -25
- package/build-module/select-control/styles/select-control-styles.js.map +1 -1
- package/build-module/slot-fill/index.js +3 -2
- package/build-module/slot-fill/index.js.map +1 -1
- package/build-module/slot-fill/types.js.map +1 -1
- package/build-module/snackbar/types.js.map +1 -1
- package/build-module/tabs/styles.js +3 -3
- package/build-module/tabs/styles.js.map +1 -1
- package/build-module/tabs/tabpanel.js +9 -7
- package/build-module/tabs/tabpanel.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control/component.js +4 -4
- package/build-module/toggle-group-control/toggle-group-control/component.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control/styles.js +29 -15
- package/build-module/toggle-group-control/toggle-group-control/styles.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js +9 -9
- package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
- package/build-module/tools-panel/tools-panel/component.js +3 -1
- package/build-module/tools-panel/tools-panel/component.js.map +1 -1
- package/build-module/tools-panel/tools-panel-header/component.js +9 -8
- package/build-module/tools-panel/tools-panel-header/component.js.map +1 -1
- package/build-module/tools-panel/types.js.map +1 -1
- package/build-module/tooltip/index.js +34 -12
- package/build-module/tooltip/index.js.map +1 -1
- package/build-module/tooltip/types.js.map +1 -1
- package/build-module/truncate/hook.js +10 -4
- package/build-module/truncate/hook.js.map +1 -1
- package/build-module/truncate/types.js.map +1 -1
- package/build-module/unit-control/index.js +1 -1
- package/build-module/unit-control/index.js.map +1 -1
- package/build-module/utils/strings.js +32 -2
- package/build-module/utils/strings.js.map +1 -1
- package/build-style/style-rtl.css +29 -5
- package/build-style/style.css +29 -5
- package/build-types/base-control/index.d.ts +3 -27
- package/build-types/base-control/index.d.ts.map +1 -1
- package/build-types/base-control/stories/index.story.d.ts +4 -1
- package/build-types/base-control/stories/index.story.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control/hook.d.ts +4 -4
- package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts +6 -6
- package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +4 -4
- package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts +4 -4
- package/build-types/border-box-control/stories/index.story.d.ts +1 -1
- package/build-types/border-control/border-control/hook.d.ts +4 -4
- package/build-types/border-control/border-control-dropdown/hook.d.ts +4 -4
- package/build-types/border-control/border-control-style-picker/hook.d.ts +4 -4
- package/build-types/border-control/stories/index.story.d.ts +6 -6
- package/build-types/box-control/stories/index.story.d.ts +42 -42
- package/build-types/box-control/styles/box-control-styles.d.ts +1 -1
- package/build-types/button/deprecated.d.ts +3 -3
- package/build-types/card/card/hook.d.ts +4 -4
- package/build-types/card/card-body/hook.d.ts +4 -4
- package/build-types/card/card-divider/hook.d.ts +4 -4
- package/build-types/card/card-footer/hook.d.ts +4 -4
- package/build-types/card/card-header/hook.d.ts +4 -4
- package/build-types/card/card-media/hook.d.ts +4 -4
- package/build-types/color-palette/styles.d.ts +2 -2
- package/build-types/color-picker/component.d.ts +2 -2
- package/build-types/color-picker/stories/index.story.d.ts +1 -1
- package/build-types/color-picker/stories/index.story.d.ts.map +1 -1
- package/build-types/color-picker/styles.d.ts +3 -3
- package/build-types/composite/test/index.d.ts.map +1 -0
- package/build-types/context/wordpress-component.d.ts +3 -3
- package/build-types/context/wordpress-component.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/index.d.ts +3 -2
- package/build-types/custom-select-control-v2/index.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/stories/index.story.d.ts +4 -3
- package/build-types/custom-select-control-v2/stories/index.story.d.ts.map +1 -1
- package/build-types/date-time/date/styles.d.ts +3 -3
- package/build-types/date-time/date-time/styles.d.ts +1 -1
- package/build-types/date-time/time/styles.d.ts +4 -4
- package/build-types/dropdown/index.d.ts +1 -1
- package/build-types/dropdown/index.d.ts.map +1 -1
- package/build-types/dropdown/stories/index.story.d.ts +3 -3
- package/build-types/dropdown/stories/index.story.d.ts.map +1 -1
- package/build-types/dropdown-menu/index.d.ts +1 -1
- package/build-types/dropdown-menu/index.d.ts.map +1 -1
- package/build-types/dropdown-menu/stories/index.story.d.ts +2 -2
- package/build-types/dropdown-menu/stories/index.story.d.ts.map +1 -1
- package/build-types/dropdown-menu-v2/index.d.ts +18 -15
- package/build-types/dropdown-menu-v2/index.d.ts.map +1 -1
- package/build-types/dropdown-menu-v2/stories/index.story.d.ts +7 -2
- package/build-types/dropdown-menu-v2/stories/index.story.d.ts.map +1 -1
- package/build-types/dropdown-menu-v2/styles.d.ts +77 -23
- package/build-types/dropdown-menu-v2/styles.d.ts.map +1 -1
- package/build-types/dropdown-menu-v2/types.d.ts +89 -173
- package/build-types/dropdown-menu-v2/types.d.ts.map +1 -1
- package/build-types/duotone-picker/duotone-picker.d.ts.map +1 -1
- package/build-types/elevation/hook.d.ts +4 -4
- package/build-types/flex/flex/hook.d.ts +4 -4
- package/build-types/flex/flex-block/hook.d.ts +4 -4
- package/build-types/flex/flex-item/hook.d.ts +4 -4
- package/build-types/focal-point-picker/stories/index.story.d.ts +4 -4
- package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +1 -1
- package/build-types/font-size-picker/index.d.ts.map +1 -1
- package/build-types/font-size-picker/styles.d.ts +1 -1
- package/build-types/form-token-field/index.d.ts.map +1 -1
- package/build-types/form-token-field/token.d.ts.map +1 -1
- package/build-types/grid/hook.d.ts +4 -4
- package/build-types/h-stack/hook.d.ts +4 -4
- package/build-types/heading/component.d.ts +1 -1
- package/build-types/heading/hook.d.ts +4 -4
- package/build-types/input-control/styles/input-control-styles.d.ts +11 -0
- package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
- package/build-types/input-control/types.d.ts +1 -1
- package/build-types/input-control/types.d.ts.map +1 -1
- package/build-types/item-group/item/hook.d.ts +4 -4
- package/build-types/item-group/item-group/hook.d.ts +4 -4
- package/build-types/lock-unlock.d.ts +3 -0
- package/build-types/lock-unlock.d.ts.map +1 -0
- package/build-types/menu-item/index.d.ts +1 -1
- package/build-types/menu-item/stories/index.story.d.ts +4 -4
- package/build-types/mobile/image/constants.d.ts +5 -0
- package/build-types/mobile/image/constants.d.ts.map +1 -0
- package/build-types/modal/index.d.ts.map +1 -1
- package/build-types/navigation/styles/navigation-styles.d.ts +3 -3
- package/build-types/navigator/navigator-back-button/hook.d.ts +6 -6
- package/build-types/navigator/navigator-button/hook.d.ts +6 -6
- package/build-types/navigator/navigator-provider/component.d.ts.map +1 -1
- package/build-types/navigator/navigator-screen/component.d.ts +1 -7
- package/build-types/navigator/navigator-screen/component.d.ts.map +1 -1
- package/build-types/navigator/styles.d.ts +9 -0
- package/build-types/navigator/styles.d.ts.map +1 -0
- 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/types.d.ts +1 -1
- package/build-types/palette-edit/index.d.ts +3 -8
- package/build-types/palette-edit/index.d.ts.map +1 -1
- package/build-types/palette-edit/styles.d.ts +3 -3
- package/build-types/popover/index.d.ts +1 -1
- package/build-types/popover/index.d.ts.map +1 -1
- package/build-types/popover/stories/e2e/index.story.d.ts +1 -1
- package/build-types/private-apis.d.ts +0 -1
- package/build-types/private-apis.d.ts.map +1 -1
- package/build-types/radio-control/index.d.ts.map +1 -1
- package/build-types/range-control/index.d.ts +1 -1
- package/build-types/range-control/styles/range-control-styles.d.ts +1 -1
- package/build-types/resizable-box/index.d.ts +1 -1
- package/build-types/resizable-box/resize-tooltip/index.d.ts +1 -1
- package/build-types/resizable-box/stories/index.story.d.ts +2 -2
- package/build-types/scrollable/hook.d.ts +4 -4
- package/build-types/search-control/index.d.ts +1 -1
- package/build-types/search-control/stories/index.story.d.ts +2 -2
- package/build-types/select-control/styles/select-control-styles.d.ts.map +1 -1
- package/build-types/slot-fill/index.d.ts +1 -1
- package/build-types/slot-fill/index.d.ts.map +1 -1
- package/build-types/slot-fill/types.d.ts +4 -0
- package/build-types/slot-fill/types.d.ts.map +1 -1
- package/build-types/snackbar/index.d.ts +2 -2
- package/build-types/snackbar/stories/index.story.d.ts +0 -3
- package/build-types/snackbar/stories/index.story.d.ts.map +1 -1
- package/build-types/snackbar/types.d.ts +1 -1
- package/build-types/snackbar/types.d.ts.map +1 -1
- package/build-types/spacer/hook.d.ts +4 -4
- package/build-types/surface/hook.d.ts +4 -4
- package/build-types/tabs/styles.d.ts.map +1 -1
- package/build-types/tabs/tabpanel.d.ts +1 -1
- package/build-types/tabs/tabpanel.d.ts.map +1 -1
- package/build-types/text/hook.d.ts +4 -4
- package/build-types/text-control/index.d.ts +1 -1
- package/build-types/textarea-control/index.d.ts +1 -1
- package/build-types/toggle-control/stories/index.story.d.ts +2 -2
- package/build-types/toggle-group-control/toggle-group-control/as-button-group.d.ts +1 -1
- package/build-types/toggle-group-control/toggle-group-control/as-radio-group.d.ts +1 -1
- package/build-types/toggle-group-control/toggle-group-control/component.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control/styles.d.ts +2 -2
- package/build-types/toggle-group-control/toggle-group-control/styles.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control-option/component.d.ts +1 -1
- package/build-types/toggle-group-control/toggle-group-control-option-base/component.d.ts +1 -1
- package/build-types/toggle-group-control/toggle-group-control-option-base/component.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control-option-icon/component.d.ts +1 -1
- package/build-types/toolbar/toolbar-button/index.d.ts +3 -3
- package/build-types/tools-panel/tools-panel/component.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel/hook.d.ts +5 -4
- package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel-header/component.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel-header/hook.d.ts +5 -4
- 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 +4 -4
- package/build-types/tools-panel/types.d.ts +9 -0
- package/build-types/tools-panel/types.d.ts.map +1 -1
- package/build-types/tooltip/index.d.ts +1 -1
- package/build-types/tooltip/index.d.ts.map +1 -1
- package/build-types/tooltip/stories/index.story.d.ts +10 -1
- package/build-types/tooltip/stories/index.story.d.ts.map +1 -1
- package/build-types/tooltip/types.d.ts +3 -0
- package/build-types/tooltip/types.d.ts.map +1 -1
- package/build-types/truncate/hook.d.ts +5 -5
- package/build-types/truncate/hook.d.ts.map +1 -1
- package/build-types/truncate/types.d.ts +4 -0
- package/build-types/truncate/types.d.ts.map +1 -1
- package/build-types/unit-control/index.d.ts +1 -1
- package/build-types/unit-control/styles/unit-control-styles.d.ts +1 -1
- package/build-types/utils/strings.d.ts +14 -2
- package/build-types/utils/strings.d.ts.map +1 -1
- package/build-types/v-stack/hook.d.ts +4 -4
- package/build-types/v-stack/stories/index.story.d.ts +1 -1
- package/package.json +20 -21
- package/src/alignment-matrix-control/test/index.tsx +10 -16
- package/src/base-control/index.tsx +21 -16
- package/src/border-box-control/border-box-control-linked-button/component.tsx +1 -1
- package/src/border-control/border-control-style-picker/component.tsx +1 -1
- package/src/box-control/index.tsx +1 -1
- package/src/box-control/linked-button.tsx +1 -1
- package/src/button/README.md +32 -6
- package/src/button/index.tsx +1 -1
- package/src/button-group/README.md +0 -6
- package/src/card/card/README.md +1 -1
- package/src/checkbox-control/README.md +1 -9
- package/src/color-palette/index.native.js +18 -7
- package/src/color-picker/color-copy-button.tsx +1 -1
- package/src/combobox-control/README.md +0 -6
- package/src/composite/test/index.tsx +576 -0
- package/src/context/wordpress-component.ts +11 -6
- package/src/custom-select-control/README.md +0 -6
- package/src/custom-select-control-v2/index.tsx +13 -12
- package/src/date-time/date/styles.ts +3 -3
- package/src/dropdown-menu/README.md +0 -5
- package/src/dropdown-menu-v2/README.md +75 -136
- package/src/dropdown-menu-v2/index.tsx +321 -231
- package/src/dropdown-menu-v2/stories/index.story.tsx +522 -126
- package/src/dropdown-menu-v2/styles.ts +226 -151
- package/src/dropdown-menu-v2/test/index.tsx +480 -188
- package/src/dropdown-menu-v2/types.ts +98 -184
- package/src/duotone-picker/duotone-picker.tsx +7 -3
- package/src/font-size-picker/index.native.js +8 -2
- package/src/font-size-picker/index.tsx +4 -2
- package/src/form-toggle/README.md +0 -6
- package/src/form-token-field/index.tsx +11 -7
- package/src/form-token-field/test/index.tsx +97 -0
- package/src/form-token-field/token.tsx +1 -0
- package/src/gradient-picker/index.tsx +2 -2
- package/src/index.native.js +6 -1
- package/src/input-control/styles/input-control-styles.tsx +10 -8
- package/src/input-control/types.ts +1 -1
- package/src/lock-unlock.js +10 -0
- package/src/menu-group/README.md +0 -8
- package/src/menu-items-choice/README.md +0 -7
- package/src/mobile/bottom-sheet/index.native.js +15 -1
- package/src/mobile/color-settings/palette.screen.native.js +7 -5
- package/src/mobile/global-styles-context/test/fixtures/theme.native.js +0 -20
- package/src/mobile/global-styles-context/utils.native.js +28 -19
- package/src/mobile/image/constants.js +1 -0
- package/src/mobile/image/index.native.js +55 -18
- package/src/mobile/image/style.native.scss +35 -9
- package/src/mobile/keyboard-aware-flat-list/index.android.js +50 -5
- package/src/mobile/keyboard-aware-flat-list/index.ios.js +65 -91
- package/src/mobile/keyboard-aware-flat-list/test/{use-scroll-to-text-input.native.js → use-scroll-to-section.native.js} +27 -25
- package/src/mobile/keyboard-aware-flat-list/test/use-scroll.native.js +71 -0
- package/src/mobile/keyboard-aware-flat-list/use-scroll-to-element.native.js +41 -0
- package/src/mobile/keyboard-aware-flat-list/{use-scroll-to-text-input.native.js → use-scroll-to-section.native.js} +22 -27
- package/src/mobile/keyboard-aware-flat-list/use-scroll.native.js +100 -0
- package/src/mobile/utils/get-px-from-css-unit.native.js +329 -0
- package/src/mobile/utils/test/get-px-from-css-unit.native.js +172 -0
- package/src/modal/README.md +0 -6
- package/src/modal/index.tsx +18 -16
- package/src/modal/test/index.tsx +90 -1
- package/src/navigation/menu/menu-title.tsx +1 -1
- package/src/navigator/navigator-provider/component.tsx +3 -4
- package/src/navigator/navigator-screen/component.tsx +15 -93
- package/src/navigator/styles.ts +71 -0
- package/src/navigator/test/index.tsx +0 -64
- package/src/notice/README.md +0 -6
- package/src/number-control/README.md +2 -2
- package/src/number-control/index.tsx +4 -8
- package/src/number-control/types.ts +1 -1
- package/src/palette-edit/index.tsx +15 -58
- package/src/palette-edit/test/index.tsx +1 -75
- package/src/panel/README.md +0 -6
- package/src/private-apis.native.js +13 -0
- package/src/private-apis.ts +12 -37
- package/src/radio-control/README.md +0 -6
- package/src/radio-control/index.tsx +4 -1
- package/src/radio-control/style.scss +29 -2
- package/src/radio-group/README.md +0 -6
- package/src/range-control/README.md +1 -9
- package/src/range-control/index.tsx +1 -1
- package/src/search-control/README.md +0 -6
- package/src/select-control/README.md +0 -6
- package/src/select-control/styles/select-control-styles.ts +10 -28
- package/src/slot-fill/index.tsx +5 -2
- package/src/slot-fill/types.ts +5 -0
- package/src/snackbar/README.md +0 -6
- package/src/snackbar/stories/index.story.tsx +7 -5
- package/src/snackbar/style.scss +4 -3
- package/src/snackbar/types.ts +2 -1
- package/src/spacer/README.md +0 -2
- package/src/tab-panel/README.md +0 -5
- package/src/tab-panel/test/index.tsx +39 -56
- package/src/tabs/styles.ts +7 -1
- package/src/tabs/tabpanel.tsx +7 -6
- package/src/tabs/test/index.tsx +56 -0
- package/src/text-control/README.md +0 -6
- package/src/textarea-control/README.md +0 -6
- package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +12 -16
- package/src/toggle-group-control/test/index.tsx +58 -45
- package/src/toggle-group-control/toggle-group-control/component.tsx +5 -4
- package/src/toggle-group-control/toggle-group-control/styles.ts +13 -19
- package/src/toggle-group-control/toggle-group-control-option/README.md +1 -1
- package/src/toggle-group-control/toggle-group-control-option-base/README.md +1 -1
- package/src/toggle-group-control/toggle-group-control-option-base/styles.ts +3 -2
- package/src/toggle-group-control/toggle-group-control-option-icon/README.md +1 -1
- package/src/toolbar/toolbar/README.md +0 -6
- package/src/tools-panel/test/index.tsx +12 -20
- package/src/tools-panel/tools-panel/README.md +7 -0
- package/src/tools-panel/tools-panel/component.tsx +2 -0
- package/src/tools-panel/tools-panel-header/README.md +7 -0
- package/src/tools-panel/tools-panel-header/component.tsx +20 -13
- package/src/tools-panel/types.ts +9 -0
- package/src/tooltip/README.md +4 -0
- package/src/tooltip/index.tsx +48 -10
- package/src/tooltip/stories/index.story.tsx +18 -1
- package/src/tooltip/test/index.tsx +404 -254
- package/src/tooltip/types.ts +4 -0
- package/src/tree-grid/README.md +0 -4
- package/src/truncate/README.md +8 -0
- package/src/truncate/hook.ts +17 -10
- package/src/truncate/test/index.tsx +54 -27
- package/src/truncate/types.ts +4 -0
- package/src/unit-control/index.tsx +1 -1
- package/src/utils/strings.ts +30 -2
- package/src/utils/test/strings.js +96 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/build/dropdown-menu-v2-ariakit/index.js +0 -256
- package/build/dropdown-menu-v2-ariakit/index.js.map +0 -1
- package/build/dropdown-menu-v2-ariakit/styles.js +0 -180
- package/build/dropdown-menu-v2-ariakit/styles.js.map +0 -1
- package/build/dropdown-menu-v2-ariakit/types.js +0 -6
- package/build/dropdown-menu-v2-ariakit/types.js.map +0 -1
- package/build/mobile/keyboard-aware-flat-list/use-scroll-to-text-input.native.js.map +0 -1
- package/build-module/dropdown-menu-v2-ariakit/index.js +0 -237
- package/build-module/dropdown-menu-v2-ariakit/index.js.map +0 -1
- package/build-module/dropdown-menu-v2-ariakit/styles.js +0 -165
- package/build-module/dropdown-menu-v2-ariakit/styles.js.map +0 -1
- package/build-module/dropdown-menu-v2-ariakit/types.js +0 -2
- package/build-module/dropdown-menu-v2-ariakit/types.js.map +0 -1
- package/build-module/mobile/keyboard-aware-flat-list/use-scroll-to-text-input.native.js.map +0 -1
- package/build-types/dropdown-menu-v2-ariakit/index.d.ts +0 -20
- package/build-types/dropdown-menu-v2-ariakit/index.d.ts.map +0 -1
- package/build-types/dropdown-menu-v2-ariakit/stories/index.story.d.ts +0 -16
- package/build-types/dropdown-menu-v2-ariakit/stories/index.story.d.ts.map +0 -1
- package/build-types/dropdown-menu-v2-ariakit/styles.d.ts +0 -96
- package/build-types/dropdown-menu-v2-ariakit/styles.d.ts.map +0 -1
- package/build-types/dropdown-menu-v2-ariakit/test/index.d.ts.map +0 -1
- package/build-types/dropdown-menu-v2-ariakit/types.d.ts +0 -168
- package/build-types/dropdown-menu-v2-ariakit/types.d.ts.map +0 -1
- package/src/dropdown-menu-v2-ariakit/README.md +0 -331
- package/src/dropdown-menu-v2-ariakit/index.tsx +0 -383
- package/src/dropdown-menu-v2-ariakit/stories/index.story.tsx +0 -617
- package/src/dropdown-menu-v2-ariakit/styles.ts +0 -345
- package/src/dropdown-menu-v2-ariakit/test/index.tsx +0 -1108
- package/src/dropdown-menu-v2-ariakit/types.ts +0 -179
- /package/build-types/{dropdown-menu-v2-ariakit → composite}/test/index.d.ts +0 -0
|
@@ -1,331 +0,0 @@
|
|
|
1
|
-
# `DropdownMenu` (v2)
|
|
2
|
-
|
|
3
|
-
<div class="callout callout-alert">
|
|
4
|
-
This feature is still experimental. “Experimental” means this is an early implementation subject to drastic and breaking changes.
|
|
5
|
-
</div>
|
|
6
|
-
|
|
7
|
-
`DropdownMenu` displays a menu to the user (such as a set of actions or functions) triggered by a button.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
## Design guidelines
|
|
11
|
-
|
|
12
|
-
### Usage
|
|
13
|
-
|
|
14
|
-
#### When to use a DropdownMenu
|
|
15
|
-
|
|
16
|
-
Use a DropdownMenu when you want users to:
|
|
17
|
-
|
|
18
|
-
- Choose an action or change a setting from a list, AND
|
|
19
|
-
- Only see the available choices contextually.
|
|
20
|
-
|
|
21
|
-
`DropdownMenu` is a React component to render an expandable menu of buttons. It is similar in purpose to a `<select>` element, with the distinction that it does not maintain a value. Instead, each option behaves as an action button.
|
|
22
|
-
|
|
23
|
-
If you need to display all the available options at all times, consider using a Toolbar instead. Use a `DropdownMenu` to display a list of actions after the user interacts with a button.
|
|
24
|
-
|
|
25
|
-
**Do**
|
|
26
|
-
Use a `DropdownMenu` to display a list of actions after the user interacts with an icon.
|
|
27
|
-
|
|
28
|
-
**Don’t** use a `DropdownMenu` for important actions that should always be visible. Use a `Toolbar` instead.
|
|
29
|
-
|
|
30
|
-
**Don’t**
|
|
31
|
-
Don’t use a `DropdownMenu` for frequently used actions. Use a `Toolbar` instead.
|
|
32
|
-
|
|
33
|
-
#### Behavior
|
|
34
|
-
|
|
35
|
-
Generally, the parent button should indicate that interacting with it will show a `DropdownMenu`.
|
|
36
|
-
|
|
37
|
-
The parent button should retain the same visual styling regardless of whether the `DropdownMenu` is displayed or not.
|
|
38
|
-
|
|
39
|
-
#### Placement
|
|
40
|
-
|
|
41
|
-
The `DropdownMenu` should typically appear directly below, or below and to the left of, the parent button. If there isn’t enough space below to display the full `DropdownMenu`, it can be displayed instead above the parent button.
|
|
42
|
-
|
|
43
|
-
## Development guidelines
|
|
44
|
-
|
|
45
|
-
This component is still highly experimental, and it's not normally accessible to consumers of the `@wordpress/components` package.
|
|
46
|
-
|
|
47
|
-
The component exposes a set of components that are meant to be used in combination with each other in order to implement a `DropdownMenu` correctly.
|
|
48
|
-
|
|
49
|
-
### `DropdownMenu`
|
|
50
|
-
|
|
51
|
-
The root component, used to specify the menu's trigger and its contents.
|
|
52
|
-
|
|
53
|
-
#### Props
|
|
54
|
-
|
|
55
|
-
The component accepts the following props:
|
|
56
|
-
|
|
57
|
-
##### `trigger`: `React.ReactNode`
|
|
58
|
-
|
|
59
|
-
The trigger button
|
|
60
|
-
|
|
61
|
-
- Required: yes
|
|
62
|
-
|
|
63
|
-
##### `children`: `React.ReactNode`
|
|
64
|
-
|
|
65
|
-
The contents of the dropdown
|
|
66
|
-
|
|
67
|
-
- Required: yes
|
|
68
|
-
|
|
69
|
-
##### `defaultOpen`: `boolean`
|
|
70
|
-
|
|
71
|
-
The open state of the dropdown menu when it is initially rendered. Use when not wanting to control its open state.
|
|
72
|
-
|
|
73
|
-
- Required: no
|
|
74
|
-
- Default: `false`
|
|
75
|
-
|
|
76
|
-
##### `open`: `boolean`
|
|
77
|
-
|
|
78
|
-
The controlled open state of the dropdown menu. Must be used in conjunction with `onOpenChange`.
|
|
79
|
-
|
|
80
|
-
- Required: no
|
|
81
|
-
|
|
82
|
-
##### `onOpenChange`: `(open: boolean) => void`
|
|
83
|
-
|
|
84
|
-
Event handler called when the open state of the dropdown menu changes.
|
|
85
|
-
|
|
86
|
-
- Required: no
|
|
87
|
-
|
|
88
|
-
##### `modal`: `boolean`
|
|
89
|
-
|
|
90
|
-
The modality of the dropdown menu. When set to true, interaction with outside elements will be disabled and only menu content will be visible to screen readers.
|
|
91
|
-
|
|
92
|
-
- Required: no
|
|
93
|
-
- Default: `true`
|
|
94
|
-
|
|
95
|
-
##### `placement`: ``'top' | 'top-start' | 'top-end' | 'right' | 'right-start' | 'right-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end'`
|
|
96
|
-
|
|
97
|
-
The placement of the dropdown menu popover.
|
|
98
|
-
|
|
99
|
-
- Required: no
|
|
100
|
-
- Default: `'bottom-start'` for root-level menus, `'right-start'` for nested menus
|
|
101
|
-
|
|
102
|
-
##### `gutter`: `number`
|
|
103
|
-
|
|
104
|
-
The distance in pixels from the trigger.
|
|
105
|
-
|
|
106
|
-
- Required: no
|
|
107
|
-
- Default: `8` for root-level menus, `16` for nested menus
|
|
108
|
-
|
|
109
|
-
##### `shift`: `number`
|
|
110
|
-
|
|
111
|
-
The skidding of the popover along the anchor element. Can be set to negative values to make the popover shift to the opposite side.
|
|
112
|
-
|
|
113
|
-
- Required: no
|
|
114
|
-
- Default: `0` for root-level menus, `-8` for nested menus
|
|
115
|
-
|
|
116
|
-
### `DropdownMenuItem`
|
|
117
|
-
|
|
118
|
-
Used to render a menu item.
|
|
119
|
-
|
|
120
|
-
#### Props
|
|
121
|
-
|
|
122
|
-
The component accepts the following props:
|
|
123
|
-
|
|
124
|
-
##### `children`: `React.ReactNode`
|
|
125
|
-
|
|
126
|
-
The contents of the item
|
|
127
|
-
|
|
128
|
-
- Required: yes
|
|
129
|
-
|
|
130
|
-
##### `prefix`: `React.ReactNode`
|
|
131
|
-
|
|
132
|
-
The contents of the item's prefix.
|
|
133
|
-
|
|
134
|
-
- Required: no
|
|
135
|
-
|
|
136
|
-
##### `suffix`: `React.ReactNode`
|
|
137
|
-
|
|
138
|
-
The contents of the item's suffix.
|
|
139
|
-
|
|
140
|
-
- Required: no
|
|
141
|
-
|
|
142
|
-
##### `hideOnClick`: `boolean`
|
|
143
|
-
|
|
144
|
-
Whether to hide the dropdown menu when the menu item is clicked.
|
|
145
|
-
|
|
146
|
-
- Required: no
|
|
147
|
-
- Default: `true`
|
|
148
|
-
|
|
149
|
-
##### `disabled`: `boolean`
|
|
150
|
-
|
|
151
|
-
Determines if the element is disabled.
|
|
152
|
-
|
|
153
|
-
- Required: no
|
|
154
|
-
- Default: `false`
|
|
155
|
-
|
|
156
|
-
### `DropdownMenuCheckboxItem`
|
|
157
|
-
|
|
158
|
-
Used to render a checkbox item.
|
|
159
|
-
|
|
160
|
-
#### Props
|
|
161
|
-
|
|
162
|
-
The component accepts the following props:
|
|
163
|
-
|
|
164
|
-
##### `children`: `React.ReactNode`
|
|
165
|
-
|
|
166
|
-
The contents of the item
|
|
167
|
-
|
|
168
|
-
- Required: yes
|
|
169
|
-
|
|
170
|
-
##### `suffix`: `React.ReactNode`
|
|
171
|
-
|
|
172
|
-
The contents of the item's suffix.
|
|
173
|
-
|
|
174
|
-
- Required: no
|
|
175
|
-
|
|
176
|
-
##### `hideOnClick`: `boolean`
|
|
177
|
-
|
|
178
|
-
Whether to hide the dropdown menu when the menu item is clicked.
|
|
179
|
-
|
|
180
|
-
- Required: no
|
|
181
|
-
- Default: `false`
|
|
182
|
-
|
|
183
|
-
##### `disabled`: `boolean`
|
|
184
|
-
|
|
185
|
-
Determines if the element is disabled.
|
|
186
|
-
|
|
187
|
-
- Required: no
|
|
188
|
-
- Default: `false`
|
|
189
|
-
|
|
190
|
-
##### `name`: `string`
|
|
191
|
-
|
|
192
|
-
The checkbox item's name.
|
|
193
|
-
|
|
194
|
-
- Required: yes
|
|
195
|
-
|
|
196
|
-
##### `value`: `string`
|
|
197
|
-
|
|
198
|
-
The checkbox item's value, useful when using multiple checkbox items
|
|
199
|
-
associated to the same `name`.
|
|
200
|
-
|
|
201
|
-
- Required: no
|
|
202
|
-
|
|
203
|
-
##### `checked`: `boolean`
|
|
204
|
-
|
|
205
|
-
The checkbox item's value, useful when using multiple checkbox items
|
|
206
|
-
associated to the same `name`.
|
|
207
|
-
|
|
208
|
-
- Required: no
|
|
209
|
-
|
|
210
|
-
##### `defaultChecked`: `boolean`
|
|
211
|
-
|
|
212
|
-
The checked state of the checkbox menu item when it is initially rendered. Use when not wanting to control its checked state.
|
|
213
|
-
|
|
214
|
-
- Required: no
|
|
215
|
-
|
|
216
|
-
##### `onChange`: `( event: React.ChangeEvent< HTMLInputElement > ) => void;`
|
|
217
|
-
|
|
218
|
-
Event handler called when the checked state of the checkbox menu item changes.
|
|
219
|
-
|
|
220
|
-
- Required: no
|
|
221
|
-
|
|
222
|
-
### `DropdownMenuRadioItem`
|
|
223
|
-
|
|
224
|
-
Used to render a radio item.
|
|
225
|
-
|
|
226
|
-
#### Props
|
|
227
|
-
|
|
228
|
-
The component accepts the following props:
|
|
229
|
-
|
|
230
|
-
##### `children`: `React.ReactNode`
|
|
231
|
-
|
|
232
|
-
The contents of the item
|
|
233
|
-
|
|
234
|
-
- Required: yes
|
|
235
|
-
|
|
236
|
-
##### `suffix`: `React.ReactNode`
|
|
237
|
-
|
|
238
|
-
The contents of the item's suffix.
|
|
239
|
-
|
|
240
|
-
- Required: no
|
|
241
|
-
|
|
242
|
-
##### `hideOnClick`: `boolean`
|
|
243
|
-
|
|
244
|
-
Whether to hide the dropdown menu when the menu item is clicked.
|
|
245
|
-
|
|
246
|
-
- Required: no
|
|
247
|
-
- Default: `false`
|
|
248
|
-
|
|
249
|
-
##### `disabled`: `boolean`
|
|
250
|
-
|
|
251
|
-
Determines if the element is disabled.
|
|
252
|
-
|
|
253
|
-
- Required: no
|
|
254
|
-
- Default: `false`
|
|
255
|
-
|
|
256
|
-
##### `name`: `string`
|
|
257
|
-
|
|
258
|
-
The radio item's name.
|
|
259
|
-
|
|
260
|
-
- Required: yes
|
|
261
|
-
|
|
262
|
-
##### `value`: `string | number`
|
|
263
|
-
|
|
264
|
-
The radio item's value.
|
|
265
|
-
|
|
266
|
-
- Required: yes
|
|
267
|
-
|
|
268
|
-
##### `checked`: `boolean`
|
|
269
|
-
|
|
270
|
-
The checkbox item's value, useful when using multiple checkbox items
|
|
271
|
-
associated to the same `name`.
|
|
272
|
-
|
|
273
|
-
- Required: no
|
|
274
|
-
|
|
275
|
-
##### `defaultChecked`: `boolean`
|
|
276
|
-
|
|
277
|
-
The checked state of the radio menu item when it is initially rendered. Use when not wanting to control its checked state.
|
|
278
|
-
|
|
279
|
-
- Required: no
|
|
280
|
-
|
|
281
|
-
##### `onChange`: `( event: React.ChangeEvent< HTMLInputElement > ) => void;`
|
|
282
|
-
|
|
283
|
-
Event handler called when the checked radio menu item changes.
|
|
284
|
-
|
|
285
|
-
- Required: no
|
|
286
|
-
|
|
287
|
-
### `DropdownMenuItemLabel`
|
|
288
|
-
|
|
289
|
-
Used to render the menu item's label.
|
|
290
|
-
|
|
291
|
-
#### Props
|
|
292
|
-
|
|
293
|
-
The component accepts the following props:
|
|
294
|
-
|
|
295
|
-
##### `children`: `React.ReactNode`
|
|
296
|
-
|
|
297
|
-
The label contents.
|
|
298
|
-
|
|
299
|
-
- Required: yes
|
|
300
|
-
|
|
301
|
-
### `DropdownMenuItemHelpText`
|
|
302
|
-
|
|
303
|
-
Used to render the menu item's help text.
|
|
304
|
-
|
|
305
|
-
#### Props
|
|
306
|
-
|
|
307
|
-
The component accepts the following props:
|
|
308
|
-
|
|
309
|
-
##### `children`: `React.ReactNode`
|
|
310
|
-
|
|
311
|
-
The help text contents.
|
|
312
|
-
|
|
313
|
-
- Required: yes
|
|
314
|
-
|
|
315
|
-
### `DropdownMenuGroup`
|
|
316
|
-
|
|
317
|
-
Used to group menu items.
|
|
318
|
-
|
|
319
|
-
#### Props
|
|
320
|
-
|
|
321
|
-
The component accepts the following props:
|
|
322
|
-
|
|
323
|
-
##### `children`: `React.ReactNode`
|
|
324
|
-
|
|
325
|
-
The contents of the group.
|
|
326
|
-
|
|
327
|
-
- Required: yes
|
|
328
|
-
|
|
329
|
-
### `DropdownMenuSeparatorProps`
|
|
330
|
-
|
|
331
|
-
Used to render a visual separator.
|
|
@@ -1,383 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
// eslint-disable-next-line no-restricted-imports
|
|
5
|
-
import * as Ariakit from '@ariakit/react';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* WordPress dependencies
|
|
9
|
-
*/
|
|
10
|
-
import {
|
|
11
|
-
forwardRef,
|
|
12
|
-
createContext,
|
|
13
|
-
useContext,
|
|
14
|
-
useMemo,
|
|
15
|
-
cloneElement,
|
|
16
|
-
isValidElement,
|
|
17
|
-
useCallback,
|
|
18
|
-
} from '@wordpress/element';
|
|
19
|
-
import { isRTL } from '@wordpress/i18n';
|
|
20
|
-
import { check, chevronRightSmall } from '@wordpress/icons';
|
|
21
|
-
import { SVG, Circle } from '@wordpress/primitives';
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Internal dependencies
|
|
25
|
-
*/
|
|
26
|
-
import { useContextSystem, contextConnect } from '../context';
|
|
27
|
-
import type { WordPressComponentProps } from '../context';
|
|
28
|
-
import Icon from '../icon';
|
|
29
|
-
import type {
|
|
30
|
-
DropdownMenuContext as DropdownMenuContextType,
|
|
31
|
-
DropdownMenuProps,
|
|
32
|
-
DropdownMenuGroupProps,
|
|
33
|
-
DropdownMenuItemProps,
|
|
34
|
-
DropdownMenuCheckboxItemProps,
|
|
35
|
-
DropdownMenuRadioItemProps,
|
|
36
|
-
DropdownMenuSeparatorProps,
|
|
37
|
-
} from './types';
|
|
38
|
-
import * as Styled from './styles';
|
|
39
|
-
|
|
40
|
-
export const DropdownMenuContext = createContext<
|
|
41
|
-
DropdownMenuContextType | undefined
|
|
42
|
-
>( undefined );
|
|
43
|
-
|
|
44
|
-
export const DropdownMenuItem = forwardRef<
|
|
45
|
-
HTMLDivElement,
|
|
46
|
-
WordPressComponentProps< DropdownMenuItemProps, 'div', false >
|
|
47
|
-
>( function DropdownMenuItem(
|
|
48
|
-
{ prefix, suffix, children, hideOnClick = true, ...props },
|
|
49
|
-
ref
|
|
50
|
-
) {
|
|
51
|
-
const dropdownMenuContext = useContext( DropdownMenuContext );
|
|
52
|
-
|
|
53
|
-
return (
|
|
54
|
-
<Styled.DropdownMenuItem
|
|
55
|
-
ref={ ref }
|
|
56
|
-
{ ...props }
|
|
57
|
-
accessibleWhenDisabled
|
|
58
|
-
hideOnClick={ hideOnClick }
|
|
59
|
-
store={ dropdownMenuContext?.store }
|
|
60
|
-
>
|
|
61
|
-
<Styled.ItemPrefixWrapper>{ prefix }</Styled.ItemPrefixWrapper>
|
|
62
|
-
|
|
63
|
-
<Styled.DropdownMenuItemContentWrapper>
|
|
64
|
-
<Styled.DropdownMenuItemChildrenWrapper>
|
|
65
|
-
{ children }
|
|
66
|
-
</Styled.DropdownMenuItemChildrenWrapper>
|
|
67
|
-
|
|
68
|
-
{ suffix && (
|
|
69
|
-
<Styled.ItemSuffixWrapper>
|
|
70
|
-
{ suffix }
|
|
71
|
-
</Styled.ItemSuffixWrapper>
|
|
72
|
-
) }
|
|
73
|
-
</Styled.DropdownMenuItemContentWrapper>
|
|
74
|
-
</Styled.DropdownMenuItem>
|
|
75
|
-
);
|
|
76
|
-
} );
|
|
77
|
-
|
|
78
|
-
export const DropdownMenuCheckboxItem = forwardRef<
|
|
79
|
-
HTMLDivElement,
|
|
80
|
-
WordPressComponentProps< DropdownMenuCheckboxItemProps, 'div', false >
|
|
81
|
-
>( function DropdownMenuCheckboxItem(
|
|
82
|
-
{ suffix, children, hideOnClick = false, ...props },
|
|
83
|
-
ref
|
|
84
|
-
) {
|
|
85
|
-
const dropdownMenuContext = useContext( DropdownMenuContext );
|
|
86
|
-
|
|
87
|
-
return (
|
|
88
|
-
<Styled.DropdownMenuCheckboxItem
|
|
89
|
-
ref={ ref }
|
|
90
|
-
{ ...props }
|
|
91
|
-
accessibleWhenDisabled
|
|
92
|
-
hideOnClick={ hideOnClick }
|
|
93
|
-
store={ dropdownMenuContext?.store }
|
|
94
|
-
>
|
|
95
|
-
<Ariakit.MenuItemCheck
|
|
96
|
-
store={ dropdownMenuContext?.store }
|
|
97
|
-
render={ <Styled.ItemPrefixWrapper /> }
|
|
98
|
-
// Override some ariakit inline styles
|
|
99
|
-
style={ { width: 'auto', height: 'auto' } }
|
|
100
|
-
>
|
|
101
|
-
<Icon icon={ check } size={ 24 } />
|
|
102
|
-
</Ariakit.MenuItemCheck>
|
|
103
|
-
|
|
104
|
-
<Styled.DropdownMenuItemContentWrapper>
|
|
105
|
-
<Styled.DropdownMenuItemChildrenWrapper>
|
|
106
|
-
{ children }
|
|
107
|
-
</Styled.DropdownMenuItemChildrenWrapper>
|
|
108
|
-
|
|
109
|
-
{ suffix && (
|
|
110
|
-
<Styled.ItemSuffixWrapper>
|
|
111
|
-
{ suffix }
|
|
112
|
-
</Styled.ItemSuffixWrapper>
|
|
113
|
-
) }
|
|
114
|
-
</Styled.DropdownMenuItemContentWrapper>
|
|
115
|
-
</Styled.DropdownMenuCheckboxItem>
|
|
116
|
-
);
|
|
117
|
-
} );
|
|
118
|
-
|
|
119
|
-
const radioCheck = (
|
|
120
|
-
<SVG xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
|
121
|
-
<Circle cx={ 12 } cy={ 12 } r={ 3 }></Circle>
|
|
122
|
-
</SVG>
|
|
123
|
-
);
|
|
124
|
-
|
|
125
|
-
export const DropdownMenuRadioItem = forwardRef<
|
|
126
|
-
HTMLDivElement,
|
|
127
|
-
WordPressComponentProps< DropdownMenuRadioItemProps, 'div', false >
|
|
128
|
-
>( function DropdownMenuRadioItem(
|
|
129
|
-
{ suffix, children, hideOnClick = false, ...props },
|
|
130
|
-
ref
|
|
131
|
-
) {
|
|
132
|
-
const dropdownMenuContext = useContext( DropdownMenuContext );
|
|
133
|
-
|
|
134
|
-
return (
|
|
135
|
-
<Styled.DropdownMenuRadioItem
|
|
136
|
-
ref={ ref }
|
|
137
|
-
{ ...props }
|
|
138
|
-
accessibleWhenDisabled
|
|
139
|
-
hideOnClick={ hideOnClick }
|
|
140
|
-
store={ dropdownMenuContext?.store }
|
|
141
|
-
>
|
|
142
|
-
<Ariakit.MenuItemCheck
|
|
143
|
-
store={ dropdownMenuContext?.store }
|
|
144
|
-
render={ <Styled.ItemPrefixWrapper /> }
|
|
145
|
-
// Override some ariakit inline styles
|
|
146
|
-
style={ { width: 'auto', height: 'auto' } }
|
|
147
|
-
>
|
|
148
|
-
<Icon icon={ radioCheck } size={ 24 } />
|
|
149
|
-
</Ariakit.MenuItemCheck>
|
|
150
|
-
|
|
151
|
-
<Styled.DropdownMenuItemContentWrapper>
|
|
152
|
-
<Styled.DropdownMenuItemChildrenWrapper>
|
|
153
|
-
{ children }
|
|
154
|
-
</Styled.DropdownMenuItemChildrenWrapper>
|
|
155
|
-
|
|
156
|
-
{ suffix && (
|
|
157
|
-
<Styled.ItemSuffixWrapper>
|
|
158
|
-
{ suffix }
|
|
159
|
-
</Styled.ItemSuffixWrapper>
|
|
160
|
-
) }
|
|
161
|
-
</Styled.DropdownMenuItemContentWrapper>
|
|
162
|
-
</Styled.DropdownMenuRadioItem>
|
|
163
|
-
);
|
|
164
|
-
} );
|
|
165
|
-
|
|
166
|
-
export const DropdownMenuGroup = forwardRef<
|
|
167
|
-
HTMLDivElement,
|
|
168
|
-
WordPressComponentProps< DropdownMenuGroupProps, 'div', false >
|
|
169
|
-
>( function DropdownMenuGroup( props, ref ) {
|
|
170
|
-
const dropdownMenuContext = useContext( DropdownMenuContext );
|
|
171
|
-
return (
|
|
172
|
-
<Styled.DropdownMenuGroup
|
|
173
|
-
ref={ ref }
|
|
174
|
-
{ ...props }
|
|
175
|
-
store={ dropdownMenuContext?.store }
|
|
176
|
-
/>
|
|
177
|
-
);
|
|
178
|
-
} );
|
|
179
|
-
|
|
180
|
-
const UnconnectedDropdownMenu = (
|
|
181
|
-
props: WordPressComponentProps< DropdownMenuProps, 'div', false >,
|
|
182
|
-
ref: React.ForwardedRef< HTMLDivElement >
|
|
183
|
-
) => {
|
|
184
|
-
const {
|
|
185
|
-
// Store props
|
|
186
|
-
open,
|
|
187
|
-
defaultOpen = false,
|
|
188
|
-
onOpenChange,
|
|
189
|
-
placement,
|
|
190
|
-
|
|
191
|
-
// Menu trigger props
|
|
192
|
-
trigger,
|
|
193
|
-
|
|
194
|
-
// Menu props
|
|
195
|
-
gutter,
|
|
196
|
-
children,
|
|
197
|
-
shift,
|
|
198
|
-
modal = true,
|
|
199
|
-
|
|
200
|
-
// From internal components context
|
|
201
|
-
variant,
|
|
202
|
-
|
|
203
|
-
// Rest
|
|
204
|
-
...otherProps
|
|
205
|
-
} = useContextSystem<
|
|
206
|
-
typeof props & Pick< DropdownMenuContextType, 'variant' >
|
|
207
|
-
>( props, 'DropdownMenu' );
|
|
208
|
-
|
|
209
|
-
const parentContext = useContext( DropdownMenuContext );
|
|
210
|
-
|
|
211
|
-
const computedDirection = isRTL() ? 'rtl' : 'ltr';
|
|
212
|
-
|
|
213
|
-
// If an explicit value for the `placement` prop is not passed,
|
|
214
|
-
// apply a default placement of `bottom-start` for the root dropdown,
|
|
215
|
-
// and of `right-start` for nested dropdowns.
|
|
216
|
-
let computedPlacement =
|
|
217
|
-
props.placement ??
|
|
218
|
-
( parentContext?.store ? 'right-start' : 'bottom-start' );
|
|
219
|
-
// Swap left/right in case of RTL direction
|
|
220
|
-
if ( computedDirection === 'rtl' ) {
|
|
221
|
-
if ( /right/.test( computedPlacement ) ) {
|
|
222
|
-
computedPlacement = computedPlacement.replace(
|
|
223
|
-
'right',
|
|
224
|
-
'left'
|
|
225
|
-
) as typeof computedPlacement;
|
|
226
|
-
} else if ( /left/.test( computedPlacement ) ) {
|
|
227
|
-
computedPlacement = computedPlacement.replace(
|
|
228
|
-
'left',
|
|
229
|
-
'right'
|
|
230
|
-
) as typeof computedPlacement;
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
const dropdownMenuStore = Ariakit.useMenuStore( {
|
|
235
|
-
parent: parentContext?.store,
|
|
236
|
-
open,
|
|
237
|
-
defaultOpen,
|
|
238
|
-
placement: computedPlacement,
|
|
239
|
-
focusLoop: true,
|
|
240
|
-
setOpen( willBeOpen ) {
|
|
241
|
-
onOpenChange?.( willBeOpen );
|
|
242
|
-
},
|
|
243
|
-
rtl: computedDirection === 'rtl',
|
|
244
|
-
} );
|
|
245
|
-
|
|
246
|
-
const contextValue = useMemo(
|
|
247
|
-
() => ( { store: dropdownMenuStore, variant } ),
|
|
248
|
-
[ dropdownMenuStore, variant ]
|
|
249
|
-
);
|
|
250
|
-
|
|
251
|
-
// Extract the side from the applied placement — useful for animations.
|
|
252
|
-
const appliedPlacementSide = dropdownMenuStore
|
|
253
|
-
.useState( 'placement' )
|
|
254
|
-
.split( '-' )[ 0 ];
|
|
255
|
-
|
|
256
|
-
if (
|
|
257
|
-
dropdownMenuStore.parent &&
|
|
258
|
-
! ( isValidElement( trigger ) && DropdownMenuItem === trigger.type )
|
|
259
|
-
) {
|
|
260
|
-
// eslint-disable-next-line no-console
|
|
261
|
-
console.warn(
|
|
262
|
-
'For nested DropdownMenus, the `trigger` should always be a `DropdownMenuItem`.'
|
|
263
|
-
);
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
const hideOnEscape = useCallback(
|
|
267
|
-
( event: React.KeyboardEvent< Element > ) => {
|
|
268
|
-
// Pressing Escape can cause unexpected consequences (ie. exiting
|
|
269
|
-
// full screen mode on MacOs, close parent modals...).
|
|
270
|
-
event.preventDefault();
|
|
271
|
-
// Returning `true` causes the menu to hide.
|
|
272
|
-
return true;
|
|
273
|
-
},
|
|
274
|
-
[]
|
|
275
|
-
);
|
|
276
|
-
|
|
277
|
-
const wrapperProps = useMemo(
|
|
278
|
-
() => ( {
|
|
279
|
-
dir: computedDirection,
|
|
280
|
-
style: {
|
|
281
|
-
direction:
|
|
282
|
-
computedDirection as React.CSSProperties[ 'direction' ],
|
|
283
|
-
},
|
|
284
|
-
} ),
|
|
285
|
-
[ computedDirection ]
|
|
286
|
-
);
|
|
287
|
-
|
|
288
|
-
return (
|
|
289
|
-
<>
|
|
290
|
-
{ /* Menu trigger */ }
|
|
291
|
-
<Ariakit.MenuButton
|
|
292
|
-
ref={ ref }
|
|
293
|
-
store={ dropdownMenuStore }
|
|
294
|
-
render={
|
|
295
|
-
dropdownMenuStore.parent
|
|
296
|
-
? cloneElement( trigger, {
|
|
297
|
-
// Add submenu arrow, unless a `suffix` is explicitly specified
|
|
298
|
-
suffix: (
|
|
299
|
-
<>
|
|
300
|
-
{ trigger.props.suffix }
|
|
301
|
-
<Styled.SubmenuChevronIcon
|
|
302
|
-
aria-hidden="true"
|
|
303
|
-
icon={ chevronRightSmall }
|
|
304
|
-
size={ 24 }
|
|
305
|
-
preserveAspectRatio="xMidYMid slice"
|
|
306
|
-
/>
|
|
307
|
-
</>
|
|
308
|
-
),
|
|
309
|
-
} )
|
|
310
|
-
: trigger
|
|
311
|
-
}
|
|
312
|
-
/>
|
|
313
|
-
|
|
314
|
-
{ /* Menu popover */ }
|
|
315
|
-
<Styled.DropdownMenu
|
|
316
|
-
{ ...otherProps }
|
|
317
|
-
modal={ modal }
|
|
318
|
-
store={ dropdownMenuStore }
|
|
319
|
-
// Root menu has an 8px distance from its trigger,
|
|
320
|
-
// otherwise 0 (which causes the submenu to slightly overlap)
|
|
321
|
-
gutter={ gutter ?? ( dropdownMenuStore.parent ? 0 : 8 ) }
|
|
322
|
-
// Align nested menu by the same (but opposite) amount
|
|
323
|
-
// as the menu container's padding.
|
|
324
|
-
shift={ shift ?? ( dropdownMenuStore.parent ? -4 : 0 ) }
|
|
325
|
-
hideOnHoverOutside={ false }
|
|
326
|
-
data-side={ appliedPlacementSide }
|
|
327
|
-
variant={ variant }
|
|
328
|
-
wrapperProps={ wrapperProps }
|
|
329
|
-
hideOnEscape={ hideOnEscape }
|
|
330
|
-
unmountOnHide
|
|
331
|
-
>
|
|
332
|
-
<DropdownMenuContext.Provider value={ contextValue }>
|
|
333
|
-
{ children }
|
|
334
|
-
</DropdownMenuContext.Provider>
|
|
335
|
-
</Styled.DropdownMenu>
|
|
336
|
-
</>
|
|
337
|
-
);
|
|
338
|
-
};
|
|
339
|
-
export const DropdownMenu = contextConnect(
|
|
340
|
-
UnconnectedDropdownMenu,
|
|
341
|
-
'DropdownMenu'
|
|
342
|
-
);
|
|
343
|
-
|
|
344
|
-
export const DropdownMenuSeparator = forwardRef<
|
|
345
|
-
HTMLHRElement,
|
|
346
|
-
WordPressComponentProps< DropdownMenuSeparatorProps, 'hr', false >
|
|
347
|
-
>( function DropdownMenuSeparator( props, ref ) {
|
|
348
|
-
const dropdownMenuContext = useContext( DropdownMenuContext );
|
|
349
|
-
return (
|
|
350
|
-
<Styled.DropdownMenuSeparator
|
|
351
|
-
ref={ ref }
|
|
352
|
-
{ ...props }
|
|
353
|
-
store={ dropdownMenuContext?.store }
|
|
354
|
-
variant={ dropdownMenuContext?.variant }
|
|
355
|
-
/>
|
|
356
|
-
);
|
|
357
|
-
} );
|
|
358
|
-
|
|
359
|
-
export const DropdownMenuItemLabel = forwardRef<
|
|
360
|
-
HTMLSpanElement,
|
|
361
|
-
WordPressComponentProps< { children: React.ReactNode }, 'span', true >
|
|
362
|
-
>( function DropdownMenuItemLabel( props, ref ) {
|
|
363
|
-
return (
|
|
364
|
-
<Styled.DropdownMenuItemLabel
|
|
365
|
-
numberOfLines={ 1 }
|
|
366
|
-
ref={ ref }
|
|
367
|
-
{ ...props }
|
|
368
|
-
/>
|
|
369
|
-
);
|
|
370
|
-
} );
|
|
371
|
-
|
|
372
|
-
export const DropdownMenuItemHelpText = forwardRef<
|
|
373
|
-
HTMLSpanElement,
|
|
374
|
-
WordPressComponentProps< { children: React.ReactNode }, 'span', true >
|
|
375
|
-
>( function DropdownMenuItemHelpText( props, ref ) {
|
|
376
|
-
return (
|
|
377
|
-
<Styled.DropdownMenuItemHelpText
|
|
378
|
-
numberOfLines={ 2 }
|
|
379
|
-
ref={ ref }
|
|
380
|
-
{ ...props }
|
|
381
|
-
/>
|
|
382
|
-
);
|
|
383
|
-
} );
|