import { LitElement } from 'lit'; import { NordEvent } from '../common/events.js'; import '../footer/Footer.js'; /** * Event dispatched when a modal is about to be dismissed. * The `trigger` property contains the original event that caused the dismiss. */ export declare class ModalCancelEvent extends NordEvent { trigger: Event; constructor(trigger: Event); } /** * Event dispatched when a modal is closed. * The `trigger` property contains the original event that caused the close, if available. */ export declare class ModalCloseEvent extends NordEvent { trigger: Event | undefined; constructor(trigger?: Event); } /** * Modal component is used to display content that temporarily blocks interactions * with the main view of an application. Modal should be used sparingly and * only when necessary. * * @status ready * @category overlay * @slot - Default slot * @slot header - Slot which holds the header of the modal, positioned next to the close button. * @slot feature - Slot for full bleed content like an image. * @slot footer - Slot which is typically used to hold call to action buttons, but can also be used to build custom footers. * @fires {ModalCancelEvent} cancel - Dispatched before the modal has closed when a user attempts to dismiss a modal. The event includes a trigger property containing the original event that caused the dismiss. Call preventDefault() on the event to prevent the modal closing. * @fires {ModalCloseEvent} close - Dispatched when a modal is closed for any reason. The event includes an optional trigger property containing the original event that caused the close, if the modal was closed by a user action. * * @cssprop [--n-modal-padding-inline=var(--n-space-m)] - Controls the padding on the sides of the modal, using our [spacing tokens](/tokens/#space). * @cssprop [--n-modal-padding-block=var(--n-space-m)] - Controls the padding above and below the header of the modal, using our [spacing tokens](/tokens/#space). * @cssprop [--n-modal-max-inline-size=620px] - Controls the width of the modal. * * @localization closeLabel - Accessible label for the close button. */ export default class Modal extends LitElement { static styles: import("lit").CSSResult[]; private modal; private backdrop; private lastTrigger?; private defaultSlot; private headerSlot; private featureSlot; private footerSlot; private localize; private modalController; /** * Controls whether the modal is open or not. */ open: boolean; /** * Controls the max-width of the modal when open. */ size: 's' | 'm' | 'l' | 'xl'; /** * The reason why the modal was closed. This typically indicates * which button the user pressed to close the modal, though any value * can be supplied if the modal is programmatically closed. */ returnValue: string; /** * By default if a modal is too big for the browser window, * the entire modal will scroll. This setting changes that behavior * so that the body of the modal scrolls instead, with the modal * itself remaining fixed. */ scrollable: boolean; /** * When true, the modal will not close when clicking the backdrop or pressing Escape, * and the close button will be hidden. Only programmatic close or custom action buttons * can dismiss the modal. */ persistent: boolean; connectedCallback(): void; disconnectedCallback(): void; /** * Show the modal, automatically moving focus to the modal or a child * element with an `autofocus` attribute. */ showModal(): void; /** * Programmatically close the modal. * @param returnValue An optional value to indicate why the modal was closed. * @param trigger An optional event that triggered the close. */ close(returnValue?: string, trigger?: Event): void; /** * Programmatically focus the modal. * @param options An object which controls aspects of the focusing process. */ focus(options?: FocusOptions): void; render(): import("lit").TemplateResult<1>; protected handleOpenUpdated(prev: boolean): void; private handleDismiss; } declare global { interface HTMLElementTagNameMap { 'nord-modal': Modal; } }