dhre-ui-kit 0.0.77 → 0.0.78
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,8 +1,8 @@
|
|
|
1
|
-
import commonStyles from '../../utils/commonStyles';
|
|
2
1
|
import React, {useEffect} from 'react';
|
|
3
|
-
import {View} from 'react-native';
|
|
2
|
+
import {StyleSheet, View} from 'react-native';
|
|
4
3
|
import * as Progress from 'react-native-progress';
|
|
5
4
|
import {ShapeType} from '../../utils/appEnum';
|
|
5
|
+
import CustomText from '../customText';
|
|
6
6
|
|
|
7
7
|
interface CustomProgressBarProps {
|
|
8
8
|
value: number; // Current progress value (0 to 100)
|
|
@@ -19,6 +19,7 @@ interface CustomProgressBarProps {
|
|
|
19
19
|
setProgress: React.Dispatch<React.SetStateAction<number>>;
|
|
20
20
|
increment?: number; // Optional increment value for progress update
|
|
21
21
|
interval?: number; // Optional interval time (ms) for progress update
|
|
22
|
+
percentageText?: string;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
const CustomProgressBar: React.FC<CustomProgressBarProps> = ({
|
|
@@ -36,6 +37,7 @@ const CustomProgressBar: React.FC<CustomProgressBarProps> = ({
|
|
|
36
37
|
setProgress,
|
|
37
38
|
increment = 1, // Default increment to 1
|
|
38
39
|
interval = 100, // Default interval to 100ms
|
|
40
|
+
percentageText
|
|
39
41
|
}) => {
|
|
40
42
|
useEffect(() => {
|
|
41
43
|
const progressInterval = setInterval(() => {
|
|
@@ -49,6 +51,23 @@ const CustomProgressBar: React.FC<CustomProgressBarProps> = ({
|
|
|
49
51
|
return () => clearInterval(progressInterval);
|
|
50
52
|
}, [progress, value, increment, interval]);
|
|
51
53
|
|
|
54
|
+
const showPercentage = () => {
|
|
55
|
+
return (
|
|
56
|
+
<View style={styles.flexDirection}>
|
|
57
|
+
<CustomText
|
|
58
|
+
text={`${value}%`}
|
|
59
|
+
variant="B1_REGULAR"
|
|
60
|
+
textColor="CONTENT_PRIMARY"
|
|
61
|
+
/>
|
|
62
|
+
{percentageText ?
|
|
63
|
+
<CustomText
|
|
64
|
+
text={percentageText}
|
|
65
|
+
variant="L3_REGULAR"
|
|
66
|
+
textColor="CONTENT_PRIMARY"
|
|
67
|
+
/>: null}
|
|
68
|
+
</View>
|
|
69
|
+
);
|
|
70
|
+
};
|
|
52
71
|
const renderProgressBar = () => {
|
|
53
72
|
switch (type) {
|
|
54
73
|
case ShapeType.LINE:
|
|
@@ -74,7 +93,7 @@ const CustomProgressBar: React.FC<CustomProgressBarProps> = ({
|
|
|
74
93
|
unfilledColor={unfilledColor}
|
|
75
94
|
borderWidth={borderWidth}
|
|
76
95
|
showsText={true}
|
|
77
|
-
formatText={
|
|
96
|
+
formatText={showPercentage}
|
|
78
97
|
testID="custom-progress-bar-circle"
|
|
79
98
|
/>
|
|
80
99
|
);
|
|
@@ -83,11 +102,15 @@ const CustomProgressBar: React.FC<CustomProgressBarProps> = ({
|
|
|
83
102
|
}
|
|
84
103
|
};
|
|
85
104
|
|
|
86
|
-
return (
|
|
87
|
-
<View style={commonStyles.centeredContainer} testID="custom-progress-bar">
|
|
88
|
-
{renderProgressBar()}
|
|
89
|
-
</View>
|
|
90
|
-
);
|
|
105
|
+
return <View testID="custom-progress-bar">{renderProgressBar()}</View>;
|
|
91
106
|
};
|
|
92
107
|
|
|
108
|
+
const styles = StyleSheet.create({
|
|
109
|
+
flexDirection: {
|
|
110
|
+
flexDirection: 'column',
|
|
111
|
+
justifyContent:'center',
|
|
112
|
+
alignItems:'center'
|
|
113
|
+
},
|
|
114
|
+
});
|
|
115
|
+
|
|
93
116
|
export default CustomProgressBar;
|
|
@@ -22,19 +22,20 @@ interface CommonTextInputProps {
|
|
|
22
22
|
editable?: boolean;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
const CommonTextInput: React.FC<CommonTextInputProps> =
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
25
|
+
const CommonTextInput: React.FC<CommonTextInputProps> = ({
|
|
26
|
+
label,
|
|
27
|
+
value,
|
|
28
|
+
onChangeText,
|
|
29
|
+
isSecureTextEntry = false,
|
|
30
|
+
keyboardType = 'default',
|
|
31
|
+
placeholderText,
|
|
32
|
+
activeBorderColor = theme.CONTENT_PRIMARY['light'],
|
|
33
|
+
inactiveBorderColor = theme.BORDER_PRIMARY['light'],
|
|
34
|
+
inputStyle,
|
|
35
|
+
maxLength,
|
|
36
|
+
errorMessage,
|
|
37
|
+
editable = true,
|
|
38
|
+
}) => {
|
|
38
39
|
return (
|
|
39
40
|
<>
|
|
40
41
|
<TextInput
|
|
@@ -43,7 +44,9 @@ const CommonTextInput: React.FC<CommonTextInputProps> = props => {
|
|
|
43
44
|
...styles.outlineStyle,
|
|
44
45
|
borderColor: value?.length ? activeBorderColor : inactiveBorderColor,
|
|
45
46
|
}}
|
|
47
|
+
label={label}
|
|
46
48
|
value={value}
|
|
49
|
+
onChangeText={onChangeText}
|
|
47
50
|
secureTextEntry={isSecureTextEntry}
|
|
48
51
|
keyboardType={keyboardType}
|
|
49
52
|
theme={{colors: {primary: DHRE_COLORS_TEXT.DH_BLACK}}}
|
|
@@ -51,7 +54,6 @@ const CommonTextInput: React.FC<CommonTextInputProps> = props => {
|
|
|
51
54
|
maxLength={maxLength}
|
|
52
55
|
placeholder={placeholderText}
|
|
53
56
|
editable={editable}
|
|
54
|
-
{...props}
|
|
55
57
|
/>
|
|
56
58
|
{errorMessage ? (
|
|
57
59
|
<CustomTypography
|