forked from tabrez96/cogo-toast
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
76 lines (65 loc) · 1.58 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import React, { ReactNode, MouseEventHandler } from 'react';
export interface IconProps {
[key: string]: string|number;
}
export interface Theme {
success: '#6EC05F';
info: '#1271EC';
warn: '#FED953';
error: '#D60A2E';
loading: '#0088ff';
}
export interface Icons {
success: React.FC<IconProps>;
info: React.FC<IconProps>;
warn: React.FC<IconProps>;
error: React.FC<IconProps>;
loading: React.FC<IconProps>;
}
export type CTOptions = Partial<{
hideAfter: number;
position:
| 'top-left'
| 'top-center'
| 'top-right'
| 'bottom-left'
| 'bottom-center'
| 'bottom-right';
heading: string;
role: string;
toastContainerID: string;
renderIcon: Function;
bar: Partial<{
size: string;
style: 'solid' | 'dashed' | 'dotted';
color: string;
}>;
onClick: MouseEventHandler;
onHide: Function;
theme?: InterfaceTheme;
icons?: Icons;
}>;
export type CTMethodOptions = CTOptions & { type: string };
export type HideToastFunction = () => void;
export type Message = string | ReactNode;
export type CTReturn = (Promise<void> & { hide?: HideToastFunction }) | void;
export type CTMethod = (message: Message, options?: CTOptions) => CTReturn;
export type CTMainMethod = (
message: Message,
options?: CTMethodOptions,
) => CTReturn;
export type CToast = {
success: CTMethod;
warn: CTMethod;
info: CTMethod;
error: CTMethod;
loading: CTMethod;
};
declare namespace cogoToast {
const success: CTMethod;
const info: CTMethod;
const loading: CTMethod;
const warn: CTMethod;
const error: CTMethod;
}
export default cogoToast;