import{d as T,m as I,g as h,r as k,h as C,q as w,c as m,o as s,w as i,a9 as V,e as u,u as d,f as o,n as r,i as c,j as g,t as v,k as B,v as M,ad as N,ap as E}from"./Bxv1kRJt.js";import{a as O,b as _,T as D}from"./Dxmk8VbU.js";import"./06_OkG9_.js";const L=["for"],P=["id","type"],U={key:1,flex:"~ col"},z=["disabled"],R=["disabled"],S=T({__name:"UiEditorInput",props:I({type:{default:"text"},disabled:{type:Boolean},tooltip:{},label:{},classes:{default:""},inputClasses:{default:"INPUT"},offset:{default:4},min:{},max:{},focus:{type:Boolean}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(f){const l=f,a=h(f,"modelValue");function y(){typeof a.value=="number"?a.value=Math.min(a.value+1,l.max??1/0):a.value=1}function b(){typeof a.value=="number"?a.value=Math.max(a.value-1,l.min??-1/0):a.value=Math.max(l.min??-1/0,-1)}const p=k(null);return C(()=>l.focus,async e=>{e&&(await w(),p.value?.focus())},{immediate:!0}),(e,t)=>(s(),m(d(D),null,{default:i(()=>[V(d(O),{class:"TOOLTIP_TRIGGER"},{default:i(()=>[o("div",{class:r(["flex items-center rounded group gap0.5",e.classes])},[e.label?(s(),c("label",{key:0,for:e.label,class:"LABEL"},v(e.label),9,L)):u("",!0),g(o("input",B({id:e.label,ref_key:"input",ref:p,"onUpdate:modelValue":t[0]||(t[0]=n=>a.value=n),type:e.type,class:[e.inputClasses,e.type==="number"?"w-12":"w-full"]},e.$attrs),null,16,P),[[M,a.value]]),e.type==="number"?(s(),c("div",U,[o("button",{class:r(["i-lucide-chevron-up size-3",[+a.value>=(e.max??1/0)?"opacity-50":"hover:scale-120"]]),disabled:+a.value>=(e.max??1/0),onClick:t[1]||(t[1]=n=>y())},null,10,z),o("button",{class:r(["size-3 i-lucide-chevron-down",[+a.value<=(e.min??1/0)?"opacity-50":"hover:scale-120"]]),disabled:+a.value<=(e.min??-1/0),onClick:t[2]||(t[2]=n=>b())},null,10,R)])):u("",!0)],2)]),_:1}),e.tooltip&&!e.disabled?(s(),m(d(_),{key:0,offset:e.offset,class:"TOOLTIP_CONTENT"},{default:i(()=>[N(v(e.tooltip),1)]),_:1},8,["offset"])):u("",!0)]),_:1}))}}),q=E(S,[["__scopeId","data-v-47e69e11"]]);export{q as default};
