@contractspec/lib.accessibility 1.57.0 → 1.59.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,173 @@
1
+ // src/preferences.tsx
2
+ import React from "react";
3
+ import { jsxDEV } from "react/jsx-dev-runtime";
4
+ "use client";
5
+ var DEFAULT_PREFERENCES = {
6
+ textSize: "m",
7
+ textSpacing: "normal",
8
+ lineHeight: "normal",
9
+ underlineLinks: false,
10
+ focusRing: "normal",
11
+ reduceMotion: "system",
12
+ highContrast: false,
13
+ dyslexiaFont: false
14
+ };
15
+ var STORAGE_KEY = "a11y:preferences:v1";
16
+ function getStoredPreferences() {
17
+ try {
18
+ const raw = typeof window !== "undefined" ? window.localStorage.getItem(STORAGE_KEY) : null;
19
+ if (!raw)
20
+ return null;
21
+ const parsed = JSON.parse(raw);
22
+ return { ...DEFAULT_PREFERENCES, ...parsed };
23
+ } catch {
24
+ return null;
25
+ }
26
+ }
27
+ function savePreferences(prefs) {
28
+ try {
29
+ if (typeof window !== "undefined") {
30
+ window.localStorage.setItem(STORAGE_KEY, JSON.stringify(prefs));
31
+ }
32
+ } catch {}
33
+ }
34
+ function applyCssVariables(prefs) {
35
+ if (typeof document === "undefined")
36
+ return;
37
+ const root = document.documentElement;
38
+ const body = document.body;
39
+ const sizeMap = {
40
+ s: "0.95",
41
+ m: "1",
42
+ l: "1.1",
43
+ xl: "1.25"
44
+ };
45
+ root.style.setProperty("--a11y-text-scale", sizeMap[prefs.textSize]);
46
+ const targetMin = prefs.textSize === "l" || prefs.textSize === "xl" ? "44px" : "0px";
47
+ root.style.setProperty("--a11y-target-min", targetMin);
48
+ root.style.setProperty("--a11y-letter-spacing", prefs.textSpacing === "increased" ? "0.12em" : "normal");
49
+ root.style.setProperty("--a11y-word-spacing", prefs.textSpacing === "increased" ? "0.16em" : "normal");
50
+ root.style.setProperty("--a11y-line-height", prefs.lineHeight === "increased" ? "1.6" : "1.5");
51
+ root.style.setProperty("--a11y-underline-links", prefs.underlineLinks ? "underline" : "revert");
52
+ root.style.setProperty("--a11y-focus-ring-width", prefs.focusRing === "thick" ? "4px" : "2px");
53
+ root.style.setProperty("--a11y-reduce-motion", prefs.reduceMotion);
54
+ root.style.setProperty("--a11y-contrast-mode", prefs.highContrast ? "high" : "normal");
55
+ if (prefs.highContrast) {
56
+ root.setAttribute("data-contrast", "high");
57
+ } else {
58
+ root.removeAttribute("data-contrast");
59
+ }
60
+ root.style.setProperty("--a11y-font-family-alt-enabled", prefs.dyslexiaFont ? "1" : "0");
61
+ if (body) {
62
+ if (prefs.textSpacing === "increased") {
63
+ body.style.letterSpacing = "0.12em";
64
+ body.style.wordSpacing = "0.16em";
65
+ } else {
66
+ body.style.letterSpacing = "";
67
+ body.style.wordSpacing = "";
68
+ }
69
+ body.style.lineHeight = prefs.lineHeight === "increased" ? "1.6" : "";
70
+ }
71
+ }
72
+ var PreferencesContext = React.createContext(null);
73
+ function useA11YPreferences() {
74
+ const ctx = React.useContext(PreferencesContext);
75
+ if (!ctx)
76
+ throw new Error("useA11YPreferences must be used within A11YPreferencesProvider");
77
+ return ctx;
78
+ }
79
+ function A11YPreferencesProvider({
80
+ children
81
+ }) {
82
+ const [preferences, setPreferencesState] = React.useState(DEFAULT_PREFERENCES);
83
+ const [hydrated, setHydrated] = React.useState(false);
84
+ React.useEffect(() => {
85
+ const stored = getStoredPreferences();
86
+ const next = stored ?? DEFAULT_PREFERENCES;
87
+ setPreferencesState(next);
88
+ setHydrated(true);
89
+ applyCssVariables(next);
90
+ }, []);
91
+ const setPreferences = React.useCallback((updater) => {
92
+ setPreferencesState((prev) => {
93
+ const next = typeof updater === "function" ? updater(prev) : { ...prev, ...updater };
94
+ savePreferences(next);
95
+ applyCssVariables(next);
96
+ try {
97
+ if (typeof window !== "undefined") {
98
+ const changed = {};
99
+ for (const key of Object.keys(next)) {
100
+ if (next[key] !== prev[key]) {
101
+ changed[key] = next[key];
102
+ }
103
+ }
104
+ window.dispatchEvent(new CustomEvent("a11y:pref_changed", {
105
+ detail: {
106
+ previous: prev,
107
+ current: next,
108
+ changed
109
+ }
110
+ }));
111
+ }
112
+ } catch {}
113
+ return next;
114
+ });
115
+ }, []);
116
+ const value = React.useMemo(() => ({ preferences, setPreferences }), [preferences, setPreferences]);
117
+ return /* @__PURE__ */ jsxDEV(PreferencesContext, {
118
+ value,
119
+ children: [
120
+ children,
121
+ !hydrated ? null : null
122
+ ]
123
+ }, undefined, true, undefined, this);
124
+ }
125
+ function a11yRootClassName() {
126
+ return "a11y-root";
127
+ }
128
+
129
+ // src/next-route-announcer.tsx
130
+ import * as React2 from "react";
131
+ import { usePathname } from "next/navigation";
132
+ import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
133
+ "use client";
134
+ function NextRouteAnnouncer() {
135
+ const pathname = usePathname();
136
+ const [message, setMessage] = React2.useState("");
137
+ React2.useEffect(() => {
138
+ if (typeof document !== "undefined") {
139
+ setMessage(document.title || pathname || "");
140
+ }
141
+ }, [pathname]);
142
+ return /* @__PURE__ */ jsxDEV2("div", {
143
+ "aria-live": "polite",
144
+ "aria-atomic": "true",
145
+ className: "sr-only",
146
+ children: message
147
+ }, undefined, false, undefined, this);
148
+ }
149
+
150
+ // src/AccessibilityProvider.tsx
151
+ import { SRLiveRegionProvider } from "@contractspec/lib.ui-kit-web/ui/live-region";
152
+ import { SkipLink } from "@contractspec/lib.ui-kit-web/ui/skip-link";
153
+ import { jsxDEV as jsxDEV3 } from "react/jsx-dev-runtime";
154
+ "use client";
155
+ function AccessibilityProvider({
156
+ children,
157
+ skipTargetId = "main"
158
+ }) {
159
+ return /* @__PURE__ */ jsxDEV3(A11YPreferencesProvider, {
160
+ children: /* @__PURE__ */ jsxDEV3(SRLiveRegionProvider, {
161
+ children: [
162
+ /* @__PURE__ */ jsxDEV3(SkipLink, {
163
+ targetId: skipTargetId
164
+ }, undefined, false, undefined, this),
165
+ /* @__PURE__ */ jsxDEV3(NextRouteAnnouncer, {}, undefined, false, undefined, this),
166
+ children
167
+ ]
168
+ }, undefined, true, undefined, this)
169
+ }, undefined, false, undefined, this);
170
+ }
171
+ export {
172
+ AccessibilityProvider
173
+ };
@@ -1,3 +1,4 @@
1
+ /* src/styles.css */
1
2
  :root {
2
3
  --a11y-text-scale: 1;
3
4
  --a11y-letter-spacing: normal;
@@ -10,14 +11,11 @@
10
11
  --a11y-font-family-alt-enabled: 0;
11
12
  }
