Sha256: 94d6c6f74d46c0a07675f58844265b49e1cf3e36752f2fc20f0baeee3d37bbd2

Contents?: true

Size: 1.42 KB

Versions: 495

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

495 entries across 495 versions & 1 rubygems

Version Path
playbook_ui-14.3.0 app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx
playbook_ui-14.3.0.pre.rc.12 app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx
playbook_ui-14.3.0.pre.rc.11 app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx
playbook_ui-14.3.0.pre.rc.10 app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx
playbook_ui-14.3.0.pre.rc.9 app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx
playbook_ui-14.3.0.pre.rc.8 app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx
playbook_ui-14.3.0.pre.rc.7 app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx
playbook_ui-14.3.0.pre.rc.6 app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx
playbook_ui-14.3.0.pre.rc.5 app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx
playbook_ui-14.3.0.pre.rc.4 app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx
playbook_ui-14.2.1.pre.alpha.20240828cikubedbump3702 app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx
playbook_ui-14.3.0.pre.rc.3 app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx
playbook_ui-14.2.1.pre.alpha.PBNTR431fixingduplicatingtextareaclassname3689 app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx
playbook_ui-14.3.0.pre.rc.2 app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx
playbook_ui-14.2.1.pre.alpha.PLAY1516railsiconsfixedwidth3674 app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx
playbook_ui-14.2.1.pre.alpha.PBNTR479removeextraspacingfromradiochildren3671 app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx
playbook_ui-14.3.0.pre.rc.1 app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx
playbook_ui-14.2.1.pre.alpha.PBNTR479removeextraspacingfromradiochildren3669 app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx
playbook_ui-14.2.1.pre.alpha.pbntr373enablekitsforradio3665 app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx
playbook_ui-14.2.1.pre.alpha.bugfixforactionrc3663 app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx