@mui/codemod 6.0.0-alpha.7 → 6.0.0-alpha.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 +227 -30
- package/node/deprecations/accordion-props/test-cases/actual.js +6 -3
- package/node/deprecations/accordion-props/test-cases/expected.js +14 -10
- package/node/deprecations/accordion-props/test-cases/theme.expected.js +8 -7
- package/node/deprecations/alert-props/test-cases/expected.js +12 -4
- package/node/deprecations/alert-props/test-cases/theme.expected.js +12 -5
- package/node/deprecations/all/deprecations-all.js +6 -0
- package/node/deprecations/autocomplete-props/test-cases/expected.js +8 -6
- package/node/deprecations/autocomplete-props/test-cases/theme.expected.js +8 -7
- package/node/deprecations/avatar-group-props/avatar-group-props.js +87 -0
- package/node/deprecations/avatar-group-props/index.js +13 -0
- package/node/deprecations/avatar-group-props/test-cases/actual.js +56 -0
- package/node/deprecations/avatar-group-props/test-cases/expected.js +58 -0
- package/node/deprecations/avatar-group-props/test-cases/theme.actual.js +48 -0
- package/node/deprecations/avatar-group-props/test-cases/theme.expected.js +50 -0
- package/node/deprecations/avatar-props/test-cases/expected.js +8 -6
- package/node/deprecations/avatar-props/test-cases/theme.expected.js +8 -7
- package/node/deprecations/backdrop-props/test-cases/actual.js +3 -2
- package/node/deprecations/backdrop-props/test-cases/expected.js +3 -3
- package/node/deprecations/badge-props/test-cases/expected.js +12 -5
- package/node/deprecations/badge-props/test-cases/theme.expected.js +12 -5
- package/node/deprecations/form-control-label-props/test-cases/expected.js +4 -2
- package/node/deprecations/form-control-label-props/test-cases/theme.expected.js +4 -3
- package/node/deprecations/grid-props/grid-props.js +51 -0
- package/node/deprecations/grid-props/index.js +13 -0
- package/node/deprecations/grid-props/test-cases/actual.js +25 -0
- package/node/deprecations/grid-props/test-cases/expected.js +23 -0
- package/node/deprecations/grid-props/test-cases/theme.actual.js +24 -0
- package/node/deprecations/grid-props/test-cases/theme.expected.js +23 -0
- package/node/deprecations/list-item-props/index.js +13 -0
- package/node/deprecations/list-item-props/list-item-props.js +22 -0
- package/node/deprecations/list-item-props/test-cases/actual.js +43 -0
- package/node/deprecations/list-item-props/test-cases/expected.js +40 -0
- package/node/deprecations/list-item-props/test-cases/theme.actual.js +56 -0
- package/node/deprecations/list-item-props/test-cases/theme.expected.js +53 -0
- package/node/deprecations/popper-props/index.js +13 -0
- package/node/deprecations/popper-props/popper-props.js +22 -0
- package/node/deprecations/popper-props/test-cases/actual.js +27 -0
- package/node/deprecations/popper-props/test-cases/expected.js +24 -0
- package/node/deprecations/popper-props/test-cases/theme.actual.js +32 -0
- package/node/deprecations/popper-props/test-cases/theme.expected.js +29 -0
- package/node/deprecations/slider-props/test-cases/expected.js +12 -4
- package/node/deprecations/slider-props/test-cases/theme.expected.js +12 -5
- package/node/deprecations/speed-dial-props/test-cases/actual.js +3 -2
- package/node/deprecations/speed-dial-props/test-cases/expected.js +3 -3
- package/node/deprecations/step-label-props/test-cases/expected.js +8 -3
- package/node/deprecations/step-label-props/test-cases/theme.expected.js +8 -4
- package/node/deprecations/text-field-props/index.js +13 -0
- package/node/deprecations/text-field-props/test-cases/actual.js +27 -0
- package/node/deprecations/text-field-props/test-cases/expected.js +31 -0
- package/node/deprecations/text-field-props/test-cases/theme.actual.js +13 -0
- package/node/deprecations/text-field-props/test-cases/theme.expected.js +15 -0
- package/node/deprecations/text-field-props/text-field-props.js +48 -0
- package/node/deprecations/tooltip-props/index.js +13 -0
- package/node/deprecations/tooltip-props/test-cases/actual.js +92 -0
- package/node/deprecations/tooltip-props/test-cases/expected.js +84 -0
- package/node/deprecations/tooltip-props/test-cases/theme.actual.js +73 -0
- package/node/deprecations/tooltip-props/test-cases/theme.expected.js +65 -0
- package/node/deprecations/tooltip-props/tooltip-props.js +22 -0
- package/node/deprecations/utils/replaceComponentsWithSlots.js +29 -17
- package/node/util/migrateToVariants.js +198 -121
- package/node/v5.0.0/badge-overlap-value.test/actual.js +3 -4
- package/node/v5.0.0/badge-overlap-value.test/expected.js +3 -4
- package/node/v5.0.0/base-remove-component-prop.test/actual.js +4 -4
- package/node/v5.0.0/base-remove-component-prop.test/expected.js +4 -4
- package/node/v5.0.0/box-sx-prop.test/actual.js +4 -4
- package/node/v5.0.0/box-sx-prop.test/expected.js +3 -3
- package/node/v5.0.0/create-theme.test/custom-fn.actual.js +3 -4
- package/node/v5.0.0/create-theme.test/custom-fn.expected.js +3 -4
- package/node/v5.0.0/jss-to-styled.test/first.actual.js +11 -14
- package/node/v5.0.0/jss-to-styled.test/first.expected.js +11 -14
- package/node/v5.0.0/jss-to-styled.test/seventh.actual.js +4 -4
- package/node/v5.0.0/jss-to-styled.test/seventh.expected.js +4 -4
- package/node/v5.0.0/jss-to-styled.test/sixth.actual.js +3 -3
- package/node/v5.0.0/jss-to-styled.test/sixth.expected.js +3 -3
- package/node/v5.0.0/jss-to-styled.test/withCreateStyles.actual.js +3 -3
- package/node/v5.0.0/jss-to-styled.test/withCreateStyles.expected.js +3 -4
- package/node/v5.0.0/jss-to-styled.test/withCreateStyles1.actual.js +3 -3
- package/node/v5.0.0/jss-to-styled.test/withCreateStyles1.expected.js +3 -4
- package/node/v5.0.0/jss-to-styled.test/withCreateStyles2.actual.js +3 -3
- package/node/v5.0.0/jss-to-styled.test/withCreateStyles2.expected.js +3 -4
- package/node/v5.0.0/jss-to-styled.test/withCreateStyles3.actual.js +3 -3
- package/node/v5.0.0/jss-to-styled.test/withCreateStyles3.expected.js +3 -4
- package/node/v5.0.0/jss-to-tss-react.test/actual-mixins-pattern.js +6 -5
- package/node/v5.0.0/jss-to-tss-react.test/expected-mixins-pattern.js +6 -5
- package/node/v5.0.0/preset-safe.test/actual.js +6 -4
- package/node/v5.0.0/preset-safe.test/expected.js +9 -6
- package/node/v5.0.0/table-props.test/actual.js +4 -5
- package/node/v5.0.0/table-props.test/expected.js +4 -5
- package/node/v5.0.0/theme-spacing.test/large-actual.js +10 -10
- package/node/v5.0.0/theme-spacing.test/large-expected.js +10 -10
- package/node/v5.0.0/variant-prop.test/actual.js +12 -6
- package/node/v5.0.0/variant-prop.test/expected.js +15 -12
- package/node/v5.0.0/with-mobile-dialog.test/expected.js +6 -5
- package/node/v5.0.0/with-width.test/expected.js +6 -5
- package/node/v6.0.0/styled/test-cases/BasicStyled.actual.js +55 -44
- package/node/v6.0.0/styled/test-cases/BasicStyled.expected.js +5 -6
- package/node/v6.0.0/styled/test-cases/ConditionalStyled.actual.js +80 -70
- package/node/v6.0.0/styled/test-cases/ConditionalStyled.expected.js +7 -6
- package/node/v6.0.0/styled/test-cases/NestedSpread.actual.js +32 -26
- package/node/v6.0.0/styled/test-cases/NestedSpread.expected.js +7 -6
- package/node/v6.0.0/styled/test-cases/ThemePaletteMode.expected.js +28 -26
- package/node/v6.0.0/styled/test-cases/VariantAndModeStyled.actual.js +6 -5
- package/node/v6.0.0/styled/test-cases/VariantAndModeStyled.expected.js +8 -8
- package/node/v6.0.0/sx-prop/index.js +13 -0
- package/node/v6.0.0/sx-prop/sx-v6.js +355 -0
- package/node/v6.0.0/sx-prop/test-cases/basic-sx.actual.js +36 -0
- package/node/v6.0.0/sx-prop/test-cases/basic-sx.expected.js +46 -0
- package/node/v6.0.0/sx-prop/test-cases/sx-css-vars.actual.js +41 -0
- package/node/v6.0.0/sx-prop/test-cases/sx-css-vars.expected.js +71 -0
- package/node/v6.0.0/sx-prop/test-cases/sx-dynamic.actual.js +87 -0
- package/node/v6.0.0/sx-prop/test-cases/sx-dynamic.expected.js +102 -0
- package/node/v6.0.0/sx-prop/test-cases/sx-dynamic2.actual.js +49 -0
- package/node/v6.0.0/sx-prop/test-cases/sx-dynamic2.expected.js +64 -0
- package/node/v6.0.0/system-props/index.js +13 -0
- package/node/v6.0.0/system-props/removeSystemProps.js +242 -0
- package/node/v6.0.0/system-props/test-cases/system-props.actual.js +79 -0
- package/node/v6.0.0/system-props/test-cases/system-props.expected.js +92 -0
- package/node/v6.0.0/theme-v6/test-cases/basicTheme.actual.js +254 -225
- package/node/v6.0.0/theme-v6/test-cases/basicTheme.expected.js +180 -162
- package/node/v6.0.0/theme-v6/test-cases/themeVariants.actual.js +23 -21
- package/node/v6.0.0/theme-v6/test-cases/themeVariants.expected.js +20 -19
- package/node/v6.0.0/theme-v6/theme-v6.js +2 -2
- package/package.json +4 -4
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _Tooltip = _interopRequireDefault(require("@mui/material/Tooltip"));
|
|
5
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
6
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
|
|
7
|
+
components: {
|
|
8
|
+
Arrow: ComponentsArrow,
|
|
9
|
+
Popper: ComponentsPopper,
|
|
10
|
+
Tooltip: ComponentsTooltip,
|
|
11
|
+
Transition: ComponentsTransition
|
|
12
|
+
},
|
|
13
|
+
componentsProps: {
|
|
14
|
+
arrow: componentsArrowProps,
|
|
15
|
+
popper: componentsPopperProps,
|
|
16
|
+
tooltip: componentsTooltipProps,
|
|
17
|
+
transition: componentsTransitionProps
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
|
|
21
|
+
slots: {
|
|
22
|
+
tooltip: SlotsTooltip
|
|
23
|
+
},
|
|
24
|
+
components: {
|
|
25
|
+
Arrow: ComponentsArrow
|
|
26
|
+
},
|
|
27
|
+
slotProps: {
|
|
28
|
+
tooltip: slotsTooltipProps
|
|
29
|
+
},
|
|
30
|
+
componentsProps: {
|
|
31
|
+
arrow: componentsArrowProps
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
|
|
35
|
+
slots: {
|
|
36
|
+
tooltip: SlotsTooltip,
|
|
37
|
+
arrow: SlotsArrow
|
|
38
|
+
},
|
|
39
|
+
components: {
|
|
40
|
+
Arrow: ComponentsArrow
|
|
41
|
+
},
|
|
42
|
+
slotProps: {
|
|
43
|
+
tooltip: slotsTooltipProps,
|
|
44
|
+
arrow: slotsArrowProps
|
|
45
|
+
},
|
|
46
|
+
componentsProps: {
|
|
47
|
+
arrow: componentsArrowProps
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
|
|
51
|
+
slots: {
|
|
52
|
+
tooltip: SlotsTooltip,
|
|
53
|
+
arrow: SlotsArrow
|
|
54
|
+
},
|
|
55
|
+
components: {
|
|
56
|
+
Arrow: ComponentsArrow
|
|
57
|
+
},
|
|
58
|
+
slotProps: {
|
|
59
|
+
tooltip: slotsTooltipProps,
|
|
60
|
+
arrow: slotsArrowProps
|
|
61
|
+
},
|
|
62
|
+
componentsProps: {
|
|
63
|
+
arrow: componentsArrowProps,
|
|
64
|
+
tooltip: componentsTooltipProps
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
|
|
68
|
+
slots: {
|
|
69
|
+
arrow: SlotsArrow,
|
|
70
|
+
popper: SlotsPopper,
|
|
71
|
+
tooltip: SlotsTooltip,
|
|
72
|
+
transition: SlotsTransition
|
|
73
|
+
},
|
|
74
|
+
components: {
|
|
75
|
+
Arrow: ComponentsArrow,
|
|
76
|
+
Popper: ComponentsPopper,
|
|
77
|
+
Tooltip: ComponentsTooltip,
|
|
78
|
+
Transition: ComponentsTransition
|
|
79
|
+
},
|
|
80
|
+
slotProps: {
|
|
81
|
+
arrow: slotsArrowProps,
|
|
82
|
+
popper: slotsPopperProps,
|
|
83
|
+
tooltip: slotsTooltipProps,
|
|
84
|
+
transition: slotsTransitionProps
|
|
85
|
+
},
|
|
86
|
+
componentsProps: {
|
|
87
|
+
arrow: componentsArrowProps,
|
|
88
|
+
popper: componentsPopperProps,
|
|
89
|
+
tooltip: componentsTooltipProps,
|
|
90
|
+
transition: componentsTransitionProps
|
|
91
|
+
}
|
|
92
|
+
});
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _Tooltip = _interopRequireDefault(require("@mui/material/Tooltip"));
|
|
5
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
6
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
|
|
7
|
+
slots: {
|
|
8
|
+
arrow: ComponentsArrow,
|
|
9
|
+
popper: ComponentsPopper,
|
|
10
|
+
tooltip: ComponentsTooltip,
|
|
11
|
+
transition: ComponentsTransition
|
|
12
|
+
},
|
|
13
|
+
slotProps: {
|
|
14
|
+
arrow: componentsArrowProps,
|
|
15
|
+
popper: componentsPopperProps,
|
|
16
|
+
tooltip: componentsTooltipProps,
|
|
17
|
+
transition: componentsTransitionProps
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
|
|
21
|
+
slots: {
|
|
22
|
+
tooltip: SlotsTooltip,
|
|
23
|
+
arrow: ComponentsArrow
|
|
24
|
+
},
|
|
25
|
+
slotProps: {
|
|
26
|
+
tooltip: slotsTooltipProps,
|
|
27
|
+
arrow: componentsArrowProps
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
|
|
31
|
+
slots: {
|
|
32
|
+
tooltip: SlotsTooltip,
|
|
33
|
+
arrow: SlotsArrow
|
|
34
|
+
},
|
|
35
|
+
slotProps: {
|
|
36
|
+
tooltip: slotsTooltipProps,
|
|
37
|
+
arrow: {
|
|
38
|
+
...componentsArrowProps,
|
|
39
|
+
...slotsArrowProps
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
|
|
44
|
+
slots: {
|
|
45
|
+
tooltip: SlotsTooltip,
|
|
46
|
+
arrow: SlotsArrow
|
|
47
|
+
},
|
|
48
|
+
slotProps: {
|
|
49
|
+
arrow: {
|
|
50
|
+
...componentsArrowProps,
|
|
51
|
+
...slotsArrowProps
|
|
52
|
+
},
|
|
53
|
+
tooltip: {
|
|
54
|
+
...componentsTooltipProps,
|
|
55
|
+
...slotsTooltipProps
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
|
|
60
|
+
slots: {
|
|
61
|
+
arrow: SlotsArrow,
|
|
62
|
+
popper: SlotsPopper,
|
|
63
|
+
tooltip: SlotsTooltip,
|
|
64
|
+
transition: SlotsTransition
|
|
65
|
+
},
|
|
66
|
+
slotProps: {
|
|
67
|
+
arrow: {
|
|
68
|
+
...componentsArrowProps,
|
|
69
|
+
...slotsArrowProps
|
|
70
|
+
},
|
|
71
|
+
popper: {
|
|
72
|
+
...componentsPopperProps,
|
|
73
|
+
...slotsPopperProps
|
|
74
|
+
},
|
|
75
|
+
tooltip: {
|
|
76
|
+
...componentsTooltipProps,
|
|
77
|
+
...slotsTooltipProps
|
|
78
|
+
},
|
|
79
|
+
transition: {
|
|
80
|
+
...componentsTransitionProps,
|
|
81
|
+
...slotsTransitionProps
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
});
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
fn({
|
|
4
|
+
MuiTooltip: {
|
|
5
|
+
defaultProps: {
|
|
6
|
+
components: {
|
|
7
|
+
Arrow: ComponentsArrow
|
|
8
|
+
},
|
|
9
|
+
componentsProps: {
|
|
10
|
+
arrow: componentsArrowProps
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
fn({
|
|
16
|
+
MuiTooltip: {
|
|
17
|
+
defaultProps: {
|
|
18
|
+
components: {
|
|
19
|
+
Arrow: ComponentsArrow
|
|
20
|
+
},
|
|
21
|
+
slots: {
|
|
22
|
+
tooltip: SlotsTooltip
|
|
23
|
+
},
|
|
24
|
+
componentsProps: {
|
|
25
|
+
arrow: componentsArrowProps
|
|
26
|
+
},
|
|
27
|
+
slotProps: {
|
|
28
|
+
tooltip: slotsTooltipProps
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
fn({
|
|
34
|
+
MuiTooltip: {
|
|
35
|
+
defaultProps: {
|
|
36
|
+
components: {
|
|
37
|
+
Arrow: ComponentsArrow
|
|
38
|
+
},
|
|
39
|
+
slots: {
|
|
40
|
+
tooltip: SlotsTooltip,
|
|
41
|
+
arrow: SlotsArrow
|
|
42
|
+
},
|
|
43
|
+
componentsProps: {
|
|
44
|
+
arrow: componentsArrowProps
|
|
45
|
+
},
|
|
46
|
+
slotProps: {
|
|
47
|
+
tooltip: slotsTooltipProps,
|
|
48
|
+
arrow: slotsArrowProps
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
fn({
|
|
54
|
+
MuiTooltip: {
|
|
55
|
+
defaultProps: {
|
|
56
|
+
components: {
|
|
57
|
+
Arrow: ComponentsArrow
|
|
58
|
+
},
|
|
59
|
+
slots: {
|
|
60
|
+
tooltip: SlotsTooltip,
|
|
61
|
+
arrow: SlotsArrow
|
|
62
|
+
},
|
|
63
|
+
componentsProps: {
|
|
64
|
+
arrow: componentsArrowProps,
|
|
65
|
+
tooltip: componentsTooltipProps
|
|
66
|
+
},
|
|
67
|
+
slotProps: {
|
|
68
|
+
tooltip: slotsTooltipProps,
|
|
69
|
+
arrow: slotsArrowProps
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
});
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
fn({
|
|
4
|
+
MuiTooltip: {
|
|
5
|
+
defaultProps: {
|
|
6
|
+
slots: {
|
|
7
|
+
arrow: ComponentsArrow
|
|
8
|
+
},
|
|
9
|
+
slotProps: {
|
|
10
|
+
arrow: componentsArrowProps
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
fn({
|
|
16
|
+
MuiTooltip: {
|
|
17
|
+
defaultProps: {
|
|
18
|
+
slots: {
|
|
19
|
+
arrow: ComponentsArrow,
|
|
20
|
+
tooltip: SlotsTooltip
|
|
21
|
+
},
|
|
22
|
+
slotProps: {
|
|
23
|
+
arrow: componentsArrowProps,
|
|
24
|
+
tooltip: slotsTooltipProps
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
fn({
|
|
30
|
+
MuiTooltip: {
|
|
31
|
+
defaultProps: {
|
|
32
|
+
slots: {
|
|
33
|
+
arrow: SlotsArrow,
|
|
34
|
+
tooltip: SlotsTooltip
|
|
35
|
+
},
|
|
36
|
+
slotProps: {
|
|
37
|
+
arrow: {
|
|
38
|
+
...componentsArrowProps,
|
|
39
|
+
...slotsArrowProps
|
|
40
|
+
},
|
|
41
|
+
tooltip: slotsTooltipProps
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
fn({
|
|
47
|
+
MuiTooltip: {
|
|
48
|
+
defaultProps: {
|
|
49
|
+
slots: {
|
|
50
|
+
arrow: SlotsArrow,
|
|
51
|
+
tooltip: SlotsTooltip
|
|
52
|
+
},
|
|
53
|
+
slotProps: {
|
|
54
|
+
arrow: {
|
|
55
|
+
...componentsArrowProps,
|
|
56
|
+
...slotsArrowProps
|
|
57
|
+
},
|
|
58
|
+
tooltip: {
|
|
59
|
+
...componentsTooltipProps,
|
|
60
|
+
...slotsTooltipProps
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
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 _replaceComponentsWithSlots = _interopRequireDefault(require("../utils/replaceComponentsWithSlots"));
|
|
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, _replaceComponentsWithSlots.default)(j, {
|
|
18
|
+
root,
|
|
19
|
+
componentName: 'Tooltip'
|
|
20
|
+
});
|
|
21
|
+
return root.toSource(printOptions);
|
|
22
|
+
}
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = replaceComponentsWithSlots;
|
|
8
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
8
|
var _findComponentJSX = _interopRequireDefault(require("../../util/findComponentJSX"));
|
|
10
9
|
var _findComponentDefaultProps = _interopRequireDefault(require("../../util/findComponentDefaultProps"));
|
|
11
10
|
var _assignObject = _interopRequireDefault(require("../../util/assignObject"));
|
|
@@ -19,9 +18,10 @@ function replaceJsxComponentsProp(j, elementPath) {
|
|
|
19
18
|
if (index !== -1) {
|
|
20
19
|
const removed = element.openingElement.attributes.splice(index, 1);
|
|
21
20
|
const camelCaseComponents = removed[0].value.expression.properties.reduce((acc, prop) => {
|
|
22
|
-
return
|
|
21
|
+
return {
|
|
22
|
+
...acc,
|
|
23
23
|
[componentsKeyToSlotsKey(prop.key.name)]: prop.value
|
|
24
|
-
}
|
|
24
|
+
};
|
|
25
25
|
}, {});
|
|
26
26
|
let hasNode = false;
|
|
27
27
|
element.openingElement.attributes.forEach(attr => {
|
|
@@ -29,9 +29,10 @@ function replaceJsxComponentsProp(j, elementPath) {
|
|
|
29
29
|
if (((_attr$name = attr.name) == null ? void 0 : _attr$name.name) === 'slots') {
|
|
30
30
|
hasNode = true;
|
|
31
31
|
const slots = attr.value.expression.properties.reduce((acc, prop) => {
|
|
32
|
-
return
|
|
32
|
+
return {
|
|
33
|
+
...acc,
|
|
33
34
|
[prop.key.name]: prop.value
|
|
34
|
-
}
|
|
35
|
+
};
|
|
35
36
|
}, {});
|
|
36
37
|
Object.entries(camelCaseComponents).forEach(([slot, value]) => {
|
|
37
38
|
if (!slots[slot]) {
|
|
@@ -65,9 +66,10 @@ function replaceJsxComponentsPropsProp(j, element) {
|
|
|
65
66
|
if (((_attr$name2 = attr.name) == null ? void 0 : _attr$name2.name) === 'slotProps') {
|
|
66
67
|
hasNode = true;
|
|
67
68
|
const slotProps = attr.value.expression.properties.reduce((acc, prop) => {
|
|
68
|
-
return
|
|
69
|
+
return {
|
|
70
|
+
...acc,
|
|
69
71
|
[prop.key.name]: prop.value
|
|
70
|
-
}
|
|
72
|
+
};
|
|
71
73
|
}, {});
|
|
72
74
|
removed[0].value.expression.properties.forEach(prop => {
|
|
73
75
|
if (!slotProps[prop.key.name]) {
|
|
@@ -109,17 +111,22 @@ function replaceDefaultPropsComponentsProp(j, defaultPropsPathCollection) {
|
|
|
109
111
|
properties: defaultPropsProperties
|
|
110
112
|
} = path.parent.value;
|
|
111
113
|
const components = path.value.value.properties.reduce((acc, prop) => {
|
|
112
|
-
return
|
|
114
|
+
return {
|
|
115
|
+
...acc,
|
|
113
116
|
[componentsKeyToSlotsKey(prop.key.name)]: prop.value
|
|
114
|
-
}
|
|
117
|
+
};
|
|
115
118
|
}, {});
|
|
116
119
|
const existingSlots = defaultPropsProperties.find(prop => prop.key.name === 'slots');
|
|
117
120
|
const slots = existingSlots ? existingSlots.value.properties.reduce((acc, prop) => {
|
|
118
|
-
return
|
|
121
|
+
return {
|
|
122
|
+
...acc,
|
|
119
123
|
[prop.key.name]: prop.value
|
|
120
|
-
}
|
|
124
|
+
};
|
|
121
125
|
}, {}) : {};
|
|
122
|
-
const updatedSlots = j.objectExpression(Object.entries(
|
|
126
|
+
const updatedSlots = j.objectExpression(Object.entries({
|
|
127
|
+
...components,
|
|
128
|
+
...slots
|
|
129
|
+
}).map(([slot, value]) => {
|
|
123
130
|
return j.objectProperty(j.identifier(slot), value);
|
|
124
131
|
}));
|
|
125
132
|
if (existingSlots) {
|
|
@@ -140,17 +147,22 @@ function replaceDefaultPropsComponentsPropsProp(j, defaultPropsPathCollection) {
|
|
|
140
147
|
properties: defaultPropsProperties
|
|
141
148
|
} = path.parent.value;
|
|
142
149
|
const components = path.value.value.properties.reduce((acc, prop) => {
|
|
143
|
-
return
|
|
150
|
+
return {
|
|
151
|
+
...acc,
|
|
144
152
|
[prop.key.name]: prop.value
|
|
145
|
-
}
|
|
153
|
+
};
|
|
146
154
|
}, {});
|
|
147
155
|
const existingSlots = defaultPropsProperties.find(prop => prop.key.name === 'slotProps');
|
|
148
156
|
const slots = existingSlots ? existingSlots.value.properties.reduce((acc, prop) => {
|
|
149
|
-
return
|
|
157
|
+
return {
|
|
158
|
+
...acc,
|
|
150
159
|
[prop.key.name]: components[prop.key.name] ? j.objectExpression([j.spreadElement(components[prop.key.name]), j.spreadElement(prop.value)]) : prop.value
|
|
151
|
-
}
|
|
160
|
+
};
|
|
152
161
|
}, {}) : {};
|
|
153
|
-
const updatedSlots = j.objectExpression(Object.entries(
|
|
162
|
+
const updatedSlots = j.objectExpression(Object.entries({
|
|
163
|
+
...components,
|
|
164
|
+
...slots
|
|
165
|
+
}).map(([slot, value]) => {
|
|
154
166
|
return j.objectProperty(j.identifier(slot), value);
|
|
155
167
|
}));
|
|
156
168
|
if (existingSlots) {
|