@mui/material 6.0.0-alpha.0 → 6.0.0-alpha.2

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.
Files changed (82) hide show
  1. package/AppBar/AppBar.js +118 -68
  2. package/Badge/Badge.d.ts +2 -4
  3. package/Badge/Badge.js +2 -4
  4. package/Button/Button.js +220 -131
  5. package/ButtonBase/ButtonBase.js +2 -2
  6. package/ButtonBase/Ripple.js +1 -1
  7. package/ButtonBase/TouchRipple.js +3 -4
  8. package/ButtonGroup/ButtonGroup.js +167 -70
  9. package/CHANGELOG.md +170 -4
  10. package/Grid/Grid.js +3 -0
  11. package/RadioGroup/RadioGroup.d.ts +0 -2
  12. package/RadioGroup/RadioGroup.js +23 -2
  13. package/RadioGroup/index.d.ts +3 -0
  14. package/RadioGroup/index.js +3 -1
  15. package/RadioGroup/radioGroupClasses.d.ts +6 -0
  16. package/RadioGroup/radioGroupClasses.js +7 -0
  17. package/Select/Select.d.ts +9 -6
  18. package/Slider/Slider.js +22 -22
  19. package/Table/Table.d.ts +0 -2
  20. package/Table/Table.js +0 -2
  21. package/index.js +1 -1
  22. package/legacy/AppBar/AppBar.js +124 -64
  23. package/legacy/Badge/Badge.js +2 -4
  24. package/legacy/Button/Button.js +218 -123
  25. package/legacy/ButtonBase/ButtonBase.js +2 -2
  26. package/legacy/ButtonBase/Ripple.js +1 -1
  27. package/legacy/ButtonBase/TouchRipple.js +3 -4
  28. package/legacy/ButtonGroup/ButtonGroup.js +163 -68
  29. package/legacy/Grid/Grid.js +3 -0
  30. package/legacy/RadioGroup/RadioGroup.js +21 -2
  31. package/legacy/RadioGroup/index.js +3 -1
  32. package/legacy/RadioGroup/radioGroupClasses.js +7 -0
  33. package/legacy/Slider/Slider.js +24 -24
  34. package/legacy/Table/Table.js +0 -2
  35. package/legacy/index.js +1 -1
  36. package/legacy/locale/index.js +1 -1
  37. package/legacy/styles/experimental_extendTheme.js +24 -2
  38. package/legacy/zero-styled/index.js +1 -0
  39. package/locale/index.js +1 -1
  40. package/modern/AppBar/AppBar.js +118 -68
  41. package/modern/Badge/Badge.js +2 -4
  42. package/modern/Button/Button.js +220 -131
  43. package/modern/ButtonBase/ButtonBase.js +2 -2
  44. package/modern/ButtonBase/Ripple.js +1 -1
  45. package/modern/ButtonBase/TouchRipple.js +3 -4
  46. package/modern/ButtonGroup/ButtonGroup.js +167 -70
  47. package/modern/Grid/Grid.js +3 -0
  48. package/modern/RadioGroup/RadioGroup.js +23 -2
  49. package/modern/RadioGroup/index.js +3 -1
  50. package/modern/RadioGroup/radioGroupClasses.js +7 -0
  51. package/modern/Slider/Slider.js +22 -22
  52. package/modern/Table/Table.js +0 -2
  53. package/modern/index.js +1 -1
  54. package/modern/locale/index.js +1 -1
  55. package/modern/styles/experimental_extendTheme.js +24 -2
  56. package/modern/zero-styled/index.js +1 -0
  57. package/node/AppBar/AppBar.js +125 -66
  58. package/node/Badge/Badge.js +2 -4
  59. package/node/Button/Button.js +224 -135
  60. package/node/ButtonBase/ButtonBase.js +4 -4
  61. package/node/ButtonBase/Ripple.js +1 -1
  62. package/node/ButtonBase/TouchRipple.js +9 -10
  63. package/node/ButtonGroup/ButtonGroup.js +169 -72
  64. package/node/Grid/Grid.js +3 -0
  65. package/node/RadioGroup/RadioGroup.js +23 -2
  66. package/node/RadioGroup/index.js +25 -1
  67. package/node/RadioGroup/radioGroupClasses.js +15 -0
  68. package/node/Slider/Slider.js +25 -25
  69. package/node/Table/Table.js +0 -2
  70. package/node/index.js +1 -1
  71. package/node/locale/index.js +1 -1
  72. package/node/styles/experimental_extendTheme.js +24 -2
  73. package/node/zero-styled/index.js +7 -0
  74. package/package.json +6 -6
  75. package/styles/components.d.ts +5 -0
  76. package/styles/experimental_extendTheme.d.ts +2 -0
  77. package/styles/experimental_extendTheme.js +24 -2
  78. package/styles/overrides.d.ts +2 -0
  79. package/umd/material-ui.development.js +888 -593
  80. package/umd/material-ui.production.min.js +4 -4
  81. package/zero-styled/index.d.ts +1 -0
  82. package/zero-styled/index.js +1 -0
@@ -334,6 +334,7 @@ export interface ThemeVars {
334
334
  overlays: Overlays;
335
335
  shadows: Shadows;
336
336
  shape: Theme['shape'];
337
+ spacing: string;
337
338
  zIndex: ZIndex;
338
339
  }
