import y from"./Icon.30f6becb.js";import v from"./Link.a86a4ec7.js";import{g as B,E as n,G as j,a9 as N,j as l,H as $,O as r,o as u,k as c,w as O,I as g,y as s,l as f,c as h,t as q}from"./entry.eb978f24.js";import{_ as L}from"./_plugin-vue_export-helper.c27b6911.js";import"./nuxt-link.0033bf2d.js";import"./_baseIsEqual.8f3c5dea.js";import"./_MapCache.e1952f2e.js";const U=B({components:{UIcon:y,ULink:v},props:{type:{type:String,default:"button"},block:{type:Boolean,default:!1},label:{type:String,default:null},loading:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},padded:{type:Boolean,default:!0},size:{type:String,default:()=>n.ui.button.default.size,validator(e){return Object.keys(n.ui.button.size).includes(e)}},color:{type:String,default:()=>n.ui.button.default.color,validator(e){return[...n.ui.colors,...Object.keys(n.ui.button.color)].includes(e)}},variant:{type:String,default:()=>n.ui.button.default.variant,validator(e){return[...Object.keys(n.ui.button.variant),...Object.values(n.ui.button.color).flatMap(i=>Object.keys(i))].includes(e)}},icon:{type:String,default:null},loadingIcon:{type:String,default:()=>n.ui.button.default.loadingIcon},leadingIcon:{type:String,default:null},trailingIcon:{type:String,default:null},trailing:{type:Boolean,default:!1},leading:{type:Boolean,default:!1},square:{type:Boolean,default:!1},truncate:{type:Boolean,default:!1},ui:{type:Object,default:()=>n.ui.button}},setup(e){const i=j(),m=N(),a=l(()=>$({},e.ui,i.ui.button)),o=l(()=>e.icon&&e.leading||e.icon&&!e.trailing||e.loading&&!e.trailing||e.leadingIcon),b=l(()=>e.icon&&e.trailing||e.loading&&e.trailing||e.trailingIcon),t=l(()=>e.square||!m.default&&!e.label),d=l(()=>{const z=a.value.color?.[e.color]?.[e.variant]||a.value.variant[e.variant];return r(a.value.base,a.value.font,a.value.rounded,a.value.size[e.size],a.value.gap[e.size],e.padded&&a.value[t.value?"square":"padding"][e.size],z?.replaceAll("{color}",e.color),e.block?"w-full flex justify-center items-center":"inline-flex items-center")}),I=l(()=>e.loading?e.loadingIcon:e.leadingIcon||e.icon),k=l(()=>e.loading&&!o.value?e.loadingIcon:e.trailingIcon||e.icon),C=l(()=>r(a.value.icon.base,a.value.icon.size[e.size],e.loading&&"animate-spin")),S=l(()=>r(a.value.icon.base,a.value.icon.size[e.size],e.loading&&!o.value&&"animate-spin"));return{isLeading:o,isTrailing:b,isSquare:t,buttonClass:d,leadingIconName:I,trailingIconName:k,leadingIconClass:C,trailingIconClass:S}}});function _(e,i,m,a,o,b){const t=y,d=v;return u(),c(d,{type:e.type,disabled:e.disabled||e.loading,class:s(e.buttonClass)},{default:O(()=>[g(e.$slots,"leading",{disabled:e.disabled,loading:e.loading},()=>[e.isLeading&&e.leadingIconName?(u(),c(t,{key:0,name:e.leadingIconName,class:s(e.leadingIconClass),"aria-hidden":"true"},null,8,["name","class"])):f("",!0)]),g(e.$slots,"default",{},()=>[e.label?(u(),h("span",{key:0,class:s([e.truncate?"text-left break-all line-clamp-1":""])},q(e.label),3)):f("",!0)]),g(e.$slots,"trailing",{disabled:e.disabled,loading:e.loading},()=>[e.isTrailing&&e.trailingIconName?(u(),c(t,{key:0,name:e.trailingIconName,class:s(e.trailingIconClass),"aria-hidden":"true"},null,8,["name","class"])):f("",!0)])]),_:3},8,["type","disabled","class"])}const M=L(U,[["render",_]]);export{M as default};
