import classNames from "classnames" ; import * as React from "react" ; import { polyfill } from "react-lifecycles-compat" ; import { AbstractPureComponent2 , Classes } from "../../common" ; import { DISPLAYNAME_PREFIX , IntentProps } from "../../common/props" ; import { Popover , PopoverInteractionKind } from "../popover/popover" ; import { IPopoverSharedProps } from "../popover/popoverSharedProps" ; export type TooltipProps = ITooltipProps ; deprecated export interface ITooltipProps extends IPopoverSharedProps , IntentProps { /**
     * The content that will be displayed inside of the tooltip.
     */ content : JSX . Element | string ; default hoverCloseDelay ? : number ; default hoverOpenDelay ? : number ; default interactionKind ? : typeof PopoverInteractionKind . HOVER | typeof PopoverInteractionKind . HOVER_TARGET_ONLY ; default transitionDuration ? : number ; } deprecated @ polyfill export class Tooltip extends AbstractPureComponent2 < TooltipProps > { public static displayName = `${ DISPLAYNAME_PREFIX }.Tooltip` ; public static defaultProps : Partial < TooltipProps > = { hoverCloseDelay : 0 , hoverOpenDelay : 100 , minimal : false , transitionDuration : 100 , } ; private popover : Popover | null = null ; public render ( ) { const { children , intent , popoverClassName , ... restProps } = this . props ; const classes = classNames ( Classes . TOOLTIP , { [ Classes . MINIMAL ] : this . props . minimal } , Classes . intentClass ( intent ) , popoverClassName ) ; return ( < Popover interactionKind = { PopoverInteractionKind . HOVER_TARGET_ONLY } modifiers = { { arrow : { enabled : ! this . props . minimal } } } { ... restProps } autoFocus = { false } canEscapeKeyClose = { false } enforceFocus = { false } lazy = { true } popoverClassName = { classes } portalContainer = { this . props . portalContainer } ref = { ref => ( this . popover = ref ) } > { children } < /Popover>); } public reposition ( ) { if ( this . popover != null ) { this . popover . reposition ( ) ; } } }