@mui/material 6.1.2 → 6.1.4

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 (70) hide show
  1. package/Badge/Badge.d.ts +2 -2
  2. package/Badge/Badge.js +12 -8
  3. package/CHANGELOG.md +357 -310
  4. package/Checkbox/Checkbox.js +1 -0
  5. package/Grid2/Grid2.d.ts +16 -11
  6. package/Grid2/Grid2.js +29 -11
  7. package/IconButton/IconButton.js +5 -16
  8. package/InputBase/InputBase.js +1 -1
  9. package/Modal/useModal.js +6 -0
  10. package/OutlinedInput/OutlinedInput.js +6 -6
  11. package/PigmentGrid/PigmentGrid.d.ts +0 -23
  12. package/PigmentGrid/PigmentGrid.js +0 -23
  13. package/PigmentHidden/PigmentHidden.js +1 -0
  14. package/Select/SelectInput.js +1 -1
  15. package/Slider/Slider.js +52 -33
  16. package/index.js +1 -1
  17. package/modern/Badge/Badge.js +12 -8
  18. package/modern/Checkbox/Checkbox.js +1 -0
  19. package/modern/Grid2/Grid2.js +29 -11
  20. package/modern/IconButton/IconButton.js +5 -16
  21. package/modern/InputBase/InputBase.js +1 -1
  22. package/modern/Modal/useModal.js +6 -0
  23. package/modern/OutlinedInput/OutlinedInput.js +6 -6
  24. package/modern/PigmentGrid/PigmentGrid.js +0 -23
  25. package/modern/PigmentHidden/PigmentHidden.js +1 -0
  26. package/modern/Select/SelectInput.js +1 -1
  27. package/modern/Slider/Slider.js +52 -33
  28. package/modern/index.js +1 -1
  29. package/modern/styles/createPalette.js +80 -86
  30. package/modern/styles/createThemeNoVars.js +1 -2
  31. package/modern/styles/index.js +1 -1
  32. package/modern/styles/makeStyles.js +1 -3
  33. package/modern/styles/responsiveFontSizes.js +1 -2
  34. package/modern/styles/withStyles.js +1 -3
  35. package/modern/styles/withTheme.js +1 -3
  36. package/modern/utils/memoTheme.js +3 -24
  37. package/modern/version/index.js +2 -2
  38. package/node/Badge/Badge.js +12 -8
  39. package/node/Checkbox/Checkbox.js +1 -0
  40. package/node/Grid2/Grid2.js +29 -11
  41. package/node/IconButton/IconButton.js +5 -16
  42. package/node/InputBase/InputBase.js +1 -1
  43. package/node/Modal/useModal.js +6 -0
  44. package/node/OutlinedInput/OutlinedInput.js +6 -6
  45. package/node/PigmentGrid/PigmentGrid.js +0 -23
  46. package/node/PigmentHidden/PigmentHidden.js +1 -0
  47. package/node/Select/SelectInput.js +1 -1
  48. package/node/Slider/Slider.js +50 -32
  49. package/node/index.js +1 -1
  50. package/node/styles/createPalette.js +80 -86
  51. package/node/styles/createThemeNoVars.js +1 -2
  52. package/node/styles/index.js +1 -1
  53. package/node/styles/makeStyles.js +1 -3
  54. package/node/styles/responsiveFontSizes.js +1 -2
  55. package/node/styles/withStyles.js +1 -3
  56. package/node/styles/withTheme.js +1 -3
  57. package/node/utils/memoTheme.js +4 -25
  58. package/node/version/index.js +2 -2
  59. package/package.json +7 -7
  60. package/styles/ThemeProviderWithVars.d.ts +1 -1
  61. package/styles/createPalette.js +80 -86
  62. package/styles/createThemeNoVars.js +1 -2
  63. package/styles/index.js +1 -1
  64. package/styles/makeStyles.js +1 -3
  65. package/styles/responsiveFontSizes.js +1 -2
  66. package/styles/withStyles.js +1 -3
  67. package/styles/withTheme.js +1 -3
  68. package/utils/memoTheme.d.ts +4 -10
  69. package/utils/memoTheme.js +3 -24
  70. package/version/index.js +2 -2
