@mui/codemod 6.0.0-alpha.1 → 6.0.0-alpha.4

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 (56) hide show
  1. package/README.md +153 -2
  2. package/node/deprecations/accordion-props/accordion-props.js +11 -71
  3. package/node/deprecations/accordion-props/test-cases/actual.js +16 -0
  4. package/node/deprecations/accordion-props/test-cases/expected.js +14 -0
  5. package/node/deprecations/accordion-props/test-cases/theme.actual.js +24 -0
  6. package/node/deprecations/accordion-props/test-cases/theme.expected.js +24 -0
  7. package/node/deprecations/all/deprecations-all.js +4 -0
  8. package/node/deprecations/all/postcss.config.js +7 -1
  9. package/node/deprecations/avatar-props/avatar-props.js +5 -39
  10. package/node/deprecations/avatar-props/test-cases/actual.js +10 -0
  11. package/node/deprecations/avatar-props/test-cases/expected.js +10 -0
  12. package/node/deprecations/avatar-props/test-cases/theme.actual.js +14 -0
  13. package/node/deprecations/avatar-props/test-cases/theme.expected.js +15 -0
  14. package/node/deprecations/backdrop-props/backdrop-props.js +5 -61
  15. package/node/deprecations/backdrop-props/test-cases/actual.js +8 -7
  16. package/node/deprecations/backdrop-props/test-cases/expected.js +7 -7
  17. package/node/deprecations/backdrop-props/test-cases/theme.actual.js +11 -0
  18. package/node/deprecations/backdrop-props/test-cases/theme.expected.js +12 -2
  19. package/node/deprecations/step-connector-classes/index.js +13 -0
  20. package/node/deprecations/step-connector-classes/postcss-plugin.js +33 -0
  21. package/node/deprecations/step-connector-classes/postcss.config.js +8 -0
  22. package/node/deprecations/step-connector-classes/step-connector-classes.js +77 -0
  23. package/node/deprecations/step-connector-classes/test-cases/actual.js +7 -0
  24. package/node/deprecations/step-connector-classes/test-cases/expected.js +7 -0
  25. package/node/deprecations/step-label-props/step-label-props.js +14 -0
  26. package/node/deprecations/step-label-props/test-cases/actual.js +23 -0
  27. package/node/deprecations/step-label-props/test-cases/expected.js +24 -0
  28. package/node/deprecations/step-label-props/test-cases/theme.actual.js +22 -0
  29. package/node/deprecations/step-label-props/test-cases/theme.expected.js +25 -0
  30. package/node/deprecations/toggle-button-group-classes/index.js +13 -0
  31. package/node/deprecations/toggle-button-group-classes/postcss-plugin.js +33 -0
  32. package/node/deprecations/toggle-button-group-classes/postcss.config.js +8 -0
  33. package/node/deprecations/toggle-button-group-classes/test-cases/actual.js +7 -0
  34. package/node/deprecations/toggle-button-group-classes/test-cases/expected.js +7 -0
  35. package/node/deprecations/toggle-button-group-classes/toggle-button-group-classes.js +77 -0
  36. package/node/deprecations/utils/movePropIntoSlotProps.js +111 -0
  37. package/node/deprecations/utils/movePropIntoSlots.js +101 -0
  38. package/node/v5.0.0/base-remove-unstyled-suffix.js +4 -4
  39. package/node/v5.0.0/styled-engine-provider.test/theme-provider.expected.js +3 -3
  40. package/node/v6.0.0/styled/index.js +13 -0
  41. package/node/v6.0.0/styled/styled-v6.js +493 -0
  42. package/node/v6.0.0/styled/test-cases/BasicStyled.actual.js +78 -0
  43. package/node/v6.0.0/styled/test-cases/BasicStyled.expected.js +144 -0
  44. package/node/v6.0.0/styled/test-cases/ConditionalStyled.actual.js +115 -0
  45. package/node/v6.0.0/styled/test-cases/ConditionalStyled.expected.js +206 -0
  46. package/node/v6.0.0/styled/test-cases/LogicalStyled.actual.js +28 -0
  47. package/node/v6.0.0/styled/test-cases/LogicalStyled.expected.js +52 -0
  48. package/node/v6.0.0/styled/test-cases/NestedSpread.actual.js +42 -0
  49. package/node/v6.0.0/styled/test-cases/NestedSpread.expected.js +85 -0
  50. package/node/v6.0.0/styled/test-cases/ObjectMap.actual.js +36 -0
  51. package/node/v6.0.0/styled/test-cases/ObjectMap.expected.js +109 -0
  52. package/node/v6.0.0/styled/test-cases/ThemePaletteMode.actual.js +62 -0
  53. package/node/v6.0.0/styled/test-cases/ThemePaletteMode.expected.js +76 -0
  54. package/node/v6.0.0/styled/test-cases/VariantAndModeStyled.actual.js +11 -0
  55. package/node/v6.0.0/styled/test-cases/VariantAndModeStyled.expected.js +19 -0
  56. package/package.json +3 -3
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
5
+ const Component = styled('div')(({
6
+ theme
7
+ }) => {
8
+ var _palette;
9
+ const palette = (_palette = (theme.vars || theme).palette) == null ? void 0 : _palette[ownerState.color];
10
+ return {
11
+ // Explicitly set the default value to solve a bug on IE11.
12
+ overflow: 'visible',
13
+ color: (theme.vars || theme).palette.action.active,
14
+ transition: theme.transitions.create('background-color', {
15
+ duration: theme.transitions.duration.shortest
16
+ }),
17
+ variants: [{
18
+ props: ({
19
+ ownerState
20
+ }) => !ownerState.disableRipple,
21
+ style: {
22
+ '&:hover': {
23
+ backgroundColor: theme.vars ? `rgba(${theme.vars.palette.action.activeChannel} / ${theme.vars.palette.action.hoverOpacity})` : alpha(theme.palette.action.active, theme.palette.action.hoverOpacity),
24
+ // Reset on touch devices, it doesn't add specificity
25
+ '@media (hover: none)': {
26
+ backgroundColor: 'transparent'
27
+ }
28
+ }
29
+ }
30
+ }, {
31
+ props: {
32
+ edge: 'start',
33
+ size: 'small'
34
+ },
35
+ style: {
36
+ marginLeft: -3
37
+ }
38
+ }, {
39
+ props: ({
40
+ edge,
41
+ ownerState
42
+ }) => edge === 'start' && ownerState.size !== 'small',
43
+ style: {
44
+ marginLeft: -12
45
+ }
46
+ }, {
47
+ props: {
48
+ edge: 'end',
49
+ size: 'small'
50
+ },
51
+ style: {
52
+ marginRight: -3
53
+ }
54
+ }, {
55
+ props: ({
56
+ edge,
57
+ ownerState
58
+ }) => edge === 'end' && ownerState.size !== 'small',
59
+ style: {
60
+ marginRight: -12
61
+ }
62
+ }, {
63
+ props: ({
64
+ ownerState
65
+ }) => ownerState.color !== 'inherit' && ownerState.color !== 'default',
66
+ style: {
67
+ color: palette == null ? void 0 : palette.main
68
+ }
69
+ }, {
70
+ props: ({
71
+ ownerState
72
+ }) => ownerState.color !== 'inherit' && ownerState.color !== 'default' && !ownerState.disableRipple,
73
+ style: {
74
+ '&:hover': (0, _extends2.default)({}, palette && {
75
+ backgroundColor: theme.vars ? `rgba(${palette.mainChannel} / ${theme.vars.palette.action.hoverOpacity})` : alpha(palette.main, theme.palette.action.hoverOpacity)
76
+ }, {
77
+ // Reset on touch devices, it doesn't add specificity
78
+ '@media (hover: none)': {
79
+ backgroundColor: 'transparent'
80
+ }
81
+ })
82
+ }
83
+ }]
84
+ };
85
+ });
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+
3
+ const IconRoot = styled('span')(({
4
+ theme,
5
+ ownerState
6
+ }) => ({
7
+ userSelect: 'none',
8
+ width: '1em',
9
+ height: '1em',
10
+ // Chrome fix for https://bugs.chromium.org/p/chromium/issues/detail?id=820541
11
+ // To remove at some point.
12
+ overflow: 'hidden',
13
+ display: 'inline-block',
14
+ // allow overflow hidden to take action
15
+ textAlign: 'center',
16
+ // support non-square icon
17
+ flexShrink: 0,
18
+ fontSize: {
19
+ inherit: 'inherit',
20
+ small: theme.typography.pxToRem(20),
21
+ medium: theme.typography.pxToRem(24),
22
+ large: theme.typography.pxToRem(36)
23
+ }[ownerState.fontSize],
24
+ // TODO v5 deprecate, v6 remove for sx
25
+ color: {
26
+ primary: (theme.vars || theme).palette.primary.main,
27
+ secondary: (theme.vars || theme).palette.secondary.main,
28
+ info: (theme.vars || theme).palette.info.main,
29
+ success: (theme.vars || theme).palette.success.main,
30
+ warning: (theme.vars || theme).palette.warning.main,
31
+ action: (theme.vars || theme).palette.action.active,
32
+ error: (theme.vars || theme).palette.error.main,
33
+ disabled: (theme.vars || theme).palette.action.disabled,
34
+ inherit: undefined
35
+ }[ownerState.color]
36
+ }));
@@ -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,76 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
5
+ const Test = styled('div')(({
6
+ theme
7
+ }) => (0, _extends2.default)({
8
+ color: theme.palette.primary.main,
9
+ background: `linear-gradient(45deg, ${theme.palette.primary[600]} 30%, ${theme.palette.primary[500]} 90%})`
10
+ }, theme.applyStyles("dark", {
11
+ color: theme.palette.primary.light,
12
+ background: `linear-gradient(45deg, ${theme.palette.primary[400]} 30%, ${theme.palette.primary[200]} 90%})`
13
+ })));
14
+ const StyledPopper = styled(Popper)(({
15
+ theme
16
+ }) => (0, _extends2.default)({
17
+ border: `1px solid ${'#30363d'}`,
18
+ boxShadow: `0 8px 24px ${'rgb(1, 4, 9)'}`,
19
+ borderRadius: 6,
20
+ width: 300,
21
+ zIndex: theme.zIndex.modal,
22
+ fontSize: 13,
23
+ color: '#c9d1d9',
24
+ backgroundColor: '#1c2128'
25
+ }, theme.applyStyles("light", {
26
+ border: `1px solid ${'#e1e4e8'}`,
27
+ boxShadow: `0 8px 24px ${'rgba(149, 157, 165, 0.2)'}`,
28
+ color: '#24292e',
29
+ backgroundColor: '#fff'
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': (0, _extends2.default)({
52
+ opacity: 1,
53
+ backgroundColor: '#1890ff'
54
+ }, theme.applyStyles("dark", {
55
+ backgroundColor: '#177ddc'
56
+ }))
57
+ }
58
+ },
59
+ '& .MuiSwitch-thumb': {
60
+ boxShadow: '0 2px 4px 0 rgb(0 35 11 / 20%)',
61
+ width: 12,
62
+ height: 12,
63
+ borderRadius: 6,
64
+ transition: theme.transitions.create(['width'], {
65
+ duration: 200
66
+ })
67
+ },
68
+ '& .MuiSwitch-track': (0, _extends2.default)({
69
+ borderRadius: 16 / 2,
70
+ opacity: 1,
71
+ backgroundColor: 'rgba(0,0,0,.25)',
72
+ boxSizing: 'border-box'
73
+ }, theme.applyStyles("dark", {
74
+ backgroundColor: 'rgba(255,255,255,.35)'
75
+ }))
76
+ }));
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
5
+ const Component = styled.div(({
6
+ theme,
7
+ ownerState
8
+ }) => (0, _extends2.default)({}, theme.typography.caption, 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
+ }));
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
5
+ const Component = styled.div(({
6
+ theme
7
+ }) => (0, _extends2.default)({}, theme.typography.caption, {
8
+ variants: [{
9
+ props: {
10
+ size: 'small'
11
+ },
12
+ style: (0, _extends2.default)({
13
+ marginTop: (theme.vars || theme).spacing(1),
14
+ color: theme.palette.primary.main
15
+ }, theme.applyStyles("dark", {
16
+ color: theme.palette.primary.light
17
+ }))
18
+ }]
19
+ }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/codemod",
3
- "version": "6.0.0-alpha.1",
3
+ "version": "6.0.0-alpha.4",
4
4
  "bin": "./codemod.js",
5
5
  "private": false,
6
6
  "author": "MUI Team",
@@ -27,7 +27,7 @@
27
27
  "@babel/core": "^7.24.4",
28
28
  "@babel/runtime": "^7.24.4",
29
29
  "@babel/traverse": "^7.24.1",
30
- "jscodeshift": "^0.13.1",
30
+ "jscodeshift": "^0.15.2",
31
31
  "jscodeshift-add-imports": "^1.0.10",
32
32
  "postcss": "^8.4.38",
33
33
  "postcss-cli": "^8.3.1",
@@ -35,7 +35,7 @@
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/chai": "^4.3.14",
38
- "@types/jscodeshift": "0.11.5",
38
+ "@types/jscodeshift": "0.11.11",
39
39
  "chai": "^4.4.1"
40
40
  },
41
41
  "sideEffects": false,