jornada-ui 0.4.12 → 0.4.14

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 (106) hide show
  1. package/lib/commonjs/components/coil-removel-code/index.js +4 -3
  2. package/lib/commonjs/components/coil-removel-code/index.js.map +1 -1
  3. package/lib/commonjs/components/list-devices/components/list-device-empty/index.js +68 -0
  4. package/lib/commonjs/components/list-devices/components/list-device-empty/index.js.map +1 -0
  5. package/lib/commonjs/components/list-devices/components/list-device-render-item/index.js +77 -0
  6. package/lib/commonjs/components/list-devices/components/list-device-render-item/index.js.map +1 -0
  7. package/lib/commonjs/components/list-devices/index.js +33 -58
  8. package/lib/commonjs/components/list-devices/index.js.map +1 -1
  9. package/lib/commonjs/components/list-devices/interface.js +2 -0
  10. package/lib/commonjs/components/list-devices/interface.js.map +1 -0
  11. package/lib/commonjs/components/list-devices/styles.js +14 -3
  12. package/lib/commonjs/components/list-devices/styles.js.map +1 -1
  13. package/lib/commonjs/components/modals/modal-to-confimations/index.js +1 -1
  14. package/lib/commonjs/components/modals/modal-to-confimations/index.js.map +1 -1
  15. package/lib/commonjs/components/selects/select-option/index.js +22 -7
  16. package/lib/commonjs/components/selects/select-option/index.js.map +1 -1
  17. package/lib/commonjs/components/step-indicator/index.js +54 -40
  18. package/lib/commonjs/components/step-indicator/index.js.map +1 -1
  19. package/lib/commonjs/components/step-indicator/styles.js.map +1 -1
  20. package/lib/commonjs/components/trip-details-card/index.js +8 -9
  21. package/lib/commonjs/components/trip-details-card/index.js.map +1 -1
  22. package/lib/commonjs/stories/step-indicator/step-indicator.stories.js +1 -0
  23. package/lib/commonjs/stories/step-indicator/step-indicator.stories.js.map +1 -1
  24. package/lib/commonjs/utils/text-limit/index.js +37 -0
  25. package/lib/commonjs/utils/text-limit/index.js.map +1 -0
  26. package/lib/module/components/coil-removel-code/index.js +4 -3
  27. package/lib/module/components/coil-removel-code/index.js.map +1 -1
  28. package/lib/module/components/list-devices/components/list-device-empty/index.js +63 -0
  29. package/lib/module/components/list-devices/components/list-device-empty/index.js.map +1 -0
  30. package/lib/module/components/list-devices/components/list-device-render-item/index.js +74 -0
  31. package/lib/module/components/list-devices/components/list-device-render-item/index.js.map +1 -0
  32. package/lib/module/components/list-devices/index.js +36 -61
  33. package/lib/module/components/list-devices/index.js.map +1 -1
  34. package/lib/module/components/list-devices/interface.js +2 -0
  35. package/lib/module/components/list-devices/interface.js.map +1 -0
  36. package/lib/module/components/list-devices/styles.js +14 -3
  37. package/lib/module/components/list-devices/styles.js.map +1 -1
  38. package/lib/module/components/modals/modal-to-confimations/index.js +1 -1
  39. package/lib/module/components/modals/modal-to-confimations/index.js.map +1 -1
  40. package/lib/module/components/selects/select-option/index.js +22 -7
  41. package/lib/module/components/selects/select-option/index.js.map +1 -1
  42. package/lib/module/components/step-indicator/index.js +55 -41
  43. package/lib/module/components/step-indicator/index.js.map +1 -1
  44. package/lib/module/components/step-indicator/styles.js.map +1 -1
  45. package/lib/module/components/trip-details-card/index.js +11 -11
  46. package/lib/module/components/trip-details-card/index.js.map +1 -1
  47. package/lib/module/stories/step-indicator/step-indicator.stories.js +1 -0
  48. package/lib/module/stories/step-indicator/step-indicator.stories.js.map +1 -1
  49. package/lib/module/utils/text-limit/index.js +32 -0
  50. package/lib/module/utils/text-limit/index.js.map +1 -0
  51. package/lib/typescript/commonjs/src/components/coil-removel-code/index.d.ts.map +1 -1
  52. package/lib/typescript/commonjs/src/components/list-devices/components/list-device-empty/index.d.ts +10 -0
  53. package/lib/typescript/commonjs/src/components/list-devices/components/list-device-empty/index.d.ts.map +1 -0
  54. package/lib/typescript/commonjs/src/components/list-devices/components/list-device-render-item/index.d.ts +22 -0
  55. package/lib/typescript/commonjs/src/components/list-devices/components/list-device-render-item/index.d.ts.map +1 -0
  56. package/lib/typescript/commonjs/src/components/list-devices/index.d.ts.map +1 -1
  57. package/lib/typescript/commonjs/src/components/list-devices/interface.d.ts +29 -0
  58. package/lib/typescript/commonjs/src/components/list-devices/interface.d.ts.map +1 -0
  59. package/lib/typescript/commonjs/src/components/list-devices/styles.d.ts +5 -5
  60. package/lib/typescript/commonjs/src/components/list-devices/styles.d.ts.map +1 -1
  61. package/lib/typescript/commonjs/src/components/selects/select-option/index.d.ts.map +1 -1
  62. package/lib/typescript/commonjs/src/components/step-indicator/index.d.ts.map +1 -1
  63. package/lib/typescript/commonjs/src/components/step-indicator/styles.d.ts +2 -2
  64. package/lib/typescript/commonjs/src/components/step-indicator/styles.d.ts.map +1 -1
  65. package/lib/typescript/commonjs/src/components/trip-details-card/index.d.ts.map +1 -1
  66. package/lib/typescript/commonjs/src/stories/step-indicator/step-indicator.stories.d.ts.map +1 -1
  67. package/lib/typescript/commonjs/src/utils/text-limit/index.d.ts +14 -0
  68. package/lib/typescript/commonjs/src/utils/text-limit/index.d.ts.map +1 -0
  69. package/lib/typescript/module/src/components/coil-removel-code/index.d.ts.map +1 -1
  70. package/lib/typescript/module/src/components/list-devices/components/list-device-empty/index.d.ts +10 -0
  71. package/lib/typescript/module/src/components/list-devices/components/list-device-empty/index.d.ts.map +1 -0
  72. package/lib/typescript/module/src/components/list-devices/components/list-device-render-item/index.d.ts +22 -0
  73. package/lib/typescript/module/src/components/list-devices/components/list-device-render-item/index.d.ts.map +1 -0
  74. package/lib/typescript/module/src/components/list-devices/index.d.ts.map +1 -1
  75. package/lib/typescript/module/src/components/list-devices/interface.d.ts +29 -0
  76. package/lib/typescript/module/src/components/list-devices/interface.d.ts.map +1 -0
  77. package/lib/typescript/module/src/components/list-devices/styles.d.ts +5 -5
  78. package/lib/typescript/module/src/components/list-devices/styles.d.ts.map +1 -1
  79. package/lib/typescript/module/src/components/selects/select-option/index.d.ts.map +1 -1
  80. package/lib/typescript/module/src/components/step-indicator/index.d.ts.map +1 -1
  81. package/lib/typescript/module/src/components/step-indicator/styles.d.ts +2 -2
  82. package/lib/typescript/module/src/components/step-indicator/styles.d.ts.map +1 -1
  83. package/lib/typescript/module/src/components/trip-details-card/index.d.ts.map +1 -1
  84. package/lib/typescript/module/src/stories/step-indicator/step-indicator.stories.d.ts.map +1 -1
  85. package/lib/typescript/module/src/utils/text-limit/index.d.ts +14 -0
  86. package/lib/typescript/module/src/utils/text-limit/index.d.ts.map +1 -0
  87. package/package.json +1 -1
  88. package/src/components/coil-removel-code/index.tsx +8 -3
  89. package/src/components/coil-removel-code/interface.d.ts +14 -13
  90. package/src/components/list-devices/components/list-device-empty/index.tsx +60 -0
  91. package/src/components/list-devices/components/list-device-render-item/index.tsx +86 -0
  92. package/src/components/list-devices/index.tsx +71 -102
  93. package/src/components/list-devices/{interface.d.ts → interface.ts} +36 -36
  94. package/src/components/list-devices/styles.ts +73 -68
  95. package/src/components/modals/modal-to-confimations/index.tsx +1 -1
  96. package/src/components/selects/select-option/index.tsx +124 -95
  97. package/src/components/step-indicator/index.tsx +56 -36
  98. package/src/components/step-indicator/interface.d.ts +14 -3
  99. package/src/components/step-indicator/styles.ts +2 -2
  100. package/src/components/trip-details-card/index.tsx +267 -270
  101. package/src/stories/step-indicator/step-indicator.stories.tsx +1 -0
  102. package/src/utils/text-limit/index.ts +28 -0
  103. package/lib/commonjs/components/list-devices/interface.d.js +0 -2
  104. package/lib/commonjs/components/list-devices/interface.d.js.map +0 -1
  105. package/lib/module/components/list-devices/interface.d.js +0 -2
  106. package/lib/module/components/list-devices/interface.d.js.map +0 -1
