react-native-exp-fig 0.1.38 → 0.1.40

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 (55) hide show
  1. package/lib/commonjs/components/modal-create-activitie/index.js +17 -13
  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 +12 -10
  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 +9 -1
  18. package/lib/commonjs/stories/modal-create-activitie/modal-create-activitie.stories.js.map +1 -1
  19. package/lib/commonjs/stories/modal-journey-rectification/modal-journey-rectification.stories.js +35 -23
  20. package/lib/commonjs/stories/modal-journey-rectification/modal-journey-rectification.stories.js.map +1 -1
  21. package/lib/module/components/modal-create-activitie/index.js +17 -13
  22. package/lib/module/components/modal-create-activitie/index.js.map +1 -1
  23. package/lib/module/components/modal-create-activitie/interface.js.map +1 -1
  24. package/lib/module/components/modal-journey-rectification/index.js +10 -10
  25. package/lib/module/components/modal-journey-rectification/index.js.map +1 -1
  26. package/lib/module/components/modals/modal-activities/data-activities/index.js +24 -0
  27. package/lib/module/components/modals/modal-activities/data-activities/index.js.map +1 -1
  28. package/lib/module/components/modals/modal-activity-reason/index.js +6 -5
  29. package/lib/module/components/modals/modal-activity-reason/index.js.map +1 -1
  30. package/lib/module/components/modals/modal-activity-reason/interface.d.js.map +1 -1
  31. package/lib/module/components/modals/modal-change-activity/index.js.map +1 -1
  32. package/lib/module/components/selects/select-option/index.js +12 -10
  33. package/lib/module/components/selects/select-option/index.js.map +1 -1
  34. package/lib/module/components/selects/select-option/interface.d.js.map +1 -1
  35. package/lib/module/stories/modal-activity-reason/modal-activity-reason.stories.js +8 -8
  36. package/lib/module/stories/modal-activity-reason/modal-activity-reason.stories.js.map +1 -1
  37. package/lib/module/stories/modal-create-activitie/modal-create-activitie.stories.js +9 -1
  38. package/lib/module/stories/modal-create-activitie/modal-create-activitie.stories.js.map +1 -1
  39. package/lib/module/stories/modal-journey-rectification/modal-journey-rectification.stories.js +35 -23
  40. package/lib/module/stories/modal-journey-rectification/modal-journey-rectification.stories.js.map +1 -1
  41. package/lib/typescript/src/components/modal-create-activitie/interface.d.ts +1 -0
  42. package/lib/typescript/src/components/modals/modal-activities/data-activities/index.d.ts +7 -0
  43. package/package.json +4 -8
  44. package/src/components/modal-create-activitie/index.tsx +216 -211
  45. package/src/components/modal-create-activitie/interface.ts +23 -22
  46. package/src/components/modal-journey-rectification/index.tsx +213 -211
  47. package/src/components/modals/modal-activities/data-activities/index.ts +31 -0
  48. package/src/components/modals/modal-activity-reason/index.tsx +163 -162
  49. package/src/components/modals/modal-activity-reason/interface.d.ts +10 -10
  50. package/src/components/modals/modal-change-activity/index.tsx +1 -1
  51. package/src/components/selects/select-option/index.tsx +133 -124
  52. package/src/components/selects/select-option/interface.d.ts +19 -18
  53. package/src/stories/modal-activity-reason/modal-activity-reason.stories.tsx +192 -192
  54. package/src/stories/modal-create-activitie/modal-create-activitie.stories.tsx +8 -0
  55. package/src/stories/modal-journey-rectification/modal-journey-rectification.stories.tsx +170 -161
