@mui/codemod 6.4.3 → 6.4.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 +160 -0
- package/node/deprecations/all/deprecations-all.js +18 -0
- package/node/deprecations/all/postcss.config.js +7 -1
- package/node/deprecations/drawer-props/drawer-props.js +67 -0
- package/node/deprecations/drawer-props/index.js +13 -0
- package/node/deprecations/drawer-props/test-cases/actual.js +73 -0
- package/node/deprecations/drawer-props/test-cases/expected.js +97 -0
- package/node/deprecations/drawer-props/test-cases/theme.actual.js +58 -0
- package/node/deprecations/drawer-props/test-cases/theme.expected.js +74 -0
- package/node/deprecations/input-base-classes/index.js +13 -0
- package/node/deprecations/input-base-classes/input-base-classes.js +69 -0
- package/node/deprecations/input-base-classes/postcss-plugin.js +42 -0
- package/node/deprecations/input-base-classes/postcss.config.js +8 -0
- package/node/deprecations/input-base-classes/test-cases/actual.js +13 -0
- package/node/deprecations/input-base-classes/test-cases/expected.js +13 -0
- package/node/deprecations/menu-props/index.js +13 -0
- package/node/deprecations/menu-props/menu-props.js +37 -0
- package/node/deprecations/menu-props/test-cases/actual.js +67 -0
- package/node/deprecations/menu-props/test-cases/expected.js +83 -0
- package/node/deprecations/menu-props/test-cases/theme.actual.js +33 -0
- package/node/deprecations/menu-props/test-cases/theme.expected.js +39 -0
- package/node/deprecations/mobile-stepper-props/index.js +13 -0
- package/node/deprecations/mobile-stepper-props/mobile-stepper-props.js +24 -0
- package/node/deprecations/mobile-stepper-props/test-cases/actual.js +30 -0
- package/node/deprecations/mobile-stepper-props/test-cases/expected.js +34 -0
- package/node/deprecations/mobile-stepper-props/test-cases/theme.actual.js +11 -0
- package/node/deprecations/mobile-stepper-props/test-cases/theme.expected.js +13 -0
- package/node/deprecations/popover-props/index.js +13 -0
- package/node/deprecations/popover-props/popover-props.js +49 -0
- package/node/deprecations/popover-props/test-cases/actual.js +73 -0
- package/node/deprecations/popover-props/test-cases/expected.js +89 -0
- package/node/deprecations/popover-props/test-cases/theme.actual.js +19 -0
- package/node/deprecations/popover-props/test-cases/theme.expected.js +23 -0
- package/node/deprecations/slider-classes/index.js +13 -0
- package/node/deprecations/slider-classes/postcss-plugin.js +51 -0
- package/node/deprecations/slider-classes/postcss.config.js +8 -0
- package/node/deprecations/slider-classes/slider-classes.js +69 -0
- package/node/deprecations/slider-classes/test-cases/actual.js +19 -0
- package/node/deprecations/slider-classes/test-cases/expected.js +19 -0
- package/node/deprecations/snackbar-props/index.js +13 -0
- package/node/deprecations/snackbar-props/snackbar-props.js +43 -0
- package/node/deprecations/snackbar-props/test-cases/actual.js +54 -0
- package/node/deprecations/snackbar-props/test-cases/expected.js +67 -0
- package/node/deprecations/snackbar-props/test-cases/theme.actual.js +39 -0
- package/node/deprecations/snackbar-props/test-cases/theme.expected.js +46 -0
- package/node/deprecations/speed-dial-action-props/index.js +13 -0
- package/node/deprecations/speed-dial-action-props/speed-dial-action-props.js +52 -0
- package/node/deprecations/speed-dial-action-props/test-cases/actual.js +56 -0
- package/node/deprecations/speed-dial-action-props/test-cases/expected.js +104 -0
- package/node/deprecations/speed-dial-action-props/test-cases/theme.actual.js +62 -0
- package/node/deprecations/speed-dial-action-props/test-cases/theme.expected.js +88 -0
- package/node/deprecations/tabs-classes/index.js +13 -0
- package/node/deprecations/tabs-classes/postcss-plugin.js +33 -0
- package/node/deprecations/tabs-classes/postcss.config.js +8 -0
- package/node/deprecations/tabs-classes/tabs-classes.js +77 -0
- package/node/deprecations/tabs-classes/test-cases/actual.js +7 -0
- package/node/deprecations/tabs-classes/test-cases/expected.js +7 -0
- package/node/deprecations/tabs-props/index.js +13 -0
- package/node/deprecations/tabs-props/tabs-props.js +37 -0
- package/node/deprecations/tabs-props/test-cases/actual.js +33 -0
- package/node/deprecations/tabs-props/test-cases/expected.js +41 -0
- package/node/deprecations/tabs-props/test-cases/theme.actual.js +15 -0
- package/node/deprecations/tabs-props/test-cases/theme.expected.js +19 -0
- package/node/deprecations/utils/movePropIntoSlotProps.js +44 -19
- package/package.json +1 -1
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = transformer;
|
|
8
|
+
var _movePropIntoSlotProps = _interopRequireDefault(require("../utils/movePropIntoSlotProps"));
|
|
9
|
+
/**
|
|
10
|
+
* @param {import('jscodeshift').FileInfo} file
|
|
11
|
+
* @param {import('jscodeshift').API} api
|
|
12
|
+
*/
|
|
13
|
+
function transformer(file, api, options) {
|
|
14
|
+
const j = api.jscodeshift;
|
|
15
|
+
const root = j(file.source);
|
|
16
|
+
const printOptions = options.printOptions;
|
|
17
|
+
(0, _movePropIntoSlotProps.default)(j, {
|
|
18
|
+
root,
|
|
19
|
+
componentName: 'SpeedDialAction',
|
|
20
|
+
propName: 'tooltipTitle',
|
|
21
|
+
slotName: 'tooltip',
|
|
22
|
+
slotPropName: 'title'
|
|
23
|
+
});
|
|
24
|
+
(0, _movePropIntoSlotProps.default)(j, {
|
|
25
|
+
root,
|
|
26
|
+
componentName: 'SpeedDialAction',
|
|
27
|
+
propName: 'tooltipPlacement',
|
|
28
|
+
slotName: 'tooltip',
|
|
29
|
+
slotPropName: 'placement'
|
|
30
|
+
});
|
|
31
|
+
(0, _movePropIntoSlotProps.default)(j, {
|
|
32
|
+
root,
|
|
33
|
+
componentName: 'SpeedDialAction',
|
|
34
|
+
propName: 'tooltipOpen',
|
|
35
|
+
slotName: 'tooltip',
|
|
36
|
+
slotPropName: 'open'
|
|
37
|
+
});
|
|
38
|
+
(0, _movePropIntoSlotProps.default)(j, {
|
|
39
|
+
root,
|
|
40
|
+
componentName: 'SpeedDialAction',
|
|
41
|
+
propName: 'TooltipClasses',
|
|
42
|
+
slotName: 'tooltip',
|
|
43
|
+
slotPropName: 'classes'
|
|
44
|
+
});
|
|
45
|
+
(0, _movePropIntoSlotProps.default)(j, {
|
|
46
|
+
root,
|
|
47
|
+
componentName: 'SpeedDialAction',
|
|
48
|
+
propName: 'FabProps',
|
|
49
|
+
slotName: 'fab'
|
|
50
|
+
});
|
|
51
|
+
return root.toSource(printOptions);
|
|
52
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _SpeedDialAction = _interopRequireDefault(require("@mui/material/SpeedDialAction"));
|
|
5
|
+
var _material = require("@mui/material");
|
|
6
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
7
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_SpeedDialAction.default, {
|
|
8
|
+
tooltipTitle: "test"
|
|
9
|
+
});
|
|
10
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_SpeedDialAction.default, {
|
|
11
|
+
tooltipOpen: true
|
|
12
|
+
});
|
|
13
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_SpeedDialAction.default, {
|
|
14
|
+
tooltipPlacement: "test"
|
|
15
|
+
});
|
|
16
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_SpeedDialAction.default, {
|
|
17
|
+
TooltipClasses: TooltipClasses
|
|
18
|
+
});
|
|
19
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_SpeedDialAction.default, {
|
|
20
|
+
FabProps: FabProps
|
|
21
|
+
});
|
|
22
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_SpeedDialAction.default, {
|
|
23
|
+
TooltipClasses: TooltipClasses,
|
|
24
|
+
tooltipOpen: true,
|
|
25
|
+
tooltipPlacement: "top",
|
|
26
|
+
tooltipTitle: "test"
|
|
27
|
+
});
|
|
28
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_SpeedDialAction.default, {
|
|
29
|
+
TooltipClasses: TooltipClasses,
|
|
30
|
+
tooltipOpen: true,
|
|
31
|
+
tooltipPlacement: "top",
|
|
32
|
+
tooltipTitle: "test",
|
|
33
|
+
FabProps: FabProps
|
|
34
|
+
});
|
|
35
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.SpeedDialAction, {
|
|
36
|
+
tooltipTitle: "test"
|
|
37
|
+
});
|
|
38
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.SpeedDialAction, {
|
|
39
|
+
tooltipOpen: true
|
|
40
|
+
});
|
|
41
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.SpeedDialAction, {
|
|
42
|
+
tooltipPlacement: "test"
|
|
43
|
+
});
|
|
44
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.SpeedDialAction, {
|
|
45
|
+
TooltipClasses: TooltipClasses
|
|
46
|
+
});
|
|
47
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.SpeedDialAction, {
|
|
48
|
+
FabProps: FabProps
|
|
49
|
+
});
|
|
50
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.SpeedDialAction, {
|
|
51
|
+
TooltipClasses: TooltipClasses,
|
|
52
|
+
tooltipOpen: true,
|
|
53
|
+
tooltipPlacement: "top",
|
|
54
|
+
tooltipTitle: "test",
|
|
55
|
+
FabProps: FabProps
|
|
56
|
+
});
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _SpeedDialAction = _interopRequireDefault(require("@mui/material/SpeedDialAction"));
|
|
5
|
+
var _material = require("@mui/material");
|
|
6
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
7
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_SpeedDialAction.default, {
|
|
8
|
+
slotProps: {
|
|
9
|
+
tooltip: {
|
|
10
|
+
title: "test"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_SpeedDialAction.default, {
|
|
15
|
+
slotProps: {
|
|
16
|
+
tooltip: {
|
|
17
|
+
open: true
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_SpeedDialAction.default, {
|
|
22
|
+
slotProps: {
|
|
23
|
+
tooltip: {
|
|
24
|
+
placement: "test"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_SpeedDialAction.default, {
|
|
29
|
+
slotProps: {
|
|
30
|
+
tooltip: {
|
|
31
|
+
classes: TooltipClasses
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_SpeedDialAction.default, {
|
|
36
|
+
slotProps: {
|
|
37
|
+
fab: FabProps
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_SpeedDialAction.default, {
|
|
41
|
+
slotProps: {
|
|
42
|
+
tooltip: {
|
|
43
|
+
title: "test",
|
|
44
|
+
placement: "top",
|
|
45
|
+
open: true,
|
|
46
|
+
classes: TooltipClasses
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_SpeedDialAction.default, {
|
|
51
|
+
slotProps: {
|
|
52
|
+
tooltip: {
|
|
53
|
+
title: "test",
|
|
54
|
+
placement: "top",
|
|
55
|
+
open: true,
|
|
56
|
+
classes: TooltipClasses
|
|
57
|
+
},
|
|
58
|
+
fab: FabProps
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.SpeedDialAction, {
|
|
62
|
+
slotProps: {
|
|
63
|
+
tooltip: {
|
|
64
|
+
title: "test"
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.SpeedDialAction, {
|
|
69
|
+
slotProps: {
|
|
70
|
+
tooltip: {
|
|
71
|
+
open: true
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.SpeedDialAction, {
|
|
76
|
+
slotProps: {
|
|
77
|
+
tooltip: {
|
|
78
|
+
placement: "test"
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.SpeedDialAction, {
|
|
83
|
+
slotProps: {
|
|
84
|
+
tooltip: {
|
|
85
|
+
classes: TooltipClasses
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.SpeedDialAction, {
|
|
90
|
+
slotProps: {
|
|
91
|
+
fab: FabProps
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.SpeedDialAction, {
|
|
95
|
+
slotProps: {
|
|
96
|
+
tooltip: {
|
|
97
|
+
title: "test",
|
|
98
|
+
placement: "top",
|
|
99
|
+
open: true,
|
|
100
|
+
classes: TooltipClasses
|
|
101
|
+
},
|
|
102
|
+
fab: FabProps
|
|
103
|
+
}
|
|
104
|
+
});
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
fn({
|
|
4
|
+
MuiSpeedDialAction: {
|
|
5
|
+
defaultProps: {
|
|
6
|
+
FabProps: {
|
|
7
|
+
id: 'test'
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
fn({
|
|
13
|
+
MuiSpeedDialAction: {
|
|
14
|
+
defaultProps: {
|
|
15
|
+
TooltipClasses: classes
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
fn({
|
|
20
|
+
MuiSpeedDialAction: {
|
|
21
|
+
defaultProps: {
|
|
22
|
+
tooltipOpen: true
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
fn({
|
|
27
|
+
MuiSpeedDialAction: {
|
|
28
|
+
defaultProps: {
|
|
29
|
+
tooltipPlacement: 'top'
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
fn({
|
|
34
|
+
MuiSpeedDialAction: {
|
|
35
|
+
defaultProps: {
|
|
36
|
+
tooltipTitle: 'test'
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
fn({
|
|
41
|
+
MuiSpeedDialAction: {
|
|
42
|
+
defaultProps: {
|
|
43
|
+
FabProps: {
|
|
44
|
+
id: 'test'
|
|
45
|
+
},
|
|
46
|
+
TooltipClasses: classes,
|
|
47
|
+
tooltipOpen: true,
|
|
48
|
+
tooltipPlacement: 'top',
|
|
49
|
+
tooltipTitle: 'test'
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
fn({
|
|
54
|
+
MuiSpeedDialAction: {
|
|
55
|
+
defaultProps: {
|
|
56
|
+
TooltipClasses: classes,
|
|
57
|
+
tooltipOpen: true,
|
|
58
|
+
tooltipPlacement: 'top',
|
|
59
|
+
tooltipTitle: 'test'
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
});
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
fn({
|
|
4
|
+
MuiSpeedDialAction: {
|
|
5
|
+
defaultProps: {
|
|
6
|
+
slotProps: {
|
|
7
|
+
fab: {
|
|
8
|
+
id: 'test'
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
fn({
|
|
15
|
+
MuiSpeedDialAction: {
|
|
16
|
+
defaultProps: {
|
|
17
|
+
slotProps: {
|
|
18
|
+
tooltip: {
|
|
19
|
+
classes: classes
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
fn({
|
|
26
|
+
MuiSpeedDialAction: {
|
|
27
|
+
defaultProps: {
|
|
28
|
+
slotProps: {
|
|
29
|
+
tooltip: {
|
|
30
|
+
open: true
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
fn({
|
|
37
|
+
MuiSpeedDialAction: {
|
|
38
|
+
defaultProps: {
|
|
39
|
+
slotProps: {
|
|
40
|
+
tooltip: {
|
|
41
|
+
placement: 'top'
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
fn({
|
|
48
|
+
MuiSpeedDialAction: {
|
|
49
|
+
defaultProps: {
|
|
50
|
+
slotProps: {
|
|
51
|
+
tooltip: {
|
|
52
|
+
title: 'test'
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
fn({
|
|
59
|
+
MuiSpeedDialAction: {
|
|
60
|
+
defaultProps: {
|
|
61
|
+
slotProps: {
|
|
62
|
+
tooltip: {
|
|
63
|
+
title: 'test',
|
|
64
|
+
placement: 'top',
|
|
65
|
+
open: true,
|
|
66
|
+
classes: classes
|
|
67
|
+
},
|
|
68
|
+
fab: {
|
|
69
|
+
id: 'test'
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
fn({
|
|
76
|
+
MuiSpeedDialAction: {
|
|
77
|
+
defaultProps: {
|
|
78
|
+
slotProps: {
|
|
79
|
+
tooltip: {
|
|
80
|
+
title: 'test',
|
|
81
|
+
placement: 'top',
|
|
82
|
+
open: true,
|
|
83
|
+
classes: classes
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
Object.defineProperty(exports, "default", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _tabsClasses.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
var _tabsClasses = _interopRequireDefault(require("./tabs-classes"));
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const classes = [{
|
|
4
|
+
deprecatedClass: '.MuiTabs-flexContainer',
|
|
5
|
+
replacementSelector: '.MuiTabs-list'
|
|
6
|
+
}, {
|
|
7
|
+
deprecatedClass: '.MuiTabs-flexContainerVertical',
|
|
8
|
+
replacementSelector: '.MuiTabs-list.MuiTabs-vertical'
|
|
9
|
+
}];
|
|
10
|
+
const plugin = () => {
|
|
11
|
+
return {
|
|
12
|
+
postcssPlugin: `Replace deprecated Tabs classes with new classes`,
|
|
13
|
+
Rule(rule) {
|
|
14
|
+
const {
|
|
15
|
+
selector
|
|
16
|
+
} = rule;
|
|
17
|
+
classes.forEach(({
|
|
18
|
+
deprecatedClass,
|
|
19
|
+
replacementSelector
|
|
20
|
+
}) => {
|
|
21
|
+
const selectorRegex = new RegExp(`${deprecatedClass}`);
|
|
22
|
+
if (selector.match(selectorRegex)) {
|
|
23
|
+
rule.selector = selector.replace(selectorRegex, replacementSelector);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
plugin.postcss = true;
|
|
30
|
+
module.exports = {
|
|
31
|
+
plugin,
|
|
32
|
+
classes
|
|
33
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
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
|
+
_postcssPlugin.classes.forEach(({
|
|
17
|
+
deprecatedClass,
|
|
18
|
+
replacementSelector
|
|
19
|
+
}) => {
|
|
20
|
+
const replacementSelectorPrefix = '&';
|
|
21
|
+
root.find(j.ImportDeclaration).filter(path => path.node.source.value.match(/^@mui\/material\/Tabs$/)).forEach(path => {
|
|
22
|
+
path.node.specifiers.forEach(specifier => {
|
|
23
|
+
if (specifier.type === 'ImportSpecifier' && specifier.imported.name === 'tabsClasses') {
|
|
24
|
+
const deprecatedAtomicClass = deprecatedClass.replace(`${deprecatedClass.split('-')[0]}-`, '');
|
|
25
|
+
root.find(j.MemberExpression, {
|
|
26
|
+
object: {
|
|
27
|
+
name: specifier.local.name
|
|
28
|
+
},
|
|
29
|
+
property: {
|
|
30
|
+
name: deprecatedAtomicClass
|
|
31
|
+
}
|
|
32
|
+
}).forEach(memberExpression => {
|
|
33
|
+
const parent = memberExpression.parentPath.parentPath.value;
|
|
34
|
+
if (parent.type === j.TemplateLiteral.name) {
|
|
35
|
+
const memberExpressionIndex = parent.expressions.findIndex(expression => expression === memberExpression.value);
|
|
36
|
+
const precedingTemplateElement = parent.quasis[memberExpressionIndex];
|
|
37
|
+
const atomicClasses = replacementSelector.replaceAll('MuiTabs-', '').replaceAll(replacementSelectorPrefix, '').replaceAll(' > ', '').split('.').filter(Boolean);
|
|
38
|
+
if (precedingTemplateElement.value.raw.endsWith(deprecatedClass.startsWith(' ') ? `${replacementSelectorPrefix} .` : `${replacementSelectorPrefix}.`)) {
|
|
39
|
+
const atomicClassesArgs = [memberExpressionIndex, 1, ...atomicClasses.map(atomicClass => j.memberExpression(memberExpression.value.object, j.identifier(atomicClass)))];
|
|
40
|
+
parent.expressions.splice(...atomicClassesArgs);
|
|
41
|
+
if (replacementSelector.includes(' > ')) {
|
|
42
|
+
const quasisArgs = [memberExpressionIndex, 1, j.templateElement({
|
|
43
|
+
raw: precedingTemplateElement.value.raw.replace(' ', ''),
|
|
44
|
+
cooked: precedingTemplateElement.value.cooked.replace(' ', '')
|
|
45
|
+
}, false), j.templateElement({
|
|
46
|
+
raw: ' > .',
|
|
47
|
+
cooked: ' > .'
|
|
48
|
+
}, false)];
|
|
49
|
+
if (atomicClasses.length === 3) {
|
|
50
|
+
quasisArgs.splice(3, 0, j.templateElement({
|
|
51
|
+
raw: '.',
|
|
52
|
+
cooked: '.'
|
|
53
|
+
}, false));
|
|
54
|
+
}
|
|
55
|
+
parent.quasis.splice(...quasisArgs);
|
|
56
|
+
} else {
|
|
57
|
+
parent.quasis.splice(memberExpressionIndex, 1, j.templateElement({
|
|
58
|
+
raw: precedingTemplateElement.value.raw,
|
|
59
|
+
cooked: precedingTemplateElement.value.cooked
|
|
60
|
+
}, false), ...(atomicClasses.length > 1 ? [j.templateElement({
|
|
61
|
+
raw: '.',
|
|
62
|
+
cooked: '.'
|
|
63
|
+
}, false)] : []));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
const selectorRegex = new RegExp(`${replacementSelectorPrefix}${deprecatedClass}$`);
|
|
72
|
+
root.find(j.Literal, literal => typeof literal.value === 'string' && literal.value.match(selectorRegex)).forEach(path => {
|
|
73
|
+
path.replace(j.literal(path.value.value.replace(selectorRegex, `${replacementSelectorPrefix}${replacementSelector}`)));
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
return root.toSource(printOptions);
|
|
77
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
Object.defineProperty(exports, "default", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _tabsProps.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
var _tabsProps = _interopRequireDefault(require("./tabs-props"));
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = transformer;
|
|
8
|
+
var _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: 'Tabs',
|
|
21
|
+
propName: 'ScrollButtonComponent',
|
|
22
|
+
slotName: 'scrollButton'
|
|
23
|
+
});
|
|
24
|
+
(0, _movePropIntoSlotProps.default)(j, {
|
|
25
|
+
root,
|
|
26
|
+
componentName: 'Tabs',
|
|
27
|
+
propName: 'TabScrollButtonProps',
|
|
28
|
+
slotName: 'scrollButton'
|
|
29
|
+
});
|
|
30
|
+
(0, _movePropIntoSlotProps.default)(j, {
|
|
31
|
+
root,
|
|
32
|
+
componentName: 'Tabs',
|
|
33
|
+
propName: 'TabIndicatorProps',
|
|
34
|
+
slotName: 'indicator'
|
|
35
|
+
});
|
|
36
|
+
return root.toSource(printOptions);
|
|
37
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _Tabs = _interopRequireDefault(require("@mui/material/Tabs"));
|
|
5
|
+
var _material = require("@mui/material");
|
|
6
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
7
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Tabs.default, {
|
|
8
|
+
ScrollButtonComponent: CustomScrollButton,
|
|
9
|
+
TabScrollButtonProps: {
|
|
10
|
+
disableRipple: true
|
|
11
|
+
},
|
|
12
|
+
TabIndicatorProps: {
|
|
13
|
+
className: 'indicator'
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tabs, {
|
|
17
|
+
ScrollButtonComponent: CustomScrollButton,
|
|
18
|
+
TabScrollButtonProps: {
|
|
19
|
+
disableRipple: true
|
|
20
|
+
},
|
|
21
|
+
TabIndicatorProps: {
|
|
22
|
+
className: 'indicator'
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(CustomTabs, {
|
|
26
|
+
ScrollButtonComponent: CustomScrollButton,
|
|
27
|
+
TabScrollButtonProps: {
|
|
28
|
+
disableRipple: true
|
|
29
|
+
},
|
|
30
|
+
TabIndicatorProps: {
|
|
31
|
+
className: 'indicator'
|
|
32
|
+
}
|
|
33
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _Tabs = _interopRequireDefault(require("@mui/material/Tabs"));
|
|
5
|
+
var _material = require("@mui/material");
|
|
6
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
7
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Tabs.default, {
|
|
8
|
+
slots: {
|
|
9
|
+
scrollButton: CustomScrollButton
|
|
10
|
+
},
|
|
11
|
+
slotProps: {
|
|
12
|
+
scrollButton: {
|
|
13
|
+
disableRipple: true
|
|
14
|
+
},
|
|
15
|
+
indicator: {
|
|
16
|
+
className: 'indicator'
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tabs, {
|
|
21
|
+
slots: {
|
|
22
|
+
scrollButton: CustomScrollButton
|
|
23
|
+
},
|
|
24
|
+
slotProps: {
|
|
25
|
+
scrollButton: {
|
|
26
|
+
disableRipple: true
|
|
27
|
+
},
|
|
28
|
+
indicator: {
|
|
29
|
+
className: 'indicator'
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(CustomTabs, {
|
|
34
|
+
ScrollButtonComponent: CustomScrollButton,
|
|
35
|
+
TabScrollButtonProps: {
|
|
36
|
+
disableRipple: true
|
|
37
|
+
},
|
|
38
|
+
TabIndicatorProps: {
|
|
39
|
+
className: 'indicator'
|
|
40
|
+
}
|
|
41
|
+
});
|