@mui/material 5.14.2 → 5.14.3

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 (105) hide show
  1. package/Accordion/Accordion.d.ts +11 -6
  2. package/AccordionSummary/AccordionSummary.d.ts +9 -7
  3. package/AppBar/AppBar.d.ts +11 -6
  4. package/Autocomplete/Autocomplete.d.ts +20 -16
  5. package/Autocomplete/Autocomplete.js +19 -15
  6. package/Avatar/Avatar.d.ts +11 -6
  7. package/AvatarGroup/AvatarGroup.d.ts +1 -1
  8. package/Backdrop/Backdrop.d.ts +11 -6
  9. package/Badge/Badge.d.ts +11 -6
  10. package/BottomNavigation/BottomNavigation.d.ts +11 -6
  11. package/BottomNavigationAction/BottomNavigationAction.d.ts +9 -7
  12. package/Box/Box.d.ts +3 -3
  13. package/Breadcrumbs/Breadcrumbs.d.ts +11 -6
  14. package/Button/Button.d.ts +16 -14
  15. package/ButtonBase/ButtonBase.d.ts +17 -12
  16. package/ButtonGroup/ButtonGroup.d.ts +11 -6
  17. package/CHANGELOG.md +91 -1
  18. package/Card/Card.d.ts +13 -8
  19. package/CardActionArea/CardActionArea.d.ts +11 -6
  20. package/CardContent/CardContent.d.ts +11 -6
  21. package/CardMedia/CardMedia.d.ts +9 -7
  22. package/Chip/Chip.d.ts +11 -6
  23. package/Container/Container.d.ts +11 -6
  24. package/Dialog/Dialog.d.ts +1 -1
  25. package/DialogContentText/DialogContentText.d.ts +9 -7
  26. package/DialogTitle/DialogTitle.d.ts +9 -7
  27. package/Divider/Divider.d.ts +11 -6
  28. package/Divider/Divider.js +6 -0
  29. package/Drawer/Drawer.d.ts +1 -1
  30. package/Fab/Fab.d.ts +11 -6
  31. package/FormControl/FormControl.d.ts +11 -6
  32. package/FormHelperText/FormHelperText.d.ts +11 -6
  33. package/FormLabel/FormLabel.d.ts +14 -9
  34. package/Grid/Grid.d.ts +11 -6
  35. package/Icon/Icon.d.ts +11 -6
  36. package/IconButton/IconButton.d.ts +9 -7
  37. package/ImageList/ImageList.d.ts +11 -6
  38. package/ImageListItem/ImageListItem.d.ts +11 -6
  39. package/InputAdornment/InputAdornment.d.ts +11 -6
  40. package/InputLabel/InputLabel.d.ts +9 -7
  41. package/Link/Link.d.ts +20 -13
  42. package/List/List.d.ts +17 -10
  43. package/ListItem/ListItem.d.ts +9 -7
  44. package/ListItemButton/ListItemButton.d.ts +9 -7
  45. package/ListSubheader/ListSubheader.d.ts +11 -6
  46. package/Menu/Menu.d.ts +23 -2
  47. package/Menu/Menu.js +48 -10
  48. package/MenuItem/MenuItem.d.ts +11 -6
  49. package/MenuList/MenuList.d.ts +11 -6
  50. package/Modal/Modal.d.ts +11 -6
  51. package/OverridableComponent.d.ts +14 -14
  52. package/PaginationItem/PaginationItem.d.ts +12 -7
  53. package/Paper/Paper.d.ts +45 -38
  54. package/Paper/index.d.ts +1 -1
  55. package/Popover/Popover.d.ts +1 -1
  56. package/README.md +2 -2
  57. package/ScopedCssBaseline/ScopedCssBaseline.d.ts +11 -6
  58. package/Select/Select.d.ts +8 -8
  59. package/Select/Select.js +1 -1
  60. package/Select/SelectInput.d.ts +7 -7
  61. package/Skeleton/Skeleton.d.ts +11 -6
  62. package/Slider/Slider.d.ts +11 -6
  63. package/Stack/Stack.d.ts +11 -6
  64. package/Step/Step.d.ts +11 -6
  65. package/StepButton/StepButton.d.ts +11 -6
  66. package/Stepper/Stepper.d.ts +11 -6
  67. package/SvgIcon/SvgIcon.d.ts +11 -6
  68. package/Tab/Tab.d.ts +11 -6
  69. package/Table/Table.d.ts +11 -6
  70. package/TableBody/TableBody.d.ts +11 -6
  71. package/TableContainer/TableContainer.d.ts +11 -6
  72. package/TableFooter/TableFooter.d.ts +11 -6
  73. package/TableHead/TableHead.d.ts +11 -6
  74. package/TablePagination/TablePagination.d.ts +11 -6
  75. package/TableRow/TableRow.d.ts +11 -6
  76. package/TableSortLabel/TableSortLabel.d.ts +9 -7
  77. package/Tabs/Tabs.d.ts +11 -6
  78. package/ToggleButton/ToggleButton.d.ts +9 -7
  79. package/Toolbar/Toolbar.d.ts +11 -6
  80. package/Typography/Typography.d.ts +76 -70
  81. package/index.d.ts +9 -9
  82. package/index.js +1 -1
  83. package/legacy/Autocomplete/Autocomplete.js +19 -16
  84. package/legacy/Divider/Divider.js +6 -0
  85. package/legacy/Menu/Menu.js +49 -9
  86. package/legacy/Select/Select.js +1 -1
  87. package/legacy/index.js +1 -1
  88. package/modern/Autocomplete/Autocomplete.js +16 -12
  89. package/modern/Divider/Divider.js +6 -0
  90. package/modern/Menu/Menu.js +47 -10
  91. package/modern/Select/Select.js +1 -1
  92. package/modern/index.js +1 -1
  93. package/node/Autocomplete/Autocomplete.js +19 -15
  94. package/node/Divider/Divider.js +6 -0
  95. package/node/Menu/Menu.js +47 -9
  96. package/node/Select/Select.js +1 -1
  97. package/node/index.js +1 -1
  98. package/package.json +6 -6
  99. package/styles/ThemeProvider.d.ts +3 -3
  100. package/styles/components.d.ts +1 -0
  101. package/styles/createTypography.d.ts +9 -10
  102. package/styles/overrides.d.ts +2 -0
  103. package/types/OverridableComponentAugmentation.d.ts +7 -7
  104. package/umd/material-ui.development.js +318 -275
  105. package/umd/material-ui.production.min.js +21 -21