@@ -1,211 +1,213 @@
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);
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
+ // 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<number | null>(
41
+ retificacaoActivities[0]?.value ?? null
42
+ );
43
+
44
+ // label do motivo derivada com memo
45
+ const activitieLabel = useMemo(
46
+ () =>
47
+ retificacaoActivities?.find((activitie) => activitie.value === selectedActivitie)?.label ??
48
+ null,
49
+ [selectedActivitie]
50
+ );
51
+
52
+ // handlers estáveis
53
+ const handleChangeReason = useCallback((value: number | null) => {
54
+ setSelectedActivitie(value);
55
+ }, []);
56
+
57
+ const handleCancel = useCallback(() => {
58
+ onClose?.();
59
+ }, [onClose]);
60
+
61
+ const handleConfirm = useCallback(() => {
62
+ onPressConfirm?.({
63
+ value: selectedActivitie,
64
+ label: activitieLabel,
65
+ dateAndHours: dateAndHours,
66
+ });
67
+
68
+ onClose?.();
69
+ }, [onPressConfirm, onClose, activitieLabel, selectedActivitie, dateAndHours]);
70
+
71
+ return (
72
+ <Modal
73
+ animationType="fade"
74
+ transparent
75
+ visible={visible}
76
+ onRequestClose={handleCancel}
77
+ statusBarTranslucent
78
+ >
79
+ <Pressable style={styles.overlay} onPress={handleCancel}>
80
+ <Box
81
+ width="90%"
82
+ backgroundColor={theme.colors.orange[500]}
83
+ borderStyled={{ borderRadius: theme.borderWidths.thick_medium }}
84
+ paddingStyle={{
85
+ paddingLeft: theme.paddings["2xs"],
86
+ paddingRight: theme.paddings["2xs"],
87
+ paddingTop: theme.paddings.sm,
88
+ paddingBottom: theme.paddings.sm,
89
+ }}
90
+ >
91
+ <View style={styles.headerRow}>
92
+ <Icons
93
+ icon="EXCLAMATION_TRIANGLE"
94
+ color={theme.colors.orange[500]}
95
+ background={theme.colors.neutral[300]}
96
+ size={22}
97
+ />
98
+ <Typography
99
+ text={textTitle ?? "Editar atividad"}
100
+ color={theme.colors.neutral[25]}
101
+ marginLeft={theme.margins["2xs"]}
102
+ fontFamily={theme.fonts.inter_bold}
103
+ fontWeight="700"
104
+ size={theme.fontSizes.lg}
105
+ />
106
+ </View>
107
+
108
+ <Box
109
+ backgroundColor={theme.colors.neutral[300]}
110
+ paddingStyle={{ padding: theme.paddings.xs }}
111
+ borderStyled={{ borderRadius: theme.borderWidths.thick_medium }}
112
+ >
113
+ <Typography
114
+ text="Confirme as alterações antes de salvar."
115
+ color={theme.colors.black[100]}
116
+ fontFamily={theme.fonts.inter_regular_400}
117
+ fontWeight="400"
118
+ lineHeight={theme.lineHeight["2xl"]}
119
+ size={theme.fontSizes.sm}
120
+ marginBottom={16}
121
+ />
122
+
123
+ <SelectOption
124
+ titleLabel="Selecione um motivo"
125
+ sizeTitleLabel={18}
126
+ dataOption={retificacaoActivities as any}
127
+ handleSelectDown={handleChangeReason}
128
+ backgroundColor={theme.colors.neutral[300]}
129
+ />
130
+
131
+ <ActivityFields
132
+ disabled={false}
133
+ icon={"CALENDAR"}
134
+ value={dateAndHours?.date}
135
+ onPressConfirm={(value) =>
136
+ setDateAndHours({ date: value, hours: dateAndHours?.hours })
137
+ }
138
+ />
139
+
140
+ <ActivityFields
141
+ disabled={false}
142
+ icon={"TIMER"}
143
+ value={dateAndHours?.hours}
144
+ onPressConfirm={(value) =>
145
+ setDateAndHours({ date: dateAndHours?.date, hours: value })
146
+ }
147
+ />
148
+
149
+ <View style={styles.actions}>
150
+ <Button
151
+ title="CANCELAR"
152
+ onPress={handleCancel}
153
+ width="48%"
154
+ height={40}
155
+ isLoading={false}
156
+ disabled={false}
157
+ backgroundColor={theme.colors.neutral[300]}
158
+ buttonTextStyle={{
159
+ color: theme.colors.blue[500],
160
+ fontFamily: theme.fonts.inter_medium_500,
161
+ fontSize: theme.fontSizes.xs,
162
+ fontWeight: "500",
163
+ }}
164
+ flexStyle={{
165
+ flexDirection: "row",
166
+ alignItems: "center",
167
+ justifyContent: "center",
168
+ textAlign: "center",
169
+ }}
170
+ borderStyled={{
171
+ borderWidth: theme.borderWidths.thin,
172
+ borderColor: theme.colors.blue[100],
173
+ borderRadius: theme.borderWidths.thick_medium,
174
+ }}
175
+ />
176
+
177
+ <Button
178
+ title="CONFIRMAR"
179
+ onPress={handleConfirm}
180
+ width="48%"
181
+ height={40}
182
+ isLoading={false}
183
+ disabled={false}
184
+ backgroundColor={theme.colors.blue[500]}
185
+ buttonTextStyle={{
186
+ color: theme.colors.neutral[25],
187
+ fontFamily: theme.fonts.inter_medium_500,
188
+ fontSize: theme.fontSizes.xs,
189
+ fontWeight: "500",
190
+ }}
191
+ flexStyle={{
192
+ flexDirection: "row",
193
+ alignItems: "center",
194
+ justifyContent: "center",
195
+ textAlign: "center",
196
+ }}
197
+ borderStyled={{
198
+ borderWidth: theme.borderWidths.thin,
199
+ borderColor: theme.colors.blue[100],
200
+ borderRadius: theme.borderWidths.thick_medium,
201
+ }}
202
+ />
203
+ </View>
204
+ </Box>
205
+ </Box>
206
+ </Pressable>
207
+ </Modal>
208
+ );
209
+ }
210
+ );
211
+
212
+ ModalJourneyRectification.displayName = "ModalJourneyRectification";
213
+ export default asBaseComponent(ModalJourneyRectification);
@@ -100,3 +100,34 @@ export const activitiesByDriverType: Record<string, Record<string, IActivity[]>>
100
100
  descanso: baseActivities.descanso!,
101
101
  },
102
102
  };
103
+
104
+ /**
105
+ * Atividades para retificação
106
+ */
107
+
108
+ export const retificacaoActivities = [
109
+ {
110
+ value: 22,
111
+ label: "Em operação - Carregamento",
112
+ },
113
+ {
114
+ value: 21,
115
+ label: "Tempo à Disposição",
116
+ },
117
+ {
118
+ value: 5,
119
+ label: "Repouso Semanal",
120
+ },
121
+ {
122
+ value: 6,
123
+ label: "Repouso Noturno",
124
+ },
125
+ {
126
+ value: 7,
127
+ label: "Refeição",
128
+ },
129
+ {
130
+ value: 9,
131
+ label: "Descanso",
132
+ },
133
+ ];