ngp-accessibility 1.0.2 → 1.0.5

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/dist/styles.css CHANGED
@@ -1,30 +1,47 @@
1
+ :root {
2
+ --ngp-a11y-gap: 8px;
3
+ --ngp-a11y-padding: 12px;
4
+ --ngp-a11y-radius: 4px;
5
+ --ngp-a11y-font-size: 14px;
6
+ --ngp-a11y-border: #ccc;
7
+ --ngp-a11y-bg: #f5f5f5;
8
+ --ngp-a11y-surface: #ffffff;
9
+ --ngp-a11y-surface-hover: #f5f5f5;
10
+ --ngp-a11y-text: #111111;
11
+ --ngp-a11y-accent: #007bff;
12
+ --ngp-a11y-accent-hover: #0056b3;
13
+ --ngp-a11y-accent-text: #ffffff;
14
+ --ngp-a11y-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
15
+ }
16
+
1
17
  .accessibility-toolbar {
2
18
  display: flex;
3
- gap: 8px;
4
- padding: 12px;
5
- background: #f5f5f5;
6
- border-bottom: 1px solid #ddd;
19
+ gap: var(--ngp-a11y-gap);
20
+ padding: var(--ngp-a11y-padding);
21
+ background: var(--ngp-a11y-bg);
22
+ border-bottom: 1px solid var(--ngp-a11y-border);
7
23
  flex-wrap: wrap;
8
24
  }
9
25
 
10
26
  .accessibility-toolbar button,
11
27
  .accessibility-toolbar select {
12
28
  padding: 8px 12px;
13
- border: 1px solid #ccc;
14
- background: white;
29
+ border: 1px solid var(--ngp-a11y-border);
30
+ background: var(--ngp-a11y-surface);
31
+ color: var(--ngp-a11y-text);
15
32
  cursor: pointer;
16
- border-radius: 4px;
17
- font-size: 14px;
33
+ border-radius: var(--ngp-a11y-radius);
34
+ font-size: var(--ngp-a11y-font-size);
18
35
  }
19
36
 
20
37
  .accessibility-toolbar button:hover {
21
- background: #e9e9e9;
38
+ background: var(--ngp-a11y-surface-hover);
22
39
  }
23
40
 
24
41
  .accessibility-toolbar button.active {
25
- background: #007bff;
26
- color: white;
27
- border-color: #007bff;
42
+ background: var(--ngp-a11y-accent);
43
+ color: var(--ngp-a11y-accent-text);
44
+ border-color: var(--ngp-a11y-accent);
28
45
  }
29
46
 
30
47
  /* Dropdown Styles */
@@ -35,17 +52,17 @@
35
52
 
36
53
  .accessibility-dropdown-toggle {
37
54
  padding: 10px 16px;
38
- background: #007bff;
39
- color: white;
55
+ background: var(--ngp-a11y-accent);
56
+ color: var(--ngp-a11y-accent-text);
40
57
  border: none;
41
- border-radius: 4px;
58
+ border-radius: var(--ngp-a11y-radius);
42
59
  cursor: pointer;
43
60
  font-size: 16px;
44
61
  font-weight: 500;
45
62
  }
46
63
 
47
64
  .accessibility-dropdown-toggle:hover {
48
- background: #0056b3;
65
+ background: var(--ngp-a11y-accent-hover);
49
66
  }
50
67
 
