@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
@@ -1,13 +1,13 @@
1
1
  /**
2
2
  * createThemeObject - Create a theme object with computed values
3
- *
3
+ *
4
4
  * Similar to Material-UI's createTheme, this function accepts theme configuration
5
5
  * options and returns a complete theme object with computed values.
6
- *
6
+ *
7
7
  * NOTE: For most use cases, use the simple theme system's `createTheme` instead,
8
8
  * which generates CSS from DesignTokens. This function is for advanced use cases
9
9
  * that need the full Theme object structure.
10
- *
10
+ *
11
11
  * @example
12
12
  * ```typescript
13
13
  * const theme = createThemeObject({
@@ -23,20 +23,27 @@
23
23
  */
24
24
 
25
25
  import type {
26
- Theme,
27
- ThemeOptions,
28
- PaletteColor,
29
- PaletteOptions,
30
- TypographyOptions,
31
- SpacingOptions,
32
- SpacingFunction,
33
- BreakpointsOptions,
34
- ShadowOptions,
35
- TransitionOptions,
36
- ZIndexOptions,
37
- BorderRadiusOptions,
26
+ Theme,
27
+ ThemeOptions,
28
+ PaletteColor,
29
+ PaletteOptions,
30
+ TypographyOptions,
31
+ SpacingOptions,
32
+ SpacingFunction,
33
+ BreakpointsOptions,
34
+ ShadowOptions,
35
+ TransitionOptions,
36
+ ZIndexOptions,
37
+ BorderRadiusOptions,
38
38
  } from '../types';
39
- import { hexToRgb, getLuminance, getContrastText, lighten, darken, createSpacing } from '../utils/themeUtils';
39
+ import {
40
+ hexToRgb,
41
+ getLuminance,
42
+ getContrastText,
43
+ lighten,
44
+ darken,
45
+ createSpacing,
46
+ } from '../utils/themeUtils';
40
47
  import { deepMerge } from './composeTheme';
41
48
 
42
49
  // ============================================================================
@@ -44,184 +51,184 @@ import { deepMerge } from './composeTheme';
44
51
  // ============================================================================
45
52
 
46
53
  const DEFAULT_PALETTE: Theme['palette'] = {
47
- primary: {
48
- main: '#7c3aed', // Primary-6
49
- light: '#d0b2f5', // Primary-3
50
- dark: '#3c1583', // Primary-9
51
- contrastText: '#ffffff',
52
- },
53
- secondary: {
54
- main: '#f3f4f6', // Gray-2
55
- light: '#ffffff', // Gray-1
56
- dark: '#e5e7eb', // Gray-3
57
- contrastText: '#1f2937', // Gray-9
58
- },
59
- error: {
60
- main: '#ef4444', // Red-6
61
- light: '#fca5a5', // Red-4
62
- dark: '#991b1b', // Red-9
63
- contrastText: '#ffffff',
64
- },
65
- warning: {
66
- main: '#eab308', // Yellow-6
67
- light: '#fde047', // Yellow-4
68
- dark: '#854d0e', // Yellow-9
69
- contrastText: '#000000',
70
- },
71
- info: {
72
- main: '#3b82f6', // Blue-6
73
- light: '#93c5fd', // Blue-4
74
- dark: '#1e40af', // Blue-9
75
- contrastText: '#ffffff',
76
- },
77
- success: {
78
- main: '#22c55e', // Green-6
79
- light: '#86efac', // Green-4
80
- dark: '#166534', // Green-9
81
- contrastText: '#ffffff',
82
- },
83
- background: {
84
- default: '#ffffff', // Primary-bg
85
- paper: '#f3f4f6', // Secondary-bg
86
- subtle: '#d1d5db', // Gray-4 (Tertiary-bg)
87
- },
88
- text: {
89
- primary: '#111827', // Gray-10
90
- secondary: '#374151', // Gray-8
91
- disabled: '#9ca3af', // Gray-5
92
- },
54
+ primary: {
55
+ main: '#7c3aed', // Primary-6
56
+ light: '#d0b2f5', // Primary-3
57
+ dark: '#3c1583', // Primary-9
58
+ contrastText: '#ffffff',
59
+ },
60
+ secondary: {
61
+ main: '#f3f4f6', // Gray-2
62
+ light: '#ffffff', // Gray-1
63
+ dark: '#e5e7eb', // Gray-3
64
+ contrastText: '#1f2937', // Gray-9
65
+ },
66
+ error: {
67
+ main: '#ef4444', // Red-6
68
+ light: '#fca5a5', // Red-4
69
+ dark: '#991b1b', // Red-9
70
+ contrastText: '#ffffff',
71
+ },
72
+ warning: {
73
+ main: '#eab308', // Yellow-6
74
+ light: '#fde047', // Yellow-4
75
+ dark: '#854d0e', // Yellow-9
76
+ contrastText: '#000000',
77
+ },
78
+ info: {
79
+ main: '#3b82f6', // Blue-6
80
+ light: '#93c5fd', // Blue-4
81
+ dark: '#1e40af', // Blue-9
82
+ contrastText: '#ffffff',
83
+ },
84
+ success: {
85
+ main: '#22c55e', // Green-6
86
+ light: '#86efac', // Green-4
87
+ dark: '#166534', // Green-9
88
+ contrastText: '#ffffff',
89
+ },
90
+ background: {
91
+ default: '#ffffff', // Primary-bg
92
+ paper: '#f3f4f6', // Secondary-bg
93
+ subtle: '#d1d5db', // Gray-4 (Tertiary-bg)
94
+ },
95
+ text: {
96
+ primary: '#111827', // Gray-10
97
+ secondary: '#374151', // Gray-8
98
+ disabled: '#9ca3af', // Gray-5
99
+ },
93
100
  };
