MCPcopy Create free account
hub / github.com/Sv443-Network/UserUtils / DialogOptions

Interface DialogOptions

lib/Dialog.ts:172–205  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

170
171/** Options passed to the Dialog constructor */
172export interface DialogOptions {
173 /** ID that gets added to child element IDs - has to be unique and conform to HTML ID naming rules! */
174 id: string;
175 /** Target and max width of the dialog in pixels */
176 width: number;
177 /** Target and max height of the dialog in pixels */
178 height: number;
179 /** Whether the dialog should close when the background is clicked - defaults to true */
180 closeOnBgClick?: boolean;
181 /** Whether the dialog should close when the escape key is pressed - defaults to true */
182 closeOnEscPress?: boolean;
183 /** Whether the dialog should be destroyed when it's closed - defaults to false */
184 destroyOnClose?: boolean;
185 /** Whether the dialog should be unmounted when it's closed - defaults to true - superseded by destroyOnClose */
186 unmountOnClose?: boolean;
187 /** Whether all listeners should be removed when the dialog is destroyed - defaults to true */
188 removeListenersOnDestroy?: boolean;
189 /** Whether the dialog should have a smaller overall appearance - defaults to false */
190 small?: boolean;
191 /** Where to align or anchor the dialog vertically - defaults to "center" */
192 verticalAlign?: "top" | "center" | "bottom";
193 /** Strings used in the dialog (used for translations) - defaults to the default English strings */
194 strings?: Partial<typeof defaultStrings>;
195 /** CSS to apply to the dialog - defaults to the {@linkcode defaultDialogCss} */
196 dialogCss?: string;
197 /** Called to render the body of the dialog */
198 renderBody: () => HTMLElement | Promise<HTMLElement>;
199 /** Called to render the header of the dialog - leave undefined for a blank header */
200 renderHeader?: () => HTMLElement | Promise<HTMLElement>;
201 /** Called to render the footer of the dialog - leave undefined for no footer */
202 renderFooter?: () => HTMLElement | Promise<HTMLElement>;
203 /** Called to render the close button of the dialog - leave undefined for no close button */
204 renderCloseBtn?: () => HTMLElement | Promise<HTMLElement>;
205}
206
207/** Creates and manages a modal dialog element */
208export class Dialog extends NanoEmitter<{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected