UNPKG

@payfit/unity-components

Version:

28 lines (27 loc) • 1.29 kB
import { ReactNode } from 'react'; import { MultiSelectOptionInfo, MultiSelectSelectionState } from '../Multiselect.context.js'; import { MultiSelectKey } from './selection-adapter.js'; /** * Extract option metadata from the complete rendered collection. This keeps * select-all correct when the visible list is virtualized. */ export declare function collectOptionInfos(children: ReactNode): MultiSelectOptionInfo[]; /** * Collect selectable item keys from React Aria's complete collection. This * includes items that are not mounted when the list is virtualized. */ export declare function collectSelectableKeys(collection: { getKeys: () => Iterable<MultiSelectKey>; getItem: (key: MultiSelectKey) => { type: string; key: MultiSelectKey; } | null; getChildren?: (key: MultiSelectKey) => Iterable<{ type: string; key: MultiSelectKey; }>; }, selectionManager: { canSelectItem: (key: MultiSelectKey) => boolean; }, groupLabel?: MultiSelectKey): Set<MultiSelectKey>; export declare function getSelectionState(selectedKeys: Set<MultiSelectKey>, keys: Iterable<MultiSelectKey>): MultiSelectSelectionState; export declare function toggleSelection(selectedKeys: Set<MultiSelectKey>, keys: Iterable<MultiSelectKey>): Set<MultiSelectKey>;