import{d as T,m as I,j as h,r as k,G as C,l as w,o as s,c as m,w as i,z as V,b as u,a as o,n as d,e as c,t as v,f as r,q as g,s as B,v as M,D as N,ab as D}from"./BvNnk7SS.js";import{a as E,b as O,T as _}from"./CYKwSea8.js";import"./BOtdTvFK.js";const z=["for"],L=["id","type"],P={key:1,flex:"~ col"},U=["disabled"],G=["disabled"],R=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(u(_),null,{default:i(()=>[V(u(E),{class:"TOOLTIP_TRIGGER"},{default:i(()=>[o("div",{class:d(["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,z)):r("",!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,L),[[M,a.value]]),e.type==="number"?(s(),c("div",P,[o("button",{class:d(["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,U),o("button",{class:d(["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,G)])):r("",!0)],2)]),_:1}),e.tooltip&&!e.disabled?(s(),m(u(O),{key:0,offset:e.offset,class:"TOOLTIP_CONTENT"},{default:i(()=>[N(v(e.tooltip),1)]),_:1},8,["offset"])):r("",!0)]),_:1}))}}),q=D(R,[["__scopeId","data-v-47e69e11"]]);export{q as default};
