@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
|
@@ -31,17 +31,22 @@ function Slot(_ref, forwardedRef) {
|
|
|
31
31
|
as: Component = 'div',
|
|
32
32
|
...props
|
|
33
33
|
} = _ref;
|
|
34
|
-
const
|
|
34
|
+
const {
|
|
35
|
+
registerSlot,
|
|
36
|
+
unregisterSlot,
|
|
37
|
+
...registry
|
|
38
|
+
} = (0, _element.useContext)(_slotFillContext.default);
|
|
35
39
|
const ref = (0, _element.useRef)();
|
|
36
40
|
(0, _element.useLayoutEffect)(() => {
|
|
37
|
-
|
|
41
|
+
registerSlot(name, ref, fillProps);
|
|
38
42
|
return () => {
|
|
39
|
-
|
|
40
|
-
}; //
|
|
41
|
-
//
|
|
42
|
-
//
|
|
43
|
-
//
|
|
44
|
-
|
|
43
|
+
unregisterSlot(name, ref);
|
|
44
|
+
}; // Ignore reason: We don't want to unregister and register the slot whenever
|
|
45
|
+
// `fillProps` change, which would cause the fill to be re-mounted. Instead,
|
|
46
|
+
// we can just update the slot (see hook below).
|
|
47
|
+
// For more context, see https://github.com/WordPress/gutenberg/pull/44403#discussion_r994415973
|
|
48
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
49
|
+
}, [registerSlot, unregisterSlot, name]); // fillProps may be an update that interacts with the layout, so we
|
|
45
50
|
// useLayoutEffect.
|
|
46
51
|
|
|
47
52
|
(0, _element.useLayoutEffect)(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/slot-fill/bubbles-virtually/slot.js"],"names":["Slot","forwardedRef","name","fillProps","as","Component","props","
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/slot-fill/bubbles-virtually/slot.js"],"names":["Slot","forwardedRef","name","fillProps","as","Component","props","registerSlot","unregisterSlot","registry","SlotFillContext","ref","updateSlot"],"mappings":";;;;;;;;;AAIA;;;;AAMA;;AAKA;;AAfA;;AACA;AACA;AACA;;AASA;AACA;AACA;AAGA,SAASA,IAAT,OAECC,YAFD,EAGE;AAAA,MAFD;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,SAAS,GAAG,EAApB;AAAwBC,IAAAA,EAAE,EAAEC,SAAS,GAAG,KAAxC;AAA+C,OAAGC;AAAlD,GAEC;AACD,QAAM;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA,cAAhB;AAAgC,OAAGC;AAAnC,MACL,yBAAYC,wBAAZ,CADD;AAEA,QAAMC,GAAG,GAAG,sBAAZ;AAEA,gCAAiB,MAAM;AACtBJ,IAAAA,YAAY,CAAEL,IAAF,EAAQS,GAAR,EAAaR,SAAb,CAAZ;AACA,WAAO,MAAM;AACZK,MAAAA,cAAc,CAAEN,IAAF,EAAQS,GAAR,CAAd;AACA,KAFD,CAFsB,CAKtB;AACA;AACA;AACA;AACA;AACA,GAVD,EAUG,CAAEJ,YAAF,EAAgBC,cAAhB,EAAgCN,IAAhC,CAVH,EALC,CAgBD;AACA;;AACA,gCAAiB,MAAM;AACtBO,IAAAA,QAAQ,CAACG,UAAT,CAAqBV,IAArB,EAA2BC,SAA3B;AACA,GAFD;AAIA,SACC,4BAAC,SAAD;AAAW,IAAA,GAAG,EAAG,2BAAc,CAAEF,YAAF,EAAgBU,GAAhB,CAAd;AAAjB,KAA8DL,KAA9D,EADD;AAGA;;eAEc,yBAAYN,IAAZ,C","sourcesContent":["// @ts-nocheck\n/**\n * WordPress dependencies\n */\nimport {\n\tuseRef,\n\tuseLayoutEffect,\n\tuseContext,\n\tforwardRef,\n} from '@wordpress/element';\nimport { useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport SlotFillContext from './slot-fill-context';\n\nfunction Slot(\n\t{ name, fillProps = {}, as: Component = 'div', ...props },\n\tforwardedRef\n) {\n\tconst { registerSlot, unregisterSlot, ...registry } =\n\t\tuseContext( SlotFillContext );\n\tconst ref = useRef();\n\n\tuseLayoutEffect( () => {\n\t\tregisterSlot( name, ref, fillProps );\n\t\treturn () => {\n\t\t\tunregisterSlot( name, ref );\n\t\t};\n\t\t// Ignore reason: We don't want to unregister and register the slot whenever\n\t\t// `fillProps` change, which would cause the fill to be re-mounted. Instead,\n\t\t// we can just update the slot (see hook below).\n\t\t// For more context, see https://github.com/WordPress/gutenberg/pull/44403#discussion_r994415973\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ registerSlot, unregisterSlot, name ] );\n\t// fillProps may be an update that interacts with the layout, so we\n\t// useLayoutEffect.\n\tuseLayoutEffect( () => {\n\t\tregistry.updateSlot( name, fillProps );\n\t} );\n\n\treturn (\n\t\t<Component ref={ useMergeRefs( [ forwardedRef, ref ] ) } { ...props } />\n\t);\n}\n\nexport default forwardRef( Slot );\n"]}
|
|
@@ -27,7 +27,13 @@ var _slotFillContext = _interopRequireDefault(require("./slot-fill-context"));
|
|
|
27
27
|
* Internal dependencies
|
|
28
28
|
*/
|
|
29
29
|
function useSlot(name) {
|
|
30
|
-
const
|
|
30
|
+
const {
|
|
31
|
+
updateSlot: registryUpdateSlot,
|
|
32
|
+
unregisterSlot: registryUnregisterSlot,
|
|
33
|
+
registerFill: registryRegisterFill,
|
|
34
|
+
unregisterFill: registryUnregisterFill,
|
|
35
|
+
...registry
|
|
36
|
+
} = (0, _element.useContext)(_slotFillContext.default);
|
|
31
37
|
const slots = (0, _valtio.useSnapshot)(registry.slots, {
|
|
32
38
|
sync: true
|
|
33
39
|
}); // The important bit here is that this call ensures
|
|
@@ -36,17 +42,17 @@ function useSlot(name) {
|
|
|
36
42
|
|
|
37
43
|
const slot = slots.get(name);
|
|
38
44
|
const updateSlot = (0, _element.useCallback)(fillProps => {
|
|
39
|
-
|
|
40
|
-
}, [name,
|
|
45
|
+
registryUpdateSlot(name, fillProps);
|
|
46
|
+
}, [name, registryUpdateSlot]);
|
|
41
47
|
const unregisterSlot = (0, _element.useCallback)(slotRef => {
|
|
42
|
-
|
|
43
|
-
}, [name,
|
|
48
|
+
registryUnregisterSlot(name, slotRef);
|
|
49
|
+
}, [name, registryUnregisterSlot]);
|
|
44
50
|
const registerFill = (0, _element.useCallback)(fillRef => {
|
|
45
|
-
|
|
46
|
-
}, [name,
|
|
51
|
+
registryRegisterFill(name, fillRef);
|
|
52
|
+
}, [name, registryRegisterFill]);
|
|
47
53
|
const unregisterFill = (0, _element.useCallback)(fillRef => {
|
|
48
|
-
|
|
49
|
-
}, [name,
|
|
54
|
+
registryUnregisterFill(name, fillRef);
|
|
55
|
+
}, [name, registryUnregisterFill]);
|
|
50
56
|
return { ...slot,
|
|
51
57
|
updateSlot,
|
|
52
58
|
unregisterSlot,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/slot-fill/bubbles-virtually/use-slot.js"],"names":["useSlot","name","
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/slot-fill/bubbles-virtually/use-slot.js"],"names":["useSlot","name","updateSlot","registryUpdateSlot","unregisterSlot","registryUnregisterSlot","registerFill","registryRegisterFill","unregisterFill","registryUnregisterFill","registry","SlotFillContext","slots","sync","slot","get","fillProps","slotRef","fillRef"],"mappings":";;;;;;;;;AAIA;;AAKA;;AAKA;;AAdA;;AACA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AAGe,SAASA,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,MAMF,yBAAYC,wBAAZ,CANJ;AAOA,QAAMC,KAAK,GAAG,yBAAaF,QAAQ,CAACE,KAAtB,EAA6B;AAAEC,IAAAA,IAAI,EAAE;AAAR,GAA7B,CAAd,CARuC,CASvC;AACA;AACA;;AACA,QAAMC,IAAI,GAAGF,KAAK,CAACG,GAAN,CAAWd,IAAX,CAAb;AAEA,QAAMC,UAAU,GAAG,0BAChBc,SAAF,IAAiB;AAChBb,IAAAA,kBAAkB,CAAEF,IAAF,EAAQe,SAAR,CAAlB;AACA,GAHiB,EAIlB,CAAEf,IAAF,EAAQE,kBAAR,CAJkB,CAAnB;AAOA,QAAMC,cAAc,GAAG,0BACpBa,OAAF,IAAe;AACdZ,IAAAA,sBAAsB,CAAEJ,IAAF,EAAQgB,OAAR,CAAtB;AACA,GAHqB,EAItB,CAAEhB,IAAF,EAAQI,sBAAR,CAJsB,CAAvB;AAOA,QAAMC,YAAY,GAAG,0BAClBY,OAAF,IAAe;AACdX,IAAAA,oBAAoB,CAAEN,IAAF,EAAQiB,OAAR,CAApB;AACA,GAHmB,EAIpB,CAAEjB,IAAF,EAAQM,oBAAR,CAJoB,CAArB;AAOA,QAAMC,cAAc,GAAG,0BACpBU,OAAF,IAAe;AACdT,IAAAA,sBAAsB,CAAER,IAAF,EAAQiB,OAAR,CAAtB;AACA,GAHqB,EAItB,CAAEjB,IAAF,EAAQQ,sBAAR,CAJsB,CAAvB;AAOA,SAAO,EACN,GAAGK,IADG;AAENZ,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"]}
|
package/build/slot-fill/fill.js
CHANGED
|
@@ -37,15 +37,21 @@ function FillComponent(_ref) {
|
|
|
37
37
|
children
|
|
38
38
|
});
|
|
39
39
|
(0, _element.useLayoutEffect)(() => {
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
const refValue = ref.current;
|
|
41
|
+
registerFill(name, refValue);
|
|
42
|
+
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.
|
|
43
|
+
// We'll leave them as-is until a more detailed investigation/refactor can be performed.
|
|
44
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
42
45
|
}, []);
|
|
43
46
|
(0, _element.useLayoutEffect)(() => {
|
|
44
47
|
ref.current.children = children;
|
|
45
48
|
|
|
46
49
|
if (slot) {
|
|
47
50
|
slot.forceUpdate();
|
|
48
|
-
}
|
|
51
|
+
} // Ignore reason: the useLayoutEffects here are written to fire at specific times, and introducing new dependencies could cause unexpected changes in behavior.
|
|
52
|
+
// We'll leave them as-is until a more detailed investigation/refactor can be performed.
|
|
53
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
54
|
+
|
|
49
55
|
}, [children]);
|
|
50
56
|
(0, _element.useLayoutEffect)(() => {
|
|
51
57
|
if (name === ref.current.name) {
|
|
@@ -55,7 +61,9 @@ function FillComponent(_ref) {
|
|
|
55
61
|
|
|
56
62
|
unregisterFill(ref.current.name, ref.current);
|
|
57
63
|
ref.current.name = name;
|
|
58
|
-
registerFill(name, ref.current);
|
|
64
|
+
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.
|
|
65
|
+
// We'll leave them as-is until a more detailed investigation/refactor can be performed.
|
|
66
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
59
67
|
}, [name]);
|
|
60
68
|
|
|
61
69
|
if (!slot || !slot.node) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/slot-fill/fill.js"],"names":["FillComponent","name","children","registerFill","unregisterFill","slot","ref","current","forceUpdate","node","props","fillProps","Fill"],"mappings":";;;;;;;;;AAKA;;;;AAKA;;AACA;;AAXA;;AAEA;AACA;AACA;;AAGA;AACA;AACA;AAIA,SAASA,aAAT,OAA2E;AAAA,MAAnD;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,QAAR;AAAkBC,IAAAA,YAAlB;AAAgCC,IAAAA;AAAhC,GAAmD;AAC1E,QAAMC,IAAI,GAAG,sBAASJ,IAAT,CAAb;AAEA,QAAMK,GAAG,GAAG,qBAAQ;AACnBL,IAAAA,IADmB;AAEnBC,IAAAA;AAFmB,GAAR,CAAZ;AAKA,gCAAiB,MAAM;
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/slot-fill/fill.js"],"names":["FillComponent","name","children","registerFill","unregisterFill","slot","ref","refValue","current","forceUpdate","node","props","fillProps","Fill"],"mappings":";;;;;;;;;AAKA;;;;AAKA;;AACA;;AAXA;;AAEA;AACA;AACA;;AAGA;AACA;AACA;AAIA,SAASA,aAAT,OAA2E;AAAA,MAAnD;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,QAAR;AAAkBC,IAAAA,YAAlB;AAAgCC,IAAAA;AAAhC,GAAmD;AAC1E,QAAMC,IAAI,GAAG,sBAASJ,IAAT,CAAb;AAEA,QAAMK,GAAG,GAAG,qBAAQ;AACnBL,IAAAA,IADmB;AAEnBC,IAAAA;AAFmB,GAAR,CAAZ;AAKA,gCAAiB,MAAM;AACtB,UAAMK,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,GAPD,EAOG,EAPH;AASA,gCAAiB,MAAM;AACtBD,IAAAA,GAAG,CAACE,OAAJ,CAAYN,QAAZ,GAAuBA,QAAvB;;AACA,QAAKG,IAAL,EAAY;AACXA,MAAAA,IAAI,CAACI,WAAL;AACA,KAJqB,CAKtB;AACA;AACA;;AACA,GARD,EAQG,CAAEP,QAAF,CARH;AAUA,gCAAiB,MAAM;AACtB,QAAKD,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,GAXD,EAWG,CAAEP,IAAF,CAXH;;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,SAAO,2BAAcV,QAAd,EAAwBG,IAAI,CAACK,IAA7B,CAAP;AACA;;AAED,MAAMG,IAAI,GAAKF,KAAF,IACZ,4BAAC,gBAAD,CAAiB,QAAjB,QACG;AAAA,MAAE;AAAER,IAAAA,YAAF;AAAgBC,IAAAA;AAAhB,GAAF;AAAA,SACD,4BAAC,aAAD,6BACMO,KADN;AAEC,IAAA,YAAY,EAAGR,YAFhB;AAGC,IAAA,cAAc,EAAGC;AAHlB,KADC;AAAA,CADH,CADD;;eAYeS,I","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"]}
|
|
@@ -38,7 +38,9 @@ const useSlot = name => {
|
|
|
38
38
|
const unsubscribe = subscribe(() => {
|
|
39
39
|
setSlot(getSlot(name));
|
|
40
40
|
});
|
|
41
|
-
return unsubscribe;
|
|
41
|
+
return unsubscribe; // Ignore reason: Modifying this dep array could introduce unexpected changes in behavior,
|
|
42
|
+
// so we'll leave it as=is until the hook can be properly refactored for exhaustive-deps.
|
|
43
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
42
44
|
}, [name]);
|
|
43
45
|
return slot;
|
|
44
46
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/slot-fill/use-slot.js"],"names":["useSlot","name","getSlot","subscribe","SlotFillContext","slot","setSlot","unsubscribe"],"mappings":";;;;;;;;;AAIA;;AAKA;;AATA;;AACA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,OAAO,GAAKC,IAAF,IAAY;AAC3B,QAAM;AAAEC,IAAAA,OAAF;AAAWC,IAAAA;AAAX,MAAyB,yBAAYC,gBAAZ,CAA/B;AACA,QAAM,CAAEC,IAAF,EAAQC,OAAR,IAAoB,uBAAUJ,OAAO,CAAED,IAAF,CAAjB,CAA1B;AAEA,0BAAW,MAAM;AAChBK,IAAAA,OAAO,CAAEJ,OAAO,CAAED,IAAF,CAAT,CAAP;AACA,UAAMM,WAAW,GAAGJ,SAAS,CAAE,MAAM;AACpCG,MAAAA,OAAO,CAAEJ,OAAO,CAAED,IAAF,CAAT,CAAP;AACA,KAF4B,CAA7B;AAIA,WAAOM,WAAP;AACA,
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/slot-fill/use-slot.js"],"names":["useSlot","name","getSlot","subscribe","SlotFillContext","slot","setSlot","unsubscribe"],"mappings":";;;;;;;;;AAIA;;AAKA;;AATA;;AACA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,OAAO,GAAKC,IAAF,IAAY;AAC3B,QAAM;AAAEC,IAAAA,OAAF;AAAWC,IAAAA;AAAX,MAAyB,yBAAYC,gBAAZ,CAA/B;AACA,QAAM,CAAEC,IAAF,EAAQC,OAAR,IAAoB,uBAAUJ,OAAO,CAAED,IAAF,CAAjB,CAA1B;AAEA,0BAAW,MAAM;AAChBK,IAAAA,OAAO,CAAEJ,OAAO,CAAED,IAAF,CAAT,CAAP;AACA,UAAMM,WAAW,GAAGJ,SAAS,CAAE,MAAM;AACpCG,MAAAA,OAAO,CAAEJ,OAAO,CAAED,IAAF,CAAT,CAAP;AACA,KAF4B,CAA7B;AAIA,WAAOM,WAAP,CANgB,CAOhB;AACA;AACA;AACA,GAVD,EAUG,CAAEN,IAAF,CAVH;AAYA,SAAOI,IAAP;AACA,CAjBD;;eAmBeL,O","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"]}
|
package/build/snackbar/index.js
CHANGED
|
@@ -100,7 +100,7 @@ function Snackbar(_ref, ref) {
|
|
|
100
100
|
}
|
|
101
101
|
}, NOTICE_TIMEOUT);
|
|
102
102
|
return () => clearTimeout(timeoutHandle);
|
|
103
|
-
}, [onDismiss, onRemove]);
|
|
103
|
+
}, [onDismiss, onRemove, explicitDismiss]);
|
|
104
104
|
const classes = (0, _classnames.default)(className, 'components-snackbar', {
|
|
105
105
|
'components-snackbar-explicit-dismiss': !!explicitDismiss
|
|
106
106
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/snackbar/index.js"],"names":["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":";;;;;;;;;AASA;;AANA;;AAKA;;AAEA;;AACA;;AAKA;;AAhBA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AAGA,MAAMA,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,GAAwC,6BAAgBA,OAAhB,CADzC;AAGA,0BAAW,MAAM;AAChB,QAAKE,aAAL,EAAqB;AACpB,uBAAOA,aAAP,EAAsBD,UAAtB;AACA;AACD,GAJD,EAIG,CAAEC,aAAF,EAAiBD,UAAjB,CAJH;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,IAAAA,IAAI,GAAG,IAPR;AAQCC,IAAAA,eAAe,GAAG,KARnB;AASC;AACA;AACA;AACAC,IAAAA,SAAS,GAAGd,IAZb;AAaCe,IAAAA;AAbD,GAgBC;AACDD,EAAAA,SAAS,GAAGA,SAAS,IAAId,IAAzB;;AAEA,WAASgB,SAAT,CAAoBC,KAApB,EAA4B;AAC3B,QAAKA,KAAK,IAAIA,KAAK,CAACC,cAApB,EAAqC;AACpCD,MAAAA,KAAK,CAACC,cAAN;AACA,KAH0B,CAK3B;;;AACAH,IAAAA,OAAO,CAACI,OAAR,CAAgBC,KAAhB;AAEAN,IAAAA,SAAS;AACTH,IAAAA,QAAQ;AACR;;AAED,WAASU,aAAT,CAAwBJ,KAAxB,EAA+BK,OAA/B,EAAyC;AACxCL,IAAAA,KAAK,CAACM,eAAN;AAEAZ,IAAAA,QAAQ;;AAER,QAAKW,OAAL,EAAe;AACdA,MAAAA,OAAO,CAAEL,KAAF,CAAP;AACA;AACD;;AAEDf,EAAAA,gBAAgB,CAAEG,aAAF,EAAiBD,UAAjB,CAAhB,CAzBC,CA2BD;;AACA,0BAAW,MAAM;AAChB,UAAMoB,aAAa,GAAGC,UAAU,CAAE,MAAM;AACvC,UAAK,CAAEZ,eAAP,EAAyB;AACxBC,QAAAA,SAAS;AACTH,QAAAA,QAAQ;AACR;AACD,KAL+B,EAK7BV,cAL6B,CAAhC;AAOA,WAAO,MAAMyB,YAAY,CAAEF,aAAF,CAAzB;AACA,GATD,EASG,CAAEV,SAAF,EAAaH,QAAb,CATH;AAWA,
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/snackbar/index.js"],"names":["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":";;;;;;;;;AASA;;AANA;;AAKA;;AAEA;;AACA;;AAKA;;AAhBA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AAGA,MAAMA,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,GAAwC,6BAAgBA,OAAhB,CADzC;AAGA,0BAAW,MAAM;AAChB,QAAKE,aAAL,EAAqB;AACpB,uBA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Aa,CAAEJ,KAAF,EAASK,OAAT,CALf;AAOC,MAAA,SAAS,EAAC;AAPX,OASGU,KATH,CADD;AAaA,GAdC,CALH,EAoBGnB,eAAe,IAChB;AACC,IAAA,IAAI,EAAC,QADN;AAEC,kBAAW,qBAFZ;AAGC,IAAA,QAAQ,EAAC,GAHV;AAIC,IAAA,SAAS,EAAC,qCAJX;AAKC,IAAA,OAAO,EAAGG,SALX;AAMC,IAAA,UAAU,EAAGA;AANd,cArBF,CATD,CADD;AA6CA;;eAEc,yBAAYV,QAAZ,C","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"]}
|
package/build/tab-panel/index.js
CHANGED
|
@@ -102,7 +102,7 @@ function TabPanel(_ref2) {
|
|
|
102
102
|
const instanceId = (0, _compose.useInstanceId)(TabPanel, 'tab-panel');
|
|
103
103
|
const [selected, setSelected] = (0, _element.useState)();
|
|
104
104
|
|
|
105
|
-
const
|
|
105
|
+
const handleTabSelection = tabKey => {
|
|
106
106
|
setSelected(tabKey);
|
|
107
107
|
onSelect === null || onSelect === void 0 ? void 0 : onSelect(tabKey);
|
|
108
108
|
};
|
|
@@ -116,14 +116,10 @@ function TabPanel(_ref2) {
|
|
|
116
116
|
});
|
|
117
117
|
const selectedId = `${instanceId}-${(_selectedTab$name = selectedTab === null || selectedTab === void 0 ? void 0 : selectedTab.name) !== null && _selectedTab$name !== void 0 ? _selectedTab$name : 'none'}`;
|
|
118
118
|
(0, _element.useEffect)(() => {
|
|
119
|
-
|
|
120
|
-
name
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
if (!newSelectedTab) {
|
|
124
|
-
setSelected(initialTabName || (tabs.length > 0 ? tabs[0].name : undefined));
|
|
119
|
+
if (!(selectedTab !== null && selectedTab !== void 0 && selectedTab.name) && tabs.length > 0) {
|
|
120
|
+
handleTabSelection(initialTabName || tabs[0].name);
|
|
125
121
|
}
|
|
126
|
-
}, [tabs]);
|
|
122
|
+
}, [tabs, selectedTab === null || selectedTab === void 0 ? void 0 : selectedTab.name, initialTabName]);
|
|
127
123
|
return (0, _element.createElement)("div", {
|
|
128
124
|
className: className
|
|
129
125
|
}, (0, _element.createElement)(_navigableContainer.NavigableMenu, {
|
|
@@ -139,7 +135,7 @@ function TabPanel(_ref2) {
|
|
|
139
135
|
"aria-controls": `${instanceId}-${tab.name}-view`,
|
|
140
136
|
selected: tab.name === selected,
|
|
141
137
|
key: tab.name,
|
|
142
|
-
onClick: () =>
|
|
138
|
+
onClick: () => handleTabSelection(tab.name)
|
|
143
139
|
}, tab.title))), selectedTab && (0, _element.createElement)("div", {
|
|
144
140
|
key: selectedId,
|
|
145
141
|
"aria-labelledby": selectedId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/tab-panel/index.tsx"],"names":["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":["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"],"m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,GAAG,CAACJ,IAXX;AAYC,IAAA,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;;eAEcf,Q","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":["UnforwardedTextControl","props","ref","__nextHasNoMarginBottom","label","hideLabelFromVision","value","help","className","onChange","type","additionalProps","instanceId","TextControl","id","onChangeValue","event","target","undefined"],"mappings":";;;;;;;;;AASA;;;;AADA;;AAMA;;AAdA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AAKA,SAASA,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,GAAG,4BAAeC,WAAf,CAAnB;AACA,QAAMC,EAAE,GAAI,0BAA0BF,UAAY,EAAlD;;AACA,QAAMG,aAAa,GAAKC,KAAF,IACrBP,QAAQ,CAAEO,KAAK,CAACC,MAAN,CAAaX,KAAf,CADT;;AAGA,SACC,4BAAC,oBAAD;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":["UnforwardedTextControl","props","ref","__nextHasNoMarginBottom","label","hideLabelFromVision","value","help","className","onChange","type","additionalProps","instanceId","TextControl","id","onChangeValue","event","target","undefined"],"mappings":";;;;;;;;;AASA;;;;AADA;;AAMA;;AAdA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AAKA,SAASA,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,GAAG,4BAAeC,WAAf,CAAnB;AACA,QAAMC,EAAE,GAAI,0BAA0BF,UAAY,EAAlD;;AACA,QAAMG,aAAa,GAAKC,KAAF,IACrBP,QAAQ,CAAEO,KAAK,CAACC,MAAN,CAAaX,KAAf,CADT;;AAGA,SACC,4BAAC,oBAAD;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;;;AACO,MAAME,WAAW,GAAG,yBAAYb,sBAAZ,CAApB;;eAEQa,W","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,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _element = require("@wordpress/element");
|
|
11
|
+
|
|
12
|
+
var _colord = require("colord");
|
|
13
|
+
|
|
14
|
+
var _a11y = _interopRequireDefault(require("colord/plugins/a11y"));
|
|
15
|
+
|
|
16
|
+
var _names = _interopRequireDefault(require("colord/plugins/names"));
|
|
17
|
+
|
|
18
|
+
var _styles = require("./styles");
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* External dependencies
|
|
22
|
+
*/
|
|
23
|
+
(0, _colord.extend)([_names.default, _a11y.default]);
|
|
24
|
+
/**
|
|
25
|
+
* `Theme` allows defining theme variables for components in the `@wordpress/components` package.
|
|
26
|
+
*
|
|
27
|
+
* Multiple `Theme` components can be nested in order to override specific theme variables.
|
|
28
|
+
*
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```jsx
|
|
32
|
+
* import { __experimentalTheme as Theme } from '@wordpress/components';
|
|
33
|
+
*
|
|
34
|
+
* const Example = () => {
|
|
35
|
+
* return (
|
|
36
|
+
* <Theme accent="red">
|
|
37
|
+
* <Button variant="primary">I'm red</Button>
|
|
38
|
+
* <Theme accent="blue">
|
|
39
|
+
* <Button variant="primary">I'm blue</Button>
|
|
40
|
+
* </Theme>
|
|
41
|
+
* </Theme>
|
|
42
|
+
* );
|
|
43
|
+
* };
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
function Theme(props) {
|
|
48
|
+
const {
|
|
49
|
+
accent
|
|
50
|
+
} = props;
|
|
51
|
+
|
|
52
|
+
if (accent && !(0, _colord.colord)(accent).isValid()) {
|
|
53
|
+
// eslint-disable-next-line no-console
|
|
54
|
+
console.warn(`wp.components.Theme: "${accent}" is not a valid color value for the 'accent' prop.`);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return (0, _element.createElement)(_styles.Wrapper, props);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
var _default = Theme;
|
|
61
|
+
exports.default = _default;
|
|
62
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/theme/index.tsx"],"names":["namesPlugin","a11yPlugin","Theme","props","accent","isValid","console","warn"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AAOA;;AAZA;AACA;AACA;AAYA,oBAAQ,CAAEA,cAAF,EAAeC,aAAf,CAAR;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,KAAT,CAAgBC,KAAhB,EAA4E;AAC3E,QAAM;AAAEC,IAAAA;AAAF,MAAaD,KAAnB;;AACA,MAAKC,MAAM,IAAI,CAAE,oBAAQA,MAAR,EAAiBC,OAAjB,EAAjB,EAA8C;AAC7C;AACAC,IAAAA,OAAO,CAACC,IAAR,CACE,yBAAyBH,MAAQ,qDADnC;AAGA;;AAED,SAAO,4BAAC,eAAD,EAAcD,KAAd,CAAP;AACA;;eAEcD,K","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,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.Wrapper = void 0;
|
|
9
|
+
|
|
10
|
+
var _base = _interopRequireDefault(require("@emotion/styled/base"));
|
|
11
|
+
|
|
12
|
+
var _colord = require("colord");
|
|
13
|
+
|
|
14
|
+
var _react = require("@emotion/react");
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* External dependencies
|
|
18
|
+
*/
|
|
19
|
+
const accentColor = _ref => {
|
|
20
|
+
let {
|
|
21
|
+
accent
|
|
22
|
+
} = _ref;
|
|
23
|
+
return accent ? /*#__PURE__*/(0, _react.css)("--wp-components-color-accent:", accent, ";--wp-components-color-accent-darker-10:", (0, _colord.colord)(accent).darken(0.1).toHex(), ";--wp-components-color-accent-darker-20:", (0, _colord.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;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const Wrapper = (0, _base.default)("div", process.env.NODE_ENV === "production" ? {
|
|
27
|
+
target: "e1krjpvb0"
|
|
28
|
+
} : {
|
|
29
|
+
target: "e1krjpvb0",
|
|
30
|
+
label: "Wrapper"
|
|
31
|
+
})(accentColor, ";" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvdGhlbWUvc3R5bGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQXlCK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styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/theme/styles.ts"],"names":["accentColor","accent","css","darken","toHex","undefined","Wrapper"],"mappings":";;;;;;;;;;;AAGA;;AAEA;;AALA;AACA;AACA;AAUA,MAAMA,WAAW,GAAG;AAAA,MAAE;AAAEC,IAAAA;AAAF,GAAF;AAAA,SACnBA,MAAM,oBACHC,UADG,mCAE8BD,MAF9B,8CAGwC,oBAAQA,MAAR,EACzCE,MADyC,CACjC,GADiC,EAEzCC,KAFyC,EAHxC,8CAMwC,oBAAQH,MAAR,EACzCE,MADyC,CACjC,GADiC,EAEzCC,KAFyC,EANxC,w0CAUHC,SAXgB;AAAA,CAApB;;AAaO,MAAMC,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,GAChBN,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":[]}
|
|
@@ -76,12 +76,24 @@ function ToggleControl(_ref) {
|
|
|
76
76
|
const cx = (0, _utils.useCx)();
|
|
77
77
|
const classes = cx('components-toggle-control', className, !__nextHasNoMarginBottom && /*#__PURE__*/(0, _react.css)({
|
|
78
78
|
marginBottom: (0, _space.space)(3)
|
|
79
|
-
}, process.env.NODE_ENV === "production" ? "" : ";label:classes;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvdG9nZ2xlLWNvbnRyb2wvaW5kZXgudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQTZEK0IiLCJmaWxlIjoiQHdvcmRwcmVzcy9jb21wb25lbnRzL3NyYy90b2dnbGUtY29udHJvbC9pbmRleC50c3giLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEV4dGVybmFsIGRlcGVuZGVuY2llc1xuICovXG5pbXBvcnQgdHlwZSB7IENoYW5nZUV2ZW50IH0gZnJvbSAncmVhY3QnO1xuaW1wb3J0IHsgY3NzIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnO1xuXG4vKipcbiAqIFdvcmRQcmVzcyBkZXBlbmRlbmNpZXNcbiAqL1xuaW1wb3J0IHsgdXNlSW5zdGFuY2VJZCB9IGZyb20gJ0B3b3JkcHJlc3MvY29tcG9zZSc7XG5cbi8qKlxuICogSW50ZXJuYWwgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCBGb3JtVG9nZ2xlIGZyb20gJy4uL2Zvcm0tdG9nZ2xlJztcbmltcG9ydCBCYXNlQ29udHJvbCBmcm9tICcuLi9iYXNlLWNvbnRyb2wnO1xuaW1wb3J0IHR5cGUgeyBXb3JkUHJlc3NDb21wb25lbnRQcm9wcyB9IGZyb20gJy4uL3VpL2NvbnRleHQvd29yZHByZXNzLWNvbXBvbmVudCc7XG5pbXBvcnQgdHlwZSB7IFRvZ2dsZUNvbnRyb2xQcm9wcyB9IGZyb20gJy4vdHlwZXMnO1xuaW1wb3J0IHsgSFN0YWNrIH0gZnJvbSAnLi4vaC1zdGFjayc7XG5pbXBvcnQgeyB1c2VDeCB9IGZy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ucHV0RWxlbWVudCA+
|
|
79
|
+
}, process.env.NODE_ENV === "production" ? "" : ";label:classes;", process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvdG9nZ2xlLWNvbnRyb2wvaW5kZXgudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQTZEK0IiLCJmaWxlIjoiQHdvcmRwcmVzcy9jb21wb25lbnRzL3NyYy90b2dnbGUtY29udHJvbC9pbmRleC50c3giLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEV4dGVybmFsIGRlcGVuZGVuY2llc1xuICovXG5pbXBvcnQgdHlwZSB7IENoYW5nZUV2ZW50IH0gZnJvbSAncmVhY3QnO1xuaW1wb3J0IHsgY3NzIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnO1xuXG4vKipcbiAqIFdvcmRQcmVzcyBkZXBlbmRlbmNpZXNcbiAqL1xuaW1wb3J0IHsgdXNlSW5zdGFuY2VJZCB9IGZyb20gJ0B3b3JkcHJlc3MvY29tcG9zZSc7XG5cbi8qKlxuICogSW50ZXJuYWwgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCBGb3JtVG9nZ2xlIGZyb20gJy4uL2Zvcm0tdG9nZ2xlJztcbmltcG9ydCBCYXNlQ29udHJvbCBmcm9tICcuLi9iYXNlLWNvbnRyb2wnO1xuaW1wb3J0IHR5cGUgeyBXb3JkUHJlc3NDb21wb25lbnRQcm9wcyB9IGZyb20gJy4uL3VpL2NvbnRleHQvd29yZHByZXNzLWNvbXBvbmVudCc7XG5pbXBvcnQgdHlwZSB7IFRvZ2dsZUNvbnRyb2xQcm9wcyB9IGZyb20gJy4vdHlwZXMnO1xuaW1wb3J0IHsgSFN0YWNrIH0gZnJvbSAnLi4vaC1zdGFjayc7XG5pbXBvcnQgeyB1c2VDeCB9IGZy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RCeSA9IGlkICsgJ19faGVscCc7XG5cdFx0fVxuXHR9XG5cblx0cmV0dXJuIChcblx0XHQ8QmFzZUNvbnRyb2xcblx0XHRcdGlkPXsgaWQgfVxuXHRcdFx0aGVscD17IGhlbHBMYWJlbCB9XG5cdFx0XHRjbGFzc05hbWU9eyBjbGFzc2VzIH1cblx0XHRcdF9fbmV4dEhhc05vTWFyZ2luQm90dG9tXG5cdFx0PlxuXHRcdFx0PEhTdGFjayBqdXN0aWZ5PVwiZmxleC1zdGFydFwiIHNwYWNpbmc9eyAzIH0+XG5cdFx0XHRcdDxGb3JtVG9nZ2xlXG5cdFx0XHRcdFx0aWQ9eyBpZCB9XG5cdFx0XHRcdFx0Y2hlY2tlZD17IGNoZWNrZWQgfVxuXHRcdFx0XHRcdG9uQ2hhbmdlPXsgb25DaGFuZ2VUb2dnbGUgfVxuXHRcdFx0XHRcdGFyaWEtZGVzY3JpYmVkYnk9eyBkZXNjcmliZWRCeSB9XG5cdFx0XHRcdFx0ZGlzYWJsZWQ9eyBkaXNhYmxlZCB9XG5cdFx0XHRcdC8+XG5cdFx0XHRcdDxsYWJlbFxuXHRcdFx0XHRcdGh0bWxGb3I9eyBpZCB9XG5cdFx0XHRcdFx0Y2xhc3NOYW1lPVwiY29tcG9uZW50cy10b2dnbGUtY29udHJvbF9fbGFiZWxcIlxuXHRcdFx0XHQ+XG5cdFx0XHRcdFx0eyBsYWJlbCB9XG5cdFx0XHRcdDwvbGFiZWw+XG5cdFx0XHQ8L0hTdGFjaz5cblx0XHQ8L0Jhc2VDb250cm9sPlxuXHQpO1xufVxuXG5leHBvcnQgZGVmYXVsdCBUb2dnbGVDb250cm9sO1xuIl19 */"));
|
|
80
80
|
let describedBy, helpLabel;
|
|
81
81
|
|
|
82
82
|
if (help) {
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
if (typeof help === 'function') {
|
|
84
|
+
// `help` as a function works only for controlled components where
|
|
85
|
+
// `checked` is passed down from parent component. Uncontrolled
|
|
86
|
+
// component can show only a static help label.
|
|
87
|
+
if (checked !== undefined) {
|
|
88
|
+
helpLabel = help(checked);
|
|
89
|
+
}
|
|
90
|
+
} else {
|
|
91
|
+
helpLabel = help;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (helpLabel) {
|
|
95
|
+
describedBy = id + '__help';
|
|
96
|
+
}
|
|
85
97
|
}
|
|
86
98
|
|
|
87
99
|
return (0, _element.createElement)(_baseControl.default, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/toggle-control/index.tsx"],"names":["ToggleControl","__nextHasNoMarginBottom","label","checked","help","className","onChange","disabled","onChangeToggle","event","target","instanceId","id","cx","classes","marginBottom","describedBy","helpLabel"],"mappings":";;;;;;;;;;;;AAIA;;AAKA;;AAKA;;AACA;;AAGA;;AACA;;AACA;;AApBA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,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,GAAG,4BAAeX,aAAf,CAAnB;AACA,QAAMY,EAAE,GAAI,4BAA4BD,UAAY,EAApD;AAEA,QAAME,EAAE,GAAG,mBAAX;AACA,QAAMC,OAAO,GAAGD,EAAE,CACjB,2BADiB,EAEjBR,SAFiB,EAGjB,CAAEJ,uBAAF,iBAA6B,gBAAK;AAAEc,IAAAA,YAAY,EAAE,kBAAO,CAAP;AAAhB,GAAL,
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/toggle-control/index.tsx"],"names":["ToggleControl","__nextHasNoMarginBottom","label","checked","help","className","onChange","disabled","onChangeToggle","event","target","instanceId","id","cx","classes","marginBottom","describedBy","helpLabel","undefined"],"mappings":";;;;;;;;;;;;AAIA;;AAKA;;AAKA;;AACA;;AAGA;;AACA;;AACA;;AApBA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,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,GAAG,4BAAeX,aAAf,CAAnB;AACA,QAAMY,EAAE,GAAI,4BAA4BD,UAAY,EAApD;AAEA,QAAME,EAAE,GAAG,mBAAX;AACA,QAAMC,OAAO,GAAGD,EAAE,CACjB,2BADiB,EAEjBR,SAFiB,EAGjB,CAAEJ,uBAAF,iBAA6B,gBAAK;AAAEc,IAAAA,YAAY,EAAE,kBAAO,CAAP;AAAhB,GAAL,ilIAHZ,CAAlB;AAMA,MAAIC,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,4BAAC,oBAAD;AACC,IAAA,EAAE,EAAGA,EADN;AAEC,IAAA,IAAI,EAAGK,SAFR;AAGC,IAAA,SAAS,EAAGH,OAHb;AAIC,IAAA,uBAAuB;AAJxB,KAMC,4BAAC,cAAD;AAAQ,IAAA,OAAO,EAAC,YAAhB;AAA6B,IAAA,OAAO,EAAG;AAAvC,KACC,4BAAC,mBAAD;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;;eAEcF,a","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"]}
|