Debian Codegraph @

node/@patternfly/react-table/src/components/Table/Tbody.tsx

raw
1 import { forwardRef } from 'react';
2 import { css } from '@patternfly/react-styles';
3 import styles from '@patternfly/react-styles/css/components/Table/table';
4
5 export interface TbodyProps extends React.HTMLProps<HTMLTableSectionElement> {
6 /** Content rendered inside the <tbody> row group */
7 children?: React.ReactNode;
8 /** Additional classes added to the <tbody> element */
9 className?: string;
10 /** Modifies the body to allow for expandable rows */
11 isExpanded?: boolean;
12 /** @hide Forwarded ref */
13 innerRef?: React.Ref<any>;
14 /** Flag indicating the <tbody> contains oddly striped rows. */
15 isOddStriped?: boolean;
16 /** Flag indicating the <tbody> contains evenly striped rows. */
17 isEvenStriped?: boolean;
18 }
19
20 const TbodyBase: React.FunctionComponent<TbodyProps> = ({
21 children,
22 className,
23 isExpanded,
24 innerRef,
25 isEvenStriped = false,
26 isOddStriped = false,
27 ...props
28 }: TbodyProps) => (
29 <tbody
30 role="rowgroup"
31 className={css(
32 styles.tableTbody,
33 className,
34 isExpanded && styles.modifiers.expanded,
35 isOddStriped && styles.modifiers.striped,
36 isEvenStriped && styles.modifiers.stripedEven
37 )}
38 ref={innerRef}
39 {...props}
40 >
41 {children}
42 </tbody>
43 );
44
45 export const Tbody = forwardRef((props: TbodyProps, ref: React.Ref<HTMLTableSectionElement>) => (
46 <TbodyBase {...props} innerRef={ref} />
47 ));
48 Tbody.displayName = 'Tbody';