@sanity/ui 3.1.14 → 3.3.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.
- package/dist/_chunks-cjs/_visual-editing.js +323 -292
- package/dist/_chunks-cjs/_visual-editing.js.map +1 -1
- package/dist/_chunks-es/_visual-editing.mjs +323 -292
- package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
- package/dist/_visual-editing.d.mts +195 -76
- package/dist/_visual-editing.d.ts +195 -76
- package/dist/index.d.mts +308 -140
- package/dist/index.d.ts +308 -140
- package/dist/index.js +97 -93
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +97 -93
- package/dist/index.mjs.map +1 -1
- package/dist/theme.d.mts +10 -4
- package/dist/theme.d.ts +10 -4
- package/package.json +1 -1
- package/src/core/components/autocomplete/autocomplete.tsx +1 -1
- package/src/core/components/autocomplete/types.ts +2 -2
- package/src/core/components/breadcrumbs/breadcrumbs.test.tsx +51 -0
- package/src/core/components/breadcrumbs/breadcrumbs.tsx +7 -3
- package/src/core/components/hotkeys/hotkeys.test.tsx +42 -0
- package/src/core/components/hotkeys/hotkeys.tsx +7 -3
- package/src/core/components/menu/__workshop__/asComponent.tsx +1 -1
- package/src/core/components/menu/menu.spacing.test.tsx +63 -0
- package/src/core/components/menu/menu.tsx +8 -2
- package/src/core/components/menu/menuDivider.ts +16 -5
- package/src/core/components/menu/menuGroup.spacing.test.tsx +63 -0
- package/src/core/components/menu/menuGroup.tsx +22 -8
- package/src/core/components/menu/menuItem.spacing.test.tsx +59 -0
- package/src/core/components/menu/menuItem.tsx +25 -8
- package/src/core/components/skeleton/skeleton.tsx +2 -2
- package/src/core/components/tab/tabList.test.tsx +48 -0
- package/src/core/components/tab/tabList.tsx +2 -2
- package/src/core/components/tab/tabPanel.tsx +2 -2
- package/src/core/components/toast/styles.ts +2 -2
- package/src/core/components/tree/__workshop__/basic.perf.ts +1 -1
- package/src/core/components/tree/__workshop__/tabFromElement.tsx +1 -1
- package/src/core/components/tree/tree.test.tsx +55 -0
- package/src/core/components/tree/tree.tsx +19 -10
- package/src/core/components/tree/treeGroup.tsx +3 -3
- package/src/core/components/tree/treeItem.test.tsx +65 -0
- package/src/core/components/tree/treeItem.tsx +11 -4
- package/src/core/components/tree/types.ts +4 -0
- package/src/core/primitives/avatar/avatar.tsx +19 -11
- package/src/core/primitives/badge/badge.tsx +20 -12
- package/src/core/primitives/box/__workshop__/asComponent.tsx +31 -0
- package/src/core/primitives/box/__workshop__/index.ts +5 -0
- package/src/core/primitives/box/box.test.tsx +142 -0
- package/src/core/primitives/box/box.tsx +41 -18
- package/src/core/primitives/button/__workshop__/disabled.tsx +2 -2
- package/src/core/primitives/button/__workshop__/sanityUploadButton.tsx +1 -1
- package/src/core/primitives/button/__workshop__/uploadButton.tsx +1 -1
- package/src/core/primitives/button/button.test.tsx +41 -3
- package/src/core/primitives/button/button.tsx +36 -12
- package/src/core/primitives/card/__workshop__/asComponent.tsx +1 -1
- package/src/core/primitives/card/card.tsx +24 -13
- package/src/core/primitives/code/code.tsx +16 -7
- package/src/core/primitives/container/container.tsx +23 -10
- package/src/core/primitives/flex/flex.tsx +21 -11
- package/src/core/primitives/grid/grid.test.tsx +80 -0
- package/src/core/primitives/grid/grid.tsx +39 -13
- package/src/core/primitives/heading/heading.tsx +19 -11
- package/src/core/primitives/inline/inline.test.tsx +51 -0
- package/src/core/primitives/inline/inline.tsx +28 -12
- package/src/core/primitives/kbd/kbd.tsx +19 -11
- package/src/core/primitives/label/label.tsx +19 -11
- package/src/core/primitives/popover/__workshop__/SidePanelStory.tsx +1 -1
- package/src/core/primitives/select/select.test.tsx +52 -0
- package/src/core/primitives/select/select.tsx +8 -2
- package/src/core/primitives/stack/stack.test.tsx +57 -0
- package/src/core/primitives/stack/stack.tsx +27 -13
- package/src/core/primitives/text/text.tsx +19 -11
- package/src/core/primitives/textInput/textInput.test.tsx +48 -0
- package/src/core/primitives/textInput/textInput.tsx +9 -4
- package/src/core/primitives/types.ts +33 -0
- package/src/core/types/component.ts +32 -0
- package/src/core/types/index.ts +1 -0
- package/src/core/utils/virtualList/virtualList.tsx +2 -2
- package/src/theme/system/css.ts +10 -4
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(
|
|
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] =
|
|
582
|
-
const
|
|
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
|
-
$[
|
|
588
|
-
const
|
|
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(!
|
|
591
|
-
const
|
|
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 = () =>
|
|
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]
|
|
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
|
-
$[
|
|
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
|
-
}, $[
|
|
608
|
-
const items = useItems(
|
|
609
|
-
let
|
|
610
|
-
if ($[
|
|
611
|
-
let
|
|
612
|
-
$[
|
|
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), $[
|
|
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
|
-
|
|
618
|
-
let
|
|
619
|
-
return $[
|
|
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(
|
|
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] =
|
|
1525
|
-
const
|
|
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
|
-
$[
|
|
1529
|
+
$[6] === Symbol.for("react.memo_cache_sentinel") ? (t1 = [], $[6] = t1) : t1 = $[6];
|
|
1528
1530
|
const path = t1;
|
|
1529
1531
|
let t2;
|
|
1530
|
-
$[
|
|
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
|
-
$[
|
|
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
|
-
$[
|
|
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
|
-
$[
|
|
1540
|
+
$[10] !== focusedElement ? (t5 = () => {
|
|
1539
1541
|
focusedElementRef.current = focusedElement;
|
|
1540
|
-
}, t6 = [focusedElement], $[
|
|
1542
|
+
}, t6 = [focusedElement], $[10] = focusedElement, $[11] = t5, $[12] = t6) : (t5 = $[11], t6 = $[12]), react.useEffect(t5, t6);
|
|
1541
1543
|
let t7, t8;
|
|
1542
|
-
$[
|
|
1544
|
+
$[13] !== state ? (t7 = () => {
|
|
1543
1545
|
stateRef.current = state;
|
|
1544
|
-
}, t8 = [state], $[
|
|
1546
|
+
}, t8 = [state], $[13] = state, $[14] = t7, $[15] = t8) : (t7 = $[14], t8 = $[15]), react.useEffect(t7, t8);
|
|
1545
1547
|
let t9;
|
|
1546
|
-
$[
|
|
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
|
-
}), $[
|
|
1561
|
+
}), $[16] = t9) : t9 = $[16];
|
|
1560
1562
|
const registerItem = t9;
|
|
1561
1563
|
let t10;
|
|
1562
|
-
$[
|
|
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
|
-
}, $[
|
|
1575
|
+
}, $[17] = t10) : t10 = $[17];
|
|
1574
1576
|
const setExpanded = t10, t11 = focusedElement || itemElements[0] || null;
|
|
1575
1577
|
let t12;
|
|
1576
|
-
$[
|
|
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
|
-
|
|
1586
|
+
gap: spacing,
|
|
1587
|
+
space: spacing,
|
|
1585
1588
|
state
|
|
1586
|
-
}, $[
|
|
1589
|
+
}, $[18] = spacing, $[19] = state, $[20] = t11, $[21] = t12) : t12 = $[21];
|
|
1587
1590
|
const contextValue = t12;
|
|
1588
1591
|
let t13;
|
|
1589
|
-
$[
|
|
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
|
-
}, $[
|
|
1651
|
+
}, $[22] = itemElements, $[23] = t13) : t13 = $[23];
|
|
1649
1652
|
const handleKeyDown = t13;
|
|
1650
1653
|
let t14;
|
|
1651
|
-
$[
|
|
1654
|
+
$[24] !== onFocus ? (t14 = (event_0) => {
|
|
1652
1655
|
setFocusedElement(event_0.target), onFocus?.(event_0);
|
|
1653
|
-
}, $[
|
|
1656
|
+
}, $[24] = onFocus, $[25] = t14) : t14 = $[25];
|
|
1654
1657
|
const handleFocus = t14;
|
|
1655
1658
|
let t15;
|
|
1656
|
-
$[
|
|
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
|
-
}, $[
|
|
1664
|
+
}, $[26] = t15) : t15 = $[26];
|
|
1662
1665
|
let t16;
|
|
1663
|
-
$[
|
|
1666
|
+
$[27] !== children ? (t16 = [children], $[27] = children, $[28] = t16) : t16 = $[28], react.useEffect(t15, t16);
|
|
1664
1667
|
let t17;
|
|
1665
|
-
$[
|
|
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 $[
|
|
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.
|
|
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(
|
|
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] =
|
|
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,
|
|
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
|
-
$[
|
|
1818
|
+
$[17] === Symbol.for("react.memo_cache_sentinel") ? (t5 = (node) => {
|
|
1815
1819
|
react.startTransition(() => _setRootElement(node));
|
|
1816
|
-
}, $[
|
|
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 ($[
|
|
1828
|
+
if ($[18] !== id || $[19] !== path) {
|
|
1825
1829
|
const itemPath = path.concat([id || ""]);
|
|
1826
|
-
t6 = itemPath, t7 = itemPath.join("/"), $[
|
|
1830
|
+
t6 = itemPath, t7 = itemPath.join("/"), $[18] = id, $[19] = path, $[20] = t6, $[21] = t7;
|
|
1827
1831
|
} else
|
|
1828
|
-
t6 = $[
|
|
1832
|
+
t6 = $[20], t7 = $[21];
|
|
1829
1833
|
let t8;
|
|
1830
|
-
$[
|
|
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
|
-
$[
|
|
1837
|
+
$[25] !== itemPath_0 || $[26] !== t9 || $[27] !== tree ? (t10 = {
|
|
1834
1838
|
...tree,
|
|
1835
1839
|
level: t9,
|
|
1836
1840
|
path: itemPath_0
|
|
1837
|
-
}, $[
|
|
1841
|
+
}, $[25] = itemPath_0, $[26] = t9, $[27] = tree, $[28] = t10) : t10 = $[28];
|
|
1838
1842
|
const contextValue = t10;
|
|
1839
1843
|
let t11;
|
|
1840
|
-
$[
|
|
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
|
-
}, $[
|
|
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
|
-
$[
|
|
1851
|
+
$[36] !== focused || $[37] !== rootElement ? (t12 = (event_0) => {
|
|
1848
1852
|
focused && event_0.key === "Enter" && (treeitemRef.current || rootElement)?.click();
|
|
1849
|
-
}, $[
|
|
1853
|
+
}, $[36] = focused, $[37] = rootElement, $[38] = t12) : t12 = $[38];
|
|
1850
1854
|
const handleKeyDown = t12;
|
|
1851
1855
|
let t13, t14;
|
|
1852
|
-
$[
|
|
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], $[
|
|
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
|
-
$[
|
|
1862
|
+
$[46] !== t15 ? (t16 = {
|
|
1859
1863
|
visibility: t15,
|
|
1860
1864
|
pointerEvents: "none"
|
|
1861
|
-
}, $[
|
|
1865
|
+
}, $[46] = t15, $[47] = t16) : t16 = $[47];
|
|
1862
1866
|
let t17;
|
|
1863
|
-
$[
|
|
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
|
-
$[
|
|
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
|
-
} }) }), $[
|
|
1871
|
+
} }) }), $[53] = IconComponent, $[54] = expanded, $[55] = fontSize, $[56] = muted, $[57] = weight, $[58] = t18) : t18 = $[58];
|
|
1868
1872
|
let t19;
|
|
1869
|
-
$[
|
|
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
|
-
] }), $[
|
|
1876
|
+
] }), $[59] = spacing, $[60] = t16, $[61] = t17, $[62] = t18, $[63] = t19) : t19 = $[63];
|
|
1873
1877
|
let t20;
|
|
1874
|
-
$[
|
|
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
|
-
$[
|
|
1880
|
+
$[69] !== padding || $[70] !== t19 || $[71] !== t20 ? (t21 = /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Flex, { padding, children: [
|
|
1877
1881
|
t19,
|
|
1878
1882
|
t20
|
|
1879
|
-
] }), $[
|
|
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
|
-
$[
|
|
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
|
-
$[
|
|
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
|
-
$[
|
|
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 $[
|
|
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
|
-
] }), $[
|
|
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
|
-
$[
|
|
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
|
-
$[
|
|
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
|
-
$[
|
|
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 $[
|
|
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
|
-
] }), $[
|
|
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;
|