1 | import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
2 | import _extends from "@babel/runtime/helpers/esm/extends";
|
3 | import * as React from 'react';
|
4 | import PropTypes from 'prop-types';
|
5 | import clsx from 'clsx';
|
6 | import { unstable_composeClasses as composeClasses } from '@mui/base';
|
7 | import styled from '../styles/styled';
|
8 | import useThemeProps from '../styles/useThemeProps';
|
9 | import capitalize from '../utils/capitalize';
|
10 | import { getListSubheaderUtilityClass } from './listSubheaderClasses';
|
11 | import { jsx as _jsx } from "react/jsx-runtime";
|
12 |
|
13 | var useUtilityClasses = function useUtilityClasses(ownerState) {
|
14 | var classes = ownerState.classes,
|
15 | color = ownerState.color,
|
16 | disableGutters = ownerState.disableGutters,
|
17 | inset = ownerState.inset,
|
18 | disableSticky = ownerState.disableSticky;
|
19 | var slots = {
|
20 | root: ['root', color !== 'default' && "color".concat(capitalize(color)), !disableGutters && 'gutters', inset && 'inset', !disableSticky && 'sticky']
|
21 | };
|
22 | return composeClasses(slots, getListSubheaderUtilityClass, classes);
|
23 | };
|
24 |
|
25 | var ListSubheaderRoot = styled('li', {
|
26 | name: 'MuiListSubheader',
|
27 | slot: 'Root',
|
28 | overridesResolver: function overridesResolver(props, styles) {
|
29 | var ownerState = props.ownerState;
|
30 | return [styles.root, ownerState.color !== 'default' && styles["color".concat(capitalize(ownerState.color))], !ownerState.disableGutters && styles.gutters, ownerState.inset && styles.inset, !ownerState.disableSticky && styles.sticky];
|
31 | }
|
32 | })(function (_ref) {
|
33 | var theme = _ref.theme,
|
34 | ownerState = _ref.ownerState;
|
35 | return _extends({
|
36 | boxSizing: 'border-box',
|
37 | lineHeight: '48px',
|
38 | listStyle: 'none',
|
39 | color: (theme.vars || theme).palette.text.secondary,
|
40 | fontFamily: theme.typography.fontFamily,
|
41 | fontWeight: theme.typography.fontWeightMedium,
|
42 | fontSize: theme.typography.pxToRem(14)
|
43 | }, ownerState.color === 'primary' && {
|
44 | color: (theme.vars || theme).palette.primary.main
|
45 | }, ownerState.color === 'inherit' && {
|
46 | color: 'inherit'
|
47 | }, !ownerState.disableGutters && {
|
48 | paddingLeft: 16,
|
49 | paddingRight: 16
|
50 | }, ownerState.inset && {
|
51 | paddingLeft: 72
|
52 | }, !ownerState.disableSticky && {
|
53 | position: 'sticky',
|
54 | top: 0,
|
55 | zIndex: 1,
|
56 | backgroundColor: (theme.vars || theme).palette.background.paper
|
57 | });
|
58 | });
|
59 | var ListSubheader = React.forwardRef(function ListSubheader(inProps, ref) {
|
60 | var props = useThemeProps({
|
61 | props: inProps,
|
62 | name: 'MuiListSubheader'
|
63 | });
|
64 |
|
65 | var className = props.className,
|
66 | _props$color = props.color,
|
67 | color = _props$color === void 0 ? 'default' : _props$color,
|
68 | _props$component = props.component,
|
69 | component = _props$component === void 0 ? 'li' : _props$component,
|
70 | _props$disableGutters = props.disableGutters,
|
71 | disableGutters = _props$disableGutters === void 0 ? false : _props$disableGutters,
|
72 | _props$disableSticky = props.disableSticky,
|
73 | disableSticky = _props$disableSticky === void 0 ? false : _props$disableSticky,
|
74 | _props$inset = props.inset,
|
75 | inset = _props$inset === void 0 ? false : _props$inset,
|
76 | other = _objectWithoutProperties(props, ["className", "color", "component", "disableGutters", "disableSticky", "inset"]);
|
77 |
|
78 | var ownerState = _extends({}, props, {
|
79 | color: color,
|
80 | component: component,
|
81 | disableGutters: disableGutters,
|
82 | disableSticky: disableSticky,
|
83 | inset: inset
|
84 | });
|
85 |
|
86 | var classes = useUtilityClasses(ownerState);
|
87 | return _jsx(ListSubheaderRoot, _extends({
|
88 | as: component,
|
89 | className: clsx(classes.root, className),
|
90 | ref: ref,
|
91 | ownerState: ownerState
|
92 | }, other));
|
93 | });
|
94 | process.env.NODE_ENV !== "production" ? ListSubheader.propTypes
|
95 |
|
96 | = {
|
97 |
|
98 |
|
99 |
|
100 |
|
101 |
|
102 | |
103 |
|
104 |
|
105 | children: PropTypes.node,
|
106 |
|
107 | |
108 |
|
109 |
|
110 | classes: PropTypes.object,
|
111 |
|
112 | |
113 |
|
114 |
|
115 | className: PropTypes.string,
|
116 |
|
117 | |
118 |
|
119 |
|
120 |
|
121 | color: PropTypes.oneOf(['default', 'inherit', 'primary']),
|
122 |
|
123 | |
124 |
|
125 |
|
126 |
|
127 | component: PropTypes.elementType,
|
128 |
|
129 | |
130 |
|
131 |
|
132 |
|
133 | disableGutters: PropTypes.bool,
|
134 |
|
135 | |
136 |
|
137 |
|
138 |
|
139 | disableSticky: PropTypes.bool,
|
140 |
|
141 | |
142 |
|
143 |
|
144 |
|
145 | inset: PropTypes.bool,
|
146 |
|
147 | |
148 |
|
149 |
|
150 | sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
151 | } : void 0;
|
152 | export default ListSubheader; |
\ | No newline at end of file |