-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.d.ts
107 lines (102 loc) · 2.13 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
type POSITIONS = 'left' | 'center' | 'right'
type BUTTON = boolean | string | object
interface caConfig {
text?: string | object
html?: string | object
title?: string | object
footer?: string | object
form?: object
timer?: number
confirmButton?: BUTTON
cancelButton?: BUTTON
backdropPostion?: POSITIONS
iconPosition?: POSITIONS
contentPosition?: POSITIONS
icon?: 'success' | 'error' | 'info' | 'warning' | 'question'
/**
* This will style the modal
* @example
* calert({
* modal: {
* background: "yellow"
* }
* })
*/
modal?: object
/**
* This will style the overlay
* @example
* calert({
* backdrop: {
* background: "rgba(20,20,20,0.6)"
* }
* })
*/
backdrop?: object
/**
* This will trigger before the calert popups
*/
preConfirm?: Function
/**
* This will add an image you can also add styling
* @example
* calert({
* image: {
* src: "https://picsum.photos/200/300",
* alt: "random photo",
* }
* })
*/
image?: object
/**
* This will add custom buttons
* @example
* calert({
* buttons: {
* try: "Try", // or
* try2: {
* innerText: "Try2",
* className: "custom-btn"
* }
* }
* })
*/
buttons?: { [key: string]: BUTTON }
/**
* This will animate the modal box
* @example
* calert({
* inputs: {
* username: {
* type: "password"
* }
* }
* })
*/
inputs?: { [key: string]: object }
/**
* This will animate the modal box
* @example
* animation: "fade .3s ease-in-out"
*/
animation?: string
}
interface result {
inputs?: object
buttons?: object
isCanceled?: boolean
isConfirmed?: boolean
}
type config = string | caConfig
interface calert {
(...params: config[]): Promise<result>
utils: {
tag: (tag: string | HTMLElement, options?: object) => Node
styles: (element: HTMLElement, options?: object) => Node
edit: (element: HTMLElement, options?: object) => any
queryAll: (selector: string) => NodeList
createPromise: () => object
}
}
declare const calert: calert
export default calert