export interface Selection { /** The selected ids — read `.has(id)` / `.size`, or use the helpers below. * Spread it (`[...selected]`) to hand the picked ids to a bulk action. */ selected: ReadonlySet; /** Whether `id` is currently selected. */ has: (id: string) => boolean; /** How many ids are selected — across pages, so it's the running total a * `SelectionBar` shows. */ count: number; /** Toggle `id`, or set it explicitly when `on` is passed (a row checkbox's `onChange`). */ toggle: (id: string, on?: boolean) => void; /** Set a whole batch of ids on/off at once — the controlled select-all `onChange(on)`. */ setAll: (ids: readonly string[], on: boolean) => void; /** Are ALL of `ids` selected? — a select-all checkbox's `checked` (false for an empty set). */ allSelected: (ids: readonly string[]) => boolean; /** SOME but not all of `ids` selected? — a select-all checkbox's `indeterminate`. */ indeterminate: (ids: readonly string[]) => boolean; /** Clear the whole selection. */ clear: () => void; } /** * Always-on multi-select state for a register / list: the `selected` Set plus the * toggle, select-all, and all-or-some helpers a `Table` + `SelectionBar` need. * Items are agnostic string ids — selectability GATING (which rows can be ticked) * stays with the caller: filter to the selectable ids and pass THOSE to `setAll` / * `allSelected` / `indeterminate` (a non-selectable row just gets a disabled * checkbox). Selection persists across pages, so `count` is the running total. * (For a files-grid that ENTERS a selection mode via tap-and-hold, that's * `useSelectionMode`; this is the checkbox-always-visible register variant.) * * ONE SCREEN, ONE CLAIM. Pass a `scope` — whatever string says which rows the * reader is looking at (a band, a search, a page) — and the selection DROPS when * it changes: a claim made over rows that are no longer in view is one a bulk act * would run over records the reader cannot see. The scope is held WITH the claim * and read during the render that changes it, never in an effect afterwards, * where one committed render would first count the rows that are gone. Omit it * for a set with one scope, where nothing can make the selection stale. */ export declare function useSelection(scope?: string): Selection;