@mui/codemod 6.4.3 → 7.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1612,6 +1612,27 @@ npx @mui/codemod@latest deprecations/select-classes <path>
1612
1612
  npx @mui/codemod@latest deprecations/slider-props <path>
1613
1613
  ```
1614
1614
 
1615
+ #### `snackbar-props`
1616
+
1617
+ ```diff
1618
+ <Snackbar
1619
+ - ClickAwayListenerProps={CustomClickAwayListenerProps}
1620
+ - ContentProps={CustomContentProps}
1621
+ - TransitionComponent={CustomTransition}
1622
+ - TransitionProps={CustomTransitionProps}
1623
+ + slots={{ transition: CustomTransition }}
1624
+ + slotProps={{
1625
+ + clickAwayListener: CustomClickAwayListenerProps,
1626
+ + content: CustomContentProps,
1627
+ + transition: CustomTransitionProps
1628
+ + }}
1629
+ />
1630
+ ```
1631
+
1632
+ ```bash
1633
+ npx @mui/codemod@next deprecations/snackbar-props <path>
1634
+ ```
1635
+
1615
1636
  #### `tooltip-props`
1616
1637
 
1617
1638
  ```diff
@@ -40,6 +40,8 @@ var _toggleButtonGroupClasses = _interopRequireDefault(require("../toggle-button
40
40
  var _tooltipProps = _interopRequireDefault(require("../tooltip-props"));
41
41
  var _tablePaginationProps = _interopRequireDefault(require("../table-pagination-props"));
42
42
  var _cardHeaderProps = _interopRequireDefault(require("../card-header-props"));
43
+ var _popoverProps = _interopRequireDefault(require("../popover-props"));
44
+ var _snackbarProps = _interopRequireDefault(require("../snackbar-props"));
43
45
  /**
44
46
  * @param {import('jscodeshift').FileInfo} file
45
47
  * @param {import('jscodeshift').API} api
@@ -80,5 +82,7 @@ function deprecationsAll(file, api, options) {
80
82
  file.source = (0, _tooltipProps.default)(file, api, options);
81
83
  file.source = (0, _tablePaginationProps.default)(file, api, options);
82
84
  file.source = (0, _cardHeaderProps.default)(file, api, options);
85
+ file.source = (0, _popoverProps.default)(file, api, options);
86
+ file.source = (0, _snackbarProps.default)(file, api, options);
83
87
  return file.source;
84
88
  }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ Object.defineProperty(exports, "default", {
8
+ enumerable: true,
9
+ get: function () {
10
+ return _popoverProps.default;
11
+ }
12
+ });
13
+ var _popoverProps = _interopRequireDefault(require("./popover-props"));
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = transformer;
8
+ var _movePropIntoSlots = _interopRequireDefault(require("../utils/movePropIntoSlots"));
9
+ var _movePropIntoSlotProps = _interopRequireDefault(require("../utils/movePropIntoSlotProps"));
10
+ /**
11
+ * @param {import('jscodeshift').FileInfo} file
12
+ * @param {import('jscodeshift').API} api
13
+ */
14
+ function transformer(file, api, options) {
15
+ const j = api.jscodeshift;
16
+ const root = j(file.source);
17
+ const printOptions = options.printOptions;
18
+ (0, _movePropIntoSlots.default)(j, {
19
+ root,
20
+ componentName: 'Popover',
21
+ propName: 'BackdropComponent',
22
+ slotName: 'backdrop'
23
+ });
24
+ (0, _movePropIntoSlotProps.default)(j, {
25
+ root,
26
+ componentName: 'Popover',
27
+ propName: 'BackdropProps',
28
+ slotName: 'backdrop'
29
+ });
30
+ (0, _movePropIntoSlotProps.default)(j, {
31
+ root,
32
+ componentName: 'Popover',
33
+ propName: 'PaperProps',
34
+ slotName: 'paper'
35
+ });
36
+ (0, _movePropIntoSlots.default)(j, {
37
+ root,
38
+ componentName: 'Popover',
39
+ propName: 'TransitionComponent',
40
+ slotName: 'transition'
41
+ });
42
+ (0, _movePropIntoSlotProps.default)(j, {
43
+ root,
44
+ componentName: 'Popover',
45
+ propName: 'TransitionProps',
46
+ slotName: 'transition'
47
+ });
48
+ return root.toSource(printOptions);
49
+ }
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ var _Popover = _interopRequireDefault(require("@mui/material/Popover"));
5
+ var _material = require("@mui/material");
6
+ var _jsxRuntime = require("react/jsx-runtime");
7
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Popover.default, {
8
+ BackdropComponent: CustomBackdrop,
9
+ BackdropProps: {
10
+ timeout: 200
11
+ },
12
+ PaperProps: {
13
+ elevation: 4
14
+ },
15
+ TransitionComponent: CustomTransition,
16
+ TransitionProps: {
17
+ timeout: 200
18
+ }
19
+ });
20
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Popover.default, {
21
+ BackdropComponent: CustomBackdrop,
22
+ BackdropProps: {
23
+ timeout: 200
24
+ },
25
+ PaperProps: {
26
+ elevation: 4
27
+ },
28
+ TransitionComponent: CustomTransition,
29
+ TransitionProps: {
30
+ timeout: 200
31
+ },
32
+ slotProps: {
33
+ backdrop: {
34
+ sx: {
35
+ backgroundColor: 'red'
36
+ }
37
+ },
38
+ paper: {
39
+ sx: {
40
+ backgroundColor: 'blue'
41
+ }
42
+ },
43
+ transition: {
44
+ onEnter: () => {}
45
+ }
46
+ }
47
+ });
48
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Popover, {
49
+ BackdropComponent: CustomBackdrop,
50
+ BackdropProps: {
51
+ timeout: 200
52
+ },
53
+ PaperProps: {
54
+ elevation: 4
55
+ },
56
+ TransitionComponent: CustomTransition,
57
+ TransitionProps: {
58
+ timeout: 200
59
+ }
60
+ });
61
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(CustomPopover, {
62
+ BackdropComponent: CustomBackdrop,
63
+ BackdropProps: {
64
+ timeout: 200
65
+ },
66
+ PaperProps: {
67
+ elevation: 4
68
+ },
69
+ TransitionComponent: CustomTransition,
70
+ TransitionProps: {
71
+ timeout: 200
72
+ }
73
+ });
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ var _Popover = _interopRequireDefault(require("@mui/material/Popover"));
5
+ var _material = require("@mui/material");
6
+ var _jsxRuntime = require("react/jsx-runtime");
7
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Popover.default, {
8
+ slots: {
9
+ backdrop: CustomBackdrop,
10
+ transition: CustomTransition
11
+ },
12
+ slotProps: {
13
+ backdrop: {
14
+ timeout: 200
15
+ },
16
+ paper: {
17
+ elevation: 4
18
+ },
19
+ transition: {
20
+ timeout: 200
21
+ }
22
+ }
23
+ });
24
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Popover.default, {
25
+ slotProps: {
26
+ backdrop: {
27
+ ...{
28
+ timeout: 200
29
+ },
30
+ ...{
31
+ sx: {
32
+ backgroundColor: 'red'
33
+ }
34
+ }
35
+ },
36
+ paper: {
37
+ ...{
38
+ elevation: 4
39
+ },
40
+ ...{
41
+ sx: {
42
+ backgroundColor: 'blue'
43
+ }
44
+ }
45
+ },
46
+ transition: {
47
+ ...{
48
+ timeout: 200
49
+ },
50
+ ...{
51
+ onEnter: () => {}
52
+ }
53
+ }
54
+ },
55
+ slots: {
56
+ backdrop: CustomBackdrop,
57
+ transition: CustomTransition
58
+ }
59
+ });
60
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Popover, {
61
+ slots: {
62
+ backdrop: CustomBackdrop,
63
+ transition: CustomTransition
64
+ },
65
+ slotProps: {
66
+ backdrop: {
67
+ timeout: 200
68
+ },
69
+ paper: {
70
+ elevation: 4
71
+ },
72
+ transition: {
73
+ timeout: 200
74
+ }
75
+ }
76
+ });
77
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(CustomPopover, {
78
+ BackdropComponent: CustomBackdrop,
79
+ BackdropProps: {
80
+ timeout: 200
81
+ },
82
+ PaperProps: {
83
+ elevation: 4
84
+ },
85
+ TransitionComponent: CustomTransition,
86
+ TransitionProps: {
87
+ timeout: 200
88
+ }
89
+ });
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ fn({
4
+ MuiPopover: {
5
+ defaultProps: {
6
+ BackdropComponent: 'div',
7
+ BackdropProps: {
8
+ timeout: 200
9
+ },
10
+ PaperProps: {
11
+ elevation: 8
12
+ },
13
+ TransitionComponent: 'em',
14
+ TransitionProps: {
15
+ timeout: 200
16
+ }
17
+ }
18
+ }
19
+ });
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ fn({
4
+ MuiPopover: {
5
+ defaultProps: {
6
+ slots: {
7
+ backdrop: 'div',
8
+ transition: 'em'
9
+ },
10
+ slotProps: {
11
+ backdrop: {
12
+ timeout: 200
13
+ },
14
+ paper: {
15
+ elevation: 8
16
+ },
17
+ transition: {
18
+ timeout: 200
19
+ }
20
+ }
21
+ }
22
+ }
23
+ });
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ Object.defineProperty(exports, "default", {
8
+ enumerable: true,
9
+ get: function () {
10
+ return _snackbarProps.default;
11
+ }
12
+ });
13
+ var _snackbarProps = _interopRequireDefault(require("./snackbar-props"));
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = transformer;
8
+ var _movePropIntoSlots = _interopRequireDefault(require("../utils/movePropIntoSlots"));
9
+ var _movePropIntoSlotProps = _interopRequireDefault(require("../utils/movePropIntoSlotProps"));
10
+ /**
11
+ * @param {import('jscodeshift').FileInfo} file
12
+ * @param {import('jscodeshift').API} api
13
+ */
14
+ function transformer(file, api, options) {
15
+ const j = api.jscodeshift;
16
+ const root = j(file.source);
17
+ const printOptions = options.printOptions;
18
+ (0, _movePropIntoSlots.default)(j, {
19
+ root,
20
+ componentName: 'Snackbar',
21
+ propName: 'TransitionComponent',
22
+ slotName: 'transition'
23
+ });
24
+ (0, _movePropIntoSlotProps.default)(j, {
25
+ root,
26
+ componentName: 'Snackbar',
27
+ propName: 'TransitionProps',
28
+ slotName: 'transition'
29
+ });
30
+ (0, _movePropIntoSlotProps.default)(j, {
31
+ root,
32
+ componentName: 'Snackbar',
33
+ propName: 'ContentProps',
34
+ slotName: 'content'
35
+ });
36
+ (0, _movePropIntoSlotProps.default)(j, {
37
+ root,
38
+ componentName: 'Snackbar',
39
+ propName: 'ClickAwayListenerProps',
40
+ slotName: 'clickAwayListener'
41
+ });
42
+ return root.toSource(printOptions);
43
+ }
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ var _Snackbar = _interopRequireDefault(require("@mui/material/Snackbar"));
5
+ var _material = require("@mui/material");
6
+ var _jsxRuntime = require("react/jsx-runtime");
7
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Snackbar.default, {
8
+ ClickAwayListenerProps: CustomListenerProps,
9
+ ContentProps: CustomContentProps,
10
+ TransitionComponent: CustomTransition,
11
+ TransitionProps: CustomTransitionProps
12
+ });
13
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Snackbar, {
14
+ ClickAwayListenerProps: CustomListenerProps,
15
+ ContentProps: CustomContentProps,
16
+ TransitionComponent: CustomTransition,
17
+ TransitionProps: CustomTransitionProps
18
+ });
19
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Snackbar.default, {
20
+ ClickAwayListenerProps: CustomListenerProps,
21
+ ContentProps: CustomContentProps,
22
+ TransitionComponent: CustomTransition,
23
+ TransitionProps: CustomTransitionProps,
24
+ slots: {
25
+ root: 'div'
26
+ }
27
+ });
28
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Snackbar, {
29
+ ClickAwayListenerProps: CustomListenerProps,
30
+ ContentProps: CustomContentProps,
31
+ TransitionComponent: CustomTransition,
32
+ TransitionProps: CustomTransitionProps,
33
+ slots: {
34
+ ...outerSlots
35
+ }
36
+ });
37
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Snackbar.default, {
38
+ ClickAwayListenerProps: CustomListenerProps,
39
+ ContentProps: CustomContentProps,
40
+ TransitionComponent: ComponentTransition,
41
+ TransitionProps: CustomTransitionProps,
42
+ slots: {
43
+ root: 'div',
44
+ transition: SlotTransition
45
+ }
46
+ });
47
+
48
+ // should skip non MUI components
49
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(NonMuiSnackbar, {
50
+ ClickAwayListenerProps: CustomListenerProps,
51
+ ContentProps: CustomContentProps,
52
+ TransitionComponent: CustomTransition,
53
+ TransitionProps: CustomTransitionProps
54
+ });
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ var _Snackbar = _interopRequireDefault(require("@mui/material/Snackbar"));
5
+ var _material = require("@mui/material");
6
+ var _jsxRuntime = require("react/jsx-runtime");
7
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Snackbar.default, {
8
+ slots: {
9
+ transition: CustomTransition
10
+ },
11
+ slotProps: {
12
+ transition: CustomTransitionProps,
13
+ content: CustomContentProps,
14
+ clickAwayListener: CustomListenerProps
15
+ }
16
+ });
17
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Snackbar, {
18
+ slots: {
19
+ transition: CustomTransition
20
+ },
21
+ slotProps: {
22
+ transition: CustomTransitionProps,
23
+ content: CustomContentProps,
24
+ clickAwayListener: CustomListenerProps
25
+ }
26
+ });
27
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Snackbar.default, {
28
+ slots: {
29
+ root: 'div',
30
+ transition: CustomTransition
31
+ },
32
+ slotProps: {
33
+ transition: CustomTransitionProps,
34
+ content: CustomContentProps,
35
+ clickAwayListener: CustomListenerProps
36
+ }
37
+ });
38
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Snackbar, {
39
+ slots: {
40
+ ...outerSlots,
41
+ transition: CustomTransition
42
+ },
43
+ slotProps: {
44
+ transition: CustomTransitionProps,
45
+ content: CustomContentProps,
46
+ clickAwayListener: CustomListenerProps
47
+ }
48
+ });
49
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Snackbar.default, {
50
+ slots: {
51
+ root: 'div',
52
+ transition: SlotTransition
53
+ },
54
+ slotProps: {
55
+ transition: CustomTransitionProps,
56
+ content: CustomContentProps,
57
+ clickAwayListener: CustomListenerProps
58
+ }
59
+ });
60
+
61
+ // should skip non MUI components
62
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(NonMuiSnackbar, {
63
+ ClickAwayListenerProps: CustomListenerProps,
64
+ ContentProps: CustomContentProps,
65
+ TransitionComponent: CustomTransition,
66
+ TransitionProps: CustomTransitionProps
67
+ });
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ fn({
4
+ MuiSnackbar: {
5
+ defaultProps: {
6
+ ClickAwayListenerProps: CustomListenerProps,
7
+ ContentProps: CustomContentProps,
8
+ TransitionComponent: CustomTransition,
9
+ TransitionProps: CustomTransitionProps
10
+ }
11
+ }
12
+ });
13
+ fn({
14
+ MuiSnackbar: {
15
+ defaultProps: {
16
+ ClickAwayListenerProps: CustomListenerProps,
17
+ ContentProps: CustomContentProps,
18
+ TransitionComponent: CustomTransition,
19
+ TransitionProps: CustomTransitionProps,
20
+ slots: {
21
+ root: 'div'
22
+ }
23
+ }
24
+ }
25
+ });
26
+ fn({
27
+ MuiSnackbar: {
28
+ defaultProps: {
29
+ ClickAwayListenerProps: CustomListenerProps,
30
+ ContentProps: CustomContentProps,
31
+ TransitionComponent: ComponentTransition,
32
+ TransitionProps: CustomTransitionProps,
33
+ slots: {
34
+ root: 'div',
35
+ transition: SlotTransition
36
+ }
37
+ }
38
+ }
39
+ });
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+
3
+ fn({
4
+ MuiSnackbar: {
5
+ defaultProps: {
6
+ slots: {
7
+ transition: CustomTransition
8
+ },
9
+ slotProps: {
10
+ transition: CustomTransitionProps,
11
+ content: CustomContentProps,
12
+ clickAwayListener: CustomListenerProps
13
+ }
14
+ }
15
+ }
16
+ });
17
+ fn({
18
+ MuiSnackbar: {
19
+ defaultProps: {
20
+ slots: {
21
+ root: 'div',
22
+ transition: CustomTransition
23
+ },
24
+ slotProps: {
25
+ transition: CustomTransitionProps,
26
+ content: CustomContentProps,
27
+ clickAwayListener: CustomListenerProps
28
+ }
29
+ }
30
+ }
31
+ });
32
+ fn({
33
+ MuiSnackbar: {
34
+ defaultProps: {
35
+ slots: {
36
+ root: 'div',
37
+ transition: SlotTransition
38
+ },
39
+ slotProps: {
40
+ transition: CustomTransitionProps,
41
+ content: CustomContentProps,
42
+ clickAwayListener: CustomListenerProps
43
+ }
44
+ }
45
+ }
46
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/codemod",
3
- "version": "6.4.3",
3
+ "version": "7.0.0-alpha.0",
4
4
  "bin": "./codemod.js",
5
5
  "private": false,
6
6
  "author": "MUI Team",
@@ -24,9 +24,9 @@
24
24
  "url": "https://opencollective.com/mui-org"
25
25
  },
26
26
  "dependencies": {
27
- "@babel/core": "^7.26.0",
28
- "@babel/runtime": "^7.26.0",
29
- "@babel/traverse": "^7.26.5",
27
+ "@babel/core": "^7.26.7",
28
+ "@babel/runtime": "^7.26.7",
29
+ "@babel/traverse": "^7.26.7",
30
30
  "jscodeshift": "^17.1.2",
31
31
  "jscodeshift-add-imports": "^1.0.11",
32
32
  "postcss": "^8.4.49",