UNPKG

4.44 kBJavaScriptView Raw
1"use strict";
2
3var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
4
5var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
6
7Object.defineProperty(exports, "__esModule", {
8 value: true
9});
10exports.default = exports.styles = void 0;
11
12var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
14var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
15
16var React = _interopRequireWildcard(require("react"));
17
18var _propTypes = _interopRequireDefault(require("prop-types"));
19
20var _clsx = _interopRequireDefault(require("clsx"));
21
22var _withStyles = _interopRequireDefault(require("../styles/withStyles"));
23
24var _capitalize = _interopRequireDefault(require("../utils/capitalize"));
25
26var styles = function styles(theme) {
27 return {
28 /* Styles applied to the root element. */
29 root: {
30 boxSizing: 'border-box',
31 lineHeight: '48px',
32 listStyle: 'none',
33 color: theme.palette.text.secondary,
34 fontFamily: theme.typography.fontFamily,
35 fontWeight: theme.typography.fontWeightMedium,
36 fontSize: theme.typography.pxToRem(14)
37 },
38
39 /* Styles applied to the root element if `color="primary"`. */
40 colorPrimary: {
41 color: theme.palette.primary.main
42 },
43
44 /* Styles applied to the root element if `color="inherit"`. */
45 colorInherit: {
46 color: 'inherit'
47 },
48
49 /* Styles applied to the inner `component` element if `disableGutters={false}`. */
50 gutters: {
51 paddingLeft: 16,
52 paddingRight: 16
53 },
54
55 /* Styles applied to the root element if `inset={true}`. */
56 inset: {
57 paddingLeft: 72
58 },
59
60 /* Styles applied to the root element if `disableSticky={false}`. */
61 sticky: {
62 position: 'sticky',
63 top: 0,
64 zIndex: 1,
65 backgroundColor: 'inherit'
66 }
67 };
68};
69
70exports.styles = styles;
71var ListSubheader = /*#__PURE__*/React.forwardRef(function ListSubheader(props, ref) {
72 var classes = props.classes,
73 className = props.className,
74 _props$color = props.color,
75 color = _props$color === void 0 ? 'default' : _props$color,
76 _props$component = props.component,
77 Component = _props$component === void 0 ? 'li' : _props$component,
78 _props$disableGutters = props.disableGutters,
79 disableGutters = _props$disableGutters === void 0 ? false : _props$disableGutters,
80 _props$disableSticky = props.disableSticky,
81 disableSticky = _props$disableSticky === void 0 ? false : _props$disableSticky,
82 _props$inset = props.inset,
83 inset = _props$inset === void 0 ? false : _props$inset,
84 other = (0, _objectWithoutProperties2.default)(props, ["classes", "className", "color", "component", "disableGutters", "disableSticky", "inset"]);
85 return /*#__PURE__*/React.createElement(Component, (0, _extends2.default)({
86 className: (0, _clsx.default)(classes.root, className, color !== 'default' && classes["color".concat((0, _capitalize.default)(color))], inset && classes.inset, !disableSticky && classes.sticky, !disableGutters && classes.gutters),
87 ref: ref
88 }, other));
89});
90process.env.NODE_ENV !== "production" ? ListSubheader.propTypes = {
91 /**
92 * The content of the component.
93 */
94 children: _propTypes.default.node,
95
96 /**
97 * Override or extend the styles applied to the component.
98 * See [CSS API](#css) below for more details.
99 */
100 classes: _propTypes.default.object.isRequired,
101
102 /**
103 * @ignore
104 */
105 className: _propTypes.default.string,
106
107 /**
108 * The color of the component. It supports those theme colors that make sense for this component.
109 */
110 color: _propTypes.default.oneOf(['default', 'primary', 'inherit']),
111
112 /**
113 * The component used for the root node.
114 * Either a string to use a HTML element or a component.
115 */
116 component: _propTypes.default
117 /* @typescript-to-proptypes-ignore */
118 .elementType,
119
120 /**
121 * If `true`, the List Subheader will not have gutters.
122 */
123 disableGutters: _propTypes.default.bool,
124
125 /**
126 * If `true`, the List Subheader will not stick to the top during scroll.
127 */
128 disableSticky: _propTypes.default.bool,
129
130 /**
131 * If `true`, the List Subheader will be indented.
132 */
133 inset: _propTypes.default.bool
134} : void 0;
135
136var _default = (0, _withStyles.default)(styles, {
137 name: 'MuiListSubheader'
138})(ListSubheader);
139
140exports.default = _default;
\No newline at end of file