import type { ComboboxStore } from '@mantine/core'; import { ActionIcon, Loader, TextInput } from '@mantine/core'; import { IconX } from '@tabler/icons-react'; import React, { forwardRef } from 'react'; interface BoxerTargetProps { clearable?: boolean; combobox: ComboboxStore; disabled?: boolean; error?: string; isFetching?: boolean; label?: string; leftSection?: React.ReactNode; onBlur: () => void; onClear: () => void; onSearch: (event: React.ChangeEvent) => void; placeholder?: string; search: string; } const BoxerTarget = forwardRef((props, ref) => { const { clearable = true, combobox, disabled, error, isFetching, label, leftSection, onBlur, onClear, onSearch, placeholder, search, } = props; const rightSection = isFetching ? ( ) : search && clearable ? ( { e.stopPropagation(); onClear(); }} size="sm" variant="subtle" > ) : null; return ( combobox.openDropdown()} onFocus={() => combobox.openDropdown()} placeholder={placeholder} ref={ref} rightSection={rightSection} value={search} /> ); }); BoxerTarget.displayName = 'BoxerTarget'; export default BoxerTarget;