@mui/utils 6.1.7 → 6.1.8

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,58 @@
1
1
  # [Versions](https://mui.com/versions/)
2
2
 
3
+ ## v6.1.8
4
+
5
+ <!-- generated comparing v6.1.7..master -->
6
+
7
+ _Nov 20, 2024_
8
+
9
+ A big thanks to the 10 contributors who made this release possible.
10
+
11
+ TODO INSERT HIGHLIGHTS
12
+
13
+ ### `@mui/material@6.1.8`
14
+
15
+ - [Autocomplete] Use `ul` element for the listbox (#44422) @DiegoAndai
16
+ - [Grid2] Remove item and zeroMinWidth classes from grid2Classes (#44419) @sai6855
17
+ - [StepIcon] Add SvgIconOwnProps type to StepIcon props (#44337) @sai6855
18
+ - Add generic back to `useMediaQuery` to prevent a breaking change (#44455) @siriwatknp
19
+ - [Tooltip] Deprecate `*Component` and `*Props` for v6 (#44350) @siriwatknp
20
+
21
+ ### `@mui/system@6.1.8`
22
+
23
+ - Warn when calling `setMode` without configuring `colorSchemeSelector` (#43783) @siriwatknp
24
+
25
+ ### `@mui/styled-engine@6.1.8`
26
+
27
+ - Add back removed internal function (#44421) @mnajdova
28
+
29
+ ### `@mui/utils@6.1.8`
30
+
31
+ - Skip deep clone React element (#44400) @siriwatknp
32
+ - Add documentation to `useForkRef` (#44410) @JCQuintas
33
+
34
+ ### Docs
35
+
36
+ - [Accordion] Replace hardcoded classes with constants in demos (#44453) @ZeeshanTamboli
37
+ - [material-ui][Autocomplete] Fix virtualization demo (#44382) @DiegoAndai
38
+ - Revert #44388 (#44454) @prakhargupta1
39
+ - Add App starters in related-projects.md (#44315) @oliviertassinari
40
+ - Bring back `*Component` and `*Props` codemods and deprecation messages (#44383) @DiegoAndai
41
+ - [docs] Copyedit Templates page (#44461) @samuelsycamore
42
+
43
+ ### Core
44
+
45
+ - Remove `stylis-plugin-rtl-sc` (#44447) @renovate[bot]
46
+ - [test][Autocomplete] Make virtualize regression screenshots deterministic (#44425) @DiegoAndai
47
+ - [blog] Fix reference to subdomain on MUI X v8 alpha zero post (#44416) @joserodolfofreitas
48
+ - [blog] MUI X v8 alpha zero blog post (#44377) @joserodolfofreitas
49
+ - [code-infra] Use vitest-compatible skip in `describeConformance` (#44412) @JCQuintas
50
+ - Keep OpenSSF badge up-to-date (aef2bf2) @oliviertassinari
51
+ - Polish useForkRef docs (#44424) @oliviertassinari
52
+ - [infra] Upgrade Cherry-pick workflow to latest (#44448) @oliviertassinari
53
+
54
+ All contributors of this release in alphabetical order: @DiegoAndai, @JCQuintas, @joserodolfofreitas, @mnajdova, @oliviertassinari, @prakhargupta1, @sai6855, samuelsycamore, @siriwatknp, @ZeeshanTamboli
55
+
3
56
  ## v6.1.7
4
57
 
5
58
  <!-- generated comparing v6.1.6..master -->
@@ -1,10 +1,12 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
7
  exports.default = deepmerge;
7
8
  exports.isPlainObject = isPlainObject;
9
+ var React = _interopRequireWildcard(require("react"));
8
10
  // https://github.com/sindresorhus/is-plain-obj/blob/main/index.js
9
11
  function isPlainObject(item) {
10
12
  if (typeof item !== 'object' || item === null) {
@@ -14,7 +16,7 @@ function isPlainObject(item) {
14
16
  return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in item) && !(Symbol.iterator in item);
15
17
  }
16
18
  function deepClone(source) {
17
- if (!isPlainObject(source)) {
19
+ if (/*#__PURE__*/React.isValidElement(source) || !isPlainObject(source)) {
18
20
  return source;
19
21
  }
20
22
  const output = {};
@@ -31,7 +33,9 @@ function deepmerge(target, source, options = {
31
33
  } : target;
32
34
  if (isPlainObject(target) && isPlainObject(source)) {
33
35
  Object.keys(source).forEach(key => {
34
- if (isPlainObject(source[key]) &&
36
+ if (/*#__PURE__*/React.isValidElement(source[key])) {
37
+ output[key] = source[key];
38
+ } else if (isPlainObject(source[key]) &&
35
39
  // Avoid prototype pollution
36
40
  Object.prototype.hasOwnProperty.call(target, key) && isPlainObject(target[key])) {
37
41
  // Since `output` is a clone of `target` and we have narrowed `target` in this block we can cast to the same type.
@@ -1,3 +1,5 @@
1
+ import * as React from 'react';
2
+
1
3
  // https://github.com/sindresorhus/is-plain-obj/blob/main/index.js
2
4
  export function isPlainObject(item) {
3
5
  if (typeof item !== 'object' || item === null) {
@@ -7,7 +9,7 @@ export function isPlainObject(item) {
7
9
  return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in item) && !(Symbol.iterator in item);
8
10
  }
9
11
  function deepClone(source) {
10
- if (!isPlainObject(source)) {
12
+ if (/*#__PURE__*/React.isValidElement(source) || !isPlainObject(source)) {
11
13
  return source;
12
14
  }
13
15
  const output = {};
@@ -24,7 +26,9 @@ export default function deepmerge(target, source, options = {
24
26
  } : target;
25
27
  if (isPlainObject(target) && isPlainObject(source)) {
26
28
  Object.keys(source).forEach(key => {
27
- if (isPlainObject(source[key]) &&
29
+ if (/*#__PURE__*/React.isValidElement(source[key])) {
30
+ output[key] = source[key];
31
+ } else if (isPlainObject(source[key]) &&
28
32
  // Avoid prototype pollution
29
33
  Object.prototype.hasOwnProperty.call(target, key) && isPlainObject(target[key])) {
30
34
  // Since `output` is a clone of `target` and we have narrowed `target` in this block we can cast to the same type.
@@ -2,6 +2,23 @@
2
2
 
3
3
  import * as React from 'react';
4
4
  import setRef from "../setRef/index.js";
5
+
6
+ /**
7
+ * Takes an array of refs and returns a new ref which will apply any modification to all of the refs.
8
+ * This is useful when you want to have the ref used in multiple places.
9
+ *
10
+ * ```tsx
11
+ * const rootRef = React.useRef<Instance>(null);
12
+ * const refFork = useForkRef(rootRef, props.ref);
13
+ *
14
+ * return (
15
+ * <Root {...props} ref={refFork} />
16
+ * );
17
+ * ```
18
+ *
19
+ * @param {Array<React.Ref<Instance> | undefined>} refs The ref array.
20
+ * @returns {React.RefCallback<Instance> | null} The new ref callback.
21
+ */
5
22
  export default function useForkRef(...refs) {
6
23
  /**
7
24
  * This will create a new function if the refs passed to this hook change and are all defined.
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/utils v6.1.7
2
+ * @mui/utils v6.1.8
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -1,3 +1,5 @@
1
+ import * as React from 'react';
2
+
1
3
  // https://github.com/sindresorhus/is-plain-obj/blob/main/index.js
2
4
  export function isPlainObject(item) {
3
5
  if (typeof item !== 'object' || item === null) {
@@ -7,7 +9,7 @@ export function isPlainObject(item) {
7
9
  return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in item) && !(Symbol.iterator in item);
8
10
  }
9
11
  function deepClone(source) {
10
- if (!isPlainObject(source)) {
12
+ if (/*#__PURE__*/React.isValidElement(source) || !isPlainObject(source)) {
11
13
  return source;
12
14
  }
13
15
  const output = {};
@@ -24,7 +26,9 @@ export default function deepmerge(target, source, options = {
24
26
  } : target;
25
27
  if (isPlainObject(target) && isPlainObject(source)) {
26
28
  Object.keys(source).forEach(key => {
27
- if (isPlainObject(source[key]) &&
29
+ if (/*#__PURE__*/React.isValidElement(source[key])) {
30
+ output[key] = source[key];
31
+ } else if (isPlainObject(source[key]) &&
28
32
  // Avoid prototype pollution
29
33
  Object.prototype.hasOwnProperty.call(target, key) && isPlainObject(target[key])) {
30
34
  // Since `output` is a clone of `target` and we have narrowed `target` in this block we can cast to the same type.
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/utils v6.1.7
2
+ * @mui/utils v6.1.8
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -2,6 +2,23 @@
2
2
 
3
3
  import * as React from 'react';
4
4
  import setRef from "../setRef/index.js";
5
+
6
+ /**
7
+ * Takes an array of refs and returns a new ref which will apply any modification to all of the refs.
8
+ * This is useful when you want to have the ref used in multiple places.
9
+ *
10
+ * ```tsx
11
+ * const rootRef = React.useRef<Instance>(null);
12
+ * const refFork = useForkRef(rootRef, props.ref);
13
+ *
14
+ * return (
15
+ * <Root {...props} ref={refFork} />
16
+ * );
17
+ * ```
18
+ *
19
+ * @param {Array<React.Ref<Instance> | undefined>} refs The ref array.
20
+ * @returns {React.RefCallback<Instance> | null} The new ref callback.
21
+ */
5
22
  export default function useForkRef(...refs) {
6
23
  /**
7
24
  * This will create a new function if the refs passed to this hook change and are all defined.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/utils",
3
- "version": "6.1.7",
3
+ "version": "6.1.8",
4
4
  "private": false,
5
5
  "author": "MUI Team",
6
6
  "description": "Utility functions for React components.",
@@ -1,2 +1,18 @@
1
1
  import * as React from 'react';
2
+ /**
3
+ * Takes an array of refs and returns a new ref which will apply any modification to all of the refs.
4
+ * This is useful when you want to have the ref used in multiple places.
5
+ *
6
+ * ```tsx
7
+ * const rootRef = React.useRef<Instance>(null);
8
+ * const refFork = useForkRef(rootRef, props.ref);
9
+ *
10
+ * return (
11
+ * <Root {...props} ref={refFork} />
12
+ * );
13
+ * ```
14
+ *
15
+ * @param {Array<React.Ref<Instance> | undefined>} refs The ref array.
16
+ * @returns {React.RefCallback<Instance> | null} The new ref callback.
17
+ */
2
18
  export default function useForkRef<Instance>(...refs: Array<React.Ref<Instance> | undefined>): React.RefCallback<Instance> | null;
@@ -9,6 +9,22 @@ Object.defineProperty(exports, "__esModule", {
9
9
  exports.default = useForkRef;
10
10
  var React = _interopRequireWildcard(require("react"));
11
11
  var _setRef = _interopRequireDefault(require("../setRef"));
12
+ /**
13
+ * Takes an array of refs and returns a new ref which will apply any modification to all of the refs.
14
+ * This is useful when you want to have the ref used in multiple places.
15
+ *
16
+ * ```tsx
17
+ * const rootRef = React.useRef<Instance>(null);
18
+ * const refFork = useForkRef(rootRef, props.ref);
19
+ *
20
+ * return (
21
+ * <Root {...props} ref={refFork} />
22
+ * );
23
+ * ```
24
+ *
25
+ * @param {Array<React.Ref<Instance> | undefined>} refs The ref array.
26
+ * @returns {React.RefCallback<Instance> | null} The new ref callback.
27
+ */
12
28
  function useForkRef(...refs) {
13
29
  /**
14
30
  * This will create a new function if the refs passed to this hook change and are all defined.