dhre-ui-kit 0.0.206 → 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 +117 -104
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +117 -104
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -741,8 +741,11 @@ interface CustomSlideButtonProps {
|
|
|
741
741
|
slideButtonTail?: boolean;
|
|
742
742
|
slideButtonTailColor?: string;
|
|
743
743
|
}
|
|
744
|
+
type SlideButtonHandle = {
|
|
745
|
+
reset?: () => void;
|
|
746
|
+
};
|
|
744
747
|
|
|
745
|
-
declare const _default$2: (props: CustomSlideButtonProps) => React$1.JSX.Element;
|
|
748
|
+
declare const _default$2: (props: CustomSlideButtonProps & React$1.RefAttributes<SlideButtonHandle>) => React$1.JSX.Element;
|
|
746
749
|
|
|
747
750
|
declare const width: number;
|
|
748
751
|
declare const height: number;
|
package/lib/index.js
CHANGED
|
@@ -3951,6 +3951,9 @@ const OTPInput = React__default["default"].forwardRef(
|
|
|
3951
3951
|
const otpRegex = new RegExp(`(\\d{${length}})`, "g");
|
|
3952
3952
|
const otp2 = otpRegex.exec(message)?.[1];
|
|
3953
3953
|
setOTP(otp2 ?? "");
|
|
3954
|
+
if (otp2) {
|
|
3955
|
+
refs.current[otp2?.length - 1]?.focus();
|
|
3956
|
+
}
|
|
3954
3957
|
});
|
|
3955
3958
|
};
|
|
3956
3959
|
React__default["default"].useImperativeHandle(ref, () => ({
|
|
@@ -4260,116 +4263,126 @@ const styles$3 = reactNative.StyleSheet.create({
|
|
|
4260
4263
|
});
|
|
4261
4264
|
|
|
4262
4265
|
const BUTTON_WIDTH = 40;
|
|
4263
|
-
const CustomSlideButton = (
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
value.current = width;
|
|
4289
|
-
}
|
|
4290
|
-
};
|
|
4291
|
-
const panResponder = React.useRef(
|
|
4292
|
-
reactNative.PanResponder.create({
|
|
4293
|
-
onMoveShouldSetPanResponder: (evt, gestureState) => {
|
|
4294
|
-
return gestureState.dx > 0;
|
|
4295
|
-
},
|
|
4296
|
-
onPanResponderGrant: () => {
|
|
4297
|
-
},
|
|
4298
|
-
onPanResponderMove: (evt, gestureState) => {
|
|
4299
|
-
if (gestureState.dx < value.current - BUTTON_WIDTH) {
|
|
4300
|
-
pan.setValue(gestureState.dx);
|
|
4301
|
-
slideTailCardRef?.current?.setNativeProps({
|
|
4302
|
-
style: { width: gestureState.dx + BUTTON_WIDTH / 2 }
|
|
4303
|
-
});
|
|
4304
|
-
}
|
|
4305
|
-
},
|
|
4306
|
-
onPanResponderRelease: (evt, gestureState) => {
|
|
4307
|
-
if (gestureState.dx > value.current - BUTTON_WIDTH - 100) {
|
|
4308
|
-
onComplete && onComplete();
|
|
4309
|
-
reactNative.Animated.spring(pan, {
|
|
4310
|
-
toValue: value.current - BUTTON_WIDTH - 10,
|
|
4311
|
-
useNativeDriver: false
|
|
4312
|
-
}).start();
|
|
4313
|
-
slideTailCardRef?.current?.setNativeProps({
|
|
4314
|
-
style: { width: value.current + BUTTON_WIDTH }
|
|
4315
|
-
// Change the width here
|
|
4316
|
-
});
|
|
4317
|
-
} else {
|
|
4318
|
-
reactNative.Animated.spring(pan, {
|
|
4319
|
-
toValue: 0,
|
|
4320
|
-
useNativeDriver: false
|
|
4321
|
-
}).start();
|
|
4322
|
-
slideTailCardRef?.current?.setNativeProps({
|
|
4323
|
-
style: { width: 0 }
|
|
4324
|
-
});
|
|
4325
|
-
}
|
|
4266
|
+
const CustomSlideButton = React__default["default"].forwardRef(
|
|
4267
|
+
({
|
|
4268
|
+
label,
|
|
4269
|
+
onComplete,
|
|
4270
|
+
icon,
|
|
4271
|
+
textStyle,
|
|
4272
|
+
containerStyle,
|
|
4273
|
+
sliderStyle,
|
|
4274
|
+
size = BUTTON_WIDTH,
|
|
4275
|
+
slideButtonTail,
|
|
4276
|
+
slideButtonTailColor = "#fff"
|
|
4277
|
+
}, ref) => {
|
|
4278
|
+
const value = React.useRef(0);
|
|
4279
|
+
const cardRef = React.useRef(null);
|
|
4280
|
+
const pan = React.useRef(new reactNative.Animated.Value(0)).current;
|
|
4281
|
+
const slideTailCardRef = React.useRef(null);
|
|
4282
|
+
slideTailCardRef?.current?.setNativeProps({
|
|
4283
|
+
style: { width: 0 }
|
|
4284
|
+
});
|
|
4285
|
+
React__default["default"].useImperativeHandle(ref, () => ({
|
|
4286
|
+
reset() {
|
|
4287
|
+
reactNative.Animated.spring(pan, {
|
|
4288
|
+
toValue: 0,
|
|
4289
|
+
useNativeDriver: false
|
|
4290
|
+
}).start();
|
|
4326
4291
|
}
|
|
4327
|
-
})
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
{
|
|
4337
|
-
ref: slideTailCardRef,
|
|
4338
|
-
style: [{ height: "100%", backgroundColor: slideButtonTailColor }]
|
|
4339
|
-
}
|
|
4340
|
-
), /* @__PURE__ */ React__default["default"].createElement(reactNative.View, { style: styles$3.buttonTextContainer }, /* @__PURE__ */ React__default["default"].createElement(
|
|
4341
|
-
CustomTypography,
|
|
4342
|
-
{
|
|
4343
|
-
text: label,
|
|
4344
|
-
variant: FontStyle.L1_REGULAR,
|
|
4345
|
-
style: {
|
|
4346
|
-
color: theme.CONTENT_INVERTED,
|
|
4347
|
-
alignSelf: "center",
|
|
4348
|
-
...textStyle
|
|
4292
|
+
}));
|
|
4293
|
+
const handleLayout = (event) => {
|
|
4294
|
+
const { width } = event.nativeEvent.layout;
|
|
4295
|
+
if (cardRef.current) {
|
|
4296
|
+
cardRef.current.setNativeProps({
|
|
4297
|
+
style: { width }
|
|
4298
|
+
// Change the width here
|
|
4299
|
+
});
|
|
4300
|
+
value.current = width;
|
|
4349
4301
|
}
|
|
4350
|
-
}
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4302
|
+
};
|
|
4303
|
+
const panResponder = React.useRef(
|
|
4304
|
+
reactNative.PanResponder.create({
|
|
4305
|
+
onMoveShouldSetPanResponder: (evt, gestureState) => {
|
|
4306
|
+
return gestureState.dx > 0;
|
|
4307
|
+
},
|
|
4308
|
+
onPanResponderGrant: () => {
|
|
4309
|
+
},
|
|
4310
|
+
onPanResponderMove: (evt, gestureState) => {
|
|
4311
|
+
if (gestureState.dx < value.current - BUTTON_WIDTH) {
|
|
4312
|
+
pan.setValue(gestureState.dx);
|
|
4313
|
+
slideTailCardRef?.current?.setNativeProps({
|
|
4314
|
+
style: { width: gestureState.dx + BUTTON_WIDTH / 2 }
|
|
4315
|
+
});
|
|
4316
|
+
}
|
|
4317
|
+
},
|
|
4318
|
+
onPanResponderRelease: (evt, gestureState) => {
|
|
4319
|
+
if (gestureState.dx > value.current - BUTTON_WIDTH - 100) {
|
|
4320
|
+
onComplete && onComplete();
|
|
4321
|
+
reactNative.Animated.spring(pan, {
|
|
4322
|
+
toValue: value.current - BUTTON_WIDTH - 10,
|
|
4323
|
+
useNativeDriver: false
|
|
4324
|
+
}).start();
|
|
4325
|
+
slideTailCardRef?.current?.setNativeProps({
|
|
4326
|
+
style: { width: value.current + BUTTON_WIDTH }
|
|
4327
|
+
// Change the width here
|
|
4328
|
+
});
|
|
4329
|
+
} else {
|
|
4330
|
+
reactNative.Animated.spring(pan, {
|
|
4331
|
+
toValue: 0,
|
|
4332
|
+
useNativeDriver: false
|
|
4333
|
+
}).start();
|
|
4334
|
+
slideTailCardRef?.current?.setNativeProps({
|
|
4335
|
+
style: { width: 0 }
|
|
4336
|
+
});
|
|
4337
|
+
}
|
|
4338
|
+
}
|
|
4339
|
+
})
|
|
4340
|
+
).current;
|
|
4341
|
+
const { theme } = useTheme();
|
|
4342
|
+
return /* @__PURE__ */ React__default["default"].createElement(reactNative.View, { style: {
|
|
4343
|
+
...styles$3.sliderContainer,
|
|
4344
|
+
backgroundColor: theme.SURFACE_INVERTED,
|
|
4345
|
+
...containerStyle
|
|
4346
|
+
}, onLayout: handleLayout, ref: cardRef }, slideButtonTail && /* @__PURE__ */ React__default["default"].createElement(
|
|
4347
|
+
reactNative.Animated.View,
|
|
4359
4348
|
{
|
|
4349
|
+
ref: slideTailCardRef,
|
|
4350
|
+
style: [{ height: "100%", backgroundColor: slideButtonTailColor }]
|
|
4351
|
+
}
|
|
4352
|
+
), /* @__PURE__ */ React__default["default"].createElement(reactNative.View, { style: styles$3.buttonTextContainer }, /* @__PURE__ */ React__default["default"].createElement(
|
|
4353
|
+
CustomTypography,
|
|
4354
|
+
{
|
|
4355
|
+
text: label,
|
|
4356
|
+
variant: FontStyle.L1_REGULAR,
|
|
4360
4357
|
style: {
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
height: verticalScale(size),
|
|
4365
|
-
borderRadius: verticalScale(size / 2),
|
|
4366
|
-
...sliderStyle
|
|
4358
|
+
color: theme.CONTENT_INVERTED,
|
|
4359
|
+
alignSelf: "center",
|
|
4360
|
+
...textStyle
|
|
4367
4361
|
}
|
|
4362
|
+
}
|
|
4363
|
+
)), /* @__PURE__ */ React__default["default"].createElement(
|
|
4364
|
+
reactNative.Animated.View,
|
|
4365
|
+
{
|
|
4366
|
+
style: [styles$3.slider, { transform: [{ translateX: pan }] }],
|
|
4367
|
+
...panResponder.panHandlers
|
|
4368
4368
|
},
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4369
|
+
/* @__PURE__ */ React__default["default"].createElement(
|
|
4370
|
+
reactNative.View,
|
|
4371
|
+
{
|
|
4372
|
+
style: {
|
|
4373
|
+
...styles$3.button,
|
|
4374
|
+
backgroundColor: theme.SURFACE_PRIMARY,
|
|
4375
|
+
width: verticalScale(size),
|
|
4376
|
+
height: verticalScale(size),
|
|
4377
|
+
borderRadius: verticalScale(size / 2),
|
|
4378
|
+
...sliderStyle
|
|
4379
|
+
}
|
|
4380
|
+
},
|
|
4381
|
+
icon
|
|
4382
|
+
)
|
|
4383
|
+
));
|
|
4384
|
+
}
|
|
4385
|
+
);
|
|
4373
4386
|
var index$2 = withThemeProvider(CustomSlideButton);
|
|
4374
4387
|
|
|
4375
4388
|
const copyToClipboard = (textToCopy) => {
|