react-native-exp-fig 0.1.37 → 0.1.39

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 (49) hide show
  1. package/lib/commonjs/components/modal-create-activitie/index.js +13 -11
  2. package/lib/commonjs/components/modal-create-activitie/index.js.map +1 -1
  3. package/lib/commonjs/components/modal-create-activitie/interface.js.map +1 -1
  4. package/lib/commonjs/components/modal-journey-rectification/index.js +10 -10
  5. package/lib/commonjs/components/modal-journey-rectification/index.js.map +1 -1
  6. package/lib/commonjs/components/modals/modal-activities/data-activities/index.js +25 -1
  7. package/lib/commonjs/components/modals/modal-activities/data-activities/index.js.map +1 -1
  8. package/lib/commonjs/components/modals/modal-activity-reason/index.js +6 -5
  9. package/lib/commonjs/components/modals/modal-activity-reason/index.js.map +1 -1
  10. package/lib/commonjs/components/modals/modal-activity-reason/interface.d.js.map +1 -1
  11. package/lib/commonjs/components/modals/modal-change-activity/index.js.map +1 -1
  12. package/lib/commonjs/components/selects/select-option/index.js +4 -4
  13. package/lib/commonjs/components/selects/select-option/index.js.map +1 -1
  14. package/lib/commonjs/components/selects/select-option/interface.d.js.map +1 -1
  15. package/lib/commonjs/stories/modal-activity-reason/modal-activity-reason.stories.js +8 -8
  16. package/lib/commonjs/stories/modal-activity-reason/modal-activity-reason.stories.js.map +1 -1
  17. package/lib/commonjs/stories/modal-create-activitie/modal-create-activitie.stories.js +5 -1
  18. package/lib/commonjs/stories/modal-create-activitie/modal-create-activitie.stories.js.map +1 -1
  19. package/lib/module/components/modal-create-activitie/index.js +13 -11
  20. package/lib/module/components/modal-create-activitie/index.js.map +1 -1
  21. package/lib/module/components/modal-create-activitie/interface.js.map +1 -1
  22. package/lib/module/components/modal-journey-rectification/index.js +10 -10
  23. package/lib/module/components/modal-journey-rectification/index.js.map +1 -1
  24. package/lib/module/components/modals/modal-activities/data-activities/index.js +24 -0
  25. package/lib/module/components/modals/modal-activities/data-activities/index.js.map +1 -1
  26. package/lib/module/components/modals/modal-activity-reason/index.js +6 -5
  27. package/lib/module/components/modals/modal-activity-reason/index.js.map +1 -1
  28. package/lib/module/components/modals/modal-activity-reason/interface.d.js.map +1 -1
  29. package/lib/module/components/modals/modal-change-activity/index.js.map +1 -1
  30. package/lib/module/components/selects/select-option/index.js +4 -4
  31. package/lib/module/components/selects/select-option/index.js.map +1 -1
  32. package/lib/module/components/selects/select-option/interface.d.js.map +1 -1
  33. package/lib/module/stories/modal-activity-reason/modal-activity-reason.stories.js +8 -8
  34. package/lib/module/stories/modal-activity-reason/modal-activity-reason.stories.js.map +1 -1
  35. package/lib/module/stories/modal-create-activitie/modal-create-activitie.stories.js +5 -1
  36. package/lib/module/stories/modal-create-activitie/modal-create-activitie.stories.js.map +1 -1
  37. package/lib/typescript/src/components/modals/modal-activities/data-activities/index.d.ts +7 -0
  38. package/package.json +4 -8
  39. package/src/components/modal-create-activitie/index.tsx +215 -211
  40. package/src/components/modal-create-activitie/interface.ts +22 -22
  41. package/src/components/modal-journey-rectification/index.tsx +213 -211
  42. package/src/components/modals/modal-activities/data-activities/index.ts +31 -0
  43. package/src/components/modals/modal-activity-reason/index.tsx +163 -162
  44. package/src/components/modals/modal-activity-reason/interface.d.ts +10 -10
  45. package/src/components/modals/modal-change-activity/index.tsx +1 -1
  46. package/src/components/selects/select-option/index.tsx +124 -124
  47. package/src/components/selects/select-option/interface.d.ts +18 -18
  48. package/src/stories/modal-activity-reason/modal-activity-reason.stories.tsx +192 -192
  49. package/src/stories/modal-create-activitie/modal-create-activitie.stories.tsx +4 -0
