UNPKG

2.27 kBTypeScriptView Raw
1import * as React from 'react';
2import { DropdownPosition, DropdownContext } from './dropdownConstants';
3export interface DropdownMenuProps {
4 /** Anything which can be rendered as dropdown items */
5 children?: React.ReactNode;
6 /** Classess applied to root element of dropdown menu */
7 className?: string;
8 /** Flag to indicate if menu is opened */
9 isOpen?: boolean;
10 /** @deprecated - no longer used */
11 openedOnEnter?: boolean;
12 /** Flag to indicate if the first dropdown item should gain initial focus, set false when adding
13 * a specific auto-focus item (like a current selection) otherwise leave as true
14 */
15 autoFocus?: boolean;
16 /** Indicates which component will be used as dropdown menu */
17 component?: React.ReactNode;
18 /** Indicates where menu will be alligned horizontally */
19 position?: DropdownPosition | 'right' | 'left';
20 /** Indicates how the menu will align at screen size breakpoints */
21 alignments?: {
22 sm?: 'right' | 'left';
23 md?: 'right' | 'left';
24 lg?: 'right' | 'left';
25 xl?: 'right' | 'left';
26 '2xl'?: 'right' | 'left';
27 };
28 /** Flag to indicate if menu is grouped */
29 isGrouped?: boolean;
30 setMenuComponentRef?: any;
31}
32export interface DropdownMenuItem extends React.HTMLAttributes<any> {
33 isDisabled: boolean;
34 disabled: boolean;
35 isHovered: boolean;
36 ref: HTMLElement;
37}
38export declare class DropdownMenu extends React.Component<DropdownMenuProps> {
39 static displayName: string;
40 context: React.ContextType<typeof DropdownContext>;
41 refsCollection: HTMLElement[][];
42 static defaultProps: DropdownMenuProps;
43 componentDidMount(): void;
44 componentWillUnmount: () => void;
45 static validToggleClasses: string[];
46 static focusFirstRef: (refCollection: HTMLElement[]) => void;
47 onKeyDown: (event: any) => void;
48 shouldComponentUpdate(): boolean;
49 childKeyHandler: (index: number, innerIndex: number, position: string, custom?: boolean) => void;
50 sendRef: (index: number, nodes: any[], isDisabled: boolean, isSeparator: boolean) => void;
51 extendChildren(): React.ReactElement<any, string | React.JSXElementConstructor<any>>[];
52 render(): JSX.Element;
53}
54//# sourceMappingURL=DropdownMenu.d.ts.map
\No newline at end of file