import v from"./Icon.fe8c0e68.js";import I from"./Link.cc0949f5.js";import{E as N,G as m,g as $,j as l,N as d,o as u,k as r,w as O,H as c,y as g,l as f,c as h,t as w,K as U}from"./entry.9e31e8a4.js";import{t as q}from"./tw-merge.27ca352e.js";import{b as L,u as _}from"./ui.config.7ae255de.js";import{_ as A}from"./_plugin-vue_export-helper.c27b6911.js";import"./nuxt-link.f786ecc0.js";const n=N(m.ui.strategy,m.ui.button,L),E=$({components:{UIcon:v,ULink:I},inheritAttrs:!1,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.default.size,validator(e){return Object.keys(n.size).includes(e)}},color:{type:String,default:()=>n.default.color,validator(e){return[...m.ui.colors,...Object.keys(n.color)].includes(e)}},variant:{type:String,default:()=>n.default.variant,validator(e){return[...Object.keys(n.variant),...Object.values(n.color).flatMap(t=>Object.keys(t))].includes(e)}},icon:{type:String,default:null},loadingIcon:{type:String,default:()=>n.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:void 0}},setup(e,{slots:t}){const{ui:a,attrs:y,attrsClass:b}=_("button",e.ui,n),i=l(()=>e.icon&&e.leading||e.icon&&!e.trailing||e.loading&&!e.trailing||e.leadingIcon),o=l(()=>e.icon&&e.trailing||e.loading&&e.trailing||e.trailingIcon),s=l(()=>e.square||!t.default&&!e.label),k=l(()=>{const j=a.value.color?.[e.color]?.[e.variant]||a.value.variant[e.variant];return q(d(a.value.base,a.value.font,a.value.rounded,a.value.size[e.size],a.value.gap[e.size],e.padded&&a.value[s.value?"square":"padding"][e.size],j?.replaceAll("{color}",e.color),e.block?"w-full flex justify-center items-center":"inline-flex items-center"),b)}),C=l(()=>e.loading?e.loadingIcon:e.leadingIcon||e.icon),z=l(()=>e.loading&&!i.value?e.loadingIcon:e.trailingIcon||e.icon),S=l(()=>d(a.value.icon.base,a.value.icon.size[e.size],e.loading&&"animate-spin")),B=l(()=>d(a.value.icon.base,a.value.icon.size[e.size],e.loading&&!i.value&&"animate-spin"));return{attrs:y,isLeading:i,isTrailing:o,isSquare:s,buttonClass:k,leadingIconName:C,trailingIconName:z,leadingIconClass:S,trailingIconClass:B}}});function M(e,t,a,y,b,i){const o=v,s=I;return u(),r(s,U({type:e.type,disabled:e.disabled||e.loading,class:e.buttonClass},e.attrs),{default:O(()=>[c(e.$slots,"leading",{disabled:e.disabled,loading:e.loading},()=>[e.isLeading&&e.leadingIconName?(u(),r(o,{key:0,name:e.leadingIconName,class:g(e.leadingIconClass),"aria-hidden":"true"},null,8,["name","class"])):f("",!0)]),c(e.$slots,"default",{},()=>[e.label?(u(),h("span",{key:0,class:g([e.truncate?"text-left break-all line-clamp-1":""])},w(e.label),3)):f("",!0)]),c(e.$slots,"trailing",{disabled:e.disabled,loading:e.loading},()=>[e.isTrailing&&e.trailingIconName?(u(),r(o,{key:0,name:e.trailingIconName,class:g(e.trailingIconClass),"aria-hidden":"true"},null,8,["name","class"])):f("",!0)])]),_:3},16,["type","disabled","class"])}const V=A(E,[["render",M]]);export{V as default};
