@webpros/mui-theme 0.3.2 → 0.3.3
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/README.md +63 -12
- package/dist/package.json +6 -4
- package/dist/src/components/feedback/Dialog/Dialog.theme.js +4 -4
- package/dist/src/components/surfaces/AppBar/AppBar.theme.d.ts +1 -1
- package/dist/src/components/surfaces/AppBar/AppBar.theme.js +1 -12
- package/dist/src/index.d.ts +1 -0
- package/dist/src/providers/WebProsMuiThemeProvider.d.ts +18 -2
- package/dist/src/providers/WebProsMuiThemeProvider.js +1 -1
- package/dist/src/providers/WebProsTheme.d.ts +19 -1
- package/dist/src/providers/WebProsTheme.js +20 -7
- package/dist/src/tokens/ThemeColorTokens.d.ts +1 -2
- package/dist/src/tokens/ThemeColorTokens.js +20 -3
- package/dist/src/utils/createIcon.js +14 -16
- package/dist/src/utils/getMUIComponents.d.ts +1 -2
- package/dist/src/utils/getMUIPalette.d.ts +2 -18
- package/dist/src/utils/getMUIPalette.js +4 -227
- package/package.json +6 -4
- package/dist/src/style/custom-color-palette.d.ts +0 -3
- package/dist/src/style/custom-color-palette.js +0 -73
- package/dist/src/tokens/legacyColors/LegacyDark.d.ts +0 -2
- package/dist/src/tokens/legacyColors/LegacyDark.js +0 -78
- package/dist/src/tokens/legacyColors/LegacyLight.d.ts +0 -2
- package/dist/src/tokens/legacyColors/LegacyLight.js +0 -76
- package/dist/src/tokens/legacyColors/ThemeColorTokensLegacy.d.ts +0 -72
- package/dist/src/tokens/legacyColors/ThemeColorTokensLegacy.js +0 -2
- package/dist/src/tokens/legacyColors/Tone.d.ts +0 -158
- package/dist/src/tokens/legacyColors/Tone.js +0 -157
- package/dist/src/tokens/legacyColors/index.d.ts +0 -2
- package/dist/src/tokens/legacyColors/index.js +0 -3
package/README.md
CHANGED
|
@@ -79,6 +79,57 @@ const App = () => (
|
|
|
79
79
|
import { Box } from '@mui/material'; // NOT import { Box } from '@webpros/mui-theme';
|
|
80
80
|
```
|
|
81
81
|
|
|
82
|
+
# Development
|
|
83
|
+
|
|
84
|
+
## Using Custom ESLint Rules
|
|
85
|
+
|
|
86
|
+
The package exports custom ESLint rules to enforce Material Design 3 design system best practices. To use them in your project:
|
|
87
|
+
|
|
88
|
+
```js
|
|
89
|
+
// eslint.config.js
|
|
90
|
+
import webprosMuiThemeRules from '@webpros/mui-theme/eslint';
|
|
91
|
+
|
|
92
|
+
export default [
|
|
93
|
+
// ... your other config
|
|
94
|
+
{
|
|
95
|
+
plugins: {
|
|
96
|
+
'@webpros/mui-theme': webprosMuiThemeRules,
|
|
97
|
+
},
|
|
98
|
+
rules: {
|
|
99
|
+
'@webpros/mui-theme/no-palette-usage': 'error',
|
|
100
|
+
'@webpros/mui-theme/no-standard-typography-variants': 'error',
|
|
101
|
+
'@webpros/mui-theme/no-hardcoded-typography-in-sx': 'error',
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
];
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
For detailed documentation of available rules, see [configs/eslint/README.md](configs/eslint/README.md).
|
|
108
|
+
|
|
109
|
+
## Adding New Custom ESLint Rules
|
|
110
|
+
|
|
111
|
+
To add a new custom rule:
|
|
112
|
+
|
|
113
|
+
1. Create a new file in `configs/eslint/rules/` with your rule implementation (use CommonJS format)
|
|
114
|
+
2. Export the rule using `module.exports`
|
|
115
|
+
3. Import and add it to `configs/eslint/index.cjs` using `require()`
|
|
116
|
+
4. Add the rule to `eslint.config.js` in the plugins and rules sections
|
|
117
|
+
5. Document the rule in `configs/eslint/README.md`
|
|
118
|
+
|
|
119
|
+
### Testing Custom Rules
|
|
120
|
+
|
|
121
|
+
Test your custom rules by running ESLint on specific files:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
# Test on a specific file
|
|
125
|
+
npx eslint src/path/to/file.ts
|
|
126
|
+
|
|
127
|
+
# Test on all TypeScript files
|
|
128
|
+
npx eslint 'src/**/*.{ts,tsx}'
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
For more information about the existing custom rules and their usage, see [eslint/README.md](eslint/README.md).
|
|
132
|
+
|
|
82
133
|
# Tools configuration
|
|
83
134
|
|
|
84
135
|
## Webpack
|
|
@@ -86,17 +137,17 @@ import { Box } from '@mui/material'; // NOT import { Box } from '@webpros/mui-th
|
|
|
86
137
|
If you use Webpack, you probably need to add the following rules to your configuration:
|
|
87
138
|
|
|
88
139
|
```js
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
},
|
|
140
|
+
module: {
|
|
141
|
+
rules: [
|
|
142
|
+
{
|
|
143
|
+
test: /\.m?js/,
|
|
144
|
+
type: 'javascript/auto',
|
|
145
|
+
resolve: {
|
|
146
|
+
fullySpecified: false,
|
|
97
147
|
},
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
148
|
+
},
|
|
149
|
+
|
|
150
|
+
// your other rules
|
|
151
|
+
];
|
|
152
|
+
}
|
|
102
153
|
```
|
package/dist/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webpros/mui-theme",
|
|
3
3
|
"description": "MUI v7 theme for WebPros products",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.3",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"theming",
|
|
15
15
|
"ui"
|
|
16
16
|
],
|
|
17
|
-
"main": "
|
|
17
|
+
"main": "src/index.js",
|
|
18
18
|
"types": "dist/index.d.ts",
|
|
19
19
|
"exports": {
|
|
20
20
|
".": {
|
|
@@ -38,7 +38,9 @@
|
|
|
38
38
|
"yarn": "^1.22.0"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
|
-
"build": "
|
|
41
|
+
"build": "yarn build:main && yarn build:eslint",
|
|
42
|
+
"build:main": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",
|
|
43
|
+
"build:eslint": "tsc -p ./eslint/tsconfig.eslint.json",
|
|
42
44
|
"storybook:dev": "storybook dev -p 6006",
|
|
43
45
|
"storybook:build": "storybook build",
|
|
44
46
|
"test": "npm run prettier:test && npm run lint && npm run typecheck",
|
|
@@ -48,7 +50,7 @@
|
|
|
48
50
|
"prettier:write": "prettier --write \"**/*.{ts,tsx}\"",
|
|
49
51
|
"typecheck": "tsc --noEmit",
|
|
50
52
|
"extract-tokens": "node tools/extractM3Tokens.js",
|
|
51
|
-
"generate:icons": "node
|
|
53
|
+
"generate:icons": "node tools/generate-icons.js"
|
|
52
54
|
},
|
|
53
55
|
"peerDependencies": {
|
|
54
56
|
"@emotion/react": "^11.14.0",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright 2025 WebPros International GmbH. All rights reserved.
|
|
2
2
|
import { modalClasses, dialogContentClasses, dialogClasses, iconButtonClasses, } from '@mui/material';
|
|
3
3
|
export const getDialog = (theme) => {
|
|
4
|
-
const { spacing,
|
|
4
|
+
const { spacing, colors } = theme;
|
|
5
5
|
const closeButtonPosition = {
|
|
6
6
|
position: 'absolute',
|
|
7
7
|
right: spacing(3),
|
|
@@ -15,7 +15,7 @@ export const getDialog = (theme) => {
|
|
|
15
15
|
styleOverrides: {
|
|
16
16
|
root: {
|
|
17
17
|
padding: spacing(3.75, 8.25, 2.375, 4.5),
|
|
18
|
-
color:
|
|
18
|
+
color: colors.schemes.surfaces.onSurface,
|
|
19
19
|
[`& + .${dialogContentClasses.root}`]: {
|
|
20
20
|
paddingTop: '0 !important',
|
|
21
21
|
},
|
|
@@ -55,7 +55,7 @@ export const getDialog = (theme) => {
|
|
|
55
55
|
MuiDialogContent: {
|
|
56
56
|
styleOverrides: {
|
|
57
57
|
root: {
|
|
58
|
-
color:
|
|
58
|
+
color: colors.schemes.surfaces.onSurfaceVariant,
|
|
59
59
|
padding: spacing(0, 4.5, 1, 4.5),
|
|
60
60
|
},
|
|
61
61
|
dividers: {
|
|
@@ -88,7 +88,7 @@ export const getDialog = (theme) => {
|
|
|
88
88
|
MuiDialogContentText: {
|
|
89
89
|
styleOverrides: {
|
|
90
90
|
root: {
|
|
91
|
-
color:
|
|
91
|
+
color: colors.schemes.surfaces.onSurfaceVariant,
|
|
92
92
|
},
|
|
93
93
|
},
|
|
94
94
|
},
|
|
@@ -1,21 +1,10 @@
|
|
|
1
|
-
export const getAppBar = (
|
|
2
|
-
const { palette } = theme;
|
|
1
|
+
export const getAppBar = (_theme) => {
|
|
3
2
|
return {
|
|
4
3
|
MuiAppBar: {
|
|
5
4
|
defaultProps: {
|
|
6
5
|
elevation: 0,
|
|
7
6
|
color: 'default',
|
|
8
7
|
},
|
|
9
|
-
styleOverrides: {
|
|
10
|
-
colorDefault: {
|
|
11
|
-
background: palette.surface.main,
|
|
12
|
-
color: palette.onSurface.main,
|
|
13
|
-
},
|
|
14
|
-
colorPrimary: {
|
|
15
|
-
background: palette.surface.main,
|
|
16
|
-
color: palette.onSurface.main,
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
8
|
},
|
|
20
9
|
};
|
|
21
10
|
};
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { default as WebProsMuiThemeProvider } from './providers/WebProsMuiThemeProvider';
|
|
2
|
+
export type { WebProsMuiThemeProviderProps } from './providers/WebProsMuiThemeProvider';
|
|
2
3
|
export { useThemeModeContext } from './providers/ThemeModeProvider';
|
|
3
4
|
export * from './utils';
|
|
4
5
|
export * from './tokens';
|
|
@@ -1,9 +1,25 @@
|
|
|
1
1
|
import { Localization } from '@mui/material/locale';
|
|
2
2
|
import { ThemeMode } from '../tokens/ThemeMode';
|
|
3
|
-
|
|
3
|
+
import { ThemeOptions, Theme } from '@mui/material';
|
|
4
|
+
import { M3Components } from '../utils';
|
|
5
|
+
export type WebProsMuiThemeProviderProps = {
|
|
4
6
|
children?: React.ReactNode;
|
|
5
7
|
themeMode?: ThemeMode;
|
|
6
8
|
localization?: Localization;
|
|
9
|
+
/**
|
|
10
|
+
* Modifier function to customize theme foundation (palette, typography, spacing, etc.).
|
|
11
|
+
* This function receives base theme options (without components) and should return modified options.
|
|
12
|
+
* Changes are applied before component styles are generated.
|
|
13
|
+
*/
|
|
14
|
+
themeOptionsModifier?: (options: Omit<ThemeOptions, 'components'>) => Omit<ThemeOptions, 'components'>;
|
|
15
|
+
/**
|
|
16
|
+
* Modifier function to customize MUI component styles and default props.
|
|
17
|
+
* This function receives generated component configurations and theme and should return modified configurations.
|
|
18
|
+
* Changes are applied after the full theme is created.
|
|
19
|
+
*
|
|
20
|
+
* **Important:** WebPros component styles are assembled in `getMUIComponents()`.
|
|
21
|
+
*/
|
|
22
|
+
themeComponentsModifier?: (options: M3Components, theme: Theme) => M3Components;
|
|
7
23
|
};
|
|
8
|
-
declare const WebProsMuiThemeProvider: ({ children, localization, themeMode }:
|
|
24
|
+
declare const WebProsMuiThemeProvider: ({ children, localization, themeMode, themeOptionsModifier, themeComponentsModifier, }: WebProsMuiThemeProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
25
|
export default WebProsMuiThemeProvider;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import ThemeModeProvider from './ThemeModeProvider';
|
|
3
3
|
import WebProsTheme from './WebProsTheme';
|
|
4
|
-
const WebProsMuiThemeProvider = ({ children, localization, themeMode }) => (_jsx(ThemeModeProvider, { children: _jsx(WebProsTheme, { mode: themeMode, localization: localization, children: children }) }));
|
|
4
|
+
const WebProsMuiThemeProvider = ({ children, localization, themeMode, themeOptionsModifier, themeComponentsModifier, }) => (_jsx(ThemeModeProvider, { children: _jsx(WebProsTheme, { mode: themeMode, localization: localization, themeOptionsModifier: themeOptionsModifier, themeComponentsModifier: themeComponentsModifier, children: children }) }));
|
|
5
5
|
export default WebProsMuiThemeProvider;
|
|
@@ -1,10 +1,28 @@
|
|
|
1
|
+
import { ThemeOptions, Theme } from '@mui/material';
|
|
1
2
|
import '../utils/getMUIThemeCustoimzationType';
|
|
3
|
+
import { M3Components } from '../utils/getMUIComponents';
|
|
2
4
|
import { ThemeMode } from '../tokens/ThemeMode';
|
|
3
5
|
import { Localization } from '@mui/material/locale';
|
|
4
6
|
type WebProsThemeProps = {
|
|
5
7
|
children?: React.ReactNode;
|
|
6
8
|
mode?: ThemeMode;
|
|
7
9
|
localization?: Localization;
|
|
10
|
+
/**
|
|
11
|
+
* Modifier function for theme foundation (palette, typography, spacing, etc.).
|
|
12
|
+
* Applied before component styles generation.
|
|
13
|
+
*
|
|
14
|
+
* **Performance Note**: To avoid unnecessary theme recreations, wrap modifier functions
|
|
15
|
+
* with `useCallback` if they depend on dynamic values, or define them outside component.
|
|
16
|
+
*/
|
|
17
|
+
themeOptionsModifier?: (options: Omit<ThemeOptions, 'components'>) => Omit<ThemeOptions, 'components'>;
|
|
18
|
+
/**
|
|
19
|
+
* Modifier function for MUI component configurations.
|
|
20
|
+
* Applied after theme creation with access to all theme tokens.
|
|
21
|
+
*
|
|
22
|
+
* **Performance Note**: To avoid unnecessary theme recreations, wrap modifier functions
|
|
23
|
+
* with `useCallback` if they depend on dynamic values, or define them outside component.
|
|
24
|
+
*/
|
|
25
|
+
themeComponentsModifier?: (options: M3Components, theme: Theme) => M3Components;
|
|
8
26
|
};
|
|
9
|
-
export declare const WebProsTheme: ({ children, mode, localization }: WebProsThemeProps) => import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
export declare const WebProsTheme: ({ children, mode, localization, themeOptionsModifier, themeComponentsModifier, }: WebProsThemeProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
28
|
export default WebProsTheme;
|
|
@@ -11,21 +11,34 @@ import { enUS } from '@mui/material/locale';
|
|
|
11
11
|
import { patchMUIShadows } from '../utils/patchMUIShadows';
|
|
12
12
|
import { ThemeSchemeDefault } from '../tokens/ThemeScheme';
|
|
13
13
|
import { getMUITypography } from '../utils/getMUITypography';
|
|
14
|
-
export const WebProsTheme = ({ children, mode, localization = enUS }) => {
|
|
14
|
+
export const WebProsTheme = ({ children, mode, localization = enUS, themeOptionsModifier, themeComponentsModifier, }) => {
|
|
15
15
|
const themeModeContext = useContext(ThemeModeContext);
|
|
16
16
|
const themeMode = mode !== null && mode !== void 0 ? mode : themeModeContext.themeMode;
|
|
17
|
-
const typography = getMUITypography();
|
|
18
17
|
const webprosTheme = useMemo(() => {
|
|
18
|
+
const typography = getMUITypography();
|
|
19
19
|
const muiPalette = getMUIPalette(themeMode, ThemeSchemeDefault);
|
|
20
|
-
|
|
20
|
+
// Prepare base theme options (without components)
|
|
21
|
+
const baseThemeOptions = {
|
|
21
22
|
palette: muiPalette.palette,
|
|
22
23
|
colors: muiPalette.colors,
|
|
23
|
-
typography: Object.assign(Object.assign({},
|
|
24
|
-
}
|
|
24
|
+
typography: Object.assign(Object.assign({}, typography), { fontFamily: "'Roboto', 'Helvetica', 'Arial', sans-serif", fontSize: 14, fontWeightLight: 300, fontWeightRegular: 400, fontWeightMedium: 500, fontWeightBold: 700, h1: Object.assign({}, typography.DisplayLarge), h2: Object.assign({}, typography.DisplayMedium), h3: Object.assign({}, typography.DisplaySmall), h4: Object.assign({}, typography.HeadlineLarge), h5: Object.assign({}, typography.HeadlineMedium), h6: Object.assign({}, typography.HeadlineSmall), subtitle1: Object.assign({}, typography.TitleLarge), subtitle2: Object.assign({}, typography.TitleMedium), body1: Object.assign({}, typography.BodyMedium), body2: Object.assign({}, typography.BodySmall), button: Object.assign({}, typography.HeadlineLarge), caption: Object.assign({}, typography.BodySmall), overline: Object.assign({}, typography.LabelSmall) }),
|
|
25
|
+
};
|
|
26
|
+
// Apply themeOptionsModifier (palette, typography, spacing, etc.)
|
|
27
|
+
let themeOptions = baseThemeOptions;
|
|
28
|
+
if (themeOptionsModifier) {
|
|
29
|
+
themeOptions = themeOptionsModifier(themeOptions);
|
|
30
|
+
}
|
|
31
|
+
let theme = createTheme(themeOptions, localization);
|
|
25
32
|
patchMUIShadows(theme);
|
|
26
|
-
|
|
33
|
+
// Apply themeComponentsModifier (component styles and props)
|
|
34
|
+
if (themeComponentsModifier) {
|
|
35
|
+
theme = deepmerge(theme, themeComponentsModifier(getMUIComponents(theme, themeMode), theme));
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
theme = deepmerge(theme, getMUIComponents(theme, themeMode));
|
|
39
|
+
}
|
|
27
40
|
return theme;
|
|
28
|
-
}, [themeMode, localization]);
|
|
41
|
+
}, [themeMode, localization, themeOptionsModifier, themeComponentsModifier]);
|
|
29
42
|
return (_jsxs(ThemeProvider, { theme: webprosTheme, children: [_jsx(CssBaseline, { enableColorScheme: true }), children] }));
|
|
30
43
|
};
|
|
31
44
|
export default WebProsTheme;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { ThemeColorTokensLegacy } from '../tokens/legacyColors/ThemeColorTokensLegacy';
|
|
2
1
|
import { Schemes, SchemesGenerated, StateLayers, StateLayersGenerated, InverseSchemes, InverseSchemesGenerated, InverseStateLayers, InverseStateLayersGenerated } from '../tokens/colors';
|
|
3
|
-
export type ThemeColorTokens =
|
|
2
|
+
export type ThemeColorTokens = {
|
|
4
3
|
schemes: Schemes;
|
|
5
4
|
stateLayers: StateLayers;
|
|
6
5
|
inverseSchemes: InverseSchemes;
|
|
@@ -1,8 +1,25 @@
|
|
|
1
1
|
// Copyright 2025 WebPros International GmbH. All rights reserved.
|
|
2
2
|
import { DarkSchemes, DarkSchemesGenerated, DarkStateLayers, DarkStateLayersGenerated, DarkInverseSchemes, DarkInverseSchemesGenerated, DarkInverseStateLayers, DarkInverseStateLayersGenerated, LightSchemes, LightSchemesGenerated, LightStateLayers, LightStateLayersGenerated, LightInverseSchemes, LightInverseSchemesGenerated, LightInverseStateLayers, LightInverseStateLayersGenerated, } from '../tokens/colors';
|
|
3
|
-
import { LegacyDarkTokensDefault, LegacyLightTokensDefault, } from '../tokens/legacyColors';
|
|
4
3
|
// reference
|
|
5
|
-
export const LightTokensDefault =
|
|
4
|
+
export const LightTokensDefault = {
|
|
5
|
+
schemes: LightSchemes,
|
|
6
|
+
stateLayers: LightStateLayers,
|
|
7
|
+
inverseSchemes: LightInverseSchemes,
|
|
8
|
+
inverseStateLayers: LightInverseStateLayers,
|
|
9
|
+
generatedSchemes: LightSchemesGenerated,
|
|
10
|
+
generatedStateLayers: LightStateLayersGenerated,
|
|
11
|
+
generatedInverseSchemes: LightInverseSchemesGenerated,
|
|
12
|
+
generatedInverseStateLayers: LightInverseStateLayersGenerated,
|
|
13
|
+
};
|
|
6
14
|
// reference
|
|
7
15
|
// https://www.figma.com/design/RPLeGa2LdhKElQQ0xIXtSh/WebPros-dashboard?node-id=53699-35493&t=pvKyGGnGRUL3kYn8-1
|
|
8
|
-
export const DarkTokensDefault =
|
|
16
|
+
export const DarkTokensDefault = {
|
|
17
|
+
schemes: DarkSchemes,
|
|
18
|
+
stateLayers: DarkStateLayers,
|
|
19
|
+
inverseSchemes: DarkInverseSchemes,
|
|
20
|
+
inverseStateLayers: DarkInverseStateLayers,
|
|
21
|
+
generatedSchemes: DarkSchemesGenerated,
|
|
22
|
+
generatedStateLayers: DarkStateLayersGenerated,
|
|
23
|
+
generatedInverseSchemes: DarkInverseSchemesGenerated,
|
|
24
|
+
generatedInverseStateLayers: DarkInverseStateLayersGenerated,
|
|
25
|
+
};
|
|
@@ -16,29 +16,27 @@ function extractPath(svg) {
|
|
|
16
16
|
const StyledIconWrapper = styled('span', {
|
|
17
17
|
shouldForwardProp: (prop) => prop !== 'iconColor',
|
|
18
18
|
})(({ theme, iconColor }) => {
|
|
19
|
+
const { colors } = theme;
|
|
19
20
|
if (!iconColor || iconColor === 'inherit') {
|
|
20
21
|
return { display: 'inline-flex', color: 'inherit' };
|
|
21
22
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
// Map MUI color tokens to M3 color schemes
|
|
24
|
+
const colorMapping = {
|
|
25
|
+
primary: colors.schemes.base.primary,
|
|
26
|
+
secondary: colors.schemes.base.secondary,
|
|
27
|
+
error: colors.schemes.status.error,
|
|
28
|
+
warning: colors.schemes.status.warning,
|
|
29
|
+
info: colors.schemes.status.info,
|
|
30
|
+
success: colors.schemes.status.success,
|
|
31
|
+
action: colors.schemes.surfaces.onSurfaceVariant,
|
|
32
|
+
disabled: colors.stateLayers.surfaces.onSurface.opacity38,
|
|
33
|
+
};
|
|
34
|
+
if (colorMapping[iconColor]) {
|
|
31
35
|
return {
|
|
32
36
|
display: 'inline-flex',
|
|
33
|
-
color:
|
|
37
|
+
color: colorMapping[iconColor],
|
|
34
38
|
};
|
|
35
39
|
}
|
|
36
|
-
if (iconColor === 'action') {
|
|
37
|
-
return { display: 'inline-flex', color: theme.palette.action.active };
|
|
38
|
-
}
|
|
39
|
-
if (iconColor === 'disabled') {
|
|
40
|
-
return { display: 'inline-flex', color: theme.palette.action.disabled };
|
|
41
|
-
}
|
|
42
40
|
return { display: 'inline-flex', color: iconColor };
|
|
43
41
|
});
|
|
44
42
|
function extractPathsData(svg) {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Theme } from '@mui/material';
|
|
2
2
|
import { ThemeMode } from '../tokens/ThemeMode';
|
|
3
|
-
type M3Components = {
|
|
3
|
+
export type M3Components = {
|
|
4
4
|
components: Theme['components'];
|
|
5
5
|
};
|
|
6
6
|
export declare const getMUIComponents: (theme: Theme, _mode: ThemeMode) => M3Components;
|
|
7
|
-
export {};
|
|
@@ -1,24 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ThemeOptions } from '@mui/material';
|
|
2
2
|
import { ThemeMode } from '../tokens/ThemeMode';
|
|
3
3
|
import { ThemeScheme } from '../tokens/ThemeScheme';
|
|
4
|
-
import { Schemes, StateLayers } from '../tokens/colors';
|
|
5
4
|
declare module '@mui/material/styles' {
|
|
6
|
-
interface
|
|
7
|
-
onPrimary: PaletteColor;
|
|
8
|
-
onPrimaryContainer: PaletteColor;
|
|
9
|
-
secondary: PaletteColor;
|
|
10
|
-
onError: PaletteColor;
|
|
11
|
-
surface: PaletteColor;
|
|
12
|
-
onSurface: PaletteColor;
|
|
13
|
-
surfaceDim: PaletteColor;
|
|
14
|
-
surfaceContainerLowest: PaletteColor;
|
|
15
|
-
surfaceContainer: PaletteColor;
|
|
16
|
-
onSurfaceVariant: PaletteColor;
|
|
17
|
-
supportive: PaletteColor;
|
|
18
|
-
}
|
|
19
|
-
interface Palette extends M3Palette {
|
|
20
|
-
}
|
|
21
|
-
interface M3PaletteOptions extends Record<keyof M3Palette, PaletteColorOptions | StateLayers | Schemes> {
|
|
5
|
+
interface M3PaletteOptions {
|
|
22
6
|
themeMode: string;
|
|
23
7
|
}
|
|
24
8
|
interface PaletteOptions extends M3PaletteOptions {
|