@mui/material 6.3.1 → 6.4.1

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 (117) hide show
  1. package/Alert/Alert.d.ts +69 -0
  2. package/Alert/Alert.js +53 -21
  3. package/Autocomplete/Autocomplete.d.ts +1 -1
  4. package/Button/Button.d.ts +18 -0
  5. package/Button/Button.js +233 -15
  6. package/Button/buttonClasses.d.ts +14 -0
  7. package/Button/buttonClasses.js +1 -1
  8. package/ButtonBase/ButtonBase.d.ts +2 -0
  9. package/ButtonGroup/ButtonGroupButtonContext.js +2 -0
  10. package/ButtonGroup/ButtonGroupContext.js +2 -0
  11. package/CHANGELOG.md +91 -0
  12. package/CardHeader/CardHeader.d.ts +114 -1
  13. package/CardHeader/CardHeader.js +99 -32
  14. package/CircularProgress/CircularProgress.js +2 -2
  15. package/Dialog/Dialog.d.ts +85 -1
  16. package/Dialog/Dialog.js +91 -20
  17. package/Dialog/DialogContext.js +2 -0
  18. package/Drawer/Drawer.js +1 -1
  19. package/Drawer/drawerClasses.d.ts +32 -8
  20. package/Drawer/drawerClasses.js +1 -1
  21. package/FormControl/FormControl.js +9 -7
  22. package/FormControl/FormControlContext.js +2 -0
  23. package/Hidden/withWidth.js +2 -0
  24. package/IconButton/IconButton.d.ts +13 -0
  25. package/IconButton/IconButton.js +80 -7
  26. package/IconButton/iconButtonClasses.d.ts +6 -0
  27. package/IconButton/iconButtonClasses.js +1 -1
  28. package/LinearProgress/LinearProgress.js +4 -4
  29. package/LinearProgress/linearProgressClasses.d.ts +31 -9
  30. package/LinearProgress/linearProgressClasses.js +1 -1
  31. package/Link/getTextDecoration.js +3 -2
  32. package/RadioGroup/RadioGroupContext.js +2 -0
  33. package/Select/Select.js +10 -1
  34. package/Select/SelectInput.js +1 -1
  35. package/Slider/useSlider.js +5 -2
  36. package/Step/StepContext.js +2 -0
  37. package/StepLabel/StepLabel.d.ts +1 -1
  38. package/Stepper/StepperContext.js +2 -0
  39. package/Table/Tablelvl2Context.js +2 -0
  40. package/ToggleButtonGroup/ToggleButtonGroupButtonContext.js +2 -0
  41. package/ToggleButtonGroup/ToggleButtonGroupContext.js +2 -0
  42. package/Tooltip/Tooltip.d.ts +1 -1
  43. package/index.js +1 -1
  44. package/modern/Alert/Alert.js +53 -21
  45. package/modern/Button/Button.js +233 -15
  46. package/modern/Button/buttonClasses.js +1 -1
  47. package/modern/ButtonGroup/ButtonGroupButtonContext.js +2 -0
  48. package/modern/ButtonGroup/ButtonGroupContext.js +2 -0
  49. package/modern/CardHeader/CardHeader.js +99 -32
  50. package/modern/CircularProgress/CircularProgress.js +2 -2
  51. package/modern/Dialog/Dialog.js +91 -20
  52. package/modern/Dialog/DialogContext.js +2 -0
  53. package/modern/Drawer/Drawer.js +1 -1
  54. package/modern/Drawer/drawerClasses.js +1 -1
  55. package/modern/FormControl/FormControl.js +9 -7
  56. package/modern/FormControl/FormControlContext.js +2 -0
  57. package/modern/Hidden/withWidth.js +2 -0
  58. package/modern/IconButton/IconButton.js +80 -7
  59. package/modern/IconButton/iconButtonClasses.js +1 -1
  60. package/modern/LinearProgress/LinearProgress.js +4 -4
  61. package/modern/LinearProgress/linearProgressClasses.js +1 -1
  62. package/modern/Link/getTextDecoration.js +3 -2
  63. package/modern/RadioGroup/RadioGroupContext.js +2 -0
  64. package/modern/Select/Select.js +10 -1
  65. package/modern/Select/SelectInput.js +1 -1
  66. package/modern/Slider/useSlider.js +5 -2
  67. package/modern/Step/StepContext.js +2 -0
  68. package/modern/Stepper/StepperContext.js +2 -0
  69. package/modern/Table/Tablelvl2Context.js +2 -0
  70. package/modern/ToggleButtonGroup/ToggleButtonGroupButtonContext.js +2 -0
  71. package/modern/ToggleButtonGroup/ToggleButtonGroupContext.js +2 -0
  72. package/modern/index.js +1 -1
  73. package/modern/utils/index.js +1 -0
  74. package/modern/utils/mergeSlotProps.js +43 -0
  75. package/modern/utils/useSlot.js +5 -1
  76. package/modern/version/index.js +2 -2
  77. package/node/Alert/Alert.js +53 -21
  78. package/node/Button/Button.js +233 -15
  79. package/node/Button/buttonClasses.js +1 -1
  80. package/node/ButtonGroup/ButtonGroupButtonContext.js +1 -0
  81. package/node/ButtonGroup/ButtonGroupContext.js +1 -0
  82. package/node/CardHeader/CardHeader.js +99 -32
  83. package/node/CircularProgress/CircularProgress.js +2 -2
  84. package/node/Dialog/Dialog.js +91 -20
  85. package/node/Dialog/DialogContext.js +1 -0
  86. package/node/Drawer/Drawer.js +1 -1
  87. package/node/Drawer/drawerClasses.js +1 -1
  88. package/node/FormControl/FormControl.js +9 -7
  89. package/node/FormControl/FormControlContext.js +1 -0
  90. package/node/Hidden/withWidth.js +1 -0
  91. package/node/IconButton/IconButton.js +79 -6
  92. package/node/IconButton/iconButtonClasses.js +1 -1
  93. package/node/LinearProgress/LinearProgress.js +4 -4
  94. package/node/LinearProgress/linearProgressClasses.js +1 -1
  95. package/node/Link/getTextDecoration.js +3 -2
  96. package/node/RadioGroup/RadioGroupContext.js +1 -0
  97. package/node/Select/Select.js +10 -1
  98. package/node/Select/SelectInput.js +1 -1
  99. package/node/Slider/useSlider.js +5 -2
  100. package/node/Step/StepContext.js +1 -0
  101. package/node/Stepper/StepperContext.js +1 -0
  102. package/node/Table/Tablelvl2Context.js +1 -0
  103. package/node/ToggleButtonGroup/ToggleButtonGroupButtonContext.js +1 -0
  104. package/node/ToggleButtonGroup/ToggleButtonGroupContext.js +1 -0
  105. package/node/index.js +1 -1
  106. package/node/utils/index.js +7 -0
  107. package/node/utils/mergeSlotProps.js +50 -0
  108. package/node/utils/useSlot.js +5 -1
  109. package/node/version/index.js +2 -2
  110. package/package.json +5 -5
  111. package/utils/index.d.ts +1 -0
  112. package/utils/index.js +1 -0
  113. package/utils/mergeSlotProps.d.ts +2 -0
  114. package/utils/mergeSlotProps.js +43 -0
  115. package/utils/useSlot.d.ts +8 -0
  116. package/utils/useSlot.js +5 -1
  117. package/version/index.js +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,96 @@
