jornada-ui 0.4.16 → 0.4.18

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 (59) hide show
  1. package/lib/commonjs/components/modal-type-activities/index.js +7 -6
  2. package/lib/commonjs/components/modal-type-activities/index.js.map +1 -1
  3. package/lib/commonjs/components/modal-type-activities/mock/index.js +34 -3
  4. package/lib/commonjs/components/modal-type-activities/mock/index.js.map +1 -1
  5. package/lib/commonjs/components/modals/modal-change-activitie-history/helpers/index.js +35 -0
  6. package/lib/commonjs/components/modals/modal-change-activitie-history/helpers/index.js.map +1 -0
  7. package/lib/commonjs/components/modals/modal-change-activitie-history/index.js +203 -0
  8. package/lib/commonjs/components/modals/modal-change-activitie-history/index.js.map +1 -0
  9. package/lib/commonjs/components/modals/modal-change-activitie-history/interface.js +6 -0
  10. package/lib/commonjs/components/modals/modal-change-activitie-history/interface.js.map +1 -0
  11. package/lib/commonjs/components/step-indicator/index.js +131 -68
  12. package/lib/commonjs/components/step-indicator/index.js.map +1 -1
  13. package/lib/module/components/modal-type-activities/index.js +8 -7
  14. package/lib/module/components/modal-type-activities/index.js.map +1 -1
  15. package/lib/module/components/modal-type-activities/mock/index.js +33 -2
  16. package/lib/module/components/modal-type-activities/mock/index.js.map +1 -1
  17. package/lib/module/components/modals/modal-change-activitie-history/helpers/index.js +32 -0
  18. package/lib/module/components/modals/modal-change-activitie-history/helpers/index.js.map +1 -0
  19. package/lib/module/components/modals/modal-change-activitie-history/index.js +196 -0
  20. package/lib/module/components/modals/modal-change-activitie-history/index.js.map +1 -0
  21. package/lib/module/components/modals/modal-change-activitie-history/interface.js +4 -0
  22. package/lib/module/components/modals/modal-change-activitie-history/interface.js.map +1 -0
  23. package/lib/module/components/step-indicator/index.js +129 -65
  24. package/lib/module/components/step-indicator/index.js.map +1 -1
  25. package/lib/typescript/commonjs/src/components/modal-type-activities/index.d.ts.map +1 -1
  26. package/lib/typescript/commonjs/src/components/modal-type-activities/interface.d.ts +1 -0
  27. package/lib/typescript/commonjs/src/components/modal-type-activities/interface.d.ts.map +1 -1
  28. package/lib/typescript/commonjs/src/components/modal-type-activities/mock/index.d.ts +17 -0
  29. package/lib/typescript/commonjs/src/components/modal-type-activities/mock/index.d.ts.map +1 -1
  30. package/lib/typescript/commonjs/src/components/modals/modal-change-activitie-history/helpers/index.d.ts +13 -0
  31. package/lib/typescript/commonjs/src/components/modals/modal-change-activitie-history/helpers/index.d.ts.map +1 -0
  32. package/lib/typescript/commonjs/src/components/modals/modal-change-activitie-history/index.d.ts +10 -0
  33. package/lib/typescript/commonjs/src/components/modals/modal-change-activitie-history/index.d.ts.map +1 -0
  34. package/lib/typescript/commonjs/src/components/modals/modal-change-activitie-history/interface.d.ts +18 -0
  35. package/lib/typescript/commonjs/src/components/modals/modal-change-activitie-history/interface.d.ts.map +1 -0
  36. package/lib/typescript/commonjs/src/components/step-indicator/index.d.ts +3 -9
  37. package/lib/typescript/commonjs/src/components/step-indicator/index.d.ts.map +1 -1
  38. package/lib/typescript/module/src/components/modal-type-activities/index.d.ts.map +1 -1
  39. package/lib/typescript/module/src/components/modal-type-activities/interface.d.ts +1 -0
  40. package/lib/typescript/module/src/components/modal-type-activities/interface.d.ts.map +1 -1
  41. package/lib/typescript/module/src/components/modal-type-activities/mock/index.d.ts +17 -0
  42. package/lib/typescript/module/src/components/modal-type-activities/mock/index.d.ts.map +1 -1
  43. package/lib/typescript/module/src/components/modals/modal-change-activitie-history/helpers/index.d.ts +13 -0
  44. package/lib/typescript/module/src/components/modals/modal-change-activitie-history/helpers/index.d.ts.map +1 -0
  45. package/lib/typescript/module/src/components/modals/modal-change-activitie-history/index.d.ts +10 -0
  46. package/lib/typescript/module/src/components/modals/modal-change-activitie-history/index.d.ts.map +1 -0
  47. package/lib/typescript/module/src/components/modals/modal-change-activitie-history/interface.d.ts +18 -0
  48. package/lib/typescript/module/src/components/modals/modal-change-activitie-history/interface.d.ts.map +1 -0
  49. package/lib/typescript/module/src/components/step-indicator/index.d.ts +3 -9
  50. package/lib/typescript/module/src/components/step-indicator/index.d.ts.map +1 -1
  51. package/package.json +1 -1
  52. package/src/components/modal-type-activities/index.tsx +173 -169
  53. package/src/components/modal-type-activities/interface.ts +36 -34
  54. package/src/components/modal-type-activities/mock/index.ts +103 -65
  55. package/src/components/modals/modal-change-activitie-history/helpers/index.ts +15 -0
  56. package/src/components/modals/modal-change-activitie-history/index.tsx +189 -0
  57. package/src/components/modals/modal-change-activitie-history/interface.ts +16 -0
  58. package/src/components/step-indicator/index.tsx +226 -155
  59. package/src/components/step-indicator/interface.d.ts +3 -2
