@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 CHANGED
@@ -5915,6 +5915,49 @@ function FlyoutItems({ items }) {
5915
5915
  return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu2__namespace.Item, { onSelect: () => child.onClick?.(), className: cls, children: label }, child.key);
5916
5916
  }) });
5917
5917
  }
5918
+ function CollapsedFlyout({ item, trigger }) {
5919
+ const [open, setOpen] = React30.useState(false);
5920
+ const closeTimer = React30__default.default.useRef(void 0);
5921
+ const openNow = () => {
5922
+ window.clearTimeout(closeTimer.current);
5923
+ setOpen(true);
5924
+ };
5925
+ const closeSoon = () => {
5926
+ window.clearTimeout(closeTimer.current);
5927
+ closeTimer.current = window.setTimeout(() => setOpen(false), 150);
5928
+ };
5929
+ React30__default.default.useEffect(() => () => window.clearTimeout(closeTimer.current), []);
5930
+ return /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu2__namespace.Root, { open, onOpenChange: setOpen, modal: false, children: [
5931
+ /* @__PURE__ */ jsxRuntime.jsx(
5932
+ DropdownMenu2__namespace.Trigger,
5933
+ {
5934
+ asChild: true,
5935
+ onPointerEnter: openNow,
5936
+ onPointerLeave: closeSoon,
5937
+ onPointerDown: (e) => {
5938
+ if (e.pointerType === "mouse") e.preventDefault();
5939
+ },
5940
+ children: trigger
5941
+ }
5942
+ ),
5943
+ /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu2__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsxs(
5944
+ DropdownMenu2__namespace.Content,
5945
+ {
5946
+ side: "right",
5947
+ align: "start",
5948
+ sideOffset: 8,
5949
+ collisionPadding: 8,
5950
+ className: FLYOUT_PANEL,
5951
+ onPointerEnter: openNow,
5952
+ onPointerLeave: closeSoon,
5953
+ children: [
5954
+ /* @__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 }),
5955
+ /* @__PURE__ */ jsxRuntime.jsx(FlyoutItems, { items: item.items })
5956
+ ]
5957
+ }
5958
+ ) })
5959
+ ] });
5960
+ }
5918
5961
  function NavItem({
5919
5962
  item,
5920
5963
  isExpanded,
@@ -5963,15 +6006,7 @@ function NavItem({
5963
6006
  }
5964
6007
  );
5965
6008
  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
- }
6009
+ if (hasChildren) return /* @__PURE__ */ jsxRuntime.jsx(CollapsedFlyout, { item, trigger: btn });
5975
6010
  return /* @__PURE__ */ jsxRuntime.jsx(Tooltip, { title: item.label, placement: "right", delayDuration: 200, children: btn });
5976
6011
  }
5977
6012
  if (!hasChildren) return btn;