@nswds/ui 4.7.0 → 4.7.2
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/README.md +23 -4
- package/dist/components/badge.d.ts +1 -1
- package/dist/components/badge.js +1 -1
- package/dist/components/badge.js.map +1 -1
- package/dist/components/button.d.ts +3 -3
- package/dist/components/button.js +1 -1
- package/dist/components/button.js.map +1 -1
- package/dist/components/expandable-search.js +2 -2
- package/dist/components/expandable-search.js.map +1 -1
- package/dist/components/field.js +1 -1
- package/dist/components/field.js.map +1 -1
- package/dist/components/footer.js +11 -8
- package/dist/components/footer.js.map +1 -1
- package/dist/components/header.d.ts +1 -1
- package/dist/components/header.js +9 -6
- package/dist/components/header.js.map +1 -1
- package/dist/components/input.js +1 -1
- package/dist/components/input.js.map +1 -1
- package/dist/components/link.d.ts +1 -1
- package/dist/components/link.js +1 -1
- package/dist/components/link.js.map +1 -1
- package/dist/components/main-nav.js +4 -4
- package/dist/components/main-nav.js.map +1 -1
- package/dist/components/masthead.d.ts +1 -1
- package/dist/components/navigation-menu.js +7 -7
- package/dist/components/navigation-menu.js.map +1 -1
- package/dist/components/push-menu.d.ts +5 -5
- package/dist/components/push-menu.js +2 -2
- package/dist/components/push-menu.js.map +1 -1
- package/dist/components/side-nav.js +5 -5
- package/dist/components/side-nav.js.map +1 -1
- package/dist/components/site-search.js +2 -2
- package/dist/components/site-search.js.map +1 -1
- package/dist/components/skip-link.d.ts +1 -1
- package/dist/components/skip-link.js +1 -1
- package/dist/components/skip-link.js.map +1 -1
- package/dist/components/spinner.js +1 -1
- package/dist/components/spinner.js.map +1 -1
- package/dist/components/step-indicator.js +5 -5
- package/dist/components/step-indicator.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +3 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/expandable-search.tsx"],"names":[],"mappings":";;;;;;AAgCA,MAAM,wBAAA,GAA2B,GAAA;AAAA,EAC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J;AAAA,SACF;AAAA,QACA;AAAA;AAAA,KACF;AAAA,oBAEA,GAAA;AAAA,MAAC,QAAA;AAAA,MAAA;AAAA,QACC,WAAA,EAAU,0BAAA;AAAA,QACV,cAAY,eAAA,IAAmB,WAAA;AAAA,QAC9B,GAAG,eAAA;AAAA,QACJ,IAAA,EAAK,QAAA;AAAA,QACL,SAAA,EAAW,EAAA;AAAA,UACT,sEAAA;AAAA,UACA,qFAAA;AAAA;AAAA;AAAA;AAAA,UAIA,qBAAA;AAAA,UACA,wGAAA;AAAA,UACA,oBAAA;AAAA;AAAA,UAEA,WAAW,qBAAA,GAAwB,qBAAA;AAAA,UACnC;AAAA,SACF;AAAA,QAEC,4CACC,GAAA,CAAC,UAAA,EAAA,EAAW,aAAA,EAAY,MAAA,EAAO,WAAU,2CAAA,EAA4C;AAAA;AAAA;AAEzF,GAAA,EACF,CAAA;AAEJ","file":"expandable-search.js","sourcesContent":["'use client'\n\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport React from 'react'\n\nimport { cn } from '../lib/utils.js'\n\nimport { IconSearch } from '../icons/search.js'\n\n/**\n * Surface colours the search can be themed with — the footer's thirteen-name\n * vocabulary (see `footerColors` in footer.tsx) plus `default`, the nswds-app\n * grey-100 chip that headers embed on a white surface.\n *\n * Every derived colour resolves from a single `--search-ink` token, so a\n * variant only declares its surface utilities and that one value. This map\n * replaces the FOUR parallel 14-entry cva tables in the nswds-app source\n * (surface / collapsed / button / focus): each of those tables was a manual\n * projection of the same underlying ink, so they are collapsed into the\n * derivations below.\n *\n * The derivations are written literally here (once) rather than per-variant:\n * Tailwind scans source text for class names, so a template-built arbitrary\n * property would never be emitted. Mirrors footer.tsx (`--footer-*`) and\n * link.tsx (`--link-halo`).\n *\n * Expanded text/surface pairs are the ones verified for footer.tsx: every\n * light pair clears WCAG 2.2 AA (1.4.3, 4.5:1) — the worst are `primary-600`\n * (4.57:1) and `accent-600` (5.18:1) — and in dark mode all clear AAA (worst\n * 13.6:1). The collapsed chip renders no text, only the icon, which paints in\n * the same ink.\n */\nconst expandableSearchVariants = cva(\n [\n // `group/search` is named so the submit button's group-focus-within hook\n // can't collide with an ancestor's bare `group` (e.g. inside a card).\n 'group/search relative inline-block rounded-sm select-none',\n // Halo for the submit button's hover / the form's focus-within state, a\n // heavier press halo, and the placeholder colour — all mixed down from\n // the ink. 70% ink keeps the placeholder related to but visibly lighter\n // than the entered text (the source used grey-700 / current at 70%\n // opacity). Dilution costs contrast, though, so the percentage routes\n // through --search-placeholder-pct and the surfaces whose 70% composite\n // fails 1.4.3 raise it to 100% in the variant map below. Verified by\n // alpha-compositing the mix over each surface (light mode): at 70%\n // primary-600 is 3.0:1, accent-600 3.1:1 and accent-400 4.48:1 — all\n // AA failures, cured by full ink (4.57 / 5.18 / 8.34:1). The eleven\n // surfaces that keep 70% all clear 4.5:1, the closest being\n // primary-400 (4.57:1) and grey-400 (4.58:1); dark mode's worst 70%\n // composite is 7.0:1.\n '[--search-halo:color-mix(in_oklch,var(--search-ink)_10%,transparent)]',\n '[--search-halo-active:color-mix(in_oklch,var(--search-ink)_18%,transparent)]',\n '[--search-placeholder:color-mix(in_oklch,var(--search-ink)_var(--search-placeholder-pct,70%),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` below is a real utility, so that\n // key is always emitted.) Same reasoning as footer.tsx and header.tsx.\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 — per\n // footer.tsx's family mapping, and `default` follows header.tsx's\n // `light` surface: grey-100→grey-850. Ink goes white on all fourteen.\n //\n // primary-600, accent-600 and accent-400 set --search-placeholder-pct\n // to 100%: their 70% placeholder composite fails AA (3.0 / 3.1 /\n // 4.48:1 — see the derivation comment above), so the placeholder\n // renders full ink there. The override is deliberately not\n // dark-scoped: every dark 70% composite clears 7:1, so 100% in dark\n // is merely a slightly stronger placeholder, not worth a second\n // declaration.\n //\n // `default` is the one variant whose ink is NOT its text colour: the\n // nswds-app chip pairs grey-800 entered text with a primary-blue icon\n // and primary-800/10 halos. Declaring ink as primary-800 reproduces the\n // icon and halos exactly; the text colour is a surface utility, so it\n // stays grey-800. (Side effect, documented: the placeholder mixes from\n // primary-800 instead of the source's grey-700 — a subtle blue shift.)\n variant: {\n default:\n 'bg-grey-100 text-grey-800 [--search-ink:var(--primary-800)] dark:bg-grey-850 dark:text-white dark:[--search-ink:var(--color-white)]',\n 'primary-800':\n 'bg-primary-800 text-white [--search-ink:var(--color-white)] dark:bg-primary-950',\n 'primary-600':\n 'bg-primary-600 text-white [--search-ink:var(--color-white)] [--search-placeholder-pct:100%] dark:bg-primary-900',\n 'primary-400':\n 'bg-primary-400 text-primary-800 [--search-ink:var(--primary-800)] dark:bg-primary-850 dark:text-white dark:[--search-ink:var(--color-white)]',\n 'primary-200':\n 'bg-primary-200 text-primary-800 [--search-ink:var(--primary-800)] dark:bg-primary-800 dark:text-white dark:[--search-ink:var(--color-white)]',\n 'grey-800': 'bg-grey-800 text-white [--search-ink:var(--color-white)] dark:bg-grey-950',\n 'grey-600': 'bg-grey-600 text-white [--search-ink:var(--color-white)] dark:bg-grey-900',\n 'grey-400':\n 'bg-grey-400 text-grey-800 [--search-ink:var(--grey-800)] dark:bg-grey-850 dark:text-white dark:[--search-ink:var(--color-white)]',\n 'grey-200':\n 'bg-grey-200 text-grey-800 [--search-ink:var(--grey-800)] dark:bg-grey-800 dark:text-white dark:[--search-ink:var(--color-white)]',\n 'accent-800':\n 'bg-accent-800 text-white [--search-ink:var(--color-white)] dark:bg-accent-950',\n 'accent-600':\n 'bg-accent-600 text-white [--search-ink:var(--color-white)] [--search-placeholder-pct:100%] dark:bg-accent-900',\n 'accent-400':\n 'bg-accent-400 text-accent-800 [--search-ink:var(--accent-800)] [--search-placeholder-pct:100%] dark:bg-accent-850 dark:text-white dark:[--search-ink:var(--color-white)]',\n 'accent-200':\n 'bg-accent-200 text-accent-800 [--search-ink:var(--accent-800)] dark:bg-accent-800 dark:text-white dark:[--search-ink:var(--color-white)]',\n white:\n 'bg-white text-grey-800 [--search-ink:var(--grey-800)] dark:bg-grey-900 dark:text-white dark:[--search-ink:var(--color-white)]',\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n },\n)\n\ntype ExpandableSearchVariant = NonNullable<VariantProps<typeof expandableSearchVariants>['variant']>\n\n// One focus treatment for the input and the submit button, INSET rather than\n// the source's offset ring. The source ringed each variant in its own surface\n// colour with a hardcoded white offset — on the default chip that was\n// ring-grey-100 around a grey-100 chip on a white page: effectively invisible\n// (a 2.4.7 Focus Visible / 2.4.13 Focus Appearance failure). An outward\n// indicator can only guarantee contrast against the page, which this component\n// cannot know; the ink is guaranteed to contrast with the surface (that is its\n// whole job), so the indicator is drawn 2px INSIDE the chip in ink, where the\n// contrast maths always holds.\nconst searchFocusClassName =\n 'focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-(--search-ink)'\n\ntype ExpandableSearchContextValue = {\n value: string\n setValue: (value: string) => void\n formHasFocusWithin: boolean\n variant: ExpandableSearchVariant\n}\n\nconst ExpandableSearchContext = React.createContext<ExpandableSearchContextValue | null>(null)\n\ntype ExpandableSearchProps = React.ComponentPropsWithoutRef<'form'> &\n VariantProps<typeof expandableSearchVariants> & {\n /**\n * Called with the current query when the form submits (Enter in the field\n * or a click on the search button). Not called if a supplied `onSubmit`\n * prevented the event's default.\n */\n onAction?: (value: string) => void\n /** Initial query. A non-empty value renders the field expanded. */\n defaultValue?: string\n ref?: React.Ref<HTMLFormElement>\n }\n\ntype ExpandableSearchButtonProps = Omit<React.ComponentPropsWithoutRef<'button'>, 'type'> & {\n [key: `data-${string}`]: string | number | boolean | undefined\n}\n\ntype ExpandableSearchFieldProps = Omit<\n React.ComponentPropsWithoutRef<'input'>,\n // `type` is pinned to `search`; `value`/`defaultValue` are owned by the\n // `ExpandableSearch` context (seed it via the root's `defaultValue` prop).\n 'type' | 'value' | 'defaultValue'\n> & {\n /**\n * Accessible name for the input, rendered as a visually-hidden `<label>`\n * and mirrored as `aria-label`. Defaults to `'Search'`.\n */\n label?: string\n /** Accessible name for the submit button. Defaults to `'Search'`. */\n buttonLabel?: string\n /** Extra props for the submit button (its `type` is pinned to `submit`). */\n buttonProps?: ExpandableSearchButtonProps\n ref?: React.Ref<HTMLInputElement>\n}\n\n/**\n * Dev-only guard, mirroring the icon-only Button check in button.tsx: with\n * `label=''` and no `aria-label` the input reaches assistive tech unnamed\n * (WCAG 2.2, 4.1.2 Name, Role, Value) — and this control leans on its name\n * more than most, since collapsed it looks like a plain icon button. No-op in\n * production.\n */\nfunction warnIfFieldUnlabelled(label: string | undefined, ariaLabel: string | undefined) {\n if (process.env.NODE_ENV === 'production') {\n return\n }\n if (!label && !ariaLabel) {\n console.warn(\n '[nswds/ui] ExpandableSearchField has no label — pass `label` or `aria-label` so the search input has an accessible name.',\n )\n }\n}\n\n/**\n * Site-search disclosure: a 48px search chip that expands into a text field\n * whenever it holds focus or a value, and submits the query to `onAction`.\n * Compose it as `<ExpandableSearch>` (the form root, owning the value and the\n * focus-within state) around one `<ExpandableSearchField>` (the input and its\n * submit button) — typically inside `HeaderActions`.\n *\n * Ported from nswds-app's `ExpandableSearch`. The mechanic is kept verbatim —\n * the collapsed control IS the text input, styled as a chip, so that the very\n * first focus or tap both reveals and focuses the field with no extra step.\n * Expansion is pure CSS keyed on the active state; no Base UI primitive is\n * used because none models this pattern (it is a styled form, not a popup —\n * focus never moves, nothing is portalled, nothing needs ARIA beyond the\n * label).\n *\n * Accessibility contract:\n * - The input carries a visually-hidden `<label>` and an `aria-label`\n * (default \"Search\"), and is `type='search'` with `enterKeyHint='search'`,\n * so its role and purpose are announced while it still looks like a button\n * (WCAG 2.2, 4.1.2; the source input was an unlabelled-by-type text input).\n * - Keyboard focus shows a 2px ink outline drawn inside the chip — the\n * source's ring was its own surface colour against a hardcoded white offset\n * and could vanish entirely (2.4.7, 2.4.13). See `searchFocusClassName`.\n * - Enter submits; Escape clears (native `type='search'` behaviour); an empty\n * blurred field collapses back to the chip.\n * - Expansion and halo transitions honour `prefers-reduced-motion` (2.3.3).\n *\n * Departures from the nswds-app source, beyond those above:\n * - React 19 `ref` prop instead of `forwardRef`.\n * - Four parallel 14-entry variant tables replaced by one ink-driven map —\n * see `expandableSearchVariants`.\n * - Expanded width `w-96` → `w-[min(24rem,80vw)]` so the field can never\n * overflow a small viewport (1.4.10 Reflow).\n * - The expanded state no longer sets `outline-none` (it would have killed\n * the new focus indicator; the source could afford it because its\n * indicator was a box-shadow ring).\n * - Expanded text selection uses `select-text`, not the source's\n * `select-auto` — `auto` computes from the root's `select-none` parent, so\n * the source's expanded field was unselectable.\n * - A consumer `onChange` on the field is chained after the context update\n * instead of replacing it (the source's spread order let it clobber the\n * controlled handler).\n *\n * The root deliberately does not claim `role='search'`: where the component\n * is the page's site search, add it yourself (one search landmark per page).\n */\nfunction ExpandableSearch({\n className,\n onAction,\n defaultValue = '',\n onSubmit,\n onFocusCapture,\n onBlurCapture,\n variant = 'default',\n ref,\n ...props\n}: ExpandableSearchProps) {\n const [value, setValue] = React.useState(defaultValue)\n const [formHasFocusWithin, setFormHasFocusWithin] = React.useState(false)\n const resolvedVariant: ExpandableSearchVariant = variant ?? 'default'\n const isActive = value.length > 0 || formHasFocusWithin\n\n const contextValue = React.useMemo(\n () => ({ value, setValue, formHasFocusWithin, variant: resolvedVariant }),\n [value, formHasFocusWithin, resolvedVariant],\n )\n\n const handleSubmit = (e: React.SubmitEvent<HTMLFormElement>) => {\n onSubmit?.(e)\n\n if (e.defaultPrevented) {\n return\n }\n\n e.preventDefault()\n onAction?.(value)\n }\n\n const handleFocusCapture = (e: React.FocusEvent<HTMLFormElement>) => {\n setFormHasFocusWithin(true)\n onFocusCapture?.(e)\n }\n\n const handleBlurCapture = (e: React.FocusEvent<HTMLFormElement>) => {\n const nextFocusedElement = e.relatedTarget as Node | null\n\n if (!e.currentTarget.contains(nextFocusedElement)) {\n setFormHasFocusWithin(false)\n }\n\n onBlurCapture?.(e)\n }\n\n return (\n <ExpandableSearchContext.Provider value={contextValue}>\n <form\n data-slot='expandable-search'\n data-variant={resolvedVariant}\n // Present-or-absent rather than \"true\"/\"false\", so it reads like Base\n // UI's data-* attributes and Tailwind's bare `data-expanded:` variant\n // works. Same convention as Header's data-scrolled.\n data-expanded={isActive || undefined}\n {...props}\n // The surface (and its ink) lives on the root so BOTH children — the\n // input and the absolutely-positioned submit button — inherit the\n // custom properties. The root shrink-wraps the input, so painting the\n // background here is visually identical to painting it on the input.\n className={cn(expandableSearchVariants({ variant }), className)}\n onBlurCapture={handleBlurCapture}\n onFocusCapture={handleFocusCapture}\n onSubmit={handleSubmit}\n ref={ref}\n />\n </ExpandableSearchContext.Provider>\n )\n}\n\n/**\n * The input and its submit button. Must be rendered inside `ExpandableSearch`,\n * which owns the value and the focus-within state.\n *\n * The submit button is `pointer-events-none` while collapsed — deliberately,\n * per the source: collapsed, the input overlays the exact same 48px square and\n * OWNS the click, so a tap lands on the input, focuses it, and expands the\n * field. Making the button clickable there would submit an empty query\n * instead of opening the field. It also never traps keyboard focus while\n * collapsed: the input precedes it in tab order, and focusing the input\n * expands the field before the button is reached.\n */\nfunction ExpandableSearchField({\n className,\n id,\n label = 'Search',\n 'aria-label': ariaLabel,\n autoComplete = 'off',\n enterKeyHint = 'search',\n onChange,\n buttonLabel = 'Search',\n buttonProps,\n ref,\n ...props\n}: ExpandableSearchFieldProps) {\n const context = React.useContext(ExpandableSearchContext)\n if (!context) throw new Error('ExpandableSearchField must be used within ExpandableSearch')\n\n const generatedId = React.useId()\n const {\n className: buttonClassName,\n children: buttonChildren,\n 'aria-label': buttonAriaLabel,\n ...restButtonProps\n } = buttonProps ?? {}\n\n const isActive = context.value.length > 0 || context.formHasFocusWithin\n const inputId = id ?? generatedId\n\n warnIfFieldUnlabelled(label, ariaLabel)\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n context.setValue(e.target.value)\n onChange?.(e)\n }\n\n return (\n <div data-slot='expandable-search-field' className='relative flex-1'>\n {label ? (\n // aria-label (below) wins for the accessible name where both exist;\n // the label element is kept for source parity and so a click on any\n // future visible rendering of it focuses the input.\n <label className='sr-only' htmlFor={inputId}>\n {label}\n </label>\n ) : null}\n\n <input\n data-slot='expandable-search-input'\n aria-label={ariaLabel ?? (label || undefined)}\n autoComplete={autoComplete}\n enterKeyHint={enterKeyHint}\n {...props}\n type='search'\n id={inputId}\n value={context.value}\n onChange={handleChange}\n className={cn(\n // Collapsed, the input is a 48px chip: transparent text and\n // placeholder so nothing peeks out, cursor-pointer because it acts\n // as the \"open search\" affordance. The background comes from the\n // form root, which shrink-wraps this element.\n 'flex h-12 w-12 cursor-pointer overflow-hidden rounded-sm border-0 bg-transparent text-transparent',\n 'placeholder:text-transparent placeholder:opacity-0',\n 'transition-[width,box-shadow,background-color] duration-300 ease-in-out motion-reduce:transition-none',\n // Hide WebKit's native clear affordance: the source field (type\n // text) had none, and Escape already clears a search input.\n '[&::-webkit-search-cancel-button]:appearance-none',\n searchFocusClassName,\n isActive\n ? // Expanded: capped at 80vw so the field cannot overflow small\n // viewports (the source's fixed w-96 could). pr-12 reserves the\n // submit button's square. select-text (not select-auto — see\n // the component JSDoc) re-enables selection under the root's\n // select-none.\n 'w-[min(24rem,80vw)] cursor-auto pt-0 pr-12 pb-0 pl-4 text-inherit select-text placeholder:text-(--search-placeholder) placeholder:opacity-100'\n : // Collapsed: the chip halos on hover exactly like the button\n // does — one visual whether the pointer technically rests on\n // the input overlay or not.\n 'p-0 hover:bg-(--search-halo)',\n className,\n )}\n ref={ref}\n />\n\n <button\n data-slot='expandable-search-button'\n aria-label={buttonAriaLabel ?? buttonLabel}\n {...restButtonProps}\n type='submit'\n className={cn(\n 'absolute top-0 right-0 z-10 flex h-12 w-12 cursor-pointer rounded-sm',\n 'transition-[background-color,box-shadow] duration-200 motion-reduce:transition-none',\n // Icon and halos all derive from the ink; the whole-form\n // focus-within halo marks the button as the pending action while\n // the user types.\n 'text-(--search-ink)',\n 'group-focus-within/search:bg-(--search-halo) hover:bg-(--search-halo) active:bg-(--search-halo-active)',\n searchFocusClassName,\n // Collapsed, the input overlay owns the click — see the JSDoc.\n isActive ? 'pointer-events-auto' : 'pointer-events-none',\n buttonClassName,\n )}\n >\n {buttonChildren ?? (\n <IconSearch aria-hidden='true' className='m-auto block size-8 shrink-0 fill-current' />\n )}\n </button>\n </div>\n )\n}\n\nexport { ExpandableSearch, ExpandableSearchField, expandableSearchVariants }\nexport type {\n ExpandableSearchButtonProps,\n ExpandableSearchFieldProps,\n ExpandableSearchProps,\n ExpandableSearchVariant,\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/expandable-search.tsx"],"names":[],"mappings":";;;;;;AAgCA,MAAM,wBAAA,GAA2B,GAAA;AAAA,EAC/B;AAAA;AAAA;AAAA,IAGE,2DAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAcA,uEAAA;AAAA,IACA,8EAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MA4BR,OAAA,EAAS;AAAA,QACP,OAAA,EACE,qIAAA;AAAA,QACF,aAAA,EACE,iFAAA;AAAA,QACF,aAAA,EACE,iHAAA;AAAA,QACF,aAAA,EACE,8IAAA;AAAA,QACF,aAAA,EACE,8IAAA;AAAA,QACF,UAAA,EAAY,2EAAA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js","sourcesContent":["'use client'\n\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport React from 'react'\n\nimport { cn } from '../lib/utils.js'\n\nimport { IconSearch } from '../icons/search.js'\n\n/**\n * Surface colours the search can be themed with — the footer's thirteen-name\n * vocabulary (see `footerColors` in footer.tsx) plus `default`, the nswds-app\n * grey-100 chip that headers embed on a white surface.\n *\n * Every derived colour resolves from a single `--search-ink` token, so a\n * variant only declares its surface utilities and that one value. This map\n * replaces the FOUR parallel 14-entry cva tables in the nswds-app source\n * (surface / collapsed / button / focus): each of those tables was a manual\n * projection of the same underlying ink, so they are collapsed into the\n * derivations below.\n *\n * The derivations are written literally here (once) rather than per-variant:\n * Tailwind scans source text for class names, so a template-built arbitrary\n * property would never be emitted. Mirrors footer.tsx (`--footer-*`) and\n * link.tsx (`--link-halo`).\n *\n * Expanded text/surface pairs are the ones verified for footer.tsx: every\n * light pair clears WCAG 2.2 AA (1.4.3, 4.5:1) — the worst are `primary-600`\n * (4.57:1) and `accent-600` (5.18:1) — and in dark mode all clear AAA (worst\n * 13.6:1). The collapsed chip renders no text, only the icon, which paints in\n * the same ink.\n */\nconst expandableSearchVariants = cva(\n [\n // `group/search` is named so the submit button's group-focus-within hook\n // can't collide with an ancestor's bare `group` (e.g. inside a card).\n 'group/search relative inline-block rounded-sm select-none',\n // Halo for the submit button's hover / the form's focus-within state, a\n // heavier press halo, and the placeholder colour — all mixed down from\n // the ink. 70% ink keeps the placeholder related to but visibly lighter\n // than the entered text (the source used grey-700 / current at 70%\n // opacity). Dilution costs contrast, though, so the percentage routes\n // through --search-placeholder-pct and the surfaces whose 70% composite\n // fails 1.4.3 raise it to 100% in the variant map below. Verified by\n // alpha-compositing the mix over each surface (light mode): at 70%\n // primary-600 is 3.0:1, accent-600 3.1:1 and accent-400 4.48:1 — all\n // AA failures, cured by full ink (4.57 / 5.18 / 8.34:1). The eleven\n // surfaces that keep 70% all clear 4.5:1, the closest being\n // primary-400 (4.57:1) and grey-400 (4.58:1); dark mode's worst 70%\n // composite is 7.0:1.\n '[--search-halo:color-mix(in_oklch,var(--search-ink)_10%,transparent)]',\n '[--search-halo-active:color-mix(in_oklch,var(--search-ink)_18%,transparent)]',\n '[--search-placeholder:color-mix(in_oklch,var(--search-ink)_var(--search-placeholder-pct,70%),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` below is a real utility, so that\n // key is always emitted.) Same reasoning as footer.tsx and header.tsx.\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 — per\n // footer.tsx's family mapping, and `default` follows header.tsx's\n // `light` surface: grey-100→grey-850. Ink goes white on all fourteen.\n //\n // primary-600, accent-600 and accent-400 set --search-placeholder-pct\n // to 100%: their 70% placeholder composite fails AA (3.0 / 3.1 /\n // 4.48:1 — see the derivation comment above), so the placeholder\n // renders full ink there. The override is deliberately not\n // dark-scoped: every dark 70% composite clears 7:1, so 100% in dark\n // is merely a slightly stronger placeholder, not worth a second\n // declaration.\n //\n // `default` is the one variant whose ink is NOT its text colour: the\n // nswds-app chip pairs grey-800 entered text with a primary-blue icon\n // and primary-800/10 halos. Declaring ink as primary-800 reproduces the\n // icon and halos exactly; the text colour is a surface utility, so it\n // stays grey-800. (Side effect, documented: the placeholder mixes from\n // primary-800 instead of the source's grey-700 — a subtle blue shift.)\n variant: {\n default:\n 'bg-grey-100 text-grey-800 [--search-ink:var(--primary-800)] dark:bg-grey-850 dark:text-white dark:[--search-ink:var(--color-white)]',\n 'primary-800':\n 'bg-primary-800 text-white [--search-ink:var(--color-white)] dark:bg-primary-950',\n 'primary-600':\n 'bg-primary-600 text-white [--search-ink:var(--color-white)] [--search-placeholder-pct:100%] dark:bg-primary-900',\n 'primary-400':\n 'bg-primary-400 text-primary-800 [--search-ink:var(--primary-800)] dark:bg-primary-850 dark:text-white dark:[--search-ink:var(--color-white)]',\n 'primary-200':\n 'bg-primary-200 text-primary-800 [--search-ink:var(--primary-800)] dark:bg-primary-800 dark:text-white dark:[--search-ink:var(--color-white)]',\n 'grey-800': 'bg-grey-800 text-white [--search-ink:var(--color-white)] dark:bg-grey-950',\n 'grey-600': 'bg-grey-600 text-white [--search-ink:var(--color-white)] dark:bg-grey-900',\n 'grey-400':\n 'bg-grey-400 text-grey-800 [--search-ink:var(--grey-800)] dark:bg-grey-850 dark:text-white dark:[--search-ink:var(--color-white)]',\n 'grey-200':\n 'bg-grey-200 text-grey-800 [--search-ink:var(--grey-800)] dark:bg-grey-800 dark:text-white dark:[--search-ink:var(--color-white)]',\n 'accent-800':\n 'bg-accent-800 text-white [--search-ink:var(--color-white)] dark:bg-accent-950',\n 'accent-600':\n 'bg-accent-600 text-white [--search-ink:var(--color-white)] [--search-placeholder-pct:100%] dark:bg-accent-900',\n 'accent-400':\n 'bg-accent-400 text-accent-800 [--search-ink:var(--accent-800)] [--search-placeholder-pct:100%] dark:bg-accent-850 dark:text-white dark:[--search-ink:var(--color-white)]',\n 'accent-200':\n 'bg-accent-200 text-accent-800 [--search-ink:var(--accent-800)] dark:bg-accent-800 dark:text-white dark:[--search-ink:var(--color-white)]',\n white:\n 'bg-white text-grey-800 [--search-ink:var(--grey-800)] dark:bg-grey-900 dark:text-white dark:[--search-ink:var(--color-white)]',\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n },\n)\n\ntype ExpandableSearchVariant = NonNullable<VariantProps<typeof expandableSearchVariants>['variant']>\n\n// One focus treatment for the input and the submit button, INSET rather than\n// the source's offset ring. The source ringed each variant in its own surface\n// colour with a hardcoded white offset — on the default chip that was\n// ring-grey-100 around a grey-100 chip on a white page: effectively invisible\n// (a 2.4.7 Focus Visible / 2.4.13 Focus Appearance failure). An outward\n// indicator can only guarantee contrast against the page, which this component\n// cannot know; the ink is guaranteed to contrast with the surface (that is its\n// whole job), so the indicator is drawn 2px INSIDE the chip in ink, where the\n// contrast maths always holds.\nconst searchFocusClassName =\n 'focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-(--search-ink)'\n\ntype ExpandableSearchContextValue = {\n value: string\n setValue: (value: string) => void\n formHasFocusWithin: boolean\n variant: ExpandableSearchVariant\n}\n\nconst ExpandableSearchContext = React.createContext<ExpandableSearchContextValue | null>(null)\n\ntype ExpandableSearchProps = React.ComponentPropsWithoutRef<'form'> &\n VariantProps<typeof expandableSearchVariants> & {\n /**\n * Called with the current query when the form submits (Enter in the field\n * or a click on the search button). Not called if a supplied `onSubmit`\n * prevented the event's default.\n */\n onAction?: (value: string) => void\n /** Initial query. A non-empty value renders the field expanded. */\n defaultValue?: string\n ref?: React.Ref<HTMLFormElement>\n }\n\ntype ExpandableSearchButtonProps = Omit<React.ComponentPropsWithoutRef<'button'>, 'type'> & {\n [key: `data-${string}`]: string | number | boolean | undefined\n}\n\ntype ExpandableSearchFieldProps = Omit<\n React.ComponentPropsWithoutRef<'input'>,\n // `type` is pinned to `search`; `value`/`defaultValue` are owned by the\n // `ExpandableSearch` context (seed it via the root's `defaultValue` prop).\n 'type' | 'value' | 'defaultValue'\n> & {\n /**\n * Accessible name for the input, rendered as a visually-hidden `<label>`\n * and mirrored as `aria-label`. Defaults to `'Search'`.\n */\n label?: string\n /** Accessible name for the submit button. Defaults to `'Search'`. */\n buttonLabel?: string\n /** Extra props for the submit button (its `type` is pinned to `submit`). */\n buttonProps?: ExpandableSearchButtonProps\n ref?: React.Ref<HTMLInputElement>\n}\n\n/**\n * Dev-only guard, mirroring the icon-only Button check in button.tsx: with\n * `label=''` and no `aria-label` the input reaches assistive tech unnamed\n * (WCAG 2.2, 4.1.2 Name, Role, Value) — and this control leans on its name\n * more than most, since collapsed it looks like a plain icon button. No-op in\n * production.\n */\nfunction warnIfFieldUnlabelled(label: string | undefined, ariaLabel: string | undefined) {\n if (process.env.NODE_ENV === 'production') {\n return\n }\n if (!label && !ariaLabel) {\n console.warn(\n '[nswds/ui] ExpandableSearchField has no label — pass `label` or `aria-label` so the search input has an accessible name.',\n )\n }\n}\n\n/**\n * Site-search disclosure: a 48px search chip that expands into a text field\n * whenever it holds focus or a value, and submits the query to `onAction`.\n * Compose it as `<ExpandableSearch>` (the form root, owning the value and the\n * focus-within state) around one `<ExpandableSearchField>` (the input and its\n * submit button) — typically inside `HeaderActions`.\n *\n * Ported from nswds-app's `ExpandableSearch`. The mechanic is kept verbatim —\n * the collapsed control IS the text input, styled as a chip, so that the very\n * first focus or tap both reveals and focuses the field with no extra step.\n * Expansion is pure CSS keyed on the active state; no Base UI primitive is\n * used because none models this pattern (it is a styled form, not a popup —\n * focus never moves, nothing is portalled, nothing needs ARIA beyond the\n * label).\n *\n * Accessibility contract:\n * - The input carries a visually-hidden `<label>` and an `aria-label`\n * (default \"Search\"), and is `type='search'` with `enterKeyHint='search'`,\n * so its role and purpose are announced while it still looks like a button\n * (WCAG 2.2, 4.1.2; the source input was an unlabelled-by-type text input).\n * - Keyboard focus shows a 2px ink outline drawn inside the chip — the\n * source's ring was its own surface colour against a hardcoded white offset\n * and could vanish entirely (2.4.7, 2.4.13). See `searchFocusClassName`.\n * - Enter submits; Escape clears (native `type='search'` behaviour); an empty\n * blurred field collapses back to the chip.\n * - Expansion and halo transitions honour `prefers-reduced-motion` (2.3.3).\n *\n * Departures from the nswds-app source, beyond those above:\n * - React 19 `ref` prop instead of `forwardRef`.\n * - Four parallel 14-entry variant tables replaced by one ink-driven map —\n * see `expandableSearchVariants`.\n * - Expanded width `w-96` → `w-[min(24rem,80vw)]` so the field can never\n * overflow a small viewport (1.4.10 Reflow).\n * - The expanded state no longer sets `outline-none` (it would have killed\n * the new focus indicator; the source could afford it because its\n * indicator was a box-shadow ring).\n * - Expanded text selection uses `select-text`, not the source's\n * `select-auto` — `auto` computes from the root's `select-none` parent, so\n * the source's expanded field was unselectable.\n * - A consumer `onChange` on the field is chained after the context update\n * instead of replacing it (the source's spread order let it clobber the\n * controlled handler).\n *\n * The root deliberately does not claim `role='search'`: where the component\n * is the page's site search, add it yourself (one search landmark per page).\n */\nfunction ExpandableSearch({\n className,\n onAction,\n defaultValue = '',\n onSubmit,\n onFocusCapture,\n onBlurCapture,\n variant = 'default',\n ref,\n ...props\n}: ExpandableSearchProps) {\n const [value, setValue] = React.useState(defaultValue)\n const [formHasFocusWithin, setFormHasFocusWithin] = React.useState(false)\n const resolvedVariant: ExpandableSearchVariant = variant ?? 'default'\n const isActive = value.length > 0 || formHasFocusWithin\n\n const contextValue = React.useMemo(\n () => ({ value, setValue, formHasFocusWithin, variant: resolvedVariant }),\n [value, formHasFocusWithin, resolvedVariant],\n )\n\n const handleSubmit = (e: React.SubmitEvent<HTMLFormElement>) => {\n onSubmit?.(e)\n\n if (e.defaultPrevented) {\n return\n }\n\n e.preventDefault()\n onAction?.(value)\n }\n\n const handleFocusCapture = (e: React.FocusEvent<HTMLFormElement>) => {\n setFormHasFocusWithin(true)\n onFocusCapture?.(e)\n }\n\n const handleBlurCapture = (e: React.FocusEvent<HTMLFormElement>) => {\n const nextFocusedElement = e.relatedTarget as Node | null\n\n if (!e.currentTarget.contains(nextFocusedElement)) {\n setFormHasFocusWithin(false)\n }\n\n onBlurCapture?.(e)\n }\n\n return (\n <ExpandableSearchContext.Provider value={contextValue}>\n <form\n data-slot='expandable-search'\n data-variant={resolvedVariant}\n // Present-or-absent rather than \"true\"/\"false\", so it reads like Base\n // UI's data-* attributes and Tailwind's bare `data-expanded:` variant\n // works. Same convention as Header's data-scrolled.\n data-expanded={isActive || undefined}\n {...props}\n // The surface (and its ink) lives on the root so BOTH children — the\n // input and the absolutely-positioned submit button — inherit the\n // custom properties. The root shrink-wraps the input, so painting the\n // background here is visually identical to painting it on the input.\n className={cn(expandableSearchVariants({ variant }), className)}\n onBlurCapture={handleBlurCapture}\n onFocusCapture={handleFocusCapture}\n onSubmit={handleSubmit}\n ref={ref}\n />\n </ExpandableSearchContext.Provider>\n )\n}\n\n/**\n * The input and its submit button. Must be rendered inside `ExpandableSearch`,\n * which owns the value and the focus-within state.\n *\n * The submit button is `pointer-events-none` while collapsed — deliberately,\n * per the source: collapsed, the input overlays the exact same 48px square and\n * OWNS the click, so a tap lands on the input, focuses it, and expands the\n * field. Making the button clickable there would submit an empty query\n * instead of opening the field. It also never traps keyboard focus while\n * collapsed: the input precedes it in tab order, and focusing the input\n * expands the field before the button is reached.\n */\nfunction ExpandableSearchField({\n className,\n id,\n label = 'Search',\n 'aria-label': ariaLabel,\n autoComplete = 'off',\n enterKeyHint = 'search',\n onChange,\n buttonLabel = 'Search',\n buttonProps,\n ref,\n ...props\n}: ExpandableSearchFieldProps) {\n const context = React.useContext(ExpandableSearchContext)\n if (!context) throw new Error('ExpandableSearchField must be used within ExpandableSearch')\n\n const generatedId = React.useId()\n const {\n className: buttonClassName,\n children: buttonChildren,\n 'aria-label': buttonAriaLabel,\n ...restButtonProps\n } = buttonProps ?? {}\n\n const isActive = context.value.length > 0 || context.formHasFocusWithin\n const inputId = id ?? generatedId\n\n warnIfFieldUnlabelled(label, ariaLabel)\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n context.setValue(e.target.value)\n onChange?.(e)\n }\n\n return (\n <div data-slot='expandable-search-field' className='relative flex-1'>\n {label ? (\n // aria-label (below) wins for the accessible name where both exist;\n // the label element is kept for source parity and so a click on any\n // future visible rendering of it focuses the input.\n <label className='sr-only' htmlFor={inputId}>\n {label}\n </label>\n ) : null}\n\n <input\n data-slot='expandable-search-input'\n aria-label={ariaLabel ?? (label || undefined)}\n autoComplete={autoComplete}\n enterKeyHint={enterKeyHint}\n {...props}\n type='search'\n id={inputId}\n value={context.value}\n onChange={handleChange}\n className={cn(\n // Collapsed, the input is a 48px chip: transparent text and\n // placeholder so nothing peeks out, cursor-pointer because it acts\n // as the \"open search\" affordance. The background comes from the\n // form root, which shrink-wraps this element.\n 'flex h-12 w-12 cursor-pointer overflow-hidden rounded-sm border-0 bg-transparent text-transparent',\n 'placeholder:text-transparent placeholder:opacity-0',\n 'duration-300 ease-in-out motion-safe:transition-[width,box-shadow,background-color]',\n // Hide WebKit's native clear affordance: the source field (type\n // text) had none, and Escape already clears a search input.\n '[&::-webkit-search-cancel-button]:appearance-none',\n searchFocusClassName,\n isActive\n ? // Expanded: capped at 80vw so the field cannot overflow small\n // viewports (the source's fixed w-96 could). pr-12 reserves the\n // submit button's square. select-text (not select-auto — see\n // the component JSDoc) re-enables selection under the root's\n // select-none.\n 'w-[min(24rem,80vw)] cursor-auto pt-0 pr-12 pb-0 pl-4 text-inherit select-text placeholder:text-(--search-placeholder) placeholder:opacity-100'\n : // Collapsed: the chip halos on hover exactly like the button\n // does — one visual whether the pointer technically rests on\n // the input overlay or not.\n 'p-0 hover:bg-(--search-halo)',\n className,\n )}\n ref={ref}\n />\n\n <button\n data-slot='expandable-search-button'\n aria-label={buttonAriaLabel ?? buttonLabel}\n {...restButtonProps}\n type='submit'\n className={cn(\n 'absolute top-0 right-0 z-10 flex h-12 w-12 cursor-pointer rounded-sm',\n 'duration-200 motion-safe:transition-[background-color,box-shadow]',\n // Icon and halos all derive from the ink; the whole-form\n // focus-within halo marks the button as the pending action while\n // the user types.\n 'text-(--search-ink)',\n 'group-focus-within/search:bg-(--search-halo) hover:bg-(--search-halo) active:bg-(--search-halo-active)',\n searchFocusClassName,\n // Collapsed, the input overlay owns the click — see the JSDoc.\n isActive ? 'pointer-events-auto' : 'pointer-events-none',\n buttonClassName,\n )}\n >\n {buttonChildren ?? (\n <IconSearch aria-hidden='true' className='m-auto block size-8 shrink-0 fill-current' />\n )}\n </button>\n </div>\n )\n}\n\nexport { ExpandableSearch, ExpandableSearchField, expandableSearchVariants }\nexport type {\n ExpandableSearchButtonProps,\n ExpandableSearchFieldProps,\n ExpandableSearchProps,\n ExpandableSearchVariant,\n}\n"]}
|
package/dist/components/field.js
CHANGED
|
@@ -70,7 +70,7 @@ const fieldVariants = cva(
|
|
|
70
70
|
orientation: {
|
|
71
71
|
vertical: "flex-col *:w-full [&>.sr-only]:w-auto",
|
|
72
72
|
horizontal: "flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",
|
|
73
|
-
responsive: "flex-col
|
|
73
|
+
responsive: "@max-md/field-group:flex-col @max-md/field-group:*:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"
|
|
74
74
|
}
|
|
75
75
|
},
|
|
76
76
|
defaultVariants: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/field.tsx"],"names":["FieldPrimitive"],"mappings":";;;;;;;;AAuDA,MAAM,kBAAA,GAAqB,KAAA,CAAM,aAAA,CAAc,KAAK,CAAA;AAEpD,SAAS,SAAS,EAAE,SAAA,EAAW,GAAA,EAAK,GAAG,OAAM,EAAqC;AAChF,EAAA,uBACE,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,WAAA,EAAU,WAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACT,kGAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,SAAS,WAAA,CAAY;AAAA,EACnB,SAAA;AAAA,EACA,OAAA,GAAU,QAAA;AAAA,EACV,GAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAsE;AACpE,EAAA,uBACE,GAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,WAAA,EAAU,cAAA;AAAA,MACV,cAAA,EAAc,OAAA;AAAA,MACd,S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,EAAA,IAAI,CAAC,WAAA,EAAa;AAChB,IAAA,uBACE,GAAA,CAAC,KAAA,EAAA,EAAI,GAAA,EAAU,IAAA,EAAK,OAAA,EAAQ,WAAA,EAAU,aAAA,EAAc,SAAA,EAAW,cAAA,EAAiB,GAAG,KAAA,EAChF,QAAA,EAAA,OAAA,EACH,CAAA;AAAA,EAEJ;AAEA,EAAA,uBACE,GAAA;AAAA,IAACA,OAAA,CAAe,KAAA;AAAA,IAAf;AAAA,MACC,GAAA;AAAA,MAKA,KAAA,EAAK,IAAA;AAAA,MACL,IAAA,EAAK,OAAA;AAAA,MACL,WAAA,EAAU,aAAA;AAAA,MACV,SAAA,EAAW,cAAA;AAAA,MACV,GAAG,KAAA;AAAA,MAEH,QAAA,EAAA;AAAA;AAAA,GACH;AAEJ","file":"field.js","sourcesContent":["'use client'\n\nimport { Field as FieldPrimitive } from '@base-ui/react/field'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\n\nimport { Label } from '../components/label.js'\nimport { Separator } from '../components/separator.js'\nimport { cn } from '../lib/utils.js'\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Base UI Field\n// ─────────────────────────────────────────────────────────────────────────────\n//\n// `Field`, `FieldLabel`, `FieldDescription`, and `FieldError` wrap Base UI's\n// Field primitive (@base-ui/react/field). Base UI owns the accessible wiring:\n// the label is associated with the control, and any description/error ids are\n// added to the control's `aria-describedby` automatically — no manual\n// `htmlFor` / `aria-describedby` / `aria-invalid` plumbing required. Set\n// `invalid` on `Field` (e.g. from react-hook-form) and the control receives\n// `aria-invalid` and the wrapper gets `data-invalid` for free.\n//\n// Base UI's Field parts must live inside a `Field.Root`. To keep the previous\n// behaviour where a label/description/error could also be used standalone\n// (e.g. a group-level FieldDescription directly inside a FieldSet), FieldLabel/\n// FieldDescription/FieldError opt into the Base UI part only when they detect a\n// surrounding `Field` (via `InsideFieldContext`) and otherwise render the plain\n// element they did before. Inside a Field they gain the automatic association;\n// outside one they are unchanged.\n//\n// `FieldSet` / `FieldLegend` stay native `<fieldset>` / `<legend>` (already\n// accessible for grouping); `FieldGroup` / `FieldContent` / `FieldSeparator` /\n// `FieldTitle` remain layout-only primitives.\n//\n// ─────────────────────────────────────────────────────────────────────────────\n// Typography hierarchy (deliberate, do not collapse to a single size)\n// ─────────────────────────────────────────────────────────────────────────────\n//\n// FieldLabel inherits its font-size from the Label primitive (`text-base/\n// relaxed` = 16px) — the primary form text users read when scanning a form,\n// kept at the 16px ideal for body copy.\n// Every supporting element in this file uses `text-sm/relaxed` (14px). That\n// is below the 16px body-copy ideal but comfortably above the 12px floor\n// older versions used, so it still reads clearly as secondary information.\n// The 16/14 gap is intentional: it preserves a scannable visual hierarchy\n// (label > description / error / metadata) without shrinking supporting text\n// back down to the previous 12px.\n//\n// If you find yourself wanting to bump these to text-base, do it in\n// `label.tsx` so FieldLabel moves with the family. If you want to drop\n// them to text-xs, please raise that as a design decision — 12px is below\n// the NSW Government digital service standards minimum body-text size.\n// ─────────────────────────────────────────────────────────────────────────────\n\n// True for descendants of our <Field> (which renders Base UI's Field.Root).\nconst InsideFieldContext = React.createContext(false)\n\nfunction FieldSet({ className, ref, ...props }: React.ComponentProps<'fieldset'>) {\n return (\n <fieldset\n ref={ref}\n data-slot='field-set'\n className={cn(\n 'flex flex-col gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction FieldLegend({\n className,\n variant = 'legend',\n ref,\n ...props\n}: React.ComponentProps<'legend'> & { variant?: 'legend' | 'label' }) {\n return (\n <legend\n ref={ref}\n data-slot='field-legend'\n data-variant={variant}\n className={cn(\n 'mb-2 font-medium data-[variant=label]:text-sm/relaxed data-[variant=legend]:text-sm',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction FieldGroup({ className, ref, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n ref={ref}\n data-slot='field-group'\n className={cn(\n // `has-[>[data-slot=…]]:gap-3` matches when FieldGroup CONTAINS a\n // checkbox/radio group child. The original `data-[slot=checkbox-group]:gap-3`\n // was self-referential (this element's slot is `field-group`) and\n // could never apply. Mirrors the rule on FieldSet above.\n 'group/field-group @container/field-group flex w-full flex-col gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3 *:data-[slot=field-group]:gap-4',\n className,\n )}\n {...props}\n />\n )\n}\n\nconst fieldVariants = cva(\n // `data-invalid:` (presence) matches the `data-invalid` attribute Base UI's\n // Field.Root sets when the field is invalid (via the `invalid` prop or native\n // validation) — replacing the old hand-set `data-[invalid=true]`.\n 'group/field flex w-full gap-2 data-invalid:text-destructive',\n {\n variants: {\n orientation: {\n vertical: 'flex-col *:w-full [&>.sr-only]:w-auto',\n horizontal:\n 'flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px',\n responsive:\n 'flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px',\n },\n },\n defaultVariants: {\n orientation: 'vertical',\n },\n },\n)\n\nfunction Field({\n className,\n orientation = 'vertical',\n ref,\n children,\n ...props\n}: React.ComponentProps<typeof FieldPrimitive.Root> & VariantProps<typeof fieldVariants>) {\n return (\n <FieldPrimitive.Root\n ref={ref}\n // Preserve the explicit group role + data-orientation the layout and the\n // accessibility tests rely on; Base UI's Root renders a bare <div>.\n role='group'\n data-slot='field'\n data-orientation={orientation}\n className={cn(fieldVariants({ orientation }), className)}\n {...props}\n >\n <InsideFieldContext.Provider value={true}>{children}</InsideFieldContext.Provider>\n </FieldPrimitive.Root>\n )\n}\n\nfunction FieldContent({ className, ref, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n ref={ref}\n data-slot='field-content'\n className={cn('group/field-content flex flex-1 flex-col gap-0.5 leading-snug', className)}\n {...props}\n />\n )\n}\n\nconst fieldLabelClassName = cn(\n 'group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-disabled/field:opacity-50 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border *:data-[slot=field]:p-2 dark:has-data-checked:bg-primary/10',\n 'has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col',\n)\n\nfunction FieldLabel({ className, ref, ...props }: React.ComponentProps<typeof Label>) {\n const insideField = React.useContext(InsideFieldContext)\n\n // Standalone (no surrounding Field): render the styled Label directly, as\n // before. Base UI's Field.Label would throw without a Field.Root ancestor.\n if (!insideField) {\n return (\n <Label\n ref={ref}\n data-slot='field-label'\n className={cn(fieldLabelClassName, className)}\n {...props}\n />\n )\n }\n\n return (\n <FieldPrimitive.Label\n // Base UI's Field.Label types its ref as HTMLElement (it can render a\n // non-label); here it always renders our <Label>, so the ref is an\n // HTMLLabelElement at runtime.\n ref={ref as React.Ref<HTMLElement>}\n // Render through our styled Label so FieldLabel keeps the Label\n // primitive's typography + data-slot, while Base UI supplies the\n // automatic `htmlFor` association with the field control.\n render={<Label />}\n data-slot='field-label'\n className={cn(fieldLabelClassName, className)}\n {...props}\n />\n )\n}\n\nfunction FieldTitle({ className, ref, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n ref={ref}\n data-slot='field-label'\n className={cn(\n 'flex w-fit items-center gap-2 text-sm/relaxed font-medium group-data-disabled/field:opacity-50',\n className,\n )}\n {...props}\n />\n )\n}\n\nconst fieldDescriptionClassName = cn(\n // `group-data-[orientation=horizontal]/field:` matches the\n // `data-orientation=\"horizontal\"` attribute Field emits.\n 'text-start text-sm/relaxed leading-normal font-normal text-muted-foreground group-data-[orientation=horizontal]/field:text-balance [[data-variant=legend]+&]:-mt-1.5',\n 'last:mt-0 nth-last-2:-mt-1',\n '[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary',\n)\n\nfunction FieldDescription({ className, ref, ...props }: React.ComponentProps<'p'>) {\n const insideField = React.useContext(InsideFieldContext)\n\n // Standalone (e.g. a group-level description inside a FieldSet): a plain\n // <p>, as before. Inside a Field, Base UI links it to the control via\n // aria-describedby.\n if (!insideField) {\n return (\n <p\n ref={ref}\n data-slot='field-description'\n className={cn(fieldDescriptionClassName, className)}\n {...props}\n />\n )\n }\n\n return (\n <FieldPrimitive.Description\n ref={ref}\n data-slot='field-description'\n className={cn(fieldDescriptionClassName, className)}\n {...props}\n />\n )\n}\n\nfunction FieldSeparator({\n children,\n className,\n ref,\n ...props\n}: React.ComponentProps<'div'> & {\n children?: React.ReactNode\n}) {\n return (\n <div\n ref={ref}\n data-slot='field-separator'\n data-content={!!children}\n className={cn(\n 'relative -my-2 h-5 text-sm/relaxed group-data-[variant=outline]/field-group:-mb-2',\n className,\n )}\n {...props}\n >\n <Separator className='absolute inset-0 top-1/2' />\n {children && (\n <span\n className='relative mx-auto block w-fit bg-background px-2 text-muted-foreground'\n data-slot='field-separator-content'\n >\n {children}\n </span>\n )}\n </div>\n )\n}\n\nfunction FieldError({\n className,\n children,\n errors,\n ref,\n ...props\n}: React.ComponentProps<'div'> & {\n errors?: Array<{ message?: string } | undefined>\n}) {\n const insideField = React.useContext(InsideFieldContext)\n\n const content = React.useMemo(() => {\n if (children) {\n return children\n }\n\n if (!errors?.length) {\n return null\n }\n\n const uniqueErrors = [...new Map(errors.map((error) => [error?.message, error])).values()]\n\n if (uniqueErrors?.length === 1) {\n return uniqueErrors[0]?.message\n }\n\n return (\n <ul className='ms-4 flex list-disc flex-col gap-1'>\n {uniqueErrors.map((error, index) => error?.message && <li key={index}>{error.message}</li>)}\n </ul>\n )\n }, [children, errors])\n\n if (!content) {\n return null\n }\n\n const errorClassName = cn('text-sm/relaxed font-normal text-destructive', className)\n\n // Standalone: a plain alert region, as before. Inside a Field, Base UI links\n // it to the control via aria-describedby.\n if (!insideField) {\n return (\n <div ref={ref} role='alert' data-slot='field-error' className={errorClassName} {...props}>\n {content}\n </div>\n )\n }\n\n return (\n <FieldPrimitive.Error\n ref={ref}\n // `match` lets the `errors` array / external library drive visibility\n // instead of the control's native ValidityState. We only render this when\n // there IS content, so force it visible; Base UI then adds its id to the\n // control's `aria-describedby`.\n match\n role='alert'\n data-slot='field-error'\n className={errorClassName}\n {...props}\n >\n {content}\n </FieldPrimitive.Error>\n )\n}\n\nexport {\n Field,\n FieldContent,\n FieldDescription,\n FieldError,\n FieldGroup,\n FieldLabel,\n FieldLegend,\n FieldSeparator,\n FieldSet,\n FieldTitle,\n}\n\n// Derived prop types — exact component props for consumers wrapping these.\nexport type FieldProps = React.ComponentProps<typeof Field>\nexport type FieldSetProps = React.ComponentProps<typeof FieldSet>\nexport type FieldLegendProps = React.ComponentProps<typeof FieldLegend>\nexport type FieldGroupProps = React.ComponentProps<typeof FieldGroup>\nexport type FieldContentProps = React.ComponentProps<typeof FieldContent>\nexport type FieldLabelProps = React.ComponentProps<typeof FieldLabel>\nexport type FieldTitleProps = React.ComponentProps<typeof FieldTitle>\nexport type FieldDescriptionProps = React.ComponentProps<typeof FieldDescription>\nexport type FieldSeparatorProps = React.ComponentProps<typeof FieldSeparator>\nexport type FieldErrorProps = React.ComponentProps<typeof FieldError>\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/field.tsx"],"names":["FieldPrimitive"],"mappings":";;;;;;;;AAuDA,MAAM,kBAAA,GAAqB,KAAA,CAAM,aAAA,CAAc,KAAK,CAAA;AAEpD,SAAS,SAAS,EAAE,SAAA,EAAW,GAAA,EAAK,GAAG,OAAM,EAAqC;AAChF,EAAA,uBACE,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,WAAA,EAAU,WAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACT,kGAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG;AAAA;AAAA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AAA,EAAgB,gBAAM,OAAA,EAAA,EAAd,KAAsB,CAAK,CAAA,EAC5F,CAAA;AAAA,EAEJ,CAAA,EAAG,CAAC,QAAA,EAAU,MAAM,CAAC,CAAA;AAErB,EAAA,IAAI,CAAC,OAAA,EAAS;AACZ,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,MAAM,cAAA,GAAiB,EAAA,CAAG,8CAAA,EAAgD,SAAS,CAAA;AAInF,EAAA,IAAI,CAAC,WAAA,EAAa;AAChB,IAAA,uBACE,GAAA,CAAC,KAAA,EAAA,EAAI,GAAA,EAAU,IAAA,EAAK,OAAA,EAAQ,WAAA,EAAU,aAAA,EAAc,SAAA,EAAW,cAAA,EAAiB,GAAG,KAAA,EAChF,QAAA,EAAA,OAAA,EACH,CAAA;AAAA,EAEJ;AAEA,EAAA,uBACE,GAAA;AAAA,IAACA,OAAA,CAAe,KAAA;AAAA,IAAf;AAAA,MACC,GAAA;AAAA,MAKA,KAAA,EAAK,IAAA;AAAA,MACL,IAAA,EAAK,OAAA;AAAA,MACL,WAAA,EAAU,aAAA;AAAA,MACV,SAAA,EAAW,cAAA;AAAA,MACV,GAAG,KAAA;AAAA,MAEH,QAAA,EAAA;AAAA;AAAA,GACH;AAEJ","file":"field.js","sourcesContent":["'use client'\n\nimport { Field as FieldPrimitive } from '@base-ui/react/field'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\n\nimport { Label } from '../components/label.js'\nimport { Separator } from '../components/separator.js'\nimport { cn } from '../lib/utils.js'\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Base UI Field\n// ─────────────────────────────────────────────────────────────────────────────\n//\n// `Field`, `FieldLabel`, `FieldDescription`, and `FieldError` wrap Base UI's\n// Field primitive (@base-ui/react/field). Base UI owns the accessible wiring:\n// the label is associated with the control, and any description/error ids are\n// added to the control's `aria-describedby` automatically — no manual\n// `htmlFor` / `aria-describedby` / `aria-invalid` plumbing required. Set\n// `invalid` on `Field` (e.g. from react-hook-form) and the control receives\n// `aria-invalid` and the wrapper gets `data-invalid` for free.\n//\n// Base UI's Field parts must live inside a `Field.Root`. To keep the previous\n// behaviour where a label/description/error could also be used standalone\n// (e.g. a group-level FieldDescription directly inside a FieldSet), FieldLabel/\n// FieldDescription/FieldError opt into the Base UI part only when they detect a\n// surrounding `Field` (via `InsideFieldContext`) and otherwise render the plain\n// element they did before. Inside a Field they gain the automatic association;\n// outside one they are unchanged.\n//\n// `FieldSet` / `FieldLegend` stay native `<fieldset>` / `<legend>` (already\n// accessible for grouping); `FieldGroup` / `FieldContent` / `FieldSeparator` /\n// `FieldTitle` remain layout-only primitives.\n//\n// ─────────────────────────────────────────────────────────────────────────────\n// Typography hierarchy (deliberate, do not collapse to a single size)\n// ─────────────────────────────────────────────────────────────────────────────\n//\n// FieldLabel inherits its font-size from the Label primitive (`text-base/\n// relaxed` = 16px) — the primary form text users read when scanning a form,\n// kept at the 16px ideal for body copy.\n// Every supporting element in this file uses `text-sm/relaxed` (14px). That\n// is below the 16px body-copy ideal but comfortably above the 12px floor\n// older versions used, so it still reads clearly as secondary information.\n// The 16/14 gap is intentional: it preserves a scannable visual hierarchy\n// (label > description / error / metadata) without shrinking supporting text\n// back down to the previous 12px.\n//\n// If you find yourself wanting to bump these to text-base, do it in\n// `label.tsx` so FieldLabel moves with the family. If you want to drop\n// them to text-xs, please raise that as a design decision — 12px is below\n// the NSW Government digital service standards minimum body-text size.\n// ─────────────────────────────────────────────────────────────────────────────\n\n// True for descendants of our <Field> (which renders Base UI's Field.Root).\nconst InsideFieldContext = React.createContext(false)\n\nfunction FieldSet({ className, ref, ...props }: React.ComponentProps<'fieldset'>) {\n return (\n <fieldset\n ref={ref}\n data-slot='field-set'\n className={cn(\n 'flex flex-col gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction FieldLegend({\n className,\n variant = 'legend',\n ref,\n ...props\n}: React.ComponentProps<'legend'> & { variant?: 'legend' | 'label' }) {\n return (\n <legend\n ref={ref}\n data-slot='field-legend'\n data-variant={variant}\n className={cn(\n 'mb-2 font-medium data-[variant=label]:text-sm/relaxed data-[variant=legend]:text-sm',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction FieldGroup({ className, ref, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n ref={ref}\n data-slot='field-group'\n className={cn(\n // `has-[>[data-slot=…]]:gap-3` matches when FieldGroup CONTAINS a\n // checkbox/radio group child. The original `data-[slot=checkbox-group]:gap-3`\n // was self-referential (this element's slot is `field-group`) and\n // could never apply. Mirrors the rule on FieldSet above.\n 'group/field-group @container/field-group flex w-full flex-col gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3 *:data-[slot=field-group]:gap-4',\n className,\n )}\n {...props}\n />\n )\n}\n\nconst fieldVariants = cva(\n // `data-invalid:` (presence) matches the `data-invalid` attribute Base UI's\n // Field.Root sets when the field is invalid (via the `invalid` prop or native\n // validation) — replacing the old hand-set `data-[invalid=true]`.\n 'group/field flex w-full gap-2 data-invalid:text-destructive',\n {\n variants: {\n orientation: {\n vertical: 'flex-col *:w-full [&>.sr-only]:w-auto',\n horizontal:\n 'flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px',\n responsive:\n '@max-md/field-group:flex-col @max-md/field-group:*:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px',\n },\n },\n defaultVariants: {\n orientation: 'vertical',\n },\n },\n)\n\nfunction Field({\n className,\n orientation = 'vertical',\n ref,\n children,\n ...props\n}: React.ComponentProps<typeof FieldPrimitive.Root> & VariantProps<typeof fieldVariants>) {\n return (\n <FieldPrimitive.Root\n ref={ref}\n // Preserve the explicit group role + data-orientation the layout and the\n // accessibility tests rely on; Base UI's Root renders a bare <div>.\n role='group'\n data-slot='field'\n data-orientation={orientation}\n className={cn(fieldVariants({ orientation }), className)}\n {...props}\n >\n <InsideFieldContext.Provider value={true}>{children}</InsideFieldContext.Provider>\n </FieldPrimitive.Root>\n )\n}\n\nfunction FieldContent({ className, ref, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n ref={ref}\n data-slot='field-content'\n className={cn('group/field-content flex flex-1 flex-col gap-0.5 leading-snug', className)}\n {...props}\n />\n )\n}\n\nconst fieldLabelClassName = cn(\n 'group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-disabled/field:opacity-50 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border *:data-[slot=field]:p-2 dark:has-data-checked:bg-primary/10',\n 'has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col',\n)\n\nfunction FieldLabel({ className, ref, ...props }: React.ComponentProps<typeof Label>) {\n const insideField = React.useContext(InsideFieldContext)\n\n // Standalone (no surrounding Field): render the styled Label directly, as\n // before. Base UI's Field.Label would throw without a Field.Root ancestor.\n if (!insideField) {\n return (\n <Label\n ref={ref}\n data-slot='field-label'\n className={cn(fieldLabelClassName, className)}\n {...props}\n />\n )\n }\n\n return (\n <FieldPrimitive.Label\n // Base UI's Field.Label types its ref as HTMLElement (it can render a\n // non-label); here it always renders our <Label>, so the ref is an\n // HTMLLabelElement at runtime.\n ref={ref as React.Ref<HTMLElement>}\n // Render through our styled Label so FieldLabel keeps the Label\n // primitive's typography + data-slot, while Base UI supplies the\n // automatic `htmlFor` association with the field control.\n render={<Label />}\n data-slot='field-label'\n className={cn(fieldLabelClassName, className)}\n {...props}\n />\n )\n}\n\nfunction FieldTitle({ className, ref, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n ref={ref}\n data-slot='field-label'\n className={cn(\n 'flex w-fit items-center gap-2 text-sm/relaxed font-medium group-data-disabled/field:opacity-50',\n className,\n )}\n {...props}\n />\n )\n}\n\nconst fieldDescriptionClassName = cn(\n // `group-data-[orientation=horizontal]/field:` matches the\n // `data-orientation=\"horizontal\"` attribute Field emits.\n 'text-start text-sm/relaxed leading-normal font-normal text-muted-foreground group-data-[orientation=horizontal]/field:text-balance [[data-variant=legend]+&]:-mt-1.5',\n 'last:mt-0 nth-last-2:-mt-1',\n '[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary',\n)\n\nfunction FieldDescription({ className, ref, ...props }: React.ComponentProps<'p'>) {\n const insideField = React.useContext(InsideFieldContext)\n\n // Standalone (e.g. a group-level description inside a FieldSet): a plain\n // <p>, as before. Inside a Field, Base UI links it to the control via\n // aria-describedby.\n if (!insideField) {\n return (\n <p\n ref={ref}\n data-slot='field-description'\n className={cn(fieldDescriptionClassName, className)}\n {...props}\n />\n )\n }\n\n return (\n <FieldPrimitive.Description\n ref={ref}\n data-slot='field-description'\n className={cn(fieldDescriptionClassName, className)}\n {...props}\n />\n )\n}\n\nfunction FieldSeparator({\n children,\n className,\n ref,\n ...props\n}: React.ComponentProps<'div'> & {\n children?: React.ReactNode\n}) {\n return (\n <div\n ref={ref}\n data-slot='field-separator'\n data-content={!!children}\n className={cn(\n 'relative -my-2 h-5 text-sm/relaxed group-data-[variant=outline]/field-group:-mb-2',\n className,\n )}\n {...props}\n >\n <Separator className='absolute inset-0 top-1/2' />\n {children && (\n <span\n className='relative mx-auto block w-fit bg-background px-2 text-muted-foreground'\n data-slot='field-separator-content'\n >\n {children}\n </span>\n )}\n </div>\n )\n}\n\nfunction FieldError({\n className,\n children,\n errors,\n ref,\n ...props\n}: React.ComponentProps<'div'> & {\n errors?: Array<{ message?: string } | undefined>\n}) {\n const insideField = React.useContext(InsideFieldContext)\n\n const content = React.useMemo(() => {\n if (children) {\n return children\n }\n\n if (!errors?.length) {\n return null\n }\n\n const uniqueErrors = [...new Map(errors.map((error) => [error?.message, error])).values()]\n\n if (uniqueErrors?.length === 1) {\n return uniqueErrors[0]?.message\n }\n\n return (\n <ul className='ms-4 flex list-disc flex-col gap-1'>\n {uniqueErrors.map((error, index) => error?.message && <li key={index}>{error.message}</li>)}\n </ul>\n )\n }, [children, errors])\n\n if (!content) {\n return null\n }\n\n const errorClassName = cn('text-sm/relaxed font-normal text-destructive', className)\n\n // Standalone: a plain alert region, as before. Inside a Field, Base UI links\n // it to the control via aria-describedby.\n if (!insideField) {\n return (\n <div ref={ref} role='alert' data-slot='field-error' className={errorClassName} {...props}>\n {content}\n </div>\n )\n }\n\n return (\n <FieldPrimitive.Error\n ref={ref}\n // `match` lets the `errors` array / external library drive visibility\n // instead of the control's native ValidityState. We only render this when\n // there IS content, so force it visible; Base UI then adds its id to the\n // control's `aria-describedby`.\n match\n role='alert'\n data-slot='field-error'\n className={errorClassName}\n {...props}\n >\n {content}\n </FieldPrimitive.Error>\n )\n}\n\nexport {\n Field,\n FieldContent,\n FieldDescription,\n FieldError,\n FieldGroup,\n FieldLabel,\n FieldLegend,\n FieldSeparator,\n FieldSet,\n FieldTitle,\n}\n\n// Derived prop types — exact component props for consumers wrapping these.\nexport type FieldProps = React.ComponentProps<typeof Field>\nexport type FieldSetProps = React.ComponentProps<typeof FieldSet>\nexport type FieldLegendProps = React.ComponentProps<typeof FieldLegend>\nexport type FieldGroupProps = React.ComponentProps<typeof FieldGroup>\nexport type FieldContentProps = React.ComponentProps<typeof FieldContent>\nexport type FieldLabelProps = React.ComponentProps<typeof FieldLabel>\nexport type FieldTitleProps = React.ComponentProps<typeof FieldTitle>\nexport type FieldDescriptionProps = React.ComponentProps<typeof FieldDescription>\nexport type FieldSeparatorProps = React.ComponentProps<typeof FieldSeparator>\nexport type FieldErrorProps = React.ComponentProps<typeof FieldError>\n"]}
|
|
@@ -76,7 +76,7 @@ const footerVariants = cva(
|
|
|
76
76
|
);
|
|
77
77
|
const footerContainerVariants = cva(
|
|
78
78
|
[
|
|
79
|
-
"mx-auto flex w-full flex-col py-6 sm:py-8",
|
|
79
|
+
"mx-auto flex w-full flex-col max-sm:py-6 sm:py-8",
|
|
80
80
|
// Lateral padding funnels through --footer-padding-x so an app can retune
|
|
81
81
|
// it once (via the `style` prop or a utility class) without a new variant.
|
|
82
82
|
// Same mechanism, and the same 16px → 24px → 48px rhythm, as the Masthead.
|
|
@@ -102,7 +102,7 @@ const footerLinkClassName = [
|
|
|
102
102
|
// Negative margin + padding keeps the hover/focus halo from shifting layout.
|
|
103
103
|
"-m-1 rounded-sm p-1 text-(--footer-ink)",
|
|
104
104
|
"underline decoration-current underline-offset-4",
|
|
105
|
-
"
|
|
105
|
+
"motion-safe:transition-colors",
|
|
106
106
|
"hover:bg-(--footer-halo) hover:decoration-2",
|
|
107
107
|
"active:bg-(--footer-halo-active) active:decoration-2",
|
|
108
108
|
// outline-(--footer-ink) guarantees the indicator contrasts with the surface
|
|
@@ -138,7 +138,7 @@ function FooterAcknowledgement({ className, children, ref, ...props }) {
|
|
|
138
138
|
...props,
|
|
139
139
|
className: cn("flex flex-row items-center gap-5 py-4", className),
|
|
140
140
|
ref,
|
|
141
|
-
children: /* @__PURE__ */ jsx("p", { className: "text-
|
|
141
|
+
children: /* @__PURE__ */ jsx("p", { className: "text-base text-pretty text-(--footer-ink) max-lg:text-center lg:text-left", children: children ?? "We acknowledge the Traditional Custodians of the land on which we work and live, and pay our respects to Elders past, present and emerging." })
|
|
142
142
|
}
|
|
143
143
|
);
|
|
144
144
|
}
|
|
@@ -159,7 +159,7 @@ function FooterLegalLinks({
|
|
|
159
159
|
...props,
|
|
160
160
|
"aria-label": ariaLabel,
|
|
161
161
|
className: cn(
|
|
162
|
-
"flex flex-wrap
|
|
162
|
+
"flex flex-wrap gap-x-4 gap-y-3 py-4 text-sm max-lg:justify-center lg:justify-start",
|
|
163
163
|
className
|
|
164
164
|
),
|
|
165
165
|
ref,
|
|
@@ -196,7 +196,7 @@ function FooterNav({
|
|
|
196
196
|
"data-slot": "footer-nav",
|
|
197
197
|
...props,
|
|
198
198
|
"aria-label": ariaLabel,
|
|
199
|
-
className: cn("grid gap-8 py-4 sm:grid-cols-2 lg:grid-cols-4", className),
|
|
199
|
+
className: cn("grid gap-8 py-4 sm:max-lg:grid-cols-2 lg:grid-cols-4", className),
|
|
200
200
|
ref
|
|
201
201
|
}
|
|
202
202
|
);
|
|
@@ -238,16 +238,19 @@ function FooterSmallPrint({
|
|
|
238
238
|
{
|
|
239
239
|
"data-slot": "footer-small-print",
|
|
240
240
|
...props,
|
|
241
|
-
className: cn(
|
|
241
|
+
className: cn(
|
|
242
|
+
"flex items-center justify-between gap-5 pt-4 max-sm:flex-col sm:flex-row",
|
|
243
|
+
className
|
|
244
|
+
),
|
|
242
245
|
ref,
|
|
243
246
|
children: [
|
|
244
|
-
/* @__PURE__ */ jsx("p", { className: "text-
|
|
247
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-(--footer-ink) max-lg:text-center lg:text-left", children: children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
245
248
|
"\xA9 Copyright ",
|
|
246
249
|
year,
|
|
247
250
|
department ? ` ${department}` : "",
|
|
248
251
|
". All rights reserved."
|
|
249
252
|
] }) }),
|
|
250
|
-
socialLinks && socialLinks.length > 0 && /* @__PURE__ */ jsx("ul", { className: "flex list-none
|
|
253
|
+
socialLinks && socialLinks.length > 0 && /* @__PURE__ */ jsx("ul", { className: "flex list-none gap-4 max-lg:justify-center lg:justify-end", children: socialLinks.map((item) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
|
|
251
254
|
FooterSocialLink,
|
|
252
255
|
{
|
|
253
256
|
href: item.href,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/footer.tsx"],"names":[],"mappings":";;;;;;;AAyBA,MAAM,YAAA,GAAe;AAAA,EACnB,aAAA;AAAA,EACA,aAAA;AAAA,EACA,aAAA;AAAA,EACA,aAAA;AAAA,EACA,UAAA;AAA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,eAAe,CAAA;AACnD,EAAA,MAAM,cAAA,GAAiB,WAAW,MAAA,GAAS,CAAA;AAE3C,EAAA,uBACE,GAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,QAAA;AAAA,MACV,cAAY,KAAA,IAAS,oBAAA;AAAA,MACpB,GAAG,KAAA;AAAA,MACJ,WAAW,EAAA,CAAG,cAAA,CAAe,EAAE,KAAA,EAAO,GAAG,SAAS,CAAA;AAAA,MAClD,GAAA;AAAA,MAEA,QAAA,kBAAA,IAAA;AAAA,QAAC,KAAA;AAAA,QAAA;AAAA,UACC,WAAA,EAAU,kBAAA;AAAA,UACV,WAAW,EAAA,CAAG,uBAAA,CAAwB,EAAE,SAAA,EAAW,GAAG,kBAAkB,CAAA;AAAA,UAEvE,QAAA,EAAA;AAAA,YAAA,SAAA,oBAAa,GAAA,CAAC,SAAA,EAAA,EAAU,UAAA,EAAU,IAAA,EAAC,WAAU,2BAAA,EAA4B,CAAA;AAAA,YACzE,QAAA;AAAA,YACA,uCACC,GAAA,CAAC,qBAAA,EAAA,EACE,QAAA,EAAA,eAAA,KAAoB,IAAA,GAAO,SAAY,eAAA,EAC1C,CAAA;AAAA,YAGD,mBAAA,KAAwB,kBAAkB,UAAA,CAAA,oBACzC,GAAA,CAAC,aAAU,UAAA,EAAU,IAAA,EAAC,WAAU,2BAAA,EAA4B,CAAA;AAAA,YAE7D,cAAA,oBAAkB,GAAA,CAAC,gBAAA,EAAA,EAAiB,UAAA,EAAwB,CAAA;AAAA,YAC5D,UAAA,oBACC,GAAA,CAAC,gBAAA,EAAA,EAAiB,UAAA,EAAwB,aAA0B,IAAA,EAAY;AAAA;AAAA;AAAA;AAEpF;AAAA,GACF;AAEJ","file":"footer.js","sourcesContent":["import { cva, type VariantProps } from 'class-variance-authority'\nimport React from 'react'\n\nimport { cn } from '../lib/utils.js'\n\nimport { ButtonLink, type IconSlot } from '../components/button.js'\nimport { Link } from '../components/link.js'\nimport { Separator } from '../components/separator.js'\n\n/**\n * Surface colours the footer can be themed with. Each one names its 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 * Every light pair clears WCAG 2.2 AA (1.4.3, 4.5:1) for the footer's smallest\n * text and 11 of the 13 also clear AAA (1.4.6, 7:1). The two AA-only pairs are\n * `primary-600` (4.57:1) and `accent-600` (5.18:1), both with white ink; prefer\n * the `-800` steps when a service is held to AAA. In dark mode all thirteen\n * clear AAA (worst 13.6:1).\n *\n * Unlike `Masthead` — which is restricted to verified AAA pairs because it is\n * legally-mandated identification — the footer carries supporting content, so\n * the full tonal range is offered here.\n */\nconst footerColors = [\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 FooterColor = (typeof footerColors)[number]\n\n// Shared by cva's defaultVariants and the data-color attribute, so the two\n// can't drift apart.\nconst DEFAULT_FOOTER_COLOR: FooterColor = 'white'\n\nconst footerVariants = cva(\n [\n 'w-full',\n // Every derived colour in the footer resolves from a single --footer-ink\n // token, so a colour variant only has to declare the surface utilities and\n // that one value. The derivations are written literally here (once) rather\n // than per-variant: Tailwind scans source text for class names, so a\n // template-built arbitrary property would never be emitted.\n //\n // Mirrors the color-mix derivation in link.tsx (--link-halo).\n '[--footer-border:color-mix(in_oklch,var(--footer-ink)_15%,transparent)]',\n '[--footer-halo:color-mix(in_oklch,var(--footer-ink)_10%,transparent)]',\n '[--footer-halo-active:color-mix(in_oklch,var(--footer-ink)_18%,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 // Note: a bracketed example in a comment here would itself be scanned by\n // Tailwind and emitted as a dead rule — keep such examples out of prose.\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 — so the\n // luminance ORDER within a family is preserved: the variant named for the\n // heaviest tone stays the heaviest. Ink goes white on all thirteen, and\n // every dark pair is WCAG 2.2 AAA (worst 13.6:1) — better than light\n // mode, where primary-600 and accent-600 are AA-only.\n color: {\n 'primary-800':\n 'bg-primary-800 text-white [--footer-ink:var(--color-white)] dark:bg-primary-950',\n 'primary-600':\n 'bg-primary-600 text-white [--footer-ink:var(--color-white)] dark:bg-primary-900',\n 'primary-400':\n 'bg-primary-400 text-primary-800 [--footer-ink:var(--primary-800)] dark:bg-primary-850 dark:text-white dark:[--footer-ink:var(--color-white)]',\n 'primary-200':\n 'bg-primary-200 text-primary-800 [--footer-ink:var(--primary-800)] dark:bg-primary-800 dark:text-white dark:[--footer-ink:var(--color-white)]',\n 'grey-800': 'bg-grey-800 text-white [--footer-ink:var(--color-white)] dark:bg-grey-950',\n 'grey-600': 'bg-grey-600 text-white [--footer-ink:var(--color-white)] dark:bg-grey-900',\n 'grey-400':\n 'bg-grey-400 text-grey-800 [--footer-ink:var(--grey-800)] dark:bg-grey-850 dark:text-white dark:[--footer-ink:var(--color-white)]',\n 'grey-200':\n 'bg-grey-200 text-grey-800 [--footer-ink:var(--grey-800)] dark:bg-grey-800 dark:text-white dark:[--footer-ink:var(--color-white)]',\n 'accent-800':\n 'bg-accent-800 text-white [--footer-ink:var(--color-white)] dark:bg-accent-950',\n 'accent-600':\n 'bg-accent-600 text-white [--footer-ink:var(--color-white)] dark:bg-accent-900',\n 'accent-400':\n 'bg-accent-400 text-accent-800 [--footer-ink:var(--accent-800)] dark:bg-accent-850 dark:text-white dark:[--footer-ink:var(--color-white)]',\n 'accent-200':\n 'bg-accent-200 text-accent-800 [--footer-ink:var(--accent-800)] dark:bg-accent-800 dark:text-white dark:[--footer-ink:var(--color-white)]',\n white:\n 'bg-white text-grey-800 [--footer-ink:var(--grey-800)] dark:bg-grey-900 dark:text-white dark:[--footer-ink:var(--color-white)]',\n },\n },\n defaultVariants: {\n color: DEFAULT_FOOTER_COLOR,\n },\n },\n)\n\nconst footerContainerVariants = cva(\n [\n 'mx-auto flex w-full flex-col py-6 sm:py-8',\n // Lateral padding funnels through --footer-padding-x so an app can retune\n // it once (via the `style` prop or a utility class) without a new variant.\n // Same mechanism, and the same 16px → 24px → 48px rhythm, as the Masthead.\n 'px-(--footer-padding-x)',\n '[--footer-padding-x:--spacing(4)] sm:[--footer-padding-x:--spacing(6)] lg:[--footer-padding-x:--spacing(12)]',\n ],\n {\n variants: {\n container: {\n // Full-bleed (nswds-app parity). --footer-max-width is still read so a\n // shell app can constrain the inner wrapper without switching variants.\n fluid: 'max-w-[var(--footer-max-width,none)]',\n // Centred content column, legacy nsw-container parity (1200px).\n contained: 'max-w-[var(--footer-max-width,75rem)]',\n },\n },\n defaultVariants: {\n container: 'fluid',\n },\n },\n)\n\n/** A link rendered anywhere in the footer — legal row or site-map column. */\ntype FooterLinkItem = {\n /** Visible link text, e.g. \"Privacy\". */\n name: string\n href: string\n}\n\n/** Alias kept for the legal-links context, where the name reads better. */\ntype FooterLegalLinkItem = FooterLinkItem\n\n/** A social channel rendered as an icon-only link in the small print row. */\ntype FooterSocialLinkItem = {\n /** Channel name, e.g. \"LinkedIn\". Used to build the accessible name. */\n name: string\n href: string\n /**\n * Icon for the channel — the component (`IconLinkedIn`) or an element\n * (`<IconLinkedIn />`). Brand marks (LinkedIn, X, Facebook…) are not part of\n * the NSWDS icon set — which is Material Symbols — so the mark is supplied by\n * the consuming app. It is rendered through `ButtonLink`'s `leadingVisual`\n * slot, which sizes and colours it.\n *\n * `Footer` is server-compatible but `ButtonLink` is not, so a React Server\n * Component assembling `socialLinks` must use the element form; the component\n * form cannot cross the RSC boundary. See `IconSlot`.\n */\n icon: IconSlot\n /**\n * Accessible name for the link. Defaults to `Follow us on {name}`.\n */\n label?: string\n}\n\n// One link treatment for the whole footer — legal row and site-map columns\n// alike — so a consumer never has to reason about which kind they are styling.\nconst footerLinkClassName = [\n // Negative margin + padding keeps the hover/focus halo from shifting layout.\n '-m-1 rounded-sm p-1 text-(--footer-ink)',\n 'underline decoration-current underline-offset-4',\n 'transition-colors motion-reduce:transition-none',\n 'hover:bg-(--footer-halo) hover:decoration-2',\n 'active:bg-(--footer-halo-active) active:decoration-2',\n // outline-(--footer-ink) guarantees the indicator contrasts with the surface\n // on every colour variant (2.4.13 Focus Appearance).\n 'focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--footer-ink)',\n].join(' ')\n\n// Repoints ButtonLink's ghost-variant tokens at the footer's ink and halos so\n// the social buttons follow the surface colour instead of the button palette.\nconst footerSocialLinkClassName = [\n '[--btn-bg:var(--footer-ink)]',\n '[--btn-icon:var(--footer-ink)]',\n '[--btn-transparent:transparent]',\n '[--btn-hover-overlay:var(--footer-halo)]',\n '[--btn-active-overlay:var(--footer-halo-active)]',\n].join(' ')\n\ntype FooterSocialLinkProps = Omit<\n React.ComponentPropsWithoutRef<typeof ButtonLink>,\n 'children' | 'color' | 'leadingVisual' | 'size' | 'variant'\n> & {\n /** Channel mark — component or element. See `IconSlot`. */\n icon: IconSlot\n /** Accessible name, e.g. \"Follow us on LinkedIn\". */\n label: string\n}\n\n/**\n * Icon-only link to a social channel. Renders through `ButtonLink`, so it\n * picks up the framework link component from `LinkProvider` and the 44px touch\n * target. The label is supplied as `aria-label` — there is no visible text.\n */\nfunction FooterSocialLink({ className, icon, label, ...props }: FooterSocialLinkProps) {\n return (\n <ButtonLink\n data-slot='footer-social-link'\n {...props}\n aria-label={label}\n variant='ghost'\n size='icon'\n leadingVisual={icon}\n className={cn(footerSocialLinkClassName, className)}\n />\n )\n}\n\ntype FooterAcknowledgementProps = React.ComponentPropsWithoutRef<'div'> & {\n ref?: React.Ref<HTMLDivElement>\n}\n\n/**\n * Acknowledgement of Country. Renders the standard NSW Government wording\n * unless `children` are supplied — pass your own text when an agency has\n * agreed different wording with the relevant Traditional Custodians.\n */\nfunction FooterAcknowledgement({ className, children, ref, ...props }: FooterAcknowledgementProps) {\n return (\n <div\n data-slot='footer-acknowledgement'\n {...props}\n className={cn('flex flex-row items-center gap-5 py-4', className)}\n ref={ref}\n >\n <p className='text-center text-base text-pretty text-(--footer-ink) lg:text-left'>\n {children ??\n 'We acknowledge the Traditional Custodians of the land on which we work and live, and pay our respects to Elders past, present and emerging.'}\n </p>\n </div>\n )\n}\n\ntype FooterLegalLinksProps = Omit<React.ComponentPropsWithoutRef<'nav'>, 'children'> & {\n legalLinks: FooterLegalLinkItem[]\n ref?: React.Ref<HTMLElement>\n}\n\n/**\n * Navigation landmark holding the footer's supporting/legal links. Renders\n * nothing when `legalLinks` is empty, so an empty landmark is never exposed to\n * assistive tech.\n */\nfunction FooterLegalLinks({\n className,\n legalLinks,\n 'aria-label': ariaLabel = 'Footer',\n ref,\n ...props\n}: FooterLegalLinksProps) {\n if (legalLinks.length === 0) {\n return null\n }\n\n return (\n <nav\n data-slot='footer-legal-links'\n {...props}\n aria-label={ariaLabel}\n className={cn(\n 'flex flex-wrap justify-center gap-x-4 gap-y-3 py-4 text-sm lg:justify-start',\n className,\n )}\n ref={ref}\n >\n {legalLinks.map((item) => (\n // variant='unstyled' — the footer supplies its own link treatment,\n // derived from --footer-ink so it tracks the surface colour. Link's own\n // variants are pinned to the primary palette (and flip in dark mode),\n // which would break on a coloured footer.\n <Link key={item.name} variant='unstyled' href={item.href} className={footerLinkClassName}>\n {item.name}\n </Link>\n ))}\n </nav>\n )\n}\n\ntype FooterNavLinkProps = Omit<React.ComponentPropsWithoutRef<typeof Link>, 'variant'>\n\n/**\n * A single site-map link, carrying the same ink-derived treatment as the legal\n * row. Exposed so a bespoke column layout (a mobile accordion, say) can match\n * the built-in columns without copying class strings.\n */\nfunction FooterNavLink({ className, ...props }: FooterNavLinkProps) {\n return (\n <Link\n data-slot='footer-nav-link'\n variant='unstyled'\n {...props}\n className={cn(footerLinkClassName, className)}\n />\n )\n}\n\ntype FooterNavProps = React.ComponentPropsWithoutRef<'nav'> & {\n ref?: React.Ref<HTMLElement>\n}\n\n/**\n * Navigation landmark wrapping the footer's site-map columns.\n *\n * One landmark for the whole site map rather than one per column: a large\n * footer would otherwise add five nav landmarks to the page, burying the ones\n * that matter when a screen-reader user lists them. Columns are headed lists\n * inside it. The default four-column grid is overridable — `cn` lets a\n * `lg:grid-cols-3` on `className` win.\n */\nfunction FooterNav({\n className,\n 'aria-label': ariaLabel = 'Site map',\n ref,\n ...props\n}: FooterNavProps) {\n return (\n <nav\n data-slot='footer-nav'\n {...props}\n aria-label={ariaLabel}\n className={cn('grid gap-8 py-4 sm:grid-cols-2 lg:grid-cols-4', className)}\n ref={ref}\n />\n )\n}\n\ntype FooterNavColumnProps = Omit<React.ComponentPropsWithoutRef<'div'>, 'children'> & {\n heading: React.ReactNode\n links: FooterLinkItem[]\n /**\n * Heading level for the column title. Defaults to `2` — correct when the\n * footer sits at the top level of the document outline. Step it down if the\n * surrounding page nests the footer under another heading, so the outline\n * stays in order (WCAG 1.3.1).\n *\n * The two bounds are not symmetric. `6` is simply the deepest heading HTML\n * defines. `1` is excluded on purpose: a site-map column title is never the\n * page's own title, so an `h1` here would be the very outline error the prop\n * exists to avoid.\n */\n headingLevel?: 2 | 3 | 4 | 5 | 6\n ref?: React.Ref<HTMLDivElement>\n}\n\n/** A headed column of site-map links. Sits inside `FooterNav`. */\nfunction FooterNavColumn({\n className,\n heading,\n links,\n headingLevel = 2,\n ref,\n ...props\n}: FooterNavColumnProps) {\n const Heading = `h${headingLevel}` as const\n\n return (\n <div\n data-slot='footer-nav-column'\n {...props}\n className={cn('flex flex-col gap-3', className)}\n ref={ref}\n >\n <Heading className='text-sm font-bold text-(--footer-ink)'>{heading}</Heading>\n <ul className='flex list-none flex-col gap-2 text-sm'>\n {links.map((item) => (\n <li key={item.name}>\n <FooterNavLink href={item.href}>{item.name}</FooterNavLink>\n </li>\n ))}\n </ul>\n </div>\n )\n}\n\ntype FooterSmallPrintProps = React.ComponentPropsWithoutRef<'div'> & {\n /** Owning agency, e.g. \"Digital NSW, Department of Customer Service\". */\n department?: string\n socialLinks?: FooterSocialLinkItem[]\n /**\n * Copyright year. Defaults to the current year read at render time — which\n * on a server-rendered page is the *server's* year, so a request that\n * straddles new year (or a server in a different timezone to the audience)\n * can hydrate with a mismatch. Pass an explicit year to pin it.\n */\n year?: number\n ref?: React.Ref<HTMLDivElement>\n}\n\n/**\n * Copyright line and social channels. `children` replace the generated\n * copyright sentence when an agency needs different wording.\n */\nfunction FooterSmallPrint({\n className,\n department,\n socialLinks,\n year = new Date().getFullYear(),\n children,\n ref,\n ...props\n}: FooterSmallPrintProps) {\n return (\n <div\n data-slot='footer-small-print'\n {...props}\n className={cn('flex flex-col items-center justify-between gap-5 pt-4 sm:flex-row', className)}\n ref={ref}\n >\n <p className='text-center text-sm text-(--footer-ink) lg:text-left'>\n {children ?? (\n <>\n © Copyright {year}\n {department ? ` ${department}` : ''}. All rights reserved.\n </>\n )}\n </p>\n {socialLinks && socialLinks.length > 0 && (\n <ul className='flex list-none justify-center gap-4 lg:justify-end'>\n {socialLinks.map((item) => (\n <li key={item.name}>\n <FooterSocialLink\n href={item.href}\n icon={item.icon}\n label={item.label ?? `Follow us on ${item.name}`}\n />\n </li>\n ))}\n </ul>\n )}\n </div>\n )\n}\n\ntype FooterProps = React.ComponentPropsWithoutRef<'footer'> &\n VariantProps<typeof footerVariants> &\n VariantProps<typeof footerContainerVariants> & {\n /** Supporting/legal links — privacy, accessibility, copyright, etc. */\n legalLinks?: FooterLegalLinkItem[]\n /** Social channels rendered as icon-only links beside the copyright line. */\n socialLinks?: FooterSocialLinkItem[]\n /** Owning agency, named in the copyright line. */\n department?: string\n /**\n * Acknowledgement of Country. `true` (default) renders the standard\n * wording, `false` omits it, and a node replaces the wording.\n */\n acknowledgement?: boolean | React.ReactNode\n /**\n * Copyright line and social channels. Defaults to `true` — the copyright\n * line renders even with no `department` to name, since it is the footer's\n * core content.\n */\n smallPrint?: boolean\n /** Rule along the top edge of the footer content. Defaults to `true`. */\n topBorder?: boolean\n /** Copyright year. See `FooterSmallPrint` for the SSR caveat. */\n year?: number\n /** Classes applied to the inner width-constraining wrapper. */\n containerClassName?: string\n /**\n * Extra content rendered above the acknowledgement — a logo, contact\n * details, or link columns.\n */\n children?: React.ReactNode\n ref?: React.Ref<HTMLElement>\n }\n\n/**\n * End-of-page `contentinfo` landmark: acknowledgement of Country, supporting\n * links, ownership and social channels. Render it once in a shared layout so\n * the same content appears on every page.\n *\n * - `color` themes the surface and names its light-mode tone; dark mode deepens\n * it onto the same family's dark steps. Every option meets WCAG 2.2 AA in\n * light mode and AAA in dark (see `footerColors`). All link, border and hover\n * colours derive from the surface's ink, so they follow automatically in both\n * themes.\n * - `container` selects the inner wrapper layout: `fluid` (full-bleed,\n * nswds-app parity) or `contained` (centred 1200px column, legacy\n * `nsw-container` parity). Fine-tune either with the `--footer-max-width`\n * and `--footer-padding-x` custom properties.\n * - Each section is independently omissible: `acknowledgement={false}`,\n * `smallPrint={false}`, or simply pass no `legalLinks` (an empty nav\n * landmark is never rendered). The rule between the acknowledgement and the\n * link row appears only when there is content on both sides of it.\n *\n * For a layout this does not cover, compose `FooterAcknowledgement`,\n * `FooterLegalLinks`, `FooterSmallPrint` and `FooterSocialLink` directly\n * inside your own `<footer>` — they all read the same `--footer-*` tokens.\n */\nfunction Footer({\n className,\n color,\n container,\n containerClassName,\n legalLinks = [],\n socialLinks,\n department,\n acknowledgement = true,\n smallPrint = true,\n topBorder = true,\n year,\n children,\n ref,\n ...props\n}: FooterProps) {\n // Boolean() rather than `!== false`: an empty string or 0 reaching this prop\n // would otherwise render an empty acknowledgement block.\n const showAcknowledgement = Boolean(acknowledgement)\n const showLegalLinks = legalLinks.length > 0\n\n return (\n <footer\n data-slot='footer'\n data-color={color ?? DEFAULT_FOOTER_COLOR}\n {...props}\n className={cn(footerVariants({ color }), className)}\n ref={ref}\n >\n <div\n data-slot='footer-container'\n className={cn(footerContainerVariants({ container }), containerClassName)}\n >\n {topBorder && <Separator decorative className='mb-4 bg-(--footer-border)' />}\n {children}\n {showAcknowledgement && (\n <FooterAcknowledgement>\n {acknowledgement === true ? undefined : acknowledgement}\n </FooterAcknowledgement>\n )}\n {/* Only a divider — never a boundary between two empty regions. */}\n {showAcknowledgement && (showLegalLinks || smallPrint) && (\n <Separator decorative className='my-4 bg-(--footer-border)' />\n )}\n {showLegalLinks && <FooterLegalLinks legalLinks={legalLinks} />}\n {smallPrint && (\n <FooterSmallPrint department={department} socialLinks={socialLinks} year={year} />\n )}\n </div>\n </footer>\n )\n}\n\nexport {\n Footer,\n FooterAcknowledgement,\n footerColors,\n footerContainerVariants,\n FooterLegalLinks,\n FooterNav,\n FooterNavColumn,\n FooterNavLink,\n FooterSmallPrint,\n FooterSocialLink,\n footerVariants,\n}\nexport type {\n FooterAcknowledgementProps,\n FooterColor,\n FooterLegalLinkItem,\n FooterLegalLinksProps,\n FooterLinkItem,\n FooterNavColumnProps,\n FooterNavLinkProps,\n FooterNavProps,\n FooterProps,\n FooterSmallPrintProps,\n FooterSocialLinkItem,\n FooterSocialLinkProps,\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/footer.tsx"],"names":[],"mappings":";;;;;;;AAyBA,MAAM,YAAA,GAAe;AAAA,EACnB,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,oBAAA,GAAoC,OAAA;AAE1C,MAAM,cAAA,GAAiB,GAAA;AAA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AA,MACpB,GAAG,KAAA;AAAA,MACJ,WAAW,EAAA,CAAG,cAAA,CAAe,EAAE,KAAA,EAAO,GAAG,SAAS,CAAA;AAAA,MAClD,GAAA;AAAA,MAEA,QAAA,kBAAA,IAAA;AAAA,QAAC,KAAA;AAAA,QAAA;AAAA,UACC,WAAA,EAAU,kBAAA;AAAA,UACV,WAAW,EAAA,CAAG,uBAAA,CAAwB,EAAE,SAAA,EAAW,GAAG,kBAAkB,CAAA;AAAA,UAEvE,QAAA,EAAA;AAAA,YAAA,SAAA,oBAAa,GAAA,CAAC,SAAA,EAAA,EAAU,UAAA,EAAU,IAAA,EAAC,WAAU,2BAAA,EAA4B,CAAA;AAAA,YACzE,QAAA;AAAA,YACA,uCACC,GAAA,CAAC,qBAAA,EAAA,EACE,QAAA,EAAA,eAAA,KAAoB,IAAA,GAAO,SAAY,eAAA,EAC1C,CAAA;AAAA,YAGD,mBAAA,KAAwB,kBAAkB,UAAA,CAAA,oBACzC,GAAA,CAAC,aAAU,UAAA,EAAU,IAAA,EAAC,WAAU,2BAAA,EAA4B,CAAA;AAAA,YAE7D,cAAA,oBAAkB,GAAA,CAAC,gBAAA,EAAA,EAAiB,UAAA,EAAwB,CAAA;AAAA,YAC5D,UAAA,oBACC,GAAA,CAAC,gBAAA,EAAA,EAAiB,UAAA,EAAwB,aAA0B,IAAA,EAAY;AAAA;AAAA;AAAA;AAEpF;AAAA,GACF;AAEJ","file":"footer.js","sourcesContent":["import { cva, type VariantProps } from 'class-variance-authority'\nimport React from 'react'\n\nimport { cn } from '../lib/utils.js'\n\nimport { ButtonLink, type IconSlot } from '../components/button.js'\nimport { Link } from '../components/link.js'\nimport { Separator } from '../components/separator.js'\n\n/**\n * Surface colours the footer can be themed with. Each one names its 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 * Every light pair clears WCAG 2.2 AA (1.4.3, 4.5:1) for the footer's smallest\n * text and 11 of the 13 also clear AAA (1.4.6, 7:1). The two AA-only pairs are\n * `primary-600` (4.57:1) and `accent-600` (5.18:1), both with white ink; prefer\n * the `-800` steps when a service is held to AAA. In dark mode all thirteen\n * clear AAA (worst 13.6:1).\n *\n * Unlike `Masthead` — which is restricted to verified AAA pairs because it is\n * legally-mandated identification — the footer carries supporting content, so\n * the full tonal range is offered here.\n */\nconst footerColors = [\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 FooterColor = (typeof footerColors)[number]\n\n// Shared by cva's defaultVariants and the data-color attribute, so the two\n// can't drift apart.\nconst DEFAULT_FOOTER_COLOR: FooterColor = 'white'\n\nconst footerVariants = cva(\n [\n 'w-full',\n // Every derived colour in the footer resolves from a single --footer-ink\n // token, so a colour variant only has to declare the surface utilities and\n // that one value. The derivations are written literally here (once) rather\n // than per-variant: Tailwind scans source text for class names, so a\n // template-built arbitrary property would never be emitted.\n //\n // Mirrors the color-mix derivation in link.tsx (--link-halo).\n '[--footer-border:color-mix(in_oklch,var(--footer-ink)_15%,transparent)]',\n '[--footer-halo:color-mix(in_oklch,var(--footer-ink)_10%,transparent)]',\n '[--footer-halo-active:color-mix(in_oklch,var(--footer-ink)_18%,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 // Note: a bracketed example in a comment here would itself be scanned by\n // Tailwind and emitted as a dead rule — keep such examples out of prose.\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 — so the\n // luminance ORDER within a family is preserved: the variant named for the\n // heaviest tone stays the heaviest. Ink goes white on all thirteen, and\n // every dark pair is WCAG 2.2 AAA (worst 13.6:1) — better than light\n // mode, where primary-600 and accent-600 are AA-only.\n color: {\n 'primary-800':\n 'bg-primary-800 text-white [--footer-ink:var(--color-white)] dark:bg-primary-950',\n 'primary-600':\n 'bg-primary-600 text-white [--footer-ink:var(--color-white)] dark:bg-primary-900',\n 'primary-400':\n 'bg-primary-400 text-primary-800 [--footer-ink:var(--primary-800)] dark:bg-primary-850 dark:text-white dark:[--footer-ink:var(--color-white)]',\n 'primary-200':\n 'bg-primary-200 text-primary-800 [--footer-ink:var(--primary-800)] dark:bg-primary-800 dark:text-white dark:[--footer-ink:var(--color-white)]',\n 'grey-800': 'bg-grey-800 text-white [--footer-ink:var(--color-white)] dark:bg-grey-950',\n 'grey-600': 'bg-grey-600 text-white [--footer-ink:var(--color-white)] dark:bg-grey-900',\n 'grey-400':\n 'bg-grey-400 text-grey-800 [--footer-ink:var(--grey-800)] dark:bg-grey-850 dark:text-white dark:[--footer-ink:var(--color-white)]',\n 'grey-200':\n 'bg-grey-200 text-grey-800 [--footer-ink:var(--grey-800)] dark:bg-grey-800 dark:text-white dark:[--footer-ink:var(--color-white)]',\n 'accent-800':\n 'bg-accent-800 text-white [--footer-ink:var(--color-white)] dark:bg-accent-950',\n 'accent-600':\n 'bg-accent-600 text-white [--footer-ink:var(--color-white)] dark:bg-accent-900',\n 'accent-400':\n 'bg-accent-400 text-accent-800 [--footer-ink:var(--accent-800)] dark:bg-accent-850 dark:text-white dark:[--footer-ink:var(--color-white)]',\n 'accent-200':\n 'bg-accent-200 text-accent-800 [--footer-ink:var(--accent-800)] dark:bg-accent-800 dark:text-white dark:[--footer-ink:var(--color-white)]',\n white:\n 'bg-white text-grey-800 [--footer-ink:var(--grey-800)] dark:bg-grey-900 dark:text-white dark:[--footer-ink:var(--color-white)]',\n },\n },\n defaultVariants: {\n color: DEFAULT_FOOTER_COLOR,\n },\n },\n)\n\nconst footerContainerVariants = cva(\n [\n 'mx-auto flex w-full flex-col max-sm:py-6 sm:py-8',\n // Lateral padding funnels through --footer-padding-x so an app can retune\n // it once (via the `style` prop or a utility class) without a new variant.\n // Same mechanism, and the same 16px → 24px → 48px rhythm, as the Masthead.\n 'px-(--footer-padding-x)',\n '[--footer-padding-x:--spacing(4)] sm:[--footer-padding-x:--spacing(6)] lg:[--footer-padding-x:--spacing(12)]',\n ],\n {\n variants: {\n container: {\n // Full-bleed (nswds-app parity). --footer-max-width is still read so a\n // shell app can constrain the inner wrapper without switching variants.\n fluid: 'max-w-[var(--footer-max-width,none)]',\n // Centred content column, legacy nsw-container parity (1200px).\n contained: 'max-w-[var(--footer-max-width,75rem)]',\n },\n },\n defaultVariants: {\n container: 'fluid',\n },\n },\n)\n\n/** A link rendered anywhere in the footer — legal row or site-map column. */\ntype FooterLinkItem = {\n /** Visible link text, e.g. \"Privacy\". */\n name: string\n href: string\n}\n\n/** Alias kept for the legal-links context, where the name reads better. */\ntype FooterLegalLinkItem = FooterLinkItem\n\n/** A social channel rendered as an icon-only link in the small print row. */\ntype FooterSocialLinkItem = {\n /** Channel name, e.g. \"LinkedIn\". Used to build the accessible name. */\n name: string\n href: string\n /**\n * Icon for the channel — the component (`IconLinkedIn`) or an element\n * (`<IconLinkedIn />`). Brand marks (LinkedIn, X, Facebook…) are not part of\n * the NSWDS icon set — which is Material Symbols — so the mark is supplied by\n * the consuming app. It is rendered through `ButtonLink`'s `leadingVisual`\n * slot, which sizes and colours it.\n *\n * `Footer` is server-compatible but `ButtonLink` is not, so a React Server\n * Component assembling `socialLinks` must use the element form; the component\n * form cannot cross the RSC boundary. See `IconSlot`.\n */\n icon: IconSlot\n /**\n * Accessible name for the link. Defaults to `Follow us on {name}`.\n */\n label?: string\n}\n\n// One link treatment for the whole footer — legal row and site-map columns\n// alike — so a consumer never has to reason about which kind they are styling.\nconst footerLinkClassName = [\n // Negative margin + padding keeps the hover/focus halo from shifting layout.\n '-m-1 rounded-sm p-1 text-(--footer-ink)',\n 'underline decoration-current underline-offset-4',\n 'motion-safe:transition-colors',\n 'hover:bg-(--footer-halo) hover:decoration-2',\n 'active:bg-(--footer-halo-active) active:decoration-2',\n // outline-(--footer-ink) guarantees the indicator contrasts with the surface\n // on every colour variant (2.4.13 Focus Appearance).\n 'focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--footer-ink)',\n].join(' ')\n\n// Repoints ButtonLink's ghost-variant tokens at the footer's ink and halos so\n// the social buttons follow the surface colour instead of the button palette.\nconst footerSocialLinkClassName = [\n '[--btn-bg:var(--footer-ink)]',\n '[--btn-icon:var(--footer-ink)]',\n '[--btn-transparent:transparent]',\n '[--btn-hover-overlay:var(--footer-halo)]',\n '[--btn-active-overlay:var(--footer-halo-active)]',\n].join(' ')\n\ntype FooterSocialLinkProps = Omit<\n React.ComponentPropsWithoutRef<typeof ButtonLink>,\n 'children' | 'color' | 'leadingVisual' | 'size' | 'variant'\n> & {\n /** Channel mark — component or element. See `IconSlot`. */\n icon: IconSlot\n /** Accessible name, e.g. \"Follow us on LinkedIn\". */\n label: string\n}\n\n/**\n * Icon-only link to a social channel. Renders through `ButtonLink`, so it\n * picks up the framework link component from `LinkProvider` and the 44px touch\n * target. The label is supplied as `aria-label` — there is no visible text.\n */\nfunction FooterSocialLink({ className, icon, label, ...props }: FooterSocialLinkProps) {\n return (\n <ButtonLink\n data-slot='footer-social-link'\n {...props}\n aria-label={label}\n variant='ghost'\n size='icon'\n leadingVisual={icon}\n className={cn(footerSocialLinkClassName, className)}\n />\n )\n}\n\ntype FooterAcknowledgementProps = React.ComponentPropsWithoutRef<'div'> & {\n ref?: React.Ref<HTMLDivElement>\n}\n\n/**\n * Acknowledgement of Country. Renders the standard NSW Government wording\n * unless `children` are supplied — pass your own text when an agency has\n * agreed different wording with the relevant Traditional Custodians.\n */\nfunction FooterAcknowledgement({ className, children, ref, ...props }: FooterAcknowledgementProps) {\n return (\n <div\n data-slot='footer-acknowledgement'\n {...props}\n className={cn('flex flex-row items-center gap-5 py-4', className)}\n ref={ref}\n >\n <p className='text-base text-pretty text-(--footer-ink) max-lg:text-center lg:text-left'>\n {children ??\n 'We acknowledge the Traditional Custodians of the land on which we work and live, and pay our respects to Elders past, present and emerging.'}\n </p>\n </div>\n )\n}\n\ntype FooterLegalLinksProps = Omit<React.ComponentPropsWithoutRef<'nav'>, 'children'> & {\n legalLinks: FooterLegalLinkItem[]\n ref?: React.Ref<HTMLElement>\n}\n\n/**\n * Navigation landmark holding the footer's supporting/legal links. Renders\n * nothing when `legalLinks` is empty, so an empty landmark is never exposed to\n * assistive tech.\n */\nfunction FooterLegalLinks({\n className,\n legalLinks,\n 'aria-label': ariaLabel = 'Footer',\n ref,\n ...props\n}: FooterLegalLinksProps) {\n if (legalLinks.length === 0) {\n return null\n }\n\n return (\n <nav\n data-slot='footer-legal-links'\n {...props}\n aria-label={ariaLabel}\n className={cn(\n 'flex flex-wrap gap-x-4 gap-y-3 py-4 text-sm max-lg:justify-center lg:justify-start',\n className,\n )}\n ref={ref}\n >\n {legalLinks.map((item) => (\n // variant='unstyled' — the footer supplies its own link treatment,\n // derived from --footer-ink so it tracks the surface colour. Link's own\n // variants are pinned to the primary palette (and flip in dark mode),\n // which would break on a coloured footer.\n <Link key={item.name} variant='unstyled' href={item.href} className={footerLinkClassName}>\n {item.name}\n </Link>\n ))}\n </nav>\n )\n}\n\ntype FooterNavLinkProps = Omit<React.ComponentPropsWithoutRef<typeof Link>, 'variant'>\n\n/**\n * A single site-map link, carrying the same ink-derived treatment as the legal\n * row. Exposed so a bespoke column layout (a mobile accordion, say) can match\n * the built-in columns without copying class strings.\n */\nfunction FooterNavLink({ className, ...props }: FooterNavLinkProps) {\n return (\n <Link\n data-slot='footer-nav-link'\n variant='unstyled'\n {...props}\n className={cn(footerLinkClassName, className)}\n />\n )\n}\n\ntype FooterNavProps = React.ComponentPropsWithoutRef<'nav'> & {\n ref?: React.Ref<HTMLElement>\n}\n\n/**\n * Navigation landmark wrapping the footer's site-map columns.\n *\n * One landmark for the whole site map rather than one per column: a large\n * footer would otherwise add five nav landmarks to the page, burying the ones\n * that matter when a screen-reader user lists them. Columns are headed lists\n * inside it. The default four-column grid is overridable — `cn` lets a\n * `lg:grid-cols-3` on `className` win.\n */\nfunction FooterNav({\n className,\n 'aria-label': ariaLabel = 'Site map',\n ref,\n ...props\n}: FooterNavProps) {\n return (\n <nav\n data-slot='footer-nav'\n {...props}\n aria-label={ariaLabel}\n className={cn('grid gap-8 py-4 sm:max-lg:grid-cols-2 lg:grid-cols-4', className)}\n ref={ref}\n />\n )\n}\n\ntype FooterNavColumnProps = Omit<React.ComponentPropsWithoutRef<'div'>, 'children'> & {\n heading: React.ReactNode\n links: FooterLinkItem[]\n /**\n * Heading level for the column title. Defaults to `2` — correct when the\n * footer sits at the top level of the document outline. Step it down if the\n * surrounding page nests the footer under another heading, so the outline\n * stays in order (WCAG 1.3.1).\n *\n * The two bounds are not symmetric. `6` is simply the deepest heading HTML\n * defines. `1` is excluded on purpose: a site-map column title is never the\n * page's own title, so an `h1` here would be the very outline error the prop\n * exists to avoid.\n */\n headingLevel?: 2 | 3 | 4 | 5 | 6\n ref?: React.Ref<HTMLDivElement>\n}\n\n/** A headed column of site-map links. Sits inside `FooterNav`. */\nfunction FooterNavColumn({\n className,\n heading,\n links,\n headingLevel = 2,\n ref,\n ...props\n}: FooterNavColumnProps) {\n const Heading = `h${headingLevel}` as const\n\n return (\n <div\n data-slot='footer-nav-column'\n {...props}\n className={cn('flex flex-col gap-3', className)}\n ref={ref}\n >\n <Heading className='text-sm font-bold text-(--footer-ink)'>{heading}</Heading>\n <ul className='flex list-none flex-col gap-2 text-sm'>\n {links.map((item) => (\n <li key={item.name}>\n <FooterNavLink href={item.href}>{item.name}</FooterNavLink>\n </li>\n ))}\n </ul>\n </div>\n )\n}\n\ntype FooterSmallPrintProps = React.ComponentPropsWithoutRef<'div'> & {\n /** Owning agency, e.g. \"Digital NSW, Department of Customer Service\". */\n department?: string\n socialLinks?: FooterSocialLinkItem[]\n /**\n * Copyright year. Defaults to the current year read at render time — which\n * on a server-rendered page is the *server's* year, so a request that\n * straddles new year (or a server in a different timezone to the audience)\n * can hydrate with a mismatch. Pass an explicit year to pin it.\n */\n year?: number\n ref?: React.Ref<HTMLDivElement>\n}\n\n/**\n * Copyright line and social channels. `children` replace the generated\n * copyright sentence when an agency needs different wording.\n */\nfunction FooterSmallPrint({\n className,\n department,\n socialLinks,\n year = new Date().getFullYear(),\n children,\n ref,\n ...props\n}: FooterSmallPrintProps) {\n return (\n <div\n data-slot='footer-small-print'\n {...props}\n className={cn(\n 'flex items-center justify-between gap-5 pt-4 max-sm:flex-col sm:flex-row',\n className,\n )}\n ref={ref}\n >\n <p className='text-sm text-(--footer-ink) max-lg:text-center lg:text-left'>\n {children ?? (\n <>\n © Copyright {year}\n {department ? ` ${department}` : ''}. All rights reserved.\n </>\n )}\n </p>\n {socialLinks && socialLinks.length > 0 && (\n <ul className='flex list-none gap-4 max-lg:justify-center lg:justify-end'>\n {socialLinks.map((item) => (\n <li key={item.name}>\n <FooterSocialLink\n href={item.href}\n icon={item.icon}\n label={item.label ?? `Follow us on ${item.name}`}\n />\n </li>\n ))}\n </ul>\n )}\n </div>\n )\n}\n\ntype FooterProps = React.ComponentPropsWithoutRef<'footer'> &\n VariantProps<typeof footerVariants> &\n VariantProps<typeof footerContainerVariants> & {\n /** Supporting/legal links — privacy, accessibility, copyright, etc. */\n legalLinks?: FooterLegalLinkItem[]\n /** Social channels rendered as icon-only links beside the copyright line. */\n socialLinks?: FooterSocialLinkItem[]\n /** Owning agency, named in the copyright line. */\n department?: string\n /**\n * Acknowledgement of Country. `true` (default) renders the standard\n * wording, `false` omits it, and a node replaces the wording.\n */\n acknowledgement?: boolean | React.ReactNode\n /**\n * Copyright line and social channels. Defaults to `true` — the copyright\n * line renders even with no `department` to name, since it is the footer's\n * core content.\n */\n smallPrint?: boolean\n /** Rule along the top edge of the footer content. Defaults to `true`. */\n topBorder?: boolean\n /** Copyright year. See `FooterSmallPrint` for the SSR caveat. */\n year?: number\n /** Classes applied to the inner width-constraining wrapper. */\n containerClassName?: string\n /**\n * Extra content rendered above the acknowledgement — a logo, contact\n * details, or link columns.\n */\n children?: React.ReactNode\n ref?: React.Ref<HTMLElement>\n }\n\n/**\n * End-of-page `contentinfo` landmark: acknowledgement of Country, supporting\n * links, ownership and social channels. Render it once in a shared layout so\n * the same content appears on every page.\n *\n * - `color` themes the surface and names its light-mode tone; dark mode deepens\n * it onto the same family's dark steps. Every option meets WCAG 2.2 AA in\n * light mode and AAA in dark (see `footerColors`). All link, border and hover\n * colours derive from the surface's ink, so they follow automatically in both\n * themes.\n * - `container` selects the inner wrapper layout: `fluid` (full-bleed,\n * nswds-app parity) or `contained` (centred 1200px column, legacy\n * `nsw-container` parity). Fine-tune either with the `--footer-max-width`\n * and `--footer-padding-x` custom properties.\n * - Each section is independently omissible: `acknowledgement={false}`,\n * `smallPrint={false}`, or simply pass no `legalLinks` (an empty nav\n * landmark is never rendered). The rule between the acknowledgement and the\n * link row appears only when there is content on both sides of it.\n *\n * For a layout this does not cover, compose `FooterAcknowledgement`,\n * `FooterLegalLinks`, `FooterSmallPrint` and `FooterSocialLink` directly\n * inside your own `<footer>` — they all read the same `--footer-*` tokens.\n */\nfunction Footer({\n className,\n color,\n container,\n containerClassName,\n legalLinks = [],\n socialLinks,\n department,\n acknowledgement = true,\n smallPrint = true,\n topBorder = true,\n year,\n children,\n ref,\n ...props\n}: FooterProps) {\n // Boolean() rather than `!== false`: an empty string or 0 reaching this prop\n // would otherwise render an empty acknowledgement block.\n const showAcknowledgement = Boolean(acknowledgement)\n const showLegalLinks = legalLinks.length > 0\n\n return (\n <footer\n data-slot='footer'\n data-color={color ?? DEFAULT_FOOTER_COLOR}\n {...props}\n className={cn(footerVariants({ color }), className)}\n ref={ref}\n >\n <div\n data-slot='footer-container'\n className={cn(footerContainerVariants({ container }), containerClassName)}\n >\n {topBorder && <Separator decorative className='mb-4 bg-(--footer-border)' />}\n {children}\n {showAcknowledgement && (\n <FooterAcknowledgement>\n {acknowledgement === true ? undefined : acknowledgement}\n </FooterAcknowledgement>\n )}\n {/* Only a divider — never a boundary between two empty regions. */}\n {showAcknowledgement && (showLegalLinks || smallPrint) && (\n <Separator decorative className='my-4 bg-(--footer-border)' />\n )}\n {showLegalLinks && <FooterLegalLinks legalLinks={legalLinks} />}\n {smallPrint && (\n <FooterSmallPrint department={department} socialLinks={socialLinks} year={year} />\n )}\n </div>\n </footer>\n )\n}\n\nexport {\n Footer,\n FooterAcknowledgement,\n footerColors,\n footerContainerVariants,\n FooterLegalLinks,\n FooterNav,\n FooterNavColumn,\n FooterNavLink,\n FooterSmallPrint,\n FooterSocialLink,\n footerVariants,\n}\nexport type {\n FooterAcknowledgementProps,\n FooterColor,\n FooterLegalLinkItem,\n FooterLegalLinksProps,\n FooterLinkItem,\n FooterNavColumnProps,\n FooterNavLinkProps,\n FooterNavProps,\n FooterProps,\n FooterSmallPrintProps,\n FooterSocialLinkItem,\n FooterSocialLinkProps,\n}\n"]}
|
|
@@ -30,7 +30,7 @@ declare const headerColors: {
|
|
|
30
30
|
};
|
|
31
31
|
type HeaderColor = keyof typeof headerColors;
|
|
32
32
|
declare const headerVariants: (props?: ({
|
|
33
|
-
color?: "
|
|
33
|
+
color?: "white" | "grey" | "light" | "dark" | null | undefined;
|
|
34
34
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
35
35
|
declare const headerContainerVariants: (props?: ({
|
|
36
36
|
container?: "fluid" | "contained" | null | undefined;
|
|
@@ -26,7 +26,7 @@ const headerVariants = cva(
|
|
|
26
26
|
// colour variant and both themes from one value. Mirrors the color-mix
|
|
27
27
|
// derivation in footer.tsx (--footer-border) and link.tsx (--link-halo).
|
|
28
28
|
"[--header-border:color-mix(in_oklch,var(--header-ink)_15%,transparent)]",
|
|
29
|
-
"
|
|
29
|
+
"duration-300 motion-safe:transition-shadow"
|
|
30
30
|
],
|
|
31
31
|
{
|
|
32
32
|
variants: {
|
|
@@ -39,7 +39,7 @@ const headerVariants = cva(
|
|
|
39
39
|
);
|
|
40
40
|
const headerContainerVariants = cva(
|
|
41
41
|
[
|
|
42
|
-
"mx-auto flex w-full flex-wrap items-center justify-between gap-x-4 gap-y-3 py-3 sm:py-4 lg:py-5",
|
|
42
|
+
"mx-auto flex w-full flex-wrap items-center justify-between gap-x-4 gap-y-3 max-sm:py-3 sm:max-lg:py-4 lg:py-5",
|
|
43
43
|
// Lateral padding funnels through --header-padding-x so an app can retune it
|
|
44
44
|
// once (via the `style` prop or a utility class) without a new variant. Same
|
|
45
45
|
// mechanism, and the same 16px → 24px → 48px rhythm, as Masthead and Footer.
|
|
@@ -111,7 +111,7 @@ function HeaderBrand({
|
|
|
111
111
|
{
|
|
112
112
|
"data-slot": "header-brand",
|
|
113
113
|
...props,
|
|
114
|
-
className: cn("flex grow basis-0 items-center gap-3 sm:gap-4", className),
|
|
114
|
+
className: cn("flex grow basis-0 items-center max-sm:gap-3 sm:gap-4", className),
|
|
115
115
|
ref,
|
|
116
116
|
children: [
|
|
117
117
|
/* @__PURE__ */ jsxs(
|
|
@@ -120,7 +120,7 @@ function HeaderBrand({
|
|
|
120
120
|
variant: "unstyled",
|
|
121
121
|
href,
|
|
122
122
|
"aria-label": label,
|
|
123
|
-
className: "-m-1 flex items-center
|
|
123
|
+
className: "-m-1 flex items-center rounded-sm p-1 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-current max-sm:gap-3 sm:gap-4",
|
|
124
124
|
children: [
|
|
125
125
|
logoNode,
|
|
126
126
|
sitename ? (
|
|
@@ -133,7 +133,7 @@ function HeaderBrand({
|
|
|
133
133
|
Sitename,
|
|
134
134
|
{
|
|
135
135
|
className: cn(
|
|
136
|
-
"
|
|
136
|
+
"font-bold text-balance max-sm:text-lg sm:text-xl",
|
|
137
137
|
!onDarkSurface && "text-primary-800 dark:text-white"
|
|
138
138
|
),
|
|
139
139
|
children: sitename
|
|
@@ -174,7 +174,10 @@ function HeaderActions({ className, ref, ...props }) {
|
|
|
174
174
|
{
|
|
175
175
|
"data-slot": "header-actions",
|
|
176
176
|
...props,
|
|
177
|
-
className: cn(
|
|
177
|
+
className: cn(
|
|
178
|
+
"flex basis-0 items-center justify-end max-sm:gap-2 sm:gap-4 md:grow",
|
|
179
|
+
className
|
|
180
|
+
),
|
|
178
181
|
ref
|
|
179
182
|
}
|
|
180
183
|
);
|