1 | import * as React from 'react';
|
2 | import type { placements as Placements } from 'rc-tooltip/lib/placements';
|
3 | import type { TooltipProps as RcTooltipProps } from 'rc-tooltip/lib/Tooltip';
|
4 | import type { PresetColorType } from '../_util/colors';
|
5 | import type { RenderFunction } from '../_util/getRenderPropValue';
|
6 | import type { AdjustOverflow, PlacementsConfig } from '../_util/placements';
|
7 | import type { LiteralUnion } from '../_util/type';
|
8 | import PurePanel from './PurePanel';
|
9 | export type { AdjustOverflow, PlacementsConfig };
|
10 | export interface TooltipRef {
|
11 |
|
12 | forcePopupAlign: VoidFunction;
|
13 | forceAlign: VoidFunction;
|
14 | }
|
15 | export type TooltipPlacement = 'top' | 'left' | 'right' | 'bottom' | 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' | 'leftTop' | 'leftBottom' | 'rightTop' | 'rightBottom';
|
16 | export interface TooltipAlignConfig {
|
17 | points?: [string, string];
|
18 | offset?: [number | string, number | string];
|
19 | targetOffset?: [number | string, number | string];
|
20 | overflow?: {
|
21 | adjustX: boolean;
|
22 | adjustY: boolean;
|
23 | };
|
24 | useCssRight?: boolean;
|
25 | useCssBottom?: boolean;
|
26 | useCssTransform?: boolean;
|
27 | }
|
28 | interface LegacyTooltipProps extends Partial<Omit<RcTooltipProps, 'children' | 'visible' | 'defaultVisible' | 'onVisibleChange' | 'afterVisibleChange' | 'destroyTooltipOnHide'>> {
|
29 | open?: RcTooltipProps['visible'];
|
30 | defaultOpen?: RcTooltipProps['defaultVisible'];
|
31 | onOpenChange?: RcTooltipProps['onVisibleChange'];
|
32 | afterOpenChange?: RcTooltipProps['afterVisibleChange'];
|
33 |
|
34 | visible?: RcTooltipProps['visible'];
|
35 |
|
36 | defaultVisible?: RcTooltipProps['defaultVisible'];
|
37 |
|
38 | onVisibleChange?: RcTooltipProps['onVisibleChange'];
|
39 |
|
40 | afterVisibleChange?: RcTooltipProps['afterVisibleChange'];
|
41 | }
|
42 | export interface AbstractTooltipProps extends LegacyTooltipProps {
|
43 | style?: React.CSSProperties;
|
44 | className?: string;
|
45 | rootClassName?: string;
|
46 | color?: LiteralUnion<PresetColorType>;
|
47 | placement?: TooltipPlacement;
|
48 | builtinPlacements?: typeof Placements;
|
49 | openClassName?: string;
|
50 |
|
51 | arrowPointAtCenter?: boolean;
|
52 | arrow?: boolean | {
|
53 |
|
54 | arrowPointAtCenter?: boolean;
|
55 | pointAtCenter?: boolean;
|
56 | };
|
57 | autoAdjustOverflow?: boolean | AdjustOverflow;
|
58 | getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement;
|
59 | children?: React.ReactNode;
|
60 | destroyTooltipOnHide?: boolean | {
|
61 | keepParent?: boolean;
|
62 | };
|
63 | }
|
64 | export interface TooltipPropsWithOverlay extends AbstractTooltipProps {
|
65 | title?: React.ReactNode | RenderFunction;
|
66 | overlay?: React.ReactNode | RenderFunction;
|
67 | }
|
68 | export interface TooltipPropsWithTitle extends AbstractTooltipProps {
|
69 | title: React.ReactNode | RenderFunction;
|
70 | overlay?: React.ReactNode | RenderFunction;
|
71 | }
|
72 | export declare type TooltipProps = TooltipPropsWithTitle | TooltipPropsWithOverlay;
|
73 | declare const Tooltip: React.ForwardRefExoticComponent<TooltipProps & React.RefAttributes<unknown>> & {
|
74 | _InternalPanelDoNotUseOrYouWillBeFired: typeof PurePanel;
|
75 | };
|
76 | export default Tooltip;
|