UNPKG

1.77 kBJavaScriptView Raw
1import _extends from "@babel/runtime/helpers/esm/extends";
2import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3import * as React from 'react';
4import PropTypes from 'prop-types';
5import clsx from 'clsx';
6import withStyles from '../styles/withStyles';
7import Tablelvl2Context from '../Table/Tablelvl2Context';
8export const styles = {
9 /* Styles applied to the root element. */
10 root: {
11 display: 'table-header-group'
12 }
13};
14const tablelvl2 = {
15 variant: 'head'
16};
17const defaultComponent = 'thead';
18const TableHead = /*#__PURE__*/React.forwardRef(function TableHead(props, ref) {
19 const {
20 classes,
21 className,
22 component: Component = defaultComponent
23 } = props,
24 other = _objectWithoutPropertiesLoose(props, ["classes", "className", "component"]);
25
26 return /*#__PURE__*/React.createElement(Tablelvl2Context.Provider, {
27 value: tablelvl2
28 }, /*#__PURE__*/React.createElement(Component, _extends({
29 className: clsx(classes.root, className),
30 ref: ref,
31 role: Component === defaultComponent ? null : 'rowgroup'
32 }, other)));
33});
34process.env.NODE_ENV !== "production" ? TableHead.propTypes = {
35 /**
36 * The content of the component, normally `TableRow`.
37 */
38 children: PropTypes.node,
39
40 /**
41 * Override or extend the styles applied to the component.
42 * See [CSS API](#css) below for more details.
43 */
44 classes: PropTypes.object.isRequired,
45
46 /**
47 * @ignore
48 */
49 className: PropTypes.string,
50
51 /**
52 * The component used for the root node.
53 * Either a string to use a HTML element or a component.
54 */
55 component: PropTypes
56 /* @typescript-to-proptypes-ignore */
57 .elementType
58} : void 0;
59export default withStyles(styles, {
60 name: 'MuiTableHead'
61})(TableHead);
\No newline at end of file