@sanity/ui 3.1.13 → 3.2.0

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.
Files changed (47) hide show
  1. package/dist/_chunks-cjs/_visual-editing.js +276 -252
  2. package/dist/_chunks-cjs/_visual-editing.js.map +1 -1
  3. package/dist/_chunks-es/_visual-editing.mjs +276 -252
  4. package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
  5. package/dist/_visual-editing.d.mts +66 -1
  6. package/dist/_visual-editing.d.ts +66 -1
  7. package/dist/index.d.mts +86 -1
  8. package/dist/index.d.ts +86 -1
  9. package/dist/index.js +97 -93
  10. package/dist/index.js.map +1 -1
  11. package/dist/index.mjs +97 -93
  12. package/dist/index.mjs.map +1 -1
  13. package/package.json +1 -1
  14. package/src/core/components/breadcrumbs/breadcrumbs.test.tsx +51 -0
  15. package/src/core/components/breadcrumbs/breadcrumbs.tsx +7 -3
  16. package/src/core/components/hotkeys/hotkeys.test.tsx +42 -0
  17. package/src/core/components/hotkeys/hotkeys.tsx +7 -3
  18. package/src/core/components/menu/menu.spacing.test.tsx +63 -0
  19. package/src/core/components/menu/menu.tsx +8 -2
  20. package/src/core/components/menu/menuGroup.spacing.test.tsx +69 -0
  21. package/src/core/components/menu/menuGroup.tsx +8 -2
  22. package/src/core/components/menu/menuItem.spacing.test.tsx +59 -0
  23. package/src/core/components/menu/menuItem.tsx +8 -2
  24. package/src/core/components/tab/tabList.test.tsx +48 -0
  25. package/src/core/components/tree/tree.test.tsx +55 -0
  26. package/src/core/components/tree/tree.tsx +10 -4
  27. package/src/core/components/tree/treeGroup.tsx +2 -2
  28. package/src/core/components/tree/treeItem.test.tsx +65 -0
  29. package/src/core/components/tree/treeItem.tsx +8 -2
  30. package/src/core/components/tree/types.ts +4 -0
  31. package/src/core/hooks/useDelayed.test.ts +20 -0
  32. package/src/core/hooks/useDelayedState.ts +9 -1
  33. package/src/core/primitives/box/box.test.tsx +134 -0
  34. package/src/core/primitives/box/box.tsx +18 -6
  35. package/src/core/primitives/button/button.test.tsx +38 -0
  36. package/src/core/primitives/button/button.tsx +8 -3
  37. package/src/core/primitives/grid/grid.test.tsx +78 -0
  38. package/src/core/primitives/grid/grid.tsx +17 -4
  39. package/src/core/primitives/inline/inline.test.tsx +51 -0
  40. package/src/core/primitives/inline/inline.tsx +9 -3
  41. package/src/core/primitives/select/select.test.tsx +52 -0
  42. package/src/core/primitives/select/select.tsx +8 -2
  43. package/src/core/primitives/stack/stack.test.tsx +57 -0
  44. package/src/core/primitives/stack/stack.tsx +7 -2
  45. package/src/core/primitives/textInput/textInput.test.tsx +48 -0
  46. package/src/core/primitives/textInput/textInput.tsx +7 -2
  47. package/src/core/primitives/types.ts +33 -0
package/dist/index.js CHANGED
@@ -570,32 +570,33 @@ const StyledBreadcrumbs = styledComponents.styled.ol.withConfig({
570
570
  displayName: "ExpandButton",
571
571
  componentId: "sc-1es8h8q-1"
572
572
  })`appearance:none;margin:-4px;`, Breadcrumbs = react.forwardRef(function(props, ref) {
573
- const $ = reactCompilerRuntime.c(29);
574
- let children, maxLength, restProps, separator, t0;
573
+ const $ = reactCompilerRuntime.c(30);
574
+ let children, gap, maxLength, restProps, separator, t0;
575
575
  $[0] !== props ? ({
576
576
  children,
577
+ gap,
577
578
  maxLength,
578
579
  separator,
579
580
  space: t0,
580
581
  ...restProps
581
- } = props, $[0] = props, $[1] = children, $[2] = maxLength, $[3] = restProps, $[4] = separator, $[5] = t0) : (children = $[1], maxLength = $[2], restProps = $[3], separator = $[4], t0 = $[5]);
582
- const spaceRaw = t0 === void 0 ? 2 : t0;
583
- let t1;
584
- $[6] !== spaceRaw ? (t1 = _visualEditing._getArrayProp(spaceRaw), $[6] = spaceRaw, $[7] = t1) : t1 = $[7];
585
- const space = t1, [open, setOpen] = react.useState(!1), expandElementRef = react.useRef(null), popoverElementRef = react.useRef(null);
582
+ } = props, $[0] = props, $[1] = children, $[2] = gap, $[3] = maxLength, $[4] = restProps, $[5] = separator, $[6] = t0) : (children = $[1], gap = $[2], maxLength = $[3], restProps = $[4], separator = $[5], t0 = $[6]);
583
+ const t1 = gap === void 0 ? t0 === void 0 ? 2 : t0 : gap;
586
584
  let t2;
587
- $[8] === Symbol.for("react.memo_cache_sentinel") ? (t2 = () => setOpen(!1), $[8] = t2) : t2 = $[8];
588
- const collapse = t2;
585
+ $[7] !== t1 ? (t2 = _visualEditing._getArrayProp(t1), $[7] = t1, $[8] = t2) : t2 = $[8];
586
+ const space = t2, [open, setOpen] = react.useState(!1), expandElementRef = react.useRef(null), popoverElementRef = react.useRef(null);
589
587
  let t3;
