@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
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import type { ForwardedRef } from 'react';
|
|
5
|
-
import { css } from '@emotion/react';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* WordPress dependencies
|
|
@@ -23,15 +22,16 @@ import isShallowEqual from '@wordpress/is-shallow-equal';
|
|
|
23
22
|
import type { WordPressComponentProps } from '../../context';
|
|
24
23
|
import { contextConnect, useContextSystem } from '../../context';
|
|
25
24
|
import { useCx } from '../../utils/hooks/use-cx';
|
|
25
|
+
import { patternMatch, findParent } from '../utils/router';
|
|
26
26
|
import { View } from '../../view';
|
|
27
27
|
import { NavigatorContext } from '../context';
|
|
28
|
+
import * as styles from '../styles';
|
|
28
29
|
import type {
|
|
29
30
|
NavigatorProviderProps,
|
|
30
31
|
NavigatorLocation,
|
|
31
32
|
NavigatorContext as NavigatorContextType,
|
|
32
33
|
Screen,
|
|
33
34
|
} from '../types';
|
|
34
|
-
import { patternMatch, findParent } from '../utils/router';
|
|
35
35
|
|
|
36
36
|
type MatchedPath = ReturnType< typeof patternMatch >;
|
|
37
37
|
type ScreenAction = { type: string; screen: Screen };
|
|
@@ -248,8 +248,7 @@ function UnconnectedNavigatorProvider(
|
|
|
248
248
|
|
|
249
249
|
const cx = useCx();
|
|
250
250
|
const classes = useMemo(
|
|
251
|
-
|
|
252
|
-
() => cx( css( { overflowX: 'hidden' } ), className ),
|
|
251
|
+
() => cx( styles.navigatorProviderWrapper, className ),
|
|
253
252
|
[ className, cx ]
|
|
254
253
|
);
|
|
255
254
|
|
|
@@ -2,11 +2,6 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import type { ForwardedRef } from 'react';
|
|
5
|
-
// eslint-disable-next-line no-restricted-imports
|
|
6
|
-
import type { MotionProps } from 'framer-motion';
|
|
7
|
-
// eslint-disable-next-line no-restricted-imports
|
|
8
|
-
import { motion } from 'framer-motion';
|
|
9
|
-
import { css } from '@emotion/react';
|
|
10
5
|
|
|
11
6
|
/**
|
|
12
7
|
* WordPress dependencies
|
|
@@ -19,8 +14,8 @@ import {
|
|
|
19
14
|
useRef,
|
|
20
15
|
useId,
|
|
21
16
|
} from '@wordpress/element';
|
|
22
|
-
import {
|
|
23
|
-
import { isRTL } from '@wordpress/i18n';
|
|
17
|
+
import { useMergeRefs } from '@wordpress/compose';
|
|
18
|
+
import { isRTL as isRTLFn } from '@wordpress/i18n';
|
|
24
19
|
import { escapeAttribute } from '@wordpress/escape-html';
|
|
25
20
|
|
|
26
21
|
/**
|
|
@@ -31,22 +26,11 @@ import { contextConnect, useContextSystem } from '../../context';
|
|
|
31
26
|
import { useCx } from '../../utils/hooks/use-cx';
|
|
32
27
|
import { View } from '../../view';
|
|
33
28
|
import { NavigatorContext } from '../context';
|
|
29
|
+
import * as styles from '../styles';
|
|
34
30
|
import type { NavigatorScreenProps } from '../types';
|
|
35
31
|
|
|
36
|
-
const animationEnterDelay = 0;
|
|
37
|
-
const animationEnterDuration = 0.14;
|
|
38
|
-
const animationExitDuration = 0.14;
|
|
39
|
-
const animationExitDelay = 0;
|
|
40
|
-
|
|
41
|
-
// Props specific to `framer-motion` can't be currently passed to `NavigatorScreen`,
|
|
42
|
-
// as some of them would overlap with HTML props (e.g. `onAnimationStart`, ...)
|
|
43
|
-
type Props = Omit<
|
|
44
|
-
WordPressComponentProps< NavigatorScreenProps, 'div', false >,
|
|
45
|
-
Exclude< keyof MotionProps, 'style' | 'children' >
|
|
46
|
-
>;
|
|
47
|
-
|
|
48
32
|
function UnconnectedNavigatorScreen(
|
|
49
|
-
props:
|
|
33
|
+
props: WordPressComponentProps< NavigatorScreenProps, 'div', false >,
|
|
50
34
|
forwardedRef: ForwardedRef< any >
|
|
51
35
|
) {
|
|
52
36
|
const screenId = useId();
|
|
@@ -55,7 +39,6 @@ function UnconnectedNavigatorScreen(
|
|
|
55
39
|
'NavigatorScreen'
|
|
56
40
|
);
|
|
57
41
|
|
|
58
|
-
const prefersReducedMotion = useReducedMotion();
|
|
59
42
|
const { location, match, addScreen, removeScreen } =
|
|
60
43
|
useContext( NavigatorContext );
|
|
61
44
|
const isMatch = match === screenId;
|
|
@@ -70,19 +53,20 @@ function UnconnectedNavigatorScreen(
|
|
|
70
53
|
return () => removeScreen( screen );
|
|
71
54
|
}, [ screenId, path, addScreen, removeScreen ] );
|
|
72
55
|
|
|
56
|
+
const isRTL = isRTLFn();
|
|
57
|
+
const { isInitial, isBack } = location;
|
|
73
58
|
const cx = useCx();
|
|
74
59
|
const classes = useMemo(
|
|
75
60
|
() =>
|
|
76
61
|
cx(
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
maxHeight: '100%',
|
|
62
|
+
styles.navigatorScreen( {
|
|
63
|
+
isInitial,
|
|
64
|
+
isBack,
|
|
65
|
+
isRTL,
|
|
82
66
|
} ),
|
|
83
67
|
className
|
|
84
68
|
),
|
|
85
|
-
[ className, cx ]
|
|
69
|
+
[ className, cx, isInitial, isBack, isRTL ]
|
|
86
70
|
);
|
|
87
71
|
|
|
88
72
|
const locationRef = useRef( location );
|
|
@@ -149,73 +133,11 @@ function UnconnectedNavigatorScreen(
|
|
|
149
133
|
|
|
150
134
|
const mergedWrapperRef = useMergeRefs( [ forwardedRef, wrapperRef ] );
|
|
151
135
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
if ( prefersReducedMotion ) {
|
|
157
|
-
return (
|
|
158
|
-
<View
|
|
159
|
-
ref={ mergedWrapperRef }
|
|
160
|
-
className={ classes }
|
|
161
|
-
{ ...otherProps }
|
|
162
|
-
>
|
|
163
|
-
{ children }
|
|
164
|
-
</View>
|
|
165
|
-
);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
const animate = {
|
|
169
|
-
opacity: 1,
|
|
170
|
-
transition: {
|
|
171
|
-
delay: animationEnterDelay,
|
|
172
|
-
duration: animationEnterDuration,
|
|
173
|
-
ease: 'easeInOut',
|
|
174
|
-
},
|
|
175
|
-
x: 0,
|
|
176
|
-
};
|
|
177
|
-
// Disable the initial animation if the screen is the very first screen to be
|
|
178
|
-
// rendered within the current `NavigatorProvider`.
|
|
179
|
-
const initial =
|
|
180
|
-
location.isInitial && ! location.isBack
|
|
181
|
-
? false
|
|
182
|
-
: {
|
|
183
|
-
opacity: 0,
|
|
184
|
-
x:
|
|
185
|
-
( isRTL() && location.isBack ) ||
|
|
186
|
-
( ! isRTL() && ! location.isBack )
|
|
187
|
-
? 50
|
|
188
|
-
: -50,
|
|
189
|
-
};
|
|
190
|
-
const exit = {
|
|
191
|
-
delay: animationExitDelay,
|
|
192
|
-
opacity: 0,
|
|
193
|
-
x:
|
|
194
|
-
( ! isRTL() && location.isBack ) || ( isRTL() && ! location.isBack )
|
|
195
|
-
? 50
|
|
196
|
-
: -50,
|
|
197
|
-
transition: {
|
|
198
|
-
duration: animationExitDuration,
|
|
199
|
-
ease: 'easeInOut',
|
|
200
|
-
},
|
|
201
|
-
};
|
|
202
|
-
|
|
203
|
-
const animatedProps = {
|
|
204
|
-
animate,
|
|
205
|
-
exit,
|
|
206
|
-
initial,
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
return (
|
|
210
|
-
<motion.div
|
|
211
|
-
ref={ mergedWrapperRef }
|
|
212
|
-
className={ classes }
|
|
213
|
-
{ ...otherProps }
|
|
214
|
-
{ ...animatedProps }
|
|
215
|
-
>
|
|
136
|
+
return isMatch ? (
|
|
137
|
+
<View ref={ mergedWrapperRef } className={ classes } { ...otherProps }>
|
|
216
138
|
{ children }
|
|
217
|
-
</
|
|
218
|
-
);
|
|
139
|
+
</View>
|
|
140
|
+
) : null;
|
|
219
141
|
}
|
|
220
142
|
|
|
221
143
|
/**
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { css, keyframes } from '@emotion/react';
|
|
5
|
+
|
|
6
|
+
export const navigatorProviderWrapper = css`
|
|
7
|
+
/* Prevents horizontal overflow while animating screen transitions */
|
|
8
|
+
overflow-x: hidden;
|
|
9
|
+
/* Mark this subsection of the DOM as isolated, providing performance benefits
|
|
10
|
+
* by limiting calculations of layout, style and paint to a DOM subtree rather
|
|
11
|
+
* than the entire page.
|
|
12
|
+
*/
|
|
13
|
+
contain: content;
|
|
14
|
+
`;
|
|
15
|
+
|
|
16
|
+
const fadeInFromRight = keyframes( {
|
|
17
|
+
'0%': {
|
|
18
|
+
opacity: 0,
|
|
19
|
+
transform: `translateX( 50px )`,
|
|
20
|
+
},
|
|
21
|
+
'100%': { opacity: 1, transform: 'none' },
|
|
22
|
+
} );
|
|
23
|
+
|
|
24
|
+
const fadeInFromLeft = keyframes( {
|
|
25
|
+
'0%': {
|
|
26
|
+
opacity: 0,
|
|
27
|
+
transform: `translateX( -50px )`,
|
|
28
|
+
},
|
|
29
|
+
'100%': { opacity: 1, transform: 'none' },
|
|
30
|
+
} );
|
|
31
|
+
|
|
32
|
+
type NavigatorScreenAnimationProps = {
|
|
33
|
+
isInitial?: boolean;
|
|
34
|
+
isBack?: boolean;
|
|
35
|
+
isRTL: boolean;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const navigatorScreenAnimation = ( {
|
|
39
|
+
isInitial,
|
|
40
|
+
isBack,
|
|
41
|
+
isRTL,
|
|
42
|
+
}: NavigatorScreenAnimationProps ) => {
|
|
43
|
+
if ( isInitial && ! isBack ) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const animationName =
|
|
48
|
+
( isRTL && isBack ) || ( ! isRTL && ! isBack )
|
|
49
|
+
? fadeInFromRight
|
|
50
|
+
: fadeInFromLeft;
|
|
51
|
+
|
|
52
|
+
return css`
|
|
53
|
+
animation-duration: 0.14s;
|
|
54
|
+
animation-timing-function: ease-in-out;
|
|
55
|
+
will-change: transform, opacity;
|
|
56
|
+
animation-name: ${ animationName };
|
|
57
|
+
|
|
58
|
+
@media ( prefers-reduced-motion ) {
|
|
59
|
+
animation-duration: 0s;
|
|
60
|
+
}
|
|
61
|
+
`;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export const navigatorScreen = ( props: NavigatorScreenAnimationProps ) => css`
|
|
65
|
+
/* Ensures horizontal overflow is visually accessible */
|
|
66
|
+
overflow-x: auto;
|
|
67
|
+
/* In case the root has a height, it should not be exceeded */
|
|
68
|
+
max-height: 100%;
|
|
69
|
+
|
|
70
|
+
${ navigatorScreenAnimation( props ) }
|
|
71
|
+
`;
|
|
@@ -769,68 +769,4 @@ describe( 'Navigator', () => {
|
|
|
769
769
|
).toHaveFocus();
|
|
770
770
|
} );
|
|
771
771
|
} );
|
|
772
|
-
|
|
773
|
-
describe( 'animation', () => {
|
|
774
|
-
it( 'should not animate the initial screen', async () => {
|
|
775
|
-
const onHomeAnimationStartSpy = jest.fn();
|
|
776
|
-
|
|
777
|
-
render(
|
|
778
|
-
<NavigatorProvider initialPath="/">
|
|
779
|
-
<NavigatorScreen
|
|
780
|
-
path="/"
|
|
781
|
-
onAnimationStart={ onHomeAnimationStartSpy }
|
|
782
|
-
>
|
|
783
|
-
<CustomNavigatorButton path="/child">
|
|
784
|
-
To child
|
|
785
|
-
</CustomNavigatorButton>
|
|
786
|
-
</NavigatorScreen>
|
|
787
|
-
</NavigatorProvider>
|
|
788
|
-
);
|
|
789
|
-
|
|
790
|
-
expect( onHomeAnimationStartSpy ).not.toHaveBeenCalled();
|
|
791
|
-
} );
|
|
792
|
-
|
|
793
|
-
it( 'should animate all other screens (including the initial screen when navigating back)', async () => {
|
|
794
|
-
const user = userEvent.setup();
|
|
795
|
-
|
|
796
|
-
const onHomeAnimationStartSpy = jest.fn();
|
|
797
|
-
const onChildAnimationStartSpy = jest.fn();
|
|
798
|
-
|
|
799
|
-
render(
|
|
800
|
-
<NavigatorProvider initialPath="/">
|
|
801
|
-
<NavigatorScreen
|
|
802
|
-
path="/"
|
|
803
|
-
onAnimationStart={ onHomeAnimationStartSpy }
|
|
804
|
-
>
|
|
805
|
-
<CustomNavigatorButton path="/child">
|
|
806
|
-
To child
|
|
807
|
-
</CustomNavigatorButton>
|
|
808
|
-
</NavigatorScreen>
|
|
809
|
-
<NavigatorScreen
|
|
810
|
-
path="/child"
|
|
811
|
-
onAnimationStart={ onChildAnimationStartSpy }
|
|
812
|
-
>
|
|
813
|
-
<CustomNavigatorBackButton>
|
|
814
|
-
Back to home
|
|
815
|
-
</CustomNavigatorBackButton>
|
|
816
|
-
</NavigatorScreen>
|
|
817
|
-
</NavigatorProvider>
|
|
818
|
-
);
|
|
819
|
-
|
|
820
|
-
expect( onHomeAnimationStartSpy ).not.toHaveBeenCalled();
|
|
821
|
-
expect( onChildAnimationStartSpy ).not.toHaveBeenCalled();
|
|
822
|
-
|
|
823
|
-
await user.click(
|
|
824
|
-
screen.getByRole( 'button', { name: 'To child' } )
|
|
825
|
-
);
|
|
826
|
-
expect( onChildAnimationStartSpy ).toHaveBeenCalledTimes( 1 );
|
|
827
|
-
expect( onHomeAnimationStartSpy ).not.toHaveBeenCalled();
|
|
828
|
-
|
|
829
|
-
await user.click(
|
|
830
|
-
screen.getByRole( 'button', { name: 'Back to home' } )
|
|
831
|
-
);
|
|
832
|
-
expect( onChildAnimationStartSpy ).toHaveBeenCalledTimes( 1 );
|
|
833
|
-
expect( onHomeAnimationStartSpy ).toHaveBeenCalledTimes( 1 );
|
|
834
|
-
} );
|
|
835
|
-
} );
|
|
836
772
|
} );
|
package/src/notice/README.md
CHANGED
|
@@ -4,12 +4,6 @@ Use Notices to communicate prominent messages to the user.
|
|
|
4
4
|
|
|
5
5
|

|
|
6
6
|
|
|
7
|
-
## Table of contents
|
|
8
|
-
|
|
9
|
-
1. [Design guidelines](#design-guidelines)
|
|
10
|
-
2. [Development guidelines](#development-guidelines)
|
|
11
|
-
3. [Related components](#related-components)
|
|
12
|
-
|
|
13
7
|
## Design guidelines
|
|
14
8
|
|
|
15
9
|
A Notice displays a succinct message. It can also offer the user options, like viewing a published post or updating a setting, and requires a user action to be dismissed.
|
|
@@ -46,9 +46,9 @@ If `isDragEnabled` is true, this controls the amount of `px` to have been dragge
|
|
|
46
46
|
|
|
47
47
|
### spinControls
|
|
48
48
|
|
|
49
|
-
The type of spin controls to display. These are
|
|
49
|
+
The type of spin controls to display. These are buttons that allow the user to
|
|
50
50
|
quickly increment and decrement the number.
|
|
51
|
-
|
|
51
|
+
|
|
52
52
|
- 'none' - Do not show spin controls.
|
|
53
53
|
- 'native' - Use browser's native HTML `input` controls.
|
|
54
54
|
- 'custom' - Use plus and minus icon buttons.
|
|
@@ -246,10 +246,8 @@ function UnforwardedNumberControl(
|
|
|
246
246
|
<SpinButton
|
|
247
247
|
className={ spinButtonClasses }
|
|
248
248
|
icon={ plusIcon }
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
aria-label={ __( 'Increment' ) }
|
|
252
|
-
tabIndex={ -1 }
|
|
249
|
+
size="small"
|
|
250
|
+
label={ __( 'Increment' ) }
|
|
253
251
|
onClick={ buildSpinButtonClickHandler(
|
|
254
252
|
'up'
|
|
255
253
|
) }
|
|
@@ -257,10 +255,8 @@ function UnforwardedNumberControl(
|
|
|
257
255
|
<SpinButton
|
|
258
256
|
className={ spinButtonClasses }
|
|
259
257
|
icon={ resetIcon }
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
aria-label={ __( 'Decrement' ) }
|
|
263
|
-
tabIndex={ -1 }
|
|
258
|
+
size="small"
|
|
259
|
+
label={ __( 'Decrement' ) }
|
|
264
260
|
onClick={ buildSpinButtonClickHandler(
|
|
265
261
|
'down'
|
|
266
262
|
) }
|
|
@@ -15,7 +15,7 @@ export type NumberControlProps = Omit<
|
|
|
15
15
|
*/
|
|
16
16
|
hideHTMLArrows?: boolean;
|
|
17
17
|
/**
|
|
18
|
-
* The type of spin controls to display. These are
|
|
18
|
+
* The type of spin controls to display. These are buttons that allow the
|
|
19
19
|
* user to quickly increment and decrement the number.
|
|
20
20
|
*
|
|
21
21
|
* - 'none' - Do not show spin controls.
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import classnames from 'classnames';
|
|
5
|
-
import { paramCase as kebabCase } from 'change-case';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* WordPress dependencies
|
|
@@ -49,6 +48,7 @@ import {
|
|
|
49
48
|
import { NavigableMenu } from '../navigable-container';
|
|
50
49
|
import { DEFAULT_GRADIENT } from '../custom-gradient-picker/constants';
|
|
51
50
|
import CustomGradientPicker from '../custom-gradient-picker';
|
|
51
|
+
import { kebabCase } from '../utils/strings';
|
|
52
52
|
import type {
|
|
53
53
|
Color,
|
|
54
54
|
ColorPickerPopoverProps,
|
|
@@ -60,7 +60,7 @@ import type {
|
|
|
60
60
|
PaletteElement,
|
|
61
61
|
} from './types';
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
const DEFAULT_COLOR = '#000';
|
|
64
64
|
|
|
65
65
|
function NameInput( { value, onChange, label }: NameInputProps ) {
|
|
66
66
|
return (
|
|
@@ -74,8 +74,8 @@ function NameInput( { value, onChange, label }: NameInputProps ) {
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
/**
|
|
77
|
-
* Returns a
|
|
78
|
-
* To ensure there are no duplicate ids, this function checks all slugs
|
|
77
|
+
* Returns a name for a palette item in the format "Color + id".
|
|
78
|
+
* To ensure there are no duplicate ids, this function checks all slugs.
|
|
79
79
|
* It expects slugs to be in the format: slugPrefix + color- + number.
|
|
80
80
|
* It then sets the id component of the new name based on the incremented id of the highest existing slug id.
|
|
81
81
|
*
|
|
@@ -88,10 +88,10 @@ export function getNameForPosition(
|
|
|
88
88
|
elements: PaletteElement[],
|
|
89
89
|
slugPrefix: string
|
|
90
90
|
) {
|
|
91
|
-
const
|
|
91
|
+
const nameRegex = new RegExp( `^${ slugPrefix }color-([\\d]+)$` );
|
|
92
92
|
const position = elements.reduce( ( previousValue, currentValue ) => {
|
|
93
93
|
if ( typeof currentValue?.slug === 'string' ) {
|
|
94
|
-
const matches = currentValue?.slug.match(
|
|
94
|
+
const matches = currentValue?.slug.match( nameRegex );
|
|
95
95
|
if ( matches ) {
|
|
96
96
|
const id = parseInt( matches[ 1 ], 10 );
|
|
97
97
|
if ( id >= previousValue ) {
|
|
@@ -103,7 +103,7 @@ export function getNameForPosition(
|
|
|
103
103
|
}, 1 );
|
|
104
104
|
|
|
105
105
|
return sprintf(
|
|
106
|
-
/* translators: %s: is
|
|
106
|
+
/* translators: %s: is an id for a custom color */
|
|
107
107
|
__( 'Color %s' ),
|
|
108
108
|
position
|
|
109
109
|
);
|
|
@@ -241,7 +241,7 @@ function Option< T extends Color | Gradient >( {
|
|
|
241
241
|
{ isEditing && ! canOnlyChangeValues && (
|
|
242
242
|
<FlexItem>
|
|
243
243
|
<RemoveButton
|
|
244
|
-
|
|
244
|
+
size="small"
|
|
245
245
|
icon={ lineSolid }
|
|
246
246
|
label={ __( 'Remove color' ) }
|
|
247
247
|
onClick={ onRemove }
|
|
@@ -261,32 +261,6 @@ function Option< T extends Color | Gradient >( {
|
|
|
261
261
|
);
|
|
262
262
|
}
|
|
263
263
|
|
|
264
|
-
/**
|
|
265
|
-
* Checks if a color or gradient is a temporary element by testing against default values.
|
|
266
|
-
*/
|
|
267
|
-
export function isTemporaryElement(
|
|
268
|
-
slugPrefix: string,
|
|
269
|
-
{ slug, color, gradient }: Color | Gradient
|
|
270
|
-
): Boolean {
|
|
271
|
-
const regex = new RegExp( `^${ slugPrefix }color-([\\d]+)$` );
|
|
272
|
-
|
|
273
|
-
// If the slug matches the temporary name regex,
|
|
274
|
-
// check if the color or gradient matches the default value.
|
|
275
|
-
if ( regex.test( slug ) ) {
|
|
276
|
-
// The order is important as gradient elements
|
|
277
|
-
// contain a color property.
|
|
278
|
-
if ( !! gradient ) {
|
|
279
|
-
return gradient === DEFAULT_GRADIENT;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
if ( !! color ) {
|
|
283
|
-
return color === DEFAULT_COLOR;
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
return false;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
264
|
function PaletteEditListView< T extends Color | Gradient >( {
|
|
291
265
|
elements,
|
|
292
266
|
onChange,
|
|
@@ -302,23 +276,6 @@ function PaletteEditListView< T extends Color | Gradient >( {
|
|
|
302
276
|
useEffect( () => {
|
|
303
277
|
elementsReference.current = elements;
|
|
304
278
|
}, [ elements ] );
|
|
305
|
-
useEffect( () => {
|
|
306
|
-
return () => {
|
|
307
|
-
if (
|
|
308
|
-
elementsReference.current?.some( ( element ) =>
|
|
309
|
-
isTemporaryElement( slugPrefix, element )
|
|
310
|
-
)
|
|
311
|
-
) {
|
|
312
|
-
const newElements = elementsReference.current.filter(
|
|
313
|
-
( element ) => ! isTemporaryElement( slugPrefix, element )
|
|
314
|
-
);
|
|
315
|
-
onChange( newElements.length ? newElements : undefined );
|
|
316
|
-
}
|
|
317
|
-
};
|
|
318
|
-
// Disable reason: adding the missing dependency here would cause breaking changes that will require
|
|
319
|
-
// a heavier refactor to avoid. See https://github.com/WordPress/gutenberg/pull/43911
|
|
320
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
321
|
-
}, [] );
|
|
322
279
|
|
|
323
280
|
const debounceOnChange = useDebounce( onChange, 100 );
|
|
324
281
|
|
|
@@ -454,7 +411,7 @@ export function PaletteEdit( {
|
|
|
454
411
|
<PaletteActionsContainer>
|
|
455
412
|
{ hasElements && isEditing && (
|
|
456
413
|
<DoneButton
|
|
457
|
-
|
|
414
|
+
size="small"
|
|
458
415
|
onClick={ () => {
|
|
459
416
|
setIsEditing( false );
|
|
460
417
|
setEditingElement( null );
|
|
@@ -465,7 +422,7 @@ export function PaletteEdit( {
|
|
|
465
422
|
) }
|
|
466
423
|
{ ! canOnlyChangeValues && (
|
|
467
424
|
<Button
|
|
468
|
-
|
|
425
|
+
size="small"
|
|
469
426
|
isPressed={ isAdding }
|
|
470
427
|
icon={ plus }
|
|
471
428
|
label={
|
|
@@ -474,7 +431,7 @@ export function PaletteEdit( {
|
|
|
474
431
|
: __( 'Add color' )
|
|
475
432
|
}
|
|
476
433
|
onClick={ () => {
|
|
477
|
-
const
|
|
434
|
+
const optionName = getNameForPosition(
|
|
478
435
|
elements,
|
|
479
436
|
slugPrefix
|
|
480
437
|
);
|
|
@@ -484,10 +441,10 @@ export function PaletteEdit( {
|
|
|
484
441
|
...gradients,
|
|
485
442
|
{
|
|
486
443
|
gradient: DEFAULT_GRADIENT,
|
|
487
|
-
name:
|
|
444
|
+
name: optionName,
|
|
488
445
|
slug:
|
|
489
446
|
slugPrefix +
|
|
490
|
-
kebabCase(
|
|
447
|
+
kebabCase( optionName ),
|
|
491
448
|
},
|
|
492
449
|
] );
|
|
493
450
|
} else {
|
|
@@ -495,10 +452,10 @@ export function PaletteEdit( {
|
|
|
495
452
|
...colors,
|
|
496
453
|
{
|
|
497
454
|
color: DEFAULT_COLOR,
|
|
498
|
-
name:
|
|
455
|
+
name: optionName,
|
|
499
456
|
slug:
|
|
500
457
|
slugPrefix +
|
|
501
|
-
kebabCase(
|
|
458
|
+
kebabCase( optionName ),
|
|
502
459
|
},
|
|
503
460
|
] );
|
|
504
461
|
}
|
|
@@ -6,13 +6,8 @@ import { render, fireEvent, screen } from '@testing-library/react';
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
8
8
|
*/
|
|
9
|
-
import PaletteEdit, {
|
|
10
|
-
getNameForPosition,
|
|
11
|
-
isTemporaryElement,
|
|
12
|
-
DEFAULT_COLOR,
|
|
13
|
-
} from '..';
|
|
9
|
+
import PaletteEdit, { getNameForPosition } from '..';
|
|
14
10
|
import type { PaletteElement } from '../types';
|
|
15
|
-
import { DEFAULT_GRADIENT } from '../../custom-gradient-picker/constants';
|
|
16
11
|
|
|
17
12
|
describe( 'getNameForPosition', () => {
|
|
18
13
|
test( 'should return 1 by default', () => {
|
|
@@ -85,75 +80,6 @@ describe( 'getNameForPosition', () => {
|
|
|
85
80
|
} );
|
|
86
81
|
} );
|
|
87
82
|
|
|
88
|
-
describe( 'isTemporaryElement', () => {
|
|
89
|
-
[
|
|
90
|
-
{
|
|
91
|
-
message: 'identifies temporary color',
|
|
92
|
-
slug: 'test-',
|
|
93
|
-
obj: {
|
|
94
|
-
name: '',
|
|
95
|
-
slug: 'test-color-1',
|
|
96
|
-
color: DEFAULT_COLOR,
|
|
97
|
-
},
|
|
98
|
-
expected: true,
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
message: 'identifies temporary gradient',
|
|
102
|
-
slug: 'test-',
|
|
103
|
-
obj: {
|
|
104
|
-
name: '',
|
|
105
|
-
slug: 'test-color-1',
|
|
106
|
-
gradient: DEFAULT_GRADIENT,
|
|
107
|
-
},
|
|
108
|
-
expected: true,
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
message: 'identifies custom color slug',
|
|
112
|
-
slug: 'test-',
|
|
113
|
-
obj: {
|
|
114
|
-
name: '',
|
|
115
|
-
slug: 'test-color-happy',
|
|
116
|
-
color: DEFAULT_COLOR,
|
|
117
|
-
},
|
|
118
|
-
expected: false,
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
message: 'identifies custom color value',
|
|
122
|
-
slug: 'test-',
|
|
123
|
-
obj: {
|
|
124
|
-
name: '',
|
|
125
|
-
slug: 'test-color-1',
|
|
126
|
-
color: '#ccc',
|
|
127
|
-
},
|
|
128
|
-
expected: false,
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
message: 'identifies custom gradient slug',
|
|
132
|
-
slug: 'test-',
|
|
133
|
-
obj: {
|
|
134
|
-
name: '',
|
|
135
|
-
slug: 'test-gradient-joy',
|
|
136
|
-
color: DEFAULT_GRADIENT,
|
|
137
|
-
},
|
|
138
|
-
expected: false,
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
message: 'identifies custom gradient value',
|
|
142
|
-
slug: 'test-',
|
|
143
|
-
obj: {
|
|
144
|
-
name: '',
|
|
145
|
-
slug: 'test-color-3',
|
|
146
|
-
color: 'linear-gradient(90deg, rgba(22, 22, 22, 1) 0%, rgb(155, 81, 224) 100%)',
|
|
147
|
-
},
|
|
148
|
-
expected: false,
|
|
149
|
-
},
|
|
150
|
-
].forEach( ( { message, slug, obj, expected } ) => {
|
|
151
|
-
it( `should ${ message }`, () => {
|
|
152
|
-
expect( isTemporaryElement( slug, obj ) ).toBe( expected );
|
|
153
|
-
} );
|
|
154
|
-
} );
|
|
155
|
-
} );
|
|
156
|
-
|
|
157
83
|
describe( 'PaletteEdit', () => {
|
|
158
84
|
const defaultProps = {
|
|
159
85
|
colors: [ { color: '#ffffff', name: 'Base', slug: 'base' } ],
|
package/src/panel/README.md
CHANGED
|
@@ -4,12 +4,6 @@ Panels expand and collapse multiple sections of content.
|
|
|
4
4
|
|
|
5
5
|

|
|
6
6
|
|
|
7
|
-
## Table of contents
|
|
8
|
-
|
|
9
|
-
1. [Design guidelines](#design-guidelines)
|
|
10
|
-
2. [Development guidelines](#development-guidelines)
|
|
11
|
-
3. [Related components](#related-components)
|
|
12
|
-
|
|
13
7
|
## Design guidelines
|
|
14
8
|
|
|
15
9
|
### Anatomy
|