jornada-ui 0.4.20 → 0.4.22

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 (53) hide show
  1. package/lib/commonjs/components/card-scheduled-journey/index.js +1 -1
  2. package/lib/commonjs/components/modal-type-activities/mock/index.js +1 -1
  3. package/lib/commonjs/components/modals/modal-to-confimations/index.js +1 -4
  4. package/lib/commonjs/components/modals/modal-to-confimations/index.js.map +1 -1
  5. package/lib/commonjs/components/step-indicator/index.js +2 -1
  6. package/lib/commonjs/components/step-indicator/index.js.map +1 -1
  7. package/lib/commonjs/components/trip-details-card/index.js +1 -0
  8. package/lib/commonjs/components/trip-details-card/index.js.map +1 -1
  9. package/lib/commonjs/components/weekly-table/components/row-table/index.js +6 -4
  10. package/lib/commonjs/components/weekly-table/components/row-table/index.js.map +1 -1
  11. package/lib/commonjs/components/weekly-table/index.js +68 -36
  12. package/lib/commonjs/components/weekly-table/index.js.map +1 -1
  13. package/lib/module/components/card-scheduled-journey/index.js +1 -1
  14. package/lib/module/components/modal-type-activities/mock/index.js +1 -1
  15. package/lib/module/components/modals/modal-to-confimations/index.js +1 -4
  16. package/lib/module/components/modals/modal-to-confimations/index.js.map +1 -1
  17. package/lib/module/components/step-indicator/index.js +2 -1
  18. package/lib/module/components/step-indicator/index.js.map +1 -1
  19. package/lib/module/components/trip-details-card/index.js +1 -0
  20. package/lib/module/components/trip-details-card/index.js.map +1 -1
  21. package/lib/module/components/weekly-table/components/row-table/index.js +6 -4
  22. package/lib/module/components/weekly-table/components/row-table/index.js.map +1 -1
  23. package/lib/module/components/weekly-table/index.js +57 -25
  24. package/lib/module/components/weekly-table/index.js.map +1 -1
  25. package/lib/typescript/commonjs/src/components/modals/modal-to-confimations/index.d.ts.map +1 -1
  26. package/lib/typescript/commonjs/src/components/step-indicator/index.d.ts.map +1 -1
  27. package/lib/typescript/commonjs/src/components/trip-details-card/index.d.ts.map +1 -1
  28. package/lib/typescript/commonjs/src/components/weekly-table/components/row-table/index.d.ts.map +1 -1
  29. package/lib/typescript/commonjs/src/components/weekly-table/components/row-table/interface.d.ts +2 -0
  30. package/lib/typescript/commonjs/src/components/weekly-table/components/row-table/interface.d.ts.map +1 -1
  31. package/lib/typescript/commonjs/src/components/weekly-table/index.d.ts.map +1 -1
  32. package/lib/typescript/commonjs/src/components/weekly-table/interface.d.ts +5 -0
  33. package/lib/typescript/commonjs/src/components/weekly-table/interface.d.ts.map +1 -1
  34. package/lib/typescript/module/src/components/modals/modal-to-confimations/index.d.ts.map +1 -1
  35. package/lib/typescript/module/src/components/step-indicator/index.d.ts.map +1 -1
  36. package/lib/typescript/module/src/components/trip-details-card/index.d.ts.map +1 -1
  37. package/lib/typescript/module/src/components/weekly-table/components/row-table/index.d.ts.map +1 -1
  38. package/lib/typescript/module/src/components/weekly-table/components/row-table/interface.d.ts +2 -0
  39. package/lib/typescript/module/src/components/weekly-table/components/row-table/interface.d.ts.map +1 -1
  40. package/lib/typescript/module/src/components/weekly-table/index.d.ts.map +1 -1
  41. package/lib/typescript/module/src/components/weekly-table/interface.d.ts +5 -0
  42. package/lib/typescript/module/src/components/weekly-table/interface.d.ts.map +1 -1
  43. package/package.json +1 -1
  44. package/src/components/card-scheduled-journey/index.tsx +1 -1
  45. package/src/components/modal-type-activities/mock/index.ts +1 -1
  46. package/src/components/modals/modal-to-confimations/index.tsx +1 -4
  47. package/src/components/step-indicator/index.tsx +2 -1
  48. package/src/components/step-indicator/interface.d.ts +3 -0
  49. package/src/components/trip-details-card/index.tsx +1 -0
  50. package/src/components/weekly-table/components/row-table/index.tsx +46 -44
  51. package/src/components/weekly-table/components/row-table/interface.ts +16 -14
  52. package/src/components/weekly-table/index.tsx +60 -17
  53. package/src/components/weekly-table/interface.ts +40 -33
@@ -1,44 +1,46 @@
1
- /**
2
- * IMPORTS
3
- */
4
- import React from "react";
5
-
6
- // components
7
- import Box from "../../../box";
8
- import Typography from "../../../typography";
9
-
10
- // typings
11
- import type { RowTableProps } from "./interface";
12
-
13
- // styles
14
- import { theme } from "../../../../styles/theme/theme";
15
-
16
- const RowTable: React.FC<RowTableProps> = ({
17
- texto,
18
- color = theme.colors.black[180],
19
- bold = false,
20
- customWidth = 55,
21
- }) => {
22
- return (
23
- <Box
24
- width={customWidth}
25
- paddingStyle={{ padding: 4 }}
26
- flexStyle={{
27
- justifyContent: "center",
28
- alignItems: "center",
29
- }}
30
- >
31
- <Typography
32
- text={texto}
33
- color={color}
34
- size={10}
35
- fontFamily={bold ? theme.fonts.inter_bold_700 : theme.fonts.inter_regular_400}
36
- />
37
- </Box>
38
- );
39
- };
40
-
41
- /**
42
- * EXPORTS
43
- */
44
- export { RowTable };
1
+ /**
2
+ * IMPORTS
3
+ */
4
+ import React from "react";
5
+
6
+ // components
7
+ import Box from "../../../box";
8
+ import Typography from "../../../typography";
9
+
10
+ // typings
11
+ import type { RowTableProps } from "./interface";
12
+
13
+ // styles
14
+ import { theme } from "../../../../styles/theme/theme";
15
+
16
+ const RowTable: React.FC<RowTableProps> = ({
17
+ testID = "row-table",
18
+ texto,
19
+ color = theme.colors.black[180],
20
+ bold = false,
21
+ customWidth = 55,
22
+ }) => {
23
+ return (
24
+ <Box
25
+ testID={testID}
26
+ width={customWidth}
27
+ paddingStyle={{ padding: 4 }}
28
+ flexStyle={{
29
+ justifyContent: "center",
30
+ alignItems: "center",
31
+ }}
32
+ >
33
+ <Typography
34
+ text={texto}
35
+ color={color}
36
+ size={10}
37
+ fontFamily={bold ? theme.fonts.inter_bold_700 : theme.fonts.inter_regular_400}
38
+ />
39
+ </Box>
40
+ );
41
+ };
42
+
43
+ /**
44
+ * EXPORTS
45
+ */
46
+ export { RowTable };
@@ -1,14 +1,16 @@
1
- /**
2
- * IMPORTS
3
- */
4
- type RowTableProps = {
5
- texto: string;
6
- color?: string;
7
- bold?: boolean;
8
- customWidth?: number;
9
- };
10
-
11
- /**
12
- * EXPORTS
13
- */
14
- export type { RowTableProps };
1
+ /**
2
+ * IMPORTS
3
+ */
4
+ type RowTableProps = {
5
+ /**Identificador para o components */
6
+ testID?: string;
7
+ texto: string;
8
+ color?: string;
9
+ bold?: boolean;
10
+ customWidth?: number;
11
+ };
12
+
13
+ /**
14
+ * EXPORTS
15
+ */
16
+ export type { RowTableProps };
@@ -2,10 +2,11 @@
2
2
  * IMPORTS
3
3
  */
4
4
  import React, { forwardRef } from "react";
5
- import { Dimensions, ScrollView } from "react-native";
5
+ import { ActivityIndicator, Dimensions, ScrollView, View } from "react-native";
6
6
 
7
7
  // components
8
8
  import Box from "../box";
9
+ import Typography from "../typography";
9
10
  import { RowTable } from "./components/row-table";
10
11
 
11
12
  // helpers
@@ -19,7 +20,7 @@ import { theme } from "../../styles/theme/theme";
19
20
  import { asBaseComponent } from "../../@types/as-base-component";
20
21
 
21
22
  const WeeklyTable = forwardRef<any, WeekCalendarProps>((props, ref): React.ReactElement => {
22
- const { semana } = props;
23
+ const { testID = "weekly-table", isLoading = false, semana } = props;
23
24
 
24
25
  const totalHoras = handleCalcularTotalHoras(semana);
25
26
 
@@ -38,7 +39,7 @@ const WeeklyTable = forwardRef<any, WeekCalendarProps>((props, ref): React.React
38
39
  };
39
40
 
40
41
  return (
41
- <ScrollView horizontal ref={ref} contentContainerStyle={{ width: "100%" }}>
42
+ <ScrollView testID={testID} horizontal ref={ref} contentContainerStyle={{ width: "100%" }}>
42
43
  <Box width={"100%"}>
43
44
  {/* Cabeçalho */}
44
45
  <Box
@@ -50,27 +51,43 @@ const WeeklyTable = forwardRef<any, WeekCalendarProps>((props, ref): React.React
50
51
  borderColor: theme.colors.blue[400],
51
52
  }}
52
53
  >
53
- <RowTable texto="DIA" bold color={theme.colors.neutral[25]} customWidth={colWidths.dia} />
54
54
  <RowTable
55
+ testID={`${testID}-title-dia`}
56
+ texto="DIA"
57
+ bold
58
+ color={theme.colors.neutral[25]}
59
+ customWidth={colWidths.dia}
60
+ />
61
+ <RowTable
62
+ testID={`${testID}-title-data`}
55
63
  texto="DATA"
56
64
  bold
57
65
  color={theme.colors.neutral[25]}
58
66
  customWidth={colWidths.data}
59
67
  />
60
68
  <RowTable
69
+ testID={`${testID}-title-jorna`}
61
70
  texto="JORNA"
62
71
  bold
63
72
  color={theme.colors.neutral[25]}
64
73
  customWidth={colWidths.jorna}
65
74
  />
66
- <RowTable texto="KMs" bold color={theme.colors.neutral[25]} customWidth={colWidths.kms} />
67
75
  <RowTable
76
+ testID={`${testID}-title-kms`}
77
+ texto="KMs"
78
+ bold
79
+ color={theme.colors.neutral[25]}
80
+ customWidth={colWidths.kms}
81
+ />
82
+ <RowTable
83
+ testID={`${testID}-title-picos`}
68
84
  texto="PICOS"
69
85
  bold
70
86
  color={theme.colors.neutral[25]}
71
87
  customWidth={colWidths.picos}
72
88
  />
73
89
  <RowTable
90
+ testID={`${testID}-title-falhas`}
74
91
  texto="FALHAS"
75
92
  bold
76
93
  color={theme.colors.neutral[25]}
@@ -79,23 +96,49 @@ const WeeklyTable = forwardRef<any, WeekCalendarProps>((props, ref): React.React
79
96
  </Box>
80
97
 
81
98
  {/* Linhas com os dados */}
82
- {semana.map((dia, index) => (
83
- <Box
84
- key={index}
85
- flexStyle={{ flexDirection: "row", justifyContent: "center" }}
86
- backgroundColor={index % 2 === 0 ? theme.colors.neutral[50] : theme.colors.neutral[300]}
99
+ {isLoading ? (
100
+ <View
101
+ testID={`${testID}-loading`}
102
+ style={{
103
+ width: "100%",
104
+ height: 250,
105
+ backgroundColor: "rgba(255,255,255,0.6)",
106
+ justifyContent: "center",
107
+ alignItems: "center",
108
+ }}
87
109
  >
88
- <RowTable texto={dia.dia ?? "-"} customWidth={colWidths.dia} />
89
- <RowTable texto={dia.entrada ?? "-"} customWidth={colWidths.data} />
90
- <RowTable texto={dia.saida ?? "-"} customWidth={colWidths.jorna} />
91
- <RowTable texto={(dia.kms ?? 0).toString()} customWidth={colWidths.kms} />
92
- <RowTable texto={(dia.picos ?? 0).toString()} customWidth={colWidths.picos} />
93
- <RowTable texto={(dia.falhas ?? 0).toString()} customWidth={colWidths.falhas} />
110
+ <ActivityIndicator size={24} color={theme.colors.blue[400]} />
111
+ <Typography
112
+ text="Carregando dados..."
113
+ color={theme.colors.black[100]}
114
+ fontFamily={theme.fonts.inter_regular_400}
115
+ size={theme.fontSizes.xs}
116
+ />
117
+ </View>
118
+ ) : (
119
+ <Box testID={`${testID}-content`}>
120
+ {semana.map((dia, index) => (
121
+ <Box
122
+ key={index}
123
+ flexStyle={{ flexDirection: "row", justifyContent: "center" }}
124
+ backgroundColor={
125
+ index % 2 === 0 ? theme.colors.neutral[50] : theme.colors.neutral[300]
126
+ }
127
+ >
128
+ <RowTable texto={dia.dia ?? "-"} customWidth={colWidths.dia} />
129
+ <RowTable texto={dia.entrada ?? "-"} customWidth={colWidths.data} />
130
+ <RowTable texto={dia.saida ?? "-"} customWidth={colWidths.jorna} />
131
+ <RowTable texto={(dia.kms ?? 0).toString()} customWidth={colWidths.kms} />
132
+ <RowTable texto={(dia.picos ?? 0).toString()} customWidth={colWidths.picos} />
133
+ <RowTable texto={(dia.falhas ?? 0).toString()} customWidth={colWidths.falhas} />
134
+ </Box>
135
+ ))}
94
136
  </Box>
95
- ))}
137
+ )}
96
138
 
97
139
  {/* Linha de totais */}
98
140
  <Box
141
+ testID={`${testID}-content-total`}
99
142
  flexStyle={{ flexDirection: "row" }}
100
143
  backgroundColor={theme.colors.green[100]}
101
144
  borderStyled={{
@@ -1,33 +1,40 @@
1
- /* eslint-disable no-unused-vars */
2
- /**
3
- * IMPORTS
4
- */
5
- import type { JSX } from "react";
6
-
7
- interface DayInfo {
8
- dia: string; // Ex: "SEG", "TER"
9
- entrada?: string; // Ex: "08:00"
10
- saida?: string; // Ex: "17:00" ou "REP"
11
- kms?: number; // Quilômetros percorridos no dia
12
- picos?: number; // Quantidade de picos
13
- falhas?: number; // Quantidade de falhas
14
- }
15
- interface WeekItem extends DayInfo {
16
- jornada?: string; // Ex: "08:00 - 17:00"
17
- }
18
- interface CampoProps {
19
- texto: string;
20
- bold?: boolean;
21
- color?: string;
22
- }
23
- interface WeekCalendarProps {
24
- semana: DayInfo[];
25
- }
26
- interface WeekCalendarComponent {
27
- (props: WeekCalendarProps): JSX.Element;
28
- }
29
-
30
- /**
31
- * EXPORTS
32
- */
33
- export type { DayInfo, WeekItem, CampoProps, WeekCalendarComponent, WeekCalendarProps };
1
+ /* eslint-disable no-unused-vars */
2
+ /**
3
+ * IMPORTS
4
+ */
5
+ import type { JSX } from "react";
6
+
7
+ interface DayInfo {
8
+ dia: string; // Ex: "SEG", "TER"
9
+ entrada?: string; // Ex: "08:00"
10
+ saida?: string; // Ex: "17:00" ou "REP"
11
+ kms?: number; // Quilômetros percorridos no dia
12
+ picos?: number; // Quantidade de picos
13
+ falhas?: number; // Quantidade de falhas
14
+ }
15
+ interface WeekItem extends DayInfo {
16
+ jornada?: string; // Ex: "08:00 - 17:00"
17
+ }
18
+ interface CampoProps {
19
+ texto: string;
20
+ bold?: boolean;
21
+ color?: string;
22
+ }
23
+ interface WeekCalendarProps {
24
+ /**Identificador para o components */
25
+ testID?: string;
26
+
27
+ /**Identificador para o components em carrega*/
28
+ isLoading?: boolean;
29
+
30
+ /**dados que vão ser renderizados */
31
+ semana: DayInfo[];
32
+ }
33
+ interface WeekCalendarComponent {
34
+ (props: WeekCalendarProps): JSX.Element;
35
+ }
36
+
37
+ /**
38
+ * EXPORTS
39
+ */
40
+ export type { DayInfo, WeekItem, CampoProps, WeekCalendarComponent, WeekCalendarProps };