export interface UseSelectionInput { /** The array of items to select from */ data: T[]; /** The initial selection, empty array by default */ defaultSelection?: T[]; /** If true, selection is reset when data changes */ resetSelectionOnDataChange?: boolean; } export interface UseSelectionHandlers { /** Add an item to the selection */ select: (selected: T) => void; /** Remove an item from the selection */ deselect: (deselected: T) => void; /** Toggle an item's selection state */ toggle: (toggled: T) => void; /** Returns true if all items from the `data` are selected */ isAllSelected: () => boolean; /** Returns true if at least one item from the `data` is selected */ isSomeSelected: () => boolean; /** Set the selection to a specific array of items */ setSelection: (selection: T[]) => void; /** Clear all selections */ resetSelection: () => void; } export type UseSelectionReturnValue = readonly [T[], UseSelectionHandlers]; export declare function useSelection(input: UseSelectionInput): UseSelectionReturnValue;