@mui/codemod 6.0.0-dev.240424162023-9968b4889d → 6.0.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 (278) hide show
  1. package/README.md +1037 -294
  2. package/codemod.js +0 -2
  3. package/node/deprecations/accordion-props/test-cases/actual.js +6 -3
  4. package/node/deprecations/accordion-props/test-cases/expected.js +14 -10
  5. package/node/deprecations/accordion-props/test-cases/theme.expected.js +8 -7
  6. package/node/deprecations/alert-props/test-cases/expected.js +12 -4
  7. package/node/deprecations/alert-props/test-cases/theme.expected.js +12 -5
  8. package/node/deprecations/all/deprecations-all.js +38 -14
  9. package/node/deprecations/all/postcss.config.js +10 -1
  10. package/node/deprecations/autocomplete-props/autocomplete-props.js +22 -0
  11. package/node/deprecations/autocomplete-props/index.js +13 -0
  12. package/node/deprecations/autocomplete-props/test-cases/actual.js +75 -0
  13. package/node/deprecations/autocomplete-props/test-cases/expected.js +75 -0
  14. package/node/deprecations/autocomplete-props/test-cases/theme.actual.js +47 -0
  15. package/node/deprecations/autocomplete-props/test-cases/theme.expected.js +47 -0
  16. package/node/deprecations/avatar-group-props/avatar-group-props.js +81 -0
  17. package/node/deprecations/avatar-group-props/index.js +13 -0
  18. package/node/deprecations/avatar-group-props/test-cases/actual.js +56 -0
  19. package/node/deprecations/avatar-group-props/test-cases/expected.js +58 -0
  20. package/node/deprecations/avatar-group-props/test-cases/theme.actual.js +48 -0
  21. package/node/deprecations/avatar-group-props/test-cases/theme.expected.js +50 -0
  22. package/node/deprecations/avatar-props/test-cases/expected.js +8 -6
  23. package/node/deprecations/avatar-props/test-cases/theme.expected.js +8 -7
  24. package/node/deprecations/backdrop-props/backdrop-props.js +3 -5
  25. package/node/deprecations/backdrop-props/test-cases/actual.js +30 -13
  26. package/node/deprecations/backdrop-props/test-cases/expected.js +23 -13
  27. package/node/deprecations/backdrop-props/test-cases/theme.actual.js +32 -6
  28. package/node/deprecations/backdrop-props/test-cases/theme.expected.js +27 -5
  29. package/node/deprecations/badge-props/test-cases/expected.js +12 -5
  30. package/node/deprecations/badge-props/test-cases/theme.expected.js +12 -5
  31. package/node/deprecations/circular-progress-classes/circular-progress-classes.js +77 -0
  32. package/node/deprecations/circular-progress-classes/index.js +13 -0
  33. package/node/deprecations/circular-progress-classes/postcss-plugin.js +33 -0
  34. package/node/deprecations/circular-progress-classes/postcss.config.js +8 -0
  35. package/node/deprecations/circular-progress-classes/test-cases/actual.js +7 -0
  36. package/node/deprecations/circular-progress-classes/test-cases/expected.js +7 -0
  37. package/node/deprecations/divider-props/divider-props.js +28 -15
  38. package/node/deprecations/divider-props/test-cases/actual.js +3 -0
  39. package/node/deprecations/divider-props/test-cases/expected.js +5 -8
  40. package/node/deprecations/divider-props/test-cases/theme.actual.js +28 -0
  41. package/node/deprecations/divider-props/test-cases/theme.expected.js +25 -0
  42. package/node/deprecations/filled-input-props/filled-input-props.js +22 -0
  43. package/node/deprecations/filled-input-props/index.js +13 -0
  44. package/node/deprecations/filled-input-props/test-cases/actual.js +60 -0
  45. package/node/deprecations/filled-input-props/test-cases/expected.js +52 -0
  46. package/node/deprecations/filled-input-props/test-cases/theme.actual.js +73 -0
  47. package/node/deprecations/filled-input-props/test-cases/theme.expected.js +65 -0
  48. package/node/deprecations/form-control-label-props/form-control-label-props.js +22 -0
  49. package/node/deprecations/form-control-label-props/index.js +13 -0
  50. package/node/deprecations/form-control-label-props/test-cases/actual.js +21 -0
  51. package/node/deprecations/form-control-label-props/test-cases/expected.js +21 -0
  52. package/node/deprecations/form-control-label-props/test-cases/theme.actual.js +23 -0
  53. package/node/deprecations/form-control-label-props/test-cases/theme.expected.js +23 -0
  54. package/node/deprecations/grid-props/grid-props.js +51 -0
  55. package/node/deprecations/grid-props/index.js +13 -0
  56. package/node/deprecations/grid-props/test-cases/actual.js +25 -0
  57. package/node/deprecations/grid-props/test-cases/expected.js +23 -0
  58. package/node/deprecations/grid-props/test-cases/theme.actual.js +24 -0
  59. package/node/deprecations/grid-props/test-cases/theme.expected.js +23 -0
  60. package/node/deprecations/image-list-item-bar-classes/image-list-item-bar-classes.js +77 -0
  61. package/node/deprecations/image-list-item-bar-classes/index.js +13 -0
  62. package/node/deprecations/image-list-item-bar-classes/postcss-plugin.js +39 -0
  63. package/node/deprecations/image-list-item-bar-classes/postcss.config.js +8 -0
  64. package/node/deprecations/image-list-item-bar-classes/test-cases/actual.js +11 -0
  65. package/node/deprecations/image-list-item-bar-classes/test-cases/expected.js +11 -0
  66. package/node/deprecations/input-base-props/index.js +13 -0
  67. package/node/deprecations/input-base-props/input-base-props.js +22 -0
  68. package/node/deprecations/input-base-props/test-cases/actual.js +60 -0
  69. package/node/deprecations/input-base-props/test-cases/expected.js +52 -0
  70. package/node/deprecations/input-base-props/test-cases/theme.actual.js +73 -0
  71. package/node/deprecations/input-base-props/test-cases/theme.expected.js +65 -0
  72. package/node/deprecations/input-props/index.js +13 -0
  73. package/node/deprecations/input-props/input-props.js +22 -0
  74. package/node/deprecations/input-props/test-cases/actual.js +60 -0
  75. package/node/deprecations/input-props/test-cases/expected.js +52 -0
  76. package/node/deprecations/input-props/test-cases/theme.actual.js +73 -0
  77. package/node/deprecations/input-props/test-cases/theme.expected.js +65 -0
  78. package/node/deprecations/list-item-props/index.js +13 -0
  79. package/node/deprecations/list-item-props/list-item-props.js +22 -0
  80. package/node/deprecations/list-item-props/test-cases/actual.js +43 -0
  81. package/node/deprecations/list-item-props/test-cases/expected.js +40 -0
  82. package/node/deprecations/list-item-props/test-cases/theme.actual.js +56 -0
  83. package/node/deprecations/list-item-props/test-cases/theme.expected.js +53 -0
  84. package/node/deprecations/modal-props/index.js +13 -0
  85. package/node/deprecations/modal-props/modal-props.js +22 -0
  86. package/node/deprecations/modal-props/test-cases/actual.js +43 -0
  87. package/node/deprecations/modal-props/test-cases/expected.js +40 -0
  88. package/node/deprecations/modal-props/test-cases/theme.actual.js +56 -0
  89. package/node/deprecations/modal-props/test-cases/theme.expected.js +53 -0
  90. package/node/deprecations/outlined-input-props/index.js +13 -0
  91. package/node/deprecations/outlined-input-props/outlined-input-props.js +22 -0
  92. package/node/deprecations/outlined-input-props/test-cases/actual.js +60 -0
  93. package/node/deprecations/outlined-input-props/test-cases/expected.js +52 -0
  94. package/node/deprecations/outlined-input-props/test-cases/theme.actual.js +73 -0
  95. package/node/deprecations/outlined-input-props/test-cases/theme.expected.js +65 -0
  96. package/node/deprecations/pagination-item-props/index.js +13 -0
  97. package/node/deprecations/pagination-item-props/pagination-item-props.js +22 -0
  98. package/node/deprecations/pagination-item-props/test-cases/actual.js +27 -0
  99. package/node/deprecations/pagination-item-props/test-cases/expected.js +21 -0
  100. package/node/deprecations/pagination-item-props/test-cases/theme.actual.js +28 -0
  101. package/node/deprecations/pagination-item-props/test-cases/theme.expected.js +26 -0
  102. package/node/deprecations/popper-props/index.js +13 -0
  103. package/node/deprecations/popper-props/popper-props.js +22 -0
  104. package/node/deprecations/popper-props/test-cases/actual.js +27 -0
  105. package/node/deprecations/popper-props/test-cases/expected.js +24 -0
  106. package/node/deprecations/popper-props/test-cases/theme.actual.js +32 -0
  107. package/node/deprecations/popper-props/test-cases/theme.expected.js +29 -0
  108. package/node/deprecations/slider-props/test-cases/expected.js +12 -4
  109. package/node/deprecations/slider-props/test-cases/theme.expected.js +12 -5
  110. package/node/deprecations/speed-dial-props/index.js +13 -0
  111. package/node/deprecations/speed-dial-props/speed-dial-props.js +31 -0
  112. package/node/deprecations/speed-dial-props/test-cases/actual.js +41 -0
  113. package/node/deprecations/speed-dial-props/test-cases/expected.js +54 -0
  114. package/node/deprecations/speed-dial-props/test-cases/theme.actual.js +33 -0
  115. package/node/deprecations/speed-dial-props/test-cases/theme.expected.js +40 -0
  116. package/node/deprecations/step-label-props/step-label-props.js +0 -14
  117. package/node/deprecations/step-label-props/test-cases/actual.js +0 -23
  118. package/node/deprecations/step-label-props/test-cases/expected.js +4 -26
  119. package/node/deprecations/step-label-props/test-cases/theme.actual.js +0 -22
  120. package/node/deprecations/step-label-props/test-cases/theme.expected.js +4 -28
  121. package/node/deprecations/tab-classes/index.js +13 -0
  122. package/node/deprecations/tab-classes/postcss-plugin.js +30 -0
  123. package/node/deprecations/tab-classes/postcss.config.js +8 -0
  124. package/node/deprecations/tab-classes/tab-classes.js +53 -0
  125. package/node/deprecations/tab-classes/test-cases/actual.js +5 -0
  126. package/node/deprecations/tab-classes/test-cases/expected.js +5 -0
  127. package/node/deprecations/table-sort-label-classes/index.js +13 -0
  128. package/node/deprecations/table-sort-label-classes/postcss-plugin.js +33 -0
  129. package/node/deprecations/table-sort-label-classes/postcss.config.js +8 -0
  130. package/node/deprecations/table-sort-label-classes/table-sort-label-classes.js +77 -0
  131. package/node/deprecations/table-sort-label-classes/test-cases/actual.js +7 -0
  132. package/node/deprecations/table-sort-label-classes/test-cases/expected.js +7 -0
  133. package/node/deprecations/text-field-props/index.js +13 -0
  134. package/node/deprecations/text-field-props/test-cases/actual.js +27 -0
  135. package/node/deprecations/text-field-props/test-cases/expected.js +31 -0
  136. package/node/deprecations/text-field-props/test-cases/theme.actual.js +13 -0
  137. package/node/deprecations/text-field-props/test-cases/theme.expected.js +15 -0
  138. package/node/deprecations/text-field-props/text-field-props.js +48 -0
  139. package/node/deprecations/tooltip-props/index.js +13 -0
  140. package/node/deprecations/tooltip-props/test-cases/actual.js +92 -0
  141. package/node/deprecations/tooltip-props/test-cases/expected.js +84 -0
  142. package/node/deprecations/tooltip-props/test-cases/theme.actual.js +73 -0
  143. package/node/deprecations/tooltip-props/test-cases/theme.expected.js +65 -0
  144. package/node/deprecations/tooltip-props/tooltip-props.js +22 -0
  145. package/node/deprecations/typography-props/index.js +13 -0
  146. package/node/deprecations/typography-props/test-cases/actual.js +80 -0
  147. package/node/deprecations/typography-props/test-cases/expected.js +86 -0
  148. package/node/deprecations/typography-props/test-cases/theme.actual.js +85 -0
  149. package/node/deprecations/typography-props/test-cases/theme.expected.js +86 -0
  150. package/node/deprecations/typography-props/typography-props.js +81 -0
  151. package/node/deprecations/utils/movePropIntoSlotProps.js +4 -12
  152. package/node/deprecations/utils/movePropIntoSlots.js +4 -12
  153. package/node/deprecations/utils/replaceComponentsWithSlots.js +32 -25
  154. package/node/util/getReturnExpression.js +19 -0
  155. package/node/util/migrateToVariants.js +586 -0
  156. package/node/util/propsToObject.js +2 -6
  157. package/node/util/renameClassKey.js +1 -2
  158. package/node/v0.15.0/import-path.js +2 -2
  159. package/node/v5.0.0/avatar-circle-circular.js +2 -4
  160. package/node/v5.0.0/badge-overlap-value.js +4 -7
  161. package/node/v5.0.0/badge-overlap-value.test/actual.js +3 -4
  162. package/node/v5.0.0/badge-overlap-value.test/expected.js +3 -4
  163. package/node/v5.0.0/base-hook-imports.js +1 -2
  164. package/node/v5.0.0/base-remove-component-prop.test/actual.js +4 -4
  165. package/node/v5.0.0/base-remove-component-prop.test/expected.js +4 -4
  166. package/node/v5.0.0/base-remove-unstyled-suffix.js +1 -2
  167. package/node/v5.0.0/base-remove-unstyled-suffix.test/actual.js +5 -5
  168. package/node/v5.0.0/base-remove-unstyled-suffix.test/expected.js +4 -4
  169. package/node/v5.0.0/base-rename-components-to-slots.js +1 -1
  170. package/node/v5.0.0/base-use-named-exports.js +5 -8
  171. package/node/v5.0.0/box-sx-prop.js +1 -2
  172. package/node/v5.0.0/box-sx-prop.test/actual.js +4 -4
  173. package/node/v5.0.0/box-sx-prop.test/expected.js +3 -3
  174. package/node/v5.0.0/button-color-prop.js +1 -2
  175. package/node/v5.0.0/chip-variant-prop.js +1 -2
  176. package/node/v5.0.0/circularprogress-variant.js +2 -4
  177. package/node/v5.0.0/create-theme.test/custom-fn.actual.js +3 -4
  178. package/node/v5.0.0/create-theme.test/custom-fn.expected.js +3 -4
  179. package/node/v5.0.0/fab-variant.js +2 -4
  180. package/node/v5.0.0/grid-list-component.test/actual.js +1 -1
  181. package/node/v5.0.0/grid-list-component.test/expected.js +1 -1
  182. package/node/v5.0.0/joy-avatar-remove-imgProps.js +3 -7
  183. package/node/v5.0.0/joy-rename-components-to-slots.js +1 -1
  184. package/node/v5.0.0/joy-rename-row-prop.js +1 -2
  185. package/node/v5.0.0/joy-text-field-to-input.js +4 -7
  186. package/node/v5.0.0/jss-to-styled.test/first.actual.js +11 -14
  187. package/node/v5.0.0/jss-to-styled.test/first.expected.js +11 -14
  188. package/node/v5.0.0/jss-to-styled.test/seventh.actual.js +4 -4
  189. package/node/v5.0.0/jss-to-styled.test/seventh.expected.js +4 -4
  190. package/node/v5.0.0/jss-to-styled.test/sixth.actual.js +3 -3
  191. package/node/v5.0.0/jss-to-styled.test/sixth.expected.js +3 -3
  192. package/node/v5.0.0/jss-to-styled.test/withCreateStyles.actual.js +3 -3
  193. package/node/v5.0.0/jss-to-styled.test/withCreateStyles.expected.js +3 -4
  194. package/node/v5.0.0/jss-to-styled.test/withCreateStyles1.actual.js +3 -3
  195. package/node/v5.0.0/jss-to-styled.test/withCreateStyles1.expected.js +3 -4
  196. package/node/v5.0.0/jss-to-styled.test/withCreateStyles2.actual.js +3 -3
  197. package/node/v5.0.0/jss-to-styled.test/withCreateStyles2.expected.js +3 -4
  198. package/node/v5.0.0/jss-to-styled.test/withCreateStyles3.actual.js +3 -3
  199. package/node/v5.0.0/jss-to-styled.test/withCreateStyles3.expected.js +3 -4
  200. package/node/v5.0.0/jss-to-tss-react.js +4 -6
  201. package/node/v5.0.0/jss-to-tss-react.test/actual-mixins-pattern.js +6 -5
  202. package/node/v5.0.0/jss-to-tss-react.test/actual-withStyles.js +4 -4
  203. package/node/v5.0.0/jss-to-tss-react.test/expected-mixins-pattern.js +6 -5
  204. package/node/v5.0.0/jss-to-tss-react.test/expected-withStyles.js +4 -4
  205. package/node/v5.0.0/link-underline-hover.js +1 -4
  206. package/node/v5.0.0/pagination-round-circular.js +3 -8
  207. package/node/v5.0.0/preset-safe.test/actual.js +6 -4
  208. package/node/v5.0.0/preset-safe.test/expected.js +9 -6
  209. package/node/v5.0.0/root-ref.test/expected.js +4 -4
  210. package/node/v5.0.0/skeleton-variant.js +3 -5
  211. package/node/v5.0.0/table-props.js +4 -9
  212. package/node/v5.0.0/table-props.test/actual.js +4 -5
  213. package/node/v5.0.0/table-props.test/expected.js +4 -5
  214. package/node/v5.0.0/tabs-scroll-buttons.js +4 -5
  215. package/node/v5.0.0/theme-spacing.test/large-actual.js +11 -11
  216. package/node/v5.0.0/theme-spacing.test/large-expected.js +11 -11
  217. package/node/v5.0.0/variant-prop.test/actual.js +12 -6
  218. package/node/v5.0.0/variant-prop.test/expected.js +15 -12
  219. package/node/v5.0.0/with-mobile-dialog.test/expected.js +6 -5
  220. package/node/v5.0.0/with-width.test/expected.js +6 -5
  221. package/node/v6.0.0/all/v6-all.js +4 -5
  222. package/node/v6.0.0/grid-v2-props/grid-v2-props.js +142 -0
  223. package/node/v6.0.0/grid-v2-props/index.js +13 -0
  224. package/node/v6.0.0/grid-v2-props/test-cases/actual.js +89 -0
  225. package/node/v6.0.0/grid-v2-props/test-cases/custom-breakpoints.actual.js +18 -0
  226. package/node/v6.0.0/grid-v2-props/test-cases/custom-breakpoints.expected.js +22 -0
  227. package/node/v6.0.0/grid-v2-props/test-cases/expected.js +101 -0
  228. package/node/v6.0.0/list-item-button-prop/index.js +13 -0
  229. package/node/v6.0.0/list-item-button-prop/list-item-button-prop.js +93 -0
  230. package/node/v6.0.0/list-item-button-prop/test-cases/actual.js +31 -0
  231. package/node/v6.0.0/list-item-button-prop/test-cases/expected.js +20 -0
  232. package/node/v6.0.0/list-item-button-prop/test-cases/theme.actual.js +20 -0
  233. package/node/v6.0.0/list-item-button-prop/test-cases/theme.expected.js +24 -0
  234. package/node/v6.0.0/styled/styled-v6.js +2 -415
  235. package/node/v6.0.0/styled/test-cases/BasicStyled.actual.js +55 -44
  236. package/node/v6.0.0/styled/test-cases/BasicStyled.expected.js +5 -6
  237. package/node/v6.0.0/styled/test-cases/ConditionalStyled.actual.js +98 -61
  238. package/node/v6.0.0/styled/test-cases/ConditionalStyled.expected.js +54 -29
  239. package/node/v6.0.0/styled/test-cases/DynamicPropsStyled.actual.js +39 -0
  240. package/node/v6.0.0/styled/test-cases/DynamicPropsStyled.expected.js +65 -0
  241. package/node/v6.0.0/styled/test-cases/LogicalStyled.actual.js +31 -1
  242. package/node/v6.0.0/styled/test-cases/LogicalStyled.expected.js +39 -1
  243. package/node/v6.0.0/styled/test-cases/NestedSpread.actual.js +33 -28
  244. package/node/v6.0.0/styled/test-cases/NestedSpread.expected.js +20 -22
  245. package/node/v6.0.0/styled/test-cases/ThemePaletteMode.expected.js +28 -26
  246. package/node/v6.0.0/styled/test-cases/VariantAndModeStyled.actual.js +6 -5
  247. package/node/v6.0.0/styled/test-cases/VariantAndModeStyled.expected.js +8 -8
  248. package/node/v6.0.0/sx-prop/index.js +13 -0
  249. package/node/v6.0.0/sx-prop/sx-v6.js +411 -0
  250. package/node/v6.0.0/sx-prop/test-cases/basic-sx.actual.js +36 -0
  251. package/node/v6.0.0/sx-prop/test-cases/basic-sx.expected.js +46 -0
  252. package/node/v6.0.0/sx-prop/test-cases/sx-applyStyles.actual.js +89 -0
  253. package/node/v6.0.0/sx-prop/test-cases/sx-applyStyles.expected.js +82 -0
  254. package/node/v6.0.0/sx-prop/test-cases/sx-condition.actual.js +92 -0
  255. package/node/v6.0.0/sx-prop/test-cases/sx-condition.expected.js +89 -0
  256. package/node/v6.0.0/sx-prop/test-cases/sx-css-vars.actual.js +55 -0
  257. package/node/v6.0.0/sx-prop/test-cases/sx-css-vars.expected.js +88 -0
  258. package/node/v6.0.0/sx-prop/test-cases/sx-dynamic.actual.js +107 -0
  259. package/node/v6.0.0/sx-prop/test-cases/sx-dynamic.expected.js +120 -0
  260. package/node/v6.0.0/sx-prop/test-cases/sx-dynamic2.actual.js +49 -0
  261. package/node/v6.0.0/sx-prop/test-cases/sx-dynamic2.expected.js +64 -0
  262. package/node/v6.0.0/sx-prop/test-cases/sx-inheritance.actual.js +17 -0
  263. package/node/v6.0.0/sx-prop/test-cases/sx-inheritance.expected.js +17 -0
  264. package/node/v6.0.0/sx-prop/test-cases/sx-line-break.actual.js +69 -0
  265. package/node/v6.0.0/sx-prop/test-cases/sx-line-break.expected.js +69 -0
  266. package/node/v6.0.0/sx-prop/test-cases/sx-value-callback.actual.js +102 -0
  267. package/node/v6.0.0/sx-prop/test-cases/sx-value-callback.expected.js +111 -0
  268. package/node/v6.0.0/system-props/index.js +13 -0
  269. package/node/v6.0.0/system-props/removeSystemProps.js +233 -0
  270. package/node/v6.0.0/system-props/test-cases/system-props.actual.js +83 -0
  271. package/node/v6.0.0/system-props/test-cases/system-props.expected.js +98 -0
  272. package/node/v6.0.0/theme-v6/index.js +13 -0
  273. package/node/v6.0.0/theme-v6/test-cases/basicTheme.actual.js +559 -0
  274. package/node/v6.0.0/theme-v6/test-cases/basicTheme.expected.js +644 -0
  275. package/node/v6.0.0/theme-v6/test-cases/themeVariants.actual.js +65 -0
  276. package/node/v6.0.0/theme-v6/test-cases/themeVariants.expected.js +74 -0
  277. package/node/v6.0.0/theme-v6/theme-v6.js +86 -0
  278. package/package.json +11 -11
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
5
+ var _material = require("@mui/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
+ sx: {
57
+ marginBottom: "32px"
58
+ }
59
+ });
60
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
61
+ sx: {
62
+ marginBottom: "32px"
63
+ }
64
+ });
65
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
66
+ sx: {
67
+ mb: "32px"
68
+ }
69
+ });
70
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
71
+ sx: {
72
+ mb: "32px"
73
+ }
74
+ });
75
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
76
+ sx: {
77
+ color: "black",
78
+ marginBottom: "16px"
79
+ }
80
+ });
81
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
82
+ sx: {
83
+ color: "black",
84
+ marginBottom: "16px"
85
+ }
86
+ });
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+
3
+ fn({
4
+ MuiTypography: {
5
+ defaultProps: {}
6
+ }
7
+ });
8
+ fn({
9
+ MuiTypography: {
10
+ defaultProps: {
11
+ className: "my-class"
12
+ }
13
+ }
14
+ });
15
+ fn({
16
+ MuiTypography: {
17
+ defaultProps: {
18
+ paragraph: false
19
+ }
20
+ }
21
+ });
22
+ fn({
23
+ MuiTypography: {
24
+ defaultProps: {
25
+ paragraph: false,
26
+ className: "my-class"
27
+ }
28
+ }
29
+ });
30
+ fn({
31
+ MuiTypography: {
32
+ defaultProps: {
33
+ paragraph: true
34
+ }
35
+ }
36
+ });
37
+ fn({
38
+ MuiTypography: {
39
+ defaultProps: {
40
+ paragraph: true,
41
+ className: "my-class"
42
+ }
43
+ }
44
+ });
45
+ fn({
46
+ MuiTypography: {
47
+ defaultProps: {
48
+ paragraph,
49
+ className: "my-class"
50
+ }
51
+ }
52
+ });
53
+ fn({
54
+ MuiTypography: {
55
+ defaultProps: {
56
+ paragraph,
57
+ className: "my-class",
58
+ sx: {
59
+ marginBottom: "32px"
60
+ }
61
+ }
62
+ }
63
+ });
64
+ fn({
65
+ MuiTypography: {
66
+ defaultProps: {
67
+ paragraph,
68
+ className: "my-class",
69
+ sx: {
70
+ mb: "32px"
71
+ }
72
+ }
73
+ }
74
+ });
75
+ fn({
76
+ MuiTypography: {
77
+ defaultProps: {
78
+ paragraph,
79
+ className: "my-class",
80
+ sx: {
81
+ color: "black"
82
+ }
83
+ }
84
+ }
85
+ });
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+
3
+ fn({
4
+ MuiTypography: {
5
+ defaultProps: {}
6
+ }
7
+ });
8
+ fn({
9
+ MuiTypography: {
10
+ defaultProps: {
11
+ className: "my-class"
12
+ }
13
+ }
14
+ });
15
+ fn({
16
+ MuiTypography: {
17
+ defaultProps: {}
18
+ }
19
+ });
20
+ fn({
21
+ MuiTypography: {
22
+ defaultProps: {
23
+ className: "my-class"
24
+ }
25
+ }
26
+ });
27
+ fn({
28
+ MuiTypography: {
29
+ defaultProps: {
30
+ sx: {
31
+ marginBottom: "16px"
32
+ }
33
+ }
34
+ }
35
+ });
36
+ fn({
37
+ MuiTypography: {
38
+ defaultProps: {
39
+ className: "my-class",
40
+ sx: {
41
+ marginBottom: "16px"
42
+ }
43
+ }
44
+ }
45
+ });
46
+ fn({
47
+ MuiTypography: {
48
+ defaultProps: {
49
+ className: "my-class",
50
+ sx: {
51
+ marginBottom: "16px"
52
+ }
53
+ }
54
+ }
55
+ });
56
+ fn({
57
+ MuiTypography: {
58
+ defaultProps: {
59
+ className: "my-class",
60
+ sx: {
61
+ marginBottom: "32px"
62
+ }
63
+ }
64
+ }
65
+ });
66
+ fn({
67
+ MuiTypography: {
68
+ defaultProps: {
69
+ className: "my-class",
70
+ sx: {
71
+ mb: "32px"
72
+ }
73
+ }
74
+ }
75
+ });
76
+ fn({
77
+ MuiTypography: {
78
+ defaultProps: {
79
+ className: "my-class",
80
+ sx: {
81
+ color: "black",
82
+ marginBottom: "16px"
83
+ }
84
+ }
85
+ }
86
+ });
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = transformer;
8
+ var _appendAttribute = _interopRequireDefault(require("../../util/appendAttribute"));
9
+ var _assignObject = _interopRequireDefault(require("../../util/assignObject"));
10
+ var _findComponentJSX = _interopRequireDefault(require("../../util/findComponentJSX"));
11
+ /**
12
+ * @param {import('jscodeshift').FileInfo} file
13
+ * @param {import('jscodeshift').API} api
14
+ */
15
+ function transformer(file, api, options) {
16
+ const j = api.jscodeshift;
17
+ const root = j(file.source);
18
+ const printOptions = options.printOptions;
19
+ (0, _findComponentJSX.default)(j, {
20
+ root,
21
+ componentName: 'Typography'
22
+ }, elementPath => {
23
+ const paragraphProp = elementPath.node.openingElement.attributes.find(attr => attr.type === 'JSXAttribute' && attr.name.name === 'paragraph');
24
+ if (!paragraphProp) {
25
+ return;
26
+ }
27
+ elementPath.node.openingElement.attributes = elementPath.node.openingElement.attributes.filter(attr => {
28
+ if (attr.type === 'JSXAttribute' && attr.name.name === 'paragraph') {
29
+ return false;
30
+ }
31
+ return true;
32
+ });
33
+ const isParagraphPropTruthy = paragraphProp.value?.expression.value !== false;
34
+ if (!isParagraphPropTruthy) {
35
+ return;
36
+ }
37
+ const sxIndex = elementPath.node.openingElement.attributes.findIndex(attr => attr.type === 'JSXAttribute' && attr.name.name === 'sx');
38
+ if (sxIndex === -1) {
39
+ (0, _appendAttribute.default)(j, {
40
+ target: elementPath.node,
41
+ attributeName: 'sx',
42
+ expression: j.objectExpression([j.objectProperty(j.identifier('marginBottom'), j.literal('16px'))])
43
+ });
44
+ } else {
45
+ const hasMarginBottom = elementPath.node.openingElement.attributes[sxIndex].value.expression.properties.some(key => key.key.name === 'marginBottom' || key.key.name === 'mb');
46
+ if (!hasMarginBottom) {
47
+ (0, _assignObject.default)(j, {
48
+ target: elementPath.node.openingElement.attributes[sxIndex],
49
+ key: 'marginBottom',
50
+ expression: j.literal('16px')
51
+ });
52
+ }
53
+ }
54
+ });
55
+ root.find(j.ObjectProperty, {
56
+ key: {
57
+ name: 'MuiTypography'
58
+ }
59
+ }).forEach(path => {
60
+ const defaultPropsObject = path.value.value.properties.find(key => key.key.name === 'defaultProps');
61
+ const paragraphProp = defaultPropsObject.value.properties.find(prop => prop.key.name === 'paragraph');
62
+ if (!paragraphProp) {
63
+ return;
64
+ }
65
+ defaultPropsObject.value.properties = defaultPropsObject.value.properties.filter(prop => !['paragraph'].includes(prop?.key?.name));
66
+ const isParagraphPropTruthy = paragraphProp.value?.value !== false;
67
+ if (!isParagraphPropTruthy) {
68
+ return;
69
+ }
70
+ const sxIndex = defaultPropsObject.value.properties.findIndex(prop => prop.key.name === 'sx');
71
+ if (sxIndex === -1) {
72
+ defaultPropsObject.value.properties.push(j.objectProperty(j.identifier('sx'), j.objectExpression([j.objectProperty(j.identifier('marginBottom'), j.literal('16px'))])));
73
+ } else {
74
+ const hasMarginBottom = defaultPropsObject.value.properties[sxIndex].value.properties.some(key => key.key.name === 'marginBottom' || key.key.name === 'mb');
75
+ if (!hasMarginBottom) {
76
+ defaultPropsObject.value.properties[sxIndex].value.properties.push(j.objectProperty(j.identifier('marginBottom'), j.literal('16px')));
77
+ }
78
+ }
79
+ });
80
+ return root.toSource(printOptions);
81
+ }
@@ -15,14 +15,10 @@ function moveJsxPropIntoSlotProps(j, element, propName, slotName) {
15
15
  const removedValue = element.openingElement.attributes.splice(propIndex, 1)[0].value.expression;
16
16
  let hasSlotProps = false;
17
17
  element.openingElement.attributes.forEach(attr => {
18
- var _attr$name;
19
- if (((_attr$name = attr.name) == null ? void 0 : _attr$name.name) === 'slotProps') {
18
+ if (attr.name?.name === 'slotProps') {
20
19
  hasSlotProps = true;
21
20
  const slots = attr.value.expression;
22
- const slotIndex = slots.properties.findIndex(prop => {
23
- var _prop$key;
24
- return (prop == null || (_prop$key = prop.key) == null ? void 0 : _prop$key.name) === slotName;
25
- });
21
+ const slotIndex = slots.properties.findIndex(prop => prop?.key?.name === slotName);
26
22
  if (slotIndex === -1) {
27
23
  (0, _assignObject.default)(j, {
28
24
  target: attr,
@@ -58,13 +54,9 @@ function moveDefaultPropsPropIntoslotProps(j, defaultPropsPathCollection, propNa
58
54
  const defaultProps = path.parent.value;
59
55
  let hasSlotProps = false;
60
56
  defaultProps.properties.forEach(property => {
61
- var _property$key;
62
- if (((_property$key = property.key) == null ? void 0 : _property$key.name) === 'slotProps') {
57
+ if (property.key?.name === 'slotProps') {
63
58
  hasSlotProps = true;
64
- const slotIndex = property.value.properties.findIndex(prop => {
65
- var _prop$key2;
66
- return (prop == null || (_prop$key2 = prop.key) == null ? void 0 : _prop$key2.name) === slotName;
67
- });
59
+ const slotIndex = property.value.properties.findIndex(prop => prop?.key?.name === slotName);
68
60
  if (slotIndex === -1) {
69
61
  property.value.properties.push(j.objectProperty(j.identifier(slotName), removedValue));
70
62
  } else {
@@ -15,13 +15,9 @@ function moveJsxPropIntoSlots(j, element, propName, slotName) {
15
15
  const removedValue = element.openingElement.attributes.splice(index, 1)[0].value.expression;
16
16
  let hasSlots = false;
17
17
  element.openingElement.attributes.forEach(attr => {
18
- var _attr$name;
19
- if (((_attr$name = attr.name) == null ? void 0 : _attr$name.name) === 'slots') {
18
+ if (attr.name?.name === 'slots') {
20
19
  hasSlots = true;
21
- const slotIndex = attr.value.expression.properties.findIndex(prop => {
22
- var _prop$key;
23
- return (prop == null || (_prop$key = prop.key) == null ? void 0 : _prop$key.name) === slotName;
24
- });
20
+ const slotIndex = attr.value.expression.properties.findIndex(prop => prop?.key?.name === slotName);
25
21
  if (slotIndex === -1) {
26
22
  (0, _assignObject.default)(j, {
27
23
  target: attr,
@@ -50,14 +46,10 @@ function moveDefaultPropsPropIntoSlots(j, defaultPropsPathCollection, propName,
50
46
  const defaultProps = path.parent.value;
51
47
  let hasSlots = false;
52
48
  defaultProps.properties.forEach(property => {
53
- var _property$key;
54
- if (((_property$key = property.key) == null ? void 0 : _property$key.name) === 'slots') {
49
+ if (property.key?.name === 'slots') {
55
50
  hasSlots = true;
56
51
  const slots = property.value;
57
- const slotIndex = slots.properties.findIndex(prop => {
58
- var _prop$key2;
59
- return (prop == null || (_prop$key2 = prop.key) == null ? void 0 : _prop$key2.name) === slotName;
60
- });
52
+ const slotIndex = slots.properties.findIndex(prop => prop?.key?.name === slotName);
61
53
  if (slotIndex === -1) {
62
54
  slots.properties.push(j.objectProperty(j.identifier(slotName), removedValue));
63
55
  }
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = replaceComponentsWithSlots;
8
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
8
  var _findComponentJSX = _interopRequireDefault(require("../../util/findComponentJSX"));
10
9
  var _findComponentDefaultProps = _interopRequireDefault(require("../../util/findComponentDefaultProps"));
11
10
  var _assignObject = _interopRequireDefault(require("../../util/assignObject"));
@@ -19,19 +18,20 @@ function replaceJsxComponentsProp(j, elementPath) {
19
18
  if (index !== -1) {
20
19
  const removed = element.openingElement.attributes.splice(index, 1);
21
20
  const camelCaseComponents = removed[0].value.expression.properties.reduce((acc, prop) => {
22
- return (0, _extends2.default)({}, acc, {
21
+ return {
22
+ ...acc,
23
23
  [componentsKeyToSlotsKey(prop.key.name)]: prop.value
24
- });
24
+ };
25
25
  }, {});
26
26
  let hasNode = false;
27
27
  element.openingElement.attributes.forEach(attr => {
28
- var _attr$name;
29
- if (((_attr$name = attr.name) == null ? void 0 : _attr$name.name) === 'slots') {
28
+ if (attr.name?.name === 'slots') {
30
29
  hasNode = true;
31
30
  const slots = attr.value.expression.properties.reduce((acc, prop) => {
32
- return (0, _extends2.default)({}, acc, {
31
+ return {
32
+ ...acc,
33
33
  [prop.key.name]: prop.value
34
- });
34
+ };
35
35
  }, {});
36
36
  Object.entries(camelCaseComponents).forEach(([slot, value]) => {
37
37
  if (!slots[slot]) {
@@ -61,13 +61,13 @@ function replaceJsxComponentsPropsProp(j, element) {
61
61
  const removed = element.openingElement.attributes.splice(index, 1);
62
62
  let hasNode = false;
63
63
  element.openingElement.attributes.forEach(attr => {
64
- var _attr$name2;
65
- if (((_attr$name2 = attr.name) == null ? void 0 : _attr$name2.name) === 'slotProps') {
64
+ if (attr.name?.name === 'slotProps') {
66
65
  hasNode = true;
67
66
  const slotProps = attr.value.expression.properties.reduce((acc, prop) => {
68
- return (0, _extends2.default)({}, acc, {
67
+ return {
68
+ ...acc,
69
69
  [prop.key.name]: prop.value
70
- });
70
+ };
71
71
  }, {});
72
72
  removed[0].value.expression.properties.forEach(prop => {
73
73
  if (!slotProps[prop.key.name]) {
@@ -77,10 +77,7 @@ function replaceJsxComponentsPropsProp(j, element) {
77
77
  expression: prop.value
78
78
  });
79
79
  } else {
80
- attr.value.expression.properties = attr.value.expression.properties.filter(p => {
81
- var _p$key;
82
- return (p == null || (_p$key = p.key) == null ? void 0 : _p$key.name) !== prop.key.name;
83
- });
80
+ attr.value.expression.properties = attr.value.expression.properties.filter(p => p?.key?.name !== prop.key.name);
84
81
  (0, _assignObject.default)(j, {
85
82
  target: attr,
86
83
  key: prop.key.name,
@@ -109,17 +106,22 @@ function replaceDefaultPropsComponentsProp(j, defaultPropsPathCollection) {
109
106
  properties: defaultPropsProperties
110
107
  } = path.parent.value;
111
108
  const components = path.value.value.properties.reduce((acc, prop) => {
112
- return (0, _extends2.default)({}, acc, {
109
+ return {
110
+ ...acc,
113
111
  [componentsKeyToSlotsKey(prop.key.name)]: prop.value
114
- });
112
+ };
115
113
  }, {});
116
114
  const existingSlots = defaultPropsProperties.find(prop => prop.key.name === 'slots');
117
115
  const slots = existingSlots ? existingSlots.value.properties.reduce((acc, prop) => {
118
- return (0, _extends2.default)({}, acc, {
116
+ return {
117
+ ...acc,
119
118
  [prop.key.name]: prop.value
120
- });
119
+ };
121
120
  }, {}) : {};
122
- const updatedSlots = j.objectExpression(Object.entries((0, _extends2.default)({}, components, slots)).map(([slot, value]) => {
121
+ const updatedSlots = j.objectExpression(Object.entries({
122
+ ...components,
123
+ ...slots
124
+ }).map(([slot, value]) => {
123
125
  return j.objectProperty(j.identifier(slot), value);
124
126
  }));
125
127
  if (existingSlots) {
@@ -140,17 +142,22 @@ function replaceDefaultPropsComponentsPropsProp(j, defaultPropsPathCollection) {
140
142
  properties: defaultPropsProperties
141
143
  } = path.parent.value;
142
144
  const components = path.value.value.properties.reduce((acc, prop) => {
143
- return (0, _extends2.default)({}, acc, {
145
+ return {
146
+ ...acc,
144
147
  [prop.key.name]: prop.value
145
- });
148
+ };
146
149
  }, {});
147
150
  const existingSlots = defaultPropsProperties.find(prop => prop.key.name === 'slotProps');
148
151
  const slots = existingSlots ? existingSlots.value.properties.reduce((acc, prop) => {
149
- return (0, _extends2.default)({}, acc, {
152
+ return {
153
+ ...acc,
150
154
  [prop.key.name]: components[prop.key.name] ? j.objectExpression([j.spreadElement(components[prop.key.name]), j.spreadElement(prop.value)]) : prop.value
151
- });
155
+ };
152
156
  }, {}) : {};
153
- const updatedSlots = j.objectExpression(Object.entries((0, _extends2.default)({}, components, slots)).map(([slot, value]) => {
157
+ const updatedSlots = j.objectExpression(Object.entries({
158
+ ...components,
159
+ ...slots
160
+ }).map(([slot, value]) => {
154
161
  return j.objectProperty(j.identifier(slot), value);
155
162
  }));
156
163
  if (existingSlots) {
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = getReturnExpression;
7
+ /**
8
+ * @param {import('ast-types').namedTypes.ArrowFunctionExpression | import('ast-types').namedTypes.FunctionExpression} node
9
+ */
10
+ function getReturnExpression(node) {
11
+ let body = node.body;
12
+ if (body === 'BlockStatement') {
13
+ body = body.body;
14
+ }
15
+ if (Array.isArray(body)) {
16
+ return body.find(statement => statement.type === 'ReturnStatement')?.argument;
17
+ }
18
+ return body;
19
+ }