1
1
  # [Versions](https://mui.com/versions/)
2
2
 
3
+ ## 6.4.1
4
+
5
+ <!-- generated comparing v6.4.0..master -->
6
+
7
+ _Jan 21, 2025_
8
+
9
+ A big thanks to the 9 contributors who made this release possible.
10
+
11
+ ### `@mui/material@6.4.1`
12
+
13
+ - [ButtonBase] Export types used in ButtonBase props (#43530) @Janpot
14
+ - [Dialog] Add slots and slotProps (#44792) @sai6855
15
+ - [Drawer] Deprecate composed classes (#44870) @yash49
16
+ - [IconButton] Set default loading to `null` (#45057) @siriwatknp
17
+ - [ListItem] Add codemod for deprecated props (#45022) @sai6855
18
+ - [Modal] Add migration guide and codemod for deprecated props (#45021) @sai6855
19
+ - [TextField] Fix filled state to be synced with autofill (#44135) @DiegoAndai
20
+
21
+ ### `@mui/system@6.4.1`
22
+
23
+ - Fix dark mode flicker using `useEnhancedEffect` (#44812) @siriwatknp
24
+
25
+ ### `@mui/utils@6.4.1`
26
+
27
+ - Do not deep merge React component (#45058) @siriwatknp
28
+
29
+ ### Docs
30
+
31
+ - Fix typo (#45070) @Fullchee
32
+ - Improve Toolpad templates section (#44914) @bharatkashyap
33
+ - Fix expand / collapse icons orientation (#44989) @zanivan
34
+ - Rename "Base UI" to "MUI Base" in all text (#45060) @mj12albert
35
+ - Add @mui/base deprecation callout (#45030) @mj12albert
36
+ - Update @mui/base deprecation message (#45064) @mj12albert
37
+
38
+ ### Core
39
+
40
+ - [code-infra] Add "use client" directive to files with React APIs (#45036) @Janpot
41
+ - [docs] 301 redirect `/base-ui` to `base-ui.com` (#45061) @mj12albert
42
+
43
+ All contributors of this release in alphabetical order: @bharatkashyap, @DiegoAndai, @Fullchee, @Janpot, @mj12albert, @sai6855, @siriwatknp, @yash49, @zanivan
44
+
45
+ ## 6.4.0
46
+
47
+ <!-- generated comparing v6.3.1..master -->
48
+
49
+ _Jan 13, 2025_
50
+
51
+ A big thanks to the 16 contributors who made this release possible. Here are some highlights ✨:
52
+
53
+ - Added [`loading` prop](https://mui.com/material-ui/react-button/#loading-2) to the `Button` and `IconButton` components (#44637) @siriwatknp
54
+
55
+ ### `@mui/material@6.4.0`
56
+
57
+ - [Alert] complete `slots` and `slotProps` (#44971) @siriwatknp
58
+ - [Autocomplete] Sync runtime and TS types for key in grouped options (#44862) @aarongarciah
59
+ - [Button] Add `loading` prop (#44637) @siriwatknp
60
+ - [CardHeader] Deprecate `*TypographyProps` and complete `slots`, `slotProps` (#44729) @siriwatknp
61
+ - [CircularProgress] Improve indeterminate animation to be symmetric and smooth (#44934) @yashdev16
62
+ - [LinearProgress] Deprecate composed classes (#44933) @headironc
63
+ - [Link] Fix error for using custom palette with underline (#44927) @siriwatknp
64
+ - [Select] Do not set `aria-controls` when closed (#44919) @siddhantantil39
65
+ - [Select] Add missing root class (#44928) @sai6855
66
+ - [Slider] Set onChangeCommitted to receive the last argument passed to onChange (#44795) @good-jinu
67
+ - Add `mergeSlotProps` for extending components (#44809) @siriwatknp
68
+ - Update `mergeSlotProps` to merge `style` (#44959) @siriwatknp
69
+ - Fix slots typing for Tooltip and StepLabel (#44985) @siriwatknp
70
+ - Remove unnecessary blank lines (#44980) @sai6855
71
+
72
+ ### Docs
73
+
74
+ - [docs] Fix Dashboard sidenav sroll (#44876) @oliviertassinari
75
+ - [docs] Fix broken anchor link to w3.org (c51af8e) @oliviertassinari
76
+ - [docs] Add details on complementary Menu components (#44957) @samuelsycamore
77
+ - [docs] Remove misleading messaging on MD3 support (#44953) @mnajdova
78
+ - [docs] Fix code copy button obscuring on small screen sizes (#44861) @ZeeshanTamboli
79
+ - [docs] Remove more instances of Adobe XD (#44956) @samuelsycamore
80
+ - [docs] Remove Adobe XD chips, links, and mentions (#44909) @samuelsycamore
81
+ - [docs] Fix incorrect rendering in Typography docs (#44937) @iaziz11
82
+
83
+ ### Core
84
+
85
+ - [core] Remove redundant screenshots (#44877) @oliviertassinari
86
+ - [core] Remove Suspense and clock mocking from regressions and e2e tests (#44935) @DiegoAndai
87
+ - [code-infra] Allow react@18 on `@mui/internal-test-utils` (#45023) @LukasTy
88
+ - [code-infra] Stabilize flaky pigment progressbar tests (#44969) @Janpot
89
+ - [example] Update the CDN example to adapt React 19. (#44979) @IceOfSummer
90
+ - [figma] Clarify that Material UI Sync plugin is experimental (#44975) @oliviertassinari
91
+
92
+ All contributors of this release in alphabetical order: @aarongarciah, @DiegoAndai, @good-jinu, @headironc, @iaziz11, @IceOfSummer, @Janpot, @LukasTy, @mnajdova, @oliviertassinari, @sai6855, @samuelsycamore, @siddhantantil39, @siriwatknp, @yashdev16, @ZeeshanTamboli
93
+
3
94
  ## 6.3.1
4
95
 
5
96
  <!-- generated comparing v6.3.0..master -->
@@ -3,8 +3,116 @@ import { SxProps } from '@mui/system';
3
3
  import { TypographyProps } from '../Typography';
4
4
  import { OverridableComponent, OverrideProps } from '../OverridableComponent';
5
5
  import { Theme } from '..';
6
+ import { CreateSlotsAndSlotProps, SlotProps } from '../utils/types';
6
7
  import { CardHeaderClasses } from './cardHeaderClasses';
7
8
 
9
+ export interface CardHeaderRootSlotPropsOverrides {}
10
+
11
+ export interface CardHeaderAvatarSlotPropsOverrides {}
12
+
13
+ export interface CardHeaderActionSlotPropsOverrides {}
14
+
15
+ export interface CardHeaderContentSlotPropsOverrides {}
16
+
17
+ export interface CardHeaderTitleSlotPropsOverrides {}
18
+
19
+ export interface CardHeaderSubheaderSlotPropsOverrides {}
20
+
21
+ export interface CardHeaderSlots {
22
+ /**
23
+ * The component that renders the root slot.
24
+ * @default 'div'
25
+ */
26
+ root: React.ElementType;
27
+ /**
28
+ * The component that renders the avatar slot.
29
+ * @default 'div'
30
+ */
31
+ avatar: React.ElementType;
32
+ /**
33
+ * The component that renders the action slot.
34
+ * @default 'div'
35
+ */
36
+ action: React.ElementType;
37
+ /**
38
+ * The component that renders the content slot.
39
+ * @default 'div'
40
+ */
41
+ content: React.ElementType;
42
+ /**
43
+ * The component that renders the title slot (as long as disableTypography is not `true`).
44
+ * [Follow this guide](https://mui.com/material-ui/api/typography/#props) to learn more about the requirements for this component.
45
+ * @default Typography
46
+ */
47
+ title: React.ElementType;
48
+ /**
49
+ * The component that renders the subheader slot (as long as disableTypography is not `true`).
50
+ * [Follow this guide](https://mui.com/material-ui/api/typography/#props) to learn more about the requirements for this component.
51
+ * @default Typography
52
+ */
53
+ subheader: React.ElementType;
54
+ }
55
+
56
+ export type CardHeaderSlotsAndSlotProps = CreateSlotsAndSlotProps<
57
+ CardHeaderSlots,
58
+ {
59
+ /**
60
+ * Props forwarded to the root slot.
61
+ * By default, the avaible props are based on the div element.
62
+ */
63
+ root: SlotProps<
64
+ React.ElementType<React.DetailsHTMLAttributes<HTMLDivElement>>,
65
+ CardHeaderRootSlotPropsOverrides,
66
+ CardHeaderOwnerState
67
+ >;
68
+ /**
69
+ * Props forwarded to the avatar slot.
70
+ * By default, the avaible props are based on the div element.
71
+ */
72
+ avatar: SlotProps<
73
+ React.ElementType<React.DetailsHTMLAttributes<HTMLDivElement>>,
74
+ CardHeaderAvatarSlotPropsOverrides,
75
+ CardHeaderOwnerState
76
+ >;
77
+ /**
78
+ * Props forwarded to the action slot.
79
+ * By default, the avaible props are based on the div element.
80
+ */
81
+ action: SlotProps<
82
+ React.ElementType<React.DetailsHTMLAttributes<HTMLDivElement>>,
83
+ CardHeaderActionSlotPropsOverrides,
84
+ CardHeaderOwnerState
85
+ >;
86
+ /**
87
+ * Props forwarded to the content slot.
88
+ * By default, the avaible props are based on the div element.
89
+ */
90
+ content: SlotProps<
91
+ React.ElementType<React.DetailsHTMLAttributes<HTMLDivElement>>,
92
+ CardHeaderContentSlotPropsOverrides,
93
+ CardHeaderOwnerState
94
+ >;
95
+ /**
96
+ * Props forwarded to the title slot (as long as disableTypography is not `true`).
97
+ * By default, the avaible props are based on the [Typography](https://mui.com/material-ui/api/typography/#props) component.
98
+ */
99
+ title: SlotProps<
100
+ React.ElementType<TypographyProps>,
101
+ CardHeaderTitleSlotPropsOverrides,
102
+ CardHeaderOwnerState
103
+ >;
104
+ /**
105
+ * Props forwarded to the subheader slot (as long as disableTypography is not `true`).
106
+ * By default, the avaible props are based on the [Typography](https://mui.com/material-ui/api/typography/#props) component.
107
+ */
108
+ subheader: SlotProps<
109
+ React.ElementType<TypographyProps>,
110
+ CardHeaderSubheaderSlotPropsOverrides,
111
+ CardHeaderOwnerState
112
+ >;
113
+ }
114
+ >;
115
+
8
116
  export interface CardHeaderOwnProps<
9
117
  TitleTypographyComponent extends React.ElementType = 'span',
10
118
  SubheaderTypographyComponent extends React.ElementType = 'span',
@@ -36,6 +144,7 @@ export interface CardHeaderOwnProps<
36
144
  /**
37
145
  * These props will be forwarded to the subheader
38
146
  * (as long as disableTypography is not `true`).
147
+ * @deprecated Use `slotProps.subheader` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
39
148
  */
40
149
  subheaderTypographyProps?: TypographyProps<
41
150
  SubheaderTypographyComponent,
@@ -54,6 +163,7 @@ export interface CardHeaderOwnProps<
54
163
  /**
55
164
  * These props will be forwarded to the title
56
165
  * (as long as disableTypography is not `true`).
166
+ * @deprecated Use `slotProps.title` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
57
167
  */
58
168
  titleTypographyProps?: TypographyProps<
59
169
  TitleTypographyComponent,
@@ -63,6 +173,8 @@ export interface CardHeaderOwnProps<
63
173
  >;
64
174
  }
65
175
 
176
+ export interface CardHeaderOwnerState extends CardHeaderOwnProps {}
177
+
66
178
  export interface CardHeaderTypeMap<
67
179
  AdditionalProps = {},
68
180
  RootComponent extends React.ElementType = 'div',
@@ -70,7 +182,8 @@ export interface CardHeaderTypeMap<
70
182
  SubheaderTypographyComponent extends React.ElementType = 'span',
71
183
  > {
72
184
  props: AdditionalProps &
73
- CardHeaderOwnProps<TitleTypographyComponent, SubheaderTypographyComponent>;
185
+ CardHeaderOwnProps<TitleTypographyComponent, SubheaderTypographyComponent> &
186
+ CardHeaderSlotsAndSlotProps;
74
187
  defaultComponent: RootComponent;
75
188
  }
76
189
  /**
@@ -2,12 +2,12 @@
2
2
 
3
3
  import * as React from 'react';
4
4
  import PropTypes from 'prop-types';
5
- import clsx from 'clsx';
6
5
  import composeClasses from '@mui/utils/composeClasses';
7
6
  import Typography, { typographyClasses } from "../Typography/index.js";
8
7
  import { styled } from "../zero-styled/index.js";
9
8
  import { useDefaultProps } from "../DefaultPropsProvider/index.js";
10
9
  import cardHeaderClasses, { getCardHeaderUtilityClass } from "./cardHeaderClasses.js";
10
+ import useSlot from "../utils/useSlot.js";
11
11
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
12
  const useUtilityClasses = ownerState => {
13
13
  const {
@@ -79,13 +79,14 @@ const CardHeader = /*#__PURE__*/React.forwardRef(function CardHeader(inProps, re
79
79
  const {
80
80
  action,
81
81
  avatar,
82
- className,
83
82
  component = 'div',
84
83
  disableTypography = false,
85
84
  subheader: subheaderProp,
86
85
  subheaderTypographyProps,
87
86
  title: titleProp,
88
87
  titleTypographyProps,
88
+ slots = {},
89
+ slotProps = {},
89
90
  ...other
90
91
  } = props;
91
92
  const ownerState = {
@@ -94,44 +95,88 @@ const CardHeader = /*#__PURE__*/React.forwardRef(function CardHeader(inProps, re
94
95
  disableTypography
95
96
  };
96
97
  const classes = useUtilityClasses(ownerState);
98
+ const externalForwardedProps = {
99
+ slots,
100
+ slotProps: {
101
+ title: titleTypographyProps,
102
+ subheader: subheaderTypographyProps,
103
+ ...slotProps
104
+ }
105
+ };
97
106
  let title = titleProp;
98
- if (title != null && title.type !== Typography && !disableTypography) {
99
- title = /*#__PURE__*/_jsx(Typography, {
107
+ const [TitleSlot, titleSlotProps] = useSlot('title', {
108
+ className: classes.title,
109
+ elementType: Typography,
110
+ externalForwardedProps,
111
+ ownerState,
112
+ additionalProps: {
100
113
  variant: avatar ? 'body2' : 'h5',
101
- className: classes.title,
102
- component: "span",
103
- ...titleTypographyProps,
114
+ component: 'span'
115
+ }
116
+ });
117
+ if (title != null && title.type !== Typography && !disableTypography) {
118
+ title = /*#__PURE__*/_jsx(TitleSlot, {
119
+ ...titleSlotProps,
104
120
  children: title
105
121
  });
106
122
  }
107
123
  let subheader = subheaderProp;
108
- if (subheader != null && subheader.type !== Typography && !disableTypography) {
109
- subheader = /*#__PURE__*/_jsx(Typography, {
124
+ const [SubheaderSlot, subheaderSlotProps] = useSlot('subheader', {
125
+ className: classes.subheader,
126
+ elementType: Typography,
127
+ externalForwardedProps,
128
+ ownerState,
129
+ additionalProps: {
110
130
  variant: avatar ? 'body2' : 'body1',
111
- className: classes.subheader,
112
- color: "textSecondary",
113
- component: "span",
114
- ...subheaderTypographyProps,
131
+ color: 'textSecondary',
132
+ component: 'span'
133
+ }
134
+ });
135
+ if (subheader != null && subheader.type !== Typography && !disableTypography) {
136
+ subheader = /*#__PURE__*/_jsx(SubheaderSlot, {
137
+ ...subheaderSlotProps,
115
138
  children: subheader
116
139
  });
117
140
  }
118
- return /*#__PURE__*/_jsxs(CardHeaderRoot, {
119
- className: clsx(classes.root, className),
120
- as: component,
121
- ref: ref,
122
- ownerState: ownerState,
123
- ...other,
124
- children: [avatar && /*#__PURE__*/_jsx(CardHeaderAvatar, {
125
- className: classes.avatar,
126
- ownerState: ownerState,
141
+ const [RootSlot, rootSlotProps] = useSlot('root', {
142
+ ref,
143
+ className: classes.root,
144
+ elementType: CardHeaderRoot,
145
+ externalForwardedProps: {
146
+ ...externalForwardedProps,
147
+ ...other,
148
+ component
149
+ },
150
+ ownerState
151
+ });
152
+ const [AvatarSlot, avatarSlotProps] = useSlot('avatar', {
153
+ className: classes.avatar,
154
+ elementType: CardHeaderAvatar,
155
+ externalForwardedProps,
156
+ ownerState
157
+ });
158
+ const [ContentSlot, contentSlotProps] = useSlot('content', {
159
+ className: classes.content,
160
+ elementType: CardHeaderContent,
161
+ externalForwardedProps,
162
+ ownerState
163
+ });
164
+ const [ActionSlot, actionSlotProps] = useSlot('action', {
165
+ className: classes.action,
166
+ elementType: CardHeaderAction,
167
+ externalForwardedProps,
168
+ ownerState
169
+ });
170
+ return /*#__PURE__*/_jsxs(RootSlot, {
171
+ ...rootSlotProps,
172
+ children: [avatar && /*#__PURE__*/_jsx(AvatarSlot, {
173
+ ...avatarSlotProps,
127
174
  children: avatar
128
- }), /*#__PURE__*/_jsxs(CardHeaderContent, {
129
- className: classes.content,
130
- ownerState: ownerState,
175
+ }), /*#__PURE__*/_jsxs(ContentSlot, {
176
+ ...contentSlotProps,
131
177
  children: [title, subheader]
132
- }), action && /*#__PURE__*/_jsx(CardHeaderAction, {
133
- className: classes.action,
134
- ownerState: ownerState,
178
+ }), action && /*#__PURE__*/_jsx(ActionSlot, {
179
+ ...actionSlotProps,
135
180
  children: action
136
181
  })]
137
182
  });
@@ -157,10 +202,6 @@ process.env.NODE_ENV !== "production" ? CardHeader.propTypes /* remove-proptypes
157
202
  * Override or extend the styles applied to the component.
158
203
  */
159
204
  classes: PropTypes.object,
160
- /**
161
- * @ignore
162
- */
163
- className: PropTypes.string,
164
205
  /**
165
206
  * The component used for the root node.
166
207
  * Either a string to use a HTML element or a component.
@@ -174,6 +215,30 @@ process.env.NODE_ENV !== "production" ? CardHeader.propTypes /* remove-proptypes
174
215
  * @default false
175
216
  */
176
217
  disableTypography: PropTypes.bool,
218
+ /**
219
+ * The props used for each slot inside.
220
+ * @default {}
221
+ */
222
+ slotProps: PropTypes.shape({
223
+ action: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
224
+ avatar: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
225
+ content: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
226
+ root: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
227
+ subheader: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
228
+ title: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
229
+ }),
230
+ /**
231
+ * The components used for each slot inside.
232
+ * @default {}
233
+ */
234
+ slots: PropTypes.shape({
235
+ action: PropTypes.elementType,
236
+ avatar: PropTypes.elementType,
237
+ content: PropTypes.elementType,
238
+ root: PropTypes.elementType,
239
+ subheader: PropTypes.elementType,
240
+ title: PropTypes.elementType
241
+ }),
177
242
  /**
178
243
  * The content of the component.
179
244
  */
@@ -181,6 +246,7 @@ process.env.NODE_ENV !== "production" ? CardHeader.propTypes /* remove-proptypes
181
246
  /**
182
247
  * These props will be forwarded to the subheader
183
248
  * (as long as disableTypography is not `true`).
249
+ * @deprecated Use `slotProps.subheader` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
184
250
  */
185
251
  subheaderTypographyProps: PropTypes.object,
186
252
  /**
@@ -194,6 +260,7 @@ process.env.NODE_ENV !== "production" ? CardHeader.propTypes /* remove-proptypes
194
260
  /**
195
261
  * These props will be forwarded to the title
196
262
  * (as long as disableTypography is not `true`).
263
+ * @deprecated Use `slotProps.title` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
197
264
  */
198
265
  titleTypographyProps: PropTypes.object
199
266
  } : void 0;
@@ -34,8 +34,8 @@ const circularDashKeyframe = keyframes`
34
34
  }
35
35
 
36
36
  100% {
37
- stroke-dasharray: 100px, 200px;
38
- stroke-dashoffset: -125px;
37
+ stroke-dasharray: 1px, 200px;
38
+ stroke-dashoffset: -126px;
39
39
  }
40
40
  `;
41
41
 
@@ -1,12 +1,91 @@
1
1
  import * as React from 'react';
2
2
  import { SxProps, Breakpoint } from '@mui/system';
3
3
  import { InternalStandardProps as StandardProps, Theme } from '..';
4
+ import { BackdropProps } from '../Backdrop';
4
5
  import { PaperProps } from '../Paper';
5
6
  import { ModalProps } from '../Modal';
6
7
  import { TransitionProps } from '../transitions/transition';
7
8
  import { DialogClasses } from './dialogClasses';
9
+ import { CreateSlotsAndSlotProps, SlotProps } from '../utils/types';
8
10
 
9
- export interface DialogProps extends StandardProps<ModalProps, 'children'> {
11
+ export interface DialogSlots {
12
+ /**
13
+ * The component that renders the transition.
14
+ * [Follow this guide](/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component.
15
+ * @default Collapse
16
+ */
17
+ transition?: React.ElementType;
18
+ /**
19
+ * The component that renders the paper.
20
+ * @default Paper
21
+ */
22
+ paper?: React.ElementType;
23
+ /**
24
+ * The component that renders the container.
25
+ */
26
+ container?: React.ElementType;
27
+ /**
28
+ * The component that renders the backdrop.
29
+ */
30
+ backdrop?: React.ElementType;
31
+ /**
32
+ * The component that renders the root.
33
+ */
34
+ root?: React.ElementType;
35
+ }
36
+
37
+ export interface DialogTransitionSlotPropsOverrides {}
38
+ export interface DialogPaperSlotPropsOverrides {}
39
+ export interface DialogContainerSlotPropsOverrides {}
40
+ export interface DialogBackdropSlotPropsOverrides {}
41
+ export interface DialogRootSlotPropsOverrides {}
42
+
43
+ export type DialogSlotsAndSlotProps = CreateSlotsAndSlotProps<
44
+ DialogSlots,
45
+ {
46
+ /**
47
+ * Props forwarded to the root slot.
48
+ * By default, the avaible props are based on the [Modal](https://mui.com/material-ui/api/modal/#props) component.
49
+ */
50
+ root: SlotProps<React.ElementType<ModalProps>, DialogRootSlotPropsOverrides, DialogOwnerState>;
51
+ /**
52
+ * Props forwarded to the backdrop slot.
53
+ * By default, the avaible props are based on the [Backdrop](https://mui.com/material-ui/api/backdrop/#props) component.
54
+ */
55
+ backdrop: SlotProps<
56
+ React.ElementType<BackdropProps>,
57
+ DialogBackdropSlotPropsOverrides,
58
+ DialogOwnerState
59
+ >;
60
+ /**
61
+ * Props forwarded to the container slot.
62
+ * By default, the avaible props are based on a div element.
63
+ */
64
+ container: SlotProps<'div', DialogContainerSlotPropsOverrides, DialogOwnerState>;
65
+ /**
66
+ * Props forwarded to the transition slot.
67
+ * By default, the avaible props are based on the [Fade](https://mui.com/material-ui/api/fade/#props) component.
68
+ */
69
+ transition: SlotProps<
70
+ React.ElementType<TransitionProps>,
71
+ DialogTransitionSlotPropsOverrides,
72
+ DialogOwnerState
73
+ >;
74
+ /**
75
+ * Props forwarded to the paper slot.
76
+ * By default, the avaible props are based on the [Paper](https://mui.com/material-ui/api/paper/#props) component.
77
+ */
78
+ paper: SlotProps<
79
+ React.ElementType<PaperProps>,
80
+ DialogPaperSlotPropsOverrides,
81
+ DialogOwnerState
82
+ >;
83
+ }
84
+ >;
85
+
86
+ export interface DialogProps
87
+ extends Omit<StandardProps<ModalProps, 'children'>, 'slots' | 'slotProps'>,
88
+ DialogSlotsAndSlotProps {
10
89
  /**
11
90
  * The id(s) of the element(s) that describe the dialog.
12
91
  */
@@ -77,6 +156,7 @@ export interface DialogProps extends StandardProps<ModalProps, 'children'> {
77
156
  /**
78
157
  * Props applied to the [`Paper`](https://mui.com/material-ui/api/paper/) element.
79
158
  * @default {}
159
+ * @deprecated Use `slotProps.paper` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
80
160
  */
81
161
  PaperProps?: Partial<PaperProps<React.ElementType>>;
82
162
  /**
@@ -92,6 +172,7 @@ export interface DialogProps extends StandardProps<ModalProps, 'children'> {
92
172
  * The component used for the transition.
93
173
  * [Follow this guide](https://mui.com/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component.
94
174
  * @default Fade
175
+ * @deprecated Use `slots.transition` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
95
176
  */
96
177
  TransitionComponent?: React.JSXElementConstructor<
97
178
  TransitionProps & { children: React.ReactElement<unknown, any> }
@@ -108,6 +189,7 @@ export interface DialogProps extends StandardProps<ModalProps, 'children'> {
108
189
  /**
109
190
  * Props applied to the transition element.
110
191
  * By default, the element is based on this [`Transition`](https://reactcommunity.org/react-transition-group/transition/) component.
192
+ * @deprecated Use `slotProps.transition` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
111
193
  */
112
194
  TransitionProps?: TransitionProps;
113
195
  }
@@ -125,3 +207,5 @@ export interface DialogProps extends StandardProps<ModalProps, 'children'> {
125
207
  * - inherits [Modal API](https://mui.com/material-ui/api/modal/)
126
208
  */
127
209
  export default function Dialog(props: DialogProps): React.JSX.Element;
210
+
211
+ export interface DialogOwnerState extends Omit<DialogProps, 'slots' | 'slotProps'> {}