UNPKG

maz-ui

Version:

A standalone components library for Vue.Js 3 & Nuxt.Js 3

48 lines (47 loc) 1.77 kB
import { Ref } from 'vue'; import { MazBtnProps } from '../MazBtn.vue'; import { MazDialogConfirmInternalProps } from '../MazDialogConfirm.vue'; export interface MazDialogConfirmState { id: string; isActive: boolean; accept: (value: unknown) => void; reject?: (reason?: unknown) => void; } export interface MazDialogConfirmButtonAction extends Omit<MazBtnProps, 'type'> { type: never; text?: string; onClick: () => unknown; } export interface MazDialogConfirmButtonPromised extends Omit<MazBtnProps, 'type'> { text?: string; type: 'accept' | 'reject'; response?: unknown; } export type MazDialogConfirmButton = MazDialogConfirmButtonPromised | MazDialogConfirmButtonAction; export type MazDialogConfirmData = Omit<MazDialogConfirmInternalProps, 'identifier'>; export declare const defaultData: { buttons: undefined; acceptText: string; hideAcceptButton: false; acceptProps: { color: "success"; type: "accept"; response: string; }; rejectText: string; hideRejectButton: false; rejectProps: { color: "destructive"; type: "reject"; response: string; }; }; declare function showDialogAndWaitChoice(identifier: string, callback?: () => unknown): Promise<unknown>; export declare function useMazDialogConfirm(): { data: Ref<MazDialogConfirmData, MazDialogConfirmData>; dialogState: Ref<MazDialogConfirmState[], MazDialogConfirmState[]>; showDialogAndWaitChoice: typeof showDialogAndWaitChoice; reject: (currentDialog: MazDialogConfirmState, response?: unknown, onClick?: () => unknown) => Promise<unknown>; accept: (currentDialog: MazDialogConfirmState, response?: unknown, onClick?: () => unknown) => Promise<unknown>; }; export {};