94
101
 
95
102
  const DEFAULT_TYPOGRAPHY: Theme['typography'] = {
96
- fontFamily: '"Roboto", "Helvetica Neue", "Helvetica", "Arial", sans-serif',
97
- fontSize: 16, // 1rem
98
- fontWeightLight: 300,
99
- fontWeightRegular: 400,
100
- fontWeightMedium: 500,
101
- fontWeightSemiBold: 600,
102
- fontWeightBold: 700,
103
- fontWeightHeavy: 800,
104
- fontWeightBlack: 900,
105
- h1: {
106
- fontSize: '2.5rem', // 40px
107
- fontWeight: 700,
108
- lineHeight: 1.3,
109
- letterSpacing: '-1px',
110
- },
111
- h2: {
112
- fontSize: '2rem', // 32px
113
- fontWeight: 700,
114
- lineHeight: 1.3,
115
- letterSpacing: '-1px',
116
- },
117
- h3: {
118
- fontSize: '1.5rem', // 24px
119
- fontWeight: 700,
120
- lineHeight: 1.3,
121
- letterSpacing: '-1px',
122
- },
123
- h4: {
124
- fontSize: '1.25rem', // 20px
125
- fontWeight: 700,
126
- lineHeight: 1.3,
127
- letterSpacing: '-0.5px',
128
- },
129
- h5: {
130
- fontSize: '1.125rem', // 18px
131
- fontWeight: 700,
132
- lineHeight: 1.3,
133
- letterSpacing: '-0.5px',
134
- },
135
- h6: {
136
- fontSize: '1rem', // 16px
137
- fontWeight: 700,
138
- lineHeight: 1.3,
139
- letterSpacing: '-0.5px',
140
- },
141
- body1: {
142
- fontSize: '1rem', // 16px
143
- fontWeight: 400,
144
- lineHeight: 1.2,
145
- },
146
- body2: {
147
- fontSize: '0.875rem', // 14px
148
- fontWeight: 400,
149
- lineHeight: 1.2,
150
- },
103
+ fontFamily: '"Roboto", "Helvetica Neue", "Helvetica", "Arial", sans-serif',
104
+ fontSize: 16, // 1rem
105
+ fontWeightLight: 300,
106
+ fontWeightRegular: 400,
107
+ fontWeightMedium: 500,
108
+ fontWeightSemiBold: 600,
109
+ fontWeightBold: 700,
110
+ fontWeightHeavy: 800,
111
+ fontWeightBlack: 900,
112
+ h1: {
113
+ fontSize: '2.5rem', // 40px
114
+ fontWeight: 700,
115
+ lineHeight: 1.3,
116
+ letterSpacing: '-1px',
117
+ },
118
+ h2: {
119
+ fontSize: '2rem', // 32px
120
+ fontWeight: 700,
121
+ lineHeight: 1.3,
122
+ letterSpacing: '-1px',
123
+ },
124
+ h3: {
125
+ fontSize: '1.5rem', // 24px
126
+ fontWeight: 700,
127
+ lineHeight: 1.3,
128
+ letterSpacing: '-1px',
129
+ },
130
+ h4: {
131
+ fontSize: '1.25rem', // 20px
132
+ fontWeight: 700,
133
+ lineHeight: 1.3,
134
+ letterSpacing: '-0.5px',
135
+ },
136
+ h5: {
137
+ fontSize: '1.125rem', // 18px
138
+ fontWeight: 700,
139
+ lineHeight: 1.3,
140
+ letterSpacing: '-0.5px',
141
+ },
142
+ h6: {
143
+ fontSize: '1rem', // 16px
144
+ fontWeight: 700,
145
+ lineHeight: 1.3,
146
+ letterSpacing: '-0.5px',
147
+ },
148
+ body1: {
149
+ fontSize: '1rem', // 16px
150
+ fontWeight: 400,
151
+ lineHeight: 1.2,
152
+ },
153
+ body2: {
154
+ fontSize: '0.875rem', // 14px
155
+ fontWeight: 400,
156
+ lineHeight: 1.2,
157
+ },
151
158
  };
