@nswds/ui 5.1.2 → 5.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.
- package/README.md +36 -1
- package/dist/components/badge.d.ts +1 -1
- package/dist/components/button.d.ts +1 -1
- package/dist/components/callout.d.ts +60 -0
- package/dist/components/callout.js +65 -0
- package/dist/components/callout.js.map +1 -0
- package/dist/components/container.d.ts +36 -0
- package/dist/components/container.js +54 -0
- package/dist/components/container.js.map +1 -0
- package/dist/components/description-list.d.ts +72 -0
- package/dist/components/description-list.js +67 -0
- package/dist/components/description-list.js.map +1 -0
- package/dist/components/footer.d.ts +10 -6
- package/dist/components/footer.js.map +1 -1
- package/dist/components/header.d.ts +1 -1
- package/dist/components/link-card.d.ts +54 -0
- package/dist/components/link-card.js +82 -0
- package/dist/components/link-card.js.map +1 -0
- package/dist/components/masthead.d.ts +1 -1
- package/dist/components/on-this-page.d.ts +89 -0
- package/dist/components/on-this-page.js +127 -0
- package/dist/components/on-this-page.js.map +1 -0
- package/dist/components/section.d.ts +53 -0
- package/dist/components/section.js +44 -0
- package/dist/components/section.js.map +1 -0
- package/dist/components/skip-link.d.ts +1 -1
- package/dist/components/slider.d.ts +86 -0
- package/dist/components/slider.js +122 -0
- package/dist/components/slider.js.map +1 -0
- package/dist/hooks/use-chrome-height.d.ts +82 -0
- package/dist/hooks/use-chrome-height.js +45 -0
- package/dist/hooks/use-chrome-height.js.map +1 -0
- package/dist/icons/brands/index.d.ts +13 -0
- package/dist/icons/brands/index.js +56 -0
- package/dist/icons/brands/index.js.map +1 -0
- package/dist/icons/client.d.ts +1 -0
- package/dist/icons/client.js +2 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +8 -0
- package/dist/styles.css +1 -1
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -112,9 +112,44 @@ Passing the component itself (`leadingVisual={IconDownload}`) throws there:
|
|
|
112
112
|
|
|
113
113
|
`Button`, `ButtonLink` and `FooterSocialLink` are client components; the icon modules deliberately are not, so they stay server-renderable and a `<IconDownload />` on a server page ships no JavaScript. That means a bare icon function is just a function value, and functions do not serialise across the RSC boundary — an element does. Client components ("use client") can use either form.
|
|
114
114
|
|
|
115
|
+
When you genuinely need the **component** form on a server page — an icon chosen from a lookup table, a prop typed as `ElementType`, a config object shared between server and client code — import from `@nswds/ui/icons/client`, which re-exports the same set as client references:
|
|
116
|
+
|
|
117
|
+
```tsx
|
|
118
|
+
// app/page.tsx — a server component, no 'use client'
|
|
119
|
+
import { ButtonLink } from '@nswds/ui'
|
|
120
|
+
import { IconDownload } from '@nswds/ui/icons/client'
|
|
121
|
+
|
|
122
|
+
export default function Page() {
|
|
123
|
+
return (
|
|
124
|
+
<ButtonLink href='/report.pdf' leadingVisual={IconDownload}>
|
|
125
|
+
Download
|
|
126
|
+
</ButtonLink>
|
|
127
|
+
)
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
That gives up the zero-JavaScript property above — the icon module is sent to the browser — so prefer the element form where it fits.
|
|
132
|
+
|
|
133
|
+
### Brand icons
|
|
134
|
+
|
|
135
|
+
The icon set is Material Symbols and contains no third-party brand marks, but `Footer`'s `socialLinks[].icon` needs one per channel. The six the NSW Government uses ship under their own subpath, already client-safe, so either form works from a server component:
|
|
136
|
+
|
|
137
|
+
```tsx
|
|
138
|
+
import {
|
|
139
|
+
IconFacebook,
|
|
140
|
+
IconGitHub,
|
|
141
|
+
IconInstagram,
|
|
142
|
+
IconLinkedIn,
|
|
143
|
+
IconX,
|
|
144
|
+
IconYouTube,
|
|
145
|
+
} from '@nswds/ui/icons/brands'
|
|
146
|
+
```
|
|
147
|
+
|
|
115
148
|
## Components
|
|
116
149
|
|
|
117
|
-
Badge, Button, ButtonLink, Card, Field, Input, Label, LabeledSeparator, Link, Logo (NSW Government logo), Separator, Spinner — plus the icon set under `@nswds/ui/icons`.
|
|
150
|
+
AspectRatio, Badge, Button, ButtonLink, Callout, Card, Collapsible, Container, DescriptionList, Drawer, ExpandableSearch, Field, Footer, Header, HoverCard, Input, Label, LabeledSeparator, Link, LinkCard, Logo (NSW Government logo), MainNav, Masthead, OnThisPage, Popover, PushMenu, Resizable, ScrollArea, Section, Separator, Sheet, SideNav, SiteSearch, SkipLink, Slider, Spinner, StepIndicator, ThemeSwitcher, Toaster, Tooltip — plus the icon set under `@nswds/ui/icons`.
|
|
151
|
+
|
|
152
|
+
Hooks: `useChromeHeight`, which measures a sticky header and publishes its height as a CSS custom property, for `scroll-padding-top`, `MainNav`'s `--main-nav-top`, and `OnThisPage`'s scroll-spy offset.
|
|
118
153
|
|
|
119
154
|
Every interactive component wraps a Base UI primitive, which provides focus management, keyboard navigation, and ARIA semantics. Each component also exports its `cva` variants function (for example `buttonVariants`) so you can extend styling.
|
|
120
155
|
|
|
@@ -6,7 +6,7 @@ import { Link } from './link.js';
|
|
|
6
6
|
|
|
7
7
|
declare const badgeVariants: (props?: ({
|
|
8
8
|
variant?: "solid" | "soft" | "surface" | "outline" | null | undefined;
|
|
9
|
-
color?: "
|
|
9
|
+
color?: "white" | "grey" | "primary" | "secondary" | "tertiary" | "accent" | "primary/grey" | "light" | "primary/white" | null | undefined;
|
|
10
10
|
size?: "default" | "sm" | "lg" | null | undefined;
|
|
11
11
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
12
12
|
type BadgeProps = VariantProps<typeof badgeVariants> & React__default.ComponentPropsWithoutRef<'span'> & {
|
|
@@ -5,7 +5,7 @@ import React__default from 'react';
|
|
|
5
5
|
import { Link } from './link.js';
|
|
6
6
|
|
|
7
7
|
declare const buttonVariants: (props?: ({
|
|
8
|
-
variant?: "solid" | "soft" | "surface" | "outline" | "
|
|
8
|
+
variant?: "solid" | "soft" | "surface" | "outline" | "ghost" | "link" | null | undefined;
|
|
9
9
|
color?: "white" | "grey" | "primary" | "secondary" | "tertiary" | "accent" | "danger" | "success" | "warning" | null | undefined;
|
|
10
10
|
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
|
|
11
11
|
iconOnly?: boolean | null | undefined;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { VariantProps } from 'class-variance-authority';
|
|
4
|
+
|
|
5
|
+
/** The four message statuses, matching `Toaster`'s vocabulary. */
|
|
6
|
+
type CalloutStatus = 'info' | 'success' | 'warning' | 'danger';
|
|
7
|
+
/**
|
|
8
|
+
* Every colour funnels through a single `--callout-ink` per status, declared on
|
|
9
|
+
* the root so the icon and the border both resolve from one declaration — the
|
|
10
|
+
* same ink-token pattern as `footer.tsx`, `link.tsx` and `step-indicator.tsx`.
|
|
11
|
+
*
|
|
12
|
+
* Values are the RAW `@nswds/tokens` semantic ROLE tokens (`--info-surface`,
|
|
13
|
+
* `--info-text`, …), not the `--color-*` Tailwind bridge aliases. Two reasons,
|
|
14
|
+
* both load-bearing:
|
|
15
|
+
*
|
|
16
|
+
* 1. Tailwind v4 tree-shakes unreferenced `@theme` keys, and an
|
|
17
|
+
* arbitrary-property reference is not a usage signal — the same trap
|
|
18
|
+
* documented on `button.tsx`'s semantic colours and `step-indicator.tsx`'s
|
|
19
|
+
* status inks. The raw tokens are plain `:root` declarations that always
|
|
20
|
+
* resolve.
|
|
21
|
+
* 2. The role tokens already carry their own dark values, scoped
|
|
22
|
+
* `[data-theme=dark], .dark` by `@nswds/tokens`' `semantic/oklch.dark.css`
|
|
23
|
+
* (imported by theme.css). So every status flips with the theme on its own
|
|
24
|
+
* and this component needs no `dark:` variant at all — nothing here can
|
|
25
|
+
* drift out of step with the token library.
|
|
26
|
+
*/
|
|
27
|
+
declare const calloutVariants: (props?: ({
|
|
28
|
+
status?: "danger" | "success" | "warning" | "info" | null | undefined;
|
|
29
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
30
|
+
type CalloutProps = Omit<React.ComponentPropsWithoutRef<'div'>, 'title'> & VariantProps<typeof calloutVariants> & {
|
|
31
|
+
/** Optional bold lead line above the body copy. */
|
|
32
|
+
title?: React.ReactNode;
|
|
33
|
+
/**
|
|
34
|
+
* Replaces the status glyph. Pass `null` to drop it entirely — the status
|
|
35
|
+
* is still carried by the border and surface, and by `title` where one is
|
|
36
|
+
* supplied.
|
|
37
|
+
*/
|
|
38
|
+
icon?: React.ElementType | null;
|
|
39
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* A bordered notice that marks a passage of page content as informational,
|
|
43
|
+
* confirming, cautionary or dangerous.
|
|
44
|
+
*
|
|
45
|
+
* **This is for STATIC content, and carries no live-region semantics.** No
|
|
46
|
+
* `role="alert"`, no `aria-live`: those announce on mount, so a callout that is
|
|
47
|
+
* simply part of the page would interrupt a screen-reader user every time they
|
|
48
|
+
* arrived. Use `Toaster` for a message that appears in response to something
|
|
49
|
+
* the user just did, or `FieldError` for inline validation — both already
|
|
50
|
+
* handle announcement. If you render a `Callout` dynamically and it genuinely
|
|
51
|
+
* needs announcing, own that at the call site with your own live region.
|
|
52
|
+
*
|
|
53
|
+
* **Status is never carried by colour alone** (WCAG 2.2, 1.4.1). The glyph
|
|
54
|
+
* distinguishes the four statuses visually; where the distinction also matters
|
|
55
|
+
* to a screen-reader user, say so in the `title` or the body copy rather than
|
|
56
|
+
* relying on the icon, which is decorative here by design.
|
|
57
|
+
*/
|
|
58
|
+
declare function Callout({ className, status, title, icon, children, ref, ...props }: CalloutProps): React.JSX.Element;
|
|
59
|
+
|
|
60
|
+
export { Callout, type CalloutProps, type CalloutStatus, calloutVariants };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { cva } from 'class-variance-authority';
|
|
3
|
+
import { cn } from '../lib/utils.js';
|
|
4
|
+
import { IconCheckCircle } from '../icons/check-circle.js';
|
|
5
|
+
import { IconError } from '../icons/error.js';
|
|
6
|
+
import { IconInfo } from '../icons/info.js';
|
|
7
|
+
import { IconWarning } from '../icons/warning.js';
|
|
8
|
+
|
|
9
|
+
const CALLOUT_ICONS = {
|
|
10
|
+
info: IconInfo,
|
|
11
|
+
success: IconCheckCircle,
|
|
12
|
+
warning: IconWarning,
|
|
13
|
+
danger: IconError
|
|
14
|
+
};
|
|
15
|
+
const calloutVariants = cva(
|
|
16
|
+
[
|
|
17
|
+
"flex gap-4 rounded-md border p-6",
|
|
18
|
+
"border-(--callout-border) bg-(--callout-surface) text-(--callout-text)"
|
|
19
|
+
],
|
|
20
|
+
{
|
|
21
|
+
variants: {
|
|
22
|
+
status: {
|
|
23
|
+
info: "[--callout-border:var(--info-border)] [--callout-ink:var(--info-solid)] [--callout-surface:var(--info-surface)] [--callout-text:var(--info-text)]",
|
|
24
|
+
success: "[--callout-border:var(--success-border)] [--callout-ink:var(--success-solid)] [--callout-surface:var(--success-surface)] [--callout-text:var(--success-text)]",
|
|
25
|
+
warning: "[--callout-border:var(--warning-border)] [--callout-ink:var(--warning-solid)] [--callout-surface:var(--warning-surface)] [--callout-text:var(--warning-text)]",
|
|
26
|
+
danger: "[--callout-border:var(--danger-border)] [--callout-ink:var(--danger-solid)] [--callout-surface:var(--danger-surface)] [--callout-text:var(--danger-text)]"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
defaultVariants: {
|
|
30
|
+
status: "info"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
function Callout({ className, status, title, icon, children, ref, ...props }) {
|
|
35
|
+
const resolvedStatus = status ?? "info";
|
|
36
|
+
const Icon = icon === void 0 ? CALLOUT_ICONS[resolvedStatus] : icon;
|
|
37
|
+
return /* @__PURE__ */ jsxs(
|
|
38
|
+
"div",
|
|
39
|
+
{
|
|
40
|
+
ref,
|
|
41
|
+
"data-slot": "callout",
|
|
42
|
+
"data-status": resolvedStatus,
|
|
43
|
+
className: cn(calloutVariants({ status, className })),
|
|
44
|
+
...props,
|
|
45
|
+
children: [
|
|
46
|
+
Icon ? /* @__PURE__ */ jsx(
|
|
47
|
+
Icon,
|
|
48
|
+
{
|
|
49
|
+
"aria-hidden": "true",
|
|
50
|
+
"data-slot": "callout-icon",
|
|
51
|
+
className: "mt-0.5 size-6 shrink-0 text-(--callout-ink)"
|
|
52
|
+
}
|
|
53
|
+
) : null,
|
|
54
|
+
/* @__PURE__ */ jsxs("div", { "data-slot": "callout-content", className: "min-w-0 flex-1", children: [
|
|
55
|
+
title ? /* @__PURE__ */ jsx("p", { "data-slot": "callout-title", className: "font-semibold", children: title }) : null,
|
|
56
|
+
children
|
|
57
|
+
] })
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export { Callout, calloutVariants };
|
|
64
|
+
//# sourceMappingURL=callout.js.map
|
|
65
|
+
//# sourceMappingURL=callout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/callout.tsx"],"names":[],"mappings":";;;;;;;;AAuBA,MAAM,aAAA,GAA0D;AAAA,EAC9D,IAAA,EAAM,QAAA;AAAA,EACN,OAAA,EAAS,eAAA;AAAA,EACT,OAAA,EAAS,WAAA;AAAA,EACT,MAAA,EAAQ;AACV,CAAA;AAsBA,MAAM,eAAA,GAAkB,GAAA;AAAA,EACtB;AAAA,IACE,kCAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,MAAA,EAAQ;AAAA,QACN,IAAA,EAAM,mJAAA;AAAA,QACN,OAAA,EACE,+JAAA;AAAA,QACF,OAAA,EACE,+JAAA;AAAA,QACF,MAAA,EACE;AAAA;AACJ,KACF;AAAA,IACA,eAAA,EAAiB;AAAA,MACf,MAAA,EAAQ;AAAA;AACV;AAEJ;AAgCA,SAAS,OAAA,CAAQ,EAAE,SAAA,EAAW,MAAA,EAAQ,KAAA,EAAO,MAAM,QAAA,EAAU,GAAA,EAAK,GAAG,KAAA,EAAM,EAAiB;AAC1F,EAAA,MAAM,iBAAiB,MAAA,IAAU,MAAA;AAIjC,EAAA,MAAM,IAAA,GAAO,IAAA,KAAS,MAAA,GAAY,aAAA,CAAc,cAAc,CAAA,GAAI,IAAA;AAElE,EAAA,uBACE,IAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,WAAA,EAAU,SAAA;AAAA,MACV,aAAA,EAAa,cAAA;AAAA,MACb,WAAW,EAAA,CAAG,eAAA,CAAgB,EAAE,MAAA,EAAQ,SAAA,EAAW,CAAC,CAAA;AAAA,MACnD,GAAG,KAAA;AAAA,MAEH,QAAA,EAAA;AAAA,QAAA,IAAA,mBACC,GAAA;AAAA,UAAC,IAAA;AAAA,UAAA;AAAA,YACC,aAAA,EAAY,MAAA;AAAA,YACZ,WAAA,EAAU,cAAA;AAAA,YAIV,SAAA,EAAU;AAAA;AAAA,SACZ,GACE,IAAA;AAAA,wBACJ,IAAA,CAAC,KAAA,EAAA,EAAI,WAAA,EAAU,iBAAA,EAAkB,WAAU,gBAAA,EACxC,QAAA,EAAA;AAAA,UAAA,KAAA,uBACE,GAAA,EAAA,EAAE,WAAA,EAAU,iBAAgB,SAAA,EAAU,eAAA,EACpC,iBACH,CAAA,GACE,IAAA;AAAA,UACH;AAAA,SAAA,EACH;AAAA;AAAA;AAAA,GACF;AAEJ","file":"callout.js","sourcesContent":["import type * as React from 'react'\n\nimport { cva, type VariantProps } from 'class-variance-authority'\n\nimport { cn } from '../lib/utils.js'\n\nimport { IconCheckCircle } from '../icons/check-circle.js'\nimport { IconError } from '../icons/error.js'\nimport { IconInfo } from '../icons/info.js'\nimport { IconWarning } from '../icons/warning.js'\n\n/** The four message statuses, matching `Toaster`'s vocabulary. */\ntype CalloutStatus = 'info' | 'success' | 'warning' | 'danger'\n\n/**\n * Status → glyph, deliberately identical to the mapping `sonner.tsx` gives its\n * toasts. A success confirmation should carry the same mark whether it arrives\n * as a toast or sits on the page, and a reader who has learnt one has learnt\n * the other.\n *\n * `danger` maps to `IconError` — the status name follows `Button`'s vocabulary\n * (`danger`, not `error`), while the icon name follows Material Symbols'.\n */\nconst CALLOUT_ICONS: Record<CalloutStatus, React.ElementType> = {\n info: IconInfo,\n success: IconCheckCircle,\n warning: IconWarning,\n danger: IconError,\n}\n\n/**\n * Every colour funnels through a single `--callout-ink` per status, declared on\n * the root so the icon and the border both resolve from one declaration — the\n * same ink-token pattern as `footer.tsx`, `link.tsx` and `step-indicator.tsx`.\n *\n * Values are the RAW `@nswds/tokens` semantic ROLE tokens (`--info-surface`,\n * `--info-text`, …), not the `--color-*` Tailwind bridge aliases. Two reasons,\n * both load-bearing:\n *\n * 1. Tailwind v4 tree-shakes unreferenced `@theme` keys, and an\n * arbitrary-property reference is not a usage signal — the same trap\n * documented on `button.tsx`'s semantic colours and `step-indicator.tsx`'s\n * status inks. The raw tokens are plain `:root` declarations that always\n * resolve.\n * 2. The role tokens already carry their own dark values, scoped\n * `[data-theme=dark], .dark` by `@nswds/tokens`' `semantic/oklch.dark.css`\n * (imported by theme.css). So every status flips with the theme on its own\n * and this component needs no `dark:` variant at all — nothing here can\n * drift out of step with the token library.\n */\nconst calloutVariants = cva(\n [\n 'flex gap-4 rounded-md border p-6',\n 'border-(--callout-border) bg-(--callout-surface) text-(--callout-text)',\n ],\n {\n variants: {\n status: {\n info: '[--callout-border:var(--info-border)] [--callout-ink:var(--info-solid)] [--callout-surface:var(--info-surface)] [--callout-text:var(--info-text)]',\n success:\n '[--callout-border:var(--success-border)] [--callout-ink:var(--success-solid)] [--callout-surface:var(--success-surface)] [--callout-text:var(--success-text)]',\n warning:\n '[--callout-border:var(--warning-border)] [--callout-ink:var(--warning-solid)] [--callout-surface:var(--warning-surface)] [--callout-text:var(--warning-text)]',\n danger:\n '[--callout-border:var(--danger-border)] [--callout-ink:var(--danger-solid)] [--callout-surface:var(--danger-surface)] [--callout-text:var(--danger-text)]',\n },\n },\n defaultVariants: {\n status: 'info',\n },\n },\n)\n\ntype CalloutProps = Omit<React.ComponentPropsWithoutRef<'div'>, 'title'> &\n VariantProps<typeof calloutVariants> & {\n /** Optional bold lead line above the body copy. */\n title?: React.ReactNode\n /**\n * Replaces the status glyph. Pass `null` to drop it entirely — the status\n * is still carried by the border and surface, and by `title` where one is\n * supplied.\n */\n icon?: React.ElementType | null\n ref?: React.Ref<HTMLDivElement>\n }\n\n/**\n * A bordered notice that marks a passage of page content as informational,\n * confirming, cautionary or dangerous.\n *\n * **This is for STATIC content, and carries no live-region semantics.** No\n * `role=\"alert\"`, no `aria-live`: those announce on mount, so a callout that is\n * simply part of the page would interrupt a screen-reader user every time they\n * arrived. Use `Toaster` for a message that appears in response to something\n * the user just did, or `FieldError` for inline validation — both already\n * handle announcement. If you render a `Callout` dynamically and it genuinely\n * needs announcing, own that at the call site with your own live region.\n *\n * **Status is never carried by colour alone** (WCAG 2.2, 1.4.1). The glyph\n * distinguishes the four statuses visually; where the distinction also matters\n * to a screen-reader user, say so in the `title` or the body copy rather than\n * relying on the icon, which is decorative here by design.\n */\nfunction Callout({ className, status, title, icon, children, ref, ...props }: CalloutProps) {\n const resolvedStatus = status ?? 'info'\n // `icon` is optional-with-a-default AND nullable-to-disable, so an explicit\n // `null` has to survive: `icon ?? CALLOUT_ICONS[…]` would resurrect the\n // default for exactly the consumer trying to turn it off.\n const Icon = icon === undefined ? CALLOUT_ICONS[resolvedStatus] : icon\n\n return (\n <div\n ref={ref}\n data-slot='callout'\n data-status={resolvedStatus}\n className={cn(calloutVariants({ status, className }))}\n {...props}\n >\n {Icon ? (\n <Icon\n aria-hidden='true'\n data-slot='callout-icon'\n // The icon modules paint `fill=\"currentColor\"`, so setting the text\n // colour here is what tints the glyph — and it keeps working for a\n // consumer-supplied `icon` drawn with strokes rather than fills.\n className='mt-0.5 size-6 shrink-0 text-(--callout-ink)'\n />\n ) : null}\n <div data-slot='callout-content' className='min-w-0 flex-1'>\n {title ? (\n <p data-slot='callout-title' className='font-semibold'>\n {title}\n </p>\n ) : null}\n {children}\n </div>\n </div>\n )\n}\n\nexport { Callout, calloutVariants }\nexport type { CalloutProps, CalloutStatus }\n"]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { VariantProps } from 'class-variance-authority';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The page-width column, carrying the same lateral rhythm the chrome
|
|
7
|
+
* components apply to their own inner wrappers.
|
|
8
|
+
*
|
|
9
|
+
* `Masthead`, `Header`, `MainNav` and `Footer` each declare a private
|
|
10
|
+
* `*ContainerVariants` with an identical `16px → 24px → 48px` padding ramp
|
|
11
|
+
* funnelled through a `--<name>-padding-x` custom property. Nothing exposed
|
|
12
|
+
* that rhythm to page CONTENT, so every consuming app retyped it — and any
|
|
13
|
+
* app that retyped it slightly differently got content that failed to line up
|
|
14
|
+
* with the header above it at one breakpoint but not the others, which is the
|
|
15
|
+
* hardest kind of misalignment to notice in review.
|
|
16
|
+
*
|
|
17
|
+
* The variant names (`fluid` / `contained`) and the `--container-max-width`
|
|
18
|
+
* escape hatch deliberately mirror the chrome's vocabulary, so a shell that
|
|
19
|
+
* themes its `Header` writes the same word here.
|
|
20
|
+
*/
|
|
21
|
+
declare const containerVariants: (props?: ({
|
|
22
|
+
size?: "fluid" | "contained" | "wide" | "narrow" | null | undefined;
|
|
23
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
24
|
+
type ContainerProps = React.ComponentPropsWithoutRef<'div'> & VariantProps<typeof containerVariants> & {
|
|
25
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Width-constraining page column with the NSW lateral rhythm.
|
|
29
|
+
*
|
|
30
|
+
* Purely presentational — it renders a `<div>` and adds no semantics, so it
|
|
31
|
+
* can sit inside any landmark without affecting the document outline. Pair it
|
|
32
|
+
* with `Section` for vertical rhythm.
|
|
33
|
+
*/
|
|
34
|
+
declare function Container({ className, size, ref, ...props }: ContainerProps): React.JSX.Element;
|
|
35
|
+
|
|
36
|
+
export { Container, type ContainerProps, containerVariants };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { cva } from 'class-variance-authority';
|
|
3
|
+
import { cn } from '../lib/utils.js';
|
|
4
|
+
|
|
5
|
+
const containerVariants = cva(
|
|
6
|
+
[
|
|
7
|
+
"mx-auto w-full",
|
|
8
|
+
// Lateral padding funnels through --container-padding-x so an app can
|
|
9
|
+
// retune it once (via the `style` prop or a utility class) without a new
|
|
10
|
+
// variant. Same mechanism, and the same 16px → 24px → 48px rhythm, as
|
|
11
|
+
// Masthead, Header, MainNav and Footer.
|
|
12
|
+
"px-(--container-padding-x)",
|
|
13
|
+
"[--container-padding-x:--spacing(4)] sm:[--container-padding-x:--spacing(6)] lg:[--container-padding-x:--spacing(12)]"
|
|
14
|
+
],
|
|
15
|
+
{
|
|
16
|
+
variants: {
|
|
17
|
+
size: {
|
|
18
|
+
// Full-bleed. Matches the chrome components' own default, so page
|
|
19
|
+
// content and the header line up without either side being
|
|
20
|
+
// reconfigured — the case that has to be right by default.
|
|
21
|
+
// --container-max-width is still read so a shell app can constrain the
|
|
22
|
+
// column without switching variants.
|
|
23
|
+
fluid: "max-w-[var(--container-max-width,none)]",
|
|
24
|
+
// Centred content column, legacy nsw-container parity (1200px). The
|
|
25
|
+
// counterpart to the chrome's `container="contained"`.
|
|
26
|
+
contained: "max-w-[var(--container-max-width,75rem)]",
|
|
27
|
+
// A wider editorial column for landing and specimen pages that want
|
|
28
|
+
// more than 1200px without going full-bleed.
|
|
29
|
+
wide: "max-w-[var(--container-max-width,90rem)]",
|
|
30
|
+
// Reading measure — roughly 65–75 characters at the body size, for
|
|
31
|
+
// long-form prose that should not span a full-width page.
|
|
32
|
+
narrow: "max-w-[var(--container-max-width,45rem)]"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
defaultVariants: {
|
|
36
|
+
size: "fluid"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
function Container({ className, size, ref, ...props }) {
|
|
41
|
+
return /* @__PURE__ */ jsx(
|
|
42
|
+
"div",
|
|
43
|
+
{
|
|
44
|
+
ref,
|
|
45
|
+
"data-slot": "container",
|
|
46
|
+
className: cn(containerVariants({ size, className })),
|
|
47
|
+
...props
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export { Container, containerVariants };
|
|
53
|
+
//# sourceMappingURL=container.js.map
|
|
54
|
+
//# sourceMappingURL=container.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/container.tsx"],"names":[],"mappings":";;;;AAsBA,MAAM,iBAAA,GAAoB,GAAA;AAAA,EACxB;AAAA,IACE,gBAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAKA,4BAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,IAAA,EAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAMJ,KAAA,EAAO,yCAAA;AAAA;AAAA;AAAA,QAGP,SAAA,EAAW,0CAAA;AAAA;AAAA;AAAA,QAGX,IAAA,EAAM,0CAAA;AAAA;AAAA;AAAA,QAGN,MAAA,EAAQ;AAAA;AACV,KACF;AAAA,IACA,eAAA,EAAiB;AAAA,MACf,IAAA,EAAM;AAAA;AACR;AAEJ;AAcA,SAAS,UAAU,EAAE,SAAA,EAAW,MAAM,GAAA,EAAK,GAAG,OAAM,EAAmB;AACrE,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,WAAA,EAAU,WAAA;AAAA,MACV,WAAW,EAAA,CAAG,iBAAA,CAAkB,EAAE,IAAA,EAAM,SAAA,EAAW,CAAC,CAAA;AAAA,MACnD,GAAG;AAAA;AAAA,GACN;AAEJ","file":"container.js","sourcesContent":["import type * as React from 'react'\n\nimport { cva, type VariantProps } from 'class-variance-authority'\n\nimport { cn } from '../lib/utils.js'\n\n/**\n * The page-width column, carrying the same lateral rhythm the chrome\n * components apply to their own inner wrappers.\n *\n * `Masthead`, `Header`, `MainNav` and `Footer` each declare a private\n * `*ContainerVariants` with an identical `16px → 24px → 48px` padding ramp\n * funnelled through a `--<name>-padding-x` custom property. Nothing exposed\n * that rhythm to page CONTENT, so every consuming app retyped it — and any\n * app that retyped it slightly differently got content that failed to line up\n * with the header above it at one breakpoint but not the others, which is the\n * hardest kind of misalignment to notice in review.\n *\n * The variant names (`fluid` / `contained`) and the `--container-max-width`\n * escape hatch deliberately mirror the chrome's vocabulary, so a shell that\n * themes its `Header` writes the same word here.\n */\nconst containerVariants = cva(\n [\n 'mx-auto w-full',\n // Lateral padding funnels through --container-padding-x so an app can\n // retune it once (via the `style` prop or a utility class) without a new\n // variant. Same mechanism, and the same 16px → 24px → 48px rhythm, as\n // Masthead, Header, MainNav and Footer.\n 'px-(--container-padding-x)',\n '[--container-padding-x:--spacing(4)] sm:[--container-padding-x:--spacing(6)] lg:[--container-padding-x:--spacing(12)]',\n ],\n {\n variants: {\n size: {\n // Full-bleed. Matches the chrome components' own default, so page\n // content and the header line up without either side being\n // reconfigured — the case that has to be right by default.\n // --container-max-width is still read so a shell app can constrain the\n // column without switching variants.\n fluid: 'max-w-[var(--container-max-width,none)]',\n // Centred content column, legacy nsw-container parity (1200px). The\n // counterpart to the chrome's `container=\"contained\"`.\n contained: 'max-w-[var(--container-max-width,75rem)]',\n // A wider editorial column for landing and specimen pages that want\n // more than 1200px without going full-bleed.\n wide: 'max-w-[var(--container-max-width,90rem)]',\n // Reading measure — roughly 65–75 characters at the body size, for\n // long-form prose that should not span a full-width page.\n narrow: 'max-w-[var(--container-max-width,45rem)]',\n },\n },\n defaultVariants: {\n size: 'fluid',\n },\n },\n)\n\ntype ContainerProps = React.ComponentPropsWithoutRef<'div'> &\n VariantProps<typeof containerVariants> & {\n ref?: React.Ref<HTMLDivElement>\n }\n\n/**\n * Width-constraining page column with the NSW lateral rhythm.\n *\n * Purely presentational — it renders a `<div>` and adds no semantics, so it\n * can sit inside any landmark without affecting the document outline. Pair it\n * with `Section` for vertical rhythm.\n */\nfunction Container({ className, size, ref, ...props }: ContainerProps) {\n return (\n <div\n ref={ref}\n data-slot='container'\n className={cn(containerVariants({ size, className }))}\n {...props}\n />\n )\n}\n\nexport { Container, containerVariants }\nexport type { ContainerProps }\n"]}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { VariantProps } from 'class-variance-authority';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Term/detail pairs — metadata strips, summary rows, key–value facts.
|
|
7
|
+
*
|
|
8
|
+
* **This name shipped once before and was removed.** `DescriptionList` was
|
|
9
|
+
* dropped from the public API as a BREAKING CHANGE in v3 (commit 09d6db3),
|
|
10
|
+
* incidentally, inside a commit whose subject was adding ten unrelated
|
|
11
|
+
* components; its registry item then outlived it by three releases until
|
|
12
|
+
* `check:registry-resolves` caught the orphan. Consumers were told to migrate
|
|
13
|
+
* off it, so this is a deliberate re-introduction rather than a revert, and it
|
|
14
|
+
* is not source-compatible with the old one:
|
|
15
|
+
*
|
|
16
|
+
* - The old markup was a single hardcoded grid
|
|
17
|
+
* (`sm:grid-cols-[min(50%,--spacing(80))_auto]`) with no way to opt out.
|
|
18
|
+
* Layout is now a variant.
|
|
19
|
+
* - The old classes were cascade-unsafe in exactly the way `check:cascade`
|
|
20
|
+
* now fails a build for — `text-base/6 sm:text-sm/6` and
|
|
21
|
+
* `border-t … sm:border-t` are bare utilities paired with responsive
|
|
22
|
+
* overrides of the same property, so an npm consumer's own Tailwind build
|
|
23
|
+
* could outrank them. Every responsive step here is a mutually exclusive
|
|
24
|
+
* range instead.
|
|
25
|
+
* - The old type ramp dropped to 14px from `sm` up. Body copy holds at 16px.
|
|
26
|
+
*/
|
|
27
|
+
declare const descriptionListVariants: (props?: ({
|
|
28
|
+
layout?: "inline" | "stacked" | "columns" | null | undefined;
|
|
29
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
30
|
+
type DescriptionListProps = React.ComponentPropsWithoutRef<'dl'> & VariantProps<typeof descriptionListVariants> & {
|
|
31
|
+
ref?: React.Ref<HTMLDListElement>;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* A `<dl>` of term/detail pairs.
|
|
35
|
+
*
|
|
36
|
+
* **`columns` and `inline` place their own children, so each pair must be
|
|
37
|
+
* wrapped in a single element.** A `<dl>` may contain `<div>` wrappers around
|
|
38
|
+
* `<dt>`/`<dd>` groups — that is valid HTML and preserves the list semantics —
|
|
39
|
+
* and it is what keeps a term with its detail when the grid wraps. Without the
|
|
40
|
+
* wrapper the grid places every `<dt>` and `<dd>` independently and pairs come
|
|
41
|
+
* apart at the wrap point:
|
|
42
|
+
*
|
|
43
|
+
* ```tsx
|
|
44
|
+
* <DescriptionList layout='inline'>
|
|
45
|
+
* <div>
|
|
46
|
+
* <DescriptionTerm>Version</DescriptionTerm>
|
|
47
|
+
* <DescriptionDetails>2.001</DescriptionDetails>
|
|
48
|
+
* </div>
|
|
49
|
+
* </DescriptionList>
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* `stacked` has no such requirement — wrap or don't, it reads the same.
|
|
53
|
+
*/
|
|
54
|
+
declare function DescriptionList({ className, layout, ref, ...props }: DescriptionListProps): React.JSX.Element;
|
|
55
|
+
type DescriptionTermProps = React.ComponentPropsWithoutRef<'dt'> & {
|
|
56
|
+
ref?: React.Ref<HTMLElement>;
|
|
57
|
+
};
|
|
58
|
+
/** The term half of a pair — the label. */
|
|
59
|
+
declare function DescriptionTerm({ className, ref, ...props }: DescriptionTermProps): React.JSX.Element;
|
|
60
|
+
type DescriptionDetailsProps = React.ComponentPropsWithoutRef<'dd'> & {
|
|
61
|
+
ref?: React.Ref<HTMLElement>;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* The detail half of a pair — the value.
|
|
65
|
+
*
|
|
66
|
+
* `ms-0` is deliberate: browsers give `<dd>` a 40px `margin-inline-start` by
|
|
67
|
+
* default, which the grid layouts would otherwise indent every value by. It is
|
|
68
|
+
* an unconditional reset, so it does not fight the responsive ramp.
|
|
69
|
+
*/
|
|
70
|
+
declare function DescriptionDetails({ className, ref, ...props }: DescriptionDetailsProps): React.JSX.Element;
|
|
71
|
+
|
|
72
|
+
export { DescriptionDetails, type DescriptionDetailsProps, DescriptionList, type DescriptionListProps, DescriptionTerm, type DescriptionTermProps, descriptionListVariants };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { cva } from 'class-variance-authority';
|
|
3
|
+
import { cn } from '../lib/utils.js';
|
|
4
|
+
|
|
5
|
+
const descriptionListVariants = cva("", {
|
|
6
|
+
variants: {
|
|
7
|
+
layout: {
|
|
8
|
+
/**
|
|
9
|
+
* Terms above details, stacked in one column at every width. The safe
|
|
10
|
+
* default: it never truncates a long term and needs no width assumptions.
|
|
11
|
+
*/
|
|
12
|
+
stacked: "flex flex-col gap-4",
|
|
13
|
+
/**
|
|
14
|
+
* Two columns from `sm` up — term in the first, detail in the second —
|
|
15
|
+
* collapsing to `stacked` below it. The classic definition-list
|
|
16
|
+
* treatment for short terms.
|
|
17
|
+
*/
|
|
18
|
+
columns: "grid gap-x-8 gap-y-4 max-sm:grid-cols-1 sm:grid-cols-[minmax(0,--spacing(60))_minmax(0,1fr)]",
|
|
19
|
+
/**
|
|
20
|
+
* Facts side by side, wrapping as they run out of room — the strip
|
|
21
|
+
* under a page banner. Terms sit above their details within each cell.
|
|
22
|
+
*/
|
|
23
|
+
inline: "grid gap-x-8 gap-y-6 max-sm:grid-cols-2 sm:grid-cols-4"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
defaultVariants: {
|
|
27
|
+
layout: "stacked"
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
function DescriptionList({ className, layout, ref, ...props }) {
|
|
31
|
+
return /* @__PURE__ */ jsx(
|
|
32
|
+
"dl",
|
|
33
|
+
{
|
|
34
|
+
ref,
|
|
35
|
+
"data-slot": "description-list",
|
|
36
|
+
"data-layout": layout ?? "stacked",
|
|
37
|
+
className: cn(descriptionListVariants({ layout, className })),
|
|
38
|
+
...props
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
function DescriptionTerm({ className, ref, ...props }) {
|
|
43
|
+
return /* @__PURE__ */ jsx(
|
|
44
|
+
"dt",
|
|
45
|
+
{
|
|
46
|
+
ref,
|
|
47
|
+
"data-slot": "description-term",
|
|
48
|
+
className: cn("text-base/relaxed text-muted-foreground", className),
|
|
49
|
+
...props
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
function DescriptionDetails({ className, ref, ...props }) {
|
|
54
|
+
return /* @__PURE__ */ jsx(
|
|
55
|
+
"dd",
|
|
56
|
+
{
|
|
57
|
+
ref,
|
|
58
|
+
"data-slot": "description-details",
|
|
59
|
+
className: cn("ms-0 text-base/relaxed text-foreground", className),
|
|
60
|
+
...props
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export { DescriptionDetails, DescriptionList, DescriptionTerm, descriptionListVariants };
|
|
66
|
+
//# sourceMappingURL=description-list.js.map
|
|
67
|
+
//# sourceMappingURL=description-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/description-list.tsx"],"names":[],"mappings":";;;;AA4BA,MAAM,uBAAA,GAA0B,IAAI,EAAA,EAAI;AAAA,EACtC,QAAA,EAAU;AAAA,IACR,MAAA,EAAQ;AAAA;AAAA;AAAA;AAAA;AAAA,MAKN,OAAA,EAAS,qBAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAMT,OAAA,EACE,8FAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAKF,MAAA,EAAQ;AAAA;AACV,GACF;AAAA,EACA,eAAA,EAAiB;AAAA,IACf,MAAA,EAAQ;AAAA;AAEZ,CAAC;AA4BD,SAAS,gBAAgB,EAAE,SAAA,EAAW,QAAQ,GAAA,EAAK,GAAG,OAAM,EAAyB;AACnF,EAAA,uBACE,GAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,WAAA,EAAU,kBAAA;AAAA,MACV,eAAa,MAAA,IAAU,SAAA;AAAA,MACvB,WAAW,EAAA,CAAG,uBAAA,CAAwB,EAAE,MAAA,EAAQ,SAAA,EAAW,CAAC,CAAA;AAAA,MAC3D,GAAG;AAAA;AAAA,GACN;AAEJ;AAOA,SAAS,gBAAgB,EAAE,SAAA,EAAW,GAAA,EAAK,GAAG,OAAM,EAAyB;AAC3E,EAAA,uBACE,GAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,WAAA,EAAU,kBAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,yCAAA,EAA2C,SAAS,CAAA;AAAA,MACjE,GAAG;AAAA;AAAA,GACN;AAEJ;AAaA,SAAS,mBAAmB,EAAE,SAAA,EAAW,GAAA,EAAK,GAAG,OAAM,EAA4B;AACjF,EAAA,uBACE,GAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,WAAA,EAAU,qBAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,wCAAA,EAA0C,SAAS,CAAA;AAAA,MAChE,GAAG;AAAA;AAAA,GACN;AAEJ","file":"description-list.js","sourcesContent":["import type * as React from 'react'\n\nimport { cva, type VariantProps } from 'class-variance-authority'\n\nimport { cn } from '../lib/utils.js'\n\n/**\n * Term/detail pairs — metadata strips, summary rows, key–value facts.\n *\n * **This name shipped once before and was removed.** `DescriptionList` was\n * dropped from the public API as a BREAKING CHANGE in v3 (commit 09d6db3),\n * incidentally, inside a commit whose subject was adding ten unrelated\n * components; its registry item then outlived it by three releases until\n * `check:registry-resolves` caught the orphan. Consumers were told to migrate\n * off it, so this is a deliberate re-introduction rather than a revert, and it\n * is not source-compatible with the old one:\n *\n * - The old markup was a single hardcoded grid\n * (`sm:grid-cols-[min(50%,--spacing(80))_auto]`) with no way to opt out.\n * Layout is now a variant.\n * - The old classes were cascade-unsafe in exactly the way `check:cascade`\n * now fails a build for — `text-base/6 sm:text-sm/6` and\n * `border-t … sm:border-t` are bare utilities paired with responsive\n * overrides of the same property, so an npm consumer's own Tailwind build\n * could outrank them. Every responsive step here is a mutually exclusive\n * range instead.\n * - The old type ramp dropped to 14px from `sm` up. Body copy holds at 16px.\n */\nconst descriptionListVariants = cva('', {\n variants: {\n layout: {\n /**\n * Terms above details, stacked in one column at every width. The safe\n * default: it never truncates a long term and needs no width assumptions.\n */\n stacked: 'flex flex-col gap-4',\n /**\n * Two columns from `sm` up — term in the first, detail in the second —\n * collapsing to `stacked` below it. The classic definition-list\n * treatment for short terms.\n */\n columns:\n 'grid gap-x-8 gap-y-4 max-sm:grid-cols-1 sm:grid-cols-[minmax(0,--spacing(60))_minmax(0,1fr)]',\n /**\n * Facts side by side, wrapping as they run out of room — the strip\n * under a page banner. Terms sit above their details within each cell.\n */\n inline: 'grid gap-x-8 gap-y-6 max-sm:grid-cols-2 sm:grid-cols-4',\n },\n },\n defaultVariants: {\n layout: 'stacked',\n },\n})\n\ntype DescriptionListProps = React.ComponentPropsWithoutRef<'dl'> &\n VariantProps<typeof descriptionListVariants> & {\n ref?: React.Ref<HTMLDListElement>\n }\n\n/**\n * A `<dl>` of term/detail pairs.\n *\n * **`columns` and `inline` place their own children, so each pair must be\n * wrapped in a single element.** A `<dl>` may contain `<div>` wrappers around\n * `<dt>`/`<dd>` groups — that is valid HTML and preserves the list semantics —\n * and it is what keeps a term with its detail when the grid wraps. Without the\n * wrapper the grid places every `<dt>` and `<dd>` independently and pairs come\n * apart at the wrap point:\n *\n * ```tsx\n * <DescriptionList layout='inline'>\n * <div>\n * <DescriptionTerm>Version</DescriptionTerm>\n * <DescriptionDetails>2.001</DescriptionDetails>\n * </div>\n * </DescriptionList>\n * ```\n *\n * `stacked` has no such requirement — wrap or don't, it reads the same.\n */\nfunction DescriptionList({ className, layout, ref, ...props }: DescriptionListProps) {\n return (\n <dl\n ref={ref}\n data-slot='description-list'\n data-layout={layout ?? 'stacked'}\n className={cn(descriptionListVariants({ layout, className }))}\n {...props}\n />\n )\n}\n\ntype DescriptionTermProps = React.ComponentPropsWithoutRef<'dt'> & {\n ref?: React.Ref<HTMLElement>\n}\n\n/** The term half of a pair — the label. */\nfunction DescriptionTerm({ className, ref, ...props }: DescriptionTermProps) {\n return (\n <dt\n ref={ref}\n data-slot='description-term'\n className={cn('text-base/relaxed text-muted-foreground', className)}\n {...props}\n />\n )\n}\n\ntype DescriptionDetailsProps = React.ComponentPropsWithoutRef<'dd'> & {\n ref?: React.Ref<HTMLElement>\n}\n\n/**\n * The detail half of a pair — the value.\n *\n * `ms-0` is deliberate: browsers give `<dd>` a 40px `margin-inline-start` by\n * default, which the grid layouts would otherwise indent every value by. It is\n * an unconditional reset, so it does not fight the responsive ramp.\n */\nfunction DescriptionDetails({ className, ref, ...props }: DescriptionDetailsProps) {\n return (\n <dd\n ref={ref}\n data-slot='description-details'\n className={cn('ms-0 text-base/relaxed text-foreground', className)}\n {...props}\n />\n )\n}\n\nexport { DescriptionDetails, DescriptionList, descriptionListVariants, DescriptionTerm }\nexport type { DescriptionDetailsProps, DescriptionListProps, DescriptionTermProps }\n"]}
|
|
@@ -76,14 +76,18 @@ type FooterSocialLinkItem = {
|
|
|
76
76
|
href: string;
|
|
77
77
|
/**
|
|
78
78
|
* Icon for the channel — the component (`IconLinkedIn`) or an element
|
|
79
|
-
* (`<IconLinkedIn />`).
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
79
|
+
* (`<IconLinkedIn />`). Rendered through `ButtonLink`'s `leadingVisual` slot,
|
|
80
|
+
* which sizes and colours it.
|
|
81
|
+
*
|
|
82
|
+
* Brand marks are not in the NSWDS icon set — which is Material Symbols — but
|
|
83
|
+
* the six the NSW Government uses ship in the package's own `icons/brands`
|
|
84
|
+
* subpath, already client-safe. (Registry consumers copy source, so they get
|
|
85
|
+
* them from the `icon-brands` registry item instead; see the README.)
|
|
83
86
|
*
|
|
84
87
|
* `Footer` is server-compatible but `ButtonLink` is not, so a React Server
|
|
85
|
-
* Component assembling `socialLinks`
|
|
86
|
-
* form cannot cross the RSC boundary.
|
|
88
|
+
* Component assembling `socialLinks` from its OWN plain icon modules must use
|
|
89
|
+
* the element form — a bare function cannot cross the RSC boundary. The marks
|
|
90
|
+
* above are client references, so either form works for them. See `IconSlot`.
|
|
87
91
|
*/
|
|
88
92
|
icon: IconSlot;
|
|
89
93
|
/**
|