@wordpress/components 21.2.0 → 22.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +99 -3
- package/CONTRIBUTING.md +20 -0
- package/build/angle-picker-control/index.js +1 -1
- package/build/angle-picker-control/index.js.map +1 -1
- package/build/autocomplete/autocompleter-ui.js +28 -2
- package/build/autocomplete/autocompleter-ui.js.map +1 -1
- package/build/border-box-control/border-box-control/component.js +65 -15
- package/build/border-box-control/border-box-control/component.js.map +1 -1
- package/build/border-box-control/border-box-control/hook.js +11 -4
- package/build/border-box-control/border-box-control/hook.js.map +1 -1
- package/build/border-box-control/border-box-control-linked-button/hook.js +3 -3
- package/build/border-box-control/border-box-control-linked-button/hook.js.map +1 -1
- package/build/border-box-control/border-box-control-split-controls/component.js +3 -3
- 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 +8 -11
- 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 +3 -7
- package/build/border-box-control/border-box-control-visualizer/hook.js.map +1 -1
- package/build/border-box-control/styles.js +34 -34
- package/build/border-box-control/styles.js.map +1 -1
- package/build/border-control/border-control/component.js +7 -4
- package/build/border-control/border-control/component.js.map +1 -1
- package/build/border-control/border-control/hook.js +12 -5
- package/build/border-control/border-control/hook.js.map +1 -1
- package/build/border-control/border-control-dropdown/hook.js +5 -5
- package/build/border-control/border-control-dropdown/hook.js.map +1 -1
- package/build/border-control/styles.js +19 -34
- package/build/border-control/styles.js.map +1 -1
- package/build/box-control/index.js +6 -2
- package/build/box-control/index.js.map +1 -1
- package/build/circular-option-picker/index.js +14 -14
- package/build/circular-option-picker/index.js.map +1 -1
- package/build/color-palette/index.js +83 -30
- package/build/color-palette/index.js.map +1 -1
- package/build/color-palette/styles.js +3 -3
- package/build/color-palette/styles.js.map +1 -1
- package/build/color-palette/types.js +6 -0
- package/build/color-palette/types.js.map +1 -0
- package/build/color-picker/input-with-slider.js +1 -1
- package/build/color-picker/input-with-slider.js.map +1 -1
- package/build/custom-gradient-picker/gradient-bar/index.js +1 -3
- package/build/custom-gradient-picker/gradient-bar/index.js.map +1 -1
- package/build/custom-select-control/index.js +8 -4
- package/build/custom-select-control/index.js.map +1 -1
- package/build/date-time/date-time/index.js +2 -0
- package/build/date-time/date-time/index.js.map +1 -1
- package/build/date-time/time/index.js +4 -4
- package/build/date-time/time/index.js.map +1 -1
- package/build/disabled/index.js +14 -27
- package/build/disabled/index.js.map +1 -1
- package/build/external-link/index.js +13 -2
- package/build/external-link/index.js.map +1 -1
- package/build/focusable-iframe/index.js +0 -1
- package/build/focusable-iframe/index.js.map +1 -1
- package/build/font-size-picker/index.js +62 -49
- package/build/font-size-picker/index.js.map +1 -1
- package/build/font-size-picker/styles.js +5 -13
- package/build/font-size-picker/styles.js.map +1 -1
- package/build/font-size-picker/utils.js +1 -22
- package/build/font-size-picker/utils.js.map +1 -1
- package/build/form-file-upload/index.js.map +1 -1
- package/build/form-token-field/suggestions-list.js +5 -5
- package/build/form-token-field/suggestions-list.js.map +1 -1
- package/build/higher-order/with-fallback-styles/index.js +1 -1
- package/build/higher-order/with-fallback-styles/index.js.map +1 -1
- package/build/higher-order/with-filters/index.js +1 -7
- package/build/higher-order/with-filters/index.js.map +1 -1
- package/build/index.js +15 -7
- package/build/index.js.map +1 -1
- package/build/input-control/index.js +2 -0
- package/build/input-control/index.js.map +1 -1
- package/build/input-control/input-base.js +1 -1
- package/build/input-control/input-base.js.map +1 -1
- package/build/input-control/styles/input-control-styles.js +21 -21
- package/build/input-control/styles/input-control-styles.js.map +1 -1
- package/build/isolated-event-container/index.js +5 -9
- package/build/isolated-event-container/index.js.map +1 -1
- package/build/item-group/styles.js +10 -10
- package/build/item-group/styles.js.map +1 -1
- package/build/modal/aria-helper.js +2 -3
- package/build/modal/aria-helper.js.map +1 -1
- package/build/modal/index.js +42 -11
- package/build/modal/index.js.map +1 -1
- package/build/modal/types.js +6 -0
- package/build/modal/types.js.map +1 -0
- package/build/navigator/index.js +8 -8
- package/build/navigator/index.js.map +1 -1
- package/build/navigator/navigator-back-button/component.js +5 -4
- package/build/navigator/navigator-back-button/component.js.map +1 -1
- package/build/navigator/navigator-back-button/index.js +1 -1
- package/build/navigator/navigator-back-button/index.js.map +1 -1
- package/build/navigator/navigator-button/component.js +5 -4
- package/build/navigator/navigator-button/component.js.map +1 -1
- package/build/navigator/navigator-button/index.js +1 -1
- package/build/navigator/navigator-button/index.js.map +1 -1
- package/build/navigator/navigator-provider/component.js +10 -7
- package/build/navigator/navigator-provider/component.js.map +1 -1
- package/build/navigator/navigator-provider/index.js +1 -1
- package/build/navigator/navigator-provider/index.js.map +1 -1
- package/build/navigator/navigator-screen/component.js +11 -8
- package/build/navigator/navigator-screen/component.js.map +1 -1
- package/build/navigator/navigator-screen/index.js +1 -1
- package/build/navigator/navigator-screen/index.js.map +1 -1
- package/build/number-control/index.js +82 -22
- package/build/number-control/index.js.map +1 -1
- package/build/number-control/styles/number-control-styles.js +36 -6
- package/build/number-control/styles/number-control-styles.js.map +1 -1
- package/build/popover/index.js +15 -29
- package/build/popover/index.js.map +1 -1
- package/build/radio-group/index.js +7 -1
- package/build/radio-group/index.js.map +1 -1
- package/build/{radio → radio-group/radio}/index.js +7 -1
- package/build/radio-group/radio/index.js.map +1 -0
- package/build/{radio-context → radio-group/radio-context}/index.js +0 -0
- package/build/radio-group/radio-context/index.js.map +1 -0
- package/build/sandbox/index.js +55 -59
- package/build/sandbox/index.js.map +1 -1
- package/build/sandbox/index.native.js +63 -62
- package/build/sandbox/index.native.js.map +1 -1
- package/build/slot-fill/bubbles-virtually/fill.js +9 -5
- package/build/slot-fill/bubbles-virtually/fill.js.map +1 -1
- package/build/slot-fill/bubbles-virtually/slot-fill-provider.js +1 -1
- package/build/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
- package/build/slot-fill/bubbles-virtually/slot.js +13 -8
- package/build/slot-fill/bubbles-virtually/slot.js.map +1 -1
- package/build/slot-fill/bubbles-virtually/use-slot.js +15 -9
- package/build/slot-fill/bubbles-virtually/use-slot.js.map +1 -1
- package/build/slot-fill/fill.js +12 -4
- package/build/slot-fill/fill.js.map +1 -1
- package/build/slot-fill/use-slot.js +3 -1
- package/build/slot-fill/use-slot.js.map +1 -1
- package/build/snackbar/index.js +1 -1
- package/build/snackbar/index.js.map +1 -1
- package/build/tab-panel/index.js +5 -9
- package/build/tab-panel/index.js.map +1 -1
- package/build/text-control/index.js +0 -2
- package/build/text-control/index.js.map +1 -1
- package/build/theme/index.js +62 -0
- package/build/theme/index.js.map +1 -0
- package/build/theme/styles.js +33 -0
- package/build/theme/styles.js.map +1 -0
- package/build/theme/types.js +6 -0
- package/build/theme/types.js.map +1 -0
- package/build/toggle-control/index.js +15 -3
- package/build/toggle-control/index.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/as-button-group.js +90 -0
- package/build/toggle-group-control/toggle-group-control/as-button-group.js.map +1 -0
- package/build/toggle-group-control/toggle-group-control/as-radio-group.js +90 -0
- package/build/toggle-group-control/toggle-group-control/as-radio-group.js.map +1 -0
- package/build/toggle-group-control/toggle-group-control/component.js +21 -50
- package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/styles.js +8 -8
- package/build/toggle-group-control/toggle-group-control/styles.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control-option-base/component.js +39 -17
- package/build/toggle-group-control/toggle-group-control-option-base/component.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control-option-base/styles.js +23 -23
- package/build/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
- package/build/toolbar-dropdown-menu/index.js +1 -1
- package/build/toolbar-dropdown-menu/index.js.map +1 -1
- package/build/tools-panel/tools-panel/hook.js +3 -3
- package/build/tools-panel/tools-panel/hook.js.map +1 -1
- package/build/tools-panel/tools-panel-item/hook.js +6 -6
- package/build/tools-panel/tools-panel-item/hook.js.map +1 -1
- package/build/tooltip/index.js +4 -1
- package/build/tooltip/index.js.map +1 -1
- package/build/tooltip/index.native.js +17 -4
- package/build/tooltip/index.native.js.map +1 -1
- package/build/ui/context/context-system-provider.js +9 -22
- package/build/ui/context/context-system-provider.js.map +1 -1
- package/build/unit-control/index.js +7 -9
- package/build/unit-control/index.js.map +1 -1
- package/build/unit-control/styles/unit-control-styles.js +15 -25
- package/build/unit-control/styles/unit-control-styles.js.map +1 -1
- package/build/utils/config-values.js +0 -1
- package/build/utils/config-values.js.map +1 -1
- package/build/utils/hooks/use-update-effect.js +5 -1
- package/build/utils/hooks/use-update-effect.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 +29 -3
- package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
- package/build-module/border-box-control/border-box-control/component.js +63 -13
- 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 +11 -4
- 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/hook.js +3 -3
- package/build-module/border-box-control/border-box-control-linked-button/hook.js.map +1 -1
- package/build-module/border-box-control/border-box-control-split-controls/component.js +3 -3
- 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 +9 -10
- 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 -6
- package/build-module/border-box-control/border-box-control-visualizer/hook.js.map +1 -1
- package/build-module/border-box-control/styles.js +26 -28
- package/build-module/border-box-control/styles.js.map +1 -1
- package/build-module/border-control/border-control/component.js +7 -4
- package/build-module/border-control/border-control/component.js.map +1 -1
- package/build-module/border-control/border-control/hook.js +12 -5
- package/build-module/border-control/border-control/hook.js.map +1 -1
- package/build-module/border-control/border-control-dropdown/hook.js +5 -5
- package/build-module/border-control/border-control-dropdown/hook.js.map +1 -1
- package/build-module/border-control/styles.js +20 -36
- package/build-module/border-control/styles.js.map +1 -1
- package/build-module/box-control/index.js +6 -2
- package/build-module/box-control/index.js.map +1 -1
- package/build-module/circular-option-picker/index.js +14 -14
- package/build-module/circular-option-picker/index.js.map +1 -1
- package/build-module/color-palette/index.js +81 -28
- package/build-module/color-palette/index.js.map +1 -1
- package/build-module/color-palette/styles.js +3 -3
- package/build-module/color-palette/styles.js.map +1 -1
- package/build-module/color-palette/types.js +2 -0
- package/build-module/color-palette/types.js.map +1 -0
- package/build-module/color-picker/input-with-slider.js +1 -1
- package/build-module/color-picker/input-with-slider.js.map +1 -1
- package/build-module/custom-gradient-picker/gradient-bar/index.js +1 -2
- package/build-module/custom-gradient-picker/gradient-bar/index.js.map +1 -1
- package/build-module/custom-select-control/index.js +8 -4
- package/build-module/custom-select-control/index.js.map +1 -1
- package/build-module/date-time/date-time/index.js +2 -0
- package/build-module/date-time/date-time/index.js.map +1 -1
- package/build-module/date-time/time/index.js +4 -4
- package/build-module/date-time/time/index.js.map +1 -1
- package/build-module/disabled/index.js +15 -27
- package/build-module/disabled/index.js.map +1 -1
- package/build-module/external-link/index.js +13 -2
- package/build-module/external-link/index.js.map +1 -1
- package/build-module/focusable-iframe/index.js +0 -1
- package/build-module/focusable-iframe/index.js.map +1 -1
- package/build-module/font-size-picker/index.js +66 -51
- package/build-module/font-size-picker/index.js.map +1 -1
- package/build-module/font-size-picker/styles.js +5 -13
- package/build-module/font-size-picker/styles.js.map +1 -1
- package/build-module/font-size-picker/utils.js +1 -20
- package/build-module/font-size-picker/utils.js.map +1 -1
- package/build-module/form-file-upload/index.js.map +1 -1
- package/build-module/form-token-field/suggestions-list.js +5 -5
- package/build-module/form-token-field/suggestions-list.js.map +1 -1
- package/build-module/higher-order/with-fallback-styles/index.js +2 -2
- package/build-module/higher-order/with-fallback-styles/index.js.map +1 -1
- package/build-module/higher-order/with-filters/index.js +1 -6
- package/build-module/higher-order/with-filters/index.js.map +1 -1
- package/build-module/index.js +4 -3
- package/build-module/index.js.map +1 -1
- package/build-module/input-control/index.js +2 -0
- package/build-module/input-control/index.js.map +1 -1
- package/build-module/input-control/input-base.js +1 -1
- package/build-module/input-control/input-base.js.map +1 -1
- package/build-module/input-control/styles/input-control-styles.js +21 -21
- package/build-module/input-control/styles/input-control-styles.js.map +1 -1
- package/build-module/isolated-event-container/index.js +7 -9
- package/build-module/isolated-event-container/index.js.map +1 -1
- package/build-module/item-group/styles.js +10 -10
- package/build-module/item-group/styles.js.map +1 -1
- package/build-module/modal/aria-helper.js +2 -3
- package/build-module/modal/aria-helper.js.map +1 -1
- package/build-module/modal/index.js +44 -12
- package/build-module/modal/index.js.map +1 -1
- package/build-module/modal/types.js +2 -0
- package/build-module/modal/types.js.map +1 -0
- package/build-module/navigator/index.js +4 -4
- package/build-module/navigator/index.js.map +1 -1
- package/build-module/navigator/navigator-back-button/component.js +3 -3
- package/build-module/navigator/navigator-back-button/component.js.map +1 -1
- package/build-module/navigator/navigator-back-button/index.js +1 -1
- package/build-module/navigator/navigator-back-button/index.js.map +1 -1
- package/build-module/navigator/navigator-button/component.js +3 -3
- package/build-module/navigator/navigator-button/component.js.map +1 -1
- package/build-module/navigator/navigator-button/index.js +1 -1
- package/build-module/navigator/navigator-button/index.js.map +1 -1
- package/build-module/navigator/navigator-provider/component.js +8 -6
- package/build-module/navigator/navigator-provider/component.js.map +1 -1
- package/build-module/navigator/navigator-provider/index.js +1 -1
- package/build-module/navigator/navigator-provider/index.js.map +1 -1
- package/build-module/navigator/navigator-screen/component.js +9 -7
- package/build-module/navigator/navigator-screen/component.js.map +1 -1
- package/build-module/navigator/navigator-screen/index.js +1 -1
- package/build-module/navigator/navigator-screen/index.js.map +1 -1
- package/build-module/number-control/index.js +81 -26
- package/build-module/number-control/index.js.map +1 -1
- package/build-module/number-control/styles/number-control-styles.js +30 -4
- package/build-module/number-control/styles/number-control-styles.js.map +1 -1
- package/build-module/popover/index.js +15 -29
- package/build-module/popover/index.js.map +1 -1
- package/build-module/radio-group/index.js +6 -1
- package/build-module/radio-group/index.js.map +1 -1
- package/build-module/{radio → radio-group/radio}/index.js +6 -1
- package/build-module/radio-group/radio/index.js.map +1 -0
- package/build-module/{radio-context → radio-group/radio-context}/index.js +0 -0
- package/build-module/radio-group/radio-context/index.js.map +1 -0
- package/build-module/sandbox/index.js +56 -59
- package/build-module/sandbox/index.js.map +1 -1
- package/build-module/sandbox/index.native.js +54 -52
- package/build-module/sandbox/index.native.js.map +1 -1
- package/build-module/slot-fill/bubbles-virtually/fill.js +9 -5
- package/build-module/slot-fill/bubbles-virtually/fill.js.map +1 -1
- package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js +1 -1
- package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
- package/build-module/slot-fill/bubbles-virtually/slot.js +13 -8
- package/build-module/slot-fill/bubbles-virtually/slot.js.map +1 -1
- package/build-module/slot-fill/bubbles-virtually/use-slot.js +15 -9
- package/build-module/slot-fill/bubbles-virtually/use-slot.js.map +1 -1
- package/build-module/slot-fill/fill.js +12 -4
- package/build-module/slot-fill/fill.js.map +1 -1
- package/build-module/slot-fill/use-slot.js +3 -1
- package/build-module/slot-fill/use-slot.js.map +1 -1
- package/build-module/snackbar/index.js +1 -1
- package/build-module/snackbar/index.js.map +1 -1
- package/build-module/tab-panel/index.js +5 -9
- package/build-module/tab-panel/index.js.map +1 -1
- package/build-module/text-control/index.js +0 -2
- package/build-module/text-control/index.js.map +1 -1
- package/build-module/theme/index.js +52 -0
- package/build-module/theme/index.js.map +1 -0
- package/build-module/theme/styles.js +25 -0
- package/build-module/theme/styles.js.map +1 -0
- package/build-module/theme/types.js +2 -0
- package/build-module/theme/types.js.map +1 -0
- package/build-module/toggle-control/index.js +15 -3
- package/build-module/toggle-control/index.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control/as-button-group.js +76 -0
- package/build-module/toggle-group-control/toggle-group-control/as-button-group.js.map +1 -0
- package/build-module/toggle-group-control/toggle-group-control/as-radio-group.js +75 -0
- package/build-module/toggle-group-control/toggle-group-control/as-radio-group.js.map +1 -0
- package/build-module/toggle-group-control/toggle-group-control/component.js +19 -49
- package/build-module/toggle-group-control/toggle-group-control/component.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control/styles.js +7 -6
- package/build-module/toggle-group-control/toggle-group-control/styles.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control-option-base/component.js +39 -17
- package/build-module/toggle-group-control/toggle-group-control-option-base/component.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js +21 -18
- package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
- package/build-module/toolbar-dropdown-menu/index.js +1 -1
- package/build-module/toolbar-dropdown-menu/index.js.map +1 -1
- package/build-module/tools-panel/tools-panel/hook.js +3 -3
- package/build-module/tools-panel/tools-panel/hook.js.map +1 -1
- package/build-module/tools-panel/tools-panel-item/hook.js +6 -6
- package/build-module/tools-panel/tools-panel-item/hook.js.map +1 -1
- package/build-module/tooltip/index.js +4 -1
- package/build-module/tooltip/index.js.map +1 -1
- package/build-module/tooltip/index.native.js +17 -4
- package/build-module/tooltip/index.native.js.map +1 -1
- package/build-module/ui/context/context-system-provider.js +6 -20
- package/build-module/ui/context/context-system-provider.js.map +1 -1
- package/build-module/unit-control/index.js +8 -10
- package/build-module/unit-control/index.js.map +1 -1
- package/build-module/unit-control/styles/unit-control-styles.js +8 -24
- package/build-module/unit-control/styles/unit-control-styles.js.map +1 -1
- package/build-module/utils/config-values.js +0 -1
- package/build-module/utils/config-values.js.map +1 -1
- package/build-module/utils/hooks/use-update-effect.js +5 -1
- package/build-module/utils/hooks/use-update-effect.js.map +1 -1
- package/build-style/style-rtl.css +45 -61
- package/build-style/style.css +43 -59
- package/build-types/base-field/hook.d.ts +11 -11
- package/build-types/border-box-control/border-box-control/component.d.ts +53 -4
- 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 +14 -12
- 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/hook.d.ts +12 -12
- 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 +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 +12 -12
- 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 +12 -12
- package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts.map +1 -1
- package/build-types/border-box-control/stories/index.d.ts +17 -0
- package/build-types/border-box-control/stories/index.d.ts.map +1 -0
- package/build-types/border-box-control/styles.d.ts +7 -6
- package/build-types/border-box-control/styles.d.ts.map +1 -1
- package/build-types/border-box-control/types.d.ts +12 -16
- package/build-types/border-box-control/types.d.ts.map +1 -1
- package/build-types/border-control/border-control/component.d.ts +2 -1
- package/build-types/border-control/border-control/component.d.ts.map +1 -1
- package/build-types/border-control/border-control/hook.d.ts +14 -13
- package/build-types/border-control/border-control/hook.d.ts.map +1 -1
- package/build-types/border-control/border-control-dropdown/component.d.ts +1 -1
- package/build-types/border-control/border-control-dropdown/hook.d.ts +11 -11
- 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 +11 -11
- package/build-types/border-control/stories/index.d.ts +12 -6
- package/build-types/border-control/stories/index.d.ts.map +1 -1
- package/build-types/border-control/styles.d.ts +3 -3
- package/build-types/border-control/styles.d.ts.map +1 -1
- package/build-types/border-control/types.d.ts +11 -9
- package/build-types/border-control/types.d.ts.map +1 -1
- package/build-types/card/card/hook.d.ts +12 -12
- package/build-types/card/card-body/hook.d.ts +12 -12
- package/build-types/card/card-divider/hook.d.ts +13 -13
- package/build-types/card/card-footer/hook.d.ts +12 -12
- package/build-types/card/card-header/hook.d.ts +12 -12
- package/build-types/card/card-media/hook.d.ts +12 -12
- package/build-types/card/stories/index.d.ts.map +1 -1
- package/build-types/circular-option-picker/index.d.ts +4 -24
- package/build-types/circular-option-picker/index.d.ts.map +1 -1
- package/build-types/color-palette/index.d.ts +33 -18
- package/build-types/color-palette/index.d.ts.map +1 -1
- package/build-types/color-palette/stories/index.d.ts +21 -0
- package/build-types/color-palette/stories/index.d.ts.map +1 -0
- package/build-types/color-palette/styles.d.ts +3 -2
- package/build-types/color-palette/styles.d.ts.map +1 -1
- package/build-types/color-palette/test/index.d.ts +2 -0
- package/build-types/color-palette/test/index.d.ts.map +1 -0
- package/build-types/color-palette/types.d.ts +86 -0
- package/build-types/color-palette/types.d.ts.map +1 -0
- package/build-types/color-picker/styles.d.ts +5 -4
- package/build-types/color-picker/styles.d.ts.map +1 -1
- package/build-types/confirm-dialog/component.d.ts +4 -4
- package/build-types/confirm-dialog/types.d.ts +5 -1
- package/build-types/confirm-dialog/types.d.ts.map +1 -1
- package/build-types/custom-select-control/index.d.ts +1 -12
- package/build-types/custom-select-control/index.d.ts.map +1 -1
- package/build-types/custom-select-control/styles.d.ts +3 -1
- package/build-types/custom-select-control/styles.d.ts.map +1 -1
- package/build-types/date-time/date/styles.d.ts +3 -3
- package/build-types/date-time/date-time/index.d.ts +2 -0
- package/build-types/date-time/date-time/index.d.ts.map +1 -1
- package/build-types/date-time/date-time/styles.d.ts +3 -3
- package/build-types/date-time/stories/date-time.d.ts.map +1 -1
- package/build-types/date-time/time/styles.d.ts +8 -4
- package/build-types/date-time/time/styles.d.ts.map +1 -1
- package/build-types/disabled/index.d.ts +8 -1
- package/build-types/disabled/index.d.ts.map +1 -1
- package/build-types/elevation/hook.d.ts +12 -12
- package/build-types/external-link/index.d.ts.map +1 -1
- package/build-types/external-link/styles/external-link-styles.d.ts +1 -1
- package/build-types/external-link/test/index.d.ts +2 -0
- package/build-types/external-link/test/index.d.ts.map +1 -0
- package/build-types/flex/flex/hook.d.ts +12 -12
- package/build-types/flex/flex-block/hook.d.ts +12 -12
- package/build-types/flex/flex-item/hook.d.ts +12 -12
- package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +2 -2
- package/build-types/focal-point-picker/styles/focal-point-style.d.ts +3 -3
- package/build-types/focusable-iframe/index.d.ts.map +1 -1
- package/build-types/font-size-picker/index.d.ts.map +1 -1
- package/build-types/font-size-picker/styles.d.ts.map +1 -1
- package/build-types/font-size-picker/types.d.ts +1 -1
- package/build-types/font-size-picker/utils.d.ts +0 -8
- package/build-types/font-size-picker/utils.d.ts.map +1 -1
- package/build-types/form-file-upload/index.d.ts.map +1 -1
- package/build-types/form-file-upload/types.d.ts +5 -4
- package/build-types/form-file-upload/types.d.ts.map +1 -1
- package/build-types/grid/hook.d.ts +12 -12
- package/build-types/h-stack/component.d.ts +1 -1
- package/build-types/h-stack/hook.d.ts +12 -12
- package/build-types/heading/hook.d.ts +12 -12
- 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-base.d.ts +5 -2
- package/build-types/input-control/input-base.d.ts.map +1 -1
- package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
- package/build-types/input-control/types.d.ts +3 -8
- package/build-types/input-control/types.d.ts.map +1 -1
- package/build-types/input-control/utils.d.ts +1 -1
- package/build-types/isolated-event-container/index.d.ts +3 -2
- package/build-types/isolated-event-container/index.d.ts.map +1 -1
- package/build-types/item-group/item/hook.d.ts +13 -13
- package/build-types/item-group/item-group/hook.d.ts +13 -13
- package/build-types/modal/aria-helper.d.ts +4 -4
- package/build-types/modal/aria-helper.d.ts.map +1 -1
- package/build-types/modal/index.d.ts +35 -2
- package/build-types/modal/index.d.ts.map +1 -1
- package/build-types/modal/stories/index.d.ts +9 -0
- package/build-types/modal/stories/index.d.ts.map +1 -0
- package/build-types/modal/test/aria-helper.d.ts +2 -0
- package/build-types/modal/test/aria-helper.d.ts.map +1 -0
- package/build-types/modal/test/index.d.ts +2 -0
- package/build-types/modal/test/index.d.ts.map +1 -0
- package/build-types/modal/types.d.ts +134 -0
- package/build-types/modal/types.d.ts.map +1 -0
- package/build-types/navigator/index.d.ts +4 -4
- package/build-types/navigator/index.d.ts.map +1 -1
- package/build-types/navigator/navigator-back-button/component.d.ts +4 -2
- package/build-types/navigator/navigator-back-button/component.d.ts.map +1 -1
- package/build-types/navigator/navigator-back-button/hook.d.ts +14 -13
- package/build-types/navigator/navigator-back-button/hook.d.ts.map +1 -1
- package/build-types/navigator/navigator-back-button/index.d.ts +1 -1
- package/build-types/navigator/navigator-back-button/index.d.ts.map +1 -1
- package/build-types/navigator/navigator-button/component.d.ts +4 -2
- package/build-types/navigator/navigator-button/component.d.ts.map +1 -1
- package/build-types/navigator/navigator-button/hook.d.ts +14 -13
- package/build-types/navigator/navigator-button/hook.d.ts.map +1 -1
- package/build-types/navigator/navigator-button/index.d.ts +1 -1
- package/build-types/navigator/navigator-button/index.d.ts.map +1 -1
- package/build-types/navigator/navigator-provider/component.d.ts +2 -2
- package/build-types/navigator/navigator-provider/component.d.ts.map +1 -1
- package/build-types/navigator/navigator-provider/index.d.ts +1 -1
- package/build-types/navigator/navigator-provider/index.d.ts.map +1 -1
- package/build-types/navigator/navigator-screen/component.d.ts +2 -2
- package/build-types/navigator/navigator-screen/component.d.ts.map +1 -1
- package/build-types/navigator/navigator-screen/index.d.ts +1 -1
- package/build-types/navigator/navigator-screen/index.d.ts.map +1 -1
- package/build-types/navigator/stories/index.d.ts +9 -0
- package/build-types/navigator/stories/index.d.ts.map +1 -0
- package/build-types/navigator/test/index.d.ts +2 -0
- package/build-types/navigator/test/index.d.ts.map +1 -0
- package/build-types/navigator/types.d.ts +4 -1
- package/build-types/navigator/types.d.ts.map +1 -1
- package/build-types/number-control/index.d.ts +2 -4
- package/build-types/number-control/index.d.ts.map +1 -1
- package/build-types/number-control/styles/number-control-styles.d.ts +5 -0
- package/build-types/number-control/styles/number-control-styles.d.ts.map +1 -1
- package/build-types/number-control/types.d.ts +12 -0
- package/build-types/number-control/types.d.ts.map +1 -1
- package/build-types/popover/index.d.ts +1 -1
- package/build-types/popover/index.d.ts.map +1 -1
- package/build-types/popover/stories/e2e/index.d.ts +1 -1
- package/build-types/popover/stories/index.d.ts +2 -0
- package/build-types/popover/stories/index.d.ts.map +1 -1
- package/build-types/popover/types.d.ts +18 -14
- package/build-types/popover/types.d.ts.map +1 -1
- package/build-types/radio-group/index.d.ts +10 -0
- package/build-types/radio-group/index.d.ts.map +1 -0
- package/build-types/radio-group/radio/index.d.ts +7 -0
- package/build-types/radio-group/radio/index.d.ts.map +1 -0
- package/build-types/{radio-context → radio-group/radio-context}/index.d.ts +0 -0
- package/build-types/radio-group/radio-context/index.d.ts.map +1 -0
- package/build-types/range-control/index.d.ts +1 -1
- package/build-types/range-control/styles/range-control-styles.d.ts +2 -1
- package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
- package/build-types/resizable-box/index.d.ts +1 -1
- package/build-types/resizable-box/resize-tooltip/index.d.ts +1 -1
- package/build-types/resizable-box/resize-tooltip/label.d.ts +1 -1
- package/build-types/scrollable/hook.d.ts +12 -12
- package/build-types/search-control/index.d.ts +2 -2
- package/build-types/search-control/stories/index.d.ts +4 -4
- package/build-types/select-control/stories/index.d.ts.map +1 -1
- package/build-types/slot-fill/bubbles-virtually/slot-fill-provider.d.ts.map +1 -1
- package/build-types/slot-fill/bubbles-virtually/use-slot.d.ts.map +1 -1
- package/build-types/slot-fill/fill.d.ts.map +1 -1
- package/build-types/slot-fill/use-slot.d.ts.map +1 -1
- package/build-types/spacer/hook.d.ts +12 -12
- package/build-types/spinner/index.d.ts +1 -1
- package/build-types/surface/hook.d.ts +12 -12
- package/build-types/tab-panel/index.d.ts.map +1 -1
- package/build-types/text/hook.d.ts +12 -12
- package/build-types/text-control/index.d.ts +2 -4
- 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/theme/index.d.ts +31 -0
- package/build-types/theme/index.d.ts.map +1 -0
- package/build-types/theme/stories/index.d.ts +13 -0
- package/build-types/theme/stories/index.d.ts.map +1 -0
- package/build-types/theme/styles.d.ts +10 -0
- package/build-types/theme/styles.d.ts.map +1 -0
- package/build-types/theme/test/index.d.ts +2 -0
- package/build-types/theme/test/index.d.ts.map +1 -0
- package/build-types/theme/types.d.ts +21 -0
- package/build-types/theme/types.d.ts.map +1 -0
- package/build-types/toggle-control/index.d.ts.map +1 -1
- package/build-types/toggle-control/types.d.ts +2 -1
- package/build-types/toggle-control/types.d.ts.map +1 -1
- package/build-types/toggle-group-control/stories/index.d.ts +2 -2
- package/build-types/toggle-group-control/stories/index.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control/as-button-group.d.ts +6 -0
- package/build-types/toggle-group-control/toggle-group-control/as-button-group.d.ts.map +1 -0
- package/build-types/toggle-group-control/toggle-group-control/as-radio-group.d.ts +6 -0
- package/build-types/toggle-group-control/toggle-group-control/as-radio-group.d.ts.map +1 -0
- package/build-types/toggle-group-control/toggle-group-control/component.d.ts +2 -2
- package/build-types/toggle-group-control/toggle-group-control/component.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control/styles.d.ts +2 -2
- package/build-types/toggle-group-control/toggle-group-control/styles.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control-option-base/component.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts +4 -7
- package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control-option-icon/component.d.ts +1 -1
- package/build-types/toggle-group-control/types.d.ts +19 -14
- package/build-types/toggle-group-control/types.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel/hook.d.ts +12 -12
- package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel-header/hook.d.ts +12 -12
- package/build-types/tools-panel/tools-panel-item/hook.d.ts +12 -12
- 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/truncate/hook.d.ts +12 -12
- package/build-types/ui/context/context-system-provider.d.ts.map +1 -1
- package/build-types/ui/control-group/hook.d.ts +12 -12
- package/build-types/ui/control-label/component.d.ts +1 -1
- package/build-types/ui/control-label/hook.d.ts +12 -12
- package/build-types/ui/form-group/form-group.d.ts +4 -4
- package/build-types/ui/form-group/use-form-group.d.ts +28 -28
- package/build-types/unit-control/index.d.ts +2 -2
- package/build-types/unit-control/index.d.ts.map +1 -1
- package/build-types/unit-control/styles/unit-control-styles.d.ts +2 -5
- package/build-types/unit-control/styles/unit-control-styles.d.ts.map +1 -1
- package/build-types/unit-control/types.d.ts +3 -3
- package/build-types/unit-control/types.d.ts.map +1 -1
- package/build-types/utils/config-values.d.ts +0 -1
- package/build-types/utils/hooks/use-update-effect.d.ts.map +1 -1
- package/build-types/utils/types.d.ts +0 -14
- package/build-types/utils/types.d.ts.map +1 -1
- package/build-types/v-stack/component.d.ts +2 -2
- package/build-types/v-stack/hook.d.ts +12 -12
- package/build-types/v-stack/stories/index.d.ts +2 -2
- package/package.json +17 -17
- package/src/angle-picker-control/index.js +1 -1
- package/src/angle-picker-control/stories/index.js +3 -0
- package/src/autocomplete/autocompleter-ui.js +29 -2
- package/src/autocomplete/test/index.js +89 -0
- package/src/base-field/test/index.js +4 -6
- package/src/border-box-control/border-box-control/README.md +8 -0
- package/src/border-box-control/border-box-control/component.tsx +66 -13
- package/src/border-box-control/border-box-control/hook.ts +11 -2
- package/src/border-box-control/border-box-control-linked-button/hook.ts +3 -6
- package/src/border-box-control/border-box-control-split-controls/component.tsx +3 -6
- package/src/border-box-control/border-box-control-split-controls/hook.ts +11 -14
- package/src/border-box-control/border-box-control-visualizer/hook.ts +4 -7
- package/src/border-box-control/stories/index.tsx +90 -0
- package/src/border-box-control/styles.ts +28 -22
- package/src/border-box-control/test/index.js +291 -121
- package/src/border-box-control/types.ts +12 -16
- package/src/border-control/border-control/README.md +14 -0
- package/src/border-control/border-control/component.tsx +6 -3
- package/src/border-control/border-control/hook.ts +10 -6
- package/src/border-control/border-control-dropdown/hook.ts +5 -7
- package/src/border-control/stories/index.tsx +12 -14
- package/src/border-control/styles.ts +20 -23
- package/src/border-control/test/index.js +139 -96
- package/src/border-control/types.ts +11 -9
- package/src/box-control/README.md +14 -0
- package/src/box-control/index.js +4 -0
- package/src/box-control/stories/index.js +8 -27
- package/src/button/README.md +2 -15
- package/src/button/stories/index.js +109 -178
- package/src/button/style.scss +40 -77
- package/src/button/test/index.js +3 -5
- package/src/card/stories/index.tsx +27 -31
- package/src/card/test/__snapshots__/index.tsx.snap +36 -35
- package/src/card/test/index.tsx +2 -6
- package/src/circular-option-picker/index.js +14 -20
- package/src/color-palette/README.md +51 -49
- package/src/color-palette/{index.js → index.tsx} +132 -51
- package/src/color-palette/stories/{index.js → index.tsx} +38 -27
- package/src/color-palette/style.scss +2 -2
- package/src/color-palette/{styles.js → styles.ts} +0 -0
- package/src/color-palette/test/__snapshots__/{index.js.snap → index.tsx.snap} +0 -0
- package/src/color-palette/test/{index.js → index.tsx} +1 -1
- package/src/color-palette/types.ts +93 -0
- package/src/color-picker/input-with-slider.tsx +1 -1
- package/src/combobox-control/test/index.js +1 -1
- package/src/confirm-dialog/types.ts +6 -0
- package/src/custom-gradient-picker/gradient-bar/index.js +1 -3
- package/src/custom-select-control/README.md +14 -0
- package/src/custom-select-control/index.js +22 -15
- package/src/date-time/date-time/index.tsx +2 -0
- package/src/date-time/stories/date-time.tsx +4 -0
- package/src/date-time/time/index.tsx +4 -4
- package/src/date-time/time/test/index.tsx +2 -6
- package/src/dimension-control/test/__snapshots__/index.test.js.snap +4 -0
- package/src/disabled/README.md +2 -0
- package/src/disabled/index.tsx +19 -34
- package/src/disabled/test/index.tsx +9 -82
- package/src/dropdown/test/index.js +4 -3
- package/src/external-link/index.tsx +14 -6
- package/src/external-link/test/index.tsx +106 -0
- package/src/focusable-iframe/index.js +0 -1
- package/src/font-size-picker/README.md +3 -3
- package/src/font-size-picker/index.tsx +153 -143
- package/src/font-size-picker/styles.ts +3 -1
- package/src/font-size-picker/test/index.tsx +447 -174
- package/src/font-size-picker/test/utils.ts +6 -50
- package/src/font-size-picker/types.ts +1 -1
- package/src/font-size-picker/utils.ts +1 -23
- package/src/form-file-upload/README.md +1 -3
- package/src/form-file-upload/index.tsx +1 -0
- package/src/form-file-upload/test/index.tsx +1 -1
- package/src/form-file-upload/types.ts +5 -4
- package/src/form-toggle/test/__snapshots__/index.tsx.snap +15 -13
- package/src/form-toggle/test/index.tsx +1 -1
- package/src/form-token-field/suggestions-list.tsx +5 -5
- package/src/h-stack/test/__snapshots__/index.tsx.snap +36 -30
- package/src/h-stack/test/index.tsx +3 -3
- package/src/higher-order/with-fallback-styles/index.js +6 -2
- package/src/higher-order/with-filters/index.js +4 -9
- package/src/higher-order/with-focus-outside/test/index.js +44 -45
- package/src/higher-order/with-focus-return/test/index.js +34 -30
- package/src/higher-order/with-notices/test/index.js +1 -1
- package/src/index.js +4 -2
- package/src/input-control/index.tsx +2 -0
- package/src/input-control/input-base.tsx +3 -3
- package/src/input-control/styles/input-control-styles.tsx +1 -0
- package/src/input-control/test/index.js +2 -2
- package/src/input-control/types.ts +4 -11
- package/src/isolated-event-container/index.tsx +32 -0
- package/src/item-group/styles.ts +1 -1
- package/src/item-group/test/__snapshots__/index.js.snap +90 -85
- package/src/item-group/test/index.js +8 -18
- package/src/menu-item/test/index.js +0 -3
- package/src/mobile/bottom-sheet/test/range-cell.native.js +16 -14
- package/src/modal/README.md +53 -54
- package/src/modal/{aria-helper.js → aria-helper.ts} +5 -7
- package/src/modal/{index.js → index.tsx} +48 -12
- package/src/modal/stories/{index.js → index.tsx} +47 -42
- package/src/modal/test/{aria-helper.js → aria-helper.ts} +0 -0
- package/src/modal/test/{index.js → index.tsx} +13 -3
- package/src/modal/types.ts +144 -0
- package/src/navigation/test/index.js +1 -1
- package/src/navigator/index.ts +4 -4
- package/src/navigator/navigator-back-button/component.tsx +4 -4
- package/src/navigator/navigator-back-button/index.ts +1 -1
- package/src/navigator/navigator-button/component.tsx +4 -4
- package/src/navigator/navigator-button/index.ts +1 -1
- package/src/navigator/navigator-provider/component.tsx +6 -4
- package/src/navigator/navigator-provider/index.ts +1 -1
- package/src/navigator/navigator-screen/component.tsx +17 -6
- package/src/navigator/navigator-screen/index.ts +1 -1
- package/src/navigator/stories/index.tsx +210 -0
- package/src/navigator/test/index.tsx +509 -0
- package/src/navigator/types.ts +2 -0
- package/src/notice/test/__snapshots__/index.js.snap +39 -38
- package/src/notice/test/index.js +15 -36
- package/src/notice/test/list.js +6 -14
- package/src/number-control/README.md +9 -4
- package/src/number-control/index.tsx +100 -33
- package/src/number-control/styles/number-control-styles.js +26 -1
- package/src/number-control/test/index.js +53 -2
- package/src/number-control/types.ts +12 -0
- package/src/panel/test/body.js +2 -2
- package/src/placeholder/style.scss +5 -0
- package/src/popover/README.md +12 -7
- package/src/popover/index.tsx +20 -30
- package/src/popover/stories/index.tsx +29 -1
- package/src/popover/style.scss +9 -0
- package/src/popover/types.ts +18 -15
- package/src/radio-group/README.md +4 -0
- package/src/radio-group/index.js +6 -1
- package/src/{radio → radio-group/radio}/index.js +6 -1
- package/src/{radio-context → radio-group/radio-context}/index.js +0 -0
- package/src/radio-group/stories/index.js +11 -2
- package/src/sandbox/index.js +62 -47
- package/src/sandbox/index.native.js +72 -52
- package/src/sandbox/test/index.js +8 -11
- package/src/select-control/stories/index.tsx +9 -4
- package/src/shortcut/test/index.tsx +1 -1
- package/src/slot-fill/bubbles-virtually/fill.js +5 -5
- package/src/slot-fill/bubbles-virtually/slot-fill-provider.js +5 -3
- package/src/slot-fill/bubbles-virtually/slot.js +10 -8
- package/src/slot-fill/bubbles-virtually/use-slot.js +15 -9
- package/src/slot-fill/fill.js +12 -2
- package/src/slot-fill/use-slot.js +3 -0
- package/src/snackbar/index.js +1 -1
- package/src/style.scss +4 -0
- package/src/surface/test/__snapshots__/index.tsx.snap +58 -46
- package/src/surface/test/index.tsx +6 -16
- package/src/tab-panel/index.tsx +5 -9
- package/src/tab-panel/test/index.tsx +78 -1
- package/src/text/test/__snapshots__/index.tsx.snap +19 -15
- package/src/text/test/index.tsx +2 -2
- package/src/text-control/index.tsx +0 -2
- package/src/text-control/stories/index.tsx +5 -6
- package/src/text-highlight/test/index.tsx +1 -3
- package/src/theme/README.md +34 -0
- package/src/theme/index.tsx +51 -0
- package/src/theme/stories/index.tsx +47 -0
- package/src/theme/styles.ts +28 -0
- package/src/theme/test/index.tsx +101 -0
- package/src/theme/types.ts +21 -0
- package/src/toggle-control/README.md +6 -4
- package/src/toggle-control/index.tsx +13 -2
- package/src/toggle-control/types.ts +2 -4
- package/src/toggle-group-control/stories/index.tsx +4 -4
- package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +219 -160
- package/src/toggle-group-control/test/index.tsx +129 -2
- package/src/toggle-group-control/toggle-group-control/as-button-group.tsx +103 -0
- package/src/toggle-group-control/toggle-group-control/as-radio-group.tsx +99 -0
- package/src/toggle-group-control/toggle-group-control/component.tsx +29 -74
- package/src/toggle-group-control/toggle-group-control/styles.ts +12 -10
- package/src/toggle-group-control/toggle-group-control-option-base/component.tsx +49 -25
- package/src/toggle-group-control/toggle-group-control-option-base/styles.ts +39 -19
- package/src/toggle-group-control/types.ts +75 -63
- package/src/toolbar/test/index.js +2 -2
- package/src/toolbar-dropdown-menu/index.js +1 -1
- package/src/toolbar-group/test/index.js +6 -10
- package/src/tools-panel/stories/index.js +0 -1
- package/src/tools-panel/stories/tools-panel-with-item-group-slot.js +0 -1
- package/src/tools-panel/test/index.js +4 -6
- package/src/tools-panel/tools-panel/hook.ts +2 -9
- package/src/tools-panel/tools-panel-item/hook.ts +17 -3
- package/src/tooltip/index.js +3 -0
- package/src/tooltip/index.native.js +15 -0
- package/src/tooltip/test/index.native.js +1 -2
- package/src/tree-grid/test/__snapshots__/cell.js.snap +20 -20
- package/src/tree-grid/test/__snapshots__/roving-tab-index-item.js.snap +17 -15
- package/src/tree-grid/test/__snapshots__/roving-tab-index.js.snap +3 -1
- package/src/tree-grid/test/__snapshots__/row.js.snap +33 -25
- package/src/tree-grid/test/cell.js +4 -4
- package/src/tree-grid/test/roving-tab-index-item.js +8 -8
- package/src/tree-grid/test/roving-tab-index.js +3 -3
- package/src/tree-grid/test/row.js +20 -16
- package/src/truncate/test/index.tsx +4 -4
- package/src/ui/context/context-system-provider.js +5 -18
- package/src/ui/context/test/__snapshots__/context-system-provider.js.snap +23 -17
- package/src/ui/context/test/context-system-provider.js +3 -3
- package/src/ui/control-group/test/__snapshots__/index.js.snap +18 -16
- package/src/ui/control-group/test/index.js +1 -1
- package/src/ui/control-label/test/__snapshots__/index.js.snap +27 -21
- package/src/ui/control-label/test/index.js +3 -3
- package/src/ui/form-group/test/__snapshots__/index.js.snap +34 -30
- package/src/ui/form-group/test/index.js +2 -2
- package/src/ui/shortcut/test/__snapshots__/index.js.snap +1 -1
- package/src/ui/shortcut/test/index.js +3 -2
- package/src/ui/spinner/test/__snapshots__/index.js.snap +75 -73
- package/src/ui/spinner/test/index.js +10 -13
- package/src/ui/tooltip/test/index.js +16 -14
- package/src/unit-control/index.tsx +29 -30
- package/src/unit-control/styles/unit-control-styles.ts +6 -12
- package/src/unit-control/test/utils.ts +43 -0
- package/src/unit-control/types.ts +5 -6
- package/src/utils/config-values.js +0 -1
- package/src/utils/hooks/use-update-effect.js +5 -1
- package/src/utils/theme-variables.scss +8 -0
- package/src/utils/types.ts +0 -15
- package/src/v-stack/test/__snapshots__/index.tsx.snap +36 -30
- package/src/v-stack/test/index.tsx +3 -3
- package/src/view/test/__snapshots__/index.js.snap +34 -24
- package/src/view/test/index.js +5 -5
- package/src/visually-hidden/README.md +4 -0
- package/tsconfig.json +0 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/build/radio/index.js.map +0 -1
- package/build/radio-context/index.js.map +0 -1
- package/build-module/radio/index.js.map +0 -1
- package/build-module/radio-context/index.js.map +0 -1
- package/build-types/radio-context/index.d.ts.map +0 -1
- package/src/border-box-control/stories/index.js +0 -106
- package/src/form-file-upload/stories/index.js +0 -51
- package/src/isolated-event-container/index.js +0 -28
- package/src/navigator/stories/index.js +0 -194
- package/src/navigator/test/index.js +0 -472
- package/src/radio/stories/index.js +0 -20
|
@@ -12,7 +12,7 @@ import { contextConnect } from '../../ui/context';
|
|
|
12
12
|
import { View } from '../../view';
|
|
13
13
|
import { useNavigatorBackButton } from './hook';
|
|
14
14
|
|
|
15
|
-
function
|
|
15
|
+
function UnconnectedNavigatorBackButton(props, forwardedRef) {
|
|
16
16
|
const navigatorBackButtonProps = useNavigatorBackButton(props);
|
|
17
17
|
return createElement(View, _extends({
|
|
18
18
|
ref: forwardedRef
|
|
@@ -54,6 +54,6 @@ function NavigatorBackButton(props, forwardedRef) {
|
|
|
54
54
|
*/
|
|
55
55
|
|
|
56
56
|
|
|
57
|
-
const
|
|
58
|
-
export default
|
|
57
|
+
export const NavigatorBackButton = contextConnect(UnconnectedNavigatorBackButton, 'NavigatorBackButton');
|
|
58
|
+
export default NavigatorBackButton;
|
|
59
59
|
//# sourceMappingURL=component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/navigator/navigator-back-button/component.tsx"],"names":["contextConnect","View","useNavigatorBackButton","
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/navigator/navigator-back-button/component.tsx"],"names":["contextConnect","View","useNavigatorBackButton","UnconnectedNavigatorBackButton","props","forwardedRef","navigatorBackButtonProps","NavigatorBackButton"],"mappings":";;;AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SAASA,cAAT,QAAwD,kBAAxD;AACA,SAASC,IAAT,QAAqB,YAArB;AACA,SAASC,sBAAT,QAAuC,QAAvC;;AAGA,SAASC,8BAAT,CACCC,KADD,EAECC,YAFD,EAGE;AACD,QAAMC,wBAAwB,GAAGJ,sBAAsB,CAAEE,KAAF,CAAvD;AAEA,SAAO,cAAC,IAAD;AAAM,IAAA,GAAG,EAAGC;AAAZ,KAAgCC,wBAAhC,EAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,MAAMC,mBAAmB,GAAGP,cAAc,CAChDG,8BADgD,EAEhD,qBAFgD,CAA1C;AAKP,eAAeI,mBAAf","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 { useNavigatorBackButton } from './hook';\nimport type { NavigatorBackButtonProps } from '../types';\n\nfunction UnconnectedNavigatorBackButton(\n\tprops: WordPressComponentProps< NavigatorBackButtonProps, 'button' >,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst navigatorBackButtonProps = useNavigatorBackButton( props );\n\n\treturn <View ref={ forwardedRef } { ...navigatorBackButtonProps } />;\n}\n\n/**\n * The `NavigatorBackButton` component can be used to navigate to a screen and\n * should be used in combination with the `NavigatorProvider`, the\n * `NavigatorScreen` and the `NavigatorButton` components (or the `useNavigator`\n * hook).\n *\n * @example\n * ```jsx\n * import {\n * __experimentalNavigatorProvider as NavigatorProvider,\n * __experimentalNavigatorScreen as NavigatorScreen,\n * __experimentalNavigatorButton as NavigatorButton,\n * __experimentalNavigatorBackButton as NavigatorBackButton,\n * } from '@wordpress/components';\n *\n * const MyNavigation = () => (\n * <NavigatorProvider initialPath=\"/\">\n * <NavigatorScreen path=\"/\">\n * <p>This is the home screen.</p>\n * <NavigatorButton path=\"/child\">\n * Navigate to child screen.\n * </NavigatorButton>\n * </NavigatorScreen>\n *\n * <NavigatorScreen path=\"/child\">\n * <p>This is the child screen.</p>\n * <NavigatorBackButton>\n * Go back\n * </NavigatorBackButton>\n * </NavigatorScreen>\n * </NavigatorProvider>\n * );\n * ```\n */\nexport const NavigatorBackButton = contextConnect(\n\tUnconnectedNavigatorBackButton,\n\t'NavigatorBackButton'\n);\n\nexport default NavigatorBackButton;\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default } from './component';
|
|
1
|
+
export { default as NavigatorBackButton } from './component';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/navigator/navigator-back-button/index.ts"],"names":["default"],"mappings":"AAAA,SAASA,
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/navigator/navigator-back-button/index.ts"],"names":["default","NavigatorBackButton"],"mappings":"AAAA,SAASA,OAAO,IAAIC,mBAApB,QAA+C,aAA/C","sourcesContent":["export { default as NavigatorBackButton } from './component';\n"]}
|
|
@@ -12,7 +12,7 @@ import { contextConnect } from '../../ui/context';
|
|
|
12
12
|
import { View } from '../../view';
|
|
13
13
|
import { useNavigatorButton } from './hook';
|
|
14
14
|
|
|
15
|
-
function
|
|
15
|
+
function UnconnectedNavigatorButton(props, forwardedRef) {
|
|
16
16
|
const navigatorButtonProps = useNavigatorButton(props);
|
|
17
17
|
return createElement(View, _extends({
|
|
18
18
|
ref: forwardedRef
|
|
@@ -53,6 +53,6 @@ function NavigatorButton(props, forwardedRef) {
|
|
|
53
53
|
*/
|
|
54
54
|
|
|
55
55
|
|
|
56
|
-
const
|
|
57
|
-
export default
|
|
56
|
+
export const NavigatorButton = contextConnect(UnconnectedNavigatorButton, 'NavigatorButton');
|
|
57
|
+
export default NavigatorButton;
|
|
58
58
|
//# sourceMappingURL=component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/navigator/navigator-button/component.tsx"],"names":["contextConnect","View","useNavigatorButton","
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/navigator/navigator-button/component.tsx"],"names":["contextConnect","View","useNavigatorButton","UnconnectedNavigatorButton","props","forwardedRef","navigatorButtonProps","NavigatorButton"],"mappings":";;;AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SAASA,cAAT,QAAwD,kBAAxD;AACA,SAASC,IAAT,QAAqB,YAArB;AACA,SAASC,kBAAT,QAAmC,QAAnC;;AAGA,SAASC,0BAAT,CACCC,KADD,EAECC,YAFD,EAGE;AACD,QAAMC,oBAAoB,GAAGJ,kBAAkB,CAAEE,KAAF,CAA/C;AAEA,SAAO,cAAC,IAAD;AAAM,IAAA,GAAG,EAAGC;AAAZ,KAAgCC,oBAAhC,EAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,MAAMC,eAAe,GAAGP,cAAc,CAC5CG,0BAD4C,EAE5C,iBAF4C,CAAtC;AAKP,eAAeI,eAAf","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 { useNavigatorButton } from './hook';\nimport type { NavigatorButtonProps } from '../types';\n\nfunction UnconnectedNavigatorButton(\n\tprops: WordPressComponentProps< NavigatorButtonProps, 'button' >,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst navigatorButtonProps = useNavigatorButton( props );\n\n\treturn <View ref={ forwardedRef } { ...navigatorButtonProps } />;\n}\n\n/**\n * The `NavigatorButton` component can be used to navigate to a screen and should\n * be used in combination with the `NavigatorProvider`, the `NavigatorScreen`\n * and the `NavigatorBackButton` components (or the `useNavigator` hook).\n *\n * @example\n * ```jsx\n * import {\n * __experimentalNavigatorProvider as NavigatorProvider,\n * __experimentalNavigatorScreen as NavigatorScreen,\n * __experimentalNavigatorButton as NavigatorButton,\n * __experimentalNavigatorBackButton as NavigatorBackButton,\n * } from '@wordpress/components';\n *\n * const MyNavigation = () => (\n * <NavigatorProvider initialPath=\"/\">\n * <NavigatorScreen path=\"/\">\n * <p>This is the home screen.</p>\n * <NavigatorButton path=\"/child\">\n * Navigate to child screen.\n * </NavigatorButton>\n * </NavigatorScreen>\n *\n * <NavigatorScreen path=\"/child\">\n * <p>This is the child screen.</p>\n * <NavigatorBackButton>\n * Go back\n * </NavigatorBackButton>\n * </NavigatorScreen>\n * </NavigatorProvider>\n * );\n * ```\n */\nexport const NavigatorButton = contextConnect(\n\tUnconnectedNavigatorButton,\n\t'NavigatorButton'\n);\n\nexport default NavigatorButton;\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default } from './component';
|
|
1
|
+
export { default as NavigatorButton } from './component';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/navigator/navigator-button/index.ts"],"names":["default"],"mappings":"AAAA,SAASA,
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/navigator/navigator-button/index.ts"],"names":["default","NavigatorButton"],"mappings":"AAAA,SAASA,OAAO,IAAIC,eAApB,QAA2C,aAA3C","sourcesContent":["export { default as NavigatorButton } from './component';\n"]}
|
|
@@ -27,11 +27,11 @@ var _ref = process.env.NODE_ENV === "production" ? {
|
|
|
27
27
|
} : {
|
|
28
28
|
name: "192ebb7-classes",
|
|
29
29
|
styles: "overflow-x:hidden;label:classes;",
|
|
30
|
-
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
30
|
+
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvbmF2aWdhdG9yL25hdmlnYXRvci1wcm92a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gKiB9IGZyb20gJ0B3b3JkcHJlc3MvY29tcG9uZW50cyc7XG4gKlxuICogY29uc3QgTXlOYXZpZ2F0aW9uID0gKCkgPT4gKFxuICogICA8TmF2aWdhdG9yUHJvdmlkZXIgaW5pdGlhbFBhdGg9XCIvXCI+XG4gKiAgICAgPE5hdmlnYXRvclNjcmVlbiBwYXRoPVwiL1wiPlxuICogICAgICAgPHA+VGhpcyBpcyB0aGUgaG9tZSBzY3JlZW4uPC9wPlxuICogICAgICAgIDxOYXZpZ2F0b3JCdXR0b24gcGF0aD1cIi9jaGlsZFwiPlxuICogICAgICAgICAgTmF2aWdhdGUgdG8gY2hpbGQgc2NyZWVuLlxuICogICAgICAgPC9OYXZpZ2F0b3JCdXR0b24+XG4gKiAgICAgPC9OYXZpZ2F0b3JTY3JlZW4+XG4gKlxuICogICAgIDxOYXZpZ2F0b3JTY3JlZW4gcGF0aD1cIi9jaGlsZFwiPlxuICogICAgICAgPHA+VGhpcyBpcyB0aGUgY2hpbGQgc2NyZWVuLjwvcD5cbiAqICAgICAgIDxOYXZpZ2F0b3JCYWNrQnV0dG9uPlxuICogICAgICAgICBHbyBiYWNrXG4gKiAgICAgICA8L05hdmlnYXRvckJhY2tCdXR0b24+XG4gKiAgICAgPC9OYXZpZ2F0b3JTY3JlZW4+XG4gKiAgIDwvTmF2aWdhdG9yUHJvdmlkZXI+XG4gKiApO1xuICogYGBgXG4gKi9cbmV4cG9ydCBjb25zdCBOYXZpZ2F0b3JQcm92aWRlciA9IGNvbnRleHRDb25uZWN0KFxuXHRVbmNvbm5lY3RlZE5hdmlnYXRvclByb3ZpZGVyLFxuXHQnTmF2aWdhdG9yUHJvdmlkZXInXG4pO1xuXG5leHBvcnQgZGVmYXVsdCBOYXZpZ2F0b3JQcm92aWRlcjtcbiJdfQ== */",
|
|
31
31
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
-
function
|
|
34
|
+
function UnconnectedNavigatorProvider(props, forwardedRef) {
|
|
35
35
|
const {
|
|
36
36
|
initialPath,
|
|
37
37
|
children,
|
|
@@ -45,13 +45,15 @@ function NavigatorProvider(props, forwardedRef) {
|
|
|
45
45
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
46
46
|
setLocationHistory([...locationHistory, { ...options,
|
|
47
47
|
path,
|
|
48
|
-
isBack: false
|
|
48
|
+
isBack: false,
|
|
49
|
+
hasRestoredFocus: false
|
|
49
50
|
}]);
|
|
50
51
|
}, [locationHistory]);
|
|
51
52
|
const goBack = useCallback(() => {
|
|
52
53
|
if (locationHistory.length > 1) {
|
|
53
54
|
setLocationHistory([...locationHistory.slice(0, -2), { ...locationHistory[locationHistory.length - 2],
|
|
54
|
-
isBack: true
|
|
55
|
+
isBack: true,
|
|
56
|
+
hasRestoredFocus: false
|
|
55
57
|
}]);
|
|
56
58
|
}
|
|
57
59
|
}, [locationHistory]);
|
|
@@ -108,6 +110,6 @@ function NavigatorProvider(props, forwardedRef) {
|
|
|
108
110
|
*/
|
|
109
111
|
|
|
110
112
|
|
|
111
|
-
const
|
|
112
|
-
export default
|
|
113
|
+
export const NavigatorProvider = contextConnect(UnconnectedNavigatorProvider, 'NavigatorProvider');
|
|
114
|
+
export default NavigatorProvider;
|
|
113
115
|
//# sourceMappingURL=component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/navigator/navigator-provider/component.tsx"],"names":["css","useMemo","useState","useCallback","contextConnect","useContextSystem","useCx","View","NavigatorContext","
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/navigator/navigator-provider/component.tsx"],"names":["css","useMemo","useState","useCallback","contextConnect","useContextSystem","useCx","View","NavigatorContext","UnconnectedNavigatorProvider","props","forwardedRef","initialPath","children","className","otherProps","locationHistory","setLocationHistory","path","goTo","options","isBack","hasRestoredFocus","goBack","length","slice","navigatorContextValue","location","isInitial","cx","classes","NavigatorProvider"],"mappings":";;;;;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EAAE,IAFT;AAGCC,QAAAA,gBAAgB,EAAE;AAHnB,OAFmB,CAAF,CAAlB;AAQA;AACD,GAX2D,EAWzD,CAAEN,eAAF,CAXyD,CAA5D;AAaA,QAAMU,qBAA2C,GAAGzB,OAAO,CAC1D,OAAQ;AACP0B,IAAAA,QAAQ,EAAE,EACT,GAAGX,eAAe,CAAEA,eAAe,CAACQ,MAAhB,GAAyB,CAA3B,CADT;AAETI,MAAAA,SAAS,EAAEZ,eAAe,CAACQ,MAAhB,KAA2B;AAF7B,KADH;AAKPL,IAAAA,IALO;AAMPI,IAAAA;AANO,GAAR,CAD0D,EAS1D,CAAEP,eAAF,EAAmBG,IAAnB,EAAyBI,MAAzB,CAT0D,CAA3D;AAYA,QAAMM,EAAE,GAAGvB,KAAK,EAAhB;AACA,QAAMwB,OAAO,GAAG7B,OAAO,EACtB;AACA,QAAM4B,EAAE,OAAkCf,SAAlC,CAFc,EAGtB,CAAEA,SAAF,EAAae,EAAb,CAHsB,CAAvB;AAMA,SACC,cAAC,IAAD;AAAM,IAAA,GAAG,EAAGlB,YAAZ;AAA2B,IAAA,SAAS,EAAGmB;AAAvC,KAAsDf,UAAtD,GACC,cAAC,gBAAD,CAAkB,QAAlB;AAA2B,IAAA,KAAK,EAAGW;AAAnC,KACGb,QADH,CADD,CADD;AAOA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,MAAMkB,iBAAiB,GAAG3B,cAAc,CAC9CK,4BAD8C,EAE9C,mBAF8C,CAAxC;AAKP,eAAesB,iBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\nimport { css } from '@emotion/react';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo, useState, useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tcontextConnect,\n\tuseContextSystem,\n\tWordPressComponentProps,\n} from '../../ui/context';\nimport { useCx } from '../../utils/hooks/use-cx';\nimport { View } from '../../view';\nimport { NavigatorContext } from '../context';\nimport type {\n\tNavigatorProviderProps,\n\tNavigatorLocation,\n\tNavigatorContext as NavigatorContextType,\n} from '../types';\n\nfunction UnconnectedNavigatorProvider(\n\tprops: WordPressComponentProps< NavigatorProviderProps, 'div' >,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst { initialPath, children, className, ...otherProps } =\n\t\tuseContextSystem( props, 'NavigatorProvider' );\n\n\tconst [ locationHistory, setLocationHistory ] = useState<\n\t\tNavigatorLocation[]\n\t>( [\n\t\t{\n\t\t\tpath: initialPath,\n\t\t},\n\t] );\n\n\tconst goTo: NavigatorContextType[ 'goTo' ] = useCallback(\n\t\t( path, options = {} ) => {\n\t\t\tsetLocationHistory( [\n\t\t\t\t...locationHistory,\n\t\t\t\t{\n\t\t\t\t\t...options,\n\t\t\t\t\tpath,\n\t\t\t\t\tisBack: false,\n\t\t\t\t\thasRestoredFocus: false,\n\t\t\t\t},\n\t\t\t] );\n\t\t},\n\t\t[ locationHistory ]\n\t);\n\n\tconst goBack: NavigatorContextType[ 'goBack' ] = useCallback( () => {\n\t\tif ( locationHistory.length > 1 ) {\n\t\t\tsetLocationHistory( [\n\t\t\t\t...locationHistory.slice( 0, -2 ),\n\t\t\t\t{\n\t\t\t\t\t...locationHistory[ locationHistory.length - 2 ],\n\t\t\t\t\tisBack: true,\n\t\t\t\t\thasRestoredFocus: false,\n\t\t\t\t},\n\t\t\t] );\n\t\t}\n\t}, [ locationHistory ] );\n\n\tconst navigatorContextValue: NavigatorContextType = useMemo(\n\t\t() => ( {\n\t\t\tlocation: {\n\t\t\t\t...locationHistory[ locationHistory.length - 1 ],\n\t\t\t\tisInitial: locationHistory.length === 1,\n\t\t\t},\n\t\t\tgoTo,\n\t\t\tgoBack,\n\t\t} ),\n\t\t[ locationHistory, goTo, goBack ]\n\t);\n\n\tconst cx = useCx();\n\tconst classes = useMemo(\n\t\t// Prevents horizontal overflow while animating screen transitions.\n\t\t() => cx( css( { overflowX: 'hidden' } ), className ),\n\t\t[ className, cx ]\n\t);\n\n\treturn (\n\t\t<View ref={ forwardedRef } className={ classes } { ...otherProps }>\n\t\t\t<NavigatorContext.Provider value={ navigatorContextValue }>\n\t\t\t\t{ children }\n\t\t\t</NavigatorContext.Provider>\n\t\t</View>\n\t);\n}\n\n/**\n * The `NavigatorProvider` component allows rendering nested views/panels/menus\n * (via the `NavigatorScreen` component and navigate between these different\n * view (via the `NavigatorButton` and `NavigatorBackButton` components or the\n * `useNavigator` hook).\n *\n * @example\n * ```jsx\n * import {\n * __experimentalNavigatorProvider as NavigatorProvider,\n * __experimentalNavigatorScreen as NavigatorScreen,\n * __experimentalNavigatorButton as NavigatorButton,\n * __experimentalNavigatorBackButton as NavigatorBackButton,\n * } from '@wordpress/components';\n *\n * const MyNavigation = () => (\n * <NavigatorProvider initialPath=\"/\">\n * <NavigatorScreen path=\"/\">\n * <p>This is the home screen.</p>\n * <NavigatorButton path=\"/child\">\n * Navigate to child screen.\n * </NavigatorButton>\n * </NavigatorScreen>\n *\n * <NavigatorScreen path=\"/child\">\n * <p>This is the child screen.</p>\n * <NavigatorBackButton>\n * Go back\n * </NavigatorBackButton>\n * </NavigatorScreen>\n * </NavigatorProvider>\n * );\n * ```\n */\nexport const NavigatorProvider = contextConnect(\n\tUnconnectedNavigatorProvider,\n\t'NavigatorProvider'\n);\n\nexport default NavigatorProvider;\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default } from './component';
|
|
1
|
+
export { default as NavigatorProvider } from './component';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/navigator/navigator-provider/index.ts"],"names":["default"],"mappings":"AAAA,SAASA,
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/navigator/navigator-provider/index.ts"],"names":["default","NavigatorProvider"],"mappings":"AAAA,SAASA,OAAO,IAAIC,iBAApB,QAA6C,aAA7C","sourcesContent":["export { default as NavigatorProvider } from './component';\n"]}
|
|
@@ -38,11 +38,11 @@ var _ref = process.env.NODE_ENV === "production" ? {
|
|
|
38
38
|
} : {
|
|
39
39
|
name: "1ulogbc-classes",
|
|
40
40
|
styles: "overflow-x:auto;max-height:100%;label:classes;",
|
|
41
|
-
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
41
|
+
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvbmF2aWdhdG9yL25hdmlnYXRvci1zY3JlZW4vY29tcG9uZW50LnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFrRUkiLCJmaWxlIjoiQHdvcmRwcmVzcy9jb21wb25lbnRzL3NyYy9uYXZpZ2F0b3IvbmF2aWdhdG9yLXNjcmVlbi9jb21wb25lbnQudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBFeHRlcm5hbCBkZXBlbmRlbmNpZXNcbiAqL1xuaW1wb3J0IHR5cGUgeyBGb3J3YXJkZWRSZWYgfSBmcm9tICdyZWFjdCc7XG4vLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgbm8tcmVzdHJpY3RlZC1pbXBvcnRzXG5pbXBvcnQgeyBtb3Rpb24sIE1vdGlvblByb3BzIH0gZnJvbSAnZnJhbWVyLW1vdGlvbic7XG5pbXBvcnQgeyBjc3MgfSBmcm9tICdAZW1vdGlvbi9yZWFjdCc7XG5cbi8qKlxuICogV29yZFByZXNzIGRlcGVuZGVuY2llc1xuICovXG5pbXBvcnQgeyBmb2N1cyB9IGZyb20gJ0B3b3JkcHJlc3MvZG9tJztcbmltcG9ydCB7IHVzZUNvbnRleHQsIHVzZUVmZmVjd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pZGVyIGluaXRpYWxQYXRoPVwiL1wiPlxuICogICAgIDxOYXZpZ2F0b3JTY3JlZW4gcGF0aD1cIi9cIj5cbiAqICAgICAgIDxwPlRoaXMgaXMgdGhlIGhvbWUgc2NyZWVuLjwvcD5cbiAqICAgICAgICA8TmF2aWdhdG9yQnV0dG9uIHBhdGg9XCIvY2hpbGRcIj5cbiAqICAgICAgICAgIE5hdmlnYXRlIHRvIGNoaWxkIHNjcmVlbi5cbiAqICAgICAgIDwvTmF2aWdhdG9yQnV0dG9uPlxuICogICAgIDwvTmF2aWdhdG9yU2NyZWVuPlxuICpcbiAqICAgICA8TmF2aWdhdG9yU2NyZWVuIHBhdGg9XCIvY2hpbGRcIj5cbiAqICAgICAgIDxwPlRoaXMgaXMgdGhlIGNoaWxkIHNjcmVlbi48L3A+XG4gKiAgICAgICA8TmF2aWdhdG9yQmFja0J1dHRvbj5cbiAqICAgICAgICAgR28gYmFja1xuICogICAgICAgPC9OYXZpZ2F0b3JCYWNrQnV0dG9uPlxuICogICAgIDwvTmF2aWdhdG9yU2NyZWVuPlxuICogICA8L05hdmlnYXRvclByb3ZpZGVyPlxuICogKTtcbiAqIGBgYFxuICovXG5leHBvcnQgY29uc3QgTmF2aWdhdG9yU2NyZWVuID0gY29udGV4dENvbm5lY3QoXG5cdFVuY29ubmVjdGVkTmF2aWdhdG9yU2NyZWVuLFxuXHQnTmF2aWdhdG9yU2NyZWVuJ1xuKTtcblxuZXhwb3J0IGRlZmF1bHQgTmF2aWdhdG9yU2NyZWVuO1xuIl19 */",
|
|
42
42
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
-
function
|
|
45
|
+
function UnconnectedNavigatorScreen(props, forwardedRef) {
|
|
46
46
|
const {
|
|
47
47
|
children,
|
|
48
48
|
className,
|
|
@@ -65,12 +65,13 @@ function NavigatorScreen(props, forwardedRef) {
|
|
|
65
65
|
// - if the current location is not the initial one (to avoid moving focus on page load)
|
|
66
66
|
// - when the screen becomes visible
|
|
67
67
|
// - if the wrapper ref has been assigned
|
|
68
|
-
if
|
|
68
|
+
// - if focus hasn't already been restored for the current location
|
|
69
|
+
if (isInitialLocation || !isMatch || !wrapperRef.current || location.hasRestoredFocus) {
|
|
69
70
|
return;
|
|
70
71
|
}
|
|
71
72
|
|
|
72
73
|
const activeElement = wrapperRef.current.ownerDocument.activeElement; // If an element is already focused within the wrapper do not focus the
|
|
73
|
-
// element. This prevents inputs or buttons from losing focus
|
|
74
|
+
// element. This prevents inputs or buttons from losing focus unnecessarily.
|
|
74
75
|
|
|
75
76
|
if (wrapperRef.current.contains(activeElement)) {
|
|
76
77
|
return;
|
|
@@ -90,8 +91,9 @@ function NavigatorScreen(props, forwardedRef) {
|
|
|
90
91
|
elementToFocus = firstTabbable !== null && firstTabbable !== void 0 ? firstTabbable : wrapperRef.current;
|
|
91
92
|
}
|
|
92
93
|
|
|
94
|
+
location.hasRestoredFocus = true;
|
|
93
95
|
elementToFocus.focus();
|
|
94
|
-
}, [isInitialLocation, isMatch, location.isBack, previousLocation === null || previousLocation === void 0 ? void 0 : previousLocation.focusTargetSelector]);
|
|
96
|
+
}, [isInitialLocation, isMatch, location.hasRestoredFocus, location.isBack, previousLocation === null || previousLocation === void 0 ? void 0 : previousLocation.focusTargetSelector]);
|
|
95
97
|
const mergedWrapperRef = useMergeRefs([forwardedRef, wrapperRef]);
|
|
96
98
|
|
|
97
99
|
if (!isMatch) {
|
|
@@ -173,6 +175,6 @@ function NavigatorScreen(props, forwardedRef) {
|
|
|
173
175
|
*/
|
|
174
176
|
|
|
175
177
|
|
|
176
|
-
const
|
|
177
|
-
export default
|
|
178
|
+
export const NavigatorScreen = contextConnect(UnconnectedNavigatorScreen, 'NavigatorScreen');
|
|
179
|
+
export default NavigatorScreen;
|
|
178
180
|
//# sourceMappingURL=component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/navigator/navigator-screen/component.tsx"],"names":["motion","css","focus","useContext","useEffect","useMemo","useRef","useReducedMotion","useMergeRefs","usePrevious","isRTL","escapeAttribute","contextConnect","useContextSystem","useCx","View","NavigatorContext","animationEnterDelay","animationEnterDuration","animationExitDuration","animationExitDelay","NavigatorScreen","props","forwardedRef","children","className","path","otherProps","prefersReducedMotion","location","isMatch","wrapperRef","previousLocation","cx","classes","isInitialLocation","isInitial","isBack","current","activeElement","ownerDocument","contains","elementToFocus","focusTargetSelector","querySelector","firstTabbable","tabbable","find","mergedWrapperRef","animate","opacity","transition","delay","duration","ease","x","initial","exit","animatedProps","ConnectedNavigatorScreen"],"mappings":";;;;;AAAA;AACA;AACA;AAEA;AACA,SAASA,MAAT,QAAoC,eAApC;AACA,SAASC,GAAT,QAAoB,gBAApB;AAEA;AACA;AACA;;AACA,SAASC,KAAT,QAAsB,gBAAtB;AACA,SAASC,UAAT,EAAqBC,SAArB,EAAgCC,OAAhC,EAAyCC,MAAzC,QAAuD,oBAAvD;AACA,SACCC,gBADD,EAECC,YAFD,EAGCC,WAHD,QAIO,oBAJP;AAKA,SAASC,KAAT,QAAsB,iBAAtB;AACA,SAASC,eAAT,QAAgC,wBAAhC;AAEA;AACA;AACA;;AACA,SACCC,cADD,EAECC,gBAFD,QAIO,kBAJP;AAKA,SAASC,KAAT,QAAsB,0BAAtB;AACA,SAASC,IAAT,QAAqB,YAArB;AACA,SAASC,gBAAT,QAAiC,YAAjC;AAGA,MAAMC,mBAAmB,GAAG,CAA5B;AACA,MAAMC,sBAAsB,GAAG,IAA/B;AACA,MAAMC,qBAAqB,GAAG,IAA9B;AACA,MAAMC,kBAAkB,GAAG,CAA3B,C,CAEA;AACA;;;;;;;;;;;;AAMA,SAASC,eAAT,CAA0BC,KAA1B,EAAwCC,YAAxC,EAA4E;AAC3E,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,SAAZ;AAAuBC,IAAAA,IAAvB;AAA6B,OAAGC;AAAhC,MAA+Cd,gBAAgB,CACpES,KADo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AGZK,IAAAA,CAAC,EACE,CAAE7C,KAAK,EAAP,IAAamB,QAAQ,CAACQ,MAAxB,IAAsC3B,KAAK,MAAM,CAAEmB,QAAQ,CAACQ,MAA5D,GACG,EADH,GAEG,CAAC,EANO;AAOZc,IAAAA,UAAU,EAAE;AACXE,MAAAA,QAAQ,EAAElC,qBADC;AAEXmC,MAAAA,IAAI,EAAE;AAFK;AAPA,GAAb;AAaA,QAAMI,aAAa,GAAG;AACrBT,IAAAA,OADqB;AAErBQ,IAAAA,IAFqB;AAGrBD,IAAAA;AAHqB,GAAtB;AAMA,SACC,cAAC,MAAD,CAAQ,GAAR;AACC,IAAA,GAAG,EAAGR,gBADP;AAEC,IAAA,SAAS,EAAGd;AAFb,KAGMP,UAHN,EAIM+B,aAJN,GAMGlC,QANH,CADD;AAUA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAMmC,wBAAwB,GAAG/C,cAAc,CAC9CS,eAD8C,EAE9C,iBAF8C,CAA/C;AAKA,eAAesC,wBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n// eslint-disable-next-line no-restricted-imports\nimport { motion, MotionProps } from 'framer-motion';\nimport { css } from '@emotion/react';\n\n/**\n * WordPress dependencies\n */\nimport { focus } from '@wordpress/dom';\nimport { useContext, useEffect, useMemo, useRef } from '@wordpress/element';\nimport {\n\tuseReducedMotion,\n\tuseMergeRefs,\n\tusePrevious,\n} from '@wordpress/compose';\nimport { isRTL } from '@wordpress/i18n';\nimport { escapeAttribute } from '@wordpress/escape-html';\n\n/**\n * Internal dependencies\n */\nimport {\n\tcontextConnect,\n\tuseContextSystem,\n\tWordPressComponentProps,\n} from '../../ui/context';\nimport { useCx } from '../../utils/hooks/use-cx';\nimport { View } from '../../view';\nimport { NavigatorContext } from '../context';\nimport type { NavigatorScreenProps } from '../types';\n\nconst animationEnterDelay = 0;\nconst animationEnterDuration = 0.14;\nconst animationExitDuration = 0.14;\nconst animationExitDelay = 0;\n\n// Props specific to `framer-motion` can't be currently passed to `NavigatorScreen`,\n// as some of them would overlap with HTML props (e.g. `onAnimationStart`, ...)\ntype Props = Omit<\n\tWordPressComponentProps< NavigatorScreenProps, 'div', false >,\n\tkeyof MotionProps\n>;\n\nfunction NavigatorScreen( props: Props, forwardedRef: ForwardedRef< any > ) {\n\tconst { children, className, path, ...otherProps } = useContextSystem(\n\t\tprops,\n\t\t'NavigatorScreen'\n\t);\n\n\tconst prefersReducedMotion = useReducedMotion();\n\tconst { location } = useContext( NavigatorContext );\n\tconst isMatch = location.path === escapeAttribute( path );\n\tconst wrapperRef = useRef< HTMLDivElement >( null );\n\n\tconst previousLocation = usePrevious( location );\n\n\tconst cx = useCx();\n\tconst classes = useMemo(\n\t\t() =>\n\t\t\tcx(\n\t\t\t\tcss( {\n\t\t\t\t\t// Ensures horizontal overflow is visually accessible.\n\t\t\t\t\toverflowX: 'auto',\n\t\t\t\t\t// In case the root has a height, it should not be exceeded.\n\t\t\t\t\tmaxHeight: '100%',\n\t\t\t\t} ),\n\t\t\t\tclassName\n\t\t\t),\n\t\t[ className, cx ]\n\t);\n\n\t// Focus restoration\n\tconst isInitialLocation = location.isInitial && ! location.isBack;\n\tuseEffect( () => {\n\t\t// Only attempt to restore focus:\n\t\t// - if the current location is not the initial one (to avoid moving focus on page load)\n\t\t// - when the screen becomes visible\n\t\t// - if the wrapper ref has been assigned\n\t\tif ( isInitialLocation || ! isMatch || ! wrapperRef.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst activeElement = wrapperRef.current.ownerDocument.activeElement;\n\n\t\t// If an element is already focused within the wrapper do not focus the\n\t\t// element. This prevents inputs or buttons from losing focus unecessarily.\n\t\tif ( wrapperRef.current.contains( activeElement ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet elementToFocus: HTMLElement | null = null;\n\n\t\t// When navigating back, if a selector is provided, use it to look for the\n\t\t// target element (assumed to be a node inside the current NavigatorScreen)\n\t\tif ( location.isBack && previousLocation?.focusTargetSelector ) {\n\t\t\telementToFocus = wrapperRef.current.querySelector(\n\t\t\t\tpreviousLocation.focusTargetSelector\n\t\t\t);\n\t\t}\n\n\t\t// If the previous query didn't run or find any element to focus, fallback\n\t\t// to the first tabbable element in the screen (or the screen itself).\n\t\tif ( ! elementToFocus ) {\n\t\t\tconst firstTabbable = (\n\t\t\t\tfocus.tabbable.find( wrapperRef.current ) as HTMLElement[]\n\t\t\t )[ 0 ];\n\t\t\telementToFocus = firstTabbable ?? wrapperRef.current;\n\t\t}\n\n\t\telementToFocus.focus();\n\t}, [\n\t\tisInitialLocation,\n\t\tisMatch,\n\t\tlocation.isBack,\n\t\tpreviousLocation?.focusTargetSelector,\n\t] );\n\n\tconst mergedWrapperRef = useMergeRefs( [ forwardedRef, wrapperRef ] );\n\n\tif ( ! isMatch ) {\n\t\treturn null;\n\t}\n\n\tif ( prefersReducedMotion ) {\n\t\treturn (\n\t\t\t<View\n\t\t\t\tref={ mergedWrapperRef }\n\t\t\t\tclassName={ classes }\n\t\t\t\t{ ...otherProps }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</View>\n\t\t);\n\t}\n\n\tconst animate = {\n\t\topacity: 1,\n\t\ttransition: {\n\t\t\tdelay: animationEnterDelay,\n\t\t\tduration: animationEnterDuration,\n\t\t\tease: 'easeInOut',\n\t\t},\n\t\tx: 0,\n\t};\n\tconst initial = {\n\t\topacity: 0,\n\t\tx:\n\t\t\t( isRTL() && location.isBack ) || ( ! isRTL() && ! location.isBack )\n\t\t\t\t? 50\n\t\t\t\t: -50,\n\t};\n\tconst exit = {\n\t\tdelay: animationExitDelay,\n\t\topacity: 0,\n\t\tx:\n\t\t\t( ! isRTL() && location.isBack ) || ( isRTL() && ! location.isBack )\n\t\t\t\t? 50\n\t\t\t\t: -50,\n\t\ttransition: {\n\t\t\tduration: animationExitDuration,\n\t\t\tease: 'easeInOut',\n\t\t},\n\t};\n\n\tconst animatedProps = {\n\t\tanimate,\n\t\texit,\n\t\tinitial,\n\t};\n\n\treturn (\n\t\t<motion.div\n\t\t\tref={ mergedWrapperRef }\n\t\t\tclassName={ classes }\n\t\t\t{ ...otherProps }\n\t\t\t{ ...animatedProps }\n\t\t>\n\t\t\t{ children }\n\t\t</motion.div>\n\t);\n}\n\n/**\n * The `NavigatorScreen` component represents a single view/screen/panel and\n * should be used in combination with the `NavigatorProvider`, the\n * `NavigatorButton` and the `NavigatorBackButton` components (or the `useNavigator`\n * hook).\n *\n * @example\n * ```jsx\n * import {\n * __experimentalNavigatorProvider as NavigatorProvider,\n * __experimentalNavigatorScreen as NavigatorScreen,\n * __experimentalNavigatorButton as NavigatorButton,\n * __experimentalNavigatorBackButton as NavigatorBackButton,\n * } from '@wordpress/components';\n *\n * const MyNavigation = () => (\n * <NavigatorProvider initialPath=\"/\">\n * <NavigatorScreen path=\"/\">\n * <p>This is the home screen.</p>\n * <NavigatorButton path=\"/child\">\n * Navigate to child screen.\n * </NavigatorButton>\n * </NavigatorScreen>\n *\n * <NavigatorScreen path=\"/child\">\n * <p>This is the child screen.</p>\n * <NavigatorBackButton>\n * Go back\n * </NavigatorBackButton>\n * </NavigatorScreen>\n * </NavigatorProvider>\n * );\n * ```\n */\nconst ConnectedNavigatorScreen = contextConnect(\n\tNavigatorScreen,\n\t'NavigatorScreen'\n);\n\nexport default ConnectedNavigatorScreen;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/navigator/navigator-screen/component.tsx"],"names":["motion","css","focus","useContext","useEffect","useMemo","useRef","useReducedMotion","useMergeRefs","usePrevious","isRTL","escapeAttribute","contextConnect","useContextSystem","useCx","View","NavigatorContext","animationEnterDelay","animationEnterDuration","animationExitDuration","animationExitDelay","UnconnectedNavigatorScreen","props","forwardedRef","children","className","path","otherProps","prefersReducedMotion","location","isMatch","wrapperRef","previousLocation","cx","classes","isInitialLocation","isInitial","isBack","current","hasRestoredFocus","activeElement","ownerDocument","contains","elementToFocus","focusTargetSelector","querySelector","firstTabbable","tabbable","find","mergedWrapperRef","animate","opacity","transition","delay","duration","ease","x","initial","exit","animatedProps","NavigatorScreen"],"mappings":";;;;;AAAA;AACA;AACA;AAEA;AACA,SAASA,MAAT,QAAoC,eAApC;AACA,SAASC,GAAT,QAAoB,gBAApB;AAEA;AACA;AACA;;AACA,SAASC,KAAT,QAAsB,gBAAtB;AACA,SAASC,UAAT,EAAqBC,SAArB,EAAgCC,OAAhC,EAAyCC,MAAzC,QAAuD,oBAAvD;AACA,SACCC,gBADD,EAECC,YAFD,EAGCC,WAHD,QAIO,oBAJP;AAKA,SAASC,KAAT,QAAsB,iBAAtB;AACA,SAASC,eAAT,QAAgC,wBAAhC;AAEA;AACA;AACA;;AACA,SACCC,cADD,EAECC,gBAFD,QAIO,kBAJP;AAKA,SAASC,KAAT,QAAsB,0BAAtB;AACA,SAASC,IAAT,QAAqB,YAArB;AACA,SAASC,gBAAT,QAAiC,YAAjC;AAGA,MAAMC,mBAAmB,GAAG,CAA5B;AACA,MAAMC,sBAAsB,GAAG,IAA/B;AACA,MAAMC,qBAAqB,GAAG,IAA9B;AACA,MAAMC,kBAAkB,GAAG,CAA3B,C,CAEA;AACA;;;;;;;;;;;;AAMA,SAASC,0BAAT,CACCC,KADD,EAECC,YAFD,EAGE;AACD,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,SAAZ;AAAuBC,IAAAA,IAAvB;AAA6B,OAAGC;AAAhC,MAA+Cd,gBAAgB,CACpES,KADoE,EAEpE,iBAFoE,CAArE;AAKA,QAAMM,oBAAoB,GAAGrB,gBAAgB,EAA7C;AACA,QAAM;AAAEsB,IAAAA;AAAF,MAAe1B,UAAU,CAAEa,gBAAF,CAA/B;AACA,QAAMc,OAAO,GAAGD,QAAQ,CAACH,IAAT,KAAkBf,eAAe,CAAEe,IAA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CAACQ,MAA5D,GACG,EADH,GAEG,CAAC,EANO;AAOZe,IAAAA,UAAU,EAAE;AACXE,MAAAA,QAAQ,EAAEnC,qBADC;AAEXoC,MAAAA,IAAI,EAAE;AAFK;AAPA,GAAb;AAaA,QAAMI,aAAa,GAAG;AACrBT,IAAAA,OADqB;AAErBQ,IAAAA,IAFqB;AAGrBD,IAAAA;AAHqB,GAAtB;AAMA,SACC,cAAC,MAAD,CAAQ,GAAR;AACC,IAAA,GAAG,EAAGR,gBADP;AAEC,IAAA,SAAS,EAAGf;AAFb,KAGMP,UAHN,EAIMgC,aAJN,GAMGnC,QANH,CADD;AAUA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,MAAMoC,eAAe,GAAGhD,cAAc,CAC5CS,0BAD4C,EAE5C,iBAF4C,CAAtC;AAKP,eAAeuC,eAAf","sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n// eslint-disable-next-line no-restricted-imports\nimport { motion, MotionProps } from 'framer-motion';\nimport { css } from '@emotion/react';\n\n/**\n * WordPress dependencies\n */\nimport { focus } from '@wordpress/dom';\nimport { useContext, useEffect, useMemo, useRef } from '@wordpress/element';\nimport {\n\tuseReducedMotion,\n\tuseMergeRefs,\n\tusePrevious,\n} from '@wordpress/compose';\nimport { isRTL } from '@wordpress/i18n';\nimport { escapeAttribute } from '@wordpress/escape-html';\n\n/**\n * Internal dependencies\n */\nimport {\n\tcontextConnect,\n\tuseContextSystem,\n\tWordPressComponentProps,\n} from '../../ui/context';\nimport { useCx } from '../../utils/hooks/use-cx';\nimport { View } from '../../view';\nimport { NavigatorContext } from '../context';\nimport type { NavigatorScreenProps } from '../types';\n\nconst animationEnterDelay = 0;\nconst animationEnterDuration = 0.14;\nconst animationExitDuration = 0.14;\nconst animationExitDelay = 0;\n\n// Props specific to `framer-motion` can't be currently passed to `NavigatorScreen`,\n// as some of them would overlap with HTML props (e.g. `onAnimationStart`, ...)\ntype Props = Omit<\n\tWordPressComponentProps< NavigatorScreenProps, 'div', false >,\n\tkeyof MotionProps\n>;\n\nfunction UnconnectedNavigatorScreen(\n\tprops: Props,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst { children, className, path, ...otherProps } = useContextSystem(\n\t\tprops,\n\t\t'NavigatorScreen'\n\t);\n\n\tconst prefersReducedMotion = useReducedMotion();\n\tconst { location } = useContext( NavigatorContext );\n\tconst isMatch = location.path === escapeAttribute( path );\n\tconst wrapperRef = useRef< HTMLDivElement >( null );\n\n\tconst previousLocation = usePrevious( location );\n\n\tconst cx = useCx();\n\tconst classes = useMemo(\n\t\t() =>\n\t\t\tcx(\n\t\t\t\tcss( {\n\t\t\t\t\t// Ensures horizontal overflow is visually accessible.\n\t\t\t\t\toverflowX: 'auto',\n\t\t\t\t\t// In case the root has a height, it should not be exceeded.\n\t\t\t\t\tmaxHeight: '100%',\n\t\t\t\t} ),\n\t\t\t\tclassName\n\t\t\t),\n\t\t[ className, cx ]\n\t);\n\n\t// Focus restoration\n\tconst isInitialLocation = location.isInitial && ! location.isBack;\n\tuseEffect( () => {\n\t\t// Only attempt to restore focus:\n\t\t// - if the current location is not the initial one (to avoid moving focus on page load)\n\t\t// - when the screen becomes visible\n\t\t// - if the wrapper ref has been assigned\n\t\t// - if focus hasn't already been restored for the current location\n\t\tif (\n\t\t\tisInitialLocation ||\n\t\t\t! isMatch ||\n\t\t\t! wrapperRef.current ||\n\t\t\tlocation.hasRestoredFocus\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst activeElement = wrapperRef.current.ownerDocument.activeElement;\n\n\t\t// If an element is already focused within the wrapper do not focus the\n\t\t// element. This prevents inputs or buttons from losing focus unnecessarily.\n\t\tif ( wrapperRef.current.contains( activeElement ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet elementToFocus: HTMLElement | null = null;\n\n\t\t// When navigating back, if a selector is provided, use it to look for the\n\t\t// target element (assumed to be a node inside the current NavigatorScreen)\n\t\tif ( location.isBack && previousLocation?.focusTargetSelector ) {\n\t\t\telementToFocus = wrapperRef.current.querySelector(\n\t\t\t\tpreviousLocation.focusTargetSelector\n\t\t\t);\n\t\t}\n\n\t\t// If the previous query didn't run or find any element to focus, fallback\n\t\t// to the first tabbable element in the screen (or the screen itself).\n\t\tif ( ! elementToFocus ) {\n\t\t\tconst firstTabbable = (\n\t\t\t\tfocus.tabbable.find( wrapperRef.current ) as HTMLElement[]\n\t\t\t )[ 0 ];\n\t\t\telementToFocus = firstTabbable ?? wrapperRef.current;\n\t\t}\n\n\t\tlocation.hasRestoredFocus = true;\n\t\telementToFocus.focus();\n\t}, [\n\t\tisInitialLocation,\n\t\tisMatch,\n\t\tlocation.hasRestoredFocus,\n\t\tlocation.isBack,\n\t\tpreviousLocation?.focusTargetSelector,\n\t] );\n\n\tconst mergedWrapperRef = useMergeRefs( [ forwardedRef, wrapperRef ] );\n\n\tif ( ! isMatch ) {\n\t\treturn null;\n\t}\n\n\tif ( prefersReducedMotion ) {\n\t\treturn (\n\t\t\t<View\n\t\t\t\tref={ mergedWrapperRef }\n\t\t\t\tclassName={ classes }\n\t\t\t\t{ ...otherProps }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</View>\n\t\t);\n\t}\n\n\tconst animate = {\n\t\topacity: 1,\n\t\ttransition: {\n\t\t\tdelay: animationEnterDelay,\n\t\t\tduration: animationEnterDuration,\n\t\t\tease: 'easeInOut',\n\t\t},\n\t\tx: 0,\n\t};\n\tconst initial = {\n\t\topacity: 0,\n\t\tx:\n\t\t\t( isRTL() && location.isBack ) || ( ! isRTL() && ! location.isBack )\n\t\t\t\t? 50\n\t\t\t\t: -50,\n\t};\n\tconst exit = {\n\t\tdelay: animationExitDelay,\n\t\topacity: 0,\n\t\tx:\n\t\t\t( ! isRTL() && location.isBack ) || ( isRTL() && ! location.isBack )\n\t\t\t\t? 50\n\t\t\t\t: -50,\n\t\ttransition: {\n\t\t\tduration: animationExitDuration,\n\t\t\tease: 'easeInOut',\n\t\t},\n\t};\n\n\tconst animatedProps = {\n\t\tanimate,\n\t\texit,\n\t\tinitial,\n\t};\n\n\treturn (\n\t\t<motion.div\n\t\t\tref={ mergedWrapperRef }\n\t\t\tclassName={ classes }\n\t\t\t{ ...otherProps }\n\t\t\t{ ...animatedProps }\n\t\t>\n\t\t\t{ children }\n\t\t</motion.div>\n\t);\n}\n\n/**\n * The `NavigatorScreen` component represents a single view/screen/panel and\n * should be used in combination with the `NavigatorProvider`, the\n * `NavigatorButton` and the `NavigatorBackButton` components (or the `useNavigator`\n * hook).\n *\n * @example\n * ```jsx\n * import {\n * __experimentalNavigatorProvider as NavigatorProvider,\n * __experimentalNavigatorScreen as NavigatorScreen,\n * __experimentalNavigatorButton as NavigatorButton,\n * __experimentalNavigatorBackButton as NavigatorBackButton,\n * } from '@wordpress/components';\n *\n * const MyNavigation = () => (\n * <NavigatorProvider initialPath=\"/\">\n * <NavigatorScreen path=\"/\">\n * <p>This is the home screen.</p>\n * <NavigatorButton path=\"/child\">\n * Navigate to child screen.\n * </NavigatorButton>\n * </NavigatorScreen>\n *\n * <NavigatorScreen path=\"/child\">\n * <p>This is the child screen.</p>\n * <NavigatorBackButton>\n * Go back\n * </NavigatorBackButton>\n * </NavigatorScreen>\n * </NavigatorProvider>\n * );\n * ```\n */\nexport const NavigatorScreen = contextConnect(\n\tUnconnectedNavigatorScreen,\n\t'NavigatorScreen'\n);\n\nexport default NavigatorScreen;\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default } from './component';
|
|
1
|
+
export { default as NavigatorScreen } from './component';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/navigator/navigator-screen/index.ts"],"names":["default"],"mappings":"AAAA,SAASA,
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/navigator/navigator-screen/index.ts"],"names":["default","NavigatorScreen"],"mappings":"AAAA,SAASA,OAAO,IAAIC,eAApB,QAA2C,aAA3C","sourcesContent":["export { default as NavigatorScreen } from './component';\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import { createElement } from "@wordpress/element";
|
|
2
|
+
import { createElement, Fragment } from "@wordpress/element";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* External dependencies
|
|
@@ -9,23 +9,31 @@ import classNames from 'classnames';
|
|
|
9
9
|
/**
|
|
10
10
|
* WordPress dependencies
|
|
11
11
|
*/
|
|
12
|
-
import { forwardRef } from '@wordpress/element';
|
|
13
|
-
import { isRTL } from '@wordpress/i18n';
|
|
12
|
+
import { useRef, forwardRef } from '@wordpress/element';
|
|
13
|
+
import { isRTL, __ } from '@wordpress/i18n';
|
|
14
|
+
import { plus as plusIcon, reset as resetIcon } from '@wordpress/icons';
|
|
15
|
+
import { useMergeRefs } from '@wordpress/compose';
|
|
16
|
+
import deprecated from '@wordpress/deprecated';
|
|
14
17
|
/**
|
|
15
18
|
* Internal dependencies
|
|
16
19
|
*/
|
|
17
20
|
|
|
18
|
-
import { Input } from './styles/number-control-styles';
|
|
21
|
+
import { Input, SpinButton } from './styles/number-control-styles';
|
|
19
22
|
import * as inputControlActionTypes from '../input-control/reducer/actions';
|
|
20
23
|
import { add, subtract, roundClamp } from '../utils/math';
|
|
21
24
|
import { ensureNumber, isValueEmpty } from '../utils/values';
|
|
25
|
+
import { HStack } from '../h-stack';
|
|
26
|
+
import { Spacer } from '../spacer';
|
|
22
27
|
|
|
23
|
-
|
|
28
|
+
const noop = () => {};
|
|
29
|
+
|
|
30
|
+
function UnforwardedNumberControl(_ref, forwardedRef) {
|
|
24
31
|
let {
|
|
25
32
|
__unstableStateReducer: stateReducerProp,
|
|
26
33
|
className,
|
|
27
34
|
dragDirection = 'n',
|
|
28
35
|
hideHTMLArrows = false,
|
|
36
|
+
spinControls = 'native',
|
|
29
37
|
isDragEnabled = true,
|
|
30
38
|
isShiftStepEnabled = true,
|
|
31
39
|
label,
|
|
@@ -36,8 +44,23 @@ function UnforwardedNumberControl(_ref, ref) {
|
|
|
36
44
|
step = 1,
|
|
37
45
|
type: typeProp = 'number',
|
|
38
46
|
value: valueProp,
|
|
47
|
+
size = 'default',
|
|
48
|
+
suffix,
|
|
49
|
+
onChange = noop,
|
|
39
50
|
...props
|
|
40
51
|
} = _ref;
|
|
52
|
+
|
|
53
|
+
if (hideHTMLArrows) {
|
|
54
|
+
deprecated('hideHTMLArrows', {
|
|
55
|
+
alternative: 'spinControls="none"',
|
|
56
|
+
since: '6.2',
|
|
57
|
+
version: '6.3'
|
|
58
|
+
});
|
|
59
|
+
spinControls = 'none';
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const inputRef = useRef();
|
|
63
|
+
const mergedRef = useMergeRefs([inputRef, forwardedRef]);
|
|
41
64
|
const isStepAny = step === 'any';
|
|
42
65
|
const baseStep = isStepAny ? 1 : ensureNumber(step);
|
|
43
66
|
const baseValue = roundClamp(0, min, max, baseStep);
|
|
@@ -49,6 +72,21 @@ function UnforwardedNumberControl(_ref, ref) {
|
|
|
49
72
|
|
|
50
73
|
const autoComplete = typeProp === 'number' ? 'off' : undefined;
|
|
51
74
|
const classes = classNames('components-number-control', className);
|
|
75
|
+
|
|
76
|
+
const spinValue = (value, direction, event) => {
|
|
77
|
+
event === null || event === void 0 ? void 0 : event.preventDefault();
|
|
78
|
+
const shift = (event === null || event === void 0 ? void 0 : event.shiftKey) && isShiftStepEnabled;
|
|
79
|
+
const delta = shift ? ensureNumber(shiftStep) * baseStep : baseStep;
|
|
80
|
+
let nextValue = isValueEmpty(value) ? baseValue : value;
|
|
81
|
+
|
|
82
|
+
if (direction === 'up') {
|
|
83
|
+
nextValue = add(nextValue, delta);
|
|
84
|
+
} else if (direction === 'down') {
|
|
85
|
+
nextValue = subtract(nextValue, delta);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return constrainValue(nextValue, shift ? delta : undefined);
|
|
89
|
+
};
|
|
52
90
|
/**
|
|
53
91
|
* "Middleware" function that intercepts updates from InputControl.
|
|
54
92
|
* This allows us to tap into actions to transform the (next) state for
|
|
@@ -57,6 +95,7 @@ function UnforwardedNumberControl(_ref, ref) {
|
|
|
57
95
|
* @return The updated state to apply to InputControl
|
|
58
96
|
*/
|
|
59
97
|
|
|
98
|
+
|
|
60
99
|
const numberControlStateReducer = (state, action) => {
|
|
61
100
|
const nextState = { ...state
|
|
62
101
|
};
|
|
@@ -71,24 +110,8 @@ function UnforwardedNumberControl(_ref, ref) {
|
|
|
71
110
|
*/
|
|
72
111
|
|
|
73
112
|
if (type === inputControlActionTypes.PRESS_UP || type === inputControlActionTypes.PRESS_DOWN) {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
let nextValue = isValueEmpty(currentValue) ? baseValue : currentValue;
|
|
77
|
-
|
|
78
|
-
if (event !== null && event !== void 0 && event.preventDefault) {
|
|
79
|
-
event.preventDefault();
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
if (type === inputControlActionTypes.PRESS_UP) {
|
|
83
|
-
nextValue = add(nextValue, incrementalValue);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
if (type === inputControlActionTypes.PRESS_DOWN) {
|
|
87
|
-
nextValue = subtract(nextValue, incrementalValue);
|
|
88
|
-
} // @ts-expect-error TODO: Resolve discrepancy between `value` types in InputControl based components
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
nextState.value = constrainValue(nextValue, enableShift ? incrementalValue : undefined);
|
|
113
|
+
// @ts-expect-error TODO: Resolve discrepancy between `value` types in InputControl based components
|
|
114
|
+
nextState.value = spinValue(currentValue, type === inputControlActionTypes.PRESS_UP ? 'up' : 'down', event);
|
|
92
115
|
}
|
|
93
116
|
/**
|
|
94
117
|
* Handles drag to update events
|
|
@@ -149,18 +172,26 @@ function UnforwardedNumberControl(_ref, ref) {
|
|
|
149
172
|
return nextState;
|
|
150
173
|
};
|
|
151
174
|
|
|
175
|
+
const buildSpinButtonClickHandler = direction => event => onChange(String(spinValue(valueProp, direction, event)), {
|
|
176
|
+
// Set event.target to the <input> so that consumers can use
|
|
177
|
+
// e.g. event.target.validity.
|
|
178
|
+
event: { ...event,
|
|
179
|
+
target: inputRef.current
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
|
|
152
183
|
return createElement(Input, _extends({
|
|
153
184
|
autoComplete: autoComplete,
|
|
154
185
|
inputMode: "numeric"
|
|
155
186
|
}, props, {
|
|
156
187
|
className: classes,
|
|
157
188
|
dragDirection: dragDirection,
|
|
158
|
-
hideHTMLArrows:
|
|
189
|
+
hideHTMLArrows: spinControls !== 'native',
|
|
159
190
|
isDragEnabled: isDragEnabled,
|
|
160
191
|
label: label,
|
|
161
192
|
max: max,
|
|
162
193
|
min: min,
|
|
163
|
-
ref:
|
|
194
|
+
ref: mergedRef,
|
|
164
195
|
required: required,
|
|
165
196
|
step: step,
|
|
166
197
|
type: typeProp // @ts-expect-error TODO: Resolve discrepancy between `value` types in InputControl based components
|
|
@@ -171,7 +202,31 @@ function UnforwardedNumberControl(_ref, ref) {
|
|
|
171
202
|
|
|
172
203
|
const baseState = numberControlStateReducer(state, action);
|
|
173
204
|
return (_stateReducerProp = stateReducerProp === null || stateReducerProp === void 0 ? void 0 : stateReducerProp(baseState, action)) !== null && _stateReducerProp !== void 0 ? _stateReducerProp : baseState;
|
|
174
|
-
}
|
|
205
|
+
},
|
|
206
|
+
size: size,
|
|
207
|
+
suffix: spinControls === 'custom' ? createElement(Fragment, null, suffix, createElement(Spacer, {
|
|
208
|
+
marginBottom: 0,
|
|
209
|
+
marginRight: 2
|
|
210
|
+
}, createElement(HStack, {
|
|
211
|
+
spacing: 1
|
|
212
|
+
}, createElement(SpinButton, {
|
|
213
|
+
icon: plusIcon,
|
|
214
|
+
isSmall: true,
|
|
215
|
+
"aria-hidden": "true",
|
|
216
|
+
"aria-label": __('Increment'),
|
|
217
|
+
tabIndex: -1,
|
|
218
|
+
onClick: buildSpinButtonClickHandler('up'),
|
|
219
|
+
size: size
|
|
220
|
+
}), createElement(SpinButton, {
|
|
221
|
+
icon: resetIcon,
|
|
222
|
+
isSmall: true,
|
|
223
|
+
"aria-hidden": "true",
|
|
224
|
+
"aria-label": __('Decrement'),
|
|
225
|
+
tabIndex: -1,
|
|
226
|
+
onClick: buildSpinButtonClickHandler('down'),
|
|
227
|
+
size: size
|
|
228
|
+
})))) : suffix,
|
|
229
|
+
onChange: onChange
|
|
175
230
|
}));
|
|
176
231
|
}
|
|
177
232
|
|