@sanity/ui 3.0.8 → 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/index.mjs CHANGED
@@ -670,15 +670,15 @@ function DialogProvider(props) {
670
670
  position,
671
671
  zOffset
672
672
  } = props;
673
- let t0, t1;
674
- $[0] !== position || $[1] !== zOffset ? (t1 = {
673
+ let t0;
674
+ $[0] !== position || $[1] !== zOffset ? (t0 = {
675
675
  version: 0,
676
676
  position,
677
677
  zOffset
678
- }, $[0] = position, $[1] = zOffset, $[2] = t1) : t1 = $[2], t0 = t1;
678
+ }, $[0] = position, $[1] = zOffset, $[2] = t0) : t0 = $[2];
679
679
  const contextValue = t0;
680
- let t2;
681
- return $[3] !== children || $[4] !== contextValue ? (t2 = /* @__PURE__ */ jsx(DialogContext.Provider, { value: contextValue, children }), $[3] = children, $[4] = contextValue, $[5] = t2) : t2 = $[5], t2;
680
+ let t1;
681
+ return $[3] !== children || $[4] !== contextValue ? (t1 = /* @__PURE__ */ jsx(DialogContext.Provider, { value: contextValue, children }), $[3] = children, $[4] = contextValue, $[5] = t1) : t1 = $[5], t1;
682
682
  }
683
683
  DialogProvider.displayName = "DialogProvider";
