import B from"./Icon.RQAIFpgh.js";import C from"./Link.LD64lelx.js";import{I as L,J as v,h as P,K as U,v as n,S as q,U as d,o as u,y as c,w,M as g,B as f,z as m,c as A,t as M,P as p}from"./entry.RGd0w9hd.js";import{u as J}from"./selectMenu.C9lwG85K.js";import{a as T}from"./useButtonGroup.AoLXlm1A.js";import{b as D}from"./button.ljqeEZC_.js";import{_ as E}from"./_plugin-vue_export-helper.x3n3nnut.js";import{n as G,g as K}from"./link.O6hAleNp.js";import"./Icon.IbV_ZJvz.js";import"./index.aIcZnwHK.js";import"./nuxt-link.HDpUgD9S.js";const l=L(v.ui.strategy,v.ui.button,D),R=P({components:{UIcon:B,ULink:C},inheritAttrs:!1,props:{...G,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}=J("button",U(e,"ui"),l),{size:t,rounded:b}=T({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),z=n(()=>{var k,S;const r=((S=(k=a.value.color)==null?void 0:k[e.color])==null?void 0:S[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)}),j=n(()=>e.loading?e.loadingIcon:e.leadingIcon||e.icon),N=n(()=>e.loading&&!i.value?e.loadingIcon:e.trailingIcon||e.icon),$=n(()=>d(a.value.icon.base,a.value.icon.size[t.value],e.loading&&a.value.icon.loading)),O=n(()=>d(a.value.icon.base,a.value.icon.size[t.value],e.loading&&!i.value&&a.value.icon.loading)),h=n(()=>K(e));return{ui:a,attrs:y,isLeading:i,isTrailing:s,isSquare:I,buttonClass:z,leadingIconName:j,trailingIconName:N,leadingIconClass:$,trailingIconClass:O,linkProps:h}}});function V(e,o,a,y,t,b){const i=B,s=C;return u(),c(s,p({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:""])},M(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=E(R,[["render",V]]);export{ne as default};
