fui-fancyui
Version:
FancyUI Libary
29 lines (28 loc) • 1.17 kB
JavaScript
"use client";
import { jsx as e, jsxs as d } from "react/jsx-runtime";
import { useState as f, useRef as h, useEffect as g } from "react";
import C from "../../molecules/SingleInputs/SingleInputs.js";
import T from "../../atoms/Typography/Typography.js";
import { WarpperComponent as x, Container as S, MessageContainer as b, Message as v } from "./FancyCodeVerificationInput.style.js";
function j(a) {
const { length: r = 6, errorMessage: n, isSuccess: u, handler: t, automaticCase: c, debounceTime: s, ...l } = a, [o, m] = f(""), i = h(null);
return g(() => {
o.length === r && (i.current && clearTimeout(i.current), i.current = setTimeout(() => t && t(o), s || 700));
}, [o, t, r, s]), /* @__PURE__ */ e(x, { ...l, children: /* @__PURE__ */ d(S, { children: [
/* @__PURE__ */ e(
C,
{
length: r,
handler: (p) => {
m(p);
},
status: { isError: !!n, isSucceed: !!u },
automaticCase: c
}
),
/* @__PURE__ */ e(b, { children: /* @__PURE__ */ e(v, { $isError: !!n, children: /* @__PURE__ */ e(T, { variant: "subTextCaption", children: n }) }) })
] }) });
}
export {
j as default
};