590
- $[9] === Symbol.for("react.memo_cache_sentinel") ? (t3 = () => setOpen(!0), $[9] = t3) : t3 = $[9];
591
- const expand = t3;
588
+ $[9] === Symbol.for("react.memo_cache_sentinel") ? (t3 = () => setOpen(!1), $[9] = t3) : t3 = $[9];
589
+ const collapse = t3;
592
590
  let t4;
593
- $[10] === Symbol.for("react.memo_cache_sentinel") ? (t4 = () => [expandElementRef.current, popoverElementRef.current], $[10] = t4) : t4 = $[10], _visualEditing.useClickOutsideEvent(collapse, t4);
591
+ $[10] === Symbol.for("react.memo_cache_sentinel") ? (t4 = () => setOpen(!0), $[10] = t4) : t4 = $[10];
592
+ const expand = t4;
594
593
  let t5;
595
- $[11] !== children ? (t5 = react.Children.toArray(children).filter(react.isValidElement), $[11] = children, $[12] = t5) : t5 = $[12];
596
- const rawItems = t5;
594
+ $[11] === Symbol.for("react.memo_cache_sentinel") ? (t5 = () => [expandElementRef.current, popoverElementRef.current], $[11] = t5) : t5 = $[11], _visualEditing.useClickOutsideEvent(collapse, t5);
597
595
  let t6;
598
- $[13] !== maxLength || $[14] !== open || $[15] !== rawItems || $[16] !== space ? (t6 = {
596
+ $[12] !== children ? (t6 = react.Children.toArray(children).filter(react.isValidElement), $[12] = children, $[13] = t6) : t6 = $[13];
597
+ const rawItems = t6;
598
+ let t7;
599
+ $[14] !== maxLength || $[15] !== open || $[16] !== rawItems || $[17] !== space ? (t7 = {
599
600
  collapse,
600
601
  expand,
601
602
  expandElementRef,
@@ -604,19 +605,19 @@ const StyledBreadcrumbs = styledComponents.styled.ol.withConfig({
604
605
  popoverElementRef,
605
606
  rawItems,
606
607
  space
607
- }, $[13] = maxLength, $[14] = open, $[15] = rawItems, $[16] = space, $[17] = t6) : t6 = $[17];
608
- const items = useItems(t6);
609
- let t7;
610
- if ($[18] !== items || $[19] !== separator || $[20] !== space) {
611
- let t82;
612
- $[22] !== separator || $[23] !== space ? (t82 = (item, itemIndex) => /* @__PURE__ */ jsxRuntime.jsxs(react.Fragment, { children: [
608
+ }, $[14] = maxLength, $[15] = open, $[16] = rawItems, $[17] = space, $[18] = t7) : t7 = $[18];
609
+ const items = useItems(t7);
610
+ let t8;
611
+ if ($[19] !== items || $[20] !== separator || $[21] !== space) {
612
+ let t92;
613
+ $[23] !== separator || $[24] !== space ? (t92 = (item, itemIndex) => /* @__PURE__ */ jsxRuntime.jsxs(react.Fragment, { children: [
613
614
  itemIndex > 0 && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { "aria-hidden": !0, as: "li", paddingX: space, children: separator || /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { muted: !0, children: "/" }) }),
614
615
  /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { as: "li", children: item })
615
- ] }, itemIndex), $[22] = separator, $[23] = space, $[24] = t82) : t82 = $[24], t7 = items.map(t82), $[18] = items, $[19] = separator, $[20] = space, $[21] = t7;
616
+ ] }, itemIndex), $[23] = separator, $[24] = space, $[25] = t92) : t92 = $[25], t8 = items.map(t92), $[19] = items, $[20] = separator, $[21] = space, $[22] = t8;
616
617
  } else
617
- t7 = $[21];
618
- let t8;
619
- return $[25] !== ref || $[26] !== restProps || $[27] !== t7 ? (t8 = /* @__PURE__ */ jsxRuntime.jsx(StyledBreadcrumbs, { "data-ui": "Breadcrumbs", ...restProps, ref, children: t7 }), $[25] = ref, $[26] = restProps, $[27] = t7, $[28] = t8) : t8 = $[28], t8;
618
+ t8 = $[22];
619
+ let t9;
620
+ return $[26] !== ref || $[27] !== restProps || $[28] !== t8 ? (t9 = /* @__PURE__ */ jsxRuntime.jsx(StyledBreadcrumbs, { "data-ui": "Breadcrumbs", ...restProps, ref, children: t8 }), $[26] = ref, $[27] = restProps, $[28] = t8, $[29] = t9) : t9 = $[29], t9;
620
621
  });
621
622
  Breadcrumbs.displayName = "ForwardRef(Breadcrumbs)";
622
623
  function useItems(t0) {
@@ -638,7 +639,7 @@ function useItems(t0) {
638
639
  let t3;
639
640
  $[11] !== afterLength || $[12] !== beforeLength || $[13] !== len || $[14] !== rawItems ? (t3 = rawItems.slice(beforeLength - 1, len - afterLength), $[11] = afterLength, $[12] = beforeLength, $[13] = len, $[14] = rawItems, $[15] = t3) : t3 = $[15];
640
641
  let t4;
641
- $[16] !== space || $[17] !== t3 ? (t4 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Stack, { as: "ol", overflow: "auto", padding: space, space, children: t3 }), $[16] = space, $[17] = t3, $[18] = t4) : t4 = $[18];
642
+ $[16] !== space || $[17] !== t3 ? (t4 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Stack, { as: "ol", overflow: "auto", padding: space, gap: space, children: t3 }), $[16] = space, $[17] = t3, $[18] = t4) : t4 = $[18];
642
643
  const t5 = open ? collapse : expand;
