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