@eccenca/gui-elements
Version:
GUI elements based on other libraries, usable in React application, written in Typescript.
46 lines (45 loc) • 2.21 kB
TypeScript
import React from "react";
import { TooltipProps as BlueprintTooltipProps } from "@blueprintjs/core";
import { MarkdownProps } from "./../../cmem/markdown/Markdown";
export interface TooltipProps extends Omit<BlueprintTooltipProps, "position"> {
/**
* Add dotted underline as visual indication to the target that a tooltip is attached.
* Should be used together with text-only elements.
*/
addIndicator?: boolean;
/**
* The size specifies the dimension the tooltip overlay element can maximal grow.
*/
size?: TooltipSize;
/**
* The tooltip will be attached to this element when it is hovered.
*/
children: React.ReactNode | React.ReactNode[];
/**
* A regular expression that when it matches against the tooltip text, enables the tooltip to be rendered as Markdown.
* This only works if the tooltip content is a string.
* Set to `false` to turn off Markdown rendering completely.
*/
markdownEnabler?: false | string;
/**
* Set properties for the Markdown parser
*/
markdownProps?: Omit<MarkdownProps, "children">;
/**
* Use the overlay target as placeholder before the real `<Tooltip /` is rendered on first hover or focus event.
* This can boost performance massive but it is currently experimental.
* Placeholders are never used when `disabled`, `defaultIsOpen` or `isOpen` is set to `true`, or if `renderTarget` is set.
* If the tooltip `content` is only a string then a placeholder is automatically used, too.
* You can prevent it in any case by setting it to `false`.
*/
usePlaceholder?: boolean;
/**
* Time after the placeholder element is replaced by the actual tooltip component.
* Must be greater than 0.
* For the first display of the tooltip this time adds up to `hoverOpenDelay`.
*/
swapPlaceholderDelay?: number;
}
export type TooltipSize = "small" | "medium" | "large";
export declare const Tooltip: ({ children, content, className, size, addIndicator, markdownEnabler, markdownProps, usePlaceholder, swapPlaceholderDelay, hoverOpenDelay, ...otherTooltipProps }: TooltipProps) => React.JSX.Element | null;
export default Tooltip;