dhre-ui-kit 0.0.82 → 0.0.84

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dhre-ui-kit",
3
- "version": "0.0.82",
3
+ "version": "0.0.84",
4
4
  "main": "src/index.ts",
5
5
  "files": [
6
6
  "src",
@@ -0,0 +1,3 @@
1
+ <svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M6.75 3.375L12.375 9L6.75 14.625" stroke="white" stroke-linecap="round" stroke-linejoin="round"/>
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M13.5 4.5L6.5 11.5L3 8" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
3
+ </svg>
@@ -9,6 +9,8 @@ import CircleTick from './images/circleTick.svg';
9
9
  import ArrowLeft from './images/arrowLeft.svg';
10
10
  import BellSimple from './images/bellSimple.svg';
11
11
  import UploadFile from './images/uploadFileIcon.svg';
12
+ import CaretRight from './images/caretRight.svg';
13
+ import CheckWhite from './images/checkWhite.svg';
12
14
 
13
15
  export {
14
16
  CalenderDots,
@@ -22,4 +24,6 @@ export {
22
24
  ArrowLeft,
23
25
  BellSimple,
24
26
  UploadFile,
27
+ CaretRight,
28
+ CheckWhite,
25
29
  };
@@ -0,0 +1,4 @@
1
+ export interface CustomSlideButtonProps {
2
+ label?: string;
3
+ onComplete?: () => void;
4
+ }
@@ -0,0 +1,60 @@
1
+ import React, {useRef} from 'react';
2
+ import {View, PanResponder, Animated, Dimensions} from 'react-native';
3
+ import {CaretRight} from '../../assets/index';
4
+ import {CustomTypography, FontStyle} from '../../index';
5
+ import styles from './styles';
6
+ import {CustomSlideButtonProps} from './custom-slide-button.interface';
7
+
8
+ const {width} = Dimensions.get('window');
9
+ const BUTTON_WIDTH = 40; // Width of the button
10
+
11
+ const CustomSlideButton = ({label, onComplete}: CustomSlideButtonProps) => {
12
+ const pan = useRef(new Animated.Value(0)).current;
13
+
14
+ const panResponder = useRef(
15
+ PanResponder.create({
16
+ onMoveShouldSetPanResponder: (evt, gestureState) => {
17
+ return gestureState.dx > 0; // Only set when moving right
18
+ },
19
+ onPanResponderGrant: () => {},
20
+ onPanResponderMove: (evt, gestureState) => {
21
+ if (gestureState.dx < width - BUTTON_WIDTH) {
22
+ pan.setValue(gestureState.dx);
23
+ }
24
+ },
25
+ onPanResponderRelease: (evt, gestureState) => {
26
+ if (gestureState.dx > width - BUTTON_WIDTH - 100) {
27
+ // If slid far enough, trigger payment action
28
+ onComplete && onComplete();
29
+ Animated.spring(pan, {
30
+ toValue: width - BUTTON_WIDTH - 10,
31
+ useNativeDriver: false,
32
+ }).start();
33
+ } else {
34
+ // Otherwise, reset position
35
+ Animated.spring(pan, {
36
+ toValue: 0,
37
+ useNativeDriver: false,
38
+ }).start();
39
+ }
40
+ },
41
+ }),
42
+ ).current;
43
+
44
+ return (
45
+ <View style={styles.sliderContainer}>
46
+ <View style={styles.buttonTextCOntainer}>
47
+ <CustomTypography text={label} variant={FontStyle.L1_REGULAR} />
48
+ </View>
49
+ <Animated.View
50
+ style={[styles.slider, {transform: [{translateX: pan}]}]}
51
+ {...panResponder.panHandlers}>
52
+ <View style={{...styles.button, width: BUTTON_WIDTH}}>
53
+ <CaretRight />
54
+ </View>
55
+ </Animated.View>
56
+ </View>
57
+ );
58
+ };
59
+
60
+ export default CustomSlideButton;
@@ -0,0 +1,42 @@
1
+ import {StyleSheet} from 'react-native';
2
+
3
+ const styles = StyleSheet.create({
4
+ container: {
5
+ flex: 1,
6
+ justifyContent: 'center',
7
+ alignItems: 'center',
8
+ backgroundColor: '#f8f8f8',
9
+ },
10
+ sliderContainer: {
11
+ width: '100%',
12
+ height: 48,
13
+ backgroundColor: '#e0e0e0',
14
+ borderRadius: 25,
15
+ overflow: 'hidden',
16
+ justifyContent: 'center',
17
+ },
18
+ slider: {
19
+ height: '100%',
20
+ width: '100%',
21
+ position: 'absolute',
22
+ },
23
+ button: {
24
+ height: 40,
25
+ backgroundColor: '#000',
26
+ justifyContent: 'center',
27
+ alignItems: 'center',
28
+ borderRadius: 20,
29
+ margin: 4,
30
+ },
31
+ buttonTextCOntainer: {
32
+ position: 'absolute',
33
+ left: 0,
34
+ right: 0,
35
+ bottom: 0,
36
+ top: 0,
37
+ alignItems: 'center',
38
+ justifyContent: 'center',
39
+ },
40
+ });
41
+
42
+ export default styles;
@@ -1,6 +1,6 @@
1
1
  import {View} from 'react-native';
2
2
  import React from 'react';
3
- import {CircleTick} from '../../assets';
3
+ import {CheckWhite} from '../../assets';
4
4
  import {styles} from './styles';
5
5
  import {IData, IProps, Status} from './stepper.interface';
6
6
  import {DHRE_COLORS_TEXT} from '../../theme/colors';
@@ -72,7 +72,7 @@ const Stepper = ({
72
72
  />
73
73
  )}
74
74
  {showStatus && item?.status === Status.Completed && (
75
- <CircleTick />
75
+ <CheckWhite />
76
76
  )}
77
77
  </View>
78
78
  {index != data?.length - 1 && (
package/src/index.ts CHANGED
@@ -44,6 +44,7 @@ export {default as OTPInput} from './components/otp';
44
44
  export {default as Stepper} from './components/stepper';
45
45
  export {FONT_STYLES} from './theme/fonts';
46
46
  export {FontStyle, Theme} from './utils/appEnum';
47
+ export {default as CustomSlideButton} from './components/customSlideButton';
47
48
 
48
49
  export {DHRE_DEFAULT, DHRE_COLORS_TEXT} from './theme/colors';
49
50