@webpros/mui-theme 0.1.6 → 0.3.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/dist/package.json +21 -11
- package/dist/src/components/data-display/Avatar/Avatar.theme.js +11 -8
- package/dist/src/components/data-display/Badge/Badge.theme.d.ts +4 -1
- package/dist/src/components/data-display/Badge/Badge.theme.js +216 -55
- package/dist/src/components/data-display/Chip/Chip.theme.d.ts +17 -3
- package/dist/src/components/data-display/Chip/Chip.theme.js +133 -477
- package/dist/src/components/data-display/Chip/get-chip-colors-map.d.ts +42 -0
- package/dist/src/components/data-display/Chip/get-chip-colors-map.js +253 -0
- package/dist/src/components/data-display/Divider/Divider.theme.d.ts +6 -1
- package/dist/src/components/data-display/Divider/Divider.theme.js +60 -3
- package/dist/src/components/data-display/List/List.theme.d.ts +1 -1
- package/dist/src/components/data-display/List/List.theme.js +1 -1
- package/dist/src/components/data-display/ListItem/ListItem.theme.d.ts +1 -1
- package/dist/src/components/data-display/ListItem/ListItem.theme.js +16 -8
- package/dist/src/components/data-display/ListItemAvatar/ListItemAvatar.theme.js +1 -2
- package/dist/src/components/data-display/ListItemButton/ListItemButton.theme.d.ts +0 -5
- package/dist/src/components/data-display/ListItemButton/ListItemButton.theme.js +14 -48
- package/dist/src/components/data-display/ListItemIcon/ListItemIcon.theme.js +4 -4
- package/dist/src/components/data-display/ListSubheader/ListSubheader.theme.d.ts +1 -1
- package/dist/src/components/data-display/ListSubheader/ListSubheader.theme.js +2 -5
- package/dist/src/components/data-display/Skeleton/Skeleton.d.ts +3 -0
- package/dist/src/components/data-display/Skeleton/Skeleton.js +4 -0
- package/dist/src/components/data-display/Skeleton/Skeleton.theme.d.ts +15 -0
- package/dist/src/components/data-display/Skeleton/Skeleton.theme.js +31 -0
- package/dist/src/components/data-display/Skeleton/index.d.ts +1 -0
- package/dist/src/components/data-display/Skeleton/index.js +2 -0
- package/dist/src/components/data-display/Tooltip/Tooltip.theme.js +7 -9
- package/dist/src/components/data-display/Typography/Typography.theme.d.ts +19 -26
- package/dist/src/components/data-display/Typography/Typography.theme.js +7 -163
- package/dist/src/components/feedback/Alert/Alert.theme.d.ts +12 -0
- package/dist/src/components/feedback/Alert/Alert.theme.js +61 -45
- package/dist/src/components/feedback/CircularProgress/CircularProgress.theme.d.ts +6 -1
- package/dist/src/components/feedback/CircularProgress/CircularProgress.theme.js +49 -8
- package/dist/src/components/feedback/Dialog/Dialog.theme.d.ts +5 -0
- package/dist/src/components/feedback/Dialog/Dialog.theme.js +43 -14
- package/dist/src/components/feedback/LinearProgress/LinearProgress.theme.d.ts +6 -1
- package/dist/src/components/feedback/LinearProgress/LinearProgress.theme.js +91 -9
- package/dist/src/components/feedback/Snackbar/Snackbar.theme.d.ts +4 -4
- package/dist/src/components/feedback/Snackbar/Snackbar.theme.js +11 -3
- package/dist/src/components/index.d.ts +10 -1
- package/dist/src/components/index.js +10 -1
- package/dist/src/components/inputs/Autocomplete/Autocomplete.theme.d.ts +1 -1
- package/dist/src/components/inputs/Autocomplete/Autocomplete.theme.js +23 -51
- package/dist/src/components/inputs/Autocomplete/components/AutocompleteCaretDownIcon.d.ts +1 -0
- package/dist/src/components/inputs/Autocomplete/components/{AutocompletePopupIcon.js → AutocompleteCaretDownIcon.js} +1 -1
- package/dist/src/components/inputs/Autocomplete/components/AutocompleteXIcon.d.ts +1 -0
- package/dist/src/components/inputs/Autocomplete/components/AutocompleteXIcon.js +4 -0
- package/dist/src/components/inputs/Button/Button.theme.d.ts +4 -0
- package/dist/src/components/inputs/Button/Button.theme.js +93 -226
- package/dist/src/components/inputs/Button/get-button-colors-map.d.ts +24 -0
- package/dist/src/components/inputs/Button/get-button-colors-map.js +211 -0
- package/dist/src/components/inputs/Checkbox/Checkbox.theme.d.ts +7 -2
- package/dist/src/components/inputs/Checkbox/Checkbox.theme.js +57 -7
- package/dist/src/components/inputs/Fab/Fab.theme.d.ts +5 -9
- package/dist/src/components/inputs/Fab/Fab.theme.js +27 -98
- package/dist/src/components/inputs/FormHelperText/FormHelperText.d.ts +2 -0
- package/dist/src/components/inputs/FormHelperText/FormHelperText.js +3 -0
- package/dist/src/components/inputs/FormHelperText/FormHelperText.theme.d.ts +7 -0
- package/dist/src/components/inputs/FormHelperText/FormHelperText.theme.js +8 -0
- package/dist/src/components/inputs/FormHelperText/index.d.ts +1 -0
- package/dist/src/components/inputs/FormHelperText/index.js +2 -0
- package/dist/src/components/inputs/FormLabel/FormLabel.d.ts +2 -0
- package/dist/src/components/inputs/FormLabel/FormLabel.js +3 -0
- package/dist/src/components/inputs/FormLabel/FormLabel.theme.d.ts +7 -0
- package/dist/src/components/inputs/FormLabel/FormLabel.theme.js +8 -0
- package/dist/src/components/inputs/FormLabel/index.d.ts +1 -0
- package/dist/src/components/inputs/FormLabel/index.js +2 -0
- package/dist/src/components/inputs/IconButton/IconButton.theme.d.ts +3 -2
- package/dist/src/components/inputs/IconButton/IconButton.theme.js +90 -95
- package/dist/src/components/inputs/InputBase/InputBase.theme.d.ts +9 -26
- package/dist/src/components/inputs/InputBase/InputBase.theme.js +2 -64
- package/dist/src/components/inputs/InputLabel/InputLabel.theme.d.ts +7 -4
- package/dist/src/components/inputs/InputLabel/InputLabel.theme.js +26 -12
- package/dist/src/components/inputs/OutlinedInput/OutlinedInput.theme.d.ts +8 -0
- package/dist/src/components/inputs/OutlinedInput/OutlinedInput.theme.js +67 -0
- package/dist/src/components/inputs/OutlinedInput/index.d.ts +1 -0
- package/dist/src/components/inputs/OutlinedInput/index.js +2 -0
- package/dist/src/components/inputs/Radio/Radio.d.ts +4 -0
- package/dist/src/components/inputs/Radio/Radio.js +4 -0
- package/dist/src/components/inputs/Radio/Radio.theme.d.ts +11 -0
- package/dist/src/components/inputs/Radio/Radio.theme.js +35 -0
- package/dist/src/components/inputs/Radio/index.d.ts +1 -0
- package/dist/src/components/{navigation/TabList → inputs/Radio}/index.js +1 -1
- package/dist/src/components/inputs/Select/Select.theme.d.ts +2 -3
- package/dist/src/components/inputs/Select/Select.theme.js +6 -33
- package/dist/src/components/inputs/Switch/Switch.theme.js +125 -49
- package/dist/src/components/inputs/TextField/TextField.theme.d.ts +2 -3
- package/dist/src/components/inputs/TextField/TextField.theme.js +2 -26
- package/dist/src/components/navigation/Breadcrumbs/Breadcrumbs.d.ts +4 -0
- package/dist/src/components/navigation/Breadcrumbs/Breadcrumbs.js +5 -0
- package/dist/src/components/navigation/Breadcrumbs/Breadcrumbs.theme.d.ts +11 -0
- package/dist/src/components/navigation/Breadcrumbs/Breadcrumbs.theme.js +23 -0
- package/dist/src/components/navigation/Breadcrumbs/Crumb.d.ts +10 -0
- package/dist/src/components/navigation/Breadcrumbs/Crumb.js +10 -0
- package/dist/src/components/navigation/Breadcrumbs/index.d.ts +1 -0
- package/dist/src/components/navigation/Breadcrumbs/index.js +2 -0
- package/dist/src/components/navigation/Drawer/Drawer.theme.d.ts +1 -1
- package/dist/src/components/navigation/Drawer/Drawer.theme.js +50 -6
- package/dist/src/components/navigation/Link/Link.theme.d.ts +11 -2
- package/dist/src/components/navigation/Link/Link.theme.js +66 -9
- package/dist/src/components/navigation/Menu/Menu.theme.d.ts +2 -3
- package/dist/src/components/navigation/Menu/Menu.theme.js +6 -11
- package/dist/src/components/navigation/MenuItem/MenuItem.theme.d.ts +2 -4
- package/dist/src/components/navigation/MenuItem/MenuItem.theme.js +8 -8
- package/dist/src/components/navigation/Pagination/Pagination.theme.d.ts +1 -1
- package/dist/src/components/navigation/Pagination/Pagination.theme.js +11 -3
- package/dist/src/components/navigation/PaginationItem/PaginationItem.theme.js +65 -10
- package/dist/src/components/navigation/PaginationItem/components/PaginationIcons.d.ts +4 -0
- package/dist/src/components/navigation/PaginationItem/components/PaginationIcons.js +8 -0
- package/dist/src/components/navigation/PaginationItem/components/index.d.ts +1 -0
- package/dist/src/components/navigation/PaginationItem/components/index.js +2 -0
- package/dist/src/components/navigation/Tab/Tab.theme.d.ts +7 -1
- package/dist/src/components/navigation/Tab/Tab.theme.js +52 -13
- package/dist/src/components/navigation/Tabs/Tabs.d.ts +3 -0
- package/dist/src/components/navigation/Tabs/Tabs.js +4 -0
- package/dist/src/components/navigation/Tabs/Tabs.theme.d.ts +16 -0
- package/dist/src/components/navigation/Tabs/Tabs.theme.js +55 -0
- package/dist/src/components/navigation/Tabs/index.d.ts +1 -0
- package/dist/src/components/navigation/Tabs/index.js +2 -0
- package/dist/src/components/surfaces/Accordion/Accordion.theme.js +54 -22
- package/dist/src/components/surfaces/Accordion/AccordionDetails.theme.d.ts +10 -0
- package/dist/src/components/surfaces/Accordion/AccordionDetails.theme.js +19 -0
- package/dist/src/components/surfaces/Accordion/AccordionSummary.theme.d.ts +10 -0
- package/dist/src/components/surfaces/Accordion/AccordionSummary.theme.js +37 -0
- package/dist/src/components/surfaces/Accordion/index.d.ts +2 -0
- package/dist/src/components/surfaces/Accordion/index.js +2 -0
- package/dist/src/components/surfaces/Card/Card.theme.js +1 -1
- package/dist/src/components/surfaces/Paper/Paper.theme.d.ts +16 -1
- package/dist/src/components/surfaces/Paper/Paper.theme.js +21 -7
- package/dist/src/components/surfaces/Paper/Paper.tokens.d.ts +8 -0
- package/dist/src/components/surfaces/Paper/Paper.tokens.js +50 -0
- package/dist/src/components/surfaces/Paper/Paper.variants.d.ts +4 -0
- package/dist/src/components/surfaces/Paper/Paper.variants.js +3 -0
- package/dist/src/components/surfaces/Popover/Popover.d.ts +4 -0
- package/dist/src/components/surfaces/Popover/Popover.js +4 -0
- package/dist/src/components/surfaces/Popover/Popover.theme.d.ts +9 -0
- package/dist/src/components/surfaces/Popover/Popover.theme.js +14 -0
- package/dist/src/components/surfaces/Popover/index.d.ts +1 -0
- package/dist/src/components/surfaces/Popover/index.js +2 -0
- package/dist/src/components/utils/Backdrop/Backdrop.d.ts +3 -0
- package/dist/src/components/utils/Backdrop/Backdrop.js +4 -0
- package/dist/src/components/utils/Backdrop/Backdrop.theme.d.ts +11 -0
- package/dist/src/components/utils/Backdrop/Backdrop.theme.js +17 -0
- package/dist/src/components/utils/Backdrop/index.d.ts +1 -0
- package/dist/src/components/utils/Backdrop/index.js +2 -0
- package/dist/src/icons/index.d.ts +4 -0
- package/dist/src/icons/index.js +12 -0
- package/dist/src/providers/ThemeModeProvider.d.ts +1 -2
- package/dist/src/providers/ThemeModeProvider.js +2 -2
- package/dist/src/providers/WebProsMuiThemeProvider.js +1 -1
- package/dist/src/providers/WebProsTheme.d.ts +1 -0
- package/dist/src/providers/WebProsTheme.js +11 -5
- package/dist/src/shared/rippleEnterKeyframe.d.ts +6 -0
- package/dist/src/shared/rippleEnterKeyframe.js +12 -0
- package/dist/src/shared/viewContext/index.d.ts +1 -0
- package/dist/src/shared/viewContext/index.js +2 -0
- package/dist/src/shared/viewContext/viewContext.d.ts +4 -0
- package/dist/src/shared/viewContext/viewContext.js +2 -0
- package/dist/src/style/additional-color-palette.d.ts +1 -3
- package/dist/src/style/additional-color-palette.js +4 -7
- package/dist/src/style/custom-color-palette.js +51 -53
- package/dist/src/tokens/ThemeColorTokens.d.ts +11 -93
- package/dist/src/tokens/ThemeColorTokens.js +4 -168
- package/dist/src/tokens/ThemeScheme.d.ts +0 -3
- package/dist/src/tokens/ThemeScheme.js +0 -2
- package/dist/src/tokens/colors/Dark.d.ts +16 -0
- package/dist/src/tokens/colors/Dark.js +1422 -0
- package/dist/src/tokens/colors/Light.d.ts +16 -0
- package/dist/src/tokens/colors/Light.js +1392 -0
- package/dist/src/tokens/colors/index.d.ts +7 -0
- package/dist/src/tokens/colors/index.js +4 -0
- package/dist/src/tokens/colors/inverseSchemas.d.ts +40 -0
- package/dist/src/tokens/colors/inverseSchemas.js +3 -0
- package/dist/src/tokens/colors/inverseSchemes.d.ts +53 -0
- package/dist/src/tokens/colors/inverseSchemes.js +3 -0
- package/dist/src/tokens/colors/inverseStateLayers.d.ts +188 -0
- package/dist/src/tokens/colors/inverseStateLayers.js +3 -0
- package/dist/src/tokens/colors/schemas.d.ts +111 -0
- package/dist/src/tokens/colors/schemas.js +3 -0
- package/dist/src/tokens/colors/schemes.d.ts +111 -0
- package/dist/src/tokens/colors/schemes.js +3 -0
- package/dist/src/tokens/colors/stateLayers.d.ts +456 -0
- package/dist/src/tokens/colors/stateLayers.js +3 -0
- package/dist/src/tokens/colors/types.d.ts +9 -0
- package/dist/src/tokens/colors/types.js +2 -0
- package/dist/src/tokens/index.d.ts +6 -2
- package/dist/src/tokens/index.js +2 -1
- package/dist/src/tokens/legacyColors/LegacyDark.d.ts +2 -0
- package/dist/src/tokens/legacyColors/LegacyDark.js +88 -0
- package/dist/src/tokens/legacyColors/LegacyLight.d.ts +2 -0
- package/dist/src/tokens/legacyColors/LegacyLight.js +86 -0
- package/dist/src/tokens/legacyColors/ThemeColorTokensLegacy.d.ts +74 -0
- package/dist/src/tokens/legacyColors/ThemeColorTokensLegacy.js +2 -0
- package/dist/src/tokens/legacyColors/additionalColors/additionalColors.d.ts +21 -0
- package/dist/src/tokens/legacyColors/additionalColors/additionalColors.js +2 -0
- package/dist/src/tokens/{additionalColors → legacyColors/additionalColors}/index.d.ts +1 -0
- package/dist/src/tokens/{additionalColors → legacyColors/additionalColors}/index.js +1 -0
- package/dist/src/tokens/legacyColors/index.d.ts +2 -0
- package/dist/src/tokens/legacyColors/index.js +3 -0
- package/dist/src/tokens/shadows/index.d.ts +12 -0
- package/dist/src/tokens/shadows/index.js +112 -0
- package/dist/src/tokens/typography/index.d.ts +2 -0
- package/dist/src/tokens/typography/index.js +4 -0
- package/dist/src/tokens/typography/typescale.d.ts +28 -0
- package/dist/src/tokens/typography/typescale.js +26 -0
- package/dist/src/tokens/typography/typography.d.ts +2 -0
- package/dist/src/tokens/typography/typography.js +156 -0
- package/dist/src/utils/createIcon.d.ts +12 -0
- package/dist/src/utils/createIcon.js +94 -0
- package/dist/src/utils/flatten.d.ts +1 -0
- package/dist/src/utils/flatten.js +12 -0
- package/dist/src/utils/getMUIComponents.js +2 -2
- package/dist/src/utils/getMUIPalette.d.ts +6 -11
- package/dist/src/utils/getMUIPalette.js +49 -25
- package/dist/src/utils/getMUIThemeCustoimzationType.d.ts +31 -0
- package/dist/src/utils/getMUIThemeCustoimzationType.js +2 -0
- package/dist/src/utils/getMUITypography.d.ts +2 -0
- package/dist/src/utils/getMUITypography.js +5 -0
- package/dist/src/utils/getStateLayerColor.d.ts +37 -0
- package/dist/src/utils/getStateLayerColor.js +43 -1
- package/dist/src/utils/index.d.ts +1 -1
- package/dist/src/utils/index.js +1 -1
- package/dist/src/utils/patchMUIShadows.js +4 -3
- package/package.json +21 -11
- package/dist/src/components/inputs/Autocomplete/components/AutocompletePopupIcon.d.ts +0 -1
- package/dist/src/components/navigation/PaginationItem/PaginationItem.d.ts +0 -3
- package/dist/src/components/navigation/PaginationItem/PaginationItem.js +0 -4
- package/dist/src/components/navigation/TabList/TabList.d.ts +0 -3
- package/dist/src/components/navigation/TabList/TabList.js +0 -4
- package/dist/src/components/navigation/TabList/TabList.theme.d.ts +0 -10
- package/dist/src/components/navigation/TabList/TabList.theme.js +0 -17
- package/dist/src/components/navigation/TabList/index.d.ts +0 -1
- package/dist/src/hooks/useTonalPalette.d.ts +0 -3
- package/dist/src/hooks/useTonalPalette.js +0 -32
- package/dist/src/providers/ThemeSchemeProvider.d.ts +0 -12
- package/dist/src/providers/ThemeSchemeProvider.js +0 -29
- package/dist/src/tokens/TonalPalette.d.ts +0 -10
- package/dist/src/tokens/TonalPalette.js +0 -10
- package/dist/src/utils/generateTokens.d.ts +0 -4
- package/dist/src/utils/generateTokens.js +0 -107
- /package/dist/src/tokens/{Tone.d.ts → legacyColors/Tone.d.ts} +0 -0
- /package/dist/src/tokens/{Tone.js → legacyColors/Tone.js} +0 -0
|
@@ -1,12 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { getBlendSchemaWithStateLayer, getInverseBlendSchemaWithStateLayer, } from '../index';
|
|
2
|
+
export const getMUIPalette = (themeMode, themeScheme) => {
|
|
3
|
+
const scheme = themeScheme[themeMode];
|
|
3
4
|
return {
|
|
4
5
|
palette: {
|
|
6
|
+
/** Basic MUI overrides */
|
|
5
7
|
themeMode,
|
|
6
8
|
primary: {
|
|
7
9
|
main: scheme.primary,
|
|
8
10
|
contrastText: scheme.onPrimary,
|
|
9
11
|
},
|
|
12
|
+
error: {
|
|
13
|
+
main: scheme.schemes.status.error,
|
|
14
|
+
contrastText: scheme.schemes.status.onError,
|
|
15
|
+
},
|
|
16
|
+
text: {
|
|
17
|
+
primary: scheme.schemes.surfaces.onSurface,
|
|
18
|
+
secondary: scheme.schemes.surfaces.onSurfaceVariant,
|
|
19
|
+
disabled: scheme.stateLayers.surfaces.onSurface.opacity38,
|
|
20
|
+
},
|
|
21
|
+
info: {
|
|
22
|
+
main: scheme.schemes.status.info,
|
|
23
|
+
contrastText: scheme.schemes.status.onInfo,
|
|
24
|
+
},
|
|
25
|
+
success: {
|
|
26
|
+
main: scheme.schemes.status.success,
|
|
27
|
+
contrastText: scheme.schemes.status.onSuccess,
|
|
28
|
+
},
|
|
29
|
+
warning: {
|
|
30
|
+
main: scheme.schemes.status.warning,
|
|
31
|
+
contrastText: scheme.schemes.status.onWarning,
|
|
32
|
+
},
|
|
10
33
|
onPrimary: {
|
|
11
34
|
main: scheme.onPrimary,
|
|
12
35
|
contrastText: scheme.primary,
|
|
@@ -51,10 +74,6 @@ export const getMUIPalette = (themeMode, themescheme) => {
|
|
|
51
74
|
main: scheme.onTertiaryContainer,
|
|
52
75
|
contrastText: scheme.tertiaryContainer,
|
|
53
76
|
},
|
|
54
|
-
error: {
|
|
55
|
-
main: scheme.error,
|
|
56
|
-
contrastText: scheme.onError,
|
|
57
|
-
},
|
|
58
77
|
onError: {
|
|
59
78
|
main: scheme.onError,
|
|
60
79
|
contrastText: scheme.error,
|
|
@@ -162,9 +181,23 @@ export const getMUIPalette = (themeMode, themescheme) => {
|
|
|
162
181
|
main: scheme.inverseOnSurface,
|
|
163
182
|
contrastText: scheme.inverseSurface,
|
|
164
183
|
},
|
|
165
|
-
action: {
|
|
184
|
+
action: {
|
|
185
|
+
// active
|
|
186
|
+
hover: scheme.stateLayers.surfaces.onSurface.opacity08,
|
|
187
|
+
hoverOpacity: scheme.generatedStateLayers['stateLayers.surfaces.onSurface.opacity08'].a,
|
|
188
|
+
selected: scheme.schemes.base.secondaryContainer, // TODO verify
|
|
189
|
+
// TODO verify
|
|
190
|
+
selectedOpacity: scheme.generatedStateLayers['stateLayers.surfaces.onSurface.opacity12'].a,
|
|
191
|
+
disabled: scheme.stateLayers.surfaces.onSurface.opacity38,
|
|
192
|
+
// disabledBackground:
|
|
193
|
+
disabledOpacity: scheme.generatedStateLayers['stateLayers.surfaces.onSurface.opacity38'].a,
|
|
194
|
+
// TODO verify
|
|
195
|
+
// focus
|
|
196
|
+
// focusOpacity
|
|
197
|
+
// activatedOpacity
|
|
198
|
+
},
|
|
166
199
|
shadow: {
|
|
167
|
-
main: scheme.shadow,
|
|
200
|
+
main: scheme.shadow, // TODO: verify if it is needed
|
|
168
201
|
},
|
|
169
202
|
scrim: {
|
|
170
203
|
main: scheme.scrim,
|
|
@@ -184,14 +217,6 @@ export const getMUIPalette = (themeMode, themescheme) => {
|
|
|
184
217
|
white: scheme.background,
|
|
185
218
|
black: scheme.onBackground,
|
|
186
219
|
},
|
|
187
|
-
text: {
|
|
188
|
-
primary: scheme.onSurface,
|
|
189
|
-
secondary: scheme.onSecondaryContainer,
|
|
190
|
-
},
|
|
191
|
-
info: {
|
|
192
|
-
main: scheme.info,
|
|
193
|
-
contrastText: scheme.onInfo,
|
|
194
|
-
},
|
|
195
220
|
onInfo: {
|
|
196
221
|
main: scheme.onInfo,
|
|
197
222
|
contrastText: scheme.info,
|
|
@@ -204,10 +229,6 @@ export const getMUIPalette = (themeMode, themescheme) => {
|
|
|
204
229
|
main: scheme.onInfoContainer,
|
|
205
230
|
contrastText: scheme.infoContainer,
|
|
206
231
|
},
|
|
207
|
-
success: {
|
|
208
|
-
main: scheme.success,
|
|
209
|
-
contrastText: scheme.onSuccess,
|
|
210
|
-
},
|
|
211
232
|
onSuccess: {
|
|
212
233
|
main: scheme.onSuccess,
|
|
213
234
|
contrastText: scheme.success,
|
|
@@ -220,10 +241,6 @@ export const getMUIPalette = (themeMode, themescheme) => {
|
|
|
220
241
|
main: scheme.onSuccessContainer,
|
|
221
242
|
contrastText: scheme.successContainer,
|
|
222
243
|
},
|
|
223
|
-
warning: {
|
|
224
|
-
main: scheme.warning,
|
|
225
|
-
contrastText: scheme.onWarning,
|
|
226
|
-
},
|
|
227
244
|
onWarning: {
|
|
228
245
|
main: scheme.onWarning,
|
|
229
246
|
contrastText: scheme.warning,
|
|
@@ -258,6 +275,13 @@ export const getMUIPalette = (themeMode, themescheme) => {
|
|
|
258
275
|
divider: scheme.outlineVariant,
|
|
259
276
|
additional: scheme.additionalColors,
|
|
260
277
|
},
|
|
261
|
-
|
|
278
|
+
colors: {
|
|
279
|
+
schemes: scheme.schemes,
|
|
280
|
+
stateLayers: scheme.stateLayers,
|
|
281
|
+
inverseSchemes: scheme.inverseSchemes,
|
|
282
|
+
inverseStateLayers: scheme.inverseStateLayers,
|
|
283
|
+
blendSchemaWithStateLayer: getBlendSchemaWithStateLayer(scheme.generatedSchemes, scheme.generatedStateLayers),
|
|
284
|
+
blendInverseSchemaWithStateLayer: getInverseBlendSchemaWithStateLayer(scheme.generatedInverseSchemes, scheme.generatedInverseStateLayers),
|
|
285
|
+
},
|
|
262
286
|
};
|
|
263
287
|
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Schemes, StateLayers, InverseSchemes, InverseStateLayers } from '../tokens/colors';
|
|
2
|
+
import { TypescaleTypographyVariants } from '../index';
|
|
3
|
+
import { BlendSchemaWithStateLayerFunction } from '../utils/getStateLayerColor';
|
|
4
|
+
declare module '@mui/material/styles' {
|
|
5
|
+
interface TypographyVariants extends TypescaleTypographyVariants {
|
|
6
|
+
}
|
|
7
|
+
interface TypographyVariantsOptions extends TypescaleTypographyVariants {
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
declare module '@mui/material/styles' {
|
|
11
|
+
interface Theme {
|
|
12
|
+
colors: {
|
|
13
|
+
schemes: Schemes;
|
|
14
|
+
stateLayers: StateLayers;
|
|
15
|
+
inverseSchemes: InverseSchemes;
|
|
16
|
+
inverseStateLayers: InverseStateLayers;
|
|
17
|
+
blendSchemaWithStateLayer: BlendSchemaWithStateLayerFunction;
|
|
18
|
+
blendInverseSchemaWithStateLayer: BlendSchemaWithStateLayerFunction;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
interface ThemeOptions {
|
|
22
|
+
colors: {
|
|
23
|
+
schemes: Schemes;
|
|
24
|
+
stateLayers: StateLayers;
|
|
25
|
+
inverseSchemes: InverseSchemes;
|
|
26
|
+
inverseStateLayers: InverseStateLayers;
|
|
27
|
+
blendSchemaWithStateLayer: BlendSchemaWithStateLayerFunction;
|
|
28
|
+
blendInverseSchemaWithStateLayer: BlendSchemaWithStateLayerFunction;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import { SchemesKey, InverseSchemesKey, StateLayersKey, InverseStateLayersKey, SchemesGenerated, InverseSchemesGenerated, StateLayersGenerated, InverseStateLayersGenerated } from '../tokens/colors';
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated Use blendSchemaWithStateLayer or color.schemes instead
|
|
4
|
+
* We're migrating to tokens based values of states. Do not use that enum in new code.
|
|
5
|
+
*/
|
|
1
6
|
export declare const StateLayerOpacity: {
|
|
2
7
|
readonly 0.08: 0.08;
|
|
3
8
|
readonly 0.12: 0.12;
|
|
@@ -6,7 +11,15 @@ export declare const StateLayerOpacity: {
|
|
|
6
11
|
readonly 0.28: 0.28;
|
|
7
12
|
readonly 0.48: 0.48;
|
|
8
13
|
};
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated Use blendSchemaWithStateLayer or color.schemes instead
|
|
16
|
+
* We're migrating to tokens based values of states. Do not use that enum in new code.
|
|
17
|
+
*/
|
|
9
18
|
export type StateLayerOpacityKey = keyof typeof StateLayerOpacity;
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated Use blendSchemaWithStateLayer or color.schemes instead
|
|
21
|
+
* We're migrating to tokens based values of states. Do not use that enum in new code.
|
|
22
|
+
*/
|
|
10
23
|
export declare enum StateLayer {
|
|
11
24
|
Hover = 0.08,
|
|
12
25
|
Focus = 0.12,
|
|
@@ -16,10 +29,34 @@ export declare enum StateLayer {
|
|
|
16
29
|
Disabled = 0.08,
|
|
17
30
|
Active = 0.12
|
|
18
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated Use blendSchemaWithStateLayer or color.schemes instead
|
|
34
|
+
* We're migrating to tokens based values of states. Do not use that enum in new code.
|
|
35
|
+
*/
|
|
19
36
|
export declare enum OnStateLayer {
|
|
20
37
|
Disabled = 0.38,
|
|
21
38
|
Active = 1
|
|
22
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* @deprecated Use blendSchemaWithStateLayer or color.schemes instead
|
|
42
|
+
* We're migrating to tokens based values of states. Do not use that enum in new code.
|
|
43
|
+
*/
|
|
23
44
|
export declare const getStateLayerColor: (state: StateLayer, containerColor: string, contentColor?: string) => string;
|
|
45
|
+
/**
|
|
46
|
+
* @deprecated Use blendSchemaWithStateLayer or color.schemes instead
|
|
47
|
+
* We're migrating to tokens based values of states. Do not use that enum in new code.
|
|
48
|
+
*/
|
|
24
49
|
export declare const getOnStateLayerColor: (state: OnStateLayer, onContainerColor: string, containerColor?: string) => string;
|
|
50
|
+
/**
|
|
51
|
+
* @deprecated Use blendSchemaWithStateLayer or color.schemes instead
|
|
52
|
+
* We're migrating to tokens based values of states. Do not use that enum in new code.
|
|
53
|
+
*/
|
|
25
54
|
export declare const getStateLayerColorByOpacityKey: (opacity: StateLayerOpacityKey, color: string) => string;
|
|
55
|
+
export type BlendSchemaWithStateLayerFunction = (schemaKey: SchemesKey | InverseSchemesKey, stateLayerKey: StateLayersKey | InverseStateLayersKey) => string;
|
|
56
|
+
export declare const getBlendSchemaWithStateLayer: (schemesGenerated: SchemesGenerated | InverseSchemesGenerated, stateLayersGenerated: StateLayersGenerated | InverseStateLayersGenerated) => BlendSchemaWithStateLayerFunction;
|
|
57
|
+
export declare const getInverseBlendSchemaWithStateLayer: (schemesGenerated: InverseSchemesGenerated, stateLayersGenerated: InverseStateLayersGenerated) => BlendSchemaWithStateLayerFunction;
|
|
58
|
+
/**
|
|
59
|
+
* Blends a schema color by color-mix
|
|
60
|
+
* Color mix is 2023 Baseline https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/color-mix
|
|
61
|
+
*/
|
|
62
|
+
export declare const blendSchemaWithStateLayer: (schemesGenerated: SchemesGenerated | InverseSchemesGenerated, stateLayersGenerated: StateLayersGenerated | InverseStateLayersGenerated) => (schemaKey: SchemesKey | InverseSchemesKey, stateLayerKey: StateLayersKey | InverseStateLayersKey) => string;
|
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
import { Blend, argbFromHex, hexFromArgb } from '@material/material-color-utilities';
|
|
3
3
|
import { alpha } from '@mui/material';
|
|
4
4
|
/* eslint-disable @typescript-eslint/no-duplicate-enum-values -- Need same value*/
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated Use blendSchemaWithStateLayer or color.schemes instead
|
|
7
|
+
* We're migrating to tokens based values of states. Do not use that enum in new code.
|
|
8
|
+
*/
|
|
6
9
|
export const StateLayerOpacity = {
|
|
7
10
|
0.08: 0.08,
|
|
8
11
|
0.12: 0.12,
|
|
@@ -11,6 +14,10 @@ export const StateLayerOpacity = {
|
|
|
11
14
|
0.28: 0.28,
|
|
12
15
|
0.48: 0.48,
|
|
13
16
|
};
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated Use blendSchemaWithStateLayer or color.schemes instead
|
|
19
|
+
* We're migrating to tokens based values of states. Do not use that enum in new code.
|
|
20
|
+
*/
|
|
14
21
|
export var StateLayer;
|
|
15
22
|
(function (StateLayer) {
|
|
16
23
|
StateLayer[StateLayer["Hover"] = 0.08] = "Hover";
|
|
@@ -21,16 +28,51 @@ export var StateLayer;
|
|
|
21
28
|
StateLayer[StateLayer["Disabled"] = 0.08] = "Disabled";
|
|
22
29
|
StateLayer[StateLayer["Active"] = 0.12] = "Active";
|
|
23
30
|
})(StateLayer || (StateLayer = {}));
|
|
31
|
+
/**
|
|
32
|
+
* @deprecated Use blendSchemaWithStateLayer or color.schemes instead
|
|
33
|
+
* We're migrating to tokens based values of states. Do not use that enum in new code.
|
|
34
|
+
*/
|
|
24
35
|
export var OnStateLayer;
|
|
25
36
|
(function (OnStateLayer) {
|
|
26
37
|
OnStateLayer[OnStateLayer["Disabled"] = 0.38] = "Disabled";
|
|
27
38
|
OnStateLayer[OnStateLayer["Active"] = 1] = "Active";
|
|
28
39
|
})(OnStateLayer || (OnStateLayer = {}));
|
|
40
|
+
/**
|
|
41
|
+
* @deprecated Use blendSchemaWithStateLayer or color.schemes instead
|
|
42
|
+
* We're migrating to tokens based values of states. Do not use that enum in new code.
|
|
43
|
+
*/
|
|
29
44
|
export const getStateLayerColor = (state, containerColor, contentColor) => contentColor
|
|
30
45
|
? hexFromArgb(Blend.cam16Ucs(argbFromHex(containerColor), argbFromHex(contentColor), state))
|
|
31
46
|
: alpha(containerColor, state);
|
|
47
|
+
/**
|
|
48
|
+
* @deprecated Use blendSchemaWithStateLayer or color.schemes instead
|
|
49
|
+
* We're migrating to tokens based values of states. Do not use that enum in new code.
|
|
50
|
+
*/
|
|
32
51
|
export const getOnStateLayerColor = (state, onContainerColor, containerColor) => containerColor
|
|
33
52
|
? hexFromArgb(Blend.cam16Ucs(argbFromHex(onContainerColor), argbFromHex(containerColor), state))
|
|
34
53
|
: alpha(onContainerColor, state);
|
|
35
54
|
// Was introduced due to fact that StateLayer enums does not correlate with values presented. So State layer is more like "const opacity value" rather then actual state
|
|
55
|
+
/**
|
|
56
|
+
* @deprecated Use blendSchemaWithStateLayer or color.schemes instead
|
|
57
|
+
* We're migrating to tokens based values of states. Do not use that enum in new code.
|
|
58
|
+
*/
|
|
36
59
|
export const getStateLayerColorByOpacityKey = (opacity, color) => alpha(color, StateLayerOpacity[opacity]);
|
|
60
|
+
// Function to get the blend function
|
|
61
|
+
export const getBlendSchemaWithStateLayer = (schemesGenerated, stateLayersGenerated) => blendSchemaWithStateLayer(schemesGenerated, stateLayersGenerated);
|
|
62
|
+
export const getInverseBlendSchemaWithStateLayer = (schemesGenerated, stateLayersGenerated) => blendSchemaWithStateLayer(schemesGenerated, stateLayersGenerated);
|
|
63
|
+
/**
|
|
64
|
+
* Blends a schema color by color-mix
|
|
65
|
+
* Color mix is 2023 Baseline https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/color-mix
|
|
66
|
+
*/
|
|
67
|
+
export const blendSchemaWithStateLayer = (schemesGenerated, stateLayersGenerated) => (schemaKey, stateLayerKey) => {
|
|
68
|
+
// Get the GeneratedRgba values directly using the keys
|
|
69
|
+
const rgb1 = schemesGenerated[schemaKey];
|
|
70
|
+
const rgb2 = stateLayersGenerated[stateLayerKey];
|
|
71
|
+
// Convert RGBA objects to color strings
|
|
72
|
+
const schemaColor = `rgba(${rgb1.r}, ${rgb1.g}, ${rgb1.b}, ${rgb1.a})`;
|
|
73
|
+
const stateLayerColor = `rgba(${rgb2.r}, ${rgb2.g}, ${rgb2.b}, 1)`; // Remove alpha from state layer
|
|
74
|
+
// Get the amount from the state layer opacity (alpha channel as percentage)
|
|
75
|
+
const percentage = Math.round(rgb2.a * 100);
|
|
76
|
+
// Use CSS color-mix for blending
|
|
77
|
+
return `color-mix(in srgb, ${schemaColor} 100%, ${stateLayerColor} ${percentage}%)`;
|
|
78
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from './generateTokens';
|
|
2
1
|
export * from './getMUIComponents';
|
|
3
2
|
export * from './getMUIPalette';
|
|
4
3
|
export * from './getMuiLocaleByCode';
|
|
4
|
+
export * from './getMUIThemeCustoimzationType';
|
|
5
5
|
export * from './getStateLayerColor';
|
|
6
6
|
export * from './patchMUIShadows';
|
package/dist/src/utils/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright 2025 WebPros International GmbH. All rights reserved.
|
|
2
|
-
export * from './generateTokens';
|
|
3
2
|
export * from './getMUIComponents';
|
|
4
3
|
export * from './getMUIPalette';
|
|
5
4
|
export * from './getMuiLocaleByCode';
|
|
5
|
+
export * from './getMUIThemeCustoimzationType';
|
|
6
6
|
export * from './getStateLayerColor';
|
|
7
7
|
export * from './patchMUIShadows';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import { alpha } from '@mui/material';
|
|
1
|
+
import { muiShadows } from '../tokens/shadows';
|
|
3
2
|
export const patchMUIShadows = (theme) => {
|
|
4
|
-
|
|
3
|
+
muiShadows.forEach((shadowValue, index) => {
|
|
4
|
+
theme.shadows[index] = shadowValue;
|
|
5
|
+
});
|
|
5
6
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webpros/mui-theme",
|
|
3
|
-
"description": "MUI
|
|
4
|
-
"version": "0.
|
|
3
|
+
"description": "MUI v7 theme for WebPros products",
|
|
4
|
+
"version": "0.3.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -20,6 +20,10 @@
|
|
|
20
20
|
".": {
|
|
21
21
|
"import": "./dist/src/index.js",
|
|
22
22
|
"types": "./dist/src/index.d.ts"
|
|
23
|
+
},
|
|
24
|
+
"./icons": {
|
|
25
|
+
"import": "./dist/src/icons/index.js",
|
|
26
|
+
"types": "./dist/src/icons/index.d.ts"
|
|
23
27
|
}
|
|
24
28
|
},
|
|
25
29
|
"type": "module",
|
|
@@ -42,15 +46,17 @@
|
|
|
42
46
|
"eslint": "eslint",
|
|
43
47
|
"prettier:test": "prettier --check \"**/*.{ts,tsx}\"",
|
|
44
48
|
"prettier:write": "prettier --write \"**/*.{ts,tsx}\"",
|
|
45
|
-
"typecheck": "tsc --noEmit"
|
|
49
|
+
"typecheck": "tsc --noEmit",
|
|
50
|
+
"extract-tokens": "node tools/extractM3Tokens.js",
|
|
51
|
+
"generate:icons": "node scripts/generate-icons.cjs"
|
|
46
52
|
},
|
|
47
53
|
"peerDependencies": {
|
|
48
54
|
"@emotion/react": "^11.14.0",
|
|
49
55
|
"@emotion/styled": "^11.14.1",
|
|
50
56
|
"@fontsource/roboto": "^5.2.6",
|
|
51
57
|
"@material/material-color-utilities": "^0.3.0",
|
|
52
|
-
"@mui/material": "^
|
|
53
|
-
"@mui/utils": "^
|
|
58
|
+
"@mui/material": "^7.3.6",
|
|
59
|
+
"@mui/utils": "^7.3.6",
|
|
54
60
|
"@mui/x-data-grid": "^7.29.0",
|
|
55
61
|
"@mui/x-date-pickers": "^7.29.0",
|
|
56
62
|
"@phosphor-icons/react": "^2.1.0",
|
|
@@ -66,8 +72,8 @@
|
|
|
66
72
|
"@eslint/js": "^9.38.0",
|
|
67
73
|
"@fontsource/roboto": "^5.2.6",
|
|
68
74
|
"@material/material-color-utilities": "^0.3.0",
|
|
69
|
-
"@mui/material": "^
|
|
70
|
-
"@mui/utils": "^
|
|
75
|
+
"@mui/material": "^7.3.6",
|
|
76
|
+
"@mui/utils": "^7.3.6",
|
|
71
77
|
"@mui/x-data-grid": "^7.29.0",
|
|
72
78
|
"@mui/x-date-pickers": "^7.29.0",
|
|
73
79
|
"@phosphor-icons/react": "^2.1.0",
|
|
@@ -79,8 +85,8 @@
|
|
|
79
85
|
"@storybook/react-vite": "^9.1.16",
|
|
80
86
|
"@stylistic/eslint-plugin": "^5.5.0",
|
|
81
87
|
"@types/node": "^24.8.1",
|
|
82
|
-
"@types/react": "
|
|
83
|
-
"@types/react-dom": "^
|
|
88
|
+
"@types/react": "18.3.1",
|
|
89
|
+
"@types/react-dom": "^18.3.1",
|
|
84
90
|
"@vitejs/plugin-react": "^5.0.4",
|
|
85
91
|
"eslint": "^9.38.0",
|
|
86
92
|
"eslint-config-prettier": "^10.1.8",
|
|
@@ -93,12 +99,13 @@
|
|
|
93
99
|
"react": "^18.3.1",
|
|
94
100
|
"react-dom": "^18.3.1",
|
|
95
101
|
"storybook": "^9.1.16",
|
|
102
|
+
"storybook-addon-pseudo-states": "^10.0.3",
|
|
96
103
|
"tsc-alias": "^1.8.16",
|
|
97
104
|
"typescript": "~5.9.3",
|
|
98
105
|
"typescript-eslint": "^8.46.1",
|
|
106
|
+
"usehooks-ts": "^3.1.1",
|
|
99
107
|
"vite": "^7.1.10",
|
|
100
|
-
"vite-plugin-dts": "^4.5.4"
|
|
101
|
-
"usehooks-ts": "^3.1.1"
|
|
108
|
+
"vite-plugin-dts": "^4.5.4"
|
|
102
109
|
},
|
|
103
110
|
"browserslist": [
|
|
104
111
|
"last 2 versions",
|
|
@@ -110,5 +117,8 @@
|
|
|
110
117
|
"extends": [
|
|
111
118
|
"plugin:storybook/recommended"
|
|
112
119
|
]
|
|
120
|
+
},
|
|
121
|
+
"resolutions": {
|
|
122
|
+
"react-is": "^18.3.1"
|
|
113
123
|
}
|
|
114
124
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const AutocompletePopupIcon: import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Theme, ComponentsOverrides, ComponentsProps } from '@mui/material';
|
|
2
|
-
interface M3TabList {
|
|
3
|
-
MuiTabs: {
|
|
4
|
-
defaultProps?: ComponentsProps['MuiTabs'];
|
|
5
|
-
styleOverrides?: ComponentsOverrides<Theme>['MuiTabs'];
|
|
6
|
-
};
|
|
7
|
-
}
|
|
8
|
-
export declare const getTabList: (theme: Theme) => M3TabList;
|
|
9
|
-
declare const _default: {};
|
|
10
|
-
export default _default;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export const getTabList = (theme) => {
|
|
2
|
-
const { palette: _ } = theme;
|
|
3
|
-
return {
|
|
4
|
-
MuiTabs: {
|
|
5
|
-
styleOverrides: {
|
|
6
|
-
root: {
|
|
7
|
-
'& > .MuiTabs-scroller > .MuiTabs-indicator': {
|
|
8
|
-
height: '3px',
|
|
9
|
-
borderTopLeftRadius: '3px',
|
|
10
|
-
borderTopRightRadius: '3px',
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
export default {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './TabList.theme';
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
// Copyright 2025 WebPros International GmbH. All rights reserved.
|
|
2
|
-
import { argbFromHex, hexFromArgb, themeFromSourceColor } from '@material/material-color-utilities';
|
|
3
|
-
import { useLayoutEffect, useState } from 'react';
|
|
4
|
-
import { TonalPaletteDefault } from '../tokens/TonalPalette';
|
|
5
|
-
export const TONAL_PALETTE_KEY = 'TonalPaletteKey';
|
|
6
|
-
const LEVELS = [
|
|
7
|
-
0, 4, 6, 10, 12, 17, 20, 22, 24, 30, 40, 50, 60, 70, 80, 87, 90, 92, 94, 95, 96, 98, 99, 100,
|
|
8
|
-
];
|
|
9
|
-
export const useTonalPalette = () => {
|
|
10
|
-
const [tonalPalette, setTonalPalette] = useState(TonalPaletteDefault);
|
|
11
|
-
useLayoutEffect(() => {
|
|
12
|
-
if (localStorage.getItem(TONAL_PALETTE_KEY)) {
|
|
13
|
-
const localTonalPalette = JSON.parse(localStorage.getItem(TONAL_PALETTE_KEY) || '{}');
|
|
14
|
-
setTonalPalette(localTonalPalette);
|
|
15
|
-
}
|
|
16
|
-
}, []);
|
|
17
|
-
const generatePalette = (hexColor) => {
|
|
18
|
-
const intColor = argbFromHex(hexColor);
|
|
19
|
-
const { palettes } = themeFromSourceColor(intColor);
|
|
20
|
-
const tones = {};
|
|
21
|
-
for (const [key, palette] of Object.entries(palettes)) {
|
|
22
|
-
const tonelevel = {};
|
|
23
|
-
for (const level of LEVELS) {
|
|
24
|
-
tonelevel[level] = hexFromArgb(palette.tone(level));
|
|
25
|
-
}
|
|
26
|
-
tones[key] = tonelevel;
|
|
27
|
-
}
|
|
28
|
-
setTonalPalette(tones);
|
|
29
|
-
localStorage.setItem(TONAL_PALETTE_KEY, JSON.stringify(tones));
|
|
30
|
-
};
|
|
31
|
-
return [tonalPalette, generatePalette];
|
|
32
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
2
|
-
import { ThemeScheme } from '../tokens/ThemeScheme';
|
|
3
|
-
export type ThemeSchemeContextType = {
|
|
4
|
-
generateScheme: (hexColor: string) => void;
|
|
5
|
-
themeScheme: ThemeScheme;
|
|
6
|
-
};
|
|
7
|
-
export type ThemeSchemeProviderProps = {
|
|
8
|
-
children?: React.ReactNode;
|
|
9
|
-
};
|
|
10
|
-
export declare const ThemeSchemeContext: import("react").Context<ThemeSchemeContextType>;
|
|
11
|
-
declare const ThemeSchemeProvider: FC<ThemeSchemeProviderProps>;
|
|
12
|
-
export default ThemeSchemeProvider;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
// Copyright 2025 WebPros International GmbH. All rights reserved.
|
|
3
|
-
import { createContext, useCallback, useLayoutEffect, useMemo, useState } from 'react';
|
|
4
|
-
import { ThemeSchemeDefault } from '../tokens/ThemeScheme';
|
|
5
|
-
import { useTonalPalette } from '../hooks/useTonalPalette';
|
|
6
|
-
import { generateDesignTokens } from '../utils/generateTokens';
|
|
7
|
-
export const ThemeSchemeContext = createContext({
|
|
8
|
-
generateScheme: () => { },
|
|
9
|
-
themeScheme: ThemeSchemeDefault,
|
|
10
|
-
});
|
|
11
|
-
const ThemeSchemeProvider = ({ children }) => {
|
|
12
|
-
const [tonalPalette, generatePalette] = useTonalPalette();
|
|
13
|
-
const [themeScheme, setThemeScheme] = useState(ThemeSchemeDefault);
|
|
14
|
-
useLayoutEffect(() => {
|
|
15
|
-
const lightTokens = generateDesignTokens('light', tonalPalette);
|
|
16
|
-
const darkTokens = generateDesignTokens('dark', tonalPalette);
|
|
17
|
-
setThemeScheme({
|
|
18
|
-
light: lightTokens,
|
|
19
|
-
dark: darkTokens,
|
|
20
|
-
tones: tonalPalette,
|
|
21
|
-
});
|
|
22
|
-
}, [tonalPalette]);
|
|
23
|
-
const generateScheme = useCallback((hexColor) => {
|
|
24
|
-
generatePalette(hexColor);
|
|
25
|
-
}, [generatePalette]);
|
|
26
|
-
const value = useMemo(() => ({ generateScheme, themeScheme }), [generateScheme, themeScheme]);
|
|
27
|
-
return _jsx(ThemeSchemeContext.Provider, { value: value, children: children });
|
|
28
|
-
};
|
|
29
|
-
export default ThemeSchemeProvider;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// Copyright 2025 WebPros International GmbH. All rights reserved.
|
|
2
|
-
import { ErrorDefault, NeutralDefault, NeutralVariantDefault, PrimaryDefault, SecondaryDefault, TertiaryDefault, } from './Tone';
|
|
3
|
-
export const TonalPaletteDefault = {
|
|
4
|
-
primary: PrimaryDefault,
|
|
5
|
-
secondary: SecondaryDefault,
|
|
6
|
-
tertiary: TertiaryDefault,
|
|
7
|
-
neutral: NeutralDefault,
|
|
8
|
-
neutralVariant: NeutralVariantDefault,
|
|
9
|
-
error: ErrorDefault,
|
|
10
|
-
};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { ThemeMode } from '../tokens/ThemeMode';
|
|
2
|
-
import { ThemeColorTokens } from '../tokens/ThemeColorTokens';
|
|
3
|
-
import { TonalPalette } from '../tokens/TonalPalette';
|
|
4
|
-
export declare const generateDesignTokens: (themeMode: ThemeMode, tonalPalette: TonalPalette) => ThemeColorTokens;
|