@rkosafo/cai.components
Version:
This package is under development and not ready for public use.
16 lines (15 loc) • 611 B
TypeScript
/**
* @template T
* @param {boolean} [nonReactive=false] - use a non-reactive placeholder to allow multiple selection and keep context shallow
* @returns {SingleSelectionContext<T>}
*/
export function createSingleSelectionContext<T>(nonReactive?: boolean): SingleSelectionContext<T>;
/**
* @template T
* @param {(value: T) => void} callback
* @returns {(open: boolean, v?: T) => SingleSelectionContext<T>}
*/
export function useSingleSelection<T>(callback: (value: T) => void): (open: boolean, v?: T) => SingleSelectionContext<T>;
export type SingleSelectionContext<T> = {
value?: T | undefined;
};