@base-ui-components/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.
13 lines • 897 B
TypeScript
import type { Filter } from "./useFilter.js";
/**
* Enhanced filter using Intl.Collator for more robust string matching.
* Uses the provided `itemToStringLabel` function if available, otherwise falls back to:
* • When `item` is an object with a `value` property, that property is used.
* • When `item` is a primitive (e.g. `string`), it is used directly.
*/
export declare function createCollatorItemFilter(collatorFilter: Filter, itemToStringLabel?: (item: any) => string): (item: any, query: string) => boolean;
/**
* Enhanced filter for single selection mode using Intl.Collator that shows all items
* when query is empty or matches the current selection, making it easier to browse options.
*/
export declare function createSingleSelectionCollatorFilter(collatorFilter: Filter, itemToStringLabel?: (item: any) => string, selectedValue?: any): (item: any, query: string) => boolean;