UNPKG

@conectate/ct-dialog

Version:

HTML dialog made with Web Components

77 lines (76 loc) 2.1 kB
import "@conectate/ct-card"; import "@conectate/ct-spinner"; import "@conectate/lit-if"; import { CtLit } from "@conectate/ct-lit"; import { CtDialog } from "./ct-dialog.js"; /** * ## `ct-loading` * A dialog component that displays a loading spinner with customizable text. * * ### Usage * ```javascript * import { showCtLoading } from '@conectate/ct-dialog'; * * // Show a loading dialog * const loadingDialog = showCtLoading(); * * // Show a loading dialog with custom text * const customLoadingDialog = showCtLoading(undefined, 'Processing'); * * // Close the dialog when operation completes * loadingDialog.close(); * ``` * * @group ct-elements * @element ct-loading */ export declare class CtLoading extends CtLit { /** * Text to display next to the spinner */ ttl: string; /** * Reference to the internal dialog instance */ dialog: CtDialog; render(): import("lit").TemplateResult<1>; static get properties(): { ttl: { type: StringConstructor; }; }; } declare global { interface HTMLElementTagNameMap { "ct-loading": CtLoading; } } /** * Displays a loading dialog with a spinner and optional custom text * * @param {string} [id] - Optional identifier for the dialog * @param {string} [str] - Optional custom text to display (default: "Loading") * @returns {CtDialog} The created dialog instance * * @example * ```javascript * // Display a loading dialog * const dialog = showCtLoading(); * * // Do some async operation * await someAsyncOperation(); * * // Close the loading dialog when complete * dialog.close(); * ``` */ export declare function showCtLoading(id?: string, str?: string): CtDialog; /** * Displays a loading dialog and returns the CtLoading instance * * @param {string} [id] - Optional identifier for the dialog * @param {string} [str] - Optional custom text to display (default: "Loading") * @returns {CtLoading} The created CtLoading instance */ export declare function showCtLoading2(id?: string, str?: string): CtLoading; export { CtDialog };