-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathIziToast.fs
More file actions
230 lines (220 loc) · 10.4 KB
/
IziToast.fs
File metadata and controls
230 lines (220 loc) · 10.4 KB
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
// ts2fable 0.0.0
module rec IziToast
#nowarn "3390" // disable warnings for invalid XML comments
open System
open Fable.Core
open Fable.Core.JS
open Browser.Types
type Array<'T> = System.Collections.Generic.IList<'T>
let [<ImportAll("izitoast")>] iziToast: IziToast = jsNative
type [<StringEnum>] [<RequireQualifiedAccess>] IziToastPosition =
| BottomRight
| BottomLeft
| TopRight
| TopLeft
| TopCenter
| BottomCenter
| Center
type [<StringEnum>] [<RequireQualifiedAccess>] IziToastTransitionIn =
| BounceInLeft
| BounceInRight
| BounceInUp
| BounceInDown
| FadeIn
| FadeInDown
| FadeInUp
| FadeInLeft
| FadeInRight
| FlipInX
type [<StringEnum>] [<RequireQualifiedAccess>] IziToastTransitionOut =
| FadeOut
| FadeOutUp
| FadeOutDown
| FadeOutLeft
| FadeOutRight
| FlipOutX
type [<AllowNullLiteral>] IziToastSettings =
/// Id of the toast
abstract id: string option with get, set
/// The class that will be applied to the toast. It may be used as a reference.
abstract ``class``: string option with get, set
/// Title of the toast.
abstract title: string option with get, set
/// Title color.
abstract titleColor: string option with get, set
/// Title fontSize.
abstract titleSize: string option with get, set
/// Title lineHeight.
abstract titleLineHeight: string option with get, set
/// Message of notification.
abstract message: string option with get, set
/// Message color.
abstract messageColor: string option with get, set
/// Message fontSize.
abstract messageSize: string option with get, set
/// Message lineHeight.
abstract messageLineHeight: string option with get, set
/// Background color of the Toast
abstract backgroundColor: string option with get, set
/// It can be light or dark or set another class. Create and use like this ".iziToast-theme-name"
/// Default value: light
abstract theme: string option with get, set
/// It can be #hexadecimal, pre-defined themes like blue, red, green and yellow or set another class. Create and use like this ".iziToast-color-name"
abstract color: string option with get, set
/// Icon class (font-icon of your choice, Icomoon, Fontawesome etc.).
abstract icon: string option with get, set
/// Icon text (font-icon using text, Material Icons, etc.).
abstract iconText: string option with get, set
/// Icon color.
abstract iconColor: string option with get, set
/// Cover image.
abstract image: string option with get, set
/// Width of cover image.
/// Default value: 50
abstract imageWidth: float option with get, set
/// Sets maxWidth of toast.
abstract maxWidth: float option with get, set
/// The z-index CSS attribute of the toast
/// Default value: 99999
abstract zindex: float option with get, set
/// It can be 1 or 2, or use another layout, creating the class like this: ".iziToast-layout3"
/// Default value: 1
abstract layout: float option with get, set
/// Applies a balloon like toast.
/// Default value: false
abstract balloon: bool option with get, set
/// Show "x" close button.
/// Default value: true
abstract close: bool option with get, set
/// Allows to close toast using the Esc key.
/// Default value: false
abstract closeOnEscape: bool option with get, set
/// Allows to close toast by clicking itself.
/// Default value: false
abstract closeOnClick: bool option with get, set
/// RTL option
/// Default value: false
abstract rtl: bool option with get, set
/// Where it will be shown.
/// Default value: bottomRight
abstract position: IziToastPosition option with get, set
/// Fixed place where you want to show the toasts.
abstract target: string option with get, set
/// Add toast to first position.
/// Default value: true
abstract targetFirst: bool option with get, set
/// Waits until the toast is closed so you can open it (Use 1 or 'once').
/// Replaces the toast that was already open (Use 2 or 'replace').
/// Default value: 0
abstract displayMode: float option with get, set
/// Amount in milliseconds to close the toast or false to disable.
/// Default value: 5000
abstract timeout: U2<bool, float> option with get, set
/// Drag feature used to close the toast.
/// Default value: true
abstract drag: bool option with get, set
/// Pause the toast timeout while the cursor is on it.
/// Default value: true
abstract pauseOnHover: bool option with get, set
/// Reset the toast timeout while the cursor is on it.
/// Default value: false
abstract resetOnHover: bool option with get, set
/// Enable timeout progress bar.
/// Default value: true
abstract progressBar: bool option with get, set
/// Progress bar color.
abstract progressBarColor: string option with get, set
/// Animation Easing of progress bar.
/// Default value: linear
abstract progressBarEasing: string option with get, set
/// Enables display the Overlay layer on the page.
/// Default value: false
abstract overlay: bool option with get, set
/// Allows to close toast clicking on the Overlay.
/// Default value: false
abstract overlayClose: bool option with get, set
/// Overlay background color.
/// Default value: rgba(0, 0, 0, 0.6)
abstract overlayColor: string option with get, set
/// Enable animations of elements in the toast.
/// Default value: true
abstract animateInside: bool option with get, set
/// Array of buttons.
/// The first parameter is html string
/// The second parameter is click event callback
/// The last parameter is a boolean that defines whether there will be focus or not.
abstract buttons: ResizeArray<string * (IziToast -> HTMLDivElement -> HTMLButtonElement -> MouseEvent -> Array<HTMLInputElement> -> unit) * bool> option with get, set
/// Array of inputs.
/// The first parameter is html string
/// The second and third parameters is event type and event callback
/// The last parameter is a boolean that defines whether there will be focus or not.
abstract inputs: ResizeArray<string * string * (IziToast -> HTMLDivElement -> HTMLInputElement -> Event -> unit) * bool> option with get, set
/// Default toast open animation.
/// Default value: 'fadeInUp'
abstract transitionIn: IziToastTransitionIn option with get, set
/// Default toast close animation.
/// Default value: 'fadeOut'
abstract transitionOut: IziToastTransitionOut option with get, set
/// Default toast opening mobile transition.
/// Default value: 'fadeInUp'
abstract transitionInMobile: IziToastTransitionIn option with get, set
/// Default toast closing mobile transition.
/// Default value: 'fadeOutDown'
abstract transitionOutMobile: IziToastTransitionOut option with get, set
/// <summary>Callback function triggered when opening the toast.</summary>
/// <param name="settings">Settings of opening toast.</param>
/// <param name="toast">Toast DOM element.</param>
abstract onOpening: (IziToastSettings -> HTMLDivElement -> unit) option with get, set
/// <summary>Callback function triggered when opened the toast.</summary>
/// <param name="settings">Settings of opening toast.</param>
/// <param name="toast">Toast DOM element.</param>
abstract onOpened: (IziToastSettings -> HTMLDivElement -> unit) option with get, set
/// <summary>Callback function triggered when closing the toast.</summary>
/// <param name="settings">Settings of closing toast.</param>
/// <param name="toast">Toast DOM element.</param>
/// <param name="closedBy">Closed by info set by hide method.</param>
abstract onClosing: (IziToastSettings -> HTMLDivElement -> string -> unit) option with get, set
/// <summary>Callback function triggered when closed the toast.</summary>
/// <param name="settings">Settings of closing toast.</param>
/// <param name="toast">Toast DOM element.</param>
/// <param name="closedBy">Closed by info set by hide method. (default: drag | timeout | button | overlay | esc | toast)</param>
abstract onClosed: (IziToastSettings -> HTMLDivElement -> string -> unit) option with get, set
type [<AllowNullLiteral>] IziToastProgress =
abstract pause: unit -> unit
abstract reset: unit -> unit
abstract resume: unit -> unit
abstract start: unit -> unit
type [<AllowNullLiteral>] IziToast =
/// <summary>Sets default values.</summary>
/// <param name="settings">Settings to set as default.</param>
abstract settings: settings: IziToastSettings -> unit
/// Destroys all toasts.
abstract destroy: unit -> unit
/// <summary>Opens the toast.</summary>
/// <returns>Returns false if toast can not be opened.</returns>
abstract show: settings: IziToastSettings -> U2<unit, bool>
/// <summary>Closes the specific toast.</summary>
/// <param name="settings">Settings for this toast.</param>
/// <param name="toast">Toast element or selector to hide.</param>
/// <param name="closedBy">Custom closed by info to use in other functions.</param>
abstract hide: settings: IziToastSettings * toast: U2<HTMLDivElement, string> * ?closedBy: string -> unit
/// <summary>Control progress bar time.</summary>
/// <param name="settings">Settings for this toast.</param>
/// <param name="toast">Toast element</param>
/// <param name="callback">Callback function triggered when invoke IziToastProgress</param>
abstract progress: settings: IziToastSettings * toast: HTMLDivElement * ?callback: (unit -> unit) -> IziToastProgress
/// <summary>Shows an info toast.</summary>
/// <param name="settings">Settings for this toast.</param>
abstract info: settings: IziToastSettings -> unit
/// <summary>Shows an error toast.</summary>
/// <param name="settings">Settings for this toast.</param>
abstract error: settings: IziToastSettings -> unit
/// <summary>Shows a warning toast.</summary>
/// <param name="settings">Settings for this toast.</param>
abstract warning: settings: IziToastSettings -> unit
/// <summary>Shows a success toast.</summary>
/// <param name="settings">Settings for this toast.</param>
abstract success: settings: IziToastSettings -> unit
/// <summary>Shows a question toast.</summary>
/// <param name="settings">Settings for this toast.</param>
abstract question: settings: IziToastSettings -> unit