@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.
Files changed (173) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/build-tools/EXAMPLES.md +372 -0
  3. package/build-tools/README.md +242 -0
  4. package/build-tools/__tests__/error-handler.test.js +230 -0
  5. package/build-tools/__tests__/index.test.js +141 -0
  6. package/build-tools/__tests__/rollup-plugin.test.js +194 -0
  7. package/build-tools/__tests__/utils.test.js +161 -0
  8. package/build-tools/__tests__/vite-plugin.test.js +129 -0
  9. package/build-tools/__tests__/webpack-loader.test.js +190 -0
  10. package/build-tools/error-handler.js +308 -0
  11. package/build-tools/index.d.ts +43 -0
  12. package/build-tools/index.js +88 -0
  13. package/build-tools/package.json +67 -0
  14. package/build-tools/rollup-plugin.js +236 -0
  15. package/build-tools/types.d.ts +163 -0
  16. package/build-tools/utils.js +203 -0
  17. package/build-tools/vite-plugin.js +161 -0
  18. package/build-tools/webpack-loader.js +123 -0
  19. package/dist/atomix.css +203 -90
  20. package/dist/atomix.css.map +1 -1
  21. package/dist/atomix.min.css +3 -3
  22. package/dist/atomix.min.css.map +1 -1
  23. package/dist/build-tools/EXAMPLES.md +372 -0
  24. package/dist/build-tools/README.md +242 -0
  25. package/dist/build-tools/__tests__/error-handler.test.js +230 -0
  26. package/dist/build-tools/__tests__/index.test.js +141 -0
  27. package/dist/build-tools/__tests__/rollup-plugin.test.js +194 -0
  28. package/dist/build-tools/__tests__/utils.test.js +161 -0
  29. package/dist/build-tools/__tests__/vite-plugin.test.js +129 -0
  30. package/dist/build-tools/__tests__/webpack-loader.test.js +190 -0
  31. package/dist/build-tools/error-handler.js +308 -0
  32. package/dist/build-tools/index.d.ts +43 -0
  33. package/dist/build-tools/index.js +88 -0
  34. package/dist/build-tools/package.json +67 -0
  35. package/dist/build-tools/rollup-plugin.js +236 -0
  36. package/dist/build-tools/types.d.ts +163 -0
  37. package/dist/build-tools/utils.js +203 -0
  38. package/dist/build-tools/vite-plugin.js +161 -0
  39. package/dist/build-tools/webpack-loader.js +123 -0
  40. package/dist/charts.d.ts +1 -1
  41. package/dist/charts.js +86 -57
  42. package/dist/charts.js.map +1 -1
  43. package/dist/core.d.ts +1 -1
  44. package/dist/core.js +136 -112
  45. package/dist/core.js.map +1 -1
  46. package/dist/forms.d.ts +2 -5
  47. package/dist/forms.js +140 -128
  48. package/dist/forms.js.map +1 -1
  49. package/dist/heavy.d.ts +1 -1
  50. package/dist/heavy.js +136 -112
  51. package/dist/heavy.js.map +1 -1
  52. package/dist/index.d.ts +9 -61
  53. package/dist/index.esm.js +237 -286
  54. package/dist/index.esm.js.map +1 -1
  55. package/dist/index.js +250 -299
  56. package/dist/index.js.map +1 -1
  57. package/dist/index.min.js +1 -1
  58. package/dist/index.min.js.map +1 -1
  59. package/package.json +23 -8
  60. package/scripts/atomix-cli.js +170 -73
  61. package/scripts/cli/__tests__/README.md +81 -0
  62. package/scripts/cli/__tests__/basic.test.js +115 -0
  63. package/scripts/cli/__tests__/component-generator.test.js +332 -0
  64. package/scripts/cli/__tests__/integration.test.js +327 -0
  65. package/scripts/cli/__tests__/test-setup.js +133 -0
  66. package/scripts/cli/__tests__/token-manager.test.js +251 -0
  67. package/scripts/cli/__tests__/utils.test.js +161 -0
  68. package/scripts/cli/component-generator.js +253 -299
  69. package/scripts/cli/dependency-checker.js +355 -0
  70. package/scripts/cli/interactive-init.js +46 -5
  71. package/scripts/cli/template-manager.js +0 -2
  72. package/scripts/cli/templates/common-templates.js +636 -0
  73. package/scripts/cli/templates/composable-templates.js +148 -126
  74. package/scripts/cli/templates/index.js +23 -16
  75. package/scripts/cli/templates/project-templates.js +151 -23
  76. package/scripts/cli/templates/react-templates.js +280 -210
  77. package/scripts/cli/templates/scss-templates.js +90 -91
  78. package/scripts/cli/templates/testing-templates.js +206 -27
  79. package/scripts/cli/templates/testing-utils.js +278 -0
  80. package/scripts/cli/templates/types-templates.js +70 -56
  81. package/scripts/cli/theme-bridge.js +8 -2
  82. package/scripts/cli/token-manager.js +318 -206
  83. package/scripts/cli/utils.js +0 -1
  84. package/src/components/Accordion/Accordion.stories.tsx +369 -870
  85. package/src/components/AtomixGlass/AtomixGlass.tsx +80 -39
  86. package/src/components/AtomixGlass/AtomixGlassContainer.tsx +103 -81
  87. package/src/components/AtomixGlass/__snapshots__/AtomixGlass.test.tsx.snap +8 -7
  88. package/src/components/AtomixGlass/glass-utils.ts +2 -2
  89. package/src/components/AtomixGlass/shader-utils.ts +5 -0
  90. package/src/components/AtomixGlass/stories/Customization.stories.tsx +131 -0
  91. package/src/components/AtomixGlass/stories/Examples.stories.tsx +2957 -2853
  92. package/src/components/AtomixGlass/stories/Modes.stories.tsx +1 -1
  93. package/src/components/AtomixGlass/stories/Overview.stories.tsx +348 -0
  94. package/src/components/AtomixGlass/stories/Performance.stories.tsx +103 -0
  95. package/src/components/AtomixGlass/stories/Playground.stories.tsx +50 -35
  96. package/src/components/AtomixGlass/stories/{ShaderVariants.stories.tsx → Shaders.stories.tsx} +1 -1
  97. package/src/components/AtomixGlass/stories/shared-components.tsx +90 -190
  98. package/src/components/Avatar/Avatar.stories.tsx +213 -1
  99. package/src/components/Badge/Badge.stories.tsx +121 -362
  100. package/src/components/Block/Block.stories.tsx +21 -12
  101. package/src/components/Breadcrumb/Breadcrumb.stories.tsx +141 -23
  102. package/src/components/Button/Button.stories.tsx +463 -1126
  103. package/src/components/Button/Button.test.tsx +107 -0
  104. package/src/components/Button/Button.tsx +46 -50
  105. package/src/components/Button/ButtonGroup.stories.tsx +373 -217
  106. package/src/components/Callout/Callout.stories.tsx +289 -634
  107. package/src/components/Card/Card.stories.tsx +248 -68
  108. package/src/components/Chart/Chart.stories.tsx +150 -8
  109. package/src/components/ColorModeToggle/ColorModeToggle.stories.tsx +151 -69
  110. package/src/components/Countdown/Countdown.stories.tsx +115 -8
  111. package/src/components/DataTable/DataTable.stories.tsx +346 -146
  112. package/src/components/DatePicker/DatePicker.stories.tsx +325 -1066
  113. package/src/components/Dropdown/Dropdown.stories.tsx +153 -33
  114. package/src/components/EdgePanel/EdgePanel.stories.tsx +230 -21
  115. package/src/components/Footer/Footer.stories.tsx +392 -328
  116. package/src/components/Form/Checkbox.stories.tsx +140 -6
  117. package/src/components/Form/Checkbox.test.tsx +63 -0
  118. package/src/components/Form/Checkbox.tsx +87 -51
  119. package/src/components/Form/Form.stories.tsx +119 -20
  120. package/src/components/Form/FormGroup.stories.tsx +127 -4
  121. package/src/components/Form/Radio.stories.tsx +140 -5
  122. package/src/components/Form/Select.stories.tsx +140 -8
  123. package/src/components/Form/Textarea.stories.tsx +149 -6
  124. package/src/components/Hero/Hero.stories.tsx +333 -32
  125. package/src/components/List/List.stories.tsx +141 -3
  126. package/src/components/Modal/Modal.stories.tsx +181 -42
  127. package/src/components/Popover/Popover.stories.tsx +448 -98
  128. package/src/components/Progress/Progress.stories.tsx +167 -5
  129. package/src/components/River/River.stories.tsx +1 -1
  130. package/src/components/SectionIntro/SectionIntro.stories.tsx +240 -48
  131. package/src/components/Spinner/Spinner.stories.tsx +102 -8
  132. package/src/components/Steps/Steps.stories.tsx +172 -43
  133. package/src/components/Tabs/Tabs.stories.tsx +136 -10
  134. package/src/components/Testimonial/Testimonial.stories.tsx +120 -3
  135. package/src/components/Todo/Todo.stories.tsx +198 -9
  136. package/src/components/Toggle/Toggle.stories.tsx +126 -39
  137. package/src/components/Tooltip/Tooltip.stories.tsx +194 -104
  138. package/src/components/Upload/Upload.stories.tsx +113 -24
  139. package/src/lib/README.md +2 -2
  140. package/src/lib/__tests__/theme-tools.test.ts +193 -0
  141. package/src/lib/composables/index.ts +2 -2
  142. package/src/lib/composables/useAtomixGlass.ts +28 -56
  143. package/src/lib/composables/useChartExport.ts +2 -7
  144. package/src/lib/composables/useDataTable.ts +46 -29
  145. package/src/lib/constants/components.ts +9 -32
  146. package/src/lib/theme/devtools/CLI.ts +1 -1
  147. package/src/lib/types/components.ts +1 -1
  148. package/src/lib/utils/__tests__/csv.test.ts +45 -0
  149. package/src/lib/utils/csv.ts +17 -0
  150. package/src/lib/utils/dataTableExport.ts +1 -10
  151. package/src/styles/01-settings/_index.scss +2 -1
  152. package/src/styles/01-settings/_settings.accordion.scss +28 -7
  153. package/src/styles/01-settings/_settings.colors.scss +11 -11
  154. package/src/styles/01-settings/_settings.typography.scss +5 -5
  155. package/src/styles/02-tools/_tools.utility-api.scss +14 -0
  156. package/src/styles/06-components/_components.accordion.scss +56 -14
  157. package/src/styles/06-components/_components.checkbox.scss +23 -17
  158. package/src/styles/99-utilities/_index.scss +2 -0
  159. package/src/styles/99-utilities/_utilities.scss +3 -1
  160. package/src/styles/99-utilities/_utilities.text-gradient.scss +45 -0
  161. package/themes/dark-complementary/README.md +98 -0
  162. package/themes/dark-complementary/index.scss +158 -0
  163. package/themes/default-light/README.md +81 -0
  164. package/themes/default-light/index.scss +154 -0
  165. package/themes/high-contrast/README.md +105 -0
  166. package/themes/high-contrast/index.scss +172 -0
  167. package/themes/test-theme/README.md +38 -0
  168. package/themes/test-theme/index.scss +47 -0
  169. package/scripts/cli/templates-original-backup.js +0 -1655
  170. package/scripts/cli/templates_backup.js +0 -684
  171. package/src/components/AtomixGlass/stories/AtomixGlass.stories.tsx +0 -1438
  172. package/src/lib/composables/useButton.ts +0 -93
  173. package/src/lib/composables/useCheckbox.ts +0 -70
