export interface UseFilterParameters extends Intl.CollatorOptions { /** * The locale to compare in, as a BCP 47 language tag. Defaults to the * runtime's. */ locale?: string | undefined; } export interface UseFilterReturnValue { /** * Whether `string` starts with `substring`. */ startsWith: (string: string, substring: string) => boolean; /** * Whether `string` ends with `substring`. */ endsWith: (string: string, substring: string) => boolean; /** * Whether `string` contains `substring` anywhere. */ contains: (string: string, substring: string) => boolean; } /** * Locale-aware string matching for filtering a list. * * `Intl.Collator` is what makes this better than `toLowerCase().includes()`: at * the default `'base'` sensitivity, "resume" matches "Résumé" and "PENO" matches * "Jalapeño" — which a lowercase comparison never will. Pass * `sensitivity: 'case'` (or any other `Intl.CollatorOptions`) to tighten it. * * All three compare a **fixed-width** window, so a query only matches a run of * the same length. Characters that fold to a different number of characters are * therefore not matched across that boundary: "straße" (6) does not find * "STRASSE" (7), even though the collator considers the two equal. Scanning * every width instead would make every keystroke quadratic. * * ```tsx * const { contains } = useFilter({ sensitivity: 'base' }); * const matches = items.filter((item) => contains(item.label, query)); * ``` * * This is the default filter behind `Combobox.Root` and `Autocomplete.Root`; * use it directly when you filter the items yourself. */ export declare function useFilter(options?: UseFilterParameters): UseFilterReturnValue; //# sourceMappingURL=useFilter.d.ts.map