@mui/utils 6.4.6 → 6.4.9
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 +121 -4
- package/esm/useForkRef/useForkRef.js +32 -12
- package/index.js +1 -1
- package/modern/index.js +1 -1
- package/modern/useForkRef/useForkRef.js +32 -12
- package/package.json +3 -3
- package/useForkRef/useForkRef.d.ts +1 -2
- package/useForkRef/useForkRef.js +32 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,122 @@
|
|
|
1
1
|
# [Versions](https://mui.com/versions/)
|
|
2
2
|
|
|
3
|
+
## 6.4.10
|
|
4
|
+
|
|
5
|
+
<!-- generated comparing v6.4.9..v6.x -->
|
|
6
|
+
|
|
7
|
+
_Mar 31, 2025_
|
|
8
|
+
|
|
9
|
+
A big thanks to the 4 contributors who made this release possible.
|
|
10
|
+
|
|
11
|
+
### `@mui/material@6.4.10`
|
|
12
|
+
|
|
13
|
+
- [Autocomplete] Prevent shrink animation in controlled Autocomplete when initial `value` is provided (#45735) @imadx
|
|
14
|
+
- [Popover] Allow `null` in `anchorEl` function return type (#45723) @eduter
|
|
15
|
+
|
|
16
|
+
### Docs
|
|
17
|
+
|
|
18
|
+
- Fix new React project link, CRA deprecated (#45669) @oliviertassinari
|
|
19
|
+
|
|
20
|
+
### Core
|
|
21
|
+
|
|
22
|
+
- [utils] Support cleanup callbacks in useForkRef (#45733) @DiegoAndai
|
|
23
|
+
|
|
24
|
+
All contributors of this release in alphabetical order: @DiegoAndai, @eduter, @imadx, @oliviertassinari
|
|
25
|
+
|
|
26
|
+
## 6.4.9
|
|
27
|
+
|
|
28
|
+
<!-- generated comparing v6.4.8..v6.x -->
|
|
29
|
+
|
|
30
|
+
_Mar 25, 2025_
|
|
31
|
+
|
|
32
|
+
A big thanks to the 7 contributors who made this release possible.
|
|
33
|
+
|
|
34
|
+
### `@mui/material@6.4.9`
|
|
35
|
+
|
|
36
|
+
- [Autocomplete] Fix when `onHighlightChange` is called (@ZeeshanTamboli) (#45635) @ZeeshanTamboli
|
|
37
|
+
- [StepLabel] Add missing root slot (#45607) @sai6855
|
|
38
|
+
- [Switch] Add slots and slotProps (#45628) @siriwatknp
|
|
39
|
+
- [TextField] Add `root` slot (#45616) @sai6855
|
|
40
|
+
- [Tabs] Fix modifier keys + Left/Right Arrow key from being consumed by tab navigation (#45620) @mushfiqbh
|
|
41
|
+
|
|
42
|
+
### `@mui/codemon@6.4.9`
|
|
43
|
+
|
|
44
|
+
- Add missing deprecations in deprecations-all file (#45508) @sai6855
|
|
45
|
+
|
|
46
|
+
### Docs
|
|
47
|
+
|
|
48
|
+
- [docs] Fix grammatical errors in support.md (#45636) @letianpailove
|
|
49
|
+
- [docs] Restore utility component docs from MUI Base to Material UI (#45240) @mapache-salvaje
|
|
50
|
+
|
|
51
|
+
### Core
|
|
52
|
+
|
|
53
|
+
- [core] Prepare v6 branch for v7 stable release (#45668) @DiegoAndai
|
|
54
|
+
|
|
55
|
+
All contributors of this release in alphabetical order: @DiegoAndai, @letianpailove, @mapache-salvaje, @mushfiqbh, @sai6855, @siriwatknp, @ZeeshanTamboli
|
|
56
|
+
|
|
57
|
+
## 6.4.8
|
|
58
|
+
|
|
59
|
+
<!-- generated comparing v6.4.7..v6.x -->
|
|
60
|
+
|
|
61
|
+
_Mar 14, 2025_
|
|
62
|
+
|
|
63
|
+
A big thanks to the 9 contributors who made this release possible.
|
|
64
|
+
|
|
65
|
+
### `@mui/material@6.4.8`
|
|
66
|
+
|
|
67
|
+
- [ListItemText] Add missing `root` slot (#45552) @sai6855
|
|
68
|
+
- [SpeedDial] Add missing `root` slot (#45551) @sai6855
|
|
69
|
+
- [Tooltip] Allow auto placement on tooltip (#45536) @Jtaks
|
|
70
|
+
- [useScrollTrigger] Do nothing if target is null (#45553) @vipierozan99
|
|
71
|
+
- [Accordion] Add missing `root` slot (#45534) @sai6855
|
|
72
|
+
- [AccordionSummary] Add slots and slotProps (#45560) @sai6855
|
|
73
|
+
- [TextareaAutosize] Fix ResizeObserver causing infinite `selectionchange` loop (#45351) (#45498) @mj12albert
|
|
74
|
+
|
|
75
|
+
### `@mui/styled-engine@6.4.8`
|
|
76
|
+
|
|
77
|
+
- Add `enableCssLayer` prop to StyledEngineProvider (#45563) @siriwatknp
|
|
78
|
+
|
|
79
|
+
### `@mui/system@6.4.8`
|
|
80
|
+
|
|
81
|
+
- [system] Prevent nested non-vars theme inheritance (#45564) @siriwatknp
|
|
82
|
+
|
|
83
|
+
### `@mui/utils@6.4.8`
|
|
84
|
+
|
|
85
|
+
- Use correct iri-reference homepage format (#45511) @dahiro
|
|
86
|
+
|
|
87
|
+
### Core
|
|
88
|
+
|
|
89
|
+
- [test] Fix React 18 tests (#45161) (#45496) @DiegoAndai
|
|
90
|
+
|
|
91
|
+
### Docs
|
|
92
|
+
|
|
93
|
+
- [Backdrop] Fix component name in migration guide (#45507) @sai6855
|
|
94
|
+
- Fix broken links to MUI X docs (cherry-pick of #45145) (#45481) @mapache-salvaje
|
|
95
|
+
- [examples] Fix the invalid argument to extract examples (#45493) @ovtn
|
|
96
|
+
- Add `overriding-component-structure` doc to Material UI (#45570) @siriwatknp
|
|
97
|
+
|
|
98
|
+
All contributors of this release in alphabetical order: @dahiro, @DiegoAndai, @Jtaks, @mapache-salvaje, @mj12albert, @ovtn, @sai6855, @siriwatknp, @vipierozan99
|
|
99
|
+
|
|
100
|
+
## 6.4.7
|
|
101
|
+
|
|
102
|
+
<!-- generated comparing v6.4.6..v6.x -->
|
|
103
|
+
|
|
104
|
+
_Mar 5, 2025_
|
|
105
|
+
|
|
106
|
+
A big thanks to the 3 contributors who made this release possible.
|
|
107
|
+
|
|
108
|
+
### `@mui/material@6.4.7`
|
|
109
|
+
|
|
110
|
+
- [ThemeProvider] Add `storageManager` prop to `ThemeProvider` (@siriwatknp) (#45437) @siriwatknp
|
|
111
|
+
- [Rating] Deprecate \*Props and complete slots, slotProps (#45295) (#45398) @DiegoAndai
|
|
112
|
+
- [Radio] Fix `inputProps` not forwarded (@siriwatknp) (#45475) @siriwatknp
|
|
113
|
+
|
|
114
|
+
### Core
|
|
115
|
+
|
|
116
|
+
- [blog] React 19 migration for MUI X (#45440) @arminmeh
|
|
117
|
+
|
|
118
|
+
All contributors of this release in alphabetical order: @arminmeh, @DiegoAndai, @siriwatknp
|
|
119
|
+
|
|
3
120
|
## 6.4.6
|
|
4
121
|
|
|
5
122
|
<!-- generated comparing v6.4.5..v6.x -->
|
|
@@ -11,21 +128,21 @@ A big thanks to the 4 contributors who made this release possible.
|
|
|
11
128
|
### `@mui/material@6.4.6`
|
|
12
129
|
|
|
13
130
|
- [Checkbox] Add slots and slotProps (#45361) @siriwatknp
|
|
14
|
-
- [Drawer] Deprecate
|
|
131
|
+
- [Drawer] Deprecate \*Props and complete `slots`, `slotProps` (#45377) @siriwatknp
|
|
15
132
|
- [Grid] Improve Grid2 upgrade experience (#45372) @DiegoAndai
|
|
16
133
|
- [InputBase] Deprecate composed classes (#45366) @siriwatknp
|
|
17
134
|
- Fix `slotProps.transition` types (#45367) @siriwatknp
|
|
18
135
|
- Allow nested theme creation with `vars` (#45368) @siriwatknp
|
|
19
136
|
- Fix wrong slotProps of DetailsHTMLAttributes types (#45356) @siriwatknp
|
|
20
|
-
- [Popover] Deprecate
|
|
137
|
+
- [Popover] Deprecate \*Props and complete `slots`, `slotProps` (#45337) @siriwatknp
|
|
21
138
|
- [Radio] Add slots and slotProps (#45364) @siriwatknp
|
|
22
139
|
- [Slider] Fix css class selector in migration guide (#45409) @sai6855
|
|
23
140
|
- [Slider] Fix spacings in .md files (#45393) @sai6855
|
|
24
141
|
- [Snackbar] Add Slots and SlotProps (#45103) (#45352) @siriwatknp
|
|
25
142
|
- [SpeedDialAction] Add slots and slotProps (#45365) @siriwatknp
|
|
26
143
|
- [SwitchBase] Deprecate `inputProps` and complete slots, slotProps (#45338) @siriwatknp
|
|
27
|
-
- [Tabs] Deprecate
|
|
28
|
-
- [Menu] Deprecate
|
|
144
|
+
- [Tabs] Deprecate \*Props and complete slots, slotProps (#45012) (#45355) @siriwatknp
|
|
145
|
+
- [Menu] Deprecate \*Props and complete `slots`, `slotProps` (#45369) @siriwatknp
|
|
29
146
|
|
|
30
147
|
### Docs
|
|
31
148
|
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import setRef from "../setRef/index.js";
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
|
-
*
|
|
8
|
-
* This is useful when you want to have the ref used in multiple places.
|
|
6
|
+
* Merges refs into a single memoized callback ref or `null`.
|
|
9
7
|
*
|
|
10
8
|
* ```tsx
|
|
11
9
|
* const rootRef = React.useRef<Instance>(null);
|
|
@@ -20,19 +18,41 @@ import setRef from "../setRef/index.js";
|
|
|
20
18
|
* @returns {React.RefCallback<Instance> | null} The new ref callback.
|
|
21
19
|
*/
|
|
22
20
|
export default function useForkRef(...refs) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
const cleanupRef = React.useRef(undefined);
|
|
22
|
+
const refEffect = React.useCallback(instance => {
|
|
23
|
+
const cleanups = refs.map(ref => {
|
|
24
|
+
if (ref == null) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
if (typeof ref === 'function') {
|
|
28
|
+
const refCallback = ref;
|
|
29
|
+
const refCleanup = refCallback(instance);
|
|
30
|
+
return typeof refCleanup === 'function' ? refCleanup : () => {
|
|
31
|
+
refCallback(null);
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
ref.current = instance;
|
|
35
|
+
return () => {
|
|
36
|
+
ref.current = null;
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
return () => {
|
|
40
|
+
cleanups.forEach(refCleanup => refCleanup?.());
|
|
41
|
+
};
|
|
42
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
43
|
+
}, refs);
|
|
28
44
|
return React.useMemo(() => {
|
|
29
45
|
if (refs.every(ref => ref == null)) {
|
|
30
46
|
return null;
|
|
31
47
|
}
|
|
32
|
-
return
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
48
|
+
return value => {
|
|
49
|
+
if (cleanupRef.current) {
|
|
50
|
+
cleanupRef.current();
|
|
51
|
+
cleanupRef.current = undefined;
|
|
52
|
+
}
|
|
53
|
+
if (value != null) {
|
|
54
|
+
cleanupRef.current = refEffect(value);
|
|
55
|
+
}
|
|
36
56
|
};
|
|
37
57
|
// TODO: uncomment once we enable eslint-plugin-react-compiler // eslint-disable-next-line react-compiler/react-compiler -- intentionally ignoring that the dependency array must be an array literal
|
|
38
58
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
package/index.js
CHANGED
package/modern/index.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import setRef from "../setRef/index.js";
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
|
-
*
|
|
8
|
-
* This is useful when you want to have the ref used in multiple places.
|
|
6
|
+
* Merges refs into a single memoized callback ref or `null`.
|
|
9
7
|
*
|
|
10
8
|
* ```tsx
|
|
11
9
|
* const rootRef = React.useRef<Instance>(null);
|
|
@@ -20,19 +18,41 @@ import setRef from "../setRef/index.js";
|
|
|
20
18
|
* @returns {React.RefCallback<Instance> | null} The new ref callback.
|
|
21
19
|
*/
|
|
22
20
|
export default function useForkRef(...refs) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
const cleanupRef = React.useRef(undefined);
|
|
22
|
+
const refEffect = React.useCallback(instance => {
|
|
23
|
+
const cleanups = refs.map(ref => {
|
|
24
|
+
if (ref == null) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
if (typeof ref === 'function') {
|
|
28
|
+
const refCallback = ref;
|
|
29
|
+
const refCleanup = refCallback(instance);
|
|
30
|
+
return typeof refCleanup === 'function' ? refCleanup : () => {
|
|
31
|
+
refCallback(null);
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
ref.current = instance;
|
|
35
|
+
return () => {
|
|
36
|
+
ref.current = null;
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
return () => {
|
|
40
|
+
cleanups.forEach(refCleanup => refCleanup?.());
|
|
41
|
+
};
|
|
42
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
43
|
+
}, refs);
|
|
28
44
|
return React.useMemo(() => {
|
|
29
45
|
if (refs.every(ref => ref == null)) {
|
|
30
46
|
return null;
|
|
31
47
|
}
|
|
32
|
-
return
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
48
|
+
return value => {
|
|
49
|
+
if (cleanupRef.current) {
|
|
50
|
+
cleanupRef.current();
|
|
51
|
+
cleanupRef.current = undefined;
|
|
52
|
+
}
|
|
53
|
+
if (value != null) {
|
|
54
|
+
cleanupRef.current = refEffect(value);
|
|
55
|
+
}
|
|
36
56
|
};
|
|
37
57
|
// TODO: uncomment once we enable eslint-plugin-react-compiler // eslint-disable-next-line react-compiler/react-compiler -- intentionally ignoring that the dependency array must be an array literal
|
|
38
58
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/utils",
|
|
3
|
-
"version": "6.4.
|
|
3
|
+
"version": "6.4.9",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"description": "Utility functions for React components.",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"bugs": {
|
|
21
21
|
"url": "https://github.com/mui/material-ui/issues"
|
|
22
22
|
},
|
|
23
|
-
"homepage": "
|
|
23
|
+
"homepage": "https://github.com/mui/material-ui/tree/master/packages/mui-utils",
|
|
24
24
|
"funding": {
|
|
25
25
|
"type": "opencollective",
|
|
26
26
|
"url": "https://opencollective.com/mui-org"
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"clsx": "^2.1.1",
|
|
32
32
|
"prop-types": "^15.8.1",
|
|
33
33
|
"react-is": "^19.0.0",
|
|
34
|
-
"@mui/types": "
|
|
34
|
+
"@mui/types": "~7.2.24"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
* This is useful when you want to have the ref used in multiple places.
|
|
3
|
+
* Merges refs into a single memoized callback ref or `null`.
|
|
5
4
|
*
|
|
6
5
|
* ```tsx
|
|
7
6
|
* const rootRef = React.useRef<Instance>(null);
|
package/useForkRef/useForkRef.js
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
'use client';
|
|
3
3
|
|
|
4
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
4
|
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
6
5
|
Object.defineProperty(exports, "__esModule", {
|
|
7
6
|
value: true
|
|
8
7
|
});
|
|
9
8
|
exports.default = useForkRef;
|
|
10
9
|
var React = _interopRequireWildcard(require("react"));
|
|
11
|
-
var _setRef = _interopRequireDefault(require("../setRef"));
|
|
12
10
|
/**
|
|
13
|
-
*
|
|
14
|
-
* This is useful when you want to have the ref used in multiple places.
|
|
11
|
+
* Merges refs into a single memoized callback ref or `null`.
|
|
15
12
|
*
|
|
16
13
|
* ```tsx
|
|
17
14
|
* const rootRef = React.useRef<Instance>(null);
|
|
@@ -26,19 +23,41 @@ var _setRef = _interopRequireDefault(require("../setRef"));
|
|
|
26
23
|
* @returns {React.RefCallback<Instance> | null} The new ref callback.
|
|
27
24
|
*/
|
|
28
25
|
function useForkRef(...refs) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
26
|
+
const cleanupRef = React.useRef(undefined);
|
|
27
|
+
const refEffect = React.useCallback(instance => {
|
|
28
|
+
const cleanups = refs.map(ref => {
|
|
29
|
+
if (ref == null) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
if (typeof ref === 'function') {
|
|
33
|
+
const refCallback = ref;
|
|
34
|
+
const refCleanup = refCallback(instance);
|
|
35
|
+
return typeof refCleanup === 'function' ? refCleanup : () => {
|
|
36
|
+
refCallback(null);
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
ref.current = instance;
|
|
40
|
+
return () => {
|
|
41
|
+
ref.current = null;
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
return () => {
|
|
45
|
+
cleanups.forEach(refCleanup => refCleanup?.());
|
|
46
|
+
};
|
|
47
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
48
|
+
}, refs);
|
|
34
49
|
return React.useMemo(() => {
|
|
35
50
|
if (refs.every(ref => ref == null)) {
|
|
36
51
|
return null;
|
|
37
52
|
}
|
|
38
|
-
return
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
53
|
+
return value => {
|
|
54
|
+
if (cleanupRef.current) {
|
|
55
|
+
cleanupRef.current();
|
|
56
|
+
cleanupRef.current = undefined;
|
|
57
|
+
}
|
|
58
|
+
if (value != null) {
|
|
59
|
+
cleanupRef.current = refEffect(value);
|
|
60
|
+
}
|
|
42
61
|
};
|
|
43
62
|
// TODO: uncomment once we enable eslint-plugin-react-compiler // eslint-disable-next-line react-compiler/react-compiler -- intentionally ignoring that the dependency array must be an array literal
|
|
44
63
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|