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.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 regex = /^\d+$/;
4150
- if (value.length === 1 && regex.test(value) && index >= 0 && index < length) {
4151
- const newOTP = `${otp}${value}`;
4152
- setOTP(newOTP);
4153
- refs.current[index + 1]?.focus();
4154
- } else if (value.length === 0 && index > 0) {
4155
- const newOTP = otp.slice(0, -1);
4156
- setOTP(newOTP);
4157
- refs.current[index - 1]?.focus();
4158
- } else if (value?.length === length) {
4159
- setOTP(value);
4160
- refs.current[length - 1]?.focus();
4161
- } else {
4162
- const newOTP = otp.slice(0, -1);
4163
- setOTP(newOTP);
4164
- refs.current[index]?.focus();
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) => {