@mui/codemod 6.4.11 → 6.5.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 +22 -0
- package/node/deprecations/all/deprecations-all.js +2 -0
- package/node/deprecations/dialog-props/dialog-props.js +40 -0
- package/node/deprecations/dialog-props/index.js +13 -0
- package/node/deprecations/dialog-props/test-cases/actual.js +47 -0
- package/node/deprecations/dialog-props/test-cases/expected.js +60 -0
- package/node/deprecations/dialog-props/test-cases/theme.actual.js +36 -0
- package/node/deprecations/dialog-props/test-cases/theme.expected.js +43 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1066,6 +1066,28 @@ CSS transforms:
|
|
|
1066
1066
|
npx @mui/codemod@latest deprecations/dialog-classes <path>
|
|
1067
1067
|
```
|
|
1068
1068
|
|
|
1069
|
+
#### `dialog-props`
|
|
1070
|
+
|
|
1071
|
+
JS transforms:
|
|
1072
|
+
|
|
1073
|
+
```diff
|
|
1074
|
+
<Dialog
|
|
1075
|
+
- PaperProps={paperProps}
|
|
1076
|
+
+ slotProps={{ paper: paperProps }}
|
|
1077
|
+
- TransitionComponent={CustomTransition}
|
|
1078
|
+
+ slots={{ transition: CustomTransition }}
|
|
1079
|
+
- TransitionProps={CustomTransitionProps}
|
|
1080
|
+
+ slotProps={{ transition: CustomTransitionProps }}
|
|
1081
|
+
/>
|
|
1082
|
+
},
|
|
1083
|
+
},
|
|
1084
|
+
},
|
|
1085
|
+
```
|
|
1086
|
+
|
|
1087
|
+
```bash
|
|
1088
|
+
npx @mui/codemod@latest deprecations/dialog-props <path>
|
|
1089
|
+
```
|
|
1090
|
+
|
|
1069
1091
|
#### `drawer-classes`
|
|
1070
1092
|
|
|
1071
1093
|
JS transforms:
|
|
@@ -20,6 +20,7 @@ var _circularProgressClasses = _interopRequireDefault(require("../circular-progr
|
|
|
20
20
|
var _dividerProps = _interopRequireDefault(require("../divider-props"));
|
|
21
21
|
var _drawerClasses = _interopRequireDefault(require("../drawer-classes"));
|
|
22
22
|
var _dialogClasses = _interopRequireDefault(require("../dialog-classes"));
|
|
23
|
+
var _dialogProps = _interopRequireDefault(require("../dialog-props"));
|
|
23
24
|
var _filledInputProps = _interopRequireDefault(require("../filled-input-props"));
|
|
24
25
|
var _formControlLabelProps = _interopRequireDefault(require("../form-control-label-props"));
|
|
25
26
|
var _imageListItemBarClasses = _interopRequireDefault(require("../image-list-item-bar-classes"));
|
|
@@ -76,6 +77,7 @@ function deprecationsAll(file, api, options) {
|
|
|
76
77
|
file.source = (0, _dividerProps.default)(file, api, options);
|
|
77
78
|
file.source = (0, _drawerClasses.default)(file, api, options);
|
|
78
79
|
file.source = (0, _dialogClasses.default)(file, api, options);
|
|
80
|
+
file.source = (0, _dialogProps.default)(file, api, options);
|
|
79
81
|
file.source = (0, _filledInputProps.default)(file, api, options);
|
|
80
82
|
file.source = (0, _formControlLabelProps.default)(file, api, options);
|
|
81
83
|
file.source = (0, _imageListItemBarClasses.default)(file, api, options);
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
packageName: options.packageName,
|
|
21
|
+
componentName: 'Dialog',
|
|
22
|
+
propName: 'TransitionComponent',
|
|
23
|
+
slotName: 'transition'
|
|
24
|
+
});
|
|
25
|
+
(0, _movePropIntoSlotProps.default)(j, {
|
|
26
|
+
root,
|
|
27
|
+
packageName: options.packageName,
|
|
28
|
+
componentName: 'Dialog',
|
|
29
|
+
propName: 'TransitionProps',
|
|
30
|
+
slotName: 'transition'
|
|
31
|
+
});
|
|
32
|
+
(0, _movePropIntoSlotProps.default)(j, {
|
|
33
|
+
root,
|
|
34
|
+
packageName: options.packageName,
|
|
35
|
+
componentName: 'Dialog',
|
|
36
|
+
propName: 'PaperProps',
|
|
37
|
+
slotName: 'paper'
|
|
38
|
+
});
|
|
39
|
+
return root.toSource(printOptions);
|
|
40
|
+
}
|
|
@@ -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 _dialogProps.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
var _dialogProps = _interopRequireDefault(require("./dialog-props"));
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _Dialog = _interopRequireDefault(require("@mui/material/Dialog"));
|
|
5
|
+
var _material = require("@mui/material");
|
|
6
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
7
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Dialog.default, {
|
|
8
|
+
TransitionComponent: CustomTransition,
|
|
9
|
+
TransitionProps: CustomTransitionProps,
|
|
10
|
+
PaperProps: PaperProps
|
|
11
|
+
});
|
|
12
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Dialog, {
|
|
13
|
+
TransitionComponent: CustomTransition,
|
|
14
|
+
TransitionProps: CustomTransitionProps,
|
|
15
|
+
PaperProps: PaperProps
|
|
16
|
+
});
|
|
17
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Dialog.default, {
|
|
18
|
+
TransitionComponent: CustomTransition,
|
|
19
|
+
TransitionProps: CustomTransitionProps,
|
|
20
|
+
slots: {
|
|
21
|
+
root: 'div'
|
|
22
|
+
},
|
|
23
|
+
PaperProps: PaperProps
|
|
24
|
+
});
|
|
25
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Dialog, {
|
|
26
|
+
TransitionComponent: CustomTransition,
|
|
27
|
+
TransitionProps: CustomTransitionProps,
|
|
28
|
+
slots: {
|
|
29
|
+
...outerSlots
|
|
30
|
+
},
|
|
31
|
+
PaperProps: PaperProps
|
|
32
|
+
});
|
|
33
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Dialog.default, {
|
|
34
|
+
TransitionComponent: ComponentTransition,
|
|
35
|
+
TransitionProps: CustomTransitionProps,
|
|
36
|
+
slots: {
|
|
37
|
+
root: 'div',
|
|
38
|
+
transition: SlotTransition
|
|
39
|
+
},
|
|
40
|
+
PaperProps: PaperProps
|
|
41
|
+
});
|
|
42
|
+
// should skip non MUI components
|
|
43
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(NonMuiDialog, {
|
|
44
|
+
TransitionComponent: CustomTransition,
|
|
45
|
+
TransitionProps: CustomTransitionProps,
|
|
46
|
+
PaperProps: PaperProps
|
|
47
|
+
});
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _Dialog = _interopRequireDefault(require("@mui/material/Dialog"));
|
|
5
|
+
var _material = require("@mui/material");
|
|
6
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
7
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Dialog.default, {
|
|
8
|
+
slots: {
|
|
9
|
+
transition: CustomTransition
|
|
10
|
+
},
|
|
11
|
+
slotProps: {
|
|
12
|
+
transition: CustomTransitionProps,
|
|
13
|
+
paper: PaperProps
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Dialog, {
|
|
17
|
+
slots: {
|
|
18
|
+
transition: CustomTransition
|
|
19
|
+
},
|
|
20
|
+
slotProps: {
|
|
21
|
+
transition: CustomTransitionProps,
|
|
22
|
+
paper: PaperProps
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Dialog.default, {
|
|
26
|
+
slots: {
|
|
27
|
+
root: 'div',
|
|
28
|
+
transition: CustomTransition
|
|
29
|
+
},
|
|
30
|
+
slotProps: {
|
|
31
|
+
transition: CustomTransitionProps,
|
|
32
|
+
paper: PaperProps
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Dialog, {
|
|
36
|
+
slots: {
|
|
37
|
+
...outerSlots,
|
|
38
|
+
transition: CustomTransition
|
|
39
|
+
},
|
|
40
|
+
slotProps: {
|
|
41
|
+
transition: CustomTransitionProps,
|
|
42
|
+
paper: PaperProps
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Dialog.default, {
|
|
46
|
+
slots: {
|
|
47
|
+
root: 'div',
|
|
48
|
+
transition: SlotTransition
|
|
49
|
+
},
|
|
50
|
+
slotProps: {
|
|
51
|
+
transition: CustomTransitionProps,
|
|
52
|
+
paper: PaperProps
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
// should skip non MUI components
|
|
56
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(NonMuiDialog, {
|
|
57
|
+
TransitionComponent: CustomTransition,
|
|
58
|
+
TransitionProps: CustomTransitionProps,
|
|
59
|
+
PaperProps: PaperProps
|
|
60
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
fn({
|
|
4
|
+
MuiDialog: {
|
|
5
|
+
defaultProps: {
|
|
6
|
+
TransitionComponent: CustomTransition,
|
|
7
|
+
TransitionProps: CustomTransitionProps,
|
|
8
|
+
PaperProps: PaperProps
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
fn({
|
|
13
|
+
MuiDialog: {
|
|
14
|
+
defaultProps: {
|
|
15
|
+
TransitionComponent: CustomTransition,
|
|
16
|
+
TransitionProps: CustomTransitionProps,
|
|
17
|
+
slots: {
|
|
18
|
+
root: 'div'
|
|
19
|
+
},
|
|
20
|
+
PaperProps: PaperProps
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
fn({
|
|
25
|
+
MuiDialog: {
|
|
26
|
+
defaultProps: {
|
|
27
|
+
TransitionComponent: ComponentTransition,
|
|
28
|
+
TransitionProps: CustomTransitionProps,
|
|
29
|
+
slots: {
|
|
30
|
+
root: 'div',
|
|
31
|
+
transition: SlotTransition
|
|
32
|
+
},
|
|
33
|
+
PaperProps: PaperProps
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
fn({
|
|
4
|
+
MuiDialog: {
|
|
5
|
+
defaultProps: {
|
|
6
|
+
slots: {
|
|
7
|
+
transition: CustomTransition
|
|
8
|
+
},
|
|
9
|
+
slotProps: {
|
|
10
|
+
transition: CustomTransitionProps,
|
|
11
|
+
paper: PaperProps
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
fn({
|
|
17
|
+
MuiDialog: {
|
|
18
|
+
defaultProps: {
|
|
19
|
+
slots: {
|
|
20
|
+
root: 'div',
|
|
21
|
+
transition: CustomTransition
|
|
22
|
+
},
|
|
23
|
+
slotProps: {
|
|
24
|
+
transition: CustomTransitionProps,
|
|
25
|
+
paper: PaperProps
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
fn({
|
|
31
|
+
MuiDialog: {
|
|
32
|
+
defaultProps: {
|
|
33
|
+
slots: {
|
|
34
|
+
root: 'div',
|
|
35
|
+
transition: SlotTransition
|
|
36
|
+
},
|
|
37
|
+
slotProps: {
|
|
38
|
+
transition: CustomTransitionProps,
|
|
39
|
+
paper: PaperProps
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
});
|