@sanity/ui 3.0.0-static.32 → 3.0.0-static.33

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.
@@ -7,7 +7,7 @@ import { box, text, textOverflow, animatedSpinnerIcon, spinner, button, buttonLo
7
7
  import { useEffectEvent } from "use-effect-event";
8
8
  import { SpinnerIcon, CloseIcon, ChevronRightIcon } from "@sanity/icons";
9
9
  import { isValidElementType } from "react-is";
10
- import { detectOverflow, flip, offset, shift, arrow, hide, useFloating, autoUpdate } from "@floating-ui/react-dom";
10
+ import { detectOverflow, autoPlacement, flip, offset, shift, arrow, hide, useFloating, autoUpdate } from "@floating-ui/react-dom";
11
11
  import { motion, AnimatePresence } from "framer-motion";
12
12
  import { createPortal } from "react-dom";
13
13
  import { assignInlineVars } from "@vanilla-extract/dynamic";
@@ -1100,6 +1100,7 @@ function Popover(props) {
1100
1100
  overflow = "hidden",
1101
1101
  padding,
1102
1102
  placement: placementProp = "bottom",
1103
+ placementStrategy = "flip",
1103
1104
  portal,
1104
1105
  preventOverflow = !0,
1105
1106
  radius = 3,
@@ -1117,12 +1118,14 @@ function Popover(props) {
1117
1118
  useImperativeHandle(forwardedRef, () => ref.current);
1118
1119
  const referenceWidthRef = useRef(void 0), middleware = useMemo(() => {
1119
1120
  const ret = [];
1120
- return (constrainSize || preventOverflow) && ret.push(flip({
1121
+ return (constrainSize || preventOverflow) && (placementStrategy === "autoPlacement" ? ret.push(autoPlacement({
1122
+ allowedPlacements: [placementProp].concat(fallbackPlacements)
1123
+ })) : ret.push(flip({
1121
1124
  boundary: floatingBoundary || void 0,
1122
1125
  fallbackPlacements,
1123
1126
  padding: DEFAULT_POPOVER_PADDING,
1124
1127
  rootBoundary
1125
- })), ret.push(offset({
1128
+ }))), ret.push(offset({
1126
1129
  mainAxis: DEFAULT_POPOVER_DISTANCE
1127
1130
  })), (constrainSize || matchReferenceWidth) && ret.push(size({
1128
1131
  apply({
@@ -1148,7 +1151,7 @@ function Popover(props) {
1148
1151
  padding: DEFAULT_POPOVER_PADDING,
1149
1152
  strategy: "referenceHidden"
1150
1153
  })), ret;
1151
- }, [animate, arrowProp, constrainSize, fallbackPlacements, floatingBoundary, margins, matchReferenceWidth, preventOverflow, referenceBoundary]), {
1154
+ }, [animate, arrowProp, constrainSize, fallbackPlacements, floatingBoundary, placementProp, placementStrategy, margins, matchReferenceWidth, preventOverflow, referenceBoundary]), {
1152
1155
  x,
1153
1156
  y,
1154
1157
  middlewareData,