@mui/system 6.0.0-beta.5 → 6.0.0-beta.6
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 +69 -0
- package/Grid/createGrid.js +1 -1
- package/cssVars/prepareCssVars.js +6 -2
- package/index.js +1 -1
- package/modern/Grid/createGrid.js +1 -1
- package/modern/cssVars/prepareCssVars.js +6 -2
- package/modern/index.js +1 -1
- package/modern/useThemeProps/useThemeProps.js +1 -2
- package/modern/version/index.js +2 -2
- package/node/Grid/createGrid.js +5 -7
- package/node/Grid/gridGenerator.js +2 -4
- package/node/RtlProvider/index.js +2 -2
- package/node/ThemeProvider/ThemeProvider.js +1 -1
- package/node/breakpoints/breakpoints.js +1 -2
- package/node/createStyled/createStyled.js +3 -4
- package/node/createTheme/applyStyles.js +1 -2
- package/node/createTheme/createTheme.js +1 -1
- package/node/cssContainerQueries/cssContainerQueries.js +1 -2
- package/node/cssVars/createCssVarsProvider.js +5 -6
- package/node/cssVars/prepareCssVars.js +10 -9
- package/node/cssVars/useCurrentColorScheme.js +2 -2
- package/node/index.js +1 -1
- package/node/sizing/sizing.js +2 -3
- package/node/spacing/spacing.js +1 -2
- package/node/styleFunctionSx/extendSxProp.js +1 -2
- package/node/styleFunctionSx/styleFunctionSx.js +1 -2
- package/node/useThemeProps/useThemeProps.js +1 -2
- package/node/version/index.js +2 -2
- package/package.json +7 -7
- package/useThemeProps/useThemeProps.js +1 -2
- package/version/index.js +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,73 @@
|
|
|
1
1
|
# [Versions](https://mui.com/versions/)
|
|
2
2
|
|
|
3
|
+
## 6.0.0-beta.6
|
|
4
|
+
|
|
5
|
+
<!-- generated comparing v6.0.0-beta.5..next -->
|
|
6
|
+
|
|
7
|
+
_Aug 16, 2024_
|
|
8
|
+
|
|
9
|
+
A big thanks to the 18 contributors who made this release possible.
|
|
10
|
+
|
|
11
|
+
### `@mui/material@6.0.0-beta.6`
|
|
12
|
+
|
|
13
|
+
- [Autocomplete] Improve the `options` prop description (#41591) @pluvio72
|
|
14
|
+
- [Autocomplete] Remove autocomplete warning regarding value not equal to option (#43314) @ZeeshanTamboli
|
|
15
|
+
- [Divider] Add aria-orientation (#43241) @aarongarciah
|
|
16
|
+
- [IconButton] Fix hover background color behavior (#43271) @mnajdova
|
|
17
|
+
- [TypeScript] Refactor types so they're compatible with upcoming React 19 (#43276) @DiegoAndai
|
|
18
|
+
- [Typography] Replace dot notation color value to work with Pigment CSS (#43288) @siriwatknp
|
|
19
|
+
- [pigment-css] Fix `getSelector` prefers-color-scheme to be object (#43237) @siriwatknp
|
|
20
|
+
- Remove `display="block"` usage to work with Pigment CSS (#43307) @siriwatknp
|
|
21
|
+
|
|
22
|
+
### `@mui/codemod@6.0.0-beta.6`
|
|
23
|
+
|
|
24
|
+
- [codemod] Skip sx spread transformation (#43291) @siriwatknp
|
|
25
|
+
|
|
26
|
+
### `@mui/styles@6.0.0-beta.6`
|
|
27
|
+
|
|
28
|
+
- [styles] Fix issues reported by eslint-plugin-react-compiler (#43118) @jlewins
|
|
29
|
+
|
|
30
|
+
### Docs
|
|
31
|
+
|
|
32
|
+
- [material-ui] Audit and copyedit the v6 migration doc (#43073) @samuelsycamore
|
|
33
|
+
- [material-ui] Fix Material Icon search lag and other improvements (#41330) @anle9650
|
|
34
|
+
- [material-ui][Popover] Fix description and title of hover interaction section (#43290) @ZeeshanTamboli
|
|
35
|
+
- [material-ui] Refine and unify custom template themes (#43220) @zanivan
|
|
36
|
+
- [joy-ui] Fix data grid redirection (#43247) @sai6855
|
|
37
|
+
- [mui-system] Add import statement in docs (#43223) @sai6855
|
|
38
|
+
- Update babel config (#43286) @romgrk
|
|
39
|
+
- Fix outdated references to Materal UI version (#43321) @oliviertassinari
|
|
40
|
+
- Polish migration git diff experience @oliviertassinari
|
|
41
|
+
- Update LTS to match format (#43212) @oliviertassinari
|
|
42
|
+
- Fix Pigment CSS migration content (#43217) @siriwatknp
|
|
43
|
+
|
|
44
|
+
### Core
|
|
45
|
+
|
|
46
|
+
- [code-infra] Remove `userEvent` export from `@mui/internal-test-utils` (#43313) @LukasTy
|
|
47
|
+
- [code-infra] Remove unnecessary alias (#43320) @Janpot
|
|
48
|
+
- [code-infra] Fix utils bundle size entrypoint (#43304) @Janpot
|
|
49
|
+
- [core] missing and incorrect scripts (#43209) @Jay-Karia
|
|
50
|
+
- [core] Set Node 14 as minimum version in all browserslist envs (#43326) @aarongarciah
|
|
51
|
+
- [core] Add React 19 as peer dependency (#43216) @aarongarciah
|
|
52
|
+
- [core] Pin `eslint-plugin-jsx-a11y` version to 6.7.1 (#43292) @Janpot
|
|
53
|
+
- [core] Update supported Node.js version to 14 (#43315) @Janpot
|
|
54
|
+
- [core] Use fs instead of fs-extra in script utils (#43234) @DiegoAndai
|
|
55
|
+
- [core] Refactor system theme props (#43120) @romgrk
|
|
56
|
+
- [docs-infra] Fix some TS issues for X docs (#43285) @Janpot
|
|
57
|
+
- [docs-infra] Move API pages to TS (#43199) @alexfauquette
|
|
58
|
+
- [docs-infra] Fix broken sandboxes with relative module imports (#42767) @bharatkashyap
|
|
59
|
+
- [docs-infra] Simplify API sections typing (#43128) @alexfauquette
|
|
60
|
+
- [examples] Fix import (#43316) @aarongarciah
|
|
61
|
+
- [examples] Add material-ui-pigment-css for Next.js and Vite (#43065) @siriwatknp
|
|
62
|
+
- [examples] Replace wrong import with `@mui/material/styles` (#43236) @siriwatknp
|
|
63
|
+
- [useMediaQuery] Adapt test implementation for React 19 (#43269) @aarongarciah
|
|
64
|
+
- [test] Update `matchMedia` mocks (#43240) @cherniavskii
|
|
65
|
+
- [test] Remove unnecessary ref param (#43282) @aarongarciah
|
|
66
|
+
- [website] Update showcase to include Toolpad Core (#43226) @bharatkashyap
|
|
67
|
+
- [website] Replace React.MutableRefObject with React.RefObject (#43284) @aarongarciah
|
|
68
|
+
|
|
69
|
+
All contributors of this release in alphabetical order: @aarongarciah, @alexfauquette, @anle9650, @bharatkashyap, @cherniavskii, @DiegoAndai, @Janpot, @Jay-Karia, @jlewins, @mnajdova, @oliviertassinari, @pluvio72, @renovate[bot], @romgrk, @sai6855, @samuelsycamore, @siriwatknp, @ZeeshanTamboli
|
|
70
|
+
|
|
3
71
|
## 6.0.0-beta.5
|
|
4
72
|
|
|
5
73
|
<!-- generated comparing v6.0.0-beta.4..next -->
|
|
@@ -1842,6 +1910,7 @@ This release was mostly about 🐛 bug fixes and 📚 documentation improvements
|
|
|
1842
1910
|
- [core] Fix TypeScript spelling in changelog @oliviertassinari
|
|
1843
1911
|
- [core] Fix small detail in the autocomplete demo @oliviertassinari
|
|
1844
1912
|
- [core] Increase node memory limit on Netlify build (#41111) @michaldudak
|
|
1913
|
+
- [core] Fix Netlify build cache issue (#43281) @LukasTy
|
|
1845
1914
|
- [core][Tooltip] Remove incorrect code comment (#41179) @ZeeshanTamboli
|
|
1846
1915
|
- [core] Fix missing context display names (#41168) @oliviertassinari
|
|
1847
1916
|
- [core][base-ui] Remove `@mui/base` dev dependency from Base UI workspace (#41216) @ZeeshanTamboli
|
package/Grid/createGrid.js
CHANGED
|
@@ -119,7 +119,7 @@ export default function createGrid(options = {}) {
|
|
|
119
119
|
children: React.Children.map(children, child => {
|
|
120
120
|
if ( /*#__PURE__*/React.isValidElement(child) && isMuiElement(child, ['Grid'])) {
|
|
121
121
|
return /*#__PURE__*/React.cloneElement(child, {
|
|
122
|
-
unstable_level: child.props
|
|
122
|
+
unstable_level: child.props?.unstable_level ?? level + 1
|
|
123
123
|
});
|
|
124
124
|
}
|
|
125
125
|
return child;
|
|
@@ -49,7 +49,7 @@ function prepareCssVars(theme, parserConfig = {}) {
|
|
|
49
49
|
vars
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
|
-
function defaultGetSelector(colorScheme) {
|
|
52
|
+
function defaultGetSelector(colorScheme, cssObject) {
|
|
53
53
|
let rule = selector;
|
|
54
54
|
if (selector === 'class') {
|
|
55
55
|
rule = '.%s';
|
|
@@ -67,7 +67,11 @@ function prepareCssVars(theme, parserConfig = {}) {
|
|
|
67
67
|
return ':root';
|
|
68
68
|
}
|
|
69
69
|
const mode = colorSchemes[colorScheme]?.palette?.mode || colorScheme;
|
|
70
|
-
return
|
|
70
|
+
return {
|
|
71
|
+
[`@media (prefers-color-scheme: ${mode})`]: {
|
|
72
|
+
':root': cssObject
|
|
73
|
+
}
|
|
74
|
+
};
|
|
71
75
|
}
|
|
72
76
|
if (rule) {
|
|
73
77
|
if (theme.defaultColorScheme === colorScheme) {
|
package/index.js
CHANGED
|
@@ -119,7 +119,7 @@ export default function createGrid(options = {}) {
|
|
|
119
119
|
children: React.Children.map(children, child => {
|
|
120
120
|
if ( /*#__PURE__*/React.isValidElement(child) && isMuiElement(child, ['Grid'])) {
|
|
121
121
|
return /*#__PURE__*/React.cloneElement(child, {
|
|
122
|
-
unstable_level: child.props
|
|
122
|
+
unstable_level: child.props?.unstable_level ?? level + 1
|
|
123
123
|
});
|
|
124
124
|
}
|
|
125
125
|
return child;
|
|
@@ -49,7 +49,7 @@ function prepareCssVars(theme, parserConfig = {}) {
|
|
|
49
49
|
vars
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
|
-
function defaultGetSelector(colorScheme) {
|
|
52
|
+
function defaultGetSelector(colorScheme, cssObject) {
|
|
53
53
|
let rule = selector;
|
|
54
54
|
if (selector === 'class') {
|
|
55
55
|
rule = '.%s';
|
|
@@ -67,7 +67,11 @@ function prepareCssVars(theme, parserConfig = {}) {
|
|
|
67
67
|
return ':root';
|
|
68
68
|
}
|
|
69
69
|
const mode = colorSchemes[colorScheme]?.palette?.mode || colorScheme;
|
|
70
|
-
return
|
|
70
|
+
return {
|
|
71
|
+
[`@media (prefers-color-scheme: ${mode})`]: {
|
|
72
|
+
':root': cssObject
|
|
73
|
+
}
|
|
74
|
+
};
|
|
71
75
|
}
|
|
72
76
|
if (rule) {
|
|
73
77
|
if (theme.defaultColorScheme === colorScheme) {
|
package/modern/index.js
CHANGED
package/modern/version/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export const version = "6.0.0-beta.
|
|
1
|
+
export const version = "6.0.0-beta.6";
|
|
2
2
|
export const major = Number("6");
|
|
3
3
|
export const minor = Number("0");
|
|
4
4
|
export const patch = Number("0");
|
|
5
5
|
export const preReleaseLabel = "beta" || null;
|
|
6
|
-
export const preReleaseNumber = Number("
|
|
6
|
+
export const preReleaseNumber = Number("6") || null;
|
|
7
7
|
export default version;
|
package/node/Grid/createGrid.js
CHANGED
|
@@ -80,7 +80,6 @@ function createGrid(options = {}) {
|
|
|
80
80
|
}
|
|
81
81
|
const GridRoot = createStyledComponent(_gridGenerator.generateGridColumnsStyles, _gridGenerator.generateGridColumnSpacingStyles, _gridGenerator.generateGridRowSpacingStyles, _gridGenerator.generateGridSizeStyles, _gridGenerator.generateGridDirectionStyles, _gridGenerator.generateGridStyles, _gridGenerator.generateGridOffsetStyles);
|
|
82
82
|
const Grid = /*#__PURE__*/React.forwardRef(function Grid(inProps, ref) {
|
|
83
|
-
var _inProps$columns, _inProps$spacing, _ref, _inProps$rowSpacing, _ref2, _inProps$columnSpacin;
|
|
84
83
|
const theme = (0, _useTheme.default)();
|
|
85
84
|
const themeProps = useThemeProps(inProps);
|
|
86
85
|
const props = (0, _styleFunctionSx.extendSxProp)(themeProps); // `color` type conflicts with html color attribute.
|
|
@@ -102,10 +101,10 @@ function createGrid(options = {}) {
|
|
|
102
101
|
} = props;
|
|
103
102
|
const size = parseResponsiveProp(sizeProp, theme.breakpoints, val => val !== false);
|
|
104
103
|
const offset = parseResponsiveProp(offsetProp, theme.breakpoints);
|
|
105
|
-
const columns =
|
|
106
|
-
const spacing =
|
|
107
|
-
const rowSpacing =
|
|
108
|
-
const columnSpacing =
|
|
104
|
+
const columns = inProps.columns ?? (level ? undefined : columnsProp);
|
|
105
|
+
const spacing = inProps.spacing ?? (level ? undefined : spacingProp);
|
|
106
|
+
const rowSpacing = inProps.rowSpacing ?? inProps.spacing ?? (level ? undefined : rowSpacingProp);
|
|
107
|
+
const columnSpacing = inProps.columnSpacing ?? inProps.spacing ?? (level ? undefined : columnSpacingProp);
|
|
109
108
|
const ownerState = {
|
|
110
109
|
...props,
|
|
111
110
|
level,
|
|
@@ -128,9 +127,8 @@ function createGrid(options = {}) {
|
|
|
128
127
|
...other,
|
|
129
128
|
children: React.Children.map(children, child => {
|
|
130
129
|
if ( /*#__PURE__*/React.isValidElement(child) && (0, _isMuiElement.default)(child, ['Grid'])) {
|
|
131
|
-
var _unstable_level;
|
|
132
130
|
return /*#__PURE__*/React.cloneElement(child, {
|
|
133
|
-
unstable_level:
|
|
131
|
+
unstable_level: child.props?.unstable_level ?? level + 1
|
|
134
132
|
});
|
|
135
133
|
}
|
|
136
134
|
return child;
|
|
@@ -126,9 +126,8 @@ const generateGridRowSpacingStyles = ({
|
|
|
126
126
|
[`--Grid-rowSpacing${appendLevel(ownerState.unstable_level)}`]: getParentSpacing('row')
|
|
127
127
|
} : {};
|
|
128
128
|
(0, _traverseBreakpoints.traverseBreakpoints)(theme.breakpoints, ownerState.rowSpacing, (appendStyle, value) => {
|
|
129
|
-
var _theme$spacing;
|
|
130
129
|
appendStyle(styles, {
|
|
131
|
-
[`--Grid-rowSpacing${appendLevel(ownerState.unstable_level)}`]: typeof value === 'string' ? value :
|
|
130
|
+
[`--Grid-rowSpacing${appendLevel(ownerState.unstable_level)}`]: typeof value === 'string' ? value : theme.spacing?.(value)
|
|
132
131
|
});
|
|
133
132
|
});
|
|
134
133
|
return styles;
|
|
@@ -148,9 +147,8 @@ const generateGridColumnSpacingStyles = ({
|
|
|
148
147
|
[`--Grid-columnSpacing${appendLevel(ownerState.unstable_level)}`]: getParentSpacing('column')
|
|
149
148
|
} : {};
|
|
150
149
|
(0, _traverseBreakpoints.traverseBreakpoints)(theme.breakpoints, ownerState.columnSpacing, (appendStyle, value) => {
|
|
151
|
-
var _theme$spacing2;
|
|
152
150
|
appendStyle(styles, {
|
|
153
|
-
[`--Grid-columnSpacing${appendLevel(ownerState.unstable_level)}`]: typeof value === 'string' ? value :
|
|
151
|
+
[`--Grid-columnSpacing${appendLevel(ownerState.unstable_level)}`]: typeof value === 'string' ? value : theme.spacing?.(value)
|
|
154
152
|
});
|
|
155
153
|
});
|
|
156
154
|
return styles;
|
|
@@ -16,7 +16,7 @@ function RtlProvider({
|
|
|
16
16
|
...props
|
|
17
17
|
}) {
|
|
18
18
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(RtlContext.Provider, {
|
|
19
|
-
value: value
|
|
19
|
+
value: value ?? true,
|
|
20
20
|
...props
|
|
21
21
|
});
|
|
22
22
|
}
|
|
@@ -26,7 +26,7 @@ process.env.NODE_ENV !== "production" ? RtlProvider.propTypes = {
|
|
|
26
26
|
} : void 0;
|
|
27
27
|
const useRtl = () => {
|
|
28
28
|
const value = React.useContext(RtlContext);
|
|
29
|
-
return value
|
|
29
|
+
return value ?? false;
|
|
30
30
|
};
|
|
31
31
|
exports.useRtl = useRtl;
|
|
32
32
|
var _default = exports.default = RtlProvider;
|
|
@@ -74,7 +74,7 @@ function ThemeProvider(props) {
|
|
|
74
74
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_RtlProvider.default, {
|
|
75
75
|
value: rtlValue,
|
|
76
76
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DefaultPropsProvider.default, {
|
|
77
|
-
value: engineTheme
|
|
77
|
+
value: engineTheme?.components,
|
|
78
78
|
children: children
|
|
79
79
|
})
|
|
80
80
|
})
|
|
@@ -109,8 +109,7 @@ function breakpoints(styleFunction) {
|
|
|
109
109
|
return newStyleFunction;
|
|
110
110
|
}
|
|
111
111
|
function createEmptyBreakpointObject(breakpointsInput = {}) {
|
|
112
|
-
|
|
113
|
-
const breakpointsInOrder = (_breakpointsInput$key = breakpointsInput.keys) == null ? void 0 : _breakpointsInput$key.reduce((acc, key) => {
|
|
112
|
+
const breakpointsInOrder = breakpointsInput.keys?.reduce((acc, key) => {
|
|
114
113
|
const breakpointStyleKey = breakpointsInput.up(key);
|
|
115
114
|
acc[breakpointStyleKey] = {};
|
|
116
115
|
return acc;
|
|
@@ -85,7 +85,7 @@ function processStyleArg(callableStyle, {
|
|
|
85
85
|
isMatch = variant.props(mergedState);
|
|
86
86
|
} else {
|
|
87
87
|
Object.keys(variant.props).forEach(key => {
|
|
88
|
-
if (
|
|
88
|
+
if (ownerState?.[key] !== variant.props[key] && props[key] !== variant.props[key]) {
|
|
89
89
|
isMatch = false;
|
|
90
90
|
}
|
|
91
91
|
});
|
|
@@ -121,7 +121,7 @@ function createStyled(input = {}) {
|
|
|
121
121
|
systemSx.__mui_systemSx = true;
|
|
122
122
|
return (tag, inputOptions = {}) => {
|
|
123
123
|
// Filter out the `sx` style function from the previous styled component to prevent unnecessary styles generated by the composite components.
|
|
124
|
-
(0, _styledEngine.internal_processStyles)(tag, styles => styles.filter(style => !
|
|
124
|
+
(0, _styledEngine.internal_processStyles)(tag, styles => styles.filter(style => !style?.__mui_systemSx));
|
|
125
125
|
const {
|
|
126
126
|
name: componentName,
|
|
127
127
|
slot: componentSlot,
|
|
@@ -208,13 +208,12 @@ function createStyled(input = {}) {
|
|
|
208
208
|
}
|
|
209
209
|
if (componentName && !skipVariantsResolver) {
|
|
210
210
|
expressionsWithDefaultTheme.push(props => {
|
|
211
|
-
var _theme$components;
|
|
212
211
|
const theme = resolveTheme({
|
|
213
212
|
...props,
|
|
214
213
|
defaultTheme,
|
|
215
214
|
themeId
|
|
216
215
|
});
|
|
217
|
-
const themeVariants = theme
|
|
216
|
+
const themeVariants = theme?.components?.[componentName]?.variants;
|
|
218
217
|
return processStyleArg({
|
|
219
218
|
variants: themeVariants
|
|
220
219
|
}, {
|
|
@@ -66,8 +66,7 @@ function applyStyles(key, styles) {
|
|
|
66
66
|
// @ts-expect-error this is 'any' type
|
|
67
67
|
const theme = this;
|
|
68
68
|
if (theme.vars) {
|
|
69
|
-
|
|
70
|
-
if (!((_theme$colorSchemes = theme.colorSchemes) != null && _theme$colorSchemes[key]) || typeof theme.getColorSchemeSelector !== 'function') {
|
|
69
|
+
if (!theme.colorSchemes?.[key] || typeof theme.getColorSchemeSelector !== 'function') {
|
|
71
70
|
return {};
|
|
72
71
|
}
|
|
73
72
|
// If CssVarsProvider is used as a provider, returns '*:where({selector}) &'
|
|
@@ -43,7 +43,7 @@ function createTheme(options = {}, ...args) {
|
|
|
43
43
|
muiTheme = args.reduce((acc, argument) => (0, _deepmerge.default)(acc, argument), muiTheme);
|
|
44
44
|
muiTheme.unstable_sxConfig = {
|
|
45
45
|
..._defaultSxConfig.default,
|
|
46
|
-
...
|
|
46
|
+
...other?.unstable_sxConfig
|
|
47
47
|
};
|
|
48
48
|
muiTheme.unstable_sx = function sx(props) {
|
|
49
49
|
return (0, _styleFunctionSx.default)({
|
|
@@ -20,9 +20,8 @@ function sortContainerQueries(theme, css) {
|
|
|
20
20
|
return css;
|
|
21
21
|
}
|
|
22
22
|
const sorted = Object.keys(css).filter(key => key.startsWith('@container')).sort((a, b) => {
|
|
23
|
-
var _a$match, _b$match;
|
|
24
23
|
const regex = /min-width:\s*([0-9.]+)/;
|
|
25
|
-
return +(
|
|
24
|
+
return +(a.match(regex)?.[1] || 0) - +(b.match(regex)?.[1] || 0);
|
|
26
25
|
});
|
|
27
26
|
if (!sorted.length) {
|
|
28
27
|
return css;
|
|
@@ -49,7 +49,6 @@ function createCssVarsProvider(options) {
|
|
|
49
49
|
}
|
|
50
50
|
const useColorScheme = () => React.useContext(ColorSchemeContext) || defaultContext;
|
|
51
51
|
function CssVarsProvider(props) {
|
|
52
|
-
var _colorSchemes$restThe, _restThemeProp$palett, _restThemeProp$genera, _theme$generateStyleS;
|
|
53
52
|
const {
|
|
54
53
|
children,
|
|
55
54
|
theme: themeProp,
|
|
@@ -83,7 +82,7 @@ function createCssVarsProvider(options) {
|
|
|
83
82
|
const allColorSchemes = React.useMemo(() => joinedColorSchemes.split(','), [joinedColorSchemes]);
|
|
84
83
|
const defaultLightColorScheme = typeof defaultColorScheme === 'string' ? defaultColorScheme : defaultColorScheme.light;
|
|
85
84
|
const defaultDarkColorScheme = typeof defaultColorScheme === 'string' ? defaultColorScheme : defaultColorScheme.dark;
|
|
86
|
-
const defaultMode = colorSchemes[defaultLightColorScheme] && colorSchemes[defaultDarkColorScheme] ? 'system' :
|
|
85
|
+
const defaultMode = colorSchemes[defaultLightColorScheme] && colorSchemes[defaultDarkColorScheme] ? 'system' : colorSchemes[restThemeProp.defaultColorScheme]?.palette?.mode || restThemeProp.palette?.mode;
|
|
87
86
|
|
|
88
87
|
// 1. Get the data about the `mode`, `colorScheme`, and setter functions.
|
|
89
88
|
const {
|
|
@@ -114,7 +113,7 @@ function createCssVarsProvider(options) {
|
|
|
114
113
|
const calculatedColorScheme = colorScheme || restThemeProp.defaultColorScheme;
|
|
115
114
|
|
|
116
115
|
// 2. get the `vars` object that refers to the CSS custom properties
|
|
117
|
-
const themeVars =
|
|
116
|
+
const themeVars = restThemeProp.generateThemeVars?.() || restThemeProp.vars;
|
|
118
117
|
|
|
119
118
|
// 3. Start composing the theme object
|
|
120
119
|
const theme = {
|
|
@@ -160,7 +159,7 @@ function createCssVarsProvider(options) {
|
|
|
160
159
|
if (selector === 'data') {
|
|
161
160
|
rule = `[data-%s]`;
|
|
162
161
|
}
|
|
163
|
-
if (selector
|
|
162
|
+
if (selector?.startsWith('data-') && !selector.includes('%s')) {
|
|
164
163
|
// 'data-mui-color-scheme' -> '[data-mui-color-scheme="%s"]'
|
|
165
164
|
rule = `[${selector}="%s"]`;
|
|
166
165
|
}
|
|
@@ -222,12 +221,12 @@ function createCssVarsProvider(options) {
|
|
|
222
221
|
systemMode
|
|
223
222
|
}), [allColorSchemes, colorScheme, darkColorScheme, lightColorScheme, mode, setColorScheme, setMode, systemMode]);
|
|
224
223
|
let shouldGenerateStyleSheet = true;
|
|
225
|
-
if (disableStyleSheetGeneration || restThemeProp.cssVariables === false || nested &&
|
|
224
|
+
if (disableStyleSheetGeneration || restThemeProp.cssVariables === false || nested && upperTheme?.cssVarPrefix === cssVarPrefix) {
|
|
226
225
|
shouldGenerateStyleSheet = false;
|
|
227
226
|
}
|
|
228
227
|
const element = /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
229
228
|
children: [shouldGenerateStyleSheet && /*#__PURE__*/(0, _jsxRuntime.jsx)(React.Fragment, {
|
|
230
|
-
children: (
|
|
229
|
+
children: (theme.generateStyleSheets?.() || []).map((styles, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_styledEngine.GlobalStyles, {
|
|
231
230
|
styles: styles
|
|
232
231
|
}, index))
|
|
233
232
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ThemeProvider.default, {
|
|
@@ -56,7 +56,7 @@ function prepareCssVars(theme, parserConfig = {}) {
|
|
|
56
56
|
vars
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
|
-
function defaultGetSelector(colorScheme) {
|
|
59
|
+
function defaultGetSelector(colorScheme, cssObject) {
|
|
60
60
|
let rule = selector;
|
|
61
61
|
if (selector === 'class') {
|
|
62
62
|
rule = '.%s';
|
|
@@ -64,18 +64,21 @@ function prepareCssVars(theme, parserConfig = {}) {
|
|
|
64
64
|
if (selector === 'data') {
|
|
65
65
|
rule = '[data-%s]';
|
|
66
66
|
}
|
|
67
|
-
if (selector
|
|
67
|
+
if (selector?.startsWith('data-') && !selector.includes('%s')) {
|
|
68
68
|
// 'data-joy-color-scheme' -> '[data-joy-color-scheme="%s"]'
|
|
69
69
|
rule = `[${selector}="%s"]`;
|
|
70
70
|
}
|
|
71
71
|
if (colorScheme) {
|
|
72
72
|
if (rule === 'media') {
|
|
73
|
-
var _colorSchemes;
|
|
74
73
|
if (theme.defaultColorScheme === colorScheme) {
|
|
75
74
|
return ':root';
|
|
76
75
|
}
|
|
77
|
-
const mode =
|
|
78
|
-
return
|
|
76
|
+
const mode = colorSchemes[colorScheme]?.palette?.mode || colorScheme;
|
|
77
|
+
return {
|
|
78
|
+
[`@media (prefers-color-scheme: ${mode})`]: {
|
|
79
|
+
':root': cssObject
|
|
80
|
+
}
|
|
81
|
+
};
|
|
79
82
|
}
|
|
80
83
|
if (rule) {
|
|
81
84
|
if (theme.defaultColorScheme === colorScheme) {
|
|
@@ -117,12 +120,11 @@ function prepareCssVars(theme, parserConfig = {}) {
|
|
|
117
120
|
...other
|
|
118
121
|
} = colorSchemesMap;
|
|
119
122
|
if (defaultSchemeVal) {
|
|
120
|
-
var _colorSchemes$colorSc;
|
|
121
123
|
// default color scheme has to come before other color schemes
|
|
122
124
|
const {
|
|
123
125
|
css
|
|
124
126
|
} = defaultSchemeVal;
|
|
125
|
-
const cssColorSheme =
|
|
127
|
+
const cssColorSheme = colorSchemes[colorScheme]?.palette?.mode;
|
|
126
128
|
const finalCss = !disableCssColorScheme && cssColorSheme ? {
|
|
127
129
|
colorScheme: cssColorSheme,
|
|
128
130
|
...css
|
|
@@ -136,8 +138,7 @@ function prepareCssVars(theme, parserConfig = {}) {
|
|
|
136
138
|
Object.entries(other).forEach(([key, {
|
|
137
139
|
css
|
|
138
140
|
}]) => {
|
|
139
|
-
|
|
140
|
-
const cssColorSheme = (_colorSchemes$key = colorSchemes[key]) == null || (_colorSchemes$key = _colorSchemes$key.palette) == null ? void 0 : _colorSchemes$key.mode;
|
|
141
|
+
const cssColorSheme = colorSchemes[key]?.palette?.mode;
|
|
141
142
|
const finalCss = !disableCssColorScheme && cssColorSheme ? {
|
|
142
143
|
colorScheme: cssColorSheme,
|
|
143
144
|
...css
|
|
@@ -96,7 +96,7 @@ function useCurrentColorScheme(options) {
|
|
|
96
96
|
// do nothing if mode does not change
|
|
97
97
|
return currentState;
|
|
98
98
|
}
|
|
99
|
-
const newMode = mode
|
|
99
|
+
const newMode = mode ?? defaultMode;
|
|
100
100
|
try {
|
|
101
101
|
localStorage.setItem(modeStorageKey, newMode);
|
|
102
102
|
} catch (e) {
|
|
@@ -186,7 +186,7 @@ function useCurrentColorScheme(options) {
|
|
|
186
186
|
const handleMediaQuery = React.useCallback(event => {
|
|
187
187
|
if (state.mode === 'system') {
|
|
188
188
|
setState(currentState => {
|
|
189
|
-
const systemMode = event
|
|
189
|
+
const systemMode = event?.matches ? 'dark' : 'light';
|
|
190
190
|
|
|
191
191
|
// Early exit, nothing changed.
|
|
192
192
|
if (currentState.systemMode === systemMode) {
|
package/node/index.js
CHANGED
package/node/sizing/sizing.js
CHANGED
|
@@ -20,14 +20,13 @@ const width = exports.width = (0, _style.default)({
|
|
|
20
20
|
const maxWidth = props => {
|
|
21
21
|
if (props.maxWidth !== undefined && props.maxWidth !== null) {
|
|
22
22
|
const styleFromPropValue = propValue => {
|
|
23
|
-
|
|
24
|
-
const breakpoint = ((_props$theme = props.theme) == null || (_props$theme = _props$theme.breakpoints) == null || (_props$theme = _props$theme.values) == null ? void 0 : _props$theme[propValue]) || _breakpoints.values[propValue];
|
|
23
|
+
const breakpoint = props.theme?.breakpoints?.values?.[propValue] || _breakpoints.values[propValue];
|
|
25
24
|
if (!breakpoint) {
|
|
26
25
|
return {
|
|
27
26
|
maxWidth: sizingTransform(propValue)
|
|
28
27
|
};
|
|
29
28
|
}
|
|
30
|
-
if (
|
|
29
|
+
if (props.theme?.breakpoints?.unit !== 'px') {
|
|
31
30
|
return {
|
|
32
31
|
maxWidth: `${breakpoint}${props.theme.breakpoints.unit}`
|
|
33
32
|
};
|
package/node/spacing/spacing.js
CHANGED
|
@@ -58,8 +58,7 @@ const marginKeys = exports.marginKeys = ['m', 'mt', 'mr', 'mb', 'ml', 'mx', 'my'
|
|
|
58
58
|
const paddingKeys = exports.paddingKeys = ['p', 'pt', 'pr', 'pb', 'pl', 'px', 'py', 'padding', 'paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft', 'paddingX', 'paddingY', 'paddingInline', 'paddingInlineStart', 'paddingInlineEnd', 'paddingBlock', 'paddingBlockStart', 'paddingBlockEnd'];
|
|
59
59
|
const spacingKeys = [...marginKeys, ...paddingKeys];
|
|
60
60
|
function createUnaryUnit(theme, themeKey, defaultValue, propName) {
|
|
61
|
-
|
|
62
|
-
const themeSpacing = (_getPath = (0, _style.getPath)(theme, themeKey, true)) != null ? _getPath : defaultValue;
|
|
61
|
+
const themeSpacing = (0, _style.getPath)(theme, themeKey, true) ?? defaultValue;
|
|
63
62
|
if (typeof themeSpacing === 'number' || typeof themeSpacing === 'string') {
|
|
64
63
|
return val => {
|
|
65
64
|
if (typeof val === 'string') {
|
|
@@ -8,12 +8,11 @@ exports.default = extendSxProp;
|
|
|
8
8
|
var _deepmerge = require("@mui/utils/deepmerge");
|
|
9
9
|
var _defaultSxConfig = _interopRequireDefault(require("./defaultSxConfig"));
|
|
10
10
|
const splitProps = props => {
|
|
11
|
-
var _props$theme$unstable, _props$theme;
|
|
12
11
|
const result = {
|
|
13
12
|
systemProps: {},
|
|
14
13
|
otherProps: {}
|
|
15
14
|
};
|
|
16
|
-
const config =
|
|
15
|
+
const config = props?.theme?.unstable_sxConfig ?? _defaultSxConfig.default;
|
|
17
16
|
Object.keys(props).forEach(prop => {
|
|
18
17
|
if (config[prop]) {
|
|
19
18
|
result.systemProps[prop] = props[prop];
|
|
@@ -70,7 +70,6 @@ function unstable_createStyleFunctionSx() {
|
|
|
70
70
|
return (0, _breakpoints.handleBreakpoints)(props, val, styleFromPropValue);
|
|
71
71
|
}
|
|
72
72
|
function styleFunctionSx(props) {
|
|
73
|
-
var _theme$unstable_sxCon;
|
|
74
73
|
const {
|
|
75
74
|
sx,
|
|
76
75
|
theme = {}
|
|
@@ -78,7 +77,7 @@ function unstable_createStyleFunctionSx() {
|
|
|
78
77
|
if (!sx) {
|
|
79
78
|
return null; // Emotion & styled-components will neglect null
|
|
80
79
|
}
|
|
81
|
-
const config =
|
|
80
|
+
const config = theme.unstable_sxConfig ?? _defaultSxConfig.default;
|
|
82
81
|
|
|
83
82
|
/*
|
|
84
83
|
* Receive `sxInput` as object or callback
|
package/node/version/index.js
CHANGED
|
@@ -4,10 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.version = exports.preReleaseNumber = exports.preReleaseLabel = exports.patch = exports.minor = exports.major = exports.default = void 0;
|
|
7
|
-
const version = exports.version = "6.0.0-beta.
|
|
7
|
+
const version = exports.version = "6.0.0-beta.6";
|
|
8
8
|
const major = exports.major = Number("6");
|
|
9
9
|
const minor = exports.minor = Number("0");
|
|
10
10
|
const patch = exports.patch = Number("0");
|
|
11
11
|
const preReleaseLabel = exports.preReleaseLabel = "beta" || null;
|
|
12
|
-
const preReleaseNumber = exports.preReleaseNumber = Number("
|
|
12
|
+
const preReleaseNumber = exports.preReleaseNumber = Number("6") || null;
|
|
13
13
|
var _default = exports.default = version;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/system",
|
|
3
|
-
"version": "6.0.0-beta.
|
|
3
|
+
"version": "6.0.0-beta.6",
|
|
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,16 +30,16 @@
|
|
|
30
30
|
"clsx": "^2.1.1",
|
|
31
31
|
"csstype": "^3.1.3",
|
|
32
32
|
"prop-types": "^15.8.1",
|
|
33
|
-
"@mui/private-theming": "6.0.0-beta.
|
|
34
|
-
"@mui/
|
|
35
|
-
"@mui/styled-engine": "6.0.0-beta.
|
|
36
|
-
"@mui/
|
|
33
|
+
"@mui/private-theming": "6.0.0-beta.6",
|
|
34
|
+
"@mui/types": "^7.2.15",
|
|
35
|
+
"@mui/styled-engine": "6.0.0-beta.6",
|
|
36
|
+
"@mui/utils": "6.0.0-beta.6"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"@emotion/react": "^11.5.0",
|
|
40
40
|
"@emotion/styled": "^11.3.0",
|
|
41
|
-
"@types/react": "^17.0.0 || ^18.0.0",
|
|
42
|
-
"react": "^17.0.0 || ^18.0.0"
|
|
41
|
+
"@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
42
|
+
"react": "^17.0.0 || ^18.0.0 || ^19.0.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependenciesMeta": {
|
|
45
45
|
"@types/react": {
|
package/version/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export const version = "6.0.0-beta.
|
|
1
|
+
export const version = "6.0.0-beta.6";
|
|
2
2
|
export const major = Number("6");
|
|
3
3
|
export const minor = Number("0");
|
|
4
4
|
export const patch = Number("0");
|
|
5
5
|
export const preReleaseLabel = "beta" || null;
|
|
6
|
-
export const preReleaseNumber = Number("
|
|
6
|
+
export const preReleaseNumber = Number("6") || null;
|
|
7
7
|
export default version;
|