mimir-ui-kit 0.0.20 → 0.0.22
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) => {
|
@@ -3,5 +3,5 @@ export { Input, EInputSize, EInputVariant } from './Input';
|
|
3
3
|
export type { TInputProps, TSize, TVariant } from './Input';
|
4
4
|
export { InputPassword } from './InputPassword';
|
5
5
|
export type { TInputPasswordProps } from './InputPassword';
|
6
|
-
export { InputPhoneNumber } from './InputPhoneNumber';
|
6
|
+
export { InputPhoneNumber, getMaskedInputPhoneValue, getUnmaskedInputValue } from './InputPhoneNumber';
|
7
7
|
export { OtpInput } from './OtpInput';
|
package/dist/components/index.js
CHANGED
@@ -4,6 +4,7 @@ import { Input } from "./Input/Input.js";
|
|
4
4
|
import { EInputSize, EInputVariant } from "./Input/constants.js";
|
5
5
|
import { InputPassword } from "./InputPassword/InputPassword.js";
|
6
6
|
import { InputPhoneNumber } from "./InputPhoneNumber/InputPhoneNumber.js";
|
7
|
+
import { getMaskedInputPhoneValue, getUnmaskedInputValue } from "./InputPhoneNumber/utils.js";
|
7
8
|
import { OtpInput } from "./OtpInput/OtpInput.js";
|
8
9
|
export {
|
9
10
|
Button,
|
@@ -16,5 +17,7 @@ export {
|
|
16
17
|
Input,
|
17
18
|
InputPassword,
|
18
19
|
InputPhoneNumber,
|
19
|
-
OtpInput
|
20
|
+
OtpInput,
|
21
|
+
getMaskedInputPhoneValue,
|
22
|
+
getUnmaskedInputValue
|
20
23
|
};
|
package/dist/index.js
CHANGED
@@ -4,6 +4,7 @@ import { Input } from "./components/Input/Input.js";
|
|
4
4
|
import { EInputSize, EInputVariant } from "./components/Input/constants.js";
|
5
5
|
import { InputPassword } from "./components/InputPassword/InputPassword.js";
|
6
6
|
import { InputPhoneNumber } from "./components/InputPhoneNumber/InputPhoneNumber.js";
|
7
|
+
import { getMaskedInputPhoneValue, getUnmaskedInputValue } from "./components/InputPhoneNumber/utils.js";
|
7
8
|
import { OtpInput } from "./components/OtpInput/OtpInput.js";
|
8
9
|
import { useMediaQuery } from "./hooks/useMediaQuery/useMediaQuery.js";
|
9
10
|
import { EMediaQuery } from "./hooks/useMediaQuery/constants.js";
|
@@ -20,5 +21,7 @@ import './assets/index.css';export {
|
|
20
21
|
InputPassword,
|
21
22
|
InputPhoneNumber,
|
22
23
|
OtpInput,
|
24
|
+
getMaskedInputPhoneValue,
|
25
|
+
getUnmaskedInputValue,
|
23
26
|
useMediaQuery
|
24
27
|
};
|