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/README.md CHANGED
@@ -26,8 +26,8 @@ npm install ngp-accessibility
26
26
  ### Option 1: Toolbar (Horizontal)
27
27
 
28
28
  ```jsx
29
- import { AccessibilityProvider, AccessibilityToolbar } from 'ngp-accessibility';
30
- import 'ngp-accessibility/dist/styles.css';
29
+ import { AccessibilityProvider, AccessibilityToolbar } from "ngp-accessibility";
30
+ import "ngp-accessibility/dist/styles.css";
31
31
 
32
32
  function App() {
33
33
  return (
@@ -42,13 +42,16 @@ function App() {
42
42
  ### Option 2: Dropdown Button
43
43
 
44
44
  ```jsx
45
- import { AccessibilityProvider, AccessibilityDropdown } from 'ngp-accessibility';
46
- import 'ngp-accessibility/dist/styles.css';
45
+ import {
46
+ AccessibilityProvider,
47
+ AccessibilityDropdown,
48
+ } from "ngp-accessibility";
49
+ import "ngp-accessibility/dist/styles.css";
47
50
 
48
51
  function App() {
49
52
  return (
50
53
  <AccessibilityProvider>
51
- <div style={{ textAlign: 'right', padding: '10px' }}>
54
+ <div style={{ textAlign: "right", padding: "10px" }}>
52
55
  <AccessibilityDropdown />
53
56
  </div>
54
57
  <YourContent />
@@ -60,6 +63,7 @@ function App() {
60
63
  ## Voice Commands
61
64
 
62
65
  When voice command is enabled, you can use:
66
+
63
67
  - "increase text" / "palakihin"
64
68
  - "decrease text" / "paliitin"
65
69
  - "high contrast" / "mataas"
@@ -71,10 +75,13 @@ When voice command is enabled, you can use:
71
75
  ## API
72
76
 
73
77
  ### AccessibilityProvider
78
+
74
79
  Wrap your app with this provider.
75
80
 
76
81
  ### useAccessibility()
82
+
77
83
  Hook that returns:
84
+
78
85
  - `language`, `setLanguage(lang)`
79
86
  - `textSize`, `increaseText()`, `decreaseText()`
80
87
  - `highContrast`, `toggleHighContrast()`
@@ -86,11 +93,77 @@ Hook that returns:
86
93
  - `translate(key)` - Get translated text
87
94
 
88
95
  ### AccessibilityToolbar
96
+
89
97
  Pre-built toolbar component with all controls.
90
98
 
99
+ ## Redesign And Theming
100
+
101
+ You can fully redesign the package UI in 3 ways:
102
+
103
+ ### 1. Override CSS variables (fastest)
104
+
105
+ ```css
106
+ :root {
107
+ --ngp-a11y-bg: #101418;
108
+ --ngp-a11y-surface: #1b232c;
109
+ --ngp-a11y-surface-hover: #243241;
110
+ --ngp-a11y-text: #f2f6fa;
111
+ --ngp-a11y-border: #2d3a48;
112
+ --ngp-a11y-accent: #16a34a;
113
+ --ngp-a11y-accent-hover: #15803d;
114
+ --ngp-a11y-accent-text: #ffffff;
115
+ --ngp-a11y-radius: 999px;
116
+ }
117
+ ```
118
+
119
+ ### 2. Pass custom classes to sub-elements
120
+
121
+ ```tsx
122
+ <AccessibilityToolbar
123
+ className="my-toolbar"
124
+ classes={{
125
+ button: "my-btn",
126
+ activeButton: "my-btn-active",
127
+ select: "my-select",
128
+ }}
129
+ />
130
+ ```
131
+
132
+ ```tsx
133
+ <AccessibilityDropdown
134
+ classes={{
135
+ toggle: "my-toggle",
136
+ menu: "my-menu",
137
+ section: "my-section",
138
+ button: "my-btn",
139
+ activeButton: "my-btn-active",
140
+ }}
141
+ />
142
+ ```
143
+
144
+ ### 3. Replace the dropdown trigger UI entirely
145
+
146
+ ```tsx
147
+ <AccessibilityDropdown
148
+ renderTrigger={({ isOpen, toggle, className }) => (
149
+ <button className={`${className} custom-trigger`} onClick={toggle}>
150
+ {isOpen ? "Close Tools" : "Open Accessibility"}
151
+ </button>
152
+ )}
153
+ />
154
+ ```
155
+
156
+ TypeScript users can import the prop types directly:
157
+
158
+ - `AccessibilityToolbarProps`
159
+ - `AccessibilityToolbarClasses`
160
+ - `AccessibilityDropdownProps`
161
+ - `AccessibilityDropdownClasses`
162
+
91
163
  ## Full Documentation
92
164
 
93
165
  For complete documentation including:
166
+
94
167
  - Full page translation guide
95
168
  - Custom toolbar examples
96
169
  - TypeScript support
@@ -1,12 +1,16 @@
1
- import React, { ReactNode } from 'react';
2
- import { Language, TranslationKey } from './translations';
1
+ import React, { ReactNode } from "react";
2
+ import { Language, TranslationKey } from "./translations";
3
3
  interface AccessibilityState {
4
4
  language: Language;
5
5
  textSize: number;
6
+ textMagnifier: boolean;
7
+ pauseAnimations: boolean;
8
+ readingGuide: boolean;
6
9
  highContrast: boolean;
7
10
  negativeContrast: boolean;
8
11
  lightBackground: boolean;
9
12
  underlineLinks: boolean;
13
+ highlightTitles: boolean;
10
14
  readableFont: boolean;
11
15
  voiceEnabled: boolean;
12
16
  }
@@ -14,10 +18,14 @@ interface AccessibilityContextType extends AccessibilityState {
14
18
  setLanguage: (lang: Language) => void;
15
19
  increaseText: () => void;
16
20
  decreaseText: () => void;
21
+ toggleTextMagnifier: () => void;
22
+ togglePauseAnimations: () => void;
23
+ toggleReadingGuide: () => void;
17
24
  toggleHighContrast: () => void;
18
25
  toggleNegativeContrast: () => void;
19
26
  toggleLightBackground: () => void;
20
27
  toggleUnderlineLinks: () => void;
28
+ toggleHighlightTitles: () => void;
21
29
  toggleReadableFont: () => void;
22
30
  toggleVoice: () => void;
23
31
  translate: (key: TranslationKey) => string;
@@ -25,7 +33,7 @@ interface AccessibilityContextType extends AccessibilityState {
25
33
  }
26
34
  interface AccessibilityProviderProps {
27
35
  children: ReactNode;
28
- translations?: Record<string, Record<string, any>>;
36
+ translations?: Partial<Record<Language, Record<string, string>>>;
29
37
  }
30
38
  export declare const AccessibilityProvider: React.FC<AccessibilityProviderProps>;
31
39
  export declare const useAccessibility: () => AccessibilityContextType;
@@ -1,2 +1,21 @@
1
- import React from 'react';
2
- export declare const AccessibilityDropdown: React.FC;
1
+ import React from "react";
2
+ export interface AccessibilityDropdownClasses {
3
+ root?: string;
4
+ trigger?: string;
5
+ panel?: string;
6
+ panelHeader?: string;
7
+ closeButton?: string;
8
+ }
9
+ export interface AccessibilityDropdownRenderTriggerProps {
10
+ isOpen: boolean;
11
+ toggle: () => void;
12
+ className: string;
13
+ }
14
+ export interface AccessibilityDropdownProps {
15
+ className?: string;
16
+ style?: React.CSSProperties;
17
+ classes?: AccessibilityDropdownClasses;
18
+ triggerLabel?: string;
19
+ renderTrigger?: (props: AccessibilityDropdownRenderTriggerProps) => React.ReactNode;
20
+ }
21
+ export declare const AccessibilityDropdown: React.FC<AccessibilityDropdownProps>;
@@ -1,2 +1,14 @@
1
- import React from 'react';
2
- export declare const AccessibilityToolbar: React.FC;
1
+ import React from "react";
2
+ export interface AccessibilityToolbarClasses {
3
+ root?: string;
4
+ select?: string;
5
+ button?: string;
6
+ activeButton?: string;
7
+ voiceButton?: string;
8
+ }
9
+ export interface AccessibilityToolbarProps {
10
+ className?: string;
11
+ style?: React.CSSProperties;
12
+ classes?: AccessibilityToolbarClasses;
13
+ }
14
+ export declare const AccessibilityToolbar: React.FC<AccessibilityToolbarProps>;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,8 @@
1
- export { AccessibilityProvider, useAccessibility } from './AccessibilityContext';
2
- export { AccessibilityToolbar } from './AccessibilityToolbar';
3
- export { AccessibilityDropdown } from './AccessibilityDropdown';
4
- export { T } from './T';
5
- export { translations, type Language, type TranslationKey } from './translations';
6
- export type { default as React } from 'react';
1
+ export { AccessibilityProvider, useAccessibility, } from "./AccessibilityContext";
2
+ export { AccessibilityToolbar } from "./AccessibilityToolbar";
3
+ export { AccessibilityDropdown } from "./AccessibilityDropdown";
4
+ export { T } from "./T";
5
+ export { translations, type Language, type TranslationKey, } from "./translations";
6
+ export type { AccessibilityToolbarProps, AccessibilityToolbarClasses, } from "./AccessibilityToolbar";
7
+ export type { AccessibilityDropdownProps, AccessibilityDropdownClasses, } from "./AccessibilityDropdown";
8
+ export type { default as React } from "react";