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-10.13.1 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-10.13.0 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-10.13.0.pre.node.update app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-10.12.0 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-10.11.0 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-10.10.0 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-10.9.0 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-10.8.1.pre.alpha.flexdeps app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-10.9.0.pre.alpha1 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-10.8.0 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-10.7.1 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-10.7.0 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-10.6.2.pre.alpha.dep app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-10.6.1.pre.alpha1 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-10.6.0 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-10.5.0 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-10.4.0 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-10.3.0 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-10.2.1.alpha.sisensefix app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
playbook_ui-10.2.1 app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx