import{l as _,p as T,r as y,g as i,s as R,c as o,o as r,b as z,z as n,v as d,t as s,u as e,M as u,P as k,N as c,x as V,C as M}from"./index-CdEV5Lsj.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}},S="ULabel",m={topWithDesc:"topWithDesc",left:"left",right:"right"},L=["data-test"],U=["data-test"],j={key:0},O=["for","data-test"],H=["data-test","textContent"],q=["data-test","textContent"],F=["for","data-test"],G=["data-test"],J=["data-test","textContent"],K=["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:{}},{...M(w,S),label:""}),emits:["click"],setup(C,{expose:D,emit:W}){const a=C,$=W,g=y(null),b=y(null),B=i(()=>a.align===m.left||a.align===m.right),E=i(()=>a.align===m.topWithDesc),N=i(()=>g.value),P=i(()=>b.value),p=i(()=>!!a.error&&!a.disabled);function A(t){$("click",t)}D({labelElement:N,wrapperElement:P});const I=i(()=>({error:!!a.error&&!a.disabled})),{getDataTest:l,wrapperAttrs:h,contentAttrs:v,labelAttrs:x,descriptionAttrs:f}=R(w,I);return(t,Q)=>B.value||E.value?(r(),o("div",s({key:0,ref_key:"wrapperRef",ref:b},e(h),{"data-test":e(l)(),onClick:A}),[z("div",s(e(v),{"data-test":e(l)("content")}),[d(t.$slots,"default")],16,U),t.label||e(u)(t.$slots.label)||t.error||t.description?(r(),o("div",j,[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},()=>[k(c(t.label),1)])],16,O)):n("",!0),p.value?(r(),o("div",s({key:1},e(f),{"data-test":e(l)("error"),textContent:c(t.error)}),null,16,H)):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,q)):n("",!0),d(t.$slots,"bottom")])):n("",!0)],16,L)):(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},()=>[k(c(t.label),1)])],16,F)):n("",!0),z("div",s(e(v),{"data-test":e(l)("content")}),[d(t.$slots,"default")],16,G),p.value?(r(),o("div",s({key:1},e(f),{"data-test":e(l)("error"),textContent:c(t.error)}),null,16,J)):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,K)):n("",!0),d(t.$slots,"bottom")],16))}});export{Y as _};
