import S from"./Icon.sNzKdesA.js";import B from"./Link.5Iw4xYEc.js";import{C as h,D as v,f as P,E as U,i as n,N as q,O as d,o as u,j as c,w,H as g,x as f,k as m,c as A,t as p,K as D}from"./entry.2xM5grDS.js";import{u as E}from"./selectMenu.72ERhOvP.js";import{a as M}from"./useButtonGroup.qVSTPZZ-.js";import{b as T}from"./button.ljqeEZC_.js";import{_ as G}from"./_plugin-vue_export-helper.x3n3nnut.js";import{n as H,g as J}from"./link.O6hAleNp.js";import"./Icon.rhzHF9SY.js";import"./index.aIcZnwHK.js";import"./nuxt-link.6gyhzeaI.js";const l=h(v.ui.strategy,v.ui.button,T),K=P({components:{UIcon:S,ULink:B},inheritAttrs:!1,props:{...H,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:()=>l.default.size,validator(e){return Object.keys(l.size).includes(e)}},color:{type:String,default:()=>l.default.color,validator(e){return[...v.ui.colors,...Object.keys(l.color)].includes(e)}},variant:{type:String,default:()=>l.default.variant,validator(e){return[...Object.keys(l.variant),...Object.values(l.color).flatMap(o=>Object.keys(o))].includes(e)}},icon:{type:String,default:null},loadingIcon:{type:String,default:()=>l.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},class:{type:[String,Object,Array],default:()=>""},ui:{type:Object,default:()=>({})}},setup(e,{slots:o}){const{ui:a,attrs:y}=E("button",U(e,"ui"),l),{size:t,rounded:b}=M({ui:a,props:e}),i=n(()=>e.icon&&e.leading||e.icon&&!e.trailing||e.loading&&!e.trailing||e.leadingIcon),s=n(()=>e.icon&&e.trailing||e.loading&&e.trailing||e.trailingIcon),I=n(()=>e.square||!o.default&&!e.label),j=n(()=>{var k,C;const r=((C=(k=a.value.color)==null?void 0:k[e.color])==null?void 0:C[e.variant])||a.value.variant[e.variant];return q(d(a.value.base,a.value.font,b.value,a.value.size[t.value],a.value.gap[t.value],e.padded&&a.value[I.value?"square":"padding"][t.value],r==null?void 0:r.replaceAll("{color}",e.color),e.block?a.value.block:a.value.inline),e.class)}),N=n(()=>e.loading?e.loadingIcon:e.leadingIcon||e.icon),z=n(()=>e.loading&&!i.value?e.loadingIcon:e.trailingIcon||e.icon),O=n(()=>d(a.value.icon.base,a.value.icon.size[t.value],e.loading&&a.value.icon.loading)),$=n(()=>d(a.value.icon.base,a.value.icon.size[t.value],e.loading&&!i.value&&a.value.icon.loading)),L=n(()=>J(e));return{ui:a,attrs:y,isLeading:i,isTrailing:s,isSquare:I,buttonClass:j,leadingIconName:N,trailingIconName:z,leadingIconClass:O,trailingIconClass:$,linkProps:L}}});function R(e,o,a,y,t,b){const i=S,s=B;return u(),c(s,D({type:e.type,disabled:e.disabled||e.loading,class:e.buttonClass},{...e.linkProps,...e.attrs}),{default:w(()=>[g(e.$slots,"leading",{disabled:e.disabled,loading:e.loading},()=>[e.isLeading&&e.leadingIconName?(u(),c(i,{key:0,name:e.leadingIconName,class:f(e.leadingIconClass),"aria-hidden":"true"},null,8,["name","class"])):m("",!0)]),g(e.$slots,"default",{},()=>[e.label?(u(),A("span",{key:0,class:f([e.truncate?e.ui.truncate:""])},p(e.label),3)):m("",!0)]),g(e.$slots,"trailing",{disabled:e.disabled,loading:e.loading},()=>[e.isTrailing&&e.trailingIconName?(u(),c(i,{key:0,name:e.trailingIconName,class:f(e.trailingIconClass),"aria-hidden":"true"},null,8,["name","class"])):m("",!0)])]),_:3},16,["type","disabled","class"])}const ne=G(K,[["render",R]]);export{ne as default};
