Sha256: 931f86c6c80f7ca815942521a4c21bb4d08b87de33661c7b37567d89cabab444

Contents?: true

Size: 1.38 KB

Versions: 674

Compression:

Stored size: 1.38 KB

Contents

import React from 'react'
import classnames from 'classnames'
import { globalProps } from '../utilities/globalProps'

import { buildAriaProps, buildDataProps, buildHtmlProps } from '../utilities/props'

import Pill from '../pb_pill/_pill'
import Caption from '../pb_caption/_caption'

type LabelPillProps = {
  aria?: {[key: string]:string},
  className?: string,
  data?: {[key: string]:string},
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
  id?: string,
  label?: string,
  pillValue?: string,
  variant: "error" | "info" | "neutral" | "primary" | "success" | "warning",
}

const LabelPill = (props: LabelPillProps) => {
  const {
    aria = {},
    className,
    data = {},
    htmlOptions = {},
    id,
    label,
    pillValue,
    variant = 'neutral',
  } = props
  const ariaProps = buildAriaProps(aria)
  const dataProps = buildDataProps(data)
  const htmlProps = buildHtmlProps(htmlOptions)
  const css = classnames(
    'pb_label_pill_kit',
    globalProps(props),
    className
  )

  return (
    <div
        {...ariaProps}
        {...dataProps}
        {...htmlProps}
        className={css}
        id={id}
    >
      <Caption
          className="pb_label_pill_label"
          text={label}
      />

      <Pill
          className="pb_label_pill_pill"
          text={pillValue}
          variant={variant}
      />
    </div>
  )
}

export default LabelPill

Version data entries

674 entries across 674 versions & 1 rubygems

Version Path
playbook_ui-14.12.0.pre.alpha.play1790darkaudittable5802 app/pb_kits/playbook/pb_label_pill/_label_pill.tsx
playbook_ui-14.12.0.pre.alpha.play1752updatecontenttag5801 app/pb_kits/playbook/pb_label_pill/_label_pill.tsx
playbook_ui-14.13.0.pre.rc.6 app/pb_kits/playbook/pb_label_pill/_label_pill.tsx
playbook_ui-14.13.0.pre.rc.5 app/pb_kits/playbook/pb_label_pill/_label_pill.tsx
playbook_ui-14.12.0.pre.alpha.PLAY1602lightboxoverlapnitrobug5781 app/pb_kits/playbook/pb_label_pill/_label_pill.tsx
playbook_ui-14.13.0.pre.rc.4 app/pb_kits/playbook/pb_label_pill/_label_pill.tsx
playbook_ui-14.12.0.pre.alpha.playrailsinputmaskissue5775 app/pb_kits/playbook/pb_label_pill/_label_pill.tsx
playbook_ui-14.12.0.pre.alpha.PBNTR456fixedconftoastrailsautoclose5757 app/pb_kits/playbook/pb_label_pill/_label_pill.tsx
playbook_ui-14.12.0.pre.alpha.PBNTR456fixedconftoastrailsautoclose5754 app/pb_kits/playbook/pb_label_pill/_label_pill.tsx
playbook_ui-14.12.0.pre.alpha.PLAY1602lightboxoverlapnitrobugzindextoken5751 app/pb_kits/playbook/pb_label_pill/_label_pill.tsx
playbook_ui-14.12.0.pre.alpha.PBNTR456fixedconftoastrailsautoclose5738 app/pb_kits/playbook/pb_label_pill/_label_pill.tsx
playbook_ui-14.13.0.pre.rc.3 app/pb_kits/playbook/pb_label_pill/_label_pill.tsx
playbook_ui-14.12.0.pre.alpha.PLAY1865reactdatepickerreinitializingbug5732 app/pb_kits/playbook/pb_label_pill/_label_pill.tsx
playbook_ui-14.12.0.pre.alpha.PBNTR456fixedconftoastrailsautoclose5728 app/pb_kits/playbook/pb_label_pill/_label_pill.tsx
playbook_ui-14.12.0.pre.alpha.play1862buttondisabledlinkbug5716 app/pb_kits/playbook/pb_label_pill/_label_pill.tsx
playbook_ui-14.12.0.pre.alpha.play1862buttondisabledlinkbug5714 app/pb_kits/playbook/pb_label_pill/_label_pill.tsx
playbook_ui-14.13.0.pre.rc.2 app/pb_kits/playbook/pb_label_pill/_label_pill.tsx
playbook_ui-14.13.0.pre.rc.1 app/pb_kits/playbook/pb_label_pill/_label_pill.tsx
playbook_ui-14.13.0.pre.rc.0 app/pb_kits/playbook/pb_label_pill/_label_pill.tsx
playbook_ui-14.12.0.pre.alpha.advancedtablealignmentfixes5693 app/pb_kits/playbook/pb_label_pill/_label_pill.tsx