@@ -1,95 +1,124 @@
1
- /**
2
- * IMPORTS
3
- */
4
- import React, { forwardRef, useState } from "react";
5
- import { View, Text, TouchableOpacity, Modal, FlatList } from "react-native";
6
-
7
- // commons / svg
8
- import { Icons } from "../../../common/icons-svg";
9
-
10
- // typings
11
- import { asBaseComponent } from "../../../@types/as-base-component";
12
- import type { ISelectDropDownProps } from "./interface";
13
-
14
- // styles
15
- import { styles } from "./styles";
16
- import { theme } from "../../../styles/theme/theme";
17
-
18
- const SelectOption = forwardRef<any, ISelectDropDownProps>((props, ref): React.ReactElement => {
19
- const { dataOption, handleSelectDown, titleLabel, sizeTitleLabel, colortitleLabel, backgroundColor } = props;
20
-
21
- const [selectedValue, setSelectedValue] = useState(dataOption[0]?.value || "");
22
- const [modalVisible, setModalVisible] = useState(false);
23
-
24
- const handleSelect = (value: string) => {
25
- setSelectedValue(value);
26
- setModalVisible(false);
27
- handleSelectDown(value);
28
- };
29
-
30
- const styleProps = {
31
- dataOption,
32
- handleSelectDown,
33
- titleLabel,
34
- sizeTitleLabel,
35
- colortitleLabel,
36
- backgroundColor,
37
- } as ISelectDropDownProps;
38
- return (
39
- <View ref={ref} style={styles(styleProps).container}>
40
- {/* Titulo para exibir o label */}
41
- <Text style={styles(styleProps).label}>{`${titleLabel ?? "Selecione uma opção"}`}:</Text>
42
-
43
- {/* Botão para abrir o modal */}
44
- <TouchableOpacity
45
- testID="select-box"
46
- style={styles(styleProps).selectBox}
47
- onPress={() => setModalVisible(true)}
48
- >
49
- <Text style={styles(styleProps).selectedText}>
50
- {dataOption.find((item) => item.value === selectedValue)?.label}
51
- </Text>
52
-
53
- <Icons
54
- size={theme.fontSizes["md"]}
55
- color={theme.colors.blue[500]}
56
- icon={"ARROW_DROP_DOWN"}
57
- />
58
- </TouchableOpacity>
59
-
60
- {/* Modal para exibir as opções */}
61
- <Modal testID="modal-container" visible={modalVisible} transparent animationType="fade">
62
- <View style={styles(styleProps).modalOverlay}>
63
- <View style={styles(styleProps).modalContainer}>
64
- <View style={{ width: "100%", alignItems: "flex-end" }}>
65
- <TouchableOpacity testID="close-icon" onPress={() => setModalVisible(false)}>
66
- <Icons
67
- size={theme.fontSizes["md"]}
68
- color={theme.colors.blue[500]}
69
- icon={"CLOSED"}
70
- />
71
- </TouchableOpacity>
72
- </View>
73
- <FlatList
74
- data={dataOption || []}
75
- keyExtractor={(item) => item.value}
76
- renderItem={({ item }) => (
77
- <TouchableOpacity
78
- style={styles(styleProps).option}
79
- onPress={() => handleSelect(item.value)}
80
- >
81
- <Text style={styles(styleProps).optionText}>{item.label}</Text>
82
- </TouchableOpacity>
83
- )}
84
- />
85
- </View>
86
- </View>
87
- </Modal>
88
- </View>
89
- );
90
- });
91
-
92
- /**
93
- * Componente SelectOption para a interação da ui.
94
- */
95
- export default asBaseComponent(SelectOption);
1
+ /**
2
+ * IMPORTS
3
+ */
4
+ import React, { forwardRef, useState } from "react";
5
+ import { View, Text, TouchableOpacity, Modal, FlatList } from "react-native";
6
+
7
+ // commons / svg
8
+ import { Icons } from "../../../common/icons-svg";
9
+
10
+ // utils
11
+ import { handleLimitTextdisplayByAmount } from "../../../utils/text-limit";
12
+
13
+ // typings
14
+ import { asBaseComponent } from "../../../@types/as-base-component";
15
+ import type { ISelectDropDownProps } from "./interface";
16
+
17
+ // styles
18
+ import { styles } from "./styles";
19
+ import { theme } from "../../../styles/theme/theme";
20
+
21
+ const SelectOption = forwardRef<any, ISelectDropDownProps>((props, ref): React.ReactElement => {
22
+ const {
23
+ dataOption,
24
+ handleSelectDown,
25
+ titleLabel,
26
+ sizeTitleLabel,
27
+ colortitleLabel,
28
+ backgroundColor,
29
+ } = props;
30
+
31
+ const [selectedValue, setSelectedValue] = useState(dataOption[0]?.value || "");
32
+ const [modalVisible, setModalVisible] = useState(false);
33
+
34
+ const handleSelect = (value: string) => {
35
+ setSelectedValue(value);
36
+ setModalVisible(false);
37
+ handleSelectDown(value);
38
+ };
39
+
40
+ const styleProps = {
41
+ dataOption,
42
+ handleSelectDown,
43
+ titleLabel,
44
+ sizeTitleLabel,
45
+ colortitleLabel,
46
+ backgroundColor,
47
+ } as ISelectDropDownProps;
48
+ return (
49
+ <View ref={ref} style={styles(styleProps).container}>
50
+ {/* Titulo para exibir o label */}
51
+ <Text style={styles(styleProps).label}>{`${titleLabel ?? "Selecione uma opção"}`}:</Text>
52
+
53
+ {/* Botão para abrir o modal */}
54
+ <TouchableOpacity
55
+ testID="select-box"
56
+ style={styles(styleProps).selectBox}
57
+ onPress={() => setModalVisible(true)}
58
+ >
59
+ <Text style={styles(styleProps).selectedText} numberOfLines={1}>
60
+ {`${handleLimitTextdisplayByAmount({
61
+ limit: 42,
62
+ text: dataOption.find((item) => item.value === selectedValue)?.label!,
63
+ })}`}
64
+ </Text>
65
+
66
+ <Icons
67
+ size={theme.fontSizes["xs"]}
68
+ color={theme.colors.blue[500]}
69
+ icon={"ARROW_DROP_DOWN"}
70
+ />
71
+ </TouchableOpacity>
72
+
73
+ {/* Modal para exibir as opções */}
74
+ <Modal testID="modal-container" visible={modalVisible} transparent animationType="fade">
75
+ <View style={styles(styleProps).modalOverlay}>
76
+ <View style={styles(styleProps).modalContainer}>
77
+ <View
78
+ style={{
79
+ width: "100%",
80
+ alignItems: "flex-end",
81
+ height: 40,
82
+ paddingRight: 8,
83
+ }}
84
+ >
85
+ <TouchableOpacity
86
+ testID="close-icon"
87
+ onPress={() => setModalVisible(false)}
88
+ style={{
89
+ width: 40,
90
+ height: 45,
91
+ alignItems: "center",
92
+ justifyContent: "center",
93
+ }}
94
+ >
95
+ <Icons
96
+ size={theme.fontSizes["md"]}
97
+ color={theme.colors.blue[500]}
98
+ icon={"CLOSED"}
99
+ />
100
+ </TouchableOpacity>
101
+ </View>
102
+ <FlatList
103
+ data={dataOption || []}
104
+ keyExtractor={(item) => item.value}
105
+ renderItem={({ item }) => (
106
+ <TouchableOpacity
107
+ style={styles(styleProps).option}
108
+ onPress={() => handleSelect(item.value)}
109
+ >
110
+ <Text style={styles(styleProps).optionText}>{item.label}</Text>
111
+ </TouchableOpacity>
112
+ )}
113
+ />
114
+ </View>
115
+ </View>
116
+ </Modal>
117
+ </View>
118
+ );
119
+ });
120
+
121
+ /**
122
+ * Componente SelectOption para a interação da ui.
123
+ */
124
+ export default asBaseComponent(SelectOption);
@@ -2,7 +2,7 @@
2
2
  * IMPORTS
