@jescon-technologies/react-native-ui-kit 0.0.1 → 0.0.3

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.
Files changed (59) hide show
  1. package/index.js +70 -0
  2. package/package.json +25 -3
  3. package/src/Alerts/AAlert.js +1 -1
  4. package/src/HOC/ConfirmOverlay.js +192 -0
  5. package/src/HOC/HAbsolute.js +56 -0
  6. package/src/HOC/HDiscontinue.js +105 -0
  7. package/src/HOC/HHeading.js +70 -0
  8. package/src/HOC/HMoreButton.js +88 -0
  9. package/src/HOC/HNatureHeading.js +402 -0
  10. package/src/HOC/HOCIcons.js +80 -0
  11. package/src/HOC/HOverlay.js +99 -0
  12. package/src/HOC/HOverlayCentered.js +140 -0
  13. package/src/HOC/HShadowButton.js +45 -0
  14. package/src/HOC/HShadowCountButton.js +82 -0
  15. package/src/HOC/OptionOverlay.js +48 -0
  16. package/src/Media/AudioScreen.js +347 -0
  17. package/src/Media/BarcodeScan.js +145 -0
  18. package/src/Media/CAudioPlay.js +228 -0
  19. package/src/Media/CCaptureImageWithoutEdit.js +330 -0
  20. package/src/Media/CImageGallery.js +289 -0
  21. package/src/Media/CImageZoom.js +82 -0
  22. package/src/Media/CSingleImage.js +391 -0
  23. package/src/Media/CSketchCanvas.js +76 -0
  24. package/src/Media/CVideoPlay.js +31 -0
  25. package/src/Media/DocumentScreen.js +367 -0
  26. package/src/Media/DrawingScreen.js +582 -0
  27. package/src/Media/ImageScreen.js +313 -0
  28. package/src/Media/RecordAudio.js +250 -0
  29. package/src/Media/RecordVideo.js +223 -0
  30. package/src/Media/VideoScreen.js +383 -0
  31. package/src/StaticComponents/SAlphabet.js +47 -0
  32. package/src/StaticComponents/SCheckBox.js +42 -0
  33. package/src/StaticComponents/SDatePicker.js +208 -0
  34. package/src/StaticComponents/SDatePickerLabel.js +253 -0
  35. package/src/StaticComponents/SDatePickerNew.js +258 -0
  36. package/src/StaticComponents/SDateTimePickerNew.js +381 -0
  37. package/src/StaticComponents/SDropDownGenerate.js +450 -0
  38. package/src/StaticComponents/SDropDownHoc.js +636 -0
  39. package/src/StaticComponents/SDropDownIcon.js +500 -0
  40. package/src/StaticComponents/SMenuBox.js +131 -0
  41. package/src/StaticComponents/SOverlay.js +177 -0
  42. package/src/StaticComponents/SOverlayTextInput.js +109 -0
  43. package/src/StaticComponents/SSearch.js +438 -0
  44. package/src/StaticComponents/SSearchBar.js +53 -0
  45. package/src/StaticComponents/SSpeedDial.js +303 -0
  46. package/src/StaticComponents/STextInput.js +289 -0
  47. package/src/StaticComponents/STextInputProps.js +36 -0
  48. package/src/StaticComponents/STimePicker.js +171 -0
  49. package/src/StaticComponents/STimingDropDownNew.js +1589 -0
  50. package/src/StaticComponents/STimingSwitch.js +34 -0
  51. package/src/layout/CContainerView.js +21 -0
  52. package/src/layout/CDetailView.js +81 -0
  53. package/src/layout/FooterBlock.js +0 -3
  54. package/src/layout/HeaderBlock.js +353 -0
  55. package/src/index.js +0 -15
  56. package/src/screens/ForgotPassword.js +0 -346
  57. package/src/screens/Login.js +0 -328
  58. package/src/screens/Splash.js +0 -788
  59. /package/src/{components → layout}/Loader.js +0 -0
