/** * Represents a value that may be of type T, or null. */ export type Nullable = T | null; /** * Stable identifier for the reason that the modal is about to close. */ export type CloseRequestReason = (typeof ModalElement.CLOSE_REQUEST_REASONS)[keyof typeof ModalElement.CLOSE_REQUEST_REASONS]; /** * Custom events with a `command` property that can be dispatched on the modal * element to trigger certain actions, such as opening or closing the modal. */ export type CommandEvent = Event & { command: string; }; /** * @summary A custom element that renders a modal dialog. * @documentation https://github.com/georapbox/modal-element * * @tagname modal-element - This is the default tag name, unless overridden by the `defineCustomElement` method. * @extends HTMLElement * * @property {boolean} open - Determines whether the modal is open or not. * @property {boolean} staticBackdrop - Determines whether the modal should close when the backdrop is clicked. * @property {boolean} noHeader - Determines whether the modal should have a header or not. * @property {boolean} noAnimations - Determines whether the modal should have animations or not when opening and closing. * @property {boolean} noCloseButton - Determines whether the modal should have a default close button or not. * @property {boolean} fullscreen - Determines whether the modal should be fullscreen or not. * @property {boolean} preserveOverflow - Determines whether the overflow of the body should be preserved when the modal is open. * @property {string} placement - Determines the placement of the modal. * @property {string} closeLabel - The label of the default close button, used as the aria-label attribute of the close button. * * @attribute {boolean} open - Determines whether the modal is open or not. * @attribute {boolean} static-backdrop - Determines whether the modal should close when the backdrop is clicked. * @attribute {boolean} no-header - Determines whether the modal should have a header or not. * @attribute {boolean} no-animations - Determines whether the modal should have animations or not when opening and closing. * @attribute {boolean} no-close-button - Determines whether the modal should have a default close button or not. * @attribute {boolean} fullscreen - Determines whether the modal should be fullscreen or not. * @attribute {boolean} preserve-overflow - Determines whether the overflow of the body should be preserved when the modal is open. * @attribute {string} placement - Determines the placement of the modal. * @attribute {string} close-label - The label of the default close button, used as the aria-label attribute of the close button. * * @slot - The modal's main content (default/unnamed slot). * @slot header - The modal's header content, usually a title. * @slot footer - The modals' footer content. Usually used for buttons or other actions. * @slot close - The content of the close button that appears in the modal's header. * * @cssproperty --me-width - The width of the modal. * @cssproperty --me-height - The height of the modal. * @cssproperty --me-border-color - The border color of the modal. * @cssproperty --me-border-style - The border style of the modal. * @cssproperty --me-border-width - The border width of the modal. * @cssproperty --me-border-radius - The border radius of the modal. * @cssproperty --me-box-shadow - The box shadow of the modal. * @cssproperty --me-background-color - The background color of the modal. * @cssproperty --me-color - The foreground color of the modal. * @cssproperty --me-header-spacing - The spacing of the header. * @cssproperty --me-header-background-color - The background color of the header. * @cssproperty --me-header-color - The foreground color of the header. * @cssproperty --me-body-spacing - The spacing of the body. * @cssproperty --me-body-background-color - The background color of the body. * @cssproperty --me-body-color - The foreground color of the body. * @cssproperty --me-footer-spacing - The spacing of the footer. * @cssproperty --me-footer-background-color - The background color of the footer. * @cssproperty --me-footer-color - The foreground color of the footer. * @cssproperty --me-close-padding - The padding of the close button. * @cssproperty --me-close-border - The border shorthand property of the close button. * @cssproperty --me-close-border-radius - The border radius shorthand property of the close button. * @cssproperty --me-close-background-color - The background color of the close button. * @cssproperty --me-close-color - The foreground color of the close button. * @cssproperty --me-close-font-size - The font size of the close button. * @cssproperty --me-backdrop-background - The background shorthand property of the backdrop. * @cssproperty --me-backdrop-filter - The backdrop filter property of the backdrop. * * @csspart base - The base wrapper of the modal. * @csspart panel - The panel wrapper of the modal. * @csspart header - The header wrapper of the modal. * @csspart title - The title wrapper of the modal. * @csspart close - The default close button rendered in the modal's header. * @csspart close-icon - The close icon of the default close button. * @csspart body - The body wrapper of the modal. * @csspart footer - The footer wrapper of the modal. * * @fires me-open - Dispatched when the modal is opened. * @fires me-close - Dispatched when the modal is closed. * @fires me-request-close - Dispatched when the modal is about to close. * * @method defineCustomElement - Static method. Defines a custom element with the given name. * @method show - Instance method. Opens the modal if it is closed, otherwise does nothing. * @method hide - Instance method. Closes the modal if it is open, otherwise does nothing. */ export class ModalElement extends HTMLElement { /** * Central list of all possible reasons that the modal is about to close. * @readonly */ static readonly CLOSE_REQUEST_REASONS: { readonly CLOSE_BUTTON: "close-button"; readonly ESCAPE_KEY: "escape-key"; readonly BACKDROP_CLICK: "backdrop-click"; readonly EXTERNAL_INVOKER: "external-invoker"; }; static get observedAttributes(): string[]; /** * Defines the custom element with the given name. * The name must contain a dash (-). * * @param {string} [elementName='modal-element'] - The name of the custom element. */ static defineCustomElement(elementName?: string): void; /** * Lifecycle method that is called when attributes are changed, added, removed, or replaced. * * @param {string} name - The name of the attribute. * @param {string} oldValue - The old value of the attribute. * @param {string} newValue - The new value of the attribute. */ attributeChangedCallback(name: string, oldValue: string, newValue: string): void; /** * Lifecycle method that is called when the element is added to the DOM. */ connectedCallback(): void; /** * Lifecycle method that is called when the element is removed from the DOM. */ disconnectedCallback(): void; set open(value: boolean); /** * Deternimes if the modal is open or not. * * @type {boolean} - True if the modal is open, otherwise false. * @attribute open * @default false */ get open(): boolean; set staticBackdrop(value: boolean); /** * Determines whether the modal should close when the backdrop is clicked. * * @type {boolean} - True if the modal should close when the backdrop is clicked, otherwise false. * @attribute static-backdrop * @default false */ get staticBackdrop(): boolean; set noHeader(value: boolean); /** * Determines whether the modal should have a header or not. * * @type {boolean} - True if the modal should have a header, otherwise false. * @attribute no-header * @default false */ get noHeader(): boolean; set noAnimations(value: boolean); /** * Determines whether the modal should have animations or not when opening and closing. * * @type {boolean} - True if the modal should have animations, otherwise false. * @attribute no-animations * @default false */ get noAnimations(): boolean; set noCloseButton(value: boolean); /** * Determines whether the modal should have a default close button or not. * * @type {boolean} - True if the modal should have a close button, otherwise false. * @attribute no-close-button * @default false */ get noCloseButton(): boolean; set fullscreen(value: boolean); /** * Determines whether the modal should be fullscreen or not. * * @type {boolean} - True if the modal should be fullscreen, otherwise false. * @attribute fullscreen * @default false */ get fullscreen(): boolean; set preserveOverflow(value: boolean); /** * Determines whether the overflow of the body should be preserved when the modal is open. * * @type {boolean} - True if the overflow of the body should be preserved, otherwise false. * @attribute preserve-overflow * @default false */ get preserveOverflow(): boolean; set placement(value: string); /** * Determines the placement of the modal. * Possible values are 'top-start', 'top-center', 'top-end', 'center-start', 'center', 'center-end', 'bottom-start', 'bottom-center', 'bottom-end'. * * @type {string} * @attribute placement * @default 'center' */ get placement(): string; set closeLabel(value: string); /** * The label of the default close button, used as the aria-label attribute of the close button. * If user provides text content for the close button using the `close` slot, this property is ignored and the aria-label attribute is removed. * * @type {string} * @attribute close-label * @default 'Close' */ get closeLabel(): string; /** * Opens the modal if it is closed, otherwise does nothing. * Make sure that the custom element is defined before calling this method. * * @example * const modal = document.querySelector('modal-element'); * modal.show(); */ show(): void; /** * Closes the modal if it is open, otherwise does nothing. * Make sure that the custom element is defined before calling this method. * * @example * const modal = document.querySelector('modal-element'); * modal.hide(); */ hide(): void; #private; } //# sourceMappingURL=modal-element.d.ts.map