@@ -1,211 +1,215 @@
1
- /**
2
- * IMPORTS
3
- */
4
- import React, { useMemo, useState, useCallback } from "react";
5
- import { Modal, View, Pressable } from "react-native";
6
-
7
- // components
8
- import Box from "..//box";
9
- import { Button }from "../button";
10
-
11
- import { Typography } from "../typography";
12
-
13
- import ActivityFields from "../selects/select-date-and-hours";
14
-
15
- import SelectOption from "../selects/select-option";
16
-
17
- // commons
18
- import { Icons } from "../../common/icons-svg";
19
- import { asBaseComponent } from "../../@types/as-base-component";
20
-
21
- // helpers
22
- import { OPTIONS } from "../../utils/options-activity";
23
-
24
- // typings
25
- import type { IDateAndHoursProps, IModalCreateActivitieProps } from "./interface";
26
-
27
- // styles / theme
28
- import { theme } from "../../styles/theme/theme";
29
- import { styles } from "./styles";
30
- import { formatDate, formHoursMinute } from "../../utils/format-data";
31
-
32
- const ModalCreteActivitie: React.FC<IModalCreateActivitieProps<any>> = React.memo(
33
- ({ visible, onClose, onPressConfirm, textTitle }) => {
34
- const [dateAndHours, setDateAndHours] = useState<IDateAndHoursProps>({
35
- date: formatDate(new Date()),
36
- hours: formHoursMinute(String(new Date().getHours() * 3600 + new Date().getMinutes() * 60)),
37
- });
38
-
39
- // estados controlados mínimos
40
- const [selectedActivitie, setSelectedActivitie] = useState<string | null>(
41
- OPTIONS[0]?.value ?? null
42
- );
43
-
44
- // label do motivo derivada com memo
45
- const activitieLabel = useMemo(
46
- () => OPTIONS.find((activitie) => activitie.value === selectedActivitie)?.label ?? null,
47
- [selectedActivitie]
48
- );
49
-
50
- // handlers estáveis
51
- const handleChangeReason = useCallback((value: string | null) => {
52
- setSelectedActivitie(value);
53
- }, []);
54
-
55
- const handleCancel = useCallback(() => {
56
- onClose?.();
57
- }, [onClose]);
58
-
59
- const handleConfirm = useCallback(() => {
60
- onPressConfirm?.({
61
- reasonValue: selectedActivitie,
62
- label: activitieLabel,
63
- dateAndHours: dateAndHours,
64
- });
65
-
66
- onClose?.();
67
- }, [onPressConfirm, onClose, activitieLabel, selectedActivitie, dateAndHours]);
68
-
69
- return (
70
- <Modal
71
- animationType="fade"
72
- transparent
73
- visible={visible}
74
- onRequestClose={handleCancel}
75
- statusBarTranslucent
76
- >
77
- <Pressable style={styles.overlay} onPress={handleCancel}>
78
- <Box
79
- width="90%"
80
- backgroundColor={theme.colors.orange[500]}
81
- borderStyled={{ borderRadius: theme.borderWidths.thick_medium }}
82
- paddingStyle={{
83
- paddingLeft: theme.paddings["2xs"],
84
- paddingRight: theme.paddings["2xs"],
85
- paddingTop: theme.paddings.sm,
86
- paddingBottom: theme.paddings.sm,
87
- }}
88
- >
89
- <View style={styles.headerRow}>
90
- <Icons
91
- icon="EXCLAMATION_TRIANGLE"
92
- color={theme.colors.orange[500]}
93
- background={theme.colors.neutral[300]}
94
- size={22}
95
- />
96
- <Typography
97
- text={textTitle ?? "Incluir atividade"}
98
- color={theme.colors.neutral[25]}
99
- marginLeft={theme.margins["2xs"]}
100
- fontFamily={theme.fonts.inter_bold}
101
- fontWeight="700"
102
- size={theme.fontSizes.lg}
103
- />
104
- </View>
105
-
106
- <Box
107
- backgroundColor={theme.colors.neutral[300]}
108
- paddingStyle={{ padding: theme.paddings.xs }}
109
- borderStyled={{ borderRadius: theme.borderWidths.thick_medium }}
110
- >
111
- <Typography
112
- text="Preencha os dados da atividade que deseja incluir."
113
- color={theme.colors.black[100]}
114
- fontFamily={theme.fonts.inter_regular_400}
115
- fontWeight="400"
116
- lineHeight={theme.lineHeight["2xl"]}
117
- size={theme.fontSizes.sm}
118
- marginBottom={16}
119
- />
120
-
121
- <SelectOption
122
- titleLabel="Selecione um motivo"
123
- sizeTitleLabel={18}
124
- dataOption={OPTIONS as any}
125
- handleSelectDown={handleChangeReason}
126
- backgroundColor={theme.colors.neutral[300]}
127
- />
128
-
129
- <ActivityFields
130
- disabled={false}
131
- icon={"CALENDAR"}
132
- value={dateAndHours?.date}
133
- onPressConfirm={(value) =>
134
- setDateAndHours({ date: value, hours: dateAndHours?.hours })
135
- }
136
- />
137
-
138
- <ActivityFields
139
- disabled={false}
140
- icon={"TIMER"}
141
- value={dateAndHours?.hours}
142
- onPressConfirm={(value) =>
143
- setDateAndHours({ date: dateAndHours?.date, hours: value })
144
- }
145
- />
146
-
147
- <View style={styles.actions}>
148
- <Button
149
- title="CANCELAR"
150
- onPress={handleCancel}
151
- width="48%"
152
- height={40}
153
- isLoading={false}
154
- disabled={false}
155
- backgroundColor={theme.colors.neutral[300]}
156
- buttonTextStyle={{
157
- color: theme.colors.blue[500],
158
- fontFamily: theme.fonts.inter_medium_500,
159
- fontSize: theme.fontSizes.xs,
160
- fontWeight: "500",
161
- }}
162
- flexStyle={{
163
- flexDirection: "row",
164
- alignItems: "center",
165
- justifyContent: "center",
166
- textAlign: "center",
167
- }}
168
- borderStyled={{
169
- borderWidth: theme.borderWidths.thin,
170
- borderColor: theme.colors.blue[100],
171
- borderRadius: theme.borderWidths.thick_medium,
172
- }}
173
- />
174
-
175
- <Button
176
- title="CONFIRMAR"
177
- onPress={handleConfirm}
178
- width="48%"
179
- height={40}
180
- isLoading={false}
181
- disabled={false}
182
- backgroundColor={theme.colors.blue[500]}
183
- buttonTextStyle={{
184
- color: theme.colors.neutral[25],
185
- fontFamily: theme.fonts.inter_medium_500,
186
- fontSize: theme.fontSizes.xs,
187
- fontWeight: "500",
188
- }}
189
- flexStyle={{
190
- flexDirection: "row",
191
- alignItems: "center",
192
- justifyContent: "center",
193
- textAlign: "center",
194
- }}
195
- borderStyled={{
196
- borderWidth: theme.borderWidths.thin,
197
- borderColor: theme.colors.blue[100],
198
- borderRadius: theme.borderWidths.thick_medium,
199
- }}
200
- />
201
- </View>
202
- </Box>
203
- </Box>
204
- </Pressable>
205
- </Modal>
206
- );
207
- }
208
- );
209
-
210
- ModalCreteActivitie.displayName = "ModalCreteActivitie";
211
- export default asBaseComponent(ModalCreteActivitie);
1
+ /**
2
+ * IMPORTS
3
+ */
4
+ import React, { useMemo, useState, useCallback } from "react";
5
+ import { Modal, View, Pressable } from "react-native";
6
+
7
+ // components
8
+ import Box from "../box";
9
+ import { Button } from "../button";
10
+
11
+ import { Typography } from "../typography";
12
+
13
+ import ActivityFields from "../selects/select-date-and-hours";
14
+
15
+ import SelectOption from "../selects/select-option";
16
+
17
+ // commons
18
+ import { Icons } from "../../common/icons-svg";
19
+ import { asBaseComponent } from "../../@types/as-base-component";
20
+
21
+ // helpers
22
+ import { retificacaoActivities } from "../modals/modal-activities/data-activities";
23
+
24
+ // utils
25
+ import { formatDate, formHoursMinute } from "../../utils/format-data";
26
+
27
+ // typings
28
+ import type { IDateAndHoursProps, IModalCreateActivitieProps } from "./interface";
29
+
30
+ // styles / theme
31
+ import { theme } from "../../styles/theme/theme";
32
+ import { styles } from "./styles";
33
+
34
+ const ModalCreteActivitie: React.FC<IModalCreateActivitieProps<any>> = React.memo(
35
+ ({ visible, onClose, onPressConfirm, textTitle }) => {
36
+ const [dateAndHours, setDateAndHours] = useState<IDateAndHoursProps>({
37
+ date: formatDate(new Date()),
38
+ hours: formHoursMinute(String(new Date().getHours() * 3600 + new Date().getMinutes() * 60)),
39
+ });
40
+
41
+ // estados controlados mínimos
42
+ const [selectedActivitie, setSelectedActivitie] = useState<number | null>(
43
+ retificacaoActivities[0]?.value ?? null
44
+ );
45
+
46
+ // label do motivo derivada com memo
47
+ const activitieLabel = useMemo(
48
+ () =>
49
+ retificacaoActivities?.find((activitie) => activitie?.value === selectedActivitie)?.label ??
50
+ null,
51
+ [selectedActivitie]
52
+ );
53
+
54
+ // handlers estáveis
55
+ const handleChangeReason = useCallback((value: number | null) => {
56
+ setSelectedActivitie(value);
57
+ }, []);
58
+
59
+ const handleCancel = useCallback(() => {
60
+ onClose?.();
61
+ }, [onClose]);
62
+
63
+ const handleConfirm = useCallback(() => {
64
+ onPressConfirm?.({
65
+ value: selectedActivitie,
66
+ label: activitieLabel,
67
+ dateAndHours: dateAndHours,
68
+ });
69
+
70
+ onClose?.();
71
+ }, [onPressConfirm, onClose, activitieLabel, selectedActivitie, dateAndHours]);
72
+
73
+ return (
74
+ <Modal
75
+ animationType="fade"
76
+ transparent
77
+ visible={visible}
78
+ onRequestClose={handleCancel}
79
+ statusBarTranslucent
80
+ >
81
+ <Pressable style={styles.overlay} onPress={handleCancel}>
82
+ <Box
83
+ width="90%"
84
+ backgroundColor={theme.colors.orange[500]}
85
+ borderStyled={{ borderRadius: theme.borderWidths.thick_medium }}
86
+ paddingStyle={{
87
+ paddingLeft: theme.paddings["2xs"],
88
+ paddingRight: theme.paddings["2xs"],
89
+ paddingTop: theme.paddings.sm,
90
+ paddingBottom: theme.paddings.sm,
91
+ }}
92
+ >
93
+ <View style={styles.headerRow}>
94
+ <Icons
95
+ icon="EXCLAMATION_TRIANGLE"
96
+ color={theme.colors.orange[500]}
97
+ background={theme.colors.neutral[300]}
98
+ size={22}
99
+ />
100
+ <Typography
101
+ text={textTitle ?? "Incluir atividade"}
102
+ color={theme.colors.neutral[25]}
103
+ marginLeft={theme.margins["2xs"]}
104
+ fontFamily={theme.fonts.inter_bold}
105
+ fontWeight="700"
106
+ size={theme.fontSizes.lg}
107
+ />
108
+ </View>
109
+
110
+ <Box
111
+ backgroundColor={theme.colors.neutral[300]}
112
+ paddingStyle={{ padding: theme.paddings.xs }}
113
+ borderStyled={{ borderRadius: theme.borderWidths.thick_medium }}
114
+ >
115
+ <Typography
116
+ text="Preencha os dados da atividade que deseja incluir."
117
+ color={theme.colors.black[100]}
118
+ fontFamily={theme.fonts.inter_regular_400}
119
+ fontWeight="400"
120
+ lineHeight={theme.lineHeight["2xl"]}
121
+ size={theme.fontSizes.sm}
122
+ marginBottom={16}
123
+ />
124
+
125
+ <SelectOption
126
+ titleLabel="Selecione um motivo"
127
+ sizeTitleLabel={18}
128
+ dataOption={retificacaoActivities as any}
129
+ handleSelectDown={handleChangeReason}
130
+ backgroundColor={theme.colors.neutral[300]}
131
+ />
132
+
133
+ <ActivityFields
134
+ disabled={false}
135
+ icon={"CALENDAR"}
136
+ value={dateAndHours?.date}
137
+ onPressConfirm={(value) =>
138
+ setDateAndHours({ date: value, hours: dateAndHours?.hours })
139
+ }
140
+ />
141
+
142
+ <ActivityFields
143
+ disabled={false}
144
+ icon={"TIMER"}
145
+ value={dateAndHours?.hours}
146
+ onPressConfirm={(value) =>
147
+ setDateAndHours({ date: dateAndHours?.date, hours: value })
148
+ }
149
+ />
150
+
151
+ <View style={styles.actions}>
152
+ <Button
153
+ title="CANCELAR"
154
+ onPress={handleCancel}
155
+ width="48%"
156
+ height={40}
157
+ isLoading={false}
158
+ disabled={false}
159
+ backgroundColor={theme.colors.neutral[300]}
160
+ buttonTextStyle={{
161
+ color: theme.colors.blue[500],
162
+ fontFamily: theme.fonts.inter_medium_500,
163
+ fontSize: theme.fontSizes.xs,
164
+ fontWeight: "500",
165
+ }}
166
+ flexStyle={{
167
+ flexDirection: "row",
168
+ alignItems: "center",
169
+ justifyContent: "center",
170
+ textAlign: "center",
171
+ }}
172
+ borderStyled={{
173
+ borderWidth: theme.borderWidths.thin,
174
+ borderColor: theme.colors.blue[100],
175
+ borderRadius: theme.borderWidths.thick_medium,
176
+ }}
177
+ />
178
+
179
+ <Button
180
+ title="CONFIRMAR"
181
+ onPress={handleConfirm}
182
+ width="48%"
183
+ height={40}
184
+ isLoading={false}
185
+ disabled={false}
186
+ backgroundColor={theme.colors.blue[500]}
187
+ buttonTextStyle={{
188
+ color: theme.colors.neutral[25],
189
+ fontFamily: theme.fonts.inter_medium_500,
190
+ fontSize: theme.fontSizes.xs,
191
+ fontWeight: "500",
192
+ }}
193
+ flexStyle={{
194
+ flexDirection: "row",
195
+ alignItems: "center",
196
+ justifyContent: "center",
197
+ textAlign: "center",
198
+ }}
199
+ borderStyled={{
200
+ borderWidth: theme.borderWidths.thin,
201
+ borderColor: theme.colors.blue[100],
202
+ borderRadius: theme.borderWidths.thick_medium,
203
+ }}
204
+ />
205
+ </View>
206
+ </Box>
207
+ </Box>
208
+ </Pressable>
209
+ </Modal>
210
+ );
211
+ }
212
+ );
213
+
214
+ ModalCreteActivitie.displayName = "ModalCreteActivitie";
215
+ export default asBaseComponent(ModalCreteActivitie);
@@ -1,22 +1,22 @@
1
- /* eslint-disable no-unused-vars */
2
- /**
3
- * IMPORTS
4
- */
5
-
6
- type IModalCreateActivitieProps<T> = {
7
- visible: boolean;
8
- textTitle?: string;
9
- options?: T;
10
- onClose: () => void;
11
- onPressConfirm: (value: T) => void;
12
- };
13
-
14
- type IDateAndHoursProps = {
15
- date: string;
16
- hours: string;
17
- };
18
-
19
- /**
20
- * EXPORTS
21
- */
22
- export type { IModalCreateActivitieProps, IDateAndHoursProps };
1
+ /* eslint-disable no-unused-vars */
2
+ /**
3
+ * IMPORTS
4
+ */
5
+
6
+ type IModalCreateActivitieProps<T> = {
7
+ visible: boolean;
8
+ textTitle?: string;
9
+ options?: T;
10
+ onClose: () => void;
11
+ onPressConfirm: (value: T) => void;
12
+ };
13
+
14
+ type IDateAndHoursProps = {
15
+ date: string;
16
+ hours: string;
17
+ };
18
+
19
+ /**
20
+ * EXPORTS
21
+ */
22
+ export type { IModalCreateActivitieProps, IDateAndHoursProps };