@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.
- package/build-tools/index.d.ts +31 -30
- package/build-tools/package.json +4 -21
- package/dist/atomix.css +20924 -2611
- package/dist/atomix.css.map +1 -1
- package/dist/atomix.min.css +76 -2
- package/dist/atomix.min.css.map +1 -1
- package/dist/build-tools/index.d.ts +31 -30
- package/dist/build-tools/package.json +4 -21
- package/dist/charts.js.map +1 -1
- package/dist/core.js.map +1 -1
- package/dist/forms.js.map +1 -1
- package/dist/heavy.js.map +1 -1
- package/dist/index.d.ts +144 -18
- package/dist/index.esm.js +110 -55
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +110 -55
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/layout.js.map +1 -1
- package/dist/theme.d.ts +9 -9
- package/dist/theme.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Accordion/Accordion.stories.tsx +32 -23
- package/src/components/Accordion/Accordion.test.tsx +70 -50
- package/src/components/Accordion/Accordion.tsx +99 -94
- package/src/components/AtomixGlass/AtomixGlass.test.tsx +1 -1
- package/src/components/AtomixGlass/GlassFilter.tsx +9 -16
- package/src/components/AtomixGlass/glass-utils.ts +4 -3
- package/src/components/AtomixGlass/shader-utils.ts +128 -52
- package/src/components/AtomixGlass/stories/Playground.stories.tsx +1 -1
- package/src/components/AtomixGlass/stories/Shaders.stories.tsx +1 -1
- package/src/components/Avatar/Avatar.stories.tsx +45 -62
- package/src/components/Avatar/Avatar.tsx +58 -56
- package/src/components/Badge/Badge.stories.tsx +20 -9
- package/src/components/Badge/Badge.test.tsx +41 -41
- package/src/components/Badge/Badge.tsx +64 -62
- package/src/components/Block/Block.stories.tsx +14 -4
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +9 -8
- package/src/components/Breadcrumb/Breadcrumb.tsx +62 -60
- package/src/components/Button/Button.stories.tsx +13 -22
- package/src/components/Button/Button.test.tsx +97 -81
- package/src/components/Button/Button.tsx +46 -14
- package/src/components/Button/ButtonGroup.stories.tsx +37 -32
- package/src/components/Button/ButtonGroup.tsx +4 -15
- package/src/components/Callout/Callout.stories.tsx +109 -16
- package/src/components/Card/Card.stories.tsx +67 -36
- package/src/components/Card/Card.tsx +30 -14
- package/src/components/Chart/AreaChart.tsx +1 -1
- package/src/components/Chart/CandlestickChart.tsx +23 -16
- package/src/components/Chart/Chart.stories.tsx +4 -9
- package/src/components/Chart/Chart.tsx +40 -44
- package/src/components/Chart/ChartRenderer.tsx +39 -12
- package/src/components/Chart/ChartToolbar.tsx +21 -5
- package/src/components/Chart/DonutChart.tsx +1 -1
- package/src/components/Chart/FunnelChart.tsx +4 -1
- package/src/components/Chart/GaugeChart.tsx +3 -1
- package/src/components/Chart/HeatmapChart.tsx +50 -37
- package/src/components/Chart/LineChart.tsx +3 -2
- package/src/components/Chart/MultiAxisChart.tsx +24 -16
- package/src/components/Chart/RadarChart.tsx +19 -17
- package/src/components/Chart/ScatterChart.tsx +29 -21
- package/src/components/ColorModeToggle/ColorModeToggle.stories.tsx +6 -2
- package/src/components/ColorModeToggle/ColorModeToggle.tsx +15 -3
- package/src/components/Countdown/Countdown.stories.tsx +7 -7
- package/src/components/DataTable/DataTable.stories.tsx +43 -38
- package/src/components/DataTable/DataTable.test.tsx +26 -148
- package/src/components/DataTable/DataTable.tsx +485 -456
- package/src/components/DatePicker/DatePicker.stories.tsx +32 -47
- package/src/components/DatePicker/DatePicker.tsx +31 -26
- package/src/components/Dropdown/Dropdown.stories.tsx +2 -5
- package/src/components/Dropdown/Dropdown.tsx +313 -299
- package/src/components/EdgePanel/EdgePanel.stories.tsx +6 -19
- package/src/components/EdgePanel/EdgePanel.tsx +1 -3
- package/src/components/Footer/Footer.stories.tsx +21 -16
- package/src/components/Footer/Footer.tsx +130 -128
- package/src/components/Footer/FooterLink.tsx +2 -2
- package/src/components/Form/Checkbox.test.tsx +49 -49
- package/src/components/Form/Checkbox.tsx +108 -100
- package/src/components/Form/Form.stories.tsx +2 -10
- package/src/components/Form/Input.stories.tsx +22 -39
- package/src/components/Form/Input.test.tsx +38 -44
- package/src/components/Form/Radio.stories.tsx +6 -12
- package/src/components/Form/Radio.tsx +68 -66
- package/src/components/Form/Select.tsx +184 -182
- package/src/components/Form/Textarea.test.tsx +27 -32
- package/src/components/Hero/Hero.stories.tsx +56 -23
- package/src/components/Hero/Hero.tsx +201 -55
- package/src/components/Icon/index.ts +7 -1
- package/src/components/List/List.tsx +19 -23
- package/src/components/Modal/Modal.stories.tsx +2 -1
- package/src/components/Modal/Modal.tsx +130 -127
- package/src/components/Navigation/Menu/MegaMenu.tsx +70 -70
- package/src/components/Navigation/Nav/NavDropdown.tsx +1 -5
- package/src/components/Navigation/SideMenu/SideMenu.stories.tsx +128 -28
- package/src/components/Navigation/SideMenu/SideMenu.tsx +5 -7
- package/src/components/Navigation/SideMenu/SideMenuItem.tsx +4 -5
- package/src/components/Pagination/Pagination.stories.tsx +7 -4
- package/src/components/Pagination/Pagination.tsx +199 -202
- package/src/components/PhotoViewer/PhotoViewer.tsx +4 -1
- package/src/components/Popover/Popover.stories.tsx +99 -192
- package/src/components/Popover/Popover.tsx +41 -37
- package/src/components/Progress/Progress.stories.tsx +35 -44
- package/src/components/River/River.stories.tsx +2 -1
- package/src/components/SectionIntro/SectionIntro.stories.tsx +71 -71
- package/src/components/Slider/Slider.stories.tsx +12 -4
- package/src/components/Spinner/Spinner.stories.tsx +3 -1
- package/src/components/Spinner/Spinner.test.tsx +23 -23
- package/src/components/Spinner/Spinner.tsx +43 -46
- package/src/components/Steps/Steps.stories.tsx +8 -6
- package/src/components/Tabs/Tabs.stories.tsx +12 -9
- package/src/components/Tabs/Tabs.tsx +74 -72
- package/src/components/Toggle/Toggle.stories.tsx +27 -13
- package/src/components/Toggle/Toggle.test.tsx +65 -70
- package/src/components/Toggle/Toggle.tsx +4 -1
- package/src/components/Tooltip/Tooltip.stories.tsx +24 -20
- package/src/components/Tooltip/Tooltip.tsx +104 -106
- package/src/components/Upload/Upload.stories.tsx +129 -127
- package/src/components/Upload/Upload.tsx +287 -283
- package/src/components/VideoPlayer/VideoPlayer.tsx +6 -1
- package/src/components/index.ts +13 -2
- package/src/layouts/Grid/Grid.stories.tsx +9 -3
- package/src/layouts/MasonryGrid/MasonryGrid.tsx +5 -1
- package/src/lib/__tests__/theme-tools.test.ts +32 -6
- package/src/lib/composables/shared-mouse-tracker.ts +13 -14
- package/src/lib/composables/useAtomixGlass.ts +106 -49
- package/src/lib/composables/useChartExport.ts +1 -1
- package/src/lib/composables/useDataTable.ts +29 -17
- package/src/lib/composables/useHero.ts +58 -14
- package/src/lib/composables/useHeroBackgroundSlider.ts +2 -9
- package/src/lib/composables/useInput.ts +10 -8
- package/src/lib/composables/useSideMenu.ts +6 -5
- package/src/lib/composables/useTooltip.ts +1 -2
- package/src/lib/composables/useVideoPlayer.ts +44 -35
- package/src/lib/config/index.ts +154 -154
- package/src/lib/constants/cssVariables.ts +29 -29
- package/src/lib/hooks/__tests__/useComponentCustomization.test.ts +2 -6
- package/src/lib/hooks/index.ts +1 -1
- package/src/lib/hooks/useComponentCustomization.ts +11 -17
- package/src/lib/hooks/usePerformanceMonitor.ts +6 -7
- package/src/lib/patterns/__tests__/slots.test.ts +1 -1
- package/src/lib/patterns/index.ts +1 -1
- package/src/lib/patterns/slots.tsx +8 -13
- package/src/lib/storybook/InteractiveDemo.tsx +13 -18
- package/src/lib/storybook/PreviewContainer.tsx +1 -1
- package/src/lib/storybook/VariantsGrid.tsx +3 -7
- package/src/lib/storybook/index.ts +1 -1
- package/src/lib/theme/adapters/cssVariableMapper.ts +47 -74
- package/src/lib/theme/adapters/index.ts +3 -9
- package/src/lib/theme/adapters/themeAdapter.ts +41 -26
- package/src/lib/theme/config/index.ts +1 -1
- package/src/lib/theme/config/types.ts +2 -2
- package/src/lib/theme/config/validator.ts +10 -5
- package/src/lib/theme/constants/constants.ts +2 -2
- package/src/lib/theme/constants/index.ts +1 -2
- package/src/lib/theme/core/__tests__/createTheme.test.ts +20 -22
- package/src/lib/theme/core/composeTheme.ts +32 -26
- package/src/lib/theme/core/createTheme.ts +1 -1
- package/src/lib/theme/core/createThemeObject.ts +308 -301
- package/src/lib/theme/core/index.ts +3 -3
- package/src/lib/theme/devtools/CLI.ts +106 -104
- package/src/lib/theme/devtools/Comparator.tsx +50 -32
- package/src/lib/theme/devtools/DesignTokensCustomizer.stories.tsx +50 -48
- package/src/lib/theme/devtools/DesignTokensCustomizer.tsx +257 -63
- package/src/lib/theme/devtools/Inspector.tsx +75 -60
- package/src/lib/theme/devtools/LiveEditor.tsx +97 -76
- package/src/lib/theme/devtools/Preview.tsx +150 -106
- package/src/lib/theme/devtools/ThemeValidator.ts +29 -21
- package/src/lib/theme/devtools/index.ts +3 -9
- package/src/lib/theme/devtools/useHistory.ts +23 -21
- package/src/lib/theme/errors/errors.ts +12 -11
- package/src/lib/theme/errors/index.ts +2 -7
- package/src/lib/theme/generators/generateCSS.ts +9 -13
- package/src/lib/theme/generators/generateCSSNested.ts +1 -6
- package/src/lib/theme/generators/generateCSSVariables.ts +673 -630
- package/src/lib/theme/generators/index.ts +1 -4
- package/src/lib/theme/i18n/index.ts +1 -1
- package/src/lib/theme/i18n/rtl.ts +13 -13
- package/src/lib/theme/index.ts +7 -16
- package/src/lib/theme/runtime/ThemeApplicator.ts +4 -4
- package/src/lib/theme/runtime/ThemeContext.tsx +1 -1
- package/src/lib/theme/runtime/ThemeErrorBoundary.tsx +19 -23
- package/src/lib/theme/runtime/ThemeProvider.tsx +230 -239
- package/src/lib/theme/runtime/__tests__/ThemeProvider.integration.test.tsx +1 -1
- package/src/lib/theme/runtime/__tests__/ThemeProvider.test.tsx +24 -29
- package/src/lib/theme/runtime/index.ts +2 -5
- package/src/lib/theme/runtime/useTheme.ts +18 -18
- package/src/lib/theme/runtime/useThemeTokens.ts +22 -22
- package/src/lib/theme/test/testTheme.ts +15 -16
- package/src/lib/theme/tokens/index.ts +2 -7
- package/src/lib/theme/tokens/tokens.ts +25 -24
- package/src/lib/theme/types.ts +428 -411
- package/src/lib/theme/utils/__tests__/themeValidation.test.ts +3 -3
- package/src/lib/theme/utils/componentTheming.ts +18 -18
- package/src/lib/theme/utils/domUtils.ts +277 -289
- package/src/lib/theme/utils/index.ts +1 -2
- package/src/lib/theme/utils/injectCSS.ts +10 -14
- package/src/lib/theme/utils/naming.ts +20 -16
- package/src/lib/theme/utils/themeHelpers.ts +10 -12
- package/src/lib/theme/utils/themeUtils.ts +85 -86
- package/src/lib/theme/utils/themeValidation.ts +82 -33
- package/src/lib/theme-tools.ts +8 -6
- package/src/lib/types/components.ts +172 -71
- package/src/lib/types/partProps.ts +1 -1
- package/src/lib/utils/__tests__/csv.test.ts +1 -1
- package/src/lib/utils/componentUtils.ts +8 -12
- package/src/lib/utils/csv.ts +3 -1
- package/src/lib/utils/dataTableExport.ts +1 -5
- package/src/lib/utils/fontPreloader.ts +10 -19
- package/src/lib/utils/icons.ts +4 -1
- package/src/lib/utils/index.ts +2 -6
- package/src/lib/utils/memoryMonitor.ts +10 -8
- package/src/lib/utils/themeNaming.ts +2 -2
- package/src/styles/01-settings/_index.scss +0 -1
- package/src/styles/01-settings/_settings.colors.scss +8 -8
- package/src/styles/01-settings/_settings.design-tokens.scss +61 -50
- package/src/styles/01-settings/_settings.navbar.scss +1 -1
- package/src/styles/01-settings/_settings.spacing.scss +3 -4
- package/src/styles/01-settings/_settings.tooltip.scss +1 -1
- package/src/styles/01-settings/_settings.typography.scss +1 -1
- package/src/styles/02-tools/_tools.button.scss +51 -21
- package/src/styles/02-tools/_tools.utility-api.scss +30 -18
- package/src/styles/03-generic/_generic.root.scss +4 -3
- package/src/styles/06-components/_components.atomix-glass.scss +13 -9
- package/src/styles/06-components/_components.button.scss +16 -4
- package/src/styles/06-components/_components.callout.scss +27 -21
- package/src/styles/06-components/_components.card.scss +5 -14
- package/src/styles/06-components/_components.chart.scss +22 -19
- package/src/styles/06-components/_components.checkbox.scss +3 -1
- package/src/styles/06-components/_components.color-mode-toggle.scss +3 -1
- package/src/styles/06-components/_components.edge-panel.scss +9 -2
- package/src/styles/06-components/_components.footer.scss +1 -1
- package/src/styles/06-components/_components.side-menu.scss +5 -5
- package/src/styles/06-components/_components.toggle.scss +18 -0
- package/src/styles/06-components/_index.scss +1 -1
- package/src/styles/06-components/old.chart.styles.scss +0 -2
- package/src/styles/99-utilities/_utilities.border.scss +69 -27
- package/src/styles/99-utilities/_utilities.display.scss +1 -1
- package/src/styles/99-utilities/_utilities.opacity.scss +10 -0
- package/src/styles/99-utilities/_utilities.position.scss +16 -9
- package/src/styles/99-utilities/_utilities.scss +1 -1
- package/src/styles/99-utilities/_utilities.sizes.scss +47 -18
- package/src/styles/99-utilities/_utilities.spacing.scss +118 -66
- package/src/styles/99-utilities/_utilities.text-gradient.scss +30 -30
- 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
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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 {
|
|
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
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
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
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
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
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
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
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
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
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
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
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
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
|
-
|
|
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
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
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
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
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
|
-
|
|
273
|
+
const unit = breakpointsInput?.unit || 'px';
|
|
268
274
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
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
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
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
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
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
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
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
|
-
|
|
339
|
-
|
|
345
|
+
// Create spacing
|
|
346
|
+
const spacing = createSpacing(mergedOptions.spacing);
|
|
340
347
|
|
|
341
|
-
|
|
342
|
-
|
|
348
|
+
// Create breakpoints
|
|
349
|
+
const breakpoints = createBreakpoints(mergedOptions.breakpoints);
|
|
343
350
|
|
|
344
|
-
|
|
345
|
-
|
|
351
|
+
// Create shadows
|
|
352
|
+
const shadows: Theme['shadows'] = deepMerge({ ...DEFAULT_SHADOWS }, mergedOptions.shadows || {});
|
|
346
353
|
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
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
|
-
|
|
354
|
-
|
|
360
|
+
// Create z-index
|
|
361
|
+
const zIndex: Theme['zIndex'] = deepMerge({ ...DEFAULT_ZINDEX }, mergedOptions.zIndex || {});
|
|
355
362
|
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
363
|
+
// Create border radius
|
|
364
|
+
const borderRadius: Theme['borderRadius'] = deepMerge(
|
|
365
|
+
{ ...DEFAULT_BORDER_RADIUS },
|
|
366
|
+
mergedOptions.borderRadius || {}
|
|
367
|
+
);
|
|
361
368
|
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
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
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
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
|
-
|
|
390
|
-
|
|
391
|
-
|
|
396
|
+
// Mark as JS theme
|
|
397
|
+
__isJSTheme: true,
|
|
398
|
+
};
|
|
392
399
|
|
|
393
|
-
|
|
400
|
+
return theme;
|
|
394
401
|
}
|
|
395
402
|
|
|
396
403
|
export default createThemeObject;
|