import * as React from 'react'; import ExclamationCircleFilled from '@ant-design/icons/ExclamationCircleFilled'; import classNames from 'classnames'; import type { PopconfirmProps } from '.'; import Button from '../button'; import { convertLegacyProps } from '../button/button'; import ActionButton from '../_util/ActionButton'; import LocaleReceiver from '../locale-provider/LocaleReceiver'; import defaultLocale from '../locale/en_US'; import { getRenderPropValue } from '../_util/getRenderPropValue'; import { ConfigContext } from '../config-provider'; import PopoverPurePanel from '../popover/PurePanel'; import useStyle from './style'; export interface PopconfirmLocale { okText: string; cancelText: string; } export interface OverlayProps extends Pick< PopconfirmProps, | 'icon' | 'okButtonProps' | 'cancelButtonProps' | 'cancelText' | 'okText' | 'okType' | 'showCancel' | 'title' > { prefixCls: string; close?: Function; onConfirm?: React.MouseEventHandler; onCancel?: React.MouseEventHandler; } export const Overlay: React.FC = (props) => { const { prefixCls, okButtonProps, cancelButtonProps, title, cancelText, okText, okType = 'primary', icon = , showCancel = true, close, onConfirm, onCancel, } = props; const { getPrefixCls } = React.useContext(ConfigContext); return ( {(contextLocale) => (
{icon && {icon}}
{getRenderPropValue(title)}
{showCancel && ( )} {okText ?? contextLocale.okText}
)}
); }; export interface PurePanelProps extends Omit, Pick { className?: string; style?: React.CSSProperties; prefixCls?: string; } export default function PurePanel(props: PurePanelProps) { const { prefixCls: customizePrefixCls, placement, className, style, ...restProps } = props; const { getPrefixCls } = React.useContext(ConfigContext); const prefixCls = getPrefixCls('popconfirm', customizePrefixCls); const [wrapSSR] = useStyle(prefixCls); return wrapSSR( , ); }