@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.js
CHANGED
|
@@ -1249,8 +1249,7 @@ function TreeNodeItem({
|
|
|
1249
1249
|
item,
|
|
1250
1250
|
onNodeClick,
|
|
1251
1251
|
defaultExpandAll,
|
|
1252
|
-
defaultExpandedKeys
|
|
1253
|
-
depth = 0
|
|
1252
|
+
defaultExpandedKeys
|
|
1254
1253
|
}) {
|
|
1255
1254
|
if (!isParent(item)) {
|
|
1256
1255
|
return /* @__PURE__ */ jsxs(
|
|
@@ -1258,7 +1257,6 @@ function TreeNodeItem({
|
|
|
1258
1257
|
{
|
|
1259
1258
|
type: "button",
|
|
1260
1259
|
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",
|
|
1261
|
-
style: { paddingLeft: depth * 12 + 8 },
|
|
1262
1260
|
onClick: () => onNodeClick({
|
|
1263
1261
|
isParent: false,
|
|
1264
1262
|
key: item.key,
|
|
@@ -1274,62 +1272,53 @@ function TreeNodeItem({
|
|
|
1274
1272
|
);
|
|
1275
1273
|
}
|
|
1276
1274
|
const initialOpen = defaultExpandAll || defaultExpandedKeys.includes(item.key) ? [item.key] : [];
|
|
1277
|
-
return /* @__PURE__ */ jsx(
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1275
|
+
return /* @__PURE__ */ jsx(AccordionPrimitive.Root, { type: "multiple", defaultValue: initialOpen, children: /* @__PURE__ */ jsxs(AccordionPrimitive.Item, { value: item.key, className: "border-none", children: [
|
|
1276
|
+
/* @__PURE__ */ jsxs(
|
|
1277
|
+
AccordionPrimitive.Trigger,
|
|
1278
|
+
{
|
|
1279
|
+
onClick: () => onNodeClick({
|
|
1280
|
+
isParent: true,
|
|
1281
|
+
key: item.key,
|
|
1282
|
+
label: item.label,
|
|
1283
|
+
data: item.nodeData,
|
|
1284
|
+
parentLabel: item.parentLabel
|
|
1285
|
+
}),
|
|
1286
|
+
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",
|
|
1287
|
+
children: [
|
|
1288
|
+
/* @__PURE__ */ jsx(
|
|
1289
|
+
"svg",
|
|
1290
|
+
{
|
|
1291
|
+
viewBox: "0 0 24 24",
|
|
1292
|
+
fill: "none",
|
|
1293
|
+
stroke: "currentColor",
|
|
1294
|
+
strokeWidth: 2.5,
|
|
1295
|
+
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",
|
|
1296
|
+
"aria-hidden": "true",
|
|
1297
|
+
children: /* @__PURE__ */ jsx(
|
|
1298
|
+
"path",
|
|
1298
1299
|
{
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
strokeWidth: 2.5,
|
|
1303
|
-
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",
|
|
1304
|
-
"aria-hidden": "true",
|
|
1305
|
-
children: /* @__PURE__ */ jsx(
|
|
1306
|
-
"path",
|
|
1307
|
-
{
|
|
1308
|
-
strokeLinecap: "round",
|
|
1309
|
-
strokeLinejoin: "round",
|
|
1310
|
-
d: "M19 9l-7 7-7-7"
|
|
1311
|
-
}
|
|
1312
|
-
)
|
|
1300
|
+
strokeLinecap: "round",
|
|
1301
|
+
strokeLinejoin: "round",
|
|
1302
|
+
d: "M19 9l-7 7-7-7"
|
|
1313
1303
|
}
|
|
1314
|
-
)
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
}
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
);
|
|
1304
|
+
)
|
|
1305
|
+
}
|
|
1306
|
+
),
|
|
1307
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-semibold text-foreground select-none", children: item.label })
|
|
1308
|
+
]
|
|
1309
|
+
}
|
|
1310
|
+
),
|
|
1311
|
+
/* @__PURE__ */ jsx(AccordionPrimitive.Content, { className: "overflow-hidden data-[state=open]:animate-accordion-down data-[state=closed]:animate-accordion-up", children: /* @__PURE__ */ jsx("div", { className: "ml-3.5 border-l border-border py-0.5", children: item.children.map((child) => /* @__PURE__ */ jsx(
|
|
1312
|
+
TreeNodeItem,
|
|
1313
|
+
{
|
|
1314
|
+
item: child,
|
|
1315
|
+
onNodeClick,
|
|
1316
|
+
defaultExpandAll,
|
|
1317
|
+
defaultExpandedKeys
|
|
1318
|
+
},
|
|
1319
|
+
child.key
|
|
1320
|
+
)) }) })
|
|
1321
|
+
] }) });
|
|
1333
1322
|
}
|
|
1334
1323
|
function Tree({
|
|
1335
1324
|
nodes,
|
|
@@ -5878,6 +5867,49 @@ function FlyoutItems({ items }) {
|
|
|
5878
5867
|
return /* @__PURE__ */ jsx(DropdownMenu2.Item, { onSelect: () => child.onClick?.(), className: cls, children: label }, child.key);
|
|
5879
5868
|
}) });
|
|
5880
5869
|
}
|
|
5870
|
+
function CollapsedFlyout({ item, trigger }) {
|
|
5871
|
+
const [open, setOpen] = useState(false);
|
|
5872
|
+
const closeTimer = React30.useRef(void 0);
|
|
5873
|
+
const openNow = () => {
|
|
5874
|
+
window.clearTimeout(closeTimer.current);
|
|
5875
|
+
setOpen(true);
|
|
5876
|
+
};
|
|
5877
|
+
const closeSoon = () => {
|
|
5878
|
+
window.clearTimeout(closeTimer.current);
|
|
5879
|
+
closeTimer.current = window.setTimeout(() => setOpen(false), 150);
|
|
5880
|
+
};
|
|
5881
|
+
React30.useEffect(() => () => window.clearTimeout(closeTimer.current), []);
|
|
5882
|
+
return /* @__PURE__ */ jsxs(DropdownMenu2.Root, { open, onOpenChange: setOpen, modal: false, children: [
|
|
5883
|
+
/* @__PURE__ */ jsx(
|
|
5884
|
+
DropdownMenu2.Trigger,
|
|
5885
|
+
{
|
|
5886
|
+
asChild: true,
|
|
5887
|
+
onPointerEnter: openNow,
|
|
5888
|
+
onPointerLeave: closeSoon,
|
|
5889
|
+
onPointerDown: (e) => {
|
|
5890
|
+
if (e.pointerType === "mouse") e.preventDefault();
|
|
5891
|
+
},
|
|
5892
|
+
children: trigger
|
|
5893
|
+
}
|
|
5894
|
+
),
|
|
5895
|
+
/* @__PURE__ */ jsx(DropdownMenu2.Portal, { children: /* @__PURE__ */ jsxs(
|
|
5896
|
+
DropdownMenu2.Content,
|
|
5897
|
+
{
|
|
5898
|
+
side: "right",
|
|
5899
|
+
align: "start",
|
|
5900
|
+
sideOffset: 8,
|
|
5901
|
+
collisionPadding: 8,
|
|
5902
|
+
className: FLYOUT_PANEL,
|
|
5903
|
+
onPointerEnter: openNow,
|
|
5904
|
+
onPointerLeave: closeSoon,
|
|
5905
|
+
children: [
|
|
5906
|
+
/* @__PURE__ */ jsx(DropdownMenu2.Label, { className: "px-2.5 pb-1 pt-1.5 text-xs font-semibold text-foreground-muted", children: item.label }),
|
|
5907
|
+
/* @__PURE__ */ jsx(FlyoutItems, { items: item.items })
|
|
5908
|
+
]
|
|
5909
|
+
}
|
|
5910
|
+
) })
|
|
5911
|
+
] });
|
|
5912
|
+
}
|
|
5881
5913
|
function NavItem({
|
|
5882
5914
|
item,
|
|
5883
5915
|
isExpanded,
|
|
@@ -5926,15 +5958,7 @@ function NavItem({
|
|
|
5926
5958
|
}
|
|
5927
5959
|
);
|
|
5928
5960
|
if (!isExpanded) {
|
|
5929
|
-
if (hasChildren) {
|
|
5930
|
-
return /* @__PURE__ */ jsxs(DropdownMenu2.Root, { children: [
|
|
5931
|
-
/* @__PURE__ */ jsx(DropdownMenu2.Trigger, { asChild: true, children: btn }),
|
|
5932
|
-
/* @__PURE__ */ jsx(DropdownMenu2.Portal, { children: /* @__PURE__ */ jsxs(DropdownMenu2.Content, { side: "right", align: "start", sideOffset: 8, collisionPadding: 8, className: FLYOUT_PANEL, children: [
|
|
5933
|
-
/* @__PURE__ */ jsx(DropdownMenu2.Label, { className: "px-2.5 pb-1 pt-1.5 text-xs font-semibold text-foreground-muted", children: item.label }),
|
|
5934
|
-
/* @__PURE__ */ jsx(FlyoutItems, { items: item.items })
|
|
5935
|
-
] }) })
|
|
5936
|
-
] });
|
|
5937
|
-
}
|
|
5961
|
+
if (hasChildren) return /* @__PURE__ */ jsx(CollapsedFlyout, { item, trigger: btn });
|
|
5938
5962
|
return /* @__PURE__ */ jsx(Tooltip, { title: item.label, placement: "right", delayDuration: 200, children: btn });
|
|
5939
5963
|
}
|
|
5940
5964
|
if (!hasChildren) return btn;
|