import{defineComponent as f,computed as l,ref as p,watch as d,createVNode as a,Transition as g,withDirectives as w,TransitionGroup as C,vShow as E}from"vue";import $ from"../_util/collapseMotion.mjs";import{getTransitionGroupProps as b,getTransitionProps as x}from"../_util/transition.mjs";import{useInjectFormItemPrefix as I}from"./context.mjs";import P from"./style/index.mjs";const L=f({compatConfig:{MODE:3},name:"ErrorList",inheritAttrs:!1,props:["errors","help","onErrorVisibleChanged","helpStatus","warnings"],setup(e,{attrs:u}){const{prefixCls:r,status:t}=I(),i=l(()=>`${r.value}-item-explain`),n=l(()=>!!(e.errors&&e.errors.length)),o=p(t.value),[,m]=P(r);return d([n,t],()=>{n.value&&(o.value=t.value)}),()=>{const h=$(`${r.value}-show-help-item`),s=b(`${r.value}-show-help-item`,h);return s.role="alert",s.class=[m.value,i.value,u.class,`${r.value}-show-help`],a(g,{...x(`${r.value}-show-help`),onAfterEnter:()=>e.onErrorVisibleChanged(!0),onAfterLeave:()=>e.onErrorVisibleChanged(!1)},{default:()=>[w(a(C,{...s,tag:"div"},{default:()=>[e.errors?.map((v,c)=>a("div",{key:c,class:o.value?`${i.value}-${o.value}`:""},[v]))]}),[[E,!!e.errors?.length]])]})}}});export{L as default};
