import type { KeyboardEvent, MouseEvent, SyntheticEvent } from "react"; import type { CollectionItem } from "./collectionTypes"; export declare const SINGLE = "default"; export declare const MULTIPLE = "multiple"; export declare const EXTENDED = "extended"; export declare const DESELECTABLE = "deselectable"; export type SingleSelectionStrategy = "default" | "deselectable"; export type MultiSelectionStrategy = "multiple" | "extended" | "extended-multi-range"; export type SelectionStrategy = SingleSelectionStrategy | MultiSelectionStrategy; export type selectedType = Selection extends MultiSelectionStrategy ? Item[] : Item | null; export type SelectHandler = (event: SyntheticEvent, selectedItem: Item) => void; export type SelectionChangeHandler = (event: SyntheticEvent, selected: Selection extends SingleSelectionStrategy ? Item | null : Item[]) => void; export declare const hasSelection: (selected: Item | Item[] | null) => boolean; export declare const getFirstSelectedItem: (selected: Item | Item[] | null) => Item | null; export interface SelectionProps { defaultSelected?: Selection extends SingleSelectionStrategy ? Item | null : Item[]; onSelect?: SelectHandler; onSelectionChange?: SelectionChangeHandler; selected?: Selection extends SingleSelectionStrategy ? Item | null : Item[]; selectionStrategy?: Selection; } export interface ListHandlers { onClick?: (event: MouseEvent) => void; onKeyDown?: (event: KeyboardEvent) => void; onKeyboardNavigation?: (event: KeyboardEvent, currentIndex: number) => void; onMouseMove?: (event: MouseEvent) => void; } export interface SelectionHookProps extends SelectionProps, Selection> { disableSelection?: boolean; highlightedIdx: number; indexPositions: CollectionItem[]; label?: string; selectionKeys?: string[]; tabToSelect?: boolean; } export interface SelectionHookResult { listHandlers: ListHandlers; selected: Selection extends SingleSelectionStrategy ? CollectionItem | null : CollectionItem[]; setSelected: (selected: Selection extends SingleSelectionStrategy ? CollectionItem | null : CollectionItem[]) => void; }