import{p as _,q as T,r as y,k as i,t as R,c as o,o as r,b as k,A as n,x as d,v as s,u as e,N as u,Q as z,O as c,y as V,D as S}from"./index-DRopsKkO.js";const w={wrapper:{base:"flex w-full group",variants:{align:{topInside:"flex-col gap-0 relative",topWithDesc:"flex-col-reverse gap-2",top:"flex-col gap-2",right:"flex-row w-fit",left:"flex-row-reverse w-fit"},disabled:{true:"cursor-not-allowed"}},compoundVariants:[{align:["left","right"],size:"sm",class:"gap-2"},{align:["left","right"],size:"md",class:"gap-2.5"},{align:["left","right"],size:"lg",class:"gap-3"},{align:["left","right"],centred:!0,class:"items-center w-auto"},{align:"left",centred:!0,class:"justify-end"},{align:"right",centred:!0,class:"justify-start"}]},content:"flex",label:{base:"z-10 block !leading-none w-max transition",variants:{size:{sm:"text-xs",md:"text-sm",lg:"text-base"},align:{top:"font-medium",topInside:"font-normal absolute left-3 text-gray-500 group-focus-within:text-brand-600",topWithDesc:"font-medium",left:"font-normal",right:"font-normal"},error:{true:"text-red-600 group-focus-within:text-red-600"},disabled:{true:"text-gray-500 cursor-not-allowed"}},compoundVariants:[{interactive:!0,disabled:!1,class:"hover:cursor-pointer"},{align:"topInside",size:"sm",class:"top-2 text-2xs"},{align:"topInside",size:"md",class:"top-2.5 text-xs"},{align:"topInside",size:"lg",class:"top-2.5 text-sm"},{align:"topWithDesc",size:"sm",class:"-mt-px"},{align:"topWithDesc",size:"md",class:""},{align:"topWithDesc",size:"lg",class:"mt-px"},{align:["left","right"],size:"sm",class:"-mt-0.5 text-sm"},{align:["left","right"],size:"md",class:"text-sm"},{align:["left","right"],size:"lg",class:"mt-px text-base"},{align:["left","right"],centred:!1,class:"pt-1"}]},description:{base:"font-normal text-gray-500 text-left !leading-tight",variants:{size:{sm:"text-2xs",md:"text-xs",lg:"text-sm"},align:{top:"",topInside:"pl-3 mt-1.5",topWithDesc:"pt-0.5",left:"pt-0.5",right:"pt-0.5"},error:{true:"text-red-600"}}},defaults:{align:"top",size:"md",centred:!1,disabled:!1,interactive:!1}},L="ULabel",m={topWithDesc:"topWithDesc",left:"left",right:"right"},M=["data-test"],O=["data-test"],U={key:0},j=["for","data-test"],q=["data-test","textContent"],H=["data-test","textContent"],Q=["for","data-test"],F=["data-test"],G=["data-test","textContent"],J=["data-test","textContent"],Y=_({inheritAttrs:!1,__name:"ULabel",props:T({label:{},for:{},description:{},error:{},interactive:{type:Boolean},align:{},size:{},disabled:{type:Boolean},centred:{type:Boolean},config:{},dataTest:{}},{...S(w,L),label:""}),emits:["click"],setup(C,{expose:D,emit:W}){const a=C,$=W,g=y(null),b=y(null),A=i(()=>a.align===m.left||a.align===m.right),B=i(()=>a.align===m.topWithDesc),E=i(()=>g.value),N=i(()=>b.value),p=i(()=>!!a.error&&!a.disabled);function I(t){$("click",t)}D({labelElement:E,wrapperElement:N});const P=i(()=>({error:!!a.error&&!a.disabled})),{getDataTest:l,wrapperAttrs:h,contentAttrs:v,labelAttrs:x,descriptionAttrs:f}=R(w,P);return(t,K)=>A.value||B.value?(r(),o("div",s({key:0,ref_key:"wrapperRef",ref:b},e(h),{"data-test":e(l)(),onClick:I}),[k("div",s(e(v),{"data-test":e(l)("content")}),[d(t.$slots,"default")],16,O),t.label||e(u)(t.$slots.label)||t.error||t.description?(r(),o("div",U,[t.label||e(u)(t.$slots.label)?(r(),o("label",s({key:0,ref_key:"labelRef",ref:g,for:a.for},e(x),{"data-test":e(l)("label")}),[d(t.$slots,"label",{label:t.label},()=>[z(c(t.label),1)])],16,j)):n("",!0),p.value?(r(),o("div",s({key:1},e(f),{"data-test":e(l)("error"),textContent:c(t.error)}),null,16,q)):n("",!0),t.description&&!p.value?(r(),o("div",s({key:2},e(f),{"data-test":e(l)("description"),textContent:c(t.description)}),null,16,H)):n("",!0),d(t.$slots,"bottom")])):n("",!0)],16,M)):(r(),o("div",V(s({key:1},e(h))),[t.label||e(u)(t.$slots.label)?(r(),o("label",s({key:0},e(x),{ref_key:"labelRef",ref:g,for:a.for,"data-test":e(l)("label")}),[d(t.$slots,"label",{label:t.label},()=>[z(c(t.label),1)])],16,Q)):n("",!0),k("div",s(e(v),{"data-test":e(l)("content")}),[d(t.$slots,"default")],16,F),p.value?(r(),o("div",s({key:1},e(f),{"data-test":e(l)("error"),textContent:c(t.error)}),null,16,G)):n("",!0),t.description&&!p.value?(r(),o("div",s({key:2},e(f),{"data-test":e(l)("description"),textContent:c(t.description)}),null,16,J)):n("",!0),d(t.$slots,"bottom")],16))}});export{Y as _};
