@shohojdhara/atomix 0.3.15 → 0.4.0

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 (245) hide show
  1. package/build-tools/index.d.ts +31 -30
  2. package/build-tools/package.json +4 -21
  3. package/dist/atomix.css +20924 -2611
  4. package/dist/atomix.css.map +1 -1
  5. package/dist/atomix.min.css +76 -2
  6. package/dist/atomix.min.css.map +1 -1
  7. package/dist/build-tools/index.d.ts +31 -30
  8. package/dist/build-tools/package.json +4 -21
  9. package/dist/charts.js.map +1 -1
  10. package/dist/core.js.map +1 -1
  11. package/dist/forms.js.map +1 -1
  12. package/dist/heavy.js.map +1 -1
  13. package/dist/index.d.ts +144 -18
  14. package/dist/index.esm.js +110 -55
  15. package/dist/index.esm.js.map +1 -1
  16. package/dist/index.js +110 -55
  17. package/dist/index.js.map +1 -1
  18. package/dist/index.min.js +1 -1
  19. package/dist/index.min.js.map +1 -1
  20. package/dist/layout.js.map +1 -1
  21. package/dist/theme.d.ts +9 -9
  22. package/dist/theme.js.map +1 -1
  23. package/package.json +1 -1
  24. package/src/components/Accordion/Accordion.stories.tsx +32 -23
  25. package/src/components/Accordion/Accordion.test.tsx +70 -50
  26. package/src/components/Accordion/Accordion.tsx +99 -94
  27. package/src/components/AtomixGlass/AtomixGlass.test.tsx +1 -1
  28. package/src/components/AtomixGlass/GlassFilter.tsx +9 -16
  29. package/src/components/AtomixGlass/glass-utils.ts +4 -3
  30. package/src/components/AtomixGlass/shader-utils.ts +128 -52
  31. package/src/components/AtomixGlass/stories/Playground.stories.tsx +1 -1
  32. package/src/components/AtomixGlass/stories/Shaders.stories.tsx +1 -1
  33. package/src/components/Avatar/Avatar.stories.tsx +45 -62
  34. package/src/components/Avatar/Avatar.tsx +58 -56
  35. package/src/components/Badge/Badge.stories.tsx +20 -9
  36. package/src/components/Badge/Badge.test.tsx +41 -41
  37. package/src/components/Badge/Badge.tsx +64 -62
  38. package/src/components/Block/Block.stories.tsx +14 -4
  39. package/src/components/Breadcrumb/Breadcrumb.stories.tsx +9 -8
  40. package/src/components/Breadcrumb/Breadcrumb.tsx +62 -60
  41. package/src/components/Button/Button.stories.tsx +13 -22
  42. package/src/components/Button/Button.test.tsx +97 -81
  43. package/src/components/Button/Button.tsx +46 -14
  44. package/src/components/Button/ButtonGroup.stories.tsx +37 -32
  45. package/src/components/Button/ButtonGroup.tsx +4 -15
  46. package/src/components/Callout/Callout.stories.tsx +109 -16
  47. package/src/components/Card/Card.stories.tsx +67 -36
  48. package/src/components/Card/Card.tsx +30 -14
  49. package/src/components/Chart/AreaChart.tsx +1 -1
  50. package/src/components/Chart/CandlestickChart.tsx +23 -16
  51. package/src/components/Chart/Chart.stories.tsx +4 -9
  52. package/src/components/Chart/Chart.tsx +40 -44
  53. package/src/components/Chart/ChartRenderer.tsx +39 -12
  54. package/src/components/Chart/ChartToolbar.tsx +21 -5
  55. package/src/components/Chart/DonutChart.tsx +1 -1
  56. package/src/components/Chart/FunnelChart.tsx +4 -1
  57. package/src/components/Chart/GaugeChart.tsx +3 -1
  58. package/src/components/Chart/HeatmapChart.tsx +50 -37
  59. package/src/components/Chart/LineChart.tsx +3 -2
  60. package/src/components/Chart/MultiAxisChart.tsx +24 -16
  61. package/src/components/Chart/RadarChart.tsx +19 -17
  62. package/src/components/Chart/ScatterChart.tsx +29 -21
  63. package/src/components/ColorModeToggle/ColorModeToggle.stories.tsx +6 -2
  64. package/src/components/ColorModeToggle/ColorModeToggle.tsx +15 -3
  65. package/src/components/Countdown/Countdown.stories.tsx +7 -7
  66. package/src/components/DataTable/DataTable.stories.tsx +43 -38
  67. package/src/components/DataTable/DataTable.test.tsx +26 -148
  68. package/src/components/DataTable/DataTable.tsx +485 -456
  69. package/src/components/DatePicker/DatePicker.stories.tsx +32 -47
  70. package/src/components/DatePicker/DatePicker.tsx +31 -26
  71. package/src/components/Dropdown/Dropdown.stories.tsx +2 -5
  72. package/src/components/Dropdown/Dropdown.tsx +313 -299
  73. package/src/components/EdgePanel/EdgePanel.stories.tsx +6 -19
  74. package/src/components/EdgePanel/EdgePanel.tsx +1 -3
  75. package/src/components/Footer/Footer.stories.tsx +21 -16
  76. package/src/components/Footer/Footer.tsx +130 -128
  77. package/src/components/Footer/FooterLink.tsx +2 -2
  78. package/src/components/Form/Checkbox.test.tsx +49 -49
  79. package/src/components/Form/Checkbox.tsx +108 -100
  80. package/src/components/Form/Form.stories.tsx +2 -10
  81. package/src/components/Form/Input.stories.tsx +22 -39
  82. package/src/components/Form/Input.test.tsx +38 -44
  83. package/src/components/Form/Radio.stories.tsx +6 -12
  84. package/src/components/Form/Radio.tsx +68 -66
  85. package/src/components/Form/Select.tsx +184 -182
  86. package/src/components/Form/Textarea.test.tsx +27 -32
  87. package/src/components/Hero/Hero.stories.tsx +56 -23
  88. package/src/components/Hero/Hero.tsx +201 -55
  89. package/src/components/Icon/index.ts +7 -1
  90. package/src/components/List/List.tsx +19 -23
  91. package/src/components/Modal/Modal.stories.tsx +2 -1
  92. package/src/components/Modal/Modal.tsx +130 -127
  93. package/src/components/Navigation/Menu/MegaMenu.tsx +70 -70
  94. package/src/components/Navigation/Nav/NavDropdown.tsx +1 -5
  95. package/src/components/Navigation/SideMenu/SideMenu.stories.tsx +128 -28
  96. package/src/components/Navigation/SideMenu/SideMenu.tsx +5 -7
  97. package/src/components/Navigation/SideMenu/SideMenuItem.tsx +4 -5
  98. package/src/components/Pagination/Pagination.stories.tsx +7 -4
  99. package/src/components/Pagination/Pagination.tsx +199 -202
  100. package/src/components/PhotoViewer/PhotoViewer.tsx +4 -1
  101. package/src/components/Popover/Popover.stories.tsx +99 -192
  102. package/src/components/Popover/Popover.tsx +41 -37
  103. package/src/components/Progress/Progress.stories.tsx +35 -44
  104. package/src/components/River/River.stories.tsx +2 -1
  105. package/src/components/SectionIntro/SectionIntro.stories.tsx +71 -71
  106. package/src/components/Slider/Slider.stories.tsx +12 -4
  107. package/src/components/Spinner/Spinner.stories.tsx +3 -1
  108. package/src/components/Spinner/Spinner.test.tsx +23 -23
  109. package/src/components/Spinner/Spinner.tsx +43 -46
  110. package/src/components/Steps/Steps.stories.tsx +8 -6
  111. package/src/components/Tabs/Tabs.stories.tsx +12 -9
  112. package/src/components/Tabs/Tabs.tsx +74 -72
  113. package/src/components/Toggle/Toggle.stories.tsx +27 -13
  114. package/src/components/Toggle/Toggle.test.tsx +65 -70
  115. package/src/components/Toggle/Toggle.tsx +4 -1
  116. package/src/components/Tooltip/Tooltip.stories.tsx +24 -20
  117. package/src/components/Tooltip/Tooltip.tsx +104 -106
  118. package/src/components/Upload/Upload.stories.tsx +129 -127
  119. package/src/components/Upload/Upload.tsx +287 -283
  120. package/src/components/VideoPlayer/VideoPlayer.tsx +6 -1
  121. package/src/components/index.ts +13 -2
  122. package/src/layouts/Grid/Grid.stories.tsx +9 -3
  123. package/src/layouts/MasonryGrid/MasonryGrid.tsx +5 -1
  124. package/src/lib/__tests__/theme-tools.test.ts +32 -6
  125. package/src/lib/composables/shared-mouse-tracker.ts +13 -14
  126. package/src/lib/composables/useAtomixGlass.ts +106 -49
  127. package/src/lib/composables/useChartExport.ts +1 -1
  128. package/src/lib/composables/useDataTable.ts +29 -17
  129. package/src/lib/composables/useHero.ts +58 -14
  130. package/src/lib/composables/useHeroBackgroundSlider.ts +2 -9
  131. package/src/lib/composables/useInput.ts +10 -8
  132. package/src/lib/composables/useSideMenu.ts +6 -5
  133. package/src/lib/composables/useTooltip.ts +1 -2
  134. package/src/lib/composables/useVideoPlayer.ts +44 -35
  135. package/src/lib/config/index.ts +154 -154
  136. package/src/lib/constants/cssVariables.ts +29 -29
  137. package/src/lib/hooks/__tests__/useComponentCustomization.test.ts +2 -6
  138. package/src/lib/hooks/index.ts +1 -1
  139. package/src/lib/hooks/useComponentCustomization.ts +11 -17
  140. package/src/lib/hooks/usePerformanceMonitor.ts +6 -7
  141. package/src/lib/patterns/__tests__/slots.test.ts +1 -1
  142. package/src/lib/patterns/index.ts +1 -1
  143. package/src/lib/patterns/slots.tsx +8 -13
  144. package/src/lib/storybook/InteractiveDemo.tsx +13 -18
  145. package/src/lib/storybook/PreviewContainer.tsx +1 -1
  146. package/src/lib/storybook/VariantsGrid.tsx +3 -7
  147. package/src/lib/storybook/index.ts +1 -1
  148. package/src/lib/theme/adapters/cssVariableMapper.ts +47 -74
  149. package/src/lib/theme/adapters/index.ts +3 -9
  150. package/src/lib/theme/adapters/themeAdapter.ts +41 -26
  151. package/src/lib/theme/config/index.ts +1 -1
  152. package/src/lib/theme/config/types.ts +2 -2
  153. package/src/lib/theme/config/validator.ts +10 -5
  154. package/src/lib/theme/constants/constants.ts +2 -2
  155. package/src/lib/theme/constants/index.ts +1 -2
  156. package/src/lib/theme/core/__tests__/createTheme.test.ts +20 -22
  157. package/src/lib/theme/core/composeTheme.ts +32 -26
  158. package/src/lib/theme/core/createTheme.ts +1 -1
  159. package/src/lib/theme/core/createThemeObject.ts +308 -301
  160. package/src/lib/theme/core/index.ts +3 -3
  161. package/src/lib/theme/devtools/CLI.ts +106 -104
  162. package/src/lib/theme/devtools/Comparator.tsx +50 -32
  163. package/src/lib/theme/devtools/DesignTokensCustomizer.stories.tsx +50 -48
  164. package/src/lib/theme/devtools/DesignTokensCustomizer.tsx +257 -63
  165. package/src/lib/theme/devtools/Inspector.tsx +75 -60
  166. package/src/lib/theme/devtools/LiveEditor.tsx +97 -76
  167. package/src/lib/theme/devtools/Preview.tsx +150 -106
  168. package/src/lib/theme/devtools/ThemeValidator.ts +29 -21
  169. package/src/lib/theme/devtools/index.ts +3 -9
  170. package/src/lib/theme/devtools/useHistory.ts +23 -21
  171. package/src/lib/theme/errors/errors.ts +12 -11
  172. package/src/lib/theme/errors/index.ts +2 -7
  173. package/src/lib/theme/generators/generateCSS.ts +9 -13
  174. package/src/lib/theme/generators/generateCSSNested.ts +1 -6
  175. package/src/lib/theme/generators/generateCSSVariables.ts +673 -630
  176. package/src/lib/theme/generators/index.ts +1 -4
  177. package/src/lib/theme/i18n/index.ts +1 -1
  178. package/src/lib/theme/i18n/rtl.ts +13 -13
  179. package/src/lib/theme/index.ts +7 -16
  180. package/src/lib/theme/runtime/ThemeApplicator.ts +4 -4
  181. package/src/lib/theme/runtime/ThemeContext.tsx +1 -1
  182. package/src/lib/theme/runtime/ThemeErrorBoundary.tsx +19 -23
  183. package/src/lib/theme/runtime/ThemeProvider.tsx +230 -239
  184. package/src/lib/theme/runtime/__tests__/ThemeProvider.integration.test.tsx +1 -1
  185. package/src/lib/theme/runtime/__tests__/ThemeProvider.test.tsx +24 -29
  186. package/src/lib/theme/runtime/index.ts +2 -5
  187. package/src/lib/theme/runtime/useTheme.ts +18 -18
  188. package/src/lib/theme/runtime/useThemeTokens.ts +22 -22
  189. package/src/lib/theme/test/testTheme.ts +15 -16
  190. package/src/lib/theme/tokens/index.ts +2 -7
  191. package/src/lib/theme/tokens/tokens.ts +25 -24
  192. package/src/lib/theme/types.ts +428 -411
  193. package/src/lib/theme/utils/__tests__/themeValidation.test.ts +3 -3
  194. package/src/lib/theme/utils/componentTheming.ts +18 -18
  195. package/src/lib/theme/utils/domUtils.ts +277 -289
  196. package/src/lib/theme/utils/index.ts +1 -2
  197. package/src/lib/theme/utils/injectCSS.ts +10 -14
  198. package/src/lib/theme/utils/naming.ts +20 -16
  199. package/src/lib/theme/utils/themeHelpers.ts +10 -12
  200. package/src/lib/theme/utils/themeUtils.ts +85 -86
  201. package/src/lib/theme/utils/themeValidation.ts +82 -33
  202. package/src/lib/theme-tools.ts +8 -6
  203. package/src/lib/types/components.ts +172 -71
  204. package/src/lib/types/partProps.ts +1 -1
  205. package/src/lib/utils/__tests__/csv.test.ts +1 -1
  206. package/src/lib/utils/componentUtils.ts +8 -12
  207. package/src/lib/utils/csv.ts +3 -1
  208. package/src/lib/utils/dataTableExport.ts +1 -5
  209. package/src/lib/utils/fontPreloader.ts +10 -19
  210. package/src/lib/utils/icons.ts +4 -1
  211. package/src/lib/utils/index.ts +2 -6
  212. package/src/lib/utils/memoryMonitor.ts +10 -8
  213. package/src/lib/utils/themeNaming.ts +2 -2
  214. package/src/styles/01-settings/_index.scss +0 -1
  215. package/src/styles/01-settings/_settings.colors.scss +8 -8
  216. package/src/styles/01-settings/_settings.design-tokens.scss +61 -50
  217. package/src/styles/01-settings/_settings.navbar.scss +1 -1
  218. package/src/styles/01-settings/_settings.spacing.scss +3 -4
  219. package/src/styles/01-settings/_settings.tooltip.scss +1 -1
  220. package/src/styles/01-settings/_settings.typography.scss +1 -1
  221. package/src/styles/02-tools/_tools.button.scss +51 -21
  222. package/src/styles/02-tools/_tools.utility-api.scss +30 -18
  223. package/src/styles/03-generic/_generic.root.scss +4 -3
  224. package/src/styles/06-components/_components.atomix-glass.scss +13 -9
  225. package/src/styles/06-components/_components.button.scss +16 -4
  226. package/src/styles/06-components/_components.callout.scss +27 -21
  227. package/src/styles/06-components/_components.card.scss +5 -14
  228. package/src/styles/06-components/_components.chart.scss +22 -19
  229. package/src/styles/06-components/_components.checkbox.scss +3 -1
  230. package/src/styles/06-components/_components.color-mode-toggle.scss +3 -1
  231. package/src/styles/06-components/_components.edge-panel.scss +9 -2
  232. package/src/styles/06-components/_components.footer.scss +1 -1
  233. package/src/styles/06-components/_components.side-menu.scss +5 -5
  234. package/src/styles/06-components/_components.toggle.scss +18 -0
  235. package/src/styles/06-components/_index.scss +1 -1
  236. package/src/styles/06-components/old.chart.styles.scss +0 -2
  237. package/src/styles/99-utilities/_utilities.border.scss +69 -27
  238. package/src/styles/99-utilities/_utilities.display.scss +1 -1
  239. package/src/styles/99-utilities/_utilities.opacity.scss +10 -0
  240. package/src/styles/99-utilities/_utilities.position.scss +16 -9
  241. package/src/styles/99-utilities/_utilities.scss +1 -1
  242. package/src/styles/99-utilities/_utilities.sizes.scss +47 -18
  243. package/src/styles/99-utilities/_utilities.spacing.scss +118 -66
  244. package/src/styles/99-utilities/_utilities.text-gradient.scss +30 -30
  245. package/src/styles/99-utilities/_utilities.text.scss +67 -46