152
159
 
153
160
  const DEFAULT_BREAKPOINTS: Theme['breakpoints'] = {
154
- values: {
155
- xs: 0,
156
- sm: 576,
157
- md: 768,
158
- lg: 992,
159
- xl: 1200,
160
- xxl: 1440,
161
- },
162
- unit: 'px',
163
- up: (key) => {
164
- const value = typeof key === 'number' ? key : DEFAULT_BREAKPOINTS.values[key] || 0;
165
- return `@media (min-width:${value}${DEFAULT_BREAKPOINTS.unit})`;
166
- },
167
- down: (key) => {
168
- const value = typeof key === 'number' ? key : DEFAULT_BREAKPOINTS.values[key] || 0;
169
- return `@media (max-width:${value - 0.05}${DEFAULT_BREAKPOINTS.unit})`;
170
- },
171
- between: (start, end) => {
172
- const startValue = typeof start === 'number' ? start : DEFAULT_BREAKPOINTS.values[start] || 0;
173
- const endValue = typeof end === 'number' ? end : DEFAULT_BREAKPOINTS.values[end] || 0;
174
- return `@media (min-width:${startValue}${DEFAULT_BREAKPOINTS.unit}) and (max-width:${endValue - 0.05}${DEFAULT_BREAKPOINTS.unit})`;
175
- },
161
+ values: {
162
+ xs: 0,
163
+ sm: 576,
164
+ md: 768,
165
+ lg: 992,
166
+ xl: 1200,
167
+ xxl: 1440,
168
+ },
169
+ unit: 'px',
170
+ up: key => {
171
+ const value = typeof key === 'number' ? key : DEFAULT_BREAKPOINTS.values[key] || 0;
172
+ return `@media (min-width:${value}${DEFAULT_BREAKPOINTS.unit})`;
173
+ },
174
+ down: key => {
175
+ const value = typeof key === 'number' ? key : DEFAULT_BREAKPOINTS.values[key] || 0;
176
+ return `@media (max-width:${value - 0.05}${DEFAULT_BREAKPOINTS.unit})`;
177
+ },
178
+ between: (start, end) => {
179
+ const startValue = typeof start === 'number' ? start : DEFAULT_BREAKPOINTS.values[start] || 0;
180
+ const endValue = typeof end === 'number' ? end : DEFAULT_BREAKPOINTS.values[end] || 0;
181
+ return `@media (min-width:${startValue}${DEFAULT_BREAKPOINTS.unit}) and (max-width:${endValue - 0.05}${DEFAULT_BREAKPOINTS.unit})`;
182
+ },
176
183
  };
177
184
 
178
185
  const DEFAULT_SHADOWS: Theme['shadows'] = {
179
- xs: '0px 1px 2px 0px rgba(45, 54, 67, 0.04), 0px 2px 4px 0px rgba(45, 54, 67, 0.08)',
180
- sm: '0 2px 4px rgba(0, 0, 0, 0.075)',
181
- md: '0 4px 8px rgba(0, 0, 0, 0.1)',
182
- lg: '0 16px 48px rgba(0, 0, 0, 0.175)',
183
- xl: '0px 16px 64px -8px rgba(45, 54, 67, 0.14)',
184
- inset: 'inset 0 1px 2px rgba(0, 0, 0, 0.075)',
186
+ xs: '0px 1px 2px 0px rgba(45, 54, 67, 0.04), 0px 2px 4px 0px rgba(45, 54, 67, 0.08)',
187
+ sm: '0 2px 4px rgba(0, 0, 0, 0.075)',
188
+ md: '0 4px 8px rgba(0, 0, 0, 0.1)',
189
+ lg: '0 16px 48px rgba(0, 0, 0, 0.175)',
190
+ xl: '0px 16px 64px -8px rgba(45, 54, 67, 0.14)',
191
+ inset: 'inset 0 1px 2px rgba(0, 0, 0, 0.075)',
185
192
  };
186
193
 
187
194
  const DEFAULT_TRANSITIONS: Theme['transitions'] = {
188
- duration: {
189
- shortest: 150,
190
- shorter: 200,
191
- short: 250,
192
- standard: 300,
193
- complex: 375,
194
- enteringScreen: 225,
195
- leavingScreen: 195,
196
- },
197
- easing: {
198
- easeInOut: 'cubic-bezier(0.4, 0, 0.2, 1)',
199
- easeOut: 'cubic-bezier(0.0, 0, 0.2, 1)',
200
- easeIn: 'cubic-bezier(0.4, 0, 1, 1)',
201
- sharp: 'cubic-bezier(0.4, 0, 0.6, 1)',
202
- },
195
+ duration: {
196
+ shortest: 150,
197
+ shorter: 200,
198
+ short: 250,
199
+ standard: 300,
200
+ complex: 375,
201
+ enteringScreen: 225,
202
+ leavingScreen: 195,
203
+ },
204
+ easing: {
205
+ easeInOut: 'cubic-bezier(0.4, 0, 0.2, 1)',
206
+ easeOut: 'cubic-bezier(0.0, 0, 0.2, 1)',
207
+ easeIn: 'cubic-bezier(0.4, 0, 1, 1)',
208
+ sharp: 'cubic-bezier(0.4, 0, 0.6, 1)',
209
+ },
203
210
  };
204
211
 
205
212
  const DEFAULT_ZINDEX: Theme['zIndex'] = {
206
- mobileStepper: 1000,
207
- speedDial: 1050,
208
- appBar: 1020,
209
- drawer: 1070,
210
- modal: 1040,
211
- snackbar: 1080,
212
- tooltip: 1060,
213
+ mobileStepper: 1000,
214
+ speedDial: 1050,
215
+ appBar: 1020,
216
+ drawer: 1070,
217
+ modal: 1040,
218
+ snackbar: 1080,
219
+ tooltip: 1060,
213
220
  };
214
221
 
215
222
  const DEFAULT_BORDER_RADIUS: Theme['borderRadius'] = {
216
- base: '0.5rem', // 8px (spacing-2)
217
- sm: '0.25rem', // 4px (spacing-1)
218
- md: '0.25rem', // 4px (spacing-1)
219
- lg: '0.625rem', // 10px (spacing-2.5)
220
- xl: '0.75rem', // 12px (spacing-3)
221
- xxl: '1rem', // 16px (spacing-4)
222
- '3xl': '1.5rem', // 24px (spacing-6)
223
- '4xl': '2rem', // 32px (spacing-8)
224
- pill: '50rem', // 800px (spacing-200)
223
+ base: '0.5rem', // 8px (spacing-2)
224
+ sm: '0.25rem', // 4px (spacing-1)
225
+ md: '0.25rem', // 4px (spacing-1)
226
+ lg: '0.625rem', // 10px (spacing-2.5)
227
+ xl: '0.75rem', // 12px (spacing-3)
228
+ xxl: '1rem', // 16px (spacing-4)
229
+ '3xl': '1.5rem', // 24px (spacing-6)
230
+ '4xl': '2rem', // 32px (spacing-8)
231
+ pill: '50rem', // 800px (spacing-200)
225
232
  };
226
233
 
227
234
  // ============================================================================
@@ -232,57 +239,57 @@ const DEFAULT_BORDER_RADIUS: Theme['borderRadius'] = {
232
239
  * Create a complete palette color from partial configuration
233
240
  */
234
241
  function createPaletteColor(color: Partial<PaletteColor> | string): PaletteColor {
235
- if (typeof color === 'string') {
236
- return {
237
- main: color,
238
- light: lighten(color),
239
- dark: darken(color),
240
- contrastText: getContrastText(color),
241
- };
242
- }
243
-
242
+ if (typeof color === 'string') {
244
243
  return {
245
- main: color.main || '#000000',
246
- light: color.light || lighten(color.main || '#000000'),
247
- dark: color.dark || darken(color.main || '#000000'),
248
- contrastText: color.contrastText || getContrastText(color.main || '#000000'),
244
+ main: color,
245
+ light: lighten(color),
246
+ dark: darken(color),
247
+ contrastText: getContrastText(color),
249
248
  };
250
- }
249
+ }
251
250
 
251
+ return {
252
+ main: color.main || '#000000',
253
+ light: color.light || lighten(color.main || '#000000'),
254
+ dark: color.dark || darken(color.main || '#000000'),
255
+ contrastText: color.contrastText || getContrastText(color.main || '#000000'),
256
+ };
257
+ }
252
258
 
253
259
  /**
254
260
  * Create breakpoints object
255
261
  */
256
262
  function createBreakpoints(breakpointsInput?: BreakpointsOptions): Theme['breakpoints'] {
257
- const values = {
258
- xs: 0,
259
- sm: 576,
260
- md: 768,
261
- lg: 992,
262
- xl: 1200,
263
- xxl: 1440,
264
- ...breakpointsInput?.values,
265
- };
263
+ const values = {
264
+ xs: 0,
265
+ sm: 576,
266
+ md: 768,
267
+ lg: 992,
268
+ xl: 1200,
269
+ xxl: 1440,
270
+ ...breakpointsInput?.values,
271
+ };
266
272
 
267
- const unit = breakpointsInput?.unit || 'px';
273
+ const unit = breakpointsInput?.unit || 'px';
268
274
 
269
- return {
270
- values,
271
- unit,
272
- up: (key) => {
273
- const value = typeof key === 'number' ? key : (values[key as keyof typeof values] ?? 0);
274
- return `@media (min-width:${value}${unit})`;
275
- },
276
- down: (key) => {
277
- const value = typeof key === 'number' ? key : (values[key as keyof typeof values] ?? 0);
278
- return `@media (max-width:${value - 0.05}${unit})`;
279
- },
280
- between: (start, end) => {
281
- const startValue = typeof start === 'number' ? start : (values[start as keyof typeof values] ?? 0);
282
- const endValue = typeof end === 'number' ? end : (values[end as keyof typeof values] ?? 0);
283
- return `@media (min-width:${startValue}${unit}) and (max-width:${endValue - 0.05}${unit})`;
284
- },
285
- };
275
+ return {
276
+ values,
277
+ unit,
278
+ up: key => {
279
+ const value = typeof key === 'number' ? key : (values[key as keyof typeof values] ?? 0);
280
+ return `@media (min-width:${value}${unit})`;
281
+ },
282
+ down: key => {
283
+ const value = typeof key === 'number' ? key : (values[key as keyof typeof values] ?? 0);
284
+ return `@media (max-width:${value - 0.05}${unit})`;
285
+ },
286
+ between: (start, end) => {
287
+ const startValue =
288
+ typeof start === 'number' ? start : (values[start as keyof typeof values] ?? 0);
289
+ const endValue = typeof end === 'number' ? end : (values[end as keyof typeof values] ?? 0);
290
+ return `@media (min-width:${startValue}${unit}) and (max-width:${endValue - 0.05}${unit})`;
291
+ },
292
+ };
286
293
  }
287
294
 
288
295
  // ============================================================================