684
684
  const MenuButton = forwardRef(function(props, forwardedRef) {
@@ -781,8 +781,8 @@ const MenuButton = forwardRef(function(props, forwardedRef) {
781
781
  shouldFocus
782
782
  }), $[28] = buttonElement, $[29] = handleBlur, $[30] = handleItemClick, $[31] = handleMenuClickOutside, $[32] = handleMenuEscape, $[33] = id, $[34] = menuProp, $[35] = shouldFocus, $[36] = t17) : t17 = $[36];
783
783
  const menu = t17;
784
- let t18, t19;
785
- $[37] !== buttonProp || $[38] !== handleMouseDown || $[39] !== id || $[40] !== open ? (t19 = buttonProp && cloneElement(buttonProp, {
784
+ let t18;
785
+ $[37] !== buttonProp || $[38] !== handleMouseDown || $[39] !== id || $[40] !== open ? (t18 = buttonProp && cloneElement(buttonProp, {
786
786
  "data-ui": "MenuButton",
787
787
  id,
788
788
  onClick: handleButtonClick,
@@ -792,14 +792,14 @@ const MenuButton = forwardRef(function(props, forwardedRef) {
792
792
  "aria-expanded": open,
793
793
  ref: setButtonElement,
794
794
  selected: buttonProp.props.selected ?? open
795
- }), $[37] = buttonProp, $[38] = handleMouseDown, $[39] = id, $[40] = open, $[41] = t19) : t19 = $[41], t18 = t19;
795
+ }), $[37] = buttonProp, $[38] = handleMouseDown, $[39] = id, $[40] = open, $[41] = t18) : t18 = $[41];
796
796
  const button = t18;
797
- let t20, t21;
798
- $[42] !== buttonElement ? (t20 = () => buttonElement, t21 = [buttonElement], $[42] = buttonElement, $[43] = t20, $[44] = t21) : (t20 = $[43], t21 = $[44]), useImperativeHandle(forwardedRef, t20, t21);
799
- let t22, t23;
800
- $[45] !== popover ? (t23 = popover || {}, $[45] = popover, $[46] = t23) : t23 = $[46];
801
- let t24;
802
- $[47] !== deprecated_boundaryElement || $[48] !== deprecated_placement || $[49] !== deprecated_popoverRadius || $[50] !== deprecated_popoverScheme || $[51] !== deprecated_portal || $[52] !== deprecated_preventOverflow || $[53] !== t23 ? (t24 = {
797
+ let t19, t20;
798
+ $[42] !== buttonElement ? (t19 = () => buttonElement, t20 = [buttonElement], $[42] = buttonElement, $[43] = t19, $[44] = t20) : (t19 = $[43], t20 = $[44]), useImperativeHandle(forwardedRef, t19, t20);
799
+ let t21;
800
+ $[45] !== popover ? (t21 = popover || {}, $[45] = popover, $[46] = t21) : t21 = $[46];
801
+ let t22;
802
+ $[47] !== deprecated_boundaryElement || $[48] !== deprecated_placement || $[49] !== deprecated_popoverRadius || $[50] !== deprecated_popoverScheme || $[51] !== deprecated_portal || $[52] !== deprecated_preventOverflow || $[53] !== t21 ? (t22 = {
803
803
  boundaryElement: deprecated_boundaryElement,
804
804
  overflow: "auto",
805
805
  placement: deprecated_placement,
@@ -807,13 +807,13 @@ const MenuButton = forwardRef(function(props, forwardedRef) {
807
807
  preventOverflow: deprecated_preventOverflow,
808
808
  radius: deprecated_popoverRadius,
809
809
  scheme: deprecated_popoverScheme,
810
- ...t23
811
- }, $[47] = deprecated_boundaryElement, $[48] = deprecated_placement, $[49] = deprecated_popoverRadius, $[50] = deprecated_popoverScheme, $[51] = deprecated_portal, $[52] = deprecated_preventOverflow, $[53] = t23, $[54] = t24) : t24 = $[54], t22 = t24;
810
+ ...t21
811
+ }, $[47] = deprecated_boundaryElement, $[48] = deprecated_placement, $[49] = deprecated_popoverRadius, $[50] = deprecated_popoverScheme, $[51] = deprecated_portal, $[52] = deprecated_preventOverflow, $[53] = t21, $[54] = t22) : t22 = $[54];
812
812
  const popoverProps = t22;
813
- let t25;
814
- $[55] !== button ? (t25 = button || /* @__PURE__ */ jsx(Fragment$1, {}), $[55] = button, $[56] = t25) : t25 = $[56];
815
- let t26;
816
- return $[57] !== menu || $[58] !== open || $[59] !== popoverProps || $[60] !== t25 ? (t26 = /* @__PURE__ */ jsx(Popover, { "data-ui": "MenuButton__popover", ...popoverProps, content: menu, open, children: t25 }), $[57] = menu, $[58] = open, $[59] = popoverProps, $[60] = t25, $[61] = t26) : t26 = $[61], t26;
813
+ let t23;
814
+ $[55] !== button ? (t23 = button || /* @__PURE__ */ jsx(Fragment$1, {}), $[55] = button, $[56] = t23) : t23 = $[56];
815
+ let t24;
816
+ return $[57] !== menu || $[58] !== open || $[59] !== popoverProps || $[60] !== t23 ? (t24 = /* @__PURE__ */ jsx(Popover, { "data-ui": "MenuButton__popover", ...popoverProps, content: menu, open, children: t23 }), $[57] = menu, $[58] = open, $[59] = popoverProps, $[60] = t23, $[61] = t24) : t24 = $[61], t24;
817
817
  });
818
818
  MenuButton.displayName = "ForwardRef(MenuButton)";
819
819
  function _temp$2(v) {
@@ -1159,8 +1159,8 @@ function ToastProvider(props) {
1159
1159
  let t1;
1160
1160
  $[0] === Symbol.for("react.memo_cache_sentinel") ? (t1 = [], $[0] = t1) : t1 = $[0];
1161
1161
  const [state, setState] = useState(t1), mounted = useMounted();
1162
- let t2, t3;
1163
- $[1] === Symbol.for("react.memo_cache_sentinel") ? (t3 = {
1162
+ let t2;
1163
+ $[1] === Symbol.for("react.memo_cache_sentinel") ? (t2 = {
1164
1164
  version: 0,
1165
1165
  push: (params) => {
1166
1166
  const id = params.id || generateToastId(), duration = params.duration || 5e3;
@@ -1181,15 +1181,15 @@ function ToastProvider(props) {
1181
1181
  });
1182
1182
  }), id;
1183
1183
  }
1184
- }, $[1] = t3) : t3 = $[1], t2 = t3;
1184
+ }, $[1] = t2) : t2 = $[1];
1185
1185
  const value = t2;
1186
+ let t3;
1187
+ $[2] !== gap || $[3] !== mounted || $[4] !== padding || $[5] !== paddingX || $[6] !== paddingY || $[7] !== state || $[8] !== zOffset ? (t3 = mounted && /* @__PURE__ */ jsx(LayerProvider, { zOffset, children: /* @__PURE__ */ jsx(ToastLayer, { padding, paddingX, paddingY, gap, children: /* @__PURE__ */ jsx(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];
1186
1188
  let t4;
1187
- $[2] !== gap || $[3] !== mounted || $[4] !== padding || $[5] !== paddingX || $[6] !== paddingY || $[7] !== state || $[8] !== zOffset ? (t4 = mounted && /* @__PURE__ */ jsx(LayerProvider, { zOffset, children: /* @__PURE__ */ jsx(ToastLayer, { padding, paddingX, paddingY, gap, children: /* @__PURE__ */ jsx(AnimatePresence, { initial: !1, mode: "popLayout", children: state.map(_temp) }) }) }), $[2] = gap, $[3] = mounted, $[4] = padding, $[5] = paddingX, $[6] = paddingY, $[7] = state, $[8] = zOffset, $[9] = t4) : t4 = $[9];
1188
- let t5;
1189
- return $[10] !== children || $[11] !== t4 ? (t5 = /* @__PURE__ */ jsxs(ToastContext.Provider, { value, children: [
1189
+ return $[10] !== children || $[11] !== t3 ? (t4 = /* @__PURE__ */ jsxs(ToastContext.Provider, { value, children: [
1190
1190
  children,
1191
- t4
1192
- ] }), $[10] = children, $[11] = t4, $[12] = t5) : t5 = $[12], t5;
1191
+ t3
1192
+ ] }), $[10] = children, $[11] = t3, $[12] = t4) : t4 = $[12], t4;
1193
1193
  }
1194
1194
  function _temp(t0) {
1195
1195
  const {
@@ -1273,27 +1273,27 @@ const TreeContext = createGlobalScopedContext("@sanity/ui/context/tree", null),
1273
1273
  ...restProps
1274
1274
  } = props, $[0] = props, $[1] = children, $[2] = onFocus, $[3] = restProps, $[4] = t0) : (children = $[1], onFocus = $[2], restProps = $[3], t0 = $[4]);
1275
1275
  const space = t0 === void 0 ? 1 : t0, ref = useRef(null), [focusedElement, setFocusedElement] = useState(null), focusedElementRef = useRef(focusedElement);
1276
- let t1, t2;
1277
- $[5] === Symbol.for("react.memo_cache_sentinel") ? (t2 = [], $[5] = t2) : t2 = $[5], t1 = t2;
1276
+ let t1;
1277
+ $[5] === Symbol.for("react.memo_cache_sentinel") ? (t1 = [], $[5] = t1) : t1 = $[5];
1278
1278
  const path = t1;
1279
+ let t2;
1280
+ $[6] === Symbol.for("react.memo_cache_sentinel") ? (t2 = [], $[6] = t2) : t2 = $[6];
1281
+ const [itemElements, setItemElements] = useState(t2);
1279
1282
  let t3;
1280
- $[6] === Symbol.for("react.memo_cache_sentinel") ? (t3 = [], $[6] = t3) : t3 = $[6];
1281
- const [itemElements, setItemElements] = useState(t3);
1283
+ $[7] === Symbol.for("react.memo_cache_sentinel") ? (t3 = {}, $[7] = t3) : t3 = $[7];
1284
+ const [state, setState] = useState(t3), stateRef = useRef(state);
1282
1285
  let t4;
1283
- $[7] === Symbol.for("react.memo_cache_sentinel") ? (t4 = {}, $[7] = t4) : t4 = $[7];
1284
- const [state, setState] = useState(t4), stateRef = useRef(state);
1285
- let t5;
1286
- $[8] === Symbol.for("react.memo_cache_sentinel") ? (t5 = () => ref.current, $[8] = t5) : t5 = $[8], useImperativeHandle(forwardedRef, t5);
1287
- let t6, t7;
1288
- $[9] !== focusedElement ? (t6 = () => {
1286
+ $[8] === Symbol.for("react.memo_cache_sentinel") ? (t4 = () => ref.current, $[8] = t4) : t4 = $[8], useImperativeHandle(forwardedRef, t4);
1287
+ let t5, t6;
1288
+ $[9] !== focusedElement ? (t5 = () => {
1289
1289
  focusedElementRef.current = focusedElement;
1290
- }, t7 = [focusedElement], $[9] = focusedElement, $[10] = t6, $[11] = t7) : (t6 = $[10], t7 = $[11]), useEffect(t6, t7);
1291
- let t8, t9;
1292
- $[12] !== state ? (t8 = () => {
1290
+ }, t6 = [focusedElement], $[9] = focusedElement, $[10] = t5, $[11] = t6) : (t5 = $[10], t6 = $[11]), useEffect(t5, t6);
1291
+ let t7, t8;
1292
+ $[12] !== state ? (t7 = () => {
1293
1293
  stateRef.current = state;
1294
- }, t9 = [state], $[12] = state, $[13] = t8, $[14] = t9) : (t8 = $[13], t9 = $[14]), useEffect(t8, t9);
1295
- let t10;
1296
- $[15] === Symbol.for("react.memo_cache_sentinel") ? (t10 = (element, path_0, expanded, selected) => (setState((s) => ({
1294
+ }, t8 = [state], $[12] = state, $[13] = t7, $[14] = t8) : (t7 = $[13], t8 = $[14]), useEffect(t7, t8);
1295
+ let t9;
1296
+ $[15] === Symbol.for("react.memo_cache_sentinel") ? (t9 = (element, path_0, expanded, selected) => (setState((s) => ({
1297
1297
  ...s,
1298
1298
  [path_0]: {
1299
1299
  element,
@@ -1306,10 +1306,10 @@ const TreeContext = createGlobalScopedContext("@sanity/ui/context/tree", null),
1306
1306
  };
1307
1307
  return delete newState[path_0], newState;
1308
1308
  });
1309
- }), $[15] = t10) : t10 = $[15];
1310
- const registerItem = t10;
1311
- let t11;
1312
- $[16] === Symbol.for("react.memo_cache_sentinel") ? (t11 = (path_1, expanded_0) => {
1309
+ }), $[15] = t9) : t9 = $[15];
1310
+ const registerItem = t9;
1311
+ let t10;
1312
+ $[16] === Symbol.for("react.memo_cache_sentinel") ? (t10 = (path_1, expanded_0) => {
1313
1313
  setState((s_1) => {
1314
1314
  const itemState = s_1[path_1];
1315
1315
  return itemState ? {
@@ -1320,14 +1320,12 @@ const TreeContext = createGlobalScopedContext("@sanity/ui/context/tree", null),
1320
1320
  }
1321
1321
  } : s_1;
1322
1322
  });
1323
- }, $[16] = t11) : t11 = $[16];
1324
- const setExpanded = t11;
1323
+ }, $[16] = t10) : t10 = $[16];
1324
+ const setExpanded = t10, t11 = focusedElement || itemElements[0] || null;
1325
1325
  let t12;
1326
- const t13 = focusedElement || itemElements[0] || null;
1327
- let t14;
1328
- $[17] !== space || $[18] !== state || $[19] !== t13 ? (t14 = {
1326
+ $[17] !== space || $[18] !== state || $[19] !== t11 ? (t12 = {
1329
1327
  version: 0,
1330
- focusedElement: t13,
1328
+ focusedElement: t11,
1331
1329
  level: 0,
1332
1330
  path,
1333
1331
  registerItem,
@@ -1335,10 +1333,10 @@ const TreeContext = createGlobalScopedContext("@sanity/ui/context/tree", null),
1335
1333
  setFocusedElement,
1336
1334
  space,
1337
1335
  state
1338
- }, $[17] = space, $[18] = state, $[19] = t13, $[20] = t14) : t14 = $[20], t12 = t14;
1336
+ }, $[17] = space, $[18] = state, $[19] = t11, $[20] = t12) : t12 = $[20];
1339
1337
  const contextValue = t12;
1340
- let t15;
1341
- $[21] !== itemElements ? (t15 = (event) => {
1338
+ let t13;
1339
+ $[21] !== itemElements ? (t13 = (event) => {
1342
1340
  if (focusedElementRef.current) {
1343
1341
  if (event.key === "ArrowDown") {
1344
1342
  event.preventDefault();
@@ -1397,26 +1395,26 @@ const TreeContext = createGlobalScopedContext("@sanity/ui/context/tree", null),
1397
1395
  return;
1398
1396
  }
1399
1397
  }
1400
- }, $[21] = itemElements, $[22] = t15) : t15 = $[22];
1401
- const handleKeyDown = t15;
1402
- let t16;
1403
- $[23] !== onFocus ? (t16 = (event_0) => {
1398
+ }, $[21] = itemElements, $[22] = t13) : t13 = $[22];
1399
+ const handleKeyDown = t13;
1400
+ let t14;
1401
+ $[23] !== onFocus ? (t14 = (event_0) => {
1404
1402
  setFocusedElement(event_0.target), onFocus?.(event_0);
1405
- }, $[23] = onFocus, $[24] = t16) : t16 = $[24];
1406
- const handleFocus = t16;
1407
- let t17;
1408
- $[25] === Symbol.for("react.memo_cache_sentinel") ? (t17 = () => {
1403
+ }, $[23] = onFocus, $[24] = t14) : t14 = $[24];
1404
+ const handleFocus = t14;
1405
+ let t15;
1406
+ $[25] === Symbol.for("react.memo_cache_sentinel") ? (t15 = () => {
1409
1407
  if (!ref.current)
1410
1408
  return;
1411
1409
  const _itemElements = Array.from(ref.current.querySelectorAll('[data-ui="TreeItem"]'));
1412
1410
  setItemElements(_itemElements);
1413
- }, $[25] = t17) : t17 = $[25];
1411
+ }, $[25] = t15) : t15 = $[25];
1412
+ let t16;
1413
+ $[26] !== children ? (t16 = [children], $[26] = children, $[27] = t16) : t16 = $[27], useEffect(t15, t16);
1414
+ let t17;
1415
+ $[28] !== children || $[29] !== handleFocus || $[30] !== handleKeyDown || $[31] !== restProps || $[32] !== space ? (t17 = /* @__PURE__ */ jsx(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];
1414
1416
  let t18;
1415
- $[26] !== children ? (t18 = [children], $[26] = children, $[27] = t18) : t18 = $[27], useEffect(t17, t18);
1416
- let t19;
1417
- $[28] !== children || $[29] !== handleFocus || $[30] !== handleKeyDown || $[31] !== restProps || $[32] !== space ? (t19 = /* @__PURE__ */ jsx(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];
1418
- let t20;
1419
- return $[34] !== contextValue || $[35] !== t19 ? (t20 = /* @__PURE__ */ jsx(TreeContext.Provider, { value: contextValue, children: t19 }), $[34] = contextValue, $[35] = t19, $[36] = t20) : t20 = $[36], t20;
1417
+ return $[34] !== contextValue || $[35] !== t17 ? (t18 = /* @__PURE__ */ jsx(TreeContext.Provider, { value: contextValue, children: t17 }), $[34] = contextValue, $[35] = t17, $[36] = t18) : t18 = $[36], t18;
1420
1418
  }));
1421
1419
  Tree.displayName = "Memo(ForwardRef(Tree))";
1422
1420
  function treeItemRootStyle() {