643
644
  let t6;
644
645
  $[19] !== expandElementRef || $[20] !== open || $[21] !== t5 ? (t6 = /* @__PURE__ */ jsxRuntime.jsx(ExpandButton, { fontSize: 1, mode: "bleed", onClick: t5, padding: 1, ref: expandElementRef, selected: open, text: "\u2026" }), $[19] = expandElementRef, $[20] = open, $[21] = t5, $[22] = t6) : t6 = $[22];
@@ -1514,36 +1515,37 @@ function _focusItemElement(el) {
1514
1515
  }
1515
1516
  }
1516
1517
  const TreeContext = _visualEditing.createGlobalScopedContext("@sanity/ui/context/tree", null), Tree = react.forwardRef(function(props, forwardedRef) {
1517
- const $ = reactCompilerRuntime.c(37);
1518
- let children, onFocus, restProps, t0;
1518
+ const $ = reactCompilerRuntime.c(38);
1519
+ let children, gap, onFocus, restProps, t0;
1519
1520
  $[0] !== props ? ({
1520
1521
  children,
1522
+ gap,
1521
1523
  space: t0,
1522
1524
  onFocus,
1523
1525
  ...restProps
1524
- } = props, $[0] = props, $[1] = children, $[2] = onFocus, $[3] = restProps, $[4] = t0) : (children = $[1], onFocus = $[2], restProps = $[3], t0 = $[4]);
1525
- const space = t0 === void 0 ? 1 : t0, ref = react.useRef(null), [focusedElement, setFocusedElement] = react.useState(null), focusedElementRef = react.useRef(focusedElement);
1526
+ } = props, $[0] = props, $[1] = children, $[2] = gap, $[3] = onFocus, $[4] = restProps, $[5] = t0) : (children = $[1], gap = $[2], onFocus = $[3], restProps = $[4], t0 = $[5]);
1527
+ const spacing = gap === void 0 ? t0 === void 0 ? 1 : t0 : gap, ref = react.useRef(null), [focusedElement, setFocusedElement] = react.useState(null), focusedElementRef = react.useRef(focusedElement);
1526
1528
  let t1;
1527
- $[5] === Symbol.for("react.memo_cache_sentinel") ? (t1 = [], $[5] = t1) : t1 = $[5];
1529
+ $[6] === Symbol.for("react.memo_cache_sentinel") ? (t1 = [], $[6] = t1) : t1 = $[6];
1528
1530
  const path = t1;
1529
1531
  let t2;
1530
- $[6] === Symbol.for("react.memo_cache_sentinel") ? (t2 = [], $[6] = t2) : t2 = $[6];
1532
+ $[7] === Symbol.for("react.memo_cache_sentinel") ? (t2 = [], $[7] = t2) : t2 = $[7];
1531
1533
  const [itemElements, setItemElements] = react.useState(t2);
1532
1534
  let t3;
1533
- $[7] === Symbol.for("react.memo_cache_sentinel") ? (t3 = {}, $[7] = t3) : t3 = $[7];
1535
+ $[8] === Symbol.for("react.memo_cache_sentinel") ? (t3 = {}, $[8] = t3) : t3 = $[8];
1534
1536
  const [state, setState] = react.useState(t3), stateRef = react.useRef(state);
1535
1537
  let t4;
1536
- $[8] === Symbol.for("react.memo_cache_sentinel") ? (t4 = () => ref.current, $[8] = t4) : t4 = $[8], react.useImperativeHandle(forwardedRef, t4);
1538
+ $[9] === Symbol.for("react.memo_cache_sentinel") ? (t4 = () => ref.current, $[9] = t4) : t4 = $[9], react.useImperativeHandle(forwardedRef, t4);
1537
1539
  let t5, t6;
1538
- $[9] !== focusedElement ? (t5 = () => {
1540
+ $[10] !== focusedElement ? (t5 = () => {
1539
1541
  focusedElementRef.current = focusedElement;
1540
- }, t6 = [focusedElement], $[9] = focusedElement, $[10] = t5, $[11] = t6) : (t5 = $[10], t6 = $[11]), react.useEffect(t5, t6);
1542
+ }, t6 = [focusedElement], $[10] = focusedElement, $[11] = t5, $[12] = t6) : (t5 = $[11], t6 = $[12]), react.useEffect(t5, t6);
1541
1543
  let t7, t8;
1542
- $[12] !== state ? (t7 = () => {
1544
+ $[13] !== state ? (t7 = () => {
1543
1545
  stateRef.current = state;
1544
- }, t8 = [state], $[12] = state, $[13] = t7, $[14] = t8) : (t7 = $[13], t8 = $[14]), react.useEffect(t7, t8);
1546
+ }, t8 = [state], $[13] = state, $[14] = t7, $[15] = t8) : (t7 = $[14], t8 = $[15]), react.useEffect(t7, t8);
1545
1547
  let t9;
