@mui/codemod 6.2.0 → 6.3.1
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 +63 -0
- package/node/deprecations/all/deprecations-all.js +6 -0
- package/node/deprecations/all/postcss.config.js +4 -1
- package/node/deprecations/select-classes/index.js +13 -0
- package/node/deprecations/select-classes/postcss-plugin.js +36 -0
- package/node/deprecations/select-classes/postcss.config.js +8 -0
- package/node/deprecations/select-classes/select-classes.js +77 -0
- package/node/deprecations/select-classes/test-cases/actual.js +9 -0
- package/node/deprecations/select-classes/test-cases/expected.js +9 -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/package.json +2 -2
package/README.md
CHANGED
|
@@ -1406,6 +1406,54 @@ npx @mui/codemod@latest deprecations/popper-props <path>
|
|
|
1406
1406
|
npx @mui/codemod@latest deprecations/outlined-input-props <path>
|
|
1407
1407
|
```
|
|
1408
1408
|
|
|
1409
|
+
#### `select-classes`
|
|
1410
|
+
|
|
1411
|
+
JS transforms:
|
|
1412
|
+
|
|
1413
|
+
```diff
|
|
1414
|
+
import { selectClasses } from '@mui/material/Select';
|
|
1415
|
+
|
|
1416
|
+
MuiSelect: {
|
|
1417
|
+
styleOverrides: {
|
|
1418
|
+
root: {
|
|
1419
|
+
- [`& .${selectClasses.iconFilled}`]: {
|
|
1420
|
+
+ [`& .${selectClasses.filled} ~ .${selectClasses.icon}`]: {
|
|
1421
|
+
color: 'red',
|
|
1422
|
+
},
|
|
1423
|
+
- [`& .${selectClasses.iconOutlined}`]: {
|
|
1424
|
+
+ [`& .${selectClasses.outlined} ~ .${selectClasses.icon}`]: {
|
|
1425
|
+
color: 'red',
|
|
1426
|
+
},
|
|
1427
|
+
- [`& .${selectClasses.iconStandard}`]: {
|
|
1428
|
+
+ [`& .${selectClasses.standard} ~ .${selectClasses.icon}`]: {
|
|
1429
|
+
color: 'red',
|
|
1430
|
+
},
|
|
1431
|
+
},
|
|
1432
|
+
},
|
|
1433
|
+
},
|
|
1434
|
+
```
|
|
1435
|
+
|
|
1436
|
+
CSS transforms:
|
|
1437
|
+
|
|
1438
|
+
```diff
|
|
1439
|
+
- .MuiSelect-iconFilled
|
|
1440
|
+
+ .MuiSelect-filled ~ .MuiSelect-icon
|
|
1441
|
+
```
|
|
1442
|
+
|
|
1443
|
+
```diff
|
|
1444
|
+
- .MuiSelect-iconOutlined
|
|
1445
|
+
+ .MuiSelect-outlined ~ .MuiSelect-icon
|
|
1446
|
+
```
|
|
1447
|
+
|
|
1448
|
+
```diff
|
|
1449
|
+
- .MuiSelect-iconStandard
|
|
1450
|
+
+ .MuiSelect-standard ~ .MuiSelect-icon
|
|
1451
|
+
```
|
|
1452
|
+
|
|
1453
|
+
```bash
|
|
1454
|
+
npx @mui/codemod@latest deprecations/select-classes <path>
|
|
1455
|
+
```
|
|
1456
|
+
|
|
1409
1457
|
#### `slider-props`
|
|
1410
1458
|
|
|
1411
1459
|
```diff
|
|
@@ -1509,6 +1557,21 @@ JS transforms:
|
|
|
1509
1557
|
npx @mui/codemod@next deprecations/step-connector-classes <path>
|
|
1510
1558
|
```
|
|
1511
1559
|
|
|
1560
|
+
#### `step-content-props`
|
|
1561
|
+
|
|
1562
|
+
```diff
|
|
1563
|
+
<StepContent
|
|
1564
|
+
- TransitionComponent={CustomTransition}
|
|
1565
|
+
- TransitionProps={{ unmountOnExit: true }}
|
|
1566
|
+
+ slots={{ transition: CustomTransition }}
|
|
1567
|
+
+ slotProps={{ transition: { unmountOnExit: true } }}
|
|
1568
|
+
/>
|
|
1569
|
+
```
|
|
1570
|
+
|
|
1571
|
+
```bash
|
|
1572
|
+
npx @mui/codemod@latest deprecations/step-content-props <path>
|
|
1573
|
+
```
|
|
1574
|
+
|
|
1512
1575
|
#### `step-label-props`
|
|
1513
1576
|
|
|
1514
1577
|
```diff
|
|
@@ -28,12 +28,15 @@ var _outlinedInputProps = _interopRequireDefault(require("../outlined-input-prop
|
|
|
28
28
|
var _paginationItemClasses = _interopRequireDefault(require("../pagination-item-classes"));
|
|
29
29
|
var _speedDialProps = _interopRequireDefault(require("../speed-dial-props"));
|
|
30
30
|
var _tableSortLabelClasses = _interopRequireDefault(require("../table-sort-label-classes"));
|
|
31
|
+
var _selectClasses = _interopRequireDefault(require("../select-classes"));
|
|
31
32
|
var _stepConnectorClasses = _interopRequireDefault(require("../step-connector-classes"));
|
|
33
|
+
var _stepContentProps = _interopRequireDefault(require("../step-content-props"));
|
|
32
34
|
var _stepLabelProps = _interopRequireDefault(require("../step-label-props"));
|
|
33
35
|
var _textFieldProps = _interopRequireDefault(require("../text-field-props"));
|
|
34
36
|
var _tabClasses = _interopRequireDefault(require("../tab-classes"));
|
|
35
37
|
var _toggleButtonGroupClasses = _interopRequireDefault(require("../toggle-button-group-classes"));
|
|
36
38
|
var _tooltipProps = _interopRequireDefault(require("../tooltip-props"));
|
|
39
|
+
var _tablePaginationProps = _interopRequireDefault(require("../table-pagination-props"));
|
|
37
40
|
/**
|
|
38
41
|
* @param {import('jscodeshift').FileInfo} file
|
|
39
42
|
* @param {import('jscodeshift').API} api
|
|
@@ -62,11 +65,14 @@ function deprecationsAll(file, api, options) {
|
|
|
62
65
|
file.source = (0, _paginationItemClasses.default)(file, api, options);
|
|
63
66
|
file.source = (0, _speedDialProps.default)(file, api, options);
|
|
64
67
|
file.source = (0, _stepConnectorClasses.default)(file, api, options);
|
|
68
|
+
file.source = (0, _stepContentProps.default)(file, api, options);
|
|
65
69
|
file.source = (0, _stepLabelProps.default)(file, api, options);
|
|
66
70
|
file.source = (0, _tableSortLabelClasses.default)(file, api, options);
|
|
67
71
|
file.source = (0, _textFieldProps.default)(file, api, options);
|
|
72
|
+
file.source = (0, _selectClasses.default)(file, api, options);
|
|
68
73
|
file.source = (0, _tabClasses.default)(file, api, options);
|
|
69
74
|
file.source = (0, _toggleButtonGroupClasses.default)(file, api, options);
|
|
70
75
|
file.source = (0, _tooltipProps.default)(file, api, options);
|
|
76
|
+
file.source = (0, _tablePaginationProps.default)(file, api, options);
|
|
71
77
|
return file.source;
|
|
72
78
|
}
|
|
@@ -33,6 +33,9 @@ const {
|
|
|
33
33
|
const {
|
|
34
34
|
plugin: tableSortLabelClassesPlugin
|
|
35
35
|
} = require('../table-sort-label-classes/postcss-plugin');
|
|
36
|
+
const {
|
|
37
|
+
plugin: selectClassesPlugin
|
|
38
|
+
} = require('../select-classes/postcss-plugin');
|
|
36
39
|
module.exports = {
|
|
37
|
-
plugins: [accordionSummaryClassesPlugin, alertClassesPlugin, buttonClassesPlugin, buttonGroupClassesPlugin, chipClassesPlugin, circularProgressClassesPlugin, paginationItemClassesPlugin, stepConnectorClassesPlugin, toggleButtonGroupClassesPlugin, tabClassesPlugin, tableSortLabelClassesPlugin]
|
|
40
|
+
plugins: [accordionSummaryClassesPlugin, alertClassesPlugin, buttonClassesPlugin, buttonGroupClassesPlugin, chipClassesPlugin, circularProgressClassesPlugin, paginationItemClassesPlugin, stepConnectorClassesPlugin, toggleButtonGroupClassesPlugin, tabClassesPlugin, tableSortLabelClassesPlugin, selectClassesPlugin]
|
|
38
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 _selectClasses.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
var _selectClasses = _interopRequireDefault(require("./select-classes"));
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const classes = [{
|
|
4
|
+
deprecatedClass: ' .MuiSelect-iconFilled',
|
|
5
|
+
replacementSelector: ' .MuiSelect-filled ~ .MuiSelect-icon'
|
|
6
|
+
}, {
|
|
7
|
+
deprecatedClass: ' .MuiSelect-iconOutlined',
|
|
8
|
+
replacementSelector: ' .MuiSelect-outlined ~ .MuiSelect-icon'
|
|
9
|
+
}, {
|
|
10
|
+
deprecatedClass: ' .MuiSelect-iconStandard',
|
|
11
|
+
replacementSelector: ' .MuiSelect-standard ~ .MuiSelect-icon'
|
|
12
|
+
}];
|
|
13
|
+
const plugin = () => {
|
|
14
|
+
return {
|
|
15
|
+
postcssPlugin: `Replace deprecated Select classes with new classes`,
|
|
16
|
+
Rule(rule) {
|
|
17
|
+
const {
|
|
18
|
+
selector
|
|
19
|
+
} = rule;
|
|
20
|
+
classes.forEach(({
|
|
21
|
+
deprecatedClass,
|
|
22
|
+
replacementSelector
|
|
23
|
+
}) => {
|
|
24
|
+
const selectorRegex = new RegExp(`${deprecatedClass.trim()}$`);
|
|
25
|
+
if (selector.match(selectorRegex)) {
|
|
26
|
+
rule.selector = selector.replace(selectorRegex, replacementSelector);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
plugin.postcss = true;
|
|
33
|
+
module.exports = {
|
|
34
|
+
plugin,
|
|
35
|
+
classes
|
|
36
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = transformer;
|
|
7
|
+
var _postcssPlugin = require("./postcss-plugin");
|
|
8
|
+
/**
|
|
9
|
+
* @param {import('jscodeshift').FileInfo} file
|
|
10
|
+
* @param {import('jscodeshift').API} api
|
|
11
|
+
*/
|
|
12
|
+
function transformer(file, api, options) {
|
|
13
|
+
const j = api.jscodeshift;
|
|
14
|
+
const root = j(file.source);
|
|
15
|
+
const printOptions = options.printOptions;
|
|
16
|
+
_postcssPlugin.classes.forEach(({
|
|
17
|
+
deprecatedClass,
|
|
18
|
+
replacementSelector
|
|
19
|
+
}) => {
|
|
20
|
+
const replacementSelectorPrefix = '&';
|
|
21
|
+
root.find(j.ImportDeclaration).filter(path => path.node.source.value.match(/^@mui\/material\/Select$/)).forEach(path => {
|
|
22
|
+
path.node.specifiers.forEach(specifier => {
|
|
23
|
+
if (specifier.type === 'ImportSpecifier' && specifier.imported.name === 'selectClasses') {
|
|
24
|
+
const deprecatedAtomicClass = deprecatedClass.replace(`${deprecatedClass.split('-')[0]}-`, '');
|
|
25
|
+
root.find(j.MemberExpression, {
|
|
26
|
+
object: {
|
|
27
|
+
name: specifier.local.name
|
|
28
|
+
},
|
|
29
|
+
property: {
|
|
30
|
+
name: deprecatedAtomicClass
|
|
31
|
+
}
|
|
32
|
+
}).forEach(memberExpression => {
|
|
33
|
+
const parent = memberExpression.parentPath.parentPath.value;
|
|
34
|
+
if (parent.type === j.TemplateLiteral.name) {
|
|
35
|
+
const memberExpressionIndex = parent.expressions.findIndex(expression => expression === memberExpression.value);
|
|
36
|
+
const precedingTemplateElement = parent.quasis[memberExpressionIndex];
|
|
37
|
+
const atomicClasses = replacementSelector.replaceAll('MuiSelect-', '').replaceAll(replacementSelectorPrefix, '').replaceAll(' ~ ', '').split('.').map(className => className.trim()).filter(Boolean);
|
|
38
|
+
if (precedingTemplateElement.value.raw.endsWith(deprecatedClass.startsWith(' ') ? `${replacementSelectorPrefix} .` : `${replacementSelectorPrefix}.`)) {
|
|
39
|
+
const atomicClassesArgs = [memberExpressionIndex, 1, ...atomicClasses.map(atomicClass => j.memberExpression(memberExpression.value.object, j.identifier(atomicClass)))];
|
|
40
|
+
parent.expressions.splice(...atomicClassesArgs);
|
|
41
|
+
if (replacementSelector.includes(' ~ ')) {
|
|
42
|
+
const quasisArgs = [memberExpressionIndex, 1, j.templateElement({
|
|
43
|
+
raw: precedingTemplateElement.value.raw,
|
|
44
|
+
cooked: precedingTemplateElement.value.cooked.replace(' ', '')
|
|
45
|
+
}, false), j.templateElement({
|
|
46
|
+
raw: ' ~ .',
|
|
47
|
+
cooked: ' ~ .'
|
|
48
|
+
}, false)];
|
|
49
|
+
if (atomicClasses.length === 3) {
|
|
50
|
+
quasisArgs.splice(3, 0, j.templateElement({
|
|
51
|
+
raw: '.',
|
|
52
|
+
cooked: '.'
|
|
53
|
+
}, false));
|
|
54
|
+
}
|
|
55
|
+
parent.quasis.splice(...quasisArgs);
|
|
56
|
+
} else {
|
|
57
|
+
parent.quasis.splice(memberExpressionIndex, 1, j.templateElement({
|
|
58
|
+
raw: precedingTemplateElement.value.raw,
|
|
59
|
+
cooked: precedingTemplateElement.value.cooked
|
|
60
|
+
}, false), j.templateElement({
|
|
61
|
+
raw: '.',
|
|
62
|
+
cooked: '.'
|
|
63
|
+
}, false));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
const selectorRegex = new RegExp(`${replacementSelectorPrefix}${deprecatedClass}$`);
|
|
72
|
+
root.find(j.Literal, literal => typeof literal.value === 'string' && literal.value.match(selectorRegex)).forEach(path => {
|
|
73
|
+
path.replace(j.literal(path.value.value.replace(selectorRegex, `${replacementSelectorPrefix}${replacementSelector}`)));
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
return root.toSource(printOptions);
|
|
77
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _Select = require("@mui/material/Select");
|
|
4
|
+
'& .MuiSelect-iconFilled';
|
|
5
|
+
'& .MuiSelect-iconOutlined';
|
|
6
|
+
'& .MuiSelect-iconStandard';
|
|
7
|
+
`& .${_Select.selectClasses.iconFilled}`;
|
|
8
|
+
`& .${_Select.selectClasses.iconOutlined}`;
|
|
9
|
+
`& .${_Select.selectClasses.iconStandard}`;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _Select = require("@mui/material/Select");
|
|
4
|
+
"& .MuiSelect-filled ~ .MuiSelect-icon";
|
|
5
|
+
"& .MuiSelect-outlined ~ .MuiSelect-icon";
|
|
6
|
+
"& .MuiSelect-standard ~ .MuiSelect-icon";
|
|
7
|
+
`& .${_Select.selectClasses.filled} ~ .${_Select.selectClasses.icon}`;
|
|
8
|
+
`& .${_Select.selectClasses.outlined} ~ .${_Select.selectClasses.icon}`;
|
|
9
|
+
`& .${_Select.selectClasses.standard} ~ .${_Select.selectClasses.icon}`;
|
|
@@ -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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/codemod",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.3.1",
|
|
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",
|