react-otpcode-input
Advanced tools
Comparing version 0.2.2 to 0.2.3
@@ -10,2 +10,3 @@ /// <reference types="react" /> | ||
autoFocus?: boolean; | ||
disabled: boolean; | ||
} | ||
@@ -12,0 +13,0 @@ |
15
index.js
@@ -69,3 +69,3 @@ "use strict"; | ||
suppressContentEditableWarning: true, | ||
type: "number" | ||
type: "tel" | ||
})(_templateObject3()); | ||
@@ -81,3 +81,4 @@ | ||
onComplete = _ref.onComplete, | ||
otp = _ref.otp; | ||
otp = _ref.otp, | ||
disabled = _ref.disabled; | ||
var otpValue = otp.padEnd(numberOfInputs); | ||
@@ -129,4 +130,8 @@ var inputs = Array(numberOfInputs).fill(0); | ||
var box = document.getElementById("contentEditableBox"); | ||
box.addEventListener("keydown", handleKeyDown); | ||
box.addEventListener("textInput", handleTextInput); | ||
if (!disabled) { | ||
box.addEventListener("keydown", handleKeyDown); | ||
box.addEventListener("textInput", handleTextInput); | ||
} | ||
return function () { | ||
@@ -136,3 +141,3 @@ box.removeEventListener("keydown", handleKeyDown); | ||
}; | ||
}, [handleTextInput]); | ||
}, [handleTextInput, disabled]); | ||
return _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement(ContentEditableBox, { | ||
@@ -139,0 +144,0 @@ id: "contentEditableBox", |
@@ -26,3 +26,3 @@ import React, { useState, useEffect, useRef } from "react"; | ||
suppressContentEditableWarning: true, | ||
type: "number" | ||
type: "tel" | ||
})` | ||
@@ -48,3 +48,3 @@ position: fixed; | ||
const OtpInput = ({ numberOfInputs, onChange, onComplete, otp }) => { | ||
const OtpInput = ({ numberOfInputs, onChange, onComplete, otp, disabled }) => { | ||
const otpValue = otp.padEnd(numberOfInputs); | ||
@@ -94,4 +94,6 @@ | ||
const box = document.getElementById("contentEditableBox"); | ||
box.addEventListener("keydown", handleKeyDown); | ||
box.addEventListener("textInput", handleTextInput); | ||
if (!disabled) { | ||
box.addEventListener("keydown", handleKeyDown); | ||
box.addEventListener("textInput", handleTextInput); | ||
} | ||
@@ -102,3 +104,3 @@ return () => { | ||
}; | ||
}, [handleTextInput]); | ||
}, [handleTextInput, disabled]); | ||
@@ -105,0 +107,0 @@ return ( |
{ | ||
"name": "react-otpcode-input", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"description": "OTP Input Component", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11733
236