@mui/codemod 6.4.6 → 6.4.7
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/README.md +15 -0
- package/node/deprecations/all/deprecations-all.js +2 -0
- package/node/deprecations/rating-props/index.js +13 -0
- package/node/deprecations/rating-props/rating-props.js +25 -0
- package/node/deprecations/rating-props/test-cases/actual.js +37 -0
- package/node/deprecations/rating-props/test-cases/expected.js +53 -0
- package/node/deprecations/rating-props/test-cases/theme.actual.js +31 -0
- package/node/deprecations/rating-props/test-cases/theme.expected.js +37 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1605,6 +1605,21 @@ npx @mui/codemod@latest deprecations/popper-props <path>
|
|
|
1605
1605
|
npx @mui/codemod@latest deprecations/outlined-input-props <path>
|
|
1606
1606
|
```
|
|
1607
1607
|
|
|
1608
|
+
#### `rating-props`
|
|
1609
|
+
|
|
1610
|
+
```diff
|
|
1611
|
+
<Snackbar
|
|
1612
|
+
- IconContainerComponent={CustomContainer}
|
|
1613
|
+
+ slots={{
|
|
1614
|
+
+ icon: { component: CustomContainer }
|
|
1615
|
+
+ }}
|
|
1616
|
+
/>
|
|
1617
|
+
```
|
|
1618
|
+
|
|
1619
|
+
```bash
|
|
1620
|
+
npx @mui/codemod@next deprecations/snackbar-props <path>
|
|
1621
|
+
```
|
|
1622
|
+
|
|
1608
1623
|
#### `select-classes`
|
|
1609
1624
|
|
|
1610
1625
|
JS transforms:
|
|
@@ -49,6 +49,7 @@ var _tabsProps = _interopRequireDefault(require("../tabs-props"));
|
|
|
49
49
|
var _tabsClasses = _interopRequireDefault(require("../tabs-classes"));
|
|
50
50
|
var _drawerProps = _interopRequireDefault(require("../drawer-props"));
|
|
51
51
|
var _menuProps = _interopRequireDefault(require("../menu-props"));
|
|
52
|
+
var _ratingProps = _interopRequireDefault(require("../rating-props"));
|
|
52
53
|
/**
|
|
53
54
|
* @param {import('jscodeshift').FileInfo} file
|
|
54
55
|
* @param {import('jscodeshift').API} api
|
|
@@ -98,5 +99,6 @@ function deprecationsAll(file, api, options) {
|
|
|
98
99
|
file.source = (0, _tabsClasses.default)(file, api, options);
|
|
99
100
|
file.source = (0, _drawerProps.default)(file, api, options);
|
|
100
101
|
file.source = (0, _menuProps.default)(file, api, options);
|
|
102
|
+
file.source = (0, _ratingProps.default)(file, api, options);
|
|
101
103
|
return file.source;
|
|
102
104
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
Object.defineProperty(exports, "default", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _ratingProps.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
var _ratingProps = _interopRequireDefault(require("./rating-props"));
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = transformer;
|
|
8
|
+
var _movePropIntoSlotProps = _interopRequireDefault(require("../utils/movePropIntoSlotProps"));
|
|
9
|
+
/**
|
|
10
|
+
* @param {import('jscodeshift').FileInfo} file
|
|
11
|
+
* @param {import('jscodeshift').API} api
|
|
12
|
+
*/
|
|
13
|
+
function transformer(file, api, options) {
|
|
14
|
+
const j = api.jscodeshift;
|
|
15
|
+
const root = j(file.source);
|
|
16
|
+
const printOptions = options.printOptions;
|
|
17
|
+
(0, _movePropIntoSlotProps.default)(j, {
|
|
18
|
+
root,
|
|
19
|
+
componentName: 'Rating',
|
|
20
|
+
propName: 'IconContainerComponent',
|
|
21
|
+
slotName: 'icon',
|
|
22
|
+
slotPropName: 'component'
|
|
23
|
+
});
|
|
24
|
+
return root.toSource(printOptions);
|
|
25
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _Rating = _interopRequireDefault(require("@mui/material/Rating"));
|
|
5
|
+
var _material = require("@mui/material");
|
|
6
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
7
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Rating.default, {
|
|
8
|
+
IconContainerComponent: CustomIconContainer
|
|
9
|
+
});
|
|
10
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Rating, {
|
|
11
|
+
IconContainerComponent: CustomIconContainer
|
|
12
|
+
});
|
|
13
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Rating.default, {
|
|
14
|
+
IconContainerComponent: CustomIconContainer,
|
|
15
|
+
slots: {
|
|
16
|
+
root: 'div'
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Rating, {
|
|
20
|
+
IconContainerComponent: CustomIconContainer,
|
|
21
|
+
slots: {
|
|
22
|
+
...outerSlots
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Rating.default, {
|
|
26
|
+
IconContainerComponent: CustomIconContainer,
|
|
27
|
+
slotProps: {
|
|
28
|
+
icon: {
|
|
29
|
+
id: 'my-rating-icon'
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// should skip non MUI components
|
|
35
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(NonMuiRating, {
|
|
36
|
+
IconContainerComponent: CustomIconContainer
|
|
37
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _Rating = _interopRequireDefault(require("@mui/material/Rating"));
|
|
5
|
+
var _material = require("@mui/material");
|
|
6
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
7
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Rating.default, {
|
|
8
|
+
slotProps: {
|
|
9
|
+
icon: {
|
|
10
|
+
component: CustomIconContainer
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Rating, {
|
|
15
|
+
slotProps: {
|
|
16
|
+
icon: {
|
|
17
|
+
component: CustomIconContainer
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Rating.default, {
|
|
22
|
+
slots: {
|
|
23
|
+
root: 'div'
|
|
24
|
+
},
|
|
25
|
+
slotProps: {
|
|
26
|
+
icon: {
|
|
27
|
+
component: CustomIconContainer
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Rating, {
|
|
32
|
+
slots: {
|
|
33
|
+
...outerSlots
|
|
34
|
+
},
|
|
35
|
+
slotProps: {
|
|
36
|
+
icon: {
|
|
37
|
+
component: CustomIconContainer
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Rating.default, {
|
|
42
|
+
slotProps: {
|
|
43
|
+
icon: {
|
|
44
|
+
id: 'my-rating-icon',
|
|
45
|
+
component: CustomIconContainer
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
// should skip non MUI components
|
|
51
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(NonMuiRating, {
|
|
52
|
+
IconContainerComponent: CustomIconContainer
|
|
53
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
fn({
|
|
4
|
+
MuiRating: {
|
|
5
|
+
defaultProps: {
|
|
6
|
+
IconContainerComponent: CustomContainer
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
fn({
|
|
11
|
+
MuiRating: {
|
|
12
|
+
defaultProps: {
|
|
13
|
+
IconContainerComponent: CustomContainer,
|
|
14
|
+
slotProps: {
|
|
15
|
+
root: {}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
fn({
|
|
21
|
+
MuiRating: {
|
|
22
|
+
defaultProps: {
|
|
23
|
+
IconContainerComponent: CustomContainer,
|
|
24
|
+
slotProps: {
|
|
25
|
+
icon: {
|
|
26
|
+
id: 'my-rating-icon'
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
fn({
|
|
4
|
+
MuiRating: {
|
|
5
|
+
defaultProps: {
|
|
6
|
+
slotProps: {
|
|
7
|
+
icon: {
|
|
8
|
+
component: CustomContainer
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
fn({
|
|
15
|
+
MuiRating: {
|
|
16
|
+
defaultProps: {
|
|
17
|
+
slotProps: {
|
|
18
|
+
root: {},
|
|
19
|
+
icon: {
|
|
20
|
+
component: CustomContainer
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
fn({
|
|
27
|
+
MuiRating: {
|
|
28
|
+
defaultProps: {
|
|
29
|
+
slotProps: {
|
|
30
|
+
icon: {
|
|
31
|
+
id: 'my-rating-icon',
|
|
32
|
+
component: CustomContainer
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
});
|