drab
Version:
Interactivity for You
32 lines (31 loc) • 1.05 kB
TypeScript
import { Base, type BaseAttributes } from "../base/index.js";
export type DialogAttributes = BaseAttributes & {
"click-outside-close"?: boolean;
"remove-body-scroll"?: boolean;
};
/**
* Provides triggers for the `HTMLDialogElement`.
*
* `click-outside-close`
*
* By default, the `HTMLDialogElement` doesn't close if the user clicks outside of it.
* Add a `click-outside-close` attribute to close when the user clicks outside.
*
* `remove-body-scroll`
*
* Add the `remove-body-scroll` attribute to remove the scroll from `document.body` when the dialog
* is open.
*/
export declare class Dialog extends Base {
#private;
constructor();
/** The `HTMLDialogElement` within the element. */
get dialog(): HTMLDialogElement;
/** `HTMLDialogElement.showModal()` with animation. */
show(): Promise<void>;
/** `HTMLDialogElement.close()` with animation. */
close(): Promise<void>;
/** `show` or `close` depending on the dialog's `open` attribute. */
toggle(): Promise<void>;
mount(): void;
}