allaw-ui 2.4.2 → 2.4.4
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.
|
@@ -29,50 +29,9 @@ var VerificationCodeInput = function (_a) {
|
|
|
29
29
|
onError === null || onError === void 0 ? void 0 : onError(null);
|
|
30
30
|
}
|
|
31
31
|
}, [testError, onError]);
|
|
32
|
-
var validateAllInputs = function () {
|
|
33
|
-
var fullValue = values.join("");
|
|
34
|
-
console.log("[VerificationCodeInput] Validating inputs:", fullValue);
|
|
35
|
-
if (fullValue.length === numInputs) {
|
|
36
|
-
console.log("[VerificationCodeInput] All inputs filled, length:", fullValue.length);
|
|
37
|
-
if (testError) {
|
|
38
|
-
setError("Code de vérification invalide");
|
|
39
|
-
onError === null || onError === void 0 ? void 0 : onError("Code de vérification invalide");
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
setError("");
|
|
43
|
-
onError === null || onError === void 0 ? void 0 : onError(null);
|
|
44
|
-
console.log("[VerificationCodeInput] Calling onComplete with:", fullValue);
|
|
45
|
-
onComplete === null || onComplete === void 0 ? void 0 : onComplete(fullValue);
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
32
|
var handleInputChange = function (index, value) {
|
|
49
|
-
var _a
|
|
33
|
+
var _a;
|
|
50
34
|
console.log("[VerificationCodeInput] Input ".concat(index, " changed to:"), value);
|
|
51
|
-
if (value.length > 1) {
|
|
52
|
-
var pastedChars = value.split("");
|
|
53
|
-
var validChars = pastedChars
|
|
54
|
-
.filter(function (char) { return validateInput(char, allowedChars); })
|
|
55
|
-
.slice(0, numInputs - index);
|
|
56
|
-
if (validChars.length > 0) {
|
|
57
|
-
var newValues_1 = __spreadArray([], values, true);
|
|
58
|
-
validChars.forEach(function (char, i) {
|
|
59
|
-
if (index + i < numInputs) {
|
|
60
|
-
newValues_1[index + i] = char;
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
setValues(newValues_1);
|
|
64
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(newValues_1.join(""));
|
|
65
|
-
var nextEmptyIndex = newValues_1.findIndex(function (val, i) { return i >= index && !val; });
|
|
66
|
-
var focusIndex = nextEmptyIndex === -1 ? numInputs - 1 : nextEmptyIndex;
|
|
67
|
-
(_a = inputRefs.current[focusIndex]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
68
|
-
if (nextEmptyIndex === -1) {
|
|
69
|
-
validateAllInputs();
|
|
70
|
-
(_b = inputRefs.current[numInputs - 1]) === null || _b === void 0 ? void 0 : _b.blur();
|
|
71
|
-
}
|
|
72
|
-
console.log("[VerificationCodeInput] Handling pasted value");
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
35
|
if (!validateInput(value, allowedChars)) {
|
|
77
36
|
console.log("[VerificationCodeInput] Invalid input value");
|
|
78
37
|
return;
|
|
@@ -83,16 +42,16 @@ var VerificationCodeInput = function (_a) {
|
|
|
83
42
|
var fullValue = newValues.join("");
|
|
84
43
|
console.log("[VerificationCodeInput] New values:", fullValue);
|
|
85
44
|
onChange === null || onChange === void 0 ? void 0 : onChange(fullValue);
|
|
86
|
-
if (value === "")
|
|
87
|
-
return;
|
|
88
|
-
setError("");
|
|
89
|
-
onError === null || onError === void 0 ? void 0 : onError(null);
|
|
90
45
|
if (index === numInputs - 1 && value !== "") {
|
|
91
|
-
console.log("[VerificationCodeInput] Last input filled, validating
|
|
92
|
-
|
|
46
|
+
console.log("[VerificationCodeInput] Last input filled, validating with:", fullValue);
|
|
47
|
+
if (fullValue.length === numInputs) {
|
|
48
|
+
setError("");
|
|
49
|
+
onError === null || onError === void 0 ? void 0 : onError(null);
|
|
50
|
+
onComplete === null || onComplete === void 0 ? void 0 : onComplete(fullValue);
|
|
51
|
+
}
|
|
93
52
|
}
|
|
94
53
|
else if (index < numInputs - 1) {
|
|
95
|
-
(
|
|
54
|
+
(_a = inputRefs.current[index + 1]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
96
55
|
}
|
|
97
56
|
};
|
|
98
57
|
var handleKeyDown = function (index, e) {
|
|
@@ -109,7 +68,13 @@ var VerificationCodeInput = function (_a) {
|
|
|
109
68
|
setTimeout(function () {
|
|
110
69
|
var isStillFocused = inputRefs.current.some(function (ref) { return ref === document.activeElement; });
|
|
111
70
|
if (!isStillFocused) {
|
|
112
|
-
|
|
71
|
+
if (values.every(function (value) { return value !== ""; })) {
|
|
72
|
+
var fullValue = values.join("");
|
|
73
|
+
console.log("[VerificationCodeInput] All inputs filled, length:", fullValue.length);
|
|
74
|
+
setError("");
|
|
75
|
+
onError === null || onError === void 0 ? void 0 : onError(null);
|
|
76
|
+
onComplete === null || onComplete === void 0 ? void 0 : onComplete(fullValue);
|
|
77
|
+
}
|
|
113
78
|
}
|
|
114
79
|
}, 0);
|
|
115
80
|
};
|
|
@@ -122,16 +87,20 @@ var VerificationCodeInput = function (_a) {
|
|
|
122
87
|
.filter(function (char) { return validateInput(char, allowedChars); })
|
|
123
88
|
.slice(0, numInputs);
|
|
124
89
|
if (validChars.length > 0) {
|
|
125
|
-
var
|
|
90
|
+
var newValues_1 = Array(numInputs).fill("");
|
|
126
91
|
validChars.forEach(function (char, i) {
|
|
127
92
|
if (i < numInputs) {
|
|
128
|
-
|
|
93
|
+
newValues_1[i] = char;
|
|
129
94
|
}
|
|
130
95
|
});
|
|
131
|
-
setValues(
|
|
132
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(
|
|
96
|
+
setValues(newValues_1);
|
|
97
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newValues_1.join(""));
|
|
133
98
|
if (validChars.length >= numInputs) {
|
|
134
|
-
|
|
99
|
+
var fullValue = newValues_1.join("");
|
|
100
|
+
console.log("[VerificationCodeInput] All inputs filled, length:", fullValue.length);
|
|
101
|
+
setError("");
|
|
102
|
+
onError === null || onError === void 0 ? void 0 : onError(null);
|
|
103
|
+
onComplete === null || onComplete === void 0 ? void 0 : onComplete(fullValue);
|
|
135
104
|
inputRefs.current.forEach(function (input) { return input === null || input === void 0 ? void 0 : input.blur(); });
|
|
136
105
|
(_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.blur();
|
|
137
106
|
}
|
|
@@ -11,7 +11,7 @@ var BlogBottomSection = function (_a) {
|
|
|
11
11
|
return (React.createElement("div", { className: styles.blogBottomSection },
|
|
12
12
|
React.createElement("div", { className: styles.blogBottomSectionUp },
|
|
13
13
|
React.createElement("div", { className: styles.tagsContainer }, tags.slice(0, 2).map(function (tag, index) {
|
|
14
|
-
var validatedTag = tag.trim().length >
|
|
14
|
+
var validatedTag = tag.trim().length > 40 ? "".concat(tag.slice(0, 40), "...") : tag;
|
|
15
15
|
return (React.createElement("span", { key: index, className: styles.blogTypeTag }, validatedTag));
|
|
16
16
|
})),
|
|
17
17
|
React.createElement(TinyInfo, { text: date.toLocaleDateString(), variant: "medium14", color: "mid-grey" })),
|