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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dhre-ui-kit",
3
- "version": "0.0.92",
3
+ "version": "0.0.94",
4
4
  "main": "src/index.ts",
5
5
  "files": [
6
6
  "src",
@@ -12,4 +12,5 @@ export interface AccordionProps {
12
12
  onToggle: () => void;
13
13
  optionalElement?: () => React.ReactNode; // Update this line
14
14
  headerComponent?: () => React.ReactNode;
15
+ disabled?: boolean;
15
16
  }
@@ -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 style={[styles.header, headerStyle]} onPress={onToggle}>
49
+ <Pressable
50
+ style={[styles.header, headerStyle, disabled && {opacity: 0.5}]}
51
+ onPress={!disabled ? onToggle : undefined}>
49
52
  {headerComponent ? (
50
53
  headerComponent()
51
54
  ) : (
@@ -10,3 +10,10 @@ export interface DayType {
10
10
  year: number;
11
11
  timestamp: number;
12
12
  }
13
+
14
+ export interface MarkedDate {
15
+ startingDay?: boolean;
16
+ endingDay?: boolean;
17
+ color: string;
18
+ textColor: string;
19
+ }
@@ -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 {DateRangePickerProps, DayType} from './DateRangePicker.interface';
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
- const markedDates = {};
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
- <TextInput
46
- mode="outlined"
47
- outlineStyle={{
48
- ...styles.outlineStyle,
49
- borderColor: value?.length ? activeBorderColor : inactiveBorderColor,
50
- }}
51
- label={label}
52
- value={value}
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
- ) : null}
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,
@@ -77,7 +77,7 @@ const styles = StyleSheet.create({
77
77
  },
78
78
  rightIconContainer: {
79
79
  position: 'absolute',
80
- left: 10,
80
+ left: 16,
81
81
  top: 10,
82
82
  },
83
83
  });