import type { ListData } from '@adobe/react-spectrum'; import type { Key } from '@react-types/shared'; /** * Subset of React Stately ListData + bulkUpdate. */ export type WindowedListData = Pick, 'items' | 'getItem' | 'selectedKeys' | 'setSelectedKeys' | 'update'> & { append: (values: Iterable) => void; bulkUpdate: (itemMap: Map) => void; findItem: (key: Key) => T | null; insert: (index: number, values: Iterable) => void; remove: (keys: Iterable) => void; setItems: (items: T[]) => void; }; export interface UseWindowedListDataOptions { getKey?: (item: T) => Key; } /** * Manages state associated with an immutable list of data. * * This hook is a revised version of React Stately's * `useListData` hook with a couple of improvements. * - Added support for bulk update * - Proper memoization of the return object + its members * - Using Iterable instead of spread function arguments to avoid stack overflow * for large lists * - findItem - method to look for item without throwing an exception if it isn't found * * @param options.getKey Optional function to derive a key from an item in the list */ export declare function useWindowedListData({ getKey, }?: UseWindowedListDataOptions): WindowedListData; /** * Default getKey function simply returns item.key if the property exists. If * not, an error is thrown. * @param item */ export declare function defaultGetKey(item: T): Key; export default useWindowedListData; //# sourceMappingURL=useWindowedListData.d.ts.map