@mui/codemod 6.0.0-beta.0 → 6.0.0-beta.3
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 +23 -1
- package/node/deprecations/divider-props/divider-props.js +48 -36
- package/node/deprecations/divider-props/test-cases/expected.js +2 -8
- package/node/deprecations/divider-props/test-cases/theme.actual.js +15 -0
- package/node/deprecations/divider-props/test-cases/theme.expected.js +12 -0
- package/node/deprecations/typography-props/index.js +13 -0
- package/node/deprecations/typography-props/test-cases/actual.js +80 -0
- package/node/deprecations/typography-props/test-cases/expected.js +86 -0
- package/node/deprecations/typography-props/test-cases/theme.actual.js +85 -0
- package/node/deprecations/typography-props/test-cases/theme.expected.js +86 -0
- package/node/deprecations/typography-props/typography-props.js +86 -0
- package/node/v6.0.0/sx-prop/sx-v6.js +33 -11
- package/node/v6.0.0/sx-prop/test-cases/sx-applyStyles.actual.js +89 -0
- package/node/v6.0.0/sx-prop/test-cases/sx-applyStyles.expected.js +82 -0
- package/node/v6.0.0/sx-prop/test-cases/sx-condition.actual.js +93 -0
- package/node/v6.0.0/sx-prop/test-cases/sx-condition.expected.js +90 -0
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -61,7 +61,7 @@ npx @mui/codemod@next <transform> <path> --jscodeshift="--printOptions='{\"quote
|
|
|
61
61
|
|
|
62
62
|
## Included scripts
|
|
63
63
|
|
|
64
|
-
- [
|
|
64
|
+
- [Deprecations](#deprecations)
|
|
65
65
|
- [v6](#v600)
|
|
66
66
|
- [v5](#v500)
|
|
67
67
|
- [v4](#v400)
|
|
@@ -1585,6 +1585,28 @@ CSS transforms:
|
|
|
1585
1585
|
npx @mui/codemod@next deprecations/table-sort-label-classes <path>
|
|
1586
1586
|
```
|
|
1587
1587
|
|
|
1588
|
+
#### `typography-props`
|
|
1589
|
+
|
|
1590
|
+
```diff
|
|
1591
|
+
<Typography
|
|
1592
|
+
- paragraph
|
|
1593
|
+
+ sx={{ marginBottom: '16px' }}
|
|
1594
|
+
/>
|
|
1595
|
+
```
|
|
1596
|
+
|
|
1597
|
+
```diff
|
|
1598
|
+
MuiTypography: {
|
|
1599
|
+
defaultProps: {
|
|
1600
|
+
- paragraph: true
|
|
1601
|
+
+ sx: { marginBottom: '16px' },
|
|
1602
|
+
},
|
|
1603
|
+
},
|
|
1604
|
+
```
|
|
1605
|
+
|
|
1606
|
+
```bash
|
|
1607
|
+
npx @mui/codemod@next deprecations/typography-props <path>
|
|
1608
|
+
```
|
|
1609
|
+
|
|
1588
1610
|
### v6.0.0
|
|
1589
1611
|
|
|
1590
1612
|
#### `sx-prop`
|
|
@@ -20,30 +20,36 @@ function transformer(file, api, options) {
|
|
|
20
20
|
root,
|
|
21
21
|
componentName: 'Divider'
|
|
22
22
|
}, elementPath => {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
var _lightProp$value;
|
|
24
|
+
const lightProp = elementPath.node.openingElement.attributes.find(attr => attr.type === 'JSXAttribute' && attr.name.name === 'light');
|
|
25
|
+
if (!lightProp) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
elementPath.node.openingElement.attributes = elementPath.node.openingElement.attributes.filter(attr => {
|
|
29
|
+
if (attr.type === 'JSXAttribute' && attr.name.name === 'light') {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
return true;
|
|
33
|
+
});
|
|
34
|
+
const isLightPropTruthy = ((_lightProp$value = lightProp.value) == null ? void 0 : _lightProp$value.expression.value) !== false;
|
|
35
|
+
if (!isLightPropTruthy) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const sxIndex = elementPath.node.openingElement.attributes.findIndex(attr => attr.type === 'JSXAttribute' && attr.name.name === 'sx');
|
|
39
|
+
if (sxIndex === -1) {
|
|
40
|
+
(0, _appendAttribute.default)(j, {
|
|
41
|
+
target: elementPath.node,
|
|
42
|
+
attributeName: 'sx',
|
|
43
|
+
expression: j.objectExpression([j.objectProperty(j.identifier('opacity'), j.literal('0.6'))])
|
|
30
44
|
});
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
45
|
+
} else {
|
|
46
|
+
const opacityIndex = elementPath.node.openingElement.attributes[sxIndex].value.expression.properties.findIndex(key => key.key.name === 'opacity');
|
|
47
|
+
if (opacityIndex === -1) {
|
|
48
|
+
(0, _assignObject.default)(j, {
|
|
49
|
+
target: elementPath.node.openingElement.attributes[sxIndex],
|
|
50
|
+
key: 'opacity',
|
|
51
|
+
expression: j.literal('0.6')
|
|
37
52
|
});
|
|
38
|
-
} else {
|
|
39
|
-
const opacityIndex = elementPath.node.openingElement.attributes[sxIndex].value.expression.properties.findIndex(key => key.key.name === 'opacity');
|
|
40
|
-
if (opacityIndex === -1) {
|
|
41
|
-
(0, _assignObject.default)(j, {
|
|
42
|
-
target: elementPath.node.openingElement.attributes[sxIndex],
|
|
43
|
-
key: 'opacity',
|
|
44
|
-
expression: j.literal('0.6')
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
53
|
}
|
|
48
54
|
}
|
|
49
55
|
});
|
|
@@ -52,21 +58,27 @@ function transformer(file, api, options) {
|
|
|
52
58
|
name: 'MuiDivider'
|
|
53
59
|
}
|
|
54
60
|
}).forEach(path => {
|
|
61
|
+
var _lightProp$value2;
|
|
55
62
|
const defaultPropsObject = path.value.value.properties.find(key => key.key.name === 'defaultProps');
|
|
56
|
-
const
|
|
57
|
-
if (
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
63
|
+
const lightProp = defaultPropsObject.value.properties.find(prop => prop.key.name === 'light');
|
|
64
|
+
if (!lightProp) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
defaultPropsObject.value.properties = defaultPropsObject.value.properties.filter(prop => {
|
|
68
|
+
var _prop$key;
|
|
69
|
+
return !['light'].includes(prop == null || (_prop$key = prop.key) == null ? void 0 : _prop$key.name);
|
|
70
|
+
});
|
|
71
|
+
const isLightPropTruthy = ((_lightProp$value2 = lightProp.value) == null ? void 0 : _lightProp$value2.value) !== false;
|
|
72
|
+
if (!isLightPropTruthy) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const sxIndex = defaultPropsObject.value.properties.findIndex(prop => prop.key.name === 'sx');
|
|
76
|
+
if (sxIndex === -1) {
|
|
77
|
+
defaultPropsObject.value.properties.push(j.objectProperty(j.identifier('sx'), j.objectExpression([j.objectProperty(j.identifier('opacity'), j.literal('0.6'))])));
|
|
78
|
+
} else {
|
|
79
|
+
const opacityIndex = defaultPropsObject.value.properties[sxIndex].value.properties.findIndex(key => key.key.name === 'opacity');
|
|
80
|
+
if (opacityIndex === -1) {
|
|
81
|
+
defaultPropsObject.value.properties[sxIndex].value.properties.push(j.objectProperty(j.identifier('opacity'), j.literal('0.6')));
|
|
70
82
|
}
|
|
71
83
|
}
|
|
72
84
|
});
|
|
@@ -17,16 +17,10 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
19
|
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Divider.default, {
|
|
20
|
-
className: "test"
|
|
21
|
-
sx: {
|
|
22
|
-
opacity: "0.6"
|
|
23
|
-
}
|
|
20
|
+
className: "test"
|
|
24
21
|
});
|
|
25
22
|
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Divider, {
|
|
26
|
-
className: "test"
|
|
27
|
-
sx: {
|
|
28
|
-
opacity: "0.6"
|
|
29
|
-
}
|
|
23
|
+
className: "test"
|
|
30
24
|
});
|
|
31
25
|
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Divider.default, {
|
|
32
26
|
className: "test",
|
|
@@ -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 _typographyProps.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
var _typographyProps = _interopRequireDefault(require("./typography-props"));
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
|
|
5
|
+
var _material = require("@mui/material");
|
|
6
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
7
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {});
|
|
8
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {});
|
|
9
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
10
|
+
className: "my-class"
|
|
11
|
+
});
|
|
12
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
13
|
+
className: "my-class"
|
|
14
|
+
});
|
|
15
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
16
|
+
paragraph: true
|
|
17
|
+
});
|
|
18
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
19
|
+
paragraph: true
|
|
20
|
+
});
|
|
21
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
22
|
+
paragraph: true,
|
|
23
|
+
className: "my-class"
|
|
24
|
+
});
|
|
25
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
26
|
+
paragraph: true,
|
|
27
|
+
className: "my-class"
|
|
28
|
+
});
|
|
29
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
30
|
+
paragraph: false,
|
|
31
|
+
className: "my-class"
|
|
32
|
+
});
|
|
33
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
34
|
+
paragraph: false,
|
|
35
|
+
className: "my-class"
|
|
36
|
+
});
|
|
37
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
38
|
+
paragraph: paragraph,
|
|
39
|
+
className: "my-class"
|
|
40
|
+
});
|
|
41
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
42
|
+
paragraph: paragraph,
|
|
43
|
+
className: "my-class"
|
|
44
|
+
});
|
|
45
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
46
|
+
paragraph: true,
|
|
47
|
+
sx: {
|
|
48
|
+
marginBottom: "32px"
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
52
|
+
paragraph: true,
|
|
53
|
+
sx: {
|
|
54
|
+
marginBottom: "32px"
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
58
|
+
paragraph: true,
|
|
59
|
+
sx: {
|
|
60
|
+
mb: "32px"
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
64
|
+
paragraph: true,
|
|
65
|
+
sx: {
|
|
66
|
+
mb: "32px"
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
70
|
+
paragraph: true,
|
|
71
|
+
sx: {
|
|
72
|
+
color: "black"
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
76
|
+
paragraph: true,
|
|
77
|
+
sx: {
|
|
78
|
+
color: "black"
|
|
79
|
+
}
|
|
80
|
+
});
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
|
|
5
|
+
var _material = require("@mui/material");
|
|
6
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
7
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {});
|
|
8
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {});
|
|
9
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
10
|
+
className: "my-class"
|
|
11
|
+
});
|
|
12
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
13
|
+
className: "my-class"
|
|
14
|
+
});
|
|
15
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
16
|
+
sx: {
|
|
17
|
+
marginBottom: "16px"
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
21
|
+
sx: {
|
|
22
|
+
marginBottom: "16px"
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
26
|
+
className: "my-class",
|
|
27
|
+
sx: {
|
|
28
|
+
marginBottom: "16px"
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
32
|
+
className: "my-class",
|
|
33
|
+
sx: {
|
|
34
|
+
marginBottom: "16px"
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
38
|
+
className: "my-class"
|
|
39
|
+
});
|
|
40
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
41
|
+
className: "my-class"
|
|
42
|
+
});
|
|
43
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
44
|
+
className: "my-class",
|
|
45
|
+
sx: {
|
|
46
|
+
marginBottom: "16px"
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
50
|
+
className: "my-class",
|
|
51
|
+
sx: {
|
|
52
|
+
marginBottom: "16px"
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
56
|
+
sx: {
|
|
57
|
+
marginBottom: "32px"
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
61
|
+
sx: {
|
|
62
|
+
marginBottom: "32px"
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
66
|
+
sx: {
|
|
67
|
+
mb: "32px"
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
71
|
+
sx: {
|
|
72
|
+
mb: "32px"
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
76
|
+
sx: {
|
|
77
|
+
color: "black",
|
|
78
|
+
marginBottom: "16px"
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
82
|
+
sx: {
|
|
83
|
+
color: "black",
|
|
84
|
+
marginBottom: "16px"
|
|
85
|
+
}
|
|
86
|
+
});
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
fn({
|
|
4
|
+
MuiTypography: {
|
|
5
|
+
defaultProps: {}
|
|
6
|
+
}
|
|
7
|
+
});
|
|
8
|
+
fn({
|
|
9
|
+
MuiTypography: {
|
|
10
|
+
defaultProps: {
|
|
11
|
+
className: "my-class"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
fn({
|
|
16
|
+
MuiTypography: {
|
|
17
|
+
defaultProps: {
|
|
18
|
+
paragraph: false
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
fn({
|
|
23
|
+
MuiTypography: {
|
|
24
|
+
defaultProps: {
|
|
25
|
+
paragraph: false,
|
|
26
|
+
className: "my-class"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
fn({
|
|
31
|
+
MuiTypography: {
|
|
32
|
+
defaultProps: {
|
|
33
|
+
paragraph: true
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
fn({
|
|
38
|
+
MuiTypography: {
|
|
39
|
+
defaultProps: {
|
|
40
|
+
paragraph: true,
|
|
41
|
+
className: "my-class"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
fn({
|
|
46
|
+
MuiTypography: {
|
|
47
|
+
defaultProps: {
|
|
48
|
+
paragraph,
|
|
49
|
+
className: "my-class"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
fn({
|
|
54
|
+
MuiTypography: {
|
|
55
|
+
defaultProps: {
|
|
56
|
+
paragraph,
|
|
57
|
+
className: "my-class",
|
|
58
|
+
sx: {
|
|
59
|
+
marginBottom: "32px"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
fn({
|
|
65
|
+
MuiTypography: {
|
|
66
|
+
defaultProps: {
|
|
67
|
+
paragraph,
|
|
68
|
+
className: "my-class",
|
|
69
|
+
sx: {
|
|
70
|
+
mb: "32px"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
fn({
|
|
76
|
+
MuiTypography: {
|
|
77
|
+
defaultProps: {
|
|
78
|
+
paragraph,
|
|
79
|
+
className: "my-class",
|
|
80
|
+
sx: {
|
|
81
|
+
color: "black"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
});
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
fn({
|
|
4
|
+
MuiTypography: {
|
|
5
|
+
defaultProps: {}
|
|
6
|
+
}
|
|
7
|
+
});
|
|
8
|
+
fn({
|
|
9
|
+
MuiTypography: {
|
|
10
|
+
defaultProps: {
|
|
11
|
+
className: "my-class"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
fn({
|
|
16
|
+
MuiTypography: {
|
|
17
|
+
defaultProps: {}
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
fn({
|
|
21
|
+
MuiTypography: {
|
|
22
|
+
defaultProps: {
|
|
23
|
+
className: "my-class"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
fn({
|
|
28
|
+
MuiTypography: {
|
|
29
|
+
defaultProps: {
|
|
30
|
+
sx: {
|
|
31
|
+
marginBottom: "16px"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
fn({
|
|
37
|
+
MuiTypography: {
|
|
38
|
+
defaultProps: {
|
|
39
|
+
className: "my-class",
|
|
40
|
+
sx: {
|
|
41
|
+
marginBottom: "16px"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
fn({
|
|
47
|
+
MuiTypography: {
|
|
48
|
+
defaultProps: {
|
|
49
|
+
className: "my-class",
|
|
50
|
+
sx: {
|
|
51
|
+
marginBottom: "16px"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
fn({
|
|
57
|
+
MuiTypography: {
|
|
58
|
+
defaultProps: {
|
|
59
|
+
className: "my-class",
|
|
60
|
+
sx: {
|
|
61
|
+
marginBottom: "32px"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
fn({
|
|
67
|
+
MuiTypography: {
|
|
68
|
+
defaultProps: {
|
|
69
|
+
className: "my-class",
|
|
70
|
+
sx: {
|
|
71
|
+
mb: "32px"
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
fn({
|
|
77
|
+
MuiTypography: {
|
|
78
|
+
defaultProps: {
|
|
79
|
+
className: "my-class",
|
|
80
|
+
sx: {
|
|
81
|
+
color: "black",
|
|
82
|
+
marginBottom: "16px"
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
});
|
|
@@ -0,0 +1,86 @@
|
|
|
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 _appendAttribute = _interopRequireDefault(require("../../util/appendAttribute"));
|
|
9
|
+
var _assignObject = _interopRequireDefault(require("../../util/assignObject"));
|
|
10
|
+
var _findComponentJSX = _interopRequireDefault(require("../../util/findComponentJSX"));
|
|
11
|
+
/**
|
|
12
|
+
* @param {import('jscodeshift').FileInfo} file
|
|
13
|
+
* @param {import('jscodeshift').API} api
|
|
14
|
+
*/
|
|
15
|
+
function transformer(file, api, options) {
|
|
16
|
+
const j = api.jscodeshift;
|
|
17
|
+
const root = j(file.source);
|
|
18
|
+
const printOptions = options.printOptions;
|
|
19
|
+
(0, _findComponentJSX.default)(j, {
|
|
20
|
+
root,
|
|
21
|
+
componentName: 'Typography'
|
|
22
|
+
}, elementPath => {
|
|
23
|
+
var _paragraphProp$value;
|
|
24
|
+
const paragraphProp = elementPath.node.openingElement.attributes.find(attr => attr.type === 'JSXAttribute' && attr.name.name === 'paragraph');
|
|
25
|
+
if (!paragraphProp) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
elementPath.node.openingElement.attributes = elementPath.node.openingElement.attributes.filter(attr => {
|
|
29
|
+
if (attr.type === 'JSXAttribute' && attr.name.name === 'paragraph') {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
return true;
|
|
33
|
+
});
|
|
34
|
+
const isParagraphPropTruthy = ((_paragraphProp$value = paragraphProp.value) == null ? void 0 : _paragraphProp$value.expression.value) !== false;
|
|
35
|
+
if (!isParagraphPropTruthy) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const sxIndex = elementPath.node.openingElement.attributes.findIndex(attr => attr.type === 'JSXAttribute' && attr.name.name === 'sx');
|
|
39
|
+
if (sxIndex === -1) {
|
|
40
|
+
(0, _appendAttribute.default)(j, {
|
|
41
|
+
target: elementPath.node,
|
|
42
|
+
attributeName: 'sx',
|
|
43
|
+
expression: j.objectExpression([j.objectProperty(j.identifier('marginBottom'), j.literal('16px'))])
|
|
44
|
+
});
|
|
45
|
+
} else {
|
|
46
|
+
const hasMarginBottom = elementPath.node.openingElement.attributes[sxIndex].value.expression.properties.some(key => key.key.name === 'marginBottom' || key.key.name === 'mb');
|
|
47
|
+
if (!hasMarginBottom) {
|
|
48
|
+
(0, _assignObject.default)(j, {
|
|
49
|
+
target: elementPath.node.openingElement.attributes[sxIndex],
|
|
50
|
+
key: 'marginBottom',
|
|
51
|
+
expression: j.literal('16px')
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
root.find(j.ObjectProperty, {
|
|
57
|
+
key: {
|
|
58
|
+
name: 'MuiTypography'
|
|
59
|
+
}
|
|
60
|
+
}).forEach(path => {
|
|
61
|
+
var _paragraphProp$value2;
|
|
62
|
+
const defaultPropsObject = path.value.value.properties.find(key => key.key.name === 'defaultProps');
|
|
63
|
+
const paragraphProp = defaultPropsObject.value.properties.find(prop => prop.key.name === 'paragraph');
|
|
64
|
+
if (!paragraphProp) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
defaultPropsObject.value.properties = defaultPropsObject.value.properties.filter(prop => {
|
|
68
|
+
var _prop$key;
|
|
69
|
+
return !['paragraph'].includes(prop == null || (_prop$key = prop.key) == null ? void 0 : _prop$key.name);
|
|
70
|
+
});
|
|
71
|
+
const isParagraphPropTruthy = ((_paragraphProp$value2 = paragraphProp.value) == null ? void 0 : _paragraphProp$value2.value) !== false;
|
|
72
|
+
if (!isParagraphPropTruthy) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const sxIndex = defaultPropsObject.value.properties.findIndex(prop => prop.key.name === 'sx');
|
|
76
|
+
if (sxIndex === -1) {
|
|
77
|
+
defaultPropsObject.value.properties.push(j.objectProperty(j.identifier('sx'), j.objectExpression([j.objectProperty(j.identifier('marginBottom'), j.literal('16px'))])));
|
|
78
|
+
} else {
|
|
79
|
+
const hasMarginBottom = defaultPropsObject.value.properties[sxIndex].value.properties.some(key => key.key.name === 'marginBottom' || key.key.name === 'mb');
|
|
80
|
+
if (!hasMarginBottom) {
|
|
81
|
+
defaultPropsObject.value.properties[sxIndex].value.properties.push(j.objectProperty(j.identifier('marginBottom'), j.literal('16px')));
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
return root.toSource(printOptions);
|
|
86
|
+
}
|
|
@@ -270,15 +270,37 @@ function sxV6(file, api, options) {
|
|
|
270
270
|
}
|
|
271
271
|
}
|
|
272
272
|
if (data.node.argument.type === 'ConditionalExpression') {
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
273
|
+
const isSxSpread = data.node.argument.consequent.type === 'Identifier' && data.node.argument.consequent.name === 'sx' || data.node.argument.alternate.type === 'Identifier' && data.node.argument.alternate.name === 'sx';
|
|
274
|
+
if (!isSxSpread) {
|
|
275
|
+
recurseObjectExpression({
|
|
276
|
+
...data,
|
|
277
|
+
node: data.node.argument,
|
|
278
|
+
parentNode: data.node
|
|
279
|
+
});
|
|
280
|
+
wrapSxInArray(data.node.argument);
|
|
281
|
+
if (data.deleteSelf) {
|
|
282
|
+
data.deleteSelf();
|
|
283
|
+
} else {
|
|
284
|
+
(0, _migrateToVariants.removeProperty)(data.parentNode, data.node);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
if (data.node.argument.type === 'CallExpression') {
|
|
289
|
+
var _getObjectKey7, _data$node$argument$c;
|
|
290
|
+
if (((_getObjectKey7 = (0, _migrateToVariants.getObjectKey)(data.node.argument.callee)) == null ? void 0 : _getObjectKey7.name) === 'theme' && (_data$node$argument$c = data.node.argument.callee.property) != null && (_data$node$argument$c = _data$node$argument$c.name) != null && _data$node$argument$c.startsWith('apply')) {
|
|
291
|
+
const objIndex = data.node.argument.arguments.findIndex(arg => arg.type === 'ObjectExpression');
|
|
292
|
+
recurseObjectExpression({
|
|
293
|
+
...data,
|
|
294
|
+
node: data.node.argument.arguments[objIndex],
|
|
295
|
+
buildStyle: styleExpression => {
|
|
296
|
+
const newArguments = [...data.node.argument.arguments];
|
|
297
|
+
newArguments[objIndex] = styleExpression;
|
|
298
|
+
return j.arrowFunctionExpression([j.identifier('theme')], {
|
|
299
|
+
...data.node.argument,
|
|
300
|
+
arguments: newArguments
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
});
|
|
282
304
|
}
|
|
283
305
|
}
|
|
284
306
|
}
|
|
@@ -368,8 +390,8 @@ function sxV6(file, api, options) {
|
|
|
368
390
|
}
|
|
369
391
|
}
|
|
370
392
|
if ((_data$node$expression = data.node.expressions) != null && _data$node$expression.some(expression => {
|
|
371
|
-
var
|
|
372
|
-
return ((
|
|
393
|
+
var _getObjectKey8, _getObjectKey9;
|
|
394
|
+
return ((_getObjectKey8 = (0, _migrateToVariants.getObjectKey)(expression)) == null ? void 0 : _getObjectKey8.name) === 'theme' || expression.type === 'CallExpression' && ((_getObjectKey9 = (0, _migrateToVariants.getObjectKey)(expression.callee)) == null ? void 0 : _getObjectKey9.name) === 'theme';
|
|
373
395
|
})) {
|
|
374
396
|
rootThemeCallback(data);
|
|
375
397
|
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(ButtonBase, {
|
|
5
|
+
component: "span",
|
|
6
|
+
ref: ref,
|
|
7
|
+
...props,
|
|
8
|
+
disabled: Boolean(disabled),
|
|
9
|
+
onClick: event => {
|
|
10
|
+
if (ref.current) {
|
|
11
|
+
ref.current.scrollIntoView({
|
|
12
|
+
block: 'nearest'
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
if (props.onClick) {
|
|
16
|
+
props.onClick(event);
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
onFocusVisible: event => {
|
|
20
|
+
if (ref.current) {
|
|
21
|
+
ref.current.scrollIntoView({
|
|
22
|
+
block: 'nearest'
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
if (props.onFocusVisible) {
|
|
26
|
+
props.onFocusVisible(event);
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
sx: [theme => ({
|
|
30
|
+
justifyContent: 'flex-start',
|
|
31
|
+
textAlign: 'left',
|
|
32
|
+
alignItems: 'center',
|
|
33
|
+
borderRadius: 1,
|
|
34
|
+
height: '100%',
|
|
35
|
+
border: '1px solid transparent',
|
|
36
|
+
transitionProperty: 'all',
|
|
37
|
+
transitionDuration: '150ms',
|
|
38
|
+
// color: 'primary.300',
|
|
39
|
+
overflow: 'auto',
|
|
40
|
+
...((!disableBorder || selected) && {
|
|
41
|
+
borderColor: 'grey.100'
|
|
42
|
+
}),
|
|
43
|
+
...(selected && {
|
|
44
|
+
bgcolor: `${alpha(theme.palette.primary[50], 0.5)}`,
|
|
45
|
+
borderColor: 'primary.300',
|
|
46
|
+
boxShadow: `0px 1px 4px ${theme.palette.primary[200]}, inset 0px 2px 4px ${alpha(theme.palette.primary[100], 0.5)}`
|
|
47
|
+
// color: 'primary.500',
|
|
48
|
+
}),
|
|
49
|
+
...(!selected && {
|
|
50
|
+
'&:hover, &:focus': {
|
|
51
|
+
bgcolor: 'primary.50',
|
|
52
|
+
borderColor: 'primary.100',
|
|
53
|
+
'@media (hover: none)': {
|
|
54
|
+
bgcolor: 'transparent'
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}),
|
|
58
|
+
...theme.applyDarkStyles({
|
|
59
|
+
color: 'primary.800',
|
|
60
|
+
...((!disableBorder || selected) && {
|
|
61
|
+
borderColor: `${alpha(theme.palette.primaryDark[600], 0.3)}`
|
|
62
|
+
}),
|
|
63
|
+
...(!selected && {
|
|
64
|
+
'&:hover, &:focus': {
|
|
65
|
+
bgcolor: `${alpha(theme.palette.primary[800], 0.1)}`,
|
|
66
|
+
borderColor: `${alpha(theme.palette.primary[500], 0.3)}`,
|
|
67
|
+
'@media (hover: none)': {
|
|
68
|
+
bgcolor: 'transparent'
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}),
|
|
72
|
+
...(selected && {
|
|
73
|
+
bgcolor: `${alpha(theme.palette.primary[800], 0.3)}`,
|
|
74
|
+
borderColor: 'primary.700',
|
|
75
|
+
// color: 'primary.300',
|
|
76
|
+
boxShadow: `0px 1px 4px ${(theme.vars || theme).palette.primary[900]}, inset 0px 2px 4px ${(theme.vars || theme).palette.primaryDark[800]}`
|
|
77
|
+
})
|
|
78
|
+
}),
|
|
79
|
+
...theme.applyStyles('light', {
|
|
80
|
+
color: 'primary.500',
|
|
81
|
+
...((!disableBorder || selected) && {
|
|
82
|
+
borderColor: `${alpha(theme.palette.primary[300], 0.3)}`
|
|
83
|
+
})
|
|
84
|
+
}),
|
|
85
|
+
'&.Mui-disabled': {
|
|
86
|
+
opacity: 0.4
|
|
87
|
+
}
|
|
88
|
+
}), ...(Array.isArray(sx) ? sx : [sx])]
|
|
89
|
+
});
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(ButtonBase, {
|
|
5
|
+
component: "span",
|
|
6
|
+
ref: ref,
|
|
7
|
+
...props,
|
|
8
|
+
disabled: Boolean(disabled),
|
|
9
|
+
onClick: event => {
|
|
10
|
+
if (ref.current) {
|
|
11
|
+
ref.current.scrollIntoView({
|
|
12
|
+
block: 'nearest'
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
if (props.onClick) {
|
|
16
|
+
props.onClick(event);
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
onFocusVisible: event => {
|
|
20
|
+
if (ref.current) {
|
|
21
|
+
ref.current.scrollIntoView({
|
|
22
|
+
block: 'nearest'
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
if (props.onFocusVisible) {
|
|
26
|
+
props.onFocusVisible(event);
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
sx: [theme => ({
|
|
30
|
+
justifyContent: 'flex-start',
|
|
31
|
+
textAlign: 'left',
|
|
32
|
+
alignItems: 'center',
|
|
33
|
+
borderRadius: 1,
|
|
34
|
+
height: '100%',
|
|
35
|
+
border: '1px solid transparent',
|
|
36
|
+
transitionProperty: 'all',
|
|
37
|
+
transitionDuration: '150ms',
|
|
38
|
+
// color: 'primary.300',
|
|
39
|
+
overflow: 'auto',
|
|
40
|
+
...theme.applyDarkStyles({
|
|
41
|
+
color: 'primary.800'
|
|
42
|
+
}),
|
|
43
|
+
...theme.applyStyles('light', {
|
|
44
|
+
color: 'primary.500'
|
|
45
|
+
}),
|
|
46
|
+
'&.Mui-disabled': {
|
|
47
|
+
opacity: 0.4
|
|
48
|
+
}
|
|
49
|
+
}), (!disableBorder || selected) && {
|
|
50
|
+
borderColor: 'grey.100'
|
|
51
|
+
}, selected && (theme => ({
|
|
52
|
+
bgcolor: `${alpha(theme.palette.primary[50], 0.5)}`,
|
|
53
|
+
borderColor: 'primary.300',
|
|
54
|
+
// color: 'primary.500',
|
|
55
|
+
boxShadow: `0px 1px 4px ${theme.palette.primary[200]}, inset 0px 2px 4px ${alpha(theme.palette.primary[100], 0.5)}`
|
|
56
|
+
})), !selected && {
|
|
57
|
+
'&:hover, &:focus': {
|
|
58
|
+
bgcolor: 'primary.50',
|
|
59
|
+
borderColor: 'primary.100',
|
|
60
|
+
'@media (hover: none)': {
|
|
61
|
+
bgcolor: 'transparent'
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}, (!disableBorder || selected) && (theme => theme.applyDarkStyles({
|
|
65
|
+
borderColor: `${alpha(theme.palette.primaryDark[600], 0.3)}`
|
|
66
|
+
})), !selected && (theme => theme.applyDarkStyles({
|
|
67
|
+
'&:hover, &:focus': {
|
|
68
|
+
bgcolor: `${alpha(theme.palette.primary[800], 0.1)}`,
|
|
69
|
+
borderColor: `${alpha(theme.palette.primary[500], 0.3)}`,
|
|
70
|
+
'@media (hover: none)': {
|
|
71
|
+
bgcolor: 'transparent'
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
})), selected && (theme => theme.applyDarkStyles({
|
|
75
|
+
bgcolor: `${alpha(theme.palette.primary[800], 0.3)}`,
|
|
76
|
+
borderColor: 'primary.700',
|
|
77
|
+
// color: 'primary.300',
|
|
78
|
+
boxShadow: `0px 1px 4px ${(theme.vars || theme).palette.primary[900]}, inset 0px 2px 4px ${(theme.vars || theme).palette.primaryDark[800]}`
|
|
79
|
+
})), (!disableBorder || selected) && (theme => theme.applyStyles('light', {
|
|
80
|
+
borderColor: `${alpha(theme.palette.primary[300], 0.3)}`
|
|
81
|
+
})), ...(Array.isArray(sx) ? sx : [sx])]
|
|
82
|
+
});
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
var _react = require("react");
|
|
5
|
+
var _it$images$, _productOffer$ui, _productOffer$ui2;
|
|
6
|
+
/*#__PURE__*/(0, _react.createElement)(Card, {
|
|
7
|
+
...otherProps,
|
|
8
|
+
ref: ref,
|
|
9
|
+
key: it.wcId,
|
|
10
|
+
"data-p": it.performance / 100,
|
|
11
|
+
variant: "outlined",
|
|
12
|
+
sx: {
|
|
13
|
+
gap: '0.25rem',
|
|
14
|
+
textDecoration: 'none',
|
|
15
|
+
borderRadius: 0.75,
|
|
16
|
+
background: 'linear-gradient(45deg, rgba(235, 245, 255, 0.30) 40%, rgba(243, 246, 249, 0.20) 100%)',
|
|
17
|
+
transition: 'all 200ms ease-in-out',
|
|
18
|
+
...(horizontal ? {
|
|
19
|
+
display: 'flex',
|
|
20
|
+
flexDirection: 'row',
|
|
21
|
+
pr: 1
|
|
22
|
+
} : {
|
|
23
|
+
display: 'flex',
|
|
24
|
+
flexDirection: 'column',
|
|
25
|
+
pb: 0.5
|
|
26
|
+
}),
|
|
27
|
+
cursor: 'pointer',
|
|
28
|
+
'&:hover': {
|
|
29
|
+
borderColor: '#99CCFF',
|
|
30
|
+
boxShadow: '0px 4px 16px #DAE2ED',
|
|
31
|
+
transition: 'all 200ms ease-in-out !important'
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
onClick: ev => {
|
|
35
|
+
ev.preventDefault();
|
|
36
|
+
navigate(href);
|
|
37
|
+
}
|
|
38
|
+
}, /*#__PURE__*/(0, _jsxRuntime.jsxs)(Box, {
|
|
39
|
+
component: Link,
|
|
40
|
+
to: href,
|
|
41
|
+
sx: {
|
|
42
|
+
position: 'relative',
|
|
43
|
+
aspectRatio: '100/55',
|
|
44
|
+
...(horizontal ? {
|
|
45
|
+
maxWidth: '50vw',
|
|
46
|
+
height: {
|
|
47
|
+
sm: '150px',
|
|
48
|
+
md: '170px',
|
|
49
|
+
lg: '210px',
|
|
50
|
+
xl: '250px'
|
|
51
|
+
}
|
|
52
|
+
} : {
|
|
53
|
+
width: '100%'
|
|
54
|
+
})
|
|
55
|
+
},
|
|
56
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(ResponsiveImage, {
|
|
57
|
+
sizes: imageSizes,
|
|
58
|
+
loading: imageLoading,
|
|
59
|
+
src: (_it$images$ = it.images[0]) == null ? void 0 : _it$images$.src,
|
|
60
|
+
alt: it.name,
|
|
61
|
+
style: {
|
|
62
|
+
aspectRatio: '100/55',
|
|
63
|
+
...(horizontal ? {
|
|
64
|
+
width: 'auto',
|
|
65
|
+
height: '100%'
|
|
66
|
+
} : {
|
|
67
|
+
width: '100%',
|
|
68
|
+
height: 'auto'
|
|
69
|
+
})
|
|
70
|
+
}
|
|
71
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(NoSsr, {
|
|
72
|
+
children: productOffer && ((_productOffer$ui = productOffer.ui) == null ? void 0 : _productOffer$ui.itemCard) && /*#__PURE__*/(0, _jsxRuntime.jsx)(PromoBanner, {
|
|
73
|
+
style: {
|
|
74
|
+
...defaultPromoCodeStyles,
|
|
75
|
+
...productOffer.style,
|
|
76
|
+
...((_productOffer$ui2 = productOffer.ui) == null || (_productOffer$ui2 = _productOffer$ui2.itemCard) == null ? void 0 : _productOffer$ui2.style)
|
|
77
|
+
},
|
|
78
|
+
children: productOffer.offerText
|
|
79
|
+
})
|
|
80
|
+
})]
|
|
81
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(Stack, {
|
|
82
|
+
direction: "column",
|
|
83
|
+
sx: {
|
|
84
|
+
flex: 1,
|
|
85
|
+
...(horizontal ? {
|
|
86
|
+
py: 1.5,
|
|
87
|
+
px: 1.5
|
|
88
|
+
} : {
|
|
89
|
+
px: 1,
|
|
90
|
+
pb: 0.5
|
|
91
|
+
})
|
|
92
|
+
}
|
|
93
|
+
}));
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
var _react = require("react");
|
|
5
|
+
var _it$images$, _productOffer$ui, _productOffer$ui2;
|
|
6
|
+
/*#__PURE__*/(0, _react.createElement)(Card, {
|
|
7
|
+
...otherProps,
|
|
8
|
+
ref: ref,
|
|
9
|
+
key: it.wcId,
|
|
10
|
+
"data-p": it.performance / 100,
|
|
11
|
+
variant: "outlined",
|
|
12
|
+
sx: [{
|
|
13
|
+
gap: '0.25rem',
|
|
14
|
+
textDecoration: 'none',
|
|
15
|
+
borderRadius: 0.75,
|
|
16
|
+
background: 'linear-gradient(45deg, rgba(235, 245, 255, 0.30) 40%, rgba(243, 246, 249, 0.20) 100%)',
|
|
17
|
+
transition: 'all 200ms ease-in-out',
|
|
18
|
+
cursor: 'pointer',
|
|
19
|
+
'&:hover': {
|
|
20
|
+
borderColor: '#99CCFF',
|
|
21
|
+
boxShadow: '0px 4px 16px #DAE2ED',
|
|
22
|
+
transition: 'all 200ms ease-in-out !important'
|
|
23
|
+
}
|
|
24
|
+
}, horizontal ? {
|
|
25
|
+
display: 'flex',
|
|
26
|
+
flexDirection: 'row',
|
|
27
|
+
pr: 1
|
|
28
|
+
} : {
|
|
29
|
+
display: 'flex',
|
|
30
|
+
flexDirection: 'column',
|
|
31
|
+
pb: 0.5
|
|
32
|
+
}],
|
|
33
|
+
onClick: ev => {
|
|
34
|
+
ev.preventDefault();
|
|
35
|
+
navigate(href);
|
|
36
|
+
}
|
|
37
|
+
}, /*#__PURE__*/(0, _jsxRuntime.jsxs)(Box, {
|
|
38
|
+
component: Link,
|
|
39
|
+
to: href,
|
|
40
|
+
sx: [{
|
|
41
|
+
position: 'relative',
|
|
42
|
+
aspectRatio: '100/55'
|
|
43
|
+
}, horizontal ? {
|
|
44
|
+
maxWidth: '50vw',
|
|
45
|
+
height: {
|
|
46
|
+
sm: '150px',
|
|
47
|
+
md: '170px',
|
|
48
|
+
lg: '210px',
|
|
49
|
+
xl: '250px'
|
|
50
|
+
}
|
|
51
|
+
} : {
|
|
52
|
+
width: '100%'
|
|
53
|
+
}],
|
|
54
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(ResponsiveImage, {
|
|
55
|
+
sizes: imageSizes,
|
|
56
|
+
loading: imageLoading,
|
|
57
|
+
src: (_it$images$ = it.images[0]) == null ? void 0 : _it$images$.src,
|
|
58
|
+
alt: it.name,
|
|
59
|
+
style: {
|
|
60
|
+
aspectRatio: '100/55',
|
|
61
|
+
...(horizontal ? {
|
|
62
|
+
width: 'auto',
|
|
63
|
+
height: '100%'
|
|
64
|
+
} : {
|
|
65
|
+
width: '100%',
|
|
66
|
+
height: 'auto'
|
|
67
|
+
})
|
|
68
|
+
}
|
|
69
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(NoSsr, {
|
|
70
|
+
children: productOffer && ((_productOffer$ui = productOffer.ui) == null ? void 0 : _productOffer$ui.itemCard) && /*#__PURE__*/(0, _jsxRuntime.jsx)(PromoBanner, {
|
|
71
|
+
style: {
|
|
72
|
+
...defaultPromoCodeStyles,
|
|
73
|
+
...productOffer.style,
|
|
74
|
+
...((_productOffer$ui2 = productOffer.ui) == null || (_productOffer$ui2 = _productOffer$ui2.itemCard) == null ? void 0 : _productOffer$ui2.style)
|
|
75
|
+
},
|
|
76
|
+
children: productOffer.offerText
|
|
77
|
+
})
|
|
78
|
+
})]
|
|
79
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(Stack, {
|
|
80
|
+
direction: "column",
|
|
81
|
+
sx: [{
|
|
82
|
+
flex: 1
|
|
83
|
+
}, horizontal ? {
|
|
84
|
+
py: 1.5,
|
|
85
|
+
px: 1.5
|
|
86
|
+
} : {
|
|
87
|
+
px: 1,
|
|
88
|
+
pb: 0.5
|
|
89
|
+
}]
|
|
90
|
+
}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/codemod",
|
|
3
|
-
"version": "6.0.0-beta.
|
|
3
|
+
"version": "6.0.0-beta.3",
|
|
4
4
|
"bin": "./codemod.js",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "MUI Team",
|
|
@@ -24,11 +24,11 @@
|
|
|
24
24
|
"url": "https://opencollective.com/mui-org"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@babel/core": "^7.24.
|
|
28
|
-
"@babel/runtime": "^7.24.
|
|
29
|
-
"@babel/traverse": "^7.24.
|
|
27
|
+
"@babel/core": "^7.24.9",
|
|
28
|
+
"@babel/runtime": "^7.24.8",
|
|
29
|
+
"@babel/traverse": "^7.24.8",
|
|
30
30
|
"jscodeshift": "^0.16.1",
|
|
31
|
-
"jscodeshift-add-imports": "^1.0.
|
|
31
|
+
"jscodeshift-add-imports": "^1.0.11",
|
|
32
32
|
"postcss": "^8.4.39",
|
|
33
33
|
"postcss-cli": "^11.0.0",
|
|
34
34
|
"yargs": "^17.7.2"
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"directory": "build"
|
|
45
45
|
},
|
|
46
46
|
"engines": {
|
|
47
|
-
"node": ">=
|
|
47
|
+
"node": ">=14.0.0"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"test": "cd ../../ && cross-env NODE_ENV=test mocha 'packages/mui-codemod/**/*.test.js'",
|