@mui/codemod 7.1.0 → 7.2.0
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 +32 -0
- package/codemod.js +8 -0
- package/deprecations/accordion-props/accordion-props.js +2 -0
- package/deprecations/accordion-props/test-cases/package.actual.js +68 -0
- package/deprecations/accordion-props/test-cases/package.expected.js +74 -0
- package/deprecations/accordion-summary-classes/accordion-summary-classes.js +1 -1
- package/deprecations/accordion-summary-classes/test-cases/package.actual.js +54 -0
- package/deprecations/accordion-summary-classes/test-cases/package.expected.js +54 -0
- package/deprecations/alert-classes/alert-classes.js +1 -1
- package/deprecations/alert-classes/test-cases/package.actual.js +27 -0
- package/deprecations/alert-classes/test-cases/package.expected.js +27 -0
- package/deprecations/alert-props/alert-props.js +1 -0
- package/deprecations/alert-props/test-cases/package.actual.js +60 -0
- package/deprecations/alert-props/test-cases/package.expected.js +52 -0
- package/deprecations/all/deprecations-all.js +2 -0
- package/deprecations/autocomplete-props/autocomplete-props.js +7 -0
- package/deprecations/autocomplete-props/test-cases/package.actual.js +113 -0
- package/deprecations/autocomplete-props/test-cases/package.expected.js +125 -0
- package/deprecations/avatar-group-props/avatar-group-props.js +4 -2
- package/deprecations/avatar-group-props/test-cases/package.actual.js +56 -0
- package/deprecations/avatar-group-props/test-cases/package.expected.js +58 -0
- package/deprecations/avatar-props/avatar-props.js +2 -1
- package/deprecations/avatar-props/test-cases/package.actual.js +36 -0
- package/deprecations/avatar-props/test-cases/package.expected.js +42 -0
- package/deprecations/backdrop-props/backdrop-props.js +2 -0
- package/deprecations/backdrop-props/test-cases/package.actual.js +81 -0
- package/deprecations/backdrop-props/test-cases/package.expected.js +81 -0
- package/deprecations/badge-props/badge-props.js +2 -1
- package/deprecations/badge-props/test-cases/package.actual.js +59 -0
- package/deprecations/badge-props/test-cases/package.expected.js +51 -0
- package/deprecations/button-classes/button-classes.js +1 -1
- package/deprecations/button-classes/test-cases/package.actual.js +69 -0
- package/deprecations/button-classes/test-cases/package.expected.js +69 -0
- package/deprecations/button-group-classes/button-group-classes.js +1 -1
- package/deprecations/button-group-classes/test-cases/package.actual.js +37 -0
- package/deprecations/button-group-classes/test-cases/package.expected.js +37 -0
- package/deprecations/card-header-props/card-header-props.js +2 -0
- package/deprecations/card-header-props/test-cases/package.actual.js +66 -0
- package/deprecations/card-header-props/test-cases/package.expected.js +78 -0
- package/deprecations/chip-classes/chip-classes.js +1 -1
- package/deprecations/chip-classes/test-cases/package.actual.js +55 -0
- package/deprecations/chip-classes/test-cases/package.expected.js +55 -0
- package/deprecations/circular-progress-classes/circular-progress-classes.js +1 -1
- package/deprecations/circular-progress-classes/test-cases/package.actual.js +7 -0
- package/deprecations/circular-progress-classes/test-cases/package.expected.js +7 -0
- package/deprecations/dialog-classes/dialog-classes.js +1 -1
- package/deprecations/dialog-classes/test-cases/package.actual.js +7 -0
- package/deprecations/dialog-classes/test-cases/package.expected.js +7 -0
- package/deprecations/dialog-props/dialog-props.js +40 -0
- package/deprecations/dialog-props/index.js +13 -0
- package/deprecations/dialog-props/test-cases/actual.js +47 -0
- package/deprecations/dialog-props/test-cases/expected.js +60 -0
- package/deprecations/dialog-props/test-cases/package.actual.js +47 -0
- package/deprecations/dialog-props/test-cases/package.expected.js +60 -0
- package/deprecations/dialog-props/test-cases/theme.actual.js +36 -0
- package/deprecations/dialog-props/test-cases/theme.expected.js +43 -0
- package/deprecations/divider-props/divider-props.js +3 -1
- package/deprecations/divider-props/test-cases/package.actual.js +45 -0
- package/deprecations/divider-props/test-cases/package.expected.js +50 -0
- package/deprecations/drawer-classes/drawer-classes.js +1 -1
- package/deprecations/drawer-classes/test-cases/package.actual.js +19 -0
- package/deprecations/drawer-classes/test-cases/package.expected.js +19 -0
- package/deprecations/drawer-props/drawer-props.js +8 -0
- package/deprecations/drawer-props/test-cases/package.actual.js +73 -0
- package/deprecations/drawer-props/test-cases/package.expected.js +97 -0
- package/deprecations/filled-input-props/filled-input-props.js +1 -0
- package/deprecations/filled-input-props/test-cases/package.actual.js +60 -0
- package/deprecations/filled-input-props/test-cases/package.expected.js +52 -0
- package/deprecations/form-control-label-props/form-control-label-props.js +1 -0
- package/deprecations/form-control-label-props/test-cases/package.actual.js +21 -0
- package/deprecations/form-control-label-props/test-cases/package.expected.js +21 -0
- package/deprecations/image-list-item-bar-classes/image-list-item-bar-classes.js +1 -1
- package/deprecations/image-list-item-bar-classes/test-cases/package.actual.js +11 -0
- package/deprecations/image-list-item-bar-classes/test-cases/package.expected.js +11 -0
- package/deprecations/input-base-classes/input-base-classes.js +1 -1
- package/deprecations/input-base-classes/test-cases/package.actual.js +13 -0
- package/deprecations/input-base-classes/test-cases/package.expected.js +13 -0
- package/deprecations/input-base-props/input-base-props.js +1 -0
- package/deprecations/input-base-props/test-cases/package.actual.js +60 -0
- package/deprecations/input-base-props/test-cases/package.expected.js +52 -0
- package/deprecations/input-props/input-props.js +1 -0
- package/deprecations/input-props/test-cases/package.actual.js +60 -0
- package/deprecations/input-props/test-cases/package.expected.js +52 -0
- package/deprecations/linear-progress-classes/linear-progress-classes.js +1 -1
- package/deprecations/linear-progress-classes/test-cases/package.actual.js +21 -0
- package/deprecations/linear-progress-classes/test-cases/package.expected.js +21 -0
- package/deprecations/list-item-props/list-item-props.js +3 -0
- package/deprecations/list-item-props/test-cases/package.actual.js +49 -0
- package/deprecations/list-item-props/test-cases/package.expected.js +50 -0
- package/deprecations/list-item-text-props/list-item-text-props.js +3 -0
- package/deprecations/list-item-text-props/test-cases/package.actual.js +21 -0
- package/deprecations/list-item-text-props/test-cases/package.expected.js +27 -0
- package/deprecations/menu-props/menu-props.js +3 -0
- package/deprecations/menu-props/test-cases/package.actual.js +67 -0
- package/deprecations/menu-props/test-cases/package.expected.js +83 -0
- package/deprecations/mobile-stepper-props/mobile-stepper-props.js +1 -0
- package/deprecations/mobile-stepper-props/test-cases/package.actual.js +30 -0
- package/deprecations/mobile-stepper-props/test-cases/package.expected.js +34 -0
- package/deprecations/modal-props/modal-props.js +3 -0
- package/deprecations/modal-props/test-cases/package.actual.js +49 -0
- package/deprecations/modal-props/test-cases/package.expected.js +50 -0
- package/deprecations/outlined-input-props/outlined-input-props.js +1 -0
- package/deprecations/outlined-input-props/test-cases/package.actual.js +60 -0
- package/deprecations/outlined-input-props/test-cases/package.expected.js +52 -0
- package/deprecations/pagination-item-classes/pagination-item-classes.js +1 -1
- package/deprecations/pagination-item-classes/test-cases/package.actual.js +108 -0
- package/deprecations/pagination-item-classes/test-cases/package.expected.js +108 -0
- package/deprecations/pagination-item-props/pagination-item-props.js +1 -0
- package/deprecations/pagination-item-props/test-cases/package.actual.js +27 -0
- package/deprecations/pagination-item-props/test-cases/package.expected.js +21 -0
- package/deprecations/popover-props/popover-props.js +5 -0
- package/deprecations/popover-props/test-cases/package.actual.js +73 -0
- package/deprecations/popover-props/test-cases/package.expected.js +89 -0
- package/deprecations/popper-props/popper-props.js +1 -0
- package/deprecations/popper-props/test-cases/package.actual.js +27 -0
- package/deprecations/popper-props/test-cases/package.expected.js +24 -0
- package/deprecations/rating-props/rating-props.js +1 -0
- package/deprecations/rating-props/test-cases/package.actual.js +37 -0
- package/deprecations/rating-props/test-cases/package.expected.js +53 -0
- package/deprecations/select-classes/select-classes.js +1 -1
- package/deprecations/select-classes/test-cases/package.actual.js +9 -0
- package/deprecations/select-classes/test-cases/package.expected.js +9 -0
- package/deprecations/slider-classes/slider-classes.js +1 -1
- package/deprecations/slider-classes/test-cases/package.actual.js +19 -0
- package/deprecations/slider-classes/test-cases/package.expected.js +19 -0
- package/deprecations/slider-props/slider-props.js +1 -0
- package/deprecations/slider-props/test-cases/package.actual.js +60 -0
- package/deprecations/slider-props/test-cases/package.expected.js +52 -0
- package/deprecations/snackbar-props/snackbar-props.js +4 -0
- package/deprecations/snackbar-props/test-cases/package.actual.js +54 -0
- package/deprecations/snackbar-props/test-cases/package.expected.js +67 -0
- package/deprecations/speed-dial-action-props/speed-dial-action-props.js +5 -0
- package/deprecations/speed-dial-action-props/test-cases/package.actual.js +56 -0
- package/deprecations/speed-dial-action-props/test-cases/package.expected.js +104 -0
- package/deprecations/speed-dial-props/speed-dial-props.js +2 -0
- package/deprecations/speed-dial-props/test-cases/package.actual.js +41 -0
- package/deprecations/speed-dial-props/test-cases/package.expected.js +54 -0
- package/deprecations/step-connector-classes/step-connector-classes.js +1 -1
- package/deprecations/step-connector-classes/test-cases/package.actual.js +7 -0
- package/deprecations/step-connector-classes/test-cases/package.expected.js +7 -0
- package/deprecations/step-content-props/step-content-props.js +2 -0
- package/deprecations/step-content-props/test-cases/package.actual.js +65 -0
- package/deprecations/step-content-props/test-cases/package.expected.js +74 -0
- package/deprecations/step-label-props/step-label-props.js +3 -0
- package/deprecations/step-label-props/test-cases/package.actual.js +44 -0
- package/deprecations/step-label-props/test-cases/package.expected.js +48 -0
- package/deprecations/tab-classes/tab-classes.js +1 -1
- package/deprecations/tab-classes/test-cases/package.actual.js +5 -0
- package/deprecations/tab-classes/test-cases/package.expected.js +5 -0
- package/deprecations/table-pagination-props/table-pagination-props.js +2 -0
- package/deprecations/table-pagination-props/test-cases/package.actual.js +62 -0
- package/deprecations/table-pagination-props/test-cases/package.expected.js +72 -0
- package/deprecations/table-sort-label-classes/table-sort-label-classes.js +1 -1
- package/deprecations/table-sort-label-classes/test-cases/package.actual.js +7 -0
- package/deprecations/table-sort-label-classes/test-cases/package.expected.js +7 -0
- package/deprecations/tabs-classes/tabs-classes.js +1 -1
- package/deprecations/tabs-classes/test-cases/package.actual.js +7 -0
- package/deprecations/tabs-classes/test-cases/package.expected.js +7 -0
- package/deprecations/tabs-props/tabs-props.js +3 -0
- package/deprecations/tabs-props/test-cases/package.actual.js +33 -0
- package/deprecations/tabs-props/test-cases/package.expected.js +41 -0
- package/deprecations/text-field-props/test-cases/package.actual.js +27 -0
- package/deprecations/text-field-props/test-cases/package.expected.js +31 -0
- package/deprecations/text-field-props/text-field-props.js +5 -0
- package/deprecations/toggle-button-group-classes/test-cases/package.actual.js +7 -0
- package/deprecations/toggle-button-group-classes/test-cases/package.expected.js +7 -0
- package/deprecations/toggle-button-group-classes/toggle-button-group-classes.js +1 -1
- package/deprecations/tooltip-props/test-cases/package.actual.js +141 -0
- package/deprecations/tooltip-props/test-cases/package.expected.js +141 -0
- package/deprecations/tooltip-props/tooltip-props.js +5 -0
- package/deprecations/typography-props/test-cases/package.actual.js +88 -0
- package/deprecations/typography-props/test-cases/package.expected.js +98 -0
- package/deprecations/typography-props/typography-props.js +1 -0
- package/deprecations/utils/movePropIntoSlotProps.js +2 -10
- package/deprecations/utils/movePropIntoSlots.js +2 -10
- package/deprecations/utils/replaceComponentsWithSlots.js +3 -13
- package/package.json +5 -5
- package/util/findComponentJSX.js +4 -3
- package/v6.0.0/grid-v2-props/grid-v2-props.js +5 -0
- package/v6.0.0/grid-v2-props/test-cases/package.actual.js +91 -0
- package/v6.0.0/grid-v2-props/test-cases/package.expected.js +91 -0
- package/v6.0.0/list-item-button-prop/list-item-button-prop.js +8 -4
- package/v6.0.0/list-item-button-prop/test-cases/package.actual.js +31 -0
- package/v6.0.0/list-item-button-prop/test-cases/package.expected.js +20 -0
- package/v7.0.0/grid-props/grid-props.js +5 -0
- package/v7.0.0/grid-props/test-cases/package.actual.js +91 -0
- package/v7.0.0/grid-props/test-cases/package.expected.js +91 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _Grid = _interopRequireDefault(require("@org/ui/material/Grid2"));
|
|
5
|
+
var _Grid2 = _interopRequireDefault(require("@org/ui/material/Grid"));
|
|
6
|
+
var _material = require("@org/ui/material");
|
|
7
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
+
// Transforms on all the possible imports
|
|
9
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
10
|
+
xs: 2
|
|
11
|
+
});
|
|
12
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Grid2, {
|
|
13
|
+
xs: 2
|
|
14
|
+
});
|
|
15
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
16
|
+
item: true
|
|
17
|
+
});
|
|
18
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
19
|
+
item: true
|
|
20
|
+
});
|
|
21
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
22
|
+
item: false
|
|
23
|
+
});
|
|
24
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
25
|
+
zeroMinWidth: true
|
|
26
|
+
});
|
|
27
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
28
|
+
zeroMinWidth: true
|
|
29
|
+
});
|
|
30
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
31
|
+
zeroMinWidth: false
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// Transforms responsive sizes
|
|
35
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
36
|
+
xs: 2,
|
|
37
|
+
sm: 4,
|
|
38
|
+
md: 6,
|
|
39
|
+
lg: 8,
|
|
40
|
+
xl: 10
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// Transforms all the possible size values
|
|
44
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
45
|
+
xs: true,
|
|
46
|
+
sm: "auto",
|
|
47
|
+
md: 2,
|
|
48
|
+
lg: true,
|
|
49
|
+
xl: false
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
// Doesn't add jsx object expression for single string values
|
|
53
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
54
|
+
xs: "auto"
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
// Transforms offset
|
|
58
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
59
|
+
xsOffset: 2
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
// Transforms responsive offset
|
|
63
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
64
|
+
xsOffset: 2,
|
|
65
|
+
smOffset: 4,
|
|
66
|
+
mdOffset: 6,
|
|
67
|
+
lgOffset: 8,
|
|
68
|
+
xlOffset: 10
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
// Transforms all the possible offset values
|
|
72
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
73
|
+
xsOffset: 2,
|
|
74
|
+
smOffset: "auto"
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
// Transforms spread props
|
|
78
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
79
|
+
xs: 2,
|
|
80
|
+
sm: 4,
|
|
81
|
+
xsOffset: 0,
|
|
82
|
+
smOffset: 2
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
// Doesn't transform Grid v1
|
|
86
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid2.default, {
|
|
87
|
+
xs: 2
|
|
88
|
+
});
|
|
89
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Grid, {
|
|
90
|
+
xs: 2
|
|
91
|
+
});
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _Grid = _interopRequireDefault(require("@org/ui/material/Grid2"));
|
|
5
|
+
var _Grid2 = _interopRequireDefault(require("@org/ui/material/Grid"));
|
|
6
|
+
var _material = require("@org/ui/material");
|
|
7
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
+
// Transforms on all the possible imports
|
|
9
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
10
|
+
size: 2
|
|
11
|
+
});
|
|
12
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Grid2, {
|
|
13
|
+
size: 2
|
|
14
|
+
});
|
|
15
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {});
|
|
16
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {});
|
|
17
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {});
|
|
18
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {});
|
|
19
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {});
|
|
20
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {});
|
|
21
|
+
|
|
22
|
+
// Transforms responsive sizes
|
|
23
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
24
|
+
size: {
|
|
25
|
+
xs: 2,
|
|
26
|
+
sm: 4,
|
|
27
|
+
md: 6,
|
|
28
|
+
lg: 8,
|
|
29
|
+
xl: 10
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
// Transforms all the possible size values
|
|
34
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
35
|
+
size: {
|
|
36
|
+
xs: "grow",
|
|
37
|
+
sm: "auto",
|
|
38
|
+
md: 2,
|
|
39
|
+
lg: "grow",
|
|
40
|
+
xl: false
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
// Doesn't add jsx object expression for single string values
|
|
45
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
46
|
+
size: "auto"
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// Transforms offset
|
|
50
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
51
|
+
offset: 2
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// Transforms responsive offset
|
|
55
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
56
|
+
offset: {
|
|
57
|
+
xs: 2,
|
|
58
|
+
sm: 4,
|
|
59
|
+
md: 6,
|
|
60
|
+
lg: 8,
|
|
61
|
+
xl: 10
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
// Transforms all the possible offset values
|
|
66
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
67
|
+
offset: {
|
|
68
|
+
xs: 2,
|
|
69
|
+
sm: "auto"
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
// Transforms spread props
|
|
74
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
75
|
+
size: {
|
|
76
|
+
xs: 2,
|
|
77
|
+
sm: 4
|
|
78
|
+
},
|
|
79
|
+
offset: {
|
|
80
|
+
xs: 0,
|
|
81
|
+
sm: 2
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
// Doesn't transform Grid v1
|
|
86
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid2.default, {
|
|
87
|
+
xs: 2
|
|
88
|
+
});
|
|
89
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Grid, {
|
|
90
|
+
xs: 2
|
|
91
|
+
});
|
|
@@ -15,6 +15,9 @@ function transformer(file, api, options) {
|
|
|
15
15
|
const j = api.jscodeshift;
|
|
16
16
|
const root = j(file.source);
|
|
17
17
|
const printOptions = options.printOptions;
|
|
18
|
+
const {
|
|
19
|
+
packageName = '@mui/material'
|
|
20
|
+
} = options;
|
|
18
21
|
const defaultPropsPathCollection = (0, _findComponentDefaultProps.default)(j, {
|
|
19
22
|
root,
|
|
20
23
|
componentName: 'ListItem'
|
|
@@ -45,6 +48,7 @@ function transformer(file, api, options) {
|
|
|
45
48
|
// Rename components that have ListItem button to ListItemButton
|
|
46
49
|
(0, _findComponentJSX.default)(j, {
|
|
47
50
|
root,
|
|
51
|
+
packageName,
|
|
48
52
|
componentName: 'ListItem'
|
|
49
53
|
}, elementPath => {
|
|
50
54
|
const index = elementPath.node.openingElement.attributes.findIndex(attr => attr.type === 'JSXAttribute' && attr.name.name === 'button');
|
|
@@ -59,7 +63,7 @@ function transformer(file, api, options) {
|
|
|
59
63
|
}
|
|
60
64
|
});
|
|
61
65
|
const importsToRemove = [...openTaggedHavingButtonProp].filter(item => !openTaggedNotHavingButtonProp.has(item));
|
|
62
|
-
root.find(j.ImportDeclaration).filter(path => path.node.source.value
|
|
66
|
+
root.find(j.ImportDeclaration).filter(path => path.node.source.value.match(new RegExp(`^${packageName}(/ListItem)?$`))).filter(path => {
|
|
63
67
|
path.node.specifiers.forEach(specifier => {
|
|
64
68
|
if (specifier.type === 'ImportDefaultSpecifier') {
|
|
65
69
|
if (importsToRemove.includes(specifier.local.name)) {
|
|
@@ -72,7 +76,7 @@ function transformer(file, api, options) {
|
|
|
72
76
|
}
|
|
73
77
|
return false;
|
|
74
78
|
}).remove();
|
|
75
|
-
root.find(j.ImportDeclaration).filter(path => path.node.source.value
|
|
79
|
+
root.find(j.ImportDeclaration).filter(path => path.node.source.value.match(new RegExp(`^${packageName}$`))).filter(path => {
|
|
76
80
|
path.node.specifiers.forEach(specifier => {
|
|
77
81
|
if (specifier.type === 'ImportSpecifier' && specifier.imported.name === 'ListItem' && importsToRemove.includes(specifier.local.name)) {
|
|
78
82
|
path.node.specifiers = path.node.specifiers.filter(spec => spec !== specifier);
|
|
@@ -85,12 +89,12 @@ function transformer(file, api, options) {
|
|
|
85
89
|
}).remove();
|
|
86
90
|
|
|
87
91
|
// If ListItemButton import does not already exist, add it at the end
|
|
88
|
-
const imports = root.find(j.ImportDeclaration).filter(path => path.node.source.value
|
|
92
|
+
const imports = root.find(j.ImportDeclaration).filter(path => path.node.source.value.match(new RegExp(`^${packageName}/ListItemButton$`)));
|
|
89
93
|
if (addedListItemButton && imports.length === 0) {
|
|
90
94
|
const lastImport = root.find(j.ImportDeclaration).at(-1);
|
|
91
95
|
|
|
92
96
|
// Insert the import for 'ListItemButton' after the last import declaration
|
|
93
|
-
lastImport.insertAfter(j.importDeclaration([j.importDefaultSpecifier(j.identifier('ListItemButton'))], j.stringLiteral(
|
|
97
|
+
lastImport.insertAfter(j.importDeclaration([j.importDefaultSpecifier(j.identifier('ListItemButton'))], j.stringLiteral(`${packageName}/ListItemButton`)));
|
|
94
98
|
}
|
|
95
99
|
return root.toSource(printOptions);
|
|
96
100
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _ListItem = _interopRequireDefault(require("@org/ui/material/ListItem"));
|
|
5
|
+
var _material = require("@org/ui/material");
|
|
6
|
+
var _ui = _interopRequireDefault(require("ui"));
|
|
7
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItem.default, {
|
|
9
|
+
button: true
|
|
10
|
+
});
|
|
11
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItem.default, {});
|
|
12
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItem, {});
|
|
13
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItem, {
|
|
14
|
+
button: true
|
|
15
|
+
});
|
|
16
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItem.default, {
|
|
17
|
+
button: true
|
|
18
|
+
});
|
|
19
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItem, {
|
|
20
|
+
button: true
|
|
21
|
+
});
|
|
22
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItem, {
|
|
23
|
+
button: true
|
|
24
|
+
});
|
|
25
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItem, {});
|
|
26
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItem, {
|
|
27
|
+
button: true
|
|
28
|
+
});
|
|
29
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.default, {
|
|
30
|
+
button: true
|
|
31
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _ListItem = _interopRequireDefault(require("@org/ui/material/ListItem"));
|
|
5
|
+
var _material = require("@org/ui/material");
|
|
6
|
+
var _ui = _interopRequireDefault(require("ui"));
|
|
7
|
+
var _ListItemButton = _interopRequireDefault(require("@org/ui/material/ListItemButton"));
|
|
8
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemButton.default, {});
|
|
10
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItem.default, {});
|
|
11
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItem, {});
|
|
12
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemButton.default, {});
|
|
13
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemButton.default, {});
|
|
14
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemButton.default, {});
|
|
15
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemButton.default, {});
|
|
16
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItem, {});
|
|
17
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemButton.default, {});
|
|
18
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.default, {
|
|
19
|
+
button: true
|
|
20
|
+
});
|
|
@@ -24,6 +24,11 @@ function gridV2Props(file, api, options) {
|
|
|
24
24
|
const root = j(file.source);
|
|
25
25
|
const breakpoints = options.muiBreakpoints?.split(',') || defaultBreakpoints;
|
|
26
26
|
const printOptions = options.printOptions;
|
|
27
|
+
const packageName = options.packageName;
|
|
28
|
+
if (packageName) {
|
|
29
|
+
possibleDefaultImports.push(`${packageName}/Grid`);
|
|
30
|
+
possibleNamedImports[packageName] = 'Grid';
|
|
31
|
+
}
|
|
27
32
|
const gridLocalNames = [];
|
|
28
33
|
root.find(j.ImportDeclaration, decl => possibleDefaultImports.includes(decl.source.value)).forEach(decl => {
|
|
29
34
|
decl.node.specifiers.forEach(spec => {
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _Grid = _interopRequireDefault(require("@org/ui/material/Grid"));
|
|
5
|
+
var _GridLegacy = _interopRequireDefault(require("@org/ui/material/GridLegacy"));
|
|
6
|
+
var _material = require("@org/ui/material");
|
|
7
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
+
// Transforms on all the possible imports
|
|
9
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
10
|
+
xs: 2
|
|
11
|
+
});
|
|
12
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Grid, {
|
|
13
|
+
xs: 2
|
|
14
|
+
});
|
|
15
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
16
|
+
item: true
|
|
17
|
+
});
|
|
18
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
19
|
+
item: true
|
|
20
|
+
});
|
|
21
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
22
|
+
item: false
|
|
23
|
+
});
|
|
24
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
25
|
+
zeroMinWidth: true
|
|
26
|
+
});
|
|
27
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
28
|
+
zeroMinWidth: true
|
|
29
|
+
});
|
|
30
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
31
|
+
zeroMinWidth: false
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// Transforms responsive sizes
|
|
35
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
36
|
+
xs: 2,
|
|
37
|
+
sm: 4,
|
|
38
|
+
md: 6,
|
|
39
|
+
lg: 8,
|
|
40
|
+
xl: 10
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// Transforms all the possible size values
|
|
44
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
45
|
+
xs: true,
|
|
46
|
+
sm: "auto",
|
|
47
|
+
md: 2,
|
|
48
|
+
lg: true,
|
|
49
|
+
xl: false
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
// Doesn't add jsx object expression for single string values
|
|
53
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
54
|
+
xs: "auto"
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
// Transforms offset
|
|
58
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
59
|
+
xsOffset: 2
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
// Transforms responsive offset
|
|
63
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
64
|
+
xsOffset: 2,
|
|
65
|
+
smOffset: 4,
|
|
66
|
+
mdOffset: 6,
|
|
67
|
+
lgOffset: 8,
|
|
68
|
+
xlOffset: 10
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
// Transforms all the possible offset values
|
|
72
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
73
|
+
xsOffset: 2,
|
|
74
|
+
smOffset: "auto"
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
// Transforms spread props
|
|
78
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
79
|
+
xs: 2,
|
|
80
|
+
sm: 4,
|
|
81
|
+
xsOffset: 0,
|
|
82
|
+
smOffset: 2
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
// Doesn't transform Grid v1
|
|
86
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_GridLegacy.default, {
|
|
87
|
+
xs: 2
|
|
88
|
+
});
|
|
89
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.GridLegacy, {
|
|
90
|
+
xs: 2
|
|
91
|
+
});
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _Grid = _interopRequireDefault(require("@org/ui/material/Grid"));
|
|
5
|
+
var _GridLegacy = _interopRequireDefault(require("@org/ui/material/GridLegacy"));
|
|
6
|
+
var _material = require("@org/ui/material");
|
|
7
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
+
// Transforms on all the possible imports
|
|
9
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
10
|
+
size: 2
|
|
11
|
+
});
|
|
12
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Grid, {
|
|
13
|
+
size: 2
|
|
14
|
+
});
|
|
15
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {});
|
|
16
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {});
|
|
17
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {});
|
|
18
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {});
|
|
19
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {});
|
|
20
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {});
|
|
21
|
+
|
|
22
|
+
// Transforms responsive sizes
|
|
23
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
24
|
+
size: {
|
|
25
|
+
xs: 2,
|
|
26
|
+
sm: 4,
|
|
27
|
+
md: 6,
|
|
28
|
+
lg: 8,
|
|
29
|
+
xl: 10
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
// Transforms all the possible size values
|
|
34
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
35
|
+
size: {
|
|
36
|
+
xs: "grow",
|
|
37
|
+
sm: "auto",
|
|
38
|
+
md: 2,
|
|
39
|
+
lg: "grow",
|
|
40
|
+
xl: false
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
// Doesn't add jsx object expression for single string values
|
|
45
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
46
|
+
size: "auto"
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// Transforms offset
|
|
50
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
51
|
+
offset: 2
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// Transforms responsive offset
|
|
55
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
56
|
+
offset: {
|
|
57
|
+
xs: 2,
|
|
58
|
+
sm: 4,
|
|
59
|
+
md: 6,
|
|
60
|
+
lg: 8,
|
|
61
|
+
xl: 10
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
// Transforms all the possible offset values
|
|
66
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
67
|
+
offset: {
|
|
68
|
+
xs: 2,
|
|
69
|
+
sm: "auto"
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
// Transforms spread props
|
|
74
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
75
|
+
size: {
|
|
76
|
+
xs: 2,
|
|
77
|
+
sm: 4
|
|
78
|
+
},
|
|
79
|
+
offset: {
|
|
80
|
+
xs: 0,
|
|
81
|
+
sm: 2
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
// Doesn't transform Grid v1
|
|
86
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_GridLegacy.default, {
|
|
87
|
+
xs: 2
|
|
88
|
+
});
|
|
89
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.GridLegacy, {
|
|
90
|
+
xs: 2
|
|
91
|
+
});
|