DefinitelyTyped/types/materialize-css/tooltip.d.ts
Max a355d32369 materialize-css: Add missing declarations and tests (#25492)
* Restructure files and add missing declarations

* Add JQuery declarations

* Restructure tests

* Add carousel tests

* Add more tests and missing JQuery declarations

* Add waves declaration and a test

* Add static init methods and tests

* allow jquery and cash object to be passed to init

* Remove redundant reference

* Clean up

* Clean up

* Clean up and add tests

* Clean up and add tests
2018-05-07 11:00:18 -07:00

96 lines
2.0 KiB
TypeScript

/// <reference path="./common.d.ts" />
declare namespace M {
class Tooltip extends Component<TooltipOptions> implements Openable {
/**
* Get Instance
*/
static getInstance(elem: Element): Tooltip;
/**
* Init Tooltip
*/
static init(els: Element, options?: Partial<TooltipOptions>): Tooltip;
/**
* Init Tooltips
*/
static init(els: MElements, options?: Partial<TooltipOptions>): Tooltip[];
/**
* Show tooltip.
*/
open(): void;
/**
* Hide tooltip.
*/
close(): void;
/**
* If tooltip is open.
*/
isOpen: boolean;
/**
* If tooltip is hovered.
*/
isHovered: boolean;
}
interface TooltipOptions {
/**
* Delay time before tooltip disappears.
* @default 0
*/
exitDelay: number;
/**
* Delay time before tooltip appears.
* @default 200
*/
enterDelay: number;
/**
* Can take regular text or HTML strings.
* @default null
*/
html: string;
/**
* Set distance tooltip appears away from its activator excluding transitionMovement.
* @default 5
*/
margin: number;
/**
* Enter transition duration.
* @default 300
*/
inDuration: number;
/**
* Exit transition duration.
* @default 250
*/
outDuration: number;
/**
* Set the direction of the tooltip.
* @default 'bottom'
*/
position: 'top' | 'right' | 'bottom' | 'left';
/**
* Amount in px that the tooltip moves during its transition.
* @default 10
*/
transitionMovement: number;
}
}
interface JQuery {
tooltip(method: keyof Pick<M.Tooltip, "open" | "close" | "destroy">): JQuery;
tooltip(options?: Partial<M.TooltipOptions>): JQuery;
}