UNPKG

1.33 kBTypeScriptView Raw
1/// <reference types="react" />
2export interface UseListItemParameters<ItemValue> {
3 /**
4 * If `true`, the list item will dispatch the `itemHover` action on pointer over.
5 * Since the use cases for it are rare, it's disabled by default.
6 * It could be used to mimic the native `select` behavior, which highlights the hovered item.
7 *
8 * @default false
9 */
10 handlePointerOverEvents?: boolean;
11 /**
12 * The list item.
13 */
14 item: ItemValue;
15}
16interface UseListItemRootSlotOwnProps {
17 onClick: React.MouseEventHandler;
18 onPointerOver: React.PointerEventHandler | undefined;
19 tabIndex?: number;
20}
21export type UseListItemRootSlotProps<ExternalProps = {}> = ExternalProps & UseListItemRootSlotOwnProps;
22export interface UseListItemReturnValue {
23 /**
24 * Resolver for the root slot's props.
25 * @param externalProps additional props to be forwarded to the root slot
26 * @returns props that should be spread on the root slot
27 */
28 getRootProps: <ExternalProps extends Record<string, unknown> = {}>(externalProps?: ExternalProps) => UseListItemRootSlotProps<ExternalProps>;
29 /**
30 * If `true`, the current item is highlighted.
31 */
32 highlighted: boolean;
33 /**
34 * If `true`, the current item is selected.
35 */
36 selected: boolean;
37}
38export {};