@shohojdhara/atomix 0.3.5 → 0.3.6

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/README.md +101 -199
  2. package/atomix.config.ts +241 -0
  3. package/dist/atomix.css +260 -179
  4. package/dist/atomix.css.map +1 -1
  5. package/dist/atomix.min.css +250 -179
  6. package/dist/atomix.min.css.map +1 -1
  7. package/dist/charts.js +61 -66
  8. package/dist/charts.js.map +1 -1
  9. package/dist/core.js +47 -31
  10. package/dist/core.js.map +1 -1
  11. package/dist/forms.js +47 -31
  12. package/dist/forms.js.map +1 -1
  13. package/dist/heavy.js +47 -31
  14. package/dist/heavy.js.map +1 -1
  15. package/dist/index.d.ts +1841 -1633
  16. package/dist/index.esm.js +4975 -4113
  17. package/dist/index.esm.js.map +1 -1
  18. package/dist/index.js +5151 -4290
  19. package/dist/index.js.map +1 -1
  20. package/dist/index.min.js +1 -1
  21. package/dist/index.min.js.map +1 -1
  22. package/dist/theme.d.ts +1572 -1442
  23. package/dist/theme.js +4816 -4080
  24. package/dist/theme.js.map +1 -1
  25. package/package.json +6 -20
  26. package/src/components/Accordion/Accordion.stories.tsx +50 -17
  27. package/src/components/AtomixGlass/AtomixGlass.tsx +65 -31
  28. package/src/components/AtomixGlass/AtomixGlassContainer.tsx +11 -4
  29. package/src/components/AtomixGlass/stories/AtomixGlass.stories.tsx +1 -32
  30. package/src/components/AtomixGlass/stories/Examples.stories.tsx +2 -2
  31. package/src/components/AtomixGlass/stories/shared-components.tsx +0 -31
  32. package/src/components/Avatar/Avatar.stories.tsx +7 -0
  33. package/src/components/Badge/Badge.stories.tsx +91 -13
  34. package/src/components/Block/Block.stories.tsx +7 -23
  35. package/src/components/Breadcrumb/Breadcrumb.stories.tsx +7 -0
  36. package/src/components/Button/Button.stories.tsx +141 -22
  37. package/src/components/Button/ButtonGroup.stories.tsx +315 -0
  38. package/src/components/Button/ButtonGroup.tsx +67 -0
  39. package/src/components/Button/index.ts +2 -0
  40. package/src/components/Callout/Callout.stories.tsx +8 -6
  41. package/src/components/Card/Card.stories.tsx +82 -28
  42. package/src/components/Chart/AnimatedChart.tsx +0 -1
  43. package/src/components/Chart/AreaChart.tsx +0 -1
  44. package/src/components/Chart/BarChart.tsx +0 -1
  45. package/src/components/Chart/BubbleChart.tsx +0 -1
  46. package/src/components/Chart/CandlestickChart.tsx +0 -1
  47. package/src/components/Chart/Chart.stories.tsx +5 -7
  48. package/src/components/Chart/Chart.tsx +0 -16
  49. package/src/components/Chart/ChartRenderer.tsx +1 -1
  50. package/src/components/Chart/DonutChart.tsx +0 -1
  51. package/src/components/Chart/FunnelChart.tsx +0 -1
  52. package/src/components/Chart/GaugeChart.tsx +0 -1
  53. package/src/components/Chart/HeatmapChart.tsx +0 -1
  54. package/src/components/Chart/LineChart.tsx +0 -1
  55. package/src/components/Chart/MultiAxisChart.tsx +0 -1
  56. package/src/components/Chart/PieChart.tsx +0 -1
  57. package/src/components/Chart/RadarChart.tsx +0 -1
  58. package/src/components/Chart/ScatterChart.tsx +0 -1
  59. package/src/components/Chart/WaterfallChart.tsx +0 -1
  60. package/src/components/ColorModeToggle/ColorModeToggle.stories.tsx +7 -0
  61. package/src/components/DataTable/DataTable.stories.tsx +23 -16
  62. package/src/components/DatePicker/DatePicker.stories.tsx +27 -19
  63. package/src/components/Dropdown/Dropdown.stories.tsx +11 -19
  64. package/src/components/EdgePanel/EdgePanel.stories.tsx +1 -0
  65. package/src/components/Footer/Footer.stories.tsx +8 -6
  66. package/src/components/Footer/FooterLink.tsx +9 -2
  67. package/src/components/Form/Checkbox.stories.tsx +7 -0
  68. package/src/components/Form/Form.stories.tsx +7 -0
  69. package/src/components/Form/FormGroup.stories.tsx +9 -1
  70. package/src/components/Form/Input.stories.tsx +69 -16
  71. package/src/components/Form/Radio.stories.tsx +9 -1
  72. package/src/components/Form/Select.stories.tsx +9 -1
  73. package/src/components/Form/Textarea.stories.tsx +10 -2
  74. package/src/components/Hero/Hero.stories.tsx +7 -0
  75. package/src/components/List/List.stories.tsx +7 -0
  76. package/src/components/Messages/Messages.stories.tsx +8 -7
  77. package/src/components/Modal/Modal.stories.tsx +17 -6
  78. package/src/components/Navigation/Menu/Menu.stories.tsx +7 -0
  79. package/src/components/Navigation/Nav/Nav.stories.tsx +7 -0
  80. package/src/components/Navigation/Navbar/Navbar.stories.tsx +1 -0
  81. package/src/components/Navigation/SideMenu/SideMenu.stories.tsx +1 -1
  82. package/src/components/Pagination/Pagination.stories.tsx +188 -111
  83. package/src/components/Pagination/Pagination.tsx +83 -3
  84. package/src/components/PhotoViewer/PhotoViewer.stories.tsx +10 -5
  85. package/src/components/Popover/Popover.stories.tsx +191 -115
  86. package/src/components/ProductReview/ProductReview.stories.tsx +80 -58
  87. package/src/components/Progress/Progress.stories.tsx +79 -49
  88. package/src/components/Rating/Rating.stories.tsx +109 -84
  89. package/src/components/River/River.stories.tsx +194 -114
  90. package/src/components/SectionIntro/SectionIntro.stories.tsx +19 -9
  91. package/src/components/Slider/Slider.stories.tsx +7 -0
  92. package/src/components/Spinner/Spinner.stories.tsx +15 -11
  93. package/src/components/Steps/Steps.stories.tsx +132 -98
  94. package/src/components/Tabs/Tabs.stories.tsx +163 -112
  95. package/src/components/Testimonial/Testimonial.stories.tsx +114 -68
  96. package/src/components/Todo/Todo.stories.tsx +38 -12
  97. package/src/components/Toggle/Toggle.stories.tsx +61 -28
  98. package/src/components/Tooltip/Tooltip.stories.tsx +318 -200
  99. package/src/components/Upload/Upload.stories.tsx +122 -84
  100. package/src/components/VideoPlayer/VideoPlayer.stories.tsx +7 -24
  101. package/src/components/index.ts +1 -0
  102. package/src/lib/composables/useAtomixGlass.ts +2 -3
  103. package/src/lib/composables/useNavbar.ts +0 -10
  104. package/src/lib/config/loader.ts +2 -1
  105. package/src/lib/constants/components.ts +10 -0
  106. package/src/lib/hooks/useComponentCustomization.ts +1 -1
  107. package/src/lib/theme/README.md +174 -0
  108. package/src/lib/theme/adapters/index.ts +31 -0
  109. package/src/lib/theme/adapters/themeAdapter.ts +287 -0
  110. package/src/lib/theme/config/__tests__/configLoader.test.ts +207 -0
  111. package/src/lib/theme/config/configLoader.ts +254 -0
  112. package/src/lib/theme/config/loader.ts +37 -48
  113. package/src/lib/theme/config/types.ts +2 -2
  114. package/src/lib/theme/config/validator.ts +15 -91
  115. package/src/lib/theme/{constants.ts → constants/constants.ts} +0 -18
  116. package/src/lib/theme/constants/index.ts +8 -0
  117. package/src/lib/theme/core/ThemeRegistry.ts +19 -6
  118. package/src/lib/theme/core/__tests__/createTheme.test.ts +132 -0
  119. package/src/lib/theme/core/composeTheme.ts +155 -0
  120. package/src/lib/theme/core/createTheme.ts +94 -0
  121. package/src/lib/theme/{createTheme.ts → core/createThemeObject.ts} +10 -6
  122. package/src/lib/theme/core/index.ts +5 -19
  123. package/src/lib/theme/devtools/Comparator.tsx +346 -22
  124. package/src/lib/theme/devtools/IMPROVEMENTS.md +139 -38
  125. package/src/lib/theme/devtools/Inspector.tsx +335 -51
  126. package/src/lib/theme/devtools/LiveEditor.tsx +478 -107
  127. package/src/lib/theme/devtools/Preview.tsx +471 -221
  128. package/src/lib/theme/{core → devtools}/ThemeValidator.ts +1 -1
  129. package/src/lib/theme/devtools/index.ts +14 -4
  130. package/src/lib/theme/devtools/useHistory.ts +130 -0
  131. package/src/lib/theme/errors/index.ts +12 -0
  132. package/src/lib/theme/generators/cssFile.ts +79 -0
  133. package/src/lib/theme/generators/generateCSS.ts +89 -0
  134. package/src/lib/theme/{generateCSSVariables.ts → generators/generateCSSVariables.ts} +3 -13
  135. package/src/lib/theme/generators/index.ts +19 -0
  136. package/src/lib/theme/i18n/rtl.ts +5 -6
  137. package/src/lib/theme/index.ts +120 -15
  138. package/src/lib/theme/runtime/ThemeApplicator.ts +52 -111
  139. package/src/lib/theme/{ThemeContext.tsx → runtime/ThemeContext.tsx} +1 -1
  140. package/src/lib/theme/runtime/ThemeErrorBoundary.tsx +1 -1
  141. package/src/lib/theme/runtime/ThemeProvider.tsx +456 -179
  142. package/src/lib/theme/runtime/index.ts +1 -2
  143. package/src/lib/theme/runtime/useTheme.ts +1 -2
  144. package/src/lib/theme/test/testTheme.ts +385 -0
  145. package/src/lib/theme/tokens/index.ts +12 -0
  146. package/src/lib/theme/tokens/tokens.ts +721 -0
  147. package/src/lib/theme/types.ts +6 -42
  148. package/src/lib/theme/{utils.ts → utils/domUtils.ts} +2 -2
  149. package/src/lib/theme/utils/index.ts +11 -0
  150. package/src/lib/theme/utils/injectCSS.ts +90 -0
  151. package/src/lib/theme/utils/themeHelpers.ts +78 -0
  152. package/src/lib/theme/{themeUtils.ts → utils/themeUtils.ts} +1 -1
  153. package/src/lib/theme-tools.ts +7 -8
  154. package/src/lib/types/components.ts +40 -130
  155. package/src/lib/utils/componentUtils.ts +1 -1
  156. package/src/styles/01-settings/_settings.design-tokens.scss +4 -1
  157. package/src/styles/02-tools/_tools.button.scss +66 -79
  158. package/src/styles/06-components/_components.atomix-glass.scss +13 -3
  159. package/src/styles/06-components/_components.pagination.scss +88 -0
  160. package/scripts/sync-theme-config.js +0 -309
  161. package/src/lib/theme/composeTheme.ts +0 -370
  162. package/src/lib/theme/core/ThemeCache.ts +0 -283
  163. package/src/lib/theme/core/ThemeEngine.test.ts +0 -146
  164. package/src/lib/theme/core/ThemeEngine.ts +0 -665
  165. package/src/lib/theme/createThemeFromConfig.ts +0 -132
  166. package/src/lib/theme/devtools/CLI.ts +0 -364
  167. package/src/lib/theme/runtime/ThemeManager.test.ts +0 -192
  168. package/src/lib/theme/runtime/ThemeManager.ts +0 -446
  169. package/src/styles/03-generic/_generated-root.css +0 -26
  170. package/src/themes/README.md +0 -442
  171. package/src/themes/themes.config.js +0 -68
  172. /package/src/lib/theme/{cssVariableMapper.ts → adapters/cssVariableMapper.ts} +0 -0
  173. /package/src/lib/theme/{errors.ts → errors/errors.ts} +0 -0
