import classnames from 'classnames'; import type { ComboboxOptionType } from '../ComboboxType'; import { slottableComponent } from '../../HOC/slottableComponent'; import D from '../../../../i18n'; type Props = { option: ComboboxOptionType; shouldDisplayOptionId?: boolean; selected?: boolean; }; export const ComboboxOption = slottableComponent( 'ComboboxOption', ({ option, shouldDisplayOptionId = true, selected }: Props) => { const { id, value, label } = option; if (value === 'OTHER') { return (
{`${D.SUGGESTER_NO_RESULT} : ${D.SUGGESTER_ARBITRARY} "${label}"`}
); } if (label) { return (
{shouldDisplayOptionId && ( <> {id || value} - )} {label}
); } return (
{id || value}
); } );