@wordpress/components 19.4.1-next.f435e9e01b.0 → 19.6.1-next.a55ed9455a.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 +35 -4
- package/CONTRIBUTING.md +69 -2
- 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/unit-control.js +2 -2
- package/build/box-control/unit-control.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/card/card/component.js +2 -2
- package/build/card/card/component.js.map +1 -1
- package/build/card/card-body/component.js +1 -1
- package/build/card/card-body/component.js.map +1 -1
- package/build/card/card-divider/component.js +1 -1
- package/build/card/card-divider/component.js.map +1 -1
- package/build/card/card-footer/component.js +1 -1
- package/build/card/card-footer/component.js.map +1 -1
- package/build/card/card-header/component.js +1 -1
- package/build/card/card-header/component.js.map +1 -1
- package/build/card/card-media/component.js +1 -1
- package/build/card/card-media/component.js.map +1 -1
- package/build/color-palette/index.native.js +35 -30
- package/build/color-palette/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/component.js.map +1 -1
- package/build/color-picker/hex-input.js +6 -9
- package/build/color-picker/hex-input.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/elevation/component.js +1 -1
- package/build/elevation/component.js.map +1 -1
- package/build/flex/flex/component.js +1 -1
- package/build/flex/flex/component.js.map +1 -1
- package/build/flex/flex-block/component.js +1 -1
- package/build/flex/flex-block/component.js.map +1 -1
- package/build/flex/flex-item/component.js +1 -1
- package/build/flex/flex-item/component.js.map +1 -1
- package/build/flyout/flyout/component.js +1 -1
- package/build/flyout/flyout/component.js.map +1 -1
- package/build/flyout/flyout-content/component.js +1 -1
- package/build/flyout/flyout-content/component.js.map +1 -1
- package/build/focal-point-picker/index.js +18 -12
- package/build/focal-point-picker/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 -2
- 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/grid/component.js +1 -1
- package/build/grid/component.js.map +1 -1
- package/build/h-stack/component.js +1 -1
- package/build/h-stack/component.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 +14 -2
- package/build/index.js.map +1 -1
- package/build/index.native.js +15 -1
- package/build/index.native.js.map +1 -1
- package/build/input-control/index.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 +19 -17
- package/build/input-control/input-field.js.map +1 -1
- package/build/input-control/reducer/reducer.js +3 -0
- package/build/input-control/reducer/reducer.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/item-group/item/component.js.map +1 -1
- package/build/item-group/item-group/component.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/bottom-sheet-navigation/navigation-screen.native.js +1 -1
- package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js.map +1 -1
- package/build/mobile/bottom-sheet/cell.native.js +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/color-settings/palette.screen.native.js +26 -9
- package/build/mobile/color-settings/palette.screen.native.js.map +1 -1
- package/build/mobile/global-styles-context/utils.native.js +73 -19
- 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/inserter-button/index.native.js +3 -3
- package/build/mobile/inserter-button/index.native.js.map +1 -1
- package/build/mobile/inserter-button/sparkles.js +25 -0
- package/build/mobile/inserter-button/sparkles.js.map +1 -0
- 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/index.js +16 -0
- package/build/navigator/index.js.map +1 -1
- package/build/navigator/navigator-back-button/component.js +72 -0
- package/build/navigator/navigator-back-button/component.js.map +1 -0
- package/build/navigator/navigator-back-button/hook.js +49 -0
- package/build/navigator/navigator-back-button/hook.js.map +1 -0
- package/build/navigator/navigator-back-button/index.js +16 -0
- package/build/navigator/navigator-back-button/index.js.map +1 -0
- package/build/navigator/navigator-button/component.js +71 -0
- package/build/navigator/navigator-button/component.js.map +1 -0
- package/build/navigator/navigator-button/hook.js +59 -0
- package/build/navigator/navigator-button/hook.js.map +1 -0
- package/build/navigator/navigator-button/index.js +16 -0
- package/build/navigator/navigator-button/index.js.map +1 -0
- package/build/navigator/navigator-provider/component.js +12 -22
- package/build/navigator/navigator-provider/component.js.map +1 -1
- package/build/navigator/navigator-screen/component.js +14 -22
- 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/resizable-box/index.js.map +1 -1
- package/build/resizable-box/resize-tooltip/index.js.map +1 -1
- package/build/resizable-box/resize-tooltip/label.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/scrollable/component.js +1 -1
- package/build/scrollable/component.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/spacer/component.js.map +1 -1
- package/build/style-provider/index.js +2 -2
- package/build/style-provider/index.js.map +1 -1
- package/build/surface/component.js +1 -1
- package/build/surface/component.js.map +1 -1
- package/build/text/component.js +1 -1
- package/build/text/component.js.map +1 -1
- package/build/text-control/index.js +2 -2
- package/build/text-control/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.map +1 -1
- package/build/toggle-group-control/toggle-group-control-option/styles.js +8 -8
- 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/tools-panel/tools-panel/component.js.map +1 -1
- package/build/tools-panel/tools-panel-header/component.js.map +1 -1
- package/build/tools-panel/tools-panel-item/component.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 +50 -6
- package/build/tree-grid/index.js.map +1 -1
- package/build/truncate/component.js +1 -1
- package/build/truncate/component.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/control-group/component.js +1 -1
- package/build/ui/control-group/component.js.map +1 -1
- package/build/ui/control-label/component.js +1 -1
- package/build/ui/control-label/component.js.map +1 -1
- package/build/ui/form-group/form-group.js +1 -1
- package/build/ui/form-group/form-group.js.map +1 -1
- package/build/ui/shortcut/component.js.map +1 -1
- package/build/ui/spinner/component.js +1 -1
- package/build/ui/spinner/component.js.map +1 -1
- package/build/ui/tooltip/component.js +1 -1
- package/build/ui/tooltip/component.js.map +1 -1
- package/build/ui/tooltip/content.js +1 -1
- package/build/ui/tooltip/content.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/v-stack/component.js +1 -1
- package/build/v-stack/component.js.map +1 -1
- package/build/visually-hidden/component.js +1 -1
- package/build/visually-hidden/component.js.map +1 -1
- package/build/z-stack/component.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/unit-control.js +1 -1
- package/build-module/box-control/unit-control.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/card/card/component.js +2 -2
- package/build-module/card/card/component.js.map +1 -1
- package/build-module/card/card-body/component.js +1 -1
- package/build-module/card/card-body/component.js.map +1 -1
- package/build-module/card/card-divider/component.js +1 -1
- package/build-module/card/card-divider/component.js.map +1 -1
- package/build-module/card/card-footer/component.js +1 -1
- package/build-module/card/card-footer/component.js.map +1 -1
- package/build-module/card/card-header/component.js +1 -1
- package/build-module/card/card-header/component.js.map +1 -1
- package/build-module/card/card-media/component.js +1 -1
- package/build-module/card/card-media/component.js.map +1 -1
- package/build-module/color-palette/index.native.js +36 -31
- package/build-module/color-palette/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/component.js.map +1 -1
- package/build-module/color-picker/hex-input.js +6 -9
- package/build-module/color-picker/hex-input.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/elevation/component.js +1 -1
- package/build-module/elevation/component.js.map +1 -1
- package/build-module/flex/flex/component.js +1 -1
- package/build-module/flex/flex/component.js.map +1 -1
- package/build-module/flex/flex-block/component.js +1 -1
- package/build-module/flex/flex-block/component.js.map +1 -1
- package/build-module/flex/flex-item/component.js +1 -1
- package/build-module/flex/flex-item/component.js.map +1 -1
- package/build-module/flyout/flyout/component.js +1 -1
- package/build-module/flyout/flyout/component.js.map +1 -1
- package/build-module/flyout/flyout-content/component.js +1 -1
- package/build-module/flyout/flyout-content/component.js.map +1 -1
- package/build-module/focal-point-picker/index.js +18 -12
- package/build-module/focal-point-picker/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 -2
- 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/grid/component.js +1 -1
- package/build-module/grid/component.js.map +1 -1
- package/build-module/h-stack/component.js +1 -1
- package/build-module/h-stack/component.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 +5 -5
- package/build-module/index.js.map +1 -1
- package/build-module/index.native.js +5 -5
- package/build-module/index.native.js.map +1 -1
- package/build-module/input-control/index.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 +19 -16
- package/build-module/input-control/input-field.js.map +1 -1
- package/build-module/input-control/reducer/reducer.js +3 -0
- package/build-module/input-control/reducer/reducer.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/item-group/item/component.js.map +1 -1
- package/build-module/item-group/item-group/component.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/bottom-sheet-navigation/navigation-screen.native.js +1 -1
- package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/cell.native.js +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/color-settings/palette.screen.native.js +27 -10
- package/build-module/mobile/color-settings/palette.screen.native.js.map +1 -1
- package/build-module/mobile/global-styles-context/utils.native.js +70 -20
- 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/inserter-button/index.native.js +1 -1
- package/build-module/mobile/inserter-button/index.native.js.map +1 -1
- package/build-module/mobile/inserter-button/sparkles.js +16 -0
- package/build-module/mobile/inserter-button/sparkles.js.map +1 -0
- 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/index.js +2 -0
- package/build-module/navigator/index.js.map +1 -1
- package/build-module/navigator/navigator-back-button/component.js +59 -0
- package/build-module/navigator/navigator-back-button/component.js.map +1 -0
- package/build-module/navigator/navigator-back-button/hook.js +36 -0
- package/build-module/navigator/navigator-back-button/hook.js.map +1 -0
- package/build-module/navigator/navigator-back-button/index.js +2 -0
- package/build-module/navigator/navigator-back-button/index.js.map +1 -0
- package/build-module/navigator/navigator-button/component.js +58 -0
- package/build-module/navigator/navigator-button/component.js.map +1 -0
- package/build-module/navigator/navigator-button/hook.js +46 -0
- package/build-module/navigator/navigator-button/hook.js.map +1 -0
- package/build-module/navigator/navigator-button/index.js +2 -0
- package/build-module/navigator/navigator-button/index.js.map +1 -0
- package/build-module/navigator/navigator-provider/component.js +12 -22
- package/build-module/navigator/navigator-provider/component.js.map +1 -1
- package/build-module/navigator/navigator-screen/component.js +13 -22
- 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/resizable-box/index.js.map +1 -1
- package/build-module/resizable-box/resize-tooltip/index.js.map +1 -1
- package/build-module/resizable-box/resize-tooltip/label.js.map +1 -1
- package/build-module/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/scrollable/component.js +1 -1
- package/build-module/scrollable/component.js.map +1 -1
- package/build-module/select-control/index.js +2 -2
- 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/spacer/component.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/surface/component.js +1 -1
- package/build-module/surface/component.js.map +1 -1
- package/build-module/text/component.js +1 -1
- package/build-module/text/component.js.map +1 -1
- package/build-module/text-control/index.js +2 -2
- package/build-module/text-control/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.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control-option/styles.js +8 -8
- 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/tools-panel/tools-panel/component.js.map +1 -1
- package/build-module/tools-panel/tools-panel-header/component.js.map +1 -1
- package/build-module/tools-panel/tools-panel-item/component.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 +51 -7
- package/build-module/tree-grid/index.js.map +1 -1
- package/build-module/truncate/component.js +1 -1
- package/build-module/truncate/component.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/control-group/component.js +1 -1
- package/build-module/ui/control-group/component.js.map +1 -1
- package/build-module/ui/control-label/component.js +1 -1
- package/build-module/ui/control-label/component.js.map +1 -1
- package/build-module/ui/form-group/form-group.js +1 -1
- package/build-module/ui/form-group/form-group.js.map +1 -1
- package/build-module/ui/shortcut/component.js.map +1 -1
- package/build-module/ui/spinner/component.js +1 -1
- package/build-module/ui/spinner/component.js.map +1 -1
- package/build-module/ui/tooltip/component.js +1 -1
- package/build-module/ui/tooltip/component.js.map +1 -1
- package/build-module/ui/tooltip/content.js +1 -1
- package/build-module/ui/tooltip/content.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-module/v-stack/component.js +1 -1
- package/build-module/v-stack/component.js.map +1 -1
- package/build-module/visually-hidden/component.js +1 -1
- package/build-module/visually-hidden/component.js.map +1 -1
- package/build-module/z-stack/component.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 -3
- package/build-types/card/card-divider/hook.d.ts.map +1 -1
- 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 -4
- package/build-types/color-picker/styles.d.ts.map +1 -1
- package/build-types/confirm-dialog/component.d.ts +10 -6
- 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 -2
- 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 +3 -3
- package/build-types/input-control/index.d.ts.map +1 -1
- package/build-types/input-control/input-base.d.ts +2 -2
- package/build-types/input-control/input-base.d.ts.map +1 -1
- package/build-types/input-control/input-field.d.ts +1 -3
- package/build-types/input-control/input-field.d.ts.map +1 -1
- package/build-types/input-control/reducer/reducer.d.ts.map +1 -1
- package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
- package/build-types/input-control/types.d.ts +1 -1
- package/build-types/input-control/types.d.ts.map +1 -1
- package/build-types/item-group/item/hook.d.ts +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/index.d.ts +2 -0
- package/build-types/navigator/index.d.ts.map +1 -1
- package/build-types/navigator/navigator-back-button/component.d.ts +38 -0
- package/build-types/navigator/navigator-back-button/component.d.ts.map +1 -0
- package/build-types/navigator/navigator-back-button/hook.d.ts +283 -0
- package/build-types/navigator/navigator-back-button/hook.d.ts.map +1 -0
- package/build-types/navigator/navigator-back-button/index.d.ts +2 -0
- package/build-types/navigator/navigator-back-button/index.d.ts.map +1 -0
- package/build-types/navigator/navigator-button/component.d.ts +37 -0
- package/build-types/navigator/navigator-button/component.d.ts.map +1 -0
- package/build-types/navigator/navigator-button/hook.d.ts +283 -0
- package/build-types/navigator/navigator-button/hook.d.ts.map +1 -0
- package/build-types/navigator/navigator-button/index.d.ts +2 -0
- package/build-types/navigator/navigator-button/index.d.ts.map +1 -0
- package/build-types/navigator/navigator-provider/component.d.ts +10 -20
- package/build-types/navigator/navigator-provider/component.d.ts.map +1 -1
- package/build-types/navigator/navigator-screen/component.d.ts +10 -20
- package/build-types/navigator/navigator-screen/component.d.ts.map +1 -1
- package/build-types/navigator/types.d.ts +21 -0
- package/build-types/navigator/types.d.ts.map +1 -1
- package/build-types/number-control/styles/number-control-styles.d.ts +1 -1
- package/build-types/resizable-box/index.d.ts +2 -2
- package/build-types/resizable-box/index.d.ts.map +1 -1
- package/build-types/resizable-box/resize-tooltip/index.d.ts.map +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 -3
- 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/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 +3 -6
- 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 -5
- 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/build-types/z-stack/component.d.ts.map +1 -1
- package/package.json +19 -18
- package/src/alignment-matrix-control/README.md +4 -0
- package/src/alignment-matrix-control/stories/index.js +1 -1
- 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-control/stories/index.js +65 -22
- 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/stories/index.js +4 -1
- package/src/box-control/test/index.js +27 -7
- package/src/box-control/unit-control.js +1 -1
- 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/card/card/component.js +1 -1
- package/src/card/card-body/component.js +1 -1
- package/src/card/card-divider/component.js +1 -1
- package/src/card/card-footer/component.js +1 -1
- package/src/card/card-header/component.js +1 -1
- package/src/card/card-media/component.js +1 -1
- package/src/color-palette/index.native.js +92 -75
- package/src/color-palette/style.native.scss +10 -5
- package/src/color-palette/style.scss +1 -0
- package/src/color-picker/color-display.tsx +1 -1
- package/src/color-picker/component.tsx +2 -2
- package/src/color-picker/hex-input.tsx +9 -9
- 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 +6 -4
- 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 +5 -5
- 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/elevation/component.js +1 -1
- package/src/flex/flex/component.js +1 -1
- package/src/flex/flex-block/component.js +1 -1
- package/src/flex/flex-item/component.js +1 -1
- package/src/flyout/flyout/README.md +1 -1
- package/src/flyout/flyout/component.js +1 -1
- package/src/flyout/flyout-content/component.js +1 -1
- package/src/flyout/test/index.js +1 -1
- package/src/focal-point-picker/README.md +7 -0
- package/src/focal-point-picker/index.js +12 -7
- package/src/focal-point-picker/index.native.js +7 -7
- package/src/focal-point-picker/stories/index.js +30 -0
- package/src/focal-point-picker/test/index.js +44 -0
- 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 -2
- package/src/font-size-picker/stories/index.js +87 -108
- package/src/form-file-upload/README.md +1 -1
- package/src/form-file-upload/stories/index.js +51 -0
- 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/grid/component.js +1 -1
- package/src/h-stack/component.js +1 -1
- package/src/heading/component.tsx +6 -6
- 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 +6 -4
- package/src/index.native.js +9 -5
- package/src/input-control/index.tsx +2 -2
- package/src/input-control/input-base.tsx +3 -3
- package/src/input-control/input-field.tsx +16 -15
- package/src/input-control/reducer/reducer.ts +3 -0
- package/src/input-control/stories/index.js +1 -1
- package/src/input-control/styles/input-control-styles.tsx +1 -0
- package/src/input-control/test/index.js +4 -4
- package/src/input-control/types.ts +1 -1
- package/src/isolated-event-container/index.js +1 -1
- package/src/item-group/item/component.tsx +2 -2
- package/src/item-group/item-group/component.tsx +2 -2
- 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/bottom-sheet-navigation/navigation-screen.native.js +10 -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/color-settings/palette.screen.native.js +39 -9
- package/src/mobile/color-settings/style.native.scss +4 -0
- package/src/mobile/global-styles-context/test/fixtures/theme.native.js +27 -0
- package/src/mobile/global-styles-context/test/utils.native.js +2 -2
- package/src/mobile/global-styles-context/utils.native.js +85 -16
- 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/inserter-button/index.native.js +1 -2
- package/src/mobile/inserter-button/sparkles.js +15 -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/navigation/stories/index.js +1 -1
- package/src/navigator/index.ts +2 -0
- package/src/navigator/navigator-back-button/README.md +31 -0
- package/src/navigator/navigator-back-button/component.tsx +62 -0
- package/src/navigator/navigator-back-button/hook.ts +40 -0
- package/src/navigator/navigator-back-button/index.ts +1 -0
- package/src/navigator/navigator-button/README.md +38 -0
- package/src/navigator/navigator-button/component.tsx +61 -0
- package/src/navigator/navigator-button/hook.ts +55 -0
- package/src/navigator/navigator-button/index.ts +1 -0
- package/src/navigator/navigator-provider/README.md +20 -33
- package/src/navigator/navigator-provider/component.tsx +13 -23
- package/src/navigator/navigator-screen/README.md +1 -1
- package/src/navigator/navigator-screen/component.tsx +16 -25
- package/src/navigator/stories/index.js +24 -37
- package/src/navigator/test/index.js +105 -51
- package/src/navigator/types.ts +27 -1
- package/src/number-control/index.js +1 -1
- package/src/number-control/stories/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/stories/index.js +1 -1
- package/src/radio-group/index.js +1 -1
- package/src/radio-group/stories/index.js +4 -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/resizable-box/index.tsx +2 -2
- package/src/resizable-box/resize-tooltip/index.tsx +2 -2
- package/src/resizable-box/resize-tooltip/label.tsx +2 -2
- package/src/sandbox/index.js +5 -5
- package/src/sandbox/index.native.js +1 -1
- package/src/scrollable/component.js +1 -1
- package/src/select-control/index.tsx +3 -4
- 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/spacer/component.tsx +2 -2
- package/src/style-provider/index.js +2 -2
- package/src/surface/component.js +1 -1
- package/src/tab-panel/test/index.js +1 -1
- package/src/text/component.js +1 -1
- package/src/text/test/index.js +2 -2
- package/src/text/types.ts +6 -8
- package/src/text-control/index.js +2 -2
- package/src/text-highlight/test/index.js +4 -4
- package/src/toggle-control/test/index.js +3 -3
- package/src/toggle-group-control/stories/index.js +1 -1
- package/src/toggle-group-control/test/__snapshots__/index.js.snap +1 -0
- package/src/toggle-group-control/toggle-group-control/component.tsx +4 -4
- package/src/toggle-group-control/toggle-group-control-option/component.tsx +2 -2
- package/src/toggle-group-control/toggle-group-control-option/styles.ts +1 -0
- package/src/toolbar/index.js +1 -1
- package/src/toolbar-group/test/index.js +2 -2
- package/src/tools-panel/stories/index.js +0 -1
- package/src/tools-panel/tools-panel/component.tsx +2 -2
- package/src/tools-panel/tools-panel-header/component.tsx +2 -2
- package/src/tools-panel/tools-panel-item/component.tsx +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 +24 -1
- package/src/tree-grid/index.js +66 -7
- package/src/tree-grid/stories/index.js +4 -1
- package/src/tree-grid/test/__snapshots__/index.js.snap +1 -14
- package/src/tree-grid/test/index.js +259 -8
- package/src/truncate/component.js +1 -1
- 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 +3 -2
- package/src/ui/control-group/component.js +1 -1
- package/src/ui/control-label/component.js +1 -1
- package/src/ui/form-group/form-group.js +1 -1
- package/src/ui/shortcut/component.tsx +2 -2
- package/src/ui/spinner/component.js +1 -1
- package/src/ui/tooltip/component.js +1 -1
- package/src/ui/tooltip/content.js +1 -1
- 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 +66 -37
- package/src/unit-control/stories/index.js +1 -1
- 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/src/v-stack/component.js +1 -1
- package/src/visually-hidden/component.js +1 -1
- package/src/z-stack/component.tsx +2 -2
- 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
- package/src/tools-panel/stories/typography-panel.js +0 -215
|
@@ -12,105 +12,90 @@ const allUnits = {
|
|
|
12
12
|
px: {
|
|
13
13
|
value: 'px',
|
|
14
14
|
label: isWeb ? 'px' : __('Pixels (px)'),
|
|
15
|
-
default: '',
|
|
16
15
|
a11yLabel: __('Pixels (px)'),
|
|
17
16
|
step: 1
|
|
18
17
|
},
|
|
19
18
|
'%': {
|
|
20
19
|
value: '%',
|
|
21
20
|
label: isWeb ? '%' : __('Percentage (%)'),
|
|
22
|
-
default: '',
|
|
23
21
|
a11yLabel: __('Percent (%)'),
|
|
24
22
|
step: 0.1
|
|
25
23
|
},
|
|
26
24
|
em: {
|
|
27
25
|
value: 'em',
|
|
28
26
|
label: isWeb ? 'em' : __('Relative to parent font size (em)'),
|
|
29
|
-
default: '',
|
|
30
27
|
a11yLabel: _x('ems', 'Relative to parent font size (em)'),
|
|
31
28
|
step: 0.01
|
|
32
29
|
},
|
|
33
30
|
rem: {
|
|
34
31
|
value: 'rem',
|
|
35
32
|
label: isWeb ? 'rem' : __('Relative to root font size (rem)'),
|
|
36
|
-
default: '',
|
|
37
33
|
a11yLabel: _x('rems', 'Relative to root font size (rem)'),
|
|
38
34
|
step: 0.01
|
|
39
35
|
},
|
|
40
36
|
vw: {
|
|
41
37
|
value: 'vw',
|
|
42
38
|
label: isWeb ? 'vw' : __('Viewport width (vw)'),
|
|
43
|
-
default: '',
|
|
44
39
|
a11yLabel: __('Viewport width (vw)'),
|
|
45
40
|
step: 0.1
|
|
46
41
|
},
|
|
47
42
|
vh: {
|
|
48
43
|
value: 'vh',
|
|
49
44
|
label: isWeb ? 'vh' : __('Viewport height (vh)'),
|
|
50
|
-
default: '',
|
|
51
45
|
a11yLabel: __('Viewport height (vh)'),
|
|
52
46
|
step: 0.1
|
|
53
47
|
},
|
|
54
48
|
vmin: {
|
|
55
49
|
value: 'vmin',
|
|
56
50
|
label: isWeb ? 'vmin' : __('Viewport smallest dimension (vmin)'),
|
|
57
|
-
default: '',
|
|
58
51
|
a11yLabel: __('Viewport smallest dimension (vmin)'),
|
|
59
52
|
step: 0.1
|
|
60
53
|
},
|
|
61
54
|
vmax: {
|
|
62
55
|
value: 'vmax',
|
|
63
56
|
label: isWeb ? 'vmax' : __('Viewport largest dimension (vmax)'),
|
|
64
|
-
default: '',
|
|
65
57
|
a11yLabel: __('Viewport largest dimension (vmax)'),
|
|
66
58
|
step: 0.1
|
|
67
59
|
},
|
|
68
60
|
ch: {
|
|
69
61
|
value: 'ch',
|
|
70
62
|
label: isWeb ? 'ch' : __('Width of the zero (0) character (ch)'),
|
|
71
|
-
default: '',
|
|
72
63
|
a11yLabel: __('Width of the zero (0) character (ch)'),
|
|
73
64
|
step: 0.01
|
|
74
65
|
},
|
|
75
66
|
ex: {
|
|
76
67
|
value: 'ex',
|
|
77
68
|
label: isWeb ? 'ex' : __('x-height of the font (ex)'),
|
|
78
|
-
default: '',
|
|
79
69
|
a11yLabel: __('x-height of the font (ex)'),
|
|
80
70
|
step: 0.01
|
|
81
71
|
},
|
|
82
72
|
cm: {
|
|
83
73
|
value: 'cm',
|
|
84
74
|
label: isWeb ? 'cm' : __('Centimeters (cm)'),
|
|
85
|
-
default: '',
|
|
86
75
|
a11yLabel: __('Centimeters (cm)'),
|
|
87
76
|
step: 0.001
|
|
88
77
|
},
|
|
89
78
|
mm: {
|
|
90
79
|
value: 'mm',
|
|
91
80
|
label: isWeb ? 'mm' : __('Millimeters (mm)'),
|
|
92
|
-
default: '',
|
|
93
81
|
a11yLabel: __('Millimeters (mm)'),
|
|
94
82
|
step: 0.1
|
|
95
83
|
},
|
|
96
84
|
in: {
|
|
97
85
|
value: 'in',
|
|
98
86
|
label: isWeb ? 'in' : __('Inches (in)'),
|
|
99
|
-
default: '',
|
|
100
87
|
a11yLabel: __('Inches (in)'),
|
|
101
88
|
step: 0.001
|
|
102
89
|
},
|
|
103
90
|
pc: {
|
|
104
91
|
value: 'pc',
|
|
105
92
|
label: isWeb ? 'pc' : __('Picas (pc)'),
|
|
106
|
-
default: '',
|
|
107
93
|
a11yLabel: __('Picas (pc)'),
|
|
108
94
|
step: 1
|
|
109
95
|
},
|
|
110
96
|
pt: {
|
|
111
97
|
value: 'pt',
|
|
112
98
|
label: isWeb ? 'pt' : __('Points (pt)'),
|
|
113
|
-
default: '',
|
|
114
99
|
a11yLabel: __('Points (pt)'),
|
|
115
100
|
step: 1
|
|
116
101
|
}
|
|
@@ -133,114 +118,125 @@ export const DEFAULT_UNIT = allUnits.px;
|
|
|
133
118
|
* Moving forward, ideally the value should be a string that contains both
|
|
134
119
|
* the value and unit, example: '10px'
|
|
135
120
|
*
|
|
136
|
-
* @param value
|
|
137
|
-
* @param unit
|
|
138
|
-
* @param
|
|
139
|
-
* @return The extracted
|
|
121
|
+
* @param rawValue The raw value as a string (may or may not contain the unit)
|
|
122
|
+
* @param fallbackUnit The unit used as a fallback, if not unit is detected in the `value`
|
|
123
|
+
* @param allowedUnits Units to derive from.
|
|
124
|
+
* @return The extracted quantity and unit. The quantity can be `undefined` in case the raw value
|
|
125
|
+
* could not be parsed to a number correctly. The unit can be `undefined` in case the unit parse
|
|
126
|
+
* from the raw value could not be matched against the list of allowed units.
|
|
140
127
|
*/
|
|
141
128
|
|
|
142
|
-
export function
|
|
143
|
-
const initialValue =
|
|
144
|
-
return
|
|
129
|
+
export function getParsedQuantityAndUnit(rawValue, fallbackUnit, allowedUnits) {
|
|
130
|
+
const initialValue = fallbackUnit ? `${rawValue !== null && rawValue !== void 0 ? rawValue : ''}${fallbackUnit}` : rawValue;
|
|
131
|
+
return parseQuantityAndUnitFromRawValue(initialValue, allowedUnits);
|
|
145
132
|
}
|
|
146
133
|
/**
|
|
147
134
|
* Checks if units are defined.
|
|
148
135
|
*
|
|
149
|
-
* @param units
|
|
150
|
-
* @return Whether
|
|
136
|
+
* @param units List of units.
|
|
137
|
+
* @return Whether the list actually contains any units.
|
|
151
138
|
*/
|
|
152
139
|
|
|
153
140
|
export function hasUnits(units) {
|
|
141
|
+
// Although the `isArray` check shouldn't be necessary (given the signature of
|
|
142
|
+
// this typed function), it's better to stay on the side of caution, since
|
|
143
|
+
// this function may be called from un-typed environments.
|
|
154
144
|
return Array.isArray(units) && !!units.length;
|
|
155
145
|
}
|
|
156
146
|
/**
|
|
157
|
-
* Parses a
|
|
147
|
+
* Parses a quantity and unit from a raw string value, given a list of allowed
|
|
148
|
+
* units and otherwise falling back to the default unit.
|
|
158
149
|
*
|
|
159
|
-
* @param
|
|
160
|
-
* @param
|
|
161
|
-
* @return The extracted
|
|
150
|
+
* @param rawValue The raw value as a string (may or may not contain the unit)
|
|
151
|
+
* @param allowedUnits Units to derive from.
|
|
152
|
+
* @return The extracted quantity and unit. The quantity can be `undefined` in case the raw value
|
|
153
|
+
* could not be parsed to a number correctly. The unit can be `undefined` in case the unit parsed
|
|
154
|
+
* from the raw value could not be matched against the list of allowed units.
|
|
162
155
|
*/
|
|
163
156
|
|
|
164
|
-
export function
|
|
165
|
-
|
|
166
|
-
const value = String(initialValue).trim();
|
|
167
|
-
let num = parseFloat(value);
|
|
168
|
-
num = isNaN(num) ? '' : num;
|
|
169
|
-
const unitMatch = value.match(/[\d.\-\+]*\s*(.*)/);
|
|
170
|
-
let unit = (unitMatch === null || unitMatch === void 0 ? void 0 : unitMatch[1]) !== undefined ? unitMatch[1] : '';
|
|
171
|
-
unit = unit.toLowerCase();
|
|
157
|
+
export function parseQuantityAndUnitFromRawValue(rawValue) {
|
|
158
|
+
var _trimmedValue, _unitMatch$;
|
|
172
159
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
160
|
+
let allowedUnits = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ALL_CSS_UNITS;
|
|
161
|
+
let trimmedValue;
|
|
162
|
+
let quantityToReturn;
|
|
163
|
+
|
|
164
|
+
if (typeof rawValue !== 'undefined' || rawValue === null) {
|
|
165
|
+
trimmedValue = `${rawValue}`.trim();
|
|
166
|
+
const parsedQuantity = parseFloat(trimmedValue);
|
|
167
|
+
quantityToReturn = !isFinite(parsedQuantity) ? undefined : parsedQuantity;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const unitMatch = (_trimmedValue = trimmedValue) === null || _trimmedValue === void 0 ? void 0 : _trimmedValue.match(/[\d.\-\+]*\s*(.*)/);
|
|
171
|
+
const matchedUnit = unitMatch === null || unitMatch === void 0 ? void 0 : (_unitMatch$ = unitMatch[1]) === null || _unitMatch$ === void 0 ? void 0 : _unitMatch$.toLowerCase();
|
|
172
|
+
let unitToReturn;
|
|
173
|
+
|
|
174
|
+
if (hasUnits(allowedUnits)) {
|
|
175
|
+
const match = allowedUnits.find(item => item.value === matchedUnit);
|
|
176
|
+
unitToReturn = match === null || match === void 0 ? void 0 : match.value;
|
|
176
177
|
} else {
|
|
177
|
-
|
|
178
|
+
unitToReturn = DEFAULT_UNIT.value;
|
|
178
179
|
}
|
|
179
180
|
|
|
180
|
-
return [
|
|
181
|
+
return [quantityToReturn, unitToReturn];
|
|
181
182
|
}
|
|
182
183
|
/**
|
|
183
|
-
* Parses
|
|
184
|
+
* Parses quantity and unit from a raw value. Validates parsed value, using fallback
|
|
184
185
|
* value if invalid.
|
|
185
186
|
*
|
|
186
|
-
* @param
|
|
187
|
-
* @param
|
|
188
|
-
* @param
|
|
189
|
-
* @param fallbackUnit
|
|
190
|
-
* @return The extracted
|
|
187
|
+
* @param rawValue The next value.
|
|
188
|
+
* @param allowedUnits Units to derive from.
|
|
189
|
+
* @param fallbackQuantity The fallback quantity, used in case it's not possible to parse a valid quantity from the raw value.
|
|
190
|
+
* @param fallbackUnit The fallback unit, used in case it's not possible to parse a valid unit from the raw value.
|
|
191
|
+
* @return The extracted quantity and unit. The quantity can be `undefined` in case the raw value
|
|
192
|
+
* could not be parsed to a number correctly, and the `fallbackQuantity` was also `undefined`. The
|
|
193
|
+
* unit can be `undefined` only if the unit parsed from the raw value could not be matched against
|
|
194
|
+
* the list of allowed units, the `fallbackQuantity` is also `undefined` and the list of
|
|
195
|
+
* `allowedUnits` is passed empty.
|
|
191
196
|
*/
|
|
192
197
|
|
|
193
|
-
export function
|
|
194
|
-
const [
|
|
195
|
-
|
|
196
|
-
let baseUnit; // The parsed value from `parseUnit` should now be either a
|
|
197
|
-
// real number or an empty string. If not, use the fallback value.
|
|
198
|
-
|
|
199
|
-
if (!Number.isFinite(parsedValue) || parsedValue === '') {
|
|
200
|
-
baseValue = fallbackValue;
|
|
201
|
-
}
|
|
198
|
+
export function getValidParsedQuantityAndUnit(rawValue, allowedUnits, fallbackQuantity, fallbackUnit) {
|
|
199
|
+
const [parsedQuantity, parsedUnit] = parseQuantityAndUnitFromRawValue(rawValue, allowedUnits); // The parsed value from `parseQuantityAndUnitFromRawValue` should now be
|
|
200
|
+
// either a real number or undefined. If undefined, use the fallback value.
|
|
202
201
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
* If no unit is found, attempt to use the first value from the collection
|
|
206
|
-
* of units as a default fallback.
|
|
207
|
-
*/
|
|
202
|
+
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
|
|
203
|
+
// defined, use the first value from the list of allowed units as fallback.
|
|
208
204
|
|
|
209
|
-
|
|
210
|
-
var _units$;
|
|
205
|
+
let unitToReturn = parsedUnit || fallbackUnit;
|
|
211
206
|
|
|
212
|
-
|
|
207
|
+
if (!unitToReturn && hasUnits(allowedUnits)) {
|
|
208
|
+
unitToReturn = allowedUnits[0].value;
|
|
213
209
|
}
|
|
214
210
|
|
|
215
|
-
return [
|
|
211
|
+
return [quantityToReturn, unitToReturn];
|
|
216
212
|
}
|
|
217
213
|
/**
|
|
218
214
|
* Takes a unit value and finds the matching accessibility label for the
|
|
219
215
|
* unit abbreviation.
|
|
220
216
|
*
|
|
221
|
-
* @param unit Unit value (example: px)
|
|
217
|
+
* @param unit Unit value (example: `px`)
|
|
222
218
|
* @return a11y label for the unit abbreviation
|
|
223
219
|
*/
|
|
224
220
|
|
|
225
|
-
export function
|
|
221
|
+
export function getAccessibleLabelForUnit(unit) {
|
|
226
222
|
const match = ALL_CSS_UNITS.find(item => item.value === unit);
|
|
227
223
|
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;
|
|
228
224
|
}
|
|
229
225
|
/**
|
|
230
|
-
* Filters available units based on values defined
|
|
231
|
-
*
|
|
232
|
-
* @param unitSetting Collection of preferred unit value strings.
|
|
233
|
-
* @param units Collection of available unit objects.
|
|
226
|
+
* Filters available units based on values defined a list of allowed unit values.
|
|
234
227
|
*
|
|
235
|
-
* @
|
|
228
|
+
* @param allowedUnitValues Collection of allowed unit value strings.
|
|
229
|
+
* @param availableUnits Collection of available unit objects.
|
|
230
|
+
* @return Filtered units.
|
|
236
231
|
*/
|
|
237
232
|
|
|
238
233
|
export function filterUnitsWithSettings() {
|
|
239
|
-
let
|
|
240
|
-
let
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
234
|
+
let allowedUnitValues = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
235
|
+
let availableUnits = arguments.length > 1 ? arguments[1] : undefined;
|
|
236
|
+
// Although the `isArray` check shouldn't be necessary (given the signature of
|
|
237
|
+
// this typed function), it's better to stay on the side of caution, since
|
|
238
|
+
// this function may be called from un-typed environments.
|
|
239
|
+
return Array.isArray(availableUnits) ? availableUnits.filter(unit => allowedUnitValues.includes(unit.value)) : [];
|
|
244
240
|
}
|
|
245
241
|
/**
|
|
246
242
|
* Custom hook to retrieve and consolidate units setting from add_theme_support().
|
|
@@ -250,29 +246,30 @@ export function filterUnitsWithSettings() {
|
|
|
250
246
|
* @param args An object containing units, settingPath & defaultUnits.
|
|
251
247
|
* @param args.units Collection of all potentially available units.
|
|
252
248
|
* @param args.availableUnits Collection of unit value strings for filtering available units.
|
|
253
|
-
* @param args.defaultValues Collection of default values for defined units. Example: { px:
|
|
249
|
+
* @param args.defaultValues Collection of default values for defined units. Example: `{ px: 350, em: 15 }`.
|
|
254
250
|
*
|
|
255
|
-
* @return Filtered units
|
|
251
|
+
* @return Filtered list of units, with their default values updated following the `defaultValues`
|
|
252
|
+
* argument's property.
|
|
256
253
|
*/
|
|
257
254
|
|
|
258
255
|
export const useCustomUnits = _ref => {
|
|
259
256
|
let {
|
|
260
|
-
units,
|
|
261
|
-
availableUnits,
|
|
257
|
+
units = ALL_CSS_UNITS,
|
|
258
|
+
availableUnits = [],
|
|
262
259
|
defaultValues
|
|
263
260
|
} = _ref;
|
|
264
|
-
|
|
265
|
-
const usedUnits = filterUnitsWithSettings(!availableUnits ? [] : availableUnits, units);
|
|
261
|
+
const customUnitsToReturn = filterUnitsWithSettings(availableUnits, units);
|
|
266
262
|
|
|
267
263
|
if (defaultValues) {
|
|
268
|
-
|
|
264
|
+
customUnitsToReturn.forEach((unit, i) => {
|
|
269
265
|
if (defaultValues[unit.value]) {
|
|
270
|
-
|
|
266
|
+
const [parsedDefaultValue] = parseQuantityAndUnitFromRawValue(defaultValues[unit.value]);
|
|
267
|
+
customUnitsToReturn[i].default = parsedDefaultValue;
|
|
271
268
|
}
|
|
272
269
|
});
|
|
273
270
|
}
|
|
274
271
|
|
|
275
|
-
return
|
|
272
|
+
return customUnitsToReturn;
|
|
276
273
|
};
|
|
277
274
|
/**
|
|
278
275
|
* Get available units with the unit for the currently selected value
|
|
@@ -282,29 +279,24 @@ export const useCustomUnits = _ref => {
|
|
|
282
279
|
* accurately displayed in the UI, even if the intention is to hide
|
|
283
280
|
* the availability of that unit.
|
|
284
281
|
*
|
|
285
|
-
* @param
|
|
286
|
-
* @param legacyUnit
|
|
287
|
-
* @param units
|
|
282
|
+
* @param rawValue Selected value to parse.
|
|
283
|
+
* @param legacyUnit Legacy unit value, if rawValue needs it appended.
|
|
284
|
+
* @param units List of available units.
|
|
288
285
|
*
|
|
289
286
|
* @return A collection of units containing the unit for the current value.
|
|
290
287
|
*/
|
|
291
288
|
|
|
292
|
-
export function getUnitsWithCurrentUnit(
|
|
289
|
+
export function getUnitsWithCurrentUnit(rawValue, legacyUnit) {
|
|
293
290
|
let units = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ALL_CSS_UNITS;
|
|
291
|
+
const unitsToReturn = Array.isArray(units) ? [...units] : [];
|
|
292
|
+
const [, currentUnit] = getParsedQuantityAndUnit(rawValue, legacyUnit, ALL_CSS_UNITS);
|
|
294
293
|
|
|
295
|
-
if (!
|
|
296
|
-
return units;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
const unitsWithCurrentUnit = [...units];
|
|
300
|
-
const [, currentUnit] = getParsedValue(currentValue, legacyUnit, ALL_CSS_UNITS);
|
|
301
|
-
|
|
302
|
-
if (currentUnit && !unitsWithCurrentUnit.some(unit => unit.value === currentUnit)) {
|
|
294
|
+
if (currentUnit && !unitsToReturn.some(unit => unit.value === currentUnit)) {
|
|
303
295
|
if (allUnits[currentUnit]) {
|
|
304
|
-
|
|
296
|
+
unitsToReturn.unshift(allUnits[currentUnit]);
|
|
305
297
|
}
|
|
306
298
|
}
|
|
307
299
|
|
|
308
|
-
return
|
|
300
|
+
return unitsToReturn;
|
|
309
301
|
}
|
|
310
302
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/unit-control/utils.ts"],"names":["__","_x","Platform","isWeb","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":"AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,EAAb,QAAuB,iBAAvB;AACA,SAASC,QAAT,QAAyB,oBAAzB;AAEA;AACA;AACA;;AAGA,MAAMC,KAAK,GAAGD,QAAQ,CAACE,EAAT,KAAgB,KAA9B;AAEA,MAAMC,QAA6C,GAAG;AACrDC,EAAAA,EAAE,EAAE;AACHC,IAAAA,KAAK,EAAE,IADJ;AAEHC,IAAAA,KAAK,EAAEL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P,uBAAuB,CACxC,CAAEK,cAAF,GAAmB,EAAnB,GAAwBA,cADgB,EAExClC,KAFwC,CAAzC;;AAKA,MAAKmC,aAAL,EAAqB;AACpBC,IAAAA,SAAS,CAACC,OAAV,CAAmB,CAAEtC,IAAF,EAAQuC,CAAR,KAAe;AACjC,UAAKH,aAAa,CAAEpC,IAAI,CAACxB,KAAP,CAAlB,EAAmC;AAClC6D,QAAAA,SAAS,CAAEE,CAAF,CAAT,CAAe7D,OAAf,GAAyB0D,aAAa,CAAEpC,IAAI,CAACxB,KAAP,CAAtC;AACA;AACD,KAJD;AAKA;;AAED,SAAO6D,SAAS,CAAC9B,MAAV,KAAqB,CAArB,GAAyB,KAAzB,GAAiC8B,SAAxC;AACA,CAxBM;AA0BP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASG,uBAAT,CACNC,YADM,EAENC,UAFM,EAIkB;AAAA,MADxBzC,KACwB,uEADOP,aACP;;AACxB,MAAK,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":["__","_x","Platform","isWeb","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":"AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,EAAb,QAAuB,iBAAvB;AACA,SAASC,QAAT,QAAyB,oBAAzB;AAEA;AACA;AACA;;AAGA,MAAMC,KAAK,GAAGD,QAAQ,CAACE,EAAT,KAAgB,KAA9B;AAEA,MAAMC,QAA6C,GAAG;AACrDC,EAAAA,EAAE,EAAE;AACHC,IAAAA,KAAK,EAAE,IADJ;AAEHC,IAAAA,KAAK,EAAEL,KAAK,GAAG,IAAH,GAAUH,EAAE,CAAE,aAAF,CAFrB;AAGHS,IAAAA,SAAS,EAAET,EAAE,CAAE,aAAF,CAHV;AAIHU,IAAAA,IAAI,EAAE;AAJH,GADiD;AAOrD,OAAK;AACJH,IAAAA,KAAK,EAAE,GADH;AAEJC,IAAAA,KAAK,EAAEL,KAAK,GAAG,GAAH,GAASH,EAAE,CAAE,gBAAF,CAFnB;AAGJS,IAAAA,SAAS,EAAET,EAAE,CAAE,aAAF,CAHT;AAIJU,IAAAA,IAAI,EAAE;AAJF,GAPgD;AAarDC,EAAAA,EAAE,EAAE;AAC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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":"AAAA,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,CAAf","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":"AAAA,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,CAAf","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"]}
|
|
@@ -148,7 +148,7 @@ export const ALERT = {
|
|
|
148
148
|
export const ADMIN = {
|
|
149
149
|
theme: `var( --wp-admin-theme-color, ${BLUE.wordpress[700]})`,
|
|
150
150
|
themeDark10: `var( --wp-admin-theme-color-darker-10, ${BLUE.medium.focus})`
|
|
151
|
-
}; // Namespaced values for raw colors hex codes
|
|
151
|
+
}; // Namespaced values for raw colors hex codes.
|
|
152
152
|
|
|
153
153
|
export const UI = {
|
|
154
154
|
theme: ADMIN.theme,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/utils/colors-values.js"],"names":["merge","rgba","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":"AAAA;AACA;AACA;AACA,SAASA,KAAT,QAAsB,QAAtB;AAEA;AACA;AACA;;AACA,SAASC,IAAT,QAAqB,UAArB;AAEA,OAAO,MAAMC,IAAI,GAAG;AACnBC,EAAAA,KAAK,EAAE,MADY;AAEnBC,EAAAA,KAAK,EAAE;AAFY,CAAb;AAKP;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,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,CAAX;AA8BP,OAAO,MAAMC,SAAS,GAA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AE,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;AAeP,OAAO,MAAM+C,MAAM,GAAG,EACrB,GAAGhD,IADkB;AAErBS,EAAAA,QAAQ,EAAEX,KAAK,CAAE,EAAF,EAAMoB,SAAN,EAAiBf,EAAE,CAACM,QAApB,CAFM;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,EAAEhB,KAAK,CAAE,EAAF,EAAMyB,UAAN,EAAkBpB,EAAE,CAACW,SAArB,CAPK;AAQrBqC,EAAAA,cAAc,EAAE3B,mBARK;AASrBpB,EAAAA,IAAI,EAAEN,KAAK,CAAE,EAAF,EAAM2B,IAAN,EAAYtB,EAAE,CAACC,IAAf,CATU;AAUrBgD,EAAAA,KAAK,EAAEvB,KAVc;AAWrBwB,EAAAA,KAAK,EAAEpB,KAXc;AAYrBlB,EAAAA,EAAE,EAAEqB;AAZiB,CAAf;AAeP,eAAeY,MAAf","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"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/utils/colors-values.js"],"names":["merge","rgba","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":"AAAA;AACA;AACA;AACA,SAASA,KAAT,QAAsB,QAAtB;AAEA;AACA;AACA;;AACA,SAASC,IAAT,QAAqB,UAArB;AAEA,OAAO,MAAMC,IAAI,GAAG;AACnBC,EAAAA,KAAK,EAAE,MADY;AAEnBC,EAAAA,KAAK,EAAE;AAFY,CAAb;AAKP;AACA;AACA;AACA;A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AAMyB,UAAN,EAAkBpB,EAAE,CAACW,SAArB,CAPK;AAQrBqC,EAAAA,cAAc,EAAE3B,mBARK;AASrBpB,EAAAA,IAAI,EAAEN,KAAK,CAAE,EAAF,EAAM2B,IAAN,EAAYtB,EAAE,CAACC,IAAf,CATU;AAUrBgD,EAAAA,KAAK,EAAEvB,KAVc;AAWrBwB,EAAAA,KAAK,EAAEpB,KAXc;AAYrBlB,EAAAA,EAAE,EAAEqB;AAZiB,CAAf;AAeP,eAAeY,MAAf","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"]}
|
|
@@ -9,7 +9,7 @@ import { View } from '../view';
|
|
|
9
9
|
import { useVStack } from './hook';
|
|
10
10
|
/**
|
|
11
11
|
* @param {import('../ui/context').WordPressComponentProps<import('./types').Props, 'div'>} props
|
|
12
|
-
* @param {import('react').
|
|
12
|
+
* @param {import('react').ForwardedRef<any>} forwardedRef
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
function VStack(props, forwardedRef) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/v-stack/component.js"],"names":["contextConnect","View","useVStack","VStack","props","forwardedRef","vStackProps","ConnectedVStack"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,cAAT,QAA+B,eAA/B;AACA,SAASC,IAAT,QAAqB,SAArB;AACA,SAASC,SAAT,QAA0B,QAA1B;AAEA;AACA;AACA;AACA;;AACA,SAASC,MAAT,CAAiBC,KAAjB,EAAwBC,YAAxB,EAAuC;AACtC,QAAMC,WAAW,GAAGJ,SAAS,CAAEE,KAAF,CAA7B;AAEA,SAAO,cAAC,IAAD,eAAWE,WAAX;AAAyB,IAAA,GAAG,EAAGD;AAA/B,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAME,eAAe,GAAGP,cAAc,CAAEG,MAAF,EAAU,QAAV,CAAtC;AAEA,eAAeI,eAAf","sourcesContent":["/**\n * Internal dependencies\n */\nimport { contextConnect } from '../ui/context';\nimport { View } from '../view';\nimport { useVStack } from './hook';\n\n/**\n * @param {import('../ui/context').WordPressComponentProps<import('./types').Props, 'div'>} props\n * @param {import('react').
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/v-stack/component.js"],"names":["contextConnect","View","useVStack","VStack","props","forwardedRef","vStackProps","ConnectedVStack"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,cAAT,QAA+B,eAA/B;AACA,SAASC,IAAT,QAAqB,SAArB;AACA,SAASC,SAAT,QAA0B,QAA1B;AAEA;AACA;AACA;AACA;;AACA,SAASC,MAAT,CAAiBC,KAAjB,EAAwBC,YAAxB,EAAuC;AACtC,QAAMC,WAAW,GAAGJ,SAAS,CAAEE,KAAF,CAA7B;AAEA,SAAO,cAAC,IAAD,eAAWE,WAAX;AAAyB,IAAA,GAAG,EAAGD;AAA/B,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAME,eAAe,GAAGP,cAAc,CAAEG,MAAF,EAAU,QAAV,CAAtC;AAEA,eAAeI,eAAf","sourcesContent":["/**\n * Internal dependencies\n */\nimport { contextConnect } from '../ui/context';\nimport { View } from '../view';\nimport { useVStack } from './hook';\n\n/**\n * @param {import('../ui/context').WordPressComponentProps<import('./types').Props, 'div'>} props\n * @param {import('react').ForwardedRef<any>} forwardedRef\n */\nfunction VStack( props, forwardedRef ) {\n\tconst vStackProps = useVStack( props );\n\n\treturn <View { ...vStackProps } ref={ forwardedRef } />;\n}\n\n/**\n * `VStack` (or Vertical Stack) is a layout component that arranges child elements in a vertical line.\n *\n * `VStack` can render anything inside.\n *\n * @example\n * ```jsx\n * import {\n * \t__experimentalText as Text,\n * \t__experimentalVStack as VStack,\n * } from `@wordpress/components`;\n *\n * function Example() {\n * \treturn (\n * \t\t<VStack>\n * \t\t\t<Text>Code</Text>\n * \t\t\t<Text>is</Text>\n * \t\t\t<Text>Poetry</Text>\n * \t\t</VStack>\n * \t);\n * }\n * ```\n */\nconst ConnectedVStack = contextConnect( VStack, 'VStack' );\n\nexport default ConnectedVStack;\n"]}
|
|
@@ -9,7 +9,7 @@ import { visuallyHidden } from './styles';
|
|
|
9
9
|
import { View } from '../view';
|
|
10
10
|
/**
|
|
11
11
|
* @param {import('../ui/context').WordPressComponentProps<{ children: import('react').ReactNode }, 'div'>} props
|
|
12
|
-
* @param {import('react').
|
|
12
|
+
* @param {import('react').ForwardedRef<any>} forwardedRef
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
function VisuallyHidden(props, forwardedRef) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/visually-hidden/component.js"],"names":["useContextSystem","contextConnect","visuallyHidden","View","VisuallyHidden","props","forwardedRef","style","styleProp","contextProps","ConnectedVisuallyHidden"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,gBAAT,EAA2BC,cAA3B,QAAiD,eAAjD;AACA,SAASC,cAAT,QAA+B,UAA/B;AACA,SAASC,IAAT,QAAqB,SAArB;AAEA;AACA;AACA;AACA;;AACA,SAASC,cAAT,CAAyBC,KAAzB,EAAgCC,YAAhC,EAA+C;AAC9C,QAAM;AAAEC,IAAAA,KAAK,EAAEC,SAAT;AAAoB,OAAGC;AAAvB,MAAwCT,gBAAgB,CAC7DK,KAD6D,EAE7D,gBAF6D,CAA9D;AAIA,SACC,cAAC,IAAD;AACC,IAAA,GAAG,EAAGC;AADP,KAEMG,YAFN;AAGC,IAAA,KAAK,EAAG,EAAE,GAAGP,cAAL;AAAqB,UAAKM,SAAS,IAAI,EAAlB;AAArB;AAHT,KADD;AAOA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAME,uBAAuB,GAAGT,cAAc,CAC7CG,cAD6C,EAE7C,gBAF6C,CAA9C;AAKA,eAAeM,uBAAf","sourcesContent":["/**\n * Internal dependencies\n */\nimport { useContextSystem, contextConnect } from '../ui/context';\nimport { visuallyHidden } from './styles';\nimport { View } from '../view';\n\n/**\n * @param {import('../ui/context').WordPressComponentProps<{ children: import('react').ReactNode }, 'div'>} props\n * @param {import('react').
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/visually-hidden/component.js"],"names":["useContextSystem","contextConnect","visuallyHidden","View","VisuallyHidden","props","forwardedRef","style","styleProp","contextProps","ConnectedVisuallyHidden"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,gBAAT,EAA2BC,cAA3B,QAAiD,eAAjD;AACA,SAASC,cAAT,QAA+B,UAA/B;AACA,SAASC,IAAT,QAAqB,SAArB;AAEA;AACA;AACA;AACA;;AACA,SAASC,cAAT,CAAyBC,KAAzB,EAAgCC,YAAhC,EAA+C;AAC9C,QAAM;AAAEC,IAAAA,KAAK,EAAEC,SAAT;AAAoB,OAAGC;AAAvB,MAAwCT,gBAAgB,CAC7DK,KAD6D,EAE7D,gBAF6D,CAA9D;AAIA,SACC,cAAC,IAAD;AACC,IAAA,GAAG,EAAGC;AADP,KAEMG,YAFN;AAGC,IAAA,KAAK,EAAG,EAAE,GAAGP,cAAL;AAAqB,UAAKM,SAAS,IAAI,EAAlB;AAArB;AAHT,KADD;AAOA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAME,uBAAuB,GAAGT,cAAc,CAC7CG,cAD6C,EAE7C,gBAF6C,CAA9C;AAKA,eAAeM,uBAAf","sourcesContent":["/**\n * Internal dependencies\n */\nimport { useContextSystem, contextConnect } from '../ui/context';\nimport { visuallyHidden } from './styles';\nimport { View } from '../view';\n\n/**\n * @param {import('../ui/context').WordPressComponentProps<{ children: import('react').ReactNode }, 'div'>} props\n * @param {import('react').ForwardedRef<any>} forwardedRef\n */\nfunction VisuallyHidden( props, forwardedRef ) {\n\tconst { style: styleProp, ...contextProps } = useContextSystem(\n\t\tprops,\n\t\t'VisuallyHidden'\n\t);\n\treturn (\n\t\t<View\n\t\t\tref={ forwardedRef }\n\t\t\t{ ...contextProps }\n\t\t\tstyle={ { ...visuallyHidden, ...( styleProp || {} ) } }\n\t\t/>\n\t);\n}\n\n/**\n * `VisuallyHidden` is a component used to render text intended to be visually\n * hidden, but will show for alternate devices, for example a screen reader.\n *\n * @example\n * ```jsx\n * import { VisuallyHidden } from `@wordpress/components`;\n *\n * function Example() {\n * \treturn (\n * \t\t<VisuallyHidden>\n * \t\t\t<label>Code is Poetry</label>\n * \t\t</VisuallyHidden>\n * \t);\n * }\n * ```\n */\nconst ConnectedVisuallyHidden = contextConnect(\n\tVisuallyHidden,\n\t'VisuallyHidden'\n);\n\nexport default ConnectedVisuallyHidden;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/z-stack/component.tsx"],"names":["isValidElement","getValidChildren","contextConnect","useContextSystem","ZStackView","ZStackChildView","ZStack","props","forwardedRef","children","className","isLayered","isReversed","offset","otherProps","validChildren","childrenLastIndex","length","clonedChildren","map","child","index","zIndex","offsetAmount","key"],"mappings":";;;AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SAASA,cAAT,QAA+B,oBAA/B;AAEA;AACA;AACA;;AACA,SAASC,gBAAT,QAAiC,gCAAjC;AACA,SAASC,cAAT,EAAyBC,gBAAzB,QAAiD,eAAjD;AAEA,SAASC,UAAT,EAAqBC,eAArB,QAA4C,UAA5C;;AA2BA,SAASC,MAAT,CACCC,KADD,EAECC,YAFD,EAGE;AACD,QAAM;AACLC,IAAAA,QADK;AAELC,IAAAA,SAFK;AAGLC,IAAAA,SAAS,GAAG,IAHP;AAILC,IAAAA,UAAU,GAAG,KAJR;AAKLC,IAAAA,MAAM,GAAG,CALJ;AAML,OAAGC;AANE,MAOFX,gBAAgB,CAAEI,KAAF,EAAS,QAAT,CAPpB;AASA,QAAMQ,aAAa,GAAGd,gBAAgB,CAAEQ,QAAF,CAAtC;AACA,QAAMO,iBAAiB,GAAGD,aAAa,CAACE,MAAd,GAAuB,CAAjD;AAEA,QAAMC,cAAc,GAAGH,aAAa,CAACI,GAAd,CAAmB,CAAEC,KAAF,EAASC,KAAT,KAAoB;AAC7D,UAAMC,MAAM,GAAGV,UAAU,GAAGI,iBAAiB,GAAGK,KAAvB,GAA+BA,KAAxD;AACA,UAAME,YAAY,GAAGV,MAAM,GAAGQ,KAA9B;AAEA,UAAMG,GAAG,GAAGxB,cAAc,CAAEoB,KAAF,CAAd,GAA0BA,KAAK,CAACI,GAAhC,GAAsCH,KAAlD;AAEA,WACC,cAAC,eAAD;AACC,MAAA,SAAS,EAAGV,SADb;AAEC,MAAA,YAAY,EAAGY,YAFhB;AAGC,MAAA,MAAM,EAAGD,MAHV;AAIC,MAAA,GAAG,EAAGE;AAJP,OAMGJ,KANH,CADD;AAUA,GAhBsB,CAAvB;AAkBA,SACC,cAAC,UAAD,eACMN,UADN;AAEC,IAAA,SAAS,EAAGJ,SAFb;AAGC,IAAA,GAAG,EAAGF;AAHP,MAKGU,cALH,CADD;AASA;;AAED,eAAehB,cAAc,CAAEI,MAAF,EAAU,QAAV,CAA7B","sourcesContent":["/**\n * External dependencies\n */\nimport type {
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/z-stack/component.tsx"],"names":["isValidElement","getValidChildren","contextConnect","useContextSystem","ZStackView","ZStackChildView","ZStack","props","forwardedRef","children","className","isLayered","isReversed","offset","otherProps","validChildren","childrenLastIndex","length","clonedChildren","map","child","index","zIndex","offsetAmount","key"],"mappings":";;;AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SAASA,cAAT,QAA+B,oBAA/B;AAEA;AACA;AACA;;AACA,SAASC,gBAAT,QAAiC,gCAAjC;AACA,SAASC,cAAT,EAAyBC,gBAAzB,QAAiD,eAAjD;AAEA,SAASC,UAAT,EAAqBC,eAArB,QAA4C,UAA5C;;AA2BA,SAASC,MAAT,CACCC,KADD,EAECC,YAFD,EAGE;AACD,QAAM;AACLC,IAAAA,QADK;AAELC,IAAAA,SAFK;AAGLC,IAAAA,SAAS,GAAG,IAHP;AAILC,IAAAA,UAAU,GAAG,KAJR;AAKLC,IAAAA,MAAM,GAAG,CALJ;AAML,OAAGC;AANE,MAOFX,gBAAgB,CAAEI,KAAF,EAAS,QAAT,CAPpB;AASA,QAAMQ,aAAa,GAAGd,gBAAgB,CAAEQ,QAAF,CAAtC;AACA,QAAMO,iBAAiB,GAAGD,aAAa,CAACE,MAAd,GAAuB,CAAjD;AAEA,QAAMC,cAAc,GAAGH,aAAa,CAACI,GAAd,CAAmB,CAAEC,KAAF,EAASC,KAAT,KAAoB;AAC7D,UAAMC,MAAM,GAAGV,UAAU,GAAGI,iBAAiB,GAAGK,KAAvB,GAA+BA,KAAxD;AACA,UAAME,YAAY,GAAGV,MAAM,GAAGQ,KAA9B;AAEA,UAAMG,GAAG,GAAGxB,cAAc,CAAEoB,KAAF,CAAd,GAA0BA,KAAK,CAACI,GAAhC,GAAsCH,KAAlD;AAEA,WACC,cAAC,eAAD;AACC,MAAA,SAAS,EAAGV,SADb;AAEC,MAAA,YAAY,EAAGY,YAFhB;AAGC,MAAA,MAAM,EAAGD,MAHV;AAIC,MAAA,GAAG,EAAGE;AAJP,OAMGJ,KANH,CADD;AAUA,GAhBsB,CAAvB;AAkBA,SACC,cAAC,UAAD,eACMN,UADN;AAEC,IAAA,SAAS,EAAGJ,SAFb;AAGC,IAAA,GAAG,EAAGF;AAHP,MAKGU,cALH,CADD;AASA;;AAED,eAAehB,cAAc,CAAEI,MAAF,EAAU,QAAV,CAA7B","sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef, ReactNode } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { isValidElement } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { getValidChildren } from '../ui/utils/get-valid-children';\nimport { contextConnect, useContextSystem } from '../ui/context';\nimport type { WordPressComponentProps } from '../ui/context';\nimport { ZStackView, ZStackChildView } from './styles';\n\nexport interface ZStackProps {\n\t/**\n\t * Layers children elements on top of each other (first: highest z-index, last: lowest z-index).\n\t *\n\t * @default true\n\t */\n\tisLayered?: boolean;\n\t/**\n\t * Reverse the layer ordering (first: lowest z-index, last: highest z-index).\n\t *\n\t * @default false\n\t */\n\tisReversed?: boolean;\n\t/**\n\t * The amount of offset between each child element. The amount of space between each child element. Defaults to `0`. Its value is automatically inverted (i.e. from positive to negative, and viceversa) when switching from LTR to RTL.\n\t *\n\t * @default 0\n\t */\n\toffset?: number;\n\t/**\n\t * Child elements.\n\t */\n\tchildren: ReactNode;\n}\n\nfunction ZStack(\n\tprops: WordPressComponentProps< ZStackProps, 'div' >,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst {\n\t\tchildren,\n\t\tclassName,\n\t\tisLayered = true,\n\t\tisReversed = false,\n\t\toffset = 0,\n\t\t...otherProps\n\t} = useContextSystem( props, 'ZStack' );\n\n\tconst validChildren = getValidChildren( children );\n\tconst childrenLastIndex = validChildren.length - 1;\n\n\tconst clonedChildren = validChildren.map( ( child, index ) => {\n\t\tconst zIndex = isReversed ? childrenLastIndex - index : index;\n\t\tconst offsetAmount = offset * index;\n\n\t\tconst key = isValidElement( child ) ? child.key : index;\n\n\t\treturn (\n\t\t\t<ZStackChildView\n\t\t\t\tisLayered={ isLayered }\n\t\t\t\toffsetAmount={ offsetAmount }\n\t\t\t\tzIndex={ zIndex }\n\t\t\t\tkey={ key }\n\t\t\t>\n\t\t\t\t{ child }\n\t\t\t</ZStackChildView>\n\t\t);\n\t} );\n\n\treturn (\n\t\t<ZStackView\n\t\t\t{ ...otherProps }\n\t\t\tclassName={ className }\n\t\t\tref={ forwardedRef }\n\t\t>\n\t\t\t{ clonedChildren }\n\t\t</ZStackView>\n\t);\n}\n\nexport default contextConnect( ZStack, 'ZStack' );\n"]}
|