package/Menu/Menu.js CHANGED
@@ -3,12 +3,12 @@
3
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
5
5
  const _excluded = ["onEntering"],
6
- _excluded2 = ["autoFocus", "children", "disableAutoFocusItem", "MenuListProps", "onClose", "open", "PaperProps", "PopoverClasses", "transitionDuration", "TransitionProps", "variant"];
6
+ _excluded2 = ["autoFocus", "children", "className", "disableAutoFocusItem", "MenuListProps", "onClose", "open", "PaperProps", "PopoverClasses", "transitionDuration", "TransitionProps", "variant", "slots", "slotProps"];
7
7
  import * as React from 'react';
8
8
  import { isFragment } from 'react-is';
9
9
  import PropTypes from 'prop-types';
10
10
  import clsx from 'clsx';
11
- import { unstable_composeClasses as composeClasses } from '@mui/base';
11
+ import { unstable_composeClasses as composeClasses, useSlotProps } from '@mui/base';
12
12
  import { HTMLElementType } from '@mui/utils';
13
13
  import MenuList from '../MenuList';
14
14
  import Popover, { PopoverPaper } from '../Popover';
@@ -63,6 +63,7 @@ const MenuMenuList = styled(MenuList, {
63
63
  outline: 0
64
64
  });
65
65
  const Menu = /*#__PURE__*/React.forwardRef(function Menu(inProps, ref) {
66
+ var _slots$paper, _slotProps$paper;
66
67
  const props = useThemeProps({
67
68
  props: inProps,
68
69
  name: 'MuiMenu'
@@ -70,6 +71,7 @@ const Menu = /*#__PURE__*/React.forwardRef(function Menu(inProps, ref) {
70
71
  const {
71
72
  autoFocus = true,
72
73
  children,
74
+ className,
73
75
  disableAutoFocusItem = false,
74
76
  MenuListProps = {},
75
77
  onClose,
@@ -80,7 +82,9 @@ const Menu = /*#__PURE__*/React.forwardRef(function Menu(inProps, ref) {
80
82
  TransitionProps: {
81
83
  onEntering
82
84
  } = {},
83
- variant = 'selectedMenu'
85
+ variant = 'selectedMenu',
86
+ slots = {},
87
+ slotProps = {}
84
88
  } = props,
85
89
  TransitionProps = _objectWithoutPropertiesLoose(props.TransitionProps, _excluded),
86
90
  other = _objectWithoutPropertiesLoose(props, _excluded2);
@@ -142,6 +146,20 @@ const Menu = /*#__PURE__*/React.forwardRef(function Menu(inProps, ref) {
142
146
  }
143
147
  }
144
148
  });
149
+ const PaperSlot = (_slots$paper = slots.paper) != null ? _slots$paper : MenuPaper;
150
+ const paperExternalSlotProps = (_slotProps$paper = slotProps.paper) != null ? _slotProps$paper : PaperProps;
151
+ const rootSlotProps = useSlotProps({
152
+ elementType: slots.root,
153
+ externalSlotProps: slotProps.root,
154
+ ownerState,
155
+ className: [classes.root, className]
156
+ });
157
+ const paperSlotProps = useSlotProps({
158
+ elementType: PaperSlot,
159
+ externalSlotProps: paperExternalSlotProps,
160
+ ownerState,
161
+ className: classes.paper
162
+ });
145
163
  return /*#__PURE__*/_jsx(MenuRoot, _extends({
146
164
  onClose: onClose,
147
165
  anchorOrigin: {
@@ -150,16 +168,13 @@ const Menu = /*#__PURE__*/React.forwardRef(function Menu(inProps, ref) {
150
168
  },
151
169
  transformOrigin: isRtl ? RTL_ORIGIN : LTR_ORIGIN,
152
170
  slots: {
153
- paper: MenuPaper
171
+ paper: PaperSlot,
172
+ root: slots.root
154
173
  },
155
174
  slotProps: {
156
- paper: _extends({}, PaperProps, {
157
- classes: _extends({}, PaperProps.classes, {
158
- root: classes.paper
159
- })
160
- })
175
+ root: rootSlotProps,
176
+ paper: paperSlotProps
161
177
  },
162
- className: classes.root,
163
178
  open: open,
164
179
  ref: ref,
165
180
  transitionDuration: transitionDuration,
@@ -207,6 +222,10 @@ process.env.NODE_ENV !== "production" ? Menu.propTypes /* remove-proptypes */ =
207
222
  * Override or extend the styles applied to the component.
208
223
  */
209
224
  classes: PropTypes.object,
225
+ /**
226
+ * @ignore
227
+ */
228
+ className: PropTypes.string,
210
229
  /**
211
230
  * When opening the menu will not focus the active item but the `[role="menu"]`
212
231
  * unless `autoFocus` is also set to `false`. Not using the default means not
@@ -239,6 +258,25 @@ process.env.NODE_ENV !== "production" ? Menu.propTypes /* remove-proptypes */ =
239
258
  * `classes` prop applied to the [`Popover`](/material-ui/api/popover/) element.
240
259
  */
241
260
  PopoverClasses: PropTypes.object,
261
+ /**
262
+ * The extra props for the slot components.
263
+ * You can override the existing props or add new ones.
264
+ *
265
+ * @default {}
266
+ */
267
+ slotProps: PropTypes.shape({
268
+ paper: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
269
+ root: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
270
+ }),
271
+ /**
272
+ * The components used for each slot inside.
273
+ *
274
+ * @default {}
275
+ */
276
+ slots: PropTypes.shape({
277
+ paper: PropTypes.elementType,
278
+ root: PropTypes.elementType
279
+ }),
242
280
  /**
243
281
  * The system prop that allows defining system overrides as well as additional CSS styles.
244
282
  */
@@ -4,8 +4,11 @@ import { ExtendButtonBase, ExtendButtonBaseTypeMap } from '../ButtonBase';
4
4
  import { OverrideProps } from '../OverridableComponent';
5
5
  import { MenuItemClasses } from './menuItemClasses';
6
6
 
7
- export type MenuItemTypeMap<P = {}, D extends React.ElementType = 'li'> = ExtendButtonBaseTypeMap<{
8
- props: P & {
7
+ export type MenuItemTypeMap<
8
+ AdditionalProps = {},
9
+ DefaultComponent extends React.ElementType = 'li',
10
+ > = ExtendButtonBaseTypeMap<{
11
+ props: AdditionalProps & {
9
12
  /**
10
13
  * If `true`, the list item is focused during the first mount.
11
14
  * Focus will also be triggered if the value changes from false to true.
@@ -47,7 +50,7 @@ export type MenuItemTypeMap<P = {}, D extends React.ElementType = 'li'> = Extend
47
50
  */
48
51
  sx?: SxProps<Theme>;
49
52
  };
50
- defaultComponent: D;
53
+ defaultComponent: DefaultComponent;
51
54
  }>;
52
55
 
53
56
  /**
@@ -64,8 +67,10 @@ export type MenuItemTypeMap<P = {}, D extends React.ElementType = 'li'> = Extend
64
67
  declare const MenuItem: ExtendButtonBase<MenuItemTypeMap>;
65
68
 
66
69
  export type MenuItemProps<
67
- D extends React.ElementType = MenuItemTypeMap['defaultComponent'],
68
- P = {},
69
- > = OverrideProps<MenuItemTypeMap<P, D>, D>;
70
+ RootComponent extends React.ElementType = MenuItemTypeMap['defaultComponent'],
71
+ AdditionalProps = {},
72
+ > = OverrideProps<MenuItemTypeMap<AdditionalProps, RootComponent>, RootComponent> & {
73
+ component?: React.ElementType;
74
+ };
70
75
 
71
76
  export default MenuItem;
@@ -2,8 +2,11 @@ import * as React from 'react';
2
2
  import { ExtendList, ExtendListTypeMap } from '../List';
3
3
  import { OverrideProps } from '../OverridableComponent';
4
4
 
5
- export type MenuListTypeMap<P = {}, D extends React.ElementType = 'ul'> = ExtendListTypeMap<{
6
- props: P & {
5
+ export type MenuListTypeMap<
6
+ AdditionalProps = {},
7
+ DefaultComponent extends React.ElementType = 'ul',
8
+ > = ExtendListTypeMap<{
9
+ props: AdditionalProps & {
7
10
  /**
8
11
  * If `true`, will focus the `[role="menu"]` container and move into tab order.
9
12
  * @default false
@@ -36,7 +39,7 @@ export type MenuListTypeMap<P = {}, D extends React.ElementType = 'ul'> = Extend
36
39
  */
37
40
  variant?: 'menu' | 'selectedMenu';
38
41
  };
39
- defaultComponent: D;
42
+ defaultComponent: DefaultComponent;
40
43
  }>;
41
44
 
42
45
  export type MenuListClassKey = keyof NonNullable<MenuListTypeMap['props']['classes']>;
@@ -59,8 +62,10 @@ export type MenuListClassKey = keyof NonNullable<MenuListTypeMap['props']['class
59
62
  declare const MenuList: ExtendList<MenuListTypeMap>;
60
63
 
61
64
  export type MenuListProps<
62
- D extends React.ElementType = MenuListTypeMap['defaultComponent'],
63
- P = {},
64
- > = OverrideProps<MenuListTypeMap<P, D>, D>;
65
+ RootComponent extends React.ElementType = MenuListTypeMap['defaultComponent'],
66
+ AdditionalProps = {},
67
+ > = OverrideProps<MenuListTypeMap<AdditionalProps, RootComponent>, RootComponent> & {
68
+ component?: React.ElementType;
69
+ };
65
70
 
66
71
  export default MenuList;
package/Modal/Modal.d.ts CHANGED
@@ -16,8 +16,11 @@ export interface ModalOwnerState extends ModalProps {
16
16
  exited: boolean;
17
17
  }
18
18
 
19
- export interface ModalTypeMap<D extends React.ElementType = 'div', P = {}> {
20
- props: P & {
19
+ export interface ModalTypeMap<
20
+ DefaultComponent extends React.ElementType = 'div',
21
+ AdditionalProps = {},
22
+ > {
23
+ props: AdditionalProps & {
21
24
  /**
22
25
  * A backdrop component. This prop enables custom backdrop rendering.
23
26
  * @deprecated Use `slots.backdrop` instead. While this prop currently works, it will be removed in the next major version.
@@ -92,7 +95,7 @@ export interface ModalTypeMap<D extends React.ElementType = 'div', P = {}> {
92
95
  */
93
96
  sx?: SxProps<Theme>;
94
97
  } & Omit<BaseModalTypeMap['props'], 'slotProps'>;
95
- defaultComponent: D;
98
+ defaultComponent: DefaultComponent;
96
99
  }
97
100
 
98
101
  type ModalRootProps = NonNullable<ModalTypeMap['props']['slotProps']>['root'];
@@ -129,8 +132,10 @@ export type ModalClasses = Record<ModalClassKey, string>;
129
132
  export declare const modalClasses: ModalClasses;
130
133
 
131
134
  export type ModalProps<
132
- D extends React.ElementType = ModalTypeMap['defaultComponent'],
133
- P = {},
134
- > = OverrideProps<ModalTypeMap<D, P>, D>;
135
+ RootComponent extends React.ElementType = ModalTypeMap['defaultComponent'],
136
+ AdditionalProps = {},
137
+ > = OverrideProps<ModalTypeMap<RootComponent, AdditionalProps>, RootComponent> & {
138
+ component?: React.ElementType;
139
+ };
135
140
 
136
141
  export default Modal;
@@ -7,21 +7,21 @@ import { StyledComponentProps } from './styles';
7
7
  *
8
8
  * Adjusts valid props based on the type of `component`.
9
9
  */
10
- export interface OverridableComponent<M extends OverridableTypeMap> {
10
+ export interface OverridableComponent<TypeMap extends OverridableTypeMap> {
11
11
  // If you make any changes to this interface, please make sure to update the
12
12
  // `OverridableComponent` type in `mui-types/index.d.ts` as well.
13
13
  // Also, there are types in Base UI that have a similar shape to this interface
14
14
  // (e.g. SelectType, OptionType, etc.).
15
- <C extends React.ElementType>(
15
+ <RootComponent extends React.ElementType>(
16
16
  props: {
17
17
  /**
18
18
  * The component used for the root node.
19
19
  * Either a string to use a HTML element or a component.
20
20
  */
21
- component: C;
22
- } & OverrideProps<M, C>,
21
+ component: RootComponent;
22
+ } & OverrideProps<TypeMap, RootComponent>,
23
23
  ): JSX.Element | null;
24
- (props: DefaultComponentProps<M>): JSX.Element | null;
24
+ (props: DefaultComponentProps<TypeMap>): JSX.Element | null;
25
25
  }
26
26
 
27
27
  /**
@@ -29,27 +29,27 @@ export interface OverridableComponent<M extends OverridableTypeMap> {
29
29
  */
30
30
  // prettier-ignore
31
31
  export type OverrideProps<
32
- M extends OverridableTypeMap,
33
- C extends React.ElementType
32
+ TypeMap extends OverridableTypeMap,
33
+ RootComponent extends React.ElementType
34
34
  > = (
35
- & BaseProps<M>
36
- & DistributiveOmit<React.ComponentPropsWithRef<C>, keyof BaseProps<M>>
35
+ & BaseProps<TypeMap>
36
+ & DistributiveOmit<React.ComponentPropsWithRef<RootComponent>, keyof BaseProps<TypeMap>>
37
37
  );
38
38
 
39
39
  /**
40
40
  * Props if `component={Component}` is NOT used.
41
41
  */
42
42
  // prettier-ignore
43
- export type DefaultComponentProps<M extends OverridableTypeMap> =
44
- & BaseProps<M>
45
- & DistributiveOmit<React.ComponentPropsWithRef<M['defaultComponent']>, keyof BaseProps<M>>;
43
+ export type DefaultComponentProps<TypeMap extends OverridableTypeMap> =
44
+ & BaseProps<TypeMap>
45
+ & DistributiveOmit<React.ComponentPropsWithRef<TypeMap['defaultComponent']>, keyof BaseProps<TypeMap>>;
46
46
 
47
47
  /**
48
48
  * Props defined on the component (+ common material-ui props).
49
49
  */
50
50
  // prettier-ignore
51
- export type BaseProps<M extends OverridableTypeMap> =
52
- & M['props']
51
+ export type BaseProps<TypeMap extends OverridableTypeMap> =
52
+ & TypeMap['props']
53
53
  & CommonProps;
54
54
 
55
55
  /**
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { OverridableStringUnion } from '@mui/types';
3
- import { OverridableComponent, OverrideProps } from '@mui/material/OverridableComponent';
4
3
  import { SxProps } from '@mui/system';
4
+ import { OverridableComponent, OverrideProps } from '@mui/material/OverridableComponent';
5
5
  import { Theme } from '../styles';
6
6
  import { UsePaginationItem } from '../usePagination/usePagination';
7
7
  import { PaginationItemClasses } from './paginationItemClasses';
@@ -12,8 +12,11 @@ export interface PaginationItemPropsSizeOverrides {}
12
12
 
13
13
  export interface PaginationItemPropsColorOverrides {}
14
14
 
15
- export interface PaginationItemTypeMap<P = {}, D extends React.ElementType = 'div'> {
16
- props: P & {
15
+ export interface PaginationItemTypeMap<
16
+ AdditionalProps = {},
17
+ DefaultComponent extends React.ElementType = 'div',
18
+ > {
19
+ props: AdditionalProps & {
17
20
  /**
18
21
  * Override or extend the styles applied to the component.
19
22
  */
@@ -94,7 +97,7 @@ export interface PaginationItemTypeMap<P = {}, D extends React.ElementType = 'di
94
97
  */
95
98
  variant?: OverridableStringUnion<'text' | 'outlined', PaginationItemPropsVariantOverrides>;
96
99
  };
97
- defaultComponent: D;
100
+ defaultComponent: DefaultComponent;
98
101
  }
99
102
 
100
103
  /**
@@ -110,8 +113,10 @@ export interface PaginationItemTypeMap<P = {}, D extends React.ElementType = 'di
110
113
  declare const PaginationItem: OverridableComponent<PaginationItemTypeMap>;
111
114
 
112
115
  export type PaginationItemProps<
113
- D extends React.ElementType = PaginationItemTypeMap['defaultComponent'],
114
- P = {},
115
- > = OverrideProps<PaginationItemTypeMap<P, D>, D>;
116
+ RootComponent extends React.ElementType = PaginationItemTypeMap['defaultComponent'],
117
+ AdditionalProps = {},
118
+ > = OverrideProps<PaginationItemTypeMap<AdditionalProps, RootComponent>, RootComponent> & {
119
+ component?: React.ElementType;
120
+ };
116
121
 
117
122
  export default PaginationItem;
package/Paper/Paper.d.ts CHANGED
@@ -7,38 +7,43 @@ import { PaperClasses } from './paperClasses';
7
7
 
8
8
  export interface PaperPropsVariantOverrides {}
9
9
 
10
- export interface PaperTypeMap<P = {}, D extends React.ElementType = 'div'> {
11
- props: P & {
12
- /**
13
- * The content of the component.
14
- */
15
- children?: React.ReactNode;
16
- /**
17
- * Override or extend the styles applied to the component.
18
- */
19
- classes?: Partial<PaperClasses>;
20
- /**
21
- * Shadow depth, corresponds to `dp` in the spec.
22
- * It accepts values between 0 and 24 inclusive.
23
- * @default 1
24
- */
25
- elevation?: number;
26
- /**
27
- * If `true`, rounded corners are disabled.
28
- * @default false
29
- */
30
- square?: boolean;
31
- /**
32
- * The system prop that allows defining system overrides as well as additional CSS styles.
33
- */
34
- sx?: SxProps<Theme>;
35
- /**
36
- * The variant to use.
37
- * @default 'elevation'
38
- */
39
- variant?: OverridableStringUnion<'elevation' | 'outlined', PaperPropsVariantOverrides>;
40
- };
41
- defaultComponent: D;
10
+ export interface PaperOwnProps {
11
+ /**
12
+ * The content of the component.
13
+ */
14
+ children?: React.ReactNode;
15
+ /**
16
+ * Override or extend the styles applied to the component.
17
+ */
18
+ classes?: Partial<PaperClasses>;
19
+ /**
20
+ * Shadow depth, corresponds to `dp` in the spec.
21
+ * It accepts values between 0 and 24 inclusive.
22
+ * @default 1
23
+ */
24
+ elevation?: number;
25
+ /**
26
+ * If `true`, rounded corners are disabled.
27
+ * @default false
28
+ */
29
+ square?: boolean;
30
+ /**
31
+ * The system prop that allows defining system overrides as well as additional CSS styles.
32
+ */
33
+ sx?: SxProps<Theme>;
34
+ /**
35
+ * The variant to use.
36
+ * @default 'elevation'
37
+ */
38
+ variant?: OverridableStringUnion<'elevation' | 'outlined', PaperPropsVariantOverrides>;
39
+ }
40
+
41
+ export interface PaperTypeMap<
42
+ AdditionalProps = {},
43
+ DefaultComponent extends React.ElementType = 'div',
44
+ > {
45
+ props: AdditionalProps & PaperOwnProps;
46
+ defaultComponent: DefaultComponent;
42
47
  }
43
48
 
44
49
  /**
@@ -54,14 +59,16 @@ export interface PaperTypeMap<P = {}, D extends React.ElementType = 'div'> {
54
59
  */
55
60
  declare const Paper: OverridableComponent<PaperTypeMap>;
56
61
 
57
- export interface ExtendPaperTypeMap<M extends OverridableTypeMap, Keys extends string = ''> {
58
- props: M['props'] & Omit<PaperTypeMap['props'], Keys>;
59
- defaultComponent: M['defaultComponent'];
62
+ export interface ExtendPaperTypeMap<TypeMap extends OverridableTypeMap, Keys extends string = ''> {
63
+ props: TypeMap['props'] & Omit<PaperTypeMap['props'], Keys>;
64
+ defaultComponent: TypeMap['defaultComponent'];
60
65
  }
61
66
 
62
67
  export type PaperProps<
63
- D extends React.ElementType = PaperTypeMap['defaultComponent'],
64
- P = {},
65
- > = OverrideProps<PaperTypeMap<P, D>, D>;
68
+ RootComponent extends React.ElementType = PaperTypeMap['defaultComponent'],
69
+ AdditionalProps = {},
70
+ > = OverrideProps<PaperTypeMap<AdditionalProps, RootComponent>, RootComponent> & {
71
+ component?: React.ElementType;
72
+ };
66
73
 
67
74
  export default Paper;
package/Paper/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { default } from './Paper';
2
- export type { PaperProps, PaperPropsVariantOverrides, PaperTypeMap } from './Paper';
2
+ export type { PaperProps, PaperOwnProps, PaperPropsVariantOverrides, PaperTypeMap } from './Paper';
3
3
 
4
4
  export { default as paperClasses } from './paperClasses';
5
5
  export * from './paperClasses';
@@ -107,7 +107,7 @@ export interface PopoverProps
107
107
  *
108
108
  * @default {}
109
109
  */
110
- PaperProps?: Partial<PaperProps>;
110
+ PaperProps?: Partial<PaperProps<React.ElementType>>;
111
111
  /**
112
112
  * The components used for each slot inside.
113
113
  *
package/README.md CHANGED
@@ -131,7 +131,7 @@ Diamond Sponsors are those who have pledged \$1,500/month or more to MUI.
131
131
  via [OpenCollective](https://opencollective.com/mui) or via [Patreon](https://www.patreon.com/oliviertassinari)
132
132
 
133
133
  <p>
134
- <a href="https://www.tidelift.com/subscription/pkg/npm-material-ui?utm_source=npm-material-ui&utm_medium=referral&utm_campaign=homepage" rel="noopener sponsored" target="_blank"><img height="96" width="96" src="https://avatars.githubusercontent.com/u/30204434?s=192" alt="tidelift.com" title="Enterprise-ready open-source software" loading="lazy" /></a>
134
+ <a href="https://tidelift.com/subscription/pkg/npm-material-ui?utm_source=npm-material-ui&utm_medium=referral&utm_campaign=homepage" rel="noopener sponsored" target="_blank"><img height="96" width="96" src="https://avatars.githubusercontent.com/u/30204434?s=192" alt="tidelift.com" title="Enterprise-ready open-source software" loading="lazy" /></a>
135
135
  <a href="https://www.text-em-all.com/?utm_source=MUI&utm_medium=referral&utm_content=readme" rel="noopener sponsored" target="_blank"><img src="https://avatars.githubusercontent.com/u/1262264?s=192" alt="text-em-all.com" title="Mass Text Messaging & Automated Calling" height="96" width="96" loading="lazy"></a>
136
136
  <a href="https://open.spotify.com/?utm_source=MUI&utm_medium=referral&utm_content=readme" rel="noopener sponsored" target="_blank"><img height="96" width="96" src="https://images.opencollective.com/spotify/f37ea28/logo/192.png" alt="Spotify" title="Music service to access to millions of songs" loading="lazy" /></a>
137
137
  <a href="https://megafamous.com/?utm_source=MUI&utm_medium=referral&utm_content=readme" rel="noopener sponsored" target="_blank"><img height="96" width="96" src="https://mui.com/static/sponsors/megafamous.png" alt="megafamous.com" title="The best place to buy Instagram followers & likes." loading="lazy" /></a>
@@ -168,7 +168,7 @@ For more options, see the [`Button` component page](https://mui.com/material-ui/
168
168
 
169
169
  ## Questions
170
170
 
171
- For how-to questions that don't involve making changes to the code base, please use [Stack Overflow](https://stackoverflow.com/questions/tagged/mui) instead of GitHub issues.
171
+ For how-to questions that don't involve making changes to the code base, please use [Stack Overflow](https://stackoverflow.com/questions/tagged/material-ui) instead of GitHub issues.
172
172
  Use the "mui" tag on Stack Overflow to make it easier for the community to find your question.
173
173
 
174
174
  ## Examples
@@ -4,8 +4,11 @@ import { Theme } from '../styles';
4
4
  import { OverridableComponent, OverrideProps } from '../OverridableComponent';
5
5
  import { ScopedCssBaselineClasses } from './scopedCssBaselineClasses';
6
6
 
7
- export interface ScopedCssBaselineTypeMap<P = {}, D extends React.ElementType = 'div'> {
8
- props: P & {
7
+ export interface ScopedCssBaselineTypeMap<
8
+ AdditionalProps = {},
9
+ DefaultComponent extends React.ElementType = 'div',
10
+ > {
11
+ props: AdditionalProps & {
9
12
  /**
10
13
  * The content of the component.
11
14
  */
@@ -25,7 +28,7 @@ export interface ScopedCssBaselineTypeMap<P = {}, D extends React.ElementType =
25
28
  */
26
29
  sx?: SxProps<Theme>;
27
30
  };
28
- defaultComponent: D;
31
+ defaultComponent: DefaultComponent;
29
32
  }
30
33
  /**
31
34
  *
@@ -40,9 +43,11 @@ export interface ScopedCssBaselineTypeMap<P = {}, D extends React.ElementType =
40
43
  declare const ScopedCssBaseline: OverridableComponent<ScopedCssBaselineTypeMap>;
41
44
 
42
45
  export type ScopedCssBaselineProps<
43
- D extends React.ElementType = ScopedCssBaselineTypeMap['defaultComponent'],
44
- P = {},
45
- > = OverrideProps<ScopedCssBaselineTypeMap<P, D>, D>;
46
+ RootComponent extends React.ElementType = ScopedCssBaselineTypeMap['defaultComponent'],
47
+ AdditionalProps = {},
48
+ > = OverrideProps<ScopedCssBaselineTypeMap<AdditionalProps, RootComponent>, RootComponent> & {
49
+ component?: React.ElementType;
50
+ };
46
51
 
47
52
  /**
48
53
  *
@@ -9,10 +9,10 @@ import { OutlinedInputProps } from '../OutlinedInput';
9
9
 
10
10
  export { SelectChangeEvent };
11
11
 
12
- export interface SelectProps<T = unknown>
12
+ export interface SelectProps<Value = unknown>
13
13
  extends StandardProps<InputProps, 'value' | 'onChange'>,
14
14
  Omit<OutlinedInputProps, 'value' | 'onChange'>,
15
- Pick<SelectInputProps<T>, 'onChange'> {
15
+ Pick<SelectInputProps<Value>, 'onChange'> {
16
16
  /**
17
17
  * If `true`, the width of the popover will automatically be set according to the items inside the
18
18
  * menu, otherwise it will be at least the width of the select input.
@@ -40,7 +40,7 @@ export interface SelectProps<T = unknown>
40
40
  /**
41
41
  * The default value. Use when the component is not controlled.
42
42
  */
43
- defaultValue?: T;
43
+ defaultValue?: Value;
44
44
  /**
45
45
  * If `true`, a value is displayed even if no items are selected.
46
46
  *
@@ -96,12 +96,12 @@ export interface SelectProps<T = unknown>
96
96
  /**
97
97
  * Callback fired when a menu item is selected.
98
98
  *
99
- * @param {SelectChangeEvent<T>} event The event source of the callback.
99
+ * @param {SelectChangeEvent<Value>} event The event source of the callback.
100
100
  * You can pull out the new value by accessing `event.target.value` (any).
101
101
  * **Warning**: This is a generic event, not a change event, unless the change event is caused by browser autofill.
102
102
  * @param {object} [child] The react element that was selected when `native` is `false` (default).
103
103
  */
104
- onChange?: SelectInputProps<T>['onChange'];
104
+ onChange?: SelectInputProps<Value>['onChange'];
105
105
  /**
106
106
  * Callback fired when the component requests to be closed.
107
107
  * Use it in either controlled (see the `open` prop), or uncontrolled mode (to detect when the Select collapses).
@@ -128,7 +128,7 @@ export interface SelectProps<T = unknown>
128
128
  * @param {any} value The `value` provided to the component.
129
129
  * @returns {ReactNode}
130
130
  */
131
- renderValue?: (value: T) => React.ReactNode;
131
+ renderValue?: (value: Value) => React.ReactNode;
132
132
  /**
133
133
  * Props applied to the clickable div element.
134
134
  */
@@ -144,7 +144,7 @@ export interface SelectProps<T = unknown>
144
144
  * If the value is an object it must have reference equality with the option in order to be selected.
145
145
  * If the value is not an object, the string representation must match with the string representation of the option in order to be selected.
146
146
  */
147
- value?: T | '';
147
+ value?: Value | '';
148
148
  /**
149
149
  * The variant to use.
150
150
  * @default 'outlined'
@@ -163,7 +163,7 @@ export interface SelectProps<T = unknown>
163
163
  * - [Select API](https://mui.com/material-ui/api/select/)
164
164
  * - inherits [OutlinedInput API](https://mui.com/material-ui/api/outlined-input/)
165
165
  */
166
- declare const Select: (<T>(props: SelectProps<T>) => JSX.Element) & {
166
+ declare const Select: (<Value>(props: SelectProps<Value>) => JSX.Element) & {
167
167
  muiName: string;
168
168
  };
169
169
 
package/Select/Select.js CHANGED
@@ -222,7 +222,7 @@ process.env.NODE_ENV !== "production" ? Select.propTypes /* remove-proptypes */
222
222
  /**
223
223
  * Callback fired when a menu item is selected.
224
224
  *
225
- * @param {SelectChangeEvent<T>} event The event source of the callback.
225
+ * @param {SelectChangeEvent<Value>} event The event source of the callback.
226
226
  * You can pull out the new value by accessing `event.target.value` (any).
227
227
  * **Warning**: This is a generic event, not a change event, unless the change event is caused by browser autofill.
228
228
  * @param {object} [child] The react element that was selected when `native` is `false` (default).
@@ -8,11 +8,11 @@ import { MenuProps } from '../Menu';
8
8
  * The type of event depends on what caused the change.
9
9
  * For example, when the browser auto-fills the `Select` you'll receive a `React.ChangeEvent`.
10
10
  */
11
- export type SelectChangeEvent<T = string> =
12
- | (Event & { target: { value: T; name: string } })
11
+ export type SelectChangeEvent<Value = string> =
12
+ | (Event & { target: { value: Value; name: string } })
13
13
  | React.ChangeEvent<HTMLInputElement>;
14
14
 
15
- export interface SelectInputProps<T = unknown> {
15
+ export interface SelectInputProps<Value = unknown> {
16
16
  autoFocus?: boolean;
17
17
  autoWidth: boolean;
18
18
  defaultOpen?: boolean;
@@ -20,24 +20,24 @@ export interface SelectInputProps<T = unknown> {
20
20
  error?: boolean;
21
21
  IconComponent?: React.ElementType;
22
22
  inputRef?: (
23
- ref: HTMLSelectElement | { node: HTMLInputElement; value: SelectInputProps<T>['value'] },
23
+ ref: HTMLSelectElement | { node: HTMLInputElement; value: SelectInputProps<Value>['value'] },
24
24
  ) => void;
25
25
  MenuProps?: Partial<MenuProps>;
26
26
  multiple: boolean;
27
27
  name?: string;
28
28
  native: boolean;
29
29
  onBlur?: React.FocusEventHandler<any>;
30
- onChange?: (event: SelectChangeEvent<T>, child: React.ReactNode) => void;
30
+ onChange?: (event: SelectChangeEvent<Value>, child: React.ReactNode) => void;
31
31
  onClose?: (event: React.SyntheticEvent) => void;
32
32
  onFocus?: React.FocusEventHandler<any>;
33
33
  onOpen?: (event: React.SyntheticEvent) => void;
34
34
  open?: boolean;
35
35
  readOnly?: boolean;
36
- renderValue?: (value: SelectInputProps<T>['value']) => React.ReactNode;
36
+ renderValue?: (value: SelectInputProps<Value>['value']) => React.ReactNode;
37
37
  SelectDisplayProps?: React.HTMLAttributes<HTMLDivElement>;
38
38
  sx?: SxProps<Theme>;
39
39
  tabIndex?: number;
40
- value?: T;
40
+ value?: Value;
41
41
  variant?: 'standard' | 'outlined' | 'filled';
42
42
  }
43
43