@mui/utils 7.1.1 → 7.2.0
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 +81 -0
- package/esm/index.js +1 -1
- package/esm/resolveProps/resolveProps.d.ts +6 -1
- package/esm/resolveProps/resolveProps.js +14 -2
- package/index.js +1 -1
- package/package.json +4 -4
- package/resolveProps/resolveProps.d.ts +6 -1
- package/resolveProps/resolveProps.js +14 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,86 @@
|
|
|
1
1
|
# [Versions](https://mui.com/versions/)
|
|
2
2
|
|
|
3
|
+
## 7.2.0
|
|
4
|
+
|
|
5
|
+
<!-- generated comparing v7.1.1..master -->
|
|
6
|
+
|
|
7
|
+
_Jun 26, 2025_
|
|
8
|
+
|
|
9
|
+
A big thanks to the 17 contributors who made this release possible. Here are the highlights ✨:
|
|
10
|
+
|
|
11
|
+
- ⚡️ Added `modularCssLayers` theme option for splitting styles into multiple CSS layers (#46001) @siriwatknp.
|
|
12
|
+
- 📖 Added example for using Material UI with React Router v7 (#46406) @siriwatknp.
|
|
13
|
+
|
|
14
|
+
### `@mui/material@7.2.0`
|
|
15
|
+
|
|
16
|
+
- [Backdrop] Fix handling of `component` prop (#46269) @sai6855
|
|
17
|
+
- [Chip] Explicitly define line-height (#46260) @DiegoAndai
|
|
18
|
+
- [Chip] Fix handling on event handlers (#46263) @sai6855
|
|
19
|
+
- [OutlinedInput][Input] Deprecate composed classes (#46316) @sai6855
|
|
20
|
+
- [Select] Pass MenuProps.slotProps.list alongside MenuListProps (#46274) @scousino
|
|
21
|
+
- [l10] Enable `labelDisplayedRows` translation for Romanian (#46377) @dhu-redwoodtech
|
|
22
|
+
- Skip generating `modularCssLayers` CSS var (#46329) @siriwatknp
|
|
23
|
+
|
|
24
|
+
### `@mui/system@7.2.0`
|
|
25
|
+
|
|
26
|
+
- Add `modularCssLayers` theme flag to split styles into multiple CSS layers (#46001) @siriwatknp
|
|
27
|
+
|
|
28
|
+
### `@mui/styled-engine@7.2.0`
|
|
29
|
+
|
|
30
|
+
- Do not reuse the emotion cache across SSR requests (#46276) @robbtraister
|
|
31
|
+
|
|
32
|
+
### `@mui/codemod@7.2.0`
|
|
33
|
+
|
|
34
|
+
- [Dialog] Add codemod for deprecated props (#46328) @sai6855
|
|
35
|
+
|
|
36
|
+
### Docs
|
|
37
|
+
|
|
38
|
+
- Don't forward `hasAiSuggestion` (#46415) @bharatkashyap
|
|
39
|
+
- Add introduction to MCP (#46224) @bharatkashyap
|
|
40
|
+
- Fallback for searchbar during SSR (#46364) @Janpot
|
|
41
|
+
- Update InitColorSchemeScript options to match colorSchemeSelector (#46302) @humble-barnacle001
|
|
42
|
+
- Add `ListItemButton` to make the deprecation clear (#46356) @siriwatknp
|
|
43
|
+
- Remove "Unstyled" section from component docs (#46272) @mapache-salvaje
|
|
44
|
+
- Add Testing section to Rating component doc (#46268) @0210shivam
|
|
45
|
+
- Fix fade modal demo (#46271) @brijeshb42
|
|
46
|
+
- [ai] Add suggestions to edit with MUI Chat (#46309) @bharatkashyap
|
|
47
|
+
- [Dialog] Fix form dialog uses ARIA roles on incompatible elements (#46307) @ZeeshanTamboli
|
|
48
|
+
- [Menu] Fix dark mode styling of grouped header demo (#46317) @sai6855
|
|
49
|
+
- [TextField] Removed type="number" demos (#46314) @KirankumarAmbati
|
|
50
|
+
- [examples] Add `material-ui-react-router-ts` example (#46406) @siriwatknp
|
|
51
|
+
|
|
52
|
+
### Core
|
|
53
|
+
|
|
54
|
+
- pnpm docs:sync-team (3641a0b) @oliviertassinari
|
|
55
|
+
- Add cross-env to eslint script (#46358) @ZeeshanTamboli
|
|
56
|
+
- Support merging of className and style from theme (#45975) @sai6855
|
|
57
|
+
- [code-infra] Create bundle size package (#45911) @Janpot
|
|
58
|
+
- [docs-infra] Add a script to generate Material UI `llms.txt` and docs markdown. (#46308) @siriwatknp
|
|
59
|
+
- [docs-infra] Fix stackblitz for js projects (#46220) @Janpot
|
|
60
|
+
- [infra] Add emotion as external for bundle monitor (#46372) @Janpot
|
|
61
|
+
- [infra] Create update PR on every canary publish for internal packages (#46367) @Janpot
|
|
62
|
+
- [infra] Remove deprecated esmExternals (#46365) @Janpot
|
|
63
|
+
- [infra] Support project-specific changelog in build scripts (#46425) @michaldudak
|
|
64
|
+
- [toolpad][website] Remove references to Toolpad (#46311) @prakhargupta1
|
|
65
|
+
|
|
66
|
+
All contributors of this release in alphabetical order: @0210shivam, @bharatkashyap, @brijeshb42, @dhu-redwoodtech, @DiegoAndai, @humble-barnacle001, @Janpot, @KirankumarAmbati, @mapache-salvaje, @michaldudak, @oliviertassinari, @prakhargupta1, @robbtraister, @sai6855, @scousino, @siriwatknp, @ZeeshanTamboli
|
|
67
|
+
|
|
68
|
+
## 7.1.2
|
|
69
|
+
|
|
70
|
+
_Jun 18, 2025_
|
|
71
|
+
|
|
72
|
+
A big thanks to the 2 contributors who made this release possible.
|
|
73
|
+
|
|
74
|
+
### `@mui/material@7.1.2`
|
|
75
|
+
|
|
76
|
+
- [Chip] Fix handling on event handlers (#46263) @sai6855
|
|
77
|
+
|
|
78
|
+
### Docs
|
|
79
|
+
|
|
80
|
+
- Fix fade modal demo (#46271) @brijeshb42
|
|
81
|
+
|
|
82
|
+
All contributors of this release in alphabetical order: @brijeshb42, @sai6855
|
|
83
|
+
|
|
3
84
|
## 7.1.1
|
|
4
85
|
|
|
5
86
|
<!-- generated comparing v7.1.0..master -->
|
package/esm/index.js
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
* Add keys, values of `defaultProps` that does not exist in `props`
|
|
3
3
|
* @param defaultProps
|
|
4
4
|
* @param props
|
|
5
|
+
* @param mergeClassNameAndStyle If `true`, merges `className` and `style` props instead of overriding them.
|
|
6
|
+
* When `false` (default), props override defaultProps. When `true`, `className` values are concatenated
|
|
7
|
+
* and `style` objects are merged with props taking precedence.
|
|
5
8
|
* @returns resolved props
|
|
6
9
|
*/
|
|
7
10
|
export default function resolveProps<T extends {
|
|
@@ -9,4 +12,6 @@ export default function resolveProps<T extends {
|
|
|
9
12
|
componentsProps?: Record<string, unknown>;
|
|
10
13
|
slots?: Record<string, unknown>;
|
|
11
14
|
slotProps?: Record<string, unknown>;
|
|
12
|
-
|
|
15
|
+
className?: string;
|
|
16
|
+
style?: React.CSSProperties;
|
|
17
|
+
} & Record<string, unknown>>(defaultProps: T, props: T, mergeClassNameAndStyle?: boolean): T;
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
+
import clsx from 'clsx';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Add keys, values of `defaultProps` that does not exist in `props`
|
|
3
5
|
* @param defaultProps
|
|
4
6
|
* @param props
|
|
7
|
+
* @param mergeClassNameAndStyle If `true`, merges `className` and `style` props instead of overriding them.
|
|
8
|
+
* When `false` (default), props override defaultProps. When `true`, `className` values are concatenated
|
|
9
|
+
* and `style` objects are merged with props taking precedence.
|
|
5
10
|
* @returns resolved props
|
|
6
11
|
*/
|
|
7
|
-
export default function resolveProps(defaultProps, props) {
|
|
12
|
+
export default function resolveProps(defaultProps, props, mergeClassNameAndStyle = false) {
|
|
8
13
|
const output = {
|
|
9
14
|
...props
|
|
10
15
|
};
|
|
@@ -30,10 +35,17 @@ export default function resolveProps(defaultProps, props) {
|
|
|
30
35
|
for (const slotKey in defaultSlotProps) {
|
|
31
36
|
if (Object.prototype.hasOwnProperty.call(defaultSlotProps, slotKey)) {
|
|
32
37
|
const slotPropName = slotKey;
|
|
33
|
-
output[propName][slotPropName] = resolveProps(defaultSlotProps[slotPropName], slotProps[slotPropName]);
|
|
38
|
+
output[propName][slotPropName] = resolveProps(defaultSlotProps[slotPropName], slotProps[slotPropName], mergeClassNameAndStyle);
|
|
34
39
|
}
|
|
35
40
|
}
|
|
36
41
|
}
|
|
42
|
+
} else if (propName === 'className' && mergeClassNameAndStyle && props.className) {
|
|
43
|
+
output.className = clsx(defaultProps?.className, props?.className);
|
|
44
|
+
} else if (propName === 'style' && mergeClassNameAndStyle && props.style) {
|
|
45
|
+
output.style = {
|
|
46
|
+
...defaultProps?.style,
|
|
47
|
+
...props?.style
|
|
48
|
+
};
|
|
37
49
|
} else if (output[propName] === undefined) {
|
|
38
50
|
output[propName] = defaultProps[propName];
|
|
39
51
|
}
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/utils",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.2.0",
|
|
4
4
|
"author": "MUI Team",
|
|
5
5
|
"description": "Utility functions for React components.",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
"url": "https://opencollective.com/mui-org"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@babel/runtime": "^7.27.
|
|
29
|
-
"@types/prop-types": "^15.7.
|
|
28
|
+
"@babel/runtime": "^7.27.6",
|
|
29
|
+
"@types/prop-types": "^15.7.15",
|
|
30
30
|
"clsx": "^2.1.1",
|
|
31
31
|
"prop-types": "^15.8.1",
|
|
32
32
|
"react-is": "^19.1.0",
|
|
33
|
-
"@mui/types": "^7.4.
|
|
33
|
+
"@mui/types": "^7.4.4"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
* Add keys, values of `defaultProps` that does not exist in `props`
|
|
3
3
|
* @param defaultProps
|
|
4
4
|
* @param props
|
|
5
|
+
* @param mergeClassNameAndStyle If `true`, merges `className` and `style` props instead of overriding them.
|
|
6
|
+
* When `false` (default), props override defaultProps. When `true`, `className` values are concatenated
|
|
7
|
+
* and `style` objects are merged with props taking precedence.
|
|
5
8
|
* @returns resolved props
|
|
6
9
|
*/
|
|
7
10
|
export default function resolveProps<T extends {
|
|
@@ -9,4 +12,6 @@ export default function resolveProps<T extends {
|
|
|
9
12
|
componentsProps?: Record<string, unknown>;
|
|
10
13
|
slots?: Record<string, unknown>;
|
|
11
14
|
slotProps?: Record<string, unknown>;
|
|
12
|
-
|
|
15
|
+
className?: string;
|
|
16
|
+
style?: React.CSSProperties;
|
|
17
|
+
} & Record<string, unknown>>(defaultProps: T, props: T, mergeClassNameAndStyle?: boolean): T;
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.default = resolveProps;
|
|
8
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
7
9
|
/**
|
|
8
10
|
* Add keys, values of `defaultProps` that does not exist in `props`
|
|
9
11
|
* @param defaultProps
|
|
10
12
|
* @param props
|
|
13
|
+
* @param mergeClassNameAndStyle If `true`, merges `className` and `style` props instead of overriding them.
|
|
14
|
+
* When `false` (default), props override defaultProps. When `true`, `className` values are concatenated
|
|
15
|
+
* and `style` objects are merged with props taking precedence.
|
|
11
16
|
* @returns resolved props
|
|
12
17
|
*/
|
|
13
|
-
function resolveProps(defaultProps, props) {
|
|
18
|
+
function resolveProps(defaultProps, props, mergeClassNameAndStyle = false) {
|
|
14
19
|
const output = {
|
|
15
20
|
...props
|
|
16
21
|
};
|
|
@@ -36,10 +41,17 @@ function resolveProps(defaultProps, props) {
|
|
|
36
41
|
for (const slotKey in defaultSlotProps) {
|
|
37
42
|
if (Object.prototype.hasOwnProperty.call(defaultSlotProps, slotKey)) {
|
|
38
43
|
const slotPropName = slotKey;
|
|
39
|
-
output[propName][slotPropName] = resolveProps(defaultSlotProps[slotPropName], slotProps[slotPropName]);
|
|
44
|
+
output[propName][slotPropName] = resolveProps(defaultSlotProps[slotPropName], slotProps[slotPropName], mergeClassNameAndStyle);
|
|
40
45
|
}
|
|
41
46
|
}
|
|
42
47
|
}
|
|
48
|
+
} else if (propName === 'className' && mergeClassNameAndStyle && props.className) {
|
|
49
|
+
output.className = (0, _clsx.default)(defaultProps?.className, props?.className);
|
|
50
|
+
} else if (propName === 'style' && mergeClassNameAndStyle && props.style) {
|
|
51
|
+
output.style = {
|
|
52
|
+
...defaultProps?.style,
|
|
53
|
+
...props?.style
|
|
54
|
+
};
|
|
43
55
|
} else if (output[propName] === undefined) {
|
|
44
56
|
output[propName] = defaultProps[propName];
|
|
45
57
|
}
|