@limetech/lime-elements
Version:
150 lines • 4.68 kB
TypeScript
import { EventEmitter } from '../../stencil-public-runtime';
import { BreadcrumbsItem } from '../breadcrumbs/breadcrumbs.types';
import { ListSeparator } from '../list/list-item.types';
import { OpenDirection, MenuItem, SurfaceWidth, MenuSearcher } from './menu.types';
/**
* @slot trigger - Element to use as a trigger for the menu.
* @exampleComponent limel-example-menu-basic
* @exampleComponent limel-example-menu-disabled
* @exampleComponent limel-example-menu-open-direction
* @exampleComponent limel-example-menu-surface-width
* @exampleComponent limel-example-menu-separators
* @exampleComponent limel-example-menu-icons
* @exampleComponent limel-example-menu-badge-icons
* @exampleComponent limel-example-menu-grid
* @exampleComponent limel-example-menu-hotkeys
* @exampleComponent limel-example-menu-secondary-text
* @exampleComponent limel-example-menu-notification
* @exampleComponent limel-example-menu-sub-menus
* @exampleComponent limel-example-menu-sub-menu-lazy-loading
* @exampleComponent limel-example-menu-sub-menu-lazy-loading-infinite
* @exampleComponent limel-example-menu-searchable
* @exampleComponent limel-example-menu-composite
*/
export declare class Menu {
/**
* A list of items and separators to show in the menu.
*/
items: Array<MenuItem | ListSeparator>;
/**
* Sets the disabled state of the menu.
*/
disabled: boolean;
/**
* Decides the menu's location in relation to its trigger
*/
openDirection: OpenDirection;
/**
* Decides the width of menu's dropdown
*/
surfaceWidth: SurfaceWidth;
/**
* Sets the open state of the menu.
*/
open: boolean;
/**
* Defines whether the menu should show badges.
*/
badgeIcons: boolean;
/**
* Renders list items in a grid layout, rather than a vertical list
*/
gridLayout: boolean;
/**
* :::warning Internal Use Only
* This property is for internal use only. We need it for now, but want to
* find a better implementation of the functionality it currently enables.
* If and when we do so, this property will be removed without prior
* notice. If you use it, your code _will_ break in the future.
* :::
*
* @internal
*/
loading: boolean;
/**
* :::warning Internal Use Only
* This property is for internal use only. We need it for now, but want to
* find a better implementation of the functionality it currently enables.
* If and when we do so, this property will be removed without prior
* notice. If you use it, your code _will_ break in the future.
* :::
*
* @internal
*/
currentSubMenu: MenuItem;
/**
* A root breadcrumb item to show above the menu items.
* Clicking it navigates back from a sub-menu to the root menu.
*/
rootItem: BreadcrumbsItem;
/**
* Is emitted when the menu is cancelled.
*/
cancel: EventEmitter<void>;
/**
* Is emitted when a menu item is selected.
*/
select: EventEmitter<MenuItem>;
/**
* A search function that takes a search-string as an argument,
* and returns a promise that will eventually be resolved with
* an array of `MenuItem`:s.
*
* See the docs for the type `MenuSearcher` for type information on
* the searcher function itself.
*/
searcher: MenuSearcher;
/**
* Message to display when search returns 0 results.
*/
emptyResultMessage?: string;
/**
* Is emitted when a menu item with a sub-menu is selected.
*/
navigateMenu: EventEmitter<MenuItem | null>;
private host;
private loadingSubItems;
private searchValue;
private searchResults;
private list;
private searchInput;
private portalId;
private triggerElement;
private selectedMenuItem?;
constructor();
componentDidRender(): void;
render(): any;
protected itemsWatcher(): void;
protected openWatcher(newValue: boolean): void;
private getBreadcrumbsItems;
private renderLoader;
private renderBreadcrumb;
private handleBreadcrumbsSelect;
private renderSearchField;
private renderEmptyMessage;
private renderMenuList;
private handleTextInput;
private handleInputKeyDown;
private handleMenuKeyDown;
private clearSearch;
private getCurrentItem;
private goForward;
private goBack;
private setTriggerAttributes;
private onClose;
private onTriggerClick;
private handleSelect;
private onSelect;
private getCssProperties;
private setListElement;
private setFocus;
private setSearchElement;
private focusMenuItem;
private isMenuItem;
private renderNotificationBadge;
private hasNotificationBadge;
private setTriggerRef;
private getMenuSurfaceWidth;
private get visibleItems();
}
//# sourceMappingURL=menu.d.ts.map