@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.
Files changed (41) 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/hooks/use-chrome-height.d.ts +82 -0
  31. package/dist/hooks/use-chrome-height.js +45 -0
  32. package/dist/hooks/use-chrome-height.js.map +1 -0
  33. package/dist/icons/brands/index.d.ts +13 -0
  34. package/dist/icons/brands/index.js +56 -0
  35. package/dist/icons/brands/index.js.map +1 -0
  36. package/dist/icons/client.d.ts +1 -0
  37. package/dist/icons/client.js +2 -0
  38. package/dist/index.d.ts +9 -0
  39. package/dist/index.js +8 -0
  40. package/dist/styles.css +1 -1
  41. 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":";;;;AAkBA,SAAS,UAAA,CAA8D;AAAA,EACrE,SAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAsC;AACpC,EAAA,uBACE,GAAA;AAAA,IAACA,QAAA,CAAgB,IAAA;AAAA,IAAhB;AAAA,MACC,WAAA,EAAU,QAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACT,mFAAA;AAAA,QACA,4GAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ;AAeA,SAAS,aAAA,CAAc,EAAE,SAAA,EAAW,GAAG,OAAM,EAAkC;AAC7E,EAAA,uBACE,GAAA;AAAA,IAACA,QAAA,CAAgB,OAAA;AAAA,IAAhB;AAAA,MACC,WAAA,EAAU,gBAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACT,+DAAA;AAAA,QACA,oLAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ;AAGA,SAAS,WAAA,CAAY,EAAE,SAAA,EAAW,GAAG,OAAM,EAAgC;AACzE,EAAA,uBACE,GAAA;AAAA,IAACA,QAAA,CAAgB,KAAA;AAAA,IAAhB;AAAA,MACC,WAAA,EAAU,cAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACT,uDAAA;AAAA,QACA,sGAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ;AAGA,SAAS,eAAA,CAAgB,EAAE,SAAA,EAAW,GAAG,OAAM,EAAoC;AACjF,EAAA,uBACE,GAAA;AAA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CAAG,gCAAgC,SAAS,CAAA,EAAI,GAAG,KAAA,EAC9E,QAAA,EAAA;AAAA,IAAA,KAAA,IAAS,4BACR,IAAA,CAAC,KAAA,EAAA,EAAI,WAAA,EAAU,eAAA,EAAgB,WAAU,yBAAA,EACtC,QAAA,EAAA;AAAA,MAAA,IAAA,uBACE,IAAA,EAAA,EAAK,aAAA,EAAY,MAAA,EAAO,SAAA,EAAU,yCAAwC,CAAA,GACzE,IAAA;AAAA,MACH,KAAA,mBAAQ,GAAA,CAAC,WAAA,EAAA,EAAa,QAAA,EAAA,KAAA,EAAM,CAAA,GAAiB,IAAA;AAAA,MAC7C,4BACC,GAAA,CAAC,WAAA,EAAA,EAAY,WAAU,+BAAA,EACpB,QAAA,EAAA,CAAC,oCACA,IAAA,CAAA,QAAA,EAAA,EACG,QAAA,EAAA;AAAA,QAAA,eAAA,CAAgB,KAAK,UAAK,CAAA;AAAA,QAC1B;AAAA,OAAA,EACH,GAEJ,CAAA,GACE;AAAA,KAAA,EACN,CAAA,GACE,IAAA;AAAA,oBACJ,GAAA,CAAC,aAAA,EAAA,EACC,QAAA,kBAAA,IAAA,CAAC,WAAA,EAAA,EACC,QAAA,EAAA;AAAA,sBAAA,GAAA,CAAC,eAAA,EAAA,EAAgB,CAAA;AAAA,0BAChB,WAAA,EAAA,EAAY;AAAA,KAAA,EACf,CAAA,EACF;AAAA,GAAA,EACF,CAAA;AAEJ","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,82 @@
