mimir-ui-kit 0.0.20 → 0.0.21

Sign up to get free protection for your applications and to get access to all the features.
@@ -63,16 +63,16 @@ const OtpInput = forwardRef(
63
63
  if (!isTargetValueDigit && nextInputEl && nextInputEl.value !== "") {
64
64
  return;
65
65
  }
66
- targetValue = isTargetValueDigit ? targetValue : " ";
66
+ targetValue = isTargetValueDigit ? targetValue.trim() : " ";
67
67
  const targetValueLength = targetValue.length;
68
68
  if (targetValueLength === 1) {
69
69
  const newValue = value.substring(0, index) + targetValue + value.substring(index + 1);
70
- onChange == null ? void 0 : onChange(newValue);
70
+ onChange == null ? void 0 : onChange(newValue.trim());
71
71
  if (isTargetValueDigit) {
72
72
  handleFocusToNextInput(index);
73
73
  }
74
74
  } else if (targetValueLength === valueLength) {
75
- onChange == null ? void 0 : onChange(targetValue);
75
+ onChange == null ? void 0 : onChange(targetValue.trim());
76
76
  target.blur();
77
77
  }
78
78
  };
@@ -91,13 +91,13 @@ const OtpInput = forwardRef(
91
91
  return handleFocusToPrevInput(index);
92
92
  }
93
93
  }
94
- const targetValue = target.value;
94
+ const targetValue = target.value.trim();
95
95
  target.setSelectionRange(0, targetValue.length);
96
96
  if (e.key !== "Backspace" || targetValue !== "") {
97
97
  return;
98
98
  }
99
99
  const newValue = `${value.substring(0, index - 1)} ${value.substring(index)}`;
100
- onChange == null ? void 0 : onChange(newValue);
100
+ onChange == null ? void 0 : onChange(newValue.trim());
101
101
  handleFocusToPrevInput(index);
102
102
  };
103
103
  const handleFocus = (e, index) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mimir-ui-kit",
3
3
  "private": false,
4
- "version": "0.0.20",
4
+ "version": "0.0.21",
5
5
  "type": "module",
6
6
  "exports": "./dist/index.js",
7
7
  "module": "./dist/index.js",