@mui/codemod 6.0.0-alpha.4 → 6.0.0-alpha.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 +111 -0
- package/node/deprecations/all/deprecations-all.js +4 -0
- package/node/deprecations/form-control-label-props/form-control-label-props.js +22 -0
- package/node/deprecations/form-control-label-props/index.js +13 -0
- package/node/deprecations/form-control-label-props/test-cases/actual.js +21 -0
- package/node/deprecations/form-control-label-props/test-cases/expected.js +19 -0
- package/node/deprecations/form-control-label-props/test-cases/theme.actual.js +23 -0
- package/node/deprecations/form-control-label-props/test-cases/theme.expected.js +22 -0
- package/node/deprecations/pagination-item-props/index.js +13 -0
- package/node/deprecations/pagination-item-props/pagination-item-props.js +22 -0
- package/node/deprecations/pagination-item-props/test-cases/actual.js +27 -0
- package/node/deprecations/pagination-item-props/test-cases/expected.js +21 -0
- package/node/deprecations/pagination-item-props/test-cases/theme.actual.js +28 -0
- package/node/deprecations/pagination-item-props/test-cases/theme.expected.js +26 -0
- package/node/deprecations/speed-dial-props/index.js +13 -0
- package/node/deprecations/speed-dial-props/speed-dial-props.js +31 -0
- package/node/deprecations/speed-dial-props/test-cases/actual.js +40 -0
- package/node/deprecations/speed-dial-props/test-cases/expected.js +54 -0
- package/node/deprecations/speed-dial-props/test-cases/theme.actual.js +33 -0
- package/node/deprecations/speed-dial-props/test-cases/theme.expected.js +40 -0
- package/node/util/getReturnExpression.js +20 -0
- package/node/util/migrateToVariants.js +472 -0
- package/node/v6.0.0/styled/styled-v6.js +2 -415
- package/node/v6.0.0/styled/test-cases/ConditionalStyled.actual.js +28 -1
- package/node/v6.0.0/styled/test-cases/ConditionalStyled.expected.js +38 -1
- package/node/v6.0.0/theme-v6/index.js +13 -0
- package/node/v6.0.0/theme-v6/test-cases/basicTheme.actual.js +530 -0
- package/node/v6.0.0/theme-v6/test-cases/basicTheme.expected.js +626 -0
- package/node/v6.0.0/theme-v6/test-cases/themeVariants.actual.js +63 -0
- package/node/v6.0.0/theme-v6/test-cases/themeVariants.expected.js +73 -0
- package/node/v6.0.0/theme-v6/theme-v6.js +87 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -858,6 +858,29 @@ npx @mui/codemod@next deprecations/chip-classes <path>
|
|
|
858
858
|
npx @mui/codemod@next deprecations/divider-props <path>
|
|
859
859
|
```
|
|
860
860
|
|
|
861
|
+
#### `form-control-label-props`
|
|
862
|
+
|
|
863
|
+
```diff
|
|
864
|
+
<FormControlLabel
|
|
865
|
+
- componentsProps={{ typography: typographyProps }}
|
|
866
|
+
+ slotProps={{ typography: typographyProps }}
|
|
867
|
+
/>
|
|
868
|
+
```
|
|
869
|
+
|
|
870
|
+
```diff
|
|
871
|
+
MuiFormControlLabel: {
|
|
872
|
+
defaultProps: {
|
|
873
|
+
- componentsProps={{ typography: typographyProps }}
|
|
874
|
+
+ slotProps={{ typography: typographyProps }}
|
|
875
|
+
},
|
|
876
|
+
},
|
|
877
|
+
```
|
|
878
|
+
|
|
879
|
+
```bash
|
|
880
|
+
npx @mui/codemod@next deprecations/form-control-label-props <path>
|
|
881
|
+
|
|
882
|
+
```
|
|
883
|
+
|
|
861
884
|
#### `pagination-item-classes`
|
|
862
885
|
|
|
863
886
|
JS transforms:
|
|
@@ -922,6 +945,28 @@ CSS transforms:
|
|
|
922
945
|
npx @mui/codemod@next deprecations/pagination-item-classes <path>
|
|
923
946
|
```
|
|
924
947
|
|
|
948
|
+
#### `pagination-item-props`
|
|
949
|
+
|
|
950
|
+
```diff
|
|
951
|
+
<PaginationItem
|
|
952
|
+
- components={{ first: FirstIcon, last: LastIcon, next: NextIcon, previous: PreviousIcons }}
|
|
953
|
+
+ slots={{ first: FirstIcon, last: LastIcon, next: NextIcon, previous: PreviousIcons }}
|
|
954
|
+
/>
|
|
955
|
+
```
|
|
956
|
+
|
|
957
|
+
```diff
|
|
958
|
+
MuiPaginationItem: {
|
|
959
|
+
defaultProps: {
|
|
960
|
+
- components: { first: FirstIcon, last: LastIcon, next: NextIcon, previous: PreviousIcons }
|
|
961
|
+
+ slots: { first: FirstIcon, last: LastIcon, next: NextIcon, previous: PreviousIcons }
|
|
962
|
+
},
|
|
963
|
+
},
|
|
964
|
+
```
|
|
965
|
+
|
|
966
|
+
```bash
|
|
967
|
+
npx @mui/codemod@next deprecations/pagination-item-props <path>
|
|
968
|
+
```
|
|
969
|
+
|
|
925
970
|
#### `slider-props`
|
|
926
971
|
|
|
927
972
|
```diff
|
|
@@ -1054,8 +1099,74 @@ npx @mui/codemod@next deprecations/step-connector-classes <path>
|
|
|
1054
1099
|
|
|
1055
1100
|
### v6.0.0
|
|
1056
1101
|
|
|
1102
|
+
#### `theme-v6`
|
|
1103
|
+
|
|
1104
|
+
```bash
|
|
1105
|
+
npx @mui/codemod@next v6.0.0/theme-v6 <path>
|
|
1106
|
+
```
|
|
1107
|
+
|
|
1108
|
+
Update the theme creation from `@mui/system@v5` to be compatible with `@pigment-css/react`.
|
|
1109
|
+
|
|
1110
|
+
- replace palette mode conditional with `theme.applyStyles()`
|
|
1111
|
+
- replace `ownerState` with `variants`
|
|
1112
|
+
- move theme variants to the root slot
|
|
1113
|
+
|
|
1114
|
+
```diff
|
|
1115
|
+
createTheme({
|
|
1116
|
+
components: {
|
|
1117
|
+
MuiButton: {
|
|
1118
|
+
- variants: [
|
|
1119
|
+
- {
|
|
1120
|
+
- props: { color: 'primary' },
|
|
1121
|
+
- style: {
|
|
1122
|
+
- color: 'red',
|
|
1123
|
+
- },
|
|
1124
|
+
- },
|
|
1125
|
+
- ],
|
|
1126
|
+
styleOverrides: {
|
|
1127
|
+
- root: ({ theme, ownerState }) => ({
|
|
1128
|
+
+ root: ({ theme }) => ({
|
|
1129
|
+
...ownerState.variant === 'contained' && {
|
|
1130
|
+
backgroundColor: alpha(theme.palette.primary.main, 0.8),
|
|
1131
|
+
...theme.palette.mode === 'dark' && {
|
|
1132
|
+
backgroundColor: alpha(theme.palette.primary.light, 0.9),
|
|
1133
|
+
}
|
|
1134
|
+
},
|
|
1135
|
+
+ variants: [
|
|
1136
|
+
+ {
|
|
1137
|
+
+ prop: { variant: 'contained' },
|
|
1138
|
+
+ style: {
|
|
1139
|
+
+ backgroundColor: alpha(theme.palette.primary.main, 0.8),
|
|
1140
|
+
+ },
|
|
1141
|
+
+ },
|
|
1142
|
+
+ {
|
|
1143
|
+
+ prop: { variant: 'contained' },
|
|
1144
|
+
+ style: {
|
|
1145
|
+
+ ...theme.applyStyles('dark', {
|
|
1146
|
+
+ backgroundColor: alpha(theme.palette.primary.light, 0.9),
|
|
1147
|
+
+ })
|
|
1148
|
+
+ },
|
|
1149
|
+
+ },
|
|
1150
|
+
+ {
|
|
1151
|
+
+ prop: { color: 'primary' },
|
|
1152
|
+
+ style: {
|
|
1153
|
+
+ color: 'red',
|
|
1154
|
+
+ },
|
|
1155
|
+
+ },
|
|
1156
|
+
+ ],
|
|
1157
|
+
})
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
})
|
|
1162
|
+
```
|
|
1163
|
+
|
|
1057
1164
|
#### `styled-v6`
|
|
1058
1165
|
|
|
1166
|
+
```bash
|
|
1167
|
+
npx @mui/codemod@next v6.0.0/styled-v6 <path>
|
|
1168
|
+
```
|
|
1169
|
+
|
|
1059
1170
|
Updates the usage of `styled` from `@mui/system@v5` to be compatible with `@pigment-css/react`.
|
|
1060
1171
|
|
|
1061
1172
|
This codemod transforms the styles based on props to `variants` by looking for `styled` calls:
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = deprecationsAll;
|
|
8
8
|
var _accordionProps = _interopRequireDefault(require("../accordion-props"));
|
|
9
|
+
var _formControlLabelProps = _interopRequireDefault(require("../form-control-label-props"));
|
|
9
10
|
var _avatarProps = _interopRequireDefault(require("../avatar-props"));
|
|
10
11
|
var _dividerProps = _interopRequireDefault(require("../divider-props"));
|
|
11
12
|
var _accordionSummaryClasses = _interopRequireDefault(require("../accordion-summary-classes"));
|
|
@@ -18,12 +19,14 @@ var _toggleButtonGroupClasses = _interopRequireDefault(require("../toggle-button
|
|
|
18
19
|
var _stepLabelProps = _interopRequireDefault(require("../step-label-props"));
|
|
19
20
|
var _backdropProps = _interopRequireDefault(require("../backdrop-props"));
|
|
20
21
|
var _stepConnectorClasses = _interopRequireDefault(require("../step-connector-classes"));
|
|
22
|
+
var _speedDialProps = _interopRequireDefault(require("../speed-dial-props"));
|
|
21
23
|
/**
|
|
22
24
|
* @param {import('jscodeshift').FileInfo} file
|
|
23
25
|
* @param {import('jscodeshift').API} api
|
|
24
26
|
*/
|
|
25
27
|
function deprecationsAll(file, api, options) {
|
|
26
28
|
file.source = (0, _accordionProps.default)(file, api, options);
|
|
29
|
+
file.source = (0, _formControlLabelProps.default)(file, api, options);
|
|
27
30
|
file.source = (0, _avatarProps.default)(file, api, options);
|
|
28
31
|
file.source = (0, _dividerProps.default)(file, api, options);
|
|
29
32
|
file.source = (0, _accordionSummaryClasses.default)(file, api, options);
|
|
@@ -36,5 +39,6 @@ function deprecationsAll(file, api, options) {
|
|
|
36
39
|
file.source = (0, _stepLabelProps.default)(file, api, options);
|
|
37
40
|
file.source = (0, _backdropProps.default)(file, api, options);
|
|
38
41
|
file.source = (0, _stepConnectorClasses.default)(file, api, options);
|
|
42
|
+
file.source = (0, _speedDialProps.default)(file, api, options);
|
|
39
43
|
return file.source;
|
|
40
44
|
}
|
|
@@ -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: 'FormControlLabel'
|
|
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 _formControlLabelProps.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
var _formControlLabelProps = _interopRequireDefault(require("./form-control-label-props"));
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _FormControlLabel = _interopRequireDefault(require("@mui/material/FormControlLabel"));
|
|
5
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
6
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_FormControlLabel.default, {
|
|
7
|
+
componentsProps: {
|
|
8
|
+
typography: componentsTypographyProps
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_FormControlLabel.default, {
|
|
12
|
+
slots: {
|
|
13
|
+
typography: SlotsTypography
|
|
14
|
+
},
|
|
15
|
+
slotProps: {
|
|
16
|
+
typography: slotsTypographyProps
|
|
17
|
+
},
|
|
18
|
+
componentsProps: {
|
|
19
|
+
typography: componentsTypographyProps
|
|
20
|
+
}
|
|
21
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
5
|
+
var _FormControlLabel = _interopRequireDefault(require("@mui/material/FormControlLabel"));
|
|
6
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
7
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_FormControlLabel.default, {
|
|
8
|
+
slotProps: {
|
|
9
|
+
typography: componentsTypographyProps
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_FormControlLabel.default, {
|
|
13
|
+
slots: {
|
|
14
|
+
typography: SlotsTypography
|
|
15
|
+
},
|
|
16
|
+
slotProps: {
|
|
17
|
+
typography: (0, _extends2.default)({}, componentsTypographyProps, slotsTypographyProps)
|
|
18
|
+
}
|
|
19
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
fn({
|
|
4
|
+
MuiFormControlLabel: {
|
|
5
|
+
defaultProps: {
|
|
6
|
+
componentsProps: {
|
|
7
|
+
typography: componentsTypographyProps
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
fn({
|
|
13
|
+
MuiFormControlLabel: {
|
|
14
|
+
defaultProps: {
|
|
15
|
+
componentsProps: {
|
|
16
|
+
typography: componentsTypographyProps
|
|
17
|
+
},
|
|
18
|
+
slotProps: {
|
|
19
|
+
typography: slotsTypographyProps
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
5
|
+
fn({
|
|
6
|
+
MuiFormControlLabel: {
|
|
7
|
+
defaultProps: {
|
|
8
|
+
slotProps: {
|
|
9
|
+
typography: componentsTypographyProps
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
fn({
|
|
15
|
+
MuiFormControlLabel: {
|
|
16
|
+
defaultProps: {
|
|
17
|
+
slotProps: {
|
|
18
|
+
typography: (0, _extends2.default)({}, componentsTypographyProps, slotsTypographyProps)
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
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 _paginationItemProps.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
var _paginationItemProps = _interopRequireDefault(require("./pagination-item-props"));
|
|
@@ -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: 'PaginationItem'
|
|
20
|
+
});
|
|
21
|
+
return root.toSource(printOptions);
|
|
22
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _PaginationItem = _interopRequireDefault(require("@mui/material/PaginationItem"));
|
|
5
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
6
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_PaginationItem.default, {
|
|
7
|
+
components: {
|
|
8
|
+
first: first,
|
|
9
|
+
last: last,
|
|
10
|
+
next: next,
|
|
11
|
+
previous: previous
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_PaginationItem.default, {
|
|
15
|
+
slots: {
|
|
16
|
+
first: slotFirst,
|
|
17
|
+
last: slotLast,
|
|
18
|
+
next: slotNext,
|
|
19
|
+
previous: slotPrevious
|
|
20
|
+
},
|
|
21
|
+
components: {
|
|
22
|
+
first: componentFirst,
|
|
23
|
+
last: componentLast,
|
|
24
|
+
next: componentNext,
|
|
25
|
+
previous: componentPrevious
|
|
26
|
+
}
|
|
27
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _PaginationItem = _interopRequireDefault(require("@mui/material/PaginationItem"));
|
|
5
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
6
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_PaginationItem.default, {
|
|
7
|
+
slots: {
|
|
8
|
+
first: first,
|
|
9
|
+
last: last,
|
|
10
|
+
next: next,
|
|
11
|
+
previous: previous
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_PaginationItem.default, {
|
|
15
|
+
slots: {
|
|
16
|
+
first: slotFirst,
|
|
17
|
+
last: slotLast,
|
|
18
|
+
next: slotNext,
|
|
19
|
+
previous: slotPrevious
|
|
20
|
+
}
|
|
21
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
fn({
|
|
4
|
+
MuiPaginationItem: {
|
|
5
|
+
defaultProps: {
|
|
6
|
+
components: {
|
|
7
|
+
first: componentFirst,
|
|
8
|
+
last: componentLast,
|
|
9
|
+
next: componentNext,
|
|
10
|
+
previous: componentPrevious
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
fn({
|
|
16
|
+
MuiPaginationItem: {
|
|
17
|
+
defaultProps: {
|
|
18
|
+
components: {
|
|
19
|
+
first: componentFirst,
|
|
20
|
+
last: componentLast
|
|
21
|
+
},
|
|
22
|
+
slots: {
|
|
23
|
+
next: slotNext,
|
|
24
|
+
previous: slotPrevious
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
fn({
|
|
4
|
+
MuiPaginationItem: {
|
|
5
|
+
defaultProps: {
|
|
6
|
+
slots: {
|
|
7
|
+
first: componentFirst,
|
|
8
|
+
last: componentLast,
|
|
9
|
+
next: componentNext,
|
|
10
|
+
previous: componentPrevious
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
fn({
|
|
16
|
+
MuiPaginationItem: {
|
|
17
|
+
defaultProps: {
|
|
18
|
+
slots: {
|
|
19
|
+
first: componentFirst,
|
|
20
|
+
last: componentLast,
|
|
21
|
+
next: slotNext,
|
|
22
|
+
previous: slotPrevious
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
});
|
|
@@ -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 _speedDialProps.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
var _speedDialProps = _interopRequireDefault(require("./speed-dial-props"));
|
|
@@ -0,0 +1,31 @@
|
|
|
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 _movePropIntoSlots = _interopRequireDefault(require("../utils/movePropIntoSlots"));
|
|
9
|
+
var _movePropIntoSlotProps = _interopRequireDefault(require("../utils/movePropIntoSlotProps"));
|
|
10
|
+
/**
|
|
11
|
+
* @param {import('jscodeshift').FileInfo} file
|
|
12
|
+
* @param {import('jscodeshift').API} api
|
|
13
|
+
*/
|
|
14
|
+
function transformer(file, api, options) {
|
|
15
|
+
const j = api.jscodeshift;
|
|
16
|
+
const root = j(file.source);
|
|
17
|
+
const printOptions = options.printOptions;
|
|
18
|
+
(0, _movePropIntoSlots.default)(j, {
|
|
19
|
+
root,
|
|
20
|
+
componentName: 'SpeedDial',
|
|
21
|
+
propName: 'TransitionComponent',
|
|
22
|
+
slotName: 'transition'
|
|
23
|
+
});
|
|
24
|
+
(0, _movePropIntoSlotProps.default)(j, {
|
|
25
|
+
root,
|
|
26
|
+
componentName: 'SpeedDial',
|
|
27
|
+
propName: 'TransitionProps',
|
|
28
|
+
slotName: 'transition'
|
|
29
|
+
});
|
|
30
|
+
return root.toSource(printOptions);
|
|
31
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
5
|
+
var _SpeedDial = _interopRequireDefault(require("@mui/material/SpeedDial"));
|
|
6
|
+
var _material = require("@mui/material");
|
|
7
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_SpeedDial.default, {
|
|
9
|
+
TransitionComponent: CustomTransition,
|
|
10
|
+
TransitionProps: CustomTransitionProps
|
|
11
|
+
});
|
|
12
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.SpeedDial, {
|
|
13
|
+
TransitionComponent: CustomTransition,
|
|
14
|
+
TransitionProps: CustomTransitionProps
|
|
15
|
+
});
|
|
16
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_SpeedDial.default, {
|
|
17
|
+
TransitionComponent: CustomTransition,
|
|
18
|
+
TransitionProps: CustomTransitionProps,
|
|
19
|
+
slots: {
|
|
20
|
+
root: 'div'
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.SpeedDial, {
|
|
24
|
+
TransitionComponent: CustomTransition,
|
|
25
|
+
TransitionProps: CustomTransitionProps,
|
|
26
|
+
slots: (0, _extends2.default)({}, outerSlots)
|
|
27
|
+
});
|
|
28
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_SpeedDial.default, {
|
|
29
|
+
TransitionComponent: ComponentTransition,
|
|
30
|
+
TransitionProps: CustomTransitionProps,
|
|
31
|
+
slots: {
|
|
32
|
+
root: 'div',
|
|
33
|
+
transition: SlotTransition
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
// should skip non MUI components
|
|
37
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(NonMuiSpeedDial, {
|
|
38
|
+
TransitionComponent: CustomTransition,
|
|
39
|
+
TransitionProps: CustomTransitionProps
|
|
40
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
5
|
+
var _SpeedDial = _interopRequireDefault(require("@mui/material/SpeedDial"));
|
|
6
|
+
var _material = require("@mui/material");
|
|
7
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_SpeedDial.default, {
|
|
9
|
+
slots: {
|
|
10
|
+
transition: CustomTransition
|
|
11
|
+
},
|
|
12
|
+
slotProps: {
|
|
13
|
+
transition: CustomTransitionProps
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.SpeedDial, {
|
|
17
|
+
slots: {
|
|
18
|
+
transition: CustomTransition
|
|
19
|
+
},
|
|
20
|
+
slotProps: {
|
|
21
|
+
transition: CustomTransitionProps
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_SpeedDial.default, {
|
|
25
|
+
slots: {
|
|
26
|
+
root: 'div',
|
|
27
|
+
transition: CustomTransition
|
|
28
|
+
},
|
|
29
|
+
slotProps: {
|
|
30
|
+
transition: CustomTransitionProps
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.SpeedDial, {
|
|
34
|
+
slots: (0, _extends2.default)({}, outerSlots, {
|
|
35
|
+
transition: CustomTransition
|
|
36
|
+
}),
|
|
37
|
+
slotProps: {
|
|
38
|
+
transition: CustomTransitionProps
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_SpeedDial.default, {
|
|
42
|
+
slots: {
|
|
43
|
+
root: 'div',
|
|
44
|
+
transition: SlotTransition
|
|
45
|
+
},
|
|
46
|
+
slotProps: {
|
|
47
|
+
transition: CustomTransitionProps
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
// should skip non MUI components
|
|
51
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(NonMuiSpeedDial, {
|
|
52
|
+
TransitionComponent: CustomTransition,
|
|
53
|
+
TransitionProps: CustomTransitionProps
|
|
54
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
fn({
|
|
4
|
+
MuiSpeedDial: {
|
|
5
|
+
defaultProps: {
|
|
6
|
+
TransitionComponent: CustomTransition,
|
|
7
|
+
TransitionProps: CustomTransitionProps
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
fn({
|
|
12
|
+
MuiSpeedDial: {
|
|
13
|
+
defaultProps: {
|
|
14
|
+
TransitionComponent: CustomTransition,
|
|
15
|
+
TransitionProps: CustomTransitionProps,
|
|
16
|
+
slots: {
|
|
17
|
+
root: 'div'
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
fn({
|
|
23
|
+
MuiSpeedDial: {
|
|
24
|
+
defaultProps: {
|
|
25
|
+
TransitionComponent: ComponentTransition,
|
|
26
|
+
TransitionProps: CustomTransitionProps,
|
|
27
|
+
slots: {
|
|
28
|
+
root: 'div',
|
|
29
|
+
transition: SlotTransition
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
fn({
|
|
4
|
+
MuiSpeedDial: {
|
|
5
|
+
defaultProps: {
|
|
6
|
+
slots: {
|
|
7
|
+
transition: CustomTransition
|
|
8
|
+
},
|
|
9
|
+
slotProps: {
|
|
10
|
+
transition: CustomTransitionProps
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
fn({
|
|
16
|
+
MuiSpeedDial: {
|
|
17
|
+
defaultProps: {
|
|
18
|
+
slots: {
|
|
19
|
+
root: 'div',
|
|
20
|
+
transition: CustomTransition
|
|
21
|
+
},
|
|
22
|
+
slotProps: {
|
|
23
|
+
transition: CustomTransitionProps
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
fn({
|
|
29
|
+
MuiSpeedDial: {
|
|
30
|
+
defaultProps: {
|
|
31
|
+
slots: {
|
|
32
|
+
root: 'div',
|
|
33
|
+
transition: SlotTransition
|
|
34
|
+
},
|
|
35
|
+
slotProps: {
|
|
36
|
+
transition: CustomTransitionProps
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = getReturnExpression;
|
|
7
|
+
/**
|
|
8
|
+
* @param {import('ast-types').namedTypes.ArrowFunctionExpression | import('ast-types').namedTypes.FunctionExpression} node
|
|
9
|
+
*/
|
|
10
|
+
function getReturnExpression(node) {
|
|
11
|
+
let body = node.body;
|
|
12
|
+
if (body === 'BlockStatement') {
|
|
13
|
+
body = body.body;
|
|
14
|
+
}
|
|
15
|
+
if (Array.isArray(body)) {
|
|
16
|
+
var _body$find;
|
|
17
|
+
return (_body$find = body.find(statement => statement.type === 'ReturnStatement')) == null ? void 0 : _body$find.argument;
|
|
18
|
+
}
|
|
19
|
+
return body;
|
|
20
|
+
}
|