Sha256: e227c1637956136fd71e48a8a833fce89f7855e95501c7c93be8eba648719b80

Contents?: true

Size: 1.61 KB

Versions: 142

Compression:

Stored size: 1.61 KB

Contents

/* @flow */

import React, { type Node } from 'react'
import classnames from 'classnames'
import { buildAriaProps, buildDataProps } from '../utilities/props'
import { globalProps } from '../utilities/globalProps.js'
import PbTable from './'

type TableProps = {
  aria?: object,
  children: array<Node> | Node,
  className: string,
  collapse?: "sm" | "md" | "lg",
  container: boolean,
  dark?: boolean,
  data?: object,
  dataTable: boolean,
  disableHover: boolean,
  id?: string,
  responsive: "collapse" | "scroll" | "none",
  singleLine: boolean,
  size: "sm" | "md" | "lg",
}

const Table = (props: TableProps) => {
  const {
    aria = {},
    children,
    className,
    collapse = 'sm',
    container = true,
    dark,
    data = {},
    dataTable = false,
    disableHover = false,
    id,
    responsive = 'collapse',
    singleLine = false,
    size = 'sm',
  } = props

  const ariaProps = buildAriaProps(aria)
  const dataProps = buildDataProps(data)
  const tableCollapseCss = responsive !== 'none' ? `table-collapse-${collapse}` : ''

  const instance = new PbTable()
  instance.connect()

  return (
    <table
        {...ariaProps}
        {...dataProps}
        className={classnames(
        'pb_table',
        `table-${size}`,
        `table-responsive-${responsive}`,
        {
          'table-card': container,
          'table-dark': dark,
          'data_table': dataTable,
          'single-line': singleLine,
          'no-hover': disableHover,
        },
        globalProps(props),
        tableCollapseCss,
        className
      )}
        id={id}
    >
      {children}
    </table>
  )
}

export default Table

Version data entries

142 entries across 142 versions & 1 rubygems

Version Path
playbook_ui-10.14.1.pre.alpha1 app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.14.0 app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.13.1 app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.13.0 app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.13.0.pre.node.update app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.12.0 app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.11.0 app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.10.0 app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.9.0 app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.8.1.pre.alpha.flexdeps app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.9.0.pre.alpha1 app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.8.0 app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.7.1 app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.7.0 app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.6.2.pre.alpha.dep app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.6.1.pre.alpha1 app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.6.0 app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.5.0 app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.4.0 app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.3.0 app/pb_kits/playbook/pb_table/_table.jsx