3
3
  */
4
4
  import React from "react";
5
- import { View, Text } from "react-native";
5
+ import { View, Text, TouchableOpacity } from "react-native";
6
6
 
7
7
  // commons / svg
8
8
  import { Icons } from "../../common/icons-svg";
@@ -30,49 +30,69 @@ const StepIndicator: React.FC<IStepIndicator> = ({
30
30
  textColorDescription,
31
31
  titleColor,
32
32
  titleNumberColor,
33
+ handleOnPressActivitie,
33
34
  }) => {
34
35
  const StepDefault = () => {
35
36
  return (
36
37
  <>
37
38
  {data!.length > 0 &&
38
- data!.map((history, index) => (
39
- <View testID="step-indicator" style={styles({}).containerIndicator} key={history.id}>
40
- <View style={styles({ sincronizado: history.sincronizado }).containerBall}>
41
- {data!?.length > 1 && index < data!?.length - 1 && (
42
- <View
43
- style={{
44
- width: 2,
45
- height: 84,
46
- marginTop: 116,
47
- position: "relative",
48
- backgroundColor: history.sincronizado
49
- ? theme.colors.blue[500]
50
- : theme.colors.orange[150],
51
- }}
52
- />
53
- )}
54
- <Text style={styles({ titleNumberColor }).titleNumber}>
55
- {data!?.length - index}
56
- </Text>
57
- </View>
39
+ data!.map((history, index) => {
40
+ // pegando primeira atividade pelo index
41
+ const isFirst = index === 0;
42
+ //pegando o tipo de atividade
43
+ const isEditableType = history.tipo === "descanso";
44
+
45
+ // pegando o valor para saber se atividade ta ou não sincronizada
46
+ const isSynced = history?.sincronizado === true;
47
+
48
+ const canEdit = isFirst && isEditableType && isSynced;
49
+
50
+ return (
51
+ <TouchableOpacity
52
+ testID="step-indicator"
53
+ activeOpacity={0.7}
54
+ key={history.id}
55
+ style={styles({}).containerIndicator}
56
+ disabled={!canEdit}
57
+ onPress={() => handleOnPressActivitie(history as any)}
58
+ >
59
+ <View style={styles({ sincronizado: history.sincronizado }).containerBall}>
60
+ {data!?.length > 1 && index < data!?.length - 1 && (
61
+ <View
62
+ style={{
63
+ width: 2,
64
+ height: 84,
65
+ marginTop: 116,
66
+ position: "relative",
67
+ backgroundColor: history.sincronizado
68
+ ? theme.colors.blue[500]
69
+ : theme.colors.orange[150],
70
+ }}
71
+ />
72
+ )}
73
+ <Text style={styles({ titleNumberColor }).titleNumber}>
74
+ {data!?.length - index}
75
+ </Text>
76
+ </View>
58
77
 
59
- <View style={styles({}).containerMain}>
60
- <Text style={styles({ titleColor }).title}>{history?.descricao}</Text>
78
+ <View style={styles({}).containerMain}>
79
+ <Text style={styles({ titleColor }).title}>{history?.descricao}</Text>
61
80
 
62
- {history?.data_inicio && (
63
- <Text style={styles({ textColorDescription }).titleDescription}>
64
- {`Inicio: ${history.data_inicio} ás ${history.data_fim}`}
65
- </Text>
66
- )}
81
+ {history?.data_inicio && (
82
+ <Text style={styles({ textColorDescription }).titleDescription}>
83
+ {`Inicio: ${history.data_inicio} ás ${history.data_fim}`}
84
+ </Text>
85
+ )}
67
86
 
68
- {history.duracao_segundos && (
69
- <Text style={styles({ textColorDescription }).titleDescription}>
70
- Duração: {formHoursMinute(history?.duracao_segundos as string)}
71
- </Text>
72
- )}
73
- </View>
74
- </View>
75
- ))}
87
+ {history.duracao_segundos && (
88
+ <Text style={styles({ textColorDescription }).titleDescription}>
89
+ Duração: {formHoursMinute(history?.duracao_segundos as string)}
90
+ </Text>
91
+ )}
92
+ </View>
93
+ </TouchableOpacity>
94
+ );
95
+ })}
76
96
  </>
77
97
  );
78
98
  };
