@mui/material 6.0.0-beta.5 → 6.0.0-beta.6

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 (101) hide show
  1. package/Autocomplete/Autocomplete.js +1 -1
  2. package/Breadcrumbs/Breadcrumbs.js +1 -1
  3. package/CHANGELOG.md +69 -0
  4. package/CardHeader/CardHeader.js +9 -5
  5. package/DialogContentText/DialogContentText.js +1 -1
  6. package/Divider/Divider.js +3 -2
  7. package/FormControlLabel/FormControlLabel.js +1 -3
  8. package/IconButton/IconButton.js +3 -0
  9. package/InputAdornment/InputAdornment.js +1 -1
  10. package/Link/Link.js +39 -4
  11. package/Link/getTextDecoration.d.ts +1 -2
  12. package/Link/getTextDecoration.js +1 -19
  13. package/ListItemText/ListItemText.js +8 -4
  14. package/Slider/useSlider.js +3 -3
  15. package/Typography/Typography.d.ts +21 -2
  16. package/Typography/Typography.js +28 -16
  17. package/index.js +1 -1
  18. package/modern/Autocomplete/Autocomplete.js +1 -1
  19. package/modern/Breadcrumbs/Breadcrumbs.js +1 -1
  20. package/modern/CardHeader/CardHeader.js +9 -5
  21. package/modern/DialogContentText/DialogContentText.js +1 -1
  22. package/modern/Divider/Divider.js +3 -2
  23. package/modern/FormControlLabel/FormControlLabel.js +1 -3
  24. package/modern/IconButton/IconButton.js +3 -0
  25. package/modern/InputAdornment/InputAdornment.js +1 -1
  26. package/modern/Link/Link.js +39 -4
  27. package/modern/Link/getTextDecoration.js +1 -19
  28. package/modern/ListItemText/ListItemText.js +8 -4
  29. package/modern/Slider/useSlider.js +3 -3
  30. package/modern/Typography/Typography.js +28 -16
  31. package/modern/index.js +1 -1
  32. package/modern/styles/createGetSelector.js +8 -2
  33. package/modern/useAutocomplete/useAutocomplete.js +0 -8
  34. package/modern/version/index.js +2 -2
  35. package/node/AppBar/AppBar.js +10 -13
  36. package/node/Autocomplete/Autocomplete.js +4 -7
  37. package/node/AvatarGroup/AvatarGroup.js +1 -2
  38. package/node/Badge/Badge.js +6 -7
  39. package/node/Breadcrumbs/Breadcrumbs.js +1 -1
  40. package/node/Button/Button.js +1 -2
  41. package/node/ButtonBase/TouchRipple.js +4 -4
  42. package/node/CardHeader/CardHeader.js +9 -5
  43. package/node/Checkbox/Checkbox.js +2 -3
  44. package/node/CssBaseline/CssBaseline.js +5 -10
  45. package/node/DialogContentText/DialogContentText.js +1 -1
  46. package/node/DialogTitle/DialogTitle.js +1 -1
  47. package/node/Divider/Divider.js +3 -2
  48. package/node/Fab/Fab.js +87 -90
  49. package/node/FilledInput/FilledInput.js +13 -17
  50. package/node/FormControlLabel/FormControlLabel.js +4 -7
  51. package/node/Grid/Grid.js +2 -4
  52. package/node/IconButton/IconButton.js +3 -0
  53. package/node/Input/Input.js +3 -4
  54. package/node/InputAdornment/InputAdornment.js +1 -1
  55. package/node/InputBase/InputBase.js +1 -2
  56. package/node/Link/Link.js +39 -4
  57. package/node/Link/getTextDecoration.js +2 -20
  58. package/node/ListItemText/ListItemText.js +9 -5
  59. package/node/Menu/Menu.js +2 -3
  60. package/node/Modal/Modal.js +4 -4
  61. package/node/Modal/ModalManager.js +1 -1
  62. package/node/Modal/useModal.js +4 -6
  63. package/node/OutlinedInput/OutlinedInput.js +3 -3
  64. package/node/PaginationItem/PaginationItem.js +4 -5
  65. package/node/Paper/Paper.js +1 -2
  66. package/node/Popover/Popover.js +2 -3
  67. package/node/Popper/BasePopper.js +1 -2
  68. package/node/Popper/Popper.js +2 -3
  69. package/node/Radio/Radio.js +2 -3
  70. package/node/ScopedCssBaseline/ScopedCssBaseline.js +2 -4
  71. package/node/Select/SelectInput.js +2 -3
  72. package/node/Slider/Slider.js +20 -21
  73. package/node/Slider/useSlider.js +17 -29
  74. package/node/Snackbar/useSnackbar.js +7 -7
  75. package/node/StepLabel/StepLabel.js +1 -1
  76. package/node/SvgIcon/SvgIcon.js +75 -81
  77. package/node/SwipeableDrawer/SwipeableDrawer.js +1 -2
  78. package/node/TabScrollButton/TabScrollButton.js +2 -3
  79. package/node/TablePagination/TablePagination.js +1 -2
  80. package/node/TablePagination/TablePaginationActions.js +10 -11
  81. package/node/Tabs/Tabs.js +5 -8
  82. package/node/Tooltip/Tooltip.js +13 -15
  83. package/node/Typography/Typography.js +28 -16
  84. package/node/Unstable_TrapFocus/FocusTrap.js +1 -2
  85. package/node/index.js +1 -1
  86. package/node/styles/createGetSelector.js +9 -3
  87. package/node/styles/createTheme.js +2 -2
  88. package/node/styles/createThemeNoVars.js +1 -1
  89. package/node/styles/createThemeWithVars.js +5 -7
  90. package/node/styles/shouldSkipGeneratingVar.js +1 -2
  91. package/node/transitions/utils.js +2 -3
  92. package/node/useAutocomplete/useAutocomplete.js +3 -18
  93. package/node/useLazyRipple/useLazyRipple.js +3 -12
  94. package/node/utils/useSlot.js +1 -1
  95. package/node/version/index.js +2 -2
  96. package/package.json +11 -11
  97. package/styles/createGetSelector.d.ts +5 -3
  98. package/styles/createGetSelector.js +8 -2
  99. package/useAutocomplete/useAutocomplete.d.ts +2 -2
  100. package/useAutocomplete/useAutocomplete.js +0 -8
  101. package/version/index.js +2 -2
