dhre-ui-kit 0.0.205 → 0.0.207
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 +119 -108
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +119 -108
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
package/lib/index.mjs
CHANGED
|
@@ -3917,6 +3917,9 @@ const OTPInput = React.forwardRef(
|
|
|
3917
3917
|
const otpRegex = new RegExp(`(\\d{${length}})`, "g");
|
|
3918
3918
|
const otp2 = otpRegex.exec(message)?.[1];
|
|
3919
3919
|
setOTP(otp2 ?? "");
|
|
3920
|
+
if (otp2) {
|
|
3921
|
+
refs.current[otp2?.length - 1]?.focus();
|
|
3922
|
+
}
|
|
3920
3923
|
});
|
|
3921
3924
|
};
|
|
3922
3925
|
React.useImperativeHandle(ref, () => ({
|
|
@@ -3934,14 +3937,12 @@ const OTPInput = React.forwardRef(
|
|
|
3934
3937
|
if (value.length === 1 && regex.test(value) && index >= 0 && index < length) {
|
|
3935
3938
|
const newOTP = `${otp}${value}`;
|
|
3936
3939
|
setOTP(newOTP);
|
|
3937
|
-
|
|
3938
|
-
refs.current[index + 1]?.focus();
|
|
3939
|
-
}
|
|
3940
|
+
refs.current[index + 1]?.focus();
|
|
3940
3941
|
} else if (value.length === 0 && index > 0) {
|
|
3941
3942
|
const newOTP = otp.slice(0, -1);
|
|
3942
3943
|
setOTP(newOTP);
|
|
3943
3944
|
refs.current[index - 1]?.focus();
|
|
3944
|
-
} else if (value
|
|
3945
|
+
} else if (value?.length === length) {
|
|
3945
3946
|
setOTP(value);
|
|
3946
3947
|
refs.current[length - 1]?.focus();
|
|
3947
3948
|
} else {
|
|
@@ -4228,116 +4229,126 @@ const styles$3 = StyleSheet.create({
|
|
|
4228
4229
|
});
|
|
4229
4230
|
|
|
4230
4231
|
const BUTTON_WIDTH = 40;
|
|
4231
|
-
const CustomSlideButton = (
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
value.current = width;
|
|
4257
|
-
}
|
|
4258
|
-
};
|
|
4259
|
-
const panResponder = useRef(
|
|
4260
|
-
PanResponder.create({
|
|
4261
|
-
onMoveShouldSetPanResponder: (evt, gestureState) => {
|
|
4262
|
-
return gestureState.dx > 0;
|
|
4263
|
-
},
|
|
4264
|
-
onPanResponderGrant: () => {
|
|
4265
|
-
},
|
|
4266
|
-
onPanResponderMove: (evt, gestureState) => {
|
|
4267
|
-
if (gestureState.dx < value.current - BUTTON_WIDTH) {
|
|
4268
|
-
pan.setValue(gestureState.dx);
|
|
4269
|
-
slideTailCardRef?.current?.setNativeProps({
|
|
4270
|
-
style: { width: gestureState.dx + BUTTON_WIDTH / 2 }
|
|
4271
|
-
});
|
|
4272
|
-
}
|
|
4273
|
-
},
|
|
4274
|
-
onPanResponderRelease: (evt, gestureState) => {
|
|
4275
|
-
if (gestureState.dx > value.current - BUTTON_WIDTH - 100) {
|
|
4276
|
-
onComplete && onComplete();
|
|
4277
|
-
Animated.spring(pan, {
|
|
4278
|
-
toValue: value.current - BUTTON_WIDTH - 10,
|
|
4279
|
-
useNativeDriver: false
|
|
4280
|
-
}).start();
|
|
4281
|
-
slideTailCardRef?.current?.setNativeProps({
|
|
4282
|
-
style: { width: value.current + BUTTON_WIDTH }
|
|
4283
|
-
// Change the width here
|
|
4284
|
-
});
|
|
4285
|
-
} else {
|
|
4286
|
-
Animated.spring(pan, {
|
|
4287
|
-
toValue: 0,
|
|
4288
|
-
useNativeDriver: false
|
|
4289
|
-
}).start();
|
|
4290
|
-
slideTailCardRef?.current?.setNativeProps({
|
|
4291
|
-
style: { width: 0 }
|
|
4292
|
-
});
|
|
4293
|
-
}
|
|
4232
|
+
const CustomSlideButton = React.forwardRef(
|
|
4233
|
+
({
|
|
4234
|
+
label,
|
|
4235
|
+
onComplete,
|
|
4236
|
+
icon,
|
|
4237
|
+
textStyle,
|
|
4238
|
+
containerStyle,
|
|
4239
|
+
sliderStyle,
|
|
4240
|
+
size = BUTTON_WIDTH,
|
|
4241
|
+
slideButtonTail,
|
|
4242
|
+
slideButtonTailColor = "#fff"
|
|
4243
|
+
}, ref) => {
|
|
4244
|
+
const value = useRef(0);
|
|
4245
|
+
const cardRef = useRef(null);
|
|
4246
|
+
const pan = useRef(new Animated.Value(0)).current;
|
|
4247
|
+
const slideTailCardRef = useRef(null);
|
|
4248
|
+
slideTailCardRef?.current?.setNativeProps({
|
|
4249
|
+
style: { width: 0 }
|
|
4250
|
+
});
|
|
4251
|
+
React.useImperativeHandle(ref, () => ({
|
|
4252
|
+
reset() {
|
|
4253
|
+
Animated.spring(pan, {
|
|
4254
|
+
toValue: 0,
|
|
4255
|
+
useNativeDriver: false
|
|
4256
|
+
}).start();
|
|
4294
4257
|
}
|
|
4295
|
-
})
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
{
|
|
4305
|
-
ref: slideTailCardRef,
|
|
4306
|
-
style: [{ height: "100%", backgroundColor: slideButtonTailColor }]
|
|
4307
|
-
}
|
|
4308
|
-
), /* @__PURE__ */ React.createElement(View, { style: styles$3.buttonTextContainer }, /* @__PURE__ */ React.createElement(
|
|
4309
|
-
CustomTypography,
|
|
4310
|
-
{
|
|
4311
|
-
text: label,
|
|
4312
|
-
variant: FontStyle.L1_REGULAR,
|
|
4313
|
-
style: {
|
|
4314
|
-
color: theme.CONTENT_INVERTED,
|
|
4315
|
-
alignSelf: "center",
|
|
4316
|
-
...textStyle
|
|
4258
|
+
}));
|
|
4259
|
+
const handleLayout = (event) => {
|
|
4260
|
+
const { width } = event.nativeEvent.layout;
|
|
4261
|
+
if (cardRef.current) {
|
|
4262
|
+
cardRef.current.setNativeProps({
|
|
4263
|
+
style: { width }
|
|
4264
|
+
// Change the width here
|
|
4265
|
+
});
|
|
4266
|
+
value.current = width;
|
|
4317
4267
|
}
|
|
4318
|
-
}
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4268
|
+
};
|
|
4269
|
+
const panResponder = useRef(
|
|
4270
|
+
PanResponder.create({
|
|
4271
|
+
onMoveShouldSetPanResponder: (evt, gestureState) => {
|
|
4272
|
+
return gestureState.dx > 0;
|
|
4273
|
+
},
|
|
4274
|
+
onPanResponderGrant: () => {
|
|
4275
|
+
},
|
|
4276
|
+
onPanResponderMove: (evt, gestureState) => {
|
|
4277
|
+
if (gestureState.dx < value.current - BUTTON_WIDTH) {
|
|
4278
|
+
pan.setValue(gestureState.dx);
|
|
4279
|
+
slideTailCardRef?.current?.setNativeProps({
|
|
4280
|
+
style: { width: gestureState.dx + BUTTON_WIDTH / 2 }
|
|
4281
|
+
});
|
|
4282
|
+
}
|
|
4283
|
+
},
|
|
4284
|
+
onPanResponderRelease: (evt, gestureState) => {
|
|
4285
|
+
if (gestureState.dx > value.current - BUTTON_WIDTH - 100) {
|
|
4286
|
+
onComplete && onComplete();
|
|
4287
|
+
Animated.spring(pan, {
|
|
4288
|
+
toValue: value.current - BUTTON_WIDTH - 10,
|
|
4289
|
+
useNativeDriver: false
|
|
4290
|
+
}).start();
|
|
4291
|
+
slideTailCardRef?.current?.setNativeProps({
|
|
4292
|
+
style: { width: value.current + BUTTON_WIDTH }
|
|
4293
|
+
// Change the width here
|
|
4294
|
+
});
|
|
4295
|
+
} else {
|
|
4296
|
+
Animated.spring(pan, {
|
|
4297
|
+
toValue: 0,
|
|
4298
|
+
useNativeDriver: false
|
|
4299
|
+
}).start();
|
|
4300
|
+
slideTailCardRef?.current?.setNativeProps({
|
|
4301
|
+
style: { width: 0 }
|
|
4302
|
+
});
|
|
4303
|
+
}
|
|
4304
|
+
}
|
|
4305
|
+
})
|
|
4306
|
+
).current;
|
|
4307
|
+
const { theme } = useTheme();
|
|
4308
|
+
return /* @__PURE__ */ React.createElement(View, { style: {
|
|
4309
|
+
...styles$3.sliderContainer,
|
|
4310
|
+
backgroundColor: theme.SURFACE_INVERTED,
|
|
4311
|
+
...containerStyle
|
|
4312
|
+
}, onLayout: handleLayout, ref: cardRef }, slideButtonTail && /* @__PURE__ */ React.createElement(
|
|
4313
|
+
Animated.View,
|
|
4327
4314
|
{
|
|
4315
|
+
ref: slideTailCardRef,
|
|
4316
|
+
style: [{ height: "100%", backgroundColor: slideButtonTailColor }]
|
|
4317
|
+
}
|
|
4318
|
+
), /* @__PURE__ */ React.createElement(View, { style: styles$3.buttonTextContainer }, /* @__PURE__ */ React.createElement(
|
|
4319
|
+
CustomTypography,
|
|
4320
|
+
{
|
|
4321
|
+
text: label,
|
|
4322
|
+
variant: FontStyle.L1_REGULAR,
|
|
4328
4323
|
style: {
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
height: verticalScale(size),
|
|
4333
|
-
borderRadius: verticalScale(size / 2),
|
|
4334
|
-
...sliderStyle
|
|
4324
|
+
color: theme.CONTENT_INVERTED,
|
|
4325
|
+
alignSelf: "center",
|
|
4326
|
+
...textStyle
|
|
4335
4327
|
}
|
|
4328
|
+
}
|
|
4329
|
+
)), /* @__PURE__ */ React.createElement(
|
|
4330
|
+
Animated.View,
|
|
4331
|
+
{
|
|
4332
|
+
style: [styles$3.slider, { transform: [{ translateX: pan }] }],
|
|
4333
|
+
...panResponder.panHandlers
|
|
4336
4334
|
},
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4335
|
+
/* @__PURE__ */ React.createElement(
|
|
4336
|
+
View,
|
|
4337
|
+
{
|
|
4338
|
+
style: {
|
|
4339
|
+
...styles$3.button,
|
|
4340
|
+
backgroundColor: theme.SURFACE_PRIMARY,
|
|
4341
|
+
width: verticalScale(size),
|
|
4342
|
+
height: verticalScale(size),
|
|
4343
|
+
borderRadius: verticalScale(size / 2),
|
|
4344
|
+
...sliderStyle
|
|
4345
|
+
}
|
|
4346
|
+
},
|
|
4347
|
+
icon
|
|
4348
|
+
)
|
|
4349
|
+
));
|
|
4350
|
+
}
|
|
4351
|
+
);
|
|
4341
4352
|
var index$2 = withThemeProvider(CustomSlideButton);
|
|
4342
4353
|
|
|
4343
4354
|
const copyToClipboard = (textToCopy) => {
|