react-native-exp-fig 2.0.3 → 2.0.4

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 (45) hide show
  1. package/lib/commonjs/components/activities-daily/index.js +4 -4
  2. package/lib/commonjs/components/modal-activities/data-activities/index.js +47 -15
  3. package/lib/commonjs/components/modal-activities/data-activities/index.js.map +1 -1
  4. package/lib/commonjs/components/modal-activities/helpers/index.js +30 -0
  5. package/lib/commonjs/components/modal-activities/helpers/index.js.map +1 -0
  6. package/lib/commonjs/components/modal-activities/index.js +6 -6
  7. package/lib/commonjs/components/modal-activities/index.js.map +1 -1
  8. package/lib/commonjs/stories/modal-activities/modal-activities.stories.js +15 -7
  9. package/lib/commonjs/stories/modal-activities/modal-activities.stories.js.map +1 -1
  10. package/lib/commonjs/utils/get-icon-by-property/index.js +22 -12
  11. package/lib/commonjs/utils/get-icon-by-property/index.js.map +1 -1
  12. package/lib/commonjs/utils/options-activity/index.js +24 -0
  13. package/lib/commonjs/utils/options-activity/index.js.map +1 -0
  14. package/lib/module/components/activities-daily/index.js +4 -4
  15. package/lib/module/components/modal-activities/data-activities/index.js +46 -14
  16. package/lib/module/components/modal-activities/data-activities/index.js.map +1 -1
  17. package/lib/module/components/modal-activities/helpers/index.js +26 -0
  18. package/lib/module/components/modal-activities/helpers/index.js.map +1 -0
  19. package/lib/module/components/modal-activities/index.js +6 -6
  20. package/lib/module/components/modal-activities/index.js.map +1 -1
  21. package/lib/module/stories/modal-activities/modal-activities.stories.js +15 -7
  22. package/lib/module/stories/modal-activities/modal-activities.stories.js.map +1 -1
  23. package/lib/module/utils/get-icon-by-property/index.js +21 -13
  24. package/lib/module/utils/get-icon-by-property/index.js.map +1 -1
  25. package/lib/module/utils/options-activity/index.js +21 -0
  26. package/lib/module/utils/options-activity/index.js.map +1 -0
  27. package/lib/typescript/src/components/modal-activities/data-activities/index.d.ts +16 -17
  28. package/lib/typescript/src/components/modal-activities/data-activities/index.d.ts.map +1 -1
  29. package/lib/typescript/src/components/modal-activities/helpers/index.d.ts +12 -0
  30. package/lib/typescript/src/components/modal-activities/helpers/index.d.ts.map +1 -0
  31. package/lib/typescript/src/stories/modal-activities/modal-activities.stories.d.ts +3 -0
  32. package/lib/typescript/src/stories/modal-activities/modal-activities.stories.d.ts.map +1 -1
  33. package/lib/typescript/src/utils/get-icon-by-property/index.d.ts +2 -1
  34. package/lib/typescript/src/utils/get-icon-by-property/index.d.ts.map +1 -1
  35. package/lib/typescript/src/utils/options-activity/index.d.ts +18 -0
  36. package/lib/typescript/src/utils/options-activity/index.d.ts.map +1 -0
  37. package/package.json +1 -1
  38. package/src/components/activities-daily/index.tsx +116 -116
  39. package/src/components/modal-activities/data-activities/index.ts +107 -65
  40. package/src/components/modal-activities/helpers/index.ts +25 -0
  41. package/src/components/modal-activities/index.tsx +137 -137
  42. package/src/components/modal-activities/interface.d.ts +34 -32
  43. package/src/stories/modal-activities/modal-activities.stories.tsx +73 -64
  44. package/src/utils/get-icon-by-property/index.tsx +73 -54
  45. package/src/utils/options-activity/index.ts +13 -0
