dhre-ui-kit 0.0.122 → 0.0.123
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 +5 -1
- package/lib/index.js +54 -42
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +54 -42
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -670,6 +670,10 @@ interface IProps$1 {
|
|
|
670
670
|
testId?: string;
|
|
671
671
|
otpContainerStyle?: ViewStyle;
|
|
672
672
|
resendOTP?: () => void;
|
|
673
|
+
otpHeaderTextStyle?: TextStyle;
|
|
674
|
+
textInputStyle?: TextStyle;
|
|
675
|
+
resendTextStyle?: TextStyle;
|
|
676
|
+
resendOtpColor?: string;
|
|
673
677
|
}
|
|
674
678
|
type OTPInputHandle = {
|
|
675
679
|
reset: () => void;
|
|
@@ -688,7 +692,7 @@ interface IProps {
|
|
|
688
692
|
showStepCount?: boolean;
|
|
689
693
|
showStatus?: boolean;
|
|
690
694
|
data: IData[];
|
|
691
|
-
completedStatusIcon
|
|
695
|
+
completedStatusIcon?: React$1.ReactElement;
|
|
692
696
|
}
|
|
693
697
|
|
|
694
698
|
declare const _default$1: (props: IProps) => React$1.JSX.Element;
|
package/lib/index.js
CHANGED
|
@@ -296,10 +296,10 @@ const withThemeProvider = (Component) => {
|
|
|
296
296
|
return (props) => /* @__PURE__ */ React__default["default"].createElement(ThemeProvider, null, /* @__PURE__ */ React__default["default"].createElement(Component, { ...props }));
|
|
297
297
|
};
|
|
298
298
|
|
|
299
|
-
const { width
|
|
299
|
+
const { width, height } = reactNative.Dimensions.get("window");
|
|
300
300
|
const guidelineBaseWidth = 375;
|
|
301
301
|
const guidelineBaseHeight = 812;
|
|
302
|
-
const horizontalScale = (size) => width
|
|
302
|
+
const horizontalScale = (size) => width / guidelineBaseWidth * size;
|
|
303
303
|
const verticalScale = (size) => height / guidelineBaseHeight * size;
|
|
304
304
|
const moderateScale = (size, factor = 0.5) => size + (horizontalScale(size) - size) * factor;
|
|
305
305
|
|
|
@@ -1979,7 +1979,7 @@ const styles$m = reactNative.StyleSheet.create({
|
|
|
1979
1979
|
position: "absolute",
|
|
1980
1980
|
alignSelf: "center",
|
|
1981
1981
|
height: verticalScale(72),
|
|
1982
|
-
width: width
|
|
1982
|
+
width: width - horizontalScale(32),
|
|
1983
1983
|
top: 56,
|
|
1984
1984
|
borderRadius: moderateScale(8),
|
|
1985
1985
|
overflow: "hidden"
|
|
@@ -2089,7 +2089,7 @@ const Toast = React__default["default"].forwardRef(({ sucessIcon, errorIcon }, r
|
|
|
2089
2089
|
Progress__namespace.Bar,
|
|
2090
2090
|
{
|
|
2091
2091
|
progress,
|
|
2092
|
-
width: width
|
|
2092
|
+
width: width - horizontalScale(48),
|
|
2093
2093
|
height: 3,
|
|
2094
2094
|
color: isSuccess ? "#024324" : "#851D41",
|
|
2095
2095
|
borderColor: "transparent"
|
|
@@ -3713,7 +3713,11 @@ const OTPInput = React__default["default"].forwardRef(
|
|
|
3713
3713
|
resendOTP,
|
|
3714
3714
|
errorMessage,
|
|
3715
3715
|
testId = "",
|
|
3716
|
-
otpContainerStyle
|
|
3716
|
+
otpContainerStyle,
|
|
3717
|
+
otpHeaderTextStyle,
|
|
3718
|
+
textInputStyle,
|
|
3719
|
+
resendTextStyle,
|
|
3720
|
+
resendOtpColor
|
|
3717
3721
|
}, ref) => {
|
|
3718
3722
|
const [otp, setOTP] = React.useState("");
|
|
3719
3723
|
const [isResendOtpEnable, setIsResendOtpEnable] = React.useState(false);
|
|
@@ -3728,6 +3732,7 @@ const OTPInput = React__default["default"].forwardRef(
|
|
|
3728
3732
|
setIsResendOtpEnable(false);
|
|
3729
3733
|
enableResendOtp();
|
|
3730
3734
|
resendOTP?.();
|
|
3735
|
+
setOTP("");
|
|
3731
3736
|
};
|
|
3732
3737
|
const enableResendOtp = () => {
|
|
3733
3738
|
setTimeout(() => {
|
|
@@ -3765,14 +3770,15 @@ const OTPInput = React__default["default"].forwardRef(
|
|
|
3765
3770
|
onComplete?.(otp);
|
|
3766
3771
|
}
|
|
3767
3772
|
}, [otp]);
|
|
3768
|
-
return /* @__PURE__ */ React__default["default"].createElement(reactNative.View, { style: { ...otpContainerStyle },
|
|
3773
|
+
return /* @__PURE__ */ React__default["default"].createElement(reactNative.View, { style: { ...otpContainerStyle }, "data-testid": testId }, /* @__PURE__ */ React__default["default"].createElement(
|
|
3769
3774
|
CustomTypography,
|
|
3770
3775
|
{
|
|
3771
3776
|
text: "OTP",
|
|
3772
3777
|
variant: FontStyle.B4_REGULAR,
|
|
3773
3778
|
style: {
|
|
3774
3779
|
color: otp?.length ? theme.CONTENT_PRIMARY : theme.CONTENT_SECONDRY,
|
|
3775
|
-
textAlign: "left"
|
|
3780
|
+
textAlign: "left",
|
|
3781
|
+
...otpHeaderTextStyle
|
|
3776
3782
|
}
|
|
3777
3783
|
}
|
|
3778
3784
|
), /* @__PURE__ */ React__default["default"].createElement(reactNative.View, { style: { ...styles$2.textInputContainer } }, Array.from({ length }).map((_, index) => /* @__PURE__ */ React__default["default"].createElement(
|
|
@@ -3782,7 +3788,8 @@ const OTPInput = React__default["default"].forwardRef(
|
|
|
3782
3788
|
style: {
|
|
3783
3789
|
...styles$2.textInputStyle,
|
|
3784
3790
|
color: theme.CONTENT_PRIMARY,
|
|
3785
|
-
borderColor: errorMessage ? theme.ERROR : otp.length === length ? theme.SUCCESS : activeInput === index ? theme.BORDER_INVERTED : theme.BORDER_PRIMARY
|
|
3791
|
+
borderColor: errorMessage ? theme.ERROR : otp.length === length ? theme.SUCCESS : activeInput === index ? theme.BORDER_INVERTED : theme.BORDER_PRIMARY,
|
|
3792
|
+
...textInputStyle
|
|
3786
3793
|
},
|
|
3787
3794
|
onFocus: () => setActiveInput(index),
|
|
3788
3795
|
onBlur: () => setActiveInput(null),
|
|
@@ -3811,7 +3818,8 @@ const OTPInput = React__default["default"].forwardRef(
|
|
|
3811
3818
|
variant: FontStyle.L2_REGULAR,
|
|
3812
3819
|
style: {
|
|
3813
3820
|
textDecorationLine: "underline",
|
|
3814
|
-
color: isResendOtpEnable ? theme.CONTENT_PRIMARY : theme.CONTENT_DISABLE
|
|
3821
|
+
color: isResendOtpEnable ? resendOtpColor ?? theme.CONTENT_PRIMARY : theme.CONTENT_DISABLE,
|
|
3822
|
+
...resendTextStyle
|
|
3815
3823
|
}
|
|
3816
3824
|
}
|
|
3817
3825
|
))));
|
|
@@ -4016,14 +4024,25 @@ const styles = reactNative.StyleSheet.create({
|
|
|
4016
4024
|
}
|
|
4017
4025
|
});
|
|
4018
4026
|
|
|
4019
|
-
const { width } = reactNative.Dimensions.get("window");
|
|
4020
4027
|
const BUTTON_WIDTH = 40;
|
|
4021
4028
|
const CustomSlideButton = ({
|
|
4022
4029
|
label,
|
|
4023
4030
|
onComplete,
|
|
4024
4031
|
icon
|
|
4025
4032
|
}) => {
|
|
4033
|
+
const value = React.useRef(0);
|
|
4034
|
+
const cardRef = React.useRef(null);
|
|
4026
4035
|
const pan = React.useRef(new reactNative.Animated.Value(0)).current;
|
|
4036
|
+
const handleLayout = (event) => {
|
|
4037
|
+
const { width } = event.nativeEvent.layout;
|
|
4038
|
+
if (cardRef.current) {
|
|
4039
|
+
cardRef.current.setNativeProps({
|
|
4040
|
+
style: { width }
|
|
4041
|
+
// Change the width here
|
|
4042
|
+
});
|
|
4043
|
+
value.current = width;
|
|
4044
|
+
}
|
|
4045
|
+
};
|
|
4027
4046
|
const panResponder = React.useRef(
|
|
4028
4047
|
reactNative.PanResponder.create({
|
|
4029
4048
|
onMoveShouldSetPanResponder: (evt, gestureState) => {
|
|
@@ -4032,15 +4051,15 @@ const CustomSlideButton = ({
|
|
|
4032
4051
|
onPanResponderGrant: () => {
|
|
4033
4052
|
},
|
|
4034
4053
|
onPanResponderMove: (evt, gestureState) => {
|
|
4035
|
-
if (gestureState.dx <
|
|
4054
|
+
if (gestureState.dx < value.current - BUTTON_WIDTH) {
|
|
4036
4055
|
pan.setValue(gestureState.dx);
|
|
4037
4056
|
}
|
|
4038
4057
|
},
|
|
4039
4058
|
onPanResponderRelease: (evt, gestureState) => {
|
|
4040
|
-
if (gestureState.dx >
|
|
4059
|
+
if (gestureState.dx > value.current - BUTTON_WIDTH - 100) {
|
|
4041
4060
|
onComplete && onComplete();
|
|
4042
4061
|
reactNative.Animated.spring(pan, {
|
|
4043
|
-
toValue:
|
|
4062
|
+
toValue: value.current - BUTTON_WIDTH - 10,
|
|
4044
4063
|
useNativeDriver: false
|
|
4045
4064
|
}).start();
|
|
4046
4065
|
} else {
|
|
@@ -4053,43 +4072,36 @@ const CustomSlideButton = ({
|
|
|
4053
4072
|
})
|
|
4054
4073
|
).current;
|
|
4055
4074
|
const { theme } = useTheme();
|
|
4056
|
-
return /* @__PURE__ */ React__default["default"].createElement(
|
|
4057
|
-
|
|
4075
|
+
return /* @__PURE__ */ React__default["default"].createElement(reactNative.View, { style: {
|
|
4076
|
+
...styles.sliderContainer,
|
|
4077
|
+
backgroundColor: theme.SURFACE_INVERTED
|
|
4078
|
+
}, onLayout: handleLayout, ref: cardRef }, /* @__PURE__ */ React__default["default"].createElement(reactNative.View, { style: styles.buttonTextCOntainer }, /* @__PURE__ */ React__default["default"].createElement(
|
|
4079
|
+
CustomTypography,
|
|
4058
4080
|
{
|
|
4081
|
+
text: label,
|
|
4082
|
+
variant: FontStyle.L1_REGULAR,
|
|
4059
4083
|
style: {
|
|
4060
|
-
|
|
4061
|
-
backgroundColor: theme.SURFACE_INVERTED
|
|
4084
|
+
color: theme.CONTENT_INVERTED
|
|
4062
4085
|
}
|
|
4086
|
+
}
|
|
4087
|
+
)), /* @__PURE__ */ React__default["default"].createElement(
|
|
4088
|
+
reactNative.Animated.View,
|
|
4089
|
+
{
|
|
4090
|
+
style: [styles.slider, { transform: [{ translateX: pan }] }],
|
|
4091
|
+
...panResponder.panHandlers
|
|
4063
4092
|
},
|
|
4064
|
-
/* @__PURE__ */ React__default["default"].createElement(
|
|
4065
|
-
|
|
4093
|
+
/* @__PURE__ */ React__default["default"].createElement(
|
|
4094
|
+
reactNative.View,
|
|
4066
4095
|
{
|
|
4067
|
-
text: label,
|
|
4068
|
-
variant: FontStyle.L1_REGULAR,
|
|
4069
4096
|
style: {
|
|
4070
|
-
|
|
4097
|
+
...styles.button,
|
|
4098
|
+
backgroundColor: theme.SURFACE_PRIMARY,
|
|
4099
|
+
width: BUTTON_WIDTH
|
|
4071
4100
|
}
|
|
4072
|
-
}
|
|
4073
|
-
)),
|
|
4074
|
-
/* @__PURE__ */ React__default["default"].createElement(
|
|
4075
|
-
reactNative.Animated.View,
|
|
4076
|
-
{
|
|
4077
|
-
style: [styles.slider, { transform: [{ translateX: pan }] }],
|
|
4078
|
-
...panResponder.panHandlers
|
|
4079
4101
|
},
|
|
4080
|
-
|
|
4081
|
-
reactNative.View,
|
|
4082
|
-
{
|
|
4083
|
-
style: {
|
|
4084
|
-
...styles.button,
|
|
4085
|
-
backgroundColor: theme.SURFACE_PRIMARY,
|
|
4086
|
-
width: BUTTON_WIDTH
|
|
4087
|
-
}
|
|
4088
|
-
},
|
|
4089
|
-
icon
|
|
4090
|
-
)
|
|
4102
|
+
icon
|
|
4091
4103
|
)
|
|
4092
|
-
);
|
|
4104
|
+
));
|
|
4093
4105
|
};
|
|
4094
4106
|
var index = withThemeProvider(CustomSlideButton);
|
|
4095
4107
|
|
|
@@ -4159,5 +4171,5 @@ exports.horizontalScale = horizontalScale;
|
|
|
4159
4171
|
exports.moderateScale = moderateScale;
|
|
4160
4172
|
exports.toastService = toastService;
|
|
4161
4173
|
exports.verticalScale = verticalScale;
|
|
4162
|
-
exports.width = width
|
|
4174
|
+
exports.width = width;
|
|
4163
4175
|
//# sourceMappingURL=index.js.map
|