@mui/codemod 5.15.9 → 5.15.11
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 +155 -3
- package/codemod.js +80 -7
- package/node/deprecations/accordion-summary-classes/accordion-summary-classes.js +55 -0
- package/node/deprecations/accordion-summary-classes/index.js +13 -0
- package/node/deprecations/accordion-summary-classes/postcss-plugin.js +28 -0
- package/node/deprecations/accordion-summary-classes/postcss.config.js +8 -0
- package/node/deprecations/accordion-summary-classes/test-cases/actual.js +54 -0
- package/node/deprecations/accordion-summary-classes/test-cases/expected.js +54 -0
- package/node/deprecations/alert-props/alert-props.js +22 -0
- package/node/deprecations/alert-props/index.js +13 -0
- package/node/deprecations/alert-props/test-cases/actual.js +43 -0
- package/node/deprecations/alert-props/test-cases/expected.js +33 -0
- package/node/deprecations/alert-props/test-cases/theme.actual.js +52 -0
- package/node/deprecations/alert-props/test-cases/theme.expected.js +42 -0
- package/node/deprecations/all/deprecations-all.js +9 -1
- package/node/deprecations/all/postcss.config.js +11 -0
- package/node/deprecations/avatar-props/avatar-props.js +58 -0
- package/node/deprecations/avatar-props/index.js +13 -0
- package/node/deprecations/avatar-props/test-cases/actual.js +26 -0
- package/node/deprecations/avatar-props/test-cases/expected.js +30 -0
- package/node/deprecations/avatar-props/test-cases/theme.actual.js +12 -0
- package/node/deprecations/avatar-props/test-cases/theme.expected.js +14 -0
- package/node/deprecations/pagination-item-classes/index.js +13 -0
- package/node/deprecations/pagination-item-classes/pagination-item-classes.js +58 -0
- package/node/deprecations/pagination-item-classes/postcss-plugin.js +39 -0
- package/node/deprecations/pagination-item-classes/postcss.config.js +8 -0
- package/node/deprecations/pagination-item-classes/test-cases/actual.js +108 -0
- package/node/deprecations/pagination-item-classes/test-cases/expected.js +108 -0
- package/node/deprecations/utils/replaceComponentsWithSlots.js +184 -0
- package/node/util/findComponentDefaultProps.js +30 -0
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
# @mui/codemod
|
|
2
2
|
|
|
3
|
-
> Codemod scripts for MUI
|
|
3
|
+
> Codemod scripts for Material UI, Base UI, MUI System, Joy UI.
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@mui/codemod)
|
|
6
6
|
[](https://www.npmjs.com/package/@mui/codemod)
|
|
7
7
|
|
|
8
8
|
This repository contains a collection of codemod scripts based for use with
|
|
9
|
-
[jscodeshift](https://github.com/facebook/jscodeshift) that help update
|
|
9
|
+
[jscodeshift](https://github.com/facebook/jscodeshift) that help update the APIs.
|
|
10
|
+
Some of the codemods also run [postcss](https://github.com/postcss/postcss) plugins to update CSS files.
|
|
10
11
|
|
|
11
12
|
## Setup & run
|
|
12
13
|
|
|
@@ -91,6 +92,92 @@ A combination of all deprecations.
|
|
|
91
92
|
npx @mui/codemod@latest deprecations/accordion-props <path>
|
|
92
93
|
```
|
|
93
94
|
|
|
95
|
+
#### `accordion-summary-classes`
|
|
96
|
+
|
|
97
|
+
JS transforms:
|
|
98
|
+
|
|
99
|
+
```diff
|
|
100
|
+
import { accordionSummaryClasses } from '@mui/material/AccordionSummary';
|
|
101
|
+
|
|
102
|
+
MuiAccordionSummary: {
|
|
103
|
+
styleOverrides: {
|
|
104
|
+
root: {
|
|
105
|
+
- [`& .${accordionSummaryClasses.contentGutters}`]: {
|
|
106
|
+
+ [`&.${accordionSummaryClasses.gutters} .${accordionSummaryClasses.content}`]: {
|
|
107
|
+
color: 'red',
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
```diff
|
|
115
|
+
MuiAccordionSummary: {
|
|
116
|
+
styleOverrides: {
|
|
117
|
+
root: {
|
|
118
|
+
- '& .MuiAccordionSummary-contentGutters': {
|
|
119
|
+
+ '&.MuiAccordionSummary-gutters .MuiAccordionSummary-content': {
|
|
120
|
+
color: 'red',
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
CSS transforms:
|
|
128
|
+
|
|
129
|
+
```diff
|
|
130
|
+
-.MuiAccordionSummary-root .MuiAccordionSummary-contentGutters
|
|
131
|
+
+.MuiAccordionSummary-root.MuiAccordionSummary-gutters .MuiAccordionSummary-content
|
|
132
|
+
/>
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
npx @mui/codemod@latest deprecations/accordion-summary-classes <path>
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
#### `alert-props`
|
|
140
|
+
|
|
141
|
+
```diff
|
|
142
|
+
<Alert
|
|
143
|
+
- components={{ CloseButton: CustomButton }}
|
|
144
|
+
+ slots={{ closeButton: CustomButton }}
|
|
145
|
+
- componentsProps={{ closeButton: { testid: 'test-id' } }}
|
|
146
|
+
+ slotProps={{ closeButton: { testid: 'test-id' } }}
|
|
147
|
+
/>
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
```diff
|
|
151
|
+
MuiAlert: {
|
|
152
|
+
defaultProps: {
|
|
153
|
+
- components: { CloseButton: CustomButton }
|
|
154
|
+
+ slots: { closeButton: CustomButton },
|
|
155
|
+
- componentsProps: { closeButton: { testid: 'test-id' }}
|
|
156
|
+
+ slotProps: { closeButton: { testid: 'test-id' } },
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
npx @mui/codemod@latest deprecations/alert-props <path>
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
#### `avatar-props`
|
|
166
|
+
|
|
167
|
+
```diff
|
|
168
|
+
<Avatar
|
|
169
|
+
- imgProps={{
|
|
170
|
+
- onError: () => {},
|
|
171
|
+
- onLoad: () => {},
|
|
172
|
+
+ slotProps={{
|
|
173
|
+
+ img: {
|
|
174
|
+
+ onError: () => {},
|
|
175
|
+
+ onLoad: () => {},
|
|
176
|
+
+ }
|
|
177
|
+
}}
|
|
178
|
+
/>;
|
|
179
|
+
```
|
|
180
|
+
|
|
94
181
|
#### `divider-props`
|
|
95
182
|
|
|
96
183
|
```diff
|
|
@@ -104,6 +191,71 @@ npx @mui/codemod@latest deprecations/accordion-props <path>
|
|
|
104
191
|
npx @mui/codemod@latest deprecations/divider-props <path>
|
|
105
192
|
```
|
|
106
193
|
|
|
194
|
+
#### `pagination-item-classes`
|
|
195
|
+
|
|
196
|
+
JS transforms:
|
|
197
|
+
|
|
198
|
+
```diff
|
|
199
|
+
import { paginationItemClasses } from '@mui/material/PaginationItem';
|
|
200
|
+
|
|
201
|
+
MuiPaginationItem: {
|
|
202
|
+
styleOverrides: {
|
|
203
|
+
root: {
|
|
204
|
+
- [`&.${paginationItemClasses.textPrimary}`]: {
|
|
205
|
+
+ [`&.${paginationItemClasses.text}.${paginationItemClasses.colorPrimary}`]: {
|
|
206
|
+
color: 'red',
|
|
207
|
+
},
|
|
208
|
+
- [`&.${paginationItemClasses.textSecondary}`]: {
|
|
209
|
+
+ [`&.${paginationItemClasses.text}.${paginationItemClasses.colorSecondary}`]: {
|
|
210
|
+
color: 'red',
|
|
211
|
+
},
|
|
212
|
+
- [`&.${paginationItemClasses.outlinedPrimary}`]: {
|
|
213
|
+
+ [`&.${paginationItemClasses.outlined}.${paginationItemClasses.colorPrimary}`]: {
|
|
214
|
+
color: 'red',
|
|
215
|
+
},
|
|
216
|
+
- [`&.${paginationItemClasses.outlinedSecondary}`]: {
|
|
217
|
+
+ [`&.${paginationItemClasses.outlined}.${paginationItemClasses.colorSecondary}`]: {
|
|
218
|
+
color: 'red',
|
|
219
|
+
},
|
|
220
|
+
- '&.MuiPaginationItem-textPrimary': {
|
|
221
|
+
+ '&.MuiPaginationItem-text.MuiPaginationItem-colorPrimary': {
|
|
222
|
+
color: 'red',
|
|
223
|
+
},
|
|
224
|
+
- '&.MuiPaginationItem-textSecondary': {
|
|
225
|
+
+ '&.MuiPaginationItem-text.MuiPaginationItem-colorSecondary': {
|
|
226
|
+
color: 'red',
|
|
227
|
+
},
|
|
228
|
+
- '&.MuiPaginationItem-outlinedPrimary': {
|
|
229
|
+
+ '&.MuiPaginationItem-outlined.MuiPaginationItem-colorPrimary': {
|
|
230
|
+
color: 'red',
|
|
231
|
+
},
|
|
232
|
+
- '&.MuiPaginationItem-outlinedSecondary': {
|
|
233
|
+
+ '&.MuiPaginationItem-outlined.MuiPaginationItem-colorSecondary': {
|
|
234
|
+
color: 'red',
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
},
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
CSS transforms:
|
|
242
|
+
|
|
243
|
+
```diff
|
|
244
|
+
-.MuiPaginationItem-textPrimary
|
|
245
|
+
+.MuiPaginationItem-text.MuiPaginationItem-primary
|
|
246
|
+
-.MuiPaginationItem-textSecondary
|
|
247
|
+
+.MuiPaginationItem-text.MuiPaginationItem-secondary
|
|
248
|
+
-.MuiPaginationItem-outlinedPrimary
|
|
249
|
+
+.MuiPaginationItem-outlined.MuiPaginationItem-primary
|
|
250
|
+
-.MuiPaginationItem-outlinedSecondary
|
|
251
|
+
+.MuiPaginationItem-outlined.MuiPaginationItem-secondary
|
|
252
|
+
/>
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
npx @mui/codemod@latest deprecations/pagination-item-classes <path>
|
|
257
|
+
```
|
|
258
|
+
|
|
107
259
|
### v5.0.0
|
|
108
260
|
|
|
109
261
|
#### `base-use-named-exports`
|
|
@@ -1218,7 +1370,7 @@ You can find more details about this breaking change in the migration guide.
|
|
|
1218
1370
|
|
|
1219
1371
|
#### `theme-augment`
|
|
1220
1372
|
|
|
1221
|
-
Adds `DefaultTheme` module augmentation to
|
|
1373
|
+
Adds `DefaultTheme` module augmentation to TypeScript projects.
|
|
1222
1374
|
|
|
1223
1375
|
```bash
|
|
1224
1376
|
npx @mui/codemod@latest v5.0.0/theme-augment <path>
|
package/codemod.js
CHANGED
|
@@ -5,11 +5,15 @@ const { promises: fs } = require('fs');
|
|
|
5
5
|
const path = require('path');
|
|
6
6
|
const yargs = require('yargs');
|
|
7
7
|
const jscodeshiftPackage = require('jscodeshift/package.json');
|
|
8
|
+
const postcssCliPackage = require('postcss-cli/package.json');
|
|
8
9
|
|
|
9
10
|
const jscodeshiftDirectory = path.dirname(require.resolve('jscodeshift'));
|
|
10
11
|
const jscodeshiftExecutable = path.join(jscodeshiftDirectory, jscodeshiftPackage.bin.jscodeshift);
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
const postcssCliDirectory = path.dirname(require.resolve('postcss-cli'));
|
|
14
|
+
const postcssExecutable = path.join(postcssCliDirectory, postcssCliPackage.bin.postcss);
|
|
15
|
+
|
|
16
|
+
async function runJscodeshiftTransform(transform, files, flags, codemodFlags) {
|
|
13
17
|
const paths = [
|
|
14
18
|
path.resolve(__dirname, './src', `${transform}/index.js`),
|
|
15
19
|
path.resolve(__dirname, './src', `${transform}.js`),
|
|
@@ -57,6 +61,8 @@ async function runTransform(transform, files, flags, codemodFlags) {
|
|
|
57
61
|
flags.parser || 'tsx',
|
|
58
62
|
'--ignore-pattern',
|
|
59
63
|
'**/node_modules/**',
|
|
64
|
+
'--ignore-pattern',
|
|
65
|
+
'**/*.css',
|
|
60
66
|
];
|
|
61
67
|
|
|
62
68
|
if (flags.dry) {
|
|
@@ -80,15 +86,82 @@ async function runTransform(transform, files, flags, codemodFlags) {
|
|
|
80
86
|
}
|
|
81
87
|
}
|
|
82
88
|
|
|
89
|
+
const parseCssFilePaths = async (files) => {
|
|
90
|
+
const cssFiles = await Promise.all(
|
|
91
|
+
files.map(async (filePath) => {
|
|
92
|
+
const stat = await fs.stat(filePath);
|
|
93
|
+
if (stat.isDirectory()) {
|
|
94
|
+
return `${filePath}/**/*.css`;
|
|
95
|
+
}
|
|
96
|
+
if (filePath.endsWith('.css')) {
|
|
97
|
+
return filePath;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return null;
|
|
101
|
+
}),
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
return cssFiles.filter(Boolean);
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
async function runPostcssTransform(transform, files) {
|
|
108
|
+
// local postcss plugins are loaded through config files https://github.com/postcss/postcss-load-config/issues/17#issuecomment-253125559
|
|
109
|
+
const paths = [
|
|
110
|
+
path.resolve(__dirname, './src', `${transform}/postcss.config.js`),
|
|
111
|
+
path.resolve(__dirname, './node', `${transform}/postcss.config.js`),
|
|
112
|
+
];
|
|
113
|
+
|
|
114
|
+
let configPath;
|
|
115
|
+
let error;
|
|
116
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
117
|
+
for (const item of paths) {
|
|
118
|
+
try {
|
|
119
|
+
// eslint-disable-next-line no-await-in-loop
|
|
120
|
+
await fs.stat(item);
|
|
121
|
+
error = undefined;
|
|
122
|
+
configPath = item;
|
|
123
|
+
break;
|
|
124
|
+
} catch (srcPathError) {
|
|
125
|
+
error = srcPathError;
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (error) {
|
|
131
|
+
// don't throw if the file is not found, postcss transform is optional
|
|
132
|
+
if (error?.code !== 'ENOENT') {
|
|
133
|
+
throw error;
|
|
134
|
+
}
|
|
135
|
+
} else {
|
|
136
|
+
const cssPaths = await parseCssFilePaths(files);
|
|
137
|
+
|
|
138
|
+
if (cssPaths.length > 0) {
|
|
139
|
+
const args = [
|
|
140
|
+
postcssExecutable,
|
|
141
|
+
...cssPaths,
|
|
142
|
+
'--config',
|
|
143
|
+
configPath,
|
|
144
|
+
'--replace',
|
|
145
|
+
'--verbose',
|
|
146
|
+
];
|
|
147
|
+
|
|
148
|
+
// eslint-disable-next-line no-console -- debug information
|
|
149
|
+
console.log(`Executing command: postcss ${args.join(' ')}`);
|
|
150
|
+
const postcssProcess = childProcess.spawnSync('node', args, { stdio: 'inherit' });
|
|
151
|
+
|
|
152
|
+
if (postcssProcess.error) {
|
|
153
|
+
throw postcssProcess.error;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
83
159
|
function run(argv) {
|
|
84
160
|
const { codemod, paths, ...flags } = argv;
|
|
161
|
+
const files = paths.map((filePath) => path.resolve(filePath));
|
|
85
162
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
paths.map((filePath) => path.resolve(filePath)),
|
|
89
|
-
flags,
|
|
90
|
-
argv._,
|
|
91
|
-
);
|
|
163
|
+
runJscodeshiftTransform(codemod, files, flags, argv._);
|
|
164
|
+
runPostcssTransform(codemod, files);
|
|
92
165
|
}
|
|
93
166
|
|
|
94
167
|
yargs
|
|
@@ -0,0 +1,55 @@
|
|
|
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
|
+
|
|
17
|
+
// contentGutters is a special case as it's applied to the content child
|
|
18
|
+
// but gutters is applied to the parent element, so the gutter class needs to go on the parent
|
|
19
|
+
|
|
20
|
+
root.find(j.ImportDeclaration).filter(path => path.node.source.value.match(/^@mui\/material\/AccordionSummary$/)).forEach(path => {
|
|
21
|
+
path.node.specifiers.forEach(specifier => {
|
|
22
|
+
if (specifier.type === 'ImportSpecifier' && specifier.imported.name === 'accordionSummaryClasses') {
|
|
23
|
+
root.find(j.MemberExpression, {
|
|
24
|
+
object: {
|
|
25
|
+
name: specifier.local.name
|
|
26
|
+
},
|
|
27
|
+
property: {
|
|
28
|
+
name: 'contentGutters'
|
|
29
|
+
}
|
|
30
|
+
}).forEach(memberExpression => {
|
|
31
|
+
const parent = memberExpression.parentPath.parentPath.value;
|
|
32
|
+
if (parent.type === j.TemplateLiteral.name) {
|
|
33
|
+
const memberExpressionIndex = parent.expressions.findIndex(expression => expression === memberExpression.value);
|
|
34
|
+
const precedingTemplateElement = parent.quasis[memberExpressionIndex];
|
|
35
|
+
if (precedingTemplateElement.value.raw.endsWith(' .')) {
|
|
36
|
+
parent.expressions.splice(memberExpressionIndex, 1, j.memberExpression(memberExpression.value.object, j.identifier('gutters')), j.memberExpression(memberExpression.value.object, j.identifier('content')));
|
|
37
|
+
parent.quasis.splice(memberExpressionIndex, 1, j.templateElement({
|
|
38
|
+
raw: precedingTemplateElement.value.raw.replace(' ', ''),
|
|
39
|
+
cooked: precedingTemplateElement.value.cooked.replace(' ', '')
|
|
40
|
+
}, false), j.templateElement({
|
|
41
|
+
raw: ' .',
|
|
42
|
+
cooked: ' .'
|
|
43
|
+
}, false));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
const selectorRegex = new RegExp(`^& ${_postcssPlugin.deprecatedClass}`);
|
|
51
|
+
root.find(j.Literal, literal => typeof literal.value === 'string' && literal.value.match(selectorRegex)).forEach(path => {
|
|
52
|
+
path.replace(j.literal(path.value.value.replace(selectorRegex, `&${_postcssPlugin.replacementSelector}`)));
|
|
53
|
+
});
|
|
54
|
+
return root.toSource(printOptions);
|
|
55
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
Object.defineProperty(exports, "default", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _accordionSummaryClasses.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
var _accordionSummaryClasses = _interopRequireDefault(require("./accordion-summary-classes"));
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const deprecatedClass = '.MuiAccordionSummary-contentGutters';
|
|
4
|
+
const replacementSelector = '.MuiAccordionSummary-gutters .MuiAccordionSummary-content';
|
|
5
|
+
const plugin = () => {
|
|
6
|
+
return {
|
|
7
|
+
postcssPlugin: `Replace ${deprecatedClass} with ${replacementSelector}`,
|
|
8
|
+
Rule(rule) {
|
|
9
|
+
const {
|
|
10
|
+
selector
|
|
11
|
+
} = rule;
|
|
12
|
+
|
|
13
|
+
// contentGutters is a special case as it's applied to the content child
|
|
14
|
+
// but gutters is applied to the parent element, so the gutter class needs to go on the parent
|
|
15
|
+
|
|
16
|
+
const selectorRegex = new RegExp(` ${deprecatedClass}`);
|
|
17
|
+
if (selector.match(selectorRegex)) {
|
|
18
|
+
rule.selector = selector.replace(selectorRegex, replacementSelector);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
plugin.postcss = true;
|
|
24
|
+
module.exports = {
|
|
25
|
+
plugin,
|
|
26
|
+
deprecatedClass,
|
|
27
|
+
replacementSelector
|
|
28
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _AccordionSummary = require("@mui/material/AccordionSummary");
|
|
4
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
5
|
+
fn({
|
|
6
|
+
MuiAccordionSummary: {
|
|
7
|
+
styleOverrides: {
|
|
8
|
+
root: {
|
|
9
|
+
'& .MuiAccordionSummary-contentGutters': {
|
|
10
|
+
color: 'red'
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
fn({
|
|
17
|
+
MuiAccordionSummary: {
|
|
18
|
+
styleOverrides: {
|
|
19
|
+
root: {
|
|
20
|
+
[`& .${_AccordionSummary.accordionSummaryClasses.contentGutters}`]: {
|
|
21
|
+
color: 'red'
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
styled(Component)(() => {
|
|
28
|
+
return {
|
|
29
|
+
'& .MuiAccordionSummary-contentGutters': {
|
|
30
|
+
color: 'red'
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
styled(Component)(() => {
|
|
35
|
+
return {
|
|
36
|
+
[`& .${_AccordionSummary.accordionSummaryClasses.contentGutters}`]: {
|
|
37
|
+
color: 'red'
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(AccordionSummary, {
|
|
42
|
+
sx: {
|
|
43
|
+
'& .MuiAccordionSummary-contentGutters': {
|
|
44
|
+
color: 'red'
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(AccordionSummary, {
|
|
49
|
+
sx: {
|
|
50
|
+
[`& .${_AccordionSummary.accordionSummaryClasses.contentGutters}`]: {
|
|
51
|
+
color: 'red'
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _AccordionSummary = require("@mui/material/AccordionSummary");
|
|
4
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
5
|
+
fn({
|
|
6
|
+
MuiAccordionSummary: {
|
|
7
|
+
styleOverrides: {
|
|
8
|
+
root: {
|
|
9
|
+
'&.MuiAccordionSummary-gutters .MuiAccordionSummary-content': {
|
|
10
|
+
color: 'red'
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
fn({
|
|
17
|
+
MuiAccordionSummary: {
|
|
18
|
+
styleOverrides: {
|
|
19
|
+
root: {
|
|
20
|
+
[`&.${_AccordionSummary.accordionSummaryClasses.gutters} .${_AccordionSummary.accordionSummaryClasses.content}`]: {
|
|
21
|
+
color: 'red'
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
styled(Component)(() => {
|
|
28
|
+
return {
|
|
29
|
+
'&.MuiAccordionSummary-gutters .MuiAccordionSummary-content': {
|
|
30
|
+
color: 'red'
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
styled(Component)(() => {
|
|
35
|
+
return {
|
|
36
|
+
[`&.${_AccordionSummary.accordionSummaryClasses.gutters} .${_AccordionSummary.accordionSummaryClasses.content}`]: {
|
|
37
|
+
color: 'red'
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(AccordionSummary, {
|
|
42
|
+
sx: {
|
|
43
|
+
'&.MuiAccordionSummary-gutters .MuiAccordionSummary-content': {
|
|
44
|
+
color: 'red'
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(AccordionSummary, {
|
|
49
|
+
sx: {
|
|
50
|
+
[`&.${_AccordionSummary.accordionSummaryClasses.gutters} .${_AccordionSummary.accordionSummaryClasses.content}`]: {
|
|
51
|
+
color: 'red'
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = transformer;
|
|
8
|
+
var _replaceComponentsWithSlots = _interopRequireDefault(require("../utils/replaceComponentsWithSlots"));
|
|
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, _replaceComponentsWithSlots.default)(j, {
|
|
18
|
+
root,
|
|
19
|
+
componentName: 'Alert'
|
|
20
|
+
});
|
|
21
|
+
return root.toSource(printOptions);
|
|
22
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
Object.defineProperty(exports, "default", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _alertProps.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
var _alertProps = _interopRequireDefault(require("./alert-props"));
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _Alert = _interopRequireDefault(require("@mui/material/Alert"));
|
|
5
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
6
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Alert.default, {
|
|
7
|
+
components: {
|
|
8
|
+
CloseButton: ComponentsButton
|
|
9
|
+
},
|
|
10
|
+
componentsProps: {
|
|
11
|
+
closeButton: componentsButtonProps
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Alert.default, {
|
|
15
|
+
slots: {
|
|
16
|
+
closeIcon: SlotsIcon
|
|
17
|
+
},
|
|
18
|
+
components: {
|
|
19
|
+
CloseButton: ComponentsButton
|
|
20
|
+
},
|
|
21
|
+
slotProps: {
|
|
22
|
+
closeIcon: slotsIconProps
|
|
23
|
+
},
|
|
24
|
+
componentsProps: {
|
|
25
|
+
closeButton: componentsButtonProps
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Alert.default, {
|
|
29
|
+
slots: {
|
|
30
|
+
closeIcon: SlotsIcon,
|
|
31
|
+
closeButton: SlotsButton
|
|
32
|
+
},
|
|
33
|
+
components: {
|
|
34
|
+
CloseButton: ComponentsButton
|
|
35
|
+
},
|
|
36
|
+
slotProps: {
|
|
37
|
+
closeIcon: slotsIconProps,
|
|
38
|
+
closeButton: slotsButtonProps
|
|
39
|
+
},
|
|
40
|
+
componentsProps: {
|
|
41
|
+
closeButton: componentsButtonProps
|
|
42
|
+
}
|
|
43
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _Alert = _interopRequireDefault(require("@mui/material/Alert"));
|
|
5
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
6
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Alert.default, {
|
|
7
|
+
slots: {
|
|
8
|
+
closeButton: ComponentsButton
|
|
9
|
+
},
|
|
10
|
+
slotProps: {
|
|
11
|
+
closeButton: componentsButtonProps
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Alert.default, {
|
|
15
|
+
slots: {
|
|
16
|
+
closeIcon: SlotsIcon,
|
|
17
|
+
closeButton: ComponentsButton
|
|
18
|
+
},
|
|
19
|
+
slotProps: {
|
|
20
|
+
closeIcon: slotsIconProps,
|
|
21
|
+
closeButton: componentsButtonProps
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Alert.default, {
|
|
25
|
+
slots: {
|
|
26
|
+
closeIcon: SlotsIcon,
|
|
27
|
+
closeButton: SlotsButton
|
|
28
|
+
},
|
|
29
|
+
slotProps: {
|
|
30
|
+
closeIcon: slotsIconProps,
|
|
31
|
+
closeButton: slotsButtonProps
|
|
32
|
+
}
|
|
33
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
fn({
|
|
4
|
+
MuiAlert: {
|
|
5
|
+
defaultProps: {
|
|
6
|
+
components: {
|
|
7
|
+
CloseButton: ComponentsButton
|
|
8
|
+
},
|
|
9
|
+
componentsProps: {
|
|
10
|
+
closeButton: componentsButtonProps
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
fn({
|
|
16
|
+
MuiAlert: {
|
|
17
|
+
defaultProps: {
|
|
18
|
+
components: {
|
|
19
|
+
CloseButton: ComponentsButton
|
|
20
|
+
},
|
|
21
|
+
slots: {
|
|
22
|
+
closeIcon: SlotsIcon
|
|
23
|
+
},
|
|
24
|
+
componentsProps: {
|
|
25
|
+
closeButton: componentsButtonProps
|
|
26
|
+
},
|
|
27
|
+
slotProps: {
|
|
28
|
+
closeIcon: slotsIconProps
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
fn({
|
|
34
|
+
MuiAlert: {
|
|
35
|
+
defaultProps: {
|
|
36
|
+
components: {
|
|
37
|
+
CloseButton: ComponentsButton
|
|
38
|
+
},
|
|
39
|
+
slots: {
|
|
40
|
+
closeIcon: SlotsIcon,
|
|
41
|
+
closeButton: SlotsButton
|
|
42
|
+
},
|
|
43
|
+
componentsProps: {
|
|
44
|
+
closeButton: componentsButtonProps
|
|
45
|
+
},
|
|
46
|
+
slotProps: {
|
|
47
|
+
closeIcon: slotsIconProps,
|
|
48
|
+
closeButton: slotsButtonProps
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
});
|