1 | import { UseListParameters, ListState, UseListReturnValue } from './useList.types';
|
2 | import { ControllableReducerAction } from '../utils/useControllableReducer.types';
|
3 | /**
|
4 | * The useList is a lower-level utility that is used to build list-like components.
|
5 | * It's used to manage the state of the list and its items.
|
6 | *
|
7 | * Supports highlighting a single item and selecting an arbitrary number of items.
|
8 | *
|
9 | * The state of the list is managed by a controllable reducer - that is a reducer that can have its state
|
10 | * controlled from outside.
|
11 | *
|
12 | * By default, the state consists of `selectedValues` and `highlightedValue` but can be extended by the caller of the hook.
|
13 | * Also the actions that can be dispatched and the reducer function can be defined externally.
|
14 | *
|
15 | * @template ItemValue The type of the item values.
|
16 | * @template State The type of the list state. This should be a subtype of `ListState<ItemValue>`.
|
17 | * @template CustomAction The type of the actions that can be dispatched (besides the standard ListAction).
|
18 | * @template CustomActionContext The shape of additional properties that will be added to actions when dispatched.
|
19 | *
|
20 | * @ignore - internal hook.
|
21 | */
|
22 | declare function useList<ItemValue, State extends ListState<ItemValue> = ListState<ItemValue>, CustomAction extends ControllableReducerAction = never, CustomActionContext = {}>(params: UseListParameters<ItemValue, State, CustomAction, CustomActionContext>): UseListReturnValue<ItemValue, State, CustomAction>;
|
23 | export { useList };
|