Sha256: 94d6c6f74d46c0a07675f58844265b49e1cf3e36752f2fc20f0baeee3d37bbd2

Contents?: true

Size: 1.42 KB

Versions: 465

Compression:

Stored size: 1.42 KB

Contents

import React from "react";
import classnames from "classnames";
import {
  buildAriaProps,
  buildDataProps,
  buildHtmlProps,
} from "../../utilities/props";
import { globalProps } from "../../utilities/globalProps";

type TableBodyPropTypes = {
  aria?: { [key: string]: string };
  children: React.ReactNode[] | React.ReactNode;
  className: string;
  data?: { [key: string]: string };
  htmlOptions?: { [key: string]: string | number | boolean | (() => void) };
  id?: string;
  tag?: "table" | "div";
};

const TableBody = (props: TableBodyPropTypes): React.ReactElement => {
  const {
    aria = {},
    children,
    className,
    data = {},
    htmlOptions = {},
    id,
    tag = "table",
  } = props;

  const ariaProps = buildAriaProps(aria);
  const dataProps = buildDataProps(data);
  const htmlProps = buildHtmlProps(htmlOptions);
  const classes = classnames("pb_table_tbody", globalProps(props), className);
  const isTableTag = tag === "table";

  return (
    <>
      {isTableTag ? (
        <tbody
            {...ariaProps}
            {...dataProps}
            {...htmlProps}
            className={classes}
            id={id}
        >
          {children}
        </tbody>
      ) : (
        <div
            {...ariaProps}
            {...dataProps}
            {...htmlProps}
            className={classes}
            id={id}
        >
          {children}
        </div>
      )}
    </>
  );
};

export default TableBody;

Version data entries

465 entries across 465 versions & 1 rubygems

Version Path
playbook_ui-14.0.0.pre.alpha.PLAY15063511 app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx
playbook_ui-14.0.0.pre.alpha.PA1477timestampkit3509 app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx
playbook_ui-14.0.0.pre.alpha.PLAY14733507 app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx
playbook_ui-14.0.0.pre.alpha.PBNTR416formpillsizes3506 app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx
playbook_ui-14.0.0.pre.alpha.PA1477timestampkit3502 app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx
playbook_ui-14.0.0.pre.alpha.PBNTR415starratingform3493 app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx
playbook_ui-14.0.0.pre.alpha.PBNTR415starratingform3492 app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx
playbook_ui-14.0.0.pre.alpha.PLAY1475bumpaxecoredependency3483 app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx
playbook_ui-14.0.0.pre.alpha.PLAY14733479 app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx
playbook_ui-14.0.0.pre.alpha.dependabotnpmandyarnreactjoyride2823478 app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx
playbook_ui-14.0.0.pre.alpha.PLAY14113475 app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx
playbook_ui-14.0.0.pre.alpha.play1447alphatest3462 app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx
playbook_ui-14.1.0 app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx
playbook_ui-13.34.1.pre.alpha.PLAY14633399 app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx
playbook_ui-13.33.0.pre.alpha.PLAY14143318 app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx
playbook_ui-13.33.0.pre.alpha.PLAY14143312 app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx
playbook_ui-13.33.0.pre.alpha.PBNTR405dropdownformfixesrails3311 app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx
playbook_ui-13.33.0.pre.alpha.PLAY1454formpillicons3309 app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx
playbook_ui-13.33.0.pre.alpha.PLAY14143306 app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx
playbook_ui-13.33.0.pre.alpha.PLAY14143305 app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx