@shohojdhara/atomix 0.4.8 → 0.4.9
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 +4 -1
- package/src/components/AtomixGlass/stories/Overview.stories.tsx +157 -6
- package/src/components/AtomixGlass/stories/Phase1-Animation.stories.tsx +653 -0
- package/src/components/AtomixGlass/stories/Phase1-Test.stories.tsx +95 -0
- package/src/components/AtomixGlass/stories/Playground.stories.tsx +51 -51
- package/src/components/AtomixGlass/stories/shared-components.tsx +6 -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,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Next.js Component Templates
|
|
3
|
+
* Optimized for Server Components and App Router
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export const nextTemplates = {
|
|
7
|
+
/**
|
|
8
|
+
* Simple Server Component
|
|
9
|
+
*/
|
|
10
|
+
simple: (name) => `/**
|
|
11
|
+
* ${name} Component (Server Component)
|
|
12
|
+
*/
|
|
13
|
+
import React from 'react';
|
|
14
|
+
|
|
15
|
+
export default function ${name}() {
|
|
16
|
+
return (
|
|
17
|
+
<div className="${name.toLowerCase()}">
|
|
18
|
+
<h1>${name} Component</h1>
|
|
19
|
+
</div>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
`,
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Client Component
|
|
26
|
+
*/
|
|
27
|
+
client: (name) => `'use client';
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* ${name} Component (Client Component)
|
|
31
|
+
*/
|
|
32
|
+
import React, { useState } from 'react';
|
|
33
|
+
|
|
34
|
+
export default function ${name}() {
|
|
35
|
+
const [active, setActive] = useState(false);
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<div className="${name.toLowerCase()}">
|
|
39
|
+
<h1>${name} Component</h1>
|
|
40
|
+
<button onClick={() => setActive(!active)}>
|
|
41
|
+
Toggle: {active ? 'On' : 'Off'}
|
|
42
|
+
</button>
|
|
43
|
+
</div>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
`,
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Complex Server Component with async data
|
|
50
|
+
*/
|
|
51
|
+
complex: (name) => `/**
|
|
52
|
+
* ${name} Component (Server Component with Data)
|
|
53
|
+
*/
|
|
54
|
+
import React from 'react';
|
|
55
|
+
|
|
56
|
+
async function getData() {
|
|
57
|
+
// Simulating data fetch
|
|
58
|
+
return { title: '${name}' };
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export default async function ${name}() {
|
|
62
|
+
const data = await getData();
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<div className="${name.toLowerCase()}">
|
|
66
|
+
<h1>{data.title}</h1>
|
|
67
|
+
<p>This is a complex Next.js server component.</p>
|
|
68
|
+
</div>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
`
|
|
72
|
+
};
|
|
@@ -146,20 +146,26 @@ export default ${name};`;
|
|
|
146
146
|
* Simple component template
|
|
147
147
|
*/
|
|
148
148
|
export const simpleTemplate = (name) => `import React, { forwardRef } from 'react';
|
|
149
|
-
import
|
|
149
|
+
import { AtomixGlass } from '../AtomixGlass/AtomixGlass';
|
|
150
|
+
import type { ${name}Props } from '../../lib/types/components';
|
|
150
151
|
|
|
151
152
|
/**
|
|
152
153
|
* ${name} - Simple Presentational Component
|
|
153
154
|
*
|
|
154
|
-
*
|
|
155
|
+
* @param {${name}Props} props - Component properties
|
|
156
|
+
* @returns {JSX.Element} The rendered component
|
|
155
157
|
*/
|
|
156
158
|
export const ${name} = forwardRef<HTMLDivElement, ${name}Props>(
|
|
157
|
-
({ children, className, ...props }, ref) => {
|
|
158
|
-
|
|
159
|
-
|
|
159
|
+
({ children, className = '', glass, 'aria-label': ariaLabel, ...props }, ref) => {
|
|
160
|
+
const componentClass = [\`c-${name.toLowerCase()}\`, className].filter(Boolean).join(' ');
|
|
161
|
+
|
|
162
|
+
const content = (
|
|
163
|
+
<div ref={ref} className={componentClass} aria-label={ariaLabel} {...props}>
|
|
160
164
|
{children}
|
|
161
165
|
</div>
|
|
162
166
|
);
|
|
167
|
+
|
|
168
|
+
return glass ? <AtomixGlass {...(glass === true ? {} : glass)}>{content}</AtomixGlass> : content;
|
|
163
169
|
}
|
|
164
170
|
);
|
|
165
171
|
|
|
@@ -172,58 +178,38 @@ ${name}.displayName = '${name}';
|
|
|
172
178
|
export const mediumTemplate = (name) => `import React, { forwardRef, useId, memo } from 'react';
|
|
173
179
|
import { ${name.toUpperCase()} } from '../../lib/constants/components';
|
|
174
180
|
import { use${name} } from '../../lib/composables/use${name}';
|
|
175
|
-
import
|
|
176
|
-
|
|
177
|
-
export interface ${name}Props {
|
|
178
|
-
/**
|
|
179
|
-
* Content to be rendered
|
|
180
|
-
*/
|
|
181
|
-
children?: React.ReactNode;
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Additional CSS classes
|
|
185
|
-
*/
|
|
186
|
-
className?: string;
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* Disabled state
|
|
190
|
-
*/
|
|
191
|
-
disabled?: boolean;
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* Inline styles
|
|
195
|
-
*/
|
|
196
|
-
style?: React.CSSProperties;
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* Other component-specific props would go here
|
|
200
|
-
*/
|
|
201
|
-
}
|
|
181
|
+
import { AtomixGlass } from '../AtomixGlass/AtomixGlass';
|
|
182
|
+
import type { ${name}Props } from '../../lib/types/components';
|
|
202
183
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
184
|
+
/**
|
|
185
|
+
* ${name} - Medium Presentational Component
|
|
186
|
+
*
|
|
187
|
+
* @param {${name}Props} props - Component properties
|
|
188
|
+
* @returns {JSX.Element} The rendered component
|
|
189
|
+
*/
|
|
190
|
+
export const ${name} = memo(
|
|
191
|
+
forwardRef<HTMLDivElement, ${name}Props>(
|
|
192
|
+
({ children, className = '', disabled = false, glass, style, 'aria-label': ariaLabel, ...props }, ref) => {
|
|
193
|
+
const instanceId = useId();
|
|
194
|
+
const { generateClassNames } = use${name}({ disabled });
|
|
195
|
+
|
|
196
|
+
const content = (
|
|
197
|
+
<div
|
|
198
|
+
ref={ref}
|
|
199
|
+
className={generateClassNames(className)}
|
|
200
|
+
style={style}
|
|
201
|
+
aria-label={ariaLabel}
|
|
202
|
+
aria-disabled={disabled}
|
|
203
|
+
{...props}
|
|
204
|
+
>
|
|
205
|
+
{children}
|
|
206
|
+
</div>
|
|
207
|
+
);
|
|
206
208
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
style,
|
|
212
|
-
...props
|
|
213
|
-
}) => {
|
|
214
|
-
const instanceId = useId();
|
|
215
|
-
const { generateClassNames } = use${name}({ disabled });
|
|
216
|
-
|
|
217
|
-
return (
|
|
218
|
-
<div
|
|
219
|
-
className={generateClassNames(className)}
|
|
220
|
-
style={style}
|
|
221
|
-
{...props}
|
|
222
|
-
>
|
|
223
|
-
{children}
|
|
224
|
-
</div>
|
|
225
|
-
);
|
|
226
|
-
});
|
|
209
|
+
return glass ? <AtomixGlass {...(glass === true ? {} : glass)}>{content}</AtomixGlass> : content;
|
|
210
|
+
}
|
|
211
|
+
)
|
|
212
|
+
);
|
|
227
213
|
|
|
228
214
|
${name}.displayName = '${name}';
|
|
229
215
|
|
|
@@ -236,80 +222,38 @@ export default ${name};
|
|
|
236
222
|
export const complexTemplate = (name) => `import React, { forwardRef, useId, memo } from 'react';
|
|
237
223
|
import { ${name.toUpperCase()} } from '../../lib/constants/components';
|
|
238
224
|
import { use${name} } from '../../lib/composables/use${name}';
|
|
239
|
-
import type { ${name}Props, ${name}State } from '../../lib/types/components';
|
|
240
225
|
import { AtomixGlass } from '../AtomixGlass/AtomixGlass';
|
|
241
|
-
import type {
|
|
242
|
-
|
|
243
|
-
export interface ${name}Props {
|
|
244
|
-
/**
|
|
245
|
-
* Content to be rendered
|
|
246
|
-
*/
|
|
247
|
-
children?: React.ReactNode;
|
|
248
|
-
|
|
249
|
-
/**
|
|
250
|
-
* Additional CSS classes
|
|
251
|
-
*/
|
|
252
|
-
className?: string;
|
|
253
|
-
|
|
254
|
-
/**
|
|
255
|
-
* Disabled state
|
|
256
|
-
*/
|
|
257
|
-
disabled?: boolean;
|
|
258
|
-
|
|
259
|
-
/**
|
|
260
|
-
* Glass effect options
|
|
261
|
-
*/
|
|
262
|
-
glass?: boolean | AtomixGlassProps;
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
* Inline styles
|
|
266
|
-
*/
|
|
267
|
-
style?: React.CSSProperties;
|
|
268
|
-
|
|
269
|
-
/**
|
|
270
|
-
* Callback when component state changes
|
|
271
|
-
*/
|
|
272
|
-
onStateChange?: (state: ${name}State) => void;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
export interface ${name}State {
|
|
276
|
-
// Define state interface for the component
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
export const ${name}: React.FC<${name}Props> = memo(({
|
|
280
|
-
children,
|
|
281
|
-
className = '',
|
|
282
|
-
disabled = false,
|
|
283
|
-
glass,
|
|
284
|
-
style,
|
|
285
|
-
onStateChange,
|
|
286
|
-
...props
|
|
287
|
-
}) => {
|
|
288
|
-
const instanceId = useId();
|
|
289
|
-
const { generateClassNames } = use${name}({ disabled, onStateChange });
|
|
290
|
-
|
|
291
|
-
const componentContent = (
|
|
292
|
-
<div
|
|
293
|
-
className={generateClassNames(className)}
|
|
294
|
-
style={style}
|
|
295
|
-
{...props}
|
|
296
|
-
>
|
|
297
|
-
{children}
|
|
298
|
-
</div>
|
|
299
|
-
);
|
|
300
|
-
|
|
301
|
-
if (glass) {
|
|
302
|
-
const defaultGlassProps = {
|
|
303
|
-
// Default glass settings specific to this component
|
|
304
|
-
};
|
|
305
|
-
|
|
306
|
-
const glassProps = glass === true ? defaultGlassProps : { ...defaultGlassProps, ...glass };
|
|
226
|
+
import type { ${name}Props, ${name}State } from '../../lib/types/components';
|
|
307
227
|
|
|
308
|
-
|
|
309
|
-
|
|
228
|
+
/**
|
|
229
|
+
* ${name} - Complex Functional Component
|
|
230
|
+
*
|
|
231
|
+
* @param {${name}Props} props - Component properties
|
|
232
|
+
* @returns {JSX.Element} The rendered component
|
|
233
|
+
*/
|
|
234
|
+
export const ${name} = memo(
|
|
235
|
+
forwardRef<HTMLDivElement, ${name}Props>(
|
|
236
|
+
({ children, className = '', disabled = false, glass, style, onStateChange, 'aria-label': ariaLabel, ...props }, ref) => {
|
|
237
|
+
const instanceId = useId();
|
|
238
|
+
const { generateClassNames } = use${name}({ disabled, onStateChange });
|
|
239
|
+
|
|
240
|
+
const content = (
|
|
241
|
+
<div
|
|
242
|
+
ref={ref}
|
|
243
|
+
className={generateClassNames(className)}
|
|
244
|
+
style={style}
|
|
245
|
+
aria-label={ariaLabel}
|
|
246
|
+
aria-disabled={disabled}
|
|
247
|
+
{...props}
|
|
248
|
+
>
|
|
249
|
+
{children}
|
|
250
|
+
</div>
|
|
251
|
+
);
|
|
310
252
|
|
|
311
|
-
|
|
312
|
-
}
|
|
253
|
+
return glass ? <AtomixGlass {...(glass === true ? {} : glass)}>{content}</AtomixGlass> : content;
|
|
254
|
+
}
|
|
255
|
+
)
|
|
256
|
+
);
|
|
313
257
|
|
|
314
258
|
${name}.displayName = '${name}';
|
|
315
259
|
|
|
@@ -10,72 +10,72 @@ export const scssComponentTemplate = (name) => `// ${name} Component Styles
|
|
|
10
10
|
// Generated by Atomix CLI
|
|
11
11
|
// Located in src/styles/06-components/_components.${name.toLowerCase()}.scss
|
|
12
12
|
|
|
13
|
-
@use '../01-settings/settings.config' as
|
|
13
|
+
@use '../01-settings/settings.config' as *;
|
|
14
14
|
|
|
15
15
|
.c-${name.toLowerCase()} {
|
|
16
16
|
// Using CSS custom properties defined in settings
|
|
17
|
-
--#{
|
|
18
|
-
--#{
|
|
19
|
-
--#{
|
|
20
|
-
--#{
|
|
21
|
-
--#{
|
|
22
|
-
--#{
|
|
23
|
-
--#{
|
|
24
|
-
--#{
|
|
17
|
+
--#{$prefix}${name.toLowerCase()}-padding: var(--atomix-spacing-4);
|
|
18
|
+
--#{$prefix}${name.toLowerCase()}-margin: var(--atomix-spacing-2);
|
|
19
|
+
--#{$prefix}${name.toLowerCase()}-border: var(--atomix-border-default);
|
|
20
|
+
--#{$prefix}${name.toLowerCase()}-border-radius: var(--atomix-border-radius-md);
|
|
21
|
+
--#{$prefix}${name.toLowerCase()}-bg: var(--atomix-bg-surface);
|
|
22
|
+
--#{$prefix}${name.toLowerCase()}-color: var(--atomix-text-primary);
|
|
23
|
+
--#{$prefix}${name.toLowerCase()}-font-size: var(--atomix-font-size-base);
|
|
24
|
+
--#{$prefix}${name.toLowerCase()}-transition: var(--atomix-transition-all);
|
|
25
25
|
|
|
26
26
|
// State-specific properties
|
|
27
|
-
--#{
|
|
28
|
-
--#{
|
|
29
|
-
--#{
|
|
30
|
-
--#{
|
|
31
|
-
--#{
|
|
32
|
-
|
|
33
|
-
padding: var(--#{
|
|
34
|
-
margin: var(--#{
|
|
35
|
-
border: var(--#{
|
|
36
|
-
border-radius: var(--#{
|
|
37
|
-
background: var(--#{
|
|
38
|
-
color: var(--#{
|
|
39
|
-
font-size: var(--#{
|
|
40
|
-
transition: var(--#{
|
|
27
|
+
--#{$prefix}${name.toLowerCase()}-hover-bg: var(--atomix-bg-surface-hover);
|
|
28
|
+
--#{$prefix}${name.toLowerCase()}-focus-bg: var(--atomix-bg-surface-focus);
|
|
29
|
+
--#{$prefix}${name.toLowerCase()}-disabled-bg: var(--atomix-bg-surface-disabled);
|
|
30
|
+
--#{$prefix}${name.toLowerCase()}-disabled-color: var(--atomix-text-disabled);
|
|
31
|
+
--#{$prefix}${name.toLowerCase()}-disabled-opacity: var(--atomix-opacity-disabled);
|
|
32
|
+
|
|
33
|
+
padding: var(--#{$prefix}${name.toLowerCase()}-padding);
|
|
34
|
+
margin: var(--#{$prefix}${name.toLowerCase()}-margin);
|
|
35
|
+
border: var(--#{$prefix}${name.toLowerCase()}-border);
|
|
36
|
+
border-radius: var(--#{$prefix}${name.toLowerCase()}-border-radius);
|
|
37
|
+
background: var(--#{$prefix}${name.toLowerCase()}-bg);
|
|
38
|
+
color: var(--#{$prefix}${name.toLowerCase()}-color);
|
|
39
|
+
font-size: var(--#{$prefix}${name.toLowerCase()}-font-size);
|
|
40
|
+
transition: var(--#{$prefix}${name.toLowerCase()}-transition);
|
|
41
41
|
|
|
42
42
|
// Size variants
|
|
43
43
|
&--sm {
|
|
44
|
-
--#{
|
|
45
|
-
--#{
|
|
44
|
+
--#{$prefix}${name.toLowerCase()}-padding: var(--atomix-spacing-2);
|
|
45
|
+
--#{$prefix}${name.toLowerCase()}-font-size: var(--atomix-font-size-sm);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
&--lg {
|
|
49
|
-
--#{
|
|
50
|
-
--#{
|
|
49
|
+
--#{$prefix}${name.toLowerCase()}-padding: var(--atomix-spacing-6);
|
|
50
|
+
--#{$prefix}${name.toLowerCase()}-font-size: var(--atomix-font-size-lg);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
// Interactive states
|
|
54
54
|
&:hover {
|
|
55
|
-
background: var(--#{
|
|
55
|
+
background: var(--#{$prefix}${name.toLowerCase()}-hover-bg);
|
|
56
56
|
cursor: pointer;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
&:focus {
|
|
60
|
-
background: var(--#{
|
|
60
|
+
background: var(--#{$prefix}${name.toLowerCase()}-focus-bg);
|
|
61
61
|
outline: 2px solid var(--atomix-focus-color);
|
|
62
62
|
outline-offset: 2px;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
// Disabled state
|
|
66
66
|
&.is-disabled {
|
|
67
|
-
background: var(--#{
|
|
68
|
-
color: var(--#{
|
|
69
|
-
opacity: var(--#{
|
|
67
|
+
background: var(--#{$prefix}${name.toLowerCase()}-disabled-bg);
|
|
68
|
+
color: var(--#{$prefix}${name.toLowerCase()}-disabled-color);
|
|
69
|
+
opacity: var(--#{$prefix}${name.toLowerCase()}-disabled-opacity);
|
|
70
70
|
cursor: not-allowed;
|
|
71
71
|
pointer-events: none;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
// Glass variant
|
|
75
75
|
&--glass {
|
|
76
|
-
background: var(--#{
|
|
77
|
-
backdrop-filter: var(--#{
|
|
78
|
-
border-color: var(--#{
|
|
76
|
+
background: var(--#{$prefix}${name.toLowerCase()}-glass-bg, rgba(255, 255, 255, 0.1));
|
|
77
|
+
backdrop-filter: var(--#{$prefix}${name.toLowerCase()}-glass-backdrop, blur(10px));
|
|
78
|
+
border-color: var(--#{$prefix}${name.toLowerCase()}-glass-border, rgba(255, 255, 255, 0.2));
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
// Data states for JavaScript interaction
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Storybook Story Templates
|
|
3
|
+
* Templates for generating Storybook stories with documentation
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Generates a comprehensive Storybook story with full documentation
|
|
8
|
+
*/
|
|
9
|
+
export const enhancedStoryTemplate = (name: string): string => `import type { Meta, StoryObj } from '@storybook/react';
|
|
10
|
+
import { ${name} } from './${name}';
|
|
11
|
+
|
|
12
|
+
const meta: Meta<typeof ${name}> = {
|
|
13
|
+
title: 'Components/${name}',
|
|
14
|
+
component: ${name},
|
|
15
|
+
parameters: {
|
|
16
|
+
layout: 'centered',
|
|
17
|
+
docs: {
|
|
18
|
+
description: {
|
|
19
|
+
component: 'A versatile ${name.toLowerCase()} component built with Atomix Design System.',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
tags: ['autodocs'],
|
|
24
|
+
argTypes: {
|
|
25
|
+
children: {
|
|
26
|
+
control: 'text',
|
|
27
|
+
description: 'Content to be rendered inside the component',
|
|
28
|
+
},
|
|
29
|
+
size: {
|
|
30
|
+
control: 'select',
|
|
31
|
+
options: ['sm', 'md', 'lg'],
|
|
32
|
+
description: 'Size variant of the component',
|
|
33
|
+
},
|
|
34
|
+
variant: {
|
|
35
|
+
control: 'select',
|
|
36
|
+
options: ['primary', 'secondary', 'success', 'error'],
|
|
37
|
+
description: 'Color variant of the component',
|
|
38
|
+
},
|
|
39
|
+
disabled: {
|
|
40
|
+
control: 'boolean',
|
|
41
|
+
description: 'Whether the component is disabled',
|
|
42
|
+
},
|
|
43
|
+
glass: {
|
|
44
|
+
control: 'boolean',
|
|
45
|
+
description: 'Whether to apply glass effect',
|
|
46
|
+
},
|
|
47
|
+
className: {
|
|
48
|
+
control: 'text',
|
|
49
|
+
description: 'Additional CSS classes',
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export default meta;
|
|
55
|
+
type Story = StoryObj<typeof meta>;
|
|
56
|
+
|
|
57
|
+
export const Default: Story = {
|
|
58
|
+
args: {
|
|
59
|
+
children: '${name} Component',
|
|
60
|
+
size: 'md',
|
|
61
|
+
variant: 'primary',
|
|
62
|
+
},
|
|
63
|
+
parameters: {
|
|
64
|
+
docs: {
|
|
65
|
+
description: {
|
|
66
|
+
story: 'Default ${name.toLowerCase()} component with primary variant and medium size.',
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export const Playground: Story = {
|
|
73
|
+
args: {
|
|
74
|
+
children: 'Interactive ${name}',
|
|
75
|
+
size: 'md',
|
|
76
|
+
variant: 'primary',
|
|
77
|
+
},
|
|
78
|
+
parameters: {
|
|
79
|
+
docs: {
|
|
80
|
+
description: {
|
|
81
|
+
story: 'Interactive playground to test different combinations of props.',
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export const Small: Story = {
|
|
88
|
+
args: {
|
|
89
|
+
...Default.args,
|
|
90
|
+
size: 'sm',
|
|
91
|
+
children: 'Small ${name}',
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export const Large: Story = {
|
|
96
|
+
args: {
|
|
97
|
+
...Default.args,
|
|
98
|
+
size: 'lg',
|
|
99
|
+
children: 'Large ${name}',
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export const Secondary: Story = {
|
|
104
|
+
args: {
|
|
105
|
+
...Default.args,
|
|
106
|
+
variant: 'secondary',
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export const Success: Story = {
|
|
111
|
+
args: {
|
|
112
|
+
...Default.args,
|
|
113
|
+
variant: 'success',
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export const Error: Story = {
|
|
118
|
+
args: {
|
|
119
|
+
...Default.args,
|
|
120
|
+
variant: 'error',
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
export const Disabled: Story = {
|
|
125
|
+
args: {
|
|
126
|
+
...Default.args,
|
|
127
|
+
disabled: true,
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export const Glass: Story = {
|
|
132
|
+
args: {
|
|
133
|
+
...Default.args,
|
|
134
|
+
glass: true,
|
|
135
|
+
},
|
|
136
|
+
parameters: {
|
|
137
|
+
docs: {
|
|
138
|
+
description: {
|
|
139
|
+
story: '${name} with glass morphism effect applied.',
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
export const CustomContent: Story = {
|
|
146
|
+
args: {
|
|
147
|
+
children: (
|
|
148
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
|
|
149
|
+
<span>🎨</span>
|
|
150
|
+
<span>Custom ${name} Content</span>
|
|
151
|
+
</div>
|
|
152
|
+
),
|
|
153
|
+
size: 'lg',
|
|
154
|
+
variant: 'primary',
|
|
155
|
+
},
|
|
156
|
+
parameters: {
|
|
157
|
+
docs: {
|
|
158
|
+
description: {
|
|
159
|
+
story: 'Example with custom content including icons and complex markup.',
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
};
|
|
164
|
+
`;
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Generates a basic Storybook story (minimal setup)
|
|
168
|
+
*/
|
|
169
|
+
export const basicStoryTemplate = (name: string): string => `import type { Meta, StoryObj } from '@storybook/react';
|
|
170
|
+
import { ${name} } from './${name}';
|
|
171
|
+
|
|
172
|
+
const meta: Meta<typeof ${name}> = {
|
|
173
|
+
title: 'Components/${name}',
|
|
174
|
+
component: ${name},
|
|
175
|
+
parameters: {
|
|
176
|
+
layout: 'centered',
|
|
177
|
+
},
|
|
178
|
+
tags: ['autodocs'],
|
|
179
|
+
argTypes: {
|
|
180
|
+
size: {
|
|
181
|
+
control: 'select',
|
|
182
|
+
options: ['sm', 'md', 'lg'],
|
|
183
|
+
},
|
|
184
|
+
variant: {
|
|
185
|
+
control: 'select',
|
|
186
|
+
options: ['primary', 'secondary', 'success', 'error'],
|
|
187
|
+
},
|
|
188
|
+
disabled: {
|
|
189
|
+
control: 'boolean',
|
|
190
|
+
},
|
|
191
|
+
glass: {
|
|
192
|
+
control: 'boolean',
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
export default meta;
|
|
198
|
+
type Story = StoryObj<typeof meta>;
|
|
199
|
+
|
|
200
|
+
export const Default: Story = {
|
|
201
|
+
args: {
|
|
202
|
+
children: '${name} Component',
|
|
203
|
+
size: 'md',
|
|
204
|
+
variant: 'primary',
|
|
205
|
+
},
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
export const Small: Story = {
|
|
209
|
+
args: {
|
|
210
|
+
...Default.args,
|
|
211
|
+
size: 'sm',
|
|
212
|
+
},
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
export const Large: Story = {
|
|
216
|
+
args: {
|
|
217
|
+
...Default.args,
|
|
218
|
+
size: 'lg',
|
|
219
|
+
},
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
export const Glass: Story = {
|
|
223
|
+
args: {
|
|
224
|
+
...Default.args,
|
|
225
|
+
glass: true,
|
|
226
|
+
},
|
|
227
|
+
};
|
|
228
|
+
`;
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* All Storybook story templates
|
|
232
|
+
*/
|
|
233
|
+
export const storybookStoryTemplates = {
|
|
234
|
+
story: basicStoryTemplate,
|
|
235
|
+
storyEnhanced: enhancedStoryTemplate,
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Type for Storybook story templates object
|
|
240
|
+
*/
|
|
241
|
+
export type StorybookStoryTemplates = typeof storybookStoryTemplates;
|