@mui/codemod 6.0.0-alpha.0 → 6.0.0-alpha.10

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 (227) hide show
  1. package/README.md +742 -2
  2. package/node/deprecations/accordion-props/accordion-props.js +11 -71
  3. package/node/deprecations/accordion-props/test-cases/actual.js +22 -3
  4. package/node/deprecations/accordion-props/test-cases/expected.js +23 -5
  5. package/node/deprecations/accordion-props/test-cases/theme.actual.js +24 -0
  6. package/node/deprecations/accordion-props/test-cases/theme.expected.js +25 -0
  7. package/node/deprecations/alert-props/test-cases/expected.js +12 -4
  8. package/node/deprecations/alert-props/test-cases/theme.expected.js +12 -5
  9. package/node/deprecations/all/deprecations-all.js +36 -8
  10. package/node/deprecations/all/postcss.config.js +10 -1
  11. package/node/deprecations/autocomplete-props/autocomplete-props.js +54 -0
  12. package/node/deprecations/autocomplete-props/index.js +13 -0
  13. package/node/deprecations/autocomplete-props/test-cases/actual.js +97 -0
  14. package/node/deprecations/autocomplete-props/test-cases/expected.js +103 -0
  15. package/node/deprecations/autocomplete-props/test-cases/theme.actual.js +65 -0
  16. package/node/deprecations/autocomplete-props/test-cases/theme.expected.js +69 -0
  17. package/node/deprecations/avatar-group-props/avatar-group-props.js +87 -0
  18. package/node/deprecations/avatar-group-props/index.js +13 -0
  19. package/node/deprecations/avatar-group-props/test-cases/actual.js +56 -0
  20. package/node/deprecations/avatar-group-props/test-cases/expected.js +58 -0
  21. package/node/deprecations/avatar-group-props/test-cases/theme.actual.js +48 -0
  22. package/node/deprecations/avatar-group-props/test-cases/theme.expected.js +50 -0
  23. package/node/deprecations/avatar-props/avatar-props.js +5 -39
  24. package/node/deprecations/avatar-props/test-cases/actual.js +10 -0
  25. package/node/deprecations/avatar-props/test-cases/expected.js +12 -0
  26. package/node/deprecations/avatar-props/test-cases/theme.actual.js +14 -0
  27. package/node/deprecations/avatar-props/test-cases/theme.expected.js +16 -0
  28. package/node/deprecations/backdrop-props/backdrop-props.js +8 -59
  29. package/node/deprecations/backdrop-props/test-cases/actual.js +56 -8
  30. package/node/deprecations/backdrop-props/test-cases/expected.js +52 -9
  31. package/node/deprecations/backdrop-props/test-cases/theme.actual.js +65 -0
  32. package/node/deprecations/backdrop-props/test-cases/theme.expected.js +63 -2
  33. package/node/deprecations/badge-props/badge-props.js +22 -0
  34. package/node/deprecations/badge-props/index.js +13 -0
  35. package/node/deprecations/badge-props/test-cases/actual.js +59 -0
  36. package/node/deprecations/badge-props/test-cases/expected.js +51 -0
  37. package/node/deprecations/badge-props/test-cases/theme.actual.js +73 -0
  38. package/node/deprecations/badge-props/test-cases/theme.expected.js +65 -0
  39. package/node/deprecations/circular-progress-classes/circular-progress-classes.js +77 -0
  40. package/node/deprecations/circular-progress-classes/index.js +13 -0
  41. package/node/deprecations/circular-progress-classes/postcss-plugin.js +33 -0
  42. package/node/deprecations/circular-progress-classes/postcss.config.js +8 -0
  43. package/node/deprecations/circular-progress-classes/test-cases/actual.js +7 -0
  44. package/node/deprecations/circular-progress-classes/test-cases/expected.js +7 -0
  45. package/node/deprecations/divider-props/divider-props.js +36 -30
  46. package/node/deprecations/divider-props/test-cases/actual.js +3 -0
  47. package/node/deprecations/divider-props/test-cases/expected.js +3 -0
  48. package/node/deprecations/divider-props/test-cases/theme.actual.js +7 -0
  49. package/node/deprecations/divider-props/test-cases/theme.expected.js +7 -0
  50. package/node/deprecations/filled-input-props/filled-input-props.js +22 -0
  51. package/node/deprecations/filled-input-props/index.js +13 -0
  52. package/node/deprecations/filled-input-props/test-cases/actual.js +60 -0
  53. package/node/deprecations/filled-input-props/test-cases/expected.js +52 -0
  54. package/node/deprecations/filled-input-props/test-cases/theme.actual.js +73 -0
  55. package/node/deprecations/filled-input-props/test-cases/theme.expected.js +65 -0
  56. package/node/deprecations/form-control-label-props/form-control-label-props.js +22 -0
  57. package/node/deprecations/form-control-label-props/index.js +13 -0
  58. package/node/deprecations/form-control-label-props/test-cases/actual.js +21 -0
  59. package/node/deprecations/form-control-label-props/test-cases/expected.js +21 -0
  60. package/node/deprecations/form-control-label-props/test-cases/theme.actual.js +23 -0
  61. package/node/deprecations/form-control-label-props/test-cases/theme.expected.js +23 -0
  62. package/node/deprecations/grid-props/grid-props.js +51 -0
  63. package/node/deprecations/grid-props/index.js +13 -0
  64. package/node/deprecations/grid-props/test-cases/actual.js +25 -0
  65. package/node/deprecations/grid-props/test-cases/expected.js +23 -0
  66. package/node/deprecations/grid-props/test-cases/theme.actual.js +24 -0
  67. package/node/deprecations/grid-props/test-cases/theme.expected.js +23 -0
  68. package/node/deprecations/input-base-props/index.js +13 -0
  69. package/node/deprecations/input-base-props/input-base-props.js +22 -0
  70. package/node/deprecations/input-base-props/test-cases/actual.js +60 -0
  71. package/node/deprecations/input-base-props/test-cases/expected.js +52 -0
  72. package/node/deprecations/input-base-props/test-cases/theme.actual.js +73 -0
  73. package/node/deprecations/input-base-props/test-cases/theme.expected.js +65 -0
  74. package/node/deprecations/input-props/index.js +13 -0
  75. package/node/deprecations/input-props/input-props.js +22 -0
  76. package/node/deprecations/input-props/test-cases/actual.js +60 -0
  77. package/node/deprecations/input-props/test-cases/expected.js +52 -0
  78. package/node/deprecations/input-props/test-cases/theme.actual.js +73 -0
  79. package/node/deprecations/input-props/test-cases/theme.expected.js +65 -0
  80. package/node/deprecations/list-item-props/index.js +13 -0
  81. package/node/deprecations/list-item-props/list-item-props.js +22 -0
  82. package/node/deprecations/list-item-props/test-cases/actual.js +43 -0
  83. package/node/deprecations/list-item-props/test-cases/expected.js +40 -0
  84. package/node/deprecations/list-item-props/test-cases/theme.actual.js +56 -0
  85. package/node/deprecations/list-item-props/test-cases/theme.expected.js +53 -0
  86. package/node/deprecations/modal-props/index.js +13 -0
  87. package/node/deprecations/modal-props/modal-props.js +22 -0
  88. package/node/deprecations/modal-props/test-cases/actual.js +43 -0
  89. package/node/deprecations/modal-props/test-cases/expected.js +40 -0
  90. package/node/deprecations/modal-props/test-cases/theme.actual.js +56 -0
  91. package/node/deprecations/modal-props/test-cases/theme.expected.js +53 -0
  92. package/node/deprecations/outlined-input-props/index.js +13 -0
  93. package/node/deprecations/outlined-input-props/outlined-input-props.js +22 -0
  94. package/node/deprecations/outlined-input-props/test-cases/actual.js +60 -0
  95. package/node/deprecations/outlined-input-props/test-cases/expected.js +52 -0
  96. package/node/deprecations/outlined-input-props/test-cases/theme.actual.js +73 -0
  97. package/node/deprecations/outlined-input-props/test-cases/theme.expected.js +65 -0
  98. package/node/deprecations/pagination-item-props/index.js +13 -0
  99. package/node/deprecations/pagination-item-props/pagination-item-props.js +22 -0
  100. package/node/deprecations/pagination-item-props/test-cases/actual.js +27 -0
  101. package/node/deprecations/pagination-item-props/test-cases/expected.js +21 -0
  102. package/node/deprecations/pagination-item-props/test-cases/theme.actual.js +28 -0
  103. package/node/deprecations/pagination-item-props/test-cases/theme.expected.js +26 -0
  104. package/node/deprecations/popper-props/index.js +13 -0
  105. package/node/deprecations/popper-props/popper-props.js +22 -0
  106. package/node/deprecations/popper-props/test-cases/actual.js +27 -0
  107. package/node/deprecations/popper-props/test-cases/expected.js +24 -0
  108. package/node/deprecations/popper-props/test-cases/theme.actual.js +32 -0
  109. package/node/deprecations/popper-props/test-cases/theme.expected.js +29 -0
  110. package/node/deprecations/slider-props/test-cases/expected.js +12 -4
  111. package/node/deprecations/slider-props/test-cases/theme.expected.js +12 -5
  112. package/node/deprecations/speed-dial-props/index.js +13 -0
  113. package/node/deprecations/speed-dial-props/speed-dial-props.js +31 -0
  114. package/node/deprecations/speed-dial-props/test-cases/actual.js +41 -0
  115. package/node/deprecations/speed-dial-props/test-cases/expected.js +54 -0
  116. package/node/deprecations/speed-dial-props/test-cases/theme.actual.js +33 -0
  117. package/node/deprecations/speed-dial-props/test-cases/theme.expected.js +40 -0
  118. package/node/deprecations/step-connector-classes/index.js +13 -0
  119. package/node/deprecations/step-connector-classes/postcss-plugin.js +33 -0
  120. package/node/deprecations/step-connector-classes/postcss.config.js +8 -0
  121. package/node/deprecations/step-connector-classes/step-connector-classes.js +77 -0
  122. package/node/deprecations/step-connector-classes/test-cases/actual.js +7 -0
  123. package/node/deprecations/step-connector-classes/test-cases/expected.js +7 -0
  124. package/node/deprecations/step-label-props/step-label-props.js +14 -0
  125. package/node/deprecations/step-label-props/test-cases/actual.js +23 -0
  126. package/node/deprecations/step-label-props/test-cases/expected.js +31 -2
  127. package/node/deprecations/step-label-props/test-cases/theme.actual.js +22 -0
  128. package/node/deprecations/step-label-props/test-cases/theme.expected.js +32 -3
  129. package/node/deprecations/text-field-props/index.js +13 -0
  130. package/node/deprecations/text-field-props/test-cases/actual.js +27 -0
  131. package/node/deprecations/text-field-props/test-cases/expected.js +31 -0
  132. package/node/deprecations/text-field-props/test-cases/theme.actual.js +13 -0
  133. package/node/deprecations/text-field-props/test-cases/theme.expected.js +15 -0
  134. package/node/deprecations/text-field-props/text-field-props.js +48 -0
  135. package/node/deprecations/toggle-button-group-classes/index.js +13 -0
  136. package/node/deprecations/toggle-button-group-classes/postcss-plugin.js +33 -0
  137. package/node/deprecations/toggle-button-group-classes/postcss.config.js +8 -0
  138. package/node/deprecations/toggle-button-group-classes/test-cases/actual.js +7 -0
  139. package/node/deprecations/toggle-button-group-classes/test-cases/expected.js +7 -0
  140. package/node/deprecations/toggle-button-group-classes/toggle-button-group-classes.js +77 -0
  141. package/node/deprecations/tooltip-props/index.js +13 -0
  142. package/node/deprecations/tooltip-props/test-cases/actual.js +92 -0
  143. package/node/deprecations/tooltip-props/test-cases/expected.js +84 -0
  144. package/node/deprecations/tooltip-props/test-cases/theme.actual.js +73 -0
  145. package/node/deprecations/tooltip-props/test-cases/theme.expected.js +65 -0
  146. package/node/deprecations/tooltip-props/tooltip-props.js +22 -0
  147. package/node/deprecations/utils/movePropIntoSlotProps.js +111 -0
  148. package/node/deprecations/utils/movePropIntoSlots.js +101 -0
  149. package/node/deprecations/utils/replaceComponentsWithSlots.js +29 -17
  150. package/node/util/getReturnExpression.js +20 -0
  151. package/node/util/migrateToVariants.js +549 -0
  152. package/node/v5.0.0/badge-overlap-value.test/actual.js +3 -4
  153. package/node/v5.0.0/badge-overlap-value.test/expected.js +3 -4
  154. package/node/v5.0.0/base-remove-component-prop.test/actual.js +4 -4
  155. package/node/v5.0.0/base-remove-component-prop.test/expected.js +4 -4
  156. package/node/v5.0.0/base-remove-unstyled-suffix.js +4 -4
  157. package/node/v5.0.0/box-sx-prop.test/actual.js +4 -4
  158. package/node/v5.0.0/box-sx-prop.test/expected.js +3 -3
  159. package/node/v5.0.0/create-theme.test/custom-fn.actual.js +3 -4
  160. package/node/v5.0.0/create-theme.test/custom-fn.expected.js +3 -4
  161. package/node/v5.0.0/jss-to-styled.test/first.actual.js +11 -14
  162. package/node/v5.0.0/jss-to-styled.test/first.expected.js +11 -14
  163. package/node/v5.0.0/jss-to-styled.test/seventh.actual.js +4 -4
  164. package/node/v5.0.0/jss-to-styled.test/seventh.expected.js +4 -4
  165. package/node/v5.0.0/jss-to-styled.test/sixth.actual.js +3 -3
  166. package/node/v5.0.0/jss-to-styled.test/sixth.expected.js +3 -3
  167. package/node/v5.0.0/jss-to-styled.test/withCreateStyles.actual.js +3 -3
  168. package/node/v5.0.0/jss-to-styled.test/withCreateStyles.expected.js +3 -4
  169. package/node/v5.0.0/jss-to-styled.test/withCreateStyles1.actual.js +3 -3
  170. package/node/v5.0.0/jss-to-styled.test/withCreateStyles1.expected.js +3 -4
  171. package/node/v5.0.0/jss-to-styled.test/withCreateStyles2.actual.js +3 -3
  172. package/node/v5.0.0/jss-to-styled.test/withCreateStyles2.expected.js +3 -4
  173. package/node/v5.0.0/jss-to-styled.test/withCreateStyles3.actual.js +3 -3
  174. package/node/v5.0.0/jss-to-styled.test/withCreateStyles3.expected.js +3 -4
  175. package/node/v5.0.0/jss-to-tss-react.test/actual-mixins-pattern.js +6 -5
  176. package/node/v5.0.0/jss-to-tss-react.test/expected-mixins-pattern.js +6 -5
  177. package/node/v5.0.0/preset-safe.test/actual.js +6 -4
  178. package/node/v5.0.0/preset-safe.test/expected.js +9 -6
  179. package/node/v5.0.0/styled-engine-provider.test/theme-provider.expected.js +3 -3
  180. package/node/v5.0.0/table-props.test/actual.js +4 -5
  181. package/node/v5.0.0/table-props.test/expected.js +4 -5
  182. package/node/v5.0.0/theme-spacing.test/large-actual.js +10 -10
  183. package/node/v5.0.0/theme-spacing.test/large-expected.js +10 -10
  184. package/node/v5.0.0/variant-prop.test/actual.js +12 -6
  185. package/node/v5.0.0/variant-prop.test/expected.js +15 -12
  186. package/node/v5.0.0/with-mobile-dialog.test/expected.js +6 -5
  187. package/node/v5.0.0/with-width.test/expected.js +6 -5
  188. package/node/v6.0.0/all/index.js +13 -0
  189. package/node/v6.0.0/all/postcss.config.js +9 -0
  190. package/node/v6.0.0/all/v6-all.js +17 -0
  191. package/node/v6.0.0/styled/index.js +13 -0
  192. package/node/v6.0.0/styled/styled-v6.js +80 -0
  193. package/node/v6.0.0/styled/test-cases/BasicStyled.actual.js +89 -0
  194. package/node/v6.0.0/styled/test-cases/BasicStyled.expected.js +143 -0
  195. package/node/v6.0.0/styled/test-cases/ConditionalStyled.actual.js +152 -0
  196. package/node/v6.0.0/styled/test-cases/ConditionalStyled.expected.js +244 -0
  197. package/node/v6.0.0/styled/test-cases/LogicalStyled.actual.js +28 -0
  198. package/node/v6.0.0/styled/test-cases/LogicalStyled.expected.js +52 -0
  199. package/node/v6.0.0/styled/test-cases/NestedSpread.actual.js +48 -0
  200. package/node/v6.0.0/styled/test-cases/NestedSpread.expected.js +86 -0
  201. package/node/v6.0.0/styled/test-cases/ObjectMap.actual.js +36 -0
  202. package/node/v6.0.0/styled/test-cases/ObjectMap.expected.js +109 -0
  203. package/node/v6.0.0/styled/test-cases/ThemePaletteMode.actual.js +62 -0
  204. package/node/v6.0.0/styled/test-cases/ThemePaletteMode.expected.js +78 -0
  205. package/node/v6.0.0/styled/test-cases/VariantAndModeStyled.actual.js +12 -0
  206. package/node/v6.0.0/styled/test-cases/VariantAndModeStyled.expected.js +19 -0
  207. package/node/v6.0.0/sx-prop/index.js +13 -0
  208. package/node/v6.0.0/sx-prop/sx-v6.js +355 -0
  209. package/node/v6.0.0/sx-prop/test-cases/basic-sx.actual.js +36 -0
  210. package/node/v6.0.0/sx-prop/test-cases/basic-sx.expected.js +46 -0
  211. package/node/v6.0.0/sx-prop/test-cases/sx-css-vars.actual.js +41 -0
  212. package/node/v6.0.0/sx-prop/test-cases/sx-css-vars.expected.js +71 -0
  213. package/node/v6.0.0/sx-prop/test-cases/sx-dynamic.actual.js +87 -0
  214. package/node/v6.0.0/sx-prop/test-cases/sx-dynamic.expected.js +102 -0
  215. package/node/v6.0.0/sx-prop/test-cases/sx-dynamic2.actual.js +49 -0
  216. package/node/v6.0.0/sx-prop/test-cases/sx-dynamic2.expected.js +64 -0
  217. package/node/v6.0.0/system-props/index.js +13 -0
  218. package/node/v6.0.0/system-props/removeSystemProps.js +242 -0
  219. package/node/v6.0.0/system-props/test-cases/system-props.actual.js +79 -0
  220. package/node/v6.0.0/system-props/test-cases/system-props.expected.js +92 -0
  221. package/node/v6.0.0/theme-v6/index.js +13 -0
  222. package/node/v6.0.0/theme-v6/test-cases/basicTheme.actual.js +559 -0
  223. package/node/v6.0.0/theme-v6/test-cases/basicTheme.expected.js +644 -0
  224. package/node/v6.0.0/theme-v6/test-cases/themeVariants.actual.js +65 -0
  225. package/node/v6.0.0/theme-v6/test-cases/themeVariants.expected.js +74 -0
  226. package/node/v6.0.0/theme-v6/theme-v6.js +87 -0
  227. package/package.json +9 -9
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+
3
+ const IconRoot = styled('span')(({
4
+ theme
5
+ }) => ({
6
+ userSelect: 'none',
7
+ width: '1em',
8
+ height: '1em',
9
+ // Chrome fix for https://bugs.chromium.org/p/chromium/issues/detail?id=820541
10
+ // To remove at some point.
11
+ overflow: 'hidden',
12
+ // allow overflow hidden to take action
13
+ display: 'inline-block',
14
+ // support non-square icon
15
+ textAlign: 'center',
16
+ flexShrink: 0,
17
+ variants: [{
18
+ props: {
19
+ fontSize: "inherit"
20
+ },
21
+ style: {
22
+ fontSize: 'inherit'
23
+ }
24
+ }, {
25
+ props: {
26
+ fontSize: "small"
27
+ },
28
+ style: {
29
+ fontSize: theme.typography.pxToRem(20)
30
+ }
31
+ }, {
32
+ props: {
33
+ fontSize: "medium"
34
+ },
35
+ style: {
36
+ fontSize: theme.typography.pxToRem(24)
37
+ }
38
+ }, {
39
+ props: {
40
+ fontSize: "large"
41
+ },
42
+ style: {
43
+ fontSize: theme.typography.pxToRem(36)
44
+ }
45
+ }, {
46
+ props: {
47
+ color: "primary"
48
+ },
49
+ style: {
50
+ color: (theme.vars || theme).palette.primary.main
51
+ }
52
+ }, {
53
+ props: {
54
+ color: "secondary"
55
+ },
56
+ style: {
57
+ color: (theme.vars || theme).palette.secondary.main
58
+ }
59
+ }, {
60
+ props: {
61
+ color: "info"
62
+ },
63
+ style: {
64
+ color: (theme.vars || theme).palette.info.main
65
+ }
66
+ }, {
67
+ props: {
68
+ color: "success"
69
+ },
70
+ style: {
71
+ color: (theme.vars || theme).palette.success.main
72
+ }
73
+ }, {
74
+ props: {
75
+ color: "warning"
76
+ },
77
+ style: {
78
+ color: (theme.vars || theme).palette.warning.main
79
+ }
80
+ }, {
81
+ props: {
82
+ color: "action"
83
+ },
84
+ style: {
85
+ color: (theme.vars || theme).palette.action.active
86
+ }
87
+ }, {
88
+ props: {
89
+ color: "error"
90
+ },
91
+ style: {
92
+ color: (theme.vars || theme).palette.error.main
93
+ }
94
+ }, {
95
+ props: {
96
+ color: "disabled"
97
+ },
98
+ style: {
99
+ color: (theme.vars || theme).palette.action.disabled
100
+ }
101
+ }, {
102
+ props: {
103
+ color: "inherit"
104
+ },
105
+ style: {
106
+ color: undefined
107
+ }
108
+ }]
109
+ }));
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+
3
+ const Test = styled('div')(({
4
+ theme
5
+ }) => ({
6
+ color: theme.palette.mode === 'dark' ? theme.palette.primary.light : theme.palette.primary.main,
7
+ background: `linear-gradient(45deg, ${theme.palette.mode === 'dark' ? theme.palette.primary[400] : theme.palette.primary[600]} 30%, ${theme.palette.mode === 'dark' ? theme.palette.primary[200] : theme.palette.primary[500]} 90%})`
8
+ }));
9
+ const StyledPopper = styled(Popper)(({
10
+ theme
11
+ }) => ({
12
+ border: `1px solid ${theme.palette.mode === 'light' ? '#e1e4e8' : '#30363d'}`,
13
+ boxShadow: `0 8px 24px ${theme.palette.mode === 'light' ? 'rgba(149, 157, 165, 0.2)' : 'rgb(1, 4, 9)'}`,
14
+ borderRadius: 6,
15
+ width: 300,
16
+ zIndex: theme.zIndex.modal,
17
+ fontSize: 13,
18
+ color: theme.palette.mode === 'light' ? '#24292e' : '#c9d1d9',
19
+ backgroundColor: theme.palette.mode === 'light' ? '#fff' : '#1c2128'
20
+ }));
21
+ const AntSwitch = styled(Switch)(({
22
+ theme
23
+ }) => ({
24
+ width: 28,
25
+ height: 16,
26
+ padding: 0,
27
+ display: 'flex',
28
+ '&:active': {
29
+ '& .MuiSwitch-thumb': {
30
+ width: 15
31
+ },
32
+ '& .MuiSwitch-switchBase.Mui-checked': {
33
+ transform: 'translateX(9px)'
34
+ }
35
+ },
36
+ '& .MuiSwitch-switchBase': {
37
+ padding: 2,
38
+ '&.Mui-checked': {
39
+ transform: 'translateX(12px)',
40
+ color: '#fff',
41
+ '& + .MuiSwitch-track': {
42
+ opacity: 1,
43
+ backgroundColor: theme.palette.mode === 'dark' ? '#177ddc' : '#1890ff'
44
+ }
45
+ }
46
+ },
47
+ '& .MuiSwitch-thumb': {
48
+ boxShadow: '0 2px 4px 0 rgb(0 35 11 / 20%)',
49
+ width: 12,
50
+ height: 12,
51
+ borderRadius: 6,
52
+ transition: theme.transitions.create(['width'], {
53
+ duration: 200
54
+ })
55
+ },
56
+ '& .MuiSwitch-track': {
57
+ borderRadius: 16 / 2,
58
+ opacity: 1,
59
+ backgroundColor: theme.palette.mode === 'dark' ? 'rgba(255,255,255,.35)' : 'rgba(0,0,0,.25)',
60
+ boxSizing: 'border-box'
61
+ }
62
+ }));
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+
3
+ const Test = styled('div')(({
4
+ theme
5
+ }) => ({
6
+ color: theme.palette.primary.main,
7
+ background: `linear-gradient(45deg, ${theme.palette.primary[600]} 30%, ${theme.palette.primary[500]} 90%})`,
8
+ ...theme.applyStyles("dark", {
9
+ color: theme.palette.primary.light,
10
+ background: `linear-gradient(45deg, ${theme.palette.primary[400]} 30%, ${theme.palette.primary[200]} 90%})`
11
+ })
12
+ }));
13
+ const StyledPopper = styled(Popper)(({
14
+ theme
15
+ }) => ({
16
+ border: `1px solid ${'#30363d'}`,
17
+ boxShadow: `0 8px 24px ${'rgb(1, 4, 9)'}`,
18
+ borderRadius: 6,
19
+ width: 300,
20
+ zIndex: theme.zIndex.modal,
21
+ fontSize: 13,
22
+ color: '#c9d1d9',
23
+ backgroundColor: '#1c2128',
24
+ ...theme.applyStyles("light", {
25
+ border: `1px solid ${'#e1e4e8'}`,
26
+ boxShadow: `0 8px 24px ${'rgba(149, 157, 165, 0.2)'}`,
27
+ color: '#24292e',
28
+ backgroundColor: '#fff'
29
+ })
30
+ }));
31
+ const AntSwitch = styled(Switch)(({
32
+ theme
33
+ }) => ({
34
+ width: 28,
35
+ height: 16,
36
+ padding: 0,
37
+ display: 'flex',
38
+ '&:active': {
39
+ '& .MuiSwitch-thumb': {
40
+ width: 15
41
+ },
42
+ '& .MuiSwitch-switchBase.Mui-checked': {
43
+ transform: 'translateX(9px)'
44
+ }
45
+ },
46
+ '& .MuiSwitch-switchBase': {
47
+ padding: 2,
48
+ '&.Mui-checked': {
49
+ transform: 'translateX(12px)',
50
+ color: '#fff',
51
+ '& + .MuiSwitch-track': {
52
+ opacity: 1,
53
+ backgroundColor: '#1890ff',
54
+ ...theme.applyStyles("dark", {
55
+ backgroundColor: '#177ddc'
56
+ })
57
+ }
58
+ }
59
+ },
60
+ '& .MuiSwitch-thumb': {
61
+ boxShadow: '0 2px 4px 0 rgb(0 35 11 / 20%)',
62
+ width: 12,
63
+ height: 12,
64
+ borderRadius: 6,
65
+ transition: theme.transitions.create(['width'], {
66
+ duration: 200
67
+ })
68
+ },
69
+ '& .MuiSwitch-track': {
70
+ borderRadius: 16 / 2,
71
+ opacity: 1,
72
+ backgroundColor: 'rgba(0,0,0,.25)',
73
+ boxSizing: 'border-box',
74
+ ...theme.applyStyles("dark", {
75
+ backgroundColor: 'rgba(255,255,255,.35)'
76
+ })
77
+ }
78
+ }));
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ const Component = styled.div(({
4
+ theme,
5
+ ownerState
6
+ }) => ({
7
+ ...theme.typography.caption,
8
+ ...(ownerState.size === 'small' && {
9
+ marginTop: (theme.vars || theme).spacing(1),
10
+ color: theme.palette.mode === 'dark' ? theme.palette.primary.light : theme.palette.primary.main
11
+ })
12
+ }));
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ const Component = styled.div(({
4
+ theme
5
+ }) => ({
6
+ ...theme.typography.caption,
7
+ variants: [{
8
+ props: {
9
+ size: 'small'
10
+ },
11
+ style: {
12
+ marginTop: (theme.vars || theme).spacing(1),
13
+ color: theme.palette.primary.main,
14
+ ...theme.applyStyles("dark", {
15
+ color: theme.palette.primary.light
16
+ })
17
+ }
18
+ }]
19
+ }));
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ Object.defineProperty(exports, "default", {
8
+ enumerable: true,
9
+ get: function () {
10
+ return _sxV.default;
11
+ }
12
+ });
13
+ var _sxV = _interopRequireDefault(require("./sx-v6"));
@@ -0,0 +1,355 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = sxV6;
8
+ var _getReturnExpression = _interopRequireDefault(require("../../util/getReturnExpression"));
9
+ var _migrateToVariants = require("../../util/migrateToVariants");
10
+ /**
11
+ *
12
+ * @param {import('jscodeshift').MemberExpression | import('jscodeshift').Identifier} node
13
+ */
14
+ function getCssVarName(node) {
15
+ if (node.type === 'MemberExpression') {
16
+ var _getObjectKey;
17
+ return `--${(_getObjectKey = (0, _migrateToVariants.getObjectKey)(node)) == null ? void 0 : _getObjectKey.name}-${node.property.name}`;
18
+ }
19
+ if (node.type === 'Identifier') {
20
+ return `--${node.name}`;
21
+ }
22
+ return '';
23
+ }
24
+
25
+ /**
26
+ * @param {import('jscodeshift').FileInfo} file
27
+ * @param {import('jscodeshift').API} api
28
+ */
29
+ function sxV6(file, api, options) {
30
+ const j = api.jscodeshift;
31
+ const root = j(file.source);
32
+ const printOptions = options.printOptions;
33
+ const createBuildStyle = (0, _migrateToVariants.getCreateBuildStyle)(j);
34
+ const appendPaletteModeStyles = (0, _migrateToVariants.getAppendPaletteModeStyles)(j);
35
+ const buildArrowFunctionAST = (0, _migrateToVariants.getBuildArrowFunctionAST)(j);
36
+
37
+ /**
38
+ *
39
+ * @param {import('jscodeshift').Identifier} node
40
+ */
41
+ function replaceUndefined(node, replacement = j.nullLiteral()) {
42
+ if ((node == null ? void 0 : node.type) === 'Identifier' && node.name === 'undefined') {
43
+ return replacement;
44
+ }
45
+ return node;
46
+ }
47
+ let shouldTransform = false;
48
+ root.find(j.JSXAttribute, {
49
+ name: {
50
+ name: 'sx'
51
+ },
52
+ value: {
53
+ type: 'JSXExpressionContainer'
54
+ }
55
+ }).forEach(path => {
56
+ /**
57
+ * @type {[import('jscodeshift').StringLiteral, import('jscodeshift').Expression][]}
58
+ */
59
+ const cssVars = [];
60
+ const conditionalExpressions = []; // for ensuring the sequence of styles
61
+ let currentIndex = 0;
62
+ const sxContainer = path.node.value;
63
+ if (['ArrowFunctionExpression', 'ObjectExpression', 'ArrayExpression'].includes(sxContainer.expression.type)) {
64
+ shouldTransform = true;
65
+ (sxContainer.expression.type === 'ArrayExpression' ? sxContainer.expression.elements : [sxContainer.expression]).forEach((item, index) => {
66
+ currentIndex = index;
67
+ recurseObjectExpression({
68
+ root: item,
69
+ replaceRoot: newRoot => {
70
+ sxContainer.expression = newRoot;
71
+ },
72
+ node: item,
73
+ buildStyle: createBuildStyle()
74
+ });
75
+ });
76
+ if (cssVars.length) {
77
+ const cssVarsObject = j.objectExpression(cssVars.map(([varName, value]) => j.objectProperty(varName, value)));
78
+ if (path.parent.node.type === 'JSXOpeningElement') {
79
+ const styleAttribute = path.parent.node.attributes.find(attribute => attribute.type === 'JSXAttribute' && attribute.name.name === 'style');
80
+ const spreadAttribute = path.parent.node.attributes.find(attribute => attribute.type === 'JSXSpreadAttribute');
81
+ if (styleAttribute) {
82
+ if (styleAttribute.value.expression.type === 'ObjectExpression') {
83
+ styleAttribute.value.expression.properties = [...cssVarsObject.properties, ...styleAttribute.value.expression.properties];
84
+ } else if (styleAttribute.value.expression.type === 'Identifier' || styleAttribute.value.expression.type === 'MemberExpression') {
85
+ styleAttribute.value.expression = j.objectExpression([...cssVarsObject.properties, j.spreadElement(styleAttribute.value.expression)]);
86
+ }
87
+ } else if (spreadAttribute) {
88
+ path.parent.node.attributes.push(j.jsxAttribute(j.jsxIdentifier('style'), j.jsxExpressionContainer(j.objectExpression([...cssVarsObject.properties, j.spreadElement(j.memberExpression(spreadAttribute.argument, j.identifier('style')))]))));
89
+ } else {
90
+ path.parent.node.attributes.push(j.jsxAttribute(j.jsxIdentifier('style'), j.jsxExpressionContainer(cssVarsObject)));
91
+ }
92
+ }
93
+ }
94
+ if (conditionalExpressions.length && sxContainer.expression.type === 'ArrayExpression') {
95
+ // insert the conditional expressions in the correct order
96
+ let cumulativeIndex = 0;
97
+ conditionalExpressions.forEach(([index, newElement]) => {
98
+ sxContainer.expression.elements.splice(index + 1 + cumulativeIndex, 0, newElement);
99
+ cumulativeIndex += 1;
100
+ });
101
+ }
102
+ if (sxContainer.expression.type === 'ArrayExpression') {
103
+ sxContainer.expression.elements = sxContainer.expression.elements.filter(item => item.type !== 'ObjectExpression' || item.properties.length > 0);
104
+ }
105
+ }
106
+ function wrapSxInArray(newElement) {
107
+ if (sxContainer.expression.type === 'ObjectExpression' || sxContainer.expression.type === 'ArrowFunctionExpression') {
108
+ sxContainer.expression = j.arrayExpression([sxContainer.expression]);
109
+ }
110
+ if (sxContainer.expression.type === 'ArrayExpression') {
111
+ // store in a list to be added later to ensure the sequence of styles
112
+ conditionalExpressions.push([currentIndex, newElement]);
113
+ }
114
+ }
115
+
116
+ /**
117
+ *
118
+ * @param {{ node: import('jscodeshift').Expression }} data
119
+ */
120
+ function recurseObjectExpression(data) {
121
+ if (data.node.type === 'ArrowFunctionExpression') {
122
+ const returnExpression = (0, _getReturnExpression.default)(data.node);
123
+ if (returnExpression) {
124
+ recurseObjectExpression({
125
+ ...data,
126
+ node: returnExpression
127
+ });
128
+ }
129
+ }
130
+ if (data.node.type === 'ObjectExpression') {
131
+ const modeStyles = {}; // to collect styles from `theme.palette.mode === '...'`
132
+ data.node.properties.forEach(prop => {
133
+ if (prop.type === 'ObjectProperty') {
134
+ recurseObjectExpression({
135
+ ...data,
136
+ node: prop.value,
137
+ parentNode: data.node,
138
+ key: prop.key,
139
+ buildStyle: createBuildStyle(prop.key, data.buildStyle),
140
+ replaceValue: newValue => {
141
+ prop.value = newValue;
142
+ },
143
+ deleteSelf: () => {
144
+ (0, _migrateToVariants.removeProperty)(data.node, prop);
145
+ if (data.node.properties.length === 0) {
146
+ var _data$deleteSelf;
147
+ (_data$deleteSelf = data.deleteSelf) == null || _data$deleteSelf.call(data);
148
+ }
149
+ },
150
+ modeStyles
151
+ });
152
+ } else {
153
+ recurseObjectExpression({
154
+ ...data,
155
+ node: prop,
156
+ parentNode: data.node,
157
+ buildStyle: createBuildStyle(prop.key, data.buildStyle)
158
+ });
159
+ }
160
+ });
161
+ appendPaletteModeStyles(data.node, modeStyles);
162
+ }
163
+ if (data.node.type === 'SpreadElement') {
164
+ if (data.node.argument.type === 'LogicalExpression') {
165
+ var _getObjectKey2, _getObjectKey3;
166
+ const paramName = data.node.argument.left.type === 'BinaryExpression' ? (_getObjectKey2 = (0, _migrateToVariants.getObjectKey)(data.node.argument.left.left)) == null ? void 0 : _getObjectKey2.name : (_getObjectKey3 = (0, _migrateToVariants.getObjectKey)(data.node.argument.left)) == null ? void 0 : _getObjectKey3.name;
167
+ if (paramName === 'theme' && data.node.argument.left.right.type === 'StringLiteral') {
168
+ if (data.node.argument.right.type === 'ObjectExpression') {
169
+ const mode = data.node.argument.left.right.value;
170
+ data.node.argument.right.properties.forEach(prop => {
171
+ if (prop.type === 'ObjectProperty') {
172
+ recurseObjectExpression({
173
+ ...data,
174
+ node: prop.value,
175
+ parentNode: data.node.argument.right,
176
+ key: prop.key,
177
+ buildStyle: createBuildStyle(prop.key, data.buildStyle, mode),
178
+ replaceValue: newValue => {
179
+ prop.value = newValue;
180
+ }
181
+ });
182
+ } else {
183
+ recurseObjectExpression({
184
+ ...data,
185
+ node: prop,
186
+ parentNode: data.node.argument.right,
187
+ buildStyle: createBuildStyle(prop.key, data.buildStyle, mode)
188
+ });
189
+ }
190
+ });
191
+ appendPaletteModeStyles(data.parentNode, {
192
+ [mode]: data.node.argument.right
193
+ });
194
+ }
195
+ if (data.deleteSelf) {
196
+ data.deleteSelf();
197
+ } else {
198
+ (0, _migrateToVariants.removeProperty)(data.parentNode, data.node);
199
+ }
200
+ return;
201
+ }
202
+ if (data.node.argument.right.type === 'ObjectExpression') {
203
+ recurseObjectExpression({
204
+ ...data,
205
+ node: data.node.argument.right,
206
+ root: data.node.argument.right,
207
+ replaceRoot: newRoot => {
208
+ data.node.argument.right = newRoot;
209
+ }
210
+ });
211
+ }
212
+ wrapSxInArray(j.logicalExpression(data.node.argument.operator, data.node.argument.left, data.node.argument.right));
213
+ if (data.deleteSelf) {
214
+ data.deleteSelf();
215
+ } else {
216
+ (0, _migrateToVariants.removeProperty)(data.parentNode, data.node);
217
+ }
218
+ }
219
+ if (data.node.argument.type === 'ConditionalExpression') {
220
+ recurseObjectExpression({
221
+ ...data,
222
+ node: data.node.argument,
223
+ parentNode: data.node
224
+ });
225
+ if (data.deleteSelf) {
226
+ data.deleteSelf();
227
+ } else {
228
+ (0, _migrateToVariants.removeProperty)(data.parentNode, data.node);
229
+ }
230
+ }
231
+ }
232
+ if (data.node.type === 'ConditionalExpression') {
233
+ if (data.node.test.type === 'BinaryExpression' || data.node.test.type === 'UnaryExpression' || data.node.test.type === 'Identifier' || data.node.test.type === 'MemberExpression') {
234
+ var _data$parentNode, _data$node$test, _data$node$test2;
235
+ if (((_data$parentNode = data.parentNode) == null ? void 0 : _data$parentNode.type) === 'ObjectExpression' && (((_data$node$test = data.node.test) == null ? void 0 : _data$node$test.type) === 'BinaryExpression' || ((_data$node$test2 = data.node.test) == null ? void 0 : _data$node$test2.type) === 'Identifier')) {
236
+ if (data.node.consequent.type !== 'ObjectExpression' && data.node.alternate.type !== 'ObjectExpression') {
237
+ if ((0, _migrateToVariants.isThemePaletteMode)(data.node.test.left)) {
238
+ var _data$replaceValue;
239
+ const consequentKey = (0, _migrateToVariants.getObjectKey)(data.node.consequent);
240
+ if (consequentKey.type === 'Identifier' && consequentKey.name !== 'theme') {
241
+ const varName = getCssVarName(data.node.consequent);
242
+ cssVars.push([j.stringLiteral(varName), data.node.consequent]);
243
+ data.node.consequent = j.stringLiteral(`var(${varName})`);
244
+ }
245
+ const alternateKey = (0, _migrateToVariants.getObjectKey)(data.node.alternate);
246
+ if (alternateKey.type === 'Identifier' && alternateKey.name !== 'theme') {
247
+ const varName = getCssVarName(data.node.alternate);
248
+ cssVars.push([j.stringLiteral(varName), data.node.alternate]);
249
+ data.node.alternate = j.stringLiteral(`var(${varName})`);
250
+ }
251
+ if (data.modeStyles) {
252
+ if (!data.modeStyles[data.node.test.right.value]) {
253
+ data.modeStyles[data.node.test.right.value] = [];
254
+ }
255
+ data.modeStyles[data.node.test.right.value].push(j.objectProperty(data.key, replaceUndefined(data.node.consequent)));
256
+ }
257
+ (_data$replaceValue = data.replaceValue) == null || _data$replaceValue.call(data, replaceUndefined(data.node.alternate));
258
+ if (data.root.type === 'ObjectExpression') {
259
+ var _data$replaceRoot;
260
+ (_data$replaceRoot = data.replaceRoot) == null || _data$replaceRoot.call(data, buildArrowFunctionAST([j.identifier('theme')], data.root));
261
+ } else if (data.root.type === 'ArrayExpression') {
262
+ data.root.elements.forEach((item, index) => {
263
+ if (item === data.node) {
264
+ data.root.elements[index] = buildArrowFunctionAST([j.identifier('theme')], data.root);
265
+ }
266
+ });
267
+ }
268
+ } else {
269
+ var _data$buildStyle, _data$buildStyle2;
270
+ wrapSxInArray(j.conditionalExpression(data.node.test, (_data$buildStyle = data.buildStyle) == null ? void 0 : _data$buildStyle.call(data, replaceUndefined(data.node.consequent)), (_data$buildStyle2 = data.buildStyle) == null ? void 0 : _data$buildStyle2.call(data, replaceUndefined(data.node.alternate))));
271
+ if (data.deleteSelf) {
272
+ data.deleteSelf();
273
+ } else {
274
+ (0, _migrateToVariants.removeProperty)(data.parentNode, data.node);
275
+ }
276
+ }
277
+ }
278
+ }
279
+ }
280
+ }
281
+ if (data.node.type === 'TemplateLiteral') {
282
+ var _data$parentNode2;
283
+ if (((_data$parentNode2 = data.parentNode) == null ? void 0 : _data$parentNode2.type) === 'ObjectExpression') {
284
+ const modeStyles = {};
285
+ data.node.expressions.forEach((expression, index) => {
286
+ if (expression.type === 'MemberExpression') {
287
+ const memberKey = (0, _migrateToVariants.getObjectKey)(expression);
288
+ if (memberKey.type === 'Identifier' && memberKey.name !== 'theme') {
289
+ const varName = getCssVarName(expression);
290
+ cssVars.push([j.stringLiteral(varName), expression]);
291
+ data.node.expressions[index] = j.stringLiteral(`var(${varName})`);
292
+ }
293
+ } else {
294
+ recurseObjectExpression({
295
+ ...data,
296
+ node: expression,
297
+ parentNode: data.parentNode,
298
+ buildStyle: createBuildStyle(data.key, data.buildStyle),
299
+ replaceValue: newValue => {
300
+ data.node.expressions[index] = newValue;
301
+ },
302
+ modeStyles
303
+ });
304
+ }
305
+ });
306
+ if (data.modeStyles) {
307
+ Object.entries(modeStyles).forEach(([mode, objectStyles]) => {
308
+ const clonedNode = {
309
+ ...data.node,
310
+ expressions: data.node.expressions.map(expression => ({
311
+ ...expression
312
+ }))
313
+ };
314
+ clonedNode.expressions = objectStyles.map(item => item.value);
315
+ if (!data.modeStyles[mode]) {
316
+ data.modeStyles[mode] = [];
317
+ }
318
+ data.modeStyles[mode].push(j.objectProperty(data.key, clonedNode));
319
+ });
320
+ if (data.key) {
321
+ var _data$replaceValue2;
322
+ (_data$replaceValue2 = data.replaceValue) == null || _data$replaceValue2.call(data, data.node);
323
+ }
324
+ }
325
+ }
326
+ }
327
+ }
328
+ });
329
+ const transformed = root.toSource(printOptions);
330
+ if (shouldTransform) {
331
+ // recast adds extra newlines that we don't want, https://github.com/facebook/jscodeshift/issues/249
332
+ // need to remove them manually
333
+ const lines = [];
334
+ let isInStyled = false;
335
+ let spaceMatch;
336
+ transformed.split('\n').forEach(line => {
337
+ if (!isInStyled) {
338
+ lines.push(line);
339
+ } else if (line !== '') {
340
+ var _line$match, _spaceMatch;
341
+ if (spaceMatch && ((_line$match = line.match(/^\s+/)) == null ? void 0 : _line$match[0]) === ((_spaceMatch = spaceMatch) == null ? void 0 : _spaceMatch[0]) && line.endsWith('}')) {
342
+ isInStyled = false;
343
+ spaceMatch = null;
344
+ }
345
+ lines.push(line);
346
+ }
347
+ if (line.includes('sx=')) {
348
+ isInStyled = true;
349
+ spaceMatch = line.match(/^\s+/);
350
+ }
351
+ });
352
+ return lines.join('\n');
353
+ }
354
+ return transformed;
355
+ }
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+
3
+ var _jsxRuntime = require("react/jsx-runtime");
4
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(Toolbar, {
5
+ variant: "regular",
6
+ sx: theme => ({
7
+ display: 'flex',
8
+ alignItems: 'center',
9
+ justifyContent: 'space-between',
10
+ flexShrink: 0,
11
+ borderRadius: '999px',
12
+ bgcolor: theme.palette.mode === 'light' ? 'hsla(220, 60%, 99%, 0.6)' : 'hsla(220, 0%, 0%, 0.7)',
13
+ backdropFilter: 'blur(24px)',
14
+ maxHeight: 40,
15
+ border: '1px solid',
16
+ borderColor: 'divider',
17
+ boxShadow: theme.palette.mode === 'light' ? '0 1px 2px hsla(210, 0%, 0%, 0.05), 0 2px 12px hsla(210, 100%, 80%, 0.5)' : '0 1px 2px hsla(210, 0%, 0%, 0.5), 0 2px 12px hsla(210, 100%, 25%, 0.3)'
18
+ })
19
+ });
20
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(Box, {
21
+ component: "main",
22
+ sx: {
23
+ backgroundColor: theme => theme.palette.mode === 'light' ? theme.palette.grey[100] : theme.palette.grey[900],
24
+ flexGrow: 1,
25
+ height: '100vh',
26
+ overflow: 'auto'
27
+ }
28
+ });
29
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(Box, {
30
+ sx: {
31
+ borderBottom: theme => `1px solid ${theme.palette.mode === 'light' ? 'grey.200' : 'grey.800'}`,
32
+ backgroundSize: 'cover',
33
+ backgroundPosition: 'center',
34
+ minHeight: 280
35
+ }
36
+ });