import React, { forwardRef, ComponentPropsWithoutRef, useMemo } from 'react'; import { Overwrite, UseComboboxGetItemPropsReturnValue } from 'downshift'; import { userSelectItemTheme, UserSelectItemTheme, } from './UserSelectItem.theme'; import { CheckRadioIcon } from 'components/shared/CustomIcon'; import { UserSelectOption } from 'components/shared/UserSelect'; import { OmitCommon } from 'types/common'; /** * Represents a type that merges ComponentPropsWithoutRef<'li'> with certain exclusions. * @type {MergedComponentPropsWithoutRef} */ type MergedComponentPropsWithoutRef = OmitCommon< ComponentPropsWithoutRef<'li'>, Omit< Overwrite, 'index' | 'item' > >; export interface UserSelectItemProps extends MergedComponentPropsWithoutRef, UserSelectItemTheme { selected: boolean; option: UserSelectOption; hovered?: boolean; } const UserSelectItem = forwardRef( ({ className, selected, hovered, option, ...props }, ref) => { const theme = userSelectItemTheme(); const { value, label, imgSrc } = option; const renderLeftImage = useMemo( () => (
{`${value}-logo`}
), [imgSrc, value], ); return (
  • {renderLeftImage}

    {label}

    {selected && }
  • ); }, ); export const EmptyUserSelectItem = () => { const theme = userSelectItemTheme(); return (
  • No results found

  • ); }; UserSelectItem.displayName = 'UserSelectItem'; export { UserSelectItem };