react-native-exp-fig 0.1.25 → 0.1.27

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 (199) hide show
  1. package/lib/commonjs/components/input-text-counter/index.js +66 -0
  2. package/lib/commonjs/components/input-text-counter/index.js.map +1 -0
  3. package/lib/commonjs/components/input-text-counter/interface.d.js.map +1 -0
  4. package/lib/commonjs/components/input-text-counter/styles.js +42 -0
  5. package/lib/commonjs/components/input-text-counter/styles.js.map +1 -0
  6. package/lib/commonjs/components/modal-create-activitie/index.js +202 -0
  7. package/lib/commonjs/components/modal-create-activitie/index.js.map +1 -0
  8. package/lib/commonjs/components/modal-create-activitie/interface.js +2 -0
  9. package/lib/commonjs/components/modal-create-activitie/interface.js.map +1 -0
  10. package/lib/commonjs/components/modal-create-activitie/styles.js +42 -0
  11. package/lib/commonjs/components/modal-create-activitie/styles.js.map +1 -0
  12. package/lib/commonjs/components/modal-journey-rectification/index.js +202 -0
  13. package/lib/commonjs/components/modal-journey-rectification/index.js.map +1 -0
  14. package/lib/commonjs/components/modal-journey-rectification/interface.d.js +2 -0
  15. package/lib/commonjs/components/modal-journey-rectification/interface.d.js.map +1 -0
  16. package/lib/commonjs/components/modal-journey-rectification/styles.js +42 -0
  17. package/lib/commonjs/components/modal-journey-rectification/styles.js.map +1 -0
  18. package/lib/commonjs/components/{modal-activities → modals/modal-activities}/data-activities/index.js +2 -2
  19. package/lib/commonjs/components/modals/modal-activities/data-activities/index.js.map +1 -0
  20. package/lib/commonjs/components/{modal-activities → modals/modal-activities}/index.js +8 -8
  21. package/lib/commonjs/components/modals/modal-activities/index.js.map +1 -0
  22. package/lib/commonjs/components/modals/modal-activities/interface.d.js +6 -0
  23. package/lib/commonjs/components/modals/modal-activities/interface.d.js.map +1 -0
  24. package/lib/commonjs/components/modals/modal-activity-reason/index.js +161 -0
  25. package/lib/commonjs/components/modals/modal-activity-reason/index.js.map +1 -0
  26. package/lib/commonjs/components/modals/modal-activity-reason/interface.d.js +2 -0
  27. package/lib/commonjs/components/modals/modal-activity-reason/interface.d.js.map +1 -0
  28. package/lib/commonjs/components/{modal-change-activity → modals/modal-change-activity}/index.js +7 -7
  29. package/lib/commonjs/components/modals/modal-change-activity/index.js.map +1 -0
  30. package/lib/commonjs/components/selects/select-date-and-hours/index.js +95 -0
  31. package/lib/commonjs/components/selects/select-date-and-hours/index.js.map +1 -0
  32. package/lib/commonjs/components/selects/select-date-and-hours/interface.js +6 -0
  33. package/lib/commonjs/components/selects/select-date-and-hours/interface.js.map +1 -0
  34. package/lib/commonjs/components/selects/select-date-and-hours/styles.js +33 -0
  35. package/lib/commonjs/components/selects/select-date-and-hours/styles.js.map +1 -0
  36. package/lib/commonjs/components/selects/select-option/index.js +41 -39
  37. package/lib/commonjs/components/selects/select-option/index.js.map +1 -1
  38. package/lib/commonjs/components/step-indicator/index.js +10 -10
  39. package/lib/commonjs/components/step-indicator/index.js.map +1 -1
  40. package/lib/commonjs/components/step-indicator/interface.d.js.map +1 -1
  41. package/lib/commonjs/index.js +32 -4
  42. package/lib/commonjs/index.js.map +1 -1
  43. package/lib/commonjs/stories/input-text-counter/input-text-counter.stories.js +259 -0
  44. package/lib/commonjs/stories/input-text-counter/input-text-counter.stories.js.map +1 -0
  45. package/lib/commonjs/stories/modal-activities/modal-activities.stories.js +1 -1
  46. package/lib/commonjs/stories/modal-activities/modal-activities.stories.js.map +1 -1
  47. package/lib/commonjs/stories/modal-activity-reason/modal-activity-reason.stories.js +198 -0
  48. package/lib/commonjs/stories/modal-activity-reason/modal-activity-reason.stories.js.map +1 -0
  49. package/lib/commonjs/stories/modal-change-activity/modal-change-activity.stories.js +3 -3
  50. package/lib/commonjs/stories/modal-change-activity/modal-change-activity.stories.js.map +1 -1
  51. package/lib/commonjs/stories/modal-create-activitie/modal-create-activitie.stories.js +86 -0
  52. package/lib/commonjs/stories/modal-create-activitie/modal-create-activitie.stories.js.map +1 -0
  53. package/lib/commonjs/stories/modal-journey-rectification/modal-journey-rectification.stories.js +172 -0
  54. package/lib/commonjs/stories/modal-journey-rectification/modal-journey-rectification.stories.js.map +1 -0
  55. package/lib/commonjs/stories/select-option/select-option.stories.js +3 -2
  56. package/lib/commonjs/stories/select-option/select-option.stories.js.map +1 -1
  57. package/lib/commonjs/stories/step-indicator/step-indicator.stories.js +2 -1
  58. package/lib/commonjs/stories/step-indicator/step-indicator.stories.js.map +1 -1
  59. package/lib/commonjs/styles/theme/theme.js +18 -2
  60. package/lib/commonjs/styles/theme/theme.js.map +1 -1
  61. package/lib/commonjs/utils/options-activity/index.js +27 -0
  62. package/lib/commonjs/utils/options-activity/index.js.map +1 -0
  63. package/lib/commonjs/utils/text-limit/index.js +37 -0
  64. package/lib/commonjs/utils/text-limit/index.js.map +1 -0
  65. package/lib/module/components/input-text-counter/index.js +63 -0
  66. package/lib/module/components/input-text-counter/index.js.map +1 -0
  67. package/lib/module/components/input-text-counter/interface.d.js.map +1 -0
  68. package/lib/module/components/input-text-counter/styles.js +37 -0
  69. package/lib/module/components/input-text-counter/styles.js.map +1 -0
  70. package/lib/module/components/modal-create-activitie/index.js +192 -0
  71. package/lib/module/components/modal-create-activitie/index.js.map +1 -0
  72. package/lib/module/components/modal-create-activitie/interface.js +2 -0
  73. package/lib/module/components/modal-create-activitie/interface.js.map +1 -0
  74. package/lib/module/components/modal-create-activitie/styles.js +37 -0
  75. package/lib/module/components/modal-create-activitie/styles.js.map +1 -0
  76. package/lib/module/components/modal-journey-rectification/index.js +192 -0
  77. package/lib/module/components/modal-journey-rectification/index.js.map +1 -0
  78. package/lib/module/components/modal-journey-rectification/interface.d.js +2 -0
  79. package/lib/module/components/modal-journey-rectification/interface.d.js.map +1 -0
  80. package/lib/module/components/modal-journey-rectification/styles.js +37 -0
  81. package/lib/module/components/modal-journey-rectification/styles.js.map +1 -0
  82. package/lib/module/components/{modal-activities → modals/modal-activities}/data-activities/index.js +2 -2
  83. package/lib/module/components/modals/modal-activities/data-activities/index.js.map +1 -0
  84. package/lib/module/components/{modal-activities → modals/modal-activities}/index.js +8 -8
  85. package/lib/module/components/modals/modal-activities/index.js.map +1 -0
  86. package/lib/module/components/modals/modal-activities/interface.d.js +2 -0
  87. package/lib/module/components/modals/modal-activities/interface.d.js.map +1 -0
  88. package/lib/module/components/modals/modal-activity-reason/index.js +151 -0
  89. package/lib/module/components/modals/modal-activity-reason/index.js.map +1 -0
  90. package/lib/module/components/modals/modal-activity-reason/interface.d.js +2 -0
  91. package/lib/module/components/modals/modal-activity-reason/interface.d.js.map +1 -0
  92. package/lib/module/components/{modal-change-activity → modals/modal-change-activity}/index.js +6 -6
  93. package/lib/module/components/modals/modal-change-activity/index.js.map +1 -0
  94. package/lib/module/components/selects/select-date-and-hours/index.js +86 -0
  95. package/lib/module/components/selects/select-date-and-hours/index.js.map +1 -0
  96. package/lib/module/components/selects/select-date-and-hours/interface.js +2 -0
  97. package/lib/module/components/selects/select-date-and-hours/interface.js.map +1 -0
  98. package/lib/module/components/selects/select-date-and-hours/styles.js +28 -0
  99. package/lib/module/components/selects/select-date-and-hours/styles.js.map +1 -0
  100. package/lib/module/components/selects/select-option/index.js +41 -42
  101. package/lib/module/components/selects/select-option/index.js.map +1 -1
  102. package/lib/module/components/step-indicator/index.js +10 -10
  103. package/lib/module/components/step-indicator/index.js.map +1 -1
  104. package/lib/module/components/step-indicator/interface.d.js.map +1 -1
  105. package/lib/module/index.js +9 -5
  106. package/lib/module/index.js.map +1 -1
  107. package/lib/module/stories/input-text-counter/input-text-counter.stories.js +253 -0
  108. package/lib/module/stories/input-text-counter/input-text-counter.stories.js.map +1 -0
  109. package/lib/module/stories/modal-activities/modal-activities.stories.js +1 -1
  110. package/lib/module/stories/modal-activities/modal-activities.stories.js.map +1 -1
  111. package/lib/module/stories/modal-activity-reason/modal-activity-reason.stories.js +193 -0
  112. package/lib/module/stories/modal-activity-reason/modal-activity-reason.stories.js.map +1 -0
  113. package/lib/module/stories/modal-change-activity/modal-change-activity.stories.js +3 -3
  114. package/lib/module/stories/modal-change-activity/modal-change-activity.stories.js.map +1 -1
  115. package/lib/module/stories/modal-create-activitie/modal-create-activitie.stories.js +78 -0
  116. package/lib/module/stories/modal-create-activitie/modal-create-activitie.stories.js.map +1 -0
  117. package/lib/module/stories/modal-journey-rectification/modal-journey-rectification.stories.js +168 -0
  118. package/lib/module/stories/modal-journey-rectification/modal-journey-rectification.stories.js.map +1 -0
  119. package/lib/module/stories/select-option/select-option.stories.js +1 -1
  120. package/lib/module/stories/select-option/select-option.stories.js.map +1 -1
  121. package/lib/module/stories/step-indicator/step-indicator.stories.js +2 -1
  122. package/lib/module/stories/step-indicator/step-indicator.stories.js.map +1 -1
  123. package/lib/module/styles/theme/theme.js +18 -2
  124. package/lib/module/styles/theme/theme.js.map +1 -1
  125. package/lib/module/utils/options-activity/index.js +22 -0
  126. package/lib/module/utils/options-activity/index.js.map +1 -0
  127. package/lib/module/utils/text-limit/index.js +30 -0
  128. package/lib/module/utils/text-limit/index.js.map +1 -0
  129. package/lib/typescript/src/components/input-text-counter/index.d.ts +33 -0
  130. package/lib/typescript/src/components/input-text-counter/styles.d.ts +34 -0
  131. package/lib/typescript/src/components/modal-create-activitie/index.d.ts +7 -0
  132. package/lib/typescript/src/components/modal-create-activitie/interface.d.ts +18 -0
  133. package/lib/typescript/src/components/modal-create-activitie/styles.d.ts +32 -0
  134. package/lib/typescript/src/components/modal-journey-rectification/index.d.ts +7 -0
  135. package/lib/typescript/src/components/modal-journey-rectification/styles.d.ts +32 -0
  136. package/lib/typescript/src/components/modals/modal-activity-reason/index.d.ts +7 -0
  137. package/lib/typescript/src/components/selects/select-date-and-hours/index.d.ts +12 -0
  138. package/lib/typescript/src/components/selects/select-date-and-hours/interface.d.ts +21 -0
  139. package/lib/typescript/src/components/selects/select-date-and-hours/styles.d.ts +24 -0
  140. package/lib/typescript/src/components/selects/select-option/index.d.ts +3 -6
  141. package/lib/typescript/src/index.d.ts +7 -3
  142. package/lib/typescript/src/stories/input-text-counter/input-text-counter.stories.d.ts +17 -0
  143. package/lib/typescript/src/stories/modal-activities/modal-activities.stories.d.ts +1 -1
  144. package/lib/typescript/src/stories/modal-activity-reason/modal-activity-reason.stories.d.ts +15 -0
  145. package/lib/typescript/src/stories/modal-change-activity/modal-change-activity.stories.d.ts +1 -1
  146. package/lib/typescript/src/stories/modal-create-activitie/modal-create-activitie.stories.d.ts +12 -0
  147. package/lib/typescript/src/stories/modal-journey-rectification/modal-journey-rectification.stories.d.ts +34 -0
  148. package/lib/typescript/src/stories/select-option/select-option.stories.d.ts +1 -1
  149. package/lib/typescript/src/styles/global/theme-provider.d.ts +16 -0
  150. package/lib/typescript/src/styles/theme/theme.d.ts +16 -0
  151. package/lib/typescript/src/utils/options-activity/index.d.ts +20 -0
  152. package/lib/typescript/src/utils/text-limit/index.d.ts +13 -0
  153. package/package.json +1 -1
  154. package/src/components/input-text-counter/index.tsx +64 -0
  155. package/src/components/input-text-counter/interface.d.ts +41 -0
  156. package/src/components/input-text-counter/styles.ts +38 -0
  157. package/src/components/modal-create-activitie/index.tsx +211 -0
  158. package/src/components/modal-create-activitie/interface.ts +22 -0
  159. package/src/components/modal-create-activitie/styles.ts +24 -0
  160. package/src/components/modal-journey-rectification/index.tsx +211 -0
  161. package/src/components/modal-journey-rectification/interface.d.ts +22 -0
  162. package/src/components/modal-journey-rectification/styles.ts +24 -0
  163. package/src/components/{modal-activities → modals/modal-activities}/data-activities/index.ts +65 -65
  164. package/src/components/{modal-activities → modals/modal-activities}/index.tsx +137 -137
  165. package/src/components/{modal-activities → modals/modal-activities}/interface.d.ts +32 -32
  166. package/src/components/modals/modal-activity-reason/index.tsx +162 -0
  167. package/src/components/modals/modal-activity-reason/interface.d.ts +10 -0
  168. package/src/components/{modal-change-activity → modals/modal-change-activity}/index.tsx +6 -6
  169. package/src/components/selects/select-date-and-hours/index.tsx +97 -0
  170. package/src/components/selects/select-date-and-hours/interface.ts +31 -0
  171. package/src/components/selects/select-date-and-hours/styles.ts +24 -0
  172. package/src/components/selects/select-option/index.tsx +50 -41
  173. package/src/components/step-indicator/index.tsx +235 -235
  174. package/src/components/step-indicator/interface.d.ts +2 -2
  175. package/src/index.ts +49 -45
  176. package/src/stories/input-text-counter/input-text-counter.stories.tsx +232 -0
  177. package/src/stories/modal-activities/modal-activities.stories.tsx +64 -64
  178. package/src/stories/modal-activity-reason/modal-activity-reason.stories.tsx +192 -0
  179. package/src/stories/modal-change-activity/modal-change-activity.stories.tsx +49 -49
  180. package/src/stories/modal-create-activitie/modal-create-activitie.stories.tsx +82 -0
  181. package/src/stories/modal-journey-rectification/modal-journey-rectification.stories.tsx +161 -0
  182. package/src/stories/select-option/select-option.stories.tsx +1 -1
  183. package/src/stories/step-indicator/step-indicator.stories.tsx +2 -1
  184. package/src/styles/theme/theme.ts +17 -0
  185. package/src/utils/options-activity/index.ts +14 -0
  186. package/src/utils/text-limit/index.ts +28 -0
  187. package/lib/commonjs/components/modal-activities/data-activities/index.js.map +0 -1
  188. package/lib/commonjs/components/modal-activities/index.js.map +0 -1
  189. package/lib/commonjs/components/modal-activities/interface.d.js.map +0 -1
  190. package/lib/commonjs/components/modal-change-activity/index.js.map +0 -1
  191. package/lib/module/components/modal-activities/data-activities/index.js.map +0 -1
  192. package/lib/module/components/modal-activities/index.js.map +0 -1
  193. package/lib/module/components/modal-activities/interface.d.js.map +0 -1
  194. package/lib/module/components/modal-change-activity/index.js.map +0 -1
  195. /package/lib/commonjs/components/{modal-activities → input-text-counter}/interface.d.js +0 -0
  196. /package/lib/module/components/{modal-activities → input-text-counter}/interface.d.js +0 -0
  197. /package/lib/typescript/src/components/{modal-activities → modals/modal-activities}/data-activities/index.d.ts +0 -0
  198. /package/lib/typescript/src/components/{modal-activities → modals/modal-activities}/index.d.ts +0 -0
  199. /package/lib/typescript/src/components/{modal-change-activity → modals/modal-change-activity}/index.d.ts +0 -0
@@ -0,0 +1,211 @@
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);
@@ -0,0 +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 };
@@ -0,0 +1,24 @@
1
+ /**
2
+ * IMPORTS
3
+ */
4
+
5
+ import { StyleSheet } from "react-native";
6
+ import { theme } from "../../styles/theme/theme";
7
+
8
+ const styles = StyleSheet.create({
9
+ overlay: {
10
+ flex: 1,
11
+ justifyContent: "center",
12
+ alignItems: "center",
13
+ backgroundColor: theme.shadows.z1,
14
+ },
15
+ card: { width: "90%" },
16
+ headerRow: { marginBottom: 10, marginLeft: 4, flexDirection: "row", alignItems: "center" },
17
+ content: { padding: theme.paddings.xs },
18
+ actions: { marginTop: 16, flexDirection: "row", justifyContent: "space-between" },
19
+ });
20
+
21
+ /**
22
+ * EXPORTS
23
+ */
24
+ export { styles };
@@ -0,0 +1,211 @@
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, IModalJourneyRectificationProps } 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 ModalJourneyRectification: React.FC<IModalJourneyRectificationProps<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 ?? "Editar atividad"}
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="Confirme as alterações antes de salvar."
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
+ ModalJourneyRectification.displayName = "ModalJourneyRectification";
211
+ export default asBaseComponent(ModalJourneyRectification);
@@ -0,0 +1,22 @@
1
+ /* eslint-disable no-unused-vars */
2
+ /**
3
+ * IMPORTS
4
+ */
5
+
6
+ type IModalJourneyRectificationProps<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 { IModalJourneyRectificationProps, IDateAndHoursProps };
@@ -0,0 +1,24 @@
1
+ /**
2
+ * IMPORTS
3
+ */
4
+
5
+ import { StyleSheet } from "react-native";
6
+ import { theme } from "../../styles/theme/theme";
7
+
8
+ const styles = StyleSheet.create({
9
+ overlay: {
10
+ flex: 1,
11
+ justifyContent: "center",
12
+ alignItems: "center",
13
+ backgroundColor: theme.shadows.z1,
14
+ },
15
+ card: { width: "90%" },
16
+ headerRow: { marginBottom: 10, marginLeft: 4, flexDirection: "row", alignItems: "center" },
17
+ content: { padding: theme.paddings.xs },
18
+ actions: { marginTop: 16, flexDirection: "row", justifyContent: "space-between" },
19
+ });
20
+
21
+ /**
22
+ * EXPORTS
23
+ */
24
+ export { styles };
@@ -1,65 +1,65 @@
1
- /**
2
- * dados para os tipos de atividades selecionado
3
- */
4
- export const activities = {
5
- trabalho: [
6
- {
7
- id: 1,
8
- referencia: "operacao_veiculo",
9
- cor_hex: "000000",
10
- descricao: "Operação com Veículo",
11
- tipo: "trabalho",
12
- },
13
- {
14
- id: 2,
15
- referencia: "aguardando_carga",
16
- cor_hex: "000000",
17
- descricao: "Em carga",
18
- tipo: "trabalho",
19
- },
20
- {
21
- id: 3,
22
- referencia: "aguardando_descarga",
23
- cor_hex: "000000",
24
- descricao: "Em Descarga",
25
- tipo: "trabalho",
26
- },
27
- {
28
- id: 8,
29
- referencia: "disposicao_veiculo_parado",
30
- cor_hex: "000000",
31
- descricao: "Disposição com Veículo Parado",
32
- tipo: "trabalho",
33
- },
34
- ],
35
- descanso: [
36
- {
37
- id: 5,
38
- referencia: "repouso_semanal",
39
- cor_hex: "000000",
40
- descricao: "Repouso Semanal",
41
- tipo: "descanso",
42
- },
43
- {
44
- id: 6,
45
- referencia: "repouso_noturno",
46
- cor_hex: "000000",
47
- descricao: "Repouso Noturno",
48
- tipo: "descanso",
49
- },
50
- {
51
- id: 7,
52
- referencia: "refeicao",
53
- cor_hex: "000000",
54
- descricao: "Refeição",
55
- tipo: "descanso",
56
- },
57
- {
58
- id: 9,
59
- referencia: "descanso",
60
- cor_hex: "000000",
61
- descricao: "Descanso",
62
- tipo: "descanso",
63
- },
64
- ],
65
- };
1
+ /**
2
+ * dados para os tipos de atividades selecionado
3
+ */
4
+ export const activities = {
5
+ trabalho: [
6
+ {
7
+ id: 1,
8
+ referencia: "operacao_veiculo",
9
+ cor_hex: "000000",
10
+ descricao: "Operação com Veículo",
11
+ tipo: "trabalho",
12
+ },
13
+ {
14
+ id: 2,
15
+ referencia: "aguardando_carga",
16
+ cor_hex: "000000",
17
+ descricao: "Em carga",
18
+ tipo: "trabalho",
19
+ },
20
+ {
21
+ id: 3,
22
+ referencia: "aguardando_descarga",
23
+ cor_hex: "000000",
24
+ descricao: "Em Descarga",
25
+ tipo: "trabalho",
26
+ },
27
+ {
28
+ id: 8,
29
+ referencia: "disposicao_veiculo_parado",
30
+ cor_hex: "000000",
31
+ descricao: "Disposição com Veículo Parado",
32
+ tipo: "trabalho",
33
+ },
34
+ ],
35
+ descanso: [
36
+ {
37
+ id: 5,
38
+ referencia: "repouso_semanal",
39
+ cor_hex: "000000",
40
+ descricao: "Repouso Semanal",
41
+ tipo: "descanso",
42
+ },
43
+ {
44
+ id: 6,
45
+ referencia: "repouso_noturno",
46
+ cor_hex: "000000",
47
+ descricao: "Repouso Noturno",
48
+ tipo: "descanso",
49
+ },
50
+ {
51
+ id: 7,
52
+ referencia: "refeicao",
53
+ cor_hex: "000000",
54
+ descricao: "Refeição",
55
+ tipo: "descanso",
56
+ },
57
+ {
58
+ id: 9,
59
+ referencia: "descanso",
60
+ cor_hex: "000000",
61
+ descricao: "Descanso",
62
+ tipo: "descanso",
63
+ },
64
+ ],
65
+ };