@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.
- package/dist/_chunks-cjs/_visual-editing.js +6 -3
- package/dist/_chunks-cjs/_visual-editing.js.map +1 -1
- package/dist/_chunks-es/_visual-editing.mjs +7 -4
- package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
- package/dist/_visual-editing.d.mts +10 -0
- package/dist/_visual-editing.d.ts +10 -0
- package/dist/index.d.mts +10 -0
- package/dist/index.d.ts +10 -0
- package/package.json +1 -1
- package/src/core/primitives/popover/popover.tsx +30 -8
|
@@ -5,7 +5,7 @@ import { useState, useEffect, useDebugValue, useSyncExternalStore, createContext
|
|
|
5
5
|
import { ThemeProvider as ThemeProvider$1, useTheme as useTheme$1, css, styled, keyframes } from "styled-components";
|
|
6
6
|
import ReactIs, { isValidElementType } from "react-is";
|
|
7
7
|
import { SpinnerIcon, CheckmarkIcon, RemoveIcon, ChevronDownIcon, CloseIcon, ChevronRightIcon } from "@sanity/icons";
|
|
8
|
-
import { detectOverflow, flip, offset, shift, arrow, hide, useFloating, autoUpdate } from "@floating-ui/react-dom";
|
|
8
|
+
import { detectOverflow, autoPlacement, flip, offset, shift, arrow, hide, useFloating, autoUpdate } from "@floating-ui/react-dom";
|
|
9
9
|
import { motion, AnimatePresence } from "framer-motion";
|
|
10
10
|
import { ResizeObserver } from "@juggle/resize-observer";
|
|
11
11
|
import { createPortal } from "react-dom";
|
|
@@ -3538,6 +3538,7 @@ const ViewportOverlay = () => {
|
|
|
3538
3538
|
overflow = "hidden",
|
|
3539
3539
|
padding: paddingProp,
|
|
3540
3540
|
placement: placementProp = "bottom",
|
|
3541
|
+
placementStrategy = "flip",
|
|
3541
3542
|
portal,
|
|
3542
3543
|
preventOverflow = !0,
|
|
3543
3544
|
radius: radiusProp = 3,
|
|
@@ -3576,12 +3577,14 @@ const ViewportOverlay = () => {
|
|
|
3576
3577
|
}, [width, matchReferenceWidth, maxWidth, open]);
|
|
3577
3578
|
const middleware = useMemo(() => {
|
|
3578
3579
|
const ret = [];
|
|
3579
|
-
return (constrainSize || preventOverflow) && ret.push(
|
|
3580
|
+
return (constrainSize || preventOverflow) && (placementStrategy === "autoPlacement" ? ret.push(autoPlacement({
|
|
3581
|
+
allowedPlacements: [placementProp].concat(fallbackPlacements)
|
|
3582
|
+
})) : ret.push(flip({
|
|
3580
3583
|
boundary: floatingBoundary || void 0,
|
|
3581
3584
|
fallbackPlacements,
|
|
3582
3585
|
padding: DEFAULT_POPOVER_PADDING,
|
|
3583
3586
|
rootBoundary
|
|
3584
|
-
})), ret.push(offset({
|
|
3587
|
+
}))), ret.push(offset({
|
|
3585
3588
|
mainAxis: DEFAULT_POPOVER_DISTANCE
|
|
3586
3589
|
})), (constrainSize || matchReferenceWidth) && ret.push(size({
|
|
3587
3590
|
apply({
|
|
@@ -3609,7 +3612,7 @@ const ViewportOverlay = () => {
|
|
|
3609
3612
|
padding: DEFAULT_POPOVER_PADDING,
|
|
3610
3613
|
strategy: "referenceHidden"
|
|
3611
3614
|
})), ret;
|
|
3612
|
-
}, [animate, arrowProp, constrainSize, fallbackPlacements, floatingBoundary, margins, matchReferenceWidth, preventOverflow, referenceBoundary]), {
|
|
3615
|
+
}, [animate, arrowProp, constrainSize, fallbackPlacements, placementProp, placementStrategy, floatingBoundary, margins, matchReferenceWidth, preventOverflow, referenceBoundary]), {
|
|
3613
3616
|
x,
|
|
3614
3617
|
y,
|
|
3615
3618
|
middlewareData,
|