@nswds/ui 4.3.0 → 4.4.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.
@@ -0,0 +1,366 @@
1
+ "use client"
2
+ import { jsx, jsxs } from 'react/jsx-runtime';
3
+ import { cva } from 'class-variance-authority';
4
+ import React from 'react';
5
+ import { IconEast } from '../icons/east.js';
6
+ import { cn } from '../lib/utils.js';
7
+ import { NavigationMenu, NavigationMenuList, NavigationMenuItem, NavigationMenuLink, NavigationMenuTrigger, NavigationMenuContent } from '../components/navigation-menu.js';
8
+
9
+ const mainNavColors = [
10
+ "primary-800",
11
+ "primary-600",
12
+ "primary-400",
13
+ "primary-200",
14
+ "grey-800",
15
+ "grey-600",
16
+ "grey-400",
17
+ "grey-200",
18
+ "accent-800",
19
+ "accent-600",
20
+ "accent-400",
21
+ "accent-200",
22
+ "white"
23
+ ];
24
+ const DEFAULT_MAIN_NAV_COLOR = "white";
25
+ const mainNavVariants = cva(
26
+ [
27
+ "w-full",
28
+ // Every derived colour on the bar resolves from a single --main-nav-ink
29
+ // token, so a colour variant only has to declare the surface utilities and
30
+ // that one value — this replaces the nswds-app source's hand-written
31
+ // 13-variant × 8-slot style table. The border derivation is written
32
+ // literally here (once) rather than per-variant: Tailwind scans source
33
+ // text for class names, so a template-built arbitrary property would
34
+ // never be emitted. Hover/active halos are not derived here — the
35
+ // triggers ride navigation-menu.tsx's --nav-menu-halo chain, re-pointed
36
+ // at this ink (see mainNavItemInk), so there is exactly one halo recipe.
37
+ "[--main-nav-border:color-mix(in_oklch,var(--main-nav-ink)_15%,transparent)]"
38
+ ],
39
+ {
40
+ variants: {
41
+ // Ink values use the RAW masterbrand tokens (--primary-800, --grey-800,
42
+ // --accent-800) rather than Tailwind's --color-* bridge aliases. Tailwind
43
+ // v4 tree-shakes an unreferenced @theme key, and referencing one from
44
+ // inside an arbitrary property is not a usage signal — the raw tokens are
45
+ // plain :root declarations from @nswds/tokens and always resolve.
46
+ // (--color-white is safe: `text-white` / `bg-white` below are real
47
+ // utilities, so that key is always emitted.)
48
+ //
49
+ // Dark mode deepens every surface onto the same family's dark steps —
50
+ // -800→-950, -600→-900, -400→-850, -200→-800, white→grey-900 — the
51
+ // Footer's exact mapping, so the luminance ORDER within a family is
52
+ // preserved and a stacked Footer + MainNav sharing one colour word stay
53
+ // in step in both themes. Ink goes white on all thirteen; every dark
54
+ // pair is WCAG 2.2 AAA (worst 13.6:1).
55
+ color: {
56
+ "primary-800": "bg-primary-800 text-white [--main-nav-ink:var(--color-white)] dark:bg-primary-950",
57
+ "primary-600": "bg-primary-600 text-white [--main-nav-ink:var(--color-white)] dark:bg-primary-900",
58
+ "primary-400": "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)]",
59
+ "primary-200": "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)]",
60
+ "grey-800": "bg-grey-800 text-white [--main-nav-ink:var(--color-white)] dark:bg-grey-950",
61
+ "grey-600": "bg-grey-600 text-white [--main-nav-ink:var(--color-white)] dark:bg-grey-900",
62
+ "grey-400": "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)]",
63
+ "grey-200": "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)]",
64
+ "accent-800": "bg-accent-800 text-white [--main-nav-ink:var(--color-white)] dark:bg-accent-950",
65
+ "accent-600": "bg-accent-600 text-white [--main-nav-ink:var(--color-white)] dark:bg-accent-900",
66
+ "accent-400": "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)]",
67
+ "accent-200": "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)]",
68
+ white: "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)]"
69
+ },
70
+ // Rules along the bar's edges, drawn from the ink-derived border token so
71
+ // they follow every colour variant and both themes. Replaces the app
72
+ // source's deprecated showTopBorder/showBottomBorder booleans, which are
73
+ // deliberately not ported.
74
+ border: {
75
+ none: "",
76
+ top: "border-t border-(--main-nav-border)",
77
+ bottom: "border-b border-(--main-nav-border)",
78
+ both: "border-y border-(--main-nav-border)"
79
+ }
80
+ },
81
+ defaultVariants: {
82
+ color: DEFAULT_MAIN_NAV_COLOR,
83
+ border: "none"
84
+ }
85
+ }
86
+ );
87
+ const mainNavContainerVariants = cva(
88
+ [
89
+ "mx-auto flex w-full items-center",
90
+ // Lateral padding funnels through --main-nav-padding-x so an app can
91
+ // retune it once (via the `style` prop or a utility class) without a new
92
+ // variant. Same mechanism, and the same 16px → 24px → 48px rhythm, as
93
+ // Masthead, Header and Footer.
94
+ "px-(--main-nav-padding-x)",
95
+ "[--main-nav-padding-x:--spacing(4)] sm:[--main-nav-padding-x:--spacing(6)] lg:[--main-nav-padding-x:--spacing(12)]"
96
+ ],
97
+ {
98
+ variants: {
99
+ container: {
100
+ // Full-bleed (nswds-app fullBleed parity). --main-nav-max-width is
101
+ // still read so a shell app can constrain the inner wrapper without
102
+ // switching variants.
103
+ fluid: "max-w-[var(--main-nav-max-width,none)]",
104
+ // Centred content column, legacy nsw-container parity (1200px).
105
+ contained: "max-w-[var(--main-nav-max-width,75rem)]"
106
+ }
107
+ },
108
+ defaultVariants: {
109
+ container: "fluid"
110
+ }
111
+ }
112
+ );
113
+ const mainNavPanelVariants = cva(
114
+ [
115
+ "p-0 whitespace-normal",
116
+ // The sibling Content (and the shared popup, via popupClassName below)
117
+ // cap themselves at --available-width, which Base UI measures from the
118
+ // active trigger — for a mid-bar trigger that is less than the nav's
119
+ // width, which would shrink right-hand panels. The panel's width is
120
+ // container-measured and can never exceed the viewport, so the cap is
121
+ // safely lifted.
122
+ "max-w-none",
123
+ "[--main-nav-panel-border:color-mix(in_oklch,var(--main-nav-panel-ink)_15%,transparent)]"
124
+ ],
125
+ {
126
+ variants: {
127
+ color: {
128
+ "primary-800": "[--main-nav-panel-ink:var(--primary-800)] dark:[--main-nav-panel-ink:var(--primary-200)]",
129
+ "primary-600": "[--main-nav-panel-ink:var(--primary-800)] dark:[--main-nav-panel-ink:var(--primary-200)]",
130
+ "primary-400": "[--main-nav-panel-ink:var(--primary-800)] dark:[--main-nav-panel-ink:var(--primary-200)]",
131
+ "primary-200": "[--main-nav-panel-ink:var(--primary-800)] dark:[--main-nav-panel-ink:var(--primary-200)]",
132
+ "grey-800": "[--main-nav-panel-ink:var(--grey-800)] dark:[--main-nav-panel-ink:var(--grey-200)]",
133
+ "grey-600": "[--main-nav-panel-ink:var(--grey-800)] dark:[--main-nav-panel-ink:var(--grey-200)]",
134
+ "grey-400": "[--main-nav-panel-ink:var(--grey-800)] dark:[--main-nav-panel-ink:var(--grey-200)]",
135
+ "grey-200": "[--main-nav-panel-ink:var(--grey-800)] dark:[--main-nav-panel-ink:var(--grey-200)]",
136
+ "accent-800": "[--main-nav-panel-ink:var(--accent-800)] dark:[--main-nav-panel-ink:var(--accent-200)]",
137
+ "accent-600": "[--main-nav-panel-ink:var(--accent-800)] dark:[--main-nav-panel-ink:var(--accent-200)]",
138
+ "accent-400": "[--main-nav-panel-ink:var(--accent-800)] dark:[--main-nav-panel-ink:var(--accent-200)]",
139
+ "accent-200": "[--main-nav-panel-ink:var(--accent-800)] dark:[--main-nav-panel-ink:var(--accent-200)]",
140
+ white: "[--main-nav-panel-ink:var(--grey-800)] dark:[--main-nav-panel-ink:var(--grey-200)]"
141
+ }
142
+ },
143
+ defaultVariants: {
144
+ color: DEFAULT_MAIN_NAV_COLOR
145
+ }
146
+ }
147
+ );
148
+ const mainNavItemInk = "[--nav-menu-ink:var(--main-nav-ink)] dark:[--nav-menu-ink:var(--main-nav-ink)]";
149
+ const mainNavPanelInk = "[--nav-menu-ink:var(--main-nav-panel-ink)] dark:[--nav-menu-ink:var(--main-nav-panel-ink)]";
150
+ const mainNavTriggerClassName = [
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)",
153
+ "lg:px-8",
154
+ "[&_svg]:size-6",
155
+ "data-popup-open:shadow-[inset_0_-4px_0_0_currentColor]",
156
+ "data-current:shadow-[inset_0_-4px_0_0_currentColor]"
157
+ ].join(" ");
158
+ const mainNavTopLinkClassName = [
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)",
161
+ "lg:px-8",
162
+ "data-active:shadow-[inset_0_-4px_0_0_currentColor]"
163
+ ].join(" ");
164
+ const mainNavFeaturedLinkClassName = [
165
+ mainNavPanelInk,
166
+ "group relative flex-row items-center rounded-none px-8 py-8 text-xl font-bold whitespace-normal text-(--main-nav-panel-ink)"
167
+ ].join(" ");
168
+ const mainNavFeaturedHeadingClassName = "flex flex-row items-center px-8 py-8 text-xl font-bold whitespace-normal text-(--main-nav-panel-ink)";
169
+ const mainNavSectionLinkClassName = [
170
+ mainNavPanelInk,
171
+ "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",
172
+ "hover:text-(--main-nav-panel-ink)",
173
+ "[&:nth-last-child(-n+3)]:border-b"
174
+ ].join(" ");
175
+ function warnIfItemUnlinked(item) {
176
+ if (process.env.NODE_ENV === "production") {
177
+ return;
178
+ }
179
+ if (!item.href && !item.links?.length) {
180
+ console.warn(
181
+ `[nswds/ui] MainNav item "${item.title}" has no href and no links \u2014 it will render as a dead "#" link.`
182
+ );
183
+ }
184
+ if (!item.href && item.links?.length) {
185
+ console.warn(
186
+ `[nswds/ui] MainNav section "${item.title}" has links but no href \u2014 its panel lead renders as a plain heading; pass href to make it a link.`
187
+ );
188
+ }
189
+ }
190
+ function MainNavMenuItem({ item, color, currentHref, panelWidth }) {
191
+ warnIfItemUnlinked(item);
192
+ const links = item.links;
193
+ const isExactCurrent = item.href !== void 0 && item.href === currentHref;
194
+ const isSectionCurrent = isExactCurrent || currentHref !== void 0 && (links?.some((link) => link.href === currentHref) ?? false);
195
+ if (!links?.length) {
196
+ return /* @__PURE__ */ jsx(NavigationMenuItem, { className: "shrink-0", children: /* @__PURE__ */ jsx(
197
+ NavigationMenuLink,
198
+ {
199
+ "data-slot": "main-nav-top-link",
200
+ href: item.href ?? "#",
201
+ active: isExactCurrent,
202
+ className: mainNavTopLinkClassName,
203
+ children: item.title
204
+ }
205
+ ) });
206
+ }
207
+ return /* @__PURE__ */ jsxs(NavigationMenuItem, { className: "shrink-0", children: [
208
+ /* @__PURE__ */ jsx(
209
+ NavigationMenuTrigger,
210
+ {
211
+ "data-current": isSectionCurrent || void 0,
212
+ className: mainNavTriggerClassName,
213
+ children: item.title
214
+ }
215
+ ),
216
+ /* @__PURE__ */ jsx(
217
+ NavigationMenuContent,
218
+ {
219
+ "data-slot": "main-nav-panel",
220
+ className: mainNavPanelVariants({ color }),
221
+ style: panelWidth === null ? void 0 : { width: panelWidth },
222
+ children: /* @__PURE__ */ jsxs("div", { className: "grid w-full", children: [
223
+ item.href === void 0 ? /* @__PURE__ */ jsx("div", { "data-slot": "main-nav-featured-heading", className: mainNavFeaturedHeadingClassName, children: item.title }) : /* @__PURE__ */ jsxs(
224
+ NavigationMenuLink,
225
+ {
226
+ "data-slot": "main-nav-featured-link",
227
+ href: item.href,
228
+ active: isExactCurrent,
229
+ className: mainNavFeaturedLinkClassName,
230
+ children: [
231
+ item.title,
232
+ /* @__PURE__ */ jsx(
233
+ IconEast,
234
+ {
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"
237
+ }
238
+ )
239
+ ]
240
+ }
241
+ ),
242
+ /* @__PURE__ */ jsx(
243
+ "div",
244
+ {
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",
247
+ children: links.map((link, index) => /* @__PURE__ */ jsx(
248
+ NavigationMenuLink,
249
+ {
250
+ "data-slot": "main-nav-section-link",
251
+ href: link.href,
252
+ active: link.href === currentHref,
253
+ className: mainNavSectionLinkClassName,
254
+ children: link.title
255
+ },
256
+ `${link.title}-${link.href}-${index}`
257
+ ))
258
+ }
259
+ )
260
+ ] })
261
+ }
262
+ )
263
+ ] });
264
+ }
265
+ function MainNav({
266
+ className,
267
+ containerClassName,
268
+ color,
269
+ container,
270
+ border,
271
+ navigation,
272
+ currentHref,
273
+ sticky = false,
274
+ shadow = true,
275
+ "aria-label": ariaLabel = "Main navigation",
276
+ ref,
277
+ ...props
278
+ }) {
279
+ const containerRef = React.useRef(null);
280
+ const [panelWidth, setPanelWidth] = React.useState(null);
281
+ React.useEffect(() => {
282
+ const element = containerRef.current;
283
+ if (!element) {
284
+ return;
285
+ }
286
+ const measure = () => {
287
+ setPanelWidth(element.getBoundingClientRect().width);
288
+ };
289
+ measure();
290
+ const observer = new ResizeObserver(measure);
291
+ observer.observe(element);
292
+ return () => observer.disconnect();
293
+ }, []);
294
+ const lastAlignOffsetRef = React.useRef(0);
295
+ const alignOffset = React.useCallback(() => {
296
+ const element = containerRef.current;
297
+ if (!element) {
298
+ return lastAlignOffsetRef.current;
299
+ }
300
+ const trigger = element.querySelector("[data-popup-open]");
301
+ if (!trigger) {
302
+ return lastAlignOffsetRef.current;
303
+ }
304
+ lastAlignOffsetRef.current = element.getBoundingClientRect().left - trigger.getBoundingClientRect().left;
305
+ return lastAlignOffsetRef.current;
306
+ }, []);
307
+ return /* @__PURE__ */ jsx(
308
+ "nav",
309
+ {
310
+ id: "nsw-main-navigation",
311
+ "data-slot": "main-nav",
312
+ "data-color": color ?? DEFAULT_MAIN_NAV_COLOR,
313
+ "aria-label": ariaLabel,
314
+ ...props,
315
+ className: cn(
316
+ mainNavVariants({ color, border }),
317
+ // z-40 matches Header (both sit below the z-50 SkipLinks). An app
318
+ // stacking this under a sticky Header sets --main-nav-top to the
319
+ // header's height.
320
+ sticky && "sticky top-[var(--main-nav-top,0px)] z-40",
321
+ // House scrolled-header shadow; in dark mode borders carry separation.
322
+ shadow && "shadow-md shadow-black/5 dark:shadow-none",
323
+ className
324
+ ),
325
+ ref,
326
+ children: /* @__PURE__ */ jsx(
327
+ "div",
328
+ {
329
+ ref: containerRef,
330
+ "data-slot": "main-nav-container",
331
+ className: cn(mainNavContainerVariants({ container }), containerClassName),
332
+ children: /* @__PURE__ */ jsx(
333
+ NavigationMenu,
334
+ {
335
+ render: /* @__PURE__ */ jsx("div", {}),
336
+ className: "w-full max-w-none justify-start",
337
+ side: "bottom",
338
+ sideOffset: 0,
339
+ align: "start",
340
+ alignOffset,
341
+ collisionPadding: 0,
342
+ collisionAvoidance: { side: "none", align: "none" },
343
+ closeDelay: 220,
344
+ popupClassName: "max-w-none rounded-none",
345
+ popupStyle: panelWidth === null ? void 0 : { width: panelWidth },
346
+ children: /* @__PURE__ */ jsx(NavigationMenuList, { className: "w-full justify-start gap-0 border-b-0", children: navigation.map((item) => /* @__PURE__ */ jsx(
347
+ MainNavMenuItem,
348
+ {
349
+ item,
350
+ color: color ?? DEFAULT_MAIN_NAV_COLOR,
351
+ currentHref,
352
+ panelWidth
353
+ },
354
+ `${item.title}-${item.href ?? "section"}`
355
+ )) })
356
+ }
357
+ )
358
+ }
359
+ )
360
+ }
361
+ );
362
+ }
363
+
364
+ export { MainNav, mainNavColors, mainNavContainerVariants, mainNavPanelVariants, mainNavVariants };
365
+ //# sourceMappingURL=main-nav.js.map
366
+ //# sourceMappingURL=main-nav.js.map
@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AA,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, MainNavProps }\n"]}
@@ -0,0 +1,148 @@
1
+ import * as class_variance_authority_types from 'class-variance-authority/types';
2
+ import { NavigationMenu as NavigationMenu$1 } from '@base-ui/react/navigation-menu';
3
+ import * as React from 'react';
4
+ import { LinkProps } from './link.js';
5
+ import 'class-variance-authority';
6
+
7
+ /**
8
+ * Trigger chrome, exported as a cva so siblings (e.g. a main-nav pattern) and
9
+ * plain links that should sit visually beside triggers can reuse or extend it —
10
+ * the app source's `Contact` item renders an `<a>` with exactly these classes.
11
+ *
12
+ * The 10% ink halo marks hover/open and the 18% mix marks pressed; both are
13
+ * backgrounds behind unchanged text, so text contrast is untouched. The
14
+ * keyboard focus indicator is a 2px outline in the ink colour itself
15
+ * (primary-800 on light surfaces, primary-200 in dark mode) — well above the
16
+ * 3:1 non-text contrast minimum of WCAG 2.2 SC 1.4.11 against the white/dark
17
+ * popover surfaces, and offset so it is never obscured (SC 2.4.7, 2.4.11).
18
+ */
19
+ declare const navigationMenuTriggerVariants: (props?: class_variance_authority_types.ClassProp | undefined) => string;
20
+ type NavigationMenuProps = Omit<NavigationMenu$1.Root.Props, 'className'> & Pick<NavigationMenu$1.Positioner.Props, 'side' | 'sideOffset' | 'align' | 'alignOffset' | 'collisionPadding' | 'collisionAvoidance'> & {
21
+ className?: string;
22
+ /** Extra classes for the shared popup surface (sizing, width caps, …). */
23
+ popupClassName?: string;
24
+ /**
25
+ * Inline styles for the shared popup surface. The popup normally sizes
26
+ * itself from Base UI's `--popup-width`/`--popup-height`, which are
27
+ * measured ONCE when a section activates — geometry that must track
28
+ * something that can change while the menu is open (MainNav's
29
+ * container-width panels, say) goes stale there. An inline style wins
30
+ * over the measured vars and stays reactive to re-renders.
31
+ */
32
+ popupStyle?: React.CSSProperties;
33
+ };
34
+ /**
35
+ * Top-level navigation menu — a menubar of triggers whose panels open into one
36
+ * shared, animated popup.
37
+ *
38
+ * INTERNAL to MainNav — not exported from the package barrel, not a registry
39
+ * item, no stories. It began as a public generic wrapper but was pulled from
40
+ * the public API: bare primitive wrappers are not the nswds-ui style (the
41
+ * design system publishes NSW-branded components, not shadcn-alikes), and
42
+ * MainNav is the supported way to get this behaviour. The file ships inside
43
+ * the main-nav registry item, and the module remains reachable through the
44
+ * package's undocumented `components/navigation-menu` export subpath purely
45
+ * as a build artefact — treat that as private API with no stability promise.
46
+ * (The package name is deliberately not written out here: this comment ships
47
+ * in registry content, and the alias-leak guard rejects any occurrence of the
48
+ * package-prefixed import form.)
49
+ *
50
+ * Consumers only write `List > Item > (Trigger + Content)` pairs; the popup
51
+ * plumbing Base UI requires (Portal → Positioner → Popup → Viewport, rendered
52
+ * once at root level, into which every `Content` teleports) is composed here so
53
+ * it cannot be assembled wrong. Positioning knobs (`side`, `sideOffset`,
54
+ * `align`, `collisionPadding`, `collisionAvoidance`) pass through to the
55
+ * internal Positioner.
56
+ *
57
+ * Accessibility is inherited from Base UI: the root renders a `<nav>` landmark
58
+ * (pass `aria-label` when a page has more than one), triggers are real buttons
59
+ * wired with `aria-expanded`/`aria-controls`, ArrowDown/Enter open from the
60
+ * keyboard, arrow keys move along the list, and Escape or focus-out closes
61
+ * (WAI-ARIA disclosure navigation pattern). Do not add ARIA by hand.
62
+ *
63
+ * Departure from the nswds-app source: that wrapper was Radix-based with an
64
+ * optional inline viewport (`viewport` prop); Base UI's model has exactly one
65
+ * viewport, so the prop is gone. Radix's `delayDuration`/`skipDelayDuration`
66
+ * map to Base UI's `delay`/`closeDelay` (both default 50ms).
67
+ */
68
+ declare function NavigationMenu({ className, children, side, sideOffset, align, alignOffset, collisionPadding, collisionAvoidance, popupClassName, popupStyle, ...props }: NavigationMenuProps): React.JSX.Element;
69
+ type NavigationMenuListProps = Omit<NavigationMenu$1.List.Props, 'className'> & {
70
+ className?: string;
71
+ };
72
+ /**
73
+ * The menubar row of triggers. Base UI renders a `<ul>` and manages roving
74
+ * arrow-key focus between the items.
75
+ *
76
+ * Carries the app source's bottom hairline (tokenised from raw grey utilities
77
+ * to the semantic `border-border`, which already flips for dark mode) and its
78
+ * hidden-scrollbar overflow so a long menu can pan on narrow screens.
79
+ */
80
+ declare function NavigationMenuList({ className, ...props }: NavigationMenuListProps): React.JSX.Element;
81
+ type NavigationMenuItemProps = Omit<NavigationMenu$1.Item.Props, 'className'> & {
82
+ className?: string;
83
+ };
84
+ /**
85
+ * One menubar entry (`<li>`), pairing a `NavigationMenuTrigger` with its
86
+ * `NavigationMenuContent` — or holding a bare `NavigationMenuLink` for items
87
+ * with no panel. Pass `value` when controlling the open item programmatically.
88
+ */
89
+ declare function NavigationMenuItem({ className, ...props }: NavigationMenuItemProps): React.JSX.Element;
90
+ type NavigationMenuTriggerProps = Omit<NavigationMenu$1.Trigger.Props, 'className'> & {
91
+ className?: string;
92
+ };
93
+ /**
94
+ * Opens the item's panel. Renders a real `<button>` (never an anchor — the
95
+ * trigger discloses content, it doesn't navigate), which Base UI wires with
96
+ * `aria-expanded`/`aria-controls` and hover/click/keyboard open behaviour.
97
+ *
98
+ * The trailing chevron rides Base UI's Icon part, which mirrors the trigger's
99
+ * `data-popup-open` attribute — the 180° flip is pure CSS off that attribute
100
+ * (no JS state), and is suppressed for reduced-motion users (WCAG 2.3.3).
101
+ * The chevron is decorative, so the Icon part is `aria-hidden`: it never
102
+ * enters the button's accessible name, and the open state it hints at is
103
+ * already conveyed programmatically via `aria-expanded` (SC 4.1.2).
104
+ */
105
+ declare function NavigationMenuTrigger({ className, children, ...props }: NavigationMenuTriggerProps): React.JSX.Element;
106
+ type NavigationMenuContentProps = Omit<NavigationMenu$1.Content.Props, 'className'> & {
107
+ className?: string;
108
+ };
109
+ /**
110
+ * The panel for one item. Authored inline next to its Trigger, but rendered
111
+ * (teleported by Base UI) into the shared root-level Viewport while active —
112
+ * so panel-to-panel switches cross-fade inside one popup surface.
113
+ *
114
+ * The directional slide keys off `data-activation-direction` (which adjacent
115
+ * trigger the user came from), matching the app source's from-start/from-end
116
+ * motion. Set `keepMounted` to keep the panel in the DOM for SSR crawlers.
117
+ */
118
+ declare function NavigationMenuContent({ className, ...props }: NavigationMenuContentProps): React.JSX.Element;
119
+ type NavigationMenuLinkProps = Omit<NavigationMenu$1.Link.Props, 'className' | 'render' | 'href'> & {
120
+ className?: string;
121
+ /**
122
+ * Link target. Accepts the same string-or-UrlObject union as `Link`, since
123
+ * the rendered element may be a framework link injected via `LinkProvider`.
124
+ */
125
+ href: LinkProps['href'];
126
+ };
127
+ /**
128
+ * A navigation link inside (or beside) the menu. Composes the design system's
129
+ * `Link` through Base UI's `render` prop: Base UI keeps the behaviour —
130
+ * roving focus, focus-out closing, `aria-current='page'` when `active`, close
131
+ * on click — while `Link` supplies the element, so a `LinkProvider` framework
132
+ * component (e.g. next/link) is injected automatically. `Link` renders with
133
+ * `variant='unstyled'`; this component owns the visual treatment (same ink
134
+ * halo/outline contract as the trigger — see `navigationMenuTriggerVariants`).
135
+ *
136
+ * Departure from Base UI's default: `closeOnClick` defaults to **true** here.
137
+ * In an SPA a client-side navigation doesn't reload the document, so a menu
138
+ * that stays open after choosing a destination reads as broken; pass
139
+ * `closeOnClick={false}` for in-page links that should keep the panel open.
140
+ *
141
+ * Set `active` for the current page (the app source's `usePathname` check is
142
+ * a framework API this package must not import — compare in the consumer and
143
+ * pass the result down): it sets `aria-current='page'` (WCAG 2.4.8 support)
144
+ * and the persistent halo via `data-active`.
145
+ */
146
+ declare function NavigationMenuLink({ className, href, closeOnClick, ...props }: NavigationMenuLinkProps): React.JSX.Element;
147
+
148
+ export { NavigationMenu, NavigationMenuContent, type NavigationMenuContentProps, NavigationMenuItem, type NavigationMenuItemProps, NavigationMenuLink, type NavigationMenuLinkProps, NavigationMenuList, type NavigationMenuListProps, type NavigationMenuProps, NavigationMenuTrigger, type NavigationMenuTriggerProps, navigationMenuTriggerVariants };