@mui/x-codemod 7.0.0-alpha.1 → 7.0.0-alpha.5

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
@@ -56,13 +56,162 @@ through jscodeshift's `printOptions` command line argument
56
56
  npx @mui/x-codemod <transform> <path> --jscodeshift="--printOptions='{\"quote\":\"double\"}'"
57
57
  ```
58
58
 
59
- ## Included scripts
59
+ ## v7.0.0
60
60
 
61
- ### v6.0.0
61
+ ### 🚀 `preset-safe` for v7.0.0
62
62
 
63
- #### 🚀 `preset-safe`
63
+ A combination of all important transformers for migrating v6 to v7.
64
+ ⚠️ This codemod should be run only once.
65
+ It runs codemods for both Data Grid and Date and Time Pickers packages.
66
+ To run codemods for a specific package, refer to the respective section.
64
67
 
65
- A combination of all important transformers for migrating v5 to v6. ⚠️ This codemod should be run only once. It runs codemods for both Data Grid and Date and Time Pickers packages. To run codemods for a specific package, refer to the respective section.
68
+ ```bash
69
+ npx @mui/x-codemod v7.0.0/preset-safe <path|folder>
70
+ ```
71
+
72
+ The corresponding sub-sections are listed below
73
+
74
+ - [`preset-safe-for-pickers`](#preset-safe-for-pickers-v700)
75
+ - [`preset-safe-for-data-grid`](#preset-safe-for-data-grid-v700)
76
+
77
+ ### Pickers codemods
78
+
79
+ #### `preset-safe` for pickers v7.0.0
80
+
81
+ The `preset-safe` codemods for pickers.
82
+
83
+ ```bash
84
+ npx @mui/x-codemod v7.0.0/pickers/preset-safe <path|folder>
85
+ ```
86
+
87
+ The list includes these transformers
88
+
89
+ - [`rename-components-to-slots-pickers`](#rename-components-to-slots-pickers)
90
+ - [`rename-default-calendar-month-to-reference-date`](#rename-default-calendar-month-to-reference-date)
91
+ - [`rename-day-picker-classes`](#rename-day-picker-classes)
92
+ - [`rename-slots-types`](#rename-slots-types)
93
+
94
+ #### `rename-components-to-slots-pickers`
95
+
96
+ Renames the `components` and `componentsProps` props to `slots` and `slotProps`, respectively.
97
+
98
+ This change only affects Date and Time Picker components.
99
+
100
+ ```diff
101
+ <DatePicker
102
+ - components={{ Toolbar: CustomToolbar }}
103
+ + slots={{ toolbar: CustomToolbar }}
104
+ - componentsProps={{ actionBar: { actions: ['clear'] } }}
105
+ + slotProps={{ actionBar: { actions: ['clear'] } }}
106
+ />;
107
+ ```
108
+
109
+ ```bash
110
+ npx @mui/x-codemod v7.0.0/pickers/rename-components-to-slots <path>
111
+ ```
112
+
113
+ #### `rename-default-calendar-month-to-reference-date`
114
+
115
+ Replace the `defaultCalendarMonth` prop with the `referenceDate` prop.
116
+
117
+ ```diff
118
+ - <DateCalendar defaultCalendarMonth={dayjs('2022-04-01')};
119
+ + <DateCalendar referenceDate{dayjs('2022-04-01')} />
120
+ ```
121
+
122
+ ```bash
123
+ npx @mui/x-codemod v7.0.0/pickers/rename-default-calendar-month-to-reference-date <path>
124
+ ```
125
+
126
+ #### `rename-day-picker-classes`
127
+
128
+ Rename the `dayPickerClasses` variable to `dayCalendarClasses`.
129
+
130
+ ```diff
131
+ - import { dayPickerClasses } from '@mui/x-date-pickers/DateCalendar';
132
+ + import { dayCalendarClasses } from '@mui/x-date-pickers/DateCalendar';
133
+ ```
134
+
135
+ ```bash
136
+ npx @mui/x-codemod v7.0.0/pickers/rename-day-picker-classes <path>
137
+ ```
138
+
139
+ #### `rename-slots-types`
140
+
141
+ Replace types suffix `SlotsComponent` by `Slots` and `SlotsComponentsProps` by `SlotProps`.
142
+
143
+ ```diff
144
+ - DateCalendarSlotsComponent
145
+ + DateCalendarSlots
146
+ - DateCalendarSlotsComponentsProps
147
+ + DateCalendarSlotProps
148
+ ```
149
+
150
+ ```bash
151
+ npx @mui/x-codemod v7.0.0/pickers/rename-slots-types <path>
152
+ ```
153
+
154
+ ### Data grid codemods
155
+
156
+ #### `preset-safe` for data grid v7.0.0
157
+
158
+ The `preset-safe` codemods for data grid.
159
+
160
+ ```bash
161
+ npx @mui/x-codemod v7.0.0/data-grid/preset-safe <path|folder>
162
+ ```
163
+
164
+ The list includes these transformers
165
+
166
+ - [`rename-components-to-slots-data-grid`](#rename-components-to-slots-data-grid)
167
+ - [`rename-cell-selection-props`](#rename-cell-selection-props)
168
+
169
+ #### `rename-components-to-slots-data-grid`
170
+
171
+ Renames the `components` and `componentsProps` props to `slots` and `slotProps`, respectively.
172
+
173
+ This change only affects Data Grid components.
174
+
175
+ ```diff
176
+ <DataGrid
177
+ - components={{ Toolbar: CustomToolbar }}
178
+ + slots={{ toolbar: CustomToolbar }}
179
+ - componentsProps={{ toolbar: { showQuickFilter: true }}}
180
+ + slotProps={{ toolbar: { showQuickFilter: true }}}
181
+ />;
182
+ ```
183
+
184
+ ```bash
185
+ npx @mui/x-codemod v7.0.0/data-grid/rename-components-to-slots <path>
186
+ ```
187
+
188
+ #### `rename-cell-selection-props`
189
+
190
+ Rename props related to `cellSelection` feature.
191
+
192
+ ```diff
193
+ <DataGridPremium
194
+ - unstable_cellSelection
195
+ + cellSelection
196
+ - cellSelectionModel={{ 0: { id: true, currencyPair: true, price1M: false } }}
197
+ + cellSelectionModel={{ 0: { id: true, currencyPair: true, price1M: false } }}
198
+ - unstable_onCellSelectionModelChange={() => {}}
199
+ + onCellSelectionModelChange={() => {}}
200
+ />;
201
+ ```
202
+
203
+ ```bash
204
+ npx @mui/x-codemod v7.0.0/data-grid/rename-cell-selection-props <path>
205
+ ```
206
+
207
+ ## v6.0.0
208
+
209
+ ### 🚀 `preset-safe` for v6.0.0
210
+
211
+ A combination of all important transformers for migrating v5 to v6.
212
+ ⚠️ This codemod should be run only once.
213
+ It runs codemods for both Data Grid and Date and Time Pickers packages.
214
+ To run codemods for a specific package, refer to the respective section.
66
215
 
67
216
  ```bash
