-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathindex.d.ts
108 lines (93 loc) · 2 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/**
* Base options interface for notifications
*/
export interface NotifierOptions {
/**
* Notification message (can contains HTML)
*/
message: string;
/**
* Type of notification:
* - 'alert' (default)
* - 'confirm'
* - 'prompt'
*/
type?: string;
/**
* Add class `cdx-notify--${style}` to popup
* We have some default styles: 'success' and 'error'
*/
style?: string;
/**
* Notification expire time in ms (8s by default)
* Only 'alert' notifies expires
*/
time?: number;
}
/**
* Confirm notification options
*/
export interface ConfirmNotifierOptions extends NotifierOptions {
/**
* Text for confirmation button
* 'Confirm' by default
*/
okText?: string;
/**
* Confirm button pressing callback
* @param {MouseEvent} event
*/
okHandler?: (event: MouseEvent) => void;
/**
* Text for cancel button
* 'Cancel' by default
*/
cancelText?: string;
/**
* Cancel button or cross button pressing callback
* @param {MouseEvent} event
*/
cancelHandler?: (event: MouseEvent) => void;
}
/**
* Prompt notification options
*/
export interface PromptNotifierOptions extends NotifierOptions {
/**
* Text for the Submit button
* 'Ok' by default
*/
okText?: string;
/**
* Submit button pressing callback
* Gets input's value as a parameter
* @param {string} value
*/
okHandler: (value: string) => void;
/**
* Cross button pressing callback
* @param {MouseEvent} event
*/
cancelHandler?: (event: MouseEvent) => void;
/**
* Type of input
* 'text' by default
*/
inputType?: string;
/**
* Input placeholder
*/
placeholder?: string;
/**
* Input default value
*/
default?: string;
}
declare namespace notifier {
/**
* Show notification
* @param {NotifierOptions | ConfirmNotifierOptions | PromptNotifierOptions} options
*/
export function show(options: NotifierOptions | ConfirmNotifierOptions | PromptNotifierOptions): void;
}
export default notifier;