@wordpress/components 20.0.2-next.957ca95e4c.0 → 21.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 +56 -1
- package/CONTRIBUTING.md +3 -54
- package/build/alignment-matrix-control/styles/alignment-matrix-control-styles.js +9 -9
- package/build/alignment-matrix-control/styles/alignment-matrix-control-styles.js.map +1 -1
- package/build/angle-picker-control/index.js +10 -0
- package/build/angle-picker-control/index.js.map +1 -1
- package/build/border-box-control/border-box-control/component.js +5 -1
- package/build/border-box-control/border-box-control/component.js.map +1 -1
- package/build/border-box-control/border-box-control-split-controls/component.js +5 -1
- package/build/border-box-control/border-box-control-split-controls/component.js.map +1 -1
- package/build/border-control/border-control-dropdown/component.js +2 -1
- package/build/border-control/border-control-dropdown/component.js.map +1 -1
- package/build/card/styles.js +17 -17
- package/build/card/styles.js.map +1 -1
- package/build/checkbox-control/index.js +3 -3
- package/build/checkbox-control/index.js.map +1 -1
- package/build/color-palette/index.js +1 -1
- package/build/color-palette/index.js.map +1 -1
- package/build/color-picker/input-with-slider.js +2 -1
- package/build/color-picker/input-with-slider.js.map +1 -1
- package/build/combobox-control/index.js +1 -1
- package/build/combobox-control/index.js.map +1 -1
- package/build/custom-gradient-picker/index.js +1 -1
- package/build/custom-gradient-picker/index.js.map +1 -1
- package/build/date-time/date/index.js +1 -1
- package/build/date-time/date/index.js.map +1 -1
- package/build/date-time/time/timezone.js +1 -1
- package/build/date-time/time/timezone.js.map +1 -1
- package/build/disabled/index.js +14 -6
- package/build/disabled/index.js.map +1 -1
- package/build/disabled/styles/disabled-styles.js +8 -18
- package/build/disabled/styles/disabled-styles.js.map +1 -1
- package/build/drop-zone/index.js +44 -9
- package/build/drop-zone/index.js.map +1 -1
- package/build/drop-zone/provider.js.map +1 -1
- package/build/drop-zone/types.js +6 -0
- package/build/drop-zone/types.js.map +1 -0
- package/build/flex/flex/hook.js +6 -30
- package/build/flex/flex/hook.js.map +1 -1
- package/build/focal-point-picker/controls.js +10 -5
- package/build/focal-point-picker/controls.js.map +1 -1
- package/build/focal-point-picker/focal-point.js.map +1 -1
- package/build/focal-point-picker/grid.js.map +1 -1
- package/build/focal-point-picker/index.js +83 -16
- package/build/focal-point-picker/index.js.map +1 -1
- package/build/focal-point-picker/media.js +4 -0
- package/build/focal-point-picker/media.js.map +1 -1
- package/build/focal-point-picker/styles/focal-point-picker-style.js +70 -41
- package/build/focal-point-picker/styles/focal-point-picker-style.js.map +1 -1
- package/build/focal-point-picker/styles/focal-point-style.js +12 -12
- package/build/focal-point-picker/styles/focal-point-style.js.map +1 -1
- package/build/focal-point-picker/types.js +6 -0
- package/build/focal-point-picker/types.js.map +1 -0
- package/build/focal-point-picker/utils.js +6 -6
- package/build/focal-point-picker/utils.js.map +1 -1
- package/build/font-size-picker/index.js +11 -0
- package/build/font-size-picker/index.js.map +1 -1
- package/build/font-size-picker/utils.js +1 -1
- package/build/font-size-picker/utils.js.map +1 -1
- package/build/form-file-upload/index.js +22 -2
- package/build/form-file-upload/index.js.map +1 -1
- package/build/form-file-upload/types.js +6 -0
- package/build/form-file-upload/types.js.map +1 -0
- package/build/form-toggle/index.js +1 -3
- package/build/form-toggle/index.js.map +1 -1
- package/build/form-token-field/index.js +4 -6
- package/build/form-token-field/index.js.map +1 -1
- package/build/form-token-field/suggestions-list.js +1 -3
- package/build/form-token-field/suggestions-list.js.map +1 -1
- package/build/gradient-picker/index.js +25 -26
- package/build/gradient-picker/index.js.map +1 -1
- package/build/icon/index.js +1 -2
- package/build/icon/index.js.map +1 -1
- package/build/input-control/input-base.js +3 -2
- package/build/input-control/input-base.js.map +1 -1
- package/build/input-control/label.js +2 -2
- package/build/input-control/label.js.map +1 -1
- package/build/input-control/styles/input-control-styles.js +41 -128
- package/build/input-control/styles/input-control-styles.js.map +1 -1
- package/build/modal/aria-helper.js +3 -10
- package/build/modal/aria-helper.js.map +1 -1
- package/build/navigable-container/container.js +5 -1
- package/build/navigable-container/container.js.map +1 -1
- package/build/navigable-container/menu.js +10 -12
- package/build/navigable-container/menu.js.map +1 -1
- package/build/navigable-container/tabbable.js +2 -4
- package/build/navigable-container/tabbable.js.map +1 -1
- package/build/navigator/navigator-button/hook.js +1 -1
- package/build/navigator/navigator-button/hook.js.map +1 -1
- package/build/navigator/navigator-screen/component.js +2 -2
- package/build/navigator/navigator-screen/component.js.map +1 -1
- package/build/number-control/index.js +29 -25
- package/build/number-control/index.js.map +1 -1
- package/build/number-control/types.js +6 -0
- package/build/number-control/types.js.map +1 -0
- package/build/placeholder/index.js +1 -3
- package/build/placeholder/index.js.map +1 -1
- package/build/popover/index.js +155 -154
- package/build/popover/index.js.map +1 -1
- package/build/popover/types.js +6 -0
- package/build/popover/types.js.map +1 -0
- package/build/popover/utils.js +119 -24
- package/build/popover/utils.js.map +1 -1
- package/build/radio-control/index.js +7 -4
- package/build/radio-control/index.js.map +1 -1
- package/build/range-control/index.js +4 -1
- package/build/range-control/index.js.map +1 -1
- package/build/range-control/styles/range-control-styles.js +33 -33
- package/build/range-control/styles/range-control-styles.js.map +1 -1
- package/build/sandbox/index.js +2 -2
- package/build/sandbox/index.js.map +1 -1
- package/build/search-control/index.js +38 -10
- package/build/search-control/index.js.map +1 -1
- package/build/search-control/types.js +6 -0
- package/build/search-control/types.js.map +1 -0
- package/build/select-control/index.native.js +2 -1
- package/build/select-control/index.native.js.map +1 -1
- package/build/tab-panel/index.js +48 -9
- package/build/tab-panel/index.js.map +1 -1
- package/build/tab-panel/types.js +6 -0
- package/build/tab-panel/types.js.map +1 -0
- package/build/text-control/index.js +2 -0
- package/build/text-control/index.js.map +1 -1
- package/build/textarea-control/index.js +3 -3
- package/build/textarea-control/index.js.map +1 -1
- package/build/toggle-control/index.js +44 -4
- package/build/toggle-control/index.js.map +1 -1
- package/build/toggle-control/types.js +6 -0
- package/build/toggle-control/types.js.map +1 -0
- package/build/toggle-group-control/toggle-group-control/component.js +2 -2
- package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control-option-icon/component.js +1 -1
- package/build/toggle-group-control/toggle-group-control-option-icon/component.js.map +1 -1
- package/build/tooltip/index.js +1 -1
- package/build/tooltip/index.js.map +1 -1
- package/build/ui/context/context-connect.js +31 -22
- package/build/ui/context/context-connect.js.map +1 -1
- package/build/ui/context/context-system-provider.js +4 -3
- package/build/ui/context/context-system-provider.js.map +1 -1
- package/build/unit-control/index.js +1 -1
- package/build/unit-control/index.js.map +1 -1
- package/build/unit-control/styles/unit-control-styles.js +9 -9
- package/build/unit-control/styles/unit-control-styles.js.map +1 -1
- package/build/utils/colors-values.js +2 -30
- package/build/utils/colors-values.js.map +1 -1
- package/build/utils/math.js +4 -4
- package/build/utils/math.js.map +1 -1
- package/build/utils/values.js +62 -6
- package/build/utils/values.js.map +1 -1
- package/build/view/component.js +6 -7
- package/build/view/component.js.map +1 -1
- package/build/view/types.js +6 -0
- package/build/view/types.js.map +1 -0
- package/build-module/alignment-matrix-control/styles/alignment-matrix-control-styles.js +9 -9
- package/build-module/alignment-matrix-control/styles/alignment-matrix-control-styles.js.map +1 -1
- package/build-module/angle-picker-control/index.js +9 -0
- package/build-module/angle-picker-control/index.js.map +1 -1
- package/build-module/border-box-control/border-box-control/component.js +5 -1
- package/build-module/border-box-control/border-box-control/component.js.map +1 -1
- package/build-module/border-box-control/border-box-control-split-controls/component.js +5 -1
- package/build-module/border-box-control/border-box-control-split-controls/component.js.map +1 -1
- package/build-module/border-control/border-control-dropdown/component.js +2 -1
- package/build-module/border-control/border-control-dropdown/component.js.map +1 -1
- package/build-module/card/styles.js +17 -17
- package/build-module/card/styles.js.map +1 -1
- package/build-module/checkbox-control/index.js +3 -3
- package/build-module/checkbox-control/index.js.map +1 -1
- package/build-module/color-palette/index.js +1 -1
- package/build-module/color-palette/index.js.map +1 -1
- package/build-module/color-picker/input-with-slider.js +2 -1
- package/build-module/color-picker/input-with-slider.js.map +1 -1
- package/build-module/combobox-control/index.js +1 -1
- package/build-module/combobox-control/index.js.map +1 -1
- package/build-module/custom-gradient-picker/index.js +1 -1
- package/build-module/custom-gradient-picker/index.js.map +1 -1
- package/build-module/date-time/date/index.js +2 -3
- package/build-module/date-time/date/index.js.map +1 -1
- package/build-module/date-time/time/timezone.js +1 -1
- package/build-module/date-time/time/timezone.js.map +1 -1
- package/build-module/disabled/index.js +16 -8
- package/build-module/disabled/index.js.map +1 -1
- package/build-module/disabled/styles/disabled-styles.js +6 -12
- package/build-module/disabled/styles/disabled-styles.js.map +1 -1
- package/build-module/drop-zone/index.js +40 -9
- package/build-module/drop-zone/index.js.map +1 -1
- package/build-module/drop-zone/provider.js.map +1 -1
- package/build-module/drop-zone/types.js +2 -0
- package/build-module/drop-zone/types.js.map +1 -0
- package/build-module/flex/flex/hook.js +7 -29
- package/build-module/flex/flex/hook.js.map +1 -1
- package/build-module/focal-point-picker/controls.js +11 -6
- package/build-module/focal-point-picker/controls.js.map +1 -1
- package/build-module/focal-point-picker/focal-point.js.map +1 -1
- package/build-module/focal-point-picker/grid.js.map +1 -1
- package/build-module/focal-point-picker/index.js +81 -16
- package/build-module/focal-point-picker/index.js.map +1 -1
- package/build-module/focal-point-picker/media.js +4 -0
- package/build-module/focal-point-picker/media.js.map +1 -1
- package/build-module/focal-point-picker/styles/focal-point-picker-style.js +68 -40
- package/build-module/focal-point-picker/styles/focal-point-picker-style.js.map +1 -1
- package/build-module/focal-point-picker/styles/focal-point-style.js +12 -12
- package/build-module/focal-point-picker/styles/focal-point-style.js.map +1 -1
- package/build-module/focal-point-picker/types.js +2 -0
- package/build-module/focal-point-picker/types.js.map +1 -0
- package/build-module/focal-point-picker/utils.js +6 -6
- package/build-module/focal-point-picker/utils.js.map +1 -1
- package/build-module/font-size-picker/index.js +10 -0
- package/build-module/font-size-picker/index.js.map +1 -1
- package/build-module/font-size-picker/utils.js +1 -1
- package/build-module/font-size-picker/utils.js.map +1 -1
- package/build-module/form-file-upload/index.js +21 -4
- package/build-module/form-file-upload/index.js.map +1 -1
- package/build-module/form-file-upload/types.js +2 -0
- package/build-module/form-file-upload/types.js.map +1 -0
- package/build-module/form-toggle/index.js +1 -3
- package/build-module/form-toggle/index.js.map +1 -1
- package/build-module/form-token-field/index.js +4 -5
- package/build-module/form-token-field/index.js.map +1 -1
- package/build-module/form-token-field/suggestions-list.js +1 -2
- package/build-module/form-token-field/suggestions-list.js.map +1 -1
- package/build-module/gradient-picker/index.js +25 -26
- package/build-module/gradient-picker/index.js.map +1 -1
- package/build-module/icon/index.js +1 -2
- package/build-module/icon/index.js.map +1 -1
- package/build-module/input-control/input-base.js +4 -3
- package/build-module/input-control/input-base.js.map +1 -1
- package/build-module/input-control/label.js +3 -3
- package/build-module/input-control/label.js.map +1 -1
- package/build-module/input-control/styles/input-control-styles.js +41 -127
- package/build-module/input-control/styles/input-control-styles.js.map +1 -1
- package/build-module/modal/aria-helper.js +3 -8
- package/build-module/modal/aria-helper.js.map +1 -1
- package/build-module/navigable-container/container.js +5 -1
- package/build-module/navigable-container/container.js.map +1 -1
- package/build-module/navigable-container/menu.js +10 -11
- package/build-module/navigable-container/menu.js.map +1 -1
- package/build-module/navigable-container/tabbable.js +2 -3
- package/build-module/navigable-container/tabbable.js.map +1 -1
- package/build-module/navigator/navigator-button/hook.js +1 -1
- package/build-module/navigator/navigator-button/hook.js.map +1 -1
- package/build-module/navigator/navigator-screen/component.js +2 -2
- package/build-module/navigator/navigator-screen/component.js.map +1 -1
- package/build-module/number-control/index.js +31 -23
- package/build-module/number-control/index.js.map +1 -1
- package/build-module/number-control/types.js +2 -0
- package/build-module/number-control/types.js.map +1 -0
- package/build-module/placeholder/index.js +1 -3
- package/build-module/placeholder/index.js.map +1 -1
- package/build-module/popover/index.js +157 -156
- package/build-module/popover/index.js.map +1 -1
- package/build-module/popover/types.js +2 -0
- package/build-module/popover/types.js.map +1 -0
- package/build-module/popover/utils.js +112 -23
- package/build-module/popover/utils.js.map +1 -1
- package/build-module/radio-control/index.js +7 -5
- package/build-module/radio-control/index.js.map +1 -1
- package/build-module/range-control/index.js +4 -1
- package/build-module/range-control/index.js.map +1 -1
- package/build-module/range-control/styles/range-control-styles.js +33 -33
- package/build-module/range-control/styles/range-control-styles.js.map +1 -1
- package/build-module/sandbox/index.js +2 -2
- package/build-module/sandbox/index.js.map +1 -1
- package/build-module/search-control/index.js +34 -7
- package/build-module/search-control/index.js.map +1 -1
- package/build-module/search-control/types.js +2 -0
- package/build-module/search-control/types.js.map +1 -0
- package/build-module/select-control/index.native.js +1 -1
- package/build-module/select-control/index.native.js.map +1 -1
- package/build-module/tab-panel/index.js +46 -10
- package/build-module/tab-panel/index.js.map +1 -1
- package/build-module/tab-panel/types.js +2 -0
- package/build-module/tab-panel/types.js.map +1 -0
- package/build-module/text-control/index.js +2 -0
- package/build-module/text-control/index.js.map +1 -1
- package/build-module/textarea-control/index.js +3 -3
- package/build-module/textarea-control/index.js.map +1 -1
- package/build-module/toggle-control/index.js +38 -4
- package/build-module/toggle-control/index.js.map +1 -1
- package/build-module/toggle-control/types.js +2 -0
- package/build-module/toggle-control/types.js.map +1 -0
- package/build-module/toggle-group-control/toggle-group-control/component.js +2 -2
- package/build-module/toggle-group-control/toggle-group-control/component.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control-option-icon/component.js +1 -1
- package/build-module/toggle-group-control/toggle-group-control-option-icon/component.js.map +1 -1
- package/build-module/tooltip/index.js +1 -1
- package/build-module/tooltip/index.js.map +1 -1
- package/build-module/ui/context/context-connect.js +30 -23
- package/build-module/ui/context/context-connect.js.map +1 -1
- package/build-module/ui/context/context-system-provider.js +5 -4
- package/build-module/ui/context/context-system-provider.js.map +1 -1
- package/build-module/unit-control/index.js +1 -1
- package/build-module/unit-control/index.js.map +1 -1
- package/build-module/unit-control/styles/unit-control-styles.js +9 -9
- package/build-module/unit-control/styles/unit-control-styles.js.map +1 -1
- package/build-module/utils/colors-values.js +2 -30
- package/build-module/utils/colors-values.js.map +1 -1
- package/build-module/utils/math.js +4 -4
- package/build-module/utils/math.js.map +1 -1
- package/build-module/utils/values.js +48 -6
- package/build-module/utils/values.js.map +1 -1
- package/build-module/view/component.js +5 -8
- package/build-module/view/component.js.map +1 -1
- package/build-module/view/types.js +2 -0
- package/build-module/view/types.js.map +1 -0
- package/build-style/style-rtl.css +2 -28
- package/build-style/style.css +2 -28
- package/build-types/base-field/hook.d.ts +54 -55
- package/build-types/base-field/hook.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control/component.d.ts +10 -2
- 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 +56 -57
- package/build-types/border-box-control/border-box-control/hook.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control-linked-button/component.d.ts +2 -1
- package/build-types/border-box-control/border-box-control-linked-button/component.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts +55 -56
- 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 +9 -2
- 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 +56 -57
- 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/component.d.ts +2 -1
- package/build-types/border-box-control/border-box-control-visualizer/component.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts +55 -56
- package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts.map +1 -1
- package/build-types/border-box-control/types.d.ts +5 -4
- package/build-types/border-box-control/types.d.ts.map +1 -1
- package/build-types/border-control/border-control/component.d.ts +14 -2
- package/build-types/border-control/border-control/component.d.ts.map +1 -1
- package/build-types/border-control/border-control/hook.d.ts +56 -57
- package/build-types/border-control/border-control/hook.d.ts.map +1 -1
- package/build-types/border-control/border-control-dropdown/component.d.ts +10 -2
- package/build-types/border-control/border-control-dropdown/component.d.ts.map +1 -1
- package/build-types/border-control/border-control-dropdown/hook.d.ts +56 -57
- package/build-types/border-control/border-control-dropdown/hook.d.ts.map +1 -1
- package/build-types/border-control/border-control-style-picker/component.d.ts +6 -2
- package/build-types/border-control/border-control-style-picker/component.d.ts.map +1 -1
- package/build-types/border-control/border-control-style-picker/hook.d.ts +55 -56
- package/build-types/border-control/border-control-style-picker/hook.d.ts.map +1 -1
- package/build-types/border-control/stories/index.d.ts +74 -6
- package/build-types/border-control/stories/index.d.ts.map +1 -1
- package/build-types/border-control/types.d.ts +6 -8
- package/build-types/border-control/types.d.ts.map +1 -1
- package/build-types/button-group/index.d.ts +1 -3
- package/build-types/button-group/index.d.ts.map +1 -1
- package/build-types/card/card/component.d.ts +9 -2
- package/build-types/card/card/component.d.ts.map +1 -1
- package/build-types/card/card/hook.d.ts +55 -56
- package/build-types/card/card/hook.d.ts.map +1 -1
- package/build-types/card/card-body/component.d.ts +9 -2
- package/build-types/card/card-body/component.d.ts.map +1 -1
- package/build-types/card/card-body/hook.d.ts +55 -56
- package/build-types/card/card-body/hook.d.ts.map +1 -1
- package/build-types/card/card-divider/component.d.ts +7 -2
- package/build-types/card/card-divider/component.d.ts.map +1 -1
- package/build-types/card/card-divider/hook.d.ts +55 -55
- package/build-types/card/card-footer/component.d.ts +11 -2
- package/build-types/card/card-footer/component.d.ts.map +1 -1
- package/build-types/card/card-footer/hook.d.ts +55 -56
- package/build-types/card/card-footer/hook.d.ts.map +1 -1
- package/build-types/card/card-header/component.d.ts +1 -1
- package/build-types/card/card-header/component.d.ts.map +1 -1
- package/build-types/card/card-header/hook.d.ts +55 -56
- package/build-types/card/card-header/hook.d.ts.map +1 -1
- package/build-types/card/card-media/component.d.ts +2 -1
- package/build-types/card/card-media/component.d.ts.map +1 -1
- package/build-types/card/card-media/hook.d.ts +55 -56
- package/build-types/card/card-media/hook.d.ts.map +1 -1
- package/build-types/checkbox-control/index.d.ts +1 -1
- package/build-types/checkbox-control/index.d.ts.map +1 -1
- package/build-types/checkbox-control/stories/index.d.ts.map +1 -1
- package/build-types/checkbox-control/types.d.ts +1 -1
- package/build-types/checkbox-control/types.d.ts.map +1 -1
- package/build-types/color-indicator/index.d.ts +1 -3
- package/build-types/color-indicator/index.d.ts.map +1 -1
- package/build-types/color-palette/styles.d.ts +1 -3
- package/build-types/color-palette/styles.d.ts.map +1 -1
- package/build-types/color-picker/component.d.ts +2 -1
- package/build-types/color-picker/component.d.ts.map +1 -1
- package/build-types/color-picker/input-with-slider.d.ts.map +1 -1
- package/build-types/color-picker/styles.d.ts +12 -25
- package/build-types/color-picker/styles.d.ts.map +1 -1
- package/build-types/confirm-dialog/component.d.ts +4 -8
- package/build-types/confirm-dialog/component.d.ts.map +1 -1
- package/build-types/date-time/date/styles.d.ts +4 -8
- package/build-types/date-time/date/styles.d.ts.map +1 -1
- package/build-types/date-time/date-time/styles.d.ts +4 -6
- package/build-types/date-time/date-time/styles.d.ts.map +1 -1
- package/build-types/date-time/time/styles.d.ts +21 -43
- package/build-types/date-time/time/styles.d.ts.map +1 -1
- package/build-types/disabled/index.d.ts +1 -1
- package/build-types/disabled/index.d.ts.map +1 -1
- package/build-types/disabled/styles/disabled-styles.d.ts +1 -5
- package/build-types/disabled/styles/disabled-styles.d.ts.map +1 -1
- package/build-types/divider/component.d.ts +7 -2
- package/build-types/divider/component.d.ts.map +1 -1
- package/build-types/drop-zone/index.d.ts +29 -0
- package/build-types/drop-zone/index.d.ts.map +1 -0
- package/build-types/drop-zone/provider.d.ts +5 -0
- package/build-types/drop-zone/provider.d.ts.map +1 -0
- package/build-types/drop-zone/stories/index.d.ts +12 -0
- package/build-types/drop-zone/stories/index.d.ts.map +1 -0
- package/build-types/drop-zone/types.d.ts +29 -0
- package/build-types/drop-zone/types.d.ts.map +1 -0
- package/build-types/dropdown/dropdown-content-wrapper.d.ts +2 -1
- package/build-types/dropdown/dropdown-content-wrapper.d.ts.map +1 -1
- package/build-types/elevation/component.d.ts +2 -1
- package/build-types/elevation/component.d.ts.map +1 -1
- package/build-types/elevation/hook.d.ts +54 -55
- package/build-types/elevation/hook.d.ts.map +1 -1
- package/build-types/external-link/index.d.ts +1 -1
- 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/flex/flex/component.d.ts +2 -1
- package/build-types/flex/flex/component.d.ts.map +1 -1
- package/build-types/flex/flex/hook.d.ts +55 -56
- package/build-types/flex/flex/hook.d.ts.map +1 -1
- package/build-types/flex/flex-block/component.d.ts +2 -1
- package/build-types/flex/flex-block/component.d.ts.map +1 -1
- package/build-types/flex/flex-block/hook.d.ts +55 -56
- package/build-types/flex/flex-block/hook.d.ts.map +1 -1
- package/build-types/flex/flex-item/component.d.ts +2 -1
- package/build-types/flex/flex-item/component.d.ts.map +1 -1
- package/build-types/flex/flex-item/hook.d.ts +55 -56
- package/build-types/flex/flex-item/hook.d.ts.map +1 -1
- package/build-types/focal-point-picker/controls.d.ts +4 -0
- package/build-types/focal-point-picker/controls.d.ts.map +1 -0
- package/build-types/focal-point-picker/focal-point.d.ts +5 -0
- package/build-types/focal-point-picker/focal-point.d.ts.map +1 -0
- package/build-types/focal-point-picker/grid.d.ts +5 -0
- package/build-types/focal-point-picker/grid.d.ts.map +1 -0
- package/build-types/focal-point-picker/index.d.ts +51 -0
- package/build-types/focal-point-picker/index.d.ts.map +1 -0
- package/build-types/focal-point-picker/media.d.ts +4 -0
- package/build-types/focal-point-picker/media.d.ts.map +1 -0
- package/build-types/focal-point-picker/stories/index.d.ts +15 -0
- package/build-types/focal-point-picker/stories/index.d.ts.map +1 -0
- package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +56 -0
- package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts.map +1 -0
- package/build-types/focal-point-picker/styles/focal-point-style.d.ts +19 -0
- package/build-types/focal-point-picker/styles/focal-point-style.d.ts.map +1 -0
- package/build-types/focal-point-picker/types.d.ts +79 -0
- package/build-types/focal-point-picker/types.d.ts.map +1 -0
- package/build-types/focal-point-picker/utils.d.ts +26 -0
- package/build-types/focal-point-picker/utils.d.ts.map +1 -0
- package/build-types/form-file-upload/index.d.ts +22 -0
- package/build-types/form-file-upload/index.d.ts.map +1 -0
- package/build-types/form-file-upload/stories/index.d.ts +23 -0
- package/build-types/form-file-upload/stories/index.d.ts.map +1 -0
- package/build-types/form-file-upload/test/index.d.ts +2 -0
- package/build-types/form-file-upload/test/index.d.ts.map +1 -0
- package/build-types/form-file-upload/types.d.ts +63 -0
- package/build-types/form-file-upload/types.d.ts.map +1 -0
- package/build-types/form-toggle/index.d.ts +1 -1
- package/build-types/form-toggle/index.d.ts.map +1 -1
- package/build-types/form-token-field/index.d.ts.map +1 -1
- package/build-types/form-token-field/styles.d.ts +1 -3
- package/build-types/form-token-field/styles.d.ts.map +1 -1
- package/build-types/form-token-field/suggestions-list.d.ts.map +1 -1
- package/build-types/form-token-field/token-input.d.ts +1 -3
- package/build-types/form-token-field/token-input.d.ts.map +1 -1
- package/build-types/grid/component.d.ts +2 -1
- package/build-types/grid/component.d.ts.map +1 -1
- package/build-types/grid/hook.d.ts +55 -56
- package/build-types/grid/hook.d.ts.map +1 -1
- package/build-types/h-stack/component.d.ts +5 -2
- package/build-types/h-stack/component.d.ts.map +1 -1
- package/build-types/h-stack/hook.d.ts +55 -56
- package/build-types/h-stack/hook.d.ts.map +1 -1
- package/build-types/heading/component.d.ts +4 -2
- package/build-types/heading/component.d.ts.map +1 -1
- package/build-types/heading/hook.d.ts +54 -55
- package/build-types/heading/hook.d.ts.map +1 -1
- package/build-types/input-control/index.d.ts +1 -1
- package/build-types/input-control/index.d.ts.map +1 -1
- package/build-types/input-control/input-base.d.ts.map +1 -1
- package/build-types/input-control/input-field.d.ts +1 -3
- package/build-types/input-control/input-field.d.ts.map +1 -1
- package/build-types/input-control/input-prefix-wrapper.d.ts +2 -1
- package/build-types/input-control/input-prefix-wrapper.d.ts.map +1 -1
- package/build-types/input-control/input-suffix-wrapper.d.ts +2 -1
- package/build-types/input-control/input-suffix-wrapper.d.ts.map +1 -1
- package/build-types/input-control/label.d.ts.map +1 -1
- package/build-types/input-control/stories/index.d.ts +5 -5
- package/build-types/input-control/stories/index.d.ts.map +1 -1
- package/build-types/input-control/styles/input-control-styles.d.ts +2 -6
- package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
- package/build-types/input-control/types.d.ts +3 -0
- package/build-types/input-control/types.d.ts.map +1 -1
- package/build-types/item-group/item/component.d.ts +2 -1
- package/build-types/item-group/item/component.d.ts.map +1 -1
- package/build-types/item-group/item/hook.d.ts +54 -55
- package/build-types/item-group/item/hook.d.ts.map +1 -1
- package/build-types/item-group/item-group/component.d.ts +2 -1
- package/build-types/item-group/item-group/component.d.ts.map +1 -1
- package/build-types/item-group/item-group/hook.d.ts +54 -55
- package/build-types/item-group/item-group/hook.d.ts.map +1 -1
- package/build-types/modal/aria-helper.d.ts.map +1 -1
- package/build-types/navigable-container/menu.d.ts.map +1 -1
- package/build-types/navigable-container/tabbable.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 +59 -60
- package/build-types/navigator/navigator-back-button/hook.d.ts.map +1 -1
- package/build-types/navigator/navigator-button/component.d.ts +7 -2
- package/build-types/navigator/navigator-button/component.d.ts.map +1 -1
- package/build-types/navigator/navigator-button/hook.d.ts +59 -60
- package/build-types/navigator/navigator-button/hook.d.ts.map +1 -1
- package/build-types/navigator/navigator-provider/component.d.ts +2 -1
- package/build-types/navigator/navigator-provider/component.d.ts.map +1 -1
- package/build-types/navigator/navigator-screen/component.d.ts +1 -1
- package/build-types/navigator/navigator-screen/component.d.ts.map +1 -1
- package/build-types/number-control/index.d.ts +10 -28
- package/build-types/number-control/index.d.ts.map +1 -1
- package/build-types/number-control/styles/number-control-styles.d.ts +1 -1
- package/build-types/number-control/types.d.ts +72 -0
- package/build-types/number-control/types.d.ts.map +1 -0
- package/build-types/placeholder/index.d.ts +1 -1
- package/build-types/placeholder/index.d.ts.map +1 -1
- package/build-types/popover/index.d.ts +28 -24
- package/build-types/popover/index.d.ts.map +1 -1
- package/build-types/popover/stories/index.d.ts +12 -0
- package/build-types/popover/stories/index.d.ts.map +1 -0
- package/build-types/popover/types.d.ts +161 -0
- package/build-types/popover/types.d.ts.map +1 -0
- package/build-types/popover/utils.d.ts +42 -24
- package/build-types/popover/utils.d.ts.map +1 -1
- package/build-types/radio-control/index.d.ts +1 -1
- package/build-types/radio-control/index.d.ts.map +1 -1
- package/build-types/range-control/index.d.ts +2 -4
- package/build-types/range-control/index.d.ts.map +1 -1
- package/build-types/range-control/input-range.d.ts +2 -4
- package/build-types/range-control/input-range.d.ts.map +1 -1
- package/build-types/range-control/styles/range-control-styles.d.ts +5 -10
- 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/resizable-box/resize-tooltip/styles/resize-tooltip.styles.d.ts +1 -3
- package/build-types/resizable-box/resize-tooltip/styles/resize-tooltip.styles.d.ts.map +1 -1
- package/build-types/scrollable/component.d.ts +2 -1
- package/build-types/scrollable/component.d.ts.map +1 -1
- package/build-types/scrollable/hook.d.ts +55 -56
- package/build-types/scrollable/hook.d.ts.map +1 -1
- package/build-types/search-control/index.d.ts +29 -0
- package/build-types/search-control/index.d.ts.map +1 -0
- package/build-types/search-control/stories/index.d.ts +47 -0
- package/build-types/search-control/stories/index.d.ts.map +1 -0
- package/build-types/search-control/types.d.ts +39 -0
- package/build-types/search-control/types.d.ts.map +1 -0
- package/build-types/select-control/index.d.ts +1 -3
- package/build-types/select-control/index.d.ts.map +1 -1
- package/build-types/select-control/stories/index.d.ts +2 -6
- package/build-types/select-control/stories/index.d.ts.map +1 -1
- package/build-types/select-control/styles/select-control-styles.d.ts +1 -3
- package/build-types/select-control/styles/select-control-styles.d.ts.map +1 -1
- package/build-types/spacer/component.d.ts +2 -1
- package/build-types/spacer/component.d.ts.map +1 -1
- package/build-types/spacer/hook.d.ts +55 -56
- package/build-types/spacer/hook.d.ts.map +1 -1
- package/build-types/spinner/index.d.ts +1 -3
- package/build-types/spinner/index.d.ts.map +1 -1
- package/build-types/surface/component.d.ts +2 -1
- package/build-types/surface/component.d.ts.map +1 -1
- package/build-types/surface/hook.d.ts +55 -56
- package/build-types/surface/hook.d.ts.map +1 -1
- package/build-types/tab-panel/index.d.ts +42 -0
- package/build-types/tab-panel/index.d.ts.map +1 -0
- package/build-types/tab-panel/stories/index.d.ts +12 -0
- package/build-types/tab-panel/stories/index.d.ts.map +1 -0
- package/build-types/tab-panel/test/index.d.ts +2 -0
- package/build-types/tab-panel/test/index.d.ts.map +1 -0
- package/build-types/tab-panel/types.d.ts +64 -0
- package/build-types/tab-panel/types.d.ts.map +1 -0
- package/build-types/text/component.d.ts +1 -1
- package/build-types/text/component.d.ts.map +1 -1
- package/build-types/text/hook.d.ts +55 -56
- package/build-types/text/hook.d.ts.map +1 -1
- 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/types.d.ts +1 -1
- package/build-types/text-control/types.d.ts.map +1 -1
- package/build-types/textarea-control/index.d.ts +1 -1
- package/build-types/textarea-control/index.d.ts.map +1 -1
- package/build-types/textarea-control/types.d.ts +1 -1
- package/build-types/textarea-control/types.d.ts.map +1 -1
- package/build-types/toggle-control/index.d.ts +26 -0
- package/build-types/toggle-control/index.d.ts.map +1 -0
- package/build-types/toggle-control/stories/index.d.ts +13 -0
- package/build-types/toggle-control/stories/index.d.ts.map +1 -0
- package/build-types/toggle-control/test/index.d.ts +2 -0
- package/build-types/toggle-control/test/index.d.ts.map +1 -0
- package/build-types/toggle-control/types.d.ts +20 -0
- package/build-types/toggle-control/types.d.ts.map +1 -0
- package/build-types/toggle-group-control/stories/index.d.ts +4 -2
- package/build-types/toggle-group-control/stories/index.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control/component.d.ts +12 -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-option/component.d.ts +2 -4
- package/build-types/toggle-group-control/toggle-group-control-option/component.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control-option-base/component.d.ts +2 -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-icon/component.d.ts +3 -5
- package/build-types/toggle-group-control/toggle-group-control-option-icon/component.d.ts.map +1 -1
- package/build-types/toggle-group-control/types.d.ts +2 -2
- package/build-types/toggle-group-control/types.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel/component.d.ts +2 -1
- package/build-types/tools-panel/tools-panel/component.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel/hook.d.ts +55 -56
- package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel-header/component.d.ts +2 -1
- package/build-types/tools-panel/tools-panel-header/component.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel-header/hook.d.ts +55 -56
- package/build-types/tools-panel/tools-panel-header/hook.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel-item/component.d.ts +6 -2
- package/build-types/tools-panel/tools-panel-item/component.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel-item/hook.d.ts +55 -56
- package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
- package/build-types/truncate/component.d.ts +2 -1
- package/build-types/truncate/component.d.ts.map +1 -1
- package/build-types/truncate/hook.d.ts +55 -56
- package/build-types/truncate/hook.d.ts.map +1 -1
- package/build-types/ui/context/context-connect.d.ts +10 -9
- package/build-types/ui/context/context-connect.d.ts.map +1 -1
- package/build-types/ui/context/context-system-provider.d.ts.map +1 -1
- package/build-types/ui/context/test/context-connect.d.ts +2 -0
- package/build-types/ui/context/test/context-connect.d.ts.map +1 -0
- package/build-types/ui/context/test/wordpress-component.d.ts +2 -0
- package/build-types/ui/context/test/wordpress-component.d.ts.map +1 -0
- package/build-types/ui/context/wordpress-component.d.ts +8 -9
- package/build-types/ui/context/wordpress-component.d.ts.map +1 -1
- package/build-types/ui/control-group/component.d.ts +4 -1
- package/build-types/ui/control-group/component.d.ts.map +1 -1
- package/build-types/ui/control-group/hook.d.ts +55 -56
- package/build-types/ui/control-group/hook.d.ts.map +1 -1
- package/build-types/ui/control-label/component.d.ts +4 -1
- package/build-types/ui/control-label/component.d.ts.map +1 -1
- package/build-types/ui/control-label/hook.d.ts +55 -56
- package/build-types/ui/control-label/hook.d.ts.map +1 -1
- package/build-types/ui/form-group/form-group.d.ts +4 -8
- package/build-types/ui/form-group/form-group.d.ts.map +1 -1
- package/build-types/ui/form-group/use-form-group.d.ts +112 -114
- package/build-types/ui/form-group/use-form-group.d.ts.map +1 -1
- package/build-types/ui/shortcut/component.d.ts +2 -1
- package/build-types/ui/shortcut/component.d.ts.map +1 -1
- package/build-types/ui/spinner/component.d.ts +1 -1
- package/build-types/ui/tooltip/component.d.ts +11 -1
- package/build-types/ui/tooltip/component.d.ts.map +1 -1
- package/build-types/ui/tooltip/content.d.ts +7 -1
- package/build-types/ui/tooltip/styles.d.ts +1 -3
- package/build-types/ui/tooltip/styles.d.ts.map +1 -1
- package/build-types/unit-control/index.d.ts +2 -12
- package/build-types/unit-control/index.d.ts.map +1 -1
- package/build-types/unit-control/stories/index.d.ts.map +1 -1
- package/build-types/unit-control/styles/unit-control-styles.d.ts +5 -10
- package/build-types/unit-control/styles/unit-control-styles.d.ts.map +1 -1
- package/build-types/unit-control/types.d.ts +3 -35
- package/build-types/unit-control/types.d.ts.map +1 -1
- package/build-types/utils/colors-values.d.ts +0 -18
- package/build-types/utils/colors-values.d.ts.map +1 -1
- package/build-types/utils/math.d.ts +6 -6
- package/build-types/utils/math.d.ts.map +1 -1
- package/build-types/utils/values.d.ts +10 -8
- package/build-types/utils/values.d.ts.map +1 -1
- package/build-types/v-stack/component.d.ts +8 -2
- package/build-types/v-stack/component.d.ts.map +1 -1
- package/build-types/v-stack/hook.d.ts +55 -56
- package/build-types/v-stack/hook.d.ts.map +1 -1
- package/build-types/v-stack/stories/index.d.ts +8 -1
- package/build-types/v-stack/stories/index.d.ts.map +1 -1
- package/build-types/view/component.d.ts +8 -6
- package/build-types/view/component.d.ts.map +1 -1
- package/build-types/view/stories/index.d.ts +12 -0
- package/build-types/view/stories/index.d.ts.map +1 -0
- package/build-types/view/types.d.ts +8 -0
- package/build-types/view/types.d.ts.map +1 -0
- package/build-types/visually-hidden/component.d.ts +2 -1
- package/build-types/visually-hidden/component.d.ts.map +1 -1
- package/build-types/z-stack/component.d.ts +2 -1
- package/build-types/z-stack/component.d.ts.map +1 -1
- package/package.json +17 -17
- package/src/alignment-matrix-control/styles/alignment-matrix-control-styles.js +1 -1
- package/src/angle-picker-control/README.md +9 -1
- package/src/angle-picker-control/index.js +12 -0
- package/src/angle-picker-control/stories/index.js +3 -3
- package/src/base-field/test/__snapshots__/index.js.snap +3 -5
- package/src/border-box-control/border-box-control/component.tsx +9 -2
- package/src/border-box-control/border-box-control-split-controls/component.tsx +8 -2
- package/src/border-box-control/types.ts +5 -4
- package/src/border-control/border-control-dropdown/component.tsx +3 -8
- package/src/border-control/types.ts +7 -9
- package/src/card/styles.ts +1 -1
- package/src/card/test/__snapshots__/index.tsx.snap +39 -51
- package/src/checkbox-control/index.tsx +3 -6
- package/src/checkbox-control/stories/index.tsx +6 -2
- package/src/checkbox-control/types.ts +4 -1
- package/src/color-palette/index.js +1 -1
- package/src/color-palette/test/__snapshots__/index.js.snap +67 -91
- package/src/color-picker/input-with-slider.tsx +1 -0
- package/src/combobox-control/index.js +1 -1
- package/src/combobox-control/test/index.js +311 -0
- package/src/custom-gradient-picker/index.js +1 -1
- package/src/date-time/date/index.tsx +2 -2
- package/src/date-time/time/timezone.tsx +1 -1
- package/src/dimension-control/test/__snapshots__/index.test.js.snap +1122 -164
- package/src/dimension-control/test/index.test.js +29 -38
- package/src/disabled/index.tsx +27 -9
- package/src/disabled/styles/disabled-styles.tsx +2 -2
- package/src/disabled/test/index.tsx +38 -0
- package/src/drop-zone/README.md +3 -3
- package/src/drop-zone/{index.js → index.tsx} +48 -13
- package/src/drop-zone/{provider.js → provider.ts} +5 -1
- package/src/drop-zone/stories/index.tsx +30 -0
- package/src/drop-zone/types.ts +29 -0
- package/src/dropdown/README.md +6 -4
- package/src/dropdown/stories/index.js +1 -1
- package/src/flex/flex/hook.ts +5 -54
- package/src/flex/test/__snapshots__/index.tsx.snap +7 -15
- package/src/focal-point-picker/README.md +2 -2
- package/src/focal-point-picker/{controls.js → controls.tsx} +38 -10
- package/src/focal-point-picker/{focal-point.js → focal-point.tsx} +7 -1
- package/src/focal-point-picker/{grid.js → grid.tsx} +6 -1
- package/src/focal-point-picker/{index.js → index.tsx} +99 -15
- package/src/focal-point-picker/{media.js → media.tsx} +10 -4
- package/src/focal-point-picker/stories/index.tsx +93 -0
- package/src/focal-point-picker/styles/{focal-point-picker-style.js → focal-point-picker-style.ts} +31 -5
- package/src/focal-point-picker/styles/{focal-point-style.js → focal-point-style.ts} +2 -1
- package/src/focal-point-picker/test/index.js +27 -7
- package/src/focal-point-picker/types.ts +93 -0
- package/src/focal-point-picker/{utils.js → utils.ts} +9 -9
- package/src/font-size-picker/README.md +9 -0
- package/src/font-size-picker/index.js +9 -0
- package/src/font-size-picker/stories/index.js +3 -5
- package/src/font-size-picker/test/index.js +15 -2
- package/src/font-size-picker/test/utils.js +1 -2
- package/src/font-size-picker/utils.js +1 -1
- package/src/form-file-upload/README.md +6 -1
- package/src/form-file-upload/{index.js → index.tsx} +22 -4
- package/src/form-file-upload/stories/index.tsx +74 -0
- package/src/form-file-upload/test/{index.js → index.tsx} +7 -3
- package/src/form-file-upload/types.ts +63 -0
- package/src/form-toggle/index.tsx +1 -6
- package/src/form-token-field/index.tsx +4 -5
- package/src/form-token-field/suggestions-list.tsx +1 -2
- package/src/gradient-picker/index.js +41 -47
- package/src/gradient-picker/stories/index.js +10 -0
- package/src/h-stack/test/__snapshots__/index.tsx.snap +3 -12
- package/src/higher-order/with-filters/test/__snapshots__/index.js.snap +87 -0
- package/src/higher-order/with-filters/test/index.js +20 -74
- package/src/icon/index.tsx +1 -1
- package/src/icon/stories/index.js +18 -0
- package/src/icon/test/index.js +32 -83
- package/src/input-control/input-base.tsx +9 -11
- package/src/input-control/label.tsx +9 -4
- package/src/input-control/styles/input-control-styles.tsx +0 -43
- package/src/input-control/types.ts +3 -0
- package/src/isolated-event-container/test/index.js +53 -11
- package/src/item-group/test/__snapshots__/index.js.snap +16 -16
- package/src/keyboard-shortcuts/test/index.js +16 -31
- package/src/menu-item/test/__snapshots__/index.js.snap +60 -62
- package/src/menu-item/test/index.js +30 -22
- package/src/modal/aria-helper.js +3 -8
- package/src/navigable-container/README.md +2 -0
- package/src/navigable-container/container.js +8 -1
- package/src/navigable-container/menu.js +14 -11
- package/src/navigable-container/stories/navigable-menu.js +49 -0
- package/src/navigable-container/stories/tabbable-container.js +40 -0
- package/src/navigable-container/tabbable.js +2 -3
- package/src/navigable-container/test/navigable-menu.js +277 -0
- package/src/navigable-container/test/tababble-container.js +175 -0
- package/src/navigator/navigator-button/hook.ts +1 -1
- package/src/navigator/navigator-screen/component.tsx +6 -1
- package/src/number-control/index.tsx +209 -0
- package/src/number-control/stories/index.js +6 -18
- package/src/number-control/types.ts +75 -0
- package/src/panel/test/__snapshots__/header.js.snap +9 -0
- package/src/panel/test/__snapshots__/index.js.snap +17 -0
- package/src/panel/test/__snapshots__/row.js.snap +17 -0
- package/src/panel/test/header.js +30 -23
- package/src/panel/test/index.js +33 -25
- package/src/panel/test/row.js +18 -11
- package/src/placeholder/index.tsx +4 -5
- package/src/placeholder/style.scss +4 -0
- package/src/popover/README.md +83 -48
- package/src/popover/{index.js → index.tsx} +246 -176
- package/src/popover/stories/{index.js → index.tsx} +51 -54
- package/src/popover/types.ts +173 -0
- package/src/popover/utils.ts +230 -0
- package/src/radio-control/index.tsx +28 -29
- package/src/radio-control/style.scss +0 -17
- package/src/range-control/index.tsx +4 -1
- package/src/range-control/styles/range-control-styles.ts +8 -8
- package/src/sandbox/index.js +2 -2
- package/src/search-control/README.md +5 -3
- package/src/search-control/{index.js → index.tsx} +35 -7
- package/src/search-control/stories/index.tsx +66 -0
- package/src/search-control/types.ts +43 -0
- package/src/select-control/index.native.js +1 -1
- package/src/slot-fill/test/index.js +69 -12
- package/src/style.scss +0 -1
- package/src/surface/test/__snapshots__/index.tsx.snap +10 -10
- package/src/tab-panel/README.md +1 -2
- package/src/tab-panel/{index.js → index.tsx} +58 -13
- package/src/tab-panel/stories/index.tsx +37 -0
- package/src/tab-panel/test/index.tsx +120 -0
- package/src/tab-panel/types.ts +65 -0
- package/src/text-control/index.tsx +2 -0
- package/src/text-control/types.ts +5 -1
- package/src/textarea-control/index.tsx +3 -6
- package/src/textarea-control/types.ts +1 -1
- package/src/toggle-control/index.tsx +97 -0
- package/src/toggle-control/stories/index.tsx +58 -0
- package/src/toggle-control/test/index.tsx +53 -0
- package/src/toggle-control/types.ts +28 -0
- package/src/toggle-group-control/stories/index.tsx +10 -3
- package/src/toggle-group-control/toggle-group-control/component.tsx +3 -3
- package/src/toggle-group-control/toggle-group-control-option-icon/README.md +1 -1
- package/src/toggle-group-control/toggle-group-control-option-icon/component.tsx +1 -1
- package/src/toggle-group-control/types.ts +2 -2
- package/src/tooltip/index.js +1 -1
- package/src/ui/context/context-connect.ts +58 -31
- package/src/ui/context/context-system-provider.js +5 -4
- package/src/ui/context/test/context-connect.tsx +55 -0
- package/src/ui/context/test/wordpress-component.tsx +36 -0
- package/src/ui/context/wordpress-component.ts +18 -12
- package/src/ui/control-group/test/__snapshots__/index.js.snap +1 -4
- package/src/unit-control/index.tsx +1 -1
- package/src/unit-control/stories/index.tsx +7 -16
- package/src/unit-control/styles/unit-control-styles.ts +2 -2
- package/src/unit-control/test/__snapshots__/index.tsx.snap +4 -6
- package/src/unit-control/types.ts +3 -44
- package/src/utils/colors-values.js +2 -24
- package/src/utils/math.js +4 -4
- package/src/utils/values.js +48 -6
- package/src/v-stack/test/__snapshots__/index.tsx.snap +3 -12
- package/src/view/{component.js → component.tsx} +13 -4
- package/src/view/stories/index.tsx +32 -0
- package/src/view/types.ts +6 -0
- package/tsconfig.json +0 -6
- package/tsconfig.tsbuildinfo +1 -1
- package/src/focal-point-picker/stories/index.js +0 -76
- package/src/navigable-container/test/menu.js +0 -310
- package/src/navigable-container/test/tabbable.js +0 -158
- package/src/number-control/index.js +0 -192
- package/src/popover/utils.js +0 -107
- package/src/search-control/stories/index.js +0 -39
- package/src/tab-panel/stories/index.js +0 -39
- package/src/tab-panel/test/index.js +0 -179
- package/src/toggle-control/index.js +0 -55
- package/src/toggle-control/stories/index.js +0 -64
- package/src/toggle-control/style.scss +0 -14
- package/src/toggle-control/test/index.js +0 -52
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/popover/index.js"],"names":["SLOT_NAME","ArrowTriangle","props","MaybeAnimatedWrapper","forwardedRef","style","receivedInlineStyles","placement","shouldAnimate","shouldReduceMotion","motionInlineStyles","otherMotionProps","slotNameContext","Popover","range","animate","headerTitle","onClose","children","className","noArrow","isAlternate","position","placementProp","offset","offsetProp","focusOnMount","anchorRef","anchorRect","getAnchorRect","expandOnMobile","onFocusOutside","__unstableSlotName","__unstableForcePosition","__unstableShift","contentProps","since","version","arrowRef","anchorRefFallback","isMobileViewport","isExpanded","hasArrow","normalizedPlacementFromProps","referenceOwnerDocument","documentToReturn","top","ownerDocument","startContainer","current","document","frameOffsetRef","offsetRef","middleware","currentPlacement","isTopBottomPlacement","includes","mainAxis","crossAxis","hasBeforePlacement","mainAxisModifier","undefined","apply","sizeProps","availableHeight","refs","floating","Object","assign","firstChild","maxHeight","overflow","limiter","padding","element","filter","m","slotName","slot","onDialogClose","type","event","dialogRef","dialogProps","__unstableOnClose","x","y","reference","strategy","update","computedPlacement","middlewareData","arrow","arrowData","resultingReferenceRef","getBoundingClientRect","topRect","bottomRect","bottom","window","DOMRect","width","rect","left","right","height","parentNode","animationFrame","referenceAndFloatingHaveSameDocument","hasFrameElement","defaultView","frameElement","updateFrameOffset","addEventListener","removeEventListener","mergedFloatingRef","content","Number","isNaN","close","split","join","isFinite","ref","PopoverContainer","PopoverSlot","name","Slot","__unstableSlotNameProvider","Provider"],"mappings":";;;;;;;;;AAqBA;;;;AAjBA;;AACA;;AAWA;;AAcA;;AAKA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AA7CA;;AACA;AACA;AACA;AAYA;;AAGA;AACA;AACA;;AAmBA;AACA;AACA;;AAUA;AACA;AACA;AACA;AACA;AACA,MAAMA,SAAS,GAAG,SAAlB,C,CAEA;AACA;AACA;AACA;;AACA,MAAMC,aAAa,GAAKC,KAAF,IACrB,4BAAC,eAAD,6BACMA,KADN;AAEC,EAAA,KAAK,EAAC,4BAFP;AAGC,EAAA,OAAO,EAAI,aAHZ;AAIC,EAAA,SAAS,EAAC,8BAJX;AAKC,EAAA,IAAI,EAAC;AALN,IAOC,4BAAC,gBAAD;AACC,EAAA,SAAS,EAAC,iCADX;AAEC,EAAA,CAAC,EAAC;AAFH,EAPD,EAWC,4BAAC,gBAAD;AACC,EAAA,SAAS,EAAC,qCADX;AAEC,EAAA,CAAC,EAAC,uBAFH;AAGC,EAAA,YAAY,EAAC;AAHd,EAXD,CADD;;AAoBA,MAAMC,oBAAoB,GAAG,yBAC5B,OAOCC,YAPD,KAQK;AAAA,MAPJ;AACCC,IAAAA,KAAK,EAAEC,oBADR;AAECC,IAAAA,SAFD;AAGCC,IAAAA,aAAa,GAAG,KAHjB;AAIC,OAAGN;AAJJ,GAOI;AACJ,QAAMO,kBAAkB,GAAG,qCAA3B;AAEA,QAAM;AAAEJ,IAAAA,KAAK,EAAEK,kBAAT;AAA6B,OA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7B,SAAjB,aAAiBA,SAAjB,uBAAiBA,SAAS,CAAEP,CAA5B,IACD,GAAGO,SAAS,CAACP,CAAG,IADf,GAEF;AANI;AANT,KAeC,4BAAC,aAAD,OAfD,CArCF,CAHD;;AA6DA,MAAKR,IAAI,CAAC6C,GAAV,EAAgB;AACfP,IAAAA,OAAO,GAAG,4BAAC,cAAD;AAAM,MAAA,IAAI,EAAGvC;AAAb,OAA0BuC,OAA1B,CAAV;AACA;;AAED,MAAKzF,SAAS,IAAIC,UAAlB,EAA+B;AAC9B,WAAOwF,OAAP;AACA;;AAED,SAAO;AAAM,IAAA,GAAG,EAAG7E;AAAZ,KAAkC6E,OAAlC,CAAP;AACA,CAhXD;;AAkXA,MAAMQ,gBAAgB,GAAG,yBAAY/G,OAAZ,CAAzB;;AAEA,SAASgH,WAAT,QAA4CF,GAA5C,EAAkD;AAAA,MAA5B;AAAEG,IAAAA,IAAI,GAAG9H;AAAT,GAA4B;AACjD,SACC,4BAAC,cAAD;AACC,IAAA,gBAAgB,MADjB;AAEC,IAAA,IAAI,EAAG8H,IAFR;AAGC,IAAA,SAAS,EAAC,cAHX;AAIC,IAAA,GAAG,EAAGH;AAJP,IADD;AAQA;;AAEDC,gBAAgB,CAACG,IAAjB,GAAwB,yBAAYF,WAAZ,CAAxB;AACAD,gBAAgB,CAACI,0BAAjB,GAA8CpH,eAAe,CAACqH,QAA9D;eAEeL,gB","sourcesContent":["// @ts-nocheck\n/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport {\n\tuseFloating,\n\tflip,\n\tshift,\n\tautoUpdate,\n\tarrow,\n\toffset as offsetMiddleware,\n\tlimitShift,\n\tsize,\n} from '@floating-ui/react-dom';\n// eslint-disable-next-line no-restricted-imports\nimport { motion, useReducedMotion } from 'framer-motion';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseRef,\n\tuseLayoutEffect,\n\tforwardRef,\n\tcreateContext,\n\tuseContext,\n\tuseMemo,\n\tuseEffect,\n} from '@wordpress/element';\nimport {\n\tuseViewportMatch,\n\tuseMergeRefs,\n\t__experimentalUseDialog as useDialog,\n} from '@wordpress/compose';\nimport { close } from '@wordpress/icons';\nimport deprecated from '@wordpress/deprecated';\nimport { Path, SVG } from '@wordpress/primitives';\n\n/**\n * Internal dependencies\n */\nimport Button from '../button';\nimport ScrollLock from '../scroll-lock';\nimport { Slot, Fill, useSlot } from '../slot-fill';\nimport {\n\tgetFrameOffset,\n\tpositionToPlacement,\n\tplacementToMotionAnimationProps,\n} from './utils';\n\n/**\n * Name of slot in which popover should fill.\n *\n * @type {string}\n */\nconst SLOT_NAME = 'Popover';\n\n// An SVG displaying a triangle facing down, filled with a solid\n// color and bordered in such a way to create an arrow-like effect.\n// Keeping the SVG's viewbox squared simplify the arrow positioning\n// calculations.\nconst ArrowTriangle = ( props ) => (\n\t<SVG\n\t\t{ ...props }\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\tviewBox={ `0 0 100 100` }\n\t\tclassName=\"components-popover__triangle\"\n\t\trole=\"presentation\"\n\t>\n\t\t<Path\n\t\t\tclassName=\"components-popover__triangle-bg\"\n\t\t\td=\"M 0 0 L 50 50 L 100 0\"\n\t\t/>\n\t\t<Path\n\t\t\tclassName=\"components-popover__triangle-border\"\n\t\t\td=\"M 0 0 L 50 50 L 100 0\"\n\t\t\tvectorEffect=\"non-scaling-stroke\"\n\t\t/>\n\t</SVG>\n);\n\nconst MaybeAnimatedWrapper = forwardRef(\n\t(\n\t\t{\n\t\t\tstyle: receivedInlineStyles,\n\t\t\tplacement,\n\t\t\tshouldAnimate = false,\n\t\t\t...props\n\t\t},\n\t\tforwardedRef\n\t) => {\n\t\tconst shouldReduceMotion = useReducedMotion();\n\n\t\tconst { style: motionInlineStyles, ...otherMotionProps } = useMemo(\n\t\t\t() => placementToMotionAnimationProps( placement ),\n\t\t\t[ placement ]\n\t\t);\n\n\t\tif ( shouldAnimate && ! shouldReduceMotion ) {\n\t\t\treturn (\n\t\t\t\t<motion.div\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t...motionInlineStyles,\n\t\t\t\t\t\t...receivedInlineStyles,\n\t\t\t\t\t} }\n\t\t\t\t\t{ ...otherMotionProps }\n\t\t\t\t\t{ ...props }\n\t\t\t\t\tref={ forwardedRef }\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tstyle={ receivedInlineStyles }\n\t\t\t\t{ ...props }\n\t\t\t\tref={ forwardedRef }\n\t\t\t/>\n\t\t);\n\t}\n);\n\nconst slotNameContext = createContext();\n\nconst Popover = (\n\t{\n\t\trange,\n\t\tanimate = true,\n\t\theaderTitle,\n\t\tonClose,\n\t\tchildren,\n\t\tclassName,\n\t\tnoArrow = true,\n\t\tisAlternate,\n\t\tposition,\n\t\tplacement: placementProp = 'bottom-start',\n\t\toffset: offsetProp = 0,\n\t\tfocusOnMount = 'firstElement',\n\t\tanchorRef,\n\t\tanchorRect,\n\t\tgetAnchorRect,\n\t\texpandOnMobile,\n\t\tonFocusOutside,\n\t\t__unstableSlotName = SLOT_NAME,\n\t\t__unstableForcePosition = false,\n\t\t__unstableShift = false,\n\t\t...contentProps\n\t},\n\tforwardedRef\n) => {\n\tif ( range ) {\n\t\tdeprecated( 'range prop in Popover component', {\n\t\t\tsince: '6.1',\n\t\t\tversion: '6.3',\n\t\t} );\n\t}\n\n\tconst arrowRef = useRef( null );\n\tconst anchorRefFallback = useRef( null );\n\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst isExpanded = expandOnMobile && isMobileViewport;\n\tconst hasArrow = ! isExpanded && ! noArrow;\n\tconst normalizedPlacementFromProps = position\n\t\t? positionToPlacement( position )\n\t\t: placementProp;\n\n\tconst referenceOwnerDocument = useMemo( () => {\n\t\tlet documentToReturn;\n\n\t\tif ( anchorRef?.top ) {\n\t\t\tdocumentToReturn = anchorRef?.top.ownerDocument;\n\t\t} else if ( anchorRef?.startContainer ) {\n\t\t\tdocumentToReturn = anchorRef.startContainer.ownerDocument;\n\t\t} else if ( anchorRef?.current ) {\n\t\t\tdocumentToReturn = anchorRef.current.ownerDocument;\n\t\t} else if ( anchorRef ) {\n\t\t\t// This one should be deprecated.\n\t\t\tdocumentToReturn = anchorRef.ownerDocument;\n\t\t} else if ( anchorRect && anchorRect?.ownerDocument ) {\n\t\t\tdocumentToReturn = anchorRect.ownerDocument;\n\t\t} else if ( getAnchorRect ) {\n\t\t\tdocumentToReturn = getAnchorRect(\n\t\t\t\tanchorRefFallback.current\n\t\t\t)?.ownerDocument;\n\t\t}\n\n\t\treturn documentToReturn ?? document;\n\t}, [ anchorRef, anchorRect, getAnchorRect ] );\n\n\t/**\n\t * Offsets the position of the popover when the anchor is inside an iframe.\n\t *\n\t * Store the offset in a ref, due to constraints with floating-ui:\n\t * https://floating-ui.com/docs/react-dom#variables-inside-middleware-functions.\n\t */\n\tconst frameOffsetRef = useRef( getFrameOffset( referenceOwnerDocument ) );\n\t/**\n\t * Store the offset prop in a ref, due to constraints with floating-ui:\n\t * https://floating-ui.com/docs/react-dom#variables-inside-middleware-functions.\n\t */\n\tconst offsetRef = useRef( offsetProp );\n\n\tconst middleware = [\n\t\toffsetMiddleware( ( { placement: currentPlacement } ) => {\n\t\t\tif ( ! frameOffsetRef.current ) {\n\t\t\t\treturn offsetRef.current;\n\t\t\t}\n\n\t\t\tconst isTopBottomPlacement =\n\t\t\t\tcurrentPlacement.includes( 'top' ) ||\n\t\t\t\tcurrentPlacement.includes( 'bottom' );\n\n\t\t\t// The main axis should represent the gap between the\n\t\t\t// floating element and the reference element. The cross\n\t\t\t// axis is always perpendicular to the main axis.\n\t\t\tconst mainAxis = isTopBottomPlacement ? 'y' : 'x';\n\t\t\tconst crossAxis = mainAxis === 'x' ? 'y' : 'x';\n\n\t\t\t// When the popover is before the reference, subtract the offset,\n\t\t\t// of the main axis else add it.\n\t\t\tconst hasBeforePlacement =\n\t\t\t\tcurrentPlacement.includes( 'top' ) ||\n\t\t\t\tcurrentPlacement.includes( 'left' );\n\t\t\tconst mainAxisModifier = hasBeforePlacement ? -1 : 1;\n\n\t\t\treturn {\n\t\t\t\tmainAxis:\n\t\t\t\t\toffsetRef.current +\n\t\t\t\t\tframeOffsetRef.current[ mainAxis ] * mainAxisModifier,\n\t\t\t\tcrossAxis: frameOffsetRef.current[ crossAxis ],\n\t\t\t};\n\t\t} ),\n\t\t__unstableForcePosition ? undefined : flip(),\n\t\t__unstableForcePosition\n\t\t\t? undefined\n\t\t\t: size( {\n\t\t\t\t\tapply( sizeProps ) {\n\t\t\t\t\t\tconst { availableHeight } = sizeProps;\n\t\t\t\t\t\tif ( ! refs.floating.current ) return;\n\t\t\t\t\t\t// Reduce the height of the popover to the available space.\n\t\t\t\t\t\tObject.assign( refs.floating.current.firstChild.style, {\n\t\t\t\t\t\t\tmaxHeight: `${ availableHeight }px`,\n\t\t\t\t\t\t\toverflow: 'auto',\n\t\t\t\t\t\t} );\n\t\t\t\t\t},\n\t\t\t } ),\n\t\t__unstableShift\n\t\t\t? shift( {\n\t\t\t\t\tcrossAxis: true,\n\t\t\t\t\tlimiter: limitShift(),\n\t\t\t\t\tpadding: 1, // Necessary to avoid flickering at the edge of the viewport.\n\t\t\t } )\n\t\t\t: undefined,\n\t\thasArrow ? arrow( { element: arrowRef } ) : undefined,\n\t].filter( ( m ) => !! m );\n\tconst slotName = useContext( slotNameContext ) || __unstableSlotName;\n\tconst slot = useSlot( slotName );\n\n\tlet onDialogClose;\n\n\tif ( onClose || onFocusOutside ) {\n\t\tonDialogClose = ( type, event ) => {\n\t\t\t// Ideally the popover should have just a single onClose prop and\n\t\t\t// not three props that potentially do the same thing.\n\t\t\tif ( type === 'focus-outside' && onFocusOutside ) {\n\t\t\t\tonFocusOutside( event );\n\t\t\t} else if ( onClose ) {\n\t\t\t\tonClose();\n\t\t\t}\n\t\t};\n\t}\n\n\tconst [ dialogRef, dialogProps ] = useDialog( {\n\t\tfocusOnMount,\n\t\t__unstableOnClose: onDialogClose,\n\t\tonClose: onDialogClose,\n\t} );\n\n\tconst {\n\t\t// Positioning coordinates\n\t\tx,\n\t\ty,\n\t\t// Callback refs (not regular refs). This allows the position to be updated.\n\t\t// when either elements change.\n\t\treference,\n\t\tfloating,\n\t\t// Object with \"regular\" refs to both \"reference\" and \"floating\"\n\t\trefs,\n\t\t// Type of CSS position property to use (absolute or fixed)\n\t\tstrategy,\n\t\tupdate,\n\t\tplacement: computedPlacement,\n\t\tmiddlewareData: { arrow: arrowData = {} },\n\t} = useFloating( { placement: normalizedPlacementFromProps, middleware } );\n\n\tuseEffect( () => {\n\t\toffsetRef.current = offsetProp;\n\t\tupdate();\n\t}, [ offsetProp, update ] );\n\n\t// Update the `reference`'s ref.\n\t//\n\t// In floating-ui's terms:\n\t// - \"reference\" refers to the popover's anchor element.\n\t// - \"floating\" refers the floating popover's element.\n\t// A floating element can also be positioned relative to a virtual element,\n\t// instead of a real one. A virtual element is represented by an object\n\t// with the `getBoundingClientRect()` function (like real elements).\n\t// See https://floating-ui.com/docs/virtual-elements for more info.\n\tuseLayoutEffect( () => {\n\t\tlet resultingReferenceRef;\n\n\t\tif ( anchorRef?.top ) {\n\t\t\t// Create a virtual element for the ref. The expectation is that\n\t\t\t// if anchorRef.top is defined, then anchorRef.bottom is defined too.\n\t\t\tresultingReferenceRef = {\n\t\t\t\tgetBoundingClientRect() {\n\t\t\t\t\tconst topRect = anchorRef.top.getBoundingClientRect();\n\t\t\t\t\tconst bottomRect = anchorRef.bottom.getBoundingClientRect();\n\t\t\t\t\treturn new window.DOMRect(\n\t\t\t\t\t\ttopRect.x,\n\t\t\t\t\t\ttopRect.y,\n\t\t\t\t\t\ttopRect.width,\n\t\t\t\t\t\tbottomRect.bottom - topRect.top\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t};\n\t\t} else if ( anchorRef?.current ) {\n\t\t\t// Standard React ref.\n\t\t\tresultingReferenceRef = anchorRef.current;\n\t\t} else if ( anchorRef ) {\n\t\t\t// If `anchorRef` holds directly the element's value (no `current` key)\n\t\t\t// This is a weird scenario and should be deprecated.\n\t\t\tresultingReferenceRef = anchorRef;\n\t\t} else if ( anchorRect ) {\n\t\t\t// Create a virtual element for the ref.\n\t\t\tresultingReferenceRef = {\n\t\t\t\tgetBoundingClientRect() {\n\t\t\t\t\treturn anchorRect;\n\t\t\t\t},\n\t\t\t};\n\t\t} else if ( getAnchorRect ) {\n\t\t\t// Create a virtual element for the ref.\n\t\t\tresultingReferenceRef = {\n\t\t\t\tgetBoundingClientRect() {\n\t\t\t\t\tconst rect = getAnchorRect( anchorRefFallback.current );\n\t\t\t\t\treturn new window.DOMRect(\n\t\t\t\t\t\trect.x ?? rect.left,\n\t\t\t\t\t\trect.y ?? rect.top,\n\t\t\t\t\t\trect.width ?? rect.right - rect.left,\n\t\t\t\t\t\trect.height ?? rect.bottom - rect.top\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t};\n\t\t} else if ( anchorRefFallback.current ) {\n\t\t\t// If no explicit ref is passed via props, fall back to\n\t\t\t// anchoring to the popover's parent node.\n\t\t\tresultingReferenceRef = anchorRefFallback.current.parentNode;\n\t\t}\n\n\t\tif ( ! resultingReferenceRef ) {\n\t\t\treturn;\n\t\t}\n\n\t\treference( resultingReferenceRef );\n\n\t\tif ( ! refs.floating.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn autoUpdate(\n\t\t\tresultingReferenceRef,\n\t\t\trefs.floating.current,\n\t\t\tupdate,\n\t\t\t{\n\t\t\t\tanimationFrame: true,\n\t\t\t}\n\t\t);\n\t\t// 'reference' and 'refs.floating' are refs and don't need to be listed\n\t\t// as dependencies (see https://github.com/WordPress/gutenberg/pull/41612)\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ anchorRef, anchorRect, getAnchorRect, update ] );\n\n\t// If the reference element is in a different ownerDocument (e.g. iFrame),\n\t// we need to manually update the floating's position as the reference's owner\n\t// document scrolls. Also update the frame offset if the view resizes.\n\tuseLayoutEffect( () => {\n\t\tconst referenceAndFloatingHaveSameDocument =\n\t\t\treferenceOwnerDocument === document;\n\t\tconst hasFrameElement =\n\t\t\t!! referenceOwnerDocument?.defaultView?.frameElement;\n\n\t\tif ( referenceAndFloatingHaveSameDocument || ! hasFrameElement ) {\n\t\t\tframeOffsetRef.current = undefined;\n\t\t\treturn;\n\t\t}\n\n\t\tconst { defaultView } = referenceOwnerDocument;\n\n\t\tconst updateFrameOffset = () => {\n\t\t\tframeOffsetRef.current = getFrameOffset( referenceOwnerDocument );\n\t\t\tupdate();\n\t\t};\n\t\tdefaultView.addEventListener( 'resize', updateFrameOffset );\n\n\t\tupdateFrameOffset();\n\n\t\treturn () => {\n\t\t\tdefaultView.removeEventListener( 'resize', updateFrameOffset );\n\t\t};\n\t}, [ referenceOwnerDocument, update ] );\n\n\tconst mergedFloatingRef = useMergeRefs( [\n\t\tfloating,\n\t\tdialogRef,\n\t\tforwardedRef,\n\t] );\n\n\t// Disable reason: We care to capture the _bubbled_ events from inputs\n\t// within popover as inferring close intent.\n\n\tlet content = (\n\t\t// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<MaybeAnimatedWrapper\n\t\t\tshouldAnimate={ animate && ! isExpanded }\n\t\t\tplacement={ computedPlacement }\n\t\t\tclassName={ classnames( 'components-popover', className, {\n\t\t\t\t'is-expanded': isExpanded,\n\t\t\t\t'is-alternate': isAlternate,\n\t\t\t} ) }\n\t\t\t{ ...contentProps }\n\t\t\tref={ mergedFloatingRef }\n\t\t\t{ ...dialogProps }\n\t\t\ttabIndex=\"-1\"\n\t\t\tstyle={\n\t\t\t\tisExpanded\n\t\t\t\t\t? undefined\n\t\t\t\t\t: {\n\t\t\t\t\t\t\tposition: strategy,\n\t\t\t\t\t\t\tleft: Number.isNaN( x ) ? 0 : x,\n\t\t\t\t\t\t\ttop: Number.isNaN( y ) ? 0 : y,\n\t\t\t\t\t }\n\t\t\t}\n\t\t>\n\t\t\t{ /* Prevents scroll on the document */ }\n\t\t\t{ isExpanded && <ScrollLock /> }\n\t\t\t{ isExpanded && (\n\t\t\t\t<div className=\"components-popover__header\">\n\t\t\t\t\t<span className=\"components-popover__header-title\">\n\t\t\t\t\t\t{ headerTitle }\n\t\t\t\t\t</span>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName=\"components-popover__close\"\n\t\t\t\t\t\ticon={ close }\n\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<div className=\"components-popover__content\">{ children }</div>\n\t\t\t{ hasArrow && (\n\t\t\t\t<div\n\t\t\t\t\tref={ arrowRef }\n\t\t\t\t\tclassName={ [\n\t\t\t\t\t\t'components-popover__arrow',\n\t\t\t\t\t\t`is-${ computedPlacement.split( '-' )[ 0 ] }`,\n\t\t\t\t\t].join( ' ' ) }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\tleft: Number.isFinite( arrowData?.x )\n\t\t\t\t\t\t\t? `${ arrowData.x }px`\n\t\t\t\t\t\t\t: '',\n\t\t\t\t\t\ttop: Number.isFinite( arrowData?.y )\n\t\t\t\t\t\t\t? `${ arrowData.y }px`\n\t\t\t\t\t\t\t: '',\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<ArrowTriangle />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</MaybeAnimatedWrapper>\n\t);\n\n\tif ( slot.ref ) {\n\t\tcontent = <Fill name={ slotName }>{ content }</Fill>;\n\t}\n\n\tif ( anchorRef || anchorRect ) {\n\t\treturn content;\n\t}\n\n\treturn <span ref={ anchorRefFallback }>{ content }</span>;\n};\n\nconst PopoverContainer = forwardRef( Popover );\n\nfunction PopoverSlot( { name = SLOT_NAME }, ref ) {\n\treturn (\n\t\t<Slot\n\t\t\tbubblesVirtually\n\t\t\tname={ name }\n\t\t\tclassName=\"popover-slot\"\n\t\t\tref={ ref }\n\t\t/>\n\t);\n}\n\nPopoverContainer.Slot = forwardRef( PopoverSlot );\nPopoverContainer.__unstableSlotNameProvider = slotNameContext.Provider;\n\nexport default PopoverContainer;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/popover/index.tsx"],"names":["SLOT_NAME","ArrowTriangle","AnimatedWrapper","forwardedRef","style","receivedInlineStyles","placement","shouldAnimate","props","hasAnimatedOnce","setHasAnimatedOnce","shouldReduceMotion","motionInlineStyles","otherMotionProps","onAnimationComplete","computedAnimationProps","animate","slotNameContext","undefined","UnforwardedPopover","range","headerTitle","onClose","children","className","noArrow","isAlternate","position","placementProp","offset","offsetProp","focusOnMount","anchorRef","anchorRect","getAnchorRect","expandOnMobile","onFocusOutside","__unstableSlotName","flip","resize","shift","__unstableShift","__unstableForcePosition","contentProps","since","version","computedFlipProp","computedResizeProp","alternative","shouldShift","arrowRef","fallbackReferenceElement","setFallbackReferenceElement","referenceOwnerDocument","setReferenceOwnerDocument","anchorRefFallback","node","isMobileViewport","isExpanded","hasArrow","normalizedPlacementFromProps","frameOffsetRef","offsetRef","middleware","currentPlacement","current","isTopBottomPlacement","includes","mainAxis","crossAxis","hasBeforePlacement","mainAxisModifier","apply","sizeProps","firstElementChild","refs","floating","HTMLElement","Object","assign","maxHeight","availableHeight","overflow","limiter","padding","element","filter","m","slotName","slot","onDialogClose","type","event","dialogRef","dialogProps","__unstableOnClose","x","y","reference","referenceCallbackRef","strategy","update","computedPlacement","middlewareData","arrow","arrowData","whileElementsMounted","referenceParam","floatingParam","updateParam","animationFrame","arrowCallbackRef","resultingReferenceOwnerDoc","fallbackDocument","document","resultingReferenceElement","top","bottom","startContainer","ownerDocument","defaultView","frameElement","updateFrameOffset","addEventListener","removeEventListener","mergedFloatingRef","content","left","Number","isNaN","close","split","join","isFinite","ref","Popover","PopoverSlot","name","Slot","__unstableSlotNameProvider","Provider"],"mappings":";;;;;;;;;AA2BA;;;;AAvBA;;AACA;;AAYA;;AAqBA;;AAKA;;AACA;;AACA;;AAKA;;AACA;;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AAA,IAAI,GAAGzI;AAAT,GAEC;AACD,SACC,4BAAC,cAAD,CACC;AADD;AAEC,IAAA,gBAAgB,MAFjB;AAGC,IAAA,IAAI,EAAGyI,IAHR;AAIC,IAAA,SAAS,EAAC,cAJX;AAKC,IAAA,GAAG,EAAGH;AALP,IADD;AASA,C,CAED;;;AACAC,OAAO,CAACG,IAAR,GAAe,yBAAYF,WAAZ,CAAf,C,CACA;;AACAD,OAAO,CAACI,0BAAR,GAAqC1H,eAAe,CAAC2H,QAArD;eAEeL,O","sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef, SyntheticEvent, RefCallback } from 'react';\nimport classnames from 'classnames';\nimport {\n\tuseFloating,\n\tflip as flipMiddleware,\n\tshift as shiftMiddleware,\n\tautoUpdate,\n\tarrow,\n\toffset as offsetMiddleware,\n\tlimitShift,\n\tsize,\n\tMiddleware,\n} from '@floating-ui/react-dom';\n// eslint-disable-next-line no-restricted-imports\nimport {\n\tmotion,\n\tuseReducedMotion,\n\tHTMLMotionProps,\n\tMotionProps,\n} from 'framer-motion';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseRef,\n\tuseLayoutEffect,\n\tforwardRef,\n\tcreateContext,\n\tuseContext,\n\tuseMemo,\n\tuseState,\n\tuseCallback,\n\tuseEffect,\n} from '@wordpress/element';\nimport {\n\tuseViewportMatch,\n\tuseMergeRefs,\n\t__experimentalUseDialog as useDialog,\n} from '@wordpress/compose';\nimport { close } from '@wordpress/icons';\nimport deprecated from '@wordpress/deprecated';\nimport { Path, SVG } from '@wordpress/primitives';\n\n/**\n * Internal dependencies\n */\nimport Button from '../button';\nimport ScrollLock from '../scroll-lock';\nimport { Slot, Fill, useSlot } from '../slot-fill';\nimport {\n\tgetFrameOffset,\n\tpositionToPlacement,\n\tplacementToMotionAnimationProps,\n\tgetReferenceOwnerDocument,\n\tgetReferenceElement,\n} from './utils';\nimport type { WordPressComponentProps } from '../ui/context';\nimport type {\n\tPopoverProps,\n\tAnimatedWrapperProps,\n\tPopoverAnchorRefReference,\n\tPopoverAnchorRefTopBottom,\n} from './types';\n\n/**\n * Name of slot in which popover should fill.\n *\n * @type {string}\n */\nconst SLOT_NAME = 'Popover';\n\n// An SVG displaying a triangle facing down, filled with a solid\n// color and bordered in such a way to create an arrow-like effect.\n// Keeping the SVG's viewbox squared simplify the arrow positioning\n// calculations.\nconst ArrowTriangle = () => (\n\t<SVG\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\tviewBox={ `0 0 100 100` }\n\t\tclassName=\"components-popover__triangle\"\n\t\trole=\"presentation\"\n\t>\n\t\t<Path\n\t\t\tclassName=\"components-popover__triangle-bg\"\n\t\t\td=\"M 0 0 L 50 50 L 100 0\"\n\t\t/>\n\t\t<Path\n\t\t\tclassName=\"components-popover__triangle-border\"\n\t\t\td=\"M 0 0 L 50 50 L 100 0\"\n\t\t\tvectorEffect=\"non-scaling-stroke\"\n\t\t/>\n\t</SVG>\n);\n\nconst AnimatedWrapper = forwardRef(\n\t(\n\t\t{\n\t\t\tstyle: receivedInlineStyles,\n\t\t\tplacement,\n\t\t\tshouldAnimate = false,\n\t\t\t...props\n\t\t}: HTMLMotionProps< 'div' > & AnimatedWrapperProps,\n\t\tforwardedRef: ForwardedRef< any >\n\t) => {\n\t\t// When animating, animate only once (i.e. when the popover is opened), and\n\t\t// do not animate on subsequent prop changes (as it conflicts with\n\t\t// floating-ui's positioning updates).\n\t\tconst [ hasAnimatedOnce, setHasAnimatedOnce ] = useState( false );\n\t\tconst shouldReduceMotion = useReducedMotion();\n\n\t\tconst { style: motionInlineStyles, ...otherMotionProps } = useMemo(\n\t\t\t() => placementToMotionAnimationProps( placement ),\n\t\t\t[ placement ]\n\t\t);\n\n\t\tconst onAnimationComplete = useCallback(\n\t\t\t() => setHasAnimatedOnce( true ),\n\t\t\t[]\n\t\t);\n\n\t\tconst computedAnimationProps: HTMLMotionProps< 'div' > =\n\t\t\tshouldAnimate && ! shouldReduceMotion\n\t\t\t\t? {\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t...motionInlineStyles,\n\t\t\t\t\t\t\t...receivedInlineStyles,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t...otherMotionProps,\n\t\t\t\t\t\tonAnimationComplete,\n\t\t\t\t\t\tanimate: hasAnimatedOnce\n\t\t\t\t\t\t\t? false\n\t\t\t\t\t\t\t: otherMotionProps.animate,\n\t\t\t\t }\n\t\t\t\t: {\n\t\t\t\t\t\tanimate: false,\n\t\t\t\t\t\tstyle: receivedInlineStyles,\n\t\t\t\t };\n\n\t\treturn (\n\t\t\t<motion.div\n\t\t\t\t{ ...computedAnimationProps }\n\t\t\t\t{ ...props }\n\t\t\t\tref={ forwardedRef }\n\t\t\t/>\n\t\t);\n\t}\n);\n\nconst slotNameContext = createContext< string | undefined >( undefined );\n\nconst UnforwardedPopover = (\n\tprops: Omit<\n\t\tWordPressComponentProps< PopoverProps, 'div', false >,\n\t\t// To avoid overlaps between the standard HTML attributes and the props\n\t\t// expected by `framer-motion`, omit all framer motion props from popover\n\t\t// props (except for `animate`, which is re-defined in `PopoverProps`).\n\t\tkeyof Omit< MotionProps, 'animate' >\n\t>,\n\tforwardedRef: ForwardedRef< any >\n) => {\n\tconst {\n\t\trange,\n\t\tanimate = true,\n\t\theaderTitle,\n\t\tonClose,\n\t\tchildren,\n\t\tclassName,\n\t\tnoArrow = true,\n\t\tisAlternate,\n\t\tposition,\n\t\tplacement: placementProp = 'bottom-start',\n\t\toffset: offsetProp = 0,\n\t\tfocusOnMount = 'firstElement',\n\t\tanchorRef,\n\t\tanchorRect,\n\t\tgetAnchorRect,\n\t\texpandOnMobile,\n\t\tonFocusOutside,\n\t\t__unstableSlotName = SLOT_NAME,\n\t\tflip = true,\n\t\tresize = true,\n\t\tshift = false,\n\t\t__unstableShift,\n\t\t__unstableForcePosition,\n\t\t...contentProps\n\t} = props;\n\n\tif ( range ) {\n\t\tdeprecated( 'range prop in Popover component', {\n\t\t\tsince: '6.1',\n\t\t\tversion: '6.3',\n\t\t} );\n\t}\n\n\tlet computedFlipProp = flip;\n\tlet computedResizeProp = resize;\n\tif ( __unstableForcePosition !== undefined ) {\n\t\tdeprecated( '__unstableForcePosition prop in Popover component', {\n\t\t\tsince: '6.1',\n\t\t\tversion: '6.3',\n\t\t\talternative: '`flip={ false }` and `resize={ false }`',\n\t\t} );\n\n\t\t// Back-compat, set the `flip` and `resize` props\n\t\t// to `false` to replicate `__unstableForcePosition`.\n\t\tcomputedFlipProp = ! __unstableForcePosition;\n\t\tcomputedResizeProp = ! __unstableForcePosition;\n\t}\n\n\tlet shouldShift = shift;\n\tif ( __unstableShift !== undefined ) {\n\t\tdeprecated( '`__unstableShift` prop in Popover component', {\n\t\t\tsince: '6.1',\n\t\t\tversion: '6.3',\n\t\t\talternative: '`shift` prop`',\n\t\t} );\n\n\t\t// Back-compat.\n\t\tshouldShift = __unstableShift;\n\t}\n\n\tconst arrowRef = useRef( null );\n\n\tconst [ fallbackReferenceElement, setFallbackReferenceElement ] =\n\t\tuseState< HTMLSpanElement | null >( null );\n\tconst [ referenceOwnerDocument, setReferenceOwnerDocument ] = useState<\n\t\tDocument | undefined\n\t>();\n\n\tconst anchorRefFallback: RefCallback< HTMLSpanElement > = useCallback(\n\t\t( node ) => {\n\t\t\tsetFallbackReferenceElement( node );\n\t\t},\n\t\t[]\n\t);\n\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst isExpanded = expandOnMobile && isMobileViewport;\n\tconst hasArrow = ! isExpanded && ! noArrow;\n\tconst normalizedPlacementFromProps = position\n\t\t? positionToPlacement( position )\n\t\t: placementProp;\n\n\t/**\n\t * Offsets the position of the popover when the anchor is inside an iframe.\n\t *\n\t * Store the offset in a ref, due to constraints with floating-ui:\n\t * https://floating-ui.com/docs/react-dom#variables-inside-middleware-functions.\n\t */\n\tconst frameOffsetRef = useRef( getFrameOffset( referenceOwnerDocument ) );\n\t/**\n\t * Store the offset prop in a ref, due to constraints with floating-ui:\n\t * https://floating-ui.com/docs/react-dom#variables-inside-middleware-functions.\n\t */\n\tconst offsetRef = useRef( offsetProp );\n\n\tconst middleware = [\n\t\toffsetMiddleware( ( { placement: currentPlacement } ) => {\n\t\t\tif ( ! frameOffsetRef.current ) {\n\t\t\t\treturn offsetRef.current;\n\t\t\t}\n\n\t\t\tconst isTopBottomPlacement =\n\t\t\t\tcurrentPlacement.includes( 'top' ) ||\n\t\t\t\tcurrentPlacement.includes( 'bottom' );\n\n\t\t\t// The main axis should represent the gap between the\n\t\t\t// floating element and the reference element. The cross\n\t\t\t// axis is always perpendicular to the main axis.\n\t\t\tconst mainAxis = isTopBottomPlacement ? 'y' : 'x';\n\t\t\tconst crossAxis = mainAxis === 'x' ? 'y' : 'x';\n\n\t\t\t// When the popover is before the reference, subtract the offset,\n\t\t\t// of the main axis else add it.\n\t\t\tconst hasBeforePlacement =\n\t\t\t\tcurrentPlacement.includes( 'top' ) ||\n\t\t\t\tcurrentPlacement.includes( 'left' );\n\t\t\tconst mainAxisModifier = hasBeforePlacement ? -1 : 1;\n\n\t\t\treturn {\n\t\t\t\tmainAxis:\n\t\t\t\t\toffsetRef.current +\n\t\t\t\t\tframeOffsetRef.current[ mainAxis ] * mainAxisModifier,\n\t\t\t\tcrossAxis: frameOffsetRef.current[ crossAxis ],\n\t\t\t};\n\t\t} ),\n\t\tcomputedFlipProp ? flipMiddleware() : undefined,\n\t\tcomputedResizeProp\n\t\t\t? size( {\n\t\t\t\t\tapply( sizeProps ) {\n\t\t\t\t\t\tconst { firstElementChild } =\n\t\t\t\t\t\t\trefs.floating.current ?? {};\n\n\t\t\t\t\t\t// Only HTMLElement instances have the `style` property.\n\t\t\t\t\t\tif ( ! ( firstElementChild instanceof HTMLElement ) )\n\t\t\t\t\t\t\treturn;\n\n\t\t\t\t\t\t// Reduce the height of the popover to the available space.\n\t\t\t\t\t\tObject.assign( firstElementChild.style, {\n\t\t\t\t\t\t\tmaxHeight: `${ sizeProps.availableHeight }px`,\n\t\t\t\t\t\t\toverflow: 'auto',\n\t\t\t\t\t\t} );\n\t\t\t\t\t},\n\t\t\t } )\n\t\t\t: undefined,\n\t\tshouldShift\n\t\t\t? shiftMiddleware( {\n\t\t\t\t\tcrossAxis: true,\n\t\t\t\t\tlimiter: limitShift(),\n\t\t\t\t\tpadding: 1, // Necessary to avoid flickering at the edge of the viewport.\n\t\t\t } )\n\t\t\t: undefined,\n\t\tarrow( { element: arrowRef } ),\n\t].filter(\n\t\t( m: Middleware | undefined ): m is Middleware => m !== undefined\n\t);\n\tconst slotName = useContext( slotNameContext ) || __unstableSlotName;\n\tconst slot = useSlot( slotName );\n\n\tlet onDialogClose;\n\n\tif ( onClose || onFocusOutside ) {\n\t\tonDialogClose = ( type: string | undefined, event: SyntheticEvent ) => {\n\t\t\t// Ideally the popover should have just a single onClose prop and\n\t\t\t// not three props that potentially do the same thing.\n\t\t\tif ( type === 'focus-outside' && onFocusOutside ) {\n\t\t\t\tonFocusOutside( event );\n\t\t\t} else if ( onClose ) {\n\t\t\t\tonClose();\n\t\t\t}\n\t\t};\n\t}\n\n\tconst [ dialogRef, dialogProps ] = useDialog( {\n\t\tfocusOnMount,\n\t\t__unstableOnClose: onDialogClose,\n\t\t// @ts-expect-error The __unstableOnClose property needs to be deprecated first (see https://github.com/WordPress/gutenberg/pull/27675)\n\t\tonClose: onDialogClose,\n\t} );\n\n\tconst {\n\t\t// Positioning coordinates\n\t\tx,\n\t\ty,\n\t\t// Callback refs (not regular refs). This allows the position to be updated.\n\t\t// when either elements change.\n\t\treference: referenceCallbackRef,\n\t\tfloating,\n\t\t// Object with \"regular\" refs to both \"reference\" and \"floating\"\n\t\trefs,\n\t\t// Type of CSS position property to use (absolute or fixed)\n\t\tstrategy,\n\t\tupdate,\n\t\tplacement: computedPlacement,\n\t\tmiddlewareData: { arrow: arrowData },\n\t} = useFloating( {\n\t\tplacement: normalizedPlacementFromProps,\n\t\tmiddleware,\n\t\twhileElementsMounted: ( referenceParam, floatingParam, updateParam ) =>\n\t\t\tautoUpdate( referenceParam, floatingParam, updateParam, {\n\t\t\t\tanimationFrame: true,\n\t\t\t} ),\n\t} );\n\n\tuseEffect( () => {\n\t\toffsetRef.current = offsetProp;\n\t\tupdate();\n\t}, [ offsetProp, update ] );\n\n\tconst arrowCallbackRef = useCallback(\n\t\t( node ) => {\n\t\t\tarrowRef.current = node;\n\t\t\tupdate();\n\t\t},\n\t\t[ update ]\n\t);\n\n\t// When any of the possible anchor \"sources\" change,\n\t// recompute the reference element (real or virtual) and its owner document.\n\tuseLayoutEffect( () => {\n\t\tconst resultingReferenceOwnerDoc = getReferenceOwnerDocument( {\n\t\t\tanchorRef,\n\t\t\tanchorRect,\n\t\t\tgetAnchorRect,\n\t\t\tfallbackReferenceElement,\n\t\t\tfallbackDocument: document,\n\t\t} );\n\t\tconst resultingReferenceElement = getReferenceElement( {\n\t\t\tanchorRef,\n\t\t\tanchorRect,\n\t\t\tgetAnchorRect,\n\t\t\tfallbackReferenceElement,\n\t\t} );\n\n\t\treferenceCallbackRef( resultingReferenceElement );\n\n\t\tsetReferenceOwnerDocument( resultingReferenceOwnerDoc );\n\t}, [\n\t\tanchorRef as Element | undefined,\n\t\t( anchorRef as PopoverAnchorRefTopBottom | undefined )?.top,\n\t\t( anchorRef as PopoverAnchorRefTopBottom | undefined )?.bottom,\n\t\t( anchorRef as Range | undefined )?.startContainer,\n\t\t( anchorRef as PopoverAnchorRefReference )?.current,\n\t\tanchorRect,\n\t\tgetAnchorRect,\n\t\tfallbackReferenceElement,\n\t\treferenceCallbackRef,\n\t] );\n\n\t// If the reference element is in a different ownerDocument (e.g. iFrame),\n\t// we need to manually update the floating's position as the reference's owner\n\t// document scrolls. Also update the frame offset if the view resizes.\n\tuseLayoutEffect( () => {\n\t\tif (\n\t\t\t// Reference and root documents are the same.\n\t\t\treferenceOwnerDocument === document ||\n\t\t\t// Reference and floating are in the same document.\n\t\t\treferenceOwnerDocument === refs?.floating?.current?.ownerDocument ||\n\t\t\t// The reference's document has no view (i.e. window)\n\t\t\t// or frame element (ie. it's not an iframe).\n\t\t\t! referenceOwnerDocument?.defaultView?.frameElement\n\t\t) {\n\t\t\tframeOffsetRef.current = undefined;\n\t\t\treturn;\n\t\t}\n\n\t\tconst { defaultView } = referenceOwnerDocument;\n\n\t\tconst updateFrameOffset = () => {\n\t\t\tframeOffsetRef.current = getFrameOffset( referenceOwnerDocument );\n\t\t\tupdate();\n\t\t};\n\t\tdefaultView.addEventListener( 'resize', updateFrameOffset );\n\n\t\tupdateFrameOffset();\n\n\t\treturn () => {\n\t\t\tdefaultView.removeEventListener( 'resize', updateFrameOffset );\n\t\t};\n\t}, [ referenceOwnerDocument, update ] );\n\n\tconst mergedFloatingRef = useMergeRefs( [\n\t\tfloating,\n\t\tdialogRef,\n\t\tforwardedRef,\n\t] );\n\n\t// Disable reason: We care to capture the _bubbled_ events from inputs\n\t// within popover as inferring close intent.\n\n\tlet content = (\n\t\t// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<AnimatedWrapper\n\t\t\tshouldAnimate={ animate && ! isExpanded }\n\t\t\tplacement={ computedPlacement }\n\t\t\tclassName={ classnames( 'components-popover', className, {\n\t\t\t\t'is-expanded': isExpanded,\n\t\t\t\t'is-alternate': isAlternate,\n\t\t\t} ) }\n\t\t\t{ ...contentProps }\n\t\t\tref={ mergedFloatingRef }\n\t\t\t{ ...dialogProps }\n\t\t\ttabIndex={ -1 }\n\t\t\tstyle={\n\t\t\t\tisExpanded\n\t\t\t\t\t? undefined\n\t\t\t\t\t: {\n\t\t\t\t\t\t\tposition: strategy,\n\t\t\t\t\t\t\tleft: Number.isNaN( x ) ? 0 : x ?? undefined,\n\t\t\t\t\t\t\ttop: Number.isNaN( y ) ? 0 : y ?? undefined,\n\t\t\t\t\t }\n\t\t\t}\n\t\t>\n\t\t\t{ /* Prevents scroll on the document */ }\n\t\t\t{ isExpanded && <ScrollLock /> }\n\t\t\t{ isExpanded && (\n\t\t\t\t<div className=\"components-popover__header\">\n\t\t\t\t\t<span className=\"components-popover__header-title\">\n\t\t\t\t\t\t{ headerTitle }\n\t\t\t\t\t</span>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName=\"components-popover__close\"\n\t\t\t\t\t\ticon={ close }\n\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<div className=\"components-popover__content\">{ children }</div>\n\t\t\t{ hasArrow && (\n\t\t\t\t<div\n\t\t\t\t\tref={ arrowCallbackRef }\n\t\t\t\t\tclassName={ [\n\t\t\t\t\t\t'components-popover__arrow',\n\t\t\t\t\t\t`is-${ computedPlacement.split( '-' )[ 0 ] }`,\n\t\t\t\t\t].join( ' ' ) }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\tleft:\n\t\t\t\t\t\t\ttypeof arrowData?.x !== 'undefined' &&\n\t\t\t\t\t\t\tNumber.isFinite( arrowData.x )\n\t\t\t\t\t\t\t\t? `${\n\t\t\t\t\t\t\t\t\t\tarrowData.x +\n\t\t\t\t\t\t\t\t\t\t( frameOffsetRef.current?.x ?? 0 )\n\t\t\t\t\t\t\t\t }px`\n\t\t\t\t\t\t\t\t: '',\n\t\t\t\t\t\ttop:\n\t\t\t\t\t\t\ttypeof arrowData?.y !== 'undefined' &&\n\t\t\t\t\t\t\tNumber.isFinite( arrowData.y )\n\t\t\t\t\t\t\t\t? `${\n\t\t\t\t\t\t\t\t\t\tarrowData.y +\n\t\t\t\t\t\t\t\t\t\t( frameOffsetRef.current?.y ?? 0 )\n\t\t\t\t\t\t\t\t }px`\n\t\t\t\t\t\t\t\t: '',\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<ArrowTriangle />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</AnimatedWrapper>\n\t);\n\n\tif ( slot.ref ) {\n\t\tcontent = <Fill name={ slotName }>{ content }</Fill>;\n\t}\n\n\tif ( anchorRef || anchorRect ) {\n\t\treturn content;\n\t}\n\n\treturn <span ref={ anchorRefFallback }>{ content }</span>;\n};\n\n/**\n * `Popover` renders its content in a floating modal. If no explicit anchor is passed via props, it anchors to its parent element by default.\n *\n * ```jsx\n * import { Button, Popover } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyPopover = () => {\n * \tconst [ isVisible, setIsVisible ] = useState( false );\n * \tconst toggleVisible = () => {\n * \t\tsetIsVisible( ( state ) => ! state );\n * \t};\n *\n * \treturn (\n * \t\t<Button variant=\"secondary\" onClick={ toggleVisible }>\n * \t\t\tToggle Popover!\n * \t\t\t{ isVisible && <Popover>Popover is toggled!</Popover> }\n * \t\t</Button>\n * \t);\n * };\n * ```\n *\n */\nexport const Popover = forwardRef( UnforwardedPopover );\n\nfunction PopoverSlot(\n\t{ name = SLOT_NAME }: { name?: string },\n\tref: ForwardedRef< any >\n) {\n\treturn (\n\t\t<Slot\n\t\t\t// @ts-expect-error Need to type `SlotFill`\n\t\t\tbubblesVirtually\n\t\t\tname={ name }\n\t\t\tclassName=\"popover-slot\"\n\t\t\tref={ ref }\n\t\t/>\n\t);\n}\n\n// @ts-expect-error For Legacy Reasons\nPopover.Slot = forwardRef( PopoverSlot );\n// @ts-expect-error For Legacy Reasons\nPopover.__unstableSlotNameProvider = slotNameContext.Provider;\n\nexport default Popover;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
package/build/popover/utils.js
CHANGED
|
@@ -3,20 +3,23 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.positionToPlacement = exports.placementToMotionAnimationProps = exports.getFrameOffset = void 0;
|
|
6
|
+
exports.positionToPlacement = exports.placementToMotionAnimationProps = exports.getReferenceOwnerDocument = exports.getReferenceElement = exports.getFrameOffset = void 0;
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
* External dependencies
|
|
10
|
+
*/
|
|
11
|
+
// eslint-disable-next-line no-restricted-imports
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Internal dependencies
|
|
12
15
|
*/
|
|
13
16
|
|
|
14
17
|
/**
|
|
15
18
|
* Converts the `Popover`'s legacy "position" prop to the new "placement" prop
|
|
16
19
|
* (used by `floating-ui`).
|
|
17
20
|
*
|
|
18
|
-
* @param
|
|
19
|
-
* @return
|
|
21
|
+
* @param position The legacy position
|
|
22
|
+
* @return The corresponding placement
|
|
20
23
|
*/
|
|
21
24
|
const positionToPlacement = position => {
|
|
22
25
|
const [x, y, z] = position.split(' ');
|
|
@@ -28,12 +31,10 @@ const positionToPlacement = position => {
|
|
|
28
31
|
suffix = '-start';
|
|
29
32
|
} else if (!!z && z === 'right' || y === 'left') {
|
|
30
33
|
suffix = '-end';
|
|
31
|
-
}
|
|
32
|
-
|
|
34
|
+
}
|
|
33
35
|
|
|
34
36
|
return x + suffix;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
+
}
|
|
37
38
|
|
|
38
39
|
return y;
|
|
39
40
|
};
|
|
@@ -44,8 +45,6 @@ const positionToPlacement = position => {
|
|
|
44
45
|
* @property {number} originY A number between 0 and 1 (0 is top, 0.5 is center, and 1 is bottom)
|
|
45
46
|
*/
|
|
46
47
|
|
|
47
|
-
/** @type {Object.<FloatingUIPlacement, {originX: number, originY: number}>} */
|
|
48
|
-
|
|
49
48
|
|
|
50
49
|
exports.positionToPlacement = positionToPlacement;
|
|
51
50
|
const PLACEMENT_TO_ANIMATION_ORIGIN = {
|
|
@@ -114,8 +113,8 @@ const PLACEMENT_TO_ANIMATION_ORIGIN = {
|
|
|
114
113
|
* Given the floating-ui `placement`, compute the framer-motion props for the
|
|
115
114
|
* popover's entry animation.
|
|
116
115
|
*
|
|
117
|
-
* @param
|
|
118
|
-
* @return
|
|
116
|
+
* @param placement A placement string from floating ui
|
|
117
|
+
* @return The object containing the motion props
|
|
119
118
|
*/
|
|
120
119
|
|
|
121
120
|
const placementToMotionAnimationProps = placement => {
|
|
@@ -139,20 +138,13 @@ const placementToMotionAnimationProps = placement => {
|
|
|
139
138
|
}
|
|
140
139
|
};
|
|
141
140
|
};
|
|
142
|
-
/**
|
|
143
|
-
* @typedef FrameOffset
|
|
144
|
-
* @type {Object}
|
|
145
|
-
* @property {number} x A numerical value representing the horizontal offset of the frame.
|
|
146
|
-
* @property {number} y A numerical value representing the vertical offset of the frame.
|
|
147
|
-
*/
|
|
148
|
-
|
|
149
141
|
/**
|
|
150
142
|
* Returns the offset of a document's frame element.
|
|
151
143
|
*
|
|
152
|
-
* @param
|
|
144
|
+
* @param document The iframe's owner document.
|
|
153
145
|
*
|
|
154
|
-
* @return
|
|
155
|
-
*
|
|
146
|
+
* @return The offset of the document's frame element, or undefined if the
|
|
147
|
+
* document has no frame element.
|
|
156
148
|
*/
|
|
157
149
|
|
|
158
150
|
|
|
@@ -175,4 +167,107 @@ const getFrameOffset = document => {
|
|
|
175
167
|
};
|
|
176
168
|
|
|
177
169
|
exports.getFrameOffset = getFrameOffset;
|
|
170
|
+
|
|
171
|
+
const getReferenceOwnerDocument = _ref => {
|
|
172
|
+
var _resultingReferenceOw;
|
|
173
|
+
|
|
174
|
+
let {
|
|
175
|
+
anchorRef,
|
|
176
|
+
anchorRect,
|
|
177
|
+
getAnchorRect,
|
|
178
|
+
fallbackReferenceElement,
|
|
179
|
+
fallbackDocument
|
|
180
|
+
} = _ref;
|
|
181
|
+
// In floating-ui's terms:
|
|
182
|
+
// - "reference" refers to the popover's anchor element.
|
|
183
|
+
// - "floating" refers the floating popover's element.
|
|
184
|
+
// A floating element can also be positioned relative to a virtual element,
|
|
185
|
+
// instead of a real one. A virtual element is represented by an object
|
|
186
|
+
// with the `getBoundingClientRect()` function (like real elements).
|
|
187
|
+
// See https://floating-ui.com/docs/virtual-elements for more info.
|
|
188
|
+
let resultingReferenceOwnerDoc;
|
|
189
|
+
|
|
190
|
+
if (anchorRef !== null && anchorRef !== void 0 && anchorRef.top) {
|
|
191
|
+
resultingReferenceOwnerDoc = anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.top.ownerDocument;
|
|
192
|
+
} else if (anchorRef !== null && anchorRef !== void 0 && anchorRef.startContainer) {
|
|
193
|
+
resultingReferenceOwnerDoc = anchorRef.startContainer.ownerDocument;
|
|
194
|
+
} else if (anchorRef !== null && anchorRef !== void 0 && anchorRef.current) {
|
|
195
|
+
resultingReferenceOwnerDoc = anchorRef.current.ownerDocument;
|
|
196
|
+
} else if (anchorRef) {
|
|
197
|
+
// This one should be deprecated.
|
|
198
|
+
resultingReferenceOwnerDoc = anchorRef.ownerDocument;
|
|
199
|
+
} else if (anchorRect && anchorRect !== null && anchorRect !== void 0 && anchorRect.ownerDocument) {
|
|
200
|
+
resultingReferenceOwnerDoc = anchorRect.ownerDocument;
|
|
201
|
+
} else if (getAnchorRect) {
|
|
202
|
+
var _getAnchorRect;
|
|
203
|
+
|
|
204
|
+
resultingReferenceOwnerDoc = (_getAnchorRect = getAnchorRect(fallbackReferenceElement)) === null || _getAnchorRect === void 0 ? void 0 : _getAnchorRect.ownerDocument;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
return (_resultingReferenceOw = resultingReferenceOwnerDoc) !== null && _resultingReferenceOw !== void 0 ? _resultingReferenceOw : fallbackDocument;
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
exports.getReferenceOwnerDocument = getReferenceOwnerDocument;
|
|
211
|
+
|
|
212
|
+
const getReferenceElement = _ref2 => {
|
|
213
|
+
var _referenceElement;
|
|
214
|
+
|
|
215
|
+
let {
|
|
216
|
+
anchorRef,
|
|
217
|
+
anchorRect,
|
|
218
|
+
getAnchorRect,
|
|
219
|
+
fallbackReferenceElement
|
|
220
|
+
} = _ref2;
|
|
221
|
+
let referenceElement = null;
|
|
222
|
+
|
|
223
|
+
if (anchorRef !== null && anchorRef !== void 0 && anchorRef.top) {
|
|
224
|
+
// Create a virtual element for the ref. The expectation is that
|
|
225
|
+
// if anchorRef.top is defined, then anchorRef.bottom is defined too.
|
|
226
|
+
// Seems to be used by the block toolbar, when multiple blocks are selected
|
|
227
|
+
// (top and bottom blocks are used to calculate the resulting rect).
|
|
228
|
+
referenceElement = {
|
|
229
|
+
getBoundingClientRect() {
|
|
230
|
+
const topRect = anchorRef.top.getBoundingClientRect();
|
|
231
|
+
const bottomRect = anchorRef.bottom.getBoundingClientRect();
|
|
232
|
+
return new window.DOMRect(topRect.x, topRect.y, topRect.width, bottomRect.bottom - topRect.top);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
};
|
|
236
|
+
} else if (anchorRef !== null && anchorRef !== void 0 && anchorRef.current) {
|
|
237
|
+
// Standard React ref.
|
|
238
|
+
referenceElement = anchorRef.current;
|
|
239
|
+
} else if (anchorRef) {
|
|
240
|
+
// If `anchorRef` holds directly the element's value (no `current` key)
|
|
241
|
+
// This is a weird scenario and should be deprecated.
|
|
242
|
+
referenceElement = anchorRef;
|
|
243
|
+
} else if (anchorRect) {
|
|
244
|
+
// Create a virtual element for the ref.
|
|
245
|
+
referenceElement = {
|
|
246
|
+
getBoundingClientRect() {
|
|
247
|
+
return anchorRect;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
};
|
|
251
|
+
} else if (getAnchorRect) {
|
|
252
|
+
// Create a virtual element for the ref.
|
|
253
|
+
referenceElement = {
|
|
254
|
+
getBoundingClientRect() {
|
|
255
|
+
var _rect$x, _rect$y, _rect$width, _rect$height;
|
|
256
|
+
|
|
257
|
+
const rect = getAnchorRect(fallbackReferenceElement);
|
|
258
|
+
return new window.DOMRect((_rect$x = rect.x) !== null && _rect$x !== void 0 ? _rect$x : rect.left, (_rect$y = rect.y) !== null && _rect$y !== void 0 ? _rect$y : rect.top, (_rect$width = rect.width) !== null && _rect$width !== void 0 ? _rect$width : rect.right - rect.left, (_rect$height = rect.height) !== null && _rect$height !== void 0 ? _rect$height : rect.bottom - rect.top);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
};
|
|
262
|
+
} else if (fallbackReferenceElement) {
|
|
263
|
+
// If no explicit ref is passed via props, fall back to
|
|
264
|
+
// anchoring to the popover's parent node.
|
|
265
|
+
referenceElement = fallbackReferenceElement.parentElement;
|
|
266
|
+
} // Convert any `undefined` value to `null`.
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
return (_referenceElement = referenceElement) !== null && _referenceElement !== void 0 ? _referenceElement : null;
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
exports.getReferenceElement = getReferenceElement;
|
|
178
273
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/popover/utils.js"],"names":["positionToPlacement","position","x","y","z","split","includes","suffix","PLACEMENT_TO_ANIMATION_ORIGIN","top","originX","originY","right","bottom","left","placementToMotionAnimationProps","placement","translateProp","startsWith","translateDirection","style","initial","opacity","scale","animate","transition","duration","ease","getFrameOffset","document","frameElement","defaultView","iframeRect","getBoundingClientRect"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,mBAAmB,GAAKC,QAAF,IAAgB;AAClD,QAAM,CAAEC,CAAF,EAAKC,CAAL,EAAQC,CAAR,IAAcH,QAAQ,CAACI,KAAT,CAAgB,GAAhB,CAApB;;AAEA,MAAK,CAAE,KAAF,EAAS,QAAT,EAAoBC,QAApB,CAA8BJ,CAA9B,CAAL,EAAyC;AACxC,QAAIK,MAAM,GAAG,EAAb;;AACA,QAAO,CAAC,CAAEH,CAAH,IAAQA,CAAC,KAAK,MAAhB,IAA4BD,CAAC,KAAK,OAAvC,EAAiD;AAChDI,MAAAA,MAAM,GAAG,QAAT;AACA,KAFD,MAEO,IAAO,CAAC,CAAEH,CAAH,IAAQA,CAAC,KAAK,OAAhB,IAA6BD,CAAC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BAAuBD,YAA5C;;AACA,MAAK,CAAEA,YAAP,EAAsB;AACrB;AACA;;AACD,QAAME,UAAU,GAAGF,YAAY,CAACG,qBAAb,EAAnB;AACA,SAAO;AAAE/B,IAAAA,CAAC,EAAE8B,UAAU,CAAClB,IAAhB;AAAsBX,IAAAA,CAAC,EAAE6B,UAAU,CAACvB;AAApC,GAAP;AACA,CAPM","sourcesContent":["/**\n * @typedef {import('../animate').AppearOrigin} AppearOrigin\n * @typedef {import('@floating-ui/react-dom').Placement} FloatingUIPlacement\n * @typedef {\t'top left' | 'top center' | 'top right' | 'middle left' | 'middle center' | 'middle right' | 'bottom left' | 'bottom center' | 'bottom right' | 'bottom left' | 'bottom center' | 'bottom right' } LegacyPosition\n */\n\n/**\n * Converts the `Popover`'s legacy \"position\" prop to the new \"placement\" prop\n * (used by `floating-ui`).\n *\n * @param {LegacyPosition} position The legacy position\n * @return {FloatingUIPlacement} The corresponding placement\n */\nexport const positionToPlacement = ( position ) => {\n\tconst [ x, y, z ] = position.split( ' ' );\n\n\tif ( [ 'top', 'bottom' ].includes( x ) ) {\n\t\tlet suffix = '';\n\t\tif ( ( !! z && z === 'left' ) || y === 'right' ) {\n\t\t\tsuffix = '-start';\n\t\t} else if ( ( !! z && z === 'right' ) || y === 'left' ) {\n\t\t\tsuffix = '-end';\n\t\t}\n\n\t\t// @ts-expect-error More TypeScript effort would be required to reconcile `string` and `Placement` types.\n\t\treturn x + suffix;\n\t}\n\n\t// @ts-expect-error More TypeScript effort would be required to reconcile `string` and `Placement` types.\n\treturn y;\n};\n\n/**\n * @typedef AnimationOrigin\n * @type {Object}\n * @property {number} originX A number between 0 and 1 (in CSS logical properties jargon, 0 is \"start\", 0.5 is \"center\", and 1 is \"end\")\n * @property {number} originY A number between 0 and 1 (0 is top, 0.5 is center, and 1 is bottom)\n */\n\n/** @type {Object.<FloatingUIPlacement, {originX: number, originY: number}>} */\nconst PLACEMENT_TO_ANIMATION_ORIGIN = {\n\ttop: { originX: 0.5, originY: 1 }, // open from bottom, center\n\t'top-start': { originX: 0, originY: 1 }, // open from bottom, left\n\t'top-end': { originX: 1, originY: 1 }, // open from bottom, right\n\tright: { originX: 0, originY: 0.5 }, // open from middle, left\n\t'right-start': { originX: 0, originY: 0 }, // open from top, left\n\t'right-end': { originX: 0, originY: 1 }, // open from bottom, left\n\tbottom: { originX: 0.5, originY: 0 }, // open from top, center\n\t'bottom-start': { originX: 0, originY: 0 }, // open from top, left\n\t'bottom-end': { originX: 1, originY: 0 }, // open from top, right\n\tleft: { originX: 1, originY: 0.5 }, // open from middle, right\n\t'left-start': { originX: 1, originY: 0 }, // open from top, right\n\t'left-end': { originX: 1, originY: 1 }, // open from bottom, right\n};\n\n/**\n * Given the floating-ui `placement`, compute the framer-motion props for the\n * popover's entry animation.\n *\n * @param {FloatingUIPlacement} placement A placement string from floating ui\n * @return {import('framer-motion').MotionProps} The object containing the motion props\n */\nexport const placementToMotionAnimationProps = ( placement ) => {\n\tconst translateProp =\n\t\tplacement.startsWith( 'top' ) || placement.startsWith( 'bottom' )\n\t\t\t? 'translateY'\n\t\t\t: 'translateX';\n\tconst translateDirection =\n\t\tplacement.startsWith( 'top' ) || placement.startsWith( 'left' )\n\t\t\t? 1\n\t\t\t: -1;\n\n\treturn {\n\t\tstyle: PLACEMENT_TO_ANIMATION_ORIGIN[ placement ],\n\t\tinitial: {\n\t\t\topacity: 0,\n\t\t\tscale: 0,\n\t\t\t[ translateProp ]: `${ 2 * translateDirection }em`,\n\t\t},\n\t\tanimate: { opacity: 1, scale: 1, [ translateProp ]: 0 },\n\t\ttransition: { duration: 0.1, ease: [ 0, 0, 0.2, 1 ] },\n\t};\n};\n\n/**\n * @typedef FrameOffset\n * @type {Object}\n * @property {number} x A numerical value representing the horizontal offset of the frame.\n * @property {number} y A numerical value representing the vertical offset of the frame.\n */\n\n/**\n * Returns the offset of a document's frame element.\n *\n * @param {Document} document A document. This will usually be the document within an iframe.\n *\n * @return {FrameOffset|undefined} The offset of the document's frame element,\n * or undefined if the document has no frame element.\n */\nexport const getFrameOffset = ( document ) => {\n\tconst frameElement = document?.defaultView?.frameElement;\n\tif ( ! frameElement ) {\n\t\treturn;\n\t}\n\tconst iframeRect = frameElement.getBoundingClientRect();\n\treturn { x: iframeRect.left, y: iframeRect.top };\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/popover/utils.ts"],"names":["positionToPlacement","position","x","y","z","split","includes","suffix","PLACEMENT_TO_ANIMATION_ORIGIN","top","originX","originY","right","bottom","left","placementToMotionAnimationProps","placement","translateProp","startsWith","translateDirection","style","initial","opacity","scale","animate","transition","duration","ease","getFrameOffset","document","frameElement","defaultView","iframeRect","getBoundingClientRect","getReferenceOwnerDocument","anchorRef","anchorRect","getAnchorRect","fallbackReferenceElement","fallbackDocument","resultingReferenceOwnerDoc","ownerDocument","startContainer","current","getReferenceElement","referenceElement","topRect","bottomRect","window","DOMRect","width","rect","height","parentElement"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;;AAIA;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,mBAAmB,GAC/BC,QADkC,IAEc;AAChD,QAAM,CAAEC,CAAF,EAAKC,CAAL,EAAQC,CAAR,IAAcH,QAAQ,CAACI,KAAT,CAAgB,GAAhB,CAApB;;AAEA,MAAK,CAAE,KAAF,EAAS,QAAT,EAAoBC,QAApB,CAA8BJ,CAA9B,CAAL,EAAyC;AACxC,QAAIK,MAAM,GAAG,EAAb;;AACA,QAAO,CAAC,CAAEH,CAAH,IAAQA,CAAC,KAAK,MAAhB,IAA4BD,CAAC,KAAK,OAAvC,EAAiD;AAChDI,MAAAA,MAAM,GAAG,QAAT;AACA,KAFD,MAEO,IAAO,CAAC,CAAEH,CAAH,IAAQA,CAAC,KAAK,OAAhB,IAA6BD,CAAC,KAAK,MAAxC,EAAiD;AACvDI,MAAAA,MAAM,GAAG,MAAT;AACA;;AAED,WAASL,CAAC,GAAGK,MAAb;AACA;;AA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AACrC,IADT,aAENqC,IAAI,CAAChD,CAFC,6CAEIgD,IAAI,CAAC1C,GAFT,iBAGN0C,IAAI,CAACD,KAHC,qDAGQC,IAAI,CAACvC,KAAL,GAAauC,IAAI,CAACrC,IAH1B,kBAINqC,IAAI,CAACC,MAJC,uDAISD,IAAI,CAACtC,MAAL,GAAcsC,IAAI,CAAC1C,GAJ5B,CAAP;AAMA;;AATiB,KAAnB;AAWA,GAbM,MAaA,IAAK6B,wBAAL,EAAgC;AACtC;AACA;AACAO,IAAAA,gBAAgB,GAAGP,wBAAwB,CAACe,aAA5C;AACA,GAzD2B,CA2D5B;;;AACA,8BAAOR,gBAAP,iEAA2B,IAA3B;AACA,CApEM","sourcesContent":["/**\n * External dependencies\n */\n// eslint-disable-next-line no-restricted-imports\nimport type { MotionProps } from 'framer-motion';\nimport type { ReferenceType } from '@floating-ui/react-dom';\n\n/**\n * Internal dependencies\n */\nimport type {\n\tPopoverProps,\n\tPopoverAnchorRefReference,\n\tPopoverAnchorRefTopBottom,\n} from './types';\n\n/**\n * Converts the `Popover`'s legacy \"position\" prop to the new \"placement\" prop\n * (used by `floating-ui`).\n *\n * @param position The legacy position\n * @return The corresponding placement\n */\nexport const positionToPlacement = (\n\tposition: NonNullable< PopoverProps[ 'position' ] >\n): NonNullable< PopoverProps[ 'placement' ] > => {\n\tconst [ x, y, z ] = position.split( ' ' );\n\n\tif ( [ 'top', 'bottom' ].includes( x ) ) {\n\t\tlet suffix = '';\n\t\tif ( ( !! z && z === 'left' ) || y === 'right' ) {\n\t\t\tsuffix = '-start';\n\t\t} else if ( ( !! z && z === 'right' ) || y === 'left' ) {\n\t\t\tsuffix = '-end';\n\t\t}\n\n\t\treturn ( x + suffix ) as NonNullable< PopoverProps[ 'placement' ] >;\n\t}\n\n\treturn y as NonNullable< PopoverProps[ 'placement' ] >;\n};\n\n/**\n * @typedef AnimationOrigin\n * @type {Object}\n * @property {number} originX A number between 0 and 1 (in CSS logical properties jargon, 0 is \"start\", 0.5 is \"center\", and 1 is \"end\")\n * @property {number} originY A number between 0 and 1 (0 is top, 0.5 is center, and 1 is bottom)\n */\n\nconst PLACEMENT_TO_ANIMATION_ORIGIN: Record<\n\tNonNullable< PopoverProps[ 'placement' ] >,\n\t{ originX: number; originY: number }\n> = {\n\ttop: { originX: 0.5, originY: 1 }, // open from bottom, center\n\t'top-start': { originX: 0, originY: 1 }, // open from bottom, left\n\t'top-end': { originX: 1, originY: 1 }, // open from bottom, right\n\tright: { originX: 0, originY: 0.5 }, // open from middle, left\n\t'right-start': { originX: 0, originY: 0 }, // open from top, left\n\t'right-end': { originX: 0, originY: 1 }, // open from bottom, left\n\tbottom: { originX: 0.5, originY: 0 }, // open from top, center\n\t'bottom-start': { originX: 0, originY: 0 }, // open from top, left\n\t'bottom-end': { originX: 1, originY: 0 }, // open from top, right\n\tleft: { originX: 1, originY: 0.5 }, // open from middle, right\n\t'left-start': { originX: 1, originY: 0 }, // open from top, right\n\t'left-end': { originX: 1, originY: 1 }, // open from bottom, right\n};\n\n/**\n * Given the floating-ui `placement`, compute the framer-motion props for the\n * popover's entry animation.\n *\n * @param placement A placement string from floating ui\n * @return The object containing the motion props\n */\nexport const placementToMotionAnimationProps = (\n\tplacement: NonNullable< PopoverProps[ 'placement' ] >\n): MotionProps => {\n\tconst translateProp =\n\t\tplacement.startsWith( 'top' ) || placement.startsWith( 'bottom' )\n\t\t\t? 'translateY'\n\t\t\t: 'translateX';\n\tconst translateDirection =\n\t\tplacement.startsWith( 'top' ) || placement.startsWith( 'left' )\n\t\t\t? 1\n\t\t\t: -1;\n\n\treturn {\n\t\tstyle: PLACEMENT_TO_ANIMATION_ORIGIN[ placement ],\n\t\tinitial: {\n\t\t\topacity: 0,\n\t\t\tscale: 0,\n\t\t\t[ translateProp ]: `${ 2 * translateDirection }em`,\n\t\t},\n\t\tanimate: { opacity: 1, scale: 1, [ translateProp ]: 0 },\n\t\ttransition: { duration: 0.1, ease: [ 0, 0, 0.2, 1 ] },\n\t};\n};\n\n/**\n * Returns the offset of a document's frame element.\n *\n * @param document The iframe's owner document.\n *\n * @return The offset of the document's frame element, or undefined if the\n * document has no frame element.\n */\nexport const getFrameOffset = (\n\tdocument?: Document\n): { x: number; y: number } | undefined => {\n\tconst frameElement = document?.defaultView?.frameElement;\n\tif ( ! frameElement ) {\n\t\treturn;\n\t}\n\tconst iframeRect = frameElement.getBoundingClientRect();\n\treturn { x: iframeRect.left, y: iframeRect.top };\n};\n\nexport const getReferenceOwnerDocument = ( {\n\tanchorRef,\n\tanchorRect,\n\tgetAnchorRect,\n\tfallbackReferenceElement,\n\tfallbackDocument,\n}: Pick< PopoverProps, 'anchorRef' | 'anchorRect' | 'getAnchorRect' > & {\n\tfallbackReferenceElement: Element | null;\n\tfallbackDocument: Document;\n} ): Document => {\n\t// In floating-ui's terms:\n\t// - \"reference\" refers to the popover's anchor element.\n\t// - \"floating\" refers the floating popover's element.\n\t// A floating element can also be positioned relative to a virtual element,\n\t// instead of a real one. A virtual element is represented by an object\n\t// with the `getBoundingClientRect()` function (like real elements).\n\t// See https://floating-ui.com/docs/virtual-elements for more info.\n\tlet resultingReferenceOwnerDoc;\n\tif ( ( anchorRef as PopoverAnchorRefTopBottom | undefined )?.top ) {\n\t\tresultingReferenceOwnerDoc = ( anchorRef as PopoverAnchorRefTopBottom )\n\t\t\t?.top.ownerDocument;\n\t} else if ( ( anchorRef as Range | undefined )?.startContainer ) {\n\t\tresultingReferenceOwnerDoc = ( anchorRef as Range ).startContainer\n\t\t\t.ownerDocument;\n\t} else if (\n\t\t( anchorRef as PopoverAnchorRefReference | undefined )?.current\n\t) {\n\t\tresultingReferenceOwnerDoc = (\n\t\t\t( anchorRef as PopoverAnchorRefReference ).current as Element\n\t\t ).ownerDocument;\n\t} else if ( anchorRef as Element | undefined ) {\n\t\t// This one should be deprecated.\n\t\tresultingReferenceOwnerDoc = ( anchorRef as Element ).ownerDocument;\n\t} else if ( anchorRect && anchorRect?.ownerDocument ) {\n\t\tresultingReferenceOwnerDoc = anchorRect.ownerDocument;\n\t} else if ( getAnchorRect ) {\n\t\tresultingReferenceOwnerDoc = getAnchorRect(\n\t\t\tfallbackReferenceElement\n\t\t)?.ownerDocument;\n\t}\n\n\treturn resultingReferenceOwnerDoc ?? fallbackDocument;\n};\n\nexport const getReferenceElement = ( {\n\tanchorRef,\n\tanchorRect,\n\tgetAnchorRect,\n\tfallbackReferenceElement,\n}: Pick< PopoverProps, 'anchorRef' | 'anchorRect' | 'getAnchorRect' > & {\n\tfallbackReferenceElement: Element | null;\n} ): ReferenceType | null => {\n\tlet referenceElement = null;\n\n\tif ( ( anchorRef as PopoverAnchorRefTopBottom | undefined )?.top ) {\n\t\t// Create a virtual element for the ref. The expectation is that\n\t\t// if anchorRef.top is defined, then anchorRef.bottom is defined too.\n\t\t// Seems to be used by the block toolbar, when multiple blocks are selected\n\t\t// (top and bottom blocks are used to calculate the resulting rect).\n\t\treferenceElement = {\n\t\t\tgetBoundingClientRect() {\n\t\t\t\tconst topRect = (\n\t\t\t\t\tanchorRef as PopoverAnchorRefTopBottom\n\t\t\t\t ).top.getBoundingClientRect();\n\t\t\t\tconst bottomRect = (\n\t\t\t\t\tanchorRef as PopoverAnchorRefTopBottom\n\t\t\t\t ).bottom.getBoundingClientRect();\n\t\t\t\treturn new window.DOMRect(\n\t\t\t\t\ttopRect.x,\n\t\t\t\t\ttopRect.y,\n\t\t\t\t\ttopRect.width,\n\t\t\t\t\tbottomRect.bottom - topRect.top\n\t\t\t\t);\n\t\t\t},\n\t\t};\n\t} else if (\n\t\t( anchorRef as PopoverAnchorRefReference | undefined )?.current\n\t) {\n\t\t// Standard React ref.\n\t\treferenceElement = ( anchorRef as PopoverAnchorRefReference ).current;\n\t} else if ( anchorRef as Element | undefined ) {\n\t\t// If `anchorRef` holds directly the element's value (no `current` key)\n\t\t// This is a weird scenario and should be deprecated.\n\t\treferenceElement = anchorRef as Element;\n\t} else if ( anchorRect ) {\n\t\t// Create a virtual element for the ref.\n\t\treferenceElement = {\n\t\t\tgetBoundingClientRect() {\n\t\t\t\treturn anchorRect;\n\t\t\t},\n\t\t};\n\t} else if ( getAnchorRect ) {\n\t\t// Create a virtual element for the ref.\n\t\treferenceElement = {\n\t\t\tgetBoundingClientRect() {\n\t\t\t\tconst rect = getAnchorRect( fallbackReferenceElement );\n\t\t\t\treturn new window.DOMRect(\n\t\t\t\t\trect.x ?? rect.left,\n\t\t\t\t\trect.y ?? rect.top,\n\t\t\t\t\trect.width ?? rect.right - rect.left,\n\t\t\t\t\trect.height ?? rect.bottom - rect.top\n\t\t\t\t);\n\t\t\t},\n\t\t};\n\t} else if ( fallbackReferenceElement ) {\n\t\t// If no explicit ref is passed via props, fall back to\n\t\t// anchoring to the popover's parent node.\n\t\treferenceElement = fallbackReferenceElement.parentElement;\n\t}\n\n\t// Convert any `undefined` value to `null`.\n\treturn referenceElement ?? null;\n};\n"]}
|
|
@@ -18,6 +18,8 @@ var _compose = require("@wordpress/compose");
|
|
|
18
18
|
|
|
19
19
|
var _baseControl = _interopRequireDefault(require("../base-control"));
|
|
20
20
|
|
|
21
|
+
var _vStack = require("../v-stack");
|
|
22
|
+
|
|
21
23
|
/**
|
|
22
24
|
* External dependencies
|
|
23
25
|
*/
|
|
@@ -55,9 +57,7 @@ var _baseControl = _interopRequireDefault(require("../base-control"));
|
|
|
55
57
|
* };
|
|
56
58
|
* ```
|
|
57
59
|
*/
|
|
58
|
-
function RadioControl(
|
|
59
|
-
// ref forwarding to RadioControl.
|
|
60
|
-
props) {
|
|
60
|
+
function RadioControl(props) {
|
|
61
61
|
const {
|
|
62
62
|
label,
|
|
63
63
|
className,
|
|
@@ -78,11 +78,14 @@ props) {
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
return (0, _element.createElement)(_baseControl.default, {
|
|
81
|
+
__nextHasNoMarginBottom: true,
|
|
81
82
|
label: label,
|
|
82
83
|
id: id,
|
|
83
84
|
hideLabelFromVision: hideLabelFromVision,
|
|
84
85
|
help: help,
|
|
85
86
|
className: (0, _classnames.default)(className, 'components-radio-control')
|
|
87
|
+
}, (0, _element.createElement)(_vStack.VStack, {
|
|
88
|
+
spacing: 1
|
|
86
89
|
}, options.map((option, index) => (0, _element.createElement)("div", {
|
|
87
90
|
key: `${id}-${index}`,
|
|
88
91
|
className: "components-radio-control__option"
|
|
@@ -97,7 +100,7 @@ props) {
|
|
|
97
100
|
"aria-describedby": !!help ? `${id}__help` : undefined
|
|
98
101
|
}, additionalProps)), (0, _element.createElement)("label", {
|
|
99
102
|
htmlFor: `${id}-${index}`
|
|
100
|
-
}, option.label))));
|
|
103
|
+
}, option.label)))));
|
|
101
104
|
}
|
|
102
105
|
|
|
103
106
|
var _default = RadioControl;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/radio-control/index.tsx"],"names":["RadioControl","props","label","className","selected","help","onChange","hideLabelFromVision","options","additionalProps","instanceId","id","onChangeValue","event","target","value","length","map","option","index","undefined"],"mappings":";;;;;;;;;;;;;;AAGA;;AAMA;;AAKA;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/radio-control/index.tsx"],"names":["RadioControl","props","label","className","selected","help","onChange","hideLabelFromVision","options","additionalProps","instanceId","id","onChangeValue","event","target","value","length","map","option","index","undefined"],"mappings":";;;;;;;;;;;;;;AAGA;;AAMA;;AAKA;;AAGA;;AAjBA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,YAAT,CACNC,KADM,EAEL;AACD,QAAM;AACLC,IAAAA,KADK;AAELC,IAAAA,SAFK;AAGLC,IAAAA,QAHK;AAILC,IAAAA,IAJK;AAKLC,IAAAA,QALK;AAMLC,IAAAA,mBANK;AAOLC,IAAAA,OAAO,GAAG,EAPL;AAQL,OAAGC;AARE,MAS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ADD;AAoCA;;eAEcF,Y","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport type { ChangeEvent } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BaseControl from '../base-control';\nimport type { WordPressComponentProps } from '../ui/context';\nimport type { RadioControlProps } from './types';\nimport { VStack } from '../v-stack';\n\n/**\n * Render a user interface to select the user type using radio inputs.\n *\n * ```jsx\n * import { RadioControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyRadioControl = () => {\n * const [ option, setOption ] = useState( 'a' );\n *\n * return (\n * <RadioControl\n * label=\"User type\"\n * help=\"The type of the current user\"\n * selected={ option }\n * options={ [\n * { label: 'Author', value: 'a' },\n * { label: 'Editor', value: 'e' },\n * ] }\n * onChange={ ( value ) => setOption( value ) }\n * />\n * );\n * };\n * ```\n */\nexport function RadioControl(\n\tprops: WordPressComponentProps< RadioControlProps, 'input', false >\n) {\n\tconst {\n\t\tlabel,\n\t\tclassName,\n\t\tselected,\n\t\thelp,\n\t\tonChange,\n\t\thideLabelFromVision,\n\t\toptions = [],\n\t\t...additionalProps\n\t} = props;\n\tconst instanceId = useInstanceId( RadioControl );\n\tconst id = `inspector-radio-control-${ instanceId }`;\n\tconst onChangeValue = ( event: ChangeEvent< HTMLInputElement > ) =>\n\t\tonChange( event.target.value );\n\n\tif ( ! options?.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BaseControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tlabel={ label }\n\t\t\tid={ id }\n\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\thelp={ help }\n\t\t\tclassName={ classnames( className, 'components-radio-control' ) }\n\t\t>\n\t\t\t<VStack spacing={ 1 }>\n\t\t\t\t{ options.map( ( option, index ) => (\n\t\t\t\t\t<div\n\t\t\t\t\t\tkey={ `${ id }-${ index }` }\n\t\t\t\t\t\tclassName=\"components-radio-control__option\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<input\n\t\t\t\t\t\t\tid={ `${ id }-${ index }` }\n\t\t\t\t\t\t\tclassName=\"components-radio-control__input\"\n\t\t\t\t\t\t\ttype=\"radio\"\n\t\t\t\t\t\t\tname={ id }\n\t\t\t\t\t\t\tvalue={ option.value }\n\t\t\t\t\t\t\tonChange={ onChangeValue }\n\t\t\t\t\t\t\tchecked={ option.value === selected }\n\t\t\t\t\t\t\taria-describedby={\n\t\t\t\t\t\t\t\t!! help ? `${ id }__help` : undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t{ ...additionalProps }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<label htmlFor={ `${ id }-${ index }` }>\n\t\t\t\t\t\t\t{ option.label }\n\t\t\t\t\t\t</label>\n\t\t\t\t\t</div>\n\t\t\t\t) ) }\n\t\t\t</VStack>\n\t\t</BaseControl>\n\t);\n}\n\nexport default RadioControl;\n"]}
|
|
@@ -127,6 +127,8 @@ function UnforwardedRangeControl(props, forwardedRef) {
|
|
|
127
127
|
};
|
|
128
128
|
|
|
129
129
|
const handleOnChange = next => {
|
|
130
|
+
// @ts-expect-error TODO: Investigate if it's problematic for setValue() to
|
|
131
|
+
// potentially receive a NaN when next is undefined.
|
|
130
132
|
let nextValue = parseFloat(next);
|
|
131
133
|
setValue(nextValue);
|
|
132
134
|
/*
|
|
@@ -276,7 +278,8 @@ function UnforwardedRangeControl(props, forwardedRef) {
|
|
|
276
278
|
onBlur: handleOnInputNumberBlur,
|
|
277
279
|
onChange: handleOnChange,
|
|
278
280
|
shiftStep: shiftStep,
|
|
279
|
-
step: step
|
|
281
|
+
step: step // @ts-expect-error TODO: Investigate if the `null` value is necessary
|
|
282
|
+
,
|
|
280
283
|
value: inputSliderValue
|
|
281
284
|
}), allowReset && (0, _element.createElement)(_rangeControlStyles.ActionRightWrapper, null, (0, _element.createElement)(_button.default, {
|
|
282
285
|
className: "components-range-control__reset",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/range-control/index.tsx"],"names":["noop","UnforwardedRangeControl","props","forwardedRef","__nextHasNoMarginBottom","afterIcon","allowReset","beforeIcon","className","color","colorProp","COLORS","ui","theme","currentInput","disabled","help","hideLabelFromVision","initialPosition","isShiftStepEnabled","label","marks","max","min","onBlur","onChange","onFocus","onMouseLeave","onMouseMove","railColor","renderTooltipContent","v","resetFallbackValue","shiftStep","showTooltip","showTooltipProp","step","trackColor","value","valueProp","withInputField","otherProps","setValue","initial","isResetPendent","hasTooltip","hasInputField","setShowTooltip","isFocused","setIsFocused","inputRef","isCurrentlyFocused","current","matches","isThumbFocused","isValueReset","currentValue","undefined","inputSliderValue","rangeFillValue","fillValue","fillValueOffset","classes","wrapperClasses","id","describedBy","enableTooltip","Number","isFinite","handleOnRangeChange","event","nextValue","parseFloat","target","handleOnChange","next","isNaN","handleOnInputNumberBlur","handleOnReset","resetValue","onChangeResetValue","handleShowTooltip","handleHideTooltip","handleOnBlur","handleOnFocus","offsetStyle","width","RangeControl"],"mappings":";;;;;;;;;AAUA;;;;AAPA;;AAMA;;AAEA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAzBA;AACA;AACA;;AAIA;AACA;AACA;;AAKA;AACA;AACA;AAyBA,MAAMA,IAAI,GAAG,MAAM,CAAE,CAArB;;AAEA,SAASC,uBAAT,CACCC,KADD,EAMCC,YAND,EAOE;AAAA;;AACD,QAAM;AACLC,IAAAA,uBAAuB,GAAG,KADrB;AAELC,IAAAA,SAFK;AAGLC,IAAAA,UAAU,GAAG,KAHR;AAILC,IAAAA,UAJK;AAKLC,IAAAA,SALK;AAMLC,IAAAA,KAAK,EAAEC,SAAS,GAAGC,cAAOC,EAAP,CAAUC,KANxB;AAOLC,IAAAA,YAPK;AAQLC,IAAAA,QAAQ,GAAG,KARN;AASLC,IAAAA,IATK;AAULC,IAAAA,mBAAmB,GAAG,KAVjB;AAWLC,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AEQsF,Y","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport type { ChangeEvent, FocusEvent, ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { useRef, useState, forwardRef } from '@wordpress/element';\nimport { useInstanceId, useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BaseControl from '../base-control';\nimport Button from '../button';\nimport Icon from '../icon';\nimport { COLORS } from '../utils';\nimport { floatClamp, useControlledRangeValue } from './utils';\nimport { clamp } from '../utils/math';\nimport InputRange from './input-range';\nimport RangeRail from './rail';\nimport SimpleTooltip from './tooltip';\nimport {\n\tActionRightWrapper,\n\tAfterIconWrapper,\n\tBeforeIconWrapper,\n\tInputNumber,\n\tRoot,\n\tTrack,\n\tThumbWrapper,\n\tThumb,\n\tWrapper,\n} from './styles/range-control-styles';\n\nimport type { RangeControlProps } from './types';\nimport type { WordPressComponentProps } from '../ui/context';\n\nconst noop = () => {};\n\nfunction UnforwardedRangeControl< IconProps = unknown >(\n\tprops: WordPressComponentProps<\n\t\tRangeControlProps< IconProps >,\n\t\t'input',\n\t\tfalse\n\t>,\n\tforwardedRef: ForwardedRef< HTMLInputElement >\n) {\n\tconst {\n\t\t__nextHasNoMarginBottom = false,\n\t\tafterIcon,\n\t\tallowReset = false,\n\t\tbeforeIcon,\n\t\tclassName,\n\t\tcolor: colorProp = COLORS.ui.theme,\n\t\tcurrentInput,\n\t\tdisabled = false,\n\t\thelp,\n\t\thideLabelFromVision = false,\n\t\tinitialPosition,\n\t\tisShiftStepEnabled = true,\n\t\tlabel,\n\t\tmarks = false,\n\t\tmax = 100,\n\t\tmin = 0,\n\t\tonBlur = noop,\n\t\tonChange = noop,\n\t\tonFocus = noop,\n\t\tonMouseLeave = noop,\n\t\tonMouseMove = noop,\n\t\trailColor,\n\t\trenderTooltipContent = ( v ) => v,\n\t\tresetFallbackValue,\n\t\tshiftStep = 10,\n\t\tshowTooltip: showTooltipProp,\n\t\tstep = 1,\n\t\ttrackColor,\n\t\tvalue: valueProp,\n\t\twithInputField = true,\n\t\t...otherProps\n\t} = props;\n\n\tconst [ value, setValue ] = useControlledRangeValue( {\n\t\tmin,\n\t\tmax,\n\t\tvalue: valueProp ?? null,\n\t\tinitial: initialPosition,\n\t} );\n\tconst isResetPendent = useRef( false );\n\n\tlet hasTooltip = showTooltipProp;\n\tlet hasInputField = withInputField;\n\n\tif ( step === 'any' ) {\n\t\t// The tooltip and number input field are hidden when the step is \"any\"\n\t\t// because the decimals get too lengthy to fit well.\n\t\thasTooltip = false;\n\t\thasInputField = false;\n\t}\n\n\tconst [ showTooltip, setShowTooltip ] = useState( hasTooltip );\n\tconst [ isFocused, setIsFocused ] = useState( false );\n\n\tconst inputRef = useRef< HTMLInputElement >();\n\tconst isCurrentlyFocused = inputRef.current?.matches( ':focus' );\n\tconst isThumbFocused = ! disabled && isFocused;\n\n\tconst isValueReset = value === null;\n\tconst currentValue = value !== undefined ? value : currentInput;\n\n\tconst inputSliderValue = isValueReset ? '' : currentValue;\n\tconst rangeFillValue = isValueReset ? ( max - min ) / 2 + min : value;\n\n\tconst fillValue = isValueReset\n\t\t? 50\n\t\t: ( ( value - min ) / ( max - min ) ) * 100;\n\tconst fillValueOffset = `${ clamp( fillValue, 0, 100 ) }%`;\n\n\tconst classes = classnames( 'components-range-control', className );\n\n\tconst wrapperClasses = classnames(\n\t\t'components-range-control__wrapper',\n\t\t!! marks && 'is-marked'\n\t);\n\n\tconst id = useInstanceId(\n\t\tUnforwardedRangeControl,\n\t\t'inspector-range-control'\n\t);\n\tconst describedBy = !! help ? `${ id }__help` : undefined;\n\tconst enableTooltip = hasTooltip !== false && Number.isFinite( value );\n\n\tconst handleOnRangeChange = ( event: ChangeEvent< HTMLInputElement > ) => {\n\t\tconst nextValue = parseFloat( event.target.value );\n\t\tsetValue( nextValue );\n\t\tonChange( nextValue );\n\t};\n\n\tconst handleOnChange = ( next: string ) => {\n\t\tlet nextValue = parseFloat( next );\n\t\tsetValue( nextValue );\n\n\t\t/*\n\t\t * Calls onChange only when nextValue is numeric\n\t\t * otherwise may queue a reset for the blur event.\n\t\t */\n\t\tif ( ! isNaN( nextValue ) ) {\n\t\t\tif ( nextValue < min || nextValue > max ) {\n\t\t\t\tnextValue = floatClamp( nextValue, min, max ) as number;\n\t\t\t}\n\n\t\t\tonChange( nextValue );\n\t\t\tisResetPendent.current = false;\n\t\t} else if ( allowReset ) {\n\t\t\tisResetPendent.current = true;\n\t\t}\n\t};\n\n\tconst handleOnInputNumberBlur = () => {\n\t\tif ( isResetPendent.current ) {\n\t\t\thandleOnReset();\n\t\t\tisResetPendent.current = false;\n\t\t}\n\t};\n\n\tconst handleOnReset = () => {\n\t\tlet resetValue: number | null = parseFloat( `${ resetFallbackValue }` );\n\t\tlet onChangeResetValue: number | undefined = resetValue;\n\n\t\tif ( isNaN( resetValue ) ) {\n\t\t\tresetValue = null;\n\t\t\tonChangeResetValue = undefined;\n\t\t}\n\n\t\tsetValue( resetValue );\n\n\t\t/**\n\t\t * Previously, this callback would always receive undefined as\n\t\t * an argument. This behavior is unexpected, specifically\n\t\t * when resetFallbackValue is defined.\n\t\t *\n\t\t * The value of undefined is not ideal. Passing it through\n\t\t * to internal <input /> elements would change it from a\n\t\t * controlled component to an uncontrolled component.\n\t\t *\n\t\t * For now, to minimize unexpected regressions, we're going to\n\t\t * preserve the undefined callback argument, except when a\n\t\t * resetFallbackValue is defined.\n\t\t */\n\t\tonChange( onChangeResetValue );\n\t};\n\n\tconst handleShowTooltip = () => setShowTooltip( true );\n\tconst handleHideTooltip = () => setShowTooltip( false );\n\n\tconst handleOnBlur = ( event: FocusEvent< HTMLInputElement > ) => {\n\t\tonBlur( event );\n\t\tsetIsFocused( false );\n\t\thandleHideTooltip();\n\t};\n\n\tconst handleOnFocus = ( event: FocusEvent< HTMLInputElement > ) => {\n\t\tonFocus( event );\n\t\tsetIsFocused( true );\n\t\thandleShowTooltip();\n\t};\n\n\tconst offsetStyle = {\n\t\t[ isRTL() ? 'right' : 'left' ]: fillValueOffset,\n\t};\n\n\treturn (\n\t\t<BaseControl\n\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\tclassName={ classes }\n\t\t\tlabel={ label }\n\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\tid={ `${ id }` }\n\t\t\thelp={ help }\n\t\t>\n\t\t\t<Root className=\"components-range-control__root\">\n\t\t\t\t{ beforeIcon && (\n\t\t\t\t\t<BeforeIconWrapper>\n\t\t\t\t\t\t<Icon icon={ beforeIcon } />\n\t\t\t\t\t</BeforeIconWrapper>\n\t\t\t\t) }\n\t\t\t\t<Wrapper\n\t\t\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\t\t\tclassName={ wrapperClasses }\n\t\t\t\t\tcolor={ colorProp }\n\t\t\t\t\tmarks={ !! marks }\n\t\t\t\t>\n\t\t\t\t\t<InputRange\n\t\t\t\t\t\t{ ...otherProps }\n\t\t\t\t\t\tclassName=\"components-range-control__slider\"\n\t\t\t\t\t\tdescribedBy={ describedBy }\n\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t\tid={ `${ id }` }\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\tmax={ max }\n\t\t\t\t\t\tmin={ min }\n\t\t\t\t\t\tonBlur={ handleOnBlur }\n\t\t\t\t\t\tonChange={ handleOnRangeChange }\n\t\t\t\t\t\tonFocus={ handleOnFocus }\n\t\t\t\t\t\tonMouseMove={ onMouseMove }\n\t\t\t\t\t\tonMouseLeave={ onMouseLeave }\n\t\t\t\t\t\tref={ useMergeRefs( [ inputRef, forwardedRef ] ) }\n\t\t\t\t\t\tstep={ step }\n\t\t\t\t\t\tvalue={ inputSliderValue ?? undefined }\n\t\t\t\t\t/>\n\t\t\t\t\t<RangeRail\n\t\t\t\t\t\taria-hidden={ true }\n\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t\tmarks={ marks }\n\t\t\t\t\t\tmax={ max }\n\t\t\t\t\t\tmin={ min }\n\t\t\t\t\t\trailColor={ railColor }\n\t\t\t\t\t\tstep={ step }\n\t\t\t\t\t\tvalue={ rangeFillValue }\n\t\t\t\t\t/>\n\t\t\t\t\t<Track\n\t\t\t\t\t\taria-hidden={ true }\n\t\t\t\t\t\tclassName=\"components-range-control__track\"\n\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t\tstyle={ { width: fillValueOffset } }\n\t\t\t\t\t\ttrackColor={ trackColor }\n\t\t\t\t\t/>\n\t\t\t\t\t<ThumbWrapper style={ offsetStyle } disabled={ disabled }>\n\t\t\t\t\t\t<Thumb\n\t\t\t\t\t\t\taria-hidden={ true }\n\t\t\t\t\t\t\tisFocused={ isThumbFocused }\n\t\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ThumbWrapper>\n\t\t\t\t\t{ enableTooltip && (\n\t\t\t\t\t\t<SimpleTooltip\n\t\t\t\t\t\t\tclassName=\"components-range-control__tooltip\"\n\t\t\t\t\t\t\tinputRef={ inputRef }\n\t\t\t\t\t\t\ttooltipPosition=\"bottom\"\n\t\t\t\t\t\t\trenderTooltipContent={ renderTooltipContent }\n\t\t\t\t\t\t\tshow={ isCurrentlyFocused || showTooltip }\n\t\t\t\t\t\t\tstyle={ offsetStyle }\n\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</Wrapper>\n\t\t\t\t{ afterIcon && (\n\t\t\t\t\t<AfterIconWrapper>\n\t\t\t\t\t\t<Icon icon={ afterIcon } />\n\t\t\t\t\t</AfterIconWrapper>\n\t\t\t\t) }\n\t\t\t\t{ hasInputField && (\n\t\t\t\t\t<InputNumber\n\t\t\t\t\t\taria-label={ label }\n\t\t\t\t\t\tclassName=\"components-range-control__number\"\n\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t\tinputMode=\"decimal\"\n\t\t\t\t\t\tisShiftStepEnabled={ isShiftStepEnabled }\n\t\t\t\t\t\tmax={ max }\n\t\t\t\t\t\tmin={ min }\n\t\t\t\t\t\tonBlur={ handleOnInputNumberBlur }\n\t\t\t\t\t\tonChange={ handleOnChange }\n\t\t\t\t\t\tshiftStep={ shiftStep }\n\t\t\t\t\t\tstep={ step }\n\t\t\t\t\t\tvalue={ inputSliderValue }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ allowReset && (\n\t\t\t\t\t<ActionRightWrapper>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName=\"components-range-control__reset\"\n\t\t\t\t\t\t\tdisabled={ disabled || value === undefined }\n\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\tisSmall\n\t\t\t\t\t\t\tonClick={ handleOnReset }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Reset' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</ActionRightWrapper>\n\t\t\t\t) }\n\t\t\t</Root>\n\t\t</BaseControl>\n\t);\n}\n\n/**\n * RangeControls are used to make selections from a range of incremental values.\n *\n * ```jsx\n * import { RangeControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyRangeControl = () => {\n * const [ isChecked, setChecked ] = useState( true );\n * return (\n * <RangeControl\n * help=\"Please select how transparent you would like this.\"\n * initialPosition={50}\n * label=\"Opacity\"\n * max={100}\n * min={0}\n * onChange={() => {}}\n * />\n * );\n * };\n * ```\n */\nexport const RangeControl = forwardRef( UnforwardedRangeControl );\n\nexport default RangeControl;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/range-control/index.tsx"],"names":["noop","UnforwardedRangeControl","props","forwardedRef","__nextHasNoMarginBottom","afterIcon","allowReset","beforeIcon","className","color","colorProp","COLORS","ui","theme","currentInput","disabled","help","hideLabelFromVision","initialPosition","isShiftStepEnabled","label","marks","max","min","onBlur","onChange","onFocus","onMouseLeave","onMouseMove","railColor","renderTooltipContent","v","resetFallbackValue","shiftStep","showTooltip","showTooltipProp","step","trackColor","value","valueProp","withInputField","otherProps","setValue","initial","isResetPendent","hasTooltip","hasInputField","setShowTooltip","isFocused","setIsFocused","inputRef","isCurrentlyFocused","current","matches","isThumbFocused","isValueReset","currentValue","undefined","inputSliderValue","rangeFillValue","fillValue","fillValueOffset","classes","wrapperClasses","id","describedBy","enableTooltip","Number","isFinite","handleOnRangeChange","event","nextValue","parseFloat","target","handleOnChange","next","isNaN","handleOnInputNumberBlur","handleOnReset","resetValue","onChangeResetValue","handleShowTooltip","handleHideTooltip","handleOnBlur","handleOnFocus","offsetStyle","width","RangeControl"],"mappings":";;;;;;;;;AAUA;;;;AAPA;;AAMA;;AAEA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAzBA;AACA;AACA;;AAIA;AACA;AACA;;AAKA;AACA;AACA;AAyBA,MAAMA,IAAI,GAAG,MAAM,CAAE,CAArB;;AAEA,SAASC,uBAAT,CACCC,KADD,EAMCC,YAND,EAOE;AAAA;;AACD,QAAM;AACLC,IAAAA,uBAAuB,GAAG,KADrB;AAELC,IAAAA,SAFK;AAGLC,IAAAA,UAAU,GAAG,KAHR;AAILC,IAAAA,UAJK;AAKLC,IAAAA,SALK;AAMLC,IAAAA,KAAK,EAAEC,SAAS,GAAGC,cAAOC,EAAP,CAAUC,KANxB;AAOLC,IAAAA,YAPK;AAQLC,IAAAA,QAAQ,GAAG,KARN;AASLC,IAAAA,IATK;AAULC,IAAAA,mBAAmB,GAAG,KAVjB;AAWLC,IAAAA,eAXK;AAYLC,IAAAA,kBAAkB,GAAG,IAZhB;AAaLC,IAAAA,KAbK;AAcLC,IAAAA,KAAK,GAAG,KAdH;AAeLC,IAAAA,GAAG,GAAG,GAfD;AAgBLC,IAAAA,GAAG,GAAG,CAhBD;AAiBLC,IAAAA,MAAM,GAAGxB,IAjBJ;AAkBLyB,IAAAA,QAAQ,GA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mD,WANT;AAOC,IAAA,KAAK,EAAG/C;AAPT,IAjDF,CAND,EAkEGjC,SAAS,IACV,4BAAC,oCAAD,QACC,4BAAC,aAAD;AAAM,IAAA,IAAI,EAAGA;AAAb,IADD,CAnEF,EAuEGyC,aAAa,IACd,4BAAC,+BAAD;AACC,kBAAa1B,KADd;AAEC,IAAA,SAAS,EAAC,kCAFX;AAGC,IAAA,QAAQ,EAAGL,QAHZ;AAIC,IAAA,SAAS,EAAC,SAJX;AAKC,IAAA,kBAAkB,EAAGI,kBALtB;AAMC,IAAA,GAAG,EAAGG,GANP;AAOC,IAAA,GAAG,EAAGC,GAPP;AAQC,IAAA,MAAM,EAAGsD,uBARV;AASC,IAAA,QAAQ,EAAGH,cATZ;AAUC,IAAA,SAAS,EAAGzC,SAVb;AAWC,IAAA,IAAI,EAAGG,IAXR,CAYC;AAZD;AAaC,IAAA,KAAK,EAAGsB;AAbT,IAxEF,EAwFGpD,UAAU,IACX,4BAAC,sCAAD,QACC,4BAAC,eAAD;AACC,IAAA,SAAS,EAAC,iCADX;AAEC,IAAA,QAAQ,EAAGS,QAAQ,IAAIuB,KAAK,KAAKmB,SAFlC;AAGC,IAAA,OAAO,EAAC,WAHT;AAIC,IAAA,OAAO,MAJR;AAKC,IAAA,OAAO,EAAGqB;AALX,KAOG,cAAI,OAAJ,CAPH,CADD,CAzFF,CARD,CADD;AAiHA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMS,YAAY,GAAG,yBAAYtF,uBAAZ,CAArB;;eAEQsF,Y","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport type { ChangeEvent, FocusEvent, ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { useRef, useState, forwardRef } from '@wordpress/element';\nimport { useInstanceId, useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BaseControl from '../base-control';\nimport Button from '../button';\nimport Icon from '../icon';\nimport { COLORS } from '../utils';\nimport { floatClamp, useControlledRangeValue } from './utils';\nimport { clamp } from '../utils/math';\nimport InputRange from './input-range';\nimport RangeRail from './rail';\nimport SimpleTooltip from './tooltip';\nimport {\n\tActionRightWrapper,\n\tAfterIconWrapper,\n\tBeforeIconWrapper,\n\tInputNumber,\n\tRoot,\n\tTrack,\n\tThumbWrapper,\n\tThumb,\n\tWrapper,\n} from './styles/range-control-styles';\n\nimport type { RangeControlProps } from './types';\nimport type { WordPressComponentProps } from '../ui/context';\n\nconst noop = () => {};\n\nfunction UnforwardedRangeControl< IconProps = unknown >(\n\tprops: WordPressComponentProps<\n\t\tRangeControlProps< IconProps >,\n\t\t'input',\n\t\tfalse\n\t>,\n\tforwardedRef: ForwardedRef< HTMLInputElement >\n) {\n\tconst {\n\t\t__nextHasNoMarginBottom = false,\n\t\tafterIcon,\n\t\tallowReset = false,\n\t\tbeforeIcon,\n\t\tclassName,\n\t\tcolor: colorProp = COLORS.ui.theme,\n\t\tcurrentInput,\n\t\tdisabled = false,\n\t\thelp,\n\t\thideLabelFromVision = false,\n\t\tinitialPosition,\n\t\tisShiftStepEnabled = true,\n\t\tlabel,\n\t\tmarks = false,\n\t\tmax = 100,\n\t\tmin = 0,\n\t\tonBlur = noop,\n\t\tonChange = noop,\n\t\tonFocus = noop,\n\t\tonMouseLeave = noop,\n\t\tonMouseMove = noop,\n\t\trailColor,\n\t\trenderTooltipContent = ( v ) => v,\n\t\tresetFallbackValue,\n\t\tshiftStep = 10,\n\t\tshowTooltip: showTooltipProp,\n\t\tstep = 1,\n\t\ttrackColor,\n\t\tvalue: valueProp,\n\t\twithInputField = true,\n\t\t...otherProps\n\t} = props;\n\n\tconst [ value, setValue ] = useControlledRangeValue( {\n\t\tmin,\n\t\tmax,\n\t\tvalue: valueProp ?? null,\n\t\tinitial: initialPosition,\n\t} );\n\tconst isResetPendent = useRef( false );\n\n\tlet hasTooltip = showTooltipProp;\n\tlet hasInputField = withInputField;\n\n\tif ( step === 'any' ) {\n\t\t// The tooltip and number input field are hidden when the step is \"any\"\n\t\t// because the decimals get too lengthy to fit well.\n\t\thasTooltip = false;\n\t\thasInputField = false;\n\t}\n\n\tconst [ showTooltip, setShowTooltip ] = useState( hasTooltip );\n\tconst [ isFocused, setIsFocused ] = useState( false );\n\n\tconst inputRef = useRef< HTMLInputElement >();\n\tconst isCurrentlyFocused = inputRef.current?.matches( ':focus' );\n\tconst isThumbFocused = ! disabled && isFocused;\n\n\tconst isValueReset = value === null;\n\tconst currentValue = value !== undefined ? value : currentInput;\n\n\tconst inputSliderValue = isValueReset ? '' : currentValue;\n\tconst rangeFillValue = isValueReset ? ( max - min ) / 2 + min : value;\n\n\tconst fillValue = isValueReset\n\t\t? 50\n\t\t: ( ( value - min ) / ( max - min ) ) * 100;\n\tconst fillValueOffset = `${ clamp( fillValue, 0, 100 ) }%`;\n\n\tconst classes = classnames( 'components-range-control', className );\n\n\tconst wrapperClasses = classnames(\n\t\t'components-range-control__wrapper',\n\t\t!! marks && 'is-marked'\n\t);\n\n\tconst id = useInstanceId(\n\t\tUnforwardedRangeControl,\n\t\t'inspector-range-control'\n\t);\n\tconst describedBy = !! help ? `${ id }__help` : undefined;\n\tconst enableTooltip = hasTooltip !== false && Number.isFinite( value );\n\n\tconst handleOnRangeChange = ( event: ChangeEvent< HTMLInputElement > ) => {\n\t\tconst nextValue = parseFloat( event.target.value );\n\t\tsetValue( nextValue );\n\t\tonChange( nextValue );\n\t};\n\n\tconst handleOnChange = ( next?: string ) => {\n\t\t// @ts-expect-error TODO: Investigate if it's problematic for setValue() to\n\t\t// potentially receive a NaN when next is undefined.\n\t\tlet nextValue = parseFloat( next );\n\t\tsetValue( nextValue );\n\n\t\t/*\n\t\t * Calls onChange only when nextValue is numeric\n\t\t * otherwise may queue a reset for the blur event.\n\t\t */\n\t\tif ( ! isNaN( nextValue ) ) {\n\t\t\tif ( nextValue < min || nextValue > max ) {\n\t\t\t\tnextValue = floatClamp( nextValue, min, max ) as number;\n\t\t\t}\n\n\t\t\tonChange( nextValue );\n\t\t\tisResetPendent.current = false;\n\t\t} else if ( allowReset ) {\n\t\t\tisResetPendent.current = true;\n\t\t}\n\t};\n\n\tconst handleOnInputNumberBlur = () => {\n\t\tif ( isResetPendent.current ) {\n\t\t\thandleOnReset();\n\t\t\tisResetPendent.current = false;\n\t\t}\n\t};\n\n\tconst handleOnReset = () => {\n\t\tlet resetValue: number | null = parseFloat( `${ resetFallbackValue }` );\n\t\tlet onChangeResetValue: number | undefined = resetValue;\n\n\t\tif ( isNaN( resetValue ) ) {\n\t\t\tresetValue = null;\n\t\t\tonChangeResetValue = undefined;\n\t\t}\n\n\t\tsetValue( resetValue );\n\n\t\t/**\n\t\t * Previously, this callback would always receive undefined as\n\t\t * an argument. This behavior is unexpected, specifically\n\t\t * when resetFallbackValue is defined.\n\t\t *\n\t\t * The value of undefined is not ideal. Passing it through\n\t\t * to internal <input /> elements would change it from a\n\t\t * controlled component to an uncontrolled component.\n\t\t *\n\t\t * For now, to minimize unexpected regressions, we're going to\n\t\t * preserve the undefined callback argument, except when a\n\t\t * resetFallbackValue is defined.\n\t\t */\n\t\tonChange( onChangeResetValue );\n\t};\n\n\tconst handleShowTooltip = () => setShowTooltip( true );\n\tconst handleHideTooltip = () => setShowTooltip( false );\n\n\tconst handleOnBlur = ( event: FocusEvent< HTMLInputElement > ) => {\n\t\tonBlur( event );\n\t\tsetIsFocused( false );\n\t\thandleHideTooltip();\n\t};\n\n\tconst handleOnFocus = ( event: FocusEvent< HTMLInputElement > ) => {\n\t\tonFocus( event );\n\t\tsetIsFocused( true );\n\t\thandleShowTooltip();\n\t};\n\n\tconst offsetStyle = {\n\t\t[ isRTL() ? 'right' : 'left' ]: fillValueOffset,\n\t};\n\n\treturn (\n\t\t<BaseControl\n\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\tclassName={ classes }\n\t\t\tlabel={ label }\n\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\tid={ `${ id }` }\n\t\t\thelp={ help }\n\t\t>\n\t\t\t<Root className=\"components-range-control__root\">\n\t\t\t\t{ beforeIcon && (\n\t\t\t\t\t<BeforeIconWrapper>\n\t\t\t\t\t\t<Icon icon={ beforeIcon } />\n\t\t\t\t\t</BeforeIconWrapper>\n\t\t\t\t) }\n\t\t\t\t<Wrapper\n\t\t\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\t\t\tclassName={ wrapperClasses }\n\t\t\t\t\tcolor={ colorProp }\n\t\t\t\t\tmarks={ !! marks }\n\t\t\t\t>\n\t\t\t\t\t<InputRange\n\t\t\t\t\t\t{ ...otherProps }\n\t\t\t\t\t\tclassName=\"components-range-control__slider\"\n\t\t\t\t\t\tdescribedBy={ describedBy }\n\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t\tid={ `${ id }` }\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\tmax={ max }\n\t\t\t\t\t\tmin={ min }\n\t\t\t\t\t\tonBlur={ handleOnBlur }\n\t\t\t\t\t\tonChange={ handleOnRangeChange }\n\t\t\t\t\t\tonFocus={ handleOnFocus }\n\t\t\t\t\t\tonMouseMove={ onMouseMove }\n\t\t\t\t\t\tonMouseLeave={ onMouseLeave }\n\t\t\t\t\t\tref={ useMergeRefs( [ inputRef, forwardedRef ] ) }\n\t\t\t\t\t\tstep={ step }\n\t\t\t\t\t\tvalue={ inputSliderValue ?? undefined }\n\t\t\t\t\t/>\n\t\t\t\t\t<RangeRail\n\t\t\t\t\t\taria-hidden={ true }\n\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t\tmarks={ marks }\n\t\t\t\t\t\tmax={ max }\n\t\t\t\t\t\tmin={ min }\n\t\t\t\t\t\trailColor={ railColor }\n\t\t\t\t\t\tstep={ step }\n\t\t\t\t\t\tvalue={ rangeFillValue }\n\t\t\t\t\t/>\n\t\t\t\t\t<Track\n\t\t\t\t\t\taria-hidden={ true }\n\t\t\t\t\t\tclassName=\"components-range-control__track\"\n\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t\tstyle={ { width: fillValueOffset } }\n\t\t\t\t\t\ttrackColor={ trackColor }\n\t\t\t\t\t/>\n\t\t\t\t\t<ThumbWrapper style={ offsetStyle } disabled={ disabled }>\n\t\t\t\t\t\t<Thumb\n\t\t\t\t\t\t\taria-hidden={ true }\n\t\t\t\t\t\t\tisFocused={ isThumbFocused }\n\t\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ThumbWrapper>\n\t\t\t\t\t{ enableTooltip && (\n\t\t\t\t\t\t<SimpleTooltip\n\t\t\t\t\t\t\tclassName=\"components-range-control__tooltip\"\n\t\t\t\t\t\t\tinputRef={ inputRef }\n\t\t\t\t\t\t\ttooltipPosition=\"bottom\"\n\t\t\t\t\t\t\trenderTooltipContent={ renderTooltipContent }\n\t\t\t\t\t\t\tshow={ isCurrentlyFocused || showTooltip }\n\t\t\t\t\t\t\tstyle={ offsetStyle }\n\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</Wrapper>\n\t\t\t\t{ afterIcon && (\n\t\t\t\t\t<AfterIconWrapper>\n\t\t\t\t\t\t<Icon icon={ afterIcon } />\n\t\t\t\t\t</AfterIconWrapper>\n\t\t\t\t) }\n\t\t\t\t{ hasInputField && (\n\t\t\t\t\t<InputNumber\n\t\t\t\t\t\taria-label={ label }\n\t\t\t\t\t\tclassName=\"components-range-control__number\"\n\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t\tinputMode=\"decimal\"\n\t\t\t\t\t\tisShiftStepEnabled={ isShiftStepEnabled }\n\t\t\t\t\t\tmax={ max }\n\t\t\t\t\t\tmin={ min }\n\t\t\t\t\t\tonBlur={ handleOnInputNumberBlur }\n\t\t\t\t\t\tonChange={ handleOnChange }\n\t\t\t\t\t\tshiftStep={ shiftStep }\n\t\t\t\t\t\tstep={ step }\n\t\t\t\t\t\t// @ts-expect-error TODO: Investigate if the `null` value is necessary\n\t\t\t\t\t\tvalue={ inputSliderValue }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ allowReset && (\n\t\t\t\t\t<ActionRightWrapper>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName=\"components-range-control__reset\"\n\t\t\t\t\t\t\tdisabled={ disabled || value === undefined }\n\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\tisSmall\n\t\t\t\t\t\t\tonClick={ handleOnReset }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Reset' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</ActionRightWrapper>\n\t\t\t\t) }\n\t\t\t</Root>\n\t\t</BaseControl>\n\t);\n}\n\n/**\n * RangeControls are used to make selections from a range of incremental values.\n *\n * ```jsx\n * import { RangeControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyRangeControl = () => {\n * const [ isChecked, setChecked ] = useState( true );\n * return (\n * <RangeControl\n * help=\"Please select how transparent you would like this.\"\n * initialPosition={50}\n * label=\"Opacity\"\n * max={100}\n * min={0}\n * onChange={() => {}}\n * />\n * );\n * };\n * ```\n */\nexport const RangeControl = forwardRef( UnforwardedRangeControl );\n\nexport default RangeControl;\n"]}
|