@limetech/lime-elements
Version:
183 lines • 6.32 kB
TypeScript
import { EventEmitter } from '../../stencil-public-runtime';
import { BreadcrumbsItem } from '../breadcrumbs/breadcrumbs.types';
import { ListSeparator } from '../list-item/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-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-hotkeys
* @exampleComponent limel-example-menu-searchable-hotkeys
* @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;
/**
* Placeholder text for the search input field.
*/
searchPlaceholder?: string;
/**
* 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 breadcrumbs;
private triggerElement;
private selectedMenuItem?;
private shouldRestoreFocusOnClose;
private readonly normalizedHotkeyCache;
private cachedSubMenuSource;
private cachedSubMenuItems;
constructor();
componentDidRender(): void;
render(): any;
protected itemsWatcher(): void;
connectedCallback(): void;
disconnectedCallback(): void;
protected openWatcher(newValue: boolean): void;
private readonly handleDocumentKeyDown;
private isFromTextInput;
private hasModifier;
private isReservedMenuHotkey;
private findMenuItemByHotkey;
private getNormalizedHotkey;
private getBreadcrumbsItems;
private readonly renderLoader;
private readonly renderBreadcrumb;
private handleBreadcrumbsSelect;
private readonly renderSearchField;
private readonly renderEmptyMessage;
private readonly renderMenuList;
private readonly handleTextInput;
private readonly handleInputKeyDown;
private readonly handleListKeyDownCapture;
private readonly handleMenuKeyDown;
private readonly handleBreadcrumbsKeyDown;
private readonly clearSearch;
private readonly getCurrentItem;
private readonly goForward;
private readonly goBack;
private readonly setTriggerAttributes;
private readonly onClose;
private readonly onTriggerClick;
private readonly handleSelect;
private readonly onSelect;
private getCssProperties;
private readonly setListElement;
private readonly setFocus;
private readonly focusTrigger;
private readonly setSearchElement;
private readonly setBreadcrumbsElement;
/**
* Focuses the first focusable element inside breadcrumbs.
* Returns true if breadcrumbs exist and were focused,
* false otherwise.
*/
private readonly focusBreadcrumbs;
private readonly focusFirstListItem;
private readonly focusLastListItem;
private readonly isFirstListItemFocused;
private readonly isLastListItemFocused;
private readonly getListItems;
private readonly focusMenuItem;
private isMenuItem;
private readonly renderNotificationBadge;
private readonly hasNotificationBadge;
private readonly setTriggerRef;
private getMenuSurfaceWidth;
private get visibleItems();
}
//# sourceMappingURL=menu.d.ts.map