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