forked from codex-team/codex.tooltips
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
89 lines (76 loc) · 1.7 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
/**
* Base options interface for tooltips
*/
export interface TooltipOptions {
/**
* Tooltip placement: top|bottom|left|right
*/
placement?: string;
/**
* Tooltip top margin
*/
marginTop?: number;
/**
* Tooltip left margin
*/
marginLeft?: number;
/**
* Tooltip right margin
*/
marginRight?: number;
/**
* Tooltip bottom margin
*/
marginBottom?: number;
/**
* Timout before showing
*/
delay?: number;
/**
* Timout before hiding
*/
hidingDelay?: number;
}
/**
* Tooltip supported content
*/
export type TooltipContent = HTMLElement | DocumentFragment | Node | string;
declare class Tooltip {
/**
* Class constructor. Loads styles.
*/
constructor();
/**
* Shows the Tooltip near passed element
*
* @param {HTMLElement} element — Tooltip will be showed near this element
* @param {TooltipContent} content - Content that will be appended to the Tooltip
* @param {TooltipOptions} options - Some displaying options, see below
*/
public show(
element: HTMLElement,
content: TooltipContent,
options?: TooltipOptions,
): void;
/**
* Hides the Tooltip
*/
public hide(): void;
/**
* Decorator for showing Tooltip by mouseenter/mouseleave
*
* @param {HTMLElement} element — Tooltip will be showed near this element
* @param {TooltipContent} content - Content that will be appended to the Tooltip
* @param {TooltipOptions} options - Some displaying options, see below
*/
public onHover(
element: HTMLElement,
content: TooltipContent,
options?: TooltipOptions,
): void;
/**
* Release DOM and event listeners
*/
public destroy(): void;
}
export default Tooltip;