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-12.30.1.pre.alpha.PLAY906multilevelselectedidsprop916 app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx
playbook_ui-12.30.1.pre.alpha.hovertesting914 app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx
playbook_ui-12.30.1.pre.alpha.PLAY906multilevelselectedidsprop912 app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx
playbook_ui-12.30.1.pre.alpha.PLAY802responsivetitlekit909 app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx
playbook_ui-12.30.0.pre.alpha.PLAY906multilevelselectedidsprop902 app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx
playbook_ui-12.30.1 app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx
playbook_ui-12.30.0 app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx
playbook_ui-12.29.0.pre.alpha.play716popoverkitcloseonclickissue893 app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx
playbook_ui-12.29.0 app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx
playbook_ui-12.28.0.pre.alpha.PLAY863multilevelv2877 app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx
playbook_ui-12.28.0.pre.alpha.PLAY863multilevelv2876 app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx
playbook_ui-12.28.0.pre.alpha.PLAY814removemomentjs871 app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx
playbook_ui-12.28.0.pre.alpha.PLAY603datepickerquickpickinputpresetdropdown869 app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx
playbook_ui-12.28.0.pre.alpha.PLAY837MapCustomButton868 app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx
playbook_ui-12.28.0.pre.alpha.20230613implementbakesupport865 app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx
playbook_ui-12.28.0 app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx
playbook_ui-12.27.0.pre.alpha.expandednotworking853 app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx
playbook_ui-12.27.0 app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx
playbook_ui-12.26.1.pre.alpha.railsmultilevelimprovements842 app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx
playbook_ui-12.26.1.pre.alpha.railsmultilevelimprovements837 app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx