import { MdcComponent } from '@aurelia-mdc-web/base'; import { MDCMenuFoundation, DefaultFocusState, Corner, MDCMenuItemComponentEventDetail } from '@material/menu'; import { MdcMenuSurface } from '@aurelia-mdc-web/menu-surface'; import { MdcList, IMdcListActionEvent } from '@aurelia-mdc-web/list'; import { MDCListIndex } from '@material/list'; import { MDCMenuDistance } from '@material/menu-surface'; /** * @selector mdc-menu * @emits mdcmenu:selected | Indicates that a menu item has been selected */ export declare class MdcMenu extends MdcComponent { menuSurface: MdcMenuSurface; get list_(): MdcList | undefined; /** Used to indicate that the menu is using fixed positioning */ fixed: boolean; typeahead: boolean; typeaheadChanged(): Promise; /** Makes the menu element direct child of the body */ hoistToBody: boolean; /** Set to indicate an element the menu should be anchored to */ anchor?: Element | null; /** Sets default focus state where the menu should focus every time when menu is opened. Focuses the list root ('list') element by default. */ defaultFocusState: keyof typeof DefaultFocusState; defaultFocusStateChanged(): Promise; /** Override the opening point of the menu. (Default: TOP_START) */ anchorCorner: keyof typeof Corner; /** Sets the distance from the anchor point that the menu surface should be shown */ anchorMargin: Partial; /** Sets whether the menu should open and close without animation when the open/close methods are called */ quickOpen: boolean; /** Sets whether the menu surface should stay open after item selection */ stayOpenOnSelection: boolean; maxHeight: number; openBottomBias: number; /** Sets whether focus should be restored after the menu is closed */ skipRestoreFocus: boolean; skipRestoreFocusChanged(): void; selectOnTab: boolean; stayOpen: boolean; handleKeydown_(evt: KeyboardEvent): boolean; handleItemAction_(evt: IMdcListActionEvent): boolean; handleMenuSurfaceOpened_(): boolean; get open(): boolean; set open(value: boolean); /** Toggles the menu to open or close */ toggle(): void; openAnchored(anchor: HTMLElement): void; get wrapFocus(): boolean; set wrapFocus(value: boolean); /** * @return Whether typeahead logic is currently matching some user prefix. */ get typeaheadInProgress(): boolean; /** * Return the items within the menu. Note that this only contains the set of elements within * the items container that are proper list items, and not supplemental / presentational DOM * elements. */ get items(): Element[]; /** * Retrieves the selected index. Only applicable to select menus. * @return The selected index, which is a number for single selection and * radio lists, and an array of numbers for checkbox lists. */ get selectedIndex(): MDCListIndex; /** * Sets the selected index of the list. Only applicable to select menus. * @param index The selected index, which is a number for single selection and * radio lists, and an array of numbers for checkbox lists. */ set selectedIndex(index: MDCListIndex); initialise(): Promise; /** * Given the next desired character from the user, adds it to the typeahead * buffer. Then, attempts to find the next option matching the buffer. Wraps * around if at the end of options. * * @param nextChar The next character to add to the prefix buffer. * @param startingIndex The index from which to start matching. Only relevant * when starting a new match sequence. To start a new match sequence, * clear the buffer using `clearTypeaheadBuffer`, or wait for the buffer * to clear after a set interval defined in list foundation. Defaults to * the currently focused index. * @return The index of the matched item, or -1 if no match. */ typeaheadMatchItem(nextChar: string, startingIndex?: number): number; /** * Layout the underlying list element in the case of any dynamic updates * to its structure. */ layout(): void; /** * @param corner Default anchor corner alignment of top-left menu corner. */ setAnchorCorner(corner: Corner): void; /** * Sets the list item as the selected row at the specified index. * @param index Index of list item within menu. */ setSelectedIndex(index: number): void; /** * Sets the enabled state to isEnabled for the menu item at the given index. * @param index Index of the menu item * @param isEnabled The desired enabled state of the menu item. */ setEnabled(index: number, isEnabled: boolean): void; /** * @return The item within the menu at the index specified. */ getOptionByIndex(index: number): Element | null; /** * @param index A menu item's index. * @return The primary text within the menu at the index specified. */ getPrimaryTextAtIndex(index: number): string; setAbsolutePosition(x: number, y: number): void; getDefaultFoundation(): MDCMenuFoundation; } export interface IMdcMenuItemComponentEventDetail extends MDCMenuItemComponentEventDetail { data: unknown; } /** @hidden */ export interface IMdcMenuItemComponentEvent extends Event { readonly detail: IMdcMenuItemComponentEventDetail; }