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