Sha256: 9a186d7043de924be2046cfa986cac6cbff367406365c4a265aa7ac846b911a3

Contents?: true

Size: 1.48 KB

Versions: 526

Compression:

Stored size: 1.48 KB

Contents

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

import Badge from '../../pb_badge/_badge'
import FormPill from '../../pb_form_pill/_form_pill'
import { SelectValueType } from '../_typeahead'

type Props = {
  data: SelectValueType,
  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,
    avatarUrl: '',
  }

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

  return (
    <components.MultiValueContainer
      className="text_input_multivalue_container"
      {...props}
    >
      {multiKit === 'badge' &&
        <Badge
          closeProps={removeProps}
          removeIcon
          text={label}
          variant="primary"
        />
      }

      {multiKit !== 'badge' && imageUrl &&
        <FormPill
          avatarUrl={imageUrl}
          closeProps={removeProps}
          marginRight="xs"
          name={label}
          size={multiKit === 'smallPill' ? 'small' : ''}
          text=''
        />
      }

      {multiKit !== 'badge' && !imageUrl &&
        <FormPill
          closeProps={removeProps}
          marginRight="xs"
          name=''
          size={multiKit === 'smallPill' ? 'small' : ''}
          text={label}
        />
      }
    </components.MultiValueContainer>
  )
}

export default MultiValue

Version data entries

526 entries across 526 versions & 1 rubygems

Version Path
playbook_ui-14.2.0.pre.alpha.PLAY15063634 app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx
playbook_ui-14.2.0.pre.alpha.PLAY15063633 app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx
playbook_ui-14.2.0.pre.alpha.fixphonenumberinputflag3632 app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx
playbook_ui-14.2.0.pre.alpha.fixphonenumberinputflag3631 app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx
playbook_ui-14.2.0.pre.alpha.PLAY15063628 app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx
playbook_ui-14.2.0.pre.alpha.PLAY15063626 app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx
playbook_ui-14.2.0.pre.alpha.PLAY15063624 app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx
playbook_ui-14.2.0.pre.alpha.play1432playgroundsanitation3622 app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx
playbook_ui-14.2.0.pre.alpha.PLAY15063621 app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx
playbook_ui-14.2.0.pre.alpha.PLAY15063620 app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx
playbook_ui-14.2.0.pre.alpha.PLAY15063619 app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx
playbook_ui-14.2.0.pre.alpha.PLAY15063618 app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx
playbook_ui-14.3.0.pre.rc.0 app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx
playbook_ui-14.1.0.pre.alpha.PLAY15063617 app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx
playbook_ui-14.1.0.pre.alpha.PLAY15063616 app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx
playbook_ui-14.1.0.pre.alpha.PLAY15063615 app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx
playbook_ui-14.1.0.pre.alpha.PLAY15063614 app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx
playbook_ui-14.1.0.pre.alpha.PLAY15063613 app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx
playbook_ui-14.1.0.pre.alpha.PLAY15063612 app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx
playbook_ui-14.1.0.pre.alpha.PLAY15063610 app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx