|
|
|
@ -1,17 +1,14 @@
|
|
|
|
|
import type { BuildInPlacements, AlignType } from '@rc-component/trigger';
|
|
|
|
|
import type { AlignType, BuildInPlacements } from '@rc-component/trigger';
|
|
|
|
|
import classNames from 'classnames';
|
|
|
|
|
import RcTooltip from 'rc-tooltip';
|
|
|
|
|
import type { placements as Placements } from 'rc-tooltip/lib/placements';
|
|
|
|
|
import type {
|
|
|
|
|
TooltipProps as RcTooltipProps,
|
|
|
|
|
TooltipRef as RcTooltipRef,
|
|
|
|
|
} from 'rc-tooltip/lib/Tooltip';
|
|
|
|
|
import type { placements as Placements } from 'rc-tooltip/lib/placements';
|
|
|
|
|
import useMergedState from 'rc-util/lib/hooks/useMergedState';
|
|
|
|
|
import type { CSSProperties } from 'react';
|
|
|
|
|
import * as React from 'react';
|
|
|
|
|
import { ConfigContext } from '../config-provider';
|
|
|
|
|
import { NoCompactStyle } from '../space/Compact';
|
|
|
|
|
import theme from '../theme';
|
|
|
|
|
import type { PresetColorType } from '../_util/colors';
|
|
|
|
|
import { getTransitionName } from '../_util/motion';
|
|
|
|
|
import type { AdjustOverflow, PlacementsConfig } from '../_util/placements';
|
|
|
|
@ -19,6 +16,9 @@ import getPlacements from '../_util/placements';
|
|
|
|
|
import { cloneElement, isFragment, isValidElement } from '../_util/reactNode';
|
|
|
|
|
import type { LiteralUnion } from '../_util/type';
|
|
|
|
|
import warning from '../_util/warning';
|
|
|
|
|
import { ConfigContext } from '../config-provider';
|
|
|
|
|
import { NoCompactStyle } from '../space/Compact';
|
|
|
|
|
import theme from '../theme';
|
|
|
|
|
import PurePanel from './PurePanel';
|
|
|
|
|
import useStyle from './style';
|
|
|
|
|
import { parseColor } from './util';
|
|
|
|
@ -311,12 +311,12 @@ const Tooltip = React.forwardRef<TooltipRef, TooltipProps>((props, ref) => {
|
|
|
|
|
const transformOrigin: React.CSSProperties = { top: '50%', left: '50%' };
|
|
|
|
|
|
|
|
|
|
if (/top|Bottom/.test(placement)) {
|
|
|
|
|
transformOrigin.top = `${rect.height - align.offset![1]}px`;
|
|
|
|
|
transformOrigin.top = `${rect.height - (align.offset![1] as number)}px`;
|
|
|
|
|
} else if (/Top|bottom/.test(placement)) {
|
|
|
|
|
transformOrigin.top = `${-align.offset![1]}px`;
|
|
|
|
|
}
|
|
|
|
|
if (/left|Right/.test(placement)) {
|
|
|
|
|
transformOrigin.left = `${rect.width - align.offset![0]}px`;
|
|
|
|
|
transformOrigin.left = `${rect.width - (align.offset![0] as number)}px`;
|
|
|
|
|
} else if (/right|Left/.test(placement)) {
|
|
|
|
|
transformOrigin.left = `${-align.offset![0]}px`;
|
|
|
|
|
}
|
|
|
|
|