@wordpress/components 28.8.6 → 28.10.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 +44 -5
- package/build/alignment-matrix-control/icon.js.map +1 -1
- package/build/alignment-matrix-control/types.js.map +1 -1
- package/build/alignment-matrix-control/utils.js.map +1 -1
- package/build/angle-picker-control/angle-circle.js.map +1 -1
- package/build/autocomplete/autocompleter-ui.js +3 -3
- package/build/autocomplete/autocompleter-ui.js.map +1 -1
- package/build/autocomplete/get-default-use-items.js.map +1 -1
- package/build/autocomplete/index.js +5 -1
- package/build/autocomplete/index.js.map +1 -1
- package/build/base-control/hooks.js.map +1 -1
- package/build/base-control/index.js.map +1 -1
- package/build/border-box-control/border-box-control/component.js +3 -14
- package/build/border-box-control/border-box-control/component.js.map +1 -1
- package/build/border-box-control/border-box-control/hook.js.map +1 -1
- package/build/border-box-control/styles.js.map +1 -1
- package/build/border-box-control/utils.js.map +1 -1
- package/build/border-control/border-control/component.js +1 -2
- package/build/border-control/border-control/component.js.map +1 -1
- package/build/border-control/border-control/hook.js.map +1 -1
- package/build/border-control/border-control-dropdown/component.js +2 -14
- package/build/border-control/border-control-dropdown/component.js.map +1 -1
- package/build/border-control/styles.js +13 -13
- package/build/border-control/styles.js.map +1 -1
- package/build/border-control/types.js.map +1 -1
- package/build/box-control/axial-input-controls.js.map +1 -1
- package/build/box-control/icon.js.map +1 -1
- package/build/box-control/index.js +4 -4
- package/build/box-control/index.js.map +1 -1
- package/build/box-control/input-controls.js.map +1 -1
- package/build/box-control/types.js.map +1 -1
- package/build/button/index.native.js +1 -1
- package/build/button/index.native.js.map +1 -1
- package/build/card/card/component.js +1 -1
- package/build/card/card/component.js.map +1 -1
- package/build/card/styles.js.map +1 -1
- package/build/color-palette/index.js.map +1 -1
- package/build/color-palette/index.native.js +2 -1
- package/build/color-palette/index.native.js.map +1 -1
- package/build/color-picker/styles.js.map +1 -1
- package/build/combobox-control/index.js +1 -1
- package/build/combobox-control/index.js.map +1 -1
- package/build/composite/legacy/index.js.map +1 -1
- package/build/context/context-connect.js +1 -0
- package/build/context/context-connect.js.map +1 -1
- package/build/context/context-system-provider.js +1 -1
- package/build/context/context-system-provider.js.map +1 -1
- package/build/context/get-styled-class-name-from-key.js.map +1 -1
- package/build/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
- package/build/custom-gradient-picker/index.js.map +1 -1
- package/build/custom-gradient-picker/serializer.js.map +1 -1
- package/build/custom-gradient-picker/utils.js.map +1 -1
- package/build/custom-select-control-v2/styles.js.map +1 -1
- package/build/dashicon/index.js.map +1 -1
- package/build/date-time/date/styles.js.map +1 -1
- package/build/date-time/time/timezone.js.map +1 -1
- package/build/draggable/index.js.map +1 -1
- package/build/drop-zone/index.js.map +1 -1
- package/build/dropdown-menu-v2/styles.js.map +1 -1
- package/build/duotone-picker/color-list-picker/index.js.map +1 -1
- package/build/duotone-picker/utils.js.map +1 -1
- package/build/elevation/hook.js.map +1 -1
- package/build/external-link/index.js +20 -23
- package/build/external-link/index.js.map +1 -1
- package/build/focal-point-picker/index.js.map +1 -1
- package/build/focal-point-picker/index.native.js.map +1 -1
- package/build/focal-point-picker/styles/focal-point-style.js.map +1 -1
- package/build/font-size-picker/index.js.map +1 -1
- package/build/form-token-field/index.js +2 -1
- package/build/form-token-field/index.js.map +1 -1
- package/build/form-token-field/suggestions-list.js.map +1 -1
- package/build/form-token-field/token-input.js.map +1 -1
- package/build/form-token-field/token.js +1 -1
- package/build/form-token-field/token.js.map +1 -1
- package/build/gradient-picker/index.js.map +1 -1
- package/build/grid/hook.js.map +1 -1
- package/build/guide/page-control.js +1 -1
- package/build/guide/page-control.js.map +1 -1
- package/build/h-stack/hook.js.map +1 -1
- package/build/heading/hook.js.map +1 -1
- package/build/index.js +36 -5
- package/build/index.js.map +1 -1
- package/build/input-control/index.js.map +1 -1
- package/build/input-control/input-base.js.map +1 -1
- package/build/input-control/styles/input-control-styles.js.map +1 -1
- package/build/item-group/styles.js.map +1 -1
- package/build/menu-group/index.js.map +1 -1
- package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js.map +1 -1
- package/build/mobile/bottom-sheet/cell.native.js +4 -4
- package/build/mobile/bottom-sheet/cell.native.js.map +1 -1
- package/build/mobile/bottom-sheet/index.native.js.map +1 -1
- package/build/mobile/bottom-sheet/range-cell.native.js +1 -1
- package/build/mobile/bottom-sheet/range-cell.native.js.map +1 -1
- package/build/mobile/bottom-sheet/range-text-input.native.js.map +1 -1
- package/build/mobile/bottom-sheet/stepper-cell/index.native.js +1 -1
- package/build/mobile/bottom-sheet/stepper-cell/index.native.js.map +1 -1
- package/build/mobile/bottom-sheet/switch-cell.native.js +4 -4
- package/build/mobile/bottom-sheet/switch-cell.native.js.map +1 -1
- package/build/mobile/cycle-select-control/index.native.js.map +1 -1
- package/build/mobile/gradient/index.native.js.map +1 -1
- package/build/mobile/image/index.native.js.map +1 -1
- package/build/mobile/link-picker/index.native.js +1 -1
- package/build/mobile/link-picker/index.native.js.map +1 -1
- package/build/mobile/link-picker/link-picker-results.native.js.map +1 -1
- package/build/mobile/picker/index.android.js.map +1 -1
- package/build/mobile/segmented-control/index.native.js.map +1 -1
- package/build/mobile/utils/get-px-from-css-unit.native.js.map +1 -1
- package/build/mobile/utils/use-unit-converter-to-mobile.native.js.map +1 -1
- package/build/modal/aria-helper.js +2 -1
- package/build/modal/aria-helper.js.map +1 -1
- package/build/modal/index.js +2 -1
- package/build/modal/index.js.map +1 -1
- package/build/modal/use-modal-exit-animation.js.map +1 -1
- package/build/navigation/group/index.js.map +1 -1
- package/build/navigation/item/base.js.map +1 -1
- package/build/navigation/menu/index.js.map +1 -1
- package/build/navigation/menu/menu-title-search.js +2 -2
- package/build/navigation/menu/menu-title-search.js.map +1 -1
- package/build/navigation/menu/menu-title.js.map +1 -1
- package/build/navigation/styles/navigation-styles.js.map +1 -1
- package/build/navigator/index.js +128 -32
- package/build/navigator/index.js.map +1 -1
- package/build/navigator/legacy.js +179 -0
- package/build/navigator/legacy.js.map +1 -0
- package/build/navigator/{navigator-provider → navigator}/component.js +5 -40
- package/build/navigator/navigator/component.js.map +1 -0
- package/build/navigator/navigator-back-button/component.js +2 -38
- package/build/navigator/navigator-back-button/component.js.map +1 -1
- package/build/navigator/navigator-back-button/hook.js +1 -1
- package/build/navigator/navigator-back-button/hook.js.map +1 -1
- package/build/navigator/navigator-button/component.js +2 -37
- package/build/navigator/navigator-button/component.js.map +1 -1
- package/build/navigator/navigator-button/hook.js +1 -1
- package/build/navigator/navigator-button/hook.js.map +1 -1
- package/build/navigator/navigator-screen/component.js +40 -62
- package/build/navigator/navigator-screen/component.js.map +1 -1
- package/build/navigator/navigator-screen/use-screen-animate-presence.js +114 -0
- package/build/navigator/navigator-screen/use-screen-animate-presence.js.map +1 -0
- package/build/navigator/navigator-to-parent-button/component.js +3 -7
- package/build/navigator/navigator-to-parent-button/component.js.map +1 -1
- package/build/navigator/styles.js +78 -35
- package/build/navigator/styles.js.map +1 -1
- package/build/navigator/types.js.map +1 -1
- package/build/navigator/use-navigator.js +4 -1
- package/build/navigator/use-navigator.js.map +1 -1
- package/build/number-control/styles/number-control-styles.js.map +1 -1
- package/build/palette-edit/index.js +1 -1
- package/build/palette-edit/index.js.map +1 -1
- package/build/popover/index.js +1 -1
- package/build/popover/index.js.map +1 -1
- package/build/popover/overlay-middlewares.js.map +1 -1
- package/build/popover/utils.js.map +1 -1
- package/build/progress-bar/index.js.map +1 -1
- package/build/progress-bar/styles.js.map +1 -1
- package/build/query-controls/index.js.map +1 -1
- package/build/query-controls/index.native.js.map +1 -1
- package/build/radio-control/index.js.map +1 -1
- package/build/radio-control/index.native.js.map +1 -1
- package/build/range-control/index.js.map +1 -1
- package/build/range-control/index.native.js.map +1 -1
- package/build/range-control/rail.js.map +1 -1
- package/build/range-control/styles/range-control-styles.js +32 -32
- package/build/range-control/styles/range-control-styles.js.map +1 -1
- package/build/range-control/tooltip.js +1 -1
- package/build/range-control/tooltip.js.map +1 -1
- package/build/range-control/utils.js.map +1 -1
- package/build/resizable-box/resize-tooltip/label.js.map +1 -1
- package/build/resizable-box/resize-tooltip/utils.js.map +1 -1
- package/build/responsive-wrapper/index.js.map +1 -1
- package/build/sandbox/index.js.map +1 -1
- package/build/sandbox/index.native.js.map +1 -1
- package/build/search-control/index.js +11 -2
- package/build/search-control/index.js.map +1 -1
- package/build/search-control/index.native.js.map +1 -1
- package/build/search-control/types.js.map +1 -1
- package/build/select-control/index.js.map +1 -1
- package/build/select-control/index.native.js.map +1 -1
- package/build/slot-fill/index.js.map +1 -1
- package/build/spinner/styles.js.map +1 -1
- package/build/style-provider/index.js +1 -0
- package/build/style-provider/index.js.map +1 -1
- package/build/surface/hook.js.map +1 -1
- package/build/surface/styles.js.map +1 -1
- package/build/tab-panel/index.js.map +1 -1
- package/build/tabs/index.js.map +1 -1
- package/build/tabs/styles.js +30 -12
- package/build/tabs/styles.js.map +1 -1
- package/build/tabs/tab.js +7 -2
- package/build/tabs/tab.js.map +1 -1
- package/build/tabs/tablist.js +71 -39
- package/build/tabs/tablist.js.map +1 -1
- package/build/tabs/tabpanel.js.map +1 -1
- package/build/tabs/use-track-overflow.js +73 -0
- package/build/tabs/use-track-overflow.js.map +1 -0
- package/build/text/get-line-height.js.map +1 -1
- package/build/text/styles/text-mixins.native.js.map +1 -1
- package/build/text/utils.js.map +1 -1
- package/build/text-control/index.native.js.map +1 -1
- package/build/text-highlight/index.js.map +1 -1
- package/build/textarea-control/index.js.map +1 -1
- package/build/theme/color-algorithms.js.map +1 -1
- package/build/theme/styles.js.map +1 -1
- package/build/toggle-control/index.js.map +1 -1
- package/build/toggle-control/index.native.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/as-button-group.js +4 -2
- package/build/toggle-group-control/toggle-group-control/as-button-group.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/as-radio-group.js +13 -2
- package/build/toggle-group-control/toggle-group-control/as-radio-group.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/component.js +15 -8
- package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/styles.js +7 -7
- package/build/toggle-group-control/toggle-group-control/styles.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control-option-base/component.js +13 -20
- package/build/toggle-group-control/toggle-group-control-option-base/component.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control-option-base/styles.js +8 -9
- package/build/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
- package/build/toggle-group-control/types.js.map +1 -1
- package/build/toolbar/toolbar/index.js.map +1 -1
- package/build/tools-panel/styles.js.map +1 -1
- package/build/unit-control/index.js.map +1 -1
- package/build/unit-control/utils.js.map +1 -1
- package/build/utils/breakpoint.js.map +1 -1
- package/build/utils/colors-values.js.map +1 -1
- package/build/utils/config-values.js.map +1 -1
- package/build/utils/element-rect.js +22 -13
- package/build/utils/element-rect.js.map +1 -1
- package/build/utils/font-size.js.map +1 -1
- package/build/utils/hooks/use-animated-offset-rect.js +80 -0
- package/build/utils/hooks/use-animated-offset-rect.js.map +1 -0
- package/build/utils/hooks/use-cx.js.map +1 -1
- package/build/utils/hooks/use-on-value-update.js +3 -7
- package/build/utils/hooks/use-on-value-update.js.map +1 -1
- package/build/utils/math.js +2 -2
- package/build/utils/math.js.map +1 -1
- package/build/utils/space.js.map +1 -1
- package/build/utils/unit-values.js.map +1 -1
- package/build/utils/use-responsive-value.js.map +1 -1
- package/build-module/alignment-matrix-control/cell.js +1 -2
- package/build-module/alignment-matrix-control/cell.js.map +1 -1
- package/build-module/alignment-matrix-control/icon.js.map +1 -1
- package/build-module/alignment-matrix-control/types.js.map +1 -1
- package/build-module/alignment-matrix-control/utils.js.map +1 -1
- package/build-module/angle-picker-control/angle-circle.js.map +1 -1
- package/build-module/angle-picker-control/index.js +1 -2
- package/build-module/angle-picker-control/index.js.map +1 -1
- package/build-module/autocomplete/autocompleter-ui.js +4 -6
- package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
- package/build-module/autocomplete/autocompleter-ui.native.js +1 -2
- package/build-module/autocomplete/autocompleter-ui.native.js.map +1 -1
- package/build-module/autocomplete/get-default-use-items.js.map +1 -1
- package/build-module/autocomplete/index.js +6 -4
- package/build-module/autocomplete/index.js.map +1 -1
- package/build-module/base-control/hooks.js.map +1 -1
- package/build-module/base-control/index.js +1 -2
- package/build-module/base-control/index.js.map +1 -1
- package/build-module/base-control/index.native.js +1 -2
- package/build-module/base-control/index.native.js.map +1 -1
- package/build-module/border-box-control/border-box-control/component.js +4 -16
- package/build-module/border-box-control/border-box-control/component.js.map +1 -1
- package/build-module/border-box-control/border-box-control/hook.js.map +1 -1
- package/build-module/border-box-control/border-box-control-split-controls/component.js +1 -2
- package/build-module/border-box-control/border-box-control-split-controls/component.js.map +1 -1
- package/build-module/border-box-control/styles.js.map +1 -1
- package/build-module/border-box-control/utils.js.map +1 -1
- package/build-module/border-control/border-control/component.js +2 -4
- package/build-module/border-control/border-control/component.js.map +1 -1
- package/build-module/border-control/border-control/hook.js.map +1 -1
- package/build-module/border-control/border-control-dropdown/component.js +3 -17
- package/build-module/border-control/border-control-dropdown/component.js.map +1 -1
- package/build-module/border-control/styles.js +13 -13
- package/build-module/border-control/styles.js.map +1 -1
- package/build-module/border-control/types.js.map +1 -1
- package/build-module/box-control/all-input-control.js +1 -3
- package/build-module/box-control/all-input-control.js.map +1 -1
- package/build-module/box-control/axial-input-controls.js +1 -3
- package/build-module/box-control/axial-input-controls.js.map +1 -1
- package/build-module/box-control/icon.js +1 -2
- package/build-module/box-control/icon.js.map +1 -1
- package/build-module/box-control/index.js +5 -6
- package/build-module/box-control/index.js.map +1 -1
- package/build-module/box-control/input-controls.js +1 -3
- package/build-module/box-control/input-controls.js.map +1 -1
- package/build-module/box-control/types.js.map +1 -1
- package/build-module/button/index.js +1 -3
- package/build-module/button/index.js.map +1 -1
- package/build-module/button/index.native.js +2 -3
- package/build-module/button/index.native.js.map +1 -1
- package/build-module/card/card/component.js +2 -3
- package/build-module/card/card/component.js.map +1 -1
- package/build-module/card/styles.js.map +1 -1
- package/build-module/checkbox-control/index.js +1 -2
- package/build-module/checkbox-control/index.js.map +1 -1
- package/build-module/circular-option-picker/circular-option-picker-option.js +1 -2
- package/build-module/circular-option-picker/circular-option-picker-option.js.map +1 -1
- package/build-module/circular-option-picker/circular-option-picker.js +1 -2
- package/build-module/circular-option-picker/circular-option-picker.js.map +1 -1
- package/build-module/color-indicator/index.native.js +1 -2
- package/build-module/color-indicator/index.native.js.map +1 -1
- package/build-module/color-palette/index.js +1 -2
- package/build-module/color-palette/index.js.map +1 -1
- package/build-module/color-palette/index.native.js +3 -4
- package/build-module/color-palette/index.native.js.map +1 -1
- package/build-module/color-picker/component.js +1 -2
- package/build-module/color-picker/component.js.map +1 -1
- package/build-module/color-picker/hsl-input.js +1 -3
- package/build-module/color-picker/hsl-input.js.map +1 -1
- package/build-module/color-picker/hsv-color-picker.native.js +1 -2
- package/build-module/color-picker/hsv-color-picker.native.js.map +1 -1
- package/build-module/color-picker/hue-picker.native.js +1 -2
- package/build-module/color-picker/hue-picker.native.js.map +1 -1
- package/build-module/color-picker/index.native.js +1 -3
- package/build-module/color-picker/index.native.js.map +1 -1
- package/build-module/color-picker/input-with-slider.js +1 -2
- package/build-module/color-picker/input-with-slider.js.map +1 -1
- package/build-module/color-picker/rgb-input.js +1 -3
- package/build-module/color-picker/rgb-input.js.map +1 -1
- package/build-module/color-picker/saturation-picker.native.js +1 -2
- package/build-module/color-picker/saturation-picker.native.js.map +1 -1
- package/build-module/color-picker/styles.js.map +1 -1
- package/build-module/combobox-control/index.js +2 -3
- package/build-module/combobox-control/index.js.map +1 -1
- package/build-module/composite/legacy/index.js.map +1 -1
- package/build-module/confirm-dialog/component.js +1 -3
- package/build-module/confirm-dialog/component.js.map +1 -1
- package/build-module/context/context-connect.js +1 -0
- package/build-module/context/context-connect.js.map +1 -1
- package/build-module/context/context-system-provider.js +1 -1
- package/build-module/context/context-system-provider.js.map +1 -1
- package/build-module/context/get-styled-class-name-from-key.js.map +1 -1
- package/build-module/custom-gradient-picker/gradient-bar/control-points.js +1 -3
- package/build-module/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
- package/build-module/custom-gradient-picker/gradient-bar/index.js +1 -2
- package/build-module/custom-gradient-picker/gradient-bar/index.js.map +1 -1
- package/build-module/custom-gradient-picker/index.js +1 -2
- package/build-module/custom-gradient-picker/index.js.map +1 -1
- package/build-module/custom-gradient-picker/index.native.js +1 -3
- package/build-module/custom-gradient-picker/index.native.js.map +1 -1
- package/build-module/custom-gradient-picker/serializer.js.map +1 -1
- package/build-module/custom-gradient-picker/utils.js.map +1 -1
- package/build-module/custom-select-control/index.js +1 -3
- package/build-module/custom-select-control/index.js.map +1 -1
- package/build-module/custom-select-control-v2/custom-select.js +1 -2
- package/build-module/custom-select-control-v2/custom-select.js.map +1 -1
- package/build-module/custom-select-control-v2/item.js +1 -2
- package/build-module/custom-select-control-v2/item.js.map +1 -1
- package/build-module/custom-select-control-v2/styles.js.map +1 -1
- package/build-module/dashicon/index.js.map +1 -1
- package/build-module/date-time/date/index.js +1 -2
- package/build-module/date-time/date/index.js.map +1 -1
- package/build-module/date-time/date/styles.js.map +1 -1
- package/build-module/date-time/date-time/index.js +1 -3
- package/build-module/date-time/date-time/index.js.map +1 -1
- package/build-module/date-time/time/index.js +1 -2
- package/build-module/date-time/time/index.js.map +1 -1
- package/build-module/date-time/time/time-input/index.js +1 -2
- package/build-module/date-time/time/time-input/index.js.map +1 -1
- package/build-module/date-time/time/timezone.js.map +1 -1
- package/build-module/dimension-control/index.js +1 -3
- package/build-module/dimension-control/index.js.map +1 -1
- package/build-module/draggable/index.js +1 -3
- package/build-module/draggable/index.js.map +1 -1
- package/build-module/drop-zone/index.js +1 -2
- package/build-module/drop-zone/index.js.map +1 -1
- package/build-module/dropdown/index.js +1 -2
- package/build-module/dropdown/index.js.map +1 -1
- package/build-module/dropdown/index.native.js +1 -2
- package/build-module/dropdown/index.native.js.map +1 -1
- package/build-module/dropdown-menu/index.js +1 -2
- package/build-module/dropdown-menu/index.js.map +1 -1
- package/build-module/dropdown-menu/index.native.js +1 -2
- package/build-module/dropdown-menu/index.native.js.map +1 -1
- package/build-module/dropdown-menu-v2/checkbox-item.js +1 -2
- package/build-module/dropdown-menu-v2/checkbox-item.js.map +1 -1
- package/build-module/dropdown-menu-v2/index.js +1 -3
- package/build-module/dropdown-menu-v2/index.js.map +1 -1
- package/build-module/dropdown-menu-v2/item.js +1 -2
- package/build-module/dropdown-menu-v2/item.js.map +1 -1
- package/build-module/dropdown-menu-v2/radio-item.js +1 -2
- package/build-module/dropdown-menu-v2/radio-item.js.map +1 -1
- package/build-module/dropdown-menu-v2/styles.js.map +1 -1
- package/build-module/duotone-picker/color-list-picker/index.js +1 -3
- package/build-module/duotone-picker/color-list-picker/index.js.map +1 -1
- package/build-module/duotone-picker/duotone-picker.js +1 -2
- package/build-module/duotone-picker/duotone-picker.js.map +1 -1
- package/build-module/duotone-picker/utils.js.map +1 -1
- package/build-module/elevation/hook.js.map +1 -1
- package/build-module/external-link/index.js +21 -25
- package/build-module/external-link/index.js.map +1 -1
- package/build-module/external-link/index.native.js +1 -2
- package/build-module/external-link/index.native.js.map +1 -1
- package/build-module/focal-point-picker/controls.js +1 -2
- package/build-module/focal-point-picker/controls.js.map +1 -1
- package/build-module/focal-point-picker/focal-point.native.js +1 -2
- package/build-module/focal-point-picker/focal-point.native.js.map +1 -1
- package/build-module/focal-point-picker/grid.js +1 -2
- package/build-module/focal-point-picker/grid.js.map +1 -1
- package/build-module/focal-point-picker/index.js +1 -2
- package/build-module/focal-point-picker/index.js.map +1 -1
- package/build-module/focal-point-picker/index.native.js +1 -2
- package/build-module/focal-point-picker/index.native.js.map +1 -1
- package/build-module/focal-point-picker/styles/focal-point-style.js.map +1 -1
- package/build-module/focal-point-picker/tooltip/index.native.js +1 -2
- package/build-module/focal-point-picker/tooltip/index.native.js.map +1 -1
- package/build-module/font-size-picker/index.js +1 -2
- package/build-module/font-size-picker/index.js.map +1 -1
- package/build-module/font-size-picker/index.native.js +1 -3
- package/build-module/font-size-picker/index.native.js.map +1 -1
- package/build-module/form-file-upload/index.js +1 -2
- package/build-module/form-file-upload/index.js.map +1 -1
- package/build-module/form-toggle/index.js +1 -2
- package/build-module/form-toggle/index.js.map +1 -1
- package/build-module/form-token-field/index.js +3 -3
- package/build-module/form-token-field/index.js.map +1 -1
- package/build-module/form-token-field/suggestions-list.js +1 -2
- package/build-module/form-token-field/suggestions-list.js.map +1 -1
- package/build-module/form-token-field/token-input.js.map +1 -1
- package/build-module/form-token-field/token.js +2 -3
- package/build-module/form-token-field/token.js.map +1 -1
- package/build-module/gradient-picker/index.js +1 -2
- package/build-module/gradient-picker/index.js.map +1 -1
- package/build-module/grid/hook.js.map +1 -1
- package/build-module/guide/index.js +1 -2
- package/build-module/guide/index.js.map +1 -1
- package/build-module/guide/page-control.js +1 -1
- package/build-module/guide/page-control.js.map +1 -1
- package/build-module/h-stack/hook.js.map +1 -1
- package/build-module/heading/hook.js.map +1 -1
- package/build-module/higher-order/with-fallback-styles/index.js +3 -4
- package/build-module/higher-order/with-fallback-styles/index.js.map +1 -1
- package/build-module/index.js +14 -4
- package/build-module/index.js.map +1 -1
- package/build-module/input-control/index.js.map +1 -1
- package/build-module/input-control/input-base.js +1 -2
- package/build-module/input-control/input-base.js.map +1 -1
- package/build-module/input-control/styles/input-control-styles.js.map +1 -1
- package/build-module/item-group/styles.js.map +1 -1
- package/build-module/keyboard-shortcuts/index.js +1 -3
- package/build-module/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/menu-group/index.js +1 -2
- package/build-module/menu-group/index.js.map +1 -1
- package/build-module/menu-item/index.js +1 -2
- package/build-module/menu-item/index.js.map +1 -1
- package/build-module/menu-items-choice/index.js +1 -2
- package/build-module/menu-items-choice/index.js.map +1 -1
- package/build-module/mobile/badge/index.native.js +1 -3
- package/build-module/mobile/badge/index.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +1 -2
- package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/cell.native.js +5 -6
- package/build-module/mobile/bottom-sheet/cell.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/color-cell.native.js +1 -2
- package/build-module/mobile/bottom-sheet/color-cell.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/index.native.js +1 -3
- package/build-module/mobile/bottom-sheet/index.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/link-suggestion-item-cell.native.js +1 -2
- package/build-module/mobile/bottom-sheet/link-suggestion-item-cell.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/nav-bar/back-button.native.js +1 -2
- package/build-module/mobile/bottom-sheet/nav-bar/back-button.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/range-cell.native.js +2 -3
- package/build-module/mobile/bottom-sheet/range-cell.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/range-text-input.native.js +1 -2
- package/build-module/mobile/bottom-sheet/range-text-input.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/stepper-cell/index.native.js +2 -3
- package/build-module/mobile/bottom-sheet/stepper-cell/index.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/stepper-cell/stepper.android.js +1 -2
- package/build-module/mobile/bottom-sheet/stepper-cell/stepper.android.js.map +1 -1
- package/build-module/mobile/bottom-sheet/stepper-cell/stepper.ios.js +1 -2
- package/build-module/mobile/bottom-sheet/stepper-cell/stepper.ios.js.map +1 -1
- package/build-module/mobile/bottom-sheet/sub-sheet/index.native.js +1 -3
- package/build-module/mobile/bottom-sheet/sub-sheet/index.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/switch-cell.native.js +4 -4
- package/build-module/mobile/bottom-sheet/switch-cell.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet-select-control/index.native.js +1 -3
- package/build-module/mobile/bottom-sheet-select-control/index.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet-text-control/index.native.js +1 -3
- package/build-module/mobile/bottom-sheet-text-control/index.native.js.map +1 -1
- package/build-module/mobile/color-settings/gradient-picker-screen.native.js +1 -2
- package/build-module/mobile/color-settings/gradient-picker-screen.native.js.map +1 -1
- package/build-module/mobile/color-settings/index.native.js +1 -2
- package/build-module/mobile/color-settings/index.native.js.map +1 -1
- package/build-module/mobile/color-settings/palette.screen.native.js +1 -3
- package/build-module/mobile/color-settings/palette.screen.native.js.map +1 -1
- package/build-module/mobile/cycle-select-control/index.native.js.map +1 -1
- package/build-module/mobile/focal-point-settings-panel/index.native.js +1 -2
- package/build-module/mobile/focal-point-settings-panel/index.native.js.map +1 -1
- package/build-module/mobile/gradient/index.native.js +1 -2
- package/build-module/mobile/gradient/index.native.js.map +1 -1
- package/build-module/mobile/html-text-input/index.native.js +1 -2
- package/build-module/mobile/html-text-input/index.native.js.map +1 -1
- package/build-module/mobile/image/icon-retry.native.js +1 -2
- package/build-module/mobile/image/icon-retry.native.js.map +1 -1
- package/build-module/mobile/image/image-editing-button.native.js +1 -2
- package/build-module/mobile/image/image-editing-button.native.js.map +1 -1
- package/build-module/mobile/image/index.native.js +1 -3
- package/build-module/mobile/image/index.native.js.map +1 -1
- package/build-module/mobile/keyboard-avoiding-view/index.ios.js +1 -2
- package/build-module/mobile/keyboard-avoiding-view/index.ios.js.map +1 -1
- package/build-module/mobile/link-picker/index.native.js +2 -3
- package/build-module/mobile/link-picker/index.native.js.map +1 -1
- package/build-module/mobile/link-picker/link-picker-results.native.js.map +1 -1
- package/build-module/mobile/link-settings/index.native.js +1 -3
- package/build-module/mobile/link-settings/index.native.js.map +1 -1
- package/build-module/mobile/link-settings/link-settings-navigation.native.js +1 -2
- package/build-module/mobile/link-settings/link-settings-navigation.native.js.map +1 -1
- package/build-module/mobile/picker/index.android.js +1 -2
- package/build-module/mobile/picker/index.android.js.map +1 -1
- package/build-module/mobile/segmented-control/index.native.js +1 -2
- package/build-module/mobile/segmented-control/index.native.js.map +1 -1
- package/build-module/mobile/utils/get-px-from-css-unit.native.js.map +1 -1
- package/build-module/mobile/utils/use-unit-converter-to-mobile.native.js.map +1 -1
- package/build-module/modal/aria-helper.js +2 -1
- package/build-module/modal/aria-helper.js.map +1 -1
- package/build-module/modal/index.js +3 -4
- package/build-module/modal/index.js.map +1 -1
- package/build-module/modal/use-modal-exit-animation.js.map +1 -1
- package/build-module/navigation/back-button/index.js +1 -2
- package/build-module/navigation/back-button/index.js.map +1 -1
- package/build-module/navigation/group/index.js +1 -2
- package/build-module/navigation/group/index.js.map +1 -1
- package/build-module/navigation/item/base-content.js +1 -3
- package/build-module/navigation/item/base-content.js.map +1 -1
- package/build-module/navigation/item/base.js.map +1 -1
- package/build-module/navigation/item/index.js +1 -2
- package/build-module/navigation/item/index.js.map +1 -1
- package/build-module/navigation/menu/index.js +1 -2
- package/build-module/navigation/menu/index.js.map +1 -1
- package/build-module/navigation/menu/menu-title-search.js +2 -2
- package/build-module/navigation/menu/menu-title-search.js.map +1 -1
- package/build-module/navigation/menu/menu-title.js +1 -2
- package/build-module/navigation/menu/menu-title.js.map +1 -1
- package/build-module/navigation/menu/search-no-results-found.js +1 -2
- package/build-module/navigation/menu/search-no-results-found.js.map +1 -1
- package/build-module/navigation/styles/navigation-styles.js.map +1 -1
- package/build-module/navigator/index.js +130 -5
- package/build-module/navigator/index.js.map +1 -1
- package/build-module/navigator/legacy.js +167 -0
- package/build-module/navigator/legacy.js.map +1 -0
- package/build-module/navigator/{navigator-provider → navigator}/component.js +4 -39
- package/build-module/navigator/navigator/component.js.map +1 -0
- package/build-module/navigator/navigator-back-button/component.js +1 -37
- package/build-module/navigator/navigator-back-button/component.js.map +1 -1
- package/build-module/navigator/navigator-back-button/hook.js +1 -1
- package/build-module/navigator/navigator-back-button/hook.js.map +1 -1
- package/build-module/navigator/navigator-button/component.js +1 -36
- package/build-module/navigator/navigator-button/component.js.map +1 -1
- package/build-module/navigator/navigator-button/hook.js +1 -1
- package/build-module/navigator/navigator-button/hook.js.map +1 -1
- package/build-module/navigator/navigator-screen/component.js +39 -61
- package/build-module/navigator/navigator-screen/component.js.map +1 -1
- package/build-module/navigator/navigator-screen/use-screen-animate-presence.js +106 -0
- package/build-module/navigator/navigator-screen/use-screen-animate-presence.js.map +1 -0
- package/build-module/navigator/navigator-to-parent-button/component.js +2 -6
- package/build-module/navigator/navigator-to-parent-button/component.js.map +1 -1
- package/build-module/navigator/styles.js +77 -33
- package/build-module/navigator/styles.js.map +1 -1
- package/build-module/navigator/types.js.map +1 -1
- package/build-module/navigator/use-navigator.js +4 -1
- package/build-module/navigator/use-navigator.js.map +1 -1
- package/build-module/notice/index.js +1 -2
- package/build-module/notice/index.js.map +1 -1
- package/build-module/notice/index.native.js +1 -3
- package/build-module/notice/index.native.js.map +1 -1
- package/build-module/number-control/index.js +1 -3
- package/build-module/number-control/index.js.map +1 -1
- package/build-module/number-control/styles/number-control-styles.js.map +1 -1
- package/build-module/palette-edit/index.js +2 -4
- package/build-module/palette-edit/index.js.map +1 -1
- package/build-module/panel/actions.native.js +1 -2
- package/build-module/panel/actions.native.js.map +1 -1
- package/build-module/panel/body.js +1 -2
- package/build-module/panel/body.js.map +1 -1
- package/build-module/panel/body.native.js +1 -2
- package/build-module/panel/body.native.js.map +1 -1
- package/build-module/panel/header.js +1 -2
- package/build-module/panel/header.js.map +1 -1
- package/build-module/panel/index.js +1 -2
- package/build-module/panel/index.js.map +1 -1
- package/build-module/placeholder/index.js +1 -2
- package/build-module/placeholder/index.js.map +1 -1
- package/build-module/popover/index.js +2 -4
- package/build-module/popover/index.js.map +1 -1
- package/build-module/popover/overlay-middlewares.js.map +1 -1
- package/build-module/popover/utils.js.map +1 -1
- package/build-module/progress-bar/index.js +1 -2
- package/build-module/progress-bar/index.js.map +1 -1
- package/build-module/progress-bar/styles.js.map +1 -1
- package/build-module/query-controls/index.js.map +1 -1
- package/build-module/query-controls/index.native.js +1 -3
- package/build-module/query-controls/index.native.js.map +1 -1
- package/build-module/radio-control/index.js +1 -2
- package/build-module/radio-control/index.js.map +1 -1
- package/build-module/radio-control/index.native.js +1 -2
- package/build-module/radio-control/index.native.js.map +1 -1
- package/build-module/range-control/index.js +1 -2
- package/build-module/range-control/index.js.map +1 -1
- package/build-module/range-control/index.native.js.map +1 -1
- package/build-module/range-control/mark.js +1 -3
- package/build-module/range-control/mark.js.map +1 -1
- package/build-module/range-control/rail.js +1 -3
- package/build-module/range-control/rail.js.map +1 -1
- package/build-module/range-control/styles/range-control-styles.js +32 -32
- package/build-module/range-control/styles/range-control-styles.js.map +1 -1
- package/build-module/range-control/tooltip.js +1 -1
- package/build-module/range-control/tooltip.js.map +1 -1
- package/build-module/range-control/utils.js.map +1 -1
- package/build-module/resizable-box/index.js +1 -2
- package/build-module/resizable-box/index.js.map +1 -1
- package/build-module/resizable-box/resize-tooltip/index.js +1 -2
- package/build-module/resizable-box/resize-tooltip/index.js.map +1 -1
- package/build-module/resizable-box/resize-tooltip/label.js.map +1 -1
- package/build-module/resizable-box/resize-tooltip/utils.js.map +1 -1
- package/build-module/responsive-wrapper/index.js.map +1 -1
- package/build-module/sandbox/index.js +1 -2
- package/build-module/sandbox/index.js.map +1 -1
- package/build-module/sandbox/index.native.js +1 -2
- package/build-module/sandbox/index.native.js.map +1 -1
- package/build-module/search-control/index.js +11 -2
- package/build-module/search-control/index.js.map +1 -1
- package/build-module/search-control/index.native.js +1 -2
- package/build-module/search-control/index.native.js.map +1 -1
- package/build-module/search-control/types.js.map +1 -1
- package/build-module/select-control/index.js.map +1 -1
- package/build-module/select-control/index.native.js.map +1 -1
- package/build-module/slot-fill/index.js +1 -3
- package/build-module/slot-fill/index.js.map +1 -1
- package/build-module/slot-fill/slot.js +1 -2
- package/build-module/slot-fill/slot.js.map +1 -1
- package/build-module/snackbar/index.js +1 -2
- package/build-module/snackbar/index.js.map +1 -1
- package/build-module/snackbar/list.js +1 -2
- package/build-module/snackbar/list.js.map +1 -1
- package/build-module/spinner/index.js +1 -2
- package/build-module/spinner/index.js.map +1 -1
- package/build-module/spinner/styles.js.map +1 -1
- package/build-module/style-provider/index.js +1 -0
- package/build-module/style-provider/index.js.map +1 -1
- package/build-module/surface/hook.js.map +1 -1
- package/build-module/surface/styles.js.map +1 -1
- package/build-module/tab-panel/index.js +1 -2
- package/build-module/tab-panel/index.js.map +1 -1
- package/build-module/tabs/index.js.map +1 -1
- package/build-module/tabs/styles.js +28 -6
- package/build-module/tabs/styles.js.map +1 -1
- package/build-module/tabs/tab.js +9 -4
- package/build-module/tabs/tab.js.map +1 -1
- package/build-module/tabs/tablist.js +72 -40
- package/build-module/tabs/tablist.js.map +1 -1
- package/build-module/tabs/tabpanel.js.map +1 -1
- package/build-module/tabs/use-track-overflow.js +67 -0
- package/build-module/tabs/use-track-overflow.js.map +1 -0
- package/build-module/text/get-line-height.js.map +1 -1
- package/build-module/text/styles/text-mixins.native.js.map +1 -1
- package/build-module/text/utils.js.map +1 -1
- package/build-module/text-control/index.native.js.map +1 -1
- package/build-module/text-highlight/index.js +1 -2
- package/build-module/text-highlight/index.js.map +1 -1
- package/build-module/textarea-control/index.js.map +1 -1
- package/build-module/theme/color-algorithms.js.map +1 -1
- package/build-module/theme/styles.js.map +1 -1
- package/build-module/tip/index.js +1 -2
- package/build-module/tip/index.js.map +1 -1
- package/build-module/toggle-control/index.js +1 -2
- package/build-module/toggle-control/index.js.map +1 -1
- package/build-module/toggle-control/index.native.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control/as-button-group.js +4 -2
- package/build-module/toggle-group-control/toggle-group-control/as-button-group.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control/as-radio-group.js +14 -3
- package/build-module/toggle-group-control/toggle-group-control/as-radio-group.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control/component.js +17 -12
- 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 +7 -7
- 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/component.js +16 -25
- package/build-module/toggle-group-control/toggle-group-control-option-base/component.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js +7 -8
- package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
- package/build-module/toggle-group-control/types.js.map +1 -1
- package/build-module/toolbar/toolbar/index.js.map +1 -1
- package/build-module/toolbar/toolbar-button/toolbar-button-container.native.js +2 -2
- package/build-module/toolbar/toolbar-button/toolbar-button-container.native.js.map +1 -1
- package/build-module/toolbar/toolbar-group/index.js +1 -2
- package/build-module/toolbar/toolbar-group/index.js.map +1 -1
- package/build-module/tools-panel/styles.js.map +1 -1
- package/build-module/tools-panel/tools-panel/component.js +1 -2
- package/build-module/tools-panel/tools-panel/component.js.map +1 -1
- package/build-module/tools-panel/tools-panel-header/component.js +1 -3
- package/build-module/tools-panel/tools-panel-header/component.js.map +1 -1
- package/build-module/tooltip/index.js +1 -2
- package/build-module/tooltip/index.js.map +1 -1
- package/build-module/tooltip/index.native.js +1 -3
- package/build-module/tooltip/index.native.js.map +1 -1
- package/build-module/tree-grid/cell.js +1 -2
- package/build-module/tree-grid/cell.js.map +1 -1
- package/build-module/unit-control/index.js.map +1 -1
- package/build-module/unit-control/index.native.js +1 -3
- package/build-module/unit-control/index.native.js.map +1 -1
- package/build-module/unit-control/utils.js.map +1 -1
- package/build-module/utils/breakpoint.js.map +1 -1
- package/build-module/utils/colors-values.js.map +1 -1
- package/build-module/utils/config-values.js.map +1 -1
- package/build-module/utils/element-rect.js +22 -12
- package/build-module/utils/element-rect.js.map +1 -1
- package/build-module/utils/font-size.js.map +1 -1
- package/build-module/utils/hooks/use-animated-offset-rect.js +74 -0
- package/build-module/utils/hooks/use-animated-offset-rect.js.map +1 -0
- package/build-module/utils/hooks/use-cx.js.map +1 -1
- package/build-module/utils/hooks/use-on-value-update.js +3 -6
- package/build-module/utils/hooks/use-on-value-update.js.map +1 -1
- package/build-module/utils/math.js +2 -2
- package/build-module/utils/math.js.map +1 -1
- package/build-module/utils/space.js.map +1 -1
- package/build-module/utils/unit-values.js.map +1 -1
- package/build-module/utils/use-responsive-value.js.map +1 -1
- package/build-style/style-rtl.css +30 -14
- package/build-style/style.css +30 -14
- package/build-types/alignment-matrix-control/types.d.ts +2 -0
- package/build-types/alignment-matrix-control/types.d.ts.map +1 -1
- package/build-types/autocomplete/index.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control/component.d.ts +5 -15
- package/build-types/border-box-control/border-box-control/component.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control-split-controls/component.d.ts +2 -1
- package/build-types/border-box-control/border-box-control-split-controls/component.d.ts.map +1 -1
- package/build-types/border-box-control/stories/index.story.d.ts +3 -2
- package/build-types/border-box-control/stories/index.story.d.ts.map +1 -1
- package/build-types/border-control/border-control/component.d.ts +3 -2
- package/build-types/border-control/border-control/component.d.ts.map +1 -1
- package/build-types/border-control/border-control-dropdown/component.d.ts +2 -1
- package/build-types/border-control/border-control-dropdown/component.d.ts.map +1 -1
- package/build-types/border-control/border-control-style-picker/component.d.ts.map +1 -1
- package/build-types/border-control/stories/index.story.d.ts +15 -30
- package/build-types/border-control/stories/index.story.d.ts.map +1 -1
- package/build-types/border-control/styles.d.ts.map +1 -1
- package/build-types/border-control/types.d.ts +12 -7
- package/build-types/border-control/types.d.ts.map +1 -1
- package/build-types/box-control/index.d.ts +4 -4
- package/build-types/box-control/stories/index.story.d.ts.map +1 -1
- package/build-types/box-control/types.d.ts +3 -3
- package/build-types/composite/stories/index.story.d.ts +22 -0
- package/build-types/composite/stories/index.story.d.ts.map +1 -1
- package/build-types/dropdown/stories/index.story.d.ts.map +1 -1
- package/build-types/dropdown-menu/stories/index.story.d.ts.map +1 -1
- package/build-types/index.d.ts +23 -4
- package/build-types/index.d.ts.map +1 -1
- package/build-types/modal/aria-helper.d.ts.map +1 -1
- package/build-types/navigator/index.d.ts +171 -5
- package/build-types/navigator/index.d.ts.map +1 -1
- package/build-types/navigator/legacy.d.ts +226 -0
- package/build-types/navigator/legacy.d.ts.map +1 -0
- package/build-types/navigator/navigator/component.d.ts +3 -0
- package/build-types/navigator/navigator/component.d.ts.map +1 -0
- package/build-types/navigator/navigator-back-button/component.d.ts +0 -35
- package/build-types/navigator/navigator-back-button/component.d.ts.map +1 -1
- package/build-types/navigator/navigator-button/component.d.ts +0 -34
- package/build-types/navigator/navigator-button/component.d.ts.map +1 -1
- package/build-types/navigator/navigator-screen/component.d.ts +0 -35
- package/build-types/navigator/navigator-screen/component.d.ts.map +1 -1
- package/build-types/navigator/navigator-screen/use-screen-animate-presence.d.ts +16 -0
- package/build-types/navigator/navigator-screen/use-screen-animate-presence.d.ts.map +1 -0
- package/build-types/navigator/navigator-to-parent-button/component.d.ts +0 -4
- package/build-types/navigator/navigator-to-parent-button/component.d.ts.map +1 -1
- package/build-types/navigator/stories/index.story.d.ts +5 -5
- package/build-types/navigator/stories/index.story.d.ts.map +1 -1
- package/build-types/navigator/styles.d.ts +20 -7
- package/build-types/navigator/styles.d.ts.map +1 -1
- package/build-types/navigator/types.d.ts +19 -1
- package/build-types/navigator/types.d.ts.map +1 -1
- package/build-types/navigator/use-navigator.d.ts +4 -1
- package/build-types/navigator/use-navigator.d.ts.map +1 -1
- package/build-types/range-control/styles/range-control-styles.d.ts +1 -1
- package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
- package/build-types/search-control/index.d.ts.map +1 -1
- package/build-types/search-control/stories/index.story.d.ts +0 -8
- package/build-types/search-control/stories/index.story.d.ts.map +1 -1
- package/build-types/search-control/types.d.ts +3 -0
- package/build-types/search-control/types.d.ts.map +1 -1
- package/build-types/select-control/stories/index.story.d.ts +7 -0
- package/build-types/select-control/stories/index.story.d.ts.map +1 -1
- package/build-types/tabs/stories/index.story.d.ts +2 -1
- package/build-types/tabs/stories/index.story.d.ts.map +1 -1
- package/build-types/tabs/styles.d.ts +7 -0
- package/build-types/tabs/styles.d.ts.map +1 -1
- package/build-types/tabs/tab.d.ts.map +1 -1
- package/build-types/tabs/tablist.d.ts.map +1 -1
- package/build-types/tabs/use-track-overflow.d.ts +17 -0
- package/build-types/tabs/use-track-overflow.d.ts.map +1 -0
- package/build-types/toggle-group-control/toggle-group-control/as-button-group.d.ts +2 -2
- package/build-types/toggle-group-control/toggle-group-control/as-button-group.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control/as-radio-group.d.ts +2 -2
- package/build-types/toggle-group-control/toggle-group-control/as-radio-group.d.ts.map +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.map +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 +0 -1
- package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts.map +1 -1
- package/build-types/toggle-group-control/types.d.ts +2 -1
- package/build-types/toggle-group-control/types.d.ts.map +1 -1
- package/build-types/utils/element-rect.d.ts +8 -0
- package/build-types/utils/element-rect.d.ts.map +1 -1
- package/build-types/utils/hooks/use-animated-offset-rect.d.ts +62 -0
- package/build-types/utils/hooks/use-animated-offset-rect.d.ts.map +1 -0
- package/build-types/utils/hooks/use-on-value-update.d.ts.map +1 -1
- package/package.json +20 -20
- package/schemas/docs-manifest.json +38 -0
- package/src/alignment-matrix-control/README.md +46 -36
- package/src/alignment-matrix-control/docs-manifest.json +12 -0
- package/src/alignment-matrix-control/types.ts +2 -0
- package/src/angle-picker-control/README.md +36 -23
- package/src/angle-picker-control/docs-manifest.json +5 -0
- package/src/autocomplete/index.tsx +4 -1
- package/src/border-box-control/border-box-control/README.md +22 -26
- package/src/border-box-control/border-box-control/component.tsx +3 -14
- package/src/border-box-control/stories/index.story.tsx +2 -1
- package/src/border-control/border-control/README.md +26 -36
- package/src/border-control/border-control/component.tsx +1 -2
- package/src/border-control/border-control-dropdown/component.tsx +1 -15
- package/src/border-control/stories/index.story.tsx +4 -10
- package/src/border-control/styles.ts +0 -1
- package/src/border-control/test/index.js +2 -15
- package/src/border-control/types.ts +12 -7
- package/src/box-control/README.md +9 -12
- package/src/box-control/index.tsx +4 -4
- package/src/box-control/stories/index.story.tsx +1 -1
- package/src/box-control/types.ts +3 -3
- package/src/button/style.scss +5 -1
- package/src/composite/legacy/test/index.tsx +22 -21
- package/src/composite/stories/index.story.tsx +42 -0
- package/src/composite/test/index.tsx +629 -38
- package/src/dropdown/stories/index.story.tsx +1 -0
- package/src/dropdown/style.scss +10 -13
- package/src/dropdown-menu/stories/index.story.tsx +3 -0
- package/src/index.ts +19 -1
- package/src/menu-group/style.scss +4 -1
- package/src/menu-items-choice/style.scss +2 -0
- package/src/modal/aria-helper.ts +1 -0
- package/src/navigator/README.md +176 -0
- package/src/navigator/index.tsx +131 -0
- package/src/navigator/legacy.ts +169 -0
- package/src/navigator/{navigator-provider → navigator}/component.tsx +6 -44
- package/src/navigator/navigator-back-button/component.tsx +1 -37
- package/src/navigator/navigator-back-button/hook.ts +1 -1
- package/src/navigator/navigator-button/component.tsx +1 -36
- package/src/navigator/navigator-button/hook.ts +1 -1
- package/src/navigator/navigator-screen/component.tsx +48 -76
- package/src/navigator/navigator-screen/use-screen-animate-presence.ts +177 -0
- package/src/navigator/navigator-to-parent-button/component.tsx +2 -7
- package/src/navigator/stories/index.story.tsx +55 -54
- package/src/navigator/styles.ts +112 -41
- package/src/navigator/test/index.tsx +47 -47
- package/src/navigator/types.ts +19 -1
- package/src/navigator/use-navigator.ts +4 -1
- package/src/range-control/styles/range-control-styles.ts +19 -10
- package/src/range-control/tooltip.tsx +1 -1
- package/src/search-control/README.md +2 -0
- package/src/search-control/index.tsx +9 -2
- package/src/search-control/stories/index.story.tsx +0 -15
- package/src/search-control/test/index.tsx +4 -1
- package/src/search-control/types.ts +3 -0
- package/src/select-control/stories/index.story.tsx +14 -1
- package/src/tabs/stories/index.story.tsx +106 -0
- package/src/tabs/styles.ts +161 -58
- package/src/tabs/tab.tsx +8 -2
- package/src/tabs/tablist.tsx +72 -39
- package/src/tabs/use-track-overflow.ts +76 -0
- package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +208 -44
- package/src/toggle-group-control/test/index.tsx +26 -0
- package/src/toggle-group-control/toggle-group-control/as-button-group.tsx +18 -10
- package/src/toggle-group-control/toggle-group-control/as-radio-group.tsx +30 -12
- package/src/toggle-group-control/toggle-group-control/component.tsx +19 -6
- package/src/toggle-group-control/toggle-group-control/styles.ts +41 -0
- package/src/toggle-group-control/toggle-group-control-option-base/component.tsx +15 -28
- package/src/toggle-group-control/toggle-group-control-option-base/styles.ts +0 -11
- package/src/toggle-group-control/types.ts +3 -1
- package/src/tools-panel/tools-panel/README.md +10 -10
- package/src/utils/element-rect.ts +32 -15
- package/src/utils/hooks/use-animated-offset-rect.ts +107 -0
- package/src/utils/hooks/use-on-value-update.ts +3 -6
- package/tsconfig.tsbuildinfo +1 -1
- package/build/navigator/navigator-provider/component.js.map +0 -1
- package/build/utils/hooks/use-event.js +0 -41
- package/build/utils/hooks/use-event.js.map +0 -1
- package/build-module/navigator/navigator-provider/component.js.map +0 -1
- package/build-module/utils/hooks/use-event.js +0 -35
- package/build-module/utils/hooks/use-event.js.map +0 -1
- package/build-types/navigator/navigator-provider/component.d.ts +0 -37
- package/build-types/navigator/navigator-provider/component.d.ts.map +0 -1
- package/build-types/utils/hooks/use-event.d.ts +0 -20
- package/build-types/utils/hooks/use-event.d.ts.map +0 -1
- package/src/navigator/index.ts +0 -6
- package/src/navigator/navigator-back-button/README.md +0 -15
- package/src/navigator/navigator-button/README.md +0 -38
- package/src/navigator/navigator-provider/README.md +0 -94
- package/src/navigator/navigator-screen/README.md +0 -33
- package/src/navigator/navigator-to-parent-button/README.md +0 -17
- package/src/utils/hooks/use-event.ts +0 -38
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_numberControl","_interopRequireDefault","require","_selectControl","_rangeControl","_space","_utils","_button","_flex","_hStack","_configValues","NumberControlWrapper","exports","_base","default","NumberControl","process","env","NODE_ENV","target","label","space","SelectControl","InnerSelectControl","RangeControl","InnerRangeControl","interactiveHueStyles","AuxiliaryColorArtefactWrapper","AuxiliaryColorArtefactHStackHeader","HStack","ColorInputWrapper","Flex","ColorfulWrapper","boxSizingReset","CONFIG","radiusFull","borderWidthFocus","CopyButton","Button"],"sources":["@wordpress/components/src/color-picker/styles.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport styled from '@emotion/styled';\n\n/**\n * Internal dependencies\n */\nimport NumberControl from '../number-control';\nimport InnerSelectControl from '../select-control';\nimport InnerRangeControl from '../range-control';\nimport { space } from '../utils/space';\nimport { boxSizingReset } from '../utils';\nimport Button from '../button';\nimport { Flex } from '../flex';\nimport { HStack } from '../h-stack';\nimport CONFIG from '../utils/config-values';\n\nexport const NumberControlWrapper = styled( NumberControl )`\n\twidth: ${ space( 24 ) };\n`;\n\nexport const SelectControl = styled( InnerSelectControl )`\n\tmargin-left: ${ space( -2 ) };\n\twidth: 5em;\n`;\n\nexport const RangeControl = styled( InnerRangeControl )`\n\tflex: 1;\n\tmargin-right: ${ space( 2 ) };\n`;\n\n// Make the Hue circle picker not go out of the bar.\nconst interactiveHueStyles = `\n.react-colorful__interactive {\n\twidth: calc( 100% - ${ space( 2 ) } );\n\tmargin-left: ${ space( 1 ) };\n}`;\n\nexport const AuxiliaryColorArtefactWrapper = styled.div`\n\tpadding-top: ${ space( 2 ) };\n\tpadding-right: 0;\n\tpadding-left: 0;\n\tpadding-bottom: 0;\n`;\n\nexport const AuxiliaryColorArtefactHStackHeader = styled( HStack )`\n\tpadding-left: ${ space( 4 ) };\n\tpadding-right: ${ space( 4 ) };\n`;\n\nexport const ColorInputWrapper = styled( Flex )`\n\tpadding-top: ${ space( 4 ) };\n\tpadding-left: ${ space( 4 ) };\n\tpadding-right: ${ space( 3 ) };\n\tpadding-bottom: ${ space( 5 ) };\n`;\n\nexport const ColorfulWrapper = styled.div`\n\t${ boxSizingReset };\n\n\twidth: 216px;\n\n\t.react-colorful {\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\talign-items: center;\n\t\twidth: 216px;\n\t\theight: auto;\n\t}\n\n\t.react-colorful__saturation {\n\t\twidth: 100%;\n\t\tborder-radius: 0;\n\t\theight: 216px;\n\t\tmargin-bottom: ${ space( 4 ) };\n\t\tborder-bottom: none;\n\t}\n\n\t.react-colorful__hue,\n\t.react-colorful__alpha {\n\t\twidth: 184px;\n\t\theight: 16px;\n\t\tborder-radius: ${ CONFIG.radiusFull };\n\t\tmargin-bottom: ${ space( 2 ) };\n\t}\n\n\t.react-colorful__pointer {\n\t\theight: 16px;\n\t\twidth: 16px;\n\t\tborder: none;\n\t\tbox-shadow: 0 0 2px 0 rgba( 0, 0, 0, 0.25 );\n\n\t\t// Shown instead of box-shadow to Windows high contrast mode.\n\t\toutline: 2px solid transparent;\n\t}\n\n\t.react-colorful__pointer-fill {\n\t\tbox-shadow: inset 0 0 0 ${ CONFIG.borderWidthFocus } #fff;\n\t}\n\n\t${ interactiveHueStyles }\n`;\n\nexport const CopyButton = styled( Button )`\n\t&&&&& {\n\t\tmin-width: ${ space( 6 ) };\n\t\tpadding: 0;\n\n\t\t> svg {\n\t\t\tmargin-right: 0;\n\t\t}\n\t}\n`;\n"],"mappings":";;;;;;;;AAQA,IAAAA,cAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,cAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,aAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AACA,IAAAQ,aAAA,GAAAT,sBAAA,CAAAC,OAAA;AAhBA;AACA;AACA;;AAGA;AACA;AACA;;AAWO,MAAMS,oBAAoB,GAAAC,OAAA,CAAAD,oBAAA,gBAAG,IAAAE,KAAA,CAAAC,OAAA,EAAQC,sBAAa,EAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA;EAAAC,MAAA;AAAA;EAAAA,MAAA;EAAAC,KAAA;AAAA,CAAC,CAAC,WAChD,IAAAC,YAAK,EAAE,EAAG,CAAC,SAAAL,OAAA,CAAAC,GAAA,CAAAC,QAAA,gyHACrB;AAEM,MAAMI,aAAa,GAAAV,OAAA,CAAAU,aAAA,gBAAG,IAAAT,KAAA,CAAAC,OAAA,EAAQS,sBAAkB,EAAAP,OAAA,CAAAC,GAAA,CAAAC,QAAA;EAAAC,MAAA;AAAA;EAAAA,MAAA;EAAAC,KAAA;AAAA,CAAC,CAAC,iBACxC,IAAAC,YAAK,EAAE,CAAC,CAAE,CAAC,mBAAAL,OAAA,CAAAC,GAAA,CAAAC,QAAA,gyHAE3B;AAEM,MAAMM,YAAY,GAAAZ,OAAA,CAAAY,YAAA,gBAAG,IAAAX,KAAA,CAAAC,OAAA,EAAQW,qBAAiB,EAAAT,OAAA,CAAAC,GAAA,CAAAC,QAAA;EAAAC,MAAA;AAAA;EAAAA,MAAA;EAAAC,KAAA;AAAA,CAAC,CAAC,yBAErC,IAAAC,YAAK,EAAE,CAAE,CAAC,SAAAL,OAAA,CAAAC,GAAA,CAAAC,QAAA,gyHAC3B;;AAED;AACA,MAAMQ,oBAAoB,
|
|
1
|
+
{"version":3,"names":["_numberControl","_interopRequireDefault","require","_selectControl","_rangeControl","_space","_utils","_button","_flex","_hStack","_configValues","NumberControlWrapper","exports","_base","default","NumberControl","process","env","NODE_ENV","target","label","space","SelectControl","InnerSelectControl","RangeControl","InnerRangeControl","interactiveHueStyles","AuxiliaryColorArtefactWrapper","AuxiliaryColorArtefactHStackHeader","HStack","ColorInputWrapper","Flex","ColorfulWrapper","boxSizingReset","CONFIG","radiusFull","borderWidthFocus","CopyButton","Button"],"sources":["@wordpress/components/src/color-picker/styles.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport styled from '@emotion/styled';\n\n/**\n * Internal dependencies\n */\nimport NumberControl from '../number-control';\nimport InnerSelectControl from '../select-control';\nimport InnerRangeControl from '../range-control';\nimport { space } from '../utils/space';\nimport { boxSizingReset } from '../utils';\nimport Button from '../button';\nimport { Flex } from '../flex';\nimport { HStack } from '../h-stack';\nimport CONFIG from '../utils/config-values';\n\nexport const NumberControlWrapper = styled( NumberControl )`\n\twidth: ${ space( 24 ) };\n`;\n\nexport const SelectControl = styled( InnerSelectControl )`\n\tmargin-left: ${ space( -2 ) };\n\twidth: 5em;\n`;\n\nexport const RangeControl = styled( InnerRangeControl )`\n\tflex: 1;\n\tmargin-right: ${ space( 2 ) };\n`;\n\n// Make the Hue circle picker not go out of the bar.\nconst interactiveHueStyles = `\n.react-colorful__interactive {\n\twidth: calc( 100% - ${ space( 2 ) } );\n\tmargin-left: ${ space( 1 ) };\n}`;\n\nexport const AuxiliaryColorArtefactWrapper = styled.div`\n\tpadding-top: ${ space( 2 ) };\n\tpadding-right: 0;\n\tpadding-left: 0;\n\tpadding-bottom: 0;\n`;\n\nexport const AuxiliaryColorArtefactHStackHeader = styled( HStack )`\n\tpadding-left: ${ space( 4 ) };\n\tpadding-right: ${ space( 4 ) };\n`;\n\nexport const ColorInputWrapper = styled( Flex )`\n\tpadding-top: ${ space( 4 ) };\n\tpadding-left: ${ space( 4 ) };\n\tpadding-right: ${ space( 3 ) };\n\tpadding-bottom: ${ space( 5 ) };\n`;\n\nexport const ColorfulWrapper = styled.div`\n\t${ boxSizingReset };\n\n\twidth: 216px;\n\n\t.react-colorful {\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\talign-items: center;\n\t\twidth: 216px;\n\t\theight: auto;\n\t}\n\n\t.react-colorful__saturation {\n\t\twidth: 100%;\n\t\tborder-radius: 0;\n\t\theight: 216px;\n\t\tmargin-bottom: ${ space( 4 ) };\n\t\tborder-bottom: none;\n\t}\n\n\t.react-colorful__hue,\n\t.react-colorful__alpha {\n\t\twidth: 184px;\n\t\theight: 16px;\n\t\tborder-radius: ${ CONFIG.radiusFull };\n\t\tmargin-bottom: ${ space( 2 ) };\n\t}\n\n\t.react-colorful__pointer {\n\t\theight: 16px;\n\t\twidth: 16px;\n\t\tborder: none;\n\t\tbox-shadow: 0 0 2px 0 rgba( 0, 0, 0, 0.25 );\n\n\t\t// Shown instead of box-shadow to Windows high contrast mode.\n\t\toutline: 2px solid transparent;\n\t}\n\n\t.react-colorful__pointer-fill {\n\t\tbox-shadow: inset 0 0 0 ${ CONFIG.borderWidthFocus } #fff;\n\t}\n\n\t${ interactiveHueStyles }\n`;\n\nexport const CopyButton = styled( Button )`\n\t&&&&& {\n\t\tmin-width: ${ space( 6 ) };\n\t\tpadding: 0;\n\n\t\t> svg {\n\t\t\tmargin-right: 0;\n\t\t}\n\t}\n`;\n"],"mappings":";;;;;;;;AAQA,IAAAA,cAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,cAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,aAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AACA,IAAAQ,aAAA,GAAAT,sBAAA,CAAAC,OAAA;AAhBA;AACA;AACA;;AAGA;AACA;AACA;;AAWO,MAAMS,oBAAoB,GAAAC,OAAA,CAAAD,oBAAA,gBAAG,IAAAE,KAAA,CAAAC,OAAA,EAAQC,sBAAa,EAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA;EAAAC,MAAA;AAAA;EAAAA,MAAA;EAAAC,KAAA;AAAA,CAAC,CAAC,WAChD,IAAAC,YAAK,EAAE,EAAG,CAAC,SAAAL,OAAA,CAAAC,GAA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props) {
|
|
|
249
249
|
(0, _element.useEffect)(() => {
|
|
250
250
|
const hasMatchingSuggestions = matchingSuggestions.length > 0;
|
|
251
251
|
if (isExpanded) {
|
|
252
|
-
const message = hasMatchingSuggestions ? (0, _i18n.sprintf)(
|
|
252
|
+
const message = hasMatchingSuggestions ? (0, _i18n.sprintf)(/* translators: %d: number of results. */
|
|
253
253
|
(0, _i18n._n)('%d result found, use up and down arrow keys to navigate.', '%d results found, use up and down arrow keys to navigate.', matchingSuggestions.length), matchingSuggestions.length) : (0, _i18n.__)('No results.');
|
|
254
254
|
(0, _a11y.speak)(message, 'polite');
|
|
255
255
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_i18n","_element","_compose","_a11y","_icons","_styles","_tokenInput","_suggestionsList","_baseControl","_button","_flex","_withFocusOutside","_hooks","_strings","_useDeprecatedProps","_withIgnoreImeEvents","_jsxRuntime","noop","DetectOutside","withFocusOutside","Component","handleFocusOutside","event","props","onFocusOutside","render","children","getIndexOfMatchingSuggestion","selectedSuggestion","matchingSuggestions","indexOf","ComboboxControl","_currentOption$label","__nextHasNoMarginBottom","__next40pxDefaultSize","value","valueProp","label","options","onChange","onChangeProp","onFilterValueChange","hideLabelFromVision","help","allowReset","className","messages","selected","__","__experimentalRenderItem","expandOnFocus","placeholder","useDeprecated36pxDefaultSizeProp","setValue","useControlledValue","currentOption","find","option","currentLabel","instanceId","useInstanceId","setSelectedSuggestion","useState","isExpanded","setIsExpanded","inputHasFocus","setInputHasFocus","inputValue","setInputValue","inputContainer","useRef","useMemo","startsWithMatch","containsMatch","match","normalizeTextString","forEach","index","push","concat","onSuggestionSelected","newSelectedSuggestion","disabled","speak","handleArrowNavigation","offset","nextIndex","length","onKeyDown","withIgnoreIMEEvents","preventDefault","defaultPrevented","code","onBlur","onFocus","onClick","onInputChange","text","handleOnReset","current","focus","handleResetStopPropagation","stopPropagation","useEffect","hasMatchingSuggestions","hasSelectedMatchingSuggestions","message","sprintf","_n","jsx","default","__associatedWPComponentName","clsx","id","jsxs","tabIndex","InputWrapperFlex","FlexBlock","ref","selectedSuggestionIndex","FlexItem","icon","closeSmall","displayTransform","suggestion","suggestions","selectedIndex","onHover","onSelect","scrollIntoView","_default","exports"],"sources":["@wordpress/components/src/combobox-control/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport {\n\tComponent,\n\tuseState,\n\tuseMemo,\n\tuseRef,\n\tuseEffect,\n} from '@wordpress/element';\nimport { useInstanceId } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\nimport { closeSmall } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { InputWrapperFlex } from './styles';\nimport TokenInput from '../form-token-field/token-input';\nimport SuggestionsList from '../form-token-field/suggestions-list';\nimport BaseControl from '../base-control';\nimport Button from '../button';\nimport { FlexBlock, FlexItem } from '../flex';\nimport withFocusOutside from '../higher-order/with-focus-outside';\nimport { useControlledValue } from '../utils/hooks';\nimport { normalizeTextString } from '../utils/strings';\nimport type { ComboboxControlOption, ComboboxControlProps } from './types';\nimport type { TokenInputProps } from '../form-token-field/types';\nimport { useDeprecated36pxDefaultSizeProp } from '../utils/use-deprecated-props';\nimport { withIgnoreIMEEvents } from '../utils/with-ignore-ime-events';\n\nconst noop = () => {};\n\ninterface DetectOutsideComponentProps {\n\tonFocusOutside: ( event: React.FocusEvent ) => void;\n\tchildren?: React.ReactNode;\n}\n\nconst DetectOutside = withFocusOutside(\n\tclass extends Component< DetectOutsideComponentProps > {\n\t\thandleFocusOutside( event: React.FocusEvent ) {\n\t\t\tthis.props.onFocusOutside( event );\n\t\t}\n\n\t\trender() {\n\t\t\treturn this.props.children;\n\t\t}\n\t}\n);\n\nconst getIndexOfMatchingSuggestion = (\n\tselectedSuggestion: ComboboxControlOption | null,\n\tmatchingSuggestions: ComboboxControlOption[]\n) =>\n\tselectedSuggestion === null\n\t\t? -1\n\t\t: matchingSuggestions.indexOf( selectedSuggestion );\n\n/**\n * `ComboboxControl` is an enhanced version of a [`SelectControl`](../select-control/README.md) with the addition of\n * being able to search for options using a search input.\n *\n * ```jsx\n * import { ComboboxControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const options = [\n * \t{\n * \t\tvalue: 'small',\n * \t\tlabel: 'Small',\n * \t},\n * \t{\n * \t\tvalue: 'normal',\n * \t\tlabel: 'Normal',\n * \t\tdisabled: true,\n * \t},\n * \t{\n * \t\tvalue: 'large',\n * \t\tlabel: 'Large',\n * \t\tdisabled: false,\n * \t},\n * ];\n *\n * function MyComboboxControl() {\n * \tconst [ fontSize, setFontSize ] = useState();\n * \tconst [ filteredOptions, setFilteredOptions ] = useState( options );\n * \treturn (\n * \t\t<ComboboxControl\n * \t\t\t__nextHasNoMarginBottom\n * \t\t\tlabel=\"Font Size\"\n * \t\t\tvalue={ fontSize }\n * \t\t\tonChange={ setFontSize }\n * \t\t\toptions={ filteredOptions }\n * \t\t\tonFilterValueChange={ ( inputValue ) =>\n * \t\t\t\tsetFilteredOptions(\n * \t\t\t\t\toptions.filter( ( option ) =>\n * \t\t\t\t\t\toption.label\n * \t\t\t\t\t\t\t.toLowerCase()\n * \t\t\t\t\t\t\t.startsWith( inputValue.toLowerCase() )\n * \t\t\t\t\t)\n * \t\t\t\t)\n * \t\t\t}\n * \t\t/>\n * \t);\n * }\n * ```\n */\nfunction ComboboxControl( props: ComboboxControlProps ) {\n\tconst {\n\t\t__nextHasNoMarginBottom = false,\n\t\t__next40pxDefaultSize = false,\n\t\tvalue: valueProp,\n\t\tlabel,\n\t\toptions,\n\t\tonChange: onChangeProp,\n\t\tonFilterValueChange = noop,\n\t\thideLabelFromVision,\n\t\thelp,\n\t\tallowReset = true,\n\t\tclassName,\n\t\tmessages = {\n\t\t\tselected: __( 'Item selected.' ),\n\t\t},\n\t\t__experimentalRenderItem,\n\t\texpandOnFocus = true,\n\t\tplaceholder,\n\t} = useDeprecated36pxDefaultSizeProp( props );\n\n\tconst [ value, setValue ] = useControlledValue( {\n\t\tvalue: valueProp,\n\t\tonChange: onChangeProp,\n\t} );\n\n\tconst currentOption = options.find( ( option ) => option.value === value );\n\tconst currentLabel = currentOption?.label ?? '';\n\t// Use a custom prefix when generating the `instanceId` to avoid having\n\t// duplicate input IDs when rendering this component and `FormTokenField`\n\t// in the same page (see https://github.com/WordPress/gutenberg/issues/42112).\n\tconst instanceId = useInstanceId( ComboboxControl, 'combobox-control' );\n\tconst [ selectedSuggestion, setSelectedSuggestion ] = useState(\n\t\tcurrentOption || null\n\t);\n\tconst [ isExpanded, setIsExpanded ] = useState( false );\n\tconst [ inputHasFocus, setInputHasFocus ] = useState( false );\n\tconst [ inputValue, setInputValue ] = useState( '' );\n\tconst inputContainer = useRef< HTMLInputElement >( null );\n\n\tconst matchingSuggestions = useMemo( () => {\n\t\tconst startsWithMatch: ComboboxControlOption[] = [];\n\t\tconst containsMatch: ComboboxControlOption[] = [];\n\t\tconst match = normalizeTextString( inputValue );\n\t\toptions.forEach( ( option ) => {\n\t\t\tconst index = normalizeTextString( option.label ).indexOf( match );\n\t\t\tif ( index === 0 ) {\n\t\t\t\tstartsWithMatch.push( option );\n\t\t\t} else if ( index > 0 ) {\n\t\t\t\tcontainsMatch.push( option );\n\t\t\t}\n\t\t} );\n\n\t\treturn startsWithMatch.concat( containsMatch );\n\t}, [ inputValue, options ] );\n\n\tconst onSuggestionSelected = (\n\t\tnewSelectedSuggestion: ComboboxControlOption\n\t) => {\n\t\tif ( newSelectedSuggestion.disabled ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetValue( newSelectedSuggestion.value );\n\t\tspeak( messages.selected, 'assertive' );\n\t\tsetSelectedSuggestion( newSelectedSuggestion );\n\t\tsetInputValue( '' );\n\t\tsetIsExpanded( false );\n\t};\n\n\tconst handleArrowNavigation = ( offset = 1 ) => {\n\t\tconst index = getIndexOfMatchingSuggestion(\n\t\t\tselectedSuggestion,\n\t\t\tmatchingSuggestions\n\t\t);\n\t\tlet nextIndex = index + offset;\n\t\tif ( nextIndex < 0 ) {\n\t\t\tnextIndex = matchingSuggestions.length - 1;\n\t\t} else if ( nextIndex >= matchingSuggestions.length ) {\n\t\t\tnextIndex = 0;\n\t\t}\n\t\tsetSelectedSuggestion( matchingSuggestions[ nextIndex ] );\n\t\tsetIsExpanded( true );\n\t};\n\n\tconst onKeyDown: React.KeyboardEventHandler< HTMLDivElement > =\n\t\twithIgnoreIMEEvents( ( event ) => {\n\t\t\tlet preventDefault = false;\n\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tswitch ( event.code ) {\n\t\t\t\tcase 'Enter':\n\t\t\t\t\tif ( selectedSuggestion ) {\n\t\t\t\t\t\tonSuggestionSelected( selectedSuggestion );\n\t\t\t\t\t\tpreventDefault = true;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'ArrowUp':\n\t\t\t\t\thandleArrowNavigation( -1 );\n\t\t\t\t\tpreventDefault = true;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'ArrowDown':\n\t\t\t\t\thandleArrowNavigation( 1 );\n\t\t\t\t\tpreventDefault = true;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'Escape':\n\t\t\t\t\tsetIsExpanded( false );\n\t\t\t\t\tsetSelectedSuggestion( null );\n\t\t\t\t\tpreventDefault = true;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif ( preventDefault ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t} );\n\n\tconst onBlur = () => {\n\t\tsetInputHasFocus( false );\n\t};\n\n\tconst onFocus = () => {\n\t\tsetInputHasFocus( true );\n\t\tif ( expandOnFocus ) {\n\t\t\tsetIsExpanded( true );\n\t\t}\n\n\t\tonFilterValueChange( '' );\n\t\tsetInputValue( '' );\n\t};\n\n\tconst onClick = () => {\n\t\tsetIsExpanded( true );\n\t};\n\n\tconst onFocusOutside = () => {\n\t\tsetIsExpanded( false );\n\t};\n\n\tconst onInputChange: TokenInputProps[ 'onChange' ] = ( event ) => {\n\t\tconst text = event.value;\n\t\tsetInputValue( text );\n\t\tonFilterValueChange( text );\n\t\tif ( inputHasFocus ) {\n\t\t\tsetIsExpanded( true );\n\t\t}\n\t};\n\n\tconst handleOnReset = () => {\n\t\tsetValue( null );\n\t\tinputContainer.current?.focus();\n\t};\n\n\t// Stop propagation of the keydown event when pressing Enter on the Reset\n\t// button to prevent calling the onKeydown callback on the container div\n\t// element which actually sets the selected suggestion.\n\tconst handleResetStopPropagation: React.KeyboardEventHandler<\n\t\tHTMLButtonElement\n\t> = ( event ) => {\n\t\tevent.stopPropagation();\n\t};\n\n\t// Update current selections when the filter input changes.\n\tuseEffect( () => {\n\t\tconst hasMatchingSuggestions = matchingSuggestions.length > 0;\n\t\tconst hasSelectedMatchingSuggestions =\n\t\t\tgetIndexOfMatchingSuggestion(\n\t\t\t\tselectedSuggestion,\n\t\t\t\tmatchingSuggestions\n\t\t\t) > 0;\n\n\t\tif ( hasMatchingSuggestions && ! hasSelectedMatchingSuggestions ) {\n\t\t\t// If the current selection isn't present in the list of suggestions, then automatically select the first item from the list of suggestions.\n\t\t\tsetSelectedSuggestion( matchingSuggestions[ 0 ] );\n\t\t}\n\t}, [ matchingSuggestions, selectedSuggestion ] );\n\n\t// Announcements.\n\tuseEffect( () => {\n\t\tconst hasMatchingSuggestions = matchingSuggestions.length > 0;\n\t\tif ( isExpanded ) {\n\t\t\tconst message = hasMatchingSuggestions\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t/* translators: %d: number of results. */\n\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t'%d result found, use up and down arrow keys to navigate.',\n\t\t\t\t\t\t\t'%d results found, use up and down arrow keys to navigate.',\n\t\t\t\t\t\t\tmatchingSuggestions.length\n\t\t\t\t\t\t),\n\t\t\t\t\t\tmatchingSuggestions.length\n\t\t\t\t )\n\t\t\t\t: __( 'No results.' );\n\n\t\t\tspeak( message, 'polite' );\n\t\t}\n\t}, [ matchingSuggestions, isExpanded ] );\n\n\t// Disable reason: There is no appropriate role which describes the\n\t// input container intended accessible usability.\n\t// TODO: Refactor click detection to use blur to stop propagation.\n\t/* eslint-disable jsx-a11y/no-static-element-interactions */\n\treturn (\n\t\t<DetectOutside onFocusOutside={ onFocusOutside }>\n\t\t\t<BaseControl\n\t\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\t\t__associatedWPComponentName=\"ComboboxControl\"\n\t\t\t\tclassName={ clsx( className, 'components-combobox-control' ) }\n\t\t\t\tlabel={ label }\n\t\t\t\tid={ `components-form-token-input-${ instanceId }` }\n\t\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\t\thelp={ help }\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"components-combobox-control__suggestions-container\"\n\t\t\t\t\ttabIndex={ -1 }\n\t\t\t\t\tonKeyDown={ onKeyDown }\n\t\t\t\t>\n\t\t\t\t\t<InputWrapperFlex\n\t\t\t\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\t\t\t>\n\t\t\t\t\t\t<FlexBlock>\n\t\t\t\t\t\t\t<TokenInput\n\t\t\t\t\t\t\t\tclassName=\"components-combobox-control__input\"\n\t\t\t\t\t\t\t\tinstanceId={ instanceId }\n\t\t\t\t\t\t\t\tref={ inputContainer }\n\t\t\t\t\t\t\t\tplaceholder={ placeholder }\n\t\t\t\t\t\t\t\tvalue={ isExpanded ? inputValue : currentLabel }\n\t\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\t\tonBlur={ onBlur }\n\t\t\t\t\t\t\t\tonClick={ onClick }\n\t\t\t\t\t\t\t\tisExpanded={ isExpanded }\n\t\t\t\t\t\t\t\tselectedSuggestionIndex={ getIndexOfMatchingSuggestion(\n\t\t\t\t\t\t\t\t\tselectedSuggestion,\n\t\t\t\t\t\t\t\t\tmatchingSuggestions\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tonChange={ onInputChange }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</FlexBlock>\n\t\t\t\t\t\t{ allowReset && (\n\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tclassName=\"components-combobox-control__reset\"\n\t\t\t\t\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\t\t\t\t\t// Disable reason: Focus returns to input field when reset is clicked.\n\t\t\t\t\t\t\t\t\t// eslint-disable-next-line no-restricted-syntax\n\t\t\t\t\t\t\t\t\tdisabled={ ! value }\n\t\t\t\t\t\t\t\t\tonClick={ handleOnReset }\n\t\t\t\t\t\t\t\t\tonKeyDown={ handleResetStopPropagation }\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Reset' ) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</InputWrapperFlex>\n\t\t\t\t\t{ isExpanded && (\n\t\t\t\t\t\t<SuggestionsList\n\t\t\t\t\t\t\tinstanceId={ instanceId }\n\t\t\t\t\t\t\t// The empty string for `value` here is not actually used, but is\n\t\t\t\t\t\t\t// just a quick way to satisfy the TypeScript requirements of SuggestionsList.\n\t\t\t\t\t\t\t// See: https://github.com/WordPress/gutenberg/pull/47581/files#r1091089330\n\t\t\t\t\t\t\tmatch={ { label: inputValue, value: '' } }\n\t\t\t\t\t\t\tdisplayTransform={ ( suggestion ) =>\n\t\t\t\t\t\t\t\tsuggestion.label\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsuggestions={ matchingSuggestions }\n\t\t\t\t\t\t\tselectedIndex={ getIndexOfMatchingSuggestion(\n\t\t\t\t\t\t\t\tselectedSuggestion,\n\t\t\t\t\t\t\t\tmatchingSuggestions\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tonHover={ setSelectedSuggestion }\n\t\t\t\t\t\t\tonSelect={ onSuggestionSelected }\n\t\t\t\t\t\t\tscrollIntoView\n\t\t\t\t\t\t\t__experimentalRenderItem={\n\t\t\t\t\t\t\t\t__experimentalRenderItem\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</BaseControl>\n\t\t</DetectOutside>\n\t);\n\t/* eslint-enable jsx-a11y/no-static-element-interactions */\n}\n\nexport default ComboboxControl;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAOA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAKA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,gBAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,YAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,OAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,KAAA,GAAAX,OAAA;AACA,IAAAY,iBAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,MAAA,GAAAb,OAAA;AACA,IAAAc,QAAA,GAAAd,OAAA;AAGA,IAAAe,mBAAA,GAAAf,OAAA;AACA,IAAAgB,oBAAA,GAAAhB,OAAA;AAAsE,IAAAiB,WAAA,GAAAjB,OAAA;AAnCtE;AACA;AACA;;AAGA;AACA;AACA;;AAaA;AACA;AACA;;AAeA,MAAMkB,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AAOrB,MAAMC,aAAa,GAAG,IAAAC,yBAAgB,EACrC,cAAcC,kBAAS,CAAgC;EACtDC,kBAAk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G,aAAe;cACzBV,SAAS,EAAGa,0BAA4B;cACxChE,KAAK,EAAG,IAAAW,QAAE,EAAE,OAAQ;YAAG,CACvB;UAAC,CACO,CACV;QAAA,CACgB,CAAC,EACjBe,UAAU,iBACX,IAAA/C,WAAA,CAAA6F,GAAA,EAACtG,gBAAA,CAAAuG,OAAe;UACfnD,UAAU,EAAGA;UACb;UACA;UACA;UAAA;UACAe,KAAK,EAAG;YAAErC,KAAK,EAAE8B,UAAU;YAAEhC,KAAK,EAAE;UAAG,CAAG;UAC1CwF,gBAAgB,EAAKC,UAAU,IAC9BA,UAAU,CAACvF,KACX;UACDwF,WAAW,EAAGhG,mBAAqB;UACnCiG,aAAa,EAAGnG,4BAA4B,CAC3CC,kBAAkB,EAClBC,mBACD,CAAG;UACHkG,OAAO,EAAGlE,qBAAuB;UACjCmE,QAAQ,EAAGhD,oBAAsB;UACjCiD,cAAc;UACdhF,wBAAwB,EACvBA;QACA,CACD,CACD;MAAA,CACG;IAAC,CACM;EAAC,CACA,CAAC;EAEjB;AACD;AAAC,IAAAiF,QAAA,GAAAC,OAAA,CAAArB,OAAA,GAEc/E,eAAe","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_i18n","_element","_compose","_a11y","_icons","_styles","_tokenInput","_suggestionsList","_baseControl","_button","_flex","_withFocusOutside","_hooks","_strings","_useDeprecatedProps","_withIgnoreImeEvents","_jsxRuntime","noop","DetectOutside","withFocusOutside","Component","handleFocusOutside","event","props","onFocusOutside","render","children","getIndexOfMatchingSuggestion","selectedSuggestion","matchingSuggestions","indexOf","ComboboxControl","_currentOption$label","__nextHasNoMarginBottom","__next40pxDefaultSize","value","valueProp","label","options","onChange","onChangeProp","onFilterValueChange","hideLabelFromVision","help","allowReset","className","messages","selected","__","__experimentalRenderItem","expandOnFocus","placeholder","useDeprecated36pxDefaultSizeProp","setValue","useControlledValue","currentOption","find","option","currentLabel","instanceId","useInstanceId","setSelectedSuggestion","useState","isExpanded","setIsExpanded","inputHasFocus","setInputHasFocus","inputValue","setInputValue","inputContainer","useRef","useMemo","startsWithMatch","containsMatch","match","normalizeTextString","forEach","index","push","concat","onSuggestionSelected","newSelectedSuggestion","disabled","speak","handleArrowNavigation","offset","nextIndex","length","onKeyDown","withIgnoreIMEEvents","preventDefault","defaultPrevented","code","onBlur","onFocus","onClick","onInputChange","text","handleOnReset","current","focus","handleResetStopPropagation","stopPropagation","useEffect","hasMatchingSuggestions","hasSelectedMatchingSuggestions","message","sprintf","_n","jsx","default","__associatedWPComponentName","clsx","id","jsxs","tabIndex","InputWrapperFlex","FlexBlock","ref","selectedSuggestionIndex","FlexItem","icon","closeSmall","displayTransform","suggestion","suggestions","selectedIndex","onHover","onSelect","scrollIntoView","_default","exports"],"sources":["@wordpress/components/src/combobox-control/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport {\n\tComponent,\n\tuseState,\n\tuseMemo,\n\tuseRef,\n\tuseEffect,\n} from '@wordpress/element';\nimport { useInstanceId } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\nimport { closeSmall } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { InputWrapperFlex } from './styles';\nimport TokenInput from '../form-token-field/token-input';\nimport SuggestionsList from '../form-token-field/suggestions-list';\nimport BaseControl from '../base-control';\nimport Button from '../button';\nimport { FlexBlock, FlexItem } from '../flex';\nimport withFocusOutside from '../higher-order/with-focus-outside';\nimport { useControlledValue } from '../utils/hooks';\nimport { normalizeTextString } from '../utils/strings';\nimport type { ComboboxControlOption, ComboboxControlProps } from './types';\nimport type { TokenInputProps } from '../form-token-field/types';\nimport { useDeprecated36pxDefaultSizeProp } from '../utils/use-deprecated-props';\nimport { withIgnoreIMEEvents } from '../utils/with-ignore-ime-events';\n\nconst noop = () => {};\n\ninterface DetectOutsideComponentProps {\n\tonFocusOutside: ( event: React.FocusEvent ) => void;\n\tchildren?: React.ReactNode;\n}\n\nconst DetectOutside = withFocusOutside(\n\tclass extends Component< DetectOutsideComponentProps > {\n\t\thandleFocusOutside( event: React.FocusEvent ) {\n\t\t\tthis.props.onFocusOutside( event );\n\t\t}\n\n\t\trender() {\n\t\t\treturn this.props.children;\n\t\t}\n\t}\n);\n\nconst getIndexOfMatchingSuggestion = (\n\tselectedSuggestion: ComboboxControlOption | null,\n\tmatchingSuggestions: ComboboxControlOption[]\n) =>\n\tselectedSuggestion === null\n\t\t? -1\n\t\t: matchingSuggestions.indexOf( selectedSuggestion );\n\n/**\n * `ComboboxControl` is an enhanced version of a [`SelectControl`](../select-control/README.md) with the addition of\n * being able to search for options using a search input.\n *\n * ```jsx\n * import { ComboboxControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const options = [\n * \t{\n * \t\tvalue: 'small',\n * \t\tlabel: 'Small',\n * \t},\n * \t{\n * \t\tvalue: 'normal',\n * \t\tlabel: 'Normal',\n * \t\tdisabled: true,\n * \t},\n * \t{\n * \t\tvalue: 'large',\n * \t\tlabel: 'Large',\n * \t\tdisabled: false,\n * \t},\n * ];\n *\n * function MyComboboxControl() {\n * \tconst [ fontSize, setFontSize ] = useState();\n * \tconst [ filteredOptions, setFilteredOptions ] = useState( options );\n * \treturn (\n * \t\t<ComboboxControl\n * \t\t\t__nextHasNoMarginBottom\n * \t\t\tlabel=\"Font Size\"\n * \t\t\tvalue={ fontSize }\n * \t\t\tonChange={ setFontSize }\n * \t\t\toptions={ filteredOptions }\n * \t\t\tonFilterValueChange={ ( inputValue ) =>\n * \t\t\t\tsetFilteredOptions(\n * \t\t\t\t\toptions.filter( ( option ) =>\n * \t\t\t\t\t\toption.label\n * \t\t\t\t\t\t\t.toLowerCase()\n * \t\t\t\t\t\t\t.startsWith( inputValue.toLowerCase() )\n * \t\t\t\t\t)\n * \t\t\t\t)\n * \t\t\t}\n * \t\t/>\n * \t);\n * }\n * ```\n */\nfunction ComboboxControl( props: ComboboxControlProps ) {\n\tconst {\n\t\t__nextHasNoMarginBottom = false,\n\t\t__next40pxDefaultSize = false,\n\t\tvalue: valueProp,\n\t\tlabel,\n\t\toptions,\n\t\tonChange: onChangeProp,\n\t\tonFilterValueChange = noop,\n\t\thideLabelFromVision,\n\t\thelp,\n\t\tallowReset = true,\n\t\tclassName,\n\t\tmessages = {\n\t\t\tselected: __( 'Item selected.' ),\n\t\t},\n\t\t__experimentalRenderItem,\n\t\texpandOnFocus = true,\n\t\tplaceholder,\n\t} = useDeprecated36pxDefaultSizeProp( props );\n\n\tconst [ value, setValue ] = useControlledValue( {\n\t\tvalue: valueProp,\n\t\tonChange: onChangeProp,\n\t} );\n\n\tconst currentOption = options.find( ( option ) => option.value === value );\n\tconst currentLabel = currentOption?.label ?? '';\n\t// Use a custom prefix when generating the `instanceId` to avoid having\n\t// duplicate input IDs when rendering this component and `FormTokenField`\n\t// in the same page (see https://github.com/WordPress/gutenberg/issues/42112).\n\tconst instanceId = useInstanceId( ComboboxControl, 'combobox-control' );\n\tconst [ selectedSuggestion, setSelectedSuggestion ] = useState(\n\t\tcurrentOption || null\n\t);\n\tconst [ isExpanded, setIsExpanded ] = useState( false );\n\tconst [ inputHasFocus, setInputHasFocus ] = useState( false );\n\tconst [ inputValue, setInputValue ] = useState( '' );\n\tconst inputContainer = useRef< HTMLInputElement >( null );\n\n\tconst matchingSuggestions = useMemo( () => {\n\t\tconst startsWithMatch: ComboboxControlOption[] = [];\n\t\tconst containsMatch: ComboboxControlOption[] = [];\n\t\tconst match = normalizeTextString( inputValue );\n\t\toptions.forEach( ( option ) => {\n\t\t\tconst index = normalizeTextString( option.label ).indexOf( match );\n\t\t\tif ( index === 0 ) {\n\t\t\t\tstartsWithMatch.push( option );\n\t\t\t} else if ( index > 0 ) {\n\t\t\t\tcontainsMatch.push( option );\n\t\t\t}\n\t\t} );\n\n\t\treturn startsWithMatch.concat( containsMatch );\n\t}, [ inputValue, options ] );\n\n\tconst onSuggestionSelected = (\n\t\tnewSelectedSuggestion: ComboboxControlOption\n\t) => {\n\t\tif ( newSelectedSuggestion.disabled ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetValue( newSelectedSuggestion.value );\n\t\tspeak( messages.selected, 'assertive' );\n\t\tsetSelectedSuggestion( newSelectedSuggestion );\n\t\tsetInputValue( '' );\n\t\tsetIsExpanded( false );\n\t};\n\n\tconst handleArrowNavigation = ( offset = 1 ) => {\n\t\tconst index = getIndexOfMatchingSuggestion(\n\t\t\tselectedSuggestion,\n\t\t\tmatchingSuggestions\n\t\t);\n\t\tlet nextIndex = index + offset;\n\t\tif ( nextIndex < 0 ) {\n\t\t\tnextIndex = matchingSuggestions.length - 1;\n\t\t} else if ( nextIndex >= matchingSuggestions.length ) {\n\t\t\tnextIndex = 0;\n\t\t}\n\t\tsetSelectedSuggestion( matchingSuggestions[ nextIndex ] );\n\t\tsetIsExpanded( true );\n\t};\n\n\tconst onKeyDown: React.KeyboardEventHandler< HTMLDivElement > =\n\t\twithIgnoreIMEEvents( ( event ) => {\n\t\t\tlet preventDefault = false;\n\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tswitch ( event.code ) {\n\t\t\t\tcase 'Enter':\n\t\t\t\t\tif ( selectedSuggestion ) {\n\t\t\t\t\t\tonSuggestionSelected( selectedSuggestion );\n\t\t\t\t\t\tpreventDefault = true;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'ArrowUp':\n\t\t\t\t\thandleArrowNavigation( -1 );\n\t\t\t\t\tpreventDefault = true;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'ArrowDown':\n\t\t\t\t\thandleArrowNavigation( 1 );\n\t\t\t\t\tpreventDefault = true;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'Escape':\n\t\t\t\t\tsetIsExpanded( false );\n\t\t\t\t\tsetSelectedSuggestion( null );\n\t\t\t\t\tpreventDefault = true;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif ( preventDefault ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t} );\n\n\tconst onBlur = () => {\n\t\tsetInputHasFocus( false );\n\t};\n\n\tconst onFocus = () => {\n\t\tsetInputHasFocus( true );\n\t\tif ( expandOnFocus ) {\n\t\t\tsetIsExpanded( true );\n\t\t}\n\n\t\tonFilterValueChange( '' );\n\t\tsetInputValue( '' );\n\t};\n\n\tconst onClick = () => {\n\t\tsetIsExpanded( true );\n\t};\n\n\tconst onFocusOutside = () => {\n\t\tsetIsExpanded( false );\n\t};\n\n\tconst onInputChange: TokenInputProps[ 'onChange' ] = ( event ) => {\n\t\tconst text = event.value;\n\t\tsetInputValue( text );\n\t\tonFilterValueChange( text );\n\t\tif ( inputHasFocus ) {\n\t\t\tsetIsExpanded( true );\n\t\t}\n\t};\n\n\tconst handleOnReset = () => {\n\t\tsetValue( null );\n\t\tinputContainer.current?.focus();\n\t};\n\n\t// Stop propagation of the keydown event when pressing Enter on the Reset\n\t// button to prevent calling the onKeydown callback on the container div\n\t// element which actually sets the selected suggestion.\n\tconst handleResetStopPropagation: React.KeyboardEventHandler<\n\t\tHTMLButtonElement\n\t> = ( event ) => {\n\t\tevent.stopPropagation();\n\t};\n\n\t// Update current selections when the filter input changes.\n\tuseEffect( () => {\n\t\tconst hasMatchingSuggestions = matchingSuggestions.length > 0;\n\t\tconst hasSelectedMatchingSuggestions =\n\t\t\tgetIndexOfMatchingSuggestion(\n\t\t\t\tselectedSuggestion,\n\t\t\t\tmatchingSuggestions\n\t\t\t) > 0;\n\n\t\tif ( hasMatchingSuggestions && ! hasSelectedMatchingSuggestions ) {\n\t\t\t// If the current selection isn't present in the list of suggestions, then automatically select the first item from the list of suggestions.\n\t\t\tsetSelectedSuggestion( matchingSuggestions[ 0 ] );\n\t\t}\n\t}, [ matchingSuggestions, selectedSuggestion ] );\n\n\t// Announcements.\n\tuseEffect( () => {\n\t\tconst hasMatchingSuggestions = matchingSuggestions.length > 0;\n\t\tif ( isExpanded ) {\n\t\t\tconst message = hasMatchingSuggestions\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t/* translators: %d: number of results. */\n\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t'%d result found, use up and down arrow keys to navigate.',\n\t\t\t\t\t\t\t'%d results found, use up and down arrow keys to navigate.',\n\t\t\t\t\t\t\tmatchingSuggestions.length\n\t\t\t\t\t\t),\n\t\t\t\t\t\tmatchingSuggestions.length\n\t\t\t\t )\n\t\t\t\t: __( 'No results.' );\n\n\t\t\tspeak( message, 'polite' );\n\t\t}\n\t}, [ matchingSuggestions, isExpanded ] );\n\n\t// Disable reason: There is no appropriate role which describes the\n\t// input container intended accessible usability.\n\t// TODO: Refactor click detection to use blur to stop propagation.\n\t/* eslint-disable jsx-a11y/no-static-element-interactions */\n\treturn (\n\t\t<DetectOutside onFocusOutside={ onFocusOutside }>\n\t\t\t<BaseControl\n\t\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\t\t__associatedWPComponentName=\"ComboboxControl\"\n\t\t\t\tclassName={ clsx( className, 'components-combobox-control' ) }\n\t\t\t\tlabel={ label }\n\t\t\t\tid={ `components-form-token-input-${ instanceId }` }\n\t\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\t\thelp={ help }\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"components-combobox-control__suggestions-container\"\n\t\t\t\t\ttabIndex={ -1 }\n\t\t\t\t\tonKeyDown={ onKeyDown }\n\t\t\t\t>\n\t\t\t\t\t<InputWrapperFlex\n\t\t\t\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\t\t\t>\n\t\t\t\t\t\t<FlexBlock>\n\t\t\t\t\t\t\t<TokenInput\n\t\t\t\t\t\t\t\tclassName=\"components-combobox-control__input\"\n\t\t\t\t\t\t\t\tinstanceId={ instanceId }\n\t\t\t\t\t\t\t\tref={ inputContainer }\n\t\t\t\t\t\t\t\tplaceholder={ placeholder }\n\t\t\t\t\t\t\t\tvalue={ isExpanded ? inputValue : currentLabel }\n\t\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\t\tonBlur={ onBlur }\n\t\t\t\t\t\t\t\tonClick={ onClick }\n\t\t\t\t\t\t\t\tisExpanded={ isExpanded }\n\t\t\t\t\t\t\t\tselectedSuggestionIndex={ getIndexOfMatchingSuggestion(\n\t\t\t\t\t\t\t\t\tselectedSuggestion,\n\t\t\t\t\t\t\t\t\tmatchingSuggestions\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tonChange={ onInputChange }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</FlexBlock>\n\t\t\t\t\t\t{ allowReset && (\n\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tclassName=\"components-combobox-control__reset\"\n\t\t\t\t\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\t\t\t\t\t// Disable reason: Focus returns to input field when reset is clicked.\n\t\t\t\t\t\t\t\t\t// eslint-disable-next-line no-restricted-syntax\n\t\t\t\t\t\t\t\t\tdisabled={ ! value }\n\t\t\t\t\t\t\t\t\tonClick={ handleOnReset }\n\t\t\t\t\t\t\t\t\tonKeyDown={ handleResetStopPropagation }\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Reset' ) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</InputWrapperFlex>\n\t\t\t\t\t{ isExpanded && (\n\t\t\t\t\t\t<SuggestionsList\n\t\t\t\t\t\t\tinstanceId={ instanceId }\n\t\t\t\t\t\t\t// The empty string for `value` here is not actually used, but is\n\t\t\t\t\t\t\t// just a quick way to satisfy the TypeScript requirements of SuggestionsList.\n\t\t\t\t\t\t\t// See: https://github.com/WordPress/gutenberg/pull/47581/files#r1091089330\n\t\t\t\t\t\t\tmatch={ { label: inputValue, value: '' } }\n\t\t\t\t\t\t\tdisplayTransform={ ( suggestion ) =>\n\t\t\t\t\t\t\t\tsuggestion.label\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsuggestions={ matchingSuggestions }\n\t\t\t\t\t\t\tselectedIndex={ getIndexOfMatchingSuggestion(\n\t\t\t\t\t\t\t\tselectedSuggestion,\n\t\t\t\t\t\t\t\tmatchingSuggestions\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tonHover={ setSelectedSuggestion }\n\t\t\t\t\t\t\tonSelect={ onSuggestionSelected }\n\t\t\t\t\t\t\tscrollIntoView\n\t\t\t\t\t\t\t__experimentalRenderItem={\n\t\t\t\t\t\t\t\t__experimentalRenderItem\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</BaseControl>\n\t\t</DetectOutside>\n\t);\n\t/* eslint-enable jsx-a11y/no-static-element-interactions */\n}\n\nexport default ComboboxControl;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAOA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAKA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,gBAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,YAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,OAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,KAAA,GAAAX,OAAA;AACA,IAAAY,iBAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,MAAA,GAAAb,OAAA;AACA,IAAAc,QAAA,GAA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AAe,CAC1B;UAAC,CACQ,CAAC,EACVpD,UAAU,iBACX,IAAA5B,WAAA,CAAA6F,GAAA,EAACnG,KAAA,CAAA8G,QAAQ;YAAA9F,QAAA,eACR,IAAAV,WAAA,CAAA6F,GAAA,EAACpG,OAAA,CAAAqG,OAAM;cACNjE,SAAS,EAAC,oCAAoC;cAC9C4E,IAAI,EAAGC;cACP;cACA;cAAA;cACAxC,QAAQ,EAAG,CAAE/C,KAAO;cACpB4D,OAAO,EAAGG,aAAe;cACzBV,SAAS,EAAGa,0BAA4B;cACxChE,KAAK,EAAG,IAAAW,QAAE,EAAE,OAAQ;YAAG,CACvB;UAAC,CACO,CACV;QAAA,CACgB,CAAC,EACjBe,UAAU,iBACX,IAAA/C,WAAA,CAAA6F,GAAA,EAACtG,gBAAA,CAAAuG,OAAe;UACfnD,UAAU,EAAGA;UACb;UACA;UACA;UAAA;UACAe,KAAK,EAAG;YAAErC,KAAK,EAAE8B,UAAU;YAAEhC,KAAK,EAAE;UAAG,CAAG;UAC1CwF,gBAAgB,EAAKC,UAAU,IAC9BA,UAAU,CAACvF,KACX;UACDwF,WAAW,EAAGhG,mBAAqB;UACnCiG,aAAa,EAAGnG,4BAA4B,CAC3CC,kBAAkB,EAClBC,mBACD,CAAG;UACHkG,OAAO,EAAGlE,qBAAuB;UACjCmE,QAAQ,EAAGhD,oBAAsB;UACjCiD,cAAc;UACdhF,wBAAwB,EACvBA;QACA,CACD,CACD;MAAA,CACG;IAAC,CACM;EAAC,CACA,CAAC;EAEjB;AACD;AAAC,IAAAiF,QAAA,GAAAC,OAAA,CAAArB,OAAA,GAEc/E,eAAe","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Ariakit","_interopRequireWildcard","require","_element","_compose","_deprecated","_interopRequireDefault","_","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","mapLegacyStatePropsToComponentProps","legacyProps","state","rest","store","props","LEGACY_TO_NEW_DISPLAY_NAME","__unstableComposite","__unstableCompositeGroup","__unstableCompositeItem","__unstableUseCompositeState","proxyComposite","ProxiedComponent","propMap","_ProxiedComponent$dis","displayName","Component","deprecated","since","alternative","undefined","id","useInstanceId","baseId","entries","forEach","from","to","assign","jsx","UnproxiedCompositeGroup","forwardRef","role","ref","Current","Row","Group","Composite","exports","CompositeGroup","CompositeItem","Item","focusable","useCompositeState","legacyStateOptions","currentId","defaultActiveId","orientation","rtl","loop","focusLoop","wrap","focusWrap","shift","focusShift","unstable_virtual","virtualFocus","useCompositeStore"],"sources":["@wordpress/components/src/composite/legacy/index.tsx"],"sourcesContent":["/**\n * Composite is a component that may contain navigable items represented by\n * CompositeItem. It's inspired by the WAI-ARIA Composite Role and implements\n * all the keyboard navigation mechanisms to ensure that there's only one\n * tab stop for the whole Composite element. This means that it can behave as\n * a roving tabindex or aria-activedescendant container.\n *\n * This file aims at providing components that are as close as possible to the\n * original `reakit`-based implementation (which was removed from the codebase),\n * although it is recommended that consumers of the package switch to the stable,\n * un-prefixed, `ariakit`-based version of `Composite`.\n *\n * @see https://ariakit.org/components/composite\n */\n\n/**\n * External dependencies\n */\nimport * as Ariakit from '@ariakit/react';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\nimport { useInstanceId } from '@wordpress/compose';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { Composite as Current } from '..';\n\ntype Orientation = 'horizontal' | 'vertical';\n\nexport interface LegacyStateOptions {\n\t/**\n\t * ID that will serve as a base for all the items IDs.\n\t */\n\tbaseId?: string;\n\t/**\n\t * Determines how next and previous functions will behave. If `rtl` is set\n\t * to `true`, they will be inverted. This only affects the composite widget\n\t * behavior. You still need to set `dir=\"rtl\"` on HTML/CSS.\n\t *\n\t * @default false\n\t */\n\trtl?: boolean;\n\t/**\n\t * Defines the orientation of the composite widget. If the composite has a\n\t * single row or column (one-dimensional), the orientation value determines\n\t * which arrow keys can be used to move focus.\n\t */\n\torientation?: Orientation;\n\t/**\n\t * The current focused item `id`.\n\t */\n\tcurrentId?: string;\n\t/**\n\t * Determines how focus moves from the start and end of rows and columns.\n\t *\n\t * @default false\n\t */\n\tloop?: boolean | Orientation;\n\t/**\n\t * If enabled, moving to the next item from the last one in a row or column\n\t * will focus the first item in the next row or column and vice-versa.\n\t *\n\t * ** Has effect only on two-dimensional composites. **\n\t *\n\t * @default false\n\t */\n\twrap?: boolean | Orientation;\n\t/**\n\t * If enabled, moving up or down when there's no next item or the next item\n\t * is disabled will shift to the item right before it.\n\t *\n\t * ** Has effect only on two-dimensional composites. **\n\t *\n\t * @default false\n\t */\n\tshift?: boolean;\n\tunstable_virtual?: boolean;\n}\n\ntype Component = React.FunctionComponent< any >;\n\ntype CompositeStore = ReturnType< typeof Ariakit.useCompositeStore >;\ntype CompositeStoreState = { store: CompositeStore };\nexport type CompositeState = CompositeStoreState &\n\tRequired< Pick< LegacyStateOptions, 'baseId' > >;\n\n// Legacy composite components can either provide state through a\n// single `state` prop, or via individual props, usually through\n// spreading the state generated by `useCompositeState`.\n// That is, `<Composite* { ...state }>`.\nexport type CompositeStateProps =\n\t| { state: CompositeState }\n\t| ( CompositeState & { state?: never } );\ntype ComponentProps< C extends Component > = React.ComponentPropsWithRef< C >;\nexport type CompositeProps< C extends Component > = ComponentProps< C > &\n\tCompositeStateProps;\ntype CompositeComponent< C extends Component > = (\n\tprops: CompositeProps< C >\n) => React.ReactElement;\ntype CompositeComponentProps = CompositeState &\n\t(\n\t\t| ComponentProps< typeof Current.Group >\n\t\t| ComponentProps< typeof Current.Item >\n\t\t| ComponentProps< typeof Current.Row >\n\t);\n\nfunction mapLegacyStatePropsToComponentProps(\n\tlegacyProps: CompositeStateProps\n): CompositeComponentProps {\n\t// If a `state` prop is provided, we unpack that; otherwise,\n\t// the necessary props are provided directly in `legacyProps`.\n\tif ( legacyProps.state ) {\n\t\tconst { state, ...rest } = legacyProps;\n\t\tconst { store, ...props } =\n\t\t\tmapLegacyStatePropsToComponentProps( state );\n\t\treturn { ...rest, ...props, store };\n\t}\n\n\treturn legacyProps;\n}\n\nconst LEGACY_TO_NEW_DISPLAY_NAME = {\n\t__unstableComposite: 'Composite',\n\t__unstableCompositeGroup: 'Composite.Group or Composite.Row',\n\t__unstableCompositeItem: 'Composite.Item',\n\t__unstableUseCompositeState: 'Composite',\n};\n\nfunction proxyComposite< C extends Component >(\n\tProxiedComponent: C | React.ForwardRefExoticComponent< C >,\n\tpropMap: Record< string, string > = {}\n): CompositeComponent< C > {\n\tconst displayName = ProxiedComponent.displayName ?? '';\n\n\tconst Component = ( legacyProps: CompositeStateProps ) => {\n\t\tdeprecated( `wp.components.${ displayName }`, {\n\t\t\tsince: '6.7',\n\t\t\talternative: LEGACY_TO_NEW_DISPLAY_NAME.hasOwnProperty(\n\t\t\t\tdisplayName\n\t\t\t)\n\t\t\t\t? LEGACY_TO_NEW_DISPLAY_NAME[\n\t\t\t\t\t\tdisplayName as keyof typeof LEGACY_TO_NEW_DISPLAY_NAME\n\t\t\t\t ]\n\t\t\t\t: undefined,\n\t\t} );\n\n\t\tconst { store, ...rest } =\n\t\t\tmapLegacyStatePropsToComponentProps( legacyProps );\n\t\tconst props = rest as ComponentProps< C >;\n\t\tprops.id = useInstanceId( store, props.baseId, props.id );\n\n\t\tObject.entries( propMap ).forEach( ( [ from, to ] ) => {\n\t\t\tif ( props.hasOwnProperty( from ) ) {\n\t\t\t\tObject.assign( props, { [ to ]: props[ from ] } );\n\t\t\t\tdelete props[ from ];\n\t\t\t}\n\t\t} );\n\n\t\tdelete props.baseId;\n\n\t\treturn <ProxiedComponent { ...props } store={ store } />;\n\t};\n\tComponent.displayName = displayName;\n\treturn Component;\n}\n\n// The old `CompositeGroup` used to behave more like the current\n// `CompositeRow`, but this has been split into two different\n// components. We handle that difference by checking on the\n// provided role, and returning the appropriate component.\nconst UnproxiedCompositeGroup = forwardRef<\n\tany,\n\tReact.ComponentPropsWithoutRef< typeof Current.Group | typeof Current.Row >\n>( ( { role, ...props }, ref ) => {\n\tconst Component = role === 'row' ? Current.Row : Current.Group;\n\treturn <Component ref={ ref } role={ role } { ...props } />;\n} );\n\n/**\n * _Note: please use the `Composite` component instead._\n *\n * @deprecated\n */\nexport const Composite = proxyComposite(\n\tObject.assign( Current, { displayName: '__unstableComposite' } ),\n\t{ baseId: 'id' }\n);\n/**\n * _Note: please use the `Composite.Row` or `Composite.Group` components instead._\n *\n * @deprecated\n */\nexport const CompositeGroup = proxyComposite(\n\tObject.assign( UnproxiedCompositeGroup, {\n\t\tdisplayName: '__unstableCompositeGroup',\n\t} )\n);\n/**\n * _Note: please use the `Composite.Item` component instead._\n *\n * @deprecated\n */\nexport const CompositeItem = proxyComposite(\n\tObject.assign( Current.Item, {\n\t\tdisplayName: '__unstableCompositeItem',\n\t} ),\n\t{\n\t\tfocusable: 'accessibleWhenDisabled',\n\t}\n);\n\n/**\n * _Note: please use the `Composite` component instead._\n *\n * @deprecated\n */\nexport function useCompositeState(\n\tlegacyStateOptions: LegacyStateOptions = {}\n): CompositeState {\n\tdeprecated( `wp.components.__unstableUseCompositeState`, {\n\t\tsince: '6.7',\n\t\talternative: LEGACY_TO_NEW_DISPLAY_NAME.__unstableUseCompositeState,\n\t} );\n\n\tconst {\n\t\tbaseId,\n\t\tcurrentId: defaultActiveId,\n\t\torientation,\n\t\trtl = false,\n\t\tloop: focusLoop = false,\n\t\twrap: focusWrap = false,\n\t\tshift: focusShift = false,\n\t\t// eslint-disable-next-line camelcase\n\t\tunstable_virtual: virtualFocus,\n\t} = legacyStateOptions;\n\n\treturn {\n\t\tbaseId: useInstanceId( Composite, 'composite', baseId ),\n\t\tstore: Ariakit.useCompositeStore( {\n\t\t\tdefaultActiveId,\n\t\t\trtl,\n\t\t\torientation,\n\t\t\tfocusLoop,\n\t\t\tfocusShift,\n\t\t\tfocusWrap,\n\t\t\tvirtualFocus,\n\t\t} ),\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AC;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["Ariakit","_interopRequireWildcard","require","_element","_compose","_deprecated","_interopRequireDefault","_","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","mapLegacyStatePropsToComponentProps","legacyProps","state","rest","store","props","LEGACY_TO_NEW_DISPLAY_NAME","__unstableComposite","__unstableCompositeGroup","__unstableCompositeItem","__unstableUseCompositeState","proxyComposite","ProxiedComponent","propMap","_ProxiedComponent$dis","displayName","Component","deprecated","since","alternative","undefined","id","useInstanceId","baseId","entries","forEach","from","to","assign","jsx","UnproxiedCompositeGroup","forwardRef","role","ref","Current","Row","Group","Composite","exports","CompositeGroup","CompositeItem","Item","focusable","useCompositeState","legacyStateOptions","currentId","defaultActiveId","orientation","rtl","loop","focusLoop","wrap","focusWrap","shift","focusShift","unstable_virtual","virtualFocus","useCompositeStore"],"sources":["@wordpress/components/src/composite/legacy/index.tsx"],"sourcesContent":["/**\n * Composite is a component that may contain navigable items represented by\n * CompositeItem. It's inspired by the WAI-ARIA Composite Role and implements\n * all the keyboard navigation mechanisms to ensure that there's only one\n * tab stop for the whole Composite element. This means that it can behave as\n * a roving tabindex or aria-activedescendant container.\n *\n * This file aims at providing components that are as close as possible to the\n * original `reakit`-based implementation (which was removed from the codebase),\n * although it is recommended that consumers of the package switch to the stable,\n * un-prefixed, `ariakit`-based version of `Composite`.\n *\n * @see https://ariakit.org/components/composite\n */\n\n/**\n * External dependencies\n */\nimport * as Ariakit from '@ariakit/react';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\nimport { useInstanceId } from '@wordpress/compose';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { Composite as Current } from '..';\n\ntype Orientation = 'horizontal' | 'vertical';\n\nexport interface LegacyStateOptions {\n\t/**\n\t * ID that will serve as a base for all the items IDs.\n\t */\n\tbaseId?: string;\n\t/**\n\t * Determines how next and previous functions will behave. If `rtl` is set\n\t * to `true`, they will be inverted. This only affects the composite widget\n\t * behavior. You still need to set `dir=\"rtl\"` on HTML/CSS.\n\t *\n\t * @default false\n\t */\n\trtl?: boolean;\n\t/**\n\t * Defines the orientation of the composite widget. If the composite has a\n\t * single row or column (one-dimensional), the orientation value determines\n\t * which arrow keys can be used to move focus.\n\t */\n\torientation?: Orientation;\n\t/**\n\t * The current focused item `id`.\n\t */\n\tcurrentId?: string;\n\t/**\n\t * Determines how focus moves from the start and end of rows and columns.\n\t *\n\t * @default false\n\t */\n\tloop?: boolean | Orientation;\n\t/**\n\t * If enabled, moving to the next item from the last one in a row or column\n\t * will focus the first item in the next row or column and vice-versa.\n\t *\n\t * ** Has effect only on two-dimensional composites. **\n\t *\n\t * @default false\n\t */\n\twrap?: boolean | Orientation;\n\t/**\n\t * If enabled, moving up or down when there's no next item or the next item\n\t * is disabled will shift to the item right before it.\n\t *\n\t * ** Has effect only on two-dimensional composites. **\n\t *\n\t * @default false\n\t */\n\tshift?: boolean;\n\tunstable_virtual?: boolean;\n}\n\ntype Component = React.FunctionComponent< any >;\n\ntype CompositeStore = ReturnType< typeof Ariakit.useCompositeStore >;\ntype CompositeStoreState = { store: CompositeStore };\nexport type CompositeState = CompositeStoreState &\n\tRequired< Pick< LegacyStateOptions, 'baseId' > >;\n\n// Legacy composite components can either provide state through a\n// single `state` prop, or via individual props, usually through\n// spreading the state generated by `useCompositeState`.\n// That is, `<Composite* { ...state }>`.\nexport type CompositeStateProps =\n\t| { state: CompositeState }\n\t| ( CompositeState & { state?: never } );\ntype ComponentProps< C extends Component > = React.ComponentPropsWithRef< C >;\nexport type CompositeProps< C extends Component > = ComponentProps< C > &\n\tCompositeStateProps;\ntype CompositeComponent< C extends Component > = (\n\tprops: CompositeProps< C >\n) => React.ReactElement;\ntype CompositeComponentProps = CompositeState &\n\t(\n\t\t| ComponentProps< typeof Current.Group >\n\t\t| ComponentProps< typeof Current.Item >\n\t\t| ComponentProps< typeof Current.Row >\n\t);\n\nfunction mapLegacyStatePropsToComponentProps(\n\tlegacyProps: CompositeStateProps\n): CompositeComponentProps {\n\t// If a `state` prop is provided, we unpack that; otherwise,\n\t// the necessary props are provided directly in `legacyProps`.\n\tif ( legacyProps.state ) {\n\t\tconst { state, ...rest } = legacyProps;\n\t\tconst { store, ...props } =\n\t\t\tmapLegacyStatePropsToComponentProps( state );\n\t\treturn { ...rest, ...props, store };\n\t}\n\n\treturn legacyProps;\n}\n\nconst LEGACY_TO_NEW_DISPLAY_NAME = {\n\t__unstableComposite: 'Composite',\n\t__unstableCompositeGroup: 'Composite.Group or Composite.Row',\n\t__unstableCompositeItem: 'Composite.Item',\n\t__unstableUseCompositeState: 'Composite',\n};\n\nfunction proxyComposite< C extends Component >(\n\tProxiedComponent: C | React.ForwardRefExoticComponent< C >,\n\tpropMap: Record< string, string > = {}\n): CompositeComponent< C > {\n\tconst displayName = ProxiedComponent.displayName ?? '';\n\n\tconst Component = ( legacyProps: CompositeStateProps ) => {\n\t\tdeprecated( `wp.components.${ displayName }`, {\n\t\t\tsince: '6.7',\n\t\t\talternative: LEGACY_TO_NEW_DISPLAY_NAME.hasOwnProperty(\n\t\t\t\tdisplayName\n\t\t\t)\n\t\t\t\t? LEGACY_TO_NEW_DISPLAY_NAME[\n\t\t\t\t\t\tdisplayName as keyof typeof LEGACY_TO_NEW_DISPLAY_NAME\n\t\t\t\t ]\n\t\t\t\t: undefined,\n\t\t} );\n\n\t\tconst { store, ...rest } =\n\t\t\tmapLegacyStatePropsToComponentProps( legacyProps );\n\t\tconst props = rest as ComponentProps< C >;\n\t\tprops.id = useInstanceId( store, props.baseId, props.id );\n\n\t\tObject.entries( propMap ).forEach( ( [ from, to ] ) => {\n\t\t\tif ( props.hasOwnProperty( from ) ) {\n\t\t\t\tObject.assign( props, { [ to ]: props[ from ] } );\n\t\t\t\tdelete props[ from ];\n\t\t\t}\n\t\t} );\n\n\t\tdelete props.baseId;\n\n\t\treturn <ProxiedComponent { ...props } store={ store } />;\n\t};\n\tComponent.displayName = displayName;\n\treturn Component;\n}\n\n// The old `CompositeGroup` used to behave more like the current\n// `CompositeRow`, but this has been split into two different\n// components. We handle that difference by checking on the\n// provided role, and returning the appropriate component.\nconst UnproxiedCompositeGroup = forwardRef<\n\tany,\n\tReact.ComponentPropsWithoutRef< typeof Current.Group | typeof Current.Row >\n>( ( { role, ...props }, ref ) => {\n\tconst Component = role === 'row' ? Current.Row : Current.Group;\n\treturn <Component ref={ ref } role={ role } { ...props } />;\n} );\n\n/**\n * _Note: please use the `Composite` component instead._\n *\n * @deprecated\n */\nexport const Composite = proxyComposite(\n\tObject.assign( Current, { displayName: '__unstableComposite' } ),\n\t{ baseId: 'id' }\n);\n/**\n * _Note: please use the `Composite.Row` or `Composite.Group` components instead._\n *\n * @deprecated\n */\nexport const CompositeGroup = proxyComposite(\n\tObject.assign( UnproxiedCompositeGroup, {\n\t\tdisplayName: '__unstableCompositeGroup',\n\t} )\n);\n/**\n * _Note: please use the `Composite.Item` component instead._\n *\n * @deprecated\n */\nexport const CompositeItem = proxyComposite(\n\tObject.assign( Current.Item, {\n\t\tdisplayName: '__unstableCompositeItem',\n\t} ),\n\t{\n\t\tfocusable: 'accessibleWhenDisabled',\n\t}\n);\n\n/**\n * _Note: please use the `Composite` component instead._\n *\n * @deprecated\n */\nexport function useCompositeState(\n\tlegacyStateOptions: LegacyStateOptions = {}\n): CompositeState {\n\tdeprecated( `wp.components.__unstableUseCompositeState`, {\n\t\tsince: '6.7',\n\t\talternative: LEGACY_TO_NEW_DISPLAY_NAME.__unstableUseCompositeState,\n\t} );\n\n\tconst {\n\t\tbaseId,\n\t\tcurrentId: defaultActiveId,\n\t\torientation,\n\t\trtl = false,\n\t\tloop: focusLoop = false,\n\t\twrap: focusWrap = false,\n\t\tshift: focusShift = false,\n\t\t// eslint-disable-next-line camelcase\n\t\tunstable_virtual: virtualFocus,\n\t} = legacyStateOptions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AE,IAAAD,sBAAa,EAAEe,SAAS,EAAE,WAAW,EAAEd,MAAO,CAAC;IACvDnB,KAAK,EAAEjC,OAAO,CAACsF,iBAAiB,CAAE;MACjCX,eAAe;MACfE,GAAG;MACHD,WAAW;MACXG,SAAS;MACTI,UAAU;MACVF,SAAS;MACTI;IACD,CAAE;EACH,CAAC;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_warning","_interopRequireDefault","_constants","_getStyledClassNameFromKey","contextConnect","Component","namespace","_contextConnect","forwardsRef","contextConnectWithoutRef","options","WrappedComponent","forwardRef","globalThis","SCRIPT_DEBUG","warn","mergedNamespace","CONNECT_STATIC_NAMESPACE","Array","isArray","Object","assign","Set","displayName","selector","getStyledClassNameFromKey","getConnectNamespace","namespaces","type","hasConnectNamespace","match","includes","some","result"],"sources":["@wordpress/components/src/context/context-connect.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef, ReactChild, ReactNode } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\nimport warn from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport { CONNECT_STATIC_NAMESPACE } from './constants';\nimport { getStyledClassNameFromKey } from './get-styled-class-name-from-key';\nimport type { WordPressComponentFromProps } from '.';\n\ntype AcceptsTwoArgs<\n\tF extends ( ...args: any ) => any,\n\tErrorMessage = never,\n> = Parameters< F >[ 'length' ] extends 2 ? {} : ErrorMessage;\n\ntype ContextConnectOptions = {\n\tforwardsRef?: boolean;\n};\n\n/**\n * Forwards ref (React.ForwardRef) and \"Connects\" (or registers) a component\n * within the Context system under a specified namespace.\n *\n * @param Component The component to register into the Context system.\n * @param namespace The namespace to register the component under.\n * @return The connected WordPressComponent\n */\nexport function contextConnect<\n\tC extends ( props: any, ref: ForwardedRef< any > ) => JSX.Element | null,\n>(\n\tComponent: C &\n\t\tAcceptsTwoArgs<\n\t\t\tC,\n\t\t\t'Warning: Your component function does not take a ref as the second argument. Did you mean to use `contextConnectWithoutRef`?'\n\t\t>,\n\tnamespace: string\n) {\n\treturn _contextConnect( Component, namespace, { forwardsRef: true } );\n}\n\n/**\n * \"Connects\" (or registers) a component within the Context system under a specified namespace.\n * Does not forward a ref.\n *\n * @param Component The component to register into the Context system.\n * @param namespace The namespace to register the component under.\n * @return The connected WordPressComponent\n */\nexport function contextConnectWithoutRef< P >(\n\tComponent: ( props: P ) => JSX.Element | null,\n\tnamespace: string\n) {\n\treturn _contextConnect( Component, namespace );\n}\n\n// This is an (experimental) evolution of the initial connect() HOC.\n// The hope is that we can improve render performance by removing functional\n// component wrappers.\nfunction _contextConnect<\n\tC extends ( props: any, ref: ForwardedRef< any > ) => JSX.Element | null,\n\tO extends ContextConnectOptions,\n>(\n\tComponent: C,\n\tnamespace: string,\n\toptions?: O\n): WordPressComponentFromProps<\n\tParameters< C >[ 0 ],\n\tO[ 'forwardsRef' ] extends true ? true : false\n> {\n\tconst WrappedComponent = options?.forwardsRef\n\t\t? forwardRef< any, Parameters< C >[ 0 ] >( Component )\n\t\t: Component;\n\n\tif ( typeof namespace === 'undefined' ) {\n\t\twarn( 'contextConnect: Please provide a namespace' );\n\t}\n\n\t// @ts-expect-error internal property\n\tlet mergedNamespace = WrappedComponent[ CONNECT_STATIC_NAMESPACE ] || [\n\t\tnamespace,\n\t];\n\n\t/**\n\t * Consolidate (merge) namespaces before attaching it to the WrappedComponent.\n\t */\n\tif ( Array.isArray( namespace ) ) {\n\t\tmergedNamespace = [ ...mergedNamespace, ...namespace ];\n\t}\n\tif ( typeof namespace === 'string' ) {\n\t\tmergedNamespace = [ ...mergedNamespace, namespace ];\n\t}\n\n\t// @ts-expect-error We can't rely on inferred types here because of the\n\t// `as` prop polymorphism we're handling in https://github.com/WordPress/gutenberg/blob/4f3a11243c365f94892e479bff0b922ccc4ccda3/packages/components/src/context/wordpress-component.ts#L32-L33\n\treturn Object.assign( WrappedComponent, {\n\t\t[ CONNECT_STATIC_NAMESPACE ]: [ ...new Set( mergedNamespace ) ],\n\t\tdisplayName: namespace,\n\t\tselector: `.${ getStyledClassNameFromKey( namespace ) }`,\n\t} );\n}\n\n/**\n * Attempts to retrieve the connected namespace from a component.\n *\n * @param Component The component to retrieve a namespace from.\n * @return The connected namespaces.\n */\nexport function getConnectNamespace(\n\tComponent: ReactChild | undefined | {}\n): string[] {\n\tif ( ! Component ) {\n\t\treturn [];\n\t}\n\n\tlet namespaces = [];\n\n\t// @ts-ignore internal property\n\tif ( Component[ CONNECT_STATIC_NAMESPACE ] ) {\n\t\t// @ts-ignore internal property\n\t\tnamespaces = Component[ CONNECT_STATIC_NAMESPACE ];\n\t}\n\n\t// @ts-ignore\n\tif ( Component.type && Component.type[ CONNECT_STATIC_NAMESPACE ] ) {\n\t\t// @ts-ignore\n\t\tnamespaces = Component.type[ CONNECT_STATIC_NAMESPACE ];\n\t}\n\n\treturn namespaces;\n}\n\n/**\n * Checks to see if a component is connected within the Context system.\n *\n * @param Component The component to retrieve a namespace from.\n * @param match The namespace to check.\n */\nexport function hasConnectNamespace(\n\tComponent: ReactNode,\n\tmatch: string[] | string\n): boolean {\n\tif ( ! Component ) {\n\t\treturn false;\n\t}\n\n\tif ( typeof match === 'string' ) {\n\t\treturn getConnectNamespace( Component ).includes( match );\n\t}\n\tif ( Array.isArray( match ) ) {\n\t\treturn match.some( ( result ) =>\n\t\t\tgetConnectNamespace( Component ).includes( result )\n\t\t);\n\t}\n\n\treturn false;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_element","require","_warning","_interopRequireDefault","_constants","_getStyledClassNameFromKey","contextConnect","Component","namespace","_contextConnect","forwardsRef","contextConnectWithoutRef","options","WrappedComponent","forwardRef","globalThis","SCRIPT_DEBUG","warn","mergedNamespace","CONNECT_STATIC_NAMESPACE","Array","isArray","Object","assign","Set","displayName","selector","getStyledClassNameFromKey","getConnectNamespace","namespaces","type","hasConnectNamespace","match","includes","some","result"],"sources":["@wordpress/components/src/context/context-connect.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef, ReactChild, ReactNode } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\nimport warn from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport { CONNECT_STATIC_NAMESPACE } from './constants';\nimport { getStyledClassNameFromKey } from './get-styled-class-name-from-key';\nimport type { WordPressComponentFromProps } from '.';\n\ntype AcceptsTwoArgs<\n\tF extends ( ...args: any ) => any,\n\tErrorMessage = never,\n> = Parameters< F >[ 'length' ] extends 2 ? {} : ErrorMessage;\n\ntype ContextConnectOptions = {\n\tforwardsRef?: boolean;\n};\n\n/**\n * Forwards ref (React.ForwardRef) and \"Connects\" (or registers) a component\n * within the Context system under a specified namespace.\n *\n * @param Component The component to register into the Context system.\n * @param namespace The namespace to register the component under.\n * @return The connected WordPressComponent\n */\nexport function contextConnect<\n\tC extends ( props: any, ref: ForwardedRef< any > ) => JSX.Element | null,\n>(\n\tComponent: C &\n\t\tAcceptsTwoArgs<\n\t\t\tC,\n\t\t\t'Warning: Your component function does not take a ref as the second argument. Did you mean to use `contextConnectWithoutRef`?'\n\t\t>,\n\tnamespace: string\n) {\n\treturn _contextConnect( Component, namespace, { forwardsRef: true } );\n}\n\n/**\n * \"Connects\" (or registers) a component within the Context system under a specified namespace.\n * Does not forward a ref.\n *\n * @param Component The component to register into the Context system.\n * @param namespace The namespace to register the component under.\n * @return The connected WordPressComponent\n */\nexport function contextConnectWithoutRef< P >(\n\tComponent: ( props: P ) => JSX.Element | null,\n\tnamespace: string\n) {\n\treturn _contextConnect( Component, namespace );\n}\n\n// This is an (experimental) evolution of the initial connect() HOC.\n// The hope is that we can improve render performance by removing functional\n// component wrappers.\nfunction _contextConnect<\n\tC extends ( props: any, ref: ForwardedRef< any > ) => JSX.Element | null,\n\tO extends ContextConnectOptions,\n>(\n\tComponent: C,\n\tnamespace: string,\n\toptions?: O\n): WordPressComponentFromProps<\n\tParameters< C >[ 0 ],\n\tO[ 'forwardsRef' ] extends true ? true : false\n> {\n\tconst WrappedComponent = options?.forwardsRef\n\t\t? forwardRef< any, Parameters< C >[ 0 ] >( Component )\n\t\t: Component;\n\n\tif ( typeof namespace === 'undefined' ) {\n\t\twarn( 'contextConnect: Please provide a namespace' );\n\t}\n\n\t// @ts-expect-error internal property\n\tlet mergedNamespace = WrappedComponent[ CONNECT_STATIC_NAMESPACE ] || [\n\t\tnamespace,\n\t];\n\n\t/**\n\t * Consolidate (merge) namespaces before attaching it to the WrappedComponent.\n\t */\n\tif ( Array.isArray( namespace ) ) {\n\t\tmergedNamespace = [ ...mergedNamespace, ...namespace ];\n\t}\n\tif ( typeof namespace === 'string' ) {\n\t\tmergedNamespace = [ ...mergedNamespace, namespace ];\n\t}\n\n\t// @ts-expect-error We can't rely on inferred types here because of the\n\t// `as` prop polymorphism we're handling in https://github.com/WordPress/gutenberg/blob/4f3a11243c365f94892e479bff0b922ccc4ccda3/packages/components/src/context/wordpress-component.ts#L32-L33\n\treturn Object.assign( WrappedComponent, {\n\t\t[ CONNECT_STATIC_NAMESPACE ]: [ ...new Set( mergedNamespace ) ],\n\t\tdisplayName: namespace,\n\t\tselector: `.${ getStyledClassNameFromKey( namespace ) }`,\n\t} );\n}\n\n/**\n * Attempts to retrieve the connected namespace from a component.\n *\n * @param Component The component to retrieve a namespace from.\n * @return The connected namespaces.\n */\nexport function getConnectNamespace(\n\tComponent: ReactChild | undefined | {}\n): string[] {\n\tif ( ! Component ) {\n\t\treturn [];\n\t}\n\n\tlet namespaces = [];\n\n\t// @ts-ignore internal property\n\tif ( Component[ CONNECT_STATIC_NAMESPACE ] ) {\n\t\t// @ts-ignore internal property\n\t\tnamespaces = Component[ CONNECT_STATIC_NAMESPACE ];\n\t}\n\n\t// @ts-ignore\n\tif ( Component.type && Component.type[ CONNECT_STATIC_NAMESPACE ] ) {\n\t\t// @ts-ignore\n\t\tnamespaces = Component.type[ CONNECT_STATIC_NAMESPACE ];\n\t}\n\n\treturn namespaces;\n}\n\n/**\n * Checks to see if a component is connected within the Context system.\n *\n * @param Component The component to retrieve a namespace from.\n * @param match The namespace to check.\n */\nexport function hasConnectNamespace(\n\tComponent: ReactNode,\n\tmatch: string[] | string\n): boolean {\n\tif ( ! Component ) {\n\t\treturn false;\n\t}\n\n\tif ( typeof match === 'string' ) {\n\t\treturn getConnectNamespace( Component ).includes( match );\n\t}\n\tif ( Array.isArray( match ) ) {\n\t\treturn match.some( ( result ) =>\n\t\t\tgetConnectNamespace( Component ).includes( result )\n\t\t);\n\t}\n\n\treturn false;\n}\n"],"mappings":";;;;;;;;;;;AAQA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,0BAAA,GAAAJ,OAAA;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;;AAcA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASK,cAAcA,CAG7BC,SAIE,EACFC,SAAiB,EAChB;EACD,OAAOC,eAAe,CAAEF,SAAS,EAAEC,SAAS,EAAE;IAAEE,WAAW,EAAE;EAAK,CAAE,CAAC;AACtE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,wBAAwBA,CACvCJ,SAA6C,EAC7CC,SAAiB,EAChB;EACD,OAAOC,eAAe,CAAEF,SAAS,EAAEC,SAAU,CAAC;AAC/C;;AAEA;AACA;AACA;AACA,SAASC,eAAeA,CAIvBF,SAAY,EACZC,SAAiB,EACjBI,OAAW,EAIV;EACD,MAAMC,gBAAgB,GAAGD,OAAO,EAAEF,WAAW,GAC1C,IAAAI,mBAAU,EAA+BP,SAAU,CAAC,GACpDA,SAAS;EAEZ,IAAK,OAAOC,SAAS,KAAK,WAAW,EAAG;IACvCO,UAAA,CAAAC,YAAA,gBAAAC,gBAAI,EAAE,4CAA6C,CAAC;EACrD;;EAEA;EACA,IA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EAAG;IAChC,OAAOJ,mBAAmB,CAAErB,SAAU,CAAC,CAAC0B,QAAQ,CAAED,KAAM,CAAC;EAC1D;EACA,IAAKZ,KAAK,CAACC,OAAO,CAAEW,KAAM,CAAC,EAAG;IAC7B,OAAOA,KAAK,CAACE,IAAI,CAAIC,MAAM,IAC1BP,mBAAmB,CAAErB,SAAU,CAAC,CAAC0B,QAAQ,CAAEE,MAAO,CACnD,CAAC;EACF;EAEA,OAAO,KAAK;AACb","ignoreList":[]}
|
|
@@ -24,7 +24,7 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
24
24
|
* Internal dependencies
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
|
-
const ComponentsContext = exports.ComponentsContext = (0, _element.createContext)(
|
|
27
|
+
const ComponentsContext = exports.ComponentsContext = (0, _element.createContext)(/** @type {Record<string, any>} */{});
|
|
28
28
|
const useComponentsContext = () => (0, _element.useContext)(ComponentsContext);
|
|
29
29
|
|
|
30
30
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_deepmerge","_interopRequireDefault","require","_es","_isPlainObject","_element","_warning","_utils","_jsxRuntime","ComponentsContext","exports","createContext","useComponentsContext","useContext","useContextSystemBridge","value","parentContext","valueRef","useRef","useUpdateEffect","fastDeepEqual","current","globalThis","SCRIPT_DEBUG","warn","JSON","stringify","config","useMemo","deepmerge","isMergeableObject","isPlainObject","BaseContextSystemProvider","children","contextValue","jsx","Provider","ContextSystemProvider","memo"],"sources":["@wordpress/components/src/context/context-system-provider.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport deepmerge from 'deepmerge';\nimport fastDeepEqual from 'fast-deep-equal/es6';\nimport { isPlainObject } from 'is-plain-object';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tcreateContext,\n\tuseContext,\n\tuseRef,\n\tuseMemo,\n\tmemo,\n} from '@wordpress/element';\nimport warn from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport { useUpdateEffect } from '../utils';\n\nexport const ComponentsContext = createContext(\n\t/** @type {Record<string, any>} */ ( {} )\n);\nexport const useComponentsContext = () => useContext( ComponentsContext );\n\n/**\n * Consolidates incoming ContextSystem values with a (potential) parent ContextSystem value.\n *\n * Note: This function will warn if it detects an un-memoized `value`\n *\n * @param {Object} props\n * @param {Record<string, any>} props.value\n * @return {Record<string, any>} The consolidated value.\n */\nfunction useContextSystemBridge( { value } ) {\n\tconst parentContext = useComponentsContext();\n\n\tconst valueRef = useRef( value );\n\n\tuseUpdateEffect( () => {\n\t\tif (\n\t\t\t// Objects are equivalent.\n\t\t\tfastDeepEqual( valueRef.current, value ) &&\n\t\t\t// But not the same reference.\n\t\t\tvalueRef.current !== value\n\t\t) {\n\t\t\twarn( `Please memoize your context: ${ JSON.stringify( value ) }` );\n\t\t}\n\t}, [ value ] );\n\n\t// `parentContext` will always be memoized (i.e., the result of this hook itself)\n\t// or the default value from when the `ComponentsContext` was originally\n\t// initialized (which will never change, it's a static variable)\n\t// so this memoization will prevent `deepmerge()` from rerunning unless\n\t// the references to `value` change OR the `parentContext` has an actual material change\n\t// (because again, it's guaranteed to be memoized or a static reference to the empty object\n\t// so we know that the only changes for `parentContext` are material ones... i.e., why we\n\t// don't have to warn in the `useUpdateEffect` hook above for `parentContext` and we only\n\t// need to bother with the `value`). The `useUpdateEffect` above will ensure that we are\n\t// correctly warning when the `value` isn't being properly memoized. All of that to say\n\t// that this should be super safe to assume that `useMemo` will only run on actual\n\t// changes to the two dependencies, therefore saving us calls to `deepmerge()`!\n\tconst config = useMemo( () => {\n\t\t// Deep clone `parentContext` to avoid mutating it later.\n\t\treturn deepmerge( parentContext ?? {}, value ?? {}, {\n\t\t\tisMergeableObject: isPlainObject,\n\t\t} );\n\t}, [ parentContext, value ] );\n\n\treturn config;\n}\n\n/**\n * A Provider component that can modify props for connected components within\n * the Context system.\n *\n * @example\n * ```jsx\n * <ContextSystemProvider value={{ Button: { size: 'small' }}}>\n * <Button>...</Button>\n * </ContextSystemProvider>\n * ```\n *\n * @template {Record<string, any>} T\n * @param {Object} options\n * @param {import('react').ReactNode} options.children Children to render.\n * @param {T} options.value Props to render into connected components.\n * @return {JSX.Element} A Provider wrapped component.\n */\nconst BaseContextSystemProvider = ( { children, value } ) => {\n\tconst contextValue = useContextSystemBridge( { value } );\n\n\treturn (\n\t\t<ComponentsContext.Provider value={ contextValue }>\n\t\t\t{ children }\n\t\t</ComponentsContext.Provider>\n\t);\n};\n\nexport const ContextSystemProvider = memo( BaseContextSystemProvider );\n"],"mappings":";;;;;;;AAGA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,GAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AAKA,IAAAG,QAAA,GAAAH,OAAA;AAOA,IAAAI,QAAA,GAAAL,sBAAA,CAAAC,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AAA2C,IAAAM,WAAA,GAAAN,OAAA;AAtB3C;AACA;AACA;;AAKA;AACA;AACA;;AAUA;AACA;AACA;;AAGO,MAAMO,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAAG,IAAAE,sBAAa,
|
|
1
|
+
{"version":3,"names":["_deepmerge","_interopRequireDefault","require","_es","_isPlainObject","_element","_warning","_utils","_jsxRuntime","ComponentsContext","exports","createContext","useComponentsContext","useContext","useContextSystemBridge","value","parentContext","valueRef","useRef","useUpdateEffect","fastDeepEqual","current","globalThis","SCRIPT_DEBUG","warn","JSON","stringify","config","useMemo","deepmerge","isMergeableObject","isPlainObject","BaseContextSystemProvider","children","contextValue","jsx","Provider","ContextSystemProvider","memo"],"sources":["@wordpress/components/src/context/context-system-provider.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport deepmerge from 'deepmerge';\nimport fastDeepEqual from 'fast-deep-equal/es6';\nimport { isPlainObject } from 'is-plain-object';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tcreateContext,\n\tuseContext,\n\tuseRef,\n\tuseMemo,\n\tmemo,\n} from '@wordpress/element';\nimport warn from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport { useUpdateEffect } from '../utils';\n\nexport const ComponentsContext = createContext(\n\t/** @type {Record<string, any>} */ ( {} )\n);\nexport const useComponentsContext = () => useContext( ComponentsContext );\n\n/**\n * Consolidates incoming ContextSystem values with a (potential) parent ContextSystem value.\n *\n * Note: This function will warn if it detects an un-memoized `value`\n *\n * @param {Object} props\n * @param {Record<string, any>} props.value\n * @return {Record<string, any>} The consolidated value.\n */\nfunction useContextSystemBridge( { value } ) {\n\tconst parentContext = useComponentsContext();\n\n\tconst valueRef = useRef( value );\n\n\tuseUpdateEffect( () => {\n\t\tif (\n\t\t\t// Objects are equivalent.\n\t\t\tfastDeepEqual( valueRef.current, value ) &&\n\t\t\t// But not the same reference.\n\t\t\tvalueRef.current !== value\n\t\t) {\n\t\t\twarn( `Please memoize your context: ${ JSON.stringify( value ) }` );\n\t\t}\n\t}, [ value ] );\n\n\t// `parentContext` will always be memoized (i.e., the result of this hook itself)\n\t// or the default value from when the `ComponentsContext` was originally\n\t// initialized (which will never change, it's a static variable)\n\t// so this memoization will prevent `deepmerge()` from rerunning unless\n\t// the references to `value` change OR the `parentContext` has an actual material change\n\t// (because again, it's guaranteed to be memoized or a static reference to the empty object\n\t// so we know that the only changes for `parentContext` are material ones... i.e., why we\n\t// don't have to warn in the `useUpdateEffect` hook above for `parentContext` and we only\n\t// need to bother with the `value`). The `useUpdateEffect` above will ensure that we are\n\t// correctly warning when the `value` isn't being properly memoized. All of that to say\n\t// that this should be super safe to assume that `useMemo` will only run on actual\n\t// changes to the two dependencies, therefore saving us calls to `deepmerge()`!\n\tconst config = useMemo( () => {\n\t\t// Deep clone `parentContext` to avoid mutating it later.\n\t\treturn deepmerge( parentContext ?? {}, value ?? {}, {\n\t\t\tisMergeableObject: isPlainObject,\n\t\t} );\n\t}, [ parentContext, value ] );\n\n\treturn config;\n}\n\n/**\n * A Provider component that can modify props for connected components within\n * the Context system.\n *\n * @example\n * ```jsx\n * <ContextSystemProvider value={{ Button: { size: 'small' }}}>\n * <Button>...</Button>\n * </ContextSystemProvider>\n * ```\n *\n * @template {Record<string, any>} T\n * @param {Object} options\n * @param {import('react').ReactNode} options.children Children to render.\n * @param {T} options.value Props to render into connected components.\n * @return {JSX.Element} A Provider wrapped component.\n */\nconst BaseContextSystemProvider = ( { children, value } ) => {\n\tconst contextValue = useContextSystemBridge( { value } );\n\n\treturn (\n\t\t<ComponentsContext.Provider value={ contextValue }>\n\t\t\t{ children }\n\t\t</ComponentsContext.Provider>\n\t);\n};\n\nexport const ContextSystemProvider = memo( BaseContextSystemProvider );\n"],"mappings":";;;;;;;AAGA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,GAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AAKA,IAAAG,QAAA,GAAAH,OAAA;AAOA,IAAAI,QAAA,GAAAL,sBAAA,CAAAC,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AAA2C,IAAAM,WAAA,GAAAN,OAAA;AAtB3C;AACA;AACA;;AAKA;AACA;AACA;;AAUA;AACA;AACA;;AAGO,MAAMO,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAAG,IAAAE,sBAAa,EAC7C,kCAAqC,CAAC,CACvC,CAAC;AACM,MAAMC,oBAAoB,GAAGA,CAAA,KAAM,IAAAC,mBAAU,EAAEJ,iBAAkB,CAAC;;AAEzE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AARAC,OAAA,CAAAE,oBAAA,GAAAA,oBAAA;AASA,SAASE,sBAAsBA,CAAE;EAAEC;AAAM,CAAC,EAAG;EAC5C,MAAMC,aAAa,GAAGJ,oBAAoB,CAAC,CAAC;EAE5C,MAAMK,QAAQ,GAAG,IAAAC,eAAM,EAAEH,KAAM,CAAC;EAEhC,IAAAI,sBAAe,EAAE,MAAM;IACtB;IACC;IACA,IAAAC,WAAa,EAAEH,QAAQ,CAACI,OAAO,EAAEN,KAAM,CAAC;IACxC;IACAE,QAAQ,CAACI,OAAO,KAAKN,KAAK,EACzB;MACDO,UAAA,CAAAC,YAAA,gBAAAC,gBAAI,EAAE,gCAAiCC,IAAI,CAACC,SAAS,CAAEX,KAAM,CAAC,EAAI,CAAC;IACpE;EACD,CAAC,EAAE,CAAEA,KAAK,CAAG,CAAC;;EAEd;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,MAAMY,MAAM,GAAG,IAAAC,gBAAO,EAAE,MAAM;IAC7B;IACA,OAAO,IAAAC,kBAAS,EAAEb,aAAa,aAAbA,aAAa,cAAbA,aAAa,GAAI,CAAC,CAAC,EAAED,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,CAAC,CAAC,EAAE;MACnDe,iBAAiB,EAAEC;IACpB,CAAE,CAAC;EACJ,CAAC,EAAE,CAAEf,aAAa,EAAED,KAAK,CAAG,CAAC;EAE7B,OAAOY,MAAM;AACd;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMK,yBAAyB,GAAGA,CAAE;EAAEC,QAAQ;EAAElB;AAAM,CAAC,KAAM;EAC5D,MAAMmB,YAAY,GAAGpB,sBAAsB,CAAE;IAAEC;EAAM,CAAE,CAAC;EAExD,oBACC,IAAAP,WAAA,CAAA2B,GAAA,EAAC1B,iBAAiB,CAAC2B,QAAQ;IAACrB,KAAK,EAAGmB,YAAc;IAAAD,QAAA,EAC/CA;EAAQ,CACiB,CAAC;AAE/B,CAAC;AAEM,MAAMI,qBAAqB,GAAA3B,OAAA,CAAA2B,qBAAA,GAAG,IAAAC,aAAI,EAAEN,yBAA0B,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_changeCase","require","_memize","_interopRequireDefault","getStyledClassName","namespace","kebab","kebabCase","getStyledClassNameFromKey","exports","memoize"],"sources":["@wordpress/components/src/context/get-styled-class-name-from-key.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport { paramCase as kebabCase } from 'change-case';\nimport memoize from 'memize';\n\n/**\n * Generates the connected component CSS className based on the namespace.\n *\n * @param namespace The name of the connected component.\n * @return The generated CSS className.\n */\nfunction getStyledClassName( namespace: string ): string {\n\tconst kebab = kebabCase( namespace );\n\treturn `components-${ kebab }`;\n}\n\nexport const getStyledClassNameFromKey = memoize( getStyledClassName );\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA,SAASG,kBAAkBA,CAAEC,SAAiB,EAAW;EACxD,MAAMC,KAAK,GAAG,IAAAC,qBAAS,EAAEF,SAAU,CAAC;EACpC,
|
|
1
|
+
{"version":3,"names":["_changeCase","require","_memize","_interopRequireDefault","getStyledClassName","namespace","kebab","kebabCase","getStyledClassNameFromKey","exports","memoize"],"sources":["@wordpress/components/src/context/get-styled-class-name-from-key.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport { paramCase as kebabCase } from 'change-case';\nimport memoize from 'memize';\n\n/**\n * Generates the connected component CSS className based on the namespace.\n *\n * @param namespace The name of the connected component.\n * @return The generated CSS className.\n */\nfunction getStyledClassName( namespace: string ): string {\n\tconst kebab = kebabCase( namespace );\n\treturn `components-${ kebab }`;\n}\n\nexport const getStyledClassNameFromKey = memoize( getStyledClassName );\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA,SAASG,kBAAkBA,CAAEC,SAAiB,EAAW;EACxD,MAAMC,KAAK,GAAG,IAAAC,qBAAS,EAAEF,SAAU,CAAC;EACpC,OAAO,cAAeC,KAAK,EAAG;AAC/B;AAEO,MAAME,yBAAyB,GAAAC,OAAA,CAAAD,yBAAA,GAAG,IAAAE,eAAO,EAAEN,kBAAmB,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_colord","_compose","_element","_i18n","_icons","_button","_hStack","_colorPicker","_visuallyHidden","_colorPalette","_utils","_constants","_dropdownContentWrapper","_jsxRuntime","ControlPointButton","isOpen","position","color","additionalProps","instanceId","useInstanceId","descriptionId","jsxs","Fragment","children","jsx","default","sprintf","__","className","clsx","VisuallyHidden","id","GradientColorPickerDropdown","isRenderedInSidebar","props","popoverProps","useMemo","placement","offset","resize","mergedClassName","CustomColorPickerDropdown","ControlPoints","disableRemove","disableAlpha","gradientPickerDomRef","ignoreMarkerPosition","value","controlPoints","onChange","onStartControlPointChange","onStopControlPointChange","__experimentalIsRenderedInSidebar","controlPointMoveStateRef","useRef","onMouseMove","event","current","undefined","relativePosition","getHorizontalRelativeGradientPosition","clientX","initialPosition","index","significantMoveHappened","Math","abs","MINIMUM_SIGNIFICANT_MOVE","updateControlPointPosition","cleanEventListeners","window","removeEventListener","listenersActivated","cleanEventListenersRef","useEffect","map","point","onClose","renderToggle","onToggle","onClick","onMouseDown","addEventListener","onKeyDown","code","stopPropagation","clampPercent","KEYBOARD_CONTROL_POINT_VARIATION","renderContent","paddingSize","ColorPicker","enableAlpha","updateControlPointColor","colord","toRgbString","length","HStack","alignment","removeControlPoint","variant","style","left","transform","InsertPoint","onOpenInserter","onCloseInserter","insertPosition","alreadyInsertedPoint","setAlreadyInsertedPoint","useState","icon","plus","addControlPoint","updateControlPointColorByPosition","_default","exports"],"sources":["@wordpress/components/src/custom-gradient-picker/gradient-bar/control-points.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport { colord } from 'colord';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { useEffect, useRef, useState, useMemo } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { plus } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport Button from '../../button';\nimport { HStack } from '../../h-stack';\nimport { ColorPicker } from '../../color-picker';\nimport { VisuallyHidden } from '../../visually-hidden';\nimport { CustomColorPickerDropdown } from '../../color-palette';\n\nimport {\n\taddControlPoint,\n\tclampPercent,\n\tremoveControlPoint,\n\tupdateControlPointColor,\n\tupdateControlPointColorByPosition,\n\tupdateControlPointPosition,\n\tgetHorizontalRelativeGradientPosition,\n} from './utils';\nimport {\n\tMINIMUM_SIGNIFICANT_MOVE,\n\tKEYBOARD_CONTROL_POINT_VARIATION,\n} from './constants';\nimport type { WordPressComponentProps } from '../../context';\nimport type {\n\tControlPointButtonProps,\n\tControlPointMoveState,\n\tControlPointsProps,\n\tInsertPointProps,\n} from '../types';\nimport type { CustomColorPickerDropdownProps } from '../../color-palette/types';\nimport DropdownContentWrapper from '../../dropdown/dropdown-content-wrapper';\n\nfunction ControlPointButton( {\n\tisOpen,\n\tposition,\n\tcolor,\n\t...additionalProps\n}: WordPressComponentProps< ControlPointButtonProps, 'button', true > ) {\n\tconst instanceId = useInstanceId( ControlPointButton );\n\tconst descriptionId = `components-custom-gradient-picker__control-point-button-description-${ instanceId }`;\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\taria-label={ sprintf(\n\t\t\t\t\t// translators: %1$s: gradient position e.g: 70, %2$s: gradient color code e.g: rgb(52,121,151).\n\t\t\t\t\t__(\n\t\t\t\t\t\t'Gradient control point at position %1$s%% with color code %2$s.'\n\t\t\t\t\t),\n\t\t\t\t\tposition,\n\t\t\t\t\tcolor\n\t\t\t\t) }\n\t\t\t\taria-describedby={ descriptionId }\n\t\t\t\taria-haspopup=\"true\"\n\t\t\t\taria-expanded={ isOpen }\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'components-custom-gradient-picker__control-point-button',\n\t\t\t\t\t{\n\t\t\t\t\t\t'is-active': isOpen,\n\t\t\t\t\t}\n\t\t\t\t) }\n\t\t\t\t{ ...additionalProps }\n\t\t\t/>\n\t\t\t<VisuallyHidden id={ descriptionId }>\n\t\t\t\t{ __(\n\t\t\t\t\t'Use your left or right arrow keys or drag and drop with the mouse to change the gradient position. Press the button to change the color or remove the control point.'\n\t\t\t\t) }\n\t\t\t</VisuallyHidden>\n\t\t</>\n\t);\n}\n\nfunction GradientColorPickerDropdown( {\n\tisRenderedInSidebar,\n\tclassName,\n\t...props\n}: CustomColorPickerDropdownProps ) {\n\t// Open the popover below the gradient control/insertion point\n\tconst popoverProps = useMemo(\n\t\t() =>\n\t\t\t( {\n\t\t\t\tplacement: 'bottom',\n\t\t\t\toffset: 8,\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} ) as const,\n\t\t[]\n\t);\n\n\tconst mergedClassName = clsx(\n\t\t'components-custom-gradient-picker__control-point-dropdown',\n\t\tclassName\n\t);\n\n\treturn (\n\t\t<CustomColorPickerDropdown\n\t\t\tisRenderedInSidebar={ isRenderedInSidebar }\n\t\t\tpopoverProps={ popoverProps }\n\t\t\tclassName={ mergedClassName }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nfunction ControlPoints( {\n\tdisableRemove,\n\tdisableAlpha,\n\tgradientPickerDomRef,\n\tignoreMarkerPosition,\n\tvalue: controlPoints,\n\tonChange,\n\tonStartControlPointChange,\n\tonStopControlPointChange,\n\t__experimentalIsRenderedInSidebar,\n}: ControlPointsProps ) {\n\tconst controlPointMoveStateRef = useRef< ControlPointMoveState >();\n\n\tconst onMouseMove = ( event: MouseEvent ) => {\n\t\tif (\n\t\t\tcontrolPointMoveStateRef.current === undefined ||\n\t\t\tgradientPickerDomRef.current === null\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst relativePosition = getHorizontalRelativeGradientPosition(\n\t\t\tevent.clientX,\n\t\t\tgradientPickerDomRef.current\n\t\t);\n\n\t\tconst { initialPosition, index, significantMoveHappened } =\n\t\t\tcontrolPointMoveStateRef.current;\n\n\t\tif (\n\t\t\t! significantMoveHappened &&\n\t\t\tMath.abs( initialPosition - relativePosition ) >=\n\t\t\t\tMINIMUM_SIGNIFICANT_MOVE\n\t\t) {\n\t\t\tcontrolPointMoveStateRef.current.significantMoveHappened = true;\n\t\t}\n\n\t\tonChange(\n\t\t\tupdateControlPointPosition( controlPoints, index, relativePosition )\n\t\t);\n\t};\n\n\tconst cleanEventListeners = () => {\n\t\tif (\n\t\t\twindow &&\n\t\t\twindow.removeEventListener &&\n\t\t\tcontrolPointMoveStateRef.current &&\n\t\t\tcontrolPointMoveStateRef.current.listenersActivated\n\t\t) {\n\t\t\twindow.removeEventListener( 'mousemove', onMouseMove );\n\t\t\twindow.removeEventListener( 'mouseup', cleanEventListeners );\n\t\t\tonStopControlPointChange();\n\t\t\tcontrolPointMoveStateRef.current.listenersActivated = false;\n\t\t}\n\t};\n\n\t// Adding `cleanEventListeners` to the dependency array below requires the function itself to be wrapped in a `useCallback`\n\t// This memoization would prevent the event listeners from being properly cleaned.\n\t// Instead, we'll pass a ref to the function in our `useEffect` so `cleanEventListeners` itself is no longer a dependency.\n\tconst cleanEventListenersRef = useRef< () => void >();\n\tcleanEventListenersRef.current = cleanEventListeners;\n\n\tuseEffect( () => {\n\t\treturn () => {\n\t\t\tcleanEventListenersRef.current?.();\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<>\n\t\t\t{ controlPoints.map( ( point, index ) => {\n\t\t\t\tconst initialPosition = point?.position;\n\t\t\t\treturn (\n\t\t\t\t\tignoreMarkerPosition !== initialPosition && (\n\t\t\t\t\t\t<GradientColorPickerDropdown\n\t\t\t\t\t\t\tisRenderedInSidebar={\n\t\t\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\tonClose={ onStopControlPointChange }\n\t\t\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t\t\t<ControlPointButton\n\t\t\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\tcontrolPointMoveStateRef.current &&\n\t\t\t\t\t\t\t\t\t\t\tcontrolPointMoveStateRef.current\n\t\t\t\t\t\t\t\t\t\t\t\t.significantMoveHappened\n\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tif ( isOpen ) {\n\t\t\t\t\t\t\t\t\t\t\tonStopControlPointChange();\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\tonStartControlPointChange();\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tonToggle();\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tonMouseDown={ () => {\n\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\twindow &&\n\t\t\t\t\t\t\t\t\t\t\twindow.addEventListener\n\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\tcontrolPointMoveStateRef.current = {\n\t\t\t\t\t\t\t\t\t\t\t\tinitialPosition,\n\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\tsignificantMoveHappened: false,\n\t\t\t\t\t\t\t\t\t\t\t\tlistenersActivated: true,\n\t\t\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\t\t\tonStartControlPointChange();\n\t\t\t\t\t\t\t\t\t\t\twindow.addEventListener(\n\t\t\t\t\t\t\t\t\t\t\t\t'mousemove',\n\t\t\t\t\t\t\t\t\t\t\t\tonMouseMove\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\twindow.addEventListener(\n\t\t\t\t\t\t\t\t\t\t\t\t'mouseup',\n\t\t\t\t\t\t\t\t\t\t\t\tcleanEventListeners\n\t\t\t\t\t\t\t\t\t\t\t);\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\tonKeyDown={ ( event ) => {\n\t\t\t\t\t\t\t\t\t\tif ( event.code === 'ArrowLeft' ) {\n\t\t\t\t\t\t\t\t\t\t\t// Stop propagation of the key press event to avoid focus moving\n\t\t\t\t\t\t\t\t\t\t\t// to another editor area.\n\t\t\t\t\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\t\t\t\tupdateControlPointPosition(\n\t\t\t\t\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\t\tclampPercent(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tpoint.position -\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tKEYBOARD_CONTROL_POINT_VARIATION\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);\n\t\t\t\t\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\t\t\t\t\tevent.code === 'ArrowRight'\n\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\t// Stop propagation of the key press event to avoid focus moving\n\t\t\t\t\t\t\t\t\t\t\t// to another editor area.\n\t\t\t\t\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\t\t\t\tupdateControlPointPosition(\n\t\t\t\t\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\t\tclampPercent(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tpoint.position +\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tKEYBOARD_CONTROL_POINT_VARIATION\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);\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\tisOpen={ isOpen }\n\t\t\t\t\t\t\t\t\tposition={ point.position }\n\t\t\t\t\t\t\t\t\tcolor={ point.color }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t\t\t<DropdownContentWrapper paddingSize=\"none\">\n\t\t\t\t\t\t\t\t\t<ColorPicker\n\t\t\t\t\t\t\t\t\t\tenableAlpha={ ! disableAlpha }\n\t\t\t\t\t\t\t\t\t\tcolor={ point.color }\n\t\t\t\t\t\t\t\t\t\tonChange={ ( color ) => {\n\t\t\t\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\t\t\t\tupdateControlPointColor(\n\t\t\t\t\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\t\tcolord(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcolor\n\t\t\t\t\t\t\t\t\t\t\t\t\t).toRgbString()\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);\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\t{ ! disableRemove &&\n\t\t\t\t\t\t\t\t\t\tcontrolPoints.length > 2 && (\n\t\t\t\t\t\t\t\t\t\t\t<HStack\n\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"components-custom-gradient-picker__remove-control-point-wrapper\"\n\t\t\t\t\t\t\t\t\t\t\t\talignment=\"center\"\n\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\t\tonClick={ () => {\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\t\tremoveControlPoint(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tindex\n\t\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\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\tvariant=\"link\"\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{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Remove Control Point'\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</Button>\n\t\t\t\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</DropdownContentWrapper>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\tleft: `${ point.position }%`,\n\t\t\t\t\t\t\t\ttransform: 'translateX( -50% )',\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);\n\t\t\t} ) }\n\t\t</>\n\t);\n}\n\nfunction InsertPoint( {\n\tvalue: controlPoints,\n\tonChange,\n\tonOpenInserter,\n\tonCloseInserter,\n\tinsertPosition,\n\tdisableAlpha,\n\t__experimentalIsRenderedInSidebar,\n}: InsertPointProps ) {\n\tconst [ alreadyInsertedPoint, setAlreadyInsertedPoint ] = useState( false );\n\treturn (\n\t\t<GradientColorPickerDropdown\n\t\t\tisRenderedInSidebar={ __experimentalIsRenderedInSidebar }\n\t\t\tclassName=\"components-custom-gradient-picker__inserter\"\n\t\t\tonClose={ () => {\n\t\t\t\tonCloseInserter();\n\t\t\t} }\n\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t<Button\n\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\taria-haspopup=\"true\"\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tif ( isOpen ) {\n\t\t\t\t\t\t\tonCloseInserter();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tsetAlreadyInsertedPoint( false );\n\t\t\t\t\t\t\tonOpenInserter();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonToggle();\n\t\t\t\t\t} }\n\t\t\t\t\tclassName=\"components-custom-gradient-picker__insert-point-dropdown\"\n\t\t\t\t\ticon={ plus }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\trenderContent={ () => (\n\t\t\t\t<DropdownContentWrapper paddingSize=\"none\">\n\t\t\t\t\t<ColorPicker\n\t\t\t\t\t\tenableAlpha={ ! disableAlpha }\n\t\t\t\t\t\tonChange={ ( color ) => {\n\t\t\t\t\t\t\tif ( ! alreadyInsertedPoint ) {\n\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\taddControlPoint(\n\t\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\t\tinsertPosition,\n\t\t\t\t\t\t\t\t\t\tcolord( color ).toRgbString()\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\tsetAlreadyInsertedPoint( true );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\tupdateControlPointColorByPosition(\n\t\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\t\tinsertPosition,\n\t\t\t\t\t\t\t\t\t\tcolord( color ).toRgbString()\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/>\n\t\t\t\t</DropdownContentWrapper>\n\t\t\t) }\n\t\t\tstyle={\n\t\t\t\tinsertPosition !== null\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tleft: `${ insertPosition }%`,\n\t\t\t\t\t\t\ttransform: 'translateX( -50% )',\n\t\t\t\t\t }\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t/>\n\t);\n}\nControlPoints.InsertPoint = InsertPoint;\n\nexport default ControlPoints;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAKA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAKA,IAAAM,OAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAR,OAAA;AACA,IAAAS,eAAA,GAAAT,OAAA;AACA,IAAAU,aAAA,GAAAV,OAAA;AAEA,IAAAW,MAAA,GAAAX,OAAA;AASA,IAAAY,UAAA,GAAAZ,OAAA;AAYA,IAAAa,uBAAA,GAAAd,sBAAA,CAAAC,OAAA;AAA6E,IAAAc,WAAA,GAAAd,OAAA;AA5C7E;AACA;AACA;;AAIA;AACA;AACA;;AAMA;AACA;AACA;;AA8BA,SAASe,kBAAkBA,CAAE;EAC5BC,MAAM;EACNC,QAAQ;EACRC,KAAK;EACL,GAAGC;AACgE,CAAC,EAAG;EACvE,MAAMC,UAAU,GAAG,IAAAC,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["_clsx","_interopRequireDefault","require","_colord","_compose","_element","_i18n","_icons","_button","_hStack","_colorPicker","_visuallyHidden","_colorPalette","_utils","_constants","_dropdownContentWrapper","_jsxRuntime","ControlPointButton","isOpen","position","color","additionalProps","instanceId","useInstanceId","descriptionId","jsxs","Fragment","children","jsx","default","sprintf","__","className","clsx","VisuallyHidden","id","GradientColorPickerDropdown","isRenderedInSidebar","props","popoverProps","useMemo","placement","offset","resize","mergedClassName","CustomColorPickerDropdown","ControlPoints","disableRemove","disableAlpha","gradientPickerDomRef","ignoreMarkerPosition","value","controlPoints","onChange","onStartControlPointChange","onStopControlPointChange","__experimentalIsRenderedInSidebar","controlPointMoveStateRef","useRef","onMouseMove","event","current","undefined","relativePosition","getHorizontalRelativeGradientPosition","clientX","initialPosition","index","significantMoveHappened","Math","abs","MINIMUM_SIGNIFICANT_MOVE","updateControlPointPosition","cleanEventListeners","window","removeEventListener","listenersActivated","cleanEventListenersRef","useEffect","map","point","onClose","renderToggle","onToggle","onClick","onMouseDown","addEventListener","onKeyDown","code","stopPropagation","clampPercent","KEYBOARD_CONTROL_POINT_VARIATION","renderContent","paddingSize","ColorPicker","enableAlpha","updateControlPointColor","colord","toRgbString","length","HStack","alignment","removeControlPoint","variant","style","left","transform","InsertPoint","onOpenInserter","onCloseInserter","insertPosition","alreadyInsertedPoint","setAlreadyInsertedPoint","useState","icon","plus","addControlPoint","updateControlPointColorByPosition","_default","exports"],"sources":["@wordpress/components/src/custom-gradient-picker/gradient-bar/control-points.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport { colord } from 'colord';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { useEffect, useRef, useState, useMemo } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { plus } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport Button from '../../button';\nimport { HStack } from '../../h-stack';\nimport { ColorPicker } from '../../color-picker';\nimport { VisuallyHidden } from '../../visually-hidden';\nimport { CustomColorPickerDropdown } from '../../color-palette';\n\nimport {\n\taddControlPoint,\n\tclampPercent,\n\tremoveControlPoint,\n\tupdateControlPointColor,\n\tupdateControlPointColorByPosition,\n\tupdateControlPointPosition,\n\tgetHorizontalRelativeGradientPosition,\n} from './utils';\nimport {\n\tMINIMUM_SIGNIFICANT_MOVE,\n\tKEYBOARD_CONTROL_POINT_VARIATION,\n} from './constants';\nimport type { WordPressComponentProps } from '../../context';\nimport type {\n\tControlPointButtonProps,\n\tControlPointMoveState,\n\tControlPointsProps,\n\tInsertPointProps,\n} from '../types';\nimport type { CustomColorPickerDropdownProps } from '../../color-palette/types';\nimport DropdownContentWrapper from '../../dropdown/dropdown-content-wrapper';\n\nfunction ControlPointButton( {\n\tisOpen,\n\tposition,\n\tcolor,\n\t...additionalProps\n}: WordPressComponentProps< ControlPointButtonProps, 'button', true > ) {\n\tconst instanceId = useInstanceId( ControlPointButton );\n\tconst descriptionId = `components-custom-gradient-picker__control-point-button-description-${ instanceId }`;\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\taria-label={ sprintf(\n\t\t\t\t\t// translators: %1$s: gradient position e.g: 70, %2$s: gradient color code e.g: rgb(52,121,151).\n\t\t\t\t\t__(\n\t\t\t\t\t\t'Gradient control point at position %1$s%% with color code %2$s.'\n\t\t\t\t\t),\n\t\t\t\t\tposition,\n\t\t\t\t\tcolor\n\t\t\t\t) }\n\t\t\t\taria-describedby={ descriptionId }\n\t\t\t\taria-haspopup=\"true\"\n\t\t\t\taria-expanded={ isOpen }\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'components-custom-gradient-picker__control-point-button',\n\t\t\t\t\t{\n\t\t\t\t\t\t'is-active': isOpen,\n\t\t\t\t\t}\n\t\t\t\t) }\n\t\t\t\t{ ...additionalProps }\n\t\t\t/>\n\t\t\t<VisuallyHidden id={ descriptionId }>\n\t\t\t\t{ __(\n\t\t\t\t\t'Use your left or right arrow keys or drag and drop with the mouse to change the gradient position. Press the button to change the color or remove the control point.'\n\t\t\t\t) }\n\t\t\t</VisuallyHidden>\n\t\t</>\n\t);\n}\n\nfunction GradientColorPickerDropdown( {\n\tisRenderedInSidebar,\n\tclassName,\n\t...props\n}: CustomColorPickerDropdownProps ) {\n\t// Open the popover below the gradient control/insertion point\n\tconst popoverProps = useMemo(\n\t\t() =>\n\t\t\t( {\n\t\t\t\tplacement: 'bottom',\n\t\t\t\toffset: 8,\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} ) as const,\n\t\t[]\n\t);\n\n\tconst mergedClassName = clsx(\n\t\t'components-custom-gradient-picker__control-point-dropdown',\n\t\tclassName\n\t);\n\n\treturn (\n\t\t<CustomColorPickerDropdown\n\t\t\tisRenderedInSidebar={ isRenderedInSidebar }\n\t\t\tpopoverProps={ popoverProps }\n\t\t\tclassName={ mergedClassName }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nfunction ControlPoints( {\n\tdisableRemove,\n\tdisableAlpha,\n\tgradientPickerDomRef,\n\tignoreMarkerPosition,\n\tvalue: controlPoints,\n\tonChange,\n\tonStartControlPointChange,\n\tonStopControlPointChange,\n\t__experimentalIsRenderedInSidebar,\n}: ControlPointsProps ) {\n\tconst controlPointMoveStateRef = useRef< ControlPointMoveState >();\n\n\tconst onMouseMove = ( event: MouseEvent ) => {\n\t\tif (\n\t\t\tcontrolPointMoveStateRef.current === undefined ||\n\t\t\tgradientPickerDomRef.current === null\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst relativePosition = getHorizontalRelativeGradientPosition(\n\t\t\tevent.clientX,\n\t\t\tgradientPickerDomRef.current\n\t\t);\n\n\t\tconst { initialPosition, index, significantMoveHappened } =\n\t\t\tcontrolPointMoveStateRef.current;\n\n\t\tif (\n\t\t\t! significantMoveHappened &&\n\t\t\tMath.abs( initialPosition - relativePosition ) >=\n\t\t\t\tMINIMUM_SIGNIFICANT_MOVE\n\t\t) {\n\t\t\tcontrolPointMoveStateRef.current.significantMoveHappened = true;\n\t\t}\n\n\t\tonChange(\n\t\t\tupdateControlPointPosition( controlPoints, index, relativePosition )\n\t\t);\n\t};\n\n\tconst cleanEventListeners = () => {\n\t\tif (\n\t\t\twindow &&\n\t\t\twindow.removeEventListener &&\n\t\t\tcontrolPointMoveStateRef.current &&\n\t\t\tcontrolPointMoveStateRef.current.listenersActivated\n\t\t) {\n\t\t\twindow.removeEventListener( 'mousemove', onMouseMove );\n\t\t\twindow.removeEventListener( 'mouseup', cleanEventListeners );\n\t\t\tonStopControlPointChange();\n\t\t\tcontrolPointMoveStateRef.current.listenersActivated = false;\n\t\t}\n\t};\n\n\t// Adding `cleanEventListeners` to the dependency array below requires the function itself to be wrapped in a `useCallback`\n\t// This memoization would prevent the event listeners from being properly cleaned.\n\t// Instead, we'll pass a ref to the function in our `useEffect` so `cleanEventListeners` itself is no longer a dependency.\n\tconst cleanEventListenersRef = useRef< () => void >();\n\tcleanEventListenersRef.current = cleanEventListeners;\n\n\tuseEffect( () => {\n\t\treturn () => {\n\t\t\tcleanEventListenersRef.current?.();\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<>\n\t\t\t{ controlPoints.map( ( point, index ) => {\n\t\t\t\tconst initialPosition = point?.position;\n\t\t\t\treturn (\n\t\t\t\t\tignoreMarkerPosition !== initialPosition && (\n\t\t\t\t\t\t<GradientColorPickerDropdown\n\t\t\t\t\t\t\tisRenderedInSidebar={\n\t\t\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\tonClose={ onStopControlPointChange }\n\t\t\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t\t\t<ControlPointButton\n\t\t\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\tcontrolPointMoveStateRef.current &&\n\t\t\t\t\t\t\t\t\t\t\tcontrolPointMoveStateRef.current\n\t\t\t\t\t\t\t\t\t\t\t\t.significantMoveHappened\n\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tif ( isOpen ) {\n\t\t\t\t\t\t\t\t\t\t\tonStopControlPointChange();\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\tonStartControlPointChange();\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tonToggle();\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tonMouseDown={ () => {\n\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\twindow &&\n\t\t\t\t\t\t\t\t\t\t\twindow.addEventListener\n\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\tcontrolPointMoveStateRef.current = {\n\t\t\t\t\t\t\t\t\t\t\t\tinitialPosition,\n\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\tsignificantMoveHappened: false,\n\t\t\t\t\t\t\t\t\t\t\t\tlistenersActivated: true,\n\t\t\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\t\t\tonStartControlPointChange();\n\t\t\t\t\t\t\t\t\t\t\twindow.addEventListener(\n\t\t\t\t\t\t\t\t\t\t\t\t'mousemove',\n\t\t\t\t\t\t\t\t\t\t\t\tonMouseMove\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\twindow.addEventListener(\n\t\t\t\t\t\t\t\t\t\t\t\t'mouseup',\n\t\t\t\t\t\t\t\t\t\t\t\tcleanEventListeners\n\t\t\t\t\t\t\t\t\t\t\t);\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\tonKeyDown={ ( event ) => {\n\t\t\t\t\t\t\t\t\t\tif ( event.code === 'ArrowLeft' ) {\n\t\t\t\t\t\t\t\t\t\t\t// Stop propagation of the key press event to avoid focus moving\n\t\t\t\t\t\t\t\t\t\t\t// to another editor area.\n\t\t\t\t\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\t\t\t\tupdateControlPointPosition(\n\t\t\t\t\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\t\tclampPercent(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tpoint.position -\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tKEYBOARD_CONTROL_POINT_VARIATION\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);\n\t\t\t\t\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\t\t\t\t\tevent.code === 'ArrowRight'\n\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\t// Stop propagation of the key press event to avoid focus moving\n\t\t\t\t\t\t\t\t\t\t\t// to another editor area.\n\t\t\t\t\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\t\t\t\tupdateControlPointPosition(\n\t\t\t\t\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\t\tclampPercent(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tpoint.position +\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tKEYBOARD_CONTROL_POINT_VARIATION\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);\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\tisOpen={ isOpen }\n\t\t\t\t\t\t\t\t\tposition={ point.position }\n\t\t\t\t\t\t\t\t\tcolor={ point.color }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t\t\t<DropdownContentWrapper paddingSize=\"none\">\n\t\t\t\t\t\t\t\t\t<ColorPicker\n\t\t\t\t\t\t\t\t\t\tenableAlpha={ ! disableAlpha }\n\t\t\t\t\t\t\t\t\t\tcolor={ point.color }\n\t\t\t\t\t\t\t\t\t\tonChange={ ( color ) => {\n\t\t\t\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\t\t\t\tupdateControlPointColor(\n\t\t\t\t\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\t\tcolord(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcolor\n\t\t\t\t\t\t\t\t\t\t\t\t\t).toRgbString()\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);\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\t{ ! disableRemove &&\n\t\t\t\t\t\t\t\t\t\tcontrolPoints.length > 2 && (\n\t\t\t\t\t\t\t\t\t\t\t<HStack\n\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"components-custom-gradient-picker__remove-control-point-wrapper\"\n\t\t\t\t\t\t\t\t\t\t\t\talignment=\"center\"\n\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\t\tonClick={ () => {\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\t\tremoveControlPoint(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tindex\n\t\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\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\tvariant=\"link\"\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{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Remove Control Point'\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</Button>\n\t\t\t\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</DropdownContentWrapper>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\tleft: `${ point.position }%`,\n\t\t\t\t\t\t\t\ttransform: 'translateX( -50% )',\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);\n\t\t\t} ) }\n\t\t</>\n\t);\n}\n\nfunction InsertPoint( {\n\tvalue: controlPoints,\n\tonChange,\n\tonOpenInserter,\n\tonCloseInserter,\n\tinsertPosition,\n\tdisableAlpha,\n\t__experimentalIsRenderedInSidebar,\n}: InsertPointProps ) {\n\tconst [ alreadyInsertedPoint, setAlreadyInsertedPoint ] = useState( false );\n\treturn (\n\t\t<GradientColorPickerDropdown\n\t\t\tisRenderedInSidebar={ __experimentalIsRenderedInSidebar }\n\t\t\tclassName=\"components-custom-gradient-picker__inserter\"\n\t\t\tonClose={ () => {\n\t\t\t\tonCloseInserter();\n\t\t\t} }\n\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t<Button\n\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\taria-haspopup=\"true\"\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tif ( isOpen ) {\n\t\t\t\t\t\t\tonCloseInserter();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tsetAlreadyInsertedPoint( false );\n\t\t\t\t\t\t\tonOpenInserter();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonToggle();\n\t\t\t\t\t} }\n\t\t\t\t\tclassName=\"components-custom-gradient-picker__insert-point-dropdown\"\n\t\t\t\t\ticon={ plus }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\trenderContent={ () => (\n\t\t\t\t<DropdownContentWrapper paddingSize=\"none\">\n\t\t\t\t\t<ColorPicker\n\t\t\t\t\t\tenableAlpha={ ! disableAlpha }\n\t\t\t\t\t\tonChange={ ( color ) => {\n\t\t\t\t\t\t\tif ( ! alreadyInsertedPoint ) {\n\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\taddControlPoint(\n\t\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\t\tinsertPosition,\n\t\t\t\t\t\t\t\t\t\tcolord( color ).toRgbString()\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\tsetAlreadyInsertedPoint( true );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\tupdateControlPointColorByPosition(\n\t\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\t\tinsertPosition,\n\t\t\t\t\t\t\t\t\t\tcolord( color ).toRgbString()\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/>\n\t\t\t\t</DropdownContentWrapper>\n\t\t\t) }\n\t\t\tstyle={\n\t\t\t\tinsertPosition !== null\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tleft: `${ insertPosition }%`,\n\t\t\t\t\t\t\ttransform: 'translateX( -50% )',\n\t\t\t\t\t }\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t/>\n\t);\n}\nControlPoints.InsertPoint = InsertPoint;\n\nexport default ControlPoints;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAKA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAKA,IAAAM,OAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAR,OAAA;AACA,IAAAS,eAAA,GAAAT,OAAA;AACA,IAAAU,aAAA,GAAAV,OAAA;AAEA,IAAAW,MAAA,GAAAX,OAAA;AASA,IAAAY,UAAA,GAAAZ,OAAA;AAYA,IAAAa,uBAAA,GAAAd,sBAAA,CAAAC,OAAA;AAA6E,IAAAc,WAAA,GAAAd,OAAA;AA5C7E;AACA;AACA;;AAIA;AACA;AACA;;AAMA;AACA;AACA;;AA8BA,SAASe,kBAAkBA,CAAE;EAC5BC,MAAM;EACNC,QAAQ;EACRC,KAAK;EACL,GAAGC;AACgE,CAAC,EAAG;EACvE,MAAMC,UAAU,GAAG,IAAAC,sBAAa,EAAEN,kBAAmB,CAAC;EACtD,MAAMO,aAAa,GAAG,uEAAwEF,UAAU,EAAG;EAC3G,oBACC,IAAAN,WAAA,CAAAS,IAAA,EAAAT,WAAA,CAAAU,QAAA;IAAAC,QAAA,gBACC,IAAA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Ac,CAAC,CAAC;QACjB;QACAzB,QAAQ,CAAC,CAAC;MACX,CAAG;MACHnD,SAAS,EAAC,0DAA0D;MACpEkF,IAAI,EAAGC;IAAM,CACb,CACC;IACHvB,aAAa,EAAGA,CAAA,kBACf,IAAA5E,WAAA,CAAAY,GAAA,EAACb,uBAAA,CAAAc,OAAsB;MAACgE,WAAW,EAAC,MAAM;MAAAlE,QAAA,eACzC,IAAAX,WAAA,CAAAY,GAAA,EAAClB,YAAA,CAAAoF,WAAW;QACXC,WAAW,EAAG,CAAE/C,YAAc;QAC9BK,QAAQ,EAAKjC,KAAK,IAAM;UACvB,IAAK,CAAE2F,oBAAoB,EAAG;YAC7B1D,QAAQ,CACP,IAAA+D,sBAAe,EACdhE,aAAa,EACb0D,cAAc,EACd,IAAAb,cAAM,EAAE7E,KAAM,CAAC,CAAC8E,WAAW,CAAC,CAC7B,CACD,CAAC;YACDc,uBAAuB,CAAE,IAAK,CAAC;UAChC,CAAC,MAAM;YACN3D,QAAQ,CACP,IAAAgE,wCAAiC,EAChCjE,aAAa,EACb0D,cAAc,EACd,IAAAb,cAAM,EAAE7E,KAAM,CAAC,CAAC8E,WAAW,CAAC,CAC7B,CACD,CAAC;UACF;QACD;MAAG,CACH;IAAC,CACqB,CACtB;IACHM,KAAK,EACJM,cAAc,KAAK,IAAI,GACpB;MACAL,IAAI,EAAE,GAAIK,cAAc,GAAI;MAC5BJ,SAAS,EAAE;IACX,CAAC,GACD5C;EACH,CACD,CAAC;AAEJ;AACAhB,aAAa,CAAC6D,WAAW,GAAGA,WAAW;AAAC,IAAAW,QAAA,GAAAC,OAAA,CAAA1F,OAAA,GAEzBiB,aAAa","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_anglePickerControl","_interopRequireDefault","_gradientBar","_flex","_selectControl","_vStack","_utils","_serializer","_constants","_customGradientPickerStyles","_jsxRuntime","GradientAnglePicker","gradientAST","hasGradient","onChange","_gradientAST$orientat","angle","orientation","value","DEFAULT_LINEAR_GRADIENT_ANGLE","onAngleChange","newAngle","serializeGradient","type","jsx","default","GradientTypePicker","onSetLinearGradient","undefined","HORIZONTAL_GRADIENT_ORIENTATION","onSetRadialGradient","restGradientAST","handleOnChange","next","__nextHasNoMarginBottom","className","label","__","labelPosition","options","GRADIENT_OPTIONS","size","CustomGradientPicker","__experimentalIsRenderedInSidebar","getGradientAstWithDefault","background","getLinearGradientRepresentation","controlPoints","colorStops","map","colorStop","color","getStopCssColor","position","parseInt","length","jsxs","VStack","spacing","children","newControlPoints","getGradientAstWithControlPoints","Flex","gap","SelectWrapper","AccessoryWrapper","_default","exports"],"sources":["@wordpress/components/src/custom-gradient-picker/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport { type LinearGradientNode } from 'gradient-parser';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport AnglePickerControl from '../angle-picker-control';\nimport CustomGradientBar from './gradient-bar';\nimport { Flex } from '../flex';\nimport SelectControl from '../select-control';\nimport { VStack } from '../v-stack';\nimport {\n\tgetGradientAstWithDefault,\n\tgetLinearGradientRepresentation,\n\tgetGradientAstWithControlPoints,\n\tgetStopCssColor,\n} from './utils';\nimport { serializeGradient } from './serializer';\nimport {\n\tDEFAULT_LINEAR_GRADIENT_ANGLE,\n\tHORIZONTAL_GRADIENT_ORIENTATION,\n\tGRADIENT_OPTIONS,\n} from './constants';\nimport {\n\tAccessoryWrapper,\n\tSelectWrapper,\n} from './styles/custom-gradient-picker-styles';\nimport type {\n\tCustomGradientPickerProps,\n\tGradientAnglePickerProps,\n\tGradientTypePickerProps,\n} from './types';\n\nconst GradientAnglePicker = ( {\n\tgradientAST,\n\thasGradient,\n\tonChange,\n}: GradientAnglePickerProps ) => {\n\tconst angle =\n\t\tgradientAST?.orientation?.value ?? DEFAULT_LINEAR_GRADIENT_ANGLE;\n\tconst onAngleChange = ( newAngle: number ) => {\n\t\tonChange(\n\t\t\tserializeGradient( {\n\t\t\t\t...gradientAST,\n\t\t\t\torientation: {\n\t\t\t\t\ttype: 'angular',\n\t\t\t\t\tvalue: `${ newAngle }`,\n\t\t\t\t},\n\t\t\t} )\n\t\t);\n\t};\n\treturn (\n\t\t<AnglePickerControl\n\t\t\tonChange={ onAngleChange }\n\t\t\tvalue={ hasGradient ? angle : '' }\n\t\t/>\n\t);\n};\n\nconst GradientTypePicker = ( {\n\tgradientAST,\n\thasGradient,\n\tonChange,\n}: GradientTypePickerProps ) => {\n\tconst { type } = gradientAST;\n\n\tconst onSetLinearGradient = () => {\n\t\tonChange(\n\t\t\tserializeGradient( {\n\t\t\t\t...gradientAST,\n\t\t\t\torientation: gradientAST.orientation\n\t\t\t\t\t? undefined\n\t\t\t\t\t: HORIZONTAL_GRADIENT_ORIENTATION,\n\t\t\t\ttype: 'linear-gradient',\n\t\t\t} satisfies LinearGradientNode )\n\t\t);\n\t};\n\n\tconst onSetRadialGradient = () => {\n\t\tconst { orientation, ...restGradientAST } = gradientAST;\n\t\tonChange(\n\t\t\tserializeGradient( {\n\t\t\t\t...restGradientAST,\n\t\t\t\ttype: 'radial-gradient',\n\t\t\t} )\n\t\t);\n\t};\n\n\tconst handleOnChange = ( next: string ) => {\n\t\tif ( next === 'linear-gradient' ) {\n\t\t\tonSetLinearGradient();\n\t\t}\n\t\tif ( next === 'radial-gradient' ) {\n\t\t\tonSetRadialGradient();\n\t\t}\n\t};\n\n\treturn (\n\t\t<SelectControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tclassName=\"components-custom-gradient-picker__type-picker\"\n\t\t\tlabel={ __( 'Type' ) }\n\t\t\tlabelPosition=\"top\"\n\t\t\tonChange={ handleOnChange }\n\t\t\toptions={ GRADIENT_OPTIONS }\n\t\t\tsize=\"__unstable-large\"\n\t\t\tvalue={ hasGradient ? type : undefined }\n\t\t/>\n\t);\n};\n\n/**\n * CustomGradientPicker is a React component that renders a UI for specifying\n * linear or radial gradients. Radial gradients are displayed in the picker as\n * a slice of the gradient from the center to the outside.\n *\n * ```jsx\n * import { CustomGradientPicker } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyCustomGradientPicker = () => {\n * const [ gradient, setGradient ] = useState();\n *\n * return (\n * <CustomGradientPicker\n *\t\t\tvalue={ gradient }\n *\t\t\tonChange={ setGradient }\n * />\n * );\n * };\n * ```\n */\nexport function CustomGradientPicker( {\n\tvalue,\n\tonChange,\n\t__experimentalIsRenderedInSidebar = false,\n}: CustomGradientPickerProps ) {\n\tconst { gradientAST, hasGradient } = getGradientAstWithDefault( value );\n\n\t// On radial gradients the bar should display a linear gradient.\n\t// On radial gradients the bar represents a slice of the gradient from the center until the outside.\n\t// On liner gradients the bar represents the color stops from left to right independently of the angle.\n\tconst background = getLinearGradientRepresentation( gradientAST );\n\n\t// Control points color option may be hex from presets, custom colors will be rgb.\n\t// The position should always be a percentage.\n\tconst controlPoints = gradientAST.colorStops.map( ( colorStop ) => {\n\t\treturn {\n\t\t\tcolor: getStopCssColor( colorStop ),\n\t\t\t// Although it's already been checked by `hasUnsupportedLength` in `getGradientAstWithDefault`,\n\t\t\t// TypeScript doesn't know that `colorStop.length` is not undefined here.\n\t\t\t// @ts-expect-error\n\t\t\tposition: parseInt( colorStop.length.value ),\n\t\t};\n\t} );\n\n\treturn (\n\t\t<VStack spacing={ 4 } className=\"components-custom-gradient-picker\">\n\t\t\t<CustomGradientBar\n\t\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t}\n\t\t\t\tbackground={ background }\n\t\t\t\thasGradient={ hasGradient }\n\t\t\t\tvalue={ controlPoints }\n\t\t\t\tonChange={ ( newControlPoints ) => {\n\t\t\t\t\tonChange(\n\t\t\t\t\t\tserializeGradient(\n\t\t\t\t\t\t\tgetGradientAstWithControlPoints(\n\t\t\t\t\t\t\t\tgradientAST,\n\t\t\t\t\t\t\t\tnewControlPoints\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} }\n\t\t\t/>\n\t\t\t<Flex\n\t\t\t\tgap={ 3 }\n\t\t\t\tclassName=\"components-custom-gradient-picker__ui-line\"\n\t\t\t>\n\t\t\t\t<SelectWrapper>\n\t\t\t\t\t<GradientTypePicker\n\t\t\t\t\t\tgradientAST={ gradientAST }\n\t\t\t\t\t\thasGradient={ hasGradient }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t/>\n\t\t\t\t</SelectWrapper>\n\t\t\t\t<AccessoryWrapper>\n\t\t\t\t\t{ gradientAST.type === 'linear-gradient' && (\n\t\t\t\t\t\t<GradientAnglePicker\n\t\t\t\t\t\t\tgradientAST={ gradientAST }\n\t\t\t\t\t\t\thasGradient={ hasGradient }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</AccessoryWrapper>\n\t\t\t</Flex>\n\t\t</VStack>\n\t);\n}\n\nexport default CustomGradientPicker;\n"],"mappings":";;;;;;;;AAQA,IAAAA,KAAA,GAAAC,OAAA;AAKA,IAAAC,mBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,YAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,cAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAMA,IAAAQ,WAAA,GAAAR,OAAA;AACA,IAAAS,UAAA,GAAAT,OAAA;AAKA,IAAAU,2BAAA,GAAAV,OAAA;AAGgD,IAAAW,WAAA,GAAAX,OAAA;AAjChD;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AA4BA,MAAMY,mBAAmB,GAAGA,CAAE;EAC7BC,WAAW;EACXC,WAAW;EACXC;AACyB,CAAC,KAAM;EAAA,IAAAC,qBAAA;EAChC,MAAMC,K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CACA;MACDE,UAAU,EAAGA,UAAY;MACzBhC,WAAW,EAAGA,WAAa;MAC3BK,KAAK,EAAG6B,aAAe;MACvBjC,QAAQ,EAAK8C,gBAAgB,IAAM;QAClC9C,QAAQ,CACP,IAAAQ,6BAAiB,EAChB,IAAAuC,sCAA+B,EAC9BjD,WAAW,EACXgD,gBACD,CACD,CACD,CAAC;MACF;IAAG,CACH,CAAC,eACF,IAAAlD,WAAA,CAAA8C,IAAA,EAACrD,KAAA,CAAA2D,IAAI;MACJC,GAAG,EAAG,CAAG;MACT5B,SAAS,EAAC,4CAA4C;MAAAwB,QAAA,gBAEtD,IAAAjD,WAAA,CAAAc,GAAA,EAACf,2BAAA,CAAAuD,aAAa;QAAAL,QAAA,eACb,IAAAjD,WAAA,CAAAc,GAAA,EAACE,kBAAkB;UAClBd,WAAW,EAAGA,WAAa;UAC3BC,WAAW,EAAGA,WAAa;UAC3BC,QAAQ,EAAGA;QAAU,CACrB;MAAC,CACY,CAAC,eAChB,IAAAJ,WAAA,CAAAc,GAAA,EAACf,2BAAA,CAAAwD,gBAAgB;QAAAN,QAAA,EACd/C,WAAW,CAACW,IAAI,KAAK,iBAAiB,iBACvC,IAAAb,WAAA,CAAAc,GAAA,EAACb,mBAAmB;UACnBC,WAAW,EAAGA,WAAa;UAC3BC,WAAW,EAAGA,WAAa;UAC3BC,QAAQ,EAAGA;QAAU,CACrB;MACD,CACgB,CAAC;IAAA,CACd,CAAC;EAAA,CACA,CAAC;AAEX;AAAC,IAAAoD,QAAA,GAAAC,OAAA,CAAA1C,OAAA,GAEciB,oBAAoB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_i18n","require","_anglePickerControl","_interopRequireDefault","_gradientBar","_flex","_selectControl","_vStack","_utils","_serializer","_constants","_customGradientPickerStyles","_jsxRuntime","GradientAnglePicker","gradientAST","hasGradient","onChange","_gradientAST$orientat","angle","orientation","value","DEFAULT_LINEAR_GRADIENT_ANGLE","onAngleChange","newAngle","serializeGradient","type","jsx","default","GradientTypePicker","onSetLinearGradient","undefined","HORIZONTAL_GRADIENT_ORIENTATION","onSetRadialGradient","restGradientAST","handleOnChange","next","__nextHasNoMarginBottom","className","label","__","labelPosition","options","GRADIENT_OPTIONS","size","CustomGradientPicker","__experimentalIsRenderedInSidebar","getGradientAstWithDefault","background","getLinearGradientRepresentation","controlPoints","colorStops","map","colorStop","color","getStopCssColor","position","parseInt","length","jsxs","VStack","spacing","children","newControlPoints","getGradientAstWithControlPoints","Flex","gap","SelectWrapper","AccessoryWrapper","_default","exports"],"sources":["@wordpress/components/src/custom-gradient-picker/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport { type LinearGradientNode } from 'gradient-parser';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport AnglePickerControl from '../angle-picker-control';\nimport CustomGradientBar from './gradient-bar';\nimport { Flex } from '../flex';\nimport SelectControl from '../select-control';\nimport { VStack } from '../v-stack';\nimport {\n\tgetGradientAstWithDefault,\n\tgetLinearGradientRepresentation,\n\tgetGradientAstWithControlPoints,\n\tgetStopCssColor,\n} from './utils';\nimport { serializeGradient } from './serializer';\nimport {\n\tDEFAULT_LINEAR_GRADIENT_ANGLE,\n\tHORIZONTAL_GRADIENT_ORIENTATION,\n\tGRADIENT_OPTIONS,\n} from './constants';\nimport {\n\tAccessoryWrapper,\n\tSelectWrapper,\n} from './styles/custom-gradient-picker-styles';\nimport type {\n\tCustomGradientPickerProps,\n\tGradientAnglePickerProps,\n\tGradientTypePickerProps,\n} from './types';\n\nconst GradientAnglePicker = ( {\n\tgradientAST,\n\thasGradient,\n\tonChange,\n}: GradientAnglePickerProps ) => {\n\tconst angle =\n\t\tgradientAST?.orientation?.value ?? DEFAULT_LINEAR_GRADIENT_ANGLE;\n\tconst onAngleChange = ( newAngle: number ) => {\n\t\tonChange(\n\t\t\tserializeGradient( {\n\t\t\t\t...gradientAST,\n\t\t\t\torientation: {\n\t\t\t\t\ttype: 'angular',\n\t\t\t\t\tvalue: `${ newAngle }`,\n\t\t\t\t},\n\t\t\t} )\n\t\t);\n\t};\n\treturn (\n\t\t<AnglePickerControl\n\t\t\tonChange={ onAngleChange }\n\t\t\tvalue={ hasGradient ? angle : '' }\n\t\t/>\n\t);\n};\n\nconst GradientTypePicker = ( {\n\tgradientAST,\n\thasGradient,\n\tonChange,\n}: GradientTypePickerProps ) => {\n\tconst { type } = gradientAST;\n\n\tconst onSetLinearGradient = () => {\n\t\tonChange(\n\t\t\tserializeGradient( {\n\t\t\t\t...gradientAST,\n\t\t\t\torientation: gradientAST.orientation\n\t\t\t\t\t? undefined\n\t\t\t\t\t: HORIZONTAL_GRADIENT_ORIENTATION,\n\t\t\t\ttype: 'linear-gradient',\n\t\t\t} satisfies LinearGradientNode )\n\t\t);\n\t};\n\n\tconst onSetRadialGradient = () => {\n\t\tconst { orientation, ...restGradientAST } = gradientAST;\n\t\tonChange(\n\t\t\tserializeGradient( {\n\t\t\t\t...restGradientAST,\n\t\t\t\ttype: 'radial-gradient',\n\t\t\t} )\n\t\t);\n\t};\n\n\tconst handleOnChange = ( next: string ) => {\n\t\tif ( next === 'linear-gradient' ) {\n\t\t\tonSetLinearGradient();\n\t\t}\n\t\tif ( next === 'radial-gradient' ) {\n\t\t\tonSetRadialGradient();\n\t\t}\n\t};\n\n\treturn (\n\t\t<SelectControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tclassName=\"components-custom-gradient-picker__type-picker\"\n\t\t\tlabel={ __( 'Type' ) }\n\t\t\tlabelPosition=\"top\"\n\t\t\tonChange={ handleOnChange }\n\t\t\toptions={ GRADIENT_OPTIONS }\n\t\t\tsize=\"__unstable-large\"\n\t\t\tvalue={ hasGradient ? type : undefined }\n\t\t/>\n\t);\n};\n\n/**\n * CustomGradientPicker is a React component that renders a UI for specifying\n * linear or radial gradients. Radial gradients are displayed in the picker as\n * a slice of the gradient from the center to the outside.\n *\n * ```jsx\n * import { CustomGradientPicker } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyCustomGradientPicker = () => {\n * const [ gradient, setGradient ] = useState();\n *\n * return (\n * <CustomGradientPicker\n *\t\t\tvalue={ gradient }\n *\t\t\tonChange={ setGradient }\n * />\n * );\n * };\n * ```\n */\nexport function CustomGradientPicker( {\n\tvalue,\n\tonChange,\n\t__experimentalIsRenderedInSidebar = false,\n}: CustomGradientPickerProps ) {\n\tconst { gradientAST, hasGradient } = getGradientAstWithDefault( value );\n\n\t// On radial gradients the bar should display a linear gradient.\n\t// On radial gradients the bar represents a slice of the gradient from the center until the outside.\n\t// On liner gradients the bar represents the color stops from left to right independently of the angle.\n\tconst background = getLinearGradientRepresentation( gradientAST );\n\n\t// Control points color option may be hex from presets, custom colors will be rgb.\n\t// The position should always be a percentage.\n\tconst controlPoints = gradientAST.colorStops.map( ( colorStop ) => {\n\t\treturn {\n\t\t\tcolor: getStopCssColor( colorStop ),\n\t\t\t// Although it's already been checked by `hasUnsupportedLength` in `getGradientAstWithDefault`,\n\t\t\t// TypeScript doesn't know that `colorStop.length` is not undefined here.\n\t\t\t// @ts-expect-error\n\t\t\tposition: parseInt( colorStop.length.value ),\n\t\t};\n\t} );\n\n\treturn (\n\t\t<VStack spacing={ 4 } className=\"components-custom-gradient-picker\">\n\t\t\t<CustomGradientBar\n\t\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t}\n\t\t\t\tbackground={ background }\n\t\t\t\thasGradient={ hasGradient }\n\t\t\t\tvalue={ controlPoints }\n\t\t\t\tonChange={ ( newControlPoints ) => {\n\t\t\t\t\tonChange(\n\t\t\t\t\t\tserializeGradient(\n\t\t\t\t\t\t\tgetGradientAstWithControlPoints(\n\t\t\t\t\t\t\t\tgradientAST,\n\t\t\t\t\t\t\t\tnewControlPoints\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} }\n\t\t\t/>\n\t\t\t<Flex\n\t\t\t\tgap={ 3 }\n\t\t\t\tclassName=\"components-custom-gradient-picker__ui-line\"\n\t\t\t>\n\t\t\t\t<SelectWrapper>\n\t\t\t\t\t<GradientTypePicker\n\t\t\t\t\t\tgradientAST={ gradientAST }\n\t\t\t\t\t\thasGradient={ hasGradient }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t/>\n\t\t\t\t</SelectWrapper>\n\t\t\t\t<AccessoryWrapper>\n\t\t\t\t\t{ gradientAST.type === 'linear-gradient' && (\n\t\t\t\t\t\t<GradientAnglePicker\n\t\t\t\t\t\t\tgradientAST={ gradientAST }\n\t\t\t\t\t\t\thasGradient={ hasGradient }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</AccessoryWrapper>\n\t\t\t</Flex>\n\t\t</VStack>\n\t);\n}\n\nexport default CustomGradientPicker;\n"],"mappings":";;;;;;;;AAQA,IAAAA,KAAA,GAAAC,OAAA;AAKA,IAAAC,mBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,YAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,cAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAMA,IAAAQ,WAAA,GAAAR,OAAA;AACA,IAAAS,UAAA,GAAAT,OAAA;AAKA,IAAAU,2BAAA,GAAAV,OAAA;AAGgD,IAAAW,WAAA,GAAAX,OAAA;AAjChD;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AA4BA,MAAMY,mBAAmB,GAAGA,CAAE;EAC7BC,WAAW;EACXC,WAAW;EACXC;AACyB,CAAC,KAAM;EAAA,IAAAC,qBAAA;EAChC,MAAMC,KAAK,IAAAD,qBAAA,GACVH,WAAW,EAAEK,WAAW,EAAEC,KAAK,cAAAH,qBAA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AK,EAAG6B,aAAe;MACvBjC,QAAQ,EAAK8C,gBAAgB,IAAM;QAClC9C,QAAQ,CACP,IAAAQ,6BAAiB,EAChB,IAAAuC,sCAA+B,EAC9BjD,WAAW,EACXgD,gBACD,CACD,CACD,CAAC;MACF;IAAG,CACH,CAAC,eACF,IAAAlD,WAAA,CAAA8C,IAAA,EAACrD,KAAA,CAAA2D,IAAI;MACJC,GAAG,EAAG,CAAG;MACT5B,SAAS,EAAC,4CAA4C;MAAAwB,QAAA,gBAEtD,IAAAjD,WAAA,CAAAc,GAAA,EAACf,2BAAA,CAAAuD,aAAa;QAAAL,QAAA,eACb,IAAAjD,WAAA,CAAAc,GAAA,EAACE,kBAAkB;UAClBd,WAAW,EAAGA,WAAa;UAC3BC,WAAW,EAAGA,WAAa;UAC3BC,QAAQ,EAAGA;QAAU,CACrB;MAAC,CACY,CAAC,eAChB,IAAAJ,WAAA,CAAAc,GAAA,EAACf,2BAAA,CAAAwD,gBAAgB;QAAAN,QAAA,EACd/C,WAAW,CAACW,IAAI,KAAK,iBAAiB,iBACvC,IAAAb,WAAA,CAAAc,GAAA,EAACb,mBAAmB;UACnBC,WAAW,EAAGA,WAAa;UAC3BC,WAAW,EAAGA,WAAa;UAC3BC,QAAQ,EAAGA;QAAU,CACrB;MACD,CACgB,CAAC;IAAA,CACd,CAAC;EAAA,CACA,CAAC;AAEX;AAAC,IAAAoD,QAAA,GAAAC,OAAA,CAAA1C,OAAA,GAEciB,oBAAoB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["serializeGradientColor","type","value","join","serializeGradientPosition","position","serializeGradientColorStop","length","serializeGradientOrientation","orientation","Array","isArray","serializeGradient","colorStops","serializedOrientation","serializedColorStops","sort","colorStop1","colorStop2","getNumericStopValue","colorStop","undefined","parseInt","map","filter","Boolean"],"sources":["@wordpress/components/src/custom-gradient-picker/serializer.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type gradientParser from 'gradient-parser';\n\nexport function serializeGradientColor( {\n\ttype,\n\tvalue,\n}: gradientParser.ColorStop ) {\n\tif ( type === 'literal' ) {\n\t\treturn value;\n\t}\n\tif ( type === 'hex' ) {\n\t\treturn `#${ value }`;\n\t}\n\treturn `${ type }(${ value.join( ',' ) })`;\n}\n\nexport function serializeGradientPosition(\n\tposition: gradientParser.ColorStop[ 'length' ]\n) {\n\tif ( ! position ) {\n\t\treturn '';\n\t}\n\tconst { value, type } = position;\n\treturn `${ value }${ type }`;\n}\n\nexport function serializeGradientColorStop( {\n\ttype,\n\tvalue,\n\tlength,\n}: gradientParser.ColorStop ) {\n\treturn `${ serializeGradientColor( {\n\t\ttype,\n\t\tvalue,\n\t} as gradientParser.ColorStop ) } ${ serializeGradientPosition( length ) }`;\n}\n\nexport function serializeGradientOrientation(\n\torientation: gradientParser.GradientNode[ 'orientation' ]\n) {\n\tif (\n\t\tArray.isArray( orientation ) ||\n\t\t! orientation ||\n\t\torientation.type !== 'angular'\n\t) {\n\t\treturn;\n\t}\n\treturn `${ orientation.value }deg`;\n}\n\nexport function serializeGradient( {\n\ttype,\n\torientation,\n\tcolorStops,\n}: gradientParser.GradientNode ) {\n\tconst serializedOrientation = serializeGradientOrientation( orientation );\n\tconst serializedColorStops = colorStops\n\t\t.sort( ( colorStop1, colorStop2 ) => {\n\t\t\tconst getNumericStopValue = (\n\t\t\t\tcolorStop: gradientParser.ColorStop\n\t\t\t) => {\n\t\t\t\treturn colorStop?.length?.value === undefined\n\t\t\t\t\t? 0\n\t\t\t\t\t: parseInt( colorStop.length.value );\n\t\t\t};\n\n\t\t\treturn (\n\t\t\t\tgetNumericStopValue( colorStop1 ) -\n\t\t\t\tgetNumericStopValue( colorStop2 )\n\t\t\t);\n\t\t} )\n\t\t.map( serializeGradientColorStop );\n\treturn `${ type }(${ [ serializedOrientation, ...serializedColorStops ]\n\t\t.filter( Boolean )\n\t\t.join( ',' ) })`;\n}\n"],"mappings":";;;;;;;;;;AAAA;AACA;AACA;;AAGO,SAASA,sBAAsBA,CAAE;EACvCC,IAAI;EACJC;AACyB,CAAC,EAAG;EAC7B,IAAKD,IAAI,KAAK,SAAS,EAAG;IACzB,OAAOC,KAAK;EACb;EACA,IAAKD,IAAI,KAAK,KAAK,EAAG;IACrB,
|
|
1
|
+
{"version":3,"names":["serializeGradientColor","type","value","join","serializeGradientPosition","position","serializeGradientColorStop","length","serializeGradientOrientation","orientation","Array","isArray","serializeGradient","colorStops","serializedOrientation","serializedColorStops","sort","colorStop1","colorStop2","getNumericStopValue","colorStop","undefined","parseInt","map","filter","Boolean"],"sources":["@wordpress/components/src/custom-gradient-picker/serializer.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type gradientParser from 'gradient-parser';\n\nexport function serializeGradientColor( {\n\ttype,\n\tvalue,\n}: gradientParser.ColorStop ) {\n\tif ( type === 'literal' ) {\n\t\treturn value;\n\t}\n\tif ( type === 'hex' ) {\n\t\treturn `#${ value }`;\n\t}\n\treturn `${ type }(${ value.join( ',' ) })`;\n}\n\nexport function serializeGradientPosition(\n\tposition: gradientParser.ColorStop[ 'length' ]\n) {\n\tif ( ! position ) {\n\t\treturn '';\n\t}\n\tconst { value, type } = position;\n\treturn `${ value }${ type }`;\n}\n\nexport function serializeGradientColorStop( {\n\ttype,\n\tvalue,\n\tlength,\n}: gradientParser.ColorStop ) {\n\treturn `${ serializeGradientColor( {\n\t\ttype,\n\t\tvalue,\n\t} as gradientParser.ColorStop ) } ${ serializeGradientPosition( length ) }`;\n}\n\nexport function serializeGradientOrientation(\n\torientation: gradientParser.GradientNode[ 'orientation' ]\n) {\n\tif (\n\t\tArray.isArray( orientation ) ||\n\t\t! orientation ||\n\t\torientation.type !== 'angular'\n\t) {\n\t\treturn;\n\t}\n\treturn `${ orientation.value }deg`;\n}\n\nexport function serializeGradient( {\n\ttype,\n\torientation,\n\tcolorStops,\n}: gradientParser.GradientNode ) {\n\tconst serializedOrientation = serializeGradientOrientation( orientation );\n\tconst serializedColorStops = colorStops\n\t\t.sort( ( colorStop1, colorStop2 ) => {\n\t\t\tconst getNumericStopValue = (\n\t\t\t\tcolorStop: gradientParser.ColorStop\n\t\t\t) => {\n\t\t\t\treturn colorStop?.length?.value === undefined\n\t\t\t\t\t? 0\n\t\t\t\t\t: parseInt( colorStop.length.value );\n\t\t\t};\n\n\t\t\treturn (\n\t\t\t\tgetNumericStopValue( colorStop1 ) -\n\t\t\t\tgetNumericStopValue( colorStop2 )\n\t\t\t);\n\t\t} )\n\t\t.map( serializeGradientColorStop );\n\treturn `${ type }(${ [ serializedOrientation, ...serializedColorStops ]\n\t\t.filter( Boolean )\n\t\t.join( ',' ) })`;\n}\n"],"mappings":";;;;;;;;;;AAAA;AACA;AACA;;AAGO,SAASA,sBAAsBA,CAAE;EACvCC,IAAI;EACJC;AACyB,CAAC,EAAG;EAC7B,IAAKD,IAAI,KAAK,SAAS,EAAG;IACzB,OAAOC,KAAK;EACb;EACA,IAAKD,IAAI,KAAK,KAAK,EAAG;IACrB,OAAO,IAAKC,KAAK,EAAG;EACrB;EACA,OAAO,GAAID,IAAI,IAAMC,KAAK,CAACC,IAAI,CAAE,GAAI,CAAC,GAAI;AAC3C;AAEO,SAASC,yBAAyBA,CACxCC,QAA8C,EAC7C;EACD,IAAK,CAAEA,QAAQ,EAAG;IACjB,OAAO,EAAE;EACV;EACA,MAAM;IAAEH,KAAK;IAAED;EAAK,CAAC,GAAGI,QAAQ;EAChC,OAAO,GAAIH,KAAK,GAAKD,IAAI,EAAG;AAC7B;AAEO,SAASK,0BAA0BA,CAAE;EAC3CL,IAAI;EACJC,KAAK;EACLK;AACyB,CAAC,EAAG;EAC7B,OAAO,GAAIP,sBAAsB,CAAE;IAClCC,IAAI;IACJC;EACD,CAA8B,CAAC,IAAME,yBAAyB,CAAEG,MAAO,CAAC,EAAG;AAC5E;AAEO,SAASC,4BAA4BA,CAC3CC,WAAyD,EACxD;EACD,IACCC,KAAK,CAACC,OAAO,CAAEF,WAAY,CAAC,IAC5B,CAAEA,WAAW,IACbA,WAAW,CAACR,IAAI,KAAK,SAAS,EAC7B;IACD;EACD;EACA,OAAO,GAAIQ,WAAW,CAACP,KAAK,KAAM;AACnC;AAEO,SAASU,iBAAiBA,CAAE;EAClCX,IAAI;EACJQ,WAAW;EACXI;AAC4B,CAAC,EAAG;EAChC,MAAMC,qBAAqB,GAAGN,4BAA4B,CAAEC,WAAY,CAAC;EACzE,MAAMM,oBAAoB,GAAGF,UAAU,CACrCG,IAAI,CAAE,CAAEC,UAAU,EAAEC,UAAU,KAAM;IACpC,MAAMC,mBAAmB,GACxBC,SAAmC,IAC/B;MACJ,OAAOA,SAAS,EAAEb,MAAM,EAAEL,KAAK,KAAKmB,SAAS,GAC1C,CAAC,GACDC,QAAQ,CAAEF,SAAS,CAACb,MAAM,CAACL,KAAM,CAAC;IACtC,CAAC;IAED,OACCiB,mBAAmB,CAAEF,UAAW,CAAC,GACjCE,mBAAmB,CAAED,UAAW,CAAC;EAEnC,CAAE,CAAC,CACFK,GAAG,CAAEjB,0BAA2B,CAAC;EACnC,OAAO,GAAIL,IAAI,IAAM,CAAEa,qBAAqB,EAAE,GAAGC,oBAAoB,CAAE,CACrES,MAAM,CAAEC,OAAQ,CAAC,CACjBtB,IAAI,CAAE,GAAI,CAAC,GAAI;AAClB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_gradientParser","_interopRequireDefault","require","_colord","_names","_constants","_serializer","extend","namesPlugin","getLinearGradientRepresentation","gradientAST","serializeGradient","type","orientation","HORIZONTAL_GRADIENT_ORIENTATION","colorStops","hasUnsupportedLength","item","length","undefined","getGradientAstWithDefault","value","hasGradient","valueToParse","DEFAULT_GRADIENT","gradientParser","parse","error","console","warn","Array","isArray","DIRECTIONAL_ORIENTATION_ANGLE_MAP","toString","some","step","forEach","stop","index","getGradientAstWithControlPoints","newControlPoints","map","position","color","r","g","b","a","colord","toRgb","getStopCssColor","colorStop","join"],"sources":["@wordpress/components/src/custom-gradient-picker/utils.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport gradientParser from 'gradient-parser';\nimport { colord, extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\n\n/**\n * Internal dependencies\n */\nimport {\n\tDEFAULT_GRADIENT,\n\tHORIZONTAL_GRADIENT_ORIENTATION,\n\tDIRECTIONAL_ORIENTATION_ANGLE_MAP,\n} from './constants';\nimport { serializeGradient } from './serializer';\nimport type { ControlPoint } from './types';\n\nextend( [ namesPlugin ] );\n\nexport function getLinearGradientRepresentation(\n\tgradientAST: gradientParser.GradientNode\n) {\n\treturn serializeGradient( {\n\t\ttype: 'linear-gradient',\n\t\torientation: HORIZONTAL_GRADIENT_ORIENTATION,\n\t\tcolorStops: gradientAST.colorStops,\n\t} );\n}\n\nfunction hasUnsupportedLength( item: gradientParser.ColorStop ) {\n\treturn item.length === undefined || item.length.type !== '%';\n}\n\nexport function getGradientAstWithDefault( value?: string | null ) {\n\t// gradientAST will contain the gradient AST as parsed by gradient-parser npm module.\n\t// More information of its structure available at https://www.npmjs.com/package/gradient-parser#ast.\n\tlet gradientAST: gradientParser.GradientNode | undefined;\n\tlet hasGradient = !! value;\n\n\tconst valueToParse = value ?? DEFAULT_GRADIENT;\n\n\ttry {\n\t\tgradientAST = gradientParser.parse( valueToParse )[ 0 ];\n\t} catch ( error ) {\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.warn(\n\t\t\t'wp.components.CustomGradientPicker failed to parse the gradient with error',\n\t\t\terror\n\t\t);\n\n\t\tgradientAST = gradientParser.parse( DEFAULT_GRADIENT )[ 0 ];\n\t\thasGradient = false;\n\t}\n\n\tif (\n\t\t! Array.isArray( gradientAST.orientation ) &&\n\t\tgradientAST.orientation?.type === 'directional'\n\t) {\n\t\tgradientAST.orientation = {\n\t\t\ttype: 'angular',\n\t\t\tvalue: DIRECTIONAL_ORIENTATION_ANGLE_MAP[\n\t\t\t\tgradientAST.orientation.value\n\t\t\t].toString(),\n\t\t};\n\t}\n\n\tif ( gradientAST.colorStops.some( hasUnsupportedLength ) ) {\n\t\tconst { colorStops } = gradientAST;\n\t\tconst step = 100 / ( colorStops.length - 1 );\n\t\tcolorStops.forEach( ( stop, index ) => {\n\t\t\tstop.length = {\n\t\t\t\tvalue: `${ step * index }`,\n\t\t\t\ttype: '%',\n\t\t\t};\n\t\t} );\n\t}\n\n\treturn { gradientAST, hasGradient };\n}\n\nexport function getGradientAstWithControlPoints(\n\tgradientAST: gradientParser.GradientNode,\n\tnewControlPoints: ControlPoint[]\n) {\n\treturn {\n\t\t...gradientAST,\n\t\tcolorStops: newControlPoints.map( ( { position, color } ) => {\n\t\t\tconst { r, g, b, a } = colord( color ).toRgb();\n\t\t\treturn {\n\t\t\t\tlength: {\n\t\t\t\t\ttype: '%',\n\t\t\t\t\tvalue: position?.toString(),\n\t\t\t\t},\n\t\t\t\ttype: a < 1 ? 'rgba' : 'rgb',\n\t\t\t\tvalue:\n\t\t\t\t\ta < 1\n\t\t\t\t\t\t? [ `${ r }`, `${ g }`, `${ b }`, `${ a }` ]\n\t\t\t\t\t\t: [ `${ r }`, `${ g }`, `${ b }` ],\n\t\t\t};\n\t\t} ),\n\t} as gradientParser.GradientNode;\n}\n\nexport function getStopCssColor( colorStop: gradientParser.ColorStop ) {\n\tswitch ( colorStop.type ) {\n\t\tcase 'hex':\n\t\t\treturn `#${ colorStop.value }`;\n\t\tcase 'literal':\n\t\t\treturn colorStop.value;\n\t\tcase 'rgb':\n\t\tcase 'rgba':\n\t\t\treturn `${ colorStop.type }(${ colorStop.value.join( ',' ) })`;\n\t\tdefault:\n\t\t\t// Should be unreachable if passing an AST from gradient-parser.\n\t\t\t// See https://github.com/rafaelcaricio/gradient-parser#ast.\n\t\t\treturn 'transparent';\n\t}\n}\n"],"mappings":";;;;;;;;;;AAGA,IAAAA,eAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAH,sBAAA,CAAAC,OAAA;AAKA,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AAQ,CAAC;IACZ,CAAC;EACF;EAEA,IAAKvB,WAAW,CAACK,UAAU,CAACmB,IAAI,CAAElB,oBAAqB,CAAC,EAAG;IAC1D,MAAM;MAAED;IAAW,CAAC,GAAGL,WAAW;IAClC,MAAMyB,IAAI,GAAG,GAAG,IAAKpB,UAAU,CAACG,MAAM,GAAG,CAAC,CAAE;IAC5CH,UAAU,CAACqB,OAAO,CAAE,CAAEC,IAAI,EAAEC,KAAK,KAAM;MACtCD,IAAI,CAACnB,MAAM,GAAG;QACbG,KAAK,
|
|
1
|
+
{"version":3,"names":["_gradientParser","_interopRequireDefault","require","_colord","_names","_constants","_serializer","extend","namesPlugin","getLinearGradientRepresentation","gradientAST","serializeGradient","type","orientation","HORIZONTAL_GRADIENT_ORIENTATION","colorStops","hasUnsupportedLength","item","length","undefined","getGradientAstWithDefault","value","hasGradient","valueToParse","DEFAULT_GRADIENT","gradientParser","parse","error","console","warn","Array","isArray","DIRECTIONAL_ORIENTATION_ANGLE_MAP","toString","some","step","forEach","stop","index","getGradientAstWithControlPoints","newControlPoints","map","position","color","r","g","b","a","colord","toRgb","getStopCssColor","colorStop","join"],"sources":["@wordpress/components/src/custom-gradient-picker/utils.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport gradientParser from 'gradient-parser';\nimport { colord, extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\n\n/**\n * Internal dependencies\n */\nimport {\n\tDEFAULT_GRADIENT,\n\tHORIZONTAL_GRADIENT_ORIENTATION,\n\tDIRECTIONAL_ORIENTATION_ANGLE_MAP,\n} from './constants';\nimport { serializeGradient } from './serializer';\nimport type { ControlPoint } from './types';\n\nextend( [ namesPlugin ] );\n\nexport function getLinearGradientRepresentation(\n\tgradientAST: gradientParser.GradientNode\n) {\n\treturn serializeGradient( {\n\t\ttype: 'linear-gradient',\n\t\torientation: HORIZONTAL_GRADIENT_ORIENTATION,\n\t\tcolorStops: gradientAST.colorStops,\n\t} );\n}\n\nfunction hasUnsupportedLength( item: gradientParser.ColorStop ) {\n\treturn item.length === undefined || item.length.type !== '%';\n}\n\nexport function getGradientAstWithDefault( value?: string | null ) {\n\t// gradientAST will contain the gradient AST as parsed by gradient-parser npm module.\n\t// More information of its structure available at https://www.npmjs.com/package/gradient-parser#ast.\n\tlet gradientAST: gradientParser.GradientNode | undefined;\n\tlet hasGradient = !! value;\n\n\tconst valueToParse = value ?? DEFAULT_GRADIENT;\n\n\ttry {\n\t\tgradientAST = gradientParser.parse( valueToParse )[ 0 ];\n\t} catch ( error ) {\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.warn(\n\t\t\t'wp.components.CustomGradientPicker failed to parse the gradient with error',\n\t\t\terror\n\t\t);\n\n\t\tgradientAST = gradientParser.parse( DEFAULT_GRADIENT )[ 0 ];\n\t\thasGradient = false;\n\t}\n\n\tif (\n\t\t! Array.isArray( gradientAST.orientation ) &&\n\t\tgradientAST.orientation?.type === 'directional'\n\t) {\n\t\tgradientAST.orientation = {\n\t\t\ttype: 'angular',\n\t\t\tvalue: DIRECTIONAL_ORIENTATION_ANGLE_MAP[\n\t\t\t\tgradientAST.orientation.value\n\t\t\t].toString(),\n\t\t};\n\t}\n\n\tif ( gradientAST.colorStops.some( hasUnsupportedLength ) ) {\n\t\tconst { colorStops } = gradientAST;\n\t\tconst step = 100 / ( colorStops.length - 1 );\n\t\tcolorStops.forEach( ( stop, index ) => {\n\t\t\tstop.length = {\n\t\t\t\tvalue: `${ step * index }`,\n\t\t\t\ttype: '%',\n\t\t\t};\n\t\t} );\n\t}\n\n\treturn { gradientAST, hasGradient };\n}\n\nexport function getGradientAstWithControlPoints(\n\tgradientAST: gradientParser.GradientNode,\n\tnewControlPoints: ControlPoint[]\n) {\n\treturn {\n\t\t...gradientAST,\n\t\tcolorStops: newControlPoints.map( ( { position, color } ) => {\n\t\t\tconst { r, g, b, a } = colord( color ).toRgb();\n\t\t\treturn {\n\t\t\t\tlength: {\n\t\t\t\t\ttype: '%',\n\t\t\t\t\tvalue: position?.toString(),\n\t\t\t\t},\n\t\t\t\ttype: a < 1 ? 'rgba' : 'rgb',\n\t\t\t\tvalue:\n\t\t\t\t\ta < 1\n\t\t\t\t\t\t? [ `${ r }`, `${ g }`, `${ b }`, `${ a }` ]\n\t\t\t\t\t\t: [ `${ r }`, `${ g }`, `${ b }` ],\n\t\t\t};\n\t\t} ),\n\t} as gradientParser.GradientNode;\n}\n\nexport function getStopCssColor( colorStop: gradientParser.ColorStop ) {\n\tswitch ( colorStop.type ) {\n\t\tcase 'hex':\n\t\t\treturn `#${ colorStop.value }`;\n\t\tcase 'literal':\n\t\t\treturn colorStop.value;\n\t\tcase 'rgb':\n\t\tcase 'rgba':\n\t\t\treturn `${ colorStop.type }(${ colorStop.value.join( ',' ) })`;\n\t\tdefault:\n\t\t\t// Should be unreachable if passing an AST from gradient-parser.\n\t\t\t// See https://github.com/rafaelcaricio/gradient-parser#ast.\n\t\t\treturn 'transparent';\n\t}\n}\n"],"mappings":";;;;;;;;;;AAGA,IAAAA,eAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAH,sBAAA,CAAAC,OAAA;AAKA,IAAAG,UAAA,GAAAH,OAAA;AAKA,IAAAI,WAAA,GAAAJ,OAAA;AAfA;AACA;AACA;;AAKA;AACA;AACA;;AASA,IAAAK,cAAM,EAAE,CAAEC,cAAW,CAAG,CAAC;AAElB,SAASC,+BAA+BA,CAC9CC,WAAwC,EACvC;EACD,OAAO,IAAAC,6BAAiB,EAAE;IACzBC,IAAI,EAAE,iBAAiB;IACvBC,WAAW,EAAEC,0CAA+B;IAC5CC,UAAU,EAAEL,WAAW,CAACK;EACzB,CAAE,CAAC;AACJ;AAEA,SAASC,oBAAoBA,CAAEC,IAA8B,EAAG;EAC/D,OAAOA,IAAI,CAACC,MAAM,KAAKC,SAAS,IAAIF,IAAI,CAACC,MAAM,CAACN,IAAI,KAAK,GAAG;AAC7D;AAEO,SAASQ,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