@mui/codemod 5.15.12 → 5.15.13
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/node/deprecations/alert-props/test-cases/actual.js +17 -0
- package/node/deprecations/alert-props/test-cases/expected.js +12 -1
- package/node/deprecations/alert-props/test-cases/theme.actual.js +21 -0
- package/node/deprecations/alert-props/test-cases/theme.expected.js +17 -1
- package/node/deprecations/slider-props/test-cases/actual.js +17 -0
- package/node/deprecations/slider-props/test-cases/expected.js +12 -1
- package/node/deprecations/slider-props/test-cases/theme.actual.js +21 -0
- package/node/deprecations/slider-props/test-cases/theme.expected.js +17 -1
- package/node/deprecations/utils/replaceComponentsWithSlots.js +11 -1
- package/package.json +1 -1
|
@@ -40,4 +40,21 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
40
40
|
componentsProps: {
|
|
41
41
|
closeButton: componentsButtonProps
|
|
42
42
|
}
|
|
43
|
+
});
|
|
44
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Alert.default, {
|
|
45
|
+
slots: {
|
|
46
|
+
closeIcon: SlotsIcon,
|
|
47
|
+
closeButton: SlotsButton
|
|
48
|
+
},
|
|
49
|
+
components: {
|
|
50
|
+
CloseButton: ComponentsButton
|
|
51
|
+
},
|
|
52
|
+
slotProps: {
|
|
53
|
+
closeIcon: slotsIconProps,
|
|
54
|
+
closeButton: slotsButtonProps
|
|
55
|
+
},
|
|
56
|
+
componentsProps: {
|
|
57
|
+
closeButton: componentsButtonProps,
|
|
58
|
+
closeIcon: componentsIconProps
|
|
59
|
+
}
|
|
43
60
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
4
5
|
var _Alert = _interopRequireDefault(require("@mui/material/Alert"));
|
|
5
6
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
6
7
|
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Alert.default, {
|
|
@@ -28,6 +29,16 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
28
29
|
},
|
|
29
30
|
slotProps: {
|
|
30
31
|
closeIcon: slotsIconProps,
|
|
31
|
-
closeButton: slotsButtonProps
|
|
32
|
+
closeButton: (0, _extends2.default)({}, componentsButtonProps, slotsButtonProps)
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Alert.default, {
|
|
36
|
+
slots: {
|
|
37
|
+
closeIcon: SlotsIcon,
|
|
38
|
+
closeButton: SlotsButton
|
|
39
|
+
},
|
|
40
|
+
slotProps: {
|
|
41
|
+
closeButton: (0, _extends2.default)({}, componentsButtonProps, slotsButtonProps),
|
|
42
|
+
closeIcon: (0, _extends2.default)({}, componentsIconProps, slotsIconProps)
|
|
32
43
|
}
|
|
33
44
|
});
|
|
@@ -49,4 +49,25 @@ fn({
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
+
});
|
|
53
|
+
fn({
|
|
54
|
+
MuiAlert: {
|
|
55
|
+
defaultProps: {
|
|
56
|
+
components: {
|
|
57
|
+
CloseButton: ComponentsButton
|
|
58
|
+
},
|
|
59
|
+
slots: {
|
|
60
|
+
closeIcon: SlotsIcon,
|
|
61
|
+
closeButton: SlotsButton
|
|
62
|
+
},
|
|
63
|
+
componentsProps: {
|
|
64
|
+
closeButton: componentsButtonProps,
|
|
65
|
+
closeIcon: componentsIconProps
|
|
66
|
+
},
|
|
67
|
+
slotProps: {
|
|
68
|
+
closeIcon: slotsIconProps,
|
|
69
|
+
closeButton: slotsButtonProps
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
52
73
|
});
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
3
5
|
fn({
|
|
4
6
|
MuiAlert: {
|
|
5
7
|
defaultProps: {
|
|
@@ -34,9 +36,23 @@ fn({
|
|
|
34
36
|
closeIcon: SlotsIcon
|
|
35
37
|
},
|
|
36
38
|
slotProps: {
|
|
37
|
-
closeButton: slotsButtonProps,
|
|
39
|
+
closeButton: (0, _extends2.default)({}, componentsButtonProps, slotsButtonProps),
|
|
38
40
|
closeIcon: slotsIconProps
|
|
39
41
|
}
|
|
40
42
|
}
|
|
41
43
|
}
|
|
44
|
+
});
|
|
45
|
+
fn({
|
|
46
|
+
MuiAlert: {
|
|
47
|
+
defaultProps: {
|
|
48
|
+
slots: {
|
|
49
|
+
closeButton: SlotsButton,
|
|
50
|
+
closeIcon: SlotsIcon
|
|
51
|
+
},
|
|
52
|
+
slotProps: {
|
|
53
|
+
closeButton: (0, _extends2.default)({}, componentsButtonProps, slotsButtonProps),
|
|
54
|
+
closeIcon: (0, _extends2.default)({}, componentsIconProps, slotsIconProps)
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
42
58
|
});
|
|
@@ -40,4 +40,21 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
40
40
|
componentsProps: {
|
|
41
41
|
track: componentsTrackProps
|
|
42
42
|
}
|
|
43
|
+
});
|
|
44
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Slider.default, {
|
|
45
|
+
slots: {
|
|
46
|
+
rail: SlotsRail,
|
|
47
|
+
track: SlotsTrack
|
|
48
|
+
},
|
|
49
|
+
components: {
|
|
50
|
+
Track: ComponentsTrack
|
|
51
|
+
},
|
|
52
|
+
slotProps: {
|
|
53
|
+
rail: slotsRailProps,
|
|
54
|
+
track: slotsTrackProps
|
|
55
|
+
},
|
|
56
|
+
componentsProps: {
|
|
57
|
+
track: componentsTrackProps,
|
|
58
|
+
rail: componentsRailProps
|
|
59
|
+
}
|
|
43
60
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
4
5
|
var _Slider = _interopRequireDefault(require("@mui/material/Slider"));
|
|
5
6
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
6
7
|
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Slider.default, {
|
|
@@ -28,6 +29,16 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
28
29
|
},
|
|
29
30
|
slotProps: {
|
|
30
31
|
rail: slotsRailProps,
|
|
31
|
-
track: slotsTrackProps
|
|
32
|
+
track: (0, _extends2.default)({}, componentsTrackProps, slotsTrackProps)
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Slider.default, {
|
|
36
|
+
slots: {
|
|
37
|
+
rail: SlotsRail,
|
|
38
|
+
track: SlotsTrack
|
|
39
|
+
},
|
|
40
|
+
slotProps: {
|
|
41
|
+
track: (0, _extends2.default)({}, componentsTrackProps, slotsTrackProps),
|
|
42
|
+
rail: (0, _extends2.default)({}, componentsRailProps, slotsRailProps)
|
|
32
43
|
}
|
|
33
44
|
});
|
|
@@ -49,4 +49,25 @@ fn({
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
+
});
|
|
53
|
+
fn({
|
|
54
|
+
MuiSlider: {
|
|
55
|
+
defaultProps: {
|
|
56
|
+
components: {
|
|
57
|
+
Track: ComponentsTrack
|
|
58
|
+
},
|
|
59
|
+
slots: {
|
|
60
|
+
rail: SlotsRail,
|
|
61
|
+
track: SlotsTrack
|
|
62
|
+
},
|
|
63
|
+
componentsProps: {
|
|
64
|
+
track: componentsTrackProps,
|
|
65
|
+
rail: componentsRailProps
|
|
66
|
+
},
|
|
67
|
+
slotProps: {
|
|
68
|
+
rail: slotsRailProps,
|
|
69
|
+
track: slotsTrackProps
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
52
73
|
});
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
3
5
|
fn({
|
|
4
6
|
MuiSlider: {
|
|
5
7
|
defaultProps: {
|
|
@@ -34,9 +36,23 @@ fn({
|
|
|
34
36
|
rail: SlotsRail
|
|
35
37
|
},
|
|
36
38
|
slotProps: {
|
|
37
|
-
track: slotsTrackProps,
|
|
39
|
+
track: (0, _extends2.default)({}, componentsTrackProps, slotsTrackProps),
|
|
38
40
|
rail: slotsRailProps
|
|
39
41
|
}
|
|
40
42
|
}
|
|
41
43
|
}
|
|
44
|
+
});
|
|
45
|
+
fn({
|
|
46
|
+
MuiSlider: {
|
|
47
|
+
defaultProps: {
|
|
48
|
+
slots: {
|
|
49
|
+
track: SlotsTrack,
|
|
50
|
+
rail: SlotsRail
|
|
51
|
+
},
|
|
52
|
+
slotProps: {
|
|
53
|
+
track: (0, _extends2.default)({}, componentsTrackProps, slotsTrackProps),
|
|
54
|
+
rail: (0, _extends2.default)({}, componentsRailProps, slotsRailProps)
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
42
58
|
});
|
|
@@ -76,6 +76,16 @@ function replaceJsxComponentsPropsProp(j, element) {
|
|
|
76
76
|
key: prop.key.name,
|
|
77
77
|
expression: prop.value
|
|
78
78
|
});
|
|
79
|
+
} else {
|
|
80
|
+
attr.value.expression.properties = attr.value.expression.properties.filter(p => {
|
|
81
|
+
var _p$key;
|
|
82
|
+
return (p == null || (_p$key = p.key) == null ? void 0 : _p$key.name) !== prop.key.name;
|
|
83
|
+
});
|
|
84
|
+
(0, _assignObject.default)(j, {
|
|
85
|
+
target: attr,
|
|
86
|
+
key: prop.key.name,
|
|
87
|
+
expression: j.objectExpression([j.spreadElement(prop.value), j.spreadElement(slotProps[prop.key.name])])
|
|
88
|
+
});
|
|
79
89
|
}
|
|
80
90
|
});
|
|
81
91
|
}
|
|
@@ -137,7 +147,7 @@ function replaceDefaultPropsComponentsPropsProp(j, defaultPropsPathCollection) {
|
|
|
137
147
|
const existingSlots = defaultPropsProperties.find(prop => prop.key.name === 'slotProps');
|
|
138
148
|
const slots = existingSlots ? existingSlots.value.properties.reduce((acc, prop) => {
|
|
139
149
|
return (0, _extends2.default)({}, acc, {
|
|
140
|
-
[prop.key.name]: prop.value
|
|
150
|
+
[prop.key.name]: components[prop.key.name] ? j.objectExpression([j.spreadElement(components[prop.key.name]), j.spreadElement(prop.value)]) : prop.value
|
|
141
151
|
});
|
|
142
152
|
}, {}) : {};
|
|
143
153
|
const updatedSlots = j.objectExpression(Object.entries((0, _extends2.default)({}, components, slots)).map(([slot, value]) => {
|