| 1 |
import{c as z,o as n,w as B,e as i,b as _,m as v,T,F as l,a as $,f,t as m,n as C,r as E}from"./vue.esm-bundler.js?ver=1.3.25";import{_ as S}from"./_plugin-vue_export-helper.js?ver=1.3.25";import{_ as k}from"./DynamicIcon.js?ver=1.3.25";import{S as g}from"./Str.js?ver=1.3.25";import{t}from"./Translator.js?ver=1.3.25";const D={key:0},L={__name:"TransitionAccordion",props:{visible:{type:Boolean,default:!1},duration:{type:Number,default:300},horizontal:{type:Boolean,default:!1}},setup(o){const a=o,s=a.duration,h=e=>{a.horizontal?e.style.width="0":e.style.height="0",e.style.opacity="0",e.style.overflow="hidden"},p=(e,d)=>{if(a.horizontal){const c=e.scrollWidth+"px";e.style.transition=`width ${s}ms ease, opacity ${s}ms ease`,requestAnimationFrame(()=>{e.style.width=c,e.style.opacity="1"})}else{const c=e.scrollHeight+"px";e.style.transition=`height ${s}ms ease, opacity ${s}ms ease`,requestAnimationFrame(()=>{e.style.height=c,e.style.opacity="1"})}setTimeout(()=>d(),s)},r=e=>{a.horizontal?e.style.width="auto":e.style.height="auto",e.style.overflow=""},u=e=>{a.horizontal?e.style.width=e.scrollWidth+"px":e.style.height=e.scrollHeight+"px",e.style.opacity="1",e.style.overflow="hidden"},w=(e,d)=>{e.offsetHeight,a.horizontal?(e.style.transition=`width ${s}ms ease, opacity ${s}ms ease`,e.style.width="0"):(e.style.transition=`height ${s}ms ease, opacity ${s}ms ease`,e.style.height="0"),e.style.opacity="0";const c=a.horizontal?"width":"height",y=x=>{x.propertyName===c&&(e.removeEventListener("transitionend",y),d())};e.addEventListener("transitionend",y)},b=e=>{};return(e,d)=>(n(),z(T,{onBeforeEnter:h,onEnter:p,onAfterEnter:r,onBeforeLeave:u,onLeave:w,onAfterLeave:b,mode:"in-out"},{default:B(()=>[o.visible?(n(),i("div",D,[v(e.$slots,"default",{},void 0,!0)])):_("",!0)]),_:3}))}},W=S(L,[["__scopeId","data-v-10073793"]]),A={name:"Badge",components:{DynamicIcon:k},props:{status:String,text:{type:String,default:null,required:!1},hideIcon:{type:Boolean,default:!1},size:String,highContrast:{type:Boolean,default:!1},type:String,icon:String},computed:{Str(){return g},computedStatus(){return this.status||this.type},badgeType(){switch(this.computedStatus){case"completed":case"paid":case"active":case"publish":case"shipped":case"success":case"licensed":case"succeeded":return"success";case"failed":case"error":case"canceled":case"expired":return"danger";case"partially_paid":case"intended":return"blue";case"scheduled":case"on-hold":case"pending":case"unpaid":case"warning":case"processing":case"future":return"warning";case"inactive":return"warning";case"dispute":return"warning";default:return"info"}},badgeSize(){return this.size?this.size:""},HighContrast(){return this.highContrast?"is-high-contrast":""}},methods:{getStatusText(){switch(this.computedStatus){case"completed":return t("Completed");case"paid":return t("Paid");case"active":return t("Active");case"publish":return t("Published");case"draft":return t("Draft");case"shipped":return t("Shipped");case"success":return t("Success");case"licensed":return t("Licensed");case"succeeded":return t("Succeeded");case"failed":return t("Failed");case"error":return t("Error");case"canceled":return t("Canceled");case"expired":return t("Expired");case"partially_paid":return t("Partially Paid");case"intended":return t("Intended");case"scheduled":return t("Scheduled");case"on-hold":return t("On Hold");case"pending":return t("Pending");case"unpaid":return t("Unpaid");case"warning":return t("Warning");case"processing":return t("Processing");case"future":return t("Future");case"inactive":return t("Inactive");case"dispute":return t("Dispute");case"disabled":return t("Disabled");case"beta":return t("Beta");default:return g.headline(this.computedStatus)}}}},I={key:0};function P(o,a,s,h,p,r){const u=E("DynamicIcon");return n(),i("span",{class:C(`badge ${r.badgeType} ${r.badgeSize} ${r.HighContrast}`)},[s.status?(n(),i(l,{key:0},[s.icon?(n(),i("span",I,[$(u,{name:s.icon},null,8,["name"])])):_("",!0),s.text?(n(),i(l,{key:1},[f(m(s.text),1)],64)):(n(),i(l,{key:2},[f(m(r.getStatusText()),1)],64))],64)):v(o.$slots,"default",{key:1})],2)}const O=S(A,[["render",P]]);export{O as B,W as T}; |