ikualo-ui-kit-mobile 1.3.1 → 1.3.2

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": "ikualo-ui-kit-mobile",
3
- "version": "1.3.1",
3
+ "version": "1.3.2",
4
4
  "main": "src/index.ts",
5
5
  "scripts": {
6
6
  "start": "expo start",
@@ -11,7 +11,6 @@
11
11
  "dependencies": {
12
12
  "@expo/metro-runtime": "^4.0.0",
13
13
  "@expo/vector-icons": "^14.0.2",
14
- "@react-native-community/datetimepicker": "8.2.0",
15
14
  "@react-navigation/bottom-tabs": "^6.5.20",
16
15
  "@react-navigation/native": "^6.1.17",
17
16
  "@react-navigation/stack": "^6.3.29",
@@ -24,7 +23,6 @@
24
23
  "react-native": "0.76.5",
25
24
  "react-native-asset": "^2.1.1",
26
25
  "react-native-gesture-handler": "~2.20.2",
27
- "react-native-modal-datetime-picker": "^18.0.0",
28
26
  "react-native-paper": "^5.12.3",
29
27
  "react-native-safe-area-context": "4.12.0",
30
28
  "react-native-screens": "~4.4.0",
@@ -1,5 +1,5 @@
1
1
  import { ScrollView, View } from 'react-native';
2
- import { InputCheckbox, Input, InputEmail, InputPassword, Text, InputDateTime } from '../..';
2
+ import { InputCheckbox, Input, InputEmail, InputPassword, Text } from '../..';
3
3
  import { useState } from 'react';
4
4
  import useStore from '../../store';
5
5
 
@@ -23,22 +23,6 @@ export const InputsExamples = () => {
23
23
  <Text fontWeight="MontserratSemiBold600" fontSize={18} color={theme.colors.text_h}>
24
24
  Campos de entrada
25
25
  </Text>
26
- <InputDateTime
27
- lang="es-ES"
28
- textBtnSave="Guardar"
29
- label="Fecha"
30
- onChange={(e) => {
31
- setValueDate(e);
32
- }}
33
- type="date"
34
- value={valueDate}
35
- isValid={true}
36
- onInvalid={() => {}}
37
- msgHelper="Fecha de prueba"
38
- msgError="Error"
39
- required={true}
40
- msgErrorRequired="Campo requerido"
41
- />
42
26
  <Input
43
27
  label="Prueba"
44
28
  onChange={(e) => {
package/src/index.ts CHANGED
@@ -11,7 +11,6 @@ export * from './elements/buttons/BtnCircle';
11
11
  export * from './elements/inputs/InputPassword';
12
12
  export * from './elements/inputs/Input';
13
13
  export * from './elements/inputs/InputEmail';
14
- export * from './elements/inputs/InputDateTime';
15
14
 
16
15
  export * from './elements/timer/Timer';
17
16
 
@@ -1,174 +0,0 @@
1
- import { HelperText, TextInput, Text } from 'react-native-paper';
2
- import { getStyleInput } from '../../../assets/styles/elements/inputs';
3
- import { useState } from 'react';
4
- import { View } from 'react-native';
5
- import React from 'react';
6
- import useStore from '../../store';
7
- import { IInputDate } from '../../models';
8
- import { ErrorInputIcon } from '../../../assets/icons/svgs';
9
- import { MaterialCommunityIcons } from '@expo/vector-icons';
10
- import DateTimePickerModal from 'react-native-modal-datetime-picker';
11
-
12
- export const InputDateTime = (props: IInputDate) => {
13
- const theme = useStore().theme;
14
- const styleInput = getStyleInput(theme);
15
- const [isFocus, setIsFocus] = useState<boolean>(false);
16
- const [errorRequired, setErrorRequired] = useState<boolean>(false);
17
- const [showDialogDate, setDialogDate] = useState<boolean>(false);
18
- const {
19
- label,
20
- lang,
21
- isDisabled,
22
- onChange,
23
- error,
24
- style,
25
- value,
26
- isValid,
27
- onFocus,
28
- onBlur,
29
- type,
30
- onInvalid,
31
- msgHelper,
32
- msgError,
33
- placeholder = lang === 'es-ES' ? 'DD-MM-YYYY' : 'DD-MM-YYYY',
34
- required,
35
- msgErrorRequired,
36
- readonly = true,
37
- textBtnSave,
38
- } = props;
39
- const [isDatePickerVisible, setDatePickerVisibility] = useState(false);
40
-
41
- const showDatePicker = () => {
42
- setDatePickerVisibility(true);
43
- };
44
-
45
- const hideDatePicker = () => {
46
- setDatePickerVisibility(false);
47
- };
48
-
49
- const handleConfirm = (date: any) => {
50
- hideDatePicker();
51
- onChange(date);
52
- setErrorRequired(false);
53
- };
54
-
55
- const formatDate = (date: Date) => {
56
- const day = date.getDate().toString().padStart(2, '0');
57
- const month = (date.getMonth() + 1).toString().padStart(2, '0');
58
- const year = date.getFullYear();
59
- if (type === 'date') {
60
- return `${day}-${month}-${year}`;
61
- } else if (type === 'datetime') {
62
- const hours = date.getHours().toString().padStart(2, '0');
63
- const minutes = date.getMinutes().toString().padStart(2, '0');
64
- return `${day}-${month}-${year} ${hours}:${minutes}`;
65
- } else if (type === 'time') {
66
- const hours = date.getHours().toString().padStart(2, '0');
67
- const minutes = date.getMinutes().toString().padStart(2, '0');
68
- return `${hours}:${minutes}`;
69
- }
70
- };
71
-
72
- return (
73
- <View>
74
- <DateTimePickerModal
75
- isVisible={isDatePickerVisible}
76
- mode="date"
77
- onConfirm={handleConfirm}
78
- onCancel={hideDatePicker}
79
- />
80
- <TextInput
81
- label={label}
82
- mode={'flat'}
83
- value={value ? formatDate(value) : placeholder}
84
- selectionColor={
85
- !errorRequired
86
- ? styleInput['input'].borderBottomColor
87
- : styleInput['input-txt-error'].borderBottomColor
88
- }
89
- theme={{
90
- colors: {
91
- primary: theme.colors.border_dark,
92
- onSurfaceVariant: theme.colors.text_p,
93
- },
94
- }}
95
- onFocus={() => {
96
- setIsFocus(true);
97
- onFocus && onFocus();
98
- }}
99
- onBlur={() => {
100
- setIsFocus(false);
101
- onBlur && onBlur();
102
- if (!value && required) {
103
- setErrorRequired(true);
104
- onInvalid && onInvalid();
105
- }
106
- }}
107
- error={error || errorRequired}
108
- right={
109
- <TextInput.Icon
110
- onPress={() => {
111
- showDatePicker();
112
- }}
113
- icon={(_) =>
114
- type === 'date' || type === 'datetime' ? (
115
- <MaterialCommunityIcons
116
- name="calendar-blank"
117
- size={24}
118
- color={isValid && !errorRequired ? theme.colors.icon : theme.colors.error}
119
- />
120
- ) : (
121
- <MaterialCommunityIcons
122
- name="clock-outline"
123
- size={24}
124
- color={isValid && !errorRequired ? theme.colors.icon : theme.colors.error}
125
- />
126
- )
127
- }
128
- />
129
- }
130
- style={[
131
- styleInput['input-label'],
132
- ((!isValid && value) || errorRequired) && styleInput['input-error-focused'],
133
- isFocus && isValid && !errorRequired && styleInput['input-text--focused'],
134
- style ?? [],
135
- ]}
136
- contentStyle={[styleInput['input-txt']]}
137
- underlineColor={
138
- isValid && !errorRequired
139
- ? styleInput['input-text-underline'].color
140
- : styleInput['input-txt-error'].borderBottomColor
141
- }
142
- activeUnderlineColor={
143
- !isValid && value
144
- ? styleInput['input-text--activeUnderline'].color
145
- : errorRequired
146
- ? styleInput['input-txt-error'].color
147
- : ''
148
- }
149
- readOnly={isDisabled || readonly}
150
- />
151
- {!isDisabled && (
152
- <>
153
- {isValid && !errorRequired && (
154
- <HelperText type="info" style={styleInput['input-password-helper']} visible={true}>
155
- {msgHelper}
156
- </HelperText>
157
- )}
158
- {!isValid && msgError !== undefined && value && !errorRequired && (
159
- <View style={styleInput['input-helper--error-text']}>
160
- <ErrorInputIcon />
161
- <Text style={styleInput['input-password-helper--error-text']}>{msgError}</Text>
162
- </View>
163
- )}
164
- {errorRequired && (
165
- <View style={styleInput['input-helper--error-text']}>
166
- <ErrorInputIcon />
167
- <Text style={styleInput['input-password-helper--error-text']}>{msgErrorRequired}</Text>
168
- </View>
169
- )}
170
- </>
171
- )}
172
- </View>
173
- );
174
- };