1
1
// Type definitions for Bootbox 4.4.0
2
2
// Project: https://github.com/makeusabrew/bootbox
3
- // Definitions by: Vincent Bortone <https://github.com/vbortone/>, Kon Pik <https://github.com/konpikwastaken/>, Anup Kattel <https://github.com/kanup/>, Dominik Schroeter <https://github.com/icereed/>
3
+ // Definitions by: Vincent Bortone <https://github.com/vbortone/>, Kon Pik <https://github.com/konpikwastaken/>, Anup Kattel <https://github.com/kanup/>, Dominik Schroeter <https://github.com/icereed/>, Troy McKinnon <https://github.com/trodi/>
4
4
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
5
5
6
6
/// <reference path="../jquery/jquery.d.ts" />
7
- interface BootboxAlertOptions {
7
+
8
+ /** Bootbox options shared by all modal types */
9
+ interface BootboxBaseOptions {
10
+ title ?: string | Element ;
11
+ callback ?: ( result : boolean | string ) => any ;
12
+ onEscape ?: ( ) => any | boolean ;
13
+ show ?: boolean ;
14
+ backdrop ?: boolean ;
15
+ closeButton ?: boolean ;
16
+ animate ?: boolean ;
17
+ className ?: string ;
8
18
size ?: string ;
9
- message : string ;
19
+ buttons ?: BootboxButtonMap ; // complex object where each key is of type BootboxButton
20
+ }
21
+
22
+ /** Bootbox options available for custom modals */
23
+ interface BootboxDialogOptions extends BootboxBaseOptions {
24
+ message : string | Element ;
25
+ }
26
+
27
+ /** Bootbox options available for alert modals */
28
+ interface BootboxAlertOptions extends BootboxDialogOptions {
10
29
callback ?: ( ) => any ;
30
+ buttons ?: BootboxAlertButtonMap ;
11
31
}
12
32
13
- interface BootboxConfirmOptions {
14
- size ?: string ;
15
- message : string ;
33
+ /** Bootbox options available for confirm modals */
34
+ interface BootboxConfirmOptions extends BootboxDialogOptions {
16
35
callback : ( result : boolean ) => any ;
36
+ buttons ?: BootboxConfirmPromptButtonMap ;
17
37
}
18
38
19
- interface BootboxPromptOptions {
20
- size ?: string ;
21
- message ? : string ;
39
+ /** Bootbox options available for prompt modals */
40
+ interface BootboxPromptOptions extends BootboxBaseOptions {
41
+ title : string ;
22
42
callback : ( result : string ) => any ;
43
+ buttons ?: BootboxConfirmPromptButtonMap ;
44
+ }
45
+
46
+ /** Bootbox options available when setting defaults for modals */
47
+ interface BootboxDefaultOptions {
48
+ locale ?: string ;
49
+ show ?: boolean ;
50
+ backdrop ?: boolean ;
51
+ closeButton ?: boolean ;
52
+ animate ?: boolean ;
53
+ className ?: string ;
23
54
}
24
55
25
56
interface BootboxButton {
@@ -32,28 +63,15 @@ interface BootboxButtonMap {
32
63
[ key : string ] : BootboxButton | Function ;
33
64
}
34
65
35
- interface BootboxDialogOptions {
36
- message : string | Element ;
37
- title ?: string | Element ;
38
- locale ?: string ;
39
- callback ?: ( result : boolean ) => any ;
40
- onEscape ?: ( ) => any | boolean ;
41
- show ?: boolean ;
42
- backdrop ?: boolean ;
43
- closeButton ?: boolean ;
44
- animate ?: boolean ;
45
- className ?: string ;
46
- size ?: string ;
47
- buttons ?: BootboxButtonMap ; // complex object where each key is of type BootboxButton
66
+ /** ButtonMap options for alerts modals */
67
+ interface BootboxAlertButtonMap extends BootboxButtonMap {
68
+ ok : BootboxButton | Function ;
48
69
}
49
70
50
- interface BootboxDefaultOptions {
51
- locale ?: string ;
52
- show ?: boolean ;
53
- backdrop ?: boolean ;
54
- closeButton ?: boolean ;
55
- animate ?: boolean ;
56
- className ?: string ;
71
+ /** ButtonMap options for confirm and prompt modals */
72
+ interface BootboxConfirmPromptButtonMap extends BootboxButtonMap {
73
+ confirm : BootboxButton | Function ;
74
+ cancel : BootboxButton | Function ;
57
75
}
58
76
59
77
interface BootboxLocaleValues {
0 commit comments