@nswds/ui 4.2.0 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/expandable-search.d.ts +119 -0
- package/dist/components/expandable-search.js +252 -0
- package/dist/components/expandable-search.js.map +1 -0
- package/dist/components/header.d.ts +147 -0
- package/dist/components/header.js +221 -0
- package/dist/components/header.js.map +1 -0
- package/dist/components/main-nav.d.ts +144 -0
- package/dist/components/main-nav.js +366 -0
- package/dist/components/main-nav.js.map +1 -0
- package/dist/components/navigation-menu.d.ts +148 -0
- package/dist/components/navigation-menu.js +205 -0
- package/dist/components/navigation-menu.js.map +1 -0
- package/dist/components/push-menu.d.ts +149 -0
- package/dist/components/push-menu.js +357 -0
- package/dist/components/push-menu.js.map +1 -0
- package/dist/components/side-nav.d.ts +116 -0
- package/dist/components/side-nav.js +180 -0
- package/dist/components/side-nav.js.map +1 -0
- package/dist/components/site-search.d.ts +115 -0
- package/dist/components/site-search.js +204 -0
- package/dist/components/site-search.js.map +1 -0
- package/dist/components/step-indicator.d.ts +160 -0
- package/dist/components/step-indicator.js +260 -0
- package/dist/components/step-indicator.js.map +1 -0
- package/dist/components/theme-switcher.d.ts +70 -0
- package/dist/components/theme-switcher.js +52 -0
- package/dist/components/theme-switcher.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +8 -0
- package/dist/styles.css +1 -1
- package/package.json +6 -5
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { NavigationMenu as NavigationMenu$1 } from '@base-ui/react/navigation-menu';
|
|
4
|
+
import { cva } from 'class-variance-authority';
|
|
5
|
+
import { IconKeyboardArrowDown } from '../icons/keyboard-arrow-down.js';
|
|
6
|
+
import { cn } from '../lib/utils.js';
|
|
7
|
+
import { Link } from '../components/link.js';
|
|
8
|
+
|
|
9
|
+
const navigationMenuInk = [
|
|
10
|
+
"[--nav-menu-ink:var(--primary-800)] dark:[--nav-menu-ink:var(--primary-200)]",
|
|
11
|
+
"[--nav-menu-halo:color-mix(in_oklch,var(--nav-menu-ink)_10%,transparent)]",
|
|
12
|
+
"[--nav-menu-halo-active:color-mix(in_oklch,var(--nav-menu-ink)_18%,transparent)]"
|
|
13
|
+
];
|
|
14
|
+
const navigationMenuTriggerVariants = cva([
|
|
15
|
+
...navigationMenuInk,
|
|
16
|
+
// Layout — h-9 keeps the row compact; the halo box is the pointer target.
|
|
17
|
+
// mb-2 pairs with the list's bottom hairline, matching the app source.
|
|
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
|
+
"bg-transparent text-foreground",
|
|
20
|
+
"transition-colors motion-reduce:transition-none",
|
|
21
|
+
// Resting halo on hover/focus/open. `focus:` (not focus-visible) is
|
|
22
|
+
// deliberate for the tint — like Button, triggers give click feedback —
|
|
23
|
+
// while the *outline* below stays keyboard-only.
|
|
24
|
+
"hover:bg-(--nav-menu-halo) focus:bg-(--nav-menu-halo) active:bg-(--nav-menu-halo-active)",
|
|
25
|
+
// Base UI marks the trigger whose popup is open with data-popup-open.
|
|
26
|
+
"data-popup-open:bg-(--nav-menu-halo)",
|
|
27
|
+
"outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--nav-menu-ink)",
|
|
28
|
+
"disabled:pointer-events-none disabled:opacity-50"
|
|
29
|
+
]);
|
|
30
|
+
function NavigationMenu({
|
|
31
|
+
className,
|
|
32
|
+
children,
|
|
33
|
+
side,
|
|
34
|
+
sideOffset = 8,
|
|
35
|
+
align,
|
|
36
|
+
alignOffset,
|
|
37
|
+
// Keep a gutter between the popup and the viewport edge on small screens.
|
|
38
|
+
collisionPadding = 20,
|
|
39
|
+
// Nav panels should never flip beside their menubar — cap size instead.
|
|
40
|
+
collisionAvoidance = { side: "none" },
|
|
41
|
+
popupClassName,
|
|
42
|
+
popupStyle,
|
|
43
|
+
...props
|
|
44
|
+
}) {
|
|
45
|
+
return /* @__PURE__ */ jsxs(
|
|
46
|
+
NavigationMenu$1.Root,
|
|
47
|
+
{
|
|
48
|
+
"data-slot": "navigation-menu",
|
|
49
|
+
className: cn(
|
|
50
|
+
"group/navigation-menu relative flex max-w-max flex-1 items-center justify-center",
|
|
51
|
+
className
|
|
52
|
+
),
|
|
53
|
+
...props,
|
|
54
|
+
children: [
|
|
55
|
+
children,
|
|
56
|
+
/* @__PURE__ */ jsx(NavigationMenu$1.Portal, { children: /* @__PURE__ */ jsx(
|
|
57
|
+
NavigationMenu$1.Positioner,
|
|
58
|
+
{
|
|
59
|
+
"data-slot": "navigation-menu-positioner",
|
|
60
|
+
side,
|
|
61
|
+
sideOffset,
|
|
62
|
+
align,
|
|
63
|
+
alignOffset,
|
|
64
|
+
collisionPadding,
|
|
65
|
+
collisionAvoidance,
|
|
66
|
+
className: cn(
|
|
67
|
+
// Base UI reports its measured geometry through these vars; sizing
|
|
68
|
+
// the box from them lets top/left glide between triggers.
|
|
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)]",
|
|
71
|
+
// data-instant: Base UI disables the glide (e.g. keyboard re-anchor).
|
|
72
|
+
"data-instant:transition-none motion-reduce:transition-none"
|
|
73
|
+
),
|
|
74
|
+
children: /* @__PURE__ */ jsx(
|
|
75
|
+
NavigationMenu$1.Popup,
|
|
76
|
+
{
|
|
77
|
+
"data-slot": "navigation-menu-popup",
|
|
78
|
+
className: cn(
|
|
79
|
+
// House popup surface (see popover.tsx / sheet.tsx).
|
|
80
|
+
"relative rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10",
|
|
81
|
+
// Width/height track the active Content's size (Base UI measures
|
|
82
|
+
// it into --popup-*), so switching sections morphs the surface
|
|
83
|
+
// instead of jump-cutting.
|
|
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",
|
|
86
|
+
// Open/close via Base UI transition attributes.
|
|
87
|
+
"data-starting-style:scale-95 data-starting-style:opacity-0",
|
|
88
|
+
"data-ending-style:scale-95 data-ending-style:opacity-0",
|
|
89
|
+
popupClassName
|
|
90
|
+
),
|
|
91
|
+
style: popupStyle,
|
|
92
|
+
children: /* @__PURE__ */ jsx(
|
|
93
|
+
NavigationMenu$1.Viewport,
|
|
94
|
+
{
|
|
95
|
+
"data-slot": "navigation-menu-viewport",
|
|
96
|
+
className: "relative size-full overflow-hidden rounded-lg"
|
|
97
|
+
}
|
|
98
|
+
)
|
|
99
|
+
}
|
|
100
|
+
)
|
|
101
|
+
}
|
|
102
|
+
) })
|
|
103
|
+
]
|
|
104
|
+
}
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
function NavigationMenuList({ className, ...props }) {
|
|
108
|
+
return /* @__PURE__ */ jsx(
|
|
109
|
+
NavigationMenu$1.List,
|
|
110
|
+
{
|
|
111
|
+
"data-slot": "navigation-menu-list",
|
|
112
|
+
className: cn(
|
|
113
|
+
"group flex flex-1 list-none items-center justify-center gap-1",
|
|
114
|
+
"[scrollbar-width:none] border-b border-border whitespace-nowrap [&::-webkit-scrollbar]:hidden",
|
|
115
|
+
className
|
|
116
|
+
),
|
|
117
|
+
...props
|
|
118
|
+
}
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
function NavigationMenuItem({ className, ...props }) {
|
|
122
|
+
return /* @__PURE__ */ jsx(
|
|
123
|
+
NavigationMenu$1.Item,
|
|
124
|
+
{
|
|
125
|
+
"data-slot": "navigation-menu-item",
|
|
126
|
+
className: cn("relative", className),
|
|
127
|
+
...props
|
|
128
|
+
}
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
function NavigationMenuTrigger({ className, children, ...props }) {
|
|
132
|
+
return /* @__PURE__ */ jsxs(
|
|
133
|
+
NavigationMenu$1.Trigger,
|
|
134
|
+
{
|
|
135
|
+
"data-slot": "navigation-menu-trigger",
|
|
136
|
+
className: cn(navigationMenuTriggerVariants(), className),
|
|
137
|
+
...props,
|
|
138
|
+
children: [
|
|
139
|
+
children,
|
|
140
|
+
/* @__PURE__ */ jsx(
|
|
141
|
+
NavigationMenu$1.Icon,
|
|
142
|
+
{
|
|
143
|
+
"data-slot": "navigation-menu-icon",
|
|
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",
|
|
146
|
+
children: /* @__PURE__ */ jsx(IconKeyboardArrowDown, { className: "size-5" })
|
|
147
|
+
}
|
|
148
|
+
)
|
|
149
|
+
]
|
|
150
|
+
}
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
function NavigationMenuContent({ className, ...props }) {
|
|
154
|
+
return /* @__PURE__ */ jsx(
|
|
155
|
+
NavigationMenu$1.Content,
|
|
156
|
+
{
|
|
157
|
+
"data-slot": "navigation-menu-content",
|
|
158
|
+
className: cn(
|
|
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",
|
|
161
|
+
"data-ending-style:opacity-0 data-starting-style:opacity-0",
|
|
162
|
+
// Slide with the direction of travel between adjacent triggers.
|
|
163
|
+
"data-starting-style:data-[activation-direction=left]:-translate-x-1/2",
|
|
164
|
+
"data-starting-style:data-[activation-direction=right]:translate-x-1/2",
|
|
165
|
+
"data-ending-style:data-[activation-direction=left]:translate-x-1/2",
|
|
166
|
+
"data-ending-style:data-[activation-direction=right]:-translate-x-1/2",
|
|
167
|
+
className
|
|
168
|
+
),
|
|
169
|
+
...props
|
|
170
|
+
}
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
function NavigationMenuLink({
|
|
174
|
+
className,
|
|
175
|
+
href,
|
|
176
|
+
closeOnClick = true,
|
|
177
|
+
...props
|
|
178
|
+
}) {
|
|
179
|
+
return /* @__PURE__ */ jsx(
|
|
180
|
+
NavigationMenu$1.Link,
|
|
181
|
+
{
|
|
182
|
+
"data-slot": "navigation-menu-link",
|
|
183
|
+
closeOnClick,
|
|
184
|
+
className: cn(
|
|
185
|
+
navigationMenuInk,
|
|
186
|
+
"flex flex-col gap-1 rounded-sm p-2 text-sm text-foreground",
|
|
187
|
+
"transition-colors motion-reduce:transition-none",
|
|
188
|
+
"hover:bg-(--nav-menu-halo) focus:bg-(--nav-menu-halo) active:bg-(--nav-menu-halo-active)",
|
|
189
|
+
// Persistent tint for the current page (`active` prop → data-active).
|
|
190
|
+
"data-active:bg-(--nav-menu-halo)",
|
|
191
|
+
"outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--nav-menu-ink)",
|
|
192
|
+
// Unsized inline icons default to text scale and muted ink; explicit
|
|
193
|
+
// size-*/text-* classes on the icon win.
|
|
194
|
+
"[&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",
|
|
195
|
+
className
|
|
196
|
+
),
|
|
197
|
+
render: /* @__PURE__ */ jsx(Link, { variant: "unstyled", href }),
|
|
198
|
+
...props
|
|
199
|
+
}
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export { NavigationMenu, NavigationMenuContent, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, navigationMenuTriggerVariants };
|
|
204
|
+
//# sourceMappingURL=navigation-menu.js.map
|
|
205
|
+
//# sourceMappingURL=navigation-menu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/navigation-menu.tsx"],"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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 '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"]}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Default slide duration for level transitions, in milliseconds — the default
|
|
5
|
+
* of the `durationMs` prop.
|
|
6
|
+
*
|
|
7
|
+
* COUPLING: `durationMs` drives BOTH the `--push-menu-duration` custom
|
|
8
|
+
* property (set inline on the root, read by the CSS transition) and the state
|
|
9
|
+
* machine's `setTimeout`s (which settle the animation state, pop levels, and
|
|
10
|
+
* schedule focus restoration). Do not override the custom property directly —
|
|
11
|
+
* that changes only the visual duration while the state machine still settles
|
|
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.
|
|
16
|
+
*/
|
|
17
|
+
declare const PUSH_MENU_DURATION_MS = 300;
|
|
18
|
+
/** A node in the menu tree. Items with `links` drill in; items with `href` navigate. */
|
|
19
|
+
type PushMenuItem = {
|
|
20
|
+
/** Unique across the whole tree — level ids and focus restoration track items by id. */
|
|
21
|
+
id: string;
|
|
22
|
+
/** Visible label. */
|
|
23
|
+
title: string;
|
|
24
|
+
/** Navigation target for leaf items. Ignored for drilling when `links` is non-empty. */
|
|
25
|
+
href?: string;
|
|
26
|
+
/** Child items. A non-empty array makes this item a drill-in button, not a link. */
|
|
27
|
+
links?: PushMenuItem[];
|
|
28
|
+
};
|
|
29
|
+
/** One entry in the level stack — the root level plus one per drill-in. */
|
|
30
|
+
type PushMenuLevel = {
|
|
31
|
+
id: string;
|
|
32
|
+
title: string;
|
|
33
|
+
/** 1 for the root level, incrementing per drill-in. */
|
|
34
|
+
depth: number;
|
|
35
|
+
items: PushMenuItem[];
|
|
36
|
+
/** The item whose activation opened this level. Absent on the root level. */
|
|
37
|
+
parentItem?: PushMenuItem;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Collapses a trail of level titles into a single "A › B › C" string, keeping
|
|
41
|
+
* the ends and eliding the middle once it outgrows `maxLength`. Exported so an
|
|
42
|
+
* app can render the same trail outside the menu (e.g. in a sheet header).
|
|
43
|
+
* Prefixed with "PushMenu" to avoid colliding with a future breadcrumb
|
|
44
|
+
* component in the package barrel.
|
|
45
|
+
*/
|
|
46
|
+
declare function generatePushMenuBreadcrumb(levels: {
|
|
47
|
+
title: string;
|
|
48
|
+
}[], maxLength?: number): string;
|
|
49
|
+
type PushMenuProps = Omit<React__default.ComponentPropsWithoutRef<'nav'>, 'children' | 'title'> & {
|
|
50
|
+
/** The menu tree. Item ids must be unique across the whole tree. */
|
|
51
|
+
navigation: PushMenuItem[];
|
|
52
|
+
/**
|
|
53
|
+
* The app's current pathname. Leaf links whose `href` matches get
|
|
54
|
+
* `aria-current="page"` and the active treatment. Replaces the nswds-app
|
|
55
|
+
* source's `usePathname()` — the design system is framework-free, so the
|
|
56
|
+
* router value is passed in rather than read from next/navigation.
|
|
57
|
+
*/
|
|
58
|
+
currentHref?: string;
|
|
59
|
+
/** Root level title, shown in the header row. Also the default `aria-label`. */
|
|
60
|
+
title?: string;
|
|
61
|
+
/** Fired when a leaf item (link or child-less button) is activated. */
|
|
62
|
+
onItemClick?: (item: PushMenuItem) => void;
|
|
63
|
+
/** Fired after a forward/back slide settles on a level. */
|
|
64
|
+
onNavigate?: (level: PushMenuLevel, history: PushMenuLevel[]) => void;
|
|
65
|
+
/**
|
|
66
|
+
* Renders a close button in the header row when provided. Unlike the
|
|
67
|
+
* nswds-app source — which only offered close on sub-levels, leaving the
|
|
68
|
+
* root level uncloseable — the button renders on every level.
|
|
69
|
+
*/
|
|
70
|
+
onClose?: () => void;
|
|
71
|
+
/** Show the "A › B › C" trail under the header on sub-levels. Defaults to `true`. */
|
|
72
|
+
showBreadcrumbs?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Slide duration in milliseconds, defaulting to `PUSH_MENU_DURATION_MS`
|
|
75
|
+
* (300). Drives both the `--push-menu-duration` custom property and the
|
|
76
|
+
* state machine's timeouts — tune the slide here, never by overriding the
|
|
77
|
+
* custom property (see the coupling note on the constant).
|
|
78
|
+
*/
|
|
79
|
+
durationMs?: number;
|
|
80
|
+
/** Label for the Back button on sub-levels. Defaults to `'Back'`. */
|
|
81
|
+
backLabel?: string;
|
|
82
|
+
/** Accessible label for the close button. Defaults to `'Close menu'`. */
|
|
83
|
+
closeLabel?: string;
|
|
84
|
+
/**
|
|
85
|
+
* Heading level for the per-level title, following `FooterNavColumn`'s
|
|
86
|
+
* precedent (the nswds-app source used a `Heading` component this package
|
|
87
|
+
* does not ship). Defaults to `2`; `1` is excluded because a menu panel
|
|
88
|
+
* title is never the page's own title.
|
|
89
|
+
*/
|
|
90
|
+
headingLevel?: 2 | 3 | 4 | 5 | 6;
|
|
91
|
+
ref?: React__default.Ref<HTMLElement>;
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Multi-level slide-in-place drill-down menu ("push menu") for mobile
|
|
95
|
+
* navigation, ported from nswds-app's `MultiLevelPushMenu`. Items with
|
|
96
|
+
* children render as buttons that slide a new level in from the right; leaf
|
|
97
|
+
* items render as links through `Link`, so apps can inject their framework
|
|
98
|
+
* link component via `LinkProvider`. Fill height from its container — compose
|
|
99
|
+
* it inside `SheetContent side="left"` for the classic mobile drawer.
|
|
100
|
+
*
|
|
101
|
+
* Accessibility contract (all improvements over the nswds-app source, which
|
|
102
|
+
* got several of these wrong):
|
|
103
|
+
*
|
|
104
|
+
* - The root is a `nav` landmark named by `title` (override with `aria-label`).
|
|
105
|
+
* - Non-current levels carry the `inert` attribute, so a hidden level's links
|
|
106
|
+
* are neither tabbable nor exposed to assistive tech. The app left every
|
|
107
|
+
* mounted level in the tab order, letting keyboard users tab into invisible
|
|
108
|
+
* history levels (WCAG 2.2, 2.4.3 Focus Order).
|
|
109
|
+
* - Focus moves with the level change (2.4.3): drilling forward focuses the
|
|
110
|
+
* new level's Back button; going back focuses the item that opened the
|
|
111
|
+
* level just left, tracked by item id and restored after the slide settles.
|
|
112
|
+
* Without this, `inert` on the old level would silently drop focus to
|
|
113
|
+
* `<body>`. The Back button is the only route back (the breadcrumb is
|
|
114
|
+
* decorative), so it always renders on sub-levels — hiding it would make
|
|
115
|
+
* drill-down one-way.
|
|
116
|
+
* - A single visually-hidden `aria-live="polite"` region at the root announces
|
|
117
|
+
* the current level's title, suffixed with the level number below the root.
|
|
118
|
+
* A live attribute on the per-level headings would not work: each level's
|
|
119
|
+
* heading is freshly mounted, and newly-mounted live regions are not
|
|
120
|
+
* reliably announced.
|
|
121
|
+
* - Level lists are `<ul role="list">` — `list-style: none` strips list
|
|
122
|
+
* semantics in some screen reader/browser pairings (notably VoiceOver), and
|
|
123
|
+
* the explicit role restores them.
|
|
124
|
+
* - Every row is at least 44px tall (2.5.8 Target Size); Back/close buttons
|
|
125
|
+
* inherit `Button`'s 44px touch target.
|
|
126
|
+
* - During the slide, rows get `pointer-events-none` and the state machine
|
|
127
|
+
* ignores re-entrant navigation, but nothing is ever `disabled` — disabling
|
|
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).
|
|
131
|
+
*
|
|
132
|
+
* Departures from the nswds-app source, beyond the above:
|
|
133
|
+
*
|
|
134
|
+
* - The footer/stats block (Level N, item counts, progress dots, lucide
|
|
135
|
+
* icons) is cut, along with its `showStats`/`showFooter` props: it was demo
|
|
136
|
+
* chrome for the sandbox, not part of a navigation component's job. The
|
|
137
|
+
* breadcrumb trail it hosted moves under the header row.
|
|
138
|
+
* - The rendered "Navigation Error" fallback for malformed data is replaced
|
|
139
|
+
* by a dev-only console warning (`warnIfNavigationMalformed`), mirroring
|
|
140
|
+
* button.tsx's `warnIfIconButtonUnlabelled`.
|
|
141
|
+
* - The breadcrumb trail is `aria-hidden`: it repeats what the heading and
|
|
142
|
+
* live region already announce, and "›" separators read poorly in AT.
|
|
143
|
+
*
|
|
144
|
+
* The level stack is seeded from `navigation`/`title` on mount; pass a `key`
|
|
145
|
+
* to remount (and reset to the root level) if either changes at runtime.
|
|
146
|
+
*/
|
|
147
|
+
declare function PushMenu({ navigation, currentHref, title, onItemClick, onNavigate, onClose, showBreadcrumbs, durationMs, backLabel, closeLabel, headingLevel, className, style, 'aria-label': ariaLabel, ref, ...props }: PushMenuProps): React__default.JSX.Element | null;
|
|
148
|
+
|
|
149
|
+
export { PUSH_MENU_DURATION_MS, PushMenu, type PushMenuItem, type PushMenuLevel, type PushMenuProps, generatePushMenuBreadcrumb };
|