@mui/utils 6.0.0-alpha.5 → 6.0.0-alpha.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 +131 -1
- package/deepmerge/deepmerge.js +3 -2
- package/exactProp/exactProp.js +3 -3
- package/index.js +1 -1
- package/modern/deepmerge/deepmerge.js +3 -2
- package/modern/exactProp/exactProp.js +3 -3
- package/modern/index.js +1 -1
- package/modern/requirePropFactory/requirePropFactory.js +3 -2
- package/modern/resolveProps/resolveProps.js +10 -4
- package/modern/useTimeout/useTimeout.js +11 -12
- package/node/deepmerge/deepmerge.js +3 -3
- package/node/exactProp/exactProp.js +3 -4
- package/node/index.js +1 -1
- package/node/requirePropFactory/requirePropFactory.js +3 -3
- package/node/resolveProps/resolveProps.js +10 -5
- package/node/useTimeout/useTimeout.js +11 -12
- package/package.json +2 -2
- package/requirePropFactory/requirePropFactory.js +3 -2
- package/resolveProps/resolveProps.js +10 -4
- package/useTimeout/useTimeout.js +11 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,142 @@
|
|
|
1
1
|
# [Versions](https://mui.com/versions/)
|
|
2
2
|
|
|
3
|
+
## v6.0.0-alpha.8
|
|
4
|
+
|
|
5
|
+
<!-- generated comparing v6.0.0-alpha.7..next -->
|
|
6
|
+
|
|
7
|
+
_May 21, 2024_
|
|
8
|
+
|
|
9
|
+
A big thanks to the 7 contributors who made this release possible.
|
|
10
|
+
This release was mostly about 🐛 bug fixes and 📚 documentation improvements.
|
|
11
|
+
|
|
12
|
+
### `@mui/material@6.0.0-alpha.7`
|
|
13
|
+
|
|
14
|
+
- ​<!-- 04 -->[material-ui] Filter only valid theme palette for generating styles (#42147) @siriwatknp
|
|
15
|
+
- ​<!-- 03 -->[material-ui] Remove UMD bundle (#42172) @ZeeshanTamboli
|
|
16
|
+
- ​<!-- 02 -->[material-ui][TextField] Deprecate `*Props` props (#42062) @DiegoAndai
|
|
17
|
+
|
|
18
|
+
### Docs
|
|
19
|
+
|
|
20
|
+
- ​<!-- 08 -->[docs] Remove Base UI from the README (#42307) @danilo-leal
|
|
21
|
+
- ​<!-- 07 -->[docs][material-ui] Fix typo in style interoperability with Tailwind CSS docs (#42279) @ZeeshanTamboli
|
|
22
|
+
- ​<!-- 06 -->[docs][material-ui] Add supported browsers section to migration guide (#42194) @DiegoAndai
|
|
23
|
+
- ​<!-- 05 -->[docs][material-ui][Pagination] Clarify pagination `page` prop API (#42220) @Mandar-Pandya
|
|
24
|
+
|
|
25
|
+
### Core
|
|
26
|
+
|
|
27
|
+
- ​<!-- 12 -->[blog] Update blog post OG image (#42270) @danilo-leal
|
|
28
|
+
- ​<!-- 11 -->[blog] Update Pigment CSS post (#42266) @danilo-leal
|
|
29
|
+
- ​<!-- 10 -->[docs] Remove LocalMonero (#42224) @oliviertassinari
|
|
30
|
+
- ​<!-- 08 -->[docs-infra] Fix keyboard navigation on page tabs (#42152) @danilo-leal
|
|
31
|
+
- ​<!-- 10 -->[code-infra] Remove raw-loader (#42275) @Janpot
|
|
32
|
+
- ​<!-- 09 -->[core] Remove outdated Babel plugins (#42140) @ZeeshanTamboli
|
|
33
|
+
- ​<!-- 12 -->[core] Fix a few more key spread issues (#42168) @oliviertassinari
|
|
34
|
+
- ​<!-- 01 -->[website] Avoid duplicate simple vs. rich (#42100) @oliviertassinari
|
|
35
|
+
|
|
36
|
+
All contributors of this release in alphabetical order: @danilo-leal, @DiegoAndai, @Janpot, @Mandar-Pandya, @oliviertassinari, @siriwatknp, @ZeeshanTamboli
|
|
37
|
+
|
|
38
|
+
## v6.0.0-alpha.7
|
|
39
|
+
|
|
40
|
+
<!-- generated comparing v6.0.0-alpha.6..next -->
|
|
41
|
+
|
|
42
|
+
_May 16, 2024_
|
|
43
|
+
|
|
44
|
+
A big thanks to the 14 contributors who made this release possible.
|
|
45
|
+
|
|
46
|
+
### `@mui/material@6.0.0-alpha.7`
|
|
47
|
+
|
|
48
|
+
- ​<!-- 23 -->[Autocomplete] Deprecate `componentsProps` props (#42179) @lhilgert9
|
|
49
|
+
- ​<!-- 22 -->[Autocomplete] Improve design when there's a start adornment for small autocomplete (#41781) @TahaRhidouani
|
|
50
|
+
- ​<!-- 21 -->[Autocomplete] deprecate `*Component` and `*Props` for v6 (#41875) @lhilgert9
|
|
51
|
+
- ​<!-- 19 -->[CircularProgress] Deprecate composed classes (#42076) @sai6855
|
|
52
|
+
- ​<!-- 05 -->[ToggleButtonGroup] Add missing `selected` class in ToggleButtonGroupClasses type (#42243) @tarunrajput
|
|
53
|
+
|
|
54
|
+
### `@mui/codemod@6.0.0-alpha.6`
|
|
55
|
+
|
|
56
|
+
- ​<!-- 18 -->[Divider] Only apply codemod if light prop is present (#42098) @DiegoAndai
|
|
57
|
+
|
|
58
|
+
### Docs
|
|
59
|
+
|
|
60
|
+
- ​<!-- 13 -->Fix 301 to Figma @oliviertassinari
|
|
61
|
+
- ​<!-- 12 -->Fix use of deprecated React API (#42118) @oliviertassinari
|
|
62
|
+
- ​<!-- 11 -->Remove the Base notification (#42191) @danilo-leal
|
|
63
|
+
- ​<!-- 07 -->[material-ui] Improve descriptions for deprecated props (#42221) @aarongarciah
|
|
64
|
+
- ​<!-- 06 -->[material-ui] Fix typo in composition docs (#42195) @aarongarciah
|
|
65
|
+
|
|
66
|
+
### Core
|
|
67
|
+
|
|
68
|
+
- ​<!-- 20 -->[blog] Introducing Pigment CSS blog post (#42198) @samuelsycamore
|
|
69
|
+
- ​<!-- 17 -->[core] Remove confusing comment @oliviertassinari
|
|
70
|
+
- ​<!-- 16 -->[core] Match other repositories and convention @oliviertassinari
|
|
71
|
+
- ​<!-- 15 -->[core] Fix React 18.3 warnings about spreading keys in the Material UI `Autocomplete` component (#42099) @heath-freenome
|
|
72
|
+
- ​<!-- 14 -->[core] Remove unecessary quotes @oliviertassinari
|
|
73
|
+
- ​<!-- 10 -->[docs-infra] Share code for section title (#42236) @alexfauquette
|
|
74
|
+
- ​<!-- 09 -->[docs-infra] Limit the copy button to the visible code block (#42115) @danilo-leal
|
|
75
|
+
- ​<!-- 08 -->[docs-infra] Make select components with two capital letters (#42004) @alexfauquette
|
|
76
|
+
- ​<!-- 08 -->[docs-infra][toolpad] Fix Page title and SERP title mismatch (#41919) @bharatkashyap
|
|
77
|
+
- ​<!-- 05 -->[website] Add redirection for talk @oliviertassinari
|
|
78
|
+
- ​<!-- 04 -->[website] Adds Arthur Balduini team info (#42193) @arthurbalduini
|
|
79
|
+
- ​<!-- 03 -->[website] Update the role template file (#42192) @danilo-leal
|
|
80
|
+
- ​<!-- 02 -->[website] Update MUI X deps and migrate TreeView demos to v7 API (#42149) @noraleonte
|
|
81
|
+
- ​<!-- 01 -->[website] Fix pricing casing (#42178) @aarongarciah
|
|
82
|
+
|
|
83
|
+
All contributors of this release in alphabetical order: @aarongarciah, @alexfauquette, @arthurbalduini, @bharatkashyap, @danilo-leal, @DiegoAndai, @heath-freenome, @lhilgert9, @noraleonte, @oliviertassinari, @sai6855, @samuelsycamore, @TahaRhidouani, @tarunrajput
|
|
84
|
+
|
|
85
|
+
## v6.0.0-alpha.6
|
|
86
|
+
|
|
87
|
+
<!-- generated comparing v6.0.0-alpha.5..next -->
|
|
88
|
+
|
|
89
|
+
_May 8, 2024_
|
|
90
|
+
|
|
91
|
+
A big thanks to the 10 contributors who made this release possible.
|
|
92
|
+
|
|
93
|
+
### `@mui/material@6.0.0-alpha.6`
|
|
94
|
+
|
|
95
|
+
- [Chip] Add colorDefault class to chipClasses (#42067) @sai6855
|
|
96
|
+
- Migrate components to support CSS extraction (#42001) @siriwatknp
|
|
97
|
+
- [SpeedDial] Deprecate TransitionComponent (#40698) @harry-whorlow
|
|
98
|
+
|
|
99
|
+
### `@mui/codemod@6.0.0-alpha.6`
|
|
100
|
+
|
|
101
|
+
- Add `theme-v6` migration (#42056) @siriwatknp
|
|
102
|
+
|
|
103
|
+
### `@mui/icons-material@6.0.0-alpha.6`
|
|
104
|
+
|
|
105
|
+
- Add the Emergency icon (#42080) @danilo-leal
|
|
106
|
+
|
|
107
|
+
### Docs
|
|
108
|
+
|
|
109
|
+
- [autocomplete] Fix duplicate autocomplete id (#42086) @oliviertassinari
|
|
110
|
+
- Fix SEO redirection issues @oliviertassinari
|
|
111
|
+
- [material-ui] Fix broken link (#42142) @aarongarciah
|
|
112
|
+
- [material-ui][docs] Fix link on the Sync page (#42088) @danilo-leal
|
|
113
|
+
|
|
114
|
+
### Core
|
|
115
|
+
|
|
116
|
+
- [blog] Shorten title to fit @oliviertassinari
|
|
117
|
+
- [blog] Update Sync post OG image (#42114) @danilo-leal
|
|
118
|
+
- [blog] A few tweaks in introducing-sync-plugin (#42092) @oliviertassinari
|
|
119
|
+
- [code-infra] Add canary release scripts (#41949) @michaldudak
|
|
120
|
+
- [code-infra] Move ComponentLinkHeader to @mui/docs (#42061) @Janpot
|
|
121
|
+
- [code-infra] Bump node image used by CI in docker (#42079) @LukasTy
|
|
122
|
+
- [core] Restrict import path with ESLint (#41970) @oliviertassinari
|
|
123
|
+
- [docs-infra] Add design and formatting improvements (#42063) @danilo-leal
|
|
124
|
+
- [docs-infra] Fix HTML structure violations (#42085) @oliviertassinari
|
|
125
|
+
- [website] Componentize a few Careers page sections (#42102) @danilo-leal
|
|
126
|
+
- [website] Refine the InfoCard design (#42116) @danilo-leal
|
|
127
|
+
- [website] Fix home page slider's track position (#42141) @aarongarciah
|
|
128
|
+
- [website] Closing the survey @oliviertassinari
|
|
129
|
+
- [website] Remove Survey banner from website and Core docs (#42104) @joserodolfofreitas
|
|
130
|
+
|
|
131
|
+
All contributors of this release in alphabetical order: @aarongarciah, @danilo-leal, @harry-whorlow, @Janpot, @joserodolfofreitas, @LukasTy, @michaldudak, @oliviertassinari, @sai6855, @siriwatknp
|
|
132
|
+
|
|
3
133
|
## v6.0.0-alpha.5
|
|
4
134
|
|
|
5
135
|
<!-- generated comparing v6.0.0-alpha.4..next -->
|
|
6
136
|
|
|
7
137
|
_May 1, 2024_
|
|
8
138
|
|
|
9
|
-
A big thanks to the 9 contributors who made this release possible.
|
|
139
|
+
A big thanks to the 9 contributors who made this release possible.
|
|
10
140
|
|
|
11
141
|
### `@mui/material@6.0.0-alpha.5`
|
|
12
142
|
|
package/deepmerge/deepmerge.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
// https://github.com/sindresorhus/is-plain-obj/blob/main/index.js
|
|
3
2
|
export function isPlainObject(item) {
|
|
4
3
|
if (typeof item !== 'object' || item === null) {
|
|
@@ -20,7 +19,9 @@ function deepClone(source) {
|
|
|
20
19
|
export default function deepmerge(target, source, options = {
|
|
21
20
|
clone: true
|
|
22
21
|
}) {
|
|
23
|
-
const output = options.clone ?
|
|
22
|
+
const output = options.clone ? {
|
|
23
|
+
...target
|
|
24
|
+
} : target;
|
|
24
25
|
if (isPlainObject(target) && isPlainObject(source)) {
|
|
25
26
|
Object.keys(source).forEach(key => {
|
|
26
27
|
// Avoid prototype pollution
|
package/exactProp/exactProp.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
// This module is based on https://github.com/airbnb/prop-types-exact repository.
|
|
3
2
|
// However, in order to reduce the number of dependencies and to remove some extra safe checks
|
|
4
3
|
// the module was forked.
|
|
@@ -8,7 +7,8 @@ export default function exactProp(propTypes) {
|
|
|
8
7
|
if (process.env.NODE_ENV === 'production') {
|
|
9
8
|
return propTypes;
|
|
10
9
|
}
|
|
11
|
-
return
|
|
10
|
+
return {
|
|
11
|
+
...propTypes,
|
|
12
12
|
[specialProperty]: props => {
|
|
13
13
|
const unsupportedProps = Object.keys(props).filter(prop => !propTypes.hasOwnProperty(prop));
|
|
14
14
|
if (unsupportedProps.length > 0) {
|
|
@@ -16,5 +16,5 @@ export default function exactProp(propTypes) {
|
|
|
16
16
|
}
|
|
17
17
|
return null;
|
|
18
18
|
}
|
|
19
|
-
}
|
|
19
|
+
};
|
|
20
20
|
}
|
package/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
// https://github.com/sindresorhus/is-plain-obj/blob/main/index.js
|
|
3
2
|
export function isPlainObject(item) {
|
|
4
3
|
if (typeof item !== 'object' || item === null) {
|
|
@@ -20,7 +19,9 @@ function deepClone(source) {
|
|
|
20
19
|
export default function deepmerge(target, source, options = {
|
|
21
20
|
clone: true
|
|
22
21
|
}) {
|
|
23
|
-
const output = options.clone ?
|
|
22
|
+
const output = options.clone ? {
|
|
23
|
+
...target
|
|
24
|
+
} : target;
|
|
24
25
|
if (isPlainObject(target) && isPlainObject(source)) {
|
|
25
26
|
Object.keys(source).forEach(key => {
|
|
26
27
|
// Avoid prototype pollution
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
// This module is based on https://github.com/airbnb/prop-types-exact repository.
|
|
3
2
|
// However, in order to reduce the number of dependencies and to remove some extra safe checks
|
|
4
3
|
// the module was forked.
|
|
@@ -8,7 +7,8 @@ export default function exactProp(propTypes) {
|
|
|
8
7
|
if (process.env.NODE_ENV === 'production') {
|
|
9
8
|
return propTypes;
|
|
10
9
|
}
|
|
11
|
-
return
|
|
10
|
+
return {
|
|
11
|
+
...propTypes,
|
|
12
12
|
[specialProperty]: props => {
|
|
13
13
|
const unsupportedProps = Object.keys(props).filter(prop => !propTypes.hasOwnProperty(prop));
|
|
14
14
|
if (unsupportedProps.length > 0) {
|
|
@@ -16,5 +16,5 @@ export default function exactProp(propTypes) {
|
|
|
16
16
|
}
|
|
17
17
|
return null;
|
|
18
18
|
}
|
|
19
|
-
}
|
|
19
|
+
};
|
|
20
20
|
}
|
package/modern/index.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
export default function requirePropFactory(componentNameInError, Component) {
|
|
3
2
|
if (process.env.NODE_ENV === 'production') {
|
|
4
3
|
return () => null;
|
|
5
4
|
}
|
|
6
5
|
|
|
7
6
|
// eslint-disable-next-line react/forbid-foreign-prop-types
|
|
8
|
-
const prevPropTypes = Component ?
|
|
7
|
+
const prevPropTypes = Component ? {
|
|
8
|
+
...Component.propTypes
|
|
9
|
+
} : null;
|
|
9
10
|
const requireProp = requiredProp => (props, propName, componentName, location, propFullName, ...args) => {
|
|
10
11
|
const propFullNameSafe = propFullName || propName;
|
|
11
12
|
const defaultTypeChecker = prevPropTypes?.[propFullNameSafe];
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
/**
|
|
3
2
|
* Add keys, values of `defaultProps` that does not exist in `props`
|
|
4
3
|
* @param {object} defaultProps
|
|
@@ -6,10 +5,15 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
6
5
|
* @returns {object} resolved props
|
|
7
6
|
*/
|
|
8
7
|
export default function resolveProps(defaultProps, props) {
|
|
9
|
-
const output =
|
|
8
|
+
const output = {
|
|
9
|
+
...props
|
|
10
|
+
};
|
|
10
11
|
Object.keys(defaultProps).forEach(propName => {
|
|
11
12
|
if (propName.toString().match(/^(components|slots)$/)) {
|
|
12
|
-
output[propName] =
|
|
13
|
+
output[propName] = {
|
|
14
|
+
...defaultProps[propName],
|
|
15
|
+
...output[propName]
|
|
16
|
+
};
|
|
13
17
|
} else if (propName.toString().match(/^(componentsProps|slotProps)$/)) {
|
|
14
18
|
const defaultSlotProps = defaultProps[propName] || {};
|
|
15
19
|
const slotProps = props[propName];
|
|
@@ -21,7 +25,9 @@ export default function resolveProps(defaultProps, props) {
|
|
|
21
25
|
// Reduce the iteration if the default slot props is empty
|
|
22
26
|
output[propName] = slotProps;
|
|
23
27
|
} else {
|
|
24
|
-
output[propName] =
|
|
28
|
+
output[propName] = {
|
|
29
|
+
...slotProps
|
|
30
|
+
};
|
|
25
31
|
Object.keys(defaultSlotProps).forEach(slotPropName => {
|
|
26
32
|
output[propName][slotPropName] = resolveProps(defaultSlotProps[slotPropName], slotProps[slotPropName]);
|
|
27
33
|
});
|
|
@@ -3,21 +3,11 @@
|
|
|
3
3
|
import useLazyRef from '../useLazyRef/useLazyRef';
|
|
4
4
|
import useOnMount from '../useOnMount/useOnMount';
|
|
5
5
|
export class Timeout {
|
|
6
|
-
constructor() {
|
|
7
|
-
this.currentId = null;
|
|
8
|
-
this.clear = () => {
|
|
9
|
-
if (this.currentId !== null) {
|
|
10
|
-
clearTimeout(this.currentId);
|
|
11
|
-
this.currentId = null;
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
this.disposeEffect = () => {
|
|
15
|
-
return this.clear;
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
6
|
static create() {
|
|
19
7
|
return new Timeout();
|
|
20
8
|
}
|
|
9
|
+
currentId = null;
|
|
10
|
+
|
|
21
11
|
/**
|
|
22
12
|
* Executes `fn` after `delay`, clearing any previously scheduled call.
|
|
23
13
|
*/
|
|
@@ -28,6 +18,15 @@ export class Timeout {
|
|
|
28
18
|
fn();
|
|
29
19
|
}, delay);
|
|
30
20
|
}
|
|
21
|
+
clear = () => {
|
|
22
|
+
if (this.currentId !== null) {
|
|
23
|
+
clearTimeout(this.currentId);
|
|
24
|
+
this.currentId = null;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
disposeEffect = () => {
|
|
28
|
+
return this.clear;
|
|
29
|
+
};
|
|
31
30
|
}
|
|
32
31
|
export default function useTimeout() {
|
|
33
32
|
const timeout = useLazyRef(Timeout.create).current;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.default = deepmerge;
|
|
8
7
|
exports.isPlainObject = isPlainObject;
|
|
9
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
8
|
// https://github.com/sindresorhus/is-plain-obj/blob/main/index.js
|
|
11
9
|
function isPlainObject(item) {
|
|
12
10
|
if (typeof item !== 'object' || item === null) {
|
|
@@ -28,7 +26,9 @@ function deepClone(source) {
|
|
|
28
26
|
function deepmerge(target, source, options = {
|
|
29
27
|
clone: true
|
|
30
28
|
}) {
|
|
31
|
-
const output = options.clone ?
|
|
29
|
+
const output = options.clone ? {
|
|
30
|
+
...target
|
|
31
|
+
} : target;
|
|
32
32
|
if (isPlainObject(target) && isPlainObject(source)) {
|
|
33
33
|
Object.keys(source).forEach(key => {
|
|
34
34
|
// Avoid prototype pollution
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.default = exactProp;
|
|
8
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
7
|
// This module is based on https://github.com/airbnb/prop-types-exact repository.
|
|
10
8
|
// However, in order to reduce the number of dependencies and to remove some extra safe checks
|
|
11
9
|
// the module was forked.
|
|
@@ -15,7 +13,8 @@ function exactProp(propTypes) {
|
|
|
15
13
|
if (process.env.NODE_ENV === 'production') {
|
|
16
14
|
return propTypes;
|
|
17
15
|
}
|
|
18
|
-
return
|
|
16
|
+
return {
|
|
17
|
+
...propTypes,
|
|
19
18
|
[specialProperty]: props => {
|
|
20
19
|
const unsupportedProps = Object.keys(props).filter(prop => !propTypes.hasOwnProperty(prop));
|
|
21
20
|
if (unsupportedProps.length > 0) {
|
|
@@ -23,5 +22,5 @@ function exactProp(propTypes) {
|
|
|
23
22
|
}
|
|
24
23
|
return null;
|
|
25
24
|
}
|
|
26
|
-
}
|
|
25
|
+
};
|
|
27
26
|
}
|
package/node/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.default = requirePropFactory;
|
|
8
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
7
|
function requirePropFactory(componentNameInError, Component) {
|
|
10
8
|
if (process.env.NODE_ENV === 'production') {
|
|
11
9
|
return () => null;
|
|
12
10
|
}
|
|
13
11
|
|
|
14
12
|
// eslint-disable-next-line react/forbid-foreign-prop-types
|
|
15
|
-
const prevPropTypes = Component ?
|
|
13
|
+
const prevPropTypes = Component ? {
|
|
14
|
+
...Component.propTypes
|
|
15
|
+
} : null;
|
|
16
16
|
const requireProp = requiredProp => (props, propName, componentName, location, propFullName, ...args) => {
|
|
17
17
|
const propFullNameSafe = propFullName || propName;
|
|
18
18
|
const defaultTypeChecker = prevPropTypes == null ? void 0 : prevPropTypes[propFullNameSafe];
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.default = resolveProps;
|
|
8
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
7
|
/**
|
|
10
8
|
* Add keys, values of `defaultProps` that does not exist in `props`
|
|
11
9
|
* @param {object} defaultProps
|
|
@@ -13,10 +11,15 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
13
11
|
* @returns {object} resolved props
|
|
14
12
|
*/
|
|
15
13
|
function resolveProps(defaultProps, props) {
|
|
16
|
-
const output =
|
|
14
|
+
const output = {
|
|
15
|
+
...props
|
|
16
|
+
};
|
|
17
17
|
Object.keys(defaultProps).forEach(propName => {
|
|
18
18
|
if (propName.toString().match(/^(components|slots)$/)) {
|
|
19
|
-
output[propName] =
|
|
19
|
+
output[propName] = {
|
|
20
|
+
...defaultProps[propName],
|
|
21
|
+
...output[propName]
|
|
22
|
+
};
|
|
20
23
|
} else if (propName.toString().match(/^(componentsProps|slotProps)$/)) {
|
|
21
24
|
const defaultSlotProps = defaultProps[propName] || {};
|
|
22
25
|
const slotProps = props[propName];
|
|
@@ -28,7 +31,9 @@ function resolveProps(defaultProps, props) {
|
|
|
28
31
|
// Reduce the iteration if the default slot props is empty
|
|
29
32
|
output[propName] = slotProps;
|
|
30
33
|
} else {
|
|
31
|
-
output[propName] =
|
|
34
|
+
output[propName] = {
|
|
35
|
+
...slotProps
|
|
36
|
+
};
|
|
32
37
|
Object.keys(defaultSlotProps).forEach(slotPropName => {
|
|
33
38
|
output[propName][slotPropName] = resolveProps(defaultSlotProps[slotPropName], slotProps[slotPropName]);
|
|
34
39
|
});
|
|
@@ -10,21 +10,11 @@ exports.default = useTimeout;
|
|
|
10
10
|
var _useLazyRef = _interopRequireDefault(require("../useLazyRef/useLazyRef"));
|
|
11
11
|
var _useOnMount = _interopRequireDefault(require("../useOnMount/useOnMount"));
|
|
12
12
|
class Timeout {
|
|
13
|
-
constructor() {
|
|
14
|
-
this.currentId = null;
|
|
15
|
-
this.clear = () => {
|
|
16
|
-
if (this.currentId !== null) {
|
|
17
|
-
clearTimeout(this.currentId);
|
|
18
|
-
this.currentId = null;
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
this.disposeEffect = () => {
|
|
22
|
-
return this.clear;
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
13
|
static create() {
|
|
26
14
|
return new Timeout();
|
|
27
15
|
}
|
|
16
|
+
currentId = null;
|
|
17
|
+
|
|
28
18
|
/**
|
|
29
19
|
* Executes `fn` after `delay`, clearing any previously scheduled call.
|
|
30
20
|
*/
|
|
@@ -35,6 +25,15 @@ class Timeout {
|
|
|
35
25
|
fn();
|
|
36
26
|
}, delay);
|
|
37
27
|
}
|
|
28
|
+
clear = () => {
|
|
29
|
+
if (this.currentId !== null) {
|
|
30
|
+
clearTimeout(this.currentId);
|
|
31
|
+
this.currentId = null;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
disposeEffect = () => {
|
|
35
|
+
return this.clear;
|
|
36
|
+
};
|
|
38
37
|
}
|
|
39
38
|
exports.Timeout = Timeout;
|
|
40
39
|
function useTimeout() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/utils",
|
|
3
|
-
"version": "6.0.0-alpha.
|
|
3
|
+
"version": "6.0.0-alpha.8",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"description": "Utility functions for React components.",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"url": "https://opencollective.com/mui-org"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@babel/runtime": "^7.24.
|
|
29
|
+
"@babel/runtime": "^7.24.5",
|
|
30
30
|
"@types/prop-types": "^15.7.12",
|
|
31
31
|
"prop-types": "^15.8.1",
|
|
32
32
|
"react-is": "^18.2.0"
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
export default function requirePropFactory(componentNameInError, Component) {
|
|
3
2
|
if (process.env.NODE_ENV === 'production') {
|
|
4
3
|
return () => null;
|
|
5
4
|
}
|
|
6
5
|
|
|
7
6
|
// eslint-disable-next-line react/forbid-foreign-prop-types
|
|
8
|
-
const prevPropTypes = Component ?
|
|
7
|
+
const prevPropTypes = Component ? {
|
|
8
|
+
...Component.propTypes
|
|
9
|
+
} : null;
|
|
9
10
|
const requireProp = requiredProp => (props, propName, componentName, location, propFullName, ...args) => {
|
|
10
11
|
const propFullNameSafe = propFullName || propName;
|
|
11
12
|
const defaultTypeChecker = prevPropTypes?.[propFullNameSafe];
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
/**
|
|
3
2
|
* Add keys, values of `defaultProps` that does not exist in `props`
|
|
4
3
|
* @param {object} defaultProps
|
|
@@ -6,10 +5,15 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
6
5
|
* @returns {object} resolved props
|
|
7
6
|
*/
|
|
8
7
|
export default function resolveProps(defaultProps, props) {
|
|
9
|
-
const output =
|
|
8
|
+
const output = {
|
|
9
|
+
...props
|
|
10
|
+
};
|
|
10
11
|
Object.keys(defaultProps).forEach(propName => {
|
|
11
12
|
if (propName.toString().match(/^(components|slots)$/)) {
|
|
12
|
-
output[propName] =
|
|
13
|
+
output[propName] = {
|
|
14
|
+
...defaultProps[propName],
|
|
15
|
+
...output[propName]
|
|
16
|
+
};
|
|
13
17
|
} else if (propName.toString().match(/^(componentsProps|slotProps)$/)) {
|
|
14
18
|
const defaultSlotProps = defaultProps[propName] || {};
|
|
15
19
|
const slotProps = props[propName];
|
|
@@ -21,7 +25,9 @@ export default function resolveProps(defaultProps, props) {
|
|
|
21
25
|
// Reduce the iteration if the default slot props is empty
|
|
22
26
|
output[propName] = slotProps;
|
|
23
27
|
} else {
|
|
24
|
-
output[propName] =
|
|
28
|
+
output[propName] = {
|
|
29
|
+
...slotProps
|
|
30
|
+
};
|
|
25
31
|
Object.keys(defaultSlotProps).forEach(slotPropName => {
|
|
26
32
|
output[propName][slotPropName] = resolveProps(defaultSlotProps[slotPropName], slotProps[slotPropName]);
|
|
27
33
|
});
|
package/useTimeout/useTimeout.js
CHANGED
|
@@ -3,21 +3,11 @@
|
|
|
3
3
|
import useLazyRef from '../useLazyRef/useLazyRef';
|
|
4
4
|
import useOnMount from '../useOnMount/useOnMount';
|
|
5
5
|
export class Timeout {
|
|
6
|
-
constructor() {
|
|
7
|
-
this.currentId = null;
|
|
8
|
-
this.clear = () => {
|
|
9
|
-
if (this.currentId !== null) {
|
|
10
|
-
clearTimeout(this.currentId);
|
|
11
|
-
this.currentId = null;
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
this.disposeEffect = () => {
|
|
15
|
-
return this.clear;
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
6
|
static create() {
|
|
19
7
|
return new Timeout();
|
|
20
8
|
}
|
|
9
|
+
currentId = null;
|
|
10
|
+
|
|
21
11
|
/**
|
|
22
12
|
* Executes `fn` after `delay`, clearing any previously scheduled call.
|
|
23
13
|
*/
|
|
@@ -28,6 +18,15 @@ export class Timeout {
|
|
|
28
18
|
fn();
|
|
29
19
|
}, delay);
|
|
30
20
|
}
|
|
21
|
+
clear = () => {
|
|
22
|
+
if (this.currentId !== null) {
|
|
23
|
+
clearTimeout(this.currentId);
|
|
24
|
+
this.currentId = null;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
disposeEffect = () => {
|
|
28
|
+
return this.clear;
|
|
29
|
+
};
|
|
31
30
|
}
|
|
32
31
|
export default function useTimeout() {
|
|
33
32
|
const timeout = useLazyRef(Timeout.create).current;
|