@navinc/base-react-components
Version:
Nav's Pattern Library
37 lines (36 loc) • 1.26 kB
TypeScript
import { ComponentType, FocusEvent } from 'react';
export type SearchInputProps<T> = {
value?: T;
results?: T[];
autoFocus?: boolean;
className?: string;
errors?: string[];
helperText?: string;
isLoading?: boolean;
isInvalid?: boolean;
label?: string;
lede?: string;
name?: string;
NoResults?: ComponentType<{
query: string;
}>;
onBlur?: (event: FocusEvent<HTMLInputElement>) => void;
onChange?: (event: {
target: {
name?: string;
value: T | null;
};
}) => void;
onFocus?: (event: FocusEvent<HTMLInputElement>) => void;
Result: ComponentType<{
result: T;
}>;
required?: boolean;
resultsMaxHeight?: string;
resultToQuery?: (result: T) => string;
search: (query: string) => Promise<T[]>;
shouldPositionResultsRelative?: boolean;
touched?: boolean;
type?: string;
};
export declare const SearchInput: <T>({ autoFocus, className, errors, helperText, isLoading, isInvalid, label, lede, name, NoResults, onBlur, onChange, onFocus, Result, required, results, resultsMaxHeight, resultToQuery, search, shouldPositionResultsRelative, touched, type, value, ...inputProps }: SearchInputProps<T>) => JSX.Element;