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 +4 -1
- package/lib/index.js +35 -2
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +35 -2
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
package/lib/index.mjs
CHANGED
|
@@ -3885,6 +3885,11 @@ const OTPInput = React.forwardRef(
|
|
|
3885
3885
|
React.useImperativeHandle(ref, () => ({
|
|
3886
3886
|
reset() {
|
|
3887
3887
|
setOTP("");
|
|
3888
|
+
refs.current[0]?.focus();
|
|
3889
|
+
},
|
|
3890
|
+
set(newOtp) {
|
|
3891
|
+
setOTP(newOtp);
|
|
3892
|
+
refs.current[newOtp?.length - 1]?.focus();
|
|
3888
3893
|
}
|
|
3889
3894
|
}));
|
|
3890
3895
|
const handleChange = (index, value) => {
|
|
@@ -3897,6 +3902,9 @@ const OTPInput = React.forwardRef(
|
|
|
3897
3902
|
const newOTP = otp.slice(0, -1);
|
|
3898
3903
|
setOTP(newOTP);
|
|
3899
3904
|
refs.current[index - 1]?.focus();
|
|
3905
|
+
} else if (value?.length === length) {
|
|
3906
|
+
setOTP(value);
|
|
3907
|
+
refs.current[length - 1]?.focus();
|
|
3900
3908
|
} else {
|
|
3901
3909
|
const newOTP = otp.slice(0, -1);
|
|
3902
3910
|
setOTP(newOTP);
|
|
@@ -3943,6 +3951,9 @@ const OTPInput = React.forwardRef(
|
|
|
3943
3951
|
keyboardType: "numeric",
|
|
3944
3952
|
ref: (el) => refs.current[index] = el,
|
|
3945
3953
|
returnKeyType: otp.length === length ? "done" : "next",
|
|
3954
|
+
importantForAutofill: "yes",
|
|
3955
|
+
textContentType: "oneTimeCode",
|
|
3956
|
+
autoComplete: "sms-otp",
|
|
3946
3957
|
selectionColor: theme$1.CONTENT_PRIMARY
|
|
3947
3958
|
}
|
|
3948
3959
|
))), /* @__PURE__ */ React.createElement(
|
|
@@ -4185,11 +4196,17 @@ const CustomSlideButton = ({
|
|
|
4185
4196
|
textStyle,
|
|
4186
4197
|
containerStyle,
|
|
4187
4198
|
sliderStyle,
|
|
4188
|
-
size = BUTTON_WIDTH
|
|
4199
|
+
size = BUTTON_WIDTH,
|
|
4200
|
+
slideButtonTail,
|
|
4201
|
+
slideButtonTailColor = "#fff"
|
|
4189
4202
|
}) => {
|
|
4190
4203
|
const value = useRef(0);
|
|
4191
4204
|
const cardRef = useRef(null);
|
|
4192
4205
|
const pan = useRef(new Animated.Value(0)).current;
|
|
4206
|
+
const slideTailCardRef = useRef(null);
|
|
4207
|
+
slideTailCardRef?.current?.setNativeProps({
|
|
4208
|
+
style: { width: 0 }
|
|
4209
|
+
});
|
|
4193
4210
|
const handleLayout = (event) => {
|
|
4194
4211
|
const { width } = event.nativeEvent.layout;
|
|
4195
4212
|
if (cardRef.current) {
|
|
@@ -4210,6 +4227,9 @@ const CustomSlideButton = ({
|
|
|
4210
4227
|
onPanResponderMove: (evt, gestureState) => {
|
|
4211
4228
|
if (gestureState.dx < value.current - BUTTON_WIDTH) {
|
|
4212
4229
|
pan.setValue(gestureState.dx);
|
|
4230
|
+
slideTailCardRef?.current?.setNativeProps({
|
|
4231
|
+
style: { width: gestureState.dx + BUTTON_WIDTH / 2 }
|
|
4232
|
+
});
|
|
4213
4233
|
}
|
|
4214
4234
|
},
|
|
4215
4235
|
onPanResponderRelease: (evt, gestureState) => {
|
|
@@ -4219,11 +4239,18 @@ const CustomSlideButton = ({
|
|
|
4219
4239
|
toValue: value.current - BUTTON_WIDTH - 10,
|
|
4220
4240
|
useNativeDriver: false
|
|
4221
4241
|
}).start();
|
|
4242
|
+
slideTailCardRef?.current?.setNativeProps({
|
|
4243
|
+
style: { width: value.current + BUTTON_WIDTH }
|
|
4244
|
+
// Change the width here
|
|
4245
|
+
});
|
|
4222
4246
|
} else {
|
|
4223
4247
|
Animated.spring(pan, {
|
|
4224
4248
|
toValue: 0,
|
|
4225
4249
|
useNativeDriver: false
|
|
4226
4250
|
}).start();
|
|
4251
|
+
slideTailCardRef?.current?.setNativeProps({
|
|
4252
|
+
style: { width: 0 }
|
|
4253
|
+
});
|
|
4227
4254
|
}
|
|
4228
4255
|
}
|
|
4229
4256
|
})
|
|
@@ -4233,7 +4260,13 @@ const CustomSlideButton = ({
|
|
|
4233
4260
|
...styles$2.sliderContainer,
|
|
4234
4261
|
backgroundColor: theme.SURFACE_INVERTED,
|
|
4235
4262
|
...containerStyle
|
|
4236
|
-
}, onLayout: handleLayout, ref: cardRef },
|
|
4263
|
+
}, onLayout: handleLayout, ref: cardRef }, slideButtonTail && /* @__PURE__ */ React.createElement(
|
|
4264
|
+
Animated.View,
|
|
4265
|
+
{
|
|
4266
|
+
ref: slideTailCardRef,
|
|
4267
|
+
style: [{ height: "100%", backgroundColor: slideButtonTailColor }]
|
|
4268
|
+
}
|
|
4269
|
+
), /* @__PURE__ */ React.createElement(View, { style: styles$2.buttonTextContainer }, /* @__PURE__ */ React.createElement(
|
|
4237
4270
|
CustomTypography,
|
|
4238
4271
|
{
|
|
4239
4272
|
text: label,
|