@vtex/admin-ui
Version:
> VTEX admin component library
20 lines (19 loc) • 636 B
TypeScript
import type { FormEvent } from 'react';
export declare function useSearchState(params?: UseSearchStateParams): SearchFormState;
export interface UseSearchStateParams {
initialValue?: string;
defaultValue?: string;
initiallyLoading?: boolean;
onSubmit?: () => void;
timeoutMs?: number;
}
export interface SearchFormState {
value: string;
debouncedValue: string;
setValue: (value: string) => void;
onSubmit: (e: FormEvent<HTMLFormElement>) => void;
showClear: boolean;
loading: boolean;
setLoading: React.Dispatch<React.SetStateAction<boolean>>;
clear: () => void;
}