@sanity/ui 3.0.7 → 3.0.9
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 +219 -285
- package/dist/_chunks-cjs/_visual-editing.js.map +1 -1
- package/dist/_chunks-es/_visual-editing.mjs +220 -286
- package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
- package/dist/index.js +69 -71
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +69 -71
- package/dist/index.mjs.map +1 -1
- package/package.json +16 -16
- package/src/core/global.ts +0 -6
package/dist/index.js
CHANGED
|
@@ -664,15 +664,15 @@ function DialogProvider(props) {
|
|
|
664
664
|
position,
|
|
665
665
|
zOffset
|
|
666
666
|
} = props;
|
|
667
|
-
let t0
|
|
668
|
-
$[0] !== position || $[1] !== zOffset ? (
|
|
667
|
+
let t0;
|
|
668
|
+
$[0] !== position || $[1] !== zOffset ? (t0 = {
|
|
669
669
|
version: 0,
|
|
670
670
|
position,
|
|
671
671
|
zOffset
|
|
672
|
-
}, $[0] = position, $[1] = zOffset, $[2] =
|
|
672
|
+
}, $[0] = position, $[1] = zOffset, $[2] = t0) : t0 = $[2];
|
|
673
673
|
const contextValue = t0;
|
|
674
|
-
let
|
|
675
|
-
return $[3] !== children || $[4] !== contextValue ? (
|
|
674
|
+
let t1;
|
|
675
|
+
return $[3] !== children || $[4] !== contextValue ? (t1 = /* @__PURE__ */ jsxRuntime.jsx(DialogContext.Provider, { value: contextValue, children }), $[3] = children, $[4] = contextValue, $[5] = t1) : t1 = $[5], t1;
|
|
676
676
|
}
|
|
677
677
|
DialogProvider.displayName = "DialogProvider";
|
|
678
678
|
const MenuButton = react.forwardRef(function(props, forwardedRef) {
|
|
@@ -775,8 +775,8 @@ const MenuButton = react.forwardRef(function(props, forwardedRef) {
|
|
|
775
775
|
shouldFocus
|
|
776
776
|
}), $[28] = buttonElement, $[29] = handleBlur, $[30] = handleItemClick, $[31] = handleMenuClickOutside, $[32] = handleMenuEscape, $[33] = id, $[34] = menuProp, $[35] = shouldFocus, $[36] = t17) : t17 = $[36];
|
|
777
777
|
const menu = t17;
|
|
778
|
-
let t18
|
|
779
|
-
$[37] !== buttonProp || $[38] !== handleMouseDown || $[39] !== id || $[40] !== open ? (
|
|
778
|
+
let t18;
|
|
779
|
+
$[37] !== buttonProp || $[38] !== handleMouseDown || $[39] !== id || $[40] !== open ? (t18 = buttonProp && react.cloneElement(buttonProp, {
|
|
780
780
|
"data-ui": "MenuButton",
|
|
781
781
|
id,
|
|
782
782
|
onClick: handleButtonClick,
|
|
@@ -786,14 +786,14 @@ const MenuButton = react.forwardRef(function(props, forwardedRef) {
|
|
|
786
786
|
"aria-expanded": open,
|
|
787
787
|
ref: setButtonElement,
|
|
788
788
|
selected: buttonProp.props.selected ?? open
|
|
789
|
-
}), $[37] = buttonProp, $[38] = handleMouseDown, $[39] = id, $[40] = open, $[41] =
|
|
789
|
+
}), $[37] = buttonProp, $[38] = handleMouseDown, $[39] = id, $[40] = open, $[41] = t18) : t18 = $[41];
|
|
790
790
|
const button = t18;
|
|
791
|
-
let
|
|
792
|
-
$[42] !== buttonElement ? (
|
|
793
|
-
let
|
|
794
|
-
$[45] !== popover ? (
|
|
795
|
-
let
|
|
796
|
-
$[47] !== deprecated_boundaryElement || $[48] !== deprecated_placement || $[49] !== deprecated_popoverRadius || $[50] !== deprecated_popoverScheme || $[51] !== deprecated_portal || $[52] !== deprecated_preventOverflow || $[53] !==
|
|
791
|
+
let t19, t20;
|
|
792
|
+
$[42] !== buttonElement ? (t19 = () => buttonElement, t20 = [buttonElement], $[42] = buttonElement, $[43] = t19, $[44] = t20) : (t19 = $[43], t20 = $[44]), react.useImperativeHandle(forwardedRef, t19, t20);
|
|
793
|
+
let t21;
|
|
794
|
+
$[45] !== popover ? (t21 = popover || {}, $[45] = popover, $[46] = t21) : t21 = $[46];
|
|
795
|
+
let t22;
|
|
796
|
+
$[47] !== deprecated_boundaryElement || $[48] !== deprecated_placement || $[49] !== deprecated_popoverRadius || $[50] !== deprecated_popoverScheme || $[51] !== deprecated_portal || $[52] !== deprecated_preventOverflow || $[53] !== t21 ? (t22 = {
|
|
797
797
|
boundaryElement: deprecated_boundaryElement,
|
|
798
798
|
overflow: "auto",
|
|
799
799
|
placement: deprecated_placement,
|
|
@@ -801,13 +801,13 @@ const MenuButton = react.forwardRef(function(props, forwardedRef) {
|
|
|
801
801
|
preventOverflow: deprecated_preventOverflow,
|
|
802
802
|
radius: deprecated_popoverRadius,
|
|
803
803
|
scheme: deprecated_popoverScheme,
|
|
804
|
-
...
|
|
805
|
-
}, $[47] = deprecated_boundaryElement, $[48] = deprecated_placement, $[49] = deprecated_popoverRadius, $[50] = deprecated_popoverScheme, $[51] = deprecated_portal, $[52] = deprecated_preventOverflow, $[53] =
|
|
804
|
+
...t21
|
|
805
|
+
}, $[47] = deprecated_boundaryElement, $[48] = deprecated_placement, $[49] = deprecated_popoverRadius, $[50] = deprecated_popoverScheme, $[51] = deprecated_portal, $[52] = deprecated_preventOverflow, $[53] = t21, $[54] = t22) : t22 = $[54];
|
|
806
806
|
const popoverProps = t22;
|
|
807
|
-
let
|
|
808
|
-
$[55] !== button ? (
|
|
809
|
-
let
|
|
810
|
-
return $[57] !== menu || $[58] !== open || $[59] !== popoverProps || $[60] !==
|
|
807
|
+
let t23;
|
|
808
|
+
$[55] !== button ? (t23 = button || /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}), $[55] = button, $[56] = t23) : t23 = $[56];
|
|
809
|
+
let t24;
|
|
810
|
+
return $[57] !== menu || $[58] !== open || $[59] !== popoverProps || $[60] !== t23 ? (t24 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Popover, { "data-ui": "MenuButton__popover", ...popoverProps, content: menu, open, children: t23 }), $[57] = menu, $[58] = open, $[59] = popoverProps, $[60] = t23, $[61] = t24) : t24 = $[61], t24;
|
|
811
811
|
});
|
|
812
812
|
MenuButton.displayName = "ForwardRef(MenuButton)";
|
|
813
813
|
function _temp$2(v) {
|
|
@@ -1153,8 +1153,8 @@ function ToastProvider(props) {
|
|
|
1153
1153
|
let t1;
|
|
1154
1154
|
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t1 = [], $[0] = t1) : t1 = $[0];
|
|
1155
1155
|
const [state, setState] = react.useState(t1), mounted = useMounted();
|
|
1156
|
-
let t2
|
|
1157
|
-
$[1] === Symbol.for("react.memo_cache_sentinel") ? (
|
|
1156
|
+
let t2;
|
|
1157
|
+
$[1] === Symbol.for("react.memo_cache_sentinel") ? (t2 = {
|
|
1158
1158
|
version: 0,
|
|
1159
1159
|
push: (params) => {
|
|
1160
1160
|
const id = params.id || generateToastId(), duration = params.duration || 5e3;
|
|
@@ -1175,15 +1175,15 @@ function ToastProvider(props) {
|
|
|
1175
1175
|
});
|
|
1176
1176
|
}), id;
|
|
1177
1177
|
}
|
|
1178
|
-
}, $[1] =
|
|
1178
|
+
}, $[1] = t2) : t2 = $[1];
|
|
1179
1179
|
const value = t2;
|
|
1180
|
+
let t3;
|
|
1181
|
+
$[2] !== gap || $[3] !== mounted || $[4] !== padding || $[5] !== paddingX || $[6] !== paddingY || $[7] !== state || $[8] !== zOffset ? (t3 = mounted && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.LayerProvider, { zOffset, children: /* @__PURE__ */ jsxRuntime.jsx(ToastLayer, { padding, paddingX, paddingY, gap, children: /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { initial: !1, mode: "popLayout", children: state.map(_temp) }) }) }), $[2] = gap, $[3] = mounted, $[4] = padding, $[5] = paddingX, $[6] = paddingY, $[7] = state, $[8] = zOffset, $[9] = t3) : t3 = $[9];
|
|
1180
1182
|
let t4;
|
|
1181
|
-
|
|
1182
|
-
let t5;
|
|
1183
|
-
return $[10] !== children || $[11] !== t4 ? (t5 = /* @__PURE__ */ jsxRuntime.jsxs(ToastContext.Provider, { value, children: [
|
|
1183
|
+
return $[10] !== children || $[11] !== t3 ? (t4 = /* @__PURE__ */ jsxRuntime.jsxs(ToastContext.Provider, { value, children: [
|
|
1184
1184
|
children,
|
|
1185
|
-
|
|
1186
|
-
] }), $[10] = children, $[11] =
|
|
1185
|
+
t3
|
|
1186
|
+
] }), $[10] = children, $[11] = t3, $[12] = t4) : t4 = $[12], t4;
|
|
1187
1187
|
}
|
|
1188
1188
|
function _temp(t0) {
|
|
1189
1189
|
const {
|
|
@@ -1267,27 +1267,27 @@ const TreeContext = _visualEditing.createGlobalScopedContext("@sanity/ui/context
|
|
|
1267
1267
|
...restProps
|
|
1268
1268
|
} = props, $[0] = props, $[1] = children, $[2] = onFocus, $[3] = restProps, $[4] = t0) : (children = $[1], onFocus = $[2], restProps = $[3], t0 = $[4]);
|
|
1269
1269
|
const space = t0 === void 0 ? 1 : t0, ref = react.useRef(null), [focusedElement, setFocusedElement] = react.useState(null), focusedElementRef = react.useRef(focusedElement);
|
|
1270
|
-
let t1
|
|
1271
|
-
$[5] === Symbol.for("react.memo_cache_sentinel") ? (
|
|
1270
|
+
let t1;
|
|
1271
|
+
$[5] === Symbol.for("react.memo_cache_sentinel") ? (t1 = [], $[5] = t1) : t1 = $[5];
|
|
1272
1272
|
const path = t1;
|
|
1273
|
+
let t2;
|
|
1274
|
+
$[6] === Symbol.for("react.memo_cache_sentinel") ? (t2 = [], $[6] = t2) : t2 = $[6];
|
|
1275
|
+
const [itemElements, setItemElements] = react.useState(t2);
|
|
1273
1276
|
let t3;
|
|
1274
|
-
$[
|
|
1275
|
-
const [
|
|
1277
|
+
$[7] === Symbol.for("react.memo_cache_sentinel") ? (t3 = {}, $[7] = t3) : t3 = $[7];
|
|
1278
|
+
const [state, setState] = react.useState(t3), stateRef = react.useRef(state);
|
|
1276
1279
|
let t4;
|
|
1277
|
-
$[
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
$[8] === Symbol.for("react.memo_cache_sentinel") ? (t5 = () => ref.current, $[8] = t5) : t5 = $[8], react.useImperativeHandle(forwardedRef, t5);
|
|
1281
|
-
let t6, t7;
|
|
1282
|
-
$[9] !== focusedElement ? (t6 = () => {
|
|
1280
|
+
$[8] === Symbol.for("react.memo_cache_sentinel") ? (t4 = () => ref.current, $[8] = t4) : t4 = $[8], react.useImperativeHandle(forwardedRef, t4);
|
|
1281
|
+
let t5, t6;
|
|
1282
|
+
$[9] !== focusedElement ? (t5 = () => {
|
|
1283
1283
|
focusedElementRef.current = focusedElement;
|
|
1284
|
-
},
|
|
1285
|
-
let
|
|
1286
|
-
$[12] !== state ? (
|
|
1284
|
+
}, t6 = [focusedElement], $[9] = focusedElement, $[10] = t5, $[11] = t6) : (t5 = $[10], t6 = $[11]), react.useEffect(t5, t6);
|
|
1285
|
+
let t7, t8;
|
|
1286
|
+
$[12] !== state ? (t7 = () => {
|
|
1287
1287
|
stateRef.current = state;
|
|
1288
|
-
},
|
|
1289
|
-
let
|
|
1290
|
-
$[15] === Symbol.for("react.memo_cache_sentinel") ? (
|
|
1288
|
+
}, t8 = [state], $[12] = state, $[13] = t7, $[14] = t8) : (t7 = $[13], t8 = $[14]), react.useEffect(t7, t8);
|
|
1289
|
+
let t9;
|
|
1290
|
+
$[15] === Symbol.for("react.memo_cache_sentinel") ? (t9 = (element, path_0, expanded, selected) => (setState((s) => ({
|
|
1291
1291
|
...s,
|
|
1292
1292
|
[path_0]: {
|
|
1293
1293
|
element,
|
|
@@ -1300,10 +1300,10 @@ const TreeContext = _visualEditing.createGlobalScopedContext("@sanity/ui/context
|
|
|
1300
1300
|
};
|
|
1301
1301
|
return delete newState[path_0], newState;
|
|
1302
1302
|
});
|
|
1303
|
-
}), $[15] =
|
|
1304
|
-
const registerItem =
|
|
1305
|
-
let
|
|
1306
|
-
$[16] === Symbol.for("react.memo_cache_sentinel") ? (
|
|
1303
|
+
}), $[15] = t9) : t9 = $[15];
|
|
1304
|
+
const registerItem = t9;
|
|
1305
|
+
let t10;
|
|
1306
|
+
$[16] === Symbol.for("react.memo_cache_sentinel") ? (t10 = (path_1, expanded_0) => {
|
|
1307
1307
|
setState((s_1) => {
|
|
1308
1308
|
const itemState = s_1[path_1];
|
|
1309
1309
|
return itemState ? {
|
|
@@ -1314,14 +1314,12 @@ const TreeContext = _visualEditing.createGlobalScopedContext("@sanity/ui/context
|
|
|
1314
1314
|
}
|
|
1315
1315
|
} : s_1;
|
|
1316
1316
|
});
|
|
1317
|
-
}, $[16] =
|
|
1318
|
-
const setExpanded = t11;
|
|
1317
|
+
}, $[16] = t10) : t10 = $[16];
|
|
1318
|
+
const setExpanded = t10, t11 = focusedElement || itemElements[0] || null;
|
|
1319
1319
|
let t12;
|
|
1320
|
-
|
|
1321
|
-
let t14;
|
|
1322
|
-
$[17] !== space || $[18] !== state || $[19] !== t13 ? (t14 = {
|
|
1320
|
+
$[17] !== space || $[18] !== state || $[19] !== t11 ? (t12 = {
|
|
1323
1321
|
version: 0,
|
|
1324
|
-
focusedElement:
|
|
1322
|
+
focusedElement: t11,
|
|
1325
1323
|
level: 0,
|
|
1326
1324
|
path,
|
|
1327
1325
|
registerItem,
|
|
@@ -1329,10 +1327,10 @@ const TreeContext = _visualEditing.createGlobalScopedContext("@sanity/ui/context
|
|
|
1329
1327
|
setFocusedElement,
|
|
1330
1328
|
space,
|
|
1331
1329
|
state
|
|
1332
|
-
}, $[17] = space, $[18] = state, $[19] =
|
|
1330
|
+
}, $[17] = space, $[18] = state, $[19] = t11, $[20] = t12) : t12 = $[20];
|
|
1333
1331
|
const contextValue = t12;
|
|
1334
|
-
let
|
|
1335
|
-
$[21] !== itemElements ? (
|
|
1332
|
+
let t13;
|
|
1333
|
+
$[21] !== itemElements ? (t13 = (event) => {
|
|
1336
1334
|
if (focusedElementRef.current) {
|
|
1337
1335
|
if (event.key === "ArrowDown") {
|
|
1338
1336
|
event.preventDefault();
|
|
@@ -1391,26 +1389,26 @@ const TreeContext = _visualEditing.createGlobalScopedContext("@sanity/ui/context
|
|
|
1391
1389
|
return;
|
|
1392
1390
|
}
|
|
1393
1391
|
}
|
|
1394
|
-
}, $[21] = itemElements, $[22] =
|
|
1395
|
-
const handleKeyDown =
|
|
1396
|
-
let
|
|
1397
|
-
$[23] !== onFocus ? (
|
|
1392
|
+
}, $[21] = itemElements, $[22] = t13) : t13 = $[22];
|
|
1393
|
+
const handleKeyDown = t13;
|
|
1394
|
+
let t14;
|
|
1395
|
+
$[23] !== onFocus ? (t14 = (event_0) => {
|
|
1398
1396
|
setFocusedElement(event_0.target), onFocus?.(event_0);
|
|
1399
|
-
}, $[23] = onFocus, $[24] =
|
|
1400
|
-
const handleFocus =
|
|
1401
|
-
let
|
|
1402
|
-
$[25] === Symbol.for("react.memo_cache_sentinel") ? (
|
|
1397
|
+
}, $[23] = onFocus, $[24] = t14) : t14 = $[24];
|
|
1398
|
+
const handleFocus = t14;
|
|
1399
|
+
let t15;
|
|
1400
|
+
$[25] === Symbol.for("react.memo_cache_sentinel") ? (t15 = () => {
|
|
1403
1401
|
if (!ref.current)
|
|
1404
1402
|
return;
|
|
1405
1403
|
const _itemElements = Array.from(ref.current.querySelectorAll('[data-ui="TreeItem"]'));
|
|
1406
1404
|
setItemElements(_itemElements);
|
|
1407
|
-
}, $[25] =
|
|
1405
|
+
}, $[25] = t15) : t15 = $[25];
|
|
1406
|
+
let t16;
|
|
1407
|
+
$[26] !== children ? (t16 = [children], $[26] = children, $[27] = t16) : t16 = $[27], react.useEffect(t15, t16);
|
|
1408
|
+
let t17;
|
|
1409
|
+
$[28] !== children || $[29] !== handleFocus || $[30] !== handleKeyDown || $[31] !== restProps || $[32] !== space ? (t17 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Stack, { as: "ul", "data-ui": "Tree", ...restProps, onFocus: handleFocus, onKeyDown: handleKeyDown, ref, role: "tree", space, children }), $[28] = children, $[29] = handleFocus, $[30] = handleKeyDown, $[31] = restProps, $[32] = space, $[33] = t17) : t17 = $[33];
|
|
1408
1410
|
let t18;
|
|
1409
|
-
$[
|
|
1410
|
-
let t19;
|
|
1411
|
-
$[28] !== children || $[29] !== handleFocus || $[30] !== handleKeyDown || $[31] !== restProps || $[32] !== space ? (t19 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Stack, { as: "ul", "data-ui": "Tree", ...restProps, onFocus: handleFocus, onKeyDown: handleKeyDown, ref, role: "tree", space, children }), $[28] = children, $[29] = handleFocus, $[30] = handleKeyDown, $[31] = restProps, $[32] = space, $[33] = t19) : t19 = $[33];
|
|
1412
|
-
let t20;
|
|
1413
|
-
return $[34] !== contextValue || $[35] !== t19 ? (t20 = /* @__PURE__ */ jsxRuntime.jsx(TreeContext.Provider, { value: contextValue, children: t19 }), $[34] = contextValue, $[35] = t19, $[36] = t20) : t20 = $[36], t20;
|
|
1411
|
+
return $[34] !== contextValue || $[35] !== t17 ? (t18 = /* @__PURE__ */ jsxRuntime.jsx(TreeContext.Provider, { value: contextValue, children: t17 }), $[34] = contextValue, $[35] = t17, $[36] = t18) : t18 = $[36], t18;
|
|
1414
1412
|
}));
|
|
1415
1413
|
Tree.displayName = "Memo(ForwardRef(Tree))";
|
|
1416
1414
|
function treeItemRootStyle() {
|