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 capitalize from '../utils/capitalize';
|
8 | export const styles = theme => ({
|
9 |
|
10 | root: {
|
11 | boxSizing: 'border-box',
|
12 | lineHeight: '48px',
|
13 | listStyle: 'none',
|
14 | color: theme.palette.text.secondary,
|
15 | fontFamily: theme.typography.fontFamily,
|
16 | fontWeight: theme.typography.fontWeightMedium,
|
17 | fontSize: theme.typography.pxToRem(14)
|
18 | },
|
19 |
|
20 |
|
21 | colorPrimary: {
|
22 | color: theme.palette.primary.main
|
23 | },
|
24 |
|
25 |
|
26 | colorInherit: {
|
27 | color: 'inherit'
|
28 | },
|
29 |
|
30 |
|
31 | gutters: {
|
32 | paddingLeft: 16,
|
33 | paddingRight: 16
|
34 | },
|
35 |
|
36 |
|
37 | inset: {
|
38 | paddingLeft: 72
|
39 | },
|
40 |
|
41 |
|
42 | sticky: {
|
43 | position: 'sticky',
|
44 | top: 0,
|
45 | zIndex: 1,
|
46 | backgroundColor: 'inherit'
|
47 | }
|
48 | });
|
49 | const ListSubheader = React.forwardRef(function ListSubheader(props, ref) {
|
50 | const {
|
51 | classes,
|
52 | className,
|
53 | color = 'default',
|
54 | component: Component = 'li',
|
55 | disableGutters = false,
|
56 | disableSticky = false,
|
57 | inset = false
|
58 | } = props,
|
59 | other = _objectWithoutPropertiesLoose(props, ["classes", "className", "color", "component", "disableGutters", "disableSticky", "inset"]);
|
60 |
|
61 | return React.createElement(Component, _extends({
|
62 | className: clsx(classes.root, className, color !== 'default' && classes[`color${capitalize(color)}`], inset && classes.inset, !disableSticky && classes.sticky, !disableGutters && classes.gutters),
|
63 | ref: ref
|
64 | }, other));
|
65 | });
|
66 | process.env.NODE_ENV !== "production" ? ListSubheader.propTypes = {
|
67 | |
68 |
|
69 |
|
70 | children: PropTypes.node,
|
71 |
|
72 | |
73 |
|
74 |
|
75 |
|
76 | classes: PropTypes.object.isRequired,
|
77 |
|
78 | |
79 |
|
80 |
|
81 | className: PropTypes.string,
|
82 |
|
83 | |
84 |
|
85 |
|
86 | color: PropTypes.oneOf(['default', 'primary', 'inherit']),
|
87 |
|
88 | |
89 |
|
90 |
|
91 |
|
92 | component: PropTypes
|
93 |
|
94 | .elementType,
|
95 |
|
96 | |
97 |
|
98 |
|
99 | disableGutters: PropTypes.bool,
|
100 |
|
101 | |
102 |
|
103 |
|
104 | disableSticky: PropTypes.bool,
|
105 |
|
106 | |
107 |
|
108 |
|
109 | inset: PropTypes.bool
|
110 | } : void 0;
|
111 | export default withStyles(styles, {
|
112 | name: 'MuiListSubheader'
|
113 | })(ListSubheader); |
\ | No newline at end of file |