@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,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
fn({
|
|
4
|
+
MuiMenu: {
|
|
5
|
+
defaultProps: {
|
|
6
|
+
slotProps: {
|
|
7
|
+
list: {
|
|
8
|
+
disablePadding: true
|
|
9
|
+
},
|
|
10
|
+
transition: {
|
|
11
|
+
timeout: 200
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
slots: {
|
|
15
|
+
transition: CustomTransition
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
fn({
|
|
21
|
+
MuiMenu: {
|
|
22
|
+
defaultProps: {
|
|
23
|
+
slotProps: {
|
|
24
|
+
root: {
|
|
25
|
+
disablePortal: true
|
|
26
|
+
},
|
|
27
|
+
list: {
|
|
28
|
+
disablePadding: true
|
|
29
|
+
},
|
|
30
|
+
transition: {
|
|
31
|
+
timeout: 200
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
slots: {
|
|
35
|
+
transition: CustomTransition
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
});
|
|
@@ -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
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/codemod",
|
|
3
|
-
"version": "7.0.0-
|
|
3
|
+
"version": "7.0.0-beta.0",
|
|
4
4
|
"bin": "./codemod.js",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "MUI Team",
|
|
@@ -24,12 +24,12 @@
|
|
|
24
24
|
"url": "https://opencollective.com/mui-org"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@babel/core": "^7.26.
|
|
28
|
-
"@babel/runtime": "^7.26.
|
|
29
|
-
"@babel/traverse": "^7.26.
|
|
27
|
+
"@babel/core": "^7.26.9",
|
|
28
|
+
"@babel/runtime": "^7.26.9",
|
|
29
|
+
"@babel/traverse": "^7.26.9",
|
|
30
30
|
"jscodeshift": "^17.1.2",
|
|
31
31
|
"jscodeshift-add-imports": "^1.0.11",
|
|
32
|
-
"postcss": "^8.5.
|
|
32
|
+
"postcss": "^8.5.2",
|
|
33
33
|
"postcss-cli": "^11.0.0",
|
|
34
34
|
"yargs": "^17.7.2"
|
|
35
35
|
},
|
package/v7.0.0/all/v7-all.js
CHANGED
|
@@ -5,12 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = v7All;
|
|
8
|
+
var _gridProps = _interopRequireDefault(require("../grid-props"));
|
|
8
9
|
var _labRemovedComponents = _interopRequireDefault(require("../lab-removed-components"));
|
|
9
10
|
/**
|
|
10
11
|
* @param {import('jscodeshift').FileInfo} file
|
|
11
12
|
* @param {import('jscodeshift').API} api
|
|
12
13
|
*/
|
|
13
14
|
function v7All(file, api, options) {
|
|
15
|
+
(0, _gridProps.default)(file, api, options);
|
|
14
16
|
(0, _labRemovedComponents.default)(file, api, options);
|
|
15
17
|
return file.source;
|
|
16
18
|
}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = gridV2Props;
|
|
7
|
+
const possibleDefaultImports = ['@mui/material/Grid', '@mui/system/Grid', '@mui/joy/Grid'];
|
|
8
|
+
const possibleNamedImports = {
|
|
9
|
+
'@mui/material': 'Grid',
|
|
10
|
+
'@mui/system': 'Grid',
|
|
11
|
+
'@mui/joy': 'Grid'
|
|
12
|
+
};
|
|
13
|
+
const defaultBreakpoints = ['xs', 'sm', 'md', 'lg', 'xl'];
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @param {import('jscodeshift').FileInfo} file
|
|
17
|
+
* @param {import('jscodeshift').API} api
|
|
18
|
+
*/
|
|
19
|
+
function gridV2Props(file, api, options) {
|
|
20
|
+
if (file.path?.endsWith('.json') || file.path?.endsWith('.d.ts')) {
|
|
21
|
+
return file.source;
|
|
22
|
+
}
|
|
23
|
+
const j = api.jscodeshift;
|
|
24
|
+
const root = j(file.source);
|
|
25
|
+
const breakpoints = options.muiBreakpoints?.split(',') || defaultBreakpoints;
|
|
26
|
+
const printOptions = options.printOptions;
|
|
27
|
+
const gridLocalNames = [];
|
|
28
|
+
root.find(j.ImportDeclaration, decl => possibleDefaultImports.includes(decl.source.value)).forEach(decl => {
|
|
29
|
+
decl.node.specifiers.forEach(spec => {
|
|
30
|
+
if (spec.type === 'ImportDefaultSpecifier') {
|
|
31
|
+
gridLocalNames.push(spec.local.name);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
root.find(j.ImportDeclaration, decl => Object.keys(possibleNamedImports).includes(decl.source.value)).forEach(decl => {
|
|
36
|
+
decl.node.specifiers.forEach(spec => {
|
|
37
|
+
if (spec.type === 'ImportSpecifier') {
|
|
38
|
+
if (possibleNamedImports[decl.node.source.value] === spec.imported.name) {
|
|
39
|
+
gridLocalNames.push(spec.local.name);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
root.find(j.JSXElement, {
|
|
45
|
+
openingElement: {
|
|
46
|
+
name: {
|
|
47
|
+
name: name => gridLocalNames.includes(name)
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}).forEach(el => {
|
|
51
|
+
const size = j.objectExpression([]);
|
|
52
|
+
const spreadProps = [];
|
|
53
|
+
const attributesToPrune = [];
|
|
54
|
+
el.node.openingElement.attributes.forEach(attr => {
|
|
55
|
+
if (attr.type === 'JSXSpreadAttribute') {
|
|
56
|
+
spreadProps.push(attr);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
const breakpointNodes = j(el).find(j.JSXAttribute).filter(path => path.parent.parent.node === el.node && breakpoints.includes(path.node.name.name));
|
|
60
|
+
breakpointNodes.nodes().forEach(node => {
|
|
61
|
+
const breakpoint = node.name.name;
|
|
62
|
+
const nodeValue = node.value;
|
|
63
|
+
let value;
|
|
64
|
+
if (nodeValue === null) {
|
|
65
|
+
value = j.stringLiteral('grow');
|
|
66
|
+
} else if (nodeValue.type === 'JSXExpressionContainer') {
|
|
67
|
+
if (nodeValue.expression.value === true) {
|
|
68
|
+
value = j.stringLiteral('grow');
|
|
69
|
+
} else {
|
|
70
|
+
value = nodeValue.expression;
|
|
71
|
+
}
|
|
72
|
+
} else {
|
|
73
|
+
value = nodeValue;
|
|
74
|
+
}
|
|
75
|
+
size.properties.push(j.property('init', j.identifier(breakpoint), value));
|
|
76
|
+
});
|
|
77
|
+
spreadProps.forEach(spreadProp => {
|
|
78
|
+
const spreadPropArgument = spreadProp.argument;
|
|
79
|
+
if (spreadPropArgument.type === 'ObjectExpression') {
|
|
80
|
+
const propertiesToPrune = [];
|
|
81
|
+
spreadPropArgument.properties.forEach(property => {
|
|
82
|
+
if (breakpoints.includes(property.key.name)) {
|
|
83
|
+
size.properties.push(j.property('init', property.key, property.value));
|
|
84
|
+
propertiesToPrune.push(property.key.name);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
spreadPropArgument.properties = spreadPropArgument.properties.filter(prop => !propertiesToPrune.includes(prop.key.name));
|
|
88
|
+
if (spreadPropArgument.properties.length === 0) {
|
|
89
|
+
attributesToPrune.push(spreadProp);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
if (size.properties.length) {
|
|
94
|
+
let sizePropValue = size;
|
|
95
|
+
if (size.properties.length === 1 && size.properties[0].key.name === 'xs') {
|
|
96
|
+
sizePropValue = size.properties[0].value;
|
|
97
|
+
}
|
|
98
|
+
if (sizePropValue.type !== 'StringLiteral') {
|
|
99
|
+
sizePropValue = j.jsxExpressionContainer(sizePropValue);
|
|
100
|
+
}
|
|
101
|
+
el.node.openingElement.attributes.push(j.jsxAttribute(j.jsxIdentifier('size'), sizePropValue));
|
|
102
|
+
}
|
|
103
|
+
el.node.openingElement.attributes = el.node.openingElement.attributes.filter(attr => !breakpoints.includes(attr?.name?.name));
|
|
104
|
+
const offset = j.objectExpression([]);
|
|
105
|
+
const offsetNodes = j(el).find(j.JSXAttribute).filter(path => path.parent.parent.node === el.node && path.node.name.name.endsWith('Offset') && breakpoints.includes(path.node.name.name.replace('Offset', '')));
|
|
106
|
+
offsetNodes.nodes().forEach(node => {
|
|
107
|
+
const breakpoint = node.name.name.replace('Offset', '');
|
|
108
|
+
const value = node.value.type === 'JSXExpressionContainer' ? node.value.expression : node.value;
|
|
109
|
+
offset.properties.push(j.property('init', j.identifier(breakpoint), value));
|
|
110
|
+
});
|
|
111
|
+
spreadProps.forEach(spreadProp => {
|
|
112
|
+
const spreadPropArgument = spreadProp.argument;
|
|
113
|
+
if (spreadPropArgument.type === 'ObjectExpression') {
|
|
114
|
+
const propertiesToPrune = [];
|
|
115
|
+
spreadPropArgument.properties.forEach(property => {
|
|
116
|
+
const breakpoint = property.key.name.replace('Offset', '');
|
|
117
|
+
if (property.key.name.endsWith('Offset') && breakpoints.includes(breakpoint)) {
|
|
118
|
+
offset.properties.push(j.property('init', j.identifier(breakpoint), property.value));
|
|
119
|
+
propertiesToPrune.push(property.key.name);
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
spreadPropArgument.properties = spreadPropArgument.properties.filter(prop => !propertiesToPrune.includes(prop.key.name));
|
|
123
|
+
if (spreadPropArgument.properties.length === 0) {
|
|
124
|
+
attributesToPrune.push(spreadProp);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
if (offset.properties.length) {
|
|
129
|
+
let offsetPropValue = offset;
|
|
130
|
+
if (offset.properties.length === 1 && offset.properties[0].key.name === 'xs') {
|
|
131
|
+
offsetPropValue = offset.properties[0].value;
|
|
132
|
+
}
|
|
133
|
+
if (offsetPropValue.type !== 'StringLiteral') {
|
|
134
|
+
offsetPropValue = j.jsxExpressionContainer(offsetPropValue);
|
|
135
|
+
}
|
|
136
|
+
el.node.openingElement.attributes.push(j.jsxAttribute(j.jsxIdentifier('offset'), offsetPropValue));
|
|
137
|
+
}
|
|
138
|
+
el.node.openingElement.attributes = el.node.openingElement.attributes.filter(attr => !breakpoints.includes(attr?.name?.name.replace('Offset', '')));
|
|
139
|
+
el.node.openingElement.attributes = el.node.openingElement.attributes.filter(attr => !attributesToPrune.includes(attr));
|
|
140
|
+
const itemProp = el.node.openingElement.attributes.find(attr => attr.type === 'JSXAttribute' && attr.name.name === 'item');
|
|
141
|
+
if (itemProp) {
|
|
142
|
+
el.node.openingElement.attributes = el.node.openingElement.attributes.filter(attr => attr.type === 'JSXAttribute' && attr.name.name !== 'item');
|
|
143
|
+
}
|
|
144
|
+
const zeroMinWidthProp = el.node.openingElement.attributes.find(attr => attr.type === 'JSXAttribute' && attr.name.name === 'zeroMinWidth');
|
|
145
|
+
if (zeroMinWidthProp) {
|
|
146
|
+
el.node.openingElement.attributes = el.node.openingElement.attributes.filter(attr => attr.type === 'JSXAttribute' && attr.name.name !== 'zeroMinWidth');
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
return root.toSource(printOptions);
|
|
150
|
+
}
|
|
@@ -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 _gridProps.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
var _gridProps = _interopRequireDefault(require("./grid-props"));
|
|
@@ -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
|
+
xs: 2
|
|
15
|
+
});
|
|
16
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid2.default, {
|
|
17
|
+
xs: 2
|
|
18
|
+
});
|
|
19
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid3.default, {
|
|
20
|
+
xs: 2
|
|
21
|
+
});
|
|
22
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Grid, {
|
|
23
|
+
xs: 2
|
|
24
|
+
});
|
|
25
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_system.Grid, {
|
|
26
|
+
xs: 2
|
|
27
|
+
});
|
|
28
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_joy.Grid, {
|
|
29
|
+
xs: 2
|
|
30
|
+
});
|
|
31
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
32
|
+
item: true
|
|
33
|
+
});
|
|
34
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
35
|
+
item: true
|
|
36
|
+
});
|
|
37
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
38
|
+
item: false
|
|
39
|
+
});
|
|
40
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
41
|
+
zeroMinWidth: true
|
|
42
|
+
});
|
|
43
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
44
|
+
zeroMinWidth: true
|
|
45
|
+
});
|
|
46
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
47
|
+
zeroMinWidth: false
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
// Transforms responsive sizes
|
|
51
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
52
|
+
xs: 2,
|
|
53
|
+
sm: 4,
|
|
54
|
+
md: 6,
|
|
55
|
+
lg: 8,
|
|
56
|
+
xl: 10
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
// Transforms all the possible size values
|
|
60
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
61
|
+
xs: true,
|
|
62
|
+
sm: "auto",
|
|
63
|
+
md: 2,
|
|
64
|
+
lg: true,
|
|
65
|
+
xl: false
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
// Doesn't add jsx object expression for single string values
|
|
69
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
70
|
+
xs: "auto"
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
// Transforms offset
|
|
74
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
75
|
+
xsOffset: 2
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
// Transforms responsive offset
|
|
79
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
80
|
+
xsOffset: 2,
|
|
81
|
+
smOffset: 4,
|
|
82
|
+
mdOffset: 6,
|
|
83
|
+
lgOffset: 8,
|
|
84
|
+
xlOffset: 10
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
// Transforms all the possible offset values
|
|
88
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
89
|
+
xsOffset: 2,
|
|
90
|
+
smOffset: "auto"
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
// Transforms spread props
|
|
94
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
95
|
+
xs: 2,
|
|
96
|
+
sm: 4,
|
|
97
|
+
xsOffset: 0,
|
|
98
|
+
smOffset: 2
|
|
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,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _Grid = _interopRequireDefault(require("@mui/material/Grid"));
|
|
5
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
6
|
+
// Transforms custom breakpoints
|
|
7
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
8
|
+
customXs: 2,
|
|
9
|
+
customSm: 4,
|
|
10
|
+
customMd: 6
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
// Transforms custom breakpoints offset
|
|
14
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
15
|
+
customXsOffset: 2,
|
|
16
|
+
customSmOffset: 4,
|
|
17
|
+
customMdOffset: 6
|
|
18
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _Grid = _interopRequireDefault(require("@mui/material/Grid"));
|
|
5
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
6
|
+
// Transforms custom breakpoints
|
|
7
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
8
|
+
size: {
|
|
9
|
+
customXs: 2,
|
|
10
|
+
customSm: 4,
|
|
11
|
+
customMd: 6
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
// Transforms custom breakpoints offset
|
|
16
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
17
|
+
offset: {
|
|
18
|
+
customXs: 2,
|
|
19
|
+
customSm: 4,
|
|
20
|
+
customMd: 6
|
|
21
|
+
}
|
|
22
|
+
});
|