dhre-ui-kit 0.0.251 → 0.0.252

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
@@ -3364,7 +3364,8 @@ const CommonTextInput = (props) => {
3364
3364
  multiline = false,
3365
3365
  // Default multiline to false
3366
3366
  rightIcon,
3367
- onRightIconPress
3367
+ onRightIconPress,
3368
+ onlyErrorBorderLabel
3368
3369
  } = props;
3369
3370
  return /* @__PURE__ */ React.createElement(Pressable, { onPress: handlePress, style: styles$9.container }, /* @__PURE__ */ React.createElement(
3370
3371
  TextInput$1,
@@ -3376,7 +3377,7 @@ const CommonTextInput = (props) => {
3376
3377
  autoCorrect: false,
3377
3378
  outlineStyle: {
3378
3379
  ...styles$9.outlineStyle,
3379
- borderColor: errorMessage?.length ? DHRE_DEFAULT.DH_SEMENTIC_ERROR : value?.length ? activeBorderColor : inactiveBorderColor
3380
+ borderColor: errorMessage?.length || onlyErrorBorderLabel ? DHRE_DEFAULT.DH_SEMENTIC_ERROR : value?.length ? activeBorderColor : inactiveBorderColor
3380
3381
  },
3381
3382
  label,
3382
3383
  value,
@@ -3386,12 +3387,12 @@ const CommonTextInput = (props) => {
3386
3387
  theme: {
3387
3388
  colors: {
3388
3389
  onSurfaceVariant: value?.length ? activeBorderColor : inactiveBorderColor,
3389
- error: errorMessage?.length ? DHRE_DEFAULT.DH_SEMENTIC_ERROR : DHRE_COLORS_TEXT.DH_BLACK,
3390
+ error: errorMessage?.length || onlyErrorBorderLabel ? DHRE_DEFAULT.DH_SEMENTIC_ERROR : DHRE_COLORS_TEXT.DH_BLACK,
3390
3391
  primary: labelColor ? errorMessage?.length ? DHRE_DEFAULT.DH_SEMENTIC_ERROR : labelColor : DHRE_COLORS_TEXT.DH_BLACK
3391
3392
  }
3392
3393
  },
3393
3394
  style: [
3394
- errorMessage ? styles$9.errorInput : styles$9.input,
3395
+ errorMessage || onlyErrorBorderLabel ? styles$9.errorInput : styles$9.input,
3395
3396
  inputStyle,
3396
3397
  multiline && styles$9.multilineInput
3397
3398
  // Apply multiline style if true
@@ -3401,7 +3402,7 @@ const CommonTextInput = (props) => {
3401
3402
  placeholder: placeholderText,
3402
3403
  editable,
3403
3404
  pointerEvents,
3404
- error: errorMessage?.length ? true : false,
3405
+ error: errorMessage?.length || onlyErrorBorderLabel ? true : false,
3405
3406
  multiline,
3406
3407
  numberOfLines: multiline ? 4 : 1,
3407
3408
  right: rightIcon ? /* @__PURE__ */ React.createElement(
@@ -3994,8 +3995,7 @@ const OTPInput = React.forwardRef(
3994
3995
  }
3995
3996
  return () => clearInterval(timer);
3996
3997
  }, [timeLeft, isResendOtpEnable]);
3997
- const refs = useRef([]);
3998
- refs.current = Array(length).fill(0).map((_, index) => refs.current[index] || null);
3998
+ const refs = useRef(Array(length).fill(null));
3999
3999
  useEffect(() => {
4000
4000
  enableResendOtp();
4001
4001
  }, []);
@@ -4048,15 +4048,12 @@ const OTPInput = React.forwardRef(
4048
4048
  }
4049
4049
  });
4050
4050
  };
4051
+ const reset = () => {
4052
+ setOTP("");
4053
+ refs?.current?.[0]?.focus();
4054
+ };
4051
4055
  React.useImperativeHandle(ref, () => ({
4052
- reset() {
4053
- setOTP("");
4054
- refs.current[0]?.focus();
4055
- },
4056
- set(newOtp) {
4057
- setOTP(newOtp);
4058
- refs.current[newOtp?.length - 1]?.focus();
4059
- }
4056
+ reset
4060
4057
  }));
4061
4058
  const handleChange = (index, value) => {
4062
4059
  const regex = /^\d+$/;