forked from atomiks/tippyjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
148 lines (131 loc) · 3.65 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
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
import Popper from 'popper.js'
export type BasicPlacement = 'top' | 'bottom' | 'left' | 'right'
export type Placement = Popper.Placement
export type Content = string | Element | ((ref: Element) => Element | string)
export type Targets = string | Element | Element[] | NodeList | VirtualReference
export interface ReferenceElement extends Element {
_tippy?: Instance
}
export interface PopperElement extends HTMLDivElement {
_tippy?: Instance
}
export interface VirtualReference extends Popper.ReferenceObject {
attributes: {
[key: string]: any
}
classList: {
classNames: {
[key: string]: boolean
}
[key: string]: any
}
}
export interface PopperInstance extends Popper {
reference: ReferenceElement
popper: PopperElement
modifiers: { name: string; padding: object | number }[]
}
export interface Options {
a11y?: boolean
allowHTML?: boolean
animateFill?: boolean
animation?: 'fade' | 'scale' | 'shift-toward' | 'perspective' | 'shift-away'
appendTo?: 'parent' | Element | ((ref: Element) => Element)
aria?: 'describedby' | 'labelledby' | null
arrow?: boolean
arrowType?: 'sharp' | 'round'
boundary?: 'scrollParent' | 'window' | 'viewport' | HTMLElement
content?: Content
delay?: number | [number, number]
distance?: number
duration?: number | [number, number]
flip?: boolean
flipBehavior?: 'flip' | Placement[]
flipOnUpdate?: boolean
followCursor?: boolean | 'vertical' | 'horizontal' | 'initial'
hideOnClick?: boolean | 'toggle'
ignoreAttributes?: boolean
inertia?: boolean
interactive?: boolean
interactiveBorder?: number
interactiveDebounce?: number
lazy?: boolean
maxWidth?: number | string
multiple?: boolean
offset?: number | string
onHidden?(instance: Instance): void
onHide?(instance: Instance): void | false
onMount?(instance: Instance): void
onShow?(instance: Instance): void | false
onShown?(instance: Instance): void
placement?: Placement
popperOptions?: Popper.PopperOptions
role?: string
showOnInit?: boolean
size?: 'small' | 'regular' | 'large'
sticky?: boolean
target?: string
theme?: 'dark' | 'light' | 'light-border' | 'google' | string
touch?: boolean
touchHold?: boolean
trigger?: string
updateDuration?: number
wait?: ((instance: Instance, event?: Event) => void) | null
zIndex?: number
}
/**
* @deprecated
* Use `Options` instead.
*/
export type Props = Options
export interface Instance {
clearDelayTimeouts(): void
destroy(): void
disable(): void
enable(): void
hide(duration?: number): void
id: number
popper: PopperElement
popperChildren: PopperChildren
popperInstance: PopperInstance | null
props: Props
reference: ReferenceElement
set(options: Options): void
setContent(content: Content): void
show(duration?: number): void
state: {
isEnabled: boolean
isVisible: boolean
isDestroyed: boolean
isMounted: boolean
isShown: boolean
}
}
export interface GroupedInstance extends Instance {
_originalProps: Props
}
export interface GroupOptions {
delay?: number | [number, number]
duration?: number | [number, number]
}
export interface PopperChildren {
tooltip: HTMLDivElement
content: HTMLDivElement
arrow: HTMLDivElement | null
backdrop: HTMLDivElement | null
}
export interface HideAllOptions {
checkHideOnClick?: boolean
duration?: number
exclude?: Instance
}
export interface Tippy {
(targets: Targets, options?: Props): Instance | Instance[]
readonly defaults: Props
readonly version: string
group(instances: Instance[], options?: GroupOptions): void
hideAll(options?: HideAllOptions): void
setDefaults(options: Props): void
}
declare const tippy: Tippy
export default tippy