@mui/system 7.0.0-beta.3 → 7.0.0-rc.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.
Files changed (60) hide show
  1. package/CHANGELOG.md +84 -0
  2. package/borders/borders.d.ts +3 -2
  3. package/colorManipulator/colorManipulator.js +3 -3
  4. package/cssContainerQueries/cssContainerQueries.js +2 -2
  5. package/cssGrid/cssGrid.d.ts +15 -2
  6. package/cssVars/createCssVarsProvider.d.ts +6 -0
  7. package/cssVars/createCssVarsProvider.js +14 -4
  8. package/display/display.d.ts +2 -1
  9. package/esm/borders/borders.d.ts +3 -2
  10. package/esm/colorManipulator/colorManipulator.js +3 -3
  11. package/esm/cssContainerQueries/cssContainerQueries.js +2 -2
  12. package/esm/cssGrid/cssGrid.d.ts +15 -2
  13. package/esm/cssVars/createCssVarsProvider.d.ts +6 -0
  14. package/esm/cssVars/createCssVarsProvider.js +14 -4
  15. package/esm/display/display.d.ts +2 -1
  16. package/esm/flexbox/flexbox.d.ts +2 -1
  17. package/esm/index.d.ts +1 -0
  18. package/esm/index.js +3 -3
  19. package/esm/palette/palette.d.ts +2 -1
  20. package/esm/positions/positions.d.ts +2 -1
  21. package/esm/shadows/shadows.d.ts +2 -1
  22. package/esm/sizing/sizing.d.ts +2 -1
  23. package/esm/spacing/spacing.d.ts +2 -1
  24. package/esm/spacing/spacing.js +9 -0
  25. package/esm/style/style.d.ts +4 -4
  26. package/esm/typography/typography.d.ts +2 -1
  27. package/esm/version/index.js +2 -2
  28. package/flexbox/flexbox.d.ts +2 -1
  29. package/index.d.ts +1 -0
  30. package/index.js +3 -3
  31. package/modern/borders/borders.d.ts +3 -2
  32. package/modern/colorManipulator/colorManipulator.js +3 -3
  33. package/modern/cssContainerQueries/cssContainerQueries.js +2 -2
  34. package/modern/cssGrid/cssGrid.d.ts +15 -2
  35. package/modern/cssVars/createCssVarsProvider.d.ts +6 -0
  36. package/modern/cssVars/createCssVarsProvider.js +14 -4
  37. package/modern/display/display.d.ts +2 -1
  38. package/modern/flexbox/flexbox.d.ts +2 -1
  39. package/modern/index.d.ts +1 -0
  40. package/modern/index.js +3 -3
  41. package/modern/palette/palette.d.ts +2 -1
  42. package/modern/positions/positions.d.ts +2 -1
  43. package/modern/shadows/shadows.d.ts +2 -1
  44. package/modern/sizing/sizing.d.ts +2 -1
  45. package/modern/spacing/spacing.d.ts +2 -1
  46. package/modern/spacing/spacing.js +9 -0
  47. package/modern/style/style.d.ts +4 -4
  48. package/modern/typography/typography.d.ts +2 -1
  49. package/modern/version/index.js +2 -2
  50. package/package.json +6 -6
  51. package/palette/palette.d.ts +2 -1
  52. package/positions/positions.d.ts +2 -1
  53. package/shadows/shadows.d.ts +2 -1
  54. package/sizing/sizing.d.ts +2 -1
  55. package/spacing/spacing.d.ts +2 -1
  56. package/spacing/spacing.js +9 -0
  57. package/style/style.d.ts +4 -4
  58. package/tsconfig.build.tsbuildinfo +1 -1
  59. package/typography/typography.d.ts +2 -1
  60. package/version/index.js +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,89 @@
1
1
  # [Versions](https://mui.com/versions/)
2
2
 
