UNPKG

1.7 kBTypeScriptView Raw
1import * as React from 'react';
2import { SimpleListItemProps } from './SimpleListItem';
3export interface SimpleListProps extends Omit<React.HTMLProps<HTMLDivElement>, 'onSelect'> {
4 /** Content rendered inside the SimpleList */
5 children?: React.ReactNode;
6 /** Additional classes added to the SimpleList container */
7 className?: string;
8 /** Callback when an item is selected */
9 onSelect?: (ref: React.RefObject<HTMLButtonElement> | React.RefObject<HTMLAnchorElement>, props: SimpleListItemProps) => void;
10 /** Indicates whether component is controlled by its internal state */
11 isControlled?: boolean;
12}
13export interface SimpleListState {
14 /** Ref of the current SimpleListItem */
15 currentRef: React.RefObject<HTMLButtonElement> | React.RefObject<HTMLAnchorElement>;
16}
17interface SimpleListContextProps {
18 currentRef: React.RefObject<HTMLButtonElement> | React.RefObject<HTMLAnchorElement>;
19 updateCurrentRef: (id: React.RefObject<HTMLButtonElement> | React.RefObject<HTMLAnchorElement>, props: SimpleListItemProps) => void;
20 isControlled: boolean;
21}
22export declare const SimpleListContext: React.Context<Partial<SimpleListContextProps>>;
23export declare class SimpleList extends React.Component<SimpleListProps, SimpleListState> {
24 static displayName: string;
25 state: {
26 currentRef: React.RefObject<HTMLButtonElement> | React.RefObject<HTMLAnchorElement>;
27 };
28 static defaultProps: SimpleListProps;
29 handleCurrentUpdate: (newCurrentRef: React.RefObject<HTMLButtonElement> | React.RefObject<HTMLAnchorElement>, itemProps: SimpleListItemProps) => void;
30 render(): JSX.Element;
31}
32export {};
33//# sourceMappingURL=SimpleList.d.ts.map
\No newline at end of file