@@ -1,13 +1,22 @@
1
1
  import React from 'react';
2
- import { StoryFn, Meta } from '@storybook/react';
3
- import { fn } from '@storybook/test';
2
+ import type { Meta, StoryObj } from '@storybook/react';
4
3
  import { Popover, PopoverTrigger } from './Popover';
5
4
  import { Toggle } from '../Toggle/Toggle';
6
5
  import { Button } from '../Button/Button';
7
6
 
8
- export default {
7
+ const meta = {
9
8
  title: 'Components/Popover',
10
9
  component: Popover,
10
+ parameters: {
11
+ layout: 'fullscreen',
12
+ docs: {
13
+ description: {
14
+ component:
15
+ 'The Popover component displays floating content relative to a trigger element. It provides a flexible way to show additional information, actions, or controls without navigating away from the current context. Popovers support multiple positions, click or hover triggers, and can include rich interactive content.',
16
+ },
17
+ },
18
+ },
19
+ tags: ['autodocs'],
11
20
  argTypes: {
12
21
  position: {
13
22
  control: { type: 'select' },
@@ -47,10 +56,13 @@ export default {
47
56
  description: 'Enable glass morphism effect',
48
57
  },
49
58
  },
50
- } as Meta<typeof Popover>;
59
+ } satisfies Meta<typeof Popover>;
60
+
61
+ export default meta;
62
+ type Story = StoryObj<typeof meta>;
51
63
 
52
- // Default template
53
- const Template: StoryFn<typeof Popover> = args => {
64
+ // Helper component for interactive stories
65
+ const InteractivePopover = (args: React.ComponentProps<typeof Popover>) => {
54
66
  const selectOptions = [
55
67
  { value: '1', label: 'Option 1' },
56
68
  { value: '2', label: 'Option 2' },
@@ -103,143 +115,207 @@ const Template: StoryFn<typeof Popover> = args => {
103
115
  );
104
116
  };
105
117
 
106
- export const Default = Template.bind({});
107
- Default.args = {
108
- position: 'top',
109
- trigger: 'click',
110
- offset: 12,
111
- delay: 0,
112
- defaultOpen: false,
113
- closeOnClickOutside: true,
114
- closeOnEscape: true,
118
+ export const Default: Story = {
119
+ render: args => <InteractivePopover {...args} />,
120
+ args: {
121
+ position: 'top',
122
+ trigger: 'click',
123
+ offset: 12,
124
+ delay: 0,
125
+ defaultOpen: false,
126
+ closeOnClickOutside: true,
127
+ closeOnEscape: true,
128
+ } as any,
115
129
  };
116
130
 
117
- export const Hover = Template.bind({});
118
- Hover.args = {
119
- ...Default.args,
120
- trigger: 'hover',
121
- delay: 200,
131
+ export const Hover: Story = {
132
+ render: args => <InteractivePopover {...args} />,
133
+ args: {
134
+ position: 'top',
135
+ trigger: 'hover',
136
+ offset: 12,
137
+ delay: 200,
138
+ defaultOpen: false,
139
+ closeOnClickOutside: true,
140
+ closeOnEscape: true,
141
+ } as any,
122
142
  };
123
143
 
124
- export const BottomPosition = Template.bind({});
125
- BottomPosition.args = {
126
- ...Default.args,
127
- position: 'bottom',
144
+ export const BottomPosition: Story = {
145
+ render: args => <InteractivePopover {...args} />,
146
+ args: {
147
+ position: 'bottom',
148
+ trigger: 'click',
149
+ offset: 12,
150
+ delay: 0,
151
+ defaultOpen: false,
152
+ closeOnClickOutside: true,
153
+ closeOnEscape: true,
154
+ } as any,
128
155
  };
129
156
 
130
- export const LeftPosition = Template.bind({});
131
- LeftPosition.args = {
132
- ...Default.args,
133
- position: 'left',
157
+ export const LeftPosition: Story = {
158
+ render: args => <InteractivePopover {...args} />,
159
+ args: {
160
+ position: 'left',
161
+ trigger: 'click',
162
+ offset: 12,
163
+ delay: 0,
164
+ defaultOpen: false,
165
+ closeOnClickOutside: true,
166
+ closeOnEscape: true,
167
+ } as any,
134
168
  };
135
169
 
136
- export const RightPosition = Template.bind({});
137
- RightPosition.args = {
138
- ...Default.args,
139
- position: 'right',
170
+ export const RightPosition: Story = {
171
+ render: args => <InteractivePopover {...args} />,
172
+ args: {
173
+ position: 'right',
174
+ trigger: 'click',
175
+ offset: 12,
176
+ delay: 0,
177
+ defaultOpen: false,
178
+ closeOnClickOutside: true,
179
+ closeOnEscape: true,
180
+ } as any,
140
181
  };
141
182
 
142
- export const AutoPosition = Template.bind({});
143
- AutoPosition.args = {
144
- ...Default.args,
145
- position: 'auto',
146
- defaultOpen: true, // Open by default to showcase auto-positioning
183
+ export const AutoPosition: Story = {
184
+ render: args => <InteractivePopover {...args} />,
185
+ args: {
186
+ position: 'auto',
187
+ trigger: 'click',
188
+ offset: 12,
189
+ delay: 0,
190
+ defaultOpen: true, // Open by default to showcase auto-positioning
191
+ closeOnClickOutside: true,
192
+ closeOnEscape: true,
193
+ } as any,
147
194
  };
148
195
 
149
196
  /**
150
197
  * Glass morphism popover example.
151
198
  */
152
- export const GlassPopover = Template.bind({});
153
- GlassPopover.args = {
154
- ...Default.args,
155
- glass: true,
199
+ export const GlassPopover: Story = {
200
+ render: args => <InteractivePopover {...args} />,
201
+ args: {
202
+ position: 'top',
203
+ trigger: 'click',
204
+ offset: 12,
205
+ delay: 0,
206
+ defaultOpen: false,
207
+ closeOnClickOutside: true,
208
+ closeOnEscape: true,
209
+ glass: true,
210
+ } as any,
211
+ decorators: [
212
+ Story => (
213
+ <div
214
+ style={{
215
+ background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
216
+ minHeight: '100vh',
217
+ padding: '2rem',
218
+ }}
219
+ >
220
+ <Story />
221
+ </div>
222
+ ),
223
+ ],
156
224
  };
157
- GlassPopover.decorators = [
158
- Story => (
159
- <div
160
- style={{
161
- background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
162
- minHeight: '100vh',
163
- padding: '2rem',
164
- }}
165
- >
166
- <Story />
167
- </div>
168
- ),
169
- ];
170
225
 
171
226
  /**
172
227
  * Glass popover with custom settings.
173
228
  */
174
- export const GlassPopoverCustom = Template.bind({});
175
- GlassPopoverCustom.args = {
176
- ...Default.args,
177
- glass: {
178
- displacementScale: 80,
179
- blurAmount: 2,
180
- saturation: 200,
181
- aberrationIntensity: 1,
182
- cornerRadius: 16,
183
- mode: 'polar',
184
- },
229
+ export const GlassPopoverCustom: Story = {
230
+ render: args => <InteractivePopover {...args} />,
231
+ args: {
232
+ position: 'top',
233
+ trigger: 'click',
234
+ offset: 12,
235
+ delay: 0,
236
+ defaultOpen: false,
237
+ closeOnClickOutside: true,
238
+ closeOnEscape: true,
239
+ glass: {
240
+ displacementScale: 80,
241
+ blurAmount: 2,
242
+ saturation: 200,
243
+ aberrationIntensity: 1,
244
+ cornerRadius: 16,
245
+ mode: 'polar',
246
+ } as any,
247
+ } as any,
248
+ decorators: [
249
+ Story => (
250
+ <div
251
+ style={{
252
+ background: 'linear-gradient(45deg, #f093fb 0%, #f5576c 100%)',
253
+ minHeight: '100vh',
254
+ padding: '2rem',
255
+ }}
256
+ >
257
+ <Story />
258
+ </div>
259
+ ),
260
+ ],
185
261
  };
186
- GlassPopoverCustom.decorators = [
187
- Story => (
188
- <div
189
- style={{
190
- background: 'linear-gradient(45deg, #f093fb 0%, #f5576c 100%)',
191
- minHeight: '100vh',
192
- padding: '2rem',
193
- }}
194
- >
195
- <Story />
196
- </div>
197
- ),
198
- ];
199
262
 
200
263
  /**
201
264
  * Glass popover with hover trigger.
202
265
  */
203
- export const GlassPopoverHover = Template.bind({});
204
- GlassPopoverHover.args = {
205
- ...Default.args,
206
- trigger: 'hover',
207
- delay: 200,
208
- glass: true,
266
+ export const GlassPopoverHover: Story = {
267
+ render: args => <InteractivePopover {...args} />,
268
+ args: {
269
+ position: 'top',
270
+ trigger: 'hover',
271
+ offset: 12,
272
+ delay: 200,
273
+ defaultOpen: false,
274
+ closeOnClickOutside: true,
275
+ closeOnEscape: true,
276
+ glass: true,
277
+ } as any,
278
+ decorators: [
279
+ Story => (
280
+ <div
281
+ style={{
282
+ background: 'linear-gradient(135deg, #4facfe 0%, #00f2fe 100%)',
283
+ minHeight: '100vh',
284
+ padding: '2rem',
285
+ }}
286
+ >
287
+ <Story />
288
+ </div>
289
+ ),
290
+ ],
209
291
  };
210
- GlassPopoverHover.decorators = [
211
- Story => (
212
- <div
213
- style={{
214
- background: 'linear-gradient(135deg, #4facfe 0%, #00f2fe 100%)',
215
- minHeight: '100vh',
216
- padding: '2rem',
217
- }}
218
- >
219
- <Story />
220
- </div>
221
- ),
222
- ];
223
292
 
224
293
  /**
225
294
  * Glass popover with different positions.
226
295
  */
227
- export const GlassPopoverPositions = Template.bind({});
228
- GlassPopoverPositions.args = {
229
- ...Default.args,
230
- glass: true,
231
- defaultOpen: true,
296
+ export const GlassPopoverPositions: Story = {
297
+ render: args => <InteractivePopover {...args} />,
298
+ args: {
299
+ position: 'top',
300
+ trigger: 'click',
301
+ offset: 12,
302
+ delay: 0,
303
+ defaultOpen: true,
304
+ closeOnClickOutside: true,
305
+ closeOnEscape: true,
306
+ glass: true,
307
+ } as any,
308
+ decorators: [
309
+ Story => (
310
+ <div
311
+ style={{
312
+ background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
313
+ minHeight: '100vh',
314
+ padding: '2rem',
315
+ }}
316
+ >
317
+ <Story />
318
+ </div>
319
+ ),
320
+ ],
232
321
  };
233
- GlassPopoverPositions.decorators = [
234
- Story => (
235
- <div
236
- style={{
237
- background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
238
- minHeight: '100vh',
239
- padding: '2rem',
240
- }}
241
- >
242
- <Story />
243
- </div>
244
- ),
245
- ];
@@ -1,88 +1,110 @@
1
1
  import React from 'react';
2
- import { StoryFn, Meta } from '@storybook/react';
3
- import { fn } from '@storybook/test';
4
- import { ProductReview, ProductReviewProps } from './ProductReview';
2
+ import type { Meta, StoryObj } from '@storybook/react';
3
+ import { ProductReview } from './ProductReview';
4
+ import { THEME_COLORS } from '../../lib/constants/components';
5
5
 
6
- export default {
6
+ const meta = {
7
7
  title: 'Components/ProductReview',
8
8
  component: ProductReview,
9
9
  parameters: {
10
+ layout: 'centered',
10
11
  docs: {
11
12
  description: {
12
- component: 'Product review form for collecting user ratings and feedback',
13
+ component:
14
+ 'The ProductReview component provides a comprehensive form for collecting user ratings and feedback on products. It supports customizable rating scales, half-star ratings, product images, and detailed comment sections. Ideal for e-commerce sites, review platforms, or any application requiring product feedback collection.',
13
15
  },
14
16
  },
15
17
  },
18
+ tags: ['autodocs'],
16
19
  argTypes: {
17
- productName: { control: 'text' },
18
- productImage: { control: 'text' },
19
- initialRating: { control: { type: 'number', min: 0, max: 5, step: 0.5 } },
20
- maxRating: { control: { type: 'number', min: 1, max: 10 } },
21
- allowHalf: { control: 'boolean' },
20
+ productName: {
21
+ control: 'text',
22
+ description: 'Name of the product being reviewed',
23
+ },
24
+ productImage: {
25
+ control: 'text',
26
+ description: 'URL of the product image',
27
+ },
28
+ initialRating: {
29
+ control: { type: 'number', min: 0, max: 5, step: 0.5 },
30
+ description: 'Initial rating value',
31
+ },
32
+ maxRating: {
33
+ control: { type: 'number', min: 1, max: 10 },
34
+ description: 'Maximum rating value',
35
+ },
36
+ allowHalf: {
37
+ control: 'boolean',
38
+ description: 'Whether to allow half-star ratings',
39
+ },
22
40
  ratingColor: {
23
41
  control: {
24
42
  type: 'select',
25
- options: ['primary', 'secondary', 'success', 'info', 'warning', 'error', 'light', 'dark'],
43
+ options: THEME_COLORS,
26
44
  },
45
+ description: 'Color variant for the rating stars',
27
46
  },
28
47
  },
29
- } as Meta<typeof ProductReview>;
48
+ } satisfies Meta<typeof ProductReview>;
30
49
 
31
- const Template: StoryFn<ProductReviewProps> = (args: ProductReviewProps) => (
32
- <ProductReview {...args} />
33
- );
50
+ export default meta;
51
+ type Story = StoryObj<typeof meta>;
34
52
 
35
- export const Default = Template.bind({});
36
- Default.args = {
37
- productName: 'Wireless Headphones',
38
- productImage: 'https://via.placeholder.com/100',
39
- initialRating: 0,
40
- maxRating: 5,
41
- allowHalf: true,
42
- ratingColor: 'warning',
43
- onSubmit: (rating: number, comment: string) => {
44
- console.log('Rating:', rating);
45
- console.log('Comment:', comment);
53
+ export const Default: Story = {
54
+ args: {
55
+ productName: 'Wireless Headphones',
56
+ productImage: 'https://via.placeholder.com/100',
57
+ initialRating: 0,
58
+ maxRating: 5,
59
+ allowHalf: true,
60
+ ratingColor: 'warning',
61
+ onSubmit: (rating: number, comment: string) => {
62
+ console.log('Rating:', rating);
63
+ console.log('Comment:', comment);
64
+ },
46
65
  },
47
66
  };
48
67
 
49
- export const WithInitialRating = Template.bind({});
50
- WithInitialRating.args = {
51
- productName: 'Smart Watch',
52
- productImage: 'https://via.placeholder.com/100',
53
- initialRating: 4,
54
- maxRating: 5,
55
- allowHalf: true,
56
- ratingColor: 'warning',
57
- onSubmit: (rating: number, comment: string) => {
58
- console.log('Rating:', rating);
59
- console.log('Comment:', comment);
68
+ export const WithInitialRating: Story = {
69
+ args: {
70
+ productName: 'Smart Watch',
71
+ productImage: 'https://via.placeholder.com/100',
72
+ initialRating: 4,
73
+ maxRating: 5,
74
+ allowHalf: true,
75
+ ratingColor: 'warning',
76
+ onSubmit: (rating: number, comment: string) => {
77
+ console.log('Rating:', rating);
78
+ console.log('Comment:', comment);
79
+ },
60
80
  },
61
81
  };
62
82
 
63
- export const WithoutImage = Template.bind({});
64
- WithoutImage.args = {
65
- productName: 'Bluetooth Speaker',
66
- initialRating: 0,
67
- maxRating: 5,
68
- allowHalf: true,
69
- ratingColor: 'warning',
70
- onSubmit: (rating: number, comment: string) => {
71
- console.log('Rating:', rating);
72
- console.log('Comment:', comment);
83
+ export const WithoutImage: Story = {
84
+ args: {
85
+ productName: 'Bluetooth Speaker',
86
+ initialRating: 0,
87
+ maxRating: 5,
88
+ allowHalf: true,
89
+ ratingColor: 'warning',
90
+ onSubmit: (rating: number, comment: string) => {
91
+ console.log('Rating:', rating);
92
+ console.log('Comment:', comment);
93
+ },
73
94
  },
74
95
  };
75
96
 
76
- export const CustomRatingScale = Template.bind({});
77
- CustomRatingScale.args = {
78
- productName: 'Gaming Laptop',
79
- productImage: 'https://via.placeholder.com/100',
80
- initialRating: 0,
81
- maxRating: 10,
82
- allowHalf: false,
83
- ratingColor: 'primary',
84
- onSubmit: (rating: number, comment: string) => {
85
- console.log('Rating:', rating);
86
- console.log('Comment:', comment);
97
+ export const CustomRatingScale: Story = {
98
+ args: {
99
+ productName: 'Gaming Laptop',
100
+ productImage: 'https://via.placeholder.com/100',
101
+ initialRating: 0,
102
+ maxRating: 10,
103
+ allowHalf: false,
104
+ ratingColor: 'primary',
105
+ onSubmit: (rating: number, comment: string) => {
106
+ console.log('Rating:', rating);
107
+ console.log('Comment:', comment);
108
+ },
87
109
  },
88
110
  };
@@ -1,75 +1,105 @@
1
1
  import React from 'react';
2
- import { Meta, StoryFn } from '@storybook/react';
2
+ import type { Meta, StoryObj } from '@storybook/react';
3
3
  import { Progress } from './Progress';
4
- import { ProgressProps } from '../../lib/types/components';
4
+ import { THEME_COLORS, SIZES } from '../../lib/constants/components';
5
5
 
6
- export default {
6
+ const meta = {
7
7
  title: 'Components/Progress',
8
8
  component: Progress,
9
+ parameters: {
10
+ layout: 'centered',
11
+ docs: {
12
+ description: {
13
+ component:
14
+ 'The Progress component displays the completion status of a task or process. It provides visual feedback on progress through a horizontal bar that fills based on a percentage value. Progress bars support multiple variants, sizes, and can be used to show loading states, form completion, or any incremental process.',
15
+ },
16
+ },
17
+ },
18
+ tags: ['autodocs'],
19
+ decorators: [
20
+ Story => (
21
+ <div style={{ width: '50%' }}>
22
+ <Story />
23
+ </div>
24
+ ),
25
+ ],
9
26
  argTypes: {
10
- value: { control: { type: 'range', min: 0, max: 100 } },
27
+ value: {
28
+ control: { type: 'range', min: 0, max: 100 },
29
+ description: 'The progress value as a percentage (0-100)',
30
+ defaultValue: 50,
31
+ },
11
32
  variant: {
12
- control: {
13
- type: 'select',
14
- options: ['primary', 'secondary', 'success', 'warning', 'error', 'info', 'light', 'dark'],
15
- },
33
+ control: { type: 'select' },
34
+ options: THEME_COLORS,
35
+ description: 'The color variant of the progress bar',
36
+ defaultValue: 'primary',
16
37
  },
17
38
  size: {
18
- control: {
19
- type: 'select',
20
- options: ['sm', 'md', 'lg'],
21
- },
39
+ control: { type: 'select' },
40
+ options: SIZES,
41
+ description: 'The size of the progress bar',
42
+ defaultValue: 'md',
22
43
  },
23
44
  },
24
- } as Meta<typeof Progress>;
45
+ } satisfies Meta<typeof Progress>;
25
46
 
26
- const Template: StoryFn<ProgressProps> = (args: ProgressProps) => <Progress {...args} />;
47
+ export default meta;
48
+ type Story = StoryObj<typeof meta>;
27
49
 
28
- export const Default = Template.bind({});
29
- Default.args = {
30
- value: 50,
31
- variant: 'primary',
32
- size: 'md',
50
+ // Default Progress
51
+ export const Default: Story = {
52
+ args: {
53
+ value: 50,
54
+ variant: 'primary',
55
+ size: 'md',
56
+ },
33
57
  };
34
58
 
35
- export const Secondary = Template.bind({});
36
- Secondary.args = {
37
- value: 75,
38
- variant: 'secondary',
39
- size: 'md',
59
+ export const Secondary: Story = {
60
+ args: {
61
+ value: 75,
62
+ variant: 'secondary',
63
+ size: 'md',
64
+ },
40
65
  };
41
66
 
42
- export const Success = Template.bind({});
43
- Success.args = {
44
- value: 100,
45
- variant: 'success',
46
- size: 'md',
67
+ export const Success: Story = {
68
+ args: {
69
+ value: 100,
70
+ variant: 'success',
71
+ size: 'md',
72
+ },
47
73
  };
48
74
 
49
- export const Warning = Template.bind({});
50
- Warning.args = {
51
- value: 25,
52
- variant: 'warning',
53
- size: 'md',
75
+ export const Warning: Story = {
76
+ args: {
77
+ value: 25,
78
+ variant: 'warning',
79
+ size: 'md',
80
+ },
54
81
  };
55
82
 
56
- export const Error = Template.bind({});
57
- Error.args = {
58
- value: 10,
59
- variant: 'error',
60
- size: 'md',
83
+ export const Error: Story = {
84
+ args: {
85
+ value: 10,
86
+ variant: 'error',
87
+ size: 'md',
88
+ },
61
89
  };
62
90
 
63
- export const Small = Template.bind({});
64
- Small.args = {
65
- value: 60,
66
- variant: 'primary',
67
- size: 'sm',
91
+ export const Small: Story = {
92
+ args: {
93
+ value: 60,
94
+ variant: 'primary',
95
+ size: 'sm',
96
+ },
68
97
  };
69
98
 
70
- export const Large = Template.bind({});
71
- Large.args = {
72
- value: 80,
73
- variant: 'primary',
74
- size: 'lg',
99
+ export const Large: Story = {
100
+ args: {
101
+ value: 80,
102
+ variant: 'primary',
103
+ size: 'lg',
104
+ },
75
105
  };