fln-espranza 1.1.12 → 1.1.14

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.
@@ -0,0 +1,57 @@
1
+ import moment from 'moment'
2
+ import React, { useState } from 'react'
3
+ import { View, TouchableOpacity } from 'react-native'
4
+ import { ClockIcon } from 'react-native-heroicons/solid'
5
+ import { onChange } from 'react-native-reanimated'
6
+ import DateTimePicker from '@react-native-community/datetimepicker';
7
+ import tw from '../../../lib/tailwind'
8
+ import { CalendarIcon } from 'react-native-heroicons/outline';
9
+ import EText from './EText';
10
+ import ELabel from './ELabel';
11
+
12
+ interface IProps {
13
+ label: string;
14
+ value: string;
15
+ onChange: (value: string) => void;
16
+ style?: string;
17
+ maxDate?: Date;
18
+ minDate?: Date;
19
+ }
20
+
21
+ export default function EDateInput({ label, value, style, maxDate, minDate, onChange }: IProps) {
22
+ // const [date, setDate] = useState(new Date());
23
+ const [show, setShow] = useState(false);
24
+
25
+ const handleOnChange = (event: any, selectedDate: any) => {
26
+ const currentDate = selectedDate;
27
+ setShow(false);
28
+ // setDate(currentDate);
29
+ onChange(moment(currentDate).format(" MMM DD, YYYY"));
30
+ }
31
+
32
+ return (
33
+
34
+ <View style={tw`flex-1 ${style ? style : ""}`}>
35
+ <ELabel label={label} />
36
+ <TouchableOpacity
37
+ style={tw`h-12 rounded-lg px-4 flex-row justify-between items-center border border-slate-300 lowercase my-2 bg-white`}
38
+ onPress={() => setShow(true)}
39
+ >
40
+ <EText size={"sm"} style={tw`font-normal`}>
41
+ {
42
+ value ? value : "Select Date"
43
+ }
44
+ </EText>
45
+ {show ? <DateTimePicker
46
+ testID="dateTimePicker"
47
+ value={value ? new Date(value) : new Date()}
48
+ mode={"date"}
49
+ onChange={handleOnChange}
50
+ minimumDate={minDate}
51
+ maximumDate={maxDate}
52
+ /> : <></>}
53
+ <CalendarIcon size={20} style={tw`text-slate-500`} />
54
+ </TouchableOpacity>
55
+ </View>
56
+ )
57
+ }
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import { View } from 'react-native';
3
+ import tw from '../lib/tailwind';
4
+ import EText from './EText';
5
+
6
+
7
+ interface IProps {
8
+ error: string;
9
+ }
10
+
11
+ export default function EErrorText( { error }: IProps ) {
12
+ return (
13
+ <View>
14
+ <EText size={"xs"} style={tw`text-red-500`}>
15
+ {error}
16
+ </EText>
17
+ </View>
18
+ )
19
+ }
@@ -7,14 +7,17 @@ import EText from './EText';
7
7
  interface IProps {
8
8
  title: string;
9
9
  active?: boolean;
10
+ onPress?: () => void;
10
11
  }
11
12
 
12
- export default function EPillButton( { title, active }: IProps) {
13
+ export default function EPillButton( { title, active, onPress }: IProps) {
13
14
  return (
14
15
  <TouchableOpacity style={[tw`px-4 py-3 mr-2 border rounded-lg border-slate-300`, {
15
16
  backgroundColor: active ? Colors['secondary-base'] : "transparent",
16
17
  borderColor: active ? Colors['secondary-base'] : Colors['border'],
17
- }]}>
18
+ }]}
19
+ onPress={onPress}
20
+ >
18
21
  <EText size={"sm"} style={tw`font-normal ${active ? "text-white" : "text-slate-500"}`}>
19
22
  {title}
20
23
  </EText>
@@ -7,7 +7,7 @@ import EText from './EText';
7
7
 