1546
- $[15] === Symbol.for("react.memo_cache_sentinel") ? (t9 = (element, path_0, expanded, selected) => (setState((s) => ({
1548
+ $[16] === Symbol.for("react.memo_cache_sentinel") ? (t9 = (element, path_0, expanded, selected) => (setState((s) => ({
1547
1549
  ...s,
1548
1550
  [path_0]: {
1549
1551
  element,
@@ -1556,10 +1558,10 @@ const TreeContext = _visualEditing.createGlobalScopedContext("@sanity/ui/context
1556
1558
  };
1557
1559
  return delete newState[path_0], newState;
1558
1560
  });
1559
- }), $[15] = t9) : t9 = $[15];
1561
+ }), $[16] = t9) : t9 = $[16];
1560
1562
  const registerItem = t9;
1561
1563
  let t10;
1562
- $[16] === Symbol.for("react.memo_cache_sentinel") ? (t10 = (path_1, expanded_0) => {
1564
+ $[17] === Symbol.for("react.memo_cache_sentinel") ? (t10 = (path_1, expanded_0) => {
1563
1565
  setState((s_1) => {
1564
1566
  const itemState = s_1[path_1];
1565
1567
  return itemState ? {
@@ -1570,10 +1572,10 @@ const TreeContext = _visualEditing.createGlobalScopedContext("@sanity/ui/context
1570
1572
  }
1571
1573
  } : s_1;
1572
1574
  });
1573
- }, $[16] = t10) : t10 = $[16];
1575
+ }, $[17] = t10) : t10 = $[17];
1574
1576
  const setExpanded = t10, t11 = focusedElement || itemElements[0] || null;
1575
1577
  let t12;
1576
- $[17] !== space || $[18] !== state || $[19] !== t11 ? (t12 = {
1578
+ $[18] !== spacing || $[19] !== state || $[20] !== t11 ? (t12 = {
1577
1579
  version: 0,
1578
1580
  focusedElement: t11,
1579
1581
  level: 0,
@@ -1581,12 +1583,13 @@ const TreeContext = _visualEditing.createGlobalScopedContext("@sanity/ui/context
1581
1583
  registerItem,
1582
1584
  setExpanded,
1583
1585
  setFocusedElement,
1584
- space,
1586
+ gap: spacing,
1587
+ space: spacing,
1585
1588
  state
1586
- }, $[17] = space, $[18] = state, $[19] = t11, $[20] = t12) : t12 = $[20];
1589
+ }, $[18] = spacing, $[19] = state, $[20] = t11, $[21] = t12) : t12 = $[21];
1587
1590
  const contextValue = t12;
1588
1591
  let t13;
1589
- $[21] !== itemElements ? (t13 = (event) => {
1592
+ $[22] !== itemElements ? (t13 = (event) => {
1590
1593
  if (focusedElementRef.current) {
1591
1594
  if (event.key === "ArrowDown") {
1592
1595
  event.preventDefault();
@@ -1645,26 +1648,26 @@ const TreeContext = _visualEditing.createGlobalScopedContext("@sanity/ui/context
1645
1648
  return;
1646
1649
  }
1647
1650
  }
1648
- }, $[21] = itemElements, $[22] = t13) : t13 = $[22];
1651
+ }, $[22] = itemElements, $[23] = t13) : t13 = $[23];
1649
1652
  const handleKeyDown = t13;
1650
1653
  let t14;
1651
- $[23] !== onFocus ? (t14 = (event_0) => {
1654
+ $[24] !== onFocus ? (t14 = (event_0) => {
1652
1655
  setFocusedElement(event_0.target), onFocus?.(event_0);
1653
- }, $[23] = onFocus, $[24] = t14) : t14 = $[24];
1656
+ }, $[24] = onFocus, $[25] = t14) : t14 = $[25];
1654
1657
  const handleFocus = t14;
1655
1658
  let t15;
1656
- $[25] === Symbol.for("react.memo_cache_sentinel") ? (t15 = () => {
1659
+ $[26] === Symbol.for("react.memo_cache_sentinel") ? (t15 = () => {
1657
1660
  if (!ref.current)
1658
1661
  return;
1659
1662
  const _itemElements = Array.from(ref.current.querySelectorAll('[data-ui="TreeItem"]'));
1660
1663
  setItemElements(_itemElements);
1661
- }, $[25] = t15) : t15 = $[25];
1664
+ }, $[26] = t15) : t15 = $[26];
1662
1665
  let t16;
1663
- $[26] !== children ? (t16 = [children], $[26] = children, $[27] = t16) : t16 = $[27], react.useEffect(t15, t16);
1666
+ $[27] !== children ? (t16 = [children], $[27] = children, $[28] = t16) : t16 = $[28], react.useEffect(t15, t16);
1664
1667
  let t17;
1665
- $[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];
1668
+ $[29] !== children || $[30] !== handleFocus || $[31] !== handleKeyDown || $[32] !== restProps || $[33] !== spacing ? (t17 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Stack, { as: "ul", "data-ui": "Tree", ...restProps, onFocus: handleFocus, onKeyDown: handleKeyDown, ref, role: "tree", gap: spacing, children }), $[29] = children, $[30] = handleFocus, $[31] = handleKeyDown, $[32] = restProps, $[33] = spacing, $[34] = t17) : t17 = $[34];
1666
1669
  let t18;
1667
- return $[34] !== contextValue || $[35] !== t17 ? (t18 = /* @__PURE__ */ jsxRuntime.jsx(TreeContext.Provider, { value: contextValue, children: t17 }), $[34] = contextValue, $[35] = t17, $[36] = t18) : t18 = $[36], t18;
1670
+ return $[35] !== contextValue || $[36] !== t17 ? (t18 = /* @__PURE__ */ jsxRuntime.jsx(TreeContext.Provider, { value: contextValue, children: t17 }), $[35] = contextValue, $[36] = t17, $[37] = t18) : t18 = $[37], t18;
1668
1671
  });
1669
1672
  Tree.displayName = "ForwardRef(Tree)";
1670
1673
  function treeItemRootStyle() {
@@ -1775,7 +1778,7 @@ function TreeGroup(props) {
1775
1778
  } = props, $[0] = props, $[1] = children, $[2] = restProps, $[3] = t0) : (children = $[1], restProps = $[2], t0 = $[3]);
1776
1779
  const expanded = t0 === void 0 ? !1 : t0, tree = useTree(), t1 = !expanded;
1777
1780
  let t2;
1778
- return $[4] !== children || $[5] !== restProps || $[6] !== t1 || $[7] !== tree.space ? (t2 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Stack, { as: "ul", "data-ui": "TreeGroup", ...restProps, hidden: t1, marginTop: tree.space, role: "group", space: tree.space, children }), $[4] = children, $[5] = restProps, $[6] = t1, $[7] = tree.space, $[8] = t2) : t2 = $[8], t2;
1781
+ return $[4] !== children || $[5] !== restProps || $[6] !== t1 || $[7] !== tree.gap ? (t2 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Stack, { as: "ul", "data-ui": "TreeGroup", ...restProps, hidden: t1, marginTop: tree.gap, role: "group", gap: tree.gap, children }), $[4] = children, $[5] = restProps, $[6] = t1, $[7] = tree.gap, $[8] = t2) : t2 = $[8], t2;
1779
1782
  }
1780
1783
  const StyledTreeItem = /* @__PURE__ */ styledComponents.styled.li.withConfig({
1781
1784
  displayName: "StyledTreeItem",
@@ -1790,8 +1793,8 @@ const StyledTreeItem = /* @__PURE__ */ styledComponents.styled.li.withConfig({
1790
1793
  componentId: "sc-iiskig-2"
1791
1794
  })`& > svg{transition:transform 100ms;}`;
1792
1795
  function TreeItem(props) {
1793
- const $ = reactCompilerRuntime.c(113);
1794
- let IconComponent, children, href, idProp, linkAs, muted, onClick, restProps, t0, t1, t2, t3, t4, text, weight;
1796
+ const $ = reactCompilerRuntime.c(114);
1797
+ let IconComponent, children, gap, href, idProp, linkAs, muted, onClick, restProps, t0, t1, t2, t3, t4, text, weight;
1795
1798
  $[0] !== props ? ({
1796
1799
  children,
1797
1800
  expanded: t0,
@@ -1804,16 +1807,17 @@ function TreeItem(props) {
1804
1807
  onClick,
1805
1808
  padding: t2,
1806
1809
  selected: t3,
1810
+ gap,
1807
1811
  space: t4,
1808
1812
  text,
1809
1813
  weight,
1810
1814
  ...restProps
1811
- } = props, $[0] = props, $[1] = IconComponent, $[2] = children, $[3] = href, $[4] = idProp, $[5] = linkAs, $[6] = muted, $[7] = onClick, $[8] = restProps, $[9] = t0, $[10] = t1, $[11] = t2, $[12] = t3, $[13] = t4, $[14] = text, $[15] = weight) : (IconComponent = $[1], children = $[2], href = $[3], idProp = $[4], linkAs = $[5], muted = $[6], onClick = $[7], restProps = $[8], t0 = $[9], t1 = $[10], t2 = $[11], t3 = $[12], t4 = $[13], text = $[14], weight = $[15]);
1812
- const expandedProp = t0 === void 0 ? !1 : t0, fontSize = t1 === void 0 ? 1 : t1, padding = t2 === void 0 ? 2 : t2, selected = t3 === void 0 ? !1 : t3, space = t4 === void 0 ? 2 : t4, [rootElement, _setRootElement] = react.useState(null);
1815
+ } = props, $[0] = props, $[1] = IconComponent, $[2] = children, $[3] = gap, $[4] = href, $[5] = idProp, $[6] = linkAs, $[7] = muted, $[8] = onClick, $[9] = restProps, $[10] = t0, $[11] = t1, $[12] = t2, $[13] = t3, $[14] = t4, $[15] = text, $[16] = weight) : (IconComponent = $[1], children = $[2], gap = $[3], href = $[4], idProp = $[5], linkAs = $[6], muted = $[7], onClick = $[8], restProps = $[9], t0 = $[10], t1 = $[11], t2 = $[12], t3 = $[13], t4 = $[14], text = $[15], weight = $[16]);
1816
+ const expandedProp = t0 === void 0 ? !1 : t0, fontSize = t1 === void 0 ? 1 : t1, padding = t2 === void 0 ? 2 : t2, selected = t3 === void 0 ? !1 : t3, spacing = gap === void 0 ? t4 === void 0 ? 2 : t4 : gap, [rootElement, _setRootElement] = react.useState(null);
1813
1817
  let t5;
1814
- $[16] === Symbol.for("react.memo_cache_sentinel") ? (t5 = (node) => {
1818
+ $[17] === Symbol.for("react.memo_cache_sentinel") ? (t5 = (node) => {
1815
1819
  react.startTransition(() => _setRootElement(node));
1816
- }, $[16] = t5) : t5 = $[16];
1820
+ }, $[17] = t5) : t5 = $[17];
1817
1821
  const setRootElement = t5, treeitemRef = react.useRef(null), tree = useTree(), {
1818
1822
  path,
1819
1823
  registerItem,
@@ -1821,89 +1825,89 @@ function TreeItem(props) {
1821
1825
  setFocusedElement
1822
1826
  } = tree, _id = react.useId(), id = idProp || _id;
1823
1827
  let t6, t7;
1824
- if ($[17] !== id || $[18] !== path) {
1828
+ if ($[18] !== id || $[19] !== path) {
1825
1829
  const itemPath = path.concat([id || ""]);
1826
- t6 = itemPath, t7 = itemPath.join("/"), $[17] = id, $[18] = path, $[19] = t6, $[20] = t7;
1830
+ t6 = itemPath, t7 = itemPath.join("/"), $[18] = id, $[19] = path, $[20] = t6, $[21] = t7;
1827
1831
  } else
1828
- t6 = $[19], t7 = $[20];
1832
+ t6 = $[20], t7 = $[21];
1829
1833
  let t8;
1830
- $[21] !== t6 || $[22] !== t7 ? (t8 = [t6, t7], $[21] = t6, $[22] = t7, $[23] = t8) : t8 = $[23];
1834
+ $[22] !== t6 || $[23] !== t7 ? (t8 = [t6, t7], $[22] = t6, $[23] = t7, $[24] = t8) : t8 = $[24];
1831
1835
  const [itemPath_0, itemKey] = t8, itemState = tree.state[itemKey], focused = tree.focusedElement === rootElement, expanded = itemState?.expanded === void 0 ? expandedProp : itemState?.expanded || !1, tabIndex = tree.focusedElement && tree.focusedElement === rootElement ? 0 : -1, t9 = tree.level + 1;
1832
1836
  let t10;
1833
- $[24] !== itemPath_0 || $[25] !== t9 || $[26] !== tree ? (t10 = {
1837
+ $[25] !== itemPath_0 || $[26] !== t9 || $[27] !== tree ? (t10 = {
1834
1838
  ...tree,
1835
1839
  level: t9,
1836
1840
  path: itemPath_0
1837
- }, $[24] = itemPath_0, $[25] = t9, $[26] = tree, $[27] = t10) : t10 = $[27];
1841
+ }, $[25] = itemPath_0, $[26] = t9, $[27] = tree, $[28] = t10) : t10 = $[28];
1838
1842
  const contextValue = t10;
1839
1843
  let t11;
1840
- $[28] !== expanded || $[29] !== itemKey || $[30] !== onClick || $[31] !== rootElement || $[32] !== setExpanded || $[33] !== setFocusedElement ? (t11 = (event) => {
1844
+ $[29] !== expanded || $[30] !== itemKey || $[31] !== onClick || $[32] !== rootElement || $[33] !== setExpanded || $[34] !== setFocusedElement ? (t11 = (event) => {
1841
1845
  onClick && onClick(event);
1842
1846
  const target = event.target;
1843
1847
  target instanceof HTMLElement && (target.getAttribute("data-ui") === "TreeItem" || target.closest('[data-ui="TreeItem__box"]')) && (event.stopPropagation(), setExpanded(itemKey, !expanded), setFocusedElement(rootElement));
1844
- }, $[28] = expanded, $[29] = itemKey, $[30] = onClick, $[31] = rootElement, $[32] = setExpanded, $[33] = setFocusedElement, $[34] = t11) : t11 = $[34];
1848
+ }, $[29] = expanded, $[30] = itemKey, $[31] = onClick, $[32] = rootElement, $[33] = setExpanded, $[34] = setFocusedElement, $[35] = t11) : t11 = $[35];
1845
1849
  const handleClick = t11;
1846
1850
  let t12;
1847
- $[35] !== focused || $[36] !== rootElement ? (t12 = (event_0) => {
1851
+ $[36] !== focused || $[37] !== rootElement ? (t12 = (event_0) => {
1848
1852
  focused && event_0.key === "Enter" && (treeitemRef.current || rootElement)?.click();
1849
- }, $[35] = focused, $[36] = rootElement, $[37] = t12) : t12 = $[37];
1853
+ }, $[36] = focused, $[37] = rootElement, $[38] = t12) : t12 = $[38];
1850
1854
  const handleKeyDown = t12;
1851
1855
  let t13, t14;
1852
- $[38] !== expanded || $[39] !== itemKey || $[40] !== registerItem || $[41] !== rootElement || $[42] !== selected ? (t13 = () => {
1856
+ $[39] !== expanded || $[40] !== itemKey || $[41] !== registerItem || $[42] !== rootElement || $[43] !== selected ? (t13 = () => {
1853
1857
  if (rootElement)
1854
1858
  return registerItem(rootElement, itemKey, expanded, selected);
1855
- }, t14 = [expanded, itemKey, registerItem, rootElement, selected], $[38] = expanded, $[39] = itemKey, $[40] = registerItem, $[41] = rootElement, $[42] = selected, $[43] = t13, $[44] = t14) : (t13 = $[43], t14 = $[44]), react.useEffect(t13, t14);
1859
+ }, t14 = [expanded, itemKey, registerItem, rootElement, selected], $[39] = expanded, $[40] = itemKey, $[41] = registerItem, $[42] = rootElement, $[43] = selected, $[44] = t13, $[45] = t14) : (t13 = $[44], t14 = $[45]), react.useEffect(t13, t14);
1856
1860
  const t15 = IconComponent || children ? "visible" : "hidden";
1857
1861
  let t16;
1858
- $[45] !== t15 ? (t16 = {
1862
+ $[46] !== t15 ? (t16 = {
1859
1863
  visibility: t15,
1860
1864
  pointerEvents: "none"
1861
- }, $[45] = t15, $[46] = t16) : t16 = $[46];
1865
+ }, $[46] = t15, $[47] = t16) : t16 = $[47];
1862
1866
  let t17;
1863
- $[47] !== IconComponent || $[48] !== fontSize || $[49] !== muted || $[50] !== weight ? (t17 = IconComponent && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { muted, size: fontSize, weight, children: /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {}) }), $[47] = IconComponent, $[48] = fontSize, $[49] = muted, $[50] = weight, $[51] = t17) : t17 = $[51];
1867
+ $[48] !== IconComponent || $[49] !== fontSize || $[50] !== muted || $[51] !== weight ? (t17 = IconComponent && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { muted, size: fontSize, weight, children: /* @__PURE__ */ jsxRuntime.jsx(IconComponent, {}) }), $[48] = IconComponent, $[49] = fontSize, $[50] = muted, $[51] = weight, $[52] = t17) : t17 = $[52];
1864
1868
  let t18;
1865
- $[52] !== IconComponent || $[53] !== expanded || $[54] !== fontSize || $[55] !== muted || $[56] !== weight ? (t18 = !IconComponent && /* @__PURE__ */ jsxRuntime.jsx(ToggleArrowText, { muted, size: fontSize, weight, children: /* @__PURE__ */ jsxRuntime.jsx(icons.ToggleArrowRightIcon, { style: {
1869
+ $[53] !== IconComponent || $[54] !== expanded || $[55] !== fontSize || $[56] !== muted || $[57] !== weight ? (t18 = !IconComponent && /* @__PURE__ */ jsxRuntime.jsx(ToggleArrowText, { muted, size: fontSize, weight, children: /* @__PURE__ */ jsxRuntime.jsx(icons.ToggleArrowRightIcon, { style: {
1866
1870
  transform: expanded ? "rotate(90deg)" : void 0
1867
- } }) }), $[52] = IconComponent, $[53] = expanded, $[54] = fontSize, $[55] = muted, $[56] = weight, $[57] = t18) : t18 = $[57];
1871
+ } }) }), $[53] = IconComponent, $[54] = expanded, $[55] = fontSize, $[56] = muted, $[57] = weight, $[58] = t18) : t18 = $[58];
1868
1872
  let t19;
1869
- $[58] !== space || $[59] !== t16 || $[60] !== t17 || $[61] !== t18 ? (t19 = /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Box, { marginRight: space, style: t16, children: [
1873
+ $[59] !== spacing || $[60] !== t16 || $[61] !== t17 || $[62] !== t18 ? (t19 = /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Box, { marginRight: spacing, style: t16, children: [
1870
1874
  t17,
1871
1875
  t18
1872
- ] }), $[58] = space, $[59] = t16, $[60] = t17, $[61] = t18, $[62] = t19) : t19 = $[62];
1876
+ ] }), $[59] = spacing, $[60] = t16, $[61] = t17, $[62] = t18, $[63] = t19) : t19 = $[63];
1873
1877
  let t20;