@@ -0,0 +1,208 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import { View, TouchableOpacity, Platform, Text } from 'react-native';
3
+ import DateTimePicker from '@react-native-community/datetimepicker';
4
+ import CText from '../CustomComponents/CText';
5
+ import FontAwesome5 from 'react-native-vector-icons/FontAwesome5';
6
+ import { normalize } from '../CommonStyle/componentStyle';
7
+ import moment from 'moment';
8
+
9
+ export default function SDatePicker(props) {
10
+ // Initialize date state: normalize incoming passingDate to 12:00 AM
11
+ const [date, setDate] = useState(
12
+ props.passingDate
13
+ ? moment(props.passingDate).startOf('day').toDate()
14
+ : moment().startOf('day').toDate()
15
+ );
16
+
17
+ const [data, setData] = useState(props.data ?? {});
18
+ const [mode, setMode] = useState('date');
19
+ const [show, setShow] = useState(false);
20
+
21
+ // Handle date change for native platforms
22
+ const onNativeChange = (event, selectedDate) => {
23
+ const currentDate = selectedDate
24
+ ? moment(selectedDate).startOf('day').toDate() // normalize to 12:00 AM
25
+ : date;
26
+
27
+ setShow(Platform.OS === 'ios');
28
+ setDate(currentDate);
29
+
30
+ setData(prevData => ({ ...prevData, value: currentDate }));
31
+
32
+ if (props.onChangeData) {
33
+ // return formatted string: "YYYY-MM-DD HH:mm:ss.SSS"
34
+ const formatted = moment(currentDate).format('YYYY-MM-DD HH:mm:ss.SSS');
35
+ props.onChangeData(formatted);
36
+ }
37
+ };
38
+
39
+ // Handle date change for web platform
40
+ const onWebChange = (e) => {
41
+ const value = e.target.value;
42
+ if (!value) {return;}
43
+
44
+ const selectedDate = new Date(value + 'T00:00:00');
45
+ if (isNaN(selectedDate.getTime())) {return;}
46
+
47
+ setDate(selectedDate);
48
+ setData(prevData => ({ ...prevData, value: selectedDate }));
49
+
50
+ if (props.onChangeData) {
51
+ const formatted = moment(selectedDate).format('YYYY-MM-DD HH:mm:ss.SSS');
52
+ props.onChangeData(formatted);
53
+ }
54
+ };
55
+
56
+ const showMode = (currentMode) => {
57
+ setShow(true);
58
+ setMode(currentMode);
59
+ };
60
+
61
+ const showDatepicker = () => {
62
+ showMode('date');
63
+ };
64
+
65
+ // Get web input value in YYYY-MM-DD format
66
+ const getWebInputValue = () => {
67
+ if (!(date instanceof Date) || isNaN(date.getTime())) {return '';}
68
+ return date.toISOString().split('T')[0];
69
+ };
70
+
71
+ // Web-specific render
72
+ if (Platform.OS === 'web') {
73
+ return (
74
+ <View style={{ borderWidth: 0, width: data.itemwidth ?? '100%' }}>
75
+ <View style={{ marginTop: normalize(0), paddingHorizontal: 0, borderWidth: 0 }}>
76
+ {props.table !== true && (
77
+ <CText
78
+ style={{
79
+ fontSize: normalize(11),
80
+ paddingHorizontal: normalize(5),
81
+ color: 'black',
82
+ borderWidth: 0,
83
+ height: normalize(16),
84
+ }}
85
+ >
86
+ {props.required && <Text style={{ color: 'red', fontSize: normalize(13), fontWeight: 'bold' }}>* </Text>}
87
+ {data.displaytext ?? 'Date'}
88
+ </CText>
89
+ )}
90
+ <View style={{ elevation: props.table !== true ? 3 : 0 }}>
91
+ <View style={{
92
+ flexDirection: 'row',
93
+ backgroundColor: data.backgroundColor ?? '#fff',
94
+ height: data.height ?? normalize(35),
95
+ borderColor: 'lightgrey',
96
+ borderWidth: props.table !== true ? 1 : 0,
97
+ borderRadius: 5,
98
+ alignItems: 'center',
99
+ marginHorizontal: normalize(1),
100
+ justifyContent: props.table !== true ? 'flex-start' : 'center',
101
+ }}>
102
+ <FontAwesome5
103
+ name="calendar-alt"
104
+ size={normalize(15)}
105
+ color={data.iconcolor ?? 'darkblue'}
106
+ style={{ paddingHorizontal: 5, width: normalize(25) }}
107
+ />
108
+ <input
109
+ type="date"
110
+ value={getWebInputValue()}
111
+ onChange={onWebChange}
112
+ disabled={props.disabled}
113
+ min={props.minDate ? moment(props.minDate).format('YYYY-MM-DD') : undefined}
114
+ max={props.maxDate ? moment(props.maxDate).format('YYYY-MM-DD') : undefined}
115
+ style={{
116
+ flex: 1,
117
+ height: '100%',
118
+ border: 'none',
119
+ backgroundColor: 'transparent',
120
+ fontSize: normalize(12),
121
+ color: 'black',
122
+ fontWeight: 'bold',
123
+ outline: 'none',
124
+ paddingLeft: normalize(5),
125
+ }}
126
+ />
127
+ {/* Display text for web (hidden by default, shown when no input) */}
128
+ {!date && (
129
+ <CText style={{
130
+ fontSize: normalize(12),
131
+ color: 'black',
132
+ fontWeight: 'bold',
133
+ position: 'absolute',
134
+ left: normalize(30),
135
+ pointerEvents: 'none',
136
+ }}>
137
+ {moment(date).format('DD-MM-YYYY')}
138
+ </CText>
139
+ )}
140
+ </View>
141
+ </View>
142
+ </View>
143
+ </View>
144
+ );
145
+ }
146
+
147
+ // Native platforms (iOS/Android) render
148
+ return (
149
+ <View style={{ borderWidth: 0, width: data.itemwidth ?? '100%' }}>
150
+ <View style={{ marginTop: normalize(0), paddingHorizontal: 0, borderWidth: 0 }}>
151
+ {props.table !== true && (
152
+ <CText
153
+ style={{
154
+ fontSize: normalize(11),
155
+ paddingHorizontal: normalize(5),
156
+ color: 'black',
157
+ borderWidth: 0,
158
+ height: normalize(16),
159
+ }}
160
+ >
161
+ {props.required && <Text style={{ color: 'red', fontSize: normalize(13), fontWeight: 'bold' }}>* </Text>}
162
+ {data.displaytext ?? 'Date'}
163
+ </CText>
164
+ )}
165
+ <View style={{ elevation: props.table !== true ? 3 : 0 }}>
166
+ <TouchableOpacity
167
+ disabled={props.disabled}
168
+ onPress={showDatepicker}
169
+ style={{
170
+ flexDirection: 'row',
171
+ backgroundColor: data.backgroundColor ?? '#fff',
172
+ height: data.height ?? normalize(35),
173
+ borderColor: 'lightgrey',
174
+ borderWidth: props.table !== true ? 1 : 0,
175
+ borderRadius: 5,
176
+ alignItems: 'center',
177
+ marginHorizontal: normalize(1),
178
+ justifyContent: props.table !== true ? 'flex-start' : 'center',
179
+ }}
180
+ >
181
+ <FontAwesome5
182
+ name="calendar-alt"
183
+ size={normalize(15)}
184
+ color={data.iconcolor ?? 'darkblue'}
185
+ style={{ paddingHorizontal: 5, width: normalize(25) }}
186
+ />
187
+ <CText style={{ fontSize: normalize(12), color: 'black', fontWeight: 'bold' }}>
188
+ {moment(date).format('DD-MM-YYYY')}
189
+ </CText>
190
+ </TouchableOpacity>
191
+ </View>
192
+ </View>
193
+
194
+ {show && (
195
+ <DateTimePicker
196
+ testID="dateTimePicker"
197
+ value={date}
198
+ mode={mode}
199
+ is24Hour={true}
200
+ display="default"
201
+ onChange={onNativeChange}
202
+ maximumDate={props.maxDate ?? new Date('2050-01-01')}
203
+ minimumDate={props.minDate ?? undefined}
204
+ />
205
+ )}
206
+ </View>
207
+ );
208
+ }
@@ -0,0 +1,253 @@
1
+ import React, { useState, useRef } from 'react';
2
+ import { View, TouchableOpacity, Platform, Dimensions, Text } from 'react-native';
3
+ import DateTimePicker from '@react-native-community/datetimepicker';
4
+ import CText from '../CustomComponents/CText';
5
+ import FontAwesome5 from 'react-native-vector-icons/FontAwesome5';
6
+ import { normalize } from '../CommonStyle/componentStyle';
7
+ import moment from 'moment';
8
+ import { Global } from '../Common/Global';
9
+ import { isNU, ValueCheck } from '../CommonStyle/ComponentFunctions';
10
+ import HOCIcons from '../HOC/HOCIcons';
11
+
12
+ export default function SDatePickerLabel(props) {
13
+ const [data, setData] = useState(props.data != undefined ? props.data : {});
14
+ const [date, setDate] = useState(props.passingDate != undefined ? new Date(props.passingDate) : new Date());
15
+ const [minimumdate, setMinimumDate] = useState(isNU(props.minimumdate) ? new Date(props.minimumdate) : new Date());
16
+ const [mode, setMode] = useState('date');
17
+ const [show, setShow] = useState(false);
18
+
19
+ const webInputRef = useRef(null);
20
+
21
+ // Handle date change for native platforms
22
+ const onNativeChange = (event, selectedDate) => {
23
+ setShow(Platform.OS === 'ios');
24
+
25
+ if (event && event.type == 'set') {
26
+ const currentDate = selectedDate || date;
27
+ setDate(currentDate);
28
+ setData({ ...data, ['value']: currentDate });
29
+
30
+ if (props.onChangeData) {
31
+ props.onChangeData(currentDate);
32
+ }
33
+
34
+ console.log('onChangeData', currentDate);
35
+ }
36
+ };
37
+
38
+ // Handle date change for web platform
39
+ const onWebChange = (e) => {
40
+ const value = e.target.value;
41
+ if (!value) {return;}
42
+
43
+ const selectedDate = new Date(value + 'T00:00:00');
44
+ if (isNaN(selectedDate.getTime())) {return;}
45
+
46
+ setDate(selectedDate);
47
+ setData({ ...data, ['value']: selectedDate });
48
+
49
+ if (props.onChangeData) {
50
+ props.onChangeData(selectedDate);
51
+ }
52
+
53
+ console.log('onChangeData web', selectedDate);
54
+ };
55
+
56
+ // Get minimum date for web input
57
+ const getWebMinDate = () => {
58
+ if (!isNU(props.minimumdate) && minimumdate instanceof Date) {
59
+ return minimumdate.toISOString().split('T')[0];
60
+ }
61
+ return undefined;
62
+ };
63
+
64
+ // Get web input value in YYYY-MM-DD format
65
+ const getWebInputValue = () => {
66
+ if (!(date instanceof Date) || isNaN(date.getTime())) {return '';}
67
+ return date.toISOString().split('T')[0];
68
+ };
69
+
70
+ const showMode = (currentMode) => {
71
+ setShow(true);
72
+ setMode(currentMode);
73
+ };
74
+
75
+ const showDatepicker = () => {
76
+ showMode('date');
77
+ };
78
+
79
+ // Focus web input when icon is clicked
80
+ const handleWebIconClick = () => {
81
+ if (webInputRef.current && !props.disabled) {
82
+ webInputRef.current.focus();
83
+ webInputRef.current.showPicker?.(); // This works in modern browsers
84
+ }
85
+ };
86
+
87
+ // Web-specific render
88
+ if (Platform.OS === 'web') {
89
+ return (
90
+ <View style={{
91
+ width: data.itemwidth != undefined ? data.itemwidth : Dimensions.get('screen').width * 0.5,
92
+ borderWidth: 0,
93
+ }}>
94
+ {props.disableplaceholder && isNU(props.table) ?
95
+ <Text
96
+ style={{
97
+ borderWidth: 0,
98
+ fontSize: normalize(9),
99
+ color: 'black',
100
+ }}
101
+ >
102
+ {data.displaytext != undefined ? data.displaytext : 'Date'}
103
+ </Text>
104
+ : null}
105
+
106
+ <View style={props.pickerstyle ?
107
+ props.pickerstyle :
108
+ {
109
+ flexDirection: 'row',
110
+ backgroundColor: '#fff',
111
+ width: ValueCheck(props.width) ? props.width : null,
112
+ borderColor: 'lightgrey',
113
+ borderWidth: props.table != undefined && props.table != true ? 1 : 0,
114
+ borderRadius: 5,
115
+ alignItems: 'center',
116
+ height: normalize(30),
117
+ elevation: props.table != undefined && props.table != true ? 3 : 0,
118
+ justifyContent: props.table != undefined && props.table != true ? 'flex-start' : 'flex-start',
119
+ }}
120
+ > <div
121
+ onClick={handleWebIconClick}
122
+ style={{ cursor: props.disabled ? 'not-allowed' : 'pointer' }}
123
+ >
124
+ {props.icon ?
125
+
126
+ <HOCIcons.Icons
127
+ icongroup={isNU(props.icon.icongroup) ? props.icon.icongroup : 5}
128
+ name={props.icon.name}
129
+ size={props.icon.size}
130
+ style={props.iconstyle}
131
+ />
132
+ :
133
+ <FontAwesome5
134
+ name={'calendar-alt'}
135
+ size={normalize(15)}
136
+ color={Global.AppTheme.primary_color}
137
+ style={{ width: normalize(25) }}
138
+ />
139
+ }
140
+ </div>
141
+
142
+ {/* Hidden HTML date input */}
143
+ <input
144
+ ref={webInputRef}
145
+ type="date"
146
+ value={getWebInputValue()}
147
+ onChange={onWebChange}
148
+ // min={getWebMinDate()}
149
+ disabled={props.disabled}
150
+ style={{
151
+ flex: 1,
152
+ height: '100%',
153
+ border: 'none',
154
+ backgroundColor: 'transparent',
155
+ fontSize: normalize(14),
156
+ color: 'black',
157
+ fontWeight: 'bold',
158
+ outline: 'none',
159
+ paddingLeft: normalize(5),
160
+ opacity: 0,
161
+ position: 'absolute',
162
+ width: '100%',
163
+ left: normalize(25),
164
+ cursor: props.disabled ? 'not-allowed' : 'pointer',
165
+ }}
166
+ />
167
+
168
+ {/* Display text that shows the formatted date */}
169
+ <Text style={props.textstyle ? props.textstyle : {
170
+ fontSize: normalize(14),
171
+ color: 'black',
172
+ fontWeight: 'bold',
173
+ marginLeft: normalize(5),
174
+ pointerEvents: 'none',
175
+ userSelect: 'none',
176
+ }}>
177
+ {moment(date).format('DD-MM-YYYY')}
178
+ </Text>
179
+ </View>
180
+ </View>
181
+ );
182
+ }
183
+
184
+ // Native platforms (iOS/Android) render
185
+ return (
186
+ <View style={{
187
+ width: data.itemwidth != undefined ? data.itemwidth : Dimensions.get('screen').width * 0.5,
188
+ borderWidth: 0,
189
+ }}>
190
+ {props.disableplaceholder && isNU(props.table) ?
191
+ <Text
192
+ style={{
193
+ borderWidth: 0,
194
+ fontSize: normalize(9),
195
+ color: 'black',
196
+ }}
197
+ >
198
+ {data.displaytext != undefined ? data.displaytext : 'Date'}
199
+ </Text>
200
+ : null}
201
+
202
+ <TouchableOpacity
203
+ disabled={props.disabled ? true : false}
204
+ onPress={() => showDatepicker()}
205
+ style={props.pickerstyle ?
206
+ props.pickerstyle :
207
+ {
208
+ flexDirection: 'row',
209
+ backgroundColor: '#fff',
210
+ width: ValueCheck(props.width) ? props.width : null,
211
+ borderColor: 'lightgrey',
212
+ borderWidth: props.table != undefined && props.table != true ? 1 : 0,
213
+ borderRadius: 5,
214
+ alignItems: 'center',
215
+ height: normalize(30),
216
+ elevation: props.table != undefined && props.table != true ? 3 : 0,
217
+ justifyContent: props.table != undefined && props.table != true ? 'flex-start' : 'flex-start',
218
+ }}
219
+ >
220
+ {props.icon ?
221
+ <HOCIcons.Icons
222
+ icongroup={isNU(props.icon.icongroup) ? props.icon.icongroup : 5}
223
+ name={props.icon.name}
224
+ size={props.icon.size}
225
+ style={props.iconstyle}
226
+ />
227
+ :
228
+ <FontAwesome5
229
+ name={'calendar-alt'}
230
+ size={normalize(15)}
231
+ color={Global.AppTheme.primary_color}
232
+ style={{ width: normalize(25) }}
233
+ />
234
+ }
235
+ <Text style={props.textstyle ? props.textstyle : { fontSize: normalize(14), color: 'black', fontWeight: 'bold' }}>
236
+ {moment(date).format('DD-MM-YYYY')}
237
+ </Text>
238
+ </TouchableOpacity>
239
+
240
+ {show && (
241
+ <DateTimePicker
242
+ minimumDate={isNU(props.minimumdate) ? minimumdate : null}
243
+ testID={'dateTimePicker'}
244
+ value={date}
245
+ mode={'date'}
246
+ is24Hour={true}
247
+ display="default"
248
+ onChange={onNativeChange}
249
+ />
250
+ )}
251
+ </View>
252
+ );
253
+ }