@nswds/ui 5.1.2 → 5.3.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.
Files changed (44) hide show
  1. package/README.md +36 -1
  2. package/dist/components/badge.d.ts +1 -1
  3. package/dist/components/button.d.ts +1 -1
  4. package/dist/components/callout.d.ts +60 -0
  5. package/dist/components/callout.js +65 -0
  6. package/dist/components/callout.js.map +1 -0
  7. package/dist/components/container.d.ts +36 -0
  8. package/dist/components/container.js +54 -0
  9. package/dist/components/container.js.map +1 -0
  10. package/dist/components/description-list.d.ts +72 -0
  11. package/dist/components/description-list.js +67 -0
  12. package/dist/components/description-list.js.map +1 -0
  13. package/dist/components/footer.d.ts +10 -6
  14. package/dist/components/footer.js.map +1 -1
  15. package/dist/components/header.d.ts +1 -1
  16. package/dist/components/link-card.d.ts +54 -0
  17. package/dist/components/link-card.js +82 -0
  18. package/dist/components/link-card.js.map +1 -0
  19. package/dist/components/masthead.d.ts +1 -1
  20. package/dist/components/on-this-page.d.ts +89 -0
  21. package/dist/components/on-this-page.js +127 -0
  22. package/dist/components/on-this-page.js.map +1 -0
  23. package/dist/components/section.d.ts +53 -0
  24. package/dist/components/section.js +44 -0
  25. package/dist/components/section.js.map +1 -0
  26. package/dist/components/skip-link.d.ts +1 -1
  27. package/dist/components/slider.d.ts +86 -0
  28. package/dist/components/slider.js +122 -0
  29. package/dist/components/slider.js.map +1 -0
  30. package/dist/components/tab-nav.d.ts +186 -0
  31. package/dist/components/tab-nav.js +100 -0
  32. package/dist/components/tab-nav.js.map +1 -0
  33. package/dist/hooks/use-chrome-height.d.ts +82 -0
  34. package/dist/hooks/use-chrome-height.js +45 -0
  35. package/dist/hooks/use-chrome-height.js.map +1 -0
  36. package/dist/icons/brands/index.d.ts +13 -0
  37. package/dist/icons/brands/index.js +56 -0
  38. package/dist/icons/brands/index.js.map +1 -0
  39. package/dist/icons/client.d.ts +1 -0
  40. package/dist/icons/client.js +2 -0
  41. package/dist/index.d.ts +10 -0
  42. package/dist/index.js +9 -0
  43. package/dist/styles.css +1 -1
  44. package/package.json +5 -1