1874
- $[63] !== fontSize || $[64] !== muted || $[65] !== text || $[66] !== weight ? (t20 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { flex: 1, children: /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { muted, size: fontSize, textOverflow: "ellipsis", weight, children: text }) }), $[63] = fontSize, $[64] = muted, $[65] = text, $[66] = weight, $[67] = t20) : t20 = $[67];
1878
+ $[64] !== fontSize || $[65] !== muted || $[66] !== text || $[67] !== weight ? (t20 = /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { flex: 1, children: /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { muted, size: fontSize, textOverflow: "ellipsis", weight, children: text }) }), $[64] = fontSize, $[65] = muted, $[66] = text, $[67] = weight, $[68] = t20) : t20 = $[68];
1875
1879
  let t21;
1876
- $[68] !== padding || $[69] !== t19 || $[70] !== t20 ? (t21 = /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Flex, { padding, children: [
1880
+ $[69] !== padding || $[70] !== t19 || $[71] !== t20 ? (t21 = /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Flex, { padding, children: [
1877
1881
  t19,
1878
1882
  t20
1879
- ] }), $[68] = padding, $[69] = t19, $[70] = t20, $[71] = t21) : t21 = $[71];
1883
+ ] }), $[69] = padding, $[70] = t19, $[71] = t20, $[72] = t21) : t21 = $[72];
1880
1884
  const content2 = t21;
