import{defineComponent as D,createVNode as i}from"vue";import x from"../_util/classNames.mjs";import P from"../_util/omit.mjs";import{booleanType as w,functionType as g,stringType as _}from"../_util/type.mjs";import c,{withUndefined as B}from"../_util/vue-types/index.mjs";function k(r){return typeof r=="string"}function M(){}const V=()=>({prefixCls:String,itemWidth:String,active:{type:Boolean,default:void 0},disabled:{type:Boolean,default:void 0},status:_(),iconPrefix:String,icon:c.any,adjustMarginRight:String,stepNumber:Number,stepIndex:Number,description:c.any,title:c.any,subTitle:c.any,progressDot:B(c.oneOfType([c.looseBool,c.func])),tailContent:c.any,icons:c.shape({finish:c.any,error:c.any}).loose,onClick:g(),onStepClick:g(),stepIcon:g(),itemRender:g(),__legacy:w()}),U=D({compatConfig:{MODE:3},name:"Step",inheritAttrs:!1,props:V(),setup(r,{slots:p,emit:S,attrs:h}){const N=e=>{S("click",e),S("stepClick",r.stepIndex)},I=({icon:e,title:f,description:u})=>{const{prefixCls:s,stepNumber:m,status:o,iconPrefix:a,icons:t,progressDot:l=p.progressDot,stepIcon:d=p.stepIcon}=r;let n;const C=x(`${s}-icon`,`${a}icon`,{[`${a}icon-${e}`]:e&&k(e),[`${a}icon-check`]:!e&&o==="finish"&&(t&&!t.finish||!t),[`${a}icon-cross`]:!e&&o==="error"&&(t&&!t.error||!t)}),$=i("span",{class:`${s}-icon-dot`},null);return l?typeof l=="function"?n=i("span",{class:`${s}-icon`},[l({iconDot:$,index:m-1,status:o,title:f,description:u,prefixCls:s})]):n=i("span",{class:`${s}-icon`},[$]):e&&!k(e)?n=i("span",{class:`${s}-icon`},[e]):t&&t.finish&&o==="finish"?n=i("span",{class:`${s}-icon`},[t.finish]):t&&t.error&&o==="error"?n=i("span",{class:`${s}-icon`},[t.error]):e||o==="finish"||o==="error"?n=i("span",{class:C},null):n=i("span",{class:`${s}-icon`},[m]),d&&(n=d({index:m-1,status:o,title:f,description:u,node:n})),n};return()=>{const{prefixCls:e,itemWidth:f,active:u,status:s="wait",tailContent:m,adjustMarginRight:o,disabled:a,title:t=p.title?.(),description:l=p.description?.(),subTitle:d=p.subTitle?.(),icon:n=p.icon?.(),onClick:C,onStepClick:$}=r,T=s||"wait",R=x(`${e}-item`,`${e}-item-${T}`,{[`${e}-item-custom`]:n,[`${e}-item-active`]:u,[`${e}-item-disabled`]:a===!0}),b={};f&&(b.width=f),o&&(b.marginRight=o);const y={onClick:C||M};$&&!a&&(y.role="button",y.tabindex=0,y.onClick=N);const v=i("div",{...P(h,["__legacy"]),class:[R,h.class],style:[h.style,b]},[i("div",{...y,class:`${e}-item-container`},[i("div",{class:`${e}-item-tail`},[m]),i("div",{class:`${e}-item-icon`},[I({icon:n,title:t,description:l})]),i("div",{class:`${e}-item-content`},[i("div",{class:`${e}-item-title`},[t,d&&i("div",{title:typeof d=="string"?d:void 0,class:`${e}-item-subtitle`},[d])]),l&&i("div",{class:`${e}-item-description`},[l])])])]);return r.itemRender?r.itemRender(v):v}}});export{V as VcStepProps,U as default};
