vision-accessibility 1.0.0 → 1.0.2
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/components/AccessibilityPanel/AccessibilityPanel.d.ts.map +1 -1
- package/dist/index.esm.js +263 -74
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +7 -2
- package/dist/index.umd.js.map +1 -1
- package/dist/lib/css-applier.d.ts +9 -1
- package/dist/lib/css-applier.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +21 -13
- package/src/components/AccessibilityPanel/AccessibilityPanel.module.scss +32 -14
- package/src/components/AccessibilityPanel/AccessibilityPanel.stories.tsx +105 -0
- package/src/components/AccessibilityPanel/AccessibilityPanel.tsx +29 -19
- package/src/components/AccessibilityToggle/AccessibilityToggle.module.scss +1 -1
- package/src/components/AccessibilityToggle/AccessibilityToggle.stories.tsx +34 -0
- package/src/components/AccessibilityToggle/AccessibilityToggle.tsx +1 -1
- package/src/components/ColorSchemeControl/ColorSchemeControl.module.scss +1 -1
- package/src/components/ColorSchemeControl/ColorSchemeControl.stories.tsx +34 -0
- package/src/components/ColorSchemeControl/ColorSchemeControl.tsx +1 -1
- package/src/components/FontSizeControl/FontSizeControl.module.scss +1 -1
- package/src/components/FontSizeControl/FontSizeControl.stories.tsx +34 -0
- package/src/components/FontSizeControl/FontSizeControl.tsx +1 -1
- package/src/components/ImageControl/ImageControl.module.scss +1 -1
- package/src/components/ImageControl/ImageControl.stories.tsx +43 -0
- package/src/components/ImageControl/ImageControl.tsx +1 -1
- package/src/lib/css-applier.ts +127 -4
- package/src/styles/global.scss +8 -8
- package/src/types/index.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,eAAe,GAAG,WAAW,CAAC;AACrE,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,UAAU,GAAG,OAAO,CAAC;AAEtD;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,mCAAmC;IACnC,SAAS,EAAE,OAAO,CAAC;IACnB,qBAAqB;IACrB,WAAW,EAAE,WAAW,CAAC;IACzB,oBAAoB;IACpB,QAAQ,EAAE,QAAQ,CAAC;IACnB,gCAAgC;IAChC,UAAU,EAAE,OAAO,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,wBAAwB;IACxB,QAAQ,EAAE,qBAAqB,CAAC;IAChC,0BAA0B;IAC1B,cAAc,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,qBAAqB,CAAC,KAAK,IAAI,CAAC;IAClE,8CAA8C;IAC9C,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,6CAA6C;IAC7C,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,wBAAwB;IACxB,MAAM,EAAE,OAAO,CAAC;IAChB,iCAAiC;IACjC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,yCAAyC;IACzC,QAAQ,CAAC,EAAE,WAAW,GAAG,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,eAAe,GAAG,WAAW,CAAC;AACrE,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,UAAU,GAAG,OAAO,CAAC;AAEtD;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,mCAAmC;IACnC,SAAS,EAAE,OAAO,CAAC;IACnB,qBAAqB;IACrB,WAAW,EAAE,WAAW,CAAC;IACzB,oBAAoB;IACpB,QAAQ,EAAE,QAAQ,CAAC;IACnB,gCAAgC;IAChC,UAAU,EAAE,OAAO,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,wBAAwB;IACxB,QAAQ,EAAE,qBAAqB,CAAC;IAChC,0BAA0B;IAC1B,cAAc,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,qBAAqB,CAAC,KAAK,IAAI,CAAC;IAClE,8CAA8C;IAC9C,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,6CAA6C;IAC7C,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,wBAAwB;IACxB,MAAM,EAAE,OAAO,CAAC;IAChB,iCAAiC;IACjC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,yCAAyC;IACzC,QAAQ,CAAC,EAAE,WAAW,GAAG,UAAU,GAAG,aAAa,GAAG,cAAc,CAAC;CACtE;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,wBAAwB;IACxB,QAAQ,EAAE,qBAAqB,CAAC;IAChC,qCAAqC;IACrC,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,qBAAqB,CAAC,KAAK,IAAI,CAAC;CAC7D;AAED;;GAEG;AACH,eAAO,MAAM,8BAA8B,EAAE,qBAK5C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,2BAA2B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vision-accessibility",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Универсальный компонент панели доступности для слабовидящих пользователей",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|
|
@@ -15,7 +15,9 @@
|
|
|
15
15
|
"dev": "vite build --watch",
|
|
16
16
|
"type-check": "tsc --noEmit",
|
|
17
17
|
"lint": "eslint src --ext .ts,.tsx",
|
|
18
|
-
"prepublishOnly": "npm run build"
|
|
18
|
+
"prepublishOnly": "npm run build",
|
|
19
|
+
"storybook": "storybook dev -p 6006",
|
|
20
|
+
"build-storybook": "storybook build"
|
|
19
21
|
},
|
|
20
22
|
"keywords": [
|
|
21
23
|
"accessibility",
|
|
@@ -26,33 +28,39 @@
|
|
|
26
28
|
"слабовидящие",
|
|
27
29
|
"доступность"
|
|
28
30
|
],
|
|
29
|
-
"author": "
|
|
31
|
+
"author": "Siyan Roman",
|
|
30
32
|
"license": "MIT",
|
|
31
33
|
"peerDependencies": {
|
|
34
|
+
"classnames": ">=2.0.1",
|
|
32
35
|
"react": ">=16.8.0",
|
|
33
36
|
"react-dom": ">=16.8.0"
|
|
34
37
|
},
|
|
35
38
|
"devDependencies": {
|
|
36
|
-
"@
|
|
37
|
-
"@
|
|
39
|
+
"@storybook/addon-essentials": "^8.6.14",
|
|
40
|
+
"@storybook/addon-interactions": "^8.6.14",
|
|
41
|
+
"@storybook/addon-links": "^8.6.14",
|
|
42
|
+
"@storybook/addon-onboarding": "^8.6.14",
|
|
43
|
+
"@storybook/blocks": "^8.6.14",
|
|
44
|
+
"@storybook/react": "^8.6.14",
|
|
45
|
+
"@storybook/react-vite": "^8.6.15",
|
|
46
|
+
"@storybook/test": "^8.6.15",
|
|
47
|
+
"@types/react": "^18.3.27",
|
|
48
|
+
"@types/react-dom": "^18.3.7",
|
|
38
49
|
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
|
39
50
|
"@typescript-eslint/parser": "^6.0.0",
|
|
40
51
|
"@vitejs/plugin-react": "^4.0.0",
|
|
41
52
|
"eslint": "^8.0.0",
|
|
42
53
|
"eslint-plugin-react": "^7.0.0",
|
|
43
54
|
"eslint-plugin-react-hooks": "^4.0.0",
|
|
55
|
+
"react-docgen-typescript": "^2.4.0",
|
|
44
56
|
"sass": "^1.69.0",
|
|
57
|
+
"storybook": "^8.6.14",
|
|
45
58
|
"terser": "^5.46.0",
|
|
46
59
|
"typescript": "^5.0.0",
|
|
47
60
|
"vite": "^5.0.0",
|
|
48
61
|
"vite-plugin-dts": "^3.0.0"
|
|
49
62
|
},
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
},
|
|
54
|
-
"bugs": {
|
|
55
|
-
"url": "https://github.com/your-username/vision-accessibility/issues"
|
|
56
|
-
},
|
|
57
|
-
"homepage": "https://github.com/your-username/vision-accessibility#readme"
|
|
63
|
+
"dependencies": {
|
|
64
|
+
"classnames": ">=2.0.1"
|
|
65
|
+
}
|
|
58
66
|
}
|
|
@@ -6,8 +6,6 @@
|
|
|
6
6
|
.stickyContainer {
|
|
7
7
|
position: fixed;
|
|
8
8
|
top: 70px;
|
|
9
|
-
right: 0;
|
|
10
|
-
left: 0;
|
|
11
9
|
pointer-events: none;
|
|
12
10
|
z-index: 1000;
|
|
13
11
|
|
|
@@ -33,15 +31,33 @@
|
|
|
33
31
|
pointer-events: auto;
|
|
34
32
|
|
|
35
33
|
// Позиционирование панели
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
34
|
+
&.top-right {
|
|
35
|
+
margin-left: auto;
|
|
36
|
+
margin-right: $spacing-xl;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&.top-left {
|
|
40
|
+
margin-left: $spacing-xl;
|
|
41
|
+
margin-right: auto;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&.bottom-right {
|
|
45
|
+
margin-left: auto;
|
|
46
|
+
margin-right: $spacing-xl;
|
|
47
|
+
position: fixed;
|
|
48
|
+
top: auto;
|
|
49
|
+
bottom: $spacing-xl;
|
|
50
|
+
width: 360px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&.bottom-left {
|
|
54
|
+
margin-left: $spacing-xl;
|
|
55
|
+
margin-right: auto;
|
|
56
|
+
position: fixed;
|
|
57
|
+
top: auto;
|
|
58
|
+
bottom: $spacing-xl;
|
|
59
|
+
width: 360px;
|
|
60
|
+
}
|
|
45
61
|
|
|
46
62
|
// Адаптивность для мобильных устройств
|
|
47
63
|
@include respond-down(md) {
|
|
@@ -50,8 +66,10 @@
|
|
|
50
66
|
margin-left: $spacing-lg;
|
|
51
67
|
margin-right: $spacing-lg;
|
|
52
68
|
|
|
53
|
-
&.
|
|
54
|
-
&.
|
|
69
|
+
&.top-right,
|
|
70
|
+
&.top-left,
|
|
71
|
+
&.bottom-right,
|
|
72
|
+
&.bottom-left {
|
|
55
73
|
margin-left: $spacing-lg;
|
|
56
74
|
margin-right: $spacing-lg;
|
|
57
75
|
}
|
|
@@ -149,7 +167,7 @@
|
|
|
149
167
|
}
|
|
150
168
|
|
|
151
169
|
// Высококонтрастная тема - адаптация стилей только для панели
|
|
152
|
-
|
|
170
|
+
.panel.highContrastMode {
|
|
153
171
|
background: $black !important;
|
|
154
172
|
border-color: $white !important;
|
|
155
173
|
color: $white !important;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { AccessibilityPanel } from "./AccessibilityPanel";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: "Components/AccessibilityPanel",
|
|
7
|
+
component: AccessibilityPanel,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: "centered",
|
|
10
|
+
},
|
|
11
|
+
tags: ["autodocs"],
|
|
12
|
+
argTypes: {
|
|
13
|
+
position: {
|
|
14
|
+
control: { type: "select" },
|
|
15
|
+
options: ["top-left", "top-right", "bottom-left", "bottom-right"],
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
} satisfies Meta<typeof AccessibilityPanel>;
|
|
19
|
+
|
|
20
|
+
export default meta;
|
|
21
|
+
type Story = StoryObj<typeof meta>;
|
|
22
|
+
|
|
23
|
+
// Оборачиваем в декоратор для обеспечения контекста и управления состоянием
|
|
24
|
+
const WithProviderAndControls = (Story: any, context: any) => {
|
|
25
|
+
const [isOpen, setIsOpen] = useState(context.args.isOpen);
|
|
26
|
+
|
|
27
|
+
const togglePanel = () => {
|
|
28
|
+
setIsOpen(!isOpen);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<div style={{ padding: "20px" }}>
|
|
33
|
+
<button onClick={togglePanel} style={{ marginBottom: "20px" }}>
|
|
34
|
+
{isOpen ? "Закрыть панель" : "Открыть панель доступности"}
|
|
35
|
+
</button>
|
|
36
|
+
|
|
37
|
+
<Story
|
|
38
|
+
{...context}
|
|
39
|
+
args={{
|
|
40
|
+
...context.args,
|
|
41
|
+
isOpen,
|
|
42
|
+
onClose: () => setIsOpen(false),
|
|
43
|
+
}}
|
|
44
|
+
/>
|
|
45
|
+
|
|
46
|
+
<div>
|
|
47
|
+
<h1 style={{ color: 'red' }}>Тестовый заголовок</h1>
|
|
48
|
+
<p>Это тестовая страница для демонстрации работы панели доступности.</p>
|
|
49
|
+
<p>
|
|
50
|
+
Вы можете изменить настройки в панели и увидеть результат на этой
|
|
51
|
+
странице.
|
|
52
|
+
</p>
|
|
53
|
+
|
|
54
|
+
<div style={{ marginTop: '20px' }}>
|
|
55
|
+
<h2>Пример изображения</h2>
|
|
56
|
+
<img
|
|
57
|
+
src="https://placehold.co/300x200/FF0000/FFFFFF?text=Цветная+картинка"
|
|
58
|
+
alt="Тестовое изображение для демонстрации функции показа/скрытия изображений"
|
|
59
|
+
style={{ maxWidth: '100%', height: 'auto' }}
|
|
60
|
+
/>
|
|
61
|
+
<p>Это цветная картинка, которая будет скрываться при включении опции "Скрывать изображения"</p>
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
<div style={{ marginTop: '20px' }}>
|
|
65
|
+
<h2>Еще немного контента</h2>
|
|
66
|
+
<p>Вот еще несколько абзацев текста для демонстрации изменения размера шрифта:</p>
|
|
67
|
+
<p>Первый параграф с обычным текстом для проверки работы изменения размера шрифта.</p>
|
|
68
|
+
<p>Второй параграф содержит немного другой текст, чтобы можно было увидеть эффект от изменения размера шрифта.</p>
|
|
69
|
+
<ul>
|
|
70
|
+
<li>Это элемент списка 1</li>
|
|
71
|
+
<li>Это элемент списка 2</li>
|
|
72
|
+
<li>Это элемент списка 3</li>
|
|
73
|
+
</ul>
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
);
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export const Default: Story = {
|
|
81
|
+
args: {
|
|
82
|
+
isOpen: true,
|
|
83
|
+
position: "top-right",
|
|
84
|
+
onClose: () => console.log("Panel closed"),
|
|
85
|
+
},
|
|
86
|
+
decorators: [WithProviderAndControls],
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export const TopLeftPosition: Story = {
|
|
90
|
+
args: {
|
|
91
|
+
isOpen: true,
|
|
92
|
+
position: "top-left",
|
|
93
|
+
onClose: () => console.log("Panel closed"),
|
|
94
|
+
},
|
|
95
|
+
decorators: [WithProviderAndControls],
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export const BottomRightPosition: Story = {
|
|
99
|
+
args: {
|
|
100
|
+
isOpen: true,
|
|
101
|
+
position: "bottom-right",
|
|
102
|
+
onClose: () => console.log("Panel closed"),
|
|
103
|
+
},
|
|
104
|
+
decorators: [WithProviderAndControls],
|
|
105
|
+
};
|
|
@@ -10,12 +10,16 @@
|
|
|
10
10
|
|
|
11
11
|
import React, { useEffect, useRef } from 'react';
|
|
12
12
|
import { AccessibilityPanelProps } from '../../types';
|
|
13
|
-
import { AccessibilityProvider } from '../../context/AccessibilityContext';
|
|
13
|
+
import { AccessibilityProvider, useAccessibilityContext } from '../../context/AccessibilityContext';
|
|
14
14
|
import { AccessibilityToggle } from '../AccessibilityToggle/AccessibilityToggle';
|
|
15
15
|
import { ColorSchemeControl } from '../ColorSchemeControl/ColorSchemeControl';
|
|
16
16
|
import { FontSizeControl } from '../FontSizeControl/FontSizeControl';
|
|
17
17
|
import { ImageControl } from '../ImageControl/ImageControl';
|
|
18
|
-
import
|
|
18
|
+
import cn from 'classnames';
|
|
19
|
+
import * as stylesImport from './AccessibilityPanel.module.scss';
|
|
20
|
+
|
|
21
|
+
// Обеспечиваем безопасный доступ к стилям
|
|
22
|
+
const styles = typeof stylesImport === 'object' && stylesImport.default ? stylesImport.default : stylesImport.default || stylesImport;
|
|
19
23
|
|
|
20
24
|
/**
|
|
21
25
|
* Внутренний компонент панели доступности
|
|
@@ -88,24 +92,30 @@ const AccessibilityPanelInner: React.FC<AccessibilityPanelProps> = ({
|
|
|
88
92
|
return null;
|
|
89
93
|
}
|
|
90
94
|
|
|
95
|
+
const { settings } = useAccessibilityContext();
|
|
96
|
+
|
|
91
97
|
return (
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
98
|
+
<div className={cn(styles.stickyContainer)}>
|
|
99
|
+
<div
|
|
100
|
+
ref={panelRef}
|
|
101
|
+
className={cn(
|
|
102
|
+
styles.panel,
|
|
103
|
+
styles[position],
|
|
104
|
+
settings.colorScheme === 'high-contrast' && styles.highContrastMode
|
|
105
|
+
)}
|
|
106
|
+
role="dialog"
|
|
107
|
+
aria-modal="true"
|
|
108
|
+
aria-labelledby="accessibility-panel-title"
|
|
109
|
+
aria-describedby="accessibility-panel-description"
|
|
110
|
+
>
|
|
111
|
+
<div className={cn(styles.header)}>
|
|
112
|
+
<h3 id="accessibility-panel-title" className={cn(styles.title)}>
|
|
103
113
|
Настройки доступности
|
|
104
114
|
</h3>
|
|
105
115
|
|
|
106
116
|
<button
|
|
107
117
|
onClick={handleCloseClick}
|
|
108
|
-
className={styles.closeButton}
|
|
118
|
+
className={cn(styles.closeButton)}
|
|
109
119
|
aria-label="Закрыть панель настроек доступности"
|
|
110
120
|
type="button"
|
|
111
121
|
>
|
|
@@ -113,17 +123,17 @@ const AccessibilityPanelInner: React.FC<AccessibilityPanelProps> = ({
|
|
|
113
123
|
</button>
|
|
114
124
|
</div>
|
|
115
125
|
|
|
116
|
-
<div
|
|
117
|
-
id="accessibility-panel-description"
|
|
118
|
-
className={styles.description}
|
|
126
|
+
<div
|
|
127
|
+
id="accessibility-panel-description"
|
|
128
|
+
className={cn(styles.description)}
|
|
119
129
|
>
|
|
120
130
|
Настройте отображение страницы для улучшения доступности
|
|
121
131
|
</div>
|
|
122
132
|
|
|
123
|
-
<div className={styles.content}>
|
|
133
|
+
<div className={cn(styles.content)}>
|
|
124
134
|
<AccessibilityToggle />
|
|
125
135
|
|
|
126
|
-
<div className={styles.controls}>
|
|
136
|
+
<div className={cn(styles.controls)}>
|
|
127
137
|
<ColorSchemeControl />
|
|
128
138
|
<FontSizeControl />
|
|
129
139
|
<ImageControl />
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { AccessibilityToggle } from './AccessibilityToggle';
|
|
3
|
+
import { AccessibilityProvider } from '../../context/AccessibilityContext';
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'Components/AccessibilityToggle',
|
|
7
|
+
component: AccessibilityToggle,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'centered',
|
|
10
|
+
},
|
|
11
|
+
tags: ['autodocs'],
|
|
12
|
+
decorators: [
|
|
13
|
+
(Story) => (
|
|
14
|
+
<AccessibilityProvider>
|
|
15
|
+
<div style={{ padding: '20px' }}>
|
|
16
|
+
<Story />
|
|
17
|
+
</div>
|
|
18
|
+
</AccessibilityProvider>
|
|
19
|
+
),
|
|
20
|
+
],
|
|
21
|
+
} satisfies Meta<typeof AccessibilityToggle>;
|
|
22
|
+
|
|
23
|
+
export default meta;
|
|
24
|
+
type Story = StoryObj<typeof meta>;
|
|
25
|
+
|
|
26
|
+
export const Default: Story = {
|
|
27
|
+
args: {},
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const WithCustomClass: Story = {
|
|
31
|
+
args: {
|
|
32
|
+
className: 'custom-toggle-class',
|
|
33
|
+
},
|
|
34
|
+
};
|
|
@@ -43,7 +43,7 @@ export const AccessibilityToggle: React.FC<AccessibilityToggleProps> = ({
|
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
return (
|
|
46
|
-
<div className={`${styles.accessibilityToggle} ${className || ''}`}>
|
|
46
|
+
<div className={`${styles.accessibilityToggle} ${className || ''} ${settings.colorScheme === 'high-contrast' ? styles.highContrastMode : ''}`}>
|
|
47
47
|
<div className={styles.toggleContainer}>
|
|
48
48
|
<label className={styles.toggleLabel}>
|
|
49
49
|
<input
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { ColorSchemeControl } from './ColorSchemeControl';
|
|
3
|
+
import { AccessibilityProvider } from '../../context/AccessibilityContext';
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'Components/ColorSchemeControl',
|
|
7
|
+
component: ColorSchemeControl,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'centered',
|
|
10
|
+
},
|
|
11
|
+
tags: ['autodocs'],
|
|
12
|
+
decorators: [
|
|
13
|
+
(Story) => (
|
|
14
|
+
<AccessibilityProvider>
|
|
15
|
+
<div style={{ padding: '20px' }}>
|
|
16
|
+
<Story />
|
|
17
|
+
</div>
|
|
18
|
+
</AccessibilityProvider>
|
|
19
|
+
),
|
|
20
|
+
],
|
|
21
|
+
} satisfies Meta<typeof ColorSchemeControl>;
|
|
22
|
+
|
|
23
|
+
export default meta;
|
|
24
|
+
type Story = StoryObj<typeof meta>;
|
|
25
|
+
|
|
26
|
+
export const Default: Story = {
|
|
27
|
+
args: {},
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const WithCustomClass: Story = {
|
|
31
|
+
args: {
|
|
32
|
+
className: 'custom-color-scheme-class',
|
|
33
|
+
},
|
|
34
|
+
};
|
|
@@ -71,7 +71,7 @@ export const ColorSchemeControl: React.FC<ColorSchemeControlProps> = ({
|
|
|
71
71
|
};
|
|
72
72
|
|
|
73
73
|
return (
|
|
74
|
-
<div className={`${styles.colorSchemeControl} ${className || ''} ${!isEnabled ? styles.disabled : ''}`}>
|
|
74
|
+
<div className={`${styles.colorSchemeControl} ${className || ''} ${!isEnabled ? styles.disabled : ''} ${colorScheme === 'high-contrast' ? styles.highContrastMode : ''}`}>
|
|
75
75
|
<h4 className={styles.title}>
|
|
76
76
|
Цветовая схема
|
|
77
77
|
</h4>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { FontSizeControl } from './FontSizeControl';
|
|
3
|
+
import { AccessibilityProvider } from '../../context/AccessibilityContext';
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'Components/FontSizeControl',
|
|
7
|
+
component: FontSizeControl,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'centered',
|
|
10
|
+
},
|
|
11
|
+
tags: ['autodocs'],
|
|
12
|
+
decorators: [
|
|
13
|
+
(Story) => (
|
|
14
|
+
<AccessibilityProvider>
|
|
15
|
+
<div style={{ padding: '20px' }}>
|
|
16
|
+
<Story />
|
|
17
|
+
</div>
|
|
18
|
+
</AccessibilityProvider>
|
|
19
|
+
),
|
|
20
|
+
],
|
|
21
|
+
} satisfies Meta<typeof FontSizeControl>;
|
|
22
|
+
|
|
23
|
+
export default meta;
|
|
24
|
+
type Story = StoryObj<typeof meta>;
|
|
25
|
+
|
|
26
|
+
export const Default: Story = {
|
|
27
|
+
args: {},
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const WithCustomClass: Story = {
|
|
31
|
+
args: {
|
|
32
|
+
className: 'custom-font-size-class',
|
|
33
|
+
},
|
|
34
|
+
};
|
|
@@ -71,7 +71,7 @@ export const FontSizeControl: React.FC<FontSizeControlProps> = ({
|
|
|
71
71
|
};
|
|
72
72
|
|
|
73
73
|
return (
|
|
74
|
-
<div className={`${styles.fontSizeControl} ${className || ''} ${!isEnabled ? styles.disabled : ''}`}>
|
|
74
|
+
<div className={`${styles.fontSizeControl} ${className || ''} ${!isEnabled ? styles.disabled : ''} ${settings.colorScheme === 'high-contrast' ? styles.highContrastMode : ''}`}>
|
|
75
75
|
<h4 className={styles.title}>
|
|
76
76
|
Размер шрифта
|
|
77
77
|
</h4>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { ImageControl } from './ImageControl';
|
|
3
|
+
import { AccessibilityProvider } from '../../context/AccessibilityContext';
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'Components/ImageControl',
|
|
7
|
+
component: ImageControl,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'centered',
|
|
10
|
+
},
|
|
11
|
+
tags: ['autodocs'],
|
|
12
|
+
decorators: [
|
|
13
|
+
(Story) => (
|
|
14
|
+
<AccessibilityProvider>
|
|
15
|
+
<div style={{ padding: '20px' }}>
|
|
16
|
+
<Story />
|
|
17
|
+
<div style={{ marginTop: '20px' }}>
|
|
18
|
+
<h1 style={{ color: 'red' }}>Демонстрация работы переключателя изображений</h1>
|
|
19
|
+
<p>Включите/выключите опцию "Показывать изображения" и посмотрите, как изображение скрывается/появляется:</p>
|
|
20
|
+
<img
|
|
21
|
+
src="https://placehold.co/300x200/00FF00/FFFFFF?text=Тестовое+изображение"
|
|
22
|
+
alt="Тестовое изображение для демонстрации функции показа/скрытия изображений"
|
|
23
|
+
style={{ maxWidth: '100%', height: 'auto', marginTop: '10px' }}
|
|
24
|
+
/>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
</AccessibilityProvider>
|
|
28
|
+
),
|
|
29
|
+
],
|
|
30
|
+
} satisfies Meta<typeof ImageControl>;
|
|
31
|
+
|
|
32
|
+
export default meta;
|
|
33
|
+
type Story = StoryObj<typeof meta>;
|
|
34
|
+
|
|
35
|
+
export const Default: Story = {
|
|
36
|
+
args: {},
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const WithCustomClass: Story = {
|
|
40
|
+
args: {
|
|
41
|
+
className: 'custom-image-control-class',
|
|
42
|
+
},
|
|
43
|
+
};
|
|
@@ -43,7 +43,7 @@ export const ImageControl: React.FC<ImageControlProps> = ({
|
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
return (
|
|
46
|
-
<div className={`${styles.imageControl} ${className || ''} ${!isEnabled ? styles.disabled : ''}`}>
|
|
46
|
+
<div className={`${styles.imageControl} ${className || ''} ${!isEnabled ? styles.disabled : ''} ${settings.colorScheme === 'high-contrast' ? styles.highContrastMode : ''}`}>
|
|
47
47
|
<h4 className={styles.title}>
|
|
48
48
|
Изображения
|
|
49
49
|
</h4>
|