UNPKG

2.96 kBJavaScriptView Raw
1'use client';
2
3import * as React from 'react';
4import PropTypes from 'prop-types';
5import clsx from 'clsx';
6import composeClasses from '@mui/utils/composeClasses';
7import Tablelvl2Context from "../Table/Tablelvl2Context.js";
8import { styled } from "../zero-styled/index.js";
9import { useDefaultProps } from "../DefaultPropsProvider/index.js";
10import { getTableHeadUtilityClass } from "./tableHeadClasses.js";
11import { jsx as _jsx } from "react/jsx-runtime";
12const useUtilityClasses = ownerState => {
13 const {
14 classes
15 } = ownerState;
16 const slots = {
17 root: ['root']
18 };
19 return composeClasses(slots, getTableHeadUtilityClass, classes);
20};
21const TableHeadRoot = styled('thead', {
22 name: 'MuiTableHead',
23 slot: 'Root',
24 overridesResolver: (props, styles) => styles.root
25})({
26 display: 'table-header-group'
27});
28const tablelvl2 = {
29 variant: 'head'
30};
31const defaultComponent = 'thead';
32const TableHead = /*#__PURE__*/React.forwardRef(function TableHead(inProps, ref) {
33 const props = useDefaultProps({
34 props: inProps,
35 name: 'MuiTableHead'
36 });
37 const {
38 className,
39 component = defaultComponent,
40 ...other
41 } = props;
42 const ownerState = {
43 ...props,
44 component
45 };
46 const classes = useUtilityClasses(ownerState);
47 return /*#__PURE__*/_jsx(Tablelvl2Context.Provider, {
48 value: tablelvl2,
49 children: /*#__PURE__*/_jsx(TableHeadRoot, {
50 as: component,
51 className: clsx(classes.root, className),
52 ref: ref,
53 role: component === defaultComponent ? null : 'rowgroup',
54 ownerState: ownerState,
55 ...other
56 })
57 });
58});
59process.env.NODE_ENV !== "production" ? TableHead.propTypes /* remove-proptypes */ = {
60 // ┌────────────────────────────── Warning ──────────────────────────────┐
61 // │ These PropTypes are generated from the TypeScript type definitions. │
62 // │ To update them, edit the d.ts file and run `pnpm proptypes`. │
63 // └─────────────────────────────────────────────────────────────────────┘
64 /**
65 * The content of the component, normally `TableRow`.
66 */
67 children: PropTypes.node,
68 /**
69 * Override or extend the styles applied to the component.
70 */
71 classes: PropTypes.object,
72 /**
73 * @ignore
74 */
75 className: PropTypes.string,
76 /**
77 * The component used for the root node.
78 * Either a string to use a HTML element or a component.
79 */
80 component: PropTypes.elementType,
81 /**
82 * The system prop that allows defining system overrides as well as additional CSS styles.
83 */
84 sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
85} : void 0;
86export default TableHead;
\No newline at end of file