@@ -9,70 +9,76 @@ import orange from "../colors/orange.js";
9
9
  import blue from "../colors/blue.js";
10
10
  import lightBlue from "../colors/lightBlue.js";
11
11
  import green from "../colors/green.js";
12
- export const light = {
13
- // The colors used to style the text.
14
- text: {
15
- // The most important text.
16
- primary: 'rgba(0, 0, 0, 0.87)',
17
- // Secondary text.
18
- secondary: 'rgba(0, 0, 0, 0.6)',
19
- // Disabled text have even lower visual prominence.
20
- disabled: 'rgba(0, 0, 0, 0.38)'
21
- },
22
- // The color used to divide different elements.
23
- divider: 'rgba(0, 0, 0, 0.12)',
24
- // The background colors used to style the surfaces.
25
- // Consistency between these values is important.
26
- background: {
27
- paper: common.white,
28
- default: common.white
29
- },
30
- // The colors used to style the action elements.
31
- action: {
32
- // The color of an active action like an icon button.
33
- active: 'rgba(0, 0, 0, 0.54)',
34
- // The color of an hovered action.
35
- hover: 'rgba(0, 0, 0, 0.04)',
36
- hoverOpacity: 0.04,
37
- // The color of a selected action.
38
- selected: 'rgba(0, 0, 0, 0.08)',
39
- selectedOpacity: 0.08,
40
- // The color of a disabled action.
41
- disabled: 'rgba(0, 0, 0, 0.26)',
42
- // The background color of a disabled action.
43
- disabledBackground: 'rgba(0, 0, 0, 0.12)',
44
- disabledOpacity: 0.38,
45
- focus: 'rgba(0, 0, 0, 0.12)',
46
- focusOpacity: 0.12,
47
- activatedOpacity: 0.12
48
- }
49
- };
50
- export const dark = {
51
- text: {
52
- primary: common.white,
53
- secondary: 'rgba(255, 255, 255, 0.7)',
54
- disabled: 'rgba(255, 255, 255, 0.5)',
55
- icon: 'rgba(255, 255, 255, 0.5)'
56
- },
57
- divider: 'rgba(255, 255, 255, 0.12)',
58
- background: {
59
- paper: '#121212',
60
- default: '#121212'
61
- },
62
- action: {
63
- active: common.white,
64
- hover: 'rgba(255, 255, 255, 0.08)',
65
- hoverOpacity: 0.08,
66
- selected: 'rgba(255, 255, 255, 0.16)',
67
- selectedOpacity: 0.16,
68
- disabled: 'rgba(255, 255, 255, 0.3)',
69
- disabledBackground: 'rgba(255, 255, 255, 0.12)',
70
- disabledOpacity: 0.38,
71
- focus: 'rgba(255, 255, 255, 0.12)',
72
- focusOpacity: 0.12,
73
- activatedOpacity: 0.24
74
- }
75
- };
12
+ function getLight() {
13
+ return {
14
+ // The colors used to style the text.
15
+ text: {
16
+ // The most important text.
17
+ primary: 'rgba(0, 0, 0, 0.87)',
18
+ // Secondary text.
19
+ secondary: 'rgba(0, 0, 0, 0.6)',
20
+ // Disabled text have even lower visual prominence.
21
+ disabled: 'rgba(0, 0, 0, 0.38)'
22
+ },
23
+ // The color used to divide different elements.
24
+ divider: 'rgba(0, 0, 0, 0.12)',
25
+ // The background colors used to style the surfaces.
26
+ // Consistency between these values is important.
27
+ background: {
28
+ paper: common.white,
29
+ default: common.white
30
+ },
31
+ // The colors used to style the action elements.
32
+ action: {
33
+ // The color of an active action like an icon button.
34
+ active: 'rgba(0, 0, 0, 0.54)',
35
+ // The color of an hovered action.
36
+ hover: 'rgba(0, 0, 0, 0.04)',
37
+ hoverOpacity: 0.04,
38
+ // The color of a selected action.
39
+ selected: 'rgba(0, 0, 0, 0.08)',
40
+ selectedOpacity: 0.08,
41
+ // The color of a disabled action.
42
+ disabled: 'rgba(0, 0, 0, 0.26)',
43
+ // The background color of a disabled action.
44
+ disabledBackground: 'rgba(0, 0, 0, 0.12)',
45
+ disabledOpacity: 0.38,
46
+ focus: 'rgba(0, 0, 0, 0.12)',
47
+ focusOpacity: 0.12,
48
+ activatedOpacity: 0.12
49
+ }
50
+ };
51
+ }
52
+ export const light = getLight();
53
+ function getDark() {
54
+ return {
55
+ text: {
56
+ primary: common.white,
57
+ secondary: 'rgba(255, 255, 255, 0.7)',
58
+ disabled: 'rgba(255, 255, 255, 0.5)',
59
+ icon: 'rgba(255, 255, 255, 0.5)'
60
+ },
61
+ divider: 'rgba(255, 255, 255, 0.12)',
62
+ background: {
63
+ paper: '#121212',
64
+ default: '#121212'
65
+ },
66
+ action: {
67
+ active: common.white,
68
+ hover: 'rgba(255, 255, 255, 0.08)',
69
+ hoverOpacity: 0.08,
70
+ selected: 'rgba(255, 255, 255, 0.16)',
71
+ selectedOpacity: 0.16,
72
+ disabled: 'rgba(255, 255, 255, 0.3)',
73
+ disabledBackground: 'rgba(255, 255, 255, 0.12)',
74
+ disabledOpacity: 0.38,
75
+ focus: 'rgba(255, 255, 255, 0.12)',
76
+ focusOpacity: 0.12,
77
+ activatedOpacity: 0.24
78
+ }
79
+ };
80
+ }
81
+ export const dark = getDark();
76
82
  function addLightOrDark(intent, direction, shade, tonalOffset) {
77
83
  const tonalOffsetLight = tonalOffset.light || tonalOffset;
78
84
  const tonalOffsetDark = tonalOffset.dark || tonalOffset * 1.5;
@@ -212,24 +218,10 @@ export default function createPalette(palette) {
212
218
  color.main = color[mainShade];
213
219
  }
214
220
  if (!color.hasOwnProperty('main')) {
215
- throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The color${name ? ` (${name})` : ''} provided to augmentColor(color) is invalid.
216
- The color object needs to have a \`main\` property or a \`${mainShade}\` property.` : _formatMuiErrorMessage(11, name ? ` (${name})` : '', mainShade));
221
+ throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The color${name ? ` (${name})` : ''} provided to augmentColor(color) is invalid.\n` + `The color object needs to have a \`main\` property or a \`${mainShade}\` property.` : _formatMuiErrorMessage(11, name ? ` (${name})` : '', mainShade));
217
222
  }
218
223
  if (typeof color.main !== 'string') {
219
- throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The color${name ? ` (${name})` : ''} provided to augmentColor(color) is invalid.
220
- \`color.main\` should be a string, but \`${JSON.stringify(color.main)}\` was provided instead.
221
-
222
- Did you intend to use one of the following approaches?
223
-
224
- import { green } from "@mui/material/colors";
225
-
226
- const theme1 = createTheme({ palette: {
227
- primary: green,
228
- } });
229
-
230
- const theme2 = createTheme({ palette: {
231
- primary: { main: green[500] },
232
- } });` : _formatMuiErrorMessage(12, name ? ` (${name})` : '', JSON.stringify(color.main)));
224
+ throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The color${name ? ` (${name})` : ''} provided to augmentColor(color) is invalid.\n` + `\`color.main\` should be a string, but \`${JSON.stringify(color.main)}\` was provided instead.\n` + '\n' + 'Did you intend to use one of the following approaches?\n' + '\n' + 'import { green } from "@mui/material/colors";\n' + '\n' + 'const theme1 = createTheme({ palette: {\n' + ' primary: green,\n' + '} });\n' + '\n' + 'const theme2 = createTheme({ palette: {\n' + ' primary: { main: green[500] },\n' + '} });' : _formatMuiErrorMessage(12, name ? ` (${name})` : '', JSON.stringify(color.main)));
233
225
  }
