121 lines
3.5 KiB
JavaScript
121 lines
3.5 KiB
JavaScript
"use strict";
|
|
|
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.default = exports.styles = void 0;
|
|
|
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
|
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
|
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
|
|
var _react = _interopRequireDefault(require("react"));
|
|
|
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
|
var _withStyles = _interopRequireDefault(require("../styles/withStyles"));
|
|
|
|
var _helpers = require("../utils/helpers");
|
|
|
|
var styles = function styles(theme) {
|
|
return {
|
|
root: theme.mixins.gutters({
|
|
boxSizing: 'border-box',
|
|
lineHeight: '48px',
|
|
listStyle: 'none',
|
|
color: theme.palette.text.secondary,
|
|
fontFamily: theme.typography.fontFamily,
|
|
fontWeight: theme.typography.fontWeightMedium,
|
|
fontSize: theme.typography.pxToRem(14)
|
|
}),
|
|
colorPrimary: {
|
|
color: theme.palette.primary.main
|
|
},
|
|
colorInherit: {
|
|
color: 'inherit'
|
|
},
|
|
inset: {
|
|
paddingLeft: theme.spacing.unit * 9
|
|
},
|
|
sticky: {
|
|
position: 'sticky',
|
|
top: 0,
|
|
zIndex: 1,
|
|
backgroundColor: 'inherit'
|
|
}
|
|
};
|
|
};
|
|
|
|
exports.styles = styles;
|
|
|
|
function ListSubheader(props) {
|
|
var _classNames;
|
|
|
|
var classes = props.classes,
|
|
className = props.className,
|
|
color = props.color,
|
|
Component = props.component,
|
|
disableSticky = props.disableSticky,
|
|
inset = props.inset,
|
|
other = (0, _objectWithoutProperties2.default)(props, ["classes", "className", "color", "component", "disableSticky", "inset"]);
|
|
return _react.default.createElement(Component, (0, _extends2.default)({
|
|
className: (0, _classnames.default)(classes.root, (_classNames = {}, (0, _defineProperty2.default)(_classNames, classes["color".concat((0, _helpers.capitalize)(color))], color !== 'default'), (0, _defineProperty2.default)(_classNames, classes.inset, inset), (0, _defineProperty2.default)(_classNames, classes.sticky, !disableSticky), _classNames), className)
|
|
}, other));
|
|
}
|
|
|
|
ListSubheader.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
/**
|
|
* The content of the component.
|
|
*/
|
|
children: _propTypes.default.node,
|
|
|
|
/**
|
|
* Useful to extend the style applied to components.
|
|
*/
|
|
classes: _propTypes.default.object.isRequired,
|
|
|
|
/**
|
|
* @ignore
|
|
*/
|
|
className: _propTypes.default.string,
|
|
|
|
/**
|
|
* The color of the component. It supports those theme colors that make sense for this component.
|
|
*/
|
|
color: _propTypes.default.oneOf(['default', 'primary', 'inherit']),
|
|
|
|
/**
|
|
* The component used for the root node.
|
|
* Either a string to use a DOM element or a component.
|
|
*/
|
|
component: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.func]),
|
|
|
|
/**
|
|
* If `true`, the List Subheader will not stick to the top during scroll.
|
|
*/
|
|
disableSticky: _propTypes.default.bool,
|
|
|
|
/**
|
|
* If `true`, the List Subheader will be indented.
|
|
*/
|
|
inset: _propTypes.default.bool
|
|
} : {};
|
|
ListSubheader.defaultProps = {
|
|
color: 'default',
|
|
component: 'li',
|
|
disableSticky: false,
|
|
inset: false
|
|
};
|
|
ListSubheader.muiName = 'ListSubheader';
|
|
|
|
var _default = (0, _withStyles.default)(styles, {
|
|
name: 'MuiListSubheader'
|
|
})(ListSubheader);
|
|
|
|
exports.default = _default; |