@mui/codemod 6.0.0-alpha.8 → 6.0.0-alpha.9
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 +219 -45
- package/node/deprecations/all/deprecations-all.js +4 -0
- package/node/deprecations/avatar-group-props/avatar-group-props.js +87 -0
- package/node/deprecations/avatar-group-props/index.js +13 -0
- package/node/deprecations/avatar-group-props/test-cases/actual.js +56 -0
- package/node/deprecations/avatar-group-props/test-cases/expected.js +58 -0
- package/node/deprecations/avatar-group-props/test-cases/theme.actual.js +48 -0
- package/node/deprecations/avatar-group-props/test-cases/theme.expected.js +50 -0
- package/node/deprecations/grid-props/grid-props.js +51 -0
- package/node/deprecations/grid-props/index.js +13 -0
- package/node/deprecations/grid-props/test-cases/actual.js +25 -0
- package/node/deprecations/grid-props/test-cases/expected.js +23 -0
- package/node/deprecations/grid-props/test-cases/theme.actual.js +24 -0
- package/node/deprecations/grid-props/test-cases/theme.expected.js +23 -0
- package/node/deprecations/list-item-props/index.js +13 -0
- package/node/deprecations/list-item-props/list-item-props.js +22 -0
- package/node/deprecations/list-item-props/test-cases/actual.js +43 -0
- package/node/deprecations/list-item-props/test-cases/expected.js +40 -0
- package/node/deprecations/list-item-props/test-cases/theme.actual.js +56 -0
- package/node/deprecations/list-item-props/test-cases/theme.expected.js +53 -0
- package/node/deprecations/popper-props/index.js +13 -0
- package/node/deprecations/popper-props/popper-props.js +22 -0
- package/node/deprecations/popper-props/test-cases/actual.js +27 -0
- package/node/deprecations/popper-props/test-cases/expected.js +24 -0
- package/node/deprecations/popper-props/test-cases/theme.actual.js +32 -0
- package/node/deprecations/popper-props/test-cases/theme.expected.js +29 -0
- package/node/deprecations/tooltip-props/index.js +13 -0
- package/node/deprecations/tooltip-props/test-cases/actual.js +92 -0
- package/node/deprecations/tooltip-props/test-cases/expected.js +84 -0
- package/node/deprecations/tooltip-props/test-cases/theme.actual.js +73 -0
- package/node/deprecations/tooltip-props/test-cases/theme.expected.js +65 -0
- package/node/deprecations/tooltip-props/tooltip-props.js +22 -0
- package/node/util/migrateToVariants.js +156 -98
- package/node/v6.0.0/sx-prop/index.js +13 -0
- package/node/v6.0.0/sx-prop/sx-v6.js +355 -0
- package/node/v6.0.0/sx-prop/test-cases/basic-sx.actual.js +36 -0
- package/node/v6.0.0/sx-prop/test-cases/basic-sx.expected.js +46 -0
- package/node/v6.0.0/sx-prop/test-cases/sx-css-vars.actual.js +41 -0
- package/node/v6.0.0/sx-prop/test-cases/sx-css-vars.expected.js +71 -0
- package/node/v6.0.0/sx-prop/test-cases/sx-dynamic.actual.js +87 -0
- package/node/v6.0.0/sx-prop/test-cases/sx-dynamic.expected.js +102 -0
- package/node/v6.0.0/sx-prop/test-cases/sx-dynamic2.actual.js +49 -0
- package/node/v6.0.0/sx-prop/test-cases/sx-dynamic2.expected.js +64 -0
- package/node/v6.0.0/system-props/index.js +13 -0
- package/node/v6.0.0/system-props/removeSystemProps.js +242 -0
- package/node/v6.0.0/system-props/test-cases/system-props.actual.js +79 -0
- package/node/v6.0.0/system-props/test-cases/system-props.expected.js +92 -0
- package/node/v6.0.0/theme-v6/theme-v6.js +2 -2
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -325,6 +325,54 @@ npx @mui/codemod@next deprecations/alert-props <path>
|
|
|
325
325
|
npx @mui/codemod@next deprecations/autocomplete-props <path>
|
|
326
326
|
```
|
|
327
327
|
|
|
328
|
+
#### `avatar-group-props`
|
|
329
|
+
|
|
330
|
+
```diff
|
|
331
|
+
<AvatarGroup
|
|
332
|
+
- componentsProps={{
|
|
333
|
+
- additionalAvatar: {color: "red"}
|
|
334
|
+
+ slotProps={{
|
|
335
|
+
+ surplus: {color: "red"}
|
|
336
|
+
}}
|
|
337
|
+
/>;
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
```diff
|
|
341
|
+
<AvatarGroup
|
|
342
|
+
slotProps={{
|
|
343
|
+
- additionalAvatar: {color: "red"}
|
|
344
|
+
+ surplus: {color: "red"}
|
|
345
|
+
}}
|
|
346
|
+
/>;
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
```diff
|
|
350
|
+
MuiAvatarGroup: {
|
|
351
|
+
defaultProps: {
|
|
352
|
+
- componentsProps: {
|
|
353
|
+
- additionalAvatar: {color: "red"}
|
|
354
|
+
+ slotProps: {
|
|
355
|
+
+ surplus: {color: "red"}
|
|
356
|
+
},
|
|
357
|
+
},
|
|
358
|
+
},
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
```diff
|
|
362
|
+
MuiAvatarGroup: {
|
|
363
|
+
defaultProps: {
|
|
364
|
+
slotProps: {
|
|
365
|
+
- additionalAvatar: {color: "red"}
|
|
366
|
+
+ surplus: {color: "red"}
|
|
367
|
+
},
|
|
368
|
+
},
|
|
369
|
+
},
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
```bash
|
|
373
|
+
npx @mui/codemod@next deprecations/avatar-group-props <path>
|
|
374
|
+
```
|
|
375
|
+
|
|
328
376
|
#### `avatar-props`
|
|
329
377
|
|
|
330
378
|
```diff
|
|
@@ -983,6 +1031,45 @@ npx @mui/codemod@next deprecations/form-control-label-props <path>
|
|
|
983
1031
|
|
|
984
1032
|
```
|
|
985
1033
|
|
|
1034
|
+
#### `list-item-props`
|
|
1035
|
+
|
|
1036
|
+
```diff
|
|
1037
|
+
<ListItem
|
|
1038
|
+
- components={{ Root: CustomRoot }}
|
|
1039
|
+
+ slots={{ root: CustomRoot }}
|
|
1040
|
+
- componentsProps={{ root: { testid: 'test-id' } }}
|
|
1041
|
+
+ slotProps={{ root: { testid: 'test-id' } }}
|
|
1042
|
+
/>
|
|
1043
|
+
```
|
|
1044
|
+
|
|
1045
|
+
```diff
|
|
1046
|
+
MuiListItem: {
|
|
1047
|
+
defaultProps: {
|
|
1048
|
+
- components: { Root: CustomRoot }
|
|
1049
|
+
+ slots: { root: CustomRoot },
|
|
1050
|
+
- componentsProps: { root: { testid: 'test-id' }}
|
|
1051
|
+
+ slotProps: { root: { testid: 'test-id' } },
|
|
1052
|
+
},
|
|
1053
|
+
},
|
|
1054
|
+
```
|
|
1055
|
+
|
|
1056
|
+
```bash
|
|
1057
|
+
npx @mui/codemod@next deprecations/list-item-props <path>
|
|
1058
|
+
```
|
|
1059
|
+
|
|
1060
|
+
#### `grid-props`
|
|
1061
|
+
|
|
1062
|
+
```diff
|
|
1063
|
+
<Grid
|
|
1064
|
+
- wrap="nowrap"
|
|
1065
|
+
+ flexWrap="nowrap"
|
|
1066
|
+
/>
|
|
1067
|
+
```
|
|
1068
|
+
|
|
1069
|
+
```bash
|
|
1070
|
+
npx @mui/codemod@next deprecations/grid-props <path>
|
|
1071
|
+
```
|
|
1072
|
+
|
|
986
1073
|
#### `pagination-item-classes`
|
|
987
1074
|
|
|
988
1075
|
JS transforms:
|
|
@@ -1069,6 +1156,32 @@ npx @mui/codemod@next deprecations/pagination-item-classes <path>
|
|
|
1069
1156
|
npx @mui/codemod@next deprecations/pagination-item-props <path>
|
|
1070
1157
|
```
|
|
1071
1158
|
|
|
1159
|
+
#### `popper-props`
|
|
1160
|
+
|
|
1161
|
+
```diff
|
|
1162
|
+
<Popper
|
|
1163
|
+
- components={{ Root: CustomRoot }}
|
|
1164
|
+
+ slots={{ root: CustomRoot }}
|
|
1165
|
+
- componentsProps={{ root: { testid: 'test-id' } }}
|
|
1166
|
+
+ slotProps={{ root: { testid: 'test-id' } }}
|
|
1167
|
+
/>
|
|
1168
|
+
```
|
|
1169
|
+
|
|
1170
|
+
```diff
|
|
1171
|
+
MuiPopper: {
|
|
1172
|
+
defaultProps: {
|
|
1173
|
+
- components: { Root: CustomRoot }
|
|
1174
|
+
+ slots: { root: CustomRoot },
|
|
1175
|
+
- componentsProps: { root: { testid: 'test-id' }}
|
|
1176
|
+
+ slotProps: { root: { testid: 'test-id' } },
|
|
1177
|
+
},
|
|
1178
|
+
},
|
|
1179
|
+
```
|
|
1180
|
+
|
|
1181
|
+
```bash
|
|
1182
|
+
npx @mui/codemod@next deprecations/popper-props <path>
|
|
1183
|
+
```
|
|
1184
|
+
|
|
1072
1185
|
#### `slider-props`
|
|
1073
1186
|
|
|
1074
1187
|
```diff
|
|
@@ -1095,45 +1208,48 @@ npx @mui/codemod@next deprecations/pagination-item-props <path>
|
|
|
1095
1208
|
npx @mui/codemod@next deprecations/slider-props <path>
|
|
1096
1209
|
```
|
|
1097
1210
|
|
|
1098
|
-
#### `
|
|
1211
|
+
#### `tooltip-props`
|
|
1099
1212
|
|
|
1100
1213
|
```diff
|
|
1101
|
-
<
|
|
1102
|
-
-
|
|
1103
|
-
|
|
1104
|
-
-
|
|
1105
|
-
|
|
1106
|
-
- FormHelperTextProps={CustomFormHelperProps}
|
|
1107
|
-
+ slotProps={{
|
|
1108
|
-
+ input: CustomInputProps
|
|
1109
|
-
+ htmlInput: CustomHtmlInputProps
|
|
1110
|
-
+ select: CustomSelectProps
|
|
1111
|
-
+ inputLabel: CustomInputLabelProps
|
|
1112
|
-
+ formHelper: CustomFormHelperProps
|
|
1113
|
-
+ }}
|
|
1214
|
+
<Tooltip
|
|
1215
|
+
- components={{ Arrow: CustomArrow }}
|
|
1216
|
+
+ slots={{ arrow: CustomArrow }}
|
|
1217
|
+
- componentsProps={{ arrow: { testid: 'test-id' } }}
|
|
1218
|
+
+ slotProps={{ arrow: { testid: 'test-id' } }}
|
|
1114
1219
|
/>
|
|
1115
1220
|
```
|
|
1116
1221
|
|
|
1222
|
+
```diff
|
|
1223
|
+
MuiTooltip: {
|
|
1224
|
+
defaultProps: {
|
|
1225
|
+
- components: { Arrow: CustomArrow }
|
|
1226
|
+
+ slots: { arrow: CustomArrow },
|
|
1227
|
+
- componentsProps: { arrow: { testid: 'test-id' }}
|
|
1228
|
+
+ slotProps: { arrow: { testid: 'test-id' } },
|
|
1229
|
+
},
|
|
1230
|
+
},
|
|
1231
|
+
```
|
|
1232
|
+
|
|
1117
1233
|
```bash
|
|
1118
|
-
npx @mui/codemod@next deprecations/
|
|
1234
|
+
npx @mui/codemod@next deprecations/tooltip-props <path>
|
|
1119
1235
|
```
|
|
1120
1236
|
|
|
1121
|
-
#### `
|
|
1237
|
+
#### `step-connector-classes`
|
|
1122
1238
|
|
|
1123
1239
|
JS transforms:
|
|
1124
1240
|
|
|
1125
1241
|
```diff
|
|
1126
|
-
import {
|
|
1242
|
+
import { stepConnectorClasses } from '@mui/material/StepConnector';
|
|
1127
1243
|
|
|
1128
|
-
|
|
1244
|
+
MuiStepConnector: {
|
|
1129
1245
|
styleOverrides: {
|
|
1130
1246
|
root: {
|
|
1131
|
-
- [`& .${
|
|
1132
|
-
+ [`&.${
|
|
1247
|
+
- [`& .${stepConnectorClasses.lineHorizontal}`]: {
|
|
1248
|
+
+ [`&.${stepConnectorClasses.horizontal} > .${stepConnectorClasses.line}`]: {
|
|
1133
1249
|
color: 'red',
|
|
1134
1250
|
},
|
|
1135
|
-
- [`& .${
|
|
1136
|
-
+ [`&.${
|
|
1251
|
+
- [`& .${stepConnectorClasses.lineVertical}`]: {
|
|
1252
|
+
+ [`&.${stepConnectorClasses.vertical} > .${stepConnectorClasses.line}`]: {
|
|
1137
1253
|
color: 'red',
|
|
1138
1254
|
},
|
|
1139
1255
|
},
|
|
@@ -1141,20 +1257,6 @@ JS transforms:
|
|
|
1141
1257
|
},
|
|
1142
1258
|
```
|
|
1143
1259
|
|
|
1144
|
-
CSS transforms:
|
|
1145
|
-
|
|
1146
|
-
```diff
|
|
1147
|
-
-.MuiToggleButtonGroup-root .MuiToggleButtonGroup-groupedHorizontal
|
|
1148
|
-
+.MuiToggleButtonGroup-root.MuiToggleButtonGroup-horizontal > .MuiToggleButtonGroup-grouped
|
|
1149
|
-
-.MuiToggleButtonGroup-root .MuiToggleButtonGroup-groupedVertical
|
|
1150
|
-
+.MuiToggleButtonGroup-root.MuiToggleButtonGroup-vertical > .MuiToggleButtonGroup-grouped
|
|
1151
|
-
/>
|
|
1152
|
-
```
|
|
1153
|
-
|
|
1154
|
-
```bash
|
|
1155
|
-
npx @mui/codemod@latest deprecations/toggle-button-group-classes <path>
|
|
1156
|
-
```
|
|
1157
|
-
|
|
1158
1260
|
#### `step-label-props`
|
|
1159
1261
|
|
|
1160
1262
|
```diff
|
|
@@ -1183,25 +1285,47 @@ npx @mui/codemod@latest deprecations/toggle-button-group-classes <path>
|
|
|
1183
1285
|
|
|
1184
1286
|
```bash
|
|
1185
1287
|
npx @mui/codemod@latest deprecations/step-label-props <path>
|
|
1288
|
+
```
|
|
1289
|
+
|
|
1290
|
+
#### `text-field-props`
|
|
1291
|
+
|
|
1292
|
+
```diff
|
|
1293
|
+
<TextField
|
|
1294
|
+
- InputProps={CustomInputProps}
|
|
1295
|
+
- inputProps={CustomHtmlInputProps}
|
|
1296
|
+
- SelectProps={CustomSelectProps}
|
|
1297
|
+
- InputLabelProps={CustomInputLabelProps}
|
|
1298
|
+
- FormHelperTextProps={CustomFormHelperProps}
|
|
1299
|
+
+ slotProps={{
|
|
1300
|
+
+ input: CustomInputProps
|
|
1301
|
+
+ htmlInput: CustomHtmlInputProps
|
|
1302
|
+
+ select: CustomSelectProps
|
|
1303
|
+
+ inputLabel: CustomInputLabelProps
|
|
1304
|
+
+ formHelper: CustomFormHelperProps
|
|
1305
|
+
+ }}
|
|
1306
|
+
/>
|
|
1307
|
+
```
|
|
1186
1308
|
|
|
1309
|
+
```bash
|
|
1310
|
+
npx @mui/codemod@next deprecations/text-field-props <path>
|
|
1187
1311
|
```
|
|
1188
1312
|
|
|
1189
|
-
#### `
|
|
1313
|
+
#### `toggle-button-group-classes`
|
|
1190
1314
|
|
|
1191
1315
|
JS transforms:
|
|
1192
1316
|
|
|
1193
1317
|
```diff
|
|
1194
|
-
import {
|
|
1318
|
+
import { toggleButtonGroupClasses } from '@mui/material/ToggleButtonGroup';
|
|
1195
1319
|
|
|
1196
|
-
|
|
1320
|
+
MuiToggleButtonGroup: {
|
|
1197
1321
|
styleOverrides: {
|
|
1198
1322
|
root: {
|
|
1199
|
-
- [`& .${
|
|
1200
|
-
+ [`&.${
|
|
1323
|
+
- [`& .${toggleButtonGroupClasses.groupedHorizontal}`]: {
|
|
1324
|
+
+ [`&.${toggleButtonGroupClasses.horizontal} > .${toggleButtonGroupClasses.grouped}`]: {
|
|
1201
1325
|
color: 'red',
|
|
1202
1326
|
},
|
|
1203
|
-
- [`& .${
|
|
1204
|
-
+ [`&.${
|
|
1327
|
+
- [`& .${toggleButtonGroupClasses.groupedVertical}`]: {
|
|
1328
|
+
+ [`&.${toggleButtonGroupClasses.vertical} > .${toggleButtonGroupClasses.grouped}`]: {
|
|
1205
1329
|
color: 'red',
|
|
1206
1330
|
},
|
|
1207
1331
|
},
|
|
@@ -1211,6 +1335,20 @@ JS transforms:
|
|
|
1211
1335
|
|
|
1212
1336
|
CSS transforms:
|
|
1213
1337
|
|
|
1338
|
+
```diff
|
|
1339
|
+
-.MuiToggleButtonGroup-root .MuiToggleButtonGroup-groupedHorizontal
|
|
1340
|
+
+.MuiToggleButtonGroup-root.MuiToggleButtonGroup-horizontal > .MuiToggleButtonGroup-grouped
|
|
1341
|
+
-.MuiToggleButtonGroup-root .MuiToggleButtonGroup-groupedVertical
|
|
1342
|
+
+.MuiToggleButtonGroup-root.MuiToggleButtonGroup-vertical > .MuiToggleButtonGroup-grouped
|
|
1343
|
+
/>
|
|
1344
|
+
```
|
|
1345
|
+
|
|
1346
|
+
```bash
|
|
1347
|
+
npx @mui/codemod@latest deprecations/toggle-button-group-classes <path>
|
|
1348
|
+
```
|
|
1349
|
+
|
|
1350
|
+
CSS transforms:
|
|
1351
|
+
|
|
1214
1352
|
```diff
|
|
1215
1353
|
- .MuiStepConnector-lineHorizontal
|
|
1216
1354
|
+.MuiStepConnector-horizontal > .MuiStepConnector-line
|
|
@@ -1224,6 +1362,42 @@ npx @mui/codemod@next deprecations/step-connector-classes <path>
|
|
|
1224
1362
|
|
|
1225
1363
|
### v6.0.0
|
|
1226
1364
|
|
|
1365
|
+
#### `sx-prop`
|
|
1366
|
+
|
|
1367
|
+
```bash
|
|
1368
|
+
npx @mui/codemod@next v6.0.0/sx-prop <path>
|
|
1369
|
+
```
|
|
1370
|
+
|
|
1371
|
+
Update the usage of the `sx` prop to be compatible with `@pigment-css/react`.
|
|
1372
|
+
|
|
1373
|
+
```diff
|
|
1374
|
+
<Box
|
|
1375
|
+
- sx={{
|
|
1376
|
+
- backgroundColor: (theme) =>
|
|
1377
|
+
- theme.palette.mode === 'light' ? theme.palette.grey[100] : theme.palette.grey[900],
|
|
1378
|
+
- }}
|
|
1379
|
+
+ sx={theme => ({
|
|
1380
|
+
+ backgroundColor: theme.palette.grey[900],
|
|
1381
|
+
+ ...theme.applyStyles("light", {
|
|
1382
|
+
+ backgroundColor: theme.palette.grey[100]
|
|
1383
|
+
+ })
|
|
1384
|
+
+ })}
|
|
1385
|
+
/>
|
|
1386
|
+
```
|
|
1387
|
+
|
|
1388
|
+
#### `system-props`
|
|
1389
|
+
|
|
1390
|
+
```bash
|
|
1391
|
+
npx @mui/codemod@next v6.0.0/system-props <path>
|
|
1392
|
+
```
|
|
1393
|
+
|
|
1394
|
+
Remove system props and add them to the `sx` prop.
|
|
1395
|
+
|
|
1396
|
+
```diff
|
|
1397
|
+
- <Box ml="2px" py={1} color="primary.main" />
|
|
1398
|
+
+ <Box sx={{ ml: "2px", py: 1, color: 'primary.main' }} />
|
|
1399
|
+
```
|
|
1400
|
+
|
|
1227
1401
|
#### `theme-v6`
|
|
1228
1402
|
|
|
1229
1403
|
```bash
|
|
@@ -1286,10 +1460,10 @@ Update the theme creation from `@mui/system@v5` to be compatible with `@pigment-
|
|
|
1286
1460
|
})
|
|
1287
1461
|
```
|
|
1288
1462
|
|
|
1289
|
-
#### `styled
|
|
1463
|
+
#### `styled`
|
|
1290
1464
|
|
|
1291
1465
|
```bash
|
|
1292
|
-
npx @mui/codemod@next v6.0.0/styled
|
|
1466
|
+
npx @mui/codemod@next v6.0.0/styled <path>
|
|
1293
1467
|
```
|
|
1294
1468
|
|
|
1295
1469
|
Updates the usage of `styled` from `@mui/system@v5` to be compatible with `@pigment-css/react`.
|
|
@@ -8,6 +8,7 @@ exports.default = deprecationsAll;
|
|
|
8
8
|
var _accordionProps = _interopRequireDefault(require("../accordion-props"));
|
|
9
9
|
var _autocompleteProps = _interopRequireDefault(require("../autocomplete-props"));
|
|
10
10
|
var _formControlLabelProps = _interopRequireDefault(require("../form-control-label-props"));
|
|
11
|
+
var _avatarGroupProps = _interopRequireDefault(require("../avatar-group-props"));
|
|
11
12
|
var _avatarProps = _interopRequireDefault(require("../avatar-props"));
|
|
12
13
|
var _dividerProps = _interopRequireDefault(require("../divider-props"));
|
|
13
14
|
var _accordionSummaryClasses = _interopRequireDefault(require("../accordion-summary-classes"));
|
|
@@ -21,6 +22,7 @@ var _stepLabelProps = _interopRequireDefault(require("../step-label-props"));
|
|
|
21
22
|
var _backdropProps = _interopRequireDefault(require("../backdrop-props"));
|
|
22
23
|
var _stepConnectorClasses = _interopRequireDefault(require("../step-connector-classes"));
|
|
23
24
|
var _circularProgressClasses = _interopRequireDefault(require("../circular-progress-classes"));
|
|
25
|
+
var _gridProps = _interopRequireDefault(require("../grid-props"));
|
|
24
26
|
var _speedDialProps = _interopRequireDefault(require("../speed-dial-props"));
|
|
25
27
|
var _textFieldProps = _interopRequireDefault(require("../text-field-props"));
|
|
26
28
|
/**
|
|
@@ -31,6 +33,7 @@ function deprecationsAll(file, api, options) {
|
|
|
31
33
|
file.source = (0, _accordionProps.default)(file, api, options);
|
|
32
34
|
file.source = (0, _autocompleteProps.default)(file, api, options);
|
|
33
35
|
file.source = (0, _formControlLabelProps.default)(file, api, options);
|
|
36
|
+
file.source = (0, _avatarGroupProps.default)(file, api, options);
|
|
34
37
|
file.source = (0, _avatarProps.default)(file, api, options);
|
|
35
38
|
file.source = (0, _dividerProps.default)(file, api, options);
|
|
36
39
|
file.source = (0, _accordionSummaryClasses.default)(file, api, options);
|
|
@@ -46,5 +49,6 @@ function deprecationsAll(file, api, options) {
|
|
|
46
49
|
file.source = (0, _circularProgressClasses.default)(file, api, options);
|
|
47
50
|
file.source = (0, _speedDialProps.default)(file, api, options);
|
|
48
51
|
file.source = (0, _textFieldProps.default)(file, api, options);
|
|
52
|
+
file.source = (0, _gridProps.default)(file, api, options);
|
|
49
53
|
return file.source;
|
|
50
54
|
}
|
|
@@ -0,0 +1,87 @@
|
|
|
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 _assignObject = _interopRequireDefault(require("../../util/assignObject"));
|
|
9
|
+
var _findComponentJSX = _interopRequireDefault(require("../../util/findComponentJSX"));
|
|
10
|
+
var _replaceComponentsWithSlots = _interopRequireDefault(require("../utils/replaceComponentsWithSlots"));
|
|
11
|
+
/**
|
|
12
|
+
* @param {import('jscodeshift').FileInfo} file
|
|
13
|
+
* @param {import('jscodeshift').API} api
|
|
14
|
+
*/
|
|
15
|
+
function transformer(file, api, options) {
|
|
16
|
+
const j = api.jscodeshift;
|
|
17
|
+
const root = j(file.source);
|
|
18
|
+
const printOptions = options.printOptions;
|
|
19
|
+
(0, _replaceComponentsWithSlots.default)(j, {
|
|
20
|
+
root,
|
|
21
|
+
componentName: 'AvatarGroup'
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
// replace `slotProps.additionalAvatar` with `slotProps.surplus` in JSX
|
|
25
|
+
(0, _findComponentJSX.default)(j, {
|
|
26
|
+
root,
|
|
27
|
+
componentName: 'AvatarGroup'
|
|
28
|
+
}, elementPath => {
|
|
29
|
+
const slotPropsIndex = elementPath.node.openingElement.attributes.findIndex(attr => attr.type === 'JSXAttribute' && attr.name.name === 'slotProps');
|
|
30
|
+
if (slotPropsIndex !== -1) {
|
|
31
|
+
const slotProps = elementPath.node.openingElement.attributes[slotPropsIndex].value.expression;
|
|
32
|
+
const additionalAvatarIndex = slotProps.properties.findIndex(prop => {
|
|
33
|
+
var _prop$key;
|
|
34
|
+
return (prop == null || (_prop$key = prop.key) == null ? void 0 : _prop$key.name) === 'additionalAvatar';
|
|
35
|
+
});
|
|
36
|
+
if (additionalAvatarIndex !== -1) {
|
|
37
|
+
const surplusIndex = slotProps.properties.findIndex(prop => {
|
|
38
|
+
var _prop$key2;
|
|
39
|
+
return (prop == null || (_prop$key2 = prop.key) == null ? void 0 : _prop$key2.name) === 'surplus';
|
|
40
|
+
});
|
|
41
|
+
const removedValue = slotProps.properties.splice(additionalAvatarIndex, 1)[0].value;
|
|
42
|
+
if (surplusIndex === -1) {
|
|
43
|
+
(0, _assignObject.default)(j, {
|
|
44
|
+
target: elementPath.node.openingElement.attributes[slotPropsIndex],
|
|
45
|
+
key: 'surplus',
|
|
46
|
+
expression: removedValue
|
|
47
|
+
});
|
|
48
|
+
} else {
|
|
49
|
+
const slotPropsSlotValue = slotProps.properties.splice(surplusIndex, 1)[0].value;
|
|
50
|
+
(0, _assignObject.default)(j, {
|
|
51
|
+
target: elementPath.node.openingElement.attributes[slotPropsIndex],
|
|
52
|
+
key: 'surplus',
|
|
53
|
+
expression: j.objectExpression([j.spreadElement(removedValue), j.spreadElement(slotPropsSlotValue)])
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// replace `slotProps.additionalAvatar` with `slotProps.surplus` in theme
|
|
61
|
+
root.find(j.ObjectProperty, {
|
|
62
|
+
key: {
|
|
63
|
+
name: 'MuiAvatarGroup'
|
|
64
|
+
}
|
|
65
|
+
}).forEach(path => {
|
|
66
|
+
const defaultPropsIndex = path.value.value.properties.findIndex(key => key.key.name === 'defaultProps');
|
|
67
|
+
if (defaultPropsIndex !== -1) {
|
|
68
|
+
const defaultProps = path.value.value.properties[defaultPropsIndex];
|
|
69
|
+
const slotPropsIndex = defaultProps.value.properties.findIndex(prop => prop.key.name === 'slotProps');
|
|
70
|
+
if (slotPropsIndex !== -1) {
|
|
71
|
+
const slotProps = defaultProps.value.properties[slotPropsIndex];
|
|
72
|
+
const additionalAvatarIndex = slotProps.value.properties.findIndex(prop => prop.key.name === 'additionalAvatar');
|
|
73
|
+
if (additionalAvatarIndex !== -1) {
|
|
74
|
+
const removedValue = slotProps.value.properties.splice(additionalAvatarIndex, 1)[0].value;
|
|
75
|
+
const surplusIndex = slotProps.value.properties.findIndex(prop => prop.key.name === 'surplus');
|
|
76
|
+
if (surplusIndex === -1) {
|
|
77
|
+
slotProps.value.properties.push(j.objectProperty(j.identifier('surplus'), removedValue));
|
|
78
|
+
} else {
|
|
79
|
+
const slotPropsSlotValue = slotProps.value.properties.splice(surplusIndex, 1)[0].value;
|
|
80
|
+
slotProps.value.properties.push(j.objectProperty(j.identifier('surplus'), j.objectExpression([j.spreadElement(removedValue), j.spreadElement(slotPropsSlotValue)])));
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
return root.toSource(printOptions);
|
|
87
|
+
}
|
|
@@ -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 _avatarGroupProps.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
var _avatarGroupProps = _interopRequireDefault(require("./avatar-group-props"));
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _AvatarGroup = _interopRequireDefault(require("@mui/material/AvatarGroup"));
|
|
5
|
+
var _material = require("@mui/material");
|
|
6
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
7
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_AvatarGroup.default, {
|
|
8
|
+
componentsProps: {
|
|
9
|
+
additionalAvatar: {
|
|
10
|
+
color: "red"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.AvatarGroup, {
|
|
15
|
+
componentsProps: {
|
|
16
|
+
additionalAvatar: {
|
|
17
|
+
color: "red"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.AvatarGroup, {
|
|
22
|
+
componentsProps: {
|
|
23
|
+
additionalAvatar: {
|
|
24
|
+
color: "red"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
slotProps: {
|
|
28
|
+
additionalAvatar: {
|
|
29
|
+
color: "blue"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.AvatarGroup, {
|
|
34
|
+
componentsProps: {
|
|
35
|
+
additionalAvatar: {
|
|
36
|
+
color: "red"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
slotProps: {
|
|
40
|
+
additionalAvatar: {
|
|
41
|
+
color: "blue"
|
|
42
|
+
},
|
|
43
|
+
surplus: {
|
|
44
|
+
color: "yellow"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// should skip non MUI components
|
|
50
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(NonMuiAvatarGroup, {
|
|
51
|
+
componentsProps: {
|
|
52
|
+
additionalAvatar: {
|
|
53
|
+
color: "red"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _AvatarGroup = _interopRequireDefault(require("@mui/material/AvatarGroup"));
|
|
5
|
+
var _material = require("@mui/material");
|
|
6
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
7
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_AvatarGroup.default, {
|
|
8
|
+
slotProps: {
|
|
9
|
+
surplus: {
|
|
10
|
+
color: "red"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.AvatarGroup, {
|
|
15
|
+
slotProps: {
|
|
16
|
+
surplus: {
|
|
17
|
+
color: "red"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.AvatarGroup, {
|
|
22
|
+
slotProps: {
|
|
23
|
+
surplus: {
|
|
24
|
+
...{
|
|
25
|
+
color: "red"
|
|
26
|
+
},
|
|
27
|
+
...{
|
|
28
|
+
color: "blue"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.AvatarGroup, {
|
|
34
|
+
slotProps: {
|
|
35
|
+
surplus: {
|
|
36
|
+
...{
|
|
37
|
+
...{
|
|
38
|
+
color: "red"
|
|
39
|
+
},
|
|
40
|
+
...{
|
|
41
|
+
color: "blue"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
...{
|
|
45
|
+
color: "yellow"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// should skip non MUI components
|
|
52
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(NonMuiAvatarGroup, {
|
|
53
|
+
componentsProps: {
|
|
54
|
+
additionalAvatar: {
|
|
55
|
+
color: "red"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
fn({
|
|
4
|
+
MuiAvatarGroup: {
|
|
5
|
+
defaultProps: {
|
|
6
|
+
componentsProps: {
|
|
7
|
+
additionalAvatar: {
|
|
8
|
+
color: "red"
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
fn({
|
|
15
|
+
MuiAvatarGroup: {
|
|
16
|
+
defaultProps: {
|
|
17
|
+
componentsProps: {
|
|
18
|
+
additionalAvatar: {
|
|
19
|
+
color: "red"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
slotProps: {
|
|
23
|
+
additionalAvatar: {
|
|
24
|
+
color: "blue"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
fn({
|
|
31
|
+
MuiAvatarGroup: {
|
|
32
|
+
defaultProps: {
|
|
33
|
+
componentsProps: {
|
|
34
|
+
additionalAvatar: {
|
|
35
|
+
color: "red"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
slotProps: {
|
|
39
|
+
additionalAvatar: {
|
|
40
|
+
color: "blue"
|
|
41
|
+
},
|
|
42
|
+
surplus: {
|
|
43
|
+
color: "yellow"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
fn({
|
|
4
|
+
MuiAvatarGroup: {
|
|
5
|
+
defaultProps: {
|
|
6
|
+
slotProps: {
|
|
7
|
+
surplus: {
|
|
8
|
+
color: "red"
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
fn({
|
|
15
|
+
MuiAvatarGroup: {
|
|
16
|
+
defaultProps: {
|
|
17
|
+
slotProps: {
|
|
18
|
+
surplus: {
|
|
19
|
+
...{
|
|
20
|
+
color: "red"
|
|
21
|
+
},
|
|
22
|
+
...{
|
|
23
|
+
color: "blue"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
fn({
|
|
31
|
+
MuiAvatarGroup: {
|
|
32
|
+
defaultProps: {
|
|
33
|
+
slotProps: {
|
|
34
|
+
surplus: {
|
|
35
|
+
...{
|
|
36
|
+
...{
|
|
37
|
+
color: "red"
|
|
38
|
+
},
|
|
39
|
+
...{
|
|
40
|
+
color: "blue"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
...{
|
|
44
|
+
color: "yellow"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
});
|