1 | import _extends from "@babel/runtime/helpers/esm/extends";
|
2 | import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
3 | import * as React from 'react';
|
4 | import PropTypes from 'prop-types';
|
5 | import clsx from 'clsx';
|
6 | import withStyles from '../styles/withStyles';
|
7 | import ListContext from '../List/ListContext';
|
8 | export const styles = theme => ({
|
9 |
|
10 | root: {
|
11 | minWidth: 56,
|
12 | color: theme.palette.action.active,
|
13 | flexShrink: 0,
|
14 | display: 'inline-flex'
|
15 | },
|
16 |
|
17 |
|
18 | alignItemsFlexStart: {
|
19 | marginTop: 8
|
20 | }
|
21 | });
|
22 |
|
23 |
|
24 |
|
25 |
|
26 | const ListItemIcon = React.forwardRef(function ListItemIcon(props, ref) {
|
27 | const {
|
28 | classes,
|
29 | className
|
30 | } = props,
|
31 | other = _objectWithoutPropertiesLoose(props, ["classes", "className"]);
|
32 |
|
33 | const context = React.useContext(ListContext);
|
34 | return React.createElement("div", _extends({
|
35 | className: clsx(classes.root, className, context.alignItems === 'flex-start' && classes.alignItemsFlexStart),
|
36 | ref: ref
|
37 | }, other));
|
38 | });
|
39 | process.env.NODE_ENV !== "production" ? ListItemIcon.propTypes = {
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 | |
46 |
|
47 |
|
48 |
|
49 | children: PropTypes.node,
|
50 |
|
51 | |
52 |
|
53 |
|
54 |
|
55 | classes: PropTypes.object,
|
56 |
|
57 | |
58 |
|
59 |
|
60 | className: PropTypes.string
|
61 | } : void 0;
|
62 | export default withStyles(styles, {
|
63 | name: 'MuiListItemIcon'
|
64 | })(ListItemIcon); |
\ | No newline at end of file |