@@ -1,65 +1,103 @@
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: 9,
38
- referencia: "descanso",
39
- cor_hex: "000000",
40
- descricao: "Descanso",
41
- tipo: "descanso",
42
- },
43
- {
44
- id: 7,
45
- referencia: "refeicao",
46
- cor_hex: "000000",
47
- descricao: "Refeição",
48
- tipo: "descanso",
49
- },
50
- {
51
- id: 6,
52
- referencia: "repouso_noturno",
53
- cor_hex: "000000",
54
- descricao: "Repouso Noturno",
55
- tipo: "descanso",
56
- },
57
- {
58
- id: 5,
59
- referencia: "repouso_semanal",
60
- cor_hex: "000000",
61
- descricao: "Repouso Semanal",
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: 9,
38
+ referencia: "descanso",
39
+ cor_hex: "000000",
40
+ descricao: "Descanso",
41
+ tipo: "descanso",
42
+ },
43
+ {
44
+ id: 7,
45
+ referencia: "refeicao",
46
+ cor_hex: "000000",
47
+ descricao: "Refeição",
48
+ tipo: "descanso",
49
+ },
50
+ {
51
+ id: 6,
52
+ referencia: "repouso_noturno",
53
+ cor_hex: "000000",
54
+ descricao: "Repouso Noturno",
55
+ tipo: "descanso",
56
+ },
57
+ {
58
+ id: 5,
59
+ referencia: "repouso_semanal",
60
+ cor_hex: "000000",
61
+ descricao: "Repouso Semanal",
62
+ tipo: "descanso",
63
+ },
64
+ ],
65
+ };
66
+
67
+ export const activitiesReserva = {
68
+ trabalho: [
69
+ {
70
+ id: 10,
71
+ referencia: "reserva",
72
+ cor_hex: "000000",
73
+ descricao: "Disposição Reserva",
74
+ tipo: "trabalho",
75
+ },
76
+ ],
77
+ descanso: [
78
+ {
79
+ id: 6,
80
+ atividade_id: 6,
81
+ referencia: "repouso_noturno",
82
+ cor_hex: "000000",
83
+ descricao: "Repouso Noturno",
84
+ tipo: "descanso",
85
+ },
86
+ {
87
+ id: 7,
88
+ atividade_id: 7,
89
+ referencia: "refeicao",
90
+ cor_hex: "000000",
91
+ descricao: "Refeição",
92
+ tipo: "descanso",
93
+ },
94
+ {
95
+ id: 5,
96
+ atividade_id: 5,
97
+ referencia: "repouso_semanal",
98
+ cor_hex: "000000",
99
+ descricao: "Repouso Semanal",
100
+ tipo: "descanso",
101
+ },
102
+ ],
103
+ };
@@ -0,0 +1,15 @@
1
+ /**
2
+ * CONSTANTS
3
+ */
4
+ const optionsActivities = [
5
+ { label: "Selecione atividade", value: "none", key: 0 },
6
+ { label: "Descanso", value: "descanso", key: 9 },
7
+ { label: "Repouso Noturno", value: "repouso_noturno", key: 6 },
8
+ { label: "Refeição", value: "refeição", key: 7 },
9
+ { label: "Repouso Semanal", value: "repouso_semanal", key: 5 },
10
+ ];
11
+
12
+ /**
13
+ * EXPORTS
14
+ */
15
+ export { optionsActivities };
@@ -0,0 +1,189 @@
1
+ /**
2
+ * IMPORTS
3
+ */
4
+ import React from "react";
5
+ // libs RN
6
+ import { Modal, View } from "react-native";
7
+
8
+ // componentes
9
+ import Box from "../../box";
10
+ import Button from "../../button";
11
+ import Typography from "../../typography";
12
+ import SelectOption from "../../selects/select-option";
13
+
14
+ // assets / icons
15
+ import { Icons } from "../../../common/icons-svg";
16
+
17
+ // helpers / data
18
+ import { optionsActivities } from "./helpers";
19
+
20
+ // typings
21
+ import type { IModalChangeActivityProps } from "./interface";
22
+
23
+ // styles / theme
24
+ import { theme } from "../../../styles/theme/theme";
25
+
26
+ /**
27
+ * Componente Modal para alteração de atividade.
28
+ */
29
+ export const ModalChangeActivity: React.FC<IModalChangeActivityProps> = ({
30
+ visible,
31
+ onClose,
32
+ modalConfirm,
33
+ descricao,
34
+ }) => {
35
+ const [isLoading] = React.useState(false);
36
+
37
+ const initial = (descricao ?? "").toLowerCase().replace(/\s+/g, "_");
38
+ const [selectedOption, setSelectedOption] = React.useState(initial || "none");
39
+
40
+ const handleConfirm = () => {
41
+ const selected = optionsActivities?.find((activity) => activity.value === selectedOption);
42
+
43
+ if (selected && selected.value !== "none") {
44
+ modalConfirm({
45
+ label: selected.label,
46
+ value: selected.value,
47
+ key: selected.key,
48
+ });
49
+ }
50
+
51
+ // sempre fechar o modal
52
+ onClose();
53
+ };
54
+
55
+ const handleSelectDown = (activity: string) => {
56
+ const option = optionsActivities.find((o) => o.label === activity || o.value === activity);
57
+
58
+ if (option) setSelectedOption(option.value);
59
+ };
60
+
61
+ return (
62
+ <Modal animationType="fade" transparent visible={visible}>
63
+ <View
64
+ style={{
65
+ flex: 1,
66
+ justifyContent: "center",
67
+ alignItems: "center",
68
+ backgroundColor: "rgba(0,0,0,0.6)",
69
+ }}
70
+ >
71
+ <Box
72
+ width={346}
73
+ backgroundColor={theme.colors.orange[500]}
74
+ borderStyled={{
75
+ borderRadius: theme.borderWidths.thick_medium,
76
+ }}
77
+ paddingStyle={{
78
+ paddingLeft: theme.paddings["2xs"],
79
+ paddingRight: theme.paddings["2xs"],
80
+ paddingTop: theme.paddings.sm,
81
+ paddingBottom: theme.paddings.sm,
82
+ }}
83
+ >
84
+ <Box
85
+ marginStyle={{ marginBottom: theme.margins["2xs"], marginLeft: theme.margins["1xs"] }}
86
+ flexStyle={{ flexDirection: "row", alignItems: "center" }}
87
+ >
88
+ <Icons
89
+ icon="EXCLAMATION_TRIANGLE"
90
+ color={theme.colors.black[10]}
91
+ background={theme.colors.yellow[50]}
92
+ size={theme.fontSizes["2xl"]}
93
+ />
94
+
95
+ <Typography
96
+ text="Alterar Atividade"
97
+ color="#fff"
98
+ marginLeft={theme.margins["2xs"]}
99
+ fontFamily={theme.fonts.inter_bold_700}
100
+ size={theme.fontSizes.md}
101
+ />
102
+ </Box>
103
+
104
+ <Box
105
+ backgroundColor={theme.colors.neutral[300]}
106
+ paddingStyle={{ padding: theme.paddings.xs }}
107
+ borderStyled={{ borderRadius: theme.borderWidths.thick_medium }}
108
+ >
109
+ <Box flexStyle={{ flexDirection: "row", justifyContent: "flex-start" }} width={"100%"}>
110
+ <Typography
111
+ text={`Deseja realmente alterar sua atividade?`}
112
+ color={theme.colors.black[25]}
113
+ fontFamily={theme.fonts.inter_medium_500}
114
+ size={theme.fontSizes.xs}
115
+ style={{ flexWrap: "wrap", maxWidth: "100%" }}
116
+ />
117
+ </Box>
118
+
119
+ <SelectOption
120
+ titleLabel="Selecione atividade"
121
+ sizeTitleLabel={theme.fontSizes.xs}
122
+ dataOption={optionsActivities}
123
+ handleSelectDown={handleSelectDown}
124
+ backgroundColor={theme.colors.neutral[300]}
125
+ />
126
+
127
+ <Box
128
+ marginStyle={{ marginTop: theme.margins["1xs"] }}
129
+ flexStyle={{ flexDirection: "row", justifyContent: "space-between" }}
130
+ >
131
+ <Button
132
+ title="CANCELAR"
133
+ onPress={onClose}
134
+ width={"48%"}
135
+ height={36}
136
+ isLoading={isLoading}
137
+ disabled={isLoading}
138
+ backgroundColor={theme.colors.neutral[300]}
139
+ buttonTextStyle={{
140
+ color: theme.colors.blue[100],
141
+ fontFamily: "Inter-Medium",
142
+ fontSize: theme.fontSizes.xs,
143
+ fontWeight: "500",
144
+ }}
145
+ flexStyle={{
146
+ flexDirection: "row",
147
+ alignItems: "center",
148
+ justifyContent: "center",
149
+ textAlign: "center",
150
+ }}
151
+ borderStyled={{
152
+ borderWidth: theme.borderWidths.thin,
153
+ borderColor: theme.colors.blue[100],
154
+ borderRadius: theme.borderWidths.thick_medium,
155
+ }}
156
+ />
157
+ <Button
158
+ title="CONFIRMAR"
159
+ onPress={handleConfirm}
160
+ width={"48%"}
161
+ height={36}
162
+ isLoading={isLoading}
163
+ disabled={isLoading}
164
+ backgroundColor={theme.colors.blue[100]}
165
+ buttonTextStyle={{
166
+ color: "#fff",
167
+ fontFamily: "Inter-Medium",
168
+ fontSize: theme.fontSizes.xs,
169
+ fontWeight: "500",
170
+ }}
171
+ flexStyle={{
172
+ flexDirection: "row",
173
+ alignItems: "center",
174
+ justifyContent: "center",
175
+ textAlign: "center",
176
+ }}
177
+ borderStyled={{
178
+ borderWidth: theme.borderWidths.thin,
179
+ borderColor: theme.colors.blue[100],
180
+ borderRadius: theme.borderWidths.thick_medium,
181
+ }}
182
+ />
183
+ </Box>
184
+ </Box>
185
+ </Box>
186
+ </View>
187
+ </Modal>
188
+ );
189
+ };
@@ -0,0 +1,16 @@
1
+ /**
2
+ * IMPROTS
3
+ */
4
+
5
+ interface IModalChangeActivityProps {
6
+ visible: boolean;
7
+ onClose: () => void;
8
+ // eslint-disable-next-line no-unused-vars
9
+ modalConfirm: (newData: { label: string; value: string; key: number }) => void;
10
+ descricao: string;
11
+ }
12
+
13
+ /**
14
+ * EXPORTS
15
+ */
16
+ export { type IModalChangeActivityProps };