@@ -1,3 +1,4 @@
1
+ /* eslint-disable no-unused-vars */
1
2
  /**
2
3
  * IMPORTS
3
4
  */
@@ -9,7 +10,17 @@ type IData = {
9
10
  data_fim: string;
10
11
  descricao: string;
11
12
  sincronizado;
13
+ tipo: string;
14
+ referencia: string;
12
15
  };
16
+
17
+ type IStyleProps = {
18
+ sincronizado?: boolean;
19
+ titleColor?: string;
20
+ titleNumberColor?: string;
21
+ textColorDescription?: string;
22
+ };
23
+
13
24
  interface IStepIndicator {
14
25
  /**dados que vão ser renderizados */
15
26
  data?: IData[];
@@ -26,10 +37,10 @@ interface IStepIndicator {
26
37
  /**cor do texto da descrição */
27
38
  textColorDescription?: string;
28
39
 
29
- /**verifica se foi sincronizado com back end */
30
- sincronizado?: boolean;
40
+ /**params para lidar com selecionamento de atividade única */
41
+ handleOnPressActivitie: (data: IData) => void;
31
42
  }
32
43
  /**
33
44
  * EXPORTS
34
45
  */
35
- export { type IStepIndicator };
46
+ export { type IStepIndicator, IStyleProps };
@@ -5,12 +5,12 @@
5
5
  import { StyleSheet } from "react-native";
6
6
 
7
7
  // typings
8
- import { type IStepIndicator } from "./interface";
8
+ import { type IStyleProps } from "./interface";
9
9
 
10
10
  // styles
11
11
  import { theme } from "../../styles/theme/theme";
12
12
 
13
- const styles = (props: IStepIndicator) =>
13
+ const styles = (props: IStyleProps) =>
14
14
  StyleSheet.create({
15
15
  containerIndicator: {
16
16
  width: "100%",