1
+ import * as React from 'react';
2
+
3
+ type UseChromeHeightOptions = {
4
+ /**
5
+ * Custom property to publish the measured height to, on `<html>`. Pass
6
+ * `null` to publish nothing and use the returned number only.
7
+ *
8
+ * @default '--chrome-height'
9
+ */
10
+ property?: string | null;
11
+ };
12
+ type UseChromeHeightResult<T extends HTMLElement> = {
13
+ /**
14
+ * Attach to the element whose height should be tracked.
15
+ *
16
+ * A CALLBACK ref, not a ref object, for two reasons. It re-attaches the
17
+ * observer when the element itself changes — a chrome wrapper that unmounts
18
+ * and remounts, or swaps between two elements, would otherwise leave the
19
+ * observer watching the detached node, because an effect keyed on a ref
20
+ * object never re-runs when only `.current` changes. And it keeps the
21
+ * returned value readable during render: React Compiler's lint rejects
22
+ * reading a ref there, which a consumer doing `ref={chrome.ref}` would
23
+ * otherwise trip on every use.
24
+ */
25
+ ref: React.RefCallback<T>;
26
+ /** Live measured height in CSS pixels. `0` until the first measurement. */
27
+ height: number;
28
+ };
29
+ /**
30
+ * Measures a sticky chrome element and publishes its height as a CSS custom
31
+ * property on `<html>`, keeping it current as the element resizes.
32
+ *
33
+ * **Why this belongs in the package.** Several components already need the
34
+ * height of the chrome above them and have no way to ask for it: `MainNav`
35
+ * documents that a consumer stacking it under a sticky `Header` must set
36
+ * `--main-nav-top` to the header's height, and any page with anchor links
37
+ * needs the same number for `scroll-padding-top` or its targets land behind
38
+ * the chrome. Every consumer was therefore writing the same `ResizeObserver`,
39
+ * and the failure it prevents only appears at the widths where the header
40
+ * wraps to a second line — which is exactly where hand-written versions were
41
+ * hardcoding a constant instead.
42
+ *
43
+ * ```tsx
44
+ * const { ref, height } = useChromeHeight({ property: '--site-chrome-height' })
45
+ *
46
+ * return (
47
+ * <div ref={ref} className='sticky top-0 z-40'>
48
+ * <Header sticky={false} />
49
+ * <MainNav navigation={nav} />
50
+ * </div>
51
+ * )
52
+ * ```
53
+ *
54
+ * ```css
55
+ * html {
56
+ * scroll-padding-top: calc(var(--site-chrome-height, 0px) + 1.5rem);
57
+ * }
58
+ * ```
59
+ *
60
+ * Notes:
61
+ *
62
+ * - **Destructure the result, as above — do not hold it as one object.**
63
+ * `const chrome = useChromeHeight(); chrome.height` fails React Compiler's
64
+ * lint with *"Cannot access refs during render"*: the returned object carries
65
+ * a `ref`, so the compiler treats reading any property off it as reading a
66
+ * ref. Destructuring at the call site gives two plain bindings and the rule
67
+ * does not apply. Projects without that lint are unaffected either way.
68
+ * - **The number is `0` until after mount.** It is measured in an effect, so
69
+ * the server render and the first client render agree — reading the DOM
70
+ * during render would be a hydration mismatch. Give the custom property a
71
+ * fallback in CSS (`var(--site-chrome-height, 0px)`) for that first paint.
72
+ * - **The property is removed on unmount**, and whenever the tracked element
73
+ * changes, so a chrome element that goes away does not leave a stale offset
74
+ * behind for whatever renders next.
75
+ * - Height comes from `borderBoxSize`, not `getBoundingClientRect()`: the
76
+ * latter reports the *transformed* size, so a chrome element that animates
77
+ * with a transform would publish a height that does not match the space it
78
+ * occupies in layout.
79
+ */
80
+ declare function useChromeHeight<T extends HTMLElement = HTMLElement>({ property, }?: UseChromeHeightOptions): UseChromeHeightResult<T>;
81
+
82
+ export { type UseChromeHeightOptions, type UseChromeHeightResult, useChromeHeight };
@@ -0,0 +1,45 @@
1
+ "use client"
2
+ import * as React from 'react';
3
+
4
+ const DEFAULT_PROPERTY = "--chrome-height";
5
+ function useChromeHeight({
6
+ property = DEFAULT_PROPERTY
7
+ } = {}) {
8
+ const [element, setElement] = React.useState(null);
9
+ const [height, setHeight] = React.useState(0);
10
+ const ref = React.useCallback((node) => {
11
+ setElement(node);
12
+ }, []);
13
+ React.useEffect(() => {
14
+ if (!element) {
15
+ return;
16
+ }
17
+ const root = element.ownerDocument.documentElement;
18
+ function publish(next) {
19
+ setHeight(next);
20
+ if (property) {
21
+ root.style.setProperty(property, `${next}px`);
22
+ }
23
+ }
24
+ const observer = new ResizeObserver((entries) => {
25
+ const entry = entries[0];
26
+ if (!entry) {
27
+ return;
28
+ }
29
+ const box = entry.borderBoxSize?.[0];
30
+ publish(box ? box.blockSize : entry.contentRect.height);
31
+ });
32
+ observer.observe(element);
33
+ return () => {
34
+ observer.disconnect();
35
+ if (property) {
36
+ root.style.removeProperty(property);
37
+ }
38
+ };
39
+ }, [element, property]);
40
+ return { ref, height };
41
+ }
42
+
43
+ export { useChromeHeight };
44
+ //# sourceMappingURL=use-chrome-height.js.map
45
+ //# sourceMappingURL=use-chrome-height.js.map
@@ -0,0 +1 @@
1
+ {"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,IAAA,QAAA,CAAS,QAAQ,OAAO,CAAA;AAExB,IAAA,OAAO,MAAM;AACX,MAAA,QAAA,CAAS,UAAA,EAAW;AACpB,MAAA,IAAI,QAAA,EAAU;AACZ,QAAA,IAAA,CAAK,KAAA,CAAM,eAAe,QAAQ,CAAA;AAAA,MACpC;AAAA,IACF,CAAA;AAAA,EACF,CAAA,EAAG,CAAC,OAAA,EAAS,QAAQ,CAAC,CAAA;AAEtB,EAAA,OAAO,EAAE,KAAK,MAAA,EAAO;AACvB","file":"use-chrome-height.js","sourcesContent":["'use client'\n\nimport * as React from 'react'\n\n/** Default custom property the measured height is published to. */\nconst DEFAULT_PROPERTY = '--chrome-height'\n\ntype UseChromeHeightOptions = {\n /**\n * Custom property to publish the measured height to, on `<html>`. Pass\n * `null` to publish nothing and use the returned number only.\n *\n * @default '--chrome-height'\n */\n property?: string | null\n}\n\ntype UseChromeHeightResult<T extends HTMLElement> = {\n /**\n * Attach to the element whose height should be tracked.\n *\n * A CALLBACK ref, not a ref object, for two reasons. It re-attaches the\n * observer when the element itself changes — a chrome wrapper that unmounts\n * and remounts, or swaps between two elements, would otherwise leave the\n * observer watching the detached node, because an effect keyed on a ref\n * object never re-runs when only `.current` changes. And it keeps the\n * returned value readable during render: React Compiler's lint rejects\n * reading a ref there, which a consumer doing `ref={chrome.ref}` would\n * otherwise trip on every use.\n */\n ref: React.RefCallback<T>\n /** Live measured height in CSS pixels. `0` until the first measurement. */\n height: number\n}\n\n/**\n * Measures a sticky chrome element and publishes its height as a CSS custom\n * property on `<html>`, keeping it current as the element resizes.\n *\n * **Why this belongs in the package.** Several components already need the\n * height of the chrome above them and have no way to ask for it: `MainNav`\n * documents that a consumer stacking it under a sticky `Header` must set\n * `--main-nav-top` to the header's height, and any page with anchor links\n * needs the same number for `scroll-padding-top` or its targets land behind\n * the chrome. Every consumer was therefore writing the same `ResizeObserver`,\n * and the failure it prevents only appears at the widths where the header\n * wraps to a second line — which is exactly where hand-written versions were\n * hardcoding a constant instead.\n *\n * ```tsx\n * const { ref, height } = useChromeHeight({ property: '--site-chrome-height' })\n *\n * return (\n * <div ref={ref} className='sticky top-0 z-40'>\n * <Header sticky={false} />\n * <MainNav navigation={nav} />\n * </div>\n * )\n * ```\n *\n * ```css\n * html {\n * scroll-padding-top: calc(var(--site-chrome-height, 0px) + 1.5rem);\n * }\n * ```\n *\n * Notes:\n *\n * - **Destructure the result, as above — do not hold it as one object.**\n * `const chrome = useChromeHeight(); chrome.height` fails React Compiler's\n * lint with *\"Cannot access refs during render\"*: the returned object carries\n * a `ref`, so the compiler treats reading any property off it as reading a\n * ref. Destructuring at the call site gives two plain bindings and the rule\n * does not apply. Projects without that lint are unaffected either way.\n * - **The number is `0` until after mount.** It is measured in an effect, so\n * the server render and the first client render agree — reading the DOM\n * during render would be a hydration mismatch. Give the custom property a\n * fallback in CSS (`var(--site-chrome-height, 0px)`) for that first paint.\n * - **The property is removed on unmount**, and whenever the tracked element\n * changes, so a chrome element that goes away does not leave a stale offset\n * behind for whatever renders next.\n * - Height comes from `borderBoxSize`, not `getBoundingClientRect()`: the\n * latter reports the *transformed* size, so a chrome element that animates\n * with a transform would publish a height that does not match the space it\n * occupies in layout.\n */\nfunction useChromeHeight<T extends HTMLElement = HTMLElement>({\n property = DEFAULT_PROPERTY,\n}: UseChromeHeightOptions = {}): UseChromeHeightResult<T> {\n // The measured element is STATE, not a ref: the effect below has to re-run\n // when it changes, and a ref mutation does not re-render or re-run anything.\n const [element, setElement] = React.useState<T | null>(null)\n const [height, setHeight] = React.useState(0)\n\n // Wrapped rather than handing back `setElement` directly. A state setter also\n // accepts an updater FUNCTION, so its type is wider than a ref callback's and\n // its contract subtly different; this is exactly `RefCallback<T>` and nothing\n // more. `useCallback` keeps it stable, so React does not detach and reattach\n // the ref on every render.\n const ref = React.useCallback<React.RefCallback<T>>((node) => {\n setElement(node)\n }, [])\n\n React.useEffect(() => {\n if (!element) {\n return\n }\n\n const root = element.ownerDocument.documentElement\n\n function publish(next: number) {\n setHeight(next)\n if (property) {\n root.style.setProperty(property, `${next}px`)\n }\n }\n\n const observer = new ResizeObserver((entries) => {\n const entry = entries[0]\n if (!entry) {\n return\n }\n\n // `borderBoxSize` is the layout size, unaffected by any transform on the\n // element. It is an array to allow for fragmented boxes; the first entry\n // is the whole box for everything this hook is used on. The fallback\n // covers the (now historical) browsers that reported only contentRect.\n const box = entry.borderBoxSize?.[0]\n publish(box ? box.blockSize : entry.contentRect.height)\n })\n\n observer.observe(element)\n\n return () => {\n observer.disconnect()\n if (property) {\n root.style.removeProperty(property)\n }\n }\n }, [element, property])\n\n return { ref, height }\n}\n\nexport { useChromeHeight }\nexport type { UseChromeHeightOptions, UseChromeHeightResult }\n"]}
@@ -0,0 +1,13 @@
1
+ import * as React from 'react';
2
+ import { SVGProps } from 'react';
3
+
4
+ type IconProps = SVGProps<SVGSVGElement>;
5
+
6
+ declare function IconFacebook(props: IconProps): React.JSX.Element;
7
+ declare function IconX(props: IconProps): React.JSX.Element;
8
+ declare function IconYouTube(props: IconProps): React.JSX.Element;
9
+ declare function IconLinkedIn(props: IconProps): React.JSX.Element;
10
+ declare function IconInstagram(props: IconProps): React.JSX.Element;
11
+ declare function IconGitHub(props: IconProps): React.JSX.Element;
12
+
13
+ export { IconFacebook, IconGitHub, IconInstagram, IconLinkedIn, IconX, IconYouTube };
@@ -0,0 +1,56 @@
1
+ "use client"
2
+ import { jsx } from 'react/jsx-runtime';
3
+
4
+ function BrandGlyph({ children, ...props }) {
5
+ return /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "currentColor", "data-slot": "icon", ...props, children });
6
+ }
7
+ function IconFacebook(props) {
8
+ return /* @__PURE__ */ jsx(BrandGlyph, { ...props, children: /* @__PURE__ */ jsx(
9
+ "path",
10
+ {
11
+ fillRule: "evenodd",
12
+ clipRule: "evenodd",
13
+ d: "M22 12c0-5.523-4.477-10-10-10S2 6.477 2 12c0 4.991 3.657 9.128 8.438 9.878v-6.987h-2.54V12h2.54V9.797c0-2.506 1.492-3.89 3.777-3.89 1.094 0 2.238.195 2.238.195v2.46h-1.26c-1.243 0-1.63.771-1.63 1.562V12h2.773l-.443 2.89h-2.33v6.988C18.343 21.128 22 16.991 22 12z"
14
+ }
15
+ ) });
16
+ }
17
+ function IconX(props) {
18
+ return /* @__PURE__ */ jsx(BrandGlyph, { ...props, children: /* @__PURE__ */ jsx("path", { d: "M13.6823 10.6218 20.2391 3H18.6854L12.9921 9.61788 8.44486 3H3.2002L10.0765 13.0074 3.2002 21H4.75404L10.7663 14.0113 15.5685 21H20.8131L13.6819 10.6218H13.6823ZM11.5541 13.0956 10.8574 12.0991 5.31391 4.16971H7.70053L12.1742 10.5689 12.8709 11.5655 18.6861 19.8835H16.2995L11.5541 13.096V13.0956Z" }) });
19
+ }
20
+ function IconYouTube(props) {
21
+ return /* @__PURE__ */ jsx(BrandGlyph, { ...props, children: /* @__PURE__ */ jsx(
22
+ "path",
23
+ {
24
+ fillRule: "evenodd",
25
+ clipRule: "evenodd",
26
+ d: "M19.812 5.418c.861.23 1.538.907 1.768 1.768C21.998 8.746 22 12 22 12s0 3.255-.418 4.814a2.504 2.504 0 0 1-1.768 1.768c-1.56.419-7.814.419-7.814.419s-6.255 0-7.814-.419a2.505 2.505 0 0 1-1.768-1.768C2 15.255 2 12 2 12s0-3.255.417-4.814a2.507 2.507 0 0 1 1.768-1.768C5.744 5 11.998 5 11.998 5s6.255 0 7.814.418ZM15.194 12 10 15V9l5.194 3Z"
27
+ }
28
+ ) });
29
+ }
30
+ function IconLinkedIn(props) {
31
+ return /* @__PURE__ */ jsx(BrandGlyph, { ...props, children: /* @__PURE__ */ jsx("path", { d: "M19 3A2 2 0 0 1 21 5V19A2 2 0 0 1 19 21H5A2 2 0 0 1 3 19V5A2 2 0 0 1 5 3H19M18.5 18.5V13.2A3.26 3.26 0 0 0 15.24 9.94C14.39 9.94 13.4 10.46 12.92 11.24V10.13H10.13V18.5H12.92V13.57C12.92 12.8 13.54 12.17 14.31 12.17A1.4 1.4 0 0 1 15.71 13.57V18.5H18.5M6.88 8.56A1.68 1.68 0 0 0 8.56 6.88C8.56 5.95 7.81 5.19 6.88 5.19A1.69 1.69 0 0 0 5.19 6.88C5.19 7.81 5.95 8.56 6.88 8.56M8.27 18.5V10.13H5.5V18.5H8.27Z" }) });
32
+ }
33
+ function IconInstagram(props) {
34
+ return /* @__PURE__ */ jsx(BrandGlyph, { ...props, children: /* @__PURE__ */ jsx(
35
+ "path",
36
+ {
37
+ fillRule: "evenodd",
38
+ clipRule: "evenodd",
39
+ d: "M12.315 2c2.43 0 2.784.013 3.808.06 1.064.049 1.791.218 2.427.465a4.902 4.902 0 011.772 1.153 4.902 4.902 0 011.153 1.772c.247.636.416 1.363.465 2.427.048 1.067.06 1.407.06 4.123v.08c0 2.643-.012 2.987-.06 4.043-.049 1.064-.218 1.791-.465 2.427a4.902 4.902 0 01-1.153 1.772 4.902 4.902 0 01-1.772 1.153c-.636.247-1.363.416-2.427.465-1.067.048-1.407.06-4.123.06h-.08c-2.643 0-2.987-.012-4.043-.06-1.064-.049-1.791-.218-2.427-.465a4.902 4.902 0 01-1.772-1.153 4.902 4.902 0 01-1.153-1.772c-.247-.636-.416-1.363-.465-2.427-.047-1.024-.06-1.379-.06-3.808v-.63c0-2.43.013-2.784.06-3.808.049-1.064.218-1.791.465-2.427a4.902 4.902 0 011.153-1.772A4.902 4.902 0 015.45 2.525c.636-.247 1.363-.416 2.427-.465C8.901 2.013 9.256 2 11.685 2h.63zm-.081 1.802h-.468c-2.456 0-2.784.011-3.807.058-.975.045-1.504.207-1.857.344-.467.182-.8.398-1.15.748-.35.35-.566.683-.748 1.15-.137.353-.3.882-.344 1.857-.047 1.023-.058 1.351-.058 3.807v.468c0 2.456.011 2.784.058 3.807.045.975.207 1.504.344 1.857.182.466.399.8.748 1.15.35.35.683.566 1.15.748.353.137.882.3 1.857.344 1.054.048 1.37.058 4.041.058h.08c2.597 0 2.917-.01 3.96-.058.976-.045 1.505-.207 1.858-.344.466-.182.8-.398 1.15-.748.35-.35.566-.683.748-1.15.137-.353.3-.882.344-1.857.048-1.055.058-1.37.058-4.041v-.08c0-2.597-.01-2.917-.058-3.96-.045-.976-.207-1.505-.344-1.858a3.097 3.097 0 00-.748-1.15 3.098 3.098 0 00-1.15-.748c-.353-.137-.882-.3-1.857-.344-1.023-.047-1.351-.058-3.807-.058zM12 6.865a5.135 5.135 0 110 10.27 5.135 5.135 0 010-10.27zm0 1.802a3.333 3.333 0 100 6.666 3.333 3.333 0 000-6.666zm5.338-3.205a1.2 1.2 0 110 2.4 1.2 1.2 0 010-2.4z"
40
+ }
41
+ ) });
42
+ }
43
+ function IconGitHub(props) {
44
+ return /* @__PURE__ */ jsx(BrandGlyph, { ...props, children: /* @__PURE__ */ jsx(
45
+ "path",
46
+ {
47
+ fillRule: "evenodd",
48
+ clipRule: "evenodd",
49
+ d: "M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z"
50
+ }
51
+ ) });
52
+ }
53
+
54
+ export { IconFacebook, IconGitHub, IconInstagram, IconLinkedIn, IconX, IconYouTube };
55
+ //# sourceMappingURL=index.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AAA,EAAY,GAAG,KAAA,EACd,QAAA,kBAAA,GAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,QAAA,EAAS,SAAA;AAAA,MACT,QAAA,EAAS,SAAA;AAAA,MACT,CAAA,EAAE;AAAA;AAAA,GACJ,EACF,CAAA;AAEJ;AAEO,SAAS,WAAW,KAAA,EAAkB;AAC3C,EAAA,uBACE,GAAA,CAAC,UAAA,EAAA,EAAY,GAAG,KAAA,EACd,QAAA,kBAAA,GAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,QAAA,EAAS,SAAA;AAAA,MACT,QAAA,EAAS,SAAA;AAAA,MACT,CAAA,EAAE;AAAA;AAAA,GACJ,EACF,CAAA;AAEJ","file":"index.js","sourcesContent":["'use client'\n\nimport type { IconProps } from '../types.js'\n\n/**\n * Third-party brand marks, for the footer's social row.\n *\n * **Why these are not in the main icon set.** That set is Material\n * Symbols — 3,900+ glyphs, generated from a dump by\n * `scripts/generate-icons.mjs`, and containing no brand marks at all. But\n * `FooterSocialLinkItem` REQUIRES an `icon`, so the footer could not be\n * completed from the package alone and every NSW site hand-copied the same six\n * SVG paths. They then drift independently: X replaced Twitter once already,\n * and each site absorbed that on its own schedule.\n *\n * They live in a subdirectory rather than beside the generated modules for two\n * concrete reasons:\n *\n * - `generate-icons.mjs regenerate` **deletes everything** in `src/icons/`\n * before writing, so a hand-authored module there is lost on the next\n * regeneration.\n * - `check:icons` requires every `*.tsx` directly in `src/icons/` to be listed\n * in the generated barrel and to export `Icon<PascalCasedFilename>`. It reads\n * that directory non-recursively, so this subdirectory is correctly invisible\n * to it.\n *\n * **These are client references, unlike the generated set.** They are handed to\n * `FooterSocialLink` — a client component — as a prop, and a plain server\n * module's function cannot cross that boundary (\"Functions cannot be passed\n * directly to Client Components\"). The `'use client'` directive makes each\n * export serialisable, so the component form works from a server page.\n *\n * The cost is that the module ships to the browser, where a plain icon module\n * rendered as an element (`<IconLinkedIn />`) would ship nothing. That trade is\n * deliberate here and not in the generated set: brand marks exist for the\n * footer's social row, which renders through `ButtonLink` — already a client\n * component — so the marks were bound for the client anyway, and six small\n * paths is a fair price for the component form working. Consumers who want the\n * zero-JavaScript path can still pass an element. The `icons/client` entry\n * point makes the same trade for the Material Symbols set, and its source has\n * the fuller explanation.\n *\n * Each mark is a `currentColor` glyph on a 24×24 grid, so `FooterSocialLink`\n * sizes and colours it through `ButtonLink`'s icon slot, which also supplies\n * the 44px touch target and the accessible name.\n *\n * Marks are reproduced from each platform's published brand assets. They are\n * the trademarks of their respective owners and are included solely to link to\n * an official NSW Government presence on those platforms; they carry no NSW\n * Government endorsement of the platform, and must not be restyled beyond\n * colour.\n */\nfunction BrandGlyph({ children, ...props }: IconProps) {\n return (\n <svg viewBox='0 0 24 24' fill='currentColor' data-slot='icon' {...props}>\n {children}\n </svg>\n )\n}\n\nexport function IconFacebook(props: IconProps) {\n return (\n <BrandGlyph {...props}>\n <path\n fillRule='evenodd'\n clipRule='evenodd'\n d='M22 12c0-5.523-4.477-10-10-10S2 6.477 2 12c0 4.991 3.657 9.128 8.438 9.878v-6.987h-2.54V12h2.54V9.797c0-2.506 1.492-3.89 3.777-3.89 1.094 0 2.238.195 2.238.195v2.46h-1.26c-1.243 0-1.63.771-1.63 1.562V12h2.773l-.443 2.89h-2.33v6.988C18.343 21.128 22 16.991 22 12z'\n />\n </BrandGlyph>\n )\n}\n\nexport function IconX(props: IconProps) {\n return (\n <BrandGlyph {...props}>\n <path d='M13.6823 10.6218 20.2391 3H18.6854L12.9921 9.61788 8.44486 3H3.2002L10.0765 13.0074 3.2002 21H4.75404L10.7663 14.0113 15.5685 21H20.8131L13.6819 10.6218H13.6823ZM11.5541 13.0956 10.8574 12.0991 5.31391 4.16971H7.70053L12.1742 10.5689 12.8709 11.5655 18.6861 19.8835H16.2995L11.5541 13.096V13.0956Z' />\n </BrandGlyph>\n )\n}\n\nexport function IconYouTube(props: IconProps) {\n return (\n <BrandGlyph {...props}>\n <path\n fillRule='evenodd'\n clipRule='evenodd'\n d='M19.812 5.418c.861.23 1.538.907 1.768 1.768C21.998 8.746 22 12 22 12s0 3.255-.418 4.814a2.504 2.504 0 0 1-1.768 1.768c-1.56.419-7.814.419-7.814.419s-6.255 0-7.814-.419a2.505 2.505 0 0 1-1.768-1.768C2 15.255 2 12 2 12s0-3.255.417-4.814a2.507 2.507 0 0 1 1.768-1.768C5.744 5 11.998 5 11.998 5s6.255 0 7.814.418ZM15.194 12 10 15V9l5.194 3Z'\n />\n </BrandGlyph>\n )\n}\n\nexport function IconLinkedIn(props: IconProps) {\n return (\n <BrandGlyph {...props}>\n <path d='M19 3A2 2 0 0 1 21 5V19A2 2 0 0 1 19 21H5A2 2 0 0 1 3 19V5A2 2 0 0 1 5 3H19M18.5 18.5V13.2A3.26 3.26 0 0 0 15.24 9.94C14.39 9.94 13.4 10.46 12.92 11.24V10.13H10.13V18.5H12.92V13.57C12.92 12.8 13.54 12.17 14.31 12.17A1.4 1.4 0 0 1 15.71 13.57V18.5H18.5M6.88 8.56A1.68 1.68 0 0 0 8.56 6.88C8.56 5.95 7.81 5.19 6.88 5.19A1.69 1.69 0 0 0 5.19 6.88C5.19 7.81 5.95 8.56 6.88 8.56M8.27 18.5V10.13H5.5V18.5H8.27Z' />\n </BrandGlyph>\n )\n}\n\nexport function IconInstagram(props: IconProps) {\n return (\n <BrandGlyph {...props}>\n <path\n fillRule='evenodd'\n clipRule='evenodd'\n d='M12.315 2c2.43 0 2.784.013 3.808.06 1.064.049 1.791.218 2.427.465a4.902 4.902 0 011.772 1.153 4.902 4.902 0 011.153 1.772c.247.636.416 1.363.465 2.427.048 1.067.06 1.407.06 4.123v.08c0 2.643-.012 2.987-.06 4.043-.049 1.064-.218 1.791-.465 2.427a4.902 4.902 0 01-1.153 1.772 4.902 4.902 0 01-1.772 1.153c-.636.247-1.363.416-2.427.465-1.067.048-1.407.06-4.123.06h-.08c-2.643 0-2.987-.012-4.043-.06-1.064-.049-1.791-.218-2.427-.465a4.902 4.902 0 01-1.772-1.153 4.902 4.902 0 01-1.153-1.772c-.247-.636-.416-1.363-.465-2.427-.047-1.024-.06-1.379-.06-3.808v-.63c0-2.43.013-2.784.06-3.808.049-1.064.218-1.791.465-2.427a4.902 4.902 0 011.153-1.772A4.902 4.902 0 015.45 2.525c.636-.247 1.363-.416 2.427-.465C8.901 2.013 9.256 2 11.685 2h.63zm-.081 1.802h-.468c-2.456 0-2.784.011-3.807.058-.975.045-1.504.207-1.857.344-.467.182-.8.398-1.15.748-.35.35-.566.683-.748 1.15-.137.353-.3.882-.344 1.857-.047 1.023-.058 1.351-.058 3.807v.468c0 2.456.011 2.784.058 3.807.045.975.207 1.504.344 1.857.182.466.399.8.748 1.15.35.35.683.566 1.15.748.353.137.882.3 1.857.344 1.054.048 1.37.058 4.041.058h.08c2.597 0 2.917-.01 3.96-.058.976-.045 1.505-.207 1.858-.344.466-.182.8-.398 1.15-.748.35-.35.566-.683.748-1.15.137-.353.3-.882.344-1.857.048-1.055.058-1.37.058-4.041v-.08c0-2.597-.01-2.917-.058-3.96-.045-.976-.207-1.505-.344-1.858a3.097 3.097 0 00-.748-1.15 3.098 3.098 0 00-1.15-.748c-.353-.137-.882-.3-1.857-.344-1.023-.047-1.351-.058-3.807-.058zM12 6.865a5.135 5.135 0 110 10.27 5.135 5.135 0 010-10.27zm0 1.802a3.333 3.333 0 100 6.666 3.333 3.333 0 000-6.666zm5.338-3.205a1.2 1.2 0 110 2.4 1.2 1.2 0 010-2.4z'\n />\n </BrandGlyph>\n )\n}\n\nexport function IconGitHub(props: IconProps) {\n return (\n <BrandGlyph {...props}>\n <path\n fillRule='evenodd'\n clipRule='evenodd'\n d='M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z'\n />\n </BrandGlyph>\n )\n}\n"]}
@@ -0,0 +1 @@
1
+ export * from './index.js'
@@ -0,0 +1,2 @@
1
+ "use client"
2
+ export * from './index.js';