@mui/codemod 6.0.0-alpha.8 → 6.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +609 -180
- package/codemod.js +0 -2
- package/node/deprecations/all/deprecations-all.js +34 -22
- 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/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/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/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/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/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/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/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/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/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/util/migrateToVariants.js +244 -138
- 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/index.js +13 -0
- package/node/v6.0.0/sx-prop/sx-v6.js +405 -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 +55 -0
- package/node/v6.0.0/sx-prop/test-cases/sx-css-vars.expected.js +88 -0
- package/node/v6.0.0/sx-prop/test-cases/sx-dynamic.actual.js +107 -0
- package/node/v6.0.0/sx-prop/test-cases/sx-dynamic.expected.js +120 -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/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/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/theme-v6.js +2 -2
- package/package.json +7 -7
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = gridV2Props;
|
|
7
|
+
const possibleDefaultImports = ['@mui/material/Unstable_Grid2', '@mui/system/Unstable_Grid', '@mui/joy/Grid'];
|
|
8
|
+
const possibleNamedImports = {
|
|
9
|
+
'@mui/material': 'Unstable_Grid2',
|
|
10
|
+
'@mui/system': 'Unstable_Grid',
|
|
11
|
+
'@mui/joy': 'Grid'
|
|
12
|
+
};
|
|
13
|
+
const defaultBreakpoints = ['xs', 'sm', 'md', 'lg', 'xl'];
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @param {import('jscodeshift').FileInfo} file
|
|
17
|
+
* @param {import('jscodeshift').API} api
|
|
18
|
+
*/
|
|
19
|
+
function gridV2Props(file, api, options) {
|
|
20
|
+
var _file$path, _file$path2, _options$muiBreakpoin;
|
|
21
|
+
if ((_file$path = file.path) != null && _file$path.endsWith('.json') || (_file$path2 = file.path) != null && _file$path2.endsWith('.d.ts')) {
|
|
22
|
+
return file.source;
|
|
23
|
+
}
|
|
24
|
+
const j = api.jscodeshift;
|
|
25
|
+
const root = j(file.source);
|
|
26
|
+
const breakpoints = ((_options$muiBreakpoin = options.muiBreakpoints) == null ? void 0 : _options$muiBreakpoin.split(',')) || defaultBreakpoints;
|
|
27
|
+
const printOptions = options.printOptions;
|
|
28
|
+
const gridLocalNames = [];
|
|
29
|
+
root.find(j.ImportDeclaration, decl => possibleDefaultImports.includes(decl.source.value)).forEach(decl => {
|
|
30
|
+
decl.node.specifiers.forEach(spec => {
|
|
31
|
+
if (spec.type === 'ImportDefaultSpecifier') {
|
|
32
|
+
gridLocalNames.push(spec.local.name);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
root.find(j.ImportDeclaration, decl => Object.keys(possibleNamedImports).includes(decl.source.value)).forEach(decl => {
|
|
37
|
+
decl.node.specifiers.forEach(spec => {
|
|
38
|
+
if (spec.type === 'ImportSpecifier') {
|
|
39
|
+
if (possibleNamedImports[decl.node.source.value] === spec.imported.name) {
|
|
40
|
+
gridLocalNames.push(spec.local.name);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
root.find(j.JSXElement, {
|
|
46
|
+
openingElement: {
|
|
47
|
+
name: {
|
|
48
|
+
name: name => gridLocalNames.includes(name)
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}).forEach(el => {
|
|
52
|
+
const size = j.objectExpression([]);
|
|
53
|
+
const spreadProps = [];
|
|
54
|
+
const attributesToPrune = [];
|
|
55
|
+
el.node.openingElement.attributes.forEach(attr => {
|
|
56
|
+
if (attr.type === 'JSXSpreadAttribute') {
|
|
57
|
+
spreadProps.push(attr);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
const breakpointNodes = j(el).find(j.JSXAttribute).filter(path => path.parent.parent.node === el.node && breakpoints.includes(path.node.name.name));
|
|
61
|
+
breakpointNodes.nodes().forEach(node => {
|
|
62
|
+
const breakpoint = node.name.name;
|
|
63
|
+
const nodeValue = node.value;
|
|
64
|
+
let value;
|
|
65
|
+
if (nodeValue === null) {
|
|
66
|
+
value = j.stringLiteral('grow');
|
|
67
|
+
} else if (nodeValue.type === 'JSXExpressionContainer') {
|
|
68
|
+
if (nodeValue.expression.value === true) {
|
|
69
|
+
value = j.stringLiteral('grow');
|
|
70
|
+
} else {
|
|
71
|
+
value = nodeValue.expression;
|
|
72
|
+
}
|
|
73
|
+
} else {
|
|
74
|
+
value = nodeValue;
|
|
75
|
+
}
|
|
76
|
+
size.properties.push(j.property('init', j.identifier(breakpoint), value));
|
|
77
|
+
});
|
|
78
|
+
spreadProps.forEach(spreadProp => {
|
|
79
|
+
const spreadPropArgument = spreadProp.argument;
|
|
80
|
+
if (spreadPropArgument.type === 'ObjectExpression') {
|
|
81
|
+
const propertiesToPrune = [];
|
|
82
|
+
spreadPropArgument.properties.forEach(property => {
|
|
83
|
+
if (breakpoints.includes(property.key.name)) {
|
|
84
|
+
size.properties.push(j.property('init', property.key, property.value));
|
|
85
|
+
propertiesToPrune.push(property.key.name);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
spreadPropArgument.properties = spreadPropArgument.properties.filter(prop => !propertiesToPrune.includes(prop.key.name));
|
|
89
|
+
if (spreadPropArgument.properties.length === 0) {
|
|
90
|
+
attributesToPrune.push(spreadProp);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
if (size.properties.length) {
|
|
95
|
+
let sizePropValue = size;
|
|
96
|
+
if (size.properties.length === 1 && size.properties[0].key.name === 'xs') {
|
|
97
|
+
sizePropValue = size.properties[0].value;
|
|
98
|
+
}
|
|
99
|
+
if (sizePropValue.type !== 'StringLiteral') {
|
|
100
|
+
sizePropValue = j.jsxExpressionContainer(sizePropValue);
|
|
101
|
+
}
|
|
102
|
+
el.node.openingElement.attributes.push(j.jsxAttribute(j.jsxIdentifier('size'), sizePropValue));
|
|
103
|
+
}
|
|
104
|
+
el.node.openingElement.attributes = el.node.openingElement.attributes.filter(attr => {
|
|
105
|
+
var _attr$name;
|
|
106
|
+
return !breakpoints.includes(attr == null || (_attr$name = attr.name) == null ? void 0 : _attr$name.name);
|
|
107
|
+
});
|
|
108
|
+
const offset = j.objectExpression([]);
|
|
109
|
+
const offsetNodes = j(el).find(j.JSXAttribute).filter(path => path.parent.parent.node === el.node && path.node.name.name.endsWith('Offset') && breakpoints.includes(path.node.name.name.replace('Offset', '')));
|
|
110
|
+
offsetNodes.nodes().forEach(node => {
|
|
111
|
+
const breakpoint = node.name.name.replace('Offset', '');
|
|
112
|
+
const value = node.value.type === 'JSXExpressionContainer' ? node.value.expression : node.value;
|
|
113
|
+
offset.properties.push(j.property('init', j.identifier(breakpoint), value));
|
|
114
|
+
});
|
|
115
|
+
spreadProps.forEach(spreadProp => {
|
|
116
|
+
const spreadPropArgument = spreadProp.argument;
|
|
117
|
+
if (spreadPropArgument.type === 'ObjectExpression') {
|
|
118
|
+
const propertiesToPrune = [];
|
|
119
|
+
spreadPropArgument.properties.forEach(property => {
|
|
120
|
+
const breakpoint = property.key.name.replace('Offset', '');
|
|
121
|
+
if (property.key.name.endsWith('Offset') && breakpoints.includes(breakpoint)) {
|
|
122
|
+
offset.properties.push(j.property('init', j.identifier(breakpoint), property.value));
|
|
123
|
+
propertiesToPrune.push(property.key.name);
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
spreadPropArgument.properties = spreadPropArgument.properties.filter(prop => !propertiesToPrune.includes(prop.key.name));
|
|
127
|
+
if (spreadPropArgument.properties.length === 0) {
|
|
128
|
+
attributesToPrune.push(spreadProp);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
if (offset.properties.length) {
|
|
133
|
+
let offsetPropValue = offset;
|
|
134
|
+
if (offset.properties.length === 1 && offset.properties[0].key.name === 'xs') {
|
|
135
|
+
offsetPropValue = offset.properties[0].value;
|
|
136
|
+
}
|
|
137
|
+
if (offsetPropValue.type !== 'StringLiteral') {
|
|
138
|
+
offsetPropValue = j.jsxExpressionContainer(offsetPropValue);
|
|
139
|
+
}
|
|
140
|
+
el.node.openingElement.attributes.push(j.jsxAttribute(j.jsxIdentifier('offset'), offsetPropValue));
|
|
141
|
+
}
|
|
142
|
+
el.node.openingElement.attributes = el.node.openingElement.attributes.filter(attr => {
|
|
143
|
+
var _attr$name2;
|
|
144
|
+
return !breakpoints.includes(attr == null || (_attr$name2 = attr.name) == null ? void 0 : _attr$name2.name.replace('Offset', ''));
|
|
145
|
+
});
|
|
146
|
+
el.node.openingElement.attributes = el.node.openingElement.attributes.filter(attr => !attributesToPrune.includes(attr));
|
|
147
|
+
});
|
|
148
|
+
return root.toSource(printOptions);
|
|
149
|
+
}
|
|
@@ -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 _gridV2Props.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
var _gridV2Props = _interopRequireDefault(require("./grid-v2-props"));
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _Unstable_Grid = _interopRequireDefault(require("@mui/material/Unstable_Grid2"));
|
|
5
|
+
var _Unstable_Grid2 = _interopRequireDefault(require("@mui/system/Unstable_Grid"));
|
|
6
|
+
var _Grid = _interopRequireDefault(require("@mui/joy/Grid"));
|
|
7
|
+
var _material = require("@mui/material");
|
|
8
|
+
var _system = require("@mui/system");
|
|
9
|
+
var _joy = require("@mui/joy");
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
// Transforms on all the possible imports
|
|
12
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Unstable_Grid.default, {
|
|
13
|
+
xs: 2
|
|
14
|
+
});
|
|
15
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Unstable_Grid2.default, {
|
|
16
|
+
xs: 2
|
|
17
|
+
});
|
|
18
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
19
|
+
xs: 2
|
|
20
|
+
});
|
|
21
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Unstable_Grid2, {
|
|
22
|
+
xs: 2
|
|
23
|
+
});
|
|
24
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_system.Unstable_Grid, {
|
|
25
|
+
xs: 2
|
|
26
|
+
});
|
|
27
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_joy.Grid, {
|
|
28
|
+
xs: 2
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// Transforms responsive sizes
|
|
32
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Unstable_Grid.default, {
|
|
33
|
+
xs: 2,
|
|
34
|
+
sm: 4,
|
|
35
|
+
md: 6,
|
|
36
|
+
lg: 8,
|
|
37
|
+
xl: 10
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// Transforms all the possible size values
|
|
41
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Unstable_Grid.default, {
|
|
42
|
+
xs: true,
|
|
43
|
+
sm: "auto",
|
|
44
|
+
md: 2,
|
|
45
|
+
lg: true,
|
|
46
|
+
xl: false
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// Doesn't add jsx object expression for single string values
|
|
50
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Unstable_Grid.default, {
|
|
51
|
+
xs: "auto"
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// Transforms offset
|
|
55
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Unstable_Grid.default, {
|
|
56
|
+
xsOffset: 2
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
// Transforms responsive offset
|
|
60
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Unstable_Grid.default, {
|
|
61
|
+
xsOffset: 2,
|
|
62
|
+
smOffset: 4,
|
|
63
|
+
mdOffset: 6,
|
|
64
|
+
lgOffset: 8,
|
|
65
|
+
xlOffset: 10
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
// Transforms all the possible offset values
|
|
69
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Unstable_Grid.default, {
|
|
70
|
+
xsOffset: 2,
|
|
71
|
+
smOffset: "auto"
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
// Transforms spread props
|
|
75
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Unstable_Grid.default, {
|
|
76
|
+
xs: 2,
|
|
77
|
+
sm: 4,
|
|
78
|
+
xsOffset: 0,
|
|
79
|
+
smOffset: 2
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
// Doesn't transform Grid v1
|
|
83
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Grid, {
|
|
84
|
+
xs: 2
|
|
85
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _Unstable_Grid = _interopRequireDefault(require("@mui/material/Unstable_Grid2"));
|
|
5
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
6
|
+
// Transforms custom breakpoints
|
|
7
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Unstable_Grid.default, {
|
|
8
|
+
customXs: 2,
|
|
9
|
+
customSm: 4,
|
|
10
|
+
customMd: 6
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
// Transforms custom breakpoints offset
|
|
14
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Unstable_Grid.default, {
|
|
15
|
+
customXsOffset: 2,
|
|
16
|
+
customSmOffset: 4,
|
|
17
|
+
customMdOffset: 6
|
|
18
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _Unstable_Grid = _interopRequireDefault(require("@mui/material/Unstable_Grid2"));
|
|
5
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
6
|
+
// Transforms custom breakpoints
|
|
7
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Unstable_Grid.default, {
|
|
8
|
+
size: {
|
|
9
|
+
customXs: 2,
|
|
10
|
+
customSm: 4,
|
|
11
|
+
customMd: 6
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
// Transforms custom breakpoints offset
|
|
16
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Unstable_Grid.default, {
|
|
17
|
+
offset: {
|
|
18
|
+
customXs: 2,
|
|
19
|
+
customSm: 4,
|
|
20
|
+
customMd: 6
|
|
21
|
+
}
|
|
22
|
+
});
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _Unstable_Grid = _interopRequireDefault(require("@mui/material/Unstable_Grid2"));
|
|
5
|
+
var _Unstable_Grid2 = _interopRequireDefault(require("@mui/system/Unstable_Grid"));
|
|
6
|
+
var _Grid = _interopRequireDefault(require("@mui/joy/Grid"));
|
|
7
|
+
var _material = require("@mui/material");
|
|
8
|
+
var _system = require("@mui/system");
|
|
9
|
+
var _joy = require("@mui/joy");
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
// Transforms on all the possible imports
|
|
12
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Unstable_Grid.default, {
|
|
13
|
+
size: 2
|
|
14
|
+
});
|
|
15
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Unstable_Grid2.default, {
|
|
16
|
+
size: 2
|
|
17
|
+
});
|
|
18
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
19
|
+
size: 2
|
|
20
|
+
});
|
|
21
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Unstable_Grid2, {
|
|
22
|
+
size: 2
|
|
23
|
+
});
|
|
24
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_system.Unstable_Grid, {
|
|
25
|
+
size: 2
|
|
26
|
+
});
|
|
27
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_joy.Grid, {
|
|
28
|
+
size: 2
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// Transforms responsive sizes
|
|
32
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Unstable_Grid.default, {
|
|
33
|
+
size: {
|
|
34
|
+
xs: 2,
|
|
35
|
+
sm: 4,
|
|
36
|
+
md: 6,
|
|
37
|
+
lg: 8,
|
|
38
|
+
xl: 10
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// Transforms all the possible size values
|
|
43
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Unstable_Grid.default, {
|
|
44
|
+
size: {
|
|
45
|
+
xs: "grow",
|
|
46
|
+
sm: "auto",
|
|
47
|
+
md: 2,
|
|
48
|
+
lg: "grow",
|
|
49
|
+
xl: false
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
// Doesn't add jsx object expression for single string values
|
|
54
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Unstable_Grid.default, {
|
|
55
|
+
size: "auto"
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
// Transforms offset
|
|
59
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Unstable_Grid.default, {
|
|
60
|
+
offset: 2
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
// Transforms responsive offset
|
|
64
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Unstable_Grid.default, {
|
|
65
|
+
offset: {
|
|
66
|
+
xs: 2,
|
|
67
|
+
sm: 4,
|
|
68
|
+
md: 6,
|
|
69
|
+
lg: 8,
|
|
70
|
+
xl: 10
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
// Transforms all the possible offset values
|
|
75
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Unstable_Grid.default, {
|
|
76
|
+
offset: {
|
|
77
|
+
xs: 2,
|
|
78
|
+
sm: "auto"
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
// Transforms spread props
|
|
83
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_Unstable_Grid.default, {
|
|
84
|
+
size: {
|
|
85
|
+
xs: 2,
|
|
86
|
+
sm: 4
|
|
87
|
+
},
|
|
88
|
+
offset: {
|
|
89
|
+
xs: 0,
|
|
90
|
+
sm: 2
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
// Doesn't transform Grid v1
|
|
95
|
+
/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Grid, {
|
|
96
|
+
xs: 2
|
|
97
|
+
});
|
|
@@ -18,6 +18,7 @@ const LinearProgressBar1 = styled('span', {
|
|
|
18
18
|
variant: 'buffer'
|
|
19
19
|
},
|
|
20
20
|
style: {
|
|
21
|
+
backgroundColor: (theme.vars || theme).palette[ownerState.color].light,
|
|
21
22
|
'&:hover': {}
|
|
22
23
|
}
|
|
23
24
|
}, {
|
|
@@ -28,14 +29,6 @@ const LinearProgressBar1 = styled('span', {
|
|
|
28
29
|
style: {
|
|
29
30
|
backgroundColor: 'currentColor'
|
|
30
31
|
}
|
|
31
|
-
}, {
|
|
32
|
-
props: {
|
|
33
|
-
variant: 'buffer',
|
|
34
|
-
color: 'normal'
|
|
35
|
-
},
|
|
36
|
-
style: {
|
|
37
|
-
backgroundColor: (theme.vars || theme).palette[ownerState.color].light
|
|
38
|
-
}
|
|
39
32
|
}, {
|
|
40
33
|
props: ({
|
|
41
34
|
variant,
|
|
@@ -58,18 +51,18 @@ const LinearProgressBar1 = styled('span', {
|
|
|
58
51
|
}
|
|
59
52
|
}, {
|
|
60
53
|
props: ({
|
|
61
|
-
ownerState
|
|
62
|
-
|
|
63
|
-
}) => ownerState.variant !== 'buffer' && color === 'inherit',
|
|
54
|
+
ownerState
|
|
55
|
+
}) => ownerState.variant !== 'buffer',
|
|
64
56
|
style: {
|
|
65
|
-
backgroundColor:
|
|
57
|
+
backgroundColor: (theme.vars || theme).palette[ownerState.color].main
|
|
66
58
|
}
|
|
67
59
|
}, {
|
|
68
60
|
props: ({
|
|
69
|
-
ownerState
|
|
70
|
-
|
|
61
|
+
ownerState,
|
|
62
|
+
color
|
|
63
|
+
}) => ownerState.variant !== 'buffer' && color === 'inherit',
|
|
71
64
|
style: {
|
|
72
|
-
backgroundColor:
|
|
65
|
+
backgroundColor: 'currentColor'
|
|
73
66
|
}
|
|
74
67
|
}]
|
|
75
68
|
}));
|
|
@@ -84,6 +77,7 @@ const ExpandMore = styled(props => {
|
|
|
84
77
|
})(({
|
|
85
78
|
theme
|
|
86
79
|
}) => ({
|
|
80
|
+
transform: 'rotate(180deg)',
|
|
87
81
|
marginLeft: 'auto',
|
|
88
82
|
transition: theme.transitions.create('transform', {
|
|
89
83
|
duration: theme.transitions.duration.shortest
|
|
@@ -95,13 +89,6 @@ const ExpandMore = styled(props => {
|
|
|
95
89
|
style: {
|
|
96
90
|
transform: 'rotate(0deg)'
|
|
97
91
|
}
|
|
98
|
-
}, {
|
|
99
|
-
props: ({
|
|
100
|
-
expand
|
|
101
|
-
}) => !!expand,
|
|
102
|
-
style: {
|
|
103
|
-
transform: 'rotate(180deg)'
|
|
104
|
-
}
|
|
105
92
|
}]
|
|
106
93
|
}));
|
|
107
94
|
const Main = styled('main', {
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _styles = require("@mui/material/styles");
|
|
8
|
+
const DemoToolbarRoot = (0, _styles.styled)('div', {
|
|
9
|
+
shouldForwardProp: prop => prop !== 'demoOptions' && prop !== 'openDemoSource'
|
|
10
|
+
})(({
|
|
11
|
+
theme,
|
|
12
|
+
demoOptions,
|
|
13
|
+
openDemoSource
|
|
14
|
+
}) => [{
|
|
15
|
+
display: 'none',
|
|
16
|
+
[theme.breakpoints.up('sm')]: {
|
|
17
|
+
top: 0,
|
|
18
|
+
maxHeight: 50,
|
|
19
|
+
display: 'block',
|
|
20
|
+
marginTop: demoOptions.bg === 'inline' ? theme.spacing(1) : -1,
|
|
21
|
+
padding: theme.spacing(0.5, 1),
|
|
22
|
+
border: `1px solid ${(theme.vars || theme).palette.divider}`,
|
|
23
|
+
borderTopWidth: demoOptions.bg === 'inline' ? 1 : 0,
|
|
24
|
+
backgroundColor: (0, _styles.alpha)(theme.palette.grey[50], 0.2),
|
|
25
|
+
borderRadius: openDemoSource ? 0 : '0 0 12px 12px',
|
|
26
|
+
transition: theme.transitions.create('border-radius'),
|
|
27
|
+
...(theme.direction === 'rtl' && {
|
|
28
|
+
left: theme.spacing(1)
|
|
29
|
+
}),
|
|
30
|
+
...(theme.direction !== 'rtl' && {
|
|
31
|
+
right: theme.spacing(1)
|
|
32
|
+
})
|
|
33
|
+
}
|
|
34
|
+
}, theme.applyDarkStyles({
|
|
35
|
+
[theme.breakpoints.up('sm')]: {
|
|
36
|
+
backgroundColor: (0, _styles.alpha)(theme.palette.primaryDark[800], 0.2)
|
|
37
|
+
}
|
|
38
|
+
})]);
|
|
39
|
+
var _default = exports.default = DemoToolbarRoot;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _styles = require("@mui/material/styles");
|
|
8
|
+
const DemoToolbarRoot = (0, _styles.styled)('div', {
|
|
9
|
+
shouldForwardProp: prop => prop !== 'demoOptions' && prop !== 'openDemoSource'
|
|
10
|
+
})(({
|
|
11
|
+
theme
|
|
12
|
+
}) => [{
|
|
13
|
+
display: 'none',
|
|
14
|
+
[theme.breakpoints.up('sm')]: {
|
|
15
|
+
top: 0,
|
|
16
|
+
maxHeight: 50,
|
|
17
|
+
display: 'block',
|
|
18
|
+
marginTop: -1,
|
|
19
|
+
padding: theme.spacing(0.5, 1),
|
|
20
|
+
border: `1px solid ${(theme.vars || theme).palette.divider}`,
|
|
21
|
+
borderTopWidth: 0,
|
|
22
|
+
backgroundColor: (0, _styles.alpha)(theme.palette.grey[50], 0.2),
|
|
23
|
+
borderRadius: '0 0 12px 12px',
|
|
24
|
+
transition: theme.transitions.create('border-radius'),
|
|
25
|
+
...theme.applyStyles("rtl", {
|
|
26
|
+
left: theme.spacing(1)
|
|
27
|
+
}),
|
|
28
|
+
...theme.applyStyles("rtl", {
|
|
29
|
+
right: theme.spacing(1)
|
|
30
|
+
})
|
|
31
|
+
},
|
|
32
|
+
variants: [{
|
|
33
|
+
props: {
|
|
34
|
+
bg: 'inline'
|
|
35
|
+
},
|
|
36
|
+
style: {
|
|
37
|
+
[theme.breakpoints.up('sm')]: {
|
|
38
|
+
marginTop: theme.spacing(1)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}, {
|
|
42
|
+
props: {
|
|
43
|
+
bg: 'inline'
|
|
44
|
+
},
|
|
45
|
+
style: {
|
|
46
|
+
[theme.breakpoints.up('sm')]: {
|
|
47
|
+
borderTopWidth: 1
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}, {
|
|
51
|
+
props: ({
|
|
52
|
+
openDemoSource
|
|
53
|
+
}) => openDemoSource,
|
|
54
|
+
style: {
|
|
55
|
+
[theme.breakpoints.up('sm')]: {
|
|
56
|
+
borderRadius: 0
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}]
|
|
60
|
+
}, theme.applyDarkStyles({
|
|
61
|
+
[theme.breakpoints.up('sm')]: {
|
|
62
|
+
backgroundColor: (0, _styles.alpha)(theme.palette.primaryDark[800], 0.2)
|
|
63
|
+
}
|
|
64
|
+
})]);
|
|
65
|
+
var _default = exports.default = DemoToolbarRoot;
|
|
@@ -25,4 +25,34 @@ const ToolbarRoot = styled('div', {
|
|
|
25
25
|
disabled
|
|
26
26
|
}) => ownerState.variant !== 'regular' && !disabled && theme.mixins.toolbar4, ({
|
|
27
27
|
theme
|
|
28
|
-
}) => theme.vars && theme.mixins.toolbar5);
|
|
28
|
+
}) => theme.vars && theme.mixins.toolbar5);
|
|
29
|
+
const ToggleButton = styled('button')(({
|
|
30
|
+
theme,
|
|
31
|
+
'aria-pressed': pressed = 'false'
|
|
32
|
+
}) => ({
|
|
33
|
+
padding: '0.5rem 1rem',
|
|
34
|
+
borderRadius: theme.vars.radius.sm,
|
|
35
|
+
display: 'inline-flex',
|
|
36
|
+
justifyContent: 'center',
|
|
37
|
+
gap: '8px',
|
|
38
|
+
minHeight: 40,
|
|
39
|
+
fontFamily: theme.vars.fontFamily.body,
|
|
40
|
+
fontSize: theme.vars.fontSize.md,
|
|
41
|
+
fontWeight: theme.vars.fontWeight.md,
|
|
42
|
+
alignItems: 'center',
|
|
43
|
+
border: '1px solid',
|
|
44
|
+
borderColor: theme.vars.palette.neutral.outlinedBorder,
|
|
45
|
+
backgroundColor: theme.vars.palette.background.body,
|
|
46
|
+
boxShadow: theme.vars.shadow.md,
|
|
47
|
+
[theme.focus.selector]: theme.focus.default,
|
|
48
|
+
...theme.variants.plain.neutral,
|
|
49
|
+
...(pressed === 'false' && {
|
|
50
|
+
'&:hover': theme.variants.plainHover.neutral,
|
|
51
|
+
'&:active': theme.variants.plainActive.neutral
|
|
52
|
+
}),
|
|
53
|
+
...(pressed === 'true' && {
|
|
54
|
+
color: theme.vars.palette.danger.plainColor,
|
|
55
|
+
backgroundColor: theme.vars.palette.background.body,
|
|
56
|
+
boxShadow: theme.shadow.sm.replace(/,/g, ', inset')
|
|
57
|
+
})
|
|
58
|
+
}));
|
|
@@ -49,4 +49,42 @@ const ToolbarRoot = styled('div', {
|
|
|
49
49
|
}]
|
|
50
50
|
}), ({
|
|
51
51
|
theme
|
|
52
|
-
}) => theme.vars && theme.mixins.toolbar5);
|
|
52
|
+
}) => theme.vars && theme.mixins.toolbar5);
|
|
53
|
+
const ToggleButton = styled('button')(({
|
|
54
|
+
theme
|
|
55
|
+
}) => ({
|
|
56
|
+
padding: '0.5rem 1rem',
|
|
57
|
+
borderRadius: theme.vars.radius.sm,
|
|
58
|
+
display: 'inline-flex',
|
|
59
|
+
justifyContent: 'center',
|
|
60
|
+
gap: '8px',
|
|
61
|
+
minHeight: 40,
|
|
62
|
+
fontFamily: theme.vars.fontFamily.body,
|
|
63
|
+
fontSize: theme.vars.fontSize.md,
|
|
64
|
+
fontWeight: theme.vars.fontWeight.md,
|
|
65
|
+
alignItems: 'center',
|
|
66
|
+
border: '1px solid',
|
|
67
|
+
borderColor: theme.vars.palette.neutral.outlinedBorder,
|
|
68
|
+
backgroundColor: theme.vars.palette.background.body,
|
|
69
|
+
boxShadow: theme.vars.shadow.md,
|
|
70
|
+
[theme.focus.selector]: theme.focus.default,
|
|
71
|
+
...theme.variants.plain.neutral,
|
|
72
|
+
variants: [{
|
|
73
|
+
props: {
|
|
74
|
+
"aria-pressed": 'false'
|
|
75
|
+
},
|
|
76
|
+
style: {
|
|
77
|
+
'&:hover': theme.variants.plainHover.neutral,
|
|
78
|
+
'&:active': theme.variants.plainActive.neutral
|
|
79
|
+
}
|
|
80
|
+
}, {
|
|
81
|
+
props: {
|
|
82
|
+
"aria-pressed": 'true'
|
|
83
|
+
},
|
|
84
|
+
style: {
|
|
85
|
+
color: theme.vars.palette.danger.plainColor,
|
|
86
|
+
backgroundColor: theme.vars.palette.background.body,
|
|
87
|
+
boxShadow: theme.shadow.sm.replace(/,/g, ', inset')
|
|
88
|
+
}
|
|
89
|
+
}]
|
|
90
|
+
}));
|
|
@@ -25,6 +25,13 @@ const Component = styled('div')(({
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
+
}, {
|
|
29
|
+
props: {
|
|
30
|
+
edge: 'start'
|
|
31
|
+
},
|
|
32
|
+
style: {
|
|
33
|
+
marginLeft: -12
|
|
34
|
+
}
|
|
28
35
|
}, {
|
|
29
36
|
props: {
|
|
30
37
|
edge: 'start',
|
|
@@ -34,12 +41,11 @@ const Component = styled('div')(({
|
|
|
34
41
|
marginLeft: -3
|
|
35
42
|
}
|
|
36
43
|
}, {
|
|
37
|
-
props:
|
|
38
|
-
edge
|
|
39
|
-
|
|
40
|
-
}) => edge === 'start' && ownerState.size !== 'small',
|
|
44
|
+
props: {
|
|
45
|
+
edge: 'end'
|
|
46
|
+
},
|
|
41
47
|
style: {
|
|
42
|
-
|
|
48
|
+
marginRight: -12
|
|
43
49
|
}
|
|
44
50
|
}, {
|
|
45
51
|
props: {
|
|
@@ -49,14 +55,6 @@ const Component = styled('div')(({
|
|
|
49
55
|
style: {
|
|
50
56
|
marginRight: -3
|
|
51
57
|
}
|
|
52
|
-
}, {
|
|
53
|
-
props: ({
|
|
54
|
-
edge,
|
|
55
|
-
ownerState
|
|
56
|
-
}) => edge === 'end' && ownerState.size !== 'small',
|
|
57
|
-
style: {
|
|
58
|
-
marginRight: -12
|
|
59
|
-
}
|
|
60
58
|
}, {
|
|
61
59
|
props: ({
|
|
62
60
|
ownerState
|