234
226
  addLightOrDark(color, 'light', lightShade, tonalOffset);
235
227
  addLightOrDark(color, 'dark', darkShade, tonalOffset);
@@ -238,12 +230,14 @@ const theme2 = createTheme({ palette: {
238
230
  }
239
231
  return color;
240
232
  };
241
- const modes = {
242
- dark,
243
- light
244
- };
233
+ let modeHydrated;
234
+ if (mode === 'light') {
235
+ modeHydrated = getLight();
236
+ } else if (mode === 'dark') {
237
+ modeHydrated = getDark();
238
+ }
245
239
  if (process.env.NODE_ENV !== 'production') {
246
- if (!modes[mode]) {
240
+ if (!modeHydrated) {
247
241
  console.error(`MUI: The palette mode \`${mode}\` is not supported.`);
248
242
  }
249
243
  }
@@ -302,7 +296,7 @@ const theme2 = createTheme({ palette: {
302
296
  // E.g., shift from Red 500 to Red 300 or Red 700.
303
297
  tonalOffset,
304
298
  // The light and dark mode object.
305
- ...modes[mode]
299
+ ...modeHydrated
306
300
  }, other);
307
301
  return paletteOutput;
308
302
  }
@@ -21,8 +21,7 @@ function createThemeNoVars(options = {}, ...args) {
21
21
  ...other
22
22
  } = options;
23
23
  if (options.vars) {
24
- throw new Error(process.env.NODE_ENV !== "production" ? `MUI: \`vars\` is a private field used for CSS variables support.
25
- Please use another name.` : _formatMuiErrorMessage(20));
24
+ throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: `vars` is a private field used for CSS variables support.\n' + 'Please use another name.' : _formatMuiErrorMessage(20));
26
25
  }
27
26
  const palette = createPalette(paletteInput);
28
27
  const systemTheme = systemCreateTheme(options);
package/styles/index.js CHANGED
@@ -6,7 +6,7 @@ export { unstable_createBreakpoints } from '@mui/system/createBreakpoints';
6
6
  // TODO: Remove this function in v6.
7
7
  // eslint-disable-next-line @typescript-eslint/naming-convention
8
8
  export function experimental_sx() {
9
- 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));
9
+ 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));
10
10
  }
11
11
  export { default as createTheme, createMuiTheme } from "./createTheme.js";
12
12
  export { default as unstable_createMuiStrictModeTheme } from "./createMuiStrictModeTheme.js";
@@ -1,6 +1,4 @@
1
1
  import _formatMuiErrorMessage from "@mui/utils/formatMuiErrorMessage";
2
2
  export default function makeStyles() {
3
- throw new Error(process.env.NODE_ENV !== "production" ? `MUI: makeStyles is no longer exported from @mui/material/styles.
4
- You have to import it from @mui/styles.
5
- See https://mui.com/r/migration-v4/#mui-material-styles for more details.` : _formatMuiErrorMessage(14));
3
+ throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: makeStyles is no longer exported from @mui/material/styles.\n' + 'You have to import it from @mui/styles.\n' + 'See https://mui.com/r/migration-v4/#mui-material-styles for more details.' : _formatMuiErrorMessage(14));
6
4
  }
@@ -34,8 +34,7 @@ export default function responsiveFontSizes(themeInput, options = {}) {
34
34
  lineHeight
35
35
  } = style;
36
36
  if (!isUnitless(lineHeight) && !disableAlign) {
37
- throw new Error(process.env.NODE_ENV !== "production" ? `MUI: Unsupported non-unitless line height with grid alignment.
38
- Use unitless line heights instead.` : _formatMuiErrorMessage(6));
37
+ throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: Unsupported non-unitless line height with grid alignment.\n' + 'Use unitless line heights instead.' : _formatMuiErrorMessage(6));
39
38
  }
