@mui/material 5.15.8 → 5.15.10
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/Autocomplete/Autocomplete.js +6 -9
- package/Avatar/Avatar.d.ts +23 -1
- package/Avatar/Avatar.js +37 -10
- package/CHANGELOG.md +86 -0
- package/Divider/Divider.d.ts +1 -1
- package/Divider/Divider.js +1 -1
- package/TableRow/TableRow.d.ts +1 -1
- package/TableRow/TableRow.js +1 -1
- package/TextField/TextField.d.ts +2 -2
- package/index.js +1 -1
- package/legacy/Autocomplete/Autocomplete.js +5 -5
- package/legacy/Avatar/Avatar.js +43 -10
- package/legacy/Divider/Divider.js +1 -1
- package/legacy/TableRow/TableRow.js +1 -1
- package/legacy/index.js +1 -1
- package/modern/Autocomplete/Autocomplete.js +6 -9
- package/modern/Avatar/Avatar.js +37 -10
- package/modern/Divider/Divider.js +1 -1
- package/modern/TableRow/TableRow.js +1 -1
- package/modern/index.js +1 -1
- package/node/Autocomplete/Autocomplete.js +7 -10
- package/node/Avatar/Avatar.js +37 -10
- package/node/Divider/Divider.js +1 -1
- package/node/TableRow/TableRow.js +1 -1
- package/node/index.js +1 -1
- package/package.json +7 -8
- package/styles/experimental_extendTheme.d.ts +9 -8
- package/umd/material-ui.development.js +48 -18
- package/umd/material-ui.production.min.js +2 -2
|
@@ -4,8 +4,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
4
4
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
5
5
|
var _ClearIcon, _ArrowDropDownIcon;
|
|
6
6
|
const _excluded = ["autoComplete", "autoHighlight", "autoSelect", "blurOnSelect", "ChipProps", "className", "clearIcon", "clearOnBlur", "clearOnEscape", "clearText", "closeText", "componentsProps", "defaultValue", "disableClearable", "disableCloseOnSelect", "disabled", "disabledItemsFocusable", "disableListWrap", "disablePortal", "filterOptions", "filterSelectedOptions", "forcePopupIcon", "freeSolo", "fullWidth", "getLimitTagsText", "getOptionDisabled", "getOptionKey", "getOptionLabel", "isOptionEqualToValue", "groupBy", "handleHomeEndKeys", "id", "includeInputInList", "inputValue", "limitTags", "ListboxComponent", "ListboxProps", "loading", "loadingText", "multiple", "noOptionsText", "onChange", "onClose", "onHighlightChange", "onInputChange", "onOpen", "open", "openOnFocus", "openText", "options", "PaperComponent", "PopperComponent", "popupIcon", "readOnly", "renderGroup", "renderInput", "renderOption", "renderTags", "selectOnFocus", "size", "slotProps", "value"],
|
|
7
|
-
_excluded2 = ["ref"]
|
|
8
|
-
_excluded3 = ["key"];
|
|
7
|
+
_excluded2 = ["ref"];
|
|
9
8
|
import * as React from 'react';
|
|
10
9
|
import PropTypes from 'prop-types';
|
|
11
10
|
import clsx from 'clsx';
|
|
@@ -30,6 +29,7 @@ import capitalize from '../utils/capitalize';
|
|
|
30
29
|
import useForkRef from '../utils/useForkRef';
|
|
31
30
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
32
31
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
32
|
+
import { createElement as _createElement } from "react";
|
|
33
33
|
const useUtilityClasses = ownerState => {
|
|
34
34
|
const {
|
|
35
35
|
classes,
|
|
@@ -528,13 +528,10 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(inProps
|
|
|
528
528
|
}, params.key);
|
|
529
529
|
const renderGroup = renderGroupProp || defaultRenderGroup;
|
|
530
530
|
const defaultRenderOption = (props2, option) => {
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
return /*#__PURE__*/_jsx("li", _extends({}, otherProps, {
|
|
536
|
-
children: getOptionLabel(option)
|
|
537
|
-
}), key);
|
|
531
|
+
// Need to clearly apply key because of https://github.com/vercel/next.js/issues/55642
|
|
532
|
+
return /*#__PURE__*/_createElement("li", _extends({}, props2, {
|
|
533
|
+
key: props2.key
|
|
534
|
+
}), getOptionLabel(option));
|
|
538
535
|
};
|
|
539
536
|
const renderOption = renderOptionProp || defaultRenderOption;
|
|
540
537
|
const renderListOption = (option, index) => {
|
package/Avatar/Avatar.d.ts
CHANGED
|
@@ -4,9 +4,30 @@ import { OverridableStringUnion } from '@mui/types';
|
|
|
4
4
|
import { Theme } from '../styles';
|
|
5
5
|
import { OverridableComponent, OverrideProps } from '../OverridableComponent';
|
|
6
6
|
import { AvatarClasses } from './avatarClasses';
|
|
7
|
+
import { CreateSlotsAndSlotProps, SlotProps } from '../utils/types';
|
|
8
|
+
|
|
9
|
+
export interface AvatarSlots {
|
|
10
|
+
/**
|
|
11
|
+
* The component that renders the transition.
|
|
12
|
+
* [Follow this guide](/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component.
|
|
13
|
+
* @default Collapse
|
|
14
|
+
*/
|
|
15
|
+
img?: React.JSXElementConstructor<React.ImgHTMLAttributes<HTMLImageElement>>;
|
|
16
|
+
}
|
|
7
17
|
|
|
8
18
|
export interface AvatarPropsVariantOverrides {}
|
|
9
19
|
|
|
20
|
+
export type AvatarSlotsAndSlotProps = CreateSlotsAndSlotProps<
|
|
21
|
+
AvatarSlots,
|
|
22
|
+
{
|
|
23
|
+
img: SlotProps<
|
|
24
|
+
React.ElementType<React.ImgHTMLAttributes<HTMLImageElement>>,
|
|
25
|
+
{},
|
|
26
|
+
AvatarOwnProps
|
|
27
|
+
>;
|
|
28
|
+
}
|
|
29
|
+
>;
|
|
30
|
+
|
|
10
31
|
export interface AvatarOwnProps {
|
|
11
32
|
/**
|
|
12
33
|
* Used in combination with `src` or `srcSet` to
|
|
@@ -25,6 +46,7 @@ export interface AvatarOwnProps {
|
|
|
25
46
|
/**
|
|
26
47
|
* [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attributes) applied to the `img` element if the component is used to display an image.
|
|
27
48
|
* It can be used to listen for the loading error event.
|
|
49
|
+
* @deprecated Use `slotProps.img` instead. This prop will be removed in v7. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/).
|
|
28
50
|
*/
|
|
29
51
|
imgProps?: React.ImgHTMLAttributes<HTMLImageElement> & {
|
|
30
52
|
sx?: SxProps<Theme>;
|
|
@@ -57,7 +79,7 @@ export interface AvatarTypeMap<
|
|
|
57
79
|
AdditionalProps = {},
|
|
58
80
|
RootComponent extends React.ElementType = 'div',
|
|
59
81
|
> {
|
|
60
|
-
props: AdditionalProps & AvatarOwnProps;
|
|
82
|
+
props: AdditionalProps & AvatarOwnProps & AvatarSlotsAndSlotProps;
|
|
61
83
|
defaultComponent: RootComponent;
|
|
62
84
|
}
|
|
63
85
|
|
package/Avatar/Avatar.js
CHANGED
|
@@ -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 = ["alt", "children", "className", "component", "imgProps", "sizes", "src", "srcSet", "variant"];
|
|
5
|
+
const _excluded = ["alt", "children", "className", "component", "slots", "slotProps", "imgProps", "sizes", "src", "srcSet", "variant"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import clsx from 'clsx';
|
|
@@ -11,6 +11,7 @@ import styled from '../styles/styled';
|
|
|
11
11
|
import useThemeProps from '../styles/useThemeProps';
|
|
12
12
|
import Person from '../internal/svg-icons/Person';
|
|
13
13
|
import { getAvatarUtilityClass } from './avatarClasses';
|
|
14
|
+
import useSlot from '../utils/useSlot';
|
|
14
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
16
|
const useUtilityClasses = ownerState => {
|
|
16
17
|
const {
|
|
@@ -150,6 +151,8 @@ const Avatar = /*#__PURE__*/React.forwardRef(function Avatar(inProps, ref) {
|
|
|
150
151
|
children: childrenProp,
|
|
151
152
|
className,
|
|
152
153
|
component = 'div',
|
|
154
|
+
slots = {},
|
|
155
|
+
slotProps = {},
|
|
153
156
|
imgProps,
|
|
154
157
|
sizes,
|
|
155
158
|
src,
|
|
@@ -172,16 +175,25 @@ const Avatar = /*#__PURE__*/React.forwardRef(function Avatar(inProps, ref) {
|
|
|
172
175
|
variant
|
|
173
176
|
});
|
|
174
177
|
const classes = useUtilityClasses(ownerState);
|
|
178
|
+
const [ImgSlot, imgSlotProps] = useSlot('img', {
|
|
179
|
+
className: classes.img,
|
|
180
|
+
elementType: AvatarImg,
|
|
181
|
+
externalForwardedProps: {
|
|
182
|
+
slots,
|
|
183
|
+
slotProps: {
|
|
184
|
+
img: _extends({}, imgProps, slotProps.img)
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
additionalProps: {
|
|
188
|
+
alt,
|
|
189
|
+
src,
|
|
190
|
+
srcSet,
|
|
191
|
+
sizes
|
|
192
|
+
},
|
|
193
|
+
ownerState
|
|
194
|
+
});
|
|
175
195
|
if (hasImgNotFailing) {
|
|
176
|
-
children = /*#__PURE__*/_jsx(
|
|
177
|
-
alt: alt,
|
|
178
|
-
srcSet: srcSet,
|
|
179
|
-
src: src,
|
|
180
|
-
sizes: sizes,
|
|
181
|
-
ownerState: ownerState,
|
|
182
|
-
className: classes.img
|
|
183
|
-
}, imgProps));
|
|
184
|
-
|
|
196
|
+
children = /*#__PURE__*/_jsx(ImgSlot, _extends({}, imgSlotProps));
|
|
185
197
|
// We only render valid children, non valid children are rendered with a fallback
|
|
186
198
|
// We consider that invalid children are all falsy values, except 0, which is valid.
|
|
187
199
|
} else if (!!childrenProp || childrenProp === 0) {
|
|
@@ -234,12 +246,27 @@ process.env.NODE_ENV !== "production" ? Avatar.propTypes /* remove-proptypes */
|
|
|
234
246
|
/**
|
|
235
247
|
* [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attributes) applied to the `img` element if the component is used to display an image.
|
|
236
248
|
* It can be used to listen for the loading error event.
|
|
249
|
+
* @deprecated Use `slotProps.img` instead. This prop will be removed in v7. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/).
|
|
237
250
|
*/
|
|
238
251
|
imgProps: PropTypes.object,
|
|
239
252
|
/**
|
|
240
253
|
* The `sizes` attribute for the `img` element.
|
|
241
254
|
*/
|
|
242
255
|
sizes: PropTypes.string,
|
|
256
|
+
/**
|
|
257
|
+
* The props used for each slot inside.
|
|
258
|
+
* @default {}
|
|
259
|
+
*/
|
|
260
|
+
slotProps: PropTypes.shape({
|
|
261
|
+
img: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
|
262
|
+
}),
|
|
263
|
+
/**
|
|
264
|
+
* The components used for each slot inside.
|
|
265
|
+
* @default {}
|
|
266
|
+
*/
|
|
267
|
+
slots: PropTypes.shape({
|
|
268
|
+
img: PropTypes.elementType
|
|
269
|
+
}),
|
|
243
270
|
/**
|
|
244
271
|
* The `src` attribute for the `img` element.
|
|
245
272
|
*/
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,91 @@
|
|
|
1
1
|
# [Versions](https://mui.com/versions/)
|
|
2
2
|
|
|
3
|
+
## v5.15.10
|
|
4
|
+
|
|
5
|
+
<!-- generated comparing v5.15.9..master -->
|
|
6
|
+
|
|
7
|
+
_Feb 12, 2024_
|
|
8
|
+
|
|
9
|
+
A big thanks to the 8 contributors who made this release possible.
|
|
10
|
+
This release was mostly about 🐛 bug fixes and 📚 documentation improvements.
|
|
11
|
+
|
|
12
|
+
### `@mui/material@5.15.10`
|
|
13
|
+
|
|
14
|
+
- [Avatar] Add props deprecation with a codemod (#40853) @siriwatknp
|
|
15
|
+
|
|
16
|
+
### `@mui/system@5.15.10`
|
|
17
|
+
|
|
18
|
+
- [Stack] Update import statement for Stack component (#41032) @sai6855
|
|
19
|
+
|
|
20
|
+
### `@mui/joy@5.0.0-beta.28`
|
|
21
|
+
|
|
22
|
+
- [Button] Fix `disabled` prop priority when inside button group (#41000) @Smileek
|
|
23
|
+
- [IconButton] Support loading prop (#40949) @Smileek
|
|
24
|
+
|
|
25
|
+
### Docs
|
|
26
|
+
|
|
27
|
+
- [Button][material-ui] Fix 'File upload' demo a11y (#40943) @oliviertassinari
|
|
28
|
+
- [TableRow][material-ui] Escape markup in `children` prop so docgen tools don't parse it as HTML (#40992) @millerized
|
|
29
|
+
- [material-ui] Remove outdated example projects link (it uses Joy UI now) (#40913) @oliviertassinari
|
|
30
|
+
- [material-ui] Fix the "Intro to the MUI ecosystem" link placement (#40988) @danilo-leal
|
|
31
|
+
- Fix 301 redirection to StackBlitz @oliviertassinari
|
|
32
|
+
- Fix h1 on Joy UI templates @oliviertassinari
|
|
33
|
+
- Have MUI workspace own the CodeSandbox @oliviertassinari
|
|
34
|
+
- Add notification for mui x v7 beta (#41001) @joserodolfofreitas
|
|
35
|
+
- Fix 301 links @oliviertassinari
|
|
36
|
+
- Fix Next.js v13.5.1 <title> SEO regression (#40302) @oliviertassinari
|
|
37
|
+
- Add a 404 page (#40884) @danilo-leal
|
|
38
|
+
- Fix missing GitHub label when opening new issue @oliviertassinari
|
|
39
|
+
|
|
40
|
+
### Core
|
|
41
|
+
|
|
42
|
+
- [blog] Add post about upcoming plans for Base UI (#40882) @danilo-leal
|
|
43
|
+
- [core] Simplify CodeSandbox reproduction @oliviertassinari
|
|
44
|
+
- [core] Missing redirection @oliviertassinari
|
|
45
|
+
- [core] Export functions from `copyFiles` script to reuse in MUI X repo (#40970) @cherniavskii
|
|
46
|
+
- [core] Avoid variable shorthands @oliviertassinari
|
|
47
|
+
- [docs-infra] Fix search icon issue (#40957) @oliviertassinari
|
|
48
|
+
- [docs-infra] Ignore classes tagged with `@ignore` (#41009) @cherniavskii
|
|
49
|
+
- [docs-infra] Fix selected tab on codeblocks (#41036) @danilo-leal
|
|
50
|
+
- [website] Polish Customer Support Agent role @oliviertassinari
|
|
51
|
+
|
|
52
|
+
All contributors of this release in alphabetical order: @cherniavskii, @danilo-leal, @joserodolfofreitas, @millerized, @oliviertassinari, @sai6855, @siriwatknp, @Smileek
|
|
53
|
+
|
|
54
|
+
## v5.15.9<!-- generated comparing v5.15.8..master -->
|
|
55
|
+
|
|
56
|
+
_Feb 8, 2024_
|
|
57
|
+
|
|
58
|
+
A big thanks to the 7 contributors who made this release possible. Here are some highlights ✨:
|
|
59
|
+
|
|
60
|
+
- 🐛 A critical fix to remove non-published library usage in `@mui/material` peerDependencies.
|
|
61
|
+
|
|
62
|
+
### `@mui/material@5.15.9`
|
|
63
|
+
|
|
64
|
+
- ​<!-- 11 -->[autocomplete] Avoid spread operator (#40968) @oliviertassinari
|
|
65
|
+
- ​<!-- 05 -->[material] Remove zero-runtime from peer dep (#41003) @brijeshb42
|
|
66
|
+
|
|
67
|
+
### `@mui/base@5.0.0-beta.36`
|
|
68
|
+
|
|
69
|
+
- ​<!-- 10 -->[base-ui] Update props using Array to ReadonlyArray type (#40754) @RaghavenderSingh
|
|
70
|
+
|
|
71
|
+
### `@mui/system@5.15.9`
|
|
72
|
+
|
|
73
|
+
- ​<!-- 02 -->[system] use `ReadonlyArray` for CSS related types (#40972) @siriwatknp
|
|
74
|
+
- ​<!-- 01 -->[zero] Migrate to use wyw-in-js instead of linaria (#40866) @brijeshb42
|
|
75
|
+
|
|
76
|
+
### Docs
|
|
77
|
+
|
|
78
|
+
- ​<!-- 06 -->[docs] Polish codemod git diff format @oliviertassinari
|
|
79
|
+
- ​<!-- 05 -->[material-ui][docs] Migrating from deprecated apis follow up (#40981) @DiegoAndai
|
|
80
|
+
|
|
81
|
+
### Core
|
|
82
|
+
|
|
83
|
+
- ​<!-- 09 -->[code-infra] Move next config to ESM (#40869) @Janpot
|
|
84
|
+
- ​<!-- 08 -->[code-infra] Update prettier (#40772) @Janpot
|
|
85
|
+
- ​<!-- 07 -->[code-infra] Add codemod for `light` prop removal (#40947) @sai6855
|
|
86
|
+
|
|
87
|
+
All contributors of this release in alphabetical order: @brijeshb42, @DiegoAndai, @Janpot, @oliviertassinari, @RaghavenderSingh, @sai6855, @siriwatknp
|
|
88
|
+
|
|
3
89
|
## v5.15.8<!-- generated comparing v5.15.7..master -->
|
|
4
90
|
|
|
5
91
|
_Feb 6, 2024_
|
package/Divider/Divider.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ export interface DividerOwnProps {
|
|
|
30
30
|
/**
|
|
31
31
|
* If `true`, the divider will have a lighter color.
|
|
32
32
|
* @default false
|
|
33
|
-
* @deprecated Use <Divider sx={{
|
|
33
|
+
* @deprecated Use <Divider sx={{ opacity: 0.6 }} /> (or any opacity or color) instead. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/)
|
|
34
34
|
*/
|
|
35
35
|
light?: boolean;
|
|
36
36
|
/**
|
package/Divider/Divider.js
CHANGED
|
@@ -221,7 +221,7 @@ process.env.NODE_ENV !== "production" ? Divider.propTypes /* remove-proptypes */
|
|
|
221
221
|
/**
|
|
222
222
|
* If `true`, the divider will have a lighter color.
|
|
223
223
|
* @default false
|
|
224
|
-
* @deprecated Use <Divider sx={{
|
|
224
|
+
* @deprecated Use <Divider sx={{ opacity: 0.6 }} /> (or any opacity or color) instead. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/)
|
|
225
225
|
*/
|
|
226
226
|
light: PropTypes.bool,
|
|
227
227
|
/**
|
package/TableRow/TableRow.d.ts
CHANGED
package/TableRow/TableRow.js
CHANGED
|
@@ -93,7 +93,7 @@ process.env.NODE_ENV !== "production" ? TableRow.propTypes /* remove-proptypes *
|
|
|
93
93
|
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
94
94
|
// └─────────────────────────────────────────────────────────────────────┘
|
|
95
95
|
/**
|
|
96
|
-
* Should be valid
|
|
96
|
+
* Should be valid `<tr>` children such as `TableCell`.
|
|
97
97
|
*/
|
|
98
98
|
children: PropTypes.node,
|
|
99
99
|
/**
|
package/TextField/TextField.d.ts
CHANGED
|
@@ -232,8 +232,8 @@ export type TextFieldProps<Variant extends TextFieldVariants = TextFieldVariants
|
|
|
232
232
|
Variant extends 'filled'
|
|
233
233
|
? FilledTextFieldProps
|
|
234
234
|
: Variant extends 'standard'
|
|
235
|
-
|
|
236
|
-
|
|
235
|
+
? StandardTextFieldProps
|
|
236
|
+
: OutlinedTextFieldProps;
|
|
237
237
|
|
|
238
238
|
/**
|
|
239
239
|
* The `TextField` is a convenience wrapper for the most common cases (80%).
|
package/index.js
CHANGED
|
@@ -28,6 +28,7 @@ import capitalize from '../utils/capitalize';
|
|
|
28
28
|
import useForkRef from '../utils/useForkRef';
|
|
29
29
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
30
30
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
31
|
+
import { createElement as _createElement } from "react";
|
|
31
32
|
var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
32
33
|
var classes = ownerState.classes,
|
|
33
34
|
disablePortal = ownerState.disablePortal,
|
|
@@ -539,11 +540,10 @@ var Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(inProps,
|
|
|
539
540
|
};
|
|
540
541
|
var renderGroup = renderGroupProp || defaultRenderGroup;
|
|
541
542
|
var defaultRenderOption = function defaultRenderOption(props2, option) {
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
}), key);
|
|
543
|
+
// Need to clearly apply key because of https://github.com/vercel/next.js/issues/55642
|
|
544
|
+
return /*#__PURE__*/_createElement("li", _extends({}, props2, {
|
|
545
|
+
key: props2.key
|
|
546
|
+
}), getOptionLabel(option));
|
|
547
547
|
};
|
|
548
548
|
var renderOption = renderOptionProp || defaultRenderOption;
|
|
549
549
|
var renderListOption = function renderListOption(option, index) {
|
package/legacy/Avatar/Avatar.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
5
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
5
6
|
import * as React from 'react';
|
|
@@ -10,6 +11,7 @@ import styled from '../styles/styled';
|
|
|
10
11
|
import useThemeProps from '../styles/useThemeProps';
|
|
11
12
|
import Person from '../internal/svg-icons/Person';
|
|
12
13
|
import { getAvatarUtilityClass } from './avatarClasses';
|
|
14
|
+
import useSlot from '../utils/useSlot';
|
|
13
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
16
|
var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
15
17
|
var classes = ownerState.classes,
|
|
@@ -151,13 +153,17 @@ var Avatar = /*#__PURE__*/React.forwardRef(function Avatar(inProps, ref) {
|
|
|
151
153
|
className = props.className,
|
|
152
154
|
_props$component = props.component,
|
|
153
155
|
component = _props$component === void 0 ? 'div' : _props$component,
|
|
156
|
+
_props$slots = props.slots,
|
|
157
|
+
slots = _props$slots === void 0 ? {} : _props$slots,
|
|
158
|
+
_props$slotProps = props.slotProps,
|
|
159
|
+
slotProps = _props$slotProps === void 0 ? {} : _props$slotProps,
|
|
154
160
|
imgProps = props.imgProps,
|
|
155
161
|
sizes = props.sizes,
|
|
156
162
|
src = props.src,
|
|
157
163
|
srcSet = props.srcSet,
|
|
158
164
|
_props$variant = props.variant,
|
|
159
165
|
variant = _props$variant === void 0 ? 'circular' : _props$variant,
|
|
160
|
-
other = _objectWithoutProperties(props, ["alt", "children", "className", "component", "imgProps", "sizes", "src", "srcSet", "variant"]);
|
|
166
|
+
other = _objectWithoutProperties(props, ["alt", "children", "className", "component", "slots", "slotProps", "imgProps", "sizes", "src", "srcSet", "variant"]);
|
|
161
167
|
var children = null;
|
|
162
168
|
|
|
163
169
|
// Use a hook instead of onError on the img element to support server-side rendering.
|
|
@@ -173,16 +179,28 @@ var Avatar = /*#__PURE__*/React.forwardRef(function Avatar(inProps, ref) {
|
|
|
173
179
|
variant: variant
|
|
174
180
|
});
|
|
175
181
|
var classes = useUtilityClasses(ownerState);
|
|
182
|
+
var _useSlot = useSlot('img', {
|
|
183
|
+
className: classes.img,
|
|
184
|
+
elementType: AvatarImg,
|
|
185
|
+
externalForwardedProps: {
|
|
186
|
+
slots: slots,
|
|
187
|
+
slotProps: {
|
|
188
|
+
img: _extends({}, imgProps, slotProps.img)
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
additionalProps: {
|
|
192
|
+
alt: alt,
|
|
193
|
+
src: src,
|
|
194
|
+
srcSet: srcSet,
|
|
195
|
+
sizes: sizes
|
|
196
|
+
},
|
|
197
|
+
ownerState: ownerState
|
|
198
|
+
}),
|
|
199
|
+
_useSlot2 = _slicedToArray(_useSlot, 2),
|
|
200
|
+
ImgSlot = _useSlot2[0],
|
|
201
|
+
imgSlotProps = _useSlot2[1];
|
|
176
202
|
if (hasImgNotFailing) {
|
|
177
|
-
children = /*#__PURE__*/_jsx(
|
|
178
|
-
alt: alt,
|
|
179
|
-
srcSet: srcSet,
|
|
180
|
-
src: src,
|
|
181
|
-
sizes: sizes,
|
|
182
|
-
ownerState: ownerState,
|
|
183
|
-
className: classes.img
|
|
184
|
-
}, imgProps));
|
|
185
|
-
|
|
203
|
+
children = /*#__PURE__*/_jsx(ImgSlot, _extends({}, imgSlotProps));
|
|
186
204
|
// We only render valid children, non valid children are rendered with a fallback
|
|
187
205
|
// We consider that invalid children are all falsy values, except 0, which is valid.
|
|
188
206
|
} else if (!!childrenProp || childrenProp === 0) {
|
|
@@ -235,12 +253,27 @@ process.env.NODE_ENV !== "production" ? Avatar.propTypes /* remove-proptypes */
|
|
|
235
253
|
/**
|
|
236
254
|
* [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attributes) applied to the `img` element if the component is used to display an image.
|
|
237
255
|
* It can be used to listen for the loading error event.
|
|
256
|
+
* @deprecated Use `slotProps.img` instead. This prop will be removed in v7. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/).
|
|
238
257
|
*/
|
|
239
258
|
imgProps: PropTypes.object,
|
|
240
259
|
/**
|
|
241
260
|
* The `sizes` attribute for the `img` element.
|
|
242
261
|
*/
|
|
243
262
|
sizes: PropTypes.string,
|
|
263
|
+
/**
|
|
264
|
+
* The props used for each slot inside.
|
|
265
|
+
* @default {}
|
|
266
|
+
*/
|
|
267
|
+
slotProps: PropTypes.shape({
|
|
268
|
+
img: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
|
269
|
+
}),
|
|
270
|
+
/**
|
|
271
|
+
* The components used for each slot inside.
|
|
272
|
+
* @default {}
|
|
273
|
+
*/
|
|
274
|
+
slots: PropTypes.shape({
|
|
275
|
+
img: PropTypes.elementType
|
|
276
|
+
}),
|
|
244
277
|
/**
|
|
245
278
|
* The `src` attribute for the `img` element.
|
|
246
279
|
*/
|
|
@@ -226,7 +226,7 @@ process.env.NODE_ENV !== "production" ? Divider.propTypes /* remove-proptypes */
|
|
|
226
226
|
/**
|
|
227
227
|
* If `true`, the divider will have a lighter color.
|
|
228
228
|
* @default false
|
|
229
|
-
* @deprecated Use <Divider sx={{
|
|
229
|
+
* @deprecated Use <Divider sx={{ opacity: 0.6 }} /> (or any opacity or color) instead. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/)
|
|
230
230
|
*/
|
|
231
231
|
light: PropTypes.bool,
|
|
232
232
|
/**
|
|
@@ -89,7 +89,7 @@ process.env.NODE_ENV !== "production" ? TableRow.propTypes /* remove-proptypes *
|
|
|
89
89
|
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
90
90
|
// └─────────────────────────────────────────────────────────────────────┘
|
|
91
91
|
/**
|
|
92
|
-
* Should be valid
|
|
92
|
+
* Should be valid `<tr>` children such as `TableCell`.
|
|
93
93
|
*/
|
|
94
94
|
children: PropTypes.node,
|
|
95
95
|
/**
|
package/legacy/index.js
CHANGED
|
@@ -4,8 +4,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
4
4
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
5
5
|
var _ClearIcon, _ArrowDropDownIcon;
|
|
6
6
|
const _excluded = ["autoComplete", "autoHighlight", "autoSelect", "blurOnSelect", "ChipProps", "className", "clearIcon", "clearOnBlur", "clearOnEscape", "clearText", "closeText", "componentsProps", "defaultValue", "disableClearable", "disableCloseOnSelect", "disabled", "disabledItemsFocusable", "disableListWrap", "disablePortal", "filterOptions", "filterSelectedOptions", "forcePopupIcon", "freeSolo", "fullWidth", "getLimitTagsText", "getOptionDisabled", "getOptionKey", "getOptionLabel", "isOptionEqualToValue", "groupBy", "handleHomeEndKeys", "id", "includeInputInList", "inputValue", "limitTags", "ListboxComponent", "ListboxProps", "loading", "loadingText", "multiple", "noOptionsText", "onChange", "onClose", "onHighlightChange", "onInputChange", "onOpen", "open", "openOnFocus", "openText", "options", "PaperComponent", "PopperComponent", "popupIcon", "readOnly", "renderGroup", "renderInput", "renderOption", "renderTags", "selectOnFocus", "size", "slotProps", "value"],
|
|
7
|
-
_excluded2 = ["ref"]
|
|
8
|
-
_excluded3 = ["key"];
|
|
7
|
+
_excluded2 = ["ref"];
|
|
9
8
|
import * as React from 'react';
|
|
10
9
|
import PropTypes from 'prop-types';
|
|
11
10
|
import clsx from 'clsx';
|
|
@@ -30,6 +29,7 @@ import capitalize from '../utils/capitalize';
|
|
|
30
29
|
import useForkRef from '../utils/useForkRef';
|
|
31
30
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
32
31
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
32
|
+
import { createElement as _createElement } from "react";
|
|
33
33
|
const useUtilityClasses = ownerState => {
|
|
34
34
|
const {
|
|
35
35
|
classes,
|
|
@@ -524,13 +524,10 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(inProps
|
|
|
524
524
|
}, params.key);
|
|
525
525
|
const renderGroup = renderGroupProp || defaultRenderGroup;
|
|
526
526
|
const defaultRenderOption = (props2, option) => {
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
return /*#__PURE__*/_jsx("li", _extends({}, otherProps, {
|
|
532
|
-
children: getOptionLabel(option)
|
|
533
|
-
}), key);
|
|
527
|
+
// Need to clearly apply key because of https://github.com/vercel/next.js/issues/55642
|
|
528
|
+
return /*#__PURE__*/_createElement("li", _extends({}, props2, {
|
|
529
|
+
key: props2.key
|
|
530
|
+
}), getOptionLabel(option));
|
|
534
531
|
};
|
|
535
532
|
const renderOption = renderOptionProp || defaultRenderOption;
|
|
536
533
|
const renderListOption = (option, index) => {
|
package/modern/Avatar/Avatar.js
CHANGED
|
@@ -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 = ["alt", "children", "className", "component", "imgProps", "sizes", "src", "srcSet", "variant"];
|
|
5
|
+
const _excluded = ["alt", "children", "className", "component", "slots", "slotProps", "imgProps", "sizes", "src", "srcSet", "variant"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import clsx from 'clsx';
|
|
@@ -11,6 +11,7 @@ import styled from '../styles/styled';
|
|
|
11
11
|
import useThemeProps from '../styles/useThemeProps';
|
|
12
12
|
import Person from '../internal/svg-icons/Person';
|
|
13
13
|
import { getAvatarUtilityClass } from './avatarClasses';
|
|
14
|
+
import useSlot from '../utils/useSlot';
|
|
14
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
16
|
const useUtilityClasses = ownerState => {
|
|
16
17
|
const {
|
|
@@ -150,6 +151,8 @@ const Avatar = /*#__PURE__*/React.forwardRef(function Avatar(inProps, ref) {
|
|
|
150
151
|
children: childrenProp,
|
|
151
152
|
className,
|
|
152
153
|
component = 'div',
|
|
154
|
+
slots = {},
|
|
155
|
+
slotProps = {},
|
|
153
156
|
imgProps,
|
|
154
157
|
sizes,
|
|
155
158
|
src,
|
|
@@ -172,16 +175,25 @@ const Avatar = /*#__PURE__*/React.forwardRef(function Avatar(inProps, ref) {
|
|
|
172
175
|
variant
|
|
173
176
|
});
|
|
174
177
|
const classes = useUtilityClasses(ownerState);
|
|
178
|
+
const [ImgSlot, imgSlotProps] = useSlot('img', {
|
|
179
|
+
className: classes.img,
|
|
180
|
+
elementType: AvatarImg,
|
|
181
|
+
externalForwardedProps: {
|
|
182
|
+
slots,
|
|
183
|
+
slotProps: {
|
|
184
|
+
img: _extends({}, imgProps, slotProps.img)
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
additionalProps: {
|
|
188
|
+
alt,
|
|
189
|
+
src,
|
|
190
|
+
srcSet,
|
|
191
|
+
sizes
|
|
192
|
+
},
|
|
193
|
+
ownerState
|
|
194
|
+
});
|
|
175
195
|
if (hasImgNotFailing) {
|
|
176
|
-
children = /*#__PURE__*/_jsx(
|
|
177
|
-
alt: alt,
|
|
178
|
-
srcSet: srcSet,
|
|
179
|
-
src: src,
|
|
180
|
-
sizes: sizes,
|
|
181
|
-
ownerState: ownerState,
|
|
182
|
-
className: classes.img
|
|
183
|
-
}, imgProps));
|
|
184
|
-
|
|
196
|
+
children = /*#__PURE__*/_jsx(ImgSlot, _extends({}, imgSlotProps));
|
|
185
197
|
// We only render valid children, non valid children are rendered with a fallback
|
|
186
198
|
// We consider that invalid children are all falsy values, except 0, which is valid.
|
|
187
199
|
} else if (!!childrenProp || childrenProp === 0) {
|
|
@@ -234,12 +246,27 @@ process.env.NODE_ENV !== "production" ? Avatar.propTypes /* remove-proptypes */
|
|
|
234
246
|
/**
|
|
235
247
|
* [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attributes) applied to the `img` element if the component is used to display an image.
|
|
236
248
|
* It can be used to listen for the loading error event.
|
|
249
|
+
* @deprecated Use `slotProps.img` instead. This prop will be removed in v7. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/).
|
|
237
250
|
*/
|
|
238
251
|
imgProps: PropTypes.object,
|
|
239
252
|
/**
|
|
240
253
|
* The `sizes` attribute for the `img` element.
|
|
241
254
|
*/
|
|
242
255
|
sizes: PropTypes.string,
|
|
256
|
+
/**
|
|
257
|
+
* The props used for each slot inside.
|
|
258
|
+
* @default {}
|
|
259
|
+
*/
|
|
260
|
+
slotProps: PropTypes.shape({
|
|
261
|
+
img: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
|
262
|
+
}),
|
|
263
|
+
/**
|
|
264
|
+
* The components used for each slot inside.
|
|
265
|
+
* @default {}
|
|
266
|
+
*/
|
|
267
|
+
slots: PropTypes.shape({
|
|
268
|
+
img: PropTypes.elementType
|
|
269
|
+
}),
|
|
243
270
|
/**
|
|
244
271
|
* The `src` attribute for the `img` element.
|
|
245
272
|
*/
|
|
@@ -221,7 +221,7 @@ process.env.NODE_ENV !== "production" ? Divider.propTypes /* remove-proptypes */
|
|
|
221
221
|
/**
|
|
222
222
|
* If `true`, the divider will have a lighter color.
|
|
223
223
|
* @default false
|
|
224
|
-
* @deprecated Use <Divider sx={{
|
|
224
|
+
* @deprecated Use <Divider sx={{ opacity: 0.6 }} /> (or any opacity or color) instead. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/)
|
|
225
225
|
*/
|
|
226
226
|
light: PropTypes.bool,
|
|
227
227
|
/**
|
|
@@ -93,7 +93,7 @@ process.env.NODE_ENV !== "production" ? TableRow.propTypes /* remove-proptypes *
|
|
|
93
93
|
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
94
94
|
// └─────────────────────────────────────────────────────────────────────┘
|
|
95
95
|
/**
|
|
96
|
-
* Should be valid
|
|
96
|
+
* Should be valid `<tr>` children such as `TableCell`.
|
|
97
97
|
*/
|
|
98
98
|
children: PropTypes.node,
|
|
99
99
|
/**
|
package/modern/index.js
CHANGED