import React, { ComponentPropsWithoutRef } from 'react'; import { Overwrite, UseMultipleSelectionGetSelectedItemReturnValue, } from 'downshift'; import { SelectValueTheme, selectValueTheme } from './SelectValue.theme'; import { OmitCommon } from 'types/common'; import { SelectOption } from 'components/shared/Select'; import { Button } from 'components/shared/Button'; import { CrossIcon } from 'components/shared/CustomIcon'; type MergedComponentPropsWithoutRef = OmitCommon< ComponentPropsWithoutRef<'span'>, Omit< Overwrite, 'index' | 'selectedItem' > >; export interface SelectValueProps extends MergedComponentPropsWithoutRef, SelectValueTheme { /** * The option of the select value */ option: SelectOption; /** * The function to call when the delete button is clicked * @param item * @returns none; */ onDelete?: (item: SelectOption) => void; } /** * The SelectValue component is used to display the selected value of a select component */ export const SelectValue = ({ className, size, option, onDelete, ...props }: SelectValueProps) => { const theme = selectValueTheme(); return ( {option.label} ); };