@mui/utils 5.16.6 → 5.16.12
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 +119 -0
- package/deepmerge/deepmerge.js +7 -2
- package/esm/deepmerge/deepmerge.js +6 -2
- package/esm/getReactElementRef/getReactElementRef.js +19 -0
- package/esm/getReactElementRef/index.js +1 -0
- package/esm/index.js +1 -0
- package/getReactElementRef/getReactElementRef.d.ts +9 -0
- package/getReactElementRef/getReactElementRef.js +26 -0
- package/getReactElementRef/index.d.ts +1 -0
- package/getReactElementRef/index.js +13 -0
- package/getReactElementRef/package.json +6 -0
- package/getValidReactChildren/getValidReactChildren.d.ts +1 -1
- package/index.d.ts +1 -0
- package/index.js +10 -2
- package/isHostComponent/isHostComponent.d.ts +1 -1
- package/legacy/deepmerge/deepmerge.js +6 -2
- package/legacy/getReactElementRef/getReactElementRef.js +19 -0
- package/legacy/getReactElementRef/index.js +1 -0
- package/legacy/index.js +2 -1
- package/modern/deepmerge/deepmerge.js +6 -2
- package/modern/getReactElementRef/getReactElementRef.js +18 -0
- package/modern/getReactElementRef/index.js +1 -0
- package/modern/index.js +2 -1
- package/package.json +4 -4
- package/useLazyRef/useLazyRef.d.ts +1 -1
- package/useSlotProps/useSlotProps.d.ts +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,124 @@
|
|
|
1
1
|
# [Versions](https://mui.com/versions/)
|
|
2
2
|
|
|
3
|
+
## v5.16.12
|
|
4
|
+
|
|
5
|
+
<!-- generated comparing v5.16.11..v5.x -->
|
|
6
|
+
|
|
7
|
+
_Dec 16, 2024_
|
|
8
|
+
|
|
9
|
+
Material UI v5 is now compatible with React 19 (#44720) @DiegoAndai
|
|
10
|
+
|
|
11
|
+
### Core
|
|
12
|
+
|
|
13
|
+
- Bump react 19 in v5 (#44720) @DiegoAndai
|
|
14
|
+
- Add `latest-v5` tag to v5 releases (#44757) @DiegoAndai
|
|
15
|
+
|
|
16
|
+
All contributors of this release in alphabetical order: @DiegoAndai
|
|
17
|
+
|
|
18
|
+
## 5.16.11
|
|
19
|
+
|
|
20
|
+
<!-- generated comparing v5.16.9..v5.x -->
|
|
21
|
+
|
|
22
|
+
_Dec 11, 2024_
|
|
23
|
+
|
|
24
|
+
A big thanks to the contributor who made this release possible.
|
|
25
|
+
|
|
26
|
+
### Core
|
|
27
|
+
|
|
28
|
+
- Bump pnpm to 9.14.4 in v5 (#44705) @DiegoAndai
|
|
29
|
+
- Fix UMD examples (#44706) @DiegoAndai
|
|
30
|
+
- [typescript] Rescue missing backports v5 (#44712) @DiegoAndai
|
|
31
|
+
|
|
32
|
+
All contributors of this release in alphabetical order: @DiegoAndai
|
|
33
|
+
|
|
34
|
+
## 5.16.9
|
|
35
|
+
|
|
36
|
+
<!-- generated comparing v5.16.8..v5.x -->
|
|
37
|
+
|
|
38
|
+
_Dec 3, 2024_
|
|
39
|
+
|
|
40
|
+
A big thanks to the 2 contributors who made this release possible.
|
|
41
|
+
|
|
42
|
+
### `@mui/material@5.16.9`
|
|
43
|
+
|
|
44
|
+
- [Tabs] Cherry pick `ScrollbarSize` ref being overridden fix (#44595) @DiegoAndai
|
|
45
|
+
|
|
46
|
+
### Core
|
|
47
|
+
|
|
48
|
+
- Ignore browserslist and remove tag latest (#44589) @siriwatknp
|
|
49
|
+
|
|
50
|
+
All contributors of this release in alphabetical order: @DiegoAndai, @siriwatknp
|
|
51
|
+
|
|
52
|
+
## 5.16.8
|
|
53
|
+
|
|
54
|
+
<!-- generated comparing v5.16.7..v5.x -->
|
|
55
|
+
|
|
56
|
+
_Nov 26, 2024_
|
|
57
|
+
|
|
58
|
+
A big thanks to the 8 contributors who made this release possible.
|
|
59
|
+
|
|
60
|
+
### `@mui/material@5.16.8`
|
|
61
|
+
|
|
62
|
+
- Cherry pick ref accessing PRs (#44543) @DiegoAndai
|
|
63
|
+
|
|
64
|
+
### `@mui/utils@5.16.8`
|
|
65
|
+
|
|
66
|
+
- Skip deep clone React element (v5.x) (#44494) @jukkatupamaki
|
|
67
|
+
|
|
68
|
+
### Docs
|
|
69
|
+
|
|
70
|
+
- Keep sponsors up to date @oliviertassinari
|
|
71
|
+
- Fix MUI Treasury Layout broken links (#43753) @oliviertassinari
|
|
72
|
+
- Strengthen CSP rule @oliviertassinari
|
|
73
|
+
- Give up on restoring search @oliviertassinari
|
|
74
|
+
- Normalize next major message @oliviertassinari
|
|
75
|
+
- Fix versions URL @oliviertassinari
|
|
76
|
+
- Fix use of absolute URLs (#43567) @oliviertassinari
|
|
77
|
+
- Restore search on v5 (#43566) @oliviertassinari
|
|
78
|
+
- Fix link from v5 to v6 (#43585) @alexfauquette
|
|
79
|
+
- Updated mui-x roadmap links with the new project URL (@michelengelen) (#43446) @michelengelen
|
|
80
|
+
- Fix broken link to Next.js docs @oliviertassinari
|
|
81
|
+
|
|
82
|
+
### Core
|
|
83
|
+
|
|
84
|
+
- [blog] Polish Upcoming changes to MUI X pricing in 2024 (#43438) @oliviertassinari
|
|
85
|
+
- [blog] Add video to the Pigment CSS blog post (#42500) @oliviertassinari
|
|
86
|
+
- [blog] Announcing pricing changes Sep 2024 (#43272) @cherniavskii
|
|
87
|
+
- Prepare for moving to v5.x branch (#43447) @siriwatknp
|
|
88
|
+
- [core] Cherry pick #42346 to v5 (#44475) @DiegoAndai
|
|
89
|
+
- [core] Fix CI on v5.x branch (#44487) @DiegoAndai
|
|
90
|
+
- [core] Fix CI on v5.x branch (#43564) @oliviertassinari
|
|
91
|
+
- [examples] Fix v5 clone example instructions (#43755) @oliviertassinari
|
|
92
|
+
- [examples] Fix CLI download instructions @oliviertassinari
|
|
93
|
+
- [examples] Fix CDN live preview example @oliviertassinari
|
|
94
|
+
- [examples] Fix more examples to work with v5 @oliviertassinari
|
|
95
|
+
- [examples] Freeze examples dependency range (#43435) @oliviertassinari
|
|
96
|
+
|
|
97
|
+
All contributors of this release in alphabetical order: @alexfauquette, @cherniavskii, @DiegoAndai, @jukkatupamaki, @michelengelen, @oliviertassinari, @rluzists1, @siriwatknp
|
|
98
|
+
|
|
99
|
+
## 5.16.7
|
|
100
|
+
|
|
101
|
+
<!-- generated comparing v5.16.6..master -->
|
|
102
|
+
|
|
103
|
+
_Aug 9, 2024_
|
|
104
|
+
|
|
105
|
+
A big thanks to the 3 contributors who made this release possible.
|
|
106
|
+
|
|
107
|
+
### `@mui/material@5.16.7`
|
|
108
|
+
|
|
109
|
+
- ​<!-- 3 -->[material-ui][mui-system] Add support for version runtime checks (#43233) @DiegoAndai
|
|
110
|
+
|
|
111
|
+
### Docs
|
|
112
|
+
|
|
113
|
+
- ​<!-- 4 -->[docs] Fix 301 @oliviertassinari
|
|
114
|
+
|
|
115
|
+
### Core
|
|
116
|
+
|
|
117
|
+
- ​<!-- 2 -->[website] Fix wrong link in pricing table (@zanivan) (#43143) @zanivan
|
|
118
|
+
- ​<!-- 1 -->[website] Add blog link to pricing table (@zanivan) (#43140) @zanivan
|
|
119
|
+
|
|
120
|
+
All contributors of this release in alphabetical order: @DiegoAndai, @oliviertassinari, @zanivan
|
|
121
|
+
|
|
3
122
|
## 5.16.6
|
|
4
123
|
|
|
5
124
|
<!-- generated comparing v5.16.5..master -->
|
package/deepmerge/deepmerge.js
CHANGED
|
@@ -7,6 +7,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = deepmerge;
|
|
8
8
|
exports.isPlainObject = isPlainObject;
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
12
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
10
13
|
// https://github.com/sindresorhus/is-plain-obj/blob/main/index.js
|
|
11
14
|
function isPlainObject(item) {
|
|
12
15
|
if (typeof item !== 'object' || item === null) {
|
|
@@ -16,7 +19,7 @@ function isPlainObject(item) {
|
|
|
16
19
|
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in item) && !(Symbol.iterator in item);
|
|
17
20
|
}
|
|
18
21
|
function deepClone(source) {
|
|
19
|
-
if (!isPlainObject(source)) {
|
|
22
|
+
if ( /*#__PURE__*/React.isValidElement(source) || !isPlainObject(source)) {
|
|
20
23
|
return source;
|
|
21
24
|
}
|
|
22
25
|
const output = {};
|
|
@@ -31,7 +34,9 @@ function deepmerge(target, source, options = {
|
|
|
31
34
|
const output = options.clone ? (0, _extends2.default)({}, target) : target;
|
|
32
35
|
if (isPlainObject(target) && isPlainObject(source)) {
|
|
33
36
|
Object.keys(source).forEach(key => {
|
|
34
|
-
if (
|
|
37
|
+
if ( /*#__PURE__*/React.isValidElement(source[key])) {
|
|
38
|
+
output[key] = source[key];
|
|
39
|
+
} else if (isPlainObject(source[key]) &&
|
|
35
40
|
// Avoid prototype pollution
|
|
36
41
|
Object.prototype.hasOwnProperty.call(target, key) && isPlainObject(target[key])) {
|
|
37
42
|
// Since `output` is a clone of `target` and we have narrowed `target` in this block we can cast to the same type.
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
2
4
|
// https://github.com/sindresorhus/is-plain-obj/blob/main/index.js
|
|
3
5
|
export function isPlainObject(item) {
|
|
4
6
|
if (typeof item !== 'object' || item === null) {
|
|
@@ -8,7 +10,7 @@ export function isPlainObject(item) {
|
|
|
8
10
|
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in item) && !(Symbol.iterator in item);
|
|
9
11
|
}
|
|
10
12
|
function deepClone(source) {
|
|
11
|
-
if (!isPlainObject(source)) {
|
|
13
|
+
if ( /*#__PURE__*/React.isValidElement(source) || !isPlainObject(source)) {
|
|
12
14
|
return source;
|
|
13
15
|
}
|
|
14
16
|
const output = {};
|
|
@@ -23,7 +25,9 @@ export default function deepmerge(target, source, options = {
|
|
|
23
25
|
const output = options.clone ? _extends({}, target) : target;
|
|
24
26
|
if (isPlainObject(target) && isPlainObject(source)) {
|
|
25
27
|
Object.keys(source).forEach(key => {
|
|
26
|
-
if (
|
|
28
|
+
if ( /*#__PURE__*/React.isValidElement(source[key])) {
|
|
29
|
+
output[key] = source[key];
|
|
30
|
+
} else if (isPlainObject(source[key]) &&
|
|
27
31
|
// Avoid prototype pollution
|
|
28
32
|
Object.prototype.hasOwnProperty.call(target, key) && isPlainObject(target[key])) {
|
|
29
33
|
// Since `output` is a clone of `target` and we have narrowed `target` in this block we can cast to the same type.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Returns the ref of a React element handling differences between React 19 and older versions.
|
|
5
|
+
* It will throw runtime error if the element is not a valid React element.
|
|
6
|
+
*
|
|
7
|
+
* @param element React.ReactElement
|
|
8
|
+
* @returns React.Ref<any> | null
|
|
9
|
+
*/
|
|
10
|
+
export default function getReactElementRef(element) {
|
|
11
|
+
// 'ref' is passed as prop in React 19, whereas 'ref' is directly attached to children in older versions
|
|
12
|
+
if (parseInt(React.version, 10) >= 19) {
|
|
13
|
+
var _element$props;
|
|
14
|
+
return (element == null || (_element$props = element.props) == null ? void 0 : _element$props.ref) || null;
|
|
15
|
+
}
|
|
16
|
+
// @ts-expect-error element.ref is not included in the ReactElement type
|
|
17
|
+
// https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/70189
|
|
18
|
+
return (element == null ? void 0 : element.ref) || null;
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './getReactElementRef';
|
package/esm/index.js
CHANGED
|
@@ -45,4 +45,5 @@ export { default as clamp } from './clamp';
|
|
|
45
45
|
export { default as unstable_useSlotProps } from './useSlotProps';
|
|
46
46
|
export { default as unstable_resolveComponentProps } from './resolveComponentProps';
|
|
47
47
|
export { default as unstable_extractEventHandlers } from './extractEventHandlers';
|
|
48
|
+
export { default as unstable_getReactElementRef } from './getReactElementRef';
|
|
48
49
|
export * from './types';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the ref of a React element handling differences between React 19 and older versions.
|
|
4
|
+
* It will throw runtime error if the element is not a valid React element.
|
|
5
|
+
*
|
|
6
|
+
* @param element React.ReactElement
|
|
7
|
+
* @returns React.Ref<any> | null
|
|
8
|
+
*/
|
|
9
|
+
export default function getReactElementRef(element: React.ReactElement): React.Ref<any> | null;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = getReactElementRef;
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
9
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
10
|
+
/**
|
|
11
|
+
* Returns the ref of a React element handling differences between React 19 and older versions.
|
|
12
|
+
* It will throw runtime error if the element is not a valid React element.
|
|
13
|
+
*
|
|
14
|
+
* @param element React.ReactElement
|
|
15
|
+
* @returns React.Ref<any> | null
|
|
16
|
+
*/
|
|
17
|
+
function getReactElementRef(element) {
|
|
18
|
+
// 'ref' is passed as prop in React 19, whereas 'ref' is directly attached to children in older versions
|
|
19
|
+
if (parseInt(React.version, 10) >= 19) {
|
|
20
|
+
var _element$props;
|
|
21
|
+
return (element == null || (_element$props = element.props) == null ? void 0 : _element$props.ref) || null;
|
|
22
|
+
}
|
|
23
|
+
// @ts-expect-error element.ref is not included in the ReactElement type
|
|
24
|
+
// https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/70189
|
|
25
|
+
return (element == null ? void 0 : element.ref) || null;
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './getReactElementRef';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
Object.defineProperty(exports, "default", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _getReactElementRef.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
var _getReactElementRef = _interopRequireDefault(require("./getReactElementRef"));
|
|
@@ -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<
|
|
8
|
+
export default function getValidReactChildren(children: React.ReactNode): React.ReactElement<unknown>[];
|
package/index.d.ts
CHANGED
|
@@ -46,4 +46,5 @@ export { default as unstable_useSlotProps } from './useSlotProps';
|
|
|
46
46
|
export type { UseSlotPropsParameters, UseSlotPropsResult } from './useSlotProps';
|
|
47
47
|
export { default as unstable_resolveComponentProps } from './resolveComponentProps';
|
|
48
48
|
export { default as unstable_extractEventHandlers } from './extractEventHandlers';
|
|
49
|
+
export { default as unstable_getReactElementRef } from './getReactElementRef';
|
|
49
50
|
export * from './types';
|
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/utils v5.16.
|
|
2
|
+
* @mui/utils v5.16.12
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -59,7 +59,8 @@ var _exportNames = {
|
|
|
59
59
|
clamp: true,
|
|
60
60
|
unstable_useSlotProps: true,
|
|
61
61
|
unstable_resolveComponentProps: true,
|
|
62
|
-
unstable_extractEventHandlers: true
|
|
62
|
+
unstable_extractEventHandlers: true,
|
|
63
|
+
unstable_getReactElementRef: true
|
|
63
64
|
};
|
|
64
65
|
Object.defineProperty(exports, "HTMLElementType", {
|
|
65
66
|
enumerable: true,
|
|
@@ -223,6 +224,12 @@ Object.defineProperty(exports, "unstable_getNormalizedScrollLeft", {
|
|
|
223
224
|
return _scrollLeft.getNormalizedScrollLeft;
|
|
224
225
|
}
|
|
225
226
|
});
|
|
227
|
+
Object.defineProperty(exports, "unstable_getReactElementRef", {
|
|
228
|
+
enumerable: true,
|
|
229
|
+
get: function () {
|
|
230
|
+
return _getReactElementRef.default;
|
|
231
|
+
}
|
|
232
|
+
});
|
|
226
233
|
Object.defineProperty(exports, "unstable_getScrollbarSize", {
|
|
227
234
|
enumerable: true,
|
|
228
235
|
get: function () {
|
|
@@ -404,6 +411,7 @@ var _clamp = _interopRequireDefault(require("./clamp"));
|
|
|
404
411
|
var _useSlotProps = _interopRequireDefault(require("./useSlotProps"));
|
|
405
412
|
var _resolveComponentProps = _interopRequireDefault(require("./resolveComponentProps"));
|
|
406
413
|
var _extractEventHandlers = _interopRequireDefault(require("./extractEventHandlers"));
|
|
414
|
+
var _getReactElementRef = _interopRequireDefault(require("./getReactElementRef"));
|
|
407
415
|
var _types = require("./types");
|
|
408
416
|
Object.keys(_types).forEach(function (key) {
|
|
409
417
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -2,5 +2,5 @@ import * as React from 'react';
|
|
|
2
2
|
/**
|
|
3
3
|
* Determines if a given element is a DOM element name (i.e. not a React component).
|
|
4
4
|
*/
|
|
5
|
-
declare function isHostComponent(element: React.ElementType):
|
|
5
|
+
declare function isHostComponent(element: React.ElementType): element is "symbol" | "object" | "center" | "button" | "meter" | "textarea" | "style" | "progress" | "text" | "ruby" | "table" | "small" | "sub" | "circle" | "embed" | "pre" | "caption" | "menu" | "clipPath" | "filter" | "menuitem" | "mask" | "marker" | "a" | "abbr" | "address" | "area" | "article" | "aside" | "audio" | "b" | "base" | "bdi" | "bdo" | "big" | "blockquote" | "body" | "br" | "canvas" | "cite" | "code" | "col" | "colgroup" | "data" | "datalist" | "dd" | "del" | "details" | "dfn" | "dialog" | "div" | "dl" | "dt" | "em" | "fieldset" | "figcaption" | "figure" | "footer" | "form" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "head" | "header" | "hgroup" | "hr" | "html" | "i" | "iframe" | "img" | "input" | "ins" | "kbd" | "keygen" | "label" | "legend" | "li" | "link" | "main" | "map" | "mark" | "meta" | "nav" | "noindex" | "noscript" | "ol" | "optgroup" | "option" | "output" | "p" | "param" | "picture" | "q" | "rp" | "rt" | "s" | "samp" | "search" | "slot" | "script" | "section" | "select" | "source" | "span" | "strong" | "summary" | "sup" | "template" | "tbody" | "td" | "tfoot" | "th" | "thead" | "time" | "title" | "tr" | "track" | "u" | "ul" | "var" | "video" | "wbr" | "webview" | "svg" | "animate" | "animateMotion" | "animateTransform" | "defs" | "desc" | "ellipse" | "feBlend" | "feColorMatrix" | "feComponentTransfer" | "feComposite" | "feConvolveMatrix" | "feDiffuseLighting" | "feDisplacementMap" | "feDistantLight" | "feDropShadow" | "feFlood" | "feFuncA" | "feFuncB" | "feFuncG" | "feFuncR" | "feGaussianBlur" | "feImage" | "feMerge" | "feMergeNode" | "feMorphology" | "feOffset" | "fePointLight" | "feSpecularLighting" | "feSpotLight" | "feTile" | "feTurbulence" | "foreignObject" | "g" | "image" | "line" | "linearGradient" | "metadata" | "mpath" | "path" | "pattern" | "polygon" | "polyline" | "radialGradient" | "rect" | "set" | "stop" | "switch" | "textPath" | "tspan" | "use" | "view";
|
|
6
6
|
export default isHostComponent;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
3
5
|
// https://github.com/sindresorhus/is-plain-obj/blob/main/index.js
|
|
4
6
|
export function isPlainObject(item) {
|
|
5
7
|
if (_typeof(item) !== 'object' || item === null) {
|
|
@@ -9,7 +11,7 @@ export function isPlainObject(item) {
|
|
|
9
11
|
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in item) && !(Symbol.iterator in item);
|
|
10
12
|
}
|
|
11
13
|
function deepClone(source) {
|
|
12
|
-
if (!isPlainObject(source)) {
|
|
14
|
+
if ( /*#__PURE__*/React.isValidElement(source) || !isPlainObject(source)) {
|
|
13
15
|
return source;
|
|
14
16
|
}
|
|
15
17
|
var output = {};
|
|
@@ -25,7 +27,9 @@ export default function deepmerge(target, source) {
|
|
|
25
27
|
var output = options.clone ? _extends({}, target) : target;
|
|
26
28
|
if (isPlainObject(target) && isPlainObject(source)) {
|
|
27
29
|
Object.keys(source).forEach(function (key) {
|
|
28
|
-
if (
|
|
30
|
+
if ( /*#__PURE__*/React.isValidElement(source[key])) {
|
|
31
|
+
output[key] = source[key];
|
|
32
|
+
} else if (isPlainObject(source[key]) &&
|
|
29
33
|
// Avoid prototype pollution
|
|
30
34
|
Object.prototype.hasOwnProperty.call(target, key) && isPlainObject(target[key])) {
|
|
31
35
|
// Since `output` is a clone of `target` and we have narrowed `target` in this block we can cast to the same type.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Returns the ref of a React element handling differences between React 19 and older versions.
|
|
5
|
+
* It will throw runtime error if the element is not a valid React element.
|
|
6
|
+
*
|
|
7
|
+
* @param element React.ReactElement
|
|
8
|
+
* @returns React.Ref<any> | null
|
|
9
|
+
*/
|
|
10
|
+
export default function getReactElementRef(element) {
|
|
11
|
+
// 'ref' is passed as prop in React 19, whereas 'ref' is directly attached to children in older versions
|
|
12
|
+
if (parseInt(React.version, 10) >= 19) {
|
|
13
|
+
var _element$props;
|
|
14
|
+
return (element == null || (_element$props = element.props) == null ? void 0 : _element$props.ref) || null;
|
|
15
|
+
}
|
|
16
|
+
// @ts-expect-error element.ref is not included in the ReactElement type
|
|
17
|
+
// https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/70189
|
|
18
|
+
return (element == null ? void 0 : element.ref) || null;
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './getReactElementRef';
|
package/legacy/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/utils v5.16.
|
|
2
|
+
* @mui/utils v5.16.12
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -52,4 +52,5 @@ export { default as clamp } from './clamp';
|
|
|
52
52
|
export { default as unstable_useSlotProps } from './useSlotProps';
|
|
53
53
|
export { default as unstable_resolveComponentProps } from './resolveComponentProps';
|
|
54
54
|
export { default as unstable_extractEventHandlers } from './extractEventHandlers';
|
|
55
|
+
export { default as unstable_getReactElementRef } from './getReactElementRef';
|
|
55
56
|
export * from './types';
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
2
4
|
// https://github.com/sindresorhus/is-plain-obj/blob/main/index.js
|
|
3
5
|
export function isPlainObject(item) {
|
|
4
6
|
if (typeof item !== 'object' || item === null) {
|
|
@@ -8,7 +10,7 @@ export function isPlainObject(item) {
|
|
|
8
10
|
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in item) && !(Symbol.iterator in item);
|
|
9
11
|
}
|
|
10
12
|
function deepClone(source) {
|
|
11
|
-
if (!isPlainObject(source)) {
|
|
13
|
+
if ( /*#__PURE__*/React.isValidElement(source) || !isPlainObject(source)) {
|
|
12
14
|
return source;
|
|
13
15
|
}
|
|
14
16
|
const output = {};
|
|
@@ -23,7 +25,9 @@ export default function deepmerge(target, source, options = {
|
|
|
23
25
|
const output = options.clone ? _extends({}, target) : target;
|
|
24
26
|
if (isPlainObject(target) && isPlainObject(source)) {
|
|
25
27
|
Object.keys(source).forEach(key => {
|
|
26
|
-
if (
|
|
28
|
+
if ( /*#__PURE__*/React.isValidElement(source[key])) {
|
|
29
|
+
output[key] = source[key];
|
|
30
|
+
} else if (isPlainObject(source[key]) &&
|
|
27
31
|
// Avoid prototype pollution
|
|
28
32
|
Object.prototype.hasOwnProperty.call(target, key) && isPlainObject(target[key])) {
|
|
29
33
|
// Since `output` is a clone of `target` and we have narrowed `target` in this block we can cast to the same type.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Returns the ref of a React element handling differences between React 19 and older versions.
|
|
5
|
+
* It will throw runtime error if the element is not a valid React element.
|
|
6
|
+
*
|
|
7
|
+
* @param element React.ReactElement
|
|
8
|
+
* @returns React.Ref<any> | null
|
|
9
|
+
*/
|
|
10
|
+
export default function getReactElementRef(element) {
|
|
11
|
+
// 'ref' is passed as prop in React 19, whereas 'ref' is directly attached to children in older versions
|
|
12
|
+
if (parseInt(React.version, 10) >= 19) {
|
|
13
|
+
return element?.props?.ref || null;
|
|
14
|
+
}
|
|
15
|
+
// @ts-expect-error element.ref is not included in the ReactElement type
|
|
16
|
+
// https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/70189
|
|
17
|
+
return element?.ref || null;
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './getReactElementRef';
|
package/modern/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/utils v5.16.
|
|
2
|
+
* @mui/utils v5.16.12
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -52,4 +52,5 @@ export { default as clamp } from './clamp';
|
|
|
52
52
|
export { default as unstable_useSlotProps } from './useSlotProps';
|
|
53
53
|
export { default as unstable_resolveComponentProps } from './resolveComponentProps';
|
|
54
54
|
export { default as unstable_extractEventHandlers } from './extractEventHandlers';
|
|
55
|
+
export { default as unstable_getReactElementRef } from './getReactElementRef';
|
|
55
56
|
export * from './types';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/utils",
|
|
3
|
-
"version": "5.16.
|
|
3
|
+
"version": "5.16.12",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"description": "Utility functions for React components.",
|
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
"@types/prop-types": "^15.7.12",
|
|
31
31
|
"clsx": "^2.1.1",
|
|
32
32
|
"prop-types": "^15.8.1",
|
|
33
|
-
"react-is": "^
|
|
33
|
+
"react-is": "^19.0.0",
|
|
34
34
|
"@mui/types": "^7.2.15"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@types/react": "^17.0.0 || ^18.0.0",
|
|
38
|
-
"react": "^17.0.0 || ^18.0.0"
|
|
37
|
+
"@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
38
|
+
"react": "^17.0.0 || ^18.0.0 || ^19.0.0"
|
|
39
39
|
},
|
|
40
40
|
"peerDependenciesMeta": {
|
|
41
41
|
"@types/react": {
|
|
@@ -6,4 +6,4 @@ import * as React from 'react';
|
|
|
6
6
|
* @usage
|
|
7
7
|
* const ref = useLazyRef(sortColumns, columns)
|
|
8
8
|
*/
|
|
9
|
-
export default function useLazyRef<T, U>(init: (arg?: U) => T, initArg?: U): React.
|
|
9
|
+
export default function useLazyRef<T, U>(init: (arg?: U) => T, initArg?: U): React.RefObject<T>;
|
|
@@ -31,10 +31,10 @@ export type UseSlotPropsResult<ElementType extends React.ElementType, SlotProps,
|
|
|
31
31
|
* @param parameters.getSlotProps - A function that returns the props to be passed to the slot component.
|
|
32
32
|
*/
|
|
33
33
|
declare function useSlotProps<ElementType extends React.ElementType, SlotProps, AdditionalProps, OwnerState>(parameters: UseSlotPropsParameters<ElementType, SlotProps, object, WithCommonProps<Record<string, any>>, AdditionalProps, OwnerState>): import("@mui/types").Simplify<import("@mui/types").Simplify<SlotProps & object & AdditionalProps & {
|
|
34
|
-
className?: string
|
|
35
|
-
style?: React.CSSProperties
|
|
34
|
+
className?: string;
|
|
35
|
+
style?: React.CSSProperties;
|
|
36
36
|
}> & {
|
|
37
|
-
ref: ((instance: any) => void) | null;
|
|
37
|
+
ref: ((instance: any | null) => void) | null;
|
|
38
38
|
} & {
|
|
39
39
|
ownerState: ElementType extends React.ComponentType<any> ? OwnerState : ElementType extends keyof React.JSX.IntrinsicElements ? undefined : OwnerState | undefined;
|
|
40
40
|
}>;
|