export type AcceptedType = string; export type SelectionValue = T | Array | ReadonlyArray | null; export declare const SELECTION_TYPES: readonly ["single", "single-strict", "multiple"]; export type SelectionType = (typeof SELECTION_TYPES)[number]; export type SelectionState = Set; export type SelectionStrategy = { type: SelectionType; /** * Set the initial selection. */ init: (values: AcceptedType[]) => SelectionState; /** * Add the provided `values` to the `selection`, respecting * the rules for the current strategy. */ select: (values: AcceptedType[], selection: SelectionState) => SelectionState; /** * Remove the provided `values` from the `selection`, respecting * the rules for the current strategy. */ unselect: (values: AcceptedType[], selection: SelectionState) => SelectionState; /** * Toggle the provided `values` from the `selection` (add to the selection if * not in the `selection`, remove from the `selection` otherwise respecting * the rules for the current strategy. */ toggle: (values: AcceptedType[], selection: SelectionState) => SelectionState; /** * Reset `selection` to the provided value, or to and empty `Set` otherwise. */ reset: (selection?: SelectionState) => SelectionState; /** * Return selection as a value, based on the `AcceptedType`. */ value: (selection?: SelectionState) => SelectionValue; }; export type SelectionStrategyCreationProps = { type?: SelectionType; };