@nswds/ui 4.7.0 → 4.7.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.
Files changed (36) hide show
  1. package/README.md +23 -4
  2. package/dist/components/badge.js +1 -1
  3. package/dist/components/badge.js.map +1 -1
  4. package/dist/components/button.js +1 -1
  5. package/dist/components/button.js.map +1 -1
  6. package/dist/components/expandable-search.js +2 -2
  7. package/dist/components/expandable-search.js.map +1 -1
  8. package/dist/components/field.js +1 -1
  9. package/dist/components/field.js.map +1 -1
  10. package/dist/components/footer.js +11 -8
  11. package/dist/components/footer.js.map +1 -1
  12. package/dist/components/header.js +9 -6
  13. package/dist/components/header.js.map +1 -1
  14. package/dist/components/input.js +1 -1
  15. package/dist/components/input.js.map +1 -1
  16. package/dist/components/link.js +1 -1
  17. package/dist/components/link.js.map +1 -1
  18. package/dist/components/main-nav.js +4 -4
  19. package/dist/components/main-nav.js.map +1 -1
  20. package/dist/components/navigation-menu.js +7 -7
  21. package/dist/components/navigation-menu.js.map +1 -1
  22. package/dist/components/push-menu.d.ts +5 -5
  23. package/dist/components/push-menu.js +2 -2
  24. package/dist/components/push-menu.js.map +1 -1
  25. package/dist/components/side-nav.js +5 -5
  26. package/dist/components/side-nav.js.map +1 -1
  27. package/dist/components/site-search.js +2 -2
  28. package/dist/components/site-search.js.map +1 -1
  29. package/dist/components/skip-link.js +1 -1
  30. package/dist/components/skip-link.js.map +1 -1
  31. package/dist/components/spinner.js +1 -1
  32. package/dist/components/spinner.js.map +1 -1
  33. package/dist/components/step-indicator.js +5 -5
  34. package/dist/components/step-indicator.js.map +1 -1
  35. package/dist/styles.css +1 -1
  36. package/package.json +3 -2
@@ -149,7 +149,7 @@ const mainNavItemInk = "[--nav-menu-ink:var(--main-nav-ink)] dark:[--nav-menu-in
149
149
  const mainNavPanelInk = "[--nav-menu-ink:var(--main-nav-panel-ink)] dark:[--nav-menu-ink:var(--main-nav-panel-ink)]";
150
150
  const mainNavTriggerClassName = [
151
151
  mainNavItemInk,
152
- "mb-0 h-auto min-h-14 w-auto justify-start rounded-none px-4 py-2 text-base leading-6 font-bold text-(--main-nav-ink)",
152
+ "mb-0 h-auto min-h-14 w-auto justify-start rounded-none max-lg:px-4 py-2 text-base leading-6 font-bold text-(--main-nav-ink)",
153
153
  "lg:px-8",
154
154
  "[&_svg]:size-6",
155
155
  "data-popup-open:shadow-[inset_0_-4px_0_0_currentColor]",
@@ -157,7 +157,7 @@ const mainNavTriggerClassName = [
157
157
  ].join(" ");
158
158
  const mainNavTopLinkClassName = [
159
159
  mainNavItemInk,
160
- "inline-flex min-h-14 flex-row items-center justify-start gap-1 rounded-none px-4 py-2 text-base leading-6 font-bold whitespace-nowrap text-(--main-nav-ink)",
160
+ "inline-flex min-h-14 flex-row items-center justify-start gap-1 rounded-none max-lg:px-4 py-2 text-base leading-6 font-bold whitespace-nowrap text-(--main-nav-ink)",
161
161
  "lg:px-8",
162
162
  "data-active:shadow-[inset_0_-4px_0_0_currentColor]"
163
163
  ].join(" ");
@@ -233,7 +233,7 @@ function MainNavMenuItem({ item, color, currentHref, panelWidth }) {
233
233
  IconEast,
234
234
  {
235
235
  "aria-hidden": "true",
236
- className: "ml-4 size-6 shrink-0 text-current transition-transform duration-300 ease-[cubic-bezier(0.22,1,0.36,1)] group-hover:translate-x-1 motion-reduce:transition-none"
236
+ className: "ml-4 size-6 shrink-0 text-current duration-300 ease-[cubic-bezier(0.22,1,0.36,1)] group-hover:translate-x-1 motion-safe:transition-transform"
237
237
  }
238
238
  )
239
239
  ]
@@ -243,7 +243,7 @@ function MainNavMenuItem({ item, color, currentHref, panelWidth }) {
243
243
  "div",
244
244
  {
245
245
  "data-slot": "main-nav-panel-links",
246
- className: "grid grid-cols-1 overflow-hidden px-4 pb-12 sm:grid-cols-2 lg:grid-cols-3",
246
+ className: "grid overflow-hidden px-4 pb-12 max-sm:grid-cols-1 sm:max-lg:grid-cols-2 lg:grid-cols-3",
247
247
  children: links.map((link, index) => /* @__PURE__ */ jsx(
248
248
  NavigationMenuLink,
249
249
  {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/main-nav.tsx"],"names":[],"mappings":";;;;;;;AAoCA,MAAM,aAAA,GAAgB;AAAA,EACpB,aAAA;AAAA,EACA,aAAA;AAAA,EACA,aAAA;AAAA,EACA,aAAA;AAAA,EACA,UAAA;AAAA,EACA,UAAA;AAAA,EACA,UAAA;AAAA,EACA,UAAA;AAAA,EACA,YAAA;AAAA,EACA,YAAA;AAAA,EACA,YAAA;AAAA,EACA,YAAA;AAAA,EACA;AACF;AAMA,MAAM,sBAAA,GAAuC,OAAA;AAE7C,MAAM,eAAA,GAAkB,GAAA;AAAA,EACtB;AAAA,IACE,QAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAUA;AAAA,GACF;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAeR,KAAA,EAAO;AAAA,QACL,aAAA,EACE,mFAAA;AAAA,QACF,aAAA,EACE,mFAAA;AAAA,QACF,aAAA,EACE,kJAAA;AAAA,QACF,aAAA,EACE,kJAAA;AAAA,QACF,UAAA,EAAY,6EAAA;AAAA,QACZ,UAAA,EAAY,6EAAA;AAAA,QACZ,UAAA,EACE,sIAAA;AAAA,QACF,UAAA,EACE,sIAAA;AAAA,QACF,YAAA,EACE,iFAAA;AAAA,QACF,YAAA,EACE,iFAAA;AAAA,QACF,YAAA,EACE,8IAAA;AAAA,QACF,YAAA,EACE,8IAAA;AAAA,QACF,KAAA,EACE;AAAA,OACJ;AAAA;AAAA;AAAA;AAAA;AAAA,MAKA,MAAA,EAAQ;AAAA,QACN,IAAA,EAAM,EAAA;AAAA,QACN,GAAA,EAAK,qCAAA;AAAA,QACL,MAAA,EAAQ,qCAAA;AAAA,QACR,IAAA,EAAM;AAAA;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B,QAAA,EAAA,UAAA,CAAW,GAAA,CAAI,CAAC,IAAA,qBACf,GAAA;AAAA,gBAAC,eAAA;AAAA,gBAAA;AAAA,kBAEC,IAAA;AAAA,kBACA,OAAO,KAAA,IAAS,sBAAA;AAAA,kBAChB,WAAA;AAAA,kBACA;AAAA,iBAAA;AAAA,gBAJK,GAAG,IAAA,CAAK,KAAK,CAAA,CAAA,EAAI,IAAA,CAAK,QAAQ,SAAS,CAAA;AAAA,eAM/C,CAAA,EACH;AAAA;AAAA;AACF;AAAA;AACF;AAAA,GACF;AAEJ","file":"main-nav.js","sourcesContent":["'use client'\n\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport React from 'react'\n\nimport { IconEast } from '../icons/east.js'\nimport { cn } from '../lib/utils.js'\n\nimport {\n NavigationMenu,\n NavigationMenuContent,\n NavigationMenuItem,\n NavigationMenuLink,\n NavigationMenuList,\n NavigationMenuTrigger,\n} from '../components/navigation-menu.js'\n\n/**\n * Surface colours the main navigation can be themed with — exactly the\n * Footer's thirteen-name vocabulary, so a service that themes its footer\n * `primary-800` writes the same word here. Each name is the LIGHT-mode\n * surface; dark mode deepens it onto the same family's dark steps (see the\n * `color` variants below), so `color` expresses tonal weight rather than a\n * literal colour.\n *\n * The bar's text/background pairs are identical to the Footer's, so its\n * contrast conclusions carry over verbatim: every light pair clears WCAG 2.2\n * AA (1.4.3, 4.5:1) for the bar's text and 11 of the 13 also clear AAA\n * (1.4.6, 7:1). The two AA-only pairs are `primary-600` (4.57:1) and\n * `accent-600` (5.18:1), both with white ink; prefer the `-800` steps when a\n * service is held to AAA. In dark mode all thirteen clear AAA (worst 13.6:1).\n *\n * The mega panels always render on the house popup surface (`bg-popover`),\n * matching the nswds-app source where every dropdown was white regardless of\n * bar colour — only the panel's accent ink follows the colour family.\n */\nconst mainNavColors = [\n 'primary-800',\n 'primary-600',\n 'primary-400',\n 'primary-200',\n 'grey-800',\n 'grey-600',\n 'grey-400',\n 'grey-200',\n 'accent-800',\n 'accent-600',\n 'accent-400',\n 'accent-200',\n 'white',\n] as const\n\ntype MainNavColor = (typeof mainNavColors)[number]\n\n// Shared by cva's defaultVariants, the data-color attribute and the panel\n// variant lookup, so the three can't drift apart.\nconst DEFAULT_MAIN_NAV_COLOR: MainNavColor = 'white'\n\nconst mainNavVariants = cva(\n [\n 'w-full',\n // Every derived colour on the bar resolves from a single --main-nav-ink\n // token, so a colour variant only has to declare the surface utilities and\n // that one value — this replaces the nswds-app source's hand-written\n // 13-variant × 8-slot style table. The border derivation is written\n // literally here (once) rather than per-variant: Tailwind scans source\n // text for class names, so a template-built arbitrary property would\n // never be emitted. Hover/active halos are not derived here — the\n // triggers ride navigation-menu.tsx's --nav-menu-halo chain, re-pointed\n // at this ink (see mainNavItemInk), so there is exactly one halo recipe.\n '[--main-nav-border:color-mix(in_oklch,var(--main-nav-ink)_15%,transparent)]',\n ],\n {\n variants: {\n // Ink values use the RAW masterbrand tokens (--primary-800, --grey-800,\n // --accent-800) rather than Tailwind's --color-* bridge aliases. Tailwind\n // v4 tree-shakes an unreferenced @theme key, and referencing one from\n // inside an arbitrary property is not a usage signal — the raw tokens are\n // plain :root declarations from @nswds/tokens and always resolve.\n // (--color-white is safe: `text-white` / `bg-white` below are real\n // utilities, so that key is always emitted.)\n //\n // Dark mode deepens every surface onto the same family's dark steps —\n // -800→-950, -600→-900, -400→-850, -200→-800, white→grey-900 — the\n // Footer's exact mapping, so the luminance ORDER within a family is\n // preserved and a stacked Footer + MainNav sharing one colour word stay\n // in step in both themes. Ink goes white on all thirteen; every dark\n // pair is WCAG 2.2 AAA (worst 13.6:1).\n color: {\n 'primary-800':\n 'bg-primary-800 text-white [--main-nav-ink:var(--color-white)] dark:bg-primary-950',\n 'primary-600':\n 'bg-primary-600 text-white [--main-nav-ink:var(--color-white)] dark:bg-primary-900',\n 'primary-400':\n 'bg-primary-400 text-primary-800 [--main-nav-ink:var(--primary-800)] dark:bg-primary-850 dark:text-white dark:[--main-nav-ink:var(--color-white)]',\n 'primary-200':\n 'bg-primary-200 text-primary-800 [--main-nav-ink:var(--primary-800)] dark:bg-primary-800 dark:text-white dark:[--main-nav-ink:var(--color-white)]',\n 'grey-800': 'bg-grey-800 text-white [--main-nav-ink:var(--color-white)] dark:bg-grey-950',\n 'grey-600': 'bg-grey-600 text-white [--main-nav-ink:var(--color-white)] dark:bg-grey-900',\n 'grey-400':\n 'bg-grey-400 text-grey-800 [--main-nav-ink:var(--grey-800)] dark:bg-grey-850 dark:text-white dark:[--main-nav-ink:var(--color-white)]',\n 'grey-200':\n 'bg-grey-200 text-grey-800 [--main-nav-ink:var(--grey-800)] dark:bg-grey-800 dark:text-white dark:[--main-nav-ink:var(--color-white)]',\n 'accent-800':\n 'bg-accent-800 text-white [--main-nav-ink:var(--color-white)] dark:bg-accent-950',\n 'accent-600':\n 'bg-accent-600 text-white [--main-nav-ink:var(--color-white)] dark:bg-accent-900',\n 'accent-400':\n 'bg-accent-400 text-accent-800 [--main-nav-ink:var(--accent-800)] dark:bg-accent-850 dark:text-white dark:[--main-nav-ink:var(--color-white)]',\n 'accent-200':\n 'bg-accent-200 text-accent-800 [--main-nav-ink:var(--accent-800)] dark:bg-accent-800 dark:text-white dark:[--main-nav-ink:var(--color-white)]',\n white:\n 'bg-white text-grey-800 [--main-nav-ink:var(--grey-800)] dark:bg-grey-900 dark:text-white dark:[--main-nav-ink:var(--color-white)]',\n },\n // Rules along the bar's edges, drawn from the ink-derived border token so\n // they follow every colour variant and both themes. Replaces the app\n // source's deprecated showTopBorder/showBottomBorder booleans, which are\n // deliberately not ported.\n border: {\n none: '',\n top: 'border-t border-(--main-nav-border)',\n bottom: 'border-b border-(--main-nav-border)',\n both: 'border-y border-(--main-nav-border)',\n },\n },\n defaultVariants: {\n color: DEFAULT_MAIN_NAV_COLOR,\n border: 'none',\n },\n },\n)\n\nconst mainNavContainerVariants = cva(\n [\n 'mx-auto flex w-full items-center',\n // Lateral padding funnels through --main-nav-padding-x so an app can\n // retune it once (via the `style` prop or a utility class) without a new\n // variant. Same mechanism, and the same 16px → 24px → 48px rhythm, as\n // Masthead, Header and Footer.\n 'px-(--main-nav-padding-x)',\n '[--main-nav-padding-x:--spacing(4)] sm:[--main-nav-padding-x:--spacing(6)] lg:[--main-nav-padding-x:--spacing(12)]',\n ],\n {\n variants: {\n container: {\n // Full-bleed (nswds-app fullBleed parity). --main-nav-max-width is\n // still read so a shell app can constrain the inner wrapper without\n // switching variants.\n fluid: 'max-w-[var(--main-nav-max-width,none)]',\n // Centred content column, legacy nsw-container parity (1200px).\n contained: 'max-w-[var(--main-nav-max-width,75rem)]',\n },\n },\n defaultVariants: {\n container: 'fluid',\n },\n },\n)\n\n/**\n * Mega-panel accent ink, keyed by the same thirteen colour names as the bar.\n * The panel itself is always the house popup surface (`bg-popover`, white in\n * light mode) — parity with the app source, whose dropdown was white for\n * every variant — so the family only tints the featured lead link, hover ink\n * and cell borders. Declared on the Content element (not inherited from the\n * bar) because Base UI portals the panel to `document.body`: a custom\n * property set on the `<nav>` can never reach it.\n *\n * Light inks are the family's -800 step on white — grey-800 on white is\n * 15.1:1 and white on primary-800 is 14.4:1 (both AAA; contrast is symmetric,\n * ratios from header.tsx); accent-800 on white clears AAA per the Footer's\n * verified pairs. Dark inks step to the family's -200 — the same dark-mode\n * interactive ink link.tsx and navigation-menu.tsx already use on this\n * popover surface. The featured lead is text-xl bold, so even the softest\n * pair is far above the large-text AA floor (1.4.3, 3:1).\n */\nconst mainNavPanelVariants = cva(\n [\n 'p-0 whitespace-normal',\n // The sibling Content (and the shared popup, via popupClassName below)\n // cap themselves at --available-width, which Base UI measures from the\n // active trigger — for a mid-bar trigger that is less than the nav's\n // width, which would shrink right-hand panels. The panel's width is\n // container-measured and can never exceed the viewport, so the cap is\n // safely lifted.\n 'max-w-none',\n '[--main-nav-panel-border:color-mix(in_oklch,var(--main-nav-panel-ink)_15%,transparent)]',\n ],\n {\n variants: {\n color: {\n 'primary-800':\n '[--main-nav-panel-ink:var(--primary-800)] dark:[--main-nav-panel-ink:var(--primary-200)]',\n 'primary-600':\n '[--main-nav-panel-ink:var(--primary-800)] dark:[--main-nav-panel-ink:var(--primary-200)]',\n 'primary-400':\n '[--main-nav-panel-ink:var(--primary-800)] dark:[--main-nav-panel-ink:var(--primary-200)]',\n 'primary-200':\n '[--main-nav-panel-ink:var(--primary-800)] dark:[--main-nav-panel-ink:var(--primary-200)]',\n 'grey-800':\n '[--main-nav-panel-ink:var(--grey-800)] dark:[--main-nav-panel-ink:var(--grey-200)]',\n 'grey-600':\n '[--main-nav-panel-ink:var(--grey-800)] dark:[--main-nav-panel-ink:var(--grey-200)]',\n 'grey-400':\n '[--main-nav-panel-ink:var(--grey-800)] dark:[--main-nav-panel-ink:var(--grey-200)]',\n 'grey-200':\n '[--main-nav-panel-ink:var(--grey-800)] dark:[--main-nav-panel-ink:var(--grey-200)]',\n 'accent-800':\n '[--main-nav-panel-ink:var(--accent-800)] dark:[--main-nav-panel-ink:var(--accent-200)]',\n 'accent-600':\n '[--main-nav-panel-ink:var(--accent-800)] dark:[--main-nav-panel-ink:var(--accent-200)]',\n 'accent-400':\n '[--main-nav-panel-ink:var(--accent-800)] dark:[--main-nav-panel-ink:var(--accent-200)]',\n 'accent-200':\n '[--main-nav-panel-ink:var(--accent-800)] dark:[--main-nav-panel-ink:var(--accent-200)]',\n white: '[--main-nav-panel-ink:var(--grey-800)] dark:[--main-nav-panel-ink:var(--grey-200)]',\n },\n },\n defaultVariants: {\n color: DEFAULT_MAIN_NAV_COLOR,\n },\n },\n)\n\n// Re-points the sibling navigation-menu's ink at the bar's surface ink. The\n// trigger/link halos and focus outlines in navigation-menu.tsx all derive\n// from --nav-menu-ink via color-mix ON THE SAME ELEMENT, so overriding the\n// one token retargets the whole chain: hover/active halos and the\n// focus-visible outline become surface-relative, guaranteeing the indicator\n// contrasts on all thirteen surfaces (WCAG 2.2, 2.4.13 Focus Appearance).\n// Both light and dark are overridden because the sibling pins its own\n// dark-mode ink (primary-200); --main-nav-ink is already theme-aware.\nconst mainNavItemInk =\n '[--nav-menu-ink:var(--main-nav-ink)] dark:[--nav-menu-ink:var(--main-nav-ink)]'\n\n// Same re-point for links INSIDE the portalled panel, where the bar's ink\n// cannot reach — these derive from the panel accent ink instead.\nconst mainNavPanelInk =\n '[--nav-menu-ink:var(--main-nav-panel-ink)] dark:[--nav-menu-ink:var(--main-nav-panel-ink)]'\n\n// Restyles the sibling trigger to the app source's bar metrics: 56px min\n// height, square corners, bold base text, wider gutters from lg up. The open\n// panel is marked with the app's 4px inset underline (data-popup-open comes\n// from Base UI); data-current draws the same underline persistently when\n// `currentHref` falls inside this section, so the underline means \"you are\n// here\" at rest and \"this panel is open\" during use.\nconst mainNavTriggerClassName = [\n mainNavItemInk,\n 'mb-0 h-auto min-h-14 w-auto justify-start rounded-none px-4 py-2 text-base leading-6 font-bold text-(--main-nav-ink)',\n 'lg:px-8',\n '[&_svg]:size-6',\n 'data-popup-open:shadow-[inset_0_-4px_0_0_currentColor]',\n 'data-current:shadow-[inset_0_-4px_0_0_currentColor]',\n].join(' ')\n\n// A panel-less item, restyled from the sibling link to sit visually beside\n// the triggers (cn's conflict merge lets these win over the link's stacked\n// defaults). `active` → data-active draws the current-page underline; Base UI\n// pairs it with aria-current='page' on the same element (WCAG 2.4.8).\nconst mainNavTopLinkClassName = [\n mainNavItemInk,\n 'inline-flex min-h-14 flex-row items-center justify-start gap-1 rounded-none px-4 py-2 text-base leading-6 font-bold whitespace-nowrap text-(--main-nav-ink)',\n 'lg:px-8',\n 'data-active:shadow-[inset_0_-4px_0_0_currentColor]',\n].join(' ')\n\n// The featured lead link at the top of a mega panel: the section title,\n// oversized, with an east arrow that nudges forward on hover (the app\n// source's exact affordance, on the house easing curve; the nudge is a\n// transition, so motion-reduce users get an instant state change — WCAG\n// 2.3.3). `group` scopes the icon's group-hover to this anchor — the panel is\n// portalled, so no other `group` ancestor can capture it.\nconst mainNavFeaturedLinkClassName = [\n mainNavPanelInk,\n 'group relative flex-row items-center rounded-none px-8 py-8 text-xl font-bold whitespace-normal text-(--main-nav-panel-ink)',\n].join(' ')\n\n// The lead when the section has no `href`: the same visual weight as the\n// featured link, but a plain heading row — no anchor (a dead link announced\n// as a link fails the reader who activates it), no hover halo, and no east\n// arrow (an arrow on a non-link promises navigation that never happens). No\n// mainNavPanelInk re-point either: that chain only feeds interactive halos.\nconst mainNavFeaturedHeadingClassName =\n 'flex flex-row items-center px-8 py-8 text-xl font-bold whitespace-normal text-(--main-nav-panel-ink)'\n\n// One bordered grid cell per section link. The anchor itself is the cell —\n// the app source wrapped a div around a stretched-link span, but making the\n// whole cell the anchor gives the same hit area with one element and no\n// aria-hidden overlay. Cells draw a top hairline from the panel ink; the last\n// grid row closes with a bottom hairline via the app's :nth-last-child(-n+3)\n// selector (tuned to the widest, 3-column layout — at narrower widths the\n// final one or two cells simply carry the closing rule, matching the app).\nconst mainNavSectionLinkClassName = [\n mainNavPanelInk,\n 'relative mx-2 justify-center rounded-none border-t border-(--main-nav-panel-border) p-4 text-base font-semibold whitespace-normal text-popover-foreground',\n 'hover:text-(--main-nav-panel-ink)',\n '[&:nth-last-child(-n+3)]:border-b',\n].join(' ')\n\n/** One link inside a mega panel. */\ntype MainNavLinkItem = {\n /** Visible link text, e.g. \"Find support near you\". */\n title: string\n href: string\n}\n\n/**\n * One top-level navigation item. With `links` it renders as a trigger opening\n * a mega panel (with `href` becoming the panel's featured lead link; without\n * an `href` the lead is a plain heading row — dev builds warn); without\n * `links` it renders as a plain link styled like the triggers. Recursion is\n * deliberately one level deep — mega panels list flat links, per the app\n * source's NavigationSection shape.\n */\ntype MainNavItem = {\n title: string\n href?: string\n links?: MainNavLinkItem[]\n}\n\n/**\n * Dev-only guard, mirroring the icon-only Button check in button.tsx: an item\n * with neither `href` nor `links` renders a dead `\"#\"` link — almost always a\n * data mistake, and a trap for keyboard and screen-reader users who activate\n * it and go nowhere. A section (`links`, no `href`) is legal but demoted —\n * its panel lead renders as a plain heading instead of the featured link —\n * so it gets its own nudge. No-op in production.\n */\nfunction warnIfItemUnlinked(item: MainNavItem) {\n if (process.env.NODE_ENV === 'production') {\n return\n }\n if (!item.href && !item.links?.length) {\n console.warn(\n `[nswds/ui] MainNav item \"${item.title}\" has no href and no links — it will render as a dead \"#\" link.`,\n )\n }\n if (!item.href && item.links?.length) {\n console.warn(\n `[nswds/ui] MainNav section \"${item.title}\" has links but no href — its panel lead renders as a plain heading; pass href to make it a link.`,\n )\n }\n}\n\ntype MainNavMenuItemProps = {\n item: MainNavItem\n color: MainNavColor\n currentHref?: string\n /** Measured container width, forwarded as the panel's inline width. */\n panelWidth: number | null\n}\n\n/**\n * One bar entry: a plain link for items without `links`, a trigger + mega\n * panel for items with them. Internal — the data-driven `MainNav` API is the\n * public surface; compose the navigation-menu primitives directly for layouts\n * this doesn't cover.\n */\nfunction MainNavMenuItem({ item, color, currentHref, panelWidth }: MainNavMenuItemProps) {\n warnIfItemUnlinked(item)\n\n const links = item.links\n const isExactCurrent = item.href !== undefined && item.href === currentHref\n const isSectionCurrent =\n isExactCurrent ||\n (currentHref !== undefined && (links?.some((link) => link.href === currentHref) ?? false))\n\n if (!links?.length) {\n return (\n <NavigationMenuItem className='shrink-0'>\n <NavigationMenuLink\n data-slot='main-nav-top-link'\n href={item.href ?? '#'}\n active={isExactCurrent}\n className={mainNavTopLinkClassName}\n >\n {item.title}\n </NavigationMenuLink>\n </NavigationMenuItem>\n )\n }\n\n return (\n <NavigationMenuItem className='shrink-0'>\n {/* The trigger is a button (it discloses, it doesn't navigate), so it\n can't carry aria-current — data-current draws the visual \"you are\n here\" underline while the aria-current announcement lives on the\n exact matching link inside the panel. */}\n <NavigationMenuTrigger\n data-current={isSectionCurrent || undefined}\n className={mainNavTriggerClassName}\n >\n {item.title}\n </NavigationMenuTrigger>\n {/* Inline width (not a CSS var): the panel is portalled to\n document.body, so a custom property set on the nav can't reach it.\n Before the first measurement resolves the panel falls back to the\n sibling's natural w-max sizing. */}\n <NavigationMenuContent\n data-slot='main-nav-panel'\n className={mainNavPanelVariants({ color })}\n style={panelWidth === null ? undefined : { width: panelWidth }}\n >\n <div className='grid w-full'>\n {/* No section href → no featured LINK: an `href=\"#\"` fallback here\n would be a dead link announced as a link. The heading row keeps\n the lead's visual weight without the anchor, halo or arrow — see\n mainNavFeaturedHeadingClassName. */}\n {item.href === undefined ? (\n <div data-slot='main-nav-featured-heading' className={mainNavFeaturedHeadingClassName}>\n {item.title}\n </div>\n ) : (\n <NavigationMenuLink\n data-slot='main-nav-featured-link'\n href={item.href}\n active={isExactCurrent}\n className={mainNavFeaturedLinkClassName}\n >\n {item.title}\n <IconEast\n aria-hidden='true'\n className='ml-4 size-6 shrink-0 text-current transition-transform duration-300 ease-[cubic-bezier(0.22,1,0.36,1)] group-hover:translate-x-1 motion-reduce:transition-none'\n />\n </NavigationMenuLink>\n )}\n <div\n data-slot='main-nav-panel-links'\n className='grid grid-cols-1 overflow-hidden px-4 pb-12 sm:grid-cols-2 lg:grid-cols-3'\n >\n {links.map((link, index) => (\n <NavigationMenuLink\n key={`${link.title}-${link.href}-${index}`}\n data-slot='main-nav-section-link'\n href={link.href}\n active={link.href === currentHref}\n className={mainNavSectionLinkClassName}\n >\n {link.title}\n </NavigationMenuLink>\n ))}\n </div>\n </div>\n </NavigationMenuContent>\n </NavigationMenuItem>\n )\n}\n\ntype MainNavProps = Omit<React.ComponentPropsWithoutRef<'nav'>, 'children'> &\n VariantProps<typeof mainNavVariants> &\n VariantProps<typeof mainNavContainerVariants> & {\n /** Top-level items; items with `links` open mega panels. */\n navigation: MainNavItem[]\n /**\n * The current page's href. The exact matching link gets\n * `aria-current=\"page\"`, and the top-level item it belongs to (a plain\n * link, or the trigger whose panel contains it) gets the current-item\n * underline. The app source read this from next/navigation's\n * `usePathname` — a framework API this package must not import; compare\n * in the consumer and pass the result down.\n */\n currentHref?: string\n /**\n * Stick to the top of the viewport as the page scrolls. Defaults to\n * `false`. When the nav renders below a sticky `Header`, set\n * `--main-nav-top` to the header's height so the two stack instead of\n * overlapping — this custom property replaces the app source's\n * `useSelectorHeight` DOM-measuring hook (the app measured `#nsw-header`\n * on every resize; a consumer that needs a live value can still measure\n * its own header and write the property, see the Sticky story).\n */\n sticky?: boolean\n /** Drop shadow under the bar. Defaults to `true`. */\n shadow?: boolean\n /** Classes applied to the inner width-constraining wrapper. */\n containerClassName?: string\n ref?: React.Ref<HTMLElement>\n }\n\n/**\n * Full-width NSW site navigation bar with mega-menu panels — the data-driven\n * consolidation of the nswds-app `NavigationMenuMainNavigation` /\n * `MainNavigation` components, rebuilt on this package's `NavigationMenu`\n * (Base UI underneath).\n *\n * - `navigation` drives everything: items with `links` render a trigger whose\n * mega panel shows a featured lead link (the section `href`; with no `href`\n * the lead demotes to a plain heading row — dev builds warn) above a\n * responsive 1/2/3-column grid of bordered section links; items without\n * `links` render plain links styled like the triggers. All anchors render\n * through `Link`, so a framework link injected via `LinkProvider`\n * (e.g. next/link) is used automatically.\n * - `color` themes the bar with the Footer's thirteen-name vocabulary and its\n * exact dark-mode deepening; every derived colour (halos, borders, focus\n * outlines) resolves from a single `--main-nav-ink` per variant. Contrast\n * conclusions are the Footer's, verbatim (see `mainNavColors`).\n * - Panels span the nav container's full width: a ResizeObserver on the inner\n * container feeds each panel's inline width, and an `alignOffset` function\n * shifts Base UI's trigger-anchored positioner back to the container's left\n * edge (measured at position time from the open trigger, so it is exact for\n * every trigger — this replaces the app source's panelMetrics state).\n * Assumes LTR; see the class comments.\n * - `container`, `border`, `shadow`, `sticky` mirror the house chrome\n * components; the app's deprecated `showTopBorder`/`showBottomBorder` and\n * `responsive` props are not ported (use `border` and\n * `className=\"hidden lg:block\"`).\n *\n * Accessibility: the outer `<nav>` is the landmark (default label \"Main\n * navigation\"; Base UI's own root is demoted to a `<div>` via `render` so the\n * page doesn't gain a nested nav landmark). Everything interactive is\n * inherited from Base UI via the sibling: triggers are real buttons with\n * `aria-expanded`/`aria-controls`, ArrowDown/Enter opens, arrow keys rove,\n * Escape and focus-out close, and the current page announces\n * `aria-current=\"page\"` (WCAG 2.4.8). Focus indicators are 2px ink-derived\n * outlines that contrast on all thirteen surfaces and on the panel surface\n * (2.4.7, 2.4.13). The 220ms `closeDelay` reproduces the app's hover-out\n * grace timer through Base UI instead of a hand-rolled setTimeout.\n *\n * The default `id=\"nsw-main-navigation\"` is kept for compatibility with\n * existing shells that target it (override via the `id` prop).\n */\nfunction MainNav({\n className,\n containerClassName,\n color,\n container,\n border,\n navigation,\n currentHref,\n sticky = false,\n shadow = true,\n 'aria-label': ariaLabel = 'Main navigation',\n ref,\n ...props\n}: MainNavProps) {\n const containerRef = React.useRef<HTMLDivElement>(null)\n const [panelWidth, setPanelWidth] = React.useState<number | null>(null)\n\n React.useEffect(() => {\n const element = containerRef.current\n if (!element) {\n return\n }\n const measure = () => {\n setPanelWidth(element.getBoundingClientRect().width)\n }\n // Read once on mount: panels can open before the first resize.\n measure()\n const observer = new ResizeObserver(measure)\n observer.observe(element)\n return () => observer.disconnect()\n }, [])\n\n // Shifts the popup from Base UI's anchor (the open trigger) to the\n // container's left edge. Called by the positioner at position time, when\n // the open trigger is findable via data-popup-open — so the offset is exact\n // per trigger with no per-trigger state. Assumes LTR (`align='start'` maps\n // to the left edge); RTL would need the mirrored calculation.\n //\n // The ref caches the last successful offset for the windows when NO trigger\n // carries data-popup-open — chiefly the ~300ms close fade, when a recompute\n // (scroll/resize mid-fade) returning 0 would snap the still-visible\n // full-width panel back to the trigger's edge. Repeating the last real\n // offset holds the fading panel where it was.\n const lastAlignOffsetRef = React.useRef(0)\n const alignOffset = React.useCallback(() => {\n const element = containerRef.current\n if (!element) {\n return lastAlignOffsetRef.current\n }\n const trigger = element.querySelector('[data-popup-open]')\n if (!trigger) {\n return lastAlignOffsetRef.current\n }\n lastAlignOffsetRef.current =\n element.getBoundingClientRect().left - trigger.getBoundingClientRect().left\n return lastAlignOffsetRef.current\n }, [])\n\n return (\n <nav\n id='nsw-main-navigation'\n data-slot='main-nav'\n data-color={color ?? DEFAULT_MAIN_NAV_COLOR}\n aria-label={ariaLabel}\n {...props}\n className={cn(\n mainNavVariants({ color, border }),\n // z-40 matches Header (both sit below the z-50 SkipLinks). An app\n // stacking this under a sticky Header sets --main-nav-top to the\n // header's height.\n sticky && 'sticky top-[var(--main-nav-top,0px)] z-40',\n // House scrolled-header shadow; in dark mode borders carry separation.\n shadow && 'shadow-md shadow-black/5 dark:shadow-none',\n className,\n )}\n ref={ref}\n >\n <div\n ref={containerRef}\n data-slot='main-nav-container'\n className={cn(mainNavContainerVariants({ container }), containerClassName)}\n >\n {/* render={<div/>}: Base UI's root is itself a <nav>; demoting it\n keeps this component to ONE navigation landmark. sideOffset 0\n seats the panel flush under the bar; collision handling is off\n because alignOffset/width already pin the panel inside the\n viewport. closeDelay 220 = the app's PANEL_CLOSE_DELAY_MS. */}\n <NavigationMenu\n render={<div />}\n className='w-full max-w-none justify-start'\n side='bottom'\n sideOffset={0}\n align='start'\n alignOffset={alignOffset}\n collisionPadding={0}\n collisionAvoidance={{ side: 'none', align: 'none' }}\n closeDelay={220}\n // Square corners (the full-width panel meets the bar edge-to-edge)\n // and no --available-width cap — see mainNavPanelVariants.\n popupClassName='max-w-none rounded-none'\n // The popup itself must follow the measured width too: Base UI\n // sizes it from --popup-width, measured once when a section\n // activates, so a panel opened before the first measurement lands\n // (or resized while open) would keep a stale popup width and clip\n // the full-width panel to a sliver. An inline width stays reactive.\n popupStyle={panelWidth === null ? undefined : { width: panelWidth }}\n >\n <NavigationMenuList className='w-full justify-start gap-0 border-b-0'>\n {navigation.map((item) => (\n <MainNavMenuItem\n key={`${item.title}-${item.href ?? 'section'}`}\n item={item}\n color={color ?? DEFAULT_MAIN_NAV_COLOR}\n currentHref={currentHref}\n panelWidth={panelWidth}\n />\n ))}\n </NavigationMenuList>\n </NavigationMenu>\n </div>\n </nav>\n )\n}\n\nexport { MainNav, mainNavColors, mainNavContainerVariants, mainNavPanelVariants, mainNavVariants }\nexport type { MainNavColor, MainNavItem, MainNavLinkItem, Main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,qBACf,GAAA;AAAA,gBAAC,eAAA;AAAA,gBAAA;AAAA,kBAEC,IAAA;AAAA,kBACA,OAAO,KAAA,IAAS,sBAAA;AAAA,kBAChB,WAAA;AAAA,kBACA;AAAA,iBAAA;AAAA,gBAJK,GAAG,IAAA,CAAK,KAAK,CAAA,CAAA,EAAI,IAAA,CAAK,QAAQ,SAAS,CAAA;AAAA,eAM/C,CAAA,EACH;AAAA;AAAA;AACF;AAAA;AACF;AAAA,GACF;AAEJ","file":"main-nav.js","sourcesContent":["'use client'\n\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport React from 'react'\n\nimport { IconEast } from '../icons/east.js'\nimport { cn } from '../lib/utils.js'\n\nimport {\n NavigationMenu,\n NavigationMenuContent,\n NavigationMenuItem,\n NavigationMenuLink,\n NavigationMenuList,\n NavigationMenuTrigger,\n} from '../components/navigation-menu.js'\n\n/**\n * Surface colours the main navigation can be themed with — exactly the\n * Footer's thirteen-name vocabulary, so a service that themes its footer\n * `primary-800` writes the same word here. Each name is the LIGHT-mode\n * surface; dark mode deepens it onto the same family's dark steps (see the\n * `color` variants below), so `color` expresses tonal weight rather than a\n * literal colour.\n *\n * The bar's text/background pairs are identical to the Footer's, so its\n * contrast conclusions carry over verbatim: every light pair clears WCAG 2.2\n * AA (1.4.3, 4.5:1) for the bar's text and 11 of the 13 also clear AAA\n * (1.4.6, 7:1). The two AA-only pairs are `primary-600` (4.57:1) and\n * `accent-600` (5.18:1), both with white ink; prefer the `-800` steps when a\n * service is held to AAA. In dark mode all thirteen clear AAA (worst 13.6:1).\n *\n * The mega panels always render on the house popup surface (`bg-popover`),\n * matching the nswds-app source where every dropdown was white regardless of\n * bar colour — only the panel's accent ink follows the colour family.\n */\nconst mainNavColors = [\n 'primary-800',\n 'primary-600',\n 'primary-400',\n 'primary-200',\n 'grey-800',\n 'grey-600',\n 'grey-400',\n 'grey-200',\n 'accent-800',\n 'accent-600',\n 'accent-400',\n 'accent-200',\n 'white',\n] as const\n\ntype MainNavColor = (typeof mainNavColors)[number]\n\n// Shared by cva's defaultVariants, the data-color attribute and the panel\n// variant lookup, so the three can't drift apart.\nconst DEFAULT_MAIN_NAV_COLOR: MainNavColor = 'white'\n\nconst mainNavVariants = cva(\n [\n 'w-full',\n // Every derived colour on the bar resolves from a single --main-nav-ink\n // token, so a colour variant only has to declare the surface utilities and\n // that one value — this replaces the nswds-app source's hand-written\n // 13-variant × 8-slot style table. The border derivation is written\n // literally here (once) rather than per-variant: Tailwind scans source\n // text for class names, so a template-built arbitrary property would\n // never be emitted. Hover/active halos are not derived here — the\n // triggers ride navigation-menu.tsx's --nav-menu-halo chain, re-pointed\n // at this ink (see mainNavItemInk), so there is exactly one halo recipe.\n '[--main-nav-border:color-mix(in_oklch,var(--main-nav-ink)_15%,transparent)]',\n ],\n {\n variants: {\n // Ink values use the RAW masterbrand tokens (--primary-800, --grey-800,\n // --accent-800) rather than Tailwind's --color-* bridge aliases. Tailwind\n // v4 tree-shakes an unreferenced @theme key, and referencing one from\n // inside an arbitrary property is not a usage signal — the raw tokens are\n // plain :root declarations from @nswds/tokens and always resolve.\n // (--color-white is safe: `text-white` / `bg-white` below are real\n // utilities, so that key is always emitted.)\n //\n // Dark mode deepens every surface onto the same family's dark steps —\n // -800→-950, -600→-900, -400→-850, -200→-800, white→grey-900 — the\n // Footer's exact mapping, so the luminance ORDER within a family is\n // preserved and a stacked Footer + MainNav sharing one colour word stay\n // in step in both themes. Ink goes white on all thirteen; every dark\n // pair is WCAG 2.2 AAA (worst 13.6:1).\n color: {\n 'primary-800':\n 'bg-primary-800 text-white [--main-nav-ink:var(--color-white)] dark:bg-primary-950',\n 'primary-600':\n 'bg-primary-600 text-white [--main-nav-ink:var(--color-white)] dark:bg-primary-900',\n 'primary-400':\n 'bg-primary-400 text-primary-800 [--main-nav-ink:var(--primary-800)] dark:bg-primary-850 dark:text-white dark:[--main-nav-ink:var(--color-white)]',\n 'primary-200':\n 'bg-primary-200 text-primary-800 [--main-nav-ink:var(--primary-800)] dark:bg-primary-800 dark:text-white dark:[--main-nav-ink:var(--color-white)]',\n 'grey-800': 'bg-grey-800 text-white [--main-nav-ink:var(--color-white)] dark:bg-grey-950',\n 'grey-600': 'bg-grey-600 text-white [--main-nav-ink:var(--color-white)] dark:bg-grey-900',\n 'grey-400':\n 'bg-grey-400 text-grey-800 [--main-nav-ink:var(--grey-800)] dark:bg-grey-850 dark:text-white dark:[--main-nav-ink:var(--color-white)]',\n 'grey-200':\n 'bg-grey-200 text-grey-800 [--main-nav-ink:var(--grey-800)] dark:bg-grey-800 dark:text-white dark:[--main-nav-ink:var(--color-white)]',\n 'accent-800':\n 'bg-accent-800 text-white [--main-nav-ink:var(--color-white)] dark:bg-accent-950',\n 'accent-600':\n 'bg-accent-600 text-white [--main-nav-ink:var(--color-white)] dark:bg-accent-900',\n 'accent-400':\n 'bg-accent-400 text-accent-800 [--main-nav-ink:var(--accent-800)] dark:bg-accent-850 dark:text-white dark:[--main-nav-ink:var(--color-white)]',\n 'accent-200':\n 'bg-accent-200 text-accent-800 [--main-nav-ink:var(--accent-800)] dark:bg-accent-800 dark:text-white dark:[--main-nav-ink:var(--color-white)]',\n white:\n 'bg-white text-grey-800 [--main-nav-ink:var(--grey-800)] dark:bg-grey-900 dark:text-white dark:[--main-nav-ink:var(--color-white)]',\n },\n // Rules along the bar's edges, drawn from the ink-derived border token so\n // they follow every colour variant and both themes. Replaces the app\n // source's deprecated showTopBorder/showBottomBorder booleans, which are\n // deliberately not ported.\n border: {\n none: '',\n top: 'border-t border-(--main-nav-border)',\n bottom: 'border-b border-(--main-nav-border)',\n both: 'border-y border-(--main-nav-border)',\n },\n },\n defaultVariants: {\n color: DEFAULT_MAIN_NAV_COLOR,\n border: 'none',\n },\n },\n)\n\nconst mainNavContainerVariants = cva(\n [\n 'mx-auto flex w-full items-center',\n // Lateral padding funnels through --main-nav-padding-x so an app can\n // retune it once (via the `style` prop or a utility class) without a new\n // variant. Same mechanism, and the same 16px → 24px → 48px rhythm, as\n // Masthead, Header and Footer.\n 'px-(--main-nav-padding-x)',\n '[--main-nav-padding-x:--spacing(4)] sm:[--main-nav-padding-x:--spacing(6)] lg:[--main-nav-padding-x:--spacing(12)]',\n ],\n {\n variants: {\n container: {\n // Full-bleed (nswds-app fullBleed parity). --main-nav-max-width is\n // still read so a shell app can constrain the inner wrapper without\n // switching variants.\n fluid: 'max-w-[var(--main-nav-max-width,none)]',\n // Centred content column, legacy nsw-container parity (1200px).\n contained: 'max-w-[var(--main-nav-max-width,75rem)]',\n },\n },\n defaultVariants: {\n container: 'fluid',\n },\n },\n)\n\n/**\n * Mega-panel accent ink, keyed by the same thirteen colour names as the bar.\n * The panel itself is always the house popup surface (`bg-popover`, white in\n * light mode) — parity with the app source, whose dropdown was white for\n * every variant — so the family only tints the featured lead link, hover ink\n * and cell borders. Declared on the Content element (not inherited from the\n * bar) because Base UI portals the panel to `document.body`: a custom\n * property set on the `<nav>` can never reach it.\n *\n * Light inks are the family's -800 step on white — grey-800 on white is\n * 15.1:1 and white on primary-800 is 14.4:1 (both AAA; contrast is symmetric,\n * ratios from header.tsx); accent-800 on white clears AAA per the Footer's\n * verified pairs. Dark inks step to the family's -200 — the same dark-mode\n * interactive ink link.tsx and navigation-menu.tsx already use on this\n * popover surface. The featured lead is text-xl bold, so even the softest\n * pair is far above the large-text AA floor (1.4.3, 3:1).\n */\nconst mainNavPanelVariants = cva(\n [\n 'p-0 whitespace-normal',\n // The sibling Content (and the shared popup, via popupClassName below)\n // cap themselves at --available-width, which Base UI measures from the\n // active trigger — for a mid-bar trigger that is less than the nav's\n // width, which would shrink right-hand panels. The panel's width is\n // container-measured and can never exceed the viewport, so the cap is\n // safely lifted.\n 'max-w-none',\n '[--main-nav-panel-border:color-mix(in_oklch,var(--main-nav-panel-ink)_15%,transparent)]',\n ],\n {\n variants: {\n color: {\n 'primary-800':\n '[--main-nav-panel-ink:var(--primary-800)] dark:[--main-nav-panel-ink:var(--primary-200)]',\n 'primary-600':\n '[--main-nav-panel-ink:var(--primary-800)] dark:[--main-nav-panel-ink:var(--primary-200)]',\n 'primary-400':\n '[--main-nav-panel-ink:var(--primary-800)] dark:[--main-nav-panel-ink:var(--primary-200)]',\n 'primary-200':\n '[--main-nav-panel-ink:var(--primary-800)] dark:[--main-nav-panel-ink:var(--primary-200)]',\n 'grey-800':\n '[--main-nav-panel-ink:var(--grey-800)] dark:[--main-nav-panel-ink:var(--grey-200)]',\n 'grey-600':\n '[--main-nav-panel-ink:var(--grey-800)] dark:[--main-nav-panel-ink:var(--grey-200)]',\n 'grey-400':\n '[--main-nav-panel-ink:var(--grey-800)] dark:[--main-nav-panel-ink:var(--grey-200)]',\n 'grey-200':\n '[--main-nav-panel-ink:var(--grey-800)] dark:[--main-nav-panel-ink:var(--grey-200)]',\n 'accent-800':\n '[--main-nav-panel-ink:var(--accent-800)] dark:[--main-nav-panel-ink:var(--accent-200)]',\n 'accent-600':\n '[--main-nav-panel-ink:var(--accent-800)] dark:[--main-nav-panel-ink:var(--accent-200)]',\n 'accent-400':\n '[--main-nav-panel-ink:var(--accent-800)] dark:[--main-nav-panel-ink:var(--accent-200)]',\n 'accent-200':\n '[--main-nav-panel-ink:var(--accent-800)] dark:[--main-nav-panel-ink:var(--accent-200)]',\n white: '[--main-nav-panel-ink:var(--grey-800)] dark:[--main-nav-panel-ink:var(--grey-200)]',\n },\n },\n defaultVariants: {\n color: DEFAULT_MAIN_NAV_COLOR,\n },\n },\n)\n\n// Re-points the sibling navigation-menu's ink at the bar's surface ink. The\n// trigger/link halos and focus outlines in navigation-menu.tsx all derive\n// from --nav-menu-ink via color-mix ON THE SAME ELEMENT, so overriding the\n// one token retargets the whole chain: hover/active halos and the\n// focus-visible outline become surface-relative, guaranteeing the indicator\n// contrasts on all thirteen surfaces (WCAG 2.2, 2.4.13 Focus Appearance).\n// Both light and dark are overridden because the sibling pins its own\n// dark-mode ink (primary-200); --main-nav-ink is already theme-aware.\nconst mainNavItemInk =\n '[--nav-menu-ink:var(--main-nav-ink)] dark:[--nav-menu-ink:var(--main-nav-ink)]'\n\n// Same re-point for links INSIDE the portalled panel, where the bar's ink\n// cannot reach — these derive from the panel accent ink instead.\nconst mainNavPanelInk =\n '[--nav-menu-ink:var(--main-nav-panel-ink)] dark:[--nav-menu-ink:var(--main-nav-panel-ink)]'\n\n// Restyles the sibling trigger to the app source's bar metrics: 56px min\n// height, square corners, bold base text, wider gutters from lg up. The open\n// panel is marked with the app's 4px inset underline (data-popup-open comes\n// from Base UI); data-current draws the same underline persistently when\n// `currentHref` falls inside this section, so the underline means \"you are\n// here\" at rest and \"this panel is open\" during use.\nconst mainNavTriggerClassName = [\n mainNavItemInk,\n 'mb-0 h-auto min-h-14 w-auto justify-start rounded-none max-lg:px-4 py-2 text-base leading-6 font-bold text-(--main-nav-ink)',\n 'lg:px-8',\n '[&_svg]:size-6',\n 'data-popup-open:shadow-[inset_0_-4px_0_0_currentColor]',\n 'data-current:shadow-[inset_0_-4px_0_0_currentColor]',\n].join(' ')\n\n// A panel-less item, restyled from the sibling link to sit visually beside\n// the triggers (cn's conflict merge lets these win over the link's stacked\n// defaults). `active` → data-active draws the current-page underline; Base UI\n// pairs it with aria-current='page' on the same element (WCAG 2.4.8).\nconst mainNavTopLinkClassName = [\n mainNavItemInk,\n 'inline-flex min-h-14 flex-row items-center justify-start gap-1 rounded-none max-lg:px-4 py-2 text-base leading-6 font-bold whitespace-nowrap text-(--main-nav-ink)',\n 'lg:px-8',\n 'data-active:shadow-[inset_0_-4px_0_0_currentColor]',\n].join(' ')\n\n// The featured lead link at the top of a mega panel: the section title,\n// oversized, with an east arrow that nudges forward on hover (the app\n// source's exact affordance, on the house easing curve; the nudge is a\n// transition, so motion-reduce users get an instant state change — WCAG\n// 2.3.3). `group` scopes the icon's group-hover to this anchor — the panel is\n// portalled, so no other `group` ancestor can capture it.\nconst mainNavFeaturedLinkClassName = [\n mainNavPanelInk,\n 'group relative flex-row items-center rounded-none px-8 py-8 text-xl font-bold whitespace-normal text-(--main-nav-panel-ink)',\n].join(' ')\n\n// The lead when the section has no `href`: the same visual weight as the\n// featured link, but a plain heading row — no anchor (a dead link announced\n// as a link fails the reader who activates it), no hover halo, and no east\n// arrow (an arrow on a non-link promises navigation that never happens). No\n// mainNavPanelInk re-point either: that chain only feeds interactive halos.\nconst mainNavFeaturedHeadingClassName =\n 'flex flex-row items-center px-8 py-8 text-xl font-bold whitespace-normal text-(--main-nav-panel-ink)'\n\n// One bordered grid cell per section link. The anchor itself is the cell —\n// the app source wrapped a div around a stretched-link span, but making the\n// whole cell the anchor gives the same hit area with one element and no\n// aria-hidden overlay. Cells draw a top hairline from the panel ink; the last\n// grid row closes with a bottom hairline via the app's :nth-last-child(-n+3)\n// selector (tuned to the widest, 3-column layout — at narrower widths the\n// final one or two cells simply carry the closing rule, matching the app).\nconst mainNavSectionLinkClassName = [\n mainNavPanelInk,\n 'relative mx-2 justify-center rounded-none border-t border-(--main-nav-panel-border) p-4 text-base font-semibold whitespace-normal text-popover-foreground',\n 'hover:text-(--main-nav-panel-ink)',\n '[&:nth-last-child(-n+3)]:border-b',\n].join(' ')\n\n/** One link inside a mega panel. */\ntype MainNavLinkItem = {\n /** Visible link text, e.g. \"Find support near you\". */\n title: string\n href: string\n}\n\n/**\n * One top-level navigation item. With `links` it renders as a trigger opening\n * a mega panel (with `href` becoming the panel's featured lead link; without\n * an `href` the lead is a plain heading row — dev builds warn); without\n * `links` it renders as a plain link styled like the triggers. Recursion is\n * deliberately one level deep — mega panels list flat links, per the app\n * source's NavigationSection shape.\n */\ntype MainNavItem = {\n title: string\n href?: string\n links?: MainNavLinkItem[]\n}\n\n/**\n * Dev-only guard, mirroring the icon-only Button check in button.tsx: an item\n * with neither `href` nor `links` renders a dead `\"#\"` link — almost always a\n * data mistake, and a trap for keyboard and screen-reader users who activate\n * it and go nowhere. A section (`links`, no `href`) is legal but demoted —\n * its panel lead renders as a plain heading instead of the featured link —\n * so it gets its own nudge. No-op in production.\n */\nfunction warnIfItemUnlinked(item: MainNavItem) {\n if (process.env.NODE_ENV === 'production') {\n return\n }\n if (!item.href && !item.links?.length) {\n console.warn(\n `[nswds/ui] MainNav item \"${item.title}\" has no href and no links — it will render as a dead \"#\" link.`,\n )\n }\n if (!item.href && item.links?.length) {\n console.warn(\n `[nswds/ui] MainNav section \"${item.title}\" has links but no href — its panel lead renders as a plain heading; pass href to make it a link.`,\n )\n }\n}\n\ntype MainNavMenuItemProps = {\n item: MainNavItem\n color: MainNavColor\n currentHref?: string\n /** Measured container width, forwarded as the panel's inline width. */\n panelWidth: number | null\n}\n\n/**\n * One bar entry: a plain link for items without `links`, a trigger + mega\n * panel for items with them. Internal — the data-driven `MainNav` API is the\n * public surface; compose the navigation-menu primitives directly for layouts\n * this doesn't cover.\n */\nfunction MainNavMenuItem({ item, color, currentHref, panelWidth }: MainNavMenuItemProps) {\n warnIfItemUnlinked(item)\n\n const links = item.links\n const isExactCurrent = item.href !== undefined && item.href === currentHref\n const isSectionCurrent =\n isExactCurrent ||\n (currentHref !== undefined && (links?.some((link) => link.href === currentHref) ?? false))\n\n if (!links?.length) {\n return (\n <NavigationMenuItem className='shrink-0'>\n <NavigationMenuLink\n data-slot='main-nav-top-link'\n href={item.href ?? '#'}\n active={isExactCurrent}\n className={mainNavTopLinkClassName}\n >\n {item.title}\n </NavigationMenuLink>\n </NavigationMenuItem>\n )\n }\n\n return (\n <NavigationMenuItem className='shrink-0'>\n {/* The trigger is a button (it discloses, it doesn't navigate), so it\n can't carry aria-current — data-current draws the visual \"you are\n here\" underline while the aria-current announcement lives on the\n exact matching link inside the panel. */}\n <NavigationMenuTrigger\n data-current={isSectionCurrent || undefined}\n className={mainNavTriggerClassName}\n >\n {item.title}\n </NavigationMenuTrigger>\n {/* Inline width (not a CSS var): the panel is portalled to\n document.body, so a custom property set on the nav can't reach it.\n Before the first measurement resolves the panel falls back to the\n sibling's natural w-max sizing. */}\n <NavigationMenuContent\n data-slot='main-nav-panel'\n className={mainNavPanelVariants({ color })}\n style={panelWidth === null ? undefined : { width: panelWidth }}\n >\n <div className='grid w-full'>\n {/* No section href → no featured LINK: an `href=\"#\"` fallback here\n would be a dead link announced as a link. The heading row keeps\n the lead's visual weight without the anchor, halo or arrow — see\n mainNavFeaturedHeadingClassName. */}\n {item.href === undefined ? (\n <div data-slot='main-nav-featured-heading' className={mainNavFeaturedHeadingClassName}>\n {item.title}\n </div>\n ) : (\n <NavigationMenuLink\n data-slot='main-nav-featured-link'\n href={item.href}\n active={isExactCurrent}\n className={mainNavFeaturedLinkClassName}\n >\n {item.title}\n <IconEast\n aria-hidden='true'\n className='ml-4 size-6 shrink-0 text-current duration-300 ease-[cubic-bezier(0.22,1,0.36,1)] group-hover:translate-x-1 motion-safe:transition-transform'\n />\n </NavigationMenuLink>\n )}\n <div\n data-slot='main-nav-panel-links'\n className='grid overflow-hidden px-4 pb-12 max-sm:grid-cols-1 sm:max-lg:grid-cols-2 lg:grid-cols-3'\n >\n {links.map((link, index) => (\n <NavigationMenuLink\n key={`${link.title}-${link.href}-${index}`}\n data-slot='main-nav-section-link'\n href={link.href}\n active={link.href === currentHref}\n className={mainNavSectionLinkClassName}\n >\n {link.title}\n </NavigationMenuLink>\n ))}\n </div>\n </div>\n </NavigationMenuContent>\n </NavigationMenuItem>\n )\n}\n\ntype MainNavProps = Omit<React.ComponentPropsWithoutRef<'nav'>, 'children'> &\n VariantProps<typeof mainNavVariants> &\n VariantProps<typeof mainNavContainerVariants> & {\n /** Top-level items; items with `links` open mega panels. */\n navigation: MainNavItem[]\n /**\n * The current page's href. The exact matching link gets\n * `aria-current=\"page\"`, and the top-level item it belongs to (a plain\n * link, or the trigger whose panel contains it) gets the current-item\n * underline. The app source read this from next/navigation's\n * `usePathname` — a framework API this package must not import; compare\n * in the consumer and pass the result down.\n */\n currentHref?: string\n /**\n * Stick to the top of the viewport as the page scrolls. Defaults to\n * `false`. When the nav renders below a sticky `Header`, set\n * `--main-nav-top` to the header's height so the two stack instead of\n * overlapping — this custom property replaces the app source's\n * `useSelectorHeight` DOM-measuring hook (the app measured `#nsw-header`\n * on every resize; a consumer that needs a live value can still measure\n * its own header and write the property, see the Sticky story).\n */\n sticky?: boolean\n /** Drop shadow under the bar. Defaults to `true`. */\n shadow?: boolean\n /** Classes applied to the inner width-constraining wrapper. */\n containerClassName?: string\n ref?: React.Ref<HTMLElement>\n }\n\n/**\n * Full-width NSW site navigation bar with mega-menu panels — the data-driven\n * consolidation of the nswds-app `NavigationMenuMainNavigation` /\n * `MainNavigation` components, rebuilt on this package's `NavigationMenu`\n * (Base UI underneath).\n *\n * - `navigation` drives everything: items with `links` render a trigger whose\n * mega panel shows a featured lead link (the section `href`; with no `href`\n * the lead demotes to a plain heading row — dev builds warn) above a\n * responsive 1/2/3-column grid of bordered section links; items without\n * `links` render plain links styled like the triggers. All anchors render\n * through `Link`, so a framework link injected via `LinkProvider`\n * (e.g. next/link) is used automatically.\n * - `color` themes the bar with the Footer's thirteen-name vocabulary and its\n * exact dark-mode deepening; every derived colour (halos, borders, focus\n * outlines) resolves from a single `--main-nav-ink` per variant. Contrast\n * conclusions are the Footer's, verbatim (see `mainNavColors`).\n * - Panels span the nav container's full width: a ResizeObserver on the inner\n * container feeds each panel's inline width, and an `alignOffset` function\n * shifts Base UI's trigger-anchored positioner back to the container's left\n * edge (measured at position time from the open trigger, so it is exact for\n * every trigger — this replaces the app source's panelMetrics state).\n * Assumes LTR; see the class comments.\n * - `container`, `border`, `shadow`, `sticky` mirror the house chrome\n * components; the app's deprecated `showTopBorder`/`showBottomBorder` and\n * `responsive` props are not ported (use `border` and\n * `className=\"hidden lg:block\"`).\n *\n * Accessibility: the outer `<nav>` is the landmark (default label \"Main\n * navigation\"; Base UI's own root is demoted to a `<div>` via `render` so the\n * page doesn't gain a nested nav landmark). Everything interactive is\n * inherited from Base UI via the sibling: triggers are real buttons with\n * `aria-expanded`/`aria-controls`, ArrowDown/Enter opens, arrow keys rove,\n * Escape and focus-out close, and the current page announces\n * `aria-current=\"page\"` (WCAG 2.4.8). Focus indicators are 2px ink-derived\n * outlines that contrast on all thirteen surfaces and on the panel surface\n * (2.4.7, 2.4.13). The 220ms `closeDelay` reproduces the app's hover-out\n * grace timer through Base UI instead of a hand-rolled setTimeout.\n *\n * The default `id=\"nsw-main-navigation\"` is kept for compatibility with\n * existing shells that target it (override via the `id` prop).\n */\nfunction MainNav({\n className,\n containerClassName,\n color,\n container,\n border,\n navigation,\n currentHref,\n sticky = false,\n shadow = true,\n 'aria-label': ariaLabel = 'Main navigation',\n ref,\n ...props\n}: MainNavProps) {\n const containerRef = React.useRef<HTMLDivElement>(null)\n const [panelWidth, setPanelWidth] = React.useState<number | null>(null)\n\n React.useEffect(() => {\n const element = containerRef.current\n if (!element) {\n return\n }\n const measure = () => {\n setPanelWidth(element.getBoundingClientRect().width)\n }\n // Read once on mount: panels can open before the first resize.\n measure()\n const observer = new ResizeObserver(measure)\n observer.observe(element)\n return () => observer.disconnect()\n }, [])\n\n // Shifts the popup from Base UI's anchor (the open trigger) to the\n // container's left edge. Called by the positioner at position time, when\n // the open trigger is findable via data-popup-open — so the offset is exact\n // per trigger with no per-trigger state. Assumes LTR (`align='start'` maps\n // to the left edge); RTL would need the mirrored calculation.\n //\n // The ref caches the last successful offset for the windows when NO trigger\n // carries data-popup-open — chiefly the ~300ms close fade, when a recompute\n // (scroll/resize mid-fade) returning 0 would snap the still-visible\n // full-width panel back to the trigger's edge. Repeating the last real\n // offset holds the fading panel where it was.\n const lastAlignOffsetRef = React.useRef(0)\n const alignOffset = React.useCallback(() => {\n const element = containerRef.current\n if (!element) {\n return lastAlignOffsetRef.current\n }\n const trigger = element.querySelector('[data-popup-open]')\n if (!trigger) {\n return lastAlignOffsetRef.current\n }\n lastAlignOffsetRef.current =\n element.getBoundingClientRect().left - trigger.getBoundingClientRect().left\n return lastAlignOffsetRef.current\n }, [])\n\n return (\n <nav\n id='nsw-main-navigation'\n data-slot='main-nav'\n data-color={color ?? DEFAULT_MAIN_NAV_COLOR}\n aria-label={ariaLabel}\n {...props}\n className={cn(\n mainNavVariants({ color, border }),\n // z-40 matches Header (both sit below the z-50 SkipLinks). An app\n // stacking this under a sticky Header sets --main-nav-top to the\n // header's height.\n sticky && 'sticky top-[var(--main-nav-top,0px)] z-40',\n // House scrolled-header shadow; in dark mode borders carry separation.\n shadow && 'shadow-md shadow-black/5 dark:shadow-none',\n className,\n )}\n ref={ref}\n >\n <div\n ref={containerRef}\n data-slot='main-nav-container'\n className={cn(mainNavContainerVariants({ container }), containerClassName)}\n >\n {/* render={<div/>}: Base UI's root is itself a <nav>; demoting it\n keeps this component to ONE navigation landmark. sideOffset 0\n seats the panel flush under the bar; collision handling is off\n because alignOffset/width already pin the panel inside the\n viewport. closeDelay 220 = the app's PANEL_CLOSE_DELAY_MS. */}\n <NavigationMenu\n render={<div />}\n className='w-full max-w-none justify-start'\n side='bottom'\n sideOffset={0}\n align='start'\n alignOffset={alignOffset}\n collisionPadding={0}\n collisionAvoidance={{ side: 'none', align: 'none' }}\n closeDelay={220}\n // Square corners (the full-width panel meets the bar edge-to-edge)\n // and no --available-width cap — see mainNavPanelVariants.\n popupClassName='max-w-none rounded-none'\n // The popup itself must follow the measured width too: Base UI\n // sizes it from --popup-width, measured once when a section\n // activates, so a panel opened before the first measurement lands\n // (or resized while open) would keep a stale popup width and clip\n // the full-width panel to a sliver. An inline width stays reactive.\n popupStyle={panelWidth === null ? undefined : { width: panelWidth }}\n >\n <NavigationMenuList className='w-full justify-start gap-0 border-b-0'>\n {navigation.map((item) => (\n <MainNavMenuItem\n key={`${item.title}-${item.href ?? 'section'}`}\n item={item}\n color={color ?? DEFAULT_MAIN_NAV_COLOR}\n currentHref={currentHref}\n panelWidth={panelWidth}\n />\n ))}\n </NavigationMenuList>\n </NavigationMenu>\n </div>\n </nav>\n )\n}\n\nexport { MainNav, mainNavColors, mainNavContainerVariants, mainNavPanelVariants, mainNavVariants }\nexport type { MainNavColor, MainNavItem, MainNavLinkItem, MainNavProps }\n"]}
@@ -17,7 +17,7 @@ const navigationMenuTriggerVariants = cva([
17
17
  // mb-2 pairs with the list's bottom hairline, matching the app source.
18
18
  "group mb-2 inline-flex h-9 w-max cursor-pointer items-center justify-center gap-1 rounded-sm px-4 py-2 text-sm font-medium whitespace-nowrap select-none",
19
19
  "bg-transparent text-foreground",
20
- "transition-colors motion-reduce:transition-none",
20
+ "motion-safe:transition-colors",
21
21
  // Resting halo on hover/focus/open. `focus:` (not focus-visible) is
22
22
  // deliberate for the tint — like Button, triggers give click feedback —
23
23
  // while the *outline* below stays keyboard-only.
@@ -67,9 +67,9 @@ function NavigationMenu({
67
67
  // Base UI reports its measured geometry through these vars; sizing
68
68
  // the box from them lets top/left glide between triggers.
69
69
  "isolate z-50 box-border h-[var(--positioner-height)] w-[var(--positioner-width)] max-w-[var(--available-width)]",
70
- "transition-[top,left,right,bottom] duration-300 ease-[cubic-bezier(0.22,1,0.36,1)]",
70
+ "duration-300 ease-[cubic-bezier(0.22,1,0.36,1)] motion-safe:transition-[top,left,right,bottom]",
71
71
  // data-instant: Base UI disables the glide (e.g. keyboard re-anchor).
72
- "data-instant:transition-none motion-reduce:transition-none"
72
+ "data-instant:transition-none"
73
73
  ),
74
74
  children: /* @__PURE__ */ jsx(
75
75
  NavigationMenu$1.Popup,
@@ -82,7 +82,7 @@ function NavigationMenu({
82
82
  // it into --popup-*), so switching sections morphs the surface
83
83
  // instead of jump-cutting.
84
84
  "h-[var(--popup-height)] w-[var(--popup-width)] max-w-[var(--available-width)] origin-(--transform-origin)",
85
- "transition-[opacity,transform,width,height,scale,translate] duration-300 ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:transition-none",
85
+ "duration-300 ease-[cubic-bezier(0.22,1,0.36,1)] motion-safe:transition-[opacity,transform,width,height,scale,translate]",
86
86
  // Open/close via Base UI transition attributes.
87
87
  "data-starting-style:scale-95 data-starting-style:opacity-0",
88
88
  "data-ending-style:scale-95 data-ending-style:opacity-0",
@@ -142,7 +142,7 @@ function NavigationMenuTrigger({ className, children, ...props }) {
142
142
  {
143
143
  "data-slot": "navigation-menu-icon",
144
144
  "aria-hidden": "true",
145
- className: "flex transition-transform duration-300 ease-[cubic-bezier(0.22,1,0.36,1)] data-popup-open:rotate-180 motion-reduce:transition-none",
145
+ className: "flex duration-300 ease-[cubic-bezier(0.22,1,0.36,1)] data-popup-open:rotate-180 motion-safe:transition-transform",
146
146
  children: /* @__PURE__ */ jsx(IconKeyboardArrowDown, { className: "size-5" })
147
147
  }
148
148
  )
@@ -157,7 +157,7 @@ function NavigationMenuContent({ className, ...props }) {
157
157
  "data-slot": "navigation-menu-content",
158
158
  className: cn(
159
159
  "h-full w-max max-w-[var(--available-width)] p-2",
160
- "transition-[opacity,translate] duration-300 ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:transition-none",
160
+ "duration-300 ease-[cubic-bezier(0.22,1,0.36,1)] motion-safe:transition-[opacity,translate]",
161
161
  "data-ending-style:opacity-0 data-starting-style:opacity-0",
162
162
  // Slide with the direction of travel between adjacent triggers.
163
163
  "data-starting-style:data-[activation-direction=left]:-translate-x-1/2",
@@ -184,7 +184,7 @@ function NavigationMenuLink({
184
184
  className: cn(
185
185
  navigationMenuInk,
186
186
  "flex flex-col gap-1 rounded-sm p-2 text-sm text-foreground",
187
- "transition-colors motion-reduce:transition-none",
187
+ "motion-safe:transition-colors",
188
188
  "hover:bg-(--nav-menu-halo) focus:bg-(--nav-menu-halo) active:bg-(--nav-menu-halo-active)",
189
189
  // Persistent tint for the current page (`active` prop → data-active).
190
190
  "data-active:bg-(--nav-menu-halo)",
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/navigation-menu.tsx"],"names":["NavigationMenuPrimitive"],"mappings":";;;;;;;AAiCA,MAAM,iBAAA,GAAoB;AAAA,EACxB,8EAAA;AAAA,EACA,2EAAA;AAAA,EACA;AACF,CAAA;AAgBA,MAAM,gCAAgC,GAAA,CAAI;AAAA,EACxC,GAAG,iBAAA;AAAA;AAAA;AAAA,EAGH,0JAAA;AAAA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u.js","sourcesContent":["'use client'\n\nimport { NavigationMenu as NavigationMenuPrimitive } from '@base-ui/react/navigation-menu'\nimport { cva } from 'class-variance-authority'\nimport type * as React from 'react'\n\nimport { IconKeyboardArrowDown } from '../icons/keyboard-arrow-down.js'\nimport { cn } from '../lib/utils.js'\n\nimport { Link, type LinkProps } from '../components/link.js'\n\n// ─── Shared motion + ink tokens ───────────────────────────────────────────────\n\n// One easing curve — ease-[cubic-bezier(0.22,1,0.36,1)] — is written literally\n// on every animated part (positioner glide, popup resize, content cross-fade,\n// chevron flip) so the menu reads as a single surface in motion, not four\n// independent animations. It is Base UI's documented nav-menu curve: a strong\n// ease-out that settles without overshoot. Written out per-use rather than\n// composed from a shared const so every class stays a literal for Tailwind's\n// source-text scanner.\n\n// Every interactive tint in the menu derives from a single --nav-menu-ink\n// token via color-mix, mirroring the --footer-ink / --link-color pattern\n// (see footer.tsx, link.tsx): a restyle only has to swap the one ink value and\n// the resting/active halos follow. The derivations are written literally\n// (not template-built) because Tailwind scans source text for class names —\n// a computed string would never be emitted.\n//\n// Ink values use the RAW masterbrand tokens (--primary-800 / --primary-200)\n// rather than Tailwind's --color-* bridge aliases: Tailwind v4 tree-shakes\n// unreferenced @theme keys, and a reference from inside an arbitrary property\n// is not a usage signal. The raw tokens are plain :root declarations from\n// @nswds/tokens and always resolve.\nconst navigationMenuInk = [\n '[--nav-menu-ink:var(--primary-800)] dark:[--nav-menu-ink:var(--primary-200)]',\n '[--nav-menu-halo:color-mix(in_oklch,var(--nav-menu-ink)_10%,transparent)]',\n '[--nav-menu-halo-active:color-mix(in_oklch,var(--nav-menu-ink)_18%,transparent)]',\n]\n\n// ─── Trigger styling (exported for reuse) ─────────────────────────────────────\n\n/**\n * Trigger chrome, exported as a cva so siblings (e.g. a main-nav pattern) and\n * plain links that should sit visually beside triggers can reuse or extend it —\n * the app source's `Contact` item renders an `<a>` with exactly these classes.\n *\n * The 10% ink halo marks hover/open and the 18% mix marks pressed; both are\n * backgrounds behind unchanged text, so text contrast is untouched. The\n * keyboard focus indicator is a 2px outline in the ink colour itself\n * (primary-800 on light surfaces, primary-200 in dark mode) — well above the\n * 3:1 non-text contrast minimum of WCAG 2.2 SC 1.4.11 against the white/dark\n * popover surfaces, and offset so it is never obscured (SC 2.4.7, 2.4.11).\n */\nconst navigationMenuTriggerVariants = cva([\n ...navigationMenuInk,\n // Layout — h-9 keeps the row compact; the halo box is the pointer target.\n // mb-2 pairs with the list's bottom hairline, matching the app source.\n 'group mb-2 inline-flex h-9 w-max cursor-pointer items-center justify-center gap-1 rounded-sm px-4 py-2 text-sm font-medium whitespace-nowrap select-none',\n 'bg-transparent text-foreground',\n 'transition-colors motion-reduce:transition-none',\n // Resting halo on hover/focus/open. `focus:` (not focus-visible) is\n // deliberate for the tint — like Button, triggers give click feedback —\n // while the *outline* below stays keyboard-only.\n 'hover:bg-(--nav-menu-halo) focus:bg-(--nav-menu-halo) active:bg-(--nav-menu-halo-active)',\n // Base UI marks the trigger whose popup is open with data-popup-open.\n 'data-popup-open:bg-(--nav-menu-halo)',\n 'outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--nav-menu-ink)',\n 'disabled:pointer-events-none disabled:opacity-50',\n])\n\n// ─── Root ─────────────────────────────────────────────────────────────────────\n\ntype NavigationMenuProps = Omit<NavigationMenuPrimitive.Root.Props, 'className'> &\n Pick<\n NavigationMenuPrimitive.Positioner.Props,\n 'side' | 'sideOffset' | 'align' | 'alignOffset' | 'collisionPadding' | 'collisionAvoidance'\n > & {\n className?: string\n /** Extra classes for the shared popup surface (sizing, width caps, …). */\n popupClassName?: string\n /**\n * Inline styles for the shared popup surface. The popup normally sizes\n * itself from Base UI's `--popup-width`/`--popup-height`, which are\n * measured ONCE when a section activates — geometry that must track\n * something that can change while the menu is open (MainNav's\n * container-width panels, say) goes stale there. An inline style wins\n * over the measured vars and stays reactive to re-renders.\n */\n popupStyle?: React.CSSProperties\n }\n\n/**\n * Top-level navigation menu — a menubar of triggers whose panels open into one\n * shared, animated popup.\n *\n * INTERNAL to MainNav — not exported from the package barrel, not a registry\n * item, no stories. It began as a public generic wrapper but was pulled from\n * the public API: bare primitive wrappers are not the nswds-ui style (the\n * design system publishes NSW-branded components, not shadcn-alikes), and\n * MainNav is the supported way to get this behaviour. The file ships inside\n * the main-nav registry item, and the module remains reachable through the\n * package's undocumented `components/navigation-menu` export subpath purely\n * as a build artefact — treat that as private API with no stability promise.\n * (The package name is deliberately not written out here: this comment ships\n * in registry content, and the alias-leak guard rejects any occurrence of the\n * package-prefixed import form.)\n *\n * Consumers only write `List > Item > (Trigger + Content)` pairs; the popup\n * plumbing Base UI requires (Portal → Positioner → Popup → Viewport, rendered\n * once at root level, into which every `Content` teleports) is composed here so\n * it cannot be assembled wrong. Positioning knobs (`side`, `sideOffset`,\n * `align`, `collisionPadding`, `collisionAvoidance`) pass through to the\n * internal Positioner.\n *\n * Accessibility is inherited from Base UI: the root renders a `<nav>` landmark\n * (pass `aria-label` when a page has more than one), triggers are real buttons\n * wired with `aria-expanded`/`aria-controls`, ArrowDown/Enter open from the\n * keyboard, arrow keys move along the list, and Escape or focus-out closes\n * (WAI-ARIA disclosure navigation pattern). Do not add ARIA by hand.\n *\n * Departure from the nswds-app source: that wrapper was Radix-based with an\n * optional inline viewport (`viewport` prop); Base UI's model has exactly one\n * viewport, so the prop is gone. Radix's `delayDuration`/`skipDelayDuration`\n * map to Base UI's `delay`/`closeDelay` (both default 50ms).\n */\nfunction NavigationMenu({\n className,\n children,\n side,\n sideOffset = 8,\n align,\n alignOffset,\n // Keep a gutter between the popup and the viewport edge on small screens.\n collisionPadding = 20,\n // Nav panels should never flip beside their menubar — cap size instead.\n collisionAvoidance = { side: 'none' },\n popupClassName,\n popupStyle,\n ...props\n}: NavigationMenuProps) {\n return (\n <NavigationMenuPrimitive.Root\n data-slot='navigation-menu'\n className={cn(\n 'group/navigation-menu relative flex max-w-max flex-1 items-center justify-center',\n className,\n )}\n {...props}\n >\n {children}\n <NavigationMenuPrimitive.Portal>\n <NavigationMenuPrimitive.Positioner\n data-slot='navigation-menu-positioner'\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n collisionPadding={collisionPadding}\n collisionAvoidance={collisionAvoidance}\n className={cn(\n // Base UI reports its measured geometry through these vars; sizing\n // the box from them lets top/left glide between triggers.\n 'isolate z-50 box-border h-[var(--positioner-height)] w-[var(--positioner-width)] max-w-[var(--available-width)]',\n 'transition-[top,left,right,bottom] duration-300 ease-[cubic-bezier(0.22,1,0.36,1)]',\n // data-instant: Base UI disables the glide (e.g. keyboard re-anchor).\n 'data-instant:transition-none motion-reduce:transition-none',\n )}\n >\n <NavigationMenuPrimitive.Popup\n data-slot='navigation-menu-popup'\n className={cn(\n // House popup surface (see popover.tsx / sheet.tsx).\n 'relative rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10',\n // Width/height track the active Content's size (Base UI measures\n // it into --popup-*), so switching sections morphs the surface\n // instead of jump-cutting.\n 'h-[var(--popup-height)] w-[var(--popup-width)] max-w-[var(--available-width)] origin-(--transform-origin)',\n 'transition-[opacity,transform,width,height,scale,translate] duration-300 ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:transition-none',\n // Open/close via Base UI transition attributes.\n 'data-starting-style:scale-95 data-starting-style:opacity-0',\n 'data-ending-style:scale-95 data-ending-style:opacity-0',\n popupClassName,\n )}\n style={popupStyle}\n >\n <NavigationMenuPrimitive.Viewport\n data-slot='navigation-menu-viewport'\n // Clips the outgoing/incoming Content pair during a section\n // switch; rounded to match the popup so corners don't leak.\n className='relative size-full overflow-hidden rounded-lg'\n />\n </NavigationMenuPrimitive.Popup>\n </NavigationMenuPrimitive.Positioner>\n </NavigationMenuPrimitive.Portal>\n </NavigationMenuPrimitive.Root>\n )\n}\n\n// ─── List / Item ──────────────────────────────────────────────────────────────\n\ntype NavigationMenuListProps = Omit<NavigationMenuPrimitive.List.Props, 'className'> & {\n className?: string\n}\n\n/**\n * The menubar row of triggers. Base UI renders a `<ul>` and manages roving\n * arrow-key focus between the items.\n *\n * Carries the app source's bottom hairline (tokenised from raw grey utilities\n * to the semantic `border-border`, which already flips for dark mode) and its\n * hidden-scrollbar overflow so a long menu can pan on narrow screens.\n */\nfunction NavigationMenuList({ className, ...props }: NavigationMenuListProps) {\n return (\n <NavigationMenuPrimitive.List\n data-slot='navigation-menu-list'\n className={cn(\n 'group flex flex-1 list-none items-center justify-center gap-1',\n '[scrollbar-width:none] border-b border-border whitespace-nowrap [&::-webkit-scrollbar]:hidden',\n className,\n )}\n {...props}\n />\n )\n}\n\ntype NavigationMenuItemProps = Omit<NavigationMenuPrimitive.Item.Props, 'className'> & {\n className?: string\n}\n\n/**\n * One menubar entry (`<li>`), pairing a `NavigationMenuTrigger` with its\n * `NavigationMenuContent` — or holding a bare `NavigationMenuLink` for items\n * with no panel. Pass `value` when controlling the open item programmatically.\n */\nfunction NavigationMenuItem({ className, ...props }: NavigationMenuItemProps) {\n return (\n <NavigationMenuPrimitive.Item\n data-slot='navigation-menu-item'\n className={cn('relative', className)}\n {...props}\n />\n )\n}\n\n// ─── Trigger ──────────────────────────────────────────────────────────────────\n\ntype NavigationMenuTriggerProps = Omit<NavigationMenuPrimitive.Trigger.Props, 'className'> & {\n className?: string\n}\n\n/**\n * Opens the item's panel. Renders a real `<button>` (never an anchor — the\n * trigger discloses content, it doesn't navigate), which Base UI wires with\n * `aria-expanded`/`aria-controls` and hover/click/keyboard open behaviour.\n *\n * The trailing chevron rides Base UI's Icon part, which mirrors the trigger's\n * `data-popup-open` attribute — the 180° flip is pure CSS off that attribute\n * (no JS state), and is suppressed for reduced-motion users (WCAG 2.3.3).\n * The chevron is decorative, so the Icon part is `aria-hidden`: it never\n * enters the button's accessible name, and the open state it hints at is\n * already conveyed programmatically via `aria-expanded` (SC 4.1.2).\n */\nfunction NavigationMenuTrigger({ className, children, ...props }: NavigationMenuTriggerProps) {\n return (\n <NavigationMenuPrimitive.Trigger\n data-slot='navigation-menu-trigger'\n className={cn(navigationMenuTriggerVariants(), className)}\n {...props}\n >\n {children}\n <NavigationMenuPrimitive.Icon\n data-slot='navigation-menu-icon'\n aria-hidden='true'\n className='flex transition-transform duration-300 ease-[cubic-bezier(0.22,1,0.36,1)] data-popup-open:rotate-180 motion-reduce:transition-none'\n >\n <IconKeyboardArrowDown className='size-5' />\n </NavigationMenuPrimitive.Icon>\n </NavigationMenuPrimitive.Trigger>\n )\n}\n\n// ─── Content ──────────────────────────────────────────────────────────────────\n\ntype NavigationMenuContentProps = Omit<NavigationMenuPrimitive.Content.Props, 'className'> & {\n className?: string\n}\n\n/**\n * The panel for one item. Authored inline next to its Trigger, but rendered\n * (teleported by Base UI) into the shared root-level Viewport while active —\n * so panel-to-panel switches cross-fade inside one popup surface.\n *\n * The directional slide keys off `data-activation-direction` (which adjacent\n * trigger the user came from), matching the app source's from-start/from-end\n * motion. Set `keepMounted` to keep the panel in the DOM for SSR crawlers.\n */\nfunction NavigationMenuContent({ className, ...props }: NavigationMenuContentProps) {\n return (\n <NavigationMenuPrimitive.Content\n data-slot='navigation-menu-content'\n className={cn(\n 'h-full w-max max-w-[var(--available-width)] p-2',\n 'transition-[opacity,translate] duration-300 ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:transition-none',\n 'data-ending-style:opacity-0 data-starting-style:opacity-0',\n // Slide with the direction of travel between adjacent triggers.\n 'data-starting-style:data-[activation-direction=left]:-translate-x-1/2',\n 'data-starting-style:data-[activation-direction=right]:translate-x-1/2',\n 'data-ending-style:data-[activation-direction=left]:translate-x-1/2',\n 'data-ending-style:data-[activation-direction=right]:-translate-x-1/2',\n className,\n )}\n {...props}\n />\n )\n}\n\n// ─── Link ─────────────────────────────────────────────────────────────────────\n\ntype NavigationMenuLinkProps = Omit<\n NavigationMenuPrimitive.Link.Props,\n 'className' | 'render' | 'href'\n> & {\n className?: string\n /**\n * Link target. Accepts the same string-or-UrlObject union as `Link`, since\n * the rendered element may be a framework link injected via `LinkProvider`.\n */\n href: LinkProps['href']\n}\n\n/**\n * A navigation link inside (or beside) the menu. Composes the design system's\n * `Link` through Base UI's `render` prop: Base UI keeps the behaviour —\n * roving focus, focus-out closing, `aria-current='page'` when `active`, close\n * on click — while `Link` supplies the element, so a `LinkProvider` framework\n * component (e.g. next/link) is injected automatically. `Link` renders with\n * `variant='unstyled'`; this component owns the visual treatment (same ink\n * halo/outline contract as the trigger — see `navigationMenuTriggerVariants`).\n *\n * Departure from Base UI's default: `closeOnClick` defaults to **true** here.\n * In an SPA a client-side navigation doesn't reload the document, so a menu\n * that stays open after choosing a destination reads as broken; pass\n * `closeOnClick={false}` for in-page links that should keep the panel open.\n *\n * Set `active` for the current page (the app source's `usePathname` check is\n * a framework API this package must not import — compare in the consumer and\n * pass the result down): it sets `aria-current='page'` (WCAG 2.4.8 support)\n * and the persistent halo via `data-active`.\n */\nfunction NavigationMenuLink({\n className,\n href,\n closeOnClick = true,\n ...props\n}: NavigationMenuLinkProps) {\n return (\n <NavigationMenuPrimitive.Link\n data-slot='navigation-menu-link'\n closeOnClick={closeOnClick}\n className={cn(\n navigationMenuInk,\n 'flex flex-col gap-1 rounded-sm p-2 text-sm text-foreground',\n 'transition-colors motion-reduce:transition-none',\n 'hover:bg-(--nav-menu-halo) focus:bg-(--nav-menu-halo) active:bg-(--nav-menu-halo-active)',\n // Persistent tint for the current page (`active` prop → data-active).\n 'data-active:bg-(--nav-menu-halo)',\n 'outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--nav-menu-ink)',\n // Unsized inline icons default to text scale and muted ink; explicit\n // size-*/text-* classes on the icon win.\n \"[&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground\",\n className,\n )}\n render={<Link variant='unstyled' href={href} />}\n {...props}\n />\n )\n}\n\nexport {\n NavigationMenu,\n NavigationMenuContent,\n NavigationMenuItem,\n NavigationMenuLink,\n NavigationMenuList,\n NavigationMenuTrigger,\n navigationMenuTriggerVariants,\n}\nexport type {\n NavigationMenuContentProps,\n NavigationMenuItemProps,\n NavigationMenuLinkProps,\n NavigationMenuListProps,\n NavigationMenuProps,\n NavigationMenuTriggerProps,\n}\n"]}
1
+ {"version":3,"sources":["../../src/components/navigation-menu.tsx"],"names":["NavigationMenuPrimitive"],"mappings":";;;;;;;AAiCA,MAAM,iBAAA,GAAoB;AAAA,EACxB,8EAAA;AAAA,EACA,2EAAA;AAAA,EACA;AACF,CAAA;AAgBA,MAAM,gCAAgC,GAAA,CAAI;AAAA,EACxC,GAAG,iBAAA;AAAA;AAAA;AAAA,EAGH,0JAAA;AAAA,EACA,gCAAA;AAAA,EACA,+BAAA;AAAA;AAAA;AAAA;AAAA,EAIA,0FAAA;AAAA;AAAA,EAEA,sCAAA;AAAA,EACA,kIAAA;AAAA,EACA;AACF,CAAC;AAyDD,SAAS,cAAA,CAAe;AAAA,EACtB,SAAA;AAAA,EACA,QAAA;AAAA,EACA,IAAA;AAAA,EACA,UAAA,GAAa,CAAA;AAAA,EACb,KAAA;AAAA,EACA,WAAA;AAAA;AAAA,EAEA,gBAAA,GAAmB,EAAA;AAAA;AAAA,EAEnB,kBAAA,GAAqB,EAAE,IAAA,EAAM,MAAA,EAAO;AAAA,EACpC,cAAA;AAAA,EACA,UAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAwB;AACtB,EAAA,uBACE,IAAA;AAAA,IAACA,gBAAA,CAAwB,IAAA;AAAA,IAAxB;AAAA,MACC,WAAA,EAAU,iBAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACT,kFAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG,KAAA;AAAA,MAEH,QAAA,EAAA;AAAA,QAAA,QAAA;AAAA,wBACD,GAAA,CAACA,gBAAA,CAAwB,MAAA,EAAxB,EACC,QAAA,kBAAA,GAAA;AAAA,UAACA,gBAAA,CAAwB,UAAA;AAAA,UAAxB;AAAA,YACC,WAAA,EAAU,4BAAA;AAAA,YACV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B;AAAA,MACC,WAAA,EAAU,sBAAA;AAAA,MACV,YAAA;AAAA,MACA,SAAA,EAAW,EAAA;AAAA,QACT,iBAAA;AAAA,QACA,4DAAA;AAAA,QACA,+BAAA;AAAA,QACA,0FAAA;AAAA;AAAA,QAEA,kCAAA;AAAA,QACA,kIAAA;AAAA;AAAA;AAAA,QAGA,0FAAA;AAAA,QACA;AAAA,OACF;AAAA,MACA,MAAA,kBAAQ,GAAA,CAAC,IAAA,EAAA,EAAK,OAAA,EAAQ,YAAW,IAAA,EAAY,CAAA;AAAA,MAC5C,GAAG;AAAA;AAAA,GACN;AAEJ","file":"navigation-menu.js","sourcesContent":["'use client'\n\nimport { NavigationMenu as NavigationMenuPrimitive } from '@base-ui/react/navigation-menu'\nimport { cva } from 'class-variance-authority'\nimport type * as React from 'react'\n\nimport { IconKeyboardArrowDown } from '../icons/keyboard-arrow-down.js'\nimport { cn } from '../lib/utils.js'\n\nimport { Link, type LinkProps } from '../components/link.js'\n\n// ─── Shared motion + ink tokens ───────────────────────────────────────────────\n\n// One easing curve — ease-[cubic-bezier(0.22,1,0.36,1)] — is written literally\n// on every animated part (positioner glide, popup resize, content cross-fade,\n// chevron flip) so the menu reads as a single surface in motion, not four\n// independent animations. It is Base UI's documented nav-menu curve: a strong\n// ease-out that settles without overshoot. Written out per-use rather than\n// composed from a shared const so every class stays a literal for Tailwind's\n// source-text scanner.\n\n// Every interactive tint in the menu derives from a single --nav-menu-ink\n// token via color-mix, mirroring the --footer-ink / --link-color pattern\n// (see footer.tsx, link.tsx): a restyle only has to swap the one ink value and\n// the resting/active halos follow. The derivations are written literally\n// (not template-built) because Tailwind scans source text for class names —\n// a computed string would never be emitted.\n//\n// Ink values use the RAW masterbrand tokens (--primary-800 / --primary-200)\n// rather than Tailwind's --color-* bridge aliases: Tailwind v4 tree-shakes\n// unreferenced @theme keys, and a reference from inside an arbitrary property\n// is not a usage signal. The raw tokens are plain :root declarations from\n// @nswds/tokens and always resolve.\nconst navigationMenuInk = [\n '[--nav-menu-ink:var(--primary-800)] dark:[--nav-menu-ink:var(--primary-200)]',\n '[--nav-menu-halo:color-mix(in_oklch,var(--nav-menu-ink)_10%,transparent)]',\n '[--nav-menu-halo-active:color-mix(in_oklch,var(--nav-menu-ink)_18%,transparent)]',\n]\n\n// ─── Trigger styling (exported for reuse) ─────────────────────────────────────\n\n/**\n * Trigger chrome, exported as a cva so siblings (e.g. a main-nav pattern) and\n * plain links that should sit visually beside triggers can reuse or extend it —\n * the app source's `Contact` item renders an `<a>` with exactly these classes.\n *\n * The 10% ink halo marks hover/open and the 18% mix marks pressed; both are\n * backgrounds behind unchanged text, so text contrast is untouched. The\n * keyboard focus indicator is a 2px outline in the ink colour itself\n * (primary-800 on light surfaces, primary-200 in dark mode) — well above the\n * 3:1 non-text contrast minimum of WCAG 2.2 SC 1.4.11 against the white/dark\n * popover surfaces, and offset so it is never obscured (SC 2.4.7, 2.4.11).\n */\nconst navigationMenuTriggerVariants = cva([\n ...navigationMenuInk,\n // Layout — h-9 keeps the row compact; the halo box is the pointer target.\n // mb-2 pairs with the list's bottom hairline, matching the app source.\n 'group mb-2 inline-flex h-9 w-max cursor-pointer items-center justify-center gap-1 rounded-sm px-4 py-2 text-sm font-medium whitespace-nowrap select-none',\n 'bg-transparent text-foreground',\n 'motion-safe:transition-colors',\n // Resting halo on hover/focus/open. `focus:` (not focus-visible) is\n // deliberate for the tint — like Button, triggers give click feedback —\n // while the *outline* below stays keyboard-only.\n 'hover:bg-(--nav-menu-halo) focus:bg-(--nav-menu-halo) active:bg-(--nav-menu-halo-active)',\n // Base UI marks the trigger whose popup is open with data-popup-open.\n 'data-popup-open:bg-(--nav-menu-halo)',\n 'outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--nav-menu-ink)',\n 'disabled:pointer-events-none disabled:opacity-50',\n])\n\n// ─── Root ─────────────────────────────────────────────────────────────────────\n\ntype NavigationMenuProps = Omit<NavigationMenuPrimitive.Root.Props, 'className'> &\n Pick<\n NavigationMenuPrimitive.Positioner.Props,\n 'side' | 'sideOffset' | 'align' | 'alignOffset' | 'collisionPadding' | 'collisionAvoidance'\n > & {\n className?: string\n /** Extra classes for the shared popup surface (sizing, width caps, …). */\n popupClassName?: string\n /**\n * Inline styles for the shared popup surface. The popup normally sizes\n * itself from Base UI's `--popup-width`/`--popup-height`, which are\n * measured ONCE when a section activates — geometry that must track\n * something that can change while the menu is open (MainNav's\n * container-width panels, say) goes stale there. An inline style wins\n * over the measured vars and stays reactive to re-renders.\n */\n popupStyle?: React.CSSProperties\n }\n\n/**\n * Top-level navigation menu — a menubar of triggers whose panels open into one\n * shared, animated popup.\n *\n * INTERNAL to MainNav — not exported from the package barrel, not a registry\n * item, no stories. It began as a public generic wrapper but was pulled from\n * the public API: bare primitive wrappers are not the nswds-ui style (the\n * design system publishes NSW-branded components, not shadcn-alikes), and\n * MainNav is the supported way to get this behaviour. The file ships inside\n * the main-nav registry item, and the module remains reachable through the\n * package's undocumented `components/navigation-menu` export subpath purely\n * as a build artefact — treat that as private API with no stability promise.\n * (The package name is deliberately not written out here: this comment ships\n * in registry content, and the alias-leak guard rejects any occurrence of the\n * package-prefixed import form.)\n *\n * Consumers only write `List > Item > (Trigger + Content)` pairs; the popup\n * plumbing Base UI requires (Portal → Positioner → Popup → Viewport, rendered\n * once at root level, into which every `Content` teleports) is composed here so\n * it cannot be assembled wrong. Positioning knobs (`side`, `sideOffset`,\n * `align`, `collisionPadding`, `collisionAvoidance`) pass through to the\n * internal Positioner.\n *\n * Accessibility is inherited from Base UI: the root renders a `<nav>` landmark\n * (pass `aria-label` when a page has more than one), triggers are real buttons\n * wired with `aria-expanded`/`aria-controls`, ArrowDown/Enter open from the\n * keyboard, arrow keys move along the list, and Escape or focus-out closes\n * (WAI-ARIA disclosure navigation pattern). Do not add ARIA by hand.\n *\n * Departure from the nswds-app source: that wrapper was Radix-based with an\n * optional inline viewport (`viewport` prop); Base UI's model has exactly one\n * viewport, so the prop is gone. Radix's `delayDuration`/`skipDelayDuration`\n * map to Base UI's `delay`/`closeDelay` (both default 50ms).\n */\nfunction NavigationMenu({\n className,\n children,\n side,\n sideOffset = 8,\n align,\n alignOffset,\n // Keep a gutter between the popup and the viewport edge on small screens.\n collisionPadding = 20,\n // Nav panels should never flip beside their menubar — cap size instead.\n collisionAvoidance = { side: 'none' },\n popupClassName,\n popupStyle,\n ...props\n}: NavigationMenuProps) {\n return (\n <NavigationMenuPrimitive.Root\n data-slot='navigation-menu'\n className={cn(\n 'group/navigation-menu relative flex max-w-max flex-1 items-center justify-center',\n className,\n )}\n {...props}\n >\n {children}\n <NavigationMenuPrimitive.Portal>\n <NavigationMenuPrimitive.Positioner\n data-slot='navigation-menu-positioner'\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n collisionPadding={collisionPadding}\n collisionAvoidance={collisionAvoidance}\n className={cn(\n // Base UI reports its measured geometry through these vars; sizing\n // the box from them lets top/left glide between triggers.\n 'isolate z-50 box-border h-[var(--positioner-height)] w-[var(--positioner-width)] max-w-[var(--available-width)]',\n 'duration-300 ease-[cubic-bezier(0.22,1,0.36,1)] motion-safe:transition-[top,left,right,bottom]',\n // data-instant: Base UI disables the glide (e.g. keyboard re-anchor).\n 'data-instant:transition-none',\n )}\n >\n <NavigationMenuPrimitive.Popup\n data-slot='navigation-menu-popup'\n className={cn(\n // House popup surface (see popover.tsx / sheet.tsx).\n 'relative rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10',\n // Width/height track the active Content's size (Base UI measures\n // it into --popup-*), so switching sections morphs the surface\n // instead of jump-cutting.\n 'h-[var(--popup-height)] w-[var(--popup-width)] max-w-[var(--available-width)] origin-(--transform-origin)',\n 'duration-300 ease-[cubic-bezier(0.22,1,0.36,1)] motion-safe:transition-[opacity,transform,width,height,scale,translate]',\n // Open/close via Base UI transition attributes.\n 'data-starting-style:scale-95 data-starting-style:opacity-0',\n 'data-ending-style:scale-95 data-ending-style:opacity-0',\n popupClassName,\n )}\n style={popupStyle}\n >\n <NavigationMenuPrimitive.Viewport\n data-slot='navigation-menu-viewport'\n // Clips the outgoing/incoming Content pair during a section\n // switch; rounded to match the popup so corners don't leak.\n className='relative size-full overflow-hidden rounded-lg'\n />\n </NavigationMenuPrimitive.Popup>\n </NavigationMenuPrimitive.Positioner>\n </NavigationMenuPrimitive.Portal>\n </NavigationMenuPrimitive.Root>\n )\n}\n\n// ─── List / Item ──────────────────────────────────────────────────────────────\n\ntype NavigationMenuListProps = Omit<NavigationMenuPrimitive.List.Props, 'className'> & {\n className?: string\n}\n\n/**\n * The menubar row of triggers. Base UI renders a `<ul>` and manages roving\n * arrow-key focus between the items.\n *\n * Carries the app source's bottom hairline (tokenised from raw grey utilities\n * to the semantic `border-border`, which already flips for dark mode) and its\n * hidden-scrollbar overflow so a long menu can pan on narrow screens.\n */\nfunction NavigationMenuList({ className, ...props }: NavigationMenuListProps) {\n return (\n <NavigationMenuPrimitive.List\n data-slot='navigation-menu-list'\n className={cn(\n 'group flex flex-1 list-none items-center justify-center gap-1',\n '[scrollbar-width:none] border-b border-border whitespace-nowrap [&::-webkit-scrollbar]:hidden',\n className,\n )}\n {...props}\n />\n )\n}\n\ntype NavigationMenuItemProps = Omit<NavigationMenuPrimitive.Item.Props, 'className'> & {\n className?: string\n}\n\n/**\n * One menubar entry (`<li>`), pairing a `NavigationMenuTrigger` with its\n * `NavigationMenuContent` — or holding a bare `NavigationMenuLink` for items\n * with no panel. Pass `value` when controlling the open item programmatically.\n */\nfunction NavigationMenuItem({ className, ...props }: NavigationMenuItemProps) {\n return (\n <NavigationMenuPrimitive.Item\n data-slot='navigation-menu-item'\n className={cn('relative', className)}\n {...props}\n />\n )\n}\n\n// ─── Trigger ──────────────────────────────────────────────────────────────────\n\ntype NavigationMenuTriggerProps = Omit<NavigationMenuPrimitive.Trigger.Props, 'className'> & {\n className?: string\n}\n\n/**\n * Opens the item's panel. Renders a real `<button>` (never an anchor — the\n * trigger discloses content, it doesn't navigate), which Base UI wires with\n * `aria-expanded`/`aria-controls` and hover/click/keyboard open behaviour.\n *\n * The trailing chevron rides Base UI's Icon part, which mirrors the trigger's\n * `data-popup-open` attribute — the 180° flip is pure CSS off that attribute\n * (no JS state), and is suppressed for reduced-motion users (WCAG 2.3.3).\n * The chevron is decorative, so the Icon part is `aria-hidden`: it never\n * enters the button's accessible name, and the open state it hints at is\n * already conveyed programmatically via `aria-expanded` (SC 4.1.2).\n */\nfunction NavigationMenuTrigger({ className, children, ...props }: NavigationMenuTriggerProps) {\n return (\n <NavigationMenuPrimitive.Trigger\n data-slot='navigation-menu-trigger'\n className={cn(navigationMenuTriggerVariants(), className)}\n {...props}\n >\n {children}\n <NavigationMenuPrimitive.Icon\n data-slot='navigation-menu-icon'\n aria-hidden='true'\n className='flex duration-300 ease-[cubic-bezier(0.22,1,0.36,1)] data-popup-open:rotate-180 motion-safe:transition-transform'\n >\n <IconKeyboardArrowDown className='size-5' />\n </NavigationMenuPrimitive.Icon>\n </NavigationMenuPrimitive.Trigger>\n )\n}\n\n// ─── Content ──────────────────────────────────────────────────────────────────\n\ntype NavigationMenuContentProps = Omit<NavigationMenuPrimitive.Content.Props, 'className'> & {\n className?: string\n}\n\n/**\n * The panel for one item. Authored inline next to its Trigger, but rendered\n * (teleported by Base UI) into the shared root-level Viewport while active —\n * so panel-to-panel switches cross-fade inside one popup surface.\n *\n * The directional slide keys off `data-activation-direction` (which adjacent\n * trigger the user came from), matching the app source's from-start/from-end\n * motion. Set `keepMounted` to keep the panel in the DOM for SSR crawlers.\n */\nfunction NavigationMenuContent({ className, ...props }: NavigationMenuContentProps) {\n return (\n <NavigationMenuPrimitive.Content\n data-slot='navigation-menu-content'\n className={cn(\n 'h-full w-max max-w-[var(--available-width)] p-2',\n 'duration-300 ease-[cubic-bezier(0.22,1,0.36,1)] motion-safe:transition-[opacity,translate]',\n 'data-ending-style:opacity-0 data-starting-style:opacity-0',\n // Slide with the direction of travel between adjacent triggers.\n 'data-starting-style:data-[activation-direction=left]:-translate-x-1/2',\n 'data-starting-style:data-[activation-direction=right]:translate-x-1/2',\n 'data-ending-style:data-[activation-direction=left]:translate-x-1/2',\n 'data-ending-style:data-[activation-direction=right]:-translate-x-1/2',\n className,\n )}\n {...props}\n />\n )\n}\n\n// ─── Link ─────────────────────────────────────────────────────────────────────\n\ntype NavigationMenuLinkProps = Omit<\n NavigationMenuPrimitive.Link.Props,\n 'className' | 'render' | 'href'\n> & {\n className?: string\n /**\n * Link target. Accepts the same string-or-UrlObject union as `Link`, since\n * the rendered element may be a framework link injected via `LinkProvider`.\n */\n href: LinkProps['href']\n}\n\n/**\n * A navigation link inside (or beside) the menu. Composes the design system's\n * `Link` through Base UI's `render` prop: Base UI keeps the behaviour —\n * roving focus, focus-out closing, `aria-current='page'` when `active`, close\n * on click — while `Link` supplies the element, so a `LinkProvider` framework\n * component (e.g. next/link) is injected automatically. `Link` renders with\n * `variant='unstyled'`; this component owns the visual treatment (same ink\n * halo/outline contract as the trigger — see `navigationMenuTriggerVariants`).\n *\n * Departure from Base UI's default: `closeOnClick` defaults to **true** here.\n * In an SPA a client-side navigation doesn't reload the document, so a menu\n * that stays open after choosing a destination reads as broken; pass\n * `closeOnClick={false}` for in-page links that should keep the panel open.\n *\n * Set `active` for the current page (the app source's `usePathname` check is\n * a framework API this package must not import — compare in the consumer and\n * pass the result down): it sets `aria-current='page'` (WCAG 2.4.8 support)\n * and the persistent halo via `data-active`.\n */\nfunction NavigationMenuLink({\n className,\n href,\n closeOnClick = true,\n ...props\n}: NavigationMenuLinkProps) {\n return (\n <NavigationMenuPrimitive.Link\n data-slot='navigation-menu-link'\n closeOnClick={closeOnClick}\n className={cn(\n navigationMenuInk,\n 'flex flex-col gap-1 rounded-sm p-2 text-sm text-foreground',\n 'motion-safe:transition-colors',\n 'hover:bg-(--nav-menu-halo) focus:bg-(--nav-menu-halo) active:bg-(--nav-menu-halo-active)',\n // Persistent tint for the current page (`active` prop → data-active).\n 'data-active:bg-(--nav-menu-halo)',\n 'outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--nav-menu-ink)',\n // Unsized inline icons default to text scale and muted ink; explicit\n // size-*/text-* classes on the icon win.\n \"[&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground\",\n className,\n )}\n render={<Link variant='unstyled' href={href} />}\n {...props}\n />\n )\n}\n\nexport {\n NavigationMenu,\n NavigationMenuContent,\n NavigationMenuItem,\n NavigationMenuLink,\n NavigationMenuList,\n NavigationMenuTrigger,\n navigationMenuTriggerVariants,\n}\nexport type {\n NavigationMenuContentProps,\n NavigationMenuItemProps,\n NavigationMenuLinkProps,\n NavigationMenuListProps,\n NavigationMenuProps,\n NavigationMenuTriggerProps,\n}\n"]}
@@ -10,9 +10,9 @@ import React__default from 'react';
10
10
  * schedule focus restoration). Do not override the custom property directly —
11
11
  * that changes only the visual duration while the state machine still settles
12
12
  * on `durationMs`, desyncing the two; pass `durationMs` instead. Under
13
- * `prefers-reduced-motion` the slide is skipped (`motion-reduce:
14
- * transition-none`) but the state machine still waits the full duration; the
15
- * menu is simply "settled early" for those users, never broken.
13
+ * `prefers-reduced-motion` the slide is skipped (the transition is applied
14
+ * under `motion-safe:` only) but the state machine still waits the full
15
+ * duration; the menu is simply "settled early" for those users, never broken.
16
16
  */
17
17
  declare const PUSH_MENU_DURATION_MS = 300;
18
18
  /** A node in the menu tree. Items with `links` drill in; items with `href` navigate. */
@@ -126,8 +126,8 @@ type PushMenuProps = Omit<React__default.ComponentPropsWithoutRef<'nav'>, 'child
126
126
  * - During the slide, rows get `pointer-events-none` and the state machine
127
127
  * ignores re-entrant navigation, but nothing is ever `disabled` — disabling
128
128
  * the focused Back button mid-animation would eject keyboard focus.
129
- * - Slides are CSS transforms with `motion-reduce:transition-none`, replacing
130
- * the app's inline transition strings (which ignored reduced motion).
129
+ * - Slides are CSS transforms applied under `motion-safe:`, replacing the app's
130
+ * inline transition strings (which ignored reduced motion).
131
131
  *
132
132
  * Departures from the nswds-app source, beyond the above:
133
133
  *
@@ -65,7 +65,7 @@ const itemBaseClassName = [
65
65
  // min-h-11 guarantees the 44px minimum target size (WCAG 2.2, 2.5.8 Target
66
66
  // Size) even for single-line rows with compact padding overrides.
67
67
  "relative flex min-h-11 w-full cursor-pointer items-center justify-between gap-x-6 border-l p-4 text-left text-base",
68
- "transition-colors motion-reduce:transition-none",
68
+ "motion-safe:transition-colors",
69
69
  "hover:border-primary-800 hover:bg-primary-800/10 dark:hover:border-primary-200 dark:hover:bg-primary-200/10",
70
70
  // Inset outline (negative offset): the levels scroll inside an
71
71
  // overflow-hidden root, so an outward offset would be clipped on the first
@@ -233,7 +233,7 @@ function PushMenu({
233
233
  inert: !isActiveLevel,
234
234
  className: cn(
235
235
  "absolute inset-0 flex h-full w-full flex-col bg-popover will-change-transform",
236
- isSliding ? "transition-transform duration-(--push-menu-duration) ease-out motion-reduce:transition-none" : "transition-none"
236
+ isSliding ? "duration-(--push-menu-duration) ease-out motion-safe:transition-transform" : "transition-none"
237
237
  ),
238
238
  style: { transform: `translateX(${translateX}%)`, zIndex: index + 1 },
239
239
  children: [