UNPKG

vira

Version:

A simple and highly versatile design system using element-vir.

60 lines (59 loc) 1.92 kB
import { type MaybePromise, type PartialWithUndefined } from '@augment-vir/common'; import { type HtmlInterpolation } from 'element-vir'; import { ViraMenuItem } from '../elements/pop-up/vira-menu-item.element.js'; import { type PopUpManager, type PopUpManagerOptions, type ShowPopUpResult } from './pop-up-manager.js'; /** * Verifies that all items have unique ids. * * @category Internal */ export declare function assertUniqueIdProps(items: ReadonlyArray<Readonly<{ id: PropertyKey; }>>): void; /** * Handles toggling pop up state for `ViraDropdown`. * * @category Internal */ export declare function triggerPopUpState({ open, callback, popUpManager, host, options, }: Readonly<{ open: boolean; popUpManager: PopUpManager; host: HTMLElement; } & PartialWithUndefined<{ callback?: ((showPopUpResult: ShowPopUpResult | undefined) => void) | undefined; options?: Partial<PopUpManagerOptions> | undefined; }>>): void; /** * A helper type to be used with {@link renderMenuItemEntries}. * * @category PopUp */ export type ViraMenuItemEntry = { content: HtmlInterpolation; } & PartialWithUndefined<{ selected: boolean; /** Called when any item is activated. */ onClick: MenuItemClickCallback; /** * If set to `true`, this menu item won't show up at all. * * @default false */ hidden: boolean; }> & typeof ViraMenuItem.InputsType; /** * A callback for menu items getting activated, to be used with {@link renderMenuItemEntries}. * * @category PopUp */ export type MenuItemClickCallback = (params: Readonly<{ /** The menu item's index in the array. */ index: number; event: MouseEvent; }>) => MaybePromise<void>; /** * A helper for rendering a bunch of menu items. * * @category PopUp */ export declare function renderMenuItemEntries(items: ReadonlyArray<Readonly<ViraMenuItemEntry>>): import("lit-html").HTMLTemplateResult[];