@mui/material 6.0.0-alpha.3 → 6.0.0-alpha.4

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 (75) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/Checkbox/Checkbox.js +51 -20
  3. package/FormHelperText/FormHelperText.js +18 -8
  4. package/IconButton/IconButton.js +97 -40
  5. package/ImageList/ImageList.js +16 -14
  6. package/ImageListItem/ImageListItem.js +37 -22
  7. package/ImageListItemBar/ImageListItemBar.js +65 -32
  8. package/ListItem/ListItem.js +94 -50
  9. package/ListItemAvatar/ListItemAvatar.js +12 -8
  10. package/ListItemButton/ListItemButton.js +35 -15
  11. package/ListItemSecondaryAction/ListItemSecondaryAction.js +12 -8
  12. package/ListItemText/ListItemText.js +20 -11
  13. package/ListSubheader/ListSubheader.js +44 -19
  14. package/Radio/Radio.js +50 -20
  15. package/Radio/RadioButtonIcon.js +18 -12
  16. package/Rating/Rating.js +71 -37
  17. package/Table/Table.js +11 -6
  18. package/TableCell/TableCell.js +96 -41
  19. package/TableSortLabel/TableSortLabel.js +19 -9
  20. package/Toolbar/Toolbar.js +33 -17
  21. package/Typography/Typography.js +3 -2
  22. package/index.js +1 -1
  23. package/modern/Checkbox/Checkbox.js +51 -20
  24. package/modern/FormHelperText/FormHelperText.js +18 -8
  25. package/modern/IconButton/IconButton.js +97 -40
  26. package/modern/ImageList/ImageList.js +16 -14
  27. package/modern/ImageListItem/ImageListItem.js +37 -22
  28. package/modern/ImageListItemBar/ImageListItemBar.js +65 -32
  29. package/modern/ListItem/ListItem.js +94 -50
  30. package/modern/ListItemAvatar/ListItemAvatar.js +12 -8
  31. package/modern/ListItemButton/ListItemButton.js +35 -15
  32. package/modern/ListItemSecondaryAction/ListItemSecondaryAction.js +12 -8
  33. package/modern/ListItemText/ListItemText.js +20 -11
  34. package/modern/ListSubheader/ListSubheader.js +44 -19
  35. package/modern/Radio/Radio.js +50 -20
  36. package/modern/Radio/RadioButtonIcon.js +18 -12
  37. package/modern/Rating/Rating.js +71 -37
  38. package/modern/Table/Table.js +11 -6
  39. package/modern/TableCell/TableCell.js +96 -41
  40. package/modern/TableSortLabel/TableSortLabel.js +19 -9
  41. package/modern/Toolbar/Toolbar.js +33 -17
  42. package/modern/Typography/Typography.js +3 -2
  43. package/modern/index.js +1 -1
  44. package/modern/styles/experimental_extendTheme.js +2 -1
  45. package/modern/styles/getOverlayAlpha.js +3 -4
  46. package/node/Checkbox/Checkbox.js +54 -23
  47. package/node/FormHelperText/FormHelperText.js +18 -8
  48. package/node/IconButton/IconButton.js +99 -43
  49. package/node/ImageList/ImageList.js +16 -14
  50. package/node/ImageListItem/ImageListItem.js +37 -22
  51. package/node/ImageListItemBar/ImageListItemBar.js +65 -32
  52. package/node/ListItem/ListItem.js +94 -50
  53. package/node/ListItemAvatar/ListItemAvatar.js +12 -8
  54. package/node/ListItemButton/ListItemButton.js +35 -15
  55. package/node/ListItemSecondaryAction/ListItemSecondaryAction.js +12 -8
  56. package/node/ListItemText/ListItemText.js +20 -11
  57. package/node/ListSubheader/ListSubheader.js +44 -19
  58. package/node/Radio/Radio.js +52 -22
  59. package/node/Radio/RadioButtonIcon.js +21 -15
  60. package/node/Rating/Rating.js +71 -37
  61. package/node/Table/Table.js +11 -6
  62. package/node/TableCell/TableCell.js +96 -41
  63. package/node/TableSortLabel/TableSortLabel.js +19 -9
  64. package/node/Toolbar/Toolbar.js +33 -17
  65. package/node/Typography/Typography.js +3 -2
  66. package/node/index.js +1 -1
  67. package/node/styles/experimental_extendTheme.js +1 -0
  68. package/node/styles/getOverlayAlpha.js +4 -5
  69. package/package.json +4 -4
  70. package/styles/experimental_extendTheme.d.ts +2 -0
  71. package/styles/experimental_extendTheme.js +2 -1
  72. package/styles/getOverlayAlpha.d.ts +1 -2
  73. package/styles/getOverlayAlpha.js +3 -4
  74. package/umd/material-ui.development.js +1028 -533
  75. package/umd/material-ui.production.min.js +4 -4
