@mui/codemod 6.1.9 → 6.3.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/README.md +41 -0
- package/node/deprecations/all/deprecations-all.js +6 -0
- package/node/deprecations/list-item-text-props/index.js +13 -0
- package/node/deprecations/list-item-text-props/list-item-text-props.js +35 -0
- package/node/deprecations/list-item-text-props/test-cases/actual.js +21 -0
- package/node/deprecations/list-item-text-props/test-cases/expected.js +27 -0
- package/node/deprecations/list-item-text-props/test-cases/theme.actual.js +34 -0
- package/node/deprecations/list-item-text-props/test-cases/theme.expected.js +40 -0
- package/node/deprecations/step-content-props/index.js +13 -0
- package/node/deprecations/step-content-props/step-content-props.js +31 -0
- package/node/deprecations/step-content-props/test-cases/actual.js +65 -0
- package/node/deprecations/step-content-props/test-cases/expected.js +74 -0
- package/node/deprecations/step-content-props/test-cases/theme.actual.js +36 -0
- package/node/deprecations/step-content-props/test-cases/theme.expected.js +41 -0
- package/node/deprecations/table-pagination-props/index.js +13 -0
- package/node/deprecations/table-pagination-props/table-pagination-props.js +31 -0
- package/node/deprecations/table-pagination-props/test-cases/actual.js +62 -0
- package/node/deprecations/table-pagination-props/test-cases/expected.js +72 -0
- package/node/deprecations/table-pagination-props/test-cases/theme.actual.js +30 -0
- package/node/deprecations/table-pagination-props/test-cases/theme.expected.js +34 -0
- package/node/deprecations/utils/movePropIntoSlots.js +2 -1
- package/node/v5.0.0/root-ref.js +3 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1107,6 +1107,32 @@ npx @mui/codemod@latest deprecations/form-control-label-props <path>
|
|
|
1107
1107
|
npx @mui/codemod@latest deprecations/list-item-props <path>
|
|
1108
1108
|
```
|
|
1109
1109
|
|
|
1110
|
+
#### `list-item-text-props`
|
|
1111
|
+
|
|
1112
|
+
```diff
|
|
1113
|
+
<ListItemText
|
|
1114
|
+
- primaryTypographyProps={primaryTypographyProps}
|
|
1115
|
+
+ slotProps={{ primary: primaryTypographyProps }}
|
|
1116
|
+
- secondaryTypographyProps={secondaryTypographyProps}
|
|
1117
|
+
+ slotProps={{ secondary: secondaryTypographyProps }}
|
|
1118
|
+
/>
|
|
1119
|
+
```
|
|
1120
|
+
|
|
1121
|
+
```diff
|
|
1122
|
+
MuiListItemText: {
|
|
1123
|
+
defaultProps: {
|
|
1124
|
+
- primaryTypographyProps:primaryTypographyProps
|
|
1125
|
+
+ slotProps:{ primary: primaryTypographyProps }
|
|
1126
|
+
- secondaryTypographyProps:secondaryTypographyProps
|
|
1127
|
+
+ slotProps:{ secondary: secondaryTypographyProps }
|
|
1128
|
+
},
|
|
1129
|
+
},
|
|
1130
|
+
```
|
|
1131
|
+
|
|
1132
|
+
```bash
|
|
1133
|
+
npx @mui/codemod@latest deprecations/list-item-text-props <path>
|
|
1134
|
+
```
|
|
1135
|
+
|
|
1110
1136
|
#### `image-list-item-bar-classes`
|
|
1111
1137
|
|
|
1112
1138
|
JS transforms:
|
|
@@ -1483,6 +1509,21 @@ JS transforms:
|
|
|
1483
1509
|
npx @mui/codemod@next deprecations/step-connector-classes <path>
|
|
1484
1510
|
```
|
|
1485
1511
|
|
|
1512
|
+
#### `step-content-props`
|
|
1513
|
+
|
|
1514
|
+
```diff
|
|
1515
|
+
<StepContent
|
|
1516
|
+
- TransitionComponent={CustomTransition}
|
|
1517
|
+
- TransitionProps={{ unmountOnExit: true }}
|
|
1518
|
+
+ slots={{ transition: CustomTransition }}
|
|
1519
|
+
+ slotProps={{ transition: { unmountOnExit: true } }}
|
|
1520
|
+
/>
|
|
1521
|
+
```
|
|
1522
|
+
|
|
1523
|
+
```bash
|
|
1524
|
+
npx @mui/codemod@latest deprecations/step-content-props <path>
|
|
1525
|
+
```
|
|
1526
|
+
|
|
1486
1527
|
#### `step-label-props`
|
|
1487
1528
|
|
|
1488
1529
|
```diff
|
|
@@ -22,17 +22,20 @@ var _formControlLabelProps = _interopRequireDefault(require("../form-control-lab
|
|
|
22
22
|
var _imageListItemBarClasses = _interopRequireDefault(require("../image-list-item-bar-classes"));
|
|
23
23
|
var _inputBaseProps = _interopRequireDefault(require("../input-base-props"));
|
|
24
24
|
var _inputProps = _interopRequireDefault(require("../input-props"));
|
|
25
|
+
var _listItemTextProps = _interopRequireDefault(require("../list-item-text-props"));
|
|
25
26
|
var _modalProps = _interopRequireDefault(require("../modal-props"));
|
|
26
27
|
var _outlinedInputProps = _interopRequireDefault(require("../outlined-input-props"));
|
|
27
28
|
var _paginationItemClasses = _interopRequireDefault(require("../pagination-item-classes"));
|
|
28
29
|
var _speedDialProps = _interopRequireDefault(require("../speed-dial-props"));
|
|
29
30
|
var _tableSortLabelClasses = _interopRequireDefault(require("../table-sort-label-classes"));
|
|
30
31
|
var _stepConnectorClasses = _interopRequireDefault(require("../step-connector-classes"));
|
|
32
|
+
var _stepContentProps = _interopRequireDefault(require("../step-content-props"));
|
|
31
33
|
var _stepLabelProps = _interopRequireDefault(require("../step-label-props"));
|
|
32
34
|
var _textFieldProps = _interopRequireDefault(require("../text-field-props"));
|
|
33
35
|
var _tabClasses = _interopRequireDefault(require("../tab-classes"));
|
|
34
36
|
var _toggleButtonGroupClasses = _interopRequireDefault(require("../toggle-button-group-classes"));
|
|
35
37
|
var _tooltipProps = _interopRequireDefault(require("../tooltip-props"));
|
|
38
|
+
var _tablePaginationProps = _interopRequireDefault(require("../table-pagination-props"));
|
|
36
39
|
/**
|
|
37
40
|
* @param {import('jscodeshift').FileInfo} file
|
|
38
41
|
* @param {import('jscodeshift').API} api
|
|
@@ -55,16 +58,19 @@ function deprecationsAll(file, api, options) {
|
|
|
55
58
|
file.source = (0, _imageListItemBarClasses.default)(file, api, options);
|
|
56
59
|
file.source = (0, _inputBaseProps.default)(file, api, options);
|
|
57
60
|
file.source = (0, _inputProps.default)(file, api, options);
|
|
61
|
+
file.source = (0, _listItemTextProps.default)(file, api, options);
|
|
58
62
|
file.source = (0, _modalProps.default)(file, api, options);
|
|
59
63
|
file.source = (0, _outlinedInputProps.default)(file, api, options);
|
|
60
64
|
file.source = (0, _paginationItemClasses.default)(file, api, options);
|
|
61
65
|
file.source = (0, _speedDialProps.default)(file, api, options);
|
|
62
66
|
file.source = (0, _stepConnectorClasses.default)(file, api, options);
|
|
67
|
+
file.source = (0, _stepContentProps.default)(file, api, options);
|
|
63
68
|
file.source = (0, _stepLabelProps.default)(file, api, options);
|
|
64
69
|
file.source = (0, _tableSortLabelClasses.default)(file, api, options);
|
|
65
70
|
file.source = (0, _textFieldProps.default)(file, api, options);
|
|
66
71
|
file.source = (0, _tabClasses.default)(file, api, options);
|
|
67
72
|
file.source = (0, _toggleButtonGroupClasses.default)(file, api, options);
|
|
68
73
|
file.source = (0, _tooltipProps.default)(file, api, options);
|
|
74
|
+
file.source = (0, _tablePaginationProps.default)(file, api, options);
|
|
69
75
|
return file.source;
|
|
70
76
|
}
|
|
@@ -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 _listItemTextProps.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
var _listItemTextProps = _interopRequireDefault(require("./list-item-text-props"));
|
|
@@ -0,0 +1,35 @@
|
|
|
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 _replaceComponentsWithSlots = _interopRequireDefault(require("../utils/replaceComponentsWithSlots"));
|
|
9
|
+
var _movePropIntoSlotProps = _interopRequireDefault(require("../utils/movePropIntoSlotProps"));
|
|
10
|
+
/**
|
|
11
|
+
* @param {import('jscodeshift').FileInfo} file
|
|
12
|
+
* @param {import('jscodeshift').API} api
|
|
13
|
+
*/
|
|
14
|
+
function transformer(file, api, options) {
|
|
15
|
+
const j = api.jscodeshift;
|
|
16
|
+
const root = j(file.source);
|
|
17
|
+
const printOptions = options.printOptions;
|
|
18
|
+
(0, _replaceComponentsWithSlots.default)(j, {
|
|
19
|
+
root,
|
|
20
|
+
componentName: 'ListItemText'
|
|
21
|
+
});
|
|
22
|
+
(0, _movePropIntoSlotProps.default)(j, {
|
|
23
|
+
root,
|
|
24
|
+
componentName: 'ListItemText',
|
|
25
|
+
propName: 'primaryTypographyProps',
|
|
26
|
+
slotName: 'primary'
|
|
27
|
+
});
|
|
28
|
+
(0, _movePropIntoSlotProps.default)(j, {
|
|
29
|
+
root,
|
|
30
|
+
componentName: 'ListItemText',
|
|
31
|
+
propName: 'secondaryTypographyProps',
|
|
32
|
+
slotName: 'secondary'
|
|
33
|
+
});
|
|
34
|
+
return root.toSource(printOptions);
|
|
35
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _ListItemText = _interopRequireDefault(require("@mui/material/ListItemText"));
|
|
5
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
6
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemText.default, {
|
|
7
|
+
secondaryTypographyProps: secondaryTypographyProps
|
|
8
|
+
});
|
|
9
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemText.default, {
|
|
10
|
+
primaryTypographyProps: primaryTypographyProps
|
|
11
|
+
});
|
|
12
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemText.default, {
|
|
13
|
+
primaryTypographyProps: primaryTypographyProps,
|
|
14
|
+
secondaryTypographyProps: secondaryTypographyProps
|
|
15
|
+
});
|
|
16
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemText.default, {
|
|
17
|
+
slotProps: {
|
|
18
|
+
primary: primarySlotProps
|
|
19
|
+
},
|
|
20
|
+
secondaryTypographyProps: secondaryTypographyProps
|
|
21
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _ListItemText = _interopRequireDefault(require("@mui/material/ListItemText"));
|
|
5
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
6
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemText.default, {
|
|
7
|
+
slotProps: {
|
|
8
|
+
secondary: secondaryTypographyProps
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemText.default, {
|
|
12
|
+
slotProps: {
|
|
13
|
+
primary: primaryTypographyProps
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemText.default, {
|
|
17
|
+
slotProps: {
|
|
18
|
+
primary: primaryTypographyProps,
|
|
19
|
+
secondary: secondaryTypographyProps
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemText.default, {
|
|
23
|
+
slotProps: {
|
|
24
|
+
primary: primarySlotProps,
|
|
25
|
+
secondary: secondaryTypographyProps
|
|
26
|
+
}
|
|
27
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
fn({
|
|
4
|
+
MuiListItemText: {
|
|
5
|
+
defaultProps: {
|
|
6
|
+
primaryTypographyProps: primaryTypographyProps
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
fn({
|
|
11
|
+
MuiListItemText: {
|
|
12
|
+
defaultProps: {
|
|
13
|
+
secondaryTypographyProps: secondaryTypographyProps
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
fn({
|
|
18
|
+
MuiListItemText: {
|
|
19
|
+
defaultProps: {
|
|
20
|
+
primaryTypographyProps: primaryTypographyProps,
|
|
21
|
+
secondaryTypographyProps: secondaryTypographyProps
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
fn({
|
|
26
|
+
MuiListItemText: {
|
|
27
|
+
defaultProps: {
|
|
28
|
+
slotProps: {
|
|
29
|
+
primary: primarySlotProps
|
|
30
|
+
},
|
|
31
|
+
secondaryTypographyProps: secondaryTypographyProps
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
fn({
|
|
4
|
+
MuiListItemText: {
|
|
5
|
+
defaultProps: {
|
|
6
|
+
slotProps: {
|
|
7
|
+
primary: primaryTypographyProps
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
fn({
|
|
13
|
+
MuiListItemText: {
|
|
14
|
+
defaultProps: {
|
|
15
|
+
slotProps: {
|
|
16
|
+
secondary: secondaryTypographyProps
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
fn({
|
|
22
|
+
MuiListItemText: {
|
|
23
|
+
defaultProps: {
|
|
24
|
+
slotProps: {
|
|
25
|
+
primary: primaryTypographyProps,
|
|
26
|
+
secondary: secondaryTypographyProps
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
fn({
|
|
32
|
+
MuiListItemText: {
|
|
33
|
+
defaultProps: {
|
|
34
|
+
slotProps: {
|
|
35
|
+
primary: primarySlotProps,
|
|
36
|
+
secondary: secondaryTypographyProps
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
});
|
|
@@ -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 _stepContentProps.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
var _stepContentProps = _interopRequireDefault(require("./step-content-props"));
|
|
@@ -0,0 +1,31 @@
|
|
|
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 _movePropIntoSlots = _interopRequireDefault(require("../utils/movePropIntoSlots"));
|
|
9
|
+
var _movePropIntoSlotProps = _interopRequireDefault(require("../utils/movePropIntoSlotProps"));
|
|
10
|
+
/**
|
|
11
|
+
* @param {import('jscodeshift').FileInfo} file
|
|
12
|
+
* @param {import('jscodeshift').API} api
|
|
13
|
+
*/
|
|
14
|
+
function transformer(file, api, options) {
|
|
15
|
+
const j = api.jscodeshift;
|
|
16
|
+
const root = j(file.source);
|
|
17
|
+
const printOptions = options.printOptions;
|
|
18
|
+
(0, _movePropIntoSlots.default)(j, {
|
|
19
|
+
root,
|
|
20
|
+
componentName: 'StepContent',
|
|
21
|
+
propName: 'TransitionComponent',
|
|
22
|
+
slotName: 'transition'
|
|
23
|
+
});
|
|
24
|
+
(0, _movePropIntoSlotProps.default)(j, {
|
|
25
|
+
root,
|
|
26
|
+
componentName: 'StepContent',
|
|
27
|
+
propName: 'TransitionProps',
|
|
28
|
+
slotName: 'transition'
|
|
29
|
+
});
|
|
30
|
+
return root.toSource(printOptions);
|
|
31
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _StepContent = _interopRequireDefault(require("@mui/material/StepContent"));
|
|
5
|
+
var _material = require("@mui/material");
|
|
6
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
7
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_StepContent.default, {
|
|
8
|
+
TransitionComponent: CustomTransition,
|
|
9
|
+
TransitionProps: {
|
|
10
|
+
unmountOnExit: true
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.StepContent, {
|
|
14
|
+
TransitionComponent: CustomTransition,
|
|
15
|
+
TransitionProps: transitionVars
|
|
16
|
+
});
|
|
17
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_StepContent.default, {
|
|
18
|
+
TransitionComponent: CustomTransition,
|
|
19
|
+
TransitionProps: {
|
|
20
|
+
unmountOnExit: true
|
|
21
|
+
},
|
|
22
|
+
slots: {
|
|
23
|
+
root: 'div'
|
|
24
|
+
},
|
|
25
|
+
slotProps: {
|
|
26
|
+
root: {
|
|
27
|
+
className: 'foo'
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.StepContent, {
|
|
32
|
+
TransitionComponent: CustomTransition,
|
|
33
|
+
TransitionProps: {
|
|
34
|
+
unmountOnExit: true
|
|
35
|
+
},
|
|
36
|
+
slots: {
|
|
37
|
+
...outerSlots
|
|
38
|
+
},
|
|
39
|
+
slotProps: {
|
|
40
|
+
...outerSlotProps
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_StepContent.default, {
|
|
44
|
+
TransitionComponent: ComponentTransition,
|
|
45
|
+
slots: {
|
|
46
|
+
transition: SlotTransition
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_StepContent.default, {
|
|
50
|
+
TransitionProps: {
|
|
51
|
+
unmountOnExit: true
|
|
52
|
+
},
|
|
53
|
+
slotProps: {
|
|
54
|
+
transition: {
|
|
55
|
+
id: 'test'
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
// should skip non MUI components
|
|
60
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(NonMuiStepContent, {
|
|
61
|
+
TransitionComponent: CustomTransition,
|
|
62
|
+
TransitionProps: {
|
|
63
|
+
unmountOnExit: true
|
|
64
|
+
}
|
|
65
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _StepContent = _interopRequireDefault(require("@mui/material/StepContent"));
|
|
5
|
+
var _material = require("@mui/material");
|
|
6
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
7
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_StepContent.default, {
|
|
8
|
+
slots: {
|
|
9
|
+
transition: CustomTransition
|
|
10
|
+
},
|
|
11
|
+
slotProps: {
|
|
12
|
+
transition: {
|
|
13
|
+
unmountOnExit: true
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.StepContent, {
|
|
18
|
+
slots: {
|
|
19
|
+
transition: CustomTransition
|
|
20
|
+
},
|
|
21
|
+
slotProps: {
|
|
22
|
+
transition: transitionVars
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_StepContent.default, {
|
|
26
|
+
slots: {
|
|
27
|
+
root: 'div',
|
|
28
|
+
transition: CustomTransition
|
|
29
|
+
},
|
|
30
|
+
slotProps: {
|
|
31
|
+
root: {
|
|
32
|
+
className: 'foo'
|
|
33
|
+
},
|
|
34
|
+
transition: {
|
|
35
|
+
unmountOnExit: true
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.StepContent, {
|
|
40
|
+
slots: {
|
|
41
|
+
...outerSlots,
|
|
42
|
+
transition: CustomTransition
|
|
43
|
+
},
|
|
44
|
+
slotProps: {
|
|
45
|
+
...outerSlotProps,
|
|
46
|
+
transition: {
|
|
47
|
+
unmountOnExit: true
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_StepContent.default, {
|
|
52
|
+
slots: {
|
|
53
|
+
transition: SlotTransition
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_StepContent.default, {
|
|
57
|
+
slotProps: {
|
|
58
|
+
transition: {
|
|
59
|
+
...{
|
|
60
|
+
unmountOnExit: true
|
|
61
|
+
},
|
|
62
|
+
...{
|
|
63
|
+
id: 'test'
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
// should skip non MUI components
|
|
69
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(NonMuiStepContent, {
|
|
70
|
+
TransitionComponent: CustomTransition,
|
|
71
|
+
TransitionProps: {
|
|
72
|
+
unmountOnExit: true
|
|
73
|
+
}
|
|
74
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
fn({
|
|
4
|
+
MuiStepContent: {
|
|
5
|
+
defaultProps: {
|
|
6
|
+
TransitionComponent: CustomTransition,
|
|
7
|
+
TransitionProps: {
|
|
8
|
+
unmountOnExit: true
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
fn({
|
|
14
|
+
MuiStepContent: {
|
|
15
|
+
defaultProps: {
|
|
16
|
+
TransitionComponent: ComponentTransition,
|
|
17
|
+
slots: {
|
|
18
|
+
transition: SlotTransition
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
fn({
|
|
24
|
+
MuiStepContent: {
|
|
25
|
+
defaultProps: {
|
|
26
|
+
slotProps: {
|
|
27
|
+
transition: {
|
|
28
|
+
id: 'test'
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
TransitionProps: {
|
|
32
|
+
unmountOnExit: true
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
fn({
|
|
4
|
+
MuiStepContent: {
|
|
5
|
+
defaultProps: {
|
|
6
|
+
slots: {
|
|
7
|
+
transition: CustomTransition
|
|
8
|
+
},
|
|
9
|
+
slotProps: {
|
|
10
|
+
transition: {
|
|
11
|
+
unmountOnExit: true
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
fn({
|
|
18
|
+
MuiStepContent: {
|
|
19
|
+
defaultProps: {
|
|
20
|
+
slots: {
|
|
21
|
+
transition: SlotTransition
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
fn({
|
|
27
|
+
MuiStepContent: {
|
|
28
|
+
defaultProps: {
|
|
29
|
+
slotProps: {
|
|
30
|
+
transition: {
|
|
31
|
+
...{
|
|
32
|
+
unmountOnExit: true
|
|
33
|
+
},
|
|
34
|
+
...{
|
|
35
|
+
id: 'test'
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
});
|
|
@@ -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 _tablePaginationProps.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
var _tablePaginationProps = _interopRequireDefault(require("./table-pagination-props"));
|
|
@@ -0,0 +1,31 @@
|
|
|
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 _movePropIntoSlots = _interopRequireDefault(require("../utils/movePropIntoSlots"));
|
|
9
|
+
var _movePropIntoSlotProps = _interopRequireDefault(require("../utils/movePropIntoSlotProps"));
|
|
10
|
+
/**
|
|
11
|
+
* @param {import('jscodeshift').FileInfo} file
|
|
12
|
+
* @param {import('jscodeshift').API} api
|
|
13
|
+
*/
|
|
14
|
+
function transformer(file, api, options) {
|
|
15
|
+
const j = api.jscodeshift;
|
|
16
|
+
const root = j(file.source);
|
|
17
|
+
const printOptions = options.printOptions;
|
|
18
|
+
(0, _movePropIntoSlots.default)(j, {
|
|
19
|
+
root,
|
|
20
|
+
componentName: 'TablePagination',
|
|
21
|
+
propName: 'ActionsComponent',
|
|
22
|
+
slotName: 'actions'
|
|
23
|
+
});
|
|
24
|
+
(0, _movePropIntoSlotProps.default)(j, {
|
|
25
|
+
root,
|
|
26
|
+
componentName: 'TablePagination',
|
|
27
|
+
propName: 'SelectProps',
|
|
28
|
+
slotName: 'select'
|
|
29
|
+
});
|
|
30
|
+
return root.toSource(printOptions);
|
|
31
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _TablePagination = _interopRequireDefault(require("@mui/material/TablePagination"));
|
|
5
|
+
var _material = require("@mui/material");
|
|
6
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
7
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_TablePagination.default, {
|
|
8
|
+
ActionsComponent: "div",
|
|
9
|
+
SelectProps: {
|
|
10
|
+
native: true
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_TablePagination.default, {
|
|
14
|
+
ActionsComponent: "div",
|
|
15
|
+
SelectProps: {
|
|
16
|
+
native: true
|
|
17
|
+
},
|
|
18
|
+
slots: {
|
|
19
|
+
actions: 'div',
|
|
20
|
+
select: 'div'
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_TablePagination.default, {
|
|
24
|
+
ActionsComponent: "div",
|
|
25
|
+
SelectProps: {
|
|
26
|
+
native: true
|
|
27
|
+
},
|
|
28
|
+
slots: {
|
|
29
|
+
root: 'div'
|
|
30
|
+
},
|
|
31
|
+
slotProps: {
|
|
32
|
+
root: {
|
|
33
|
+
'aria-label': ''
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_TablePagination.default, {
|
|
38
|
+
ActionsComponent: "div",
|
|
39
|
+
SelectProps: {
|
|
40
|
+
native: true
|
|
41
|
+
},
|
|
42
|
+
slots: {
|
|
43
|
+
actions: () => null
|
|
44
|
+
},
|
|
45
|
+
slotProps: {
|
|
46
|
+
select: {
|
|
47
|
+
native: false
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TablePagination, {
|
|
52
|
+
ActionsComponent: "div",
|
|
53
|
+
SelectProps: {
|
|
54
|
+
native: true
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(CustomTablePagination, {
|
|
58
|
+
ActionsComponent: "div",
|
|
59
|
+
SelectProps: {
|
|
60
|
+
native: true
|
|
61
|
+
}
|
|
62
|
+
});
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _TablePagination = _interopRequireDefault(require("@mui/material/TablePagination"));
|
|
5
|
+
var _material = require("@mui/material");
|
|
6
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
7
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_TablePagination.default, {
|
|
8
|
+
slots: {
|
|
9
|
+
actions: "div"
|
|
10
|
+
},
|
|
11
|
+
slotProps: {
|
|
12
|
+
select: {
|
|
13
|
+
native: true
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_TablePagination.default, {
|
|
18
|
+
slots: {
|
|
19
|
+
actions: 'div',
|
|
20
|
+
select: 'div'
|
|
21
|
+
},
|
|
22
|
+
slotProps: {
|
|
23
|
+
select: {
|
|
24
|
+
native: true
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_TablePagination.default, {
|
|
29
|
+
slots: {
|
|
30
|
+
root: 'div',
|
|
31
|
+
actions: "div"
|
|
32
|
+
},
|
|
33
|
+
slotProps: {
|
|
34
|
+
root: {
|
|
35
|
+
'aria-label': ''
|
|
36
|
+
},
|
|
37
|
+
select: {
|
|
38
|
+
native: true
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_TablePagination.default, {
|
|
43
|
+
slots: {
|
|
44
|
+
actions: () => null
|
|
45
|
+
},
|
|
46
|
+
slotProps: {
|
|
47
|
+
select: {
|
|
48
|
+
...{
|
|
49
|
+
native: true
|
|
50
|
+
},
|
|
51
|
+
...{
|
|
52
|
+
native: false
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TablePagination, {
|
|
58
|
+
slots: {
|
|
59
|
+
actions: "div"
|
|
60
|
+
},
|
|
61
|
+
slotProps: {
|
|
62
|
+
select: {
|
|
63
|
+
native: true
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(CustomTablePagination, {
|
|
68
|
+
ActionsComponent: "div",
|
|
69
|
+
SelectProps: {
|
|
70
|
+
native: true
|
|
71
|
+
}
|
|
72
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
fn({
|
|
4
|
+
MuiTablePagination: {
|
|
5
|
+
defaultProps: {
|
|
6
|
+
ActionsComponent: 'div',
|
|
7
|
+
SelectProps: {
|
|
8
|
+
native: true
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
fn({
|
|
14
|
+
MuiTablePagination: {
|
|
15
|
+
defaultProps: {
|
|
16
|
+
ActionsComponent: 'div',
|
|
17
|
+
SelectProps: {
|
|
18
|
+
native: true
|
|
19
|
+
},
|
|
20
|
+
slotProps: {
|
|
21
|
+
root: {
|
|
22
|
+
id: 'test'
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
slots: {
|
|
26
|
+
root: 'div'
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
fn({
|
|
4
|
+
MuiTablePagination: {
|
|
5
|
+
defaultProps: {
|
|
6
|
+
slots: {
|
|
7
|
+
actions: 'div'
|
|
8
|
+
},
|
|
9
|
+
slotProps: {
|
|
10
|
+
select: {
|
|
11
|
+
native: true
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
fn({
|
|
18
|
+
MuiTablePagination: {
|
|
19
|
+
defaultProps: {
|
|
20
|
+
slotProps: {
|
|
21
|
+
root: {
|
|
22
|
+
id: 'test'
|
|
23
|
+
},
|
|
24
|
+
select: {
|
|
25
|
+
native: true
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
slots: {
|
|
29
|
+
root: 'div',
|
|
30
|
+
actions: 'div'
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
});
|
|
@@ -12,7 +12,8 @@ var _appendAttribute = _interopRequireDefault(require("../../util/appendAttribut
|
|
|
12
12
|
function moveJsxPropIntoSlots(j, element, propName, slotName) {
|
|
13
13
|
const index = element.openingElement.attributes.findIndex(attr => attr.type === 'JSXAttribute' && attr.name.name === propName);
|
|
14
14
|
if (index !== -1) {
|
|
15
|
-
const
|
|
15
|
+
const attrNode = element.openingElement.attributes.splice(index, 1)[0];
|
|
16
|
+
const removedValue = attrNode.value.expression || attrNode.value;
|
|
16
17
|
let hasSlots = false;
|
|
17
18
|
element.openingElement.attributes.forEach(attr => {
|
|
18
19
|
if (attr.name?.name === 'slots') {
|
package/node/v5.0.0/root-ref.js
CHANGED
|
@@ -8,5 +8,7 @@ exports.default = transformer;
|
|
|
8
8
|
* @param {import('jscodeshift').FileInfo} file
|
|
9
9
|
*/
|
|
10
10
|
function transformer(file) {
|
|
11
|
-
|
|
11
|
+
// The regexes below have a negative lookahead to prevent ReDoS
|
|
12
|
+
// See https://github.com/mui/material-ui/issues/44078
|
|
13
|
+
return file.source.replace(/\n?import(?!import).*core\/RootRef['"];?/gm, '').replace(/\n?import {\s?RootRef\s?} from ['"]@material-ui\/core\/?['"];?/gm, '').replace(/({.*)(RootRef,?)(.*})/gm, '$1$3').replace(/<RootRef(?!<RootRef).*>/gm, '<>').replace(/<\/RootRef>/gm, '</>');
|
|
12
14
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/codemod",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.3.0",
|
|
4
4
|
"bin": "./codemod.js",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "MUI Team",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@babel/core": "^7.26.0",
|
|
28
28
|
"@babel/runtime": "^7.26.0",
|
|
29
|
-
"@babel/traverse": "^7.
|
|
29
|
+
"@babel/traverse": "^7.26.4",
|
|
30
30
|
"jscodeshift": "^17.1.1",
|
|
31
31
|
"jscodeshift-add-imports": "^1.0.11",
|
|
32
32
|
"postcss": "^8.4.49",
|