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