1 | 'use client';
|
2 |
|
3 | import * as React from 'react';
|
4 | import PropTypes from 'prop-types';
|
5 | import clsx from 'clsx';
|
6 | import composeClasses from '@mui/utils/composeClasses';
|
7 | import ListContext from "../List/ListContext.js";
|
8 | import { styled } from "../zero-styled/index.js";
|
9 | import { useDefaultProps } from "../DefaultPropsProvider/index.js";
|
10 | import { getListItemAvatarUtilityClass } from "./listItemAvatarClasses.js";
|
11 | import { jsx as _jsx } from "react/jsx-runtime";
|
12 | const useUtilityClasses = ownerState => {
|
13 | const {
|
14 | alignItems,
|
15 | classes
|
16 | } = ownerState;
|
17 | const slots = {
|
18 | root: ['root', alignItems === 'flex-start' && 'alignItemsFlexStart']
|
19 | };
|
20 | return composeClasses(slots, getListItemAvatarUtilityClass, classes);
|
21 | };
|
22 | const ListItemAvatarRoot = styled('div', {
|
23 | name: 'MuiListItemAvatar',
|
24 | slot: 'Root',
|
25 | overridesResolver: (props, styles) => {
|
26 | const {
|
27 | ownerState
|
28 | } = props;
|
29 | return [styles.root, ownerState.alignItems === 'flex-start' && styles.alignItemsFlexStart];
|
30 | }
|
31 | })({
|
32 | minWidth: 56,
|
33 | flexShrink: 0,
|
34 | variants: [{
|
35 | props: {
|
36 | alignItems: 'flex-start'
|
37 | },
|
38 | style: {
|
39 | marginTop: 8
|
40 | }
|
41 | }]
|
42 | });
|
43 |
|
44 |
|
45 |
|
46 |
|
47 | const ListItemAvatar = React.forwardRef(function ListItemAvatar(inProps, ref) {
|
48 | const props = useDefaultProps({
|
49 | props: inProps,
|
50 | name: 'MuiListItemAvatar'
|
51 | });
|
52 | const {
|
53 | className,
|
54 | ...other
|
55 | } = props;
|
56 | const context = React.useContext(ListContext);
|
57 | const ownerState = {
|
58 | ...props,
|
59 | alignItems: context.alignItems
|
60 | };
|
61 | const classes = useUtilityClasses(ownerState);
|
62 | return _jsx(ListItemAvatarRoot, {
|
63 | className: clsx(classes.root, className),
|
64 | ownerState: ownerState,
|
65 | ref: ref,
|
66 | ...other
|
67 | });
|
68 | });
|
69 | process.env.NODE_ENV !== "production" ? ListItemAvatar.propTypes = {
|
70 |
|
71 |
|
72 |
|
73 |
|
74 | |
75 |
|
76 |
|
77 | children: PropTypes.node,
|
78 | |
79 |
|
80 |
|
81 | classes: PropTypes.object,
|
82 | |
83 |
|
84 |
|
85 | className: PropTypes.string,
|
86 | |
87 |
|
88 |
|
89 | sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
90 | } : void 0;
|
91 | export default ListItemAvatar; |
\ | No newline at end of file |