@sanity/ui 2.15.18 → 2.16.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.
@@ -3534,6 +3534,7 @@ const ViewportOverlay = () => {
3534
3534
  overflow = "hidden",
3535
3535
  padding: paddingProp,
3536
3536
  placement: placementProp = "bottom",
3537
+ placementStrategy = "flip",
3537
3538
  portal,
3538
3539
  preventOverflow = !0,
3539
3540
  radius: radiusProp = 3,
@@ -3572,12 +3573,14 @@ const ViewportOverlay = () => {
3572
3573
  }, [width, matchReferenceWidth, maxWidth, open]);
3573
3574
  const middleware = react.useMemo(() => {
3574
3575
  const ret = [];
3575
- return (constrainSize || preventOverflow) && ret.push(reactDom$1.flip({
3576
+ return (constrainSize || preventOverflow) && (placementStrategy === "autoPlacement" ? ret.push(reactDom$1.autoPlacement({
3577
+ allowedPlacements: [placementProp].concat(fallbackPlacements)
3578
+ })) : ret.push(reactDom$1.flip({
3576
3579
  boundary: floatingBoundary || void 0,
3577
3580
  fallbackPlacements,
3578
3581
  padding: DEFAULT_POPOVER_PADDING,
3579
3582
  rootBoundary
3580
- })), ret.push(reactDom$1.offset({
3583
+ }))), ret.push(reactDom$1.offset({
3581
3584
  mainAxis: DEFAULT_POPOVER_DISTANCE
3582
3585
  })), (constrainSize || matchReferenceWidth) && ret.push(size({
3583
3586
  apply({
@@ -3605,7 +3608,7 @@ const ViewportOverlay = () => {
3605
3608
  padding: DEFAULT_POPOVER_PADDING,
3606
3609
  strategy: "referenceHidden"
3607
3610
  })), ret;
3608
- }, [animate, arrowProp, constrainSize, fallbackPlacements, floatingBoundary, margins, matchReferenceWidth, preventOverflow, referenceBoundary]), {
3611
+ }, [animate, arrowProp, constrainSize, fallbackPlacements, placementProp, placementStrategy, floatingBoundary, margins, matchReferenceWidth, preventOverflow, referenceBoundary]), {
3609
3612
  x,
3610
3613
  y,
3611
3614
  middlewareData,