@wordpress/components 19.5.0 → 19.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -5
- package/build/alignment-matrix-control/utils.js +1 -1
- package/build/alignment-matrix-control/utils.js.map +1 -1
- package/build/angle-picker-control/angle-circle.js +1 -1
- package/build/angle-picker-control/angle-circle.js.map +1 -1
- package/build/animation/index.js +0 -6
- package/build/animation/index.js.map +1 -1
- package/build/autocomplete/get-default-use-items.js +3 -3
- package/build/autocomplete/get-default-use-items.js.map +1 -1
- package/build/base-field/hook.js +1 -1
- package/build/base-field/hook.js.map +1 -1
- package/build/box-control/icon.js +1 -1
- package/build/box-control/icon.js.map +1 -1
- package/build/box-control/index.js +4 -4
- package/build/box-control/index.js.map +1 -1
- package/build/box-control/utils.js +12 -8
- package/build/box-control/utils.js.map +1 -1
- package/build/button/index.js +5 -5
- package/build/button/index.js.map +1 -1
- package/build/button/index.native.js +7 -7
- package/build/button/index.native.js.map +1 -1
- package/build/color-picker/color-display.js +1 -1
- package/build/color-picker/color-display.js.map +1 -1
- package/build/color-picker/styles.js +8 -8
- package/build/color-picker/styles.js.map +1 -1
- package/build/combobox-control/index.js +1 -1
- package/build/combobox-control/index.js.map +1 -1
- package/build/confirm-dialog/component.js +4 -2
- package/build/confirm-dialog/component.js.map +1 -1
- package/build/date-time/time.js +7 -4
- package/build/date-time/time.js.map +1 -1
- package/build/divider/component.js +5 -4
- package/build/divider/component.js.map +1 -1
- package/build/draggable/index.js +3 -3
- package/build/draggable/index.js.map +1 -1
- package/build/focal-point-picker/index.native.js +7 -7
- package/build/focal-point-picker/index.native.js.map +1 -1
- package/build/focal-point-picker/tooltip/index.native.js +1 -1
- package/build/focal-point-picker/tooltip/index.native.js.map +1 -1
- package/build/font-size-picker/index.js +1 -1
- package/build/font-size-picker/index.js.map +1 -1
- package/build/form-token-field/index.js +6 -6
- package/build/form-token-field/index.js.map +1 -1
- package/build/form-token-field/suggestions-list.js +2 -2
- package/build/form-token-field/suggestions-list.js.map +1 -1
- package/build/heading/component.js +6 -5
- package/build/heading/component.js.map +1 -1
- package/build/heading/hook.js +1 -1
- package/build/heading/hook.js.map +1 -1
- package/build/higher-order/with-notices/index.js +1 -1
- package/build/higher-order/with-notices/index.js.map +1 -1
- package/build/index.js +2 -2
- package/build/index.js.map +1 -1
- package/build/index.native.js.map +1 -1
- package/build/input-control/input-base.js +1 -1
- package/build/input-control/input-base.js.map +1 -1
- package/build/input-control/input-field.js +12 -10
- package/build/input-control/input-field.js.map +1 -1
- package/build/input-control/styles/input-control-styles.js +25 -25
- package/build/input-control/styles/input-control-styles.js.map +1 -1
- package/build/isolated-event-container/index.js +1 -1
- package/build/isolated-event-container/index.js.map +1 -1
- package/build/mobile/bottom-sheet/bottom-sheet-context.native.js +4 -4
- package/build/mobile/bottom-sheet/bottom-sheet-context.native.js.map +1 -1
- package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +1 -1
- package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js.map +1 -1
- package/build/mobile/bottom-sheet/cell.native.js +1 -1
- package/build/mobile/bottom-sheet/cell.native.js.map +1 -1
- package/build/mobile/bottom-sheet/index.native.js +11 -11
- package/build/mobile/bottom-sheet/index.native.js.map +1 -1
- package/build/mobile/bottom-sheet/link-cell.native.js +1 -1
- package/build/mobile/bottom-sheet/link-cell.native.js.map +1 -1
- package/build/mobile/bottom-sheet/link-suggestion-item-cell.native.js +1 -1
- package/build/mobile/bottom-sheet/link-suggestion-item-cell.native.js.map +1 -1
- package/build/mobile/bottom-sheet/nav-bar/back-button.native.js +1 -1
- package/build/mobile/bottom-sheet/nav-bar/back-button.native.js.map +1 -1
- package/build/mobile/global-styles-context/utils.native.js +10 -10
- package/build/mobile/global-styles-context/utils.native.js.map +1 -1
- package/build/mobile/gradient/index.native.js +2 -2
- package/build/mobile/gradient/index.native.js.map +1 -1
- package/build/mobile/html-text-input/container.ios.js +3 -3
- package/build/mobile/html-text-input/container.ios.js.map +1 -1
- package/build/mobile/html-text-input/index.native.js +1 -1
- package/build/mobile/html-text-input/index.native.js.map +1 -1
- package/build/mobile/image/index.native.js +1 -1
- package/build/mobile/image/index.native.js.map +1 -1
- package/build/mobile/keyboard-aware-flat-list/index.android.js +1 -1
- package/build/mobile/keyboard-aware-flat-list/index.android.js.map +1 -1
- package/build/mobile/keyboard-aware-flat-list/index.ios.js +2 -2
- package/build/mobile/keyboard-aware-flat-list/index.ios.js.map +1 -1
- package/build/mobile/link-picker/index.native.js +3 -3
- package/build/mobile/link-picker/index.native.js.map +1 -1
- package/build/mobile/link-picker/link-picker-results.native.js +8 -8
- package/build/mobile/link-picker/link-picker-results.native.js.map +1 -1
- package/build/mobile/link-settings/image-link-destinations-screen.native.js +2 -2
- package/build/mobile/link-settings/image-link-destinations-screen.native.js.map +1 -1
- package/build/mobile/link-settings/index.native.js +1 -1
- package/build/mobile/link-settings/index.native.js.map +1 -1
- package/build/modal/aria-helper.js +1 -1
- package/build/modal/aria-helper.js.map +1 -1
- package/build/modal/index.js +2 -2
- package/build/modal/index.js.map +1 -1
- package/build/navigable-container/container.js +2 -2
- package/build/navigable-container/container.js.map +1 -1
- package/build/navigable-container/tabbable.js +1 -1
- package/build/navigable-container/tabbable.js.map +1 -1
- package/build/navigation/item/index.js +1 -1
- package/build/navigation/item/index.js.map +1 -1
- package/build/navigation/menu/index.js +1 -1
- package/build/navigation/menu/index.js.map +1 -1
- package/build/navigator/navigator-provider/component.js +2 -2
- package/build/navigator/navigator-provider/component.js.map +1 -1
- package/build/navigator/navigator-screen/component.js +1 -1
- package/build/navigator/navigator-screen/component.js.map +1 -1
- package/build/number-control/index.js +1 -1
- package/build/number-control/index.js.map +1 -1
- package/build/panel/body.js +2 -2
- package/build/panel/body.js.map +1 -1
- package/build/popover/index.js +3 -3
- package/build/popover/index.js.map +1 -1
- package/build/popover/utils.js +6 -6
- package/build/popover/utils.js.map +1 -1
- package/build/radio-group/index.js +1 -1
- package/build/radio-group/index.js.map +1 -1
- package/build/range-control/styles/range-control-styles.js +29 -29
- package/build/range-control/styles/range-control-styles.js.map +1 -1
- package/build/sandbox/index.js +5 -5
- package/build/sandbox/index.js.map +1 -1
- package/build/sandbox/index.native.js +1 -1
- package/build/sandbox/index.native.js.map +1 -1
- package/build/select-control/index.js +1 -1
- package/build/select-control/index.js.map +1 -1
- package/build/select-control/styles/select-control-styles.js +5 -5
- package/build/select-control/styles/select-control-styles.js.map +1 -1
- package/build/slot-fill/bubbles-virtually/slot-fill-provider.js +1 -1
- package/build/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
- package/build/slot-fill/bubbles-virtually/slot.js +1 -1
- package/build/slot-fill/bubbles-virtually/slot.js.map +1 -1
- package/build/slot-fill/fill.js +1 -1
- package/build/slot-fill/fill.js.map +1 -1
- package/build/slot-fill/provider.js +1 -1
- package/build/slot-fill/provider.js.map +1 -1
- package/build/snackbar/index.js +1 -1
- package/build/snackbar/index.js.map +1 -1
- package/build/snackbar/list.js +1 -1
- package/build/snackbar/list.js.map +1 -1
- package/build/style-provider/index.js +2 -2
- package/build/style-provider/index.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/component.js +2 -2
- package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control-option/component.js +1 -4
- 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 +12 -19
- package/build/toggle-group-control/toggle-group-control-option/styles.js.map +1 -1
- package/build/toolbar/index.js +1 -1
- package/build/toolbar/index.js.map +1 -1
- package/build/tooltip/index.js +3 -3
- package/build/tooltip/index.js.map +1 -1
- package/build/tooltip/index.native.js +7 -7
- package/build/tooltip/index.native.js.map +1 -1
- package/build/tree-grid/index.js +4 -1
- package/build/tree-grid/index.js.map +1 -1
- package/build/truncate/utils.js +1 -1
- package/build/truncate/utils.js.map +1 -1
- package/build/ui/context/context-connect.js +8 -15
- package/build/ui/context/context-connect.js.map +1 -1
- package/build/ui/context/context-system-provider.js +2 -2
- package/build/ui/context/context-system-provider.js.map +1 -1
- package/build/ui/context/index.js.map +1 -1
- package/build/ui/utils/colors.js +2 -2
- package/build/ui/utils/colors.js.map +1 -1
- package/build/ui/utils/space.js +2 -2
- package/build/ui/utils/space.js.map +1 -1
- package/build/unit-control/index.js +38 -29
- package/build/unit-control/index.js.map +1 -1
- package/build/unit-control/index.native.js +4 -2
- package/build/unit-control/index.native.js.map +1 -1
- package/build/unit-control/unit-select-control.js +1 -1
- package/build/unit-control/unit-select-control.js.map +1 -1
- package/build/unit-control/utils.js +96 -104
- package/build/unit-control/utils.js.map +1 -1
- package/build/utils/breakpoint-values.js +1 -1
- package/build/utils/breakpoint-values.js.map +1 -1
- package/build/utils/colors-values.js +1 -1
- package/build/utils/colors-values.js.map +1 -1
- package/build-module/alignment-matrix-control/utils.js +1 -1
- package/build-module/alignment-matrix-control/utils.js.map +1 -1
- package/build-module/angle-picker-control/angle-circle.js +1 -1
- package/build-module/angle-picker-control/angle-circle.js.map +1 -1
- package/build-module/animation/index.js +1 -1
- package/build-module/animation/index.js.map +1 -1
- package/build-module/autocomplete/get-default-use-items.js +3 -3
- package/build-module/autocomplete/get-default-use-items.js.map +1 -1
- package/build-module/base-field/hook.js +1 -1
- package/build-module/base-field/hook.js.map +1 -1
- package/build-module/box-control/icon.js +1 -1
- package/build-module/box-control/icon.js.map +1 -1
- package/build-module/box-control/index.js +5 -5
- package/build-module/box-control/index.js.map +1 -1
- package/build-module/box-control/utils.js +13 -9
- package/build-module/box-control/utils.js.map +1 -1
- package/build-module/button/index.js +5 -5
- package/build-module/button/index.js.map +1 -1
- package/build-module/button/index.native.js +7 -7
- package/build-module/button/index.native.js.map +1 -1
- package/build-module/color-picker/color-display.js +1 -1
- package/build-module/color-picker/color-display.js.map +1 -1
- package/build-module/color-picker/styles.js +8 -8
- package/build-module/color-picker/styles.js.map +1 -1
- package/build-module/combobox-control/index.js +1 -1
- package/build-module/combobox-control/index.js.map +1 -1
- package/build-module/confirm-dialog/component.js +4 -5
- package/build-module/confirm-dialog/component.js.map +1 -1
- package/build-module/date-time/time.js +7 -4
- package/build-module/date-time/time.js.map +1 -1
- package/build-module/divider/component.js +3 -3
- package/build-module/divider/component.js.map +1 -1
- package/build-module/draggable/index.js +3 -3
- package/build-module/draggable/index.js.map +1 -1
- package/build-module/focal-point-picker/index.native.js +7 -7
- package/build-module/focal-point-picker/index.native.js.map +1 -1
- package/build-module/focal-point-picker/tooltip/index.native.js +1 -1
- package/build-module/focal-point-picker/tooltip/index.native.js.map +1 -1
- package/build-module/font-size-picker/index.js +1 -1
- package/build-module/font-size-picker/index.js.map +1 -1
- package/build-module/form-token-field/index.js +6 -6
- package/build-module/form-token-field/index.js.map +1 -1
- package/build-module/form-token-field/suggestions-list.js +2 -2
- package/build-module/form-token-field/suggestions-list.js.map +1 -1
- package/build-module/heading/component.js +4 -4
- package/build-module/heading/component.js.map +1 -1
- package/build-module/heading/hook.js +1 -1
- package/build-module/heading/hook.js.map +1 -1
- package/build-module/higher-order/with-notices/index.js +1 -1
- package/build-module/higher-order/with-notices/index.js.map +1 -1
- package/build-module/index.js +4 -4
- package/build-module/index.js.map +1 -1
- package/build-module/index.native.js +4 -4
- package/build-module/index.native.js.map +1 -1
- package/build-module/input-control/input-base.js +1 -1
- package/build-module/input-control/input-base.js.map +1 -1
- package/build-module/input-control/input-field.js +13 -10
- package/build-module/input-control/input-field.js.map +1 -1
- package/build-module/input-control/styles/input-control-styles.js +25 -25
- package/build-module/input-control/styles/input-control-styles.js.map +1 -1
- package/build-module/isolated-event-container/index.js +1 -1
- package/build-module/isolated-event-container/index.js.map +1 -1
- package/build-module/mobile/bottom-sheet/bottom-sheet-context.native.js +4 -4
- package/build-module/mobile/bottom-sheet/bottom-sheet-context.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +1 -1
- package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/cell.native.js +1 -1
- package/build-module/mobile/bottom-sheet/cell.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/index.native.js +11 -11
- package/build-module/mobile/bottom-sheet/index.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/link-cell.native.js +1 -1
- 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 +1 -1
- package/build-module/mobile/bottom-sheet/link-suggestion-item-cell.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/nav-bar/back-button.native.js +1 -1
- package/build-module/mobile/bottom-sheet/nav-bar/back-button.native.js.map +1 -1
- package/build-module/mobile/global-styles-context/utils.native.js +10 -10
- package/build-module/mobile/global-styles-context/utils.native.js.map +1 -1
- package/build-module/mobile/gradient/index.native.js +2 -2
- package/build-module/mobile/gradient/index.native.js.map +1 -1
- package/build-module/mobile/html-text-input/container.ios.js +3 -3
- package/build-module/mobile/html-text-input/container.ios.js.map +1 -1
- package/build-module/mobile/html-text-input/index.native.js +1 -1
- package/build-module/mobile/html-text-input/index.native.js.map +1 -1
- package/build-module/mobile/image/index.native.js +1 -1
- package/build-module/mobile/image/index.native.js.map +1 -1
- package/build-module/mobile/keyboard-aware-flat-list/index.android.js +1 -1
- package/build-module/mobile/keyboard-aware-flat-list/index.android.js.map +1 -1
- package/build-module/mobile/keyboard-aware-flat-list/index.ios.js +2 -2
- package/build-module/mobile/keyboard-aware-flat-list/index.ios.js.map +1 -1
- package/build-module/mobile/link-picker/index.native.js +3 -3
- package/build-module/mobile/link-picker/index.native.js.map +1 -1
- package/build-module/mobile/link-picker/link-picker-results.native.js +8 -8
- package/build-module/mobile/link-picker/link-picker-results.native.js.map +1 -1
- package/build-module/mobile/link-settings/image-link-destinations-screen.native.js +2 -2
- package/build-module/mobile/link-settings/image-link-destinations-screen.native.js.map +1 -1
- package/build-module/mobile/link-settings/index.native.js +1 -1
- package/build-module/mobile/link-settings/index.native.js.map +1 -1
- package/build-module/modal/aria-helper.js +1 -1
- package/build-module/modal/aria-helper.js.map +1 -1
- package/build-module/modal/index.js +2 -2
- package/build-module/modal/index.js.map +1 -1
- package/build-module/navigable-container/container.js +2 -2
- package/build-module/navigable-container/container.js.map +1 -1
- package/build-module/navigable-container/tabbable.js +1 -1
- package/build-module/navigable-container/tabbable.js.map +1 -1
- package/build-module/navigation/item/index.js +1 -1
- package/build-module/navigation/item/index.js.map +1 -1
- package/build-module/navigation/menu/index.js +1 -1
- package/build-module/navigation/menu/index.js.map +1 -1
- package/build-module/navigator/navigator-provider/component.js +2 -2
- package/build-module/navigator/navigator-provider/component.js.map +1 -1
- package/build-module/navigator/navigator-screen/component.js +1 -1
- package/build-module/navigator/navigator-screen/component.js.map +1 -1
- package/build-module/number-control/index.js +1 -1
- package/build-module/number-control/index.js.map +1 -1
- package/build-module/panel/body.js +2 -2
- package/build-module/panel/body.js.map +1 -1
- package/build-module/popover/index.js +3 -3
- package/build-module/popover/index.js.map +1 -1
- package/build-module/popover/utils.js +6 -6
- package/build-module/popover/utils.js.map +1 -1
- package/build-module/radio-group/index.js +1 -1
- package/build-module/radio-group/index.js.map +1 -1
- package/build-module/range-control/styles/range-control-styles.js +29 -29
- package/build-module/range-control/styles/range-control-styles.js.map +1 -1
- package/build-module/sandbox/index.js +5 -5
- package/build-module/sandbox/index.js.map +1 -1
- package/build-module/sandbox/index.native.js +1 -1
- package/build-module/sandbox/index.native.js.map +1 -1
- package/build-module/select-control/index.js +1 -1
- package/build-module/select-control/index.js.map +1 -1
- package/build-module/select-control/styles/select-control-styles.js +5 -5
- package/build-module/select-control/styles/select-control-styles.js.map +1 -1
- package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js +1 -1
- package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
- package/build-module/slot-fill/bubbles-virtually/slot.js +1 -1
- package/build-module/slot-fill/bubbles-virtually/slot.js.map +1 -1
- package/build-module/slot-fill/fill.js +1 -1
- package/build-module/slot-fill/fill.js.map +1 -1
- package/build-module/slot-fill/provider.js +1 -1
- package/build-module/slot-fill/provider.js.map +1 -1
- package/build-module/snackbar/index.js +1 -1
- package/build-module/snackbar/index.js.map +1 -1
- package/build-module/snackbar/list.js +1 -1
- package/build-module/snackbar/list.js.map +1 -1
- package/build-module/style-provider/index.js +2 -2
- package/build-module/style-provider/index.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control/component.js +2 -2
- package/build-module/toggle-group-control/toggle-group-control/component.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control-option/component.js +1 -4
- package/build-module/toggle-group-control/toggle-group-control-option/component.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control-option/styles.js +11 -17
- package/build-module/toggle-group-control/toggle-group-control-option/styles.js.map +1 -1
- package/build-module/toolbar/index.js +1 -1
- package/build-module/toolbar/index.js.map +1 -1
- package/build-module/tooltip/index.js +3 -3
- package/build-module/tooltip/index.js.map +1 -1
- package/build-module/tooltip/index.native.js +7 -7
- package/build-module/tooltip/index.native.js.map +1 -1
- package/build-module/tree-grid/index.js +4 -1
- package/build-module/tree-grid/index.js.map +1 -1
- package/build-module/truncate/utils.js +1 -1
- package/build-module/truncate/utils.js.map +1 -1
- package/build-module/ui/context/context-connect.js +9 -16
- package/build-module/ui/context/context-connect.js.map +1 -1
- package/build-module/ui/context/context-system-provider.js +2 -2
- package/build-module/ui/context/context-system-provider.js.map +1 -1
- package/build-module/ui/context/index.js.map +1 -1
- package/build-module/ui/utils/colors.js +2 -2
- package/build-module/ui/utils/colors.js.map +1 -1
- package/build-module/ui/utils/space.js +2 -2
- package/build-module/ui/utils/space.js.map +1 -1
- package/build-module/unit-control/index.js +39 -30
- package/build-module/unit-control/index.js.map +1 -1
- package/build-module/unit-control/index.native.js +5 -3
- package/build-module/unit-control/index.native.js.map +1 -1
- package/build-module/unit-control/unit-select-control.js +1 -1
- package/build-module/unit-control/unit-select-control.js.map +1 -1
- package/build-module/unit-control/utils.js +92 -100
- package/build-module/unit-control/utils.js.map +1 -1
- package/build-module/utils/breakpoint-values.js +1 -1
- package/build-module/utils/breakpoint-values.js.map +1 -1
- package/build-module/utils/colors-values.js +1 -1
- package/build-module/utils/colors-values.js.map +1 -1
- package/build-style/style-rtl.css +8 -0
- package/build-style/style.css +8 -0
- package/build-types/base-field/hook.d.ts +2 -1
- package/build-types/base-field/hook.d.ts.map +1 -1
- package/build-types/card/card/hook.d.ts +2 -1
- package/build-types/card/card/hook.d.ts.map +1 -1
- package/build-types/card/card-body/hook.d.ts +2 -1
- package/build-types/card/card-body/hook.d.ts.map +1 -1
- package/build-types/card/card-divider/hook.d.ts +2 -2
- package/build-types/card/card-footer/hook.d.ts +2 -1
- package/build-types/card/card-footer/hook.d.ts.map +1 -1
- package/build-types/card/card-header/hook.d.ts +2 -1
- package/build-types/card/card-header/hook.d.ts.map +1 -1
- package/build-types/card/card-media/hook.d.ts +2 -1
- package/build-types/card/card-media/hook.d.ts.map +1 -1
- package/build-types/color-picker/styles.d.ts +2 -2
- package/build-types/confirm-dialog/component.d.ts +8 -0
- package/build-types/confirm-dialog/component.d.ts.map +1 -1
- package/build-types/confirm-dialog/types.d.ts +2 -0
- package/build-types/confirm-dialog/types.d.ts.map +1 -1
- package/build-types/divider/component.d.ts +2 -2
- package/build-types/divider/component.d.ts.map +1 -1
- package/build-types/divider/stories/index.d.ts +10 -0
- package/build-types/divider/stories/index.d.ts.map +1 -0
- package/build-types/divider/types.d.ts +1 -1
- package/build-types/divider/types.d.ts.map +1 -1
- package/build-types/elevation/hook.d.ts +2 -1
- package/build-types/elevation/hook.d.ts.map +1 -1
- package/build-types/flex/flex/hook.d.ts +2 -1
- package/build-types/flex/flex/hook.d.ts.map +1 -1
- package/build-types/flex/flex-block/hook.d.ts +2 -1
- package/build-types/flex/flex-block/hook.d.ts.map +1 -1
- package/build-types/flex/flex-item/hook.d.ts +2 -1
- package/build-types/flex/flex-item/hook.d.ts.map +1 -1
- package/build-types/flyout/flyout/hook.d.ts +2 -1
- package/build-types/flyout/flyout/hook.d.ts.map +1 -1
- package/build-types/grid/hook.d.ts +2 -1
- package/build-types/grid/hook.d.ts.map +1 -1
- package/build-types/h-stack/hook.d.ts +3 -2
- package/build-types/h-stack/hook.d.ts.map +1 -1
- package/build-types/heading/component.d.ts +3 -3
- package/build-types/heading/component.d.ts.map +1 -1
- package/build-types/heading/hook.d.ts +2 -1
- package/build-types/heading/hook.d.ts.map +1 -1
- package/build-types/heading/stories/index.d.ts +12 -0
- package/build-types/heading/stories/index.d.ts.map +1 -0
- package/build-types/input-control/index.d.ts +1 -1
- package/build-types/input-control/index.d.ts.map +1 -1
- package/build-types/input-control/input-field.d.ts +1 -1
- package/build-types/input-control/input-field.d.ts.map +1 -1
- package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
- package/build-types/item-group/item/hook.d.ts +2 -1
- package/build-types/item-group/item/hook.d.ts.map +1 -1
- package/build-types/item-group/item-group/hook.d.ts +2 -1
- package/build-types/item-group/item-group/hook.d.ts.map +1 -1
- package/build-types/navigator/navigator-back-button/hook.d.ts +2 -1
- package/build-types/navigator/navigator-back-button/hook.d.ts.map +1 -1
- package/build-types/navigator/navigator-button/hook.d.ts +2 -1
- package/build-types/navigator/navigator-button/hook.d.ts.map +1 -1
- package/build-types/number-control/styles/number-control-styles.d.ts +1 -1
- package/build-types/scrollable/hook.d.ts +2 -1
- package/build-types/scrollable/hook.d.ts.map +1 -1
- package/build-types/select-control/index.d.ts +1 -1
- package/build-types/select-control/index.d.ts.map +1 -1
- package/build-types/select-control/styles/select-control-styles.d.ts.map +1 -1
- package/build-types/spacer/hook.d.ts +2 -1
- package/build-types/spacer/hook.d.ts.map +1 -1
- package/build-types/surface/hook.d.ts +2 -1
- package/build-types/surface/hook.d.ts.map +1 -1
- package/build-types/text/hook.d.ts +2 -1
- package/build-types/text/hook.d.ts.map +1 -1
- package/build-types/text/types.d.ts +1 -2
- package/build-types/text/types.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control-option/component.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control-option/styles.d.ts +0 -4
- package/build-types/toggle-group-control/toggle-group-control-option/styles.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel/hook.d.ts +2 -1
- package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel-header/hook.d.ts +2 -1
- package/build-types/tools-panel/tools-panel-header/hook.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel-item/hook.d.ts +2 -1
- package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
- package/build-types/truncate/hook.d.ts +2 -1
- package/build-types/truncate/hook.d.ts.map +1 -1
- package/build-types/ui/context/context-connect.d.ts +18 -16
- package/build-types/ui/context/context-connect.d.ts.map +1 -1
- package/build-types/ui/context/index.d.ts +4 -4
- package/build-types/ui/context/index.d.ts.map +1 -1
- package/build-types/ui/context/wordpress-component.d.ts +1 -0
- package/build-types/ui/context/wordpress-component.d.ts.map +1 -1
- package/build-types/ui/control-group/hook.d.ts +2 -1
- package/build-types/ui/control-group/hook.d.ts.map +1 -1
- package/build-types/ui/control-label/hook.d.ts +2 -1
- package/build-types/ui/control-label/hook.d.ts.map +1 -1
- package/build-types/ui/form-group/use-form-group.d.ts +6 -4
- package/build-types/ui/form-group/use-form-group.d.ts.map +1 -1
- package/build-types/unit-control/index.d.ts +3 -3
- package/build-types/unit-control/index.d.ts.map +1 -1
- package/build-types/unit-control/types.d.ts +4 -6
- package/build-types/unit-control/types.d.ts.map +1 -1
- package/build-types/unit-control/utils.d.ts +47 -38
- package/build-types/unit-control/utils.d.ts.map +1 -1
- package/build-types/v-stack/hook.d.ts +2 -1
- package/build-types/v-stack/hook.d.ts.map +1 -1
- package/package.json +18 -18
- package/src/alignment-matrix-control/utils.js +1 -1
- package/src/angle-picker-control/angle-circle.js +1 -1
- package/src/animation/index.js +0 -1
- package/src/autocomplete/get-default-use-items.js +3 -3
- package/src/base-field/hook.js +1 -1
- package/src/box-control/icon.js +1 -1
- package/src/box-control/index.js +5 -5
- package/src/box-control/test/index.js +27 -7
- package/src/box-control/utils.js +13 -9
- package/src/button/index.js +5 -5
- package/src/button/index.native.js +7 -7
- package/src/button/style.scss +1 -0
- package/src/color-palette/style.scss +1 -0
- package/src/color-picker/color-display.tsx +1 -1
- package/src/color-picker/styles.ts +1 -1
- package/src/color-picker/test/index.js +1 -1
- package/src/combobox-control/index.js +1 -1
- package/src/combobox-control/style.scss +1 -0
- package/src/confirm-dialog/README.md +56 -45
- package/src/confirm-dialog/component.tsx +4 -2
- package/src/confirm-dialog/stories/index.js +19 -0
- package/src/confirm-dialog/test/index.js +28 -0
- package/src/confirm-dialog/types.ts +2 -0
- package/src/date-time/style.scss +4 -0
- package/src/date-time/time.js +16 -5
- package/src/dimension-control/test/index.test.js +1 -1
- package/src/disabled/test/index.js +1 -1
- package/src/divider/component.tsx +3 -3
- package/src/divider/stories/index.tsx +70 -0
- package/src/divider/types.ts +3 -1
- package/src/draggable/index.js +3 -3
- package/src/draggable/stories/index.js +1 -1
- package/src/flyout/flyout/README.md +1 -1
- package/src/flyout/test/index.js +1 -1
- package/src/focal-point-picker/index.native.js +7 -7
- package/src/focal-point-picker/tooltip/index.native.js +1 -1
- package/src/font-size-picker/README.md +1 -2
- package/src/font-size-picker/index.js +1 -1
- package/src/font-size-picker/stories/index.js +87 -108
- package/src/font-size-picker/test/index.js +0 -2
- package/src/form-token-field/index.js +6 -6
- package/src/form-token-field/style.scss +1 -0
- package/src/form-token-field/suggestions-list.js +2 -2
- package/src/form-token-field/test/index.js +6 -6
- package/src/heading/component.tsx +4 -4
- package/src/heading/hook.ts +1 -1
- package/src/heading/stories/index.tsx +37 -0
- package/src/higher-order/with-filters/test/index.js +1 -1
- package/src/higher-order/with-focus-outside/test/index.js +1 -1
- package/src/higher-order/with-notices/index.js +1 -1
- package/src/higher-order/with-notices/test/index.js +3 -3
- package/src/index.js +4 -4
- package/src/index.native.js +4 -4
- package/src/input-control/input-base.tsx +1 -1
- package/src/input-control/input-field.tsx +12 -9
- package/src/input-control/styles/input-control-styles.tsx +1 -0
- package/src/input-control/test/index.js +4 -4
- package/src/isolated-event-container/index.js +1 -1
- package/src/item-group/test/index.js +0 -1
- package/src/mobile/bottom-sheet/bottom-sheet-context.native.js +4 -4
- package/src/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +1 -1
- package/src/mobile/bottom-sheet/cell.native.js +1 -1
- package/src/mobile/bottom-sheet/index.native.js +11 -11
- package/src/mobile/bottom-sheet/link-cell.native.js +1 -1
- package/src/mobile/bottom-sheet/link-suggestion-item-cell.native.js +1 -1
- package/src/mobile/bottom-sheet/nav-bar/back-button.native.js +1 -1
- package/src/mobile/global-styles-context/utils.native.js +10 -10
- package/src/mobile/gradient/index.native.js +2 -2
- package/src/mobile/html-text-input/container.ios.js +3 -3
- package/src/mobile/html-text-input/index.native.js +1 -1
- package/src/mobile/html-text-input/test/index.native.js +14 -14
- package/src/mobile/image/index.native.js +1 -1
- package/src/mobile/image/style.native.scss +1 -0
- package/src/mobile/keyboard-aware-flat-list/index.android.js +1 -1
- package/src/mobile/keyboard-aware-flat-list/index.ios.js +2 -2
- package/src/mobile/link-picker/index.native.js +3 -3
- package/src/mobile/link-picker/link-picker-results.native.js +8 -8
- package/src/mobile/link-settings/image-link-destinations-screen.native.js +2 -2
- package/src/mobile/link-settings/index.native.js +1 -2
- package/src/mobile/link-settings/test/edit.native.js +15 -15
- package/src/modal/aria-helper.js +1 -1
- package/src/modal/index.js +2 -2
- package/src/navigable-container/container.js +2 -2
- package/src/navigable-container/tabbable.js +1 -1
- package/src/navigable-container/test/menu.js +5 -5
- package/src/navigable-container/test/tabbable.js +2 -2
- package/src/navigation/item/index.js +1 -1
- package/src/navigation/menu/index.js +1 -1
- package/src/navigation/stories/controlled-state.js +2 -2
- package/src/navigator/navigator-provider/component.tsx +1 -1
- package/src/navigator/navigator-screen/component.tsx +2 -2
- package/src/navigator/test/index.js +18 -19
- package/src/navigator/types.ts +1 -1
- package/src/number-control/index.js +1 -1
- package/src/panel/body.js +2 -2
- package/src/popover/index.js +3 -3
- package/src/popover/utils.js +6 -6
- package/src/radio-group/index.js +1 -1
- package/src/range-control/stories/index.js +1 -1
- package/src/range-control/styles/range-control-styles.js +1 -1
- package/src/range-control/test/index.js +2 -2
- package/src/sandbox/index.js +5 -5
- package/src/sandbox/index.native.js +1 -1
- package/src/select-control/index.tsx +1 -1
- package/src/select-control/styles/select-control-styles.ts +1 -0
- package/src/slot-fill/bubbles-virtually/slot-fill-provider.js +1 -1
- package/src/slot-fill/bubbles-virtually/slot.js +1 -2
- package/src/slot-fill/fill.js +1 -1
- package/src/slot-fill/provider.js +1 -1
- package/src/snackbar/index.js +1 -1
- package/src/snackbar/list.js +1 -1
- package/src/style-provider/index.js +2 -2
- package/src/tab-panel/test/index.js +1 -1
- package/src/text/test/index.js +2 -2
- package/src/text/types.ts +6 -8
- package/src/text-highlight/test/index.js +4 -4
- package/src/toggle-control/test/index.js +3 -3
- package/src/toggle-group-control/test/__snapshots__/index.js.snap +1 -27
- package/src/toggle-group-control/toggle-group-control/component.tsx +2 -2
- package/src/toggle-group-control/toggle-group-control-option/component.tsx +1 -4
- package/src/toggle-group-control/toggle-group-control-option/styles.ts +1 -12
- package/src/toolbar/index.js +1 -1
- package/src/toolbar-group/test/index.js +2 -2
- package/src/tooltip/index.js +3 -3
- package/src/tooltip/index.native.js +7 -7
- package/src/tooltip/test/index.js +2 -2
- package/src/tooltip/test/index.native.js +2 -2
- package/src/tree-grid/README.md +1 -1
- package/src/tree-grid/index.js +4 -0
- package/src/tree-grid/test/__snapshots__/index.js.snap +1 -1
- package/src/tree-grid/test/index.js +128 -52
- package/src/truncate/utils.js +1 -1
- package/src/ui/context/{context-connect.js → context-connect.ts} +27 -16
- package/src/ui/context/context-system-provider.js +2 -2
- package/src/ui/context/{index.js → index.ts} +0 -0
- package/src/ui/context/wordpress-component.ts +1 -0
- package/src/ui/tooltip/test/index.js +4 -4
- package/src/ui/utils/colors.js +2 -2
- package/src/ui/utils/space.ts +2 -2
- package/src/unit-control/README.md +1 -1
- package/src/unit-control/index.native.js +5 -3
- package/src/unit-control/index.tsx +64 -35
- package/src/unit-control/test/index.js +102 -3
- package/src/unit-control/test/utils.js +56 -15
- package/src/unit-control/types.ts +5 -8
- package/src/unit-control/unit-select-control.tsx +1 -1
- package/src/unit-control/utils.ts +128 -125
- package/src/utils/breakpoint-values.js +1 -1
- package/src/utils/colors-values.js +1 -1
- package/src/utils/hooks/test/use-controlled-state.js +1 -1
- package/src/utils/hooks/test/use-controlled-value.js +3 -3
- package/src/utils/hooks/test/use-latest-ref.js +1 -1
- package/src/utils/test/math.js +2 -2
- package/src/utils/test/rtl.js +12 -12
- package/tsconfig.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/src/divider/stories/index.js +0 -64
- package/src/heading/stories/index.js +0 -24
|
@@ -5,12 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.DEFAULT_UNIT = exports.CSS_UNITS = exports.ALL_CSS_UNITS = void 0;
|
|
7
7
|
exports.filterUnitsWithSettings = filterUnitsWithSettings;
|
|
8
|
-
exports.
|
|
8
|
+
exports.getAccessibleLabelForUnit = getAccessibleLabelForUnit;
|
|
9
|
+
exports.getParsedQuantityAndUnit = getParsedQuantityAndUnit;
|
|
9
10
|
exports.getUnitsWithCurrentUnit = getUnitsWithCurrentUnit;
|
|
10
|
-
exports.
|
|
11
|
+
exports.getValidParsedQuantityAndUnit = getValidParsedQuantityAndUnit;
|
|
11
12
|
exports.hasUnits = hasUnits;
|
|
12
|
-
exports.
|
|
13
|
-
exports.parseUnit = parseUnit;
|
|
13
|
+
exports.parseQuantityAndUnitFromRawValue = parseQuantityAndUnitFromRawValue;
|
|
14
14
|
exports.useCustomUnits = void 0;
|
|
15
15
|
|
|
16
16
|
var _i18n = require("@wordpress/i18n");
|
|
@@ -25,105 +25,90 @@ const allUnits = {
|
|
|
25
25
|
px: {
|
|
26
26
|
value: 'px',
|
|
27
27
|
label: isWeb ? 'px' : (0, _i18n.__)('Pixels (px)'),
|
|
28
|
-
default: '',
|
|
29
28
|
a11yLabel: (0, _i18n.__)('Pixels (px)'),
|
|
30
29
|
step: 1
|
|
31
30
|
},
|
|
32
31
|
'%': {
|
|
33
32
|
value: '%',
|
|
34
33
|
label: isWeb ? '%' : (0, _i18n.__)('Percentage (%)'),
|
|
35
|
-
default: '',
|
|
36
34
|
a11yLabel: (0, _i18n.__)('Percent (%)'),
|
|
37
35
|
step: 0.1
|
|
38
36
|
},
|
|
39
37
|
em: {
|
|
40
38
|
value: 'em',
|
|
41
39
|
label: isWeb ? 'em' : (0, _i18n.__)('Relative to parent font size (em)'),
|
|
42
|
-
default: '',
|
|
43
40
|
a11yLabel: (0, _i18n._x)('ems', 'Relative to parent font size (em)'),
|
|
44
41
|
step: 0.01
|
|
45
42
|
},
|
|
46
43
|
rem: {
|
|
47
44
|
value: 'rem',
|
|
48
45
|
label: isWeb ? 'rem' : (0, _i18n.__)('Relative to root font size (rem)'),
|
|
49
|
-
default: '',
|
|
50
46
|
a11yLabel: (0, _i18n._x)('rems', 'Relative to root font size (rem)'),
|
|
51
47
|
step: 0.01
|
|
52
48
|
},
|
|
53
49
|
vw: {
|
|
54
50
|
value: 'vw',
|
|
55
51
|
label: isWeb ? 'vw' : (0, _i18n.__)('Viewport width (vw)'),
|
|
56
|
-
default: '',
|
|
57
52
|
a11yLabel: (0, _i18n.__)('Viewport width (vw)'),
|
|
58
53
|
step: 0.1
|
|
59
54
|
},
|
|
60
55
|
vh: {
|
|
61
56
|
value: 'vh',
|
|
62
57
|
label: isWeb ? 'vh' : (0, _i18n.__)('Viewport height (vh)'),
|
|
63
|
-
default: '',
|
|
64
58
|
a11yLabel: (0, _i18n.__)('Viewport height (vh)'),
|
|
65
59
|
step: 0.1
|
|
66
60
|
},
|
|
67
61
|
vmin: {
|
|
68
62
|
value: 'vmin',
|
|
69
63
|
label: isWeb ? 'vmin' : (0, _i18n.__)('Viewport smallest dimension (vmin)'),
|
|
70
|
-
default: '',
|
|
71
64
|
a11yLabel: (0, _i18n.__)('Viewport smallest dimension (vmin)'),
|
|
72
65
|
step: 0.1
|
|
73
66
|
},
|
|
74
67
|
vmax: {
|
|
75
68
|
value: 'vmax',
|
|
76
69
|
label: isWeb ? 'vmax' : (0, _i18n.__)('Viewport largest dimension (vmax)'),
|
|
77
|
-
default: '',
|
|
78
70
|
a11yLabel: (0, _i18n.__)('Viewport largest dimension (vmax)'),
|
|
79
71
|
step: 0.1
|
|
80
72
|
},
|
|
81
73
|
ch: {
|
|
82
74
|
value: 'ch',
|
|
83
75
|
label: isWeb ? 'ch' : (0, _i18n.__)('Width of the zero (0) character (ch)'),
|
|
84
|
-
default: '',
|
|
85
76
|
a11yLabel: (0, _i18n.__)('Width of the zero (0) character (ch)'),
|
|
86
77
|
step: 0.01
|
|
87
78
|
},
|
|
88
79
|
ex: {
|
|
89
80
|
value: 'ex',
|
|
90
81
|
label: isWeb ? 'ex' : (0, _i18n.__)('x-height of the font (ex)'),
|
|
91
|
-
default: '',
|
|
92
82
|
a11yLabel: (0, _i18n.__)('x-height of the font (ex)'),
|
|
93
83
|
step: 0.01
|
|
94
84
|
},
|
|
95
85
|
cm: {
|
|
96
86
|
value: 'cm',
|
|
97
87
|
label: isWeb ? 'cm' : (0, _i18n.__)('Centimeters (cm)'),
|
|
98
|
-
default: '',
|
|
99
88
|
a11yLabel: (0, _i18n.__)('Centimeters (cm)'),
|
|
100
89
|
step: 0.001
|
|
101
90
|
},
|
|
102
91
|
mm: {
|
|
103
92
|
value: 'mm',
|
|
104
93
|
label: isWeb ? 'mm' : (0, _i18n.__)('Millimeters (mm)'),
|
|
105
|
-
default: '',
|
|
106
94
|
a11yLabel: (0, _i18n.__)('Millimeters (mm)'),
|
|
107
95
|
step: 0.1
|
|
108
96
|
},
|
|
109
97
|
in: {
|
|
110
98
|
value: 'in',
|
|
111
99
|
label: isWeb ? 'in' : (0, _i18n.__)('Inches (in)'),
|
|
112
|
-
default: '',
|
|
113
100
|
a11yLabel: (0, _i18n.__)('Inches (in)'),
|
|
114
101
|
step: 0.001
|
|
115
102
|
},
|
|
116
103
|
pc: {
|
|
117
104
|
value: 'pc',
|
|
118
105
|
label: isWeb ? 'pc' : (0, _i18n.__)('Picas (pc)'),
|
|
119
|
-
default: '',
|
|
120
106
|
a11yLabel: (0, _i18n.__)('Picas (pc)'),
|
|
121
107
|
step: 1
|
|
122
108
|
},
|
|
123
109
|
pt: {
|
|
124
110
|
value: 'pt',
|
|
125
111
|
label: isWeb ? 'pt' : (0, _i18n.__)('Points (pt)'),
|
|
126
|
-
default: '',
|
|
127
112
|
a11yLabel: (0, _i18n.__)('Points (pt)'),
|
|
128
113
|
step: 1
|
|
129
114
|
}
|
|
@@ -148,121 +133,132 @@ const DEFAULT_UNIT = allUnits.px;
|
|
|
148
133
|
* Moving forward, ideally the value should be a string that contains both
|
|
149
134
|
* the value and unit, example: '10px'
|
|
150
135
|
*
|
|
151
|
-
* @param value
|
|
152
|
-
* @param unit
|
|
153
|
-
* @param
|
|
154
|
-
* @return The extracted
|
|
136
|
+
* @param rawValue The raw value as a string (may or may not contain the unit)
|
|
137
|
+
* @param fallbackUnit The unit used as a fallback, if not unit is detected in the `value`
|
|
138
|
+
* @param allowedUnits Units to derive from.
|
|
139
|
+
* @return The extracted quantity and unit. The quantity can be `undefined` in case the raw value
|
|
140
|
+
* could not be parsed to a number correctly. The unit can be `undefined` in case the unit parse
|
|
141
|
+
* from the raw value could not be matched against the list of allowed units.
|
|
155
142
|
*/
|
|
156
143
|
|
|
157
144
|
exports.DEFAULT_UNIT = DEFAULT_UNIT;
|
|
158
145
|
|
|
159
|
-
function
|
|
160
|
-
const initialValue =
|
|
161
|
-
return
|
|
146
|
+
function getParsedQuantityAndUnit(rawValue, fallbackUnit, allowedUnits) {
|
|
147
|
+
const initialValue = fallbackUnit ? `${rawValue !== null && rawValue !== void 0 ? rawValue : ''}${fallbackUnit}` : rawValue;
|
|
148
|
+
return parseQuantityAndUnitFromRawValue(initialValue, allowedUnits);
|
|
162
149
|
}
|
|
163
150
|
/**
|
|
164
151
|
* Checks if units are defined.
|
|
165
152
|
*
|
|
166
|
-
* @param units
|
|
167
|
-
* @return Whether
|
|
153
|
+
* @param units List of units.
|
|
154
|
+
* @return Whether the list actually contains any units.
|
|
168
155
|
*/
|
|
169
156
|
|
|
170
157
|
|
|
171
158
|
function hasUnits(units) {
|
|
159
|
+
// Although the `isArray` check shouldn't be necessary (given the signature of
|
|
160
|
+
// this typed function), it's better to stay on the side of caution, since
|
|
161
|
+
// this function may be called from un-typed environments.
|
|
172
162
|
return Array.isArray(units) && !!units.length;
|
|
173
163
|
}
|
|
174
164
|
/**
|
|
175
|
-
* Parses a
|
|
165
|
+
* Parses a quantity and unit from a raw string value, given a list of allowed
|
|
166
|
+
* units and otherwise falling back to the default unit.
|
|
176
167
|
*
|
|
177
|
-
* @param
|
|
178
|
-
* @param
|
|
179
|
-
* @return The extracted
|
|
168
|
+
* @param rawValue The raw value as a string (may or may not contain the unit)
|
|
169
|
+
* @param allowedUnits Units to derive from.
|
|
170
|
+
* @return The extracted quantity and unit. The quantity can be `undefined` in case the raw value
|
|
171
|
+
* could not be parsed to a number correctly. The unit can be `undefined` in case the unit parsed
|
|
172
|
+
* from the raw value could not be matched against the list of allowed units.
|
|
180
173
|
*/
|
|
181
174
|
|
|
182
175
|
|
|
183
|
-
function
|
|
184
|
-
|
|
185
|
-
const value = String(initialValue).trim();
|
|
186
|
-
let num = parseFloat(value);
|
|
187
|
-
num = isNaN(num) ? '' : num;
|
|
188
|
-
const unitMatch = value.match(/[\d.\-\+]*\s*(.*)/);
|
|
189
|
-
let unit = (unitMatch === null || unitMatch === void 0 ? void 0 : unitMatch[1]) !== undefined ? unitMatch[1] : '';
|
|
190
|
-
unit = unit.toLowerCase();
|
|
176
|
+
function parseQuantityAndUnitFromRawValue(rawValue) {
|
|
177
|
+
var _trimmedValue, _unitMatch$;
|
|
191
178
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
179
|
+
let allowedUnits = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ALL_CSS_UNITS;
|
|
180
|
+
let trimmedValue;
|
|
181
|
+
let quantityToReturn;
|
|
182
|
+
|
|
183
|
+
if (typeof rawValue !== 'undefined' || rawValue === null) {
|
|
184
|
+
trimmedValue = `${rawValue}`.trim();
|
|
185
|
+
const parsedQuantity = parseFloat(trimmedValue);
|
|
186
|
+
quantityToReturn = !isFinite(parsedQuantity) ? undefined : parsedQuantity;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
const unitMatch = (_trimmedValue = trimmedValue) === null || _trimmedValue === void 0 ? void 0 : _trimmedValue.match(/[\d.\-\+]*\s*(.*)/);
|
|
190
|
+
const matchedUnit = unitMatch === null || unitMatch === void 0 ? void 0 : (_unitMatch$ = unitMatch[1]) === null || _unitMatch$ === void 0 ? void 0 : _unitMatch$.toLowerCase();
|
|
191
|
+
let unitToReturn;
|
|
192
|
+
|
|
193
|
+
if (hasUnits(allowedUnits)) {
|
|
194
|
+
const match = allowedUnits.find(item => item.value === matchedUnit);
|
|
195
|
+
unitToReturn = match === null || match === void 0 ? void 0 : match.value;
|
|
195
196
|
} else {
|
|
196
|
-
|
|
197
|
+
unitToReturn = DEFAULT_UNIT.value;
|
|
197
198
|
}
|
|
198
199
|
|
|
199
|
-
return [
|
|
200
|
+
return [quantityToReturn, unitToReturn];
|
|
200
201
|
}
|
|
201
202
|
/**
|
|
202
|
-
* Parses
|
|
203
|
+
* Parses quantity and unit from a raw value. Validates parsed value, using fallback
|
|
203
204
|
* value if invalid.
|
|
204
205
|
*
|
|
205
|
-
* @param
|
|
206
|
-
* @param
|
|
207
|
-
* @param
|
|
208
|
-
* @param fallbackUnit
|
|
209
|
-
* @return The extracted
|
|
206
|
+
* @param rawValue The next value.
|
|
207
|
+
* @param allowedUnits Units to derive from.
|
|
208
|
+
* @param fallbackQuantity The fallback quantity, used in case it's not possible to parse a valid quantity from the raw value.
|
|
209
|
+
* @param fallbackUnit The fallback unit, used in case it's not possible to parse a valid unit from the raw value.
|
|
210
|
+
* @return The extracted quantity and unit. The quantity can be `undefined` in case the raw value
|
|
211
|
+
* could not be parsed to a number correctly, and the `fallbackQuantity` was also `undefined`. The
|
|
212
|
+
* unit can be `undefined` only if the unit parsed from the raw value could not be matched against
|
|
213
|
+
* the list of allowed units, the `fallbackQuantity` is also `undefined` and the list of
|
|
214
|
+
* `allowedUnits` is passed empty.
|
|
210
215
|
*/
|
|
211
216
|
|
|
212
217
|
|
|
213
|
-
function
|
|
214
|
-
const [
|
|
215
|
-
|
|
216
|
-
let baseUnit; // The parsed value from `parseUnit` should now be either a
|
|
217
|
-
// real number or an empty string. If not, use the fallback value.
|
|
218
|
-
|
|
219
|
-
if (!Number.isFinite(parsedValue) || parsedValue === '') {
|
|
220
|
-
baseValue = fallbackValue;
|
|
221
|
-
}
|
|
218
|
+
function getValidParsedQuantityAndUnit(rawValue, allowedUnits, fallbackQuantity, fallbackUnit) {
|
|
219
|
+
const [parsedQuantity, parsedUnit] = parseQuantityAndUnitFromRawValue(rawValue, allowedUnits); // The parsed value from `parseQuantityAndUnitFromRawValue` should now be
|
|
220
|
+
// either a real number or undefined. If undefined, use the fallback value.
|
|
222
221
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
* If no unit is found, attempt to use the first value from the collection
|
|
226
|
-
* of units as a default fallback.
|
|
227
|
-
*/
|
|
222
|
+
const quantityToReturn = parsedQuantity !== null && parsedQuantity !== void 0 ? parsedQuantity : fallbackQuantity; // If no unit is parsed from the raw value, or if the fallback unit is not
|
|
223
|
+
// defined, use the first value from the list of allowed units as fallback.
|
|
228
224
|
|
|
229
|
-
|
|
230
|
-
var _units$;
|
|
225
|
+
let unitToReturn = parsedUnit || fallbackUnit;
|
|
231
226
|
|
|
232
|
-
|
|
227
|
+
if (!unitToReturn && hasUnits(allowedUnits)) {
|
|
228
|
+
unitToReturn = allowedUnits[0].value;
|
|
233
229
|
}
|
|
234
230
|
|
|
235
|
-
return [
|
|
231
|
+
return [quantityToReturn, unitToReturn];
|
|
236
232
|
}
|
|
237
233
|
/**
|
|
238
234
|
* Takes a unit value and finds the matching accessibility label for the
|
|
239
235
|
* unit abbreviation.
|
|
240
236
|
*
|
|
241
|
-
* @param unit Unit value (example: px)
|
|
237
|
+
* @param unit Unit value (example: `px`)
|
|
242
238
|
* @return a11y label for the unit abbreviation
|
|
243
239
|
*/
|
|
244
240
|
|
|
245
241
|
|
|
246
|
-
function
|
|
242
|
+
function getAccessibleLabelForUnit(unit) {
|
|
247
243
|
const match = ALL_CSS_UNITS.find(item => item.value === unit);
|
|
248
244
|
return match !== null && match !== void 0 && match.a11yLabel ? match === null || match === void 0 ? void 0 : match.a11yLabel : match === null || match === void 0 ? void 0 : match.value;
|
|
249
245
|
}
|
|
250
246
|
/**
|
|
251
|
-
* Filters available units based on values defined
|
|
252
|
-
*
|
|
253
|
-
* @param unitSetting Collection of preferred unit value strings.
|
|
254
|
-
* @param units Collection of available unit objects.
|
|
247
|
+
* Filters available units based on values defined a list of allowed unit values.
|
|
255
248
|
*
|
|
256
|
-
* @
|
|
249
|
+
* @param allowedUnitValues Collection of allowed unit value strings.
|
|
250
|
+
* @param availableUnits Collection of available unit objects.
|
|
251
|
+
* @return Filtered units.
|
|
257
252
|
*/
|
|
258
253
|
|
|
259
254
|
|
|
260
255
|
function filterUnitsWithSettings() {
|
|
261
|
-
let
|
|
262
|
-
let
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
256
|
+
let allowedUnitValues = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
257
|
+
let availableUnits = arguments.length > 1 ? arguments[1] : undefined;
|
|
258
|
+
// Although the `isArray` check shouldn't be necessary (given the signature of
|
|
259
|
+
// this typed function), it's better to stay on the side of caution, since
|
|
260
|
+
// this function may be called from un-typed environments.
|
|
261
|
+
return Array.isArray(availableUnits) ? availableUnits.filter(unit => allowedUnitValues.includes(unit.value)) : [];
|
|
266
262
|
}
|
|
267
263
|
/**
|
|
268
264
|
* Custom hook to retrieve and consolidate units setting from add_theme_support().
|
|
@@ -272,30 +268,31 @@ function filterUnitsWithSettings() {
|
|
|
272
268
|
* @param args An object containing units, settingPath & defaultUnits.
|
|
273
269
|
* @param args.units Collection of all potentially available units.
|
|
274
270
|
* @param args.availableUnits Collection of unit value strings for filtering available units.
|
|
275
|
-
* @param args.defaultValues Collection of default values for defined units. Example: { px:
|
|
271
|
+
* @param args.defaultValues Collection of default values for defined units. Example: `{ px: 350, em: 15 }`.
|
|
276
272
|
*
|
|
277
|
-
* @return Filtered units
|
|
273
|
+
* @return Filtered list of units, with their default values updated following the `defaultValues`
|
|
274
|
+
* argument's property.
|
|
278
275
|
*/
|
|
279
276
|
|
|
280
277
|
|
|
281
278
|
const useCustomUnits = _ref => {
|
|
282
279
|
let {
|
|
283
|
-
units,
|
|
284
|
-
availableUnits,
|
|
280
|
+
units = ALL_CSS_UNITS,
|
|
281
|
+
availableUnits = [],
|
|
285
282
|
defaultValues
|
|
286
283
|
} = _ref;
|
|
287
|
-
|
|
288
|
-
const usedUnits = filterUnitsWithSettings(!availableUnits ? [] : availableUnits, units);
|
|
284
|
+
const customUnitsToReturn = filterUnitsWithSettings(availableUnits, units);
|
|
289
285
|
|
|
290
286
|
if (defaultValues) {
|
|
291
|
-
|
|
287
|
+
customUnitsToReturn.forEach((unit, i) => {
|
|
292
288
|
if (defaultValues[unit.value]) {
|
|
293
|
-
|
|
289
|
+
const [parsedDefaultValue] = parseQuantityAndUnitFromRawValue(defaultValues[unit.value]);
|
|
290
|
+
customUnitsToReturn[i].default = parsedDefaultValue;
|
|
294
291
|
}
|
|
295
292
|
});
|
|
296
293
|
}
|
|
297
294
|
|
|
298
|
-
return
|
|
295
|
+
return customUnitsToReturn;
|
|
299
296
|
};
|
|
300
297
|
/**
|
|
301
298
|
* Get available units with the unit for the currently selected value
|
|
@@ -305,9 +302,9 @@ const useCustomUnits = _ref => {
|
|
|
305
302
|
* accurately displayed in the UI, even if the intention is to hide
|
|
306
303
|
* the availability of that unit.
|
|
307
304
|
*
|
|
308
|
-
* @param
|
|
309
|
-
* @param legacyUnit
|
|
310
|
-
* @param units
|
|
305
|
+
* @param rawValue Selected value to parse.
|
|
306
|
+
* @param legacyUnit Legacy unit value, if rawValue needs it appended.
|
|
307
|
+
* @param units List of available units.
|
|
311
308
|
*
|
|
312
309
|
* @return A collection of units containing the unit for the current value.
|
|
313
310
|
*/
|
|
@@ -315,22 +312,17 @@ const useCustomUnits = _ref => {
|
|
|
315
312
|
|
|
316
313
|
exports.useCustomUnits = useCustomUnits;
|
|
317
314
|
|
|
318
|
-
function getUnitsWithCurrentUnit(
|
|
315
|
+
function getUnitsWithCurrentUnit(rawValue, legacyUnit) {
|
|
319
316
|
let units = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ALL_CSS_UNITS;
|
|
317
|
+
const unitsToReturn = Array.isArray(units) ? [...units] : [];
|
|
318
|
+
const [, currentUnit] = getParsedQuantityAndUnit(rawValue, legacyUnit, ALL_CSS_UNITS);
|
|
320
319
|
|
|
321
|
-
if (!
|
|
322
|
-
return units;
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
const unitsWithCurrentUnit = [...units];
|
|
326
|
-
const [, currentUnit] = getParsedValue(currentValue, legacyUnit, ALL_CSS_UNITS);
|
|
327
|
-
|
|
328
|
-
if (currentUnit && !unitsWithCurrentUnit.some(unit => unit.value === currentUnit)) {
|
|
320
|
+
if (currentUnit && !unitsToReturn.some(unit => unit.value === currentUnit)) {
|
|
329
321
|
if (allUnits[currentUnit]) {
|
|
330
|
-
|
|
322
|
+
unitsToReturn.unshift(allUnits[currentUnit]);
|
|
331
323
|
}
|
|
332
324
|
}
|
|
333
325
|
|
|
334
|
-
return
|
|
326
|
+
return unitsToReturn;
|
|
335
327
|
}
|
|
336
328
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/unit-control/utils.ts"],"names":["isWeb","Platform","OS","allUnits","px","value","label","default","a11yLabel","step","em","rem","vw","vh","vmin","vmax","ch","ex","cm","mm","in","pc","pt","ALL_CSS_UNITS","Object","values","CSS_UNITS","DEFAULT_UNIT","getParsedValue","unit","units","initialValue","parseUnit","hasUnits","Array","isArray","length","String","trim","num","parseFloat","isNaN","unitMatch","match","undefined","toLowerCase","find","item","getValidParsedUnit","next","fallbackValue","fallbackUnit","parsedValue","parsedUnit","baseValue","baseUnit","Number","isFinite","parseA11yLabelForUnit","filterUnitsWithSettings","unitSetting","filter","includes","useCustomUnits","availableUnits","defaultValues","usedUnits","forEach","i","getUnitsWithCurrentUnit","currentValue","legacyUnit","unitsWithCurrentUnit","currentUnit","some","unshift"],"mappings":";;;;;;;;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AASA,MAAMA,KAAK,GAAGC,kBAASC,EAAT,KAAgB,KAA9B;AAEA,MAAMC,QAA6C,GAAG;AACrDC,EAAAA,EAAE,EAAE;AACHC,IAAAA,KAAK,EAAE,IADJ;AAEHC,IAAAA,KAAK,EAAEN,KAAK,GAAG,IAAH,GAAU,cAAI,aAAJ,CAFnB;AAGHO,IAAAA,OAAO,EAAE,EAHN;AAIHC,IAAAA,SAAS,EAAE,cAAI,aAAJ,CAJR;AAKHC,IAAAA,IAAI,EAAE;AALH,GADiD;AAQrD,OAAK;AACJJ,IAAAA,KAAK,EAAE,GADH;AAEJC,IAAAA,KAAK,EAAEN,KAAK,GAAG,GAAH,GAAS,cAAI,gBAAJ,CAFjB;AAGJO,IAAAA,OAAO,EAAE,EAHL;AAIJC,IAAAA,SAAS,EAAE,cAAI,aAAJ,CAJP;AAKJC,IAAAA,IAAI,EAAE;AALF,GARgD;AAerDC,EAAAA,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CAAEW,KAAK,CAACC,OAAN,CAAeL,KAAf,CAAP,EAAgC;AAC/B,WAAOA,KAAP;AACA;;AAED,QAAM0C,oBAAoB,GAAG,CAAE,GAAG1C,KAAL,CAA7B;AACA,QAAM,GAAI2C,WAAJ,IAAoB7C,cAAc,CACvC0C,YADuC,EAEvCC,UAFuC,EAGvChD,aAHuC,CAAxC;;AAMA,MACCkD,WAAW,IACX,CAAED,oBAAoB,CAACE,IAArB,CAA6B7C,IAAF,IAAYA,IAAI,CAACxB,KAAL,KAAeoE,WAAtD,CAFH,EAGE;AACD,QAAKtE,QAAQ,CAAEsE,WAAF,CAAb,EAA+B;AAC9BD,MAAAA,oBAAoB,CAACG,OAArB,CAA8BxE,QAAQ,CAAEsE,WAAF,CAAtC;AACA;AACD;;AAED,SAAOD,oBAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport { Platform } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { Value, WPUnitControlUnit, WPUnitControlUnitList } from './types';\n\nconst isWeb = Platform.OS === 'web';\n\nconst allUnits: Record< string, WPUnitControlUnit > = {\n\tpx: {\n\t\tvalue: 'px',\n\t\tlabel: isWeb ? 'px' : __( 'Pixels (px)' ),\n\t\tdefault: '',\n\t\ta11yLabel: __( 'Pixels (px)' ),\n\t\tstep: 1,\n\t},\n\t'%': {\n\t\tvalue: '%',\n\t\tlabel: isWeb ? '%' : __( 'Percentage (%)' ),\n\t\tdefault: '',\n\t\ta11yLabel: __( 'Percent (%)' ),\n\t\tstep: 0.1,\n\t},\n\tem: {\n\t\tvalue: 'em',\n\t\tlabel: isWeb ? 'em' : __( 'Relative to parent font size (em)' ),\n\t\tdefault: '',\n\t\ta11yLabel: _x( 'ems', 'Relative to parent font size (em)' ),\n\t\tstep: 0.01,\n\t},\n\trem: {\n\t\tvalue: 'rem',\n\t\tlabel: isWeb ? 'rem' : __( 'Relative to root font size (rem)' ),\n\t\tdefault: '',\n\t\ta11yLabel: _x( 'rems', 'Relative to root font size (rem)' ),\n\t\tstep: 0.01,\n\t},\n\tvw: {\n\t\tvalue: 'vw',\n\t\tlabel: isWeb ? 'vw' : __( 'Viewport width (vw)' ),\n\t\tdefault: '',\n\t\ta11yLabel: __( 'Viewport width (vw)' ),\n\t\tstep: 0.1,\n\t},\n\tvh: {\n\t\tvalue: 'vh',\n\t\tlabel: isWeb ? 'vh' : __( 'Viewport height (vh)' ),\n\t\tdefault: '',\n\t\ta11yLabel: __( 'Viewport height (vh)' ),\n\t\tstep: 0.1,\n\t},\n\tvmin: {\n\t\tvalue: 'vmin',\n\t\tlabel: isWeb ? 'vmin' : __( 'Viewport smallest dimension (vmin)' ),\n\t\tdefault: '',\n\t\ta11yLabel: __( 'Viewport smallest dimension (vmin)' ),\n\t\tstep: 0.1,\n\t},\n\tvmax: {\n\t\tvalue: 'vmax',\n\t\tlabel: isWeb ? 'vmax' : __( 'Viewport largest dimension (vmax)' ),\n\t\tdefault: '',\n\t\ta11yLabel: __( 'Viewport largest dimension (vmax)' ),\n\t\tstep: 0.1,\n\t},\n\tch: {\n\t\tvalue: 'ch',\n\t\tlabel: isWeb ? 'ch' : __( 'Width of the zero (0) character (ch)' ),\n\t\tdefault: '',\n\t\ta11yLabel: __( 'Width of the zero (0) character (ch)' ),\n\t\tstep: 0.01,\n\t},\n\tex: {\n\t\tvalue: 'ex',\n\t\tlabel: isWeb ? 'ex' : __( 'x-height of the font (ex)' ),\n\t\tdefault: '',\n\t\ta11yLabel: __( 'x-height of the font (ex)' ),\n\t\tstep: 0.01,\n\t},\n\tcm: {\n\t\tvalue: 'cm',\n\t\tlabel: isWeb ? 'cm' : __( 'Centimeters (cm)' ),\n\t\tdefault: '',\n\t\ta11yLabel: __( 'Centimeters (cm)' ),\n\t\tstep: 0.001,\n\t},\n\tmm: {\n\t\tvalue: 'mm',\n\t\tlabel: isWeb ? 'mm' : __( 'Millimeters (mm)' ),\n\t\tdefault: '',\n\t\ta11yLabel: __( 'Millimeters (mm)' ),\n\t\tstep: 0.1,\n\t},\n\tin: {\n\t\tvalue: 'in',\n\t\tlabel: isWeb ? 'in' : __( 'Inches (in)' ),\n\t\tdefault: '',\n\t\ta11yLabel: __( 'Inches (in)' ),\n\t\tstep: 0.001,\n\t},\n\tpc: {\n\t\tvalue: 'pc',\n\t\tlabel: isWeb ? 'pc' : __( 'Picas (pc)' ),\n\t\tdefault: '',\n\t\ta11yLabel: __( 'Picas (pc)' ),\n\t\tstep: 1,\n\t},\n\tpt: {\n\t\tvalue: 'pt',\n\t\tlabel: isWeb ? 'pt' : __( 'Points (pt)' ),\n\t\tdefault: '',\n\t\ta11yLabel: __( 'Points (pt)' ),\n\t\tstep: 1,\n\t},\n};\n\n/**\n * An array of all available CSS length units.\n */\nexport const ALL_CSS_UNITS = Object.values( allUnits );\n\n/**\n * Units of measurements. `a11yLabel` is used by screenreaders.\n */\nexport const CSS_UNITS = [\n\tallUnits.px,\n\tallUnits[ '%' ],\n\tallUnits.em,\n\tallUnits.rem,\n\tallUnits.vw,\n\tallUnits.vh,\n];\n\nexport const DEFAULT_UNIT = allUnits.px;\n\n/**\n * Handles legacy value + unit handling.\n * This component use to manage both incoming value and units separately.\n *\n * Moving forward, ideally the value should be a string that contains both\n * the value and unit, example: '10px'\n *\n * @param value Value\n * @param unit Unit value\n * @param units Units to derive from.\n * @return The extracted number and unit.\n */\nexport function getParsedValue(\n\tvalue: Value,\n\tunit?: string,\n\tunits?: WPUnitControlUnitList\n): [ Value, string | undefined ] {\n\tconst initialValue = unit ? `${ value }${ unit }` : value;\n\n\treturn parseUnit( initialValue, units );\n}\n\n/**\n * Checks if units are defined.\n *\n * @param units Units to check.\n * @return Whether units are defined.\n */\nexport function hasUnits( units: WPUnitControlUnitList ): boolean {\n\treturn Array.isArray( units ) && !! units.length;\n}\n\n/**\n * Parses a number and unit from a value.\n *\n * @param initialValue Value to parse\n * @param units Units to derive from.\n * @return The extracted number and unit.\n */\nexport function parseUnit(\n\tinitialValue: Value | undefined,\n\tunits: WPUnitControlUnitList = ALL_CSS_UNITS\n): [ Value, string | undefined ] {\n\tconst value = String( initialValue ).trim();\n\n\tlet num: Value = parseFloat( value );\n\tnum = isNaN( num ) ? '' : num;\n\n\tconst unitMatch = value.match( /[\\d.\\-\\+]*\\s*(.*)/ );\n\n\tlet unit: string | undefined =\n\t\tunitMatch?.[ 1 ] !== undefined ? unitMatch[ 1 ] : '';\n\tunit = unit.toLowerCase();\n\n\tif ( hasUnits( units ) && units !== false ) {\n\t\tconst match = units.find( ( item ) => item.value === unit );\n\t\tunit = match?.value;\n\t} else {\n\t\tunit = DEFAULT_UNIT.value;\n\t}\n\n\treturn [ num, unit ];\n}\n\n/**\n * Parses a number and unit from a value. Validates parsed value, using fallback\n * value if invalid.\n *\n * @param next The next value.\n * @param units Units to derive from.\n * @param fallbackValue The fallback value.\n * @param fallbackUnit The fallback value.\n * @return The extracted value and unit.\n */\nexport function getValidParsedUnit(\n\tnext: Value | undefined,\n\tunits: WPUnitControlUnitList,\n\tfallbackValue: Value,\n\tfallbackUnit: string | undefined\n): [ Value, string | undefined ] {\n\tconst [ parsedValue, parsedUnit ] = parseUnit( next, units );\n\tlet baseValue = parsedValue;\n\tlet baseUnit: string | undefined;\n\n\t// The parsed value from `parseUnit` should now be either a\n\t// real number or an empty string. If not, use the fallback value.\n\tif ( ! Number.isFinite( parsedValue ) || parsedValue === '' ) {\n\t\tbaseValue = fallbackValue;\n\t}\n\n\tbaseUnit = parsedUnit || fallbackUnit;\n\n\t/**\n\t * If no unit is found, attempt to use the first value from the collection\n\t * of units as a default fallback.\n\t */\n\tif ( Array.isArray( units ) && hasUnits( units ) && ! baseUnit ) {\n\t\tbaseUnit = units[ 0 ]?.value;\n\t}\n\n\treturn [ baseValue, baseUnit ];\n}\n\n/**\n * Takes a unit value and finds the matching accessibility label for the\n * unit abbreviation.\n *\n * @param unit Unit value (example: px)\n * @return a11y label for the unit abbreviation\n */\nexport function parseA11yLabelForUnit( unit: string ): string | undefined {\n\tconst match = ALL_CSS_UNITS.find( ( item ) => item.value === unit );\n\treturn match?.a11yLabel ? match?.a11yLabel : match?.value;\n}\n\n/**\n * Filters available units based on values defined by the unit setting/property.\n *\n * @param unitSetting Collection of preferred unit value strings.\n * @param units Collection of available unit objects.\n *\n * @return Filtered units based on settings.\n */\nexport function filterUnitsWithSettings(\n\tunitSetting: Array< string > = [],\n\tunits: WPUnitControlUnitList\n): Array< WPUnitControlUnit > {\n\treturn Array.isArray( units )\n\t\t? units.filter( ( unit ) => {\n\t\t\t\treturn unitSetting.includes( unit.value );\n\t\t } )\n\t\t: [];\n}\n\n/**\n * Custom hook to retrieve and consolidate units setting from add_theme_support().\n * TODO: ideally this hook shouldn't be needed\n * https://github.com/WordPress/gutenberg/pull/31822#discussion_r633280823\n *\n * @param args An object containing units, settingPath & defaultUnits.\n * @param args.units Collection of all potentially available units.\n * @param args.availableUnits Collection of unit value strings for filtering available units.\n * @param args.defaultValues Collection of default values for defined units. Example: { px: '350', em: '15' }.\n *\n * @return Filtered units based on settings.\n */\nexport const useCustomUnits = ( {\n\tunits,\n\tavailableUnits,\n\tdefaultValues,\n}: {\n\tunits?: WPUnitControlUnitList;\n\tavailableUnits?: Array< string >;\n\tdefaultValues: Record< string, Value >;\n} ): WPUnitControlUnitList => {\n\tunits = units || ALL_CSS_UNITS;\n\tconst usedUnits = filterUnitsWithSettings(\n\t\t! availableUnits ? [] : availableUnits,\n\t\tunits\n\t);\n\n\tif ( defaultValues ) {\n\t\tusedUnits.forEach( ( unit, i ) => {\n\t\t\tif ( defaultValues[ unit.value ] ) {\n\t\t\t\tusedUnits[ i ].default = defaultValues[ unit.value ];\n\t\t\t}\n\t\t} );\n\t}\n\n\treturn usedUnits.length === 0 ? false : usedUnits;\n};\n\n/**\n * Get available units with the unit for the currently selected value\n * prepended if it is not available in the list of units.\n *\n * This is useful to ensure that the current value's unit is always\n * accurately displayed in the UI, even if the intention is to hide\n * the availability of that unit.\n *\n * @param currentValue Selected value to parse.\n * @param legacyUnit Legacy unit value, if currentValue needs it appended.\n * @param units List of available units.\n *\n * @return A collection of units containing the unit for the current value.\n */\nexport function getUnitsWithCurrentUnit(\n\tcurrentValue: Value,\n\tlegacyUnit: string | undefined,\n\tunits: WPUnitControlUnitList = ALL_CSS_UNITS\n): WPUnitControlUnitList {\n\tif ( ! Array.isArray( units ) ) {\n\t\treturn units;\n\t}\n\n\tconst unitsWithCurrentUnit = [ ...units ];\n\tconst [ , currentUnit ] = getParsedValue(\n\t\tcurrentValue,\n\t\tlegacyUnit,\n\t\tALL_CSS_UNITS\n\t);\n\n\tif (\n\t\tcurrentUnit &&\n\t\t! unitsWithCurrentUnit.some( ( unit ) => unit.value === currentUnit )\n\t) {\n\t\tif ( allUnits[ currentUnit ] ) {\n\t\t\tunitsWithCurrentUnit.unshift( allUnits[ currentUnit ] );\n\t\t}\n\t}\n\n\treturn unitsWithCurrentUnit;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/unit-control/utils.ts"],"names":["isWeb","Platform","OS","allUnits","px","value","label","a11yLabel","step","em","rem","vw","vh","vmin","vmax","ch","ex","cm","mm","in","pc","pt","ALL_CSS_UNITS","Object","values","CSS_UNITS","DEFAULT_UNIT","getParsedQuantityAndUnit","rawValue","fallbackUnit","allowedUnits","initialValue","parseQuantityAndUnitFromRawValue","hasUnits","units","Array","isArray","length","trimmedValue","quantityToReturn","trim","parsedQuantity","parseFloat","isFinite","undefined","unitMatch","match","matchedUnit","toLowerCase","unitToReturn","find","item","getValidParsedQuantityAndUnit","fallbackQuantity","parsedUnit","getAccessibleLabelForUnit","unit","filterUnitsWithSettings","allowedUnitValues","availableUnits","filter","includes","useCustomUnits","defaultValues","customUnitsToReturn","forEach","i","parsedDefaultValue","default","getUnitsWithCurrentUnit","legacyUnit","unitsToReturn","currentUnit","some","unshift"],"mappings":";;;;;;;;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AASA,MAAMA,KAAK,GAAGC,k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iD,aAAa,GAAGpC,KAAK,CAACC,OAAN,CAAeF,KAAf,IAAyB,CAAE,GAAGA,KAAL,CAAzB,GAAwC,EAA9D;AACA,QAAM,GAAIsC,WAAJ,IAAoB7C,wBAAwB,CACjDC,QADiD,EAEjD0C,UAFiD,EAGjDhD,aAHiD,CAAlD;;AAMA,MACCkD,WAAW,IACX,CAAED,aAAa,CAACE,IAAd,CAAsBjB,IAAF,IAAYA,IAAI,CAACnD,KAAL,KAAemE,WAA/C,CAFH,EAGE;AACD,QAAKrE,QAAQ,CAAEqE,WAAF,CAAb,EAA+B;AAC9BD,MAAAA,aAAa,CAACG,OAAd,CAAuBvE,QAAQ,CAAEqE,WAAF,CAA/B;AACA;AACD;;AAED,SAAOD,aAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport { Platform } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { WPUnitControlUnit } from './types';\n\nconst isWeb = Platform.OS === 'web';\n\nconst allUnits: Record< string, WPUnitControlUnit > = {\n\tpx: {\n\t\tvalue: 'px',\n\t\tlabel: isWeb ? 'px' : __( 'Pixels (px)' ),\n\t\ta11yLabel: __( 'Pixels (px)' ),\n\t\tstep: 1,\n\t},\n\t'%': {\n\t\tvalue: '%',\n\t\tlabel: isWeb ? '%' : __( 'Percentage (%)' ),\n\t\ta11yLabel: __( 'Percent (%)' ),\n\t\tstep: 0.1,\n\t},\n\tem: {\n\t\tvalue: 'em',\n\t\tlabel: isWeb ? 'em' : __( 'Relative to parent font size (em)' ),\n\t\ta11yLabel: _x( 'ems', 'Relative to parent font size (em)' ),\n\t\tstep: 0.01,\n\t},\n\trem: {\n\t\tvalue: 'rem',\n\t\tlabel: isWeb ? 'rem' : __( 'Relative to root font size (rem)' ),\n\t\ta11yLabel: _x( 'rems', 'Relative to root font size (rem)' ),\n\t\tstep: 0.01,\n\t},\n\tvw: {\n\t\tvalue: 'vw',\n\t\tlabel: isWeb ? 'vw' : __( 'Viewport width (vw)' ),\n\t\ta11yLabel: __( 'Viewport width (vw)' ),\n\t\tstep: 0.1,\n\t},\n\tvh: {\n\t\tvalue: 'vh',\n\t\tlabel: isWeb ? 'vh' : __( 'Viewport height (vh)' ),\n\t\ta11yLabel: __( 'Viewport height (vh)' ),\n\t\tstep: 0.1,\n\t},\n\tvmin: {\n\t\tvalue: 'vmin',\n\t\tlabel: isWeb ? 'vmin' : __( 'Viewport smallest dimension (vmin)' ),\n\t\ta11yLabel: __( 'Viewport smallest dimension (vmin)' ),\n\t\tstep: 0.1,\n\t},\n\tvmax: {\n\t\tvalue: 'vmax',\n\t\tlabel: isWeb ? 'vmax' : __( 'Viewport largest dimension (vmax)' ),\n\t\ta11yLabel: __( 'Viewport largest dimension (vmax)' ),\n\t\tstep: 0.1,\n\t},\n\tch: {\n\t\tvalue: 'ch',\n\t\tlabel: isWeb ? 'ch' : __( 'Width of the zero (0) character (ch)' ),\n\t\ta11yLabel: __( 'Width of the zero (0) character (ch)' ),\n\t\tstep: 0.01,\n\t},\n\tex: {\n\t\tvalue: 'ex',\n\t\tlabel: isWeb ? 'ex' : __( 'x-height of the font (ex)' ),\n\t\ta11yLabel: __( 'x-height of the font (ex)' ),\n\t\tstep: 0.01,\n\t},\n\tcm: {\n\t\tvalue: 'cm',\n\t\tlabel: isWeb ? 'cm' : __( 'Centimeters (cm)' ),\n\t\ta11yLabel: __( 'Centimeters (cm)' ),\n\t\tstep: 0.001,\n\t},\n\tmm: {\n\t\tvalue: 'mm',\n\t\tlabel: isWeb ? 'mm' : __( 'Millimeters (mm)' ),\n\t\ta11yLabel: __( 'Millimeters (mm)' ),\n\t\tstep: 0.1,\n\t},\n\tin: {\n\t\tvalue: 'in',\n\t\tlabel: isWeb ? 'in' : __( 'Inches (in)' ),\n\t\ta11yLabel: __( 'Inches (in)' ),\n\t\tstep: 0.001,\n\t},\n\tpc: {\n\t\tvalue: 'pc',\n\t\tlabel: isWeb ? 'pc' : __( 'Picas (pc)' ),\n\t\ta11yLabel: __( 'Picas (pc)' ),\n\t\tstep: 1,\n\t},\n\tpt: {\n\t\tvalue: 'pt',\n\t\tlabel: isWeb ? 'pt' : __( 'Points (pt)' ),\n\t\ta11yLabel: __( 'Points (pt)' ),\n\t\tstep: 1,\n\t},\n};\n\n/**\n * An array of all available CSS length units.\n */\nexport const ALL_CSS_UNITS = Object.values( allUnits );\n\n/**\n * Units of measurements. `a11yLabel` is used by screenreaders.\n */\nexport const CSS_UNITS = [\n\tallUnits.px,\n\tallUnits[ '%' ],\n\tallUnits.em,\n\tallUnits.rem,\n\tallUnits.vw,\n\tallUnits.vh,\n];\n\nexport const DEFAULT_UNIT = allUnits.px;\n\n/**\n * Handles legacy value + unit handling.\n * This component use to manage both incoming value and units separately.\n *\n * Moving forward, ideally the value should be a string that contains both\n * the value and unit, example: '10px'\n *\n * @param rawValue The raw value as a string (may or may not contain the unit)\n * @param fallbackUnit The unit used as a fallback, if not unit is detected in the `value`\n * @param allowedUnits Units to derive from.\n * @return The extracted quantity and unit. The quantity can be `undefined` in case the raw value\n * could not be parsed to a number correctly. The unit can be `undefined` in case the unit parse\n * from the raw value could not be matched against the list of allowed units.\n */\nexport function getParsedQuantityAndUnit(\n\trawValue?: string | number,\n\tfallbackUnit?: string,\n\tallowedUnits?: WPUnitControlUnit[]\n): [ number | undefined, string | undefined ] {\n\tconst initialValue = fallbackUnit\n\t\t? `${ rawValue ?? '' }${ fallbackUnit }`\n\t\t: rawValue;\n\n\treturn parseQuantityAndUnitFromRawValue( initialValue, allowedUnits );\n}\n\n/**\n * Checks if units are defined.\n *\n * @param units List of units.\n * @return Whether the list actually contains any units.\n */\nexport function hasUnits( units?: WPUnitControlUnit[] ): boolean {\n\t// Although the `isArray` check shouldn't be necessary (given the signature of\n\t// this typed function), it's better to stay on the side of caution, since\n\t// this function may be called from un-typed environments.\n\treturn Array.isArray( units ) && !! units.length;\n}\n\n/**\n * Parses a quantity and unit from a raw string value, given a list of allowed\n * units and otherwise falling back to the default unit.\n *\n * @param rawValue The raw value as a string (may or may not contain the unit)\n * @param allowedUnits Units to derive from.\n * @return The extracted quantity and unit. The quantity can be `undefined` in case the raw value\n * could not be parsed to a number correctly. The unit can be `undefined` in case the unit parsed\n * from the raw value could not be matched against the list of allowed units.\n */\nexport function parseQuantityAndUnitFromRawValue(\n\trawValue?: string | number,\n\tallowedUnits: WPUnitControlUnit[] = ALL_CSS_UNITS\n): [ number | undefined, string | undefined ] {\n\tlet trimmedValue;\n\tlet quantityToReturn;\n\n\tif ( typeof rawValue !== 'undefined' || rawValue === null ) {\n\t\ttrimmedValue = `${ rawValue }`.trim();\n\t\tconst parsedQuantity = parseFloat( trimmedValue );\n\t\tquantityToReturn = ! isFinite( parsedQuantity )\n\t\t\t? undefined\n\t\t\t: parsedQuantity;\n\t}\n\n\tconst unitMatch = trimmedValue?.match( /[\\d.\\-\\+]*\\s*(.*)/ );\n\tconst matchedUnit = unitMatch?.[ 1 ]?.toLowerCase();\n\tlet unitToReturn: string | undefined;\n\tif ( hasUnits( allowedUnits ) ) {\n\t\tconst match = allowedUnits.find(\n\t\t\t( item ) => item.value === matchedUnit\n\t\t);\n\t\tunitToReturn = match?.value;\n\t} else {\n\t\tunitToReturn = DEFAULT_UNIT.value;\n\t}\n\n\treturn [ quantityToReturn, unitToReturn ];\n}\n\n/**\n * Parses quantity and unit from a raw value. Validates parsed value, using fallback\n * value if invalid.\n *\n * @param rawValue The next value.\n * @param allowedUnits Units to derive from.\n * @param fallbackQuantity The fallback quantity, used in case it's not possible to parse a valid quantity from the raw value.\n * @param fallbackUnit The fallback unit, used in case it's not possible to parse a valid unit from the raw value.\n * @return The extracted quantity and unit. The quantity can be `undefined` in case the raw value\n * could not be parsed to a number correctly, and the `fallbackQuantity` was also `undefined`. The\n * unit can be `undefined` only if the unit parsed from the raw value could not be matched against\n * the list of allowed units, the `fallbackQuantity` is also `undefined` and the list of\n * `allowedUnits` is passed empty.\n */\nexport function getValidParsedQuantityAndUnit(\n\trawValue: string | number,\n\tallowedUnits: WPUnitControlUnit[],\n\tfallbackQuantity?: number,\n\tfallbackUnit?: string\n): [ number | undefined, string | undefined ] {\n\tconst [ parsedQuantity, parsedUnit ] = parseQuantityAndUnitFromRawValue(\n\t\trawValue,\n\t\tallowedUnits\n\t);\n\n\t// The parsed value from `parseQuantityAndUnitFromRawValue` should now be\n\t// either a real number or undefined. If undefined, use the fallback value.\n\tconst quantityToReturn = parsedQuantity ?? fallbackQuantity;\n\n\t// If no unit is parsed from the raw value, or if the fallback unit is not\n\t// defined, use the first value from the list of allowed units as fallback.\n\tlet unitToReturn = parsedUnit || fallbackUnit;\n\n\tif ( ! unitToReturn && hasUnits( allowedUnits ) ) {\n\t\tunitToReturn = allowedUnits[ 0 ].value;\n\t}\n\n\treturn [ quantityToReturn, unitToReturn ];\n}\n\n/**\n * Takes a unit value and finds the matching accessibility label for the\n * unit abbreviation.\n *\n * @param unit Unit value (example: `px`)\n * @return a11y label for the unit abbreviation\n */\nexport function getAccessibleLabelForUnit( unit: string ): string | undefined {\n\tconst match = ALL_CSS_UNITS.find( ( item ) => item.value === unit );\n\treturn match?.a11yLabel ? match?.a11yLabel : match?.value;\n}\n\n/**\n * Filters available units based on values defined a list of allowed unit values.\n *\n * @param allowedUnitValues Collection of allowed unit value strings.\n * @param availableUnits Collection of available unit objects.\n * @return Filtered units.\n */\nexport function filterUnitsWithSettings(\n\tallowedUnitValues: string[] = [],\n\tavailableUnits: WPUnitControlUnit[]\n): WPUnitControlUnit[] {\n\t// Although the `isArray` check shouldn't be necessary (given the signature of\n\t// this typed function), it's better to stay on the side of caution, since\n\t// this function may be called from un-typed environments.\n\treturn Array.isArray( availableUnits )\n\t\t? availableUnits.filter( ( unit ) =>\n\t\t\t\tallowedUnitValues.includes( unit.value )\n\t\t )\n\t\t: [];\n}\n\n/**\n * Custom hook to retrieve and consolidate units setting from add_theme_support().\n * TODO: ideally this hook shouldn't be needed\n * https://github.com/WordPress/gutenberg/pull/31822#discussion_r633280823\n *\n * @param args An object containing units, settingPath & defaultUnits.\n * @param args.units Collection of all potentially available units.\n * @param args.availableUnits Collection of unit value strings for filtering available units.\n * @param args.defaultValues Collection of default values for defined units. Example: `{ px: 350, em: 15 }`.\n *\n * @return Filtered list of units, with their default values updated following the `defaultValues`\n * argument's property.\n */\nexport const useCustomUnits = ( {\n\tunits = ALL_CSS_UNITS,\n\tavailableUnits = [],\n\tdefaultValues,\n}: {\n\tunits?: WPUnitControlUnit[];\n\tavailableUnits?: string[];\n\tdefaultValues: Record< string, number >;\n} ): WPUnitControlUnit[] => {\n\tconst customUnitsToReturn = filterUnitsWithSettings(\n\t\tavailableUnits,\n\t\tunits\n\t);\n\n\tif ( defaultValues ) {\n\t\tcustomUnitsToReturn.forEach( ( unit, i ) => {\n\t\t\tif ( defaultValues[ unit.value ] ) {\n\t\t\t\tconst [ parsedDefaultValue ] = parseQuantityAndUnitFromRawValue(\n\t\t\t\t\tdefaultValues[ unit.value ]\n\t\t\t\t);\n\n\t\t\t\tcustomUnitsToReturn[ i ].default = parsedDefaultValue;\n\t\t\t}\n\t\t} );\n\t}\n\n\treturn customUnitsToReturn;\n};\n\n/**\n * Get available units with the unit for the currently selected value\n * prepended if it is not available in the list of units.\n *\n * This is useful to ensure that the current value's unit is always\n * accurately displayed in the UI, even if the intention is to hide\n * the availability of that unit.\n *\n * @param rawValue Selected value to parse.\n * @param legacyUnit Legacy unit value, if rawValue needs it appended.\n * @param units List of available units.\n *\n * @return A collection of units containing the unit for the current value.\n */\nexport function getUnitsWithCurrentUnit(\n\trawValue?: string | number,\n\tlegacyUnit?: string,\n\tunits: WPUnitControlUnit[] = ALL_CSS_UNITS\n): WPUnitControlUnit[] {\n\tconst unitsToReturn = Array.isArray( units ) ? [ ...units ] : [];\n\tconst [ , currentUnit ] = getParsedQuantityAndUnit(\n\t\trawValue,\n\t\tlegacyUnit,\n\t\tALL_CSS_UNITS\n\t);\n\n\tif (\n\t\tcurrentUnit &&\n\t\t! unitsToReturn.some( ( unit ) => unit.value === currentUnit )\n\t) {\n\t\tif ( allUnits[ currentUnit ] ) {\n\t\t\tunitsToReturn.unshift( allUnits[ currentUnit ] );\n\t\t}\n\t}\n\n\treturn unitsToReturn;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/utils/breakpoint-values.js"],"names":["huge","wide","large","medium","small","mobile"],"mappings":";;;;;;eAAe;AACdA,EAAAA,IAAI,EAAE,QADQ;AAEdC,EAAAA,IAAI,EAAE,QAFQ;AAGd,aAAW,QAHG;AAIdC,EAAAA,KAAK,EAAE,OAJO;AAIE;AAChBC,EAAAA,MAAM,EAAE,OALM;AAKG;AACjBC,EAAAA,KAAK,EAAE,OANO;AAOdC,EAAAA,MAAM,EAAE,OAPM;AAQd,eAAa;AARC,C","sourcesContent":["export default {\n\thuge: '1440px',\n\twide: '1280px',\n\t'x-large': '1080px',\n\tlarge: '960px', // admin sidebar auto folds\n\tmedium: '782px', //
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/utils/breakpoint-values.js"],"names":["huge","wide","large","medium","small","mobile"],"mappings":";;;;;;eAAe;AACdA,EAAAA,IAAI,EAAE,QADQ;AAEdC,EAAAA,IAAI,EAAE,QAFQ;AAGd,aAAW,QAHG;AAIdC,EAAAA,KAAK,EAAE,OAJO;AAIE;AAChBC,EAAAA,MAAM,EAAE,OALM;AAKG;AACjBC,EAAAA,KAAK,EAAE,OANO;AAOdC,EAAAA,MAAM,EAAE,OAPM;AAQd,eAAa;AARC,C","sourcesContent":["export default {\n\thuge: '1440px',\n\twide: '1280px',\n\t'x-large': '1080px',\n\tlarge: '960px', // admin sidebar auto folds\n\tmedium: '782px', // Adminbar goes big.\n\tsmall: '600px',\n\tmobile: '480px',\n\t'zoomed-in': '280px',\n};\n"]}
|
|
@@ -166,7 +166,7 @@ exports.ALERT = ALERT;
|
|
|
166
166
|
const ADMIN = {
|
|
167
167
|
theme: `var( --wp-admin-theme-color, ${BLUE.wordpress[700]})`,
|
|
168
168
|
themeDark10: `var( --wp-admin-theme-color-darker-10, ${BLUE.medium.focus})`
|
|
169
|
-
}; // Namespaced values for raw colors hex codes
|
|
169
|
+
}; // Namespaced values for raw colors hex codes.
|
|
170
170
|
|
|
171
171
|
exports.ADMIN = ADMIN;
|
|
172
172
|
const UI = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/utils/colors-values.js"],"names":["BASE","black","white","G2","blue","medium","focus","focusDark","gray","darkGray","primary","heading","mediumGray","text","lightGray","ui","secondary","tertiary","DARK_GRAY","placeholder","DARK_OPACITY","backgroundFill","DARK_OPACITY_LIGHT","LIGHT_GRAY","LIGHT_OPACITY_LIGHT","BLUE","wordpress","dark","highlight","ALERT","yellow","red","green","ADMIN","theme","themeDark10","UI","background","backgroundDisabled","border","borderHover","borderFocus","borderDisabled","borderLight","label","textDisabled","textDark","textLight","COLORS","darkOpacity","darkOpacityLight","lightGrayLight","alert","admin"],"mappings":";;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AAGO,MAAMA,IAAI,GAAG;AACnBC,EAAAA,KAAK,EAAE,MADY;AAEnBC,EAAAA,KAAK,EAAE;AAFY,CAAb;AAKP;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMC,EAAE,GAAG;AACjBC,EAAAA,IAAI,EAAE;AACLC,IAAAA,MAAM,EAAE;AACPC,MAAAA,KAAK,EAAE,SADA;AAEPC,MAAAA,SAAS,EAAE;AAFJ;AADH,GADW;AAOjBC,EAAAA,IAAI,EAAE;AACL,SAAK,SADA;AAEL,SAAK,SAFA;AAEW;AAChB,SAAK,SAHA;AAGW;AAChB,SAAK,MAJA;AAKL,SAAK,MALA;AAKQ;AACb,SAAK,SANA;AAMW;AAChB,SAAK,SAPA,CAOW;;AAPX,GAPW;AAgBjBC,EAAAA,QAAQ,EAAE;AACTC,IAAAA,OAAO,EAAE,SADA;AAETC,IAAAA,OAAO,EAAE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AAA,WAAW,EAAExC,EAAE,CAACK,IAAH,CAAS,GAAT,CARI;AASjBoC,EAAAA,KAAK,EAAE1B,SAAS,CAAE,GAAF,CATC;AAUjB2B,EAAAA,YAAY,EAAE3B,SAAS,CAAE,GAAF,CAVN;AAWjB4B,EAAAA,QAAQ,EAAE9C,IAAI,CAACE,KAXE;AAYjB6C,EAAAA,SAAS,EAAE/C,IAAI,CAACC;AAZC,CAAX;;AAeA,MAAM+C,MAAM,GAAG,EACrB,GAAGhD,IADkB;AAErBS,EAAAA,QAAQ,EAAE,mBAAO,EAAP,EAAWS,SAAX,EAAsBf,EAAE,CAACM,QAAzB,CAFW;AAGrBwC,EAAAA,WAAW,EAAE7B,YAHQ;AAIrB8B,EAAAA,gBAAgB,EAAE5B,kBAJG;AAKrBV,EAAAA,UAAU,EAAET,EAAE,CAACS,UALM;AAMrBJ,EAAAA,IAAI,EAAEL,EAAE,CAACK,IANY;AAOrBM,EAAAA,SAAS,EAAE,mBAAO,EAAP,EAAWS,UAAX,EAAuBpB,EAAE,CAACW,SAA1B,CAPU;AAQrBqC,EAAAA,cAAc,EAAE3B,mBARK;AASrBpB,EAAAA,IAAI,EAAE,mBAAO,EAAP,EAAWqB,IAAX,EAAiBtB,EAAE,CAACC,IAApB,CATe;AAUrBgD,EAAAA,KAAK,EAAEvB,KAVc;AAWrBwB,EAAAA,KAAK,EAAEpB,KAXc;AAYrBlB,EAAAA,EAAE,EAAEqB;AAZiB,CAAf;;eAeQY,M","sourcesContent":["/**\n * External dependencies\n */\nimport { merge } from 'lodash';\n\n/**\n * Internal dependencies\n */\nimport { rgba } from './colors';\n\nexport const BASE = {\n\tblack: '#000',\n\twhite: '#fff',\n};\n\n/**\n * TODO: Continue to update values as \"G2\" design evolves.\n *\n * \"G2\" refers to the movement to advance the interface of the block editor.\n * https://github.com/WordPress/gutenberg/issues/18667\n */\nexport const G2 = {\n\tblue: {\n\t\tmedium: {\n\t\t\tfocus: '#007cba',\n\t\t\tfocusDark: '#fff',\n\t\t},\n\t},\n\tgray: {\n\t\t900: '#1e1e1e',\n\t\t700: '#757575', // Meets 4.6:1 text contrast against white.\n\t\t600: '#949494', // Meets 3:1 UI or large text contrast against white.\n\t\t400: '#ccc',\n\t\t300: '#ddd', // Used for most borders.\n\t\t200: '#e0e0e0', // Used sparingly for light borders.\n\t\t100: '#f0f0f0', // Used for light gray backgrounds.\n\t},\n\tdarkGray: {\n\t\tprimary: '#1e1e1e',\n\t\theading: '#050505',\n\t},\n\tmediumGray: {\n\t\ttext: '#757575',\n\t},\n\tlightGray: {\n\t\tui: '#949494',\n\t\tsecondary: '#ccc',\n\t\ttertiary: '#e7e8e9',\n\t},\n};\n\nexport const DARK_GRAY = {\n\t900: '#191e23',\n\t800: '#23282d',\n\t700: '#32373c',\n\t600: '#40464d',\n\t500: '#555d66', // Use this most of the time for dark items.\n\t400: '#606a73',\n\t300: '#6c7781', // Lightest gray that can be used for AA text contrast.\n\t200: '#7e8993',\n\t150: '#8d96a0', // Lightest gray that can be used for AA non-text contrast.\n\t100: '#8f98a1',\n\tplaceholder: rgba( G2.gray[ 900 ], 0.62 ),\n};\n\nexport const DARK_OPACITY = {\n\t900: rgba( '#000510', 0.9 ),\n\t800: rgba( '#00000a', 0.85 ),\n\t700: rgba( '#06060b', 0.8 ),\n\t600: rgba( '#000913', 0.75 ),\n\t500: rgba( '#0a1829', 0.7 ),\n\t400: rgba( '#0a1829', 0.65 ),\n\t300: rgba( '#0e1c2e', 0.62 ),\n\t200: rgba( '#162435', 0.55 ),\n\t100: rgba( '#223443', 0.5 ),\n\tbackgroundFill: rgba( DARK_GRAY[ 700 ], 0.7 ),\n};\n\nexport const DARK_OPACITY_LIGHT = {\n\t900: rgba( '#304455', 0.45 ),\n\t800: rgba( '#425863', 0.4 ),\n\t700: rgba( '#667886', 0.35 ),\n\t600: rgba( '#7b86a2', 0.3 ),\n\t500: rgba( '#9197a2', 0.25 ),\n\t400: rgba( '#95959c', 0.2 ),\n\t300: rgba( '#829493', 0.15 ),\n\t200: rgba( '#8b8b96', 0.1 ),\n\t100: rgba( '#747474', 0.05 ),\n};\n\nexport const LIGHT_GRAY = {\n\t900: '#a2aab2',\n\t800: '#b5bcc2',\n\t700: '#ccd0d4',\n\t600: '#d7dade',\n\t500: '#e2e4e7', // Good for \"grayed\" items and borders.\n\t400: '#e8eaeb', // Good for \"readonly\" input fields and special text selection.\n\t300: '#edeff0',\n\t200: '#f3f4f5',\n\t100: '#f8f9f9',\n\tplaceholder: rgba( BASE.white, 0.65 ),\n};\n\nexport const LIGHT_OPACITY_LIGHT = {\n\t900: rgba( BASE.white, 0.5 ),\n\t800: rgba( BASE.white, 0.45 ),\n\t700: rgba( BASE.white, 0.4 ),\n\t600: rgba( BASE.white, 0.35 ),\n\t500: rgba( BASE.white, 0.3 ),\n\t400: rgba( BASE.white, 0.25 ),\n\t300: rgba( BASE.white, 0.2 ),\n\t200: rgba( BASE.white, 0.15 ),\n\t100: rgba( BASE.white, 0.1 ),\n\tbackgroundFill: rgba( LIGHT_GRAY[ 300 ], 0.8 ),\n};\n\n// Additional colors.\n// Some are from https://make.wordpress.org/design/handbook/foundations/colors/.\n\nexport const BLUE = {\n\twordpress: {\n\t\t700: '#00669b',\n\t},\n\tdark: {\n\t\t900: '#0071a1',\n\t},\n\tmedium: {\n\t\t900: '#006589',\n\t\t800: '#00739c',\n\t\t700: '#007fac',\n\t\t600: '#008dbe',\n\t\t500: '#00a0d2',\n\t\t400: '#33b3db',\n\t\t300: '#66c6e4',\n\t\t200: '#bfe7f3',\n\t\t100: '#e5f5fa',\n\t\thighlight: '#b3e7fe',\n\t\tfocus: '#007cba',\n\t},\n};\n\nexport const ALERT = {\n\tyellow: '#f0b849',\n\tred: '#d94f4f',\n\tgreen: '#4ab866',\n};\n\nexport const ADMIN = {\n\ttheme: `var( --wp-admin-theme-color, ${ BLUE.wordpress[ 700 ] })`,\n\tthemeDark10: `var( --wp-admin-theme-color-darker-10, ${ BLUE.medium.focus })`,\n};\n\n// Namespaced values for raw colors hex codes
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/utils/colors-values.js"],"names":["BASE","black","white","G2","blue","medium","focus","focusDark","gray","darkGray","primary","heading","mediumGray","text","lightGray","ui","secondary","tertiary","DARK_GRAY","placeholder","DARK_OPACITY","backgroundFill","DARK_OPACITY_LIGHT","LIGHT_GRAY","LIGHT_OPACITY_LIGHT","BLUE","wordpress","dark","highlight","ALERT","yellow","red","green","ADMIN","theme","themeDark10","UI","background","backgroundDisabled","border","borderHover","borderFocus","borderDisabled","borderLight","label","textDisabled","textDark","textLight","COLORS","darkOpacity","darkOpacityLight","lightGrayLight","alert","admin"],"mappings":";;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AAGO,MAAMA,IAAI,GAAG;AACnBC,EAAAA,KAAK,EAAE,MADY;AAEnBC,EAAAA,KAAK,EAAE;AAFY,CAAb;AAKP;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMC,EAAE,GAAG;AACjBC,EAAAA,IAAI,EAAE;AACLC,IAAAA,MAAM,EAAE;AACPC,MAAAA,KAAK,EAAE,SADA;AAEPC,MAAAA,SAAS,EAAE;AAFJ;AADH,GADW;AAOjBC,EAAAA,IAAI,EAAE;AACL,SAAK,SADA;AAEL,SAAK,SAFA;AAEW;AAChB,SAAK,SAHA;AAGW;AAChB,SAAK,MAJA;AAKL,SAAK,MALA;AAKQ;AACb,SAAK,SANA;AAMW;AAChB,SAAK,SAPA,CAOW;;AAPX,GAPW;AAgBjBC,EAAAA,QAAQ,EAAE;AACTC,IAAAA,OAAO,EAAE,SADA;AAETC,IAAAA,OAAO,EAAE;AAFA,GAhBO;AAoBjBC,EAAAA,UAAU,EAAE;AACXC,IAAAA,IAAI,EAAE;AADK,GApBK;AAuBjBC,EAAAA,SAAS,EAAE;AACVC,IAAAA,EAAE,EAAE,SADM;AAEVC,IAAAA,SAAS,EAAE,MAFD;AAGVC,IAAAA,QAAQ,EAAE;AAHA;AAvBM,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AAYjB6C,EAAAA,SAAS,EAAE/C,IAAI,CAACC;AAZC,CAAX;;AAeA,MAAM+C,MAAM,GAAG,EACrB,GAAGhD,IADkB;AAErBS,EAAAA,QAAQ,EAAE,mBAAO,EAAP,EAAWS,SAAX,EAAsBf,EAAE,CAACM,QAAzB,CAFW;AAGrBwC,EAAAA,WAAW,EAAE7B,YAHQ;AAIrB8B,EAAAA,gBAAgB,EAAE5B,kBAJG;AAKrBV,EAAAA,UAAU,EAAET,EAAE,CAACS,UALM;AAMrBJ,EAAAA,IAAI,EAAEL,EAAE,CAACK,IANY;AAOrBM,EAAAA,SAAS,EAAE,mBAAO,EAAP,EAAWS,UAAX,EAAuBpB,EAAE,CAACW,SAA1B,CAPU;AAQrBqC,EAAAA,cAAc,EAAE3B,mBARK;AASrBpB,EAAAA,IAAI,EAAE,mBAAO,EAAP,EAAWqB,IAAX,EAAiBtB,EAAE,CAACC,IAApB,CATe;AAUrBgD,EAAAA,KAAK,EAAEvB,KAVc;AAWrBwB,EAAAA,KAAK,EAAEpB,KAXc;AAYrBlB,EAAAA,EAAE,EAAEqB;AAZiB,CAAf;;eAeQY,M","sourcesContent":["/**\n * External dependencies\n */\nimport { merge } from 'lodash';\n\n/**\n * Internal dependencies\n */\nimport { rgba } from './colors';\n\nexport const BASE = {\n\tblack: '#000',\n\twhite: '#fff',\n};\n\n/**\n * TODO: Continue to update values as \"G2\" design evolves.\n *\n * \"G2\" refers to the movement to advance the interface of the block editor.\n * https://github.com/WordPress/gutenberg/issues/18667\n */\nexport const G2 = {\n\tblue: {\n\t\tmedium: {\n\t\t\tfocus: '#007cba',\n\t\t\tfocusDark: '#fff',\n\t\t},\n\t},\n\tgray: {\n\t\t900: '#1e1e1e',\n\t\t700: '#757575', // Meets 4.6:1 text contrast against white.\n\t\t600: '#949494', // Meets 3:1 UI or large text contrast against white.\n\t\t400: '#ccc',\n\t\t300: '#ddd', // Used for most borders.\n\t\t200: '#e0e0e0', // Used sparingly for light borders.\n\t\t100: '#f0f0f0', // Used for light gray backgrounds.\n\t},\n\tdarkGray: {\n\t\tprimary: '#1e1e1e',\n\t\theading: '#050505',\n\t},\n\tmediumGray: {\n\t\ttext: '#757575',\n\t},\n\tlightGray: {\n\t\tui: '#949494',\n\t\tsecondary: '#ccc',\n\t\ttertiary: '#e7e8e9',\n\t},\n};\n\nexport const DARK_GRAY = {\n\t900: '#191e23',\n\t800: '#23282d',\n\t700: '#32373c',\n\t600: '#40464d',\n\t500: '#555d66', // Use this most of the time for dark items.\n\t400: '#606a73',\n\t300: '#6c7781', // Lightest gray that can be used for AA text contrast.\n\t200: '#7e8993',\n\t150: '#8d96a0', // Lightest gray that can be used for AA non-text contrast.\n\t100: '#8f98a1',\n\tplaceholder: rgba( G2.gray[ 900 ], 0.62 ),\n};\n\nexport const DARK_OPACITY = {\n\t900: rgba( '#000510', 0.9 ),\n\t800: rgba( '#00000a', 0.85 ),\n\t700: rgba( '#06060b', 0.8 ),\n\t600: rgba( '#000913', 0.75 ),\n\t500: rgba( '#0a1829', 0.7 ),\n\t400: rgba( '#0a1829', 0.65 ),\n\t300: rgba( '#0e1c2e', 0.62 ),\n\t200: rgba( '#162435', 0.55 ),\n\t100: rgba( '#223443', 0.5 ),\n\tbackgroundFill: rgba( DARK_GRAY[ 700 ], 0.7 ),\n};\n\nexport const DARK_OPACITY_LIGHT = {\n\t900: rgba( '#304455', 0.45 ),\n\t800: rgba( '#425863', 0.4 ),\n\t700: rgba( '#667886', 0.35 ),\n\t600: rgba( '#7b86a2', 0.3 ),\n\t500: rgba( '#9197a2', 0.25 ),\n\t400: rgba( '#95959c', 0.2 ),\n\t300: rgba( '#829493', 0.15 ),\n\t200: rgba( '#8b8b96', 0.1 ),\n\t100: rgba( '#747474', 0.05 ),\n};\n\nexport const LIGHT_GRAY = {\n\t900: '#a2aab2',\n\t800: '#b5bcc2',\n\t700: '#ccd0d4',\n\t600: '#d7dade',\n\t500: '#e2e4e7', // Good for \"grayed\" items and borders.\n\t400: '#e8eaeb', // Good for \"readonly\" input fields and special text selection.\n\t300: '#edeff0',\n\t200: '#f3f4f5',\n\t100: '#f8f9f9',\n\tplaceholder: rgba( BASE.white, 0.65 ),\n};\n\nexport const LIGHT_OPACITY_LIGHT = {\n\t900: rgba( BASE.white, 0.5 ),\n\t800: rgba( BASE.white, 0.45 ),\n\t700: rgba( BASE.white, 0.4 ),\n\t600: rgba( BASE.white, 0.35 ),\n\t500: rgba( BASE.white, 0.3 ),\n\t400: rgba( BASE.white, 0.25 ),\n\t300: rgba( BASE.white, 0.2 ),\n\t200: rgba( BASE.white, 0.15 ),\n\t100: rgba( BASE.white, 0.1 ),\n\tbackgroundFill: rgba( LIGHT_GRAY[ 300 ], 0.8 ),\n};\n\n// Additional colors.\n// Some are from https://make.wordpress.org/design/handbook/foundations/colors/.\n\nexport const BLUE = {\n\twordpress: {\n\t\t700: '#00669b',\n\t},\n\tdark: {\n\t\t900: '#0071a1',\n\t},\n\tmedium: {\n\t\t900: '#006589',\n\t\t800: '#00739c',\n\t\t700: '#007fac',\n\t\t600: '#008dbe',\n\t\t500: '#00a0d2',\n\t\t400: '#33b3db',\n\t\t300: '#66c6e4',\n\t\t200: '#bfe7f3',\n\t\t100: '#e5f5fa',\n\t\thighlight: '#b3e7fe',\n\t\tfocus: '#007cba',\n\t},\n};\n\nexport const ALERT = {\n\tyellow: '#f0b849',\n\tred: '#d94f4f',\n\tgreen: '#4ab866',\n};\n\nexport const ADMIN = {\n\ttheme: `var( --wp-admin-theme-color, ${ BLUE.wordpress[ 700 ] })`,\n\tthemeDark10: `var( --wp-admin-theme-color-darker-10, ${ BLUE.medium.focus })`,\n};\n\n// Namespaced values for raw colors hex codes.\nexport const UI = {\n\ttheme: ADMIN.theme,\n\tbackground: BASE.white,\n\tbackgroundDisabled: LIGHT_GRAY[ 200 ],\n\tborder: G2.gray[ 700 ],\n\tborderHover: G2.gray[ 700 ],\n\tborderFocus: ADMIN.themeDark10,\n\tborderDisabled: G2.gray[ 400 ],\n\tborderLight: G2.gray[ 300 ],\n\tlabel: DARK_GRAY[ 500 ],\n\ttextDisabled: DARK_GRAY[ 150 ],\n\ttextDark: BASE.white,\n\ttextLight: BASE.black,\n};\n\nexport const COLORS = {\n\t...BASE,\n\tdarkGray: merge( {}, DARK_GRAY, G2.darkGray ),\n\tdarkOpacity: DARK_OPACITY,\n\tdarkOpacityLight: DARK_OPACITY_LIGHT,\n\tmediumGray: G2.mediumGray,\n\tgray: G2.gray,\n\tlightGray: merge( {}, LIGHT_GRAY, G2.lightGray ),\n\tlightGrayLight: LIGHT_OPACITY_LIGHT,\n\tblue: merge( {}, BLUE, G2.blue ),\n\talert: ALERT,\n\tadmin: ADMIN,\n\tui: UI,\n};\n\nexport default COLORS;\n"]}
|
|
@@ -19,7 +19,7 @@ export const ALIGNMENT_LABEL = {
|
|
|
19
19
|
'bottom left': __('Bottom Left'),
|
|
20
20
|
'bottom center': __('Bottom Center'),
|
|
21
21
|
'bottom right': __('Bottom Right')
|
|
22
|
-
}; // Transforms GRID into a flat Array of values
|
|
22
|
+
}; // Transforms GRID into a flat Array of values.
|
|
23
23
|
|
|
24
24
|
export const ALIGNMENTS = flattenDeep(GRID);
|
|
25
25
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/alignment-matrix-control/utils.js"],"names":["flattenDeep","__","GRID","ALIGNMENT_LABEL","ALIGNMENTS","transformValue","value","nextValue","replace","getItemId","prefixId","valueId","getAlignmentIndex","alignment","item","index","indexOf","undefined"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAT,QAA4B,QAA5B;AAEA;AACA;AACA;;AACA,SAASC,EAAT,QAAmB,iBAAnB;AAEA,OAAO,MAAMC,IAAI,GAAG,CACnB,CAAE,UAAF,EAAc,YAAd,EAA4B,WAA5B,CADmB,EAEnB,CAAE,aAAF,EAAiB,eAAjB,EAAkC,cAAlC,CAFmB,EAGnB,CAAE,aAAF,EAAiB,eAAjB,EAAkC,cAAlC,CA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;AAEA,SAAOC,KAAK,GAAG,CAAC,CAAT,GAAaA,KAAb,GAAqBE,SAA5B;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { flattenDeep } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\nexport const GRID = [\n\t[ 'top left', 'top center', 'top right' ],\n\t[ 'center left', 'center center', 'center right' ],\n\t[ 'bottom left', 'bottom center', 'bottom right' ],\n];\n\n// Stored as map as i18n __() only accepts strings (not variables)\nexport const ALIGNMENT_LABEL = {\n\t'top left': __( 'Top Left' ),\n\t'top center': __( 'Top Center' ),\n\t'top right': __( 'Top Right' ),\n\t'center left': __( 'Center Left' ),\n\t'center center': __( 'Center Center' ),\n\t'center right': __( 'Center Right' ),\n\t'bottom left': __( 'Bottom Left' ),\n\t'bottom center': __( 'Bottom Center' ),\n\t'bottom right': __( 'Bottom Right' ),\n};\n\n// Transforms GRID into a flat Array of values
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/alignment-matrix-control/utils.js"],"names":["flattenDeep","__","GRID","ALIGNMENT_LABEL","ALIGNMENTS","transformValue","value","nextValue","replace","getItemId","prefixId","valueId","getAlignmentIndex","alignment","item","index","indexOf","undefined"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAT,QAA4B,QAA5B;AAEA;AACA;AACA;;AACA,SAASC,EAAT,QAAmB,iBAAnB;AAEA,OAAO,MAAMC,IAAI,GAAG,CACnB,CAAE,UAAF,EAAc,YAAd,EAA4B,WAA5B,CADmB,EAEnB,CAAE,aAAF,EAAiB,eAAjB,EAAkC,cAAlC,CAFmB,EAGnB,CAAE,aAAF,EAAiB,eAAjB,EAAkC,cAAlC,CAHmB,CAAb,C,CAMP;;AACA,OAAO,MAAMC,eAAe,GAAG;AAC9B,cAAYF,EAAE,CAAE,UAAF,CADgB;AAE9B,gBAAcA,EAAE,CAAE,YAAF,CAFc;AAG9B,eAAaA,EAAE,CAAE,WAAF,CAHe;AAI9B,iBAAeA,EAAE,CAAE,aAAF,CAJa;AAK9B,mBAAiBA,EAAE,CAAE,eAAF,CALW;AAM9B,kBAAgBA,EAAE,CAAE,cAAF,CANY;AAO9B,iBAAeA,EAAE,CAAE,aAAF,CAPa;AAQ9B,mBAAiBA,EAAE,CAAE,eAAF,CARW;AAS9B,kBAAgBA,EAAE,CAAE,cAAF;AATY,CAAxB,C,CAYP;;AACA,OAAO,MAAMG,UAAU,GAAGJ,WAAW,CAAEE,IAAF,CAA9B;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASG,cAAT,CAAyBC,KAAzB,EAAiC;AACvC,QAAMC,SAAS,GAAGD,KAAK,KAAK,QAAV,GAAqB,eAArB,GAAuCA,KAAzD;AAEA,SAAOC,SAAS,CAACC,OAAV,CAAmB,GAAnB,EAAwB,GAAxB,CAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,SAAT,CAAoBC,QAApB,EAA8BJ,KAA9B,EAAsC;AAC5C,QAAMK,OAAO,GAAGN,cAAc,CAAEC,KAAF,CAAd,CAAwBE,OAAxB,CAAiC,GAAjC,EAAsC,GAAtC,CAAhB;AAEA,SAAQ,GAAGE,QAAU,IAAIC,OAAS,EAAlC;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,iBAAT,GAAmD;AAAA,MAAvBC,SAAuB,uEAAX,QAAW;AACzD,QAAMC,IAAI,GAAGT,cAAc,CAAEQ,SAAF,CAAd,CAA4BL,OAA5B,CAAqC,GAArC,EAA0C,GAA1C,CAAb;AACA,QAAMO,KAAK,GAAGX,UAAU,CAACY,OAAX,CAAoBF,IAApB,CAAd;AAEA,SAAOC,KAAK,GAAG,CAAC,CAAT,GAAaA,KAAb,GAAqBE,SAA5B;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { flattenDeep } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\nexport const GRID = [\n\t[ 'top left', 'top center', 'top right' ],\n\t[ 'center left', 'center center', 'center right' ],\n\t[ 'bottom left', 'bottom center', 'bottom right' ],\n];\n\n// Stored as map as i18n __() only accepts strings (not variables)\nexport const ALIGNMENT_LABEL = {\n\t'top left': __( 'Top Left' ),\n\t'top center': __( 'Top Center' ),\n\t'top right': __( 'Top Right' ),\n\t'center left': __( 'Center Left' ),\n\t'center center': __( 'Center Center' ),\n\t'center right': __( 'Center Right' ),\n\t'bottom left': __( 'Bottom Left' ),\n\t'bottom center': __( 'Bottom Center' ),\n\t'bottom right': __( 'Bottom Right' ),\n};\n\n// Transforms GRID into a flat Array of values.\nexport const ALIGNMENTS = flattenDeep( GRID );\n\n/**\n * Parses and transforms an incoming value to better match the alignment values\n *\n * @param {string} value An alignment value to parse.\n *\n * @return {string} The parsed value.\n */\nexport function transformValue( value ) {\n\tconst nextValue = value === 'center' ? 'center center' : value;\n\n\treturn nextValue.replace( '-', ' ' );\n}\n\n/**\n * Creates an item ID based on a prefix ID and an alignment value.\n *\n * @param {string} prefixId An ID to prefix.\n * @param {string} value An alignment value.\n *\n * @return {string} The item id.\n */\nexport function getItemId( prefixId, value ) {\n\tconst valueId = transformValue( value ).replace( ' ', '-' );\n\n\treturn `${ prefixId }-${ valueId }`;\n}\n\n/**\n * Retrieves the alignment index from a value.\n *\n * @param {string} alignment Value to check.\n *\n * @return {number} The index of a matching alignment.\n */\nexport function getAlignmentIndex( alignment = 'center' ) {\n\tconst item = transformValue( alignment ).replace( '-', ' ' );\n\tconst index = ALIGNMENTS.indexOf( item );\n\n\treturn index > -1 ? index : undefined;\n}\n"]}
|
|
@@ -40,7 +40,7 @@ function AngleCircle(_ref) {
|
|
|
40
40
|
} = angleCircleRef.current; // Prevent (drag) mouse events from selecting and accidentally
|
|
41
41
|
// triggering actions from other elements.
|
|
42
42
|
|
|
43
|
-
event.preventDefault(); // Ensure the input isn't focused as preventDefault would leave it
|
|
43
|
+
event.preventDefault(); // Ensure the input isn't focused as preventDefault would leave it.
|
|
44
44
|
|
|
45
45
|
ownerDocument.activeElement.blur();
|
|
46
46
|
onChange(getAngle(centerX, centerY, event.clientX, event.clientY));
|