@planetaexo/design-system 0.4.17 → 0.4.18
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/index.cjs +3 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -5085,11 +5085,10 @@ var OTPCodeInput = ({
|
|
|
5085
5085
|
e.preventDefault();
|
|
5086
5086
|
}
|
|
5087
5087
|
};
|
|
5088
|
-
const handlePaste = (e) => {
|
|
5088
|
+
const handlePaste = (e, startIndex) => {
|
|
5089
5089
|
e.preventDefault();
|
|
5090
5090
|
const pasted = e.clipboardData.getData("text").replace(/\D/g, "").slice(0, length);
|
|
5091
5091
|
if (!pasted) return;
|
|
5092
|
-
const startIndex = focusedIndexRef.current;
|
|
5093
5092
|
const newDigits = [...digits];
|
|
5094
5093
|
for (let i = 0; i < pasted.length && startIndex + i < length; i++) {
|
|
5095
5094
|
newDigits[startIndex + i] = pasted[i];
|
|
@@ -5119,7 +5118,6 @@ var OTPCodeInput = ({
|
|
|
5119
5118
|
),
|
|
5120
5119
|
role: "group",
|
|
5121
5120
|
"aria-label": label,
|
|
5122
|
-
onPaste: handlePaste,
|
|
5123
5121
|
children: digits.map((digit, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
5124
5122
|
"input",
|
|
5125
5123
|
{
|
|
@@ -5130,13 +5128,14 @@ var OTPCodeInput = ({
|
|
|
5130
5128
|
type: "text",
|
|
5131
5129
|
inputMode: "numeric",
|
|
5132
5130
|
pattern: "\\d*",
|
|
5133
|
-
maxLength:
|
|
5131
|
+
maxLength: 1,
|
|
5134
5132
|
value: digit,
|
|
5135
5133
|
autoComplete: index === 0 ? "one-time-code" : "off",
|
|
5136
5134
|
"aria-label": `${label} d\xEDgito ${index + 1} de ${length}`,
|
|
5137
5135
|
disabled,
|
|
5138
5136
|
onChange: (e) => handleChange(index, e.target.value),
|
|
5139
5137
|
onKeyDown: (e) => handleKeyDown(index, e),
|
|
5138
|
+
onPaste: (e) => handlePaste(e, index),
|
|
5140
5139
|
onFocus: (e) => {
|
|
5141
5140
|
focusedIndexRef.current = index;
|
|
5142
5141
|
e.target.select();
|