@mui/codemod 6.1.7 → 6.1.8

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 (23) hide show
  1. package/README.md +42 -10
  2. package/node/deprecations/all/deprecations-all.js +8 -0
  3. package/node/deprecations/autocomplete-props/autocomplete-props.js +102 -0
  4. package/node/deprecations/autocomplete-props/test-cases/actual.js +38 -0
  5. package/node/deprecations/autocomplete-props/test-cases/expected.js +50 -0
  6. package/node/deprecations/autocomplete-props/test-cases/theme.actual.js +18 -0
  7. package/node/deprecations/autocomplete-props/test-cases/theme.expected.js +26 -0
  8. package/node/deprecations/backdrop-props/backdrop-props.js +7 -0
  9. package/node/deprecations/backdrop-props/test-cases/actual.js +30 -0
  10. package/node/deprecations/backdrop-props/test-cases/expected.js +33 -0
  11. package/node/deprecations/backdrop-props/test-cases/theme.actual.js +28 -0
  12. package/node/deprecations/backdrop-props/test-cases/theme.expected.js +29 -0
  13. package/node/deprecations/step-label-props/step-label-props.js +14 -0
  14. package/node/deprecations/step-label-props/test-cases/actual.js +23 -0
  15. package/node/deprecations/step-label-props/test-cases/expected.js +27 -0
  16. package/node/deprecations/step-label-props/test-cases/theme.actual.js +22 -0
  17. package/node/deprecations/step-label-props/test-cases/theme.expected.js +28 -0
  18. package/node/deprecations/tooltip-props/test-cases/actual.js +49 -0
  19. package/node/deprecations/tooltip-props/test-cases/expected.js +57 -0
  20. package/node/deprecations/tooltip-props/test-cases/theme.actual.js +36 -0
  21. package/node/deprecations/tooltip-props/test-cases/theme.expected.js +40 -0
  22. package/node/deprecations/tooltip-props/tooltip-props.js +26 -0
  23. package/package.json +2 -2
package/README.md CHANGED
@@ -275,12 +275,14 @@ npx @mui/codemod@latest deprecations/alert-props <path>
275
275
  - }}
276
276
  + slots={{
277
277
  + paper: CustomPaper,
278
- + popper: CustomPopper,
279
- + listbox: CustomListbox,
278
+ + popper: CustomPopper
280
279
  + }}
