UNPKG

1.98 kBTypeScriptView Raw
1/**
2 * This tooltip class is derived from Bootstrap 3, but modified to not require
3 * jQuery, which is an expensive dependency we want to eliminate.
4 */
5export interface Tooltip {
6 readonly options: TooltipOptions;
7 readonly enabled: boolean;
8 readonly timeout: number;
9 readonly hoverState: "in" | "out" | null;
10 readonly element: HTMLElement;
11
12 getTitle(): string;
13 getTooltipElement(): HTMLElement;
14 getArrowElement(): HTMLElement;
15 enable(): void;
16 disable(): void;
17 toggleEnabled(): void;
18 toggle(): void;
19 recalculatePosition(): void;
20}
21
22/** The options for a Bootstrap 3 Tooltip class, which Atom uses a variant of. */
23export interface TooltipOptions {
24 /** Apply a CSS fade transition to the tooltip. */
25 animation?: boolean | undefined;
26
27 /** Appends the tooltip to a specific element. */
28 container?: string | HTMLElement | false | undefined;
29
30 /**
31 * Delay showing and hiding the tooltip (ms) - does not apply to manual
32 * trigger type.
33 */
34 delay?: number | { show: number; hide: number } | undefined;
35
36 /** Allow HTML in the tooltip. */
37 html?: boolean | undefined;
38
39 /** How to position the tooltip. */
40 placement?: "top" | "bottom" | "left" | "right" | "auto" | undefined;
41
42 /**
43 * If a selector is provided, tooltip objects will be delegated to the
44 * specified targets.
45 */
46 selector?: string | undefined;
47
48 /** Base HTML to use when creating the tooltip. */
49 template?: string | undefined;
50
51 /**
52 * Default title value if title attribute isn't present.
53 * If a function is given, it will be called with its this reference set to
54 * the element that the tooltip is attached to.
55 */
56 title?: string | HTMLElement | (() => string) | undefined;
57
58 /**
59 * How tooltip is triggered - click | hover | focus | manual.
60 * You may pass multiple triggers; separate them with a space.
61 */
62 trigger?: string | undefined;
63}
64
\No newline at end of file