8
8
  interface IProps {
9
9
  name: string;
10
- subjectName: string;
10
+ subjectName?: string;
11
11
  border?: boolean;
12
12
  children?: JSX.Element;
13
13
  titleSize: string;
@@ -0,0 +1,55 @@
1
+ import moment from 'moment'
2
+ import React, { useState } from 'react'
3
+ import { View, TouchableOpacity } from 'react-native'
4
+ import { ClockIcon } from 'react-native-heroicons/outline'
5
+ import { onChange } from 'react-native-reanimated'
6
+ import DateTimePicker from '@react-native-community/datetimepicker';
7
+ import tw from '../../../lib/tailwind'
8
+ import EText from './EText';
9
+ import ELabel from './ELabel';
10
+
11
+ interface IProps {
12
+ label: string;
13
+ value: string;
14
+ onChange: (value: string) => void;
15
+ style?: string;
16
+ }
17
+
18
+ export default function ETimeInput( { label, value,style, onChange }: IProps ) {
19
+ const [date, setDate] = useState(new Date());
20
+ const [show, setShow] = useState(false);
21
+
22
+ const handleOnChange = (event: any, selectedDate: any) => {
23
+ const currentDate = selectedDate;
24
+ setShow(false);
25
+ setDate(currentDate);
26
+ onChange(moment(currentDate).format("hh:mm A"));
27
+ }
28
+
29
+ return (
30
+
31
+ <View style={tw`flex-1 ${ style ? style : ""}`}>
32
+ <ELabel label={label} />
33
+ <TouchableOpacity
34
+ style={tw`h-12 rounded-lg px-4 flex-row justify-between items-center border border-slate-300 lowercase my-2 bg-white`}
35
+ onPress={() => setShow(true)}
36
+ >
37
+ <EText size={"sm"} style={tw`font-normal`}>
38
+ {
39
+ // value ? value : moment(date).format("hh:mm A")
40
+ value ? value : "Select Time"
41
+ }
42
+ </EText>
43
+ {show ? <DateTimePicker
44
+ testID="dateTimePicker"
45
+ value={date}
46
+ mode={"time"}
47
+ is24Hour={false}
48
+ onChange={handleOnChange}
49
+ /> : <></>}
50
+ <ClockIcon size={20} style={tw`text-slate-500`} />
51
+ </TouchableOpacity>
52
+ </View>
53
+ )
54
+ }
55
+
package/index.ts CHANGED
@@ -29,6 +29,9 @@ import Spacer from "./components/Spacer";
29
29
  import { Colors } from "./utils/Color";
30
30
  import ProgressBar from "./components/ProgressBar";
31
31
  import Loader from "./components/Loader";
32
+ import ETimeInput from "./components/ETimeInput";
33
+ import EDateInput from "./components/EDateInput";
34
+ import EErrorText from "./components/EErrorText";
32
35
 
33
36
  export {
34
37
  Avatar,
@@ -61,6 +64,9 @@ export {
61
64
  Timer,
62
65
  ProgressBar,
63
66
  Loader,
67
+ ETimeInput,
68
+ EDateInput,
69
+ EErrorText,
64
70
  Colors
65
71
 
66
72
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fln-espranza",
3
- "version": "1.1.12",
3
+ "version": "1.1.14",
4
4
  "description": "All components used inside FLN Project of Espranza Innovations",
5
5
  "main": "index.ts",
6
6
  "scripts": {
@@ -18,6 +18,9 @@
18
18
  "@react-navigation/drawer": "^6.5.0",
19
19
  "@react-navigation/native": "^6.0.10",
20
20
  "@react-navigation/native-stack": "^6.6.2",
21
- "react-native-heroicons": "^2.2.0"
21
+ "react-native-heroicons": "^2.2.0",
22
+ "moment": "^2.29.4",
23
+ "@react-native-community/datetimepicker": "6.1.2",
24
+ "react-native-reanimated": "~2.8.0"
22
25
  }
23
26
  }