ngp-accessibility 1.0.3 → 1.0.6

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
@@ -14,6 +14,17 @@
14
14
  --ngp-a11y-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
15
15
  }
16
16
 
17
+ /* Hide Google Translate default UI */
18
+ .goog-te-banner-frame,
19
+ #google_translate_element,
20
+ .skiptranslate {
21
+ display: none !important;
22
+ }
23
+
24
+ body {
25
+ top: 0 !important;
26
+ }
27
+
17
28
  .accessibility-toolbar {
18
29
  display: flex;
19
30
  gap: var(--ngp-a11y-gap);
@@ -134,7 +145,126 @@
134
145
  }
135
146
 
136
147
  .underline-links a {
137
- text-decoration: underline !important;
148
+ text-decoration-line: underline !important;
149
+ text-decoration-thickness: 1px !important;
150
+ text-underline-offset: 0.2em;
151
+ font-weight: 700;
152
+ border: 2px solid #3f81f4;
153
+ border-radius: 4px;
154
+ box-shadow: inset 0 -0.2em 0 rgba(96, 165, 250, 0.24);
155
+ transition:
156
+ background 0.2s ease,
157
+ box-shadow 0.2s ease,
158
+ color 0.2s ease;
159
+ }
160
+
161
+ .underline-links a:hover {
162
+ background: rgba(37, 99, 235, 0.2);
163
+ box-shadow: inset 0 -0.28em 0 rgba(96, 165, 250, 0.32);
164
+ }
165
+
166
+ .highlight-titles :is(h1, h2, h3, h4, h5, h6, [role="heading"]) {
167
+ border: 2px solid #2563eb !important;
168
+ border-radius: 10px;
169
+ padding: 0.18em 0.45em;
170
+ background: rgba(37, 99, 235, 0.08);
171
+ box-shadow: 0 8px 20px rgba(37, 99, 235, 0.12);
172
+ }
173
+
174
+ .highlight-titles .a11y-root :is(h1, h2, h3, h4, h5, h6, [role="heading"]) {
175
+ border: none !important;
176
+ border-radius: 0;
177
+ padding: 0;
178
+ background: transparent;
179
+ box-shadow: none;
180
+ }
181
+
182
+ .pause-animations,
183
+ .pause-animations body {
184
+ scroll-behavior: auto !important;
185
+ }
186
+
187
+ .pause-animations *:not(.a11y-root):not(.a11y-root *) {
188
+ animation-duration: 0.01ms !important;
189
+ animation-delay: 0ms !important;
190
+ animation-iteration-count: 1 !important;
191
+ transition-duration: 0.01ms !important;
192
+ transition-delay: 0ms !important;
193
+ }
194
+
195
+ .a11y-reading-guide {
196
+ position: fixed;
197
+ inset: 0;
198
+ z-index: 900;
199
+ pointer-events: none;
200
+ }
201
+
202
+ .a11y-reading-guide-top,
203
+ .a11y-reading-guide-bottom {
204
+ position: absolute;
205
+ left: 0;
206
+ width: 100%;
207
+ background: rgba(15, 23, 42, 0.22);
208
+ }
209
+
210
+ .a11y-reading-guide-top {
211
+ top: 0;
212
+ }
213
+
214
+ .a11y-reading-guide-bottom {
215
+ bottom: 0;
216
+ }
217
+
218
+ .a11y-reading-guide-focus {
219
+ position: absolute;
220
+ left: 0;
221
+ width: 100%;
222
+ border-top: 1px solid rgba(96, 165, 250, 0.35);
223
+ border-bottom: 1px solid rgba(96, 165, 250, 0.35);
224
+ background: linear-gradient(
225
+ 180deg,
226
+ rgba(255, 255, 255, 0.18) 0%,
227
+ rgba(255, 255, 255, 0.06) 100%
228
+ );
229
+ box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
230
+ }
231
+
232
+ .a11y-reading-guide-line {
233
+ position: absolute;
234
+ left: 0;
235
+ width: 100%;
236
+ height: 2px;
237
+ margin-top: -1px;
238
+ background: rgba(150, 150, 150, 0.9);
239
+ box-shadow: 0 0 18px rgba(59, 130, 246, 0.45);
240
+ }
241
+
242
+ .a11y-text-magnifier-tooltip {
243
+ position: fixed;
244
+ top: 0;
245
+ left: 0;
246
+ z-index: 3000;
247
+ max-width: min(360px, calc(100vw - 24px));
248
+ padding: 12px 14px;
249
+ border-radius: 12px;
250
+ background: rgba(0, 0, 0, 0.6);
251
+ color: #ffffff;
252
+ font-size: 20px;
253
+ font-weight: 600;
254
+ line-height: 1.35;
255
+ pointer-events: none;
256
+ opacity: 0;
257
+ transform: translateY(4px);
258
+ transition:
259
+ opacity 0.14s ease,
260
+ transform 0.14s ease;
261
+ box-shadow: 0 16px 32px rgba(15, 23, 42, 0.24);
262
+ backdrop-filter: blur(8px);
263
+ }
264
+
265
+ .a11y-text-magnifier-tooltip[data-visible="true"] {
266
+ opacity: 1;
267
+ transform: translateY(0);
138
268
  }
