dhre-ui-kit 0.0.325 → 0.0.327
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/lib/index.d.ts +1 -0
- package/lib/index.js +22 -18
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +22 -18
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
package/lib/index.mjs
CHANGED
|
@@ -1977,7 +1977,8 @@ const Accordion = ({
|
|
|
1977
1977
|
headerComponent,
|
|
1978
1978
|
disabled = false,
|
|
1979
1979
|
icon,
|
|
1980
|
-
titleVariant = "B4_REGULAR"
|
|
1980
|
+
titleVariant = "B4_REGULAR",
|
|
1981
|
+
slideAnimation = true
|
|
1981
1982
|
}) => {
|
|
1982
1983
|
const contentRef = useRef(null);
|
|
1983
1984
|
const [animation] = useState(new Animated.Value(0));
|
|
@@ -2036,7 +2037,7 @@ const Accordion = ({
|
|
|
2036
2037
|
}) : null
|
|
2037
2038
|
),
|
|
2038
2039
|
optionalElement ? optionalElement() : null,
|
|
2039
|
-
isOpen && /* @__PURE__ */ React.createElement(Animated.View, { style: [styles$m.content, { height: cardHeight }] }, /* @__PURE__ */ React.createElement(
|
|
2040
|
+
isOpen && /* @__PURE__ */ React.createElement(Animated.View, { style: [styles$m.content, slideAnimation && { height: cardHeight }] }, /* @__PURE__ */ React.createElement(
|
|
2040
2041
|
View,
|
|
2041
2042
|
{
|
|
2042
2043
|
ref: contentRef,
|
|
@@ -4146,22 +4147,25 @@ const OTPInput = React.forwardRef(
|
|
|
4146
4147
|
}
|
|
4147
4148
|
}));
|
|
4148
4149
|
const handleChange = (index, value) => {
|
|
4149
|
-
const
|
|
4150
|
-
if (value
|
|
4151
|
-
const
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4150
|
+
const specialCharacterRegex = /[^a-zA-Z0-9 ]/;
|
|
4151
|
+
if (value === "" || value?.length > 1 || !specialCharacterRegex.test(value)) {
|
|
4152
|
+
const regex = /^\d+$/;
|
|
4153
|
+
if (value.length === 1 && regex.test(value) && index >= 0 && index < length) {
|
|
4154
|
+
const newOTP = `${otp}${value}`;
|
|
4155
|
+
setOTP(newOTP);
|
|
4156
|
+
refs.current[index + 1]?.focus();
|
|
4157
|
+
} else if (value.length === 0 && index > 0) {
|
|
4158
|
+
const newOTP = otp.slice(0, -1);
|
|
4159
|
+
setOTP(newOTP);
|
|
4160
|
+
refs.current[index - 1]?.focus();
|
|
4161
|
+
} else if (value?.length === length) {
|
|
4162
|
+
setOTP(value);
|
|
4163
|
+
refs.current[length - 1]?.focus();
|
|
4164
|
+
} else {
|
|
4165
|
+
const newOTP = otp.slice(0, -1);
|
|
4166
|
+
setOTP(newOTP);
|
|
4167
|
+
refs.current[index]?.focus();
|
|
4168
|
+
}
|
|
4165
4169
|
}
|
|
4166
4170
|
};
|
|
4167
4171
|
const handleKeyPress = (e, index) => {
|