dhre-ui-kit 0.0.247 → 0.0.248
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 -2
- package/lib/index.js +103 -112
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +104 -113
- package/lib/index.mjs.map +1 -1
- package/package.json +2 -1
package/lib/index.d.ts
CHANGED
|
@@ -743,13 +743,15 @@ declare const _default$3: (props: IProps) => React$1.JSX.Element;
|
|
|
743
743
|
interface CustomSlideButtonProps {
|
|
744
744
|
label?: string;
|
|
745
745
|
onComplete?: () => void;
|
|
746
|
+
onReset?: () => void;
|
|
746
747
|
icon: React$1.ReactElement;
|
|
747
748
|
size?: number;
|
|
748
749
|
textStyle?: TextStyle;
|
|
749
750
|
containerStyle?: ViewStyle;
|
|
750
751
|
sliderStyle?: ViewStyle;
|
|
751
|
-
|
|
752
|
-
|
|
752
|
+
sliderBackgroundColor?: string;
|
|
753
|
+
sliderTextColor?: string;
|
|
754
|
+
resetTimer?: number;
|
|
753
755
|
}
|
|
754
756
|
type SlideButtonHandle = {
|
|
755
757
|
reset?: () => void;
|
package/lib/index.js
CHANGED
|
@@ -7,7 +7,7 @@ var reactRedux = require('react-redux');
|
|
|
7
7
|
var reactNative = require('react-native');
|
|
8
8
|
var reactNativeGestureHandler = require('react-native-gesture-handler');
|
|
9
9
|
var blur = require('@react-native-community/blur');
|
|
10
|
-
var
|
|
10
|
+
var LottieView = require('lottie-react-native');
|
|
11
11
|
var Tooltip = require('react-native-walkthrough-tooltip');
|
|
12
12
|
var Pdf = require('react-native-pdf');
|
|
13
13
|
var Progress = require('react-native-progress');
|
|
@@ -19,6 +19,7 @@ var reactNativeElementDropdown = require('react-native-element-dropdown');
|
|
|
19
19
|
var DocumentPicker = require('react-native-document-picker');
|
|
20
20
|
var RNFS = require('react-native-fs');
|
|
21
21
|
var OTPVerify = require('react-native-otp-verify');
|
|
22
|
+
var stylehelper = require('src/utils/stylehelper');
|
|
22
23
|
var Clipboard = require('@react-native-clipboard/clipboard');
|
|
23
24
|
|
|
24
25
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -42,7 +43,7 @@ function _interopNamespace(e) {
|
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
45
|
-
var
|
|
46
|
+
var LottieView__default = /*#__PURE__*/_interopDefaultLegacy(LottieView);
|
|
46
47
|
var Tooltip__default = /*#__PURE__*/_interopDefaultLegacy(Tooltip);
|
|
47
48
|
var Pdf__default = /*#__PURE__*/_interopDefaultLegacy(Pdf);
|
|
48
49
|
var Progress__namespace = /*#__PURE__*/_interopNamespace(Progress);
|
|
@@ -746,6 +747,13 @@ const BottomDrawer = ({
|
|
|
746
747
|
|
|
747
748
|
const createStyles$3 = (theme) => {
|
|
748
749
|
return reactNative.StyleSheet.create({
|
|
750
|
+
container: {
|
|
751
|
+
position: "absolute",
|
|
752
|
+
left: 0,
|
|
753
|
+
right: 0,
|
|
754
|
+
bottom: 0,
|
|
755
|
+
top: 0
|
|
756
|
+
},
|
|
749
757
|
backdrop: {
|
|
750
758
|
flex: 1,
|
|
751
759
|
justifyContent: "center",
|
|
@@ -782,67 +790,20 @@ const createStyles$3 = (theme) => {
|
|
|
782
790
|
};
|
|
783
791
|
|
|
784
792
|
const CustomLoader = ({ loading, loadingText = "Loading..." }) => {
|
|
785
|
-
const rotateAnim = React.useRef(new reactNative.Animated.Value(0)).current;
|
|
786
793
|
const { theme, mode } = useTheme();
|
|
787
794
|
const styles = createStyles$3(theme);
|
|
788
|
-
React.useEffect(() => {
|
|
789
|
-
if (loading) {
|
|
790
|
-
reactNative.Animated.loop(
|
|
791
|
-
reactNative.Animated.timing(rotateAnim, {
|
|
792
|
-
toValue: 1,
|
|
793
|
-
duration: 1500,
|
|
794
|
-
easing: reactNative.Easing.linear,
|
|
795
|
-
useNativeDriver: true
|
|
796
|
-
})
|
|
797
|
-
).start();
|
|
798
|
-
} else {
|
|
799
|
-
rotateAnim.stopAnimation();
|
|
800
|
-
rotateAnim.setValue(0);
|
|
801
|
-
}
|
|
802
|
-
return () => {
|
|
803
|
-
rotateAnim.stopAnimation();
|
|
804
|
-
};
|
|
805
|
-
}, [loading, rotateAnim]);
|
|
806
795
|
if (!loading) return null;
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
), /* @__PURE__ */ React__default["default"].createElement(
|
|
819
|
-
Svg.Stop,
|
|
820
|
-
{
|
|
821
|
-
offset: "100%",
|
|
822
|
-
stopColor: mode === "dark" ? "#FFFFFF" : "#AAAAAA",
|
|
823
|
-
stopOpacity: ".9"
|
|
824
|
-
}
|
|
825
|
-
))), /* @__PURE__ */ React__default["default"].createElement(
|
|
826
|
-
Svg.Circle,
|
|
827
|
-
{
|
|
828
|
-
cx: "50",
|
|
829
|
-
cy: "50",
|
|
830
|
-
r: "40",
|
|
831
|
-
stroke: "url(#grad)",
|
|
832
|
-
strokeWidth: "8",
|
|
833
|
-
fill: "none",
|
|
834
|
-
strokeDasharray: "250",
|
|
835
|
-
strokeLinecap: "round"
|
|
836
|
-
}
|
|
837
|
-
))), /* @__PURE__ */ React__default["default"].createElement(
|
|
838
|
-
CustomText$1,
|
|
839
|
-
{
|
|
840
|
-
text: loadingText,
|
|
841
|
-
style: styles.text,
|
|
842
|
-
variant: FontStyle.B4_REGULAR,
|
|
843
|
-
textColor: "#000000"
|
|
844
|
-
}
|
|
845
|
-
))));
|
|
796
|
+
else {
|
|
797
|
+
return /* @__PURE__ */ React__default["default"].createElement(reactNative.View, { style: styles.container }, /* @__PURE__ */ React__default["default"].createElement(reactNative.View, { style: styles.backdrop }, /* @__PURE__ */ React__default["default"].createElement(reactNative.View, { style: styles.box }, /* @__PURE__ */ React__default["default"].createElement(reactNative.View, { style: styles.loader }, /* @__PURE__ */ React__default["default"].createElement(LottieView__default["default"], { style: styles.loader, source: require("../../assets/json/Loading.json"), autoPlay: true, loop: true })), /* @__PURE__ */ React__default["default"].createElement(
|
|
798
|
+
CustomText$1,
|
|
799
|
+
{
|
|
800
|
+
text: loadingText,
|
|
801
|
+
style: styles.text,
|
|
802
|
+
variant: FontStyle.B4_REGULAR,
|
|
803
|
+
textColor: "#000000"
|
|
804
|
+
}
|
|
805
|
+
))));
|
|
806
|
+
}
|
|
846
807
|
};
|
|
847
808
|
var CustomLoader$1 = withThemeProvider(CustomLoader);
|
|
848
809
|
|
|
@@ -4417,8 +4378,8 @@ const styles$3 = reactNative.StyleSheet.create({
|
|
|
4417
4378
|
alignItems: "center"
|
|
4418
4379
|
},
|
|
4419
4380
|
sliderContainer: {
|
|
4420
|
-
height: verticalScale(48),
|
|
4421
|
-
borderRadius: moderateScale(25),
|
|
4381
|
+
height: stylehelper.verticalScale(48),
|
|
4382
|
+
borderRadius: stylehelper.moderateScale(25),
|
|
4422
4383
|
overflow: "hidden",
|
|
4423
4384
|
justifyContent: "center"
|
|
4424
4385
|
},
|
|
@@ -4429,11 +4390,11 @@ const styles$3 = reactNative.StyleSheet.create({
|
|
|
4429
4390
|
justifyContent: "center"
|
|
4430
4391
|
},
|
|
4431
4392
|
button: {
|
|
4432
|
-
height: verticalScale(40),
|
|
4393
|
+
height: stylehelper.verticalScale(40),
|
|
4433
4394
|
justifyContent: "center",
|
|
4434
4395
|
alignItems: "center",
|
|
4435
|
-
borderRadius: moderateScale(20),
|
|
4436
|
-
margin:
|
|
4396
|
+
borderRadius: stylehelper.moderateScale(20),
|
|
4397
|
+
margin: 4
|
|
4437
4398
|
},
|
|
4438
4399
|
buttonTextContainer: {
|
|
4439
4400
|
position: "absolute",
|
|
@@ -4442,7 +4403,8 @@ const styles$3 = reactNative.StyleSheet.create({
|
|
|
4442
4403
|
bottom: 0,
|
|
4443
4404
|
top: 0,
|
|
4444
4405
|
alignItems: "center",
|
|
4445
|
-
justifyContent: "center"
|
|
4406
|
+
justifyContent: "center",
|
|
4407
|
+
borderRadius: 25
|
|
4446
4408
|
}
|
|
4447
4409
|
});
|
|
4448
4410
|
|
|
@@ -4451,30 +4413,25 @@ const CustomSlideButton = React__default["default"].forwardRef(
|
|
|
4451
4413
|
({
|
|
4452
4414
|
label,
|
|
4453
4415
|
onComplete,
|
|
4416
|
+
onReset,
|
|
4454
4417
|
icon,
|
|
4455
4418
|
textStyle,
|
|
4456
4419
|
containerStyle,
|
|
4457
4420
|
sliderStyle,
|
|
4458
4421
|
size = BUTTON_WIDTH,
|
|
4459
|
-
|
|
4460
|
-
|
|
4422
|
+
sliderBackgroundColor = "#fff",
|
|
4423
|
+
sliderTextColor = "#000",
|
|
4424
|
+
resetTimer = 2e3
|
|
4461
4425
|
}, ref) => {
|
|
4462
4426
|
const value = React.useRef(0);
|
|
4463
4427
|
const cardRef = React.useRef(null);
|
|
4464
4428
|
const [translateX] = React.useState(new reactNative.Animated.Value(0));
|
|
4465
|
-
const
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
});
|
|
4429
|
+
const sliderConteinerRef = React.useRef(null);
|
|
4430
|
+
const [color, setColor] = React.useState(new reactNative.Animated.Value(0));
|
|
4431
|
+
const [sliderBackgroundColorRef, setSliderBackgroundColorRef] = React.useState(new reactNative.Animated.Value(0));
|
|
4469
4432
|
React__default["default"].useImperativeHandle(ref, () => ({
|
|
4470
4433
|
reset() {
|
|
4471
|
-
|
|
4472
|
-
toValue: 0,
|
|
4473
|
-
useNativeDriver: false
|
|
4474
|
-
}).start();
|
|
4475
|
-
slideTailCardRef?.current?.setNativeProps({
|
|
4476
|
-
style: { width: 0 }
|
|
4477
|
-
});
|
|
4434
|
+
resetAll();
|
|
4478
4435
|
}
|
|
4479
4436
|
}));
|
|
4480
4437
|
const handleLayout = (event) => {
|
|
@@ -4485,68 +4442,102 @@ const CustomSlideButton = React__default["default"].forwardRef(
|
|
|
4485
4442
|
// Change the width here
|
|
4486
4443
|
});
|
|
4487
4444
|
value.current = width;
|
|
4445
|
+
sliderConteinerRef?.current?.setNativeProps({
|
|
4446
|
+
style: { width }
|
|
4447
|
+
});
|
|
4488
4448
|
}
|
|
4489
4449
|
};
|
|
4450
|
+
const resetAll = () => {
|
|
4451
|
+
reactNative.Animated.timing(translateX, {
|
|
4452
|
+
toValue: 0,
|
|
4453
|
+
useNativeDriver: false
|
|
4454
|
+
}).start();
|
|
4455
|
+
reactNative.Animated.timing(sliderBackgroundColorRef, {
|
|
4456
|
+
toValue: 0,
|
|
4457
|
+
duration: 0,
|
|
4458
|
+
// no transition time, immediate change
|
|
4459
|
+
useNativeDriver: false
|
|
4460
|
+
// because we're animating the color, not layout
|
|
4461
|
+
}).start();
|
|
4462
|
+
reactNative.Animated.timing(color, {
|
|
4463
|
+
toValue: 0,
|
|
4464
|
+
delay: 300,
|
|
4465
|
+
// no transition time, immediate change
|
|
4466
|
+
useNativeDriver: false
|
|
4467
|
+
// because we're animating the color, not layout
|
|
4468
|
+
}).start();
|
|
4469
|
+
onReset?.();
|
|
4470
|
+
};
|
|
4490
4471
|
const panResponder = reactNative.PanResponder.create({
|
|
4491
4472
|
onMoveShouldSetPanResponder: (e, gestureState) => {
|
|
4492
4473
|
return gestureState.dx !== 0;
|
|
4493
4474
|
},
|
|
4494
4475
|
onPanResponderMove: (evt, gestureState) => {
|
|
4495
|
-
if (gestureState.dx > 0) {
|
|
4476
|
+
if (gestureState.dx > 0 && gestureState.dx <= value?.current - BUTTON_WIDTH - 8) {
|
|
4496
4477
|
translateX.setValue(gestureState.dx);
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4478
|
+
let colorValue = gestureState.dx > value.current / 3 ? 1 : 0;
|
|
4479
|
+
reactNative.Animated.timing(color, {
|
|
4480
|
+
toValue: colorValue,
|
|
4481
|
+
duration: 0,
|
|
4482
|
+
// no transition time, immediate change
|
|
4483
|
+
useNativeDriver: false
|
|
4484
|
+
// because we're animating the color, not layout
|
|
4485
|
+
}).start();
|
|
4500
4486
|
}
|
|
4501
4487
|
},
|
|
4502
4488
|
onPanResponderRelease: (e, gestureState) => {
|
|
4503
|
-
if (gestureState.dx >= value.current * 0.
|
|
4489
|
+
if (gestureState.dx >= value.current * 0.8) {
|
|
4504
4490
|
reactNative.Animated.timing(translateX, {
|
|
4505
|
-
toValue: value
|
|
4491
|
+
toValue: value?.current - (BUTTON_WIDTH + 8),
|
|
4506
4492
|
// Slide to the end
|
|
4507
4493
|
duration: 300,
|
|
4508
4494
|
useNativeDriver: false
|
|
4509
|
-
}).start(
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
// Change the width here
|
|
4515
|
-
});
|
|
4516
|
-
} else {
|
|
4517
|
-
reactNative.Animated.spring(translateX, {
|
|
4518
|
-
toValue: 0,
|
|
4495
|
+
}).start();
|
|
4496
|
+
reactNative.Animated.timing(sliderBackgroundColorRef, {
|
|
4497
|
+
toValue: 1,
|
|
4498
|
+
duration: 0,
|
|
4499
|
+
// no transition time, immediate change
|
|
4519
4500
|
useNativeDriver: false
|
|
4501
|
+
// because we're animating the color, not layout
|
|
4520
4502
|
}).start();
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4503
|
+
onComplete?.();
|
|
4504
|
+
setTimeout(() => {
|
|
4505
|
+
resetAll();
|
|
4506
|
+
}, resetTimer);
|
|
4507
|
+
} else {
|
|
4508
|
+
resetAll();
|
|
4524
4509
|
}
|
|
4525
4510
|
}
|
|
4526
4511
|
});
|
|
4512
|
+
const textColor = color.interpolate({
|
|
4513
|
+
inputRange: [0, 1],
|
|
4514
|
+
outputRange: [sliderTextColor, "transparent"]
|
|
4515
|
+
});
|
|
4516
|
+
const backgroundColor = sliderBackgroundColorRef.interpolate({
|
|
4517
|
+
inputRange: [0, 1],
|
|
4518
|
+
outputRange: [sliderBackgroundColor, "transparent"]
|
|
4519
|
+
});
|
|
4527
4520
|
const { theme } = useTheme();
|
|
4528
4521
|
return /* @__PURE__ */ React__default["default"].createElement(reactNative.View, { style: {
|
|
4529
4522
|
...styles$3.sliderContainer,
|
|
4530
4523
|
backgroundColor: theme.SURFACE_INVERTED,
|
|
4531
4524
|
...containerStyle
|
|
4532
|
-
}, onLayout: handleLayout, ref: cardRef },
|
|
4525
|
+
}, onLayout: handleLayout, ref: cardRef }, /* @__PURE__ */ React__default["default"].createElement(
|
|
4533
4526
|
reactNative.Animated.View,
|
|
4534
4527
|
{
|
|
4535
|
-
|
|
4536
|
-
|
|
4528
|
+
style: [styles$3.buttonTextContainer, { backgroundColor, transform: [{ translateX }] }],
|
|
4529
|
+
ref: sliderConteinerRef
|
|
4537
4530
|
}
|
|
4538
|
-
), /* @__PURE__ */ React__default["default"].createElement(
|
|
4539
|
-
|
|
4531
|
+
), /* @__PURE__ */ React__default["default"].createElement(
|
|
4532
|
+
reactNative.View,
|
|
4540
4533
|
{
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
}
|
|
4549
|
-
)), /* @__PURE__ */ React__default["default"].createElement(
|
|
4534
|
+
style: styles$3.buttonTextContainer
|
|
4535
|
+
},
|
|
4536
|
+
/* @__PURE__ */ React__default["default"].createElement(reactNative.Animated.Text, { style: [{
|
|
4537
|
+
alignSelf: "center",
|
|
4538
|
+
...textStyle
|
|
4539
|
+
}, { color: textColor }] }, label)
|
|
4540
|
+
), /* @__PURE__ */ React__default["default"].createElement(
|
|
4550
4541
|
reactNative.Animated.View,
|
|
4551
4542
|
{
|
|
4552
4543
|
style: [styles$3.slider, { transform: [{ translateX }] }],
|