@@ -47,8 +47,7 @@ const TableCellRoot = (0, _styled.default)('td', {
47
47
  return [styles.root, styles[ownerState.variant], styles[`size${(0, _capitalize.default)(ownerState.size)}`], ownerState.padding !== 'normal' && styles[`padding${(0, _capitalize.default)(ownerState.padding)}`], ownerState.align !== 'inherit' && styles[`align${(0, _capitalize.default)(ownerState.align)}`], ownerState.stickyHeader && styles.stickyHeader];
48
48
  }
49
49
  })(({
50
- theme,
51
- ownerState
50
+ theme
52
51
  }) => (0, _extends2.default)({}, theme.typography.body2, {
53
52
  display: 'table-cell',
54
53
  verticalAlign: 'inherit',
@@ -57,47 +56,103 @@ const TableCellRoot = (0, _styled.default)('td', {
57
56
  borderBottom: theme.vars ? `1px solid ${theme.vars.palette.TableCell.border}` : `1px solid
58
57
  ${theme.palette.mode === 'light' ? (0, _colorManipulator.lighten)((0, _colorManipulator.alpha)(theme.palette.divider, 1), 0.88) : (0, _colorManipulator.darken)((0, _colorManipulator.alpha)(theme.palette.divider, 1), 0.68)}`,
59
58
  textAlign: 'left',
60
- padding: 16
61
- }, ownerState.variant === 'head' && {
62
- color: (theme.vars || theme).palette.text.primary,
63
- lineHeight: theme.typography.pxToRem(24),
64
- fontWeight: theme.typography.fontWeightMedium
65
- }, ownerState.variant === 'body' && {
66
- color: (theme.vars || theme).palette.text.primary
67
- }, ownerState.variant === 'footer' && {
68
- color: (theme.vars || theme).palette.text.secondary,
69
- lineHeight: theme.typography.pxToRem(21),
70
- fontSize: theme.typography.pxToRem(12)
71
- }, ownerState.size === 'small' && {
72
- padding: '6px 16px',
73
- [`&.${_tableCellClasses.default.paddingCheckbox}`]: {
74
- width: 24,
75
- // prevent the checkbox column from growing
76
- padding: '0 12px 0 16px',
77
- '& > *': {
59
+ padding: 16,
60
+ variants: [{
61
+ props: {
62
+ variant: 'head'
63
+ },
64
+ style: {
65
+ color: (theme.vars || theme).palette.text.primary,
66
+ lineHeight: theme.typography.pxToRem(24),
67
+ fontWeight: theme.typography.fontWeightMedium
68
+ }
69
+ }, {
70
+ props: {
71
+ variant: 'body'
72
+ },
73
+ style: {
74
+ color: (theme.vars || theme).palette.text.primary
75
+ }
76
+ }, {
77
+ props: {
78
+ variant: 'footer'
79
+ },
80
+ style: {
81
+ color: (theme.vars || theme).palette.text.secondary,
82
+ lineHeight: theme.typography.pxToRem(21),
83
+ fontSize: theme.typography.pxToRem(12)
84
+ }
85
+ }, {
86
+ props: {
87
+ size: 'small'
88
+ },
89
+ style: {
90
+ padding: '6px 16px',
91
+ [`&.${_tableCellClasses.default.paddingCheckbox}`]: {
92
+ width: 24,
93
+ // prevent the checkbox column from growing
94
+ padding: '0 12px 0 16px',
95
+ '& > *': {
96
+ padding: 0
97
+ }
98
+ }
99
+ }
100
+ }, {
101
+ props: {
102
+ padding: 'checkbox'
103
+ },
104
+ style: {
105
+ width: 48,
106
+ // prevent the checkbox column from growing
107
+ padding: '0 0 0 4px'
108
+ }
109
+ }, {
110
+ props: {
111
+ padding: 'none'
112
+ },
113
+ style: {
78
114
  padding: 0
79
115
  }
80
- }
81
- }, ownerState.padding === 'checkbox' && {
82
- width: 48,
83
- // prevent the checkbox column from growing
84
- padding: '0 0 0 4px'
85
- }, ownerState.padding === 'none' && {
86
- padding: 0
87
- }, ownerState.align === 'left' && {
88
- textAlign: 'left'
89
- }, ownerState.align === 'center' && {
90
- textAlign: 'center'
91
- }, ownerState.align === 'right' && {
92
- textAlign: 'right',
93
- flexDirection: 'row-reverse'
94
- }, ownerState.align === 'justify' && {
95
- textAlign: 'justify'
96
- }, ownerState.stickyHeader && {
97
- position: 'sticky',
98
- top: 0,
99
- zIndex: 2,
100
- backgroundColor: (theme.vars || theme).palette.background.default
116
+ }, {
117
+ props: {
118
+ align: 'left'
119
+ },
120
+ style: {
121
+ textAlign: 'left'
122
+ }
123
+ }, {
124
+ props: {
125
+ align: 'center'
126
+ },
127
+ style: {
128
+ textAlign: 'center'
129
+ }
130
+ }, {
131
+ props: {
132
+ align: 'right'
133
+ },
134
+ style: {
135
+ textAlign: 'right',
136
+ flexDirection: 'row-reverse'
137
+ }
138
+ }, {
139
+ props: {
140
+ align: 'justify'
141
+ },
142
+ style: {
143
+ textAlign: 'justify'
144
+ }
145
+ }, {
146
+ props: ({
147
+ ownerState
148
+ }) => ownerState.stickyHeader,
149
+ style: {
150
+ position: 'sticky',
151
+ top: 0,
152
+ zIndex: 2,
153
+ backgroundColor: (theme.vars || theme).palette.background.default
154
+ }
155
+ }]
101
156
  }));
102
157
 
103
158
  /**
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.default = void 0;
9
- var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
10
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
+ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
11
11
  var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
12
12
  var _clsx = _interopRequireDefault(require("clsx"));
13
13
  var _propTypes = _interopRequireDefault(require("prop-types"));
@@ -78,9 +78,8 @@ const TableSortLabelIcon = (0, _styled.default)('span', {
78
78
  return [styles.icon, styles[`iconDirection${(0, _capitalize.default)(ownerState.direction)}`]];
79
79
  }
80
80
  })(({
81
- theme,
82
- ownerState
83
- }) => (0, _extends2.default)({
81
+ theme
82
+ }) => ({
84
83
  fontSize: 18,
85
84
  marginRight: 4,
86
85
  marginLeft: 4,
@@ -88,11 +87,22 @@ const TableSortLabelIcon = (0, _styled.default)('span', {
88
87
  transition: theme.transitions.create(['opacity', 'transform'], {
89
88
  duration: theme.transitions.duration.shorter
90
89
  }),
91
- userSelect: 'none'
92
- }, ownerState.direction === 'desc' && {
93
- transform: 'rotate(0deg)'
94
- }, ownerState.direction === 'asc' && {
95
- transform: 'rotate(180deg)'
90
+ userSelect: 'none',
91
+ variants: [{
92
+ props: {
93
+ direction: 'desc'
94
+ },
95
+ style: {
96
+ transform: 'rotate(0deg)'
97
+ }
98
+ }, {
99
+ props: {
100
+ direction: 'asc'
101
+ },
102
+ style: {
103
+ transform: 'rotate(180deg)'
104
+ }
105
+ }]
96
106
  }));
97
107
 
98
108
  /**
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.default = void 0;
9
- var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
10
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
+ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
11
11
  var React = _interopRequireWildcard(require("react"));
12
12
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
13
  var _clsx = _interopRequireDefault(require("clsx"));
@@ -40,25 +40,41 @@ const ToolbarRoot = (0, _styled.default)('div', {
40
40
  return [styles.root, !ownerState.disableGutters && styles.gutters, styles[ownerState.variant]];
41
41
  }
42
42
  })(({
43
- theme,
44
- ownerState
45
- }) => (0, _extends2.default)({
43
+ theme
44
+ }) => ({
46
45
  position: 'relative',
47
46
  display: 'flex',
48
- alignItems: 'center'
49
- }, !ownerState.disableGutters && {
50
- paddingLeft: theme.spacing(2),
51
- paddingRight: theme.spacing(2),
52
- [theme.breakpoints.up('sm')]: {
53
- paddingLeft: theme.spacing(3),
54
- paddingRight: theme.spacing(3)
55
- }
56
- }, ownerState.variant === 'dense' && {
57
- minHeight: 48
47
+ alignItems: 'center',
48
+ variants: [{
49
+ props: ({
50
+ ownerState
51
+ }) => !ownerState.disableGutters,
52
+ style: {
53
+ paddingLeft: theme.spacing(2),
54
+ paddingRight: theme.spacing(2),
55
+ [theme.breakpoints.up('sm')]: {
56
+ paddingLeft: theme.spacing(3),
57
+ paddingRight: theme.spacing(3)
58
+ }
59
+ }
60
+ }, {
61
+ props: {
62
+ variant: 'dense'
63
+ },
64
+ style: {
65
+ minHeight: 48
66
+ }
67
+ }]
58
68
  }), ({
59
- theme,
60
- ownerState
61
- }) => ownerState.variant === 'regular' && theme.mixins.toolbar);
69
+ theme
70
+ }) => ({
71
+ variants: [{
72
+ props: {
73
+ variant: 'regular'
74
+ },
75
+ style: theme.mixins.toolbar
76
+ }]
77
+ }));
62
78
  const Toolbar = /*#__PURE__*/React.forwardRef(function Toolbar(inProps, ref) {
63
79
  const props = (0, _useThemeProps.default)({
64
80
  props: inProps,
@@ -126,9 +126,10 @@ const Typography = /*#__PURE__*/React.forwardRef(function Typography(inProps, re
126
126
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(TypographyRoot, (0, _extends2.default)({
127
127
  as: Component,
128
128
  ref: ref,
129
- ownerState: ownerState,
130
129
  className: (0, _clsx.default)(classes.root, className)
131
- }, other));
130
+ }, other, {
131
+ ownerState: ownerState
132
+ }));
132
133
  });
133
134
  process.env.NODE_ENV !== "production" ? Typography.propTypes /* remove-proptypes */ = {
134
135
  // ┌────────────────────────────── Warning ──────────────────────────────┐
package/node/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/material v6.0.0-alpha.3
2
+ * @mui/material v6.0.0-alpha.4
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -130,6 +130,7 @@ function extendTheme(options = {}, ...args) {
130
130
  overlays: ((_colorSchemesInput$da3 = colorSchemesInput.dark) == null ? void 0 : _colorSchemesInput$da3.overlays) || defaultDarkOverlays
131
131
  })
132
132
  }),
133
+ font: (0, _extends2.default)({}, (0, _cssVars.prepareTypographyVars)(muiTheme.typography), muiTheme.font),
133
134
  spacing: getSpacingVal(input.spacing)
134
135
  });
