@krasnoff/react-accessibility-component 1.0.4 → 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/README.md +22 -5
- package/dist/README.md +22 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -23,20 +23,37 @@ yarn add react-accessibility-component
|
|
|
23
23
|
Import and use the component in your React application:
|
|
24
24
|
|
|
25
25
|
```
|
|
26
|
-
import
|
|
26
|
+
import '@krasnoff/react-accessibility-component/dist/react-accessibility-component.css';
|
|
27
|
+
import { AccessibilityComponent as AccessibilityComponentBase } from "@krasnoff/react-accessibility-component";
|
|
28
|
+
|
|
29
|
+
const AccessibilityComponent = AccessibilityComponentBase as React.FC<React.PropsWithChildren>;
|
|
27
30
|
|
|
28
31
|
function App() {
|
|
32
|
+
// need to implement this handler to listen to the events emitted by the accessibility component
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
const handler = (e: Event) => {
|
|
35
|
+
const { message, value } = (e as CustomEvent).detail;
|
|
36
|
+
console.log(message, value);
|
|
37
|
+
// message can be: "OpenCloseComponent", "grayScale", "contrast",
|
|
38
|
+
// "fontSizeIndex", "brightBackground", "readableFonts",
|
|
39
|
+
// "markHyperlinks", "listsMark", "titlesMark"
|
|
40
|
+
};
|
|
41
|
+
window.addEventListener("shadow-click", handler);
|
|
42
|
+
return () => window.removeEventListener("shadow-click", handler);
|
|
43
|
+
}, []);
|
|
44
|
+
|
|
29
45
|
return (
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
46
|
+
<>
|
|
47
|
+
<h1>Vite + React to NPM repository</h1>
|
|
48
|
+
</AccessibilityComponent />
|
|
49
|
+
</>
|
|
33
50
|
)
|
|
34
51
|
}
|
|
35
52
|
|
|
36
53
|
export default App
|
|
37
54
|
```
|
|
38
55
|
|
|
39
|
-
|
|
56
|
+
Alternatively, you can add the following css file to the `index.html` file in your project instead of importing it in the App component:
|
|
40
57
|
|
|
41
58
|
```
|
|
42
59
|
<link rel="stylesheet" href="node_modules/react-accessibility-component/dist/react-accessibility-component.css" />
|
package/dist/README.md
CHANGED
|
@@ -23,20 +23,37 @@ yarn add react-accessibility-component
|
|
|
23
23
|
Import and use the component in your React application:
|
|
24
24
|
|
|
25
25
|
```
|
|
26
|
-
import
|
|
26
|
+
import '@krasnoff/react-accessibility-component/dist/react-accessibility-component.css';
|
|
27
|
+
import { AccessibilityComponent as AccessibilityComponentBase } from "@krasnoff/react-accessibility-component";
|
|
28
|
+
|
|
29
|
+
const AccessibilityComponent = AccessibilityComponentBase as React.FC<React.PropsWithChildren>;
|
|
27
30
|
|
|
28
31
|
function App() {
|
|
32
|
+
// need to implement this handler to listen to the events emitted by the accessibility component
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
const handler = (e: Event) => {
|
|
35
|
+
const { message, value } = (e as CustomEvent).detail;
|
|
36
|
+
console.log(message, value);
|
|
37
|
+
// message can be: "OpenCloseComponent", "grayScale", "contrast",
|
|
38
|
+
// "fontSizeIndex", "brightBackground", "readableFonts",
|
|
39
|
+
// "markHyperlinks", "listsMark", "titlesMark"
|
|
40
|
+
};
|
|
41
|
+
window.addEventListener("shadow-click", handler);
|
|
42
|
+
return () => window.removeEventListener("shadow-click", handler);
|
|
43
|
+
}, []);
|
|
44
|
+
|
|
29
45
|
return (
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
46
|
+
<>
|
|
47
|
+
<h1>Vite + React to NPM repository</h1>
|
|
48
|
+
</AccessibilityComponent />
|
|
49
|
+
</>
|
|
33
50
|
)
|
|
34
51
|
}
|
|
35
52
|
|
|
36
53
|
export default App
|
|
37
54
|
```
|
|
38
55
|
|
|
39
|
-
|
|
56
|
+
Alternatively, you can add the following css file to the `index.html` file in your project instead of importing it in the App component:
|
|
40
57
|
|
|
41
58
|
```
|
|
42
59
|
<link rel="stylesheet" href="node_modules/react-accessibility-component/dist/react-accessibility-component.css" />
|
package/package.json
CHANGED