import{r as s,j as e}from"./index-a36IMXuN.js";const h=s.memo(a=>{const{label:r,detail:u,onSubmit:c,initialValue:i,minimal:m,...d}=a,[n,x]=s.useState(i);s.useEffect(()=>{x(i)},[i]);const o=s.useCallback(t=>{x(t.target.value?t.target.valueAsNumber:"")},[]),l=s.useCallback(t=>{c(n,!t.target.validationMessage)},[c,n]);return e.jsxs("fieldset",{className:"fieldset",children:[r&&e.jsxs("legend",{className:"fieldset-legend",children:[r,a.required?" *":""]}),a.min!=null&&a.max!=null&&e.jsxs("div",{className:"w-full max-w-xs",children:[e.jsx("input",{className:"range range-xs range-primary",onChange:o,onTouchEnd:l,onMouseUp:l,onKeyUp:l,...d,type:"range",value:n}),e.jsxs("div",{className:"flex justify-between px-1 mt-1 text-xs",children:[e.jsx("span",{children:a.min}),m&&e.jsx("span",{children:n}),e.jsx("span",{children:a.max})]})]}),!m&&e.jsx("input",{className:`input ${a.pattern||a.required?"validator":""}`,onChange:o,onBlur:l,...d,type:"number",value:n}),u&&e.jsx("p",{className:"label whitespace-normal",children:u})]})});export{h as N};
