@geomak/ui 7.3.1 → 7.3.2
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 +44 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +44 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5878,6 +5878,49 @@ function FlyoutItems({ items }) {
|
|
|
5878
5878
|
return /* @__PURE__ */ jsx(DropdownMenu2.Item, { onSelect: () => child.onClick?.(), className: cls, children: label }, child.key);
|
|
5879
5879
|
}) });
|
|
5880
5880
|
}
|
|
5881
|
+
function CollapsedFlyout({ item, trigger }) {
|
|
5882
|
+
const [open, setOpen] = useState(false);
|
|
5883
|
+
const closeTimer = React30.useRef(void 0);
|
|
5884
|
+
const openNow = () => {
|
|
5885
|
+
window.clearTimeout(closeTimer.current);
|
|
5886
|
+
setOpen(true);
|
|
5887
|
+
};
|
|
5888
|
+
const closeSoon = () => {
|
|
5889
|
+
window.clearTimeout(closeTimer.current);
|
|
5890
|
+
closeTimer.current = window.setTimeout(() => setOpen(false), 150);
|
|
5891
|
+
};
|
|
5892
|
+
React30.useEffect(() => () => window.clearTimeout(closeTimer.current), []);
|
|
5893
|
+
return /* @__PURE__ */ jsxs(DropdownMenu2.Root, { open, onOpenChange: setOpen, modal: false, children: [
|
|
5894
|
+
/* @__PURE__ */ jsx(
|
|
5895
|
+
DropdownMenu2.Trigger,
|
|
5896
|
+
{
|
|
5897
|
+
asChild: true,
|
|
5898
|
+
onPointerEnter: openNow,
|
|
5899
|
+
onPointerLeave: closeSoon,
|
|
5900
|
+
onPointerDown: (e) => {
|
|
5901
|
+
if (e.pointerType === "mouse") e.preventDefault();
|
|
5902
|
+
},
|
|
5903
|
+
children: trigger
|
|
5904
|
+
}
|
|
5905
|
+
),
|
|
5906
|
+
/* @__PURE__ */ jsx(DropdownMenu2.Portal, { children: /* @__PURE__ */ jsxs(
|
|
5907
|
+
DropdownMenu2.Content,
|
|
5908
|
+
{
|
|
5909
|
+
side: "right",
|
|
5910
|
+
align: "start",
|
|
5911
|
+
sideOffset: 8,
|
|
5912
|
+
collisionPadding: 8,
|
|
5913
|
+
className: FLYOUT_PANEL,
|
|
5914
|
+
onPointerEnter: openNow,
|
|
5915
|
+
onPointerLeave: closeSoon,
|
|
5916
|
+
children: [
|
|
5917
|
+
/* @__PURE__ */ jsx(DropdownMenu2.Label, { className: "px-2.5 pb-1 pt-1.5 text-xs font-semibold text-foreground-muted", children: item.label }),
|
|
5918
|
+
/* @__PURE__ */ jsx(FlyoutItems, { items: item.items })
|
|
5919
|
+
]
|
|
5920
|
+
}
|
|
5921
|
+
) })
|
|
5922
|
+
] });
|
|
5923
|
+
}
|
|
5881
5924
|
function NavItem({
|
|
5882
5925
|
item,
|
|
5883
5926
|
isExpanded,
|
|
@@ -5926,15 +5969,7 @@ function NavItem({
|
|
|
5926
5969
|
}
|
|
5927
5970
|
);
|
|
5928
5971
|
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
|
-
}
|
|
5972
|
+
if (hasChildren) return /* @__PURE__ */ jsx(CollapsedFlyout, { item, trigger: btn });
|
|
5938
5973
|
return /* @__PURE__ */ jsx(Tooltip, { title: item.label, placement: "right", delayDuration: 200, children: btn });
|
|
5939
5974
|
}
|
|
5940
5975
|
if (!hasChildren) return btn;
|