accessibility-plugin-react 1.0.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +15 -0
- package/README.md +77 -45
- package/dist/index.d.mts +114 -0
- package/dist/index.d.ts +114 -1
- package/dist/index.js +1694 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1657 -0
- package/dist/index.mjs.map +1 -0
- package/dist/style.css +593 -0
- package/docs/API.md +89 -0
- package/docs/ARCHITECTURE.md +43 -0
- package/docs/BASELINE.md +48 -0
- package/docs/CUSTOM_FEATURES.md +101 -0
- package/docs/DESIGN.md +39 -0
- package/docs/DEVELOPMENT.md +91 -0
- package/docs/FEATURES.md +49 -0
- package/docs/HANDOVER.md +143 -0
- package/docs/INSTALLATION.md +92 -0
- package/docs/MIGRATION.md +40 -0
- package/docs/PROJECT_STATUS.md +95 -0
- package/docs/RELEASE.md +107 -0
- package/docs/ROADMAP.md +29 -0
- package/docs/TROUBLESHOOTING.md +25 -0
- package/docs/assets/clean-light-desktop.png +0 -0
- package/docs/assets/clean-light-mobile.png +0 -0
- package/docs/assets/movable-desktop.png +0 -0
- package/docs/assets/position-menu.png +0 -0
- package/docs/assets/quick-actions-mobile.png +0 -0
- package/docs/assets/widget-desktop.png +0 -0
- package/docs/assets/widget-mobile.png +0 -0
- package/package.json +86 -48
- package/dist/index.es.js +0 -8354
- package/dist/index.umd.js +0 -14
package/dist/style.css
ADDED
|
@@ -0,0 +1,593 @@
|
|
|
1
|
+
/* Historical filename retained: scoped plain CSS, no Tailwind runtime or reset. */
|
|
2
|
+
.arap-root {
|
|
3
|
+
--arap-surface: #fff;
|
|
4
|
+
--arap-text: #111827;
|
|
5
|
+
--arap-muted: #475569;
|
|
6
|
+
--arap-border: #cbd5e1;
|
|
7
|
+
--arap-divider: #e2e8f0;
|
|
8
|
+
--arap-accent: #1d4ed8;
|
|
9
|
+
--arap-accent-hover: #1e40af;
|
|
10
|
+
--arap-selected: #eff6ff;
|
|
11
|
+
--arap-control: #f8fafc;
|
|
12
|
+
color-scheme: light;
|
|
13
|
+
font:
|
|
14
|
+
15px/1.5 system-ui,
|
|
15
|
+
sans-serif;
|
|
16
|
+
color: var(--arap-text);
|
|
17
|
+
text-align: left;
|
|
18
|
+
letter-spacing: normal;
|
|
19
|
+
}
|
|
20
|
+
.arap-root *,
|
|
21
|
+
.arap-root *::before,
|
|
22
|
+
.arap-root *::after {
|
|
23
|
+
box-sizing: border-box;
|
|
24
|
+
}
|
|
25
|
+
.arap-root button {
|
|
26
|
+
font: inherit;
|
|
27
|
+
cursor: pointer;
|
|
28
|
+
color: inherit;
|
|
29
|
+
text-transform: none;
|
|
30
|
+
letter-spacing: normal;
|
|
31
|
+
transition:
|
|
32
|
+
background-color 0.15s,
|
|
33
|
+
border-color 0.15s;
|
|
34
|
+
}
|
|
35
|
+
.arap-root button:disabled {
|
|
36
|
+
opacity: 0.45;
|
|
37
|
+
cursor: not-allowed;
|
|
38
|
+
}
|
|
39
|
+
.arap-root button:focus-visible,
|
|
40
|
+
.arap-panel:focus-visible {
|
|
41
|
+
outline: 3px solid var(--arap-accent);
|
|
42
|
+
outline-offset: 3px;
|
|
43
|
+
}
|
|
44
|
+
.arap-root .arap-btn {
|
|
45
|
+
position: fixed;
|
|
46
|
+
z-index: 2147483001;
|
|
47
|
+
bottom: max(16px, env(safe-area-inset-bottom));
|
|
48
|
+
right: max(16px, env(safe-area-inset-right));
|
|
49
|
+
width: 56px;
|
|
50
|
+
height: 56px;
|
|
51
|
+
padding: 12px;
|
|
52
|
+
display: flex;
|
|
53
|
+
align-items: center;
|
|
54
|
+
justify-content: center;
|
|
55
|
+
border: 2px solid var(--arap-surface);
|
|
56
|
+
border-radius: 50%;
|
|
57
|
+
background: var(--arap-accent);
|
|
58
|
+
color: #fff;
|
|
59
|
+
box-shadow:
|
|
60
|
+
0 4px 12px #0f172a26,
|
|
61
|
+
0 10px 24px #0f172a14;
|
|
62
|
+
}
|
|
63
|
+
.arap-root .arap-btn:hover {
|
|
64
|
+
background: var(--arap-accent-hover);
|
|
65
|
+
}
|
|
66
|
+
.arap-root .arap-btn[data-position="left"] {
|
|
67
|
+
right: auto;
|
|
68
|
+
left: max(16px, env(safe-area-inset-left));
|
|
69
|
+
}
|
|
70
|
+
.arap-root .arap-btn[data-position="top"] {
|
|
71
|
+
bottom: auto;
|
|
72
|
+
top: max(16px, env(safe-area-inset-top));
|
|
73
|
+
}
|
|
74
|
+
.arap-root .arap-panel {
|
|
75
|
+
position: fixed;
|
|
76
|
+
z-index: 2147483000;
|
|
77
|
+
bottom: max(88px, calc(env(safe-area-inset-bottom) + 72px));
|
|
78
|
+
right: max(16px, env(safe-area-inset-right));
|
|
79
|
+
width: min(400px, calc(100vw - 32px));
|
|
80
|
+
max-height: calc(100vh - 120px);
|
|
81
|
+
max-height: calc(100dvh - 120px - env(safe-area-inset-bottom));
|
|
82
|
+
overflow: auto;
|
|
83
|
+
overscroll-behavior: contain;
|
|
84
|
+
scrollbar-width: thin;
|
|
85
|
+
scrollbar-color: var(--arap-border) transparent;
|
|
86
|
+
padding: 20px;
|
|
87
|
+
border: 1px solid var(--arap-divider);
|
|
88
|
+
border-radius: 16px;
|
|
89
|
+
background: var(--arap-surface);
|
|
90
|
+
box-shadow:
|
|
91
|
+
0 8px 16px #0f172a0d,
|
|
92
|
+
0 20px 48px #0f172a1a;
|
|
93
|
+
}
|
|
94
|
+
.arap-root .arap-panel[hidden] {
|
|
95
|
+
display: none !important;
|
|
96
|
+
}
|
|
97
|
+
.arap-root .arap-panel[data-position="left"] {
|
|
98
|
+
right: auto;
|
|
99
|
+
left: max(16px, env(safe-area-inset-left));
|
|
100
|
+
}
|
|
101
|
+
.arap-root .arap-panel[data-position="top"] {
|
|
102
|
+
bottom: auto;
|
|
103
|
+
top: max(88px, calc(env(safe-area-inset-top) + 72px));
|
|
104
|
+
}
|
|
105
|
+
.arap-heading {
|
|
106
|
+
display: flex;
|
|
107
|
+
justify-content: space-between;
|
|
108
|
+
align-items: flex-start;
|
|
109
|
+
gap: 8px;
|
|
110
|
+
padding-bottom: 18px;
|
|
111
|
+
border-bottom: 1px solid var(--arap-divider);
|
|
112
|
+
}
|
|
113
|
+
.arap-heading-copy {
|
|
114
|
+
min-width: 0;
|
|
115
|
+
}
|
|
116
|
+
.arap-heading h2 {
|
|
117
|
+
margin: 0;
|
|
118
|
+
font:
|
|
119
|
+
700 22px/1.3 system-ui,
|
|
120
|
+
sans-serif;
|
|
121
|
+
letter-spacing: -0.025em;
|
|
122
|
+
color: var(--arap-text);
|
|
123
|
+
overflow-wrap: anywhere;
|
|
124
|
+
}
|
|
125
|
+
.arap-description {
|
|
126
|
+
margin: 6px 0 0;
|
|
127
|
+
color: var(--arap-muted);
|
|
128
|
+
font:
|
|
129
|
+
14px/1.5 system-ui,
|
|
130
|
+
sans-serif;
|
|
131
|
+
overflow-wrap: anywhere;
|
|
132
|
+
}
|
|
133
|
+
.arap-heading button {
|
|
134
|
+
flex: none;
|
|
135
|
+
width: 44px;
|
|
136
|
+
height: 44px;
|
|
137
|
+
margin-top: -6px;
|
|
138
|
+
border: 1px solid transparent;
|
|
139
|
+
border-radius: 8px;
|
|
140
|
+
background: transparent;
|
|
141
|
+
color: var(--arap-muted);
|
|
142
|
+
font-size: 28px;
|
|
143
|
+
line-height: 1;
|
|
144
|
+
}
|
|
145
|
+
.arap-heading button:hover {
|
|
146
|
+
background: var(--arap-control);
|
|
147
|
+
border-color: var(--arap-border);
|
|
148
|
+
}
|
|
149
|
+
.arap-feature {
|
|
150
|
+
display: grid;
|
|
151
|
+
grid-template-columns: minmax(0, 1fr) auto;
|
|
152
|
+
align-items: center;
|
|
153
|
+
gap: 10px 12px;
|
|
154
|
+
padding: 18px 0;
|
|
155
|
+
border-bottom: 1px solid var(--arap-divider);
|
|
156
|
+
}
|
|
157
|
+
.arap-feature:last-child {
|
|
158
|
+
border: 0;
|
|
159
|
+
padding-bottom: 0;
|
|
160
|
+
}
|
|
161
|
+
.arap-label {
|
|
162
|
+
display: flex;
|
|
163
|
+
align-items: center;
|
|
164
|
+
gap: 10px;
|
|
165
|
+
font-weight: 500;
|
|
166
|
+
min-width: 0;
|
|
167
|
+
overflow-wrap: anywhere;
|
|
168
|
+
}
|
|
169
|
+
.arap-icon {
|
|
170
|
+
flex: none;
|
|
171
|
+
width: 22px;
|
|
172
|
+
height: 22px;
|
|
173
|
+
display: inline-block;
|
|
174
|
+
vertical-align: middle;
|
|
175
|
+
}
|
|
176
|
+
.arap-controls {
|
|
177
|
+
display: flex;
|
|
178
|
+
align-items: stretch;
|
|
179
|
+
border: 1px solid var(--arap-border);
|
|
180
|
+
border-radius: 9px;
|
|
181
|
+
overflow: hidden;
|
|
182
|
+
background: var(--arap-control);
|
|
183
|
+
}
|
|
184
|
+
.arap-root .arap-btn-sm {
|
|
185
|
+
flex: none;
|
|
186
|
+
width: 44px;
|
|
187
|
+
height: 44px;
|
|
188
|
+
border: 0;
|
|
189
|
+
border-radius: 0;
|
|
190
|
+
background: transparent;
|
|
191
|
+
font-size: 22px;
|
|
192
|
+
}
|
|
193
|
+
.arap-root .arap-btn-sm:hover:not(:disabled) {
|
|
194
|
+
background: var(--arap-selected);
|
|
195
|
+
color: var(--arap-accent);
|
|
196
|
+
}
|
|
197
|
+
/* Keep keyboard outlines outside a clipped stepper visible inside its control. */
|
|
198
|
+
.arap-root .arap-controls button:focus-visible {
|
|
199
|
+
outline-offset: -4px;
|
|
200
|
+
}
|
|
201
|
+
.arap-value {
|
|
202
|
+
display: flex;
|
|
203
|
+
align-items: center;
|
|
204
|
+
justify-content: center;
|
|
205
|
+
min-width: 56px;
|
|
206
|
+
padding: 0 6px;
|
|
207
|
+
text-align: center;
|
|
208
|
+
font-weight: 600;
|
|
209
|
+
border-inline: 1px solid var(--arap-divider);
|
|
210
|
+
background: var(--arap-surface);
|
|
211
|
+
}
|
|
212
|
+
.arap-segmented {
|
|
213
|
+
grid-column: 1 / -1;
|
|
214
|
+
display: flex;
|
|
215
|
+
flex-wrap: wrap;
|
|
216
|
+
gap: 6px;
|
|
217
|
+
min-width: 0;
|
|
218
|
+
}
|
|
219
|
+
.arap-root .arap-segment {
|
|
220
|
+
flex: 1 1 auto;
|
|
221
|
+
display: inline-flex;
|
|
222
|
+
align-items: center;
|
|
223
|
+
justify-content: center;
|
|
224
|
+
gap: 5px;
|
|
225
|
+
min-width: 44px;
|
|
226
|
+
min-height: 44px;
|
|
227
|
+
padding: 8px 10px;
|
|
228
|
+
border: 1px solid var(--arap-border);
|
|
229
|
+
border-radius: 8px;
|
|
230
|
+
background: var(--arap-control);
|
|
231
|
+
color: var(--arap-muted);
|
|
232
|
+
overflow-wrap: anywhere;
|
|
233
|
+
}
|
|
234
|
+
.arap-root .arap-segment:hover {
|
|
235
|
+
background: var(--arap-selected);
|
|
236
|
+
border-color: var(--arap-accent);
|
|
237
|
+
}
|
|
238
|
+
.arap-root .arap-segment-active {
|
|
239
|
+
background: var(--arap-accent);
|
|
240
|
+
color: #fff;
|
|
241
|
+
border-color: var(--arap-accent);
|
|
242
|
+
font-weight: 600;
|
|
243
|
+
}
|
|
244
|
+
.arap-root .arap-segment-active:hover {
|
|
245
|
+
background: var(--arap-accent-hover);
|
|
246
|
+
color: #fff;
|
|
247
|
+
}
|
|
248
|
+
.arap-check {
|
|
249
|
+
flex: none;
|
|
250
|
+
font-size: 15px;
|
|
251
|
+
line-height: 1;
|
|
252
|
+
}
|
|
253
|
+
/* The visible switch is 32px tall; its actual button target is 44px. */
|
|
254
|
+
.arap-root .arap-toggle {
|
|
255
|
+
position: relative;
|
|
256
|
+
width: 56px;
|
|
257
|
+
height: 44px;
|
|
258
|
+
padding: 0;
|
|
259
|
+
border: 0;
|
|
260
|
+
border-radius: 10px;
|
|
261
|
+
background: transparent;
|
|
262
|
+
}
|
|
263
|
+
.arap-toggle::before {
|
|
264
|
+
content: "";
|
|
265
|
+
position: absolute;
|
|
266
|
+
inset: 6px 0;
|
|
267
|
+
border: 2px solid #64748b;
|
|
268
|
+
border-radius: 20px;
|
|
269
|
+
background: #e2e8f0;
|
|
270
|
+
}
|
|
271
|
+
.arap-toggle-knob {
|
|
272
|
+
position: absolute;
|
|
273
|
+
top: 10px;
|
|
274
|
+
left: 4px;
|
|
275
|
+
width: 24px;
|
|
276
|
+
height: 24px;
|
|
277
|
+
border-radius: 50%;
|
|
278
|
+
background: #475569;
|
|
279
|
+
pointer-events: none;
|
|
280
|
+
transition: transform 0.15s;
|
|
281
|
+
}
|
|
282
|
+
.arap-toggle-active::before {
|
|
283
|
+
background: var(--arap-accent);
|
|
284
|
+
border-color: var(--arap-accent);
|
|
285
|
+
}
|
|
286
|
+
.arap-toggle-active .arap-toggle-knob {
|
|
287
|
+
transform: translateX(24px);
|
|
288
|
+
background: #fff;
|
|
289
|
+
}
|
|
290
|
+
.arap-toggle-active .arap-toggle-knob::after {
|
|
291
|
+
content: "✓";
|
|
292
|
+
display: block;
|
|
293
|
+
color: var(--arap-accent);
|
|
294
|
+
font-size: 16px;
|
|
295
|
+
font-weight: 700;
|
|
296
|
+
line-height: 24px;
|
|
297
|
+
text-align: center;
|
|
298
|
+
}
|
|
299
|
+
.arap-root .arap-toggle:hover::before {
|
|
300
|
+
border-color: var(--arap-accent);
|
|
301
|
+
}
|
|
302
|
+
.arap-feature-reset {
|
|
303
|
+
display: block;
|
|
304
|
+
}
|
|
305
|
+
.arap-root .arap-reset-btn {
|
|
306
|
+
display: flex;
|
|
307
|
+
align-items: center;
|
|
308
|
+
justify-content: center;
|
|
309
|
+
gap: 10px;
|
|
310
|
+
width: 100%;
|
|
311
|
+
min-height: 48px;
|
|
312
|
+
padding: 10px;
|
|
313
|
+
border: 1px solid var(--arap-border);
|
|
314
|
+
border-radius: 10px;
|
|
315
|
+
background: var(--arap-control);
|
|
316
|
+
color: var(--arap-accent);
|
|
317
|
+
font-weight: 600;
|
|
318
|
+
}
|
|
319
|
+
.arap-root .arap-reset-btn:hover {
|
|
320
|
+
background: var(--arap-selected);
|
|
321
|
+
border-color: var(--arap-accent);
|
|
322
|
+
}
|
|
323
|
+
@media (max-width: 380px) {
|
|
324
|
+
.arap-root .arap-panel {
|
|
325
|
+
padding: 16px;
|
|
326
|
+
}
|
|
327
|
+
.arap-heading h2 {
|
|
328
|
+
font-size: 20px;
|
|
329
|
+
}
|
|
330
|
+
.arap-feature-stepper {
|
|
331
|
+
grid-template-columns: minmax(0, 1fr);
|
|
332
|
+
}
|
|
333
|
+
.arap-controls {
|
|
334
|
+
width: 100%;
|
|
335
|
+
}
|
|
336
|
+
.arap-value {
|
|
337
|
+
flex: 1;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
@media (prefers-reduced-motion: reduce) {
|
|
341
|
+
.arap-root *,
|
|
342
|
+
.arap-root *::before,
|
|
343
|
+
.arap-root *::after {
|
|
344
|
+
transition: none !important;
|
|
345
|
+
animation: none !important;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
@media (forced-colors: active) {
|
|
349
|
+
.arap-root {
|
|
350
|
+
--arap-surface: Canvas;
|
|
351
|
+
--arap-text: CanvasText;
|
|
352
|
+
--arap-muted: CanvasText;
|
|
353
|
+
--arap-border: ButtonText;
|
|
354
|
+
--arap-divider: ButtonText;
|
|
355
|
+
--arap-accent: Highlight;
|
|
356
|
+
--arap-control: Canvas;
|
|
357
|
+
--arap-selected: Canvas;
|
|
358
|
+
}
|
|
359
|
+
.arap-root button[aria-pressed="true"] {
|
|
360
|
+
outline: 2px solid Highlight;
|
|
361
|
+
outline-offset: -4px;
|
|
362
|
+
}
|
|
363
|
+
.arap-root .arap-segment-active {
|
|
364
|
+
color: HighlightText;
|
|
365
|
+
background: Highlight;
|
|
366
|
+
}
|
|
367
|
+
.arap-toggle::before {
|
|
368
|
+
border-color: ButtonText;
|
|
369
|
+
background: Canvas;
|
|
370
|
+
}
|
|
371
|
+
.arap-toggle-knob {
|
|
372
|
+
background: ButtonText;
|
|
373
|
+
}
|
|
374
|
+
.arap-toggle-active .arap-toggle-knob {
|
|
375
|
+
background: Highlight;
|
|
376
|
+
}
|
|
377
|
+
.arap-toggle-active .arap-toggle-knob::after {
|
|
378
|
+
color: HighlightText;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/* The shell stays still: only the tools region scrolls. */
|
|
383
|
+
.arap-root .arap-panel {
|
|
384
|
+
display: flex;
|
|
385
|
+
flex-direction: column;
|
|
386
|
+
overflow: visible;
|
|
387
|
+
}
|
|
388
|
+
.arap-heading {
|
|
389
|
+
flex: none;
|
|
390
|
+
}
|
|
391
|
+
.arap-tools {
|
|
392
|
+
flex: 1 1 auto;
|
|
393
|
+
min-height: 0;
|
|
394
|
+
overflow: auto;
|
|
395
|
+
overscroll-behavior: contain;
|
|
396
|
+
scrollbar-width: thin;
|
|
397
|
+
scrollbar-color: var(--arap-border) transparent;
|
|
398
|
+
padding: 0 3px;
|
|
399
|
+
margin: 0 -3px;
|
|
400
|
+
}
|
|
401
|
+
.arap-tools:focus-visible {
|
|
402
|
+
outline: 3px solid var(--arap-accent);
|
|
403
|
+
outline-offset: -3px;
|
|
404
|
+
}
|
|
405
|
+
.arap-quick-actions {
|
|
406
|
+
position: relative;
|
|
407
|
+
flex: none;
|
|
408
|
+
display: flex;
|
|
409
|
+
align-items: center;
|
|
410
|
+
gap: 8px;
|
|
411
|
+
padding-top: 14px;
|
|
412
|
+
margin-top: 8px;
|
|
413
|
+
border-top: 1px solid var(--arap-divider);
|
|
414
|
+
}
|
|
415
|
+
.arap-actions {
|
|
416
|
+
flex: 1;
|
|
417
|
+
min-width: 0;
|
|
418
|
+
}
|
|
419
|
+
.arap-actions:empty {
|
|
420
|
+
display: none;
|
|
421
|
+
}
|
|
422
|
+
.arap-actions .arap-feature-reset {
|
|
423
|
+
padding: 0;
|
|
424
|
+
margin: 0;
|
|
425
|
+
border: 0;
|
|
426
|
+
}
|
|
427
|
+
.arap-root .arap-position-button,
|
|
428
|
+
.arap-root .arap-position-default,
|
|
429
|
+
.arap-root .arap-position-arrows button {
|
|
430
|
+
min-width: 44px;
|
|
431
|
+
min-height: 44px;
|
|
432
|
+
padding: 8px 10px;
|
|
433
|
+
border: 1px solid var(--arap-border);
|
|
434
|
+
border-radius: 8px;
|
|
435
|
+
background: var(--arap-control);
|
|
436
|
+
color: var(--arap-accent);
|
|
437
|
+
}
|
|
438
|
+
.arap-root .arap-position-button:hover,
|
|
439
|
+
.arap-root .arap-position-default:hover,
|
|
440
|
+
.arap-root .arap-position-arrows button:hover {
|
|
441
|
+
background: var(--arap-selected);
|
|
442
|
+
border-color: var(--arap-accent);
|
|
443
|
+
}
|
|
444
|
+
.arap-position-popover {
|
|
445
|
+
position: absolute;
|
|
446
|
+
z-index: 1;
|
|
447
|
+
bottom: calc(100% + 8px);
|
|
448
|
+
left: 0;
|
|
449
|
+
width: 100%;
|
|
450
|
+
max-height: calc(100dvh - 160px);
|
|
451
|
+
overflow: auto;
|
|
452
|
+
padding: 14px;
|
|
453
|
+
border: 1px solid var(--arap-border);
|
|
454
|
+
border-radius: 12px;
|
|
455
|
+
background: var(--arap-surface);
|
|
456
|
+
box-shadow: 0 8px 24px #0f172a26;
|
|
457
|
+
}
|
|
458
|
+
.arap-position-popover[hidden] {
|
|
459
|
+
display: none !important;
|
|
460
|
+
}
|
|
461
|
+
.arap-position-label {
|
|
462
|
+
display: block;
|
|
463
|
+
margin-bottom: 6px;
|
|
464
|
+
font-weight: 600;
|
|
465
|
+
}
|
|
466
|
+
.arap-position-popover select {
|
|
467
|
+
width: 100%;
|
|
468
|
+
min-height: 44px;
|
|
469
|
+
padding: 8px;
|
|
470
|
+
border: 1px solid var(--arap-border);
|
|
471
|
+
border-radius: 8px;
|
|
472
|
+
font: inherit;
|
|
473
|
+
color: var(--arap-text);
|
|
474
|
+
background: var(--arap-surface);
|
|
475
|
+
}
|
|
476
|
+
.arap-position-popover select:focus-visible {
|
|
477
|
+
outline: 3px solid var(--arap-accent);
|
|
478
|
+
outline-offset: 2px;
|
|
479
|
+
}
|
|
480
|
+
.arap-position-arrows {
|
|
481
|
+
display: flex;
|
|
482
|
+
justify-content: space-between;
|
|
483
|
+
gap: 6px;
|
|
484
|
+
margin-top: 10px;
|
|
485
|
+
}
|
|
486
|
+
.arap-position-default {
|
|
487
|
+
width: 100%;
|
|
488
|
+
margin-top: 8px;
|
|
489
|
+
}
|
|
490
|
+
.arap-root .arap-btn[data-draggable="true"] {
|
|
491
|
+
touch-action: none;
|
|
492
|
+
user-select: none;
|
|
493
|
+
cursor: grab;
|
|
494
|
+
}
|
|
495
|
+
.arap-root .arap-btn[data-dragging="true"] {
|
|
496
|
+
cursor: grabbing;
|
|
497
|
+
}
|
|
498
|
+
.arap-root .arap-btn[data-corner$="left"],
|
|
499
|
+
.arap-root .arap-panel[data-corner$="left"] {
|
|
500
|
+
right: auto;
|
|
501
|
+
left: max(16px, env(safe-area-inset-left));
|
|
502
|
+
}
|
|
503
|
+
.arap-root .arap-btn[data-corner$="right"],
|
|
504
|
+
.arap-root .arap-panel[data-corner$="right"] {
|
|
505
|
+
left: auto;
|
|
506
|
+
right: max(16px, env(safe-area-inset-right));
|
|
507
|
+
}
|
|
508
|
+
.arap-root .arap-btn[data-corner^="top"] {
|
|
509
|
+
bottom: auto;
|
|
510
|
+
top: max(16px, env(safe-area-inset-top));
|
|
511
|
+
}
|
|
512
|
+
.arap-root .arap-btn[data-corner^="bottom"] {
|
|
513
|
+
top: auto;
|
|
514
|
+
bottom: max(16px, env(safe-area-inset-bottom));
|
|
515
|
+
}
|
|
516
|
+
.arap-root .arap-panel[data-corner^="top"] {
|
|
517
|
+
bottom: auto;
|
|
518
|
+
top: max(88px, calc(env(safe-area-inset-top) + 72px));
|
|
519
|
+
}
|
|
520
|
+
.arap-root .arap-panel[data-corner^="bottom"] {
|
|
521
|
+
top: auto;
|
|
522
|
+
bottom: max(88px, calc(env(safe-area-inset-bottom) + 72px));
|
|
523
|
+
}
|
|
524
|
+
.arap-sr-only {
|
|
525
|
+
position: absolute;
|
|
526
|
+
width: 1px;
|
|
527
|
+
height: 1px;
|
|
528
|
+
padding: 0;
|
|
529
|
+
margin: -1px;
|
|
530
|
+
overflow: hidden;
|
|
531
|
+
clip-path: inset(50%);
|
|
532
|
+
white-space: nowrap;
|
|
533
|
+
border: 0;
|
|
534
|
+
}
|
|
535
|
+
.arap-root .arap-skip-actions {
|
|
536
|
+
position: absolute;
|
|
537
|
+
top: 12px;
|
|
538
|
+
left: 20px;
|
|
539
|
+
width: 44px;
|
|
540
|
+
height: 44px;
|
|
541
|
+
clip-path: inset(50%);
|
|
542
|
+
overflow: hidden;
|
|
543
|
+
pointer-events: none;
|
|
544
|
+
}
|
|
545
|
+
.arap-root .arap-skip-actions:focus-visible {
|
|
546
|
+
right: 20px;
|
|
547
|
+
width: auto;
|
|
548
|
+
height: auto;
|
|
549
|
+
min-height: 44px;
|
|
550
|
+
clip-path: none;
|
|
551
|
+
pointer-events: auto;
|
|
552
|
+
z-index: 2;
|
|
553
|
+
padding: 8px;
|
|
554
|
+
border: 1px solid var(--arap-accent);
|
|
555
|
+
border-radius: 8px;
|
|
556
|
+
background: var(--arap-surface);
|
|
557
|
+
color: var(--arap-accent);
|
|
558
|
+
}
|
|
559
|
+
@media (max-height: 480px) {
|
|
560
|
+
.arap-root .arap-panel {
|
|
561
|
+
top: max(16px, env(safe-area-inset-top)) !important;
|
|
562
|
+
bottom: max(16px, env(safe-area-inset-bottom)) !important;
|
|
563
|
+
max-height: calc(
|
|
564
|
+
100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom)
|
|
565
|
+
) !important;
|
|
566
|
+
padding: 8px;
|
|
567
|
+
}
|
|
568
|
+
.arap-heading {
|
|
569
|
+
padding-bottom: 8px;
|
|
570
|
+
}
|
|
571
|
+
.arap-heading h2 {
|
|
572
|
+
font-size: 18px;
|
|
573
|
+
}
|
|
574
|
+
.arap-heading button {
|
|
575
|
+
margin-top: 0;
|
|
576
|
+
}
|
|
577
|
+
.arap-description {
|
|
578
|
+
display: none;
|
|
579
|
+
}
|
|
580
|
+
.arap-quick-actions {
|
|
581
|
+
padding-top: 8px;
|
|
582
|
+
margin-top: 0;
|
|
583
|
+
}
|
|
584
|
+
.arap-root .arap-reset-btn {
|
|
585
|
+
min-height: 44px;
|
|
586
|
+
}
|
|
587
|
+
.arap-root .arap-btn[data-open="true"] {
|
|
588
|
+
visibility: hidden;
|
|
589
|
+
}
|
|
590
|
+
.arap-position-popover {
|
|
591
|
+
max-height: calc(100dvh - 96px);
|
|
592
|
+
}
|
|
593
|
+
}
|
package/docs/API.md
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Public API
|
|
2
|
+
|
|
3
|
+
All exports are named from `accessibility-plugin-react`. JavaScript consumers receive compiled ESM/CJS; TypeScript consumers receive matching declarations. CSS is an explicit import from `accessibility-plugin-react/style.css` (historical `/dist/style.css` also works).
|
|
4
|
+
|
|
5
|
+
## Components
|
|
6
|
+
|
|
7
|
+
| Component | Props |
|
|
8
|
+
| --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
9
|
+
| AccessibilityPlugin | `children: ReactNode` required; `position?: 'left' \| 'right' \| 'top' \| 'bottom'` default right; `persistenceKey?: string` default `react-accessibility-plugin:state`; `persist?: boolean` default true |
|
|
10
|
+
| AccessibilityButton | `draggable?: boolean` default true (pointer/Alt+arrow movement); `icon?: ReactNode` default inline accessibility SVG; `title?: string` accessible name, default Accessibility; `description?: string` supplementary accessible description; `className?: string`; `style?: CSSProperties` |
|
|
11
|
+
| AccessibilityList | `footer?: ReactNode` extra fixed actions; `children: ReactNode` required; `title?: string` visible heading and region name, default Accessibility settings; `description?: string` default Adjust your reading experience (empty string omits it); `closeLabel?: string` default Close accessibility settings; `className?: string`; `style?: CSSProperties` |
|
|
12
|
+
| All fifteen controllers listed in FEATURES.md | No props. Pick/omit in JSX. For custom labels or behavior, compose a control with useAccessibility. |
|
|
13
|
+
|
|
14
|
+
Use one button/list pair per provider and one provider per document. UI IDs use React `useId`; do not target the old fixed `arap-panel` ID. Plugin children can include ordinary app content, but mounting the widget as a sibling makes intent clearer. Persistence configuration is fixed at mount; use `<AccessibilityPlugin key={newKey} persistenceKey={newKey}>` when switching storage identity.
|
|
15
|
+
|
|
16
|
+
## useAccessibility
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
useAccessibility<T>(featureKey: string, defaultValue: T, options?: FeatureOptions<T>): {
|
|
20
|
+
value: T;
|
|
21
|
+
setValue: (next: T) => void;
|
|
22
|
+
reset: () => void;
|
|
23
|
+
}
|
|
24
|
+
interface FeatureOptions<T> {
|
|
25
|
+
validate?: (value: unknown) => value is T;
|
|
26
|
+
apply?: (value: T) => void | (() => void);
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
`setValue` takes a concrete value, not a React functional updater. It validates and throws on invalid programmatic values. `reset` restores only this feature; `ResetController` clears all display features and preserves saved widget placement. JSON-compatible state only: no functions, symbols, cycles, class instances or DOM references. Custom validators are essential for records and arrays. Unique stable keys cannot be empty, `__proto__`, `constructor` or `prototype`. Built-in keys are reserved; their validation cannot be overridden by custom definitions.
|
|
31
|
+
|
|
32
|
+
Definitions/defaults are immutable for the provider lifetime; the first registered definition for a key wins. Repeated readers may share a key if they agree on the definition. Do not change a hook's key in place; remount a keyed component. `apply` runs only on the client; return cleanup. It runs again when the value changes and may be replayed by Strict Mode. Its lifetime is the provider's, not its control's.
|
|
33
|
+
|
|
34
|
+
## Context and exported types
|
|
35
|
+
|
|
36
|
+
`AccessibilityContext` defaults to null outside the provider. Prefer the hook for feature state. Advanced consumers may read `state: { isOpen, features }`, `isOpen`, `panelId`, `position`, `widgetPlacement`; call `setWidgetPlacement(nextOrNull)`, `toggleOpen()`, `closeMenu()`, `resetAll()`; and use `getFeatureState<T>(key, defaultValue)`, `setFeatureState<T>(key, value)`, `registerFeature(key, definition)`.
|
|
37
|
+
|
|
38
|
+
`FeatureRegistration` is `FeatureOptions<unknown>` plus `defaultValue: unknown`. Use the generic hook instead of manually casting callbacks. Legacy `registerReset(key, fn)` / `unregisterReset(key)` remain available; callbacks run before global state is cleared. They are not the primary effect lifecycle API. Callback owners must unregister their callback on teardown.
|
|
39
|
+
|
|
40
|
+
Exported types: `AccessibilityPluginProps`, `AccessibilityButtonProps`, `AccessibilityListProps`, `AccessibilityState`, `AccessibilityContextValue`, `PluginPosition`, `WidgetPlacement`, `FeatureOptions<T>`, `FeatureRegistration`.
|
|
41
|
+
|
|
42
|
+
## Styling and labels
|
|
43
|
+
|
|
44
|
+
Import library CSS once, then load your overrides. It does not require Tailwind or set host `html`, `body`, universal resets, theme variables or heading defaults. `arap-` classes are the customization convention. Scope overrides to your panel class or `.arap-root` so they do not affect host controls:
|
|
45
|
+
|
|
46
|
+
```css
|
|
47
|
+
.arap-root .my-panel {
|
|
48
|
+
border-radius: 8px;
|
|
49
|
+
background: #f8fafc;
|
|
50
|
+
}
|
|
51
|
+
.arap-root .my-trigger {
|
|
52
|
+
background: #164e63;
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
```tsx
|
|
57
|
+
<AccessibilityButton className="my-trigger" title="Display preferences" />
|
|
58
|
+
<AccessibilityList className="my-panel" title="Display preferences" closeLabel="Close preferences">
|
|
59
|
+
<FontSizeController />
|
|
60
|
+
</AccessibilityList>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Host theme classes on an application root do not enclose body portals. Use global `.arap-root` overrides for custom widget themes, and preserve contrast, focus and pressed states. Consumer CSS containing broad `!important` rules can still interfere. Native buttons have explicit type and are safe within application forms.
|
|
64
|
+
|
|
65
|
+
### Clean light design foundation
|
|
66
|
+
|
|
67
|
+
The default widget uses white surfaces, ink labels, blue selected controls, outline icons, subtle dividers and a compact stepper layout. Steppers stack below their labels at narrow widths. All existing modes remain available; the reference mockup is a direction, not a reduced feature set. Icons are decorative, selected segmented controls include a checkmark, and switches retain 44px button targets.
|
|
68
|
+
|
|
69
|
+
Override the scoped CSS variables on `.arap-root` to adapt the palette. Defaults include `--arap-surface`, `--arap-text`, `--arap-muted`, `--arap-border`, `--arap-divider`, `--arap-accent`, `--arap-accent-hover`, `--arap-selected` and `--arap-control`. Supply compatible contrast for every state and test custom palettes. Consumer styles may also set these variables on their panel/trigger class. These variables are not applied to the host document.
|
|
70
|
+
|
|
71
|
+
```css
|
|
72
|
+
.arap-root {
|
|
73
|
+
--arap-accent: #1e40af;
|
|
74
|
+
--arap-accent-hover: #1e3a8a;
|
|
75
|
+
--arap-selected: #eff6ff;
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Movement and always-visible actions
|
|
80
|
+
|
|
81
|
+
The trigger is draggable by default. An 8px movement threshold distinguishes dragging from clicking; completing or cancelling a drag does not open the panel. Alt+arrow keys move it by 20px. The fixed “Move button” action also provides four corners, four click-to-move arrows, “Reset button position” and “Done moving”, so movement never requires a dragging gesture. Movement updates a polite status announcement.
|
|
82
|
+
|
|
83
|
+
Placement is either `{ kind: "corner", corner: "bottom-right" | "bottom-left" | "top-right" | "top-left" }` or `{ kind: "point", x: number, y: number }`, with normalized coordinates in [0,1]. It shares the provider's versioned persistence record under reserved key `__arap_widget_placement`; custom features must not use that key. Saved placement overrides the initial position prop. Without it, left means bottom-left, top means top-right, and right/bottom mean bottom-right. Resetting placement returns to the current prop. `persist={false}` disables saving and restoring placement as well as display settings.
|
|
84
|
+
|
|
85
|
+
Coordinates are clamped on resizing and account for the trigger's measured dimensions. The panel opens above or below the moved trigger within available viewport space. On short screens it uses the available screen height and temporarily hides the trigger while open, avoiding overlap with actions; Close/Escape restores the trigger and focus.
|
|
86
|
+
|
|
87
|
+
Only `.arap-tools` scrolls. The heading, Close, “Move button” and fixed action area stay accessible. A ResetController placed anywhere inside AccessibilityList (including nested composition) renders its button in that area without changing its effect ownership. It remains opt-in; no reset button is injected when it is omitted. Keyboard users can Tab from Close to “Jump to quick actions”, then activate it to focus reset/the first footer action. An open movement menu consumes Escape before the panel does.
|
|
88
|
+
|
|
89
|
+
Use `footer` for additional fixed actions. Keep actions concise and independently keyboard accessible. `draggable={false}` disables pointer/Alt+arrow movement on the trigger; the panel's explicit movement controls remain available. Consumer inline positioning styles override library geometry and should be tested with movement.
|