UNPKG

koval-ui

Version:

React components collection with minimalistic design. Supports theming, layout, and input validation.

29 lines (28 loc) 761 B
"use client"; import { useEffect as c } from "react"; import { ValidationState as o } from "./ValidationProps.js"; const m = ({ validation: t, inputRef: r, setValidity: s, errorMessage: e }) => { c(() => { if (typeof t == "string") switch (s(t), t) { case "valid": { r.current?.setCustomValidity(""); break; } case "error": { r.current?.setCustomValidity(e || o.error); break; } case "inProgress": { r.current?.setCustomValidity(e || o.inProgress); break; } default: r.current?.setCustomValidity(""); } }, [e, r, s, t]); }; export { m as useExternalValidation }; //# sourceMappingURL=useExternalValidation.js.map