diff --git a/components/dropdown/dropdown.tsx b/components/dropdown/dropdown.tsx index 8639c7fc2e..5e4d94cbcc 100644 --- a/components/dropdown/dropdown.tsx +++ b/components/dropdown/dropdown.tsx @@ -288,7 +288,8 @@ const Dropdown: CompoundedComponent = (props) => { mouseEnterDelay={mouseEnterDelay} mouseLeaveDelay={mouseLeaveDelay} visible={mergedOpen} - builtinPlacements={builtinPlacements} + // TODO: remove `as any` when `rc-dropdown` upgrade to use `@rc-component/trigger` + builtinPlacements={builtinPlacements as any} arrow={!!arrow} overlayClassName={overlayClassNameCustomized} prefixCls={prefixCls} diff --git a/components/tooltip/index.tsx b/components/tooltip/index.tsx index 2778a32226..bd46b6c466 100644 --- a/components/tooltip/index.tsx +++ b/components/tooltip/index.tsx @@ -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((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`; } diff --git a/package.json b/package.json index 29283cbc3d..6d10497463 100644 --- a/package.json +++ b/package.json @@ -115,7 +115,7 @@ "@ctrl/tinycolor": "^3.6.0", "@rc-component/mutate-observer": "^1.0.0", "@rc-component/tour": "~1.8.0", - "@rc-component/trigger": "^1.7.0", + "@rc-component/trigger": "^1.11.0", "classnames": "^2.2.6", "copy-to-clipboard": "^3.2.0", "dayjs": "^1.11.1",