@shohojdhara/atomix 0.3.12 → 0.3.14
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/CHANGELOG.md +19 -0
- package/README.md +2 -0
- package/dist/atomix.css +101 -88
- package/dist/atomix.css.map +1 -1
- package/dist/atomix.min.css +5 -15258
- package/dist/atomix.min.css.map +1 -1
- package/dist/charts.d.ts +1 -1
- package/dist/charts.js +17 -19
- package/dist/charts.js.map +1 -1
- package/dist/core.d.ts +41 -11
- package/dist/core.js +55 -41
- package/dist/core.js.map +1 -1
- package/dist/forms.d.ts +28 -11
- package/dist/forms.js +25 -24
- package/dist/forms.js.map +1 -1
- package/dist/heavy.d.ts +1 -1
- package/dist/heavy.js +32 -25
- package/dist/heavy.js.map +1 -1
- package/dist/index.d.ts +122 -46
- package/dist/index.esm.js +865 -200
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +870 -204
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/theme.d.ts +27 -2
- package/dist/theme.js +721 -108
- package/dist/theme.js.map +1 -1
- package/package.json +1 -1
- package/scripts/atomix-cli.js +610 -1111
- package/scripts/cli/component-generator.js +610 -0
- package/scripts/cli/documentation-sync.js +542 -0
- package/scripts/cli/interactive-init.js +84 -288
- package/scripts/cli/mappings.js +211 -0
- package/scripts/cli/migration-tools.js +95 -288
- package/scripts/cli/template-manager.js +107 -0
- package/scripts/cli/templates/README.md +123 -0
- package/scripts/cli/templates/composable-templates.js +149 -0
- package/scripts/cli/templates/config-templates.js +126 -0
- package/scripts/cli/templates/index.js +95 -0
- package/scripts/cli/templates/project-templates.js +214 -0
- package/scripts/cli/templates/react-templates.js +261 -0
- package/scripts/cli/templates/scss-templates.js +156 -0
- package/scripts/cli/templates/storybook-templates.js +236 -0
- package/scripts/cli/templates/testing-templates.js +45 -0
- package/scripts/cli/templates/token-templates.js +447 -0
- package/scripts/cli/templates/types-templates.js +133 -0
- package/scripts/cli/templates-original-backup.js +1655 -0
- package/scripts/cli/templates.js +35 -0
- package/scripts/cli/templates_backup.js +684 -0
- package/scripts/cli/theme-bridge.js +20 -14
- package/scripts/cli/token-manager.js +150 -77
- package/scripts/cli/utils.js +37 -25
- package/src/components/Accordion/Accordion.stories.tsx +5 -5
- package/src/components/Accordion/Accordion.test.tsx +57 -0
- package/src/components/Accordion/Accordion.tsx +4 -0
- package/src/components/AtomixGlass/AtomixGlassContainer.tsx +41 -44
- package/src/components/AtomixGlass/stories/AtomixGlass.stories.tsx +1 -1
- package/src/components/AtomixGlass/stories/Examples.stories.tsx +37 -37
- package/src/components/AtomixGlass/stories/Modes.stories.tsx +1 -2
- package/src/components/AtomixGlass/stories/Playground.stories.tsx +50 -51
- package/src/components/Avatar/Avatar.stories.tsx +26 -26
- package/src/components/Badge/Badge.stories.tsx +31 -31
- package/src/components/Badge/Badge.test.tsx +51 -0
- package/src/components/Badge/Badge.tsx +20 -1
- package/src/components/Block/Block.stories.tsx +5 -5
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +1 -1
- package/src/components/Breadcrumb/Breadcrumb.tsx +2 -2
- package/src/components/Button/Button.stories.tsx +13 -13
- package/src/components/Button/Button.tsx +4 -4
- package/src/components/Button/ButtonGroup.stories.tsx +2 -2
- package/src/components/Button/README.md +5 -0
- package/src/components/Callout/Callout.stories.tsx +11 -11
- package/src/components/Callout/Callout.test.tsx +10 -10
- package/src/components/Callout/Callout.tsx +7 -7
- package/src/components/Callout/README.md +9 -8
- package/src/components/Card/Card.tsx +2 -2
- package/src/components/Chart/Chart.stories.tsx +6 -6
- package/src/components/Chart/Chart.tsx +1 -1
- package/src/components/ColorModeToggle/ColorModeToggle.stories.tsx +1 -1
- package/src/components/DataTable/DataTable.tsx +14 -12
- package/src/components/DatePicker/DatePicker.stories.tsx +6 -6
- package/src/components/Dropdown/Dropdown.stories.tsx +4 -4
- package/src/components/Form/Checkbox.stories.tsx +3 -3
- package/src/components/Form/Checkbox.tsx +4 -2
- package/src/components/Form/Form.stories.tsx +3 -3
- package/src/components/Form/FormGroup.stories.tsx +1 -1
- package/src/components/Form/Input.stories.tsx +28 -16
- package/src/components/Form/Input.test.tsx +59 -0
- package/src/components/Form/Input.tsx +97 -95
- package/src/components/Form/Radio.stories.tsx +94 -94
- package/src/components/Form/Radio.tsx +2 -2
- package/src/components/Form/Select.stories.tsx +4 -4
- package/src/components/Form/Select.tsx +2 -2
- package/src/components/Form/Textarea.stories.tsx +22 -7
- package/src/components/Form/Textarea.test.tsx +45 -0
- package/src/components/Form/Textarea.tsx +88 -86
- package/src/components/List/List.stories.tsx +2 -2
- package/src/components/Modal/Modal.stories.tsx +4 -4
- package/src/components/Navigation/Navbar/Navbar.stories.tsx +5 -5
- package/src/components/Navigation/Navbar/Navbar.tsx +1 -1
- package/src/components/Navigation/README.md +1 -1
- package/src/components/Pagination/Pagination.stories.tsx +5 -2
- package/src/components/Pagination/Pagination.tsx +1 -1
- package/src/components/PhotoViewer/PhotoViewer.stories.tsx +10 -10
- package/src/components/Popover/Popover.stories.tsx +1 -1
- package/src/components/ProductReview/ProductReview.tsx +1 -1
- package/src/components/Progress/Progress.tsx +46 -46
- package/src/components/Rating/Rating.stories.tsx +4 -4
- package/src/components/Rating/Rating.tsx +8 -8
- package/src/components/Slider/Slider.stories.tsx +63 -63
- package/src/components/Spinner/Spinner.stories.tsx +2 -2
- package/src/components/Spinner/Spinner.test.tsx +35 -0
- package/src/components/Spinner/Spinner.tsx +9 -2
- package/src/components/Testimonial/Testimonial.stories.tsx +1 -1
- package/src/components/Toggle/Toggle.stories.tsx +32 -9
- package/src/components/Toggle/Toggle.test.tsx +91 -0
- package/src/components/Toggle/Toggle.tsx +44 -27
- package/src/components/Tooltip/Tooltip.tsx +1 -1
- package/src/layouts/Grid/Grid.stories.tsx +49 -49
- package/src/layouts/MasonryGrid/MasonryGrid.stories.tsx +2 -2
- package/src/lib/composables/useAccordion.ts +12 -3
- package/src/lib/composables/useBreadcrumb.ts +2 -2
- package/src/lib/composables/useCallout.ts +7 -7
- package/src/lib/composables/useNavbar.ts +1 -1
- package/src/lib/constants/components.ts +1 -1
- package/src/lib/storybook/InteractiveDemo.tsx +113 -0
- package/src/lib/storybook/PreviewContainer.tsx +36 -0
- package/src/lib/storybook/VariantsGrid.tsx +21 -0
- package/src/lib/storybook/index.ts +3 -0
- package/src/lib/theme/core/createThemeObject.ts +9 -5
- package/src/lib/theme/devtools/CLI.ts +155 -0
- package/src/lib/theme/devtools/DesignTokensCustomizer.stories.tsx +213 -0
- package/src/lib/theme/devtools/DesignTokensCustomizer.tsx +566 -0
- package/src/lib/theme/devtools/LiveEditor.tsx +2 -1
- package/src/lib/theme/devtools/index.ts +3 -0
- package/src/lib/theme/errors/errors.ts +8 -0
- package/src/lib/theme/runtime/ThemeProvider.tsx +117 -57
- package/src/lib/theme/runtime/__tests__/ThemeProvider.integration.test.tsx +305 -0
- package/src/lib/theme/runtime/__tests__/ThemeProvider.test.tsx +588 -0
- package/src/lib/theme/utils/__tests__/themeValidation.test.ts +264 -0
- package/src/lib/theme/utils/index.ts +1 -0
- package/src/lib/theme/utils/themeValidation.ts +501 -0
- package/src/lib/theme-tools.ts +32 -3
- package/src/lib/types/components.ts +81 -26
- package/src/lib/utils/themeNaming.ts +1 -1
- package/src/styles/06-components/_components.atomix-glass.scss +14 -15
- package/src/styles/06-components/_components.callout.scss +29 -33
- package/src/styles/06-components/_index.scss +1 -1
- package/src/styles/99-utilities/_utilities.display.scss +14 -3
- package/src/styles/99-utilities/_utilities.flex.scss +10 -10
- package/src/styles/99-utilities/_utilities.text.scss +28 -8
- package/scripts/cli/__tests__/cli-commands.test.js +0 -204
- package/scripts/cli/__tests__/utils.test.js +0 -201
- package/scripts/cli/__tests__/vitest.config.js +0 -26
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Storybook Templates
|
|
3
|
+
* Templates for Storybook stories and documentation
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Basic Storybook story template
|
|
8
|
+
*/
|
|
9
|
+
export const basicStoryTemplate = (name) => `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
|
+
},
|
|
18
|
+
tags: ['autodocs'],
|
|
19
|
+
argTypes: {
|
|
20
|
+
size: {
|
|
21
|
+
control: 'select',
|
|
22
|
+
options: ['sm', 'md', 'lg'],
|
|
23
|
+
},
|
|
24
|
+
variant: {
|
|
25
|
+
control: 'select',
|
|
26
|
+
options: ['primary', 'secondary', 'success', 'error'],
|
|
27
|
+
},
|
|
28
|
+
disabled: {
|
|
29
|
+
control: 'boolean',
|
|
30
|
+
},
|
|
31
|
+
glass: {
|
|
32
|
+
control: 'boolean',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export default meta;
|
|
38
|
+
type Story = StoryObj<typeof meta>;
|
|
39
|
+
|
|
40
|
+
export const Default: Story = {
|
|
41
|
+
args: {
|
|
42
|
+
children: '${name} Component',
|
|
43
|
+
size: 'md',
|
|
44
|
+
variant: 'primary',
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const Small: Story = {
|
|
49
|
+
args: {
|
|
50
|
+
...Default.args,
|
|
51
|
+
size: 'sm',
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const Large: Story = {
|
|
56
|
+
args: {
|
|
57
|
+
...Default.args,
|
|
58
|
+
size: 'lg',
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const Glass: Story = {
|
|
63
|
+
args: {
|
|
64
|
+
...Default.args,
|
|
65
|
+
glass: true,
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
`;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Enhanced Storybook story template with detailed documentation
|
|
72
|
+
*/
|
|
73
|
+
export const enhancedStoryTemplate = (name) => `import type { Meta, StoryObj } from '@storybook/react';
|
|
74
|
+
import { ${name} } from './${name}';
|
|
75
|
+
|
|
76
|
+
const meta: Meta<typeof ${name}> = {
|
|
77
|
+
title: 'Components/${name}',
|
|
78
|
+
component: ${name},
|
|
79
|
+
parameters: {
|
|
80
|
+
layout: 'centered',
|
|
81
|
+
docs: {
|
|
82
|
+
description: {
|
|
83
|
+
component: 'A versatile ${name.toLowerCase()} component built with Atomix Design System.',
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
tags: ['autodocs'],
|
|
88
|
+
argTypes: {
|
|
89
|
+
children: {
|
|
90
|
+
control: 'text',
|
|
91
|
+
description: 'Content to be rendered inside the component',
|
|
92
|
+
},
|
|
93
|
+
size: {
|
|
94
|
+
control: 'select',
|
|
95
|
+
options: ['sm', 'md', 'lg'],
|
|
96
|
+
description: 'Size variant of the component',
|
|
97
|
+
},
|
|
98
|
+
variant: {
|
|
99
|
+
control: 'select',
|
|
100
|
+
options: ['primary', 'secondary', 'success', 'error'],
|
|
101
|
+
description: 'Color variant of the component',
|
|
102
|
+
},
|
|
103
|
+
disabled: {
|
|
104
|
+
control: 'boolean',
|
|
105
|
+
description: 'Whether the component is disabled',
|
|
106
|
+
},
|
|
107
|
+
glass: {
|
|
108
|
+
control: 'boolean',
|
|
109
|
+
description: 'Whether to apply glass effect',
|
|
110
|
+
},
|
|
111
|
+
className: {
|
|
112
|
+
control: 'text',
|
|
113
|
+
description: 'Additional CSS classes',
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export default meta;
|
|
119
|
+
type Story = StoryObj<typeof meta>;
|
|
120
|
+
|
|
121
|
+
export const Default: Story = {
|
|
122
|
+
args: {
|
|
123
|
+
children: '${name} Component',
|
|
124
|
+
size: 'md',
|
|
125
|
+
variant: 'primary',
|
|
126
|
+
},
|
|
127
|
+
parameters: {
|
|
128
|
+
docs: {
|
|
129
|
+
description: {
|
|
130
|
+
story: 'Default ${name.toLowerCase()} component with primary variant and medium size.',
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
export const Playground: Story = {
|
|
137
|
+
args: {
|
|
138
|
+
children: 'Interactive ${name}',
|
|
139
|
+
size: 'md',
|
|
140
|
+
variant: 'primary',
|
|
141
|
+
},
|
|
142
|
+
parameters: {
|
|
143
|
+
docs: {
|
|
144
|
+
description: {
|
|
145
|
+
story: 'Interactive playground to test different combinations of props.',
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
export const Small: Story = {
|
|
152
|
+
args: {
|
|
153
|
+
...Default.args,
|
|
154
|
+
size: 'sm',
|
|
155
|
+
children: 'Small ${name}',
|
|
156
|
+
},
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
export const Large: Story = {
|
|
160
|
+
args: {
|
|
161
|
+
...Default.args,
|
|
162
|
+
size: 'lg',
|
|
163
|
+
children: 'Large ${name}',
|
|
164
|
+
},
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
export const Secondary: Story = {
|
|
168
|
+
args: {
|
|
169
|
+
...Default.args,
|
|
170
|
+
variant: 'secondary',
|
|
171
|
+
},
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
export const Success: Story = {
|
|
175
|
+
args: {
|
|
176
|
+
...Default.args,
|
|
177
|
+
variant: 'success',
|
|
178
|
+
},
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
export const Error: Story = {
|
|
182
|
+
args: {
|
|
183
|
+
...Default.args,
|
|
184
|
+
variant: 'error',
|
|
185
|
+
},
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
export const Disabled: Story = {
|
|
189
|
+
args: {
|
|
190
|
+
...Default.args,
|
|
191
|
+
disabled: true,
|
|
192
|
+
},
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
export const Glass: Story = {
|
|
196
|
+
args: {
|
|
197
|
+
...Default.args,
|
|
198
|
+
glass: true,
|
|
199
|
+
},
|
|
200
|
+
parameters: {
|
|
201
|
+
docs: {
|
|
202
|
+
description: {
|
|
203
|
+
story: '${name} with glass morphism effect applied.',
|
|
204
|
+
},
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
export const CustomContent: Story = {
|
|
210
|
+
args: {
|
|
211
|
+
children: (
|
|
212
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
|
|
213
|
+
<span>🎨</span>
|
|
214
|
+
<span>Custom ${name} Content</span>
|
|
215
|
+
</div>
|
|
216
|
+
),
|
|
217
|
+
size: 'lg',
|
|
218
|
+
variant: 'primary',
|
|
219
|
+
},
|
|
220
|
+
parameters: {
|
|
221
|
+
docs: {
|
|
222
|
+
description: {
|
|
223
|
+
story: 'Example with custom content including icons and complex markup.',
|
|
224
|
+
},
|
|
225
|
+
},
|
|
226
|
+
},
|
|
227
|
+
};
|
|
228
|
+
`;
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Storybook templates object
|
|
232
|
+
*/
|
|
233
|
+
export const storybookTemplates = {
|
|
234
|
+
story: basicStoryTemplate,
|
|
235
|
+
storyEnhanced: enhancedStoryTemplate,
|
|
236
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Testing Templates
|
|
3
|
+
* Templates for component testing
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Vitest test template for React components
|
|
8
|
+
*/
|
|
9
|
+
export const testTemplate = (name) => `import { describe, it, expect } from 'vitest';
|
|
10
|
+
import { render, screen } from '@testing-library/react';
|
|
11
|
+
import { ${name} } from './${name}';
|
|
12
|
+
|
|
13
|
+
describe('${name}', () => {
|
|
14
|
+
it('renders children correctly', () => {
|
|
15
|
+
render(<${name}>Test Content</${name}>);
|
|
16
|
+
expect(screen.getByText('Test Content')).toBeInTheDocument();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('applies size variant classes', () => {
|
|
20
|
+
const { container } = render(<${name} size="lg">Content</${name}>);
|
|
21
|
+
const element = container.firstChild;
|
|
22
|
+
expect(element).toHaveClass('c-${name.toLowerCase()}--lg');
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('handles disabled state', () => {
|
|
26
|
+
const { container } = render(<${name} disabled>Content</${name}>);
|
|
27
|
+
const element = container.firstChild;
|
|
28
|
+
expect(element).toHaveAttribute('aria-disabled', 'true');
|
|
29
|
+
expect(element).toHaveClass('is-disabled');
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('forwards ref correctly', () => {
|
|
33
|
+
const ref = React.createRef<HTMLDivElement>();
|
|
34
|
+
render(<${name} ref={ref}>Content</${name}>);
|
|
35
|
+
expect(ref.current).toBeInstanceOf(HTMLDivElement);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
`;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Testing templates object
|
|
42
|
+
*/
|
|
43
|
+
export const testingTemplates = {
|
|
44
|
+
test: testTemplate,
|
|
45
|
+
};
|