@mui/codemod 5.11.0 → 5.11.6
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 +76 -0
- package/node/v5.0.0/joy-avatar-remove-imgProps.js +68 -0
- package/node/v5.0.0/joy-avatar-remove-imgProps.test/actual.js +32 -0
- package/node/v5.0.0/joy-avatar-remove-imgProps.test/expected.js +32 -0
- package/node/v5.0.0/joy-text-field-to-input.js +152 -0
- package/node/v5.0.0/joy-text-field-to-input.test/actual.js +48 -0
- package/node/v5.0.0/joy-text-field-to-input.test/expected.js +42 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -62,6 +62,82 @@ npx @mui/codemod <transform> <path> --jscodeshift="--printOptions='{\"quote\":\"
|
|
|
62
62
|
|
|
63
63
|
### v5.0.0
|
|
64
64
|
|
|
65
|
+
#### `joy-avatar-remove-imgProps`
|
|
66
|
+
|
|
67
|
+
Remove `imgProps` prop by transferring its value into `slotProps.img`
|
|
68
|
+
|
|
69
|
+
This change only affects Joy UI Avatar component.
|
|
70
|
+
|
|
71
|
+
```diff
|
|
72
|
+
<Avatar
|
|
73
|
+
- imgProps={{ ['data-id']: 'imageId' }}
|
|
74
|
+
- slotProps={{ root: { ['data-id']: 'rootId' }}}
|
|
75
|
+
+ slotProps={{ root: { ['data-id']: 'rootId' }, img: { ['data-id']: 'imageId' } }}
|
|
76
|
+
/>;
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
```sh
|
|
80
|
+
npx @mui/codemod v5.0.0/joy-avatar-remove-imgProps <path>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
#### `joy-text-field-to-input`
|
|
84
|
+
|
|
85
|
+
Replace `<TextField>` with composition of `Input`
|
|
86
|
+
|
|
87
|
+
This change only affects Joy UI components.
|
|
88
|
+
|
|
89
|
+
```diff
|
|
90
|
+
-import TextField from '@mui/joy/TextField';
|
|
91
|
+
+import FormControl from '@mui/joy/FormControl';
|
|
92
|
+
+import FormLabel from '@mui/joy/FormLabel';
|
|
93
|
+
+import FormHelperText from '@mui/joy/FormHelperText';
|
|
94
|
+
+import Input from '@mui/joy/Input';
|
|
95
|
+
|
|
96
|
+
-<TextField
|
|
97
|
+
- id="Id"
|
|
98
|
+
- label="Label"
|
|
99
|
+
- placeholder="Placeholder"
|
|
100
|
+
- helperText="Help!"
|
|
101
|
+
- name="Name"
|
|
102
|
+
- type="tel"
|
|
103
|
+
- autoComplete="on"
|
|
104
|
+
- autoFocus
|
|
105
|
+
- error
|
|
106
|
+
- required
|
|
107
|
+
- fullWidth
|
|
108
|
+
- defaultValue="DefaultValue"
|
|
109
|
+
- size="sm"
|
|
110
|
+
- color="primary"
|
|
111
|
+
- variant="outlined"
|
|
112
|
+
-/>
|
|
113
|
+
+<FormControl
|
|
114
|
+
+ id="Id"
|
|
115
|
+
+ required
|
|
116
|
+
+ size="sm"
|
|
117
|
+
+ color="primary">
|
|
118
|
+
+ <FormLabel>
|
|
119
|
+
+ Label
|
|
120
|
+
+ </FormLabel>
|
|
121
|
+
+ <JoyInput
|
|
122
|
+
+ placeholder="Placeholder"
|
|
123
|
+
+ name="Name"
|
|
124
|
+
+ type="tel"
|
|
125
|
+
+ autoComplete="on"
|
|
126
|
+
+ autoFocus
|
|
127
|
+
+ error
|
|
128
|
+
+ fullWidth
|
|
129
|
+
+ defaultValue="DefaultValue"
|
|
130
|
+
+ variant="outlined" />
|
|
131
|
+
+ <FormHelperText id="Id-helper-text">
|
|
132
|
+
+ Help!
|
|
133
|
+
+ </FormHelperText>
|
|
134
|
+
+</FormControl>
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
```sh
|
|
138
|
+
npx @mui/codemod v5.0.0/joy-text-field-to-input <path>
|
|
139
|
+
```
|
|
140
|
+
|
|
65
141
|
#### `joy-rename-components-to-slots`
|
|
66
142
|
|
|
67
143
|
Renames the `components` and `componentsProps` props to `slots` and `slotProps`, respectively.
|
|
@@ -0,0 +1,68 @@
|
|
|
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 root = j(file.source);
|
|
14
|
+
const printOptions = options.printOptions;
|
|
15
|
+
root.find(j.ImportDeclaration).filter(({
|
|
16
|
+
node
|
|
17
|
+
}) => {
|
|
18
|
+
const sourceVal = node.source.value;
|
|
19
|
+
return ['@mui/joy',
|
|
20
|
+
// Process only Joy UI components
|
|
21
|
+
'@mui/joy/Avatar' // Filter default imports of components other than `Avatar`
|
|
22
|
+
].includes(sourceVal);
|
|
23
|
+
}).forEach(path => {
|
|
24
|
+
path.node.specifiers.forEach(elementNode => {
|
|
25
|
+
var _elementNode$imported;
|
|
26
|
+
if (elementNode.type === 'ImportSpecifier' && ((_elementNode$imported = elementNode.imported) == null ? void 0 : _elementNode$imported.name) === 'Avatar' || elementNode.type === 'ImportDefaultSpecifier') {
|
|
27
|
+
// Process only Joy `Avatar` component
|
|
28
|
+
root.findJSXElements(elementNode.local.name).forEach(elementPath => {
|
|
29
|
+
if (elementPath.node.type !== 'JSXElement') {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const slotPropsAttributeNode = elementPath.node.openingElement.attributes.find(attributeNode => {
|
|
33
|
+
var _attributeNode$value$;
|
|
34
|
+
return attributeNode.type === 'JSXAttribute' && attributeNode.name.name === 'slotProps' && ((_attributeNode$value$ = attributeNode.value.expression) == null ? void 0 : _attributeNode$value$.type) === 'ObjectExpression';
|
|
35
|
+
});
|
|
36
|
+
const newAttributeNodes = [];
|
|
37
|
+
elementPath.node.openingElement.attributes.forEach(attributeNode => {
|
|
38
|
+
if (attributeNode.type !== 'JSXAttribute') {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (attributeNode.name.name !== 'imgProps') {
|
|
42
|
+
newAttributeNodes.push(attributeNode);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const val = attributeNode.value;
|
|
46
|
+
if (!(val != null && val.expression)) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (slotPropsAttributeNode) {
|
|
50
|
+
const imgObjInSlotProps = slotPropsAttributeNode.value.expression.properties.find(propNode => propNode.key.name === 'img' && propNode.value.type === 'ObjectExpression');
|
|
51
|
+
if (imgObjInSlotProps) {
|
|
52
|
+
const newProperties = [...imgObjInSlotProps.value.properties, ...attributeNode.value.expression.properties];
|
|
53
|
+
imgObjInSlotProps.value.properties = newProperties;
|
|
54
|
+
} else {
|
|
55
|
+
slotPropsAttributeNode.value.expression.properties.push(j.objectProperty(j.identifier('img'), attributeNode.value));
|
|
56
|
+
}
|
|
57
|
+
} else {
|
|
58
|
+
newAttributeNodes.push(j.jsxAttribute(j.jsxIdentifier('slotProps'), j.jsxExpressionContainer(j.objectExpression([j.objectProperty(j.identifier('img'), attributeNode.value.expression)]))));
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
elementPath.node.openingElement.attributes = newAttributeNodes;
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
const transformed = root.findJSXElements();
|
|
67
|
+
return transformed.toSource(printOptions);
|
|
68
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _joy = require("@mui/joy");
|
|
5
|
+
var _Avatar = _interopRequireDefault(require("@mui/joy/Avatar"));
|
|
6
|
+
var _Avatar2 = _interopRequireDefault(require("@mui/material/Avatar"));
|
|
7
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
+
// the codemod should transform only Joy UI `Avatar`;
|
|
9
|
+
|
|
10
|
+
/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
11
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_joy.Avatar, {
|
|
12
|
+
imgProps: {
|
|
13
|
+
['aria-hidden']: true
|
|
14
|
+
}
|
|
15
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Avatar.default, {
|
|
16
|
+
slotProps: {
|
|
17
|
+
root: {
|
|
18
|
+
['aria-hidden']: false
|
|
19
|
+
},
|
|
20
|
+
img: {
|
|
21
|
+
['aria-label']: 'imgSlot'
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
imgProps: {
|
|
25
|
+
['aria-hidden']: true
|
|
26
|
+
}
|
|
27
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Avatar2.default, {
|
|
28
|
+
imgProps: {
|
|
29
|
+
['aria-hidden']: true
|
|
30
|
+
}
|
|
31
|
+
})]
|
|
32
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _joy = require("@mui/joy");
|
|
5
|
+
var _Avatar = _interopRequireDefault(require("@mui/joy/Avatar"));
|
|
6
|
+
var _Avatar2 = _interopRequireDefault(require("@mui/material/Avatar"));
|
|
7
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
+
// the codemod should transform only Joy UI `Avatar`;
|
|
9
|
+
|
|
10
|
+
/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
11
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_joy.Avatar, {
|
|
12
|
+
slotProps: {
|
|
13
|
+
img: {
|
|
14
|
+
['aria-hidden']: true
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Avatar.default, {
|
|
18
|
+
slotProps: {
|
|
19
|
+
root: {
|
|
20
|
+
['aria-hidden']: false
|
|
21
|
+
},
|
|
22
|
+
img: {
|
|
23
|
+
['aria-label']: 'imgSlot',
|
|
24
|
+
['aria-hidden']: true
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Avatar2.default, {
|
|
28
|
+
imgProps: {
|
|
29
|
+
['aria-hidden']: true
|
|
30
|
+
}
|
|
31
|
+
})]
|
|
32
|
+
});
|
|
@@ -0,0 +1,152 @@
|
|
|
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 root = j(file.source);
|
|
14
|
+
const printOptions = options.printOptions;
|
|
15
|
+
root.find(j.ImportDeclaration).filter(({
|
|
16
|
+
node
|
|
17
|
+
}) => {
|
|
18
|
+
const sourceVal = node.source.value;
|
|
19
|
+
if (sourceVal === '@mui/joy/TextField') {
|
|
20
|
+
node.source.value = '@mui/joy/Input';
|
|
21
|
+
}
|
|
22
|
+
return ['@mui/joy',
|
|
23
|
+
// Process only Joy UI components
|
|
24
|
+
'@mui/joy/TextField' // Filter default imports of components other than TextField
|
|
25
|
+
].includes(sourceVal);
|
|
26
|
+
}).forEach(path => {
|
|
27
|
+
path.node.specifiers.forEach(elementNode => {
|
|
28
|
+
var _elementNode$imported;
|
|
29
|
+
if (elementNode.type === 'ImportSpecifier' && ((_elementNode$imported = elementNode.imported) == null ? void 0 : _elementNode$imported.name) === 'TextField' || elementNode.type === 'ImportDefaultSpecifier') {
|
|
30
|
+
var _elementNode$imported2;
|
|
31
|
+
if (((_elementNode$imported2 = elementNode.imported) == null ? void 0 : _elementNode$imported2.name) === 'TextField') {
|
|
32
|
+
elementNode.imported.name = 'Input';
|
|
33
|
+
}
|
|
34
|
+
let newElementName;
|
|
35
|
+
root.findJSXElements(elementNode.local.name).forEach(elementPath => {
|
|
36
|
+
if (elementPath.node.type !== 'JSXElement') {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
newElementName = elementPath.node.openingElement.name.name.replace(/TextField/gm, 'Input');
|
|
40
|
+
elementPath.node.openingElement.name.name = newElementName;
|
|
41
|
+
const formControlAttributeNodes = [];
|
|
42
|
+
const formLabelAttributeNodes = [];
|
|
43
|
+
const formHelperTextAttributeNodes = [];
|
|
44
|
+
const inputAttributeNodes = [];
|
|
45
|
+
let formLabelValue;
|
|
46
|
+
let formHelperTextValue;
|
|
47
|
+
elementPath.node.openingElement.attributes.forEach(attributeNode => {
|
|
48
|
+
var _attributeNode$value$, _attributeNode$value$2;
|
|
49
|
+
if (attributeNode.type !== 'JSXAttribute') {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const attributeName = attributeNode.name.name;
|
|
53
|
+
switch (attributeName) {
|
|
54
|
+
case 'size':
|
|
55
|
+
case 'color':
|
|
56
|
+
case 'required':
|
|
57
|
+
formControlAttributeNodes.push(attributeNode);
|
|
58
|
+
break;
|
|
59
|
+
case 'slotProps':
|
|
60
|
+
if (((_attributeNode$value$ = attributeNode.value.expression) == null ? void 0 : _attributeNode$value$.type) === 'ObjectExpression') {
|
|
61
|
+
attributeNode.value.expression.properties.forEach(propNode => {
|
|
62
|
+
if (propNode.value.type !== 'ObjectExpression') {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
propNode.value.properties.forEach(prop => {
|
|
66
|
+
const key = prop.key.value;
|
|
67
|
+
const newAttributeNode = j.jsxAttribute(j.jsxIdentifier(key), j.jsxExpressionContainer(prop.value));
|
|
68
|
+
switch (propNode.key.name) {
|
|
69
|
+
case 'root':
|
|
70
|
+
formControlAttributeNodes.push(newAttributeNode);
|
|
71
|
+
break;
|
|
72
|
+
case 'label':
|
|
73
|
+
formLabelAttributeNodes.push(newAttributeNode);
|
|
74
|
+
break;
|
|
75
|
+
case 'input':
|
|
76
|
+
inputAttributeNodes.push(newAttributeNode);
|
|
77
|
+
break;
|
|
78
|
+
case 'helperText':
|
|
79
|
+
formHelperTextAttributeNodes.push(newAttributeNode);
|
|
80
|
+
break;
|
|
81
|
+
default:
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
break;
|
|
87
|
+
case 'slots':
|
|
88
|
+
if (((_attributeNode$value$2 = attributeNode.value.expression) == null ? void 0 : _attributeNode$value$2.type) === 'ObjectExpression') {
|
|
89
|
+
attributeNode.value.expression.properties.forEach(propNode => {
|
|
90
|
+
const newAttributeNode = j.jsxAttribute(j.jsxIdentifier('component'), j.jsxExpressionContainer(propNode.value));
|
|
91
|
+
switch (propNode.key.name) {
|
|
92
|
+
case 'root':
|
|
93
|
+
formControlAttributeNodes.push(newAttributeNode);
|
|
94
|
+
break;
|
|
95
|
+
case 'label':
|
|
96
|
+
formLabelAttributeNodes.push(newAttributeNode);
|
|
97
|
+
break;
|
|
98
|
+
case 'input':
|
|
99
|
+
inputAttributeNodes.push(newAttributeNode);
|
|
100
|
+
break;
|
|
101
|
+
case 'helperText':
|
|
102
|
+
formHelperTextAttributeNodes.push(newAttributeNode);
|
|
103
|
+
break;
|
|
104
|
+
default:
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
break;
|
|
109
|
+
case 'label':
|
|
110
|
+
formLabelValue = attributeNode.value.value;
|
|
111
|
+
break;
|
|
112
|
+
case 'helperText':
|
|
113
|
+
formHelperTextValue = attributeNode.value.value;
|
|
114
|
+
break;
|
|
115
|
+
case 'id':
|
|
116
|
+
formControlAttributeNodes.push(attributeNode);
|
|
117
|
+
formLabelAttributeNodes.push(j.jsxAttribute(j.jsxIdentifier('id'), j.literal(`${attributeNode.value.value}-label`)));
|
|
118
|
+
formHelperTextAttributeNodes.push(j.jsxAttribute(j.jsxIdentifier('id'), j.literal(`${attributeNode.value.value}-helper-text`)));
|
|
119
|
+
break;
|
|
120
|
+
default:
|
|
121
|
+
}
|
|
122
|
+
if (!['size', 'color', 'slotProps', 'slots', 'label', 'helperText', 'id', 'required'].includes(attributeName)) {
|
|
123
|
+
inputAttributeNodes.push(attributeNode);
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
elementPath.node.openingElement.attributes = inputAttributeNodes;
|
|
127
|
+
if (formControlAttributeNodes.length > 0 || formLabelValue || formHelperTextValue) {
|
|
128
|
+
const formControlIdentifier = j.jsxIdentifier('FormControl');
|
|
129
|
+
const childrenOfFormControl = [];
|
|
130
|
+
if (formLabelValue) {
|
|
131
|
+
const formLabelIdentifier = j.jsxIdentifier('FormLabel');
|
|
132
|
+
const formLabelElement = j.jsxElement(j.jsxOpeningElement(formLabelIdentifier, formLabelAttributeNodes), j.jsxClosingElement(formLabelIdentifier), [j.jsxText('\n'), j.jsxText(formLabelValue), j.jsxText('\n')]);
|
|
133
|
+
childrenOfFormControl.push(formLabelElement, j.jsxText('\n'));
|
|
134
|
+
}
|
|
135
|
+
childrenOfFormControl.push(elementPath.node, j.jsxText('\n'));
|
|
136
|
+
if (formHelperTextValue) {
|
|
137
|
+
const formHelperTextIdentifier = j.jsxIdentifier('FormHelperText');
|
|
138
|
+
const formHelperTextElement = j.jsxElement(j.jsxOpeningElement(formHelperTextIdentifier, formHelperTextAttributeNodes), j.jsxClosingElement(formHelperTextIdentifier), [j.jsxText('\n'), j.jsxText(formHelperTextValue), j.jsxText('\n')]);
|
|
139
|
+
childrenOfFormControl.push(formHelperTextElement);
|
|
140
|
+
}
|
|
141
|
+
elementPath.replace(j.jsxElement(j.jsxOpeningElement(formControlIdentifier, formControlAttributeNodes), j.jsxClosingElement(formControlIdentifier), [j.jsxText('\n'), ...childrenOfFormControl, j.jsxText('\n')]));
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
if (newElementName) {
|
|
145
|
+
elementNode.local.name = newElementName;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
const transformed = root.findJSXElements();
|
|
151
|
+
return transformed.toSource(printOptions);
|
|
152
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _joy = require("@mui/joy");
|
|
5
|
+
var _TextField = _interopRequireDefault(require("@mui/joy/TextField"));
|
|
6
|
+
var _TextField2 = _interopRequireDefault(require("@mui/material/TextField"));
|
|
7
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
+
// the codemod should transform only Joy TextField
|
|
9
|
+
|
|
10
|
+
/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
11
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_joy.TextField, {
|
|
12
|
+
slotProps: {
|
|
13
|
+
root: {
|
|
14
|
+
['aria-hidden']: false
|
|
15
|
+
},
|
|
16
|
+
label: {
|
|
17
|
+
['aria-hidden']: false
|
|
18
|
+
},
|
|
19
|
+
input: {
|
|
20
|
+
['aria-hidden']: false
|
|
21
|
+
},
|
|
22
|
+
helperText: {
|
|
23
|
+
['aria-hidden']: false
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
slots: {
|
|
27
|
+
root: 'span',
|
|
28
|
+
label: 'span',
|
|
29
|
+
input: 'span',
|
|
30
|
+
helperText: 'span'
|
|
31
|
+
},
|
|
32
|
+
id: "Id",
|
|
33
|
+
label: "Label",
|
|
34
|
+
placeholder: "Placeholder",
|
|
35
|
+
helperText: "Help!",
|
|
36
|
+
name: "Name",
|
|
37
|
+
type: "button",
|
|
38
|
+
autoComplete: "on",
|
|
39
|
+
autoFocus: true,
|
|
40
|
+
error: true,
|
|
41
|
+
required: true,
|
|
42
|
+
fullWidth: true,
|
|
43
|
+
defaultValue: "DefaultValue",
|
|
44
|
+
size: "sm",
|
|
45
|
+
color: "primary",
|
|
46
|
+
variant: "outlined"
|
|
47
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField2.default, {})]
|
|
48
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _joy = require("@mui/joy");
|
|
5
|
+
var _Input = _interopRequireDefault(require("@mui/joy/Input"));
|
|
6
|
+
var _TextField = _interopRequireDefault(require("@mui/material/TextField"));
|
|
7
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
+
// the codemod should transform only Joy TextField
|
|
9
|
+
|
|
10
|
+
/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
11
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(FormControl, {
|
|
12
|
+
"aria-hidden": false,
|
|
13
|
+
component: 'span',
|
|
14
|
+
id: "Id",
|
|
15
|
+
required: true,
|
|
16
|
+
size: "sm",
|
|
17
|
+
color: "primary",
|
|
18
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(FormLabel, {
|
|
19
|
+
"aria-hidden": false,
|
|
20
|
+
component: 'span',
|
|
21
|
+
id: "Id-label",
|
|
22
|
+
children: "Label"
|
|
23
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_joy.Input, {
|
|
24
|
+
"aria-hidden": false,
|
|
25
|
+
component: 'span',
|
|
26
|
+
placeholder: "Placeholder",
|
|
27
|
+
name: "Name",
|
|
28
|
+
type: "button",
|
|
29
|
+
autoComplete: "on",
|
|
30
|
+
autoFocus: true,
|
|
31
|
+
error: true,
|
|
32
|
+
fullWidth: true,
|
|
33
|
+
defaultValue: "DefaultValue",
|
|
34
|
+
variant: "outlined"
|
|
35
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(FormHelperText, {
|
|
36
|
+
"aria-hidden": false,
|
|
37
|
+
component: 'span',
|
|
38
|
+
id: "Id-helper-text",
|
|
39
|
+
children: "Help!"
|
|
40
|
+
})]
|
|
41
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Input.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {})]
|
|
42
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/codemod",
|
|
3
|
-
"version": "5.11.
|
|
3
|
+
"version": "5.11.6",
|
|
4
4
|
"bin": "./codemod.js",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "MUI Team",
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
"url": "https://opencollective.com/mui"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@babel/core": "^7.20.
|
|
34
|
-
"@babel/runtime": "^7.20.
|
|
35
|
-
"@babel/traverse": "^7.20.
|
|
33
|
+
"@babel/core": "^7.20.7",
|
|
34
|
+
"@babel/runtime": "^7.20.7",
|
|
35
|
+
"@babel/traverse": "^7.20.10",
|
|
36
36
|
"jscodeshift": "^0.13.1",
|
|
37
37
|
"jscodeshift-add-imports": "^1.0.10",
|
|
38
38
|
"yargs": "^17.6.2"
|