@nswds/ui 4.1.6 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,200 @@
1
+ import * as class_variance_authority_types from 'class-variance-authority/types';
2
+ import { VariantProps } from 'class-variance-authority';
3
+ import React__default from 'react';
4
+ import { ButtonLink } from './button.js';
5
+ import { Link } from './link.js';
6
+ import '@base-ui/react/button';
7
+
8
+ /**
9
+ * Surface colours the footer can be themed with. Each one names its LIGHT-mode
10
+ * surface; dark mode deepens it onto the same family's dark steps (see the
11
+ * `color` variants below), so `color` expresses tonal weight rather than a
12
+ * literal colour.
13
+ *
14
+ * Every light pair clears WCAG 2.2 AA (1.4.3, 4.5:1) for the footer's smallest
15
+ * text and 11 of the 13 also clear AAA (1.4.6, 7:1). The two AA-only pairs are
16
+ * `primary-600` (4.57:1) and `accent-600` (5.18:1), both with white ink; prefer
17
+ * the `-800` steps when a service is held to AAA. In dark mode all thirteen
18
+ * clear AAA (worst 13.6:1).
19
+ *
20
+ * Unlike `Masthead` — which is restricted to verified AAA pairs because it is
21
+ * legally-mandated identification — the footer carries supporting content, so
22
+ * the full tonal range is offered here.
23
+ */
24
+ declare const footerColors: readonly ["primary-800", "primary-600", "primary-400", "primary-200", "grey-800", "grey-600", "grey-400", "grey-200", "accent-800", "accent-600", "accent-400", "accent-200", "white"];
25
+ type FooterColor = (typeof footerColors)[number];
26
+ declare const footerVariants: (props?: ({
27
+ color?: "white" | "primary-800" | "primary-600" | "primary-400" | "primary-200" | "grey-800" | "grey-600" | "grey-400" | "grey-200" | "accent-800" | "accent-600" | "accent-400" | "accent-200" | null | undefined;
28
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
29
+ declare const footerContainerVariants: (props?: ({
30
+ container?: "fluid" | "contained" | null | undefined;
31
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
32
+ /** A link rendered anywhere in the footer — legal row or site-map column. */
33
+ type FooterLinkItem = {
34
+ /** Visible link text, e.g. "Privacy". */
35
+ name: string;
36
+ href: string;
37
+ };
38
+ /** Alias kept for the legal-links context, where the name reads better. */
39
+ type FooterLegalLinkItem = FooterLinkItem;
40
+ /** A social channel rendered as an icon-only link in the small print row. */
41
+ type FooterSocialLinkItem = {
42
+ /** Channel name, e.g. "LinkedIn". Used to build the accessible name. */
43
+ name: string;
44
+ href: string;
45
+ /**
46
+ * Icon component for the channel. Brand marks (LinkedIn, X, Facebook…) are
47
+ * not part of the NSWDS icon set — which is Material Symbols — so the mark is
48
+ * supplied by the consuming app. It is rendered through `ButtonLink`'s
49
+ * `leadingVisual` slot, which sizes and colours it.
50
+ */
51
+ icon: React__default.ElementType;
52
+ /**
53
+ * Accessible name for the link. Defaults to `Follow us on {name}`.
54
+ */
55
+ label?: string;
56
+ };
57
+ type FooterSocialLinkProps = Omit<React__default.ComponentPropsWithoutRef<typeof ButtonLink>, 'children' | 'color' | 'leadingVisual' | 'size' | 'variant'> & {
58
+ icon: React__default.ElementType;
59
+ /** Accessible name, e.g. "Follow us on LinkedIn". */
60
+ label: string;
61
+ };
62
+ /**
63
+ * Icon-only link to a social channel. Renders through `ButtonLink`, so it
64
+ * picks up the framework link component from `LinkProvider` and the 44px touch
65
+ * target. The label is supplied as `aria-label` — there is no visible text.
66
+ */
67
+ declare function FooterSocialLink({ className, icon, label, ...props }: FooterSocialLinkProps): React__default.JSX.Element;
68
+ type FooterAcknowledgementProps = React__default.ComponentPropsWithoutRef<'div'> & {
69
+ ref?: React__default.Ref<HTMLDivElement>;
70
+ };
71
+ /**
72
+ * Acknowledgement of Country. Renders the standard NSW Government wording
73
+ * unless `children` are supplied — pass your own text when an agency has
74
+ * agreed different wording with the relevant Traditional Custodians.
75
+ */
76
+ declare function FooterAcknowledgement({ className, children, ref, ...props }: FooterAcknowledgementProps): React__default.JSX.Element;
77
+ type FooterLegalLinksProps = Omit<React__default.ComponentPropsWithoutRef<'nav'>, 'children'> & {
78
+ legalLinks: FooterLegalLinkItem[];
79
+ ref?: React__default.Ref<HTMLElement>;
80
+ };
81
+ /**
82
+ * Navigation landmark holding the footer's supporting/legal links. Renders
83
+ * nothing when `legalLinks` is empty, so an empty landmark is never exposed to
84
+ * assistive tech.
85
+ */
86
+ declare function FooterLegalLinks({ className, legalLinks, 'aria-label': ariaLabel, ref, ...props }: FooterLegalLinksProps): React__default.JSX.Element | null;
87
+ type FooterNavLinkProps = Omit<React__default.ComponentPropsWithoutRef<typeof Link>, 'variant'>;
88
+ /**
89
+ * A single site-map link, carrying the same ink-derived treatment as the legal
90
+ * row. Exposed so a bespoke column layout (a mobile accordion, say) can match
91
+ * the built-in columns without copying class strings.
92
+ */
93
+ declare function FooterNavLink({ className, ...props }: FooterNavLinkProps): React__default.JSX.Element;
94
+ type FooterNavProps = React__default.ComponentPropsWithoutRef<'nav'> & {
95
+ ref?: React__default.Ref<HTMLElement>;
96
+ };
97
+ /**
98
+ * Navigation landmark wrapping the footer's site-map columns.
99
+ *
100
+ * One landmark for the whole site map rather than one per column: a large
101
+ * footer would otherwise add five nav landmarks to the page, burying the ones
102
+ * that matter when a screen-reader user lists them. Columns are headed lists
103
+ * inside it. The default four-column grid is overridable — `cn` lets a
104
+ * `lg:grid-cols-3` on `className` win.
105
+ */
106
+ declare function FooterNav({ className, 'aria-label': ariaLabel, ref, ...props }: FooterNavProps): React__default.JSX.Element;
107
+ type FooterNavColumnProps = Omit<React__default.ComponentPropsWithoutRef<'div'>, 'children'> & {
108
+ heading: React__default.ReactNode;
109
+ links: FooterLinkItem[];
110
+ /**
111
+ * Heading level for the column title. Defaults to `2` — correct when the
112
+ * footer sits at the top level of the document outline. Step it down if the
113
+ * surrounding page nests the footer under another heading, so the outline
114
+ * stays in order (WCAG 1.3.1).
115
+ *
116
+ * The two bounds are not symmetric. `6` is simply the deepest heading HTML
117
+ * defines. `1` is excluded on purpose: a site-map column title is never the
118
+ * page's own title, so an `h1` here would be the very outline error the prop
119
+ * exists to avoid.
120
+ */
121
+ headingLevel?: 2 | 3 | 4 | 5 | 6;
122
+ ref?: React__default.Ref<HTMLDivElement>;
123
+ };
124
+ /** A headed column of site-map links. Sits inside `FooterNav`. */
125
+ declare function FooterNavColumn({ className, heading, links, headingLevel, ref, ...props }: FooterNavColumnProps): React__default.JSX.Element;
126
+ type FooterSmallPrintProps = React__default.ComponentPropsWithoutRef<'div'> & {
127
+ /** Owning agency, e.g. "Digital NSW, Department of Customer Service". */
128
+ department?: string;
129
+ socialLinks?: FooterSocialLinkItem[];
130
+ /**
131
+ * Copyright year. Defaults to the current year read at render time — which
132
+ * on a server-rendered page is the *server's* year, so a request that
133
+ * straddles new year (or a server in a different timezone to the audience)
134
+ * can hydrate with a mismatch. Pass an explicit year to pin it.
135
+ */
136
+ year?: number;
137
+ ref?: React__default.Ref<HTMLDivElement>;
138
+ };
139
+ /**
140
+ * Copyright line and social channels. `children` replace the generated
141
+ * copyright sentence when an agency needs different wording.
142
+ */
143
+ declare function FooterSmallPrint({ className, department, socialLinks, year, children, ref, ...props }: FooterSmallPrintProps): React__default.JSX.Element;
144
+ type FooterProps = React__default.ComponentPropsWithoutRef<'footer'> & VariantProps<typeof footerVariants> & VariantProps<typeof footerContainerVariants> & {
145
+ /** Supporting/legal links — privacy, accessibility, copyright, etc. */
146
+ legalLinks?: FooterLegalLinkItem[];
147
+ /** Social channels rendered as icon-only links beside the copyright line. */
148
+ socialLinks?: FooterSocialLinkItem[];
149
+ /** Owning agency, named in the copyright line. */
150
+ department?: string;
151
+ /**
152
+ * Acknowledgement of Country. `true` (default) renders the standard
153
+ * wording, `false` omits it, and a node replaces the wording.
154
+ */
155
+ acknowledgement?: boolean | React__default.ReactNode;
156
+ /**
157
+ * Copyright line and social channels. Defaults to `true` — the copyright
158
+ * line renders even with no `department` to name, since it is the footer's
159
+ * core content.
160
+ */
161
+ smallPrint?: boolean;
162
+ /** Rule along the top edge of the footer content. Defaults to `true`. */
163
+ topBorder?: boolean;
164
+ /** Copyright year. See `FooterSmallPrint` for the SSR caveat. */
165
+ year?: number;
166
+ /** Classes applied to the inner width-constraining wrapper. */
167
+ containerClassName?: string;
168
+ /**
169
+ * Extra content rendered above the acknowledgement — a logo, contact
170
+ * details, or link columns.
171
+ */
172
+ children?: React__default.ReactNode;
173
+ ref?: React__default.Ref<HTMLElement>;
174
+ };
175
+ /**
176
+ * End-of-page `contentinfo` landmark: acknowledgement of Country, supporting
177
+ * links, ownership and social channels. Render it once in a shared layout so
178
+ * the same content appears on every page.
179
+ *
180
+ * - `color` themes the surface and names its light-mode tone; dark mode deepens
181
+ * it onto the same family's dark steps. Every option meets WCAG 2.2 AA in
182
+ * light mode and AAA in dark (see `footerColors`). All link, border and hover
183
+ * colours derive from the surface's ink, so they follow automatically in both
184
+ * themes.
185
+ * - `container` selects the inner wrapper layout: `fluid` (full-bleed,
186
+ * nswds-app parity) or `contained` (centred 1200px column, legacy
187
+ * `nsw-container` parity). Fine-tune either with the `--footer-max-width`
188
+ * and `--footer-padding-x` custom properties.
189
+ * - Each section is independently omissible: `acknowledgement={false}`,
190
+ * `smallPrint={false}`, or simply pass no `legalLinks` (an empty nav
191
+ * landmark is never rendered). The rule between the acknowledgement and the
192
+ * link row appears only when there is content on both sides of it.
193
+ *
194
+ * For a layout this does not cover, compose `FooterAcknowledgement`,
195
+ * `FooterLegalLinks`, `FooterSmallPrint` and `FooterSocialLink` directly
196
+ * inside your own `<footer>` — they all read the same `--footer-*` tokens.
197
+ */
198
+ declare function Footer({ className, color, container, containerClassName, legalLinks, socialLinks, department, acknowledgement, smallPrint, topBorder, year, children, ref, ...props }: FooterProps): React__default.JSX.Element;
199
+
200
+ export { Footer, FooterAcknowledgement, type FooterAcknowledgementProps, type FooterColor, type FooterLegalLinkItem, FooterLegalLinks, type FooterLegalLinksProps, type FooterLinkItem, FooterNav, FooterNavColumn, type FooterNavColumnProps, FooterNavLink, type FooterNavLinkProps, type FooterNavProps, type FooterProps, FooterSmallPrint, type FooterSmallPrintProps, FooterSocialLink, type FooterSocialLinkItem, type FooterSocialLinkProps, footerColors, footerContainerVariants, footerVariants };
@@ -0,0 +1,309 @@
1
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
+ import { cva } from 'class-variance-authority';
3
+ import { cn } from '../lib/utils.js';
4
+ import { ButtonLink } from '../components/button.js';
5
+ import { Link } from '../components/link.js';
6
+ import { Separator } from '../components/separator.js';
7
+
8
+ const footerColors = [
9
+ "primary-800",
10
+ "primary-600",
11
+ "primary-400",
12
+ "primary-200",
13
+ "grey-800",
14
+ "grey-600",
15
+ "grey-400",
16
+ "grey-200",
17
+ "accent-800",
18
+ "accent-600",
19
+ "accent-400",
20
+ "accent-200",
21
+ "white"
22
+ ];
23
+ const DEFAULT_FOOTER_COLOR = "white";
24
+ const footerVariants = cva(
25
+ [
26
+ "w-full",
27
+ // Every derived colour in the footer resolves from a single --footer-ink
28
+ // token, so a colour variant only has to declare the surface utilities and
29
+ // that one value. The derivations are written literally here (once) rather
30
+ // than per-variant: Tailwind scans source text for class names, so a
31
+ // template-built arbitrary property would never be emitted.
32
+ //
33
+ // Mirrors the color-mix derivation in link.tsx (--link-halo).
34
+ "[--footer-border:color-mix(in_oklch,var(--footer-ink)_15%,transparent)]",
35
+ "[--footer-halo:color-mix(in_oklch,var(--footer-ink)_10%,transparent)]",
36
+ "[--footer-halo-active:color-mix(in_oklch,var(--footer-ink)_18%,transparent)]"
37
+ ],
38
+ {
39
+ variants: {
40
+ // Ink values use the RAW masterbrand tokens (--primary-800, --grey-800,
41
+ // --accent-800) rather than Tailwind's --color-* bridge aliases. Tailwind
42
+ // v4 tree-shakes an unreferenced @theme key, and referencing one from
43
+ // inside an arbitrary property is not a usage signal — the raw tokens are
44
+ // plain :root declarations from @nswds/tokens and always resolve.
45
+ // (--color-white is safe: `text-white` / `bg-white` below are real
46
+ // utilities, so that key is always emitted.)
47
+ //
48
+ // Note: a bracketed example in a comment here would itself be scanned by
49
+ // Tailwind and emitted as a dead rule — keep such examples out of prose.
50
+ // Dark mode deepens every surface onto the same family's dark steps —
51
+ // -800→-950, -600→-900, -400→-850, -200→-800, white→grey-900 — so the
52
+ // luminance ORDER within a family is preserved: the variant named for the
53
+ // heaviest tone stays the heaviest. Ink goes white on all thirteen, and
54
+ // every dark pair is WCAG 2.2 AAA (worst 13.6:1) — better than light
55
+ // mode, where primary-600 and accent-600 are AA-only.
56
+ color: {
57
+ "primary-800": "bg-primary-800 text-white [--footer-ink:var(--color-white)] dark:bg-primary-950",
58
+ "primary-600": "bg-primary-600 text-white [--footer-ink:var(--color-white)] dark:bg-primary-900",
59
+ "primary-400": "bg-primary-400 text-primary-800 [--footer-ink:var(--primary-800)] dark:bg-primary-850 dark:text-white dark:[--footer-ink:var(--color-white)]",
60
+ "primary-200": "bg-primary-200 text-primary-800 [--footer-ink:var(--primary-800)] dark:bg-primary-800 dark:text-white dark:[--footer-ink:var(--color-white)]",
61
+ "grey-800": "bg-grey-800 text-white [--footer-ink:var(--color-white)] dark:bg-grey-950",
62
+ "grey-600": "bg-grey-600 text-white [--footer-ink:var(--color-white)] dark:bg-grey-900",
63
+ "grey-400": "bg-grey-400 text-grey-800 [--footer-ink:var(--grey-800)] dark:bg-grey-850 dark:text-white dark:[--footer-ink:var(--color-white)]",
64
+ "grey-200": "bg-grey-200 text-grey-800 [--footer-ink:var(--grey-800)] dark:bg-grey-800 dark:text-white dark:[--footer-ink:var(--color-white)]",
65
+ "accent-800": "bg-accent-800 text-white [--footer-ink:var(--color-white)] dark:bg-accent-950",
66
+ "accent-600": "bg-accent-600 text-white [--footer-ink:var(--color-white)] dark:bg-accent-900",
67
+ "accent-400": "bg-accent-400 text-accent-800 [--footer-ink:var(--accent-800)] dark:bg-accent-850 dark:text-white dark:[--footer-ink:var(--color-white)]",
68
+ "accent-200": "bg-accent-200 text-accent-800 [--footer-ink:var(--accent-800)] dark:bg-accent-800 dark:text-white dark:[--footer-ink:var(--color-white)]",
69
+ white: "bg-white text-grey-800 [--footer-ink:var(--grey-800)] dark:bg-grey-900 dark:text-white dark:[--footer-ink:var(--color-white)]"
70
+ }
71
+ },
72
+ defaultVariants: {
73
+ color: DEFAULT_FOOTER_COLOR
74
+ }
75
+ }
76
+ );
77
+ const footerContainerVariants = cva(
78
+ [
79
+ "mx-auto flex w-full flex-col py-6 sm:py-8",
80
+ // Lateral padding funnels through --footer-padding-x so an app can retune
81
+ // it once (via the `style` prop or a utility class) without a new variant.
82
+ // Same mechanism, and the same 16px → 24px → 48px rhythm, as the Masthead.
83
+ "px-(--footer-padding-x)",
84
+ "[--footer-padding-x:--spacing(4)] sm:[--footer-padding-x:--spacing(6)] lg:[--footer-padding-x:--spacing(12)]"
85
+ ],
86
+ {
87
+ variants: {
88
+ container: {
89
+ // Full-bleed (nswds-app parity). --footer-max-width is still read so a
90
+ // shell app can constrain the inner wrapper without switching variants.
91
+ fluid: "max-w-[var(--footer-max-width,none)]",
92
+ // Centred content column, legacy nsw-container parity (1200px).
93
+ contained: "max-w-[var(--footer-max-width,75rem)]"
94
+ }
95
+ },
96
+ defaultVariants: {
97
+ container: "fluid"
98
+ }
99
+ }
100
+ );
101
+ const footerLinkClassName = [
102
+ // Negative margin + padding keeps the hover/focus halo from shifting layout.
103
+ "-m-1 rounded-sm p-1 text-(--footer-ink)",
104
+ "underline decoration-current underline-offset-4",
105
+ "transition-colors motion-reduce:transition-none",
106
+ "hover:bg-(--footer-halo) hover:decoration-2",
107
+ "active:bg-(--footer-halo-active) active:decoration-2",
108
+ // outline-(--footer-ink) guarantees the indicator contrasts with the surface
109
+ // on every colour variant (2.4.13 Focus Appearance).
110
+ "focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--footer-ink)"
111
+ ].join(" ");
112
+ const footerSocialLinkClassName = [
113
+ "[--btn-bg:var(--footer-ink)]",
114
+ "[--btn-icon:var(--footer-ink)]",
115
+ "[--btn-transparent:transparent]",
116
+ "[--btn-hover-overlay:var(--footer-halo)]",
117
+ "[--btn-active-overlay:var(--footer-halo-active)]"
118
+ ].join(" ");
119
+ function FooterSocialLink({ className, icon, label, ...props }) {
120
+ return /* @__PURE__ */ jsx(
121
+ ButtonLink,
122
+ {
123
+ "data-slot": "footer-social-link",
124
+ ...props,
125
+ "aria-label": label,
126
+ variant: "ghost",
127
+ size: "icon",
128
+ leadingVisual: icon,
129
+ className: cn(footerSocialLinkClassName, className)
130
+ }
131
+ );
132
+ }
133
+ function FooterAcknowledgement({ className, children, ref, ...props }) {
134
+ return /* @__PURE__ */ jsx(
135
+ "div",
136
+ {
137
+ "data-slot": "footer-acknowledgement",
138
+ ...props,
139
+ className: cn("flex flex-row items-center gap-5 py-4", className),
140
+ ref,
141
+ children: /* @__PURE__ */ jsx("p", { className: "text-center text-base text-pretty text-(--footer-ink) 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
+ }
143
+ );
144
+ }
145
+ function FooterLegalLinks({
146
+ className,
147
+ legalLinks,
148
+ "aria-label": ariaLabel = "Footer",
149
+ ref,
150
+ ...props
151
+ }) {
152
+ if (legalLinks.length === 0) {
153
+ return null;
154
+ }
155
+ return /* @__PURE__ */ jsx(
156
+ "nav",
157
+ {
158
+ "data-slot": "footer-legal-links",
159
+ ...props,
160
+ "aria-label": ariaLabel,
161
+ className: cn(
162
+ "flex flex-wrap justify-center gap-x-4 gap-y-3 py-4 text-sm lg:justify-start",
163
+ className
164
+ ),
165
+ ref,
166
+ children: legalLinks.map((item) => (
167
+ // variant='unstyled' — the footer supplies its own link treatment,
168
+ // derived from --footer-ink so it tracks the surface colour. Link's own
169
+ // variants are pinned to the primary palette (and flip in dark mode),
170
+ // which would break on a coloured footer.
171
+ /* @__PURE__ */ jsx(Link, { variant: "unstyled", href: item.href, className: footerLinkClassName, children: item.name }, item.name)
172
+ ))
173
+ }
174
+ );
175
+ }
176
+ function FooterNavLink({ className, ...props }) {
177
+ return /* @__PURE__ */ jsx(
178
+ Link,
179
+ {
180
+ "data-slot": "footer-nav-link",
181
+ variant: "unstyled",
182
+ ...props,
183
+ className: cn(footerLinkClassName, className)
184
+ }
185
+ );
186
+ }
187
+ function FooterNav({
188
+ className,
189
+ "aria-label": ariaLabel = "Site map",
190
+ ref,
191
+ ...props
192
+ }) {
193
+ return /* @__PURE__ */ jsx(
194
+ "nav",
195
+ {
196
+ "data-slot": "footer-nav",
197
+ ...props,
198
+ "aria-label": ariaLabel,
199
+ className: cn("grid gap-8 py-4 sm:grid-cols-2 lg:grid-cols-4", className),
200
+ ref
201
+ }
202
+ );
203
+ }
204
+ function FooterNavColumn({
205
+ className,
206
+ heading,
207
+ links,
208
+ headingLevel = 2,
209
+ ref,
210
+ ...props
211
+ }) {
212
+ const Heading = `h${headingLevel}`;
213
+ return /* @__PURE__ */ jsxs(
214
+ "div",
215
+ {
216
+ "data-slot": "footer-nav-column",
217
+ ...props,
218
+ className: cn("flex flex-col gap-3", className),
219
+ ref,
220
+ children: [
221
+ /* @__PURE__ */ jsx(Heading, { className: "text-sm font-bold text-(--footer-ink)", children: heading }),
222
+ /* @__PURE__ */ jsx("ul", { className: "flex list-none flex-col gap-2 text-sm", children: links.map((item) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(FooterNavLink, { href: item.href, children: item.name }) }, item.name)) })
223
+ ]
224
+ }
225
+ );
226
+ }
227
+ function FooterSmallPrint({
228
+ className,
229
+ department,
230
+ socialLinks,
231
+ year = (/* @__PURE__ */ new Date()).getFullYear(),
232
+ children,
233
+ ref,
234
+ ...props
235
+ }) {
236
+ return /* @__PURE__ */ jsxs(
237
+ "div",
238
+ {
239
+ "data-slot": "footer-small-print",
240
+ ...props,
241
+ className: cn("flex flex-col items-center justify-between gap-5 pt-4 sm:flex-row", className),
242
+ ref,
243
+ children: [
244
+ /* @__PURE__ */ jsx("p", { className: "text-center text-sm text-(--footer-ink) lg:text-left", children: children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
245
+ "\xA9 Copyright ",
246
+ year,
247
+ department ? ` ${department}` : "",
248
+ ". All rights reserved."
249
+ ] }) }),
250
+ socialLinks && socialLinks.length > 0 && /* @__PURE__ */ jsx("ul", { className: "flex list-none justify-center gap-4 lg:justify-end", children: socialLinks.map((item) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
251
+ FooterSocialLink,
252
+ {
253
+ href: item.href,
254
+ icon: item.icon,
255
+ label: item.label ?? `Follow us on ${item.name}`
256
+ }
257
+ ) }, item.name)) })
258
+ ]
259
+ }
260
+ );
261
+ }
262
+ function Footer({
263
+ className,
264
+ color,
265
+ container,
266
+ containerClassName,
267
+ legalLinks = [],
268
+ socialLinks,
269
+ department,
270
+ acknowledgement = true,
271
+ smallPrint = true,
272
+ topBorder = true,
273
+ year,
274
+ children,
275
+ ref,
276
+ ...props
277
+ }) {
278
+ const showAcknowledgement = Boolean(acknowledgement);
279
+ const showLegalLinks = legalLinks.length > 0;
280
+ return /* @__PURE__ */ jsx(
281
+ "footer",
282
+ {
283
+ "data-slot": "footer",
284
+ "data-color": color ?? DEFAULT_FOOTER_COLOR,
285
+ ...props,
286
+ className: cn(footerVariants({ color }), className),
287
+ ref,
288
+ children: /* @__PURE__ */ jsxs(
289
+ "div",
290
+ {
291
+ "data-slot": "footer-container",
292
+ className: cn(footerContainerVariants({ container }), containerClassName),
293
+ children: [
294
+ topBorder && /* @__PURE__ */ jsx(Separator, { decorative: true, className: "mb-4 bg-(--footer-border)" }),
295
+ children,
296
+ showAcknowledgement && /* @__PURE__ */ jsx(FooterAcknowledgement, { children: acknowledgement === true ? void 0 : acknowledgement }),
297
+ showAcknowledgement && (showLegalLinks || smallPrint) && /* @__PURE__ */ jsx(Separator, { decorative: true, className: "my-4 bg-(--footer-border)" }),
298
+ showLegalLinks && /* @__PURE__ */ jsx(FooterLegalLinks, { legalLinks }),
299
+ smallPrint && /* @__PURE__ */ jsx(FooterSmallPrint, { department, socialLinks, year })
300
+ ]
301
+ }
302
+ )
303
+ }
304
+ );
305
+ }
306
+
307
+ export { Footer, FooterAcknowledgement, FooterLegalLinks, FooterNav, FooterNavColumn, FooterNavLink, FooterSmallPrint, FooterSocialLink, footerColors, footerContainerVariants, footerVariants };
308
+ //# sourceMappingURL=footer.js.map
309
+ //# sourceMappingURL=footer.js.map
@@ -0,0 +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;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;AAAA,EACrB;AAAA,IACE,QAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQA,yEAAA;AAAA,IACA,uEAAA;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,MAiBR,KAAA,EAAO;AAAA,QACL,aAAA,EACE,iFAAA;AAAA,QACF,aAAA,EACE,iFAAA;AAAA,QACF,aAAA,EACE,8IAAA;AAAA,QACF,aAAA,EACE,8IAAA;AAAA,QACF,UAAA,EAAY,2EAAA;AAAA,QACZ,UAAA,EAAY,2EAAA;AAAA,QACZ,UAAA,EACE,kIAAA;AAAA,QACF,UAAA,EACE,kIAAA;AAAA,QACF,YAAA,EACE,+EAAA;AAAA,QACF,YAAA,EACE,+EAAA;AAAA,QACF,YAAA,EACE,0IAAA;AAAA,QACF,YAAA,EACE,0IAAA;AAAA,QACF,KAAA,EACE;AAAA;AACJ,KACF;AAAA,IACA,eAAA,EAAiB;AAAA,MACf,K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BAAA,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 } 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 component for the channel. Brand marks (LinkedIn, X, Facebook…) are\n * not part of the NSWDS icon set — which is Material Symbols — so the mark is\n * supplied by the consuming app. It is rendered through `ButtonLink`'s\n * `leadingVisual` slot, which sizes and colours it.\n */\n icon: React.ElementType\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 icon: React.ElementType\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 &copy; 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"]}
package/dist/index.d.ts CHANGED
@@ -5,6 +5,7 @@ export { Card, CardAction, CardActionProps, CardContent, CardContentProps, CardD
5
5
  export { Collapsible, CollapsibleContent, CollapsibleTrigger } from './components/collapsible.js';
6
6
  export { Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger } from './components/drawer.js';
7
7
  export { Field, FieldContent, FieldContentProps, FieldDescription, FieldDescriptionProps, FieldError, FieldErrorProps, FieldGroup, FieldGroupProps, FieldLabel, FieldLabelProps, FieldLegend, FieldLegendProps, FieldProps, FieldSeparator, FieldSeparatorProps, FieldSet, FieldSetProps, FieldTitle, FieldTitleProps } from './components/field.js';
8
+ export { Footer, FooterAcknowledgement, FooterAcknowledgementProps, FooterColor, FooterLegalLinkItem, FooterLegalLinks, FooterLegalLinksProps, FooterLinkItem, FooterNav, FooterNavColumn, FooterNavColumnProps, FooterNavLink, FooterNavLinkProps, FooterNavProps, FooterProps, FooterSmallPrint, FooterSmallPrintProps, FooterSocialLink, FooterSocialLinkItem, FooterSocialLinkProps, footerColors, footerContainerVariants, footerVariants } from './components/footer.js';
8
9
  export { HoverCard, HoverCardContent, HoverCardTrigger } from './components/hover-card.js';
9
10
  export { Input, InputProps } from './components/input.js';
10
11
  export { Label, LabelProps } from './components/label.js';
package/dist/index.js CHANGED
@@ -5,6 +5,7 @@ export * from './components/card.js';
5
5
  export * from './components/collapsible.js';
6
6
  export * from './components/drawer.js';
7
7
  export * from './components/field.js';
8
+ export * from './components/footer.js';
8
9
  export * from './components/hover-card.js';
9
10
  export * from './components/input.js';
10
11
  export * from './components/label.js';