@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.
Files changed (187) hide show
  1. package/README.md +32 -0
  2. package/codemod.js +8 -0
  3. package/deprecations/accordion-props/accordion-props.js +2 -0
  4. package/deprecations/accordion-props/test-cases/package.actual.js +68 -0
  5. package/deprecations/accordion-props/test-cases/package.expected.js +74 -0
  6. package/deprecations/accordion-summary-classes/accordion-summary-classes.js +1 -1
  7. package/deprecations/accordion-summary-classes/test-cases/package.actual.js +54 -0
  8. package/deprecations/accordion-summary-classes/test-cases/package.expected.js +54 -0
  9. package/deprecations/alert-classes/alert-classes.js +1 -1
  10. package/deprecations/alert-classes/test-cases/package.actual.js +27 -0
  11. package/deprecations/alert-classes/test-cases/package.expected.js +27 -0
  12. package/deprecations/alert-props/alert-props.js +1 -0
  13. package/deprecations/alert-props/test-cases/package.actual.js +60 -0
  14. package/deprecations/alert-props/test-cases/package.expected.js +52 -0
  15. package/deprecations/all/deprecations-all.js +2 -0
  16. package/deprecations/autocomplete-props/autocomplete-props.js +7 -0
  17. package/deprecations/autocomplete-props/test-cases/package.actual.js +113 -0
  18. package/deprecations/autocomplete-props/test-cases/package.expected.js +125 -0
  19. package/deprecations/avatar-group-props/avatar-group-props.js +4 -2
  20. package/deprecations/avatar-group-props/test-cases/package.actual.js +56 -0
  21. package/deprecations/avatar-group-props/test-cases/package.expected.js +58 -0
  22. package/deprecations/avatar-props/avatar-props.js +2 -1
  23. package/deprecations/avatar-props/test-cases/package.actual.js +36 -0
  24. package/deprecations/avatar-props/test-cases/package.expected.js +42 -0
  25. package/deprecations/backdrop-props/backdrop-props.js +2 -0
  26. package/deprecations/backdrop-props/test-cases/package.actual.js +81 -0
  27. package/deprecations/backdrop-props/test-cases/package.expected.js +81 -0
  28. package/deprecations/badge-props/badge-props.js +2 -1
  29. package/deprecations/badge-props/test-cases/package.actual.js +59 -0
  30. package/deprecations/badge-props/test-cases/package.expected.js +51 -0
  31. package/deprecations/button-classes/button-classes.js +1 -1
  32. package/deprecations/button-classes/test-cases/package.actual.js +69 -0
  33. package/deprecations/button-classes/test-cases/package.expected.js +69 -0
  34. package/deprecations/button-group-classes/button-group-classes.js +1 -1
  35. package/deprecations/button-group-classes/test-cases/package.actual.js +37 -0
  36. package/deprecations/button-group-classes/test-cases/package.expected.js +37 -0
  37. package/deprecations/card-header-props/card-header-props.js +2 -0
  38. package/deprecations/card-header-props/test-cases/package.actual.js +66 -0
  39. package/deprecations/card-header-props/test-cases/package.expected.js +78 -0
  40. package/deprecations/chip-classes/chip-classes.js +1 -1
  41. package/deprecations/chip-classes/test-cases/package.actual.js +55 -0
  42. package/deprecations/chip-classes/test-cases/package.expected.js +55 -0
  43. package/deprecations/circular-progress-classes/circular-progress-classes.js +1 -1
  44. package/deprecations/circular-progress-classes/test-cases/package.actual.js +7 -0
  45. package/deprecations/circular-progress-classes/test-cases/package.expected.js +7 -0
  46. package/deprecations/dialog-classes/dialog-classes.js +1 -1
  47. package/deprecations/dialog-classes/test-cases/package.actual.js +7 -0
  48. package/deprecations/dialog-classes/test-cases/package.expected.js +7 -0
  49. package/deprecations/dialog-props/dialog-props.js +40 -0
  50. package/deprecations/dialog-props/index.js +13 -0
  51. package/deprecations/dialog-props/test-cases/actual.js +47 -0
  52. package/deprecations/dialog-props/test-cases/expected.js +60 -0
  53. package/deprecations/dialog-props/test-cases/package.actual.js +47 -0
  54. package/deprecations/dialog-props/test-cases/package.expected.js +60 -0
  55. package/deprecations/dialog-props/test-cases/theme.actual.js +36 -0
  56. package/deprecations/dialog-props/test-cases/theme.expected.js +43 -0
  57. package/deprecations/divider-props/divider-props.js +3 -1
  58. package/deprecations/divider-props/test-cases/package.actual.js +45 -0
  59. package/deprecations/divider-props/test-cases/package.expected.js +50 -0
  60. package/deprecations/drawer-classes/drawer-classes.js +1 -1
  61. package/deprecations/drawer-classes/test-cases/package.actual.js +19 -0
  62. package/deprecations/drawer-classes/test-cases/package.expected.js +19 -0
  63. package/deprecations/drawer-props/drawer-props.js +8 -0
  64. package/deprecations/drawer-props/test-cases/package.actual.js +73 -0
  65. package/deprecations/drawer-props/test-cases/package.expected.js +97 -0
  66. package/deprecations/filled-input-props/filled-input-props.js +1 -0
  67. package/deprecations/filled-input-props/test-cases/package.actual.js +60 -0
  68. package/deprecations/filled-input-props/test-cases/package.expected.js +52 -0
  69. package/deprecations/form-control-label-props/form-control-label-props.js +1 -0
  70. package/deprecations/form-control-label-props/test-cases/package.actual.js +21 -0
  71. package/deprecations/form-control-label-props/test-cases/package.expected.js +21 -0
  72. package/deprecations/image-list-item-bar-classes/image-list-item-bar-classes.js +1 -1
  73. package/deprecations/image-list-item-bar-classes/test-cases/package.actual.js +11 -0
  74. package/deprecations/image-list-item-bar-classes/test-cases/package.expected.js +11 -0
  75. package/deprecations/input-base-classes/input-base-classes.js +1 -1
  76. package/deprecations/input-base-classes/test-cases/package.actual.js +13 -0
  77. package/deprecations/input-base-classes/test-cases/package.expected.js +13 -0
  78. package/deprecations/input-base-props/input-base-props.js +1 -0
  79. package/deprecations/input-base-props/test-cases/package.actual.js +60 -0
  80. package/deprecations/input-base-props/test-cases/package.expected.js +52 -0
  81. package/deprecations/input-props/input-props.js +1 -0
  82. package/deprecations/input-props/test-cases/package.actual.js +60 -0
  83. package/deprecations/input-props/test-cases/package.expected.js +52 -0
  84. package/deprecations/linear-progress-classes/linear-progress-classes.js +1 -1
  85. package/deprecations/linear-progress-classes/test-cases/package.actual.js +21 -0
  86. package/deprecations/linear-progress-classes/test-cases/package.expected.js +21 -0
  87. package/deprecations/list-item-props/list-item-props.js +3 -0
  88. package/deprecations/list-item-props/test-cases/package.actual.js +49 -0
  89. package/deprecations/list-item-props/test-cases/package.expected.js +50 -0
  90. package/deprecations/list-item-text-props/list-item-text-props.js +3 -0
  91. package/deprecations/list-item-text-props/test-cases/package.actual.js +21 -0
  92. package/deprecations/list-item-text-props/test-cases/package.expected.js +27 -0
  93. package/deprecations/menu-props/menu-props.js +3 -0
  94. package/deprecations/menu-props/test-cases/package.actual.js +67 -0
  95. package/deprecations/menu-props/test-cases/package.expected.js +83 -0
  96. package/deprecations/mobile-stepper-props/mobile-stepper-props.js +1 -0
  97. package/deprecations/mobile-stepper-props/test-cases/package.actual.js +30 -0
  98. package/deprecations/mobile-stepper-props/test-cases/package.expected.js +34 -0
  99. package/deprecations/modal-props/modal-props.js +3 -0
  100. package/deprecations/modal-props/test-cases/package.actual.js +49 -0
  101. package/deprecations/modal-props/test-cases/package.expected.js +50 -0
  102. package/deprecations/outlined-input-props/outlined-input-props.js +1 -0
  103. package/deprecations/outlined-input-props/test-cases/package.actual.js +60 -0
  104. package/deprecations/outlined-input-props/test-cases/package.expected.js +52 -0
  105. package/deprecations/pagination-item-classes/pagination-item-classes.js +1 -1
  106. package/deprecations/pagination-item-classes/test-cases/package.actual.js +108 -0
  107. package/deprecations/pagination-item-classes/test-cases/package.expected.js +108 -0
  108. package/deprecations/pagination-item-props/pagination-item-props.js +1 -0
  109. package/deprecations/pagination-item-props/test-cases/package.actual.js +27 -0
  110. package/deprecations/pagination-item-props/test-cases/package.expected.js +21 -0
  111. package/deprecations/popover-props/popover-props.js +5 -0
  112. package/deprecations/popover-props/test-cases/package.actual.js +73 -0
  113. package/deprecations/popover-props/test-cases/package.expected.js +89 -0
  114. package/deprecations/popper-props/popper-props.js +1 -0
  115. package/deprecations/popper-props/test-cases/package.actual.js +27 -0
  116. package/deprecations/popper-props/test-cases/package.expected.js +24 -0
  117. package/deprecations/rating-props/rating-props.js +1 -0
  118. package/deprecations/rating-props/test-cases/package.actual.js +37 -0
  119. package/deprecations/rating-props/test-cases/package.expected.js +53 -0
  120. package/deprecations/select-classes/select-classes.js +1 -1
  121. package/deprecations/select-classes/test-cases/package.actual.js +9 -0
  122. package/deprecations/select-classes/test-cases/package.expected.js +9 -0
  123. package/deprecations/slider-classes/slider-classes.js +1 -1
  124. package/deprecations/slider-classes/test-cases/package.actual.js +19 -0
  125. package/deprecations/slider-classes/test-cases/package.expected.js +19 -0
  126. package/deprecations/slider-props/slider-props.js +1 -0
  127. package/deprecations/slider-props/test-cases/package.actual.js +60 -0
  128. package/deprecations/slider-props/test-cases/package.expected.js +52 -0
  129. package/deprecations/snackbar-props/snackbar-props.js +4 -0
  130. package/deprecations/snackbar-props/test-cases/package.actual.js +54 -0
  131. package/deprecations/snackbar-props/test-cases/package.expected.js +67 -0
  132. package/deprecations/speed-dial-action-props/speed-dial-action-props.js +5 -0
  133. package/deprecations/speed-dial-action-props/test-cases/package.actual.js +56 -0
  134. package/deprecations/speed-dial-action-props/test-cases/package.expected.js +104 -0
  135. package/deprecations/speed-dial-props/speed-dial-props.js +2 -0
  136. package/deprecations/speed-dial-props/test-cases/package.actual.js +41 -0
  137. package/deprecations/speed-dial-props/test-cases/package.expected.js +54 -0
  138. package/deprecations/step-connector-classes/step-connector-classes.js +1 -1
  139. package/deprecations/step-connector-classes/test-cases/package.actual.js +7 -0
  140. package/deprecations/step-connector-classes/test-cases/package.expected.js +7 -0
  141. package/deprecations/step-content-props/step-content-props.js +2 -0
  142. package/deprecations/step-content-props/test-cases/package.actual.js +65 -0
  143. package/deprecations/step-content-props/test-cases/package.expected.js +74 -0
  144. package/deprecations/step-label-props/step-label-props.js +3 -0
  145. package/deprecations/step-label-props/test-cases/package.actual.js +44 -0
  146. package/deprecations/step-label-props/test-cases/package.expected.js +48 -0
  147. package/deprecations/tab-classes/tab-classes.js +1 -1
  148. package/deprecations/tab-classes/test-cases/package.actual.js +5 -0
  149. package/deprecations/tab-classes/test-cases/package.expected.js +5 -0
  150. package/deprecations/table-pagination-props/table-pagination-props.js +2 -0
  151. package/deprecations/table-pagination-props/test-cases/package.actual.js +62 -0
  152. package/deprecations/table-pagination-props/test-cases/package.expected.js +72 -0
  153. package/deprecations/table-sort-label-classes/table-sort-label-classes.js +1 -1
  154. package/deprecations/table-sort-label-classes/test-cases/package.actual.js +7 -0
  155. package/deprecations/table-sort-label-classes/test-cases/package.expected.js +7 -0
  156. package/deprecations/tabs-classes/tabs-classes.js +1 -1
  157. package/deprecations/tabs-classes/test-cases/package.actual.js +7 -0
  158. package/deprecations/tabs-classes/test-cases/package.expected.js +7 -0
  159. package/deprecations/tabs-props/tabs-props.js +3 -0
  160. package/deprecations/tabs-props/test-cases/package.actual.js +33 -0
  161. package/deprecations/tabs-props/test-cases/package.expected.js +41 -0
  162. package/deprecations/text-field-props/test-cases/package.actual.js +27 -0
  163. package/deprecations/text-field-props/test-cases/package.expected.js +31 -0
  164. package/deprecations/text-field-props/text-field-props.js +5 -0
  165. package/deprecations/toggle-button-group-classes/test-cases/package.actual.js +7 -0
  166. package/deprecations/toggle-button-group-classes/test-cases/package.expected.js +7 -0
  167. package/deprecations/toggle-button-group-classes/toggle-button-group-classes.js +1 -1
  168. package/deprecations/tooltip-props/test-cases/package.actual.js +141 -0
  169. package/deprecations/tooltip-props/test-cases/package.expected.js +141 -0
  170. package/deprecations/tooltip-props/tooltip-props.js +5 -0
  171. package/deprecations/typography-props/test-cases/package.actual.js +88 -0
  172. package/deprecations/typography-props/test-cases/package.expected.js +98 -0
  173. package/deprecations/typography-props/typography-props.js +1 -0
  174. package/deprecations/utils/movePropIntoSlotProps.js +2 -10
  175. package/deprecations/utils/movePropIntoSlots.js +2 -10
  176. package/deprecations/utils/replaceComponentsWithSlots.js +3 -13
  177. package/package.json +5 -5
  178. package/util/findComponentJSX.js +4 -3
  179. package/v6.0.0/grid-v2-props/grid-v2-props.js +5 -0
  180. package/v6.0.0/grid-v2-props/test-cases/package.actual.js +91 -0
  181. package/v6.0.0/grid-v2-props/test-cases/package.expected.js +91 -0
  182. package/v6.0.0/list-item-button-prop/list-item-button-prop.js +8 -4
  183. package/v6.0.0/list-item-button-prop/test-cases/package.actual.js +31 -0
  184. package/v6.0.0/list-item-button-prop/test-cases/package.expected.js +20 -0
  185. package/v7.0.0/grid-props/grid-props.js +5 -0
  186. package/v7.0.0/grid-props/test-cases/package.actual.js +91 -0
  187. package/v7.0.0/grid-props/test-cases/package.expected.js +91 -0
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+
3
+ var _ToggleButtonGroup = require("@org/ui/material/ToggleButtonGroup");
4
+ '& .MuiToggleButtonGroup-groupedHorizontal';
5
+ '& .MuiToggleButtonGroup-groupedVertical';
6
+ `& .${_ToggleButtonGroup.toggleButtonGroupClasses.groupedHorizontal}`;
7
+ `& .${_ToggleButtonGroup.toggleButtonGroupClasses.groupedVertical}`;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+
3
+ var _ToggleButtonGroup = require("@org/ui/material/ToggleButtonGroup");
4
+ "&.MuiToggleButtonGroup-horizontal > .MuiToggleButtonGroup-grouped";
5
+ "&.MuiToggleButtonGroup-vertical > .MuiToggleButtonGroup-grouped";
6
+ `&.${_ToggleButtonGroup.toggleButtonGroupClasses.horizontal} > .${_ToggleButtonGroup.toggleButtonGroupClasses.grouped}`;
7
+ `&.${_ToggleButtonGroup.toggleButtonGroupClasses.vertical} > .${_ToggleButtonGroup.toggleButtonGroupClasses.grouped}`;
@@ -18,7 +18,7 @@ function transformer(file, api, options) {
18
18
  replacementSelector
19
19
  }) => {
20
20
  const replacementSelectorPrefix = '&';
21
- root.find(j.ImportDeclaration).filter(path => path.node.source.value.match(/^@mui\/material\/ToggleButtonGroup$/)).forEach(path => {
21
+ root.find(j.ImportDeclaration).filter(path => path.node.source.value.match(new RegExp(`^${options.packageName || '@mui/material'}(/ToggleButtonGroup)?$`))).forEach(path => {
22
22
  path.node.specifiers.forEach(specifier => {
23
23
  if (specifier.type === 'ImportSpecifier' && specifier.imported.name === 'toggleButtonGroupClasses') {
24
24
  const deprecatedAtomicClass = deprecatedClass.replace(`${deprecatedClass.split('-')[0]}-`, '');
@@ -0,0 +1,141 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ var _Tooltip = _interopRequireDefault(require("@org/ui/material/Tooltip"));
5
+ var _material = require("@org/ui/material");
6
+ var _jsxRuntime = require("react/jsx-runtime");
7
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
8
+ components: {
9
+ Arrow: ComponentsArrow,
10
+ Popper: ComponentsPopper,
11
+ Tooltip: ComponentsTooltip,
12
+ Transition: ComponentsTransition
13
+ },
14
+ componentsProps: {
15
+ arrow: componentsArrowProps,
16
+ popper: componentsPopperProps,
17
+ tooltip: componentsTooltipProps,
18
+ transition: componentsTransitionProps
19
+ }
20
+ });
21
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
22
+ slots: {
23
+ tooltip: SlotsTooltip
24
+ },
25
+ components: {
26
+ Arrow: ComponentsArrow
27
+ },
28
+ slotProps: {
29
+ tooltip: slotsTooltipProps
30
+ },
31
+ componentsProps: {
32
+ arrow: componentsArrowProps
33
+ }
34
+ });
35
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
36
+ slots: {
37
+ tooltip: SlotsTooltip,
38
+ arrow: SlotsArrow
39
+ },
40
+ components: {
41
+ Arrow: ComponentsArrow
42
+ },
43
+ slotProps: {
44
+ tooltip: slotsTooltipProps,
45
+ arrow: slotsArrowProps
46
+ },
47
+ componentsProps: {
48
+ arrow: componentsArrowProps
49
+ }
50
+ });
51
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
52
+ slots: {
53
+ tooltip: SlotsTooltip,
54
+ arrow: SlotsArrow
55
+ },
56
+ components: {
57
+ Arrow: ComponentsArrow
58
+ },
59
+ slotProps: {
60
+ tooltip: slotsTooltipProps,
61
+ arrow: slotsArrowProps
62
+ },
63
+ componentsProps: {
64
+ arrow: componentsArrowProps,
65
+ tooltip: componentsTooltipProps
66
+ }
67
+ });
68
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
69
+ slots: {
70
+ arrow: SlotsArrow,
71
+ popper: SlotsPopper,
72
+ tooltip: SlotsTooltip,
73
+ transition: SlotsTransition
74
+ },
75
+ components: {
76
+ Arrow: ComponentsArrow,
77
+ Popper: ComponentsPopper,
78
+ Tooltip: ComponentsTooltip,
79
+ Transition: ComponentsTransition
80
+ },
81
+ slotProps: {
82
+ arrow: slotsArrowProps,
83
+ popper: slotsPopperProps,
84
+ tooltip: slotsTooltipProps,
85
+ transition: slotsTransitionProps
86
+ },
87
+ componentsProps: {
88
+ arrow: componentsArrowProps,
89
+ popper: componentsPopperProps,
90
+ tooltip: componentsTooltipProps,
91
+ transition: componentsTransitionProps
92
+ }
93
+ });
94
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
95
+ PopperComponent: CustomPopper,
96
+ TransitionComponent: CustomTransition,
97
+ PopperProps: {
98
+ disablePortal: true
99
+ },
100
+ TransitionProps: {
101
+ timeout: 200
102
+ }
103
+ });
104
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
105
+ PopperComponent: CustomPopper,
106
+ TransitionComponent: CustomTransition,
107
+ PopperProps: {
108
+ disablePortal: true
109
+ },
110
+ TransitionProps: {
111
+ timeout: 200
112
+ },
113
+ slotProps: {
114
+ tooltip: {
115
+ height: 20
116
+ }
117
+ },
118
+ slots: {
119
+ tooltip: "div"
120
+ }
121
+ });
122
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
123
+ PopperComponent: CustomPopper,
124
+ TransitionComponent: CustomTransition,
125
+ PopperProps: {
126
+ disablePortal: true
127
+ },
128
+ TransitionProps: {
129
+ timeout: 200
130
+ }
131
+ });
132
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(CustomTooltip, {
133
+ PopperComponent: CustomPopper,
134
+ TransitionComponent: CustomTransition,
135
+ PopperProps: {
136
+ disablePortal: true
137
+ },
138
+ TransitionProps: {
139
+ timeout: 200
140
+ }
141
+ });
@@ -0,0 +1,141 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ var _Tooltip = _interopRequireDefault(require("@org/ui/material/Tooltip"));
5
+ var _material = require("@org/ui/material");
6
+ var _jsxRuntime = require("react/jsx-runtime");
7
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
8
+ slots: {
9
+ arrow: ComponentsArrow,
10
+ popper: ComponentsPopper,
11
+ tooltip: ComponentsTooltip,
12
+ transition: ComponentsTransition
13
+ },
14
+ slotProps: {
15
+ arrow: componentsArrowProps,
16
+ popper: componentsPopperProps,
17
+ tooltip: componentsTooltipProps,
18
+ transition: componentsTransitionProps
19
+ }
20
+ });
21
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
22
+ slots: {
23
+ tooltip: SlotsTooltip,
24
+ arrow: ComponentsArrow
25
+ },
26
+ slotProps: {
27
+ tooltip: slotsTooltipProps,
28
+ arrow: componentsArrowProps
29
+ }
30
+ });
31
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
32
+ slots: {
33
+ tooltip: SlotsTooltip,
34
+ arrow: SlotsArrow
35
+ },
36
+ slotProps: {
37
+ tooltip: slotsTooltipProps,
38
+ arrow: {
39
+ ...componentsArrowProps,
40
+ ...slotsArrowProps
41
+ }
42
+ }
43
+ });
44
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
45
+ slots: {
46
+ tooltip: SlotsTooltip,
47
+ arrow: SlotsArrow
48
+ },
49
+ slotProps: {
50
+ arrow: {
51
+ ...componentsArrowProps,
52
+ ...slotsArrowProps
53
+ },
54
+ tooltip: {
55
+ ...componentsTooltipProps,
56
+ ...slotsTooltipProps
57
+ }
58
+ }
59
+ });
60
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
61
+ slots: {
62
+ arrow: SlotsArrow,
63
+ popper: SlotsPopper,
64
+ tooltip: SlotsTooltip,
65
+ transition: SlotsTransition
66
+ },
67
+ slotProps: {
68
+ arrow: {
69
+ ...componentsArrowProps,
70
+ ...slotsArrowProps
71
+ },
72
+ popper: {
73
+ ...componentsPopperProps,
74
+ ...slotsPopperProps
75
+ },
76
+ tooltip: {
77
+ ...componentsTooltipProps,
78
+ ...slotsTooltipProps
79
+ },
80
+ transition: {
81
+ ...componentsTransitionProps,
82
+ ...slotsTransitionProps
83
+ }
84
+ }
85
+ });
86
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
87
+ slots: {
88
+ popper: CustomPopper,
89
+ transition: CustomTransition
90
+ },
91
+ slotProps: {
92
+ popper: {
93
+ disablePortal: true
94
+ },
95
+ transition: {
96
+ timeout: 200
97
+ }
98
+ }
99
+ });
100
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
101
+ slotProps: {
102
+ tooltip: {
103
+ height: 20
104
+ },
105
+ popper: {
106
+ disablePortal: true
107
+ },
108
+ transition: {
109
+ timeout: 200
110
+ }
111
+ },
112
+ slots: {
113
+ tooltip: "div",
114
+ popper: CustomPopper,
115
+ transition: CustomTransition
116
+ }
117
+ });
118
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
119
+ slots: {
120
+ popper: CustomPopper,
121
+ transition: CustomTransition
122
+ },
123
+ slotProps: {
124
+ popper: {
125
+ disablePortal: true
126
+ },
127
+ transition: {
128
+ timeout: 200
129
+ }
130
+ }
131
+ });
132
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(CustomTooltip, {
133
+ PopperComponent: CustomPopper,
134
+ TransitionComponent: CustomTransition,
135
+ PopperProps: {
136
+ disablePortal: true
137
+ },
138
+ TransitionProps: {
139
+ timeout: 200
140
+ }
141
+ });
@@ -18,28 +18,33 @@ function transformer(file, api, options) {
18
18
  const printOptions = options.printOptions;
19
19
  (0, _replaceComponentsWithSlots.default)(j, {
20
20
  root,
21
+ packageName: options.packageName,
21
22
  componentName: 'Tooltip'
22
23
  });
23
24
  (0, _movePropIntoSlots.default)(j, {
24
25
  root,
26
+ packageName: options.packageName,
25
27
  componentName: 'Tooltip',
26
28
  propName: 'PopperComponent',
27
29
  slotName: 'popper'
28
30
  });
29
31
  (0, _movePropIntoSlotProps.default)(j, {
30
32
  root,
33
+ packageName: options.packageName,
31
34
  componentName: 'Tooltip',
32
35
  propName: 'PopperProps',
33
36
  slotName: 'popper'
34
37
  });
35
38
  (0, _movePropIntoSlots.default)(j, {
36
39
  root,
40
+ packageName: options.packageName,
37
41
  componentName: 'Tooltip',
38
42
  propName: 'TransitionComponent',
39
43
  slotName: 'transition'
40
44
  });
41
45
  (0, _movePropIntoSlotProps.default)(j, {
42
46
  root,
47
+ packageName: options.packageName,
43
48
  componentName: 'Tooltip',
44
49
  propName: 'TransitionProps',
45
50
  slotName: 'transition'
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ var _Typography = _interopRequireDefault(require("@org/ui/material/Typography"));
5
+ var _material = require("@org/ui/material");
6
+ var _jsxRuntime = require("react/jsx-runtime");
7
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {});
8
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {});
9
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
10
+ className: "my-class"
11
+ });
12
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
13
+ className: "my-class"
14
+ });
15
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
16
+ paragraph: true
17
+ });
18
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
19
+ paragraph: true
20
+ });
21
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
22
+ paragraph: true,
23
+ className: "my-class"
24
+ });
25
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
26
+ paragraph: true,
27
+ className: "my-class"
28
+ });
29
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
30
+ paragraph: false,
31
+ className: "my-class"
32
+ });
33
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
34
+ paragraph: false,
35
+ className: "my-class"
36
+ });
37
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
38
+ paragraph: true,
39
+ className: "my-class"
40
+ });
41
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
42
+ paragraph: true,
43
+ className: "my-class"
44
+ });
45
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
46
+ paragraph: paragraph,
47
+ className: "my-class"
48
+ });
49
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
50
+ paragraph: paragraph,
51
+ className: "my-class"
52
+ });
53
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
54
+ paragraph: true,
55
+ sx: {
56
+ marginBottom: "32px"
57
+ }
58
+ });
59
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
60
+ paragraph: true,
61
+ sx: {
62
+ marginBottom: "32px"
63
+ }
64
+ });
65
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
66
+ paragraph: true,
67
+ sx: {
68
+ mb: "32px"
69
+ }
70
+ });
71
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
72
+ paragraph: true,
73
+ sx: {
74
+ mb: "32px"
75
+ }
76
+ });
77
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
78
+ paragraph: true,
79
+ sx: {
80
+ color: "black"
81
+ }
82
+ });
83
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
84
+ paragraph: true,
85
+ sx: {
86
+ color: "black"
87
+ }
88
+ });
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ var _Typography = _interopRequireDefault(require("@org/ui/material/Typography"));
5
+ var _material = require("@org/ui/material");
6
+ var _jsxRuntime = require("react/jsx-runtime");
7
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {});
8
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {});
9
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
10
+ className: "my-class"
11
+ });
12
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
13
+ className: "my-class"
14
+ });
15
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
16
+ sx: {
17
+ marginBottom: "16px"
18
+ }
19
+ });
20
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
21
+ sx: {
22
+ marginBottom: "16px"
23
+ }
24
+ });
25
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
26
+ className: "my-class",
27
+ sx: {
28
+ marginBottom: "16px"
29
+ }
30
+ });
31
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
32
+ className: "my-class",
33
+ sx: {
34
+ marginBottom: "16px"
35
+ }
36
+ });
37
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
38
+ className: "my-class"
39
+ });
40
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
41
+ className: "my-class"
42
+ });
43
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
44
+ className: "my-class",
45
+ sx: {
46
+ marginBottom: "16px"
47
+ }
48
+ });
49
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
50
+ className: "my-class",
51
+ sx: {
52
+ marginBottom: "16px"
53
+ }
54
+ });
55
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
56
+ className: "my-class",
57
+ sx: paragraph ? {
58
+ marginBottom: "16px"
59
+ } : undefined
60
+ });
61
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
62
+ className: "my-class",
63
+ sx: paragraph ? {
64
+ marginBottom: "16px"
65
+ } : undefined
66
+ });
67
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
68
+ sx: {
69
+ marginBottom: "32px"
70
+ }
71
+ });
72
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
73
+ sx: {
74
+ marginBottom: "32px"
75
+ }
76
+ });
77
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
78
+ sx: {
79
+ mb: "32px"
80
+ }
81
+ });
82
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
83
+ sx: {
84
+ mb: "32px"
85
+ }
86
+ });
87
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
88
+ sx: {
89
+ color: "black",
90
+ marginBottom: "16px"
91
+ }
92
+ });
93
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
94
+ sx: {
95
+ color: "black",
96
+ marginBottom: "16px"
97
+ }
98
+ });
@@ -18,6 +18,7 @@ function transformer(file, api, options) {
18
18
  const printOptions = options.printOptions;
19
19
  (0, _findComponentJSX.default)(j, {
20
20
  root,
21
+ packageName: options.packageName,
21
22
  componentName: 'Typography'
22
23
  }, elementPath => {
23
24
  const paragraphProp = elementPath.node.openingElement.attributes.find(attr => attr.type === 'JSXAttribute' && attr.name.name === 'paragraph');
@@ -108,21 +108,13 @@ function moveDefaultPropsPropIntoslotProps(j, defaultPropsPathCollection, propNa
108
108
  */
109
109
  function movePropIntoSlotProps(j, options) {
110
110
  const {
111
- root,
112
- componentName,
113
111
  propName,
114
112
  slotName,
115
113
  slotPropName
116
114
  } = options;
117
- (0, _findComponentJSX.default)(j, {
118
- root,
119
- componentName
120
- }, elementPath => {
115
+ (0, _findComponentJSX.default)(j, options, elementPath => {
121
116
  moveJsxPropIntoSlotProps(j, elementPath.node, propName, slotName, slotPropName);
122
117
  });
123
- const defaultPropsPathCollection = (0, _findComponentDefaultProps.default)(j, {
124
- root,
125
- componentName
126
- });
118
+ const defaultPropsPathCollection = (0, _findComponentDefaultProps.default)(j, options);
127
119
  moveDefaultPropsPropIntoslotProps(j, defaultPropsPathCollection, propName, slotName, slotPropName);
128
120
  }
@@ -75,20 +75,12 @@ function moveDefaultPropsPropIntoSlots(j, defaultPropsPathCollection, propName,
75
75
  */
76
76
  function movePropIntoSlots(j, options) {
77
77
  const {
78
- root,
79
- componentName,
80
78
  propName,
81
79
  slotName
82
80
  } = options;
83
- (0, _findComponentJSX.default)(j, {
84
- root,
85
- componentName
86
- }, elementPath => {
81
+ (0, _findComponentJSX.default)(j, options, elementPath => {
87
82
  moveJsxPropIntoSlots(j, elementPath.node, propName, slotName);
88
83
  });
89
- const defaultPropsPathCollection = (0, _findComponentDefaultProps.default)(j, {
90
- root,
91
- componentName
92
- });
84
+ const defaultPropsPathCollection = (0, _findComponentDefaultProps.default)(j, options);
93
85
  moveDefaultPropsPropIntoSlots(j, defaultPropsPathCollection, propName, slotName);
94
86
  }
@@ -176,26 +176,16 @@ function replaceDefaultPropsComponentsPropsProp(j, defaultPropsPathCollection) {
176
176
  * If there are duplicated values, the slots values will be used.
177
177
  *
178
178
  * @param {import('jscodeshift')} j
179
- * @param {{ element: import('jscodeshift').JSXElement }} options
179
+ * @param {{ element: import('jscodeshift').JSXElement, packageName?: string }} options
180
180
  *
181
181
  * @example <Component componentsProps={{ root: { 'testid': 'root-id'} }} /> => <Component slotProps={{ root: { 'testid': 'root-id'} }} />
182
182
  */
183
183
  function replaceComponentsWithSlots(j, options) {
184
- const {
185
- root,
186
- componentName
187
- } = options;
188
- (0, _findComponentJSX.default)(j, {
189
- root,
190
- componentName
191
- }, elementPath => {
184
+ (0, _findComponentJSX.default)(j, options, elementPath => {
192
185
  replaceJsxComponentsProp(j, elementPath);
193
186
  replaceJsxComponentsPropsProp(j, elementPath.node);
194
187
  });
195
- const defaultPropsPathCollection = (0, _findComponentDefaultProps.default)(j, {
196
- root,
197
- componentName
198
- });
188
+ const defaultPropsPathCollection = (0, _findComponentDefaultProps.default)(j, options);
199
189
  replaceDefaultPropsComponentsProp(j, defaultPropsPathCollection);
200
190
  replaceDefaultPropsComponentsPropsProp(j, defaultPropsPathCollection);
201
191
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/codemod",
3
- "version": "7.1.0",
3
+ "version": "7.2.0",
4
4
  "author": "MUI Team",
5
5
  "description": "Codemod scripts for Material UI.",
6
6
  "bin": "./codemod.js",
@@ -23,12 +23,12 @@
23
23
  "url": "https://opencollective.com/mui-org"
24
24
  },
25
25
  "dependencies": {
26
- "@babel/core": "^7.27.1",
27
- "@babel/runtime": "^7.27.1",
28
- "@babel/traverse": "^7.27.1",
26
+ "@babel/core": "^7.27.4",
27
+ "@babel/runtime": "^7.27.6",
28
+ "@babel/traverse": "^7.27.4",
29
29
  "jscodeshift": "^17.1.2",
30
30
  "jscodeshift-add-imports": "^1.0.11",
31
- "postcss": "^8.5.3",
31
+ "postcss": "^8.5.6",
32
32
  "postcss-cli": "^11.0.1",
33
33
  "yargs": "^17.7.2"
34
34
  },
@@ -8,14 +8,15 @@ exports.default = findComponentJSX;
8
8
  * Find all the JSXElements of a given component name.
9
9
  *
10
10
  * @param {import('jscodeshift')} j
11
- * @param {{ root: import('jscodeshift').Collection; componentName: string }} options
11
+ * @param {{ root: import('jscodeshift').Collection; componentName: string; packageName?: string }} options
12
12
  * @param {(path: import('jscodeshift').ASTPath<import('jscodeshift').JSXElement>) => void} callback
13
13
  *
14
14
  */
15
15
  function findComponentJSX(j, options, callback) {
16
16
  const {
17
17
  root,
18
- componentName
18
+ componentName,
19
+ packageName = '@mui/material'
19
20
  } = options;
20
21
 
21
22
  // case 1: import ComponentName from '@mui/material/ComponentName';
@@ -23,7 +24,7 @@ function findComponentJSX(j, options, callback) {
23
24
  // case 3: import { ComponentName as SomethingElse } from '@mui/material';
24
25
 
25
26
  const importName = new Set();
26
- root.find(j.ImportDeclaration).filter(path => path.node.source.value.match(new RegExp(`^@mui/material(/${componentName})?$`))).forEach(path => {
27
+ root.find(j.ImportDeclaration).filter(path => path.node.source.value.match(new RegExp(`^${packageName}(/${componentName})?$`))).forEach(path => {
27
28
  path.node.specifiers.forEach(specifier => {
28
29
  if (specifier.type === 'ImportDefaultSpecifier') {
29
30
  importName.add(specifier.local.name);
@@ -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}/Grid2`);
30
+ possibleNamedImports[packageName] = 'Grid2';
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 => {