import { Optional, record } from '@synnaxlabs/x';
import { UseHoverProps, UseHoverReturn } from './useHover';
/**
 * Extra information passed as an additional argument to the `onChange` callback.
 * of the {@link useMultiple} hook.
 */
export interface UseOnChangeExtra<K extends record.Key = record.Key> {
    clickedIndex: number | null;
    /** The key of the entry that was last clicked. */
    clicked: K | null;
}
export interface UseSingleAllowNoneProps<K extends record.Key> {
    value?: K;
    onChange: (next: K | null, extra: UseOnChangeExtra<K>) => void;
    allowNone?: true;
    closeDialogOnSelect?: boolean;
    autoSelectOnNone?: boolean;
}
export interface UseSingleRequiredProps<K extends record.Key> {
    value: K;
    onChange: (next: K, extra: UseOnChangeExtra<K>) => void;
    allowNone: false | undefined;
    closeDialogOnSelect?: boolean;
    autoSelectOnNone?: boolean;
}
type UseSingleInternalProps<K extends record.Key> = UseSingleAllowNoneProps<K> | UseSingleRequiredProps<K>;
export type UseSingleProps<K extends record.Key> = Optional<UseSingleInternalProps<K>, "allowNone"> & Pick<UseHoverProps<K>, "initialHover">;
export interface UseMultipleProps<K extends record.Key> extends Pick<UseHoverProps<K>, "initialHover"> {
    allowNone?: boolean;
    value: K[];
    onChange: (next: K[], extra: UseOnChangeExtra<K>) => void;
    replaceOnSingle?: boolean;
    closeDialogOnSelect?: boolean;
    autoSelectOnNone?: boolean;
}
/** Return value for the {@link useMultiple} hook. */
export interface UseReturn<K extends record.Key> extends UseHoverReturn<K> {
    onSelect: (key: K) => void;
    setSelected: (keys: K[]) => void;
    clear: () => void;
}
export declare const useSingle: <K extends record.Key>({ allowNone, onChange, value, closeDialogOnSelect, initialHover, autoSelectOnNone, }: UseSingleProps<K>) => UseReturn<K>;
export declare const useMultiple: <K extends record.Key>({ value, replaceOnSingle, onChange, initialHover, allowNone, closeDialogOnSelect, autoSelectOnNone, }: UseMultipleProps<K>) => UseReturn<K>;
export {};
//# sourceMappingURL=use.d.ts.map