1881
1885
  if (href) {
1882
1886
  const t222 = selected ? "" : void 0;
1883
1887
  let t232;
1884
- $[72] !== content2 || $[73] !== expanded || $[74] !== href || $[75] !== linkAs || $[76] !== tabIndex || $[77] !== tree.level ? (t232 = /* @__PURE__ */ jsxRuntime.jsx(TreeItemBox, { $level: tree.level, "aria-expanded": expanded, as: linkAs, "data-ui": "TreeItem__box", href, ref: treeitemRef, role: "treeitem", tabIndex, children: content2 }), $[72] = content2, $[73] = expanded, $[74] = href, $[75] = linkAs, $[76] = tabIndex, $[77] = tree.level, $[78] = t232) : t232 = $[78];
1888
+ $[73] !== content2 || $[74] !== expanded || $[75] !== href || $[76] !== linkAs || $[77] !== tabIndex || $[78] !== tree.level ? (t232 = /* @__PURE__ */ jsxRuntime.jsx(TreeItemBox, { $level: tree.level, "aria-expanded": expanded, as: linkAs, "data-ui": "TreeItem__box", href, ref: treeitemRef, role: "treeitem", tabIndex, children: content2 }), $[73] = content2, $[74] = expanded, $[75] = href, $[76] = linkAs, $[77] = tabIndex, $[78] = tree.level, $[79] = t232) : t232 = $[79];
1885
1889
  let t242;
1886
- $[79] !== children || $[80] !== expanded ? (t242 = children && /* @__PURE__ */ jsxRuntime.jsx(TreeGroup, { hidden: !expanded, children }), $[79] = children, $[80] = expanded, $[81] = t242) : t242 = $[81];
1890
+ $[80] !== children || $[81] !== expanded ? (t242 = children && /* @__PURE__ */ jsxRuntime.jsx(TreeGroup, { hidden: !expanded, children }), $[80] = children, $[81] = expanded, $[82] = t242) : t242 = $[82];
1887
1891
  let t252;
1888
- $[82] !== contextValue || $[83] !== t242 ? (t252 = /* @__PURE__ */ jsxRuntime.jsx(TreeContext.Provider, { value: contextValue, children: t242 }), $[82] = contextValue, $[83] = t242, $[84] = t252) : t252 = $[84];
1892
+ $[83] !== contextValue || $[84] !== t242 ? (t252 = /* @__PURE__ */ jsxRuntime.jsx(TreeContext.Provider, { value: contextValue, children: t242 }), $[83] = contextValue, $[84] = t242, $[85] = t252) : t252 = $[85];
1889
1893
  let t262;
1890
- return $[85] !== handleClick || $[86] !== id || $[87] !== itemKey || $[88] !== restProps || $[89] !== t222 || $[90] !== t232 || $[91] !== t252 ? (t262 = /* @__PURE__ */ jsxRuntime.jsxs(StyledTreeItem, { "data-selected": t222, "data-tree-id": id, "data-tree-key": itemKey, "data-ui": "TreeItem", ...restProps, onClick: handleClick, ref: setRootElement, role: "none", children: [
1894
+ return $[86] !== handleClick || $[87] !== id || $[88] !== itemKey || $[89] !== restProps || $[90] !== t222 || $[91] !== t232 || $[92] !== t252 ? (t262 = /* @__PURE__ */ jsxRuntime.jsxs(StyledTreeItem, { "data-selected": t222, "data-tree-id": id, "data-tree-key": itemKey, "data-ui": "TreeItem", ...restProps, onClick: handleClick, ref: setRootElement, role: "none", children: [
1891
1895
  t232,
1892
1896
  t252
1893
- ] }), $[85] = handleClick, $[86] = id, $[87] = itemKey, $[88] = restProps, $[89] = t222, $[90] = t232, $[91] = t252, $[92] = t262) : t262 = $[92], t262;
1897
+ ] }), $[86] = handleClick, $[87] = id, $[88] = itemKey, $[89] = restProps, $[90] = t222, $[91] = t232, $[92] = t252, $[93] = t262) : t262 = $[93], t262;
1894
1898
  }
