@ecohouse/ui 0.1.62 → 0.1.63

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.js CHANGED
@@ -36725,11 +36725,13 @@ function reconcileVerificationCells(cells, code, length) {
36725
36725
  }
36726
36726
  function updateVerificationCells(currentCells, index, input, length) {
36727
36727
  const safeLength = Math.max(1, length);
36728
- const safeIndex = Math.min(Math.max(0, index), safeLength - 1);
36728
+ const focusedIndex = Math.min(Math.max(0, index), safeLength - 1);
36729
36729
  const cells = Array.from({ length: safeLength }, (_, cellIndex) => {
36730
36730
  const cell = currentCells[cellIndex] ?? "";
36731
36731
  return /^\d$/.test(cell) ? cell : "";
36732
36732
  });
36733
+ const pastedDigits = input.replace(/\D/g, "");
36734
+ const safeIndex = pastedDigits.length > 1 && pastedDigits.length > safeLength - focusedIndex ? 0 : focusedIndex;
36733
36735
  const insertedDigits = normalizeVerificationCode(input, safeLength - safeIndex);
36734
36736
  if (!insertedDigits) {
36735
36737
  cells[safeIndex] = "";