@@ -0,0 +1,53 @@
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
+ * Vertical rhythm for a top-level page section.
7
+ *
8
+ * Every step is written as a set of MUTUALLY EXCLUSIVE breakpoint ranges
9
+ * (`max-sm:` / `sm:max-lg:` / `lg:`) rather than a bare utility plus responsive
10
+ * overrides. `py-16 sm:py-20 lg:py-28` renders identically here but is
11
+ * order-dependent across two Tailwind builds: an npm consumer's own build
12
+ * re-emits any utility they also use, a media query carries no extra
13
+ * specificity, and their plain `.py-16` would then outrank our `.lg:py-28` on
14
+ * an element they never referenced. `check:cascade` fails the build on the
15
+ * unsafe form — see its script header, and AGENTS.md §4 Step 1.
16
+ */
17
+ declare const sectionVariants: (props?: ({
18
+ spacing?: "default" | "none" | "loose" | "tight" | null | undefined;
19
+ divider?: boolean | null | undefined;
20
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
21
+ type SectionProps = React.ComponentPropsWithoutRef<'section'> & VariantProps<typeof sectionVariants> & {
22
+ /**
23
+ * `id` of the heading that names this section. Required for the section to
24
+ * be exposed as a `region` landmark — see the note on the component.
25
+ */
26
+ labelledBy?: string;
27
+ ref?: React.Ref<HTMLElement>;
28
+ };
29
+ /**
30
+ * A top-level page section with the house vertical rhythm.
31
+ *
32
+ * **Naming is what makes it a landmark.** A bare `<section>` is a generic
33
+ * container in the accessibility tree; it is only exposed as a `region` — and
34
+ * so only reachable by landmark navigation — once it has an accessible name.
35
+ * Pass `labelledBy` pointing at the `id` of the section's own heading, or
36
+ * `aria-label` where there is no visible heading to point at. This component
37
+ * deliberately does NOT invent a fallback name: an auto-generated label would
38
+ * put an unhelpful entry in the landmark list (WCAG 2.2, 1.3.1) and hide the
39
+ * omission from review.
40
+ *
41
+ * Pair with `Container` for the lateral rhythm:
42
+ *
43
+ * ```tsx
44
+ * <Section id='specimen' labelledBy='specimen-heading' divider>
45
+ * <Container>
46
+ * <h2 id='specimen-heading'>Nine weights, one file</h2>
47
+ * </Container>
48
+ * </Section>
49
+ * ```
50
+ */
51
+ declare function Section({ className, spacing, divider, labelledBy, ref, ...props }: SectionProps): React.JSX.Element;
52
+
53
+ export { Section, type SectionProps, sectionVariants };
@@ -0,0 +1,44 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { cva } from 'class-variance-authority';
3
+ import { cn } from '../lib/utils.js';
4
+
5
+ const sectionVariants = cva("", {
6
+ variants: {
7
+ spacing: {
8
+ default: "max-sm:py-16 sm:max-lg:py-20 lg:py-28",
9
+ tight: "max-sm:py-10 sm:max-lg:py-12 lg:py-16",
10
+ loose: "max-sm:py-20 sm:max-lg:py-28 lg:py-36",
11
+ // For a section that supplies its own padding, or one butted against a
12
+ // neighbour that already carries the gap.
13
+ none: ""
14
+ },
15
+ /**
16
+ * Hairline rule along the bottom edge, for stacking sections on one
17
+ * surface without alternating background colours.
18
+ */
19
+ divider: {
20
+ true: "border-b border-border",
21
+ false: ""
22
+ }
23
+ },
24
+ defaultVariants: {
25
+ spacing: "default",
26
+ divider: false
27
+ }
28
+ });
29
+ function Section({ className, spacing, divider, labelledBy, ref, ...props }) {
30
+ return /* @__PURE__ */ jsx(
31
+ "section",
32
+ {
33
+ ref,
34
+ "data-slot": "section",
35
+ "aria-labelledby": labelledBy,
36
+ className: cn(sectionVariants({ spacing, divider, className })),
37
+ ...props
38
+ }
39
+ );
40
+ }
41
+
42
+ export { Section, sectionVariants };
43
+ //# sourceMappingURL=section.js.map
44
+ //# sourceMappingURL=section.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/section.tsx"],"names":[],"mappings":";;;;AAkBA,MAAM,eAAA,GAAkB,IAAI,EAAA,EAAI;AAAA,EAC9B,QAAA,EAAU;AAAA,IACR,OAAA,EAAS;AAAA,MACP,OAAA,EAAS,uCAAA;AAAA,MACT,KAAA,EAAO,uCAAA;AAAA,MACP,KAAA,EAAO,uCAAA;AAAA;AAAA;AAAA,MAGP,IAAA,EAAM;AAAA,KACR;AAAA;AAAA;AAAA;AAAA;AAAA,IAKA,OAAA,EAAS;AAAA,MACP,IAAA,EAAM,wBAAA;AAAA,MACN,KAAA,EAAO;AAAA;AACT,GACF;AAAA,EACA,eAAA,EAAiB;AAAA,IACf,OAAA,EAAS,SAAA;AAAA,IACT,OAAA,EAAS;AAAA;AAEb,CAAC;AAkCD,SAAS,OAAA,CAAQ,EAAE,SAAA,EAAW,OAAA,EAAS,SAAS,UAAA,EAAY,GAAA,EAAK,GAAG,KAAA,EAAM,EAAiB;AACzF,EAAA,uBACE,GAAA;AAAA,IAAC,SAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,WAAA,EAAU,SAAA;AAAA,MACV,iBAAA,EAAiB,UAAA;AAAA,MACjB,SAAA,EAAW,GAAG,eAAA,CAAgB,EAAE,SAAS,OAAA,EAAS,SAAA,EAAW,CAAC,CAAA;AAAA,MAC7D,GAAG;AAAA;AAAA,GACN;AAEJ","file":"section.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 * Vertical rhythm for a top-level page section.\n *\n * Every step is written as a set of MUTUALLY EXCLUSIVE breakpoint ranges\n * (`max-sm:` / `sm:max-lg:` / `lg:`) rather than a bare utility plus responsive\n * overrides. `py-16 sm:py-20 lg:py-28` renders identically here but is\n * order-dependent across two Tailwind builds: an npm consumer's own build\n * re-emits any utility they also use, a media query carries no extra\n * specificity, and their plain `.py-16` would then outrank our `.lg:py-28` on\n * an element they never referenced. `check:cascade` fails the build on the\n * unsafe form — see its script header, and AGENTS.md §4 Step 1.\n */\nconst sectionVariants = cva('', {\n variants: {\n spacing: {\n default: 'max-sm:py-16 sm:max-lg:py-20 lg:py-28',\n tight: 'max-sm:py-10 sm:max-lg:py-12 lg:py-16',\n loose: 'max-sm:py-20 sm:max-lg:py-28 lg:py-36',\n // For a section that supplies its own padding, or one butted against a\n // neighbour that already carries the gap.\n none: '',\n },\n /**\n * Hairline rule along the bottom edge, for stacking sections on one\n * surface without alternating background colours.\n */\n divider: {\n true: 'border-b border-border',\n false: '',\n },\n },\n defaultVariants: {\n spacing: 'default',\n divider: false,\n },\n})\n\ntype SectionProps = React.ComponentPropsWithoutRef<'section'> &\n VariantProps<typeof sectionVariants> & {\n /**\n * `id` of the heading that names this section. Required for the section to\n * be exposed as a `region` landmark — see the note on the component.\n */\n labelledBy?: string\n ref?: React.Ref<HTMLElement>\n }\n\n/**\n * A top-level page section with the house vertical rhythm.\n *\n * **Naming is what makes it a landmark.** A bare `<section>` is a generic\n * container in the accessibility tree; it is only exposed as a `region` — and\n * so only reachable by landmark navigation — once it has an accessible name.\n * Pass `labelledBy` pointing at the `id` of the section's own heading, or\n * `aria-label` where there is no visible heading to point at. This component\n * deliberately does NOT invent a fallback name: an auto-generated label would\n * put an unhelpful entry in the landmark list (WCAG 2.2, 1.3.1) and hide the\n * omission from review.\n *\n * Pair with `Container` for the lateral rhythm:\n *\n * ```tsx\n * <Section id='specimen' labelledBy='specimen-heading' divider>\n * <Container>\n * <h2 id='specimen-heading'>Nine weights, one file</h2>\n * </Container>\n * </Section>\n * ```\n */\nfunction Section({ className, spacing, divider, labelledBy, ref, ...props }: SectionProps) {\n return (\n <section\n ref={ref}\n data-slot='section'\n aria-labelledby={labelledBy}\n className={cn(sectionVariants({ spacing, divider, className }))}\n {...props}\n />\n )\n}\n\nexport { Section, sectionVariants }\nexport type { SectionProps }\n"]}
@@ -3,7 +3,7 @@ import { VariantProps } from 'class-variance-authority';
3
3
  import React__default from 'react';
4
4
 
5
5
  declare const skipLinkVariants: (props?: ({
6
- color?: "light" | "white" | "grey" | "dark" | null | undefined;
6
+ color?: "white" | "grey" | "light" | "dark" | null | undefined;
7
7
  } & class_variance_authority_types.ClassProp) | undefined) => string;
8
8
  type SkipLinkProps = React__default.ComponentPropsWithoutRef<'a'> & VariantProps<typeof skipLinkVariants> & {
9
9
  /** Same-page fragment target, e.g. `"#content"`. */
@@ -0,0 +1,86 @@
1
+ import * as React from 'react';
2
+ import { Slider as Slider$1 } from '@base-ui/react/slider';
3
+
4
+ /**
5
+ * Styled Base UI Slider parts, exported for layouts the composed `Slider`
6
+ * below does not cover (a two-thumb range with its own labelling, a vertical
7
+ * slider in a toolbar, a value readout somewhere other than beside the label).
8
+ *
9
+ * All keyboard, pointer, ARIA and form behaviour comes from Base UI —
10
+ * arrow/Home/End/PageUp/PageDown stepping, `role="slider"`,
11
+ * `aria-valuenow`/`-valuemin`/`-valuemax`, thumb focus management, and RTL.
12
+ * Nothing here re-implements any of it (AGENTS.md §8, "never hand-roll ARIA").
13
+ */
14
+ declare function SliderRoot<Value extends number | readonly number[] = number>({ className, ...props }: Slider$1.Root.Props<Value>): React.JSX.Element;
15
+ /**
16
+ * The interactive area. Larger than the visible track, for a 24px pointer
17
+ * target.
18
+ *
19
+ * The disabled fade lives HERE rather than on the root, which is where the
20
+ * reflex is to put it (and where `Button` puts its own). On a Button, the faded
21
+ * text sits on a solid fill and survives; on a slider the label and value are
22
+ * plain text on the page background, and fading them took the label to 3.55:1
23
+ * and the readout to 2.39:1 — both below the 4.5:1 minimum, caught by the axe
24
+ * check on the Disabled story. A disabled control still has to be readable
25
+ * (WCAG 2.2, 1.4.3), so only the track, indicator and thumb dim; the label and
26
+ * value keep their contrast, and the root just stops taking pointer events.
27
+ */
28
+ declare function SliderControl({ className, ...props }: Slider$1.Control.Props): React.JSX.Element;
29
+ /** The unfilled rail. */
30
+ declare function SliderTrack({ className, ...props }: Slider$1.Track.Props): React.JSX.Element;
31
+ /** The filled portion, from `min` to the current value. */
32
+ declare function SliderIndicator({ className, ...props }: Slider$1.Indicator.Props): React.JSX.Element;
33
+ /**
34
+ * The draggable handle.
35
+ *
36
+ * `border-background` rather than `border-white`: the ring separating the thumb
37
+ * from the track has to read against the page surface, which is near-black in
38
+ * dark mode, so a hardcoded white would invert the effect exactly where it
39
+ * matters most.
40
+ */
41
+ declare function SliderThumb({ className, ...props }: Slider$1.Thumb.Props): React.JSX.Element;
42
+ /** The current value, rendered as an `<output>` by Base UI. */
43
+ declare function SliderValue({ className, ...props }: Slider$1.Value.Props): React.JSX.Element;
44
+ /** The slider's visible label, associated by Base UI. */
45
+ declare function SliderLabel({ className, ...props }: Slider$1.Label.Props): React.JSX.Element;
46
+ type SliderProps<Value extends number | readonly number[] = number> = Omit<Slider$1.Root.Props<Value>, 'children'> & {
47
+ /**
48
+ * Visible label. Omit only when the control is labelled from outside — via
49
+ * `Field`/`FieldLabel`, or an `aria-label` on the root — never leave it
50
+ * unnamed (WCAG 2.2, 4.1.2).
51
+ */
52
+ label?: React.ReactNode;
53
+ /** Show the live value beside the label. Defaults to `true`. */
54
+ showValue?: boolean;
55
+ /**
56
+ * Unit appended to the readout, e.g. `'px'` or `'%'`. Purely visual — Base
57
+ * UI announces the underlying number, so use `format` on the root for a unit
58
+ * assistive tech should hear.
59
+ */
60
+ suffix?: React.ReactNode;
61
+ /** Optional leading glyph, sized and hidden from assistive tech here. */
62
+ icon?: React.ElementType;
63
+ };
64
+ /**
65
+ * A slider for choosing a number from a range.
66
+ *
67
+ * Composes the parts above into the common layout: label and live value on one
68
+ * row, track beneath. For anything else, import the parts directly.
69
+ *
70
+ * ```tsx
71
+ * <Slider label='Size' defaultValue={56} min={16} max={140} suffix='px' />
72
+ * ```
73
+ *
74
+ * **Inside a `Field` it needs no `label` of its own.** Base UI's Slider reads
75
+ * the surrounding Field context (`SliderRootState` extends `FieldRootState`),
76
+ * so `FieldLabel`, `FieldDescription` and `FieldError` associate with it the
77
+ * same way they do for `Input` — passing both would name the control twice.
78
+ *
79
+ * **Range sliders work through the parts, not this wrapper.** Pass an array
80
+ * `value` and Base UI renders one thumb per entry, but a single visible label
81
+ * cannot correctly name two thumbs; build those from `SliderRoot` and give
82
+ * each `SliderThumb` its own accessible name.
83
+ */
84
+ declare function Slider<Value extends number | readonly number[] = number>({ className, label, showValue, suffix, icon: Icon, ...props }: SliderProps<Value>): React.JSX.Element;
85
+
86
+ export { Slider, SliderControl, SliderIndicator, SliderLabel, type SliderProps, SliderRoot, SliderThumb, SliderTrack, SliderValue };
@@ -0,0 +1,122 @@
1
+ "use client"
2
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
+ import { Slider as Slider$1 } from '@base-ui/react/slider';
4
+ import { cn } from '../lib/utils.js';
5
+
6
+ function SliderRoot({
7
+ className,
8
+ ...props
9
+ }) {
10
+ return /* @__PURE__ */ jsx(
11
+ Slider$1.Root,
12
+ {
13
+ "data-slot": "slider",
14
+ className: cn(
15
+ "flex w-full touch-none items-center select-none data-disabled:pointer-events-none",
16
+ "data-[orientation=vertical]:h-full data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",
17
+ className
18
+ ),
19
+ ...props
20
+ }
21
+ );
22
+ }
23
+ function SliderControl({ className, ...props }) {
24
+ return /* @__PURE__ */ jsx(
25
+ Slider$1.Control,
26
+ {
27
+ "data-slot": "slider-control",
28
+ className: cn(
29
+ "flex w-full flex-1 items-center py-3 data-disabled:opacity-50",
30
+ "data-[orientation=vertical]:h-full data-[orientation=vertical]:w-auto data-[orientation=vertical]:justify-center data-[orientation=vertical]:px-3 data-[orientation=vertical]:py-0",
31
+ className
32
+ ),
33
+ ...props
34
+ }
35
+ );
36
+ }
37
+ function SliderTrack({ className, ...props }) {
38
+ return /* @__PURE__ */ jsx(
39
+ Slider$1.Track,
40
+ {
41
+ "data-slot": "slider-track",
42
+ className: cn(
43
+ "relative w-full overflow-hidden rounded-full bg-muted",
44
+ "data-[orientation=horizontal]:h-2 data-[orientation=vertical]:h-full data-[orientation=vertical]:w-2",
45
+ className
46
+ ),
47
+ ...props
48
+ }
49
+ );
50
+ }
51
+ function SliderIndicator({ className, ...props }) {
52
+ return /* @__PURE__ */ jsx(
53
+ Slider$1.Indicator,
54
+ {
55
+ "data-slot": "slider-indicator",
56
+ className: cn("rounded-full bg-primary select-none", className),
57
+ ...props
58
+ }
59
+ );
60
+ }
61
+ function SliderThumb({ className, ...props }) {
62
+ return /* @__PURE__ */ jsx(
63
+ Slider$1.Thumb,
64
+ {
65
+ "data-slot": "slider-thumb",
66
+ className: cn(
67
+ "size-5 rounded-full border-2 border-background bg-primary shadow-sm",
68
+ "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring",
69
+ "data-[dragging]:scale-110 motion-safe:transition-transform",
70
+ className
71
+ ),
72
+ ...props
73
+ }
74
+ );
75
+ }
76
+ function SliderValue({ className, ...props }) {
77
+ return /* @__PURE__ */ jsx(
78
+ Slider$1.Value,
79
+ {
80
+ "data-slot": "slider-value",
81
+ className: cn("text-base tabular-nums", className),
82
+ ...props
83
+ }
84
+ );
85
+ }
86
+ function SliderLabel({ className, ...props }) {
87
+ return /* @__PURE__ */ jsx(
88
+ Slider$1.Label,
89
+ {
90
+ "data-slot": "slider-label",
91
+ className: cn("text-base font-semibold", className),
92
+ ...props
93
+ }
94
+ );
95
+ }
96
+ function Slider({
97
+ className,
98
+ label,
99
+ showValue = true,
100
+ suffix,
101
+ icon: Icon,
102
+ ...props
103
+ }) {
104
+ return /* @__PURE__ */ jsxs(SliderRoot, { className: cn("flex-col items-stretch gap-1", className), ...props, children: [
105
+ label || showValue ? /* @__PURE__ */ jsxs("div", { "data-slot": "slider-header", className: "flex items-center gap-3", children: [
106
+ Icon ? /* @__PURE__ */ jsx(Icon, { "aria-hidden": "true", className: "size-5 shrink-0 text-muted-foreground" }) : null,
107
+ label ? /* @__PURE__ */ jsx(SliderLabel, { children: label }) : null,
108
+ showValue ? /* @__PURE__ */ jsx(SliderValue, { className: "ms-auto text-muted-foreground", children: (formattedValues) => /* @__PURE__ */ jsxs(Fragment, { children: [
109
+ formattedValues.join(" \u2013 "),
110
+ suffix
111
+ ] }) }) : null
112
+ ] }) : null,
113
+ /* @__PURE__ */ jsx(SliderControl, { children: /* @__PURE__ */ jsxs(SliderTrack, { children: [
114
+ /* @__PURE__ */ jsx(SliderIndicator, {}),
115
+ /* @__PURE__ */ jsx(SliderThumb, {})
116
+ ] }) })
117
+ ] });
118
+ }
119
+
120
+ export { Slider, SliderControl, SliderIndicator, SliderLabel, SliderRoot, SliderThumb, SliderTrack, SliderValue };
121
+ //# sourceMappingURL=slider.js.map
122
+ //# sourceMappingURL=slider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/slider.tsx"],"names":["SliderPrimitive"],"mappings":"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","file":"slider.js","sourcesContent":["'use client'\n\nimport type * as React from 'react'\n\nimport { Slider as SliderPrimitive } from '@base-ui/react/slider'\n\nimport { cn } from '../lib/utils.js'\n\n/**\n * Styled Base UI Slider parts, exported for layouts the composed `Slider`\n * below does not cover (a two-thumb range with its own labelling, a vertical\n * slider in a toolbar, a value readout somewhere other than beside the label).\n *\n * All keyboard, pointer, ARIA and form behaviour comes from Base UI —\n * arrow/Home/End/PageUp/PageDown stepping, `role=\"slider\"`,\n * `aria-valuenow`/`-valuemin`/`-valuemax`, thumb focus management, and RTL.\n * Nothing here re-implements any of it (AGENTS.md §8, \"never hand-roll ARIA\").\n */\nfunction SliderRoot<Value extends number | readonly number[] = number>({\n className,\n ...props\n}: SliderPrimitive.Root.Props<Value>) {\n return (\n <SliderPrimitive.Root<Value>\n data-slot='slider'\n className={cn(\n 'flex w-full touch-none items-center select-none data-disabled:pointer-events-none',\n 'data-[orientation=vertical]:h-full data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col',\n className,\n )}\n {...props}\n />\n )\n}\n\n/**\n * The interactive area. Larger than the visible track, for a 24px pointer\n * target.\n *\n * The disabled fade lives HERE rather than on the root, which is where the\n * reflex is to put it (and where `Button` puts its own). On a Button, the faded\n * text sits on a solid fill and survives; on a slider the label and value are\n * plain text on the page background, and fading them took the label to 3.55:1\n * and the readout to 2.39:1 — both below the 4.5:1 minimum, caught by the axe\n * check on the Disabled story. A disabled control still has to be readable\n * (WCAG 2.2, 1.4.3), so only the track, indicator and thumb dim; the label and\n * value keep their contrast, and the root just stops taking pointer events.\n */\nfunction SliderControl({ className, ...props }: SliderPrimitive.Control.Props) {\n return (\n <SliderPrimitive.Control\n data-slot='slider-control'\n className={cn(\n 'flex w-full flex-1 items-center py-3 data-disabled:opacity-50',\n 'data-[orientation=vertical]:h-full data-[orientation=vertical]:w-auto data-[orientation=vertical]:justify-center data-[orientation=vertical]:px-3 data-[orientation=vertical]:py-0',\n className,\n )}\n {...props}\n />\n )\n}\n\n/** The unfilled rail. */\nfunction SliderTrack({ className, ...props }: SliderPrimitive.Track.Props) {\n return (\n <SliderPrimitive.Track\n data-slot='slider-track'\n className={cn(\n 'relative w-full overflow-hidden rounded-full bg-muted',\n 'data-[orientation=horizontal]:h-2 data-[orientation=vertical]:h-full data-[orientation=vertical]:w-2',\n className,\n )}\n {...props}\n />\n )\n}\n\n/** The filled portion, from `min` to the current value. */\nfunction SliderIndicator({ className, ...props }: SliderPrimitive.Indicator.Props) {\n return (\n <SliderPrimitive.Indicator\n data-slot='slider-indicator'\n className={cn('rounded-full bg-primary select-none', className)}\n {...props}\n />\n )\n}\n\n/**\n * The draggable handle.\n *\n * `border-background` rather than `border-white`: the ring separating the thumb\n * from the track has to read against the page surface, which is near-black in\n * dark mode, so a hardcoded white would invert the effect exactly where it\n * matters most.\n */\nfunction SliderThumb({ className, ...props }: SliderPrimitive.Thumb.Props) {\n return (\n <SliderPrimitive.Thumb\n data-slot='slider-thumb'\n className={cn(\n 'size-5 rounded-full border-2 border-background bg-primary shadow-sm',\n 'focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring',\n 'data-[dragging]:scale-110 motion-safe:transition-transform',\n className,\n )}\n {...props}\n />\n )\n}\n\n/** The current value, rendered as an `<output>` by Base UI. */\nfunction SliderValue({ className, ...props }: SliderPrimitive.Value.Props) {\n return (\n <SliderPrimitive.Value\n data-slot='slider-value'\n className={cn('text-base tabular-nums', className)}\n {...props}\n />\n )\n}\n\n/** The slider's visible label, associated by Base UI. */\nfunction SliderLabel({ className, ...props }: SliderPrimitive.Label.Props) {\n return (\n <SliderPrimitive.Label\n data-slot='slider-label'\n className={cn('text-base font-semibold', className)}\n {...props}\n />\n )\n}\n\ntype SliderProps<Value extends number | readonly number[] = number> = Omit<\n SliderPrimitive.Root.Props<Value>,\n 'children'\n> & {\n /**\n * Visible label. Omit only when the control is labelled from outside — via\n * `Field`/`FieldLabel`, or an `aria-label` on the root — never leave it\n * unnamed (WCAG 2.2, 4.1.2).\n */\n label?: React.ReactNode\n /** Show the live value beside the label. Defaults to `true`. */\n showValue?: boolean\n /**\n * Unit appended to the readout, e.g. `'px'` or `'%'`. Purely visual — Base\n * UI announces the underlying number, so use `format` on the root for a unit\n * assistive tech should hear.\n */\n suffix?: React.ReactNode\n /** Optional leading glyph, sized and hidden from assistive tech here. */\n icon?: React.ElementType\n}\n\n/**\n * A slider for choosing a number from a range.\n *\n * Composes the parts above into the common layout: label and live value on one\n * row, track beneath. For anything else, import the parts directly.\n *\n * ```tsx\n * <Slider label='Size' defaultValue={56} min={16} max={140} suffix='px' />\n * ```\n *\n * **Inside a `Field` it needs no `label` of its own.** Base UI's Slider reads\n * the surrounding Field context (`SliderRootState` extends `FieldRootState`),\n * so `FieldLabel`, `FieldDescription` and `FieldError` associate with it the\n * same way they do for `Input` — passing both would name the control twice.\n *\n * **Range sliders work through the parts, not this wrapper.** Pass an array\n * `value` and Base UI renders one thumb per entry, but a single visible label\n * cannot correctly name two thumbs; build those from `SliderRoot` and give\n * each `SliderThumb` its own accessible name.\n */\nfunction Slider<Value extends number | readonly number[] = number>({\n className,\n label,\n showValue = true,\n suffix,\n icon: Icon,\n ...props\n}: SliderProps<Value>) {\n return (\n <SliderRoot<Value> className={cn('flex-col items-stretch gap-1', className)} {...props}>\n {label || showValue ? (\n <div data-slot='slider-header' className='flex items-center gap-3'>\n {Icon ? (\n <Icon aria-hidden='true' className='size-5 shrink-0 text-muted-foreground' />\n ) : null}\n {label ? <SliderLabel>{label}</SliderLabel> : null}\n {showValue ? (\n <SliderValue className='ms-auto text-muted-foreground'>\n {(formattedValues) => (\n <>\n {formattedValues.join(' – ')}\n {suffix}\n </>\n )}\n </SliderValue>\n ) : null}\n </div>\n ) : null}\n <SliderControl>\n <SliderTrack>\n <SliderIndicator />\n <SliderThumb />\n </SliderTrack>\n </SliderControl>\n </SliderRoot>\n )\n}\n\nexport {\n Slider,\n SliderControl,\n SliderIndicator,\n SliderLabel,\n SliderRoot,\n SliderThumb,\n SliderTrack,\n SliderValue,\n}\nexport type { SliderProps }\n"]}
@@ -0,0 +1,186 @@
1
+ import * as class_variance_authority_types from 'class-variance-authority/types';
2
+ import { VariantProps } from 'class-variance-authority';
3
+ import * as React from 'react';
4
+ import { LinkProps } from './link.js';
5
+
6
+ /**
7
+ * The bar itself: a horizontal scroll container with the rule the tabs sit on.
8
+ *
9
+ * The rule is on the LIST, not on the `<nav>`. The nav is the scroll container,
10
+ * so a rule there spans only the visible width and stops dead at the right edge
11
+ * while the tabs keep going — the bar looks broken exactly when it overflows,
12
+ * which is the case that matters. `min-w-max` on the list makes it as wide as
13
+ * its tabs, so the rule runs the full scrollable width instead.
14
+ *
15
+ * The scrollbar is suppressed on the nav, the element that actually scrolls: a
16
+ * visible bar would sit on top of the tabs. The clipped final tab is what
17
+ * signals there is more to the right. Scrolling itself is untouched, so pointer
18
+ * drag, shift-wheel and keyboard all still reach the overflow — the same
19
+ * treatment `OnThisPage` gives its horizontal bar.
20
+ */
21
+ declare const tabNavListVariants: (props?: ({
22
+ border?: boolean | null | undefined;
23
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
24
+ /**
25
+ * One tab.
26
+ *
27
+ * `-mb-px` pulls the 2px marker down over the list's 1px rule so the two merge
28
+ * into a single edge, rather than the marker floating a hairline above it.
29
+ *
30
+ * Idle and current ink live in separate branches rather than in the base
31
+ * string. Both are single-class selectors, so with both on the element at once
32
+ * the winner comes down to Tailwind's internal sort order — the same reason
33
+ * `OnThisPage` splits them.
34
+ *
35
+ * The current tab changes colour AND draws the marker rule, so the state is
36
+ * never signalled by colour alone (WCAG 2.2, 1.4.1). The rule is always drawn,
37
+ * `transparent` when idle, so becoming current never changes the tab's size and
38
+ * the bar cannot reflow under the pointer.
39
+ *
40
+ * Floored at 44px on coarse pointers, the promise DESIGN.md makes and
41
+ * `Button`/`PushMenu` hold. `p-4` over a 24px line box already clears it on
42
+ * most type scales; the floor makes that independent of the consumer's scale.
43
+ */
44
+ declare const tabNavLinkVariants: (props?: ({
45
+ current?: boolean | null | undefined;
46
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
47
+ type TabNavProps = React.ComponentPropsWithoutRef<'nav'> & VariantProps<typeof tabNavListVariants> & {
48
+ /**
49
+ * The current page's href. The `TabNavLink` whose `href` matches it exactly
50
+ * gets `aria-current='page'` and the marker rule.
51
+ *
52
+ * Matching is EXACT, deliberately. Prefix matching (`pathname.startsWith`)
53
+ * is the obvious shortcut and it is wrong in two directions: `/colour`
54
+ * matches `/colour-blind-safe`, and every parent in a nested set matches at
55
+ * once, so several tabs claim the page. Matching rules beyond equality are
56
+ * the caller's to define — set `current` on the link directly and the bar
57
+ * will not second-guess it.
58
+ *
59
+ * Frameworkless replacement for `usePathname()` — pass your router's
60
+ * pathname in, as with `SideNav`.
61
+ */
62
+ currentHref?: string;
63
+ ref?: React.Ref<HTMLElement>;
64
+ };
65
+ /**
66
+ * Flat horizontal navigation between the pages of one section — the bar that
67
+ * sits under the site header and lists a section's peer pages.
68
+ *
69
+ * **Where it sits among the other navigation components**, none of which it
70
+ * overlaps:
71
+ *
72
+ * | Component | Moves you |
73
+ * | ------------ | ------------------------------------------------ |
74
+ * | `MainNav` | between sites/sections, mega menu |
75
+ * | `SideNav` | between pages, as a tree |
76
+ * | `TabNav` | between the pages of one section, as a flat bar |
77
+ * | `StepNav` | through a multi-page journey |
78
+ * | `OnThisPage` | within the page you are on |
79
+ *
80
+ * The closest neighbours are `SideNav` and `OnThisPage`. `SideNav` does the
81
+ * same job — peer-page navigation — but as a vertical tree with arbitrary
82
+ * nesting; this is the flat horizontal form, for a section whose pages have no
83
+ * hierarchy worth drawing. `OnThisPage` looks nearly identical and is not
84
+ * related: its entries are anchors into the current page, which is why it marks
85
+ * `aria-current='location'` where this marks `'page'`.
86
+ *
87
+ * **These are not ARIA tabs, and must never become them.** The name describes
88
+ * the visual idiom, which is what a designer reaching for this will search for.
89
+ * The semantics are a `<nav>` landmark over a list of links: each one navigates
90
+ * to a different URL, so a reader gets a page load, not a panel swap. Adding
91
+ * `role='tablist'`/`role='tab'` would promise `aria-controls` panels that do
92
+ * not exist and hand the arrow keys a selection model the browser cannot honour
93
+ * across a navigation. `OnThisPage` documents the mirror-image decision about
94
+ * `aria-current`; this is the same care applied to `role`.
95
+ *
96
+ * **No Base UI primitive is involved, and none is missing.** The house rule is
97
+ * never to hand-roll ARIA, focus or keyboard behaviour — but these are plain
98
+ * anchors, which have all three natively, and a link list needs no roving
99
+ * tabindex. Nothing is hand-rolled here because there is nothing to hand-roll.
100
+ *
101
+ * Accessibility contract:
102
+ *
103
+ * - The landmark is named (`aria-label`, default "Subsection navigation") so it
104
+ * is distinguishable from the page's other navigation landmarks (WCAG 2.2,
105
+ * 1.3.1). Name it after the section it navigates — "Colour", "Get started" —
106
+ * whenever you know it; the default only guarantees the landmark is not
107
+ * anonymous.
108
+ * - The current page is marked `aria-current='page'`.
109
+ * - `role='list'` is explicit on the `<ul>`: `list-style: none` strips list
110
+ * semantics in Safari/VoiceOver, the same reason `SideNav`, `StepIndicator`
111
+ * and `OnThisPage` set it.
112
+ * - The current state carries colour AND a marker rule, never colour alone
113
+ * (1.4.1), and the rule occupies its space when idle so nothing reflows.
114
+ * - Focus is always visible via the house outline pattern (2.4.13).
115
+ *
116
+ * Departures from the nswds-app `TabNavigation` source, all deliberate:
117
+ *
118
+ * - **The current tab comes from `currentHref`, not from internal state.** The
119
+ * source tracked the last-clicked tab in a `useState`, which is a click
120
+ * highlighter, not page navigation: on a fresh page load nothing is marked,
121
+ * and after a real navigation the state is gone. Marking the current page is
122
+ * the entire job of this component, so it reads the router's pathname the way
123
+ * `SideNav` does.
124
+ * - **Tabs are identified by `href`, not by a `tabId`.** The source defaulted
125
+ * every link's id to the literal string `'unique-id'`, so any two links
126
+ * without an explicit id shared one identity. Keying off the destination
127
+ * removes the id from the API entirely.
128
+ * - **No hover-pill animation, and no `motion` dependency.** The source
129
+ * animated a floating background between tabs via `motion/react`. The hover
130
+ * state here is a colour derivation per DESIGN.md's Derived State Rule; a
131
+ * design system taking on an animation runtime to decorate one hover is a
132
+ * cost every consumer pays.
133
+ * - Radix `NavigationMenu` → plain semantics. The source used it purely as
134
+ * markup scaffolding, and its `onSelect` is what made the active tab
135
+ * click-driven in the first place.
136
+ * - Links render through `Link`, so frameworks inject their own anchor via
137
+ * `LinkProvider` (`next/link` et al) — as in `SideNav`.
138
+ *
139
+ * @example
140
+ * ```tsx
141
+ * <TabNav currentHref={pathname} aria-label='Colour'>
142
+ * <TabNavLink href='/colour/brand'>Brand palette</TabNavLink>
143
+ * <TabNavLink href='/colour/semantic'>Semantic palette</TabNavLink>
144
+ * </TabNav>
145
+ * ```
146
+ */
147
+ declare function TabNav({ className, children, currentHref, border, 'aria-label': ariaLabel, ref, ...props }: TabNavProps): React.JSX.Element;
148
+ /**
149
+ * `as` is omitted deliberately, not by oversight.
150
+ *
151
+ * `Link` strips `href` from any non-anchor intrinsic element, so `as='button'`
152
+ * typechecked and rendered `<button href=null aria-current='page'>` — a control
153
+ * that cannot navigate, announcing itself as the current *page*. That is a
154
+ * name/role/value mismatch (WCAG 2.2, 4.1.2), not merely a dead link, and it
155
+ * contradicts the nav-over-links contract this component documents.
156
+ *
157
+ * Nothing is lost. A bar whose tabs render as different element types is
158
+ * incoherent by construction, and framework links still arrive the documented
159
+ * way — wrap the bar in `<LinkProvider component={NextLink}>`. `SideNav` sets
160
+ * the same precedent: it renders `Link` internally and never forwards `as`.
161
+ */
162
+ type TabNavLinkProps = Omit<LinkProps, 'variant' | 'as'> & {
163
+ /**
164
+ * Force the current state, overriding the bar's `currentHref` comparison.
165
+ *
166
+ * The escape hatch for any matching rule other than equality — prefix
167
+ * matching for a nested route, ignoring a query string, treating an index
168
+ * page as current for its children. Compute it from your router and set it
169
+ * here; `TabNav` does not guess.
170
+ *
171
+ * Also the only way to mark the current tab when `href` is a url object,
172
+ * which cannot be compared to a pathname string.
173
+ */
174
+ current?: boolean;
175
+ };
176
+ /**
177
+ * One tab: a link to a peer page, marked `aria-current='page'` when it is the
178
+ * one being read.
179
+ *
180
+ * Renders its own `<li>`, so `TabNav`'s children are tabs rather than list
181
+ * items — the compound shape `Header`/`HeaderBrand` and `Footer`/`FooterNav`
182
+ * already use.
183
+ */
184
+ declare function TabNavLink({ className, children, current, href, ...props }: TabNavLinkProps): React.JSX.Element;
185
+
186
+ export { TabNav, TabNavLink, type TabNavLinkProps, type TabNavProps, tabNavLinkVariants, tabNavListVariants };
@@ -0,0 +1,100 @@
1
+ "use client"
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import { cva } from 'class-variance-authority';
4
+ import * as React from 'react';
5
+ import { cn } from '../lib/utils.js';
6
+ import { Link } from '../components/link.js';
7
+
8
+ const TabNavContext = React.createContext(null);
9
+ const tabNavListVariants = cva("flex min-w-max items-center", {
10
+ variants: {
11
+ /**
12
+ * The rule the tabs sit on. Off for a bar inside a `Card` or panel that
13
+ * already draws its own edge, where a second rule reads as a double border.
14
+ */
15
+ border: {
16
+ true: "border-b border-border",
17
+ false: ""
18
+ }
19
+ },
20
+ defaultVariants: {
21
+ border: true
22
+ }
23
+ });
24
+ const tabNavLinkVariants = cva(
25
+ [
26
+ "flex shrink-0 items-center border-b-2 p-4 font-bold whitespace-nowrap",
27
+ "-mb-px",
28
+ "[@media(pointer:coarse)]:min-h-11",
29
+ "motion-safe:transition-colors",
30
+ "hover:bg-primary/10 hover:text-primary",
31
+ "focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring"
32
+ ],
33
+ {
34
+ variants: {
35
+ current: {
36
+ true: "border-primary text-primary",
37
+ false: "border-transparent text-foreground"
38
+ }
39
+ },
40
+ defaultVariants: {
41
+ current: false
42
+ }
43
+ }
44
+ );
45
+ function TabNav({
46
+ className,
47
+ children,
48
+ currentHref,
49
+ border,
50
+ "aria-label": ariaLabel = "Subsection navigation",
51
+ ref,
52
+ ...props
53
+ }) {
54
+ const context = React.useMemo(() => ({ currentHref }), [currentHref]);
55
+ return /* @__PURE__ */ jsx(
56
+ "nav",
57
+ {
58
+ ...props,
59
+ ref,
60
+ "data-slot": "tab-nav",
61
+ "aria-label": ariaLabel,
62
+ className: cn(
63
+ "text-base",
64
+ "[scrollbar-width:none] overflow-x-auto [&::-webkit-scrollbar]:hidden",
65
+ className
66
+ ),
67
+ children: /* @__PURE__ */ jsx("ul", { role: "list", "data-slot": "tab-nav-list", className: cn(tabNavListVariants({ border })), children: /* @__PURE__ */ jsx(TabNavContext.Provider, { value: context, children }) })
68
+ }
69
+ );
70
+ }
71
+ function warnIfOrphaned(hasContext) {
72
+ if (process.env.NODE_ENV === "production" || hasContext) {
73
+ return;
74
+ }
75
+ console.warn(
76
+ "[nswds/ui] TabNavLink rendered outside a TabNav \u2014 it cannot read currentHref, so the current tab is never derived automatically (only an explicit `current` still applies), and its <li> sits outside any list. Wrap the links in <TabNav>."
77
+ );
78
+ }
79
+ function TabNavLink({ className, children, current, href, ...props }) {
80
+ const context = React.useContext(TabNavContext);
81
+ warnIfOrphaned(context !== null);
82
+ const isCurrent = current ?? (context?.currentHref !== void 0 && typeof href === "string" && href === context.currentHref);
83
+ return /* @__PURE__ */ jsx("li", { "data-slot": "tab-nav-item", className: "flex", children: /* @__PURE__ */ jsx(
84
+ Link,
85
+ {
86
+ ...props,
87
+ variant: "unstyled",
88
+ "data-slot": "tab-nav-link",
89
+ "data-active": isCurrent ? "" : void 0,
90
+ href,
91
+ "aria-current": isCurrent ? "page" : void 0,
92
+ className: cn(tabNavLinkVariants({ current: isCurrent }), className),
93
+ children
94
+ }
95
+ ) });
96
+ }
97
+
98
+ export { TabNav, TabNavLink, tabNavLinkVariants, tabNavListVariants };
99
+ //# sourceMappingURL=tab-nav.js.map
100
+ //# sourceMappingURL=tab-nav.js.map