@kwiz/fluentui
Version:
KWIZ common controls for FluentUI
27 lines (26 loc) • 1.07 kB
TypeScript
import { IPrompterProps } from "../controls/prompt";
import { ButtonEXProps } from "../types";
export type iAlertPrompterProps = Omit<IPrompterProps, "onOK"> & {
/** return false to prevent closing the dialog. */
onOK?: () => Promise<void> | void | Promise<boolean> | boolean;
};
type confirmOptions = {
onOK?: () => void;
onCancel?: () => void;
okProps?: Partial<ButtonEXProps>;
cancelProps?: Partial<ButtonEXProps>;
};
type confirmEXOverloads = {
(message: string | JSX.Element, onOK?: () => void, onCancel?: () => void): Promise<boolean>;
(message: string | JSX.Element, options?: confirmOptions): Promise<boolean>;
};
export interface iAlerts {
promptEX: (info: iAlertPrompterProps) => void;
confirmEX: confirmEXOverloads;
alertEX: (message: string | JSX.Element, onOK?: () => void) => Promise<void>;
alertPrompt?: JSX.Element;
close: () => void;
}
/** Easily prompt, confirm or alert the user. To use this you must render the alertPrompt in your element. */
export declare function useAlerts(): iAlerts;
export {};