@@ -1,4 +1,5 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react';
2
+ import { fn } from '@storybook/test';
2
3
  import { useState } from 'react';
3
4
  import { ColorModeToggle, type ColorMode } from './ColorModeToggle';
4
5
  import { Moon, Sun } from '@phosphor-icons/react';
@@ -10,33 +11,132 @@ const meta = {
10
11
  layout: 'centered',
11
12
  docs: {
12
13
  description: {
13
- component:
14
- 'The ColorModeToggle component provides a user-friendly switch for toggling between light and dark color modes. It automatically detects system preferences, persists user choices, and provides visual feedback. Essential for applications supporting theme customization and accessibility preferences.',
14
+ component: `
15
+ # ColorModeToggle
16
+
17
+ ## Overview
18
+
19
+ The ColorModeToggle component provides a user-friendly switch for toggling between light and dark color modes. It automatically detects system preferences, persists user choices, and provides visual feedback. Essential for applications supporting theme customization and accessibility preferences.
20
+
21
+ ## Features
22
+
23
+ - Automatic detection of system preference
24
+ - Local storage persistence
25
+ - Multiple size options
26
+ - Customizable icons
27
+ - Accessible design
28
+ - Controlled/uncontrolled modes
29
+
30
+ ## Accessibility
31
+
32
+ - Keyboard support: Toggle can be activated using Space or Enter keys
33
+ - Screen reader: Announces current mode and change events
34
+ - ARIA support: Proper roles and properties for assistive technologies
35
+ - Focus management: Maintains visible focus indicator
36
+
37
+ ## Usage Examples
38
+
39
+ ### Basic Usage
40
+
41
+ \`\`\`tsx
42
+ <ColorModeToggle />
43
+ \`\`\`
44
+
45
+ ### Controlled Mode
46
+
47
+ \`\`\`tsx
48
+ <ColorModeToggle value={mode} onChange={setMode} />
49
+ \`\`\`
50
+
51
+ ## API Reference
52
+
53
+ ### Props
54
+
55
+ | Prop | Type | Default | Description |
56
+ | ---- | ---- | ------- | ----------- |
57
+ | size | 'sm' \\| 'md' \\| 'lg' | 'md' | Size variant of the toggle |
58
+ | disabled | boolean | false | Whether the toggle is disabled |
59
+ | showTooltip | boolean | false | Whether to show tooltip on hover |
60
+ | disableStorage | boolean | false | Whether to disable localStorage persistence |
61
+ | disableSystemPreference | boolean | false | Whether to disable system preference detection |
62
+ | value | 'light' \\| 'dark' \\| 'system' | - | Controlled value of the toggle |
63
+ | onChange | (mode: ColorMode) => void | - | Callback when mode changes |
64
+ | lightIcon | ReactNode | Default sun icon | Custom icon for light mode |
65
+ | darkIcon | ReactNode | Default moon icon | Custom icon for dark mode |
66
+ `,
15
67
  },
16
68
  },
17
69
  },
