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-11.20.0.pre.alpha.passthrough1 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-11.20.0.pre.alpha.railsdialog1 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-11.20.0.pre.alpha.focus1 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-11.20.0 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-11.19.0.pre.alpha.map1 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-11.19.0.pre.alpha.pagpassthrough1 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-11.19.0 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-11.18.0.pre.alpha.pagutility1 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-11.19.0.pre.typeahead1 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-11.18.0 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-11.17.0 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-11.15.0.pre.alpha.dependencies1 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-11.16.0.pre.alpha.paginationrails1 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-11.16.0 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-11.16.0.pre.alpha.reactupgrade1 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-11.15.0.pre.alpha.table1 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-11.16.0.pre.alpha.pagination.rails1 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-11.15.0 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-11.14.0 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-11.13.0.pre.alpha.fontawesome1 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx