@mui/codemod 6.4.6 → 6.4.9
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 +15 -62
- package/node/deprecations/all/deprecations-all.js +14 -1
- package/node/deprecations/rating-props/index.js +13 -0
- package/node/deprecations/rating-props/rating-props.js +25 -0
- package/node/deprecations/rating-props/test-cases/actual.js +37 -0
- package/node/deprecations/rating-props/test-cases/expected.js +53 -0
- package/node/deprecations/rating-props/test-cases/theme.actual.js +31 -0
- package/node/deprecations/rating-props/test-cases/theme.expected.js +37 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -11,8 +11,6 @@ Some of the codemods also run [postcss](https://github.com/postcss/postcss) plug
|
|
|
11
11
|
|
|
12
12
|
## Setup & run
|
|
13
13
|
|
|
14
|
-
<!-- #default-branch-switch -->
|
|
15
|
-
|
|
16
14
|
```bash
|
|
17
15
|
npx @mui/codemod@latest <codemod> <paths...>
|
|
18
16
|
|
|
@@ -1605,6 +1603,21 @@ npx @mui/codemod@latest deprecations/popper-props <path>
|
|
|
1605
1603
|
npx @mui/codemod@latest deprecations/outlined-input-props <path>
|
|
1606
1604
|
```
|
|
1607
1605
|
|
|
1606
|
+
#### `rating-props`
|
|
1607
|
+
|
|
1608
|
+
```diff
|
|
1609
|
+
<Snackbar
|
|
1610
|
+
- IconContainerComponent={CustomContainer}
|
|
1611
|
+
+ slots={{
|
|
1612
|
+
+ icon: { component: CustomContainer }
|
|
1613
|
+
+ }}
|
|
1614
|
+
/>
|
|
1615
|
+
```
|
|
1616
|
+
|
|
1617
|
+
```bash
|
|
1618
|
+
npx @mui/codemod@next deprecations/snackbar-props <path>
|
|
1619
|
+
```
|
|
1620
|
+
|
|
1608
1621
|
#### `select-classes`
|
|
1609
1622
|
|
|
1610
1623
|
JS transforms:
|
|
@@ -2580,8 +2593,6 @@ Renames `Autocomplete`'s `closeIcon` prop to `clearIcon`.
|
|
|
2580
2593
|
+<Autocomplete clearIcon={defaultClearIcon} />
|
|
2581
2594
|
```
|
|
2582
2595
|
|
|
2583
|
-
<!-- #default-branch-switch -->
|
|
2584
|
-
|
|
2585
2596
|
```bash
|
|
2586
2597
|
npx @mui/codemod@latest v5.0.0/autocomplete-rename-closeicon <path>
|
|
2587
2598
|
```
|
|
@@ -2599,8 +2610,6 @@ Renames `Autocomplete`'s `getOptionSelected` to `isOptionEqualToValue`.
|
|
|
2599
2610
|
/>
|
|
2600
2611
|
```
|
|
2601
2612
|
|
|
2602
|
-
<!-- #default-branch-switch -->
|
|
2603
|
-
|
|
2604
2613
|
```bash
|
|
2605
2614
|
npx @mui/codemod@latest v5.0.0/autocomplete-rename-option <path>
|
|
2606
2615
|
```
|
|
@@ -2618,8 +2627,6 @@ Updates the `Avatar`'s `variant` value and `classes` key from 'circle' to 'circu
|
|
|
2618
2627
|
+<Avatar classes={{ circular: 'className' }} />
|
|
2619
2628
|
```
|
|
2620
2629
|
|
|
2621
|
-
<!-- #default-branch-switch -->
|
|
2622
|
-
|
|
2623
2630
|
```bash
|
|
2624
2631
|
npx @mui/codemod@latest v5.0.0/avatar-circle-circular <path>
|
|
2625
2632
|
```
|
|
@@ -2653,8 +2660,6 @@ Renames the badge's props.
|
|
|
2653
2660
|
}}>
|
|
2654
2661
|
```
|
|
2655
2662
|
|
|
2656
|
-
<!-- #default-branch-switch -->
|
|
2657
|
-
|
|
2658
2663
|
```bash
|
|
2659
2664
|
npx @mui/codemod@latest v5.0.0/badge-overlap-value <path>
|
|
2660
2665
|
```
|
|
@@ -2677,8 +2682,6 @@ This change only affects Base UI components.
|
|
|
2677
2682
|
/>;
|
|
2678
2683
|
```
|
|
2679
2684
|
|
|
2680
|
-
<!-- #default-branch-switch -->
|
|
2681
|
-
|
|
2682
2685
|
```bash
|
|
2683
2686
|
npx @mui/codemod@latest v5.0.0/base-rename-components-to-slots <path>
|
|
2684
2687
|
```
|
|
@@ -2696,8 +2699,6 @@ Updates the Box API from separate system props to `sx`.
|
|
|
2696
2699
|
+<Box borderRadius="16px">
|
|
2697
2700
|
```
|
|
2698
2701
|
|
|
2699
|
-
<!-- #default-branch-switch -->
|
|
2700
|
-
|
|
2701
2702
|
```bash
|
|
2702
2703
|
npx @mui/codemod@latest v5.0.0/box-borderradius-values <path>
|
|
2703
2704
|
```
|
|
@@ -2732,8 +2733,6 @@ Renames the Box `grid*Gap` props.
|
|
|
2732
2733
|
+<Box rowGap={4}>Item 5</Box>
|
|
2733
2734
|
```
|
|
2734
2735
|
|
|
2735
|
-
<!-- #default-branch-switch -->
|
|
2736
|
-
|
|
2737
2736
|
```bash
|
|
2738
2737
|
npx @mui/codemod@latest v5.0.0/box-rename-gap <path>
|
|
2739
2738
|
```
|
|
@@ -2749,8 +2748,6 @@ Removes the outdated `color` prop values.
|
|
|
2749
2748
|
+<Button>
|
|
2750
2749
|
```
|
|
2751
2750
|
|
|
2752
|
-
<!-- #default-branch-switch -->
|
|
2753
|
-
|
|
2754
2751
|
```bash
|
|
2755
2752
|
npx @mui/codemod@latest v5.0.0/button-color-prop <path>
|
|
2756
2753
|
```
|
|
@@ -2766,8 +2763,6 @@ Removes the Chip `variant` prop if the value is `"default"`.
|
|
|
2766
2763
|
+<Chip>
|
|
2767
2764
|
```
|
|
2768
2765
|
|
|
2769
|
-
<!-- #default-branch-switch -->
|
|
2770
|
-
|
|
2771
2766
|
```bash
|
|
2772
2767
|
npx @mui/codemod@latest v5.0.0/chip-variant-prop <path>
|
|
2773
2768
|
```
|
|
@@ -2783,8 +2778,6 @@ Renames the CircularProgress `static` variant to `determinate`.
|
|
|
2783
2778
|
+<CircularProgress variant="determinate" classes={{ determinate: 'className' }} />
|
|
2784
2779
|
```
|
|
2785
2780
|
|
|
2786
|
-
<!-- #default-branch-switch -->
|
|
2787
|
-
|
|
2788
2781
|
```bash
|
|
2789
2782
|
npx @mui/codemod@latest v5.0.0/circularprogress-variant <path>
|
|
2790
2783
|
```
|
|
@@ -2802,8 +2795,6 @@ Renames `Collapse`'s `collapsedHeight` prop to `collapsedSize`.
|
|
|
2802
2795
|
+<Collapse classes={{ root: 'collapse' }} />
|
|
2803
2796
|
```
|
|
2804
2797
|
|
|
2805
|
-
<!-- #default-branch-switch -->
|
|
2806
|
-
|
|
2807
2798
|
```bash
|
|
2808
2799
|
npx @mui/codemod@latest v5.0.0/collapse-rename-collapsedheight <path>
|
|
2809
2800
|
```
|
|
@@ -2821,8 +2812,6 @@ A generic codemod to rename any component prop.
|
|
|
2821
2812
|
+<Component newProp />
|
|
2822
2813
|
```
|
|
2823
2814
|
|
|
2824
|
-
<!-- #default-branch-switch -->
|
|
2825
|
-
|
|
2826
2815
|
```bash
|
|
2827
2816
|
npx @mui/codemod@latest v5.0.0/component-rename-prop <path> -- --component=Grid --from=prop --to=newProp
|
|
2828
2817
|
```
|
|
@@ -2933,8 +2922,6 @@ Renames the `fade` style utility import and calls to `alpha()`.
|
|
|
2933
2922
|
+const foo = alpha('#aaa');
|
|
2934
2923
|
```
|
|
2935
2924
|
|
|
2936
|
-
<!-- #default-branch-switch -->
|
|
2937
|
-
|
|
2938
2925
|
```bash
|
|
2939
2926
|
npx @mui/codemod@latest v5.0.0/fade-rename-alpha <path>
|
|
2940
2927
|
```
|
|
@@ -2950,8 +2937,6 @@ Renames `Grid`'s `justify` prop to `justifyContent`.
|
|
|
2950
2937
|
+<Grid item justifyContent="left">Item</Grid>
|
|
2951
2938
|
```
|
|
2952
2939
|
|
|
2953
|
-
<!-- #default-branch-switch -->
|
|
2954
|
-
|
|
2955
2940
|
```bash
|
|
2956
2941
|
npx @mui/codemod@latest v5.0.0/grid-justify-justifycontent <path>
|
|
2957
2942
|
```
|
|
@@ -3234,8 +3219,6 @@ or
|
|
|
3234
3219
|
+import { SpeedDial } from '@material-ui/core';
|
|
3235
3220
|
```
|
|
3236
3221
|
|
|
3237
|
-
<!-- #default-branch-switch -->
|
|
3238
|
-
|
|
3239
3222
|
```bash
|
|
3240
3223
|
npx @mui/codemod@latest v5.0.0/moved-lab-modules <path>
|
|
3241
3224
|
```
|
|
@@ -3278,8 +3261,6 @@ Fix private import paths.
|
|
|
3278
3261
|
+import { createTheme } from '@material-ui/core/styles';
|
|
3279
3262
|
```
|
|
3280
3263
|
|
|
3281
|
-
<!-- #default-branch-switch -->
|
|
3282
|
-
|
|
3283
3264
|
```bash
|
|
3284
3265
|
npx @mui/codemod@latest v5.0.0/optimal-imports <path>
|
|
3285
3266
|
```
|
|
@@ -3407,8 +3388,6 @@ Updates breakpoint values to match new logic. ⚠️ This mod is not idempotent,
|
|
|
3407
3388
|
+theme.breakpoints.between('sm', 'lg')
|
|
3408
3389
|
```
|
|
3409
3390
|
|
|
3410
|
-
<!-- #default-branch-switch -->
|
|
3411
|
-
|
|
3412
3391
|
```bash
|
|
3413
3392
|
npx @mui/codemod@latest v5.0.0/theme-breakpoints <path>
|
|
3414
3393
|
```
|
|
@@ -3481,8 +3460,6 @@ Removes the 'px' suffix from some template strings.
|
|
|
3481
3460
|
+`${theme.spacing(2)} ${theme.spacing(4)}`
|
|
3482
3461
|
```
|
|
3483
3462
|
|
|
3484
|
-
<!-- #default-branch-switch -->
|
|
3485
|
-
|
|
3486
3463
|
```bash
|
|
3487
3464
|
npx @mui/codemod@latest v5.0.0/theme-spacing <path>
|
|
3488
3465
|
```
|
|
@@ -3514,8 +3491,6 @@ Converts all `@mui/material` submodule imports to the root module:
|
|
|
3514
3491
|
+import { List, Grid } from '@mui/material';
|
|
3515
3492
|
```
|
|
3516
3493
|
|
|
3517
|
-
<!-- #default-branch-switch -->
|
|
3518
|
-
|
|
3519
3494
|
```bash
|
|
3520
3495
|
npx @mui/codemod@latest v5.0.0/top-level-imports <path>
|
|
3521
3496
|
```
|
|
@@ -3566,8 +3541,6 @@ Updates Dialog, Menu, Popover, and Snackbar to use the `TransitionProps` prop to
|
|
|
3566
3541
|
/>
|
|
3567
3542
|
```
|
|
3568
3543
|
|
|
3569
|
-
<!-- #default-branch-switch -->
|
|
3570
|
-
|
|
3571
3544
|
```bash
|
|
3572
3545
|
npx @mui/codemod@latest v5.0.0/use-transitionprops <path>
|
|
3573
3546
|
```
|
|
@@ -3596,8 +3569,6 @@ The diff should look like this:
|
|
|
3596
3569
|
+<FormControl value="Standard" variant="standard" />
|
|
3597
3570
|
```
|
|
3598
3571
|
|
|
3599
|
-
<!-- #default-branch-switch -->
|
|
3600
|
-
|
|
3601
3572
|
```bash
|
|
3602
3573
|
npx @mui/codemod@latest v5.0.0/variant-prop <path>
|
|
3603
3574
|
```
|
|
@@ -3707,8 +3678,6 @@ The diff should look like this:
|
|
|
3707
3678
|
+const spacing = theme.spacing(1);
|
|
3708
3679
|
```
|
|
3709
3680
|
|
|
3710
|
-
<!-- #default-branch-switch -->
|
|
3711
|
-
|
|
3712
3681
|
```bash
|
|
3713
3682
|
npx @mui/codemod@latest v4.0.0/theme-spacing-api <path>
|
|
3714
3683
|
```
|
|
@@ -3734,8 +3703,6 @@ Converts all `@material-ui/core` imports more than 1 level deep to the optimal f
|
|
|
3734
3703
|
+import { withStyles, createTheme } from '@material-ui/core/styles';
|
|
3735
3704
|
```
|
|
3736
3705
|
|
|
3737
|
-
<!-- #default-branch-switch -->
|
|
3738
|
-
|
|
3739
3706
|
```bash
|
|
3740
3707
|
npx @mui/codemod@latest v4.0.0/optimal-imports <path>
|
|
3741
3708
|
```
|
|
@@ -3752,8 +3719,6 @@ Converts all `@material-ui/core` submodule imports to the root module:
|
|
|
3752
3719
|
+import { List, withStyles } from '@material-ui/core';
|
|
3753
3720
|
```
|
|
3754
3721
|
|
|
3755
|
-
<!-- #default-branch-switch -->
|
|
3756
|
-
|
|
3757
3722
|
```bash
|
|
3758
3723
|
npx @mui/codemod@latest v4.0.0/top-level-imports <path>
|
|
3759
3724
|
```
|
|
@@ -3773,8 +3738,6 @@ The diff should look like this:
|
|
|
3773
3738
|
+import MenuItem from '@material-ui/core/MenuItem';
|
|
3774
3739
|
```
|
|
3775
3740
|
|
|
3776
|
-
<!-- #default-branch-switch -->
|
|
3777
|
-
|
|
3778
3741
|
```bash
|
|
3779
3742
|
npx @mui/codemod@latest v1.0.0/import-path <path>
|
|
3780
3743
|
```
|
|
@@ -3800,16 +3763,12 @@ The diff should look like this:
|
|
|
3800
3763
|
+const teal500 = teal['500'];
|
|
3801
3764
|
```
|
|
3802
3765
|
|
|
3803
|
-
<!-- #default-branch-switch -->
|
|
3804
|
-
|
|
3805
3766
|
```bash
|
|
3806
3767
|
npx @mui/codemod@latest v1.0.0/color-imports <path>
|
|
3807
3768
|
```
|
|
3808
3769
|
|
|
3809
3770
|
**additional options**
|
|
3810
3771
|
|
|
3811
|
-
<!-- #default-branch-switch -->
|
|
3812
|
-
|
|
3813
3772
|
```bash
|
|
3814
3773
|
npx @mui/codemod@latest v1.0.0/color-imports <path> -- --importPath='mui/styles/colors' --targetPath='mui/colors'
|
|
3815
3774
|
```
|
|
@@ -3826,8 +3785,6 @@ The diff should look like this:
|
|
|
3826
3785
|
+import ThreeDRotation from '@material-ui/icons/ThreeDRotation';
|
|
3827
3786
|
```
|
|
3828
3787
|
|
|
3829
|
-
<!-- #default-branch-switch -->
|
|
3830
|
-
|
|
3831
3788
|
```bash
|
|
3832
3789
|
npx @mui/codemod@latest v1.0.0/svg-icon-imports <path>
|
|
3833
3790
|
```
|
|
@@ -3844,8 +3801,6 @@ The diff should look like this:
|
|
|
3844
3801
|
+<MenuItem>{"Profile" + "!"}</MenuItem>
|
|
3845
3802
|
```
|
|
3846
3803
|
|
|
3847
|
-
<!-- #default-branch-switch -->
|
|
3848
|
-
|
|
3849
3804
|
```bash
|
|
3850
3805
|
npx @mui/codemod@latest v1.0.0/menu-item-primary-text <path>
|
|
3851
3806
|
```
|
|
@@ -3868,8 +3823,6 @@ The diff should look like this:
|
|
|
3868
3823
|
+import RaisedButton from 'material-ui/RaisedButton';
|
|
3869
3824
|
```
|
|
3870
3825
|
|
|
3871
|
-
<!-- #default-branch-switch -->
|
|
3872
|
-
|
|
3873
3826
|
```bash
|
|
3874
3827
|
npx @mui/codemod@latest v0.15.0/import-path <path>
|
|
3875
3828
|
```
|
|
@@ -8,6 +8,7 @@ exports.default = deprecationsAll;
|
|
|
8
8
|
var _accordionSummaryClasses = _interopRequireDefault(require("../accordion-summary-classes"));
|
|
9
9
|
var _accordionProps = _interopRequireDefault(require("../accordion-props"));
|
|
10
10
|
var _alertClasses = _interopRequireDefault(require("../alert-classes"));
|
|
11
|
+
var _alertProps = _interopRequireDefault(require("../alert-props"));
|
|
11
12
|
var _avatarGroupProps = _interopRequireDefault(require("../avatar-group-props"));
|
|
12
13
|
var _autocompleteProps = _interopRequireDefault(require("../autocomplete-props"));
|
|
13
14
|
var _avatarProps = _interopRequireDefault(require("../avatar-props"));
|
|
@@ -28,7 +29,9 @@ var _listItemTextProps = _interopRequireDefault(require("../list-item-text-props
|
|
|
28
29
|
var _linearProgressClasses = _interopRequireDefault(require("../linear-progress-classes"));
|
|
29
30
|
var _modalProps = _interopRequireDefault(require("../modal-props"));
|
|
30
31
|
var _outlinedInputProps = _interopRequireDefault(require("../outlined-input-props"));
|
|
32
|
+
var _paginationItemProps = _interopRequireDefault(require("../pagination-item-props"));
|
|
31
33
|
var _paginationItemClasses = _interopRequireDefault(require("../pagination-item-classes"));
|
|
34
|
+
var _popperProps = _interopRequireDefault(require("../popper-props"));
|
|
32
35
|
var _speedDialProps = _interopRequireDefault(require("../speed-dial-props"));
|
|
33
36
|
var _tableSortLabelClasses = _interopRequireDefault(require("../table-sort-label-classes"));
|
|
34
37
|
var _selectClasses = _interopRequireDefault(require("../select-classes"));
|
|
@@ -42,13 +45,16 @@ var _tooltipProps = _interopRequireDefault(require("../tooltip-props"));
|
|
|
42
45
|
var _tablePaginationProps = _interopRequireDefault(require("../table-pagination-props"));
|
|
43
46
|
var _cardHeaderProps = _interopRequireDefault(require("../card-header-props"));
|
|
44
47
|
var _popoverProps = _interopRequireDefault(require("../popover-props"));
|
|
48
|
+
var _snackbarProps = _interopRequireDefault(require("../snackbar-props"));
|
|
49
|
+
var _sliderProps = _interopRequireDefault(require("../slider-props"));
|
|
45
50
|
var _sliderClasses = _interopRequireDefault(require("../slider-classes"));
|
|
46
51
|
var _mobileStepperProps = _interopRequireDefault(require("../mobile-stepper-props"));
|
|
47
|
-
var _snackbarProps = _interopRequireDefault(require("../snackbar-props"));
|
|
48
52
|
var _tabsProps = _interopRequireDefault(require("../tabs-props"));
|
|
49
53
|
var _tabsClasses = _interopRequireDefault(require("../tabs-classes"));
|
|
50
54
|
var _drawerProps = _interopRequireDefault(require("../drawer-props"));
|
|
51
55
|
var _menuProps = _interopRequireDefault(require("../menu-props"));
|
|
56
|
+
var _ratingProps = _interopRequireDefault(require("../rating-props"));
|
|
57
|
+
var _typographyProps = _interopRequireDefault(require("../typography-props"));
|
|
52
58
|
/**
|
|
53
59
|
* @param {import('jscodeshift').FileInfo} file
|
|
54
60
|
* @param {import('jscodeshift').API} api
|
|
@@ -57,6 +63,7 @@ function deprecationsAll(file, api, options) {
|
|
|
57
63
|
file.source = (0, _accordionSummaryClasses.default)(file, api, options);
|
|
58
64
|
file.source = (0, _accordionProps.default)(file, api, options);
|
|
59
65
|
file.source = (0, _alertClasses.default)(file, api, options);
|
|
66
|
+
file.source = (0, _alertProps.default)(file, api, options);
|
|
60
67
|
file.source = (0, _avatarGroupProps.default)(file, api, options);
|
|
61
68
|
file.source = (0, _autocompleteProps.default)(file, api, options);
|
|
62
69
|
file.source = (0, _avatarProps.default)(file, api, options);
|
|
@@ -78,6 +85,8 @@ function deprecationsAll(file, api, options) {
|
|
|
78
85
|
file.source = (0, _modalProps.default)(file, api, options);
|
|
79
86
|
file.source = (0, _outlinedInputProps.default)(file, api, options);
|
|
80
87
|
file.source = (0, _paginationItemClasses.default)(file, api, options);
|
|
88
|
+
file.source = (0, _paginationItemProps.default)(file, api, options);
|
|
89
|
+
file.source = (0, _popperProps.default)(file, api, options);
|
|
81
90
|
file.source = (0, _speedDialProps.default)(file, api, options);
|
|
82
91
|
file.source = (0, _stepConnectorClasses.default)(file, api, options);
|
|
83
92
|
file.source = (0, _stepContentProps.default)(file, api, options);
|
|
@@ -91,6 +100,8 @@ function deprecationsAll(file, api, options) {
|
|
|
91
100
|
file.source = (0, _tablePaginationProps.default)(file, api, options);
|
|
92
101
|
file.source = (0, _cardHeaderProps.default)(file, api, options);
|
|
93
102
|
file.source = (0, _popoverProps.default)(file, api, options);
|
|
103
|
+
file.source = (0, _snackbarProps.default)(file, api, options);
|
|
104
|
+
file.source = (0, _sliderProps.default)(file, api, options);
|
|
94
105
|
file.source = (0, _sliderClasses.default)(file, api, options);
|
|
95
106
|
file.source = (0, _mobileStepperProps.default)(file, api, options);
|
|
96
107
|
file.source = (0, _snackbarProps.default)(file, api, options);
|
|
@@ -98,5 +109,7 @@ function deprecationsAll(file, api, options) {
|
|
|
98
109
|
file.source = (0, _tabsClasses.default)(file, api, options);
|
|
99
110
|
file.source = (0, _drawerProps.default)(file, api, options);
|
|
100
111
|
file.source = (0, _menuProps.default)(file, api, options);
|
|
112
|
+
file.source = (0, _ratingProps.default)(file, api, options);
|
|
113
|
+
file.source = (0, _typographyProps.default)(file, api, options);
|
|
101
114
|
return file.source;
|
|
102
115
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
Object.defineProperty(exports, "default", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _ratingProps.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
var _ratingProps = _interopRequireDefault(require("./rating-props"));
|
|
@@ -0,0 +1,25 @@
|
|
|
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 _movePropIntoSlotProps = _interopRequireDefault(require("../utils/movePropIntoSlotProps"));
|
|
9
|
+
/**
|
|
10
|
+
* @param {import('jscodeshift').FileInfo} file
|
|
11
|
+
* @param {import('jscodeshift').API} api
|
|
12
|
+
*/
|
|
13
|
+
function transformer(file, api, options) {
|
|
14
|
+
const j = api.jscodeshift;
|
|
15
|
+
const root = j(file.source);
|
|
16
|
+
const printOptions = options.printOptions;
|
|
17
|
+
(0, _movePropIntoSlotProps.default)(j, {
|
|
18
|
+
root,
|
|
19
|
+
componentName: 'Rating',
|
|
20
|
+
propName: 'IconContainerComponent',
|
|
21
|
+
slotName: 'icon',
|
|
22
|
+
slotPropName: 'component'
|
|
23
|
+
});
|
|
24
|
+
return root.toSource(printOptions);
|
|
25
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _Rating = _interopRequireDefault(require("@mui/material/Rating"));
|
|
5
|
+
var _material = require("@mui/material");
|
|
6
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
7
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Rating.default, {
|
|
8
|
+
IconContainerComponent: CustomIconContainer
|
|
9
|
+
});
|
|
10
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Rating, {
|
|
11
|
+
IconContainerComponent: CustomIconContainer
|
|
12
|
+
});
|
|
13
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Rating.default, {
|
|
14
|
+
IconContainerComponent: CustomIconContainer,
|
|
15
|
+
slots: {
|
|
16
|
+
root: 'div'
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Rating, {
|
|
20
|
+
IconContainerComponent: CustomIconContainer,
|
|
21
|
+
slots: {
|
|
22
|
+
...outerSlots
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Rating.default, {
|
|
26
|
+
IconContainerComponent: CustomIconContainer,
|
|
27
|
+
slotProps: {
|
|
28
|
+
icon: {
|
|
29
|
+
id: 'my-rating-icon'
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// should skip non MUI components
|
|
35
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(NonMuiRating, {
|
|
36
|
+
IconContainerComponent: CustomIconContainer
|
|
37
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _Rating = _interopRequireDefault(require("@mui/material/Rating"));
|
|
5
|
+
var _material = require("@mui/material");
|
|
6
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
7
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Rating.default, {
|
|
8
|
+
slotProps: {
|
|
9
|
+
icon: {
|
|
10
|
+
component: CustomIconContainer
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Rating, {
|
|
15
|
+
slotProps: {
|
|
16
|
+
icon: {
|
|
17
|
+
component: CustomIconContainer
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Rating.default, {
|
|
22
|
+
slots: {
|
|
23
|
+
root: 'div'
|
|
24
|
+
},
|
|
25
|
+
slotProps: {
|
|
26
|
+
icon: {
|
|
27
|
+
component: CustomIconContainer
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Rating, {
|
|
32
|
+
slots: {
|
|
33
|
+
...outerSlots
|
|
34
|
+
},
|
|
35
|
+
slotProps: {
|
|
36
|
+
icon: {
|
|
37
|
+
component: CustomIconContainer
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Rating.default, {
|
|
42
|
+
slotProps: {
|
|
43
|
+
icon: {
|
|
44
|
+
id: 'my-rating-icon',
|
|
45
|
+
component: CustomIconContainer
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
// should skip non MUI components
|
|
51
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(NonMuiRating, {
|
|
52
|
+
IconContainerComponent: CustomIconContainer
|
|
53
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
fn({
|
|
4
|
+
MuiRating: {
|
|
5
|
+
defaultProps: {
|
|
6
|
+
IconContainerComponent: CustomContainer
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
fn({
|
|
11
|
+
MuiRating: {
|
|
12
|
+
defaultProps: {
|
|
13
|
+
IconContainerComponent: CustomContainer,
|
|
14
|
+
slotProps: {
|
|
15
|
+
root: {}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
fn({
|
|
21
|
+
MuiRating: {
|
|
22
|
+
defaultProps: {
|
|
23
|
+
IconContainerComponent: CustomContainer,
|
|
24
|
+
slotProps: {
|
|
25
|
+
icon: {
|
|
26
|
+
id: 'my-rating-icon'
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
fn({
|
|
4
|
+
MuiRating: {
|
|
5
|
+
defaultProps: {
|
|
6
|
+
slotProps: {
|
|
7
|
+
icon: {
|
|
8
|
+
component: CustomContainer
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
fn({
|
|
15
|
+
MuiRating: {
|
|
16
|
+
defaultProps: {
|
|
17
|
+
slotProps: {
|
|
18
|
+
root: {},
|
|
19
|
+
icon: {
|
|
20
|
+
component: CustomContainer
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
fn({
|
|
27
|
+
MuiRating: {
|
|
28
|
+
defaultProps: {
|
|
29
|
+
slotProps: {
|
|
30
|
+
icon: {
|
|
31
|
+
id: 'my-rating-icon',
|
|
32
|
+
component: CustomContainer
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
});
|