dhre-component-lib 0.7.8 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/OtpInput/OtpInput.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +10 -9
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +10 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -21617,7 +21617,7 @@ const MapComponent = ({ containerClassName = "map-container", zoom = 18, mapOpti
|
|
|
21617
21617
|
}
|
|
21618
21618
|
};
|
|
21619
21619
|
|
|
21620
|
-
var css$e = ".otpMainContainer {\n display: flex;\n justify-content: center;\n flex-direction: column;\n margin: 10px;\n width: 343px;\n}\n\n.otpInputDiv {\n flex-direction: row;\n gap: 12px;\n display: flex;\n}\n\n.otpInput {\n width: calc(25% - 9px);\n height: 48px;\n text-align: center;\n font-size: 18px;\n font-weight: 400;\n border-radius: 8px;\n}\n@media (max-width: 600px) {\n .otpInput {\n height: 40px;\n }\n}\n\n.resendContainer {\n display: flex;\n flex-direction: row;\n margin-top: 10px;\n justify-content: space-between;\n}\n\n.errorText {\n color: #EB0542;\n font-weight: 400;\n font-size: 14px;\n}\n\n.timerText {\n color: #0569C2;\n font-weight: 400;\n font-size: 14px;\n display: flex;\n align-items: center;\n}\n\n.resendText {\n color: #A7A7A7;\n font-weight: 700;\n font-size: 14px;\n}\n\n.enabledResendText {\n color: #000000;\n font-weight: 700;\n font-size: 14px;\n}";
|
|
21620
|
+
var css$e = ".otpMainContainer {\n display: flex;\n justify-content: center;\n flex-direction: column;\n margin: 10px 0;\n width: 343px;\n}\n\n.otpInputDiv {\n flex-direction: row;\n gap: 12px;\n display: flex;\n}\n\n.otpInput {\n width: calc(25% - 9px);\n height: 48px;\n text-align: center;\n font-size: 18px;\n font-weight: 400;\n border-radius: 8px;\n}\n@media (max-width: 600px) {\n .otpInput {\n height: 40px;\n }\n}\n\n.otpInput::-webkit-inner-spin-button {\n display: none;\n}\n\n.resendContainer {\n display: flex;\n flex-direction: row;\n margin-top: 10px;\n justify-content: space-between;\n}\n\n.errorText {\n color: #EB0542;\n font-weight: 400;\n font-size: 14px;\n}\n\n.timerText {\n color: #0569C2;\n font-weight: 400;\n font-size: 14px;\n display: flex;\n align-items: center;\n}\n\n.resendText {\n color: #A7A7A7;\n font-weight: 700;\n font-size: 14px;\n}\n\n.enabledResendText {\n color: #000000;\n font-weight: 700;\n font-size: 14px;\n}";
|
|
21621
21621
|
n(css$e,{});
|
|
21622
21622
|
|
|
21623
21623
|
const OTPInput = ({ length = 4, onChange, autoFocus = false, onResend, resendDelay = 60, error = false, errorText, resendText, showResendButton = true, className, inputClassName, disableResend, icon, noResendButtonText }) => {
|
|
@@ -21631,7 +21631,7 @@ const OTPInput = ({ length = 4, onChange, autoFocus = false, onResend, resendDel
|
|
|
21631
21631
|
return () => clearInterval(countdown);
|
|
21632
21632
|
}, []);
|
|
21633
21633
|
const handleChange = (value, index) => {
|
|
21634
|
-
if (isNaN(Number(value)))
|
|
21634
|
+
if (isNaN(Number(value)) || Number(value) > 9)
|
|
21635
21635
|
return;
|
|
21636
21636
|
const newOtp = [...otp];
|
|
21637
21637
|
newOtp[index] = value;
|
|
@@ -21652,11 +21652,12 @@ const OTPInput = ({ length = 4, onChange, autoFocus = false, onResend, resendDel
|
|
|
21652
21652
|
}
|
|
21653
21653
|
}
|
|
21654
21654
|
};
|
|
21655
|
-
const handleResendClick = () => {
|
|
21656
|
-
onResend()
|
|
21657
|
-
|
|
21658
|
-
|
|
21659
|
-
|
|
21655
|
+
const handleResendClick = async () => {
|
|
21656
|
+
onResend(() => {
|
|
21657
|
+
setOtp(Array(length).fill(""));
|
|
21658
|
+
setTimer(resendDelay);
|
|
21659
|
+
setIsComplete(false);
|
|
21660
|
+
});
|
|
21660
21661
|
};
|
|
21661
21662
|
React$1.useEffect(() => {
|
|
21662
21663
|
setIsComplete(otp.every((digit) => digit !== ""));
|
|
@@ -21676,11 +21677,11 @@ const OTPInput = ({ length = 4, onChange, autoFocus = false, onResend, resendDel
|
|
|
21676
21677
|
return (React__namespace.default.createElement("div", { className: `${'otpMainContainer'} ${className ? className : ''}` },
|
|
21677
21678
|
React__namespace.default.createElement("div", { className: "otpInputDiv" }, Array(length)
|
|
21678
21679
|
.fill("")
|
|
21679
|
-
.map((_, index) => (React__namespace.default.createElement("input", { key: index, type: "number", id: `otp-input-${index}`, value: otp[index], "data-testid": `otp-input-${index}`, onChange: (e) => handleChange(e.target.value, index), onKeyDown: (e) => handleKeyDown(e, index),
|
|
21680
|
+
.map((_, index) => (React__namespace.default.createElement("input", { key: index, type: "number", id: `otp-input-${index}`, value: otp[index], "data-testid": `otp-input-${index}`, onChange: (e) => handleChange(e.target.value, index), onKeyDown: (e) => handleKeyDown(e, index), style: { border: `1px solid ${getReadableStatus()}` }, className: `${'otpInput'} ${inputClassName ? inputClassName : ''}`, autoFocus: autoFocus && index === 0 })))),
|
|
21680
21681
|
React__namespace.default.createElement("div", { className: "resendContainer" },
|
|
21681
21682
|
error && (React__namespace.default.createElement("div", { className: "errorText" }, errorText)),
|
|
21682
21683
|
!showResendButton && !error && React__namespace.default.createElement("div", { className: "errorText" }, noResendButtonText),
|
|
21683
|
-
|
|
21684
|
+
showResendButton && (React__namespace.default.createElement(React__namespace.default.Fragment, null,
|
|
21684
21685
|
React__namespace.default.createElement("div", { className: "timerText" },
|
|
21685
21686
|
timer ? icon : "",
|
|
21686
21687
|
timer > 0 ? `00:${timer} secs` : ""),
|