@mui/system 9.0.0-beta.1 → 9.0.1

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.
@@ -150,7 +150,7 @@ function createGrid(options = {}) {
150
150
  wrap: _propTypes.default.oneOf(['nowrap', 'wrap-reverse', 'wrap'])
151
151
  } : void 0;
152
152
 
153
- // @ts-ignore internal logic for nested grid
153
+ // @ts-expect-error internal logic for nested grid
154
154
  Grid.muiName = 'Grid';
155
155
  return Grid;
156
156
  }
@@ -143,7 +143,7 @@ export default function createGrid(options = {}) {
143
143
  wrap: PropTypes.oneOf(['nowrap', 'wrap-reverse', 'wrap'])
144
144
  } : void 0;
145
145
 
146
- // @ts-ignore internal logic for nested grid
146
+ // @ts-expect-error internal logic for nested grid
147
147
  Grid.muiName = 'Grid';
148
148
  return Grid;
149
149
  }
package/README.md CHANGED
@@ -9,11 +9,11 @@ Install the package in your project directory with:
9
9
  <!-- #npm-tag-reference -->
10
10
 
11
11
  ```bash
12
- npm install @mui/system@next @emotion/react @emotion/styled
12
+ npm install @mui/system @emotion/react @emotion/styled
13
13
  ```
14
14
 
15
15
  ## Documentation
16
16
 
17
17
  <!-- #host-reference -->
18
18
 
19
- Visit [https://next.mui.com/system/getting-started/](https://next.mui.com/system/getting-started/) to view the full documentation.
19
+ Visit [https://mui.com/system/getting-started/](https://mui.com/system/getting-started/) to view the full documentation.
@@ -14,6 +14,7 @@ export interface ThemeProviderProps<Theme = DefaultTheme> {
14
14
  theme: Partial<Theme> | ((outerTheme: Theme) => Theme);
15
15
  }
16
16
 
17
+ // #host-reference
17
18
  /**
18
19
  * This component makes the `theme` available down the React tree.
19
20
  * It should preferably be used at **the root of your component tree**.
@@ -14,6 +14,7 @@ export interface ThemeProviderProps<Theme = DefaultTheme> {
14
14
  theme: Partial<Theme> | ((outerTheme: Theme) => Theme);
15
15
  }
16
16
 
17
+ // #host-reference
17
18
  /**
18
19
  * This component makes the `theme` available down the React tree.
19
20
  * It should preferably be used at **the root of your component tree**.
@@ -19,4 +19,4 @@ type DefaultBreakPoints = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
19
19
  /**
20
20
  * @returns An enhanced stylefunction that considers breakpoints
21
21
  */
22
- export default function breakpoints<Props, Breakpoints extends string = DefaultBreakPoints>(styleFunction: StyleFunction<Props>): StyleFunction<Partial<Record<Breakpoints, Props>> & Props>;
22
+ export default function breakpoints<Props, BreakpointsInput extends string = DefaultBreakPoints>(styleFunction: StyleFunction<Props>): StyleFunction<Partial<Record<BreakpointsInput, Props>> & Props>;
@@ -19,4 +19,4 @@ type DefaultBreakPoints = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
19
19
  /**
20
20
  * @returns An enhanced stylefunction that considers breakpoints
21
21
  */
22
- export default function breakpoints<Props, Breakpoints extends string = DefaultBreakPoints>(styleFunction: StyleFunction<Props>): StyleFunction<Partial<Record<Breakpoints, Props>> & Props>;
22
+ export default function breakpoints<Props, BreakpointsInput extends string = DefaultBreakPoints>(styleFunction: StyleFunction<Props>): StyleFunction<Partial<Record<BreakpointsInput, Props>> & Props>;
@@ -26,13 +26,13 @@ export interface Breakpoints {
26
26
  /**
27
27
  * @param key - A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px.
28
28
  * @returns A media query string ready to be used with most styling solutions, which matches screen widths greater than the screen size given by the breakpoint key (inclusive).
29
- * @see [API documentation](https://next.mui.com/material-ui/customization/breakpoints/#theme-breakpoints-up-key-media-query)
29
+ * @see [API documentation](https://mui.com/material-ui/customization/breakpoints/#theme-breakpoints-up-key-media-query)
30
30
  */
31
31
  up: (key: Breakpoint | number) => string;
32
32
  /**
33
33
  * @param key - A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px.
34
34
  * @returns A media query string ready to be used with most styling solutions, which matches screen widths less than the screen size given by the breakpoint key (exclusive).
35
- * @see [API documentation](https://next.mui.com/material-ui/customization/breakpoints/#theme-breakpoints-down-key-media-query)
35
+ * @see [API documentation](https://mui.com/material-ui/customization/breakpoints/#theme-breakpoints-down-key-media-query)
36
36
  */
37
37
  down: (key: Breakpoint | number) => string;
38
38
  /**
@@ -40,14 +40,14 @@ export interface Breakpoints {
40
40
  * @param end - A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px.
41
41
  * @returns A media query string ready to be used with most styling solutions, which matches screen widths greater than
42
42
  * the screen size given by the breakpoint key in the first argument (inclusive) and less than the screen size given by the breakpoint key in the second argument (exclusive).
43
- * @see [API documentation](https://next.mui.com/material-ui/customization/breakpoints/#theme-breakpoints-between-start-end-media-query)
43
+ * @see [API documentation](https://mui.com/material-ui/customization/breakpoints/#theme-breakpoints-between-start-end-media-query)
44
44
  */
45
45
  between: (start: Breakpoint | number, end: Breakpoint | number) => string;
46
46
  /**
47
47
  * @param key - A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px.
48
48
  * @returns A media query string ready to be used with most styling solutions, which matches screen widths starting from
49
49
  * the screen size given by the breakpoint key (inclusive) and stopping at the screen size given by the next breakpoint key (exclusive).
50
- * @see [API documentation](https://next.mui.com/material-ui/customization/breakpoints/#theme-breakpoints-only-key-media-query)
50
+ * @see [API documentation](https://mui.com/material-ui/customization/breakpoints/#theme-breakpoints-only-key-media-query)
51
51
  */
52
52
  only: (key: Breakpoint) => string;
53
53
  /**
@@ -26,13 +26,13 @@ export interface Breakpoints {
26
26
  /**
27
27
  * @param key - A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px.
28
28
  * @returns A media query string ready to be used with most styling solutions, which matches screen widths greater than the screen size given by the breakpoint key (inclusive).
29
- * @see [API documentation](https://next.mui.com/material-ui/customization/breakpoints/#theme-breakpoints-up-key-media-query)
29
+ * @see [API documentation](https://mui.com/material-ui/customization/breakpoints/#theme-breakpoints-up-key-media-query)
30
30
  */
31
31
  up: (key: Breakpoint | number) => string;
32
32
  /**
33
33
  * @param key - A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px.
34
34
  * @returns A media query string ready to be used with most styling solutions, which matches screen widths less than the screen size given by the breakpoint key (exclusive).
35
- * @see [API documentation](https://next.mui.com/material-ui/customization/breakpoints/#theme-breakpoints-down-key-media-query)
35
+ * @see [API documentation](https://mui.com/material-ui/customization/breakpoints/#theme-breakpoints-down-key-media-query)
36
36
  */
37
37
  down: (key: Breakpoint | number) => string;
38
38
  /**
@@ -40,14 +40,14 @@ export interface Breakpoints {
40
40
  * @param end - A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px.
41
41
  * @returns A media query string ready to be used with most styling solutions, which matches screen widths greater than
42
42
  * the screen size given by the breakpoint key in the first argument (inclusive) and less than the screen size given by the breakpoint key in the second argument (exclusive).
43
- * @see [API documentation](https://next.mui.com/material-ui/customization/breakpoints/#theme-breakpoints-between-start-end-media-query)
43
+ * @see [API documentation](https://mui.com/material-ui/customization/breakpoints/#theme-breakpoints-between-start-end-media-query)
44
44
  */
45
45
  between: (start: Breakpoint | number, end: Breakpoint | number) => string;
46
46
  /**
47
47
  * @param key - A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px.
48
48
  * @returns A media query string ready to be used with most styling solutions, which matches screen widths starting from
49
49
  * the screen size given by the breakpoint key (inclusive) and stopping at the screen size given by the next breakpoint key (exclusive).
50
- * @see [API documentation](https://next.mui.com/material-ui/customization/breakpoints/#theme-breakpoints-only-key-media-query)
50
+ * @see [API documentation](https://mui.com/material-ui/customization/breakpoints/#theme-breakpoints-only-key-media-query)
51
51
  */
52
52
  only: (key: Breakpoint) => string;
53
53
  /**
@@ -53,6 +53,8 @@ function getContainerQuery(theme, shorthand) {
53
53
  const matches = shorthand.match(/^@([^/]+)?\/?(.+)?$/);
54
54
  if (!matches) {
55
55
  if (process.env.NODE_ENV !== 'production') {
56
+ // TODO: avoid throwing during React render only in development.
57
+ // eslint-disable-next-line mui/no-guarded-throw
56
58
  throw /* minify-error */new Error(`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`.');
57
59
  }
58
60
  return null;
@@ -44,6 +44,8 @@ export function getContainerQuery(theme, shorthand) {
44
44
  const matches = shorthand.match(/^@([^/]+)?\/?(.+)?$/);
45
45
  if (!matches) {
46
46
  if (process.env.NODE_ENV !== 'production') {
47
+ // TODO: avoid throwing during React render only in development.
48
+ // eslint-disable-next-line mui/no-guarded-throw
47
49
  throw /* minify-error */new Error(`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`.');
48
50
  }
49
51
  return null;
@@ -238,6 +238,7 @@ function createCssVarsProvider(options) {
238
238
  setColorScheme,
239
239
  setMode: process.env.NODE_ENV === 'production' ? setMode : newMode => {
240
240
  if (memoTheme.colorSchemeSelector === 'media') {
241
+ // #host-reference
241
242
  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'));
242
243
  }
243
244
  setMode(newMode);
@@ -230,6 +230,7 @@ export default function createCssVarsProvider(options) {
230
230
  setColorScheme,
231
231
  setMode: process.env.NODE_ENV === 'production' ? setMode : newMode => {
232
232
  if (memoTheme.colorSchemeSelector === 'media') {
233
+ // #host-reference
233
234
  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'));
234
235
  }
235
236
  setMode(newMode);
@@ -14,7 +14,7 @@ function prepareCssVars(theme, parserConfig = {}) {
14
14
  colorSchemeSelector: selector,
15
15
  enableContrastVars
16
16
  } = parserConfig;
17
- // @ts-ignore - ignore components do not exist
17
+ // @ts-expect-error - ignore components do not exist
18
18
  const {
19
19
  colorSchemes = {},
20
20
  components,
@@ -7,7 +7,7 @@ function prepareCssVars(theme, parserConfig = {}) {
7
7
  colorSchemeSelector: selector,
8
8
  enableContrastVars
9
9
  } = parserConfig;
10
- // @ts-ignore - ignore components do not exist
10
+ // @ts-expect-error - ignore components do not exist
11
11
  const {
12
12
  colorSchemes = {},
13
13
  components,
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/system v9.0.0-beta.1
2
+ * @mui/system v9.0.1
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
package/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/system v9.0.0-beta.1
2
+ * @mui/system v9.0.1
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@mui/system",
3
- "version": "9.0.0-beta.1",
3
+ "version": "9.0.1",
4
4
  "author": "MUI Team",
5
5
  "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.",
6
+ "license": "MIT",
6
7
  "keywords": [
7
8
  "react",
8
9
  "react-component",
@@ -14,7 +15,6 @@
14
15
  "url": "git+https://github.com/mui/material-ui.git",
15
16
  "directory": "packages/mui-system"
16
17
  },
17
- "license": "MIT",
18
18
  "bugs": {
19
19
  "url": "https://github.com/mui/material-ui/issues"
20
20
  },
@@ -28,10 +28,10 @@
28
28
  "clsx": "^2.1.1",
29
29
  "csstype": "^3.2.3",
30
30
  "prop-types": "^15.8.1",
31
- "@mui/private-theming": "9.0.0-beta.1",
32
- "@mui/types": "^9.0.0-beta.0",
33
- "@mui/styled-engine": "9.0.0-beta.0",
34
- "@mui/utils": "9.0.0-beta.1"
31
+ "@mui/private-theming": "^9.0.1",
32
+ "@mui/styled-engine": "^9.0.0",
33
+ "@mui/types": "^9.0.0",
34
+ "@mui/utils": "^9.0.1"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "@emotion/react": "^11.5.0",
@@ -118,7 +118,7 @@ function setThemeValue(css, prop, value, theme, config) {
118
118
  const finalValue = (0, _style.getStyleValue2)(themeMapping, transform, valueFinal, prop);
119
119
  if (cssProperty === false) {
120
120
  if (mediaKey) {
121
- css[mediaKey] = finalValue;
121
+ (0, _fastDeepAssign.default)(css[mediaKey], finalValue);
122
122
  } else {
123
123
  (0, _fastDeepAssign.default)(css, finalValue);
124
124
  }
@@ -111,7 +111,7 @@ function setThemeValue(css, prop, value, theme, config) {
111
111
  const finalValue = getStyleValue2(themeMapping, transform, valueFinal, prop);
112
112
  if (cssProperty === false) {
113
113
  if (mediaKey) {
114
- css[mediaKey] = finalValue;
114
+ merge(css[mediaKey], finalValue);
115
115
  } else {
116
116
  merge(css, finalValue);
117
117
  }
@@ -93,9 +93,10 @@ function unstable_createUseMediaQuery(params = {}) {
93
93
  // This defensive check is here for simplicity.
94
94
  // Most of the time, the match media logic isn't central to people tests.
95
95
  const supportMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia !== 'undefined';
96
+ const fallbackMatchMedia = supportMatchMedia ? window.matchMedia : null;
96
97
  const {
97
98
  defaultMatches = false,
98
- matchMedia = supportMatchMedia ? window.matchMedia : null,
99
+ matchMedia: customMatchMedia,
99
100
  ssrMatchMedia = null,
100
101
  noSsr = false
101
102
  } = (0, _useThemeProps.getThemeProps)({
@@ -103,6 +104,15 @@ function unstable_createUseMediaQuery(params = {}) {
103
104
  props: options,
104
105
  theme
105
106
  });
107
+ const matchMedia = React.useMemo(() => {
108
+ if (customMatchMedia !== undefined) {
109
+ return customMatchMedia;
110
+ }
111
+ if (fallbackMatchMedia === null) {
112
+ return null;
113
+ }
114
+ return fallbackMatchMedia.bind(window);
115
+ }, [customMatchMedia, fallbackMatchMedia]);
106
116
  if (process.env.NODE_ENV !== 'production') {
107
117
  if (typeof queryInput === 'function' && theme === null) {
108
118
  console.error(['MUI: The `query` argument provided is invalid.', 'You are providing a function without a theme in the context.', 'One of the parent elements needs to use a ThemeProvider.'].join('\n'));
@@ -85,9 +85,10 @@ export function unstable_createUseMediaQuery(params = {}) {
85
85
  // This defensive check is here for simplicity.
86
86
  // Most of the time, the match media logic isn't central to people tests.
87
87
  const supportMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia !== 'undefined';
88
+ const fallbackMatchMedia = supportMatchMedia ? window.matchMedia : null;
88
89
  const {
89
90
  defaultMatches = false,
90
- matchMedia = supportMatchMedia ? window.matchMedia : null,
91
+ matchMedia: customMatchMedia,
91
92
  ssrMatchMedia = null,
92
93
  noSsr = false
93
94
  } = getThemeProps({
@@ -95,6 +96,15 @@ export function unstable_createUseMediaQuery(params = {}) {
95
96
  props: options,
96
97
  theme
97
98
  });
99
+ const matchMedia = React.useMemo(() => {
100
+ if (customMatchMedia !== undefined) {
101
+ return customMatchMedia;
102
+ }
103
+ if (fallbackMatchMedia === null) {
104
+ return null;
105
+ }
106
+ return fallbackMatchMedia.bind(window);
107
+ }, [customMatchMedia, fallbackMatchMedia]);
98
108
  if (process.env.NODE_ENV !== 'production') {
99
109
  if (typeof queryInput === 'function' && theme === null) {
100
110
  console.error(['MUI: The `query` argument provided is invalid.', 'You are providing a function without a theme in the context.', 'One of the parent elements needs to use a ThemeProvider.'].join('\n'));
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 = "9.0.0-beta.1";
7
+ const version = exports.version = "9.0.1";
8
8
  const major = exports.major = Number("9");
9
9
  const minor = exports.minor = Number("0");
10
- const patch = exports.patch = Number("0");
11
- const prerelease = exports.prerelease = "beta.1";
10
+ const patch = exports.patch = Number("1");
11
+ const prerelease = exports.prerelease = undefined;
12
12
  var _default = exports.default = version;
package/version/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
- export const version = "9.0.0-beta.1";
1
+ export const version = "9.0.1";
2
2
  export const major = Number("9");
3
3
  export const minor = Number("0");
4
- export const patch = Number("0");
5
- export const prerelease = "beta.1";
4
+ export const patch = Number("1");
5
+ export const prerelease = undefined;
6
6
  export default version;