@@ -254,7 +254,8 @@ export const UsageExamples: Story = {
254
254
  parameters: {
255
255
  docs: {
256
256
  description: {
257
- story: 'Practical examples demonstrating how badges can be used in real-world scenarios such as navigation menus, product cards, and task lists.',
257
+ story:
258
+ 'Practical examples demonstrating how badges can be used in real-world scenarios such as navigation menus, product cards, and task lists.',
258
259
  },
259
260
  },
260
261
  },
@@ -325,7 +326,8 @@ export const AccessibilityFeatures: Story = {
325
326
  parameters: {
326
327
  docs: {
327
328
  description: {
328
- story: 'Examples of accessible badge implementations with proper ARIA labels and keyboard navigation support.',
329
+ story:
330
+ 'Examples of accessible badge implementations with proper ARIA labels and keyboard navigation support.',
329
331
  },
330
332
  },
331
333
  },
@@ -338,14 +340,11 @@ export const AccessibilityFeatures: Story = {
338
340
  <Badge label="Alert" variant="error" aria-label="Critical notification" />
339
341
  </div>
340
342
  </div>
341
-
343
+
342
344
  <div>
343
345
  <h3 className="u-mt-0 u-mb-2">Interactive Badges</h3>
344
346
  <div className="u-flex u-gap-2">
345
- <Badge
346
- label="Closable Tag"
347
- variant="info"
348
- />
347
+ <Badge label="Closable Tag" variant="info" />
349
348
  </div>
350
349
  </div>
351
350
  </div>
@@ -361,7 +360,13 @@ export const WithGlassEffect: Story = {
361
360
  variant: 'primary',
362
361
  },
363
362
  render: () => (
364
- <div className="u-bg-cover u-bg-center u-rounded-xl u-p-24" style={{backgroundImage: 'url(https://cdn.pixabay.com/photo/2023/07/07/20/42/grasshopper-8113345_1280.jpg)'}}>
363
+ <div
364
+ className="u-bg-cover u-bg-center u-rounded-xl u-p-24"
365
+ style={{
366
+ backgroundImage:
367
+ 'url(https://cdn.pixabay.com/photo/2023/07/07/20/42/grasshopper-8113345_1280.jpg)',
368
+ }}
369
+ >
365
370
  <div className="u-flex u-flex-wrap u-gap-2">
366
371
  {THEME_COLORS.map(color => (
367
372
  <Badge key={color} label={color} variant={color} glass={true} />
@@ -390,7 +395,13 @@ export const WithCustomGlassSettings: Story = {
390
395
  },
391
396
  decorators: [
392
397
  Story => (
393
- <div className="u-bg-cover u-bg-center u-rounded-xl u-p-24" style={{backgroundImage: 'url(https://cdn.pixabay.com/photo/2021/06/14/22/46/milky-way-6337038_1280.jpg)'}}>
398
+ <div
399
+ className="u-bg-cover u-bg-center u-rounded-xl u-p-24"
400
+ style={{
401
+ backgroundImage:
402
+ 'url(https://cdn.pixabay.com/photo/2021/06/14/22/46/milky-way-6337038_1280.jpg)',
403
+ }}
404
+ >
394
405
  <Story />
395
406
  </div>
396
407
  ),
@@ -4,48 +4,48 @@ import { Badge } from './Badge';
4
4
 
5
5
  // Mock AtomixGlass component
6
6
  vi.mock('../AtomixGlass/AtomixGlass', () => ({
7
- AtomixGlass: ({ children, ...props }: any) => (
8
- <div data-testid="atomix-glass" data-glass-props={JSON.stringify(props)}>
9
- {children}
10
- </div>
11
- ),
7
+ AtomixGlass: ({ children, ...props }: any) => (
8
+ <div data-testid="atomix-glass" data-glass-props={JSON.stringify(props)}>
9
+ {children}
10
+ </div>
11
+ ),
12
12
  }));
13
13
 
14
14
  describe('Badge Component', () => {
15
- it('renders correctly', () => {
16
- render(<Badge label="Test Badge" />);
17
- expect(screen.getByText('Test Badge')).toBeInTheDocument();
18
- });
19
-
20
- it('renders with aria-label', () => {
21
- render(<Badge label="Badge" aria-label="Accessible Badge" />);
22
- expect(screen.getByLabelText('Accessible Badge')).toBeInTheDocument();
23
- });
24
-
25
- it('renders close button when onRemove is provided', () => {
26
- const handleRemove = vi.fn();
27
- render(<Badge label="Removable" onRemove={handleRemove} />);
28
-
29
- const closeButton = screen.getByRole('button', { name: 'Remove badge' });
30
- expect(closeButton).toBeInTheDocument();
31
-
32
- fireEvent.click(closeButton);
33
- expect(handleRemove).toHaveBeenCalledTimes(1);
34
- });
35
-
36
- it('does not render close button when onRemove is not provided', () => {
37
- render(<Badge label="Static" />);
38
- expect(screen.queryByRole('button')).not.toBeInTheDocument();
39
- });
40
-
41
- it('disables close button when badge is disabled', () => {
42
- const handleRemove = vi.fn();
43
- render(<Badge label="Disabled" onRemove={handleRemove} disabled />);
44
-
45
- const closeButton = screen.getByRole('button', { name: 'Remove badge' });
46
- expect(closeButton).toBeDisabled();
47
-
48
- fireEvent.click(closeButton);
49
- expect(handleRemove).not.toHaveBeenCalled();
50
- });
15
+ it('renders correctly', () => {
16
+ render(<Badge label="Test Badge" />);
17
+ expect(screen.getByText('Test Badge')).toBeInTheDocument();
18
+ });
19
+
20
+ it('renders with aria-label', () => {
21
+ render(<Badge label="Badge" aria-label="Accessible Badge" />);
22
+ expect(screen.getByLabelText('Accessible Badge')).toBeInTheDocument();
23
+ });
24
+
25
+ it('renders close button when onRemove is provided', () => {
26
+ const handleRemove = vi.fn();
27
+ render(<Badge label="Removable" onRemove={handleRemove} />);
28
+
29
+ const closeButton = screen.getByRole('button', { name: 'Remove badge' });
30
+ expect(closeButton).toBeInTheDocument();
31
+
32
+ fireEvent.click(closeButton);
33
+ expect(handleRemove).toHaveBeenCalledTimes(1);
34
+ });
35
+
36
+ it('does not render close button when onRemove is not provided', () => {
37
+ render(<Badge label="Static" />);
38
+ expect(screen.queryByRole('button')).not.toBeInTheDocument();
39
+ });
40
+
41
+ it('disables close button when badge is disabled', () => {
42
+ const handleRemove = vi.fn();
43
+ render(<Badge label="Disabled" onRemove={handleRemove} disabled />);
44
+
45
+ const closeButton = screen.getByRole('button', { name: 'Remove badge' });
46
+ expect(closeButton).toBeDisabled();
47
+
48
+ fireEvent.click(closeButton);
49
+ expect(handleRemove).not.toHaveBeenCalled();
50
+ });
51
51
  });
@@ -4,75 +4,77 @@ import { BADGE } from '../../lib/constants/components';
4
4
  import { BadgeProps } from '../../lib/types/components';
5
5
  import { AtomixGlass } from '../AtomixGlass/AtomixGlass';
6
6
 
7
- export const Badge: React.FC<BadgeProps> = memo(({
8
- label,
9
- variant = 'primary',
10
- size = 'md',
11
- disabled = false,
12
- icon,
13
- onRemove,
14
- 'aria-label': ariaLabel,
15
- className = '',
16
- glass,
17
- style,
18
- }) => {
19
- const { generateBadgeClass } = useBadge({
20
- variant,
21
- size,
22
- disabled,
23
- });
7
+ export const Badge: React.FC<BadgeProps> = memo(
8
+ ({
9
+ label,
10
+ variant = 'primary',
11
+ size = 'md',
12
+ disabled = false,
13
+ icon,
14
+ onRemove,
15
+ 'aria-label': ariaLabel,
16
+ className = '',
17
+ glass,
18
+ style,
19
+ }) => {
20
+ const { generateBadgeClass } = useBadge({
21
+ variant,
22
+ size,
23
+ disabled,
24
+ });
24
25
 
25
- const ref = useRef<HTMLSpanElement>(null);
26
+ const ref = useRef<HTMLSpanElement>(null);
26
27
 
27
- const badgeClass = generateBadgeClass({
28
- variant,
29
- size,
30
- disabled,
31
- className: `${className} ${glass ? 'c-badge--glass' : ''}`.trim(),
32
- });
28
+ const badgeClass = generateBadgeClass({
29
+ variant,
30
+ size,
31
+ disabled,
32
+ className: `${className} ${glass ? 'c-badge--glass' : ''}`.trim(),
33
+ });
33
34
 
34
- const badgeElement = (
35
- <span
36
- className={badgeClass}
37
- aria-disabled={disabled}
38
- aria-label={ariaLabel}
39
- ref={ref}
40
- style={style}
41
- >
42
- {icon && <span className={BADGE.ICON_CLASS}>{icon}</span>}
43
- <span>{label}</span>
44
- {onRemove && (
45
- <button
46
- type="button"
47
- className="c-badge__close"
48
- onClick={onRemove}
49
- aria-label="Remove badge"
50
- disabled={disabled}
51
- >
52
- ×
53
- </button>
54
- )}
55
- </span>
56
- );
35
+ const badgeElement = (
36
+ <span
37
+ className={badgeClass}
38
+ aria-disabled={disabled}
39
+ aria-label={ariaLabel}
40
+ ref={ref}
41
+ style={style}
42
+ >
43
+ {icon && <span className={BADGE.ICON_CLASS}>{icon}</span>}
44
+ <span>{label}</span>
45
+ {onRemove && (
46
+ <button
47
+ type="button"
48
+ className="c-badge__close"
49
+ onClick={onRemove}
50
+ aria-label="Remove badge"
51
+ disabled={disabled}
52
+ >
53
+ ×
54
+ </button>
55
+ )}
56
+ </span>
57
+ );
57
58
 
58
- if (glass) {
59
- // Default glass settings for badges
60
- const defaultGlassProps = {
61
- displacementScale: 20,
62
- cornerRadius: ref.current?.getBoundingClientRect().width
63
- ? ref.current?.getBoundingClientRect().width / 2
64
- : 16,
65
- className: 'c-badge--glass',
66
- elasticity: 0,
67
- };
59
+ if (glass) {
60
+ // Default glass settings for badges
61
+ const defaultGlassProps = {
62
+ displacementScale: 20,
63
+ cornerRadius: ref.current?.getBoundingClientRect().width
64
+ ? ref.current?.getBoundingClientRect().width / 2
65
+ : 16,
66
+ className: 'c-badge--glass',
67
+ elasticity: 0,
68
+ };
68
69
 
69
- const glassProps = glass === true ? defaultGlassProps : { ...defaultGlassProps, ...glass };
70
+ const glassProps = glass === true ? defaultGlassProps : { ...defaultGlassProps, ...glass };
70
71
 
71
- return <AtomixGlass {...glassProps}>{badgeElement}</AtomixGlass>;
72
- }
72
+ return <AtomixGlass {...glassProps}>{badgeElement}</AtomixGlass>;
73
+ }
73
74
 
74
- return badgeElement;
75
- });
75
+ return badgeElement;
76
+ }
77
+ );
76
78
 
77
79
  Badge.displayName = 'Badge';
78
80
 
@@ -178,7 +178,9 @@ export const ArticleLayout: Story = {
178
178
  <Block spacing="md" container={{ type: 'sm' }} background="secondary">
179
179
  <h3>Ready to get started?</h3>
180
180
  <p>Join thousands of developers building with our design system.</p>
181
- <Button variant="primary" onClick={fn()}>Start Building</Button>
181
+ <Button variant="primary" onClick={fn()}>
182
+ Start Building
183
+ </Button>
182
184
  </Block>
183
185
  </div>
184
186
  ),
@@ -334,14 +336,22 @@ export const ContentPreview: Story = {
334
336
  <Card
335
337
  title="Cards"
336
338
  text="Flexible content containers with multiple options"
337
- actions={<Button variant="primary" onClick={fn()}>View Details</Button>}
339
+ actions={
340
+ <Button variant="primary" onClick={fn()}>
341
+ View Details
342
+ </Button>
343
+ }
338
344
  />
339
345
  </GridCol>
340
346
  <GridCol xs={12} md={6} lg={4}>
341
347
  <Card
342
348
  title="Blocks"
343
349
  text="Layout containers with consistent spacing and backgrounds"
344
- actions={<Button variant="primary" onClick={fn()}>Learn More</Button>}
350
+ actions={
351
+ <Button variant="primary" onClick={fn()}>
352
+ Learn More
353
+ </Button>
354
+ }
345
355
  />
346
356
  </GridCol>
347
357
  </Grid>
@@ -398,4 +408,4 @@ export const ContentPreview: Story = {
398
408
  </Block>
399
409
  </div>
400
410
  ),
401
- };
411
+ };
@@ -181,18 +181,18 @@ export const WithMixedInteractions: Story = {
181
181
  args: {
182
182
  items: [
183
183
  { label: 'Home', href: '/' },
184
- {
185
- label: 'Products',
184
+ {
185
+ label: 'Products',
186
186
  onClick: fn(),
187
187
  // Simulating client-side navigation
188
188
  },
189
- {
190
- label: 'Category',
189
+ {
190
+ label: 'Category',
191
191
  href: '/products/category',
192
192
  icon: <Icon name="Folder" size="sm" />,
193
193
  },
194
- {
195
- label: 'Product Name',
194
+ {
195
+ label: 'Product Name',
196
196
  active: true,
197
197
  icon: <Icon name="Tag" size="sm" />,
198
198
  },
@@ -202,7 +202,8 @@ export const WithMixedInteractions: Story = {
202
202
  parameters: {
203
203
  docs: {
204
204
  description: {
205
- story: 'Breadcrumb combining both traditional link navigation and client-side interactions.',
205
+ story:
206
+ 'Breadcrumb combining both traditional link navigation and client-side interactions.',
206
207
  },
207
208
  },
208
209
  },
@@ -228,4 +229,4 @@ export const LongBreadcrumbPath: Story = {
228
229
  },
229
230
  },
230
231
  },
231
- };
232
+ };
@@ -69,67 +69,69 @@ export interface BreadcrumbProps {
69
69
  */
70
70
  style?: React.CSSProperties;
71
71
  }
72
- export const Breadcrumb: React.FC<BreadcrumbProps> = memo(({
73
- items,
74
- divider,
75
- className = '',
76
- 'aria-label': ariaLabel = 'Breadcrumb',
77
- LinkComponent,
78
- style,
79
- }) => {
80
- const breadcrumbClasses = [BREADCRUMB.CLASSES.BASE, className].filter(Boolean).join(' ');
81
-
82
- return (
83
- <nav aria-label={ariaLabel} style={style}>
84
- <ol className={breadcrumbClasses}>
85
- {items.map((item, index) => {
86
- const isLast = index === items.length - 1;
87
- const itemClasses = [
88
- BREADCRUMB.CLASSES.ITEM,
89
- item.active || isLast ? BREADCRUMB.CLASSES.ACTIVE : '',
90
- ]
91
- .filter(Boolean)
92
- .join(' ');
93
-
94
- const linkContent = (
95
- <>
96
- {item.icon && <span className="c-breadcrumb__icon">{item.icon}</span>}
97
- {item.label}
98
- </>
99
- );
100
-
101
- const linkProps = {
102
- href: item.href,
103
- className: BREADCRUMB.CLASSES.LINK,
104
- onClick: item.onClick,
105
- style: item.style,
106
- };
107
-
108
- return (
109
- <li key={index} className={itemClasses} style={item.style}>
110
- {item.href && !item.active ? (
111
- LinkComponent ? (
112
- (() => {
113
- const Component = LinkComponent as React.ComponentType<any>;
114
- return (
115
- <Component {...(linkProps as React.ComponentProps<React.ElementType>)}>
116
- {linkContent}
117
- </Component>
118
- );
119
- })()
72
+ export const Breadcrumb: React.FC<BreadcrumbProps> = memo(
73
+ ({
74
+ items,
75
+ divider,
76
+ className = '',
77
+ 'aria-label': ariaLabel = 'Breadcrumb',
78
+ LinkComponent,
79
+ style,
80
+ }) => {
81
+ const breadcrumbClasses = [BREADCRUMB.CLASSES.BASE, className].filter(Boolean).join(' ');
82
+
83
+ return (
84
+ <nav aria-label={ariaLabel} style={style}>
85
+ <ol className={breadcrumbClasses}>
86
+ {items.map((item, index) => {
87
+ const isLast = index === items.length - 1;
88
+ const itemClasses = [
89
+ BREADCRUMB.CLASSES.ITEM,
90
+ item.active || isLast ? BREADCRUMB.CLASSES.ACTIVE : '',
91
+ ]
92
+ .filter(Boolean)
93
+ .join(' ');
94
+
95
+ const linkContent = (
96
+ <>
97
+ {item.icon && <span className="c-breadcrumb__icon">{item.icon}</span>}
98
+ {item.label}
99
+ </>
100
+ );
101
+
102
+ const linkProps = {
103
+ href: item.href,
104
+ className: BREADCRUMB.CLASSES.LINK,
105
+ onClick: item.onClick,
106
+ style: item.style,
107
+ };
108
+
109
+ return (
110
+ <li key={index} className={itemClasses} style={item.style}>
111
+ {item.href && !item.active ? (
112
+ LinkComponent ? (
113
+ (() => {
114
+ const Component = LinkComponent as React.ComponentType<any>;
115
+ return (
116
+ <Component {...(linkProps as React.ComponentProps<React.ElementType>)}>
117
+ {linkContent}
118
+ </Component>
119
+ );
120
+ })()
121
+ ) : (
122
+ <a {...(linkProps as React.ComponentProps<'a'>)}>{linkContent}</a>
123
+ )
120
124
  ) : (
121
- <a {...(linkProps as React.ComponentProps<'a'>)}>{linkContent}</a>
122
- )
123
- ) : (
124
- <span className={BREADCRUMB.CLASSES.LINK}>{linkContent}</span>
125
- )}
126
- </li>
127
- );
128
- })}
129
- </ol>
130
- </nav>
131
- );
132
- });
125
+ <span className={BREADCRUMB.CLASSES.LINK}>{linkContent}</span>
126
+ )}
127
+ </li>
128
+ );
129
+ })}
130
+ </ol>
131
+ </nav>
132
+ );
133
+ }
134
+ );
133
135
 
134
136
  Breadcrumb.displayName = 'Breadcrumb';
135
137
 
@@ -41,7 +41,6 @@ const sampleData = {
41
41
  longText: 'Lorem ipsum dolor sit amet...'.repeat(20),
42
42
  };
43
43
 
44
-
45
44
  // ============================================================================
46
45
  // META CONFIGURATION
47
46
  // ============================================================================
@@ -508,13 +507,13 @@ export const CustomStyling: Story = {
508
507
  variant: 'primary',
509
508
  size: 'md',
510
509
  },
511
- render: (args) => (
512
- <Button
513
- {...args}
514
- style={{
515
- background: 'linear-gradient(45deg, #667eea, #764ba2)',
510
+ render: args => (
511
+ <Button
512
+ {...args}
513
+ style={{
514
+ background: 'linear-gradient(45deg, #667eea, #764ba2)',
516
515
  border: 'none',
517
- boxShadow: '0 4px 15px rgba(0, 0, 0, 0.2)'
516
+ boxShadow: '0 4px 15px rgba(0, 0, 0, 0.2)',
518
517
  }}
519
518
  />
520
519
  ),
@@ -579,21 +578,16 @@ export const NoIconFallback: Story = {
579
578
  export const WithAsyncAction: Story = {
580
579
  render: () => {
581
580
  const [isLoading, setIsLoading] = useState(false);
582
-
581
+
583
582
  const handleClick = useCallback(async () => {
584
583
  setIsLoading(true);
585
584
  // Simulate async operation
586
585
  await new Promise(resolve => setTimeout(resolve, 2000));
587
586
  setIsLoading(false);
588
587
  }, []);
589
-
588
+
590
589
  return (
591
- <Button
592
- label="Async Action"
593
- variant="primary"
594
- loading={isLoading}
595
- onClick={handleClick}
596
- />
590
+ <Button label="Async Action" variant="primary" loading={isLoading} onClick={handleClick} />
597
591
  );
598
592
  },
599
593
  };
@@ -695,11 +689,7 @@ export const WithKeyboardNavigation: Story = {
695
689
  export const WithScreenReader: Story = {
696
690
  render: () => (
697
691
  <div className="u-flex u-gap-2">
698
- <Button
699
- label="Announcement"
700
- variant="primary"
701
- aria-describedby="announcement-description"
702
- />
692
+ <Button label="Announcement" variant="primary" aria-describedby="announcement-description" />
703
693
  <div id="announcement-description" className="u-sr-only">
704
694
  This button triggers an announcement
705
695
  </div>
@@ -758,7 +748,8 @@ export const WithGlassEffect: Story = {
758
748
  <div
759
749
  className="u-bg-cover u-bg-center u-p-10 u-rounded-xl"
760
750
  style={{
761
- backgroundImage: 'url(https://cdn.pixabay.com/photo/2022/10/02/17/23/mushroom-7494046_1280.jpg)',
751
+ backgroundImage:
752
+ 'url(https://cdn.pixabay.com/photo/2022/10/02/17/23/mushroom-7494046_1280.jpg)',
762
753
  }}
763
754
  >
764
755
  <div className="u-flex u-flex-wrap u-gap-2">
@@ -788,6 +779,6 @@ export const WithCustomGlassSettings: Story = {
788
779
  },
789
780
  },
790
781
  decorators: [
791
- withBackground('https://cdn.pixabay.com/photo/2021/06/14/22/46/milky-way-6337038_1280.jpg')
782
+ withBackground('https://cdn.pixabay.com/photo/2021/06/14/22/46/milky-way-6337038_1280.jpg'),
792
783
  ],
793
784
  };