import * as React from 'react';
import classNames from 'classnames';
import { Popup } from 'rc-tooltip';
import type { PopoverProps } from '.';
import { getRenderPropValue } from '../_util/getRenderPropValue';
import { ConfigContext } from '../config-provider';
import useStyle from './style';
export const getOverlay = (
prefixCls?: string,
title?: PopoverProps['title'],
content?: PopoverProps['content'],
) => {
if (!title && !content) {
return null;
}
return (
<>
{title &&
{getRenderPropValue(title)}
}
{getRenderPropValue(content)}
>
);
};
export interface PurePanelProps extends Omit {
children?: React.ReactNode;
}
interface RawPurePanelProps extends PopoverProps {
hashId: string;
}
export const RawPurePanel: React.FC = (props) => {
const {
hashId,
prefixCls,
className,
style,
placement = 'top',
title,
content,
children,
} = props;
return (
{children || getOverlay(prefixCls, title, content)}
);
};
const PurePanel: React.FC = (props) => {
const { prefixCls: customizePrefixCls, className, ...restProps } = props;
const { getPrefixCls } = React.useContext(ConfigContext);
const prefixCls = getPrefixCls('popover', customizePrefixCls);
const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls);
return wrapCSSVar(
,
);
};
export default PurePanel;