1895
1899
  const t22 = selected ? "" : void 0;
1896
1900
  let t23;
1897
- $[93] !== content2 || $[94] !== tree.level ? (t23 = /* @__PURE__ */ jsxRuntime.jsx(TreeItemBox, { $level: tree.level, as: "div", "data-ui": "TreeItem__box", children: content2 }), $[93] = content2, $[94] = tree.level, $[95] = t23) : t23 = $[95];
1901
+ $[94] !== content2 || $[95] !== tree.level ? (t23 = /* @__PURE__ */ jsxRuntime.jsx(TreeItemBox, { $level: tree.level, as: "div", "data-ui": "TreeItem__box", children: content2 }), $[94] = content2, $[95] = tree.level, $[96] = t23) : t23 = $[96];
1898
1902
  let t24;
1899
- $[96] !== children || $[97] !== expanded ? (t24 = children && /* @__PURE__ */ jsxRuntime.jsx(TreeGroup, { expanded, children }), $[96] = children, $[97] = expanded, $[98] = t24) : t24 = $[98];
1903
+ $[97] !== children || $[98] !== expanded ? (t24 = children && /* @__PURE__ */ jsxRuntime.jsx(TreeGroup, { expanded, children }), $[97] = children, $[98] = expanded, $[99] = t24) : t24 = $[99];
1900
1904
  let t25;
1901
- $[99] !== contextValue || $[100] !== t24 ? (t25 = /* @__PURE__ */ jsxRuntime.jsx(TreeContext.Provider, { value: contextValue, children: t24 }), $[99] = contextValue, $[100] = t24, $[101] = t25) : t25 = $[101];
1905
+ $[100] !== contextValue || $[101] !== t24 ? (t25 = /* @__PURE__ */ jsxRuntime.jsx(TreeContext.Provider, { value: contextValue, children: t24 }), $[100] = contextValue, $[101] = t24, $[102] = t25) : t25 = $[102];
1902
1906
  let t26;
1903
- return $[102] !== expanded || $[103] !== handleClick || $[104] !== handleKeyDown || $[105] !== id || $[106] !== itemKey || $[107] !== restProps || $[108] !== t22 || $[109] !== t23 || $[110] !== t25 || $[111] !== tabIndex ? (t26 = /* @__PURE__ */ jsxRuntime.jsxs(StyledTreeItem, { "data-selected": t22, "data-ui": "TreeItem", "data-tree-id": id, "data-tree-key": itemKey, ...restProps, "aria-expanded": expanded, onClick: handleClick, onKeyDown: handleKeyDown, ref: setRootElement, role: "treeitem", tabIndex, children: [
1907
+ return $[103] !== expanded || $[104] !== handleClick || $[105] !== handleKeyDown || $[106] !== id || $[107] !== itemKey || $[108] !== restProps || $[109] !== t22 || $[110] !== t23 || $[111] !== t25 || $[112] !== tabIndex ? (t26 = /* @__PURE__ */ jsxRuntime.jsxs(StyledTreeItem, { "data-selected": t22, "data-ui": "TreeItem", "data-tree-id": id, "data-tree-key": itemKey, ...restProps, "aria-expanded": expanded, onClick: handleClick, onKeyDown: handleKeyDown, ref: setRootElement, role: "treeitem", tabIndex, children: [
1904
1908
  t23,
1905
1909
  t25
1906
- ] }), $[102] = expanded, $[103] = handleClick, $[104] = handleKeyDown, $[105] = id, $[106] = itemKey, $[107] = restProps, $[108] = t22, $[109] = t23, $[110] = t25, $[111] = tabIndex, $[112] = t26) : t26 = $[112], t26;
1910
+ ] }), $[103] = expanded, $[104] = handleClick, $[105] = handleKeyDown, $[106] = id, $[107] = itemKey, $[108] = restProps, $[109] = t22, $[110] = t23, $[111] = t25, $[112] = tabIndex, $[113] = t26) : t26 = $[113], t26;
1907
1911
  }
1908
1912
  TreeItem.displayName = "TreeItem";
1909
1913
  exports.Arrow = _visualEditing.Arrow;