@sanity/ui 3.0.0-static.31 → 3.0.0-static.32
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 +49 -47
- package/dist/_chunks-cjs/_visual-editing.cjs.map +1 -1
- package/dist/_chunks-es/_visual-editing.js +49 -47
- package/dist/_chunks-es/_visual-editing.js.map +1 -1
- package/dist/css/index.cjs +1 -3
- package/dist/css/index.cjs.map +1 -1
- package/dist/css/index.css +1 -1
- package/dist/css/index.d.cts +1 -1
- package/dist/css/index.d.ts +1 -1
- package/dist/css/index.js +1 -3
- package/dist/css/index.js.map +1 -1
- package/dist/index.cjs +80 -79
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +82 -81
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/core/{primitives/root/Root.tsx → Root.tsx} +5 -3
- package/src/core/{primitives/root/RootProvider.tsx → RootProvider.tsx} +5 -5
- package/src/core/__workshop__/boundary.tsx +28 -0
- package/src/core/__workshop__/index.ts +14 -0
- package/src/core/index.ts +4 -2
- package/src/core/primitives/card/card.tsx +4 -3
- package/src/core/primitives/card/useCard.ts +8 -2
- package/src/core/primitives/grid/types.ts +1 -1
- package/src/core/primitives/popover/popover.tsx +1 -4
- package/src/core/primitives/tooltip/tooltip.tsx +1 -4
- package/src/core/utils/portal/portal.tsx +1 -5
- package/src/css/components/toast/toast.css.ts +2 -2
- package/src/css/primitives/root/root.css.ts +5 -1
- package/src/css/primitives/root/root.ts +1 -1
- package/src/css/props/gridColumnStart/types.ts +1 -1
- package/src/core/primitives/root/__workshop__/boundary.tsx +0 -5
- package/src/core/primitives/root/__workshop__/index.ts +0 -8
|
@@ -551,7 +551,10 @@ function getElementRef(element) {
|
|
|
551
551
|
return mayWarn ? element.ref : (getter = Object.getOwnPropertyDescriptor(element, "ref")?.get, mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning, mayWarn ? element.props.ref : element.props.ref || element.ref);
|
|
552
552
|
}
|
|
553
553
|
function useCard() {
|
|
554
|
-
|
|
554
|
+
const card2 = useContext(CardContext);
|
|
555
|
+
if (!card2)
|
|
556
|
+
throw new Error("useCard(): missing context value");
|
|
557
|
+
return card2;
|
|
555
558
|
}
|
|
556
559
|
const key = "@sanity/ui/context/portal", elementKey = Symbol.for(`${key}/element`), elementMap = globalScope;
|
|
557
560
|
elementMap[elementKey] = null;
|
|
@@ -577,11 +580,10 @@ function Portal(props) {
|
|
|
577
580
|
} = props, card2 = useCard(), portal = usePortal(), portalElement = (name ? portal.elements && portal.elements[name] : portal.element) || portal.elements?.default;
|
|
578
581
|
if (!portalElement)
|
|
579
582
|
return null;
|
|
580
|
-
|
|
583
|
+
let t0;
|
|
584
|
+
$[0] !== card2.scheme || $[1] !== children ? (t0 = /* @__PURE__ */ jsx(CardProvider, { tone: "transparent", scheme: card2.scheme, children }), $[0] = card2.scheme, $[1] = children, $[2] = t0) : t0 = $[2];
|
|
581
585
|
let t1;
|
|
582
|
-
$[
|
|
583
|
-
let t2;
|
|
584
|
-
return $[3] !== portalElement || $[4] !== t1 ? (t2 = createPortal(t1, portalElement), $[3] = portalElement, $[4] = t1, $[5] = t2) : t2 = $[5], t2;
|
|
586
|
+
return $[3] !== portalElement || $[4] !== t0 ? (t1 = createPortal(t0, portalElement), $[3] = portalElement, $[4] = t0, $[5] = t1) : t1 = $[5], t1;
|
|
585
587
|
}
|
|
586
588
|
function getLayerContext(contextValue) {
|
|
587
589
|
if (!isRecord(contextValue) || contextValue.version !== 0)
|
|
@@ -801,7 +803,7 @@ function Card(props) {
|
|
|
801
803
|
tone: t5,
|
|
802
804
|
...rest
|
|
803
805
|
} = t0, $[0] = t0, $[1] = className, $[2] = disabled, $[3] = pressed, $[4] = rest, $[5] = schemeProp, $[6] = selected, $[7] = style, $[8] = t1, $[9] = t2, $[10] = t3, $[11] = t4, $[12] = t5) : (className = $[1], disabled = $[2], pressed = $[3], rest = $[4], schemeProp = $[5], selected = $[6], style = $[7], t1 = $[8], t2 = $[9], t3 = $[10], t4 = $[11], t5 = $[12]);
|
|
804
|
-
const checkered = t1 === void 0 ? !1 : t1, focusRing = t2 === void 0 ? !1 : t2, as = t3 === void 0 ? DEFAULT_CARD_ELEMENT : t3, radius = t4 === void 0 ? 0 : t4, toneProp = t5 === void 0 ? "default" : t5, parent =
|
|
806
|
+
const checkered = t1 === void 0 ? !1 : t1, focusRing = t2 === void 0 ? !1 : t2, as = t3 === void 0 ? DEFAULT_CARD_ELEMENT : t3, radius = t4 === void 0 ? 0 : t4, toneProp = t5 === void 0 ? "default" : t5, parent = useContext(CardContext), tone = toneProp === "inherit" ? parent?.tone : toneProp, scheme = schemeProp === void 0 ? parent?.scheme : schemeProp, t6 = scheme === parent?.scheme ? void 0 : scheme;
|
|
805
807
|
let t7;
|
|
806
808
|
$[13] !== className || $[14] !== t6 || $[15] !== tone ? (t7 = card({
|
|
807
809
|
className,
|
|
@@ -817,7 +819,7 @@ function Card(props) {
|
|
|
817
819
|
const t14 = scheme ?? "light", t15 = tone ?? "default", t16 = parent?.unstable_CompatProvider;
|
|
818
820
|
let t17;
|
|
819
821
|
if ($[28] !== node || $[29] !== t14 || $[30] !== t15 || $[31] !== t16 ? (t17 = /* @__PURE__ */ jsx(CardProvider, { scheme: t14, tone: t15, unstable_CompatProvider: t16, children: node }), $[28] = node, $[29] = t14, $[30] = t15, $[31] = t16, $[32] = t17) : t17 = $[32], node = t17, parent?.unstable_CompatProvider) {
|
|
820
|
-
const CompatProvider = parent.unstable_CompatProvider, t18 = scheme ?? "light", t19 = tone ?? parent
|
|
822
|
+
const CompatProvider = parent.unstable_CompatProvider, t18 = scheme ?? "light", t19 = tone ?? parent.tone;
|
|
821
823
|
let t20;
|
|
822
824
|
return $[33] !== CompatProvider || $[34] !== node || $[35] !== t18 || $[36] !== t19 ? (t20 = /* @__PURE__ */ jsx(CompatProvider, { scheme: t18, tone: t19, children: node }), $[33] = CompatProvider, $[34] = node, $[35] = t18, $[36] = t19, $[37] = t20) : t20 = $[37], t20;
|
|
823
825
|
}
|
|
@@ -1181,7 +1183,7 @@ function Popover(props) {
|
|
|
1181
1183
|
/* @__PURE__ */ jsx(PopoverLayer, { ...rest, __unstable_margins: margins, animate, arrow: arrowProp, arrowRef: setArrow, arrowX, arrowY, as, className: popover({
|
|
1182
1184
|
className
|
|
1183
1185
|
}), hidden: referenceHidden, maxWidth: widthProp, overflow, padding, placement, radius, ref: setFloating, scheme, shadow, originX, originY, strategy, x, y, zOffset, children: content })
|
|
1184
|
-
] }), children = open && (portal ? /* @__PURE__ */ jsx(Portal, { __unstable_name: typeof portal == "string" ? portal : void 0, children: /* @__PURE__ */ jsx(CardProvider, { tone: tone === "inherit" ? card2
|
|
1186
|
+
] }), children = open && (portal ? /* @__PURE__ */ jsx(Portal, { __unstable_name: typeof portal == "string" ? portal : void 0, children: /* @__PURE__ */ jsx(CardProvider, { tone: tone === "inherit" ? card2.tone : tone, scheme: scheme ?? "light", children: node_1 }) }) : node_1);
|
|
1185
1187
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1186
1188
|
animate ? /* @__PURE__ */ jsx(AnimatePresence, { children }) : children,
|
|
1187
1189
|
child
|
|
@@ -2000,44 +2002,6 @@ function usePrefersDark(t0) {
|
|
|
2000
2002
|
function _temp$1() {
|
|
2001
2003
|
return !1;
|
|
2002
2004
|
}
|
|
2003
|
-
function PortalProvider(props) {
|
|
2004
|
-
const $ = c(7), {
|
|
2005
|
-
boundaryElement,
|
|
2006
|
-
children,
|
|
2007
|
-
element,
|
|
2008
|
-
__unstable_elements: elementsProp
|
|
2009
|
-
} = props, elements = useUnique(elementsProp), fallbackElement = useSyncExternalStore(emptySubscribe, _temp, _temp2);
|
|
2010
|
-
let t0;
|
|
2011
|
-
const t1 = boundaryElement || null, t2 = element || fallbackElement;
|
|
2012
|
-
let t3;
|
|
2013
|
-
$[0] !== elements || $[1] !== t1 || $[2] !== t2 ? (t3 = {
|
|
2014
|
-
version: 0,
|
|
2015
|
-
boundaryElement: t1,
|
|
2016
|
-
element: t2,
|
|
2017
|
-
elements
|
|
2018
|
-
}, $[0] = elements, $[1] = t1, $[2] = t2, $[3] = t3) : t3 = $[3], t0 = t3;
|
|
2019
|
-
const value = t0;
|
|
2020
|
-
let t4;
|
|
2021
|
-
return $[4] !== children || $[5] !== value ? (t4 = /* @__PURE__ */ jsx(PortalContext.Provider, { value, children }), $[4] = children, $[5] = value, $[6] = t4) : t4 = $[6], t4;
|
|
2022
|
-
}
|
|
2023
|
-
function _temp2() {
|
|
2024
|
-
return null;
|
|
2025
|
-
}
|
|
2026
|
-
function _temp() {
|
|
2027
|
-
return document.body;
|
|
2028
|
-
}
|
|
2029
|
-
const emptySubscribe = () => () => {
|
|
2030
|
-
};
|
|
2031
|
-
function useUnique(value) {
|
|
2032
|
-
const valueRef = useRef(value);
|
|
2033
|
-
return _isEqual(valueRef.current, value) || (valueRef.current = value), valueRef.current;
|
|
2034
|
-
}
|
|
2035
|
-
function _isEqual(objA, objB) {
|
|
2036
|
-
if (!objA || !objB)
|
|
2037
|
-
return objA === objB;
|
|
2038
|
-
const keysA = Object.keys(objA), keysB = Object.keys(objB);
|
|
2039
|
-
return keysA.length !== keysB.length ? !1 : keysA.every((key2) => objA[key2] === objB[key2]);
|
|
2040
|
-
}
|
|
2041
2005
|
function useDelayedState(initialState) {
|
|
2042
2006
|
const $ = c(3), [state, setState] = useState(initialState), delayedAction = useRef(void 0);
|
|
2043
2007
|
let t0;
|
|
@@ -2250,7 +2214,7 @@ function Tooltip(props) {
|
|
|
2250
2214
|
}), originX, originY, padding, placement, radius, ref: setFloating, scheme, shadow, style: {
|
|
2251
2215
|
...floatingStyles,
|
|
2252
2216
|
maxWidth: tooltipMaxWidth > 0 ? `${tooltipMaxWidth}px` : void 0
|
|
2253
|
-
}, 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
|
|
2217
|
+
}, 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 : tone, scheme: scheme ?? "light", children: node_0 }) }) : node_0);
|
|
2254
2218
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2255
2219
|
animate ? /* @__PURE__ */ jsx(AnimatePresence, { children }) : children,
|
|
2256
2220
|
child
|
|
@@ -2280,6 +2244,44 @@ function useCloseOnMouseLeave(t0) {
|
|
|
2280
2244
|
let t3;
|
|
2281
2245
|
$[7] !== isInsideGroup || $[8] !== showTooltip ? (t3 = [isInsideGroup, showTooltip], $[7] = isInsideGroup, $[8] = showTooltip, $[9] = t3) : t3 = $[9], useEffect(t2, t3);
|
|
2282
2246
|
}
|
|
2247
|
+
function PortalProvider(props) {
|
|
2248
|
+
const $ = c(7), {
|
|
2249
|
+
boundaryElement,
|
|
2250
|
+
children,
|
|
2251
|
+
element,
|
|
2252
|
+
__unstable_elements: elementsProp
|
|
2253
|
+
} = props, elements = useUnique(elementsProp), fallbackElement = useSyncExternalStore(emptySubscribe, _temp, _temp2);
|
|
2254
|
+
let t0;
|
|
2255
|
+
const t1 = boundaryElement || null, t2 = element || fallbackElement;
|
|
2256
|
+
let t3;
|
|
2257
|
+
$[0] !== elements || $[1] !== t1 || $[2] !== t2 ? (t3 = {
|
|
2258
|
+
version: 0,
|
|
2259
|
+
boundaryElement: t1,
|
|
2260
|
+
element: t2,
|
|
2261
|
+
elements
|
|
2262
|
+
}, $[0] = elements, $[1] = t1, $[2] = t2, $[3] = t3) : t3 = $[3], t0 = t3;
|
|
2263
|
+
const value = t0;
|
|
2264
|
+
let t4;
|
|
2265
|
+
return $[4] !== children || $[5] !== value ? (t4 = /* @__PURE__ */ jsx(PortalContext.Provider, { value, children }), $[4] = children, $[5] = value, $[6] = t4) : t4 = $[6], t4;
|
|
2266
|
+
}
|
|
2267
|
+
function _temp2() {
|
|
2268
|
+
return null;
|
|
2269
|
+
}
|
|
2270
|
+
function _temp() {
|
|
2271
|
+
return document.body;
|
|
2272
|
+
}
|
|
2273
|
+
const emptySubscribe = () => () => {
|
|
2274
|
+
};
|
|
2275
|
+
function useUnique(value) {
|
|
2276
|
+
const valueRef = useRef(value);
|
|
2277
|
+
return _isEqual(valueRef.current, value) || (valueRef.current = value), valueRef.current;
|
|
2278
|
+
}
|
|
2279
|
+
function _isEqual(objA, objB) {
|
|
2280
|
+
if (!objA || !objB)
|
|
2281
|
+
return objA === objB;
|
|
2282
|
+
const keysA = Object.keys(objA), keysB = Object.keys(objB);
|
|
2283
|
+
return keysA.length !== keysB.length ? !1 : keysA.every((key2) => objA[key2] === objB[key2]);
|
|
2284
|
+
}
|
|
2283
2285
|
export {
|
|
2284
2286
|
AnimatedSpinnerIcon,
|
|
2285
2287
|
Arrow,
|