Sha256: 0bc05adb9cb0cc39bedf14801f3989360e1505587610df22edd029dd003cc619

Contents?: true

Size: 1.32 KB

Versions: 504

Compression:

Stored size: 1.32 KB

Contents

import React from 'react'

import classnames from 'classnames'
import Title from '../pb_title/_title'
import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
import { GlobalProps, globalProps } from '../utilities/globalProps'

type PillProps = {
  aria?: {[key: string]: string},
  className?: string,
  data?: {[key: string]: string},
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
  id?: string,
  text: string,
  variant?: "success" | "warning" | "error" | "info" | "neutral" | "primary",
  textTransform?: "none" | "lowercase"
} & GlobalProps

const Pill = (props: PillProps) => {
  const {
    aria = {},
    className,
    data = {},
    htmlOptions = {},
    id,
    text,
    variant = 'neutral',
    textTransform = 'lowercase',
  } = props

  const ariaProps = buildAriaProps(aria)
  const dataProps = buildDataProps(data)
  const htmlProps = buildHtmlProps(htmlOptions)
  const classes = classnames(buildCss('pb_pill_kit', variant, textTransform), globalProps(props), className)

  return (
    <div
        {...ariaProps}
        {...dataProps}
        {...htmlProps}
        className={classes}
        id={id}
    >
      <Title
          className="pb_pill_text"
          size={4}
          tag="div"
          text={text}
      />
    </div>
  )
}

export default Pill

Version data entries

504 entries across 504 versions & 1 rubygems

Version Path
playbook_ui-14.8.0.pre.alpha.PLAY1649rolloutheightglobalprops4635 app/pb_kits/playbook/pb_pill/_pill.tsx
playbook_ui-14.9.0.pre.rc.8 app/pb_kits/playbook/pb_pill/_pill.tsx
playbook_ui-14.8.0.pre.alpha.PLAY1598floatinguiupgrade4617 app/pb_kits/playbook/pb_pill/_pill.tsx
playbook_ui-14.9.0.pre.rc.7 app/pb_kits/playbook/pb_pill/_pill.tsx
playbook_ui-14.9.0.pre.rc.6 app/pb_kits/playbook/pb_pill/_pill.tsx
playbook_ui-14.9.0.pre.rc.5 app/pb_kits/playbook/pb_pill/_pill.tsx
playbook_ui-14.8.0.pre.alpha.pbntr661createstickyleftprop4612 app/pb_kits/playbook/pb_pill/_pill.tsx
playbook_ui-14.8.0.pre.alpha.play1648heightglobalprops4606 app/pb_kits/playbook/pb_pill/_pill.tsx
playbook_ui-14.9.0.pre.rc.4 app/pb_kits/playbook/pb_pill/_pill.tsx
playbook_ui-14.9.0.pre.rc.3 app/pb_kits/playbook/pb_pill/_pill.tsx
playbook_ui-14.9.0.pre.rc.2 app/pb_kits/playbook/pb_pill/_pill.tsx
playbook_ui-14.8.0.pre.alpha.revert3916revert3893PBNTR667railstypeaheadformintegration4567 app/pb_kits/playbook/pb_pill/_pill.tsx
playbook_ui-14.8.0.pre.alpha.revert3916revert3893PBNTR667railstypeaheadformintegration4565 app/pb_kits/playbook/pb_pill/_pill.tsx
playbook_ui-14.8.0.pre.alpha.PLAY1598floatinguiupgrade4563 app/pb_kits/playbook/pb_pill/_pill.tsx
playbook_ui-14.8.0.pre.alpha.play1648heightglobalprops4559 app/pb_kits/playbook/pb_pill/_pill.tsx
playbook_ui-14.9.0.pre.rc.1 app/pb_kits/playbook/pb_pill/_pill.tsx
playbook_ui-14.8.0.pre.alpha.PLAY16254545 app/pb_kits/playbook/pb_pill/_pill.tsx
playbook_ui-14.8.0.pre.alpha.PLAY1615movenegativetoleftofcurrencysign4543 app/pb_kits/playbook/pb_pill/_pill.tsx
playbook_ui-14.8.0.pre.alpha.PLAY1615movenegativetoleftofcurrencysign4539 app/pb_kits/playbook/pb_pill/_pill.tsx
playbook_ui-14.9.0.pre.rc.0 app/pb_kits/playbook/pb_pill/_pill.tsx