import * as solid_js from 'solid-js'; import { Signal } from 'solid-js'; import { EventHookOn } from '@solidjs-use/shared'; type UseConfirmDialogRevealResult = { data?: C; isCanceled: false; } | { data?: D; isCanceled: true; }; interface UseConfirmDialogReturn { /** * Opens the dialog. * Create promise and return it. Triggers `onReveal` hook. */ reveal: (data?: RevealData) => Promise>; /** * Confirms and closes the dialog. Triggers a callback inside `onConfirm` hook. * Resolves promise from `reveal()` with `data` and `isCanceled` Accessor with `false` value. * Can accept any data and to pass it to `onConfirm` hook. */ confirm: (data?: ConfirmData) => void; /** * Cancels and closes the dialog. Triggers a callback inside `onCancel` hook. * Resolves promise from `reveal()` with `data` and `isCanceled` Accessor with `true` value. * Can accept any data and to pass it to `onCancel` hook. */ cancel: (data?: CancelData) => void; /** * Event Hook to be triggered right before dialog creating. */ onReveal: EventHookOn; /** * Event Hook to be called on `confirm()`. * Gets data object from `confirm` function. */ onConfirm: EventHookOn; /** * Event Hook to be called on `cancel()`. * Gets data object from `cancel` function. */ onCancel: EventHookOn; } /** * Hooks for creating confirm dialogs. Useful for modal windows, popups and logins. * * @see https://solidjs-use.github.io/solidjs-use/core/useConfirmDialog */ declare function useConfirmDialog([revealed, setRevealed]?: Signal): { isRevealed: solid_js.Accessor; reveal: (data?: RevealData) => Promise>; confirm: (data?: ConfirmData) => void; cancel: (data?: CancelData) => void; onReveal: EventHookOn; onConfirm: EventHookOn; onCancel: EventHookOn; }; export { UseConfirmDialogReturn, UseConfirmDialogRevealResult, useConfirmDialog };