@bigtablet/design-system 2.4.3 → 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.
- package/dist/index.js +9 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -948,9 +948,9 @@ var Dropdown = ({
|
|
|
948
948
|
};
|
|
949
949
|
React4.useEffect(() => {
|
|
950
950
|
if (!isOpen) return;
|
|
951
|
-
const
|
|
951
|
+
const matchedIndex = options.findIndex((o) => o.value === currentValue && !o.disabled);
|
|
952
952
|
setActiveIndex(
|
|
953
|
-
|
|
953
|
+
matchedIndex >= 0 ? matchedIndex : Math.max(
|
|
954
954
|
0,
|
|
955
955
|
options.findIndex((o) => !o.disabled)
|
|
956
956
|
)
|
|
@@ -2090,9 +2090,9 @@ var OtpInput = ({
|
|
|
2090
2090
|
if (autoFocus) inputsRef.current[0]?.focus();
|
|
2091
2091
|
}, [autoFocus]);
|
|
2092
2092
|
const digits = React4.useMemo(() => {
|
|
2093
|
-
const
|
|
2094
|
-
while (
|
|
2095
|
-
return
|
|
2093
|
+
const chars = value.split("").slice(0, length);
|
|
2094
|
+
while (chars.length < length) chars.push("");
|
|
2095
|
+
return chars;
|
|
2096
2096
|
}, [value, length]);
|
|
2097
2097
|
const focusInput = (index) => {
|
|
2098
2098
|
inputsRef.current[index]?.focus();
|
|
@@ -2101,12 +2101,12 @@ var OtpInput = ({
|
|
|
2101
2101
|
onChange?.(newDigits.join(""));
|
|
2102
2102
|
};
|
|
2103
2103
|
const handleChange = (index, e) => {
|
|
2104
|
-
const
|
|
2105
|
-
if (
|
|
2104
|
+
const nextDigit = e.target.value;
|
|
2105
|
+
if (nextDigit && !/^\d$/.test(nextDigit)) return;
|
|
2106
2106
|
const newDigits = [...digits];
|
|
2107
|
-
newDigits[index] =
|
|
2107
|
+
newDigits[index] = nextDigit;
|
|
2108
2108
|
updateValue(newDigits);
|
|
2109
|
-
if (
|
|
2109
|
+
if (nextDigit && index < length - 1) {
|
|
2110
2110
|
focusInput(index + 1);
|
|
2111
2111
|
}
|
|
2112
2112
|
};
|