@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.
- package/dist/_chunks-cjs/_visual-editing.cjs +6 -3
- package/dist/_chunks-cjs/_visual-editing.cjs.map +1 -1
- package/dist/_chunks-es/_visual-editing.js +7 -4
- package/dist/_chunks-es/_visual-editing.js.map +1 -1
- package/dist/_visual-editing.d.cts +10 -0
- package/dist/_visual-editing.d.ts +10 -0
- package/dist/css/index.cjs +1 -1
- package/dist/css/index.cjs.map +1 -1
- package/dist/css/index.css +1 -1
- package/dist/css/index.js +1 -1
- package/dist/css/index.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
- package/src/core/Root.tsx +2 -2
- package/src/core/primitives/popover/popover.tsx +30 -8
- package/src/css/primitives/root/root.css.ts +1 -1
- package/src/css/primitives/root/root.ts +1 -1
- package/dist/css/layers.css +0 -4
- package/dist/css/primitives/popover/popover.css +0 -4
|
@@ -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(
|
|
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,
|