135
136
  Object.keys(theme.colorSchemes).forEach(key => {
@@ -3,15 +3,14 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = void 0;
6
+ exports.default = getOverlayAlpha;
7
7
  // Inspired by https://github.com/material-components/material-components-ios/blob/bca36107405594d5b7b16265a5b0ed698f85a5ee/components/Elevation/src/UIColor%2BMaterialElevation.m#L61
8
- const getOverlayAlpha = elevation => {
8
+ function getOverlayAlpha(elevation) {
9
9
  let alphaValue;
10
10
  if (elevation < 1) {
11
11
  alphaValue = 5.11916 * elevation ** 2;
12
12
  } else {
13
13
  alphaValue = 4.5 * Math.log(elevation + 1) + 2;
14
14
  }
15
- return (alphaValue / 100).toFixed(2);
16
- };
17
- var _default = exports.default = getOverlayAlpha;
15
+ return Math.round(alphaValue * 10) / 1000;
16
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/material",
3
- "version": "6.0.0-alpha.3",
3
+ "version": "6.0.0-alpha.4",
4
4
  "private": false,
5
5
  "author": "MUI Team",
6
6
  "description": "Material UI is an open-source React component library that implements Google's Material Design. It's comprehensive and can be used in production out of the box.",
@@ -34,11 +34,11 @@
34
34
  "prop-types": "^15.8.1",
35
35
  "react-is": "^18.2.0",
36
36
  "react-transition-group": "^4.4.5",
37
- "@mui/base": "5.0.0-beta.42",
38
- "@mui/system": "^6.0.0-alpha.3",
39
37
  "@mui/types": "^7.2.14",
38
+ "@mui/system": "^6.0.0-alpha.4",
39
+ "@mui/core-downloads-tracker": "^6.0.0-alpha.4",
40
40
  "@mui/utils": "^6.0.0-alpha.3",
41
- "@mui/core-downloads-tracker": "^6.0.0-alpha.3"
41
+ "@mui/base": "5.0.0-beta.42"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "@emotion/react": "^11.5.0",
@@ -1,6 +1,7 @@
1
1
  /* eslint-disable @typescript-eslint/naming-convention */
2
2
  import { OverridableStringUnion } from '@mui/types';
3
3
  import { SxConfig, SxProps, CSSObject, ApplyStyles } from '@mui/system';
4
+ import { ExtractTypographyTokens } from '@mui/system/cssVars';
4
5
  import { ThemeOptions, Theme } from './createTheme';
5
6
  import { Palette, PaletteOptions } from './createPalette';
6
7
  import { Shadows } from './shadows';
@@ -321,6 +322,7 @@ export interface CssVarsThemeOptions extends Omit<ThemeOptions, 'palette' | 'com
321
322
 
322
323
  // should not include keys defined in `shouldSkipGeneratingVar` and have value typeof function
323
324
  export interface ThemeVars {
325
+ font: ExtractTypographyTokens<Theme['typography']>;
324
326
  palette: Omit<
325
327
  ColorSystem['palette'],
326
328
  | 'colorScheme'
@@ -5,7 +5,7 @@ const _excluded = ["colorSchemes", "cssVarPrefix", "shouldSkipGeneratingVar", "g
5
5
  import deepmerge from '@mui/utils/deepmerge';
6
6
  import { unstable_createGetCssVar as systemCreateGetCssVar, createSpacing } from '@mui/system';
7
7
  import { createUnarySpacing } from '@mui/system/spacing';
8
- import { prepareCssVars } from '@mui/system/cssVars';
8
+ import { prepareCssVars, prepareTypographyVars } from '@mui/system/cssVars';
9
9
  import styleFunctionSx, { unstable_defaultSxConfig as defaultSxConfig } from '@mui/system/styleFunctionSx';
10
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';
11
11
  import defaultShouldSkipGeneratingVar from './shouldSkipGeneratingVar';
@@ -118,6 +118,7 @@ export default function extendTheme(options = {}, ...args) {
118
118
  overlays: colorSchemesInput.dark?.overlays || defaultDarkOverlays
119
119
  })
120
120
  }),
121
+ font: _extends({}, prepareTypographyVars(muiTheme.typography), muiTheme.font),
121
122
  spacing: getSpacingVal(input.spacing)
122
123
  });
123
124
  Object.keys(theme.colorSchemes).forEach(key => {
@@ -1,2 +1 @@
1
- declare const getOverlayAlpha: (elevation: number) => string;
2
- export default getOverlayAlpha;
1
+ export default function getOverlayAlpha(elevation: number): number;
@@ -1,11 +1,10 @@
1
1
  // Inspired by https://github.com/material-components/material-components-ios/blob/bca36107405594d5b7b16265a5b0ed698f85a5ee/components/Elevation/src/UIColor%2BMaterialElevation.m#L61
2
- const getOverlayAlpha = elevation => {
2
+ export default function getOverlayAlpha(elevation) {
3
3
  let alphaValue;
4
4
  if (elevation < 1) {
5
5
  alphaValue = 5.11916 * elevation ** 2;
6
6
  } else {
7
7
  alphaValue = 4.5 * Math.log(elevation + 1) + 2;
8
8
  }
9
- return (alphaValue / 100).toFixed(2);
10
- };
11
- export default getOverlayAlpha;
9
+ return Math.round(alphaValue * 10) / 1000;
10
+ }