@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/slot-fill/bubbles-virtually/use-slot.js"],"names":["useSnapshot","useCallback","useContext","SlotFillContext","useSlot","name","
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/slot-fill/bubbles-virtually/use-slot.js"],"names":["useSnapshot","useCallback","useContext","SlotFillContext","useSlot","name","updateSlot","registryUpdateSlot","unregisterSlot","registryUnregisterSlot","registerFill","registryRegisterFill","unregisterFill","registryUnregisterFill","registry","slots","sync","slot","get","fillProps","slotRef","fillRef"],"mappings":"AAAA;;AACA;AACA;AACA;AACA,SAASA,WAAT,QAA4B,QAA5B;AAEA;AACA;AACA;;AACA,SAASC,WAAT,EAAsBC,UAAtB,QAAwC,oBAAxC;AAEA;AACA;AACA;;AACA,OAAOC,eAAP,MAA4B,qBAA5B;AAEA,eAAe,SAASC,OAAT,CAAkBC,IAAlB,EAAyB;AACvC,QAAM;AACLC,IAAAA,UAAU,EAAEC,kBADP;AAELC,IAAAA,cAAc,EAAEC,sBAFX;AAGLC,IAAAA,YAAY,EAAEC,oBAHT;AAILC,IAAAA,cAAc,EAAEC,sBAJX;AAKL,OAAGC;AALE,MAMFZ,UAAU,CAAEC,eAAF,CANd;AAOA,QAAMY,KAAK,GAAGf,WAAW,CAAEc,QAAQ,CAACC,KAAX,EAAkB;AAAEC,IAAAA,IAAI,EAAE;AAAR,GAAlB,CAAzB,CARuC,CASvC;AACA;AACA;;AACA,QAAMC,IAAI,GAAGF,KAAK,CAACG,GAAN,CAAWb,IAAX,CAAb;AAEA,QAAMC,UAAU,GAAGL,WAAW,CAC3BkB,SAAF,IAAiB;AAChBZ,IAAAA,kBAAkB,CAAEF,IAAF,EAAQc,SAAR,CAAlB;AACA,GAH4B,EAI7B,CAAEd,IAAF,EAAQE,kBAAR,CAJ6B,CAA9B;AAOA,QAAMC,cAAc,GAAGP,WAAW,CAC/BmB,OAAF,IAAe;AACdX,IAAAA,sBAAsB,CAAEJ,IAAF,EAAQe,OAAR,CAAtB;AACA,GAHgC,EAIjC,CAAEf,IAAF,EAAQI,sBAAR,CAJiC,CAAlC;AAOA,QAAMC,YAAY,GAAGT,WAAW,CAC7BoB,OAAF,IAAe;AACdV,IAAAA,oBAAoB,CAAEN,IAAF,EAAQgB,OAAR,CAApB;AACA,GAH8B,EAI/B,CAAEhB,IAAF,EAAQM,oBAAR,CAJ+B,CAAhC;AAOA,QAAMC,cAAc,GAAGX,WAAW,CAC/BoB,OAAF,IAAe;AACdR,IAAAA,sBAAsB,CAAER,IAAF,EAAQgB,OAAR,CAAtB;AACA,GAHgC,EAIjC,CAAEhB,IAAF,EAAQQ,sBAAR,CAJiC,CAAlC;AAOA,SAAO,EACN,GAAGI,IADG;AAENX,IAAAA,UAFM;AAGNE,IAAAA,cAHM;AAINE,IAAAA,YAJM;AAKNE,IAAAA;AALM,GAAP;AAOA","sourcesContent":["// @ts-nocheck\n/**\n * External dependencies\n */\nimport { useSnapshot } from 'valtio';\n\n/**\n * WordPress dependencies\n */\nimport { useCallback, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SlotFillContext from './slot-fill-context';\n\nexport default function useSlot( name ) {\n\tconst {\n\t\tupdateSlot: registryUpdateSlot,\n\t\tunregisterSlot: registryUnregisterSlot,\n\t\tregisterFill: registryRegisterFill,\n\t\tunregisterFill: registryUnregisterFill,\n\t\t...registry\n\t} = useContext( SlotFillContext );\n\tconst slots = useSnapshot( registry.slots, { sync: true } );\n\t// The important bit here is that this call ensures\n\t// the hook only causes a re-render if the slot\n\t// with the given name change, not any other slot.\n\tconst slot = slots.get( name );\n\n\tconst updateSlot = useCallback(\n\t\t( fillProps ) => {\n\t\t\tregistryUpdateSlot( name, fillProps );\n\t\t},\n\t\t[ name, registryUpdateSlot ]\n\t);\n\n\tconst unregisterSlot = useCallback(\n\t\t( slotRef ) => {\n\t\t\tregistryUnregisterSlot( name, slotRef );\n\t\t},\n\t\t[ name, registryUnregisterSlot ]\n\t);\n\n\tconst registerFill = useCallback(\n\t\t( fillRef ) => {\n\t\t\tregistryRegisterFill( name, fillRef );\n\t\t},\n\t\t[ name, registryRegisterFill ]\n\t);\n\n\tconst unregisterFill = useCallback(\n\t\t( fillRef ) => {\n\t\t\tregistryUnregisterFill( name, fillRef );\n\t\t},\n\t\t[ name, registryUnregisterFill ]\n\t);\n\n\treturn {\n\t\t...slot,\n\t\tupdateSlot,\n\t\tunregisterSlot,\n\t\tregisterFill,\n\t\tunregisterFill,\n\t};\n}\n"]}
|
|
@@ -26,15 +26,21 @@ function FillComponent(_ref) {
|
|
|
26
26
|
children
|
|
27
27
|
});
|
|
28
28
|
useLayoutEffect(() => {
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
const refValue = ref.current;
|
|
30
|
+
registerFill(name, refValue);
|
|
31
|
+
return () => unregisterFill(name, refValue); // Ignore reason: the useLayoutEffects here are written to fire at specific times, and introducing new dependencies could cause unexpected changes in behavior.
|
|
32
|
+
// We'll leave them as-is until a more detailed investigation/refactor can be performed.
|
|
33
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
31
34
|
}, []);
|
|
32
35
|
useLayoutEffect(() => {
|
|
33
36
|
ref.current.children = children;
|
|
34
37
|
|
|
35
38
|
if (slot) {
|
|
36
39
|
slot.forceUpdate();
|
|
37
|
-
}
|
|
40
|
+
} // Ignore reason: the useLayoutEffects here are written to fire at specific times, and introducing new dependencies could cause unexpected changes in behavior.
|
|
41
|
+
// We'll leave them as-is until a more detailed investigation/refactor can be performed.
|
|
42
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
43
|
+
|
|
38
44
|
}, [children]);
|
|
39
45
|
useLayoutEffect(() => {
|
|
40
46
|
if (name === ref.current.name) {
|
|
@@ -44,7 +50,9 @@ function FillComponent(_ref) {
|
|
|
44
50
|
|
|
45
51
|
unregisterFill(ref.current.name, ref.current);
|
|
46
52
|
ref.current.name = name;
|
|
47
|
-
registerFill(name, ref.current);
|
|
53
|
+
registerFill(name, ref.current); // Ignore reason: the useLayoutEffects here are written to fire at specific times, and introducing new dependencies could cause unexpected changes in behavior.
|
|
54
|
+
// We'll leave them as-is until a more detailed investigation/refactor can be performed.
|
|
55
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
48
56
|
}, [name]);
|
|
49
57
|
|
|
50
58
|
if (!slot || !slot.node) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/slot-fill/fill.js"],"names":["createPortal","useLayoutEffect","useRef","SlotFillContext","useSlot","FillComponent","name","children","registerFill","unregisterFill","slot","ref","current","forceUpdate","node","props","fillProps","Fill"],"mappings":";;AAAA;;AAEA;AACA;AACA;AACA,SAASA,YAAT,EAAuBC,eAAvB,EAAwCC,MAAxC,QAAsD,oBAAtD;AAEA;AACA;AACA;;AACA,OAAOC,eAAP,MAA4B,WAA5B;AACA,OAAOC,OAAP,MAAoB,YAApB;;AAEA,SAASC,aAAT,OAA2E;AAAA,MAAnD;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,QAAR;AAAkBC,IAAAA,YAAlB;AAAgCC,IAAAA;AAAhC,GAAmD;AAC1E,QAAMC,IAAI,GAAGN,OAAO,CAAEE,IAAF,CAApB;AAEA,QAAMK,GAAG,GAAGT,MAAM,CAAE;AACnBI,IAAAA,IADmB;AAEnBC,IAAAA;AAFmB,GAAF,CAAlB;AAKAN,EAAAA,eAAe,CAAE,MAAM;
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/slot-fill/fill.js"],"names":["createPortal","useLayoutEffect","useRef","SlotFillContext","useSlot","FillComponent","name","children","registerFill","unregisterFill","slot","ref","refValue","current","forceUpdate","node","props","fillProps","Fill"],"mappings":";;AAAA;;AAEA;AACA;AACA;AACA,SAASA,YAAT,EAAuBC,eAAvB,EAAwCC,MAAxC,QAAsD,oBAAtD;AAEA;AACA;AACA;;AACA,OAAOC,eAAP,MAA4B,WAA5B;AACA,OAAOC,OAAP,MAAoB,YAApB;;AAEA,SAASC,aAAT,OAA2E;AAAA,MAAnD;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,QAAR;AAAkBC,IAAAA,YAAlB;AAAgCC,IAAAA;AAAhC,GAAmD;AAC1E,QAAMC,IAAI,GAAGN,OAAO,CAAEE,IAAF,CAApB;AAEA,QAAMK,GAAG,GAAGT,MAAM,CAAE;AACnBI,IAAAA,IADmB;AAEnBC,IAAAA;AAFmB,GAAF,CAAlB;AAKAN,EAAAA,eAAe,CAAE,MAAM;AACtB,UAAMW,QAAQ,GAAGD,GAAG,CAACE,OAArB;AACAL,IAAAA,YAAY,CAAEF,IAAF,EAAQM,QAAR,CAAZ;AACA,WAAO,MAAMH,cAAc,CAAEH,IAAF,EAAQM,QAAR,CAA3B,CAHsB,CAItB;AACA;AACA;AACA,GAPc,EAOZ,EAPY,CAAf;AASAX,EAAAA,eAAe,CAAE,MAAM;AACtBU,IAAAA,GAAG,CAACE,OAAJ,CAAYN,QAAZ,GAAuBA,QAAvB;;AACA,QAAKG,IAAL,EAAY;AACXA,MAAAA,IAAI,CAACI,WAAL;AACA,KAJqB,CAKtB;AACA;AACA;;AACA,GARc,EAQZ,CAAEP,QAAF,CARY,CAAf;AAUAN,EAAAA,eAAe,CAAE,MAAM;AACtB,QAAKK,IAAI,KAAKK,GAAG,CAACE,OAAJ,CAAYP,IAA1B,EAAiC;AAChC;AACA;AACA;;AACDG,IAAAA,cAAc,CAAEE,GAAG,CAACE,OAAJ,CAAYP,IAAd,EAAoBK,GAAG,CAACE,OAAxB,CAAd;AACAF,IAAAA,GAAG,CAACE,OAAJ,CAAYP,IAAZ,GAAmBA,IAAnB;AACAE,IAAAA,YAAY,CAAEF,IAAF,EAAQK,GAAG,CAACE,OAAZ,CAAZ,CAPsB,CAQtB;AACA;AACA;AACA,GAXc,EAWZ,CAAEP,IAAF,CAXY,CAAf;;AAaA,MAAK,CAAEI,IAAF,IAAU,CAAEA,IAAI,CAACK,IAAtB,EAA6B;AAC5B,WAAO,IAAP;AACA,GA1CyE,CA4C1E;;;AACA,MAAK,OAAOR,QAAP,KAAoB,UAAzB,EAAsC;AACrCA,IAAAA,QAAQ,GAAGA,QAAQ,CAAEG,IAAI,CAACM,KAAL,CAAWC,SAAb,CAAnB;AACA;;AAED,SAAOjB,YAAY,CAAEO,QAAF,EAAYG,IAAI,CAACK,IAAjB,CAAnB;AACA;;AAED,MAAMG,IAAI,GAAKF,KAAF,IACZ,cAAC,eAAD,CAAiB,QAAjB,QACG;AAAA,MAAE;AAAER,IAAAA,YAAF;AAAgBC,IAAAA;AAAhB,GAAF;AAAA,SACD,cAAC,aAAD,eACMO,KADN;AAEC,IAAA,YAAY,EAAGR,YAFhB;AAGC,IAAA,cAAc,EAAGC;AAHlB,KADC;AAAA,CADH,CADD;;AAYA,eAAeS,IAAf","sourcesContent":["// @ts-nocheck\n\n/**\n * WordPress dependencies\n */\nimport { createPortal, useLayoutEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SlotFillContext from './context';\nimport useSlot from './use-slot';\n\nfunction FillComponent( { name, children, registerFill, unregisterFill } ) {\n\tconst slot = useSlot( name );\n\n\tconst ref = useRef( {\n\t\tname,\n\t\tchildren,\n\t} );\n\n\tuseLayoutEffect( () => {\n\t\tconst refValue = ref.current;\n\t\tregisterFill( name, refValue );\n\t\treturn () => unregisterFill( name, refValue );\n\t\t// Ignore reason: the useLayoutEffects here are written to fire at specific times, and introducing new dependencies could cause unexpected changes in behavior.\n\t\t// We'll leave them as-is until a more detailed investigation/refactor can be performed.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [] );\n\n\tuseLayoutEffect( () => {\n\t\tref.current.children = children;\n\t\tif ( slot ) {\n\t\t\tslot.forceUpdate();\n\t\t}\n\t\t// Ignore reason: the useLayoutEffects here are written to fire at specific times, and introducing new dependencies could cause unexpected changes in behavior.\n\t\t// We'll leave them as-is until a more detailed investigation/refactor can be performed.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ children ] );\n\n\tuseLayoutEffect( () => {\n\t\tif ( name === ref.current.name ) {\n\t\t\t// Ignore initial effect.\n\t\t\treturn;\n\t\t}\n\t\tunregisterFill( ref.current.name, ref.current );\n\t\tref.current.name = name;\n\t\tregisterFill( name, ref.current );\n\t\t// Ignore reason: the useLayoutEffects here are written to fire at specific times, and introducing new dependencies could cause unexpected changes in behavior.\n\t\t// We'll leave them as-is until a more detailed investigation/refactor can be performed.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ name ] );\n\n\tif ( ! slot || ! slot.node ) {\n\t\treturn null;\n\t}\n\n\t// If a function is passed as a child, provide it with the fillProps.\n\tif ( typeof children === 'function' ) {\n\t\tchildren = children( slot.props.fillProps );\n\t}\n\n\treturn createPortal( children, slot.node );\n}\n\nconst Fill = ( props ) => (\n\t<SlotFillContext.Consumer>\n\t\t{ ( { registerFill, unregisterFill } ) => (\n\t\t\t<FillComponent\n\t\t\t\t{ ...props }\n\t\t\t\tregisterFill={ registerFill }\n\t\t\t\tunregisterFill={ unregisterFill }\n\t\t\t/>\n\t\t) }\n\t</SlotFillContext.Consumer>\n);\n\nexport default Fill;\n"]}
|
|
@@ -27,7 +27,9 @@ const useSlot = name => {
|
|
|
27
27
|
const unsubscribe = subscribe(() => {
|
|
28
28
|
setSlot(getSlot(name));
|
|
29
29
|
});
|
|
30
|
-
return unsubscribe;
|
|
30
|
+
return unsubscribe; // Ignore reason: Modifying this dep array could introduce unexpected changes in behavior,
|
|
31
|
+
// so we'll leave it as=is until the hook can be properly refactored for exhaustive-deps.
|
|
32
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
31
33
|
}, [name]);
|
|
32
34
|
return slot;
|
|
33
35
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/slot-fill/use-slot.js"],"names":["useContext","useState","useEffect","SlotFillContext","useSlot","name","getSlot","subscribe","slot","setSlot","unsubscribe"],"mappings":"AAAA;;AACA;AACA;AACA;AACA,SAASA,UAAT,EAAqBC,QAArB,EAA+BC,SAA/B,QAAgD,oBAAhD;AAEA;AACA;AACA;;AACA,OAAOC,eAAP,MAA4B,WAA5B;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,OAAO,GAAKC,IAAF,IAAY;AAC3B,QAAM;AAAEC,IAAAA,OAAF;AAAWC,IAAAA;AAAX,MAAyBP,UAAU,CAAEG,eAAF,CAAzC;AACA,QAAM,CAAEK,IAAF,EAAQC,OAAR,IAAoBR,QAAQ,CAAEK,OAAO,CAAED,IAAF,CAAT,CAAlC;AAEAH,EAAAA,SAAS,CAAE,MAAM;AAChBO,IAAAA,OAAO,CAAEH,OAAO,CAAED,IAAF,CAAT,CAAP;AACA,UAAMK,WAAW,GAAGH,SAAS,CAAE,MAAM;AACpCE,MAAAA,OAAO,CAAEH,OAAO,CAAED,IAAF,CAAT,CAAP;AACA,KAF4B,CAA7B;AAIA,WAAOK,WAAP;AACA,
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/slot-fill/use-slot.js"],"names":["useContext","useState","useEffect","SlotFillContext","useSlot","name","getSlot","subscribe","slot","setSlot","unsubscribe"],"mappings":"AAAA;;AACA;AACA;AACA;AACA,SAASA,UAAT,EAAqBC,QAArB,EAA+BC,SAA/B,QAAgD,oBAAhD;AAEA;AACA;AACA;;AACA,OAAOC,eAAP,MAA4B,WAA5B;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,OAAO,GAAKC,IAAF,IAAY;AAC3B,QAAM;AAAEC,IAAAA,OAAF;AAAWC,IAAAA;AAAX,MAAyBP,UAAU,CAAEG,eAAF,CAAzC;AACA,QAAM,CAAEK,IAAF,EAAQC,OAAR,IAAoBR,QAAQ,CAAEK,OAAO,CAAED,IAAF,CAAT,CAAlC;AAEAH,EAAAA,SAAS,CAAE,MAAM;AAChBO,IAAAA,OAAO,CAAEH,OAAO,CAAED,IAAF,CAAT,CAAP;AACA,UAAMK,WAAW,GAAGH,SAAS,CAAE,MAAM;AACpCE,MAAAA,OAAO,CAAEH,OAAO,CAAED,IAAF,CAAT,CAAP;AACA,KAF4B,CAA7B;AAIA,WAAOK,WAAP,CANgB,CAOhB;AACA;AACA;AACA,GAVQ,EAUN,CAAEL,IAAF,CAVM,CAAT;AAYA,SAAOG,IAAP;AACA,CAjBD;;AAmBA,eAAeJ,OAAf","sourcesContent":["// @ts-nocheck\n/**\n * WordPress dependencies\n */\nimport { useContext, useState, useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SlotFillContext from './context';\n\n/**\n * React hook returning the active slot given a name.\n *\n * @param {string} name Slot name.\n * @return {Object} Slot object.\n */\nconst useSlot = ( name ) => {\n\tconst { getSlot, subscribe } = useContext( SlotFillContext );\n\tconst [ slot, setSlot ] = useState( getSlot( name ) );\n\n\tuseEffect( () => {\n\t\tsetSlot( getSlot( name ) );\n\t\tconst unsubscribe = subscribe( () => {\n\t\t\tsetSlot( getSlot( name ) );\n\t\t} );\n\n\t\treturn unsubscribe;\n\t\t// Ignore reason: Modifying this dep array could introduce unexpected changes in behavior,\n\t\t// so we'll leave it as=is until the hook can be properly refactored for exhaustive-deps.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ name ] );\n\n\treturn slot;\n};\n\nexport default useSlot;\n"]}
|
|
@@ -88,7 +88,7 @@ function Snackbar(_ref, ref) {
|
|
|
88
88
|
}
|
|
89
89
|
}, NOTICE_TIMEOUT);
|
|
90
90
|
return () => clearTimeout(timeoutHandle);
|
|
91
|
-
}, [onDismiss, onRemove]);
|
|
91
|
+
}, [onDismiss, onRemove, explicitDismiss]);
|
|
92
92
|
const classes = classnames(className, 'components-snackbar', {
|
|
93
93
|
'components-snackbar-explicit-dismiss': !!explicitDismiss
|
|
94
94
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/snackbar/index.js"],"names":["classnames","speak","useEffect","forwardRef","renderToString","__","warning","Button","noop","NOTICE_TIMEOUT","useSpokenMessage","message","politeness","spokenMessage","Snackbar","ref","className","children","actions","onRemove","icon","explicitDismiss","onDismiss","listRef","dismissMe","event","preventDefault","current","focus","onActionClick","onClick","stopPropagation","timeoutHandle","setTimeout","clearTimeout","classes","length","snackbarContentClassnames","map","index","label","url"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,KAAT,QAAsB,iBAAtB;AACA,SAASC,SAAT,EAAoBC,UAApB,EAAgCC,cAAhC,QAAsD,oBAAtD;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,OAAOC,OAAP,MAAoB,oBAApB;AAEA;AACA;AACA;;AACA,SAASC,MAAT,QAAuB,KAAvB;;AAEA,MAAMC,IAAI,GAAG,MAAM,CAAE,CAArB;;AACA,MAAMC,cAAc,GAAG,KAAvB;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,gBAAT,CAA2BC,OAA3B,EAAoCC,UAApC,EAAiD;AAChD,QAAMC,aAAa,GAClB,OAAOF,OAAP,KAAmB,QAAnB,GAA8BA,OAA9B,GAAwCP,cAAc,CAAEO,OAAF,CADvD;AAGAT,EAAAA,SAAS,CAAE,MAAM;AAChB,QAAKW,aAAL,EAAqB;AACpBZ,MAAAA,KAAK,CAAEY,aAAF,EAAiBD,UAAjB,CAAL;AACA;AACD,GAJQ,EAIN,CAAEC,aAAF,EAAiBD,UAAjB,CAJM,CAAT;AAKA;;AAED,SAASE,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/components/src/snackbar/index.js"],"names":["classnames","speak","useEffect","forwardRef","renderToString","__","warning","Button","noop","NOTICE_TIMEOUT","useSpokenMessage","message","politeness","spokenMessage","Snackbar","ref","className","children","actions","onRemove","icon","explicitDismiss","onDismiss","listRef","dismissMe","event","preventDefault","current","focus","onActionClick","onClick","stopPropagation","timeoutHandle","setTimeout","clearTimeout","classes","length","snackbarContentClassnames","map","index","label","url"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,KAAT,QAAsB,iBAAtB;AACA,SAASC,SAAT,EAAoBC,UAApB,EAAgCC,cAAhC,QAAsD,oBAAtD;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,OAAOC,OAAP,MAAoB,oBAApB;AAEA;AACA;AACA;;AACA,SAASC,MAAT,QAAuB,KAAvB;;AAEA,MAAMC,IAAI,GAAG,MAAM,CAAE,CAArB;;AACA,MAAMC,cAAc,GAAG,KAAvB;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,gBAAT,CAA2BC,OAA3B,EAAoCC,UAApC,EAAiD;AAChD,QAAMC,aAAa,GAClB,OAAOF,OAAP,KAAmB,QAAnB,GAA8BA,OAA9B,GAAwCP,cAAc,CAAEO,OAAF,CADvD;AAGAT,EAAAA,SAAS,CAAE,MAAM;AAChB,QAAKW,aAAL,EAAqB;AACpBZ,MAAAA,KAAK,CAAEY,aAAF,EAAiBD,UAAjB,CAAL;AACA;AACD,GAJQ,EAIN,CAAEC,aAAF,EAAiBD,UAAjB,CAJM,CAAT;AAKA;;AAED,SAASE,QAAT,OAgBCC,GAhBD,EAiBE;AAAA,MAhBD;AACCC,IAAAA,SADD;AAECC,IAAAA,QAFD;AAGCJ,IAAAA,aAAa,GAAGI,QAHjB;AAICL,IAAAA,UAAU,GAAG,QAJd;AAKCM,IAAAA,OAAO,GAAG,EALX;AAMCC,IAAAA,QAAQ,GAAGX,IANZ;AAOCY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AAMC,IAAA,UAAU,EAAGA;AANd,cArBF,CATD,CADD;AA6CA;;AAED,eAAerB,UAAU,CAAEW,QAAF,CAAzB","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { speak } from '@wordpress/a11y';\nimport { useEffect, forwardRef, renderToString } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport warning from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport { Button } from '../';\n\nconst noop = () => {};\nconst NOTICE_TIMEOUT = 10000;\n\n/** @typedef {import('@wordpress/element').WPElement} WPElement */\n\n/**\n * Custom hook which announces the message with the given politeness, if a\n * valid message is provided.\n *\n * @param {string|WPElement} [message] Message to announce.\n * @param {'polite'|'assertive'} politeness Politeness to announce.\n */\nfunction useSpokenMessage( message, politeness ) {\n\tconst spokenMessage =\n\t\ttypeof message === 'string' ? message : renderToString( message );\n\n\tuseEffect( () => {\n\t\tif ( spokenMessage ) {\n\t\t\tspeak( spokenMessage, politeness );\n\t\t}\n\t}, [ spokenMessage, politeness ] );\n}\n\nfunction Snackbar(\n\t{\n\t\tclassName,\n\t\tchildren,\n\t\tspokenMessage = children,\n\t\tpoliteness = 'polite',\n\t\tactions = [],\n\t\tonRemove = noop,\n\t\ticon = null,\n\t\texplicitDismiss = false,\n\t\t// onDismiss is a callback executed when the snackbar is dismissed.\n\t\t// It is distinct from onRemove, which _looks_ like a callback but is\n\t\t// actually the function to call to remove the snackbar from the UI.\n\t\tonDismiss = noop,\n\t\tlistRef,\n\t},\n\tref\n) {\n\tonDismiss = onDismiss || noop;\n\n\tfunction dismissMe( event ) {\n\t\tif ( event && event.preventDefault ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\n\t\t// Prevent focus loss by moving it to the list element.\n\t\tlistRef.current.focus();\n\n\t\tonDismiss();\n\t\tonRemove();\n\t}\n\n\tfunction onActionClick( event, onClick ) {\n\t\tevent.stopPropagation();\n\n\t\tonRemove();\n\n\t\tif ( onClick ) {\n\t\t\tonClick( event );\n\t\t}\n\t}\n\n\tuseSpokenMessage( spokenMessage, politeness );\n\n\t// Only set up the timeout dismiss if we're not explicitly dismissing.\n\tuseEffect( () => {\n\t\tconst timeoutHandle = setTimeout( () => {\n\t\t\tif ( ! explicitDismiss ) {\n\t\t\t\tonDismiss();\n\t\t\t\tonRemove();\n\t\t\t}\n\t\t}, NOTICE_TIMEOUT );\n\n\t\treturn () => clearTimeout( timeoutHandle );\n\t}, [ onDismiss, onRemove, explicitDismiss ] );\n\n\tconst classes = classnames( className, 'components-snackbar', {\n\t\t'components-snackbar-explicit-dismiss': !! explicitDismiss,\n\t} );\n\tif ( actions && actions.length > 1 ) {\n\t\t// We need to inform developers that snackbar only accepts 1 action.\n\t\twarning(\n\t\t\t'Snackbar can only have 1 action, use Notice if your message require many messages'\n\t\t);\n\t\t// return first element only while keeping it inside an array\n\t\tactions = [ actions[ 0 ] ];\n\t}\n\n\tconst snackbarContentClassnames = classnames(\n\t\t'components-snackbar__content',\n\t\t{\n\t\t\t'components-snackbar__content-with-icon': !! icon,\n\t\t}\n\t);\n\n\treturn (\n\t\t<div\n\t\t\tref={ ref }\n\t\t\tclassName={ classes }\n\t\t\tonClick={ ! explicitDismiss ? dismissMe : noop }\n\t\t\ttabIndex=\"0\"\n\t\t\trole={ ! explicitDismiss ? 'button' : '' }\n\t\t\tonKeyPress={ ! explicitDismiss ? dismissMe : noop }\n\t\t\taria-label={ ! explicitDismiss ? __( 'Dismiss this notice' ) : '' }\n\t\t>\n\t\t\t<div className={ snackbarContentClassnames }>\n\t\t\t\t{ icon && (\n\t\t\t\t\t<div className=\"components-snackbar__icon\">{ icon }</div>\n\t\t\t\t) }\n\t\t\t\t{ children }\n\t\t\t\t{ actions.map( ( { label, onClick, url }, index ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\thref={ url }\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ ( event ) =>\n\t\t\t\t\t\t\t\tonActionClick( event, onClick )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tclassName=\"components-snackbar__action\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t\t{ explicitDismiss && (\n\t\t\t\t\t<span\n\t\t\t\t\t\trole=\"button\"\n\t\t\t\t\t\taria-label=\"Dismiss this notice\"\n\t\t\t\t\t\ttabIndex=\"0\"\n\t\t\t\t\t\tclassName=\"components-snackbar__dismiss-button\"\n\t\t\t\t\t\tonClick={ dismissMe }\n\t\t\t\t\t\tonKeyPress={ dismissMe }\n\t\t\t\t\t>\n\t\t\t\t\t\t✕\n\t\t\t\t\t</span>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nexport default forwardRef( Snackbar );\n"]}
|
|
@@ -88,7 +88,7 @@ export function TabPanel(_ref2) {
|
|
|
88
88
|
const instanceId = useInstanceId(TabPanel, 'tab-panel');
|
|
89
89
|
const [selected, setSelected] = useState();
|
|
90
90
|
|
|
91
|
-
const
|
|
91
|
+
const handleTabSelection = tabKey => {
|
|
92
92
|
setSelected(tabKey);
|
|
93
93
|
onSelect === null || onSelect === void 0 ? void 0 : onSelect(tabKey);
|
|
94
94
|
};
|
|
@@ -102,14 +102,10 @@ export function TabPanel(_ref2) {
|
|
|
102
102
|
});
|
|
103
103
|
const selectedId = `${instanceId}-${(_selectedTab$name = selectedTab === null || selectedTab === void 0 ? void 0 : selectedTab.name) !== null && _selectedTab$name !== void 0 ? _selectedTab$name : 'none'}`;
|
|
104
104
|
useEffect(() => {
|
|
105
|
-
|
|
106
|
-
name
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
if (!newSelectedTab) {
|
|
110
|
-
setSelected(initialTabName || (tabs.length > 0 ? tabs[0].name : undefined));
|
|
105
|
+
if (!(selectedTab !== null && selectedTab !== void 0 && selectedTab.name) && tabs.length > 0) {
|
|
106
|
+
handleTabSelection(initialTabName || tabs[0].name);
|
|
111
107
|
}
|
|
112
|
-
}, [tabs]);
|
|
108
|
+
}, [tabs, selectedTab === null || selectedTab === void 0 ? void 0 : selectedTab.name, initialTabName]);
|
|
113
109
|
return createElement("div", {
|
|
114
110
|
className: className
|
|
115
111
|
}, createElement(NavigableMenu, {
|
|
@@ -125,7 +121,7 @@ export function TabPanel(_ref2) {
|
|
|
125
121
|
"aria-controls": `${instanceId}-${tab.name}-view`,
|
|
126
122
|
selected: tab.name === selected,
|
|
127
123
|
key: tab.name,
|
|
128
|
-
onClick: () =>
|
|
124
|
+
onClick: () => handleTabSelection(tab.name)
|
|
129
125
|
}, tab.title))), selectedTab && createElement("div", {
|
|
130
126
|
key: selectedId,
|
|
131
127
|
"aria-labelledby": selectedId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/tab-panel/index.tsx"],"names":["classnames","find","useState","useEffect","useInstanceId","NavigableMenu","Button","TabButton","tabId","onClick","children","selected","rest","TabPanel","className","tabs","initialTabName","orientation","activeClass","onSelect","instanceId","setSelected","
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/tab-panel/index.tsx"],"names":["classnames","find","useState","useEffect","useInstanceId","NavigableMenu","Button","TabButton","tabId","onClick","children","selected","rest","TabPanel","className","tabs","initialTabName","orientation","activeClass","onSelect","instanceId","setSelected","handleTabSelection","tabKey","onNavigate","_childIndex","child","click","selectedTab","name","selectedId","length","map","tab","title"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AACA,SAASC,IAAT,QAAqB,QAArB;AAEA;AACA;AACA;;AACA,SAASC,QAAT,EAAmBC,SAAnB,QAAoC,oBAApC;AACA,SAASC,aAAT,QAA8B,oBAA9B;AAEA;AACA;AACA;;AACA,SAASC,aAAT,QAA8B,wBAA9B;AACA,OAAOC,MAAP,MA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A,OAAO,EAAG,MAAMP,kBAAkB,CAAEW,GAAG,CAACJ,IAAN;AAZnC,KAcGI,GAAG,CAACC,KAdP,CADC,CANH,CADD,EA0BGN,WAAW,IACZ;AACC,IAAA,GAAG,EAAGE,UADP;AAEC,uBAAkBA,UAFnB;AAGC,IAAA,IAAI,EAAC,UAHN;AAIC,IAAA,EAAE,EAAI,GAAGA,UAAY,OAJtB;AAKC,IAAA,SAAS,EAAC;AALX,KAOGpB,QAAQ,CAAEkB,WAAF,CAPX,CA3BF,CADD;AAwCA;AAED,eAAef,QAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { find } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useEffect } from '@wordpress/element';\nimport { useInstanceId } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { NavigableMenu } from '../navigable-container';\nimport Button from '../button';\nimport type { TabButtonProps, TabPanelProps } from './types';\nimport type { WordPressComponentProps } from '../ui/context';\n\nconst TabButton = ( {\n\ttabId,\n\tonClick,\n\tchildren,\n\tselected,\n\t...rest\n}: TabButtonProps ) => (\n\t<Button\n\t\trole=\"tab\"\n\t\ttabIndex={ selected ? null : -1 }\n\t\taria-selected={ selected }\n\t\tid={ tabId }\n\t\tonClick={ onClick }\n\t\t{ ...rest }\n\t>\n\t\t{ children }\n\t</Button>\n);\n\n/**\n * TabPanel is an ARIA-compliant tabpanel.\n *\n * TabPanels organize content across different screens, data sets, and interactions.\n * It has two sections: a list of tabs, and the view to show when tabs are chosen.\n *\n * ```jsx\n * import { TabPanel } from '@wordpress/components';\n *\n * const onSelect = ( tabName ) => {\n * console.log( 'Selecting tab', tabName );\n * };\n *\n * const MyTabPanel = () => (\n * <TabPanel\n * className=\"my-tab-panel\"\n * activeClass=\"active-tab\"\n * onSelect={ onSelect }\n * tabs={ [\n * {\n * name: 'tab1',\n * title: 'Tab 1',\n * className: 'tab-one',\n * },\n * {\n * name: 'tab2',\n * title: 'Tab 2',\n * className: 'tab-two',\n * },\n * ] }\n * >\n * { ( tab ) => <p>{ tab.title }</p> }\n * </TabPanel>\n * );\n * ```\n */\nexport function TabPanel( {\n\tclassName,\n\tchildren,\n\ttabs,\n\tinitialTabName,\n\torientation = 'horizontal',\n\tactiveClass = 'is-active',\n\tonSelect,\n}: WordPressComponentProps< TabPanelProps, 'div', false > ) {\n\tconst instanceId = useInstanceId( TabPanel, 'tab-panel' );\n\tconst [ selected, setSelected ] = useState< string >();\n\n\tconst handleTabSelection = ( tabKey: string ) => {\n\t\tsetSelected( tabKey );\n\t\tonSelect?.( tabKey );\n\t};\n\n\tconst onNavigate = ( _childIndex: number, child: HTMLButtonElement ) => {\n\t\tchild.click();\n\t};\n\tconst selectedTab = find( tabs, { name: selected } );\n\tconst selectedId = `${ instanceId }-${ selectedTab?.name ?? 'none' }`;\n\n\tuseEffect( () => {\n\t\tif ( ! selectedTab?.name && tabs.length > 0 ) {\n\t\t\thandleTabSelection( initialTabName || tabs[ 0 ].name );\n\t\t}\n\t}, [ tabs, selectedTab?.name, initialTabName ] );\n\n\treturn (\n\t\t<div className={ className }>\n\t\t\t<NavigableMenu\n\t\t\t\trole=\"tablist\"\n\t\t\t\torientation={ orientation }\n\t\t\t\tonNavigate={ onNavigate }\n\t\t\t\tclassName=\"components-tab-panel__tabs\"\n\t\t\t>\n\t\t\t\t{ tabs.map( ( tab ) => (\n\t\t\t\t\t<TabButton\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'components-tab-panel__tabs-item',\n\t\t\t\t\t\t\ttab.className,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t[ activeClass ]: tab.name === selected,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t\ttabId={ `${ instanceId }-${ tab.name }` }\n\t\t\t\t\t\taria-controls={ `${ instanceId }-${ tab.name }-view` }\n\t\t\t\t\t\tselected={ tab.name === selected }\n\t\t\t\t\t\tkey={ tab.name }\n\t\t\t\t\t\tonClick={ () => handleTabSelection( tab.name ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ tab.title }\n\t\t\t\t\t</TabButton>\n\t\t\t\t) ) }\n\t\t\t</NavigableMenu>\n\t\t\t{ selectedTab && (\n\t\t\t\t<div\n\t\t\t\t\tkey={ selectedId }\n\t\t\t\t\taria-labelledby={ selectedId }\n\t\t\t\t\trole=\"tabpanel\"\n\t\t\t\t\tid={ `${ selectedId }-view` }\n\t\t\t\t\tclassName=\"components-tab-panel__tab-content\"\n\t\t\t\t>\n\t\t\t\t\t{ children( selectedTab ) }\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nexport default TabPanel;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/text-control/index.tsx"],"names":["useInstanceId","forwardRef","BaseControl","UnforwardedTextControl","props","ref","__nextHasNoMarginBottom","label","hideLabelFromVision","value","help","className","onChange","type","additionalProps","instanceId","TextControl","id","onChangeValue","event","target","undefined"],"mappings":";;;AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SAASA,aAAT,QAA8B,oBAA9B;AACA,SAASC,UAAT,QAA2B,oBAA3B;AAEA;AACA;AACA;;AACA,OAAOC,WAAP,MAAwB,iBAAxB;;AAIA,SAASC,sBAAT,CACCC,KADD,EAECC,GAFD,EAGE;AACD,QAAM;AACLC,IAAAA,uBADK;AAELC,IAAAA,KAFK;AAGLC,IAAAA,mBAHK;AAILC,IAAAA,KAJK;AAKLC,IAAAA,IALK;AAMLC,IAAAA,SANK;AAOLC,IAAAA,QAPK;AAQLC,IAAAA,IAAI,GAAG,MARF;AASL,OAAGC;AATE,MAUFV,KAVJ;AAWA,QAAMW,UAAU,GAAGf,aAAa,CAAEgB,WAAF,CAAhC;AACA,QAAMC,EAAE,GAAI,0BAA0BF,UAAY,EAAlD;;AACA,QAAMG,aAAa,GAAKC,KAAF,IACrBP,QAAQ,CAAEO,KAAK,CAACC,MAAN,CAAaX,KAAf,CADT;;AAGA,SACC,cAAC,WAAD;AACC,IAAA,uBAAuB,EAAGH,uBAD3B;AAEC,IAAA,KAAK,EAAGC,KAFT;AAGC,IAAA,mBAAmB,EAAGC,mBAHvB;AAIC,IAAA,EAAE,EAAGS,EAJN;AAKC,IAAA,IAAI,EAAGP,IALR;AAMC,IAAA,SAAS,EAAGC;AANb,KAQC;AACC,IAAA,SAAS,EAAC,gCADX;AAEC,IAAA,IAAI,EAAGE,IAFR;AAGC,IAAA,EAAE,EAAGI,EAHN;AAIC,IAAA,KAAK,EAAGR,KAJT;AAKC,IAAA,QAAQ,EAAGS,aALZ;AAMC,wBAAmB,CAAC,CAAER,IAAH,GAAUO,EAAE,GAAG,QAAf,GAA0BI,SAN9C;AAOC,IAAA,GAAG,EAAGhB;AAPP,KAQMS,eARN,EARD,CADD;AAqBA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/text-control/index.tsx"],"names":["useInstanceId","forwardRef","BaseControl","UnforwardedTextControl","props","ref","__nextHasNoMarginBottom","label","hideLabelFromVision","value","help","className","onChange","type","additionalProps","instanceId","TextControl","id","onChangeValue","event","target","undefined"],"mappings":";;;AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SAASA,aAAT,QAA8B,oBAA9B;AACA,SAASC,UAAT,QAA2B,oBAA3B;AAEA;AACA;AACA;;AACA,OAAOC,WAAP,MAAwB,iBAAxB;;AAIA,SAASC,sBAAT,CACCC,KADD,EAECC,GAFD,EAGE;AACD,QAAM;AACLC,IAAAA,uBADK;AAELC,IAAAA,KAFK;AAGLC,IAAAA,mBAHK;AAILC,IAAAA,KAJK;AAKLC,IAAAA,IALK;AAMLC,IAAAA,SANK;AAOLC,IAAAA,QAPK;AAQLC,IAAAA,IAAI,GAAG,MARF;AASL,OAAGC;AATE,MAUFV,KAVJ;AAWA,QAAMW,UAAU,GAAGf,aAAa,CAAEgB,WAAF,CAAhC;AACA,QAAMC,EAAE,GAAI,0BAA0BF,UAAY,EAAlD;;AACA,QAAMG,aAAa,GAAKC,KAAF,IACrBP,QAAQ,CAAEO,KAAK,CAACC,MAAN,CAAaX,KAAf,CADT;;AAGA,SACC,cAAC,WAAD;AACC,IAAA,uBAAuB,EAAGH,uBAD3B;AAEC,IAAA,KAAK,EAAGC,KAFT;AAGC,IAAA,mBAAmB,EAAGC,mBAHvB;AAIC,IAAA,EAAE,EAAGS,EAJN;AAKC,IAAA,IAAI,EAAGP,IALR;AAMC,IAAA,SAAS,EAAGC;AANb,KAQC;AACC,IAAA,SAAS,EAAC,gCADX;AAEC,IAAA,IAAI,EAAGE,IAFR;AAGC,IAAA,EAAE,EAAGI,EAHN;AAIC,IAAA,KAAK,EAAGR,KAJT;AAKC,IAAA,QAAQ,EAAGS,aALZ;AAMC,wBAAmB,CAAC,CAAER,IAAH,GAAUO,EAAE,GAAG,QAAf,GAA0BI,SAN9C;AAOC,IAAA,GAAG,EAAGhB;AAPP,KAQMS,eARN,EARD,CADD;AAqBA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,MAAME,WAAW,GAAGf,UAAU,CAAEE,sBAAF,CAA9B;AAEP,eAAea,WAAf","sourcesContent":["/**\n * External dependencies\n */\nimport type { ChangeEvent, ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport BaseControl from '../base-control';\nimport type { WordPressComponentProps } from '../ui/context';\nimport type { TextControlProps } from './types';\n\nfunction UnforwardedTextControl(\n\tprops: WordPressComponentProps< TextControlProps, 'input', false >,\n\tref: ForwardedRef< HTMLInputElement >\n) {\n\tconst {\n\t\t__nextHasNoMarginBottom,\n\t\tlabel,\n\t\thideLabelFromVision,\n\t\tvalue,\n\t\thelp,\n\t\tclassName,\n\t\tonChange,\n\t\ttype = 'text',\n\t\t...additionalProps\n\t} = props;\n\tconst instanceId = useInstanceId( TextControl );\n\tconst id = `inspector-text-control-${ instanceId }`;\n\tconst onChangeValue = ( event: ChangeEvent< HTMLInputElement > ) =>\n\t\tonChange( event.target.value );\n\n\treturn (\n\t\t<BaseControl\n\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\tlabel={ label }\n\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\tid={ id }\n\t\t\thelp={ help }\n\t\t\tclassName={ className }\n\t\t>\n\t\t\t<input\n\t\t\t\tclassName=\"components-text-control__input\"\n\t\t\t\ttype={ type }\n\t\t\t\tid={ id }\n\t\t\t\tvalue={ value }\n\t\t\t\tonChange={ onChangeValue }\n\t\t\t\taria-describedby={ !! help ? id + '__help' : undefined }\n\t\t\t\tref={ ref }\n\t\t\t\t{ ...additionalProps }\n\t\t\t/>\n\t\t</BaseControl>\n\t);\n}\n\n/**\n * TextControl components let users enter and edit text.\n *\n * ```jsx\n * import { TextControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyTextControl = () => {\n * const [ className, setClassName ] = useState( '' );\n *\n * return (\n * <TextControl\n * label=\"Additional CSS Class\"\n * value={ className }\n * onChange={ ( value ) => setClassName( value ) }\n * />\n * );\n * };\n * ```\n */\nexport const TextControl = forwardRef( UnforwardedTextControl );\n\nexport default TextControl;\n"]}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { createElement } from "@wordpress/element";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* External dependencies
|
|
5
|
+
*/
|
|
6
|
+
import { colord, extend } from 'colord';
|
|
7
|
+
import a11yPlugin from 'colord/plugins/a11y';
|
|
8
|
+
import namesPlugin from 'colord/plugins/names';
|
|
9
|
+
/**
|
|
10
|
+
* Internal dependencies
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { Wrapper } from './styles';
|
|
14
|
+
extend([namesPlugin, a11yPlugin]);
|
|
15
|
+
/**
|
|
16
|
+
* `Theme` allows defining theme variables for components in the `@wordpress/components` package.
|
|
17
|
+
*
|
|
18
|
+
* Multiple `Theme` components can be nested in order to override specific theme variables.
|
|
19
|
+
*
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```jsx
|
|
23
|
+
* import { __experimentalTheme as Theme } from '@wordpress/components';
|
|
24
|
+
*
|
|
25
|
+
* const Example = () => {
|
|
26
|
+
* return (
|
|
27
|
+
* <Theme accent="red">
|
|
28
|
+
* <Button variant="primary">I'm red</Button>
|
|
29
|
+
* <Theme accent="blue">
|
|
30
|
+
* <Button variant="primary">I'm blue</Button>
|
|
31
|
+
* </Theme>
|
|
32
|
+
* </Theme>
|
|
33
|
+
* );
|
|
34
|
+
* };
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
function Theme(props) {
|
|
39
|
+
const {
|
|
40
|
+
accent
|
|
41
|
+
} = props;
|
|
42
|
+
|
|
43
|
+
if (accent && !colord(accent).isValid()) {
|
|
44
|
+
// eslint-disable-next-line no-console
|
|
45
|
+
console.warn(`wp.components.Theme: "${accent}" is not a valid color value for the 'accent' prop.`);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return createElement(Wrapper, props);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export default Theme;
|
|
52
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/theme/index.tsx"],"names":["colord","extend","a11yPlugin","namesPlugin","Wrapper","Theme","props","accent","isValid","console","warn"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,MAAT,EAAiBC,MAAjB,QAA+B,QAA/B;AACA,OAAOC,UAAP,MAAuB,qBAAvB;AACA,OAAOC,WAAP,MAAwB,sBAAxB;AAEA;AACA;AACA;;AAGA,SAASC,OAAT,QAAwB,UAAxB;AAEAH,MAAM,CAAE,CAAEE,WAAF,EAAeD,UAAf,CAAF,CAAN;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASG,KAAT,CAAgBC,KAAhB,EAA4E;AAC3E,QAAM;AAAEC,IAAAA;AAAF,MAAaD,KAAnB;;AACA,MAAKC,MAAM,IAAI,CAAEP,MAAM,CAAEO,MAAF,CAAN,CAAiBC,OAAjB,EAAjB,EAA8C;AAC7C;AACAC,IAAAA,OAAO,CAACC,IAAR,CACE,yBAAyBH,MAAQ,qDADnC;AAGA;;AAED,SAAO,cAAC,OAAD,EAAcD,KAAd,CAAP;AACA;;AAED,eAAeD,KAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { colord, extend } from 'colord';\nimport a11yPlugin from 'colord/plugins/a11y';\nimport namesPlugin from 'colord/plugins/names';\n\n/**\n * Internal dependencies\n */\nimport type { ThemeProps } from './types';\nimport type { WordPressComponentProps } from '../ui/context';\nimport { Wrapper } from './styles';\n\nextend( [ namesPlugin, a11yPlugin ] );\n\n/**\n * `Theme` allows defining theme variables for components in the `@wordpress/components` package.\n *\n * Multiple `Theme` components can be nested in order to override specific theme variables.\n *\n *\n * @example\n * ```jsx\n * import { __experimentalTheme as Theme } from '@wordpress/components';\n *\n * const Example = () => {\n * return (\n * <Theme accent=\"red\">\n * <Button variant=\"primary\">I'm red</Button>\n * <Theme accent=\"blue\">\n * <Button variant=\"primary\">I'm blue</Button>\n * </Theme>\n * </Theme>\n * );\n * };\n * ```\n */\nfunction Theme( props: WordPressComponentProps< ThemeProps, 'div', true > ) {\n\tconst { accent } = props;\n\tif ( accent && ! colord( accent ).isValid() ) {\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.warn(\n\t\t\t`wp.components.Theme: \"${ accent }\" is not a valid color value for the 'accent' prop.`\n\t\t);\n\t}\n\n\treturn <Wrapper { ...props } />;\n}\n\nexport default Theme;\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import _styled from "@emotion/styled/base";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* External dependencies
|
|
5
|
+
*/
|
|
6
|
+
import { colord } from 'colord';
|
|
7
|
+
import { css } from '@emotion/react';
|
|
8
|
+
/**
|
|
9
|
+
* Internal dependencies
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const accentColor = _ref => {
|
|
13
|
+
let {
|
|
14
|
+
accent
|
|
15
|
+
} = _ref;
|
|
16
|
+
return accent ? /*#__PURE__*/css("--wp-components-color-accent:", accent, ";--wp-components-color-accent-darker-10:", colord(accent).darken(0.1).toHex(), ";--wp-components-color-accent-darker-20:", colord(accent).darken(0.2).toHex(), ";" + (process.env.NODE_ENV === "production" ? "" : ";label:accentColor;"), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvdGhlbWUvc3R5bGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQWNPIiwiZmlsZSI6IkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvdGhlbWUvc3R5bGVzLnRzIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBFeHRlcm5hbCBkZXBlbmRlbmNpZXNcbiAqL1xuaW1wb3J0IHsgY29sb3JkIH0gZnJvbSAnY29sb3JkJztcbmltcG9ydCBzdHlsZWQgZnJvbSAnQGVtb3Rpb24vc3R5bGVkJztcbmltcG9ydCB7IGNzcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0JztcblxuLyoqXG4gKiBJbnRlcm5hbCBkZXBlbmRlbmNpZXNcbiAqL1xuaW1wb3J0IHR5cGUgeyBUaGVtZVByb3BzIH0gZnJvbSAnLi90eXBlcyc7XG5cbmNvbnN0IGFjY2VudENvbG9yID0gKCB7IGFjY2VudCB9OiBUaGVtZVByb3BzICkgPT5cblx0YWNjZW50XG5cdFx0PyBjc3NgXG5cdFx0XHRcdC0td3AtY29tcG9uZW50cy1jb2xvci1hY2NlbnQ6ICR7IGFjY2VudCB9O1xuXHRcdFx0XHQtLXdwLWNvbXBvbmVudHMtY29sb3ItYWNjZW50LWRhcmtlci0xMDogJHsgY29sb3JkKCBhY2NlbnQgKVxuXHRcdFx0XHRcdC5kYXJrZW4oIDAuMSApXG5cdFx0XHRcdFx0LnRvSGV4KCkgfTtcblx0XHRcdFx0LS13cC1jb21wb25lbnRzLWNvbG9yLWFjY2VudC1kYXJrZXItMjA6ICR7IGNvbG9yZCggYWNjZW50IClcblx0XHRcdFx0XHQuZGFya2VuKCAwLjIgKVxuXHRcdFx0XHRcdC50b0hleCgpIH07XG5cdFx0ICBgXG5cdFx0OiB1bmRlZmluZWQ7XG5cbmV4cG9ydCBjb25zdCBXcmFwcGVyID0gc3R5bGVkLmRpdjwgVGhlbWVQcm9wcyA+YFxuXHQkeyBhY2NlbnRDb2xvciB9XG5gO1xuIl19 */") : undefined;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const Wrapper = _styled("div", process.env.NODE_ENV === "production" ? {
|
|
20
|
+
target: "e1krjpvb0"
|
|
21
|
+
} : {
|
|
22
|
+
target: "e1krjpvb0",
|
|
23
|
+
label: "Wrapper"
|
|
24
|
+
})(accentColor, ";" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvdGhlbWUvc3R5bGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQXlCK0MiLCJmaWxlIjoiQHdvcmRwcmVzcy9jb21wb25lbnRzL3NyYy90aGVtZS9zdHlsZXMudHMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEV4dGVybmFsIGRlcGVuZGVuY2llc1xuICovXG5pbXBvcnQgeyBjb2xvcmQgfSBmcm9tICdjb2xvcmQnO1xuaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnO1xuaW1wb3J0IHsgY3NzIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnO1xuXG4vKipcbiAqIEludGVybmFsIGRlcGVuZGVuY2llc1xuICovXG5pbXBvcnQgdHlwZSB7IFRoZW1lUHJvcHMgfSBmcm9tICcuL3R5cGVzJztcblxuY29uc3QgYWNjZW50Q29sb3IgPSAoIHsgYWNjZW50IH06IFRoZW1lUHJvcHMgKSA9PlxuXHRhY2NlbnRcblx0XHQ/IGNzc2Bcblx0XHRcdFx0LS13cC1jb21wb25lbnRzLWNvbG9yLWFjY2VudDogJHsgYWNjZW50IH07XG5cdFx0XHRcdC0td3AtY29tcG9uZW50cy1jb2xvci1hY2NlbnQtZGFya2VyLTEwOiAkeyBjb2xvcmQoIGFjY2VudCApXG5cdFx0XHRcdFx0LmRhcmtlbiggMC4xIClcblx0XHRcdFx0XHQudG9IZXgoKSB9O1xuXHRcdFx0XHQtLXdwLWNvbXBvbmVudHMtY29sb3ItYWNjZW50LWRhcmtlci0yMDogJHsgY29sb3JkKCBhY2NlbnQgKVxuXHRcdFx0XHRcdC5kYXJrZW4oIDAuMiApXG5cdFx0XHRcdFx0LnRvSGV4KCkgfTtcblx0XHQgIGBcblx0XHQ6IHVuZGVmaW5lZDtcblxuZXhwb3J0IGNvbnN0IFdyYXBwZXIgPSBzdHlsZWQuZGl2PCBUaGVtZVByb3BzID5gXG5cdCR7IGFjY2VudENvbG9yIH1cbmA7XG4iXX0= */"));
|
|
25
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/theme/styles.ts"],"names":["colord","css","accentColor","accent","darken","toHex","undefined","Wrapper"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,MAAT,QAAuB,QAAvB;AAEA,SAASC,GAAT,QAAoB,gBAApB;AAEA;AACA;AACA;;AAGA,MAAMC,WAAW,GAAG;AAAA,MAAE;AAAEC,IAAAA;AAAF,GAAF;AAAA,SACnBA,MAAM,gBACHF,GADG,kCAE8BE,MAF9B,8CAGwCH,MAAM,CAAEG,MAAF,CAAN,CACzCC,MADyC,CACjC,GADiC,EAEzCC,KAFyC,EAHxC,8CAMwCL,MAAM,CAAEG,MAAF,CAAN,CACzCC,MADyC,CACjC,GADiC,EAEzCC,KAFyC,EANxC,w0CAUHC,SAXgB;AAAA,CAApB;;AAaA,OAAO,MAAMC,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,GAChBL,WADgB,qwCAAb","sourcesContent":["/**\n * External dependencies\n */\nimport { colord } from 'colord';\nimport styled from '@emotion/styled';\nimport { css } from '@emotion/react';\n\n/**\n * Internal dependencies\n */\nimport type { ThemeProps } from './types';\n\nconst accentColor = ( { accent }: ThemeProps ) =>\n\taccent\n\t\t? css`\n\t\t\t\t--wp-components-color-accent: ${ accent };\n\t\t\t\t--wp-components-color-accent-darker-10: ${ colord( accent )\n\t\t\t\t\t.darken( 0.1 )\n\t\t\t\t\t.toHex() };\n\t\t\t\t--wp-components-color-accent-darker-20: ${ colord( accent )\n\t\t\t\t\t.darken( 0.2 )\n\t\t\t\t\t.toHex() };\n\t\t `\n\t\t: undefined;\n\nexport const Wrapper = styled.div< ThemeProps >`\n\t${ accentColor }\n`;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -59,12 +59,24 @@ export function ToggleControl(_ref) {
|
|
|
59
59
|
const cx = useCx();
|
|
60
60
|
const classes = cx('components-toggle-control', className, !__nextHasNoMarginBottom && /*#__PURE__*/css({
|
|
61
61
|
marginBottom: space(3)
|
|
62
|
-
}, process.env.NODE_ENV === "production" ? "" : ";label:classes;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvdG9nZ2xlLWNvbnRyb2wvaW5kZXgudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQTZEK0IiLCJmaWxlIjoiQHdvcmRwcmVzcy9jb21wb25lbnRzL3NyYy90b2dnbGUtY29udHJvbC9pbmRleC50c3giLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEV4dGVybmFsIGRlcGVuZGVuY2llc1xuICovXG5pbXBvcnQgdHlwZSB7IENoYW5nZUV2ZW50IH0gZnJvbSAncmVhY3QnO1xuaW1wb3J0IHsgY3NzIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnO1xuXG4vKipcbiAqIFdvcmRQcmVzcyBkZXBlbmRlbmNpZXNcbiAqL1xuaW1wb3J0IHsgdXNlSW5zdGFuY2VJZCB9IGZyb20gJ0B3b3JkcHJlc3MvY29tcG9zZSc7XG5cbi8qKlxuICogSW50ZXJuYWwgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCBGb3JtVG9nZ2xlIGZyb20gJy4uL2Zvcm0tdG9nZ2xlJztcbmltcG9ydCBCYXNlQ29udHJvbCBmcm9tICcuLi9iYXNlLWNvbnRyb2wnO1xuaW1wb3J0IHR5cGUgeyBXb3JkUHJlc3NDb21wb25lbnRQcm9wcyB9IGZyb20gJy4uL3VpL2NvbnRleHQvd29yZHByZXNzLWNvbXBvbmVudCc7XG5pbXBvcnQgdHlwZSB7IFRvZ2dsZUNvbnRyb2xQcm9wcyB9IGZyb20gJy4vdHlwZXMnO1xuaW1wb3J0IHsgSFN0YWNrIH0gZnJvbSAnLi4vaC1zdGFjayc7XG5pbXBvcnQgeyB1c2VDeCB9IGZyb20gJy4uL3V0aWxzJztcbmltcG9ydCB7IHNwYWNlIH0gZnJvbSA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";label:classes;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvdG9nZ2xlLWNvbnRyb2wvaW5kZXgudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQTZEK0IiLCJmaWxlIjoiQHdvcmRwcmVzcy9jb21wb25lbnRzL3NyYy90b2dnbGUtY29udHJvbC9pbmRleC50c3giLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEV4dGVybmFsIGRlcGVuZGVuY2llc1xuICovXG5pbXBvcnQgdHlwZSB7IENoYW5nZUV2ZW50IH0gZnJvbSAncmVhY3QnO1xuaW1wb3J0IHsgY3NzIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnO1xuXG4vKipcbiAqIFdvcmRQcmVzcyBkZXBlbmRlbmNpZXNcbiAqL1xuaW1wb3J0IHsgdXNlSW5zdGFuY2VJZCB9IGZyb20gJ0B3b3JkcHJlc3MvY29tcG9zZSc7XG5cbi8qKlxuICogSW50ZXJuYWwgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCBGb3JtVG9nZ2xlIGZyb20gJy4uL2Zvcm0tdG9nZ2xlJztcbmltcG9ydCBCYXNlQ29udHJvbCBmcm9tICcuLi9iYXNlLWNvbnRyb2wnO1xuaW1wb3J0IHR5cGUgeyBXb3JkUHJlc3NDb21wb25lbnRQcm9wcyB9IGZyb20gJy4uL3VpL2NvbnRleHQvd29yZHByZXNzLWNvbXBvbmVudCc7XG5pbXBvcnQgdHlwZSB7IFRvZ2dsZUNvbnRyb2xQcm9wcyB9IGZyb20gJy4vdHlwZXMnO1xuaW1wb3J0IHsgSFN0YWNrIH0gZnJvbSAnLi4vaC1zdGFjayc7XG5pbXBvcnQgeyB1c2VDeCB9IGZyb20gJy4uL3V0aWxzJztcbmltcG9ydCB7IHNwYWNlIH0gZnJvbSA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V0dXJuIChcblx0XHQ8QmFzZUNvbnRyb2xcblx0XHRcdGlkPXsgaWQgfVxuXHRcdFx0aGVscD17IGhlbHBMYWJlbCB9XG5cdFx0XHRjbGFzc05hbWU9eyBjbGFzc2VzIH1cblx0XHRcdF9fbmV4dEhhc05vTWFyZ2luQm90dG9tXG5cdFx0PlxuXHRcdFx0PEhTdGFjayBqdXN0aWZ5PVwiZmxleC1zdGFydFwiIHNwYWNpbmc9eyAzIH0+XG5cdFx0XHRcdDxGb3JtVG9nZ2xlXG5cdFx0XHRcdFx0aWQ9eyBpZCB9XG5cdFx0XHRcdFx0Y2hlY2tlZD17IGNoZWNrZWQgfVxuXHRcdFx0XHRcdG9uQ2hhbmdlPXsgb25DaGFuZ2VUb2dnbGUgfVxuXHRcdFx0XHRcdGFyaWEtZGVzY3JpYmVkYnk9eyBkZXNjcmliZWRCeSB9XG5cdFx0XHRcdFx0ZGlzYWJsZWQ9eyBkaXNhYmxlZCB9XG5cdFx0XHRcdC8+XG5cdFx0XHRcdDxsYWJlbFxuXHRcdFx0XHRcdGh0bWxGb3I9eyBpZCB9XG5cdFx0XHRcdFx0Y2xhc3NOYW1lPVwiY29tcG9uZW50cy10b2dnbGUtY29udHJvbF9fbGFiZWxcIlxuXHRcdFx0XHQ+XG5cdFx0XHRcdFx0eyBsYWJlbCB9XG5cdFx0XHRcdDwvbGFiZWw+XG5cdFx0XHQ8L0hTdGFjaz5cblx0XHQ8L0Jhc2VDb250cm9sPlxuXHQpO1xufVxuXG5leHBvcnQgZGVmYXVsdCBUb2dnbGVDb250cm9sO1xuIl19 */"));
|
|
63
63
|
let describedBy, helpLabel;
|
|
64
64
|
|
|
65
65
|
if (help) {
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
if (typeof help === 'function') {
|
|
67
|
+
// `help` as a function works only for controlled components where
|
|
68
|
+
// `checked` is passed down from parent component. Uncontrolled
|
|
69
|
+
// component can show only a static help label.
|
|
70
|
+
if (checked !== undefined) {
|
|
71
|
+
helpLabel = help(checked);
|
|
72
|
+
}
|
|
73
|
+
} else {
|
|
74
|
+
helpLabel = help;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (helpLabel) {
|
|
78
|
+
describedBy = id + '__help';
|
|
79
|
+
}
|
|
68
80
|
}
|
|
69
81
|
|
|
70
82
|
return createElement(BaseControl, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/toggle-control/index.tsx"],"names":["css","useInstanceId","FormToggle","BaseControl","HStack","useCx","space","ToggleControl","__nextHasNoMarginBottom","label","checked","help","className","onChange","disabled","onChangeToggle","event","target","instanceId","id","cx","classes","marginBottom","describedBy","helpLabel"],"mappings":";;AAAA;AACA;AACA;AAEA,SAASA,GAAT,QAAoB,gBAApB;AAEA;AACA;AACA;;AACA,SAASC,aAAT,QAA8B,oBAA9B;AAEA;AACA;AACA;;AACA,OAAOC,UAAP,MAAuB,gBAAvB;AACA,OAAOC,WAAP,MAAwB,iBAAxB;AAGA,SAASC,MAAT,QAAuB,YAAvB;AACA,SAASC,KAAT,QAAsB,UAAtB;AACA,SAASC,KAAT,QAAsB,mBAAtB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,aAAT,OAQ4D;AAAA,MARpC;AAC9BC,IAAAA,uBAD8B;AAE9BC,IAAAA,KAF8B;AAG9BC,IAAAA,OAH8B;AAI9BC,IAAAA,IAJ8B;AAK9BC,IAAAA,SAL8B;AAM9BC,IAAAA,QAN8B;AAO9BC,IAAAA;AAP8B,GAQoC;;AAClE,WAASC,cAAT,CAAyBC,KAAzB,EAAkE;AACjEH,IAAAA,QAAQ,CAAEG,KAAK,CAACC,MAAN,CAAaP,OAAf,CAAR;AACA;;AACD,QAAMQ,UAAU,GAAGjB,aAAa,CAAEM,aAAF,CAAhC;AACA,QAAMY,EAAE,GAAI,4BAA4BD,UAAY,EAApD;AAEA,QAAME,EAAE,GAAGf,KAAK,EAAhB;AACA,QAAMgB,OAAO,GAAGD,EAAE,CACjB,2BADiB,EAEjBR,SAFiB,EAGjB,CAAEJ,uBAAF,iBAA6BR,GAAG,CAAE;AAAEsB,IAAAA,YAAY,EAAEhB,KAAK,CAAE,CAAF;AAArB,GAAF,
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/toggle-control/index.tsx"],"names":["css","useInstanceId","FormToggle","BaseControl","HStack","useCx","space","ToggleControl","__nextHasNoMarginBottom","label","checked","help","className","onChange","disabled","onChangeToggle","event","target","instanceId","id","cx","classes","marginBottom","describedBy","helpLabel","undefined"],"mappings":";;AAAA;AACA;AACA;AAEA,SAASA,GAAT,QAAoB,gBAApB;AAEA;AACA;AACA;;AACA,SAASC,aAAT,QAA8B,oBAA9B;AAEA;AACA;AACA;;AACA,OAAOC,UAAP,MAAuB,gBAAvB;AACA,OAAOC,WAAP,MAAwB,iBAAxB;AAGA,SAASC,MAAT,QAAuB,YAAvB;AACA,SAASC,KAAT,QAAsB,UAAtB;AACA,SAASC,KAAT,QAAsB,mBAAtB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,aAAT,OAQ4D;AAAA,MARpC;AAC9BC,IAAAA,uBAD8B;AAE9BC,IAAAA,KAF8B;AAG9BC,IAAAA,OAH8B;AAI9BC,IAAAA,IAJ8B;AAK9BC,IAAAA,SAL8B;AAM9BC,IAAAA,QAN8B;AAO9BC,IAAAA;AAP8B,GAQoC;;AAClE,WAASC,cAAT,CAAyBC,KAAzB,EAAkE;AACjEH,IAAAA,QAAQ,CAAEG,KAAK,CAACC,MAAN,CAAaP,OAAf,CAAR;AACA;;AACD,QAAMQ,UAAU,GAAGjB,aAAa,CAAEM,aAAF,CAAhC;AACA,QAAMY,EAAE,GAAI,4BAA4BD,UAAY,EAApD;AAEA,QAAME,EAAE,GAAGf,KAAK,EAAhB;AACA,QAAMgB,OAAO,GAAGD,EAAE,CACjB,2BADiB,EAEjBR,SAFiB,EAGjB,CAAEJ,uBAAF,iBAA6BR,GAAG,CAAE;AAAEsB,IAAAA,YAAY,EAAEhB,KAAK,CAAE,CAAF;AAArB,GAAF,ilIAHf,CAAlB;AAMA,MAAIiB,WAAJ,EAAiBC,SAAjB;;AACA,MAAKb,IAAL,EAAY;AACX,QAAK,OAAOA,IAAP,KAAgB,UAArB,EAAkC;AACjC;AACA;AACA;AACA,UAAKD,OAAO,KAAKe,SAAjB,EAA6B;AAC5BD,QAAAA,SAAS,GAAGb,IAAI,CAAED,OAAF,CAAhB;AACA;AACD,KAPD,MAOO;AACNc,MAAAA,SAAS,GAAGb,IAAZ;AACA;;AACD,QAAKa,SAAL,EAAiB;AAChBD,MAAAA,WAAW,GAAGJ,EAAE,GAAG,QAAnB;AACA;AACD;;AAED,SACC,cAAC,WAAD;AACC,IAAA,EAAE,EAAGA,EADN;AAEC,IAAA,IAAI,EAAGK,SAFR;AAGC,IAAA,SAAS,EAAGH,OAHb;AAIC,IAAA,uBAAuB;AAJxB,KAMC,cAAC,MAAD;AAAQ,IAAA,OAAO,EAAC,YAAhB;AAA6B,IAAA,OAAO,EAAG;AAAvC,KACC,cAAC,UAAD;AACC,IAAA,EAAE,EAAGF,EADN;AAEC,IAAA,OAAO,EAAGT,OAFX;AAGC,IAAA,QAAQ,EAAGK,cAHZ;AAIC,wBAAmBQ,WAJpB;AAKC,IAAA,QAAQ,EAAGT;AALZ,IADD,EAQC;AACC,IAAA,OAAO,EAAGK,EADX;AAEC,IAAA,SAAS,EAAC;AAFX,KAIGV,KAJH,CARD,CAND,CADD;AAwBA;AAED,eAAeF,aAAf","sourcesContent":["/**\n * External dependencies\n */\nimport type { ChangeEvent } from 'react';\nimport { css } from '@emotion/react';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport FormToggle from '../form-toggle';\nimport BaseControl from '../base-control';\nimport type { WordPressComponentProps } from '../ui/context/wordpress-component';\nimport type { ToggleControlProps } from './types';\nimport { HStack } from '../h-stack';\nimport { useCx } from '../utils';\nimport { space } from '../ui/utils/space';\n\n/**\n * ToggleControl is used to generate a toggle user interface.\n *\n * ```jsx\n * import { ToggleControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyToggleControl = () => {\n * const [ value, setValue ] = useState( false );\n *\n * return (\n * <ToggleControl\n * label=\"Fixed Background\"\n * checked={ value }\n * onChange={ () => setValue( ( state ) => ! state ) }\n * />\n * );\n * };\n * ```\n */\nexport function ToggleControl( {\n\t__nextHasNoMarginBottom,\n\tlabel,\n\tchecked,\n\thelp,\n\tclassName,\n\tonChange,\n\tdisabled,\n}: WordPressComponentProps< ToggleControlProps, 'input', false > ) {\n\tfunction onChangeToggle( event: ChangeEvent< HTMLInputElement > ) {\n\t\tonChange( event.target.checked );\n\t}\n\tconst instanceId = useInstanceId( ToggleControl );\n\tconst id = `inspector-toggle-control-${ instanceId }`;\n\n\tconst cx = useCx();\n\tconst classes = cx(\n\t\t'components-toggle-control',\n\t\tclassName,\n\t\t! __nextHasNoMarginBottom && css( { marginBottom: space( 3 ) } )\n\t);\n\n\tlet describedBy, helpLabel;\n\tif ( help ) {\n\t\tif ( typeof help === 'function' ) {\n\t\t\t// `help` as a function works only for controlled components where\n\t\t\t// `checked` is passed down from parent component. Uncontrolled\n\t\t\t// component can show only a static help label.\n\t\t\tif ( checked !== undefined ) {\n\t\t\t\thelpLabel = help( checked );\n\t\t\t}\n\t\t} else {\n\t\t\thelpLabel = help;\n\t\t}\n\t\tif ( helpLabel ) {\n\t\t\tdescribedBy = id + '__help';\n\t\t}\n\t}\n\n\treturn (\n\t\t<BaseControl\n\t\t\tid={ id }\n\t\t\thelp={ helpLabel }\n\t\t\tclassName={ classes }\n\t\t\t__nextHasNoMarginBottom\n\t\t>\n\t\t\t<HStack justify=\"flex-start\" spacing={ 3 }>\n\t\t\t\t<FormToggle\n\t\t\t\t\tid={ id }\n\t\t\t\t\tchecked={ checked }\n\t\t\t\t\tonChange={ onChangeToggle }\n\t\t\t\t\taria-describedby={ describedBy }\n\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t/>\n\t\t\t\t<label\n\t\t\t\t\thtmlFor={ id }\n\t\t\t\t\tclassName=\"components-toggle-control__label\"\n\t\t\t\t>\n\t\t\t\t\t{ label }\n\t\t\t\t</label>\n\t\t\t</HStack>\n\t\t</BaseControl>\n\t);\n}\n\nexport default ToggleControl;\n"]}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import { createElement } from "@wordpress/element";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* External dependencies
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* WordPress dependencies
|
|
10
|
+
*/
|
|
11
|
+
import { useMergeRefs, useInstanceId, usePrevious, useResizeObserver } from '@wordpress/compose';
|
|
12
|
+
import { forwardRef, useRef, useState } from '@wordpress/element';
|
|
13
|
+
/**
|
|
14
|
+
* Internal dependencies
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { View } from '../../view';
|
|
18
|
+
import ToggleGroupControlBackdrop from './toggle-group-control-backdrop';
|
|
19
|
+
import ToggleGroupControlContext from '../context';
|
|
20
|
+
import { useUpdateEffect } from '../../utils/hooks';
|
|
21
|
+
|
|
22
|
+
function UnforwardedToggleGroupControlAsButtonGroup(_ref, forwardedRef) {
|
|
23
|
+
let {
|
|
24
|
+
children,
|
|
25
|
+
isAdaptiveWidth,
|
|
26
|
+
label,
|
|
27
|
+
onChange,
|
|
28
|
+
size,
|
|
29
|
+
value,
|
|
30
|
+
...otherProps
|
|
31
|
+
} = _ref;
|
|
32
|
+
const containerRef = useRef();
|
|
33
|
+
const [resizeListener, sizes] = useResizeObserver();
|
|
34
|
+
const baseId = useInstanceId(ToggleGroupControlAsButtonGroup, 'toggle-group-control-as-button-group').toString();
|
|
35
|
+
const [selectedValue, setSelectedValue] = useState(value);
|
|
36
|
+
const groupContext = {
|
|
37
|
+
baseId,
|
|
38
|
+
state: selectedValue,
|
|
39
|
+
setState: setSelectedValue
|
|
40
|
+
};
|
|
41
|
+
const previousValue = usePrevious(value); // Propagate groupContext.state change.
|
|
42
|
+
|
|
43
|
+
useUpdateEffect(() => {
|
|
44
|
+
// Avoid calling onChange if groupContext state changed
|
|
45
|
+
// from incoming value.
|
|
46
|
+
if (previousValue !== groupContext.state) {
|
|
47
|
+
onChange(groupContext.state);
|
|
48
|
+
}
|
|
49
|
+
}, [groupContext.state]); // Sync incoming value with groupContext.state.
|
|
50
|
+
|
|
51
|
+
useUpdateEffect(() => {
|
|
52
|
+
if (value !== groupContext.state) {
|
|
53
|
+
groupContext.setState(value);
|
|
54
|
+
}
|
|
55
|
+
}, [value]);
|
|
56
|
+
return createElement(ToggleGroupControlContext.Provider, {
|
|
57
|
+
value: { ...groupContext,
|
|
58
|
+
isBlock: !isAdaptiveWidth,
|
|
59
|
+
isDeselectable: true,
|
|
60
|
+
size
|
|
61
|
+
}
|
|
62
|
+
}, createElement(View, _extends({
|
|
63
|
+
"aria-label": label
|
|
64
|
+
}, otherProps, {
|
|
65
|
+
ref: useMergeRefs([containerRef, forwardedRef]),
|
|
66
|
+
role: "group"
|
|
67
|
+
}), resizeListener, createElement(ToggleGroupControlBackdrop, {
|
|
68
|
+
state: groupContext.state,
|
|
69
|
+
containerRef: containerRef,
|
|
70
|
+
containerWidth: sizes.width,
|
|
71
|
+
isAdaptiveWidth: isAdaptiveWidth
|
|
72
|
+
}), children));
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export const ToggleGroupControlAsButtonGroup = forwardRef(UnforwardedToggleGroupControlAsButtonGroup);
|
|
76
|
+
//# sourceMappingURL=as-button-group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/toggle-group-control/toggle-group-control/as-button-group.tsx"],"names":["useMergeRefs","useInstanceId","usePrevious","useResizeObserver","forwardRef","useRef","useState","View","ToggleGroupControlBackdrop","ToggleGroupControlContext","useUpdateEffect","UnforwardedToggleGroupControlAsButtonGroup","forwardedRef","children","isAdaptiveWidth","label","onChange","size","value","otherProps","containerRef","resizeListener","sizes","baseId","ToggleGroupControlAsButtonGroup","toString","selectedValue","setSelectedValue","groupContext","state","setState","previousValue","isBlock","isDeselectable","width"],"mappings":";;;AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SACCA,YADD,EAECC,aAFD,EAGCC,WAHD,EAICC,iBAJD,QAKO,oBALP;AAMA,SAASC,UAAT,EAAqBC,MAArB,EAA6BC,QAA7B,QAA6C,oBAA7C;AAEA;AACA;AACA;;AACA,SAASC,IAAT,QAAqB,YAArB;AACA,OAAOC,0BAAP,MAAuC,iCAAvC;AACA,OAAOC,yBAAP,MAAsC,YAAtC;AACA,SAASC,eAAT,QAAgC,mBAAhC;;AAIA,SAASC,0CAAT,OAcCC,YAdD,EAeE;AAAA,MAdD;AACCC,IAAAA,QADD;AAECC,IAAAA,eAFD;AAGCC,IAAAA,KAHD;AAICC,IAAAA,QAJD;AAKCC,IAAAA,IALD;AAMCC,IAAAA,KAND;AAOC,OAAGC;AAPJ,GAcC;AACD,QAAMC,YAAY,GAAGf,MAAM,EAA3B;AACA,QAAM,CAAEgB,cAAF,EAAkBC,KAAlB,IAA4BnB,iBAAiB,EAAnD;AACA,QAAMoB,MAAM,GAAGtB,aAAa,CAC3BuB,+BAD2B,EAE3B,sCAF2B,CAAb,CAGbC,QAHa,EAAf;AAIA,QAAM,CAAEC,aAAF,EAAiBC,gBAAjB,IAAsCrB,QAAQ,CAAEY,KAAF,CAApD;AACA,QAAMU,YAAY,GAAG;AACpBL,IAAAA,MADoB;AAEpBM,IAAAA,KAAK,EAAEH,aAFa;AAGpBI,IAAAA,QAAQ,EAAEH;AAHU,GAArB;AAKA,QAAMI,aAAa,GAAG7B,WAAW,CAAEgB,KAAF,CAAjC,CAbC,CAeD;;AACAR,EAAAA,eAAe,CAAE,MAAM;AACtB;AACA;AACA,QAAKqB,aAAa,KAAKH,YAAY,CAACC,KAApC,EAA4C;AAC3Cb,MAAAA,QAAQ,CAAEY,YAAY,CAACC,KAAf,CAAR;AACA;AACD,GANc,EAMZ,CAAED,YAAY,CAACC,KAAf,CANY,CAAf,CAhBC,CAwBD;;AACAnB,EAAAA,eAAe,CAAE,MAAM;AACtB,QAAKQ,KAAK,KAAKU,YAAY,CAACC,KAA5B,EAAoC;AACnCD,MAAAA,YAAY,CAACE,QAAb,CAAuBZ,KAAvB;AACA;AACD,GAJc,EAIZ,CAAEA,KAAF,CAJY,CAAf;AAMA,SACC,cAAC,yBAAD,CAA2B,QAA3B;AACC,IAAA,KAAK,EAAG,EACP,GAAGU,YADI;AAEPI,MAAAA,OAAO,EAAE,CAAElB,eAFJ;AAGPmB,MAAAA,cAAc,EAAE,IAHT;AAIPhB,MAAAA;AAJO;AADT,KAQC,cAAC,IAAD;AACC,kBAAaF;AADd,KAEMI,UAFN;AAGC,IAAA,GAAG,EAAGnB,YAAY,CAAE,CAAEoB,YAAF,EAAgBR,YAAhB,CAAF,CAHnB;AAIC,IAAA,IAAI,EAAC;AAJN,MAMGS,cANH,EAOC,cAAC,0BAAD;AACC,IAAA,KAAK,EAAGO,YAAY,CAACC,KADtB;AAEC,IAAA,YAAY,EAAGT,YAFhB;AAGC,IAAA,cAAc,EAAGE,KAAK,CAACY,KAHxB;AAIC,IAAA,eAAe,EAAGpB;AAJnB,IAPD,EAaGD,QAbH,CARD,CADD;AA0BA;;AAED,OAAO,MAAMW,+BAA+B,GAAGpB,UAAU,CACxDO,0CADwD,CAAlD","sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseMergeRefs,\n\tuseInstanceId,\n\tusePrevious,\n\tuseResizeObserver,\n} from '@wordpress/compose';\nimport { forwardRef, useRef, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { View } from '../../view';\nimport ToggleGroupControlBackdrop from './toggle-group-control-backdrop';\nimport ToggleGroupControlContext from '../context';\nimport { useUpdateEffect } from '../../utils/hooks';\nimport type { WordPressComponentProps } from '../../ui/context';\nimport type { ToggleGroupControlMainControlProps } from '../types';\n\nfunction UnforwardedToggleGroupControlAsButtonGroup(\n\t{\n\t\tchildren,\n\t\tisAdaptiveWidth,\n\t\tlabel,\n\t\tonChange,\n\t\tsize,\n\t\tvalue,\n\t\t...otherProps\n\t}: WordPressComponentProps<\n\t\tToggleGroupControlMainControlProps,\n\t\t'div',\n\t\tfalse\n\t>,\n\tforwardedRef: ForwardedRef< HTMLDivElement >\n) {\n\tconst containerRef = useRef();\n\tconst [ resizeListener, sizes ] = useResizeObserver();\n\tconst baseId = useInstanceId(\n\t\tToggleGroupControlAsButtonGroup,\n\t\t'toggle-group-control-as-button-group'\n\t).toString();\n\tconst [ selectedValue, setSelectedValue ] = useState( value );\n\tconst groupContext = {\n\t\tbaseId,\n\t\tstate: selectedValue,\n\t\tsetState: setSelectedValue,\n\t};\n\tconst previousValue = usePrevious( value );\n\n\t// Propagate groupContext.state change.\n\tuseUpdateEffect( () => {\n\t\t// Avoid calling onChange if groupContext state changed\n\t\t// from incoming value.\n\t\tif ( previousValue !== groupContext.state ) {\n\t\t\tonChange( groupContext.state );\n\t\t}\n\t}, [ groupContext.state ] );\n\n\t// Sync incoming value with groupContext.state.\n\tuseUpdateEffect( () => {\n\t\tif ( value !== groupContext.state ) {\n\t\t\tgroupContext.setState( value );\n\t\t}\n\t}, [ value ] );\n\n\treturn (\n\t\t<ToggleGroupControlContext.Provider\n\t\t\tvalue={ {\n\t\t\t\t...groupContext,\n\t\t\t\tisBlock: ! isAdaptiveWidth,\n\t\t\t\tisDeselectable: true,\n\t\t\t\tsize,\n\t\t\t} }\n\t\t>\n\t\t\t<View\n\t\t\t\taria-label={ label }\n\t\t\t\t{ ...otherProps }\n\t\t\t\tref={ useMergeRefs( [ containerRef, forwardedRef ] ) }\n\t\t\t\trole=\"group\"\n\t\t\t>\n\t\t\t\t{ resizeListener }\n\t\t\t\t<ToggleGroupControlBackdrop\n\t\t\t\t\tstate={ groupContext.state }\n\t\t\t\t\tcontainerRef={ containerRef }\n\t\t\t\t\tcontainerWidth={ sizes.width }\n\t\t\t\t\tisAdaptiveWidth={ isAdaptiveWidth }\n\t\t\t\t/>\n\t\t\t\t{ children }\n\t\t\t</View>\n\t\t</ToggleGroupControlContext.Provider>\n\t);\n}\n\nexport const ToggleGroupControlAsButtonGroup = forwardRef(\n\tUnforwardedToggleGroupControlAsButtonGroup\n);\n"]}
|