139
269
 
140
270
  .readable-font,
@@ -143,3 +273,404 @@
143
273
  letter-spacing: 0.05em !important;
144
274
  line-height: 1.6 !important;
145
275
  }
276
+
277
+ /* Focus Indicator — enhanced keyboard focus outlines */
278
+ .focus-indicator *:focus,
279
+ .focus-indicator *:focus-visible {
280
+ outline: 3px solid #f59e0b !important;
281
+ outline-offset: 3px !important;
282
+ box-shadow: 0 0 0 5px rgba(245, 158, 11, 0.35) !important;
283
+ border-radius: 3px;
284
+ }
285
+
286
+ .focus-indicator .a11y-root *:focus,
287
+ .focus-indicator .a11y-root *:focus-visible {
288
+ outline: none !important;
289
+ box-shadow: none !important;
290
+ }
291
+ .a11y-root {
292
+ position: relative;
293
+ display: inline-flex;
294
+ flex-direction: column;
295
+ z-index: 1200;
296
+ }
297
+
298
+ .a11y-trigger {
299
+ display: inline-flex;
300
+ align-items: center;
301
+ justify-content: center;
302
+ gap: 8px;
303
+ min-height: 44px;
304
+ padding: 12px 18px;
305
+ border: 1px solid #bfdbfe;
306
+ border-radius: 14px;
307
+ color: #000000;
308
+ cursor: pointer;
309
+ font-size: 14px;
310
+ font-weight: 700;
311
+ letter-spacing: -0.01em;
312
+ box-shadow: 0 10px 24px rgba(59, 130, 246, 0.16);
313
+ transition:
314
+ background 0.2s ease,
315
+ border-color 0.2s ease,
316
+ box-shadow 0.2s ease,
317
+ transform 0.2s ease;
318
+ }
319
+
320
+ .a11y-trigger:hover {
321
+ transform: translateY(-1px);
322
+ box-shadow: 0 14px 28px rgba(59, 130, 246, 0.2);
323
+ }
324
+
325
+ .a11y-trigger:focus-visible {
326
+ outline: 3px solid rgba(37, 99, 235, 0.22);
327
+ outline-offset: 2px;
328
+ }
329
+ .a11y-panel {
330
+ width: 420px;
331
+ overflow-y: scroll;
332
+ background: linear-gradient(180deg, #ffffff 0%, #f7fafc 100%);
333
+ border: 1px solid #d9e2ec;
334
+ border-radius: 20px;
335
+ padding: 20px;
336
+ box-shadow: 0 24px 48px rgba(15, 23, 42, 0.16);
337
+ position: absolute;
338
+ right: 0;
339
+ min-width: 200px;
340
+ display: flex;
341
+ flex-direction: column;
342
+ gap: 16px;
343
+ height: 420px;
344
+ }
345
+
346
+ .a11y-panel-header {
347
+ display: flex;
348
+ align-items: flex-start;
349
+ justify-content: space-between;
350
+ gap: 16px;
351
+ padding: 4px 4px 12px;
352
+ border-bottom: 1px solid #e2e8f0;
353
+ }
354
+
355
+ .a11y-panel-heading {
356
+ display: flex;
357
+ flex-direction: column;
358
+ gap: 4px;
359
+ }
360
+
361
+ .a11y-panel-eyebrow {
362
+ font-size: 11px;
363
+ font-weight: 700;
364
+ letter-spacing: 0.12em;
365
+ text-transform: uppercase;
366
+ color: #2563eb;
367
+ }
368
+
369
+ .a11y-panel-title {
370
+ font-size: 20px;
371
+ font-weight: 700;
372
+ color: #0f172a;
373
+ line-height: 1.2;
374
+ }
375
+
376
+ .a11y-panel-close {
377
+ width: 38px;
378
+ height: 38px;
379
+ flex-shrink: 0;
380
+ border: 1px solid #cbd5e1;
381
+ border-radius: 999px;
382
+ background: #ffffff;
383
+ color: #334155;
384
+ cursor: pointer;
385
+ font-size: 22px;
386
+ line-height: 1;
387
+ transition:
388
+ background 0.2s ease,
389
+ color 0.2s ease,
390
+ border-color 0.2s ease,
391
+ transform 0.2s ease;
392
+ }
393
+
394
+ .a11y-panel-close:hover {
395
+ background: #eff6ff;
396
+ color: #1d4ed8;
397
+ border-color: #93c5fd;
398
+ transform: rotate(90deg);
399
+ }
400
+
401
+ .a11y-panel-close:focus-visible {
402
+ outline: 3px solid rgba(37, 99, 235, 0.2);
403
+ outline-offset: 2px;
404
+ }
405
+
406
+ .a11y-panel button,
407
+ .a11y-panel select {
408
+ font-family: inherit;
409
+ }
410
+
411
+ .a11y-language {
412
+ display: flex;
413
+ align-items: center;
414
+ justify-content: space-between;
415
+ gap: 12px;
416
+ padding: 8px 12px;
417
+ background: #eff6ff;
418
+ border: 1px solid #bfdbfe;
419
+ border-radius: 10px;
420
+ }
421
+ .a11y-language label {
422
+ font-size: 16px;
423
+ font-weight: 700;
424
+ color: #1e3a8a;
425
+ }
426
+
427
+ .a11y-language select {
428
+ appearance: none;
429
+ -webkit-appearance: none;
430
+ -moz-appearance: none;
431
+
432
+ width: 100%;
433
+ padding: 8px 36px 8px 12px;
434
+
435
+ border: 1px solid #93c5fd;
436
+ border-radius: 10px;
437
+
438
+ background-color: #ffffff;
439
+ background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 20 20' fill='%231e3a5f' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5.5 7.5L10 12l4.5-4.5' stroke='%231e3a5f' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
440
+ background-repeat: no-repeat;
441
+ background-position: right 10px center;
442
+ background-size: 16px;
443
+
444
+ color: #1e3a5f;
445
+ font-size: 13px;
446
+ font-weight: 500;
447
+
448
+ cursor: pointer;
449
+
450
+ transition:
451
+ border-color 0.2s ease,
452
+ box-shadow 0.2s ease,
453
+ background-color 0.2s ease;
454
+ }
455
+
456
+ /* hover */
457
+ .a11y-language select:hover {
458
+ border-color: #60a5fa;
459
+ background-color: #f8fbff;
460
+ }
461
+
462
+ /* focus (keyboard accessibility) */
463
+ .a11y-language select:focus-visible {
464
+ outline: none;
465
+ border-color: #2563eb;
466
+ box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
467
+ }
468
+
469
+ /* active click */
470
+ .a11y-language select:active {
471
+ background-color: #f1f7ff;
472
+ }
473
+
474
+ /* disabled */
475
+ .a11y-language select:disabled {
476
+ background-color: #f3f4f6;
477
+ border-color: #d1d5db;
478
+ color: #9ca3af;
479
+ cursor: not-allowed;
480
+ }
481
+
482
+ /* high contrast mode support */
483
+ .high-contrast .a11y-language select {
484
+ border-color: #000;
485
+ color: #000;
486
+ background-color: #fff;
487
+ }
488
+
489
+ .a11y-section {
490
+ display: flex;
491
+ flex-direction: column;
492
+ gap: 14px;
493
+ background: linear-gradient(180deg, #f8fbff 0%, #eff6ff 100%);
494
+ border: 1px solid #dbeafe;
495
+ border-radius: 16px;
496
+ padding: 18px;
497
+ }
498
+
499
+ .a11y-section-title {
500
+ font-size: 16px;
501
+ font-weight: 700;
502
+ margin: 0;
503
+ color: #1e3a8a;
504
+ letter-spacing: -0.01em;
505
+ }
506
+
507
+ .a11y-grid {
508
+ display: grid;
509
+ grid-template-columns: repeat(2, 1fr);
510
+ gap: 14px;
511
+ }
512
+
513
+ .a11y-card {
514
+ appearance: none;
515
+ display: flex;
516
+ flex-direction: column;
517
+ justify-content: center;
518
+ align-items: center;
519
+ gap: 12px;
520
+ min-height: 84px;
521
+ background: #ffffff;
522
+ color: #0f172a;
523
+ border-radius: 14px;
524
+ padding: 16px;
525
+ border: 1px solid #d6e4f5;
526
+ cursor: pointer;
527
+ text-align: left;
528
+ box-shadow: 0 10px 24px rgba(148, 163, 184, 0.12);
529
+ transition:
530
+ border-color 0.2s ease,
531
+ background 0.2s ease,
532
+ box-shadow 0.2s ease,
533
+ transform 0.2s ease;
534
+ font-size: 14px;
535
+ font-weight: 600;
536
+ line-height: 1.35;
537
+ }
538
+
539
+ .a11y-card:hover {
540
+ background: #f8fbff;
541
+ border-color: #93c5fd;
542
+ transform: translateY(-4px);
543
+ box-shadow: 0 14px 28px rgba(59, 130, 246, 0.14);
544
+ }
545
+
546
+ .a11y-card.active {
547
+ background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
548
+ color: #ffffff;
549
+ border-color: #1d4ed8;
550
+ box-shadow: 0 16px 30px rgba(37, 99, 235, 0.28);
551
+ }
552
+
553
+ .a11y-card:focus-visible {
554
+ outline: 3px solid rgba(37, 99, 235, 0.22);
555
+ outline-offset: 2px;
556
+ }
557
+
558
+ .a11y-card.active:hover {
559
+ background: linear-gradient(180deg, #1d4ed8 0%, #1e40af 100%);
560
+ border-color: #1e40af;
561
+ }
562
+
563
+ .a11y-card-title {
564
+ font-size: 14px;
565
+ font-weight: 700;
566
+ color: inherit;
567
+ }
568
+
569
+ .a11y-stepper {
570
+ display: flex;
571
+ align-items: center;
572
+ justify-content: space-between;
573
+ gap: 10px;
574
+ width: 100%;
575
+ }
576
+
577
+ .a11y-stepper button {
578
+ width: 34px;
579
+ height: 34px;
580
+ border-radius: 50%;
581
+ border: 1px solid #bfdbfe;
582
+ background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
583
+ color: #1d4ed8;
584
+ font-size: 18px;
585
+ font-weight: 700;
586
+ cursor: pointer;
587
+ transition:
588
+ background 0.2s ease,
589
+ border-color 0.2s ease,
590
+ color 0.2s ease,
591
+ transform 0.2s ease;
592
+ }
593
+
594
+ .a11y-stepper button:hover {
595
+ background: linear-gradient(180deg, #dbeafe 0%, #bfdbfe 100%);
596
+ border-color: #93c5fd;
597
+ color: #1e3a8a;
598
+ transform: scale(1.04);
599
+ }
600
+
601
+ .a11y-stepper button:focus-visible {
602
+ outline: 3px solid rgba(37, 99, 235, 0.22);
603
+ outline-offset: 2px;
604
+ }
605
+
606
+ .a11y-stepper-value {
607
+ flex: 1;
608
+ text-align: center;
609
+ font-size: 13px;
610
+ font-weight: 700;
611
+ color: inherit;
612
+ padding: 8px 10px;
613
+ border-radius: 999px;
614
+ background: rgba(37, 99, 235, 0.08);
615
+ }
616
+
617
+ .a11y-card.active .a11y-stepper-value {
618
+ background: rgba(255, 255, 255, 0.16);
619
+ }
620
+
621
+ .a11y-card.active .a11y-stepper button {
622
+ border-color: rgba(255, 255, 255, 0.34);
623
+ background: rgba(255, 255, 255, 0.16);
624
+ color: #ffffff;
625
+ }
626
+
627
+ .a11y-card.active .a11y-stepper button:hover {
628
+ background: rgba(255, 255, 255, 0.24);
629
+ border-color: rgba(255, 255, 255, 0.48);
630
+ color: #ffffff;
631
+ }
632
+
633
+ .a11y-language {
634
+ display: flex;
635
+ justify-content: space-between;
636
+ align-items: center;
637
+ gap: 16px;
638
+ background: #eef4ff;
639
+ border: 1px solid #cfe0ff;
640
+ border-radius: 16px;
641
+ padding: 14px 16px;
642
+ }
643
+
644
+ .a11y-language select {
645
+ padding: 8px 12px;
646
+ border-radius: 10px;
647
+ border: 1px solid #bfd3f2;
648
+ background: #ffffff;
649
+ color: #0f172a;
650
+ cursor: pointer;
651
+ transition:
652
+ border-color 0.2s ease,
653
+ box-shadow 0.2s ease;
654
+ }
655
+
656
+ .a11y-language select:focus-visible {
657
+ outline: none;
658
+ border-color: #60a5fa;
659
+ box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.18);
660
+ }
661
+
662
+ @media (max-width: 640px) {
663
+ .a11y-panel {
664
+ width: min(100vw - 24px, 300px);
665
+ right: 0;
666
+ }
667
+
668
+ .a11y-grid {
669
+ grid-template-columns: 1fr;
670
+ }
671
+
672
+ .a11y-language {
673
+ flex-direction: column;
674
+ align-items: stretch;
675
+ }
676
+ }
@@ -1,34 +1,59 @@
1
1
  export declare const translations: {
2
2
  en: {
3
+ language: string;
3
4
  increaseText: string;
4
5
  decreaseText: string;
6
+ textMagnifier: string;
5
7
  highContrast: string;
6
8
  negativeContrast: string;
7
9
  lightBackground: string;
8
10
  underlineLinks: string;
11
+ highlightTitles: string;
9
12
  readableFont: string;
13
+ pauseAnimations: string;
14
+ readingGuide: string;
10
15
  voiceCommand: string;
16
+ readAloud: string;
17
+ colorBlindMode: string;
18
+ focusIndicator: string;
11
19
  };
12
20
  tl: {
21
+ language: string;
13
22
  increaseText: string;
14
23
  decreaseText: string;
24
+ textMagnifier: string;
15
25
  highContrast: string;
16
26
  negativeContrast: string;
17
27
  lightBackground: string;
18
28
  underlineLinks: string;
29
+ highlightTitles: string;
19
30
  readableFont: string;
31
+ pauseAnimations: string;
32
+ readingGuide: string;
20
33
  voiceCommand: string;
34
+ readAloud: string;
35
+ colorBlindMode: string;
36
+ focusIndicator: string;
21
37
  };
22
38
  ceb: {
39
+ language: string;
23
40
  increaseText: string;
24
41
  decreaseText: string;
42
+ textMagnifier: string;
25
43
  highContrast: string;
26
44
  negativeContrast: string;
27
45
  lightBackground: string;
28
46
  underlineLinks: string;
47
+ highlightTitles: string;
29
48
  readableFont: string;
49
+ pauseAnimations: string;
50
+ readingGuide: string;
30
51
  voiceCommand: string;
52
+ readAloud: string;
53
+ colorBlindMode: string;
54
+ focusIndicator: string;
31
55
  };
32
56
  };
33
- export type Language = keyof typeof translations;
57
+ export type ManualLanguage = keyof typeof translations;
58
+ export type Language = ManualLanguage | (string & {});
34
59
  export type TranslationKey = keyof typeof translations.en;
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "ngp-accessibility",
3
- "version": "1.0.3",
3
+ "version": "1.0.6",
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",