@base-ui/react
Version:
Base UI is a library of headless ('unstyled') React components and low-level hooks. You gain complete control over your app's CSS and accessibility features.
16 lines • 785 B
TypeScript
export declare function getFilter(options?: GetFilterParameters): Filter;
export interface GetFilterParameters extends Intl.CollatorOptions {
/**
* The locale to use for string comparison.
* Defaults to the user's runtime locale.
*/
locale?: Intl.LocalesArgument | undefined;
}
export interface Filter {
/** Returns whether the item matches the query anywhere. */
contains: <Item>(item: Item, query: string, itemToString?: (item: Item) => string) => boolean;
/** Returns whether the item starts with the query. */
startsWith: <Item>(item: Item, query: string, itemToString?: (item: Item) => string) => boolean;
/** Returns whether the item ends with the query. */
endsWith: <Item>(item: Item, query: string, itemToString?: (item: Item) => string) => boolean;
}