@mui/codemod 6.0.0-alpha.11 → 6.0.0-alpha.12

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.
@@ -26,9 +26,11 @@ var _modalProps = _interopRequireDefault(require("../modal-props"));
26
26
  var _outlinedInputProps = _interopRequireDefault(require("../outlined-input-props"));
27
27
  var _paginationItemClasses = _interopRequireDefault(require("../pagination-item-classes"));
28
28
  var _speedDialProps = _interopRequireDefault(require("../speed-dial-props"));
29
+ var _tableSortLabelClasses = _interopRequireDefault(require("../table-sort-label-classes"));
29
30
  var _stepConnectorClasses = _interopRequireDefault(require("../step-connector-classes"));
30
31
  var _stepLabelProps = _interopRequireDefault(require("../step-label-props"));
31
32
  var _textFieldProps = _interopRequireDefault(require("../text-field-props"));
33
+ var _tabClasses = _interopRequireDefault(require("../tab-classes"));
32
34
  var _toggleButtonGroupClasses = _interopRequireDefault(require("../toggle-button-group-classes"));
33
35
  /**
34
36
  * @param {import('jscodeshift').FileInfo} file
@@ -58,7 +60,9 @@ function deprecationsAll(file, api, options) {
58
60
  file.source = (0, _speedDialProps.default)(file, api, options);
59
61
  file.source = (0, _stepConnectorClasses.default)(file, api, options);
60
62
  file.source = (0, _stepLabelProps.default)(file, api, options);
63
+ file.source = (0, _tableSortLabelClasses.default)(file, api, options);
61
64
  file.source = (0, _textFieldProps.default)(file, api, options);
65
+ file.source = (0, _tabClasses.default)(file, api, options);
62
66
  file.source = (0, _toggleButtonGroupClasses.default)(file, api, options);
63
67
  return file.source;
64
68
  }
@@ -27,6 +27,12 @@ const {
27
27
  const {
28
28
  plugin: circularProgressClassesPlugin
29
29
  } = require('../circular-progress-classes/postcss-plugin');
30
+ const {
31
+ plugin: tabClassesPlugin
32
+ } = require('../tab-classes/postcss-plugin');
33
+ const {
34
+ plugin: tableSortLabelClassesPlugin
35
+ } = require('../table-sort-label-classes/postcss-plugin');
30
36
  module.exports = {
31
- plugins: [accordionSummaryClassesPlugin, alertClassesPlugin, buttonClassesPlugin, buttonGroupClassesPlugin, chipClassesPlugin, circularProgressClassesPlugin, paginationItemClassesPlugin, stepConnectorClassesPlugin, toggleButtonGroupClassesPlugin]
37
+ plugins: [accordionSummaryClassesPlugin, alertClassesPlugin, buttonClassesPlugin, buttonGroupClassesPlugin, chipClassesPlugin, circularProgressClassesPlugin, paginationItemClassesPlugin, stepConnectorClassesPlugin, toggleButtonGroupClassesPlugin, tabClassesPlugin, tableSortLabelClassesPlugin]
32
38
  };
@@ -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 _tabClasses.default;
11
+ }
12
+ });
13
+ var _tabClasses = _interopRequireDefault(require("./tab-classes"));
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ const classes = [{
4
+ deprecatedClass: ' .MuiTab-iconWrapper',
5
+ replacementSelector: ' .MuiTab-icon'
6
+ }];
7
+ const plugin = () => {
8
+ return {
9
+ postcssPlugin: `Replace deprecated Tab classes with new classes`,
10
+ Rule(rule) {
11
+ const {
12
+ selector
13
+ } = rule;
14
+ classes.forEach(({
15
+ deprecatedClass,
16
+ replacementSelector
17
+ }) => {
18
+ const selectorRegex = new RegExp(`${deprecatedClass}$`);
19
+ if (selector.match(selectorRegex)) {
20
+ rule.selector = selector.replace(selectorRegex, replacementSelector);
21
+ }
22
+ });
23
+ }
24
+ };
25
+ };
26
+ plugin.postcss = true;
27
+ module.exports = {
28
+ plugin,
29
+ classes
30
+ };
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+
3
+ const {
4
+ plugin
5
+ } = require('./postcss-plugin');
6
+ module.exports = {
7
+ plugins: [plugin]
8
+ };
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = transformer;
7
+ var _postcssPlugin = require("./postcss-plugin");
8
+ /**
9
+ * @param {import('jscodeshift').FileInfo} file
10
+ * @param {import('jscodeshift').API} api
11
+ */
12
+ function transformer(file, api, options) {
13
+ const j = api.jscodeshift;
14
+ const root = j(file.source);
15
+ const printOptions = options.printOptions;
16
+ _postcssPlugin.classes.forEach(({
17
+ deprecatedClass,
18
+ replacementSelector
19
+ }) => {
20
+ const replacementSelectorPrefix = '&';
21
+ root.find(j.ImportDeclaration).filter(path => path.node.source.value.match(/^@mui\/material\/Tab$/)).forEach(path => {
22
+ path.node.specifiers.forEach(specifier => {
23
+ if (specifier.type === 'ImportSpecifier' && specifier.imported.name === 'tabClasses') {
24
+ const deprecatedAtomicClass = deprecatedClass.replace(`${deprecatedClass.split('-')[0]}-`, '');
25
+ root.find(j.MemberExpression, {
26
+ object: {
27
+ name: specifier.local.name
28
+ },
29
+ property: {
30
+ name: deprecatedAtomicClass
31
+ }
32
+ }).forEach(memberExpression => {
33
+ const parent = memberExpression.parentPath.parentPath.value;
34
+ if (parent.type === j.TemplateLiteral.name) {
35
+ const memberExpressionIndex = parent.expressions.findIndex(expression => expression === memberExpression.value);
36
+ const precedingTemplateElement = parent.quasis[memberExpressionIndex];
37
+ const atomicClasses = ['icon'];
38
+ if (precedingTemplateElement.value.raw.endsWith(deprecatedClass.startsWith(' ') ? `${replacementSelectorPrefix} .` : `${replacementSelectorPrefix}.`)) {
39
+ const atomicClassesArgs = [memberExpressionIndex, 1, ...atomicClasses.map(atomicClass => j.memberExpression(memberExpression.value.object, j.identifier(atomicClass)))];
40
+ parent.expressions.splice(...atomicClassesArgs);
41
+ }
42
+ }
43
+ });
44
+ }
45
+ });
46
+ });
47
+ const selectorRegex = new RegExp(`${replacementSelectorPrefix}${deprecatedClass}$`);
48
+ root.find(j.Literal, literal => typeof literal.value === 'string' && literal.value.match(selectorRegex)).forEach(path => {
49
+ path.replace(j.literal(path.value.value.replace(selectorRegex, `${replacementSelectorPrefix}${replacementSelector}`)));
50
+ });
51
+ });
52
+ return root.toSource(printOptions);
53
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ var _Tab = require("@mui/material/Tab");
4
+ '& .MuiTab-iconWrapper';
5
+ `& .${_Tab.tabClasses.iconWrapper}`;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ var _Tab = require("@mui/material/Tab");
4
+ "& .MuiTab-icon";
5
+ `& .${_Tab.tabClasses.icon}`;
@@ -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 _tableSortLabelClasses.default;
11
+ }
12
+ });
13
+ var _tableSortLabelClasses = _interopRequireDefault(require("./table-sort-label-classes"));
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ const classes = [{
4
+ deprecatedClass: ' .MuiTableSortLabel-iconDirectionDesc',
5
+ replacementSelector: '.MuiTableSortLabel-directionDesc > .MuiTableSortLabel-icon'
6
+ }, {
7
+ deprecatedClass: ' .MuiTableSortLabel-iconDirectionAsc',
8
+ replacementSelector: '.MuiTableSortLabel-directionAsc > .MuiTableSortLabel-icon'
9
+ }];
10
+ const plugin = () => {
11
+ return {
12
+ postcssPlugin: `Replace deprecated TableSortLabel classes with new classes`,
13
+ Rule(rule) {
14
+ const {
15
+ selector
16
+ } = rule;
17
+ classes.forEach(({
18
+ deprecatedClass,
19
+ replacementSelector
20
+ }) => {
21
+ const selectorRegex = new RegExp(`${deprecatedClass}$`);
22
+ if (selector.match(selectorRegex)) {
23
+ rule.selector = selector.replace(selectorRegex, replacementSelector);
24
+ }
25
+ });
26
+ }
27
+ };
28
+ };
29
+ plugin.postcss = true;
30
+ module.exports = {
31
+ plugin,
32
+ classes
33
+ };
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+
3
+ const {
4
+ plugin
5
+ } = require('./postcss-plugin');
6
+ module.exports = {
7
+ plugins: [plugin]
8
+ };
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = transformer;
7
+ var _postcssPlugin = require("./postcss-plugin");
8
+ /**
9
+ * @param {import('jscodeshift').FileInfo} file
10
+ * @param {import('jscodeshift').API} api
11
+ */
12
+ function transformer(file, api, options) {
13
+ const j = api.jscodeshift;
14
+ const root = j(file.source);
15
+ const printOptions = options.printOptions;
16
+ _postcssPlugin.classes.forEach(({
17
+ deprecatedClass,
18
+ replacementSelector
19
+ }) => {
20
+ const replacementSelectorPrefix = '&';
21
+ root.find(j.ImportDeclaration).filter(path => path.node.source.value.match(/^@mui\/material\/TableSortLabel$/)).forEach(path => {
22
+ path.node.specifiers.forEach(specifier => {
23
+ if (specifier.type === 'ImportSpecifier' && specifier.imported.name === 'tableSortLabelClasses') {
24
+ const deprecatedAtomicClass = deprecatedClass.replace(`${deprecatedClass.split('-')[0]}-`, '');
25
+ root.find(j.MemberExpression, {
26
+ object: {
27
+ name: specifier.local.name
28
+ },
29
+ property: {
30
+ name: deprecatedAtomicClass
31
+ }
32
+ }).forEach(memberExpression => {
33
+ const parent = memberExpression.parentPath.parentPath.value;
34
+ if (parent.type === j.TemplateLiteral.name) {
35
+ const memberExpressionIndex = parent.expressions.findIndex(expression => expression === memberExpression.value);
36
+ const precedingTemplateElement = parent.quasis[memberExpressionIndex];
37
+ const atomicClasses = replacementSelector.replaceAll('MuiTableSortLabel-', '').replaceAll(replacementSelectorPrefix, '').replaceAll(' > ', '').split('.').filter(Boolean);
38
+ if (precedingTemplateElement.value.raw.endsWith(deprecatedClass.startsWith(' ') ? `${replacementSelectorPrefix} .` : `${replacementSelectorPrefix}.`)) {
39
+ const atomicClassesArgs = [memberExpressionIndex, 1, ...atomicClasses.map(atomicClass => j.memberExpression(memberExpression.value.object, j.identifier(atomicClass)))];
40
+ parent.expressions.splice(...atomicClassesArgs);
41
+ if (replacementSelector.includes(' > ')) {
42
+ const quasisArgs = [memberExpressionIndex, 1, j.templateElement({
43
+ raw: precedingTemplateElement.value.raw.replace(' ', ''),
44
+ cooked: precedingTemplateElement.value.cooked.replace(' ', '')
45
+ }, false), j.templateElement({
46
+ raw: ' > .',
47
+ cooked: ' > .'
48
+ }, false)];
49
+ if (atomicClasses.length === 3) {
50
+ quasisArgs.splice(3, 0, j.templateElement({
51
+ raw: '.',
52
+ cooked: '.'
53
+ }, false));
54
+ }
55
+ parent.quasis.splice(...quasisArgs);
56
+ } else {
57
+ parent.quasis.splice(memberExpressionIndex, 1, j.templateElement({
58
+ raw: precedingTemplateElement.value.raw,
59
+ cooked: precedingTemplateElement.value.cooked
60
+ }, false), j.templateElement({
61
+ raw: '.',
62
+ cooked: '.'
63
+ }, false));
64
+ }
65
+ }
66
+ }
67
+ });
68
+ }
69
+ });
70
+ });
71
+ const selectorRegex = new RegExp(`${replacementSelectorPrefix}${deprecatedClass}$`);
72
+ root.find(j.Literal, literal => typeof literal.value === 'string' && literal.value.match(selectorRegex)).forEach(path => {
73
+ path.replace(j.literal(path.value.value.replace(selectorRegex, `${replacementSelectorPrefix}${replacementSelector}`)));
74
+ });
75
+ });
76
+ return root.toSource(printOptions);
77
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+
3
+ var _TableSortLabel = require("@mui/material/TableSortLabel");
4
+ '& .MuiTableSortLabel-iconDirectionDesc';
5
+ '& .MuiTableSortLabel-iconDirectionAsc';
6
+ `& .${_TableSortLabel.tableSortLabelClasses.iconDirectionDesc}`;
7
+ `& .${_TableSortLabel.tableSortLabelClasses.iconDirectionAsc}`;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+
3
+ var _TableSortLabel = require("@mui/material/TableSortLabel");
4
+ "&.MuiTableSortLabel-directionDesc > .MuiTableSortLabel-icon";
5
+ "&.MuiTableSortLabel-directionAsc > .MuiTableSortLabel-icon";
6
+ `&.${_TableSortLabel.tableSortLabelClasses.directionDesc} > .${_TableSortLabel.tableSortLabelClasses.icon}`;
7
+ `&.${_TableSortLabel.tableSortLabelClasses.directionAsc} > .${_TableSortLabel.tableSortLabelClasses.icon}`;
@@ -331,25 +331,32 @@ function migrateToVariants(j, styles) {
331
331
  } else if (style.body.type === 'ConditionalExpression') {
332
332
  // skip ConditionalExpression
333
333
  } else {
334
- let objectExpression = style.body;
335
- let counter = 0;
336
- while (objectExpression.type !== 'ObjectExpression' && counter < MAX_DEPTH) {
337
- counter += 1;
338
- if (objectExpression.type === 'BlockStatement') {
339
- objectExpression = objectExpression.body.find(item => item.type === 'ReturnStatement').argument;
340
- }
334
+ const expressions = [];
335
+ if (style.body.type === 'ArrayExpression') {
336
+ expressions.push(...style.body.elements);
337
+ } else {
338
+ expressions.push(style.body);
341
339
  }
342
- recurseObjectExpression({
343
- node: objectExpression,
344
- buildStyle: createBuildStyle()
340
+ expressions.forEach(objectExpression => {
341
+ let counter = 0;
342
+ while (objectExpression.type !== 'ObjectExpression' && counter < MAX_DEPTH) {
343
+ counter += 1;
344
+ if (objectExpression.type === 'BlockStatement') {
345
+ objectExpression = objectExpression.body.find(item => item.type === 'ReturnStatement').argument;
346
+ }
347
+ }
348
+ recurseObjectExpression({
349
+ node: objectExpression,
350
+ buildStyle: createBuildStyle()
351
+ });
352
+ if (variants.length && objectExpression.type === 'ObjectExpression') {
353
+ objectExpression.properties.push(j.objectProperty(j.identifier('variants'), j.arrayExpression(variants.filter(variant => {
354
+ const props = variant.properties.find(prop => prop.key.name === 'props');
355
+ const styleVal = variant.properties.find(prop => prop.key.name === 'style');
356
+ return props && styleVal && (!styleVal.value.properties || styleVal.value.properties.length > 0) && (props.value.type === 'ArrowFunctionExpression' || props.value.properties.length > 0);
357
+ }))));
358
+ }
345
359
  });
346
- if (variants.length) {
347
- objectExpression.properties.push(j.objectProperty(j.identifier('variants'), j.arrayExpression(variants.filter(variant => {
348
- const props = variant.properties.find(prop => prop.key.name === 'props');
349
- const styleVal = variant.properties.find(prop => prop.key.name === 'style');
350
- return props && styleVal && (!styleVal.value.properties || styleVal.value.properties.length > 0) && (props.value.type === 'ArrowFunctionExpression' || props.value.properties.length > 0);
351
- }))));
352
- }
353
360
  }
354
361
  function recurseObjectExpression(data) {
355
362
  if (data.node.type === 'ObjectExpression') {
@@ -477,7 +484,6 @@ function migrateToVariants(j, styles) {
477
484
  leftName = (_getObjectKey5 = getObjectKey(data.node.test.argument)) == null ? void 0 : _getObjectKey5.name;
478
485
  }
479
486
  if (parameters.has(leftName) && leftName !== 'theme') {
480
- var _data$parentNode;
481
487
  let props = buildProps(data.node.test);
482
488
  if (data.props) {
483
489
  props = mergeProps(data.props, props);
@@ -488,32 +494,37 @@ function migrateToVariants(j, styles) {
488
494
  style: styleVal
489
495
  };
490
496
  variants.push(buildObjectAST(variant));
491
-
492
- // create another variant with inverted condition
493
- let props2 = buildProps(inverseBinaryExpression(data.node.test));
494
- if (data.props) {
495
- props2 = mergeProps(data.props, props2);
496
- }
497
- const styleVal2 = data.buildStyle(data.node.alternate);
498
- const variant2 = {
499
- props: props2,
500
- style: styleVal2
501
- };
502
- variants.push(buildObjectAST(variant2));
503
- if (((_data$parentNode = data.parentNode) == null ? void 0 : _data$parentNode.type) === 'ObjectExpression') {
504
- removeProperty(data.parentNode, data.node);
497
+ if (data.node.consequent.type === 'ObjectExpression' && data.node.alternate.type === 'ObjectExpression') {
498
+ var _data$parentNode;
499
+ // create another variant with inverted condition
500
+ let props2 = buildProps(inverseBinaryExpression(data.node.test));
501
+ if (data.props) {
502
+ props2 = mergeProps(data.props, props2);
503
+ }
504
+ const styleVal2 = data.buildStyle(data.node.alternate);
505
+ const variant2 = {
506
+ props: props2,
507
+ style: styleVal2
508
+ };
509
+ variants.push(buildObjectAST(variant2));
510
+ if (((_data$parentNode = data.parentNode) == null ? void 0 : _data$parentNode.type) === 'ObjectExpression') {
511
+ removeProperty(data.parentNode, data.node);
512
+ }
513
+ } else {
514
+ var _data$replaceValue;
515
+ (_data$replaceValue = data.replaceValue) == null || _data$replaceValue.call(data, data.node.alternate);
505
516
  }
506
517
  }
507
518
  if (leftName === 'theme' && ((_data$parentNode2 = data.parentNode) == null ? void 0 : _data$parentNode2.type) === 'ObjectExpression' && ((_data$node$test = data.node.test) == null ? void 0 : _data$node$test.type) === 'BinaryExpression' && isThemePaletteMode(data.node.test.left)) {
508
519
  if (data.node.consequent.type !== 'ObjectExpression' && data.node.alternate.type !== 'ObjectExpression') {
509
- var _data$replaceValue;
520
+ var _data$replaceValue2;
510
521
  if (data.modeStyles) {
511
522
  if (!data.modeStyles[data.node.test.right.value]) {
512
523
  data.modeStyles[data.node.test.right.value] = [];
513
524
  }
514
525
  data.modeStyles[data.node.test.right.value].push(j.objectProperty(data.key, data.node.consequent));
515
526
  }
516
- (_data$replaceValue = data.replaceValue) == null || _data$replaceValue.call(data, data.node.alternate);
527
+ (_data$replaceValue2 = data.replaceValue) == null || _data$replaceValue2.call(data, data.node.alternate);
517
528
  }
518
529
  }
519
530
  }
@@ -549,10 +560,10 @@ function migrateToVariants(j, styles) {
549
560
  data.modeStyles[mode].push(j.objectProperty(data.key, clonedNode));
550
561
  });
551
562
  if (data.key) {
552
- var _data$replaceValue2;
563
+ var _data$replaceValue3;
553
564
  // to remove the arrow function
554
565
  // { ...: theme => `1px solid...` } to { ...: `1px solid...` }
555
- (_data$replaceValue2 = data.replaceValue) == null || _data$replaceValue2.call(data, data.node);
566
+ (_data$replaceValue3 = data.replaceValue) == null || _data$replaceValue3.call(data, data.node);
556
567
  }
557
568
  }
558
569
  }
@@ -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
- color
63
- }) => ownerState.variant !== 'buffer' && color === 'inherit',
54
+ ownerState
55
+ }) => ownerState.variant !== 'buffer',
64
56
  style: {
65
- backgroundColor: 'currentColor'
57
+ backgroundColor: (theme.vars || theme).palette[ownerState.color].main
66
58
  }
67
59
  }, {
68
60
  props: ({
69
- ownerState
70
- }) => ownerState.variant !== 'buffer' && ownerState.color !== 'inherit',
61
+ ownerState,
62
+ color
63
+ }) => ownerState.variant !== 'buffer' && color === 'inherit',
71
64
  style: {
72
- backgroundColor: (theme.vars || theme).palette[ownerState.color].main
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,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
- ownerState
40
- }) => edge === 'start' && ownerState.size !== 'small',
44
+ props: {
45
+ edge: 'end'
46
+ },
41
47
  style: {
42
- marginLeft: -12
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