@mui/system 6.1.9 → 6.2.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/CHANGELOG.md +82 -0
- package/Grid/createGrid.d.ts +2 -0
- package/Grid/createGrid.js +2 -1
- package/Grid/index.d.ts +1 -0
- package/Grid/index.js +24 -2
- package/cssVars/createCssVarsProvider.js +46 -42
- package/esm/Grid/createGrid.js +2 -1
- package/esm/Grid/index.js +2 -1
- package/esm/cssVars/createCssVarsProvider.js +46 -42
- package/esm/version/index.js +3 -3
- package/index.js +1 -1
- package/memoTheme.d.ts +1 -1
- package/modern/Grid/createGrid.js +2 -1
- package/modern/Grid/index.js +2 -1
- package/modern/cssVars/createCssVarsProvider.js +46 -42
- package/modern/index.js +1 -1
- package/modern/version/index.js +3 -3
- package/package.json +4 -4
- package/version/index.js +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,87 @@
|
|
|
1
1
|
# [Versions](https://mui.com/versions/)
|
|
2
2
|
|
|
3
|
+
## 6.2.0
|
|
4
|
+
|
|
5
|
+
<!-- generated comparing v6.1.10..master -->
|
|
6
|
+
|
|
7
|
+
_Dec 10, 2024_
|
|
8
|
+
|
|
9
|
+
A big thanks to the 9 contributors who made this release possible. Here are some highlights ✨:
|
|
10
|
+
|
|
11
|
+
- Material UI is now compatible with React 19 (#44672) @DiegoAndai
|
|
12
|
+
- Fixed incorrect `aria-orientation` for vertical sliders. <kbd>ArrowRight</kbd> now increases the value and <kbd>ArrowLeft</kbd> decreases the value in vertical sliders; they were reversed in prior versions. (#44537) @mj12albert
|
|
13
|
+
|
|
14
|
+
### `@mui/material@6.2.0`
|
|
15
|
+
|
|
16
|
+
- [Box] Add missing `component` to `BoxProps` type (#44643) @DiegoAndai
|
|
17
|
+
- [Grid] Fix spacing when using css variables (#44663) @DiegoAndai
|
|
18
|
+
- [ListItemText] Add `slots` and `slotProps` (#44571) @sai6855
|
|
19
|
+
|
|
20
|
+
### Docs
|
|
21
|
+
|
|
22
|
+
- Add Toolpad Core template link (#44415) @bharatkashyap
|
|
23
|
+
|
|
24
|
+
### Core
|
|
25
|
+
|
|
26
|
+
- [docs-infra] Allow custom annotations (#44707) @vladmoroz
|
|
27
|
+
- [Box] Fix `component` prop test (#44651) @DiegoAndai
|
|
28
|
+
- React 19 useRef cleanup (#44704) @DiegoAndai
|
|
29
|
+
- Remove obselete lerna options (#44676) @ZeeshanTamboli
|
|
30
|
+
- Fix Regular Expression Denial of Service (ReDoS) vulnerabilities (#44627) @SuperMaxine
|
|
31
|
+
- Fix number of contributors (#44650) @aarongarciah
|
|
32
|
+
- [docs-infra] Add support for data attributes in the API generation (#44709) @mnajdova
|
|
33
|
+
- [docs-infra] Fix RTL dark mode (#41803) @alexfauquette
|
|
34
|
+
- [Grid] Remove deeply nested imports (#43605) @Janpot
|
|
35
|
+
|
|
36
|
+
All contributors of this release in alphabetical order: @aarongarciah, @alexfauquette, @bharatkashyap, @DiegoAndai, @Janpot, @mj12albert, @mnajdova, @sai6855, @SuperMaxine, @vladmoroz, @ZeeshanTamboli
|
|
37
|
+
|
|
38
|
+
## 6.1.10
|
|
39
|
+
|
|
40
|
+
<!-- generated comparing v6.1.9..master -->
|
|
41
|
+
|
|
42
|
+
_Dec 3, 2024_
|
|
43
|
+
|
|
44
|
+
A big thanks to the 11 contributors who made this release possible.
|
|
45
|
+
|
|
46
|
+
### `@mui/material@6.1.10`
|
|
47
|
+
|
|
48
|
+
- [Avatar] Fix `slotProps.img` not spread to hook (#44536) @siriwatknp
|
|
49
|
+
- [FilledInput] Use `slotProps` instead of `componentsProps` (#44552) @siriwatknp
|
|
50
|
+
- [Grid2] Fix theme scoping error (#44599) @siriwatknp
|
|
51
|
+
- [Grid2] Add container styles from styleOverrides (#44598) @sai6855
|
|
52
|
+
- Skip `tonalOffset` from setting color channel (#44585) @siriwatknp
|
|
53
|
+
- Remove few more React.ReactElement<any> types (#44290) @sai6855
|
|
54
|
+
- [Tabs] Fix `ScrollbarSize` ref being overriden (#44593) @DiegoAndai
|
|
55
|
+
- [Select][TextField] Fix screen reader from saying `&ZeroWidthSpace` (#44631) @arishoham
|
|
56
|
+
|
|
57
|
+
### `@mui/system@6.1.10`
|
|
58
|
+
|
|
59
|
+
- [ThemeProvider] Optimize `theme` changes when enabling CSS theme variables (#44588) @siriwatknp
|
|
60
|
+
|
|
61
|
+
### Docs
|
|
62
|
+
|
|
63
|
+
- Notification for the MUI X v8 alpha zero announcement blog post (#44629) @joserodolfofreitas
|
|
64
|
+
- Bump React Router to ^7.0.1 (#44531) @oliviertassinari
|
|
65
|
+
- [material-ui] Replace testid with id in migration guide (#44636) @sai6855
|
|
66
|
+
- [material-ui][TextField] Update usage of `InputLabelProps` in docs (#44634) @sai6855
|
|
67
|
+
- [material-ui][ListItem] Add missing diffs in migration guide (#44638) @sai6855
|
|
68
|
+
- [examples] Use Next.js 14 on examples (#44486) @DiegoAndai
|
|
69
|
+
- Update links and sidebar nav for Base UI components in Material UI (#44581) @samuelsycamore
|
|
70
|
+
|
|
71
|
+
### Core
|
|
72
|
+
|
|
73
|
+
- Remove `getSlotOwnerState` from `useSlot` util (#44403) @ZeeshanTamboli
|
|
74
|
+
- Extract useRippleHandler outside of ButtonBase (#44591) @albarv340
|
|
75
|
+
- Update eslint config (#44586) @MBilalShafi
|
|
76
|
+
- [core-infra] Remove useless fragments (#44516) @oliviertassinari
|
|
77
|
+
- [docs-infra] Fix Banner CLS (#44632) @oliviertassinari
|
|
78
|
+
- [docs-infra] Change CSS vars generation to be extracted from Enum (#44587) @mnajdova
|
|
79
|
+
- [docs-infra] Automatically hide Black Friday banner (#44630) @oliviertassinari
|
|
80
|
+
- [docs-infra] Fix TOC RTL padding regression (#44535) @oliviertassinari
|
|
81
|
+
- [test-utils] Remove leftover React.ReactElement<any> from describeConformance.tsx (#44639) @sai6855
|
|
82
|
+
|
|
83
|
+
All contributors of this release in alphabetical order: @albarv340, @arishoham, @DiegoAndai, @joserodolfofreitas, @MBilalShafi, @mnajdova, @oliviertassinari, @sai6855, @samuelsycamore, @siriwatknp, @ZeeshanTamboli
|
|
84
|
+
|
|
3
85
|
## 6.1.9
|
|
4
86
|
|
|
5
87
|
<!-- generated comparing v6.1.8..master -->
|
package/Grid/createGrid.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { OverridableComponent } from '@mui/types';
|
|
3
|
+
import useThemeSystem from '../useTheme';
|
|
3
4
|
import { GridTypeMap } from './GridProps';
|
|
4
5
|
declare const defaultCreateStyledComponent: import("@mui/styled-engine").CreateStyledComponent<import("../createStyled").MUIStyledCommonProps<any>, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.ClassAttributes<HTMLDivElement> | keyof React.HTMLAttributes<HTMLDivElement>>, {}, any>;
|
|
5
6
|
declare function useThemePropsDefault<T extends {}>(props: T): T;
|
|
6
7
|
export default function createGrid(options?: {
|
|
7
8
|
createStyledComponent?: typeof defaultCreateStyledComponent;
|
|
8
9
|
useThemeProps?: typeof useThemePropsDefault;
|
|
10
|
+
useTheme?: typeof useThemeSystem;
|
|
9
11
|
componentName?: string;
|
|
10
12
|
}): OverridableComponent<GridTypeMap<{}, "div">>;
|
|
11
13
|
export {};
|
package/Grid/createGrid.js
CHANGED
|
@@ -39,6 +39,7 @@ function createGrid(options = {}) {
|
|
|
39
39
|
// This will allow adding custom styled fn (for example for custom sx style function)
|
|
40
40
|
createStyledComponent = defaultCreateStyledComponent,
|
|
41
41
|
useThemeProps = useThemePropsDefault,
|
|
42
|
+
useTheme = _useTheme.default,
|
|
42
43
|
componentName = 'MuiGrid'
|
|
43
44
|
} = options;
|
|
44
45
|
const useUtilityClasses = (ownerState, theme) => {
|
|
@@ -79,7 +80,7 @@ function createGrid(options = {}) {
|
|
|
79
80
|
}
|
|
80
81
|
const GridRoot = createStyledComponent(_gridGenerator.generateGridColumnsStyles, _gridGenerator.generateGridColumnSpacingStyles, _gridGenerator.generateGridRowSpacingStyles, _gridGenerator.generateGridSizeStyles, _gridGenerator.generateGridDirectionStyles, _gridGenerator.generateGridStyles, _gridGenerator.generateGridOffsetStyles);
|
|
81
82
|
const Grid = /*#__PURE__*/React.forwardRef(function Grid(inProps, ref) {
|
|
82
|
-
const theme = (
|
|
83
|
+
const theme = useTheme();
|
|
83
84
|
const themeProps = useThemeProps(inProps);
|
|
84
85
|
const props = (0, _styleFunctionSx.extendSxProp)(themeProps); // `color` type conflicts with html color attribute.
|
|
85
86
|
const {
|
package/Grid/index.d.ts
CHANGED
|
@@ -4,3 +4,4 @@ export * from './GridProps';
|
|
|
4
4
|
export { default as gridClasses } from './gridClasses';
|
|
5
5
|
export * from './gridClasses';
|
|
6
6
|
export { traverseBreakpoints as unstable_traverseBreakpoints } from './traverseBreakpoints';
|
|
7
|
+
export { generateDirectionClasses as unstable_generateDirectionClasses, generateSizeClassNames as unstable_generateSizeClassNames, generateSpacingClassNames as unstable_generateSpacingClassNames, } from './gridGenerator';
|
package/Grid/index.js
CHANGED
|
@@ -8,7 +8,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
var _exportNames = {
|
|
9
9
|
createGrid: true,
|
|
10
10
|
gridClasses: true,
|
|
11
|
-
unstable_traverseBreakpoints: true
|
|
11
|
+
unstable_traverseBreakpoints: true,
|
|
12
|
+
unstable_generateDirectionClasses: true,
|
|
13
|
+
unstable_generateSizeClassNames: true,
|
|
14
|
+
unstable_generateSpacingClassNames: true
|
|
12
15
|
};
|
|
13
16
|
Object.defineProperty(exports, "createGrid", {
|
|
14
17
|
enumerable: true,
|
|
@@ -28,6 +31,24 @@ Object.defineProperty(exports, "gridClasses", {
|
|
|
28
31
|
return _gridClasses.default;
|
|
29
32
|
}
|
|
30
33
|
});
|
|
34
|
+
Object.defineProperty(exports, "unstable_generateDirectionClasses", {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
get: function () {
|
|
37
|
+
return _gridGenerator.generateDirectionClasses;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
Object.defineProperty(exports, "unstable_generateSizeClassNames", {
|
|
41
|
+
enumerable: true,
|
|
42
|
+
get: function () {
|
|
43
|
+
return _gridGenerator.generateSizeClassNames;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
Object.defineProperty(exports, "unstable_generateSpacingClassNames", {
|
|
47
|
+
enumerable: true,
|
|
48
|
+
get: function () {
|
|
49
|
+
return _gridGenerator.generateSpacingClassNames;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
31
52
|
Object.defineProperty(exports, "unstable_traverseBreakpoints", {
|
|
32
53
|
enumerable: true,
|
|
33
54
|
get: function () {
|
|
@@ -60,4 +81,5 @@ Object.keys(_gridClasses).forEach(function (key) {
|
|
|
60
81
|
}
|
|
61
82
|
});
|
|
62
83
|
});
|
|
63
|
-
var _traverseBreakpoints = require("./traverseBreakpoints");
|
|
84
|
+
var _traverseBreakpoints = require("./traverseBreakpoints");
|
|
85
|
+
var _gridGenerator = require("./gridGenerator");
|
|
@@ -47,6 +47,8 @@ function createCssVarsProvider(options) {
|
|
|
47
47
|
ColorSchemeContext.displayName = 'ColorSchemeContext';
|
|
48
48
|
}
|
|
49
49
|
const useColorScheme = () => React.useContext(ColorSchemeContext) || defaultContext;
|
|
50
|
+
const defaultColorSchemes = {};
|
|
51
|
+
const defaultComponents = {};
|
|
50
52
|
function CssVarsProvider(props) {
|
|
51
53
|
const {
|
|
52
54
|
children,
|
|
@@ -73,12 +75,12 @@ function createCssVarsProvider(options) {
|
|
|
73
75
|
return typeof defaultTheme === 'function' ? defaultTheme() : defaultTheme;
|
|
74
76
|
}, [themeProp]);
|
|
75
77
|
const scopedTheme = initialTheme[themeId];
|
|
78
|
+
const restThemeProp = scopedTheme || initialTheme;
|
|
76
79
|
const {
|
|
77
|
-
colorSchemes =
|
|
78
|
-
components =
|
|
79
|
-
cssVarPrefix
|
|
80
|
-
|
|
81
|
-
} = scopedTheme || initialTheme;
|
|
80
|
+
colorSchemes = defaultColorSchemes,
|
|
81
|
+
components = defaultComponents,
|
|
82
|
+
cssVarPrefix
|
|
83
|
+
} = restThemeProp;
|
|
82
84
|
const joinedColorSchemes = Object.keys(colorSchemes).filter(k => !!colorSchemes[k]).join(',');
|
|
83
85
|
const allColorSchemes = React.useMemo(() => joinedColorSchemes.split(','), [joinedColorSchemes]);
|
|
84
86
|
const defaultLightColorScheme = typeof defaultColorScheme === 'string' ? defaultColorScheme : defaultColorScheme.light;
|
|
@@ -110,43 +112,45 @@ function createCssVarsProvider(options) {
|
|
|
110
112
|
mode = ctx.mode;
|
|
111
113
|
colorScheme = ctx.colorScheme;
|
|
112
114
|
}
|
|
115
|
+
const memoTheme = React.useMemo(() => {
|
|
116
|
+
// `colorScheme` is undefined on the server and hydration phase
|
|
117
|
+
const calculatedColorScheme = colorScheme || restThemeProp.defaultColorScheme;
|
|
113
118
|
|
|
114
|
-
|
|
115
|
-
|
|
119
|
+
// 2. get the `vars` object that refers to the CSS custom properties
|
|
120
|
+
const themeVars = restThemeProp.generateThemeVars?.() || restThemeProp.vars;
|
|
116
121
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
if (typeof theme.generateSpacing === 'function') {
|
|
129
|
-
theme.spacing = theme.generateSpacing();
|
|
130
|
-
}
|
|
122
|
+
// 3. Start composing the theme object
|
|
123
|
+
const theme = {
|
|
124
|
+
...restThemeProp,
|
|
125
|
+
components,
|
|
126
|
+
colorSchemes,
|
|
127
|
+
cssVarPrefix,
|
|
128
|
+
vars: themeVars
|
|
129
|
+
};
|
|
130
|
+
if (typeof theme.generateSpacing === 'function') {
|
|
131
|
+
theme.spacing = theme.generateSpacing();
|
|
132
|
+
}
|
|
131
133
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
134
|
+
// 4. Resolve the color scheme and merge it to the theme
|
|
135
|
+
if (calculatedColorScheme) {
|
|
136
|
+
const scheme = colorSchemes[calculatedColorScheme];
|
|
137
|
+
if (scheme && typeof scheme === 'object') {
|
|
138
|
+
// 4.1 Merge the selected color scheme to the theme
|
|
139
|
+
Object.keys(scheme).forEach(schemeKey => {
|
|
140
|
+
if (scheme[schemeKey] && typeof scheme[schemeKey] === 'object') {
|
|
141
|
+
// shallow merge the 1st level structure of the theme.
|
|
142
|
+
theme[schemeKey] = {
|
|
143
|
+
...theme[schemeKey],
|
|
144
|
+
...scheme[schemeKey]
|
|
145
|
+
};
|
|
146
|
+
} else {
|
|
147
|
+
theme[schemeKey] = scheme[schemeKey];
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
}
|
|
148
151
|
}
|
|
149
|
-
|
|
152
|
+
return resolveTheme ? resolveTheme(theme) : theme;
|
|
153
|
+
}, [restThemeProp, colorScheme, components, colorSchemes, cssVarPrefix]);
|
|
150
154
|
|
|
151
155
|
// 5. Declaring effects
|
|
152
156
|
// 5.1 Updates the selector value to use the current color scheme which tells CSS to use the proper stylesheet.
|
|
@@ -220,13 +224,13 @@ function createCssVarsProvider(options) {
|
|
|
220
224
|
mode,
|
|
221
225
|
setColorScheme,
|
|
222
226
|
setMode: process.env.NODE_ENV === 'production' ? setMode : newMode => {
|
|
223
|
-
if (
|
|
227
|
+
if (memoTheme.colorSchemeSelector === 'media') {
|
|
224
228
|
console.error(['MUI: The `setMode` function has no effect if `colorSchemeSelector` is `media` (`media` is the default value).', 'To toggle the mode manually, please configure `colorSchemeSelector` to use a class or data attribute.', 'To learn more, visit https://mui.com/material-ui/customization/css-theme-variables/configuration/#toggling-dark-mode-manually'].join('\n'));
|
|
225
229
|
}
|
|
226
230
|
setMode(newMode);
|
|
227
231
|
},
|
|
228
232
|
systemMode
|
|
229
|
-
}), [allColorSchemes, colorScheme, darkColorScheme, lightColorScheme, mode, setColorScheme, setMode, systemMode,
|
|
233
|
+
}), [allColorSchemes, colorScheme, darkColorScheme, lightColorScheme, mode, setColorScheme, setMode, systemMode, memoTheme.colorSchemeSelector]);
|
|
230
234
|
let shouldGenerateStyleSheet = true;
|
|
231
235
|
if (disableStyleSheetGeneration || restThemeProp.cssVariables === false || nested && upperTheme?.cssVarPrefix === cssVarPrefix) {
|
|
232
236
|
shouldGenerateStyleSheet = false;
|
|
@@ -234,10 +238,10 @@ function createCssVarsProvider(options) {
|
|
|
234
238
|
const element = /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
235
239
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ThemeProvider.default, {
|
|
236
240
|
themeId: scopedTheme ? themeId : undefined,
|
|
237
|
-
theme:
|
|
241
|
+
theme: memoTheme,
|
|
238
242
|
children: children
|
|
239
243
|
}), shouldGenerateStyleSheet && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styledEngine.GlobalStyles, {
|
|
240
|
-
styles:
|
|
244
|
+
styles: memoTheme.generateStyleSheets?.() || []
|
|
241
245
|
})]
|
|
242
246
|
});
|
|
243
247
|
if (nested) {
|
package/esm/Grid/createGrid.js
CHANGED
|
@@ -6,7 +6,7 @@ import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
|
6
6
|
import composeClasses from '@mui/utils/composeClasses';
|
|
7
7
|
import systemStyled from "../styled/index.js";
|
|
8
8
|
import useThemePropsSystem from "../useThemeProps/index.js";
|
|
9
|
-
import
|
|
9
|
+
import useThemeSystem from "../useTheme/index.js";
|
|
10
10
|
import { extendSxProp } from "../styleFunctionSx/index.js";
|
|
11
11
|
import createTheme from "../createTheme/index.js";
|
|
12
12
|
import { generateGridStyles, generateGridSizeStyles, generateGridColumnsStyles, generateGridColumnSpacingStyles, generateGridRowSpacingStyles, generateGridDirectionStyles, generateGridOffsetStyles, generateSizeClassNames, generateSpacingClassNames, generateDirectionClasses } from "./gridGenerator.js";
|
|
@@ -31,6 +31,7 @@ export default function createGrid(options = {}) {
|
|
|
31
31
|
// This will allow adding custom styled fn (for example for custom sx style function)
|
|
32
32
|
createStyledComponent = defaultCreateStyledComponent,
|
|
33
33
|
useThemeProps = useThemePropsDefault,
|
|
34
|
+
useTheme = useThemeSystem,
|
|
34
35
|
componentName = 'MuiGrid'
|
|
35
36
|
} = options;
|
|
36
37
|
const useUtilityClasses = (ownerState, theme) => {
|
package/esm/Grid/index.js
CHANGED
|
@@ -3,4 +3,5 @@ export { default as createGrid } from "./createGrid.js";
|
|
|
3
3
|
export * from "./GridProps.js";
|
|
4
4
|
export { default as gridClasses } from "./gridClasses.js";
|
|
5
5
|
export * from "./gridClasses.js";
|
|
6
|
-
export { traverseBreakpoints as unstable_traverseBreakpoints } from "./traverseBreakpoints.js";
|
|
6
|
+
export { traverseBreakpoints as unstable_traverseBreakpoints } from "./traverseBreakpoints.js";
|
|
7
|
+
export { generateDirectionClasses as unstable_generateDirectionClasses, generateSizeClassNames as unstable_generateSizeClassNames, generateSpacingClassNames as unstable_generateSpacingClassNames } from "./gridGenerator.js";
|
|
@@ -38,6 +38,8 @@ export default function createCssVarsProvider(options) {
|
|
|
38
38
|
ColorSchemeContext.displayName = 'ColorSchemeContext';
|
|
39
39
|
}
|
|
40
40
|
const useColorScheme = () => React.useContext(ColorSchemeContext) || defaultContext;
|
|
41
|
+
const defaultColorSchemes = {};
|
|
42
|
+
const defaultComponents = {};
|
|
41
43
|
function CssVarsProvider(props) {
|
|
42
44
|
const {
|
|
43
45
|
children,
|
|
@@ -64,12 +66,12 @@ export default function createCssVarsProvider(options) {
|
|
|
64
66
|
return typeof defaultTheme === 'function' ? defaultTheme() : defaultTheme;
|
|
65
67
|
}, [themeProp]);
|
|
66
68
|
const scopedTheme = initialTheme[themeId];
|
|
69
|
+
const restThemeProp = scopedTheme || initialTheme;
|
|
67
70
|
const {
|
|
68
|
-
colorSchemes =
|
|
69
|
-
components =
|
|
70
|
-
cssVarPrefix
|
|
71
|
-
|
|
72
|
-
} = scopedTheme || initialTheme;
|
|
71
|
+
colorSchemes = defaultColorSchemes,
|
|
72
|
+
components = defaultComponents,
|
|
73
|
+
cssVarPrefix
|
|
74
|
+
} = restThemeProp;
|
|
73
75
|
const joinedColorSchemes = Object.keys(colorSchemes).filter(k => !!colorSchemes[k]).join(',');
|
|
74
76
|
const allColorSchemes = React.useMemo(() => joinedColorSchemes.split(','), [joinedColorSchemes]);
|
|
75
77
|
const defaultLightColorScheme = typeof defaultColorScheme === 'string' ? defaultColorScheme : defaultColorScheme.light;
|
|
@@ -101,43 +103,45 @@ export default function createCssVarsProvider(options) {
|
|
|
101
103
|
mode = ctx.mode;
|
|
102
104
|
colorScheme = ctx.colorScheme;
|
|
103
105
|
}
|
|
106
|
+
const memoTheme = React.useMemo(() => {
|
|
107
|
+
// `colorScheme` is undefined on the server and hydration phase
|
|
108
|
+
const calculatedColorScheme = colorScheme || restThemeProp.defaultColorScheme;
|
|
104
109
|
|
|
105
|
-
|
|
106
|
-
|
|
110
|
+
// 2. get the `vars` object that refers to the CSS custom properties
|
|
111
|
+
const themeVars = restThemeProp.generateThemeVars?.() || restThemeProp.vars;
|
|
107
112
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
if (typeof theme.generateSpacing === 'function') {
|
|
120
|
-
theme.spacing = theme.generateSpacing();
|
|
121
|
-
}
|
|
113
|
+
// 3. Start composing the theme object
|
|
114
|
+
const theme = {
|
|
115
|
+
...restThemeProp,
|
|
116
|
+
components,
|
|
117
|
+
colorSchemes,
|
|
118
|
+
cssVarPrefix,
|
|
119
|
+
vars: themeVars
|
|
120
|
+
};
|
|
121
|
+
if (typeof theme.generateSpacing === 'function') {
|
|
122
|
+
theme.spacing = theme.generateSpacing();
|
|
123
|
+
}
|
|
122
124
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
125
|
+
// 4. Resolve the color scheme and merge it to the theme
|
|
126
|
+
if (calculatedColorScheme) {
|
|
127
|
+
const scheme = colorSchemes[calculatedColorScheme];
|
|
128
|
+
if (scheme && typeof scheme === 'object') {
|
|
129
|
+
// 4.1 Merge the selected color scheme to the theme
|
|
130
|
+
Object.keys(scheme).forEach(schemeKey => {
|
|
131
|
+
if (scheme[schemeKey] && typeof scheme[schemeKey] === 'object') {
|
|
132
|
+
// shallow merge the 1st level structure of the theme.
|
|
133
|
+
theme[schemeKey] = {
|
|
134
|
+
...theme[schemeKey],
|
|
135
|
+
...scheme[schemeKey]
|
|
136
|
+
};
|
|
137
|
+
} else {
|
|
138
|
+
theme[schemeKey] = scheme[schemeKey];
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
}
|
|
139
142
|
}
|
|
140
|
-
|
|
143
|
+
return resolveTheme ? resolveTheme(theme) : theme;
|
|
144
|
+
}, [restThemeProp, colorScheme, components, colorSchemes, cssVarPrefix]);
|
|
141
145
|
|
|
142
146
|
// 5. Declaring effects
|
|
143
147
|
// 5.1 Updates the selector value to use the current color scheme which tells CSS to use the proper stylesheet.
|
|
@@ -211,13 +215,13 @@ export default function createCssVarsProvider(options) {
|
|
|
211
215
|
mode,
|
|
212
216
|
setColorScheme,
|
|
213
217
|
setMode: process.env.NODE_ENV === 'production' ? setMode : newMode => {
|
|
214
|
-
if (
|
|
218
|
+
if (memoTheme.colorSchemeSelector === 'media') {
|
|
215
219
|
console.error(['MUI: The `setMode` function has no effect if `colorSchemeSelector` is `media` (`media` is the default value).', 'To toggle the mode manually, please configure `colorSchemeSelector` to use a class or data attribute.', 'To learn more, visit https://mui.com/material-ui/customization/css-theme-variables/configuration/#toggling-dark-mode-manually'].join('\n'));
|
|
216
220
|
}
|
|
217
221
|
setMode(newMode);
|
|
218
222
|
},
|
|
219
223
|
systemMode
|
|
220
|
-
}), [allColorSchemes, colorScheme, darkColorScheme, lightColorScheme, mode, setColorScheme, setMode, systemMode,
|
|
224
|
+
}), [allColorSchemes, colorScheme, darkColorScheme, lightColorScheme, mode, setColorScheme, setMode, systemMode, memoTheme.colorSchemeSelector]);
|
|
221
225
|
let shouldGenerateStyleSheet = true;
|
|
222
226
|
if (disableStyleSheetGeneration || restThemeProp.cssVariables === false || nested && upperTheme?.cssVarPrefix === cssVarPrefix) {
|
|
223
227
|
shouldGenerateStyleSheet = false;
|
|
@@ -225,10 +229,10 @@ export default function createCssVarsProvider(options) {
|
|
|
225
229
|
const element = /*#__PURE__*/_jsxs(React.Fragment, {
|
|
226
230
|
children: [/*#__PURE__*/_jsx(ThemeProvider, {
|
|
227
231
|
themeId: scopedTheme ? themeId : undefined,
|
|
228
|
-
theme:
|
|
232
|
+
theme: memoTheme,
|
|
229
233
|
children: children
|
|
230
234
|
}), shouldGenerateStyleSheet && /*#__PURE__*/_jsx(GlobalStyles, {
|
|
231
|
-
styles:
|
|
235
|
+
styles: memoTheme.generateStyleSheets?.() || []
|
|
232
236
|
})]
|
|
233
237
|
});
|
|
234
238
|
if (nested) {
|
package/esm/version/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export const version = "6.
|
|
1
|
+
export const version = "6.2.0";
|
|
2
2
|
export const major = Number("6");
|
|
3
|
-
export const minor = Number("
|
|
4
|
-
export const patch = Number("
|
|
3
|
+
export const minor = Number("2");
|
|
4
|
+
export const patch = Number("0");
|
|
5
5
|
export const prerelease = undefined;
|
|
6
6
|
export default version;
|
package/index.js
CHANGED
package/memoTheme.d.ts
CHANGED
|
@@ -8,5 +8,5 @@ type ThemeStyleFunction<T> = (props: {
|
|
|
8
8
|
*/
|
|
9
9
|
export default function unstable_memoTheme<T>(styleFn: ThemeStyleFunction<T>): (props: {
|
|
10
10
|
theme: T;
|
|
11
|
-
}) => string | number | boolean | import("@mui/styled-engine").
|
|
11
|
+
}) => string | number | boolean | import("@mui/styled-engine").CSSObject | import("@mui/styled-engine").ComponentSelector | import("@mui/styled-engine").Keyframes | import("@mui/styled-engine").SerializedStyles | import("@mui/styled-engine").ArrayCSSInterpolation | null;
|
|
12
12
|
export {};
|
|
@@ -6,7 +6,7 @@ import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
|
6
6
|
import composeClasses from '@mui/utils/composeClasses';
|
|
7
7
|
import systemStyled from "../styled/index.js";
|
|
8
8
|
import useThemePropsSystem from "../useThemeProps/index.js";
|
|
9
|
-
import
|
|
9
|
+
import useThemeSystem from "../useTheme/index.js";
|
|
10
10
|
import { extendSxProp } from "../styleFunctionSx/index.js";
|
|
11
11
|
import createTheme from "../createTheme/index.js";
|
|
12
12
|
import { generateGridStyles, generateGridSizeStyles, generateGridColumnsStyles, generateGridColumnSpacingStyles, generateGridRowSpacingStyles, generateGridDirectionStyles, generateGridOffsetStyles, generateSizeClassNames, generateSpacingClassNames, generateDirectionClasses } from "./gridGenerator.js";
|
|
@@ -31,6 +31,7 @@ export default function createGrid(options = {}) {
|
|
|
31
31
|
// This will allow adding custom styled fn (for example for custom sx style function)
|
|
32
32
|
createStyledComponent = defaultCreateStyledComponent,
|
|
33
33
|
useThemeProps = useThemePropsDefault,
|
|
34
|
+
useTheme = useThemeSystem,
|
|
34
35
|
componentName = 'MuiGrid'
|
|
35
36
|
} = options;
|
|
36
37
|
const useUtilityClasses = (ownerState, theme) => {
|
package/modern/Grid/index.js
CHANGED
|
@@ -3,4 +3,5 @@ export { default as createGrid } from "./createGrid.js";
|
|
|
3
3
|
export * from "./GridProps.js";
|
|
4
4
|
export { default as gridClasses } from "./gridClasses.js";
|
|
5
5
|
export * from "./gridClasses.js";
|
|
6
|
-
export { traverseBreakpoints as unstable_traverseBreakpoints } from "./traverseBreakpoints.js";
|
|
6
|
+
export { traverseBreakpoints as unstable_traverseBreakpoints } from "./traverseBreakpoints.js";
|
|
7
|
+
export { generateDirectionClasses as unstable_generateDirectionClasses, generateSizeClassNames as unstable_generateSizeClassNames, generateSpacingClassNames as unstable_generateSpacingClassNames } from "./gridGenerator.js";
|
|
@@ -38,6 +38,8 @@ export default function createCssVarsProvider(options) {
|
|
|
38
38
|
ColorSchemeContext.displayName = 'ColorSchemeContext';
|
|
39
39
|
}
|
|
40
40
|
const useColorScheme = () => React.useContext(ColorSchemeContext) || defaultContext;
|
|
41
|
+
const defaultColorSchemes = {};
|
|
42
|
+
const defaultComponents = {};
|
|
41
43
|
function CssVarsProvider(props) {
|
|
42
44
|
const {
|
|
43
45
|
children,
|
|
@@ -64,12 +66,12 @@ export default function createCssVarsProvider(options) {
|
|
|
64
66
|
return typeof defaultTheme === 'function' ? defaultTheme() : defaultTheme;
|
|
65
67
|
}, [themeProp]);
|
|
66
68
|
const scopedTheme = initialTheme[themeId];
|
|
69
|
+
const restThemeProp = scopedTheme || initialTheme;
|
|
67
70
|
const {
|
|
68
|
-
colorSchemes =
|
|
69
|
-
components =
|
|
70
|
-
cssVarPrefix
|
|
71
|
-
|
|
72
|
-
} = scopedTheme || initialTheme;
|
|
71
|
+
colorSchemes = defaultColorSchemes,
|
|
72
|
+
components = defaultComponents,
|
|
73
|
+
cssVarPrefix
|
|
74
|
+
} = restThemeProp;
|
|
73
75
|
const joinedColorSchemes = Object.keys(colorSchemes).filter(k => !!colorSchemes[k]).join(',');
|
|
74
76
|
const allColorSchemes = React.useMemo(() => joinedColorSchemes.split(','), [joinedColorSchemes]);
|
|
75
77
|
const defaultLightColorScheme = typeof defaultColorScheme === 'string' ? defaultColorScheme : defaultColorScheme.light;
|
|
@@ -101,43 +103,45 @@ export default function createCssVarsProvider(options) {
|
|
|
101
103
|
mode = ctx.mode;
|
|
102
104
|
colorScheme = ctx.colorScheme;
|
|
103
105
|
}
|
|
106
|
+
const memoTheme = React.useMemo(() => {
|
|
107
|
+
// `colorScheme` is undefined on the server and hydration phase
|
|
108
|
+
const calculatedColorScheme = colorScheme || restThemeProp.defaultColorScheme;
|
|
104
109
|
|
|
105
|
-
|
|
106
|
-
|
|
110
|
+
// 2. get the `vars` object that refers to the CSS custom properties
|
|
111
|
+
const themeVars = restThemeProp.generateThemeVars?.() || restThemeProp.vars;
|
|
107
112
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
if (typeof theme.generateSpacing === 'function') {
|
|
120
|
-
theme.spacing = theme.generateSpacing();
|
|
121
|
-
}
|
|
113
|
+
// 3. Start composing the theme object
|
|
114
|
+
const theme = {
|
|
115
|
+
...restThemeProp,
|
|
116
|
+
components,
|
|
117
|
+
colorSchemes,
|
|
118
|
+
cssVarPrefix,
|
|
119
|
+
vars: themeVars
|
|
120
|
+
};
|
|
121
|
+
if (typeof theme.generateSpacing === 'function') {
|
|
122
|
+
theme.spacing = theme.generateSpacing();
|
|
123
|
+
}
|
|
122
124
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
125
|
+
// 4. Resolve the color scheme and merge it to the theme
|
|
126
|
+
if (calculatedColorScheme) {
|
|
127
|
+
const scheme = colorSchemes[calculatedColorScheme];
|
|
128
|
+
if (scheme && typeof scheme === 'object') {
|
|
129
|
+
// 4.1 Merge the selected color scheme to the theme
|
|
130
|
+
Object.keys(scheme).forEach(schemeKey => {
|
|
131
|
+
if (scheme[schemeKey] && typeof scheme[schemeKey] === 'object') {
|
|
132
|
+
// shallow merge the 1st level structure of the theme.
|
|
133
|
+
theme[schemeKey] = {
|
|
134
|
+
...theme[schemeKey],
|
|
135
|
+
...scheme[schemeKey]
|
|
136
|
+
};
|
|
137
|
+
} else {
|
|
138
|
+
theme[schemeKey] = scheme[schemeKey];
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
}
|
|
139
142
|
}
|
|
140
|
-
|
|
143
|
+
return resolveTheme ? resolveTheme(theme) : theme;
|
|
144
|
+
}, [restThemeProp, colorScheme, components, colorSchemes, cssVarPrefix]);
|
|
141
145
|
|
|
142
146
|
// 5. Declaring effects
|
|
143
147
|
// 5.1 Updates the selector value to use the current color scheme which tells CSS to use the proper stylesheet.
|
|
@@ -211,13 +215,13 @@ export default function createCssVarsProvider(options) {
|
|
|
211
215
|
mode,
|
|
212
216
|
setColorScheme,
|
|
213
217
|
setMode: process.env.NODE_ENV === 'production' ? setMode : newMode => {
|
|
214
|
-
if (
|
|
218
|
+
if (memoTheme.colorSchemeSelector === 'media') {
|
|
215
219
|
console.error(['MUI: The `setMode` function has no effect if `colorSchemeSelector` is `media` (`media` is the default value).', 'To toggle the mode manually, please configure `colorSchemeSelector` to use a class or data attribute.', 'To learn more, visit https://mui.com/material-ui/customization/css-theme-variables/configuration/#toggling-dark-mode-manually'].join('\n'));
|
|
216
220
|
}
|
|
217
221
|
setMode(newMode);
|
|
218
222
|
},
|
|
219
223
|
systemMode
|
|
220
|
-
}), [allColorSchemes, colorScheme, darkColorScheme, lightColorScheme, mode, setColorScheme, setMode, systemMode,
|
|
224
|
+
}), [allColorSchemes, colorScheme, darkColorScheme, lightColorScheme, mode, setColorScheme, setMode, systemMode, memoTheme.colorSchemeSelector]);
|
|
221
225
|
let shouldGenerateStyleSheet = true;
|
|
222
226
|
if (disableStyleSheetGeneration || restThemeProp.cssVariables === false || nested && upperTheme?.cssVarPrefix === cssVarPrefix) {
|
|
223
227
|
shouldGenerateStyleSheet = false;
|
|
@@ -225,10 +229,10 @@ export default function createCssVarsProvider(options) {
|
|
|
225
229
|
const element = /*#__PURE__*/_jsxs(React.Fragment, {
|
|
226
230
|
children: [/*#__PURE__*/_jsx(ThemeProvider, {
|
|
227
231
|
themeId: scopedTheme ? themeId : undefined,
|
|
228
|
-
theme:
|
|
232
|
+
theme: memoTheme,
|
|
229
233
|
children: children
|
|
230
234
|
}), shouldGenerateStyleSheet && /*#__PURE__*/_jsx(GlobalStyles, {
|
|
231
|
-
styles:
|
|
235
|
+
styles: memoTheme.generateStyleSheets?.() || []
|
|
232
236
|
})]
|
|
233
237
|
});
|
|
234
238
|
if (nested) {
|
package/modern/index.js
CHANGED
package/modern/version/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export const version = "6.
|
|
1
|
+
export const version = "6.2.0";
|
|
2
2
|
export const major = Number("6");
|
|
3
|
-
export const minor = Number("
|
|
4
|
-
export const patch = Number("
|
|
3
|
+
export const minor = Number("2");
|
|
4
|
+
export const patch = Number("0");
|
|
5
5
|
export const prerelease = undefined;
|
|
6
6
|
export default version;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/system",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.2.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"description": "MUI System is a set of CSS utilities to help you build custom designs more efficiently. It makes it possible to rapidly lay out custom designs.",
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
"clsx": "^2.1.1",
|
|
31
31
|
"csstype": "^3.1.3",
|
|
32
32
|
"prop-types": "^15.8.1",
|
|
33
|
-
"@mui/private-theming": "^6.
|
|
33
|
+
"@mui/private-theming": "^6.2.0",
|
|
34
34
|
"@mui/types": "^7.2.19",
|
|
35
|
-
"@mui/
|
|
36
|
-
"@mui/
|
|
35
|
+
"@mui/utils": "^6.2.0",
|
|
36
|
+
"@mui/styled-engine": "^6.2.0"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"@emotion/react": "^11.5.0",
|
package/version/index.js
CHANGED
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.version = exports.prerelease = exports.patch = exports.minor = exports.major = exports.default = void 0;
|
|
7
|
-
const version = exports.version = "6.
|
|
7
|
+
const version = exports.version = "6.2.0";
|
|
8
8
|
const major = exports.major = Number("6");
|
|
9
|
-
const minor = exports.minor = Number("
|
|
10
|
-
const patch = exports.patch = Number("
|
|
9
|
+
const minor = exports.minor = Number("2");
|
|
10
|
+
const patch = exports.patch = Number("0");
|
|
11
11
|
const prerelease = exports.prerelease = undefined;
|
|
12
12
|
var _default = exports.default = version;
|