@@ -1082,7 +1082,7 @@ process.env.NODE_ENV !== "production" ? Autocomplete.propTypes /* remove-proptyp
1082
1082
  */
1083
1083
  openText: PropTypes.string,
1084
1084
  /**
1085
- * Array of options.
1085
+ * A list of options that will be shown in the Autocomplete.
1086
1086
  */
1087
1087
  options: PropTypes.array.isRequired,
1088
1088
  /**
@@ -154,7 +154,7 @@ const Breadcrumbs = /*#__PURE__*/React.forwardRef(function Breadcrumbs(inProps,
154
154
  return /*#__PURE__*/_jsx(BreadcrumbsRoot, {
155
155
  ref: ref,
156
156
  component: component,
157
- color: "text.secondary",
157
+ color: "textSecondary",
158
158
  className: clsx(classes.root, className),
159
159
  ownerState: ownerState,
160
160
  ...other,
package/CHANGELOG.md CHANGED
@@ -1,5 +1,73 @@
1
1
  # [Versions](https://mui.com/versions/)
2
2
 
3
+ ## 6.0.0-beta.6
4
+
5
+ <!-- generated comparing v6.0.0-beta.5..next -->
6
+
7
+ _Aug 16, 2024_
8
+
9
+ A big thanks to the 18 contributors who made this release possible.
10
+
11
+ ### `@mui/material@6.0.0-beta.6`
12
+
13
+ - [Autocomplete] Improve the `options` prop description (#41591) @pluvio72
14
+ - [Autocomplete] Remove autocomplete warning regarding value not equal to option (#43314) @ZeeshanTamboli
15
+ - [Divider] Add aria-orientation (#43241) @aarongarciah
16
+ - [IconButton] Fix hover background color behavior (#43271) @mnajdova
17
+ - [TypeScript] Refactor types so they're compatible with upcoming React 19 (#43276) @DiegoAndai
18
+ - [Typography] Replace dot notation color value to work with Pigment CSS (#43288) @siriwatknp
19
+ - [pigment-css] Fix `getSelector` prefers-color-scheme to be object (#43237) @siriwatknp
20
+ - Remove `display="block"` usage to work with Pigment CSS (#43307) @siriwatknp
21
+
22
+ ### `@mui/codemod@6.0.0-beta.6`
23
+
24
+ - [codemod] Skip sx spread transformation (#43291) @siriwatknp
25
+
26
+ ### `@mui/styles@6.0.0-beta.6`
27
+
28
+ - [styles] Fix issues reported by eslint-plugin-react-compiler (#43118) @jlewins
29
+
30
+ ### Docs
31
+
32
+ - [material-ui] Audit and copyedit the v6 migration doc (#43073) @samuelsycamore
33
+ - [material-ui] Fix Material Icon search lag and other improvements (#41330) @anle9650
34
+ - [material-ui][Popover] Fix description and title of hover interaction section (#43290) @ZeeshanTamboli
35
+ - [material-ui] Refine and unify custom template themes (#43220) @zanivan
36
+ - [joy-ui] Fix data grid redirection (#43247) @sai6855
37
+ - [mui-system] Add import statement in docs (#43223) @sai6855
38
+ - Update babel config (#43286) @romgrk
39
+ - Fix outdated references to Materal UI version (#43321) @oliviertassinari
40
+ - Polish migration git diff experience @oliviertassinari
41
+ - Update LTS to match format (#43212) @oliviertassinari
42
+ - Fix Pigment CSS migration content (#43217) @siriwatknp
43
+
44
+ ### Core
45
+
46
+ - [code-infra] Remove `userEvent` export from `@mui/internal-test-utils` (#43313) @LukasTy
47
+ - [code-infra] Remove unnecessary alias (#43320) @Janpot
48
+ - [code-infra] Fix utils bundle size entrypoint (#43304) @Janpot
49
+ - [core] missing and incorrect scripts (#43209) @Jay-Karia
50
+ - [core] Set Node 14 as minimum version in all browserslist envs (#43326) @aarongarciah
51
+ - [core] Add React 19 as peer dependency (#43216) @aarongarciah
52
+ - [core] Pin `eslint-plugin-jsx-a11y` version to 6.7.1 (#43292) @Janpot
53
+ - [core] Update supported Node.js version to 14 (#43315) @Janpot
54
+ - [core] Use fs instead of fs-extra in script utils (#43234) @DiegoAndai
55
+ - [core] Refactor system theme props (#43120) @romgrk
56
+ - [docs-infra] Fix some TS issues for X docs (#43285) @Janpot
57
+ - [docs-infra] Move API pages to TS (#43199) @alexfauquette
58
+ - [docs-infra] Fix broken sandboxes with relative module imports (#42767) @bharatkashyap
59
+ - [docs-infra] Simplify API sections typing (#43128) @alexfauquette
60
+ - [examples] Fix import (#43316) @aarongarciah
61
+ - [examples] Add material-ui-pigment-css for Next.js and Vite (#43065) @siriwatknp
62
+ - [examples] Replace wrong import with `@mui/material/styles` (#43236) @siriwatknp
63
+ - [useMediaQuery] Adapt test implementation for React 19 (#43269) @aarongarciah
64
+ - [test] Update `matchMedia` mocks (#43240) @cherniavskii
65
+ - [test] Remove unnecessary ref param (#43282) @aarongarciah
66
+ - [website] Update showcase to include Toolpad Core (#43226) @bharatkashyap
67
+ - [website] Replace React.MutableRefObject with React.RefObject (#43284) @aarongarciah
68
+
69
+ All contributors of this release in alphabetical order: @aarongarciah, @alexfauquette, @anle9650, @bharatkashyap, @cherniavskii, @DiegoAndai, @Janpot, @Jay-Karia, @jlewins, @mnajdova, @oliviertassinari, @pluvio72, @renovate[bot], @romgrk, @sai6855, @samuelsycamore, @siriwatknp, @ZeeshanTamboli
70
+
3
71
  ## 6.0.0-beta.5
4
72
 
5
73
  <!-- generated comparing v6.0.0-beta.4..next -->
@@ -1842,6 +1910,7 @@ This release was mostly about 🐛 bug fixes and 📚 documentation improvements
1842
1910
  - [core] Fix TypeScript spelling in changelog @oliviertassinari
1843
1911
  - [core] Fix small detail in the autocomplete demo @oliviertassinari
1844
1912
  - [core] Increase node memory limit on Netlify build (#41111) @michaldudak
1913
+ - [core] Fix Netlify build cache issue (#43281) @LukasTy
1845
1914
  - [core][Tooltip] Remove incorrect code comment (#41179) @ZeeshanTamboli
1846
1915
  - [core] Fix missing context display names (#41168) @oliviertassinari
1847
1916
  - [core][base-ui] Remove `@mui/base` dev dependency from Base UI workspace (#41216) @ZeeshanTamboli
@@ -4,7 +4,7 @@ import * as React from 'react';
4
4
  import PropTypes from 'prop-types';
5
5
  import clsx from 'clsx';
6
6
  import composeClasses from '@mui/utils/composeClasses';
7
- import Typography from '../Typography';
7
+ import Typography, { typographyClasses } from '../Typography';
8
8
  import { styled } from '../zero-styled';
9
9
  import { useDefaultProps } from '../DefaultPropsProvider';
10
10
  import cardHeaderClasses, { getCardHeaderUtilityClass } from './cardHeaderClasses';
@@ -61,7 +61,13 @@ const CardHeaderContent = styled('div', {
61
61
  slot: 'Content',
62
62
  overridesResolver: (props, styles) => styles.content
63
63
  })({
64
- flex: '1 1 auto'
64
+ flex: '1 1 auto',
65
+ [`.${typographyClasses.root}:where(& .${cardHeaderClasses.title})`]: {
66
+ display: 'block'
67
+ },
68
+ [`.${typographyClasses.root}:where(& .${cardHeaderClasses.subheader})`]: {
69
+ display: 'block'
70
+ }
65
71
  });
66
72
  const CardHeader = /*#__PURE__*/React.forwardRef(function CardHeader(inProps, ref) {
67
73
  const props = useDefaultProps({
@@ -92,7 +98,6 @@ const CardHeader = /*#__PURE__*/React.forwardRef(function CardHeader(inProps, re
92
98
  variant: avatar ? 'body2' : 'h5',
93
99
  className: classes.title,
94
100
  component: "span",
95
- display: "block",
96
101
  ...titleTypographyProps,
97
102
  children: title
98
103
  });
@@ -102,9 +107,8 @@ const CardHeader = /*#__PURE__*/React.forwardRef(function CardHeader(inProps, re
102
107
  subheader = /*#__PURE__*/_jsx(Typography, {
103
108
  variant: avatar ? 'body2' : 'body1',
104
109
  className: classes.subheader,
105
- color: "text.secondary",
110
+ color: "textSecondary",
106
111
  component: "span",
107
- display: "block",
108
112
  ...subheaderTypographyProps,
109
113
  children: subheader
110
114
  });
@@ -44,7 +44,7 @@ const DialogContentText = /*#__PURE__*/React.forwardRef(function DialogContentTe
44
44
  return /*#__PURE__*/_jsx(DialogContentTextRoot, {
45
45
  component: "p",
46
46
  variant: "body1",
47
- color: "text.secondary",
47
+ color: "textSecondary",
48
48
  ref: ref,
49
49
  ownerState: ownerState,
50
50
  className: clsx(classes.root, className),
@@ -203,10 +203,10 @@ const Divider = /*#__PURE__*/React.forwardRef(function Divider(inProps, ref) {
203
203
  absolute = false,
204
204
  children,
205
205
  className,
206
- component = children ? 'div' : 'hr',
206
+ orientation = 'horizontal',
207
+ component = children || orientation === 'vertical' ? 'div' : 'hr',
207
208
  flexItem = false,
208
209
  light = false,
209
- orientation = 'horizontal',
210
210
  role = component !== 'hr' ? 'separator' : undefined,
211
211
  textAlign = 'center',
212
212
  variant = 'fullWidth',
@@ -230,6 +230,7 @@ const Divider = /*#__PURE__*/React.forwardRef(function Divider(inProps, ref) {
230
230
  role: role,
231
231
  ref: ref,
232
232
  ownerState: ownerState,
233
+ "aria-orientation": role === 'separator' && (component !== 'hr' || orientation === 'vertical') ? orientation : undefined,
233
234
  ...other,
234
235
  children: children ? /*#__PURE__*/_jsx(DividerWrapper, {
235
236
  className: classes.wrapper,
@@ -8,7 +8,6 @@ import composeClasses from '@mui/utils/composeClasses';
8
8
  import { useFormControl } from '../FormControl';
9
9
  import { styled } from '../zero-styled';
10
10
  import { useDefaultProps } from '../DefaultPropsProvider';
11
- import Stack from '../Stack';
12
11
  import Typography from '../Typography';
13
12
  import capitalize from '../utils/capitalize';
14
13
  import formControlLabelClasses, { getFormControlLabelUtilityClasses } from './formControlLabelClasses';
@@ -182,8 +181,7 @@ const FormControlLabel = /*#__PURE__*/React.forwardRef(function FormControlLabel
182
181
  ownerState: ownerState,
183
182
  ref: ref,
184
183
  ...other,
185
- children: [/*#__PURE__*/React.cloneElement(control, controlProps), required ? /*#__PURE__*/_jsxs(Stack, {
186
- display: "block",
184
+ children: [/*#__PURE__*/React.cloneElement(control, controlProps), required ? /*#__PURE__*/_jsxs("div", {
187
185
  children: [label, /*#__PURE__*/_jsxs(AsteriskComponent, {
188
186
  ownerState: ownerState,
189
187
  "aria-hidden": true,
@@ -164,6 +164,7 @@ const IconButton = /*#__PURE__*/React.forwardRef(function IconButton(inProps, re
164
164
  color = 'default',
165
165
  disabled = false,
166
166
  disableFocusRipple = false,
167
+ disableRipple = false,
167
168
  size = 'medium',
168
169
  ...other
169
170
  } = props;
@@ -173,6 +174,7 @@ const IconButton = /*#__PURE__*/React.forwardRef(function IconButton(inProps, re
173
174
  color,
174
175
  disabled,
175
176
  disableFocusRipple,
177
+ disableRipple,
176
178
  size
177
179
  };
178
180
  const classes = useUtilityClasses(ownerState);
@@ -181,6 +183,7 @@ const IconButton = /*#__PURE__*/React.forwardRef(function IconButton(inProps, re
181
183
  centerRipple: true,
182
184
  focusRipple: !disableFocusRipple,
183
185
  disabled: disabled,
186
+ disableRipple: disableRipple,
184
187
  ref: ref,
185
188
  ...other,
186
189
  ownerState: ownerState,
@@ -122,7 +122,7 @@ const InputAdornment = /*#__PURE__*/React.forwardRef(function InputAdornment(inP
122
122
  ref: ref,
123
123
  ...other,
124
124
  children: typeof children === 'string' && !disableTypography ? /*#__PURE__*/_jsx(Typography, {
125
- color: "text.secondary",
125
+ color: "textSecondary",
126
126
  children: children
127
127
  }) : /*#__PURE__*/_jsxs(React.Fragment, {
128
128
  children: [position === 'start' ? ( /* notranslate needed while Google Translate will not fix zero-width space issue */_span || (_span = /*#__PURE__*/_jsx("span", {
package/Link/Link.js CHANGED
@@ -12,8 +12,19 @@ import { styled, useTheme } from '../zero-styled';
12
12
  import { useDefaultProps } from '../DefaultPropsProvider';
13
13
  import Typography from '../Typography';
14
14
  import linkClasses, { getLinkUtilityClass } from './linkClasses';
15
- import getTextDecoration, { colorTransformations } from './getTextDecoration';
15
+ import getTextDecoration from './getTextDecoration';
16
16
  import { jsx as _jsx } from "react/jsx-runtime";
17
+ const v6Colors = {
18
+ primary: true,
19
+ secondary: true,
20
+ error: true,
21
+ info: true,
22
+ success: true,
23
+ warning: true,
24
+ textPrimary: true,
25
+ textSecondary: true,
26
+ textDisabled: true
27
+ };
17
28
  const useUtilityClasses = ownerState => {
18
29
  const {
19
30
  classes,
@@ -83,6 +94,30 @@ const LinkRoot = styled(Typography, {
83
94
  '--Link-underlineColor': theme.vars ? `rgba(${theme.vars.palette[color].mainChannel} / 0.4)` : alpha(theme.palette[color].main, 0.4)
84
95
  }
85
96
  })), {
97
+ props: {
98
+ underline: 'always',
99
+ color: 'textPrimary'
100
+ },
101
+ style: {
102
+ '--Link-underlineColor': theme.vars ? `rgba(${theme.vars.palette.text.primaryChannel} / 0.4)` : alpha(theme.palette.text.primary, 0.4)
103
+ }
104
+ }, {
105
+ props: {
106
+ underline: 'always',
107
+ color: 'textSecondary'
108
+ },
109
+ style: {
110
+ '--Link-underlineColor': theme.vars ? `rgba(${theme.vars.palette.text.secondaryChannel} / 0.4)` : alpha(theme.palette.text.secondary, 0.4)
111
+ }
112
+ }, {
113
+ props: {
114
+ underline: 'always',
115
+ color: 'textDisabled'
116
+ },
117
+ style: {
118
+ '--Link-underlineColor': (theme.vars || theme).palette.text.disabled
119
+ }
120
+ }, {
86
121
  props: {
87
122
  component: 'button'
88
123
  },
@@ -171,12 +206,12 @@ const Link = /*#__PURE__*/React.forwardRef(function Link(inProps, ref) {
171
206
  ownerState: ownerState,
172
207
  variant: variant,
173
208
  ...other,
174
- sx: [...(colorTransformations[color] === undefined ? [{
209
+ sx: [...(v6Colors[color] === undefined ? [{
175
210
  color
176
211
  }] : []), ...(Array.isArray(sx) ? sx : [sx])],
177
212
  style: {
178
213
  ...other.style,
179
- ...(underline === 'always' && color !== 'inherit' && {
214
+ ...(underline === 'always' && color !== 'inherit' && !v6Colors[color] && {
180
215
  '--Link-underlineColor': getTextDecoration({
181
216
  theme,
182
217
  ownerState
@@ -206,7 +241,7 @@ process.env.NODE_ENV !== "production" ? Link.propTypes /* remove-proptypes */ =
206
241
  * The color of the link.
207
242
  * @default 'primary'
208
243
  */
209
- color: PropTypes /* @typescript-to-proptypes-ignore */.any,
244
+ color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['primary', 'secondary', 'success', 'error', 'info', 'warning', 'textPrimary', 'textSecondary', 'textDisabled']), PropTypes.string]),
210
245
  /**
211
246
  * The component used for the root node.
212
247
  * Either a string to use a HTML element or a component.
@@ -1,9 +1,8 @@
1
1
  import type { Theme } from '../styles';
2
- export declare const colorTransformations: Record<string, string | null | undefined>;
3
2
  declare const getTextDecoration: <T extends Theme>({ theme, ownerState, }: {
4
3
  theme: T;
5
4
  ownerState: {
6
5
  color: string;
7
6
  };
8
- }) => string | null;
7
+ }) => string;
9
8
  export default getTextDecoration;
@@ -1,28 +1,10 @@
1
1
  import { getPath } from '@mui/system/style';
2
2
  import { alpha } from '@mui/system/colorManipulator';
3
- // TODO v7: remove this transformation
4
- export const colorTransformations = {
5
- textPrimary: 'text.primary',
6
- textSecondary: 'text.secondary',
7
- // For main palette, the color will be applied by the styles above.
8
- primary: null,
9
- secondary: null,
10
- error: null,
11
- info: null,
12
- success: null,
13
- warning: null
14
- };
15
3
  const getTextDecoration = ({
16
4
  theme,
17
5
  ownerState
18
6
  }) => {
19
- let transformedColor = colorTransformations[ownerState.color];
20
- if (transformedColor === null) {
21
- return null;
22
- }
23
- if (transformedColor === undefined) {
24
- transformedColor = ownerState.color;
25
- }
7
+ const transformedColor = ownerState.color;
26
8
  const color = getPath(theme, `palette.${transformedColor}`, false) || ownerState.color;
27
9
  const channelColor = getPath(theme, `palette.${transformedColor}Channel`);
28
10
  if ('vars' in theme && channelColor) {
@@ -4,7 +4,7 @@ import * as React from 'react';
4
4
  import PropTypes from 'prop-types';
5
5
  import clsx from 'clsx';
6
6
  import composeClasses from '@mui/utils/composeClasses';
7
- import Typography from '../Typography';
7
+ import Typography, { typographyClasses } from '../Typography';
8
8
  import ListContext from '../List/ListContext';
9
9
  import { styled } from '../zero-styled';
10
10
  import { useDefaultProps } from '../DefaultPropsProvider';
@@ -43,6 +43,12 @@ const ListItemTextRoot = styled('div', {
43
43
  minWidth: 0,
44
44
  marginTop: 4,
45
45
  marginBottom: 4,
46
+ [`.${typographyClasses.root}:where(& .${listItemTextClasses.primary})`]: {
47
+ display: 'block'
48
+ },
49
+ [`.${typographyClasses.root}:where(& .${listItemTextClasses.secondary})`]: {
50
+ display: 'block'
51
+ },
46
52
  variants: [{
47
53
  props: ({
48
54
  ownerState
@@ -95,7 +101,6 @@ const ListItemText = /*#__PURE__*/React.forwardRef(function ListItemText(inProps
95
101
  variant: dense ? 'body2' : 'body1',
96
102
  className: classes.primary,
97
103
  component: primaryTypographyProps?.variant ? undefined : 'span',
98
- display: "block",
99
104
  ...primaryTypographyProps,
100
105
  children: primary
101
106
  });
@@ -104,8 +109,7 @@ const ListItemText = /*#__PURE__*/React.forwardRef(function ListItemText(inProps
104
109
  secondary = /*#__PURE__*/_jsx(Typography, {
105
110
  variant: "body2",
106
111
  className: classes.secondary,
107
- color: "text.secondary",
108
- display: "block",
112
+ color: "textSecondary",
109
113
  ...secondaryTypographyProps,
110
114
  children: secondary
111
115
  });
@@ -177,7 +177,7 @@ export function useSlider(parameters) {
177
177
  tabIndex,
178
178
  value: valueProp
179
179
  } = parameters;
180
- const touchId = React.useRef();
180
+ const touchId = React.useRef(undefined);
181
181
  // We can't use the :active browser pseudo-classes.
182
182
  // - The active state isn't triggered when clicking on the rail.
183
183
  // - The active state isn't transferred when inversing a range slider.
@@ -215,7 +215,7 @@ export function useSlider(parameters) {
215
215
  })) : marksProp || [];
216
216
  const marksValues = marks.map(mark => mark.value);
217
217
  const [focusedThumbIndex, setFocusedThumbIndex] = React.useState(-1);
218
- const sliderRef = React.useRef();
218
+ const sliderRef = React.useRef(null);
219
219
  const handleRef = useForkRef(ref, sliderRef);
220
220
  const createHandleHiddenInputFocus = otherHandlers => event => {
221
221
  const index = Number(event.currentTarget.getAttribute('data-index'));
@@ -318,7 +318,7 @@ export function useSlider(parameters) {
318
318
  // @ts-ignore
319
319
  changeValue(event, event.target.valueAsNumber);
320
320
  };
321
- const previousIndex = React.useRef();
321
+ const previousIndex = React.useRef(undefined);
322
322
  let axis = orientation;
323
323
  if (isRtl && orientation === 'horizontal') {
324
324
  axis += '-reverse';
@@ -1,14 +1,16 @@
1
1
  import * as React from 'react';
2
2
  import { OverridableStringUnion } from '@mui/types';
3
3
  import { SxProps, SystemProps } from '@mui/system';
4
- import { Theme } from '../styles';
4
+ import { Theme, TypeText } from '../styles';
5
5
  import { OverrideProps, OverridableComponent } from '../OverridableComponent';
6
6
  import { Variant } from '../styles/createTypography';
7
7
  import { TypographyClasses } from './typographyClasses';
8
8
 
9
9
  export interface TypographyPropsVariantOverrides {}
10
10
 
11
- export interface TypographyOwnProps extends SystemProps<Theme> {
11
+ export interface TypographyPropsColorOverrides {}
12
+
13
+ export interface TypographyOwnProps extends Omit<SystemProps<Theme>, 'color'> {
12
14
  /**
13
15
  * Set the text-align on the component.
14
16
  * @default 'inherit'
@@ -22,6 +24,23 @@ export interface TypographyOwnProps extends SystemProps<Theme> {
22
24
  * Override or extend the styles applied to the component.
23
25
  */
24
26
  classes?: Partial<TypographyClasses>;
27
+ /**
28
+ * The color of the component.
29
+ * It supports both default and custom theme colors, which can be added as shown in the
30
+ * [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
31
+ */
32
+ color?:
33
+ | OverridableStringUnion<
34
+ | 'primary'
35
+ | 'secondary'
36
+ | 'success'
37
+ | 'error'
38
+ | 'info'
39
+ | 'warning'
40
+ | `text${Capitalize<keyof TypeText>}`,
41
+ TypographyPropsColorOverrides
42
+ >
43
+ | (string & {}); // to work with v5 color prop type which allows any string
25
44
  /**
26
45
  * If `true`, the text will have a bottom margin.
27
46
  * @default false
@@ -9,6 +9,17 @@ import { useDefaultProps } from '../DefaultPropsProvider';
9
9
  import capitalize from '../utils/capitalize';
10
10
  import { getTypographyUtilityClass } from './typographyClasses';
11
11
  import { jsx as _jsx } from "react/jsx-runtime";
12
+ const v6Colors = {
13
+ primary: true,
14
+ secondary: true,
15
+ error: true,
16
+ info: true,
17
+ success: true,
18
+ warning: true,
19
+ textPrimary: true,
20
+ textSecondary: true,
21
+ textDisabled: true
22
+ };
12
23
  const extendSxProp = internal_createExtendSxProp();
13
24
  const useUtilityClasses = ownerState => {
14
25
  const {
@@ -59,6 +70,13 @@ export const TypographyRoot = styled('span', {
59
70
  style: {
60
71
  color: (theme.vars || theme).palette[color].main
61
72
  }
73
+ })), ...Object.entries(theme.palette?.text || {}).filter(([, value]) => typeof value === 'string').map(([color]) => ({
74
+ props: {
75
+ color: `text${capitalize(color)}`
76
+ },
77
+ style: {
78
+ color: (theme.vars || theme).palette.text[color]
79
+ }
62
80
  })), {
63
81
  props: ({
64
82
  ownerState
@@ -104,19 +122,6 @@ const defaultVariantMapping = {
104
122
  body2: 'p',
105
123
  inherit: 'p'
106
124
  };
107
-
108
- // TODO v7: remove this transformation and `extendSxProp`
109
- const colorTransformations = {
110
- textPrimary: 'text.primary',
111
- textSecondary: 'text.secondary',
112
- // For the main palette, the color will be applied by the `...Object.entries(theme.palette)` clause in the TypographyRoot's styles
113
- primary: null,
114
- secondary: null,
115
- error: null,
116
- info: null,
117
- success: null,
118
- warning: null
119
- };
120
125
  const Typography = /*#__PURE__*/React.forwardRef(function Typography(inProps, ref) {
121
126
  const {
122
127
  color,
@@ -125,11 +130,12 @@ const Typography = /*#__PURE__*/React.forwardRef(function Typography(inProps, re
125
130
  props: inProps,
126
131
  name: 'MuiTypography'
127
132
  });
128
- const textColor = colorTransformations[color];
133
+ const isSxColor = !v6Colors[color];
134
+ // TODO: Remove `extendSxProp` in v7
129
135
  const props = extendSxProp({
130
136
  ...themeProps,
131
- ...(textColor !== null && {
132
- color: textColor || color
137
+ ...(isSxColor && {
138
+ color
133
139
  })
134
140
  });
135
141
  const {
@@ -193,6 +199,12 @@ process.env.NODE_ENV !== "production" ? Typography.propTypes /* remove-proptypes
193
199
  * @ignore
194
200
  */
195
201
  className: PropTypes.string,
202
+ /**
203
+ * The color of the component.
204
+ * It supports both default and custom theme colors, which can be added as shown in the
205
+ * [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
206
+ */
207
+ color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['primary', 'secondary', 'success', 'error', 'info', 'warning', 'textPrimary', 'textSecondary', 'textDisabled']), PropTypes.string]),
196
208
  /**
197
209
  * The component used for the root node.
198
210
  * Either a string to use a HTML element or a component.
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/material v6.0.0-beta.5
2
+ * @mui/material v6.0.0-beta.6
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -1082,7 +1082,7 @@ process.env.NODE_ENV !== "production" ? Autocomplete.propTypes /* remove-proptyp
1082
1082
  */
1083
1083
  openText: PropTypes.string,
1084
1084
  /**
1085
- * Array of options.
1085
+ * A list of options that will be shown in the Autocomplete.
1086
1086
  */
1087
1087
  options: PropTypes.array.isRequired,
1088
1088
  /**
@@ -154,7 +154,7 @@ const Breadcrumbs = /*#__PURE__*/React.forwardRef(function Breadcrumbs(inProps,
154
154
  return /*#__PURE__*/_jsx(BreadcrumbsRoot, {
155
155
  ref: ref,
156
156
  component: component,
157
- color: "text.secondary",
157
+ color: "textSecondary",
158
158
  className: clsx(classes.root, className),
159
159
  ownerState: ownerState,
160
160
  ...other,
@@ -4,7 +4,7 @@ import * as React from 'react';
4
4
  import PropTypes from 'prop-types';
5
5
  import clsx from 'clsx';
6
6
  import composeClasses from '@mui/utils/composeClasses';
7
- import Typography from '../Typography';
7
+ import Typography, { typographyClasses } from '../Typography';
8
8
  import { styled } from '../zero-styled';
9
9
  import { useDefaultProps } from '../DefaultPropsProvider';
10
10
  import cardHeaderClasses, { getCardHeaderUtilityClass } from './cardHeaderClasses';
@@ -61,7 +61,13 @@ const CardHeaderContent = styled('div', {
61
61
  slot: 'Content',
62
62
  overridesResolver: (props, styles) => styles.content
63
63
  })({
64
- flex: '1 1 auto'
64
+ flex: '1 1 auto',
65
+ [`.${typographyClasses.root}:where(& .${cardHeaderClasses.title})`]: {
66
+ display: 'block'
67
+ },
68
+ [`.${typographyClasses.root}:where(& .${cardHeaderClasses.subheader})`]: {
69
+ display: 'block'
70
+ }
65
71
  });
66
72
  const CardHeader = /*#__PURE__*/React.forwardRef(function CardHeader(inProps, ref) {
67
73
  const props = useDefaultProps({
@@ -92,7 +98,6 @@ const CardHeader = /*#__PURE__*/React.forwardRef(function CardHeader(inProps, re
92
98
  variant: avatar ? 'body2' : 'h5',
93
99
  className: classes.title,
94
100
  component: "span",
95
- display: "block",
96
101
  ...titleTypographyProps,
97
102
  children: title
98
103
  });
@@ -102,9 +107,8 @@ const CardHeader = /*#__PURE__*/React.forwardRef(function CardHeader(inProps, re
102
107
  subheader = /*#__PURE__*/_jsx(Typography, {
103
108
  variant: avatar ? 'body2' : 'body1',
104
109
  className: classes.subheader,
105
- color: "text.secondary",
110
+ color: "textSecondary",
106
111
  component: "span",
107
- display: "block",
108
112
  ...subheaderTypographyProps,
109
113
  children: subheader
110
114
  });
@@ -44,7 +44,7 @@ const DialogContentText = /*#__PURE__*/React.forwardRef(function DialogContentTe
44
44
  return /*#__PURE__*/_jsx(DialogContentTextRoot, {
45
45
  component: "p",
46
46
  variant: "body1",
47
- color: "text.secondary",
47
+ color: "textSecondary",
48
48
  ref: ref,
49
49
  ownerState: ownerState,
50
50
  className: clsx(classes.root, className),
@@ -203,10 +203,10 @@ const Divider = /*#__PURE__*/React.forwardRef(function Divider(inProps, ref) {
203
203
  absolute = false,
204
204
  children,
205
205
  className,
206
- component = children ? 'div' : 'hr',
206
+ orientation = 'horizontal',
207
+ component = children || orientation === 'vertical' ? 'div' : 'hr',
207
208
  flexItem = false,
208
209
  light = false,
209
- orientation = 'horizontal',
210
210
  role = component !== 'hr' ? 'separator' : undefined,
211
211
  textAlign = 'center',
212
212
  variant = 'fullWidth',
@@ -230,6 +230,7 @@ const Divider = /*#__PURE__*/React.forwardRef(function Divider(inProps, ref) {
230
230
  role: role,
231
231
  ref: ref,
232
232
  ownerState: ownerState,
233
+ "aria-orientation": role === 'separator' && (component !== 'hr' || orientation === 'vertical') ? orientation : undefined,
233
234
  ...other,
234
235
  children: children ? /*#__PURE__*/_jsx(DividerWrapper, {
235
236
  className: classes.wrapper,
@@ -8,7 +8,6 @@ import composeClasses from '@mui/utils/composeClasses';
8
8
  import { useFormControl } from '../FormControl';
9
9
  import { styled } from '../zero-styled';
10
10
  import { useDefaultProps } from '../DefaultPropsProvider';
11
- import Stack from '../Stack';
12
11
  import Typography from '../Typography';
13
12
  import capitalize from '../utils/capitalize';
14
13
  import formControlLabelClasses, { getFormControlLabelUtilityClasses } from './formControlLabelClasses';
@@ -182,8 +181,7 @@ const FormControlLabel = /*#__PURE__*/React.forwardRef(function FormControlLabel
182
181
  ownerState: ownerState,
183
182
  ref: ref,
184
183
  ...other,
185
- children: [/*#__PURE__*/React.cloneElement(control, controlProps), required ? /*#__PURE__*/_jsxs(Stack, {
186
- display: "block",
184
+ children: [/*#__PURE__*/React.cloneElement(control, controlProps), required ? /*#__PURE__*/_jsxs("div", {
187
185
  children: [label, /*#__PURE__*/_jsxs(AsteriskComponent, {
188
186
  ownerState: ownerState,
189
187
  "aria-hidden": true,