import{defineComponent as V,ref as K,toRef as I,computed as b,createVNode as t}from"vue";import{ExclamationCircleFilled as M}from"@antsoo-lib/icons";import q from"../_util/ActionButton.mjs";import U from"../_util/KeyCode.mjs";import G from"../_util/classNames.mjs";import H from"../_util/hooks/useMergedState.mjs";import J from"../_util/omit.mjs";import Q from"../_util/props-util/initDefaultProps.mjs";import{getTransitionName as W}from"../_util/transition.mjs";import{withInstall as X,objectType as N,anyType as a,stringType as Y}from"../_util/type.mjs";import{cloneVNodes as Z}from"../_util/vnode.mjs";import _ from"../_util/warning.mjs";import"../button/index.mjs";import{convertLegacyProps as B}from"../button/buttonTypes.mjs";import ee from"../config-provider/hooks/useConfigInject.mjs";import{useLocaleReceiver as oe}from"../locale/LocaleReceiver.mjs";import te from"../locale/en_US.mjs";import ne from"../popover/index.mjs";import{tooltipDefaultProps as re}from"../tooltip/Tooltip.mjs";import ie from"../tooltip/abstractTooltipProps.mjs";import ae from"./style/index.mjs";import le from"../button/button.mjs";const se=()=>({...ie(),prefixCls:String,content:a(),title:a(),description:a(),okType:Y("primary"),disabled:{type:Boolean,default:!1},okText:a(),cancelText:a(),icon:a(),okButtonProps:N(),cancelButtonProps:N(),showCancel:{type:Boolean,default:!0},onConfirm:Function,onCancel:Function}),ce=V({compatConfig:{MODE:3},name:"APopconfirm",inheritAttrs:!1,props:Q(se(),{...re(),trigger:"click",placement:"top",mouseEnterDelay:.1,mouseLeaveDelay:.1,arrowPointAtCenter:!1,autoAdjustOverflow:!0,okType:"primary",disabled:!1}),slots:Object,setup(o,{slots:r,emit:u,expose:h,attrs:w}){const d=K();_(o.visible===void 0),h({getPopupDomNode:()=>d.value?.getPopupDomNode?.()});const[C,O]=H(!1,{value:I(o,"open")}),s=(e,i)=>{o.open===void 0&&O(e),u("update:open",e),u("openChange",e,i)},D=e=>{s(!1,e)},v=e=>o.onConfirm?.(e),$=e=>{s(!1,e),o.onCancel?.(e)},S=e=>{e.keyCode===U.ESC&&C&&s(!1,e)},j=e=>{const{disabled:i}=o;i||s(e)},{prefixCls:n,getPrefixCls:g}=ee("popconfirm",o),A=b(()=>g()),E=b(()=>g("btn")),[R]=ae(n),[P]=oe("Popconfirm",te.Popconfirm),z=()=>{const{okButtonProps:e,cancelButtonProps:i,title:m=r.title?.(),description:l=r.description?.(),cancelText:p=r.cancel?.(),okText:f=r.okText?.(),okType:c,icon:y=r.icon?.()||t(M,null,null),showCancel:F=!0}=o,{cancelButton:x,okButton:k}=r,T={onClick:$,size:"small",...i},L={onClick:v,...B(c),size:"small",...e};return t("div",{class:`${n.value}-inner-content`},[t("div",{class:`${n.value}-message`},[y&&t("span",{class:`${n.value}-message-icon`},[y]),t("div",{class:[`${n.value}-message-title`,{[`${n.value}-message-title-only`]:!!l}]},[m])]),l&&t("div",{class:`${n.value}-description`},[l]),t("div",{class:`${n.value}-buttons`},[F?x?x(T):t(le,T,{default:()=>[p||P.value.cancelText]}):null,k?k(L):t(q,{buttonProps:{size:"small",...B(c),...e},actionFn:v,close:D,prefixCls:E.value,quitOnNullishReturnValue:!0,emitEvent:!0},{default:()=>[f||P.value.okText]})])])};return()=>{const{placement:e,overlayClassName:i,trigger:m="click",...l}=o,p=J(l,["title","content","cancelText","okText","onUpdate:open","onConfirm","onCancel","prefixCls"]),f=G(n.value,i);return R(t(ne,{...p,...w,trigger:m,placement:e,onOpenChange:j,open:C.value,overlayClassName:f,transitionName:W(A.value,"zoom-big",o.transitionName),ref:d,"data-popover-inject":!0},{default:()=>[Z(r.default?.()||[],{onKeydown:c=>{S(c)}},!1)],content:z}))}}}),je=X(ce);export{je as default,se as popconfirmProps};
