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