1 | "use strict";
|
2 |
|
3 | var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
4 |
|
5 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
6 |
|
7 | Object.defineProperty(exports, "__esModule", {
|
8 | value: true
|
9 | });
|
10 | exports.default = exports.styles = void 0;
|
11 |
|
12 | var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
13 |
|
14 | var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
15 |
|
16 | var React = _interopRequireWildcard(require("react"));
|
17 |
|
18 | var _propTypes = _interopRequireDefault(require("prop-types"));
|
19 |
|
20 | var _clsx = _interopRequireDefault(require("clsx"));
|
21 |
|
22 | var _withStyles = _interopRequireDefault(require("../styles/withStyles"));
|
23 |
|
24 | var _Typography = _interopRequireDefault(require("../Typography"));
|
25 |
|
26 | var _ListContext = _interopRequireDefault(require("../List/ListContext"));
|
27 |
|
28 | var styles = {
|
29 |
|
30 | root: {
|
31 | flex: '1 1 auto',
|
32 | minWidth: 0,
|
33 | marginTop: 4,
|
34 | marginBottom: 4
|
35 | },
|
36 |
|
37 |
|
38 | multiline: {
|
39 | marginTop: 6,
|
40 | marginBottom: 6
|
41 | },
|
42 |
|
43 |
|
44 | dense: {},
|
45 |
|
46 |
|
47 | inset: {
|
48 | paddingLeft: 56
|
49 | },
|
50 |
|
51 |
|
52 | primary: {},
|
53 |
|
54 |
|
55 | secondary: {}
|
56 | };
|
57 | exports.styles = styles;
|
58 | var ListItemText = React.forwardRef(function ListItemText(props, ref) {
|
59 | var children = props.children,
|
60 | classes = props.classes,
|
61 | className = props.className,
|
62 | _props$disableTypogra = props.disableTypography,
|
63 | disableTypography = _props$disableTypogra === void 0 ? false : _props$disableTypogra,
|
64 | _props$inset = props.inset,
|
65 | inset = _props$inset === void 0 ? false : _props$inset,
|
66 | primaryProp = props.primary,
|
67 | primaryTypographyProps = props.primaryTypographyProps,
|
68 | secondaryProp = props.secondary,
|
69 | secondaryTypographyProps = props.secondaryTypographyProps,
|
70 | other = (0, _objectWithoutProperties2.default)(props, ["children", "classes", "className", "disableTypography", "inset", "primary", "primaryTypographyProps", "secondary", "secondaryTypographyProps"]);
|
71 |
|
72 | var _React$useContext = React.useContext(_ListContext.default),
|
73 | dense = _React$useContext.dense;
|
74 |
|
75 | var primary = primaryProp != null ? primaryProp : children;
|
76 |
|
77 | if (primary != null && primary.type !== _Typography.default && !disableTypography) {
|
78 | primary = React.createElement(_Typography.default, (0, _extends2.default)({
|
79 | variant: dense ? 'body2' : 'body1',
|
80 | className: classes.primary,
|
81 | component: "span",
|
82 | display: "block"
|
83 | }, primaryTypographyProps), primary);
|
84 | }
|
85 |
|
86 | var secondary = secondaryProp;
|
87 |
|
88 | if (secondary != null && secondary.type !== _Typography.default && !disableTypography) {
|
89 | secondary = React.createElement(_Typography.default, (0, _extends2.default)({
|
90 | variant: "body2",
|
91 | className: classes.secondary,
|
92 | color: "textSecondary",
|
93 | display: "block"
|
94 | }, secondaryTypographyProps), secondary);
|
95 | }
|
96 |
|
97 | return React.createElement("div", (0, _extends2.default)({
|
98 | className: (0, _clsx.default)(classes.root, className, dense && classes.dense, inset && classes.inset, primary && secondary && classes.multiline),
|
99 | ref: ref
|
100 | }, other), primary, secondary);
|
101 | });
|
102 | process.env.NODE_ENV !== "production" ? ListItemText.propTypes = {
|
103 |
|
104 |
|
105 |
|
106 |
|
107 |
|
108 | |
109 |
|
110 |
|
111 | children: _propTypes.default.node,
|
112 |
|
113 | |
114 |
|
115 |
|
116 |
|
117 | classes: _propTypes.default.object,
|
118 |
|
119 | |
120 |
|
121 |
|
122 | className: _propTypes.default.string,
|
123 |
|
124 | |
125 |
|
126 |
|
127 |
|
128 |
|
129 |
|
130 | disableTypography: _propTypes.default.bool,
|
131 |
|
132 | |
133 |
|
134 |
|
135 |
|
136 | inset: _propTypes.default.bool,
|
137 |
|
138 | |
139 |
|
140 |
|
141 | primary: _propTypes.default.node,
|
142 |
|
143 | |
144 |
|
145 |
|
146 |
|
147 | primaryTypographyProps: _propTypes.default.object,
|
148 |
|
149 | |
150 |
|
151 |
|
152 | secondary: _propTypes.default.node,
|
153 |
|
154 | |
155 |
|
156 |
|
157 |
|
158 | secondaryTypographyProps: _propTypes.default.object
|
159 | } : void 0;
|
160 |
|
161 | var _default = (0, _withStyles.default)(styles, {
|
162 | name: 'MuiListItemText'
|
163 | })(ListItemText);
|
164 |
|
165 | exports.default = _default; |
\ | No newline at end of file |