import{dq as s,dm as e}from"./index-D_pphaE2.js";const h=s.memo(a=>{const{label:r,detail:u,onSubmit:m,initialValue:i,minimal:c,...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=>{m(n,!t.target.validationMessage)},[m,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}),c&&e.jsx("span",{children:n}),e.jsx("span",{children:a.max})]})]}),!c&&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};
