@shohojdhara/atomix 0.4.8 → 0.5.0
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/atomix.config.ts +58 -1
- package/dist/atomix.css +148 -120
- package/dist/atomix.css.map +1 -1
- package/dist/atomix.min.css +1 -1
- package/dist/atomix.min.css.map +1 -1
- package/dist/charts.d.ts +33 -0
- package/dist/charts.js +1227 -122
- package/dist/charts.js.map +1 -1
- package/dist/core.d.ts +33 -10
- package/dist/core.js +1052 -41
- package/dist/core.js.map +1 -1
- package/dist/forms.d.ts +33 -0
- package/dist/forms.js +2086 -1035
- package/dist/forms.js.map +1 -1
- package/dist/heavy.d.ts +42 -1
- package/dist/heavy.js +1620 -600
- package/dist/heavy.js.map +1 -1
- package/dist/index.d.ts +441 -270
- package/dist/index.esm.js +1900 -638
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1935 -670
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +6 -3
- package/scripts/atomix-cli.js +148 -4
- package/scripts/cli/__tests__/basic.test.js +3 -2
- package/scripts/cli/__tests__/clean.test.js +278 -0
- package/scripts/cli/__tests__/component-validator.test.js +433 -0
- package/scripts/cli/__tests__/generator.test.js +613 -0
- package/scripts/cli/__tests__/glass-motion.test.js +256 -0
- package/scripts/cli/__tests__/integration.test.js +719 -108
- package/scripts/cli/__tests__/migrate.test.js +74 -0
- package/scripts/cli/__tests__/security.test.js +206 -0
- package/scripts/cli/__tests__/test-setup.js +3 -1
- package/scripts/cli/__tests__/theme-bridge.test.js +507 -0
- package/scripts/cli/__tests__/token-provider.test.js +361 -0
- package/scripts/cli/__tests__/utils.test.js +5 -5
- package/scripts/cli/commands/benchmark.js +105 -0
- package/scripts/cli/commands/build-theme.js +4 -1
- package/scripts/cli/commands/clean.js +109 -0
- package/scripts/cli/commands/doctor.js +88 -0
- package/scripts/cli/commands/generate.js +135 -14
- package/scripts/cli/commands/init.js +45 -18
- package/scripts/cli/commands/migrate.js +106 -0
- package/scripts/cli/commands/sync-tokens.js +206 -0
- package/scripts/cli/commands/theme-bridge.js +248 -0
- package/scripts/cli/commands/tokens.js +157 -0
- package/scripts/cli/commands/validate.js +194 -0
- package/scripts/cli/internal/ai-engine.js +156 -0
- package/scripts/cli/internal/component-validator.js +443 -0
- package/scripts/cli/internal/config-loader.js +162 -0
- package/scripts/cli/internal/filesystem.js +102 -2
- package/scripts/cli/internal/generator.js +359 -39
- package/scripts/cli/internal/glass-generator.js +398 -0
- package/scripts/cli/internal/hook-generator.js +369 -0
- package/scripts/cli/internal/hooks.js +61 -0
- package/scripts/cli/internal/itcss-generator.js +565 -0
- package/scripts/cli/internal/motion-generator.js +679 -0
- package/scripts/cli/internal/template-engine.js +301 -0
- package/scripts/cli/internal/theme-bridge.js +664 -0
- package/scripts/cli/internal/tokens/engine.js +122 -0
- package/scripts/cli/internal/tokens/provider.js +34 -0
- package/scripts/cli/internal/tokens/providers/figma.js +50 -0
- package/scripts/cli/internal/tokens/providers/style-dictionary.js +48 -0
- package/scripts/cli/internal/tokens/providers/w3c.js +48 -0
- package/scripts/cli/internal/tokens/token-provider.js +443 -0
- package/scripts/cli/internal/tokens/token-validator.js +513 -0
- package/scripts/cli/internal/validator.js +276 -0
- package/scripts/cli/internal/wizard.js +60 -6
- package/scripts/cli/mappings.js +23 -0
- package/scripts/cli/migration-tools.js +164 -94
- package/scripts/cli/plugins/style-dictionary.js +46 -0
- package/scripts/cli/templates/README.md +525 -95
- package/scripts/cli/templates/common-templates.js +40 -14
- package/scripts/cli/templates/components/react-component.ts +282 -0
- package/scripts/cli/templates/config/project-config.ts +112 -0
- package/scripts/cli/templates/hooks/use-component.ts +477 -0
- package/scripts/cli/templates/index.js +19 -4
- package/scripts/cli/templates/index.ts +171 -0
- package/scripts/cli/templates/next-templates.js +72 -0
- package/scripts/cli/templates/react-templates.js +70 -126
- package/scripts/cli/templates/scss-templates.js +35 -35
- package/scripts/cli/templates/stories/storybook-story.ts +241 -0
- package/scripts/cli/templates/styles/scss-component.ts +255 -0
- package/scripts/cli/templates/tests/vitest-test.ts +229 -0
- package/scripts/cli/templates/token-templates.js +337 -1
- package/scripts/cli/templates/tokens/token-generators.ts +1088 -0
- package/scripts/cli/templates/types/component-types.ts +145 -0
- package/scripts/cli/templates/utils/testing-utils.ts +144 -0
- package/scripts/cli/templates/vanilla-templates.js +39 -0
- package/scripts/cli/token-manager.js +8 -2
- package/scripts/cli/utils/cache-manager.js +240 -0
- package/scripts/cli/utils/detector.js +46 -0
- package/scripts/cli/utils/diagnostics.js +289 -0
- package/scripts/cli/utils/error.js +45 -3
- package/scripts/cli/utils/helpers.js +24 -0
- package/scripts/cli/utils/logger.js +1 -1
- package/scripts/cli/utils/security.js +302 -0
- package/scripts/cli/utils/telemetry.js +115 -0
- package/scripts/cli/utils/validation.js +4 -38
- package/scripts/cli/utils.js +46 -0
- package/src/components/Accordion/Accordion.stories.tsx +0 -18
- package/src/components/Accordion/Accordion.test.tsx +0 -17
- package/src/components/Accordion/Accordion.tsx +0 -4
- package/src/components/AtomixGlass/AtomixGlass.tsx +102 -2
- package/src/components/AtomixGlass/AtomixGlassContainer.tsx +125 -12
- package/src/components/AtomixGlass/PerformanceDashboard.tsx +219 -0
- package/src/components/AtomixGlass/README.md +25 -10
- package/src/components/AtomixGlass/animation-system.ts +578 -0
- package/src/components/AtomixGlass/shader-utils.ts +3 -0
- package/src/components/AtomixGlass/stories/AnimationFeatures.stories.tsx +653 -0
- package/src/components/AtomixGlass/stories/AnimationTests.stories.tsx +95 -0
- package/src/components/AtomixGlass/stories/CardExamples.stories.tsx +212 -0
- package/src/components/AtomixGlass/stories/DashboardExamples.stories.tsx +348 -0
- package/src/components/AtomixGlass/stories/EcommerceExamples.stories.tsx +410 -0
- package/src/components/AtomixGlass/stories/FormExamples.stories.tsx +436 -0
- package/src/components/AtomixGlass/stories/HeroExamples.stories.tsx +264 -0
- package/src/components/AtomixGlass/stories/InteractivePlayground.stories.tsx +247 -0
- package/src/components/AtomixGlass/stories/MobileUIExamples.stories.tsx +418 -0
- package/src/components/AtomixGlass/stories/ModalExamples.stories.tsx +402 -0
- package/src/components/AtomixGlass/stories/Overview.stories.tsx +157 -6
- package/src/components/AtomixGlass/stories/Playground.stories.tsx +658 -93
- package/src/components/AtomixGlass/stories/PresetGallery.stories.tsx +335 -0
- package/src/components/AtomixGlass/stories/WidgetExamples.stories.tsx +441 -0
- package/src/components/AtomixGlass/stories/argTypes.ts +384 -0
- package/src/components/AtomixGlass/stories/shared-components.tsx +91 -1
- package/src/components/AtomixGlass/stories/types.ts +127 -0
- package/src/components/Avatar/Avatar.tsx +1 -1
- package/src/components/Button/Button.stories.disabled-link.tsx +10 -0
- package/src/components/Button/Button.stories.tsx +10 -0
- package/src/components/Button/Button.test.tsx +16 -11
- package/src/components/Button/Button.tsx +4 -4
- package/src/components/Card/Card.tsx +1 -1
- package/src/components/Dropdown/Dropdown.tsx +12 -12
- package/src/components/Form/Select.tsx +62 -3
- package/src/components/Modal/Modal.tsx +14 -3
- package/src/components/Navigation/Navbar/Navbar.tsx +44 -0
- package/src/components/Slider/Slider.stories.tsx +3 -3
- package/src/components/Slider/Slider.tsx +38 -0
- package/src/components/Steps/Steps.tsx +3 -3
- package/src/components/Tabs/Tabs.tsx +77 -8
- package/src/components/Testimonial/Testimonial.tsx +1 -1
- package/src/components/TypedButton/TypedButton.stories.tsx +59 -0
- package/src/components/TypedButton/TypedButton.tsx +39 -0
- package/src/components/TypedButton/index.ts +2 -0
- package/src/components/VideoPlayer/VideoPlayer.tsx +11 -4
- package/src/lib/composables/index.ts +4 -7
- package/src/lib/composables/types.ts +45 -0
- package/src/lib/composables/useAccordion.ts +0 -7
- package/src/lib/composables/useAtomixGlass.ts +144 -5
- package/src/lib/composables/useChartExport.ts +3 -13
- package/src/lib/composables/useDropdown.ts +66 -0
- package/src/lib/composables/useFocusTrap.ts +80 -0
- package/src/lib/composables/usePerformanceMonitor.ts +448 -0
- package/src/lib/composables/useResponsiveGlass.presets.ts +192 -0
- package/src/lib/composables/useResponsiveGlass.ts +441 -0
- package/src/lib/composables/useTooltip.ts +16 -0
- package/src/lib/composables/useTypedButton.ts +66 -0
- package/src/lib/config/index.ts +62 -5
- package/src/lib/constants/components.ts +55 -0
- package/src/lib/theme/devtools/__tests__/useHistory.test.tsx +150 -0
- package/src/lib/theme/tokens/centralized-tokens.ts +120 -0
- package/src/lib/theme/utils/__tests__/domUtils.test.ts +101 -0
- package/src/lib/types/components.ts +37 -11
- package/src/lib/types/glass.ts +35 -0
- package/src/lib/types/index.ts +1 -0
- package/src/lib/utils/displacement-generator.ts +1 -1
- package/src/styles/01-settings/_settings.testtypecheck.scss +53 -0
- package/src/styles/01-settings/_settings.typedbutton.scss +53 -0
- package/src/styles/06-components/_components.testbutton.scss +212 -0
- package/src/styles/06-components/_components.testtypecheck.scss +212 -0
- package/src/styles/06-components/_components.typedbutton.scss +212 -0
- package/src/styles/99-utilities/_index.scss +1 -0
- package/src/styles/99-utilities/_utilities.text.scss +1 -1
- package/src/styles/99-utilities/_utilities.touch-target.scss +36 -0
- package/src/styles/06-components/old.chart.styles.scss +0 -2788
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* argTypes.ts
|
|
3
|
+
*
|
|
4
|
+
* Shared argType definitions for AtomixGlass Storybook stories.
|
|
5
|
+
* Provides consistent control configurations across all story files.
|
|
6
|
+
*
|
|
7
|
+
* @package Atomix
|
|
8
|
+
* @component AtomixGlass
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type { ArgTypeDefinition, ArgTypeCategory } from './types';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Base argTypes that are common to all AtomixGlass stories
|
|
15
|
+
*/
|
|
16
|
+
export const baseArgTypes = {
|
|
17
|
+
// Content category
|
|
18
|
+
children: {
|
|
19
|
+
control: 'text',
|
|
20
|
+
description: 'Content to display inside the glass effect',
|
|
21
|
+
table: {
|
|
22
|
+
category: 'Content' as ArgTypeCategory,
|
|
23
|
+
defaultValue: { summary: '-' },
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
// Visual category
|
|
28
|
+
displacementScale: {
|
|
29
|
+
control: { type: 'range', min: 0, max: 100, step: 1 },
|
|
30
|
+
description: 'Displacement scale for the glass effect (default: 70)',
|
|
31
|
+
table: {
|
|
32
|
+
category: 'Visual' as ArgTypeCategory,
|
|
33
|
+
defaultValue: { summary: '70' },
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
blurAmount: {
|
|
37
|
+
control: { type: 'range', min: 0, max: 10, step: 0.5 },
|
|
38
|
+
description: 'Blur amount for the backdrop (default: 0.0625)',
|
|
39
|
+
table: {
|
|
40
|
+
category: 'Visual' as ArgTypeCategory,
|
|
41
|
+
defaultValue: { summary: '0.0625' },
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
saturation: {
|
|
45
|
+
control: { type: 'range', min: 100, max: 300, step: 5 },
|
|
46
|
+
description: 'Saturation percentage for the backdrop (default: 140)',
|
|
47
|
+
table: {
|
|
48
|
+
category: 'Visual' as ArgTypeCategory,
|
|
49
|
+
defaultValue: { summary: '140' },
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
aberrationIntensity: {
|
|
53
|
+
control: { type: 'range', min: 0, max: 10, step: 0.1 },
|
|
54
|
+
description: 'Chromatic aberration intensity (default: 2)',
|
|
55
|
+
table: {
|
|
56
|
+
category: 'Visual' as ArgTypeCategory,
|
|
57
|
+
defaultValue: { summary: '2' },
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
elasticity: {
|
|
61
|
+
control: { type: 'range', min: 0, max: 1, step: 0.01 },
|
|
62
|
+
description: 'Elasticity factor for mouse interactions (default: 0.15)',
|
|
63
|
+
table: {
|
|
64
|
+
category: 'Visual' as ArgTypeCategory,
|
|
65
|
+
defaultValue: { summary: '0.15' },
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
borderRadius: {
|
|
69
|
+
control: { type: 'range', min: 0, max: 50, step: 1 },
|
|
70
|
+
description: 'Corner radius in pixels (default: 20)',
|
|
71
|
+
table: {
|
|
72
|
+
category: 'Visual' as ArgTypeCategory,
|
|
73
|
+
defaultValue: { summary: '20' },
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
overLight: {
|
|
77
|
+
control: {
|
|
78
|
+
type: 'select',
|
|
79
|
+
labels: {
|
|
80
|
+
false: 'false (Dark Background)',
|
|
81
|
+
true: 'true (Light Background)',
|
|
82
|
+
auto: 'auto (Auto-detect)',
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
options: [false, true, 'auto'],
|
|
86
|
+
description: 'OverLight configuration mode',
|
|
87
|
+
table: {
|
|
88
|
+
category: 'Visual' as ArgTypeCategory,
|
|
89
|
+
defaultValue: { summary: '"auto"' },
|
|
90
|
+
type: { summary: 'boolean | "auto"' },
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
mode: {
|
|
94
|
+
control: { type: 'inline-radio', options: ['standard', 'polar', 'prominent', 'shader'] },
|
|
95
|
+
description: 'Glass effect mode (default: "standard")',
|
|
96
|
+
table: {
|
|
97
|
+
category: 'Visual' as ArgTypeCategory,
|
|
98
|
+
defaultValue: { summary: '"standard"' },
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
// Style category
|
|
103
|
+
padding: {
|
|
104
|
+
control: { type: 'text' },
|
|
105
|
+
description: 'Padding for the glass component',
|
|
106
|
+
table: {
|
|
107
|
+
category: 'Style' as ArgTypeCategory,
|
|
108
|
+
defaultValue: { summary: '0' },
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
height: {
|
|
112
|
+
control: { type: 'text' },
|
|
113
|
+
description: 'Height of the glass component',
|
|
114
|
+
table: {
|
|
115
|
+
category: 'Style' as ArgTypeCategory,
|
|
116
|
+
defaultValue: { summary: 'undefined' },
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
width: {
|
|
120
|
+
control: { type: 'text' },
|
|
121
|
+
description: 'Width of the glass component',
|
|
122
|
+
table: {
|
|
123
|
+
category: 'Style' as ArgTypeCategory,
|
|
124
|
+
defaultValue: { summary: 'undefined' },
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
className: {
|
|
128
|
+
control: 'text',
|
|
129
|
+
description: 'Additional CSS class names',
|
|
130
|
+
table: {
|
|
131
|
+
category: 'Style' as ArgTypeCategory,
|
|
132
|
+
defaultValue: { summary: '-' },
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
style: {
|
|
136
|
+
control: 'object',
|
|
137
|
+
description: 'CSS style object',
|
|
138
|
+
table: {
|
|
139
|
+
category: 'Style' as ArgTypeCategory,
|
|
140
|
+
defaultValue: { summary: '{}' },
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
|
|
144
|
+
// Interaction category
|
|
145
|
+
onClick: {
|
|
146
|
+
action: 'clicked',
|
|
147
|
+
description: 'Click event handler',
|
|
148
|
+
table: {
|
|
149
|
+
category: 'Interaction' as ArgTypeCategory,
|
|
150
|
+
defaultValue: { summary: '-' },
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
|
|
154
|
+
// Performance category
|
|
155
|
+
devicePreset: {
|
|
156
|
+
control: { type: 'inline-radio', options: ['performance', 'balanced', 'quality'] },
|
|
157
|
+
description: 'Device preset for responsive optimization (default: "balanced")',
|
|
158
|
+
table: {
|
|
159
|
+
category: 'Performance' as ArgTypeCategory,
|
|
160
|
+
defaultValue: { summary: '"balanced"' },
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
disableResponsiveBreakpoints: {
|
|
164
|
+
control: 'boolean',
|
|
165
|
+
description: 'Disable responsive breakpoint system (default: false)',
|
|
166
|
+
table: {
|
|
167
|
+
category: 'Performance' as ArgTypeCategory,
|
|
168
|
+
defaultValue: { summary: 'false' },
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
|
|
172
|
+
// Animation category (Phase 1)
|
|
173
|
+
withTimeAnimation: {
|
|
174
|
+
control: 'boolean',
|
|
175
|
+
description: 'Enable time-based animation (Phase 1, default: true)',
|
|
176
|
+
table: {
|
|
177
|
+
category: 'Animation' as ArgTypeCategory,
|
|
178
|
+
defaultValue: { summary: 'true' },
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
animationSpeed: {
|
|
182
|
+
control: { type: 'range', min: 0, max: 3, step: 0.1 },
|
|
183
|
+
description: 'Animation speed multiplier (Phase 1, default: 1.0)',
|
|
184
|
+
table: {
|
|
185
|
+
category: 'Animation' as ArgTypeCategory,
|
|
186
|
+
defaultValue: { summary: '1.0' },
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
withMultiLayerDistortion: {
|
|
190
|
+
control: 'boolean',
|
|
191
|
+
description: 'Enable multi-layer distortion using FBM (Phase 1, default: false)',
|
|
192
|
+
table: {
|
|
193
|
+
category: 'Animation' as ArgTypeCategory,
|
|
194
|
+
defaultValue: { summary: 'false' },
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
distortionOctaves: {
|
|
198
|
+
control: { type: 'range', min: 1, max: 8, step: 1 },
|
|
199
|
+
description: 'Number of octaves for FBM distortion (Phase 1, default: 5)',
|
|
200
|
+
table: {
|
|
201
|
+
category: 'Animation' as ArgTypeCategory,
|
|
202
|
+
defaultValue: { summary: '5' },
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
distortionLacunarity: {
|
|
206
|
+
control: { type: 'range', min: 1, max: 4, step: 0.1 },
|
|
207
|
+
description: 'Lacunarity for FBM distortion (Phase 1, default: 2.0)',
|
|
208
|
+
table: {
|
|
209
|
+
category: 'Animation' as ArgTypeCategory,
|
|
210
|
+
defaultValue: { summary: '2.0' },
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
distortionGain: {
|
|
214
|
+
control: { type: 'range', min: 0.1, max: 1, step: 0.1 },
|
|
215
|
+
description: 'Gain for FBM distortion (Phase 1, default: 0.5)',
|
|
216
|
+
table: {
|
|
217
|
+
category: 'Animation' as ArgTypeCategory,
|
|
218
|
+
defaultValue: { summary: '0.5' },
|
|
219
|
+
},
|
|
220
|
+
},
|
|
221
|
+
distortionQuality: {
|
|
222
|
+
control: { type: 'select', options: ['low', 'medium', 'high', 'ultra'] },
|
|
223
|
+
description: 'Quality preset for FBM distortion (Phase 1, default: "high")',
|
|
224
|
+
table: {
|
|
225
|
+
category: 'Animation' as ArgTypeCategory,
|
|
226
|
+
defaultValue: { summary: '"high"' },
|
|
227
|
+
},
|
|
228
|
+
},
|
|
229
|
+
|
|
230
|
+
// Debug category
|
|
231
|
+
debugPerformance: {
|
|
232
|
+
control: 'boolean',
|
|
233
|
+
description: 'Enable performance monitoring dashboard (development only)',
|
|
234
|
+
table: {
|
|
235
|
+
category: 'Debug' as ArgTypeCategory,
|
|
236
|
+
defaultValue: { summary: 'false' },
|
|
237
|
+
},
|
|
238
|
+
},
|
|
239
|
+
debugBorderRadius: {
|
|
240
|
+
control: 'boolean',
|
|
241
|
+
description: 'Debug mode for corner radius extraction',
|
|
242
|
+
table: {
|
|
243
|
+
category: 'Debug' as ArgTypeCategory,
|
|
244
|
+
defaultValue: { summary: 'false' },
|
|
245
|
+
},
|
|
246
|
+
},
|
|
247
|
+
|
|
248
|
+
// Accessibility category
|
|
249
|
+
'aria-label': {
|
|
250
|
+
control: 'text',
|
|
251
|
+
description: 'ARIA label for accessibility',
|
|
252
|
+
table: {
|
|
253
|
+
category: 'Accessibility' as ArgTypeCategory,
|
|
254
|
+
defaultValue: { summary: '-' },
|
|
255
|
+
},
|
|
256
|
+
},
|
|
257
|
+
'aria-describedby': {
|
|
258
|
+
control: 'text',
|
|
259
|
+
description: 'ARIA describedby attribute for additional description',
|
|
260
|
+
table: {
|
|
261
|
+
category: 'Accessibility' as ArgTypeCategory,
|
|
262
|
+
defaultValue: { summary: '-' },
|
|
263
|
+
},
|
|
264
|
+
},
|
|
265
|
+
role: {
|
|
266
|
+
control: 'text',
|
|
267
|
+
description: 'ARIA role attribute',
|
|
268
|
+
table: {
|
|
269
|
+
category: 'Accessibility' as ArgTypeCategory,
|
|
270
|
+
defaultValue: { summary: 'undefined' },
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
|
+
tabIndex: {
|
|
274
|
+
control: 'number',
|
|
275
|
+
description: 'Tab index for keyboard navigation',
|
|
276
|
+
table: {
|
|
277
|
+
category: 'Accessibility' as ArgTypeCategory,
|
|
278
|
+
defaultValue: { summary: '0' },
|
|
279
|
+
},
|
|
280
|
+
},
|
|
281
|
+
reducedMotion: {
|
|
282
|
+
control: 'boolean',
|
|
283
|
+
description: 'Override for reduced motion preference (default: false)',
|
|
284
|
+
table: {
|
|
285
|
+
category: 'Accessibility' as ArgTypeCategory,
|
|
286
|
+
defaultValue: { summary: 'false' },
|
|
287
|
+
},
|
|
288
|
+
},
|
|
289
|
+
highContrast: {
|
|
290
|
+
control: 'boolean',
|
|
291
|
+
description: 'Override for high contrast preference (default: false)',
|
|
292
|
+
table: {
|
|
293
|
+
category: 'Accessibility' as ArgTypeCategory,
|
|
294
|
+
defaultValue: { summary: 'false' },
|
|
295
|
+
},
|
|
296
|
+
},
|
|
297
|
+
withoutEffects: {
|
|
298
|
+
control: 'boolean',
|
|
299
|
+
description: 'Disable all visual effects (default: false)',
|
|
300
|
+
table: {
|
|
301
|
+
category: 'Accessibility' as ArgTypeCategory,
|
|
302
|
+
defaultValue: { summary: 'false' },
|
|
303
|
+
},
|
|
304
|
+
},
|
|
305
|
+
} satisfies Record<string, ArgTypeDefinition>;
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Minimal argTypes for simple stories (excludes advanced features)
|
|
309
|
+
*/
|
|
310
|
+
export const minimalArgTypes = {
|
|
311
|
+
children: baseArgTypes.children,
|
|
312
|
+
displacementScale: baseArgTypes.displacementScale,
|
|
313
|
+
blurAmount: baseArgTypes.blurAmount,
|
|
314
|
+
saturation: baseArgTypes.saturation,
|
|
315
|
+
aberrationIntensity: baseArgTypes.aberrationIntensity,
|
|
316
|
+
borderRadius: baseArgTypes.borderRadius,
|
|
317
|
+
mode: baseArgTypes.mode,
|
|
318
|
+
padding: baseArgTypes.padding,
|
|
319
|
+
className: baseArgTypes.className,
|
|
320
|
+
onClick: baseArgTypes.onClick,
|
|
321
|
+
} satisfies Record<string, ArgTypeDefinition>;
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Advanced argTypes for playground and testing stories (includes all features)
|
|
325
|
+
*/
|
|
326
|
+
export const advancedArgTypes = {
|
|
327
|
+
...baseArgTypes,
|
|
328
|
+
globalMousePosition: {
|
|
329
|
+
control: 'object',
|
|
330
|
+
description: 'External global mouse position { x: number; y: number }',
|
|
331
|
+
table: {
|
|
332
|
+
category: 'Interaction' as ArgTypeCategory,
|
|
333
|
+
defaultValue: { summary: 'undefined' },
|
|
334
|
+
},
|
|
335
|
+
},
|
|
336
|
+
mouseOffset: {
|
|
337
|
+
control: 'object',
|
|
338
|
+
description: 'External mouse offset { x: number; y: number }',
|
|
339
|
+
table: {
|
|
340
|
+
category: 'Interaction' as ArgTypeCategory,
|
|
341
|
+
defaultValue: { summary: 'undefined' },
|
|
342
|
+
},
|
|
343
|
+
},
|
|
344
|
+
mouseContainer: {
|
|
345
|
+
control: false,
|
|
346
|
+
description: 'React ref object for mouse container element',
|
|
347
|
+
table: {
|
|
348
|
+
category: 'Interaction' as ArgTypeCategory,
|
|
349
|
+
defaultValue: { summary: 'undefined' },
|
|
350
|
+
},
|
|
351
|
+
},
|
|
352
|
+
} satisfies Record<string, ArgTypeDefinition>;
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Helper function to pick specific argType categories
|
|
356
|
+
*/
|
|
357
|
+
export function pickArgTypeCategories<T extends Record<string, ArgTypeDefinition>>(
|
|
358
|
+
argTypes: T,
|
|
359
|
+
categories: ArgTypeCategory[]
|
|
360
|
+
): Partial<T> {
|
|
361
|
+
const result: Partial<T> = {};
|
|
362
|
+
Object.entries(argTypes).forEach(([key, value]) => {
|
|
363
|
+
if (value.table?.category && categories.includes(value.table.category)) {
|
|
364
|
+
result[key as keyof T] = value;
|
|
365
|
+
}
|
|
366
|
+
});
|
|
367
|
+
return result;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* Helper function to exclude specific argType categories
|
|
372
|
+
*/
|
|
373
|
+
export function excludeArgTypeCategories<T extends Record<string, ArgTypeDefinition>>(
|
|
374
|
+
argTypes: T,
|
|
375
|
+
categories: ArgTypeCategory[]
|
|
376
|
+
): Partial<T> {
|
|
377
|
+
const result: Partial<T> = {};
|
|
378
|
+
Object.entries(argTypes).forEach(([key, value]) => {
|
|
379
|
+
if (value.table?.category && !categories.includes(value.table.category)) {
|
|
380
|
+
result[key as keyof T] = value;
|
|
381
|
+
}
|
|
382
|
+
});
|
|
383
|
+
return result;
|
|
384
|
+
}
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import React, { useState, useEffect, useCallback, useRef } from 'react';
|
|
13
|
-
import type { RefObject } from 'react';
|
|
13
|
+
import type { RefObject, ErrorInfo } from 'react';
|
|
14
|
+
import type { StoryErrorBoundaryProps } from './types';
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* Enhanced BackgroundWrapper Component
|
|
@@ -97,6 +98,9 @@ export const BackgroundWrapper: React.FC<BackgroundWrapperProps> = ({
|
|
|
97
98
|
backgroundColor: overlayColor,
|
|
98
99
|
opacity: overlayOpacity,
|
|
99
100
|
padding,
|
|
101
|
+
objectPosition: 'center',
|
|
102
|
+
objectFit: 'cover',
|
|
103
|
+
backgroundPosition: 'fixed'
|
|
100
104
|
}}
|
|
101
105
|
/>
|
|
102
106
|
)}
|
|
@@ -193,8 +197,94 @@ export const StoryContainer: React.FC<StoryContainerProps> = ({
|
|
|
193
197
|
* Collection of high-quality background images for different moods and scenarios
|
|
194
198
|
*/
|
|
195
199
|
export const backgroundImages = [
|
|
200
|
+
'https://images.unsplash.com/photo-1773609108583-4f0040c75e7f?q=80&w=2532&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D',
|
|
201
|
+
'https://images.unsplash.com/photo-1593433073755-4233a78ee359?q=80&w=987&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D',
|
|
196
202
|
'https://images.unsplash.com/photo-1637825891028-564f672aa42c?ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&q=80&w=2670',
|
|
203
|
+
'https://images.unsplash.com/photo-1773062278803-0643c4782445?q=80&w=2070&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D',
|
|
197
204
|
'https://images.unsplash.com/photo-1506905925346-21bda4d32df4?q=80&w=2940&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D',
|
|
198
205
|
'https://images.unsplash.com/photo-1519681393784-d120267933ba?ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&q=80&w=2670',
|
|
199
206
|
'https://images.unsplash.com/photo-1441974231531-c6227db76b6e?q=80&w=2940&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D',
|
|
200
207
|
];
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* StoryErrorBoundary Component
|
|
211
|
+
*
|
|
212
|
+
* Error boundary wrapper for stories to gracefully handle rendering errors.
|
|
213
|
+
* Provides a fallback UI and error logging for better developer experience.
|
|
214
|
+
*/
|
|
215
|
+
export class StoryErrorBoundary extends React.Component<
|
|
216
|
+
StoryErrorBoundaryProps,
|
|
217
|
+
{ hasError: boolean; error?: Error }
|
|
218
|
+
> {
|
|
219
|
+
constructor(props: StoryErrorBoundaryProps) {
|
|
220
|
+
super(props);
|
|
221
|
+
this.state = { hasError: false };
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
static getDerivedStateFromError(error: Error) {
|
|
225
|
+
return { hasError: true, error };
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
componentDidCatch(error: Error, errorInfo: React.ErrorInfo) {
|
|
229
|
+
console.error('Story rendering error:', error, errorInfo);
|
|
230
|
+
if (this.props.onError) {
|
|
231
|
+
this.props.onError(error, errorInfo);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
render() {
|
|
236
|
+
if (this.state.hasError) {
|
|
237
|
+
if (this.props.fallback) {
|
|
238
|
+
return this.props.fallback;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
return (
|
|
242
|
+
<div
|
|
243
|
+
className="u-flex u-items-center u-justify-center u-p-5"
|
|
244
|
+
style={{
|
|
245
|
+
minHeight: '400px',
|
|
246
|
+
backgroundColor: 'rgba(239, 68, 68, 0.1)',
|
|
247
|
+
borderRadius: '12px',
|
|
248
|
+
border: '2px solid rgba(239, 68, 68, 0.3)',
|
|
249
|
+
}}
|
|
250
|
+
>
|
|
251
|
+
<div className="u-text-center">
|
|
252
|
+
<h3
|
|
253
|
+
className="u-mb-2 u-text-xl u-font-bold"
|
|
254
|
+
style={{ color: '#dc2626' }}
|
|
255
|
+
>
|
|
256
|
+
Story Rendering Error
|
|
257
|
+
</h3>
|
|
258
|
+
<p className="u-mb-4 u-text-sm" style={{ color: '#7f1d1d' }}>
|
|
259
|
+
{this.state.error?.message || 'An unexpected error occurred'}
|
|
260
|
+
</p>
|
|
261
|
+
<button
|
|
262
|
+
onClick={() => this.setState({ hasError: false })}
|
|
263
|
+
className="u-px-4 u-py-2 u-bg-red-600 u-text-white u-rounded u-cursor-pointer u-border-none u-transition-color u-hover-bg-red-700"
|
|
264
|
+
>
|
|
265
|
+
Try Again
|
|
266
|
+
</button>
|
|
267
|
+
</div>
|
|
268
|
+
</div>
|
|
269
|
+
);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
return this.props.children;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* FallbackBackground Component
|
|
278
|
+
*
|
|
279
|
+
* Provides a gradient fallback when background images fail to load.
|
|
280
|
+
* Used as a safety net for broken external image URLs.
|
|
281
|
+
*/
|
|
282
|
+
export const FallbackBackground: React.FC<{ className?: string }> = ({ className = '' }) => (
|
|
283
|
+
<div
|
|
284
|
+
className={`u-absolute u-inset-0 ${className}`}
|
|
285
|
+
style={{
|
|
286
|
+
background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
|
|
287
|
+
zIndex: -1,
|
|
288
|
+
}}
|
|
289
|
+
/>
|
|
290
|
+
);
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* types.ts
|
|
3
|
+
*
|
|
4
|
+
* Shared type definitions for AtomixGlass Storybook stories.
|
|
5
|
+
* Provides consistent TypeScript types across all story files.
|
|
6
|
+
*
|
|
7
|
+
* @package Atomix
|
|
8
|
+
* @component AtomixGlass
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type { StoryObj, Meta } from '@storybook/react';
|
|
12
|
+
import type { ComponentType, ReactNode } from 'react';
|
|
13
|
+
import type AtomixGlass from '../AtomixGlass';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Type helper for story props without children requirement
|
|
17
|
+
* Used to create flexible story configurations
|
|
18
|
+
*/
|
|
19
|
+
export type AtomixGlassStoryProps = Omit<React.ComponentProps<typeof AtomixGlass>, 'children'> & {
|
|
20
|
+
children?: ReactNode;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Story configuration object for reusable story setups
|
|
25
|
+
*/
|
|
26
|
+
export interface StoryConfig {
|
|
27
|
+
/** Story title/description */
|
|
28
|
+
description?: string;
|
|
29
|
+
/** Layout mode: centered, fullscreen, or padded */
|
|
30
|
+
layout?: 'centered' | 'fullscreen' | 'padded';
|
|
31
|
+
/** Background image URL or index */
|
|
32
|
+
backgroundImage?: string;
|
|
33
|
+
/** Enable overlay */
|
|
34
|
+
overlay?: boolean;
|
|
35
|
+
/** Overlay opacity (0-1) */
|
|
36
|
+
overlayOpacity?: number;
|
|
37
|
+
/** Custom CSS class names */
|
|
38
|
+
className?: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* ArgType category definitions for organized controls panel
|
|
43
|
+
*/
|
|
44
|
+
export type ArgTypeCategory =
|
|
45
|
+
| 'Content'
|
|
46
|
+
| 'Visual'
|
|
47
|
+
| 'Interaction'
|
|
48
|
+
| 'Style'
|
|
49
|
+
| 'Performance'
|
|
50
|
+
| 'Animation'
|
|
51
|
+
| 'Debug'
|
|
52
|
+
| 'Accessibility'
|
|
53
|
+
| 'Events';
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Enhanced argType definition with category support
|
|
57
|
+
*/
|
|
58
|
+
export interface ArgTypeDefinition {
|
|
59
|
+
control: Record<string, unknown>;
|
|
60
|
+
description: string;
|
|
61
|
+
table: {
|
|
62
|
+
category?: ArgTypeCategory;
|
|
63
|
+
defaultValue?: { summary: string };
|
|
64
|
+
type?: { summary: string };
|
|
65
|
+
};
|
|
66
|
+
options?: string[];
|
|
67
|
+
action?: string;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Background image item for story wrappers
|
|
72
|
+
*/
|
|
73
|
+
export interface BackgroundImageItem {
|
|
74
|
+
url: string;
|
|
75
|
+
label: string;
|
|
76
|
+
tag: 'dark' | 'colorful' | 'light' | 'nature' | 'abstract';
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Error boundary props for story error handling
|
|
81
|
+
*/
|
|
82
|
+
export interface StoryErrorBoundaryProps {
|
|
83
|
+
children: ReactNode;
|
|
84
|
+
fallback?: ReactNode;
|
|
85
|
+
onError?: (error: Error, errorInfo: React.ErrorInfo) => void;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Preset configuration for quick story setup
|
|
90
|
+
*/
|
|
91
|
+
export interface GlassPreset {
|
|
92
|
+
name: string;
|
|
93
|
+
description: string;
|
|
94
|
+
args: Partial<AtomixGlassStoryProps>;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Performance metrics for monitoring story rendering
|
|
99
|
+
*/
|
|
100
|
+
export interface PerformanceMetrics {
|
|
101
|
+
renderTime: number;
|
|
102
|
+
fps?: number;
|
|
103
|
+
memoryUsage?: number;
|
|
104
|
+
timestamp: number;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Story decorator function type
|
|
109
|
+
*/
|
|
110
|
+
export type StoryDecorator<T = unknown> = (
|
|
111
|
+
Story: ComponentType,
|
|
112
|
+
context: { args?: T; globals?: Record<string, unknown> }
|
|
113
|
+
) => ReactNode;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Helper type for creating typed story objects
|
|
117
|
+
*/
|
|
118
|
+
export type TypedStory<T extends ComponentType = typeof AtomixGlass> = StoryObj<Meta<T>>;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Validation result for story configurations
|
|
122
|
+
*/
|
|
123
|
+
export interface StoryValidationResult {
|
|
124
|
+
isValid: boolean;
|
|
125
|
+
errors: string[];
|
|
126
|
+
warnings: string[];
|
|
127
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Button } from './Button';
|
|
2
|
+
|
|
3
|
+
export const DisabledLinkExample = {
|
|
4
|
+
render: () => (
|
|
5
|
+
<div style={{ padding: '20px', display: 'flex', gap: '10px' }}>
|
|
6
|
+
<Button href="/home" disabled>Disabled Link Button</Button>
|
|
7
|
+
<Button href="/home">Normal Link Button</Button>
|
|
8
|
+
</div>
|
|
9
|
+
),
|
|
10
|
+
};
|
|
@@ -406,6 +406,16 @@ export const DisabledState: Story = {
|
|
|
406
406
|
},
|
|
407
407
|
};
|
|
408
408
|
|
|
409
|
+
export const DisabledLinkState: Story = {
|
|
410
|
+
args: {
|
|
411
|
+
label: 'Disabled Link Button',
|
|
412
|
+
variant: 'primary',
|
|
413
|
+
size: 'md',
|
|
414
|
+
disabled: true,
|
|
415
|
+
href: '/home',
|
|
416
|
+
},
|
|
417
|
+
};
|
|
418
|
+
|
|
409
419
|
/**
|
|
410
420
|
* Shows button in active state
|
|
411
421
|
*/
|
|
@@ -75,22 +75,27 @@ describe('Button Component', () => {
|
|
|
75
75
|
});
|
|
76
76
|
|
|
77
77
|
it('renders as disabled link when disabled and href provided', () => {
|
|
78
|
-
// Current implementation might be buggy here, let's see
|
|
79
78
|
render(
|
|
80
79
|
<Button href="/home" disabled>
|
|
81
80
|
Home
|
|
82
81
|
</Button>
|
|
83
82
|
);
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
//
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
83
|
+
|
|
84
|
+
// An anchor tag without an href attribute is not considered a 'link' role.
|
|
85
|
+
// It's considered a generic text element, but in our component it has role='link' implicitly? No.
|
|
86
|
+
// Actually, an anchor without href is generic. But it might have button styles.
|
|
87
|
+
// Let's get it by text and assert it's an anchor without href.
|
|
88
|
+
const element = screen.getByText('Home').closest('a');
|
|
89
|
+
expect(element).toBeInTheDocument();
|
|
90
|
+
|
|
91
|
+
// It shouldn't have an href attribute because it's disabled.
|
|
92
|
+
expect(element).not.toHaveAttribute('href');
|
|
93
|
+
|
|
94
|
+
// It should have aria-disabled true
|
|
95
|
+
expect(element).toHaveAttribute('aria-disabled', 'true');
|
|
96
|
+
|
|
97
|
+
// It should have disabled class
|
|
98
|
+
expect(element).toHaveClass('c-btn--disabled');
|
|
94
99
|
});
|
|
95
100
|
|
|
96
101
|
it('forwards ref', () => {
|