Sha256: 22281e75fffddae7c82845fc551ac8a9a50f3dd14ad067bfd8564a90991a136e

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 TableHeadPropTypes = {
  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 TableHead = (props: TableHeadPropTypes): 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_thead", globalProps(props), className);
  const isTableTag = tag === "table";

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

export default TableHead;

Version data entries

465 entries across 465 versions & 1 rubygems

Version Path
playbook_ui-14.2.1.pre.alpha.20240828cikubedbump3702 app/pb_kits/playbook/pb_table/subcomponents/_table_head.tsx
playbook_ui-14.3.0.pre.rc.3 app/pb_kits/playbook/pb_table/subcomponents/_table_head.tsx
playbook_ui-14.2.1.pre.alpha.PBNTR431fixingduplicatingtextareaclassname3689 app/pb_kits/playbook/pb_table/subcomponents/_table_head.tsx
playbook_ui-14.3.0.pre.rc.2 app/pb_kits/playbook/pb_table/subcomponents/_table_head.tsx
playbook_ui-14.2.1.pre.alpha.PLAY1516railsiconsfixedwidth3674 app/pb_kits/playbook/pb_table/subcomponents/_table_head.tsx
playbook_ui-14.2.1.pre.alpha.PBNTR479removeextraspacingfromradiochildren3671 app/pb_kits/playbook/pb_table/subcomponents/_table_head.tsx
playbook_ui-14.3.0.pre.rc.1 app/pb_kits/playbook/pb_table/subcomponents/_table_head.tsx
playbook_ui-14.2.1.pre.alpha.PBNTR479removeextraspacingfromradiochildren3669 app/pb_kits/playbook/pb_table/subcomponents/_table_head.tsx
playbook_ui-14.2.1.pre.alpha.pbntr373enablekitsforradio3665 app/pb_kits/playbook/pb_table/subcomponents/_table_head.tsx
playbook_ui-14.2.1.pre.alpha.bugfixforactionrc3663 app/pb_kits/playbook/pb_table/subcomponents/_table_head.tsx
playbook_ui-14.2.0.pre.alpha.PLAY15063653 app/pb_kits/playbook/pb_table/subcomponents/_table_head.tsx
playbook_ui-14.2.0.pre.alpha.play1490railsdialogdatafix3649 app/pb_kits/playbook/pb_table/subcomponents/_table_head.tsx
playbook_ui-14.2.0.pre.alpha.PLAY15063645 app/pb_kits/playbook/pb_table/subcomponents/_table_head.tsx
playbook_ui-14.2.1 app/pb_kits/playbook/pb_table/subcomponents/_table_head.tsx
playbook_ui-14.2.0.pre.alpha.PLAY15063640 app/pb_kits/playbook/pb_table/subcomponents/_table_head.tsx
playbook_ui-14.2.0.pre.alpha.PLAY15063639 app/pb_kits/playbook/pb_table/subcomponents/_table_head.tsx
playbook_ui-14.2.0.pre.alpha.PLAY15063638 app/pb_kits/playbook/pb_table/subcomponents/_table_head.tsx
playbook_ui-14.2.0.pre.alpha.PLAY15063637 app/pb_kits/playbook/pb_table/subcomponents/_table_head.tsx
playbook_ui-14.2.0.pre.alpha.PLAY15063634 app/pb_kits/playbook/pb_table/subcomponents/_table_head.tsx
playbook_ui-14.2.0.pre.alpha.PLAY15063633 app/pb_kits/playbook/pb_table/subcomponents/_table_head.tsx