@mui/codemod 7.0.0-alpha.1 → 7.0.0-beta.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 +132 -10
- package/deprecations/all/deprecations-all.js +6 -0
- package/deprecations/all/postcss.config.js +4 -1
- package/deprecations/input-base-classes/index.js +13 -0
- package/deprecations/input-base-classes/input-base-classes.js +69 -0
- package/deprecations/input-base-classes/postcss-plugin.js +42 -0
- package/deprecations/input-base-classes/postcss.config.js +8 -0
- package/deprecations/input-base-classes/test-cases/actual.js +13 -0
- package/deprecations/input-base-classes/test-cases/expected.js +13 -0
- package/deprecations/menu-props/index.js +13 -0
- package/deprecations/menu-props/menu-props.js +37 -0
- package/deprecations/menu-props/test-cases/actual.js +67 -0
- package/deprecations/menu-props/test-cases/expected.js +83 -0
- package/deprecations/menu-props/test-cases/theme.actual.js +33 -0
- package/deprecations/menu-props/test-cases/theme.expected.js +39 -0
- package/deprecations/rating-props/index.js +13 -0
- package/deprecations/rating-props/rating-props.js +25 -0
- package/deprecations/rating-props/test-cases/actual.js +37 -0
- package/deprecations/rating-props/test-cases/expected.js +53 -0
- package/deprecations/rating-props/test-cases/theme.actual.js +31 -0
- package/deprecations/rating-props/test-cases/theme.expected.js +37 -0
- package/package.json +5 -5
- package/v7.0.0/all/v7-all.js +2 -0
- package/v7.0.0/grid-props/grid-props.js +150 -0
- package/v7.0.0/grid-props/index.js +13 -0
- package/v7.0.0/grid-props/test-cases/actual.js +107 -0
- package/v7.0.0/grid-props/test-cases/custom-breakpoints.actual.js +18 -0
- package/v7.0.0/grid-props/test-cases/custom-breakpoints.expected.js +22 -0
- package/v7.0.0/grid-props/test-cases/expected.js +107 -0
- package/v7.0.0/input-label-size-normal-medium/index.js +13 -0
- package/v7.0.0/input-label-size-normal-medium/input-label-size-normal-medium.js +21 -0
- package/v7.0.0/input-label-size-normal-medium/test-cases/actual.js +9 -0
- package/v7.0.0/input-label-size-normal-medium/test-cases/expected.js +9 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _Grid = _interopRequireDefault(require("@mui/material/Grid"));
|
|
5
|
+
var _GridLegacy = _interopRequireDefault(require("@mui/material/GridLegacy"));
|
|
6
|
+
var _Grid2 = _interopRequireDefault(require("@mui/system/Grid"));
|
|
7
|
+
var _Grid3 = _interopRequireDefault(require("@mui/joy/Grid"));
|
|
8
|
+
var _material = require("@mui/material");
|
|
9
|
+
var _system = require("@mui/system");
|
|
10
|
+
var _joy = require("@mui/joy");
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
// Transforms on all the possible imports
|
|
13
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
14
|
+
size: 2
|
|
15
|
+
});
|
|
16
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid2.default, {
|
|
17
|
+
size: 2
|
|
18
|
+
});
|
|
19
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid3.default, {
|
|
20
|
+
size: 2
|
|
21
|
+
});
|
|
22
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Grid, {
|
|
23
|
+
size: 2
|
|
24
|
+
});
|
|
25
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_system.Grid, {
|
|
26
|
+
size: 2
|
|
27
|
+
});
|
|
28
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_joy.Grid, {
|
|
29
|
+
size: 2
|
|
30
|
+
});
|
|
31
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {});
|
|
32
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {});
|
|
33
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {});
|
|
34
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {});
|
|
35
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {});
|
|
36
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {});
|
|
37
|
+
|
|
38
|
+
// Transforms responsive sizes
|
|
39
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
40
|
+
size: {
|
|
41
|
+
xs: 2,
|
|
42
|
+
sm: 4,
|
|
43
|
+
md: 6,
|
|
44
|
+
lg: 8,
|
|
45
|
+
xl: 10
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// Transforms all the possible size values
|
|
50
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
51
|
+
size: {
|
|
52
|
+
xs: "grow",
|
|
53
|
+
sm: "auto",
|
|
54
|
+
md: 2,
|
|
55
|
+
lg: "grow",
|
|
56
|
+
xl: false
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// Doesn't add jsx object expression for single string values
|
|
61
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
62
|
+
size: "auto"
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
// Transforms offset
|
|
66
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
67
|
+
offset: 2
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
// Transforms responsive offset
|
|
71
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
72
|
+
offset: {
|
|
73
|
+
xs: 2,
|
|
74
|
+
sm: 4,
|
|
75
|
+
md: 6,
|
|
76
|
+
lg: 8,
|
|
77
|
+
xl: 10
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
// Transforms all the possible offset values
|
|
82
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
83
|
+
offset: {
|
|
84
|
+
xs: 2,
|
|
85
|
+
sm: "auto"
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
// Transforms spread props
|
|
90
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
91
|
+
size: {
|
|
92
|
+
xs: 2,
|
|
93
|
+
sm: 4
|
|
94
|
+
},
|
|
95
|
+
offset: {
|
|
96
|
+
xs: 0,
|
|
97
|
+
sm: 2
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
// Doesn't transform Grid v1
|
|
102
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_GridLegacy.default, {
|
|
103
|
+
xs: 2
|
|
104
|
+
});
|
|
105
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.GridLegacy, {
|
|
106
|
+
xs: 2
|
|
107
|
+
});
|
|
@@ -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 _inputLabelSizeNormalMedium.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
var _inputLabelSizeNormalMedium = _interopRequireDefault(require("./input-label-size-normal-medium"));
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = transformer;
|
|
7
|
+
/**
|
|
8
|
+
* @param {import('jscodeshift').FileInfo} file
|
|
9
|
+
* @param {import('jscodeshift').API} api
|
|
10
|
+
*/
|
|
11
|
+
function transformer(file, api, options) {
|
|
12
|
+
const j = api.jscodeshift;
|
|
13
|
+
const printOptions = options.printOptions;
|
|
14
|
+
return j(file.source).findJSXElements('InputLabel').forEach(path => {
|
|
15
|
+
path.node.openingElement.attributes.forEach(node => {
|
|
16
|
+
if (node.type === 'JSXAttribute' && node.name.name === 'size' && (node.value.value === 'normal' || node.value.expression?.value === 'normal')) {
|
|
17
|
+
node.value = j.literal('medium');
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}).toSource(printOptions);
|
|
21
|
+
}
|