@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.js
CHANGED
|
@@ -5064,11 +5064,10 @@ var OTPCodeInput = ({
|
|
|
5064
5064
|
e.preventDefault();
|
|
5065
5065
|
}
|
|
5066
5066
|
};
|
|
5067
|
-
const handlePaste = (e) => {
|
|
5067
|
+
const handlePaste = (e, startIndex) => {
|
|
5068
5068
|
e.preventDefault();
|
|
5069
5069
|
const pasted = e.clipboardData.getData("text").replace(/\D/g, "").slice(0, length);
|
|
5070
5070
|
if (!pasted) return;
|
|
5071
|
-
const startIndex = focusedIndexRef.current;
|
|
5072
5071
|
const newDigits = [...digits];
|
|
5073
5072
|
for (let i = 0; i < pasted.length && startIndex + i < length; i++) {
|
|
5074
5073
|
newDigits[startIndex + i] = pasted[i];
|
|
@@ -5098,7 +5097,6 @@ var OTPCodeInput = ({
|
|
|
5098
5097
|
),
|
|
5099
5098
|
role: "group",
|
|
5100
5099
|
"aria-label": label,
|
|
5101
|
-
onPaste: handlePaste,
|
|
5102
5100
|
children: digits.map((digit, index) => /* @__PURE__ */ jsx(
|
|
5103
5101
|
"input",
|
|
5104
5102
|
{
|
|
@@ -5109,13 +5107,14 @@ var OTPCodeInput = ({
|
|
|
5109
5107
|
type: "text",
|
|
5110
5108
|
inputMode: "numeric",
|
|
5111
5109
|
pattern: "\\d*",
|
|
5112
|
-
maxLength:
|
|
5110
|
+
maxLength: 1,
|
|
5113
5111
|
value: digit,
|
|
5114
5112
|
autoComplete: index === 0 ? "one-time-code" : "off",
|
|
5115
5113
|
"aria-label": `${label} d\xEDgito ${index + 1} de ${length}`,
|
|
5116
5114
|
disabled,
|
|
5117
5115
|
onChange: (e) => handleChange(index, e.target.value),
|
|
5118
5116
|
onKeyDown: (e) => handleKeyDown(index, e),
|
|
5117
|
+
onPaste: (e) => handlePaste(e, index),
|
|
5119
5118
|
onFocus: (e) => {
|
|
5120
5119
|
focusedIndexRef.current = index;
|
|
5121
5120
|
e.target.select();
|