68
217
  npx @mui/x-codemod v6.0.0/preset-safe <path|folder>
@@ -70,12 +219,12 @@ npx @mui/x-codemod v6.0.0/preset-safe <path|folder>
70
219
 
71
220
  The corresponding sub-sections are listed below
72
221
 
73
- - [`preset-safe-for-pickers`](#preset-safe-for-pickers)
74
- - [`preset-safe-for-data-grid`](#preset-safe-for-data-grid)
222
+ - [`preset-safe-for-pickers`](#preset-safe-for-pickers-v600)
223
+ - [`preset-safe-for-data-grid`](#preset-safe-for-data-grid-v600)
75
224
 
76
225
  ### Pickers codemods
77
226
 
78
- #### `preset-safe` for pickers
227
+ #### `preset-safe` for pickers v6.0.0
79
228
 
80
229
  The `preset-safe` codemods for pickers.
81
230
 
@@ -385,7 +534,7 @@ npx @mui/x-codemod v6.0.0/pickers/rename-default-toolbar-title-localeText <path>
385
534
 
386
535
  Renames the `components` and `componentsProps` props to `slots` and `slotProps`, respectively.
387
536
 
388
- This change only affects pickers components.
537
+ This change only affects Date and Time Pickers components.
389
538
 
390
539
  ```diff
391
540
  <DatePicker
@@ -402,7 +551,7 @@ npx @mui/x-codemod v6.0.0/pickers/rename-components-to-slots <path>
402
551
 
403
552
  ### Data grid codemods
404
553
 
405
- #### `preset-safe` for data grid
554
+ #### `preset-safe` for data grid v6.0.0
406
555
 
407
556
  The `preset-safe` codemods for data grid.
408
557
 
@@ -684,7 +833,7 @@ npx @mui/x-codemod v6.0.0/data-grid/replace-onCellFocusOut-prop <path>
684
833
 
685
834
  Renames the `components` and `componentsProps` props to `slots` and `slotProps`, respectively.
686
835
 
687
- This change only affects data grid components.
836
+ This change only affects Data Grid components.
688
837
 
689
838
  ```diff
690
839
  <DataGrid
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-codemod",
3
- "version": "7.0.0-alpha.1",
3
+ "version": "7.0.0-alpha.5",
4
4
  "bin": "./codemod.js",
5
5
  "private": false,
6
6
  "author": "MUI Team",
@@ -9,6 +9,7 @@
9
9
  "react",
10
10
  "react-component",
11
11
  "mui",
12
+ "mui-x",
12
13
  "codemod",
13
14
  "jscodeshift"
14
15
  ],
@@ -28,12 +29,12 @@
28
29
  "homepage": "https://github.com/mui/mui-x/tree/master/packages/x-codemod",
29
30
  "funding": {
30
31
  "type": "opencollective",
31
- "url": "https://opencollective.com/mui"
32
+ "url": "https://opencollective.com/mui-org"
32
33
  },
33
34
  "dependencies": {
34
- "@babel/core": "^7.23.2",
35
- "@babel/runtime": "^7.23.2",
36
- "@babel/traverse": "^7.23.2",
35
+ "@babel/core": "^7.23.5",
36
+ "@babel/runtime": "^7.23.5",
37
+ "@babel/traverse": "^7.23.5",
37
38
  "jscodeshift": "0.13.1",
38
39
  "jscodeshift-add-imports": "^1.0.10",
39
40
  "yargs": "^17.7.2"
@@ -89,7 +89,6 @@ function transformer(file, api, options) {
89
89
  // Add the new localeText prop
90
90
  j.jsxAttribute(j.jsxIdentifier('localeText'), j.jsxExpressionContainer(j.objectExpression(newLocaleText)))]), j.jsxClosingElement(j.jsxIdentifier('LocalizationProvider')), [path.value] // Pass in the original component as children
91
91
  );
92
-
93
92
  j(path).replaceWith(wrappedComponent);
94
93
  } else {
95
94
  attributes.push(j.jsxAttribute(j.jsxIdentifier('localeText'), j.jsxExpressionContainer(j.objectExpression(newLocaleText))));
@@ -5,8 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = transformer;
8
- var _renameComponentsToSlots = _interopRequireDefault(require("../../../v6.0.0/data-grid/rename-components-to-slots"));
8
+ var _renameComponentsToSlots = _interopRequireDefault(require("../rename-components-to-slots"));
9
+ var _renameCellSelectionProps = _interopRequireDefault(require("../rename-cell-selection-props"));
9
10
  function transformer(file, api, options) {
10
11
  file.source = (0, _renameComponentsToSlots.default)(file, api, options);
12
+ file.source = (0, _renameCellSelectionProps.default)(file, api, options);
11
13
  return file.source;
12
14
  }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = transformer;
8
+ var _renameProps = _interopRequireDefault(require("../../../util/renameProps"));
9
+ const componentNames = ['DataGridPremium'];
10
+ const props = {
11
+ unstable_cellSelection: 'cellSelection',
12
+ unstable_cellSelectionModel: 'cellSelectionModel',
13
+ unstable_onCellSelectionModelChange: 'onCellSelectionModelChange'
14
+ };
15
+ function transformer(file, api, options) {
16
+ const j = api.jscodeshift;
17
+ const root = j(file.source);
18
+ const printOptions = options.printOptions || {
19
+ quote: 'single',
20
+ trailingComma: true
21
+ };
22
+ return (0, _renameProps.default)({
23
+ root,
24
+ j,
25
+ props,
26
+ componentNames
27
+ }).toSource(printOptions);
28
+ }
@@ -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 _renameComponentsToSlots.default;
11
+ }
12
+ });
13
+ var _renameComponentsToSlots = _interopRequireDefault(require("../../../v6.0.0/data-grid/rename-components-to-slots"));
@@ -5,8 +5,14 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = transformer;
8
- var _renameComponentsToSlots = _interopRequireDefault(require("../../../v6.0.0/pickers/rename-components-to-slots"));
8
+ var _renameComponentsToSlots = _interopRequireDefault(require("../rename-components-to-slots"));
9
+ var _renameDefaultCalendarMonthToReferenceDate = _interopRequireDefault(require("../rename-default-calendar-month-to-reference-date"));
10
+ var _renameDayPickerClasses = _interopRequireDefault(require("../rename-day-picker-classes"));
11
+ var _renameSlotsTypes = _interopRequireDefault(require("../rename-slots-types"));
9
12
  function transformer(file, api, options) {
10
13
  file.source = (0, _renameComponentsToSlots.default)(file, api, options);
14
+ file.source = (0, _renameDefaultCalendarMonthToReferenceDate.default)(file, api, options);
15
+ file.source = (0, _renameDayPickerClasses.default)(file, api, options);
16
+ file.source = (0, _renameSlotsTypes.default)(file, api, options);
11
17
  return file.source;
12
18
  }
