dhre-ui-kit 0.0.92 → 0.0.94
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 +1 -1
- package/src/components/accordion/Accordion.interface.ts +1 -0
- package/src/components/accordion/Accordion.tsx +4 -1
- package/src/components/dateRangePicker/DateRangePicker.interface.ts +7 -0
- package/src/components/dateRangePicker/DateRangePicker.tsx +10 -2
- package/src/components/progressBar/ProgressBar.tsx +2 -2
- package/src/components/textInput/Textinput.tsx +51 -33
- package/src/components/topic/Topic.tsx +1 -1
package/package.json
CHANGED
|
@@ -17,6 +17,7 @@ const Accordion = ({
|
|
|
17
17
|
onToggle,
|
|
18
18
|
optionalElement, // Destructure the new prop,
|
|
19
19
|
headerComponent,
|
|
20
|
+
disabled = false,
|
|
20
21
|
}: AccordionProps) => {
|
|
21
22
|
const contentRef = useRef<View>(null);
|
|
22
23
|
const [animation] = useState(new Animated.Value(0));
|
|
@@ -45,7 +46,9 @@ const Accordion = ({
|
|
|
45
46
|
|
|
46
47
|
return (
|
|
47
48
|
<View style={[styles.container, containerStyle]} testID={testId}>
|
|
48
|
-
<Pressable
|
|
49
|
+
<Pressable
|
|
50
|
+
style={[styles.header, headerStyle, disabled && {opacity: 0.5}]}
|
|
51
|
+
onPress={!disabled ? onToggle : undefined}>
|
|
49
52
|
{headerComponent ? (
|
|
50
53
|
headerComponent()
|
|
51
54
|
) : (
|
|
@@ -2,7 +2,11 @@ import React, {useState} from 'react';
|
|
|
2
2
|
import {View} from 'react-native';
|
|
3
3
|
import {Calendar} from 'react-native-calendars';
|
|
4
4
|
import Button from '../button';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
DateRangePickerProps,
|
|
7
|
+
DayType,
|
|
8
|
+
MarkedDate,
|
|
9
|
+
} from './DateRangePicker.interface';
|
|
6
10
|
import styles from './DateRangePicker.styles';
|
|
7
11
|
|
|
8
12
|
const DateRangePicker = (props: DateRangePickerProps) => {
|
|
@@ -32,7 +36,8 @@ const DateRangePicker = (props: DateRangePickerProps) => {
|
|
|
32
36
|
|
|
33
37
|
const getMarkedDates = () => {
|
|
34
38
|
const {startDate, endDate} = selectedRange;
|
|
35
|
-
|
|
39
|
+
|
|
40
|
+
const markedDates: {[key: string]: MarkedDate} = {};
|
|
36
41
|
|
|
37
42
|
if (startDate) {
|
|
38
43
|
markedDates[startDate] = {
|
|
@@ -65,6 +70,8 @@ const DateRangePicker = (props: DateRangePickerProps) => {
|
|
|
65
70
|
return markedDates;
|
|
66
71
|
};
|
|
67
72
|
|
|
73
|
+
const isButtonDisabled = !selectedRange.startDate || !selectedRange.endDate;
|
|
74
|
+
|
|
68
75
|
return (
|
|
69
76
|
<View>
|
|
70
77
|
<Calendar
|
|
@@ -92,6 +99,7 @@ const DateRangePicker = (props: DateRangePickerProps) => {
|
|
|
92
99
|
}}
|
|
93
100
|
containerStyle={styles.applyButton}
|
|
94
101
|
textStyle={styles.applyButtonText}
|
|
102
|
+
disabled={isButtonDisabled}
|
|
95
103
|
/>
|
|
96
104
|
</View>
|
|
97
105
|
);
|
|
@@ -20,7 +20,7 @@ interface CustomProgressBarProps {
|
|
|
20
20
|
increment?: number; // Optional increment value for progress update
|
|
21
21
|
interval?: number; // Optional interval time (ms) for progress update
|
|
22
22
|
percentageText?: string;
|
|
23
|
-
valueTextStyle?: TextStyle
|
|
23
|
+
valueTextStyle?: TextStyle;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
const CustomProgressBar: React.FC<CustomProgressBarProps> = ({
|
|
@@ -39,7 +39,7 @@ const CustomProgressBar: React.FC<CustomProgressBarProps> = ({
|
|
|
39
39
|
increment = 1, // Default increment to 1
|
|
40
40
|
interval = 100, // Default interval to 100ms
|
|
41
41
|
percentageText,
|
|
42
|
-
valueTextStyle
|
|
42
|
+
valueTextStyle,
|
|
43
43
|
}) => {
|
|
44
44
|
useEffect(() => {
|
|
45
45
|
const progressInterval = setInterval(() => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {StyleSheet, ViewStyle} from 'react-native';
|
|
2
|
+
import {Pressable, StyleSheet, View, ViewStyle} from 'react-native';
|
|
3
3
|
import {TextInput} from 'react-native-paper';
|
|
4
4
|
import {DHRE_COLORS_TEXT, DHRE_DEFAULT} from '../../theme/colors';
|
|
5
5
|
import {verticalScale, moderateScale} from '../../utils/stylehelper';
|
|
@@ -22,6 +22,8 @@ interface CommonTextInputProps {
|
|
|
22
22
|
editable?: boolean;
|
|
23
23
|
textColor?: string;
|
|
24
24
|
labelColor?: string;
|
|
25
|
+
pointerEvents?: 'box-none' | 'none' | 'box-only' | 'auto' | undefined;
|
|
26
|
+
handlePress?: () => void;
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
const CommonTextInput: React.FC<CommonTextInputProps> = ({
|
|
@@ -39,46 +41,62 @@ const CommonTextInput: React.FC<CommonTextInputProps> = ({
|
|
|
39
41
|
editable = true,
|
|
40
42
|
textColor = theme.CONTENT_PRIMARY['light'],
|
|
41
43
|
labelColor,
|
|
44
|
+
handlePress,
|
|
45
|
+
pointerEvents,
|
|
42
46
|
}) => {
|
|
43
47
|
return (
|
|
44
|
-
|
|
45
|
-
<
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
onChangeText={onChangeText}
|
|
54
|
-
secureTextEntry={isSecureTextEntry}
|
|
55
|
-
keyboardType={keyboardType}
|
|
56
|
-
theme={{
|
|
57
|
-
colors: {
|
|
58
|
-
primary: labelColor ? labelColor : DHRE_COLORS_TEXT.DH_BLACK,
|
|
59
|
-
},
|
|
60
|
-
}}
|
|
61
|
-
style={[errorMessage ? styles.errorInput : styles.input, inputStyle]}
|
|
62
|
-
maxLength={maxLength}
|
|
63
|
-
textColor={textColor}
|
|
64
|
-
placeholder={placeholderText}
|
|
65
|
-
editable={editable}
|
|
66
|
-
/>
|
|
67
|
-
{errorMessage ? (
|
|
68
|
-
<CustomTypography
|
|
69
|
-
variant={'L2_REGULAR'}
|
|
70
|
-
text={errorMessage ?? ''}
|
|
71
|
-
style={{
|
|
72
|
-
...styles.errorStyle,
|
|
73
|
-
color: DHRE_DEFAULT.DH_SEMENTIC_ERROR,
|
|
48
|
+
<View style={styles.container}>
|
|
49
|
+
<Pressable onPress={handlePress} style={styles.touchable}>
|
|
50
|
+
<TextInput
|
|
51
|
+
mode="outlined"
|
|
52
|
+
outlineStyle={{
|
|
53
|
+
...styles.outlineStyle,
|
|
54
|
+
borderColor: value?.length
|
|
55
|
+
? activeBorderColor
|
|
56
|
+
: inactiveBorderColor,
|
|
74
57
|
}}
|
|
58
|
+
label={label}
|
|
59
|
+
value={value}
|
|
60
|
+
onChangeText={onChangeText}
|
|
61
|
+
secureTextEntry={isSecureTextEntry}
|
|
62
|
+
keyboardType={keyboardType}
|
|
63
|
+
theme={{
|
|
64
|
+
colors: {
|
|
65
|
+
primary: labelColor ? labelColor : DHRE_COLORS_TEXT.DH_BLACK,
|
|
66
|
+
},
|
|
67
|
+
}}
|
|
68
|
+
style={[errorMessage ? styles.errorInput : styles.input, inputStyle]}
|
|
69
|
+
maxLength={maxLength}
|
|
70
|
+
textColor={textColor}
|
|
71
|
+
placeholder={placeholderText}
|
|
72
|
+
editable={editable}
|
|
73
|
+
pointerEvents={pointerEvents}
|
|
75
74
|
/>
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
{errorMessage ? (
|
|
76
|
+
<CustomTypography
|
|
77
|
+
variant={'L2_REGULAR'}
|
|
78
|
+
text={errorMessage ?? ''}
|
|
79
|
+
style={{
|
|
80
|
+
...styles.errorStyle,
|
|
81
|
+
color: DHRE_DEFAULT.DH_SEMENTIC_ERROR,
|
|
82
|
+
}}
|
|
83
|
+
/>
|
|
84
|
+
) : null}
|
|
85
|
+
</Pressable>
|
|
86
|
+
</View>
|
|
78
87
|
);
|
|
79
88
|
};
|
|
80
89
|
|
|
81
90
|
const styles = StyleSheet.create({
|
|
91
|
+
container: {
|
|
92
|
+
flex: 1,
|
|
93
|
+
justifyContent: 'center',
|
|
94
|
+
alignItems: 'center',
|
|
95
|
+
},
|
|
96
|
+
touchable: {
|
|
97
|
+
width: '100%', // Adjust width as needed
|
|
98
|
+
},
|
|
99
|
+
|
|
82
100
|
input: {
|
|
83
101
|
marginVertical: verticalScale(8),
|
|
84
102
|
backgroundColor: DHRE_COLORS_TEXT.DH_WHITE,
|