import { SvelteComponentTyped } from "svelte"; import type { SvelteHTMLElements } from "svelte/elements"; type $RestProps = SvelteHTMLElements["button"]; type $Props = { /** * Required. Specify the trigger button text. * Alternatively, use the "labelChildren" slot for custom trigger content; * `labelText` is still used as the accessible name in that case. * When `iconOnly` is `true`, the text is not rendered but remains the * trigger's accessible name. */ labelText: string; /** * Set to `true` to render an icon-only trigger * @default false */ iconOnly?: boolean; /** * Specify the icon to render in the icon-only trigger. * @default OverflowMenuVertical */ icon?: Icon; /** * Specify the ARIA label and title for the icon-only trigger's icon. * Defaults to `labelText`. */ iconDescription?: string | undefined; /** * Specify the kind of button. * Does not apply when `iconOnly` is `true`; the icon-only trigger is * always ghost. * @default "primary" */ kind?: "primary" | "tertiary" | "ghost"; /** * Specify the size of the trigger button and the menu's row height. * @default "md" */ size?: "xs" | "sm" | "md" | "lg"; /** * Set to `true` to disable the trigger button * @default false */ disabled?: boolean; /** * Set the preferred direction the menu opens toward. * The menu flips to the opposite direction if there is not enough space. * @default "bottom" */ direction?: "top" | "bottom"; /** * Align the menu to the trigger button. * `start` and `end` are the trigger's inline start and end, which swap * under `dir="rtl"`. * A menu that would run past a side of the window takes another * alignment for that open. * @default "start" */ intrinsicAlign?: "start" | "center" | "end"; /** * Specify the maximum height of the menu. * A number is treated as pixels; a string is used as a CSS length. * The menu scrolls once its items exceed the height. */ maxHeight?: number | string | undefined; /** * Set to `true` to open the menu. * @default false */ open?: boolean; /** * Obtain a reference to the trigger button HTML element. * @default null */ ref?: null | HTMLButtonElement; labelChildren?: (this: void) => void; children?: (this: void) => void; [key: `data-${string}`]: unknown; }; export type MenuButtonProps = Omit<$RestProps, keyof $Props> & $Props; export default class MenuButton extends SvelteComponentTyped< MenuButtonProps, { blur: CustomEvent; click: CustomEvent; close: CustomEvent<{ trigger: "escape-key" | "outside-click" | "select"; }>; focus: CustomEvent; mousedown: CustomEvent; mouseenter: CustomEvent; mouseleave: CustomEvent; mouseover: CustomEvent; }, { default: Record; labelChildren: Record; } > {}