UNPKG

matrix-react-sdk

Version:
50 lines (49 loc) 1.43 kB
import React, { ReactElement, ReactNode } from "react"; import { NonEmptyArray } from "../../../@types/common"; export interface DropdownProps { id: string; label: string; value?: string; className?: string; autoComplete?: string; children: NonEmptyArray<ReactElement & { key: string; }>; disabled?: boolean; menuWidth?: number; searchEnabled?: boolean; placeholder?: string; onOptionChange(dropdownKey: string): void; onSearchChange?(query: string): void; getShortOption?(value: string): ReactNode; } interface IState { expanded: boolean; highlightedOption: string; searchQuery: string; } export default class Dropdown extends React.Component<DropdownProps, IState> { private readonly buttonRef; private dropdownRootElement; private ignoreEvent; private childrenByKey; constructor(props: DropdownProps); componentDidUpdate(prevProps: Readonly<DropdownProps>): void; componentWillUnmount(): void; private reindexChildren; private onDocumentClick; private onRootClick; private onAccessibleButtonClick; private close; private onMenuOptionClick; private onKeyDown; private onInputChange; private collectRoot; private setHighlightedOption; private nextOption; private prevOption; private scrollIntoView; private getMenuOptions; render(): React.ReactNode; } export {};