@geomak/ui 6.2.0 → 6.2.1

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
@@ -3423,29 +3423,23 @@ function Sidebar({
3423
3423
  }
3424
3424
  ) });
3425
3425
  }
3426
+ var MegaMenuContext = React8.createContext({ align: "start" });
3426
3427
  function MegaMenu({ children, align = "start", delayDuration = 200, className = "", style, "aria-label": ariaLabel }) {
3427
- const justify = align === "center" ? "justify-center" : align === "end" ? "justify-end" : "justify-start";
3428
- return /* @__PURE__ */ jsxRuntime.jsxs(
3428
+ return /* @__PURE__ */ jsxRuntime.jsx(MegaMenuContext.Provider, { value: { align }, children: /* @__PURE__ */ jsxRuntime.jsx(
3429
3429
  NavigationMenu__namespace.Root,
3430
3430
  {
3431
3431
  delayDuration,
3432
3432
  "aria-label": ariaLabel,
3433
- className: ["relative z-10 flex", className].filter(Boolean).join(" "),
3433
+ className: ["relative z-10 flex w-full", className].filter(Boolean).join(" "),
3434
3434
  style,
3435
- children: [
3436
- /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu__namespace.List, { className: "flex items-center gap-1", children }),
3437
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: `absolute left-0 top-full flex w-full ${justify} pt-2`, children: /* @__PURE__ */ jsxRuntime.jsx(
3438
- NavigationMenu__namespace.Viewport,
3439
- {
3440
- className: "relative origin-top overflow-hidden rounded-lg border border-border bg-surface shadow-lg\n h-[var(--radix-navigation-menu-viewport-height)] w-[var(--radix-navigation-menu-viewport-width)]\n transition-[width,height] duration-200 ease-out\n data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95\n data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95"
3441
- }
3442
- ) })
3443
- ]
3435
+ children: /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu__namespace.List, { className: "flex items-center gap-1", children })
3444
3436
  }
3445
- );
3437
+ ) });
3446
3438
  }
3447
3439
  var TOP_ITEM = "group/top inline-flex items-center gap-1.5 h-10 px-3 rounded-md text-sm font-medium select-none text-foreground-secondary hover:text-foreground hover:bg-surface-raised data-[state=open]:text-accent data-[active]:text-accent transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-accent";
3448
3440
  function MegaMenuItem({ label, icon, href, children, className = "" }) {
3441
+ const { align } = React8.useContext(MegaMenuContext);
3442
+ const pos = align === "center" ? "left-1/2 -translate-x-1/2" : align === "end" ? "right-0" : "left-0";
3449
3443
  if (!children) {
3450
3444
  return /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu__namespace.Item, { children: /* @__PURE__ */ jsxRuntime.jsxs(NavigationMenu__namespace.Link, { href, className: [TOP_ITEM, className].filter(Boolean).join(" "), children: [
3451
3445
  icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex h-4 w-4 flex-shrink-0 items-center justify-center", children: icon }),
@@ -3469,16 +3463,24 @@ function MegaMenuItem({ label, icon, href, children, className = "" }) {
3469
3463
  }
3470
3464
  )
3471
3465
  ] }),
3472
- /* @__PURE__ */ jsxRuntime.jsx(NavigationMenu__namespace.Content, { className: "data-[motion=from-start]:animate-in data-[motion=to-end]:animate-out", children })
3466
+ /* @__PURE__ */ jsxRuntime.jsx(
3467
+ NavigationMenu__namespace.Content,
3468
+ {
3469
+ className: `absolute top-full mt-2 ${pos} z-20 overflow-hidden rounded-lg border border-border bg-surface shadow-lg
3470
+ data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95
3471
+ data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95`,
3472
+ children
3473
+ }
3474
+ )
3473
3475
  ] });
3474
3476
  }
3475
- var COLS = { 1: "grid-cols-1", 2: "grid-cols-2", 3: "grid-cols-3", 4: "grid-cols-4" };
3476
3477
  function MegaMenuPanel({ children, columns, className = "", style }) {
3478
+ const maxWidth = columns ? `${columns * 248}px` : "min(92vw, 880px)";
3477
3479
  return /* @__PURE__ */ jsxRuntime.jsx(
3478
3480
  "div",
3479
3481
  {
3480
- className: ["grid gap-6 p-6", columns ? COLS[columns] : "auto-cols-fr grid-flow-col", "w-max max-w-[min(92vw,860px)]", className].filter(Boolean).join(" "),
3481
- style,
3482
+ className: ["flex flex-wrap gap-6 p-6", className].filter(Boolean).join(" "),
3483
+ style: { maxWidth, ...style },
3482
3484
  children
3483
3485
  }
3484
3486
  );