18
70
  tags: ['autodocs'],
19
71
  argTypes: {
20
72
  size: {
21
- control: 'select',
73
+ control: { type: 'select' },
22
74
  options: ['sm', 'md', 'lg'],
23
75
  description: 'Size variant',
76
+ table: {
77
+ type: { summary: '"sm" | "md" | "lg"' },
78
+ defaultValue: { summary: 'md' },
79
+ },
24
80
  },
25
81
  disabled: {
26
82
  control: 'boolean',
27
83
  description: 'Disable the toggle',
84
+ table: {
85
+ type: { summary: 'boolean' },
86
+ defaultValue: { summary: false },
87
+ },
28
88
  },
29
89
  showTooltip: {
30
90
  control: 'boolean',
31
91
  description: 'Show tooltip on hover',
92
+ table: {
93
+ type: { summary: 'boolean' },
94
+ defaultValue: { summary: false },
95
+ },
32
96
  },
33
97
  disableStorage: {
34
98
  control: 'boolean',
35
99
  description: 'Disable localStorage persistence',
100
+ table: {
101
+ type: { summary: 'boolean' },
102
+ defaultValue: { summary: false },
103
+ },
36
104
  },
37
105
  disableSystemPreference: {
38
106
  control: 'boolean',
39
107
  description: 'Disable system preference detection',
108
+ table: {
109
+ type: { summary: 'boolean' },
110
+ defaultValue: { summary: false },
111
+ },
112
+ },
113
+ value: {
114
+ control: { type: 'radio', options: ['light', 'dark', 'system'] },
115
+ description: 'Controlled value of the toggle',
116
+ table: {
117
+ type: { summary: '"light" | "dark" | "system"' },
118
+ defaultValue: { summary: '-' },
119
+ },
120
+ },
121
+ onChange: {
122
+ action: 'mode changed',
123
+ description: 'Callback when mode changes',
124
+ },
125
+ lightIcon: {
126
+ control: 'object',
127
+ description: 'Custom icon for light mode',
128
+ table: {
129
+ type: { summary: 'ReactNode' },
130
+ defaultValue: { summary: 'Default sun icon' },
131
+ },
132
+ },
133
+ darkIcon: {
134
+ control: 'object',
135
+ description: 'Custom icon for dark mode',
136
+ table: {
137
+ type: { summary: 'ReactNode' },
138
+ defaultValue: { summary: 'Default moon icon' },
139
+ },
40
140
  },
41
141
  },