@@ -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 _renameComponentsToSlots.default;
11
+ }
12
+ });
13
+ var _renameComponentsToSlots = _interopRequireDefault(require("../../../v6.0.0/pickers/rename-components-to-slots"));
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = transformer;
7
+ const PACKAGE_REGEXP = /@mui\/x-date-pickers(-pro|)(\/(.*)|)/;
8
+ const matchImport = path => (path.node.source.value?.toString() ?? '').match(PACKAGE_REGEXP);
9
+ function transformer(file, api, options) {
10
+ const j = api.jscodeshift;
11
+ const root = j(file.source);
12
+ const printOptions = options.printOptions || {
13
+ quote: 'single',
14
+ trailingComma: true
15
+ };
16
+ const matchingImports = root.find(j.ImportDeclaration).filter(path => !!matchImport(path));
17
+
18
+ // Rename the import specifiers
19
+ // - import { dayPickerClasses } from '@mui/x-date-pickers'
20
+ // + import { dayCalendarClasses } from '@mui/x-date-pickers'
21
+ matchingImports.find(j.ImportSpecifier).filter(path => path.node.imported.name === 'dayPickerClasses').replaceWith(path => j.importSpecifier(j.identifier('dayCalendarClasses'), path.value.local));
22
+
23
+ // Rename the import usage
24
+ // - dayPickerClasses.root
25
+ // + dayCalendarClasses.root
26
+ root.find(j.Identifier).filter(path => path.node.name === 'dayPickerClasses').replaceWith(() => j.identifier('dayCalendarClasses'));
27
+ return root.toSource(printOptions);
28
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = transformer;
8
+ var _renameProps = _interopRequireDefault(require("../../../util/renameProps"));
9
+ function transformer(file, api, options) {
10
+ const j = api.jscodeshift;
11
+ const root = j(file.source);
12
+ const printOptions = options.printOptions;
13
+ return (0, _renameProps.default)({
14
+ root,
15
+ componentNames: ['DateCalendar', 'DatePicker', 'DateRangeCalendar', 'DateRangePicker', 'DateTimePicker', 'DesktopDatePicker', 'DesktopDateRangePicker', 'DesktopDateTimePicker', 'MobileDatePicker', 'MobileDateRangePicker', 'MobileDateTimePicker', 'StaticDatePicker', 'StaticDateRangePicker', 'StaticDateTimePicker'],
16
+ props: {
17
+ defaultCalendarMonth: 'referenceDate'
18
+ },
19
+ j
20
+ }).toSource(printOptions);
21
+ }
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = transformer;
7
+ const PACKAGE_REGEXP = /@mui\/x-date-pickers(-pro|)(\/(.*)|)/;
8
+ const rename = {
9
+ DateCalendarSlotsComponent: 'DateCalendarSlots',
10
+ DateCalendarSlotsComponentsProps: 'DateCalendarSlotProps',
11
+ DatePickerSlotsComponents: 'DatePickerSlots',
12
+ DatePickerSlotsComponentsProps: 'DatePickerSlotProps',
13
+ DateTimePickerSlotsComponents: 'DateTimePickerSlots',
14
+ DateTimePickerSlotsComponentsProps: 'DateTimePickerSlotProps',
15
+ DesktopDatePickerSlotsComponent: 'DesktopDatePickerSlots',
16
+ DesktopDatePickerSlotsComponentsProps: 'DesktopDatePickerSlotProps',
17
+ DesktopDateTimePickerSlotsComponent: 'DesktopDateTimePickerSlots',
18
+ DesktopDateTimePickerSlotsComponentsProps: 'DesktopDateTimePickerSlotProps',
19
+ DesktopTimePickerSlotsComponent: 'DesktopTimePickerSlots',
20
+ DesktopTimePickerSlotsComponentsProps: 'DesktopTimePickerSlotProps',
21
+ DigitalClockSlotsComponent: 'DigitalClockSlots',
22
+ DigitalClockSlotsComponentsProps: 'DigitalClockSlotProps',
23
+ ExportedPickersLayoutSlotsComponent: 'ExportedPickersLayoutSlots',
24
+ ExportedPickersLayoutSlotsComponentsProps: 'ExportedPickersLayoutSlotProps',
25
+ MobileDatePickerSlotsComponent: 'MobileDatePickerSlots',
26
+ MobileDatePickerSlotsComponentsProps: 'MobileDatePickerSlotProps',
27
+ MobileDateTimePickerSlotsComponent: 'MobileDateTimePickerSlots',
28
+ MobileDateTimePickerSlotsComponentsProps: 'MobileDateTimePickerSlotProps',
29
+ MobileTimePickerSlotsComponent: 'MobileTimePickerSlots',
30
+ MobileTimePickerSlotsComponentsProps: 'MobileTimePickerSlotProps',
31
+ MultiSectionDigitalClockSlotsComponent: 'MultiSectionDigitalClockSlots',
32
+ MultiSectionDigitalClockSlotsComponentsProps: 'MultiSectionDigitalClockSlotProps',
33
+ PickersCalendarHeaderSlotsComponent: 'PickersCalendarHeaderSlots',
34
+ PickersCalendarHeaderSlotsComponentsProps: 'PickersCalendarHeaderSlotProps',
35
+ PickersLayoutSlotsComponent: 'PickersLayoutSlots',
36
+ PickersLayoutSlotsComponentsProps: 'PickersLayoutSlotProps',
37
+ StaticDatePickerSlotsComponent: 'StaticDatePickerSlots',
38
+ StaticDatePickerSlotsComponentsProps: 'StaticDatePickerSlotProps',
39
+ StaticDateTimePickerSlotsComponent: 'StaticDateTimePickerSlots',
40
+ StaticDateTimePickerSlotsComponentsProps: 'StaticDateTimePickerSlotProps',
41
+ StaticTimePickerSlotsComponent: 'StaticTimePickerSlots',
42
+ StaticTimePickerSlotsComponentsProps: 'StaticTimePickerSlotProps',
43
+ TimeClockSlotsComponent: 'TimeClockSlots',
44
+ TimeClockSlotsComponentsProps: 'TimeClockSlotProps',
45
+ TimePickerSlotsComponents: 'TimePickerSlots',
46
+ TimePickerSlotsComponentsProps: 'TimePickerSlotProps',
47
+ DateRangeCalendarSlotsComponent: 'DateRangeCalendarSlots',
48
+ DateRangeCalendarSlotsComponentsProps: 'DateRangeCalendarSlotProps',
49
+ DateRangePickerSlotsComponents: 'DateRangePickerSlots',
50
+ DateRangePickerSlotsComponentsProps: 'DateRangePickerSlotProps',
51
+ DesktopDateRangePickerSlotsComponent: 'DesktopDateRangePickerSlots',
52
+ DesktopDateRangePickerSlotsComponentsProps: 'DesktopDateRangePickerSlotProps',
53
+ MobileDateRangePickerSlotsComponent: 'MobileDateRangePickerSlots',
54
+ MobileDateRangePickerSlotsComponentsProps: 'MobileDateRangePickerSlotProps',
55
+ StaticDateRangePickerSlotsComponent: 'StaticDateRangePickerSlots',
56
+ StaticDateRangePickerSlotsComponentsProps: 'StaticDateRangePickerSlotProps',
57
+ // Next elements are internal types
58
+ DayCalendarSlotsComponent: 'DayCalendarSlots',
59
+ DayCalendarSlotsComponentsProps: 'DayCalendarSlotProps',
60
+ SingleInputTimeRangeFieldSlotsComponent: 'SingleInputTimeRangeFieldSlots',
61
+ SingleInputTimeRangeFieldSlotsComponentsProps: 'SingleInputTimeRangeFieldSlotProps',
62
+ SingleInputDateRangeFieldSlotsComponentsProps: 'SingleInputDateRangeFieldSlotProps',
63
+ SingleInputDateRangeFieldSlotsComponent: 'SingleInputDateRangeFieldSlots',
64
+ SingleInputDateTimeRangeFieldSlotsComponent: 'SingleInputDateTimeRangeFieldSlots',
65
+ SingleInputDateTimeRangeFieldSlotsComponentsProps: 'SingleInputDateTimeRangeFieldSlotProps',
66
+ UseMobileRangePickerSlotsComponent: 'UseMobileRangePickerSlots',
67
+ UseMobileRangePickerSlotsComponentsProps: 'UseMobileRangePickerSlotProps',
68
+ BaseDateRangePickerSlotsComponent: 'BaseDateRangePickerSlots',
69
+ BaseDateRangePickerSlotsComponentsProps: 'BaseDateRangePickerSlotProps',
70
+ PickersArrowSwitcherSlotsComponent: 'PickersArrowSwitcherSlots',
71
+ PickersArrowSwitcherSlotsComponentsProps: 'PickersArrowSwitcherSlotProps',
72
+ PickersArrowSwitcherComponentsPropsOverrides: 'PickersArrowSwitcherSlotPropsOverrides',
73
+ UseStaticRangePickerSlotsComponent: 'UseStaticRangePickerSlots',
74
+ UseStaticRangePickerSlotsComponentsProps: 'UseStaticRangePickerSlotProps',
75
+ PickersModalDialogSlotsComponent: 'PickersModalDialogSlots',
76
+ PickersModalDialogSlotsComponentsProps: 'PickersModalDialogSlotProps',
77
+ RangePickerFieldSlotsComponent: 'RangePickerFieldSlots',
78
+ RangePickerFieldSlotsComponentsProps: 'RangePickerFieldSlotProps',
79
+ FieldSlotsComponents: 'FieldSlots',
80
+ FieldSlotsComponentsProps: 'FieldSlotProps',
81
+ PickersPopperSlotsComponent: 'PickersPopperSlots',
82
+ PickersPopperSlotsComponentsProps: 'PickersPopperSlotProps',
83
+ UseDesktopRangePickerSlotsComponent: 'UseDesktopRangePickerSlots',
84
+ UseDesktopRangePickerSlotsComponentsProps: 'UseDesktopRangePickerSlotProps',
85
+ MultiInputFieldSlotRootProps: 'MultiInputFieldSlotRootProps',
86
+ MultiInputFieldSlotTextFieldProps: 'MultiInputFieldSlotTextFieldProps',
87
+ UseDesktopPickerSlotsComponent: 'UseDesktopPickerSlots',
88
+ UseDesktopPickerSlotsComponentsProps: 'UseDesktopPickerSlotProps',
89
+ ExportedUseDesktopPickerSlotsComponentsProps: 'ExportedUseDesktopPickerSlotProps',
90
+ BaseDatePickerSlotsComponent: 'BaseDatePickerSlots',
91
+ BaseDatePickerSlotsComponentsProps: 'BaseDatePickerSlotProps',
92
+ UseStaticPickerSlotsComponent: 'UseStaticPickerSlots',
93
+ UseStaticPickerSlotsComponentsProps: 'UseStaticPickerSlotProps',
94
+ BaseDateTimePickerSlotsComponent: 'BaseDateTimePickerSlots',
95
+ BaseDateTimePickerSlotsComponentsProps: 'BaseDateTimePickerSlotProps',
96
+ BaseTimePickerSlotsComponent: 'BaseTimePickerSlots',
97
+ BaseTimePickerSlotsComponentsProps: 'BaseTimePickerSlotProps',
98
+ UseMobilePickerSlotsComponent: 'UseMobilePickerSlots',
99
+ UseMobilePickerSlotsComponentsProps: 'UseMobilePickerSlotProps',
100
+ ExportedUseMobilePickerSlotsComponentsProps: 'ExportedUseMobilePickerSlotProps',
101
+ DateTimeFieldSlotsComponent: 'DateTimeFieldSlots',
102
+ DateTimeFieldSlotsComponentsProps: 'DateTimeFieldSlotProps',
103
+ TimeFieldSlotsComponent: 'TimeFieldSlots',
104
+ TimeFieldSlotsComponentsProps: 'TimeFieldSlotProps',
105
+ DateFieldSlotsComponent: 'DateFieldSlots',
106
+ DateFieldSlotsComponentsProps: 'DateFieldSlotProps',
107
+ MultiInputDateRangeFieldSlotsComponent: 'MultiInputDateRangeFieldSlots',
108
+ MultiInputDateRangeFieldSlotsComponentsProps: 'MultiInputDateRangeFieldSlotProps',
109
+ MultiInputDateTimeRangeFieldSlotsComponent: 'MultiInputDateTimeRangeFieldSlots',
110
+ MultiInputDateTimeRangeFieldSlotsComponentsProps: 'MultiInputDateTimeRangeFieldSlotProps',
111
+ MultiInputTimeRangeFieldSlotsComponent: 'MultiInputTimeRangeFieldSlots',
112
+ MultiInputTimeRangeFieldSlotsComponentsProps: 'MultiInputTimeRangeFieldSlotProps'
113
+ };
114
+ const matchImport = path => (path.node.source.value?.toString() ?? '').match(PACKAGE_REGEXP);
115
+ function transformer(file, api, options) {
116
+ const j = api.jscodeshift;
117
+ const root = j(file.source);
118
+ const printOptions = options.printOptions || {
119
+ quote: 'single',
120
+ trailingComma: true
121
+ };
122
+ const matchingImports = root.find(j.ImportDeclaration).filter(path => !!matchImport(path));
123
+
124
+ // Rename the import specifiers
125
+ // - import { DayCalendarSlotsComponent } from '@mui/x-date-pickers'
126
+ // + import { DayCalendarSlots } from '@mui/x-date-pickers'
127
+ matchingImports.find(j.ImportSpecifier).filter(path => Object.keys(rename).includes(path.node.imported.name)).replaceWith(path => j.importSpecifier(j.identifier(rename[path.node.imported.name]), path.value.local));
128
+
129
+ // Rename the import usage
130
+ // - DayCalendarSlotsComponent
131
+ // + DayCalendarSlots
132
+ root.find(j.Identifier).filter(path => Object.keys(rename).includes(path.node.name)).replaceWith(path => j.identifier(rename[path.node.name]));
133
+ return root.toSource(printOptions);
134
+ }