import { SvelteComponentTyped } from "svelte"; import type { SvelteHTMLElements } from "svelte/elements"; export type CarbonMenuPlacementContext = import("svelte/store").Writable; type $RestProps = SvelteHTMLElements["div"]; type $Props = { /** * Required. Specify the primary action button text. * Alternatively, use the "labelChildren" slot for custom button content; * `labelText` is still used as the accessible name in that case. */ labelText: string; /** * Set to `true` to disable both the primary action and trigger buttons. * @default false */ disabled?: boolean; /** * Set to `true` to show a loading spinner on the primary action button * and prevent it from being activated. Unlike `disabled`, the trigger * button is unaffected — the menu can still be opened while the primary * action is in flight. * @default false */ loading?: boolean; /** * Specify the accessible description for the primary action's loading * spinner. */ loadingDescription?: string | undefined; /** * Specify the size of both buttons and the menu row height. * @default "md" */ size?: "xs" | "sm" | "md" | "lg"; /** * 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 button group, the primary action and the * trigger together. `start` and `end` are the group'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 "end" */ intrinsicAlign?: "start" | "center" | "end"; /** * Set to `true` to open the menu. * @default false */ open?: boolean; /** * Specify the accessible label for the icon-only trigger button. * Set to an empty string to render the trigger without a tooltip, the * same way `Button` handles an empty `iconDescription` - the trigger then * has no accessible name of its own, so only do this when something else * in the surrounding context labels it. * @default "Additional actions" */ iconDescription?: string; /** * Set the tooltip placement in floating-ui form: the side, then `start` * or `end` along it, as Popover's `align` takes. Above and below, * `start` and `end` name inline sides, so they swap under `dir="rtl"`. * When set, takes precedence over `tooltipPosition` and `tooltipAlignment`. */ tooltipAlign?: "top" | "top-start" | "top-end" | "bottom" | "bottom-start" | "bottom-end" | "left" | "left-start" | "left-end" | "right" | "right-start" | "right-end" | undefined; /** * Set the position of the icon-only trigger's tooltip. * Independent of `direction`, which controls where the menu opens. * @deprecated use `tooltipAlign` * @default "bottom" */ tooltipPosition?: "top" | "right" | "bottom" | "left"; /** * Set the alignment of the icon-only trigger's tooltip relative to the * trigger. Use `"end"` when the button sits at the right edge of a page. * @deprecated use `tooltipAlign` * @default "center" */ tooltipAlignment?: "start" | "center" | "end"; /** * Obtain a reference to the outer HTML element. * @default null */ ref?: null | HTMLDivElement; /** Custom content for the primary action button. `labelText` remains the accessible name. */ labelChildren?: (this: void) => void; children?: (this: void) => void; [key: `data-${string}`]: unknown; }; export type ComboButtonProps = Omit<$RestProps, keyof $Props> & $Props; export default class ComboButton extends SvelteComponentTyped< ComboButtonProps, { blur: CustomEvent; "blur:trigger": CustomEvent; click: CustomEvent; /** Fires when the menu trigger button is clicked, separate from the primary action's `click` event. */ "click:trigger": CustomEvent; close: CustomEvent<{ trigger: "escape-key" | "outside-click" | "select"; }>; focus: CustomEvent; "focus:trigger": CustomEvent; mousedown: CustomEvent; "mousedown:trigger": CustomEvent; mouseenter: CustomEvent; "mouseenter:trigger": CustomEvent; mouseleave: CustomEvent; "mouseleave:trigger": CustomEvent; mouseover: CustomEvent; "mouseover:trigger": CustomEvent; }, { default: Record; /** Custom content for the primary action button. `labelText` remains the accessible name. */ labelChildren: Record; } > {}