42
142
  } satisfies Meta<typeof ColorModeToggle>;
@@ -44,13 +144,18 @@ const meta = {
44
144
  export default meta;
45
145
  type Story = StoryObj<typeof meta>;
46
146
 
47
- // Default Color Mode Toggle
48
- export const Default: Story = {
147
+ export const BasicUsage: Story = {
49
148
  args: {},
149
+ parameters: {
150
+ docs: {
151
+ description: {
152
+ story: 'Default Color Mode Toggle with automatic system preference detection.',
153
+ },
154
+ },
155
+ },
50
156
  };
51
157
 
52
- // Size Variants
53
- export const Sizes: Story = {
158
+ export const AllSizes: Story = {
54
159
  render: () => (
55
160
  <div style={{ display: 'flex', gap: '1rem', alignItems: 'center' }}>
56
161
  <ColorModeToggle size="sm" />
@@ -58,17 +163,29 @@ export const Sizes: Story = {
58
163
  <ColorModeToggle size="lg" />
59
164
  </div>
60
165
  ),
166
+ parameters: {
167
+ docs: {
168
+ description: {
169
+ story: 'Color Mode Toggle in all available sizes.',
170
+ },
171
+ },
172
+ },
61
173
  };
62
174
 
63
- // Disabled State
64
- export const Disabled: Story = {
175
+ export const DisabledState: Story = {
65
176
  args: {
66
177
  disabled: true,
67
178
  },
179
+ parameters: {
180
+ docs: {
181
+ description: {
182
+ story: 'Disabled state of the Color Mode Toggle.',
183
+ },
184
+ },
185
+ },
68
186
  };
69
187
 
70
- // Controlled Mode
71
- export const Controlled: Story = {
188
+ export const ControlledMode: Story = {
72
189
  render: () => {
73
190
  const [mode, setMode] = useState<ColorMode>('light');
74
191
  return (
@@ -81,9 +198,15 @@ export const Controlled: Story = {
81
198
  </div>
82
199
  );
83
200
  },
201
+ parameters: {
202
+ docs: {
203
+ description: {
204
+ story: 'Controlled mode example with external state management.',
205
+ },
206
+ },
207
+ },
84
208
  };
85
209
 
86
- // Custom Icons
87
210
  export const CustomIcons: Story = {
88
211
  render: () => (
89
212
  <ColorModeToggle
@@ -91,71 +214,30 @@ export const CustomIcons: Story = {
91
214
  darkIcon={<Sun size={24} weight="fill" />}
92
215
  />
93
216
  ),
217
+ parameters: {
218
+ docs: {
219
+ description: {
220
+ story: 'Color Mode Toggle with custom icons.',
221
+ },
222
+ },
223
+ },
94
224
  };
95
225
 
96
- // With Callback
97
226
  export const WithCallback: Story = {
98
227
  render: () => {
99
228
  const [lastChanged, setLastChanged] = useState<string>('');
100
229
  return (
101
230
  <div style={{ display: 'flex', flexDirection: 'column', gap: '1rem', alignItems: 'center' }}>
102
- <ColorModeToggle
103
- onChange={(mode) => setLastChanged(`Changed to ${mode} at ${new Date().toLocaleTimeString()}`)}
104
- />
105
- {lastChanged && <p style={{ fontSize: '0.875rem' }}>{lastChanged}</p>}
231
+ <ColorModeToggle onChange={(mode) => setLastChanged(`Mode changed to ${mode} at ${new Date().toLocaleTimeString()}`)} />
232
+ {lastChanged && <p>Last changed: {lastChanged}</p>}
106
233
  </div>
107
234
  );
108
235
  },
109
- };
110
-
111
- // Custom Storage Key
112
- export const CustomStorageKey: Story = {
113
- args: {
114
- storageKey: 'my-app-theme',
115
- dataAttribute: 'data-theme',
116
- },
117
- };
118
-
119
- // Without Storage
120
- export const WithoutStorage: Story = {
121
- args: {
122
- disableStorage: true,
236
+ parameters: {
237
+ docs: {
238
+ description: {
239
+ story: 'Color Mode Toggle with change callback.',
240
+ },
241
+ },
123
242
  },
124
- };
125
-
126
- // Example Usage in Header
127
- export const InHeader: Story = {
128
- render: () => (
129
- <div
130
- className="u-p-5 u-shadow u-flex u-justify-between u-items-center"
131
- style={{ width: '400px', borderRadius: '8px' }}
132
- >
133
- <span style={{ fontWeight: 600 }}>Toggle Theme</span>
134
- <ColorModeToggle />
135
- </div>
136
- ),
137
- };
138
-
139
- // Multiple Toggles
140
- export const MultipleToggles: Story = {
141
- render: () => (
142
- <div style={{ display: 'flex', gap: '2rem' }}>
143
- <div style={{ display: 'flex', flexDirection: 'column', gap: '0.5rem', alignItems: 'center' }}>
144
- <ColorModeToggle size="sm" />
145
- <span style={{ fontSize: '0.75rem' }}>Small</span>
146
- </div>
147
- <div style={{ display: 'flex', flexDirection: 'column', gap: '0.5rem', alignItems: 'center' }}>
148
- <ColorModeToggle size="md" />
149
- <span style={{ fontSize: '0.75rem' }}>Medium</span>
150
- </div>
151
- <div style={{ display: 'flex', flexDirection: 'column', gap: '0.5rem', alignItems: 'center' }}>
152
- <ColorModeToggle size="lg" />
153
- <span style={{ fontSize: '0.75rem' }}>Large</span>
154
- </div>
155
- <div style={{ display: 'flex', flexDirection: 'column', gap: '0.5rem', alignItems: 'center' }}>
156
- <ColorModeToggle disabled />
157
- <span style={{ fontSize: '0.75rem' }}>Disabled</span>
158
- </div>
159
- </div>
160
- ),
161
- };
243
+ };
@@ -1,4 +1,5 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react';
2
+ import { fn } from '@storybook/test';
2
3
  import { Countdown } from './Countdown';
3
4
 
4
5
  const meta = {
@@ -6,16 +7,101 @@ const meta = {
6
7
  component: Countdown,
7
8
  parameters: {
8
9
  layout: 'centered',
10
+ docs: {
11
+ description: {
12
+ component: `
13
+ # Countdown
14
+
15
+ ## Overview
16
+
17
+ The Countdown component displays a countdown timer to a specified target date. It shows days, hours, minutes, and seconds in a clean, customizable format. The component supports focusing on specific units, custom separators, and different visual styles.
18
+
19
+ ## Features
20
+
21
+ - Configurable time units to display
22
+ - Customizable separator strings
23
+ - Focused visual style
24
+ - Automatic time calculation
25
+ - Accessible design
26
+
27
+ ## Accessibility
28
+
29
+ - Screen reader: Time values are announced appropriately
30
+ - ARIA support: Proper roles and properties for time elements
31
+ - Focus management: Interactive elements maintain focus indicators
32
+ - Keyboard support: Accessible via keyboard navigation
33
+
34
+ ## Usage Examples
35
+
36
+ ### Basic Usage
37
+
38
+ \`\`\`tsx
39
+ <Countdown target={targetDate} />
40
+ \`\`\`
41
+
42
+ ### With Specific Units
43
+
44
+ \`\`\`tsx
45
+ <Countdown
46
+ target={targetDate}
47
+ show={['hours', 'minutes', 'seconds']}
48
+ />
49
+ \`\`\`
50
+
51
+ ## API Reference
52
+
53
+ ### Props
54
+
55
+ | Prop | Type | Default | Description |
56
+ | ---- | ---- | ------- | ----------- |
57
+ | target | Date \\| number \\| string | - | Target date/time for the countdown |
58
+ | show | Array<'days' \\| 'hours' \\| 'minutes' \\| 'seconds'> | ['days', 'hours', 'minutes', 'seconds'] | Which time units to display |
59
+ | separator | string | ':' | String to separate time units |
60
+ | focused | boolean | false | Whether to apply focused visual style |
61
+ | onComplete | () => void | - | Callback when countdown completes |
62
+ | formatUnit | (unit: string, value: number) => string | - | Custom formatter for time units |
63
+ `,
64
+ },
65
+ },
9
66
  },
67
+ tags: ['autodocs'],
10
68
  argTypes: {
11
- target: { control: 'date', description: 'Target date/time' },
69
+ target: {
70
+ control: 'date',
71
+ description: 'Target date/time for the countdown',
72
+ table: {
73
+ type: { summary: 'Date | number | string' },
74
+ defaultValue: { summary: '-' },
75
+ },
76
+ },
12
77
  show: {
13
- control: 'check',
14
- options: ['days', 'hours', 'minutes', 'seconds'],
78
+ control: { type: 'check', options: ['days', 'hours', 'minutes', 'seconds'] },
15
79
  description: 'Fields to show',
80
+ table: {
81
+ type: { summary: "Array<'days' | 'hours' | 'minutes' | 'seconds'>" },
82
+ defaultValue: { summary: "['days', 'hours', 'minutes', 'seconds']" },
83
+ },
84
+ },
85
+ separator: {
86
+ control: 'text',
87
+ description: 'Separator string',
88
+ table: {
89
+ type: { summary: 'string' },
90
+ defaultValue: { summary: ':' },
91
+ },
92
+ },
93
+ focused: {
94
+ control: 'boolean',
95
+ description: 'Focused style',
96
+ table: {
97
+ type: { summary: 'boolean' },
98
+ defaultValue: { summary: false },
99
+ },
100
+ },
101
+ onComplete: {
102
+ action: 'completed',
103
+ description: 'Callback when countdown completes',
16
104
  },
17
- separator: { control: 'text', description: 'Separator string' },
18
- focused: { control: 'boolean', description: 'Focused style' },
19
105
  },
20
106
  } satisfies Meta<typeof Countdown>;
21
107
 
@@ -24,17 +110,31 @@ type Story = StoryObj<typeof meta>;
24
110
 
25
111
  const futureDate = new Date(Date.now() + 1000 * 60 * 60 * 24 + 1000 * 60 * 45 + 1000 * 30); // 1d 45m 30s
26
112
 
27
- export const Default: Story = {
113
+ export const BasicUsage: Story = {
28
114
  args: {
29
115
  target: futureDate,
30
116
  },
117
+ parameters: {
118
+ docs: {
119
+ description: {
120
+ story: 'Basic Countdown component with default settings.',
121
+ },
122
+ },
123
+ },
31
124
  };
32
125
 
33
- export const Focused: Story = {
126
+ export const FocusedStyle: Story = {
34
127
  args: {
35
128
  target: futureDate,
36
129
  focused: true,
37
130
  },
131
+ parameters: {
132
+ docs: {
133
+ description: {
134
+ story: 'Countdown with focused visual style.',
135
+ },
136
+ },
137
+ },
38
138
  };
39
139
 
40
140
  export const CustomSeparator: Story = {
@@ -43,4 +143,11 @@ export const CustomSeparator: Story = {
43
143
  separator: ' | ',
44
144
  show: ['hours', 'minutes', 'seconds'],
45
145
  },
46
- };
146
+ parameters: {
147
+ docs: {
148
+ description: {
149
+ story: 'Countdown with custom separator and specific units.',
150
+ },
151
+ },
152
+ },
153
+ };