@tcn/sb-blackcat-addon 1.0.0 → 3.0.12
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/LICENSE +201 -0
- package/README.md +180 -61
- package/dist/adjust_color.d.ts +2 -0
- package/dist/adjust_color.d.ts.map +1 -0
- package/dist/constants.d.ts +3 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/decorator.d.ts +18 -0
- package/dist/decorator.d.ts.map +1 -0
- package/dist/globals/theme.d.ts +17 -0
- package/dist/globals/theme.d.ts.map +1 -0
- package/dist/index.cjs +5 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -3
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/preview.cjs +154 -2
- package/dist/preview.cjs.map +1 -1
- package/dist/preview.css +17 -0
- package/dist/preview.d.ts +4 -15
- package/dist/preview.d.ts.map +1 -0
- package/dist/preview.js +155 -2
- package/dist/preview.js.map +1 -1
- package/package.json +32 -70
- package/src/adjust_color.ts +56 -0
- package/src/constants.ts +2 -0
- package/src/decorator.tsx +60 -0
- package/src/globals/theme.ts +24 -0
- package/src/index.test.ts +5 -0
- package/src/index.ts +1 -0
- package/src/preview.tsx +87 -0
- package/src/sb_decorator.module.css +17 -0
- package/src/stories/Button.stories.ts +53 -0
- package/src/stories/Button.tsx +48 -0
- package/src/stories/button.css +31 -0
- package/tsconfig.json +30 -0
- package/types/css_variables.d.ts +8 -0
- package/types/file_types.d.ts +54 -0
- package/dist/index.d.cts +0 -3
- package/dist/preview.d.cts +0 -15
- package/dist/tcn_palette.module-WZDBNRNC.module.css +0 -86
- package/preview.js +0 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2024 TCN
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,97 +1,216 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @tcn/sb-blackcat-addon
|
|
2
2
|
|
|
3
|
-
A Storybook addon that provides accessibility
|
|
3
|
+
A Storybook addon that provides enhanced accessibility features, layout direction controls, and design system integration for the Blackcat UI component library.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
2. A direction control to switch between LTR and RTL layouts
|
|
5
|
+
## Overview
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
`@tcn/sb-blackcat-addon` is a specialized Storybook addon that enhances the development experience for Blackcat UI components. It provides accessibility testing tools, layout direction controls, and design system integration features that help developers build and test components with accessibility and internationalization in mind.
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
- React
|
|
9
|
+
## What's Included
|
|
12
10
|
|
|
13
|
-
|
|
11
|
+
### Accessibility Features
|
|
12
|
+
- **Scalar Controls**: Adjust component sizes for accessibility testing
|
|
13
|
+
- **Layout Direction**: Test components in LTR and RTL layouts
|
|
14
|
+
- **Color Customization**: Test components with different accent and text colors
|
|
15
|
+
- **Accessibility Testing**: Tools for testing component accessibility
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
### Design System Integration
|
|
18
|
+
- **Color Palette**: Predefined color schemes for consistent testing
|
|
19
|
+
- **Scalar System**: Size scaling for different accessibility needs
|
|
20
|
+
- **Theme Integration**: Seamless integration with Blackcat UI themes
|
|
21
|
+
- **Component Decorators**: Enhanced story presentation and testing
|
|
18
22
|
|
|
19
|
-
|
|
23
|
+
### Storybook Enhancements
|
|
24
|
+
- **Global Controls**: Easy access to accessibility and design controls
|
|
25
|
+
- **Story Decorators**: Automatic application of accessibility features
|
|
26
|
+
- **Preview Configuration**: Enhanced story preview with accessibility tools
|
|
27
|
+
- **Toolbar Integration**: Quick access to accessibility controls
|
|
28
|
+
|
|
29
|
+
## Key Features
|
|
30
|
+
|
|
31
|
+
- **Accessibility First**: Built-in accessibility testing and controls
|
|
32
|
+
- **Layout Direction Support**: Full LTR and RTL layout testing
|
|
33
|
+
- **Scalar Controls**: Size adjustment for accessibility compliance
|
|
34
|
+
- **Color Customization**: Flexible color scheme testing
|
|
35
|
+
- **Storybook Integration**: Seamless integration with Storybook
|
|
36
|
+
- **Design System Support**: Full integration with Blackcat UI components
|
|
37
|
+
- **Performance Optimized**: Efficient addon with minimal overhead
|
|
20
38
|
|
|
21
|
-
|
|
39
|
+
## Usage
|
|
22
40
|
|
|
41
|
+
### Basic Installation
|
|
23
42
|
```typescript
|
|
24
43
|
// .storybook/main.ts
|
|
25
44
|
import type { StorybookConfig } from '@storybook/react-vite';
|
|
26
45
|
|
|
27
46
|
const config: StorybookConfig = {
|
|
28
|
-
|
|
47
|
+
// ... other config
|
|
29
48
|
addons: [
|
|
30
|
-
'@storybook/addon-links',
|
|
31
|
-
'@storybook/addon-essentials',
|
|
32
|
-
'@storybook/addon-onboarding',
|
|
33
|
-
'@storybook/addon-interactions',
|
|
34
49
|
'@tcn/sb-blackcat-addon',
|
|
50
|
+
// ... other addons
|
|
35
51
|
],
|
|
36
|
-
framework: {
|
|
37
|
-
name: '@storybook/react-vite',
|
|
38
|
-
options: {},
|
|
39
|
-
},
|
|
40
|
-
docs: {
|
|
41
|
-
autodocs: 'tag',
|
|
42
|
-
},
|
|
43
52
|
};
|
|
44
53
|
|
|
45
54
|
export default config;
|
|
46
55
|
```
|
|
47
56
|
|
|
48
|
-
|
|
57
|
+
### Preview Configuration
|
|
58
|
+
```typescript
|
|
59
|
+
// .storybook/preview.ts
|
|
60
|
+
import { preview } from '@tcn/sb-blackcat-addon/preview';
|
|
49
61
|
|
|
50
|
-
|
|
62
|
+
export default preview;
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Using Accessibility Controls
|
|
66
|
+
```typescript
|
|
67
|
+
// In your Storybook stories
|
|
68
|
+
export default {
|
|
69
|
+
title: 'Components/Button',
|
|
70
|
+
component: Button,
|
|
71
|
+
parameters: {
|
|
72
|
+
// Enable specific addon features
|
|
73
|
+
blackcat: {
|
|
74
|
+
enableScalar: true,
|
|
75
|
+
enableDirection: true,
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export const Primary = {
|
|
81
|
+
args: {
|
|
82
|
+
children: 'Primary Button',
|
|
83
|
+
hierarchy: 'primary',
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
```
|
|
51
87
|
|
|
52
|
-
###
|
|
88
|
+
### Custom Color Schemes
|
|
89
|
+
```typescript
|
|
90
|
+
// The addon automatically provides these color controls:
|
|
91
|
+
// - Accent Color: TCN, Cyan, Blue, Purple, Magenta, Red, Orange, Yellow, Green, Grey, Black, White
|
|
92
|
+
// - Text Color: Same color palette for text testing
|
|
93
|
+
// - Scalar: 0.75x, 0.875x, 1x, 1.125x, 1.25x
|
|
94
|
+
// - Direction: LTR, RTL
|
|
95
|
+
```
|
|
53
96
|
|
|
54
|
-
|
|
97
|
+
## Addon Features
|
|
98
|
+
|
|
99
|
+
### Accessibility Scalar
|
|
100
|
+
- **Size Adjustment**: Scale component sizes for accessibility testing
|
|
101
|
+
- **User Preference Simulation**: Test components at different size preferences
|
|
102
|
+
- **Responsive Testing**: Ensure components work at various scales
|
|
103
|
+
- **Accessibility Compliance**: Test WCAG size requirements
|
|
104
|
+
|
|
105
|
+
### Layout Direction
|
|
106
|
+
- **LTR Support**: Test left-to-right layouts
|
|
107
|
+
- **RTL Support**: Test right-to-left layouts
|
|
108
|
+
- **Component Adaptation**: Ensure components work in both directions
|
|
109
|
+
- **Internationalization**: Test components for global markets
|
|
110
|
+
|
|
111
|
+
### Color Customization
|
|
112
|
+
- **Accent Colors**: Test components with different brand colors
|
|
113
|
+
- **Text Colors**: Test readability with various text colors
|
|
114
|
+
- **Contrast Testing**: Ensure proper color contrast ratios
|
|
115
|
+
- **Theme Testing**: Test components across different color schemes
|
|
116
|
+
|
|
117
|
+
### Story Decorators
|
|
118
|
+
- **Automatic Application**: All stories automatically get accessibility features
|
|
119
|
+
- **Consistent Testing**: Uniform accessibility testing across all components
|
|
120
|
+
- **Enhanced Presentation**: Better story presentation with accessibility tools
|
|
121
|
+
- **Integration**: Seamless integration with existing Storybook setup
|
|
122
|
+
|
|
123
|
+
## Design System Integration
|
|
124
|
+
|
|
125
|
+
The addon automatically integrates with:
|
|
126
|
+
- **Blackcat UI Components**: Full support for all component types
|
|
127
|
+
- **CSS Custom Properties**: Dynamic color and size adjustments
|
|
128
|
+
- **Theme System**: Integration with Blackcat UI themes
|
|
129
|
+
- **Layout Components**: Support for all layout and spacing systems
|
|
130
|
+
- **Typography**: Consistent text sizing and color controls
|
|
131
|
+
|
|
132
|
+
## Accessibility Features
|
|
133
|
+
|
|
134
|
+
### Scalar Controls
|
|
135
|
+
- **Extra Small**: 0.75x scale for testing small text requirements
|
|
136
|
+
- **Small**: 0.875x scale for testing reduced size preferences
|
|
137
|
+
- **Medium**: 1x scale (default) for normal viewing
|
|
138
|
+
- **Large**: 1.125x scale for testing large text preferences
|
|
139
|
+
- **Extra Large**: 1.25x scale for testing maximum accessibility
|
|
140
|
+
|
|
141
|
+
### Layout Direction
|
|
142
|
+
- **LTR (Left-to-Right)**: Standard left-to-right layout testing
|
|
143
|
+
- **RTL (Right-to-Left)**: Right-to-left layout testing for RTL languages
|
|
144
|
+
- **Automatic Switching**: Easy switching between layout directions
|
|
145
|
+
- **Component Adaptation**: Ensure components work in both directions
|
|
146
|
+
|
|
147
|
+
### Color Testing
|
|
148
|
+
- **High Contrast**: Test components with high contrast color schemes
|
|
149
|
+
- **Low Vision**: Test components for users with low vision
|
|
150
|
+
- **Color Blindness**: Test components for color blind users
|
|
151
|
+
- **Brand Consistency**: Test components across different brand colors
|
|
152
|
+
|
|
153
|
+
## When to Use
|
|
154
|
+
|
|
155
|
+
Choose `@tcn/sb-blackcat-addon` when you need:
|
|
156
|
+
- Accessibility testing for your components
|
|
157
|
+
- Layout direction testing (LTR/RTL)
|
|
158
|
+
- Component size scaling for accessibility
|
|
159
|
+
- Color scheme testing and validation
|
|
160
|
+
- Enhanced Storybook development experience
|
|
161
|
+
- Design system integration testing
|
|
162
|
+
- Internationalization testing support
|
|
55
163
|
|
|
56
|
-
|
|
57
|
-
/* Font size scaling */
|
|
58
|
-
.my-component {
|
|
59
|
-
font-size: calc(16px * var(--accessibility-scalar));
|
|
60
|
-
}
|
|
164
|
+
## Configuration
|
|
61
165
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
166
|
+
### Enable Features
|
|
167
|
+
```typescript
|
|
168
|
+
// .storybook/preview.ts
|
|
169
|
+
export const parameters = {
|
|
170
|
+
blackcat: {
|
|
171
|
+
enableScalar: true, // Enable size scaling controls
|
|
172
|
+
enableDirection: true, // Enable layout direction controls
|
|
173
|
+
enableColors: true, // Enable color customization
|
|
174
|
+
},
|
|
175
|
+
};
|
|
176
|
+
```
|
|
67
177
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
178
|
+
### Custom Colors
|
|
179
|
+
```typescript
|
|
180
|
+
// The addon provides a predefined color palette:
|
|
181
|
+
// TCN, Cyan, Blue, Purple, Magenta, Red, Orange, Yellow, Green, Grey, Black, White
|
|
182
|
+
// These colors are optimized for accessibility and design system consistency
|
|
183
|
+
```
|
|
71
184
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
185
|
+
### Story Integration
|
|
186
|
+
```typescript
|
|
187
|
+
// Individual stories can override addon settings
|
|
188
|
+
export const StoryWithCustomSettings = {
|
|
189
|
+
parameters: {
|
|
190
|
+
blackcat: {
|
|
191
|
+
enableScalar: false, // Disable scalar for this story
|
|
192
|
+
enableDirection: true, // Keep direction controls
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
};
|
|
76
196
|
```
|
|
77
197
|
|
|
78
|
-
|
|
198
|
+
## Performance
|
|
79
199
|
|
|
80
|
-
|
|
200
|
+
- **Efficient Rendering**: Minimal impact on story performance
|
|
201
|
+
- **Lazy Loading**: Controls load only when needed
|
|
202
|
+
- **Memory Management**: Proper cleanup and resource management
|
|
203
|
+
- **Bundle Optimization**: Tree-shakeable addon features
|
|
204
|
+
- **Fast Switching**: Quick switching between accessibility settings
|
|
81
205
|
|
|
82
|
-
|
|
206
|
+
## Browser Support
|
|
83
207
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
| 1.125 | Large |
|
|
90
|
-
| 1.25 | Extra Large |
|
|
208
|
+
- **Modern Browsers**: Full support for modern browsers
|
|
209
|
+
- **CSS Custom Properties**: Leverages modern CSS features
|
|
210
|
+
- **Responsive Design**: Works across all screen sizes
|
|
211
|
+
- **Touch Support**: Optimized for touch devices
|
|
212
|
+
- **Accessibility**: Full accessibility compliance
|
|
91
213
|
|
|
92
|
-
|
|
214
|
+
## License
|
|
93
215
|
|
|
94
|
-
|
|
95
|
-
|-------|-------------------|
|
|
96
|
-
| ltr | Left to Right |
|
|
97
|
-
| rtl | Right to Left |
|
|
216
|
+
Apache-2.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adjust_color.d.ts","sourceRoot":"","sources":["../src/adjust_color.ts"],"names":[],"mappings":"AAKA,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAkDlF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,EAAG,mBAA4B,CAAC;AACrD,eAAO,MAAM,OAAO,0BAA8B,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Decorator } from '@storybook/react-vite';
|
|
2
|
+
export declare const colorMap: Readonly<{
|
|
3
|
+
TCN: "#cd6b2c";
|
|
4
|
+
Cyan: "#0abef1";
|
|
5
|
+
Blue: "#1e7aff";
|
|
6
|
+
Purple: "#953e96";
|
|
7
|
+
Magenta: "#f54f9e";
|
|
8
|
+
Red: "#e0383e";
|
|
9
|
+
Orange: "#f7821a";
|
|
10
|
+
Yellow: "#eeb80f";
|
|
11
|
+
Green: "#39b712";
|
|
12
|
+
Grey: "#797979";
|
|
13
|
+
Black: "#333333";
|
|
14
|
+
White: "#ffffff";
|
|
15
|
+
}>;
|
|
16
|
+
export declare const colorNames: string[];
|
|
17
|
+
export declare const BlackcatDecorator: Decorator;
|
|
18
|
+
//# sourceMappingURL=decorator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorator.d.ts","sourceRoot":"","sources":["../src/decorator.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAMvD,eAAO,MAAM,QAAQ;;;;;;;;;;;;;EAanB,CAAC;AAEH,eAAO,MAAM,UAAU,UAAwB,CAAC;AAEhD,eAAO,MAAM,iBAAiB,EAAE,SAmC/B,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { StoryContext } from '@storybook/react-vite';
|
|
2
|
+
export declare const sbThemes: Readonly<{
|
|
3
|
+
ergo: {
|
|
4
|
+
value: string;
|
|
5
|
+
label: string;
|
|
6
|
+
};
|
|
7
|
+
windows98: {
|
|
8
|
+
value: string;
|
|
9
|
+
label: string;
|
|
10
|
+
};
|
|
11
|
+
}>;
|
|
12
|
+
export declare const sbThemeStyleMap: Readonly<{
|
|
13
|
+
[sbThemes.ergo.value]: CSSStyleSheet;
|
|
14
|
+
[sbThemes.windows98.value]: CSSStyleSheet;
|
|
15
|
+
}>;
|
|
16
|
+
export declare function useSBThemeGlobal(context: StoryContext): CSSStyleSheet;
|
|
17
|
+
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/globals/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAI1D,eAAO,MAAM,QAAQ;;;;;;;;;EASnB,CAAC;AAEH,eAAO,MAAM,eAAe;IAC1B,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,gBAAgB;IACrC,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,CAAC,gBAAqB;EAC/C,CAAC;AAEH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,YAAY,iBAGrD"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const ADDON_ID = "sb-blackcat-addon";
|
|
4
|
+
exports.BLACKCAT_ADDON_ID = ADDON_ID;
|
|
5
|
+
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/constants.ts"],"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/constants.ts"],"sourcesContent":["export const ADDON_ID = 'sb-blackcat-addon' as const;\nexport const TOOL_ID = `${ADDON_ID}/tool` as const;\n"],"names":[],"mappings":";;AAAO,MAAM,WAAW;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export { ADDON_ID as BLACKCAT_ADDON_ID };
|
|
1
|
+
export { ADDON_ID as BLACKCAT_ADDON_ID } from './constants.js';
|
|
2
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,iBAAiB,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/constants.ts"],"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/constants.ts"],"sourcesContent":["export const ADDON_ID = 'sb-blackcat-addon' as const;\nexport const TOOL_ID = `${ADDON_ID}/tool` as const;\n"],"names":[],"mappings":"AAAO,MAAM,WAAW;"}
|