import { Dispatch, SetStateAction } from 'react'; import * as React from 'react'; import { ListItemProps, ListProps } from '../list'; import { Override } from '../overrides'; import { PopoverProps } from '../popover'; export declare type MenuItemProps = Omit & { getChildMenu?: () => null | React.ReactElement; onMouseEnter?: () => void; onMouseLeave?: () => void; renderAll?: boolean; overrides?: { ListItem?: Override>; Popover?: Override>; }; }; declare type State = { highlightedItem: HTMLElement | null; }; export declare type ActionType = 'INITIALIZE_MENU'; export declare type Reducer = (type: ActionType, nextState: State) => State; export declare type MenuProps = Omit & { /** * Navigation starts as soon as Menu mounts. Flag this prop true to disable this behaviour. * e.g. In nested menu we don't want navigationOnMount behavior */ disableNavigationOnMount?: boolean; /** * Should Menu be focused when keyboard navigation is on. * true (default) - Menu will be focused as soon as you hover mouse on Menu. keyboard navigation will be disabled only when MenuList is blurred. * false (useful with select) - Menu will not focus. Once navigation is enabled, you cannot stop it(because onBlur will not be called in any case) till the Menu is unmounted. */ focusWhenNavigationEnabled?: boolean; overrides?: { List?: Override>; }; onHighlightedItemChange?: (item?: HTMLElement | null) => void; /** * By default 1st item or selected item will be highlighted on mount. If true, no item will be highlighted on mount. */ disableAutoHighlight?: boolean; /** * If true, none of the MenuItem will be highlighted when mouse leaves the Menu. */ resetMenuHighlightOnMouseLeave?: boolean; /** * @deprecated This prop will be removed. use resetMenuHighlightOnMouseLeave */ resetMenuOnMouseLeave?: boolean; reducer?: Reducer; captureScroll?: boolean; selectOnTab?: boolean; }; declare type MenuActions = { turnOnKeyboardNavigation?: () => void; turnOffKeyboardNavigation?: () => void; setHighlightedItem?: Dispatch>; }; export declare type MenuRef = HTMLElement & MenuActions; export declare type TraversalFunction = (highlightedItemIndex: HTMLElement | null, parentContainer: HTMLElement) => HTMLElement | null; export declare type ContextMenuInfo = { menuRef: HTMLElement; turnOnKeyboardNavigation: () => void; turnOffKeyboardNavigation: () => void; }; export declare type ContextValue = Partial<{ registerMenu: (menuInfo: ContextMenuInfo) => void; unregisterMenu: (menuRef?: HTMLElement) => void; getMenuInfo: (menuRef: HTMLElement) => ContextMenuInfo; getChildMenuInfo: (menuRef: HTMLElement) => ContextMenuInfo; getParentMenuInfo: (menuRef: HTMLElement) => ContextMenuInfo; getRootMenuInfo: () => ContextMenuInfo; }>; export {};