51
68
  .accessibility-dropdown-menu {
@@ -53,10 +70,10 @@
53
70
  top: 100%;
54
71
  right: 0;
55
72
  margin-top: 8px;
56
- background: white;
57
- border: 1px solid #ddd;
58
- border-radius: 4px;
59
- box-shadow: 0 4px 12px rgba(0,0,0,0.15);
73
+ background: var(--ngp-a11y-surface);
74
+ border: 1px solid var(--ngp-a11y-border);
75
+ border-radius: var(--ngp-a11y-radius);
76
+ box-shadow: var(--ngp-a11y-shadow);
60
77
  min-width: 280px;
61
78
  z-index: 1000;
62
79
  padding: 12px;
@@ -65,9 +82,9 @@
65
82
  .accessibility-dropdown-section {
66
83
  display: flex;
67
84
  flex-direction: column;
68
- gap: 8px;
85
+ gap: var(--ngp-a11y-gap);
69
86
  padding: 8px 0;
70
- border-bottom: 1px solid #eee;
87
+ border-bottom: 1px solid var(--ngp-a11y-border);
71
88
  }
72
89
 
73
90
  .accessibility-dropdown-section:last-child {
@@ -83,22 +100,23 @@
83
100
  .accessibility-dropdown-section button,
84
101
  .accessibility-dropdown-section select {
85
102
  padding: 8px 12px;
86
- border: 1px solid #ccc;
87
- background: white;
103
+ border: 1px solid var(--ngp-a11y-border);
104
+ background: var(--ngp-a11y-surface);
105
+ color: var(--ngp-a11y-text);
88
106
  cursor: pointer;
89
- border-radius: 4px;
90
- font-size: 14px;
107
+ border-radius: var(--ngp-a11y-radius);
108
+ font-size: var(--ngp-a11y-font-size);
91
109
  text-align: left;
92
110
  }
93
111
 
94
112
  .accessibility-dropdown-section button:hover {
95
- background: #f5f5f5;
113
+ background: var(--ngp-a11y-surface-hover);
96
114
  }
97
115
 
98
116
  .accessibility-dropdown-section button.active {
99
- background: #007bff;
100
- color: white;
101
- border-color: #007bff;
117
+ background: var(--ngp-a11y-accent);
118
+ color: var(--ngp-a11y-accent-text);
119
+ border-color: var(--ngp-a11y-accent);
102
120
  }
103
121
 
104
122
  .high-contrast {
@@ -116,12 +134,445 @@
116
134
  }
117
135
 
118
136
  .underline-links a {
119
- text-decoration: underline !important;
137
+ text-decoration-line: underline !important;
138
+ text-decoration-thickness: 1px !important;
139
+ text-underline-offset: 0.2em;
140
+ font-weight: 700;
141
+ border: 2px solid #3f81f4;
142
+ border-radius: 4px;
143
+ box-shadow: inset 0 -0.2em 0 rgba(96, 165, 250, 0.24);
144
+ transition:
145
+ background 0.2s ease,
146
+ box-shadow 0.2s ease,
147
+ color 0.2s ease;
148
+ }
149
+
150
+ .underline-links a:hover {
151
+ background: rgba(37, 99, 235, 0.2);
152
+ box-shadow: inset 0 -0.28em 0 rgba(96, 165, 250, 0.32);
153
+ }
154
+
155
+ .highlight-titles :is(h1, h2, h3, h4, h5, h6, [role="heading"]) {
156
+ border: 2px solid #2563eb !important;
157
+ border-radius: 10px;
158
+ padding: 0.18em 0.45em;
159
+ background: rgba(37, 99, 235, 0.08);
160
+ box-shadow: 0 8px 20px rgba(37, 99, 235, 0.12);
161
+ }
162
+
163
+ .highlight-titles .a11y-root :is(h1, h2, h3, h4, h5, h6, [role="heading"]) {
164
+ border: none !important;
165
+ border-radius: 0;
166
+ padding: 0;
167
+ background: transparent;
168
+ box-shadow: none;
169
+ }
170
+
171
+ .pause-animations,
172
+ .pause-animations body {
173
+ scroll-behavior: auto !important;
174
+ }
175
+
176
+ .pause-animations *:not(.a11y-root):not(.a11y-root *) {
177
+ animation-duration: 0.01ms !important;
178
+ animation-delay: 0ms !important;
179
+ animation-iteration-count: 1 !important;
180
+ transition-duration: 0.01ms !important;
181
+ transition-delay: 0ms !important;
182
+ }
183
+
184
+ .a11y-reading-guide {
185
+ position: fixed;
186
+ inset: 0;
187
+ z-index: 900;
188
+ pointer-events: none;
189
+ }
190
+
191
+ .a11y-reading-guide-top,
192
+ .a11y-reading-guide-bottom {
193
+ position: absolute;
194
+ left: 0;
195
+ width: 100%;
196
+ background: rgba(15, 23, 42, 0.22);
197
+ }
198
+
199
+ .a11y-reading-guide-top {
200
+ top: 0;
201
+ }
202
+
203
+ .a11y-reading-guide-bottom {
204
+ bottom: 0;
205
+ }
206
+
207
+ .a11y-reading-guide-focus {
208
+ position: absolute;
209
+ left: 0;
210
+ width: 100%;
211
+ border-top: 1px solid rgba(96, 165, 250, 0.35);
212
+ border-bottom: 1px solid rgba(96, 165, 250, 0.35);
213
+ background: linear-gradient(
214
+ 180deg,
215
+ rgba(255, 255, 255, 0.18) 0%,
216
+ rgba(255, 255, 255, 0.06) 100%
217
+ );
218
+ box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
219
+ }
220
+
221
+ .a11y-reading-guide-line {
222
+ position: absolute;
223
+ left: 0;
224
+ width: 100%;
225
+ height: 2px;
226
+ margin-top: -1px;
227
+ background: rgba(150, 150, 150, 0.9);
228
+ box-shadow: 0 0 18px rgba(59, 130, 246, 0.45);
229
+ }
230
+
231
+ .a11y-text-magnifier-tooltip {
232
+ position: fixed;
233
+ top: 0;
234
+ left: 0;
235
+ z-index: 3000;
236
+ max-width: min(360px, calc(100vw - 24px));
237
+ padding: 12px 14px;
238
+ border-radius: 12px;
239
+ background: rgba(0, 0, 0, 0.6);
240
+ color: #ffffff;
241
+ font-size: 20px;
242
+ font-weight: 600;
243
+ line-height: 1.35;
244
+ pointer-events: none;
245
+ opacity: 0;
246
+ transform: translateY(4px);
247
+ transition:
248
+ opacity 0.14s ease,
249
+ transform 0.14s ease;
250
+ box-shadow: 0 16px 32px rgba(15, 23, 42, 0.24);
251
+ backdrop-filter: blur(8px);
252
+ }
253
+
254
+ .a11y-text-magnifier-tooltip[data-visible="true"] {
255
+ opacity: 1;
256
+ transform: translateY(0);
120
257
  }
121
258
 
122
259
  .readable-font,
123
260
  .readable-font * {
124
- font-family: 'Arial', 'Helvetica', sans-serif !important;
261
+ font-family: "Arial", "Helvetica", sans-serif !important;
125
262
  letter-spacing: 0.05em !important;
126
263
  line-height: 1.6 !important;
127
264
  }
265
+ .a11y-root {
266
+ position: relative;
267
+ display: inline-flex;
268
+ flex-direction: column;
269
+ z-index: 1200;
270
+ }
271
+
272
+ .a11y-trigger {
273
+ display: inline-flex;
274
+ align-items: center;
275
+ justify-content: center;
276
+ gap: 8px;
277
+ min-height: 44px;
278
+ padding: 12px 18px;
279
+ border: 1px solid #bfdbfe;
280
+ border-radius: 14px;
281
+ color: #000000;
282
+ cursor: pointer;
283
+ font-size: 14px;
284
+ font-weight: 700;
285
+ letter-spacing: -0.01em;
286
+ box-shadow: 0 10px 24px rgba(59, 130, 246, 0.16);
287
+ transition:
288
+ background 0.2s ease,
289
+ border-color 0.2s ease,
290
+ box-shadow 0.2s ease,
291
+ transform 0.2s ease;
292
+ }
293
+
294
+ .a11y-trigger:hover {
295
+ transform: translateY(-1px);
296
+ box-shadow: 0 14px 28px rgba(59, 130, 246, 0.2);
297
+ }
298
+
299
+ .a11y-trigger:focus-visible {
300
+ outline: 3px solid rgba(37, 99, 235, 0.22);
301
+ outline-offset: 2px;
302
+ }
303
+ .a11y-panel {
304
+ width: 420px;
305
+ overflow-y: scroll;
306
+ background: linear-gradient(180deg, #ffffff 0%, #f7fafc 100%);
307
+ border: 1px solid #d9e2ec;
308
+ border-radius: 20px;
309
+ padding: 20px;
310
+ box-shadow: 0 24px 48px rgba(15, 23, 42, 0.16);
311
+ position: absolute;
312
+ right: 0;
313
+ min-width: 200px;
314
+ display: flex;
315
+ flex-direction: column;
316
+ gap: 16px;
317
+ height: 420px;
318
+ }
319
+
320
+ .a11y-panel-header {
321
+ display: flex;
322
+ align-items: flex-start;
323
+ justify-content: space-between;
324
+ gap: 16px;
325
+ padding: 4px 4px 12px;
326
+ border-bottom: 1px solid #e2e8f0;
327
+ }
328
+
329
+ .a11y-panel-heading {
330
+ display: flex;
331
+ flex-direction: column;
332
+ gap: 4px;
333
+ }
334
+
335
+ .a11y-panel-eyebrow {
336
+ font-size: 11px;
337
+ font-weight: 700;
338
+ letter-spacing: 0.12em;
339
+ text-transform: uppercase;
340
+ color: #2563eb;
341
+ }
342
+
343
+ .a11y-panel-title {
344
+ font-size: 20px;
345
+ font-weight: 700;
346
+ color: #0f172a;
347
+ line-height: 1.2;
348
+ }
349
+
350
+ .a11y-panel-close {
351
+ width: 38px;
352
+ height: 38px;
353
+ flex-shrink: 0;
354
+ border: 1px solid #cbd5e1;
355
+ border-radius: 999px;
356
+ background: #ffffff;
357
+ color: #334155;
358
+ cursor: pointer;
359
+ font-size: 22px;
360
+ line-height: 1;
361
+ transition:
362
+ background 0.2s ease,
363
+ color 0.2s ease,
364
+ border-color 0.2s ease,
365
+ transform 0.2s ease;
366
+ }
367
+
368
+ .a11y-panel-close:hover {
369
+ background: #eff6ff;
370
+ color: #1d4ed8;
371
+ border-color: #93c5fd;
372
+ transform: rotate(90deg);
373
+ }
374
+
375
+ .a11y-panel-close:focus-visible {
376
+ outline: 3px solid rgba(37, 99, 235, 0.2);
377
+ outline-offset: 2px;
378
+ }
379
+
380
+ .a11y-panel button,
381
+ .a11y-panel select {
382
+ font-family: inherit;
383
+ }
384
+
385
+ .a11y-section {
386
+ display: flex;
387
+ flex-direction: column;
388
+ gap: 14px;
389
+ background: linear-gradient(180deg, #f8fbff 0%, #eff6ff 100%);
390
+ border: 1px solid #dbeafe;
391
+ border-radius: 16px;
392
+ padding: 18px;
393
+ }
394
+
395
+ .a11y-section-title {
396
+ font-size: 16px;
397
+ font-weight: 700;
398
+ margin: 0;
399
+ color: #1e3a8a;
400
+ letter-spacing: -0.01em;
401
+ }
402
+
403
+ .a11y-grid {
404
+ display: grid;
405
+ grid-template-columns: repeat(2, 1fr);
406
+ gap: 14px;
407
+ }
408
+
409
+ .a11y-card {
410
+ appearance: none;
411
+ display: flex;
412
+ flex-direction: column;
413
+ justify-content: center;
414
+ align-items: center;
415
+ gap: 12px;
416
+ min-height: 84px;
417
+ background: #ffffff;
418
+ color: #0f172a;
419
+ border-radius: 14px;
420
+ padding: 16px;
421
+ border: 1px solid #d6e4f5;
422
+ cursor: pointer;
423
+ text-align: left;
424
+ box-shadow: 0 10px 24px rgba(148, 163, 184, 0.12);
425
+ transition:
426
+ border-color 0.2s ease,
427
+ background 0.2s ease,
428
+ box-shadow 0.2s ease,
429
+ transform 0.2s ease;
430
+ font-size: 14px;
431
+ font-weight: 600;
432
+ line-height: 1.35;
433
+ }
434
+
435
+ .a11y-card:hover {
436
+ background: #f8fbff;
437
+ border-color: #93c5fd;
438
+ transform: translateY(-4px);
439
+ box-shadow: 0 14px 28px rgba(59, 130, 246, 0.14);
440
+ }
441
+
442
+ .a11y-card.active {
443
+ background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
444
+ color: #ffffff;
445
+ border-color: #1d4ed8;
446
+ box-shadow: 0 16px 30px rgba(37, 99, 235, 0.28);
447
+ }
448
+
449
+ .a11y-card:focus-visible {
450
+ outline: 3px solid rgba(37, 99, 235, 0.22);
451
+ outline-offset: 2px;
452
+ }
453
+
454
+ .a11y-card.active:hover {
455
+ background: linear-gradient(180deg, #1d4ed8 0%, #1e40af 100%);
456
+ border-color: #1e40af;
457
+ }
458
+
459
+ .a11y-card-title {
460
+ font-size: 14px;
461
+ font-weight: 700;
462
+ color: inherit;
463
+ }
464
+
465
+ .a11y-stepper {
466
+ display: flex;
467
+ align-items: center;
468
+ justify-content: space-between;
469
+ gap: 10px;
470
+ width: 100%;
471
+ }
472
+
473
+ .a11y-stepper button {
474
+ width: 34px;
475
+ height: 34px;
476
+ border-radius: 50%;
477
+ border: 1px solid #bfdbfe;
478
+ background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
479
+ color: #1d4ed8;
480
+ font-size: 18px;
481
+ font-weight: 700;
482
+ cursor: pointer;
483
+ transition:
484
+ background 0.2s ease,
485
+ border-color 0.2s ease,
486
+ color 0.2s ease,
487
+ transform 0.2s ease;
488
+ }
489
+
490
+ .a11y-stepper button:hover {
491
+ background: linear-gradient(180deg, #dbeafe 0%, #bfdbfe 100%);
492
+ border-color: #93c5fd;
493
+ color: #1e3a8a;
494
+ transform: scale(1.04);
495
+ }
496
+
497
+ .a11y-stepper button:focus-visible {
498
+ outline: 3px solid rgba(37, 99, 235, 0.22);
499
+ outline-offset: 2px;
500
+ }
501
+
502
+ .a11y-stepper-value {
503
+ flex: 1;
504
+ text-align: center;
505
+ font-size: 13px;
506
+ font-weight: 700;
507
+ color: inherit;
508
+ padding: 8px 10px;
509
+ border-radius: 999px;
510
+ background: rgba(37, 99, 235, 0.08);
511
+ }
512
+
513
+ .a11y-card.active .a11y-stepper-value {
514
+ background: rgba(255, 255, 255, 0.16);
515
+ }
516
+
517
+ .a11y-card.active .a11y-stepper button {
518
+ border-color: rgba(255, 255, 255, 0.34);
519
+ background: rgba(255, 255, 255, 0.16);
520
+ color: #ffffff;
521
+ }
522
+
523
+ .a11y-card.active .a11y-stepper button:hover {
524
+ background: rgba(255, 255, 255, 0.24);
525
+ border-color: rgba(255, 255, 255, 0.48);
526
+ color: #ffffff;
527
+ }
528
+
529
+ .a11y-language {
530
+ display: flex;
531
+ justify-content: space-between;
532
+ align-items: center;
533
+ gap: 16px;
534
+ background: #eef4ff;
535
+ border: 1px solid #cfe0ff;
536
+ border-radius: 16px;
537
+ padding: 14px 16px;
538
+ }
539
+
540
+ .a11y-language label {
541
+ font-size: 14px;
542
+ font-weight: 600;
543
+ color: #1e3a8a;
544
+ }
545
+
546
+ .a11y-language select {
547
+ padding: 8px 12px;
548
+ border-radius: 10px;
549
+ border: 1px solid #bfd3f2;
550
+ background: #ffffff;
551
+ color: #0f172a;
552
+ cursor: pointer;
553
+ transition:
554
+ border-color 0.2s ease,
555
+ box-shadow 0.2s ease;
556
+ }
557
+
558
+ .a11y-language select:focus-visible {
559
+ outline: none;
560
+ border-color: #60a5fa;
561
+ box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.18);
562
+ }
563
+
564
+ @media (max-width: 640px) {
565
+ .a11y-panel {
566
+ width: min(100vw - 24px, 300px);
567
+ right: 0;
568
+ }
569
+
570
+ .a11y-grid {
571
+ grid-template-columns: 1fr;
572
+ }
573
+
574
+ .a11y-language {
575
+ flex-direction: column;
576
+ align-items: stretch;
577
+ }
578
+ }
@@ -2,31 +2,43 @@ export declare const translations: {
2
2
  en: {
3
3
  increaseText: string;
4
4
  decreaseText: string;
5
+ textMagnifier: string;
5
6
  highContrast: string;
6
7
  negativeContrast: string;
7
8
  lightBackground: string;
8
9
  underlineLinks: string;
10
+ highlightTitles: string;
9
11
  readableFont: string;
12
+ pauseAnimations: string;
13
+ readingGuide: string;
10
14
  voiceCommand: string;
11
15
  };
12
16
  tl: {
13
17
  increaseText: string;
14
18
  decreaseText: string;
19
+ textMagnifier: string;
15
20
  highContrast: string;
16
21
  negativeContrast: string;
17
22
  lightBackground: string;
18
23
  underlineLinks: string;
24
+ highlightTitles: string;
19
25
  readableFont: string;
26
+ pauseAnimations: string;
27
+ readingGuide: string;
20
28
  voiceCommand: string;
21
29
  };
22
30
  ceb: {
23
31
  increaseText: string;
24
32
  decreaseText: string;
33
+ textMagnifier: string;
25
34
  highContrast: string;
26
35
  negativeContrast: string;
27
36
  lightBackground: string;
28
37
  underlineLinks: string;
38
+ highlightTitles: string;
29
39
  readableFont: string;
40
+ pauseAnimations: string;
41
+ readingGuide: string;
30
42
  voiceCommand: string;
31
43
  };
32
44
  };
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "ngp-accessibility",
3
- "version": "1.0.2",
3
+ "version": "1.0.5",
4
4
  "description": "React accessibility package with translation, text sizing, contrast modes, and voice commands",
5
5
  "author": {
6
- "name": "Rodolfo Miclat Jr."
6
+ "name": "National Government Portal"
7
7
  },
8
8
  "main": "dist/index.js",
9
9
  "module": "dist/index.esm.js",
@@ -12,8 +12,8 @@
12
12
  "dist"
13
13
  ],
14
14
  "scripts": {
15
- "build": "rollup -c && cp src/styles.css dist/styles.css",
16
- "dev": "rollup -c -w"
15
+ "build": "rollup -c --bundleConfigAsCjs && cp src/styles.css dist/styles.css",
16
+ "dev": "rollup -c --bundleConfigAsCjs -w"
17
17
  },
18
18
  "keywords": [
19
19
  "react",