@geomak/ui 7.3.1 → 7.3.3
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.cjs +90 -66
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +90 -66
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1286,8 +1286,7 @@ function TreeNodeItem({
|
|
|
1286
1286
|
item,
|
|
1287
1287
|
onNodeClick,
|
|
1288
1288
|
defaultExpandAll,
|
|
1289
|
-
defaultExpandedKeys
|
|
1290
|
-
depth = 0
|
|
1289
|
+
defaultExpandedKeys
|
|
1291
1290
|
}) {
|
|
1292
1291
|
if (!isParent(item)) {
|
|
1293
1292
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -1295,7 +1294,6 @@ function TreeNodeItem({
|
|
|
1295
1294
|
{
|
|
1296
1295
|
type: "button",
|
|
1297
1296
|
className: "flex w-full items-center gap-2.5 cursor-pointer select-none group text-left rounded-md px-2 py-1.5 hover:bg-surface-raised transition-colors duration-150 focus:outline-none focus-visible:ring-2 focus-visible:ring-accent",
|
|
1298
|
-
style: { paddingLeft: depth * 12 + 8 },
|
|
1299
1297
|
onClick: () => onNodeClick({
|
|
1300
1298
|
isParent: false,
|
|
1301
1299
|
key: item.key,
|
|
@@ -1311,62 +1309,53 @@ function TreeNodeItem({
|
|
|
1311
1309
|
);
|
|
1312
1310
|
}
|
|
1313
1311
|
const initialOpen = defaultExpandAll || defaultExpandedKeys.includes(item.key) ? [item.key] : [];
|
|
1314
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1312
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AccordionPrimitive__namespace.Root, { type: "multiple", defaultValue: initialOpen, children: /* @__PURE__ */ jsxRuntime.jsxs(AccordionPrimitive__namespace.Item, { value: item.key, className: "border-none", children: [
|
|
1313
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1314
|
+
AccordionPrimitive__namespace.Trigger,
|
|
1315
|
+
{
|
|
1316
|
+
onClick: () => onNodeClick({
|
|
1317
|
+
isParent: true,
|
|
1318
|
+
key: item.key,
|
|
1319
|
+
label: item.label,
|
|
1320
|
+
data: item.nodeData,
|
|
1321
|
+
parentLabel: item.parentLabel
|
|
1322
|
+
}),
|
|
1323
|
+
className: "flex items-center gap-2 cursor-pointer py-1.5 px-2 group focus:outline-none focus-visible:ring-2 focus-visible:ring-accent w-full text-left rounded-md hover:bg-surface-raised transition-colors duration-150",
|
|
1324
|
+
children: [
|
|
1325
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1326
|
+
"svg",
|
|
1327
|
+
{
|
|
1328
|
+
viewBox: "0 0 24 24",
|
|
1329
|
+
fill: "none",
|
|
1330
|
+
stroke: "currentColor",
|
|
1331
|
+
strokeWidth: 2.5,
|
|
1332
|
+
className: "h-3.5 w-3.5 flex-shrink-0 text-foreground-muted transition-transform duration-200 group-data-[state=open]:rotate-0 group-data-[state=closed]:-rotate-90",
|
|
1333
|
+
"aria-hidden": "true",
|
|
1334
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1335
|
+
"path",
|
|
1335
1336
|
{
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
strokeWidth: 2.5,
|
|
1340
|
-
className: "h-3.5 w-3.5 flex-shrink-0 text-foreground-muted transition-transform duration-200 group-data-[state=open]:rotate-0 group-data-[state=closed]:-rotate-90",
|
|
1341
|
-
"aria-hidden": "true",
|
|
1342
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1343
|
-
"path",
|
|
1344
|
-
{
|
|
1345
|
-
strokeLinecap: "round",
|
|
1346
|
-
strokeLinejoin: "round",
|
|
1347
|
-
d: "M19 9l-7 7-7-7"
|
|
1348
|
-
}
|
|
1349
|
-
)
|
|
1337
|
+
strokeLinecap: "round",
|
|
1338
|
+
strokeLinejoin: "round",
|
|
1339
|
+
d: "M19 9l-7 7-7-7"
|
|
1350
1340
|
}
|
|
1351
|
-
)
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
}
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
);
|
|
1341
|
+
)
|
|
1342
|
+
}
|
|
1343
|
+
),
|
|
1344
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-semibold text-foreground select-none", children: item.label })
|
|
1345
|
+
]
|
|
1346
|
+
}
|
|
1347
|
+
),
|
|
1348
|
+
/* @__PURE__ */ jsxRuntime.jsx(AccordionPrimitive__namespace.Content, { className: "overflow-hidden data-[state=open]:animate-accordion-down data-[state=closed]:animate-accordion-up", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ml-3.5 border-l border-border py-0.5", children: item.children.map((child) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1349
|
+
TreeNodeItem,
|
|
1350
|
+
{
|
|
1351
|
+
item: child,
|
|
1352
|
+
onNodeClick,
|
|
1353
|
+
defaultExpandAll,
|
|
1354
|
+
defaultExpandedKeys
|
|
1355
|
+
},
|
|
1356
|
+
child.key
|
|
1357
|
+
)) }) })
|
|
1358
|
+
] }) });
|
|
1370
1359
|
}
|
|
1371
1360
|
function Tree({
|
|
1372
1361
|
nodes,
|
|
@@ -5915,6 +5904,49 @@ function FlyoutItems({ items }) {
|
|
|
5915
5904
|
return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu2__namespace.Item, { onSelect: () => child.onClick?.(), className: cls, children: label }, child.key);
|
|
5916
5905
|
}) });
|
|
5917
5906
|
}
|
|
5907
|
+
function CollapsedFlyout({ item, trigger }) {
|
|
5908
|
+
const [open, setOpen] = React30.useState(false);
|
|
5909
|
+
const closeTimer = React30__default.default.useRef(void 0);
|
|
5910
|
+
const openNow = () => {
|
|
5911
|
+
window.clearTimeout(closeTimer.current);
|
|
5912
|
+
setOpen(true);
|
|
5913
|
+
};
|
|
5914
|
+
const closeSoon = () => {
|
|
5915
|
+
window.clearTimeout(closeTimer.current);
|
|
5916
|
+
closeTimer.current = window.setTimeout(() => setOpen(false), 150);
|
|
5917
|
+
};
|
|
5918
|
+
React30__default.default.useEffect(() => () => window.clearTimeout(closeTimer.current), []);
|
|
5919
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu2__namespace.Root, { open, onOpenChange: setOpen, modal: false, children: [
|
|
5920
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5921
|
+
DropdownMenu2__namespace.Trigger,
|
|
5922
|
+
{
|
|
5923
|
+
asChild: true,
|
|
5924
|
+
onPointerEnter: openNow,
|
|
5925
|
+
onPointerLeave: closeSoon,
|
|
5926
|
+
onPointerDown: (e) => {
|
|
5927
|
+
if (e.pointerType === "mouse") e.preventDefault();
|
|
5928
|
+
},
|
|
5929
|
+
children: trigger
|
|
5930
|
+
}
|
|
5931
|
+
),
|
|
5932
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenu2__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5933
|
+
DropdownMenu2__namespace.Content,
|
|
5934
|
+
{
|
|
5935
|
+
side: "right",
|
|
5936
|
+
align: "start",
|
|
5937
|
+
sideOffset: 8,
|
|
5938
|
+
collisionPadding: 8,
|
|
5939
|
+
className: FLYOUT_PANEL,
|
|
5940
|
+
onPointerEnter: openNow,
|
|
5941
|
+
onPointerLeave: closeSoon,
|
|
5942
|
+
children: [
|
|
5943
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenu2__namespace.Label, { className: "px-2.5 pb-1 pt-1.5 text-xs font-semibold text-foreground-muted", children: item.label }),
|
|
5944
|
+
/* @__PURE__ */ jsxRuntime.jsx(FlyoutItems, { items: item.items })
|
|
5945
|
+
]
|
|
5946
|
+
}
|
|
5947
|
+
) })
|
|
5948
|
+
] });
|
|
5949
|
+
}
|
|
5918
5950
|
function NavItem({
|
|
5919
5951
|
item,
|
|
5920
5952
|
isExpanded,
|
|
@@ -5963,15 +5995,7 @@ function NavItem({
|
|
|
5963
5995
|
}
|
|
5964
5996
|
);
|
|
5965
5997
|
if (!isExpanded) {
|
|
5966
|
-
if (hasChildren) {
|
|
5967
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu2__namespace.Root, { children: [
|
|
5968
|
-
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenu2__namespace.Trigger, { asChild: true, children: btn }),
|
|
5969
|
-
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenu2__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu2__namespace.Content, { side: "right", align: "start", sideOffset: 8, collisionPadding: 8, className: FLYOUT_PANEL, children: [
|
|
5970
|
-
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenu2__namespace.Label, { className: "px-2.5 pb-1 pt-1.5 text-xs font-semibold text-foreground-muted", children: item.label }),
|
|
5971
|
-
/* @__PURE__ */ jsxRuntime.jsx(FlyoutItems, { items: item.items })
|
|
5972
|
-
] }) })
|
|
5973
|
-
] });
|
|
5974
|
-
}
|
|
5998
|
+
if (hasChildren) return /* @__PURE__ */ jsxRuntime.jsx(CollapsedFlyout, { item, trigger: btn });
|
|
5975
5999
|
return /* @__PURE__ */ jsxRuntime.jsx(Tooltip, { title: item.label, placement: "right", delayDuration: 200, children: btn });
|
|
5976
6000
|
}
|
|
5977
6001
|
if (!hasChildren) return btn;
|