import { Command } from 'cmdk'; import type React from 'react'; import { cn } from '@/lib/utils'; import { Popover } from '../../popover'; import type { MentionInputSuggestionsDropdownItem, MentionInputSuggestionsOnSelectParams, } from './MentionInputSuggestions.types'; export type MentionInputSuggestionsItemProps = { onSelect: (d: MentionInputSuggestionsOnSelectParams) => void; } & MentionInputSuggestionsDropdownItem & { className?: string; style?: React.CSSProperties; }; export const MentionInputSuggestionsItem = ({ value, inputValue, label, icon, onClick, disabled, loading, closeOnSelect, type, addValueToInput, onSelect, className, style, popoverContent, }: MentionInputSuggestionsItemProps) => { const onSelectItem = () => { onSelect({ value, inputValue, label, onClick, addValueToInput, closeOnSelect, disabled, loading, }); }; return ( { onSelectItem(); }} onSelect={() => { onSelectItem(); }} > {icon && ( {icon} )} {label} ); }; const PopoverContentWrapper = ({ children, popoverContent, }: { children: React.ReactNode; popoverContent?: MentionInputSuggestionsItemProps['popoverContent']; }) => { if (!popoverContent) return children; return ( {children} ); };