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

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/CHANGELOG.md CHANGED
@@ -1,5 +1,43 @@
1
1
  # [Versions](https://mui.com/versions/)
2
2
 
3
+ ## v6.0.0-alpha.5
4
+
5
+ <!-- generated comparing v6.0.0-alpha.4..next -->
6
+
7
+ _May 1, 2024_
8
+
9
+ A big thanks to the 9 contributors who made this release possible. Here are some highlights ✨:
10
+
11
+ ### `@mui/material@6.0.0-alpha.5`
12
+
13
+ - [FormControlLabel] Deprecate `componentsProps` (#41767) @sai6855
14
+ - [PaginationItem] Deprecate components prop (#41777) @sai6855
15
+ - [SvgIcon] Convert to support CSS extraction (#41779) @aarongarciah
16
+
17
+ ### `@mui/base@5.0.0-beta.43`
18
+
19
+ - [TextareaAutosize] Fix resizing instability (#41638) @ZeeshanTamboli
20
+
21
+ ### Docs
22
+
23
+ - Fix small SEO issues @oliviertassinari
24
+ - [material-ui] Fix minor spelling error in the "About the lab" page (#42073) @ryanhartwig
25
+ - [material-ui] Update Figma plugin name (#41967) @danilo-leal
26
+ - [material-ui][templates] Fix input props attributes in Landing Page template (#42013) @5-tom
27
+ - [system] Update typo on the sx prop page (#42035) @bricker
28
+
29
+ ### Core
30
+
31
+ - [docs-infra] Clean up branding theme file and improve font-face readibility (#42023) @danilo-leal
32
+ - [docs-infra] Simplify docs demo (#42016) @oliviertassinari
33
+ - [website] Add content about the Sync plugin in the Material UI page (#40515) @danilo-leal
34
+ - [website] Sync career roles (#42058) @oliviertassinari
35
+ - [website] Add Nadja on the about page (#42021) @mnajdova
36
+ - [website] Fix code block design by changing the `MarkdownElement` import (#42022) @danilo-leal
37
+ - [wesbite] Remove duplicate MarkdownElement component (#42028) @danilo-leal
38
+
39
+ All contributors of this release in alphabetical order: @5-tom, @aarongarciah, @bricker, @danilo-leal, @mnajdova, @oliviertassinari, @ryanhartwig, @sai6855, @ZeeshanTamboli
40
+
3
41
  ## v6.0.0-alpha.4
4
42
 
5
43
  <!-- generated comparing v6.0.0-alpha.3..next -->
@@ -1,11 +1,29 @@
1
1
  import * as React from 'react';
2
2
  import { SxProps } from '@mui/system';
3
3
  import { Theme, InternalStandardProps as StandardProps } from '..';
4
- import { TypographyProps } from '../Typography';
4
+ import Typography, { TypographyProps } from '../Typography';
5
5
  import { FormControlLabelClasses } from './formControlLabelClasses';
6
+ import { CreateSlotsAndSlotProps, SlotProps } from '../utils/types';
7
+
8
+ export interface FormControlLabelSlots {
9
+ /**
10
+ * The component that renders the label.
11
+ * This is unused if `disableTypography` is true.
12
+ * @default Typography
13
+ */
14
+ typography?: React.ElementType;
15
+ }
16
+
17
+ export type FormControlLabelSlotsAndSlotProps = CreateSlotsAndSlotProps<
18
+ FormControlLabelSlots,
19
+ {
20
+ typography: SlotProps<typeof Typography, {}, FormControlLabelProps>;
21
+ }
22
+ >;
6
23
 
7
24
  export interface FormControlLabelProps
8
- extends StandardProps<React.LabelHTMLAttributes<HTMLLabelElement>, 'children' | 'onChange'> {
25
+ extends StandardProps<React.LabelHTMLAttributes<HTMLLabelElement>, 'children' | 'onChange'>,
26
+ FormControlLabelSlotsAndSlotProps {
9
27
  /**
10
28
  * If `true`, the component appears selected.
11
29
  */
@@ -17,6 +35,7 @@ export interface FormControlLabelProps
17
35
  /**
18
36
  * The props used for each slot inside.
19
37
  * @default {}
38
+ * @deprecated use the `slotProps` prop instead. This prop will be removed in v7. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/).
20
39
  */
21
40
  componentsProps?: {
22
41
  /**
@@ -63,18 +82,6 @@ export interface FormControlLabelProps
63
82
  * If `true`, the label will indicate that the `input` is required.
64
83
  */
65
84
  required?: boolean;
66
- /**
67
- * The props used for each slot inside.
68
- * @default {}
69
- */
70
- slotProps?: {
71
- /**
72
- * Props applied to the Typography wrapper of the passed label.
73
- * This is unused if disableTypography is true.
74
- * @default {}
75
- */
76
- typography?: TypographyProps;
77
- };
78
85
  /**
79
86
  * The system prop that allows defining system overrides as well as additional CSS styles.
80
87
  */
@@ -2,7 +2,7 @@
2
2
 
3
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
5
- const _excluded = ["checked", "className", "componentsProps", "control", "disabled", "disableTypography", "inputRef", "label", "labelPlacement", "name", "onChange", "required", "slotProps", "value"];
5
+ const _excluded = ["checked", "className", "componentsProps", "control", "disabled", "disableTypography", "inputRef", "label", "labelPlacement", "name", "onChange", "required", "slots", "slotProps", "value"];
6
6
  import * as React from 'react';
7
7
  import PropTypes from 'prop-types';
8
8
  import clsx from 'clsx';
@@ -15,6 +15,7 @@ import Typography from '../Typography';
15
15
  import capitalize from '../utils/capitalize';
16
16
  import formControlLabelClasses, { getFormControlLabelUtilityClasses } from './formControlLabelClasses';
17
17
  import formControlState from '../FormControl/formControlState';
18
+ import useSlot from '../utils/useSlot';
18
19
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
19
20
  const useThemeProps = createUseThemeProps('MuiFormControlLabel');
20
21
  const useUtilityClasses = ownerState => {
@@ -124,6 +125,7 @@ const FormControlLabel = /*#__PURE__*/React.forwardRef(function FormControlLabel
124
125
  label: labelProp,
125
126
  labelPlacement = 'end',
126
127
  required: requiredProp,
128
+ slots = {},
127
129
  slotProps = {}
128
130
  } = props,
129
131
  other = _objectWithoutPropertiesLoose(props, _excluded);
@@ -151,10 +153,18 @@ const FormControlLabel = /*#__PURE__*/React.forwardRef(function FormControlLabel
151
153
  error: fcs.error
152
154
  });
153
155
  const classes = useUtilityClasses(ownerState);
154
- const typographySlotProps = slotProps.typography ?? componentsProps.typography;
156
+ const externalForwardedProps = {
157
+ slots,
158
+ slotProps: _extends({}, componentsProps, slotProps)
159
+ };
160
+ const [TypographySlot, typographySlotProps] = useSlot('typography', {
161
+ elementType: Typography,
162
+ externalForwardedProps,
163
+ ownerState
164
+ });
155
165
  let label = labelProp;
156
166
  if (label != null && label.type !== Typography && !disableTypography) {
157
- label = /*#__PURE__*/_jsx(Typography, _extends({
167
+ label = /*#__PURE__*/_jsx(TypographySlot, _extends({
158
168
  component: "span"
159
169
  }, typographySlotProps, {
160
170
  className: clsx(classes.label, typographySlotProps?.className),
@@ -197,6 +207,7 @@ process.env.NODE_ENV !== "production" ? FormControlLabel.propTypes /* remove-pro
197
207
  /**
198
208
  * The props used for each slot inside.
199
209
  * @default {}
210
+ * @deprecated use the `slotProps` prop instead. This prop will be removed in v7. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/).
200
211
  */
201
212
  componentsProps: PropTypes.shape({
202
213
  typography: PropTypes.object
@@ -246,7 +257,14 @@ process.env.NODE_ENV !== "production" ? FormControlLabel.propTypes /* remove-pro
246
257
  * @default {}
247
258
  */
248
259
  slotProps: PropTypes.shape({
249
- typography: PropTypes.object
260
+ typography: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
261
+ }),
262
+ /**
263
+ * The components used for each slot inside.
264
+ * @default {}
265
+ */
266
+ slots: PropTypes.shape({
267
+ typography: PropTypes.elementType
250
268
  }),
251
269
  /**
252
270
  * The system prop that allows defining system overrides as well as additional CSS styles.
@@ -5,6 +5,7 @@ import { OverridableComponent, OverrideProps } from '@mui/material/OverridableCo
5
5
  import { Theme } from '../styles';
6
6
  import { UsePaginationItem } from '../usePagination/usePagination';
7
7
  import { PaginationItemClasses } from './paginationItemClasses';
8
+ import { CreateSlotsAndSlotProps, SlotProps } from '../utils/types';
8
9
 
9
10
  export interface PaginationItemPropsVariantOverrides {}
10
11
 
@@ -12,7 +13,30 @@ export interface PaginationItemPropsSizeOverrides {}
12
13
 
13
14
  export interface PaginationItemPropsColorOverrides {}
14
15
 
15
- export interface PaginationItemOwnProps {
16
+ export interface PaginationItemSlots {
17
+ first?: React.ElementType;
18
+ last?: React.ElementType;
19
+ next?: React.ElementType;
20
+ previous?: React.ElementType;
21
+ }
22
+
23
+ export type PaginationItemSlotsAndSlotProps = CreateSlotsAndSlotProps<
24
+ PaginationItemSlots,
25
+ {
26
+ first: SlotProps<React.ElementType<React.HTMLProps<HTMLElement>>, {}, PaginationItemOwnerState>;
27
+ last: SlotProps<React.ElementType<React.HTMLProps<HTMLElement>>, {}, PaginationItemOwnerState>;
28
+ next: SlotProps<React.ElementType<React.HTMLProps<HTMLElement>>, {}, PaginationItemOwnerState>;
29
+ previous: SlotProps<
30
+ React.ElementType<React.HTMLProps<HTMLElement>>,
31
+ {},
32
+ PaginationItemOwnerState
33
+ >;
34
+ }
35
+ >;
36
+
37
+ export interface PaginationItemOwnerState extends PaginationItemProps {}
38
+
39
+ export interface PaginationItemOwnProps extends PaginationItemSlotsAndSlotProps {
16
40
  /**
17
41
  * Override or extend the styles applied to the component.
18
42
  */
@@ -34,6 +58,7 @@ export interface PaginationItemOwnProps {
34
58
  * It's recommended to use the `slots` prop instead.
35
59
  *
36
60
  * @default {}
61
+ * @deprecated use the `slots` prop instead. This prop will be removed in v7. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/).
37
62
  */
38
63
  components?: {
39
64
  first?: React.ElementType;
@@ -65,19 +90,6 @@ export interface PaginationItemOwnProps {
65
90
  * @default 'medium'
66
91
  */
67
92
  size?: OverridableStringUnion<'small' | 'medium' | 'large', PaginationItemPropsSizeOverrides>;
68
- /**
69
- * The components used for each slot inside.
70
- *
71
- * This prop is an alias for the `components` prop, which will be deprecated in the future.
72
- *
73
- * @default {}
74
- */
75
- slots?: {
76
- first?: React.ElementType;
77
- last?: React.ElementType;
78
- next?: React.ElementType;
79
- previous?: React.ElementType;
80
- };
81
93
  /**
82
94
  * The system prop that allows defining system overrides as well as additional CSS styles.
83
95
  */
@@ -2,7 +2,7 @@
2
2
 
3
3
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
4
4
  import _extends from "@babel/runtime/helpers/esm/extends";
5
- const _excluded = ["className", "color", "component", "components", "disabled", "page", "selected", "shape", "size", "slots", "type", "variant"];
5
+ const _excluded = ["className", "color", "component", "components", "disabled", "page", "selected", "shape", "size", "slots", "slotProps", "type", "variant"];
6
6
  import * as React from 'react';
7
7
  import PropTypes from 'prop-types';
8
8
  import clsx from 'clsx';
@@ -16,6 +16,7 @@ import FirstPageIcon from '../internal/svg-icons/FirstPage';
16
16
  import LastPageIcon from '../internal/svg-icons/LastPage';
17
17
  import NavigateBeforeIcon from '../internal/svg-icons/NavigateBefore';
18
18
  import NavigateNextIcon from '../internal/svg-icons/NavigateNext';
19
+ import useSlot from '../utils/useSlot';
19
20
  import { styled, createUseThemeProps } from '../zero-styled';
20
21
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
21
22
  const useThemeProps = createUseThemeProps('MuiPaginationItem');
@@ -281,6 +282,7 @@ const PaginationItem = /*#__PURE__*/React.forwardRef(function PaginationItem(inP
281
282
  shape = 'circular',
282
283
  size = 'medium',
283
284
  slots = {},
285
+ slotProps = {},
284
286
  type = 'page',
285
287
  variant = 'text'
286
288
  } = props,
@@ -296,18 +298,53 @@ const PaginationItem = /*#__PURE__*/React.forwardRef(function PaginationItem(inP
296
298
  });
297
299
  const isRtl = useRtl();
298
300
  const classes = useUtilityClasses(ownerState);
299
- const normalizedIcons = isRtl ? {
300
- previous: slots.next || components.next || NavigateNextIcon,
301
- next: slots.previous || components.previous || NavigateBeforeIcon,
302
- last: slots.first || components.first || FirstPageIcon,
303
- first: slots.last || components.last || LastPageIcon
304
- } : {
305
- previous: slots.previous || components.previous || NavigateBeforeIcon,
306
- next: slots.next || components.next || NavigateNextIcon,
307
- first: slots.first || components.first || FirstPageIcon,
308
- last: slots.last || components.last || LastPageIcon
301
+ const externalForwardedProps = {
302
+ slots: {
303
+ previous: slots.previous ?? components.previous,
304
+ next: slots.next ?? components.next,
305
+ first: slots.first ?? components.first,
306
+ last: slots.last ?? components.last
307
+ },
308
+ slotProps
309
309
  };
310
- const Icon = normalizedIcons[type];
310
+ const [PreviousSlot, previousSlotProps] = useSlot('previous', {
311
+ elementType: NavigateBeforeIcon,
312
+ externalForwardedProps,
313
+ ownerState
314
+ });
315
+ const [NextSlot, nextSlotProps] = useSlot('next', {
316
+ elementType: NavigateNextIcon,
317
+ externalForwardedProps,
318
+ ownerState
319
+ });
320
+ const [FirstSlot, firstSlotProps] = useSlot('first', {
321
+ elementType: FirstPageIcon,
322
+ externalForwardedProps,
323
+ ownerState
324
+ });
325
+ const [LastSlot, lastSlotProps] = useSlot('last', {
326
+ elementType: LastPageIcon,
327
+ externalForwardedProps,
328
+ ownerState
329
+ });
330
+ const rtlAwareType = isRtl ? {
331
+ previous: 'next',
332
+ next: 'previous',
333
+ first: 'last',
334
+ last: 'first'
335
+ }[type] : type;
336
+ const IconSlot = {
337
+ previous: PreviousSlot,
338
+ next: NextSlot,
339
+ first: FirstSlot,
340
+ last: LastSlot
341
+ }[rtlAwareType];
342
+ const iconSlotProps = {
343
+ previous: previousSlotProps,
344
+ next: nextSlotProps,
345
+ first: firstSlotProps,
346
+ last: lastSlotProps
347
+ }[rtlAwareType];
311
348
  return type === 'start-ellipsis' || type === 'end-ellipsis' ? /*#__PURE__*/_jsx(PaginationItemEllipsis, {
312
349
  ref: ref,
313
350
  ownerState: ownerState,
@@ -320,11 +357,10 @@ const PaginationItem = /*#__PURE__*/React.forwardRef(function PaginationItem(inP
320
357
  disabled: disabled,
321
358
  className: clsx(classes.root, className)
322
359
  }, other, {
323
- children: [type === 'page' && page, Icon ? /*#__PURE__*/_jsx(PaginationItemPageIcon, {
324
- as: Icon,
325
- ownerState: ownerState,
326
- className: classes.icon
327
- }) : null]
360
+ children: [type === 'page' && page, IconSlot ? /*#__PURE__*/_jsx(PaginationItemPageIcon, _extends({}, iconSlotProps, {
361
+ className: classes.icon,
362
+ as: IconSlot
363
+ })) : null]
328
364
  }));
329
365
  });
330
366
  process.env.NODE_ENV !== "production" ? PaginationItem.propTypes /* remove-proptypes */ = {
@@ -363,6 +399,7 @@ process.env.NODE_ENV !== "production" ? PaginationItem.propTypes /* remove-propt
363
399
  * It's recommended to use the `slots` prop instead.
364
400
  *
365
401
  * @default {}
402
+ * @deprecated use the `slots` prop instead. This prop will be removed in v7. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/).
366
403
  */
367
404
  components: PropTypes.shape({
368
405
  first: PropTypes.elementType,
@@ -394,11 +431,18 @@ process.env.NODE_ENV !== "production" ? PaginationItem.propTypes /* remove-propt
394
431
  * @default 'medium'
395
432
  */
396
433
  size: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['small', 'medium', 'large']), PropTypes.string]),
434
+ /**
435
+ * The props used for each slot inside.
436
+ * @default {}
437
+ */
438
+ slotProps: PropTypes.shape({
439
+ first: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
440
+ last: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
441
+ next: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
442
+ previous: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
443
+ }),
397
444
  /**
398
445
  * The components used for each slot inside.
399
- *
400
- * This prop is an alias for the `components` prop, which will be deprecated in the future.
401
- *
402
446
  * @default {}
403
447
  */
404
448
  slots: PropTypes.shape({
@@ -8,10 +8,10 @@ import PropTypes from 'prop-types';
8
8
  import clsx from 'clsx';
9
9
  import composeClasses from '@mui/utils/composeClasses';
10
10
  import capitalize from '../utils/capitalize';
11
- import useThemeProps from '../styles/useThemeProps';
12
- import styled from '../styles/styled';
11
+ import { styled, createUseThemeProps } from '../zero-styled';
13
12
  import { getSvgIconUtilityClass } from './svgIconClasses';
14
13
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
+ const useThemeProps = createUseThemeProps('MuiSvgIcon');
15
15
  const useUtilityClasses = ownerState => {
16
16
  const {
17
17
  color,
@@ -33,32 +33,82 @@ const SvgIconRoot = styled('svg', {
33
33
  return [styles.root, ownerState.color !== 'inherit' && styles[`color${capitalize(ownerState.color)}`], styles[`fontSize${capitalize(ownerState.fontSize)}`]];
34
34
  }
35
35
  })(({
36
- theme,
37
- ownerState
36
+ theme
38
37
  }) => ({
39
38
  userSelect: 'none',
40
39
  width: '1em',
41
40
  height: '1em',
42
41
  display: 'inline-block',
43
- // the <svg> will define the property that has `currentColor`
44
- // for example heroicons uses fill="none" and stroke="currentColor"
45
- fill: ownerState.hasSvgAsChild ? undefined : 'currentColor',
46
42
  flexShrink: 0,
47
43
  transition: theme.transitions?.create?.('fill', {
48
- duration: theme.transitions?.duration?.shorter
44
+ duration: (theme.vars ?? theme).transitions?.duration?.shorter
49
45
  }),
50
- fontSize: {
51
- inherit: 'inherit',
52
- small: theme.typography?.pxToRem?.(20) || '1.25rem',
53
- medium: theme.typography?.pxToRem?.(24) || '1.5rem',
54
- large: theme.typography?.pxToRem?.(35) || '2.1875rem'
55
- }[ownerState.fontSize],
56
- // TODO v5 deprecate, v6 remove for sx
57
- color: (theme.vars || theme).palette?.[ownerState.color]?.main ?? {
58
- action: (theme.vars || theme).palette?.action?.active,
59
- disabled: (theme.vars || theme).palette?.action?.disabled,
60
- inherit: undefined
61
- }[ownerState.color]
46
+ variants: [{
47
+ props: props => !props.hasSvgAsChild,
48
+ style: {
49
+ // the <svg> will define the property that has `currentColor`
50
+ // for example heroicons uses fill="none" and stroke="currentColor"
51
+ fill: 'currentColor'
52
+ }
53
+ }, {
54
+ props: {
55
+ fontSize: 'inherit'
56
+ },
57
+ style: {
58
+ fontSize: 'inherit'
59
+ }
60
+ }, {
61
+ props: {
62
+ fontSize: 'small'
63
+ },
64
+ style: {
65
+ fontSize: theme.typography?.pxToRem?.(20) || '1.25rem'
66
+ }
67
+ }, {
68
+ props: {
69
+ fontSize: 'medium'
70
+ },
71
+ style: {
72
+ fontSize: theme.typography?.pxToRem?.(24) || '1.5rem'
73
+ }
74
+ }, {
75
+ props: {
76
+ fontSize: 'large'
77
+ },
78
+ style: {
79
+ fontSize: theme.typography?.pxToRem?.(35) || '2.1875rem'
80
+ }
81
+ },
82
+ // TODO v5 deprecate color prop, v6 remove for sx
83
+ ...Object.entries((theme.vars ?? theme).palette).filter(([, value]) => value.main).map(([color]) => ({
84
+ props: {
85
+ color
86
+ },
87
+ style: {
88
+ color: (theme.vars ?? theme).palette?.[color]?.main
89
+ }
90
+ })), {
91
+ props: {
92
+ color: 'action'
93
+ },
94
+ style: {
95
+ color: (theme.vars ?? theme).palette?.action?.active
96
+ }
97
+ }, {
98
+ props: {
99
+ color: 'disabled'
100
+ },
101
+ style: {
102
+ color: (theme.vars ?? theme).palette?.action?.disabled
103
+ }
104
+ }, {
105
+ props: {
106
+ color: 'inherit'
107
+ },
108
+ style: {
109
+ color: undefined
110
+ }
111
+ }]
62
112
  }));
63
113
  const SvgIcon = /*#__PURE__*/React.forwardRef(function SvgIcon(inProps, ref) {
64
114
  const props = useThemeProps({
@@ -179,5 +229,7 @@ process.env.NODE_ENV !== "production" ? SvgIcon.propTypes /* remove-proptypes */
179
229
  */
180
230
  viewBox: PropTypes.string
181
231
  } : void 0;
182
- SvgIcon.muiName = 'SvgIcon';
232
+ if (SvgIcon) {
233
+ SvgIcon.muiName = 'SvgIcon';
234
+ }
183
235
  export default SvgIcon;
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/material v6.0.0-alpha.4
2
+ * @mui/material v6.0.0-alpha.5
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -2,7 +2,7 @@
2
2
 
3
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
5
- const _excluded = ["checked", "className", "componentsProps", "control", "disabled", "disableTypography", "inputRef", "label", "labelPlacement", "name", "onChange", "required", "slotProps", "value"];
5
+ const _excluded = ["checked", "className", "componentsProps", "control", "disabled", "disableTypography", "inputRef", "label", "labelPlacement", "name", "onChange", "required", "slots", "slotProps", "value"];
6
6
  import * as React from 'react';
7
7
  import PropTypes from 'prop-types';
8
8
  import clsx from 'clsx';
@@ -15,6 +15,7 @@ import Typography from '../Typography';
15
15
  import capitalize from '../utils/capitalize';
16
16
  import formControlLabelClasses, { getFormControlLabelUtilityClasses } from './formControlLabelClasses';
17
17
  import formControlState from '../FormControl/formControlState';
18
+ import useSlot from '../utils/useSlot';
18
19
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
19
20
  const useThemeProps = createUseThemeProps('MuiFormControlLabel');
20
21
  const useUtilityClasses = ownerState => {
@@ -124,6 +125,7 @@ const FormControlLabel = /*#__PURE__*/React.forwardRef(function FormControlLabel
124
125
  label: labelProp,
125
126
  labelPlacement = 'end',
126
127
  required: requiredProp,
128
+ slots = {},
127
129
  slotProps = {}
128
130
  } = props,
129
131
  other = _objectWithoutPropertiesLoose(props, _excluded);
@@ -151,10 +153,18 @@ const FormControlLabel = /*#__PURE__*/React.forwardRef(function FormControlLabel
151
153
  error: fcs.error
152
154
  });
153
155
  const classes = useUtilityClasses(ownerState);
154
- const typographySlotProps = slotProps.typography ?? componentsProps.typography;
156
+ const externalForwardedProps = {
157
+ slots,
158
+ slotProps: _extends({}, componentsProps, slotProps)
159
+ };
160
+ const [TypographySlot, typographySlotProps] = useSlot('typography', {
161
+ elementType: Typography,
162
+ externalForwardedProps,
163
+ ownerState
164
+ });
155
165
  let label = labelProp;
156
166
  if (label != null && label.type !== Typography && !disableTypography) {
157
- label = /*#__PURE__*/_jsx(Typography, _extends({
167
+ label = /*#__PURE__*/_jsx(TypographySlot, _extends({
158
168
  component: "span"
159
169
  }, typographySlotProps, {
160
170
  className: clsx(classes.label, typographySlotProps?.className),
@@ -197,6 +207,7 @@ process.env.NODE_ENV !== "production" ? FormControlLabel.propTypes /* remove-pro
197
207
  /**
198
208
  * The props used for each slot inside.
199
209
  * @default {}
210
+ * @deprecated use the `slotProps` prop instead. This prop will be removed in v7. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/).
200
211
  */
201
212
  componentsProps: PropTypes.shape({
202
213
  typography: PropTypes.object
@@ -246,7 +257,14 @@ process.env.NODE_ENV !== "production" ? FormControlLabel.propTypes /* remove-pro
246
257
  * @default {}
247
258
  */
248
259
  slotProps: PropTypes.shape({
249
- typography: PropTypes.object
260
+ typography: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
261
+ }),
262
+ /**
263
+ * The components used for each slot inside.
264
+ * @default {}
265
+ */
266
+ slots: PropTypes.shape({
267
+ typography: PropTypes.elementType
250
268
  }),
251
269
  /**
252
270
  * The system prop that allows defining system overrides as well as additional CSS styles.