/** * Represents the request context passed to an items provider function. * This interface is intentionally minimal to ensure easy integration * with Angular, React, Vue, and other frameworks. * * @public */ export interface IItemsProviderRequest { /** * The current search text entered by the user. * * @public * @readonly */ readonly searchText: string; /** * An AbortSignal that can be used to cancel async operations * when a new search is initiated or the component is disconnected. * * @public * @readonly */ readonly signal: AbortSignal; } /** * Represents an item returned by an items provider. * This is a generic interface that can represent any item type. * * @public */ export interface IItemsProviderItem { /** * The unique identifier or value of the item. * * @public */ value: string; /** * The display text shown in the suggestion list. * * @public */ displayText: string; /** * Optional additional data associated with the item. * * @public */ data?: unknown; } /** * Represents a function that provides items for an autocomplete component. * The function can return items synchronously or asynchronously. * * @remarks * This type is designed to be framework-agnostic and easy to use in * Angular, React, Vue, Svelte, and vanilla JavaScript. * * @example * ```typescript * // Synchronous provider * const syncProvider: ItemsProviderFn = (request) => { * return items.filter(item => * item.displayText.toLowerCase().includes(request.searchText.toLowerCase()) * ); * }; * * // Asynchronous provider * const asyncProvider: ItemsProviderFn = async (request) => { * const response = await fetch(`/api/search?q=${request.searchText}`, { * signal: request.signal * }); * return response.json(); * }; * ``` * * @typeParam T - The type of items returned by the provider. Defaults to `unknown`. * @param request - The request context containing search text and abort signal. * @returns An array of items or a Promise that resolves to an array of items. * * @public */ export type ItemsProviderFn = (request: IItemsProviderRequest) => Array | Promise>; //# sourceMappingURL=ItemsProvider.d.ts.map