281
280
  + slotProps={{
282
281
  + chip: { height: 10 },
283
- + listbox: { height: 12 },
282
+ + listbox: {
283
+ + component: CustomListbox,
284
+ + ...{ height: 12 },
285
+ + },
284
286
  + clearIndicator: { width: 10 },
285
287
  + paper: { width: 12 },
286
288
  + popper: { width: 14 },
@@ -306,11 +308,13 @@ npx @mui/codemod@latest deprecations/alert-props <path>
306
308
  + slots: {
307
309
  + paper: CustomPaper,
308
310
  + popper: CustomPopper,
309
- + listbox: CustomListbox,
310
311
  + },
311
312
  + slotProps: {
312
313
  + chip: { height: 10 },
313
- + listbox: { height: 12 },
314
+ + listbox: {
315
+ + component: CustomListbox,
316
+ + ...{ height: 12 },
317
+ + },
314
318
  + clearIndicator: { width: 10 },
315
319
  + paper: { width: 12 },
316
320
  + popper: { width: 14 },
@@ -1408,19 +1412,43 @@ npx @mui/codemod@latest deprecations/slider-props <path>
1408
1412
  <Tooltip
1409
1413
  - components={{ Arrow: CustomArrow }}
1410
1414
  - componentsProps={{ arrow: { testid: 'test-id' } }}
1411
- + slots={{ arrow: CustomArrow }}
1412
- + slotProps={{ arrow: { testid: 'test-id' } }}
1415
+ - PopperComponent={CustomPopperComponent}
1416
+ - TransitionComponent={CustomTransitionComponent}
1417
+ - PopperProps={CustomPopperProps}
1418
+ - TransitionProps={CustomTransitionProps}
1419
+ + slots={{
1420
+ + arrow: CustomArrow,
1421
+ + popper: CustomPopperComponent,
1422
+ + transition: CustomTransitionComponent,
1423
+ + }}
1424
+ + slotProps={{
1425
+ + arrow: { testid: 'test-id' },
1426
+ + popper: CustomPopperProps,
1427
+ + transition: CustomTransitionProps,
1428
+ + }}
1413
1429
  />
1414
1430
  ```
1415
1431
 
1416
1432
  ```diff
1417
1433
  MuiTooltip: {
1418
1434
  defaultProps: {
1435
+ - PopperComponent: CustomPopperComponent,
1436
+ - TransitionComponent: CustomTransitionComponent,
1437
+ - PopperProps: CustomPopperProps,
1438
+ - TransitionProps: CustomTransitionProps,
1419
1439
  - components: { Arrow: CustomArrow }
1420
- + slots: { arrow: CustomArrow },
1440
+ + slots: {
1441
+ + arrow: CustomArrow,
1442
+ + popper: CustomPopperComponent,
1443
+ + transition: CustomTransitionComponent,
1444
+ + },
1421
1445
  - componentsProps: { arrow: { testid: 'test-id' }}
1422
- + slotProps: { arrow: { testid: 'test-id' } },
1423
- },
1446
+ + slotProps: {
1447
+ + arrow: { testid: 'test-id' },
1448
+ + popper: CustomPopperProps,
1449
+ + transition: CustomTransitionProps,
1450
+ + },
1451
+ },
1424
1452
  },
1425
1453
  ```
1426
1454
 
@@ -1451,6 +1479,10 @@ JS transforms:
1451
1479
  },
1452
1480
  ```
1453
1481
 
1482
+ ```bash
1483
+ npx @mui/codemod@next deprecations/step-connector-classes <path>
1484
+ ```
1485
+
1454
1486
  #### `step-label-props`
1455
1487
 
1456
1488
  ```diff
@@ -6,9 +6,11 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = deprecationsAll;
8
8
  var _accordionSummaryClasses = _interopRequireDefault(require("../accordion-summary-classes"));
9
+ var _accordionProps = _interopRequireDefault(require("../accordion-props"));
9
10
  var _alertClasses = _interopRequireDefault(require("../alert-classes"));
10
11
  var _avatarGroupProps = _interopRequireDefault(require("../avatar-group-props"));
11
12
  var _autocompleteProps = _interopRequireDefault(require("../autocomplete-props"));
13
+ var _avatarProps = _interopRequireDefault(require("../avatar-props"));
12
14
  var _backdropProps = _interopRequireDefault(require("../backdrop-props"));
13
15
  var _buttonClasses = _interopRequireDefault(require("../button-classes"));
14
16
  var _buttonGroupClasses = _interopRequireDefault(require("../button-group-classes"));
@@ -23,21 +25,25 @@ var _inputProps = _interopRequireDefault(require("../input-props"));
23
25
  var _modalProps = _interopRequireDefault(require("../modal-props"));
24
26
  var _outlinedInputProps = _interopRequireDefault(require("../outlined-input-props"));
25
27
  var _paginationItemClasses = _interopRequireDefault(require("../pagination-item-classes"));
28
+ var _speedDialProps = _interopRequireDefault(require("../speed-dial-props"));
26
29
  var _tableSortLabelClasses = _interopRequireDefault(require("../table-sort-label-classes"));
27
30
  var _stepConnectorClasses = _interopRequireDefault(require("../step-connector-classes"));
28
31
  var _stepLabelProps = _interopRequireDefault(require("../step-label-props"));
29
32
  var _textFieldProps = _interopRequireDefault(require("../text-field-props"));
30
33
  var _tabClasses = _interopRequireDefault(require("../tab-classes"));
31
34
  var _toggleButtonGroupClasses = _interopRequireDefault(require("../toggle-button-group-classes"));
35
+ var _tooltipProps = _interopRequireDefault(require("../tooltip-props"));
32
36
  /**
33
37
  * @param {import('jscodeshift').FileInfo} file
34
38
  * @param {import('jscodeshift').API} api
35
39
  */
36
40
  function deprecationsAll(file, api, options) {
37
41
  file.source = (0, _accordionSummaryClasses.default)(file, api, options);
42
+ file.source = (0, _accordionProps.default)(file, api, options);
38
43
  file.source = (0, _alertClasses.default)(file, api, options);
39
44
  file.source = (0, _avatarGroupProps.default)(file, api, options);
40
45
  file.source = (0, _autocompleteProps.default)(file, api, options);
46
+ file.source = (0, _avatarProps.default)(file, api, options);
41
47
  file.source = (0, _backdropProps.default)(file, api, options);
42
48
  file.source = (0, _buttonClasses.default)(file, api, options);
43
49
  file.source = (0, _buttonGroupClasses.default)(file, api, options);
@@ -52,11 +58,13 @@ function deprecationsAll(file, api, options) {
52
58
  file.source = (0, _modalProps.default)(file, api, options);
53
59
  file.source = (0, _outlinedInputProps.default)(file, api, options);
54
60
  file.source = (0, _paginationItemClasses.default)(file, api, options);
61
+ file.source = (0, _speedDialProps.default)(file, api, options);
55
62
  file.source = (0, _stepConnectorClasses.default)(file, api, options);
56
63
  file.source = (0, _stepLabelProps.default)(file, api, options);
57
64
  file.source = (0, _tableSortLabelClasses.default)(file, api, options);
58
65
  file.source = (0, _textFieldProps.default)(file, api, options);
59
66
  file.source = (0, _tabClasses.default)(file, api, options);
60
67
  file.source = (0, _toggleButtonGroupClasses.default)(file, api, options);
68
+ file.source = (0, _tooltipProps.default)(file, api, options);
61
69
  return file.source;
62
70
  }
@@ -5,7 +5,13 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = transformer;
8
+ var _movePropIntoSlots = _interopRequireDefault(require("../utils/movePropIntoSlots"));
9
+ var _movePropIntoSlotProps = _interopRequireDefault(require("../utils/movePropIntoSlotProps"));
8
10
  var _replaceComponentsWithSlots = _interopRequireDefault(require("../utils/replaceComponentsWithSlots"));
11
+ var _findComponentJSX = _interopRequireDefault(require("../../util/findComponentJSX"));
12
+ var _findComponentDefaultProps = _interopRequireDefault(require("../../util/findComponentDefaultProps"));
13
+ var _assignObject = _interopRequireDefault(require("../../util/assignObject"));
14
+ var _appendAttribute = _interopRequireDefault(require("../../util/appendAttribute"));
9
15
  /**
10
16
  * @param {import('jscodeshift').FileInfo} file
11
17
  * @param {import('jscodeshift').API} api
@@ -14,9 +20,105 @@ function transformer(file, api, options) {
14
20
  const j = api.jscodeshift;
15
21
  const root = j(file.source);
16
22
  const printOptions = options.printOptions;
23
+ (0, _movePropIntoSlots.default)(j, {
24
+ root,
25
+ componentName: 'Autocomplete',
26
+ propName: 'PaperComponent',
27
+ slotName: 'paper'
28
+ });
29
+ (0, _movePropIntoSlots.default)(j, {
30
+ root,
31
+ componentName: 'Autocomplete',
32
+ propName: 'PopperComponent',
33
+ slotName: 'popper'
34
+ });
35
+ (0, _movePropIntoSlotProps.default)(j, {
36
+ root,
37
+ componentName: 'Autocomplete',
38
+ propName: 'ListboxProps',
39
+ slotName: 'listbox'
40
+ });
41
+ (0, _movePropIntoSlotProps.default)(j, {
42
+ root,
43
+ componentName: 'Autocomplete',
44
+ propName: 'ChipProps',
45
+ slotName: 'chip'
46
+ });
17
47
  (0, _replaceComponentsWithSlots.default)(j, {
18
48
  root,
19
49
  componentName: 'Autocomplete'
20
50
  });
51
+
52
+ // Move ListboxComponent JSX prop into slotProps.listbox.component
53
+ (0, _findComponentJSX.default)(j, {
54
+ root,
55
+ componentName: 'Autocomplete'
56
+ }, elementPath => {
57
+ const element = elementPath.node;
58
+ const propIndex = element.openingElement.attributes.findIndex(attr => attr.type === 'JSXAttribute' && attr.name.name === 'ListboxComponent');
59
+ if (propIndex !== -1) {
60
+ const removedValue = element.openingElement.attributes.splice(propIndex, 1)[0].value.expression;
61
+ let hasSlotProps = false;
62
+ element.openingElement.attributes.forEach(attr => {
63
+ if (attr.name?.name === 'slotProps') {
64
+ hasSlotProps = true;
65
+ const slots = attr.value.expression;
66
+ const slotIndex = slots.properties.findIndex(prop => prop?.key?.name === 'listbox');
67
+ if (slotIndex === -1) {
68
+ (0, _assignObject.default)(j, {
69
+ target: attr,
70
+ key: 'listbox',
71
+ expression: j.objectExpression([j.objectProperty(j.identifier('component'), removedValue)])
72
+ });
73
+ } else {
74
+ const slotPropsSlotValue = slots.properties.splice(slotIndex, 1)[0].value;
75
+ (0, _assignObject.default)(j, {
76
+ target: attr,
77
+ key: 'listbox',
78
+ expression: j.objectExpression([j.objectProperty(j.identifier('component'), removedValue), j.spreadElement(slotPropsSlotValue)])
79
+ });
80
+ }
81
+ }
82
+ });
83
+ if (!hasSlotProps) {
84
+ (0, _appendAttribute.default)(j, {
85
+ target: element,
86
+ attributeName: 'slotProps',
87
+ expression: j.objectExpression([j.objectProperty(j.identifier('listbox'), j.objectExpression([j.objectProperty(j.identifier('component'), removedValue)]))])
88
+ });
89
+ }
90
+ }
91
+ });
92
+
93
+ // Move ListboxComponent default prop into slotProps.listbox.component
94
+ const defaultPropsPathCollection = (0, _findComponentDefaultProps.default)(j, {
95
+ root,
96
+ componentName: 'Autocomplete'
97
+ });
98
+ defaultPropsPathCollection.find(j.ObjectProperty, {
99
+ key: {
100
+ name: 'ListboxComponent'
101
+ }
102
+ }).forEach(path => {
103
+ const removedValue = path.value.value;
104
+ const defaultProps = path.parent.value;
105
+ let hasSlotProps = false;
106
+ defaultProps.properties.forEach(property => {
107
+ if (property.key?.name === 'slotProps') {
108
+ hasSlotProps = true;
109
+ const slotIndex = property.value.properties.findIndex(prop => prop?.key?.name === 'listbox');
110
+ if (slotIndex === -1) {
111
+ property.value.properties.push(j.objectProperty(j.identifier('listbox'), j.objectExpression([j.objectProperty(j.identifier('component'), removedValue)])));
112
+ } else {
113
+ const slotPropsSlotValue = property.value.properties.splice(slotIndex, 1)[0].value;
114
+ property.value.properties.push(j.objectProperty(j.identifier('listbox'), j.objectExpression([j.objectProperty(j.identifier('component'), removedValue), j.spreadElement(slotPropsSlotValue)])));
115
+ }
116
+ }
117
+ });
118
+ if (!hasSlotProps) {
119
+ defaultProps.properties.push(j.objectProperty(j.identifier('slotProps'), j.objectExpression([j.objectProperty(j.identifier('listbox'), j.objectExpression([j.objectProperty(j.identifier('component'), removedValue)]))])));
120
+ }
121
+ path.prune();
122
+ });
21
123
  return root.toSource(printOptions);
22
124
  }
@@ -5,6 +5,15 @@ var _Autocomplete = _interopRequireDefault(require("@mui/material/Autocomplete")
5
5
  var _material = require("@mui/material");
6
6
  var _jsxRuntime = require("react/jsx-runtime");
7
7
  /*#__PURE__*/(0, _jsxRuntime.jsx)(_Autocomplete.default, {
8
+ ChipProps: {
9
+ height: 10
10
+ },
11
+ PaperComponent: CustomPaper,
12
+ PopperComponent: CustomPopper,
13
+ ListboxComponent: CustomListbox,
14
+ ListboxProps: {
15
+ height: 12
16
+ },
8
17
  componentsProps: {
9
18
  clearIndicator: {
10
19
  width: 10
@@ -21,6 +30,15 @@ var _jsxRuntime = require("react/jsx-runtime");
21
30
  }
22
31
  });
23
32
  /*#__PURE__*/(0, _jsxRuntime.jsx)(_Autocomplete.default, {
33
+ ChipProps: {
34
+ height: 10
35
+ },
36
+ PaperComponent: CustomPaper,
37
+ PopperComponent: CustomPopper,
38
+ ListboxComponent: CustomListbox,
39
+ ListboxProps: {
40
+ height: 12
41
+ },
24
42
  slotProps: {
25
43
  popupIndicator: {
26
44
  width: 20
@@ -42,6 +60,15 @@ var _jsxRuntime = require("react/jsx-runtime");
42
60
  }
43
61
  });
44
62
  /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Autocomplete, {
63
+ ChipProps: {
64
+ height: 10
65
+ },
66
+ PaperComponent: CustomPaper,
67
+ PopperComponent: CustomPopper,
68
+ ListboxComponent: CustomListbox,
69
+ ListboxProps: {
70
+ height: 12
71
+ },
45
72
  componentsProps: {
46
73
  clearIndicator: {
47
74
  width: 10
@@ -72,4 +99,15 @@ var _jsxRuntime = require("react/jsx-runtime");
72
99
  width: 16
73
100
  }
74
101
  }
102
+ });
103
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(CustomAutocomplete, {
104
+ ChipProps: {
105
+ height: 10
106
+ },
107
+ PaperComponent: CustomPaper,
108
+ PopperComponent: CustomPopper,
109
+ ListboxComponent: CustomListbox,
110
+ ListboxProps: {
111
+ height: 12
112
+ }
75
113
  });
@@ -5,7 +5,14 @@ var _Autocomplete = _interopRequireDefault(require("@mui/material/Autocomplete")
5
5
  var _material = require("@mui/material");
6
6
  var _jsxRuntime = require("react/jsx-runtime");
7
7
  /*#__PURE__*/(0, _jsxRuntime.jsx)(_Autocomplete.default, {
8
+ slots: {
9
+ paper: CustomPaper,
10
+ popper: CustomPopper
11
+ },
8
12
  slotProps: {
13
+ chip: {
14
+ height: 10
15
+ },
9
16
  clearIndicator: {
10
17
  width: 10
11
18
  },
@@ -17,11 +24,20 @@ var _jsxRuntime = require("react/jsx-runtime");
17
24
  },
18
25
  popupIndicator: {
19
26
  width: 16
27
+ },
28
+ listbox: {
29
+ component: CustomListbox,
30
+ ...{
31
+ height: 12
32
+ }
20
33
  }
21
34
  }
22
35
  });
23
36
  /*#__PURE__*/(0, _jsxRuntime.jsx)(_Autocomplete.default, {
24
37
  slotProps: {
38
+ chip: {
39
+ height: 10
40
+ },
25
41
  clearIndicator: {
26
42
  width: 10
27
43
  },
@@ -38,11 +54,28 @@ var _jsxRuntime = require("react/jsx-runtime");
38
54
  ...{
39
55
  width: 20
40
56
  }
57
+ },
58
+ listbox: {
59
+ component: CustomListbox,
60
+ ...{
61
+ height: 12
62
+ }
41
63
  }
64
+ },
65
+ slots: {
66
+ paper: CustomPaper,
67
+ popper: CustomPopper
42
68
  }
43
69
  });
44
70
  /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Autocomplete, {
71
+ slots: {
72
+ paper: CustomPaper,
73
+ popper: CustomPopper
74
+ },
45
75
  slotProps: {
76
+ chip: {
77
+ height: 10
78
+ },
46
79
  clearIndicator: {
47
80
  width: 10
48
81
  },
@@ -54,6 +87,12 @@ var _jsxRuntime = require("react/jsx-runtime");
54
87
  },
55
88
  popupIndicator: {
56
89
  width: 16
90
+ },
91
+ listbox: {
92
+ component: CustomListbox,
93
+ ...{
94
+ height: 12
95
+ }
57
96
  }
58
97
  }
59
98
  });
@@ -72,4 +111,15 @@ var _jsxRuntime = require("react/jsx-runtime");
72
111
  width: 16
73
112
  }
74
113
  }
114
+ });
115
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(CustomAutocomplete, {
116
+ ChipProps: {
117
+ height: 10
118
+ },
119
+ PaperComponent: CustomPaper,
120
+ PopperComponent: CustomPopper,
121
+ ListboxComponent: CustomListbox,
122
+ ListboxProps: {
123
+ height: 12
124
+ }
75
125
  });
@@ -3,6 +3,15 @@
3
3
  fn({
4
4
  MuiAutocomplete: {
5
5
  defaultProps: {
6
+ ChipProps: {
7
+ height: 10
8
+ },
9
+ PaperComponent: CustomPaper,
10
+ PopperComponent: CustomPopper,
11
+ ListboxComponent: CustomListbox,
12
+ ListboxProps: {
13
+ height: 12
14
+ },
6
15
  componentsProps: {
7
16
  clearIndicator: {
8
17
  width: 10
@@ -23,6 +32,15 @@ fn({
23
32
  fn({
24
33
  MuiAutocomplete: {
25
34
  defaultProps: {
35
+ ChipProps: {
36
+ height: 10
37
+ },
38
+ PaperComponent: CustomPaper,
39
+ PopperComponent: CustomPopper,
40
+ ListboxComponent: CustomListbox,
41
+ ListboxProps: {
42
+ height: 12
43
+ },
26
44
  slotProps: {
27
45
  popupIndicator: {
28
46
  width: 20
@@ -3,6 +3,10 @@
3
3
  fn({
4
4
  MuiAutocomplete: {
5
5
  defaultProps: {
6
+ slots: {
7
+ paper: CustomPaper,
8
+ popper: CustomPopper
9
+ },
6
10
  slotProps: {
7
11
  clearIndicator: {
8
12
  width: 10
@@ -15,6 +19,15 @@ fn({
15
19
  },
16
20
  popupIndicator: {
17
21
  width: 16
22
+ },
23
+ chip: {
24
+ height: 10
25
+ },
26
+ listbox: {
27
+ component: CustomListbox,
28
+ ...{
29
+ height: 12
30
+ }
18
31
  }
19
32
  }
20
33
  }
@@ -40,7 +53,20 @@ fn({
40
53
  ...{
41
54
  width: 20
42
55
  }
56
+ },
57
+ chip: {
58
+ height: 10
59
+ },
60
+ listbox: {
61
+ component: CustomListbox,
62
+ ...{
63
+ height: 12
64
+ }
43
65
  }
66
+ },
67
+ slots: {
68
+ paper: CustomPaper,
69
+ popper: CustomPopper
44
70
  }
45
71
  }
46
72
  }
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = transformer;
8
+ var _movePropIntoSlots = _interopRequireDefault(require("../utils/movePropIntoSlots"));
8
9
  var _replaceComponentsWithSlots = _interopRequireDefault(require("../utils/replaceComponentsWithSlots"));
9
10
  /**
10
11
  * @param {import('jscodeshift').FileInfo} file
@@ -18,5 +19,11 @@ function transformer(file, api, options) {
18
19
  root,
19
20
  componentName: 'Backdrop'
20
21
  });
22
+ (0, _movePropIntoSlots.default)(j, {
23
+ root,
24
+ componentName: 'Backdrop',
25
+ propName: 'TransitionComponent',
26
+ slotName: 'transition'
27
+ });
21
28
  return root.toSource(printOptions);
22
29
  }
@@ -4,6 +4,36 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  var _Backdrop = _interopRequireDefault(require("@mui/material/Backdrop"));
5
5
  var _material = require("@mui/material");
6
6
  var _jsxRuntime = require("react/jsx-runtime");
7
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Backdrop.default, {
8
+ TransitionComponent: CustomTransition
9
+ });
10
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Backdrop, {
11
+ TransitionComponent: CustomTransition
12
+ });
13
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Backdrop.default, {
14
+ TransitionComponent: CustomTransition,
15
+ slots: {
16
+ root: 'div'
17
+ }
18
+ });
19
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Backdrop, {
20
+ TransitionComponent: CustomTransition,
21
+ slots: {
22
+ ...outerSlots
23
+ }
24
+ });
25
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Backdrop.default, {
26
+ TransitionComponent: ComponentTransition,
27
+ slots: {
28
+ root: 'div',
29
+ transition: SlotTransition
30
+ }
31
+ });
32
+
33
+ // should skip non MUI components
34
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(NonMuiBackdrop, {
35
+ TransitionComponent: CustomTransition
36
+ });
7
37
  /*#__PURE__*/(0, _jsxRuntime.jsx)(_Backdrop.default, {
8
38
  components: {
9
39
  Root: ComponentsRoot
@@ -4,6 +4,39 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  var _Backdrop = _interopRequireDefault(require("@mui/material/Backdrop"));
5
5
  var _material = require("@mui/material");
6
6
  var _jsxRuntime = require("react/jsx-runtime");
7
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Backdrop.default, {
8
+ slots: {
9
+ transition: CustomTransition
10
+ }
11
+ });
12
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Backdrop, {
13
+ slots: {
14
+ transition: CustomTransition
15
+ }
16
+ });
17
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Backdrop.default, {
18
+ slots: {
19
+ root: 'div',
20
+ transition: CustomTransition
21
+ }
22
+ });
23
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Backdrop, {
24
+ slots: {
25
+ ...outerSlots,
26
+ transition: CustomTransition
27
+ }
28
+ });
29
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Backdrop.default, {
30
+ slots: {
31
+ root: 'div',
32
+ transition: SlotTransition
33
+ }
34
+ });
35
+
36
+ // should skip non MUI components
37
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(NonMuiBackdrop, {
38
+ TransitionComponent: CustomTransition
39
+ });
7
40
  /*#__PURE__*/(0, _jsxRuntime.jsx)(_Backdrop.default, {
8
41
  slots: {
9
42
  root: ComponentsRoot
@@ -1,5 +1,33 @@
1
1
  "use strict";
2
2
 
3
+ fn({
4
+ MuiBackdrop: {
5
+ defaultProps: {
6
+ TransitionComponent: CustomTransition
7
+ }
8
+ }
9
+ });
10
+ fn({
11
+ MuiBackdrop: {
12
+ defaultProps: {
13
+ TransitionComponent: CustomTransition,
14
+ slots: {
15
+ root: 'div'
16
+ }
17
+ }
18
+ }
19
+ });
20
+ fn({
21
+ MuiBackdrop: {
22
+ defaultProps: {
23
+ TransitionComponent: ComponentTransition,
24
+ slots: {
25
+ root: 'div',
26
+ transition: SlotTransition
27
+ }
28
+ }
29
+ }
30
+ });
3
31
  fn({
4
32
  MuiBackdrop: {
5
33
  defaultProps: {
@@ -1,5 +1,34 @@
1
1
  "use strict";
2
2
 
3
+ fn({
4
+ MuiBackdrop: {
5
+ defaultProps: {
6
+ slots: {
7
+ transition: CustomTransition
8
+ }
9
+ }
10
+ }
11
+ });
12
+ fn({
13
+ MuiBackdrop: {
14
+ defaultProps: {
15
+ slots: {
16
+ root: 'div',
17
+ transition: CustomTransition
18
+ }
19
+ }
20
+ }
21
+ });
22
+ fn({
23
+ MuiBackdrop: {
24
+ defaultProps: {
25
+ slots: {
26
+ root: 'div',
27
+ transition: SlotTransition
28
+ }
29
+ }
30
+ }
31
+ });
3
32
  fn({
4
33
  MuiBackdrop: {
5
34
  defaultProps: {
@@ -6,6 +6,8 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = transformer;
8
8
  var _replaceComponentsWithSlots = _interopRequireDefault(require("../utils/replaceComponentsWithSlots"));
9
+ var _movePropIntoSlots = _interopRequireDefault(require("../utils/movePropIntoSlots"));
10
+ var _movePropIntoSlotProps = _interopRequireDefault(require("../utils/movePropIntoSlotProps"));
9
11
  /**
10
12
  * @param {import('jscodeshift').FileInfo} file
11
13
  * @param {import('jscodeshift').API} api
@@ -18,5 +20,17 @@ function transformer(file, api, options) {
18
20
  root,
19
21
  componentName: 'StepLabel'
20
22
  });
23
+ (0, _movePropIntoSlots.default)(j, {
24
+ root,
25
+ componentName: 'StepLabel',
26
+ propName: 'StepIconComponent',
27
+ slotName: 'stepIcon'
28
+ });
29
+ (0, _movePropIntoSlotProps.default)(j, {
30
+ root,
31
+ componentName: 'StepLabel',
32
+ propName: 'StepIconProps',
33
+ slotName: 'stepIcon'
34
+ });
21
35
  return root.toSource(printOptions);
22
36
  }
@@ -18,4 +18,27 @@ var _jsxRuntime = require("react/jsx-runtime");
18
18
  componentsProps: {
19
19
  label: componentsLabelProps
20
20
  }
21
+ });
22
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_StepLabel.default, {
23
+ componentsProps: {
24
+ label: componentsLabelProps
25
+ },
26
+ StepIconProps: StepIconProps
27
+ });
28
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_StepLabel.default, {
29
+ slots: {
30
+ label: SlotsLabel
31
+ },
32
+ slotProps: {
33
+ label: slotLabelProps
34
+ },
35
+ componentsProps: {
36
+ label: componentsLabelProps
37
+ },
38
+ StepIconComponent: StepIconComponent,
39
+ StepIconProps: StepIconProps
40
+ });
41
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_StepLabel.default, {
42
+ StepIconComponent: StepIconComponent,
43
+ StepIconProps: StepIconProps
21
44
  });
@@ -18,4 +18,31 @@ var _jsxRuntime = require("react/jsx-runtime");
18
18
  ...slotLabelProps
19
19
  }
20
20
  }
21
+ });
22
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_StepLabel.default, {
23
+ slotProps: {
24
+ label: componentsLabelProps,
25
+ stepIcon: StepIconProps
26
+ }
27
+ });
28
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_StepLabel.default, {
29
+ slots: {
30
+ label: SlotsLabel,
31
+ stepIcon: StepIconComponent
32
+ },
33
+ slotProps: {
34
+ label: {
35
+ ...componentsLabelProps,
36
+ ...slotLabelProps
37
+ },
38
+ stepIcon: StepIconProps
39
+ }
40
+ });
41
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_StepLabel.default, {
42
+ slots: {
43
+ stepIcon: StepIconComponent
44
+ },
45
+ slotProps: {
46
+ stepIcon: StepIconProps
47
+ }
21
48
  });
@@ -20,4 +20,26 @@ fn({
20
20
  }
21
21
  }
22
22
  }
23
+ });
24
+ fn({
25
+ MuiStepLabel: {
26
+ defaultProps: {
27
+ StepIconComponent: StepIconComponent,
28
+ StepIconProps: StepIconProps
29
+ }
30
+ }
31
+ });
32
+ fn({
33
+ MuiStepLabel: {
34
+ defaultProps: {
35
+ componentsProps: {
36
+ label: componentsLabelProps
37
+ },
38
+ slotProps: {
39
+ label: slotLabelProps
40
+ },
41
+ StepIconComponent: StepIconComponent,
42
+ StepIconProps: StepIconProps
43
+ }
44
+ }
23
45
  });
@@ -20,4 +20,32 @@ fn({
20
20
  }
21
21
  }
22
22
  }
23
+ });
24
+ fn({
25
+ MuiStepLabel: {
26
+ defaultProps: {
27
+ slots: {
28
+ stepIcon: StepIconComponent
29
+ },
30
+ slotProps: {
31
+ stepIcon: StepIconProps
32
+ }
33
+ }
34
+ }
35
+ });
36
+ fn({
37
+ MuiStepLabel: {
38
+ defaultProps: {
39
+ slotProps: {
40
+ label: {
41
+ ...componentsLabelProps,
42
+ ...slotLabelProps
43
+ },
44
+ stepIcon: StepIconProps
45
+ },
46
+ slots: {
47
+ stepIcon: StepIconComponent
48
+ }
49
+ }
50
+ }
23
51
  });
@@ -2,6 +2,7 @@
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
4
  var _Tooltip = _interopRequireDefault(require("@mui/material/Tooltip"));
5
+ var _material = require("@mui/material");
5
6
  var _jsxRuntime = require("react/jsx-runtime");
6
7
  /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
7
8
  components: {
@@ -89,4 +90,52 @@ var _jsxRuntime = require("react/jsx-runtime");
89
90
  tooltip: componentsTooltipProps,
90
91
  transition: componentsTransitionProps
91
92
  }
93
+ });
94
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
95
+ PopperComponent: CustomPopper,
96
+ TransitionComponent: CustomTransition,
97
+ PopperProps: {
98
+ disablePortal: true
99
+ },
100
+ TransitionProps: {
101
+ timeout: 200
102
+ }
103
+ });
104
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
105
+ PopperComponent: CustomPopper,
106
+ TransitionComponent: CustomTransition,
107
+ PopperProps: {
108
+ disablePortal: true
109
+ },
110
+ TransitionProps: {
111
+ timeout: 200
112
+ },
113
+ slotProps: {
114
+ tooltip: {
115
+ height: 20
116
+ }
117
+ },
118
+ slots: {
119
+ tooltip: "div"
120
+ }
121
+ });
122
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
123
+ PopperComponent: CustomPopper,
124
+ TransitionComponent: CustomTransition,
125
+ PopperProps: {
126
+ disablePortal: true
127
+ },
128
+ TransitionProps: {
129
+ timeout: 200
130
+ }
131
+ });
132
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(CustomTooltip, {
133
+ PopperComponent: CustomPopper,
134
+ TransitionComponent: CustomTransition,
135
+ PopperProps: {
136
+ disablePortal: true
137
+ },
138
+ TransitionProps: {
139
+ timeout: 200
140
+ }
92
141
  });
@@ -2,6 +2,7 @@
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
4
  var _Tooltip = _interopRequireDefault(require("@mui/material/Tooltip"));
5
+ var _material = require("@mui/material");
5
6
  var _jsxRuntime = require("react/jsx-runtime");
6
7
  /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
7
8
  slots: {
@@ -81,4 +82,60 @@ var _jsxRuntime = require("react/jsx-runtime");
81
82
  ...slotsTransitionProps
82
83
  }
83
84
  }
85
+ });
86
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
87
+ slots: {
88
+ popper: CustomPopper,
89
+ transition: CustomTransition
90
+ },
91
+ slotProps: {
92
+ popper: {
93
+ disablePortal: true
94
+ },
95
+ transition: {
96
+ timeout: 200
97
+ }
98
+ }
99
+ });
100
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
101
+ slotProps: {
102
+ tooltip: {
103
+ height: 20
104
+ },
105
+ popper: {
106
+ disablePortal: true
107
+ },
108
+ transition: {
109
+ timeout: 200
110
+ }
111
+ },
112
+ slots: {
113
+ tooltip: "div",
114
+ popper: CustomPopper,
115
+ transition: CustomTransition
116
+ }
117
+ });
118
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
119
+ slots: {
120
+ popper: CustomPopper,
121
+ transition: CustomTransition
122
+ },
123
+ slotProps: {
124
+ popper: {
125
+ disablePortal: true
126
+ },
127
+ transition: {
128
+ timeout: 200
129
+ }
130
+ }
131
+ });
132
+ /*#__PURE__*/(0, _jsxRuntime.jsx)(CustomTooltip, {
133
+ PopperComponent: CustomPopper,
134
+ TransitionComponent: CustomTransition,
135
+ PopperProps: {
136
+ disablePortal: true
137
+ },
138
+ TransitionProps: {
139
+ timeout: 200
140
+ }
84
141
  });
@@ -70,4 +70,40 @@ fn({
70
70
  }
71
71
  }
72
72
  }
73
+ });
74
+ fn({
75
+ MuiTooltip: {
76
+ defaultProps: {
77
+ PopperComponent: CustomPopper,
78
+ TransitionComponent: CustomTransition,
79
+ PopperProps: {
80
+ disablePortal: true
81
+ },
82
+ TransitionProps: {
83
+ timeout: 200
84
+ }
85
+ }
86
+ }
87
+ });
88
+ fn({
89
+ MuiTooltip: {
90
+ defaultProps: {
91
+ PopperComponent: CustomPopper,
92
+ TransitionComponent: CustomTransition,
93
+ PopperProps: {
94
+ disablePortal: true
95
+ },
96
+ TransitionProps: {
97
+ timeout: 200
98
+ },
99
+ slotProps: {
100
+ tooltip: {
101
+ height: 20
102
+ }
103
+ },
104
+ slots: {
105
+ tooltip: "div"
106
+ }
107
+ }
108
+ }
73
109
  });
@@ -62,4 +62,44 @@ fn({
62
62
  }
63
63
  }
64
64
  }
65
+ });
66
+ fn({
67
+ MuiTooltip: {
68
+ defaultProps: {
69
+ slots: {
70
+ popper: CustomPopper,
71
+ transition: CustomTransition
72
+ },
73
+ slotProps: {
74
+ popper: {
75
+ disablePortal: true
76
+ },
77
+ transition: {
78
+ timeout: 200
79
+ }
80
+ }
81
+ }
82
+ }
83
+ });
84
+ fn({
85
+ MuiTooltip: {
86
+ defaultProps: {
87
+ slotProps: {
88
+ tooltip: {
89
+ height: 20
90
+ },
91
+ popper: {
92
+ disablePortal: true
93
+ },
94
+ transition: {
95
+ timeout: 200
96
+ }
97
+ },
98
+ slots: {
99
+ tooltip: "div",
100
+ popper: CustomPopper,
101
+ transition: CustomTransition
102
+ }
103
+ }
104
+ }
65
105
  });
@@ -6,6 +6,8 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = transformer;
8
8
  var _replaceComponentsWithSlots = _interopRequireDefault(require("../utils/replaceComponentsWithSlots"));
9
+ var _movePropIntoSlots = _interopRequireDefault(require("../utils/movePropIntoSlots"));
10
+ var _movePropIntoSlotProps = _interopRequireDefault(require("../utils/movePropIntoSlotProps"));
9
11
  /**
10
12
  * @param {import('jscodeshift').FileInfo} file
11
13
  * @param {import('jscodeshift').API} api
@@ -18,5 +20,29 @@ function transformer(file, api, options) {
18
20
  root,
19
21
  componentName: 'Tooltip'
20
22
  });
23
+ (0, _movePropIntoSlots.default)(j, {
24
+ root,
25
+ componentName: 'Tooltip',
26
+ propName: 'PopperComponent',
27
+ slotName: 'popper'
28
+ });
29
+ (0, _movePropIntoSlotProps.default)(j, {
30
+ root,
31
+ componentName: 'Tooltip',
32
+ propName: 'PopperProps',
33
+ slotName: 'popper'
34
+ });
35
+ (0, _movePropIntoSlots.default)(j, {
36
+ root,
37
+ componentName: 'Tooltip',
38
+ propName: 'TransitionComponent',
39
+ slotName: 'transition'
40
+ });
41
+ (0, _movePropIntoSlotProps.default)(j, {
42
+ root,
43
+ componentName: 'Tooltip',
44
+ propName: 'TransitionProps',
45
+ slotName: 'transition'
46
+ });
21
47
  return root.toSource(printOptions);
22
48
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/codemod",
3
- "version": "6.1.7",
3
+ "version": "6.1.8",
4
4
  "bin": "./codemod.js",
5
5
  "private": false,
6
6
  "author": "MUI Team",
@@ -29,7 +29,7 @@
29
29
  "@babel/traverse": "^7.25.9",
30
30
  "jscodeshift": "^17.1.1",
31
31
  "jscodeshift-add-imports": "^1.0.11",
32
- "postcss": "^8.4.47",
32
+ "postcss": "^8.4.49",
33
33
  "postcss-cli": "^11.0.0",
34
34
  "yargs": "^17.7.2"
35
35
  },