@wordpress/components 19.11.0 → 19.14.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 +110 -0
- package/CONTRIBUTING.md +94 -12
- package/README.md +1 -1
- package/build/alignment-matrix-control/index.js +8 -5
- package/build/alignment-matrix-control/index.js.map +1 -1
- package/build/alignment-matrix-control/utils.js +1 -7
- package/build/alignment-matrix-control/utils.js.map +1 -1
- package/build/angle-picker-control/index.js +2 -2
- package/build/angle-picker-control/index.js.map +1 -1
- package/build/autocomplete/autocompleter-ui.js +3 -1
- package/build/autocomplete/autocompleter-ui.js.map +1 -1
- package/build/autocomplete/autocompleter-ui.native.js +8 -2
- package/build/autocomplete/autocompleter-ui.native.js.map +1 -1
- package/build/autocomplete/index.js +14 -10
- package/build/autocomplete/index.js.map +1 -1
- package/build/border-box-control/border-box-control/component.js +2 -1
- package/build/border-box-control/border-box-control/component.js.map +1 -1
- package/build/border-box-control/border-box-control/hook.js +2 -2
- package/build/border-box-control/border-box-control/hook.js.map +1 -1
- package/build/border-box-control/border-box-control-linked-button/component.js.map +1 -1
- package/build/border-box-control/border-box-control-split-controls/component.js +4 -1
- package/build/border-box-control/border-box-control-split-controls/component.js.map +1 -1
- package/build/border-box-control/border-box-control-split-controls/hook.js +13 -4
- package/build/border-box-control/border-box-control-split-controls/hook.js.map +1 -1
- package/build/border-box-control/border-box-control-visualizer/hook.js +6 -2
- package/build/border-box-control/border-box-control-visualizer/hook.js.map +1 -1
- package/build/border-box-control/styles.js +21 -11
- package/build/border-box-control/styles.js.map +1 -1
- package/build/border-box-control/utils.js.map +1 -1
- package/build/border-control/border-control/component.js +40 -4
- package/build/border-control/border-control/component.js.map +1 -1
- package/build/border-control/border-control/hook.js +2 -2
- package/build/border-control/border-control/hook.js.map +1 -1
- package/build/box-control/all-input-control.js +6 -10
- package/build/box-control/all-input-control.js.map +1 -1
- package/build/box-control/axial-input-controls.js.map +1 -1
- package/build/box-control/index.js +3 -7
- package/build/box-control/index.js.map +1 -1
- package/build/box-control/input-controls.js +6 -10
- package/build/box-control/input-controls.js.map +1 -1
- package/build/box-control/unit-control.js +4 -4
- package/build/box-control/unit-control.js.map +1 -1
- package/build/box-control/utils.js +3 -3
- package/build/box-control/utils.js.map +1 -1
- package/build/button/index.native.js +1 -3
- package/build/button/index.native.js.map +1 -1
- package/build/checkbox-control/index.js.map +1 -1
- package/build/color-indicator/index.js +27 -10
- package/build/color-indicator/index.js.map +1 -1
- package/build/color-indicator/types.js +6 -0
- package/build/color-indicator/types.js.map +1 -0
- package/build/color-palette/index.js +11 -3
- package/build/color-palette/index.js.map +1 -1
- package/build/color-palette/index.native.js +4 -1
- package/build/color-palette/index.native.js.map +1 -1
- package/build/color-picker/color-copy-button.js +87 -0
- package/build/color-picker/color-copy-button.js.map +1 -0
- package/build/color-picker/component.js +10 -23
- package/build/color-picker/component.js.map +1 -1
- package/build/color-picker/hex-input.js +18 -1
- package/build/color-picker/hex-input.js.map +1 -1
- package/build/color-picker/index.native.js.map +1 -1
- package/build/color-picker/input-with-slider.js +1 -2
- package/build/color-picker/input-with-slider.js.map +1 -1
- package/build/color-picker/styles.js +37 -19
- package/build/color-picker/styles.js.map +1 -1
- package/build/combobox-control/index.js +4 -2
- package/build/combobox-control/index.js.map +1 -1
- package/build/confirm-dialog/component.js.map +1 -1
- package/build/custom-gradient-bar/constants.js +1 -3
- package/build/custom-gradient-bar/constants.js.map +1 -1
- package/build/custom-gradient-bar/control-points.js +15 -8
- package/build/custom-gradient-bar/control-points.js.map +1 -1
- package/build/custom-gradient-bar/index.js +5 -5
- package/build/custom-gradient-bar/index.js.map +1 -1
- package/build/custom-gradient-bar/utils.js +5 -7
- package/build/custom-gradient-bar/utils.js.map +1 -1
- package/build/custom-gradient-picker/index.js +8 -8
- package/build/custom-gradient-picker/index.js.map +1 -1
- package/build/custom-gradient-picker/index.native.js +8 -9
- package/build/custom-gradient-picker/index.native.js.map +1 -1
- package/build/custom-gradient-picker/serializer.js +4 -7
- package/build/custom-gradient-picker/serializer.js.map +1 -1
- package/build/custom-gradient-picker/utils.js +1 -1
- package/build/custom-gradient-picker/utils.js.map +1 -1
- package/build/custom-select-control/index.js.map +1 -1
- package/build/date-time/{date.js → date/index.js} +57 -16
- package/build/date-time/date/index.js.map +1 -0
- package/build/date-time/date/styles.js +70 -0
- package/build/date-time/date/styles.js.map +1 -0
- package/build/date-time/{utils.js → date/utils.js} +0 -0
- package/build/date-time/date/utils.js.map +1 -0
- package/build/date-time/date-time/index.js +177 -0
- package/build/date-time/date-time/index.js.map +1 -0
- package/build/date-time/date-time/styles.js +32 -0
- package/build/date-time/date-time/styles.js.map +1 -0
- package/build/date-time/index.js +2 -109
- package/build/date-time/index.js.map +1 -1
- package/build/date-time/time/index.js +322 -0
- package/build/date-time/time/index.js.map +1 -0
- package/build/date-time/time/styles.js +139 -0
- package/build/date-time/time/styles.js.map +1 -0
- package/build/date-time/{timezone.js → time/timezone.js} +4 -2
- package/build/date-time/time/timezone.js.map +1 -0
- package/build/dimension-control/index.js +1 -3
- package/build/dimension-control/index.js.map +1 -1
- package/build/divider/styles.js +5 -5
- package/build/divider/styles.js.map +1 -1
- package/build/draggable/index.js.map +1 -1
- package/build/draggable/index.native.js +16 -6
- package/build/draggable/index.native.js.map +1 -1
- package/build/drop-zone/provider.js.map +1 -1
- package/build/dropdown/index.js +6 -3
- package/build/dropdown/index.js.map +1 -1
- package/build/dropdown-menu/index.js +13 -2
- package/build/dropdown-menu/index.js.map +1 -1
- package/build/dropdown-menu/index.native.js +13 -2
- package/build/dropdown-menu/index.native.js.map +1 -1
- package/build/duotone-picker/duotone-picker.js +42 -29
- package/build/duotone-picker/duotone-picker.js.map +1 -1
- package/build/elevation/hook.js +13 -13
- package/build/elevation/hook.js.map +1 -1
- package/build/external-link/index.js +20 -8
- package/build/external-link/index.js.map +1 -1
- package/build/external-link/styles/external-link-styles.js +3 -3
- package/build/external-link/styles/external-link-styles.js.map +1 -1
- package/build/external-link/types.js +6 -0
- package/build/external-link/types.js.map +1 -0
- package/build/flex/flex/hook.js +9 -5
- package/build/flex/flex/hook.js.map +1 -1
- package/build/focal-point-picker/controls.js +3 -7
- package/build/focal-point-picker/controls.js.map +1 -1
- package/build/focal-point-picker/index.js.map +1 -1
- package/build/focal-point-picker/index.native.js +4 -4
- package/build/focal-point-picker/index.native.js.map +1 -1
- package/build/focal-point-picker/media.js +4 -8
- package/build/focal-point-picker/media.js.map +1 -1
- package/build/font-size-picker/index.js +1 -1
- package/build/font-size-picker/index.js.map +1 -1
- package/build/form-toggle/index.js +34 -9
- package/build/form-toggle/index.js.map +1 -1
- package/build/form-toggle/types.js +6 -0
- package/build/form-toggle/types.js.map +1 -0
- package/build/form-token-field/index.js +328 -359
- package/build/form-token-field/index.js.map +1 -1
- package/build/form-token-field/suggestions-list.js +26 -20
- package/build/form-token-field/suggestions-list.js.map +1 -1
- package/build/form-token-field/token-input.js +39 -53
- package/build/form-token-field/token-input.js.map +1 -1
- package/build/form-token-field/token.js +3 -3
- package/build/form-token-field/token.js.map +1 -1
- package/build/form-token-field/types.js +6 -0
- package/build/form-token-field/types.js.map +1 -0
- package/build/gradient-picker/index.js.map +1 -1
- package/build/h-stack/utils.js +3 -3
- package/build/h-stack/utils.js.map +1 -1
- package/build/heading/component.js +0 -1
- package/build/heading/component.js.map +1 -1
- package/build/heading/hook.js.map +1 -1
- package/build/heading/types.js +6 -0
- package/build/heading/types.js.map +1 -0
- package/build/higher-order/navigate-regions/index.js.map +1 -1
- package/build/higher-order/with-focus-return/index.js.map +1 -1
- package/build/higher-order/with-spoken-messages/index.js.map +1 -1
- package/build/icon/index.js.map +1 -1
- package/build/input-control/index.js +14 -9
- package/build/input-control/index.js.map +1 -1
- package/build/input-control/input-field.js +11 -36
- package/build/input-control/input-field.js.map +1 -1
- package/build/input-control/reducer/reducer.js +36 -24
- package/build/input-control/reducer/reducer.js.map +1 -1
- package/build/input-control/reducer/state.js +0 -1
- package/build/input-control/reducer/state.js.map +1 -1
- package/build/input-control/utils.js +46 -1
- package/build/input-control/utils.js.map +1 -1
- package/build/menu-items-choice/index.js +3 -7
- package/build/menu-items-choice/index.js.map +1 -1
- package/build/mobile/bottom-sheet/bottom-sheet-context.native.js.map +1 -1
- package/build/mobile/bottom-sheet/cell.native.js.map +1 -1
- package/build/mobile/bottom-sheet/cycle-picker-cell.native.js +1 -7
- package/build/mobile/bottom-sheet/cycle-picker-cell.native.js.map +1 -1
- package/build/mobile/bottom-sheet/index.native.js.map +1 -1
- package/build/mobile/bottom-sheet/keyboard-avoiding-view.native.js +0 -1
- package/build/mobile/bottom-sheet/keyboard-avoiding-view.native.js.map +1 -1
- package/build/mobile/bottom-sheet/picker-cell.native.js.map +1 -1
- package/build/mobile/bottom-sheet/stepper-cell/index.native.js.map +1 -1
- package/build/mobile/color-settings/index.native.js.map +1 -1
- package/build/mobile/global-styles-context/index.native.js.map +1 -1
- package/build/mobile/gradient/index.native.js.map +1 -1
- package/build/mobile/html-text-input/index.native.js.map +1 -1
- package/build/mobile/inserter-button/index.native.js.map +1 -1
- package/build/mobile/link-picker/index.native.js +4 -4
- package/build/mobile/link-picker/index.native.js.map +1 -1
- package/build/mobile/link-settings/image-link-destinations-screen.native.js.map +1 -1
- package/build/mobile/media-edit/index.native.js.map +1 -1
- package/build/mobile/segmented-control/index.native.js +3 -5
- package/build/mobile/segmented-control/index.native.js.map +1 -1
- package/build/modal/index.js +1 -1
- package/build/modal/index.js.map +1 -1
- package/build/navigable-container/container.js +4 -2
- package/build/navigable-container/container.js.map +1 -1
- package/build/navigation/context.js +12 -16
- package/build/navigation/context.js.map +1 -1
- package/build/navigation/group/index.js +4 -7
- package/build/navigation/group/index.js.map +1 -1
- package/build/navigation/index.js +3 -3
- package/build/navigation/index.js.map +1 -1
- package/build/navigation/item/base.js +3 -3
- package/build/navigation/item/base.js.map +1 -1
- package/build/navigation/item/index.js +3 -3
- package/build/navigation/item/index.js.map +1 -1
- package/build/navigation/item/use-navigation-tree-item.js +2 -1
- package/build/navigation/item/use-navigation-tree-item.js.map +1 -1
- package/build/navigation/menu/menu-title-search.js +1 -7
- package/build/navigation/menu/menu-title-search.js.map +1 -1
- package/build/navigation/menu/search-no-results-found.js +1 -7
- package/build/navigation/menu/search-no-results-found.js.map +1 -1
- package/build/navigation/use-navigation-tree-nodes.js +18 -10
- package/build/navigation/use-navigation-tree-nodes.js.map +1 -1
- package/build/navigation/utils.js +4 -2
- package/build/navigation/utils.js.map +1 -1
- package/build/navigator/navigator-back-button/hook.js.map +1 -1
- package/build/navigator/navigator-button/hook.js.map +1 -1
- package/build/navigator/navigator-provider/component.js +1 -1
- package/build/navigator/navigator-provider/component.js.map +1 -1
- package/build/navigator/navigator-screen/component.js +1 -1
- package/build/navigator/navigator-screen/component.js.map +1 -1
- package/build/notice/index.js +5 -5
- package/build/notice/index.js.map +1 -1
- package/build/notice/list.js +4 -2
- package/build/notice/list.js.map +1 -1
- package/build/panel/body.js +3 -3
- package/build/panel/body.js.map +1 -1
- package/build/placeholder/index.js +26 -12
- package/build/placeholder/index.js.map +1 -1
- package/build/popover/index.js +40 -33
- package/build/popover/index.js.map +1 -1
- package/build/radio-control/index.js +43 -7
- package/build/radio-control/index.js.map +1 -1
- package/build/radio-control/types.js +6 -0
- package/build/radio-control/types.js.map +1 -0
- package/build/range-control/index.js +11 -9
- package/build/range-control/index.js.map +1 -1
- package/build/range-control/input-range.js +6 -10
- package/build/range-control/input-range.js.map +1 -1
- package/build/range-control/utils.js +10 -12
- package/build/range-control/utils.js.map +1 -1
- package/build/resizable-box/resize-tooltip/index.js +3 -3
- package/build/resizable-box/resize-tooltip/index.js.map +1 -1
- package/build/resizable-box/resize-tooltip/utils.js +4 -7
- package/build/resizable-box/resize-tooltip/utils.js.map +1 -1
- package/build/responsive-wrapper/index.js.map +1 -1
- package/build/search-control/index.js +4 -6
- package/build/search-control/index.js.map +1 -1
- package/build/select-control/index.js +8 -4
- package/build/select-control/index.js.map +1 -1
- package/build/slot-fill/fill.js +1 -7
- package/build/slot-fill/fill.js.map +1 -1
- package/build/slot-fill/slot.js +14 -3
- package/build/slot-fill/slot.js.map +1 -1
- package/build/snackbar/index.js +7 -7
- package/build/snackbar/index.js.map +1 -1
- package/build/snackbar/list.js +3 -1
- package/build/snackbar/list.js.map +1 -1
- package/build/spacer/component.js +5 -5
- package/build/spacer/component.js.map +1 -1
- package/build/spacer/hook.js +11 -3
- package/build/spacer/hook.js.map +1 -1
- package/build/spinner/index.js +26 -13
- package/build/spinner/index.js.map +1 -1
- package/build/spinner/styles.js +10 -10
- package/build/spinner/styles.js.map +1 -1
- package/build/surface/component.js +7 -7
- package/build/surface/component.js.map +1 -1
- package/build/surface/hook.js +8 -11
- package/build/surface/hook.js.map +1 -1
- package/build/surface/index.js.map +1 -1
- package/build/surface/styles.js +8 -48
- package/build/surface/styles.js.map +1 -1
- package/build/tab-panel/index.js +3 -1
- package/build/tab-panel/index.js.map +1 -1
- package/build/text/hook.js +4 -4
- package/build/text/hook.js.map +1 -1
- package/build/text/utils.js.map +1 -1
- package/build/textarea-control/index.js +40 -6
- package/build/textarea-control/index.js.map +1 -1
- package/build/textarea-control/styles/textarea-control-styles.js +3 -3
- package/build/textarea-control/styles/textarea-control-styles.js.map +1 -1
- package/build/textarea-control/types.js +6 -0
- package/build/textarea-control/types.js.map +1 -0
- package/build/toggle-control/index.js +1 -3
- package/build/toggle-control/index.js.map +1 -1
- package/build/toggle-control/index.native.js +1 -7
- package/build/toggle-control/index.native.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.js.map +1 -1
- package/build/toolbar/index.js.map +1 -1
- package/build/tools-panel/tools-panel/hook.js.map +1 -1
- package/build/tools-panel/tools-panel-header/hook.js.map +1 -1
- package/build/tooltip/index.js +2 -1
- package/build/tooltip/index.js.map +1 -1
- package/build/tree-grid/roving-tab-index-item.js.map +1 -1
- package/build/tree-select/index.js +57 -4
- package/build/tree-select/index.js.map +1 -1
- package/build/tree-select/types.js +6 -0
- package/build/tree-select/types.js.map +1 -0
- package/build/truncate/component.js +7 -8
- package/build/truncate/component.js.map +1 -1
- package/build/truncate/hook.js +3 -10
- package/build/truncate/hook.js.map +1 -1
- package/build/truncate/index.js.map +1 -1
- package/build/truncate/styles.js +1 -1
- package/build/truncate/styles.js.map +1 -1
- package/build/truncate/utils.js +3 -16
- package/build/truncate/utils.js.map +1 -1
- package/build/ui/form-group/form-group-content.js.map +1 -1
- package/build/unit-control/index.js.map +1 -1
- package/build/utils/hooks/index.js +0 -8
- package/build/utils/hooks/index.js.map +1 -1
- package/build/utils/math.js +17 -7
- package/build/utils/math.js.map +1 -1
- package/build/utils/unit-values.js.map +1 -1
- package/build/utils/values.js.map +1 -1
- package/build/v-stack/component.js +9 -9
- package/build/v-stack/component.js.map +1 -1
- package/build/v-stack/hook.js +0 -5
- package/build/v-stack/hook.js.map +1 -1
- package/build/v-stack/index.js.map +1 -1
- package/build/z-stack/component.js +22 -3
- package/build/z-stack/component.js.map +1 -1
- package/build/z-stack/types.js +6 -0
- package/build/z-stack/types.js.map +1 -0
- package/build-module/alignment-matrix-control/index.js +7 -3
- package/build-module/alignment-matrix-control/index.js.map +1 -1
- package/build-module/alignment-matrix-control/utils.js +1 -6
- package/build-module/alignment-matrix-control/utils.js.map +1 -1
- package/build-module/angle-picker-control/index.js +1 -1
- package/build-module/angle-picker-control/index.js.map +1 -1
- package/build-module/autocomplete/autocompleter-ui.js +3 -1
- package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
- package/build-module/autocomplete/autocompleter-ui.native.js +8 -2
- package/build-module/autocomplete/autocompleter-ui.native.js.map +1 -1
- package/build-module/autocomplete/index.js +15 -11
- package/build-module/autocomplete/index.js.map +1 -1
- package/build-module/border-box-control/border-box-control/component.js +2 -1
- package/build-module/border-box-control/border-box-control/component.js.map +1 -1
- package/build-module/border-box-control/border-box-control/hook.js +2 -2
- package/build-module/border-box-control/border-box-control/hook.js.map +1 -1
- package/build-module/border-box-control/border-box-control-linked-button/component.js.map +1 -1
- package/build-module/border-box-control/border-box-control-split-controls/component.js +4 -1
- package/build-module/border-box-control/border-box-control-split-controls/component.js.map +1 -1
- package/build-module/border-box-control/border-box-control-split-controls/hook.js +11 -4
- package/build-module/border-box-control/border-box-control-split-controls/hook.js.map +1 -1
- package/build-module/border-box-control/border-box-control-visualizer/hook.js +4 -2
- package/build-module/border-box-control/border-box-control-visualizer/hook.js.map +1 -1
- package/build-module/border-box-control/styles.js +13 -8
- package/build-module/border-box-control/styles.js.map +1 -1
- package/build-module/border-box-control/utils.js.map +1 -1
- package/build-module/border-control/border-control/component.js +38 -3
- package/build-module/border-control/border-control/component.js.map +1 -1
- package/build-module/border-control/border-control/hook.js +2 -2
- package/build-module/border-control/border-control/hook.js.map +1 -1
- package/build-module/box-control/all-input-control.js +3 -5
- package/build-module/box-control/all-input-control.js.map +1 -1
- package/build-module/box-control/axial-input-controls.js.map +1 -1
- package/build-module/box-control/index.js +2 -5
- package/build-module/box-control/index.js.map +1 -1
- package/build-module/box-control/input-controls.js +3 -5
- package/build-module/box-control/input-controls.js.map +1 -1
- package/build-module/box-control/unit-control.js +3 -1
- package/build-module/box-control/unit-control.js.map +1 -1
- package/build-module/box-control/utils.js +4 -4
- package/build-module/box-control/utils.js.map +1 -1
- package/build-module/button/index.native.js +1 -2
- package/build-module/button/index.native.js.map +1 -1
- package/build-module/checkbox-control/index.js.map +1 -1
- package/build-module/color-indicator/index.js +29 -8
- package/build-module/color-indicator/index.js.map +1 -1
- package/build-module/color-indicator/types.js +2 -0
- package/build-module/color-indicator/types.js.map +1 -0
- package/build-module/color-palette/index.js +9 -6
- package/build-module/color-palette/index.js.map +1 -1
- package/build-module/color-palette/index.native.js +4 -1
- package/build-module/color-palette/index.native.js.map +1 -1
- package/build-module/color-picker/color-copy-button.js +73 -0
- package/build-module/color-picker/color-copy-button.js.map +1 -0
- package/build-module/color-picker/component.js +11 -21
- package/build-module/color-picker/component.js.map +1 -1
- package/build-module/color-picker/hex-input.js +18 -1
- package/build-module/color-picker/hex-input.js.map +1 -1
- package/build-module/color-picker/index.native.js.map +1 -1
- package/build-module/color-picker/input-with-slider.js +1 -2
- package/build-module/color-picker/input-with-slider.js.map +1 -1
- package/build-module/color-picker/styles.js +30 -16
- package/build-module/color-picker/styles.js.map +1 -1
- package/build-module/combobox-control/index.js +5 -2
- package/build-module/combobox-control/index.js.map +1 -1
- package/build-module/confirm-dialog/component.js.map +1 -1
- package/build-module/custom-gradient-bar/constants.js +0 -1
- package/build-module/custom-gradient-bar/constants.js.map +1 -1
- package/build-module/custom-gradient-bar/control-points.js +16 -9
- package/build-module/custom-gradient-bar/control-points.js.map +1 -1
- package/build-module/custom-gradient-bar/index.js +6 -6
- package/build-module/custom-gradient-bar/index.js.map +1 -1
- package/build-module/custom-gradient-bar/utils.js +6 -8
- package/build-module/custom-gradient-bar/utils.js.map +1 -1
- package/build-module/custom-gradient-picker/index.js +8 -7
- package/build-module/custom-gradient-picker/index.js.map +1 -1
- package/build-module/custom-gradient-picker/index.native.js +8 -8
- package/build-module/custom-gradient-picker/index.native.js.map +1 -1
- package/build-module/custom-gradient-picker/serializer.js +4 -6
- package/build-module/custom-gradient-picker/serializer.js.map +1 -1
- package/build-module/custom-gradient-picker/utils.js +1 -1
- package/build-module/custom-gradient-picker/utils.js.map +1 -1
- package/build-module/custom-select-control/index.js.map +1 -1
- package/build-module/date-time/{date.js → date/index.js} +51 -16
- package/build-module/date-time/date/index.js.map +1 -0
- package/build-module/date-time/date/styles.js +61 -0
- package/build-module/date-time/date/styles.js.map +1 -0
- package/build-module/date-time/{utils.js → date/utils.js} +0 -0
- package/build-module/date-time/date/utils.js.map +1 -0
- package/build-module/date-time/date-time/index.js +147 -0
- package/build-module/date-time/date-time/index.js.map +1 -0
- package/build-module/date-time/date-time/styles.js +22 -0
- package/build-module/date-time/date-time/styles.js.map +1 -0
- package/build-module/date-time/index.js +1 -105
- package/build-module/date-time/index.js.map +1 -1
- package/build-module/date-time/time/index.js +302 -0
- package/build-module/date-time/time/index.js.map +1 -0
- package/build-module/date-time/time/styles.js +118 -0
- package/build-module/date-time/time/styles.js.map +1 -0
- package/build-module/date-time/{timezone.js → time/timezone.js} +3 -2
- package/build-module/date-time/time/timezone.js.map +1 -0
- package/build-module/dimension-control/index.js +1 -2
- package/build-module/dimension-control/index.js.map +1 -1
- package/build-module/divider/styles.js +5 -5
- package/build-module/divider/styles.js.map +1 -1
- package/build-module/draggable/index.js.map +1 -1
- package/build-module/draggable/index.native.js +16 -6
- package/build-module/draggable/index.native.js.map +1 -1
- package/build-module/drop-zone/provider.js.map +1 -1
- package/build-module/dropdown/index.js +6 -3
- package/build-module/dropdown/index.js.map +1 -1
- package/build-module/dropdown-menu/index.js +12 -1
- package/build-module/dropdown-menu/index.js.map +1 -1
- package/build-module/dropdown-menu/index.native.js +12 -1
- package/build-module/dropdown-menu/index.native.js.map +1 -1
- package/build-module/duotone-picker/duotone-picker.js +42 -29
- package/build-module/duotone-picker/duotone-picker.js.map +1 -1
- package/build-module/elevation/hook.js +12 -12
- package/build-module/elevation/hook.js.map +1 -1
- package/build-module/external-link/index.js +22 -7
- package/build-module/external-link/index.js.map +1 -1
- package/build-module/external-link/styles/external-link-styles.js +3 -3
- package/build-module/external-link/styles/external-link-styles.js.map +1 -1
- package/build-module/external-link/types.js +2 -0
- package/build-module/external-link/types.js.map +1 -0
- package/build-module/flex/flex/hook.js +7 -5
- package/build-module/flex/flex/hook.js.map +1 -1
- package/build-module/focal-point-picker/controls.js +3 -5
- package/build-module/focal-point-picker/controls.js.map +1 -1
- package/build-module/focal-point-picker/index.js.map +1 -1
- package/build-module/focal-point-picker/index.native.js +1 -1
- package/build-module/focal-point-picker/index.native.js.map +1 -1
- package/build-module/focal-point-picker/media.js +3 -5
- package/build-module/focal-point-picker/media.js.map +1 -1
- package/build-module/font-size-picker/index.js +1 -1
- package/build-module/font-size-picker/index.js.map +1 -1
- package/build-module/form-toggle/index.js +31 -7
- package/build-module/form-toggle/index.js.map +1 -1
- package/build-module/form-toggle/types.js +2 -0
- package/build-module/form-toggle/types.js.map +1 -0
- package/build-module/form-token-field/index.js +329 -361
- package/build-module/form-token-field/index.js.map +1 -1
- package/build-module/form-token-field/suggestions-list.js +32 -23
- package/build-module/form-token-field/suggestions-list.js.map +1 -1
- package/build-module/form-token-field/token-input.js +43 -58
- package/build-module/form-token-field/token-input.js.map +1 -1
- package/build-module/form-token-field/token.js +3 -1
- package/build-module/form-token-field/token.js.map +1 -1
- package/build-module/form-token-field/types.js +2 -0
- package/build-module/form-token-field/types.js.map +1 -0
- package/build-module/gradient-picker/index.js.map +1 -1
- package/build-module/h-stack/utils.js +3 -3
- package/build-module/h-stack/utils.js.map +1 -1
- package/build-module/heading/component.js +0 -1
- package/build-module/heading/component.js.map +1 -1
- package/build-module/heading/hook.js.map +1 -1
- package/build-module/heading/types.js +2 -0
- package/build-module/heading/types.js.map +1 -0
- package/build-module/higher-order/navigate-regions/index.js.map +1 -1
- package/build-module/higher-order/with-focus-return/index.js.map +1 -1
- package/build-module/higher-order/with-spoken-messages/index.js.map +1 -1
- package/build-module/icon/index.js.map +1 -1
- package/build-module/input-control/index.js +10 -5
- package/build-module/input-control/index.js.map +1 -1
- package/build-module/input-control/input-field.js +3 -26
- package/build-module/input-control/input-field.js.map +1 -1
- package/build-module/input-control/reducer/reducer.js +38 -26
- package/build-module/input-control/reducer/reducer.js.map +1 -1
- package/build-module/input-control/reducer/state.js +0 -1
- package/build-module/input-control/reducer/state.js.map +1 -1
- package/build-module/input-control/utils.js +49 -3
- package/build-module/input-control/utils.js.map +1 -1
- package/build-module/menu-items-choice/index.js +3 -5
- package/build-module/menu-items-choice/index.js.map +1 -1
- package/build-module/mobile/bottom-sheet/bottom-sheet-context.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/cell.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/cycle-picker-cell.native.js +1 -6
- package/build-module/mobile/bottom-sheet/cycle-picker-cell.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/index.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/keyboard-avoiding-view.native.js +0 -1
- package/build-module/mobile/bottom-sheet/keyboard-avoiding-view.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/picker-cell.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/stepper-cell/index.native.js.map +1 -1
- package/build-module/mobile/color-settings/index.native.js.map +1 -1
- package/build-module/mobile/global-styles-context/index.native.js.map +1 -1
- package/build-module/mobile/gradient/index.native.js.map +1 -1
- package/build-module/mobile/html-text-input/index.native.js.map +1 -1
- package/build-module/mobile/inserter-button/index.native.js.map +1 -1
- package/build-module/mobile/link-picker/index.native.js +4 -3
- package/build-module/mobile/link-picker/index.native.js.map +1 -1
- package/build-module/mobile/link-settings/image-link-destinations-screen.native.js.map +1 -1
- package/build-module/mobile/media-edit/index.native.js.map +1 -1
- package/build-module/mobile/segmented-control/index.native.js +3 -4
- package/build-module/mobile/segmented-control/index.native.js.map +1 -1
- package/build-module/modal/index.js +1 -1
- package/build-module/modal/index.js.map +1 -1
- package/build-module/navigable-container/container.js +5 -2
- package/build-module/navigable-container/container.js.map +1 -1
- package/build-module/navigation/context.js +3 -5
- package/build-module/navigation/context.js.map +1 -1
- package/build-module/navigation/group/index.js +3 -6
- package/build-module/navigation/group/index.js.map +1 -1
- package/build-module/navigation/index.js +3 -1
- package/build-module/navigation/index.js.map +1 -1
- package/build-module/navigation/item/base.js +2 -2
- package/build-module/navigation/item/base.js.map +1 -1
- package/build-module/navigation/item/index.js +3 -1
- package/build-module/navigation/item/index.js.map +1 -1
- package/build-module/navigation/item/use-navigation-tree-item.js +2 -1
- package/build-module/navigation/item/use-navigation-tree-item.js.map +1 -1
- package/build-module/navigation/menu/menu-title-search.js +1 -6
- package/build-module/navigation/menu/menu-title-search.js.map +1 -1
- package/build-module/navigation/menu/search-no-results-found.js +1 -6
- package/build-module/navigation/menu/search-no-results-found.js.map +1 -1
- package/build-module/navigation/use-navigation-tree-nodes.js +18 -9
- package/build-module/navigation/use-navigation-tree-nodes.js.map +1 -1
- package/build-module/navigation/utils.js +2 -2
- package/build-module/navigation/utils.js.map +1 -1
- package/build-module/navigator/navigator-back-button/hook.js.map +1 -1
- package/build-module/navigator/navigator-button/hook.js.map +1 -1
- package/build-module/navigator/navigator-provider/component.js +1 -1
- package/build-module/navigator/navigator-provider/component.js.map +1 -1
- package/build-module/navigator/navigator-screen/component.js +1 -1
- package/build-module/navigator/navigator-screen/component.js.map +1 -1
- package/build-module/notice/index.js +2 -1
- package/build-module/notice/index.js.map +1 -1
- package/build-module/notice/list.js +4 -1
- package/build-module/notice/list.js.map +1 -1
- package/build-module/panel/body.js +3 -1
- package/build-module/panel/body.js.map +1 -1
- package/build-module/placeholder/index.js +24 -11
- package/build-module/placeholder/index.js.map +1 -1
- package/build-module/popover/index.js +40 -33
- package/build-module/popover/index.js.map +1 -1
- package/build-module/radio-control/index.js +40 -7
- package/build-module/radio-control/index.js.map +1 -1
- package/build-module/radio-control/types.js +2 -0
- package/build-module/radio-control/types.js.map +1 -0
- package/build-module/range-control/index.js +4 -2
- package/build-module/range-control/index.js.map +1 -1
- package/build-module/range-control/input-range.js +2 -5
- package/build-module/range-control/input-range.js.map +1 -1
- package/build-module/range-control/utils.js +4 -5
- package/build-module/range-control/utils.js.map +1 -1
- package/build-module/resizable-box/resize-tooltip/index.js +2 -1
- package/build-module/resizable-box/resize-tooltip/index.js.map +1 -1
- package/build-module/resizable-box/resize-tooltip/utils.js +3 -5
- package/build-module/resizable-box/resize-tooltip/utils.js.map +1 -1
- package/build-module/responsive-wrapper/index.js.map +1 -1
- package/build-module/search-control/index.js +6 -7
- package/build-module/search-control/index.js.map +1 -1
- package/build-module/select-control/index.js +6 -2
- package/build-module/select-control/index.js.map +1 -1
- package/build-module/slot-fill/fill.js +1 -6
- package/build-module/slot-fill/fill.js.map +1 -1
- package/build-module/slot-fill/slot.js +12 -2
- package/build-module/slot-fill/slot.js.map +1 -1
- package/build-module/snackbar/index.js +3 -1
- package/build-module/snackbar/index.js.map +1 -1
- package/build-module/snackbar/list.js +4 -1
- package/build-module/snackbar/list.js.map +1 -1
- package/build-module/spacer/component.js +3 -4
- package/build-module/spacer/component.js.map +1 -1
- package/build-module/spacer/hook.js +10 -2
- package/build-module/spacer/hook.js.map +1 -1
- package/build-module/spinner/index.js +22 -13
- package/build-module/spinner/index.js.map +1 -1
- package/build-module/spinner/styles.js +10 -10
- package/build-module/spinner/styles.js.map +1 -1
- package/build-module/surface/component.js +7 -7
- package/build-module/surface/component.js.map +1 -1
- package/build-module/surface/hook.js +8 -11
- package/build-module/surface/hook.js.map +1 -1
- package/build-module/surface/index.js.map +1 -1
- package/build-module/surface/styles.js +8 -48
- package/build-module/surface/styles.js.map +1 -1
- package/build-module/tab-panel/index.js +3 -1
- package/build-module/tab-panel/index.js.map +1 -1
- package/build-module/text/hook.js +4 -4
- package/build-module/text/hook.js.map +1 -1
- package/build-module/text/utils.js.map +1 -1
- package/build-module/textarea-control/index.js +36 -5
- package/build-module/textarea-control/index.js.map +1 -1
- package/build-module/textarea-control/styles/textarea-control-styles.js +3 -3
- package/build-module/textarea-control/styles/textarea-control-styles.js.map +1 -1
- package/build-module/textarea-control/types.js +2 -0
- package/build-module/textarea-control/types.js.map +1 -0
- package/build-module/toggle-control/index.js +1 -2
- package/build-module/toggle-control/index.js.map +1 -1
- package/build-module/toggle-control/index.native.js +1 -6
- package/build-module/toggle-control/index.native.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.js.map +1 -1
- package/build-module/toolbar/index.js.map +1 -1
- package/build-module/tools-panel/tools-panel/hook.js.map +1 -1
- package/build-module/tools-panel/tools-panel-header/hook.js.map +1 -1
- package/build-module/tooltip/index.js +2 -1
- package/build-module/tooltip/index.js.map +1 -1
- package/build-module/tree-grid/roving-tab-index-item.js.map +1 -1
- package/build-module/tree-select/index.js +53 -3
- package/build-module/tree-select/index.js.map +1 -1
- package/build-module/tree-select/types.js +2 -0
- package/build-module/tree-select/types.js.map +1 -0
- package/build-module/truncate/component.js +7 -8
- package/build-module/truncate/component.js.map +1 -1
- package/build-module/truncate/hook.js +3 -10
- package/build-module/truncate/hook.js.map +1 -1
- package/build-module/truncate/index.js.map +1 -1
- package/build-module/truncate/styles.js +1 -1
- package/build-module/truncate/styles.js.map +1 -1
- package/build-module/truncate/utils.js +3 -16
- package/build-module/truncate/utils.js.map +1 -1
- package/build-module/ui/form-group/form-group-content.js.map +1 -1
- package/build-module/unit-control/index.js.map +1 -1
- package/build-module/utils/hooks/index.js +0 -1
- package/build-module/utils/hooks/index.js.map +1 -1
- package/build-module/utils/math.js +15 -6
- package/build-module/utils/math.js.map +1 -1
- package/build-module/utils/unit-values.js.map +1 -1
- package/build-module/utils/values.js.map +1 -1
- package/build-module/v-stack/component.js +9 -9
- package/build-module/v-stack/component.js.map +1 -1
- package/build-module/v-stack/hook.js +0 -5
- package/build-module/v-stack/hook.js.map +1 -1
- package/build-module/v-stack/index.js.map +1 -1
- package/build-module/z-stack/component.js +21 -2
- package/build-module/z-stack/component.js.map +1 -1
- package/build-module/z-stack/types.js +2 -0
- package/build-module/z-stack/types.js.map +1 -0
- package/build-style/style-rtl.css +61 -191
- package/build-style/style.css +61 -195
- package/build-types/base-control/stories/index.d.ts.map +1 -1
- package/build-types/base-field/hook.d.ts +0 -1
- package/build-types/base-field/hook.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control/component.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control/hook.d.ts +0 -1
- package/build-types/border-box-control/border-box-control/hook.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control-linked-button/component.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts +0 -1
- package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control-split-controls/component.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +1 -1
- package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts +0 -1
- package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts.map +1 -1
- package/build-types/border-box-control/styles.d.ts +3 -2
- package/build-types/border-box-control/styles.d.ts.map +1 -1
- package/build-types/border-box-control/utils.d.ts.map +1 -1
- package/build-types/border-control/border-control/component.d.ts +36 -2
- package/build-types/border-control/border-control/component.d.ts.map +1 -1
- package/build-types/border-control/border-control/hook.d.ts +0 -1
- package/build-types/border-control/border-control/hook.d.ts.map +1 -1
- package/build-types/border-control/border-control-dropdown/hook.d.ts +0 -1
- package/build-types/border-control/border-control-dropdown/hook.d.ts.map +1 -1
- package/build-types/border-control/border-control-style-picker/hook.d.ts +0 -1
- package/build-types/border-control/border-control-style-picker/hook.d.ts.map +1 -1
- package/build-types/border-control/stories/index.d.ts +33 -0
- package/build-types/border-control/stories/index.d.ts.map +1 -0
- package/build-types/button-group/index.d.ts +1 -1
- package/build-types/button-group/index.d.ts.map +1 -1
- package/build-types/card/card/hook.d.ts +0 -1
- package/build-types/card/card/hook.d.ts.map +1 -1
- package/build-types/card/card-body/hook.d.ts +0 -1
- package/build-types/card/card-body/hook.d.ts.map +1 -1
- package/build-types/card/card-divider/hook.d.ts +0 -1
- package/build-types/card/card-divider/hook.d.ts.map +1 -1
- package/build-types/card/card-footer/hook.d.ts +0 -1
- package/build-types/card/card-footer/hook.d.ts.map +1 -1
- package/build-types/card/card-header/hook.d.ts +0 -1
- package/build-types/card/card-header/hook.d.ts.map +1 -1
- package/build-types/card/card-media/hook.d.ts +0 -1
- package/build-types/card/card-media/hook.d.ts.map +1 -1
- package/build-types/card/types.d.ts +1 -1
- package/build-types/card/types.d.ts.map +1 -1
- package/build-types/checkbox-control/index.d.ts.map +1 -1
- package/build-types/checkbox-control/stories/index.d.ts.map +1 -1
- package/build-types/checkbox-control/test/index.d.ts +2 -0
- package/build-types/checkbox-control/test/index.d.ts.map +1 -0
- package/build-types/color-indicator/index.d.ts +16 -5
- package/build-types/color-indicator/index.d.ts.map +1 -1
- package/build-types/color-indicator/stories/index.d.ts +12 -0
- package/build-types/color-indicator/stories/index.d.ts.map +1 -0
- package/build-types/color-indicator/test/index.d.ts +2 -0
- package/build-types/color-indicator/test/index.d.ts.map +1 -0
- package/build-types/color-indicator/types.d.ts +12 -0
- package/build-types/color-indicator/types.d.ts.map +1 -0
- package/build-types/color-palette/index.d.ts +1 -0
- package/build-types/color-palette/index.d.ts.map +1 -1
- package/build-types/color-palette/styles.d.ts +4 -2
- package/build-types/color-palette/styles.d.ts.map +1 -1
- package/build-types/{date-time → color-palette}/test/utils.d.ts +0 -0
- package/build-types/color-palette/test/utils.d.ts.map +1 -0
- package/build-types/color-picker/color-copy-button.d.ts +4 -0
- package/build-types/color-picker/color-copy-button.d.ts.map +1 -0
- package/build-types/color-picker/component.d.ts.map +1 -1
- package/build-types/color-picker/hex-input.d.ts.map +1 -1
- package/build-types/color-picker/styles.d.ts +25 -8
- package/build-types/color-picker/styles.d.ts.map +1 -1
- package/build-types/color-picker/types.d.ts +8 -0
- package/build-types/color-picker/types.d.ts.map +1 -1
- package/build-types/confirm-dialog/component.d.ts.map +1 -1
- package/build-types/date-time/{date.d.ts → date/index.d.ts} +4 -3
- package/build-types/date-time/date/index.d.ts.map +1 -0
- package/build-types/date-time/date/styles.d.ts +23 -0
- package/build-types/date-time/date/styles.d.ts.map +1 -0
- package/build-types/date-time/date/test/index.d.ts +2 -0
- package/build-types/date-time/date/test/index.d.ts.map +1 -0
- package/build-types/date-time/date/test/utils.d.ts +2 -0
- package/build-types/date-time/date/test/utils.d.ts.map +1 -0
- package/build-types/date-time/{utils.d.ts → date/utils.d.ts} +0 -0
- package/build-types/date-time/date/utils.d.ts.map +1 -0
- package/build-types/date-time/date-time/index.d.ts +33 -0
- package/build-types/date-time/date-time/index.d.ts.map +1 -0
- package/build-types/date-time/date-time/styles.d.ts +6 -0
- package/build-types/date-time/date-time/styles.d.ts.map +1 -0
- package/build-types/date-time/index.d.ts +2 -28
- package/build-types/date-time/index.d.ts.map +1 -1
- package/build-types/date-time/stories/{index.d.ts → date-time.d.ts} +2 -2
- package/build-types/date-time/stories/date-time.d.ts.map +1 -0
- package/build-types/date-time/stories/date.d.ts.map +1 -1
- package/build-types/date-time/{time.d.ts → time/index.d.ts} +2 -2
- package/build-types/date-time/time/index.d.ts.map +1 -0
- package/build-types/date-time/time/styles.d.ts +111 -0
- package/build-types/date-time/time/styles.d.ts.map +1 -0
- package/build-types/date-time/time/test/index.d.ts +2 -0
- package/build-types/date-time/time/test/index.d.ts.map +1 -0
- package/build-types/date-time/{timezone.d.ts → time/timezone.d.ts} +0 -0
- package/build-types/date-time/time/timezone.d.ts.map +1 -0
- package/build-types/date-time/types.d.ts +20 -15
- package/build-types/date-time/types.d.ts.map +1 -1
- package/build-types/divider/styles.d.ts.map +1 -1
- package/build-types/dropdown/index.d.ts.map +1 -1
- package/build-types/dropdown-menu/index.d.ts.map +1 -1
- package/build-types/elevation/hook.d.ts +0 -1
- package/build-types/elevation/hook.d.ts.map +1 -1
- package/build-types/external-link/index.d.ts +17 -0
- package/build-types/external-link/index.d.ts.map +1 -0
- package/build-types/external-link/stories/index.d.ts +12 -0
- package/build-types/external-link/stories/index.d.ts.map +1 -0
- package/build-types/external-link/styles/external-link-styles.d.ts +10 -0
- package/build-types/external-link/styles/external-link-styles.d.ts.map +1 -0
- package/build-types/external-link/types.d.ts +15 -0
- package/build-types/external-link/types.d.ts.map +1 -0
- package/build-types/flex/flex/hook.d.ts +0 -1
- package/build-types/flex/flex/hook.d.ts.map +1 -1
- package/build-types/flex/flex-block/hook.d.ts +0 -1
- package/build-types/flex/flex-block/hook.d.ts.map +1 -1
- package/build-types/flex/flex-item/hook.d.ts +0 -1
- package/build-types/flex/flex-item/hook.d.ts.map +1 -1
- package/build-types/form-toggle/index.d.ts +29 -0
- package/build-types/form-toggle/index.d.ts.map +1 -0
- package/build-types/form-toggle/stories/index.d.ts +12 -0
- package/build-types/form-toggle/stories/index.d.ts.map +1 -0
- package/build-types/form-toggle/test/index.d.ts +2 -0
- package/build-types/form-toggle/test/index.d.ts.map +1 -0
- package/build-types/form-toggle/types.d.ts +22 -0
- package/build-types/form-toggle/types.d.ts.map +1 -0
- package/build-types/form-token-field/index.d.ts +15 -0
- package/build-types/form-token-field/index.d.ts.map +1 -0
- package/build-types/form-token-field/stories/index.d.ts +13 -0
- package/build-types/form-token-field/stories/index.d.ts.map +1 -0
- package/build-types/form-token-field/suggestions-list.d.ts +10 -0
- package/build-types/form-token-field/suggestions-list.d.ts.map +1 -0
- package/build-types/form-token-field/test/lib/fixtures.d.ts +26 -0
- package/build-types/form-token-field/test/lib/fixtures.d.ts.map +1 -0
- package/build-types/form-token-field/test/lib/token-field-wrapper.d.ts +21 -0
- package/build-types/form-token-field/test/lib/token-field-wrapper.d.ts.map +1 -0
- package/build-types/form-token-field/token-input.d.ts +12 -0
- package/build-types/form-token-field/token-input.d.ts.map +1 -0
- package/build-types/form-token-field/token.d.ts +4 -0
- package/build-types/form-token-field/token.d.ts.map +1 -0
- package/build-types/form-token-field/types.d.ts +176 -0
- package/build-types/form-token-field/types.d.ts.map +1 -0
- package/build-types/grid/hook.d.ts +0 -1
- package/build-types/grid/hook.d.ts.map +1 -1
- package/build-types/h-stack/hook.d.ts +0 -1
- package/build-types/h-stack/hook.d.ts.map +1 -1
- package/build-types/heading/component.d.ts +1 -2
- package/build-types/heading/component.d.ts.map +1 -1
- package/build-types/heading/hook.d.ts +1 -29
- package/build-types/heading/hook.d.ts.map +1 -1
- package/build-types/heading/stories/index.d.ts.map +1 -1
- package/build-types/heading/test/index.d.ts +2 -0
- package/build-types/heading/test/index.d.ts.map +1 -0
- package/build-types/heading/types.d.ts +16 -0
- package/build-types/heading/types.d.ts.map +1 -0
- package/build-types/higher-order/with-focus-outside/index.d.ts +1 -1
- package/build-types/input-control/index.d.ts +1 -1
- package/build-types/input-control/index.d.ts.map +1 -1
- package/build-types/input-control/input-field.d.ts +1 -1
- package/build-types/input-control/input-field.d.ts.map +1 -1
- package/build-types/input-control/reducer/reducer.d.ts +5 -3
- package/build-types/input-control/reducer/reducer.d.ts.map +1 -1
- package/build-types/input-control/reducer/state.d.ts +2 -2
- package/build-types/input-control/reducer/state.d.ts.map +1 -1
- package/build-types/input-control/stories/index.d.ts +5 -5
- package/build-types/input-control/stories/index.d.ts.map +1 -1
- package/build-types/input-control/utils.d.ts +17 -0
- package/build-types/input-control/utils.d.ts.map +1 -1
- package/build-types/item-group/item/hook.d.ts +0 -1
- package/build-types/item-group/item/hook.d.ts.map +1 -1
- package/build-types/item-group/item-group/hook.d.ts +0 -1
- package/build-types/item-group/item-group/hook.d.ts.map +1 -1
- package/build-types/navigator/navigator-back-button/hook.d.ts +0 -1
- package/build-types/navigator/navigator-back-button/hook.d.ts.map +1 -1
- package/build-types/navigator/navigator-button/hook.d.ts +0 -1
- package/build-types/navigator/navigator-button/hook.d.ts.map +1 -1
- package/build-types/navigator/navigator-provider/component.d.ts.map +1 -1
- package/build-types/number-control/styles/number-control-styles.d.ts +1 -1
- package/build-types/popover/index.d.ts +1 -0
- package/build-types/popover/index.d.ts.map +1 -1
- package/build-types/radio-control/index.d.ts +31 -0
- package/build-types/radio-control/index.d.ts.map +1 -0
- package/build-types/radio-control/stories/index.d.ts +12 -0
- package/build-types/radio-control/stories/index.d.ts.map +1 -0
- package/build-types/radio-control/types.d.ts +29 -0
- package/build-types/radio-control/types.d.ts.map +1 -0
- package/build-types/range-control/index.d.ts +5 -5
- package/build-types/range-control/index.d.ts.map +1 -1
- package/build-types/range-control/input-range.d.ts +4 -4
- package/build-types/range-control/input-range.d.ts.map +1 -1
- package/build-types/range-control/utils.d.ts.map +1 -1
- package/build-types/resizable-box/resize-tooltip/index.d.ts.map +1 -1
- package/build-types/resizable-box/resize-tooltip/utils.d.ts.map +1 -1
- package/build-types/scrollable/hook.d.ts +0 -1
- package/build-types/scrollable/hook.d.ts.map +1 -1
- package/build-types/select-control/index.d.ts +1 -1
- package/build-types/select-control/index.d.ts.map +1 -1
- package/build-types/select-control/stories/index.d.ts +3 -3
- package/build-types/select-control/stories/index.d.ts.map +1 -1
- package/build-types/select-control/types.d.ts +1 -1
- package/build-types/select-control/types.d.ts.map +1 -1
- package/build-types/slot-fill/fill.d.ts.map +1 -1
- package/build-types/slot-fill/slot.d.ts.map +1 -1
- package/build-types/spacer/component.d.ts +2 -3
- package/build-types/spacer/component.d.ts.map +1 -1
- package/build-types/spacer/hook.d.ts +0 -1
- package/build-types/spacer/hook.d.ts.map +1 -1
- package/build-types/spacer/stories/index.d.ts +12 -0
- package/build-types/spacer/stories/index.d.ts.map +1 -0
- package/build-types/spinner/index.d.ts +16 -15
- package/build-types/spinner/index.d.ts.map +1 -1
- package/build-types/spinner/stories/index.d.ts +13 -0
- package/build-types/spinner/stories/index.d.ts.map +1 -0
- package/build-types/spinner/styles.d.ts +4 -3
- package/build-types/spinner/styles.d.ts.map +1 -1
- package/build-types/surface/component.d.ts +3 -2
- package/build-types/surface/component.d.ts.map +1 -1
- package/build-types/surface/hook.d.ts +4 -5
- package/build-types/surface/hook.d.ts.map +1 -1
- package/build-types/surface/index.d.ts +2 -2
- package/build-types/surface/index.d.ts.map +1 -1
- package/build-types/surface/stories/index.d.ts +12 -0
- package/build-types/surface/stories/index.d.ts.map +1 -0
- package/build-types/surface/styles.d.ts +10 -21
- package/build-types/surface/styles.d.ts.map +1 -1
- package/build-types/surface/test/index.d.ts +2 -0
- package/build-types/surface/test/index.d.ts.map +1 -0
- package/build-types/surface/types.d.ts +1 -1
- package/build-types/surface/types.d.ts.map +1 -1
- package/build-types/text/hook.d.ts +0 -1
- package/build-types/text/hook.d.ts.map +1 -1
- package/build-types/text/types.d.ts +1 -1
- package/build-types/text/types.d.ts.map +1 -1
- package/build-types/text/utils.d.ts.map +1 -1
- package/build-types/text-control/index.d.ts +1 -1
- package/build-types/text-control/index.d.ts.map +1 -1
- package/build-types/text-control/stories/index.d.ts.map +1 -1
- package/build-types/textarea-control/index.d.ts +29 -0
- package/build-types/textarea-control/index.d.ts.map +1 -0
- package/build-types/textarea-control/stories/index.d.ts +12 -0
- package/build-types/textarea-control/stories/index.d.ts.map +1 -0
- package/build-types/textarea-control/styles/textarea-control-styles.d.ts +6 -0
- package/build-types/textarea-control/styles/textarea-control-styles.d.ts.map +1 -0
- package/build-types/textarea-control/types.d.ts +26 -0
- package/build-types/textarea-control/types.d.ts.map +1 -0
- package/build-types/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel/hook.d.ts +0 -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 +0 -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 +0 -1
- package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
- package/build-types/tooltip/index.d.ts.map +1 -1
- package/build-types/tree-select/index.d.ts +53 -0
- package/build-types/tree-select/index.d.ts.map +1 -0
- package/build-types/tree-select/stories/index.d.ts +12 -0
- package/build-types/tree-select/stories/index.d.ts.map +1 -0
- package/build-types/tree-select/types.d.ts +30 -0
- package/build-types/tree-select/types.d.ts.map +1 -0
- package/build-types/truncate/component.d.ts +3 -3
- package/build-types/truncate/component.d.ts.map +1 -1
- package/build-types/truncate/hook.d.ts +5 -3
- package/build-types/truncate/hook.d.ts.map +1 -1
- package/build-types/truncate/index.d.ts +2 -2
- package/build-types/truncate/index.d.ts.map +1 -1
- package/build-types/truncate/stories/index.d.ts +13 -0
- package/build-types/truncate/stories/index.d.ts.map +1 -0
- package/build-types/truncate/styles.d.ts +1 -1
- package/build-types/truncate/styles.d.ts.map +1 -1
- package/build-types/truncate/test/index.d.ts +2 -0
- package/build-types/truncate/test/index.d.ts.map +1 -0
- package/build-types/truncate/types.d.ts +22 -11
- package/build-types/truncate/types.d.ts.map +1 -1
- package/build-types/truncate/utils.d.ts +17 -28
- package/build-types/truncate/utils.d.ts.map +1 -1
- package/build-types/ui/context/wordpress-component.d.ts.map +1 -1
- package/build-types/ui/control-group/hook.d.ts +0 -1
- package/build-types/ui/control-group/hook.d.ts.map +1 -1
- package/build-types/ui/control-label/hook.d.ts +0 -1
- package/build-types/ui/control-label/hook.d.ts.map +1 -1
- package/build-types/ui/form-group/use-form-group.d.ts +2 -4
- package/build-types/ui/form-group/use-form-group.d.ts.map +1 -1
- package/build-types/unit-control/index.d.ts +1 -1
- package/build-types/unit-control/index.d.ts.map +1 -1
- package/build-types/unit-control/stories/index.d.ts.map +1 -1
- package/build-types/utils/hooks/index.d.ts +0 -1
- package/build-types/utils/math.d.ts +10 -0
- package/build-types/utils/math.d.ts.map +1 -1
- package/build-types/utils/unit-values.d.ts.map +1 -1
- package/build-types/utils/values.d.ts.map +1 -1
- package/build-types/v-stack/component.d.ts +5 -4
- package/build-types/v-stack/component.d.ts.map +1 -1
- package/build-types/v-stack/hook.d.ts +5 -4
- package/build-types/v-stack/hook.d.ts.map +1 -1
- package/build-types/v-stack/index.d.ts +2 -2
- package/build-types/v-stack/index.d.ts.map +1 -1
- package/build-types/v-stack/stories/index.d.ts +9 -0
- package/build-types/v-stack/stories/index.d.ts.map +1 -0
- package/build-types/v-stack/test/index.d.ts +2 -0
- package/build-types/v-stack/test/index.d.ts.map +1 -0
- package/build-types/v-stack/types.d.ts +21 -1
- package/build-types/v-stack/types.d.ts.map +1 -1
- package/build-types/z-stack/component.d.ts +18 -28
- package/build-types/z-stack/component.d.ts.map +1 -1
- package/build-types/z-stack/stories/index.d.ts +6 -0
- package/build-types/z-stack/stories/index.d.ts.map +1 -0
- package/build-types/z-stack/types.d.ts +33 -0
- package/build-types/z-stack/types.d.ts.map +1 -0
- package/package.json +19 -18
- package/src/alignment-matrix-control/index.js +6 -3
- package/src/alignment-matrix-control/utils.js +1 -6
- package/src/angle-picker-control/index.js +1 -1
- package/src/autocomplete/autocompleter-ui.js +3 -0
- package/src/autocomplete/autocompleter-ui.native.js +6 -0
- package/src/autocomplete/index.js +16 -8
- package/src/base-control/stories/index.tsx +2 -3
- package/src/border-box-control/border-box-control/component.tsx +1 -0
- package/src/border-box-control/border-box-control/hook.ts +2 -2
- package/src/border-box-control/border-box-control-linked-button/component.tsx +2 -5
- package/src/border-box-control/border-box-control-split-controls/component.tsx +3 -0
- package/src/border-box-control/border-box-control-split-controls/hook.ts +18 -4
- package/src/border-box-control/border-box-control-visualizer/hook.ts +5 -2
- package/src/border-box-control/styles.ts +6 -2
- package/src/border-box-control/utils.ts +5 -2
- package/src/border-control/border-control/component.tsx +41 -4
- package/src/border-control/border-control/hook.ts +10 -5
- package/src/border-control/stories/index.tsx +150 -0
- package/src/box-control/all-input-control.js +2 -4
- package/src/box-control/axial-input-controls.js +4 -6
- package/src/box-control/index.js +2 -5
- package/src/box-control/input-controls.js +33 -36
- package/src/box-control/test/index.js +120 -109
- package/src/box-control/unit-control.js +2 -1
- package/src/box-control/utils.js +4 -4
- package/src/button/index.native.js +1 -2
- package/src/card/stories/index.js +10 -5
- package/src/card/types.ts +1 -1
- package/src/checkbox-control/index.tsx +2 -3
- package/src/checkbox-control/stories/index.tsx +2 -3
- package/src/checkbox-control/test/__snapshots__/index.tsx.snap +42 -0
- package/src/checkbox-control/test/index.tsx +110 -0
- package/src/color-indicator/README.md +7 -9
- package/src/color-indicator/index.tsx +47 -0
- package/src/color-indicator/stories/index.tsx +37 -0
- package/src/color-indicator/test/__snapshots__/index.tsx.snap +11 -0
- package/src/color-indicator/test/{index.js → index.tsx} +4 -4
- package/src/color-indicator/types.ts +12 -0
- package/src/color-palette/index.js +16 -5
- package/src/color-palette/index.native.js +3 -0
- package/src/color-palette/stories/index.js +25 -1
- package/src/color-palette/test/utils.ts +24 -0
- package/src/color-picker/color-copy-button.tsx +76 -0
- package/src/color-picker/component.tsx +18 -37
- package/src/color-picker/hex-input.tsx +16 -0
- package/src/color-picker/index.native.js +7 -4
- package/src/color-picker/input-with-slider.tsx +2 -2
- package/src/color-picker/styles.ts +25 -2
- package/src/color-picker/types.ts +9 -0
- package/src/combobox-control/index.js +4 -2
- package/src/confirm-dialog/component.tsx +7 -8
- package/src/custom-gradient-bar/constants.js +2 -2
- package/src/custom-gradient-bar/control-points.js +20 -16
- package/src/custom-gradient-bar/index.js +11 -11
- package/src/custom-gradient-bar/test/utils.js +79 -0
- package/src/custom-gradient-bar/utils.js +6 -18
- package/src/custom-gradient-picker/index.js +4 -11
- package/src/custom-gradient-picker/index.native.js +3 -11
- package/src/custom-gradient-picker/serializer.js +5 -11
- package/src/custom-gradient-picker/style.scss +1 -3
- package/src/custom-gradient-picker/utils.js +5 -4
- package/src/custom-select-control/index.js +2 -1
- package/src/custom-select-control/stories/index.js +1 -2
- package/src/date-time/README.md +23 -0
- package/src/date-time/{datepicker.scss → date/datepicker.scss} +0 -0
- package/src/date-time/{date.tsx → date/index.tsx} +42 -17
- package/src/date-time/date/style.scss +85 -0
- package/src/date-time/date/styles.ts +55 -0
- package/src/date-time/{test/date.tsx → date/test/index.tsx} +2 -2
- package/src/date-time/{test → date/test}/utils.ts +0 -0
- package/src/date-time/{utils.ts → date/utils.ts} +0 -0
- package/src/date-time/date-time/index.tsx +217 -0
- package/src/date-time/date-time/styles.ts +8 -0
- package/src/date-time/index.ts +9 -0
- package/src/date-time/stories/{index.tsx → date-time.tsx} +5 -7
- package/src/date-time/stories/date.tsx +2 -3
- package/src/date-time/style.scss +1 -262
- package/src/date-time/time/index.tsx +356 -0
- package/src/date-time/time/styles.ts +119 -0
- package/src/date-time/{test/time.tsx → time/test/index.tsx} +97 -50
- package/src/date-time/{timezone.tsx → time/timezone.tsx} +5 -2
- package/src/date-time/types.ts +23 -18
- package/src/dimension-control/README.md +5 -2
- package/src/dimension-control/index.js +1 -2
- package/src/dimension-control/test/index.test.js +7 -7
- package/src/divider/styles.ts +2 -3
- package/src/draggable/index.js +3 -3
- package/src/draggable/index.native.js +26 -7
- package/src/draggable/test/index.native.js +130 -0
- package/src/drop-zone/provider.js +1 -2
- package/src/dropdown/index.js +7 -3
- package/src/dropdown-menu/index.js +11 -1
- package/src/dropdown-menu/index.native.js +11 -1
- package/src/duotone-picker/duotone-picker.js +58 -37
- package/src/duotone-picker/style.scss +19 -0
- package/src/elevation/hook.js +8 -8
- package/src/external-link/README.md +18 -0
- package/src/external-link/{index.js → index.tsx} +26 -6
- package/src/external-link/stories/index.tsx +36 -0
- package/src/external-link/styles/{external-link-styles.js → external-link-styles.ts} +0 -0
- package/src/external-link/types.ts +15 -0
- package/src/flex/flex/README.md +5 -10
- package/src/flex/flex/hook.js +4 -1
- package/src/flex/flex-item/README.md +1 -1
- package/src/focal-point-picker/controls.js +1 -5
- package/src/focal-point-picker/index.js +2 -8
- package/src/focal-point-picker/index.native.js +1 -1
- package/src/focal-point-picker/media.js +2 -5
- package/src/font-size-picker/index.js +3 -1
- package/src/form-toggle/README.md +10 -11
- package/src/form-toggle/index.tsx +71 -0
- package/src/form-toggle/stories/index.tsx +52 -0
- package/src/form-toggle/test/__snapshots__/index.tsx.snap +54 -0
- package/src/form-toggle/test/index.tsx +102 -0
- package/src/form-toggle/types.ts +22 -0
- package/src/form-token-field/index.tsx +694 -0
- package/src/form-token-field/stories/index.tsx +103 -0
- package/src/form-token-field/style.scss +2 -1
- package/src/form-token-field/{suggestions-list.js → suggestions-list.tsx} +45 -29
- package/src/form-token-field/test/index.js +70 -40
- package/src/form-token-field/test/lib/token-field-wrapper.tsx +71 -0
- package/src/form-token-field/token-input.tsx +76 -0
- package/src/form-token-field/{token.js → token.tsx} +4 -2
- package/src/form-token-field/types.ts +178 -0
- package/src/gradient-picker/index.js +4 -3
- package/src/h-stack/utils.js +3 -3
- package/src/heading/README.md +4 -3
- package/src/heading/component.tsx +2 -2
- package/src/heading/hook.ts +6 -46
- package/src/heading/stories/index.tsx +5 -1
- package/src/heading/test/__snapshots__/{index.js.snap → index.tsx.snap} +0 -0
- package/src/heading/test/index.tsx +68 -0
- package/src/heading/types.ts +29 -0
- package/src/higher-order/navigate-regions/index.js +7 -5
- package/src/higher-order/with-filters/test/index.js +43 -36
- package/src/higher-order/with-focus-return/index.js +14 -13
- package/src/higher-order/with-spoken-messages/index.js +8 -7
- package/src/higher-order/with-spoken-messages/test/index.js +1 -1
- package/src/icon/index.tsx +2 -2
- package/src/input-control/index.tsx +10 -3
- package/src/input-control/input-field.tsx +12 -31
- package/src/input-control/reducer/reducer.ts +63 -47
- package/src/input-control/reducer/state.ts +2 -3
- package/src/input-control/test/index.js +106 -31
- package/src/input-control/utils.ts +56 -2
- package/src/item-group/stories/index.js +2 -1
- package/src/menu-item/test/index.js +2 -1
- package/src/menu-items-choice/index.js +2 -5
- package/src/mobile/bottom-sheet/bottom-sheet-context.native.js +2 -4
- package/src/mobile/bottom-sheet/cell.native.js +2 -3
- package/src/mobile/bottom-sheet/cycle-picker-cell.native.js +3 -5
- package/src/mobile/bottom-sheet/index.native.js +14 -17
- package/src/mobile/bottom-sheet/keyboard-avoiding-view.native.js +2 -7
- package/src/mobile/bottom-sheet/picker-cell.native.js +2 -7
- package/src/mobile/bottom-sheet/stepper-cell/index.native.js +4 -6
- package/src/mobile/color-settings/index.native.js +2 -4
- package/src/mobile/global-styles-context/index.native.js +8 -7
- package/src/mobile/gradient/index.native.js +12 -9
- package/src/mobile/gradient/test/index.native.js +1 -3
- package/src/mobile/html-text-input/index.native.js +2 -3
- package/src/mobile/inserter-button/index.native.js +2 -6
- package/src/mobile/link-picker/index.native.js +2 -3
- package/src/mobile/link-settings/image-link-destinations-screen.native.js +6 -2
- package/src/mobile/media-edit/index.native.js +2 -3
- package/src/mobile/segmented-control/index.native.js +9 -9
- package/src/mobile/utils/test/index.native.js +3 -12
- package/src/modal/index.js +1 -1
- package/src/navigable-container/container.js +3 -2
- package/src/navigable-container/test/menu.js +1 -2
- package/src/navigable-container/test/tabbable.js +1 -2
- package/src/navigation/context.js +2 -5
- package/src/navigation/group/index.js +8 -3
- package/src/navigation/index.js +2 -1
- package/src/navigation/item/base.js +3 -2
- package/src/navigation/item/index.js +2 -1
- package/src/navigation/item/use-navigation-tree-item.js +2 -0
- package/src/navigation/menu/menu-title-search.js +3 -6
- package/src/navigation/menu/search-no-results-found.js +3 -6
- package/src/navigation/stories/controlled-state.js +1 -1
- package/src/navigation/stories/more-examples.js +2 -3
- package/src/navigation/test/index.js +252 -52
- package/src/navigation/use-navigation-tree-nodes.js +11 -10
- package/src/navigation/utils.js +2 -2
- package/src/navigator/navigator-back-button/hook.ts +14 -12
- package/src/navigator/navigator-button/hook.ts +14 -13
- package/src/navigator/navigator-provider/component.tsx +2 -6
- package/src/navigator/navigator-screen/component.tsx +3 -3
- package/src/notice/index.js +2 -1
- package/src/notice/list.js +3 -1
- package/src/number-control/stories/index.js +24 -24
- package/src/panel/body.js +2 -1
- package/src/placeholder/README.md +7 -6
- package/src/placeholder/index.js +27 -10
- package/src/placeholder/style.scss +23 -0
- package/src/popover/index.js +42 -27
- package/src/query-controls/README.md +1 -1
- package/src/radio-control/README.md +17 -23
- package/src/radio-control/index.tsx +107 -0
- package/src/radio-control/stories/index.tsx +72 -0
- package/src/radio-control/types.ts +32 -0
- package/src/range-control/index.js +4 -2
- package/src/range-control/input-range.js +2 -5
- package/src/range-control/utils.js +3 -4
- package/src/resizable-box/resize-tooltip/index.tsx +2 -1
- package/src/resizable-box/resize-tooltip/utils.ts +1 -5
- package/src/responsive-wrapper/index.js +2 -4
- package/src/sandbox/test/index.js +4 -6
- package/src/search-control/index.js +6 -7
- package/src/select-control/README.md +11 -0
- package/src/select-control/index.tsx +9 -2
- package/src/select-control/stories/index.tsx +3 -4
- package/src/select-control/types.ts +1 -1
- package/src/slot-fill/README.md +1 -1
- package/src/slot-fill/fill.js +1 -5
- package/src/slot-fill/slot.js +12 -2
- package/src/slot-fill/test/slot.js +2 -3
- package/src/snackbar/index.js +1 -1
- package/src/snackbar/list.js +2 -1
- package/src/spacer/component.tsx +3 -4
- package/src/spacer/hook.ts +13 -13
- package/src/spacer/stories/index.tsx +70 -0
- package/src/spinner/{index.js → index.tsx} +23 -9
- package/src/spinner/stories/index.tsx +32 -0
- package/src/spinner/{styles.js → styles.ts} +0 -0
- package/src/style.scss +1 -0
- package/src/surface/README.md +15 -15
- package/src/surface/{component.js → component.tsx} +13 -7
- package/src/surface/{hook.js → hook.ts} +13 -12
- package/src/surface/{index.js → index.ts} +0 -0
- package/src/surface/stories/index.tsx +40 -0
- package/src/surface/{styles.js → styles.ts} +15 -44
- package/src/surface/test/__snapshots__/{index.js.snap → index.tsx.snap} +0 -0
- package/src/surface/test/{index.js → index.tsx} +2 -1
- package/src/surface/types.ts +1 -1
- package/src/tab-panel/index.js +3 -1
- package/src/text/hook.js +4 -1
- package/src/text/types.ts +1 -1
- package/src/text/utils.js +2 -3
- package/src/text-control/stories/index.tsx +4 -6
- package/src/textarea-control/README.md +14 -20
- package/src/textarea-control/index.tsx +86 -0
- package/src/textarea-control/stories/index.tsx +58 -0
- package/src/textarea-control/styles/{textarea-control-styles.js → textarea-control-styles.ts} +0 -0
- package/src/textarea-control/types.ts +30 -0
- package/src/toggle-control/index.js +1 -2
- package/src/toggle-control/index.native.js +2 -6
- package/src/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.tsx +2 -4
- package/src/toolbar/index.js +1 -2
- package/src/tools-panel/tools-panel/hook.ts +2 -4
- package/src/tools-panel/tools-panel-header/hook.ts +2 -5
- package/src/tooltip/index.js +1 -0
- package/src/tree-grid/roving-tab-index-item.js +2 -4
- package/src/tree-grid/test/index.js +2 -3
- package/src/tree-select/README.md +2 -2
- package/src/tree-select/index.tsx +99 -0
- package/src/tree-select/stories/index.tsx +80 -0
- package/src/tree-select/types.ts +35 -0
- package/src/truncate/README.md +16 -12
- package/src/truncate/{component.js → component.tsx} +13 -9
- package/src/truncate/{hook.js → hook.ts} +8 -10
- package/src/truncate/{index.js → index.ts} +0 -0
- package/src/truncate/stories/index.tsx +49 -0
- package/src/truncate/{styles.js → styles.ts} +0 -0
- package/src/truncate/test/{index.js → index.tsx} +4 -4
- package/src/truncate/types.ts +28 -10
- package/src/truncate/{utils.js → utils.ts} +19 -19
- package/src/ui/context/wordpress-component.ts +4 -5
- package/src/ui/form-group/form-group-content.js +4 -4
- package/src/unit-control/index.tsx +7 -9
- package/src/unit-control/stories/index.tsx +8 -12
- package/src/unit-control/test/index.tsx +4 -7
- package/src/utils/hooks/index.js +0 -1
- package/src/utils/hooks/stories/use-cx.js +8 -7
- package/src/utils/hooks/test/use-controlled-state.js +2 -1
- package/src/utils/math.js +14 -5
- package/src/utils/test/math.js +22 -1
- package/src/utils/unit-values.ts +2 -1
- package/src/utils/values.js +2 -3
- package/src/v-stack/README.md +6 -18
- package/src/v-stack/{component.js → component.tsx} +15 -10
- package/src/v-stack/{hook.js → hook.ts} +5 -6
- package/src/v-stack/{index.js → index.ts} +0 -0
- package/src/v-stack/stories/index.tsx +41 -0
- package/src/v-stack/test/__snapshots__/{index.js.snap → index.tsx.snap} +0 -0
- package/src/v-stack/test/{index.js → index.tsx} +0 -0
- package/src/v-stack/types.ts +21 -1
- package/src/z-stack/README.md +14 -3
- package/src/z-stack/component.tsx +24 -29
- package/src/z-stack/stories/index.tsx +76 -0
- package/src/z-stack/types.ts +33 -0
- package/tsconfig.json +7 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/color-picker/color-display.js +0 -184
- package/build/color-picker/color-display.js.map +0 -1
- package/build/date-time/date.js.map +0 -1
- package/build/date-time/time.js +0 -289
- package/build/date-time/time.js.map +0 -1
- package/build/date-time/timezone.js.map +0 -1
- package/build/date-time/utils.js.map +0 -1
- package/build/utils/hooks/use-combined-ref.js +0 -32
- package/build/utils/hooks/use-combined-ref.js.map +0 -1
- package/build-module/color-picker/color-display.js +0 -170
- package/build-module/color-picker/color-display.js.map +0 -1
- package/build-module/date-time/date.js.map +0 -1
- package/build-module/date-time/time.js +0 -271
- package/build-module/date-time/time.js.map +0 -1
- package/build-module/date-time/timezone.js.map +0 -1
- package/build-module/date-time/utils.js.map +0 -1
- package/build-module/utils/hooks/use-combined-ref.js +0 -28
- package/build-module/utils/hooks/use-combined-ref.js.map +0 -1
- package/build-types/color-picker/color-display.d.ts +0 -14
- package/build-types/color-picker/color-display.d.ts.map +0 -1
- package/build-types/date-time/date.d.ts.map +0 -1
- package/build-types/date-time/stories/index.d.ts.map +0 -1
- package/build-types/date-time/test/date.d.ts +0 -2
- package/build-types/date-time/test/date.d.ts.map +0 -1
- package/build-types/date-time/test/time.d.ts +0 -2
- package/build-types/date-time/test/time.d.ts.map +0 -1
- package/build-types/date-time/test/utils.d.ts.map +0 -1
- package/build-types/date-time/time.d.ts.map +0 -1
- package/build-types/date-time/timezone.d.ts.map +0 -1
- package/build-types/date-time/utils.d.ts.map +0 -1
- package/build-types/utils/hooks/use-combined-ref.d.ts +0 -8
- package/build-types/utils/hooks/use-combined-ref.d.ts.map +0 -1
- package/src/border-control/stories/index.js +0 -119
- package/src/color-indicator/index.js +0 -16
- package/src/color-indicator/stories/index.js +0 -22
- package/src/color-indicator/test/__snapshots__/index.js.snap +0 -13
- package/src/color-picker/color-display.tsx +0 -169
- package/src/date-time/index.tsx +0 -196
- package/src/date-time/time.tsx +0 -321
- package/src/external-link/stories/index.js +0 -23
- package/src/form-toggle/index.js +0 -37
- package/src/form-toggle/stories/index.js +0 -28
- package/src/form-toggle/test/index.js +0 -75
- package/src/form-token-field/index.js +0 -725
- package/src/form-token-field/stories/index.js +0 -102
- package/src/form-token-field/test/lib/token-field-wrapper.js +0 -56
- package/src/form-token-field/token-input.js +0 -81
- package/src/heading/test/index.js +0 -67
- package/src/radio-control/index.js +0 -69
- package/src/radio-control/stories/index.js +0 -41
- package/src/spacer/stories/index.js +0 -59
- package/src/spinner/stories/index.js +0 -43
- package/src/surface/stories/index.js +0 -46
- package/src/textarea-control/index.js +0 -45
- package/src/textarea-control/stories/index.js +0 -48
- package/src/tree-select/index.js +0 -48
- package/src/tree-select/stories/index.js +0 -80
- package/src/truncate/stories/index.js +0 -38
- package/src/utils/hooks/use-combined-ref.ts +0 -28
- package/src/z-stack/stories/index.js +0 -70
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/h-stack/utils.js"],"names":["ALIGNMENTS","bottom","align","justify","bottomLeft","bottomRight","center","edge","left","right","stretch","top","topLeft","topRight","V_ALIGNMENTS","getAlignmentProps","alignment","direction","isVertical","props","alignmentProps"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA,MAAMA,UAAU,GAAG;AAClBC,EAAAA,MAAM,EAAE;AAAEC,IAAAA,KAAK,EAAE,UAAT;AAAqBC,IAAAA,OAAO,EAAE;AAA9B,GADU;AAElBC,EAAAA,UAAU,EAAE;AAAEF,IAAAA,KAAK,EAAE,YAAT;AAAuBC,IAAAA,OAAO,EAAE;AAAhC,GAFM;AAGlBE,EAAAA,WAAW,EAAE;AAAEH,IAAAA,KAAK,EAAE,UAAT;AAAqBC,IAAAA,OAAO,EAAE;AAA9B,GAHK;AAIlBG,EAAAA,MAAM,EAAE;AAAEJ,IAAAA,KAAK,EAAE,QAAT;AAAmBC,IAAAA,OAAO,EAAE;AAA5B,GAJU;AAKlBI,EAAAA,IAAI,EAAE;AAAEL,IAAAA,KAAK,EAAE,QAAT;AAAmBC,IAAAA,OAAO,EAAE;AAA5B,GALY;AAMlBK,EAAAA,IAAI,EAAE;AAAEN,IAAAA,KAAK,EAAE,QAAT;AAAmBC,IAAAA,OAAO,EAAE;AAA5B,GANY;AAOlBM,EAAAA,KAAK,EAAE;AAAEP,IAAAA,KAAK,EAAE,QAAT;AAAmBC,IAAAA,OAAO,EAAE;AAA5B,GAPW;AAQlBO,EAAAA,OAAO,EAAE;AAAER,IAAAA,KAAK,EAAE;AAAT,GARS;AASlBS,EAAAA,GAAG,EAAE;AAAET,IAAAA,KAAK,EAAE,YAAT;AAAuBC,IAAAA,OAAO,EAAE;AAAhC,GATa;AAUlBS,EAA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EV,IAAAA,OAAO,EAAE,YAAX;AAAyBD,IAAAA,KAAK,EAAE;AAAhC;AAXU,CAArB;AAcA;;AACA;AACA;AACA;AACA;AACA;;AACA;;AACO,SAASa,iBAAT,CAA4BC,SAA5B,EAA2D;AAAA,MAApBC,SAAoB,uEAAR,KAAQ;;AACjE,MAAK,
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/h-stack/utils.js"],"names":["ALIGNMENTS","bottom","align","justify","bottomLeft","bottomRight","center","edge","left","right","stretch","top","topLeft","topRight","V_ALIGNMENTS","getAlignmentProps","alignment","direction","isVertical","props","alignmentProps"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA,MAAMA,UAAU,GAAG;AAClBC,EAAAA,MAAM,EAAE;AAAEC,IAAAA,KAAK,EAAE,UAAT;AAAqBC,IAAAA,OAAO,EAAE;AAA9B,GADU;AAElBC,EAAAA,UAAU,EAAE;AAAEF,IAAAA,KAAK,EAAE,YAAT;AAAuBC,IAAAA,OAAO,EAAE;AAAhC,GAFM;AAGlBE,EAAAA,WAAW,EAAE;AAAEH,IAAAA,KAAK,EAAE,UAAT;AAAqBC,IAAAA,OAAO,EAAE;AAA9B,GAHK;AAIlBG,EAAAA,MAAM,EAAE;AAAEJ,IAAAA,KAAK,EAAE,QAAT;AAAmBC,IAAAA,OAAO,EAAE;AAA5B,GAJU;AAKlBI,EAAAA,IAAI,EAAE;AAAEL,IAAAA,KAAK,EAAE,QAAT;AAAmBC,IAAAA,OAAO,EAAE;AAA5B,GALY;AAMlBK,EAAAA,IAAI,EAAE;AAAEN,IAAAA,KAAK,EAAE,QAAT;AAAmBC,IAAAA,OAAO,EAAE;AAA5B,GANY;AAOlBM,EAAAA,KAAK,EAAE;AAAEP,IAAAA,KAAK,EAAE,QAAT;AAAmBC,IAAAA,OAAO,EAAE;AAA5B,GAPW;AAQlBO,EAAAA,OAAO,EAAE;AAAER,IAAAA,KAAK,EAAE;AAAT,GARS;AASlBS,EAAAA,GAA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OAAO,EAAE,YAAX;AAAyBD,IAAAA,KAAK,EAAE;AAAhC,GAVW;AAWpBW,EAAAA,QAAQ,EAAE;AAAEV,IAAAA,OAAO,EAAE,YAAX;AAAyBD,IAAAA,KAAK,EAAE;AAAhC;AAXU,CAArB;AAcA;;AACA;AACA;AACA;AACA;AACA;;AACA;;AACO,SAASa,iBAAT,CAA4BC,SAA5B,EAA2D;AAAA,MAApBC,SAAoB,uEAAR,KAAQ;;AACjE,MAAK,CAAE,4BAAgBD,SAAhB,CAAP,EAAqC;AACpC,WAAO,EAAP;AACA;;AACD,QAAME,UAAU,GAAGD,SAAS,KAAK,QAAjC;AACA,QAAME,KAAK,GAAGD,UAAU,GAAGJ,YAAH,GAAkBd,UAA1C;AAEA,QAAMoB,cAAc,GACnBJ,SAAS,IAAIG,KAAb,GACGA,KAAK;AAAE;AAAyCH,EAAAA,SAA3C,CADR,GAEG;AAAEd,IAAAA,KAAK,EAAEc;AAAT,GAHJ;AAKA,SAAOI,cAAP;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport { isValueDefined } from '../utils/values';\n\n/** @type {import('./types').Alignments} */\nconst ALIGNMENTS = {\n\tbottom: { align: 'flex-end', justify: 'center' },\n\tbottomLeft: { align: 'flex-start', justify: 'flex-end' },\n\tbottomRight: { align: 'flex-end', justify: 'flex-end' },\n\tcenter: { align: 'center', justify: 'center' },\n\tedge: { align: 'center', justify: 'space-between' },\n\tleft: { align: 'center', justify: 'flex-start' },\n\tright: { align: 'center', justify: 'flex-end' },\n\tstretch: { align: 'stretch' },\n\ttop: { align: 'flex-start', justify: 'center' },\n\ttopLeft: { align: 'flex-start', justify: 'flex-start' },\n\ttopRight: { align: 'flex-start', justify: 'flex-end' },\n};\n\n/** @type {import('./types').Alignments} */\nconst V_ALIGNMENTS = {\n\tbottom: { justify: 'flex-end', align: 'center' },\n\tbottomLeft: { justify: 'flex-start', align: 'flex-end' },\n\tbottomRight: { justify: 'flex-end', align: 'flex-end' },\n\tcenter: { justify: 'center', align: 'center' },\n\tedge: { justify: 'space-between', align: 'center' },\n\tleft: { justify: 'center', align: 'flex-start' },\n\tright: { justify: 'center', align: 'flex-end' },\n\tstretch: { justify: 'stretch' },\n\ttop: { justify: 'flex-start', align: 'center' },\n\ttopLeft: { justify: 'flex-start', align: 'flex-start' },\n\ttopRight: { justify: 'flex-start', align: 'flex-end' },\n};\n\n/* eslint-disable jsdoc/valid-types */\n/**\n * @param {import('./types').HStackAlignment | import('react').CSSProperties[ 'alignItems' ]} alignment Where to align.\n * @param {import('../flex/types').FlexDirection} [direction='row'] Direction to align.\n * @return {import('./types').AlignmentProps} Alignment props.\n */\n/* eslint-enable jsdoc/valid-types */\nexport function getAlignmentProps( alignment, direction = 'row' ) {\n\tif ( ! isValueDefined( alignment ) ) {\n\t\treturn {};\n\t}\n\tconst isVertical = direction === 'column';\n\tconst props = isVertical ? V_ALIGNMENTS : ALIGNMENTS;\n\n\tconst alignmentProps =\n\t\talignment in props\n\t\t\t? props[ /** @type {keyof typeof ALIGNMENTS} */ ( alignment ) ]\n\t\t\t: { align: alignment };\n\n\treturn alignmentProps;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/heading/component.tsx"],"names":["UnconnectedHeading","props","forwardedRef","headerProps","Heading"],"mappings":";;;;;;;;;;;;;AAQA;;AACA;;AACA;;AAVA;AACA;AACA;;AAGA;AACA;AACA;
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/heading/component.tsx"],"names":["UnconnectedHeading","props","forwardedRef","headerProps","Heading"],"mappings":";;;;;;;;;;;;;AAQA;;AACA;;AACA;;AAVA;AACA;AACA;;AAGA;AACA;AACA;AAMA,SAASA,kBAAT,CACCC,KADD,EAECC,YAFD,EAGE;AACD,QAAMC,WAAW,GAAG,sBAAYF,KAAZ,CAApB;AAEA,SAAO,4BAAC,UAAD,6BAAWE,WAAX;AAAyB,IAAA,GAAG,EAAGD;AAA/B,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAME,OAAO,GAAG,6BAAgBJ,kBAAhB,EAAoC,SAApC,CAAhB;;eAEQI,O","sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * Internal dependencies\n */\nimport { contextConnect, WordPressComponentProps } from '../ui/context';\nimport { View } from '../view';\nimport { useHeading } from './hook';\nimport type { HeadingProps } from './types';\n\nfunction UnconnectedHeading(\n\tprops: WordPressComponentProps< HeadingProps, 'h1' >,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst headerProps = useHeading( props );\n\n\treturn <View { ...headerProps } ref={ forwardedRef } />;\n}\n\n/**\n * `Heading` renders headings and titles using the library's typography system.\n *\n * ```jsx\n * import { __experimentalHeading as Heading } from \"@wordpress/components\";\n *\n * function Example() {\n * return <Heading>Code is Poetry</Heading>;\n * }\n * ```\n */\nexport const Heading = contextConnect( UnconnectedHeading, 'Heading' );\n\nexport default Heading;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/heading/hook.ts"],"names":["useHeading","props","as","asProp","level","otherProps","a11yProps","role","parseInt","textProps","color","COLORS","gray","size","isBlock","weight","CONFIG","fontWeightHeading"],"mappings":";;;;;;;AAGA;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/heading/hook.ts"],"names":["useHeading","props","as","asProp","level","otherProps","a11yProps","role","parseInt","textProps","color","COLORS","gray","size","isBlock","weight","CONFIG","fontWeightHeading"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AACA;;AANA;AACA;AACA;AAOO,SAASA,UAAT,CACNC,KADM,EAEL;AACD,QAAM;AACLC,IAAAA,EAAE,EAAEC,MADC;AAELC,IAAAA,KAAK,GAAG,CAFH;AAGL,OAAGC;AAHE,MAIF,+BAAkBJ,KAAlB,EAAyB,SAAzB,CAJJ;AAMA,QAAMC,EAAE,GAAKC,MAAM,IAAK,IAAIC,KAAO,EAAnC;AAEA,QAAME,SAGL,GAAG,EAHJ;;AAIA,MAAK,OAAOJ,EAAP,KAAc,QAAd,IAA0BA,EAAE,CAAE,CAAF,CAAF,KAAY,GAA3C,EAAiD;AAChD;AACAI,IAAAA,SAAS,CAACC,IAAV,GAAiB,SAAjB;AACAD,IAAAA,SAAS,CAAE,YAAF,CAAT,GACC,OAAOF,KAAP,KAAiB,QAAjB,GAA4BI,QAAQ,CAAEJ,KAAF,CAApC,GAAgDA,KADjD;AAEA;;AAED,QAAMK,SAAS,GAAG,mBAAS;AAC1BC,IAAAA,KAAK,EAAEC,cAAOC,IAAP,CAAa,GAAb,CADmB;AAE1BC,IAAAA,IAAI,EAAE,kCAAoBT,KAApB,CAFoB;AAG1BU,IAAAA,OAAO,EAAE,IAHiB;AAI1BC,IAAAA,MAAM,EAAEC,cAAOC,iBAJW;AAK1B,OAAGZ;AALuB,GAAT,CAAlB;AAQA,SAAO,EAAE,GAAGI,SAAL;AAAgB,OAAGH,SAAnB;AAA8BJ,IAAAA;AAA9B,GAAP;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport { useContextSystem, WordPressComponentProps } from '../ui/context';\nimport { useText } from '../text';\nimport { getHeadingFontSize } from '../ui/utils/font-size';\nimport { CONFIG, COLORS } from '../utils';\nimport type { HeadingProps } from './types';\n\nexport function useHeading(\n\tprops: WordPressComponentProps< HeadingProps, 'h1' >\n) {\n\tconst {\n\t\tas: asProp,\n\t\tlevel = 2,\n\t\t...otherProps\n\t} = useContextSystem( props, 'Heading' );\n\n\tconst as = ( asProp || `h${ level }` ) as keyof JSX.IntrinsicElements;\n\n\tconst a11yProps: {\n\t\trole?: string;\n\t\t'aria-level'?: number;\n\t} = {};\n\tif ( typeof as === 'string' && as[ 0 ] !== 'h' ) {\n\t\t// If not a semantic `h` element, add a11y props:\n\t\ta11yProps.role = 'heading';\n\t\ta11yProps[ 'aria-level' ] =\n\t\t\ttypeof level === 'string' ? parseInt( level ) : level;\n\t}\n\n\tconst textProps = useText( {\n\t\tcolor: COLORS.gray[ 900 ],\n\t\tsize: getHeadingFontSize( level ),\n\t\tisBlock: true,\n\t\tweight: CONFIG.fontWeightHeading as import('react').CSSProperties[ 'fontWeight' ],\n\t\t...otherProps,\n\t} );\n\n\treturn { ...textProps, ...a11yProps, as };\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/higher-order/navigate-regions/index.js"],"names":["defaultShortcuts","previous","modifier","character","next","useNavigateRegions","shortcuts","ref","isFocusingRegions","setIsFocusingRegions","focusRegion","offset","regions","Array","from","current","querySelectorAll","length","nextRegion","selectedIndex","indexOf","ownerDocument","activeElement","nextIndex","focus","clickRef","element","onClick","addEventListener","removeEventListener","className","onKeyDown","event","some","isKeyboardEvent","Component","props"],"mappings":";;;;;;;;AAGA;;AACA;;AAKA;;AATA;AACA;AACA;AASA,MAAMA,gBAAgB,GAAG;AACxBC,EAAAA,QAAQ,EAAE,CACT;AACCC,IAAAA,QAAQ,EAAE,WADX;AAECC,IAAAA,SAAS,EAAE;AAFZ,GADS,EAKT;AACCD,IAAAA,QAAQ,EAAE,QADX;AAECC,IAAAA,SAAS,EAAE;AAFZ,GALS,CADc;AAWxBC,EAAAA,IAAI,EAAE,CACL;AACCF,IAAAA,QAAQ,EAAE,MADX;AAECC,IAAAA,SAAS,EAAE;AAFZ,GADK,EAKL;AACCD,IAAAA,QAAQ,EAAE,QADX;AAECC,IAAAA,SAAS,EAAE;AAFZ,GALK;AAXkB,CAAzB;;AAuBO,SAASE,kBAAT,GAA4D;AAAA,MAA/BC,SAA+B,uEAAnBN,gBAAmB;AAClE,QAAMO,GAAG,GAAG,sBAAZ;AACA,QAAM,CAAEC,iBAAF,EAAqBC,oBAArB,IAA8C,uBAAU,KAAV,CAApD;;AAEA,WAASC,WAAT,CAAsBC,MAAtB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D;;AAGNuB,IAAAA,SAAS,CAAEC,KAAF,EAAU;AAClB,UACC1B,SAAS,CAACL,QAAV,CAAmBgC,IAAnB,CAAyB,QAA+B;AAAA,YAA7B;AAAE/B,UAAAA,QAAF;AAAYC,UAAAA;AAAZ,SAA6B;AACvD,eAAO+B,0BAAiBhC,QAAjB,EAA6B8B,KAA7B,EAAoC7B,SAApC,CAAP;AACA,OAFD,CADD,EAIE;AACDO,QAAAA,WAAW,CAAE,CAAC,CAAH,CAAX;AACA,OAND,MAMO,IACNJ,SAAS,CAACF,IAAV,CAAe6B,IAAf,CAAqB,SAA+B;AAAA,YAA7B;AAAE/B,UAAAA,QAAF;AAAYC,UAAAA;AAAZ,SAA6B;AACnD,eAAO+B,0BAAiBhC,QAAjB,EAA6B8B,KAA7B,EAAoC7B,SAApC,CAAP;AACA,OAFD,CADM,EAIL;AACDO,QAAAA,WAAW,CAAE,CAAF,CAAX;AACA;AACD;;AAjBK,GAAP;AAmBA;;eAEc,yCACZyB,SAAF,
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/higher-order/navigate-regions/index.js"],"names":["defaultShortcuts","previous","modifier","character","next","useNavigateRegions","shortcuts","ref","isFocusingRegions","setIsFocusingRegions","focusRegion","offset","regions","Array","from","current","querySelectorAll","length","nextRegion","selectedIndex","indexOf","ownerDocument","activeElement","nextIndex","focus","clickRef","element","onClick","addEventListener","removeEventListener","className","onKeyDown","event","some","isKeyboardEvent","Component","props"],"mappings":";;;;;;;;AAGA;;AACA;;AAKA;;AATA;AACA;AACA;AASA,MAAMA,gBAAgB,GAAG;AACxBC,EAAAA,QAAQ,EAAE,CACT;AACCC,IAAAA,QAAQ,EAAE,WADX;AAECC,IAAAA,SAAS,EAAE;AAFZ,GADS,EAKT;AACCD,IAAAA,QAAQ,EAAE,QADX;AAECC,IAAAA,SAAS,EAAE;AAFZ,GALS,CADc;AAWxBC,EAAAA,IAAI,EAAE,CACL;AACCF,IAAAA,QAAQ,EAAE,MADX;AAECC,IA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gBAAR,CAA0B,OAA1B,EAAmCD,OAAnC;AAEA,WAAO,MAAM;AACZD,MAAAA,OAAO,CAACG,mBAAR,CAA6B,OAA7B,EAAsCF,OAAtC;AACA,KAFD;AAGA,GAXe,EAYhB,CAAElB,oBAAF,CAZgB,CAAjB;AAeA,SAAO;AACNF,IAAAA,GAAG,EAAE,2BAAc,CAAEA,GAAF,EAAOkB,QAAP,CAAd,CADC;AAENK,IAAAA,SAAS,EAAEtB,iBAAiB,GAAG,qBAAH,GAA2B,EAFjD;;AAGNuB,IAAAA,SAAS,CAAEC,KAAF,EAAU;AAClB,UACC1B,SAAS,CAACL,QAAV,CAAmBgC,IAAnB,CAAyB,QAA+B;AAAA,YAA7B;AAAE/B,UAAAA,QAAF;AAAYC,UAAAA;AAAZ,SAA6B;AACvD,eAAO+B,0BAAiBhC,QAAjB,EAA6B8B,KAA7B,EAAoC7B,SAApC,CAAP;AACA,OAFD,CADD,EAIE;AACDO,QAAAA,WAAW,CAAE,CAAC,CAAH,CAAX;AACA,OAND,MAMO,IACNJ,SAAS,CAACF,IAAV,CAAe6B,IAAf,CAAqB,SAA+B;AAAA,YAA7B;AAAE/B,UAAAA,QAAF;AAAYC,UAAAA;AAAZ,SAA6B;AACnD,eAAO+B,0BAAiBhC,QAAjB,EAA6B8B,KAA7B,EAAoC7B,SAApC,CAAP;AACA,OAFD,CADM,EAIL;AACDO,QAAAA,WAAW,CAAE,CAAF,CAAX;AACA;AACD;;AAjBK,GAAP;AAmBA;;eAEc,yCACZyB,SAAF,IACC;AAAA,MAAE;AAAE7B,IAAAA,SAAF;AAAa,OAAG8B;AAAhB,GAAF;AAAA,SAEE,mCAAU/B,kBAAkB,CAAEC,SAAF,CAA5B,EACC,4BAAC,SAAD,EAAgB8B,KAAhB,CADD,CAFF;AAAA,CAFa,EAQd,iBARc,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useRef } from '@wordpress/element';\nimport {\n\tcreateHigherOrderComponent,\n\tuseRefEffect,\n\tuseMergeRefs,\n} from '@wordpress/compose';\nimport { isKeyboardEvent } from '@wordpress/keycodes';\n\nconst defaultShortcuts = {\n\tprevious: [\n\t\t{\n\t\t\tmodifier: 'ctrlShift',\n\t\t\tcharacter: '`',\n\t\t},\n\t\t{\n\t\t\tmodifier: 'access',\n\t\t\tcharacter: 'p',\n\t\t},\n\t],\n\tnext: [\n\t\t{\n\t\t\tmodifier: 'ctrl',\n\t\t\tcharacter: '`',\n\t\t},\n\t\t{\n\t\t\tmodifier: 'access',\n\t\t\tcharacter: 'n',\n\t\t},\n\t],\n};\n\nexport function useNavigateRegions( shortcuts = defaultShortcuts ) {\n\tconst ref = useRef();\n\tconst [ isFocusingRegions, setIsFocusingRegions ] = useState( false );\n\n\tfunction focusRegion( offset ) {\n\t\tconst regions = Array.from(\n\t\t\tref.current.querySelectorAll( '[role=\"region\"]' )\n\t\t);\n\t\tif ( ! regions.length ) {\n\t\t\treturn;\n\t\t}\n\t\tlet nextRegion = regions[ 0 ];\n\t\tconst selectedIndex = regions.indexOf(\n\t\t\tref.current.ownerDocument.activeElement\n\t\t);\n\t\tif ( selectedIndex !== -1 ) {\n\t\t\tlet nextIndex = selectedIndex + offset;\n\t\t\tnextIndex = nextIndex === -1 ? regions.length - 1 : nextIndex;\n\t\t\tnextIndex = nextIndex === regions.length ? 0 : nextIndex;\n\t\t\tnextRegion = regions[ nextIndex ];\n\t\t}\n\n\t\tnextRegion.focus();\n\t\tsetIsFocusingRegions( true );\n\t}\n\n\tconst clickRef = useRefEffect(\n\t\t( element ) => {\n\t\t\tfunction onClick() {\n\t\t\t\tsetIsFocusingRegions( false );\n\t\t\t}\n\n\t\t\telement.addEventListener( 'click', onClick );\n\n\t\t\treturn () => {\n\t\t\t\telement.removeEventListener( 'click', onClick );\n\t\t\t};\n\t\t},\n\t\t[ setIsFocusingRegions ]\n\t);\n\n\treturn {\n\t\tref: useMergeRefs( [ ref, clickRef ] ),\n\t\tclassName: isFocusingRegions ? 'is-focusing-regions' : '',\n\t\tonKeyDown( event ) {\n\t\t\tif (\n\t\t\t\tshortcuts.previous.some( ( { modifier, character } ) => {\n\t\t\t\t\treturn isKeyboardEvent[ modifier ]( event, character );\n\t\t\t\t} )\n\t\t\t) {\n\t\t\t\tfocusRegion( -1 );\n\t\t\t} else if (\n\t\t\t\tshortcuts.next.some( ( { modifier, character } ) => {\n\t\t\t\t\treturn isKeyboardEvent[ modifier ]( event, character );\n\t\t\t\t} )\n\t\t\t) {\n\t\t\t\tfocusRegion( 1 );\n\t\t\t}\n\t\t},\n\t};\n}\n\nexport default createHigherOrderComponent(\n\t( Component ) =>\n\t\t( { shortcuts, ...props } ) =>\n\t\t\t(\n\t\t\t\t<div { ...useNavigateRegions( shortcuts ) }>\n\t\t\t\t\t<Component { ...props } />\n\t\t\t\t</div>\n\t\t\t),\n\t'navigateRegions'\n);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/higher-order/with-focus-return/index.js"],"names":["isComponentLike","object","Component","options","HoC","onFocusReturn","WrappedComponent","WithFocusReturn","props","ref","Provider","children","since","hint"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AALA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,eAAT,CAA0BC,MAA1B,EAAmC;AAClC,SAAOA,MAAM,YAAYC,kBAAlB,IAA+B,OAAOD,MAAP,KAAkB,UAAxD;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;eACe,yCAA8BE,OAAF,IAAe;AACzD,QAAMC,GAAG,
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/higher-order/with-focus-return/index.js"],"names":["isComponentLike","object","Component","options","HoC","onFocusReturn","WrappedComponent","WithFocusReturn","props","ref","Provider","children","since","hint"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AALA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,eAAT,CAA0BC,MAA1B,EAAmC;AAClC,SAAOA,MAAM,YAAYC,kBAAlB,IAA+B,OAAOD,MAAP,KAAkB,UAAxD;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;eACe,yCAA8BE,OAAF,IAAe;AACzD,QAAMC,GAAG,GACR;AAAA,QAAE;AAAEC,MAAAA;AAAF,KAAF,uEAAsB,EAAtB;AAAA,WACEC,gBAAF,IAAwB;AACvB,YAAMC,eAAe,GAAKC,KAAF,IAAa;AACpC,cAAMC,GAAG,GAAG,6BAAgBJ,aAAhB,CAAZ;AACA,eACC;AAAK,UAAA,GAAG,EAAGI;AAAX,WACC,4BAAC,gBAAD,EAAuBD,KAAvB,CADD,CADD;AAKA,OAPD;;AASA,aAAOD,eAAP;AACA,KAZD;AAAA,GADD;;AAeA,MAAKP,eAAe,CAAEG,OAAF,CAApB,EAAkC;AACjC,UAAMG,gBAAgB,GAAGH,OAAzB;AACA,WAAOC,GAAG,GAAIE,gBAAJ,CAAV;AACA;;AAED,SAAOF,GAAG,CAAED,OAAF,CAAV;AACA,CAtBc,EAsBZ,iBAtBY,C;;;;AAwBR,MAAMO,QAAQ,GAAG,QAAoB;AAAA,MAAlB;AAAEC,IAAAA;AAAF,GAAkB;AAC3C,2BAAY,6CAAZ,EAA2D;AAC1DC,IAAAA,KAAK,EAAE,KADmD;AAE1DC,IAAAA,IAAI,EAAE;AAFoD,GAA3D;AAKA,SAAOF,QAAP;AACA,CAPM","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { createHigherOrderComponent, useFocusReturn } from '@wordpress/compose';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Returns true if the given object is component-like. An object is component-\n * like if it is an instance of wp.element.Component, or is a function.\n *\n * @param {*} object Object to test.\n *\n * @return {boolean} Whether object is component-like.\n */\nfunction isComponentLike( object ) {\n\treturn object instanceof Component || typeof object === 'function';\n}\n\n/**\n * Higher Order Component used to be used to wrap disposable elements like\n * sidebars, modals, dropdowns. When mounting the wrapped component, we track a\n * reference to the current active element so we know where to restore focus\n * when the component is unmounted.\n *\n * @param {(WPComponent|Object)} options The component to be enhanced with\n * focus return behavior, or an object\n * describing the component and the\n * focus return characteristics.\n *\n * @return {Function} Higher Order Component with the focus restauration behaviour.\n */\nexport default createHigherOrderComponent( ( options ) => {\n\tconst HoC =\n\t\t( { onFocusReturn } = {} ) =>\n\t\t( WrappedComponent ) => {\n\t\t\tconst WithFocusReturn = ( props ) => {\n\t\t\t\tconst ref = useFocusReturn( onFocusReturn );\n\t\t\t\treturn (\n\t\t\t\t\t<div ref={ ref }>\n\t\t\t\t\t\t<WrappedComponent { ...props } />\n\t\t\t\t\t</div>\n\t\t\t\t);\n\t\t\t};\n\n\t\t\treturn WithFocusReturn;\n\t\t};\n\n\tif ( isComponentLike( options ) ) {\n\t\tconst WrappedComponent = options;\n\t\treturn HoC()( WrappedComponent );\n\t}\n\n\treturn HoC( options );\n}, 'withFocusReturn' );\n\nexport const Provider = ( { children } ) => {\n\tdeprecated( 'wp.components.FocusReturnProvider component', {\n\t\tsince: '5.7',\n\t\thint: 'This provider is not used anymore. You can just remove it from your codebase',\n\t} );\n\n\treturn children;\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/higher-order/with-spoken-messages/index.js"],"names":["Component","props","speak"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;eACe,yCACZA,SAAF,IAAmBC,KAAF,
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/higher-order/with-spoken-messages/index.js"],"names":["Component","props","speak"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;eACe,yCACZA,SAAF,IAAmBC,KAAF,IAEf,4BAAC,SAAD,6BACMA,KADN;AAEC,EAAA,KAAK,EAAGC,WAFT;AAGC,EAAA,cAAc,EAAG,0BAAaA,WAAb,EAAoB,GAApB;AAHlB,GAHY,EASd,oBATc,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent, useDebounce } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * A Higher Order Component used to be provide speak and debounced speak\n * functions.\n *\n * @see https://developer.wordpress.org/block-editor/packages/packages-a11y/#speak\n *\n * @param {WPComponent} Component The component to be wrapped.\n *\n * @return {WPComponent} The wrapped component.\n */\nexport default createHigherOrderComponent(\n\t( Component ) => ( props ) =>\n\t\t(\n\t\t\t<Component\n\t\t\t\t{ ...props }\n\t\t\t\tspeak={ speak }\n\t\t\t\tdebouncedSpeak={ useDebounce( speak, 500 ) }\n\t\t\t/>\n\t\t),\n\t'withSpokenMessages'\n);\n"]}
|
package/build/icon/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/icon/index.tsx"],"names":["Icon","icon","size","additionalProps","Dashicon","type","prototype","Component","SVG","appliedProps","width","height","props"],"mappings":";;;;;;;;;;;AAQA;;AAMA;;AAKA;;AAnBA;AACA;AACA;;AAGA;AACA;AACA;;AASA;AACA;AACA;AA8BA,SAASA,IAAT,OAIgB;AAAA,MAJI;AACnBC,IAAAA,IAAI,GAAG,IADY;AAEnBC,IAAAA,IAAI,GAAG,EAFY;AAGnB,OAAGC;AAHgB,GAIJ;;AACf,MAAK,aAAa,OAAOF,IAAzB,EAAgC;AAC/B,WACC,4BAAC,iBAAD;AACC,MAAA,IAAI,EAAGA;AADR,OAEQE,eAFR,EADD;AAMA;;AAED,MAAK,6BAAgBF,IAAhB,KAA0BG,sBAAaH,IAAI,CAACI,IAAjD,EAAwD;AACvD,WAAO,2BAAcJ,IAAd,EAAoB,EAC1B,GAAGE;AADuB,KAApB,CAAP;AAGA;;AAED,MAAK,eAAe,OAAOF,IAA3B,EAAkC;AACjC,QAAKA,IAAI,CAACK,SAAL,YAA0BC,kBAA/B,EAA2C;AAC1C,aAAO,4BAAeN,IAAf,
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/icon/index.tsx"],"names":["Icon","icon","size","additionalProps","Dashicon","type","prototype","Component","SVG","appliedProps","width","height","props"],"mappings":";;;;;;;;;;;AAQA;;AAMA;;AAKA;;AAnBA;AACA;AACA;;AAGA;AACA;AACA;;AASA;AACA;AACA;AA8BA,SAASA,IAAT,OAIgB;AAAA,MAJI;AACnBC,IAAAA,IAAI,GAAG,IADY;AAEnBC,IAAAA,IAAI,GAAG,EAFY;AAGnB,OAAGC;AAHgB,GAIJ;;AACf,MAAK,aAAa,OAAOF,IAAzB,EAAgC;AAC/B,WACC,4BAAC,iBAAD;AACC,MAAA,IAAI,EAAGA;AADR,OAEQE,eAFR,EADD;AAMA;;AAED,MAAK,6BAAgBF,IAAhB,KAA0BG,sBAAaH,IAAI,CAACI,IAAjD,EAAwD;AACvD,WAAO,2BAAcJ,IAAd,EAAoB,EAC1B,GAAGE;AADuB,KAApB,CAAP;AAGA;;AAED,MAAK,eAAe,OAAOF,IAA3B,EAAkC;AACjC,QAAKA,IAAI,CAACK,SAAL,YAA0BC,kBAA/B,EAA2C;AAC1C,aAAO,4BAAeN,IAAf,EAAqB;AAC3BC,QAAAA,IAD2B;AAE3B,WAAGC;AAFwB,OAArB,CAAP;AAIA;;AAED,WAASF,IAAF,CAA+C;AACrDC,MAAAA,IADqD;AAErD,SAAGC;AAFkD,KAA/C,CAAP;AAIA;;AAED,MAAKF,IAAI,KAAMA,IAAI,CAACI,IAAL,KAAc,KAAd,IAAuBJ,IAAI,CAACI,IAAL,KAAcG,eAA3C,CAAT,EAA4D;AAC3D,UAAMC,YAAY,GAAG;AACpBC,MAAAA,KAAK,EAAER,IADa;AAEpBS,MAAAA,MAAM,EAAET,IAFY;AAGpB,SAAGD,IAAI,CAACW,KAHY;AAIpB,SAAGT;AAJiB,KAArB;AAOA,WAAO,4BAAC,eAAD,EAAUM,YAAV,CAAP;AACA;;AAED,MAAK,6BAAgBR,IAAhB,CAAL,EAA8B;AAC7B,WAAO,2BAAcA,IAAd,EAAoB;AAC1B;AACAC,MAAAA,IAF0B;AAG1B,SAAGC;AAHuB,KAApB,CAAP;AAKA;;AAED,SAAOF,IAAP;AACA;;eAEcD,I","sourcesContent":["/**\n * External dependencies\n */\nimport type { ComponentType, HTMLProps, SVGProps } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tcloneElement,\n\tcreateElement,\n\tComponent,\n\tisValidElement,\n} from '@wordpress/element';\nimport { SVG } from '@wordpress/primitives';\n\n/**\n * Internal dependencies\n */\nimport Dashicon from '../dashicon';\nimport type { IconKey as DashiconIconKey } from '../dashicon/types';\n\ntype IconType< P > = DashiconIconKey | ComponentType< P > | JSX.Element;\n\ninterface BaseProps< P > {\n\t/**\n\t * The icon to render. Supported values are: Dashicons (specified as\n\t * strings), functions, Component instances and `null`.\n\t *\n\t * @default null\n\t */\n\ticon?: IconType< P > | null;\n\t/**\n\t * The size (width and height) of the icon.\n\t *\n\t * @default 24\n\t */\n\tsize?: number;\n}\n\ntype AdditionalProps< T > = T extends ComponentType< infer U >\n\t? U\n\t: T extends DashiconIconKey\n\t? SVGProps< SVGSVGElement >\n\t: {};\n\nexport type Props< P > = BaseProps< P > & AdditionalProps< IconType< P > >;\n\nfunction Icon< P >( {\n\ticon = null,\n\tsize = 24,\n\t...additionalProps\n}: Props< P > ) {\n\tif ( 'string' === typeof icon ) {\n\t\treturn (\n\t\t\t<Dashicon\n\t\t\t\ticon={ icon }\n\t\t\t\t{ ...( additionalProps as HTMLProps< HTMLSpanElement > ) }\n\t\t\t/>\n\t\t);\n\t}\n\n\tif ( isValidElement( icon ) && Dashicon === icon.type ) {\n\t\treturn cloneElement( icon, {\n\t\t\t...additionalProps,\n\t\t} );\n\t}\n\n\tif ( 'function' === typeof icon ) {\n\t\tif ( icon.prototype instanceof Component ) {\n\t\t\treturn createElement( icon, {\n\t\t\t\tsize,\n\t\t\t\t...additionalProps,\n\t\t\t} as unknown as P );\n\t\t}\n\n\t\treturn ( icon as ( ...args: any[] ) => JSX.Element )( {\n\t\t\tsize,\n\t\t\t...additionalProps,\n\t\t} );\n\t}\n\n\tif ( icon && ( icon.type === 'svg' || icon.type === SVG ) ) {\n\t\tconst appliedProps = {\n\t\t\twidth: size,\n\t\t\theight: size,\n\t\t\t...icon.props,\n\t\t\t...additionalProps,\n\t\t};\n\n\t\treturn <SVG { ...appliedProps } />;\n\t}\n\n\tif ( isValidElement( icon ) ) {\n\t\treturn cloneElement( icon, {\n\t\t\t// @ts-ignore Just forwarding the size prop along\n\t\t\tsize,\n\t\t\t...additionalProps,\n\t\t} );\n\t}\n\n\treturn icon;\n}\n\nexport default Icon;\n"]}
|
|
@@ -13,8 +13,6 @@ var _element = require("@wordpress/element");
|
|
|
13
13
|
|
|
14
14
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
15
15
|
|
|
16
|
-
var _lodash = require("lodash");
|
|
17
|
-
|
|
18
16
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
19
17
|
|
|
20
18
|
var _compose = require("@wordpress/compose");
|
|
@@ -23,6 +21,8 @@ var _inputBase = _interopRequireDefault(require("./input-base"));
|
|
|
23
21
|
|
|
24
22
|
var _inputField = _interopRequireDefault(require("./input-field"));
|
|
25
23
|
|
|
24
|
+
var _utils = require("./utils");
|
|
25
|
+
|
|
26
26
|
/**
|
|
27
27
|
* External dependencies
|
|
28
28
|
*/
|
|
@@ -34,6 +34,8 @@ var _inputField = _interopRequireDefault(require("./input-field"));
|
|
|
34
34
|
/**
|
|
35
35
|
* Internal dependencies
|
|
36
36
|
*/
|
|
37
|
+
const noop = () => {};
|
|
38
|
+
|
|
37
39
|
function useUniqueId(idProp) {
|
|
38
40
|
const instanceId = (0, _compose.useInstanceId)(InputControl);
|
|
39
41
|
const id = `inspector-input-control-${instanceId}`;
|
|
@@ -51,9 +53,9 @@ function UnforwardedInputControl(_ref, ref) {
|
|
|
51
53
|
isPressEnterToChange = false,
|
|
52
54
|
label,
|
|
53
55
|
labelPosition = 'top',
|
|
54
|
-
onChange =
|
|
55
|
-
onValidate =
|
|
56
|
-
onKeyDown =
|
|
56
|
+
onChange = noop,
|
|
57
|
+
onValidate = noop,
|
|
58
|
+
onKeyDown = noop,
|
|
57
59
|
prefix,
|
|
58
60
|
size = 'default',
|
|
59
61
|
suffix,
|
|
@@ -63,6 +65,11 @@ function UnforwardedInputControl(_ref, ref) {
|
|
|
63
65
|
const [isFocused, setIsFocused] = (0, _element.useState)(false);
|
|
64
66
|
const id = useUniqueId(idProp);
|
|
65
67
|
const classes = (0, _classnames.default)('components-input-control', className);
|
|
68
|
+
const draftHookProps = (0, _utils.useDraft)({
|
|
69
|
+
value,
|
|
70
|
+
onBlur: props.onBlur,
|
|
71
|
+
onChange
|
|
72
|
+
});
|
|
66
73
|
return (0, _element.createElement)(_inputBase.default, {
|
|
67
74
|
__unstableInputWidth: __unstableInputWidth,
|
|
68
75
|
className: classes,
|
|
@@ -83,15 +90,13 @@ function UnforwardedInputControl(_ref, ref) {
|
|
|
83
90
|
id: id,
|
|
84
91
|
isFocused: isFocused,
|
|
85
92
|
isPressEnterToChange: isPressEnterToChange,
|
|
86
|
-
onChange: onChange,
|
|
87
93
|
onKeyDown: onKeyDown,
|
|
88
94
|
onValidate: onValidate,
|
|
89
95
|
ref: ref,
|
|
90
96
|
setIsFocused: setIsFocused,
|
|
91
97
|
size: size,
|
|
92
|
-
stateReducer: stateReducer
|
|
93
|
-
|
|
94
|
-
})));
|
|
98
|
+
stateReducer: stateReducer
|
|
99
|
+
}, draftHookProps)));
|
|
95
100
|
}
|
|
96
101
|
/**
|
|
97
102
|
* InputControl components let users enter and edit text. This is an experimental component
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/input-control/index.tsx"],"names":["useUniqueId","idProp","instanceId","InputControl","id","UnforwardedInputControl","ref","__unstableStateReducer","stateReducer","state","__unstableInputWidth","className","disabled","hideLabelFromVision","isPressEnterToChange","label","labelPosition","onChange","
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/input-control/index.tsx"],"names":["noop","useUniqueId","idProp","instanceId","InputControl","id","UnforwardedInputControl","ref","__unstableStateReducer","stateReducer","state","__unstableInputWidth","className","disabled","hideLabelFromVision","isPressEnterToChange","label","labelPosition","onChange","onValidate","onKeyDown","prefix","size","suffix","value","props","isFocused","setIsFocused","classes","draftHookProps","onBlur"],"mappings":";;;;;;;;;;;AAUA;;;;AAPA;;AAMA;;AAMA;;AACA;;AAEA;;AAlBA;AACA;AACA;;AAIA;AACA;AACA;;AAIA;AACA;AACA;AAMA,MAAMA,IAAI,GAAG,MAAM,CAAE,CAArB;;AAEA,SAASC,WAAT,CAAsBC,MAAtB,EAAwC;AACvC,QAAMC,UAAU,GAAG,4BAAeC,YAAf,CAAnB;AACA,QAAMC,EAAE,GAAI,2BAA2BF,UAAY,EAAnD;AAEA,SAAOD,MAAM,IAAIG,EAAjB;AACA;;AAEM,SAASC,uBAAT,OAoBNC,GApBM,EAqBL;AAAA,MApBD;AACCC,IAAAA,sBAAsB,EAAEC,YAAY,GAAKC,KAAF,IAAaA,KADrD;AAECC,IAAAA,oBAFD;AAGCC,IAAAA,SAHD;AAICC,IAAAA,QAAQ,GAAG,KAJZ;AAKCC,IAAAA,mBAAmB,GAAG,KALvB;AAMCT,IAAAA,EAAE,EAAEH,MANL;AAOCa,IAAAA,oBAAoB,GAAG,KAPxB;AAQCC,IAAAA,KARD;AASCC,IAAAA,aAAa,GAAG,KATjB;AAUCC,IAAAA,QAAQ,GAAGlB,IAVZ;AAWCmB,IAAAA,UAAU,GAAGnB,IAXd;AAYCoB,IAAAA,SAAS,GAAGpB,IAZb;AAaCqB,IAAAA,MAbD;AAcCC,IAAAA,IAAI,GAAG,SAdR;AAeCC,IAAAA,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;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMzB,YAAY,GAAG,yBAAYE,uBAAZ,CAArB;;eAEQF,Y","sourcesContent":["/**\n * External dependencies\n */\nimport classNames from 'classnames';\nimport type { ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { useState, forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport InputBase from './input-base';\nimport InputField from './input-field';\nimport type { InputControlProps } from './types';\nimport { useDraft } from './utils';\n\nconst noop = () => {};\n\nfunction useUniqueId( idProp?: string ) {\n\tconst instanceId = useInstanceId( InputControl );\n\tconst id = `inspector-input-control-${ instanceId }`;\n\n\treturn idProp || id;\n}\n\nexport function UnforwardedInputControl(\n\t{\n\t\t__unstableStateReducer: stateReducer = ( state ) => state,\n\t\t__unstableInputWidth,\n\t\tclassName,\n\t\tdisabled = false,\n\t\thideLabelFromVision = false,\n\t\tid: idProp,\n\t\tisPressEnterToChange = false,\n\t\tlabel,\n\t\tlabelPosition = 'top',\n\t\tonChange = noop,\n\t\tonValidate = noop,\n\t\tonKeyDown = noop,\n\t\tprefix,\n\t\tsize = 'default',\n\t\tsuffix,\n\t\tvalue,\n\t\t...props\n\t}: InputControlProps,\n\tref: ForwardedRef< HTMLInputElement >\n) {\n\tconst [ isFocused, setIsFocused ] = useState( false );\n\n\tconst id = useUniqueId( idProp );\n\tconst classes = classNames( 'components-input-control', className );\n\n\tconst draftHookProps = useDraft( {\n\t\tvalue,\n\t\tonBlur: props.onBlur,\n\t\tonChange,\n\t} );\n\n\treturn (\n\t\t<InputBase\n\t\t\t__unstableInputWidth={ __unstableInputWidth }\n\t\t\tclassName={ classes }\n\t\t\tdisabled={ disabled }\n\t\t\tgap={ 3 }\n\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\tid={ id }\n\t\t\tisFocused={ isFocused }\n\t\t\tjustify=\"left\"\n\t\t\tlabel={ label }\n\t\t\tlabelPosition={ labelPosition }\n\t\t\tprefix={ prefix }\n\t\t\tsize={ size }\n\t\t\tsuffix={ suffix }\n\t\t>\n\t\t\t<InputField\n\t\t\t\t{ ...props }\n\t\t\t\tclassName=\"components-input-control__input\"\n\t\t\t\tdisabled={ disabled }\n\t\t\t\tid={ id }\n\t\t\t\tisFocused={ isFocused }\n\t\t\t\tisPressEnterToChange={ isPressEnterToChange }\n\t\t\t\tonKeyDown={ onKeyDown }\n\t\t\t\tonValidate={ onValidate }\n\t\t\t\tref={ ref }\n\t\t\t\tsetIsFocused={ setIsFocused }\n\t\t\t\tsize={ size }\n\t\t\t\tstateReducer={ stateReducer }\n\t\t\t\t{ ...draftHookProps }\n\t\t\t/>\n\t\t</InputBase>\n\t);\n}\n\n/**\n * InputControl components let users enter and edit text. This is an experimental component\n * intended to (in time) merge with or replace `TextControl`.\n *\n * ```jsx\n * import { __experimentalInputControl as InputControl } from '@wordpress/components';\n * import { useState } from '@wordpress/compose';\n *\n * const Example = () => {\n * const [ value, setValue ] = useState( '' );\n *\n * return (\n * \t<InputControl\n * \t\tvalue={ value }\n * \t\tonChange={ ( nextValue ) => setValue( nextValue ?? '' ) }\n * \t/>\n * );\n * };\n * ```\n */\nexport const InputControl = forwardRef( UnforwardedInputControl );\n\nexport default InputControl;\n"]}
|
|
@@ -11,8 +11,6 @@ var _element = require("@wordpress/element");
|
|
|
11
11
|
|
|
12
12
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
13
|
|
|
14
|
-
var _lodash = require("lodash");
|
|
15
|
-
|
|
16
14
|
var _react = require("@use-gesture/react");
|
|
17
15
|
|
|
18
16
|
var _utils = require("./utils");
|
|
@@ -21,8 +19,6 @@ var _inputControlStyles = require("./styles/input-control-styles");
|
|
|
21
19
|
|
|
22
20
|
var _reducer = require("./reducer/reducer");
|
|
23
21
|
|
|
24
|
-
var _utils2 = require("../utils");
|
|
25
|
-
|
|
26
22
|
/**
|
|
27
23
|
* External dependencies
|
|
28
24
|
*/
|
|
@@ -30,6 +26,8 @@ var _utils2 = require("../utils");
|
|
|
30
26
|
/**
|
|
31
27
|
* WordPress dependencies
|
|
32
28
|
*/
|
|
29
|
+
const noop = () => {};
|
|
30
|
+
|
|
33
31
|
function InputField(_ref, ref) {
|
|
34
32
|
let {
|
|
35
33
|
disabled = false,
|
|
@@ -39,14 +37,14 @@ function InputField(_ref, ref) {
|
|
|
39
37
|
isDragEnabled = false,
|
|
40
38
|
isFocused,
|
|
41
39
|
isPressEnterToChange = false,
|
|
42
|
-
onBlur =
|
|
43
|
-
onChange =
|
|
44
|
-
onDrag =
|
|
45
|
-
onDragEnd =
|
|
46
|
-
onDragStart =
|
|
47
|
-
onFocus =
|
|
48
|
-
onKeyDown =
|
|
49
|
-
onValidate =
|
|
40
|
+
onBlur = noop,
|
|
41
|
+
onChange = noop,
|
|
42
|
+
onDrag = noop,
|
|
43
|
+
onDragEnd = noop,
|
|
44
|
+
onDragStart = noop,
|
|
45
|
+
onFocus = noop,
|
|
46
|
+
onKeyDown = noop,
|
|
47
|
+
onValidate = noop,
|
|
50
48
|
size = 'default',
|
|
51
49
|
setIsFocused,
|
|
52
50
|
stateReducer = state => state,
|
|
@@ -72,37 +70,14 @@ function InputField(_ref, ref) {
|
|
|
72
70
|
isDragEnabled,
|
|
73
71
|
value: valueProp,
|
|
74
72
|
isPressEnterToChange
|
|
75
|
-
});
|
|
73
|
+
}, onChange);
|
|
76
74
|
const {
|
|
77
|
-
_event,
|
|
78
75
|
value,
|
|
79
76
|
isDragging,
|
|
80
77
|
isDirty
|
|
81
78
|
} = state;
|
|
82
79
|
const wasDirtyOnBlur = (0, _element.useRef)(false);
|
|
83
80
|
const dragCursor = (0, _utils.useDragCursor)(isDragging, dragDirection);
|
|
84
|
-
/*
|
|
85
|
-
* Handles synchronization of external and internal value state.
|
|
86
|
-
* If not focused and did not hold a dirty value[1] on blur
|
|
87
|
-
* updates the value from the props. Otherwise if not holding
|
|
88
|
-
* a dirty value[1] propagates the value and event through onChange.
|
|
89
|
-
* [1] value is only made dirty if isPressEnterToChange is true
|
|
90
|
-
*/
|
|
91
|
-
|
|
92
|
-
(0, _utils2.useUpdateEffect)(() => {
|
|
93
|
-
if (valueProp === value) {
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (!isFocused && !wasDirtyOnBlur.current) {
|
|
98
|
-
commit(valueProp, _event);
|
|
99
|
-
} else if (!isDirty) {
|
|
100
|
-
onChange(value, {
|
|
101
|
-
event: _event
|
|
102
|
-
});
|
|
103
|
-
wasDirtyOnBlur.current = false;
|
|
104
|
-
}
|
|
105
|
-
}, [value, isDirty, isFocused, valueProp]);
|
|
106
81
|
|
|
107
82
|
const handleOnBlur = event => {
|
|
108
83
|
onBlur(event);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/input-control/input-field.tsx"],"names":["InputField","ref","disabled","dragDirection","dragThreshold","id","isDragEnabled","isFocused","isPressEnterToChange","onBlur","noop","onChange","onDrag","onDragEnd","onDragStart","onFocus","onKeyDown","onValidate","size","setIsFocused","stateReducer","state","value","valueProp","type","props","change","commit","drag","dragEnd","dragStart","invalidate","pressDown","pressEnter","pressUp","reset","_event","isDragging","isDirty","wasDirtyOnBlur","dragCursor","current","event","handleOnBlur","target","validity","valid","handleOnCommit","handleOnFocus","handleOnChange","nextValue","currentTarget","err","handleOnKeyDown","key","preventDefault","dragGestureProps","dragProps","distance","dragging","stopPropagation","axis","threshold","enabled","pointer","capture","handleOnMouseDown","onMouseDown","ownerDocument","activeElement","focus","ForwardedComponent"],"mappings":";;;;;;;;;AAkBA;;;;AAfA;;AACA;;AAmBA;;AACA;;AACA;;AACA;;AA1BA;AACA;AACA;;AAaA;AACA;AACA;AAYA,SAASA,UAAT,OAwBCC,GAxBD,EAyBE;AAAA,MAxBD;AACCC,IAAAA,QAAQ,G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AHX;AAIC,IAAA,QAAQ,EAAGvD,QAJZ;AAKC,IAAA,UAAU,EAAGsC,UALd;AAMC,IAAA,UAAU,EAAGH,UANd;AAOC,IAAA,EAAE,EAAGhC,EAPN;AAQC,IAAA,MAAM,EAAGsC,YARV;AASC,IAAA,QAAQ,EAAGM,cATZ;AAUC,IAAA,OAAO,EAAGD,aAVX;AAWC,IAAA,SAAS,EAAGK,eAXb;AAYC,IAAA,WAAW,EAAGa,iBAZf;AAaC,IAAA,GAAG,EAAGjE,GAbP;AAcC,IAAA,SAAS,EAAGiB,IAdb;AAeC,IAAA,KAAK,EAAGI,KAfT;AAgBC,IAAA,IAAI,EAAGE;AAhBR,KADD;AAoBA;;AAED,MAAM+C,kBAAkB,GAAG,yBAAYvE,UAAZ,CAA3B;eAEeuE,kB","sourcesContent":["/**\n * External dependencies\n */\nimport { noop } from 'lodash';\nimport { useDrag } from '@use-gesture/react';\nimport type {\n\tSyntheticEvent,\n\tChangeEvent,\n\tKeyboardEvent,\n\tPointerEvent,\n\tFocusEvent,\n\tForwardedRef,\n\tMouseEvent,\n} from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef, useRef } from '@wordpress/element';\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../ui/context';\nimport { useDragCursor } from './utils';\nimport { Input } from './styles/input-control-styles';\nimport { useInputControlStateReducer } from './reducer/reducer';\nimport { useUpdateEffect } from '../utils';\nimport type { InputFieldProps } from './types';\n\nfunction InputField(\n\t{\n\t\tdisabled = false,\n\t\tdragDirection = 'n',\n\t\tdragThreshold = 10,\n\t\tid,\n\t\tisDragEnabled = false,\n\t\tisFocused,\n\t\tisPressEnterToChange = false,\n\t\tonBlur = noop,\n\t\tonChange = noop,\n\t\tonDrag = noop,\n\t\tonDragEnd = noop,\n\t\tonDragStart = noop,\n\t\tonFocus = noop,\n\t\tonKeyDown = noop,\n\t\tonValidate = noop,\n\t\tsize = 'default',\n\t\tsetIsFocused,\n\t\tstateReducer = ( state: any ) => state,\n\t\tvalue: valueProp,\n\t\ttype,\n\t\t...props\n\t}: WordPressComponentProps< InputFieldProps, 'input', false >,\n\tref: ForwardedRef< HTMLInputElement >\n) {\n\tconst {\n\t\t// State.\n\t\tstate,\n\t\t// Actions.\n\t\tchange,\n\t\tcommit,\n\t\tdrag,\n\t\tdragEnd,\n\t\tdragStart,\n\t\tinvalidate,\n\t\tpressDown,\n\t\tpressEnter,\n\t\tpressUp,\n\t\treset,\n\t} = useInputControlStateReducer( stateReducer, {\n\t\tisDragEnabled,\n\t\tvalue: valueProp,\n\t\tisPressEnterToChange,\n\t} );\n\n\tconst { _event, value, isDragging, isDirty } = state;\n\tconst wasDirtyOnBlur = useRef( false );\n\n\tconst dragCursor = useDragCursor( isDragging, dragDirection );\n\n\t/*\n\t * Handles synchronization of external and internal value state.\n\t * If not focused and did not hold a dirty value[1] on blur\n\t * updates the value from the props. Otherwise if not holding\n\t * a dirty value[1] propagates the value and event through onChange.\n\t * [1] value is only made dirty if isPressEnterToChange is true\n\t */\n\tuseUpdateEffect( () => {\n\t\tif ( valueProp === value ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( ! isFocused && ! wasDirtyOnBlur.current ) {\n\t\t\tcommit( valueProp, _event as SyntheticEvent );\n\t\t} else if ( ! isDirty ) {\n\t\t\tonChange( value, {\n\t\t\t\tevent: _event as\n\t\t\t\t\t| ChangeEvent< HTMLInputElement >\n\t\t\t\t\t| PointerEvent< HTMLInputElement >,\n\t\t\t} );\n\t\t\twasDirtyOnBlur.current = false;\n\t\t}\n\t}, [ value, isDirty, isFocused, valueProp ] );\n\n\tconst handleOnBlur = ( event: FocusEvent< HTMLInputElement > ) => {\n\t\tonBlur( event );\n\t\tsetIsFocused?.( false );\n\n\t\t/**\n\t\t * If isPressEnterToChange is set, this commits the value to\n\t\t * the onChange callback.\n\t\t */\n\t\tif ( isDirty || ! event.target.validity.valid ) {\n\t\t\twasDirtyOnBlur.current = true;\n\t\t\thandleOnCommit( event );\n\t\t}\n\t};\n\n\tconst handleOnFocus = ( event: FocusEvent< HTMLInputElement > ) => {\n\t\tonFocus( event );\n\t\tsetIsFocused?.( true );\n\t};\n\n\tconst handleOnChange = ( event: ChangeEvent< HTMLInputElement > ) => {\n\t\tconst nextValue = event.target.value;\n\t\tchange( nextValue, event );\n\t};\n\n\tconst handleOnCommit = ( event: SyntheticEvent< HTMLInputElement > ) => {\n\t\tconst nextValue = event.currentTarget.value;\n\n\t\ttry {\n\t\t\tonValidate( nextValue );\n\t\t\tcommit( nextValue, event );\n\t\t} catch ( err ) {\n\t\t\tinvalidate( err, event );\n\t\t}\n\t};\n\n\tconst handleOnKeyDown = ( event: KeyboardEvent< HTMLInputElement > ) => {\n\t\tconst { key } = event;\n\t\tonKeyDown( event );\n\n\t\tswitch ( key ) {\n\t\t\tcase 'ArrowUp':\n\t\t\t\tpressUp( event );\n\t\t\t\tbreak;\n\n\t\t\tcase 'ArrowDown':\n\t\t\t\tpressDown( event );\n\t\t\t\tbreak;\n\n\t\t\tcase 'Enter':\n\t\t\t\tpressEnter( event );\n\n\t\t\t\tif ( isPressEnterToChange ) {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\thandleOnCommit( event );\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase 'Escape':\n\t\t\t\tif ( isPressEnterToChange && isDirty ) {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\treset( valueProp, event );\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\t};\n\n\tconst dragGestureProps = useDrag< PointerEvent< HTMLInputElement > >(\n\t\t( dragProps ) => {\n\t\t\tconst { distance, dragging, event, target } = dragProps;\n\n\t\t\t// The `target` prop always references the `input` element while, by\n\t\t\t// default, the `dragProps.event.target` property would reference the real\n\t\t\t// event target (i.e. any DOM element that the pointer is hovering while\n\t\t\t// dragging). Ensuring that the `target` is always the `input` element\n\t\t\t// allows consumers of `InputControl` (or any higher-level control) to\n\t\t\t// check the input's validity by accessing `event.target.validity.valid`.\n\t\t\tdragProps.event = {\n\t\t\t\t...dragProps.event,\n\t\t\t\ttarget,\n\t\t\t};\n\n\t\t\tif ( ! distance ) return;\n\t\t\tevent.stopPropagation();\n\n\t\t\t/**\n\t\t\t * Quick return if no longer dragging.\n\t\t\t * This prevents unnecessary value calculations.\n\t\t\t */\n\t\t\tif ( ! dragging ) {\n\t\t\t\tonDragEnd( dragProps );\n\t\t\t\tdragEnd( dragProps );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tonDrag( dragProps );\n\t\t\tdrag( dragProps );\n\n\t\t\tif ( ! isDragging ) {\n\t\t\t\tonDragStart( dragProps );\n\t\t\t\tdragStart( dragProps );\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\taxis: dragDirection === 'e' || dragDirection === 'w' ? 'x' : 'y',\n\t\t\tthreshold: dragThreshold,\n\t\t\tenabled: isDragEnabled,\n\t\t\tpointer: { capture: false },\n\t\t}\n\t);\n\n\tconst dragProps = isDragEnabled ? dragGestureProps() : {};\n\t/*\n\t * Works around the odd UA (e.g. Firefox) that does not focus inputs of\n\t * type=number when their spinner arrows are pressed.\n\t */\n\tlet handleOnMouseDown;\n\tif ( type === 'number' ) {\n\t\thandleOnMouseDown = ( event: MouseEvent< HTMLInputElement > ) => {\n\t\t\tprops.onMouseDown?.( event );\n\t\t\tif (\n\t\t\t\tevent.currentTarget !==\n\t\t\t\tevent.currentTarget.ownerDocument.activeElement\n\t\t\t) {\n\t\t\t\tevent.currentTarget.focus();\n\t\t\t}\n\t\t};\n\t}\n\n\treturn (\n\t\t<Input\n\t\t\t{ ...props }\n\t\t\t{ ...dragProps }\n\t\t\tclassName=\"components-input-control__input\"\n\t\t\tdisabled={ disabled }\n\t\t\tdragCursor={ dragCursor }\n\t\t\tisDragging={ isDragging }\n\t\t\tid={ id }\n\t\t\tonBlur={ handleOnBlur }\n\t\t\tonChange={ handleOnChange }\n\t\t\tonFocus={ handleOnFocus }\n\t\t\tonKeyDown={ handleOnKeyDown }\n\t\t\tonMouseDown={ handleOnMouseDown }\n\t\t\tref={ ref }\n\t\t\tinputSize={ size }\n\t\t\tvalue={ value }\n\t\t\ttype={ type }\n\t\t/>\n\t);\n}\n\nconst ForwardedComponent = forwardRef( InputField );\n\nexport default ForwardedComponent;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/input-control/input-field.tsx"],"names":["noop","InputField","ref","disabled","dragDirection","dragThreshold","id","isDragEnabled","isFocused","isPressEnterToChange","onBlur","onChange","onDrag","onDragEnd","onDragStart","onFocus","onKeyDown","onValidate","size","setIsFocused","stateReducer","state","value","valueProp","type","props","change","commit","drag","dragEnd","dragStart","invalidate","pressDown","pressEnter","pressUp","reset","isDragging","isDirty","wasDirtyOnBlur","dragCursor","handleOnBlur","event","target","validity","valid","current","handleOnCommit","handleOnFocus","handleOnChange","nextValue","currentTarget","err","handleOnKeyDown","key","preventDefault","dragGestureProps","dragProps","distance","dragging","stopPropagation","axis","threshold","enabled","pointer","capture","handleOnMouseDown","onMouseDown","ownerDocument","activeElement","focus","ForwardedComponent"],"mappings":";;;;;;;;;AAiBA;;;;AAdA;;AAmBA;;AACA;;AACA;;AAxBA;AACA;AACA;;AAYA;AACA;AACA;AAWA,MAAMA,IAAI,GAAG,MAAM,CAAE,CAArB;;AAEA,SAASC,UAAT,OAwBCC,GAxBD,EAyBE;AAAA,MAxBD;AACCC,IAAAA,QAAQ,GAAG,KADZ;AAECC,IAAAA,aAAa,GAAG,GAFjB;AAGCC,IAAAA,aAAa,GAAG,EAHjB;AAICC,IAAAA,EAJD;AAKCC,IAAAA,aAAa,GAAG,KALjB;AAMCC,IAAAA,SAND;AAOCC,IAAAA,oBAAoB,GAAG,KAPxB;AAQCC,IAAAA,MAAM,GAAGV,IARV;AASCW,IAAAA,QAAQ,GAAGX,IATZ;AAUCY,IAAAA,MAAM,GAAGZ,IAVV;AAWCa,IAAAA,SAAS,GAAGb,IAXb;AAYCc,IAAAA,WAAW,GAAGd,IAZf;AA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AAKxB,KAAF,IAA6C;AAAA;;AAChE,4BAAAhB,KAAK,CAACyC,WAAN,+EAAAzC,KAAK,EAAgBgB,KAAhB,CAAL;;AACA,UACCA,KAAK,CAACS,aAAN,KACAT,KAAK,CAACS,aAAN,CAAoBiB,aAApB,CAAkCC,aAFnC,EAGE;AACD3B,QAAAA,KAAK,CAACS,aAAN,CAAoBmB,KAApB;AACA;AACD,KARD;AASA;;AAED,SACC,4BAAC,yBAAD,6BACM5C,KADN,EAEM+B,SAFN;AAGC,IAAA,SAAS,EAAC,iCAHX;AAIC,IAAA,QAAQ,EAAGrD,QAJZ;AAKC,IAAA,UAAU,EAAGoC,UALd;AAMC,IAAA,UAAU,EAAGH,UANd;AAOC,IAAA,EAAE,EAAG9B,EAPN;AAQC,IAAA,MAAM,EAAGkC,YARV;AASC,IAAA,QAAQ,EAAGQ,cATZ;AAUC,IAAA,OAAO,EAAGD,aAVX;AAWC,IAAA,SAAS,EAAGK,eAXb;AAYC,IAAA,WAAW,EAAGa,iBAZf;AAaC,IAAA,GAAG,EAAG/D,GAbP;AAcC,IAAA,SAAS,EAAGgB,IAdb;AAeC,IAAA,KAAK,EAAGI,KAfT;AAgBC,IAAA,IAAI,EAAGE;AAhBR,KADD;AAoBA;;AAED,MAAM8C,kBAAkB,GAAG,yBAAYrE,UAAZ,CAA3B;eAEeqE,kB","sourcesContent":["/**\n * External dependencies\n */\nimport { useDrag } from '@use-gesture/react';\nimport type {\n\tSyntheticEvent,\n\tChangeEvent,\n\tKeyboardEvent,\n\tPointerEvent,\n\tFocusEvent,\n\tForwardedRef,\n\tMouseEvent,\n} from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef, useRef } from '@wordpress/element';\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../ui/context';\nimport { useDragCursor } from './utils';\nimport { Input } from './styles/input-control-styles';\nimport { useInputControlStateReducer } from './reducer/reducer';\nimport type { InputFieldProps } from './types';\n\nconst noop = () => {};\n\nfunction InputField(\n\t{\n\t\tdisabled = false,\n\t\tdragDirection = 'n',\n\t\tdragThreshold = 10,\n\t\tid,\n\t\tisDragEnabled = false,\n\t\tisFocused,\n\t\tisPressEnterToChange = false,\n\t\tonBlur = noop,\n\t\tonChange = noop,\n\t\tonDrag = noop,\n\t\tonDragEnd = noop,\n\t\tonDragStart = noop,\n\t\tonFocus = noop,\n\t\tonKeyDown = noop,\n\t\tonValidate = noop,\n\t\tsize = 'default',\n\t\tsetIsFocused,\n\t\tstateReducer = ( state: any ) => state,\n\t\tvalue: valueProp,\n\t\ttype,\n\t\t...props\n\t}: WordPressComponentProps< InputFieldProps, 'input', false >,\n\tref: ForwardedRef< HTMLInputElement >\n) {\n\tconst {\n\t\t// State.\n\t\tstate,\n\t\t// Actions.\n\t\tchange,\n\t\tcommit,\n\t\tdrag,\n\t\tdragEnd,\n\t\tdragStart,\n\t\tinvalidate,\n\t\tpressDown,\n\t\tpressEnter,\n\t\tpressUp,\n\t\treset,\n\t} = useInputControlStateReducer(\n\t\tstateReducer,\n\t\t{\n\t\t\tisDragEnabled,\n\t\t\tvalue: valueProp,\n\t\t\tisPressEnterToChange,\n\t\t},\n\t\tonChange\n\t);\n\n\tconst { value, isDragging, isDirty } = state;\n\tconst wasDirtyOnBlur = useRef( false );\n\n\tconst dragCursor = useDragCursor( isDragging, dragDirection );\n\n\tconst handleOnBlur = ( event: FocusEvent< HTMLInputElement > ) => {\n\t\tonBlur( event );\n\t\tsetIsFocused?.( false );\n\n\t\t/**\n\t\t * If isPressEnterToChange is set, this commits the value to\n\t\t * the onChange callback.\n\t\t */\n\t\tif ( isDirty || ! event.target.validity.valid ) {\n\t\t\twasDirtyOnBlur.current = true;\n\t\t\thandleOnCommit( event );\n\t\t}\n\t};\n\n\tconst handleOnFocus = ( event: FocusEvent< HTMLInputElement > ) => {\n\t\tonFocus( event );\n\t\tsetIsFocused?.( true );\n\t};\n\n\tconst handleOnChange = ( event: ChangeEvent< HTMLInputElement > ) => {\n\t\tconst nextValue = event.target.value;\n\t\tchange( nextValue, event );\n\t};\n\n\tconst handleOnCommit = ( event: SyntheticEvent< HTMLInputElement > ) => {\n\t\tconst nextValue = event.currentTarget.value;\n\n\t\ttry {\n\t\t\tonValidate( nextValue );\n\t\t\tcommit( nextValue, event );\n\t\t} catch ( err ) {\n\t\t\tinvalidate( err, event );\n\t\t}\n\t};\n\n\tconst handleOnKeyDown = ( event: KeyboardEvent< HTMLInputElement > ) => {\n\t\tconst { key } = event;\n\t\tonKeyDown( event );\n\n\t\tswitch ( key ) {\n\t\t\tcase 'ArrowUp':\n\t\t\t\tpressUp( event );\n\t\t\t\tbreak;\n\n\t\t\tcase 'ArrowDown':\n\t\t\t\tpressDown( event );\n\t\t\t\tbreak;\n\n\t\t\tcase 'Enter':\n\t\t\t\tpressEnter( event );\n\n\t\t\t\tif ( isPressEnterToChange ) {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\thandleOnCommit( event );\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase 'Escape':\n\t\t\t\tif ( isPressEnterToChange && isDirty ) {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\treset( valueProp, event );\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\t};\n\n\tconst dragGestureProps = useDrag< PointerEvent< HTMLInputElement > >(\n\t\t( dragProps ) => {\n\t\t\tconst { distance, dragging, event, target } = dragProps;\n\n\t\t\t// The `target` prop always references the `input` element while, by\n\t\t\t// default, the `dragProps.event.target` property would reference the real\n\t\t\t// event target (i.e. any DOM element that the pointer is hovering while\n\t\t\t// dragging). Ensuring that the `target` is always the `input` element\n\t\t\t// allows consumers of `InputControl` (or any higher-level control) to\n\t\t\t// check the input's validity by accessing `event.target.validity.valid`.\n\t\t\tdragProps.event = {\n\t\t\t\t...dragProps.event,\n\t\t\t\ttarget,\n\t\t\t};\n\n\t\t\tif ( ! distance ) return;\n\t\t\tevent.stopPropagation();\n\n\t\t\t/**\n\t\t\t * Quick return if no longer dragging.\n\t\t\t * This prevents unnecessary value calculations.\n\t\t\t */\n\t\t\tif ( ! dragging ) {\n\t\t\t\tonDragEnd( dragProps );\n\t\t\t\tdragEnd( dragProps );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tonDrag( dragProps );\n\t\t\tdrag( dragProps );\n\n\t\t\tif ( ! isDragging ) {\n\t\t\t\tonDragStart( dragProps );\n\t\t\t\tdragStart( dragProps );\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\taxis: dragDirection === 'e' || dragDirection === 'w' ? 'x' : 'y',\n\t\t\tthreshold: dragThreshold,\n\t\t\tenabled: isDragEnabled,\n\t\t\tpointer: { capture: false },\n\t\t}\n\t);\n\n\tconst dragProps = isDragEnabled ? dragGestureProps() : {};\n\t/*\n\t * Works around the odd UA (e.g. Firefox) that does not focus inputs of\n\t * type=number when their spinner arrows are pressed.\n\t */\n\tlet handleOnMouseDown;\n\tif ( type === 'number' ) {\n\t\thandleOnMouseDown = ( event: MouseEvent< HTMLInputElement > ) => {\n\t\t\tprops.onMouseDown?.( event );\n\t\t\tif (\n\t\t\t\tevent.currentTarget !==\n\t\t\t\tevent.currentTarget.ownerDocument.activeElement\n\t\t\t) {\n\t\t\t\tevent.currentTarget.focus();\n\t\t\t}\n\t\t};\n\t}\n\n\treturn (\n\t\t<Input\n\t\t\t{ ...props }\n\t\t\t{ ...dragProps }\n\t\t\tclassName=\"components-input-control__input\"\n\t\t\tdisabled={ disabled }\n\t\t\tdragCursor={ dragCursor }\n\t\t\tisDragging={ isDragging }\n\t\t\tid={ id }\n\t\t\tonBlur={ handleOnBlur }\n\t\t\tonChange={ handleOnChange }\n\t\t\tonFocus={ handleOnFocus }\n\t\t\tonKeyDown={ handleOnKeyDown }\n\t\t\tonMouseDown={ handleOnMouseDown }\n\t\t\tref={ ref }\n\t\t\tinputSize={ size }\n\t\t\tvalue={ value }\n\t\t\ttype={ type }\n\t\t/>\n\t);\n}\n\nconst ForwardedComponent = forwardRef( InputField );\n\nexport default ForwardedComponent;\n"]}
|
|
@@ -118,16 +118,13 @@ function inputControlStateReducer(composedStateReducers) {
|
|
|
118
118
|
break;
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
|
|
122
|
-
nextState._event = action.payload.event;
|
|
123
|
-
}
|
|
121
|
+
nextState._event = action.payload.event;
|
|
124
122
|
/**
|
|
125
123
|
* Send the nextState + action to the composedReducers via
|
|
126
124
|
* this "bridge" mechanism. This allows external stateReducers
|
|
127
125
|
* to hook into actions, and modify state if needed.
|
|
128
126
|
*/
|
|
129
127
|
|
|
130
|
-
|
|
131
128
|
return composedStateReducers(nextState, action);
|
|
132
129
|
};
|
|
133
130
|
}
|
|
@@ -141,8 +138,9 @@ function inputControlStateReducer(composedStateReducers) {
|
|
|
141
138
|
* This technique uses the "stateReducer" design pattern:
|
|
142
139
|
* https://kentcdodds.com/blog/the-state-reducer-pattern/
|
|
143
140
|
*
|
|
144
|
-
* @param stateReducer
|
|
145
|
-
* @param initialState
|
|
141
|
+
* @param stateReducer An external state reducer.
|
|
142
|
+
* @param initialState The initial state for the reducer.
|
|
143
|
+
* @param onChangeHandler A handler for the onChange event.
|
|
146
144
|
* @return State, dispatch, and a collection of actions.
|
|
147
145
|
*/
|
|
148
146
|
|
|
@@ -150,18 +148,10 @@ function inputControlStateReducer(composedStateReducers) {
|
|
|
150
148
|
function useInputControlStateReducer() {
|
|
151
149
|
let stateReducer = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _state.initialStateReducer;
|
|
152
150
|
let initialState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _state.initialInputControlState;
|
|
151
|
+
let onChangeHandler = arguments.length > 2 ? arguments[2] : undefined;
|
|
153
152
|
const [state, dispatch] = (0, _element.useReducer)(inputControlStateReducer(stateReducer), mergeInitialState(initialState));
|
|
154
153
|
|
|
155
154
|
const createChangeEvent = type => (nextValue, event) => {
|
|
156
|
-
/**
|
|
157
|
-
* Persist allows for the (Synthetic) event to be used outside of
|
|
158
|
-
* this function call.
|
|
159
|
-
* https://reactjs.org/docs/events.html#event-pooling
|
|
160
|
-
*/
|
|
161
|
-
if (event && event.persist) {
|
|
162
|
-
event.persist();
|
|
163
|
-
}
|
|
164
|
-
|
|
165
155
|
dispatch({
|
|
166
156
|
type,
|
|
167
157
|
payload: {
|
|
@@ -172,15 +162,6 @@ function useInputControlStateReducer() {
|
|
|
172
162
|
};
|
|
173
163
|
|
|
174
164
|
const createKeyEvent = type => event => {
|
|
175
|
-
/**
|
|
176
|
-
* Persist allows for the (Synthetic) event to be used outside of
|
|
177
|
-
* this function call.
|
|
178
|
-
* https://reactjs.org/docs/events.html#event-pooling
|
|
179
|
-
*/
|
|
180
|
-
if (event && event.persist) {
|
|
181
|
-
event.persist();
|
|
182
|
-
}
|
|
183
|
-
|
|
184
165
|
dispatch({
|
|
185
166
|
type,
|
|
186
167
|
payload: {
|
|
@@ -218,6 +199,37 @@ function useInputControlStateReducer() {
|
|
|
218
199
|
const pressUp = createKeyEvent(actions.PRESS_UP);
|
|
219
200
|
const pressDown = createKeyEvent(actions.PRESS_DOWN);
|
|
220
201
|
const pressEnter = createKeyEvent(actions.PRESS_ENTER);
|
|
202
|
+
const currentState = (0, _element.useRef)(state);
|
|
203
|
+
const refProps = (0, _element.useRef)({
|
|
204
|
+
value: initialState.value,
|
|
205
|
+
onChangeHandler
|
|
206
|
+
});
|
|
207
|
+
(0, _element.useLayoutEffect)(() => {
|
|
208
|
+
currentState.current = state;
|
|
209
|
+
refProps.current = {
|
|
210
|
+
value: initialState.value,
|
|
211
|
+
onChangeHandler
|
|
212
|
+
};
|
|
213
|
+
});
|
|
214
|
+
(0, _element.useLayoutEffect)(() => {
|
|
215
|
+
if (currentState.current._event !== undefined && state.value !== refProps.current.value && !state.isDirty) {
|
|
216
|
+
var _state$value;
|
|
217
|
+
|
|
218
|
+
refProps.current.onChangeHandler((_state$value = state.value) !== null && _state$value !== void 0 ? _state$value : '', {
|
|
219
|
+
event: currentState.current._event
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
}, [state.value, state.isDirty]);
|
|
223
|
+
(0, _element.useLayoutEffect)(() => {
|
|
224
|
+
if (initialState.value !== currentState.current.value && !currentState.current.isDirty) {
|
|
225
|
+
dispatch({
|
|
226
|
+
type: actions.RESET,
|
|
227
|
+
payload: {
|
|
228
|
+
value: initialState.value
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
}, [initialState.value]);
|
|
221
233
|
return {
|
|
222
234
|
change,
|
|
223
235
|
commit,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/input-control/reducer/reducer.ts"],"names":["mergeInitialState","initialState","initialInputControlState","value","initialValue","inputControlStateReducer","composedStateReducers","state","action","nextState","type","actions","PRESS_UP","isDirty","PRESS_DOWN","DRAG_START","isDragging","DRAG_END","CHANGE","error","payload","isPressEnterToChange","COMMIT","RESET","INVALIDATE","event","_event","useInputControlStateReducer","stateReducer","initialStateReducer","dispatch","createChangeEvent","nextValue","persist","createKeyEvent","createDragEvent","change","invalidate","reset","commit","dragStart","drag","DRAG","dragEnd","pressUp","pressDown","pressEnter","PRESS_ENTER"],"mappings":";;;;;;;AAQA;;AAKA;;AAMA;;;;;;AAnBA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AASA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,iBAAT,GAEc;AAAA,MADbC,YACa,uEADyBC,+BACzB;AACb,QAAM;AAAEC,IAAAA;AAAF,MAAYF,YAAlB;AAEA,SAAO,EACN,GAAGC,+BADG;AAEN,OAAGD,YAFG;AAGNG,IAAAA,YAAY,EAAED;AAHR,GAAP;AAKA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASE,wBAAT,CACCC,qBADD,EAEgB;AACf,SAAO,CAAEC,KAAF,EAASC,MAAT,KAAqB;AAC3B,UAAMC,SAAS,GAAG,EAAE,GAAGF;AAAL,K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AQU,MAAAA;AAAR,KAAF,CAAR;AACA,GAJD;AAMA;AACD;AACA;;;AACC,QAAMgB,MAAM,GAAGL,iBAAiB,CAAEpB,OAAO,CAACO,MAAV,CAAhC;;AACA,QAAMmB,UAAU,GAAG,CAAElB,KAAF,EAAkBM,KAAlB,KAClBK,QAAQ,CAAE;AAAEpB,IAAAA,IAAI,EAAEC,OAAO,CAACa,UAAhB;AAA4BJ,IAAAA,OAAO,EAAE;AAAED,MAAAA,KAAF;AAASM,MAAAA;AAAT;AAArC,GAAF,CADT;;AAEA,QAAMa,KAAK,GAAGP,iBAAiB,CAAEpB,OAAO,CAACY,KAAV,CAA/B;AACA,QAAMgB,MAAM,GAAGR,iBAAiB,CAAEpB,OAAO,CAACW,MAAV,CAAhC;AAEA,QAAMkB,SAAS,GAAGL,eAAe,CAAExB,OAAO,CAACI,UAAV,CAAjC;AACA,QAAM0B,IAAI,GAAGN,eAAe,CAAExB,OAAO,CAAC+B,IAAV,CAA5B;AACA,QAAMC,OAAO,GAAGR,eAAe,CAAExB,OAAO,CAACM,QAAV,CAA/B;AAEA,QAAM2B,OAAO,GAAGV,cAAc,CAAEvB,OAAO,CAACC,QAAV,CAA9B;AACA,QAAMiC,SAAS,GAAGX,cAAc,CAAEvB,OAAO,CAACG,UAAV,CAAhC;AACA,QAAMgC,UAAU,GAAGZ,cAAc,CAAEvB,OAAO,CAACoC,WAAV,CAAjC;AAEA,SAAO;AACNX,IAAAA,MADM;AAENG,IAAAA,MAFM;AAGNT,IAAAA,QAHM;AAINW,IAAAA,IAJM;AAKNE,IAAAA,OALM;AAMNH,IAAAA,SANM;AAONH,IAAAA,UAPM;AAQNQ,IAAAA,SARM;AASNC,IAAAA,UATM;AAUNF,IAAAA,OAVM;AAWNN,IAAAA,KAXM;AAYN/B,IAAAA;AAZM,GAAP;AAcA","sourcesContent":["/**\n * External dependencies\n */\nimport type { SyntheticEvent } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { useReducer } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tInputState,\n\tStateReducer,\n\tinitialInputControlState,\n\tinitialStateReducer,\n} from './state';\nimport * as actions from './actions';\n\n/**\n * Prepares initialState for the reducer.\n *\n * @param initialState The initial state.\n * @return Prepared initialState for the reducer\n */\nfunction mergeInitialState(\n\tinitialState: Partial< InputState > = initialInputControlState\n): InputState {\n\tconst { value } = initialState;\n\n\treturn {\n\t\t...initialInputControlState,\n\t\t...initialState,\n\t\tinitialValue: value,\n\t} as InputState;\n}\n\n/**\n * Creates a reducer that opens the channel for external state subscription\n * and modification.\n *\n * This technique uses the \"stateReducer\" design pattern:\n * https://kentcdodds.com/blog/the-state-reducer-pattern/\n *\n * @param composedStateReducers A custom reducer that can subscribe and modify state.\n * @return The reducer.\n */\nfunction inputControlStateReducer(\n\tcomposedStateReducers: StateReducer\n): StateReducer {\n\treturn ( state, action ) => {\n\t\tconst nextState = { ...state };\n\n\t\tswitch ( action.type ) {\n\t\t\t/**\n\t\t\t * Keyboard events\n\t\t\t */\n\t\t\tcase actions.PRESS_UP:\n\t\t\t\tnextState.isDirty = false;\n\t\t\t\tbreak;\n\n\t\t\tcase actions.PRESS_DOWN:\n\t\t\t\tnextState.isDirty = false;\n\t\t\t\tbreak;\n\n\t\t\t/**\n\t\t\t * Drag events\n\t\t\t */\n\t\t\tcase actions.DRAG_START:\n\t\t\t\tnextState.isDragging = true;\n\t\t\t\tbreak;\n\n\t\t\tcase actions.DRAG_END:\n\t\t\t\tnextState.isDragging = false;\n\t\t\t\tbreak;\n\n\t\t\t/**\n\t\t\t * Input events\n\t\t\t */\n\t\t\tcase actions.CHANGE:\n\t\t\t\tnextState.error = null;\n\t\t\t\tnextState.value = action.payload.value;\n\n\t\t\t\tif ( state.isPressEnterToChange ) {\n\t\t\t\t\tnextState.isDirty = true;\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase actions.COMMIT:\n\t\t\t\tnextState.value = action.payload.value;\n\t\t\t\tnextState.isDirty = false;\n\t\t\t\tbreak;\n\n\t\t\tcase actions.RESET:\n\t\t\t\tnextState.error = null;\n\t\t\t\tnextState.isDirty = false;\n\t\t\t\tnextState.value = action.payload.value || state.initialValue;\n\t\t\t\tbreak;\n\n\t\t\t/**\n\t\t\t * Validation\n\t\t\t */\n\t\t\tcase actions.INVALIDATE:\n\t\t\t\tnextState.error = action.payload.error;\n\t\t\t\tbreak;\n\t\t}\n\n\t\tif ( action.payload.event ) {\n\t\t\tnextState._event = action.payload.event;\n\t\t}\n\n\t\t/**\n\t\t * Send the nextState + action to the composedReducers via\n\t\t * this \"bridge\" mechanism. This allows external stateReducers\n\t\t * to hook into actions, and modify state if needed.\n\t\t */\n\t\treturn composedStateReducers( nextState, action );\n\t};\n}\n\n/**\n * A custom hook that connects and external stateReducer with an internal\n * reducer. This hook manages the internal state of InputControl.\n * However, by connecting an external stateReducer function, other\n * components can react to actions as well as modify state before it is\n * applied.\n *\n * This technique uses the \"stateReducer\" design pattern:\n * https://kentcdodds.com/blog/the-state-reducer-pattern/\n *\n * @param stateReducer An external state reducer.\n * @param initialState The initial state for the reducer.\n * @return State, dispatch, and a collection of actions.\n */\nexport function useInputControlStateReducer(\n\tstateReducer: StateReducer = initialStateReducer,\n\tinitialState: Partial< InputState > = initialInputControlState\n) {\n\tconst [ state, dispatch ] = useReducer< StateReducer >(\n\t\tinputControlStateReducer( stateReducer ),\n\t\tmergeInitialState( initialState )\n\t);\n\n\tconst createChangeEvent = ( type: actions.ChangeEventAction[ 'type' ] ) => (\n\t\tnextValue: actions.ChangeEventAction[ 'payload' ][ 'value' ],\n\t\tevent: actions.ChangeEventAction[ 'payload' ][ 'event' ]\n\t) => {\n\t\t/**\n\t\t * Persist allows for the (Synthetic) event to be used outside of\n\t\t * this function call.\n\t\t * https://reactjs.org/docs/events.html#event-pooling\n\t\t */\n\t\tif ( event && event.persist ) {\n\t\t\tevent.persist();\n\t\t}\n\n\t\tdispatch( {\n\t\t\ttype,\n\t\t\tpayload: { value: nextValue, event },\n\t\t} as actions.InputAction );\n\t};\n\n\tconst createKeyEvent = ( type: actions.KeyEventAction[ 'type' ] ) => (\n\t\tevent: actions.KeyEventAction[ 'payload' ][ 'event' ]\n\t) => {\n\t\t/**\n\t\t * Persist allows for the (Synthetic) event to be used outside of\n\t\t * this function call.\n\t\t * https://reactjs.org/docs/events.html#event-pooling\n\t\t */\n\t\tif ( event && event.persist ) {\n\t\t\tevent.persist();\n\t\t}\n\n\t\tdispatch( { type, payload: { event } } );\n\t};\n\n\tconst createDragEvent = ( type: actions.DragEventAction[ 'type' ] ) => (\n\t\tpayload: actions.DragEventAction[ 'payload' ]\n\t) => {\n\t\tdispatch( { type, payload } );\n\t};\n\n\t/**\n\t * Actions for the reducer\n\t */\n\tconst change = createChangeEvent( actions.CHANGE );\n\tconst invalidate = ( error: unknown, event: SyntheticEvent ) =>\n\t\tdispatch( { type: actions.INVALIDATE, payload: { error, event } } );\n\tconst reset = createChangeEvent( actions.RESET );\n\tconst commit = createChangeEvent( actions.COMMIT );\n\n\tconst dragStart = createDragEvent( actions.DRAG_START );\n\tconst drag = createDragEvent( actions.DRAG );\n\tconst dragEnd = createDragEvent( actions.DRAG_END );\n\n\tconst pressUp = createKeyEvent( actions.PRESS_UP );\n\tconst pressDown = createKeyEvent( actions.PRESS_DOWN );\n\tconst pressEnter = createKeyEvent( actions.PRESS_ENTER );\n\n\treturn {\n\t\tchange,\n\t\tcommit,\n\t\tdispatch,\n\t\tdrag,\n\t\tdragEnd,\n\t\tdragStart,\n\t\tinvalidate,\n\t\tpressDown,\n\t\tpressEnter,\n\t\tpressUp,\n\t\treset,\n\t\tstate,\n\t} as const;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/input-control/reducer/reducer.ts"],"names":["mergeInitialState","initialState","initialInputControlState","value","initialValue","inputControlStateReducer","composedStateReducers","state","action","nextState","type","actions","PRESS_UP","isDirty","PRESS_DOWN","DRAG_START","isDragging","DRAG_END","CHANGE","error","payload","isPressEnterToChange","COMMIT","RESET","INVALIDATE","_event","event","useInputControlStateReducer","stateReducer","initialStateReducer","onChangeHandler","dispatch","createChangeEvent","nextValue","createKeyEvent","createDragEvent","change","invalidate","reset","commit","dragStart","drag","DRAG","dragEnd","pressUp","pressDown","pressEnter","PRESS_ENTER","currentState","refProps","current","undefined"],"mappings":";;;;;;;AAQA;;AAKA;;AAMA;;;;;;AAnBA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAUA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,iBAAT,GAEc;AAAA,MADbC,YACa,uEADyBC,+BACzB;AACb,QAAM;AAAEC,IAAAA;AAAF,MAAYF,YAAlB;AAEA,SAAO,EACN,GAAGC,+BADG;AAEN,OAAGD,YAFG;AAGNG,IAAAA,YAAY,EAAED;AAHR,GAAP;AAKA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASE,wBAAT,CACCC,qBADD,EAEgB;AACf,SAAO,CAAEC,KAAF,EAASC,MAAT,KAAqB;AAC3B,UAAMC,SAAS,GAAG,EAAE,GAAGF;AAAL,KAAlB;;AAEA,YAASC,MAAM,CAACE,IAAhB;AACC;AACH;AACA;AACG,WAAKC,OAAO,CAACC,QAAb;AACCH,QAAAA,SAAS,CAACI,OAAV,GAAoB,KAApB;AACA;;AAED,WAAKF,OAAO,CAACG,UAAb;AACCL,QAAAA,SAAS,CAACI,OAAV,GAAoB,KAApB;AACA;;AAED;AACH;AACA;;AACG,WAAKF,OAAO,CAACI,UAAb;AACCN,QAAAA,SAAS,CAACO,UAAV,GAAuB,IAAvB;AACA;;AAED,WAAKL,OAAO,CAACM,QAAb;AACCR,QAAAA,SAAS,CAACO,UAAV,GAAuB,KAAvB;AACA;;AAED;AACH;AACA;;AACG,WAAKL,OAAO,CAACO,MAAb;AACCT,QAAAA,SAAS,CAACU,KAAV,GAAkB,IAAlB;AACAV,QAAAA,SAAS,CAACN,KAAV,GAAkBK,MAA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Y,CAACE,KAAf,CAVH;AAYA,SAAO;AACNiC,IAAAA,MADM;AAENG,IAAAA,MAFM;AAGNR,IAAAA,QAHM;AAINU,IAAAA,IAJM;AAKNE,IAAAA,OALM;AAMNH,IAAAA,SANM;AAONH,IAAAA,UAPM;AAQNQ,IAAAA,SARM;AASNC,IAAAA,UATM;AAUNF,IAAAA,OAVM;AAWNN,IAAAA,KAXM;AAYN/B,IAAAA;AAZM,GAAP;AAcA","sourcesContent":["/**\n * External dependencies\n */\nimport type { SyntheticEvent, ChangeEvent, PointerEvent } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { useReducer, useLayoutEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tInputState,\n\tStateReducer,\n\tinitialInputControlState,\n\tinitialStateReducer,\n} from './state';\nimport * as actions from './actions';\nimport type { InputChangeCallback } from '../types';\n\n/**\n * Prepares initialState for the reducer.\n *\n * @param initialState The initial state.\n * @return Prepared initialState for the reducer\n */\nfunction mergeInitialState(\n\tinitialState: Partial< InputState > = initialInputControlState\n): InputState {\n\tconst { value } = initialState;\n\n\treturn {\n\t\t...initialInputControlState,\n\t\t...initialState,\n\t\tinitialValue: value,\n\t} as InputState;\n}\n\n/**\n * Creates a reducer that opens the channel for external state subscription\n * and modification.\n *\n * This technique uses the \"stateReducer\" design pattern:\n * https://kentcdodds.com/blog/the-state-reducer-pattern/\n *\n * @param composedStateReducers A custom reducer that can subscribe and modify state.\n * @return The reducer.\n */\nfunction inputControlStateReducer(\n\tcomposedStateReducers: StateReducer\n): StateReducer {\n\treturn ( state, action ) => {\n\t\tconst nextState = { ...state };\n\n\t\tswitch ( action.type ) {\n\t\t\t/**\n\t\t\t * Keyboard events\n\t\t\t */\n\t\t\tcase actions.PRESS_UP:\n\t\t\t\tnextState.isDirty = false;\n\t\t\t\tbreak;\n\n\t\t\tcase actions.PRESS_DOWN:\n\t\t\t\tnextState.isDirty = false;\n\t\t\t\tbreak;\n\n\t\t\t/**\n\t\t\t * Drag events\n\t\t\t */\n\t\t\tcase actions.DRAG_START:\n\t\t\t\tnextState.isDragging = true;\n\t\t\t\tbreak;\n\n\t\t\tcase actions.DRAG_END:\n\t\t\t\tnextState.isDragging = false;\n\t\t\t\tbreak;\n\n\t\t\t/**\n\t\t\t * Input events\n\t\t\t */\n\t\t\tcase actions.CHANGE:\n\t\t\t\tnextState.error = null;\n\t\t\t\tnextState.value = action.payload.value;\n\n\t\t\t\tif ( state.isPressEnterToChange ) {\n\t\t\t\t\tnextState.isDirty = true;\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase actions.COMMIT:\n\t\t\t\tnextState.value = action.payload.value;\n\t\t\t\tnextState.isDirty = false;\n\t\t\t\tbreak;\n\n\t\t\tcase actions.RESET:\n\t\t\t\tnextState.error = null;\n\t\t\t\tnextState.isDirty = false;\n\t\t\t\tnextState.value = action.payload.value || state.initialValue;\n\t\t\t\tbreak;\n\n\t\t\t/**\n\t\t\t * Validation\n\t\t\t */\n\t\t\tcase actions.INVALIDATE:\n\t\t\t\tnextState.error = action.payload.error;\n\t\t\t\tbreak;\n\t\t}\n\n\t\tnextState._event = action.payload.event;\n\n\t\t/**\n\t\t * Send the nextState + action to the composedReducers via\n\t\t * this \"bridge\" mechanism. This allows external stateReducers\n\t\t * to hook into actions, and modify state if needed.\n\t\t */\n\t\treturn composedStateReducers( nextState, action );\n\t};\n}\n\n/**\n * A custom hook that connects and external stateReducer with an internal\n * reducer. This hook manages the internal state of InputControl.\n * However, by connecting an external stateReducer function, other\n * components can react to actions as well as modify state before it is\n * applied.\n *\n * This technique uses the \"stateReducer\" design pattern:\n * https://kentcdodds.com/blog/the-state-reducer-pattern/\n *\n * @param stateReducer An external state reducer.\n * @param initialState The initial state for the reducer.\n * @param onChangeHandler A handler for the onChange event.\n * @return State, dispatch, and a collection of actions.\n */\nexport function useInputControlStateReducer(\n\tstateReducer: StateReducer = initialStateReducer,\n\tinitialState: Partial< InputState > = initialInputControlState,\n\tonChangeHandler: InputChangeCallback\n) {\n\tconst [ state, dispatch ] = useReducer< StateReducer >(\n\t\tinputControlStateReducer( stateReducer ),\n\t\tmergeInitialState( initialState )\n\t);\n\n\tconst createChangeEvent =\n\t\t( type: actions.ChangeEventAction[ 'type' ] ) =>\n\t\t(\n\t\t\tnextValue: actions.ChangeEventAction[ 'payload' ][ 'value' ],\n\t\t\tevent: actions.ChangeEventAction[ 'payload' ][ 'event' ]\n\t\t) => {\n\t\t\tdispatch( {\n\t\t\t\ttype,\n\t\t\t\tpayload: { value: nextValue, event },\n\t\t\t} as actions.InputAction );\n\t\t};\n\n\tconst createKeyEvent =\n\t\t( type: actions.KeyEventAction[ 'type' ] ) =>\n\t\t( event: actions.KeyEventAction[ 'payload' ][ 'event' ] ) => {\n\t\t\tdispatch( { type, payload: { event } } );\n\t\t};\n\n\tconst createDragEvent =\n\t\t( type: actions.DragEventAction[ 'type' ] ) =>\n\t\t( payload: actions.DragEventAction[ 'payload' ] ) => {\n\t\t\tdispatch( { type, payload } );\n\t\t};\n\n\t/**\n\t * Actions for the reducer\n\t */\n\tconst change = createChangeEvent( actions.CHANGE );\n\tconst invalidate = ( error: unknown, event: SyntheticEvent ) =>\n\t\tdispatch( { type: actions.INVALIDATE, payload: { error, event } } );\n\tconst reset = createChangeEvent( actions.RESET );\n\tconst commit = createChangeEvent( actions.COMMIT );\n\n\tconst dragStart = createDragEvent( actions.DRAG_START );\n\tconst drag = createDragEvent( actions.DRAG );\n\tconst dragEnd = createDragEvent( actions.DRAG_END );\n\n\tconst pressUp = createKeyEvent( actions.PRESS_UP );\n\tconst pressDown = createKeyEvent( actions.PRESS_DOWN );\n\tconst pressEnter = createKeyEvent( actions.PRESS_ENTER );\n\n\tconst currentState = useRef( state );\n\tconst refProps = useRef( { value: initialState.value, onChangeHandler } );\n\tuseLayoutEffect( () => {\n\t\tcurrentState.current = state;\n\t\trefProps.current = { value: initialState.value, onChangeHandler };\n\t} );\n\tuseLayoutEffect( () => {\n\t\tif (\n\t\t\tcurrentState.current._event !== undefined &&\n\t\t\tstate.value !== refProps.current.value &&\n\t\t\t! state.isDirty\n\t\t) {\n\t\t\trefProps.current.onChangeHandler( state.value ?? '', {\n\t\t\t\tevent: currentState.current._event as\n\t\t\t\t\t| ChangeEvent< HTMLInputElement >\n\t\t\t\t\t| PointerEvent< HTMLInputElement >,\n\t\t\t} );\n\t\t}\n\t}, [ state.value, state.isDirty ] );\n\tuseLayoutEffect( () => {\n\t\tif (\n\t\t\tinitialState.value !== currentState.current.value &&\n\t\t\t! currentState.current.isDirty\n\t\t) {\n\t\t\tdispatch( {\n\t\t\t\ttype: actions.RESET,\n\t\t\t\tpayload: { value: initialState.value },\n\t\t\t} );\n\t\t}\n\t}, [ initialState.value ] );\n\n\treturn {\n\t\tchange,\n\t\tcommit,\n\t\tdispatch,\n\t\tdrag,\n\t\tdragEnd,\n\t\tdragStart,\n\t\tinvalidate,\n\t\tpressDown,\n\t\tpressEnter,\n\t\tpressUp,\n\t\treset,\n\t\tstate,\n\t} as const;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/input-control/reducer/state.ts"],"names":["initialStateReducer","state","initialInputControlState","
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/input-control/reducer/state.ts"],"names":["initialStateReducer","state","initialInputControlState","error","initialValue","isDirty","isDragEnabled","isDragging","isPressEnterToChange","value"],"mappings":";;;;;;;AAAA;AACA;AACA;;AAGA;AACA;AACA;AAgBO,MAAMA,mBAAiC,GAAKC,KAAF,IAAyBA,KAAnE;;;AAEA,MAAMC,wBAAoC,GAAG;AACnDC,EAAAA,KAAK,EAAE,IAD4C;AAEnDC,EAAAA,YAAY,EAAE,EAFqC;AAGnDC,EAAAA,OAAO,EAAE,KAH0C;AAInDC,EAAAA,aAAa,EAAE,KAJoC;AAKnDC,EAAAA,UAAU,EAAE,KALuC;AAMnDC,EAAAA,oBAAoB,EAAE,KAN6B;AAOnDC,EAAAA,KAAK,EAAE;AAP4C,CAA7C","sourcesContent":["/**\n * External dependencies\n */\nimport type { Reducer, SyntheticEvent } from 'react';\n\n/**\n * Internal dependencies\n */\nimport type { InputAction } from './actions';\n\nexport interface InputState {\n\t_event?: SyntheticEvent;\n\terror: unknown;\n\tinitialValue?: string;\n\tisDirty: boolean;\n\tisDragEnabled: boolean;\n\tisDragging: boolean;\n\tisPressEnterToChange: boolean;\n\tvalue?: string;\n}\n\nexport type StateReducer = Reducer< InputState, InputAction >;\n\nexport const initialStateReducer: StateReducer = ( state: InputState ) => state;\n\nexport const initialInputControlState: InputState = {\n\terror: null,\n\tinitialValue: '',\n\tisDirty: false,\n\tisDragEnabled: false,\n\tisDragging: false,\n\tisPressEnterToChange: false,\n\tvalue: '',\n};\n"]}
|