@@ -1,65 +1,107 @@
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
+ * Tipagem da atividade
3
+ */
4
+ export interface IActivity {
5
+ id: number;
6
+ referencia: string;
7
+ cor_hex: string;
8
+ descricao: string;
9
+ tipo: "trabalho" | "descanso";
10
+ }
11
+
12
+ /**
13
+ * Lista base de atividades padrão (normal)
14
+ */
15
+ const baseActivities: Record<string, IActivity[]> = {
16
+ trabalho: [
17
+ {
18
+ id: 1,
19
+ referencia: "em_operacao",
20
+ cor_hex: "#000000",
21
+ descricao: "Em Operação Carregamento",
22
+ tipo: "trabalho",
23
+ },
24
+ {
25
+ id: 2,
26
+ referencia: "aguardando_carga",
27
+ cor_hex: "#000000",
28
+ descricao: "Em Carga",
29
+ tipo: "trabalho",
30
+ },
31
+ {
32
+ id: 3,
33
+ referencia: "aguardando_descarga",
34
+ cor_hex: "#000000",
35
+ descricao: "Em Descarga",
36
+ tipo: "trabalho",
37
+ },
38
+ {
39
+ id: 8,
40
+ referencia: "disposicao_veiculo_parado",
41
+ cor_hex: "#000000",
42
+ descricao: "Disposição com Veículo Parado",
43
+ tipo: "trabalho",
44
+ },
45
+ ],
46
+ descanso: [
47
+ {
48
+ id: 5,
49
+ referencia: "repouso_semanal",
50
+ cor_hex: "#000000",
51
+ descricao: "Repouso Semanal",
52
+ tipo: "descanso",
53
+ },
54
+ {
55
+ id: 6,
56
+ referencia: "repouso_noturno",
57
+ cor_hex: "#000000",
58
+ descricao: "Repouso Noturno",
59
+ tipo: "descanso",
60
+ },
61
+ {
62
+ id: 7,
63
+ referencia: "refeicao",
64
+ cor_hex: "#000000",
65
+ descricao: "Refeição",
66
+ tipo: "descanso",
67
+ },
68
+ {
69
+ id: 9,
70
+ referencia: "descanso",
71
+ cor_hex: "#000000",
72
+ descricao: "Descanso",
73
+ tipo: "descanso",
74
+ },
75
+ ],
76
+ };
77
+
78
+ /**
79
+ * Atividades específicas por tipo de usuário
80
+ */
81
+ export const activitiesByDriverType: Record<string, Record<string, IActivity[]>> = {
82
+ normal: baseActivities,
83
+ carregador: {
84
+ trabalho: [
85
+ {
86
+ id: 1,
87
+ referencia: "em_operacao",
88
+ cor_hex: "#000000",
89
+ descricao: "Em Operação Carregamento",
90
+ tipo: "trabalho",
91
+ },
92
+ {
93
+ id: 21,
94
+ referencia: "aguardando_descarga",
95
+ cor_hex: "#000000",
96
+ descricao: "Tempo à Disposição",
97
+ tipo: "trabalho",
98
+ },
99
+ ],
100
+ descanso: baseActivities.descanso!,
101
+ },
102
+ };
103
+
104
+ /**
105
+ * Atividades base para uso nos testes
106
+ */
107
+ export const activities = baseActivities;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * IMPORTS
3
+ */
4
+ import { activitiesByDriverType } from "../data-activities";
5
+
6
+ /**
7
+ * Função que retorna as atividades por tipo de atividade e tipo de usuário (normal ou carregador)
8
+ * @param driverType
9
+ * @param activityType
10
+ * @returns
11
+ */
12
+ const getActivitiesByType = (driverType: string, activityType: string) => {
13
+ const driverActivities = activitiesByDriverType[driverType];
14
+
15
+ if (!driverActivities) {
16
+ return activitiesByDriverType["carregador"]![activityType] || [];
17
+ }
18
+
19
+ return driverActivities[activityType] || [];
20
+ };
21
+
22
+ /**
23
+ * EXPORTS
24
+ */
25
+ export { getActivitiesByType };
@@ -1,137 +1,137 @@
1
- /**
2
- * IMPORTS
3
- */
4
- import React from "react";
5
- import { Modal, TouchableOpacity, FlatList } from "react-native";
6
-
7
- // components
8
-
9
- import { Box } from "../box";
10
-
11
- // commons / icons
12
- import { Icons } from "../../common/icons-svg";
13
- import { getIconModalActivities } from "../../common/icons-svg/modal-activities";
14
-
15
- // styles
16
- import { theme } from "../../styles/theme/theme";
17
- import { Typography } from "../typography";
18
- import { Button } from "../button";
19
-
20
- //typing
21
- import { IModalActivities, IActivity } from "./interface";
22
-
23
- // atividades
24
- import { activities } from "./data-activities";
25
-
26
- export const ModalActivities: React.FC<IModalActivities> = ({
27
- onClose,
28
- handleActivity,
29
- activityType,
30
- isLoading,
31
- style,
32
- }) => {
33
- return (
34
- <Modal animationType="fade" transparent={true} onRequestClose={onClose}>
35
- <Box
36
- backgroundColor={"rgba(0, 0, 0, 0.7)"}
37
- flexStyle={{ flex: 1, justifyContent: "center", alignItems: "center" }}
38
- >
39
- <Box
40
- height={310}
41
- width={"92%"}
42
- backgroundColor={theme.colors.neutral[25]}
43
- borderStyled={{
44
- borderColor: theme.colors.blue[500],
45
- borderWidth: theme.borderWidths.thick,
46
- borderRadius: theme.borderWidths.thick_medium,
47
- }}
48
- paddingStyle={{
49
- padding: theme.paddings.md,
50
- }}
51
- style={{ position: "relative" }}
52
- >
53
- <Box
54
- width={"100%"}
55
- flexStyle={{
56
- flexDirection: "row",
57
- justifyContent: "space-between",
58
- alignItems: "center",
59
- }}
60
- >
61
- <Typography
62
- text="Atividades"
63
- size={theme.fontSizes.md}
64
- color={theme.colors.blue[500]}
65
- fontFamily={theme.fonts.inter_bold_700}
66
- lineHeight={theme.fontSizes.xl}
67
- />
68
-
69
- <TouchableOpacity activeOpacity={0.7} onPress={onClose} style={{}}>
70
- <Icons icon="CLOSED" color={theme.colors.blue[500]} />
71
- </TouchableOpacity>
72
- </Box>
73
- {/* as atividades */}
74
- <Box marginStyle={{ marginTop: theme.margins["2xl"] }}>
75
- <FlatList
76
- data={activities[activityType]}
77
- numColumns={3}
78
- keyExtractor={(item) => item.id.toString()}
79
- scrollEnabled={false}
80
- renderItem={({ item }) => (
81
- <TouchableOpacity
82
- style={{
83
- alignItems: "center",
84
- width: 110,
85
- marginBottom: theme.margins["2xl"], // espaço entre as linhas
86
- }}
87
- onPress={() => handleActivity(item as IActivity)}
88
- >
89
- {getIconModalActivities(item.referencia)}
90
-
91
- <Typography
92
- text={item.descricao}
93
- size={theme.fontSizes.xs}
94
- color={theme.colors.blue[500]}
95
- lineHeight={theme.fontSizes.md}
96
- fontFamily={theme.fonts.inter_medium_500}
97
- fontWeight="500"
98
- align="center"
99
- marginTop={5}
100
- />
101
- </TouchableOpacity>
102
- )}
103
- />
104
- </Box>
105
-
106
- <Button
107
- title={"CANCELAR ATIVIDADE"}
108
- width="100%"
109
- height={40}
110
- activeOpacity={0.7}
111
- onPress={onClose}
112
- backgroundColor={theme.colors.blue[500]}
113
- buttonTextStyle={{
114
- color: theme.colors.neutral[25],
115
- fontFamily: theme.fonts.inter_medium_500,
116
- fontSize: theme.fontSizes.md,
117
- fontWeight: "500",
118
- }}
119
- flexStyle={{
120
- flexDirection: "row",
121
- alignItems: "center",
122
- justifyContent: "center",
123
- }}
124
- borderStyled={{
125
- borderWidth: theme.borderWidths.thin,
126
- borderColor: theme.colors.blue[500],
127
- borderRadius: theme.borderWidths.thick_medium,
128
- }}
129
- marginStyle={{ marginLeft: theme.margins.md }}
130
- isLoading={isLoading ?? false}
131
- style={[style, { position: "absolute", bottom: 10, left: 0 }]}
132
- />
133
- </Box>
134
- </Box>
135
- </Modal>
136
- );
137
- };
1
+ /**
2
+ * IMPORTS
3
+ */
4
+ import React from "react";
5
+ import { Modal, TouchableOpacity, FlatList } from "react-native";
6
+
7
+ // components
8
+
9
+ import { Box } from "../box";
10
+
11
+ // commons / icons
12
+ import { Icons } from "../../common/icons-svg";
13
+ import { getIconModalActivities } from "../../common/icons-svg/modal-activities";
14
+
15
+ // styles
16
+ import { theme } from "../../styles/theme/theme";
17
+ import { Typography } from "../typography";
18
+ import { Button } from "../button";
19
+
20
+ //typing
21
+ import { IModalActivities, IActivity } from "./interface";
22
+
23
+ // atividades
24
+ import { getActivitiesByType } from "./helpers";
25
+
26
+ export const ModalActivities: React.FC<IModalActivities> = ({
27
+ onClose,
28
+ handleActivity,
29
+ activityType,
30
+ driverType = "carregador",
31
+ style,
32
+ }) => {
33
+ return (
34
+ <Modal animationType="fade" transparent={true} onRequestClose={onClose}>
35
+ <Box
36
+ backgroundColor={"rgba(0, 0, 0, 0.7)"}
37
+ flexStyle={{ flex: 1, justifyContent: "center", alignItems: "center" }}
38
+ >
39
+ <Box
40
+ height={310}
41
+ width={"92%"}
42
+ backgroundColor={theme.colors.neutral[25]}
43
+ borderStyled={{
44
+ borderColor: theme.colors.blue[500],
45
+ borderWidth: theme.borderWidths.thick,
46
+ borderRadius: theme.borderWidths.thick_medium,
47
+ }}
48
+ paddingStyle={{
49
+ padding: theme.paddings.md,
50
+ }}
51
+ style={{ position: "relative" }}
52
+ >
53
+ <Box
54
+ width={"100%"}
55
+ flexStyle={{
56
+ flexDirection: "row",
57
+ justifyContent: "space-between",
58
+ alignItems: "center",
59
+ }}
60
+ >
61
+ <Typography
62
+ text="Atividades"
63
+ size={theme.fontSizes.md}
64
+ color={theme.colors.blue[500]}
65
+ fontFamily={theme.fonts.inter_bold_700}
66
+ lineHeight={theme.fontSizes.xl}
67
+ />
68
+
69
+ <TouchableOpacity activeOpacity={0.7} onPress={onClose} style={{}}>
70
+ <Icons icon="CLOSED" color={theme.colors.blue[500]} />
71
+ </TouchableOpacity>
72
+ </Box>
73
+ {/* as atividades */}
74
+ <Box marginStyle={{ marginTop: theme.margins["2xl"] }}>
75
+ <FlatList
76
+ data={getActivitiesByType(driverType, activityType)}
77
+ numColumns={3}
78
+ keyExtractor={(item) => item.id.toString()}
79
+ scrollEnabled={false}
80
+ renderItem={({ item }) => (
81
+ <TouchableOpacity
82
+ style={{
83
+ alignItems: "center",
84
+ width: 110,
85
+ marginBottom: theme.margins["2xl"], // espaço entre as linhas
86
+ }}
87
+ onPress={() => handleActivity(item as IActivity)}
88
+ >
89
+ {getIconModalActivities(item.referencia)}
90
+
91
+ <Typography
92
+ text={item.descricao}
93
+ size={theme.fontSizes.xs}
94
+ color={theme.colors.blue[500]}
95
+ lineHeight={theme.fontSizes.md}
96
+ fontFamily={theme.fonts.inter_medium_500}
97
+ fontWeight="500"
98
+ align="center"
99
+ marginTop={5}
100
+ />
101
+ </TouchableOpacity>
102
+ )}
103
+ />
104
+ </Box>
105
+
106
+ <Button
107
+ title={"CANCELAR ATIVIDADE"}
108
+ width="100%"
109
+ height={40}
110
+ activeOpacity={0.7}
111
+ onPress={onClose}
112
+ backgroundColor={theme.colors.blue[500]}
113
+ buttonTextStyle={{
114
+ color: theme.colors.neutral[25],
115
+ fontFamily: theme.fonts.inter_medium_500,
116
+ fontSize: theme.fontSizes.md,
117
+ fontWeight: "500",
118
+ }}
119
+ flexStyle={{
120
+ flexDirection: "row",
121
+ alignItems: "center",
122
+ justifyContent: "center",
123
+ }}
124
+ borderStyled={{
125
+ borderWidth: theme.borderWidths.thin,
126
+ borderColor: theme.colors.blue[500],
127
+ borderRadius: theme.borderWidths.thick_medium,
128
+ }}
129
+ marginStyle={{ marginLeft: theme.margins.md }}
130
+ isLoading={false}
131
+ style={[style, { position: "absolute", bottom: 10, left: 0 }]}
132
+ />
133
+ </Box>
134
+ </Box>
135
+ </Modal>
136
+ );
137
+ };
@@ -1,32 +1,34 @@
1
- /**
2
- * IMPORTS
3
- */
4
- import { ModalProps } from "react-native";
5
-
6
- // typing
7
- import { IGlobalCss } from "../../styles/global/interface";
8
-
9
- interface IActivity {
10
- id: number;
11
- referencia: string;
12
- cor_hex: string;
13
- descricao: string;
14
- tipo: "trabalho" | "descanso";
15
- }
16
-
17
- interface IModalActivities extends ModalProps, IGlobalCss {
18
- /** função que fecha modal */
19
- onClose: () => void;
20
-
21
- /** tipo de atividades */
22
- activityType: IActivity["tipo"];
23
-
24
- /** função que manda atividade selecionada */
25
- // eslint-disable-next-line no-unused-vars
26
- handleActivity: (activity: IActivity) => void;
27
- }
28
-
29
- /**
30
- * EXPORTS
31
- */
32
- export { IModalActivities, IActivity };
1
+ /**
2
+ * IMPORTS
3
+ */
4
+ import { ModalProps } from "react-native";
5
+
6
+ // typing
7
+ import { IGlobalCss } from "../../../styles/global/interface";
8
+
9
+ interface IActivity {
10
+ id: number;
11
+ referencia: string;
12
+ cor_hex: string;
13
+ descricao: string;
14
+ tipo: "trabalho" | "descanso";
15
+ }
16
+
17
+ interface IModalActivities extends ModalProps, IGlobalCss {
18
+ /** função que fecha modal */
19
+ onClose: () => void;
20
+
21
+ /** tipo de atividades */
22
+ activityType: IActivity["tipo"];
23
+
24
+ /** função que manda atividade selecionada */
25
+ // eslint-disable-next-line no-unused-vars
26
+ handleActivity: (activity: IActivity) => void;
27
+
28
+ driverType?: "normal" | "carregador";
29
+ }
30
+
31
+ /**
32
+ * EXPORTS
33
+ */
34
+ export { IModalActivities, IActivity };