@vtex/admin-ui
Version:
> VTEX admin component library
28 lines (27 loc) • 942 B
TypeScript
import type { UseComboboxProps, UseComboboxReturnValue } from 'downshift';
import type { Dispatch, ReactNode, SetStateAction } from 'react';
declare type DownshiftRestProps<C> = Omit<UseComboboxProps<C>, 'items'>;
interface MatchParams<T> {
inputValue?: string;
itemString?: string;
item?: T;
}
interface Params<T> extends DownshiftRestProps<T> {
id: string;
collection: T[];
historySize?: number;
compare?: (a: T, b: T) => boolean;
match?: (params: MatchParams<T>) => boolean;
render?: (item: T) => ReactNode;
}
declare type CollectionType = 'storage' | 'search' | 'seed';
export interface ComboboxState<T> {
combobox: UseComboboxReturnValue<T>;
collection: {
items: T[];
type: CollectionType;
setItems: Dispatch<SetStateAction<T[]>>;
};
}
export declare function unstableUseSearchBoxState<C>(params: Params<C>): ComboboxState<C>;
export {};