import { IDialogButton, IDialogSeverity } from './components/types.ts'; export type * from './components/types.ts'; /** * This class provides generic Nextcloud themed dialogs */ export declare class Dialog { #private; constructor(name: string, text: string, buttons?: IDialogButton[], severity?: IDialogSeverity); /** * Spawn and show the dialog - if already open the previous instance will be destroyed * * @return Promise that resolves when the dialog is answered successfully and rejects on close */ show(): Promise; } /** * The DialogBuilder provides an easy to use interface for creating simple dialogs in consistent Nextcloud design * * @example * ```ts * // It is recommended to use `getDialogBuilder` instead * const dialogBuilder = new DialogBuilder('The dialog title') * const dialog = dialogBuilder * .setText('The dialog message') * .setSeverity(DialogSeverity.Warning) * .addButton({ * label: 'Ok', * callback: () => console.warn('Warning was dismissed'), * }) * .build() * ``` */ export declare class DialogBuilder { #private; constructor(name?: string); /** * Set dialog name * * @param name The name or headline of the dialog */ setName(name: string): this; /** * Set the dialog text * * @param text Main text of the dialog */ setText(text: string): this; /** * Set the severity of the dialog * * @param severity Severity of the dialog */ setSeverity(severity: IDialogSeverity): this; /** * Set buttons from array * * @param buttons Either an array of dialog buttons */ setButtons(buttons: IDialogButton[]): this; /** * Add a single button * * @param button Button to add */ addButton(button: IDialogButton): this; build(): Dialog; } /** * Get the dialog builder to create a new dialog * * @param name The name of the dialog (title) * @example * ```ts * const dialog = getDialogBuilder('Confirm action') * .addButton({ * label: 'Ok', * callback: () => console.warn('confirmed'), * }) * .build() * ``` */ export declare function getDialogBuilder(name: string): DialogBuilder; export interface ConfirmationDialogOptions { /** The name of the dialog (heading) */ name: string; /** The text of the dialog */ text: string; /** The text of the confirmation button */ labelConfirm?: string; /** The text of the reject button */ labelReject?: string; /** The severity */ severity?: IDialogSeverity; } /** * Open a new confirmation dialog. * The dialog either resolves to true when the confirm-button was pressed, * or to false if the reject-button was pressed. * * @param options - Dialog options see `ConfirmationDialogOptions` */ export declare function showConfirmation(options: ConfirmationDialogOptions): Promise;