UNPKG

@material-ui/core

Version:

React components that implement Google's Material Design.

146 lines (116 loc) 4.35 kB
"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 _utils = require("@material-ui/utils"); var _withStyles = _interopRequireDefault(require("../styles/withStyles")); var _helpers = require("../utils/helpers"); var styles = function styles(theme) { return { /* Styles applied to the root element. */ root: { 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) }, /* Styles applied to the root element if `color="primary"`. */ colorPrimary: { color: theme.palette.primary.main }, /* Styles applied to the root element if `color="inherit"`. */ colorInherit: { color: 'inherit' }, /* Styles applied to the inner `component` element if `disableGutters={false}`. */ gutters: { paddingLeft: 16, paddingRight: 16 }, /* Styles applied to the root element if `inset={true}`. */ inset: { paddingLeft: 72 }, /* Styles applied to the root element if `disableSticky={false}`. */ 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, disableGutters = props.disableGutters, disableSticky = props.disableSticky, inset = props.inset, other = (0, _objectWithoutProperties2.default)(props, ["classes", "className", "color", "component", "disableGutters", "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), (0, _defineProperty2.default)(_classNames, classes.gutters, !disableGutters), _classNames), className) }, other)); } process.env.NODE_ENV !== "production" ? ListSubheader.propTypes = { /** * The content of the component. */ children: _propTypes.default.node, /** * Override or extend the styles applied to the component. * See [CSS API](#css-api) below for more details. */ 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: _utils.componentPropType, /** * If `true`, the List Subheader will not have gutters. */ disableGutters: _propTypes.default.bool, /** * 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 } : void 0; ListSubheader.defaultProps = { color: 'default', component: 'li', disableGutters: false, disableSticky: false, inset: false }; ListSubheader.muiName = 'ListSubheader'; var _default = (0, _withStyles.default)(styles, { name: 'MuiListSubheader' })(ListSubheader); exports.default = _default;