2016-09-02 10:18:33 +03:00
|
|
|
import * as React from "react";
|
2016-12-19 22:13:36 +03:00
|
|
|
|
2016-07-24 14:17:16 +03:00
|
|
|
export interface TooltipTheme {
|
|
|
|
/**
|
|
|
|
* Added to the tooltip element.
|
|
|
|
*/
|
|
|
|
tooltip?: string;
|
|
|
|
/**
|
|
|
|
* Added to the root when the tooltip is active.
|
|
|
|
*/
|
|
|
|
tooltipActive?: string;
|
|
|
|
/**
|
|
|
|
* Wrapper for the root element used to position the tooltip.
|
|
|
|
*/
|
|
|
|
tooltipWrapper?: string;
|
|
|
|
}
|
|
|
|
|
2016-12-19 22:13:36 +03:00
|
|
|
export interface TooltipProps {
|
|
|
|
/**
|
|
|
|
* Additional class added to composed component.
|
|
|
|
*/
|
|
|
|
className?: string;
|
|
|
|
/**
|
|
|
|
* Callback to be invoked when Component is clicked.
|
|
|
|
*/
|
|
|
|
onClick?: Function;
|
|
|
|
/**
|
|
|
|
* Callback called when the mouse enters the Component.
|
|
|
|
*/
|
|
|
|
onMouseEnter?: Function;
|
|
|
|
/**
|
|
|
|
* Callback called when the mouse leaves the Component.
|
|
|
|
*/
|
|
|
|
onMouseLeave?: Function;
|
2016-07-24 14:17:16 +03:00
|
|
|
/**
|
|
|
|
* Classnames object defining the component style.
|
|
|
|
*/
|
|
|
|
theme?: TooltipTheme;
|
|
|
|
/**
|
2016-12-19 22:13:36 +03:00
|
|
|
* The text (or node) used for the tooltip.
|
2016-07-24 14:17:16 +03:00
|
|
|
*/
|
2016-12-19 22:13:36 +03:00
|
|
|
tooltip?: React.ReactNode;
|
2016-07-24 14:17:16 +03:00
|
|
|
/**
|
|
|
|
* Amount of time in miliseconds spent before the tooltip is visible.
|
2016-12-19 22:13:36 +03:00
|
|
|
* @default 0
|
2016-07-24 14:17:16 +03:00
|
|
|
*/
|
|
|
|
tooltipDelay?: number;
|
|
|
|
/**
|
|
|
|
* If true, the Tooltip hides after a click in the host component.
|
|
|
|
* @default true
|
|
|
|
*/
|
|
|
|
tooltipHideOnClick?: boolean;
|
2016-12-19 22:13:36 +03:00
|
|
|
/**
|
|
|
|
* Tooltip position.
|
|
|
|
* @default "vertical"
|
|
|
|
*/
|
|
|
|
tooltipPosition?: "bottom" | "top" | "left" | "right" | "horizontal" | "vertical";
|
|
|
|
/**
|
|
|
|
* Determines the tooltip should be toggled when clicked. This is useful for mobile where there is no mouse enter.
|
|
|
|
* @default false
|
|
|
|
*/
|
|
|
|
tooltipShowOnClick?: boolean;
|
|
|
|
/**
|
|
|
|
* Additional attributes passed to composed component.
|
|
|
|
*/
|
|
|
|
[key: string]: any;
|
2016-07-24 14:17:16 +03:00
|
|
|
}
|
|
|
|
|
2016-09-02 10:18:33 +03:00
|
|
|
declare class TooltipComponent<P, S> extends React.Component<P, S> {
|
2016-07-24 14:17:16 +03:00
|
|
|
props: P & TooltipProps;
|
|
|
|
}
|
|
|
|
|
2017-09-01 18:51:41 +03:00
|
|
|
declare interface TooltippedComponentClass<P> extends TooltipProps {
|
2016-07-24 14:17:16 +03:00
|
|
|
new (props?: P, context?: any): TooltipComponent<P, any>;
|
|
|
|
}
|
|
|
|
|
2017-09-01 18:51:41 +03:00
|
|
|
declare interface TooltipOptions {
|
|
|
|
className?: string;
|
|
|
|
delay?: number;
|
|
|
|
hideOnClick?: boolean;
|
|
|
|
passthrough?: boolean;
|
|
|
|
showOnClick?: boolean;
|
|
|
|
position?: 'bottom' | 'horizontal' | 'left' | 'right' | 'top' | 'vertical'
|
|
|
|
}
|
|
|
|
|
|
|
|
declare type tooltipHOC<P> = (componentClass: React.ComponentClass<P>) => TooltippedComponentClass<P>
|
|
|
|
|
|
|
|
export function tooltipFactory<P>(options?: TooltipOptions): tooltipHOC<P>;
|
2016-07-24 14:17:16 +03:00
|
|
|
|
2017-09-01 18:51:41 +03:00
|
|
|
export default function Tooltip<P>(component: React.ReactType): TooltippedComponentClass<P>;
|