Sha256: 97525f929d926e0cfae8798d9573ad06f43c4a9f2b1e74bccba4a7572a0c0921

Contents?: true

Size: 1.43 KB

Versions: 231

Compression:

Stored size: 1.43 KB

Contents

/* @flow */

import React from 'react'
import { components } from 'react-select'

import Badge from '../../pb_badge/_badge'
import FormPill from '../../pb_form_pill/_form_pill'

type Props = {
  data: object,
  multiValueTemplate: any,
  removeProps: any,
  selectProps: any,
}

const MultiValue = (props: Props) => {
  const { removeProps } = props
  const { imageUrl, label } = props.data
  const { multiKit } = props.selectProps

  const formPillProps = {
    marginRight: 'xs',
    name: label,
  }

  if (typeof imageUrl === 'string') formPillProps.avatarUrl = imageUrl

  return (
    <components.MultiValueContainer
        className="text_input_multivalue_container"
        {...props}
    >
      <If condition={multiKit === 'badge'}>
        <Badge
            closeProps={removeProps}
            removeIcon
            text={label}
            variant="primary"
        />
        <Else />
        <If condition={imageUrl}>
          <FormPill
              avatarUrl={imageUrl}
              closeProps={removeProps}
              marginRight="xs"
              name={label}
              size={multiKit === 'smallPill' ? 'small' : ''}
          />
          <Else />
          <FormPill
              closeProps={removeProps}
              marginRight="xs"
              size={multiKit === 'smallPill' ? 'small' : ''}
              text={label}
          />
        </If>
      </If>
    </components.MultiValueContainer>
  )
}

export default MultiValue

Version data entries

231 entries across 231 versions & 1 rubygems

Version Path
playbook_ui-12.6.0.pre.alpha.sectionseparator1 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-12.6.0.pre.alpha.menuyml1 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-12.6.0.pre.alpha.collapsible1 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-12.6.0.pre.alpha.cssphone1 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-12.6.0 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-12.5.0.pre.alpha.datepickerinput1 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-12.5.0.pre.alpha.phonerails1 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-12.5.0.pre.alpha.datepicker1 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-12.5.0.pre.alpha.filter1 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-12.5.0 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-12.4.0.pre.alpha.map1 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-12.4.0.pre.alpha.devdocstest1 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-12.4.0 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-12.3.1.pre.alpha.phone1 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-12.3.1 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-12.3.0.pre.alpha.patchtest1 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-12.3.0 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-12.2.0 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-12.1.0 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-12.0.0 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx