@mui/x-codemod 8.27.0 → 9.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/CHANGELOG.md CHANGED
@@ -1,9 +1,261 @@
1
1
  # Changelog
2
2
 
3
- > For full v8 changelog, please refer to the [v.8x branch](https://github.com/mui/mui-x/blob/v8.x/CHANGELOG.md).
3
+ ## 9.0.0-alpha.0
4
4
 
5
- All notable changes to this project will be documented in this file.
6
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+ _Feb 16, 2026_
6
+
7
+ We'd like to extend a big thank you to the 21 contributors who made this release possible. Here are some highlights ✨:
8
+
9
+ - Add support for virtualized items on `<RichTreeViewPro />`:
10
+
11
+ ```tsx
12
+ <RichTreeViewPro items={ITEMS} virtualization itemHeight={48} />
13
+ ```
14
+
15
+ - Add Thai (`thTH`) locale on the Data Grid and the Date and Time Pickers (#21116) @siriwatknp
16
+ - Add a new `AdapterDayjsBuddhist` adapter for Date and Time Pickers (#20984) @siriwatknp
17
+ - Add support for virtualization in the rich tree view (#20780) @flaviendelangle
18
+ - Add WebGL renderer to Heatmap (#20756) @bernardobelchior
19
+
20
+ Special thanks go out to these community members for their valuable contributions:
21
+ @jhe-iqbis
22
+
23
+ The following team members contributed to this release:
24
+ @alexfauquette, @arminmeh, @bernardobelchior, @brijeshb42, @cherniavskii, @dav-is, @flaviendelangle, @Janpot, @JCQuintas, @mapache-salvaje, @MBilalShafi, @michelengelen, @mj12albert, @noraleonte, @oliviertassinari, @rita-codes, @romgrk, @sai6855, @siriwatknp
25
+
26
+ ### Data Grid
27
+
28
+ #### `@mui/x-data-grid@9.0.0-alpha.0`
29
+
30
+ - [DataGrid] Update default `logicOperator` behavior in filtering docs (#21098) @michelengelen
31
+ - [DataGrid] Add `thTH` locale (#21116) @siriwatknp
32
+ - [DataGrid] Fix initial filter value state in CustomMultiValueOperator demo (#21217) @sai6855
33
+
34
+ #### `@mui/x-data-grid-pro@9.0.0-alpha.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
35
+
36
+ Same changes as in `@mui/x-data-grid@9.0.0-alpha.0`, plus:
37
+
38
+ - [DataGridPro] Cleanup outdated rows on `dataSource` reference update (#21138) @MBilalShafi
39
+
40
+ #### `@mui/x-data-grid-premium@9.0.0-alpha.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
41
+
42
+ Same changes as in `@mui/x-data-grid-pro@9.0.0-alpha.0`.
43
+
44
+ ### Date and Time Pickers
45
+
46
+ #### `@mui/x-date-pickers@9.0.0-alpha.0`
47
+
48
+ - [pickers] Add `AdapterDayjsBuddhist` adapter (#20984) @siriwatknp
49
+ - [pickers] Add `thTH` locale (#21116) @siriwatknp
50
+
51
+ #### `@mui/x-date-pickers-pro@9.0.0-alpha.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
52
+
53
+ Same changes as in `@mui/x-date-pickers@9.0.0-alpha.0`.
54
+
55
+ ### Charts
56
+
57
+ #### `@mui/x-charts@9.0.0-alpha.0`
58
+
59
+ - [charts] Add Legend actions (#20404) @JCQuintas
60
+ - [charts] Add `Chart` suffix to MUI Classes (#21042) @JCQuintas
61
+ - [charts] Add `axesGap` props to put space between axes (#20904) @alexfauquette
62
+ - [charts] Add `cleanIdentifier` function to charts series instance (#20832) @JCQuintas
63
+ - [charts] Add `initialHiddenItems` prop to set initial state (#20894) @JCQuintas
64
+ - [charts] Add `useXAxisCoordinates` and `useYAxisCoordinates` hooks (#20972) @bernardobelchior
65
+ - [charts] Add axis slots and expose axis ticks hooks (#20935) @bernardobelchior
66
+ - [charts] Change `line` legend marker to be a line (#21059) @JCQuintas
67
+ - [charts] Codemod test pattern with function (#21111) @JCQuintas
68
+ - [charts] Control the item tooltip (#20617) @alexfauquette
69
+ - [charts] Enable keyboard navigation in radar chart (#20765) @alexfauquette
70
+ - [charts] Export `CartesianChartSeriesType` and `StackableChartSeriesType` (#21012) @bernardobelchior
71
+ - [charts] Export plugins from premium (#20866) @JCQuintas
72
+ - [charts] Filter hidden series from axis tooltip (#21273) @Copilot
73
+ - [charts] Filter hidden series from axis tooltip (#21273) @Copilot
74
+ - [charts] Fix rename `getSVGPoint` to `getChartPoint` (#21335) @bernardobelchior
75
+ - [charts] Fix cleanup function in useChartInteractionListener to correctly remove event listeners with options (#21218) @sai6855
76
+ - [charts] Fix import rename in codemod (#21112) @JCQuintas
77
+ - [charts] Fix multiple exports of `HighlightScope` (#21270) @bernardobelchior
78
+ - [charts] Fix test inconsistency in charts (#20907) @JCQuintas
79
+ - [charts] Fix tooltip position for stacked line series (#20901) @alexfauquette
80
+ - [charts] Make Highlight scope a generic (#21189) @alexfauquette
81
+ - [charts] Make `LegendItemParams.type` required (#21003) @alexfauquette
82
+ - [charts] Make `seriesId` a string only (#20997) @alexfauquette
83
+ - [charts] Make the `useChartRootRef` support typing parameter (#21023) @alexfauquette
84
+ - [charts] Memoize HeatmapItem to avoid re-render when fading/highlighting (#20865) @bernardobelchior
85
+ - [charts] Move axis id to `data-axis-id` attribute instead of class (#21037) @JCQuintas
86
+ - [charts] Move `cleanIdentifier` and `serializeIdentifier` instance methods to `useChartSeriesConfig` plugin (#21025) @JCQuintas
87
+ - [charts] Move `seriesConfig` to `useChartSeriesConfig` plugin (#21004) @JCQuintas
88
+ - [charts] Move element refs to `useChartElementRef` plugin (#21099) @JCQuintas
89
+ - [charts] Move types related to `seriesConfig` into the `useChartSeriesConfig` plugin folder (#21026) @JCQuintas
90
+ - [charts] Remove `data-has-focused-item` from `ChartsSurface` (#21255) @bernardobelchior
91
+ - [charts] Remove default generic of item identifiers (#21182) @alexfauquette
92
+ - [charts] Remove deprecated `id` from `LegendItemParams` (#21055) @alexfauquette
93
+ - [charts] Remove deprecated `ChartApi` export from `ChartContainer` (#20975) @JCQuintas
94
+ - [charts] Remove deprecated `useAxisTooltip` in favor of `useAxesTooltip` (#20962) @Copilot
95
+ - [charts] Remove deprecated series type helpers and functions (#20998) @alexfauquette
96
+ - [charts] Rename `ChartContainer` to `ChartsContainer` (#21173) @JCQuintas
97
+ - [charts] Rename `getSVGPoint` to `getChartPoint` (#21322) @bernardobelchior
98
+ - [charts] Rename `TickItemType` to `TickItem` (#21008) @bernardobelchior
99
+ - [charts] Replace props `id` by `seriesId` when necessary (#21057) @alexfauquette
100
+ - [charts] Revert `touch-action: pan-y` removal when zoom is disabled (#20852) @bernardobelchior
101
+ - [charts] The `useXxxSeries([])` return empty array (#21001) @alexfauquette
102
+ - [charts] Use `NumberValue` in domain limit function (#21054) @JCQuintas
103
+
104
+ #### `@mui/x-charts-pro@9.0.0-alpha.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
105
+
106
+ Same changes as in `@mui/x-charts@9.0.0-alpha.0`, plus:
107
+
108
+ - [charts-pro] Add border radius to heatmap (#20931) @bernardobelchior
109
+ - [charts-pro] Add keyboard navigation to funnel (#20766) @alexfauquette
110
+ - [charts-pro] Add keyboard navigation to heatmap (#20786) @alexfauquette
111
+ - [charts-pro] Add keyboard navigation to sankey (#20777) @alexfauquette
112
+ - [charts-pro] Fix Heatmap's `onItemClick` not triggering (#21016) @bernardobelchior
113
+ - [charts-pro] Fix crash when two same-direction axes have a zoom preview (#20916) @bernardobelchior
114
+ - [charts-pro] Handle edge case in export image (#21190) @bernardobelchior
115
+ - [charts-pro] Prefer global pointer interaction tracker in Heatmap (#20697) @bernardobelchior
116
+ - [charts-pro] Support composition for Sankey (#20604) @alexfauquette
117
+ - [charts-pro] Update Heatmap identifier (#21124) @alexfauquette
118
+ - [charts-pro] Update default value of `hideLegend` prop in `Heatmap` (#20961) @Copilot
119
+
120
+ #### `@mui/x-charts-premium@9.0.0-alpha.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
121
+
122
+ Same changes as in `@mui/x-charts-pro@9.0.0-alpha.0`, plus:
123
+
124
+ - [charts-premium] Add WebGL renderer to Heatmap (#20756) @bernardobelchior
125
+ - [charts-premium] Add `ChartContainerPremium` (#20910) @bernardobelchior
126
+ - [charts-premium] Add `HeatmapPremium` (#20930) @bernardobelchior
127
+ - [charts-premium] Add keyboard navigation to range-bar (#21272) @alexfauquette
128
+ - [charts-premium] Extract `HeatmapSVGPlot` from `HeatmapPlot` component (#21015) @bernardobelchior
129
+ - [charts-premium] Fix `ChartDataProviderPremium` tests (#20868) @bernardobelchior
130
+ - [charts-premium] Fix links in comments for chart containers and data providers (#21105) @bernardobelchior
131
+
132
+ ### Tree View
133
+
134
+ #### `@mui/x-tree-view@9.0.0-alpha.0`
135
+
136
+ _No changes._
137
+
138
+ #### `@mui/x-tree-view-pro@9.0.0-alpha.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
139
+
140
+ Same changes as in `@mui/x-tree-view@9.0.0-alpha.0`, plus:
141
+
142
+ - [RichTreeViewPro] Add support for virtualization (#20780) @flaviendelangle
143
+
144
+ ### Codemod
145
+
146
+ #### `@mui/x-codemod@9.0.0-alpha.0`
147
+
148
+ - [codemod] Document and Clean the codemod utils (#21014) @alexfauquette
149
+
150
+ ### Docs
151
+
152
+ - [docs] Add focus highlight in composition snipets (#20614) @alexfauquette
153
+ - [docs] Add simple candlestick chart demo (#20912) @bernardobelchior
154
+ - [docs] Fix Waterfall Chart documentation badge from Pro to Premium (#20888) @Copilot
155
+ - [docs] Fix broken links on Data Grid Editing sub-pages (#20911) @arminmeh
156
+ - [docs] Fix docs API for HeatmapPremium (#21137) @alexfauquette
157
+ - [docs] Fix horizontal overflow in heatmap docs (#20968) @bernardobelchior
158
+ - [docs] Move Range Bar Chart to existing charts (#21120) @bernardobelchior
159
+ - [docs] Prepare the scheduler doc for the alpha (#21268) @flaviendelangle
160
+ - [docs] Rewording of the heatmap item click (#20987) @alexfauquette
161
+ - [scheduler][docs] Create the Quickstart page (#20913) @flaviendelangle
162
+ - [charts][docs] Revise the Charts CSP doc (#20906) @mapache-salvaje
163
+ - [charts][docs] Revise the Charts Composition doc (#20032) @mapache-salvaje
164
+ - [charts][docs] Revise the Charts Hooks Overview doc (#20921) @mapache-salvaje
165
+ - [charts][docs] Revise the Charts Legend doc (#20821) @mapache-salvaje
166
+ - [charts][docs] Revise the Charts Localization doc (#20800) @mapache-salvaje
167
+ - [charts][docs] Revise the Charts Plugins doc (#20933) @mapache-salvaje
168
+ - [charts][docs] Revise the Charts Stacking doc (#20830) @mapache-salvaje
169
+ - [charts][docs] Revise the Charts Styling doc (#20835) @mapache-salvaje
170
+ - [charts][docs] Revise the Charts Toolbar doc (#20867) @mapache-salvaje
171
+ - [charts][docs] Revise the Charts Tooltip doc (#20869) @mapache-salvaje
172
+ - [charts][docs] Revise the Charts Zoom and Pan doc (#20893) @mapache-salvaje
173
+ - [DataGrid][docs] Add a recipe for handling long text cell (#20754) @siriwatknp
174
+ - [DataGrid][docs] Add high-level competitor comparison to Overview doc (DX-117) (#20870) @mapache-salvaje
175
+ - [DataGrid][docs] Remove Bundling section from quickstart (#21177) @MBilalShafi
176
+
177
+ ### Core
178
+
179
+ - [code-infra] Add `MUI_TEST_ENV` global (#21187) @Janpot
180
+ - [code-infra] Fix `material-ui/disallow-react-api-in-server-components` (#20909) @JCQuintas
181
+ - [code-infra] Fix `renameImports` codemod not preserving comments (#20977) @JCQuintas
182
+ - [code-infra] Fix the label comparison to use lower case (#20934) @brijeshb42
183
+ - [code-infra] Github action to sync title and label (#20922) @brijeshb42
184
+ - [code-infra] Ignore scheduler demo with random data (#20982) @JCQuintas
185
+ - [code-infra] Improve `codemod` testing setup (#20981) @JCQuintas
186
+ - [code-infra] Only ignore renovate[bot] in changelog generation script (#21185) @bernardobelchior
187
+ - [code-infra] Prepare for v9 (#20860) @JCQuintas
188
+ - [code-infra] Set `rasterizehtml` version in pnpm catalog (#21175) @bernardobelchior
189
+ - [code-infra] Update codeowners (#20886) @JCQuintas
190
+ - [code-infra] V9 preparation (#20928) @JCQuintas
191
+ - [code-infra] eslint rule rename (#21172) @Janpot
192
+ - [code-infra][docs] V9 charts migration doc kickoff (#20973) @JCQuintas
193
+ - [docs-infra] Add Cookie Banner and Analytics Provider (#21228) @dav-is
194
+ - [docs-infra] Fix missing slots section on API page (#20915) @Janpot
195
+ - [docs-infra] Fix two broken links (#20914) @Janpot
196
+ - [docs-infra] Port demo changes (#20971) @Janpot
197
+ - [internal] Add information about codemods to AGENTS.md (#21011) @bernardobelchior
198
+ - [internal] Fix codemod versioning instructions in `AGENTS.md` (#21024) @bernardobelchior
199
+ - [internal] Fix missing generated props in master (#21142) @bernardobelchior
200
+ - [internal] Headless sorting plugin (#21089) @arminmeh
201
+ - [internal] Remove duplicate code (#20896) @oliviertassinari
202
+
203
+ ### Miscellaneous
204
+
205
+ - Bump next to ^15.5.11 (#21171) @Copilot
206
+ - [core] Fix CI (#21223) @flaviendelangle
207
+ - [PoC] Headless data grid (#20645) @cherniavskii
208
+
209
+ ## v8.27.1
210
+
211
+ _Feb 13, 2026_
212
+
213
+ We'd like to extend a big thank you to the 6 contributors who made this release possible. Here are some highlights ✨:
214
+
215
+ - 📝 CSS bundler support is no longer needed for the Data Grid
216
+ - 🐞 Bugfixes
217
+
218
+ Special thanks go out to these community members for their valuable contributions:
219
+ @sai6855
220
+
221
+ The following team members contributed to this release:
222
+ @arminmeh, @cherniavskii, @flaviendelangle, @mj12albert, @MBilalShafi
223
+
224
+ ### Data Grid
225
+
226
+ #### `@mui/x-data-grid@8.27.1`
227
+
228
+ - [DataGrid] Hide column menu icon when there are no items (#21303) @MBilalShafi
229
+ - [DataGrid] Migrate styled imports and remove `index.css` (#21176) @MBilalShafi
230
+ - [DataGrid] Optimize `GridRootStyles` overrides resolver (#21251) @sai6855
231
+
232
+ #### `@mui/x-data-grid-pro@8.27.1` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
233
+
234
+ Same changes as in `@mui/x-data-grid@8.27.1`, plus:
235
+
236
+ - [DataGridPro] Fix column pinning issue with `restoreState` (#21305) @MBilalShafi
237
+ - [DataGridPro] Fix lazy loading params for page with one row (#21238) @MBilalShafi
238
+ - [DataGridPro] Properly extract parent path (#21301) @arminmeh
239
+
240
+ #### `@mui/x-data-grid-premium@8.27.1` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
241
+
242
+ Same changes as in `@mui/x-data-grid-pro@8.27.1`, plus:
243
+
244
+ - [DataGridPremium] Fix aggregation display when `initialState` has both `sortModel` and `pinnedColumns` (#21152) @mj12albert
245
+
246
+ ### Tree View
247
+
248
+ #### `@mui/x-tree-view@8.27.1`
249
+
250
+ - [tree view] Fix `apiRef.current.setItemExpansion()` (#21095) @flaviendelangle
251
+
252
+ #### `@mui/x-tree-view-pro@8.27.1` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
253
+
254
+ Same changes as in `@mui/x-tree-view@8.27.1`.
255
+
256
+ ### Core
257
+
258
+ - [internal] Add CLI for translation using LLM (#21299) @cherniavskii
7
259
 
8
260
  ## v8.27.0
9
261
 
package/README.md CHANGED
@@ -57,6 +57,114 @@ through jscodeshift's `printOptions` command line argument
57
57
  npx @mui/x-codemod <transform> <path> --jscodeshift="--printOptions='{\"quote\":\"double\"}'"
58
58
  ```
59
59
 
60
+ ## v9.0.0
61
+
62
+ ### 🚀 `preset-safe` for v9.0.0
63
+
64
+ A combination of all important transformers for migrating v8 to v9.
65
+ ⚠️ This codemod should be run only once.
66
+ It runs codemods for all MUI X packages.
67
+ To run codemods for a specific package, refer to the respective section.
68
+
69
+ <!-- #npm-tag-reference -->
70
+
71
+ ```bash
72
+ npx @mui/x-codemod@next v9.0.0/preset-safe <path|folder>
73
+ ```
74
+
75
+ The corresponding sub-sections are listed below
76
+
77
+ <!-- - [`preset-safe-for-tree-view`](#preset-safe-for-tree-view-v900) -->
78
+ <!-- - [`preset-safe-for-data-grid`](#preset-safe-for-data-grid-v900) -->
79
+ <!-- - [`preset-safe-for-pickers`](#preset-safe-for-pickers-v900) -->
80
+
81
+ - [`preset-safe-for-charts`](#preset-safe-for-charts-v900)
82
+
83
+ ### Charts codemods
84
+
85
+ #### 🚀 `preset-safe` for Charts v9.0.0
86
+
87
+ The `preset-safe` codemods for Charts.
88
+
89
+ <!-- #npm-tag-reference -->
90
+
91
+ ```bash
92
+ npx @mui/x-codemod@next v9.0.0/charts/preset-safe <path|folder>
93
+ ```
94
+
95
+ The list includes these transformers
96
+
97
+ - [`replace-heatmap-hide-legend-false`](#replace-heatmap-hide-legend-false)
98
+ - [`rename-chart-api-import`](#rename-chart-api-import)
99
+ - [`rename-id-to-series-id`](#rename-id-to-series-id)
100
+
101
+ ### `replace-heatmap-hide-legend-false`
102
+
103
+ The default value of the `hideLegend` prop in the `Heatmap` component has changed from `true` to `false` in v9. This improves consistency across chart components and developer experience.
104
+
105
+ ```diff
106
+ <Heatmap
107
+ + hideLegend
108
+ />
109
+ ```
110
+
111
+ ### `rename-axis-tooltip-hook`
112
+
113
+ The `useAxisTooltip()` hook has been renamed to `useAxesTooltip()` to better reflect its functionality of handling multiple axes.
114
+
115
+ ```diff
116
+ -import { useAxisTooltip, UseAxisTooltipReturnValue, UseAxisTooltipParams } from '@mui/x-charts';
117
+ +import { useAxesTooltip, UseAxesTooltipReturnValue, UseAxesTooltipParams } from '@mui/x-charts';
118
+ ```
119
+
120
+ The hook now always returns an array of tooltip data (one entry per active axis) instead of a single object.
121
+ The `multipleAxes` parameter has been removed since the hook now always supports multiple axes.
122
+
123
+ After running the codemod to do the renaming make sure to adapt the hook returned value to your needs.
124
+
125
+ ```diff
126
+ function CustomTooltip() {
127
+ // If you want to keep only one axis
128
+ - const tooltipData = useAxisTooltip();
129
+ + const tooltipData = useAxesTooltip()[0] ?? null;
130
+ // If you use all the axes
131
+ - const tooltipData = useAxisTooltip({ multipleAxes: true });
132
+ + const tooltipData = useAxesTooltip();
133
+ }
134
+ ```
135
+
136
+ ### `rename-chart-api-import`
137
+
138
+ Moves the `ChartApi` type import from `@mui/x-charts/ChartContainer` to `@mui/x-charts/context`.
139
+
140
+ ```diff
141
+ -import type { ChartApi } from '@mui/x-charts/ChartContainer';
142
+ +import type { ChartApi } from '@mui/x-charts/context';
143
+ ```
144
+
145
+ #### `rename-id-to-series-id`
146
+
147
+ Rename the props `id` to `seriesId`.
148
+
149
+ ```diff
150
+ - <PieArc id='series-a' />
151
+ + <PieArc seriesId='series-a' />
152
+ ```
153
+
154
+ Here is the list of slots and components that are impacted by the renaming:
155
+
156
+ | slot | Component |
157
+ | :------------ | :--------------------------------------- |
158
+ | pieArc | PieArc |
159
+ | | PieArcPlot |
160
+ | pieArcLabel | PieArcLabel |
161
+ | | PieArcLabelPlot |
162
+ | bar | BarElement, AnimatedRangeBarElementProps |
163
+ | area | AnimatedArea, AreaElement |
164
+ | line | AnimatedLine, LineElement |
165
+ | mark | MarkElement |
166
+ | lineHighlight | LineHighlightElement |
167
+
60
168
  ## v8.0.0
61
169
 
62
170
  ### 🚀 `preset-safe` for v8.0.0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-codemod",
3
- "version": "8.27.0",
3
+ "version": "9.0.0-alpha.0",
4
4
  "author": "MUI Team",
5
5
  "description": "Codemod scripts for MUI X.",
6
6
  "bin": "./codemod.js",
@@ -24,12 +24,12 @@
24
24
  "url": "https://opencollective.com/mui-org"
25
25
  },
26
26
  "dependencies": {
27
- "@babel/core": "^7.28.5",
28
- "@babel/runtime": "^7.28.4",
29
- "@babel/traverse": "^7.28.5",
27
+ "@babel/core": "^7.29.0",
28
+ "@babel/runtime": "^7.28.6",
29
+ "@babel/traverse": "^7.29.0",
30
30
  "jscodeshift": "17.3.0",
31
31
  "yargs": "^18.0.0",
32
- "@mui/x-internals": "8.26.0"
32
+ "@mui/x-internals": "9.0.0-alpha.0"
33
33
  },
34
34
  "sideEffects": false,
35
35
  "publishConfig": {
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = addProp;
7
+ /**
8
+ * Adds a prop to specified JSX components in the AST.
9
+ *
10
+ * Can be configured to only add the prop if it is absent.
11
+ */
12
+ function addProp({
13
+ j,
14
+ root,
15
+ componentNames,
16
+ propName,
17
+ propValue,
18
+ position
19
+ }) {
20
+ return root.find(j.JSXElement).filter(path => {
21
+ return componentNames.includes(path.value.openingElement.name.name);
22
+ }).forEach(path => {
23
+ const hasProp = path.value.openingElement.attributes?.some(attr => {
24
+ return attr.type === 'JSXAttribute' && attr.name.name === propName;
25
+ });
26
+ if (!hasProp) {
27
+ const fn = position === 'start' ? 'unshift' : 'push';
28
+ path.value.openingElement.attributes?.[fn](j.jsxAttribute(j.jsxIdentifier(propName), typeof propValue === 'boolean' && propValue ? null : j.jsxExpressionContainer(j.literal(propValue))));
29
+ }
30
+ });
31
+ }
@@ -5,6 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = removeObjectProperty;
7
7
  const getAttributeName = attribute => attribute.name.type === 'JSXIdentifier' ? attribute.name.name : attribute.name.name.name;
8
+ /**
9
+ * Removes a property from an object prop in specified components.
10
+ * If the object only contains that property, the whole prop is removed.
11
+ */
8
12
  function removeObjectProperty({
9
13
  root,
10
14
  propName,
@@ -4,6 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = removeProps;
7
+ /**
8
+ * Removes specified props from given components.
9
+ */
7
10
  function removeProps({
8
11
  root,
9
12
  componentNames,
@@ -12,6 +12,11 @@ const getSlotsTranslation = translations => {
12
12
  });
13
13
  return lowercasedTranslation;
14
14
  };
15
+
16
+ /**
17
+ * Replace the components / componentsProps by their equivalent slots / slotProps.
18
+ * Only used for v6 -> v7 migration.
19
+ */
15
20
  function renameComponentsSlots({
16
21
  root,
17
22
  componentNames,
@@ -23,9 +23,13 @@ const getMatchingNestedImport = (path, parameters) => {
23
23
  };
24
24
  const getMatchingRootImport = (path, parameters) => {
25
25
  return parameters.imports.find(importConfig => {
26
- return !importConfig.skipRoot && importConfig.importsMapping.hasOwnProperty(path.node.imported.name);
26
+ return importConfig.importsMapping.hasOwnProperty(path.node.imported.name);
27
27
  });
28
28
  };
29
+
30
+ /**
31
+ * Rename import paths, identifiers and usages based on a renaming configuration.
32
+ */
29
33
  function renameImports(parameters) {
30
34
  const {
31
35
  j,
@@ -105,15 +109,50 @@ function renameImports(parameters) {
105
109
  }
106
110
  return !!getMatchingNestedImport(path, parameters)?.newEndpoint;
107
111
  }).replaceWith(path => {
112
+ const importConfig = getMatchingNestedImport(path, parameters);
108
113
  const pathStr = getPathStrFromPath(path);
109
114
  const oldEndpoint = getRelativeEndpointFromPathStr(pathStr, parameters.packageNames);
110
- const newEndpoint = getMatchingNestedImport(path, parameters).newEndpoint;
115
+ const newEndpoint = importConfig.newEndpoint;
111
116
  const newPathStr = pathStr.replace(oldEndpoint, newEndpoint);
112
- return j.importDeclaration(
113
- // Copy over the existing import specifiers
114
- path.node.specifiers,
115
- // Replace the source with our new source
116
- j.stringLiteral(newPathStr));
117
+
118
+ // Handle splitting when splitUnmatchedSpecifiers is enabled
119
+ if (importConfig.splitUnmatchedSpecifiers) {
120
+ const specifiers = path.node.specifiers ?? [];
121
+ const specifiersToMove = [];
122
+ const specifiersToKeep = [];
123
+ for (const specifier of specifiers) {
124
+ if (specifier.type === 'ImportSpecifier' && importConfig.importsMapping.hasOwnProperty(specifier.imported.name)) {
125
+ specifiersToMove.push(specifier);
126
+ } else {
127
+ specifiersToKeep.push(specifier);
128
+ }
129
+ }
130
+
131
+ // If no specifiers match, don't change anything
132
+ if (specifiersToMove.length === 0) {
133
+ return path.node;
134
+ }
135
+
136
+ // If all specifiers match, just update the path in place (no split needed)
137
+ if (specifiersToKeep.length === 0) {
138
+ path.node.source = j.stringLiteral(newPathStr);
139
+ return path.node;
140
+ }
141
+
142
+ // Split: modify current node to keep unmatched specifiers, insert new node for matched ones
143
+ const moveNode = j.importDeclaration(specifiersToMove, j.stringLiteral(newPathStr));
144
+
145
+ // Insert the new import after the current one
146
+ j(path).insertAfter(moveNode);
147
+
148
+ // Update the current node in place to only keep the unmatched specifiers
149
+ path.node.specifiers = specifiersToKeep;
150
+ return path.node;
151
+ }
152
+
153
+ // Default behavior: move all specifiers to the new endpoint (modify in place)
154
+ path.node.source = j.stringLiteral(newPathStr);
155
+ return path.node;
117
156
  });
118
157
 
119
158
  // Rename the import usage
@@ -4,6 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = renameNestedProps;
7
+ /**
8
+ * Allow to rename object properties inside props of specified components.
9
+ */
7
10
  function renameNestedProps({
8
11
  root,
9
12
  componentNames,
@@ -1,12 +1,10 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = transform;
9
- var _renameCSSClasses = _interopRequireDefault(require("../../../util/renameCSSClasses"));
10
8
  var _renameIdentifiers = _interopRequireWildcard(require("../../../util/renameIdentifiers"));
11
9
  const renamedIdentifiers = {
12
10
  GridLinkOperator: 'GridLogicOperator',
@@ -51,10 +49,26 @@ const preRequisiteUsages = {
51
49
  const renamedLiterals = {
52
50
  filterPanelLinkOperator: 'filterPanelLogicOperator'
53
51
  };
54
- const renamedClasses = {
55
- 'MuiDataGrid-filterFormLinkOperatorInput': 'MuiDataGrid-filterFormLogicOperatorInput',
56
- 'MuiDataGrid-withBorder': 'MuiDataGrid-withBorderColor'
57
- };
52
+ /**
53
+ * Renames CSS classes when they are literals based on the provided mapping.
54
+ */
55
+ function renameCSSClasses({
56
+ root,
57
+ j
58
+ }) {
59
+ const renamedClasses = {
60
+ 'MuiDataGrid-filterFormLinkOperatorInput': 'MuiDataGrid-filterFormLogicOperatorInput',
61
+ 'MuiDataGrid-withBorder': 'MuiDataGrid-withBorderColor'
62
+ };
63
+ root.find(j.Literal).filter(path => !!Object.keys(renamedClasses).find(className => {
64
+ const literal = path.node.value;
65
+ return typeof literal === 'string' && literal.includes(className) && !literal.includes(renamedClasses[className]);
66
+ })).replaceWith(path => {
67
+ const literal = path.node.value;
68
+ const targetClassKey = Object.keys(renamedClasses).find(className => literal.includes(className));
69
+ return j.literal(literal.replace(targetClassKey, renamedClasses[targetClassKey]));
70
+ });
71
+ }
58
72
  function transform(file, api, options) {
59
73
  const j = api.jscodeshift;
60
74
  const root = j(file.source);
@@ -95,10 +109,9 @@ function transform(file, api, options) {
95
109
  // Rename the classes
96
110
  // - 'MuiDataGrid-filterFormLinkOperatorInput'
97
111
  // + 'MuiDataGrid-filterFormLogicOperatorInput'
98
- (0, _renameCSSClasses.default)({
112
+ renameCSSClasses({
99
113
  j,
100
- root,
101
- renamedClasses
114
+ root
102
115
  });
103
116
  }
104
117
  return root.toSource(printOptions);
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = transformer;
8
+ exports.testConfig = void 0;
9
+ var renameIdToSeriesId = _interopRequireWildcard(require("../rename-id-to-series-id"));
10
+ var renameChartApiImport = _interopRequireWildcard(require("../rename-chart-api-import"));
11
+ var replaceHeatmapHideLegend = _interopRequireWildcard(require("../replace-heatmap-hide-legend-false"));
12
+ const allModules = [
13
+ // Add other transforms here as they are created
14
+ replaceHeatmapHideLegend, renameIdToSeriesId, renameChartApiImport];
15
+ function transformer(file, api, options) {
16
+ allModules.forEach(module => {
17
+ file.source = module.default(file, api, options);
18
+ });
19
+ return file.source;
20
+ }
21
+ const testConfig = exports.testConfig = {
22
+ allModules
23
+ };
@@ -0,0 +1,53 @@
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
+ exports.testConfig = void 0;
9
+ var _path = _interopRequireDefault(require("path"));
10
+ var _readFile = _interopRequireDefault(require("../../../util/readFile"));
11
+ var _renameImports = require("../../../util/renameImports");
12
+ function transformer(file, api, options) {
13
+ const j = api.jscodeshift;
14
+ const root = j(file.source);
15
+ const printOptions = options.printOptions || {
16
+ quote: 'single',
17
+ trailingComma: true,
18
+ wrapColumn: 40
19
+ };
20
+ (0, _renameImports.renameImports)({
21
+ j,
22
+ root,
23
+ packageNames: ['@mui/x-charts', '@mui/x-charts-pro', '@mui/x-charts-premium'],
24
+ imports: [{
25
+ oldEndpoint: 'ChartsTooltip',
26
+ importsMapping: {
27
+ useAxisTooltip: 'useAxesTooltip',
28
+ UseAxisTooltipReturnValue: 'UseAxesTooltipReturnValue',
29
+ UseAxisTooltipParams: 'UseAxesTooltipParams'
30
+ }
31
+ }, {
32
+ importsMapping: {
33
+ useAxisTooltip: 'useAxesTooltip',
34
+ UseAxisTooltipReturnValue: 'UseAxesTooltipReturnValue',
35
+ UseAxisTooltipParams: 'UseAxesTooltipParams'
36
+ }
37
+ }]
38
+ });
39
+ return root.toSource(printOptions);
40
+ }
41
+ const testConfig = () => ({
42
+ name: 'rename-axis-tooltip-hook',
43
+ specFiles: [{
44
+ name: 'nested',
45
+ actual: (0, _readFile.default)(_path.default.join(__dirname, 'actual-nested-imports.spec.tsx')),
46
+ expected: (0, _readFile.default)(_path.default.join(__dirname, 'expected-nested-imports.spec.tsx'))
47
+ }, {
48
+ name: 'root',
49
+ actual: (0, _readFile.default)(_path.default.join(__dirname, 'actual-root-imports.spec.tsx')),
50
+ expected: (0, _readFile.default)(_path.default.join(__dirname, 'expected-root-imports.spec.tsx'))
51
+ }]
52
+ });
53
+ exports.testConfig = testConfig;
@@ -0,0 +1,42 @@
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
+ exports.testConfig = void 0;
9
+ var _path = _interopRequireDefault(require("path"));
10
+ var _readFile = _interopRequireDefault(require("../../../util/readFile"));
11
+ var _renameImports = require("../../../util/renameImports");
12
+ function transformer(file, api, options) {
13
+ const j = api.jscodeshift;
14
+ const root = j(file.source);
15
+ const printOptions = options.printOptions || {
16
+ quote: 'single',
17
+ trailingComma: true
18
+ };
19
+ (0, _renameImports.renameImports)({
20
+ j,
21
+ root,
22
+ packageNames: ['@mui/x-charts', '@mui/x-charts-pro', '@mui/x-charts-premium'],
23
+ imports: [{
24
+ oldEndpoint: 'ChartContainer',
25
+ newEndpoint: 'context',
26
+ importsMapping: {
27
+ ChartApi: 'ChartApi'
28
+ },
29
+ splitUnmatchedSpecifiers: true
30
+ }]
31
+ });
32
+ return root.toSource(printOptions);
33
+ }
34
+ const testConfig = () => ({
35
+ name: 'rename-chart-api-import',
36
+ specFiles: [{
37
+ name: 'imports',
38
+ actual: (0, _readFile.default)(_path.default.join(__dirname, 'actual-imports.spec.tsx')),
39
+ expected: (0, _readFile.default)(_path.default.join(__dirname, 'expected-imports.spec.tsx'))
40
+ }]
41
+ });
42
+ exports.testConfig = testConfig;
@@ -0,0 +1,37 @@
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
+ exports.testConfig = void 0;
9
+ var _path = _interopRequireDefault(require("path"));
10
+ var _readFile = _interopRequireDefault(require("../../../util/readFile"));
11
+ var _renameProps = _interopRequireDefault(require("../../../util/renameProps"));
12
+ function transformer(file, api, options) {
13
+ const j = api.jscodeshift;
14
+ const root = j(file.source);
15
+ const printOptions = options.printOptions || {
16
+ quote: 'single',
17
+ trailingComma: true
18
+ };
19
+ (0, _renameProps.default)({
20
+ j,
21
+ root,
22
+ componentNames: ['PieArc', 'PieArcPlot', 'PieArcLabel', 'PieArcLabelPlot', 'BarElement', 'AnimatedRangeBarElement', 'AnimatedArea', 'AnimatedLine', 'MarkElement', 'AreaElement', 'LineElement', 'LineHighlightElement'],
23
+ props: {
24
+ id: 'seriesId'
25
+ }
26
+ });
27
+ return root.toSource(printOptions);
28
+ }
29
+ const testConfig = () => ({
30
+ name: 'rename-id-to-series-id',
31
+ specFiles: [{
32
+ name: 'rename id to seriesId',
33
+ actual: (0, _readFile.default)(_path.default.join(__dirname, 'actual-imports.spec.tsx')),
34
+ expected: (0, _readFile.default)(_path.default.join(__dirname, 'expected-imports.spec.tsx'))
35
+ }]
36
+ });
37
+ exports.testConfig = testConfig;
@@ -0,0 +1,41 @@
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
+ exports.testConfig = void 0;
9
+ var _path = _interopRequireDefault(require("path"));
10
+ var _addProp = _interopRequireDefault(require("../../../util/addProp"));
11
+ var _readFile = _interopRequireDefault(require("../../../util/readFile"));
12
+ /**
13
+ * Codemod for v9.0.0: Updates <Heatmap /> usages to explicitly set hideLegend={true}
14
+ * if the prop is missing, to preserve v8 behavior after the default changes to false.
15
+ */
16
+
17
+ function transformer(file, api, options) {
18
+ const j = api.jscodeshift;
19
+ const root = j(file.source);
20
+ const printOptions = options.printOptions || {
21
+ quote: 'single',
22
+ trailingComma: true
23
+ };
24
+ return (0, _addProp.default)({
25
+ root,
26
+ j,
27
+ componentNames: ['Heatmap', 'HeatmapPremium'],
28
+ propName: 'hideLegend',
29
+ propValue: true,
30
+ position: 'start'
31
+ }).toSource(printOptions);
32
+ }
33
+ const testConfig = () => ({
34
+ name: 'replace-heatmap-hide-legend-false',
35
+ specFiles: [{
36
+ name: 'imports',
37
+ actual: (0, _readFile.default)(_path.default.join(__dirname, 'actual.spec.tsx')),
38
+ expected: (0, _readFile.default)(_path.default.join(__dirname, 'expected.spec.tsx'))
39
+ }]
40
+ });
41
+ exports.testConfig = testConfig;
@@ -0,0 +1,16 @@
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 _presetSafe = _interopRequireDefault(require("../charts/preset-safe"));
9
+ function transformer(file, api, options) {
10
+ [
11
+ // Add others here as they are created
12
+ _presetSafe.default].forEach(transform => {
13
+ file.source = transform(file, api, options);
14
+ });
15
+ return file.source;
16
+ }
@@ -1,54 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = propsToObject;
7
- function propsToObject({
8
- j,
9
- root,
10
- componentName,
11
- aliasName,
12
- propName,
13
- props
14
- }) {
15
- function buildObject(node, value) {
16
- const shorthand = node.value.expression && node.value.expression.name === node.name.name;
17
- const property = j.objectProperty(j.identifier(node.name.name), node.value.expression ? node.value.expression : node.value);
18
- property.shorthand = shorthand;
19
- value.push(property);
20
- return value;
21
- }
22
- const result = aliasName ? root.find(j.JSXElement, {
23
- openingElement: {
24
- name: {
25
- property: {
26
- name: componentName
27
- }
28
- }
29
- }
30
- }) : root.findJSXElements(componentName);
31
- return result.forEach(path => {
32
- // @ts-expect-error
33
- if (!aliasName || aliasName && path.node.openingElement.name.object.name === aliasName) {
34
- let propValue = [];
35
- const attributes = path.node.openingElement.attributes;
36
- attributes?.forEach((node, index) => {
37
- // Only transform whitelisted props
38
- if (node.type === 'JSXAttribute' && props.includes(node.name.name)) {
39
- propValue = buildObject(node, propValue);
40
- delete attributes[index];
41
- }
42
- });
43
- if (propValue.length > 0) {
44
- const propNameAttr = attributes?.find(attr => attr.type === 'JSXAttribute' && attr.name.name === propName);
45
- if (propNameAttr && propNameAttr.type === 'JSXAttribute') {
46
- // @ts-expect-error
47
- (propNameAttr.value.expression?.properties || []).push(...j.objectExpression(propValue).properties);
48
- } else {
49
- attributes?.push(j.jsxAttribute(j.jsxIdentifier(propName), j.jsxExpressionContainer(j.objectExpression(propValue))));
50
- }
51
- }
52
- }
53
- });
54
- }
@@ -1,20 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = renameCSSClasses;
7
- function renameCSSClasses({
8
- root,
9
- j,
10
- renamedClasses
11
- }) {
12
- root.find(j.Literal).filter(path => !!Object.keys(renamedClasses).find(className => {
13
- const literal = path.node.value;
14
- return typeof literal === 'string' && literal.includes(className) && !literal.includes(renamedClasses[className]);
15
- })).replaceWith(path => {
16
- const literal = path.node.value;
17
- const targetClassKey = Object.keys(renamedClasses).find(className => literal.includes(className));
18
- return j.literal(literal.replace(targetClassKey, renamedClasses[targetClassKey]));
19
- });
20
- }