@mui/codemod 6.0.0-alpha.9 → 6.0.0-beta.1
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 +423 -168
- package/codemod.js +0 -2
- package/node/deprecations/all/deprecations-all.js +34 -26
- package/node/deprecations/all/postcss.config.js +7 -1
- package/node/deprecations/autocomplete-props/autocomplete-props.js +0 -32
- package/node/deprecations/autocomplete-props/test-cases/actual.js +13 -35
- package/node/deprecations/autocomplete-props/test-cases/expected.js +13 -41
- package/node/deprecations/autocomplete-props/test-cases/theme.actual.js +0 -18
- package/node/deprecations/autocomplete-props/test-cases/theme.expected.js +0 -22
- package/node/deprecations/backdrop-props/backdrop-props.js +3 -5
- package/node/deprecations/backdrop-props/test-cases/actual.js +30 -14
- package/node/deprecations/backdrop-props/test-cases/expected.js +23 -13
- package/node/deprecations/backdrop-props/test-cases/theme.actual.js +32 -6
- package/node/deprecations/backdrop-props/test-cases/theme.expected.js +27 -5
- package/node/deprecations/filled-input-props/filled-input-props.js +22 -0
- package/node/deprecations/filled-input-props/index.js +13 -0
- package/node/deprecations/filled-input-props/test-cases/actual.js +60 -0
- package/node/deprecations/filled-input-props/test-cases/expected.js +52 -0
- package/node/deprecations/filled-input-props/test-cases/theme.actual.js +73 -0
- package/node/deprecations/filled-input-props/test-cases/theme.expected.js +65 -0
- package/node/deprecations/input-base-props/index.js +13 -0
- package/node/deprecations/input-base-props/input-base-props.js +22 -0
- package/node/deprecations/input-base-props/test-cases/actual.js +60 -0
- package/node/deprecations/input-base-props/test-cases/expected.js +52 -0
- package/node/deprecations/input-base-props/test-cases/theme.actual.js +73 -0
- package/node/deprecations/input-base-props/test-cases/theme.expected.js +65 -0
- package/node/deprecations/input-props/index.js +13 -0
- package/node/deprecations/input-props/input-props.js +22 -0
- package/node/deprecations/input-props/test-cases/actual.js +60 -0
- package/node/deprecations/input-props/test-cases/expected.js +52 -0
- package/node/deprecations/input-props/test-cases/theme.actual.js +73 -0
- package/node/deprecations/input-props/test-cases/theme.expected.js +65 -0
- package/node/deprecations/modal-props/index.js +13 -0
- package/node/deprecations/modal-props/modal-props.js +22 -0
- package/node/deprecations/modal-props/test-cases/actual.js +43 -0
- package/node/deprecations/modal-props/test-cases/expected.js +40 -0
- package/node/deprecations/modal-props/test-cases/theme.actual.js +56 -0
- package/node/deprecations/modal-props/test-cases/theme.expected.js +53 -0
- package/node/deprecations/outlined-input-props/index.js +13 -0
- package/node/deprecations/outlined-input-props/outlined-input-props.js +22 -0
- package/node/deprecations/outlined-input-props/test-cases/actual.js +60 -0
- package/node/deprecations/outlined-input-props/test-cases/expected.js +52 -0
- package/node/deprecations/outlined-input-props/test-cases/theme.actual.js +73 -0
- package/node/deprecations/outlined-input-props/test-cases/theme.expected.js +65 -0
- package/node/deprecations/step-label-props/step-label-props.js +0 -14
- package/node/deprecations/step-label-props/test-cases/actual.js +0 -23
- package/node/deprecations/step-label-props/test-cases/expected.js +0 -27
- package/node/deprecations/step-label-props/test-cases/theme.actual.js +0 -22
- package/node/deprecations/step-label-props/test-cases/theme.expected.js +0 -28
- package/node/deprecations/tab-classes/index.js +13 -0
- package/node/deprecations/tab-classes/postcss-plugin.js +30 -0
- package/node/deprecations/tab-classes/postcss.config.js +8 -0
- package/node/deprecations/tab-classes/tab-classes.js +53 -0
- package/node/deprecations/tab-classes/test-cases/actual.js +5 -0
- package/node/deprecations/tab-classes/test-cases/expected.js +5 -0
- package/node/deprecations/table-sort-label-classes/index.js +13 -0
- package/node/deprecations/table-sort-label-classes/postcss-plugin.js +33 -0
- package/node/deprecations/table-sort-label-classes/postcss.config.js +8 -0
- package/node/deprecations/table-sort-label-classes/table-sort-label-classes.js +77 -0
- package/node/deprecations/table-sort-label-classes/test-cases/actual.js +7 -0
- package/node/deprecations/table-sort-label-classes/test-cases/expected.js +7 -0
- package/node/util/migrateToVariants.js +91 -43
- package/node/v5.0.0/theme-spacing.test/large-actual.js +1 -1
- package/node/v5.0.0/theme-spacing.test/large-expected.js +1 -1
- package/node/v6.0.0/grid-v2-props/grid-v2-props.js +149 -0
- package/node/v6.0.0/grid-v2-props/index.js +13 -0
- package/node/v6.0.0/grid-v2-props/test-cases/actual.js +85 -0
- package/node/v6.0.0/grid-v2-props/test-cases/custom-breakpoints.actual.js +18 -0
- package/node/v6.0.0/grid-v2-props/test-cases/custom-breakpoints.expected.js +22 -0
- package/node/v6.0.0/grid-v2-props/test-cases/expected.js +97 -0
- package/node/v6.0.0/styled/test-cases/ConditionalStyled.expected.js +9 -22
- package/node/v6.0.0/styled/test-cases/DynamicPropsStyled.actual.js +39 -0
- package/node/v6.0.0/styled/test-cases/DynamicPropsStyled.expected.js +65 -0
- package/node/v6.0.0/styled/test-cases/LogicalStyled.actual.js +31 -1
- package/node/v6.0.0/styled/test-cases/LogicalStyled.expected.js +39 -1
- package/node/v6.0.0/styled/test-cases/NestedSpread.expected.js +11 -13
- package/node/v6.0.0/sx-prop/sx-v6.js +111 -39
- 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/node/v6.0.0/sx-prop/test-cases/sx-css-vars.actual.js +14 -0
- package/node/v6.0.0/sx-prop/test-cases/sx-css-vars.expected.js +33 -16
- package/node/v6.0.0/sx-prop/test-cases/sx-dynamic.actual.js +21 -1
- package/node/v6.0.0/sx-prop/test-cases/sx-dynamic.expected.js +19 -1
- package/node/v6.0.0/sx-prop/test-cases/sx-line-break.actual.js +69 -0
- package/node/v6.0.0/sx-prop/test-cases/sx-line-break.expected.js +69 -0
- package/node/v6.0.0/sx-prop/test-cases/sx-value-callback.actual.js +102 -0
- package/node/v6.0.0/sx-prop/test-cases/sx-value-callback.expected.js +111 -0
- package/package.json +7 -7
|
@@ -12,14 +12,18 @@ var _migrateToVariants = require("../../util/migrateToVariants");
|
|
|
12
12
|
* @param {import('jscodeshift').MemberExpression | import('jscodeshift').Identifier} node
|
|
13
13
|
*/
|
|
14
14
|
function getCssVarName(node) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
let varName = '-';
|
|
16
|
+
while (node.type === 'MemberExpression') {
|
|
17
|
+
var _node$object, _node$property;
|
|
18
|
+
varName += `-${((_node$object = node.object) == null ? void 0 : _node$object.name) || ((_node$property = node.property) == null ? void 0 : _node$property.name) || 'unknown'}`;
|
|
19
|
+
if (node.object.type === 'MemberExpression') {
|
|
20
|
+
node = node.object;
|
|
21
|
+
} else {
|
|
22
|
+
node = node.property;
|
|
23
|
+
}
|
|
21
24
|
}
|
|
22
|
-
|
|
25
|
+
varName += `-${node.name || 'unknown'}`;
|
|
26
|
+
return varName;
|
|
23
27
|
}
|
|
24
28
|
|
|
25
29
|
/**
|
|
@@ -112,6 +116,18 @@ function sxV6(file, api, options) {
|
|
|
112
116
|
conditionalExpressions.push([currentIndex, newElement]);
|
|
113
117
|
}
|
|
114
118
|
}
|
|
119
|
+
function rootThemeCallback(data) {
|
|
120
|
+
if (data.root.type === 'ObjectExpression') {
|
|
121
|
+
var _data$replaceRoot;
|
|
122
|
+
(_data$replaceRoot = data.replaceRoot) == null || _data$replaceRoot.call(data, buildArrowFunctionAST([j.identifier('theme')], data.root));
|
|
123
|
+
} else if (data.root.type === 'ArrayExpression') {
|
|
124
|
+
data.root.elements.forEach((item, index) => {
|
|
125
|
+
if (item === data.node) {
|
|
126
|
+
data.root.elements[index] = buildArrowFunctionAST([j.identifier('theme')], data.root);
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
}
|
|
115
131
|
|
|
116
132
|
/**
|
|
117
133
|
*
|
|
@@ -121,10 +137,47 @@ function sxV6(file, api, options) {
|
|
|
121
137
|
if (data.node.type === 'ArrowFunctionExpression') {
|
|
122
138
|
const returnExpression = (0, _getReturnExpression.default)(data.node);
|
|
123
139
|
if (returnExpression) {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
140
|
+
var _returnExpression$pro, _getObjectKey, _getObjectKey2, _getObjectKey3, _getObjectKey4;
|
|
141
|
+
if (returnExpression.type === 'MemberExpression' && ((_returnExpression$pro = returnExpression.property) == null ? void 0 : _returnExpression$pro.type) === 'ConditionalExpression') {
|
|
142
|
+
recurseObjectExpression({
|
|
143
|
+
...data,
|
|
144
|
+
node: j.conditionalExpression(returnExpression.property.test, {
|
|
145
|
+
...returnExpression,
|
|
146
|
+
property: returnExpression.property.consequent
|
|
147
|
+
}, {
|
|
148
|
+
...returnExpression,
|
|
149
|
+
property: returnExpression.property.alternate
|
|
150
|
+
})
|
|
151
|
+
});
|
|
152
|
+
} else if (returnExpression.type === 'TemplateLiteral') {
|
|
153
|
+
const firstExpression = returnExpression.expressions[0];
|
|
154
|
+
if ((firstExpression == null ? void 0 : firstExpression.type) === 'ConditionalExpression') {
|
|
155
|
+
recurseObjectExpression({
|
|
156
|
+
...data,
|
|
157
|
+
node: j.conditionalExpression(firstExpression.test, {
|
|
158
|
+
...returnExpression,
|
|
159
|
+
expressions: [firstExpression.consequent, ...(returnExpression.expressions || []).slice(1)]
|
|
160
|
+
}, {
|
|
161
|
+
...returnExpression,
|
|
162
|
+
expressions: [firstExpression.alternate, ...(returnExpression.expressions || []).slice(1)]
|
|
163
|
+
})
|
|
164
|
+
});
|
|
165
|
+
} else {
|
|
166
|
+
recurseObjectExpression({
|
|
167
|
+
...data,
|
|
168
|
+
node: returnExpression
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
} else if (returnExpression.type === 'CallExpression' && ((_getObjectKey = (0, _migrateToVariants.getObjectKey)(returnExpression.callee)) == null ? void 0 : _getObjectKey.name) === 'theme' || returnExpression.type === 'MemberExpression' && ((_getObjectKey2 = (0, _migrateToVariants.getObjectKey)(returnExpression)) == null ? void 0 : _getObjectKey2.name) === 'theme' || returnExpression.type === 'BinaryExpression' && (((_getObjectKey3 = (0, _migrateToVariants.getObjectKey)(returnExpression.left)) == null ? void 0 : _getObjectKey3.name) === 'theme' || ((_getObjectKey4 = (0, _migrateToVariants.getObjectKey)(returnExpression.right)) == null ? void 0 : _getObjectKey4.name) === 'theme')) {
|
|
172
|
+
var _data$replaceValue;
|
|
173
|
+
(_data$replaceValue = data.replaceValue) == null || _data$replaceValue.call(data, returnExpression);
|
|
174
|
+
rootThemeCallback(data);
|
|
175
|
+
} else {
|
|
176
|
+
recurseObjectExpression({
|
|
177
|
+
...data,
|
|
178
|
+
node: returnExpression
|
|
179
|
+
});
|
|
180
|
+
}
|
|
128
181
|
}
|
|
129
182
|
}
|
|
130
183
|
if (data.node.type === 'ObjectExpression') {
|
|
@@ -162,8 +215,8 @@ function sxV6(file, api, options) {
|
|
|
162
215
|
}
|
|
163
216
|
if (data.node.type === 'SpreadElement') {
|
|
164
217
|
if (data.node.argument.type === 'LogicalExpression') {
|
|
165
|
-
var
|
|
166
|
-
const paramName = data.node.argument.left.type === 'BinaryExpression' ? (
|
|
218
|
+
var _getObjectKey5, _getObjectKey6;
|
|
219
|
+
const paramName = data.node.argument.left.type === 'BinaryExpression' ? (_getObjectKey5 = (0, _migrateToVariants.getObjectKey)(data.node.argument.left.left)) == null ? void 0 : _getObjectKey5.name : (_getObjectKey6 = (0, _migrateToVariants.getObjectKey)(data.node.argument.left)) == null ? void 0 : _getObjectKey6.name;
|
|
167
220
|
if (paramName === 'theme' && data.node.argument.left.right.type === 'StringLiteral') {
|
|
168
221
|
if (data.node.argument.right.type === 'ObjectExpression') {
|
|
169
222
|
const mode = data.node.argument.left.right.value;
|
|
@@ -209,7 +262,7 @@ function sxV6(file, api, options) {
|
|
|
209
262
|
}
|
|
210
263
|
});
|
|
211
264
|
}
|
|
212
|
-
wrapSxInArray(j.logicalExpression(data.node.argument.operator, data.node.argument.left, data.node.argument.right));
|
|
265
|
+
wrapSxInArray(j.logicalExpression(data.node.argument.operator, data.node.argument.left, data.buildStyle(data.node.argument.right)));
|
|
213
266
|
if (data.deleteSelf) {
|
|
214
267
|
data.deleteSelf();
|
|
215
268
|
} else {
|
|
@@ -217,15 +270,37 @@ function sxV6(file, api, options) {
|
|
|
217
270
|
}
|
|
218
271
|
}
|
|
219
272
|
if (data.node.argument.type === 'ConditionalExpression') {
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
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
|
+
});
|
|
229
304
|
}
|
|
230
305
|
}
|
|
231
306
|
}
|
|
@@ -235,7 +310,7 @@ function sxV6(file, api, options) {
|
|
|
235
310
|
if (((_data$parentNode = data.parentNode) == null ? void 0 : _data$parentNode.type) === 'ObjectExpression' && (((_data$node$test = data.node.test) == null ? void 0 : _data$node$test.type) === 'BinaryExpression' || ((_data$node$test2 = data.node.test) == null ? void 0 : _data$node$test2.type) === 'Identifier')) {
|
|
236
311
|
if (data.node.consequent.type !== 'ObjectExpression' && data.node.alternate.type !== 'ObjectExpression') {
|
|
237
312
|
if ((0, _migrateToVariants.isThemePaletteMode)(data.node.test.left)) {
|
|
238
|
-
var _data$
|
|
313
|
+
var _data$replaceValue2;
|
|
239
314
|
const consequentKey = (0, _migrateToVariants.getObjectKey)(data.node.consequent);
|
|
240
315
|
if (consequentKey.type === 'Identifier' && consequentKey.name !== 'theme') {
|
|
241
316
|
const varName = getCssVarName(data.node.consequent);
|
|
@@ -254,17 +329,8 @@ function sxV6(file, api, options) {
|
|
|
254
329
|
}
|
|
255
330
|
data.modeStyles[data.node.test.right.value].push(j.objectProperty(data.key, replaceUndefined(data.node.consequent)));
|
|
256
331
|
}
|
|
257
|
-
(_data$
|
|
258
|
-
|
|
259
|
-
var _data$replaceRoot;
|
|
260
|
-
(_data$replaceRoot = data.replaceRoot) == null || _data$replaceRoot.call(data, buildArrowFunctionAST([j.identifier('theme')], data.root));
|
|
261
|
-
} else if (data.root.type === 'ArrayExpression') {
|
|
262
|
-
data.root.elements.forEach((item, index) => {
|
|
263
|
-
if (item === data.node) {
|
|
264
|
-
data.root.elements[index] = buildArrowFunctionAST([j.identifier('theme')], data.root);
|
|
265
|
-
}
|
|
266
|
-
});
|
|
267
|
-
}
|
|
332
|
+
(_data$replaceValue2 = data.replaceValue) == null || _data$replaceValue2.call(data, replaceUndefined(data.node.alternate));
|
|
333
|
+
rootThemeCallback(data);
|
|
268
334
|
} else {
|
|
269
335
|
var _data$buildStyle, _data$buildStyle2;
|
|
270
336
|
wrapSxInArray(j.conditionalExpression(data.node.test, (_data$buildStyle = data.buildStyle) == null ? void 0 : _data$buildStyle.call(data, replaceUndefined(data.node.consequent)), (_data$buildStyle2 = data.buildStyle) == null ? void 0 : _data$buildStyle2.call(data, replaceUndefined(data.node.alternate))));
|
|
@@ -279,7 +345,7 @@ function sxV6(file, api, options) {
|
|
|
279
345
|
}
|
|
280
346
|
}
|
|
281
347
|
if (data.node.type === 'TemplateLiteral') {
|
|
282
|
-
var _data$parentNode2;
|
|
348
|
+
var _data$parentNode2, _data$node$expression;
|
|
283
349
|
if (((_data$parentNode2 = data.parentNode) == null ? void 0 : _data$parentNode2.type) === 'ObjectExpression') {
|
|
284
350
|
const modeStyles = {};
|
|
285
351
|
data.node.expressions.forEach((expression, index) => {
|
|
@@ -318,11 +384,17 @@ function sxV6(file, api, options) {
|
|
|
318
384
|
data.modeStyles[mode].push(j.objectProperty(data.key, clonedNode));
|
|
319
385
|
});
|
|
320
386
|
if (data.key) {
|
|
321
|
-
var _data$
|
|
322
|
-
(_data$
|
|
387
|
+
var _data$replaceValue3;
|
|
388
|
+
(_data$replaceValue3 = data.replaceValue) == null || _data$replaceValue3.call(data, data.node);
|
|
323
389
|
}
|
|
324
390
|
}
|
|
325
391
|
}
|
|
392
|
+
if ((_data$node$expression = data.node.expressions) != null && _data$node$expression.some(expression => {
|
|
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';
|
|
395
|
+
})) {
|
|
396
|
+
rootThemeCallback(data);
|
|
397
|
+
}
|
|
326
398
|
}
|
|
327
399
|
}
|
|
328
400
|
});
|
|
@@ -344,7 +416,7 @@ function sxV6(file, api, options) {
|
|
|
344
416
|
}
|
|
345
417
|
lines.push(line);
|
|
346
418
|
}
|
|
347
|
-
if (line.includes('sx=')) {
|
|
419
|
+
if (line.includes('sx=') && !line.match(/sx=\{\{[^}]+\}\}/)) {
|
|
348
420
|
isInStyled = true;
|
|
349
421
|
spaceMatch = line.match(/^\s+/);
|
|
350
422
|
}
|
|
@@ -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
|
+
}));
|
|
@@ -38,4 +38,18 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
38
38
|
backgroundPosition: 'center',
|
|
39
39
|
backgroundImage: `url(${post.image})`
|
|
40
40
|
}
|
|
41
|
+
});
|
|
42
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(Chip, {
|
|
43
|
+
size: "sm",
|
|
44
|
+
variant: "outlined",
|
|
45
|
+
color: colors[data.role],
|
|
46
|
+
sx: {
|
|
47
|
+
ml: 'auto',
|
|
48
|
+
borderRadius: '2px',
|
|
49
|
+
minHeight: '20px',
|
|
50
|
+
paddingInline: '4px',
|
|
51
|
+
fontSize: 'xs',
|
|
52
|
+
bgcolor: `${colors[data.role]}.softBg`
|
|
53
|
+
},
|
|
54
|
+
children: data.role
|
|
41
55
|
});
|