@shohojdhara/atomix 0.3.14 → 0.3.15
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 +20 -0
- package/build-tools/EXAMPLES.md +372 -0
- package/build-tools/README.md +242 -0
- package/build-tools/__tests__/error-handler.test.js +230 -0
- package/build-tools/__tests__/index.test.js +141 -0
- package/build-tools/__tests__/rollup-plugin.test.js +194 -0
- package/build-tools/__tests__/utils.test.js +161 -0
- package/build-tools/__tests__/vite-plugin.test.js +129 -0
- package/build-tools/__tests__/webpack-loader.test.js +190 -0
- package/build-tools/error-handler.js +308 -0
- package/build-tools/index.d.ts +43 -0
- package/build-tools/index.js +88 -0
- package/build-tools/package.json +67 -0
- package/build-tools/rollup-plugin.js +236 -0
- package/build-tools/types.d.ts +163 -0
- package/build-tools/utils.js +203 -0
- package/build-tools/vite-plugin.js +161 -0
- package/build-tools/webpack-loader.js +123 -0
- package/dist/atomix.css +203 -90
- package/dist/atomix.css.map +1 -1
- package/dist/atomix.min.css +3 -3
- package/dist/atomix.min.css.map +1 -1
- package/dist/build-tools/EXAMPLES.md +372 -0
- package/dist/build-tools/README.md +242 -0
- package/dist/build-tools/__tests__/error-handler.test.js +230 -0
- package/dist/build-tools/__tests__/index.test.js +141 -0
- package/dist/build-tools/__tests__/rollup-plugin.test.js +194 -0
- package/dist/build-tools/__tests__/utils.test.js +161 -0
- package/dist/build-tools/__tests__/vite-plugin.test.js +129 -0
- package/dist/build-tools/__tests__/webpack-loader.test.js +190 -0
- package/dist/build-tools/error-handler.js +308 -0
- package/dist/build-tools/index.d.ts +43 -0
- package/dist/build-tools/index.js +88 -0
- package/dist/build-tools/package.json +67 -0
- package/dist/build-tools/rollup-plugin.js +236 -0
- package/dist/build-tools/types.d.ts +163 -0
- package/dist/build-tools/utils.js +203 -0
- package/dist/build-tools/vite-plugin.js +161 -0
- package/dist/build-tools/webpack-loader.js +123 -0
- package/dist/charts.d.ts +1 -1
- package/dist/charts.js +86 -57
- package/dist/charts.js.map +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +136 -112
- package/dist/core.js.map +1 -1
- package/dist/forms.d.ts +2 -5
- package/dist/forms.js +140 -128
- package/dist/forms.js.map +1 -1
- package/dist/heavy.d.ts +1 -1
- package/dist/heavy.js +136 -112
- package/dist/heavy.js.map +1 -1
- package/dist/index.d.ts +9 -61
- package/dist/index.esm.js +237 -286
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +250 -299
- 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 +23 -8
- package/scripts/atomix-cli.js +170 -73
- package/scripts/cli/__tests__/README.md +81 -0
- package/scripts/cli/__tests__/basic.test.js +115 -0
- package/scripts/cli/__tests__/component-generator.test.js +332 -0
- package/scripts/cli/__tests__/integration.test.js +327 -0
- package/scripts/cli/__tests__/test-setup.js +133 -0
- package/scripts/cli/__tests__/token-manager.test.js +251 -0
- package/scripts/cli/__tests__/utils.test.js +161 -0
- package/scripts/cli/component-generator.js +253 -299
- package/scripts/cli/dependency-checker.js +355 -0
- package/scripts/cli/interactive-init.js +46 -5
- package/scripts/cli/template-manager.js +0 -2
- package/scripts/cli/templates/common-templates.js +636 -0
- package/scripts/cli/templates/composable-templates.js +148 -126
- package/scripts/cli/templates/index.js +23 -16
- package/scripts/cli/templates/project-templates.js +151 -23
- package/scripts/cli/templates/react-templates.js +280 -210
- package/scripts/cli/templates/scss-templates.js +90 -91
- package/scripts/cli/templates/testing-templates.js +206 -27
- package/scripts/cli/templates/testing-utils.js +278 -0
- package/scripts/cli/templates/types-templates.js +70 -56
- package/scripts/cli/theme-bridge.js +8 -2
- package/scripts/cli/token-manager.js +318 -206
- package/scripts/cli/utils.js +0 -1
- package/src/components/Accordion/Accordion.stories.tsx +369 -870
- package/src/components/AtomixGlass/AtomixGlass.tsx +80 -39
- package/src/components/AtomixGlass/AtomixGlassContainer.tsx +103 -81
- package/src/components/AtomixGlass/__snapshots__/AtomixGlass.test.tsx.snap +8 -7
- package/src/components/AtomixGlass/glass-utils.ts +2 -2
- package/src/components/AtomixGlass/shader-utils.ts +5 -0
- package/src/components/AtomixGlass/stories/Customization.stories.tsx +131 -0
- package/src/components/AtomixGlass/stories/Examples.stories.tsx +2957 -2853
- package/src/components/AtomixGlass/stories/Modes.stories.tsx +1 -1
- package/src/components/AtomixGlass/stories/Overview.stories.tsx +348 -0
- package/src/components/AtomixGlass/stories/Performance.stories.tsx +103 -0
- package/src/components/AtomixGlass/stories/Playground.stories.tsx +50 -35
- package/src/components/AtomixGlass/stories/{ShaderVariants.stories.tsx → Shaders.stories.tsx} +1 -1
- package/src/components/AtomixGlass/stories/shared-components.tsx +90 -190
- package/src/components/Avatar/Avatar.stories.tsx +213 -1
- package/src/components/Badge/Badge.stories.tsx +121 -362
- package/src/components/Block/Block.stories.tsx +21 -12
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +141 -23
- package/src/components/Button/Button.stories.tsx +463 -1126
- package/src/components/Button/Button.test.tsx +107 -0
- package/src/components/Button/Button.tsx +46 -50
- package/src/components/Button/ButtonGroup.stories.tsx +373 -217
- package/src/components/Callout/Callout.stories.tsx +289 -634
- package/src/components/Card/Card.stories.tsx +248 -68
- package/src/components/Chart/Chart.stories.tsx +150 -8
- package/src/components/ColorModeToggle/ColorModeToggle.stories.tsx +151 -69
- package/src/components/Countdown/Countdown.stories.tsx +115 -8
- package/src/components/DataTable/DataTable.stories.tsx +346 -146
- package/src/components/DatePicker/DatePicker.stories.tsx +325 -1066
- package/src/components/Dropdown/Dropdown.stories.tsx +153 -33
- package/src/components/EdgePanel/EdgePanel.stories.tsx +230 -21
- package/src/components/Footer/Footer.stories.tsx +392 -328
- package/src/components/Form/Checkbox.stories.tsx +140 -6
- package/src/components/Form/Checkbox.test.tsx +63 -0
- package/src/components/Form/Checkbox.tsx +87 -51
- package/src/components/Form/Form.stories.tsx +119 -20
- package/src/components/Form/FormGroup.stories.tsx +127 -4
- package/src/components/Form/Radio.stories.tsx +140 -5
- package/src/components/Form/Select.stories.tsx +140 -8
- package/src/components/Form/Textarea.stories.tsx +149 -6
- package/src/components/Hero/Hero.stories.tsx +333 -32
- package/src/components/List/List.stories.tsx +141 -3
- package/src/components/Modal/Modal.stories.tsx +181 -42
- package/src/components/Popover/Popover.stories.tsx +448 -98
- package/src/components/Progress/Progress.stories.tsx +167 -5
- package/src/components/River/River.stories.tsx +1 -1
- package/src/components/SectionIntro/SectionIntro.stories.tsx +240 -48
- package/src/components/Spinner/Spinner.stories.tsx +102 -8
- package/src/components/Steps/Steps.stories.tsx +172 -43
- package/src/components/Tabs/Tabs.stories.tsx +136 -10
- package/src/components/Testimonial/Testimonial.stories.tsx +120 -3
- package/src/components/Todo/Todo.stories.tsx +198 -9
- package/src/components/Toggle/Toggle.stories.tsx +126 -39
- package/src/components/Tooltip/Tooltip.stories.tsx +194 -104
- package/src/components/Upload/Upload.stories.tsx +113 -24
- package/src/lib/README.md +2 -2
- package/src/lib/__tests__/theme-tools.test.ts +193 -0
- package/src/lib/composables/index.ts +2 -2
- package/src/lib/composables/useAtomixGlass.ts +28 -56
- package/src/lib/composables/useChartExport.ts +2 -7
- package/src/lib/composables/useDataTable.ts +46 -29
- package/src/lib/constants/components.ts +9 -32
- package/src/lib/theme/devtools/CLI.ts +1 -1
- package/src/lib/types/components.ts +1 -1
- package/src/lib/utils/__tests__/csv.test.ts +45 -0
- package/src/lib/utils/csv.ts +17 -0
- package/src/lib/utils/dataTableExport.ts +1 -10
- package/src/styles/01-settings/_index.scss +2 -1
- package/src/styles/01-settings/_settings.accordion.scss +28 -7
- package/src/styles/01-settings/_settings.colors.scss +11 -11
- package/src/styles/01-settings/_settings.typography.scss +5 -5
- package/src/styles/02-tools/_tools.utility-api.scss +14 -0
- package/src/styles/06-components/_components.accordion.scss +56 -14
- package/src/styles/06-components/_components.checkbox.scss +23 -17
- package/src/styles/99-utilities/_index.scss +2 -0
- package/src/styles/99-utilities/_utilities.scss +3 -1
- package/src/styles/99-utilities/_utilities.text-gradient.scss +45 -0
- package/themes/dark-complementary/README.md +98 -0
- package/themes/dark-complementary/index.scss +158 -0
- package/themes/default-light/README.md +81 -0
- package/themes/default-light/index.scss +154 -0
- package/themes/high-contrast/README.md +105 -0
- package/themes/high-contrast/index.scss +172 -0
- package/themes/test-theme/README.md +38 -0
- package/themes/test-theme/index.scss +47 -0
- package/scripts/cli/templates-original-backup.js +0 -1655
- package/scripts/cli/templates_backup.js +0 -684
- package/src/components/AtomixGlass/stories/AtomixGlass.stories.tsx +0 -1438
- package/src/lib/composables/useButton.ts +0 -93
- package/src/lib/composables/useCheckbox.ts +0 -70
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import { fn } from '@storybook/test';
|
|
3
4
|
import type { AtomixGlassProps } from '../../lib/types/components';
|
|
4
5
|
import { Tabs } from './Tabs';
|
|
5
6
|
|
|
@@ -13,8 +14,67 @@ const meta = {
|
|
|
13
14
|
layout: 'padded',
|
|
14
15
|
docs: {
|
|
15
16
|
description: {
|
|
16
|
-
component:
|
|
17
|
-
|
|
17
|
+
component: `
|
|
18
|
+
# Tabs
|
|
19
|
+
|
|
20
|
+
## Overview
|
|
21
|
+
|
|
22
|
+
Tabs organize content into multiple panels accessible via tab navigation. It provides a clean interface for switching between different views or sections of content. Tabs support keyboard navigation and can include rich content in each panel.
|
|
23
|
+
|
|
24
|
+
## Features
|
|
25
|
+
|
|
26
|
+
- Multiple tab panels with distinct content
|
|
27
|
+
- Keyboard navigation support
|
|
28
|
+
- Active tab indication
|
|
29
|
+
- Glass morphism effect option
|
|
30
|
+
- Rich content support
|
|
31
|
+
- Accessible design
|
|
32
|
+
- Responsive behavior
|
|
33
|
+
|
|
34
|
+
## Accessibility
|
|
35
|
+
|
|
36
|
+
- Keyboard support: Navigate tabs with arrow keys, activate with Enter/Space
|
|
37
|
+
- Screen reader: Tab labels and content announced properly
|
|
38
|
+
- ARIA support: Proper roles and properties for tab components
|
|
39
|
+
- Focus management: Maintains focus on active tab element
|
|
40
|
+
|
|
41
|
+
## Usage Examples
|
|
42
|
+
|
|
43
|
+
### Basic Usage
|
|
44
|
+
|
|
45
|
+
\`\`\`tsx
|
|
46
|
+
<Tabs
|
|
47
|
+
items={[
|
|
48
|
+
{ label: 'Tab 1', content: <div>Content 1</div> },
|
|
49
|
+
{ label: 'Tab 2', content: <div>Content 2</div> },
|
|
50
|
+
]}
|
|
51
|
+
/>
|
|
52
|
+
\`\`\`
|
|
53
|
+
|
|
54
|
+
### With Glass Effect
|
|
55
|
+
|
|
56
|
+
\`\`\`tsx
|
|
57
|
+
<Tabs
|
|
58
|
+
glass={true}
|
|
59
|
+
items={[
|
|
60
|
+
{ label: 'Tab 1', content: <div>Content 1</div> },
|
|
61
|
+
{ label: 'Tab 2', content: <div>Content 2</div> },
|
|
62
|
+
]}
|
|
63
|
+
/>
|
|
64
|
+
\`\`\`
|
|
65
|
+
|
|
66
|
+
## API Reference
|
|
67
|
+
|
|
68
|
+
### Props
|
|
69
|
+
|
|
70
|
+
| Prop | Type | Default | Description |
|
|
71
|
+
| ---- | ---- | ------- | ----------- |
|
|
72
|
+
| activeIndex | number | 0 | The index of the currently active tab |
|
|
73
|
+
| items | TabItem[] | [] | Array of tab items with labels and content |
|
|
74
|
+
| glass | boolean \\| GlassProps | false | Enable glass morphism effect |
|
|
75
|
+
| onChange | (index: number) => void | - | Callback when active tab changes |
|
|
76
|
+
| className | string | - | Additional CSS classes for the component |
|
|
77
|
+
`,
|
|
18
78
|
},
|
|
19
79
|
},
|
|
20
80
|
},
|
|
@@ -23,11 +83,30 @@ const meta = {
|
|
|
23
83
|
activeIndex: {
|
|
24
84
|
control: { type: 'number' },
|
|
25
85
|
description: 'The index of the currently active tab',
|
|
26
|
-
|
|
86
|
+
table: {
|
|
87
|
+
type: { summary: 'number' },
|
|
88
|
+
defaultValue: { summary: 0 },
|
|
89
|
+
},
|
|
27
90
|
},
|
|
28
91
|
glass: {
|
|
29
92
|
control: 'boolean',
|
|
30
93
|
description: 'Enable glass morphism effect',
|
|
94
|
+
table: {
|
|
95
|
+
type: { summary: 'boolean | GlassProps' },
|
|
96
|
+
defaultValue: { summary: false },
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
onChange: {
|
|
100
|
+
action: 'tab changed',
|
|
101
|
+
description: 'Callback when active tab changes',
|
|
102
|
+
},
|
|
103
|
+
className: {
|
|
104
|
+
control: 'text',
|
|
105
|
+
description: 'Additional CSS classes for the component',
|
|
106
|
+
table: {
|
|
107
|
+
type: { summary: 'string' },
|
|
108
|
+
defaultValue: { summary: '-' },
|
|
109
|
+
},
|
|
31
110
|
},
|
|
32
111
|
},
|
|
33
112
|
} satisfies Meta<typeof Tabs>;
|
|
@@ -35,10 +114,7 @@ const meta = {
|
|
|
35
114
|
export default meta;
|
|
36
115
|
type Story = StoryObj<typeof meta>;
|
|
37
116
|
|
|
38
|
-
|
|
39
|
-
* Default tabs component with three tabs.
|
|
40
|
-
*/
|
|
41
|
-
export const Default: Story = {
|
|
117
|
+
export const BasicUsage: Story = {
|
|
42
118
|
render: args => (
|
|
43
119
|
<div style={{ maxWidth: '600px', margin: '0 auto', padding: '30px' }}>
|
|
44
120
|
<Tabs {...args} />
|
|
@@ -61,11 +137,15 @@ export const Default: Story = {
|
|
|
61
137
|
],
|
|
62
138
|
activeIndex: 0,
|
|
63
139
|
},
|
|
140
|
+
parameters: {
|
|
141
|
+
docs: {
|
|
142
|
+
description: {
|
|
143
|
+
story: 'Basic tabs component with three tabs.',
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
},
|
|
64
147
|
};
|
|
65
148
|
|
|
66
|
-
/**
|
|
67
|
-
* Tabs with a different tab initially active (Tab 2).
|
|
68
|
-
*/
|
|
69
149
|
export const WithDifferentActiveTab: Story = {
|
|
70
150
|
render: args => (
|
|
71
151
|
<div style={{ maxWidth: '600px', margin: '0 auto', padding: '30px' }}>
|
|
@@ -89,6 +169,52 @@ export const WithDifferentActiveTab: Story = {
|
|
|
89
169
|
],
|
|
90
170
|
activeIndex: 1,
|
|
91
171
|
},
|
|
172
|
+
parameters: {
|
|
173
|
+
docs: {
|
|
174
|
+
description: {
|
|
175
|
+
story: 'Tabs with a different tab initially active (Tab 2).',
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
export const WithGlassEffect: Story = {
|
|
182
|
+
render: args => (
|
|
183
|
+
<div style={{
|
|
184
|
+
maxWidth: '600px',
|
|
185
|
+
margin: '0 auto',
|
|
186
|
+
padding: '30px',
|
|
187
|
+
background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
|
|
188
|
+
minHeight: '300px'
|
|
189
|
+
}}>
|
|
190
|
+
<Tabs {...args} />
|
|
191
|
+
</div>
|
|
192
|
+
),
|
|
193
|
+
args: {
|
|
194
|
+
items: [
|
|
195
|
+
{
|
|
196
|
+
label: 'Tab 1',
|
|
197
|
+
content: <p>This is the content for Tab 1 with glass effect.</p>,
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
label: 'Tab 2',
|
|
201
|
+
content: <p>This is the content for Tab 2 with glass effect.</p>,
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
label: 'Tab 3',
|
|
205
|
+
content: <p>This is the content for Tab 3 with glass effect.</p>,
|
|
206
|
+
},
|
|
207
|
+
],
|
|
208
|
+
activeIndex: 0,
|
|
209
|
+
glass: true,
|
|
210
|
+
},
|
|
211
|
+
parameters: {
|
|
212
|
+
docs: {
|
|
213
|
+
description: {
|
|
214
|
+
story: 'Tabs with glass morphism effect applied.',
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
},
|
|
92
218
|
};
|
|
93
219
|
|
|
94
220
|
/**
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import { fn } from '@storybook/test';
|
|
3
4
|
import { Testimonial } from './Testimonial';
|
|
4
5
|
|
|
5
6
|
const meta = {
|
|
@@ -9,20 +10,108 @@ const meta = {
|
|
|
9
10
|
layout: 'centered',
|
|
10
11
|
docs: {
|
|
11
12
|
description: {
|
|
12
|
-
component:
|
|
13
|
-
|
|
13
|
+
component: `
|
|
14
|
+
# Testimonial
|
|
15
|
+
|
|
16
|
+
## Overview
|
|
17
|
+
|
|
18
|
+
Testimonial component displays customer reviews, quotes, or endorsements with author information and avatars. It supports multiple sizes, skeleton loading states, and can display rich content. Testimonials are ideal for showcasing social proof, customer feedback, or featured quotes on landing pages and marketing sites.
|
|
19
|
+
|
|
20
|
+
## Features
|
|
21
|
+
|
|
22
|
+
- Customer quotes with author information
|
|
23
|
+
- Avatar display with author details
|
|
24
|
+
- Multiple size variants
|
|
25
|
+
- Skeleton loading states
|
|
26
|
+
- Responsive design
|
|
27
|
+
- Accessible markup
|
|
28
|
+
- Customizable styling
|
|
29
|
+
|
|
30
|
+
## Accessibility
|
|
31
|
+
|
|
32
|
+
- Screen reader: Quote and author information announced properly
|
|
33
|
+
- ARIA support: Proper roles and properties for testimonial components
|
|
34
|
+
- Keyboard support: Accessible via keyboard navigation
|
|
35
|
+
- Focus management: Maintains focus on interactive elements
|
|
36
|
+
|
|
37
|
+
## Usage Examples
|
|
38
|
+
|
|
39
|
+
### Basic Usage
|
|
40
|
+
|
|
41
|
+
\`\`\`tsx
|
|
42
|
+
<Testimonial
|
|
43
|
+
quote="Great product!"
|
|
44
|
+
author={{
|
|
45
|
+
name: 'John Doe',
|
|
46
|
+
role: 'Customer',
|
|
47
|
+
avatarSrc: '/path/to/avatar.jpg',
|
|
48
|
+
avatarAlt: 'John Doe'
|
|
49
|
+
}}
|
|
50
|
+
/>
|
|
51
|
+
\`\`\`
|
|
52
|
+
|
|
53
|
+
### With Size Variant
|
|
54
|
+
|
|
55
|
+
\`\`\`tsx
|
|
56
|
+
<Testimonial
|
|
57
|
+
quote="Great product!"
|
|
58
|
+
author={{
|
|
59
|
+
name: 'John Doe',
|
|
60
|
+
role: 'Customer',
|
|
61
|
+
avatarSrc: '/path/to/avatar.jpg',
|
|
62
|
+
avatarAlt: 'John Doe'
|
|
63
|
+
}}
|
|
64
|
+
size="lg"
|
|
65
|
+
/>
|
|
66
|
+
\`\`\`
|
|
67
|
+
|
|
68
|
+
## API Reference
|
|
69
|
+
|
|
70
|
+
### Props
|
|
71
|
+
|
|
72
|
+
| Prop | Type | Default | Description |
|
|
73
|
+
| ---- | ---- | ------- | ----------- |
|
|
74
|
+
| quote | string | - | The testimonial quote text |
|
|
75
|
+
| author | AuthorInfo | - | Information about the testimonial author |
|
|
76
|
+
| size | '' \\| 'sm' \\| 'lg' | '' | Size variant of the testimonial |
|
|
77
|
+
| skeleton | boolean | false | Whether to show skeleton loading state |
|
|
78
|
+
`,
|
|
14
79
|
},
|
|
15
80
|
},
|
|
16
81
|
},
|
|
17
82
|
tags: ['autodocs'],
|
|
18
83
|
argTypes: {
|
|
84
|
+
quote: {
|
|
85
|
+
control: 'text',
|
|
86
|
+
description: 'The testimonial quote text',
|
|
87
|
+
table: {
|
|
88
|
+
type: { summary: 'string' },
|
|
89
|
+
defaultValue: { summary: '-' },
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
author: {
|
|
93
|
+
control: 'object',
|
|
94
|
+
description: 'Information about the testimonial author',
|
|
95
|
+
table: {
|
|
96
|
+
type: { summary: 'AuthorInfo' },
|
|
97
|
+
defaultValue: { summary: '-' },
|
|
98
|
+
},
|
|
99
|
+
},
|
|
19
100
|
size: {
|
|
20
101
|
control: { type: 'select', options: ['', 'sm', 'lg'] },
|
|
21
102
|
description: 'Size variant of the testimonial',
|
|
103
|
+
table: {
|
|
104
|
+
type: { summary: '"" | "sm" | "lg"' },
|
|
105
|
+
defaultValue: { summary: '' },
|
|
106
|
+
},
|
|
22
107
|
},
|
|
23
108
|
skeleton: {
|
|
24
109
|
control: 'boolean',
|
|
25
110
|
description: 'Whether to show skeleton loading state',
|
|
111
|
+
table: {
|
|
112
|
+
type: { summary: 'boolean' },
|
|
113
|
+
defaultValue: { summary: false },
|
|
114
|
+
},
|
|
26
115
|
},
|
|
27
116
|
},
|
|
28
117
|
} satisfies Meta<typeof Testimonial>;
|
|
@@ -31,7 +120,7 @@ export default meta;
|
|
|
31
120
|
type Story = StoryObj<typeof meta>;
|
|
32
121
|
|
|
33
122
|
// Default testimonial
|
|
34
|
-
export const
|
|
123
|
+
export const BasicUsage: Story = {
|
|
35
124
|
render: args => (
|
|
36
125
|
<div style={{ padding: '30px' }}>
|
|
37
126
|
<Testimonial {...args} />
|
|
@@ -49,6 +138,13 @@ export const Default: Story = {
|
|
|
49
138
|
},
|
|
50
139
|
size: '',
|
|
51
140
|
},
|
|
141
|
+
parameters: {
|
|
142
|
+
docs: {
|
|
143
|
+
description: {
|
|
144
|
+
story: 'Basic testimonial with default size.',
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
},
|
|
52
148
|
};
|
|
53
149
|
|
|
54
150
|
// Large testimonial
|
|
@@ -70,6 +166,13 @@ export const Large: Story = {
|
|
|
70
166
|
},
|
|
71
167
|
size: 'lg',
|
|
72
168
|
},
|
|
169
|
+
parameters: {
|
|
170
|
+
docs: {
|
|
171
|
+
description: {
|
|
172
|
+
story: 'Large testimonial with expanded size.',
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
},
|
|
73
176
|
};
|
|
74
177
|
|
|
75
178
|
// Small testimonial
|
|
@@ -91,6 +194,13 @@ export const Small: Story = {
|
|
|
91
194
|
},
|
|
92
195
|
size: 'sm',
|
|
93
196
|
},
|
|
197
|
+
parameters: {
|
|
198
|
+
docs: {
|
|
199
|
+
description: {
|
|
200
|
+
story: 'Small testimonial with compact size.',
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
},
|
|
94
204
|
};
|
|
95
205
|
|
|
96
206
|
// Skeleton loading state
|
|
@@ -104,6 +214,13 @@ export const Skeleton: Story = {
|
|
|
104
214
|
skeleton: true,
|
|
105
215
|
size: '',
|
|
106
216
|
},
|
|
217
|
+
parameters: {
|
|
218
|
+
docs: {
|
|
219
|
+
description: {
|
|
220
|
+
story: 'Testimonial showing skeleton loading state.',
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
},
|
|
107
224
|
};
|
|
108
225
|
|
|
109
226
|
// Large skeleton
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { fn } from '@storybook/test';
|
|
2
3
|
import { generateUUID } from '../../lib/utils';
|
|
3
4
|
import { Todo } from './Todo';
|
|
4
5
|
import { SIZES } from '../../lib/constants/components';
|
|
@@ -10,8 +11,71 @@ const meta = {
|
|
|
10
11
|
layout: 'centered',
|
|
11
12
|
docs: {
|
|
12
13
|
description: {
|
|
13
|
-
component:
|
|
14
|
-
|
|
14
|
+
component: `
|
|
15
|
+
# Todo
|
|
16
|
+
|
|
17
|
+
## Overview
|
|
18
|
+
|
|
19
|
+
Todo component provides a complete todo list interface with the ability to add, complete, and manage tasks. It supports multiple sizes, can show or hide completed items, and provides a clean interface for task management. Ideal for task tracking, project management, or any scenario requiring a simple todo list.
|
|
20
|
+
|
|
21
|
+
## Features
|
|
22
|
+
|
|
23
|
+
- Add, complete, and manage tasks
|
|
24
|
+
- Multiple size options
|
|
25
|
+
- Show/hide completed items
|
|
26
|
+
- Clean and intuitive interface
|
|
27
|
+
- Responsive design
|
|
28
|
+
- Task persistence
|
|
29
|
+
- Accessible markup
|
|
30
|
+
|
|
31
|
+
## Accessibility
|
|
32
|
+
|
|
33
|
+
- Keyboard support: Navigate and interact with todos using keyboard
|
|
34
|
+
- Screen reader: Task status and content announced properly
|
|
35
|
+
- ARIA support: Proper roles and properties for todo components
|
|
36
|
+
- Focus management: Maintains focus on interactive elements
|
|
37
|
+
|
|
38
|
+
## Usage Examples
|
|
39
|
+
|
|
40
|
+
### Basic Usage
|
|
41
|
+
|
|
42
|
+
\`\`\`tsx
|
|
43
|
+
<Todo
|
|
44
|
+
items={[
|
|
45
|
+
{ id: '1', text: 'Task 1', completed: false },
|
|
46
|
+
{ id: '2', text: 'Task 2', completed: true },
|
|
47
|
+
]}
|
|
48
|
+
title="My Tasks"
|
|
49
|
+
placeholder="Add a new task"
|
|
50
|
+
/>
|
|
51
|
+
\`\`\`
|
|
52
|
+
|
|
53
|
+
### With Configuration
|
|
54
|
+
|
|
55
|
+
\`\`\`tsx
|
|
56
|
+
<Todo
|
|
57
|
+
items={tasks}
|
|
58
|
+
title="Project Tasks"
|
|
59
|
+
placeholder="Add a new task"
|
|
60
|
+
size="lg"
|
|
61
|
+
showCompleted={false}
|
|
62
|
+
/>
|
|
63
|
+
\`\`\`
|
|
64
|
+
|
|
65
|
+
## API Reference
|
|
66
|
+
|
|
67
|
+
### Props
|
|
68
|
+
|
|
69
|
+
| Prop | Type | Default | Description |
|
|
70
|
+
| ---- | ---- | ------- | ----------- |
|
|
71
|
+
| items | TodoItem[] | [] | Array of todo items |
|
|
72
|
+
| title | string | - | Title of the todo list |
|
|
73
|
+
| size | 'sm' \\| 'md' \\| 'lg' | 'md' | Size of the todo component |
|
|
74
|
+
| placeholder | string | - | Placeholder text for the input field |
|
|
75
|
+
| showCompleted | boolean | true | Whether to show completed items |
|
|
76
|
+
| className | string | - | Additional CSS class names |
|
|
77
|
+
| disabled | boolean | false | Whether the todo list is disabled |
|
|
78
|
+
`,
|
|
15
79
|
},
|
|
16
80
|
},
|
|
17
81
|
},
|
|
@@ -20,31 +84,59 @@ const meta = {
|
|
|
20
84
|
items: {
|
|
21
85
|
control: 'object',
|
|
22
86
|
description: 'Array of todo items',
|
|
87
|
+
table: {
|
|
88
|
+
type: { summary: 'TodoItem[]' },
|
|
89
|
+
defaultValue: { summary: '[]' },
|
|
90
|
+
},
|
|
23
91
|
},
|
|
24
92
|
title: {
|
|
25
93
|
control: 'text',
|
|
26
94
|
description: 'Title of the todo list',
|
|
95
|
+
table: {
|
|
96
|
+
type: { summary: 'string' },
|
|
97
|
+
defaultValue: { summary: '-' },
|
|
98
|
+
},
|
|
27
99
|
},
|
|
28
100
|
size: {
|
|
29
101
|
control: { type: 'select' },
|
|
30
102
|
options: SIZES,
|
|
31
103
|
description: 'Size of the todo component',
|
|
104
|
+
table: {
|
|
105
|
+
type: { summary: '"sm" | "md" | "lg"' },
|
|
106
|
+
defaultValue: { summary: 'md' },
|
|
107
|
+
},
|
|
32
108
|
},
|
|
33
109
|
placeholder: {
|
|
34
110
|
control: 'text',
|
|
35
111
|
description: 'Placeholder text for the input field',
|
|
112
|
+
table: {
|
|
113
|
+
type: { summary: 'string' },
|
|
114
|
+
defaultValue: { summary: '-' },
|
|
115
|
+
},
|
|
36
116
|
},
|
|
37
117
|
showCompleted: {
|
|
38
118
|
control: 'boolean',
|
|
39
119
|
description: 'Whether to show completed items',
|
|
120
|
+
table: {
|
|
121
|
+
type: { summary: 'boolean' },
|
|
122
|
+
defaultValue: { summary: true },
|
|
123
|
+
},
|
|
40
124
|
},
|
|
41
125
|
className: {
|
|
42
126
|
control: 'text',
|
|
43
127
|
description: 'Additional CSS class names',
|
|
128
|
+
table: {
|
|
129
|
+
type: { summary: 'string' },
|
|
130
|
+
defaultValue: { summary: '-' },
|
|
131
|
+
},
|
|
44
132
|
},
|
|
45
133
|
disabled: {
|
|
46
134
|
control: 'boolean',
|
|
47
135
|
description: 'Whether the todo list is disabled',
|
|
136
|
+
table: {
|
|
137
|
+
type: { summary: 'boolean' },
|
|
138
|
+
defaultValue: { summary: false },
|
|
139
|
+
},
|
|
48
140
|
},
|
|
49
141
|
},
|
|
50
142
|
} satisfies Meta<typeof Todo>;
|
|
@@ -52,7 +144,7 @@ const meta = {
|
|
|
52
144
|
export default meta;
|
|
53
145
|
type Story = StoryObj<typeof meta>;
|
|
54
146
|
|
|
55
|
-
export const
|
|
147
|
+
export const BasicUsage: Story = {
|
|
56
148
|
args: {
|
|
57
149
|
items: [
|
|
58
150
|
{ id: '1', text: 'Learn React', completed: true },
|
|
@@ -65,6 +157,13 @@ export const Default: Story = {
|
|
|
65
157
|
showCompleted: true,
|
|
66
158
|
disabled: false,
|
|
67
159
|
},
|
|
160
|
+
parameters: {
|
|
161
|
+
docs: {
|
|
162
|
+
description: {
|
|
163
|
+
story: 'Basic todo list with sample tasks.',
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
},
|
|
68
167
|
};
|
|
69
168
|
|
|
70
169
|
export const WithManyItems: Story = {
|
|
@@ -79,19 +178,56 @@ export const WithManyItems: Story = {
|
|
|
79
178
|
title: 'Project Tasks',
|
|
80
179
|
showCompleted: true,
|
|
81
180
|
},
|
|
181
|
+
parameters: {
|
|
182
|
+
docs: {
|
|
183
|
+
description: {
|
|
184
|
+
story: 'Todo list with multiple tasks.',
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
},
|
|
82
188
|
};
|
|
83
189
|
|
|
84
190
|
export const Small: Story = {
|
|
85
191
|
args: {
|
|
86
|
-
|
|
192
|
+
items: [
|
|
193
|
+
{ id: '1', text: 'Learn React', completed: true },
|
|
194
|
+
{ id: '2', text: 'Build a todo app', completed: false },
|
|
195
|
+
{ id: '3', text: 'Deploy to production', completed: false },
|
|
196
|
+
],
|
|
197
|
+
title: 'Todo List',
|
|
198
|
+
placeholder: 'Add a new task',
|
|
87
199
|
size: 'sm',
|
|
200
|
+
showCompleted: true,
|
|
201
|
+
disabled: false,
|
|
202
|
+
},
|
|
203
|
+
parameters: {
|
|
204
|
+
docs: {
|
|
205
|
+
description: {
|
|
206
|
+
story: 'Small-sized todo list.',
|
|
207
|
+
},
|
|
208
|
+
},
|
|
88
209
|
},
|
|
89
210
|
};
|
|
90
211
|
|
|
91
212
|
export const Large: Story = {
|
|
92
213
|
args: {
|
|
93
|
-
|
|
214
|
+
items: [
|
|
215
|
+
{ id: '1', text: 'Learn React', completed: true },
|
|
216
|
+
{ id: '2', text: 'Build a todo app', completed: false },
|
|
217
|
+
{ id: '3', text: 'Deploy to production', completed: false },
|
|
218
|
+
],
|
|
219
|
+
title: 'Todo List',
|
|
220
|
+
placeholder: 'Add a new task',
|
|
94
221
|
size: 'lg',
|
|
222
|
+
showCompleted: true,
|
|
223
|
+
disabled: false,
|
|
224
|
+
},
|
|
225
|
+
parameters: {
|
|
226
|
+
docs: {
|
|
227
|
+
description: {
|
|
228
|
+
story: 'Large-sized todo list.',
|
|
229
|
+
},
|
|
230
|
+
},
|
|
95
231
|
},
|
|
96
232
|
};
|
|
97
233
|
|
|
@@ -102,28 +238,81 @@ export const HideCompleted: Story = {
|
|
|
102
238
|
{ id: generateUUID(), text: 'Build a todo app', completed: false },
|
|
103
239
|
{ id: generateUUID(), text: 'Deploy to production', completed: false },
|
|
104
240
|
],
|
|
241
|
+
title: 'Todo List',
|
|
242
|
+
placeholder: 'Add a new task',
|
|
105
243
|
showCompleted: false,
|
|
106
|
-
|
|
244
|
+
},
|
|
245
|
+
parameters: {
|
|
246
|
+
docs: {
|
|
247
|
+
description: {
|
|
248
|
+
story: 'Todo list that hides completed items.',
|
|
249
|
+
},
|
|
250
|
+
},
|
|
107
251
|
},
|
|
108
252
|
};
|
|
109
253
|
|
|
110
254
|
export const Disabled: Story = {
|
|
111
255
|
args: {
|
|
112
|
-
|
|
256
|
+
items: [
|
|
257
|
+
{ id: '1', text: 'Learn React', completed: true },
|
|
258
|
+
{ id: '2', text: 'Build a todo app', completed: false },
|
|
259
|
+
{ id: '3', text: 'Deploy to production', completed: false },
|
|
260
|
+
],
|
|
261
|
+
title: 'Todo List',
|
|
262
|
+
placeholder: 'Add a new task',
|
|
263
|
+
size: 'md',
|
|
264
|
+
showCompleted: true,
|
|
113
265
|
disabled: true,
|
|
114
266
|
},
|
|
267
|
+
parameters: {
|
|
268
|
+
docs: {
|
|
269
|
+
description: {
|
|
270
|
+
story: 'Disabled todo list.',
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
|
+
},
|
|
115
274
|
};
|
|
116
275
|
|
|
117
276
|
export const CustomTitle: Story = {
|
|
118
277
|
args: {
|
|
119
|
-
|
|
278
|
+
items: [
|
|
279
|
+
{ id: '1', text: 'Learn React', completed: true },
|
|
280
|
+
{ id: '2', text: 'Build a todo app', completed: false },
|
|
281
|
+
{ id: '3', text: 'Deploy to production', completed: false },
|
|
282
|
+
],
|
|
120
283
|
title: 'My Custom Todo List',
|
|
284
|
+
placeholder: 'Add a new task',
|
|
285
|
+
size: 'md',
|
|
286
|
+
showCompleted: true,
|
|
287
|
+
disabled: false,
|
|
288
|
+
},
|
|
289
|
+
parameters: {
|
|
290
|
+
docs: {
|
|
291
|
+
description: {
|
|
292
|
+
story: 'Todo list with a custom title.',
|
|
293
|
+
},
|
|
294
|
+
},
|
|
121
295
|
},
|
|
122
296
|
};
|
|
123
297
|
|
|
124
298
|
export const NoTitle: Story = {
|
|
125
299
|
args: {
|
|
126
|
-
|
|
300
|
+
items: [
|
|
301
|
+
{ id: '1', text: 'Learn React', completed: true },
|
|
302
|
+
{ id: '2', text: 'Build a todo app', completed: false },
|
|
303
|
+
{ id: '3', text: 'Deploy to production', completed: false },
|
|
304
|
+
],
|
|
127
305
|
title: '',
|
|
306
|
+
placeholder: 'Add a new task',
|
|
307
|
+
size: 'md',
|
|
308
|
+
showCompleted: true,
|
|
309
|
+
disabled: false,
|
|
310
|
+
},
|
|
311
|
+
parameters: {
|
|
312
|
+
docs: {
|
|
313
|
+
description: {
|
|
314
|
+
story: 'Todo list without a title.',
|
|
315
|
+
},
|
|
316
|
+
},
|
|
128
317
|
},
|
|
129
318
|
};
|