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 CHANGED
@@ -370,6 +370,7 @@ interface AccordionProps {
370
370
  disabled?: boolean;
371
371
  icon?: React$1.ReactElement;
372
372
  titleVariant?: string;
373
+ slideAnimation?: boolean;
373
374
  }
374
375
 
375
376
  declare const _default$g: (props: AccordionProps) => React$1.JSX.Element;
package/lib/index.js CHANGED
@@ -2014,7 +2014,8 @@ const Accordion = ({
2014
2014
  headerComponent,
2015
2015
  disabled = false,
2016
2016
  icon,
2017
- titleVariant = "B4_REGULAR"
2017
+ titleVariant = "B4_REGULAR",
2018
+ slideAnimation = true
2018
2019
  }) => {
2019
2020
  const contentRef = React.useRef(null);
2020
2021
  const [animation] = React.useState(new reactNative.Animated.Value(0));
@@ -2073,7 +2074,7 @@ const Accordion = ({
2073
2074
  }) : null
2074
2075
  ),
2075
2076
  optionalElement ? optionalElement() : null,
2076
- isOpen && /* @__PURE__ */ React__default["default"].createElement(reactNative.Animated.View, { style: [styles$m.content, { height: cardHeight }] }, /* @__PURE__ */ React__default["default"].createElement(
2077
+ isOpen && /* @__PURE__ */ React__default["default"].createElement(reactNative.Animated.View, { style: [styles$m.content, slideAnimation && { height: cardHeight }] }, /* @__PURE__ */ React__default["default"].createElement(
2077
2078
  reactNative.View,
2078
2079
  {
2079
2080
  ref: contentRef,
@@ -4183,22 +4184,25 @@ const OTPInput = React__default["default"].forwardRef(
4183
4184
  }
4184
4185
  }));
4185
4186
  const handleChange = (index, value) => {
4186
- const regex = /^\d+$/;
4187
- if (value.length === 1 && regex.test(value) && index >= 0 && index < length) {
4188
- const newOTP = `${otp}${value}`;
4189
- setOTP(newOTP);
4190
- refs.current[index + 1]?.focus();
4191
- } else if (value.length === 0 && index > 0) {
4192
- const newOTP = otp.slice(0, -1);
4193
- setOTP(newOTP);
4194
- refs.current[index - 1]?.focus();
4195
- } else if (value?.length === length) {
4196
- setOTP(value);
4197
- refs.current[length - 1]?.focus();
4198
- } else {
4199
- const newOTP = otp.slice(0, -1);
4200
- setOTP(newOTP);
4201
- refs.current[index]?.focus();
4187
+ const specialCharacterRegex = /[^a-zA-Z0-9 ]/;
4188
+ if (value === "" || value?.length > 1 || !specialCharacterRegex.test(value)) {
4189
+ const regex = /^\d+$/;
4190
+ if (value.length === 1 && regex.test(value) && index >= 0 && index < length) {
4191
+ const newOTP = `${otp}${value}`;
4192
+ setOTP(newOTP);
4193
+ refs.current[index + 1]?.focus();
4194
+ } else if (value.length === 0 && index > 0) {
4195
+ const newOTP = otp.slice(0, -1);
4196
+ setOTP(newOTP);
4197
+ refs.current[index - 1]?.focus();
4198
+ } else if (value?.length === length) {
4199
+ setOTP(value);
4200
+ refs.current[length - 1]?.focus();
4201
+ } else {
4202
+ const newOTP = otp.slice(0, -1);
4203
+ setOTP(newOTP);
4204
+ refs.current[index]?.focus();
4205
+ }
4202
4206
  }
4203
4207
  };
4204
4208
  const handleKeyPress = (e, index) => {