12
13
 
13
- html,
14
- body {
14
+ html, body {
15
15
  font-size: calc(16px * var(--a11y-text-scale));
16
16
  }
17
17
 
18
- body,
19
- p,
20
- li {
18
+ body, p, li {
21
19
  letter-spacing: var(--a11y-letter-spacing);
22
20
  word-spacing: var(--a11y-word-spacing);
23
21
  line-height: var(--a11y-line-height);
@@ -27,7 +25,7 @@ a {
27
25
  text-decoration: var(--a11y-underline-links);
28
26
  }
29
27
 
30
- :where(button, [role='button'], a, input, select, textarea) {
28
+ :where(button, [role="button"], a, input, select, textarea) {
31
29
  outline-offset: 2px;
32
30
  min-height: var(--a11y-target-min, 0);
33
31
  min-width: var(--a11y-target-min, 0);
@@ -37,38 +35,26 @@ a {
37
35
  outline: var(--a11y-focus-ring-width) solid currentColor;
38
36
  }
39
37
 
40
- /* High contrast mode surface example tokens (apps should map their colors) */
41
- :root[data-contrast='high'],
42
- :root[style*='--a11y-contrast-mode: high'] {
43
- /* Apps can read this signal to swap theme */
44
- }
45
-
46
- /* Dyslexia-friendly font: consumers should apply a font-family when enabled */
47
- :root[style*='--a11y-font-family-alt-enabled: 1'] body {
38
+ :root[style*="--a11y-font-family-alt-enabled: 1"] body {
48
39
  font-family: var(--font-dyslexia, system-ui, sans-serif);
49
40
  }
50
41
 
51
- /* Respect reduced motion preference and explicit override */
52
42
  @media (prefers-reduced-motion: reduce) {
53
- :root[style*='--a11y-reduce-motion: system'] * {
43
+ :root[style*="--a11y-reduce-motion: system"] * {
54
44
  animation: none !important;
55
- transition: none !important;
56
45
  scroll-behavior: auto !important;
46
+ transition: none !important;
57
47
  }
58
48
  }
59
- :root[style*='--a11y-reduce-motion: reduce'] * {
49
+
50
+ :root[style*="--a11y-reduce-motion: reduce"] * {
60
51
  animation: none !important;
61
- transition: none !important;
62
52
  scroll-behavior: auto !important;
53
+ transition: none !important;
63
54
  }
64
55
 
65
- /* Explicit fallbacks for environments not honoring custom properties thoroughly */
66
56
  body {
67
- /* If variables are missing, ensure readable defaults */
68
57
  letter-spacing: var(--a11y-letter-spacing, normal);
69
58
  word-spacing: var(--a11y-word-spacing, normal);
70
59
  line-height: var(--a11y-line-height, 1.5);
71
60
  }
72
-
73
-
74
- /*# sourceMappingURL=styles-C5GUMPoX.css.map*/
@@ -0,0 +1,427 @@
1
+ // src/preferences.tsx
2
+ import React from "react";
3
+ import { jsxDEV } from "react/jsx-dev-runtime";
4
+ "use client";
5
+ var DEFAULT_PREFERENCES = {
6
+ textSize: "m",
7
+ textSpacing: "normal",
8
+ lineHeight: "normal",
9
+ underlineLinks: false,
10
+ focusRing: "normal",
11
+ reduceMotion: "system",
12
+ highContrast: false,
13
+ dyslexiaFont: false
14
+ };
15
+ var STORAGE_KEY = "a11y:preferences:v1";
16
+ function getStoredPreferences() {
17
+ try {
18
+ const raw = typeof window !== "undefined" ? window.localStorage.getItem(STORAGE_KEY) : null;
19
+ if (!raw)
20
+ return null;
21
+ const parsed = JSON.parse(raw);
22
+ return { ...DEFAULT_PREFERENCES, ...parsed };
23
+ } catch {
24
+ return null;
25
+ }
26
+ }
27
+ function savePreferences(prefs) {
28
+ try {
29
+ if (typeof window !== "undefined") {
30
+ window.localStorage.setItem(STORAGE_KEY, JSON.stringify(prefs));
31
+ }
32
+ } catch {}
33
+ }
34
+ function applyCssVariables(prefs) {
35
+ if (typeof document === "undefined")
36
+ return;
37
+ const root = document.documentElement;
38
+ const body = document.body;
39
+ const sizeMap = {
40
+ s: "0.95",
41
+ m: "1",
42
+ l: "1.1",
43
+ xl: "1.25"
44
+ };
45
+ root.style.setProperty("--a11y-text-scale", sizeMap[prefs.textSize]);
46
+ const targetMin = prefs.textSize === "l" || prefs.textSize === "xl" ? "44px" : "0px";
47
+ root.style.setProperty("--a11y-target-min", targetMin);
48
+ root.style.setProperty("--a11y-letter-spacing", prefs.textSpacing === "increased" ? "0.12em" : "normal");
49
+ root.style.setProperty("--a11y-word-spacing", prefs.textSpacing === "increased" ? "0.16em" : "normal");
50
+ root.style.setProperty("--a11y-line-height", prefs.lineHeight === "increased" ? "1.6" : "1.5");
51
+ root.style.setProperty("--a11y-underline-links", prefs.underlineLinks ? "underline" : "revert");
52
+ root.style.setProperty("--a11y-focus-ring-width", prefs.focusRing === "thick" ? "4px" : "2px");
53
+ root.style.setProperty("--a11y-reduce-motion", prefs.reduceMotion);
54
+ root.style.setProperty("--a11y-contrast-mode", prefs.highContrast ? "high" : "normal");
55
+ if (prefs.highContrast) {
56
+ root.setAttribute("data-contrast", "high");
57
+ } else {
58
+ root.removeAttribute("data-contrast");
59
+ }
60
+ root.style.setProperty("--a11y-font-family-alt-enabled", prefs.dyslexiaFont ? "1" : "0");
61
+ if (body) {
62
+ if (prefs.textSpacing === "increased") {
63
+ body.style.letterSpacing = "0.12em";
64
+ body.style.wordSpacing = "0.16em";
65
+ } else {
66
+ body.style.letterSpacing = "";
67
+ body.style.wordSpacing = "";
68
+ }
69
+ body.style.lineHeight = prefs.lineHeight === "increased" ? "1.6" : "";
70
+ }
71
+ }
72
+ var PreferencesContext = React.createContext(null);
73
+ function useA11YPreferences() {
74
+ const ctx = React.useContext(PreferencesContext);
75
+ if (!ctx)
76
+ throw new Error("useA11YPreferences must be used within A11YPreferencesProvider");
77
+ return ctx;
78
+ }
79
+ function A11YPreferencesProvider({
80
+ children
81
+ }) {
82
+ const [preferences, setPreferencesState] = React.useState(DEFAULT_PREFERENCES);
83
+ const [hydrated, setHydrated] = React.useState(false);
84
+ React.useEffect(() => {
85
+ const stored = getStoredPreferences();
86
+ const next = stored ?? DEFAULT_PREFERENCES;
87
+ setPreferencesState(next);
88
+ setHydrated(true);
89
+ applyCssVariables(next);
90
+ }, []);
91
+ const setPreferences = React.useCallback((updater) => {
92
+ setPreferencesState((prev) => {
93
+ const next = typeof updater === "function" ? updater(prev) : { ...prev, ...updater };
94
+ savePreferences(next);
95
+ applyCssVariables(next);
96
+ try {
97
+ if (typeof window !== "undefined") {
98
+ const changed = {};
99
+ for (const key of Object.keys(next)) {
100
+ if (next[key] !== prev[key]) {
101
+ changed[key] = next[key];
102
+ }
103
+ }
104
+ window.dispatchEvent(new CustomEvent("a11y:pref_changed", {
105
+ detail: {
106
+ previous: prev,
107
+ current: next,
108
+ changed
109
+ }
110
+ }));
111
+ }
112
+ } catch {}
113
+ return next;
114
+ });
115
+ }, []);
116
+ const value = React.useMemo(() => ({ preferences, setPreferences }), [preferences, setPreferences]);
117
+ return /* @__PURE__ */ jsxDEV(PreferencesContext, {
118
+ value,
119
+ children: [
120
+ children,
121
+ !hydrated ? null : null
122
+ ]
123
+ }, undefined, true, undefined, this);
124
+ }
125
+ function a11yRootClassName() {
126
+ return "a11y-root";
127
+ }
128
+
129
+ // src/AccessibilityPanel.tsx
130
+ import {
131
+ Dialog,
132
+ DialogClose,
133
+ DialogContent,
134
+ DialogOverlay,
135
+ DialogPortal,
136
+ DialogTitle,
137
+ DialogTrigger
138
+ } from "@contractspec/lib.ui-kit-web/ui/dialog";
139
+ import { Button } from "@contractspec/lib.design-system";
140
+ import { Switch } from "@contractspec/lib.ui-kit-web/ui/switch";
141
+ import { Label } from "@contractspec/lib.ui-kit-web/ui/label";
142
+ import {
143
+ Select,
144
+ SelectContent,
145
+ SelectItem,
146
+ SelectTrigger,
147
+ SelectValue
148
+ } from "@contractspec/lib.ui-kit-web/ui/select";
149
+ import { cn } from "@contractspec/lib.ui-kit-web/ui/utils";
150
+ import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
151
+ "use client";
152
+ function AccessibilityPanel({ className }) {
153
+ const { preferences, setPreferences } = useA11YPreferences();
154
+ return /* @__PURE__ */ jsxDEV2(Dialog, {
155
+ children: [
156
+ /* @__PURE__ */ jsxDEV2(DialogTrigger, {
157
+ asChild: true,
158
+ children: /* @__PURE__ */ jsxDEV2(Button, {
159
+ variant: "outline",
160
+ "aria-haspopup": "dialog",
161
+ children: "Accessibility"
162
+ }, undefined, false, undefined, this)
163
+ }, undefined, false, undefined, this),
164
+ /* @__PURE__ */ jsxDEV2(DialogPortal, {
165
+ children: [
166
+ /* @__PURE__ */ jsxDEV2(DialogOverlay, {
167
+ className: "fixed inset-0 z-50 bg-black/40"
168
+ }, undefined, false, undefined, this),
169
+ /* @__PURE__ */ jsxDEV2(DialogContent, {
170
+ className: cn("bg-background focus-visible:ring-ring max-w-md p-6 shadow-lg outline-hidden focus-visible:ring-2", className),
171
+ "aria-describedby": "a11y-panel-desc",
172
+ children: [
173
+ /* @__PURE__ */ jsxDEV2(DialogTitle, {
174
+ className: "text-lg font-semibold",
175
+ children: "Accessibility settings"
176
+ }, undefined, false, undefined, this),
177
+ /* @__PURE__ */ jsxDEV2("p", {
178
+ id: "a11y-panel-desc",
179
+ className: "text-muted-foreground text-sm",
180
+ children: "Adjust text size, spacing, focus and motion to suit your needs."
181
+ }, undefined, false, undefined, this),
182
+ /* @__PURE__ */ jsxDEV2("div", {
183
+ className: "mt-6 space-y-6",
184
+ children: [
185
+ /* @__PURE__ */ jsxDEV2("div", {
186
+ className: "space-y-2",
187
+ children: [
188
+ /* @__PURE__ */ jsxDEV2(Label, {
189
+ children: "Text size"
190
+ }, undefined, false, undefined, this),
191
+ /* @__PURE__ */ jsxDEV2(Select, {
192
+ value: preferences.textSize,
193
+ onValueChange: (v) => setPreferences({ textSize: v }),
194
+ children: [
195
+ /* @__PURE__ */ jsxDEV2(SelectTrigger, {
196
+ "aria-label": "Text size",
197
+ children: /* @__PURE__ */ jsxDEV2(SelectValue, {}, undefined, false, undefined, this)
198
+ }, undefined, false, undefined, this),
199
+ /* @__PURE__ */ jsxDEV2(SelectContent, {
200
+ children: [
201
+ /* @__PURE__ */ jsxDEV2(SelectItem, {
202
+ value: "s",
203
+ children: "Small"
204
+ }, undefined, false, undefined, this),
205
+ /* @__PURE__ */ jsxDEV2(SelectItem, {
206
+ value: "m",
207
+ children: "Medium"
208
+ }, undefined, false, undefined, this),
209
+ /* @__PURE__ */ jsxDEV2(SelectItem, {
210
+ value: "l",
211
+ children: "Large"
212
+ }, undefined, false, undefined, this),
213
+ /* @__PURE__ */ jsxDEV2(SelectItem, {
214
+ value: "xl",
215
+ children: "Extra Large"
216
+ }, undefined, false, undefined, this)
217
+ ]
218
+ }, undefined, true, undefined, this)
219
+ ]
220
+ }, undefined, true, undefined, this)
221
+ ]
222
+ }, undefined, true, undefined, this),
223
+ /* @__PURE__ */ jsxDEV2("div", {
224
+ className: "flex items-center justify-between",
225
+ children: [
226
+ /* @__PURE__ */ jsxDEV2(Label, {
227
+ htmlFor: "text-spacing",
228
+ children: "Increase text spacing (WCAG 1.4.12)"
229
+ }, undefined, false, undefined, this),
230
+ /* @__PURE__ */ jsxDEV2(Switch, {
231
+ id: "text-spacing",
232
+ checked: preferences.textSpacing === "increased",
233
+ onCheckedChange: (c) => setPreferences({ textSpacing: c ? "increased" : "normal" })
234
+ }, undefined, false, undefined, this)
235
+ ]
236
+ }, undefined, true, undefined, this),
237
+ /* @__PURE__ */ jsxDEV2("div", {
238
+ className: "flex items-center justify-between",
239
+ children: [
240
+ /* @__PURE__ */ jsxDEV2(Label, {
241
+ htmlFor: "line-height",
242
+ children: "Increase line height"
243
+ }, undefined, false, undefined, this),
244
+ /* @__PURE__ */ jsxDEV2(Switch, {
245
+ id: "line-height",
246
+ checked: preferences.lineHeight === "increased",
247
+ onCheckedChange: (c) => setPreferences({ lineHeight: c ? "increased" : "normal" })
248
+ }, undefined, false, undefined, this)
249
+ ]
250
+ }, undefined, true, undefined, this),
251
+ /* @__PURE__ */ jsxDEV2("div", {
252
+ className: "flex items-center justify-between",
253
+ children: [
254
+ /* @__PURE__ */ jsxDEV2(Label, {
255
+ htmlFor: "underline-links",
256
+ children: "Always underline links"
257
+ }, undefined, false, undefined, this),
258
+ /* @__PURE__ */ jsxDEV2(Switch, {
259
+ id: "underline-links",
260
+ checked: preferences.underlineLinks,
261
+ onCheckedChange: (c) => setPreferences({ underlineLinks: c })
262
+ }, undefined, false, undefined, this)
263
+ ]
264
+ }, undefined, true, undefined, this),
265
+ /* @__PURE__ */ jsxDEV2("div", {
266
+ className: "flex items-center justify-between",
267
+ children: [
268
+ /* @__PURE__ */ jsxDEV2(Label, {
269
+ htmlFor: "focus-ring",
270
+ children: "Thick focus ring"
271
+ }, undefined, false, undefined, this),
272
+ /* @__PURE__ */ jsxDEV2(Switch, {
273
+ id: "focus-ring",
274
+ checked: preferences.focusRing === "thick",
275
+ onCheckedChange: (c) => setPreferences({ focusRing: c ? "thick" : "normal" })
276
+ }, undefined, false, undefined, this)
277
+ ]
278
+ }, undefined, true, undefined, this),
279
+ /* @__PURE__ */ jsxDEV2("div", {
280
+ className: "space-y-2",
281
+ children: [
282
+ /* @__PURE__ */ jsxDEV2(Label, {
283
+ children: "Motion"
284
+ }, undefined, false, undefined, this),
285
+ /* @__PURE__ */ jsxDEV2(Select, {
286
+ value: preferences.reduceMotion,
287
+ onValueChange: (v) => setPreferences({ reduceMotion: v }),
288
+ children: [
289
+ /* @__PURE__ */ jsxDEV2(SelectTrigger, {
290
+ "aria-label": "Motion preferences",
291
+ children: /* @__PURE__ */ jsxDEV2(SelectValue, {}, undefined, false, undefined, this)
292
+ }, undefined, false, undefined, this),
293
+ /* @__PURE__ */ jsxDEV2(SelectContent, {
294
+ children: [
295
+ /* @__PURE__ */ jsxDEV2(SelectItem, {
296
+ value: "system",
297
+ children: "Follow system"
298
+ }, undefined, false, undefined, this),
299
+ /* @__PURE__ */ jsxDEV2(SelectItem, {
300
+ value: "reduce",
301
+ children: "Reduce motion"
302
+ }, undefined, false, undefined, this),
303
+ /* @__PURE__ */ jsxDEV2(SelectItem, {
304
+ value: "no-preference",
305
+ children: "Allow motion"
306
+ }, undefined, false, undefined, this)
307
+ ]
308
+ }, undefined, true, undefined, this)
309
+ ]
310
+ }, undefined, true, undefined, this)
311
+ ]
312
+ }, undefined, true, undefined, this),
313
+ /* @__PURE__ */ jsxDEV2("div", {
314
+ className: "flex items-center justify-between",
315
+ children: [
316
+ /* @__PURE__ */ jsxDEV2(Label, {
317
+ htmlFor: "contrast",
318
+ children: "High contrast"
319
+ }, undefined, false, undefined, this),
320
+ /* @__PURE__ */ jsxDEV2(Switch, {
321
+ id: "contrast",
322
+ checked: preferences.highContrast,
323
+ onCheckedChange: (c) => setPreferences({ highContrast: c })
324
+ }, undefined, false, undefined, this)
325
+ ]
326
+ }, undefined, true, undefined, this),
327
+ /* @__PURE__ */ jsxDEV2("div", {
328
+ className: "flex items-center justify-between",
329
+ children: [
330
+ /* @__PURE__ */ jsxDEV2(Label, {
331
+ htmlFor: "dyslexia-font",
332
+ children: "Dyslexia-friendly font"
333
+ }, undefined, false, undefined, this),
334
+ /* @__PURE__ */ jsxDEV2(Switch, {
335
+ id: "dyslexia-font",
336
+ checked: preferences.dyslexiaFont,
337
+ onCheckedChange: (c) => setPreferences({ dyslexiaFont: c })
338
+ }, undefined, false, undefined, this)
339
+ ]
340
+ }, undefined, true, undefined, this)
341
+ ]
342
+ }, undefined, true, undefined, this),
343
+ /* @__PURE__ */ jsxDEV2("div", {
344
+ className: "mt-8 flex justify-end gap-2",
345
+ children: /* @__PURE__ */ jsxDEV2(DialogClose, {
346
+ asChild: true,
347
+ children: /* @__PURE__ */ jsxDEV2(Button, {
348
+ variant: "secondary",
349
+ children: "Close"
350
+ }, undefined, false, undefined, this)
351
+ }, undefined, false, undefined, this)
352
+ }, undefined, false, undefined, this)
353
+ ]
354
+ }, undefined, true, undefined, this)
355
+ ]
356
+ }, undefined, true, undefined, this)
357
+ ]
358
+ }, undefined, true, undefined, this);
359
+ }
360
+
361
+ // src/next-route-announcer.tsx
362
+ import * as React2 from "react";
363
+ import { usePathname } from "next/navigation";
364
+ import { jsxDEV as jsxDEV3 } from "react/jsx-dev-runtime";
365
+ "use client";
366
+ function NextRouteAnnouncer() {
367
+ const pathname = usePathname();
368
+ const [message, setMessage] = React2.useState("");
369
+ React2.useEffect(() => {
370
+ if (typeof document !== "undefined") {
371
+ setMessage(document.title || pathname || "");
372
+ }
373
+ }, [pathname]);
374
+ return /* @__PURE__ */ jsxDEV3("div", {
375
+ "aria-live": "polite",
376
+ "aria-atomic": "true",
377
+ className: "sr-only",
378
+ children: message
379
+ }, undefined, false, undefined, this);
380
+ }
381
+
382
+ // src/AccessibilityProvider.tsx
383
+ import { SRLiveRegionProvider } from "@contractspec/lib.ui-kit-web/ui/live-region";
384
+ import { SkipLink } from "@contractspec/lib.ui-kit-web/ui/skip-link";
385
+ import { jsxDEV as jsxDEV4 } from "react/jsx-dev-runtime";
386
+ "use client";
387
+ function AccessibilityProvider({
388
+ children,
389
+ skipTargetId = "main"
390
+ }) {
391
+ return /* @__PURE__ */ jsxDEV4(A11YPreferencesProvider, {
392
+ children: /* @__PURE__ */ jsxDEV4(SRLiveRegionProvider, {
393
+ children: [
394
+ /* @__PURE__ */ jsxDEV4(SkipLink, {
395
+ targetId: skipTargetId
396
+ }, undefined, false, undefined, this),
397
+ /* @__PURE__ */ jsxDEV4(NextRouteAnnouncer, {}, undefined, false, undefined, this),
398
+ children
399
+ ]
400
+ }, undefined, true, undefined, this)
401
+ }, undefined, false, undefined, this);
402
+ }
403
+
404
+ // src/index.ts
405
+ import { SkipLink as SkipLink2 } from "@contractspec/lib.ui-kit-web/ui/skip-link";
406
+ import { VisuallyHidden } from "@contractspec/lib.ui-kit-web/ui/visually-hidden";
407
+ import {
408
+ SRLiveRegionProvider as SRLiveRegionProvider2,
409
+ useSRLiveRegion
410
+ } from "@contractspec/lib.ui-kit-web/ui/live-region";
411
+ import { RouteAnnouncer } from "@contractspec/lib.ui-kit-web/ui/route-announcer";
412
+ import { FocusOnRouteChange } from "@contractspec/lib.ui-kit-web/ui/focus-on-route-change";
413
+ import { useReducedMotion } from "@contractspec/lib.ui-kit-web/ui/use-reduced-motion";
414
+ export {
415
+ useSRLiveRegion,
416
+ useReducedMotion,
417
+ useA11YPreferences,
418
+ VisuallyHidden,
419
+ SkipLink2 as SkipLink,
420
+ SRLiveRegionProvider2 as SRLiveRegionProvider,
421
+ RouteAnnouncer,
422
+ NextRouteAnnouncer,
423
+ FocusOnRouteChange,
424
+ AccessibilityProvider,
425
+ AccessibilityPanel,
426
+ A11YPreferencesProvider
427
+ };