@wordpress/components 28.14.1-next.cd6172eb0.0 → 29.0.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 +16 -9
- package/build/alignment-matrix-control/icon.js +1 -0
- package/build/alignment-matrix-control/icon.js.map +1 -1
- package/build/alignment-matrix-control/index.js +1 -0
- package/build/alignment-matrix-control/index.js.map +1 -1
- package/build/animation/index.js +0 -6
- package/build/animation/index.js.map +1 -1
- package/build/autocomplete/autocompleter-ui.js +1 -0
- package/build/autocomplete/autocompleter-ui.js.map +1 -1
- package/build/autocomplete/autocompleter-ui.native.js +1 -0
- package/build/autocomplete/autocompleter-ui.native.js.map +1 -1
- package/build/autocomplete/get-default-use-items.js +1 -0
- package/build/autocomplete/get-default-use-items.js.map +1 -1
- package/build/autocomplete/index.js +1 -0
- package/build/autocomplete/index.js.map +1 -1
- package/build/border-box-control/utils.js +1 -0
- package/build/border-box-control/utils.js.map +1 -1
- package/build/border-control/border-control-dropdown/component.js +1 -0
- package/build/border-control/border-control-dropdown/component.js.map +1 -1
- package/build/border-control/border-control-style-picker/component.js +1 -0
- package/build/border-control/border-control-style-picker/component.js.map +1 -1
- package/build/box-control/index.js +13 -13
- package/build/box-control/index.js.map +1 -1
- package/build/box-control/input-control.js +161 -0
- package/build/box-control/input-control.js.map +1 -0
- package/build/box-control/types.js.map +1 -1
- package/build/box-control/utils.js +51 -48
- package/build/box-control/utils.js.map +1 -1
- package/build/button/index.native.js +1 -0
- package/build/button/index.native.js.map +1 -1
- package/build/button/types.js.map +1 -1
- package/build/color-indicator/index.native.js +1 -0
- package/build/color-indicator/index.native.js.map +1 -1
- package/build/color-palette/index.js +1 -0
- package/build/color-palette/index.js.map +1 -1
- package/build/color-palette/index.native.js +1 -0
- package/build/color-palette/index.native.js.map +1 -1
- package/build/color-palette/utils.js +1 -0
- package/build/color-palette/utils.js.map +1 -1
- package/build/combobox-control/index.js +1 -0
- package/build/combobox-control/index.js.map +1 -1
- package/build/composite/legacy/index.js +1 -0
- package/build/composite/legacy/index.js.map +1 -1
- package/build/context/context-connect.js +1 -0
- package/build/context/context-connect.js.map +1 -1
- package/build/custom-gradient-picker/gradient-bar/control-points.js +1 -0
- package/build/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
- package/build/custom-gradient-picker/gradient-bar/index.js +1 -0
- package/build/custom-gradient-picker/gradient-bar/index.js.map +1 -1
- package/build/custom-gradient-picker/gradient-bar/utils.js +1 -0
- package/build/custom-gradient-picker/gradient-bar/utils.js.map +1 -1
- package/build/custom-gradient-picker/index.js +1 -0
- package/build/custom-gradient-picker/index.js.map +1 -1
- package/build/custom-gradient-picker/serializer.js +1 -0
- package/build/custom-gradient-picker/serializer.js.map +1 -1
- package/build/custom-gradient-picker/utils.js +1 -0
- package/build/custom-gradient-picker/utils.js.map +1 -1
- package/build/custom-select-control/index.js +3 -2
- package/build/custom-select-control/index.js.map +1 -1
- package/build/dashicon/index.js +1 -0
- package/build/dashicon/index.js.map +1 -1
- package/build/date-time/date/index.js +1 -0
- package/build/date-time/date/index.js.map +1 -1
- package/build/date-time/date/use-lilius/index.js +1 -0
- package/build/date-time/date/use-lilius/index.js.map +1 -1
- package/build/date-time/time/index.js +1 -0
- package/build/date-time/time/index.js.map +1 -1
- package/build/dimension-control/index.js +1 -0
- package/build/dimension-control/index.js.map +1 -1
- package/build/dimension-control/sizes.js +1 -0
- package/build/dimension-control/sizes.js.map +1 -1
- package/build/draggable/index.js +1 -0
- package/build/draggable/index.js.map +1 -1
- package/build/draggable/index.native.js +1 -0
- package/build/draggable/index.native.js.map +1 -1
- package/build/dropdown-menu/index.js +1 -0
- package/build/dropdown-menu/index.js.map +1 -1
- package/build/dropdown-menu/index.native.js +1 -0
- package/build/dropdown-menu/index.native.js.map +1 -1
- package/build/duotone-picker/color-list-picker/index.js +1 -0
- package/build/duotone-picker/color-list-picker/index.js.map +1 -1
- package/build/duotone-picker/duotone-picker.js +1 -0
- package/build/duotone-picker/duotone-picker.js.map +1 -1
- package/build/duotone-picker/utils.js +1 -0
- package/build/duotone-picker/utils.js.map +1 -1
- package/build/external-link/index.js +1 -0
- package/build/external-link/index.js.map +1 -1
- package/build/font-size-picker/font-size-picker-select.js +1 -0
- package/build/font-size-picker/font-size-picker-select.js.map +1 -1
- package/build/font-size-picker/font-size-picker-toggle-group.js +1 -0
- package/build/font-size-picker/font-size-picker-toggle-group.js.map +1 -1
- package/build/font-size-picker/index.js +1 -0
- package/build/font-size-picker/index.js.map +1 -1
- package/build/font-size-picker/index.native.js +1 -0
- package/build/font-size-picker/index.native.js.map +1 -1
- package/build/font-size-picker/utils.js +1 -0
- package/build/font-size-picker/utils.js.map +1 -1
- package/build/form-token-field/index.js +1 -0
- package/build/form-token-field/index.js.map +1 -1
- package/build/form-token-field/suggestions-list.js +1 -0
- package/build/form-token-field/suggestions-list.js.map +1 -1
- package/build/gradient-picker/index.js +1 -0
- package/build/gradient-picker/index.js.map +1 -1
- package/build/guide/index.js +1 -0
- package/build/guide/index.js.map +1 -1
- package/build/guide/page-control.js +1 -0
- package/build/guide/page-control.js.map +1 -1
- package/build/h-stack/hook.js +1 -0
- package/build/h-stack/hook.js.map +1 -1
- package/build/higher-order/navigate-regions/index.js +1 -0
- package/build/higher-order/navigate-regions/index.js.map +1 -1
- package/build/higher-order/with-fallback-styles/index.js +1 -0
- package/build/higher-order/with-fallback-styles/index.js.map +1 -1
- package/build/higher-order/with-filters/index.js +1 -0
- package/build/higher-order/with-filters/index.js.map +1 -1
- package/build/higher-order/with-notices/index.js +1 -0
- package/build/higher-order/with-notices/index.js.map +1 -1
- package/build/index.js +0 -6
- package/build/index.js.map +1 -1
- package/build/keyboard-shortcuts/index.js +1 -0
- package/build/keyboard-shortcuts/index.js.map +1 -1
- package/build/menu/styles.js +16 -16
- package/build/menu/styles.js.map +1 -1
- package/build/menu-items-choice/index.js +1 -0
- package/build/menu-items-choice/index.js.map +1 -1
- package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +1 -0
- package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js.map +1 -1
- package/build/mobile/bottom-sheet/keyboard-avoiding-view.native.js +1 -0
- package/build/mobile/bottom-sheet/keyboard-avoiding-view.native.js.map +1 -1
- package/build/mobile/bottom-sheet/picker-cell.native.js +1 -0
- package/build/mobile/bottom-sheet/picker-cell.native.js.map +1 -1
- package/build/mobile/bottom-sheet-select-control/index.native.js +1 -0
- package/build/mobile/bottom-sheet-select-control/index.native.js.map +1 -1
- package/build/mobile/color-settings/palette.screen.native.js +1 -0
- package/build/mobile/color-settings/palette.screen.native.js.map +1 -1
- package/build/mobile/gradient/index.native.js +1 -0
- package/build/mobile/gradient/index.native.js.map +1 -1
- package/build/mobile/media-edit/index.native.js +1 -0
- package/build/mobile/media-edit/index.native.js.map +1 -1
- package/build/mobile/picker/index.android.js +1 -0
- package/build/mobile/picker/index.android.js.map +1 -1
- package/build/mobile/picker/index.ios.js +1 -0
- package/build/mobile/picker/index.ios.js.map +1 -1
- package/build/mobile/segmented-control/index.native.js +1 -0
- package/build/mobile/segmented-control/index.native.js.map +1 -1
- package/build/mobile/utils/get-px-from-css-unit.native.js +1 -0
- package/build/mobile/utils/get-px-from-css-unit.native.js.map +1 -1
- package/build/navigable-container/container.js +1 -0
- package/build/navigable-container/container.js.map +1 -1
- package/build/navigation/group/index.js +1 -0
- package/build/navigation/group/index.js.map +1 -1
- package/build/navigation/menu/menu-title-search.js +1 -0
- package/build/navigation/menu/menu-title-search.js.map +1 -1
- package/build/navigation/menu/search-no-results-found.js +1 -0
- package/build/navigation/menu/search-no-results-found.js.map +1 -1
- package/build/navigation/styles/navigation-styles.js +12 -12
- package/build/navigation/styles/navigation-styles.js.map +1 -1
- package/build/navigator/navigator/component.js +1 -0
- package/build/navigator/navigator/component.js.map +1 -1
- package/build/navigator/navigator-screen/component.js +1 -0
- package/build/navigator/navigator-screen/component.js.map +1 -1
- package/build/navigator/utils/router.js +1 -0
- package/build/navigator/utils/router.js.map +1 -1
- package/build/notice/index.js +1 -0
- package/build/notice/index.js.map +1 -1
- package/build/notice/list.js +1 -0
- package/build/notice/list.js.map +1 -1
- package/build/notice/list.native.js +1 -0
- package/build/notice/list.native.js.map +1 -1
- package/build/palette-edit/index.js +1 -0
- package/build/palette-edit/index.js.map +1 -1
- package/build/panel/actions.native.js +1 -0
- package/build/panel/actions.native.js.map +1 -1
- package/build/query-controls/index.js +1 -0
- package/build/query-controls/index.js.map +1 -1
- package/build/query-controls/terms.js +1 -0
- package/build/query-controls/terms.js.map +1 -1
- package/build/radio-control/index.js +1 -0
- package/build/radio-control/index.js.map +1 -1
- package/build/radio-control/index.native.js +1 -0
- package/build/radio-control/index.native.js.map +1 -1
- package/build/range-control/mark.js +0 -1
- package/build/range-control/mark.js.map +1 -1
- package/build/range-control/rail.js +1 -0
- package/build/range-control/rail.js.map +1 -1
- package/build/range-control/styles/range-control-styles.js +33 -45
- package/build/range-control/styles/range-control-styles.js.map +1 -1
- package/build/resizable-box/index.js +1 -0
- package/build/resizable-box/index.js.map +1 -1
- package/build/sandbox/index.js +1 -0
- package/build/sandbox/index.js.map +1 -1
- package/build/sandbox/index.native.js +1 -0
- package/build/sandbox/index.native.js.map +1 -1
- package/build/search-control/index.native.js +1 -0
- package/build/search-control/index.native.js.map +1 -1
- package/build/select-control/index.js +1 -0
- package/build/select-control/index.js.map +1 -1
- package/build/slot-fill/bubbles-virtually/slot-fill-provider.js +1 -0
- package/build/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
- package/build/slot-fill/provider.js +1 -0
- package/build/slot-fill/provider.js.map +1 -1
- package/build/slot-fill/slot.js +1 -0
- package/build/slot-fill/slot.js.map +1 -1
- package/build/snackbar/index.js +1 -0
- package/build/snackbar/index.js.map +1 -1
- package/build/snackbar/list.js +1 -0
- package/build/snackbar/list.js.map +1 -1
- package/build/tab-panel/index.js +1 -0
- package/build/tab-panel/index.js.map +1 -1
- package/build/tabs/index.js +1 -0
- package/build/tabs/index.js.map +1 -1
- package/build/text/utils.js +1 -0
- package/build/text/utils.js.map +1 -1
- package/build/theme/color-algorithms.js +1 -0
- package/build/theme/color-algorithms.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/styles.js +7 -7
- package/build/toggle-group-control/toggle-group-control/styles.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control-option-base/styles.js +8 -8
- package/build/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
- package/build/toolbar/toolbar-group/index.js +1 -0
- package/build/toolbar/toolbar-group/index.js.map +1 -1
- package/build/tools-panel/tools-panel/hook.js +1 -0
- package/build/tools-panel/tools-panel/hook.js.map +1 -1
- package/build/tools-panel/tools-panel-header/component.js +1 -0
- package/build/tools-panel/tools-panel-header/component.js.map +1 -1
- package/build/tree-grid/cell.js +4 -1
- package/build/tree-grid/cell.js.map +1 -1
- package/build/tree-grid/index.js +1 -0
- package/build/tree-grid/index.js.map +1 -1
- package/build/tree-grid/types.js.map +1 -1
- package/build/tree-select/index.js +1 -0
- package/build/tree-select/index.js.map +1 -1
- package/build/unit-control/index.js +1 -0
- package/build/unit-control/index.js.map +1 -1
- package/build/unit-control/index.native.js +1 -0
- package/build/unit-control/index.native.js.map +1 -1
- package/build/unit-control/unit-select-control.js +1 -0
- package/build/unit-control/unit-select-control.js.map +1 -1
- package/build/unit-control/utils.js +1 -0
- package/build/unit-control/utils.js.map +1 -1
- package/build/utils/colors-values.js +3 -0
- package/build/utils/colors-values.js.map +1 -1
- package/build/utils/config-values.js +0 -1
- package/build/utils/config-values.js.map +1 -1
- package/build/utils/get-valid-children.js +1 -0
- package/build/utils/get-valid-children.js.map +1 -1
- package/build/utils/hooks/use-animated-offset-rect.js +1 -0
- package/build/utils/hooks/use-animated-offset-rect.js.map +1 -1
- package/build/utils/hooks/use-cx.js +1 -0
- package/build/utils/hooks/use-cx.js.map +1 -1
- package/build/utils/math.js +1 -0
- package/build/utils/math.js.map +1 -1
- package/build/utils/rtl.js +1 -0
- package/build/utils/rtl.js.map +1 -1
- package/build/utils/values.js +1 -0
- package/build/utils/values.js.map +1 -1
- package/build/z-stack/component.js +1 -0
- package/build/z-stack/component.js.map +1 -1
- package/build-module/alignment-matrix-control/icon.js +1 -0
- package/build-module/alignment-matrix-control/icon.js.map +1 -1
- package/build-module/alignment-matrix-control/index.js +1 -0
- package/build-module/alignment-matrix-control/index.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/autocompleter-ui.js +1 -0
- package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
- package/build-module/autocomplete/autocompleter-ui.native.js +1 -0
- package/build-module/autocomplete/autocompleter-ui.native.js.map +1 -1
- package/build-module/autocomplete/get-default-use-items.js +1 -0
- package/build-module/autocomplete/get-default-use-items.js.map +1 -1
- package/build-module/autocomplete/index.js +1 -0
- package/build-module/autocomplete/index.js.map +1 -1
- package/build-module/border-box-control/utils.js +1 -0
- package/build-module/border-box-control/utils.js.map +1 -1
- package/build-module/border-control/border-control-dropdown/component.js +1 -0
- package/build-module/border-control/border-control-dropdown/component.js.map +1 -1
- package/build-module/border-control/border-control-style-picker/component.js +1 -0
- package/build-module/border-control/border-control-style-picker/component.js.map +1 -1
- package/build-module/box-control/index.js +15 -15
- package/build-module/box-control/index.js.map +1 -1
- package/build-module/box-control/input-control.js +153 -0
- package/build-module/box-control/input-control.js.map +1 -0
- package/build-module/box-control/types.js.map +1 -1
- package/build-module/box-control/utils.js +48 -46
- package/build-module/box-control/utils.js.map +1 -1
- package/build-module/button/index.native.js +1 -0
- package/build-module/button/index.native.js.map +1 -1
- package/build-module/button/types.js.map +1 -1
- package/build-module/color-indicator/index.native.js +1 -0
- package/build-module/color-indicator/index.native.js.map +1 -1
- package/build-module/color-palette/index.js +1 -0
- package/build-module/color-palette/index.js.map +1 -1
- package/build-module/color-palette/index.native.js +1 -0
- package/build-module/color-palette/index.native.js.map +1 -1
- package/build-module/color-palette/utils.js +1 -0
- package/build-module/color-palette/utils.js.map +1 -1
- package/build-module/combobox-control/index.js +1 -0
- package/build-module/combobox-control/index.js.map +1 -1
- package/build-module/composite/legacy/index.js +1 -0
- package/build-module/composite/legacy/index.js.map +1 -1
- package/build-module/context/context-connect.js +1 -0
- package/build-module/context/context-connect.js.map +1 -1
- package/build-module/custom-gradient-picker/gradient-bar/control-points.js +1 -0
- package/build-module/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
- package/build-module/custom-gradient-picker/gradient-bar/index.js +1 -0
- package/build-module/custom-gradient-picker/gradient-bar/index.js.map +1 -1
- package/build-module/custom-gradient-picker/gradient-bar/utils.js +1 -0
- package/build-module/custom-gradient-picker/gradient-bar/utils.js.map +1 -1
- package/build-module/custom-gradient-picker/index.js +1 -0
- package/build-module/custom-gradient-picker/index.js.map +1 -1
- package/build-module/custom-gradient-picker/serializer.js +1 -0
- package/build-module/custom-gradient-picker/serializer.js.map +1 -1
- package/build-module/custom-gradient-picker/utils.js +1 -0
- package/build-module/custom-gradient-picker/utils.js.map +1 -1
- package/build-module/custom-select-control/index.js +3 -2
- package/build-module/custom-select-control/index.js.map +1 -1
- package/build-module/dashicon/index.js +1 -0
- package/build-module/dashicon/index.js.map +1 -1
- package/build-module/date-time/date/index.js +1 -0
- package/build-module/date-time/date/index.js.map +1 -1
- package/build-module/date-time/date/use-lilius/index.js +1 -0
- package/build-module/date-time/date/use-lilius/index.js.map +1 -1
- package/build-module/date-time/time/index.js +1 -0
- package/build-module/date-time/time/index.js.map +1 -1
- package/build-module/dimension-control/index.js +1 -0
- package/build-module/dimension-control/index.js.map +1 -1
- package/build-module/dimension-control/sizes.js +1 -0
- package/build-module/dimension-control/sizes.js.map +1 -1
- package/build-module/draggable/index.js +1 -0
- package/build-module/draggable/index.js.map +1 -1
- package/build-module/draggable/index.native.js +1 -0
- package/build-module/draggable/index.native.js.map +1 -1
- package/build-module/dropdown-menu/index.js +1 -0
- package/build-module/dropdown-menu/index.js.map +1 -1
- package/build-module/dropdown-menu/index.native.js +1 -0
- package/build-module/dropdown-menu/index.native.js.map +1 -1
- package/build-module/duotone-picker/color-list-picker/index.js +1 -0
- package/build-module/duotone-picker/color-list-picker/index.js.map +1 -1
- package/build-module/duotone-picker/duotone-picker.js +1 -0
- package/build-module/duotone-picker/duotone-picker.js.map +1 -1
- package/build-module/duotone-picker/utils.js +1 -0
- package/build-module/duotone-picker/utils.js.map +1 -1
- package/build-module/external-link/index.js +1 -0
- package/build-module/external-link/index.js.map +1 -1
- package/build-module/font-size-picker/font-size-picker-select.js +1 -0
- package/build-module/font-size-picker/font-size-picker-select.js.map +1 -1
- package/build-module/font-size-picker/font-size-picker-toggle-group.js +1 -0
- package/build-module/font-size-picker/font-size-picker-toggle-group.js.map +1 -1
- package/build-module/font-size-picker/index.js +1 -0
- package/build-module/font-size-picker/index.js.map +1 -1
- package/build-module/font-size-picker/index.native.js +1 -0
- package/build-module/font-size-picker/index.native.js.map +1 -1
- package/build-module/font-size-picker/utils.js +1 -0
- package/build-module/font-size-picker/utils.js.map +1 -1
- package/build-module/form-token-field/index.js +1 -0
- package/build-module/form-token-field/index.js.map +1 -1
- package/build-module/form-token-field/suggestions-list.js +1 -0
- package/build-module/form-token-field/suggestions-list.js.map +1 -1
- package/build-module/gradient-picker/index.js +1 -0
- package/build-module/gradient-picker/index.js.map +1 -1
- package/build-module/guide/index.js +1 -0
- package/build-module/guide/index.js.map +1 -1
- package/build-module/guide/page-control.js +1 -0
- package/build-module/guide/page-control.js.map +1 -1
- package/build-module/h-stack/hook.js +1 -0
- package/build-module/h-stack/hook.js.map +1 -1
- package/build-module/higher-order/navigate-regions/index.js +1 -0
- package/build-module/higher-order/navigate-regions/index.js.map +1 -1
- package/build-module/higher-order/with-fallback-styles/index.js +1 -0
- package/build-module/higher-order/with-fallback-styles/index.js.map +1 -1
- package/build-module/higher-order/with-filters/index.js +1 -0
- package/build-module/higher-order/with-filters/index.js.map +1 -1
- package/build-module/higher-order/with-notices/index.js +1 -0
- package/build-module/higher-order/with-notices/index.js.map +1 -1
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/keyboard-shortcuts/index.js +1 -0
- package/build-module/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/menu/styles.js +16 -16
- package/build-module/menu/styles.js.map +1 -1
- package/build-module/menu-items-choice/index.js +1 -0
- package/build-module/menu-items-choice/index.js.map +1 -1
- package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +1 -0
- package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/keyboard-avoiding-view.native.js +1 -0
- package/build-module/mobile/bottom-sheet/keyboard-avoiding-view.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/picker-cell.native.js +1 -0
- package/build-module/mobile/bottom-sheet/picker-cell.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet-select-control/index.native.js +1 -0
- package/build-module/mobile/bottom-sheet-select-control/index.native.js.map +1 -1
- package/build-module/mobile/color-settings/palette.screen.native.js +1 -0
- package/build-module/mobile/color-settings/palette.screen.native.js.map +1 -1
- package/build-module/mobile/gradient/index.native.js +1 -0
- package/build-module/mobile/gradient/index.native.js.map +1 -1
- package/build-module/mobile/media-edit/index.native.js +1 -0
- package/build-module/mobile/media-edit/index.native.js.map +1 -1
- package/build-module/mobile/picker/index.android.js +1 -0
- package/build-module/mobile/picker/index.android.js.map +1 -1
- package/build-module/mobile/picker/index.ios.js +1 -0
- package/build-module/mobile/picker/index.ios.js.map +1 -1
- package/build-module/mobile/segmented-control/index.native.js +1 -0
- package/build-module/mobile/segmented-control/index.native.js.map +1 -1
- package/build-module/mobile/utils/get-px-from-css-unit.native.js +1 -0
- package/build-module/mobile/utils/get-px-from-css-unit.native.js.map +1 -1
- package/build-module/navigable-container/container.js +1 -0
- package/build-module/navigable-container/container.js.map +1 -1
- package/build-module/navigation/group/index.js +1 -0
- package/build-module/navigation/group/index.js.map +1 -1
- package/build-module/navigation/menu/menu-title-search.js +1 -0
- package/build-module/navigation/menu/menu-title-search.js.map +1 -1
- package/build-module/navigation/menu/search-no-results-found.js +1 -0
- package/build-module/navigation/menu/search-no-results-found.js.map +1 -1
- package/build-module/navigation/styles/navigation-styles.js +12 -12
- package/build-module/navigation/styles/navigation-styles.js.map +1 -1
- package/build-module/navigator/navigator/component.js +1 -0
- package/build-module/navigator/navigator/component.js.map +1 -1
- package/build-module/navigator/navigator-screen/component.js +1 -0
- package/build-module/navigator/navigator-screen/component.js.map +1 -1
- package/build-module/navigator/utils/router.js +1 -0
- package/build-module/navigator/utils/router.js.map +1 -1
- package/build-module/notice/index.js +1 -0
- package/build-module/notice/index.js.map +1 -1
- package/build-module/notice/list.js +1 -0
- package/build-module/notice/list.js.map +1 -1
- package/build-module/notice/list.native.js +1 -0
- package/build-module/notice/list.native.js.map +1 -1
- package/build-module/palette-edit/index.js +1 -0
- package/build-module/palette-edit/index.js.map +1 -1
- package/build-module/panel/actions.native.js +1 -0
- package/build-module/panel/actions.native.js.map +1 -1
- package/build-module/query-controls/index.js +1 -0
- package/build-module/query-controls/index.js.map +1 -1
- package/build-module/query-controls/terms.js +1 -0
- package/build-module/query-controls/terms.js.map +1 -1
- package/build-module/radio-control/index.js +1 -0
- package/build-module/radio-control/index.js.map +1 -1
- package/build-module/radio-control/index.native.js +1 -0
- package/build-module/radio-control/index.native.js.map +1 -1
- package/build-module/range-control/mark.js +0 -1
- package/build-module/range-control/mark.js.map +1 -1
- package/build-module/range-control/rail.js +1 -0
- package/build-module/range-control/rail.js.map +1 -1
- package/build-module/range-control/styles/range-control-styles.js +33 -45
- package/build-module/range-control/styles/range-control-styles.js.map +1 -1
- package/build-module/resizable-box/index.js +1 -0
- package/build-module/resizable-box/index.js.map +1 -1
- package/build-module/sandbox/index.js +1 -0
- package/build-module/sandbox/index.js.map +1 -1
- package/build-module/sandbox/index.native.js +1 -0
- package/build-module/sandbox/index.native.js.map +1 -1
- package/build-module/search-control/index.native.js +1 -0
- package/build-module/search-control/index.native.js.map +1 -1
- package/build-module/select-control/index.js +1 -0
- package/build-module/select-control/index.js.map +1 -1
- package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js +1 -0
- package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
- package/build-module/slot-fill/provider.js +1 -0
- package/build-module/slot-fill/provider.js.map +1 -1
- package/build-module/slot-fill/slot.js +1 -0
- package/build-module/slot-fill/slot.js.map +1 -1
- package/build-module/snackbar/index.js +1 -0
- package/build-module/snackbar/index.js.map +1 -1
- package/build-module/snackbar/list.js +1 -0
- package/build-module/snackbar/list.js.map +1 -1
- package/build-module/tab-panel/index.js +1 -0
- package/build-module/tab-panel/index.js.map +1 -1
- package/build-module/tabs/index.js +1 -0
- package/build-module/tabs/index.js.map +1 -1
- package/build-module/text/utils.js +1 -0
- package/build-module/text/utils.js.map +1 -1
- package/build-module/theme/color-algorithms.js +1 -0
- package/build-module/theme/color-algorithms.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control/styles.js +7 -7
- package/build-module/toggle-group-control/toggle-group-control/styles.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js +8 -8
- package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
- package/build-module/toolbar/toolbar-group/index.js +1 -0
- package/build-module/toolbar/toolbar-group/index.js.map +1 -1
- package/build-module/tools-panel/tools-panel/hook.js +1 -0
- package/build-module/tools-panel/tools-panel/hook.js.map +1 -1
- package/build-module/tools-panel/tools-panel-header/component.js +1 -0
- package/build-module/tools-panel/tools-panel-header/component.js.map +1 -1
- package/build-module/tree-grid/cell.js +4 -1
- package/build-module/tree-grid/cell.js.map +1 -1
- package/build-module/tree-grid/index.js +1 -0
- package/build-module/tree-grid/index.js.map +1 -1
- package/build-module/tree-grid/types.js.map +1 -1
- package/build-module/tree-select/index.js +1 -0
- package/build-module/tree-select/index.js.map +1 -1
- package/build-module/unit-control/index.js +1 -0
- package/build-module/unit-control/index.js.map +1 -1
- package/build-module/unit-control/index.native.js +1 -0
- package/build-module/unit-control/index.native.js.map +1 -1
- package/build-module/unit-control/unit-select-control.js +1 -0
- package/build-module/unit-control/unit-select-control.js.map +1 -1
- package/build-module/unit-control/utils.js +1 -0
- package/build-module/unit-control/utils.js.map +1 -1
- package/build-module/utils/colors-values.js +3 -0
- package/build-module/utils/colors-values.js.map +1 -1
- package/build-module/utils/config-values.js +0 -1
- package/build-module/utils/config-values.js.map +1 -1
- package/build-module/utils/get-valid-children.js +1 -0
- package/build-module/utils/get-valid-children.js.map +1 -1
- package/build-module/utils/hooks/use-animated-offset-rect.js +1 -0
- package/build-module/utils/hooks/use-animated-offset-rect.js.map +1 -1
- package/build-module/utils/hooks/use-cx.js +1 -0
- package/build-module/utils/hooks/use-cx.js.map +1 -1
- package/build-module/utils/math.js +1 -0
- package/build-module/utils/math.js.map +1 -1
- package/build-module/utils/rtl.js +1 -0
- package/build-module/utils/rtl.js.map +1 -1
- package/build-module/utils/values.js +1 -0
- package/build-module/utils/values.js.map +1 -1
- package/build-module/z-stack/component.js +1 -0
- package/build-module/z-stack/component.js.map +1 -1
- package/build-style/style-rtl.css +3 -3
- package/build-style/style.css +3 -3
- package/build-types/alignment-matrix-control/styles.d.ts.map +1 -1
- package/build-types/angle-picker-control/styles/angle-picker-control-styles.d.ts.map +1 -1
- package/build-types/animation/index.d.ts +1 -1
- package/build-types/animation/index.d.ts.map +1 -1
- package/build-types/base-control/hooks.d.ts +4 -4
- package/build-types/base-control/styles/base-control-styles.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control/hook.d.ts +83 -83
- package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts +93 -93
- package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +83 -83
- package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts +83 -83
- package/build-types/border-control/border-control/hook.d.ts +83 -83
- package/build-types/border-control/border-control-dropdown/hook.d.ts +83 -83
- package/build-types/border-control/stories/index.story.d.ts.map +1 -1
- package/build-types/box-control/index.d.ts.map +1 -1
- package/build-types/box-control/input-control.d.ts +3 -0
- package/build-types/box-control/input-control.d.ts.map +1 -0
- package/build-types/box-control/stories/index.story.d.ts +816 -816
- package/build-types/box-control/stories/index.story.d.ts.map +1 -1
- package/build-types/box-control/styles/box-control-icon-styles.d.ts.map +1 -1
- package/build-types/box-control/types.d.ts +9 -1
- package/build-types/box-control/types.d.ts.map +1 -1
- package/build-types/box-control/utils.d.ts +23 -15
- package/build-types/box-control/utils.d.ts.map +1 -1
- package/build-types/button/stories/index.story.d.ts +18 -0
- package/build-types/button/stories/index.story.d.ts.map +1 -1
- package/build-types/button/types.d.ts +6 -4
- package/build-types/button/types.d.ts.map +1 -1
- package/build-types/card/card/hook.d.ts +83 -83
- package/build-types/card/card-body/hook.d.ts +83 -83
- package/build-types/card/card-divider/hook.d.ts +84 -84
- package/build-types/card/card-footer/hook.d.ts +83 -83
- package/build-types/card/card-header/hook.d.ts +83 -83
- package/build-types/card/card-media/hook.d.ts +83 -83
- package/build-types/color-picker/styles.d.ts.map +1 -1
- package/build-types/combobox-control/stories/index.story.d.ts.map +1 -1
- package/build-types/composite/index.d.ts.map +1 -1
- package/build-types/context/constants.d.ts.map +1 -1
- package/build-types/context/get-styled-class-name-from-key.d.ts +1 -9
- package/build-types/context/get-styled-class-name-from-key.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/stories/index.story.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/styles.d.ts.map +1 -1
- package/build-types/date-time/date/styles.d.ts.map +1 -1
- package/build-types/date-time/stories/date-time.story.d.ts.map +1 -1
- package/build-types/date-time/stories/date.story.d.ts.map +1 -1
- package/build-types/date-time/stories/time.story.d.ts.map +1 -1
- package/build-types/date-time/time/styles.d.ts.map +1 -1
- package/build-types/dimension-control/stories/index.story.d.ts.map +1 -1
- package/build-types/dropdown-menu/index.d.ts.map +1 -1
- package/build-types/elevation/hook.d.ts +83 -83
- package/build-types/flex/flex/hook.d.ts +83 -83
- package/build-types/flex/flex-block/hook.d.ts +83 -83
- package/build-types/flex/flex-item/hook.d.ts +83 -83
- package/build-types/focal-point-picker/stories/index.story.d.ts.map +1 -1
- package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts.map +1 -1
- package/build-types/font-size-picker/styles.d.ts.map +1 -1
- package/build-types/grid/hook.d.ts +83 -83
- package/build-types/h-stack/hook.d.ts +83 -83
- package/build-types/heading/hook.d.ts +82 -82
- package/build-types/higher-order/with-fallback-styles/index.d.ts +2 -2
- package/build-types/higher-order/with-filters/index.d.ts +4 -4
- package/build-types/index.d.ts +1 -1
- package/build-types/index.d.ts.map +1 -1
- package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
- package/build-types/item-group/item/hook.d.ts +83 -83
- package/build-types/item-group/item-group/hook.d.ts +83 -83
- package/build-types/menu/styles.d.ts.map +1 -1
- package/build-types/menu-item/stories/index.story.d.ts.map +1 -1
- package/build-types/navigation/styles/navigation-styles.d.ts.map +1 -1
- package/build-types/navigator/navigator-back-button/hook.d.ts +92 -92
- package/build-types/navigator/navigator-button/hook.d.ts +92 -92
- package/build-types/popover/stories/index.story.d.ts.map +1 -1
- package/build-types/progress-bar/styles.d.ts.map +1 -1
- package/build-types/range-control/mark.d.ts.map +1 -1
- package/build-types/range-control/styles/range-control-styles.d.ts +2 -2
- package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
- package/build-types/resizable-box/resize-tooltip/styles/resize-tooltip.styles.d.ts.map +1 -1
- package/build-types/resizable-box/stories/index.story.d.ts.map +1 -1
- package/build-types/scrollable/hook.d.ts +83 -83
- package/build-types/scrollable/stories/index.story.d.ts.map +1 -1
- package/build-types/select-control/index.d.ts.map +1 -1
- package/build-types/select-control/stories/index.story.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 +83 -83
- package/build-types/spinner/styles.d.ts.map +1 -1
- package/build-types/surface/hook.d.ts +83 -83
- package/build-types/text/hook.d.ts +83 -83
- package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel/hook.d.ts +83 -83
- package/build-types/tools-panel/tools-panel-header/hook.d.ts +83 -83
- package/build-types/tools-panel/tools-panel-item/hook.d.ts +83 -83
- package/build-types/tree-grid/cell.d.ts.map +1 -1
- package/build-types/tree-grid/types.d.ts +1 -1
- package/build-types/tree-grid/types.d.ts.map +1 -1
- package/build-types/truncate/hook.d.ts +83 -83
- package/build-types/unit-control/styles/unit-control-styles.d.ts.map +1 -1
- package/build-types/utils/colors-values.d.ts +3 -0
- package/build-types/utils/colors-values.d.ts.map +1 -1
- package/build-types/utils/config-values.d.ts +0 -1
- package/build-types/utils/hooks/use-controlled-state.d.ts +1 -1
- package/build-types/utils/hooks/use-controlled-state.d.ts.map +1 -1
- package/build-types/utils/rtl.d.ts +1 -1
- package/build-types/utils/rtl.d.ts.map +1 -1
- package/build-types/v-stack/hook.d.ts +83 -83
- package/build-types/z-stack/styles.d.ts.map +1 -1
- package/package.json +19 -19
- package/src/alignment-matrix-control/stories/index.story.tsx +2 -2
- package/src/angle-picker-control/stories/index.story.tsx +2 -2
- package/src/animation/index.tsx +0 -1
- package/src/base-control/stories/index.story.tsx +1 -1
- package/src/border-box-control/stories/index.story.tsx +1 -1
- package/src/border-control/stories/index.story.tsx +1 -1
- package/src/box-control/index.tsx +24 -14
- package/src/box-control/input-control.tsx +197 -0
- package/src/box-control/stories/index.story.tsx +1 -1
- package/src/box-control/types.ts +9 -1
- package/src/box-control/utils.ts +62 -60
- package/src/button/README.md +108 -219
- package/src/button/docs-manifest.json +5 -0
- package/src/button/stories/best-practices.mdx +31 -0
- package/src/button/stories/index.story.tsx +18 -0
- package/src/button/types.ts +6 -4
- package/src/button-group/stories/index.story.tsx +1 -1
- package/src/card/stories/index.story.tsx +2 -2
- package/src/checkbox-control/stories/index.story.tsx +1 -1
- package/src/circular-option-picker/stories/index.story.tsx +2 -2
- package/src/color-palette/stories/index.story.tsx +3 -3
- package/src/color-picker/stories/index.story.tsx +2 -2
- package/src/combobox-control/stories/index.story.tsx +1 -1
- package/src/composite/stories/index.story.tsx +3 -3
- package/src/confirm-dialog/stories/index.story.tsx +1 -1
- package/src/custom-select-control/index.tsx +2 -2
- package/src/custom-select-control/stories/index.story.tsx +2 -2
- package/src/custom-select-control-v2/stories/index.story.tsx +2 -2
- package/src/date-time/stories/date-time.story.tsx +4 -1
- package/src/date-time/stories/date.story.tsx +4 -1
- package/src/date-time/stories/time.story.tsx +4 -1
- package/src/dimension-control/stories/index.story.tsx +1 -1
- package/src/disabled/stories/index.story.tsx +3 -3
- package/src/divider/stories/index.story.tsx +1 -1
- package/src/draggable/stories/index.story.tsx +2 -2
- package/src/dropdown/stories/index.story.tsx +7 -7
- package/src/dropdown-menu/index.tsx +3 -1
- package/src/dropdown-menu/stories/index.story.tsx +3 -3
- package/src/duotone-picker/stories/duotone-picker.story.tsx +1 -1
- package/src/flex/stories/index.story.tsx +1 -1
- package/src/font-size-picker/stories/index.story.tsx +1 -1
- package/src/form-file-upload/stories/index.story.tsx +3 -3
- package/src/form-token-field/stories/index.story.tsx +2 -2
- package/src/gradient-picker/stories/index.story.tsx +1 -1
- package/src/grid/stories/index.story.tsx +1 -1
- package/src/h-stack/stories/index.story.tsx +2 -2
- package/src/index.ts +1 -5
- package/src/input-control/stories/index.story.tsx +4 -4
- package/src/item-group/stories/index.story.tsx +2 -2
- package/src/menu/stories/index.story.tsx +2 -2
- package/src/menu/styles.ts +1 -1
- package/src/menu-group/stories/index.story.tsx +1 -1
- package/src/menu-item/stories/index.story.tsx +1 -1
- package/src/menu-items-choice/stories/index.story.tsx +1 -1
- package/src/modal/stories/index.story.tsx +2 -2
- package/src/modal/test/index.tsx +2 -1
- package/src/navigable-container/stories/navigable-menu.story.tsx +1 -1
- package/src/navigable-container/stories/tabbable-container.story.tsx +1 -1
- package/src/navigation/stories/index.story.tsx +4 -4
- package/src/navigation/styles/navigation-styles.tsx +3 -2
- package/src/navigator/stories/index.story.tsx +3 -3
- package/src/number-control/stories/index.story.tsx +1 -1
- package/src/panel/stories/index.story.tsx +1 -1
- package/src/placeholder/stories/index.story.tsx +3 -3
- package/src/popover/stories/index.story.tsx +11 -9
- package/src/query-controls/stories/index.story.tsx +6 -6
- package/src/radio-control/stories/index.story.tsx +1 -1
- package/src/radio-group/stories/index.story.tsx +3 -3
- package/src/range-control/mark.tsx +0 -1
- package/src/range-control/stories/index.story.tsx +7 -7
- package/src/range-control/styles/range-control-styles.ts +18 -19
- package/src/resizable-box/stories/index.story.tsx +1 -1
- package/src/responsive-wrapper/stories/index.story.tsx +1 -1
- package/src/sandbox/stories/index.story.tsx +1 -1
- package/src/scrollable/stories/index.story.tsx +2 -1
- package/src/search-control/stories/index.story.tsx +1 -1
- package/src/select-control/stories/index.story.tsx +1 -1
- package/src/slot-fill/stories/index.story.tsx +2 -2
- package/src/snackbar/stories/index.story.tsx +4 -4
- package/src/snackbar/stories/list.story.tsx +2 -2
- package/src/surface/stories/index.story.tsx +1 -1
- package/src/text-control/stories/index.story.tsx +1 -1
- package/src/textarea-control/stories/index.story.tsx +1 -1
- package/src/theme/stories/index.story.tsx +1 -1
- package/src/toggle-control/stories/index.story.tsx +1 -1
- package/src/toggle-group-control/stories/index.story.tsx +1 -1
- package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +22 -22
- package/src/toggle-group-control/toggle-group-control/styles.ts +1 -1
- package/src/toggle-group-control/toggle-group-control-option-base/styles.ts +6 -6
- package/src/toolbar/stories/index.story.tsx +1 -1
- package/src/tools-panel/stories/index.story.tsx +3 -3
- package/src/tools-panel/test/index.tsx +0 -17
- package/src/tooltip/stories/index.story.tsx +1 -1
- package/src/tree-grid/cell.tsx +5 -1
- package/src/tree-grid/stories/index.story.tsx +1 -1
- package/src/tree-grid/types.ts +1 -1
- package/src/tree-select/stories/index.story.tsx +1 -1
- package/src/unit-control/stories/index.story.tsx +4 -4
- package/src/utils/colors-values.js +3 -0
- package/src/utils/config-values.js +0 -1
- package/src/view/stories/index.story.tsx +1 -1
- package/src/visually-hidden/stories/index.story.tsx +1 -1
- package/src/z-stack/stories/index.story.tsx +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/build/box-control/all-input-control.js +0 -91
- package/build/box-control/all-input-control.js.map +0 -1
- package/build/box-control/axial-input-controls.js +0 -125
- package/build/box-control/axial-input-controls.js.map +0 -1
- package/build/box-control/input-controls.js +0 -133
- package/build/box-control/input-controls.js.map +0 -1
- package/build-module/box-control/all-input-control.js +0 -84
- package/build-module/box-control/all-input-control.js.map +0 -1
- package/build-module/box-control/axial-input-controls.js +0 -116
- package/build-module/box-control/axial-input-controls.js.map +0 -1
- package/build-module/box-control/input-controls.js +0 -124
- package/build-module/box-control/input-controls.js.map +0 -1
- package/build-types/box-control/all-input-control.d.ts +0 -3
- package/build-types/box-control/all-input-control.d.ts.map +0 -1
- package/build-types/box-control/axial-input-controls.d.ts +0 -3
- package/build-types/box-control/axial-input-controls.d.ts.map +0 -1
- package/build-types/box-control/input-controls.d.ts +0 -3
- package/build-types/box-control/input-controls.d.ts.map +0 -1
- package/src/box-control/all-input-control.tsx +0 -110
- package/src/box-control/axial-input-controls.tsx +0 -165
- package/src/box-control/input-controls.tsx +0 -167
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useInstanceId","parseQuantityAndUnitFromRawValue","Tooltip","CUSTOM_VALUE_SETTINGS","LABELS","FlexedBoxControlIcon","FlexedRangeControl","InputWrapper","StyledUnitControl","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","createElement","_createElement","groupedSides","AxialInputControls","__next40pxDefaultSize","onChange","onFocus","values","selectedUnits","setSelectedUnits","sides","props","generatedId","createHandleOnFocus","side","event","handleOnValueChange","next","nextValues","isNumeric","undefined","isNaN","parseFloat","nextValue","top","bottom","left","right","createHandleOnUnitChange","newUnits","filteredSides","length","filter","includes","children","map","_CUSTOM_VALUE_SETTING","_CUSTOM_VALUE_SETTING2","parsedQuantity","parsedUnit","selectedUnit","inputId","join","placement","text","__shouldNotWarnDeprecated36pxSize","className","id","isPressEnterToChange","value","newValue","onUnitChange","label","hideLabelFromVision","key","__nextHasNoMarginBottom","min","max","step","withInputField"],"sources":["@wordpress/components/src/box-control/axial-input-controls.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\n/**\n * Internal dependencies\n */\nimport { parseQuantityAndUnitFromRawValue } from '../unit-control/utils';\nimport Tooltip from '../tooltip';\nimport { CUSTOM_VALUE_SETTINGS, LABELS } from './utils';\nimport {\n\tFlexedBoxControlIcon,\n\tFlexedRangeControl,\n\tInputWrapper,\n\tStyledUnitControl,\n} from './styles/box-control-styles';\nimport type { BoxControlInputControlProps } from './types';\n\nconst groupedSides = [ 'vertical', 'horizontal' ] as const;\ntype GroupedSide = ( typeof groupedSides )[ number ];\n\nexport default function AxialInputControls( {\n\t__next40pxDefaultSize,\n\tonChange,\n\tonFocus,\n\tvalues,\n\tselectedUnits,\n\tsetSelectedUnits,\n\tsides,\n\t...props\n}: BoxControlInputControlProps ) {\n\tconst generatedId = useInstanceId(\n\t\tAxialInputControls,\n\t\t`box-control-input`\n\t);\n\n\tconst createHandleOnFocus =\n\t\t( side: GroupedSide ) =>\n\t\t( event: React.FocusEvent< HTMLInputElement > ) => {\n\t\t\tif ( ! onFocus ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tonFocus( event, { side } );\n\t\t};\n\n\tconst handleOnValueChange = ( side: GroupedSide, next?: string ) => {\n\t\tif ( ! onChange ) {\n\t\t\treturn;\n\t\t}\n\t\tconst nextValues = { ...values };\n\t\tconst isNumeric = next !== undefined && ! isNaN( parseFloat( next ) );\n\t\tconst nextValue = isNumeric ? next : undefined;\n\n\t\tif ( side === 'vertical' ) {\n\t\t\tnextValues.top = nextValue;\n\t\t\tnextValues.bottom = nextValue;\n\t\t}\n\n\t\tif ( side === 'horizontal' ) {\n\t\t\tnextValues.left = nextValue;\n\t\t\tnextValues.right = nextValue;\n\t\t}\n\n\t\tonChange( nextValues );\n\t};\n\n\tconst createHandleOnUnitChange =\n\t\t( side: GroupedSide ) => ( next?: string ) => {\n\t\t\tconst newUnits = { ...selectedUnits };\n\n\t\t\tif ( side === 'vertical' ) {\n\t\t\t\tnewUnits.top = next;\n\t\t\t\tnewUnits.bottom = next;\n\t\t\t}\n\n\t\t\tif ( side === 'horizontal' ) {\n\t\t\t\tnewUnits.left = next;\n\t\t\t\tnewUnits.right = next;\n\t\t\t}\n\n\t\t\tsetSelectedUnits( newUnits );\n\t\t};\n\n\t// Filter sides if custom configuration provided, maintaining default order.\n\tconst filteredSides = sides?.length\n\t\t? groupedSides.filter( ( side ) => sides.includes( side ) )\n\t\t: groupedSides;\n\n\treturn (\n\t\t<>\n\t\t\t{ filteredSides.map( ( side ) => {\n\t\t\t\tconst [ parsedQuantity, parsedUnit ] =\n\t\t\t\t\tparseQuantityAndUnitFromRawValue(\n\t\t\t\t\t\tside === 'vertical' ? values.top : values.left\n\t\t\t\t\t);\n\t\t\t\tconst selectedUnit =\n\t\t\t\t\tside === 'vertical'\n\t\t\t\t\t\t? selectedUnits.top\n\t\t\t\t\t\t: selectedUnits.left;\n\n\t\t\t\tconst inputId = [ generatedId, side ].join( '-' );\n\n\t\t\t\treturn (\n\t\t\t\t\t<InputWrapper key={ side }>\n\t\t\t\t\t\t<FlexedBoxControlIcon side={ side } sides={ sides } />\n\t\t\t\t\t\t<Tooltip placement=\"top-end\" text={ LABELS[ side ] }>\n\t\t\t\t\t\t\t<StyledUnitControl\n\t\t\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\t\t\t__shouldNotWarnDeprecated36pxSize\n\t\t\t\t\t\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\t\t\t\t\t\tclassName=\"component-box-control__unit-control\"\n\t\t\t\t\t\t\t\tid={ inputId }\n\t\t\t\t\t\t\t\tisPressEnterToChange\n\t\t\t\t\t\t\t\tvalue={ [\n\t\t\t\t\t\t\t\t\tparsedQuantity,\n\t\t\t\t\t\t\t\t\tselectedUnit ?? parsedUnit,\n\t\t\t\t\t\t\t\t].join( '' ) }\n\t\t\t\t\t\t\t\tonChange={ ( newValue ) =>\n\t\t\t\t\t\t\t\t\thandleOnValueChange( side, newValue )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonUnitChange={ createHandleOnUnitChange(\n\t\t\t\t\t\t\t\t\tside\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tonFocus={ createHandleOnFocus( side ) }\n\t\t\t\t\t\t\t\tlabel={ LABELS[ side ] }\n\t\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\t\tkey={ side }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t<FlexedRangeControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\t\t\t\t\t__shouldNotWarnDeprecated36pxSize\n\t\t\t\t\t\t\taria-controls={ inputId }\n\t\t\t\t\t\t\tlabel={ LABELS[ side ] }\n\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\tonChange={ ( newValue ) =>\n\t\t\t\t\t\t\t\thandleOnValueChange(\n\t\t\t\t\t\t\t\t\tside,\n\t\t\t\t\t\t\t\t\tnewValue !== undefined\n\t\t\t\t\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t\t\t\t\tnewValue,\n\t\t\t\t\t\t\t\t\t\t\t\tselectedUnit ?? parsedUnit,\n\t\t\t\t\t\t\t\t\t\t ].join( '' )\n\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\t\tmax={\n\t\t\t\t\t\t\t\tCUSTOM_VALUE_SETTINGS[ selectedUnit ?? 'px' ]\n\t\t\t\t\t\t\t\t\t?.max ?? 10\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tstep={\n\t\t\t\t\t\t\t\tCUSTOM_VALUE_SETTINGS[ selectedUnit ?? 'px' ]\n\t\t\t\t\t\t\t\t\t?.step ?? 0.1\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvalue={ parsedQuantity ?? 0 }\n\t\t\t\t\t\t\twithInputField={ false }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</InputWrapper>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,QAAQ,oBAAoB;AAClD;AACA;AACA;AACA,SAASC,gCAAgC,QAAQ,uBAAuB;AACxE,OAAOC,OAAO,MAAM,YAAY;AAChC,SAASC,qBAAqB,EAAEC,MAAM,QAAQ,SAAS;AACvD,SACCC,oBAAoB,EACpBC,kBAAkB,EAClBC,YAAY,EACZC,iBAAiB,QACX,6BAA6B;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA,EAAAC,QAAA,IAAAC,SAAA;AAAA,SAAAC,aAAA,IAAAC,cAAA;AAGrC,MAAMC,YAAY,GAAG,CAAE,UAAU,EAAE,YAAY,CAAW;AAG1D,eAAe,SAASC,kBAAkBA,CAAE;EAC3CC,qBAAqB;EACrBC,QAAQ;EACRC,OAAO;EACPC,MAAM;EACNC,aAAa;EACbC,gBAAgB;EAChBC,KAAK;EACL,GAAGC;AACyB,CAAC,EAAG;EAChC,MAAMC,WAAW,GAAG3B,aAAa,CAChCkB,kBAAkB,EAClB,mBACD,CAAC;EAED,MAAMU,mBAAmB,GACtBC,IAAiB,IACjBC,KAA2C,IAAM;IAClD,IAAK,CAAET,OAAO,EAAG;MAChB;IACD;IACAA,OAAO,CAAES,KAAK,EAAE;MAAED;IAAK,CAAE,CAAC;EAC3B,CAAC;EAEF,MAA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CACZ;QAAC,CACM,CAAC,eACVnB,IAAA,CAACJ,kBAAkB;UAClBgE,uBAAuB;UACvBnD,qBAAqB,EAAGA,qBAAuB;UAC/CyC,iCAAiC;UACjC,iBAAgBJ,OAAS;UACzBW,KAAK,EAAG/D,MAAM,CAAEyB,IAAI,CAAI;UACxBuC,mBAAmB;UACnBhD,QAAQ,EAAK6C,QAAQ,IACpBlC,mBAAmB,CAClBF,IAAI,EACJoC,QAAQ,KAAK9B,SAAS,GACnB,CACA8B,QAAQ,EACRV,YAAY,aAAZA,YAAY,cAAZA,YAAY,GAAID,UAAU,CACzB,CAACG,IAAI,CAAE,EAAG,CAAC,GACZtB,SACJ,CACA;UACDoC,GAAG,EAAG,CAAG;UACTC,GAAG,GAAArB,qBAAA,GACFhD,qBAAqB,CAAEoD,YAAY,aAAZA,YAAY,cAAZA,YAAY,GAAI,IAAI,CAAE,EAC1CiB,GAAG,cAAArB,qBAAA,cAAAA,qBAAA,GAAI,EACV;UACDsB,IAAI,GAAArB,sBAAA,GACHjD,qBAAqB,CAAEoD,YAAY,aAAZA,YAAY,cAAZA,YAAY,GAAI,IAAI,CAAE,EAC1CkB,IAAI,cAAArB,sBAAA,cAAAA,sBAAA,GAAI,GACX;UACDY,KAAK,EAAGX,cAAc,aAAdA,cAAc,cAAdA,cAAc,GAAI,CAAG;UAC7BqB,cAAc,EAAG;QAAO,CACxB,CAAC;MAAA,GAvDiB7C,IAwDN,CAAC;IAEjB,CAAE;EAAC,CACF,CAAC;AAEL","ignoreList":[]}
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useInstanceId } from '@wordpress/compose';
|
|
5
|
-
/**
|
|
6
|
-
* Internal dependencies
|
|
7
|
-
*/
|
|
8
|
-
import Tooltip from '../tooltip';
|
|
9
|
-
import { parseQuantityAndUnitFromRawValue } from '../unit-control/utils';
|
|
10
|
-
import { ALL_SIDES, CUSTOM_VALUE_SETTINGS, LABELS } from './utils';
|
|
11
|
-
import { FlexedBoxControlIcon, FlexedRangeControl, InputWrapper, StyledUnitControl } from './styles/box-control-styles';
|
|
12
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
13
|
-
const noop = () => {};
|
|
14
|
-
export default function BoxInputControls({
|
|
15
|
-
__next40pxDefaultSize,
|
|
16
|
-
onChange = noop,
|
|
17
|
-
onFocus = noop,
|
|
18
|
-
values,
|
|
19
|
-
selectedUnits,
|
|
20
|
-
setSelectedUnits,
|
|
21
|
-
sides,
|
|
22
|
-
...props
|
|
23
|
-
}) {
|
|
24
|
-
const generatedId = useInstanceId(BoxInputControls, 'box-control-input');
|
|
25
|
-
const createHandleOnFocus = side => event => {
|
|
26
|
-
onFocus(event, {
|
|
27
|
-
side
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
const handleOnChange = nextValues => {
|
|
31
|
-
onChange(nextValues);
|
|
32
|
-
};
|
|
33
|
-
const handleOnValueChange = (side, next, extra) => {
|
|
34
|
-
const nextValues = {
|
|
35
|
-
...values
|
|
36
|
-
};
|
|
37
|
-
const isNumeric = next !== undefined && !isNaN(parseFloat(next));
|
|
38
|
-
const nextValue = isNumeric ? next : undefined;
|
|
39
|
-
nextValues[side] = nextValue;
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Supports changing pair sides. For example, holding the ALT key
|
|
43
|
-
* when changing the TOP will also update BOTTOM.
|
|
44
|
-
*/
|
|
45
|
-
// @ts-expect-error - TODO: event.altKey is only present when the change event was
|
|
46
|
-
// triggered by a keyboard event. Should this feature be implemented differently so
|
|
47
|
-
// it also works with drag events?
|
|
48
|
-
if (extra?.event.altKey) {
|
|
49
|
-
switch (side) {
|
|
50
|
-
case 'top':
|
|
51
|
-
nextValues.bottom = nextValue;
|
|
52
|
-
break;
|
|
53
|
-
case 'bottom':
|
|
54
|
-
nextValues.top = nextValue;
|
|
55
|
-
break;
|
|
56
|
-
case 'left':
|
|
57
|
-
nextValues.right = nextValue;
|
|
58
|
-
break;
|
|
59
|
-
case 'right':
|
|
60
|
-
nextValues.left = nextValue;
|
|
61
|
-
break;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
handleOnChange(nextValues);
|
|
65
|
-
};
|
|
66
|
-
const createHandleOnUnitChange = side => next => {
|
|
67
|
-
const newUnits = {
|
|
68
|
-
...selectedUnits
|
|
69
|
-
};
|
|
70
|
-
newUnits[side] = next;
|
|
71
|
-
setSelectedUnits(newUnits);
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
// Filter sides if custom configuration provided, maintaining default order.
|
|
75
|
-
const filteredSides = sides?.length ? ALL_SIDES.filter(side => sides.includes(side)) : ALL_SIDES;
|
|
76
|
-
return /*#__PURE__*/_jsx(_Fragment, {
|
|
77
|
-
children: filteredSides.map(side => {
|
|
78
|
-
var _CUSTOM_VALUE_SETTING, _CUSTOM_VALUE_SETTING2;
|
|
79
|
-
const [parsedQuantity, parsedUnit] = parseQuantityAndUnitFromRawValue(values[side]);
|
|
80
|
-
const computedUnit = values[side] ? parsedUnit : selectedUnits[side];
|
|
81
|
-
const inputId = [generatedId, side].join('-');
|
|
82
|
-
return /*#__PURE__*/_jsxs(InputWrapper, {
|
|
83
|
-
expanded: true,
|
|
84
|
-
children: [/*#__PURE__*/_jsx(FlexedBoxControlIcon, {
|
|
85
|
-
side: side,
|
|
86
|
-
sides: sides
|
|
87
|
-
}), /*#__PURE__*/_jsx(Tooltip, {
|
|
88
|
-
placement: "top-end",
|
|
89
|
-
text: LABELS[side],
|
|
90
|
-
children: /*#__PURE__*/_jsx(StyledUnitControl, {
|
|
91
|
-
...props,
|
|
92
|
-
__shouldNotWarnDeprecated36pxSize: true,
|
|
93
|
-
__next40pxDefaultSize: __next40pxDefaultSize,
|
|
94
|
-
className: "component-box-control__unit-control",
|
|
95
|
-
id: inputId,
|
|
96
|
-
isPressEnterToChange: true,
|
|
97
|
-
value: [parsedQuantity, computedUnit].join(''),
|
|
98
|
-
onChange: (nextValue, extra) => handleOnValueChange(side, nextValue, extra),
|
|
99
|
-
onUnitChange: createHandleOnUnitChange(side),
|
|
100
|
-
onFocus: createHandleOnFocus(side),
|
|
101
|
-
label: LABELS[side],
|
|
102
|
-
hideLabelFromVision: true
|
|
103
|
-
})
|
|
104
|
-
}), /*#__PURE__*/_jsx(FlexedRangeControl, {
|
|
105
|
-
__nextHasNoMarginBottom: true,
|
|
106
|
-
__next40pxDefaultSize: __next40pxDefaultSize,
|
|
107
|
-
__shouldNotWarnDeprecated36pxSize: true,
|
|
108
|
-
"aria-controls": inputId,
|
|
109
|
-
label: LABELS[side],
|
|
110
|
-
hideLabelFromVision: true,
|
|
111
|
-
onChange: newValue => {
|
|
112
|
-
handleOnValueChange(side, newValue !== undefined ? [newValue, computedUnit].join('') : undefined);
|
|
113
|
-
},
|
|
114
|
-
min: 0,
|
|
115
|
-
max: (_CUSTOM_VALUE_SETTING = CUSTOM_VALUE_SETTINGS[computedUnit !== null && computedUnit !== void 0 ? computedUnit : 'px']?.max) !== null && _CUSTOM_VALUE_SETTING !== void 0 ? _CUSTOM_VALUE_SETTING : 10,
|
|
116
|
-
step: (_CUSTOM_VALUE_SETTING2 = CUSTOM_VALUE_SETTINGS[computedUnit !== null && computedUnit !== void 0 ? computedUnit : 'px']?.step) !== null && _CUSTOM_VALUE_SETTING2 !== void 0 ? _CUSTOM_VALUE_SETTING2 : 0.1,
|
|
117
|
-
value: parsedQuantity !== null && parsedQuantity !== void 0 ? parsedQuantity : 0,
|
|
118
|
-
withInputField: false
|
|
119
|
-
})]
|
|
120
|
-
}, `box-control-${side}`);
|
|
121
|
-
})
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
//# sourceMappingURL=input-controls.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useInstanceId","Tooltip","parseQuantityAndUnitFromRawValue","ALL_SIDES","CUSTOM_VALUE_SETTINGS","LABELS","FlexedBoxControlIcon","FlexedRangeControl","InputWrapper","StyledUnitControl","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","noop","BoxInputControls","__next40pxDefaultSize","onChange","onFocus","values","selectedUnits","setSelectedUnits","sides","props","generatedId","createHandleOnFocus","side","event","handleOnChange","nextValues","handleOnValueChange","next","extra","isNumeric","undefined","isNaN","parseFloat","nextValue","altKey","bottom","top","right","left","createHandleOnUnitChange","newUnits","filteredSides","length","filter","includes","children","map","_CUSTOM_VALUE_SETTING","_CUSTOM_VALUE_SETTING2","parsedQuantity","parsedUnit","computedUnit","inputId","join","expanded","placement","text","__shouldNotWarnDeprecated36pxSize","className","id","isPressEnterToChange","value","onUnitChange","label","hideLabelFromVision","__nextHasNoMarginBottom","newValue","min","max","step","withInputField"],"sources":["@wordpress/components/src/box-control/input-controls.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\n/**\n * Internal dependencies\n */\nimport Tooltip from '../tooltip';\nimport { parseQuantityAndUnitFromRawValue } from '../unit-control/utils';\nimport { ALL_SIDES, CUSTOM_VALUE_SETTINGS, LABELS } from './utils';\nimport {\n\tFlexedBoxControlIcon,\n\tFlexedRangeControl,\n\tInputWrapper,\n\tStyledUnitControl,\n} from './styles/box-control-styles';\nimport type { BoxControlInputControlProps, BoxControlValue } from './types';\n\nconst noop = () => {};\n\nexport default function BoxInputControls( {\n\t__next40pxDefaultSize,\n\tonChange = noop,\n\tonFocus = noop,\n\tvalues,\n\tselectedUnits,\n\tsetSelectedUnits,\n\tsides,\n\t...props\n}: BoxControlInputControlProps ) {\n\tconst generatedId = useInstanceId( BoxInputControls, 'box-control-input' );\n\n\tconst createHandleOnFocus =\n\t\t( side: keyof BoxControlValue ) =>\n\t\t( event: React.FocusEvent< HTMLInputElement > ) => {\n\t\t\tonFocus( event, { side } );\n\t\t};\n\n\tconst handleOnChange = ( nextValues: BoxControlValue ) => {\n\t\tonChange( nextValues );\n\t};\n\n\tconst handleOnValueChange = (\n\t\tside: keyof BoxControlValue,\n\t\tnext?: string,\n\t\textra?: { event: React.SyntheticEvent< Element, Event > }\n\t) => {\n\t\tconst nextValues = { ...values };\n\t\tconst isNumeric = next !== undefined && ! isNaN( parseFloat( next ) );\n\t\tconst nextValue = isNumeric ? next : undefined;\n\n\t\tnextValues[ side ] = nextValue;\n\n\t\t/**\n\t\t * Supports changing pair sides. For example, holding the ALT key\n\t\t * when changing the TOP will also update BOTTOM.\n\t\t */\n\t\t// @ts-expect-error - TODO: event.altKey is only present when the change event was\n\t\t// triggered by a keyboard event. Should this feature be implemented differently so\n\t\t// it also works with drag events?\n\t\tif ( extra?.event.altKey ) {\n\t\t\tswitch ( side ) {\n\t\t\t\tcase 'top':\n\t\t\t\t\tnextValues.bottom = nextValue;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'bottom':\n\t\t\t\t\tnextValues.top = nextValue;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'left':\n\t\t\t\t\tnextValues.right = nextValue;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'right':\n\t\t\t\t\tnextValues.left = nextValue;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\thandleOnChange( nextValues );\n\t};\n\n\tconst createHandleOnUnitChange =\n\t\t( side: keyof BoxControlValue ) => ( next?: string ) => {\n\t\t\tconst newUnits = { ...selectedUnits };\n\t\t\tnewUnits[ side ] = next;\n\t\t\tsetSelectedUnits( newUnits );\n\t\t};\n\n\t// Filter sides if custom configuration provided, maintaining default order.\n\tconst filteredSides = sides?.length\n\t\t? ALL_SIDES.filter( ( side ) => sides.includes( side ) )\n\t\t: ALL_SIDES;\n\n\treturn (\n\t\t<>\n\t\t\t{ filteredSides.map( ( side ) => {\n\t\t\t\tconst [ parsedQuantity, parsedUnit ] =\n\t\t\t\t\tparseQuantityAndUnitFromRawValue( values[ side ] );\n\n\t\t\t\tconst computedUnit = values[ side ]\n\t\t\t\t\t? parsedUnit\n\t\t\t\t\t: selectedUnits[ side ];\n\n\t\t\t\tconst inputId = [ generatedId, side ].join( '-' );\n\n\t\t\t\treturn (\n\t\t\t\t\t<InputWrapper key={ `box-control-${ side }` } expanded>\n\t\t\t\t\t\t<FlexedBoxControlIcon side={ side } sides={ sides } />\n\t\t\t\t\t\t<Tooltip placement=\"top-end\" text={ LABELS[ side ] }>\n\t\t\t\t\t\t\t<StyledUnitControl\n\t\t\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\t\t\t__shouldNotWarnDeprecated36pxSize\n\t\t\t\t\t\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\t\t\t\t\t\tclassName=\"component-box-control__unit-control\"\n\t\t\t\t\t\t\t\tid={ inputId }\n\t\t\t\t\t\t\t\tisPressEnterToChange\n\t\t\t\t\t\t\t\tvalue={ [ parsedQuantity, computedUnit ].join(\n\t\t\t\t\t\t\t\t\t''\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tonChange={ ( nextValue, extra ) =>\n\t\t\t\t\t\t\t\t\thandleOnValueChange(\n\t\t\t\t\t\t\t\t\t\tside,\n\t\t\t\t\t\t\t\t\t\tnextValue,\n\t\t\t\t\t\t\t\t\t\textra\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonUnitChange={ createHandleOnUnitChange(\n\t\t\t\t\t\t\t\t\tside\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tonFocus={ createHandleOnFocus( side ) }\n\t\t\t\t\t\t\t\tlabel={ LABELS[ side ] }\n\t\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Tooltip>\n\n\t\t\t\t\t\t<FlexedRangeControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\t\t\t\t\t__shouldNotWarnDeprecated36pxSize\n\t\t\t\t\t\t\taria-controls={ inputId }\n\t\t\t\t\t\t\tlabel={ LABELS[ side ] }\n\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\tonChange={ ( newValue ) => {\n\t\t\t\t\t\t\t\thandleOnValueChange(\n\t\t\t\t\t\t\t\t\tside,\n\t\t\t\t\t\t\t\t\tnewValue !== undefined\n\t\t\t\t\t\t\t\t\t\t? [ newValue, computedUnit ].join( '' )\n\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\t\tmax={\n\t\t\t\t\t\t\t\tCUSTOM_VALUE_SETTINGS[ computedUnit ?? 'px' ]\n\t\t\t\t\t\t\t\t\t?.max ?? 10\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tstep={\n\t\t\t\t\t\t\t\tCUSTOM_VALUE_SETTINGS[ computedUnit ?? 'px' ]\n\t\t\t\t\t\t\t\t\t?.step ?? 0.1\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvalue={ parsedQuantity ?? 0 }\n\t\t\t\t\t\t\twithInputField={ false }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</InputWrapper>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,QAAQ,oBAAoB;AAClD;AACA;AACA;AACA,OAAOC,OAAO,MAAM,YAAY;AAChC,SAASC,gCAAgC,QAAQ,uBAAuB;AACxE,SAASC,SAAS,EAAEC,qBAAqB,EAAEC,MAAM,QAAQ,SAAS;AAClE,SACCC,oBAAoB,EACpBC,kBAAkB,EAClBC,YAAY,EACZC,iBAAiB,QACX,6BAA6B;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA,EAAAC,QAAA,IAAAC,SAAA;AAGrC,MAAMC,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AAErB,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AAI,EAwD1B,CAAC;IAEjB,CAAE;EAAC,CACF,CAAC;AAEL","ignoreList":[]}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { BoxControlInputControlProps } from './types';
|
|
2
|
-
export default function AllInputControl({ __next40pxDefaultSize, onChange, onFocus, values, sides, selectedUnits, setSelectedUnits, ...props }: BoxControlInputControlProps): import("react").JSX.Element;
|
|
3
|
-
//# sourceMappingURL=all-input-control.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"all-input-control.d.ts","sourceRoot":"","sources":["../../src/box-control/all-input-control.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAa3D,MAAM,CAAC,OAAO,UAAU,eAAe,CAAE,EACxC,qBAAqB,EACrB,QAAe,EACf,OAAc,EACd,MAAM,EACN,KAAK,EACL,aAAa,EACb,gBAAgB,EAChB,GAAG,KAAK,EACR,EAAE,2BAA2B,+BA2E7B"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { BoxControlInputControlProps } from './types';
|
|
2
|
-
export default function AxialInputControls({ __next40pxDefaultSize, onChange, onFocus, values, selectedUnits, setSelectedUnits, sides, ...props }: BoxControlInputControlProps): import("react").JSX.Element;
|
|
3
|
-
//# sourceMappingURL=axial-input-controls.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"axial-input-controls.d.ts","sourceRoot":"","sources":["../../src/box-control/axial-input-controls.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAK3D,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAE,EAC3C,qBAAqB,EACrB,QAAQ,EACR,OAAO,EACP,MAAM,EACN,aAAa,EACb,gBAAgB,EAChB,KAAK,EACL,GAAG,KAAK,EACR,EAAE,2BAA2B,+BAsI7B"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { BoxControlInputControlProps } from './types';
|
|
2
|
-
export default function BoxInputControls({ __next40pxDefaultSize, onChange, onFocus, values, selectedUnits, setSelectedUnits, sides, ...props }: BoxControlInputControlProps): import("react").JSX.Element;
|
|
3
|
-
//# sourceMappingURL=input-controls.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"input-controls.d.ts","sourceRoot":"","sources":["../../src/box-control/input-controls.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,2BAA2B,EAAmB,MAAM,SAAS,CAAC;AAI5E,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAE,EACzC,qBAAqB,EACrB,QAAe,EACf,OAAc,EACd,MAAM,EACN,aAAa,EACb,gBAAgB,EAChB,KAAK,EACL,GAAG,KAAK,EACR,EAAE,2BAA2B,+BAyI7B"}
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useInstanceId } from '@wordpress/compose';
|
|
5
|
-
/**
|
|
6
|
-
* Internal dependencies
|
|
7
|
-
*/
|
|
8
|
-
import type { UnitControlProps } from '../unit-control/types';
|
|
9
|
-
import {
|
|
10
|
-
FlexedRangeControl,
|
|
11
|
-
StyledUnitControl,
|
|
12
|
-
} from './styles/box-control-styles';
|
|
13
|
-
import type { BoxControlInputControlProps } from './types';
|
|
14
|
-
import { parseQuantityAndUnitFromRawValue } from '../unit-control';
|
|
15
|
-
import {
|
|
16
|
-
LABELS,
|
|
17
|
-
applyValueToSides,
|
|
18
|
-
getAllValue,
|
|
19
|
-
isValuesMixed,
|
|
20
|
-
isValuesDefined,
|
|
21
|
-
CUSTOM_VALUE_SETTINGS,
|
|
22
|
-
} from './utils';
|
|
23
|
-
|
|
24
|
-
const noop = () => {};
|
|
25
|
-
|
|
26
|
-
export default function AllInputControl( {
|
|
27
|
-
__next40pxDefaultSize,
|
|
28
|
-
onChange = noop,
|
|
29
|
-
onFocus = noop,
|
|
30
|
-
values,
|
|
31
|
-
sides,
|
|
32
|
-
selectedUnits,
|
|
33
|
-
setSelectedUnits,
|
|
34
|
-
...props
|
|
35
|
-
}: BoxControlInputControlProps ) {
|
|
36
|
-
const inputId = useInstanceId( AllInputControl, 'box-control-input-all' );
|
|
37
|
-
|
|
38
|
-
const allValue = getAllValue( values, selectedUnits, sides );
|
|
39
|
-
const hasValues = isValuesDefined( values );
|
|
40
|
-
const isMixed = hasValues && isValuesMixed( values, selectedUnits, sides );
|
|
41
|
-
const allPlaceholder = isMixed ? LABELS.mixed : undefined;
|
|
42
|
-
|
|
43
|
-
const [ parsedQuantity, parsedUnit ] =
|
|
44
|
-
parseQuantityAndUnitFromRawValue( allValue );
|
|
45
|
-
|
|
46
|
-
const handleOnFocus: React.FocusEventHandler< HTMLInputElement > = (
|
|
47
|
-
event
|
|
48
|
-
) => {
|
|
49
|
-
onFocus( event, { side: 'all' } );
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
const onValueChange = ( next?: string ) => {
|
|
53
|
-
const isNumeric = next !== undefined && ! isNaN( parseFloat( next ) );
|
|
54
|
-
const nextValue = isNumeric ? next : undefined;
|
|
55
|
-
const nextValues = applyValueToSides( values, nextValue, sides );
|
|
56
|
-
|
|
57
|
-
onChange( nextValues );
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
const sliderOnChange = ( next?: number ) => {
|
|
61
|
-
onValueChange(
|
|
62
|
-
next !== undefined ? [ next, parsedUnit ].join( '' ) : undefined
|
|
63
|
-
);
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
// Set selected unit so it can be used as fallback by unlinked controls
|
|
67
|
-
// when individual sides do not have a value containing a unit.
|
|
68
|
-
const handleOnUnitChange: UnitControlProps[ 'onUnitChange' ] = ( unit ) => {
|
|
69
|
-
const newUnits = applyValueToSides( selectedUnits, unit, sides );
|
|
70
|
-
setSelectedUnits( newUnits );
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
return (
|
|
74
|
-
<>
|
|
75
|
-
<StyledUnitControl
|
|
76
|
-
{ ...props }
|
|
77
|
-
__shouldNotWarnDeprecated36pxSize
|
|
78
|
-
__next40pxDefaultSize={ __next40pxDefaultSize }
|
|
79
|
-
className="component-box-control__unit-control"
|
|
80
|
-
disableUnits={ isMixed }
|
|
81
|
-
id={ inputId }
|
|
82
|
-
isPressEnterToChange
|
|
83
|
-
value={ allValue }
|
|
84
|
-
onChange={ onValueChange }
|
|
85
|
-
onUnitChange={ handleOnUnitChange }
|
|
86
|
-
onFocus={ handleOnFocus }
|
|
87
|
-
placeholder={ allPlaceholder }
|
|
88
|
-
label={ LABELS.all }
|
|
89
|
-
hideLabelFromVision
|
|
90
|
-
/>
|
|
91
|
-
|
|
92
|
-
<FlexedRangeControl
|
|
93
|
-
__nextHasNoMarginBottom
|
|
94
|
-
__next40pxDefaultSize={ __next40pxDefaultSize }
|
|
95
|
-
__shouldNotWarnDeprecated36pxSize
|
|
96
|
-
aria-controls={ inputId }
|
|
97
|
-
label={ LABELS.all }
|
|
98
|
-
hideLabelFromVision
|
|
99
|
-
onChange={ sliderOnChange }
|
|
100
|
-
min={ 0 }
|
|
101
|
-
max={ CUSTOM_VALUE_SETTINGS[ parsedUnit ?? 'px' ]?.max ?? 10 }
|
|
102
|
-
step={
|
|
103
|
-
CUSTOM_VALUE_SETTINGS[ parsedUnit ?? 'px' ]?.step ?? 0.1
|
|
104
|
-
}
|
|
105
|
-
value={ parsedQuantity ?? 0 }
|
|
106
|
-
withInputField={ false }
|
|
107
|
-
/>
|
|
108
|
-
</>
|
|
109
|
-
);
|
|
110
|
-
}
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useInstanceId } from '@wordpress/compose';
|
|
5
|
-
/**
|
|
6
|
-
* Internal dependencies
|
|
7
|
-
*/
|
|
8
|
-
import { parseQuantityAndUnitFromRawValue } from '../unit-control/utils';
|
|
9
|
-
import Tooltip from '../tooltip';
|
|
10
|
-
import { CUSTOM_VALUE_SETTINGS, LABELS } from './utils';
|
|
11
|
-
import {
|
|
12
|
-
FlexedBoxControlIcon,
|
|
13
|
-
FlexedRangeControl,
|
|
14
|
-
InputWrapper,
|
|
15
|
-
StyledUnitControl,
|
|
16
|
-
} from './styles/box-control-styles';
|
|
17
|
-
import type { BoxControlInputControlProps } from './types';
|
|
18
|
-
|
|
19
|
-
const groupedSides = [ 'vertical', 'horizontal' ] as const;
|
|
20
|
-
type GroupedSide = ( typeof groupedSides )[ number ];
|
|
21
|
-
|
|
22
|
-
export default function AxialInputControls( {
|
|
23
|
-
__next40pxDefaultSize,
|
|
24
|
-
onChange,
|
|
25
|
-
onFocus,
|
|
26
|
-
values,
|
|
27
|
-
selectedUnits,
|
|
28
|
-
setSelectedUnits,
|
|
29
|
-
sides,
|
|
30
|
-
...props
|
|
31
|
-
}: BoxControlInputControlProps ) {
|
|
32
|
-
const generatedId = useInstanceId(
|
|
33
|
-
AxialInputControls,
|
|
34
|
-
`box-control-input`
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
const createHandleOnFocus =
|
|
38
|
-
( side: GroupedSide ) =>
|
|
39
|
-
( event: React.FocusEvent< HTMLInputElement > ) => {
|
|
40
|
-
if ( ! onFocus ) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
onFocus( event, { side } );
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
const handleOnValueChange = ( side: GroupedSide, next?: string ) => {
|
|
47
|
-
if ( ! onChange ) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
const nextValues = { ...values };
|
|
51
|
-
const isNumeric = next !== undefined && ! isNaN( parseFloat( next ) );
|
|
52
|
-
const nextValue = isNumeric ? next : undefined;
|
|
53
|
-
|
|
54
|
-
if ( side === 'vertical' ) {
|
|
55
|
-
nextValues.top = nextValue;
|
|
56
|
-
nextValues.bottom = nextValue;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if ( side === 'horizontal' ) {
|
|
60
|
-
nextValues.left = nextValue;
|
|
61
|
-
nextValues.right = nextValue;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
onChange( nextValues );
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
const createHandleOnUnitChange =
|
|
68
|
-
( side: GroupedSide ) => ( next?: string ) => {
|
|
69
|
-
const newUnits = { ...selectedUnits };
|
|
70
|
-
|
|
71
|
-
if ( side === 'vertical' ) {
|
|
72
|
-
newUnits.top = next;
|
|
73
|
-
newUnits.bottom = next;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
if ( side === 'horizontal' ) {
|
|
77
|
-
newUnits.left = next;
|
|
78
|
-
newUnits.right = next;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
setSelectedUnits( newUnits );
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
// Filter sides if custom configuration provided, maintaining default order.
|
|
85
|
-
const filteredSides = sides?.length
|
|
86
|
-
? groupedSides.filter( ( side ) => sides.includes( side ) )
|
|
87
|
-
: groupedSides;
|
|
88
|
-
|
|
89
|
-
return (
|
|
90
|
-
<>
|
|
91
|
-
{ filteredSides.map( ( side ) => {
|
|
92
|
-
const [ parsedQuantity, parsedUnit ] =
|
|
93
|
-
parseQuantityAndUnitFromRawValue(
|
|
94
|
-
side === 'vertical' ? values.top : values.left
|
|
95
|
-
);
|
|
96
|
-
const selectedUnit =
|
|
97
|
-
side === 'vertical'
|
|
98
|
-
? selectedUnits.top
|
|
99
|
-
: selectedUnits.left;
|
|
100
|
-
|
|
101
|
-
const inputId = [ generatedId, side ].join( '-' );
|
|
102
|
-
|
|
103
|
-
return (
|
|
104
|
-
<InputWrapper key={ side }>
|
|
105
|
-
<FlexedBoxControlIcon side={ side } sides={ sides } />
|
|
106
|
-
<Tooltip placement="top-end" text={ LABELS[ side ] }>
|
|
107
|
-
<StyledUnitControl
|
|
108
|
-
{ ...props }
|
|
109
|
-
__shouldNotWarnDeprecated36pxSize
|
|
110
|
-
__next40pxDefaultSize={ __next40pxDefaultSize }
|
|
111
|
-
className="component-box-control__unit-control"
|
|
112
|
-
id={ inputId }
|
|
113
|
-
isPressEnterToChange
|
|
114
|
-
value={ [
|
|
115
|
-
parsedQuantity,
|
|
116
|
-
selectedUnit ?? parsedUnit,
|
|
117
|
-
].join( '' ) }
|
|
118
|
-
onChange={ ( newValue ) =>
|
|
119
|
-
handleOnValueChange( side, newValue )
|
|
120
|
-
}
|
|
121
|
-
onUnitChange={ createHandleOnUnitChange(
|
|
122
|
-
side
|
|
123
|
-
) }
|
|
124
|
-
onFocus={ createHandleOnFocus( side ) }
|
|
125
|
-
label={ LABELS[ side ] }
|
|
126
|
-
hideLabelFromVision
|
|
127
|
-
key={ side }
|
|
128
|
-
/>
|
|
129
|
-
</Tooltip>
|
|
130
|
-
<FlexedRangeControl
|
|
131
|
-
__nextHasNoMarginBottom
|
|
132
|
-
__next40pxDefaultSize={ __next40pxDefaultSize }
|
|
133
|
-
__shouldNotWarnDeprecated36pxSize
|
|
134
|
-
aria-controls={ inputId }
|
|
135
|
-
label={ LABELS[ side ] }
|
|
136
|
-
hideLabelFromVision
|
|
137
|
-
onChange={ ( newValue ) =>
|
|
138
|
-
handleOnValueChange(
|
|
139
|
-
side,
|
|
140
|
-
newValue !== undefined
|
|
141
|
-
? [
|
|
142
|
-
newValue,
|
|
143
|
-
selectedUnit ?? parsedUnit,
|
|
144
|
-
].join( '' )
|
|
145
|
-
: undefined
|
|
146
|
-
)
|
|
147
|
-
}
|
|
148
|
-
min={ 0 }
|
|
149
|
-
max={
|
|
150
|
-
CUSTOM_VALUE_SETTINGS[ selectedUnit ?? 'px' ]
|
|
151
|
-
?.max ?? 10
|
|
152
|
-
}
|
|
153
|
-
step={
|
|
154
|
-
CUSTOM_VALUE_SETTINGS[ selectedUnit ?? 'px' ]
|
|
155
|
-
?.step ?? 0.1
|
|
156
|
-
}
|
|
157
|
-
value={ parsedQuantity ?? 0 }
|
|
158
|
-
withInputField={ false }
|
|
159
|
-
/>
|
|
160
|
-
</InputWrapper>
|
|
161
|
-
);
|
|
162
|
-
} ) }
|
|
163
|
-
</>
|
|
164
|
-
);
|
|
165
|
-
}
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useInstanceId } from '@wordpress/compose';
|
|
5
|
-
/**
|
|
6
|
-
* Internal dependencies
|
|
7
|
-
*/
|
|
8
|
-
import Tooltip from '../tooltip';
|
|
9
|
-
import { parseQuantityAndUnitFromRawValue } from '../unit-control/utils';
|
|
10
|
-
import { ALL_SIDES, CUSTOM_VALUE_SETTINGS, LABELS } from './utils';
|
|
11
|
-
import {
|
|
12
|
-
FlexedBoxControlIcon,
|
|
13
|
-
FlexedRangeControl,
|
|
14
|
-
InputWrapper,
|
|
15
|
-
StyledUnitControl,
|
|
16
|
-
} from './styles/box-control-styles';
|
|
17
|
-
import type { BoxControlInputControlProps, BoxControlValue } from './types';
|
|
18
|
-
|
|
19
|
-
const noop = () => {};
|
|
20
|
-
|
|
21
|
-
export default function BoxInputControls( {
|
|
22
|
-
__next40pxDefaultSize,
|
|
23
|
-
onChange = noop,
|
|
24
|
-
onFocus = noop,
|
|
25
|
-
values,
|
|
26
|
-
selectedUnits,
|
|
27
|
-
setSelectedUnits,
|
|
28
|
-
sides,
|
|
29
|
-
...props
|
|
30
|
-
}: BoxControlInputControlProps ) {
|
|
31
|
-
const generatedId = useInstanceId( BoxInputControls, 'box-control-input' );
|
|
32
|
-
|
|
33
|
-
const createHandleOnFocus =
|
|
34
|
-
( side: keyof BoxControlValue ) =>
|
|
35
|
-
( event: React.FocusEvent< HTMLInputElement > ) => {
|
|
36
|
-
onFocus( event, { side } );
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
const handleOnChange = ( nextValues: BoxControlValue ) => {
|
|
40
|
-
onChange( nextValues );
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const handleOnValueChange = (
|
|
44
|
-
side: keyof BoxControlValue,
|
|
45
|
-
next?: string,
|
|
46
|
-
extra?: { event: React.SyntheticEvent< Element, Event > }
|
|
47
|
-
) => {
|
|
48
|
-
const nextValues = { ...values };
|
|
49
|
-
const isNumeric = next !== undefined && ! isNaN( parseFloat( next ) );
|
|
50
|
-
const nextValue = isNumeric ? next : undefined;
|
|
51
|
-
|
|
52
|
-
nextValues[ side ] = nextValue;
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Supports changing pair sides. For example, holding the ALT key
|
|
56
|
-
* when changing the TOP will also update BOTTOM.
|
|
57
|
-
*/
|
|
58
|
-
// @ts-expect-error - TODO: event.altKey is only present when the change event was
|
|
59
|
-
// triggered by a keyboard event. Should this feature be implemented differently so
|
|
60
|
-
// it also works with drag events?
|
|
61
|
-
if ( extra?.event.altKey ) {
|
|
62
|
-
switch ( side ) {
|
|
63
|
-
case 'top':
|
|
64
|
-
nextValues.bottom = nextValue;
|
|
65
|
-
break;
|
|
66
|
-
case 'bottom':
|
|
67
|
-
nextValues.top = nextValue;
|
|
68
|
-
break;
|
|
69
|
-
case 'left':
|
|
70
|
-
nextValues.right = nextValue;
|
|
71
|
-
break;
|
|
72
|
-
case 'right':
|
|
73
|
-
nextValues.left = nextValue;
|
|
74
|
-
break;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
handleOnChange( nextValues );
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
const createHandleOnUnitChange =
|
|
82
|
-
( side: keyof BoxControlValue ) => ( next?: string ) => {
|
|
83
|
-
const newUnits = { ...selectedUnits };
|
|
84
|
-
newUnits[ side ] = next;
|
|
85
|
-
setSelectedUnits( newUnits );
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
// Filter sides if custom configuration provided, maintaining default order.
|
|
89
|
-
const filteredSides = sides?.length
|
|
90
|
-
? ALL_SIDES.filter( ( side ) => sides.includes( side ) )
|
|
91
|
-
: ALL_SIDES;
|
|
92
|
-
|
|
93
|
-
return (
|
|
94
|
-
<>
|
|
95
|
-
{ filteredSides.map( ( side ) => {
|
|
96
|
-
const [ parsedQuantity, parsedUnit ] =
|
|
97
|
-
parseQuantityAndUnitFromRawValue( values[ side ] );
|
|
98
|
-
|
|
99
|
-
const computedUnit = values[ side ]
|
|
100
|
-
? parsedUnit
|
|
101
|
-
: selectedUnits[ side ];
|
|
102
|
-
|
|
103
|
-
const inputId = [ generatedId, side ].join( '-' );
|
|
104
|
-
|
|
105
|
-
return (
|
|
106
|
-
<InputWrapper key={ `box-control-${ side }` } expanded>
|
|
107
|
-
<FlexedBoxControlIcon side={ side } sides={ sides } />
|
|
108
|
-
<Tooltip placement="top-end" text={ LABELS[ side ] }>
|
|
109
|
-
<StyledUnitControl
|
|
110
|
-
{ ...props }
|
|
111
|
-
__shouldNotWarnDeprecated36pxSize
|
|
112
|
-
__next40pxDefaultSize={ __next40pxDefaultSize }
|
|
113
|
-
className="component-box-control__unit-control"
|
|
114
|
-
id={ inputId }
|
|
115
|
-
isPressEnterToChange
|
|
116
|
-
value={ [ parsedQuantity, computedUnit ].join(
|
|
117
|
-
''
|
|
118
|
-
) }
|
|
119
|
-
onChange={ ( nextValue, extra ) =>
|
|
120
|
-
handleOnValueChange(
|
|
121
|
-
side,
|
|
122
|
-
nextValue,
|
|
123
|
-
extra
|
|
124
|
-
)
|
|
125
|
-
}
|
|
126
|
-
onUnitChange={ createHandleOnUnitChange(
|
|
127
|
-
side
|
|
128
|
-
) }
|
|
129
|
-
onFocus={ createHandleOnFocus( side ) }
|
|
130
|
-
label={ LABELS[ side ] }
|
|
131
|
-
hideLabelFromVision
|
|
132
|
-
/>
|
|
133
|
-
</Tooltip>
|
|
134
|
-
|
|
135
|
-
<FlexedRangeControl
|
|
136
|
-
__nextHasNoMarginBottom
|
|
137
|
-
__next40pxDefaultSize={ __next40pxDefaultSize }
|
|
138
|
-
__shouldNotWarnDeprecated36pxSize
|
|
139
|
-
aria-controls={ inputId }
|
|
140
|
-
label={ LABELS[ side ] }
|
|
141
|
-
hideLabelFromVision
|
|
142
|
-
onChange={ ( newValue ) => {
|
|
143
|
-
handleOnValueChange(
|
|
144
|
-
side,
|
|
145
|
-
newValue !== undefined
|
|
146
|
-
? [ newValue, computedUnit ].join( '' )
|
|
147
|
-
: undefined
|
|
148
|
-
);
|
|
149
|
-
} }
|
|
150
|
-
min={ 0 }
|
|
151
|
-
max={
|
|
152
|
-
CUSTOM_VALUE_SETTINGS[ computedUnit ?? 'px' ]
|
|
153
|
-
?.max ?? 10
|
|
154
|
-
}
|
|
155
|
-
step={
|
|
156
|
-
CUSTOM_VALUE_SETTINGS[ computedUnit ?? 'px' ]
|
|
157
|
-
?.step ?? 0.1
|
|
158
|
-
}
|
|
159
|
-
value={ parsedQuantity ?? 0 }
|
|
160
|
-
withInputField={ false }
|
|
161
|
-
/>
|
|
162
|
-
</InputWrapper>
|
|
163
|
-
);
|
|
164
|
-
} ) }
|
|
165
|
-
</>
|
|
166
|
-
);
|
|
167
|
-
}
|