@mui/utils 6.1.2 → 6.1.3

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 CHANGED
@@ -1,5 +1,82 @@
1
1
  # [Versions](https://mui.com/versions/)
2
2
 
3
+ ## v6.1.3
4
+
5
+ <!-- generated comparing v6.1.2..master -->
6
+
7
+ _Oct 9, 2024_
8
+
9
+ A big thanks to the 18 contributors who made this release possible. Here are some highlights ✨:
10
+
11
+ - 🚀 Improved performance on styled components by pre-serializing and caching the styles (#43412) @romgrk
12
+
13
+ ### `@mui/material@6.1.3`
14
+
15
+ - &#8203;<!-- 18 -->Change React.ReactElement<any> to React.ReactElement<unknown> (#43402) @sai6855
16
+ - &#8203;<!-- 42 -->[Badge] Make keys in anchor origin partial (#43950) @sai6855
17
+ - &#8203;<!-- 22 -->[Grid2] Fix column spacing for nested containers (#43733) @Janpot
18
+ - &#8203;<!-- 21 -->[Grid2] Remove required `item` prop for `size` prop (#44027) @Janpot
19
+ - &#8203;<!-- 20 -->[Grid2] Add compatible props warning (#43801) @k-rajat19
20
+ - &#8203;<!-- 17 -->[Modal] Fix comment location (#44026) @oliviertassinari
21
+ - &#8203;<!-- 16 -->[OutlinedInput] Resolve border color issue on mobile (#43797) (#43879) @wojtek35
22
+
23
+ ### `@mui/system@6.1.3`
24
+
25
+ - &#8203;<!-- 15 -->Make createGrid compatible with React 19 types (#44035) @aarongarciah
26
+ - &#8203;<!-- 14 -->Add empty interfaces to fix issue with typescript module augmentation (#43873) @yonatan0
27
+ - &#8203;<!-- 13 -->Pre-serialize & cache styles to improve performance (#43412) @romgrk
28
+ - &#8203;<!-- 09 -->[typescript] `SystemCSSProperties` should not have `SystemStyleObject` as value (#44029) @siriwatknp
29
+
30
+ ### `@mui/utils@6.0.0-beta.11`
31
+
32
+ - &#8203;<!-- 08 -->[utils] Make getReactElementRef React 19 compatible (#44034) @aarongarciah
33
+
34
+ ### `@mui/lab@6.1.3`
35
+
36
+ - &#8203;<!-- 20 -->[lab][Timeline] Fix types for React 19 (#44043) @aarongarciah
37
+
38
+ ### Docs
39
+
40
+ - &#8203;<!-- 35 -->Update docs-infra role (#44032) @mnajdova
41
+ - &#8203;<!-- 34 -->Update Material Symbols plan to reflect Google development (#44000) @oliviertassinari
42
+ - &#8203;<!-- 33 -->Fix 301 redirections in docs @oliviertassinari
43
+ - &#8203;<!-- 32 -->Fix indentation @oliviertassinari
44
+ - &#8203;<!-- 31 -->Fix Live edit copies (#43835) @oliviertassinari
45
+ - &#8203;<!-- 30 -->Virtualize icons svg (#43939) @Janpot
46
+ - &#8203;<!-- 28 -->[Grid] Fix Grid2 gap description (#43967) @aarongarciah
47
+ - &#8203;<!-- 27 -->[icons] Index search synchronously (#44001) @oliviertassinari
48
+ - &#8203;<!-- 26 -->[material-ui] Incorrect React useState Example on Toggle Button (#43987) @barrownicholas
49
+ - &#8203;<!-- 25 -->[material-ui] Add theme setting for pigment-css migration (#43993) @effektsvk
50
+ - &#8203;<!-- 24 -->[material-ui] Fix incorrect `slotProp` name in the `TextField` deprecation note. (#43985) @Chee7ah
51
+ - &#8203;<!-- 23 -->[examples] Use CSS Variables (#43856) @Juneezee
52
+ - &#8203;<!-- 29 -->[material-ui] Improved documentation for indeterminateIcon prop (#43791) @marctaylor01
53
+
54
+ ### Core
55
+
56
+ - &#8203;<!-- 37 -->Fix typo in useLocalStorageState (#44024) @hieunguyenduc696
57
+ - &#8203;<!-- 36 -->Amend changelog (#43968) @aarongarciah
58
+ - &#8203;<!-- 41 -->Remove `@mui/styled-engine-sc` dev dependency from `@mui/styled-engine-sc` (#44050) @Janpot
59
+ - &#8203;<!-- 43 -->[docs-infra] Add pointer cursor on hover for logo to improve UX (#43999) @Asin-Junior-Honore
60
+ - &#8203;<!-- 41 -->[blog] Migrate some .gif to <video> (#43945) @oliviertassinari
61
+ - &#8203;<!-- 40 -->[code-infra] Align `next` dependency specifier across project (#44036) @Janpot
62
+ - &#8203;<!-- 39 -->[code-infra] Move MuiError babel macro to babel plugin (#43904) @Janpot
63
+ - &#8203;<!-- 38 -->[code-infra] Forbid calling `Error` without `new` (#43963) @Janpot
64
+ - &#8203;<!-- 29 -->[docs-infra] Fix link in header regression (#43834) @oliviertassinari
65
+ - &#8203;<!-- 19 -->[infra] Fix line break in Stack Overflow message @oliviertassinari
66
+ - &#8203;<!-- 12 -->[test] Add missing async (#44028) @oliviertassinari
67
+ - &#8203;<!-- 11 -->[test] Fix Escape event firing event (#43961) @oliviertassinari
68
+ - &#8203;<!-- 10 -->[test] Fix flaky pigment-css screenshot (#43959) @Janpot
69
+ - &#8203;<!-- 07 -->[website] Add missing \_redirects HTTP status @oliviertassinari
70
+ - &#8203;<!-- 06 -->[website] Fix sponsor image height @oliviertassinari
71
+ - &#8203;<!-- 05 -->[website] Remove srcset, does nothing in README @oliviertassinari
72
+ - &#8203;<!-- 04 -->[website] Polish display of sponsors @oliviertassinari
73
+ - &#8203;<!-- 03 -->[website] Standardize utm tags @oliviertassinari
74
+ - &#8203;<!-- 02 -->[website] Improve utm_source strategy @oliviertassinari
75
+ - &#8203;<!-- 01 -->[website] Clarify min-level docs-infra @oliviertassinari
76
+ - &#8203;<!-- 08 -->[website] Update backlink sponsors (#43995) @rluzists1
77
+
78
+ All contributors of this release in alphabetical order: @aarongarciah, @Asin-Junior-Honore, @barrownicholas, @Chee7ah, @effektsvk, @hieunguyenduc696, @Janpot, @Juneezee, @k-rajat19, @mnajdova, @oliviertassinari, @romgrk, @sai6855, @siriwatknp, @wojtek35, @yonatan0
79
+
3
80
  ## v6.1.2
4
81
 
5
82
  <!-- generated comparing v6.1.1..master -->
@@ -10,16 +87,12 @@ A big thanks to the 13 contributors who made this release possible.
10
87
 
11
88
  ### `@mui/material@6.1.2`
12
89
 
13
- - [Modal] Remove unnecessary `manager` prop handling (#43867) @ZeeshanTamboli
14
90
  - [Autocomplete] Fix listbox opens and closes on click when used with `limitTags` (#42494) @appleSimple
15
91
  - [Button] Ignore `dark` and `contrastText` if not provided in the theme (#43861) @siriwatknp
16
92
  - [Button] Fix regression for color `inherit` (#43862) @siriwatknp
17
93
  - [LinearProgress] Fix background color (#43949) @sai6855
18
94
  - Support CSS variables with shadow DOM (#43948) @siriwatknp
19
- - Improve getReactElementRef() utils (#43022) @sai6855
20
- - [Modal] Replace `show` parameter name with `hide` in modal manager (#43868) @ZeeshanTamboli
21
95
  - [Rating] Use Rating `name` as prefix of input element ids (#43829) @yash49
22
- - [Drawer] Refactor getScrollbarSize usages (#43828) @BrianWoolfolk
23
96
  - [Drawer] Fix issue with main window being used instead of iframe's window (#43818) @albarv340
24
97
  - [ThemeProvider] Support setting default mode (#43951) @siriwatknp
25
98
 
@@ -56,9 +129,10 @@ A big thanks to the 13 contributors who made this release possible.
56
129
  - [icons] Reduce Material Icon page size (#43911) @oliviertassinari
57
130
  - [test] Point Istanbul to correct URL (#43935) @sai6855
58
131
  - [test] Sync React.version parse logic with codebase (#43820) @oliviertassinari
59
- - [website] Add 'Row spanning' (#43831) @oliviertassinari
60
- - [website] Improve Next roles section (#43822) @oliviertassinari
61
- - [website] Open the xCharts, eXplore and X general react engineer roles (#43805) @DanailH
132
+ - Improve getReactElementRef() utils (#43022) @sai6855
133
+ - [Drawer] Refactor getScrollbarSize usages (#43828) @BrianWoolfolk
134
+ - [Modal] Replace `show` parameter name with `hide` in modal manager (#43868) @ZeeshanTamboli
135
+ - [Modal] Remove unnecessary `manager` prop handling (#43867) @ZeeshanTamboli
62
136
 
63
137
  All contributors of this release in alphabetical order: @albarv340, @appleSimple, @BrianWoolfolk, @DanailH, @Janpot, @kdichev, @oliviertassinari, @sai6855, @samuelsycamore, @siriwatknp, @wilhelmlofsten, @yash49, @ZeeshanTamboli
64
138
 
@@ -12,7 +12,7 @@ var _formatMuiErrorMessage2 = _interopRequireDefault(require("@mui/utils/formatM
12
12
  // We only handle the first word.
13
13
  function capitalize(string) {
14
14
  if (typeof string !== 'string') {
15
- throw new Error(process.env.NODE_ENV !== "production" ? `MUI: \`capitalize(string)\` expects a string argument.` : (0, _formatMuiErrorMessage2.default)(7));
15
+ throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: `capitalize(string)` expects a string argument.' : (0, _formatMuiErrorMessage2.default)(7));
16
16
  }
17
17
  return string.charAt(0).toUpperCase() + string.slice(1);
18
18
  }
@@ -5,7 +5,7 @@ import _formatMuiErrorMessage from "@mui/utils/formatMuiErrorMessage";
5
5
  // We only handle the first word.
6
6
  export default function capitalize(string) {
7
7
  if (typeof string !== 'string') {
8
- throw new Error(process.env.NODE_ENV !== "production" ? `MUI: \`capitalize(string)\` expects a string argument.` : _formatMuiErrorMessage(7));
8
+ throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: `capitalize(string)` expects a string argument.' : _formatMuiErrorMessage(7));
9
9
  }
10
10
  return string.charAt(0).toUpperCase() + string.slice(1);
11
11
  }
@@ -1,19 +1,15 @@
1
1
  /**
2
- * WARNING: Don't import this directly.
3
- * Use `MuiError` from `@mui/internal-babel-macros/MuiError.macro` instead.
2
+ * WARNING: Don't import this directly. It's imported by the code generated by
3
+ * `@mui/interal-babel-plugin-minify-errors`. Make sure to always use string literals in `Error`
4
+ * constructors to ensure the plugin works as expected. Supported patterns include:
5
+ * throw new Error('My message');
6
+ * throw new Error(`My message: ${foo}`);
7
+ * throw new Error(`My message: ${foo}` + 'another string');
8
+ * ...
4
9
  * @param {number} code
5
10
  */
6
- export default function formatMuiErrorMessage(code) {
7
- // Apply babel-plugin-transform-template-literals in loose mode
8
- // loose mode is safe if we're concatenating primitives
9
- // see https://babeljs.io/docs/en/babel-plugin-transform-template-literals#loose
10
- /* eslint-disable prefer-template */
11
- let url = 'https://mui.com/production-error/?code=' + code;
12
- for (let i = 1; i < arguments.length; i += 1) {
13
- // rest params over-transpile for this case
14
- // eslint-disable-next-line prefer-rest-params
15
- url += '&args[]=' + encodeURIComponent(arguments[i]);
16
- }
17
- return 'Minified MUI error #' + code + '; visit ' + url + ' for the full message.';
18
- /* eslint-enable prefer-template */
11
+ export default function formatMuiErrorMessage(code, ...args) {
12
+ const url = new URL(`https://mui.com/production-error/?code=${code}`);
13
+ args.forEach(arg => url.searchParams.append('args[]', arg));
14
+ return `Minified MUI error #${code}; visit ${url} for the full message.`;
19
15
  }
@@ -5,14 +5,14 @@ import * as React from 'react';
5
5
  * It will throw runtime error if the element is not a valid React element.
6
6
  *
7
7
  * @param element React.ReactElement
8
- * @returns React.Ref<any> | null | undefined
8
+ * @returns React.Ref<any> | null
9
9
  */
10
10
  export default function getReactElementRef(element) {
11
11
  // 'ref' is passed as prop in React 19, whereas 'ref' is directly attached to children in older versions
12
12
  if (parseInt(React.version, 10) >= 19) {
13
- return element.props?.ref;
13
+ return element?.props?.ref || null;
14
14
  }
15
15
  // @ts-expect-error element.ref is not included in the ReactElement type
16
16
  // https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/70189
17
- return element?.ref;
17
+ return element?.ref || null;
18
18
  }
@@ -28,20 +28,20 @@ function emitCurrentTabStorageChange(key) {
28
28
  listeners.forEach(listener => listener());
29
29
  }
30
30
  }
31
- function subscribe(area, key, callbark) {
31
+ function subscribe(area, key, callback) {
32
32
  if (!key) {
33
33
  return () => {};
34
34
  }
35
35
  const storageHandler = event => {
36
36
  if (event.storageArea === area && event.key === key) {
37
- callbark();
37
+ callback();
38
38
  }
39
39
  };
40
40
  window.addEventListener('storage', storageHandler);
41
- onCurrentTabStorageChange(key, callbark);
41
+ onCurrentTabStorageChange(key, callback);
42
42
  return () => {
43
43
  window.removeEventListener('storage', storageHandler);
44
- offCurrentTabStorageChange(key, callbark);
44
+ offCurrentTabStorageChange(key, callback);
45
45
  };
46
46
  }
47
47
  function getSnapshot(area, key) {
@@ -89,7 +89,7 @@ function useLocalStorageStateServer() {
89
89
  function useLocalStorageStateBrowser(key, initializer = null) {
90
90
  const [initialValue] = React.useState(initializer);
91
91
  const area = window.localStorage;
92
- const subscribeKey = React.useCallback(callbark => subscribe(area, key, callbark), [area, key]);
92
+ const subscribeKey = React.useCallback(callback => subscribe(area, key, callback), [area, key]);
93
93
  const getKeySnapshot = React.useCallback(() => getSnapshot(area, key) ?? initialValue, [area, initialValue, key]);
94
94
 
95
95
  // Start with null for the hydration, and then switch to the actual value.
@@ -1,6 +1,11 @@
1
1
  /**
2
- * WARNING: Don't import this directly.
3
- * Use `MuiError` from `@mui/internal-babel-macros/MuiError.macro` instead.
2
+ * WARNING: Don't import this directly. It's imported by the code generated by
3
+ * `@mui/interal-babel-plugin-minify-errors`. Make sure to always use string literals in `Error`
4
+ * constructors to ensure the plugin works as expected. Supported patterns include:
5
+ * throw new Error('My message');
6
+ * throw new Error(`My message: ${foo}`);
7
+ * throw new Error(`My message: ${foo}` + 'another string');
8
+ * ...
4
9
  * @param {number} code
5
10
  */
6
- export default function formatMuiErrorMessage(code: number): string;
11
+ export default function formatMuiErrorMessage(code: number, ...args: string[]): string;
@@ -5,21 +5,17 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = formatMuiErrorMessage;
7
7
  /**
8
- * WARNING: Don't import this directly.
9
- * Use `MuiError` from `@mui/internal-babel-macros/MuiError.macro` instead.
8
+ * WARNING: Don't import this directly. It's imported by the code generated by
9
+ * `@mui/interal-babel-plugin-minify-errors`. Make sure to always use string literals in `Error`
10
+ * constructors to ensure the plugin works as expected. Supported patterns include:
11
+ * throw new Error('My message');
12
+ * throw new Error(`My message: ${foo}`);
13
+ * throw new Error(`My message: ${foo}` + 'another string');
14
+ * ...
10
15
  * @param {number} code
11
16
  */
12
- function formatMuiErrorMessage(code) {
13
- // Apply babel-plugin-transform-template-literals in loose mode
14
- // loose mode is safe if we're concatenating primitives
15
- // see https://babeljs.io/docs/en/babel-plugin-transform-template-literals#loose
16
- /* eslint-disable prefer-template */
17
- let url = 'https://mui.com/production-error/?code=' + code;
18
- for (let i = 1; i < arguments.length; i += 1) {
19
- // rest params over-transpile for this case
20
- // eslint-disable-next-line prefer-rest-params
21
- url += '&args[]=' + encodeURIComponent(arguments[i]);
22
- }
23
- return 'Minified MUI error #' + code + '; visit ' + url + ' for the full message.';
24
- /* eslint-enable prefer-template */
17
+ function formatMuiErrorMessage(code, ...args) {
18
+ const url = new URL(`https://mui.com/production-error/?code=${code}`);
19
+ args.forEach(arg => url.searchParams.append('args[]', arg));
20
+ return `Minified MUI error #${code}; visit ${url} for the full message.`;
25
21
  }
@@ -4,6 +4,6 @@ import * as React from 'react';
4
4
  * It will throw runtime error if the element is not a valid React element.
5
5
  *
6
6
  * @param element React.ReactElement
7
- * @returns React.Ref<any> | null | undefined
7
+ * @returns React.Ref<any> | null
8
8
  */
9
- export default function getReactElementRef(element: React.ReactElement): React.Ref<any> | null | undefined;
9
+ export default function getReactElementRef(element: React.ReactElement): React.Ref<any> | null;
@@ -11,14 +11,14 @@ var React = _interopRequireWildcard(require("react"));
11
11
  * It will throw runtime error if the element is not a valid React element.
12
12
  *
13
13
  * @param element React.ReactElement
14
- * @returns React.Ref<any> | null | undefined
14
+ * @returns React.Ref<any> | null
15
15
  */
16
16
  function getReactElementRef(element) {
17
17
  // 'ref' is passed as prop in React 19, whereas 'ref' is directly attached to children in older versions
18
18
  if (parseInt(React.version, 10) >= 19) {
19
- return element.props?.ref;
19
+ return element?.props?.ref || null;
20
20
  }
21
21
  // @ts-expect-error element.ref is not included in the ReactElement type
22
22
  // https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/70189
23
- return element?.ref;
23
+ return element?.ref || null;
24
24
  }
@@ -5,4 +5,4 @@ import * as React from 'react';
5
5
  *
6
6
  * @param children the children
7
7
  */
8
- export default function getValidReactChildren(children: React.ReactNode): React.ReactElement<any>[];
8
+ export default function getValidReactChildren(children: React.ReactNode): React.ReactElement<unknown>[];
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/utils v6.1.2
2
+ * @mui/utils v6.1.3
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -5,7 +5,7 @@ import _formatMuiErrorMessage from "@mui/utils/formatMuiErrorMessage";
5
5
  // We only handle the first word.
6
6
  export default function capitalize(string) {
7
7
  if (typeof string !== 'string') {
8
- throw new Error(process.env.NODE_ENV !== "production" ? `MUI: \`capitalize(string)\` expects a string argument.` : _formatMuiErrorMessage(7));
8
+ throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: `capitalize(string)` expects a string argument.' : _formatMuiErrorMessage(7));
9
9
  }
10
10
  return string.charAt(0).toUpperCase() + string.slice(1);
11
11
  }
@@ -1,19 +1,15 @@
1
1
  /**
2
- * WARNING: Don't import this directly.
3
- * Use `MuiError` from `@mui/internal-babel-macros/MuiError.macro` instead.
2
+ * WARNING: Don't import this directly. It's imported by the code generated by
3
+ * `@mui/interal-babel-plugin-minify-errors`. Make sure to always use string literals in `Error`
4
+ * constructors to ensure the plugin works as expected. Supported patterns include:
5
+ * throw new Error('My message');
6
+ * throw new Error(`My message: ${foo}`);
7
+ * throw new Error(`My message: ${foo}` + 'another string');
8
+ * ...
4
9
  * @param {number} code
5
10
  */
6
- export default function formatMuiErrorMessage(code) {
7
- // Apply babel-plugin-transform-template-literals in loose mode
8
- // loose mode is safe if we're concatenating primitives
9
- // see https://babeljs.io/docs/en/babel-plugin-transform-template-literals#loose
10
- /* eslint-disable prefer-template */
11
- let url = 'https://mui.com/production-error/?code=' + code;
12
- for (let i = 1; i < arguments.length; i += 1) {
13
- // rest params over-transpile for this case
14
- // eslint-disable-next-line prefer-rest-params
15
- url += '&args[]=' + encodeURIComponent(arguments[i]);
16
- }
17
- return 'Minified MUI error #' + code + '; visit ' + url + ' for the full message.';
18
- /* eslint-enable prefer-template */
11
+ export default function formatMuiErrorMessage(code, ...args) {
12
+ const url = new URL(`https://mui.com/production-error/?code=${code}`);
13
+ args.forEach(arg => url.searchParams.append('args[]', arg));
14
+ return `Minified MUI error #${code}; visit ${url} for the full message.`;
19
15
  }
@@ -5,14 +5,14 @@ import * as React from 'react';
5
5
  * It will throw runtime error if the element is not a valid React element.
6
6
  *
7
7
  * @param element React.ReactElement
8
- * @returns React.Ref<any> | null | undefined
8
+ * @returns React.Ref<any> | null
9
9
  */
10
10
  export default function getReactElementRef(element) {
11
11
  // 'ref' is passed as prop in React 19, whereas 'ref' is directly attached to children in older versions
12
12
  if (parseInt(React.version, 10) >= 19) {
13
- return element.props?.ref;
13
+ return element?.props?.ref || null;
14
14
  }
15
15
  // @ts-expect-error element.ref is not included in the ReactElement type
16
16
  // https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/70189
17
- return element?.ref;
17
+ return element?.ref || null;
18
18
  }
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/utils v6.1.2
2
+ * @mui/utils v6.1.3
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -28,20 +28,20 @@ function emitCurrentTabStorageChange(key) {
28
28
  listeners.forEach(listener => listener());
29
29
  }
30
30
  }
31
- function subscribe(area, key, callbark) {
31
+ function subscribe(area, key, callback) {
32
32
  if (!key) {
33
33
  return () => {};
34
34
  }
35
35
  const storageHandler = event => {
36
36
  if (event.storageArea === area && event.key === key) {
37
- callbark();
37
+ callback();
38
38
  }
39
39
  };
40
40
  window.addEventListener('storage', storageHandler);
41
- onCurrentTabStorageChange(key, callbark);
41
+ onCurrentTabStorageChange(key, callback);
42
42
  return () => {
43
43
  window.removeEventListener('storage', storageHandler);
44
- offCurrentTabStorageChange(key, callbark);
44
+ offCurrentTabStorageChange(key, callback);
45
45
  };
46
46
  }
47
47
  function getSnapshot(area, key) {
@@ -89,7 +89,7 @@ function useLocalStorageStateServer() {
89
89
  function useLocalStorageStateBrowser(key, initializer = null) {
90
90
  const [initialValue] = React.useState(initializer);
91
91
  const area = window.localStorage;
92
- const subscribeKey = React.useCallback(callbark => subscribe(area, key, callbark), [area, key]);
92
+ const subscribeKey = React.useCallback(callback => subscribe(area, key, callback), [area, key]);
93
93
  const getKeySnapshot = React.useCallback(() => getSnapshot(area, key) ?? initialValue, [area, initialValue, key]);
94
94
 
95
95
  // Start with null for the hydration, and then switch to the actual value.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/utils",
3
- "version": "6.1.2",
3
+ "version": "6.1.3",
4
4
  "private": false,
5
5
  "author": "MUI Team",
6
6
  "description": "Utility functions for React components.",
@@ -31,7 +31,7 @@
31
31
  "clsx": "^2.1.1",
32
32
  "prop-types": "^15.8.1",
33
33
  "react-is": "^18.3.1",
34
- "@mui/types": "^7.2.17"
34
+ "@mui/types": "^7.2.18"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0",
@@ -33,20 +33,20 @@ function emitCurrentTabStorageChange(key) {
33
33
  listeners.forEach(listener => listener());
34
34
  }
35
35
  }
36
- function subscribe(area, key, callbark) {
36
+ function subscribe(area, key, callback) {
37
37
  if (!key) {
38
38
  return () => {};
39
39
  }
40
40
  const storageHandler = event => {
41
41
  if (event.storageArea === area && event.key === key) {
42
- callbark();
42
+ callback();
43
43
  }
44
44
  };
45
45
  window.addEventListener('storage', storageHandler);
46
- onCurrentTabStorageChange(key, callbark);
46
+ onCurrentTabStorageChange(key, callback);
47
47
  return () => {
48
48
  window.removeEventListener('storage', storageHandler);
49
- offCurrentTabStorageChange(key, callbark);
49
+ offCurrentTabStorageChange(key, callback);
50
50
  };
51
51
  }
52
52
  function getSnapshot(area, key) {
@@ -94,7 +94,7 @@ function useLocalStorageStateServer() {
94
94
  function useLocalStorageStateBrowser(key, initializer = null) {
95
95
  const [initialValue] = React.useState(initializer);
96
96
  const area = window.localStorage;
97
- const subscribeKey = React.useCallback(callbark => subscribe(area, key, callbark), [area, key]);
97
+ const subscribeKey = React.useCallback(callback => subscribe(area, key, callback), [area, key]);
98
98
  const getKeySnapshot = React.useCallback(() => getSnapshot(area, key) ?? initialValue, [area, initialValue, key]);
99
99
 
100
100
  // Start with null for the hydration, and then switch to the actual value.