import type { EventEmitter } from '../../stencil-public-runtime'; import type { ModalActionsLayout, ModalCloseEvent, ModalCloseReason, ModalSize, ModalVariant } from './mud-modal.types'; /** * Modal — overlay dialog molecule. * * Renders a centered dialog card on top of a dimmed backdrop using the native * `` element internally. The native element provides the focus trap, * ESC handling, and top-layer rendering required for WCAG 2.1 AA Modal * conformance (SC 2.1.2 No Keyboard Trap reversed: focus IS trapped inside an * active dialog and returned on close). * * Pattern B (internal DOM): the dialog, backdrop, header, body and footer all * live inside shadow DOM. Consumers project content through five slots * (`title`, `icon`, `image`, default body, `actions`) and toggle visibility * via the `open` prop or the imperative `openModal()` / `closeModal()` * methods. * * Variants control the header treatment: * - `default` — title + close button (text-only header) * - `with-image` — full-bleed hero image at top with overlaid close button * - `with-icon` — leading 48px icon above the body content (no top header bar) * * Dismiss reasons routed through `mudClose<{reason}>`: * - `backdrop` — click on backdrop (suppressed by `closeOnBackdrop=false`) * - `escape` — ESC keypress (suppressed by `closeOnEscape=false`) * - `close-button` — trailing × button activated * - `action` — programmatic via `closeModal('action')`, used by footer buttons * * @element mud-modal * * @slot - (default) The dialog body content. Plain text or rich content. * @slot title - Rich title content. Overrides the `title` prop when populated. * @slot icon - Leading 48px icon for the `with-icon` variant. * @slot image - Full-bleed hero image for the `with-image` variant. * @slot actions - Footer action group. Typically `mud-button` instances. */ export declare class MudModal { /** * Whether the modal is currently shown. Reflected so consumers can target * `mud-modal[open]` in selectors. Mutable so the component can flip it back * to `false` on internal dismiss (backdrop / escape / close button). * @default false */ open: boolean; /** * Visual size rung. Drives the dialog max-width and the typography scale of * title and body copy. * @default 'md' */ size: ModalSize; /** * Header treatment. * - `default` — title bar + close button * - `with-image` — hero image as header (close button overlaid) * - `with-icon` — leading 48px icon, no top bar * @default 'default' */ variant: ModalVariant; /** * Title text rendered in the header. The named `title` slot, when filled, * overrides this prop to allow rich content. */ titleText?: string; /** * Hero image URL for the `with-image` variant. Rendered as the slot fallback * — if a consumer projects their own `` / `` it * wins. Pair with `imageAlt` for accessibility (empty alt is acceptable for * decorative images). */ imageSrc?: string; /** * Alt text for the prop-driven hero image. Use an empty string when the image * is purely decorative and the title/body already describes the action. * @default '' */ imageAlt: string; /** * When `true`, renders a trailing × close button in the header. Activating * it emits `mudClose` with `reason: 'close-button'`. Hide it for required * confirmation flows by setting `closable=false`. * @default true */ closable: boolean; /** * Whether a click on the backdrop dismisses the modal. Disable for flows * that demand an explicit decision (e.g. unsaved-changes confirmation). * @default true */ closeOnBackdrop: boolean; /** * Whether pressing ESC dismisses the modal. Disable to enforce a deliberate * confirmation; pair with `closable=false` and footer actions for the * strictest dialog contract. * @default true */ closeOnEscape: boolean; /** * Styles the dialog frame and footer for an irreversible action (e.g. * delete account). Adds a red top border accent and is intended to be paired * with a destructive primary `mud-button` in the actions slot. * @default false */ destructive: boolean; /** * Footer button arrangement (Figma 358:16247). * - `inline` — buttons sit side-by-side, right-aligned (default) * - `stacked` — buttons span the full footer width, stacked vertically (primary on top) * * For mobile / touch layouts use `stacked` and slot the action buttons * DIRECTLY (`` each, primary first) — not * wrapped in a container. A wrapped `
` stays inline because * its own layout can't be restyled from the modal's shadow CSS. * @default 'inline' */ actionsLayout: ModalActionsLayout; /** * Accessible name forwarded to the host as `aria-label`. Required when no * title is provided. The consumer-supplied `aria-label` attribute is captured * on connect into `resolvedAriaLabel` and stripped from the host to avoid * Stencil's attribute-observer / render-loop antipattern (same pattern as * mud-radio / mud-switch / mud-tooltip / mud-accordion / mud-breadcrumb / * mud-date-picker). */ label?: string; /** * Accessible label for the close × button. Defaults to the Romanian * "Închide". * @default 'Închide' */ closeLabel: string; private hasTitleSlot; private hasIconSlot; private hasImageSlot; private hasActionsSlot; private resolvedAriaLabel?; host: HTMLMudModalElement; /** * Fires after the dialog has been shown. */ mudOpen: EventEmitter; /** * Fires after the dialog has been dismissed. Payload carries the `reason` * so consumers can distinguish backdrop vs. escape vs. close-button vs. * footer-action dismissals. */ mudClose: EventEmitter; private dialogRef?; private previousActiveElement; private readonly titleId; private readonly bodyId; private suppressNativeClose; componentWillLoad(): void; private captureAriaLabel; syncLabel(next?: string): void; componentDidLoad(): void; disconnectedCallback(): void; handleOpenChange(next: boolean, prev: boolean): void; /** * Imperatively open the dialog. Equivalent to setting `open=true`. * Emits `mudOpen` once the dialog is visible. */ openModal(): Promise; /** * Imperatively close the dialog. Emits `mudClose` with the supplied reason * (defaults to `'action'`, intended for footer button handlers). */ closeModal(reason?: ModalCloseReason): Promise; private detectSlots; private onTitleSlotChange; private onIconSlotChange; private onImageSlotChange; private onActionsSlotChange; private showDialog; private hideDialog; private dismiss; private handleBackdropClick; private handleDialogCancel; private handleDialogClose; private handleCloseButtonClick; private handleCloseButtonKeyDown; private renderCloseButton; private renderHeader; private renderBody; private renderFooter; render(): any; }