40
39
  if (!isUnitless(lineHeight)) {
41
40
  // make it unitless
@@ -1,6 +1,4 @@
1
1
  import _formatMuiErrorMessage from "@mui/utils/formatMuiErrorMessage";
2
2
  export default function withStyles() {
3
- throw new Error(process.env.NODE_ENV !== "production" ? `MUI: withStyles is no longer exported from @mui/material/styles.
4
- You have to import it from @mui/styles.
5
- See https://mui.com/r/migration-v4/#mui-material-styles for more details.` : _formatMuiErrorMessage(15));
3
+ throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: withStyles is no longer exported from @mui/material/styles.\n' + 'You have to import it from @mui/styles.\n' + 'See https://mui.com/r/migration-v4/#mui-material-styles for more details.' : _formatMuiErrorMessage(15));
6
4
  }
@@ -1,6 +1,4 @@
1
1
  import _formatMuiErrorMessage from "@mui/utils/formatMuiErrorMessage";
2
2
  export default function withTheme() {
3
- throw new Error(process.env.NODE_ENV !== "production" ? `MUI: withTheme is no longer exported from @mui/material/styles.
4
- You have to import it from @mui/styles.
5
- See https://mui.com/r/migration-v4/#mui-material-styles for more details.` : _formatMuiErrorMessage(16));
3
+ throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: withTheme is no longer exported from @mui/material/styles.\n' + 'You have to import it from @mui/styles.\n' + 'See https://mui.com/r/migration-v4/#mui-material-styles for more details.' : _formatMuiErrorMessage(16));
6
4
  }
@@ -1,13 +1,7 @@
1
- import { CSSInterpolation } from '@mui/system';
2
1
  import { Theme } from '../styles/createTheme';
3
- type ThemeStyleFunction = (props: {
2
+ declare const memoTheme: (styleFn: (props: {
4
3
  theme: Theme;
5
- }) => CSSInterpolation;
6
- /**
7
- * Memoize style function on theme.
8
- * Intended to be used in styled() calls that only need access to the theme.
9
- */
10
- export default function memoTheme(styleFn: ThemeStyleFunction): (props: {
4
+ }) => import("@mui/styled-engine").CSSInterpolation) => (props: {
11
5
  theme: Theme;
12
- }) => CSSInterpolation;
13
- export {};
6
+ }) => string | number | boolean | import("@mui/styled-engine").ComponentSelector | import("@mui/styled-engine").Keyframes | import("@mui/styled-engine").SerializedStyles | import("@mui/styled-engine").CSSObject | import("@mui/styled-engine").ArrayCSSInterpolation | null;
7
+ export default memoTheme;
@@ -1,24 +1,3 @@
1
- // We need to pass an argument as `{ theme }` for PigmentCSS, but we don't want to
2
- // allocate more objects.
3
- const arg = {
4
- theme: undefined
5
- };
6
-
7
- /**
8
- * Memoize style function on theme.
9
- * Intended to be used in styled() calls that only need access to the theme.
10
- */
11
- export default function memoTheme(styleFn) {
12
- let lastValue;
13
- let lastTheme;
14
- return props => {
15
- let value = lastValue;
16
- if (value === undefined || props.theme !== lastTheme) {
17
- arg.theme = props.theme;
18
- value = styleFn(arg);
19
- lastValue = value;
20
- lastTheme = props.theme;
21
- }
22
- return value;
23
- };
24
- }
1
+ import { unstable_memoTheme } from '@mui/system';
2
+ const memoTheme = unstable_memoTheme;
3
+ export default memoTheme;
package/version/index.js CHANGED
@@ -1,6 +1,6 @@
1
- export const version = "6.1.2";
1
+ export const version = "6.1.4";
2
2
  export const major = Number("6");
3
3
  export const minor = Number("1");
4
- export const patch = Number("2");
4
+ export const patch = Number("4");
5
5
  export const prerelease = undefined;
6
6
  export default version;