dhre-ui-kit 0.0.191 → 0.0.192

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
@@ -706,7 +706,8 @@ interface IProps$1 {
706
706
  mode?: 'light' | 'dark';
707
707
  }
708
708
  type OTPInputHandle = {
709
- reset: () => void;
709
+ reset?: () => void;
710
+ set?: (newOtp: string) => void;
710
711
  };
711
712
 
712
713
  declare const _default$4: (props: IProps$1 & React$1.RefAttributes<OTPInputHandle>) => React$1.JSX.Element;
@@ -735,6 +736,8 @@ interface CustomSlideButtonProps {
735
736
  textStyle?: TextStyle;
736
737
  containerStyle?: ViewStyle;
737
738
  sliderStyle?: ViewStyle;
739
+ slideButtonTail?: boolean;
740
+ slideButtonTailColor?: string;
738
741
  }
739
742
 
740
743
  declare const _default$2: (props: CustomSlideButtonProps) => React$1.JSX.Element;
package/lib/index.js CHANGED
@@ -3918,6 +3918,11 @@ const OTPInput = React__default["default"].forwardRef(
3918
3918
  React__default["default"].useImperativeHandle(ref, () => ({
3919
3919
  reset() {
3920
3920
  setOTP("");
3921
+ refs.current[0]?.focus();
3922
+ },
3923
+ set(newOtp) {
3924
+ setOTP(newOtp);
3925
+ refs.current[newOtp?.length - 1]?.focus();
3921
3926
  }
3922
3927
  }));
3923
3928
  const handleChange = (index, value) => {
@@ -3930,6 +3935,9 @@ const OTPInput = React__default["default"].forwardRef(
3930
3935
  const newOTP = otp.slice(0, -1);
3931
3936
  setOTP(newOTP);
3932
3937
  refs.current[index - 1]?.focus();
3938
+ } else if (value?.length === length) {
3939
+ setOTP(value);
3940
+ refs.current[length - 1]?.focus();
3933
3941
  } else {
3934
3942
  const newOTP = otp.slice(0, -1);
3935
3943
  setOTP(newOTP);
@@ -3976,6 +3984,9 @@ const OTPInput = React__default["default"].forwardRef(
3976
3984
  keyboardType: "numeric",
3977
3985
  ref: (el) => refs.current[index] = el,
3978
3986
  returnKeyType: otp.length === length ? "done" : "next",
3987
+ importantForAutofill: "yes",
3988
+ textContentType: "oneTimeCode",
3989
+ autoComplete: "sms-otp",
3979
3990
  selectionColor: theme$1.CONTENT_PRIMARY
3980
3991
  }
3981
3992
  ))), /* @__PURE__ */ React__default["default"].createElement(
@@ -4218,11 +4229,17 @@ const CustomSlideButton = ({
4218
4229
  textStyle,
4219
4230
  containerStyle,
4220
4231
  sliderStyle,
4221
- size = BUTTON_WIDTH
4232
+ size = BUTTON_WIDTH,
4233
+ slideButtonTail,
4234
+ slideButtonTailColor = "#fff"
4222
4235
  }) => {
4223
4236
  const value = React.useRef(0);
4224
4237
  const cardRef = React.useRef(null);
4225
4238
  const pan = React.useRef(new reactNative.Animated.Value(0)).current;
4239
+ const slideTailCardRef = React.useRef(null);
4240
+ slideTailCardRef?.current?.setNativeProps({
4241
+ style: { width: 0 }
4242
+ });
4226
4243
  const handleLayout = (event) => {
4227
4244
  const { width } = event.nativeEvent.layout;
4228
4245
  if (cardRef.current) {
@@ -4243,6 +4260,9 @@ const CustomSlideButton = ({
4243
4260
  onPanResponderMove: (evt, gestureState) => {
4244
4261
  if (gestureState.dx < value.current - BUTTON_WIDTH) {
4245
4262
  pan.setValue(gestureState.dx);
4263
+ slideTailCardRef?.current?.setNativeProps({
4264
+ style: { width: gestureState.dx + BUTTON_WIDTH / 2 }
4265
+ });
4246
4266
  }
4247
4267
  },
4248
4268
  onPanResponderRelease: (evt, gestureState) => {
@@ -4252,11 +4272,18 @@ const CustomSlideButton = ({
4252
4272
  toValue: value.current - BUTTON_WIDTH - 10,
4253
4273
  useNativeDriver: false
4254
4274
  }).start();
4275
+ slideTailCardRef?.current?.setNativeProps({
4276
+ style: { width: value.current + BUTTON_WIDTH }
4277
+ // Change the width here
4278
+ });
4255
4279
  } else {
4256
4280
  reactNative.Animated.spring(pan, {
4257
4281
  toValue: 0,
4258
4282
  useNativeDriver: false
4259
4283
  }).start();
4284
+ slideTailCardRef?.current?.setNativeProps({
4285
+ style: { width: 0 }
4286
+ });
4260
4287
  }
4261
4288
  }
4262
4289
  })
@@ -4266,7 +4293,13 @@ const CustomSlideButton = ({
4266
4293
  ...styles$2.sliderContainer,
4267
4294
  backgroundColor: theme.SURFACE_INVERTED,
4268
4295
  ...containerStyle
4269
- }, onLayout: handleLayout, ref: cardRef }, /* @__PURE__ */ React__default["default"].createElement(reactNative.View, { style: styles$2.buttonTextContainer }, /* @__PURE__ */ React__default["default"].createElement(
4296
+ }, onLayout: handleLayout, ref: cardRef }, slideButtonTail && /* @__PURE__ */ React__default["default"].createElement(
4297
+ reactNative.Animated.View,
4298
+ {
4299
+ ref: slideTailCardRef,
4300
+ style: [{ height: "100%", backgroundColor: slideButtonTailColor }]
4301
+ }
4302
+ ), /* @__PURE__ */ React__default["default"].createElement(reactNative.View, { style: styles$2.buttonTextContainer }, /* @__PURE__ */ React__default["default"].createElement(
4270
4303
  CustomTypography,
4271
4304
  {
4272
4305
  text: label,