@@ -291,106 +298,106 @@ function createBreakpoints(breakpointsInput?: BreakpointsOptions): Theme['breakp
291
298
 
292
299
  /**
293
300
  * Create a theme object with computed values
294
- *
301
+ *
295
302
  * @param options - Theme configuration options
296
303
  * @returns Complete theme object
297
304
  */
298
305
  export function createThemeObject(...options: ThemeOptions[]): Theme {
299
- // Merge all options by spreading them into a single object
300
- const mergedOptions = options.reduce((acc, option) => {
301
- // Cast option to any to avoid strict typing during merge
302
- const opt = option as any;
303
- return deepMerge(acc, opt || {}) as any;
304
- }, {} as any);
306
+ // Merge all options by spreading them into a single object
307
+ const mergedOptions = options.reduce((acc, option) => {
308
+ // Cast option to any to avoid strict typing during merge
309
+ const opt = option as any;
310
+ return deepMerge(acc, opt || {}) as any;
311
+ }, {} as any);
305
312
 
306
- // Create palette
307
- const palette: Theme['palette'] = {
308
- primary: createPaletteColor(mergedOptions.palette?.primary || DEFAULT_PALETTE.primary),
309
- secondary: createPaletteColor(mergedOptions.palette?.secondary || DEFAULT_PALETTE.secondary),
310
- error: createPaletteColor(mergedOptions.palette?.error || DEFAULT_PALETTE.error),
311
- warning: createPaletteColor(mergedOptions.palette?.warning || DEFAULT_PALETTE.warning),
312
- info: createPaletteColor(mergedOptions.palette?.info || DEFAULT_PALETTE.info),
313
- success: createPaletteColor(mergedOptions.palette?.success || DEFAULT_PALETTE.success),
314
- // Handle light and dark colors if provided
315
- ...(mergedOptions.palette?.light && {
316
- light: createPaletteColor(mergedOptions.palette.light),
317
- }),
318
- ...(mergedOptions.palette?.dark && {
319
- dark: createPaletteColor(mergedOptions.palette.dark),
320
- }),
321
- background: {
322
- default: mergedOptions.palette?.background?.default || DEFAULT_PALETTE.background.default,
323
- subtle: mergedOptions.palette?.background?.subtle || DEFAULT_PALETTE.background.subtle,
324
- },
325
- text: {
326
- primary: mergedOptions.palette?.text?.primary || DEFAULT_PALETTE.text.primary,
327
- secondary: mergedOptions.palette?.text?.secondary || DEFAULT_PALETTE.text.secondary,
328
- disabled: mergedOptions.palette?.text?.disabled || DEFAULT_PALETTE.text.disabled,
329
- },
330
- };
313
+ // Create palette
314
+ const palette: Theme['palette'] = {
315
+ primary: createPaletteColor(mergedOptions.palette?.primary || DEFAULT_PALETTE.primary),
316
+ secondary: createPaletteColor(mergedOptions.palette?.secondary || DEFAULT_PALETTE.secondary),
317
+ error: createPaletteColor(mergedOptions.palette?.error || DEFAULT_PALETTE.error),
318
+ warning: createPaletteColor(mergedOptions.palette?.warning || DEFAULT_PALETTE.warning),
319
+ info: createPaletteColor(mergedOptions.palette?.info || DEFAULT_PALETTE.info),
320
+ success: createPaletteColor(mergedOptions.palette?.success || DEFAULT_PALETTE.success),
321
+ // Handle light and dark colors if provided
322
+ ...(mergedOptions.palette?.light && {
323
+ light: createPaletteColor(mergedOptions.palette.light),
324
+ }),
325
+ ...(mergedOptions.palette?.dark && {
326
+ dark: createPaletteColor(mergedOptions.palette.dark),
327
+ }),
328
+ background: {
329
+ default: mergedOptions.palette?.background?.default || DEFAULT_PALETTE.background.default,
330
+ subtle: mergedOptions.palette?.background?.subtle || DEFAULT_PALETTE.background.subtle,
331
+ },
332
+ text: {
333
+ primary: mergedOptions.palette?.text?.primary || DEFAULT_PALETTE.text.primary,
334
+ secondary: mergedOptions.palette?.text?.secondary || DEFAULT_PALETTE.text.secondary,
335
+ disabled: mergedOptions.palette?.text?.disabled || DEFAULT_PALETTE.text.disabled,
336
+ },
337
+ };
331
338
 
332
- // Create typography
333
- const typography: Theme['typography'] = deepMerge(
334
- { ...DEFAULT_TYPOGRAPHY } as Partial<Theme['typography']>,
335
- (mergedOptions.typography || {}) as Partial<Theme['typography']>
336
- ) as Theme['typography'];
339
+ // Create typography
340
+ const typography: Theme['typography'] = deepMerge(
341
+ { ...DEFAULT_TYPOGRAPHY } as Partial<Theme['typography']>,
342
+ (mergedOptions.typography || {}) as Partial<Theme['typography']>
343
+ ) as Theme['typography'];
337
344
 
338
- // Create spacing
339
- const spacing = createSpacing(mergedOptions.spacing);
345
+ // Create spacing
346
+ const spacing = createSpacing(mergedOptions.spacing);
340
347
 
341
- // Create breakpoints
342
- const breakpoints = createBreakpoints(mergedOptions.breakpoints);
348
+ // Create breakpoints
349
+ const breakpoints = createBreakpoints(mergedOptions.breakpoints);
343
350
 
344
- // Create shadows
345
- const shadows: Theme['shadows'] = deepMerge({ ...DEFAULT_SHADOWS }, mergedOptions.shadows || {});
351
+ // Create shadows
352
+ const shadows: Theme['shadows'] = deepMerge({ ...DEFAULT_SHADOWS }, mergedOptions.shadows || {});
346
353
 
347
- // Create transitions
348
- const transitions: Theme['transitions'] = deepMerge(
349
- { ...DEFAULT_TRANSITIONS } as Partial<Theme['transitions']>,
350
- (mergedOptions.transitions || {}) as Partial<Theme['transitions']>
351
- ) as Theme['transitions'];
354
+ // Create transitions
355
+ const transitions: Theme['transitions'] = deepMerge(
356
+ { ...DEFAULT_TRANSITIONS } as Partial<Theme['transitions']>,
357
+ (mergedOptions.transitions || {}) as Partial<Theme['transitions']>
358
+ ) as Theme['transitions'];
352
359
 
353
- // Create z-index
354
- const zIndex: Theme['zIndex'] = deepMerge({ ...DEFAULT_ZINDEX }, mergedOptions.zIndex || {});
360
+ // Create z-index
361
+ const zIndex: Theme['zIndex'] = deepMerge({ ...DEFAULT_ZINDEX }, mergedOptions.zIndex || {});
355
362
 
356
- // Create border radius
357
- const borderRadius: Theme['borderRadius'] = deepMerge(
358
- { ...DEFAULT_BORDER_RADIUS },
359
- mergedOptions.borderRadius || {}
360
- );
363
+ // Create border radius
364
+ const borderRadius: Theme['borderRadius'] = deepMerge(
365
+ { ...DEFAULT_BORDER_RADIUS },
366
+ mergedOptions.borderRadius || {}
367
+ );
361
368
 
362
- // Create theme object
363
- const theme: Theme = {
364
- // Metadata
365
- name: mergedOptions.name || 'Custom Theme',
366
- class: mergedOptions.class,
367
- description: mergedOptions.description,
368
- author: mergedOptions.author,
369
- version: mergedOptions.version || '1.0.0',
370
- tags: mergedOptions.tags,
371
- supportsDarkMode: mergedOptions.supportsDarkMode,
372
- status: mergedOptions.status || 'experimental',
373
- a11y: mergedOptions.a11y,
374
- color: mergedOptions.color || palette.primary.main,
375
- features: mergedOptions.features,
376
- dependencies: mergedOptions.dependencies,
369
+ // Create theme object
370
+ const theme: Theme = {
371
+ // Metadata
372
+ name: mergedOptions.name || 'Custom Theme',
373
+ class: mergedOptions.class,
374
+ description: mergedOptions.description,
375
+ author: mergedOptions.author,
376
+ version: mergedOptions.version || '1.0.0',
377
+ tags: mergedOptions.tags,
378
+ supportsDarkMode: mergedOptions.supportsDarkMode,
379
+ status: mergedOptions.status || 'experimental',
380
+ a11y: mergedOptions.a11y,
381
+ color: mergedOptions.color || palette.primary.main,
382
+ features: mergedOptions.features,
383
+ dependencies: mergedOptions.dependencies,
377
384
 
378
- // Theme configuration
379
- palette,
380
- typography,
381
- spacing,
382
- breakpoints,
383
- shadows,
384
- transitions,
385
- zIndex,
386
- borderRadius,
387
- custom: mergedOptions.custom || {},
385
+ // Theme configuration
386
+ palette,
387
+ typography,
388
+ spacing,
389
+ breakpoints,
390
+ shadows,
391
+ transitions,
392
+ zIndex,
393
+ borderRadius,
394
+ custom: mergedOptions.custom || {},
388
395
 
389
- // Mark as JS theme
390
- __isJSTheme: true,
391
- };
396
+ // Mark as JS theme
397
+ __isJSTheme: true,
398
+ };
392
399
 
393
- return theme;
400
+ return theme;
394
401
  }
395
402
 
396
403
  export default createThemeObject;