vision-accessibility 1.0.0 → 1.0.1

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.
Files changed (29) hide show
  1. package/dist/components/AccessibilityPanel/AccessibilityPanel.d.ts.map +1 -1
  2. package/dist/index.esm.js +263 -74
  3. package/dist/index.esm.js.map +1 -1
  4. package/dist/index.umd.js +7 -2
  5. package/dist/index.umd.js.map +1 -1
  6. package/dist/lib/css-applier.d.ts +9 -1
  7. package/dist/lib/css-applier.d.ts.map +1 -1
  8. package/dist/style.css +1 -1
  9. package/dist/types/index.d.ts +1 -1
  10. package/dist/types/index.d.ts.map +1 -1
  11. package/package.json +21 -13
  12. package/src/components/AccessibilityPanel/AccessibilityPanel.module.scss +32 -12
  13. package/src/components/AccessibilityPanel/AccessibilityPanel.stories.tsx +105 -0
  14. package/src/components/AccessibilityPanel/AccessibilityPanel.tsx +29 -19
  15. package/src/components/AccessibilityToggle/AccessibilityToggle.module.scss +1 -1
  16. package/src/components/AccessibilityToggle/AccessibilityToggle.stories.tsx +34 -0
  17. package/src/components/AccessibilityToggle/AccessibilityToggle.tsx +1 -1
  18. package/src/components/ColorSchemeControl/ColorSchemeControl.module.scss +1 -1
  19. package/src/components/ColorSchemeControl/ColorSchemeControl.stories.tsx +34 -0
  20. package/src/components/ColorSchemeControl/ColorSchemeControl.tsx +1 -1
  21. package/src/components/FontSizeControl/FontSizeControl.module.scss +1 -1
  22. package/src/components/FontSizeControl/FontSizeControl.stories.tsx +34 -0
  23. package/src/components/FontSizeControl/FontSizeControl.tsx +1 -1
  24. package/src/components/ImageControl/ImageControl.module.scss +1 -1
  25. package/src/components/ImageControl/ImageControl.stories.tsx +43 -0
  26. package/src/components/ImageControl/ImageControl.tsx +1 -1
  27. package/src/lib/css-applier.ts +127 -4
  28. package/src/styles/global.scss +7 -7
  29. package/src/types/index.ts +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/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 +1,6 @@
1
1
  {
2
2
  "name": "vision-accessibility",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
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": "Your Name",
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
- "@types/react": "^18.0.0",
37
- "@types/react-dom": "^18.0.0",
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
- "repository": {
51
- "type": "git",
52
- "url": "https://github.com/your-username/vision-accessibility.git"
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
  }
@@ -33,15 +33,33 @@
33
33
  pointer-events: auto;
34
34
 
35
35
  // Позиционирование панели
36
- &.topRight {
37
- margin-left: auto;
38
- margin-right: $spacing-xl;
39
- }
40
-
41
- &.topLeft {
42
- margin-left: $spacing-xl;
43
- margin-right: auto;
44
- }
36
+ &.top-right {
37
+ margin-left: auto;
38
+ margin-right: $spacing-xl;
39
+ }
40
+
41
+ &.top-left {
42
+ margin-left: $spacing-xl;
43
+ margin-right: auto;
44
+ }
45
+
46
+ &.bottom-right {
47
+ margin-left: auto;
48
+ margin-right: $spacing-xl;
49
+ position: fixed;
50
+ top: auto;
51
+ bottom: $spacing-xl;
52
+ width: 360px;
53
+ }
54
+
55
+ &.bottom-left {
56
+ margin-left: $spacing-xl;
57
+ margin-right: auto;
58
+ position: fixed;
59
+ top: auto;
60
+ bottom: $spacing-xl;
61
+ width: 360px;
62
+ }
45
63
 
46
64
  // Адаптивность для мобильных устройств
47
65
  @include respond-down(md) {
@@ -50,8 +68,10 @@
50
68
  margin-left: $spacing-lg;
51
69
  margin-right: $spacing-lg;
52
70
 
53
- &.topRight,
54
- &.topLeft {
71
+ &.top-right,
72
+ &.top-left,
73
+ &.bottom-right,
74
+ &.bottom-left {
55
75
  margin-left: $spacing-lg;
56
76
  margin-right: $spacing-lg;
57
77
  }
@@ -149,7 +169,7 @@
149
169
  }
150
170
 
151
171
  // Высококонтрастная тема - адаптация стилей только для панели
152
- :global(.accessibility-high-contrast) .panel {
172
+ .panel.highContrastMode {
153
173
  background: $black !important;
154
174
  border-color: $white !important;
155
175
  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 styles from './AccessibilityPanel.module.scss';
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
- <div className={`${styles.stickyContainer} accessibility-panel-container`}>
93
- <div
94
- ref={panelRef}
95
- className={`${styles.panel} ${styles[position]}`}
96
- role="dialog"
97
- aria-modal="true"
98
- aria-labelledby="accessibility-panel-title"
99
- aria-describedby="accessibility-panel-description"
100
- >
101
- <div className={styles.header}>
102
- <h3 id="accessibility-panel-title" className={styles.title}>
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 />
@@ -110,7 +110,7 @@
110
110
  }
111
111
 
112
112
  // Высококонтрастная тема - адаптация стилей
113
- :global(.accessibility-high-contrast) .accessibilityToggle {
113
+ .accessibilityToggle.highContrastMode {
114
114
  border-bottom-color: $white !important;
115
115
 
116
116
  .toggleLabel {
@@ -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
@@ -136,7 +136,7 @@
136
136
  }
137
137
 
138
138
  // Высококонтрастная тема - адаптация стилей
139
- :global(.accessibility-high-contrast) .colorSchemeControl {
139
+ .colorSchemeControl.highContrastMode {
140
140
  .title {
141
141
  color: $white !important;
142
142
  }
@@ -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>
@@ -136,7 +136,7 @@
136
136
  }
137
137
 
138
138
  // Высококонтрастная тема - адаптация стилей
139
- :global(.accessibility-high-contrast) .fontSizeControl {
139
+ .fontSizeControl.highContrastMode {
140
140
  .title {
141
141
  color: $white !important;
142
142
  }
@@ -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>
@@ -119,7 +119,7 @@
119
119
  }
120
120
 
121
121
  // Высококонтрастная тема - адаптация стилей
122
- :global(.accessibility-high-contrast) .imageControl {
122
+ .imageControl.highContrastMode {
123
123
  .title {
124
124
  color: $white !important;
125
125
  }
@@ -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>