@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.d.cts CHANGED
@@ -1661,7 +1661,8 @@ interface MegaMenuProps {
1661
1661
  * Compose top-level items with `MegaMenu.Item`. An item with children opens a
1662
1662
  * panel (`MegaMenu.Panel` → `MegaMenu.Section` → `MegaMenu.Link`, plus an
1663
1663
  * optional `MegaMenu.Featured` promo column); an item with just `href` is a
1664
- * plain top-level link.
1664
+ * plain top-level link. Each panel positions itself under the bar and sizes to
1665
+ * its content.
1665
1666
  *
1666
1667
  * @example
1667
1668
  * ```tsx
@@ -1701,7 +1702,7 @@ interface MegaMenuItemProps {
1701
1702
  declare function MegaMenuItem({ label, icon, href, children, className }: MegaMenuItemProps): react_jsx_runtime.JSX.Element;
1702
1703
  interface MegaMenuPanelProps {
1703
1704
  children: React__default.ReactNode;
1704
- /** Number of section columns (the featured column sits outside this grid). Default auto. */
1705
+ /** Cap the panel to roughly this many side-by-side columns before wrapping. Default: single row. */
1705
1706
  columns?: 1 | 2 | 3 | 4;
1706
1707
  className?: string;
1707
1708
  style?: React__default.CSSProperties;
package/dist/index.d.ts CHANGED
@@ -1661,7 +1661,8 @@ interface MegaMenuProps {
1661
1661
  * Compose top-level items with `MegaMenu.Item`. An item with children opens a
1662
1662
  * panel (`MegaMenu.Panel` → `MegaMenu.Section` → `MegaMenu.Link`, plus an
1663
1663
  * optional `MegaMenu.Featured` promo column); an item with just `href` is a
1664
- * plain top-level link.
1664
+ * plain top-level link. Each panel positions itself under the bar and sizes to
1665
+ * its content.
1665
1666
  *
1666
1667
  * @example
1667
1668
  * ```tsx
@@ -1701,7 +1702,7 @@ interface MegaMenuItemProps {
1701
1702
  declare function MegaMenuItem({ label, icon, href, children, className }: MegaMenuItemProps): react_jsx_runtime.JSX.Element;
1702
1703
  interface MegaMenuPanelProps {
1703
1704
  children: React__default.ReactNode;
1704
- /** Number of section columns (the featured column sits outside this grid). Default auto. */
1705
+ /** Cap the panel to roughly this many side-by-side columns before wrapping. Default: single row. */
1705
1706
  columns?: 1 | 2 | 3 | 4;
1706
1707
  className?: string;
1707
1708
  style?: React__default.CSSProperties;
package/dist/index.js CHANGED
@@ -3387,29 +3387,23 @@ function Sidebar({
3387
3387
  }
3388
3388
  ) });
3389
3389
  }
3390
+ var MegaMenuContext = createContext({ align: "start" });
3390
3391
  function MegaMenu({ children, align = "start", delayDuration = 200, className = "", style, "aria-label": ariaLabel }) {
3391
- const justify = align === "center" ? "justify-center" : align === "end" ? "justify-end" : "justify-start";
3392
- return /* @__PURE__ */ jsxs(
3392
+ return /* @__PURE__ */ jsx(MegaMenuContext.Provider, { value: { align }, children: /* @__PURE__ */ jsx(
3393
3393
  NavigationMenu.Root,
3394
3394
  {
3395
3395
  delayDuration,
3396
3396
  "aria-label": ariaLabel,
3397
- className: ["relative z-10 flex", className].filter(Boolean).join(" "),
3397
+ className: ["relative z-10 flex w-full", className].filter(Boolean).join(" "),
3398
3398
  style,
3399
- children: [
3400
- /* @__PURE__ */ jsx(NavigationMenu.List, { className: "flex items-center gap-1", children }),
3401
- /* @__PURE__ */ jsx("div", { className: `absolute left-0 top-full flex w-full ${justify} pt-2`, children: /* @__PURE__ */ jsx(
3402
- NavigationMenu.Viewport,
3403
- {
3404
- 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"
3405
- }
3406
- ) })
3407
- ]
3399
+ children: /* @__PURE__ */ jsx(NavigationMenu.List, { className: "flex items-center gap-1", children })
3408
3400
  }
3409
- );
3401
+ ) });
3410
3402
  }
3411
3403
  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";
3412
3404
  function MegaMenuItem({ label, icon, href, children, className = "" }) {
3405
+ const { align } = useContext(MegaMenuContext);
3406
+ const pos = align === "center" ? "left-1/2 -translate-x-1/2" : align === "end" ? "right-0" : "left-0";
3413
3407
  if (!children) {
3414
3408
  return /* @__PURE__ */ jsx(NavigationMenu.Item, { children: /* @__PURE__ */ jsxs(NavigationMenu.Link, { href, className: [TOP_ITEM, className].filter(Boolean).join(" "), children: [
3415
3409
  icon && /* @__PURE__ */ jsx("span", { className: "flex h-4 w-4 flex-shrink-0 items-center justify-center", children: icon }),
@@ -3433,16 +3427,24 @@ function MegaMenuItem({ label, icon, href, children, className = "" }) {
3433
3427
  }
3434
3428
  )
3435
3429
  ] }),
3436
- /* @__PURE__ */ jsx(NavigationMenu.Content, { className: "data-[motion=from-start]:animate-in data-[motion=to-end]:animate-out", children })
3430
+ /* @__PURE__ */ jsx(
3431
+ NavigationMenu.Content,
3432
+ {
3433
+ className: `absolute top-full mt-2 ${pos} z-20 overflow-hidden rounded-lg border border-border bg-surface shadow-lg
3434
+ data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95
3435
+ data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95`,
3436
+ children
3437
+ }
3438
+ )
3437
3439
  ] });
3438
3440
  }
3439
- var COLS = { 1: "grid-cols-1", 2: "grid-cols-2", 3: "grid-cols-3", 4: "grid-cols-4" };
3440
3441
  function MegaMenuPanel({ children, columns, className = "", style }) {
3442
+ const maxWidth = columns ? `${columns * 248}px` : "min(92vw, 880px)";
3441
3443
  return /* @__PURE__ */ jsx(
3442
3444
  "div",
3443
3445
  {
3444
- 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(" "),
3445
- style,
3446
+ className: ["flex flex-wrap gap-6 p-6", className].filter(Boolean).join(" "),
3447
+ style: { maxWidth, ...style },
3446
3448
  children
3447
3449
  }
3448
3450
  );