3
+ ## 7.0.0-rc.0
4
+
5
+ <!-- generated comparing v7.0.0-beta.4..master -->
6
+
7
+ _Mar 18, 2025_
8
+
9
+ A big thanks to the 4 contributors who made this release possible.
10
+
11
+ ### `@mui/material@7.0.0-rc.0`
12
+
13
+ - [StepLabel] Add missing root slot (#45603) @sai6855
14
+ - [Switch] Add slots and slotProps (#45595) @siriwatknp
15
+ - [utils] Add merging function to `mergeSlotProps` utility (#45543) @siriwatknp
16
+
17
+ ### Core
18
+
19
+ - [blog] Clarify the difference between the two Pro plans (#45266) @oliviertassinari
20
+ - [code-infra] Allow specifying a custom error formatter module for error minifcation (#45291) @Janpot
21
+ - [code-infra] Make `getVersionEnvVariables` reusable for other repos (#45562) @Janpot
22
+ - [code-infra] Update peer dependency of `@mui/utils` in `@mui/docs` (#45561) @Janpot
23
+ - Add StackBlitz template to issue template (#45504) @Janpot
24
+
25
+ All contributors of this release in alphabetical order: @Janpot, @oliviertassinari, @sai6855, @siriwatknp
26
+
27
+ ## 7.0.0-beta.4
28
+
29
+ <!-- generated comparing v7.0.0-beta.3..master -->
30
+
31
+ _Mar 13, 2025_
32
+
33
+ A big thanks to the 10 contributors who made this release possible.
34
+ This release contains bug fixes 🐛 and improvements to the new package layout 🏗️.
35
+
36
+ ### `@mui/material@7.0.0-beta.4`
37
+
38
+ - [Accordion] Add missing `root` slot (#45532) @sai6855
39
+ - [AccordionSummary] Add slots and slotProps (#45559) @sai6855
40
+ - [ListItemText] Add missing `root` slot (#45540) @sai6855
41
+ - [SpeedDial] Add missing `root` slot (#45541) @sai6855
42
+ - [Tooltip] Allow auto placement on tooltip (#45399) @Jtaks
43
+ - [useScrollTrigger] Do nothing if target is null (#45441) @vipierozan99
44
+ - [TextareaAutosize] Fix ResizeObserver causing infinite `selectionchange` loop (#45351) @mj12albert
45
+ - Fix negative input for CSS variables spacing array (#45550) @siriwatknp
46
+ - Add missing deprecations in deprecations-all file (#45505) @sai6855
47
+ - Rename some `@mui/material/styles/createTypography` exports (#45558) @Janpot
48
+
49
+ ### `@mui/icons-material@7.0.0-beta.4`
50
+
51
+ - Remove unused icon names from the download script (#45453) @yermartee
52
+
53
+ ### `@mui/system@7.0.0-beta.4`
54
+
55
+ - Prevent nested non-vars theme inheritance (#45545) @siriwatknp
56
+ - Disable theme recalculation as default behavior (#45405) @siriwatknp
57
+ - Fix package layout inconsistencies (#45491) @DiegoAndai
58
+
59
+ ### `@mui/styled-engine@7.0.0-beta.4`
60
+
61
+ - Add `enableCssLayer` prop to StyledEngineProvider (#45428) @siriwatknp
62
+
63
+ ### `@mui/types@7.3.0`
64
+
65
+ - [code-infra] Fix type resolution for @mui/types (#45513) @Janpot
66
+
67
+ ### `@mui/utils@7.0.0-beta.4`
68
+
69
+ - Fix package layout inconsistencies (#45491) @DiegoAndai
70
+ - Use correct iri-reference homepage format (#45472) @dahiro
71
+
72
+ ### Docs
73
+
74
+ - [Backdrop] Fix component name in migration guide (#45506) @sai6855
75
+ - [TextField] Add HTML input section to TextField page (#45439) @siriwatknp
76
+
77
+ ### Core
78
+
79
+ - [code-infra] Convert a few docs modules to ts (#45548) @Janpot
80
+ - [code-infra] Remove more CJS modules from the docs (#45557) @Janpot
81
+ - [code-infra] Remove nested imports from theme augmentation (#45514) @Janpot
82
+ - [docs-infra] Add @ts-ignore to avoid type checking for MUI X (#45555) @siriwatknp
83
+ - [blog] Fix author end-of-year updates (#45533) @oliviertassinari
84
+
85
+ All contributors of this release in alphabetical order: @dahiro, @DiegoAndai, @Janpot, @Jtaks, @mj12albert, @oliviertassinari, @sai6855, @siriwatknp, @vipierozan99, @yermartee
86
+
3
87
  ## 7.0.0-beta.3
4
88
 
5
89
  <!-- generated comparing v7.0.0-beta.2..master -->
@@ -1,4 +1,4 @@
1
- import { PropsFor, SimpleStyleFunction, borders } from "../Box/index.js";
1
+ import { PropsFor, borders, SimpleStyleFunction } from "../Box/index.js";
2
2
  export const border: SimpleStyleFunction<'border'>;
3
3
  export const borderTop: SimpleStyleFunction<'borderTop'>;
4
4
  export const borderRight: SimpleStyleFunction<'borderRight'>;
@@ -10,4 +10,5 @@ export const borderRightColor: SimpleStyleFunction<'borderRightColor'>;
10
10
  export const borderBottomColor: SimpleStyleFunction<'borderBottomColor'>;
11
11
  export const borderLeftColor: SimpleStyleFunction<'borderLeftColor'>;
12
12
  export const borderRadius: SimpleStyleFunction<'borderRadius'>;
13
- export type BordersProps = PropsFor<typeof borders>;
13
+ export type BordersProps = PropsFor<typeof borders>;
14
+ export default borders;
@@ -22,7 +22,7 @@ exports.private_safeEmphasize = private_safeEmphasize;
22
22
  exports.private_safeLighten = private_safeLighten;
23
23
  exports.recomposeColor = recomposeColor;
24
24
  exports.rgbToHex = rgbToHex;
25
- var _formatMuiErrorMessage2 = _interopRequireDefault(require("@mui/utils/formatMuiErrorMessage"));
25
+ var _formatMuiErrorMessage = _interopRequireDefault(require("@mui/utils/formatMuiErrorMessage"));
26
26
  var _clamp = _interopRequireDefault(require("@mui/utils/clamp"));
27
27
  /* eslint-disable @typescript-eslint/naming-convention */
28
28
 
@@ -86,7 +86,7 @@ function decomposeColor(color) {
86
86
  const marker = color.indexOf('(');
87
87
  const type = color.substring(0, marker);
88
88
  if (!['rgb', 'rgba', 'hsl', 'hsla', 'color'].includes(type)) {
89
- throw new Error(process.env.NODE_ENV !== "production" ? `MUI: Unsupported \`${color}\` color.\n` + 'The following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().' : (0, _formatMuiErrorMessage2.default)(9, color));
89
+ throw new Error(process.env.NODE_ENV !== "production" ? `MUI: Unsupported \`${color}\` color.\n` + 'The following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().' : (0, _formatMuiErrorMessage.default)(9, color));
90
90
  }
91
91
  let values = color.substring(marker + 1, color.length - 1);
92
92
  let colorSpace;
@@ -97,7 +97,7 @@ function decomposeColor(color) {
97
97
  values[3] = values[3].slice(1);
98
98
  }
99
99
  if (!['srgb', 'display-p3', 'a98-rgb', 'prophoto-rgb', 'rec-2020'].includes(colorSpace)) {
100
- throw new Error(process.env.NODE_ENV !== "production" ? `MUI: unsupported \`${colorSpace}\` color space.\n` + 'The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020.' : (0, _formatMuiErrorMessage2.default)(10, colorSpace));
100
+ throw new Error(process.env.NODE_ENV !== "production" ? `MUI: unsupported \`${colorSpace}\` color space.\n` + 'The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020.' : (0, _formatMuiErrorMessage.default)(10, colorSpace));
101
101
  }
102
102
  } else {
103
103
  values = values.split(',');
@@ -8,7 +8,7 @@ exports.default = cssContainerQueries;
8
8
  exports.getContainerQuery = getContainerQuery;
9
9
  exports.isCqShorthand = isCqShorthand;
10
10
  exports.sortContainerQueries = sortContainerQueries;
11
- var _formatMuiErrorMessage2 = _interopRequireDefault(require("@mui/utils/formatMuiErrorMessage"));
11
+ var _formatMuiErrorMessage = _interopRequireDefault(require("@mui/utils/formatMuiErrorMessage"));
12
12
  /**
13
13
  * For using in `sx` prop to sort the breakpoint from low to high.
14
14
  * Note: this function does not work and will not support multiple units.
@@ -42,7 +42,7 @@ function getContainerQuery(theme, shorthand) {
42
42
  const matches = shorthand.match(/^@([^/]+)?\/?(.+)?$/);
43
43
  if (!matches) {
44
44
  if (process.env.NODE_ENV !== 'production') {
45
- throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The provided shorthand ${`(${shorthand})`} is invalid. The format should be \`@<breakpoint | number>\` or \`@<breakpoint | number>/<container>\`.\n` + 'For example, `@sm` or `@600` or `@40rem/sidebar`.' : (0, _formatMuiErrorMessage2.default)(18, `(${shorthand})`));
45
+ throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The provided shorthand ${`(${shorthand})`} is invalid. The format should be \`@<breakpoint | number>\` or \`@<breakpoint | number>/<container>\`.\n` + 'For example, `@sm` or `@600` or `@40rem/sidebar`.' : (0, _formatMuiErrorMessage.default)(18, `(${shorthand})`));
46
46
  }
47
47
  return null;
48
48
  }
@@ -1,2 +1,15 @@
1
- import { PropsFor, grid } from "../Box/index.js";
2
- export type CssGridProps = PropsFor<typeof grid>;
1
+ import { PropsFor, grid, SimpleStyleFunction } from "../Box/index.js";
2
+ export const gap: SimpleStyleFunction<'gap'>;
3
+ export const columnGap: SimpleStyleFunction<'columnGap'>;
4
+ export const rowGap: SimpleStyleFunction<'rowGap'>;
5
+ export const gridColumn: SimpleStyleFunction<'gridColumn'>;
6
+ export const gridRow: SimpleStyleFunction<'gridRow'>;
7
+ export const gridAutoFlow: SimpleStyleFunction<'gridAutoFlow'>;
8
+ export const gridAutoColumns: SimpleStyleFunction<'gridAutoColumns'>;
9
+ export const gridAutoRows: SimpleStyleFunction<'gridAutoRows'>;
10
+ export const gridTemplateColumns: SimpleStyleFunction<'gridTemplateColumns'>;
11
+ export const gridTemplateRows: SimpleStyleFunction<'gridTemplateRows'>;
12
+ export const gridTemplateAreas: SimpleStyleFunction<'gridTemplateAreas'>;
13
+ export const gridArea: SimpleStyleFunction<'gridArea'>;
14
+ export type CssGridProps = PropsFor<typeof grid>;
15
+ export default grid;
@@ -35,6 +35,12 @@ export interface CssVarsProviderConfig<ColorScheme extends string> {
35
35
  * @default false
36
36
  */
37
37
  disableTransitionOnChange?: boolean;
38
+ /**
39
+ * If `true`, theme values are recalculated when the mode changes.
40
+ * The `theme.colorSchemes.{mode}.*` nodes will be shallow merged to the top-level of the theme.
41
+ * @default false
42
+ */
43
+ forceThemeRerender?: boolean;
38
44
  }
39
45
  type Identify<I extends string | undefined, T> = I extends string ? T | { [k in I]: T } : T;
40
46
  export interface CreateCssVarsProviderResult<ColorScheme extends string, Identifier extends string | undefined = undefined> {
@@ -65,6 +65,7 @@ function createCssVarsProvider(options) {
65
65
  disableNestedContext = false,
66
66
  disableStyleSheetGeneration = false,
67
67
  defaultMode: initialMode = 'system',
68
+ forceThemeRerender = false,
68
69
  noSsr
69
70
  } = props;
70
71
  const hasMounted = React.useRef(false);
@@ -116,10 +117,15 @@ function createCssVarsProvider(options) {
116
117
  mode = ctx.mode;
117
118
  colorScheme = ctx.colorScheme;
118
119
  }
120
+ if (process.env.NODE_ENV !== 'production') {
121
+ if (forceThemeRerender && !restThemeProp.vars) {
122
+ console.warn(['MUI: The `forceThemeRerender` prop should only be used with CSS theme variables.', 'Note that it will slow down the app when changing between modes, so only do this when you cannot find a better solution.'].join('\n'));
123
+ }
124
+ }
125
+ const calculatedColorScheme = forceThemeRerender && restThemeProp.vars ?
126
+ // `colorScheme` is undefined on the server and hydration phase
127
+ colorScheme || restThemeProp.defaultColorScheme : restThemeProp.defaultColorScheme;
119
128
  const memoTheme = React.useMemo(() => {
120
- // `colorScheme` is undefined on the server and hydration phase
121
- const calculatedColorScheme = colorScheme || restThemeProp.defaultColorScheme;
122
-
123
129
  // 2. get the `vars` object that refers to the CSS custom properties
124
130
  const themeVars = restThemeProp.generateThemeVars?.() || restThemeProp.vars;
125
131
 
@@ -154,7 +160,7 @@ function createCssVarsProvider(options) {
154
160
  }
155
161
  }
156
162
  return resolveTheme ? resolveTheme(theme) : theme;
157
- }, [restThemeProp, colorScheme, components, colorSchemes, cssVarPrefix]);
163
+ }, [restThemeProp, calculatedColorScheme, components, colorSchemes, cssVarPrefix]);
158
164
 
159
165
  // 5. Declaring effects
160
166
  // 5.1 Updates the selector value to use the current color scheme which tells CSS to use the proper stylesheet.
@@ -292,6 +298,10 @@ function createCssVarsProvider(options) {
292
298
  * The document to attach the attribute to.
293
299
  */
294
300
  documentNode: _propTypes.default.any,
301
+ /**
302
+ * If `true`, theme values are recalculated when the mode changes.
303
+ */
304
+ forceThemeRerender: _propTypes.default.bool,
295
305
  /**
296
306
  * The key in the local storage used to store current color scheme.
297
307
  */
@@ -1,2 +1,3 @@
1
1
  import { PropsFor, display } from "../Box/index.js";
2
- export type DisplayProps = PropsFor<typeof display>;
2
+ export type DisplayProps = PropsFor<typeof display>;
3
+ export default display;
@@ -1,4 +1,4 @@
1
- import { PropsFor, SimpleStyleFunction, borders } from "../Box/index.js";
1
+ import { PropsFor, borders, SimpleStyleFunction } from "../Box/index.js";
2
2
  export const border: SimpleStyleFunction<'border'>;
3
3
  export const borderTop: SimpleStyleFunction<'borderTop'>;
4
4
  export const borderRight: SimpleStyleFunction<'borderRight'>;
@@ -10,4 +10,5 @@ export const borderRightColor: SimpleStyleFunction<'borderRightColor'>;
10
10
  export const borderBottomColor: SimpleStyleFunction<'borderBottomColor'>;
11
11
  export const borderLeftColor: SimpleStyleFunction<'borderLeftColor'>;
12
12
  export const borderRadius: SimpleStyleFunction<'borderRadius'>;
13
- export type BordersProps = PropsFor<typeof borders>;
13
+ export type BordersProps = PropsFor<typeof borders>;
14
+ export default borders;
@@ -1,4 +1,4 @@
1
- import _formatMuiErrorMessage from "@mui/utils/formatMuiErrorMessage";
1
+ import _formatErrorMessage from "@mui/utils/formatMuiErrorMessage";
2
2
  /* eslint-disable @typescript-eslint/naming-convention */
3
3
  import clamp from '@mui/utils/clamp';
4
4
 
@@ -62,7 +62,7 @@ export function decomposeColor(color) {
62
62
  const marker = color.indexOf('(');
63
63
  const type = color.substring(0, marker);
64
64
  if (!['rgb', 'rgba', 'hsl', 'hsla', 'color'].includes(type)) {
65
- throw new Error(process.env.NODE_ENV !== "production" ? `MUI: Unsupported \`${color}\` color.\n` + 'The following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().' : _formatMuiErrorMessage(9, color));
65
+ throw new Error(process.env.NODE_ENV !== "production" ? `MUI: Unsupported \`${color}\` color.\n` + 'The following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().' : _formatErrorMessage(9, color));
66
66
  }
67
67
  let values = color.substring(marker + 1, color.length - 1);
68
68
  let colorSpace;
@@ -73,7 +73,7 @@ export function decomposeColor(color) {
73
73
  values[3] = values[3].slice(1);
74
74
  }
75
75
  if (!['srgb', 'display-p3', 'a98-rgb', 'prophoto-rgb', 'rec-2020'].includes(colorSpace)) {
76
- throw new Error(process.env.NODE_ENV !== "production" ? `MUI: unsupported \`${colorSpace}\` color space.\n` + 'The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020.' : _formatMuiErrorMessage(10, colorSpace));
76
+ throw new Error(process.env.NODE_ENV !== "production" ? `MUI: unsupported \`${colorSpace}\` color space.\n` + 'The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020.' : _formatErrorMessage(10, colorSpace));
77
77
  }
78
78
  } else {
79
79
  values = values.split(',');
@@ -1,4 +1,4 @@
1
- import _formatMuiErrorMessage from "@mui/utils/formatMuiErrorMessage";
1
+ import _formatErrorMessage from "@mui/utils/formatMuiErrorMessage";
2
2
  /**
3
3
  * For using in `sx` prop to sort the breakpoint from low to high.
4
4
  * Note: this function does not work and will not support multiple units.
@@ -32,7 +32,7 @@ export function getContainerQuery(theme, shorthand) {
32
32
  const matches = shorthand.match(/^@([^/]+)?\/?(.+)?$/);
33
33
  if (!matches) {
34
34
  if (process.env.NODE_ENV !== 'production') {
35
- throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The provided shorthand ${`(${shorthand})`} is invalid. The format should be \`@<breakpoint | number>\` or \`@<breakpoint | number>/<container>\`.\n` + 'For example, `@sm` or `@600` or `@40rem/sidebar`.' : _formatMuiErrorMessage(18, `(${shorthand})`));
35
+ throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The provided shorthand ${`(${shorthand})`} is invalid. The format should be \`@<breakpoint | number>\` or \`@<breakpoint | number>/<container>\`.\n` + 'For example, `@sm` or `@600` or `@40rem/sidebar`.' : _formatErrorMessage(18, `(${shorthand})`));
36
36
  }
37
37
  return null;
38
38
  }
@@ -1,2 +1,15 @@
1
- import { PropsFor, grid } from "../Box/index.js";
2
- export type CssGridProps = PropsFor<typeof grid>;
1
+ import { PropsFor, grid, SimpleStyleFunction } from "../Box/index.js";
2
+ export const gap: SimpleStyleFunction<'gap'>;
3
+ export const columnGap: SimpleStyleFunction<'columnGap'>;
4
+ export const rowGap: SimpleStyleFunction<'rowGap'>;
5
+ export const gridColumn: SimpleStyleFunction<'gridColumn'>;
6
+ export const gridRow: SimpleStyleFunction<'gridRow'>;
7
+ export const gridAutoFlow: SimpleStyleFunction<'gridAutoFlow'>;
8
+ export const gridAutoColumns: SimpleStyleFunction<'gridAutoColumns'>;
9
+ export const gridAutoRows: SimpleStyleFunction<'gridAutoRows'>;
10
+ export const gridTemplateColumns: SimpleStyleFunction<'gridTemplateColumns'>;
11
+ export const gridTemplateRows: SimpleStyleFunction<'gridTemplateRows'>;
12
+ export const gridTemplateAreas: SimpleStyleFunction<'gridTemplateAreas'>;
13
+ export const gridArea: SimpleStyleFunction<'gridArea'>;
14
+ export type CssGridProps = PropsFor<typeof grid>;
15
+ export default grid;
@@ -35,6 +35,12 @@ export interface CssVarsProviderConfig<ColorScheme extends string> {
35
35
  * @default false
36
36
  */
37
37
  disableTransitionOnChange?: boolean;
38
+ /**
39
+ * If `true`, theme values are recalculated when the mode changes.
40
+ * The `theme.colorSchemes.{mode}.*` nodes will be shallow merged to the top-level of the theme.
41
+ * @default false
42
+ */
43
+ forceThemeRerender?: boolean;
38
44
  }
39
45
  type Identify<I extends string | undefined, T> = I extends string ? T | { [k in I]: T } : T;
40
46
  export interface CreateCssVarsProviderResult<ColorScheme extends string, Identifier extends string | undefined = undefined> {
@@ -57,6 +57,7 @@ export default function createCssVarsProvider(options) {
57
57
  disableNestedContext = false,
58
58
  disableStyleSheetGeneration = false,
59
59
  defaultMode: initialMode = 'system',
60
+ forceThemeRerender = false,
60
61
  noSsr
61
62
  } = props;
62
63
  const hasMounted = React.useRef(false);
@@ -108,10 +109,15 @@ export default function createCssVarsProvider(options) {
108
109
  mode = ctx.mode;
109
110
  colorScheme = ctx.colorScheme;
110
111
  }
112
+ if (process.env.NODE_ENV !== 'production') {
113
+ if (forceThemeRerender && !restThemeProp.vars) {
114
+ console.warn(['MUI: The `forceThemeRerender` prop should only be used with CSS theme variables.', 'Note that it will slow down the app when changing between modes, so only do this when you cannot find a better solution.'].join('\n'));
115
+ }
116
+ }
117
+ const calculatedColorScheme = forceThemeRerender && restThemeProp.vars ?
118
+ // `colorScheme` is undefined on the server and hydration phase
119
+ colorScheme || restThemeProp.defaultColorScheme : restThemeProp.defaultColorScheme;
111
120
  const memoTheme = React.useMemo(() => {
112
- // `colorScheme` is undefined on the server and hydration phase
113
- const calculatedColorScheme = colorScheme || restThemeProp.defaultColorScheme;
114
-
115
121
  // 2. get the `vars` object that refers to the CSS custom properties
116
122
  const themeVars = restThemeProp.generateThemeVars?.() || restThemeProp.vars;
117
123
 
@@ -146,7 +152,7 @@ export default function createCssVarsProvider(options) {
146
152
  }
147
153
  }
148
154
  return resolveTheme ? resolveTheme(theme) : theme;
149
- }, [restThemeProp, colorScheme, components, colorSchemes, cssVarPrefix]);
155
+ }, [restThemeProp, calculatedColorScheme, components, colorSchemes, cssVarPrefix]);
150
156
 
151
157
  // 5. Declaring effects
152
158
  // 5.1 Updates the selector value to use the current color scheme which tells CSS to use the proper stylesheet.
@@ -284,6 +290,10 @@ export default function createCssVarsProvider(options) {
284
290
  * The document to attach the attribute to.
285
291
  */
286
292
  documentNode: PropTypes.any,
293
+ /**
294
+ * If `true`, theme values are recalculated when the mode changes.
295
+ */
296
+ forceThemeRerender: PropTypes.bool,
287
297
  /**
288
298
  * The key in the local storage used to store current color scheme.
289
299
  */
@@ -1,2 +1,3 @@
1
1
  import { PropsFor, display } from "../Box/index.js";
2
- export type DisplayProps = PropsFor<typeof display>;
2
+ export type DisplayProps = PropsFor<typeof display>;
3
+ export default display;
@@ -1,2 +1,3 @@
1
1
  import { PropsFor, flexbox } from "../Box/index.js";
2
- export type FlexboxProps = PropsFor<typeof flexbox>;
2
+ export type FlexboxProps = PropsFor<typeof flexbox>;
3
+ export default flexbox;
package/esm/index.d.ts CHANGED
@@ -27,6 +27,7 @@ export { css, keyframes, StyledEngineProvider, Interpolation, CSSInterpolation,
27
27
  export { default as GlobalStyles } from "./GlobalStyles/index.js";
28
28
  export type { GlobalStylesProps } from "./GlobalStyles/index.js";
29
29
  export * from "./style/index.js";
30
+ export { default as style } from "./style/index.js";
30
31
  export * from "./spacing/index.js";
31
32
  export { default as unstable_styleFunctionSx, unstable_createStyleFunctionSx, extendSxProp as unstable_extendSxProp, unstable_defaultSxConfig } from "./styleFunctionSx/index.js";
32
33
  export * from "./styleFunctionSx/index.js";
package/esm/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  /**
2
- * @mui/system v7.0.0-beta.3
2
+ * @mui/system v7.0.0-rc.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  */
8
- import _formatMuiErrorMessage from "@mui/utils/formatMuiErrorMessage";
8
+ import _formatErrorMessage from "@mui/utils/formatMuiErrorMessage";
9
9
  export { css, keyframes, StyledEngineProvider } from '@mui/styled-engine';
10
10
  export { default as GlobalStyles } from "./GlobalStyles/index.js";
11
11
  export { default as borders } from "./borders/index.js";
@@ -35,7 +35,7 @@ export { default as unstable_styleFunctionSx, unstable_createStyleFunctionSx, ex
35
35
  // TODO: Remove this function in v6
36
36
  // eslint-disable-next-line @typescript-eslint/naming-convention
37
37
  export function experimental_sx() {
38
- throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: The `experimental_sx` has been moved to `theme.unstable_sx`.' + 'For more details, see https://github.com/mui/material-ui/pull/35150.' : _formatMuiErrorMessage(19));
38
+ throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: The `experimental_sx` has been moved to `theme.unstable_sx`.' + 'For more details, see https://github.com/mui/material-ui/pull/35150.' : _formatErrorMessage(19));
39
39
  }
40
40
  export { default as unstable_getThemeValue } from "./getThemeValue/index.js";
41
41
  export { default as Box } from "./Box/index.js";
@@ -1,4 +1,5 @@
1
1
  import { PropsFor, SimpleStyleFunction, palette } from "../Box/index.js";
2
2
  export const color: SimpleStyleFunction<'color'>;
3
3
  export const bgcolor: SimpleStyleFunction<'bgcolor'>;
4
- export type PaletteProps = PropsFor<typeof palette>;
4
+ export type PaletteProps = PropsFor<typeof palette>;
5
+ export default palette;
@@ -1,2 +1,3 @@
1
1
  import { PropsFor, positions } from "../Box/index.js";
2
- export type PositionsProps = PropsFor<typeof positions>;
2
+ export type PositionsProps = PropsFor<typeof positions>;
3
+ export default positions;
@@ -1,2 +1,3 @@
1
1
  import { PropsFor, shadows } from "../Box/index.js";
2
- export type ShadowsProps = PropsFor<typeof shadows>;
2
+ export type ShadowsProps = PropsFor<typeof shadows>;
3
+ export default shadows;
@@ -8,4 +8,5 @@ export const minHeight: SimpleStyleFunction<'minHeight'>;
8
8
  export const sizeWidth: SimpleStyleFunction<'sizeWidth'>;
9
9
  export const sizeHeight: SimpleStyleFunction<'sizeHeight'>;
10
10
  export const boxSizing: SimpleStyleFunction<'boxSizing'>;
11
- export type SizingProps = PropsFor<typeof sizing>;
11
+ export type SizingProps = PropsFor<typeof sizing>;
12
+ export default sizing;
@@ -15,4 +15,5 @@ export const margin: SimpleStyleFunction<'m' | 'mt' | 'mr' | 'mb' | 'ml' | 'mx'
15
15
  export type MarginProps = PropsFor<typeof margin>;
16
16
  export const padding: SimpleStyleFunction<'p' | 'pt' | 'pr' | 'pb' | 'pl' | 'px' | 'py' | 'padding' | 'paddingTop' | 'paddingRight' | 'paddingBottom' | 'paddingLeft' | 'paddingX' | 'paddingY' | 'paddingInline' | 'paddingInlineStart' | 'paddingInlineEnd' | 'paddingBlock' | 'paddingBlockStart' | 'paddingBlockEnd'>;
17
17
  export function getValue(transformer: (prop: SpacingValueType) => SpacingValueType, propValue: SpacingValueType): SpacingValueType;
18
- export type PaddingProps = PropsFor<typeof padding>;
18
+ export type PaddingProps = PropsFor<typeof padding>;
19
+ export default spacing;
@@ -55,6 +55,12 @@ export function createUnaryUnit(theme, themeKey, defaultValue, propName) {
55
55
  }
56
56
  }
57
57
  if (typeof themeSpacing === 'string') {
58
+ if (themeSpacing.startsWith('var(') && val === 0) {
59
+ return 0;
60
+ }
61
+ if (themeSpacing.startsWith('var(') && val === 1) {
62
+ return themeSpacing;
63
+ }
58
64
  return `calc(${val} * ${themeSpacing})`;
59
65
  }
60
66
  return themeSpacing * val;
@@ -80,6 +86,9 @@ export function createUnaryUnit(theme, themeKey, defaultValue, propName) {
80
86
  if (typeof transformed === 'number') {
81
87
  return -transformed;
82
88
  }
89
+ if (typeof transformed === 'string' && transformed.startsWith('var(')) {
90
+ return `calc(-1 * ${transformed})`;
91
+ }
83
92
  return `-${transformed}`;
84
93
  };
85
94
  }
@@ -10,10 +10,10 @@ export interface StyleOptions<PropKey> {
10
10
  themeKey?: string;
11
11
  transform?: TransformFunction;
12
12
  }
13
- export function style<PropKey extends string, Theme extends object>(options: StyleOptions<PropKey>): StyleFunction<{ [K in PropKey]?: unknown } & {
13
+ export function getPath<T>(obj: T, path: string | undefined, checkVars?: boolean): null | unknown;
14
+ export function getStyleValue(themeMapping: object | ((arg: any) => any), transform: TransformFunction | null, propValueFinal: unknown, userValue?: unknown): any;
15
+ export default function style<PropKey extends string, Theme extends object>(options: StyleOptions<PropKey>): StyleFunction<{ [K in PropKey]?: unknown } & {
14
16
  theme?: Theme;
15
17
  }> & {
16
18
  filterProps: string[];
17
- };
18
- export function getPath<T>(obj: T, path: string | undefined, checkVars?: boolean): null | unknown;
19
- export function getStyleValue(themeMapping: object | ((arg: any) => any), transform: TransformFunction | null, propValueFinal: unknown, userValue?: unknown): any;
19
+ };
@@ -8,4 +8,5 @@ export const letterSpacing: SimpleStyleFunction<'letterSpacing'>;
8
8
  export const lineHeight: SimpleStyleFunction<'lineHeight'>;
9
9
  export const textAlign: SimpleStyleFunction<'textAlign'>;
10
10
  export const textTransform: SimpleStyleFunction<'textTransform'>;
11
- export type TypographyProps = PropsFor<typeof typography>;
11
+ export type TypographyProps = PropsFor<typeof typography>;
12
+ export default typography;
@@ -1,6 +1,6 @@
1
- export const version = "7.0.0-beta.3";
1
+ export const version = "7.0.0-rc.0";
2
2
  export const major = Number("7");
3
3
  export const minor = Number("0");
4
4
  export const patch = Number("0");
5
- export const prerelease = "beta.3";
5
+ export const prerelease = "rc.0";
6
6
  export default version;
@@ -1,2 +1,3 @@
1
1
  import { PropsFor, flexbox } from "../Box/index.js";
2
- export type FlexboxProps = PropsFor<typeof flexbox>;
2
+ export type FlexboxProps = PropsFor<typeof flexbox>;
3
+ export default flexbox;
package/index.d.ts CHANGED
@@ -27,6 +27,7 @@ export { css, keyframes, StyledEngineProvider, Interpolation, CSSInterpolation,
27
27
  export { default as GlobalStyles } from "./GlobalStyles/index.js";
28
28
  export type { GlobalStylesProps } from "./GlobalStyles/index.js";
29
29
  export * from "./style/index.js";
30
+ export { default as style } from "./style/index.js";
30
31
  export * from "./spacing/index.js";
31
32
  export { default as unstable_styleFunctionSx, unstable_createStyleFunctionSx, extendSxProp as unstable_extendSxProp, unstable_defaultSxConfig } from "./styleFunctionSx/index.js";
32
33
  export * from "./styleFunctionSx/index.js";
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/system v7.0.0-beta.3
2
+ * @mui/system v7.0.0-rc.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -394,7 +394,7 @@ Object.defineProperty(exports, "useThemeWithoutDefault", {
394
394
  return _useThemeWithoutDefault.default;
395
395
  }
396
396
  });
397
- var _formatMuiErrorMessage2 = _interopRequireDefault(require("@mui/utils/formatMuiErrorMessage"));
397
+ var _formatMuiErrorMessage = _interopRequireDefault(require("@mui/utils/formatMuiErrorMessage"));
398
398
  var _styledEngine = require("@mui/styled-engine");
399
399
  var _GlobalStyles = _interopRequireDefault(require("./GlobalStyles"));
400
400
  var _borders = _interopRequireWildcard(require("./borders"));
@@ -610,7 +610,7 @@ Object.keys(_Stack2).forEach(function (key) {
610
610
  // TODO: Remove this function in v6
611
611
  // eslint-disable-next-line @typescript-eslint/naming-convention
612
612
  function experimental_sx() {
613
- throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: The `experimental_sx` has been moved to `theme.unstable_sx`.' + 'For more details, see https://github.com/mui/material-ui/pull/35150.' : (0, _formatMuiErrorMessage2.default)(19));
613
+ throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: The `experimental_sx` has been moved to `theme.unstable_sx`.' + 'For more details, see https://github.com/mui/material-ui/pull/35150.' : (0, _formatMuiErrorMessage.default)(19));
614
614
  }
615
615
 
616
616
  /** ----------------- */
@@ -1,4 +1,4 @@
1
- import { PropsFor, SimpleStyleFunction, borders } from "../Box/index.js";
1
+ import { PropsFor, borders, SimpleStyleFunction } from "../Box/index.js";
2
2
  export const border: SimpleStyleFunction<'border'>;
3
3
  export const borderTop: SimpleStyleFunction<'borderTop'>;
4
4
  export const borderRight: SimpleStyleFunction<'borderRight'>;
@@ -10,4 +10,5 @@ export const borderRightColor: SimpleStyleFunction<'borderRightColor'>;
10
10
  export const borderBottomColor: SimpleStyleFunction<'borderBottomColor'>;
11
11
  export const borderLeftColor: SimpleStyleFunction<'borderLeftColor'>;
12
12
  export const borderRadius: SimpleStyleFunction<'borderRadius'>;
13
- export type BordersProps = PropsFor<typeof borders>;
13
+ export type BordersProps = PropsFor<typeof borders>;
14
+ export default borders;
@@ -1,4 +1,4 @@
1
- import _formatMuiErrorMessage from "@mui/utils/formatMuiErrorMessage";
1
+ import _formatErrorMessage from "@mui/utils/formatMuiErrorMessage";
2
2
  /* eslint-disable @typescript-eslint/naming-convention */
3
3
  import clamp from '@mui/utils/clamp';
4
4
 
@@ -62,7 +62,7 @@ export function decomposeColor(color) {
62
62
  const marker = color.indexOf('(');
63
63
  const type = color.substring(0, marker);
64
64
  if (!['rgb', 'rgba', 'hsl', 'hsla', 'color'].includes(type)) {
65
- throw new Error(process.env.NODE_ENV !== "production" ? `MUI: Unsupported \`${color}\` color.\n` + 'The following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().' : _formatMuiErrorMessage(9, color));
65
+ throw new Error(process.env.NODE_ENV !== "production" ? `MUI: Unsupported \`${color}\` color.\n` + 'The following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().' : _formatErrorMessage(9, color));
66
66
  }
67
67
  let values = color.substring(marker + 1, color.length - 1);
68
68
  let colorSpace;
@@ -73,7 +73,7 @@ export function decomposeColor(color) {
73
73
  values[3] = values[3].slice(1);
74
74
  }
75
75
  if (!['srgb', 'display-p3', 'a98-rgb', 'prophoto-rgb', 'rec-2020'].includes(colorSpace)) {
76
- throw new Error(process.env.NODE_ENV !== "production" ? `MUI: unsupported \`${colorSpace}\` color space.\n` + 'The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020.' : _formatMuiErrorMessage(10, colorSpace));
76
+ throw new Error(process.env.NODE_ENV !== "production" ? `MUI: unsupported \`${colorSpace}\` color space.\n` + 'The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020.' : _formatErrorMessage(10, colorSpace));
77
77
  }
78
78
  } else {
79
79
  values = values.split(',');
@@ -1,4 +1,4 @@
1
- import _formatMuiErrorMessage from "@mui/utils/formatMuiErrorMessage";
1
+ import _formatErrorMessage from "@mui/utils/formatMuiErrorMessage";
2
2
  /**
3
3
  * For using in `sx` prop to sort the breakpoint from low to high.
4
4
  * Note: this function does not work and will not support multiple units.
@@ -32,7 +32,7 @@ export function getContainerQuery(theme, shorthand) {
32
32
  const matches = shorthand.match(/^@([^/]+)?\/?(.+)?$/);
33
33
  if (!matches) {
34
34
  if (process.env.NODE_ENV !== 'production') {
35
- throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The provided shorthand ${`(${shorthand})`} is invalid. The format should be \`@<breakpoint | number>\` or \`@<breakpoint | number>/<container>\`.\n` + 'For example, `@sm` or `@600` or `@40rem/sidebar`.' : _formatMuiErrorMessage(18, `(${shorthand})`));
35
+ throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The provided shorthand ${`(${shorthand})`} is invalid. The format should be \`@<breakpoint | number>\` or \`@<breakpoint | number>/<container>\`.\n` + 'For example, `@sm` or `@600` or `@40rem/sidebar`.' : _formatErrorMessage(18, `(${shorthand})`));
36
36
  }
37
37
  return null;
38
38
  }
@@ -1,2 +1,15 @@
1
- import { PropsFor, grid } from "../Box/index.js";
2
- export type CssGridProps = PropsFor<typeof grid>;
1
+ import { PropsFor, grid, SimpleStyleFunction } from "../Box/index.js";
2
+ export const gap: SimpleStyleFunction<'gap'>;
3
+ export const columnGap: SimpleStyleFunction<'columnGap'>;
4
+ export const rowGap: SimpleStyleFunction<'rowGap'>;
5
+ export const gridColumn: SimpleStyleFunction<'gridColumn'>;
6
+ export const gridRow: SimpleStyleFunction<'gridRow'>;
7
+ export const gridAutoFlow: SimpleStyleFunction<'gridAutoFlow'>;
8
+ export const gridAutoColumns: SimpleStyleFunction<'gridAutoColumns'>;
9
+ export const gridAutoRows: SimpleStyleFunction<'gridAutoRows'>;
10
+ export const gridTemplateColumns: SimpleStyleFunction<'gridTemplateColumns'>;
11
+ export const gridTemplateRows: SimpleStyleFunction<'gridTemplateRows'>;
12
+ export const gridTemplateAreas: SimpleStyleFunction<'gridTemplateAreas'>;
13
+ export const gridArea: SimpleStyleFunction<'gridArea'>;
14
+ export type CssGridProps = PropsFor<typeof grid>;
15
+ export default grid;