2022-08-26 16:19:39 +05:00
|
|
|
import { eSendEvent } from "../../services/event-manager";
|
|
|
|
|
import { eCloseSimpleDialog, eOpenSimpleDialog } from "../../utils/events";
|
2021-07-01 22:34:18 +05:00
|
|
|
|
|
|
|
|
type DialogInfo = {
|
2022-01-22 12:57:05 +05:00
|
|
|
title?: string;
|
|
|
|
|
paragraph?: string;
|
|
|
|
|
positiveText?: string;
|
|
|
|
|
negativeText?: string;
|
2022-08-27 15:23:11 +05:00
|
|
|
positivePress?: (value: unknown) => void;
|
2022-01-22 12:57:05 +05:00
|
|
|
onClose?: () => void;
|
|
|
|
|
positiveType?:
|
2022-08-26 16:19:39 +05:00
|
|
|
| "transparent"
|
|
|
|
|
| "gray"
|
|
|
|
|
| "grayBg"
|
|
|
|
|
| "accent"
|
|
|
|
|
| "inverted"
|
|
|
|
|
| "shade"
|
|
|
|
|
| "error"
|
|
|
|
|
| "errorShade";
|
2022-01-22 12:57:05 +05:00
|
|
|
icon?: string;
|
|
|
|
|
paragraphColor: string;
|
|
|
|
|
input: boolean;
|
|
|
|
|
inputPlaceholder: string;
|
|
|
|
|
defaultValue: string;
|
2022-08-26 16:19:39 +05:00
|
|
|
context: "global" | "local";
|
2022-01-22 12:57:05 +05:00
|
|
|
};
|
2021-07-01 22:34:18 +05:00
|
|
|
|
2022-02-08 15:44:13 +05:00
|
|
|
export function presentDialog(data: Partial<DialogInfo>): void {
|
2021-07-01 22:34:18 +05:00
|
|
|
eSendEvent(eOpenSimpleDialog, data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function hideDialog(): void {
|
|
|
|
|
eSendEvent(eCloseSimpleDialog);
|
2022-01-22 12:57:05 +05:00
|
|
|
}
|