@wordpress/components 19.17.0 → 20.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 +75 -1
- package/CONTRIBUTING.md +10 -10
- package/build/alignment-matrix-control/index.js +1 -1
- package/build/alignment-matrix-control/index.js.map +1 -1
- 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 +3 -0
- package/build/angle-picker-control/index.js.map +1 -1
- package/build/angle-picker-control/styles/angle-picker-control-styles.js +14 -4
- package/build/angle-picker-control/styles/angle-picker-control-styles.js.map +1 -1
- package/build/autocomplete/index.js +9 -11
- package/build/autocomplete/index.js.map +1 -1
- package/build/base-control/styles/base-control-styles.js +8 -8
- package/build/base-control/styles/base-control-styles.js.map +1 -1
- package/build/base-field/styles.js +5 -5
- package/build/base-field/styles.js.map +1 -1
- package/build/box-control/styles/box-control-visualizer-styles.js +8 -8
- package/build/box-control/styles/box-control-visualizer-styles.js.map +1 -1
- package/build/card/card/component.js +6 -11
- package/build/card/card/component.js.map +1 -1
- package/build/card/card/hook.js +0 -10
- package/build/card/card/hook.js.map +1 -1
- package/build/card/card/index.js.map +1 -1
- package/build/card/card-body/component.js +7 -8
- package/build/card/card-body/component.js.map +1 -1
- package/build/card/card-body/hook.js +0 -4
- package/build/card/card-body/hook.js.map +1 -1
- package/build/card/card-body/index.js.map +1 -1
- package/build/card/card-divider/component.js +7 -8
- package/build/card/card-divider/component.js.map +1 -1
- package/build/card/card-divider/hook.js +0 -4
- package/build/card/card-divider/hook.js.map +1 -1
- package/build/card/card-divider/index.js.map +1 -1
- package/build/card/card-footer/component.js +7 -8
- package/build/card/card-footer/component.js.map +1 -1
- package/build/card/card-footer/hook.js +0 -4
- package/build/card/card-footer/hook.js.map +1 -1
- package/build/card/card-footer/index.js.map +1 -1
- package/build/card/card-header/component.js +7 -8
- package/build/card/card-header/component.js.map +1 -1
- package/build/card/card-header/hook.js +0 -4
- package/build/card/card-header/hook.js.map +1 -1
- package/build/card/card-header/index.js.map +1 -1
- package/build/card/card-media/component.js +7 -7
- package/build/card/card-media/component.js.map +1 -1
- package/build/card/card-media/hook.js +0 -4
- package/build/card/card-media/hook.js.map +1 -1
- package/build/card/card-media/index.js.map +1 -1
- package/build/card/context.js.map +1 -1
- package/build/card/index.js.map +1 -1
- package/build/card/styles.js +17 -17
- package/build/card/styles.js.map +1 -1
- package/build/color-list-picker/index.js +16 -5
- package/build/color-list-picker/index.js.map +1 -1
- package/build/color-palette/index.js +22 -12
- package/build/color-palette/index.js.map +1 -1
- package/build/color-palette/index.native.js +3 -3
- package/build/color-palette/index.native.js.map +1 -1
- package/build/combobox-control/index.js +7 -4
- package/build/combobox-control/index.js.map +1 -1
- package/build/{custom-gradient-bar → custom-gradient-picker/gradient-bar}/constants.js +0 -0
- package/build/custom-gradient-picker/gradient-bar/constants.js.map +1 -0
- package/build/{custom-gradient-bar → custom-gradient-picker/gradient-bar}/control-points.js +34 -41
- package/build/custom-gradient-picker/gradient-bar/control-points.js.map +1 -0
- package/build/{custom-gradient-bar → custom-gradient-picker/gradient-bar}/index.js +0 -1
- package/build/custom-gradient-picker/gradient-bar/index.js.map +1 -0
- package/build/{custom-gradient-bar → custom-gradient-picker/gradient-bar}/utils.js +0 -0
- package/build/custom-gradient-picker/gradient-bar/utils.js.map +1 -0
- package/build/custom-gradient-picker/index.js +19 -4
- package/build/custom-gradient-picker/index.js.map +1 -1
- package/build/custom-select-control/index.js +21 -11
- package/build/custom-select-control/index.js.map +1 -1
- package/build/custom-select-control/styles.js +34 -0
- package/build/custom-select-control/styles.js.map +1 -0
- package/build/date-time/constants.js +9 -0
- package/build/date-time/constants.js.map +1 -0
- package/build/date-time/date/index.js +175 -186
- package/build/date-time/date/index.js.map +1 -1
- package/build/date-time/date/styles.js +59 -40
- package/build/date-time/date/styles.js.map +1 -1
- package/build/date-time/date-time/index.js +5 -2
- package/build/date-time/date-time/index.js.map +1 -1
- package/build/date-time/time/index.js +22 -17
- package/build/date-time/time/index.js.map +1 -1
- package/build/date-time/utils.js +27 -0
- package/build/date-time/utils.js.map +1 -0
- package/build/dimension-control/index.js +2 -6
- package/build/dimension-control/index.js.map +1 -1
- package/build/disabled/index.js +28 -11
- package/build/disabled/index.js.map +1 -1
- package/build/disabled/styles/disabled-styles.js +3 -3
- package/build/disabled/styles/disabled-styles.js.map +1 -1
- package/build/{swatch → disabled}/types.js +0 -0
- package/build/{swatch → disabled}/types.js.map +0 -0
- package/build/drop-zone/index.js +2 -4
- package/build/drop-zone/index.js.map +1 -1
- package/build/dropdown/index.js +5 -6
- package/build/dropdown/index.js.map +1 -1
- package/build/duotone-picker/custom-duotone-bar.js +2 -2
- package/build/duotone-picker/custom-duotone-bar.js.map +1 -1
- package/build/duotone-picker/duotone-picker.js +9 -1
- package/build/duotone-picker/duotone-picker.js.map +1 -1
- package/build/duotone-picker/duotone-swatch.js +13 -3
- package/build/duotone-picker/duotone-swatch.js.map +1 -1
- package/build/focal-point-picker/index.js +4 -6
- package/build/focal-point-picker/index.js.map +1 -1
- package/build/focal-point-picker/styles/focal-point-style.js +4 -4
- package/build/focal-point-picker/styles/focal-point-style.js.map +1 -1
- package/build/font-size-picker/index.js +43 -14
- package/build/font-size-picker/index.js.map +1 -1
- package/build/font-size-picker/utils.js +32 -22
- package/build/font-size-picker/utils.js.map +1 -1
- package/build/form-token-field/index.js +29 -20
- package/build/form-token-field/index.js.map +1 -1
- package/build/gradient-picker/index.js +15 -3
- package/build/gradient-picker/index.js.map +1 -1
- package/build/guide/index.js +5 -3
- package/build/guide/index.js.map +1 -1
- package/build/guide/page-control.js +3 -7
- package/build/guide/page-control.js.map +1 -1
- package/build/item-group/styles.js +10 -10
- package/build/item-group/styles.js.map +1 -1
- package/build/mobile/bottom-sheet/index.native.js +3 -6
- package/build/mobile/bottom-sheet/index.native.js.map +1 -1
- package/build/mobile/global-styles-context/utils.native.js +3 -1
- package/build/mobile/global-styles-context/utils.native.js.map +1 -1
- package/build/mobile/image/index.native.js +6 -26
- package/build/mobile/image/index.native.js.map +1 -1
- package/build/mobile/picker/index.android.js +3 -3
- package/build/mobile/picker/index.android.js.map +1 -1
- package/build/modal/index.js +1 -3
- package/build/modal/index.js.map +1 -1
- package/build/navigable-container/container.js +9 -8
- package/build/navigable-container/container.js.map +1 -1
- package/build/navigable-container/menu.js +3 -9
- package/build/navigable-container/menu.js.map +1 -1
- package/build/navigator/navigator-back-button/hook.js +0 -4
- package/build/navigator/navigator-back-button/hook.js.map +1 -1
- package/build/navigator/navigator-button/hook.js +0 -4
- package/build/navigator/navigator-button/hook.js.map +1 -1
- package/build/notice/list.js +10 -6
- package/build/notice/list.js.map +1 -1
- package/build/palette-edit/index.js +1 -0
- package/build/palette-edit/index.js.map +1 -1
- package/build/palette-edit/styles.js +10 -10
- package/build/palette-edit/styles.js.map +1 -1
- package/build/popover/index.js +100 -97
- package/build/popover/index.js.map +1 -1
- package/build/popover/utils.js +178 -0
- package/build/popover/utils.js.map +1 -0
- package/build/range-control/index.js +3 -0
- package/build/range-control/index.js.map +1 -1
- package/build/range-control/styles/range-control-styles.js +43 -37
- package/build/range-control/styles/range-control-styles.js.map +1 -1
- package/build/select-control/chevron-down.js +30 -0
- package/build/select-control/chevron-down.js.map +1 -0
- package/build/select-control/index.js +7 -7
- package/build/select-control/index.js.map +1 -1
- package/build/select-control/styles/select-control-styles.js +30 -15
- package/build/select-control/styles/select-control-styles.js.map +1 -1
- package/build/snackbar/list.js +5 -3
- package/build/snackbar/list.js.map +1 -1
- package/build/spinner/index.js +2 -0
- package/build/spinner/index.js.map +1 -1
- package/build/text/styles.js +7 -7
- package/build/text/styles.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/component.js +16 -8
- package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/styles.js +7 -5
- package/build/toggle-group-control/toggle-group-control/styles.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control-option/component.js +15 -5
- package/build/toggle-group-control/toggle-group-control-option/component.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control-option-base/component.js +5 -1
- package/build/toggle-group-control/toggle-group-control-option-base/component.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control-option-base/styles.js +20 -7
- package/build/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control-option-icon/component.js +26 -7
- package/build/toggle-group-control/toggle-group-control-option-icon/component.js.map +1 -1
- package/build/tools-panel/styles.js +11 -11
- package/build/tools-panel/styles.js.map +1 -1
- package/build/tooltip/index.js +1 -7
- package/build/tooltip/index.js.map +1 -1
- package/build/tree-grid/index.js +4 -10
- package/build/tree-grid/index.js.map +1 -1
- package/build/ui/context/context-connect.js +1 -3
- package/build/ui/context/context-connect.js.map +1 -1
- package/build/unit-control/index.js +2 -3
- package/build/unit-control/index.js.map +1 -1
- package/build/utils/colors-values.js +52 -142
- package/build/utils/colors-values.js.map +1 -1
- package/build/utils/config-values.js +1 -1
- package/build/utils/config-values.js.map +1 -1
- package/build/utils/input/input-control.js +1 -1
- package/build/utils/input/input-control.js.map +1 -1
- package/build/utils/rtl.js +6 -5
- package/build/utils/rtl.js.map +1 -1
- package/build/utils/strings.js +50 -0
- package/build/utils/strings.js.map +1 -0
- package/build-module/alignment-matrix-control/index.js +1 -1
- package/build-module/alignment-matrix-control/index.js.map +1 -1
- 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 +3 -0
- package/build-module/angle-picker-control/index.js.map +1 -1
- package/build-module/angle-picker-control/styles/angle-picker-control-styles.js +13 -4
- package/build-module/angle-picker-control/styles/angle-picker-control-styles.js.map +1 -1
- package/build-module/autocomplete/index.js +9 -10
- package/build-module/autocomplete/index.js.map +1 -1
- package/build-module/base-control/styles/base-control-styles.js +8 -8
- package/build-module/base-control/styles/base-control-styles.js.map +1 -1
- package/build-module/base-field/styles.js +5 -5
- package/build-module/base-field/styles.js.map +1 -1
- package/build-module/box-control/styles/box-control-visualizer-styles.js +8 -8
- package/build-module/box-control/styles/box-control-visualizer-styles.js.map +1 -1
- package/build-module/card/card/component.js +5 -10
- package/build-module/card/card/component.js.map +1 -1
- package/build-module/card/card/hook.js +0 -9
- package/build-module/card/card/hook.js.map +1 -1
- package/build-module/card/card/index.js.map +1 -1
- package/build-module/card/card-body/component.js +7 -8
- package/build-module/card/card-body/component.js.map +1 -1
- package/build-module/card/card-body/hook.js +0 -4
- package/build-module/card/card-body/hook.js.map +1 -1
- package/build-module/card/card-body/index.js.map +1 -1
- package/build-module/card/card-divider/component.js +7 -8
- package/build-module/card/card-divider/component.js.map +1 -1
- package/build-module/card/card-divider/hook.js +0 -4
- package/build-module/card/card-divider/hook.js.map +1 -1
- package/build-module/card/card-divider/index.js.map +1 -1
- package/build-module/card/card-footer/component.js +7 -8
- package/build-module/card/card-footer/component.js.map +1 -1
- package/build-module/card/card-footer/hook.js +0 -4
- package/build-module/card/card-footer/hook.js.map +1 -1
- package/build-module/card/card-footer/index.js.map +1 -1
- package/build-module/card/card-header/component.js +7 -8
- package/build-module/card/card-header/component.js.map +1 -1
- package/build-module/card/card-header/hook.js +0 -4
- package/build-module/card/card-header/hook.js.map +1 -1
- package/build-module/card/card-header/index.js.map +1 -1
- package/build-module/card/card-media/component.js +7 -7
- package/build-module/card/card-media/component.js.map +1 -1
- package/build-module/card/card-media/hook.js +0 -4
- package/build-module/card/card-media/hook.js.map +1 -1
- package/build-module/card/card-media/index.js.map +1 -1
- package/build-module/card/context.js.map +1 -1
- package/build-module/card/index.js.map +1 -1
- package/build-module/card/styles.js +17 -17
- package/build-module/card/styles.js.map +1 -1
- package/build-module/color-list-picker/index.js +13 -5
- package/build-module/color-list-picker/index.js.map +1 -1
- package/build-module/color-palette/index.js +22 -11
- package/build-module/color-palette/index.js.map +1 -1
- package/build-module/color-palette/index.native.js +4 -4
- package/build-module/color-palette/index.native.js.map +1 -1
- package/build-module/combobox-control/index.js +6 -3
- package/build-module/combobox-control/index.js.map +1 -1
- package/build-module/{custom-gradient-bar → custom-gradient-picker/gradient-bar}/constants.js +0 -0
- package/build-module/custom-gradient-picker/gradient-bar/constants.js.map +1 -0
- package/build-module/{custom-gradient-bar → custom-gradient-picker/gradient-bar}/control-points.js +34 -41
- package/build-module/custom-gradient-picker/gradient-bar/control-points.js.map +1 -0
- package/build-module/{custom-gradient-bar → custom-gradient-picker/gradient-bar}/index.js +0 -1
- package/build-module/custom-gradient-picker/gradient-bar/index.js.map +1 -0
- package/build-module/{custom-gradient-bar → custom-gradient-picker/gradient-bar}/utils.js +0 -0
- package/build-module/custom-gradient-picker/gradient-bar/utils.js.map +1 -0
- package/build-module/custom-gradient-picker/index.js +16 -3
- package/build-module/custom-gradient-picker/index.js.map +1 -1
- package/build-module/custom-select-control/index.js +20 -12
- package/build-module/custom-select-control/index.js.map +1 -1
- package/build-module/custom-select-control/styles.js +22 -0
- package/build-module/custom-select-control/styles.js.map +1 -0
- package/build-module/date-time/constants.js +2 -0
- package/build-module/date-time/constants.js.map +1 -0
- package/build-module/date-time/date/index.js +178 -184
- package/build-module/date-time/date/index.js.map +1 -1
- package/build-module/date-time/date/styles.js +47 -38
- package/build-module/date-time/date/styles.js.map +1 -1
- package/build-module/date-time/date-time/index.js +4 -2
- package/build-module/date-time/date-time/index.js.map +1 -1
- package/build-module/date-time/time/index.js +20 -16
- package/build-module/date-time/time/index.js.map +1 -1
- package/build-module/date-time/utils.js +19 -0
- package/build-module/date-time/utils.js.map +1 -0
- package/build-module/dimension-control/index.js +1 -5
- package/build-module/dimension-control/index.js.map +1 -1
- package/build-module/disabled/index.js +28 -11
- package/build-module/disabled/index.js.map +1 -1
- package/build-module/disabled/styles/disabled-styles.js +3 -3
- package/build-module/disabled/styles/disabled-styles.js.map +1 -1
- package/build-module/{swatch → disabled}/types.js +0 -0
- package/build-module/{swatch → disabled}/types.js.map +0 -0
- package/build-module/drop-zone/index.js +2 -3
- package/build-module/drop-zone/index.js.map +1 -1
- package/build-module/dropdown/index.js +5 -6
- package/build-module/dropdown/index.js.map +1 -1
- package/build-module/duotone-picker/custom-duotone-bar.js +1 -1
- package/build-module/duotone-picker/custom-duotone-bar.js.map +1 -1
- package/build-module/duotone-picker/duotone-picker.js +7 -1
- package/build-module/duotone-picker/duotone-picker.js.map +1 -1
- package/build-module/duotone-picker/duotone-swatch.js +11 -3
- package/build-module/duotone-picker/duotone-swatch.js.map +1 -1
- package/build-module/focal-point-picker/index.js +4 -5
- package/build-module/focal-point-picker/index.js.map +1 -1
- package/build-module/focal-point-picker/styles/focal-point-style.js +4 -4
- package/build-module/focal-point-picker/styles/focal-point-style.js.map +1 -1
- package/build-module/font-size-picker/index.js +39 -14
- package/build-module/font-size-picker/index.js.map +1 -1
- package/build-module/font-size-picker/utils.js +31 -23
- package/build-module/font-size-picker/utils.js.map +1 -1
- package/build-module/form-token-field/index.js +30 -20
- package/build-module/form-token-field/index.js.map +1 -1
- package/build-module/gradient-picker/index.js +14 -3
- package/build-module/gradient-picker/index.js.map +1 -1
- package/build-module/guide/index.js +5 -3
- package/build-module/guide/index.js.map +1 -1
- package/build-module/guide/page-control.js +3 -6
- package/build-module/guide/page-control.js.map +1 -1
- package/build-module/item-group/styles.js +10 -10
- package/build-module/item-group/styles.js.map +1 -1
- package/build-module/mobile/bottom-sheet/index.native.js +3 -5
- package/build-module/mobile/bottom-sheet/index.native.js.map +1 -1
- package/build-module/mobile/global-styles-context/utils.native.js +2 -1
- package/build-module/mobile/global-styles-context/utils.native.js.map +1 -1
- package/build-module/mobile/image/index.native.js +8 -28
- package/build-module/mobile/image/index.native.js.map +1 -1
- package/build-module/mobile/picker/index.android.js +3 -3
- package/build-module/mobile/picker/index.android.js.map +1 -1
- package/build-module/modal/index.js +1 -2
- package/build-module/modal/index.js.map +1 -1
- package/build-module/navigable-container/container.js +9 -7
- package/build-module/navigable-container/container.js.map +1 -1
- package/build-module/navigable-container/menu.js +3 -8
- package/build-module/navigable-container/menu.js.map +1 -1
- package/build-module/navigator/navigator-back-button/hook.js +0 -4
- package/build-module/navigator/navigator-back-button/hook.js.map +1 -1
- package/build-module/navigator/navigator-button/hook.js +0 -4
- package/build-module/navigator/navigator-button/hook.js.map +1 -1
- package/build-module/notice/list.js +10 -5
- package/build-module/notice/list.js.map +1 -1
- package/build-module/palette-edit/index.js +1 -0
- package/build-module/palette-edit/index.js.map +1 -1
- package/build-module/palette-edit/styles.js +10 -10
- package/build-module/palette-edit/styles.js.map +1 -1
- package/build-module/popover/index.js +100 -98
- package/build-module/popover/index.js.map +1 -1
- package/build-module/popover/utils.js +164 -0
- package/build-module/popover/utils.js.map +1 -0
- package/build-module/range-control/index.js +3 -0
- package/build-module/range-control/index.js.map +1 -1
- package/build-module/range-control/styles/range-control-styles.js +43 -37
- package/build-module/range-control/styles/range-control-styles.js.map +1 -1
- package/build-module/select-control/chevron-down.js +21 -0
- package/build-module/select-control/chevron-down.js.map +1 -0
- package/build-module/select-control/index.js +7 -7
- package/build-module/select-control/index.js.map +1 -1
- package/build-module/select-control/styles/select-control-styles.js +24 -13
- package/build-module/select-control/styles/select-control-styles.js.map +1 -1
- package/build-module/snackbar/list.js +5 -2
- package/build-module/snackbar/list.js.map +1 -1
- package/build-module/spinner/index.js +2 -0
- package/build-module/spinner/index.js.map +1 -1
- package/build-module/text/styles.js +7 -7
- package/build-module/text/styles.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control/component.js +14 -7
- package/build-module/toggle-group-control/toggle-group-control/component.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control/styles.js +5 -4
- package/build-module/toggle-group-control/toggle-group-control/styles.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control-option/component.js +17 -3
- package/build-module/toggle-group-control/toggle-group-control-option/component.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control-option-base/component.js +5 -1
- package/build-module/toggle-group-control/toggle-group-control-option-base/component.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js +16 -6
- package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control-option-icon/component.js +27 -5
- package/build-module/toggle-group-control/toggle-group-control-option-icon/component.js.map +1 -1
- package/build-module/tools-panel/styles.js +11 -11
- package/build-module/tools-panel/styles.js.map +1 -1
- package/build-module/tooltip/index.js +1 -6
- package/build-module/tooltip/index.js.map +1 -1
- package/build-module/tree-grid/index.js +4 -9
- package/build-module/tree-grid/index.js.map +1 -1
- package/build-module/ui/context/context-connect.js +1 -2
- package/build-module/ui/context/context-connect.js.map +1 -1
- package/build-module/unit-control/index.js +2 -2
- package/build-module/unit-control/index.js.map +1 -1
- package/build-module/utils/colors-values.js +52 -141
- package/build-module/utils/colors-values.js.map +1 -1
- package/build-module/utils/config-values.js +1 -1
- package/build-module/utils/config-values.js.map +1 -1
- package/build-module/utils/input/input-control.js +1 -1
- package/build-module/utils/input/input-control.js.map +1 -1
- package/build-module/utils/rtl.js +6 -4
- package/build-module/utils/rtl.js.map +1 -1
- package/build-module/utils/strings.js +37 -0
- package/build-module/utils/strings.js.map +1 -0
- package/build-style/style-rtl.css +176 -1227
- package/build-style/style.css +171 -1225
- package/build-types/card/card/component.d.ts +3 -3
- package/build-types/card/card/component.d.ts.map +1 -1
- package/build-types/card/card/hook.d.ts +7 -2
- package/build-types/card/card/hook.d.ts.map +1 -1
- package/build-types/card/card/index.d.ts +2 -2
- package/build-types/card/card/index.d.ts.map +1 -1
- package/build-types/card/card-body/component.d.ts +3 -3
- package/build-types/card/card-body/component.d.ts.map +1 -1
- package/build-types/card/card-body/hook.d.ts +5 -2
- package/build-types/card/card-body/hook.d.ts.map +1 -1
- package/build-types/card/card-body/index.d.ts +2 -2
- package/build-types/card/card-body/index.d.ts.map +1 -1
- package/build-types/card/card-divider/component.d.ts +3 -3
- package/build-types/card/card-divider/component.d.ts.map +1 -1
- package/build-types/card/card-divider/hook.d.ts +5 -2
- package/build-types/card/card-divider/hook.d.ts.map +1 -1
- package/build-types/card/card-divider/index.d.ts +2 -2
- package/build-types/card/card-divider/index.d.ts.map +1 -1
- package/build-types/card/card-footer/component.d.ts +3 -3
- package/build-types/card/card-footer/component.d.ts.map +1 -1
- package/build-types/card/card-footer/hook.d.ts +5 -2
- package/build-types/card/card-footer/hook.d.ts.map +1 -1
- package/build-types/card/card-footer/index.d.ts +2 -2
- package/build-types/card/card-footer/index.d.ts.map +1 -1
- package/build-types/card/card-header/component.d.ts +3 -3
- package/build-types/card/card-header/component.d.ts.map +1 -1
- package/build-types/card/card-header/hook.d.ts +5 -2
- package/build-types/card/card-header/hook.d.ts.map +1 -1
- package/build-types/card/card-header/index.d.ts +2 -2
- package/build-types/card/card-header/index.d.ts.map +1 -1
- package/build-types/card/card-media/component.d.ts +3 -4
- package/build-types/card/card-media/component.d.ts.map +1 -1
- package/build-types/card/card-media/hook.d.ts +6 -5
- package/build-types/card/card-media/hook.d.ts.map +1 -1
- package/build-types/card/card-media/index.d.ts +2 -2
- package/build-types/card/card-media/index.d.ts.map +1 -1
- package/build-types/card/context.d.ts +3 -2
- package/build-types/card/context.d.ts.map +1 -1
- package/build-types/card/index.d.ts +6 -6
- package/build-types/card/index.d.ts.map +1 -1
- package/build-types/card/stories/index.d.ts +12 -0
- package/build-types/card/stories/index.d.ts.map +1 -0
- package/build-types/card/styles.d.ts +20 -22
- package/build-types/card/styles.d.ts.map +1 -1
- package/build-types/card/test/index.d.ts +2 -0
- package/build-types/{flyout → card/test}/index.d.ts.map +1 -1
- package/build-types/card/types.d.ts +7 -1
- package/build-types/card/types.d.ts.map +1 -1
- package/build-types/color-palette/index.d.ts +2 -1
- package/build-types/color-palette/index.d.ts.map +1 -1
- package/build-types/color-picker/styles.d.ts +2 -2
- package/build-types/date-time/constants.d.ts +2 -0
- package/build-types/date-time/constants.d.ts.map +1 -0
- package/build-types/date-time/date/index.d.ts +3 -1
- package/build-types/date-time/date/index.d.ts.map +1 -1
- package/build-types/date-time/date/styles.d.ts +22 -8
- package/build-types/date-time/date/styles.d.ts.map +1 -1
- package/build-types/date-time/date/test/index.d.ts +1 -1
- package/build-types/date-time/date/test/index.d.ts.map +1 -1
- package/build-types/date-time/date-time/index.d.ts.map +1 -1
- package/build-types/date-time/time/index.d.ts.map +1 -1
- package/build-types/date-time/utils.d.ts +8 -0
- package/build-types/date-time/utils.d.ts.map +1 -0
- package/build-types/disabled/index.d.ts +35 -28
- package/build-types/disabled/index.d.ts.map +1 -1
- package/build-types/disabled/stories/index.d.ts +13 -0
- package/build-types/disabled/stories/index.d.ts.map +1 -0
- package/build-types/disabled/styles/disabled-styles.d.ts +2 -1
- package/build-types/disabled/styles/disabled-styles.d.ts.map +1 -1
- package/build-types/disabled/test/index.d.ts +2 -0
- package/build-types/{flyout/flyout → disabled/test}/index.d.ts.map +1 -1
- package/build-types/disabled/types.d.ts +14 -0
- package/build-types/disabled/types.d.ts.map +1 -0
- package/build-types/dropdown/index.d.ts.map +1 -1
- package/build-types/form-token-field/index.d.ts.map +1 -1
- package/build-types/form-token-field/stories/index.d.ts +1 -0
- package/build-types/form-token-field/stories/index.d.ts.map +1 -1
- package/build-types/form-token-field/test/index.d.ts +2 -0
- package/build-types/form-token-field/test/index.d.ts.map +1 -0
- package/build-types/form-token-field/types.d.ts +7 -0
- package/build-types/form-token-field/types.d.ts.map +1 -1
- package/build-types/navigable-container/menu.d.ts.map +1 -1
- package/build-types/navigator/navigator-back-button/hook.d.ts +0 -3
- package/build-types/navigator/navigator-back-button/hook.d.ts.map +1 -1
- package/build-types/navigator/navigator-button/hook.d.ts +0 -3
- package/build-types/navigator/navigator-button/hook.d.ts.map +1 -1
- package/build-types/placeholder/test/index.d.ts +2 -0
- package/build-types/placeholder/test/index.d.ts.map +1 -0
- package/build-types/popover/index.d.ts +1 -1
- package/build-types/popover/index.d.ts.map +1 -1
- package/build-types/popover/utils.d.ts +26 -69
- package/build-types/popover/utils.d.ts.map +1 -1
- package/build-types/range-control/index.d.ts +2 -2
- package/build-types/range-control/index.d.ts.map +1 -1
- package/build-types/range-control/styles/range-control-styles.d.ts +5 -2
- package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
- package/build-types/range-control/types.d.ts +2 -2
- package/build-types/range-control/types.d.ts.map +1 -1
- package/build-types/select-control/chevron-down.d.ts +4 -0
- package/build-types/select-control/chevron-down.d.ts.map +1 -0
- package/build-types/select-control/index.d.ts.map +1 -1
- package/build-types/select-control/styles/select-control-styles.d.ts +8 -0
- package/build-types/select-control/styles/select-control-styles.d.ts.map +1 -1
- package/build-types/spinner/index.d.ts.map +1 -1
- package/build-types/toggle-group-control/stories/index.d.ts +25 -0
- package/build-types/toggle-group-control/stories/index.d.ts.map +1 -0
- package/build-types/toggle-group-control/test/index.d.ts +2 -0
- package/build-types/toggle-group-control/test/index.d.ts.map +1 -0
- package/build-types/toggle-group-control/toggle-group-control/component.d.ts +6 -3
- package/build-types/toggle-group-control/toggle-group-control/component.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control/styles.d.ts +1 -0
- package/build-types/toggle-group-control/toggle-group-control/styles.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control-option/component.d.ts +6 -7
- 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.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts +4 -0
- package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control-option-icon/component.d.ts +11 -9
- 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 +23 -10
- package/build-types/toggle-group-control/types.d.ts.map +1 -1
- package/build-types/tooltip/index.d.ts.map +1 -1
- package/build-types/ui/context/context-connect.d.ts +3 -0
- package/build-types/ui/context/context-connect.d.ts.map +1 -1
- package/build-types/ui/form-group/use-form-group.d.ts +2 -2
- package/build-types/unit-control/index.d.ts +2 -1
- package/build-types/unit-control/index.d.ts.map +1 -1
- package/build-types/unit-control/types.d.ts +5 -1
- package/build-types/unit-control/types.d.ts.map +1 -1
- package/build-types/utils/colors-values.d.ts +18 -97
- package/build-types/utils/colors-values.d.ts.map +1 -1
- package/build-types/utils/rtl.d.ts.map +1 -1
- package/build-types/utils/strings.d.ts +2 -0
- package/build-types/utils/strings.d.ts.map +1 -0
- package/package.json +22 -21
- package/src/alignment-matrix-control/index.js +1 -1
- package/src/alignment-matrix-control/stories/index.js +49 -24
- package/src/alignment-matrix-control/styles/alignment-matrix-control-styles.js +1 -3
- package/src/angle-picker-control/index.js +7 -1
- package/src/angle-picker-control/stories/index.js +8 -5
- package/src/angle-picker-control/styles/angle-picker-control-styles.js +12 -3
- package/src/autocomplete/index.js +9 -18
- package/src/base-control/styles/base-control-styles.ts +1 -1
- package/src/base-field/styles.js +1 -1
- package/src/base-field/test/__snapshots__/index.js.snap +2 -2
- package/src/box-control/styles/box-control-visualizer-styles.js +0 -1
- package/src/box-control/test/index.js +8 -8
- package/src/button/test/index.js +188 -146
- package/src/card/card/{component.js → component.tsx} +13 -9
- package/src/card/card/{hook.js → hook.ts} +11 -11
- package/src/card/card/{index.js → index.ts} +0 -0
- package/src/card/card-body/{component.js → component.tsx} +13 -9
- package/src/card/card-body/{hook.js → hook.ts} +5 -5
- package/src/card/card-body/{index.js → index.ts} +0 -0
- package/src/card/card-divider/{component.js → component.tsx} +16 -10
- package/src/card/card-divider/{hook.js → hook.ts} +5 -5
- package/src/card/card-divider/{index.js → index.ts} +0 -0
- package/src/card/card-footer/{component.js → component.tsx} +13 -9
- package/src/card/card-footer/{hook.js → hook.ts} +5 -5
- package/src/card/card-footer/{index.js → index.ts} +0 -0
- package/src/card/card-header/{component.js → component.tsx} +13 -9
- package/src/card/card-header/{hook.js → hook.ts} +5 -5
- package/src/card/card-header/{index.js → index.ts} +0 -0
- package/src/card/card-media/{component.js → component.tsx} +13 -8
- package/src/card/card-media/{hook.js → hook.ts} +5 -5
- package/src/card/card-media/{index.js → index.ts} +0 -0
- package/src/card/{context.js → context.ts} +0 -0
- package/src/card/{index.js → index.ts} +0 -0
- package/src/card/stories/index.tsx +75 -0
- package/src/card/{styles.js → styles.ts} +0 -0
- package/src/card/test/__snapshots__/{index.js.snap → index.tsx.snap} +0 -0
- package/src/card/test/{index.js → index.tsx} +3 -3
- package/src/card/types.ts +8 -1
- package/src/color-list-picker/index.js +15 -3
- package/src/color-list-picker/style.scss +11 -0
- package/src/color-palette/index.js +32 -16
- package/src/color-palette/index.native.js +10 -6
- package/src/color-palette/stories/index.js +1 -1
- package/src/color-palette/test/__snapshots__/index.js.snap +17 -3
- package/src/combobox-control/index.js +6 -5
- package/src/combobox-control/stories/index.js +9 -3
- package/src/combobox-control/style.scss +0 -1
- package/src/confirm-dialog/test/index.js +85 -62
- package/src/{custom-gradient-bar → custom-gradient-picker/gradient-bar}/constants.js +0 -0
- package/src/{custom-gradient-bar → custom-gradient-picker/gradient-bar}/control-points.js +54 -50
- package/src/{custom-gradient-bar → custom-gradient-picker/gradient-bar}/index.js +0 -3
- package/src/{custom-gradient-bar → custom-gradient-picker/gradient-bar}/test/utils.js +0 -0
- package/src/{custom-gradient-bar → custom-gradient-picker/gradient-bar}/utils.js +0 -0
- package/src/custom-gradient-picker/index.js +18 -3
- package/src/custom-gradient-picker/stories/index.js +4 -3
- package/src/custom-gradient-picker/style.scss +30 -27
- package/src/custom-select-control/README.md +10 -0
- package/src/custom-select-control/index.js +22 -16
- package/src/custom-select-control/stories/index.js +1 -1
- package/src/custom-select-control/style.scss +0 -12
- package/src/custom-select-control/styles.ts +28 -0
- package/src/custom-select-control/test/index.js +4 -1
- package/src/date-time/constants.ts +1 -0
- package/src/date-time/date/index.tsx +289 -184
- package/src/date-time/date/styles.ts +86 -27
- package/src/date-time/date/test/index.tsx +18 -28
- package/src/date-time/date-time/index.tsx +3 -2
- package/src/date-time/time/index.tsx +23 -19
- package/src/date-time/utils.ts +17 -0
- package/src/dimension-control/index.js +1 -5
- package/src/disabled/index.tsx +80 -0
- package/src/disabled/stories/index.tsx +87 -0
- package/src/disabled/styles/{disabled-styles.js → disabled-styles.tsx} +0 -0
- package/src/disabled/test/index.tsx +174 -0
- package/src/disabled/types.ts +13 -0
- package/src/drop-zone/index.js +2 -3
- package/src/dropdown/index.js +3 -5
- package/src/dropdown-menu/stories/index.js +13 -2
- package/src/duotone-picker/custom-duotone-bar.js +1 -1
- package/src/duotone-picker/duotone-picker.js +34 -26
- package/src/duotone-picker/duotone-swatch.js +12 -5
- package/src/duotone-picker/stories/duotone-picker.js +66 -0
- package/src/duotone-picker/stories/duotone-swatch.js +32 -0
- package/src/focal-point-picker/index.js +10 -5
- package/src/focal-point-picker/styles/focal-point-style.js +0 -1
- package/src/focal-point-picker/test/index.js +78 -45
- package/src/font-size-picker/index.js +161 -144
- package/src/font-size-picker/stories/index.js +1 -0
- package/src/font-size-picker/style.scss +8 -5
- package/src/font-size-picker/test/index.js +13 -6
- package/src/font-size-picker/test/{util.js → utils.js} +77 -1
- package/src/font-size-picker/utils.js +38 -23
- package/src/form-token-field/README.md +1 -0
- package/src/form-token-field/index.tsx +41 -33
- package/src/form-token-field/stories/index.tsx +8 -0
- package/src/form-token-field/test/index.tsx +2106 -0
- package/src/form-token-field/types.ts +7 -0
- package/src/gradient-picker/index.js +22 -7
- package/src/gradient-picker/stories/index.js +56 -81
- package/src/guide/index.js +3 -1
- package/src/guide/page-control.js +1 -6
- package/src/guide/stories/index.js +12 -11
- package/src/guide/test/index.js +54 -37
- package/src/guide/test/page-control.js +14 -17
- package/src/higher-order/with-notices/test/index.js +4 -2
- package/src/higher-order/with-spoken-messages/test/index.js +1 -1
- package/src/item-group/styles.ts +3 -3
- package/src/menu-group/test/index.js +18 -7
- package/src/mobile/bottom-sheet/index.native.js +2 -4
- package/src/mobile/global-styles-context/utils.native.js +2 -1
- package/src/mobile/image/index.native.js +9 -30
- package/src/mobile/picker/index.android.js +10 -4
- package/src/mobile/picker/styles.native.scss +4 -4
- package/src/modal/index.js +1 -2
- package/src/modal/test/index.js +11 -9
- package/src/navigable-container/container.js +12 -18
- package/src/navigable-container/menu.js +3 -7
- package/src/navigable-container/test/menu.js +14 -11
- package/src/navigator/navigator-back-button/hook.ts +0 -3
- package/src/navigator/navigator-button/hook.ts +0 -3
- package/src/notice/list.js +12 -10
- package/src/palette-edit/index.js +1 -0
- package/src/palette-edit/styles.js +6 -5
- package/src/placeholder/README.md +1 -1
- package/src/placeholder/style.scss +65 -20
- package/src/placeholder/test/index.tsx +174 -0
- package/src/popover/index.js +133 -112
- package/src/popover/stories/index.js +17 -3
- package/src/popover/test/__snapshots__/index.js.snap +6 -6
- package/src/popover/test/index.js +129 -36
- package/src/popover/utils.js +107 -0
- package/src/range-control/index.tsx +3 -0
- package/src/range-control/styles/range-control-styles.ts +9 -4
- package/src/range-control/types.ts +5 -2
- package/src/select-control/chevron-down.tsx +25 -0
- package/src/select-control/index.tsx +6 -9
- package/src/select-control/styles/select-control-styles.ts +23 -14
- package/src/slot-fill/test/slot.js +5 -5
- package/src/snackbar/list.js +3 -2
- package/src/spinner/index.tsx +2 -0
- package/src/style.scss +0 -2
- package/src/text/styles.js +1 -1
- package/src/text/test/index.tsx +1 -1
- package/src/toggle-group-control/stories/index.tsx +127 -0
- package/src/toggle-group-control/test/__snapshots__/{index.js.snap → index.tsx.snap} +28 -22
- package/src/toggle-group-control/test/{index.js → index.tsx} +2 -4
- package/src/toggle-group-control/toggle-group-control/README.md +2 -0
- package/src/toggle-group-control/toggle-group-control/component.tsx +18 -9
- package/src/toggle-group-control/toggle-group-control/styles.ts +9 -6
- package/src/toggle-group-control/toggle-group-control-option/component.tsx +19 -3
- package/src/toggle-group-control/toggle-group-control-option-base/component.tsx +3 -0
- package/src/toggle-group-control/toggle-group-control-option-base/styles.ts +18 -0
- package/src/toggle-group-control/toggle-group-control-option-icon/README.md +6 -8
- package/src/toggle-group-control/toggle-group-control-option-icon/component.tsx +30 -7
- package/src/toggle-group-control/types.ts +74 -59
- package/src/toolbar/test/index.js +4 -4
- package/src/toolbar-group/test/index.js +9 -15
- package/src/tools-panel/styles.ts +2 -2
- package/src/tools-panel/test/index.js +3 -2
- package/src/tooltip/index.js +1 -5
- package/src/tooltip/test/index.js +188 -172
- package/src/tree-grid/index.js +4 -9
- package/src/ui/context/context-connect.ts +3 -2
- package/src/unit-control/index.tsx +2 -2
- package/src/unit-control/types.ts +10 -1
- package/src/utils/colors-values.js +42 -137
- package/src/utils/config-values.js +1 -1
- package/src/utils/input/input-control.js +6 -6
- package/src/utils/rtl.js +6 -2
- package/src/utils/strings.ts +72 -0
- package/src/utils/test/strings.js +15 -0
- package/tsconfig.json +0 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/build/custom-gradient-bar/constants.js.map +0 -1
- package/build/custom-gradient-bar/control-points.js.map +0 -1
- package/build/custom-gradient-bar/index.js.map +0 -1
- package/build/custom-gradient-bar/utils.js.map +0 -1
- package/build/date-time/date/utils.js +0 -34
- package/build/date-time/date/utils.js.map +0 -1
- package/build/swatch/index.js +0 -41
- package/build/swatch/index.js.map +0 -1
- package/build-module/custom-gradient-bar/constants.js.map +0 -1
- package/build-module/custom-gradient-bar/control-points.js.map +0 -1
- package/build-module/custom-gradient-bar/index.js.map +0 -1
- package/build-module/custom-gradient-bar/utils.js.map +0 -1
- package/build-module/date-time/date/utils.js +0 -22
- package/build-module/date-time/date/utils.js.map +0 -1
- package/build-module/swatch/index.js +0 -30
- package/build-module/swatch/index.js.map +0 -1
- package/build-types/color-picker/color-display.d.ts +0 -13
- package/build-types/color-picker/color-display.d.ts.map +0 -1
- package/build-types/date-time/date/test/utils.d.ts +0 -2
- package/build-types/date-time/date/test/utils.d.ts.map +0 -1
- package/build-types/date-time/date/utils.d.ts +0 -15
- package/build-types/date-time/date/utils.d.ts.map +0 -1
- package/build-types/flyout/context.d.ts +0 -6
- package/build-types/flyout/context.d.ts.map +0 -1
- package/build-types/flyout/flyout/component.d.ts +0 -21
- package/build-types/flyout/flyout/component.d.ts.map +0 -1
- package/build-types/flyout/flyout/hook.d.ts +0 -270
- package/build-types/flyout/flyout/hook.d.ts.map +0 -1
- package/build-types/flyout/flyout/index.d.ts +0 -3
- package/build-types/flyout/flyout-content/component.d.ts +0 -3
- package/build-types/flyout/flyout-content/component.d.ts.map +0 -1
- package/build-types/flyout/flyout-content/index.d.ts +0 -2
- package/build-types/flyout/flyout-content/index.d.ts.map +0 -1
- package/build-types/flyout/index.d.ts +0 -2
- package/build-types/flyout/styles.d.ts +0 -22
- package/build-types/flyout/styles.d.ts.map +0 -1
- package/build-types/flyout/types.d.ts +0 -80
- package/build-types/flyout/types.d.ts.map +0 -1
- package/build-types/flyout/utils.d.ts +0 -8
- package/build-types/flyout/utils.d.ts.map +0 -1
- package/build-types/form-token-field/test/lib/fixtures.d.ts +0 -26
- package/build-types/form-token-field/test/lib/fixtures.d.ts.map +0 -1
- package/build-types/form-token-field/test/lib/token-field-wrapper.d.ts +0 -21
- package/build-types/form-token-field/test/lib/token-field-wrapper.d.ts.map +0 -1
- package/build-types/swatch/index.d.ts +0 -5
- package/build-types/swatch/index.d.ts.map +0 -1
- package/build-types/swatch/types.d.ts +0 -11
- package/build-types/swatch/types.d.ts.map +0 -1
- package/build-types/utils/hooks/use-combined-ref.d.ts +0 -8
- package/build-types/utils/hooks/use-combined-ref.d.ts.map +0 -1
- package/src/card/stories/index.js +0 -209
- package/src/date-time/date/datepicker.scss +0 -863
- package/src/date-time/date/style.scss +0 -85
- package/src/date-time/date/test/utils.ts +0 -32
- package/src/date-time/date/utils.ts +0 -20
- package/src/date-time/style.scss +0 -1
- package/src/disabled/index.js +0 -55
- package/src/disabled/stories/index.js +0 -61
- package/src/disabled/test/index.js +0 -240
- package/src/form-token-field/test/index.js +0 -411
- package/src/form-token-field/test/lib/fixtures.js +0 -89
- package/src/form-token-field/test/lib/token-field-wrapper.tsx +0 -71
- package/src/menu-group/test/__snapshots__/index.js.snap +0 -23
- package/src/placeholder/test/index.js +0 -163
- package/src/swatch/index.tsx +0 -22
- package/src/swatch/style.scss +0 -21
- package/src/swatch/types.ts +0 -11
- package/src/toggle-group-control/stories/index.js +0 -203
- package/src/tools-panel/test/__snapshots__/index.js.snap +0 -210
package/build/popover/index.js
CHANGED
|
@@ -15,6 +15,8 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
15
15
|
|
|
16
16
|
var _reactDom = require("@floating-ui/react-dom");
|
|
17
17
|
|
|
18
|
+
var _framerMotion = require("framer-motion");
|
|
19
|
+
|
|
18
20
|
var _compose = require("@wordpress/compose");
|
|
19
21
|
|
|
20
22
|
var _icons = require("@wordpress/icons");
|
|
@@ -29,13 +31,14 @@ var _scrollLock = _interopRequireDefault(require("../scroll-lock"));
|
|
|
29
31
|
|
|
30
32
|
var _slotFill = require("../slot-fill");
|
|
31
33
|
|
|
32
|
-
var
|
|
34
|
+
var _utils = require("./utils");
|
|
33
35
|
|
|
34
36
|
// @ts-nocheck
|
|
35
37
|
|
|
36
38
|
/**
|
|
37
39
|
* External dependencies
|
|
38
40
|
*/
|
|
41
|
+
// eslint-disable-next-line no-restricted-imports
|
|
39
42
|
|
|
40
43
|
/**
|
|
41
44
|
* WordPress dependencies
|
|
@@ -69,56 +72,38 @@ const ArrowTriangle = props => (0, _element.createElement)(_primitives.SVG, (0,
|
|
|
69
72
|
vectorEffect: "non-scaling-stroke"
|
|
70
73
|
}));
|
|
71
74
|
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
return
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
const [a, b] = placement.split('-');
|
|
94
|
-
let x, y;
|
|
95
|
-
|
|
96
|
-
if (a === 'top' || a === 'bottom') {
|
|
97
|
-
x = a === 'top' ? 'bottom' : 'top';
|
|
98
|
-
y = 'middle';
|
|
99
|
-
|
|
100
|
-
if (b === 'start') {
|
|
101
|
-
y = 'left';
|
|
102
|
-
} else if (b === 'end') {
|
|
103
|
-
y = 'right';
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
if (a === 'left' || a === 'right') {
|
|
108
|
-
x = 'center';
|
|
109
|
-
y = a === 'left' ? 'right' : 'left';
|
|
110
|
-
|
|
111
|
-
if (b === 'start') {
|
|
112
|
-
x = 'top';
|
|
113
|
-
} else if (b === 'end') {
|
|
114
|
-
x = 'bottom';
|
|
115
|
-
}
|
|
75
|
+
const MaybeAnimatedWrapper = (0, _element.forwardRef)((_ref, forwardedRef) => {
|
|
76
|
+
let {
|
|
77
|
+
style: receivedInlineStyles,
|
|
78
|
+
placement,
|
|
79
|
+
shouldAnimate = false,
|
|
80
|
+
...props
|
|
81
|
+
} = _ref;
|
|
82
|
+
const shouldReduceMotion = (0, _framerMotion.useReducedMotion)();
|
|
83
|
+
const {
|
|
84
|
+
style: motionInlineStyles,
|
|
85
|
+
...otherMotionProps
|
|
86
|
+
} = (0, _element.useMemo)(() => (0, _utils.placementToMotionAnimationProps)(placement), [placement]);
|
|
87
|
+
|
|
88
|
+
if (shouldAnimate && !shouldReduceMotion) {
|
|
89
|
+
return (0, _element.createElement)(_framerMotion.motion.div, (0, _extends2.default)({
|
|
90
|
+
style: { ...motionInlineStyles,
|
|
91
|
+
...receivedInlineStyles
|
|
92
|
+
}
|
|
93
|
+
}, otherMotionProps, props, {
|
|
94
|
+
ref: forwardedRef
|
|
95
|
+
}));
|
|
116
96
|
}
|
|
117
97
|
|
|
118
|
-
return
|
|
119
|
-
|
|
98
|
+
return (0, _element.createElement)("div", (0, _extends2.default)({
|
|
99
|
+
style: receivedInlineStyles
|
|
100
|
+
}, props, {
|
|
101
|
+
ref: forwardedRef
|
|
102
|
+
}));
|
|
103
|
+
});
|
|
104
|
+
const slotNameContext = (0, _element.createContext)();
|
|
120
105
|
|
|
121
|
-
const Popover = (
|
|
106
|
+
const Popover = (_ref2, forwardedRef) => {
|
|
122
107
|
let {
|
|
123
108
|
range,
|
|
124
109
|
animate = true,
|
|
@@ -130,7 +115,7 @@ const Popover = (_ref, forwardedRef) => {
|
|
|
130
115
|
isAlternate,
|
|
131
116
|
position,
|
|
132
117
|
placement: placementProp = 'bottom-start',
|
|
133
|
-
offset,
|
|
118
|
+
offset: offsetProp = 0,
|
|
134
119
|
focusOnMount = 'firstElement',
|
|
135
120
|
anchorRef,
|
|
136
121
|
anchorRect,
|
|
@@ -142,7 +127,7 @@ const Popover = (_ref, forwardedRef) => {
|
|
|
142
127
|
__unstableForcePosition = false,
|
|
143
128
|
__unstableShift = false,
|
|
144
129
|
...contentProps
|
|
145
|
-
} =
|
|
130
|
+
} = _ref2;
|
|
146
131
|
|
|
147
132
|
if (range) {
|
|
148
133
|
(0, _deprecated.default)('range prop in Popover component', {
|
|
@@ -156,8 +141,8 @@ const Popover = (_ref, forwardedRef) => {
|
|
|
156
141
|
const isMobileViewport = (0, _compose.useViewportMatch)('medium', '<');
|
|
157
142
|
const isExpanded = expandOnMobile && isMobileViewport;
|
|
158
143
|
const hasArrow = !isExpanded && !noArrow;
|
|
159
|
-
const normalizedPlacementFromProps = position ? positionToPlacement(position) : placementProp;
|
|
160
|
-
const
|
|
144
|
+
const normalizedPlacementFromProps = position ? (0, _utils.positionToPlacement)(position) : placementProp;
|
|
145
|
+
const referenceOwnerDocument = (0, _element.useMemo)(() => {
|
|
161
146
|
var _documentToReturn;
|
|
162
147
|
|
|
163
148
|
let documentToReturn;
|
|
@@ -183,33 +168,25 @@ const Popover = (_ref, forwardedRef) => {
|
|
|
183
168
|
}, [anchorRef, anchorRect, getAnchorRect]);
|
|
184
169
|
/**
|
|
185
170
|
* Offsets the position of the popover when the anchor is inside an iframe.
|
|
171
|
+
*
|
|
172
|
+
* Store the offset in a ref, due to constraints with floating-ui:
|
|
173
|
+
* https://floating-ui.com/docs/react-dom#variables-inside-middleware-functions.
|
|
186
174
|
*/
|
|
187
175
|
|
|
188
|
-
const
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
frameElement
|
|
194
|
-
} = defaultView;
|
|
195
|
-
|
|
196
|
-
if (!frameElement || ownerDocument === document) {
|
|
197
|
-
return undefined;
|
|
198
|
-
}
|
|
176
|
+
const frameOffsetRef = (0, _element.useRef)((0, _utils.getFrameOffset)(referenceOwnerDocument));
|
|
177
|
+
/**
|
|
178
|
+
* Store the offset prop in a ref, due to constraints with floating-ui:
|
|
179
|
+
* https://floating-ui.com/docs/react-dom#variables-inside-middleware-functions.
|
|
180
|
+
*/
|
|
199
181
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
x: iframeRect.left,
|
|
203
|
-
y: iframeRect.top
|
|
204
|
-
};
|
|
205
|
-
}, [ownerDocument]);
|
|
206
|
-
const middleware = [frameOffset || offset ? (0, _reactDom.offset)(_ref2 => {
|
|
182
|
+
const offsetRef = (0, _element.useRef)(offsetProp);
|
|
183
|
+
const middleware = [(0, _reactDom.offset)(_ref3 => {
|
|
207
184
|
let {
|
|
208
185
|
placement: currentPlacement
|
|
209
|
-
} =
|
|
186
|
+
} = _ref3;
|
|
210
187
|
|
|
211
|
-
if (!
|
|
212
|
-
return
|
|
188
|
+
if (!frameOffsetRef.current) {
|
|
189
|
+
return offsetRef.current;
|
|
213
190
|
}
|
|
214
191
|
|
|
215
192
|
const isTopBottomPlacement = currentPlacement.includes('top') || currentPlacement.includes('bottom'); // The main axis should represent the gap between the
|
|
@@ -222,20 +199,19 @@ const Popover = (_ref, forwardedRef) => {
|
|
|
222
199
|
|
|
223
200
|
const hasBeforePlacement = currentPlacement.includes('top') || currentPlacement.includes('left');
|
|
224
201
|
const mainAxisModifier = hasBeforePlacement ? -1 : 1;
|
|
225
|
-
const normalizedOffset = offset ? offset : 0;
|
|
226
202
|
return {
|
|
227
|
-
mainAxis:
|
|
228
|
-
crossAxis:
|
|
203
|
+
mainAxis: offsetRef.current + frameOffsetRef.current[mainAxis] * mainAxisModifier,
|
|
204
|
+
crossAxis: frameOffsetRef.current[crossAxis]
|
|
229
205
|
};
|
|
230
|
-
})
|
|
206
|
+
}), __unstableForcePosition ? undefined : (0, _reactDom.flip)(), __unstableForcePosition ? undefined : (0, _reactDom.size)({
|
|
231
207
|
apply(sizeProps) {
|
|
232
208
|
const {
|
|
233
|
-
|
|
209
|
+
availableHeight
|
|
234
210
|
} = sizeProps;
|
|
235
211
|
if (!refs.floating.current) return; // Reduce the height of the popover to the available space.
|
|
236
212
|
|
|
237
213
|
Object.assign(refs.floating.current.firstChild.style, {
|
|
238
|
-
maxHeight: `${
|
|
214
|
+
maxHeight: `${availableHeight}px`,
|
|
239
215
|
overflow: 'auto'
|
|
240
216
|
});
|
|
241
217
|
}
|
|
@@ -291,7 +267,11 @@ const Popover = (_ref, forwardedRef) => {
|
|
|
291
267
|
} = (0, _reactDom.useFloating)({
|
|
292
268
|
placement: normalizedPlacementFromProps,
|
|
293
269
|
middleware
|
|
294
|
-
});
|
|
270
|
+
});
|
|
271
|
+
(0, _element.useEffect)(() => {
|
|
272
|
+
offsetRef.current = offsetProp;
|
|
273
|
+
update();
|
|
274
|
+
}, [offsetProp, update]); // Update the `reference`'s ref.
|
|
295
275
|
//
|
|
296
276
|
// In floating-ui's terms:
|
|
297
277
|
// - "reference" refers to the popover's anchor element.
|
|
@@ -357,8 +337,10 @@ const Popover = (_ref, forwardedRef) => {
|
|
|
357
337
|
return;
|
|
358
338
|
}
|
|
359
339
|
|
|
360
|
-
return (0, _reactDom.autoUpdate)(resultingReferenceRef, refs.floating.current, update);
|
|
361
|
-
|
|
340
|
+
return (0, _reactDom.autoUpdate)(resultingReferenceRef, refs.floating.current, update); // 'reference' and 'refs.floating' are refs and don't need to be listed
|
|
341
|
+
// as dependencies (see https://github.com/WordPress/gutenberg/pull/41612)
|
|
342
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
343
|
+
}, [anchorRef, anchorRect, getAnchorRect, update]); // This is only needed for a smooth transition when moving blocks.
|
|
362
344
|
|
|
363
345
|
(0, _element.useLayoutEffect)(() => {
|
|
364
346
|
if (!__unstableObserveElement) {
|
|
@@ -372,31 +354,52 @@ const Popover = (_ref, forwardedRef) => {
|
|
|
372
354
|
return () => {
|
|
373
355
|
observer.disconnect();
|
|
374
356
|
};
|
|
375
|
-
}, [__unstableObserveElement]); // If the reference element is in a different ownerDocument (e.g. iFrame),
|
|
357
|
+
}, [__unstableObserveElement, update]); // If the reference element is in a different ownerDocument (e.g. iFrame),
|
|
376
358
|
// we need to manually update the floating's position as the reference's owner
|
|
377
|
-
// document scrolls.
|
|
359
|
+
// document scrolls. Also update the frame offset if the view resizes.
|
|
378
360
|
|
|
379
361
|
(0, _element.useLayoutEffect)(() => {
|
|
380
|
-
|
|
362
|
+
var _referenceOwnerDocume;
|
|
363
|
+
|
|
364
|
+
if (referenceOwnerDocument === document) {
|
|
365
|
+
frameOffsetRef.current = undefined;
|
|
381
366
|
return;
|
|
382
367
|
}
|
|
383
368
|
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
369
|
+
const {
|
|
370
|
+
defaultView
|
|
371
|
+
} = referenceOwnerDocument;
|
|
372
|
+
referenceOwnerDocument.addEventListener('scroll', update);
|
|
373
|
+
let updateFrameOffset;
|
|
374
|
+
const hasFrameElement = !!(referenceOwnerDocument !== null && referenceOwnerDocument !== void 0 && (_referenceOwnerDocume = referenceOwnerDocument.defaultView) !== null && _referenceOwnerDocume !== void 0 && _referenceOwnerDocume.frameElement);
|
|
375
|
+
|
|
376
|
+
if (hasFrameElement) {
|
|
377
|
+
updateFrameOffset = () => {
|
|
378
|
+
frameOffsetRef.current = (0, _utils.getFrameOffset)(referenceOwnerDocument);
|
|
379
|
+
update();
|
|
380
|
+
};
|
|
388
381
|
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
382
|
+
updateFrameOffset();
|
|
383
|
+
defaultView.addEventListener('resize', updateFrameOffset);
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
return () => {
|
|
387
|
+
referenceOwnerDocument.removeEventListener('scroll', update);
|
|
388
|
+
|
|
389
|
+
if (updateFrameOffset) {
|
|
390
|
+
defaultView.removeEventListener('resize', updateFrameOffset);
|
|
391
|
+
}
|
|
392
|
+
};
|
|
393
|
+
}, [referenceOwnerDocument, update]);
|
|
393
394
|
const mergedFloatingRef = (0, _compose.useMergeRefs)([floating, dialogRef, forwardedRef]); // Disable reason: We care to capture the _bubbled_ events from inputs
|
|
394
395
|
// within popover as inferring close intent.
|
|
395
396
|
|
|
396
397
|
let content = // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
|
|
397
398
|
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
398
|
-
(0, _element.createElement)(
|
|
399
|
-
|
|
399
|
+
(0, _element.createElement)(MaybeAnimatedWrapper, (0, _extends2.default)({
|
|
400
|
+
shouldAnimate: animate && !isExpanded,
|
|
401
|
+
placement: computedPlacement,
|
|
402
|
+
className: (0, _classnames.default)('components-popover', className, {
|
|
400
403
|
'is-expanded': isExpanded,
|
|
401
404
|
'is-alternate': isAlternate
|
|
402
405
|
})
|
|
@@ -445,10 +448,10 @@ const Popover = (_ref, forwardedRef) => {
|
|
|
445
448
|
|
|
446
449
|
const PopoverContainer = (0, _element.forwardRef)(Popover);
|
|
447
450
|
|
|
448
|
-
function PopoverSlot(
|
|
451
|
+
function PopoverSlot(_ref4, ref) {
|
|
449
452
|
let {
|
|
450
453
|
name = SLOT_NAME
|
|
451
|
-
} =
|
|
454
|
+
} = _ref4;
|
|
452
455
|
return (0, _element.createElement)(_slotFill.Slot, {
|
|
453
456
|
bubblesVirtually: true,
|
|
454
457
|
name: name,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/popover/index.js"],"names":["SLOT_NAME","ArrowTriangle","props","slotNameContext","positionToPlacement","position","x","y","z","split","includes","suffix","placementToAnimationOrigin","placement","a","b","Popover","forwardedRef","range","animate","headerTitle","onClose","children","className","noArrow","isAlternate","placementProp","offset","focusOnMount","anchorRef","anchorRect","getAnchorRect","expandOnMobile","onFocusOutside","__unstableSlotName","__unstableObserveElement","__unstableForcePosition","__unstableShift","contentProps","since","version","arrowRef","anchorRefFallback","isMobileViewport","isExpanded","hasArrow","normalizedPlacementFromProps","ownerDocument","documentToReturn","top","startContainer","current","document","frameOffset","defaultView","frameElement","undefined","iframeRect","getBoundingClientRect","left","middleware","currentPlacement","isTopBottomPlacement","mainAxis","crossAxis","hasBeforePlacement","mainAxisModifier","normalizedOffset","apply","sizeProps","height","refs","floating","Object","assign","firstChild","style","maxHeight","overflow","limiter","padding","element","filter","m","slotName","slot","onDialogClose","type","event","dialogRef","dialogProps","__unstableOnClose","reference","strategy","update","computedPlacement","middlewareData","arrow","arrowData","resultingReferenceRef","topRect","bottomRect","bottom","window","DOMRect","width","rect","right","parentNode","observer","MutationObserver","observe","attributes","disconnect","addEventListener","removeEventListener","animateClassName","origin","mergedFloatingRef","content","Number","isNaN","close","join","isFinite","ref","PopoverContainer","PopoverSlot","name","Slot","__unstableSlotNameProvider","Provider"],"mappings":";;;;;;;;;AAmBA;;;;AAfA;;AACA;;AAsBA;;AAKA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AA1CA;;AACA;AACA;AACA;;AAaA;AACA;AACA;;AAkBA;AACA;AACA;;AAMA;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,EA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IAAA,KAAK,EAAG;AACPhE,MAAAA,IAAI,EAAE6D,MAAM,CAACI,QAAP,CAAiB1B,SAAjB,aAAiBA,SAAjB,uBAAiBA,SAAS,CAAE5F,CAA5B,IACF,GAAG4F,SAAS,CAAC5F,CAAG,IADd,GAEH,EAHI;AAIP2C,MAAAA,GAAG,EAAEuE,MAAM,CAACI,QAAP,CAAiB1B,SAAjB,aAAiBA,SAAjB,uBAAiBA,SAAS,CAAE3F,CAA5B,IACD,GAAG2F,SAAS,CAAC3F,CAAG,IADf,GAEF;AANI;AANT,KAeC,4BAAC,aAAD,OAfD,CAxCF,CAHD;;AAgEA,MAAK8E,IAAI,CAACwC,GAAV,EAAgB;AACfN,IAAAA,OAAO,GAAG,4BAAC,cAAD;AAAM,MAAA,IAAI,EAAGnC;AAAb,OAA0BmC,OAA1B,CAAV;AACA;;AAED,MAAK1F,SAAS,IAAIC,UAAlB,EAA+B;AAC9B,WAAOyF,OAAP;AACA;;AAED,SAAO;AAAM,IAAA,GAAG,EAAG7E;AAAZ,KAAkC6E,OAAlC,CAAP;AACA,CAlXD;;AAoXA,MAAMO,gBAAgB,GAAG,yBAAY9G,OAAZ,CAAzB;;AAEA,SAAS+G,WAAT,QAA4CF,GAA5C,EAAkD;AAAA,MAA5B;AAAEG,IAAAA,IAAI,GAAGhI;AAAT,GAA4B;AACjD,SACC,4BAAC,cAAD;AACC,IAAA,gBAAgB,MADjB;AAEC,IAAA,IAAI,EAAGgI,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,GAA8C/H,eAAe,CAACgI,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\n/**\n * WordPress dependencies\n */\nimport {\n\tuseRef,\n\tuseLayoutEffect,\n\tforwardRef,\n\tcreateContext,\n\tuseContext,\n\tuseMemo,\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 { getAnimateClassName } from '../animate';\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 slotNameContext = createContext();\n\nconst 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\t\treturn x + suffix;\n\t}\n\n\treturn y;\n};\n\nconst placementToAnimationOrigin = ( placement ) => {\n\tconst [ a, b ] = placement.split( '-' );\n\n\tlet x, y;\n\tif ( a === 'top' || a === 'bottom' ) {\n\t\tx = a === 'top' ? 'bottom' : 'top';\n\t\ty = 'middle';\n\t\tif ( b === 'start' ) {\n\t\t\ty = 'left';\n\t\t} else if ( b === 'end' ) {\n\t\t\ty = 'right';\n\t\t}\n\t}\n\n\tif ( a === 'left' || a === 'right' ) {\n\t\tx = 'center';\n\t\ty = a === 'left' ? 'right' : 'left';\n\t\tif ( b === 'start' ) {\n\t\t\tx = 'top';\n\t\t} else if ( b === 'end' ) {\n\t\t\tx = 'bottom';\n\t\t}\n\t}\n\n\treturn x + ' ' + y;\n};\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,\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__unstableObserveElement,\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 ownerDocument = 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\tconst frameOffset = useMemo( () => {\n\t\tconst { defaultView } = ownerDocument;\n\t\tconst { frameElement } = defaultView;\n\n\t\tif ( ! frameElement || ownerDocument === document ) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst iframeRect = frameElement.getBoundingClientRect();\n\t\treturn { x: iframeRect.left, y: iframeRect.top };\n\t}, [ ownerDocument ] );\n\n\tconst middleware = [\n\t\tframeOffset || offset\n\t\t\t? offsetMiddleware( ( { placement: currentPlacement } ) => {\n\t\t\t\t\tif ( ! frameOffset ) {\n\t\t\t\t\t\treturn offset;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst isTopBottomPlacement =\n\t\t\t\t\t\tcurrentPlacement.includes( 'top' ) ||\n\t\t\t\t\t\tcurrentPlacement.includes( 'bottom' );\n\n\t\t\t\t\t// The main axis should represent the gap between the\n\t\t\t\t\t// floating element and the reference element. The cross\n\t\t\t\t\t// axis is always perpendicular to the main axis.\n\t\t\t\t\tconst mainAxis = isTopBottomPlacement ? 'y' : 'x';\n\t\t\t\t\tconst crossAxis = mainAxis === 'x' ? 'y' : 'x';\n\n\t\t\t\t\t// When the popover is before the reference, subtract the offset,\n\t\t\t\t\t// of the main axis else add it.\n\t\t\t\t\tconst hasBeforePlacement =\n\t\t\t\t\t\tcurrentPlacement.includes( 'top' ) ||\n\t\t\t\t\t\tcurrentPlacement.includes( 'left' );\n\t\t\t\t\tconst mainAxisModifier = hasBeforePlacement ? -1 : 1;\n\t\t\t\t\tconst normalizedOffset = offset ? offset : 0;\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tmainAxis:\n\t\t\t\t\t\t\tnormalizedOffset +\n\t\t\t\t\t\t\tframeOffset[ mainAxis ] * mainAxisModifier,\n\t\t\t\t\t\tcrossAxis: frameOffset[ crossAxis ],\n\t\t\t\t\t};\n\t\t\t } )\n\t\t\t: undefined,\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 { height } = 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: `${ height }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\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);\n\t}, [ anchorRef, anchorRect, getAnchorRect ] );\n\n\t// This is only needed for a smooth transition when moving blocks.\n\tuseLayoutEffect( () => {\n\t\tif ( ! __unstableObserveElement ) {\n\t\t\treturn;\n\t\t}\n\t\tconst observer = new window.MutationObserver( update );\n\t\tobserver.observe( __unstableObserveElement, { attributes: true } );\n\n\t\treturn () => {\n\t\t\tobserver.disconnect();\n\t\t};\n\t}, [ __unstableObserveElement ] );\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.\n\tuseLayoutEffect( () => {\n\t\tif ( ownerDocument === document ) {\n\t\t\treturn;\n\t\t}\n\n\t\townerDocument.addEventListener( 'scroll', update );\n\t\treturn () => ownerDocument.removeEventListener( 'scroll', update );\n\t}, [ ownerDocument ] );\n\n\t/** @type {false | string} */\n\tconst animateClassName =\n\t\t!! animate &&\n\t\tgetAnimateClassName( {\n\t\t\ttype: 'appear',\n\t\t\torigin: placementToAnimationOrigin( computedPlacement ),\n\t\t} );\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<div\n\t\t\tclassName={ classnames(\n\t\t\t\t'components-popover',\n\t\t\t\tclassName,\n\t\t\t\tanimateClassName,\n\t\t\t\t{\n\t\t\t\t\t'is-expanded': isExpanded,\n\t\t\t\t\t'is-alternate': isAlternate,\n\t\t\t\t}\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</div>\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.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","__unstableObserveElement","__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","observer","MutationObserver","observe","attributes","disconnect","defaultView","addEventListener","updateFrameOffset","hasFrameElement","frameElement","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,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AP,CAAiBhC,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,CAACgD,GAAV,EAAgB;AACfP,IAAAA,OAAO,GAAG,4BAAC,cAAD;AAAM,MAAA,IAAI,EAAG1C;AAAb,OAA0B0C,OAA1B,CAAV;AACA;;AAED,MAAK7F,SAAS,IAAIC,UAAlB,EAA+B;AAC9B,WAAO4F,OAAP;AACA;;AAED,SAAO;AAAM,IAAA,GAAG,EAAGhF;AAAZ,KAAkCgF,OAAlC,CAAP;AACA,CAlYD;;AAoYA,MAAMQ,gBAAgB,GAAG,yBAAYnH,OAAZ,CAAzB;;AAEA,SAASoH,WAAT,QAA4CF,GAA5C,EAAkD;AAAA,MAA5B;AAAEG,IAAAA,IAAI,GAAGlI;AAAT,GAA4B;AACjD,SACC,4BAAC,cAAD;AACC,IAAA,gBAAgB,MADjB;AAEC,IAAA,IAAI,EAAGkI,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,GAA8CxH,eAAe,CAACyH,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__unstableObserveElement,\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);\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// This is only needed for a smooth transition when moving blocks.\n\tuseLayoutEffect( () => {\n\t\tif ( ! __unstableObserveElement ) {\n\t\t\treturn;\n\t\t}\n\t\tconst observer = new window.MutationObserver( update );\n\t\tobserver.observe( __unstableObserveElement, { attributes: true } );\n\n\t\treturn () => {\n\t\t\tobserver.disconnect();\n\t\t};\n\t}, [ __unstableObserveElement, 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\tif ( referenceOwnerDocument === document ) {\n\t\t\tframeOffsetRef.current = undefined;\n\t\t\treturn;\n\t\t}\n\n\t\tconst { defaultView } = referenceOwnerDocument;\n\n\t\treferenceOwnerDocument.addEventListener( 'scroll', update );\n\n\t\tlet updateFrameOffset;\n\t\tconst hasFrameElement =\n\t\t\t!! referenceOwnerDocument?.defaultView?.frameElement;\n\t\tif ( hasFrameElement ) {\n\t\t\tupdateFrameOffset = () => {\n\t\t\t\tframeOffsetRef.current = getFrameOffset(\n\t\t\t\t\treferenceOwnerDocument\n\t\t\t\t);\n\t\t\t\tupdate();\n\t\t\t};\n\t\t\tupdateFrameOffset();\n\t\t\tdefaultView.addEventListener( 'resize', updateFrameOffset );\n\t\t}\n\n\t\treturn () => {\n\t\t\treferenceOwnerDocument.removeEventListener( 'scroll', update );\n\n\t\t\tif ( updateFrameOffset ) {\n\t\t\t\tdefaultView.removeEventListener( 'resize', updateFrameOffset );\n\t\t\t}\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"]}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.positionToPlacement = exports.placementToMotionAnimationProps = exports.getFrameOffset = void 0;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @typedef {import('../animate').AppearOrigin} AppearOrigin
|
|
10
|
+
* @typedef {import('@floating-ui/react-dom').Placement} FloatingUIPlacement
|
|
11
|
+
* @typedef { '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
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Converts the `Popover`'s legacy "position" prop to the new "placement" prop
|
|
16
|
+
* (used by `floating-ui`).
|
|
17
|
+
*
|
|
18
|
+
* @param {LegacyPosition} position The legacy position
|
|
19
|
+
* @return {FloatingUIPlacement} The corresponding placement
|
|
20
|
+
*/
|
|
21
|
+
const positionToPlacement = position => {
|
|
22
|
+
const [x, y, z] = position.split(' ');
|
|
23
|
+
|
|
24
|
+
if (['top', 'bottom'].includes(x)) {
|
|
25
|
+
let suffix = '';
|
|
26
|
+
|
|
27
|
+
if (!!z && z === 'left' || y === 'right') {
|
|
28
|
+
suffix = '-start';
|
|
29
|
+
} else if (!!z && z === 'right' || y === 'left') {
|
|
30
|
+
suffix = '-end';
|
|
31
|
+
} // @ts-expect-error More TypeScript effort would be required to reconcile `string` and `Placement` types.
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
return x + suffix;
|
|
35
|
+
} // @ts-expect-error More TypeScript effort would be required to reconcile `string` and `Placement` types.
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
return y;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* @typedef AnimationOrigin
|
|
42
|
+
* @type {Object}
|
|
43
|
+
* @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")
|
|
44
|
+
* @property {number} originY A number between 0 and 1 (0 is top, 0.5 is center, and 1 is bottom)
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
/** @type {Object.<FloatingUIPlacement, {originX: number, originY: number}>} */
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
exports.positionToPlacement = positionToPlacement;
|
|
51
|
+
const PLACEMENT_TO_ANIMATION_ORIGIN = {
|
|
52
|
+
top: {
|
|
53
|
+
originX: 0.5,
|
|
54
|
+
originY: 1
|
|
55
|
+
},
|
|
56
|
+
// open from bottom, center
|
|
57
|
+
'top-start': {
|
|
58
|
+
originX: 0,
|
|
59
|
+
originY: 1
|
|
60
|
+
},
|
|
61
|
+
// open from bottom, left
|
|
62
|
+
'top-end': {
|
|
63
|
+
originX: 1,
|
|
64
|
+
originY: 1
|
|
65
|
+
},
|
|
66
|
+
// open from bottom, right
|
|
67
|
+
right: {
|
|
68
|
+
originX: 0,
|
|
69
|
+
originY: 0.5
|
|
70
|
+
},
|
|
71
|
+
// open from middle, left
|
|
72
|
+
'right-start': {
|
|
73
|
+
originX: 0,
|
|
74
|
+
originY: 0
|
|
75
|
+
},
|
|
76
|
+
// open from top, left
|
|
77
|
+
'right-end': {
|
|
78
|
+
originX: 0,
|
|
79
|
+
originY: 1
|
|
80
|
+
},
|
|
81
|
+
// open from bottom, left
|
|
82
|
+
bottom: {
|
|
83
|
+
originX: 0.5,
|
|
84
|
+
originY: 0
|
|
85
|
+
},
|
|
86
|
+
// open from top, center
|
|
87
|
+
'bottom-start': {
|
|
88
|
+
originX: 0,
|
|
89
|
+
originY: 0
|
|
90
|
+
},
|
|
91
|
+
// open from top, left
|
|
92
|
+
'bottom-end': {
|
|
93
|
+
originX: 1,
|
|
94
|
+
originY: 0
|
|
95
|
+
},
|
|
96
|
+
// open from top, right
|
|
97
|
+
left: {
|
|
98
|
+
originX: 1,
|
|
99
|
+
originY: 0.5
|
|
100
|
+
},
|
|
101
|
+
// open from middle, right
|
|
102
|
+
'left-start': {
|
|
103
|
+
originX: 1,
|
|
104
|
+
originY: 0
|
|
105
|
+
},
|
|
106
|
+
// open from top, right
|
|
107
|
+
'left-end': {
|
|
108
|
+
originX: 1,
|
|
109
|
+
originY: 1
|
|
110
|
+
} // open from bottom, right
|
|
111
|
+
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Given the floating-ui `placement`, compute the framer-motion props for the
|
|
115
|
+
* popover's entry animation.
|
|
116
|
+
*
|
|
117
|
+
* @param {FloatingUIPlacement} placement A placement string from floating ui
|
|
118
|
+
* @return {import('framer-motion').MotionProps} The object containing the motion props
|
|
119
|
+
*/
|
|
120
|
+
|
|
121
|
+
const placementToMotionAnimationProps = placement => {
|
|
122
|
+
const translateProp = placement.startsWith('top') || placement.startsWith('bottom') ? 'translateY' : 'translateX';
|
|
123
|
+
const translateDirection = placement.startsWith('top') || placement.startsWith('left') ? 1 : -1;
|
|
124
|
+
return {
|
|
125
|
+
style: PLACEMENT_TO_ANIMATION_ORIGIN[placement],
|
|
126
|
+
initial: {
|
|
127
|
+
opacity: 0,
|
|
128
|
+
scale: 0,
|
|
129
|
+
[translateProp]: `${2 * translateDirection}em`
|
|
130
|
+
},
|
|
131
|
+
animate: {
|
|
132
|
+
opacity: 1,
|
|
133
|
+
scale: 1,
|
|
134
|
+
[translateProp]: 0
|
|
135
|
+
},
|
|
136
|
+
transition: {
|
|
137
|
+
duration: 0.1,
|
|
138
|
+
ease: [0, 0, 0.2, 1]
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
};
|
|
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
|
+
/**
|
|
150
|
+
* Returns the offset of a document's frame element.
|
|
151
|
+
*
|
|
152
|
+
* @param {Document} document A document. This will usually be the document within an iframe.
|
|
153
|
+
*
|
|
154
|
+
* @return {FrameOffset|undefined} The offset of the document's frame element,
|
|
155
|
+
* or undefined if the document has no frame element.
|
|
156
|
+
*/
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
exports.placementToMotionAnimationProps = placementToMotionAnimationProps;
|
|
160
|
+
|
|
161
|
+
const getFrameOffset = document => {
|
|
162
|
+
var _document$defaultView;
|
|
163
|
+
|
|
164
|
+
const frameElement = document === null || document === void 0 ? void 0 : (_document$defaultView = document.defaultView) === null || _document$defaultView === void 0 ? void 0 : _document$defaultView.frameElement;
|
|
165
|
+
|
|
166
|
+
if (!frameElement) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const iframeRect = frameElement.getBoundingClientRect();
|
|
171
|
+
return {
|
|
172
|
+
x: iframeRect.left,
|
|
173
|
+
y: iframeRect.top
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
exports.getFrameOffset = getFrameOffset;
|
|
178
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +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,KAAK,MAAxC,EAAiD;AACvDI,MAAAA,MAAM,GAAG,MAAT;AACA,KANuC,CAQxC;;;AACA,WAAOL,CAAC,GAAGK,MAAX;AACA,GAbiD,CAelD;;;AACA,SAAOJ,CAAP;AACA,CAjBM;AAmBP;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;AACA,MAAMK,6BAA6B,GAAG;AACrCC,EAAAA,GAAG,EAAE;AAAEC,IAAAA,OAAO,EAAE,GAAX;AAAgBC,IAAAA,OAAO,EAAE;AAAzB,GADgC;AACF;AACnC,eAAa;AAAED,IAAAA,OAAO,EAAE,CAAX;AAAcC,IAAAA,OAAO,EAAE;AAAvB,GAFwB;AAEI;AACzC,aAAW;AAAED,IAAAA,OAAO,EAAE,CAAX;AAAcC,IAAAA,OAAO,EAAE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AEG,CAAC,CAHL;AAKA,SAAO;AACNE,IAAAA,KAAK,EAAEZ,6BAA6B,CAAEQ,SAAF,CAD9B;AAENK,IAAAA,OAAO,EAAE;AACRC,MAAAA,OAAO,EAAE,CADD;AAERC,MAAAA,KAAK,EAAE,CAFC;AAGR,OAAEN,aAAF,GAAoB,GAAG,IAAIE,kBAAoB;AAHvC,KAFH;AAONK,IAAAA,OAAO,EAAE;AAAEF,MAAAA,OAAO,EAAE,CAAX;AAAcC,MAAAA,KAAK,EAAE,CAArB;AAAwB,OAAEN,aAAF,GAAmB;AAA3C,KAPH;AAQNQ,IAAAA,UAAU,EAAE;AAAEC,MAAAA,QAAQ,EAAE,GAAZ;AAAiBC,MAAAA,IAAI,EAAE,CAAE,CAAF,EAAK,CAAL,EAAQ,GAAR,EAAa,CAAb;AAAvB;AARN,GAAP;AAUA,CApBM;AAsBP;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AACO,MAAMC,cAAc,GAAKC,QAAF,IAAgB;AAAA;;AAC7C,QAAMC,YAAY,GAAGD,QAAH,aAAGA,QAAH,gDAAGA,QAAQ,CAAEE,WAAb,0DAAG,sBAAuBD,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"]}
|