339
340
 
@@ -431,6 +432,7 @@ export interface CssVarsTheme extends ColorSystem {
431
432
  getColorSchemeSelector: (colorScheme: SupportedColorScheme) => string;
432
433
  generateThemeVars: () => ThemeVars;
433
434
  generateStyleSheets: () => Array<Record<string, any>>;
435
+ generateSpacing: () => Theme['spacing'];
434
436
 
435
437
  // Default theme tokens
436
438
  spacing: Theme['spacing'];
@@ -3,7 +3,9 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
3
3
  const _excluded = ["colorSchemes", "cssVarPrefix", "shouldSkipGeneratingVar", "getSelector"],
4
4
  _excluded2 = ["palette"];
5
5
  import deepmerge from '@mui/utils/deepmerge';
6
- import { unstable_createGetCssVar as systemCreateGetCssVar, unstable_prepareCssVars as prepareCssVars } from '@mui/system';
6
+ import { unstable_createGetCssVar as systemCreateGetCssVar, createSpacing } from '@mui/system';
7
+ import { createUnarySpacing } from '@mui/system/spacing';
8
+ import { prepareCssVars } from '@mui/system/cssVars';
7
9
  import styleFunctionSx, { unstable_defaultSxConfig as defaultSxConfig } from '@mui/system/styleFunctionSx';
8
10
  import { private_safeColorChannel as safeColorChannel, private_safeAlpha as safeAlpha, private_safeDarken as safeDarken, private_safeLighten as safeLighten, private_safeEmphasize as safeEmphasize, hslToRgb } from '@mui/system/colorManipulator';
9
11
  import defaultShouldSkipGeneratingVar from './shouldSkipGeneratingVar';
@@ -42,6 +44,21 @@ function setColorChannel(obj, key) {
42
44
  obj[`${key}Channel`] = safeColorChannel(toRgb(obj[key]), `MUI: Can't create \`palette.${key}Channel\` because \`palette.${key}\` is not one of these formats: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().` + '\n' + `To suppress this warning, you need to explicitly provide the \`palette.${key}Channel\` as a string (in rgb format, for example "12 12 12") or undefined if you want to remove the channel token.`);
43
45
  }
44
46
  }
47
+ function getSpacingVal(spacingInput) {
48
+ if (typeof spacingInput === 'number') {
49
+ return `${spacingInput}px`;
50
+ }
51
+ if (typeof spacingInput === 'string') {
52
+ return spacingInput;
53
+ }
54
+ if (typeof spacingInput === 'function') {
55
+ return getSpacingVal(spacingInput(1));
56
+ }
57
+ if (Array.isArray(spacingInput)) {
58
+ return spacingInput;
59
+ }
60
+ return '8px';
61
+ }
45
62
  const silent = fn => {
46
63
  try {
47
64
  return fn();
@@ -100,7 +117,8 @@ export default function extendTheme(options = {}, ...args) {
100
117
  }, colorSchemesInput.dark?.opacity),
101
118
  overlays: colorSchemesInput.dark?.overlays || defaultDarkOverlays
102
119
  })
103
- })
120
+ }),
121
+ spacing: getSpacingVal(input.spacing)
104
122
  });
105
123
  Object.keys(theme.colorSchemes).forEach(key => {
106
124
  const palette = theme.colorSchemes[key].palette;
@@ -309,7 +327,11 @@ export default function extendTheme(options = {}, ...args) {
309
327
  });
310
328
  theme.generateThemeVars = generateThemeVars;
311
329
  theme.generateStyleSheets = generateStyleSheets;
330
+ theme.generateSpacing = function generateSpacing() {
331
+ return createSpacing(input.spacing, createUnarySpacing(this));
332
+ };
312
333
  theme.getColorSchemeSelector = colorScheme => `[${theme.attribute}="${colorScheme}"] &`;
334
+ theme.spacing = theme.generateSpacing();
313
335
  theme.shouldSkipGeneratingVar = shouldSkipGeneratingVar;
314
336
  theme.unstable_sxConfig = _extends({}, defaultSxConfig, input?.unstable_sxConfig);
315
337
  theme.unstable_sx = function sx(props) {
@@ -77,6 +77,7 @@ import { PaginationItemClassKey } from '../PaginationItem';
77
77
  import { PaperClassKey } from '../Paper';
78
78
  import { PopoverClassKey } from '../Popover';
79
79
  import { RadioClassKey } from '../Radio';
80
+ import { RadioGroupClassKey } from '../RadioGroup';
80
81
  import { RatingClassKey } from '../Rating';
81
82
  import { ScopedCssBaselineClassKey } from '../ScopedCssBaseline';
82
83
  import { SelectClassKey } from '../Select';
@@ -222,6 +223,7 @@ export interface ComponentNameToClassKey {
222
223
  MuiPopover: PopoverClassKey;
223
224
  MuiPopper: PopperClassKey;
224
225
  MuiRadio: RadioClassKey;
226
+ MuiRadioGroup: RadioGroupClassKey;
225
227
  MuiRating: RatingClassKey;
226
228
  MuiScopedCssBaseline: ScopedCssBaselineClassKey;
227
229
  MuiSelect: SelectClassKey;