@wordpress/components 19.0.1 → 19.0.2
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/build/alignment-matrix-control/cell.js +6 -5
- package/build/alignment-matrix-control/cell.js.map +1 -1
- package/build/alignment-matrix-control/icon.js +9 -8
- package/build/alignment-matrix-control/icon.js.map +1 -1
- package/build/alignment-matrix-control/index.js +11 -10
- package/build/alignment-matrix-control/index.js.map +1 -1
- package/build/alignment-matrix-control/styles/alignment-matrix-control-icon-styles.js +9 -7
- package/build/alignment-matrix-control/styles/alignment-matrix-control-icon-styles.js.map +1 -1
- package/build/alignment-matrix-control/styles/alignment-matrix-control-styles.js +9 -7
- package/build/alignment-matrix-control/styles/alignment-matrix-control-styles.js.map +1 -1
- package/build/alignment-matrix-control/utils.js +5 -4
- package/build/alignment-matrix-control/utils.js.map +1 -1
- package/build/angle-picker-control/angle-circle.js +6 -5
- package/build/angle-picker-control/angle-circle.js.map +1 -1
- package/build/angle-picker-control/index.js +8 -6
- package/build/angle-picker-control/index.js.map +1 -1
- package/build/angle-picker-control/styles/angle-picker-control-styles.js +1 -1
- package/build/animate/index.js +7 -6
- package/build/animate/index.js.map +1 -1
- package/build/animation/index.js +6 -6
- package/build/autocomplete/autocompleter-ui.js +13 -12
- package/build/autocomplete/autocompleter-ui.js.map +1 -1
- package/build/autocomplete/autocompleter-ui.native.js +15 -12
- package/build/autocomplete/autocompleter-ui.native.js.map +1 -1
- package/build/autocomplete/background-view.android.js +4 -3
- package/build/autocomplete/background-view.android.js.map +1 -1
- package/build/autocomplete/background-view.ios.js +4 -3
- package/build/autocomplete/background-view.ios.js.map +1 -1
- package/build/autocomplete/get-default-use-items.js +3 -1
- package/build/autocomplete/get-default-use-items.js.map +1 -1
- package/build/autocomplete/index.js +20 -17
- package/build/autocomplete/index.js.map +1 -1
- package/build/base-control/index.js +14 -12
- package/build/base-control/index.js.map +1 -1
- package/build/base-control/index.native.js +6 -5
- package/build/base-control/index.native.js.map +1 -1
- package/build/base-control/styles/base-control-styles.js +1 -1
- package/build/base-field/hook.js +4 -2
- package/build/base-field/hook.js.map +1 -1
- package/build/base-field/styles.js +1 -1
- package/build/box-control/all-input-control.js +12 -11
- package/build/box-control/all-input-control.js.map +1 -1
- package/build/box-control/axial-input-controls.js +13 -11
- package/build/box-control/axial-input-controls.js.map +1 -1
- package/build/box-control/icon.js +8 -6
- package/build/box-control/icon.js.map +1 -1
- package/build/box-control/index.js +22 -18
- package/build/box-control/index.js.map +1 -1
- package/build/box-control/input-controls.js +17 -14
- package/build/box-control/input-controls.js.map +1 -1
- package/build/box-control/linked-button.js +5 -4
- package/build/box-control/linked-button.js.map +1 -1
- package/build/box-control/styles/box-control-icon-styles.js +5 -4
- package/build/box-control/styles/box-control-icon-styles.js.map +1 -1
- package/build/box-control/styles/box-control-styles.js +13 -10
- package/build/box-control/styles/box-control-styles.js.map +1 -1
- package/build/box-control/styles/box-control-visualizer-styles.js +12 -8
- package/build/box-control/styles/box-control-visualizer-styles.js.map +1 -1
- package/build/box-control/unit-control.js +22 -18
- package/build/box-control/unit-control.js.map +1 -1
- package/build/box-control/utils.js +10 -6
- package/build/box-control/utils.js.map +1 -1
- package/build/box-control/visualizer.js +32 -26
- package/build/box-control/visualizer.js.map +1 -1
- package/build/button/deprecated.js +8 -7
- package/build/button/deprecated.js.map +1 -1
- package/build/button/index.js +15 -24
- package/build/button/index.js.map +1 -1
- package/build/button-group/index.js +5 -4
- package/build/button-group/index.js.map +1 -1
- package/build/card/card/component.js +4 -2
- package/build/card/card/component.js.map +1 -1
- package/build/card/card/hook.js +12 -10
- package/build/card/card/hook.js.map +1 -1
- package/build/card/card-body/hook.js +4 -2
- package/build/card/card-body/hook.js.map +1 -1
- package/build/card/card-divider/hook.js +4 -2
- package/build/card/card-divider/hook.js.map +1 -1
- package/build/card/card-footer/hook.js +4 -2
- package/build/card/card-footer/hook.js.map +1 -1
- package/build/card/card-header/hook.js +4 -2
- package/build/card/card-header/hook.js.map +1 -1
- package/build/card/card-media/hook.js +4 -2
- package/build/card/card-media/hook.js.map +1 -1
- package/build/card/index.js +24 -22
- package/build/card/index.js.map +1 -1
- package/build/card/styles.js +1 -1
- package/build/card/types.js +4 -0
- package/build/checkbox-control/index.js +11 -9
- package/build/checkbox-control/index.js.map +1 -1
- package/build/circular-option-picker/index.js +40 -33
- package/build/circular-option-picker/index.js.map +1 -1
- package/build/clipboard-button/index.js +9 -8
- package/build/clipboard-button/index.js.map +1 -1
- package/build/color-control/index.native.js +8 -7
- package/build/color-control/index.native.js.map +1 -1
- package/build/color-edit/index.js +53 -40
- package/build/color-edit/index.js.map +1 -1
- package/build/color-edit/styles.js +1 -1
- package/build/color-indicator/index.js +13 -10
- package/build/color-indicator/index.js.map +1 -1
- package/build/color-indicator/index.native.js +12 -10
- package/build/color-indicator/index.native.js.map +1 -1
- package/build/color-list-picker/index.js +18 -16
- package/build/color-list-picker/index.js.map +1 -1
- package/build/color-palette/index.js +55 -47
- package/build/color-palette/index.js.map +1 -1
- package/build/color-palette/index.native.js +23 -20
- package/build/color-palette/index.native.js.map +1 -1
- package/build/color-picker/color-display.js +35 -27
- package/build/color-picker/color-display.js.map +1 -1
- package/build/color-picker/color-input.js +7 -6
- package/build/color-picker/color-input.js.map +1 -1
- package/build/color-picker/hex-input.js +7 -5
- package/build/color-picker/hex-input.js.map +1 -1
- package/build/color-picker/hsl-input.js +6 -5
- package/build/color-picker/hsl-input.js.map +1 -1
- package/build/color-picker/index.native.js +23 -20
- package/build/color-picker/index.native.js.map +1 -1
- package/build/color-picker/input-with-slider.js +9 -8
- package/build/color-picker/input-with-slider.js.map +1 -1
- package/build/color-picker/picker.js +6 -5
- package/build/color-picker/picker.js.map +1 -1
- package/build/color-picker/rgb-input.js +6 -5
- package/build/color-picker/rgb-input.js.map +1 -1
- package/build/color-picker/styles.js +1 -1
- package/build/color-picker/types.js +4 -0
- package/build/combobox-control/index.js +17 -15
- package/build/combobox-control/index.js.map +1 -1
- package/build/custom-gradient-bar/constants.js +1 -1
- package/build/custom-gradient-bar/control-points.js +120 -108
- package/build/custom-gradient-bar/control-points.js.map +1 -1
- package/build/custom-gradient-bar/index.js +13 -11
- package/build/custom-gradient-bar/index.js.map +1 -1
- package/build/custom-gradient-bar/utils.js +9 -7
- package/build/custom-gradient-bar/utils.js.map +1 -1
- package/build/custom-gradient-picker/constants.js +1 -1
- package/build/custom-gradient-picker/index.js +17 -14
- package/build/custom-gradient-picker/index.js.map +1 -1
- package/build/custom-gradient-picker/index.native.js +6 -5
- package/build/custom-gradient-picker/index.native.js.map +1 -1
- package/build/custom-gradient-picker/serializer.js +20 -16
- package/build/custom-gradient-picker/serializer.js.map +1 -1
- package/build/custom-gradient-picker/styles/custom-gradient-picker-styles.js +1 -1
- package/build/custom-gradient-picker/utils.js +7 -6
- package/build/custom-gradient-picker/utils.js.map +1 -1
- package/build/custom-select-control/index.js +22 -18
- package/build/custom-select-control/index.js.map +1 -1
- package/build/dashicon/index.js +6 -5
- package/build/dashicon/index.js.map +1 -1
- package/build/dashicon/index.native.js +9 -6
- package/build/dashicon/index.native.js.map +1 -1
- package/build/dashicon/types.js +4 -0
- package/build/date-time/date.js +5 -4
- package/build/date-time/date.js.map +1 -1
- package/build/date-time/index.js +9 -8
- package/build/date-time/index.js.map +1 -1
- package/build/date-time/time.js +14 -11
- package/build/date-time/time.js.map +1 -1
- package/build/dimension-control/index.js +14 -9
- package/build/dimension-control/index.js.map +1 -1
- package/build/dimension-control/sizes.js +1 -1
- package/build/disabled/index.js +8 -6
- package/build/disabled/index.js.map +1 -1
- package/build/disabled/index.native.js +4 -3
- package/build/disabled/index.native.js.map +1 -1
- package/build/divider/styles.js +7 -5
- package/build/divider/styles.js.map +1 -1
- package/build/divider/types.js +4 -0
- package/build/draggable/index.js +13 -11
- package/build/draggable/index.js.map +1 -1
- package/build/drop-zone/index.js +8 -7
- package/build/drop-zone/index.js.map +1 -1
- package/build/drop-zone/provider.js +4 -3
- package/build/drop-zone/provider.js.map +1 -1
- package/build/dropdown/index.js +14 -13
- package/build/dropdown/index.js.map +1 -1
- package/build/dropdown-menu/index.js +9 -5
- package/build/dropdown-menu/index.js.map +1 -1
- package/build/dropdown-menu/index.native.js +26 -19
- package/build/dropdown-menu/index.native.js.map +1 -1
- package/build/duotone-picker/custom-duotone-bar.js +5 -4
- package/build/duotone-picker/custom-duotone-bar.js.map +1 -1
- package/build/duotone-picker/duotone-picker.js +15 -13
- package/build/duotone-picker/duotone-picker.js.map +1 -1
- package/build/duotone-picker/duotone-swatch.js +4 -3
- package/build/duotone-picker/duotone-swatch.js.map +1 -1
- package/build/duotone-picker/utils.js +29 -16
- package/build/duotone-picker/utils.js.map +1 -1
- package/build/elevation/hook.js +4 -2
- package/build/elevation/hook.js.map +1 -1
- package/build/elevation/types.js +4 -0
- package/build/external-link/index.js +8 -7
- package/build/external-link/index.js.map +1 -1
- package/build/external-link/index.native.js +5 -4
- package/build/external-link/index.native.js.map +1 -1
- package/build/flex/flex/hook.js +10 -6
- package/build/flex/flex/hook.js.map +1 -1
- package/build/flex/flex-item/hook.js +4 -2
- package/build/flex/flex-item/hook.js.map +1 -1
- package/build/flex/index.js +12 -10
- package/build/flex/index.js.map +1 -1
- package/build/flex/styles.js +1 -1
- package/build/flex/types.js +4 -0
- package/build/flyout/styles.js +5 -3
- package/build/flyout/styles.js.map +1 -1
- package/build/flyout/types.js +4 -0
- package/build/flyout/utils.js +4 -3
- package/build/flyout/utils.js.map +1 -1
- package/build/focal-point-picker/controls.js +8 -7
- package/build/focal-point-picker/controls.js.map +1 -1
- package/build/focal-point-picker/focal-point.js +8 -7
- package/build/focal-point-picker/focal-point.js.map +1 -1
- package/build/focal-point-picker/focal-point.native.js +6 -5
- package/build/focal-point-picker/focal-point.native.js.map +1 -1
- package/build/focal-point-picker/grid.js +6 -5
- package/build/focal-point-picker/grid.js.map +1 -1
- package/build/focal-point-picker/index.js +2 -1
- package/build/focal-point-picker/index.js.map +1 -1
- package/build/focal-point-picker/media.js +19 -16
- package/build/focal-point-picker/media.js.map +1 -1
- package/build/focal-point-picker/styles/focal-point-picker-style.js +8 -5
- package/build/focal-point-picker/styles/focal-point-picker-style.js.map +1 -1
- package/build/focal-point-picker/styles/focal-point-style.js +7 -4
- package/build/focal-point-picker/styles/focal-point-style.js.map +1 -1
- package/build/focal-point-picker/tooltip/index.native.js +18 -15
- package/build/focal-point-picker/tooltip/index.native.js.map +1 -1
- package/build/focal-point-picker/utils.js +6 -4
- package/build/focal-point-picker/utils.js.map +1 -1
- package/build/focusable-iframe/index.js +5 -4
- package/build/focusable-iframe/index.js.map +1 -1
- package/build/font-size-picker/index.js +24 -17
- package/build/font-size-picker/index.js.map +1 -1
- package/build/font-size-picker/index.native.js +11 -8
- package/build/font-size-picker/index.native.js.map +1 -1
- package/build/font-size-picker/utils.js +22 -18
- package/build/font-size-picker/utils.js.map +1 -1
- package/build/footer-message-control/index.native.js +3 -2
- package/build/footer-message-control/index.native.js.map +1 -1
- package/build/form-file-upload/index.js +9 -8
- package/build/form-file-upload/index.js.map +1 -1
- package/build/form-toggle/index.js +9 -8
- package/build/form-toggle/index.js.map +1 -1
- package/build/form-token-field/index.js +8 -2
- package/build/form-token-field/index.js.map +1 -1
- package/build/form-token-field/token.js +15 -14
- package/build/form-token-field/token.js.map +1 -1
- package/build/gradient-picker/index.js +56 -49
- package/build/gradient-picker/index.js.map +1 -1
- package/build/grid/types.js +4 -0
- package/build/guide/icons.js +16 -13
- package/build/guide/icons.js.map +1 -1
- package/build/guide/index.js +9 -8
- package/build/guide/index.js.map +1 -1
- package/build/guide/page-control.js +6 -5
- package/build/guide/page-control.js.map +1 -1
- package/build/h-stack/types.js +4 -0
- package/build/h-stack/utils.js +3 -1
- package/build/h-stack/utils.js.map +1 -1
- package/build/higher-order/navigate-regions/index.js +20 -14
- package/build/higher-order/navigate-regions/index.js.map +1 -1
- package/build/higher-order/with-focus-return/index.js +18 -14
- package/build/higher-order/with-focus-return/index.js.map +1 -1
- package/build/icon/index.js +7 -5
- package/build/icon/index.js.map +1 -1
- package/build/index.js +314 -312
- package/build/index.js.map +1 -1
- package/build/index.native.js +220 -218
- package/build/index.native.js.map +1 -1
- package/build/input-control/backdrop.js +5 -4
- package/build/input-control/backdrop.js.map +1 -1
- package/build/input-control/index.js +20 -19
- package/build/input-control/index.js.map +1 -1
- package/build/input-control/input-base.js +16 -15
- package/build/input-control/input-base.js.map +1 -1
- package/build/input-control/input-field.js +24 -23
- package/build/input-control/input-field.js.map +1 -1
- package/build/input-control/label.js +7 -6
- package/build/input-control/label.js.map +1 -1
- package/build/input-control/reducer/actions.js +1 -1
- package/build/input-control/reducer/reducer.js +20 -7
- package/build/input-control/reducer/reducer.js.map +1 -1
- package/build/input-control/reducer/state.js +1 -1
- package/build/input-control/styles/input-control-styles.js +49 -37
- package/build/input-control/styles/input-control-styles.js.map +1 -1
- package/build/input-control/types.js +4 -0
- package/build/isolated-event-container/index.js +5 -4
- package/build/isolated-event-container/index.js.map +1 -1
- package/build/item-group/item/hook.js +4 -2
- package/build/item-group/item/hook.js.map +1 -1
- package/build/item-group/item-group/hook.js +4 -2
- package/build/item-group/item-group/hook.js.map +1 -1
- package/build/item-group/styles.js +1 -1
- package/build/item-group/types.js +4 -0
- package/build/keyboard-shortcuts/index.js +15 -13
- package/build/keyboard-shortcuts/index.js.map +1 -1
- package/build/menu-items-choice/index.js +7 -6
- package/build/menu-items-choice/index.js.map +1 -1
- package/build/mobile/audio-player/index.native.js +8 -7
- package/build/mobile/audio-player/index.native.js.map +1 -1
- package/build/mobile/badge/index.native.js +6 -5
- package/build/mobile/badge/index.native.js.map +1 -1
- package/build/mobile/bottom-sheet/bottom-sheet-context.native.js +1 -1
- package/build/mobile/bottom-sheet/bottom-sheet-navigation/bottom-sheet-navigation-context.native.js +1 -1
- package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +12 -10
- package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js.map +1 -1
- package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +12 -9
- package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js.map +1 -1
- package/build/mobile/bottom-sheet/button.native.js +21 -18
- package/build/mobile/bottom-sheet/button.native.js.map +1 -1
- package/build/mobile/bottom-sheet/footer-message-cell.native.js +5 -4
- package/build/mobile/bottom-sheet/footer-message-cell.native.js.map +1 -1
- package/build/mobile/bottom-sheet/footer-message-link/footer-message-link.native.js +5 -4
- package/build/mobile/bottom-sheet/footer-message-link/footer-message-link.native.js.map +1 -1
- package/build/mobile/bottom-sheet/index.native.js +24 -17
- package/build/mobile/bottom-sheet/index.native.js.map +1 -1
- package/build/mobile/bottom-sheet/link-cell.native.js +7 -6
- package/build/mobile/bottom-sheet/link-cell.native.js.map +1 -1
- package/build/mobile/bottom-sheet/link-suggestion-item-cell.native.js +5 -4
- package/build/mobile/bottom-sheet/link-suggestion-item-cell.native.js.map +1 -1
- package/build/mobile/bottom-sheet/nav-bar/action-button.native.js +7 -6
- package/build/mobile/bottom-sheet/nav-bar/action-button.native.js.map +1 -1
- package/build/mobile/bottom-sheet/nav-bar/apply-button.native.js +4 -3
- package/build/mobile/bottom-sheet/nav-bar/apply-button.native.js.map +1 -1
- package/build/mobile/bottom-sheet/nav-bar/back-button.native.js +15 -12
- package/build/mobile/bottom-sheet/nav-bar/back-button.native.js.map +1 -1
- package/build/mobile/bottom-sheet/nav-bar/heading.native.js +4 -3
- package/build/mobile/bottom-sheet/nav-bar/heading.native.js.map +1 -1
- package/build/mobile/bottom-sheet/nav-bar/index.native.js +4 -3
- package/build/mobile/bottom-sheet/nav-bar/index.native.js.map +1 -1
- package/build/mobile/bottom-sheet/range-text-input.native.js +6 -5
- package/build/mobile/bottom-sheet/range-text-input.native.js.map +1 -1
- package/build/mobile/bottom-sheet/ripple.native.js +11 -10
- package/build/mobile/bottom-sheet/ripple.native.js.map +1 -1
- package/build/mobile/bottom-sheet/stepper-cell/index.native.js +2 -1
- package/build/mobile/bottom-sheet/stepper-cell/index.native.js.map +1 -1
- package/build/mobile/bottom-sheet/stepper-cell/stepper.android.js +12 -11
- package/build/mobile/bottom-sheet/stepper-cell/stepper.android.js.map +1 -1
- package/build/mobile/bottom-sheet/stepper-cell/stepper.ios.js +12 -11
- package/build/mobile/bottom-sheet/stepper-cell/stepper.ios.js.map +1 -1
- package/build/mobile/bottom-sheet/sub-sheet/index.native.js +7 -6
- package/build/mobile/bottom-sheet/sub-sheet/index.native.js.map +1 -1
- package/build/mobile/bottom-sheet-select-control/index.native.js +8 -7
- package/build/mobile/bottom-sheet-select-control/index.native.js.map +1 -1
- package/build/mobile/bottom-sheet-text-control/index.native.js +9 -8
- package/build/mobile/bottom-sheet-text-control/index.native.js.map +1 -1
- package/build/mobile/clipboard/index.native.js +1 -1
- package/build/mobile/color-settings/index.native.js +11 -10
- package/build/mobile/color-settings/index.native.js.map +1 -1
- package/build/mobile/cycle-select-control/index.native.js +12 -11
- package/build/mobile/cycle-select-control/index.native.js.map +1 -1
- package/build/mobile/dashicons/index.native.js +1 -1
- package/build/mobile/focal-point-settings-panel/index.native.js +7 -6
- package/build/mobile/focal-point-settings-panel/index.native.js.map +1 -1
- package/build/mobile/global-styles-context/index.native.js +1 -1
- package/build/mobile/global-styles-context/utils.native.js +8 -6
- package/build/mobile/global-styles-context/utils.native.js.map +1 -1
- package/build/mobile/gradient/index.native.js +14 -13
- package/build/mobile/gradient/index.native.js.map +1 -1
- package/build/mobile/gridicons/index.native.js +1 -1
- package/build/mobile/html-text-input/container.android.js +12 -9
- package/build/mobile/html-text-input/container.android.js.map +1 -1
- package/build/mobile/image/image-editing-button.native.js +26 -22
- package/build/mobile/image/image-editing-button.native.js.map +1 -1
- package/build/mobile/image/index.native.js +23 -22
- package/build/mobile/image/index.native.js.map +1 -1
- package/build/mobile/keyboard-avoiding-view/index.ios.js +29 -22
- package/build/mobile/keyboard-avoiding-view/index.ios.js.map +1 -1
- package/build/mobile/keyboard-aware-flat-list/index.ios.js +46 -43
- package/build/mobile/keyboard-aware-flat-list/index.ios.js.map +1 -1
- package/build/mobile/layout-animation/index.native.js +3 -1
- package/build/mobile/layout-animation/index.native.js.map +1 -1
- package/build/mobile/link-picker/index.native.js +13 -11
- package/build/mobile/link-picker/index.native.js.map +1 -1
- package/build/mobile/link-picker/link-picker-results.native.js +48 -34
- package/build/mobile/link-picker/link-picker-results.native.js.map +1 -1
- package/build/mobile/link-picker/link-picker-screen.native.js +9 -7
- package/build/mobile/link-picker/link-picker-screen.native.js.map +1 -1
- package/build/mobile/link-settings/image-link-destinations-screen.native.js +9 -8
- package/build/mobile/link-settings/image-link-destinations-screen.native.js.map +1 -1
- package/build/mobile/link-settings/index.native.js +58 -57
- package/build/mobile/link-settings/index.native.js.map +1 -1
- package/build/mobile/media-edit/index.native.js +1 -1
- package/build/mobile/picker/index.ios.js +6 -3
- package/build/mobile/picker/index.ios.js.map +1 -1
- package/build/mobile/readable-content-view/index.native.js +12 -9
- package/build/mobile/readable-content-view/index.native.js.map +1 -1
- package/build/mobile/segmented-control/index.native.js +16 -14
- package/build/mobile/segmented-control/index.native.js.map +1 -1
- package/build/mobile/utils/alignments.native.js +1 -1
- package/build/mobile/utils/index.native.js +2 -1
- package/build/mobile/utils/index.native.js.map +1 -1
- package/build/mobile/utils/use-unit-converter-to-mobile.native.js +5 -4
- package/build/mobile/utils/use-unit-converter-to-mobile.native.js.map +1 -1
- package/build/modal/aria-helper.js +1 -1
- package/build/modal/index.js +32 -29
- package/build/modal/index.js.map +1 -1
- package/build/navigable-container/menu.js +7 -5
- package/build/navigable-container/menu.js.map +1 -1
- package/build/navigable-container/tabbable.js +6 -4
- package/build/navigable-container/tabbable.js.map +1 -1
- package/build/navigation/back-button/index.js +8 -7
- package/build/navigation/back-button/index.js.map +1 -1
- package/build/navigation/group/index.js +6 -5
- package/build/navigation/group/index.js.map +1 -1
- package/build/navigation/index.js +11 -8
- package/build/navigation/index.js.map +1 -1
- package/build/navigation/menu/menu-title-search.js +8 -7
- package/build/navigation/menu/menu-title-search.js.map +1 -1
- package/build/navigation/menu/menu-title.js +8 -7
- package/build/navigation/menu/menu-title.js.map +1 -1
- package/build/navigation/menu/search-no-results-found.js +4 -3
- package/build/navigation/menu/search-no-results-found.js.map +1 -1
- package/build/navigation/styles/navigation-styles.js +1 -1
- package/build/navigator/types.js +4 -0
- package/build/notice/index.js +26 -24
- package/build/notice/index.js.map +1 -1
- package/build/notice/index.native.js +7 -6
- package/build/notice/index.native.js.map +1 -1
- package/build/notice/list.js +8 -6
- package/build/notice/list.js.map +1 -1
- package/build/number-control/index.js +22 -19
- package/build/number-control/index.js.map +1 -1
- package/build/number-control/styles/number-control-styles.js +4 -3
- package/build/number-control/styles/number-control-styles.js.map +1 -1
- package/build/panel/actions.native.js +10 -8
- package/build/panel/actions.native.js.map +1 -1
- package/build/panel/body.js +19 -17
- package/build/panel/body.js.map +1 -1
- package/build/panel/body.native.js +7 -6
- package/build/panel/body.native.js.map +1 -1
- package/build/panel/bottom-separator-cover.native.js +4 -3
- package/build/panel/bottom-separator-cover.native.js.map +1 -1
- package/build/panel/header.js +5 -4
- package/build/panel/header.js.map +1 -1
- package/build/panel/index.js +6 -5
- package/build/panel/index.js.map +1 -1
- package/build/panel/row.js +10 -7
- package/build/panel/row.js.map +1 -1
- package/build/placeholder/index.js +12 -11
- package/build/placeholder/index.js.map +1 -1
- package/build/popover/index.js +45 -37
- package/build/popover/index.js.map +1 -1
- package/build/popover/utils.js +10 -2
- package/build/popover/utils.js.map +1 -1
- package/build/query-controls/author-select.js +8 -7
- package/build/query-controls/author-select.js.map +1 -1
- package/build/query-controls/category-select.js +9 -8
- package/build/query-controls/category-select.js.map +1 -1
- package/build/query-controls/index.js +19 -18
- package/build/query-controls/index.js.map +1 -1
- package/build/query-controls/index.native.js +14 -13
- package/build/query-controls/index.native.js.map +1 -1
- package/build/radio/index.js +6 -5
- package/build/radio/index.js.map +1 -1
- package/build/radio-control/index.js +11 -10
- package/build/radio-control/index.js.map +1 -1
- package/build/radio-control/index.native.js +7 -6
- package/build/radio-control/index.native.js.map +1 -1
- package/build/radio-group/index.js +9 -8
- package/build/radio-group/index.js.map +1 -1
- package/build/range-control/index.js +33 -32
- package/build/range-control/index.js.map +1 -1
- package/build/range-control/index.native.js +20 -18
- package/build/range-control/index.native.js.map +1 -1
- package/build/range-control/input-range.js +11 -10
- package/build/range-control/input-range.js.map +1 -1
- package/build/range-control/mark.js +8 -7
- package/build/range-control/mark.js.map +1 -1
- package/build/range-control/rail.js +29 -24
- package/build/range-control/rail.js.map +1 -1
- package/build/range-control/styles/range-control-styles.js +50 -36
- package/build/range-control/styles/range-control-styles.js.map +1 -1
- package/build/range-control/tooltip.js +17 -15
- package/build/range-control/tooltip.js.map +1 -1
- package/build/range-control/utils.js +15 -13
- package/build/range-control/utils.js.map +1 -1
- package/build/resizable-box/index.js +9 -8
- package/build/resizable-box/index.js.map +1 -1
- package/build/resizable-box/resize-tooltip/index.js +13 -12
- package/build/resizable-box/resize-tooltip/index.js.map +1 -1
- package/build/resizable-box/resize-tooltip/label.js +7 -6
- package/build/resizable-box/resize-tooltip/label.js.map +1 -1
- package/build/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js +1 -1
- package/build/resizable-box/resize-tooltip/utils.js +20 -17
- package/build/resizable-box/resize-tooltip/utils.js.map +1 -1
- package/build/responsive-wrapper/index.js +7 -6
- package/build/responsive-wrapper/index.js.map +1 -1
- package/build/sandbox/index.js +12 -9
- package/build/sandbox/index.js.map +1 -1
- package/build/sandbox/index.native.js +15 -13
- package/build/sandbox/index.native.js.map +1 -1
- package/build/scrollable/hook.js +4 -2
- package/build/scrollable/hook.js.map +1 -1
- package/build/scrollable/styles.js +1 -1
- package/build/scrollable/types.js +4 -0
- package/build/search-control/index.js +12 -11
- package/build/search-control/index.js.map +1 -1
- package/build/search-control/index.native.js +6 -5
- package/build/search-control/index.native.js.map +1 -1
- package/build/select-control/index.js +33 -26
- package/build/select-control/index.js.map +1 -1
- package/build/select-control/index.native.js +12 -11
- package/build/select-control/index.native.js.map +1 -1
- package/build/select-control/styles/select-control-styles.js +13 -10
- package/build/select-control/styles/select-control-styles.js.map +1 -1
- package/build/select-control/types.js +4 -0
- package/build/shortcut/index.js +6 -4
- package/build/shortcut/index.js.map +1 -1
- package/build/slot-fill/bubbles-virtually/fill.js +5 -4
- package/build/slot-fill/bubbles-virtually/fill.js.map +1 -1
- package/build/slot-fill/bubbles-virtually/slot-fill-provider.js +4 -3
- package/build/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
- package/build/slot-fill/bubbles-virtually/slot.js +7 -6
- package/build/slot-fill/bubbles-virtually/slot.js.map +1 -1
- package/build/slot-fill/fill.js +17 -13
- package/build/slot-fill/fill.js.map +1 -1
- package/build/slot-fill/index.js +12 -9
- package/build/slot-fill/index.js.map +1 -1
- package/build/slot-fill/index.native.js +2 -2
- package/build/slot-fill/slot.js +12 -9
- package/build/slot-fill/slot.js.map +1 -1
- package/build/snackbar/index.js +22 -20
- package/build/snackbar/index.js.map +1 -1
- package/build/snackbar/list.js +7 -6
- package/build/snackbar/list.js.map +1 -1
- package/build/spacer/types.js +4 -0
- package/build/style-provider/index.js +10 -6
- package/build/style-provider/index.js.map +1 -1
- package/build/style-provider/index.native.js +4 -3
- package/build/style-provider/index.native.js.map +1 -1
- package/build/surface/hook.js +4 -2
- package/build/surface/hook.js.map +1 -1
- package/build/surface/styles.js +9 -7
- package/build/surface/styles.js.map +1 -1
- package/build/surface/types.js +4 -0
- package/build/swatch/index.js +4 -3
- package/build/swatch/index.js.map +1 -1
- package/build/tab-panel/index.js +27 -23
- package/build/tab-panel/index.js.map +1 -1
- package/build/text/hook.js +4 -2
- package/build/text/hook.js.map +1 -1
- package/build/text/styles/text-mixins.native.js +3 -1
- package/build/text/styles/text-mixins.native.js.map +1 -1
- package/build/text/styles.js +1 -1
- package/build/text/types.js +4 -0
- package/build/text/utils.js +17 -16
- package/build/text/utils.js.map +1 -1
- package/build/text-control/index.js +13 -12
- package/build/text-control/index.js.map +1 -1
- package/build/text-control/index.native.js +13 -12
- package/build/text-control/index.native.js.map +1 -1
- package/build/text-highlight/index.js +5 -4
- package/build/text-highlight/index.js.map +1 -1
- package/build/textarea-control/index.js +11 -10
- package/build/textarea-control/index.js.map +1 -1
- package/build/textarea-control/index.native.js +8 -7
- package/build/textarea-control/index.native.js.map +1 -1
- package/build/toggle-control/index.js +10 -8
- package/build/toggle-control/index.js.map +1 -1
- package/build/toggle-control/index.native.js +10 -9
- package/build/toggle-control/index.native.js.map +1 -1
- package/build/toggle-group-control/context.js +1 -1
- package/build/toggle-group-control/toggle-group-control/component.js +4 -2
- package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/styles.js +1 -1
- package/build/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.js +7 -6
- package/build/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control-option/component.js +4 -2
- package/build/toggle-group-control/toggle-group-control-option/component.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control-option/styles.js +1 -1
- package/build/toggle-group-control/types.js +4 -0
- package/build/toolbar/index.js +7 -5
- package/build/toolbar/index.js.map +1 -1
- package/build/toolbar/toolbar-container.js +5 -4
- package/build/toolbar/toolbar-container.js.map +1 -1
- package/build/toolbar/toolbar-container.native.js +6 -3
- package/build/toolbar/toolbar-container.native.js.map +1 -1
- package/build/toolbar-button/index.js +11 -10
- package/build/toolbar-button/index.js.map +1 -1
- package/build/toolbar-group/index.js +9 -8
- package/build/toolbar-group/index.js.map +1 -1
- package/build/toolbar-group/toolbar-group-collapsed.js +6 -5
- package/build/toolbar-group/toolbar-group-collapsed.js.map +1 -1
- package/build/toolbar-group/toolbar-group-collapsed.native.js +7 -6
- package/build/toolbar-group/toolbar-group-collapsed.native.js.map +1 -1
- package/build/toolbar-group/toolbar-group-container.js +10 -7
- package/build/toolbar-group/toolbar-group-container.js.map +1 -1
- package/build/toolbar-group/toolbar-group-container.native.js +10 -7
- package/build/toolbar-group/toolbar-group-container.native.js.map +1 -1
- package/build/toolbar-item/index.js +6 -5
- package/build/toolbar-item/index.js.map +1 -1
- package/build/toolbar-item/index.native.js +6 -4
- package/build/toolbar-item/index.native.js.map +1 -1
- package/build/tools-panel/index.js +4 -4
- package/build/tools-panel/styles.js +1 -1
- package/build/tools-panel/tools-panel/hook.js +21 -13
- package/build/tools-panel/tools-panel/hook.js.map +1 -1
- package/build/tools-panel/tools-panel-header/component.js +38 -29
- package/build/tools-panel/tools-panel-header/component.js.map +1 -1
- package/build/tools-panel/tools-panel-header/hook.js +4 -2
- package/build/tools-panel/tools-panel-header/hook.js.map +1 -1
- package/build/tools-panel/tools-panel-item/hook.js +4 -2
- package/build/tools-panel/tools-panel-item/hook.js.map +1 -1
- package/build/tools-panel/types.js +4 -0
- package/build/tooltip/index.js +52 -41
- package/build/tooltip/index.js.map +1 -1
- package/build/tooltip/index.native.js +16 -13
- package/build/tooltip/index.native.js.map +1 -1
- package/build/tree-grid/cell.js +6 -5
- package/build/tree-grid/cell.js.map +1 -1
- package/build/tree-grid/index.js +13 -12
- package/build/tree-grid/index.js.map +1 -1
- package/build/tree-grid/item.js +5 -4
- package/build/tree-grid/item.js.map +1 -1
- package/build/tree-grid/roving-tab-index-context.js +1 -1
- package/build/tree-grid/roving-tab-index-item.js +6 -5
- package/build/tree-grid/roving-tab-index-item.js.map +1 -1
- package/build/tree-grid/roving-tab-index.js +4 -3
- package/build/tree-grid/roving-tab-index.js.map +1 -1
- package/build/tree-grid/row.js +9 -8
- package/build/tree-grid/row.js.map +1 -1
- package/build/tree-select/index.js +11 -9
- package/build/tree-select/index.js.map +1 -1
- package/build/truncate/hook.js +4 -2
- package/build/truncate/hook.js.map +1 -1
- package/build/truncate/types.js +4 -0
- package/build/truncate/utils.js +5 -3
- package/build/truncate/utils.js.map +1 -1
- package/build/ui/__storybook-utils/example-grid.js +40 -30
- package/build/ui/__storybook-utils/example-grid.js.map +1 -1
- package/build/ui/__storybook-utils/page.js +5 -4
- package/build/ui/__storybook-utils/page.js.map +1 -1
- package/build/ui/context/constants.js +1 -1
- package/build/ui/context/context-connect.js +3 -1
- package/build/ui/context/context-connect.js.map +1 -1
- package/build/ui/context/context-system-provider.js +10 -8
- package/build/ui/context/context-system-provider.js.map +1 -1
- package/build/ui/context/index.js +6 -6
- package/build/ui/context/utils.js +1 -1
- package/build/ui/context/wordpress-component.js +4 -0
- package/build/ui/control-group/hook.js +4 -2
- package/build/ui/control-group/hook.js.map +1 -1
- package/build/ui/control-group/styles.js +1 -1
- package/build/ui/control-group/types.js +4 -0
- package/build/ui/control-label/hook.js +4 -2
- package/build/ui/control-label/hook.js.map +1 -1
- package/build/ui/control-label/styles.js +1 -1
- package/build/ui/control-label/types.js +4 -0
- package/build/ui/form-group/form-group-content.js +13 -12
- package/build/ui/form-group/form-group-content.js.map +1 -1
- package/build/ui/form-group/form-group-help.js +4 -3
- package/build/ui/form-group/form-group-help.js.map +1 -1
- package/build/ui/form-group/form-group-label.js +7 -6
- package/build/ui/form-group/form-group-label.js.map +1 -1
- package/build/ui/form-group/types.js +4 -0
- package/build/ui/form-group/use-form-group.js +4 -2
- package/build/ui/form-group/use-form-group.js.map +1 -1
- package/build/ui/spinner/styles.js +1 -1
- package/build/ui/tooltip/content.js +4 -2
- package/build/ui/tooltip/content.js.map +1 -1
- package/build/ui/tooltip/styles.js +5 -3
- package/build/ui/tooltip/styles.js.map +1 -1
- package/build/ui/tooltip/types.js +4 -0
- package/build/ui/utils/font-size.js +7 -3
- package/build/ui/utils/font-size.js.map +1 -1
- package/build/ui/utils/get-high-dpi.js +5 -1
- package/build/ui/utils/get-high-dpi.js.map +1 -1
- package/build/ui/utils/types.js +4 -0
- package/build/ui/utils/use-responsive-value.js +5 -3
- package/build/ui/utils/use-responsive-value.js.map +1 -1
- package/build/unit-control/index.js +25 -22
- package/build/unit-control/index.js.map +1 -1
- package/build/unit-control/index.native.js +17 -16
- package/build/unit-control/index.native.js.map +1 -1
- package/build/unit-control/styles/unit-control-styles.js +13 -10
- package/build/unit-control/styles/unit-control-styles.js.map +1 -1
- package/build/unit-control/types.js +4 -0
- package/build/unit-control/unit-select-control.js +11 -9
- package/build/unit-control/unit-select-control.js.map +1 -1
- package/build/unit-control/utils.js +20 -13
- package/build/unit-control/utils.js.map +1 -1
- package/build/utils/browsers.js +10 -2
- package/build/utils/browsers.js.map +1 -1
- package/build/utils/colors-values.js +1 -1
- package/build/utils/colors.js +3 -1
- package/build/utils/colors.js.map +1 -1
- package/build/utils/hooks/emotion.d.js +4 -0
- package/build/utils/hooks/index.js +10 -10
- package/build/utils/hooks/use-combined-ref.js +5 -1
- package/build/utils/hooks/use-combined-ref.js.map +1 -1
- package/build/utils/hooks/use-controlled-state.js +2 -1
- package/build/utils/hooks/use-controlled-state.js.map +1 -1
- package/build/utils/hooks/use-controlled-value.js +6 -5
- package/build/utils/hooks/use-controlled-value.js.map +1 -1
- package/build/utils/hooks/use-cx.js +5 -1
- package/build/utils/hooks/use-cx.js.map +1 -1
- package/build/utils/input/base.js +1 -1
- package/build/utils/math.js +19 -7
- package/build/utils/math.js.map +1 -1
- package/build/utils/reduce-motion.js +2 -1
- package/build/utils/reduce-motion.js.map +1 -1
- package/build/utils/rtl.js +6 -3
- package/build/utils/rtl.js.map +1 -1
- package/build/utils/style-mixins.js +12 -12
- package/build/utils/types.js +4 -0
- package/build/utils/unit-values.js +1 -1
- package/build/utils/values.js +10 -6
- package/build/utils/values.js.map +1 -1
- package/build/v-stack/types.js +4 -0
- package/build/z-stack/styles.js +24 -15
- package/build/z-stack/styles.js.map +1 -1
- package/build-module/alignment-matrix-control/cell.js +6 -5
- package/build-module/alignment-matrix-control/cell.js.map +1 -1
- package/build-module/alignment-matrix-control/icon.js +9 -8
- package/build-module/alignment-matrix-control/icon.js.map +1 -1
- package/build-module/alignment-matrix-control/index.js +11 -10
- package/build-module/alignment-matrix-control/index.js.map +1 -1
- package/build-module/alignment-matrix-control/styles/alignment-matrix-control-icon-styles.js +8 -6
- package/build-module/alignment-matrix-control/styles/alignment-matrix-control-icon-styles.js.map +1 -1
- package/build-module/alignment-matrix-control/styles/alignment-matrix-control-styles.js +8 -6
- package/build-module/alignment-matrix-control/styles/alignment-matrix-control-styles.js.map +1 -1
- package/build-module/alignment-matrix-control/utils.js +2 -1
- package/build-module/alignment-matrix-control/utils.js.map +1 -1
- package/build-module/angle-picker-control/angle-circle.js +6 -5
- package/build-module/angle-picker-control/angle-circle.js.map +1 -1
- package/build-module/angle-picker-control/index.js +8 -6
- package/build-module/angle-picker-control/index.js.map +1 -1
- package/build-module/animate/index.js +6 -5
- package/build-module/animate/index.js.map +1 -1
- package/build-module/autocomplete/autocompleter-ui.js +13 -12
- package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
- package/build-module/autocomplete/autocompleter-ui.native.js +14 -11
- package/build-module/autocomplete/autocompleter-ui.native.js.map +1 -1
- package/build-module/autocomplete/background-view.android.js +4 -3
- package/build-module/autocomplete/background-view.android.js.map +1 -1
- package/build-module/autocomplete/background-view.ios.js +4 -3
- package/build-module/autocomplete/background-view.ios.js.map +1 -1
- package/build-module/autocomplete/get-default-use-items.js +3 -1
- package/build-module/autocomplete/get-default-use-items.js.map +1 -1
- package/build-module/autocomplete/index.js +19 -16
- package/build-module/autocomplete/index.js.map +1 -1
- package/build-module/base-control/index.js +14 -12
- package/build-module/base-control/index.js.map +1 -1
- package/build-module/base-control/index.native.js +6 -5
- package/build-module/base-control/index.native.js.map +1 -1
- package/build-module/box-control/all-input-control.js +12 -11
- package/build-module/box-control/all-input-control.js.map +1 -1
- package/build-module/box-control/axial-input-controls.js +13 -11
- package/build-module/box-control/axial-input-controls.js.map +1 -1
- package/build-module/box-control/icon.js +8 -6
- package/build-module/box-control/icon.js.map +1 -1
- package/build-module/box-control/index.js +22 -18
- package/build-module/box-control/index.js.map +1 -1
- package/build-module/box-control/input-controls.js +17 -14
- package/build-module/box-control/input-controls.js.map +1 -1
- package/build-module/box-control/linked-button.js +5 -4
- package/build-module/box-control/linked-button.js.map +1 -1
- package/build-module/box-control/styles/box-control-icon-styles.js +4 -3
- package/build-module/box-control/styles/box-control-icon-styles.js.map +1 -1
- package/build-module/box-control/styles/box-control-styles.js +12 -9
- package/build-module/box-control/styles/box-control-styles.js.map +1 -1
- package/build-module/box-control/styles/box-control-visualizer-styles.js +11 -7
- package/build-module/box-control/styles/box-control-visualizer-styles.js.map +1 -1
- package/build-module/box-control/unit-control.js +22 -18
- package/build-module/box-control/unit-control.js.map +1 -1
- package/build-module/box-control/utils.js +6 -2
- package/build-module/box-control/utils.js.map +1 -1
- package/build-module/box-control/visualizer.js +32 -26
- package/build-module/box-control/visualizer.js.map +1 -1
- package/build-module/button/deprecated.js +8 -7
- package/build-module/button/deprecated.js.map +1 -1
- package/build-module/button/index.js +15 -24
- package/build-module/button/index.js.map +1 -1
- package/build-module/button-group/index.js +5 -4
- package/build-module/button-group/index.js.map +1 -1
- package/build-module/card/card/hook.js +8 -8
- package/build-module/card/card/hook.js.map +1 -1
- package/build-module/card/types.js +1 -1
- package/build-module/checkbox-control/index.js +11 -9
- package/build-module/checkbox-control/index.js.map +1 -1
- package/build-module/circular-option-picker/index.js +40 -33
- package/build-module/circular-option-picker/index.js.map +1 -1
- package/build-module/clipboard-button/index.js +9 -8
- package/build-module/clipboard-button/index.js.map +1 -1
- package/build-module/color-control/index.native.js +8 -7
- package/build-module/color-control/index.native.js.map +1 -1
- package/build-module/color-edit/index.js +53 -40
- package/build-module/color-edit/index.js.map +1 -1
- package/build-module/color-indicator/index.js +13 -10
- package/build-module/color-indicator/index.js.map +1 -1
- package/build-module/color-indicator/index.native.js +12 -10
- package/build-module/color-indicator/index.native.js.map +1 -1
- package/build-module/color-list-picker/index.js +18 -16
- package/build-module/color-list-picker/index.js.map +1 -1
- package/build-module/color-palette/index.js +55 -47
- package/build-module/color-palette/index.js.map +1 -1
- package/build-module/color-palette/index.native.js +23 -20
- package/build-module/color-palette/index.native.js.map +1 -1
- package/build-module/color-picker/color-display.js +35 -27
- package/build-module/color-picker/color-display.js.map +1 -1
- package/build-module/color-picker/color-input.js +7 -6
- package/build-module/color-picker/color-input.js.map +1 -1
- package/build-module/color-picker/hex-input.js +7 -5
- package/build-module/color-picker/hex-input.js.map +1 -1
- package/build-module/color-picker/hsl-input.js +6 -5
- package/build-module/color-picker/hsl-input.js.map +1 -1
- package/build-module/color-picker/index.native.js +23 -20
- package/build-module/color-picker/index.native.js.map +1 -1
- package/build-module/color-picker/input-with-slider.js +9 -8
- package/build-module/color-picker/input-with-slider.js.map +1 -1
- package/build-module/color-picker/picker.js +6 -5
- package/build-module/color-picker/picker.js.map +1 -1
- package/build-module/color-picker/rgb-input.js +6 -5
- package/build-module/color-picker/rgb-input.js.map +1 -1
- package/build-module/color-picker/types.js +1 -1
- package/build-module/combobox-control/index.js +17 -15
- package/build-module/combobox-control/index.js.map +1 -1
- package/build-module/custom-gradient-bar/control-points.js +118 -106
- package/build-module/custom-gradient-bar/control-points.js.map +1 -1
- package/build-module/custom-gradient-bar/index.js +13 -11
- package/build-module/custom-gradient-bar/index.js.map +1 -1
- package/build-module/custom-gradient-bar/utils.js +6 -4
- package/build-module/custom-gradient-bar/utils.js.map +1 -1
- package/build-module/custom-gradient-picker/index.js +17 -14
- package/build-module/custom-gradient-picker/index.js.map +1 -1
- package/build-module/custom-gradient-picker/index.native.js +6 -5
- package/build-module/custom-gradient-picker/index.native.js.map +1 -1
- package/build-module/custom-gradient-picker/serializer.js +18 -14
- package/build-module/custom-gradient-picker/serializer.js.map +1 -1
- package/build-module/custom-gradient-picker/utils.js +5 -4
- package/build-module/custom-gradient-picker/utils.js.map +1 -1
- package/build-module/custom-select-control/index.js +22 -18
- package/build-module/custom-select-control/index.js.map +1 -1
- package/build-module/dashicon/index.js +6 -5
- package/build-module/dashicon/index.js.map +1 -1
- package/build-module/dashicon/index.native.js +5 -4
- package/build-module/dashicon/index.native.js.map +1 -1
- package/build-module/dashicon/types.js +1 -1
- package/build-module/date-time/date.js +5 -4
- package/build-module/date-time/date.js.map +1 -1
- package/build-module/date-time/index.js +9 -8
- package/build-module/date-time/index.js.map +1 -1
- package/build-module/date-time/time.js +14 -11
- package/build-module/date-time/time.js.map +1 -1
- package/build-module/dimension-control/index.js +10 -7
- package/build-module/dimension-control/index.js.map +1 -1
- package/build-module/disabled/index.js +8 -6
- package/build-module/disabled/index.js.map +1 -1
- package/build-module/disabled/index.native.js +4 -3
- package/build-module/disabled/index.native.js.map +1 -1
- package/build-module/divider/styles.js +7 -5
- package/build-module/divider/styles.js.map +1 -1
- package/build-module/divider/types.js +1 -1
- package/build-module/draggable/index.js +13 -11
- package/build-module/draggable/index.js.map +1 -1
- package/build-module/drop-zone/index.js +8 -7
- package/build-module/drop-zone/index.js.map +1 -1
- package/build-module/drop-zone/provider.js +4 -3
- package/build-module/drop-zone/provider.js.map +1 -1
- package/build-module/dropdown/index.js +14 -13
- package/build-module/dropdown/index.js.map +1 -1
- package/build-module/dropdown-menu/index.js +9 -5
- package/build-module/dropdown-menu/index.js.map +1 -1
- package/build-module/dropdown-menu/index.native.js +26 -19
- package/build-module/dropdown-menu/index.native.js.map +1 -1
- package/build-module/duotone-picker/custom-duotone-bar.js +5 -4
- package/build-module/duotone-picker/custom-duotone-bar.js.map +1 -1
- package/build-module/duotone-picker/duotone-picker.js +15 -13
- package/build-module/duotone-picker/duotone-picker.js.map +1 -1
- package/build-module/duotone-picker/duotone-swatch.js +4 -3
- package/build-module/duotone-picker/duotone-swatch.js.map +1 -1
- package/build-module/duotone-picker/utils.js +27 -14
- package/build-module/duotone-picker/utils.js.map +1 -1
- package/build-module/elevation/types.js +1 -1
- package/build-module/external-link/index.js +8 -7
- package/build-module/external-link/index.js.map +1 -1
- package/build-module/external-link/index.native.js +5 -4
- package/build-module/external-link/index.native.js.map +1 -1
- package/build-module/flex/flex/hook.js +6 -4
- package/build-module/flex/flex/hook.js.map +1 -1
- package/build-module/flex/types.js +1 -1
- package/build-module/flyout/types.js +1 -1
- package/build-module/flyout/utils.js +4 -3
- package/build-module/flyout/utils.js.map +1 -1
- package/build-module/focal-point-picker/controls.js +8 -7
- package/build-module/focal-point-picker/controls.js.map +1 -1
- package/build-module/focal-point-picker/focal-point.js +8 -7
- package/build-module/focal-point-picker/focal-point.js.map +1 -1
- package/build-module/focal-point-picker/focal-point.native.js +6 -5
- package/build-module/focal-point-picker/focal-point.native.js.map +1 -1
- package/build-module/focal-point-picker/grid.js +6 -5
- package/build-module/focal-point-picker/grid.js.map +1 -1
- package/build-module/focal-point-picker/index.js +2 -1
- package/build-module/focal-point-picker/index.js.map +1 -1
- package/build-module/focal-point-picker/media.js +19 -16
- package/build-module/focal-point-picker/media.js.map +1 -1
- package/build-module/focal-point-picker/styles/focal-point-picker-style.js +7 -4
- package/build-module/focal-point-picker/styles/focal-point-picker-style.js.map +1 -1
- package/build-module/focal-point-picker/styles/focal-point-style.js +6 -3
- package/build-module/focal-point-picker/styles/focal-point-style.js.map +1 -1
- package/build-module/focal-point-picker/tooltip/index.native.js +18 -15
- package/build-module/focal-point-picker/tooltip/index.native.js.map +1 -1
- package/build-module/focal-point-picker/utils.js +4 -2
- package/build-module/focal-point-picker/utils.js.map +1 -1
- package/build-module/focusable-iframe/index.js +5 -4
- package/build-module/focusable-iframe/index.js.map +1 -1
- package/build-module/font-size-picker/index.js +20 -15
- package/build-module/font-size-picker/index.js.map +1 -1
- package/build-module/font-size-picker/index.native.js +7 -6
- package/build-module/font-size-picker/index.native.js.map +1 -1
- package/build-module/font-size-picker/utils.js +19 -15
- package/build-module/font-size-picker/utils.js.map +1 -1
- package/build-module/footer-message-control/index.native.js +3 -2
- package/build-module/footer-message-control/index.native.js.map +1 -1
- package/build-module/form-file-upload/index.js +9 -8
- package/build-module/form-file-upload/index.js.map +1 -1
- package/build-module/form-toggle/index.js +9 -8
- package/build-module/form-toggle/index.js.map +1 -1
- package/build-module/form-token-field/index.js +8 -2
- package/build-module/form-token-field/index.js.map +1 -1
- package/build-module/form-token-field/token.js +15 -14
- package/build-module/form-token-field/token.js.map +1 -1
- package/build-module/gradient-picker/index.js +56 -49
- package/build-module/gradient-picker/index.js.map +1 -1
- package/build-module/grid/types.js +1 -1
- package/build-module/guide/icons.js +16 -13
- package/build-module/guide/icons.js.map +1 -1
- package/build-module/guide/index.js +9 -8
- package/build-module/guide/index.js.map +1 -1
- package/build-module/guide/page-control.js +6 -5
- package/build-module/guide/page-control.js.map +1 -1
- package/build-module/h-stack/types.js +1 -1
- package/build-module/h-stack/utils.js +3 -1
- package/build-module/h-stack/utils.js.map +1 -1
- package/build-module/higher-order/navigate-regions/index.js +19 -13
- package/build-module/higher-order/navigate-regions/index.js.map +1 -1
- package/build-module/higher-order/with-focus-return/index.js +17 -13
- package/build-module/higher-order/with-focus-return/index.js.map +1 -1
- package/build-module/icon/index.js +7 -5
- package/build-module/icon/index.js.map +1 -1
- package/build-module/input-control/backdrop.js +5 -4
- package/build-module/input-control/backdrop.js.map +1 -1
- package/build-module/input-control/index.js +20 -19
- package/build-module/input-control/index.js.map +1 -1
- package/build-module/input-control/input-base.js +16 -15
- package/build-module/input-control/input-base.js.map +1 -1
- package/build-module/input-control/input-field.js +24 -23
- package/build-module/input-control/input-field.js.map +1 -1
- package/build-module/input-control/label.js +7 -6
- package/build-module/input-control/label.js.map +1 -1
- package/build-module/input-control/reducer/reducer.js +15 -4
- package/build-module/input-control/reducer/reducer.js.map +1 -1
- package/build-module/input-control/styles/input-control-styles.js +48 -36
- package/build-module/input-control/styles/input-control-styles.js.map +1 -1
- package/build-module/input-control/types.js +1 -1
- package/build-module/isolated-event-container/index.js +5 -4
- package/build-module/isolated-event-container/index.js.map +1 -1
- package/build-module/item-group/types.js +1 -1
- package/build-module/keyboard-shortcuts/index.js +15 -13
- package/build-module/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/menu-items-choice/index.js +7 -6
- package/build-module/menu-items-choice/index.js.map +1 -1
- package/build-module/mobile/audio-player/index.native.js +8 -7
- package/build-module/mobile/audio-player/index.native.js.map +1 -1
- package/build-module/mobile/badge/index.native.js +6 -5
- package/build-module/mobile/badge/index.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +12 -10
- package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +12 -9
- package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/button.native.js +21 -18
- package/build-module/mobile/bottom-sheet/button.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/footer-message-cell.native.js +5 -4
- package/build-module/mobile/bottom-sheet/footer-message-cell.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/footer-message-link/footer-message-link.native.js +5 -4
- package/build-module/mobile/bottom-sheet/footer-message-link/footer-message-link.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/index.native.js +24 -17
- package/build-module/mobile/bottom-sheet/index.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/link-cell.native.js +7 -6
- package/build-module/mobile/bottom-sheet/link-cell.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/link-suggestion-item-cell.native.js +5 -4
- package/build-module/mobile/bottom-sheet/link-suggestion-item-cell.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/nav-bar/action-button.native.js +7 -6
- package/build-module/mobile/bottom-sheet/nav-bar/action-button.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/nav-bar/apply-button.native.js +4 -3
- package/build-module/mobile/bottom-sheet/nav-bar/apply-button.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/nav-bar/back-button.native.js +15 -12
- package/build-module/mobile/bottom-sheet/nav-bar/back-button.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/nav-bar/heading.native.js +4 -3
- package/build-module/mobile/bottom-sheet/nav-bar/heading.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/nav-bar/index.native.js +4 -3
- package/build-module/mobile/bottom-sheet/nav-bar/index.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/range-text-input.native.js +6 -5
- package/build-module/mobile/bottom-sheet/range-text-input.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/ripple.native.js +11 -10
- package/build-module/mobile/bottom-sheet/ripple.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/stepper-cell/index.native.js +2 -1
- 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 +12 -11
- 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 +12 -11
- 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 +7 -6
- package/build-module/mobile/bottom-sheet/sub-sheet/index.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet-select-control/index.native.js +8 -7
- 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 +9 -8
- package/build-module/mobile/bottom-sheet-text-control/index.native.js.map +1 -1
- package/build-module/mobile/color-settings/index.native.js +11 -10
- package/build-module/mobile/color-settings/index.native.js.map +1 -1
- package/build-module/mobile/cycle-select-control/index.native.js +12 -11
- package/build-module/mobile/cycle-select-control/index.native.js.map +1 -1
- package/build-module/mobile/focal-point-settings-panel/index.native.js +7 -6
- package/build-module/mobile/focal-point-settings-panel/index.native.js.map +1 -1
- package/build-module/mobile/global-styles-context/utils.native.js +4 -2
- package/build-module/mobile/global-styles-context/utils.native.js.map +1 -1
- package/build-module/mobile/gradient/index.native.js +11 -10
- package/build-module/mobile/gradient/index.native.js.map +1 -1
- package/build-module/mobile/html-text-input/container.android.js +12 -9
- package/build-module/mobile/html-text-input/container.android.js.map +1 -1
- package/build-module/mobile/image/image-editing-button.native.js +26 -22
- package/build-module/mobile/image/image-editing-button.native.js.map +1 -1
- package/build-module/mobile/image/index.native.js +23 -22
- package/build-module/mobile/image/index.native.js.map +1 -1
- package/build-module/mobile/keyboard-avoiding-view/index.ios.js +29 -22
- package/build-module/mobile/keyboard-avoiding-view/index.ios.js.map +1 -1
- package/build-module/mobile/keyboard-aware-flat-list/index.ios.js +46 -43
- package/build-module/mobile/keyboard-aware-flat-list/index.ios.js.map +1 -1
- package/build-module/mobile/layout-animation/index.native.js +2 -1
- package/build-module/mobile/layout-animation/index.native.js.map +1 -1
- package/build-module/mobile/link-picker/index.native.js +12 -10
- package/build-module/mobile/link-picker/index.native.js.map +1 -1
- package/build-module/mobile/link-picker/link-picker-results.native.js +48 -34
- package/build-module/mobile/link-picker/link-picker-results.native.js.map +1 -1
- package/build-module/mobile/link-picker/link-picker-screen.native.js +9 -7
- package/build-module/mobile/link-picker/link-picker-screen.native.js.map +1 -1
- package/build-module/mobile/link-settings/image-link-destinations-screen.native.js +9 -8
- package/build-module/mobile/link-settings/image-link-destinations-screen.native.js.map +1 -1
- package/build-module/mobile/link-settings/index.native.js +58 -57
- package/build-module/mobile/link-settings/index.native.js.map +1 -1
- package/build-module/mobile/picker/index.ios.js +6 -3
- package/build-module/mobile/picker/index.ios.js.map +1 -1
- package/build-module/mobile/readable-content-view/index.native.js +11 -9
- package/build-module/mobile/readable-content-view/index.native.js.map +1 -1
- package/build-module/mobile/segmented-control/index.native.js +16 -14
- package/build-module/mobile/segmented-control/index.native.js.map +1 -1
- package/build-module/mobile/utils/index.native.js +2 -1
- package/build-module/mobile/utils/index.native.js.map +1 -1
- package/build-module/mobile/utils/use-unit-converter-to-mobile.native.js +4 -3
- package/build-module/mobile/utils/use-unit-converter-to-mobile.native.js.map +1 -1
- package/build-module/modal/index.js +27 -26
- package/build-module/modal/index.js.map +1 -1
- package/build-module/navigable-container/menu.js +7 -5
- package/build-module/navigable-container/menu.js.map +1 -1
- package/build-module/navigable-container/tabbable.js +6 -4
- package/build-module/navigable-container/tabbable.js.map +1 -1
- package/build-module/navigation/back-button/index.js +8 -7
- package/build-module/navigation/back-button/index.js.map +1 -1
- package/build-module/navigation/group/index.js +6 -5
- package/build-module/navigation/group/index.js.map +1 -1
- package/build-module/navigation/index.js +11 -8
- package/build-module/navigation/index.js.map +1 -1
- package/build-module/navigation/menu/menu-title-search.js +8 -7
- package/build-module/navigation/menu/menu-title-search.js.map +1 -1
- package/build-module/navigation/menu/menu-title.js +8 -7
- package/build-module/navigation/menu/menu-title.js.map +1 -1
- package/build-module/navigation/menu/search-no-results-found.js +4 -3
- package/build-module/navigation/menu/search-no-results-found.js.map +1 -1
- package/build-module/navigator/types.js +1 -1
- package/build-module/notice/index.js +26 -24
- package/build-module/notice/index.js.map +1 -1
- package/build-module/notice/index.native.js +7 -6
- package/build-module/notice/index.native.js.map +1 -1
- package/build-module/notice/list.js +8 -6
- package/build-module/notice/list.js.map +1 -1
- package/build-module/number-control/index.js +18 -17
- package/build-module/number-control/index.js.map +1 -1
- package/build-module/number-control/styles/number-control-styles.js +4 -3
- package/build-module/number-control/styles/number-control-styles.js.map +1 -1
- package/build-module/panel/actions.native.js +10 -8
- package/build-module/panel/actions.native.js.map +1 -1
- package/build-module/panel/body.js +19 -17
- package/build-module/panel/body.js.map +1 -1
- package/build-module/panel/body.native.js +7 -6
- package/build-module/panel/body.native.js.map +1 -1
- package/build-module/panel/bottom-separator-cover.native.js +4 -3
- package/build-module/panel/bottom-separator-cover.native.js.map +1 -1
- package/build-module/panel/header.js +5 -4
- package/build-module/panel/header.js.map +1 -1
- package/build-module/panel/index.js +6 -5
- package/build-module/panel/index.js.map +1 -1
- package/build-module/panel/row.js +10 -7
- package/build-module/panel/row.js.map +1 -1
- package/build-module/placeholder/index.js +12 -11
- package/build-module/placeholder/index.js.map +1 -1
- package/build-module/popover/index.js +45 -37
- package/build-module/popover/index.js.map +1 -1
- package/build-module/popover/utils.js +9 -1
- package/build-module/popover/utils.js.map +1 -1
- package/build-module/query-controls/author-select.js +8 -7
- package/build-module/query-controls/author-select.js.map +1 -1
- package/build-module/query-controls/category-select.js +9 -8
- package/build-module/query-controls/category-select.js.map +1 -1
- package/build-module/query-controls/index.js +19 -18
- package/build-module/query-controls/index.js.map +1 -1
- package/build-module/query-controls/index.native.js +14 -13
- package/build-module/query-controls/index.native.js.map +1 -1
- package/build-module/radio/index.js +6 -5
- package/build-module/radio/index.js.map +1 -1
- package/build-module/radio-control/index.js +11 -10
- package/build-module/radio-control/index.js.map +1 -1
- package/build-module/radio-control/index.native.js +7 -6
- package/build-module/radio-control/index.native.js.map +1 -1
- package/build-module/radio-group/index.js +9 -8
- package/build-module/radio-group/index.js.map +1 -1
- package/build-module/range-control/index.js +33 -32
- package/build-module/range-control/index.js.map +1 -1
- package/build-module/range-control/index.native.js +20 -18
- package/build-module/range-control/index.native.js.map +1 -1
- package/build-module/range-control/input-range.js +11 -10
- package/build-module/range-control/input-range.js.map +1 -1
- package/build-module/range-control/mark.js +8 -7
- package/build-module/range-control/mark.js.map +1 -1
- package/build-module/range-control/rail.js +29 -24
- package/build-module/range-control/rail.js.map +1 -1
- package/build-module/range-control/styles/range-control-styles.js +49 -35
- package/build-module/range-control/styles/range-control-styles.js.map +1 -1
- package/build-module/range-control/tooltip.js +17 -15
- package/build-module/range-control/tooltip.js.map +1 -1
- package/build-module/range-control/utils.js +15 -13
- package/build-module/range-control/utils.js.map +1 -1
- package/build-module/resizable-box/index.js +9 -8
- package/build-module/resizable-box/index.js.map +1 -1
- package/build-module/resizable-box/resize-tooltip/index.js +13 -12
- package/build-module/resizable-box/resize-tooltip/index.js.map +1 -1
- package/build-module/resizable-box/resize-tooltip/label.js +7 -6
- package/build-module/resizable-box/resize-tooltip/label.js.map +1 -1
- package/build-module/resizable-box/resize-tooltip/utils.js +19 -16
- package/build-module/resizable-box/resize-tooltip/utils.js.map +1 -1
- package/build-module/responsive-wrapper/index.js +7 -6
- package/build-module/responsive-wrapper/index.js.map +1 -1
- package/build-module/sandbox/index.js +12 -9
- package/build-module/sandbox/index.js.map +1 -1
- package/build-module/sandbox/index.native.js +15 -13
- package/build-module/sandbox/index.native.js.map +1 -1
- package/build-module/scrollable/types.js +1 -1
- package/build-module/search-control/index.js +12 -11
- package/build-module/search-control/index.js.map +1 -1
- package/build-module/search-control/index.native.js +6 -5
- package/build-module/search-control/index.native.js.map +1 -1
- package/build-module/select-control/index.js +33 -26
- package/build-module/select-control/index.js.map +1 -1
- package/build-module/select-control/index.native.js +12 -11
- package/build-module/select-control/index.native.js.map +1 -1
- package/build-module/select-control/styles/select-control-styles.js +12 -9
- package/build-module/select-control/styles/select-control-styles.js.map +1 -1
- package/build-module/select-control/types.js +1 -1
- package/build-module/shortcut/index.js +6 -4
- package/build-module/shortcut/index.js.map +1 -1
- package/build-module/slot-fill/bubbles-virtually/fill.js +5 -4
- package/build-module/slot-fill/bubbles-virtually/fill.js.map +1 -1
- package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js +4 -3
- package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
- package/build-module/slot-fill/bubbles-virtually/slot.js +7 -6
- package/build-module/slot-fill/bubbles-virtually/slot.js.map +1 -1
- package/build-module/slot-fill/fill.js +17 -13
- package/build-module/slot-fill/fill.js.map +1 -1
- package/build-module/slot-fill/index.js +11 -8
- package/build-module/slot-fill/index.js.map +1 -1
- package/build-module/slot-fill/slot.js +12 -9
- package/build-module/slot-fill/slot.js.map +1 -1
- package/build-module/snackbar/index.js +22 -20
- package/build-module/snackbar/index.js.map +1 -1
- package/build-module/snackbar/list.js +7 -6
- package/build-module/snackbar/list.js.map +1 -1
- package/build-module/spacer/types.js +1 -1
- package/build-module/style-provider/index.js +6 -4
- package/build-module/style-provider/index.js.map +1 -1
- package/build-module/style-provider/index.native.js +4 -3
- package/build-module/style-provider/index.native.js.map +1 -1
- package/build-module/surface/styles.js +7 -6
- package/build-module/surface/styles.js.map +1 -1
- package/build-module/surface/types.js +1 -1
- package/build-module/swatch/index.js +4 -3
- package/build-module/swatch/index.js.map +1 -1
- package/build-module/tab-panel/index.js +26 -22
- package/build-module/tab-panel/index.js.map +1 -1
- package/build-module/text/styles/text-mixins.native.js +3 -1
- package/build-module/text/styles/text-mixins.native.js.map +1 -1
- package/build-module/text/types.js +1 -1
- package/build-module/text/utils.js +17 -16
- package/build-module/text/utils.js.map +1 -1
- package/build-module/text-control/index.js +13 -12
- package/build-module/text-control/index.js.map +1 -1
- package/build-module/text-control/index.native.js +13 -12
- package/build-module/text-control/index.native.js.map +1 -1
- package/build-module/text-highlight/index.js +5 -4
- package/build-module/text-highlight/index.js.map +1 -1
- package/build-module/textarea-control/index.js +11 -10
- package/build-module/textarea-control/index.js.map +1 -1
- package/build-module/textarea-control/index.native.js +8 -7
- package/build-module/textarea-control/index.native.js.map +1 -1
- package/build-module/toggle-control/index.js +10 -8
- package/build-module/toggle-control/index.js.map +1 -1
- package/build-module/toggle-control/index.native.js +10 -9
- package/build-module/toggle-control/index.native.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.js +7 -6
- package/build-module/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.js.map +1 -1
- package/build-module/toggle-group-control/types.js +1 -1
- package/build-module/toolbar/index.js +7 -5
- package/build-module/toolbar/index.js.map +1 -1
- package/build-module/toolbar/toolbar-container.js +5 -4
- package/build-module/toolbar/toolbar-container.js.map +1 -1
- package/build-module/toolbar/toolbar-container.native.js +6 -3
- package/build-module/toolbar/toolbar-container.native.js.map +1 -1
- package/build-module/toolbar-button/index.js +11 -10
- package/build-module/toolbar-button/index.js.map +1 -1
- package/build-module/toolbar-group/index.js +9 -8
- package/build-module/toolbar-group/index.js.map +1 -1
- package/build-module/toolbar-group/toolbar-group-collapsed.js +6 -5
- package/build-module/toolbar-group/toolbar-group-collapsed.js.map +1 -1
- package/build-module/toolbar-group/toolbar-group-collapsed.native.js +7 -6
- package/build-module/toolbar-group/toolbar-group-collapsed.native.js.map +1 -1
- package/build-module/toolbar-group/toolbar-group-container.js +10 -7
- package/build-module/toolbar-group/toolbar-group-container.js.map +1 -1
- package/build-module/toolbar-group/toolbar-group-container.native.js +10 -7
- package/build-module/toolbar-group/toolbar-group-container.native.js.map +1 -1
- package/build-module/toolbar-item/index.js +6 -5
- package/build-module/toolbar-item/index.js.map +1 -1
- package/build-module/toolbar-item/index.native.js +6 -4
- package/build-module/toolbar-item/index.native.js.map +1 -1
- package/build-module/tools-panel/tools-panel/hook.js +17 -11
- package/build-module/tools-panel/tools-panel/hook.js.map +1 -1
- package/build-module/tools-panel/tools-panel-header/component.js +38 -29
- package/build-module/tools-panel/tools-panel-header/component.js.map +1 -1
- package/build-module/tools-panel/types.js +1 -1
- package/build-module/tooltip/index.js +52 -41
- package/build-module/tooltip/index.js.map +1 -1
- package/build-module/tooltip/index.native.js +16 -13
- package/build-module/tooltip/index.native.js.map +1 -1
- package/build-module/tree-grid/cell.js +6 -5
- package/build-module/tree-grid/cell.js.map +1 -1
- package/build-module/tree-grid/index.js +7 -6
- package/build-module/tree-grid/index.js.map +1 -1
- package/build-module/tree-grid/item.js +5 -4
- package/build-module/tree-grid/item.js.map +1 -1
- package/build-module/tree-grid/roving-tab-index-item.js +6 -5
- package/build-module/tree-grid/roving-tab-index-item.js.map +1 -1
- package/build-module/tree-grid/roving-tab-index.js +4 -3
- package/build-module/tree-grid/roving-tab-index.js.map +1 -1
- package/build-module/tree-grid/row.js +9 -8
- package/build-module/tree-grid/row.js.map +1 -1
- package/build-module/tree-select/index.js +11 -9
- package/build-module/tree-select/index.js.map +1 -1
- package/build-module/truncate/types.js +1 -1
- package/build-module/truncate/utils.js +3 -1
- package/build-module/truncate/utils.js.map +1 -1
- package/build-module/ui/__storybook-utils/example-grid.js +40 -30
- package/build-module/ui/__storybook-utils/example-grid.js.map +1 -1
- package/build-module/ui/__storybook-utils/page.js +5 -4
- package/build-module/ui/__storybook-utils/page.js.map +1 -1
- package/build-module/ui/context/context-connect.js +3 -1
- package/build-module/ui/context/context-connect.js.map +1 -1
- package/build-module/ui/context/context-system-provider.js +9 -7
- package/build-module/ui/context/context-system-provider.js.map +1 -1
- package/build-module/ui/context/wordpress-component.js +1 -1
- package/build-module/ui/control-group/types.js +1 -1
- package/build-module/ui/control-label/types.js +1 -1
- package/build-module/ui/form-group/form-group-content.js +13 -12
- package/build-module/ui/form-group/form-group-content.js.map +1 -1
- package/build-module/ui/form-group/form-group-help.js +4 -3
- package/build-module/ui/form-group/form-group-help.js.map +1 -1
- package/build-module/ui/form-group/form-group-label.js +7 -6
- package/build-module/ui/form-group/form-group-label.js.map +1 -1
- package/build-module/ui/form-group/types.js +1 -1
- package/build-module/ui/tooltip/types.js +1 -1
- package/build-module/ui/utils/font-size.js +6 -2
- package/build-module/ui/utils/font-size.js.map +1 -1
- package/build-module/ui/utils/get-high-dpi.js +5 -1
- package/build-module/ui/utils/get-high-dpi.js.map +1 -1
- package/build-module/ui/utils/types.js +1 -1
- package/build-module/ui/utils/use-responsive-value.js +4 -2
- package/build-module/ui/utils/use-responsive-value.js.map +1 -1
- package/build-module/unit-control/index.js +20 -19
- package/build-module/unit-control/index.js.map +1 -1
- package/build-module/unit-control/index.native.js +16 -15
- package/build-module/unit-control/index.native.js.map +1 -1
- package/build-module/unit-control/styles/unit-control-styles.js +12 -9
- package/build-module/unit-control/styles/unit-control-styles.js.map +1 -1
- package/build-module/unit-control/types.js +1 -1
- package/build-module/unit-control/unit-select-control.js +11 -9
- package/build-module/unit-control/unit-select-control.js.map +1 -1
- package/build-module/unit-control/utils.js +14 -8
- package/build-module/unit-control/utils.js.map +1 -1
- package/build-module/utils/browsers.js +10 -2
- package/build-module/utils/browsers.js.map +1 -1
- package/build-module/utils/colors.js +3 -1
- package/build-module/utils/colors.js.map +1 -1
- package/build-module/utils/hooks/emotion.d.js +1 -1
- package/build-module/utils/hooks/use-combined-ref.js +5 -1
- package/build-module/utils/hooks/use-combined-ref.js.map +1 -1
- package/build-module/utils/hooks/use-controlled-state.js +2 -1
- package/build-module/utils/hooks/use-controlled-state.js.map +1 -1
- package/build-module/utils/hooks/use-controlled-value.js +6 -5
- package/build-module/utils/hooks/use-controlled-value.js.map +1 -1
- package/build-module/utils/hooks/use-cx.js +5 -1
- package/build-module/utils/hooks/use-cx.js.map +1 -1
- package/build-module/utils/math.js +17 -5
- package/build-module/utils/math.js.map +1 -1
- package/build-module/utils/reduce-motion.js +2 -1
- package/build-module/utils/reduce-motion.js.map +1 -1
- package/build-module/utils/rtl.js +5 -2
- package/build-module/utils/rtl.js.map +1 -1
- package/build-module/utils/types.js +1 -1
- package/build-module/utils/values.js +9 -5
- package/build-module/utils/values.js.map +1 -1
- package/build-module/v-stack/types.js +1 -1
- package/build-module/z-stack/styles.js +23 -14
- package/build-module/z-stack/styles.js.map +1 -1
- package/package.json +16 -16
|
@@ -46,12 +46,13 @@ var _constants = require("./constants");
|
|
|
46
46
|
/**
|
|
47
47
|
* Internal dependencies
|
|
48
48
|
*/
|
|
49
|
-
function ControlPointButton({
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
49
|
+
function ControlPointButton(_ref) {
|
|
50
|
+
let {
|
|
51
|
+
isOpen,
|
|
52
|
+
position,
|
|
53
|
+
color,
|
|
54
|
+
...additionalProps
|
|
55
|
+
} = _ref;
|
|
55
56
|
const instanceId = (0, _compose.useInstanceId)(ControlPointButton);
|
|
56
57
|
const descriptionId = `components-custom-gradient-picker__control-point-button-description-${instanceId}`;
|
|
57
58
|
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_button.default, (0, _extends2.default)({
|
|
@@ -71,16 +72,17 @@ function ControlPointButton({
|
|
|
71
72
|
}, (0, _i18n.__)('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.')));
|
|
72
73
|
}
|
|
73
74
|
|
|
74
|
-
function ControlPoints({
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
75
|
+
function ControlPoints(_ref2) {
|
|
76
|
+
let {
|
|
77
|
+
disableRemove,
|
|
78
|
+
disableAlpha,
|
|
79
|
+
gradientPickerDomRef,
|
|
80
|
+
ignoreMarkerPosition,
|
|
81
|
+
value: controlPoints,
|
|
82
|
+
onChange,
|
|
83
|
+
onStartControlPointChange,
|
|
84
|
+
onStopControlPointChange
|
|
85
|
+
} = _ref2;
|
|
84
86
|
const controlPointMoveState = (0, _element.useRef)();
|
|
85
87
|
|
|
86
88
|
const onMouseMove = event => {
|
|
@@ -117,111 +119,121 @@ function ControlPoints({
|
|
|
117
119
|
return ignoreMarkerPosition !== initialPosition && (0, _element.createElement)(_dropdown.default, {
|
|
118
120
|
key: index,
|
|
119
121
|
onClose: onStopControlPointChange,
|
|
120
|
-
renderToggle:
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
122
|
+
renderToggle: _ref3 => {
|
|
123
|
+
let {
|
|
124
|
+
isOpen,
|
|
125
|
+
onToggle
|
|
126
|
+
} = _ref3;
|
|
127
|
+
return (0, _element.createElement)(ControlPointButton, {
|
|
128
|
+
key: index,
|
|
129
|
+
onClick: () => {
|
|
130
|
+
if (controlPointMoveState.current && controlPointMoveState.current.significantMoveHappened) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (isOpen) {
|
|
135
|
+
onStopControlPointChange();
|
|
136
|
+
} else {
|
|
137
|
+
onStartControlPointChange();
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
onToggle();
|
|
141
|
+
},
|
|
142
|
+
onMouseDown: () => {
|
|
143
|
+
if (window && window.addEventListener) {
|
|
144
|
+
controlPointMoveState.current = {
|
|
145
|
+
initialPosition,
|
|
146
|
+
index,
|
|
147
|
+
significantMoveHappened: false,
|
|
148
|
+
listenersActivated: true
|
|
149
|
+
};
|
|
150
|
+
onStartControlPointChange();
|
|
151
|
+
window.addEventListener('mousemove', onMouseMove);
|
|
152
|
+
window.addEventListener('mouseup', cleanEventListeners);
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
onKeyDown: event => {
|
|
156
|
+
if (event.keyCode === _keycodes.LEFT) {
|
|
157
|
+
// Stop propagation of the key press event to avoid focus moving
|
|
158
|
+
// to another editor area.
|
|
159
|
+
event.stopPropagation();
|
|
160
|
+
onChange((0, _utils.updateControlPointPosition)(controlPoints, index, (0, _utils.clampPercent)(point.position - _constants.KEYBOARD_CONTROL_POINT_VARIATION)));
|
|
161
|
+
} else if (event.keyCode === _keycodes.RIGHT) {
|
|
162
|
+
// Stop propagation of the key press event to avoid focus moving
|
|
163
|
+
// to another editor area.
|
|
164
|
+
event.stopPropagation();
|
|
165
|
+
onChange((0, _utils.updateControlPointPosition)(controlPoints, index, (0, _utils.clampPercent)(point.position + _constants.KEYBOARD_CONTROL_POINT_VARIATION)));
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
isOpen: isOpen,
|
|
169
|
+
position: point.position,
|
|
170
|
+
color: point.color
|
|
171
|
+
});
|
|
172
|
+
},
|
|
173
|
+
renderContent: _ref4 => {
|
|
174
|
+
let {
|
|
175
|
+
onClose
|
|
176
|
+
} = _ref4;
|
|
177
|
+
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_colorPicker.ColorPicker, {
|
|
178
|
+
enableAlpha: !disableAlpha,
|
|
179
|
+
color: point.color,
|
|
180
|
+
onChange: color => {
|
|
181
|
+
onChange((0, _utils.updateControlPointColor)(controlPoints, index, (0, _colord.colord)(color).toRgbString()));
|
|
162
182
|
}
|
|
163
|
-
},
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
color: point.color,
|
|
173
|
-
onChange: color => {
|
|
174
|
-
onChange((0, _utils.updateControlPointColor)(controlPoints, index, (0, _colord.colord)(color).toRgbString()));
|
|
175
|
-
}
|
|
176
|
-
}), !disableRemove && (0, _element.createElement)(_button.default, {
|
|
177
|
-
className: "components-custom-gradient-picker__remove-control-point",
|
|
178
|
-
onClick: () => {
|
|
179
|
-
onChange((0, _utils.removeControlPoint)(controlPoints, index));
|
|
180
|
-
onClose();
|
|
181
|
-
},
|
|
182
|
-
variant: "link"
|
|
183
|
-
}, (0, _i18n.__)('Remove Control Point'))),
|
|
183
|
+
}), !disableRemove && (0, _element.createElement)(_button.default, {
|
|
184
|
+
className: "components-custom-gradient-picker__remove-control-point",
|
|
185
|
+
onClick: () => {
|
|
186
|
+
onChange((0, _utils.removeControlPoint)(controlPoints, index));
|
|
187
|
+
onClose();
|
|
188
|
+
},
|
|
189
|
+
variant: "link"
|
|
190
|
+
}, (0, _i18n.__)('Remove Control Point')));
|
|
191
|
+
},
|
|
184
192
|
popoverProps: _constants.COLOR_POPOVER_PROPS
|
|
185
193
|
});
|
|
186
194
|
});
|
|
187
195
|
}
|
|
188
196
|
|
|
189
|
-
function InsertPoint({
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
+
function InsertPoint(_ref5) {
|
|
198
|
+
let {
|
|
199
|
+
value: controlPoints,
|
|
200
|
+
onChange,
|
|
201
|
+
onOpenInserter,
|
|
202
|
+
onCloseInserter,
|
|
203
|
+
insertPosition,
|
|
204
|
+
disableAlpha
|
|
205
|
+
} = _ref5;
|
|
197
206
|
const [alreadyInsertedPoint, setAlreadyInsertedPoint] = (0, _element.useState)(false);
|
|
198
207
|
return (0, _element.createElement)(_dropdown.default, {
|
|
199
208
|
className: "components-custom-gradient-picker__inserter",
|
|
200
209
|
onClose: () => {
|
|
201
210
|
onCloseInserter();
|
|
202
211
|
},
|
|
203
|
-
renderToggle:
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
212
|
+
renderToggle: _ref6 => {
|
|
213
|
+
let {
|
|
214
|
+
isOpen,
|
|
215
|
+
onToggle
|
|
216
|
+
} = _ref6;
|
|
217
|
+
return (0, _element.createElement)(_button.default, {
|
|
218
|
+
"aria-expanded": isOpen,
|
|
219
|
+
"aria-haspopup": "true",
|
|
220
|
+
onClick: () => {
|
|
221
|
+
if (isOpen) {
|
|
222
|
+
onCloseInserter();
|
|
223
|
+
} else {
|
|
224
|
+
setAlreadyInsertedPoint(false);
|
|
225
|
+
onOpenInserter();
|
|
226
|
+
}
|
|
216
227
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
228
|
+
onToggle();
|
|
229
|
+
},
|
|
230
|
+
className: "components-custom-gradient-picker__insert-point",
|
|
231
|
+
icon: _icons.plus,
|
|
232
|
+
style: {
|
|
233
|
+
left: insertPosition !== null ? `${insertPosition}%` : undefined
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
},
|
|
225
237
|
renderContent: () => (0, _element.createElement)(_colorPicker.ColorPicker, {
|
|
226
238
|
enableAlpha: !disableAlpha,
|
|
227
239
|
onChange: color => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/custom-gradient-bar/control-points.js"],"names":["ControlPointButton","isOpen","position","color","additionalProps","instanceId","descriptionId","left","ControlPoints","disableRemove","disableAlpha","gradientPickerDomRef","ignoreMarkerPosition","value","controlPoints","onChange","onStartControlPointChange","onStopControlPointChange","controlPointMoveState","onMouseMove","event","relativePosition","clientX","current","GRADIENT_MARKERS_WIDTH","initialPosition","index","significantMoveHappened","Math","abs","MINIMUM_SIGNIFICANT_MOVE","cleanEventListeners","window","removeEventListener","listenersActivated","map","point","onToggle","addEventListener","keyCode","LEFT","stopPropagation","KEYBOARD_CONTROL_POINT_VARIATION","RIGHT","onClose","toRgbString","COLOR_POPOVER_PROPS","InsertPoint","onOpenInserter","onCloseInserter","insertPosition","alreadyInsertedPoint","setAlreadyInsertedPoint","plus","undefined"],"mappings":";;;;;;;;;AAUA;;;;AAPA;;AACA;;AAKA;;AAEA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAEA;;AASA;;AAhCA;AACA;AACA;;AAIA;AACA;AACA;;AAOA;AACA;AACA;AAsBA,SAASA,kBAAT,CAA6B;AAAEC,EAAAA,MAAF;AAAUC,EAAAA,QAAV;AAAoBC,EAAAA,KAApB;AAA2B,KAAGC;AAA9B,CAA7B,EAA+E;AAC9E,QAAMC,UAAU,GAAG,4BAAeL,kBAAf,CAAnB;AACA,QAAMM,aAAa,GAAI,uEAAuED,UAAY,EAA1G;AACA,SACC,qDACC,4BAAC,eAAD;AACC,kBAAa,oBACZ;AACA,kBACC,iEADD,CAFY,EAKZH,QALY,EAMZC,KANY,CADd;AASC,wBAAmBG,aATpB;AAUC,qBAAc,MAVf;AAWC,qBAAgBL,MAXjB;AAYC,IAAA,SAAS,EAAG,yBACX,yDADW,EAEX;AACC,mBAAaA;AADd,KAFW,CAZb;AA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B,EAHD,CADO,CAAR;AAOAO,UAAAA,uBAAuB,CAAE,IAAF,CAAvB;AACA,SATD,MASO;AACNrC,UAAAA,QAAQ,CACP,8CACCD,aADD,EAECoC,cAFD,EAGC,oBAAQ/C,KAAR,EAAgB0C,WAAhB,EAHD,CADO,CAAR;AAOA;AACD;AArBF,MA7BF;AAqDC,IAAA,YAAY,EAAGC;AArDhB,IADD;AAyDA;;AACDtC,aAAa,CAACuC,WAAd,GAA4BA,WAA5B;eAEevC,a","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { colord } from 'colord';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { useEffect, useRef, useState } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { plus } from '@wordpress/icons';\nimport { LEFT, RIGHT } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport Button from '../button';\nimport { ColorPicker } from '../color-picker';\nimport Dropdown from '../dropdown';\nimport { VisuallyHidden } from '../visually-hidden';\n\nimport {\n\taddControlPoint,\n\tclampPercent,\n\tremoveControlPoint,\n\tupdateControlPointColor,\n\tupdateControlPointColorByPosition,\n\tupdateControlPointPosition,\n\tgetHorizontalRelativeGradientPosition,\n} from './utils';\nimport {\n\tCOLOR_POPOVER_PROPS,\n\tGRADIENT_MARKERS_WIDTH,\n\tMINIMUM_SIGNIFICANT_MOVE,\n\tKEYBOARD_CONTROL_POINT_VARIATION,\n} from './constants';\n\nfunction ControlPointButton( { isOpen, position, color, ...additionalProps } ) {\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={ classnames(\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\tstyle={ {\n\t\t\t\t\tleft: `${ position }%`,\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 ControlPoints( {\n\tdisableRemove,\n\tdisableAlpha,\n\tgradientPickerDomRef,\n\tignoreMarkerPosition,\n\tvalue: controlPoints,\n\tonChange,\n\tonStartControlPointChange,\n\tonStopControlPointChange,\n} ) {\n\tconst controlPointMoveState = useRef();\n\n\tconst onMouseMove = ( event ) => {\n\t\tconst relativePosition = getHorizontalRelativeGradientPosition(\n\t\t\tevent.clientX,\n\t\t\tgradientPickerDomRef.current,\n\t\t\tGRADIENT_MARKERS_WIDTH\n\t\t);\n\t\tconst {\n\t\t\tinitialPosition,\n\t\t\tindex,\n\t\t\tsignificantMoveHappened,\n\t\t} = controlPointMoveState.current;\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\tcontrolPointMoveState.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\tcontrolPointMoveState.current &&\n\t\t\tcontrolPointMoveState.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\tcontrolPointMoveState.current.listenersActivated = false;\n\t\t}\n\t};\n\n\tuseEffect( () => {\n\t\treturn () => {\n\t\t\tcleanEventListeners();\n\t\t};\n\t}, [] );\n\n\treturn controlPoints.map( ( point, index ) => {\n\t\tconst initialPosition = point?.position;\n\t\treturn (\n\t\t\tignoreMarkerPosition !== initialPosition && (\n\t\t\t\t<Dropdown\n\t\t\t\t\tkey={ index }\n\t\t\t\t\tonClose={ onStopControlPointChange }\n\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t<ControlPointButton\n\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\tcontrolPointMoveState.current &&\n\t\t\t\t\t\t\t\t\tcontrolPointMoveState.current\n\t\t\t\t\t\t\t\t\t\t.significantMoveHappened\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif ( isOpen ) {\n\t\t\t\t\t\t\t\t\tonStopControlPointChange();\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tonStartControlPointChange();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonToggle();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonMouseDown={ () => {\n\t\t\t\t\t\t\t\tif ( window && window.addEventListener ) {\n\t\t\t\t\t\t\t\t\tcontrolPointMoveState.current = {\n\t\t\t\t\t\t\t\t\t\tinitialPosition,\n\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\tsignificantMoveHappened: false,\n\t\t\t\t\t\t\t\t\t\tlistenersActivated: true,\n\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\tonStartControlPointChange();\n\t\t\t\t\t\t\t\t\twindow.addEventListener(\n\t\t\t\t\t\t\t\t\t\t'mousemove',\n\t\t\t\t\t\t\t\t\t\tonMouseMove\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\twindow.addEventListener(\n\t\t\t\t\t\t\t\t\t\t'mouseup',\n\t\t\t\t\t\t\t\t\t\tcleanEventListeners\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\tonKeyDown={ ( event ) => {\n\t\t\t\t\t\t\t\tif ( event.keyCode === LEFT ) {\n\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// to another editor area.\n\t\t\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\t\tupdateControlPointPosition(\n\t\t\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\tclampPercent(\n\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\tKEYBOARD_CONTROL_POINT_VARIATION\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} else if ( event.keyCode === RIGHT ) {\n\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// to another editor area.\n\t\t\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\t\tupdateControlPointPosition(\n\t\t\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\tclampPercent(\n\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\tKEYBOARD_CONTROL_POINT_VARIATION\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}\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tisOpen={ isOpen }\n\t\t\t\t\t\t\tposition={ point.position }\n\t\t\t\t\t\t\tcolor={ point.color }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<ColorPicker\n\t\t\t\t\t\t\t\tenableAlpha={ ! disableAlpha }\n\t\t\t\t\t\t\t\tcolor={ point.color }\n\t\t\t\t\t\t\t\tonChange={ ( color ) => {\n\t\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\t\tupdateControlPointColor(\n\t\t\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\tcolord( color ).toRgbString()\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{ ! disableRemove && (\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tclassName=\"components-custom-gradient-picker__remove-control-point\"\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\t\t\tremoveControlPoint(\n\t\t\t\t\t\t\t\t\t\t\t\tcontrolPoints,\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)\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Remove Control Point' ) }\n\t\t\t\t\t\t\t\t</Button>\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\tpopoverProps={ COLOR_POPOVER_PROPS }\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} ) {\n\tconst [ alreadyInsertedPoint, setAlreadyInsertedPoint ] = useState( false );\n\treturn (\n\t\t<Dropdown\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\"\n\t\t\t\t\ticon={ plus }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\tleft:\n\t\t\t\t\t\t\tinsertPosition !== null\n\t\t\t\t\t\t\t\t? `${ insertPosition }%`\n\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\trenderContent={ () => (\n\t\t\t\t<ColorPicker\n\t\t\t\t\tenableAlpha={ ! disableAlpha }\n\t\t\t\t\tonChange={ ( color ) => {\n\t\t\t\t\t\tif ( ! alreadyInsertedPoint ) {\n\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\taddControlPoint(\n\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\tinsertPosition,\n\t\t\t\t\t\t\t\t\tcolord( color ).toRgbString()\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tsetAlreadyInsertedPoint( true );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\tupdateControlPointColorByPosition(\n\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\tinsertPosition,\n\t\t\t\t\t\t\t\t\tcolord( color ).toRgbString()\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/>\n\t\t\t) }\n\t\t\tpopoverProps={ COLOR_POPOVER_PROPS }\n\t\t/>\n\t);\n}\nControlPoints.InsertPoint = InsertPoint;\n\nexport default ControlPoints;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/custom-gradient-bar/control-points.js"],"names":["ControlPointButton","isOpen","position","color","additionalProps","instanceId","descriptionId","left","ControlPoints","disableRemove","disableAlpha","gradientPickerDomRef","ignoreMarkerPosition","value","controlPoints","onChange","onStartControlPointChange","onStopControlPointChange","controlPointMoveState","onMouseMove","event","relativePosition","clientX","current","GRADIENT_MARKERS_WIDTH","initialPosition","index","significantMoveHappened","Math","abs","MINIMUM_SIGNIFICANT_MOVE","cleanEventListeners","window","removeEventListener","listenersActivated","map","point","onToggle","addEventListener","keyCode","LEFT","stopPropagation","KEYBOARD_CONTROL_POINT_VARIATION","RIGHT","onClose","toRgbString","COLOR_POPOVER_PROPS","InsertPoint","onOpenInserter","onCloseInserter","insertPosition","alreadyInsertedPoint","setAlreadyInsertedPoint","plus","undefined"],"mappings":";;;;;;;;;AAUA;;;;AAPA;;AACA;;AAKA;;AAEA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAEA;;AASA;;AAhCA;AACA;AACA;;AAIA;AACA;AACA;;AAOA;AACA;AACA;AAsBA,SAASA,kBAAT,OAA+E;AAAA,MAAlD;AAAEC,IAAAA,MAAF;AAAUC,IAAAA,QAAV;AAAoBC,IAAAA,KAApB;AAA2B,OAAGC;AAA9B,GAAkD;AAC9E,QAAMC,UAAU,GAAG,4BAAeL,kBAAf,CAAnB;AACA,QAAMM,aAAa,GAAI,uEAAuED,UAAY,EAA1G;AACA,SACC,qDACC,4BAAC,eAAD;AACC,kBAAa,oBACZ;AACA,kBACC,iEADD,CAFY,EAKZH,QALY,EAMZC,KANY,CADd;AASC,wBAAmBG,aATpB;AAUC,qBAAc,MAVf;AAWC,qBAAgBL,MAXjB;AAYC,IAAA,SAAS,EAAG,yBACX,yDADW,EAEX;AACC,mBAAaA;AADd,KAFW,CAZb;AAkBC,IAAA,KAAK,EAAG;AACPM,MAAAA,IAAI,EAAG,GAAGL,QAAU;AADb;AAlBT,KAqBME,eArBN,EADD,EAwBC,4BAAC,8BAAD;AAAgB,IAAA,EAAE,EAAGE;AAArB,KACG,cACD,sKADC,CADH,CAxBD,CADD;AAgCA;;AAED,SAASE,aAAT,QASI;AAAA,MAToB;AACvBC,IAAAA,aADuB;AAEvBC,IAAAA,YAFuB;AAGvBC,IAAAA,oBAHuB;AAIvBC,IAAAA,oBAJuB;AAKvBC,IAAAA,KAAK,EAAEC,aALgB;AAMvBC,IAAAA,QANuB;AAOvBC,IAAAA,yBAPuB;AAQvBC,IAAAA;AARuB,GASpB;AACH,QAAMC,qBAAqB,GAAG,sBAA9B;;AAEA,QAAMC,WAAW,GAAKC,KAAF,IAAa;AAChC,UAAMC,gBAAgB,GAAG,kDACxBD,KAAK,CAACE,OAD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,IAAA,YAAY,EAAG;AAAA,UAAE;AAAEhD,QAAAA,MAAF;AAAUoC,QAAAA;AAAV,OAAF;AAAA,aACd,4BAAC,eAAD;AACC,yBAAgBpC,MADjB;AAEC,yBAAc,MAFf;AAGC,QAAA,OAAO,EAAG,MAAM;AACf,cAAKA,MAAL,EAAc;AACbgD,YAAAA,eAAe;AACf,WAFD,MAEO;AACNG,YAAAA,uBAAuB,CAAE,KAAF,CAAvB;AACAJ,YAAAA,cAAc;AACd;;AACDX,UAAAA,QAAQ;AACR,SAXF;AAYC,QAAA,SAAS,EAAC,iDAZX;AAaC,QAAA,IAAI,EAAGgB,WAbR;AAcC,QAAA,KAAK,EAAG;AACP9C,UAAAA,IAAI,EACH2C,cAAc,KAAK,IAAnB,GACI,GAAGA,cAAgB,GADvB,GAEGI;AAJG;AAdT,QADc;AAAA,KALhB;AA4BC,IAAA,aAAa,EAAG,MACf,4BAAC,wBAAD;AACC,MAAA,WAAW,EAAG,CAAE5C,YADjB;AAEC,MAAA,QAAQ,EAAKP,KAAF,IAAa;AACvB,YAAK,CAAEgD,oBAAP,EAA8B;AAC7BpC,UAAAA,QAAQ,CACP,4BACCD,aADD,EAECoC,cAFD,EAGC,oBAAQ/C,KAAR,EAAgB0C,WAAhB,EAHD,CADO,CAAR;AAOAO,UAAAA,uBAAuB,CAAE,IAAF,CAAvB;AACA,SATD,MASO;AACNrC,UAAAA,QAAQ,CACP,8CACCD,aADD,EAECoC,cAFD,EAGC,oBAAQ/C,KAAR,EAAgB0C,WAAhB,EAHD,CADO,CAAR;AAOA;AACD;AArBF,MA7BF;AAqDC,IAAA,YAAY,EAAGC;AArDhB,IADD;AAyDA;;AACDtC,aAAa,CAACuC,WAAd,GAA4BA,WAA5B;eAEevC,a","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { colord } from 'colord';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { useEffect, useRef, useState } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { plus } from '@wordpress/icons';\nimport { LEFT, RIGHT } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport Button from '../button';\nimport { ColorPicker } from '../color-picker';\nimport Dropdown from '../dropdown';\nimport { VisuallyHidden } from '../visually-hidden';\n\nimport {\n\taddControlPoint,\n\tclampPercent,\n\tremoveControlPoint,\n\tupdateControlPointColor,\n\tupdateControlPointColorByPosition,\n\tupdateControlPointPosition,\n\tgetHorizontalRelativeGradientPosition,\n} from './utils';\nimport {\n\tCOLOR_POPOVER_PROPS,\n\tGRADIENT_MARKERS_WIDTH,\n\tMINIMUM_SIGNIFICANT_MOVE,\n\tKEYBOARD_CONTROL_POINT_VARIATION,\n} from './constants';\n\nfunction ControlPointButton( { isOpen, position, color, ...additionalProps } ) {\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={ classnames(\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\tstyle={ {\n\t\t\t\t\tleft: `${ position }%`,\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 ControlPoints( {\n\tdisableRemove,\n\tdisableAlpha,\n\tgradientPickerDomRef,\n\tignoreMarkerPosition,\n\tvalue: controlPoints,\n\tonChange,\n\tonStartControlPointChange,\n\tonStopControlPointChange,\n} ) {\n\tconst controlPointMoveState = useRef();\n\n\tconst onMouseMove = ( event ) => {\n\t\tconst relativePosition = getHorizontalRelativeGradientPosition(\n\t\t\tevent.clientX,\n\t\t\tgradientPickerDomRef.current,\n\t\t\tGRADIENT_MARKERS_WIDTH\n\t\t);\n\t\tconst {\n\t\t\tinitialPosition,\n\t\t\tindex,\n\t\t\tsignificantMoveHappened,\n\t\t} = controlPointMoveState.current;\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\tcontrolPointMoveState.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\tcontrolPointMoveState.current &&\n\t\t\tcontrolPointMoveState.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\tcontrolPointMoveState.current.listenersActivated = false;\n\t\t}\n\t};\n\n\tuseEffect( () => {\n\t\treturn () => {\n\t\t\tcleanEventListeners();\n\t\t};\n\t}, [] );\n\n\treturn controlPoints.map( ( point, index ) => {\n\t\tconst initialPosition = point?.position;\n\t\treturn (\n\t\t\tignoreMarkerPosition !== initialPosition && (\n\t\t\t\t<Dropdown\n\t\t\t\t\tkey={ index }\n\t\t\t\t\tonClose={ onStopControlPointChange }\n\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t<ControlPointButton\n\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\tcontrolPointMoveState.current &&\n\t\t\t\t\t\t\t\t\tcontrolPointMoveState.current\n\t\t\t\t\t\t\t\t\t\t.significantMoveHappened\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif ( isOpen ) {\n\t\t\t\t\t\t\t\t\tonStopControlPointChange();\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tonStartControlPointChange();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonToggle();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonMouseDown={ () => {\n\t\t\t\t\t\t\t\tif ( window && window.addEventListener ) {\n\t\t\t\t\t\t\t\t\tcontrolPointMoveState.current = {\n\t\t\t\t\t\t\t\t\t\tinitialPosition,\n\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\tsignificantMoveHappened: false,\n\t\t\t\t\t\t\t\t\t\tlistenersActivated: true,\n\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\tonStartControlPointChange();\n\t\t\t\t\t\t\t\t\twindow.addEventListener(\n\t\t\t\t\t\t\t\t\t\t'mousemove',\n\t\t\t\t\t\t\t\t\t\tonMouseMove\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\twindow.addEventListener(\n\t\t\t\t\t\t\t\t\t\t'mouseup',\n\t\t\t\t\t\t\t\t\t\tcleanEventListeners\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\tonKeyDown={ ( event ) => {\n\t\t\t\t\t\t\t\tif ( event.keyCode === LEFT ) {\n\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// to another editor area.\n\t\t\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\t\tupdateControlPointPosition(\n\t\t\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\tclampPercent(\n\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\tKEYBOARD_CONTROL_POINT_VARIATION\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} else if ( event.keyCode === RIGHT ) {\n\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// to another editor area.\n\t\t\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\t\tupdateControlPointPosition(\n\t\t\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\tclampPercent(\n\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\tKEYBOARD_CONTROL_POINT_VARIATION\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}\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tisOpen={ isOpen }\n\t\t\t\t\t\t\tposition={ point.position }\n\t\t\t\t\t\t\tcolor={ point.color }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<ColorPicker\n\t\t\t\t\t\t\t\tenableAlpha={ ! disableAlpha }\n\t\t\t\t\t\t\t\tcolor={ point.color }\n\t\t\t\t\t\t\t\tonChange={ ( color ) => {\n\t\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\t\tupdateControlPointColor(\n\t\t\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\tcolord( color ).toRgbString()\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{ ! disableRemove && (\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tclassName=\"components-custom-gradient-picker__remove-control-point\"\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\t\t\tremoveControlPoint(\n\t\t\t\t\t\t\t\t\t\t\t\tcontrolPoints,\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)\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Remove Control Point' ) }\n\t\t\t\t\t\t\t\t</Button>\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\tpopoverProps={ COLOR_POPOVER_PROPS }\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} ) {\n\tconst [ alreadyInsertedPoint, setAlreadyInsertedPoint ] = useState( false );\n\treturn (\n\t\t<Dropdown\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\"\n\t\t\t\t\ticon={ plus }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\tleft:\n\t\t\t\t\t\t\tinsertPosition !== null\n\t\t\t\t\t\t\t\t? `${ insertPosition }%`\n\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\trenderContent={ () => (\n\t\t\t\t<ColorPicker\n\t\t\t\t\tenableAlpha={ ! disableAlpha }\n\t\t\t\t\tonChange={ ( color ) => {\n\t\t\t\t\t\tif ( ! alreadyInsertedPoint ) {\n\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\taddControlPoint(\n\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\tinsertPosition,\n\t\t\t\t\t\t\t\t\tcolord( color ).toRgbString()\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tsetAlreadyInsertedPoint( true );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\tupdateControlPointColorByPosition(\n\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\tinsertPosition,\n\t\t\t\t\t\t\t\t\tcolord( color ).toRgbString()\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/>\n\t\t\t) }\n\t\t\tpopoverProps={ COLOR_POPOVER_PROPS }\n\t\t/>\n\t);\n}\nControlPoints.InsertPoint = InsertPoint;\n\nexport default ControlPoints;\n"]}
|
|
@@ -96,23 +96,25 @@ const customGradientBarReducerInitialState = {
|
|
|
96
96
|
id: 'IDLE'
|
|
97
97
|
};
|
|
98
98
|
|
|
99
|
-
function CustomGradientBar({
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
99
|
+
function CustomGradientBar(_ref) {
|
|
100
|
+
let {
|
|
101
|
+
background,
|
|
102
|
+
hasGradient,
|
|
103
|
+
value: controlPoints,
|
|
104
|
+
onChange,
|
|
105
|
+
disableInserter = false,
|
|
106
|
+
disableAlpha = false
|
|
107
|
+
} = _ref;
|
|
107
108
|
const gradientPickerDomRef = (0, _element.useRef)();
|
|
108
109
|
const [gradientBarState, gradientBarStateDispatch] = (0, _element.useReducer)(customGradientBarReducer, customGradientBarReducerInitialState);
|
|
109
110
|
|
|
110
111
|
const onMouseEnterAndMove = event => {
|
|
111
112
|
const insertPosition = (0, _utils.getHorizontalRelativeGradientPosition)(event.clientX, gradientPickerDomRef.current, _constants.INSERT_POINT_WIDTH); // If the insert point is close to an existing control point don't show it.
|
|
112
113
|
|
|
113
|
-
if ((0, _lodash.some)(controlPoints,
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
if ((0, _lodash.some)(controlPoints, _ref2 => {
|
|
115
|
+
let {
|
|
116
|
+
position
|
|
117
|
+
} = _ref2;
|
|
116
118
|
return Math.abs(insertPosition - position) < _constants.MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT;
|
|
117
119
|
})) {
|
|
118
120
|
if (gradientBarState.id === 'MOVING_INSERTER') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/custom-gradient-bar/index.js"],"names":["customGradientBarReducer","state","action","type","id","insertPosition","customGradientBarReducerInitialState","CustomGradientBar","background","hasGradient","value","controlPoints","onChange","disableInserter","disableAlpha","gradientPickerDomRef","gradientBarState","gradientBarStateDispatch","onMouseEnterAndMove","event","clientX","current","INSERT_POINT_WIDTH","position","Math","abs","MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT","onMouseLeave","isMovingInserter","isInsertingControlPoint","undefined"],"mappings":";;;;;;;;;AAUA;;AANA;;AACA;;AAUA;;AACA;;AACA;;AAjBA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;AAQA,SAASA,wBAAT,CAAmCC,KAAnC,EAA0CC,MAA1C,EAAmD;AAClD,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,eAAL;AACC,UAAKF,KAAK,CAACG,EAAN,KAAa,MAAb,IAAuBH,KAAK,CAACG,EAAN,KAAa,iBAAzC,EAA6D;AAC5D,eAAO;AACNA,UAAAA,EAAE,EAAE,iBADE;AAENC,UAAAA,cAAc,EAAEH,MAAM,CAACG;AAFjB,SAAP;AAIA;;AACD;;AACD,SAAK,oBAAL;AACC,UAAKJ,KAAK,CAACG,EAAN,KAAa,iBAAlB,EAAsC;AACrC,eAAO;AACNA,UAAAA,EAAE,EAAE;AADE,SAAP;AAGA;;AACD;;AACD,SAAK,eAAL;AACC,UAAKH,KAAK,CAACG,EAAN,KAAa,iBAAlB,EAAsC;AACrC,eAAO;AACNA,UAAAA,EAAE,EAAE,yBADE;AAENC,UAAAA,cAAc,EAAEJ,KAAK,CAACI;AAFhB,SAAP;AAIA;;AACD;;AACD,SAAK,gBAAL;AACC,UAAKJ,KAAK,CAACG,EAAN,KAAa,yBAAlB,EAA8C;AAC7C,eAAO;AACNA,UAAAA,EAAE,EAAE;AADE,SAAP;AAGA;;AACD;;AACD,SAAK,sBAAL;AACC,UAAKH,KAAK,CAACG,EAAN,KAAa,MAAlB,EAA2B;AAC1B,eAAO;AACNA,UAAAA,EAAE,EAAE;AADE,SAAP;AAGA;;AACD;;AACD,SAAK,qBAAL;AACC,UAAKH,KAAK,CAACG,EAAN,KAAa,sBAAlB,EAA2C;AAC1C,eAAO;AACNA,UAAAA,EAAE,EAAE;AADE,SAAP;AAGA;;AACD;AA5CF;;AA8CA,SAAOH,KAAP;AACA;;AACD,MAAMK,oCAAoC,GAAG;AAAEF,EAAAA,EAAE,EAAE;AAAN,CAA7C;;AAEe,SAASG,iBAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/custom-gradient-bar/index.js"],"names":["customGradientBarReducer","state","action","type","id","insertPosition","customGradientBarReducerInitialState","CustomGradientBar","background","hasGradient","value","controlPoints","onChange","disableInserter","disableAlpha","gradientPickerDomRef","gradientBarState","gradientBarStateDispatch","onMouseEnterAndMove","event","clientX","current","INSERT_POINT_WIDTH","position","Math","abs","MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT","onMouseLeave","isMovingInserter","isInsertingControlPoint","undefined"],"mappings":";;;;;;;;;AAUA;;AANA;;AACA;;AAUA;;AACA;;AACA;;AAjBA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;AAQA,SAASA,wBAAT,CAAmCC,KAAnC,EAA0CC,MAA1C,EAAmD;AAClD,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,eAAL;AACC,UAAKF,KAAK,CAACG,EAAN,KAAa,MAAb,IAAuBH,KAAK,CAACG,EAAN,KAAa,iBAAzC,EAA6D;AAC5D,eAAO;AACNA,UAAAA,EAAE,EAAE,iBADE;AAENC,UAAAA,cAAc,EAAEH,MAAM,CAACG;AAFjB,SAAP;AAIA;;AACD;;AACD,SAAK,oBAAL;AACC,UAAKJ,KAAK,CAACG,EAAN,KAAa,iB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QAJZ;AAKC,IAAA,cAAc,EAAG,MAAM;AACtBK,MAAAA,wBAAwB,CAAE;AACzBd,QAAAA,IAAI,EAAE;AADmB,OAAF,CAAxB;AAGA,KATF;AAUC,IAAA,eAAe,EAAG,MAAM;AACvBc,MAAAA,wBAAwB,CAAE;AACzBd,QAAAA,IAAI,EAAE;AADmB,OAAF,CAAxB;AAGA;AAdF,IAHH,EAoBC,4BAAC,sBAAD;AACC,IAAA,YAAY,EAAGW,YADhB;AAEC,IAAA,aAAa,EAAGD,eAFjB;AAGC,IAAA,oBAAoB,EAAGE,oBAHxB;AAIC,IAAA,oBAAoB,EACnBc,uBAAuB,GACpBb,gBAAgB,CAACX,cADG,GAEpByB,SAPL;AASC,IAAA,KAAK,EAAGnB,aATT;AAUC,IAAA,QAAQ,EAAGC,QAVZ;AAWC,IAAA,yBAAyB,EAAG,MAAM;AACjCK,MAAAA,wBAAwB,CAAE;AACzBd,QAAAA,IAAI,EAAE;AADmB,OAAF,CAAxB;AAGA,KAfF;AAgBC,IAAA,wBAAwB,EAAG,MAAM;AAChCc,MAAAA,wBAAwB,CAAE;AACzBd,QAAAA,IAAI,EAAE;AADmB,OAAF,CAAxB;AAGA;AApBF,IApBD,CAXD,CADD;AAyDA","sourcesContent":["/**\n * External dependencies\n */\n\nimport { some } from 'lodash';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useRef, useReducer } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport ControlPoints from './control-points';\nimport { getHorizontalRelativeGradientPosition } from './utils';\nimport {\n\tINSERT_POINT_WIDTH,\n\tMINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT,\n} from './constants';\n\nfunction customGradientBarReducer( state, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'MOVE_INSERTER':\n\t\t\tif ( state.id === 'IDLE' || state.id === 'MOVING_INSERTER' ) {\n\t\t\t\treturn {\n\t\t\t\t\tid: 'MOVING_INSERTER',\n\t\t\t\t\tinsertPosition: action.insertPosition,\n\t\t\t\t};\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 'STOP_INSERTER_MOVE':\n\t\t\tif ( state.id === 'MOVING_INSERTER' ) {\n\t\t\t\treturn {\n\t\t\t\t\tid: 'IDLE',\n\t\t\t\t};\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 'OPEN_INSERTER':\n\t\t\tif ( state.id === 'MOVING_INSERTER' ) {\n\t\t\t\treturn {\n\t\t\t\t\tid: 'INSERTING_CONTROL_POINT',\n\t\t\t\t\tinsertPosition: state.insertPosition,\n\t\t\t\t};\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 'CLOSE_INSERTER':\n\t\t\tif ( state.id === 'INSERTING_CONTROL_POINT' ) {\n\t\t\t\treturn {\n\t\t\t\t\tid: 'IDLE',\n\t\t\t\t};\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 'START_CONTROL_CHANGE':\n\t\t\tif ( state.id === 'IDLE' ) {\n\t\t\t\treturn {\n\t\t\t\t\tid: 'MOVING_CONTROL_POINT',\n\t\t\t\t};\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 'STOP_CONTROL_CHANGE':\n\t\t\tif ( state.id === 'MOVING_CONTROL_POINT' ) {\n\t\t\t\treturn {\n\t\t\t\t\tid: 'IDLE',\n\t\t\t\t};\n\t\t\t}\n\t\t\tbreak;\n\t}\n\treturn state;\n}\nconst customGradientBarReducerInitialState = { id: 'IDLE' };\n\nexport default function CustomGradientBar( {\n\tbackground,\n\thasGradient,\n\tvalue: controlPoints,\n\tonChange,\n\tdisableInserter = false,\n\tdisableAlpha = false,\n} ) {\n\tconst gradientPickerDomRef = useRef();\n\n\tconst [ gradientBarState, gradientBarStateDispatch ] = useReducer(\n\t\tcustomGradientBarReducer,\n\t\tcustomGradientBarReducerInitialState\n\t);\n\tconst onMouseEnterAndMove = ( event ) => {\n\t\tconst insertPosition = getHorizontalRelativeGradientPosition(\n\t\t\tevent.clientX,\n\t\t\tgradientPickerDomRef.current,\n\t\t\tINSERT_POINT_WIDTH\n\t\t);\n\n\t\t// If the insert point is close to an existing control point don't show it.\n\t\tif (\n\t\t\tsome( controlPoints, ( { position } ) => {\n\t\t\t\treturn (\n\t\t\t\t\tMath.abs( insertPosition - position ) <\n\t\t\t\t\tMINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT\n\t\t\t\t);\n\t\t\t} )\n\t\t) {\n\t\t\tif ( gradientBarState.id === 'MOVING_INSERTER' ) {\n\t\t\t\tgradientBarStateDispatch( { type: 'STOP_INSERTER_MOVE' } );\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tgradientBarStateDispatch( { type: 'MOVE_INSERTER', insertPosition } );\n\t};\n\n\tconst onMouseLeave = () => {\n\t\tgradientBarStateDispatch( { type: 'STOP_INSERTER_MOVE' } );\n\t};\n\n\tconst isMovingInserter = gradientBarState.id === 'MOVING_INSERTER';\n\tconst isInsertingControlPoint =\n\t\tgradientBarState.id === 'INSERTING_CONTROL_POINT';\n\n\treturn (\n\t\t<div\n\t\t\tref={ gradientPickerDomRef }\n\t\t\tclassName={ classnames(\n\t\t\t\t'components-custom-gradient-picker__gradient-bar',\n\t\t\t\t{ 'has-gradient': hasGradient }\n\t\t\t) }\n\t\t\tonMouseEnter={ onMouseEnterAndMove }\n\t\t\tonMouseMove={ onMouseEnterAndMove }\n\t\t\tstyle={ { background } }\n\t\t\tonMouseLeave={ onMouseLeave }\n\t\t>\n\t\t\t<div className=\"components-custom-gradient-picker__markers-container\">\n\t\t\t\t{ ! disableInserter &&\n\t\t\t\t\t( isMovingInserter || isInsertingControlPoint ) && (\n\t\t\t\t\t\t<ControlPoints.InsertPoint\n\t\t\t\t\t\t\tdisableAlpha={ disableAlpha }\n\t\t\t\t\t\t\tinsertPosition={ gradientBarState.insertPosition }\n\t\t\t\t\t\t\tvalue={ controlPoints }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\tonOpenInserter={ () => {\n\t\t\t\t\t\t\t\tgradientBarStateDispatch( {\n\t\t\t\t\t\t\t\t\ttype: 'OPEN_INSERTER',\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonCloseInserter={ () => {\n\t\t\t\t\t\t\t\tgradientBarStateDispatch( {\n\t\t\t\t\t\t\t\t\ttype: 'CLOSE_INSERTER',\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<ControlPoints\n\t\t\t\t\tdisableAlpha={ disableAlpha }\n\t\t\t\t\tdisableRemove={ disableInserter }\n\t\t\t\t\tgradientPickerDomRef={ gradientPickerDomRef }\n\t\t\t\t\tignoreMarkerPosition={\n\t\t\t\t\t\tisInsertingControlPoint\n\t\t\t\t\t\t\t? gradientBarState.insertPosition\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t\tvalue={ controlPoints }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\tonStartControlPointChange={ () => {\n\t\t\t\t\t\tgradientBarStateDispatch( {\n\t\t\t\t\t\t\ttype: 'START_CONTROL_CHANGE',\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tonStopControlPointChange={ () => {\n\t\t\t\t\t\tgradientBarStateDispatch( {\n\t\t\t\t\t\t\ttype: 'STOP_CONTROL_CHANGE',\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"]}
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.addControlPoint = addControlPoint;
|
|
6
7
|
exports.clampPercent = clampPercent;
|
|
8
|
+
exports.getHorizontalRelativeGradientPosition = getHorizontalRelativeGradientPosition;
|
|
7
9
|
exports.isOverlapping = isOverlapping;
|
|
8
|
-
exports.addControlPoint = addControlPoint;
|
|
9
10
|
exports.removeControlPoint = removeControlPoint;
|
|
10
11
|
exports.updateControlPoint = updateControlPoint;
|
|
11
|
-
exports.updateControlPointPosition = updateControlPointPosition;
|
|
12
12
|
exports.updateControlPointColor = updateControlPointColor;
|
|
13
13
|
exports.updateControlPointColorByPosition = updateControlPointColorByPosition;
|
|
14
|
-
exports.
|
|
14
|
+
exports.updateControlPointPosition = updateControlPointPosition;
|
|
15
15
|
|
|
16
16
|
var _constants = require("./constants");
|
|
17
17
|
|
|
@@ -59,13 +59,15 @@ function clampPercent(value) {
|
|
|
59
59
|
*/
|
|
60
60
|
|
|
61
61
|
|
|
62
|
-
function isOverlapping(value, initialIndex, newPosition
|
|
62
|
+
function isOverlapping(value, initialIndex, newPosition) {
|
|
63
|
+
let minDistance = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : _constants.MINIMUM_DISTANCE_BETWEEN_POINTS;
|
|
63
64
|
const initialPosition = value[initialIndex].position;
|
|
64
65
|
const minPosition = Math.min(initialPosition, newPosition);
|
|
65
66
|
const maxPosition = Math.max(initialPosition, newPosition);
|
|
66
|
-
return value.some(({
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
return value.some((_ref, index) => {
|
|
68
|
+
let {
|
|
69
|
+
position
|
|
70
|
+
} = _ref;
|
|
69
71
|
return index !== initialIndex && (Math.abs(position - newPosition) < minDistance || minPosition < position && position < maxPosition);
|
|
70
72
|
});
|
|
71
73
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/custom-gradient-bar/utils.js"],"names":["clampPercent","value","Math","max","min","isOverlapping","initialIndex","newPosition","minDistance","MINIMUM_DISTANCE_BETWEEN_POINTS","initialPosition","position","minPosition","maxPosition","some","index","abs","addControlPoint","points","color","nextIndex","findIndex","point","newPoint","newPoints","slice","splice","removeControlPoint","filter","pointIndex","updateControlPoint","newValue","updateControlPointPosition","updateControlPointColor","newColor","updateControlPointColorByPosition","getHorizontalRelativeGradientPosition","mouseXCoordinate","containerElement","positionedElementWidth","x","width","getBoundingClientRect","absolutePositionValue","MINIMUM_ABSOLUTE_LEFT_POSITION","availableWidth","INSERT_POINT_WIDTH","round"],"mappings":";;;;;;;;;;;;;;;AAGA;;AAHA;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,YAAT,CAAuBC,KAAvB,EAA+B;AACrC,SAAOC,IAAI,CAACC,GAAL,CAAU,CAAV,EAAaD,IAAI,CAACE,GAAL,CAAU,GAAV,EAAeH,KAAf,CAAb,CAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASI,aAAT,CACNJ,KADM,EAENK,YAFM,EAGNC,WAHM,EAINC,WAAW,GAAGC,0CAJR,EAKL;AACD,QAAMC,eAAe,GAAGT,KAAK,CAAEK,YAAF,CAAL,CAAsBK,QAA9C;AACA,QAAMC,WAAW,GAAGV,IAAI,CAACE,GAAL,CAAUM,eAAV,EAA2BH,WAA3B,CAApB;AACA,QAAMM,WAAW,GAAGX,IAAI,CAACC,GAAL,CAAUO,eAAV,EAA2BH,WAA3B,CAApB;AAEA,SAAON,KAAK,CAACa,IAAN,CAAY,CAAE;AAAEH,IAAAA;AAAF,GAAF,EAAgBI,KAAhB,KAA2B;AAC7C,WACCA,KAAK,KAAKT,YAAV,KACEJ,IAAI,CAACc,GAAL,CAAUL,QAAQ,GAAGJ,WAArB,IAAqCC,WAArC,IACCI,WAAW,GAAGD,QAAd,IAA0BA,QAAQ,GAAGE,WAFxC,CADD;AAKA,GANM,CAAP;AAOA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASI,eAAT,CAA0BC,MAA1B,EAAkCP,QAAlC,EAA4CQ,KAA5C,EAAoD;AAC1D,QAAMC,SAAS,GAAGF,MAAM,CAACG,S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SAASU,uBAAT,CAAkCf,MAAlC,EAA0CH,KAA1C,EAAiDmB,QAAjD,EAA4D;AAClE,QAAMX,QAAQ,GAAG,EAChB,GAAGL,MAAM,CAAEH,KAAF,CADO;AAEhBI,IAAAA,KAAK,EAAEe;AAFS,GAAjB;AAIA,SAAOJ,kBAAkB,CAAEZ,MAAF,EAAUH,KAAV,EAAiBQ,QAAjB,CAAzB;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASY,iCAAT,CACNjB,MADM,EAENP,QAFM,EAGNuB,QAHM,EAIL;AACD,QAAMnB,KAAK,GAAGG,MAAM,CAACG,SAAP,CAAoBC,KAAF,IAAaA,KAAK,CAACX,QAAN,KAAmBA,QAAlD,CAAd;AACA,SAAOsB,uBAAuB,CAAEf,MAAF,EAAUH,KAAV,EAAiBmB,QAAjB,CAA9B;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASE,qCAAT,CACNC,gBADM,EAENC,gBAFM,EAGNC,sBAHM,EAIL;AACD,MAAK,CAAED,gBAAP,EAA0B;AACzB;AACA;;AACD,QAAM;AAAEE,IAAAA,CAAF;AAAKC,IAAAA;AAAL,MAAeH,gBAAgB,CAACI,qBAAjB,EAArB;AACA,QAAMC,qBAAqB,GAC1BN,gBAAgB,GAChBG,CADA,GAEAI,yCAFA,GAGAL,sBAAsB,GAAG,CAJ1B;AAKA,QAAMM,cAAc,GACnBJ,KAAK,GAAGG,yCAAR,GAAyCE,6BAD1C;AAEA,SAAO5C,IAAI,CAAC6C,KAAL,CACN/C,YAAY,CAAI2C,qBAAqB,GAAG,GAA1B,GAAkCE,cAApC,CADN,CAAP;AAGA","sourcesContent":["/**\n * Internal dependencies\n */\nimport {\n\tMINIMUM_DISTANCE_BETWEEN_POINTS,\n\tMINIMUM_ABSOLUTE_LEFT_POSITION,\n\tINSERT_POINT_WIDTH,\n} from './constants';\n\n/**\n * Control point for the gradient bar.\n *\n * @typedef {Object} ControlPoint\n * @property {string} color Color of the control point.\n * @property {number} position Integer position of the control point as a percentage.\n */\n\n/**\n * Color as parsed from the gradient by gradient-parser.\n *\n * @typedef {Object} Color\n * @property {string} r Red component.\n * @property {string} g Green component.\n * @property {string} b Green component.\n * @property {string} [a] Optional alpha component.\n */\n\n/**\n * Clamps a number between 0 and 100.\n *\n * @param {number} value Value to clamp.\n *\n * @return {number} Value clamped between 0 and 100.\n */\nexport function clampPercent( value ) {\n\treturn Math.max( 0, Math.min( 100, value ) );\n}\n\n/**\n * Check if a control point is overlapping with another.\n *\n * @param {ControlPoint[]} value Array of control points.\n * @param {number} initialIndex Index of the position to test.\n * @param {number} newPosition New position of the control point.\n * @param {number} minDistance Distance considered to be overlapping.\n *\n * @return {boolean} True if the point is overlapping.\n */\nexport function isOverlapping(\n\tvalue,\n\tinitialIndex,\n\tnewPosition,\n\tminDistance = MINIMUM_DISTANCE_BETWEEN_POINTS\n) {\n\tconst initialPosition = value[ initialIndex ].position;\n\tconst minPosition = Math.min( initialPosition, newPosition );\n\tconst maxPosition = Math.max( initialPosition, newPosition );\n\n\treturn value.some( ( { position }, index ) => {\n\t\treturn (\n\t\t\tindex !== initialIndex &&\n\t\t\t( Math.abs( position - newPosition ) < minDistance ||\n\t\t\t\t( minPosition < position && position < maxPosition ) )\n\t\t);\n\t} );\n}\n\n/**\n * Adds a control point from an array and returns the new array.\n *\n * @param {ControlPoint[]} points Array of control points.\n * @param {number} position Position to insert the new point.\n * @param {Color} color Color to update the control point at index.\n *\n * @return {ControlPoint[]} New array of control points.\n */\nexport function addControlPoint( points, position, color ) {\n\tconst nextIndex = points.findIndex(\n\t\t( point ) => point.position > position\n\t);\n\tconst newPoint = { color, position };\n\tconst newPoints = points.slice();\n\tnewPoints.splice( nextIndex - 1, 0, newPoint );\n\treturn newPoints;\n}\n\n/**\n * Removes a control point from an array and returns the new array.\n *\n * @param {ControlPoint[]} points Array of control points.\n * @param {number} index Index to remove.\n *\n * @return {ControlPoint[]} New array of control points.\n */\nexport function removeControlPoint( points, index ) {\n\treturn points.filter( ( point, pointIndex ) => {\n\t\treturn pointIndex !== index;\n\t} );\n}\n\n/**\n * Updates a control point from an array and returns the new array.\n *\n * @param {ControlPoint[]} points Array of control points.\n * @param {number} index Index to update.\n * @param {ControlPoint[]} newPoint New control point to replace the index.\n *\n * @return {ControlPoint[]} New array of control points.\n */\nexport function updateControlPoint( points, index, newPoint ) {\n\tconst newValue = points.slice();\n\tnewValue[ index ] = newPoint;\n\treturn newValue;\n}\n\n/**\n * Updates the position of a control point from an array and returns the new array.\n *\n * @param {ControlPoint[]} points Array of control points.\n * @param {number} index Index to update.\n * @param {number} newPosition Position to move the control point at index.\n *\n * @return {ControlPoint[]} New array of control points.\n */\nexport function updateControlPointPosition( points, index, newPosition ) {\n\tif ( isOverlapping( points, index, newPosition ) ) {\n\t\treturn points;\n\t}\n\tconst newPoint = {\n\t\t...points[ index ],\n\t\tposition: newPosition,\n\t};\n\treturn updateControlPoint( points, index, newPoint );\n}\n\n/**\n * Updates the position of a control point from an array and returns the new array.\n *\n * @param {ControlPoint[]} points Array of control points.\n * @param {number} index Index to update.\n * @param {Color} newColor Color to update the control point at index.\n *\n * @return {ControlPoint[]} New array of control points.\n */\nexport function updateControlPointColor( points, index, newColor ) {\n\tconst newPoint = {\n\t\t...points[ index ],\n\t\tcolor: newColor,\n\t};\n\treturn updateControlPoint( points, index, newPoint );\n}\n\n/**\n * Updates the position of a control point from an array and returns the new array.\n *\n * @param {ControlPoint[]} points Array of control points.\n * @param {number} position Position of the color stop.\n * @param {string} newColor Color to update the control point at index.\n *\n * @return {ControlPoint[]} New array of control points.\n */\nexport function updateControlPointColorByPosition(\n\tpoints,\n\tposition,\n\tnewColor\n) {\n\tconst index = points.findIndex( ( point ) => point.position === position );\n\treturn updateControlPointColor( points, index, newColor );\n}\n\n/**\n * Gets the horizontal coordinate when dragging a control point with the mouse.\n *\n * @param {number} mouseXCoordinate Horizontal coordinate of the mouse position.\n * @param {Element} containerElement Container for the gradient picker.\n * @param {number} positionedElementWidth Width of the positioned element.\n *\n * @return {number} Whole number percentage from the left.\n */\nexport function getHorizontalRelativeGradientPosition(\n\tmouseXCoordinate,\n\tcontainerElement,\n\tpositionedElementWidth\n) {\n\tif ( ! containerElement ) {\n\t\treturn;\n\t}\n\tconst { x, width } = containerElement.getBoundingClientRect();\n\tconst absolutePositionValue =\n\t\tmouseXCoordinate -\n\t\tx -\n\t\tMINIMUM_ABSOLUTE_LEFT_POSITION -\n\t\tpositionedElementWidth / 2;\n\tconst availableWidth =\n\t\twidth - MINIMUM_ABSOLUTE_LEFT_POSITION - INSERT_POINT_WIDTH;\n\treturn Math.round(\n\t\tclampPercent( ( absolutePositionValue * 100 ) / availableWidth )\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/custom-gradient-bar/utils.js"],"names":["clampPercent","value","Math","max","min","isOverlapping","initialIndex","newPosition","minDistance","MINIMUM_DISTANCE_BETWEEN_POINTS","initialPosition","position","minPosition","maxPosition","some","index","abs","addControlPoint","points","color","nextIndex","findIndex","point","newPoint","newPoints","slice","splice","removeControlPoint","filter","pointIndex","updateControlPoint","newValue","updateControlPointPosition","updateControlPointColor","newColor","updateControlPointColorByPosition","getHorizontalRelativeGradientPosition","mouseXCoordinate","containerElement","positionedElementWidth","x","width","getBoundingClientRect","absolutePositionValue","MINIMUM_ABSOLUTE_LEFT_POSITION","availableWidth","INSERT_POINT_WIDTH","round"],"mappings":";;;;;;;;;;;;;;;AAGA;;AAHA;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,YAAT,CAAuBC,KAAvB,EAA+B;AACrC,SAAOC,IAAI,CAACC,GAAL,CAAU,CAAV,EAAaD,IAAI,CAACE,GAAL,CAAU,GAAV,EAAeH,KAAf,CAAb,CAAP;AACA;AAED;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AAK,CAACX,QAAN,KAAmBA,QAAlD,CAAd;AACA,SAAOsB,uBAAuB,CAAEf,MAAF,EAAUH,KAAV,EAAiBmB,QAAjB,CAA9B;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASE,qCAAT,CACNC,gBADM,EAENC,gBAFM,EAGNC,sBAHM,EAIL;AACD,MAAK,CAAED,gBAAP,EAA0B;AACzB;AACA;;AACD,QAAM;AAAEE,IAAAA,CAAF;AAAKC,IAAAA;AAAL,MAAeH,gBAAgB,CAACI,qBAAjB,EAArB;AACA,QAAMC,qBAAqB,GAC1BN,gBAAgB,GAChBG,CADA,GAEAI,yCAFA,GAGAL,sBAAsB,GAAG,CAJ1B;AAKA,QAAMM,cAAc,GACnBJ,KAAK,GAAGG,yCAAR,GAAyCE,6BAD1C;AAEA,SAAO5C,IAAI,CAAC6C,KAAL,CACN/C,YAAY,CAAI2C,qBAAqB,GAAG,GAA1B,GAAkCE,cAApC,CADN,CAAP;AAGA","sourcesContent":["/**\n * Internal dependencies\n */\nimport {\n\tMINIMUM_DISTANCE_BETWEEN_POINTS,\n\tMINIMUM_ABSOLUTE_LEFT_POSITION,\n\tINSERT_POINT_WIDTH,\n} from './constants';\n\n/**\n * Control point for the gradient bar.\n *\n * @typedef {Object} ControlPoint\n * @property {string} color Color of the control point.\n * @property {number} position Integer position of the control point as a percentage.\n */\n\n/**\n * Color as parsed from the gradient by gradient-parser.\n *\n * @typedef {Object} Color\n * @property {string} r Red component.\n * @property {string} g Green component.\n * @property {string} b Green component.\n * @property {string} [a] Optional alpha component.\n */\n\n/**\n * Clamps a number between 0 and 100.\n *\n * @param {number} value Value to clamp.\n *\n * @return {number} Value clamped between 0 and 100.\n */\nexport function clampPercent( value ) {\n\treturn Math.max( 0, Math.min( 100, value ) );\n}\n\n/**\n * Check if a control point is overlapping with another.\n *\n * @param {ControlPoint[]} value Array of control points.\n * @param {number} initialIndex Index of the position to test.\n * @param {number} newPosition New position of the control point.\n * @param {number} minDistance Distance considered to be overlapping.\n *\n * @return {boolean} True if the point is overlapping.\n */\nexport function isOverlapping(\n\tvalue,\n\tinitialIndex,\n\tnewPosition,\n\tminDistance = MINIMUM_DISTANCE_BETWEEN_POINTS\n) {\n\tconst initialPosition = value[ initialIndex ].position;\n\tconst minPosition = Math.min( initialPosition, newPosition );\n\tconst maxPosition = Math.max( initialPosition, newPosition );\n\n\treturn value.some( ( { position }, index ) => {\n\t\treturn (\n\t\t\tindex !== initialIndex &&\n\t\t\t( Math.abs( position - newPosition ) < minDistance ||\n\t\t\t\t( minPosition < position && position < maxPosition ) )\n\t\t);\n\t} );\n}\n\n/**\n * Adds a control point from an array and returns the new array.\n *\n * @param {ControlPoint[]} points Array of control points.\n * @param {number} position Position to insert the new point.\n * @param {Color} color Color to update the control point at index.\n *\n * @return {ControlPoint[]} New array of control points.\n */\nexport function addControlPoint( points, position, color ) {\n\tconst nextIndex = points.findIndex(\n\t\t( point ) => point.position > position\n\t);\n\tconst newPoint = { color, position };\n\tconst newPoints = points.slice();\n\tnewPoints.splice( nextIndex - 1, 0, newPoint );\n\treturn newPoints;\n}\n\n/**\n * Removes a control point from an array and returns the new array.\n *\n * @param {ControlPoint[]} points Array of control points.\n * @param {number} index Index to remove.\n *\n * @return {ControlPoint[]} New array of control points.\n */\nexport function removeControlPoint( points, index ) {\n\treturn points.filter( ( point, pointIndex ) => {\n\t\treturn pointIndex !== index;\n\t} );\n}\n\n/**\n * Updates a control point from an array and returns the new array.\n *\n * @param {ControlPoint[]} points Array of control points.\n * @param {number} index Index to update.\n * @param {ControlPoint[]} newPoint New control point to replace the index.\n *\n * @return {ControlPoint[]} New array of control points.\n */\nexport function updateControlPoint( points, index, newPoint ) {\n\tconst newValue = points.slice();\n\tnewValue[ index ] = newPoint;\n\treturn newValue;\n}\n\n/**\n * Updates the position of a control point from an array and returns the new array.\n *\n * @param {ControlPoint[]} points Array of control points.\n * @param {number} index Index to update.\n * @param {number} newPosition Position to move the control point at index.\n *\n * @return {ControlPoint[]} New array of control points.\n */\nexport function updateControlPointPosition( points, index, newPosition ) {\n\tif ( isOverlapping( points, index, newPosition ) ) {\n\t\treturn points;\n\t}\n\tconst newPoint = {\n\t\t...points[ index ],\n\t\tposition: newPosition,\n\t};\n\treturn updateControlPoint( points, index, newPoint );\n}\n\n/**\n * Updates the position of a control point from an array and returns the new array.\n *\n * @param {ControlPoint[]} points Array of control points.\n * @param {number} index Index to update.\n * @param {Color} newColor Color to update the control point at index.\n *\n * @return {ControlPoint[]} New array of control points.\n */\nexport function updateControlPointColor( points, index, newColor ) {\n\tconst newPoint = {\n\t\t...points[ index ],\n\t\tcolor: newColor,\n\t};\n\treturn updateControlPoint( points, index, newPoint );\n}\n\n/**\n * Updates the position of a control point from an array and returns the new array.\n *\n * @param {ControlPoint[]} points Array of control points.\n * @param {number} position Position of the color stop.\n * @param {string} newColor Color to update the control point at index.\n *\n * @return {ControlPoint[]} New array of control points.\n */\nexport function updateControlPointColorByPosition(\n\tpoints,\n\tposition,\n\tnewColor\n) {\n\tconst index = points.findIndex( ( point ) => point.position === position );\n\treturn updateControlPointColor( points, index, newColor );\n}\n\n/**\n * Gets the horizontal coordinate when dragging a control point with the mouse.\n *\n * @param {number} mouseXCoordinate Horizontal coordinate of the mouse position.\n * @param {Element} containerElement Container for the gradient picker.\n * @param {number} positionedElementWidth Width of the positioned element.\n *\n * @return {number} Whole number percentage from the left.\n */\nexport function getHorizontalRelativeGradientPosition(\n\tmouseXCoordinate,\n\tcontainerElement,\n\tpositionedElementWidth\n) {\n\tif ( ! containerElement ) {\n\t\treturn;\n\t}\n\tconst { x, width } = containerElement.getBoundingClientRect();\n\tconst absolutePositionValue =\n\t\tmouseXCoordinate -\n\t\tx -\n\t\tMINIMUM_ABSOLUTE_LEFT_POSITION -\n\t\tpositionedElementWidth / 2;\n\tconst availableWidth =\n\t\twidth - MINIMUM_ABSOLUTE_LEFT_POSITION - INSERT_POINT_WIDTH;\n\treturn Math.round(\n\t\tclampPercent( ( absolutePositionValue * 100 ) / availableWidth )\n\t);\n}\n"]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.HORIZONTAL_GRADIENT_ORIENTATION = exports.GRADIENT_OPTIONS = exports.DIRECTIONAL_ORIENTATION_ANGLE_MAP = exports.DEFAULT_LINEAR_GRADIENT_ANGLE = exports.DEFAULT_GRADIENT = void 0;
|
|
7
7
|
|
|
8
8
|
var _i18n = require("@wordpress/i18n");
|
|
9
9
|
|
|
@@ -40,11 +40,12 @@ var _customGradientPickerStyles = require("./styles/custom-gradient-picker-style
|
|
|
40
40
|
/**
|
|
41
41
|
* Internal dependencies
|
|
42
42
|
*/
|
|
43
|
-
const GradientAnglePicker =
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
const GradientAnglePicker = _ref => {
|
|
44
|
+
let {
|
|
45
|
+
gradientAST,
|
|
46
|
+
hasGradient,
|
|
47
|
+
onChange
|
|
48
|
+
} = _ref;
|
|
48
49
|
const angle = (0, _lodash.get)(gradientAST, ['orientation', 'value'], _constants.DEFAULT_LINEAR_GRADIENT_ANGLE);
|
|
49
50
|
|
|
50
51
|
const onAngleChange = newAngle => {
|
|
@@ -63,11 +64,12 @@ const GradientAnglePicker = ({
|
|
|
63
64
|
});
|
|
64
65
|
};
|
|
65
66
|
|
|
66
|
-
const GradientTypePicker =
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
const GradientTypePicker = _ref2 => {
|
|
68
|
+
let {
|
|
69
|
+
gradientAST,
|
|
70
|
+
hasGradient,
|
|
71
|
+
onChange
|
|
72
|
+
} = _ref2;
|
|
71
73
|
const {
|
|
72
74
|
type
|
|
73
75
|
} = gradientAST;
|
|
@@ -107,10 +109,11 @@ const GradientTypePicker = ({
|
|
|
107
109
|
});
|
|
108
110
|
};
|
|
109
111
|
|
|
110
|
-
function CustomGradientPicker({
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
function CustomGradientPicker(_ref3) {
|
|
113
|
+
let {
|
|
114
|
+
value,
|
|
115
|
+
onChange
|
|
116
|
+
} = _ref3;
|
|
114
117
|
const gradientAST = (0, _utils.getGradientAstWithDefault)(value); // On radial gradients the bar should display a linear gradient.
|
|
115
118
|
// On radial gradients the bar represents a slice of the gradient from the center until the outside.
|
|
116
119
|
// On liner gradients the bar represents the color stops from left to right independently of the angle.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/custom-gradient-picker/index.js"],"names":["GradientAnglePicker","gradientAST","hasGradient","onChange","angle","DEFAULT_LINEAR_GRADIENT_ANGLE","onAngleChange","newAngle","orientation","type","value","GradientTypePicker","onSetLinearGradient","HORIZONTAL_GRADIENT_ORIENTATION","onSetRadialGradient","handleOnChange","next","GRADIENT_OPTIONS","CustomGradientPicker","background","DEFAULT_GRADIENT","controlPoints","colorStops","map","colorStop","color","position","parseInt","length","newControlPoints"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAMA;;AACA;;AAMA;;AA9BA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AAuBA,MAAMA,mBAAmB,GAAG,
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/custom-gradient-picker/index.js"],"names":["GradientAnglePicker","gradientAST","hasGradient","onChange","angle","DEFAULT_LINEAR_GRADIENT_ANGLE","onAngleChange","newAngle","orientation","type","value","GradientTypePicker","onSetLinearGradient","HORIZONTAL_GRADIENT_ORIENTATION","onSetRadialGradient","handleOnChange","next","GRADIENT_OPTIONS","CustomGradientPicker","background","DEFAULT_GRADIENT","controlPoints","colorStops","map","colorStop","color","position","parseInt","length","newControlPoints"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AAKA;;AACA;;AACA;;AACA;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MAAAA,QAAQ,CACP,mCACC,4CACCF,WADD,EAEC4B,gBAFD,CADD,CADO,CAAR;AAQA;AAbF,IADD,EAgBC,4BAAC,UAAD;AACC,IAAA,GAAG,EAAG,CADP;AAEC,IAAA,SAAS,EAAC;AAFX,KAIC,4BAAC,yCAAD,QACC,4BAAC,kBAAD;AACC,IAAA,WAAW,EAAG5B,WADf;AAEC,IAAA,WAAW,EAAGC,WAFf;AAGC,IAAA,QAAQ,EAAGC;AAHZ,IADD,CAJD,EAWC,4BAAC,4CAAD,QACGF,WAAW,CAACQ,IAAZ,KAAqB,iBAArB,IACD,4BAAC,mBAAD;AACC,IAAA,WAAW,EAAGR,WADf;AAEC,IAAA,WAAW,EAAGC,WAFf;AAGC,IAAA,QAAQ,EAAGC;AAHZ,IAFF,CAXD,CAhBD,CADD;AAwCA","sourcesContent":["/**\n * External dependencies\n */\nimport { get, omit } from 'lodash';\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 '../custom-gradient-bar';\nimport { Flex } from '../flex';\nimport SelectControl from '../select-control';\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\tDEFAULT_GRADIENT,\n} from './constants';\nimport {\n\tAccessoryWrapper,\n\tSelectWrapper,\n} from './styles/custom-gradient-picker-styles';\n\nconst GradientAnglePicker = ( { gradientAST, hasGradient, onChange } ) => {\n\tconst angle = get(\n\t\tgradientAST,\n\t\t[ 'orientation', 'value' ],\n\t\tDEFAULT_LINEAR_GRADIENT_ANGLE\n\t);\n\tconst onAngleChange = ( newAngle ) => {\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\tlabelPosition=\"top\"\n\t\t\tvalue={ hasGradient ? angle : '' }\n\t\t/>\n\t);\n};\n\nconst GradientTypePicker = ( { gradientAST, hasGradient, onChange } ) => {\n\tconst { type } = gradientAST;\n\tconst onSetLinearGradient = () => {\n\t\tonChange(\n\t\t\tserializeGradient( {\n\t\t\t\t...gradientAST,\n\t\t\t\t...( gradientAST.orientation\n\t\t\t\t\t? {}\n\t\t\t\t\t: { orientation: HORIZONTAL_GRADIENT_ORIENTATION } ),\n\t\t\t\ttype: 'linear-gradient',\n\t\t\t} )\n\t\t);\n\t};\n\n\tconst onSetRadialGradient = () => {\n\t\tonChange(\n\t\t\tserializeGradient( {\n\t\t\t\t...omit( gradientAST, [ 'orientation' ] ),\n\t\t\t\ttype: 'radial-gradient',\n\t\t\t} )\n\t\t);\n\t};\n\n\tconst handleOnChange = ( next ) => {\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\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\tvalue={ hasGradient && type }\n\t\t/>\n\t);\n};\n\nexport default function CustomGradientPicker( { value, onChange } ) {\n\tconst gradientAST = getGradientAstWithDefault( value );\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\tconst hasGradient = gradientAST.value !== DEFAULT_GRADIENT;\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\tcolor: getStopCssColor( colorStop ),\n\t\tposition: parseInt( colorStop.length.value ),\n\t} ) );\n\n\treturn (\n\t\t<div className=\"components-custom-gradient-picker\">\n\t\t\t<CustomGradientBar\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</div>\n\t);\n}\n"]}
|