@wordpress/components 25.6.1 → 26.0.1-next.5a1d1283.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 +21 -1
- package/CONTRIBUTING.md +1 -1
- package/README.md +3 -8
- package/build/color-picker/hsv-color-picker.native.js +92 -0
- package/build/color-picker/hsv-color-picker.native.js.map +1 -0
- package/build/color-picker/hue-picker.native.js +195 -0
- package/build/color-picker/hue-picker.native.js.map +1 -0
- package/build/color-picker/index.native.js +3 -2
- package/build/color-picker/index.native.js.map +1 -1
- package/build/color-picker/saturation-picker.native.js +178 -0
- package/build/color-picker/saturation-picker.native.js.map +1 -0
- package/build/item-group/item/component.js +0 -1
- package/build/item-group/item/component.js.map +1 -1
- package/build/item-group/item-group/component.js +0 -1
- package/build/item-group/item-group/component.js.map +1 -1
- package/build/menu-item/index.js +6 -4
- package/build/menu-item/index.js.map +1 -1
- package/build/menu-item/types.js.map +1 -1
- package/build/mobile/link-settings/link-settings-navigation.native.js +1 -1
- package/build/mobile/link-settings/link-settings-navigation.native.js.map +1 -1
- package/build/navigation/index.js +0 -1
- package/build/navigation/index.js.map +1 -1
- package/build/navigator/navigator-provider/component.js +1 -2
- package/build/navigator/navigator-provider/component.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 +38 -75
- package/build/popover/index.js.map +1 -1
- package/build/popover/overlay-middlewares.js.map +1 -1
- package/build/popover/types.js.map +1 -1
- package/build/popover/utils.js +5 -50
- package/build/popover/utils.js.map +1 -1
- package/build/progress-bar/styles.js +6 -5
- package/build/progress-bar/styles.js.map +1 -1
- package/build/search-control/index.native.js +27 -24
- package/build/search-control/index.native.js.map +1 -1
- package/build/shortcut/index.js +13 -0
- package/build/shortcut/index.js.map +1 -1
- package/build/slot-fill/bubbles-virtually/slot-fill-context.js +3 -1
- package/build/slot-fill/bubbles-virtually/slot-fill-context.js.map +1 -1
- package/build/slot-fill/bubbles-virtually/slot.js +14 -8
- package/build/slot-fill/bubbles-virtually/slot.js.map +1 -1
- package/build/slot-fill/index.js +5 -0
- package/build/slot-fill/index.js.map +1 -1
- package/build/spinner/index.js +0 -1
- package/build/spinner/index.js.map +1 -1
- package/build/theme/index.js +0 -1
- package/build/theme/index.js.map +1 -1
- package/build/tools-panel/tools-panel/component.js +0 -1
- package/build/tools-panel/tools-panel/component.js.map +1 -1
- package/build/tools-panel/tools-panel-header/component.js +5 -1
- package/build/tools-panel/tools-panel-header/component.js.map +1 -1
- package/build/tree-select/index.js +0 -1
- package/build/tree-select/index.js.map +1 -1
- package/build/unit-control/index.js +0 -1
- package/build/unit-control/index.js.map +1 -1
- package/build/utils/hooks/use-cx.js +2 -1
- package/build/utils/hooks/use-cx.js.map +1 -1
- package/build/view/component.js +1 -2
- package/build/view/component.js.map +1 -1
- package/build-module/color-picker/hsv-color-picker.native.js +84 -0
- package/build-module/color-picker/hsv-color-picker.native.js.map +1 -0
- package/build-module/color-picker/hue-picker.native.js +185 -0
- package/build-module/color-picker/hue-picker.native.js.map +1 -0
- package/build-module/color-picker/index.native.js +2 -1
- package/build-module/color-picker/index.native.js.map +1 -1
- package/build-module/color-picker/saturation-picker.native.js +168 -0
- package/build-module/color-picker/saturation-picker.native.js.map +1 -0
- package/build-module/item-group/item/component.js +0 -1
- package/build-module/item-group/item/component.js.map +1 -1
- package/build-module/item-group/item-group/component.js +0 -1
- package/build-module/item-group/item-group/component.js.map +1 -1
- package/build-module/menu-item/index.js +4 -2
- package/build-module/menu-item/index.js.map +1 -1
- package/build-module/menu-item/types.js.map +1 -1
- package/build-module/mobile/link-settings/link-settings-navigation.native.js +1 -1
- package/build-module/mobile/link-settings/link-settings-navigation.native.js.map +1 -1
- package/build-module/navigation/index.js +0 -1
- package/build-module/navigation/index.js.map +1 -1
- package/build-module/navigator/navigator-provider/component.js +1 -2
- package/build-module/navigator/navigator-provider/component.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 +42 -79
- package/build-module/popover/index.js.map +1 -1
- package/build-module/popover/overlay-middlewares.js.map +1 -1
- package/build-module/popover/types.js.map +1 -1
- package/build-module/popover/utils.js +4 -47
- package/build-module/popover/utils.js.map +1 -1
- package/build-module/progress-bar/styles.js +6 -5
- package/build-module/progress-bar/styles.js.map +1 -1
- package/build-module/search-control/index.native.js +28 -25
- package/build-module/search-control/index.native.js.map +1 -1
- package/build-module/shortcut/index.js +13 -0
- package/build-module/shortcut/index.js.map +1 -1
- package/build-module/slot-fill/bubbles-virtually/slot-fill-context.js +3 -1
- package/build-module/slot-fill/bubbles-virtually/slot-fill-context.js.map +1 -1
- package/build-module/slot-fill/bubbles-virtually/slot.js +14 -8
- package/build-module/slot-fill/bubbles-virtually/slot.js.map +1 -1
- package/build-module/slot-fill/index.js +6 -1
- package/build-module/slot-fill/index.js.map +1 -1
- package/build-module/spinner/index.js +0 -1
- package/build-module/spinner/index.js.map +1 -1
- package/build-module/theme/index.js +0 -1
- package/build-module/theme/index.js.map +1 -1
- package/build-module/tools-panel/tools-panel/component.js +0 -1
- package/build-module/tools-panel/tools-panel/component.js.map +1 -1
- package/build-module/tools-panel/tools-panel-header/component.js +5 -1
- package/build-module/tools-panel/tools-panel-header/component.js.map +1 -1
- package/build-module/tree-select/index.js +0 -1
- package/build-module/tree-select/index.js.map +1 -1
- package/build-module/unit-control/index.js +0 -1
- package/build-module/unit-control/index.js.map +1 -1
- package/build-module/utils/hooks/use-cx.js +2 -1
- package/build-module/utils/hooks/use-cx.js.map +1 -1
- package/build-module/view/component.js +1 -2
- package/build-module/view/component.js.map +1 -1
- package/build-types/alignment-matrix-control/stories/index.story.d.ts +2 -2
- package/build-types/alignment-matrix-control/stories/index.story.d.ts.map +1 -1
- package/build-types/angle-picker-control/stories/index.story.d.ts +2 -2
- package/build-types/angle-picker-control/stories/index.story.d.ts.map +1 -1
- package/build-types/animate/stories/index.story.d.ts +9 -9
- package/build-types/animate/stories/index.story.d.ts.map +1 -1
- package/build-types/base-control/stories/index.story.d.ts +4 -4
- package/build-types/base-control/stories/index.story.d.ts.map +1 -1
- package/build-types/border-box-control/stories/index.story.d.ts +2 -2
- package/build-types/border-box-control/stories/index.story.d.ts.map +1 -1
- package/build-types/border-control/stories/index.story.d.ts +2 -2
- package/build-types/border-control/stories/index.story.d.ts.map +1 -1
- package/build-types/button/stories/e2e/index.story.d.ts +3 -3
- package/build-types/button/stories/e2e/index.story.d.ts.map +1 -1
- package/build-types/button/stories/index.story.d.ts +10 -9
- package/build-types/button/stories/index.story.d.ts.map +1 -1
- package/build-types/button-group/stories/index.story.d.ts +3 -3
- package/build-types/button-group/stories/index.story.d.ts.map +1 -1
- package/build-types/card/stories/index.story.d.ts +2 -2
- package/build-types/card/stories/index.story.d.ts.map +1 -1
- package/build-types/checkbox-control/stories/index.story.d.ts +4 -4
- package/build-types/checkbox-control/stories/index.story.d.ts.map +1 -1
- package/build-types/circular-option-picker/stories/index.story.d.ts +2 -2
- package/build-types/circular-option-picker/stories/index.story.d.ts.map +1 -1
- package/build-types/color-indicator/stories/index.story.d.ts +3 -3
- package/build-types/color-indicator/stories/index.story.d.ts.map +1 -1
- package/build-types/color-palette/stories/index.story.d.ts +3 -3
- package/build-types/color-palette/stories/index.story.d.ts.map +1 -1
- package/build-types/color-palette/styles.d.ts +1 -1
- package/build-types/color-picker/stories/index.story.d.ts +2 -2
- package/build-types/color-picker/stories/index.story.d.ts.map +1 -1
- package/build-types/combobox-control/stories/index.story.d.ts +2 -2
- package/build-types/combobox-control/stories/index.story.d.ts.map +1 -1
- package/build-types/custom-gradient-picker/stories/index.story.d.ts +2 -2
- package/build-types/custom-gradient-picker/stories/index.story.d.ts.map +1 -1
- package/build-types/date-time/date/styles.d.ts +1 -1
- package/build-types/date-time/stories/date-time.story.d.ts +5 -5
- package/build-types/date-time/stories/date-time.story.d.ts.map +1 -1
- package/build-types/date-time/stories/date.story.d.ts +5 -5
- package/build-types/date-time/stories/date.story.d.ts.map +1 -1
- package/build-types/date-time/stories/time.story.d.ts +3 -3
- package/build-types/date-time/stories/time.story.d.ts.map +1 -1
- package/build-types/dimension-control/stories/index.story.d.ts.map +1 -1
- package/build-types/disabled/stories/index.story.d.ts +4 -4
- package/build-types/disabled/stories/index.story.d.ts.map +1 -1
- package/build-types/divider/stories/index.story.d.ts +5 -5
- package/build-types/divider/stories/index.story.d.ts.map +1 -1
- package/build-types/draggable/stories/index.story.d.ts +4 -4
- package/build-types/draggable/stories/index.story.d.ts.map +1 -1
- package/build-types/drop-zone/stories/index.story.d.ts +2 -2
- package/build-types/drop-zone/stories/index.story.d.ts.map +1 -1
- package/build-types/dropdown/stories/index.story.d.ts +6 -5
- package/build-types/dropdown/stories/index.story.d.ts.map +1 -1
- package/build-types/dropdown-menu/stories/index.story.d.ts +2 -2
- package/build-types/dropdown-menu/stories/index.story.d.ts.map +1 -1
- package/build-types/dropdown-menu-v2/stories/index.story.d.ts +2 -2
- package/build-types/dropdown-menu-v2/stories/index.story.d.ts.map +1 -1
- package/build-types/duotone-picker/stories/duotone-picker.story.d.ts +2 -2
- package/build-types/duotone-picker/stories/duotone-picker.story.d.ts.map +1 -1
- package/build-types/duotone-picker/stories/duotone-swatch.story.d.ts +2 -2
- package/build-types/duotone-picker/stories/duotone-swatch.story.d.ts.map +1 -1
- package/build-types/elevation/stories/index.story.d.ts +5 -5
- package/build-types/elevation/stories/index.story.d.ts.map +1 -1
- package/build-types/external-link/stories/index.story.d.ts +3 -3
- package/build-types/external-link/stories/index.story.d.ts.map +1 -1
- package/build-types/flex/stories/index.story.d.ts +4 -4
- package/build-types/flex/stories/index.story.d.ts.map +1 -1
- package/build-types/focal-point-picker/stories/index.story.d.ts +2 -2
- package/build-types/focal-point-picker/stories/index.story.d.ts.map +1 -1
- package/build-types/font-size-picker/stories/e2e/index.story.d.ts +2 -2
- package/build-types/font-size-picker/stories/e2e/index.story.d.ts.map +1 -1
- package/build-types/font-size-picker/stories/index.story.d.ts +8 -8
- package/build-types/font-size-picker/stories/index.story.d.ts.map +1 -1
- package/build-types/form-file-upload/stories/index.story.d.ts +2 -2
- package/build-types/form-file-upload/stories/index.story.d.ts.map +1 -1
- package/build-types/form-toggle/stories/index.story.d.ts +3 -3
- package/build-types/form-toggle/stories/index.story.d.ts.map +1 -1
- package/build-types/form-token-field/stories/index.story.d.ts +7 -7
- package/build-types/form-token-field/stories/index.story.d.ts.map +1 -1
- package/build-types/gradient-picker/stories/index.story.d.ts +2 -2
- package/build-types/gradient-picker/stories/index.story.d.ts.map +1 -1
- package/build-types/grid/stories/index.story.d.ts +3 -3
- package/build-types/grid/stories/index.story.d.ts.map +1 -1
- package/build-types/guide/stories/index.story.d.ts +2 -2
- package/build-types/guide/stories/index.story.d.ts.map +1 -1
- package/build-types/h-stack/stories/e2e/index.story.d.ts +3 -3
- package/build-types/h-stack/stories/e2e/index.story.d.ts.map +1 -1
- package/build-types/h-stack/stories/index.story.d.ts +3 -3
- package/build-types/h-stack/stories/index.story.d.ts.map +1 -1
- package/build-types/heading/stories/index.story.d.ts +3 -3
- package/build-types/heading/stories/index.story.d.ts.map +1 -1
- package/build-types/icon/stories/index.story.d.ts +4 -4
- package/build-types/icon/stories/index.story.d.ts.map +1 -1
- package/build-types/input-control/stories/index.story.d.ts +2 -2
- package/build-types/input-control/stories/index.story.d.ts.map +1 -1
- package/build-types/item-group/item/component.d.ts +0 -1
- package/build-types/item-group/item/component.d.ts.map +1 -1
- package/build-types/item-group/item-group/component.d.ts +0 -1
- package/build-types/item-group/item-group/component.d.ts.map +1 -1
- package/build-types/item-group/stories/index.story.d.ts +6 -6
- package/build-types/item-group/stories/index.story.d.ts.map +1 -1
- package/build-types/keyboard-shortcuts/stories/index.story.d.ts +2 -2
- package/build-types/keyboard-shortcuts/stories/index.story.d.ts.map +1 -1
- package/build-types/menu-group/stories/index.story.d.ts +3 -3
- package/build-types/menu-group/stories/index.story.d.ts.map +1 -1
- package/build-types/menu-item/index.d.ts +5 -58
- package/build-types/menu-item/index.d.ts.map +1 -1
- package/build-types/menu-item/stories/index.story.d.ts +74 -0
- package/build-types/menu-item/stories/index.story.d.ts.map +1 -0
- package/build-types/menu-item/types.d.ts +3 -2
- package/build-types/menu-item/types.d.ts.map +1 -1
- package/build-types/menu-items-choice/stories/index.story.d.ts +3 -3
- package/build-types/menu-items-choice/stories/index.story.d.ts.map +1 -1
- package/build-types/modal/stories/index.story.d.ts +4 -4
- package/build-types/modal/stories/index.story.d.ts.map +1 -1
- package/build-types/navigable-container/stories/navigable-menu.story.d.ts +3 -3
- package/build-types/navigable-container/stories/navigable-menu.story.d.ts.map +1 -1
- package/build-types/navigable-container/stories/tabbable-container.story.d.ts +3 -3
- package/build-types/navigable-container/stories/tabbable-container.story.d.ts.map +1 -1
- package/build-types/navigation/index.d.ts +0 -1
- package/build-types/navigation/index.d.ts.map +1 -1
- package/build-types/navigation/stories/index.story.d.ts +2 -2
- package/build-types/navigation/stories/index.story.d.ts.map +1 -1
- package/build-types/navigation/stories/utils/controlled-state.d.ts +2 -2
- package/build-types/navigation/stories/utils/controlled-state.d.ts.map +1 -1
- package/build-types/navigation/stories/utils/default.d.ts +2 -2
- package/build-types/navigation/stories/utils/default.d.ts.map +1 -1
- package/build-types/navigation/stories/utils/group.d.ts +2 -2
- package/build-types/navigation/stories/utils/group.d.ts.map +1 -1
- package/build-types/navigation/stories/utils/hide-if-empty.d.ts +2 -2
- package/build-types/navigation/stories/utils/hide-if-empty.d.ts.map +1 -1
- package/build-types/navigation/stories/utils/more-examples.d.ts +2 -2
- package/build-types/navigation/stories/utils/more-examples.d.ts.map +1 -1
- package/build-types/navigation/stories/utils/search.d.ts +2 -2
- package/build-types/navigation/stories/utils/search.d.ts.map +1 -1
- package/build-types/navigation/styles/navigation-styles.d.ts +1 -1
- package/build-types/navigator/navigator-provider/component.d.ts +0 -1
- package/build-types/navigator/navigator-provider/component.d.ts.map +1 -1
- package/build-types/navigator/stories/index.story.d.ts +5 -5
- package/build-types/navigator/stories/index.story.d.ts.map +1 -1
- package/build-types/notice/stories/index.story.d.ts +3 -3
- package/build-types/notice/stories/index.story.d.ts.map +1 -1
- package/build-types/number-control/stories/index.story.d.ts +2 -2
- package/build-types/number-control/stories/index.story.d.ts.map +1 -1
- package/build-types/palette-edit/stories/index.story.d.ts +2 -2
- package/build-types/palette-edit/stories/index.story.d.ts.map +1 -1
- package/build-types/palette-edit/styles.d.ts +1 -1
- package/build-types/palette-edit/styles.d.ts.map +1 -1
- package/build-types/panel/stories/index.story.d.ts +6 -6
- package/build-types/panel/stories/index.story.d.ts.map +1 -1
- package/build-types/placeholder/stories/index.story.d.ts +3 -3
- package/build-types/placeholder/stories/index.story.d.ts.map +1 -1
- package/build-types/popover/index.d.ts.map +1 -1
- package/build-types/popover/overlay-middlewares.d.ts +2 -2
- package/build-types/popover/overlay-middlewares.d.ts.map +1 -1
- package/build-types/popover/stories/index.story.d.ts +7 -7
- package/build-types/popover/stories/index.story.d.ts.map +1 -1
- package/build-types/popover/types.d.ts +6 -0
- package/build-types/popover/types.d.ts.map +1 -1
- package/build-types/popover/utils.d.ts +1 -21
- package/build-types/popover/utils.d.ts.map +1 -1
- package/build-types/progress-bar/stories/index.story.d.ts +3 -3
- package/build-types/progress-bar/stories/index.story.d.ts.map +1 -1
- package/build-types/progress-bar/styles.d.ts.map +1 -1
- package/build-types/query-controls/stories/index.story.d.ts +4 -4
- package/build-types/query-controls/stories/index.story.d.ts.map +1 -1
- package/build-types/radio-control/stories/index.story.d.ts +3 -3
- package/build-types/radio-control/stories/index.story.d.ts.map +1 -1
- package/build-types/range-control/stories/index.story.d.ts +9 -9
- package/build-types/range-control/stories/index.story.d.ts.map +1 -1
- package/build-types/resizable-box/stories/index.story.d.ts +2 -2
- package/build-types/resizable-box/stories/index.story.d.ts.map +1 -1
- package/build-types/responsive-wrapper/stories/index.story.d.ts +3 -3
- package/build-types/responsive-wrapper/stories/index.story.d.ts.map +1 -1
- package/build-types/sandbox/stories/index.story.d.ts +2 -2
- package/build-types/sandbox/stories/index.story.d.ts.map +1 -1
- package/build-types/scroll-lock/stories/index.story.d.ts +3 -3
- package/build-types/scroll-lock/stories/index.story.d.ts.map +1 -1
- package/build-types/scrollable/stories/index.story.d.ts +3 -3
- package/build-types/scrollable/stories/index.story.d.ts.map +1 -1
- package/build-types/search-control/stories/index.story.d.ts +2 -2
- package/build-types/search-control/stories/index.story.d.ts.map +1 -1
- package/build-types/select-control/stories/index.story.d.ts +2 -2
- package/build-types/select-control/stories/index.story.d.ts.map +1 -1
- package/build-types/shortcut/index.d.ts +13 -0
- package/build-types/shortcut/index.d.ts.map +1 -1
- package/build-types/shortcut/stories/index.story.d.ts +13 -0
- package/build-types/shortcut/stories/index.story.d.ts.map +1 -0
- package/build-types/slot-fill/bubbles-virtually/slot-fill-context.d.ts +1 -0
- package/build-types/slot-fill/bubbles-virtually/slot-fill-context.d.ts.map +1 -1
- package/build-types/slot-fill/bubbles-virtually/slot.d.ts +1 -6
- package/build-types/slot-fill/index.d.ts +1 -1
- package/build-types/slot-fill/index.d.ts.map +1 -1
- package/build-types/snackbar/stories/index.story.d.ts +7 -7
- package/build-types/snackbar/stories/index.story.d.ts.map +1 -1
- package/build-types/snackbar/stories/list.story.d.ts +3 -3
- package/build-types/snackbar/stories/list.story.d.ts.map +1 -1
- package/build-types/spacer/stories/index.story.d.ts +3 -3
- package/build-types/spacer/stories/index.story.d.ts.map +1 -1
- package/build-types/spinner/index.d.ts +0 -1
- package/build-types/spinner/index.d.ts.map +1 -1
- package/build-types/spinner/stories/index.story.d.ts +4 -4
- package/build-types/spinner/stories/index.story.d.ts.map +1 -1
- package/build-types/surface/stories/index.story.d.ts +3 -3
- package/build-types/surface/stories/index.story.d.ts.map +1 -1
- package/build-types/tab-panel/stories/index.story.d.ts +2 -2
- package/build-types/tab-panel/stories/index.story.d.ts.map +1 -1
- package/build-types/text-control/stories/index.story.d.ts +4 -4
- package/build-types/text-control/stories/index.story.d.ts.map +1 -1
- package/build-types/text-highlight/stories/index.story.d.ts +3 -3
- package/build-types/text-highlight/stories/index.story.d.ts.map +1 -1
- package/build-types/textarea-control/stories/index.story.d.ts +3 -3
- package/build-types/textarea-control/stories/index.story.d.ts.map +1 -1
- package/build-types/theme/index.d.ts +0 -1
- package/build-types/theme/index.d.ts.map +1 -1
- package/build-types/theme/stories/index.story.d.ts +4 -4
- package/build-types/theme/stories/index.story.d.ts.map +1 -1
- package/build-types/tip/stories/index.story.d.ts +3 -3
- package/build-types/tip/stories/index.story.d.ts.map +1 -1
- package/build-types/toggle-control/stories/index.story.d.ts +2 -2
- package/build-types/toggle-control/stories/index.story.d.ts.map +1 -1
- package/build-types/toggle-group-control/stories/index.story.d.ts +6 -6
- package/build-types/toggle-group-control/stories/index.story.d.ts.map +1 -1
- package/build-types/toolbar/stories/index.story.d.ts +2 -2
- package/build-types/toolbar/stories/index.story.d.ts.map +1 -1
- package/build-types/tools-panel/stories/index.story.d.ts +8 -8
- package/build-types/tools-panel/stories/index.story.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel/component.d.ts +0 -1
- package/build-types/tools-panel/tools-panel/component.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel-header/component.d.ts.map +1 -1
- package/build-types/tree-grid/stories/index.story.d.ts +2 -2
- package/build-types/tree-grid/stories/index.story.d.ts.map +1 -1
- package/build-types/tree-select/index.d.ts +0 -1
- package/build-types/tree-select/index.d.ts.map +1 -1
- package/build-types/tree-select/stories/index.story.d.ts +2 -2
- package/build-types/tree-select/stories/index.story.d.ts.map +1 -1
- package/build-types/truncate/stories/index.story.d.ts +4 -4
- package/build-types/truncate/stories/index.story.d.ts.map +1 -1
- package/build-types/unit-control/index.d.ts +0 -1
- package/build-types/unit-control/index.d.ts.map +1 -1
- package/build-types/unit-control/stories/index.story.d.ts +7 -7
- package/build-types/unit-control/stories/index.story.d.ts.map +1 -1
- package/build-types/utils/hooks/use-cx.d.ts +2 -1
- package/build-types/utils/hooks/use-cx.d.ts.map +1 -1
- package/build-types/v-stack/stories/e2e/index.story.d.ts +3 -3
- package/build-types/v-stack/stories/e2e/index.story.d.ts.map +1 -1
- package/build-types/v-stack/stories/index.story.d.ts +2 -2
- package/build-types/v-stack/stories/index.story.d.ts.map +1 -1
- package/build-types/view/component.d.ts +0 -1
- package/build-types/view/component.d.ts.map +1 -1
- package/build-types/view/stories/index.story.d.ts +3 -3
- package/build-types/view/stories/index.story.d.ts.map +1 -1
- package/build-types/visually-hidden/stories/index.story.d.ts +5 -5
- package/build-types/visually-hidden/stories/index.story.d.ts.map +1 -1
- package/build-types/z-stack/stories/index.story.d.ts +3 -3
- package/build-types/z-stack/stories/index.story.d.ts.map +1 -1
- package/package.json +20 -20
- package/src/alignment-matrix-control/stories/index.story.tsx +7 -3
- package/src/angle-picker-control/stories/index.story.tsx +3 -3
- package/src/animate/stories/index.story.tsx +12 -10
- package/src/base-control/stories/index.story.tsx +5 -9
- package/src/border-box-control/stories/index.story.tsx +5 -9
- package/src/border-control/stories/index.story.tsx +8 -14
- package/src/button/stories/e2e/index.story.tsx +3 -3
- package/src/button/stories/index.story.tsx +10 -10
- package/src/button-group/stories/index.story.tsx +4 -6
- package/src/card/stories/index.story.tsx +5 -5
- package/src/checkbox-control/stories/index.story.tsx +7 -6
- package/src/circular-option-picker/stories/index.story.tsx +16 -4
- package/src/color-indicator/stories/index.story.tsx +4 -6
- package/src/color-palette/stories/index.story.tsx +12 -21
- package/src/color-picker/hsv-color-picker.native.js +88 -0
- package/src/color-picker/hue-picker.native.js +194 -0
- package/src/color-picker/index.native.js +2 -1
- package/src/color-picker/saturation-picker.native.js +163 -0
- package/src/color-picker/stories/index.story.tsx +3 -3
- package/src/color-picker/style.native.scss +23 -0
- package/src/combobox-control/stories/index.story.tsx +3 -3
- package/src/custom-gradient-picker/stories/index.story.tsx +3 -3
- package/src/date-time/stories/date-time.story.tsx +8 -10
- package/src/date-time/stories/date.story.tsx +8 -9
- package/src/date-time/stories/time.story.tsx +4 -4
- package/src/dimension-control/stories/index.story.tsx +3 -3
- package/src/disabled/stories/index.story.tsx +4 -4
- package/src/divider/stories/index.story.tsx +6 -6
- package/src/draggable/stories/index.story.tsx +5 -7
- package/src/drop-zone/stories/index.story.tsx +3 -3
- package/src/dropdown/stories/index.story.tsx +8 -6
- package/src/dropdown-menu/stories/index.story.tsx +3 -3
- package/src/dropdown-menu-v2/stories/index.story.tsx +24 -10
- package/src/duotone-picker/stories/duotone-picker.story.tsx +3 -6
- package/src/duotone-picker/stories/duotone-swatch.story.tsx +3 -3
- package/src/elevation/stories/index.story.tsx +7 -7
- package/src/external-link/stories/index.story.tsx +4 -6
- package/src/flex/stories/index.story.tsx +6 -6
- package/src/focal-point-picker/stories/index.story.tsx +3 -3
- package/src/font-size-picker/stories/e2e/index.story.tsx +3 -3
- package/src/font-size-picker/stories/index.story.tsx +10 -10
- package/src/form-file-upload/stories/index.story.tsx +3 -3
- package/src/form-toggle/stories/index.story.tsx +4 -7
- package/src/form-token-field/stories/index.story.tsx +10 -11
- package/src/gradient-picker/stories/index.story.tsx +3 -3
- package/src/grid/stories/index.story.tsx +4 -4
- package/src/guide/stories/index.story.tsx +3 -3
- package/src/h-stack/stories/e2e/index.story.tsx +4 -4
- package/src/h-stack/stories/index.story.tsx +4 -4
- package/src/heading/stories/index.story.tsx +3 -3
- package/src/icon/stories/index.story.tsx +5 -5
- package/src/input-control/stories/index.story.tsx +5 -3
- package/src/item-group/item/component.tsx +0 -1
- package/src/item-group/item-group/component.tsx +0 -1
- package/src/item-group/stories/index.story.tsx +11 -12
- package/src/keyboard-shortcuts/stories/index.story.tsx +3 -3
- package/src/menu-group/stories/index.story.tsx +5 -5
- package/src/menu-item/README.md +1 -1
- package/src/menu-item/index.tsx +5 -2
- package/src/menu-item/stories/index.story.tsx +80 -0
- package/src/menu-item/types.ts +3 -2
- package/src/menu-items-choice/stories/index.story.tsx +4 -6
- package/src/mobile/link-settings/link-settings-navigation.native.js +1 -1
- package/src/modal/stories/index.story.tsx +5 -10
- package/src/navigable-container/stories/navigable-menu.story.tsx +3 -3
- package/src/navigable-container/stories/tabbable-container.story.tsx +3 -3
- package/src/navigation/index.tsx +0 -1
- package/src/navigation/stories/index.story.tsx +16 -2
- package/src/navigation/stories/utils/controlled-state.tsx +2 -2
- package/src/navigation/stories/utils/default.tsx +2 -2
- package/src/navigation/stories/utils/group.tsx +2 -2
- package/src/navigation/stories/utils/hide-if-empty.tsx +2 -2
- package/src/navigation/stories/utils/more-examples.tsx +2 -2
- package/src/navigation/stories/utils/search.tsx +2 -2
- package/src/navigator/navigator-provider/component.tsx +0 -1
- package/src/navigator/stories/index.story.tsx +9 -10
- package/src/notice/stories/index.story.tsx +6 -6
- package/src/number-control/stories/index.story.tsx +3 -3
- package/src/palette-edit/stories/index.story.tsx +3 -3
- package/src/palette-edit/styles.js +0 -1
- package/src/panel/stories/index.story.tsx +9 -11
- package/src/placeholder/stories/index.story.tsx +4 -6
- package/src/popover/README.md +2 -2
- package/src/popover/index.tsx +69 -103
- package/src/popover/overlay-middlewares.tsx +2 -2
- package/src/popover/stories/index.story.tsx +8 -10
- package/src/popover/test/index.tsx +15 -1
- package/src/popover/types.ts +6 -0
- package/src/popover/utils.ts +5 -56
- package/src/progress-bar/stories/index.story.tsx +4 -6
- package/src/progress-bar/styles.ts +4 -1
- package/src/query-controls/stories/index.story.tsx +5 -6
- package/src/radio-control/stories/index.story.tsx +4 -6
- package/src/radio-group/stories/index.story.js +1 -0
- package/src/range-control/stories/index.story.tsx +12 -18
- package/src/resizable-box/stories/index.story.tsx +3 -3
- package/src/responsive-wrapper/stories/index.story.tsx +4 -5
- package/src/sandbox/stories/index.story.tsx +3 -5
- package/src/scroll-lock/stories/index.story.tsx +3 -3
- package/src/scrollable/stories/index.story.tsx +4 -4
- package/src/search-control/index.native.js +39 -27
- package/src/search-control/stories/index.story.tsx +3 -3
- package/src/select-control/stories/index.story.tsx +3 -3
- package/src/shortcut/index.tsx +13 -0
- package/src/shortcut/stories/index.story.tsx +33 -0
- package/src/slot-fill/README.md +5 -5
- package/src/slot-fill/bubbles-virtually/slot-fill-context.js +3 -0
- package/src/slot-fill/bubbles-virtually/slot.js +17 -5
- package/src/slot-fill/index.js +6 -1
- package/src/slot-fill/stories/index.story.js +2 -0
- package/src/slot-fill/test/__snapshots__/slot.js.snap +12 -4
- package/src/snackbar/stories/index.story.tsx +10 -13
- package/src/snackbar/stories/list.story.tsx +3 -3
- package/src/spacer/stories/index.story.tsx +4 -4
- package/src/spinner/index.tsx +0 -1
- package/src/spinner/stories/index.story.tsx +5 -5
- package/src/surface/stories/index.story.tsx +4 -4
- package/src/tab-panel/stories/index.story.tsx +5 -13
- package/src/tab-panel/test/index.tsx +9 -25
- package/src/text-control/stories/index.story.tsx +7 -6
- package/src/text-highlight/stories/index.story.tsx +4 -6
- package/src/textarea-control/stories/index.story.tsx +4 -6
- package/src/theme/index.tsx +0 -1
- package/src/theme/stories/index.story.tsx +5 -5
- package/src/tip/stories/index.story.tsx +4 -4
- package/src/toggle-control/stories/index.story.tsx +3 -3
- package/src/toggle-group-control/stories/index.story.tsx +17 -11
- package/src/toolbar/stories/index.story.tsx +13 -3
- package/src/tools-panel/stories/index.story.tsx +17 -12
- package/src/tools-panel/tools-panel/component.tsx +0 -1
- package/src/tools-panel/tools-panel-header/component.tsx +3 -0
- package/src/tree-grid/stories/index.story.tsx +5 -3
- package/src/tree-select/index.tsx +0 -1
- package/src/tree-select/stories/index.story.tsx +3 -3
- package/src/truncate/stories/index.story.tsx +5 -7
- package/src/unit-control/index.tsx +0 -1
- package/src/unit-control/stories/index.story.tsx +10 -9
- package/src/utils/hooks/use-cx.ts +2 -1
- package/src/v-stack/stories/e2e/index.story.tsx +4 -4
- package/src/v-stack/stories/index.story.tsx +3 -3
- package/src/view/component.tsx +0 -1
- package/src/view/stories/index.story.tsx +4 -4
- package/src/visually-hidden/stories/index.story.tsx +7 -7
- package/src/z-stack/stories/index.story.tsx +4 -4
- package/tsconfig.tsbuildinfo +1 -1
- package/build/popover/limit-shift.js +0 -129
- package/build/popover/limit-shift.js.map +0 -1
- package/build-module/popover/limit-shift.js +0 -122
- package/build-module/popover/limit-shift.js.map +0 -1
- package/build-types/popover/limit-shift.d.ts +0 -87
- package/build-types/popover/limit-shift.d.ts.map +0 -1
- package/src/popover/limit-shift.ts +0 -205
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import type {
|
|
4
|
+
import type { Meta, StoryFn } from '@storybook/react';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
@@ -16,9 +16,11 @@ import InputControl from '../../input-control';
|
|
|
16
16
|
*/
|
|
17
17
|
import { wordpress } from '@wordpress/icons';
|
|
18
18
|
|
|
19
|
-
const meta:
|
|
19
|
+
const meta: Meta< typeof Panel > = {
|
|
20
20
|
title: 'Components/Panel',
|
|
21
21
|
component: Panel,
|
|
22
|
+
// @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
|
|
23
|
+
subcomponents: { PanelRow, PanelBody },
|
|
22
24
|
argTypes: {
|
|
23
25
|
children: { control: { type: null } },
|
|
24
26
|
},
|
|
@@ -29,11 +31,9 @@ const meta: ComponentMeta< typeof Panel > = {
|
|
|
29
31
|
};
|
|
30
32
|
export default meta;
|
|
31
33
|
|
|
32
|
-
const Template:
|
|
33
|
-
<Panel { ...props } />
|
|
34
|
-
);
|
|
34
|
+
const Template: StoryFn< typeof Panel > = ( props ) => <Panel { ...props } />;
|
|
35
35
|
|
|
36
|
-
export const Default:
|
|
36
|
+
export const Default: StoryFn< typeof Panel > = Template.bind( {} );
|
|
37
37
|
Default.args = {
|
|
38
38
|
header: 'My panel',
|
|
39
39
|
children: (
|
|
@@ -68,7 +68,7 @@ Default.args = {
|
|
|
68
68
|
* `PanelRow` is a generic container for rows within a `PanelBody`.
|
|
69
69
|
* It is a flex container with a top margin for spacing.
|
|
70
70
|
*/
|
|
71
|
-
export const _PanelRow:
|
|
71
|
+
export const _PanelRow: StoryFn< typeof Panel > = Template.bind( {} );
|
|
72
72
|
_PanelRow.args = {
|
|
73
73
|
children: (
|
|
74
74
|
<PanelBody title="My Profile">
|
|
@@ -85,9 +85,7 @@ _PanelRow.args = {
|
|
|
85
85
|
),
|
|
86
86
|
};
|
|
87
87
|
|
|
88
|
-
export const DisabledSection:
|
|
89
|
-
{}
|
|
90
|
-
);
|
|
88
|
+
export const DisabledSection: StoryFn< typeof Panel > = Template.bind( {} );
|
|
91
89
|
DisabledSection.args = {
|
|
92
90
|
...Default.args,
|
|
93
91
|
children: (
|
|
@@ -99,7 +97,7 @@ DisabledSection.args = {
|
|
|
99
97
|
),
|
|
100
98
|
};
|
|
101
99
|
|
|
102
|
-
export const WithIcon:
|
|
100
|
+
export const WithIcon: StoryFn< typeof Panel > = Template.bind( {} );
|
|
103
101
|
WithIcon.args = {
|
|
104
102
|
...Default.args,
|
|
105
103
|
children: (
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import type {
|
|
4
|
+
import type { Meta, StoryFn } from '@storybook/react';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -17,7 +17,7 @@ import TextControl from '../../text-control';
|
|
|
17
17
|
|
|
18
18
|
const ICONS = { starEmpty, starFilled, styles, wordpress };
|
|
19
19
|
|
|
20
|
-
const meta:
|
|
20
|
+
const meta: Meta< typeof Placeholder > = {
|
|
21
21
|
component: Placeholder,
|
|
22
22
|
title: 'Components/Placeholder',
|
|
23
23
|
argTypes: {
|
|
@@ -37,7 +37,7 @@ const meta: ComponentMeta< typeof Placeholder > = {
|
|
|
37
37
|
};
|
|
38
38
|
export default meta;
|
|
39
39
|
|
|
40
|
-
const Template:
|
|
40
|
+
const Template: StoryFn< typeof Placeholder > = ( args ) => {
|
|
41
41
|
const [ value, setValue ] = useState( '' );
|
|
42
42
|
|
|
43
43
|
return (
|
|
@@ -55,9 +55,7 @@ const Template: ComponentStory< typeof Placeholder > = ( args ) => {
|
|
|
55
55
|
);
|
|
56
56
|
};
|
|
57
57
|
|
|
58
|
-
export const Default:
|
|
59
|
-
{}
|
|
60
|
-
);
|
|
58
|
+
export const Default: StoryFn< typeof Placeholder > = Template.bind( {} );
|
|
61
59
|
Default.args = {
|
|
62
60
|
icon: 'wordpress',
|
|
63
61
|
label: 'My Placeholder Label',
|
package/src/popover/README.md
CHANGED
|
@@ -6,7 +6,7 @@ The behavior of the popover when it exceeds the viewport's edges can be controll
|
|
|
6
6
|
|
|
7
7
|
## Usage
|
|
8
8
|
|
|
9
|
-
Render a Popover
|
|
9
|
+
Render a Popover adjacent to its container.
|
|
10
10
|
|
|
11
11
|
If a Popover is returned by your component, it will be shown. To hide the popover, simply omit it from your component's render value.
|
|
12
12
|
|
|
@@ -60,7 +60,7 @@ const MyPopover = () => {
|
|
|
60
60
|
};
|
|
61
61
|
```
|
|
62
62
|
|
|
63
|
-
If you want Popover elements to render to a specific location on the page
|
|
63
|
+
By default Popovers render at the end of the body of your document. If you want Popover elements to render to a specific location on the page, you must render a `Popover.Slot` further up the element tree:
|
|
64
64
|
|
|
65
65
|
```jsx
|
|
66
66
|
import { render } from '@wordpress/element';
|
package/src/popover/index.tsx
CHANGED
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type { ForwardedRef, SyntheticEvent, RefCallback } from 'react';
|
|
5
5
|
import classnames from 'classnames';
|
|
6
|
-
import type { Middleware, MiddlewareArguments } from '@floating-ui/react-dom';
|
|
7
6
|
import {
|
|
8
7
|
useFloating,
|
|
9
8
|
flip as flipMiddleware,
|
|
10
9
|
shift as shiftMiddleware,
|
|
10
|
+
limitShift,
|
|
11
11
|
autoUpdate,
|
|
12
12
|
arrow,
|
|
13
13
|
offset as offsetMiddleware,
|
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
useMemo,
|
|
31
31
|
useState,
|
|
32
32
|
useCallback,
|
|
33
|
+
createPortal,
|
|
33
34
|
} from '@wordpress/element';
|
|
34
35
|
import {
|
|
35
36
|
useViewportMatch,
|
|
@@ -49,8 +50,6 @@ import ScrollLock from '../scroll-lock';
|
|
|
49
50
|
import { Slot, Fill, useSlot } from '../slot-fill';
|
|
50
51
|
import {
|
|
51
52
|
computePopoverPosition,
|
|
52
|
-
getFrameOffset,
|
|
53
|
-
getFrameScale,
|
|
54
53
|
positionToPlacement,
|
|
55
54
|
placementToMotionAnimationProps,
|
|
56
55
|
getReferenceOwnerDocument,
|
|
@@ -63,7 +62,6 @@ import type {
|
|
|
63
62
|
PopoverAnchorRefReference,
|
|
64
63
|
PopoverAnchorRefTopBottom,
|
|
65
64
|
} from './types';
|
|
66
|
-
import { limitShift as customLimitShift } from './limit-shift';
|
|
67
65
|
import { overlayMiddlewares } from './overlay-middlewares';
|
|
68
66
|
|
|
69
67
|
/**
|
|
@@ -139,6 +137,20 @@ const AnimatedWrapper = forwardRef(
|
|
|
139
137
|
|
|
140
138
|
const slotNameContext = createContext< string | undefined >( undefined );
|
|
141
139
|
|
|
140
|
+
const fallbackContainerClassname = 'components-popover__fallback-container';
|
|
141
|
+
const getPopoverFallbackContainer = () => {
|
|
142
|
+
let container = document.body.querySelector(
|
|
143
|
+
'.' + fallbackContainerClassname
|
|
144
|
+
);
|
|
145
|
+
if ( ! container ) {
|
|
146
|
+
container = document.createElement( 'div' );
|
|
147
|
+
container.className = fallbackContainerClassname;
|
|
148
|
+
document.body.append( container );
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return container;
|
|
152
|
+
};
|
|
153
|
+
|
|
142
154
|
const UnforwardedPopover = (
|
|
143
155
|
props: Omit<
|
|
144
156
|
WordPressComponentProps< PopoverProps, 'div', false >,
|
|
@@ -167,6 +179,7 @@ const UnforwardedPopover = (
|
|
|
167
179
|
flip = true,
|
|
168
180
|
resize = true,
|
|
169
181
|
shift = false,
|
|
182
|
+
inline = false,
|
|
170
183
|
variant,
|
|
171
184
|
|
|
172
185
|
// Deprecated props
|
|
@@ -246,69 +259,34 @@ const UnforwardedPopover = (
|
|
|
246
259
|
? positionToPlacement( position )
|
|
247
260
|
: placementProp;
|
|
248
261
|
|
|
249
|
-
/**
|
|
250
|
-
* Offsets the position of the popover when the anchor is inside an iframe.
|
|
251
|
-
*
|
|
252
|
-
* Store the offset in a ref, due to constraints with floating-ui:
|
|
253
|
-
* https://floating-ui.com/docs/react-dom#variables-inside-middleware-functions.
|
|
254
|
-
*/
|
|
255
|
-
const frameOffsetRef = useRef( getFrameOffset( referenceOwnerDocument ) );
|
|
256
|
-
|
|
257
262
|
const middleware = [
|
|
258
263
|
...( placementProp === 'overlay' ? overlayMiddlewares() : [] ),
|
|
259
|
-
// Custom middleware which adjusts the popover's position by taking into
|
|
260
|
-
// account the offset of the anchor's iframe (if any) compared to the page.
|
|
261
|
-
{
|
|
262
|
-
name: 'frameOffset',
|
|
263
|
-
fn( { x, y }: MiddlewareArguments ) {
|
|
264
|
-
if ( ! frameOffsetRef.current ) {
|
|
265
|
-
return {
|
|
266
|
-
x,
|
|
267
|
-
y,
|
|
268
|
-
};
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
return {
|
|
272
|
-
x: x + frameOffsetRef.current.x,
|
|
273
|
-
y: y + frameOffsetRef.current.y,
|
|
274
|
-
data: {
|
|
275
|
-
// This will be used in the customLimitShift() function.
|
|
276
|
-
amount: frameOffsetRef.current,
|
|
277
|
-
},
|
|
278
|
-
};
|
|
279
|
-
},
|
|
280
|
-
},
|
|
281
264
|
offsetMiddleware( offsetProp ),
|
|
282
|
-
computedFlipProp
|
|
283
|
-
computedResizeProp
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
padding: 1, // Necessary to avoid flickering at the edge of the viewport.
|
|
306
|
-
} )
|
|
307
|
-
: undefined,
|
|
265
|
+
computedFlipProp && flipMiddleware(),
|
|
266
|
+
computedResizeProp &&
|
|
267
|
+
size( {
|
|
268
|
+
apply( sizeProps ) {
|
|
269
|
+
const { firstElementChild } = refs.floating.current ?? {};
|
|
270
|
+
|
|
271
|
+
// Only HTMLElement instances have the `style` property.
|
|
272
|
+
if ( ! ( firstElementChild instanceof HTMLElement ) )
|
|
273
|
+
return;
|
|
274
|
+
|
|
275
|
+
// Reduce the height of the popover to the available space.
|
|
276
|
+
Object.assign( firstElementChild.style, {
|
|
277
|
+
maxHeight: `${ sizeProps.availableHeight }px`,
|
|
278
|
+
overflow: 'auto',
|
|
279
|
+
} );
|
|
280
|
+
},
|
|
281
|
+
} ),
|
|
282
|
+
shift &&
|
|
283
|
+
shiftMiddleware( {
|
|
284
|
+
crossAxis: true,
|
|
285
|
+
limiter: limitShift(),
|
|
286
|
+
padding: 1, // Necessary to avoid flickering at the edge of the viewport.
|
|
287
|
+
} ),
|
|
308
288
|
arrow( { element: arrowRef } ),
|
|
309
|
-
]
|
|
310
|
-
( m: Middleware | undefined ): m is Middleware => m !== undefined
|
|
311
|
-
);
|
|
289
|
+
];
|
|
312
290
|
const slotName = useContext( slotNameContext ) || __unstableSlotName;
|
|
313
291
|
const slot = useSlot( slotName );
|
|
314
292
|
|
|
@@ -337,10 +315,6 @@ const UnforwardedPopover = (
|
|
|
337
315
|
// Positioning coordinates
|
|
338
316
|
x,
|
|
339
317
|
y,
|
|
340
|
-
// Callback refs (not regular refs). This allows the position to be updated.
|
|
341
|
-
// when either elements change.
|
|
342
|
-
reference: referenceCallbackRef,
|
|
343
|
-
floating,
|
|
344
318
|
// Object with "regular" refs to both "reference" and "floating"
|
|
345
319
|
refs,
|
|
346
320
|
// Type of CSS position property to use (absolute or fixed)
|
|
@@ -356,6 +330,7 @@ const UnforwardedPopover = (
|
|
|
356
330
|
middleware,
|
|
357
331
|
whileElementsMounted: ( referenceParam, floatingParam, updateParam ) =>
|
|
358
332
|
autoUpdate( referenceParam, floatingParam, updateParam, {
|
|
333
|
+
layoutShift: false,
|
|
359
334
|
animationFrame: true,
|
|
360
335
|
} ),
|
|
361
336
|
} );
|
|
@@ -390,17 +365,16 @@ const UnforwardedPopover = (
|
|
|
390
365
|
fallbackReferenceElement,
|
|
391
366
|
fallbackDocument: document,
|
|
392
367
|
} );
|
|
393
|
-
|
|
368
|
+
|
|
394
369
|
const resultingReferenceElement = getReferenceElement( {
|
|
395
370
|
anchor,
|
|
396
371
|
anchorRef,
|
|
397
372
|
anchorRect,
|
|
398
373
|
getAnchorRect,
|
|
399
374
|
fallbackReferenceElement,
|
|
400
|
-
scale,
|
|
401
375
|
} );
|
|
402
376
|
|
|
403
|
-
|
|
377
|
+
refs.setReference( resultingReferenceElement );
|
|
404
378
|
|
|
405
379
|
setReferenceOwnerDocument( resultingReferenceOwnerDoc );
|
|
406
380
|
}, [
|
|
@@ -413,23 +387,17 @@ const UnforwardedPopover = (
|
|
|
413
387
|
anchorRect,
|
|
414
388
|
getAnchorRect,
|
|
415
389
|
fallbackReferenceElement,
|
|
416
|
-
|
|
390
|
+
refs,
|
|
417
391
|
] );
|
|
418
392
|
|
|
419
393
|
// If the reference element is in a different ownerDocument (e.g. iFrame),
|
|
420
394
|
// we need to manually update the floating's position as the reference's owner
|
|
421
|
-
// document scrolls.
|
|
395
|
+
// document scrolls.
|
|
422
396
|
useLayoutEffect( () => {
|
|
423
397
|
if (
|
|
424
|
-
|
|
425
|
-
referenceOwnerDocument
|
|
426
|
-
// Reference and floating are in the same document.
|
|
427
|
-
referenceOwnerDocument === refs.floating.current?.ownerDocument ||
|
|
428
|
-
// The reference's document has no view (i.e. window)
|
|
429
|
-
// or frame element (ie. it's not an iframe).
|
|
430
|
-
! referenceOwnerDocument?.defaultView?.frameElement
|
|
398
|
+
! referenceOwnerDocument ||
|
|
399
|
+
! referenceOwnerDocument.defaultView
|
|
431
400
|
) {
|
|
432
|
-
frameOffsetRef.current = undefined;
|
|
433
401
|
return;
|
|
434
402
|
}
|
|
435
403
|
|
|
@@ -440,23 +408,17 @@ const UnforwardedPopover = (
|
|
|
440
408
|
? getScrollContainer( frameElement )
|
|
441
409
|
: null;
|
|
442
410
|
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
update();
|
|
446
|
-
};
|
|
447
|
-
defaultView.addEventListener( 'resize', updateFrameOffset );
|
|
448
|
-
scrollContainer?.addEventListener( 'scroll', updateFrameOffset );
|
|
449
|
-
|
|
450
|
-
updateFrameOffset();
|
|
411
|
+
defaultView.addEventListener( 'resize', update );
|
|
412
|
+
scrollContainer?.addEventListener( 'scroll', update );
|
|
451
413
|
|
|
452
414
|
return () => {
|
|
453
|
-
defaultView.removeEventListener( 'resize',
|
|
454
|
-
scrollContainer?.removeEventListener( 'scroll',
|
|
415
|
+
defaultView.removeEventListener( 'resize', update );
|
|
416
|
+
scrollContainer?.removeEventListener( 'scroll', update );
|
|
455
417
|
};
|
|
456
|
-
}, [ referenceOwnerDocument, update
|
|
418
|
+
}, [ referenceOwnerDocument, update ] );
|
|
457
419
|
|
|
458
420
|
const mergedFloatingRef = useMergeRefs( [
|
|
459
|
-
|
|
421
|
+
refs.setFloating,
|
|
460
422
|
dialogRef,
|
|
461
423
|
forwardedRef,
|
|
462
424
|
] );
|
|
@@ -527,18 +489,12 @@ const UnforwardedPopover = (
|
|
|
527
489
|
left:
|
|
528
490
|
typeof arrowData?.x !== 'undefined' &&
|
|
529
491
|
Number.isFinite( arrowData.x )
|
|
530
|
-
? `${
|
|
531
|
-
arrowData.x +
|
|
532
|
-
( frameOffsetRef.current?.x ?? 0 )
|
|
533
|
-
}px`
|
|
492
|
+
? `${ arrowData.x }px`
|
|
534
493
|
: '',
|
|
535
494
|
top:
|
|
536
495
|
typeof arrowData?.y !== 'undefined' &&
|
|
537
496
|
Number.isFinite( arrowData.y )
|
|
538
|
-
? `${
|
|
539
|
-
arrowData.y +
|
|
540
|
-
( frameOffsetRef.current?.y ?? 0 )
|
|
541
|
-
}px`
|
|
497
|
+
? `${ arrowData.y }px`
|
|
542
498
|
: '',
|
|
543
499
|
} }
|
|
544
500
|
>
|
|
@@ -548,15 +504,25 @@ const UnforwardedPopover = (
|
|
|
548
504
|
</AnimatedWrapper>
|
|
549
505
|
);
|
|
550
506
|
|
|
551
|
-
|
|
507
|
+
const shouldRenderWithinSlot = slot.ref && ! inline;
|
|
508
|
+
const hasAnchor = anchorRef || anchorRect || anchor;
|
|
509
|
+
|
|
510
|
+
if ( shouldRenderWithinSlot ) {
|
|
552
511
|
content = <Fill name={ slotName }>{ content }</Fill>;
|
|
512
|
+
} else if ( ! inline ) {
|
|
513
|
+
content = createPortal( content, getPopoverFallbackContainer() );
|
|
553
514
|
}
|
|
554
515
|
|
|
555
|
-
if (
|
|
516
|
+
if ( hasAnchor ) {
|
|
556
517
|
return content;
|
|
557
518
|
}
|
|
558
519
|
|
|
559
|
-
return
|
|
520
|
+
return (
|
|
521
|
+
<>
|
|
522
|
+
<span ref={ anchorRefFallback } />
|
|
523
|
+
{ content }
|
|
524
|
+
</>
|
|
525
|
+
);
|
|
560
526
|
};
|
|
561
527
|
|
|
562
528
|
/**
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import type {
|
|
4
|
+
import type { MiddlewareState } from '@floating-ui/react-dom';
|
|
5
5
|
import { size } from '@floating-ui/react-dom';
|
|
6
6
|
|
|
7
7
|
export function overlayMiddlewares() {
|
|
8
8
|
return [
|
|
9
9
|
{
|
|
10
10
|
name: 'overlay',
|
|
11
|
-
fn( { rects }:
|
|
11
|
+
fn( { rects }: MiddlewareState ) {
|
|
12
12
|
return rects.reference;
|
|
13
13
|
},
|
|
14
14
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import type {
|
|
4
|
+
import type { StoryFn, Meta } from '@storybook/react';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -34,7 +34,7 @@ const AVAILABLE_PLACEMENTS: PopoverProps[ 'placement' ][] = [
|
|
|
34
34
|
'overlay',
|
|
35
35
|
];
|
|
36
36
|
|
|
37
|
-
const meta:
|
|
37
|
+
const meta: Meta< typeof Popover > = {
|
|
38
38
|
title: 'Components/Popover',
|
|
39
39
|
component: Popover,
|
|
40
40
|
argTypes: {
|
|
@@ -81,7 +81,7 @@ const PopoverWithAnchor = ( args: PopoverProps ) => {
|
|
|
81
81
|
);
|
|
82
82
|
};
|
|
83
83
|
|
|
84
|
-
const Template:
|
|
84
|
+
const Template: StoryFn< typeof Popover > = ( args ) => {
|
|
85
85
|
const [ isVisible, setIsVisible ] = useState( false );
|
|
86
86
|
const toggleVisible = () => {
|
|
87
87
|
setIsVisible( ( state ) => ! state );
|
|
@@ -116,7 +116,7 @@ const Template: ComponentStory< typeof Popover > = ( args ) => {
|
|
|
116
116
|
);
|
|
117
117
|
};
|
|
118
118
|
|
|
119
|
-
export const Default:
|
|
119
|
+
export const Default: StoryFn< typeof Popover > = Template.bind( {} );
|
|
120
120
|
Default.args = {
|
|
121
121
|
children: (
|
|
122
122
|
<div style={ { width: '280px', whiteSpace: 'normal' } }>
|
|
@@ -128,7 +128,7 @@ Default.args = {
|
|
|
128
128
|
),
|
|
129
129
|
};
|
|
130
130
|
|
|
131
|
-
export const Unstyled:
|
|
131
|
+
export const Unstyled: StoryFn< typeof Popover > = Template.bind( {} );
|
|
132
132
|
Unstyled.args = {
|
|
133
133
|
children: (
|
|
134
134
|
<div style={ { width: '280px', whiteSpace: 'normal' } }>
|
|
@@ -141,7 +141,7 @@ Unstyled.args = {
|
|
|
141
141
|
variant: 'unstyled',
|
|
142
142
|
};
|
|
143
143
|
|
|
144
|
-
export const AllPlacements:
|
|
144
|
+
export const AllPlacements: StoryFn< typeof Popover > = ( {
|
|
145
145
|
children,
|
|
146
146
|
...args
|
|
147
147
|
} ) => (
|
|
@@ -194,7 +194,7 @@ AllPlacements.args = {
|
|
|
194
194
|
flip: false,
|
|
195
195
|
};
|
|
196
196
|
|
|
197
|
-
export const DynamicHeight:
|
|
197
|
+
export const DynamicHeight: StoryFn< typeof Popover > = ( {
|
|
198
198
|
children,
|
|
199
199
|
...args
|
|
200
200
|
} ) => {
|
|
@@ -246,9 +246,7 @@ DynamicHeight.args = {
|
|
|
246
246
|
children: 'Content with dynamic height',
|
|
247
247
|
};
|
|
248
248
|
|
|
249
|
-
export const WithSlotOutsideIframe:
|
|
250
|
-
args
|
|
251
|
-
) => {
|
|
249
|
+
export const WithSlotOutsideIframe: StoryFn< typeof Popover > = ( args ) => {
|
|
252
250
|
return <PopoverInsideIframeRenderedInExternalSlot { ...args } />;
|
|
253
251
|
};
|
|
254
252
|
WithSlotOutsideIframe.args = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { render, screen, waitFor } from '@testing-library/react';
|
|
4
|
+
import { render, screen, waitFor, getByText } from '@testing-library/react';
|
|
5
5
|
import type { CSSProperties } from 'react';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -112,6 +112,20 @@ describe( 'Popover', () => {
|
|
|
112
112
|
expect( screen.getByRole( 'tooltip' ) ).toBeVisible()
|
|
113
113
|
);
|
|
114
114
|
} );
|
|
115
|
+
|
|
116
|
+
it( 'should render inline regardless of slot name', async () => {
|
|
117
|
+
const { container } = render(
|
|
118
|
+
<Popover inline __unstableSlotName="Popover">
|
|
119
|
+
Hello
|
|
120
|
+
</Popover>
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
await waitFor( () =>
|
|
124
|
+
// We want to explicitly check if it's within the container.
|
|
125
|
+
// eslint-disable-next-line testing-library/prefer-screen-queries
|
|
126
|
+
expect( getByText( container, 'Hello' ) ).toBeVisible()
|
|
127
|
+
);
|
|
128
|
+
} );
|
|
115
129
|
} );
|
|
116
130
|
|
|
117
131
|
describe( 'anchor', () => {
|
package/src/popover/types.ts
CHANGED
|
@@ -150,6 +150,12 @@ export type PopoverProps = {
|
|
|
150
150
|
* @default undefined
|
|
151
151
|
*/
|
|
152
152
|
variant?: 'unstyled' | 'toolbar';
|
|
153
|
+
/**
|
|
154
|
+
* Whether to render the popover inline or within the slot.
|
|
155
|
+
*
|
|
156
|
+
* @default false
|
|
157
|
+
*/
|
|
158
|
+
inline?: boolean;
|
|
153
159
|
// Deprecated props
|
|
154
160
|
/**
|
|
155
161
|
* Prevent the popover from flipping and resizing when meeting the viewport
|
package/src/popover/utils.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
// eslint-disable-next-line no-restricted-imports
|
|
5
5
|
import type { MotionProps } from 'framer-motion';
|
|
6
|
-
import type { ReferenceType } from '@floating-ui/react-dom';
|
|
6
|
+
import type { ReferenceType, VirtualElement } from '@floating-ui/react-dom';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Internal dependencies
|
|
@@ -139,42 +139,6 @@ export const placementToMotionAnimationProps = (
|
|
|
139
139
|
};
|
|
140
140
|
};
|
|
141
141
|
|
|
142
|
-
/**
|
|
143
|
-
* Returns the offset of a document's frame element.
|
|
144
|
-
*
|
|
145
|
-
* @param document The iframe's owner document.
|
|
146
|
-
*
|
|
147
|
-
* @return The offset of the document's frame element, or undefined if the
|
|
148
|
-
* document has no frame element.
|
|
149
|
-
*/
|
|
150
|
-
export const getFrameOffset = (
|
|
151
|
-
document?: Document
|
|
152
|
-
): { x: number; y: number } | undefined => {
|
|
153
|
-
const frameElement = document?.defaultView?.frameElement;
|
|
154
|
-
if ( ! frameElement ) {
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
const iframeRect = frameElement.getBoundingClientRect();
|
|
158
|
-
return { x: iframeRect.left, y: iframeRect.top };
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
export const getFrameScale = (
|
|
162
|
-
document?: Document
|
|
163
|
-
): {
|
|
164
|
-
x: number;
|
|
165
|
-
y: number;
|
|
166
|
-
} => {
|
|
167
|
-
const frameElement = document?.defaultView?.frameElement as HTMLElement;
|
|
168
|
-
if ( ! frameElement ) {
|
|
169
|
-
return { x: 1, y: 1 };
|
|
170
|
-
}
|
|
171
|
-
const rect = frameElement.getBoundingClientRect();
|
|
172
|
-
return {
|
|
173
|
-
x: rect.width / frameElement.offsetWidth,
|
|
174
|
-
y: rect.height / frameElement.offsetHeight,
|
|
175
|
-
};
|
|
176
|
-
};
|
|
177
|
-
|
|
178
142
|
export const getReferenceOwnerDocument = ( {
|
|
179
143
|
anchor,
|
|
180
144
|
anchorRef,
|
|
@@ -197,7 +161,10 @@ export const getReferenceOwnerDocument = ( {
|
|
|
197
161
|
// with the `getBoundingClientRect()` function (like real elements).
|
|
198
162
|
// See https://floating-ui.com/docs/virtual-elements for more info.
|
|
199
163
|
let resultingReferenceOwnerDoc;
|
|
200
|
-
if ( anchor ) {
|
|
164
|
+
if ( ( anchor as VirtualElement )?.contextElement ) {
|
|
165
|
+
resultingReferenceOwnerDoc = ( anchor as VirtualElement ).contextElement
|
|
166
|
+
?.ownerDocument;
|
|
167
|
+
} else if ( anchor ) {
|
|
201
168
|
resultingReferenceOwnerDoc = anchor.ownerDocument;
|
|
202
169
|
} else if ( ( anchorRef as PopoverAnchorRefTopBottom | undefined )?.top ) {
|
|
203
170
|
resultingReferenceOwnerDoc = ( anchorRef as PopoverAnchorRefTopBottom )
|
|
@@ -231,13 +198,11 @@ export const getReferenceElement = ( {
|
|
|
231
198
|
anchorRect,
|
|
232
199
|
getAnchorRect,
|
|
233
200
|
fallbackReferenceElement,
|
|
234
|
-
scale,
|
|
235
201
|
}: Pick<
|
|
236
202
|
PopoverProps,
|
|
237
203
|
'anchorRef' | 'anchorRect' | 'getAnchorRect' | 'anchor'
|
|
238
204
|
> & {
|
|
239
205
|
fallbackReferenceElement: Element | null;
|
|
240
|
-
scale: { x: number; y: number };
|
|
241
206
|
} ): ReferenceType | null => {
|
|
242
207
|
let referenceElement = null;
|
|
243
208
|
|
|
@@ -299,22 +264,6 @@ export const getReferenceElement = ( {
|
|
|
299
264
|
referenceElement = fallbackReferenceElement.parentElement;
|
|
300
265
|
}
|
|
301
266
|
|
|
302
|
-
if ( referenceElement && ( scale.x !== 1 || scale.y !== 1 ) ) {
|
|
303
|
-
// If the popover is inside an iframe, the coordinates of the
|
|
304
|
-
// reference element need to be scaled to match the iframe's scale.
|
|
305
|
-
const rect = referenceElement.getBoundingClientRect();
|
|
306
|
-
referenceElement = {
|
|
307
|
-
getBoundingClientRect() {
|
|
308
|
-
return new window.DOMRect(
|
|
309
|
-
rect.x * scale.x,
|
|
310
|
-
rect.y * scale.y,
|
|
311
|
-
rect.width * scale.x,
|
|
312
|
-
rect.height * scale.y
|
|
313
|
-
);
|
|
314
|
-
},
|
|
315
|
-
};
|
|
316
|
-
}
|
|
317
|
-
|
|
318
267
|
// Convert any `undefined` value to `null`.
|
|
319
268
|
return referenceElement ?? null;
|
|
320
269
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import type {
|
|
4
|
+
import type { Meta, StoryFn } from '@storybook/react';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
8
8
|
*/
|
|
9
9
|
import { ProgressBar } from '..';
|
|
10
10
|
|
|
11
|
-
const meta:
|
|
11
|
+
const meta: Meta< typeof ProgressBar > = {
|
|
12
12
|
component: ProgressBar,
|
|
13
13
|
title: 'Components (Experimental)/ProgressBar',
|
|
14
14
|
argTypes: {
|
|
@@ -23,11 +23,9 @@ const meta: ComponentMeta< typeof ProgressBar > = {
|
|
|
23
23
|
};
|
|
24
24
|
export default meta;
|
|
25
25
|
|
|
26
|
-
const Template:
|
|
26
|
+
const Template: StoryFn< typeof ProgressBar > = ( { ...args } ) => {
|
|
27
27
|
return <ProgressBar { ...args } />;
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
export const Default:
|
|
31
|
-
{}
|
|
32
|
-
);
|
|
30
|
+
export const Default: StoryFn< typeof ProgressBar > = Template.bind( {} );
|
|
33
31
|
Default.args = {};
|