mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-14 13:51:41 +08:00

Some checks are pending
Publish Any Commit / build (push) Waiting to run
✅ test v6 / lint (push) Waiting to run
✅ test v6 / test-react-legacy (18, 1/2) (push) Waiting to run
✅ test v6 / test-react-legacy (18, 2/2) (push) Waiting to run
✅ test v6 / test-node (push) Waiting to run
✅ test v6 / test-react-latest (dom, 1/2) (push) Waiting to run
✅ test v6 / test-react-latest (dom, 2/2) (push) Waiting to run
✅ test v6 / test-react-latest-dist (dist, 1/2) (push) Blocked by required conditions
✅ test v6 / test-react-latest-dist (dist, 2/2) (push) Blocked by required conditions
✅ test v6 / test-react-latest-dist (dist-min, 1/2) (push) Blocked by required conditions
✅ test v6 / test-react-latest-dist (dist-min, 2/2) (push) Blocked by required conditions
✅ test v6 / test-coverage (push) Blocked by required conditions
✅ test v6 / build (push) Waiting to run
✅ test v6 / test lib/es module (es, 1/2) (push) Waiting to run
✅ test v6 / test lib/es module (es, 2/2) (push) Waiting to run
✅ test v6 / test lib/es module (lib, 1/2) (push) Waiting to run
✅ test v6 / test lib/es module (lib, 2/2) (push) Waiting to run
👁️ Visual Regression Persist Start / test image (push) Waiting to run
* feat: use cssVar by default * chore: update deps * chore: update snapshot * chore: update snapshot * chore: update snapshot * chore: test * chore: update * chore: update scripts * chore: UPDATE TEST * feat: add root * chore: update snapshot * chore: fix test case * chore: fix cycle deps * feat: rm legacy css variables configuration * chore: update test case * chore: update * chore: fix test * chore: update overrides * chore: bump cssinjs * chore: add test case
63 lines
1.5 KiB
TypeScript
63 lines
1.5 KiB
TypeScript
import * as React from 'react';
|
|
import classNames from 'classnames';
|
|
import { Popup } from '@rc-component/tooltip';
|
|
|
|
import type { TooltipProps } from '.';
|
|
import { ConfigContext } from '../config-provider';
|
|
import useStyle from './style';
|
|
import { parseColor } from './util';
|
|
|
|
export interface PurePanelProps extends Omit<TooltipProps, 'children'> {}
|
|
|
|
/** @private Internal Component. Do not use in your production. */
|
|
const PurePanel: React.FC<PurePanelProps> = (props) => {
|
|
const {
|
|
prefixCls: customizePrefixCls,
|
|
className,
|
|
placement = 'top',
|
|
title,
|
|
color,
|
|
overlayInnerStyle,
|
|
} = props;
|
|
const { getPrefixCls } = React.useContext(ConfigContext);
|
|
|
|
const prefixCls = getPrefixCls('tooltip', customizePrefixCls);
|
|
const [hashId, cssVarCls] = useStyle(prefixCls);
|
|
|
|
// Color
|
|
const colorInfo = parseColor(prefixCls, color);
|
|
|
|
const arrowContentStyle = colorInfo.arrowStyle;
|
|
|
|
const formattedOverlayInnerStyle: React.CSSProperties = {
|
|
...overlayInnerStyle,
|
|
...colorInfo.overlayStyle,
|
|
};
|
|
|
|
const cls = classNames(
|
|
hashId,
|
|
cssVarCls,
|
|
prefixCls,
|
|
`${prefixCls}-pure`,
|
|
`${prefixCls}-placement-${placement}`,
|
|
className,
|
|
colorInfo.className,
|
|
);
|
|
|
|
return (
|
|
<div className={cls} style={arrowContentStyle}>
|
|
<div className={`${prefixCls}-arrow`} />
|
|
<Popup
|
|
{...props}
|
|
className={hashId}
|
|
prefixCls={prefixCls}
|
|
overlayInnerStyle={formattedOverlayInnerStyle}
|
|
>
|
|
{title}
|
|
</Popup>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default PurePanel;
|