@sanity/ui 3.0.0-static.13 → 3.0.0-static.14
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 +63 -65
- package/dist/_chunks-cjs/_visual-editing.js.map +1 -1
- package/dist/_chunks-es/_visual-editing.mjs +63 -65
- package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/src/ui/primitives/popover/popover.tsx +7 -6
- package/src/ui/primitives/popover/{popoverCard.tsx → popoverLayer.tsx} +18 -21
- package/src/ui/primitives/tooltip/tooltip.tsx +20 -24
- package/src/ui/primitives/tooltip/{tooltipCard.tsx → tooltipLayer.tsx} +16 -19
|
@@ -1688,9 +1688,9 @@ function size(options) {
|
|
|
1688
1688
|
}
|
|
1689
1689
|
};
|
|
1690
1690
|
}
|
|
1691
|
-
const
|
|
1692
|
-
function
|
|
1693
|
-
const $ = c(
|
|
1691
|
+
const DEFAULT_POPOVER_LAYER_ELEMENT = "div", MotionLayer$1 = motion.create(Layer);
|
|
1692
|
+
function PopoverLayer(props) {
|
|
1693
|
+
const $ = c(67), t0 = props;
|
|
1694
1694
|
let animate, arrow2, arrowRef, arrowX, arrowY, children, marginsProp, maxWidth, originX, originY, overflow, padding, placement, radius, referenceWidth, rest, shadow, strategy, style, t1, t2, xProp, yProp;
|
|
1695
1695
|
$[0] !== t0 ? ({
|
|
1696
1696
|
__unstable_margins: marginsProp,
|
|
@@ -1717,56 +1717,54 @@ function PopoverCard(props) {
|
|
|
1717
1717
|
y: yProp,
|
|
1718
1718
|
...rest
|
|
1719
1719
|
} = t0, $[0] = t0, $[1] = animate, $[2] = arrow2, $[3] = arrowRef, $[4] = arrowX, $[5] = arrowY, $[6] = children, $[7] = marginsProp, $[8] = maxWidth, $[9] = originX, $[10] = originY, $[11] = overflow, $[12] = padding, $[13] = placement, $[14] = radius, $[15] = referenceWidth, $[16] = rest, $[17] = shadow, $[18] = strategy, $[19] = style, $[20] = t1, $[21] = t2, $[22] = xProp, $[23] = yProp) : (animate = $[1], arrow2 = $[2], arrowRef = $[3], arrowX = $[4], arrowY = $[5], children = $[6], marginsProp = $[7], maxWidth = $[8], originX = $[9], originY = $[10], overflow = $[11], padding = $[12], placement = $[13], radius = $[14], referenceWidth = $[15], rest = $[16], shadow = $[17], strategy = $[18], style = $[19], t1 = $[20], t2 = $[21], xProp = $[22], yProp = $[23]);
|
|
1720
|
-
const as = t1 === void 0 ?
|
|
1720
|
+
const as = t1 === void 0 ? DEFAULT_POPOVER_LAYER_ELEMENT : t1, tone = t2 === void 0 ? "inherit" : t2;
|
|
1721
1721
|
let t3;
|
|
1722
1722
|
t3 = marginsProp || DEFAULT_POPOVER_MARGINS;
|
|
1723
1723
|
const margins = t3, x = (xProp ?? 0) + margins[3], y = (yProp ?? 0) + margins[0];
|
|
1724
1724
|
let t4;
|
|
1725
|
-
const t5 =
|
|
1726
|
-
let
|
|
1727
|
-
$[24] !== originX || $[25] !== originY || $[26] !== referenceWidth || $[27] !==
|
|
1725
|
+
const t5 = animate ? "transform" : void 0;
|
|
1726
|
+
let t6;
|
|
1727
|
+
$[24] !== originX || $[25] !== originY || $[26] !== referenceWidth || $[27] !== style || $[28] !== t5 || $[29] !== x || $[30] !== y ? (t6 = {
|
|
1728
1728
|
left: x,
|
|
1729
1729
|
originX,
|
|
1730
1730
|
originY,
|
|
1731
|
-
position: strategy,
|
|
1732
1731
|
top: y,
|
|
1733
1732
|
width: referenceWidth,
|
|
1734
|
-
|
|
1735
|
-
willChange: t6,
|
|
1733
|
+
willChange: t5,
|
|
1736
1734
|
...style
|
|
1737
|
-
}, $[24] = originX, $[25] = originY, $[26] = referenceWidth, $[27] =
|
|
1735
|
+
}, $[24] = originX, $[25] = originY, $[26] = referenceWidth, $[27] = style, $[28] = t5, $[29] = x, $[30] = y, $[31] = t6) : t6 = $[31], t4 = t6;
|
|
1738
1736
|
const rootStyle = t4;
|
|
1739
|
-
let
|
|
1740
|
-
const
|
|
1741
|
-
let
|
|
1742
|
-
$[
|
|
1743
|
-
left:
|
|
1744
|
-
top:
|
|
1737
|
+
let t7;
|
|
1738
|
+
const t8 = arrowX !== null ? arrowX : void 0, t9 = arrowY !== null ? arrowY : void 0;
|
|
1739
|
+
let t10;
|
|
1740
|
+
$[32] !== t8 || $[33] !== t9 ? (t10 = {
|
|
1741
|
+
left: t8,
|
|
1742
|
+
top: t9,
|
|
1745
1743
|
right: void 0,
|
|
1746
1744
|
bottom: void 0
|
|
1747
|
-
}, $[
|
|
1748
|
-
const arrowStyle =
|
|
1745
|
+
}, $[32] = t8, $[33] = t9, $[34] = t10) : t10 = $[34], t7 = t10;
|
|
1746
|
+
const arrowStyle = t7;
|
|
1747
|
+
let t11;
|
|
1748
|
+
$[35] === Symbol.for("react.memo_cache_sentinel") ? (t11 = popoverCard(), $[35] = t11) : t11 = $[35];
|
|
1749
1749
|
let t12;
|
|
1750
|
-
$[
|
|
1750
|
+
$[36] !== animate ? (t12 = animate ? ["hidden", "initial"] : void 0, $[36] = animate, $[37] = t12) : t12 = $[37];
|
|
1751
1751
|
let t13;
|
|
1752
|
-
$[38] !== animate ? (t13 = animate ? ["
|
|
1752
|
+
$[38] !== animate ? (t13 = animate ? ["visible", "scaleIn"] : void 0, $[38] = animate, $[39] = t13) : t13 = $[39];
|
|
1753
1753
|
let t14;
|
|
1754
|
-
$[40] !== animate ? (t14 = animate ? ["
|
|
1754
|
+
$[40] !== animate ? (t14 = animate ? ["hidden", "scaleOut"] : void 0, $[40] = animate, $[41] = t14) : t14 = $[41];
|
|
1755
1755
|
let t15;
|
|
1756
|
-
$[42] !==
|
|
1756
|
+
$[42] !== children || $[43] !== padding ? (t15 = /* @__PURE__ */ jsx(Flex, { direction: "column", flex: 1, padding, children }), $[42] = children, $[43] = padding, $[44] = t15) : t15 = $[44];
|
|
1757
1757
|
let t16;
|
|
1758
|
-
$[
|
|
1758
|
+
$[45] !== maxWidth || $[46] !== overflow || $[47] !== t15 ? (t16 = /* @__PURE__ */ jsx(Flex, { "data-ui": "Popover__wrapper", direction: "column", flex: 1, maxWidth, overflow, children: t15 }), $[45] = maxWidth, $[46] = overflow, $[47] = t15, $[48] = t16) : t16 = $[48];
|
|
1759
1759
|
let t17;
|
|
1760
|
-
$[
|
|
1760
|
+
$[49] !== arrow2 || $[50] !== arrowRef || $[51] !== arrowStyle ? (t17 = arrow2 && /* @__PURE__ */ jsx(Arrow, { ref: arrowRef, style: arrowStyle, width: DEFAULT_POPOVER_ARROW_WIDTH, height: DEFAULT_POPOVER_ARROW_HEIGHT, radius: DEFAULT_POPOVER_ARROW_RADIUS }), $[49] = arrow2, $[50] = arrowRef, $[51] = arrowStyle, $[52] = t17) : t17 = $[52];
|
|
1761
1761
|
let t18;
|
|
1762
|
-
$[
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
t18
|
|
1767
|
-
] }), $[55] = as, $[56] = placement, $[57] = radius, $[58] = rest, $[59] = rootStyle, $[60] = shadow, $[61] = t13, $[62] = t14, $[63] = t15, $[64] = t17, $[65] = t18, $[66] = tone, $[67] = t19) : t19 = $[67], t19;
|
|
1762
|
+
return $[53] !== as || $[54] !== placement || $[55] !== radius || $[56] !== rest || $[57] !== rootStyle || $[58] !== shadow || $[59] !== strategy || $[60] !== t12 || $[61] !== t13 || $[62] !== t14 || $[63] !== t16 || $[64] !== t17 || $[65] !== tone ? (t18 = /* @__PURE__ */ jsxs(MotionLayer$1, { className: t11, "data-ui": "Popover", ...rest, as, "data-context-tone": tone, "data-placement": placement, direction: "column", display: "flex", position: strategy, radius, shadow, sizing: "border", style: rootStyle, tone, variants: POPOVER_MOTION_PROPS.card, transition: POPOVER_MOTION_PROPS.transition, initial: t12, animate: t13, exit: t14, children: [
|
|
1763
|
+
t16,
|
|
1764
|
+
t17
|
|
1765
|
+
] }), $[53] = as, $[54] = placement, $[55] = radius, $[56] = rest, $[57] = rootStyle, $[58] = shadow, $[59] = strategy, $[60] = t12, $[61] = t13, $[62] = t14, $[63] = t16, $[64] = t17, $[65] = tone, $[66] = t18) : t18 = $[66], t18;
|
|
1768
1766
|
}
|
|
1769
|
-
|
|
1767
|
+
PopoverLayer.displayName = "PopoverCard";
|
|
1770
1768
|
const DEFAULT_POPOVER_ELEMENT = "div";
|
|
1771
1769
|
function ViewportOverlay() {
|
|
1772
1770
|
const $ = c(2), {
|
|
@@ -1881,9 +1879,9 @@ function Popover(props) {
|
|
|
1881
1879
|
updateRef && (typeof updateRef == "function" ? updateRef(update) : updateRef && (updateRef.current = update));
|
|
1882
1880
|
}, [update, updateRef]), disabled)
|
|
1883
1881
|
return childProp || /* @__PURE__ */ jsx(Fragment, {});
|
|
1884
|
-
const popover = /* @__PURE__ */ jsxs(
|
|
1882
|
+
const popover = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1885
1883
|
modal && /* @__PURE__ */ jsx(ViewportOverlay, {}),
|
|
1886
|
-
/* @__PURE__ */ jsx(
|
|
1884
|
+
/* @__PURE__ */ jsx(PopoverLayer, { ...rest, __unstable_margins: margins, animate, arrow: arrowProp, arrowRef: setArrow, arrowX, arrowY, as, hidden: referenceHidden, maxWidth: widthProp, overflow, padding, placement, radius, ref: setFloating, scheme, shadow, originX, originY, strategy, x, y, zOffset, children: content })
|
|
1887
1885
|
] }), children = open && (portal ? /* @__PURE__ */ jsx(Portal, { __unstable_name: typeof portal == "string" ? portal : void 0, children: /* @__PURE__ */ jsx(CardProvider, { tone: tone === "inherit" ? card2?.tone ?? "default" : tone, scheme: scheme ?? "light", children: popover }) }) : popover);
|
|
1888
1886
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1889
1887
|
animate ? /* @__PURE__ */ jsx(AnimatePresence, { children }) : children,
|
|
@@ -2242,8 +2240,32 @@ const DEFAULT_TOOLTIP_ARROW_WIDTH = 15, DEFAULT_TOOLTIP_ARROW_HEIGHT = 6, DEFAUL
|
|
|
2242
2240
|
right: ["right-end", "right-start", "left", "top", "bottom"],
|
|
2243
2241
|
"right-start": ["right", "right-end", "left-start", "top-start", "bottom-start"],
|
|
2244
2242
|
"right-end": ["right", "right-start", "left-end", "top-end", "bottom-end"]
|
|
2245
|
-
},
|
|
2246
|
-
function
|
|
2243
|
+
}, TooltipDelayGroupContext = createGlobalScopedContext("@sanity/ui/context/tooltipDelayGroup", null);
|
|
2244
|
+
function TooltipDelayGroupProvider(props) {
|
|
2245
|
+
const $ = c(9), {
|
|
2246
|
+
children,
|
|
2247
|
+
delay
|
|
2248
|
+
} = props, [isGroupActive, setIsGroupActive] = useDelayedState(!1), [openTooltipId, setOpenTooltipId] = useDelayedState(null), openDelay = typeof delay == "number" ? delay : delay?.open || 0, closeDelay = typeof delay == "number" ? delay : delay?.close || 0;
|
|
2249
|
+
let t0;
|
|
2250
|
+
const t1 = isGroupActive ? 1 : openDelay;
|
|
2251
|
+
let t2;
|
|
2252
|
+
$[0] !== closeDelay || $[1] !== openTooltipId || $[2] !== setIsGroupActive || $[3] !== setOpenTooltipId || $[4] !== t1 ? (t2 = {
|
|
2253
|
+
setIsGroupActive,
|
|
2254
|
+
openTooltipId,
|
|
2255
|
+
setOpenTooltipId,
|
|
2256
|
+
openDelay: t1,
|
|
2257
|
+
closeDelay
|
|
2258
|
+
}, $[0] = closeDelay, $[1] = openTooltipId, $[2] = setIsGroupActive, $[3] = setOpenTooltipId, $[4] = t1, $[5] = t2) : t2 = $[5], t0 = t2;
|
|
2259
|
+
const value = t0;
|
|
2260
|
+
let t3;
|
|
2261
|
+
return $[6] !== children || $[7] !== value ? (t3 = /* @__PURE__ */ jsx(TooltipDelayGroupContext.Provider, { value, children }), $[6] = children, $[7] = value, $[8] = t3) : t3 = $[8], t3;
|
|
2262
|
+
}
|
|
2263
|
+
TooltipDelayGroupProvider.displayName = "TooltipDelayGroupProvider";
|
|
2264
|
+
function useTooltipDelayGroup() {
|
|
2265
|
+
return useContext(TooltipDelayGroupContext);
|
|
2266
|
+
}
|
|
2267
|
+
const DEFAULT_TOOLTIP_LAYER_ELEMENT = "div", MotionLayer = motion.create(Layer);
|
|
2268
|
+
function TooltipLayer(props) {
|
|
2247
2269
|
const $ = c(53), t0 = props;
|
|
2248
2270
|
let animate, arrow2, arrowRef, arrowX, arrowY, children, originX, originY, padding, placement, radius, rest, scheme, shadow, style, t1, t2;
|
|
2249
2271
|
$[0] !== t0 ? ({
|
|
@@ -2265,7 +2287,7 @@ function TooltipCard(props) {
|
|
|
2265
2287
|
tone: t2,
|
|
2266
2288
|
...rest
|
|
2267
2289
|
} = t0, $[0] = t0, $[1] = animate, $[2] = arrow2, $[3] = arrowRef, $[4] = arrowX, $[5] = arrowY, $[6] = children, $[7] = originX, $[8] = originY, $[9] = padding, $[10] = placement, $[11] = radius, $[12] = rest, $[13] = scheme, $[14] = shadow, $[15] = style, $[16] = t1, $[17] = t2) : (animate = $[1], arrow2 = $[2], arrowRef = $[3], arrowX = $[4], arrowY = $[5], children = $[6], originX = $[7], originY = $[8], padding = $[9], placement = $[10], radius = $[11], rest = $[12], scheme = $[13], shadow = $[14], style = $[15], t1 = $[16], t2 = $[17]);
|
|
2268
|
-
const as = t1 === void 0 ?
|
|
2290
|
+
const as = t1 === void 0 ? DEFAULT_TOOLTIP_LAYER_ELEMENT : t1, tone = t2 === void 0 ? "inherit" : t2;
|
|
2269
2291
|
let t3;
|
|
2270
2292
|
const t4 = animate ? "transform" : void 0;
|
|
2271
2293
|
let t5;
|
|
@@ -2298,36 +2320,12 @@ function TooltipCard(props) {
|
|
|
2298
2320
|
let t15;
|
|
2299
2321
|
$[33] !== arrow2 || $[34] !== arrowRef || $[35] !== arrowStyle ? (t15 = arrow2 && /* @__PURE__ */ jsx(Arrow, { ref: arrowRef, style: arrowStyle, width: DEFAULT_TOOLTIP_ARROW_WIDTH, height: DEFAULT_TOOLTIP_ARROW_HEIGHT, radius: DEFAULT_TOOLTIP_ARROW_RADIUS }), $[33] = arrow2, $[34] = arrowRef, $[35] = arrowStyle, $[36] = t15) : t15 = $[36];
|
|
2300
2322
|
let t16;
|
|
2301
|
-
return $[37] !== as || $[38] !== children || $[39] !== padding || $[40] !== placement || $[41] !== radius || $[42] !== rest || $[43] !== rootStyle || $[44] !== scheme || $[45] !== shadow || $[46] !== t11 || $[47] !== t12 || $[48] !== t13 || $[49] !== t14 || $[50] !== t15 || $[51] !== tone ? (t16 = /* @__PURE__ */ jsxs(
|
|
2323
|
+
return $[37] !== as || $[38] !== children || $[39] !== padding || $[40] !== placement || $[41] !== radius || $[42] !== rest || $[43] !== rootStyle || $[44] !== scheme || $[45] !== shadow || $[46] !== t11 || $[47] !== t12 || $[48] !== t13 || $[49] !== t14 || $[50] !== t15 || $[51] !== tone ? (t16 = /* @__PURE__ */ jsxs(MotionLayer, { "data-ui": "Tooltip__card", ...rest, as, className: t10, "data-animate": t11, "data-placement": placement, padding, radius, scheme, shadow, style: rootStyle, variants: POPOVER_MOTION_PROPS.card, transition: POPOVER_MOTION_PROPS.transition, initial: t12, animate: t13, exit: t14, tone, children: [
|
|
2302
2324
|
children,
|
|
2303
2325
|
t15
|
|
2304
2326
|
] }), $[37] = as, $[38] = children, $[39] = padding, $[40] = placement, $[41] = radius, $[42] = rest, $[43] = rootStyle, $[44] = scheme, $[45] = shadow, $[46] = t11, $[47] = t12, $[48] = t13, $[49] = t14, $[50] = t15, $[51] = tone, $[52] = t16) : t16 = $[52], t16;
|
|
2305
2327
|
}
|
|
2306
|
-
|
|
2307
|
-
const TooltipDelayGroupContext = createGlobalScopedContext("@sanity/ui/context/tooltipDelayGroup", null);
|
|
2308
|
-
function TooltipDelayGroupProvider(props) {
|
|
2309
|
-
const $ = c(9), {
|
|
2310
|
-
children,
|
|
2311
|
-
delay
|
|
2312
|
-
} = props, [isGroupActive, setIsGroupActive] = useDelayedState(!1), [openTooltipId, setOpenTooltipId] = useDelayedState(null), openDelay = typeof delay == "number" ? delay : delay?.open || 0, closeDelay = typeof delay == "number" ? delay : delay?.close || 0;
|
|
2313
|
-
let t0;
|
|
2314
|
-
const t1 = isGroupActive ? 1 : openDelay;
|
|
2315
|
-
let t2;
|
|
2316
|
-
$[0] !== closeDelay || $[1] !== openTooltipId || $[2] !== setIsGroupActive || $[3] !== setOpenTooltipId || $[4] !== t1 ? (t2 = {
|
|
2317
|
-
setIsGroupActive,
|
|
2318
|
-
openTooltipId,
|
|
2319
|
-
setOpenTooltipId,
|
|
2320
|
-
openDelay: t1,
|
|
2321
|
-
closeDelay
|
|
2322
|
-
}, $[0] = closeDelay, $[1] = openTooltipId, $[2] = setIsGroupActive, $[3] = setOpenTooltipId, $[4] = t1, $[5] = t2) : t2 = $[5], t0 = t2;
|
|
2323
|
-
const value = t0;
|
|
2324
|
-
let t3;
|
|
2325
|
-
return $[6] !== children || $[7] !== value ? (t3 = /* @__PURE__ */ jsx(TooltipDelayGroupContext.Provider, { value, children }), $[6] = children, $[7] = value, $[8] = t3) : t3 = $[8], t3;
|
|
2326
|
-
}
|
|
2327
|
-
TooltipDelayGroupProvider.displayName = "TooltipDelayGroupProvider";
|
|
2328
|
-
function useTooltipDelayGroup() {
|
|
2329
|
-
return useContext(TooltipDelayGroupContext);
|
|
2330
|
-
}
|
|
2328
|
+
TooltipLayer.displayName = "TooltipLayer";
|
|
2331
2329
|
const DEFAULT_TOOLTIP_ELEMENT = "div";
|
|
2332
2330
|
function Tooltip(props) {
|
|
2333
2331
|
const boundaryElementContext = useBoundaryElement(), {
|
|
@@ -2446,10 +2444,10 @@ function Tooltip(props) {
|
|
|
2446
2444
|
}) : null, [childProp, handleBlur, handleClick, handleContextMenu, handleFocus, handleMouseEnter, handleMouseLeave]);
|
|
2447
2445
|
if (useImperativeHandle(childProp ? getElementRef(childProp) : null, () => referenceElement, [referenceElement]), !child) return /* @__PURE__ */ jsx(Fragment, {});
|
|
2448
2446
|
if (disabled) return child;
|
|
2449
|
-
const node_0 = /* @__PURE__ */ jsx(
|
|
2447
|
+
const node_0 = /* @__PURE__ */ jsx(TooltipLayer, { "data-ui": "Tooltip", ...rest, animate, arrow: arrowProp, arrowRef: setArrow, arrowX, arrowY, as, className: composeClassNames(className, tooltip()), originX, originY, padding, placement, radius, ref: setFloating, scheme, shadow, style: {
|
|
2450
2448
|
...floatingStyles,
|
|
2451
2449
|
maxWidth: tooltipMaxWidth > 0 ? `${tooltipMaxWidth}px` : void 0
|
|
2452
|
-
},
|
|
2450
|
+
}, tone, zOffset, children: content }), children = showTooltip && (portalProp ? /* @__PURE__ */ jsx(Portal, { __unstable_name: typeof portalProp == "string" ? portalProp : void 0, children: /* @__PURE__ */ jsx(CardProvider, { tone: tone === "inherit" ? card2?.tone ?? "default" : tone, scheme: scheme ?? "light", children: node_0 }) }) : node_0);
|
|
2453
2451
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2454
2452
|
animate ? /* @__PURE__ */ jsx(AnimatePresence, { children }) : children,
|
|
2455
2453
|
child
|