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.23.0.pre.cachetest app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.21.0.pre.alpha.lightbox.2 app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.21.0.pre.alpha.lightbox app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.21.0.pre.alpha.rg1 app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.21.0.pre.alpha.jg1 app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.21.0.pre.alpha.na1 app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.21.0.pre.alpha.jd1 app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.20.0 app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.19.0 app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.19.0.pre.lightbox app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.18.2 app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.19.0.pre.popover.alpha1 app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.18.1 app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.18.0 app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.17.0 app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.16.0 app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.15.1 app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.15.1.pre.alpha.rubocop.deps app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.15.0 app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.14.1.pre.alpha2 app/pb_kits/playbook/pb_table/_table.jsx