@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
|
@@ -4,14 +4,11 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.DEFAULT_COLOR = void 0;
|
|
8
7
|
exports.PaletteEdit = PaletteEdit;
|
|
9
8
|
exports.default = void 0;
|
|
10
9
|
exports.getNameForPosition = getNameForPosition;
|
|
11
|
-
exports.isTemporaryElement = isTemporaryElement;
|
|
12
10
|
var _react = require("react");
|
|
13
11
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
14
|
-
var _changeCase = require("change-case");
|
|
15
12
|
var _element = require("@wordpress/element");
|
|
16
13
|
var _i18n = require("@wordpress/i18n");
|
|
17
14
|
var _icons = require("@wordpress/icons");
|
|
@@ -30,6 +27,7 @@ var _styles = require("./styles");
|
|
|
30
27
|
var _navigableContainer = require("../navigable-container");
|
|
31
28
|
var _constants = require("../custom-gradient-picker/constants");
|
|
32
29
|
var _customGradientPicker = _interopRequireDefault(require("../custom-gradient-picker"));
|
|
30
|
+
var _strings = require("../utils/strings");
|
|
33
31
|
/**
|
|
34
32
|
* External dependencies
|
|
35
33
|
*/
|
|
@@ -43,7 +41,6 @@ var _customGradientPicker = _interopRequireDefault(require("../custom-gradient-p
|
|
|
43
41
|
*/
|
|
44
42
|
|
|
45
43
|
const DEFAULT_COLOR = '#000';
|
|
46
|
-
exports.DEFAULT_COLOR = DEFAULT_COLOR;
|
|
47
44
|
function NameInput({
|
|
48
45
|
value,
|
|
49
46
|
onChange,
|
|
@@ -58,8 +55,8 @@ function NameInput({
|
|
|
58
55
|
}
|
|
59
56
|
|
|
60
57
|
/**
|
|
61
|
-
* Returns a
|
|
62
|
-
* To ensure there are no duplicate ids, this function checks all slugs
|
|
58
|
+
* Returns a name for a palette item in the format "Color + id".
|
|
59
|
+
* To ensure there are no duplicate ids, this function checks all slugs.
|
|
63
60
|
* It expects slugs to be in the format: slugPrefix + color- + number.
|
|
64
61
|
* It then sets the id component of the new name based on the incremented id of the highest existing slug id.
|
|
65
62
|
*
|
|
@@ -69,10 +66,10 @@ function NameInput({
|
|
|
69
66
|
* @return A unique name for a palette item.
|
|
70
67
|
*/
|
|
71
68
|
function getNameForPosition(elements, slugPrefix) {
|
|
72
|
-
const
|
|
69
|
+
const nameRegex = new RegExp(`^${slugPrefix}color-([\\d]+)$`);
|
|
73
70
|
const position = elements.reduce((previousValue, currentValue) => {
|
|
74
71
|
if (typeof currentValue?.slug === 'string') {
|
|
75
|
-
const matches = currentValue?.slug.match(
|
|
72
|
+
const matches = currentValue?.slug.match(nameRegex);
|
|
76
73
|
if (matches) {
|
|
77
74
|
const id = parseInt(matches[1], 10);
|
|
78
75
|
if (id >= previousValue) {
|
|
@@ -82,7 +79,7 @@ function getNameForPosition(elements, slugPrefix) {
|
|
|
82
79
|
}
|
|
83
80
|
return previousValue;
|
|
84
81
|
}, 1);
|
|
85
|
-
return (0, _i18n.sprintf)( /* translators: %s: is
|
|
82
|
+
return (0, _i18n.sprintf)( /* translators: %s: is an id for a custom color */
|
|
86
83
|
(0, _i18n.__)('Color %s'), position);
|
|
87
84
|
}
|
|
88
85
|
function ColorPickerPopover({
|
|
@@ -177,10 +174,10 @@ function Option({
|
|
|
177
174
|
onChange: nextName => onChange({
|
|
178
175
|
...element,
|
|
179
176
|
name: nextName,
|
|
180
|
-
slug: slugPrefix + (0,
|
|
177
|
+
slug: slugPrefix + (0, _strings.kebabCase)(nextName !== null && nextName !== void 0 ? nextName : '')
|
|
181
178
|
})
|
|
182
179
|
}) : (0, _react.createElement)(_styles.NameContainer, null, element.name)), isEditing && !canOnlyChangeValues && (0, _react.createElement)(_flex.FlexItem, null, (0, _react.createElement)(_styles.RemoveButton, {
|
|
183
|
-
|
|
180
|
+
size: "small",
|
|
184
181
|
icon: _icons.lineSolid,
|
|
185
182
|
label: (0, _i18n.__)('Remove color'),
|
|
186
183
|
onClick: onRemove
|
|
@@ -191,31 +188,6 @@ function Option({
|
|
|
191
188
|
popoverProps: popoverProps
|
|
192
189
|
}));
|
|
193
190
|
}
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* Checks if a color or gradient is a temporary element by testing against default values.
|
|
197
|
-
*/
|
|
198
|
-
function isTemporaryElement(slugPrefix, {
|
|
199
|
-
slug,
|
|
200
|
-
color,
|
|
201
|
-
gradient
|
|
202
|
-
}) {
|
|
203
|
-
const regex = new RegExp(`^${slugPrefix}color-([\\d]+)$`);
|
|
204
|
-
|
|
205
|
-
// If the slug matches the temporary name regex,
|
|
206
|
-
// check if the color or gradient matches the default value.
|
|
207
|
-
if (regex.test(slug)) {
|
|
208
|
-
// The order is important as gradient elements
|
|
209
|
-
// contain a color property.
|
|
210
|
-
if (!!gradient) {
|
|
211
|
-
return gradient === _constants.DEFAULT_GRADIENT;
|
|
212
|
-
}
|
|
213
|
-
if (!!color) {
|
|
214
|
-
return color === DEFAULT_COLOR;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
return false;
|
|
218
|
-
}
|
|
219
191
|
function PaletteEditListView({
|
|
220
192
|
elements,
|
|
221
193
|
onChange,
|
|
@@ -231,17 +203,6 @@ function PaletteEditListView({
|
|
|
231
203
|
(0, _element.useEffect)(() => {
|
|
232
204
|
elementsReference.current = elements;
|
|
233
205
|
}, [elements]);
|
|
234
|
-
(0, _element.useEffect)(() => {
|
|
235
|
-
return () => {
|
|
236
|
-
if (elementsReference.current?.some(element => isTemporaryElement(slugPrefix, element))) {
|
|
237
|
-
const newElements = elementsReference.current.filter(element => !isTemporaryElement(slugPrefix, element));
|
|
238
|
-
onChange(newElements.length ? newElements : undefined);
|
|
239
|
-
}
|
|
240
|
-
};
|
|
241
|
-
// Disable reason: adding the missing dependency here would cause breaking changes that will require
|
|
242
|
-
// a heavier refactor to avoid. See https://github.com/WordPress/gutenberg/pull/43911
|
|
243
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
244
|
-
}, []);
|
|
245
206
|
const debounceOnChange = (0, _compose.useDebounce)(onChange, 100);
|
|
246
207
|
return (0, _react.createElement)(_vStack.VStack, {
|
|
247
208
|
spacing: 3
|
|
@@ -340,29 +301,29 @@ function PaletteEdit({
|
|
|
340
301
|
return (0, _react.createElement)(_styles.PaletteEditStyles, null, (0, _react.createElement)(_styles.PaletteHStackHeader, null, (0, _react.createElement)(_styles.PaletteHeading, {
|
|
341
302
|
level: paletteLabelHeadingLevel
|
|
342
303
|
}, paletteLabel), (0, _react.createElement)(_styles.PaletteActionsContainer, null, hasElements && isEditing && (0, _react.createElement)(_styles.DoneButton, {
|
|
343
|
-
|
|
304
|
+
size: "small",
|
|
344
305
|
onClick: () => {
|
|
345
306
|
setIsEditing(false);
|
|
346
307
|
setEditingElement(null);
|
|
347
308
|
}
|
|
348
309
|
}, (0, _i18n.__)('Done')), !canOnlyChangeValues && (0, _react.createElement)(_button.default, {
|
|
349
|
-
|
|
310
|
+
size: "small",
|
|
350
311
|
isPressed: isAdding,
|
|
351
312
|
icon: _icons.plus,
|
|
352
313
|
label: isGradient ? (0, _i18n.__)('Add gradient') : (0, _i18n.__)('Add color'),
|
|
353
314
|
onClick: () => {
|
|
354
|
-
const
|
|
315
|
+
const optionName = getNameForPosition(elements, slugPrefix);
|
|
355
316
|
if (!!gradients) {
|
|
356
317
|
onChange([...gradients, {
|
|
357
318
|
gradient: _constants.DEFAULT_GRADIENT,
|
|
358
|
-
name:
|
|
359
|
-
slug: slugPrefix + (0,
|
|
319
|
+
name: optionName,
|
|
320
|
+
slug: slugPrefix + (0, _strings.kebabCase)(optionName)
|
|
360
321
|
}]);
|
|
361
322
|
} else {
|
|
362
323
|
onChange([...colors, {
|
|
363
324
|
color: DEFAULT_COLOR,
|
|
364
|
-
name:
|
|
365
|
-
slug: slugPrefix + (0,
|
|
325
|
+
name: optionName,
|
|
326
|
+
slug: slugPrefix + (0, _strings.kebabCase)(optionName)
|
|
366
327
|
}]);
|
|
367
328
|
}
|
|
368
329
|
setIsEditing(true);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_classnames","_interopRequireDefault","require","_changeCase","_element","_i18n","_icons","_compose","_button","_colorPicker","_flex","_hStack","_itemGroup","_vStack","_gradientPicker","_colorPalette","_dropdownMenu","_popover","_styles","_navigableContainer","_constants","_customGradientPicker","DEFAULT_COLOR","exports","NameInput","value","onChange","label","_react","createElement","NameInputControl","hideLabelFromVision","getNameForPosition","elements","slugPrefix","temporaryNameRegex","RegExp","position","reduce","previousValue","currentValue","slug","matches","match","id","parseInt","sprintf","__","ColorPickerPopover","isGradient","element","popoverProps","receivedPopoverProps","onClose","useMemo","shift","offset","resize","placement","className","classnames","default","ColorPicker","color","enableAlpha","newColor","__nextHasNoMargin","__experimentalIsRenderedInSidebar","gradient","newGradient","Option","canOnlyChangeValues","isEditing","onStartEditing","onRemove","onStopEditing","focusOutsideProps","useFocusOutside","popoverAnchor","setPopoverAnchor","useState","anchor","PaletteItem","undefined","as","onClick","ref","style","cursor","HStack","justify","FlexItem","IndicatorStyled","background","name","nextName","kebabCase","NameContainer","RemoveButton","isSmall","icon","lineSolid","isTemporaryElement","regex","test","DEFAULT_GRADIENT","PaletteEditListView","editingElement","setEditingElement","elementsReference","useRef","useEffect","current","some","newElements","filter","length","debounceOnChange","useDebounce","VStack","spacing","ItemGroup","isRounded","map","index","key","newElement","currentElement","currentIndex","_currentElement","EMPTY_ARRAY","PaletteEdit","gradients","colors","paletteLabel","paletteLabelHeadingLevel","emptyMessage","canReset","setIsEditing","isAdding","elementsLength","hasElements","onSelectPaletteItem","useCallback","newEditingElementIndex","selectedElement","PaletteEditStyles","PaletteHStackHeader","PaletteHeading","level","PaletteActionsContainer","DoneButton","isPressed","plus","tempOptionName","moreVertical","toggleProps","Fragment","NavigableMenu","role","variant","clearable","disableCustomGradients","disableCustomColors","_default"],"sources":["@wordpress/components/src/palette-edit/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { paramCase as kebabCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseState,\n\tuseRef,\n\tuseEffect,\n\tuseCallback,\n\tuseMemo,\n} from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { lineSolid, moreVertical, plus } from '@wordpress/icons';\nimport {\n\t__experimentalUseFocusOutside as useFocusOutside,\n\tuseDebounce,\n} from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport Button from '../button';\nimport { ColorPicker } from '../color-picker';\nimport { FlexItem } from '../flex';\nimport { HStack } from '../h-stack';\nimport { ItemGroup } from '../item-group';\nimport { VStack } from '../v-stack';\nimport GradientPicker from '../gradient-picker';\nimport ColorPalette from '../color-palette';\nimport DropdownMenu from '../dropdown-menu';\nimport Popover from '../popover';\nimport {\n\tPaletteActionsContainer,\n\tPaletteEditStyles,\n\tPaletteHeading,\n\tPaletteHStackHeader,\n\tIndicatorStyled,\n\tPaletteItem,\n\tNameContainer,\n\tNameInputControl,\n\tDoneButton,\n\tRemoveButton,\n} from './styles';\nimport { NavigableMenu } from '../navigable-container';\nimport { DEFAULT_GRADIENT } from '../custom-gradient-picker/constants';\nimport CustomGradientPicker from '../custom-gradient-picker';\nimport type {\n\tColor,\n\tColorPickerPopoverProps,\n\tGradient,\n\tNameInputProps,\n\tOptionProps,\n\tPaletteEditListViewProps,\n\tPaletteEditProps,\n\tPaletteElement,\n} from './types';\n\nexport const DEFAULT_COLOR = '#000';\n\nfunction NameInput( { value, onChange, label }: NameInputProps ) {\n\treturn (\n\t\t<NameInputControl\n\t\t\tlabel={ label }\n\t\t\thideLabelFromVision\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t/>\n\t);\n}\n\n/**\n * Returns a temporary name for a palette item in the format \"Color + id\".\n * To ensure there are no duplicate ids, this function checks all slugs for temporary names.\n * It expects slugs to be in the format: slugPrefix + color- + number.\n * It then sets the id component of the new name based on the incremented id of the highest existing slug id.\n *\n * @param elements An array of color palette items.\n * @param slugPrefix The slug prefix used to match the element slug.\n *\n * @return A unique name for a palette item.\n */\nexport function getNameForPosition(\n\telements: PaletteElement[],\n\tslugPrefix: string\n) {\n\tconst temporaryNameRegex = new RegExp( `^${ slugPrefix }color-([\\\\d]+)$` );\n\tconst position = elements.reduce( ( previousValue, currentValue ) => {\n\t\tif ( typeof currentValue?.slug === 'string' ) {\n\t\t\tconst matches = currentValue?.slug.match( temporaryNameRegex );\n\t\t\tif ( matches ) {\n\t\t\t\tconst id = parseInt( matches[ 1 ], 10 );\n\t\t\t\tif ( id >= previousValue ) {\n\t\t\t\t\treturn id + 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn previousValue;\n\t}, 1 );\n\n\treturn sprintf(\n\t\t/* translators: %s: is a temporary id for a custom color */\n\t\t__( 'Color %s' ),\n\t\tposition\n\t);\n}\n\nfunction ColorPickerPopover< T extends Color | Gradient >( {\n\tisGradient,\n\telement,\n\tonChange,\n\tpopoverProps: receivedPopoverProps,\n\tonClose = () => {},\n}: ColorPickerPopoverProps< T > ) {\n\tconst popoverProps: ColorPickerPopoverProps< T >[ 'popoverProps' ] =\n\t\tuseMemo(\n\t\t\t() => ( {\n\t\t\t\tshift: true,\n\t\t\t\toffset: 20,\n\t\t\t\t// Disabling resize as it would otherwise cause the popover to show\n\t\t\t\t// scrollbars while dragging the color picker's handle close to the\n\t\t\t\t// popover edge.\n\t\t\t\tresize: false,\n\t\t\t\tplacement: 'left-start',\n\t\t\t\t...receivedPopoverProps,\n\t\t\t\tclassName: classnames(\n\t\t\t\t\t'components-palette-edit__popover',\n\t\t\t\t\treceivedPopoverProps?.className\n\t\t\t\t),\n\t\t\t} ),\n\t\t\t[ receivedPopoverProps ]\n\t\t);\n\n\treturn (\n\t\t<Popover { ...popoverProps } onClose={ onClose }>\n\t\t\t{ ! isGradient && (\n\t\t\t\t<ColorPicker\n\t\t\t\t\tcolor={ element.color }\n\t\t\t\t\tenableAlpha\n\t\t\t\t\tonChange={ ( newColor ) => {\n\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t...element,\n\t\t\t\t\t\t\tcolor: newColor,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isGradient && (\n\t\t\t\t<div className=\"components-palette-edit__popover-gradient-picker\">\n\t\t\t\t\t<CustomGradientPicker\n\t\t\t\t\t\t__nextHasNoMargin\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\tvalue={ element.gradient }\n\t\t\t\t\t\tonChange={ ( newGradient ) => {\n\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t...element,\n\t\t\t\t\t\t\t\tgradient: newGradient,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</Popover>\n\t);\n}\n\nfunction Option< T extends Color | Gradient >( {\n\tcanOnlyChangeValues,\n\telement,\n\tonChange,\n\tisEditing,\n\tonStartEditing,\n\tonRemove,\n\tonStopEditing,\n\tpopoverProps: receivedPopoverProps,\n\tslugPrefix,\n\tisGradient,\n}: OptionProps< T > ) {\n\tconst focusOutsideProps = useFocusOutside( onStopEditing );\n\tconst value = isGradient ? element.gradient : element.color;\n\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\tconst popoverProps = useMemo(\n\t\t() => ( {\n\t\t\t...receivedPopoverProps,\n\t\t\t// Use the custom palette color item as the popover anchor.\n\t\t\tanchor: popoverAnchor,\n\t\t} ),\n\t\t[ popoverAnchor, receivedPopoverProps ]\n\t);\n\n\treturn (\n\t\t<PaletteItem\n\t\t\tclassName={ isEditing ? 'is-selected' : undefined }\n\t\t\tas=\"div\"\n\t\t\tonClick={ onStartEditing }\n\t\t\tref={ setPopoverAnchor }\n\t\t\t{ ...( isEditing\n\t\t\t\t? { ...focusOutsideProps }\n\t\t\t\t: {\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\tcursor: 'pointer',\n\t\t\t\t\t\t},\n\t\t\t\t } ) }\n\t\t>\n\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t<FlexItem>\n\t\t\t\t\t<IndicatorStyled\n\t\t\t\t\t\tstyle={ { background: value, color: 'transparent' } }\n\t\t\t\t\t/>\n\t\t\t\t</FlexItem>\n\t\t\t\t<FlexItem>\n\t\t\t\t\t{ isEditing && ! canOnlyChangeValues ? (\n\t\t\t\t\t\t<NameInput\n\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\tisGradient\n\t\t\t\t\t\t\t\t\t? __( 'Gradient name' )\n\t\t\t\t\t\t\t\t\t: __( 'Color name' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvalue={ element.name }\n\t\t\t\t\t\t\tonChange={ ( nextName?: string ) =>\n\t\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t\t...element,\n\t\t\t\t\t\t\t\t\tname: nextName,\n\t\t\t\t\t\t\t\t\tslug:\n\t\t\t\t\t\t\t\t\t\tslugPrefix +\n\t\t\t\t\t\t\t\t\t\tkebabCase( nextName ?? '' ),\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<NameContainer>{ element.name }</NameContainer>\n\t\t\t\t\t) }\n\t\t\t\t</FlexItem>\n\t\t\t\t{ isEditing && ! canOnlyChangeValues && (\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t<RemoveButton\n\t\t\t\t\t\t\tisSmall\n\t\t\t\t\t\t\ticon={ lineSolid }\n\t\t\t\t\t\t\tlabel={ __( 'Remove color' ) }\n\t\t\t\t\t\t\tonClick={ onRemove }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t) }\n\t\t\t</HStack>\n\t\t\t{ isEditing && (\n\t\t\t\t<ColorPickerPopover\n\t\t\t\t\tisGradient={ isGradient }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\telement={ element }\n\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</PaletteItem>\n\t);\n}\n\n/**\n * Checks if a color or gradient is a temporary element by testing against default values.\n */\nexport function isTemporaryElement(\n\tslugPrefix: string,\n\t{ slug, color, gradient }: Color | Gradient\n): Boolean {\n\tconst regex = new RegExp( `^${ slugPrefix }color-([\\\\d]+)$` );\n\n\t// If the slug matches the temporary name regex,\n\t// check if the color or gradient matches the default value.\n\tif ( regex.test( slug ) ) {\n\t\t// The order is important as gradient elements\n\t\t// contain a color property.\n\t\tif ( !! gradient ) {\n\t\t\treturn gradient === DEFAULT_GRADIENT;\n\t\t}\n\n\t\tif ( !! color ) {\n\t\t\treturn color === DEFAULT_COLOR;\n\t\t}\n\t}\n\n\treturn false;\n}\n\nfunction PaletteEditListView< T extends Color | Gradient >( {\n\telements,\n\tonChange,\n\teditingElement,\n\tsetEditingElement,\n\tcanOnlyChangeValues,\n\tslugPrefix,\n\tisGradient,\n\tpopoverProps,\n}: PaletteEditListViewProps< T > ) {\n\t// When unmounting the component if there are empty elements (the user did not complete the insertion) clean them.\n\tconst elementsReference = useRef< typeof elements >();\n\tuseEffect( () => {\n\t\telementsReference.current = elements;\n\t}, [ elements ] );\n\tuseEffect( () => {\n\t\treturn () => {\n\t\t\tif (\n\t\t\t\telementsReference.current?.some( ( element ) =>\n\t\t\t\t\tisTemporaryElement( slugPrefix, element )\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tconst newElements = elementsReference.current.filter(\n\t\t\t\t\t( element ) => ! isTemporaryElement( slugPrefix, element )\n\t\t\t\t);\n\t\t\t\tonChange( newElements.length ? newElements : undefined );\n\t\t\t}\n\t\t};\n\t\t// Disable reason: adding the missing dependency here would cause breaking changes that will require\n\t\t// a heavier refactor to avoid. See https://github.com/WordPress/gutenberg/pull/43911\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [] );\n\n\tconst debounceOnChange = useDebounce( onChange, 100 );\n\n\treturn (\n\t\t<VStack spacing={ 3 }>\n\t\t\t<ItemGroup isRounded>\n\t\t\t\t{ elements.map( ( element, index ) => (\n\t\t\t\t\t<Option\n\t\t\t\t\t\tisGradient={ isGradient }\n\t\t\t\t\t\tcanOnlyChangeValues={ canOnlyChangeValues }\n\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\telement={ element }\n\t\t\t\t\t\tonStartEditing={ () => {\n\t\t\t\t\t\t\tif ( editingElement !== index ) {\n\t\t\t\t\t\t\t\tsetEditingElement( index );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonChange={ ( newElement ) => {\n\t\t\t\t\t\t\tdebounceOnChange(\n\t\t\t\t\t\t\t\telements.map(\n\t\t\t\t\t\t\t\t\t( currentElement, currentIndex ) => {\n\t\t\t\t\t\t\t\t\t\tif ( currentIndex === index ) {\n\t\t\t\t\t\t\t\t\t\t\treturn newElement;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\treturn currentElement;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonRemove={ () => {\n\t\t\t\t\t\t\tsetEditingElement( null );\n\t\t\t\t\t\t\tconst newElements = elements.filter(\n\t\t\t\t\t\t\t\t( _currentElement, currentIndex ) => {\n\t\t\t\t\t\t\t\t\tif ( currentIndex === index ) {\n\t\t\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\tnewElements.length ? newElements : undefined\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tisEditing={ index === editingElement }\n\t\t\t\t\t\tonStopEditing={ () => {\n\t\t\t\t\t\t\tif ( index === editingElement ) {\n\t\t\t\t\t\t\t\tsetEditingElement( null );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tslugPrefix={ slugPrefix }\n\t\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t</ItemGroup>\n\t\t</VStack>\n\t);\n}\n\nconst EMPTY_ARRAY: Color[] = [];\n\n/**\n * Allows editing a palette of colors or gradients.\n *\n * ```jsx\n * import { PaletteEdit } from '@wordpress/components';\n * const MyPaletteEdit = () => {\n * const [ controlledColors, setControlledColors ] = useState( colors );\n *\n * return (\n * <PaletteEdit\n * colors={ controlledColors }\n * onChange={ ( newColors?: Color[] ) => {\n * setControlledColors( newColors );\n * } }\n * paletteLabel=\"Here is a label\"\n * />\n * );\n * };\n * ```\n */\nexport function PaletteEdit( {\n\tgradients,\n\tcolors = EMPTY_ARRAY,\n\tonChange,\n\tpaletteLabel,\n\tpaletteLabelHeadingLevel = 2,\n\temptyMessage,\n\tcanOnlyChangeValues,\n\tcanReset,\n\tslugPrefix = '',\n\tpopoverProps,\n}: PaletteEditProps ) {\n\tconst isGradient = !! gradients;\n\tconst elements = isGradient ? gradients : colors;\n\tconst [ isEditing, setIsEditing ] = useState( false );\n\tconst [ editingElement, setEditingElement ] = useState<\n\t\tnumber | null | undefined\n\t>( null );\n\tconst isAdding =\n\t\tisEditing &&\n\t\t!! editingElement &&\n\t\telements[ editingElement ] &&\n\t\t! elements[ editingElement ].slug;\n\tconst elementsLength = elements.length;\n\tconst hasElements = elementsLength > 0;\n\tconst debounceOnChange = useDebounce( onChange, 100 );\n\tconst onSelectPaletteItem = useCallback(\n\t\t(\n\t\t\tvalue?: PaletteElement[ keyof PaletteElement ],\n\t\t\tnewEditingElementIndex?: number\n\t\t) => {\n\t\t\tconst selectedElement =\n\t\t\t\tnewEditingElementIndex === undefined\n\t\t\t\t\t? undefined\n\t\t\t\t\t: elements[ newEditingElementIndex ];\n\t\t\tconst key = isGradient ? 'gradient' : 'color';\n\t\t\t// Ensures that the index returned matches a known element value.\n\t\t\tif ( !! selectedElement && selectedElement[ key ] === value ) {\n\t\t\t\tsetEditingElement( newEditingElementIndex );\n\t\t\t} else {\n\t\t\t\tsetIsEditing( true );\n\t\t\t}\n\t\t},\n\t\t[ isGradient, elements ]\n\t);\n\n\treturn (\n\t\t<PaletteEditStyles>\n\t\t\t<PaletteHStackHeader>\n\t\t\t\t<PaletteHeading level={ paletteLabelHeadingLevel }>\n\t\t\t\t\t{ paletteLabel }\n\t\t\t\t</PaletteHeading>\n\t\t\t\t<PaletteActionsContainer>\n\t\t\t\t\t{ hasElements && isEditing && (\n\t\t\t\t\t\t<DoneButton\n\t\t\t\t\t\t\tisSmall\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tsetIsEditing( false );\n\t\t\t\t\t\t\t\tsetEditingElement( null );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Done' ) }\n\t\t\t\t\t\t</DoneButton>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! canOnlyChangeValues && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tisSmall\n\t\t\t\t\t\t\tisPressed={ isAdding }\n\t\t\t\t\t\t\ticon={ plus }\n\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\tisGradient\n\t\t\t\t\t\t\t\t\t? __( 'Add gradient' )\n\t\t\t\t\t\t\t\t\t: __( 'Add color' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tconst tempOptionName = getNameForPosition(\n\t\t\t\t\t\t\t\t\telements,\n\t\t\t\t\t\t\t\t\tslugPrefix\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\tif ( !! gradients ) {\n\t\t\t\t\t\t\t\t\tonChange( [\n\t\t\t\t\t\t\t\t\t\t...gradients,\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tgradient: DEFAULT_GRADIENT,\n\t\t\t\t\t\t\t\t\t\t\tname: tempOptionName,\n\t\t\t\t\t\t\t\t\t\t\tslug:\n\t\t\t\t\t\t\t\t\t\t\t\tslugPrefix +\n\t\t\t\t\t\t\t\t\t\t\t\tkebabCase( tempOptionName ),\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t] );\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tonChange( [\n\t\t\t\t\t\t\t\t\t\t...colors,\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tcolor: DEFAULT_COLOR,\n\t\t\t\t\t\t\t\t\t\t\tname: tempOptionName,\n\t\t\t\t\t\t\t\t\t\t\tslug:\n\t\t\t\t\t\t\t\t\t\t\t\tslugPrefix +\n\t\t\t\t\t\t\t\t\t\t\t\tkebabCase( tempOptionName ),\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t] );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tsetIsEditing( true );\n\t\t\t\t\t\t\t\tsetEditingElement( elements.length );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ hasElements &&\n\t\t\t\t\t\t( ! isEditing ||\n\t\t\t\t\t\t\t! canOnlyChangeValues ||\n\t\t\t\t\t\t\tcanReset ) && (\n\t\t\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\t\tisGradient\n\t\t\t\t\t\t\t\t\t\t? __( 'Gradient options' )\n\t\t\t\t\t\t\t\t\t\t: __( 'Color options' )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\t\t\tisSmall: true,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ ( { onClose }: { onClose: () => void } ) => (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<NavigableMenu role=\"menu\">\n\t\t\t\t\t\t\t\t\t\t\t{ ! isEditing && (\n\t\t\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetIsEditing( true );\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"components-palette-edit__menu-button\"\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ __( 'Show details' ) }\n\t\t\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t{ ! canOnlyChangeValues && (\n\t\t\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetEditingElement(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnull\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetIsEditing( false );\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonChange();\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"components-palette-edit__menu-button\"\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ isGradient\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Remove all gradients'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Remove all colors'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t ) }\n\t\t\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t{ canReset && (\n\t\t\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetEditingElement(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnull\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonChange();\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ isGradient\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? __( 'Reset gradient' )\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: __( 'Reset colors' ) }\n\t\t\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</NavigableMenu>\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</DropdownMenu>\n\t\t\t\t\t\t) }\n\t\t\t\t</PaletteActionsContainer>\n\t\t\t</PaletteHStackHeader>\n\t\t\t{ hasElements && (\n\t\t\t\t<>\n\t\t\t\t\t{ isEditing && (\n\t\t\t\t\t\t<PaletteEditListView< ( typeof elements )[ number ] >\n\t\t\t\t\t\t\tcanOnlyChangeValues={ canOnlyChangeValues }\n\t\t\t\t\t\t\telements={ elements }\n\t\t\t\t\t\t\t// @ts-expect-error TODO: Don't know how to resolve\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\teditingElement={ editingElement }\n\t\t\t\t\t\t\tsetEditingElement={ setEditingElement }\n\t\t\t\t\t\t\tslugPrefix={ slugPrefix }\n\t\t\t\t\t\t\tisGradient={ isGradient }\n\t\t\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! isEditing && editingElement !== null && (\n\t\t\t\t\t\t<ColorPickerPopover\n\t\t\t\t\t\t\tisGradient={ isGradient }\n\t\t\t\t\t\t\tonClose={ () => setEditingElement( null ) }\n\t\t\t\t\t\t\tonChange={ (\n\t\t\t\t\t\t\t\tnewElement: ( typeof elements )[ number ]\n\t\t\t\t\t\t\t) => {\n\t\t\t\t\t\t\t\tdebounceOnChange(\n\t\t\t\t\t\t\t\t\t// @ts-expect-error TODO: Don't know how to resolve\n\t\t\t\t\t\t\t\t\telements.map(\n\t\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t\tcurrentElement: ( typeof elements )[ number ],\n\t\t\t\t\t\t\t\t\t\t\tcurrentIndex: number\n\t\t\t\t\t\t\t\t\t\t) => {\n\t\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\t\tcurrentIndex === editingElement\n\t\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\t\treturn newElement;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\treturn currentElement;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\telement={ elements[ editingElement ?? -1 ] }\n\t\t\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! isEditing &&\n\t\t\t\t\t\t( isGradient ? (\n\t\t\t\t\t\t\t<GradientPicker\n\t\t\t\t\t\t\t\t__nextHasNoMargin\n\t\t\t\t\t\t\t\tgradients={ gradients }\n\t\t\t\t\t\t\t\tonChange={ onSelectPaletteItem }\n\t\t\t\t\t\t\t\tclearable={ false }\n\t\t\t\t\t\t\t\tdisableCustomGradients={ true }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<ColorPalette\n\t\t\t\t\t\t\t\tcolors={ colors }\n\t\t\t\t\t\t\t\tonChange={ onSelectPaletteItem }\n\t\t\t\t\t\t\t\tclearable={ false }\n\t\t\t\t\t\t\t\tdisableCustomColors={ true }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) ) }\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t{ ! hasElements && emptyMessage }\n\t\t</PaletteEditStyles>\n\t);\n}\n\nexport default PaletteEdit;\n"],"mappings":";;;;;;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAKA,IAAAE,QAAA,GAAAF,OAAA;AAOA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAQA,IAAAM,OAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AACA,IAAAQ,KAAA,GAAAR,OAAA;AACA,IAAAS,OAAA,GAAAT,OAAA;AACA,IAAAU,UAAA,GAAAV,OAAA;AACA,IAAAW,OAAA,GAAAX,OAAA;AACA,IAAAY,eAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,aAAA,GAAAd,sBAAA,CAAAC,OAAA;AACA,IAAAc,aAAA,GAAAf,sBAAA,CAAAC,O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A;EAAc,CAC7B,CACD,EACC,CAAEqB,SAAS,IAAImC,cAAc,KAAK,IAAI,IACvC,IAAA/E,MAAA,CAAAC,aAAA,EAACmB,kBAAkB;IAClBC,UAAU,EAAGA,UAAY;IACzBI,OAAO,EAAGA,CAAA,KAAMuD,iBAAiB,CAAE,IAAK,CAAG;IAC3ClF,QAAQ,EACPoG,UAAyC,IACrC;MACJT,gBAAgB;MACf;MACApF,QAAQ,CAAC0F,GAAG,CACX,CACCI,cAA6C,EAC7CC,YAAoB,KAChB;QACJ,IACCA,YAAY,KAAKrB,cAAc,EAC9B;UACD,OAAOmB,UAAU;QAClB;QACA,OAAOC,cAAc;MACtB,CACD,CACD,CAAC;IACF,CAAG;IACH7E,OAAO,EAAGjB,QAAQ,CAAE0E,cAAc,aAAdA,cAAc,cAAdA,cAAc,GAAI,CAAC,CAAC,CAAI;IAC5CxD,YAAY,EAAGA;EAAc,CAC7B,CACD,EACC,CAAEqB,SAAS,KACVvB,UAAU,GACX,IAAArB,MAAA,CAAAC,aAAA,EAACf,eAAA,CAAA+C,OAAc;IACdK,iBAAiB;IACjBkE,SAAS,EAAGA,SAAW;IACvB1G,QAAQ,EAAGoH,mBAAqB;IAChCmB,SAAS,EAAG,KAAO;IACnBC,sBAAsB,EAAG;EAAM,CAC/B,CAAC,GAEF,IAAAtI,MAAA,CAAAC,aAAA,EAACd,aAAA,CAAA8C,OAAY;IACZwE,MAAM,EAAGA,MAAQ;IACjB3G,QAAQ,EAAGoH,mBAAqB;IAChCmB,SAAS,EAAG,KAAO;IACnBE,mBAAmB,EAAG;EAAM,CAC5B,CACD,CACD,CACF,EACC,CAAEtB,WAAW,IAAIL,YACD,CAAC;AAEtB;AAAC,IAAA4B,QAAA,GAEcjC,WAAW;AAAA5G,OAAA,CAAAsC,OAAA,GAAAuG,QAAA"}
|
|
1
|
+
{"version":3,"names":["_classnames","_interopRequireDefault","require","_element","_i18n","_icons","_compose","_button","_colorPicker","_flex","_hStack","_itemGroup","_vStack","_gradientPicker","_colorPalette","_dropdownMenu","_popover","_styles","_navigableContainer","_constants","_customGradientPicker","_strings","DEFAULT_COLOR","NameInput","value","onChange","label","_react","createElement","NameInputControl","hideLabelFromVision","getNameForPosition","elements","slugPrefix","nameRegex","RegExp","position","reduce","previousValue","currentValue","slug","matches","match","id","parseInt","sprintf","__","ColorPickerPopover","isGradient","element","popoverProps","receivedPopoverProps","onClose","useMemo","shift","offset","resize","placement","className","classnames","default","ColorPicker","color","enableAlpha","newColor","__nextHasNoMargin","__experimentalIsRenderedInSidebar","gradient","newGradient","Option","canOnlyChangeValues","isEditing","onStartEditing","onRemove","onStopEditing","focusOutsideProps","useFocusOutside","popoverAnchor","setPopoverAnchor","useState","anchor","PaletteItem","undefined","as","onClick","ref","style","cursor","HStack","justify","FlexItem","IndicatorStyled","background","name","nextName","kebabCase","NameContainer","RemoveButton","size","icon","lineSolid","PaletteEditListView","editingElement","setEditingElement","elementsReference","useRef","useEffect","current","debounceOnChange","useDebounce","VStack","spacing","ItemGroup","isRounded","map","index","key","newElement","currentElement","currentIndex","newElements","filter","_currentElement","length","EMPTY_ARRAY","PaletteEdit","gradients","colors","paletteLabel","paletteLabelHeadingLevel","emptyMessage","canReset","setIsEditing","isAdding","elementsLength","hasElements","onSelectPaletteItem","useCallback","newEditingElementIndex","selectedElement","PaletteEditStyles","PaletteHStackHeader","PaletteHeading","level","PaletteActionsContainer","DoneButton","isPressed","plus","optionName","DEFAULT_GRADIENT","moreVertical","toggleProps","isSmall","Fragment","NavigableMenu","role","variant","clearable","disableCustomGradients","disableCustomColors","_default","exports"],"sources":["@wordpress/components/src/palette-edit/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseState,\n\tuseRef,\n\tuseEffect,\n\tuseCallback,\n\tuseMemo,\n} from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { lineSolid, moreVertical, plus } from '@wordpress/icons';\nimport {\n\t__experimentalUseFocusOutside as useFocusOutside,\n\tuseDebounce,\n} from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport Button from '../button';\nimport { ColorPicker } from '../color-picker';\nimport { FlexItem } from '../flex';\nimport { HStack } from '../h-stack';\nimport { ItemGroup } from '../item-group';\nimport { VStack } from '../v-stack';\nimport GradientPicker from '../gradient-picker';\nimport ColorPalette from '../color-palette';\nimport DropdownMenu from '../dropdown-menu';\nimport Popover from '../popover';\nimport {\n\tPaletteActionsContainer,\n\tPaletteEditStyles,\n\tPaletteHeading,\n\tPaletteHStackHeader,\n\tIndicatorStyled,\n\tPaletteItem,\n\tNameContainer,\n\tNameInputControl,\n\tDoneButton,\n\tRemoveButton,\n} from './styles';\nimport { NavigableMenu } from '../navigable-container';\nimport { DEFAULT_GRADIENT } from '../custom-gradient-picker/constants';\nimport CustomGradientPicker from '../custom-gradient-picker';\nimport { kebabCase } from '../utils/strings';\nimport type {\n\tColor,\n\tColorPickerPopoverProps,\n\tGradient,\n\tNameInputProps,\n\tOptionProps,\n\tPaletteEditListViewProps,\n\tPaletteEditProps,\n\tPaletteElement,\n} from './types';\n\nconst DEFAULT_COLOR = '#000';\n\nfunction NameInput( { value, onChange, label }: NameInputProps ) {\n\treturn (\n\t\t<NameInputControl\n\t\t\tlabel={ label }\n\t\t\thideLabelFromVision\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t/>\n\t);\n}\n\n/**\n * Returns a name for a palette item in the format \"Color + id\".\n * To ensure there are no duplicate ids, this function checks all slugs.\n * It expects slugs to be in the format: slugPrefix + color- + number.\n * It then sets the id component of the new name based on the incremented id of the highest existing slug id.\n *\n * @param elements An array of color palette items.\n * @param slugPrefix The slug prefix used to match the element slug.\n *\n * @return A unique name for a palette item.\n */\nexport function getNameForPosition(\n\telements: PaletteElement[],\n\tslugPrefix: string\n) {\n\tconst nameRegex = new RegExp( `^${ slugPrefix }color-([\\\\d]+)$` );\n\tconst position = elements.reduce( ( previousValue, currentValue ) => {\n\t\tif ( typeof currentValue?.slug === 'string' ) {\n\t\t\tconst matches = currentValue?.slug.match( nameRegex );\n\t\t\tif ( matches ) {\n\t\t\t\tconst id = parseInt( matches[ 1 ], 10 );\n\t\t\t\tif ( id >= previousValue ) {\n\t\t\t\t\treturn id + 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn previousValue;\n\t}, 1 );\n\n\treturn sprintf(\n\t\t/* translators: %s: is an id for a custom color */\n\t\t__( 'Color %s' ),\n\t\tposition\n\t);\n}\n\nfunction ColorPickerPopover< T extends Color | Gradient >( {\n\tisGradient,\n\telement,\n\tonChange,\n\tpopoverProps: receivedPopoverProps,\n\tonClose = () => {},\n}: ColorPickerPopoverProps< T > ) {\n\tconst popoverProps: ColorPickerPopoverProps< T >[ 'popoverProps' ] =\n\t\tuseMemo(\n\t\t\t() => ( {\n\t\t\t\tshift: true,\n\t\t\t\toffset: 20,\n\t\t\t\t// Disabling resize as it would otherwise cause the popover to show\n\t\t\t\t// scrollbars while dragging the color picker's handle close to the\n\t\t\t\t// popover edge.\n\t\t\t\tresize: false,\n\t\t\t\tplacement: 'left-start',\n\t\t\t\t...receivedPopoverProps,\n\t\t\t\tclassName: classnames(\n\t\t\t\t\t'components-palette-edit__popover',\n\t\t\t\t\treceivedPopoverProps?.className\n\t\t\t\t),\n\t\t\t} ),\n\t\t\t[ receivedPopoverProps ]\n\t\t);\n\n\treturn (\n\t\t<Popover { ...popoverProps } onClose={ onClose }>\n\t\t\t{ ! isGradient && (\n\t\t\t\t<ColorPicker\n\t\t\t\t\tcolor={ element.color }\n\t\t\t\t\tenableAlpha\n\t\t\t\t\tonChange={ ( newColor ) => {\n\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t...element,\n\t\t\t\t\t\t\tcolor: newColor,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isGradient && (\n\t\t\t\t<div className=\"components-palette-edit__popover-gradient-picker\">\n\t\t\t\t\t<CustomGradientPicker\n\t\t\t\t\t\t__nextHasNoMargin\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\tvalue={ element.gradient }\n\t\t\t\t\t\tonChange={ ( newGradient ) => {\n\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t...element,\n\t\t\t\t\t\t\t\tgradient: newGradient,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</Popover>\n\t);\n}\n\nfunction Option< T extends Color | Gradient >( {\n\tcanOnlyChangeValues,\n\telement,\n\tonChange,\n\tisEditing,\n\tonStartEditing,\n\tonRemove,\n\tonStopEditing,\n\tpopoverProps: receivedPopoverProps,\n\tslugPrefix,\n\tisGradient,\n}: OptionProps< T > ) {\n\tconst focusOutsideProps = useFocusOutside( onStopEditing );\n\tconst value = isGradient ? element.gradient : element.color;\n\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\tconst popoverProps = useMemo(\n\t\t() => ( {\n\t\t\t...receivedPopoverProps,\n\t\t\t// Use the custom palette color item as the popover anchor.\n\t\t\tanchor: popoverAnchor,\n\t\t} ),\n\t\t[ popoverAnchor, receivedPopoverProps ]\n\t);\n\n\treturn (\n\t\t<PaletteItem\n\t\t\tclassName={ isEditing ? 'is-selected' : undefined }\n\t\t\tas=\"div\"\n\t\t\tonClick={ onStartEditing }\n\t\t\tref={ setPopoverAnchor }\n\t\t\t{ ...( isEditing\n\t\t\t\t? { ...focusOutsideProps }\n\t\t\t\t: {\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\tcursor: 'pointer',\n\t\t\t\t\t\t},\n\t\t\t\t } ) }\n\t\t>\n\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t<FlexItem>\n\t\t\t\t\t<IndicatorStyled\n\t\t\t\t\t\tstyle={ { background: value, color: 'transparent' } }\n\t\t\t\t\t/>\n\t\t\t\t</FlexItem>\n\t\t\t\t<FlexItem>\n\t\t\t\t\t{ isEditing && ! canOnlyChangeValues ? (\n\t\t\t\t\t\t<NameInput\n\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\tisGradient\n\t\t\t\t\t\t\t\t\t? __( 'Gradient name' )\n\t\t\t\t\t\t\t\t\t: __( 'Color name' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvalue={ element.name }\n\t\t\t\t\t\t\tonChange={ ( nextName?: string ) =>\n\t\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t\t...element,\n\t\t\t\t\t\t\t\t\tname: nextName,\n\t\t\t\t\t\t\t\t\tslug:\n\t\t\t\t\t\t\t\t\t\tslugPrefix +\n\t\t\t\t\t\t\t\t\t\tkebabCase( nextName ?? '' ),\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<NameContainer>{ element.name }</NameContainer>\n\t\t\t\t\t) }\n\t\t\t\t</FlexItem>\n\t\t\t\t{ isEditing && ! canOnlyChangeValues && (\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t<RemoveButton\n\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\ticon={ lineSolid }\n\t\t\t\t\t\t\tlabel={ __( 'Remove color' ) }\n\t\t\t\t\t\t\tonClick={ onRemove }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t) }\n\t\t\t</HStack>\n\t\t\t{ isEditing && (\n\t\t\t\t<ColorPickerPopover\n\t\t\t\t\tisGradient={ isGradient }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\telement={ element }\n\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</PaletteItem>\n\t);\n}\n\nfunction PaletteEditListView< T extends Color | Gradient >( {\n\telements,\n\tonChange,\n\teditingElement,\n\tsetEditingElement,\n\tcanOnlyChangeValues,\n\tslugPrefix,\n\tisGradient,\n\tpopoverProps,\n}: PaletteEditListViewProps< T > ) {\n\t// When unmounting the component if there are empty elements (the user did not complete the insertion) clean them.\n\tconst elementsReference = useRef< typeof elements >();\n\tuseEffect( () => {\n\t\telementsReference.current = elements;\n\t}, [ elements ] );\n\n\tconst debounceOnChange = useDebounce( onChange, 100 );\n\n\treturn (\n\t\t<VStack spacing={ 3 }>\n\t\t\t<ItemGroup isRounded>\n\t\t\t\t{ elements.map( ( element, index ) => (\n\t\t\t\t\t<Option\n\t\t\t\t\t\tisGradient={ isGradient }\n\t\t\t\t\t\tcanOnlyChangeValues={ canOnlyChangeValues }\n\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\telement={ element }\n\t\t\t\t\t\tonStartEditing={ () => {\n\t\t\t\t\t\t\tif ( editingElement !== index ) {\n\t\t\t\t\t\t\t\tsetEditingElement( index );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonChange={ ( newElement ) => {\n\t\t\t\t\t\t\tdebounceOnChange(\n\t\t\t\t\t\t\t\telements.map(\n\t\t\t\t\t\t\t\t\t( currentElement, currentIndex ) => {\n\t\t\t\t\t\t\t\t\t\tif ( currentIndex === index ) {\n\t\t\t\t\t\t\t\t\t\t\treturn newElement;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\treturn currentElement;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonRemove={ () => {\n\t\t\t\t\t\t\tsetEditingElement( null );\n\t\t\t\t\t\t\tconst newElements = elements.filter(\n\t\t\t\t\t\t\t\t( _currentElement, currentIndex ) => {\n\t\t\t\t\t\t\t\t\tif ( currentIndex === index ) {\n\t\t\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\tnewElements.length ? newElements : undefined\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tisEditing={ index === editingElement }\n\t\t\t\t\t\tonStopEditing={ () => {\n\t\t\t\t\t\t\tif ( index === editingElement ) {\n\t\t\t\t\t\t\t\tsetEditingElement( null );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tslugPrefix={ slugPrefix }\n\t\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t</ItemGroup>\n\t\t</VStack>\n\t);\n}\n\nconst EMPTY_ARRAY: Color[] = [];\n\n/**\n * Allows editing a palette of colors or gradients.\n *\n * ```jsx\n * import { PaletteEdit } from '@wordpress/components';\n * const MyPaletteEdit = () => {\n * const [ controlledColors, setControlledColors ] = useState( colors );\n *\n * return (\n * <PaletteEdit\n * colors={ controlledColors }\n * onChange={ ( newColors?: Color[] ) => {\n * setControlledColors( newColors );\n * } }\n * paletteLabel=\"Here is a label\"\n * />\n * );\n * };\n * ```\n */\nexport function PaletteEdit( {\n\tgradients,\n\tcolors = EMPTY_ARRAY,\n\tonChange,\n\tpaletteLabel,\n\tpaletteLabelHeadingLevel = 2,\n\temptyMessage,\n\tcanOnlyChangeValues,\n\tcanReset,\n\tslugPrefix = '',\n\tpopoverProps,\n}: PaletteEditProps ) {\n\tconst isGradient = !! gradients;\n\tconst elements = isGradient ? gradients : colors;\n\tconst [ isEditing, setIsEditing ] = useState( false );\n\tconst [ editingElement, setEditingElement ] = useState<\n\t\tnumber | null | undefined\n\t>( null );\n\tconst isAdding =\n\t\tisEditing &&\n\t\t!! editingElement &&\n\t\telements[ editingElement ] &&\n\t\t! elements[ editingElement ].slug;\n\tconst elementsLength = elements.length;\n\tconst hasElements = elementsLength > 0;\n\tconst debounceOnChange = useDebounce( onChange, 100 );\n\tconst onSelectPaletteItem = useCallback(\n\t\t(\n\t\t\tvalue?: PaletteElement[ keyof PaletteElement ],\n\t\t\tnewEditingElementIndex?: number\n\t\t) => {\n\t\t\tconst selectedElement =\n\t\t\t\tnewEditingElementIndex === undefined\n\t\t\t\t\t? undefined\n\t\t\t\t\t: elements[ newEditingElementIndex ];\n\t\t\tconst key = isGradient ? 'gradient' : 'color';\n\t\t\t// Ensures that the index returned matches a known element value.\n\t\t\tif ( !! selectedElement && selectedElement[ key ] === value ) {\n\t\t\t\tsetEditingElement( newEditingElementIndex );\n\t\t\t} else {\n\t\t\t\tsetIsEditing( true );\n\t\t\t}\n\t\t},\n\t\t[ isGradient, elements ]\n\t);\n\n\treturn (\n\t\t<PaletteEditStyles>\n\t\t\t<PaletteHStackHeader>\n\t\t\t\t<PaletteHeading level={ paletteLabelHeadingLevel }>\n\t\t\t\t\t{ paletteLabel }\n\t\t\t\t</PaletteHeading>\n\t\t\t\t<PaletteActionsContainer>\n\t\t\t\t\t{ hasElements && isEditing && (\n\t\t\t\t\t\t<DoneButton\n\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tsetIsEditing( false );\n\t\t\t\t\t\t\t\tsetEditingElement( null );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Done' ) }\n\t\t\t\t\t\t</DoneButton>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! canOnlyChangeValues && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\tisPressed={ isAdding }\n\t\t\t\t\t\t\ticon={ plus }\n\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\tisGradient\n\t\t\t\t\t\t\t\t\t? __( 'Add gradient' )\n\t\t\t\t\t\t\t\t\t: __( 'Add color' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tconst optionName = getNameForPosition(\n\t\t\t\t\t\t\t\t\telements,\n\t\t\t\t\t\t\t\t\tslugPrefix\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\tif ( !! gradients ) {\n\t\t\t\t\t\t\t\t\tonChange( [\n\t\t\t\t\t\t\t\t\t\t...gradients,\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tgradient: DEFAULT_GRADIENT,\n\t\t\t\t\t\t\t\t\t\t\tname: optionName,\n\t\t\t\t\t\t\t\t\t\t\tslug:\n\t\t\t\t\t\t\t\t\t\t\t\tslugPrefix +\n\t\t\t\t\t\t\t\t\t\t\t\tkebabCase( optionName ),\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t] );\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tonChange( [\n\t\t\t\t\t\t\t\t\t\t...colors,\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tcolor: DEFAULT_COLOR,\n\t\t\t\t\t\t\t\t\t\t\tname: optionName,\n\t\t\t\t\t\t\t\t\t\t\tslug:\n\t\t\t\t\t\t\t\t\t\t\t\tslugPrefix +\n\t\t\t\t\t\t\t\t\t\t\t\tkebabCase( optionName ),\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t] );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tsetIsEditing( true );\n\t\t\t\t\t\t\t\tsetEditingElement( elements.length );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ hasElements &&\n\t\t\t\t\t\t( ! isEditing ||\n\t\t\t\t\t\t\t! canOnlyChangeValues ||\n\t\t\t\t\t\t\tcanReset ) && (\n\t\t\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\t\tisGradient\n\t\t\t\t\t\t\t\t\t\t? __( 'Gradient options' )\n\t\t\t\t\t\t\t\t\t\t: __( 'Color options' )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\t\t\tisSmall: true,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ ( { onClose }: { onClose: () => void } ) => (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<NavigableMenu role=\"menu\">\n\t\t\t\t\t\t\t\t\t\t\t{ ! isEditing && (\n\t\t\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetIsEditing( true );\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"components-palette-edit__menu-button\"\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ __( 'Show details' ) }\n\t\t\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t{ ! canOnlyChangeValues && (\n\t\t\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetEditingElement(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnull\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetIsEditing( false );\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonChange();\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"components-palette-edit__menu-button\"\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ isGradient\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Remove all gradients'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Remove all colors'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t ) }\n\t\t\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t{ canReset && (\n\t\t\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetEditingElement(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnull\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonChange();\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ isGradient\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? __( 'Reset gradient' )\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: __( 'Reset colors' ) }\n\t\t\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</NavigableMenu>\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</DropdownMenu>\n\t\t\t\t\t\t) }\n\t\t\t\t</PaletteActionsContainer>\n\t\t\t</PaletteHStackHeader>\n\t\t\t{ hasElements && (\n\t\t\t\t<>\n\t\t\t\t\t{ isEditing && (\n\t\t\t\t\t\t<PaletteEditListView< ( typeof elements )[ number ] >\n\t\t\t\t\t\t\tcanOnlyChangeValues={ canOnlyChangeValues }\n\t\t\t\t\t\t\telements={ elements }\n\t\t\t\t\t\t\t// @ts-expect-error TODO: Don't know how to resolve\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\teditingElement={ editingElement }\n\t\t\t\t\t\t\tsetEditingElement={ setEditingElement }\n\t\t\t\t\t\t\tslugPrefix={ slugPrefix }\n\t\t\t\t\t\t\tisGradient={ isGradient }\n\t\t\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! isEditing && editingElement !== null && (\n\t\t\t\t\t\t<ColorPickerPopover\n\t\t\t\t\t\t\tisGradient={ isGradient }\n\t\t\t\t\t\t\tonClose={ () => setEditingElement( null ) }\n\t\t\t\t\t\t\tonChange={ (\n\t\t\t\t\t\t\t\tnewElement: ( typeof elements )[ number ]\n\t\t\t\t\t\t\t) => {\n\t\t\t\t\t\t\t\tdebounceOnChange(\n\t\t\t\t\t\t\t\t\t// @ts-expect-error TODO: Don't know how to resolve\n\t\t\t\t\t\t\t\t\telements.map(\n\t\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t\tcurrentElement: ( typeof elements )[ number ],\n\t\t\t\t\t\t\t\t\t\t\tcurrentIndex: number\n\t\t\t\t\t\t\t\t\t\t) => {\n\t\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\t\tcurrentIndex === editingElement\n\t\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\t\treturn newElement;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\treturn currentElement;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\telement={ elements[ editingElement ?? -1 ] }\n\t\t\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! isEditing &&\n\t\t\t\t\t\t( isGradient ? (\n\t\t\t\t\t\t\t<GradientPicker\n\t\t\t\t\t\t\t\t__nextHasNoMargin\n\t\t\t\t\t\t\t\tgradients={ gradients }\n\t\t\t\t\t\t\t\tonChange={ onSelectPaletteItem }\n\t\t\t\t\t\t\t\tclearable={ false }\n\t\t\t\t\t\t\t\tdisableCustomGradients={ true }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<ColorPalette\n\t\t\t\t\t\t\t\tcolors={ colors }\n\t\t\t\t\t\t\t\tonChange={ onSelectPaletteItem }\n\t\t\t\t\t\t\t\tclearable={ false }\n\t\t\t\t\t\t\t\tdisableCustomColors={ true }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) ) }\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t{ ! hasElements && emptyMessage }\n\t\t</PaletteEditStyles>\n\t);\n}\n\nexport default PaletteEdit;\n"],"mappings":";;;;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AAOA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAQA,IAAAK,OAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM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IAAArB,MAAA,CAAAC,aAAA,EAACf,eAAA,CAAA+C,OAAc;IACdK,iBAAiB;IACjB6D,SAAS,EAAGA,SAAW;IACvBrG,QAAQ,EAAG+G,mBAAqB;IAChCqB,SAAS,EAAG,KAAO;IACnBC,sBAAsB,EAAG;EAAM,CAC/B,CAAC,GAEF,IAAAnI,MAAA,CAAAC,aAAA,EAACd,aAAA,CAAA8C,OAAY;IACZmE,MAAM,EAAGA,MAAQ;IACjBtG,QAAQ,EAAG+G,mBAAqB;IAChCqB,SAAS,EAAG,KAAO;IACnBE,mBAAmB,EAAG;EAAM,CAC5B,CACD,CACD,CACF,EACC,CAAExB,WAAW,IAAIL,YACD,CAAC;AAEtB;AAAC,IAAA8B,QAAA,GAEcnC,WAAW;AAAAoC,OAAA,CAAArG,OAAA,GAAAoG,QAAA"}
|
package/build/private-apis.js
CHANGED
|
@@ -4,18 +4,18 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
8
|
-
var _privateApis = require("@wordpress/private-apis");
|
|
7
|
+
exports.privateApis = void 0;
|
|
9
8
|
var _v = require("./composite/v2");
|
|
10
9
|
var _customSelectControl = _interopRequireDefault(require("./custom-select-control"));
|
|
11
10
|
var _utils = require("./popover/utils");
|
|
12
11
|
var _progressBar = _interopRequireDefault(require("./progress-bar"));
|
|
13
12
|
var _slotFill = require("./slot-fill");
|
|
14
13
|
var _dropdownMenuV = require("./dropdown-menu-v2");
|
|
15
|
-
var _dropdownMenuV2Ariakit = require("./dropdown-menu-v2-ariakit");
|
|
16
14
|
var _contextSystemProvider = require("./context/context-system-provider");
|
|
17
15
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
18
16
|
var _tabs = _interopRequireDefault(require("./tabs"));
|
|
17
|
+
var _strings = require("./utils/strings");
|
|
18
|
+
var _lockUnlock = require("./lock-unlock");
|
|
19
19
|
/**
|
|
20
20
|
* WordPress dependencies
|
|
21
21
|
*/
|
|
@@ -24,15 +24,9 @@ var _tabs = _interopRequireDefault(require("./tabs"));
|
|
|
24
24
|
* Internal dependencies
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
|
-
const {
|
|
28
|
-
lock,
|
|
29
|
-
unlock
|
|
30
|
-
} = (0, _privateApis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.', '@wordpress/components');
|
|
31
|
-
exports.unlock = unlock;
|
|
32
|
-
exports.lock = lock;
|
|
33
27
|
const privateApis = {};
|
|
34
28
|
exports.privateApis = privateApis;
|
|
35
|
-
lock(privateApis, {
|
|
29
|
+
(0, _lockUnlock.lock)(privateApis, {
|
|
36
30
|
CompositeV2: _v.Composite,
|
|
37
31
|
CompositeGroupV2: _v.CompositeGroup,
|
|
38
32
|
CompositeItemV2: _v.CompositeItem,
|
|
@@ -42,26 +36,17 @@ lock(privateApis, {
|
|
|
42
36
|
__experimentalPopoverLegacyPositionToPlacement: _utils.positionToPlacement,
|
|
43
37
|
createPrivateSlotFill: _slotFill.createPrivateSlotFill,
|
|
44
38
|
ComponentsContext: _contextSystemProvider.ComponentsContext,
|
|
39
|
+
ProgressBar: _progressBar.default,
|
|
40
|
+
Tabs: _tabs.default,
|
|
41
|
+
Theme: _theme.default,
|
|
45
42
|
DropdownMenuV2: _dropdownMenuV.DropdownMenu,
|
|
46
|
-
DropdownMenuCheckboxItemV2: _dropdownMenuV.DropdownMenuCheckboxItem,
|
|
47
43
|
DropdownMenuGroupV2: _dropdownMenuV.DropdownMenuGroup,
|
|
48
44
|
DropdownMenuItemV2: _dropdownMenuV.DropdownMenuItem,
|
|
49
|
-
|
|
50
|
-
DropdownMenuRadioGroupV2: _dropdownMenuV.DropdownMenuRadioGroup,
|
|
45
|
+
DropdownMenuCheckboxItemV2: _dropdownMenuV.DropdownMenuCheckboxItem,
|
|
51
46
|
DropdownMenuRadioItemV2: _dropdownMenuV.DropdownMenuRadioItem,
|
|
52
47
|
DropdownMenuSeparatorV2: _dropdownMenuV.DropdownMenuSeparator,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
Tabs: _tabs.default,
|
|
57
|
-
Theme: _theme.default,
|
|
58
|
-
DropdownMenuV2Ariakit: _dropdownMenuV2Ariakit.DropdownMenu,
|
|
59
|
-
DropdownMenuGroupV2Ariakit: _dropdownMenuV2Ariakit.DropdownMenuGroup,
|
|
60
|
-
DropdownMenuItemV2Ariakit: _dropdownMenuV2Ariakit.DropdownMenuItem,
|
|
61
|
-
DropdownMenuCheckboxItemV2Ariakit: _dropdownMenuV2Ariakit.DropdownMenuCheckboxItem,
|
|
62
|
-
DropdownMenuRadioItemV2Ariakit: _dropdownMenuV2Ariakit.DropdownMenuRadioItem,
|
|
63
|
-
DropdownMenuSeparatorV2Ariakit: _dropdownMenuV2Ariakit.DropdownMenuSeparator,
|
|
64
|
-
DropdownMenuItemLabelV2Ariakit: _dropdownMenuV2Ariakit.DropdownMenuItemLabel,
|
|
65
|
-
DropdownMenuItemHelpTextV2Ariakit: _dropdownMenuV2Ariakit.DropdownMenuItemHelpText
|
|
48
|
+
DropdownMenuItemLabelV2: _dropdownMenuV.DropdownMenuItemLabel,
|
|
49
|
+
DropdownMenuItemHelpTextV2: _dropdownMenuV.DropdownMenuItemHelpText,
|
|
50
|
+
kebabCase: _strings.kebabCase
|
|
66
51
|
});
|
|
67
52
|
//# sourceMappingURL=private-apis.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_v","require","_customSelectControl","_interopRequireDefault","_utils","_progressBar","_slotFill","_dropdownMenuV","_contextSystemProvider","_theme","_tabs","_strings","_lockUnlock","privateApis","exports","lock","CompositeV2","CompositeGroupV2","CompositeItemV2","CompositeRowV2","useCompositeStoreV2","CustomSelectControl","__experimentalPopoverLegacyPositionToPlacement","createPrivateSlotFill","ComponentsContext","ProgressBar","Tabs","Theme","DropdownMenuV2","DropdownMenuGroupV2","DropdownMenuItemV2","DropdownMenuCheckboxItemV2","DropdownMenuRadioItemV2","DropdownMenuSeparatorV2","DropdownMenuItemLabelV2","DropdownMenuItemHelpTextV2","kebabCase"],"sources":["@wordpress/components/src/private-apis.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\n/**\n * Internal dependencies\n */\nimport {\n\tComposite as CompositeV2,\n\tCompositeGroup as CompositeGroupV2,\n\tCompositeItem as CompositeItemV2,\n\tCompositeRow as CompositeRowV2,\n\tuseCompositeStore as useCompositeStoreV2,\n} from './composite/v2';\nimport { default as CustomSelectControl } from './custom-select-control';\nimport { positionToPlacement as __experimentalPopoverLegacyPositionToPlacement } from './popover/utils';\nimport { default as ProgressBar } from './progress-bar';\nimport { createPrivateSlotFill } from './slot-fill';\nimport {\n\tDropdownMenu as DropdownMenuV2,\n\tDropdownMenuGroup as DropdownMenuGroupV2,\n\tDropdownMenuItem as DropdownMenuItemV2,\n\tDropdownMenuCheckboxItem as DropdownMenuCheckboxItemV2,\n\tDropdownMenuRadioItem as DropdownMenuRadioItemV2,\n\tDropdownMenuSeparator as DropdownMenuSeparatorV2,\n\tDropdownMenuItemLabel as DropdownMenuItemLabelV2,\n\tDropdownMenuItemHelpText as DropdownMenuItemHelpTextV2,\n} from './dropdown-menu-v2';\nimport { ComponentsContext } from './context/context-system-provider';\nimport Theme from './theme';\nimport Tabs from './tabs';\nimport { kebabCase } from './utils/strings';\nimport { lock } from './lock-unlock';\n\nexport const privateApis = {};\nlock( privateApis, {\n\tCompositeV2,\n\tCompositeGroupV2,\n\tCompositeItemV2,\n\tCompositeRowV2,\n\tuseCompositeStoreV2,\n\tCustomSelectControl,\n\t__experimentalPopoverLegacyPositionToPlacement,\n\tcreatePrivateSlotFill,\n\tComponentsContext,\n\tProgressBar,\n\tTabs,\n\tTheme,\n\tDropdownMenuV2,\n\tDropdownMenuGroupV2,\n\tDropdownMenuItemV2,\n\tDropdownMenuCheckboxItemV2,\n\tDropdownMenuRadioItemV2,\n\tDropdownMenuSeparatorV2,\n\tDropdownMenuItemLabelV2,\n\tDropdownMenuItemHelpTextV2,\n\tkebabCase,\n} );\n"],"mappings":";;;;;;;AAQA,IAAAA,EAAA,GAAAC,OAAA;AAOA,IAAAC,oBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,cAAA,GAAAN,OAAA;AAUA,IAAAO,sBAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAN,sBAAA,CAAAF,OAAA;AACA,IAAAS,KAAA,GAAAP,sBAAA,CAAAF,OAAA;AACA,IAAAU,QAAA,GAAAV,OAAA;AACA,IAAAW,WAAA,GAAAX,OAAA;AAjCA;AACA;AACA;;AAGA;AACA;AACA;;AA4BO,MAAMY,WAAW,GAAG,CAAC,CAAC;AAACC,OAAA,CAAAD,WAAA,GAAAA,WAAA;AAC9B,IAAAE,gBAAI,EAAEF,WAAW,EAAE;EAClBG,WAAW,EAAXA,YAAW;EACXC,gBAAgB,EAAhBA,iBAAgB;EAChBC,eAAe,EAAfA,gBAAe;EACfC,cAAc,EAAdA,eAAc;EACdC,mBAAmB,EAAnBA,oBAAmB;EACnBC,mBAAmB,EAAnBA,4BAAmB;EACnBC,8CAA8C,EAA9CA,0BAA8C;EAC9CC,qBAAqB,EAArBA,+BAAqB;EACrBC,iBAAiB,EAAjBA,wCAAiB;EACjBC,WAAW,EAAXA,oBAAW;EACXC,IAAI,EAAJA,aAAI;EACJC,KAAK,EAALA,cAAK;EACLC,cAAc,EAAdA,2BAAc;EACdC,mBAAmB,EAAnBA,gCAAmB;EACnBC,kBAAkB,EAAlBA,+BAAkB;EAClBC,0BAA0B,EAA1BA,uCAA0B;EAC1BC,uBAAuB,EAAvBA,oCAAuB;EACvBC,uBAAuB,EAAvBA,oCAAuB;EACvBC,uBAAuB,EAAvBA,oCAAuB;EACvBC,0BAA0B,EAA1BA,uCAA0B;EAC1BC,SAAS,EAATA;AACD,CAAE,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.privateApis = void 0;
|
|
7
|
+
var _strings = require("./utils/strings");
|
|
8
|
+
var _lockUnlock = require("./lock-unlock");
|
|
9
|
+
/**
|
|
10
|
+
* Internal dependencies
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Private @wordpress/components APIs.
|
|
15
|
+
*/
|
|
16
|
+
const privateApis = {};
|
|
17
|
+
exports.privateApis = privateApis;
|
|
18
|
+
(0, _lockUnlock.lock)(privateApis, {
|
|
19
|
+
kebabCase: _strings.kebabCase
|
|
20
|
+
});
|
|
21
|
+
//# sourceMappingURL=private-apis.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_strings","require","_lockUnlock","privateApis","exports","lock","kebabCase"],"sources":["@wordpress/components/src/private-apis.native.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { kebabCase } from './utils/strings';\nimport { lock } from './lock-unlock';\n\n/**\n * Private @wordpress/components APIs.\n */\nexport const privateApis = {};\nlock( privateApis, {\n\tkebabCase,\n} );\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACO,MAAME,WAAW,GAAG,CAAC,CAAC;AAACC,OAAA,CAAAD,WAAA,GAAAA,WAAA;AAC9B,IAAAE,gBAAI,EAAEF,WAAW,EAAE;EAClBG,SAAS,EAATA;AACD,CAAE,CAAC"}
|
|
@@ -88,6 +88,7 @@ function RadioControl(props) {
|
|
|
88
88
|
"aria-describedby": !!help ? `${id}__help` : undefined,
|
|
89
89
|
...additionalProps
|
|
90
90
|
}), (0, _react.createElement)("label", {
|
|
91
|
+
className: "components-radio-control__label",
|
|
91
92
|
htmlFor: `${id}-${index}`
|
|
92
93
|
}, option.label)))));
|
|
93
94
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_classnames","_interopRequireDefault","require","_compose","_baseControl","_vStack","RadioControl","props","label","className","selected","help","onChange","hideLabelFromVision","options","additionalProps","instanceId","useInstanceId","id","onChangeValue","event","target","value","length","_react","createElement","default","__nextHasNoMarginBottom","classnames","VStack","spacing","map","option","index","key","type","name","checked","undefined","htmlFor","_default","exports"],"sources":["@wordpress/components/src/radio-control/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport type { ChangeEvent } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BaseControl from '../base-control';\nimport type { WordPressComponentProps } from '../context';\nimport type { RadioControlProps } from './types';\nimport { VStack } from '../v-stack';\n\n/**\n * Render a user interface to select the user type using radio inputs.\n *\n * ```jsx\n * import { RadioControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyRadioControl = () => {\n * const [ option, setOption ] = useState( 'a' );\n *\n * return (\n * <RadioControl\n * label=\"User type\"\n * help=\"The type of the current user\"\n * selected={ option }\n * options={ [\n * { label: 'Author', value: 'a' },\n * { label: 'Editor', value: 'e' },\n * ] }\n * onChange={ ( value ) => setOption( value ) }\n * />\n * );\n * };\n * ```\n */\nexport function RadioControl(\n\tprops: WordPressComponentProps< RadioControlProps, 'input', false >\n) {\n\tconst {\n\t\tlabel,\n\t\tclassName,\n\t\tselected,\n\t\thelp,\n\t\tonChange,\n\t\thideLabelFromVision,\n\t\toptions = [],\n\t\t...additionalProps\n\t} = props;\n\tconst instanceId = useInstanceId( RadioControl );\n\tconst id = `inspector-radio-control-${ instanceId }`;\n\tconst onChangeValue = ( event: ChangeEvent< HTMLInputElement > ) =>\n\t\tonChange( event.target.value );\n\n\tif ( ! options?.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BaseControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tlabel={ label }\n\t\t\tid={ id }\n\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\thelp={ help }\n\t\t\tclassName={ classnames( className, 'components-radio-control' ) }\n\t\t>\n\t\t\t<VStack spacing={ 1 }>\n\t\t\t\t{ options.map( ( option, index ) => (\n\t\t\t\t\t<div\n\t\t\t\t\t\tkey={ `${ id }-${ index }` }\n\t\t\t\t\t\tclassName=\"components-radio-control__option\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<input\n\t\t\t\t\t\t\tid={ `${ id }-${ index }` }\n\t\t\t\t\t\t\tclassName=\"components-radio-control__input\"\n\t\t\t\t\t\t\ttype=\"radio\"\n\t\t\t\t\t\t\tname={ id }\n\t\t\t\t\t\t\tvalue={ option.value }\n\t\t\t\t\t\t\tonChange={ onChangeValue }\n\t\t\t\t\t\t\tchecked={ option.value === selected }\n\t\t\t\t\t\t\taria-describedby={\n\t\t\t\t\t\t\t\t!! help ? `${ id }__help` : undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t{ ...additionalProps }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<label
|
|
1
|
+
{"version":3,"names":["_classnames","_interopRequireDefault","require","_compose","_baseControl","_vStack","RadioControl","props","label","className","selected","help","onChange","hideLabelFromVision","options","additionalProps","instanceId","useInstanceId","id","onChangeValue","event","target","value","length","_react","createElement","default","__nextHasNoMarginBottom","classnames","VStack","spacing","map","option","index","key","type","name","checked","undefined","htmlFor","_default","exports"],"sources":["@wordpress/components/src/radio-control/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport type { ChangeEvent } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BaseControl from '../base-control';\nimport type { WordPressComponentProps } from '../context';\nimport type { RadioControlProps } from './types';\nimport { VStack } from '../v-stack';\n\n/**\n * Render a user interface to select the user type using radio inputs.\n *\n * ```jsx\n * import { RadioControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyRadioControl = () => {\n * const [ option, setOption ] = useState( 'a' );\n *\n * return (\n * <RadioControl\n * label=\"User type\"\n * help=\"The type of the current user\"\n * selected={ option }\n * options={ [\n * { label: 'Author', value: 'a' },\n * { label: 'Editor', value: 'e' },\n * ] }\n * onChange={ ( value ) => setOption( value ) }\n * />\n * );\n * };\n * ```\n */\nexport function RadioControl(\n\tprops: WordPressComponentProps< RadioControlProps, 'input', false >\n) {\n\tconst {\n\t\tlabel,\n\t\tclassName,\n\t\tselected,\n\t\thelp,\n\t\tonChange,\n\t\thideLabelFromVision,\n\t\toptions = [],\n\t\t...additionalProps\n\t} = props;\n\tconst instanceId = useInstanceId( RadioControl );\n\tconst id = `inspector-radio-control-${ instanceId }`;\n\tconst onChangeValue = ( event: ChangeEvent< HTMLInputElement > ) =>\n\t\tonChange( event.target.value );\n\n\tif ( ! options?.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BaseControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tlabel={ label }\n\t\t\tid={ id }\n\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\thelp={ help }\n\t\t\tclassName={ classnames( className, 'components-radio-control' ) }\n\t\t>\n\t\t\t<VStack spacing={ 1 }>\n\t\t\t\t{ options.map( ( option, index ) => (\n\t\t\t\t\t<div\n\t\t\t\t\t\tkey={ `${ id }-${ index }` }\n\t\t\t\t\t\tclassName=\"components-radio-control__option\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<input\n\t\t\t\t\t\t\tid={ `${ id }-${ index }` }\n\t\t\t\t\t\t\tclassName=\"components-radio-control__input\"\n\t\t\t\t\t\t\ttype=\"radio\"\n\t\t\t\t\t\t\tname={ id }\n\t\t\t\t\t\t\tvalue={ option.value }\n\t\t\t\t\t\t\tonChange={ onChangeValue }\n\t\t\t\t\t\t\tchecked={ option.value === selected }\n\t\t\t\t\t\t\taria-describedby={\n\t\t\t\t\t\t\t\t!! help ? `${ id }__help` : undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t{ ...additionalProps }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<label\n\t\t\t\t\t\t\tclassName=\"components-radio-control__label\"\n\t\t\t\t\t\t\thtmlFor={ `${ id }-${ index }` }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ option.label }\n\t\t\t\t\t\t</label>\n\t\t\t\t\t</div>\n\t\t\t\t) ) }\n\t\t\t</VStack>\n\t\t</BaseControl>\n\t);\n}\n\nexport default RadioControl;\n"],"mappings":";;;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAMA,IAAAC,QAAA,GAAAD,OAAA;AAKA,IAAAE,YAAA,GAAAH,sBAAA,CAAAC,OAAA;AAGA,IAAAG,OAAA,GAAAH,OAAA;AAjBA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASI,YAAYA,CAC3BC,KAAmE,EAClE;EACD,MAAM;IACLC,KAAK;IACLC,SAAS;IACTC,QAAQ;IACRC,IAAI;IACJC,QAAQ;IACRC,mBAAmB;IACnBC,OAAO,GAAG,EAAE;IACZ,GAAGC;EACJ,CAAC,GAAGR,KAAK;EACT,MAAMS,UAAU,GAAG,IAAAC,sBAAa,EAAEX,YAAa,CAAC;EAChD,MAAMY,EAAE,GAAI,2BAA2BF,UAAY,EAAC;EACp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C;AAEhB;AAAC,IAAAgC,QAAA,GAEclC,YAAY;AAAAmC,OAAA,CAAAf,OAAA,GAAAc,QAAA"}
|
|
@@ -260,7 +260,7 @@ function UnforwardedRangeControl(props, forwardedRef) {
|
|
|
260
260
|
className: "components-range-control__reset",
|
|
261
261
|
disabled: disabled || value === undefined,
|
|
262
262
|
variant: "secondary",
|
|
263
|
-
|
|
263
|
+
size: "small",
|
|
264
264
|
onClick: handleOnReset
|
|
265
265
|
}, (0, _i18n.__)('Reset')))));
|
|
266
266
|
}
|