import { Dispatch, SetStateAction } from 'react'; /** * Custom hook to manage the selection state of a list of items. * * @param {string[]} itemIds - The list of item IDs to manage. * @param {string[]} [defaultSelected=[]] - The list of default selected item IDs. * * @returns {UseMultiSelectReturn} - An object containing: * - `values`: The current list of selected item IDs. * - `status`: The current selection status ('checked', 'unchecked', 'indeterminate'). * - `setValues`: A function to manually set the selected item IDs. * - `onSelectAllItems`: A function to select all items. * - `onDeSelectAllItems`: A function to deselect all items. * - `onToggleSelectItem`: A function to toggle the selection of a specific item. * * @example * const { values, status, onSelectAllItems, onDeSelectAllItems, onToggleSelectItem } = useMultiSelect(['item1', 'item2', 'item3'], ['item1']); * * return ( *
* * * {itemIds.map(itemId => ( *
* onToggleSelectItem(itemId)} * /> * {itemId} *
* ))} *
* ); */ type UseMultiSelectReturn = { values: string[]; status: 'checked' | 'unchecked' | 'indeterminate'; setValues: Dispatch>; onSelectAllItems: () => void; onDeSelectAllItems: () => void; onToggleSelectItem: (inputValue: string) => void; }; declare function useMultiSelect(listItems: string[], defaultSelectedItems?: string[]): UseMultiSelectReturn; /** * Updates the selected items list by adding or removing the specified item. * * @param {string[]} selectedItems - The current list of selected items. * @param {string} newItem - The item to add or remove. * @returns {string[]} - The updated list of selected items. */ declare function updateSelectedItems(selectedItems: string[], newItem: string): string[]; export { type UseMultiSelectReturn, updateSelectedItems, useMultiSelect };