react-native-exp-fig 0.1.21 → 0.1.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 (95) hide show
  1. package/lib/commonjs/@types/as-base-component.js +12 -0
  2. package/lib/commonjs/@types/as-base-component.js.map +1 -0
  3. package/lib/commonjs/common/icons-svg/constants/index.js +2 -1
  4. package/lib/commonjs/common/icons-svg/constants/index.js.map +1 -1
  5. package/lib/commonjs/common/icons-svg/eclamation-triangle/index.js +33 -0
  6. package/lib/commonjs/common/icons-svg/eclamation-triangle/index.js.map +1 -0
  7. package/lib/commonjs/common/icons-svg/index.js +8 -0
  8. package/lib/commonjs/common/icons-svg/index.js.map +1 -1
  9. package/lib/commonjs/common/icons-svg/truck/index.js +2 -2
  10. package/lib/commonjs/common/icons-svg/truck/index.js.map +1 -1
  11. package/lib/commonjs/components/box/index.js +11 -11
  12. package/lib/commonjs/components/box/index.js.map +1 -1
  13. package/lib/commonjs/components/history-activities-card/index.js +197 -0
  14. package/lib/commonjs/components/history-activities-card/index.js.map +1 -0
  15. package/lib/commonjs/components/history-activities-card/interface.js +6 -0
  16. package/lib/commonjs/components/history-activities-card/interface.js.map +1 -0
  17. package/lib/commonjs/components/modal-change-activity/index.js +216 -0
  18. package/lib/commonjs/components/modal-change-activity/index.js.map +1 -0
  19. package/lib/commonjs/components/selects/select-option/index.js +28 -11
  20. package/lib/commonjs/components/selects/select-option/index.js.map +1 -1
  21. package/lib/commonjs/components/selects/select-option/interface.d.js.map +1 -1
  22. package/lib/commonjs/components/step-indicator/index.js +45 -7
  23. package/lib/commonjs/components/step-indicator/index.js.map +1 -1
  24. package/lib/commonjs/helpers/text-utils.js +21 -0
  25. package/lib/commonjs/helpers/text-utils.js.map +1 -0
  26. package/lib/commonjs/index.js +14 -0
  27. package/lib/commonjs/index.js.map +1 -1
  28. package/lib/commonjs/stories/history-activities-card/history-activities-card.stories.js +104 -0
  29. package/lib/commonjs/stories/history-activities-card/history-activities-card.stories.js.map +1 -0
  30. package/lib/commonjs/stories/modal-change-activity/modal-change-activity.stories.js +52 -0
  31. package/lib/commonjs/stories/modal-change-activity/modal-change-activity.stories.js.map +1 -0
  32. package/lib/commonjs/utils/get-icon-by-property/index.js.map +1 -1
  33. package/lib/module/@types/as-base-component.js +6 -0
  34. package/lib/module/@types/as-base-component.js.map +1 -0
  35. package/lib/module/common/icons-svg/constants/index.js +2 -1
  36. package/lib/module/common/icons-svg/constants/index.js.map +1 -1
  37. package/lib/module/common/icons-svg/eclamation-triangle/index.js +25 -0
  38. package/lib/module/common/icons-svg/eclamation-triangle/index.js.map +1 -0
  39. package/lib/module/common/icons-svg/index.js +8 -0
  40. package/lib/module/common/icons-svg/index.js.map +1 -1
  41. package/lib/module/common/icons-svg/truck/index.js +2 -2
  42. package/lib/module/common/icons-svg/truck/index.js.map +1 -1
  43. package/lib/module/components/box/index.js +10 -8
  44. package/lib/module/components/box/index.js.map +1 -1
  45. package/lib/module/components/history-activities-card/index.js +190 -0
  46. package/lib/module/components/history-activities-card/index.js.map +1 -0
  47. package/lib/module/components/history-activities-card/interface.js +2 -0
  48. package/lib/module/components/history-activities-card/interface.js.map +1 -0
  49. package/lib/module/components/modal-change-activity/index.js +207 -0
  50. package/lib/module/components/modal-change-activity/index.js.map +1 -0
  51. package/lib/module/components/selects/select-option/index.js +28 -11
  52. package/lib/module/components/selects/select-option/index.js.map +1 -1
  53. package/lib/module/components/selects/select-option/interface.d.js.map +1 -1
  54. package/lib/module/components/step-indicator/index.js +45 -7
  55. package/lib/module/components/step-indicator/index.js.map +1 -1
  56. package/lib/module/helpers/text-utils.js +14 -0
  57. package/lib/module/helpers/text-utils.js.map +1 -0
  58. package/lib/module/index.js +4 -2
  59. package/lib/module/index.js.map +1 -1
  60. package/lib/module/stories/history-activities-card/history-activities-card.stories.js +97 -0
  61. package/lib/module/stories/history-activities-card/history-activities-card.stories.js.map +1 -0
  62. package/lib/module/stories/modal-change-activity/modal-change-activity.stories.js +45 -0
  63. package/lib/module/stories/modal-change-activity/modal-change-activity.stories.js.map +1 -0
  64. package/lib/module/utils/get-icon-by-property/index.js +0 -1
  65. package/lib/module/utils/get-icon-by-property/index.js.map +1 -1
  66. package/lib/typescript/src/@types/as-base-component.d.ts +2 -0
  67. package/lib/typescript/src/common/icons-svg/constants/index.d.ts +1 -0
  68. package/lib/typescript/src/common/icons-svg/eclamation-triangle/index.d.ts +4 -0
  69. package/lib/typescript/src/components/box/index.d.ts +3 -5
  70. package/lib/typescript/src/components/history-activities-card/index.d.ts +76 -0
  71. package/lib/typescript/src/components/history-activities-card/interface.d.ts +120 -0
  72. package/lib/typescript/src/components/modal-change-activity/index.d.ts +24 -0
  73. package/lib/typescript/src/helpers/text-utils.d.ts +7 -0
  74. package/lib/typescript/src/index.d.ts +2 -0
  75. package/lib/typescript/src/stories/history-activities-card/history-activities-card.stories.d.ts +10 -0
  76. package/lib/typescript/src/stories/modal-change-activity/modal-change-activity.stories.d.ts +9 -0
  77. package/lib/typescript/src/utils/get-icon-by-property/index.d.ts +2 -1
  78. package/package.json +11 -8
  79. package/src/@types/as-base-component.ts +9 -0
  80. package/src/common/icons-svg/constants/index.ts +1 -0
  81. package/src/common/icons-svg/eclamation-triangle/index.tsx +46 -0
  82. package/src/common/icons-svg/index.tsx +5 -1
  83. package/src/common/icons-svg/truck/index.tsx +2 -2
  84. package/src/components/box/index.tsx +49 -47
  85. package/src/components/history-activities-card/index.tsx +217 -0
  86. package/src/components/history-activities-card/interface.ts +147 -0
  87. package/src/components/modal-change-activity/index.tsx +202 -0
  88. package/src/components/selects/select-option/index.tsx +115 -100
  89. package/src/components/selects/select-option/interface.d.ts +18 -18
  90. package/src/components/step-indicator/index.tsx +63 -7
  91. package/src/helpers/text-utils.ts +15 -0
  92. package/src/index.ts +45 -43
  93. package/src/stories/history-activities-card/history-activities-card.stories.tsx +107 -0
  94. package/src/stories/modal-change-activity/modal-change-activity.stories.tsx +52 -0
  95. package/src/utils/get-icon-by-property/index.tsx +13 -1
@@ -0,0 +1,120 @@
1
+ /**
2
+ * IMPORTS
3
+ */
4
+ import type React from "react";
5
+ import { type DimensionValue, type ViewProps } from "react-native";
6
+ import type { PropertyType } from "../../utils/get-icon-by-property";
7
+ /**
8
+ * INTERFACE
9
+ */
10
+ declare type ICardActivitiesWeek = ViewProps & {
11
+ /**
12
+ * props que mostra o nome do usuário
13
+ */
14
+ name?: string;
15
+ /**
16
+ * props que mostra o ciclo do relatório - DIÁRIA OU SEMANAL
17
+ */
18
+ ciclo?: string;
19
+ /**
20
+ * props que mostra a data
21
+ */
22
+ data_start: string;
23
+ data_end?: string | null;
24
+ duration: string;
25
+ status?: string;
26
+ name_activitie: string;
27
+ referencia: PropertyType;
28
+ type_activitie: string;
29
+ avatar?: string;
30
+ idAtividade: number;
31
+ children?: React.ReactNode;
32
+ /**
33
+ * TestID para testes automático e identificação
34
+ */
35
+ testID?: string;
36
+ /**
37
+ * A propriedade CSS abreviada border define a borda de um elemento. Ele define os valores de largura da borda, estilo da borda e cor da borda.
38
+ */
39
+ borderStyled?: {
40
+ borderStyle?: "solid" | "dotted" | "dashed";
41
+ borderRadius?: number | DimensionValue;
42
+ borderTopRightRadius?: number | DimensionValue;
43
+ borderTopLeftRadius?: number | DimensionValue;
44
+ borderBottomRightRadius?: number | DimensionValue;
45
+ borderBottomLeftRadius?: number | DimensionValue;
46
+ borderWidth?: number | DimensionValue;
47
+ borderLeftWidth?: number | DimensionValue;
48
+ borderRightWidth?: number | DimensionValue;
49
+ borderTopWidth?: number | DimensionValue;
50
+ borderBottomWidth?: number | DimensionValue;
51
+ borderColor?: string;
52
+ borderBottomColor?: string;
53
+ borderLeftColor?: string;
54
+ borderRightColor?: string;
55
+ borderTopColor?: string;
56
+ };
57
+ /**
58
+ * Propriedades que define a orientação do button que é usada para representar uma página. Na maioria das vezes, esse valores corresponde ao posicionamento alvo da página impressa, se aplicável.
59
+ */
60
+ flexStyle?: {
61
+ alignItems?: "flex-start" | "flex-end" | "center" | "stretch" | "baseline";
62
+ alignSelf?: "auto" | "flex-start" | "flex-end" | "center" | "stretch" | "baseline";
63
+ flex?: string | number;
64
+ flexDirection?: "column" | "column-reverse" | "row" | "row-reverse";
65
+ flexWrap?: "nowrap" | "wrap" | "wrap-reverse";
66
+ textAlign?: "auto" | "center" | "left" | "right" | "justify";
67
+ justifyContent?: "flex-start" | "flex-end" | "center" | "space-between" | "space-around" | "space-evenly";
68
+ };
69
+ /**
70
+ * A propriedade margin do CSS define a área de margem nos quatro lados do elemento. É uma abreviação que define todas as margens individuais de uma só vez: margin-top, margin-right (en-US), margin-bottom, e margin-left (en-US).
71
+ */
72
+ marginStyle?: {
73
+ margin?: number | DimensionValue;
74
+ marginLeft?: number | DimensionValue;
75
+ marginRight?: number | DimensionValue;
76
+ marginTop?: number | DimensionValue;
77
+ marginBottom?: number | DimensionValue;
78
+ };
79
+ /**
80
+ * A propriedade padding define uma a distância entre o conteúdo de um elemento e suas bordas. É um atalho que evita definir uma distância para cada lado separadamente (padding-top, padding-right, padding-bottom, padding-left).
81
+ */
82
+ paddingStyle?: {
83
+ padding?: number | DimensionValue;
84
+ paddingLeft?: number | DimensionValue;
85
+ paddingRight?: number | DimensionValue;
86
+ paddingTop?: number | DimensionValue;
87
+ paddingBottom?: number | DimensionValue;
88
+ };
89
+ /**
90
+ * A propriedade CSS height define a altura de um elemento. A altura de um elemento é a distância do topo da borda superior do elemento ao fundo da borda inferior.
91
+ */
92
+ height?: number | DimensionValue;
93
+ /**
94
+ * A propriedade CSS width define a largura de um elemento. A largura de um elemento é a distância do topo da borda esquerda do elemento ao fundo da borda direita.
95
+ */
96
+ width?: number | DimensionValue;
97
+ /**
98
+ * O fundo abreviado CSS Propriedade define todas as propriedades do estilo de fundo de uma só vez, como cor, imagem, origem e tamanho ou método de repetição. As propriedades dos componentes não definidas no fundo da declaração de valor da propriedade abreviada são definidas como seus valores padrão..
99
+ * A Propriedade Background está sendo utilizada para definir a cor de fundo do cabeçalho do card e do ícone check.
100
+ */
101
+ backgroundColor?: string;
102
+ /**
103
+ * Propriedade texto que sera renderizado pro usuário final
104
+ */
105
+ text?: string;
106
+ /**
107
+ * A propriedade CSS color define o valor da cor de primeiro plano do texto e das decorações de texto de um elemento e define o valor currentcolor. currentcolor pode ser usado como um valor indireto em outras propriedades e é o padrão para outras propriedades de cores, como border-color.
108
+ */
109
+ color?: {
110
+ colorSvg?: string;
111
+ colorText?: string;
112
+ colorTextBold?: string;
113
+ colorTextData?: string;
114
+ };
115
+ iconColor?: string;
116
+ };
117
+ /**
118
+ * EXPORT
119
+ */
120
+ export type { ICardActivitiesWeek };
@@ -0,0 +1,24 @@
1
+ /**
2
+ * IMPORTS
3
+ */
4
+ import React from "react";
5
+ /**
6
+ * TYPES
7
+ */
8
+ interface IModalChangeActivityProps {
9
+ visible: boolean;
10
+ onClose: () => void;
11
+ modalConfirm: (newData: {
12
+ label: string;
13
+ value: string;
14
+ key: number;
15
+ }) => void;
16
+ dataRegistro: string;
17
+ descricao: string;
18
+ imagemUrl?: string;
19
+ }
20
+ /**
21
+ * COMPONENT
22
+ */
23
+ export declare const ModalChangeActivity: React.FC<IModalChangeActivityProps>;
24
+ export {};
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Função para limitar a quantidade de caracteres de um texto
3
+ * @param text - O texto a ser limitado
4
+ * @param maxLength - Número máximo de caracteres (padrão: 20)
5
+ * @returns Texto limitado com "..." se exceder o limite
6
+ */
7
+ export declare const truncateText: (text: string, maxLength?: number) => string;
@@ -32,6 +32,8 @@ export { ActivitiesDaily } from "./components/activities-daily";
32
32
  export { ActivitiesProgress } from "./components/activities-progress";
33
33
  export { ProfileMenuOption } from "./components/profile-menu-option";
34
34
  export { ModalActivities } from "./components/modal-activities";
35
+ export { HistoryActivitiesCard } from "./components/history-activities-card";
36
+ export { ModalChangeActivity } from "./components/modal-change-activity";
35
37
  export { multiply } from "./utils/mutiply";
36
38
  export { formatDate, getLastSevenDays, formHoursMinute } from "./utils/format-data";
37
39
  export { theme } from "./styles/theme/theme";
@@ -0,0 +1,10 @@
1
+ import type { StoryObj, Meta } from "@storybook/react";
2
+ import HistoryActivitiesCard from "../../components/history-activities-card";
3
+ declare const meta: Meta<typeof HistoryActivitiesCard>;
4
+ export default meta;
5
+ declare type Story = StoryObj<typeof meta>;
6
+ export declare const Default: Story;
7
+ export declare const WithoutAvatar: Story;
8
+ export declare const LongActivity: Story;
9
+ export declare const MinimalData: Story;
10
+ export declare const CompleteData: Story;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * IMPORTS
3
+ */
4
+ import type { Meta, StoryObj } from "@storybook/react";
5
+ import { ModalChangeActivity } from "../../components/modal-change-activity";
6
+ declare const meta: Meta<typeof ModalChangeActivity>;
7
+ export default meta;
8
+ declare type Story = StoryObj<typeof meta>;
9
+ export declare const Default: Story;
@@ -2,13 +2,14 @@
2
2
  * IMPORTS
3
3
  */
4
4
  import React from "react";
5
+ export declare type PropertyType = "operacao_veiculo" | "manutencao" | "aguardando_carga" | "disposicao_veiculo_parado" | "aguardando_descarga" | "descanso" | "repouso_semanal" | "repouso_noturno" | "refeicao" | "ferias";
5
6
  /**
6
7
  * Function that will map property types to corresponding icons in SVG 🛠️.
7
8
  * @param propertyType
8
9
  * @param color
9
10
  * @returns SVG
10
11
  */
11
- declare const getIconByProperty: React.FC<any>;
12
+ declare const getIconByProperty: (propertyType: PropertyType, color?: string) => React.ReactNode;
12
13
  /**
13
14
  * EXPORTS
14
15
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-exp-fig",
3
- "version": "0.1.21",
3
+ "version": "0.1.22",
4
4
  "description": "Biblioteca para desenvolvimento dos componentes para utilizar nos app da Expresso Figueiredo.",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -95,7 +95,7 @@
95
95
  "@storybook/react-native": "^8.5.3",
96
96
  "@storybook/react-webpack5": "^8.3.5",
97
97
  "@testing-library/jest-native": "^5.4.3",
98
- "@testing-library/react-native": "^12.3.0",
98
+ "@testing-library/react-native": "^13.2.2",
99
99
  "@types/jest": "^29.5.5",
100
100
  "@types/react": "^18.2.44",
101
101
  "@typescript-eslint/eslint-plugin": "^8.23.0",
@@ -119,11 +119,15 @@
119
119
  "react": "18.3.1",
120
120
  "react-native": "0.76.6",
121
121
  "react-native-builder-bob": "^0.32.0",
122
+ "react-test-renderer": "^18.3.1",
122
123
  "release-it": "^17.10.0",
123
- "storybook": "^8.3.5"
124
+ "storybook": "^8.3.5",
125
+ "typescript": "4.8.4"
124
126
  },
125
127
  "resolutions": {
126
- "@types/react": "^18.2.44"
128
+ "@types/react": "^18.2.44",
129
+ "react": "18.3.1",
130
+ "react-dom": "18.3.1"
127
131
  },
128
132
  "workspaces": [
129
133
  "example"
@@ -183,15 +187,14 @@
183
187
  "jest-environment-jsdom": "^29.7.0",
184
188
  "jest-matcher-utils": "^29.7.0",
185
189
  "react": "*",
186
- "react-dom": "^18.3.1",
190
+ "react-dom": "*",
187
191
  "react-native": "*",
188
- "react-native-exp-fig": "^0.1.1",
192
+ "react-native-exp-fig": "^0.1.20",
189
193
  "react-native-gesture-handler": "^2.19.0",
190
194
  "react-native-reanimated": "^3.16.7",
191
- "react-native-safe-area-context": "^4.11.0",
195
+ "react-native-safe-area-context": "*",
192
196
  "react-native-svg": "^15.6.0",
193
197
  "react-native-web": "^0.19.12",
194
- "react-test-renderer": "^18.2.0",
195
198
  "ts-jest": "^29.1.1",
196
199
  "ts-node": "^10.9.1",
197
200
  "typescript": "4.8.4"
@@ -0,0 +1,9 @@
1
+ import type React from "react";
2
+
3
+ export function asBaseComponent<P>(
4
+ Component: React.ComponentType<P>,
5
+ // eslint-disable-next-line no-unused-vars
6
+ _options?: P
7
+ ): React.ComponentType<P> {
8
+ return Component;
9
+ }
@@ -57,6 +57,7 @@ const SVG_NAME = {
57
57
  HOURGLASS: "hourglass",
58
58
  HOUSE: "house",
59
59
  ISLAND: "island",
60
+ EXCLAMATION_TRIANGLE: "exclamation-triangle",
60
61
  };
61
62
 
62
63
  /**
@@ -0,0 +1,46 @@
1
+ import * as React from "react";
2
+ import Svg, { Path } from "react-native-svg";
3
+ import { type ISvgProps } from "../interface";
4
+
5
+ const SvgIconWarningTriangle: React.FC<ISvgProps> = ({
6
+ color,
7
+ size,
8
+ background,
9
+ }) => (
10
+ <Svg
11
+ width={size ?? 36}
12
+ height={size ?? 36}
13
+ viewBox="0 0 36 36"
14
+ fill="none"
15
+ >
16
+ {/* Triângulo com cantos arredondados usando curvas (Q) */}
17
+ <Path
18
+ d="M18 4
19
+ C19 4 20 5 20.5 6
20
+ L33.5 30
21
+ C34 31 33 32 32 32
22
+ H4
23
+ C3 32 2 31 2.5 30
24
+ L15.5 6
25
+ C16 5 17 4 18 4
26
+ Z"
27
+ fill={background ?? "#F4B31D"}
28
+ />
29
+
30
+ {/* Traço da exclamação */}
31
+ <Path
32
+ d="M18 13V20"
33
+ stroke={color ?? "#fff"}
34
+ strokeWidth="2.5"
35
+ strokeLinecap="round"
36
+ />
37
+
38
+ {/* Ponto da exclamação */}
39
+ <Path
40
+ d="M18 25a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"
41
+ fill={color ?? "#fff"}
42
+ />
43
+ </Svg>
44
+ );
45
+
46
+ export { SvgIconWarningTriangle };
@@ -57,6 +57,7 @@ import { SvgIconHourglass } from "./hourglass";
57
57
  import { SvgCurrencyCircleDollar } from "./currency-circle-dollar";
58
58
  import { SvgPackage } from "./package";
59
59
  import { SvgIconHouse } from "./house";
60
+ import { SvgIconWarningTriangle } from "./eclamation-triangle";
60
61
 
61
62
  // typing
62
63
  import { ISvgProps } from "./interface";
@@ -197,7 +198,10 @@ const Icons: React.FC<ISvgProps> = ({ icon, color, size, background }) => {
197
198
  background={background}
198
199
  />
199
200
  );
200
-
201
+
202
+ case "EXCLAMATION_TRIANGLE":
203
+ return <SvgIconWarningTriangle icon={"EXCLAMATION_TRIANGLE"} color={color} size={size} background={background} />;
204
+
201
205
  case "PLUS":
202
206
  return <SvgIconPlus color={color} size={size} icon={"PLUS"} />;
203
207
 
@@ -19,14 +19,14 @@ const IconTruck: React.FC<ISvgProps> = ({ color, size, ...res }) => (
19
19
  {...res}
20
20
  >
21
21
  <Path
22
- stroke={color ?? "#050022"}
22
+ stroke={color ?? "#fff"}
23
23
  strokeWidth={2}
24
24
  strokeLinecap="round"
25
25
  strokeLinejoin="round"
26
26
  d="M10 17h4V5H2v12h3M20 17h2v-3.34a4 4 0 00-1.17-2.83L19 9h-5M14 17h1"
27
27
  />
28
28
  <Path
29
- stroke={color ?? "#050022"}
29
+ stroke={color ?? "#fff"}
30
30
  strokeWidth={2}
31
31
  strokeLinecap="round"
32
32
  strokeLinejoin="round"
@@ -1,47 +1,49 @@
1
- /**
2
- * IMPORTS
3
- */
4
- import React from "react";
5
- import { View } from "react-native";
6
-
7
- // typings
8
- import { IBoxProps } from "./interface";
9
-
10
- // styles
11
- import { styles } from "./styles";
12
-
13
- /**
14
- * Componente Box para envolver outros componentes de forma flexível.
15
- */
16
- export const Box: React.FC<IBoxProps> = ({
17
- children,
18
- width,
19
- height,
20
- backgroundColor,
21
- borderStyled,
22
- flexStyle,
23
- paddingStyle,
24
- marginStyle,
25
- opacity = 1,
26
- testID = "box",
27
- style,
28
- }) => {
29
- // Criando o objeto de estilos dinamicamente
30
- const styleProps: Partial<IBoxProps> = {
31
- width,
32
- height,
33
- backgroundColor,
34
- borderStyled,
35
- flexStyle,
36
- paddingStyle,
37
- marginStyle,
38
- opacity,
39
- style,
40
- };
41
-
42
- return (
43
- <View testID={testID} style={[styles(styleProps).boxStyle, style]}>
44
- {children}
45
- </View>
46
- );
47
- };
1
+ /**
2
+ * IMPORTS
3
+ */
4
+ import { forwardRef } from "react";
5
+ import { View } from "react-native";
6
+
7
+ // typings
8
+ import { IBoxProps } from "./interface";
9
+
10
+ // styles
11
+ import { styles } from "./styles";
12
+
13
+ /**
14
+ * Componente Box para envolver outros componentes de forma flexível.
15
+ */
16
+ export const Box = forwardRef<View, IBoxProps>(({
17
+ children,
18
+ width,
19
+ height,
20
+ backgroundColor,
21
+ borderStyled,
22
+ flexStyle,
23
+ paddingStyle,
24
+ marginStyle,
25
+ opacity = 1,
26
+ testID = "box",
27
+ style,
28
+ }, ref) => {
29
+ // Criando o objeto de estilos dinamicamente
30
+ const styleProps: Partial<IBoxProps> = {
31
+ width,
32
+ height,
33
+ backgroundColor,
34
+ borderStyled,
35
+ flexStyle,
36
+ paddingStyle,
37
+ marginStyle,
38
+ opacity,
39
+ style,
40
+ };
41
+
42
+ return (
43
+ <View ref={ref} testID={testID} style={[styles(styleProps).boxStyle, style]}>
44
+ {children}
45
+ </View>
46
+ );
47
+ });
48
+
49
+ Box.displayName = "Box";
@@ -0,0 +1,217 @@
1
+ /**
2
+ * IMPORTS
3
+ */
4
+ import React, { forwardRef } from "react";
5
+ import { Image } from "react-native";
6
+
7
+ // components
8
+ import { Box } from "../box";
9
+ import { Typography } from "../typography";
10
+
11
+ //commons/ icons
12
+ import { IMAGES } from "../../common/constants";
13
+
14
+ // typings
15
+ import type { ICardActivitiesWeek } from "./interface";
16
+ import { asBaseComponent } from "../../@types/as-base-component";
17
+
18
+ // styles
19
+ import { theme } from "../../styles/theme/theme";
20
+ import { getIconByProperty } from "../../utils/get-icon-by-property";
21
+
22
+ // helpers
23
+ import { truncateText } from "../../helpers/text-utils";
24
+
25
+ const HistoryActivitiesCard = forwardRef<any, ICardActivitiesWeek>(
26
+ (props, ref): React.ReactElement => {
27
+ const {
28
+ testID,
29
+ backgroundColor,
30
+ idAtividade,
31
+ name_activitie,
32
+ referencia,
33
+ type_activitie,
34
+ data_start,
35
+ data_end,
36
+ duration,
37
+ avatar,
38
+ } = props;
39
+ return (
40
+ <Box
41
+ ref={ref}
42
+ testID={testID}
43
+ width={"100%"}
44
+ backgroundColor={theme.colors.neutral[25]}
45
+ borderStyled={{
46
+ borderRadius: theme.borderWidths.thick_medium,
47
+ }}
48
+ marginStyle={{
49
+ marginBottom: theme.margins["2xs"],
50
+ }}
51
+ >
52
+ <Box
53
+ width={"100%"}
54
+ height={30}
55
+ backgroundColor={backgroundColor ?? theme.colors.green[400]}
56
+ borderStyled={{
57
+ borderTopLeftRadius: theme.borderWidths.thin_bold,
58
+ borderTopRightRadius: theme.borderWidths.thin_bold,
59
+ borderColor: theme.colors.blue[400],
60
+ }}
61
+ flexStyle={{
62
+ justifyContent: "center",
63
+ }}
64
+ >
65
+ <Typography
66
+ text={`ATIVIDADE ${!data_end ? "EM ANDAMENTO" : ""} #${idAtividade}`}
67
+ color={theme.colors.neutral[25]}
68
+ size={theme.fontSizes.xs}
69
+ fontFamily={theme.fonts.inter_semi_bold_600}
70
+ fontWeight={"500"}
71
+ lineHeight={theme.fontSizes.lg}
72
+ marginLeft={theme.margins["2xs"]}
73
+ />
74
+ </Box>
75
+ <Box
76
+ width={"100%"}
77
+ flexStyle={{
78
+ flexDirection: "row",
79
+ justifyContent: "space-between",
80
+ }}
81
+ paddingStyle={{
82
+ padding: theme.paddings["2xs"],
83
+ }}
84
+ >
85
+ <Box width={"100%"}>
86
+ <Box flexStyle={{ flexDirection: "row", alignItems: "center" }}>
87
+ <Image
88
+ style={{
89
+ width: 45,
90
+ height: 45,
91
+ borderRadius: 10,
92
+ marginRight: 10,
93
+ }}
94
+ source={{ uri: avatar ?? IMAGES.IMAGE_ANONIMA }}
95
+ />
96
+
97
+ <Box width={"100%"}>
98
+ <Box
99
+ width={"84%"}
100
+ flexStyle={{
101
+ flexDirection: "row",
102
+ flexWrap: "wrap",
103
+ }}
104
+ >
105
+ <Typography
106
+ style={{ flexShrink: 1 }}
107
+ text={`Início: `}
108
+ size={theme.fontSizes.xs}
109
+ color={theme.colors.black[10]}
110
+ fontFamily={theme.fonts.inter_semi_bold_600}
111
+ />
112
+ <Typography
113
+ text={`${data_start} ás ${data_end ?? "00/00/0000 00:00"}`}
114
+ size={theme.fontSizes["2xs"]}
115
+ color={theme.colors.black[180]}
116
+ fontFamily={theme.fonts.inter_regular_400}
117
+ />
118
+ </Box>
119
+
120
+ <Box
121
+ flexStyle={{
122
+ flexDirection: "row",
123
+ justifyContent: "space-between",
124
+ }}
125
+ width={"84%"}
126
+ >
127
+ <Box flexStyle={{ flexDirection: "row" }}>
128
+ <Typography
129
+ text={`Duração: `}
130
+ size={theme.fontSizes.xs}
131
+ color={theme.colors.black[10]}
132
+ fontFamily={theme.fonts.inter_semi_bold_600}
133
+ />
134
+
135
+ <Typography
136
+ text={`${duration ?? "00:00"}`}
137
+ size={theme.fontSizes["2xs"]}
138
+ color={theme.colors.black[180]}
139
+ fontFamily={theme.fonts.inter_light_300}
140
+ />
141
+ </Box>
142
+
143
+ {getIconByProperty(referencia, backgroundColor)}
144
+ </Box>
145
+ </Box>
146
+ </Box>
147
+ </Box>
148
+ </Box>
149
+
150
+ <Box
151
+ width={"100%"}
152
+ flexStyle={{
153
+ flexDirection: "row",
154
+ justifyContent: "space-between",
155
+ alignItems: "center",
156
+ }}
157
+ paddingStyle={{
158
+ padding: theme.paddings["2xs"],
159
+ }}
160
+ borderStyled={{
161
+ borderTopWidth: theme.borderWidths.thin_medium,
162
+ borderTopColor: theme.colors.neutral[200],
163
+ }}
164
+ >
165
+ <Box marginStyle={{ marginRight: 2 }}>
166
+ <Typography
167
+ text={`Atividade:`}
168
+ size={theme.fontSizes.xs}
169
+ color={theme.colors.gray[700]}
170
+ fontFamily={theme.fonts.inter_regular_400}
171
+ />
172
+
173
+ <Typography
174
+ text={truncateText(name_activitie ?? "Sem informação")}
175
+ size={theme.fontSizes.sm}
176
+ color={theme.colors.black[100]}
177
+ fontFamily={theme.fonts.inter_semi_bold_600}
178
+ />
179
+ </Box>
180
+
181
+ <Box
182
+ flexStyle={{
183
+ flexDirection: "column",
184
+ alignItems: "flex-end",
185
+ justifyContent: "center",
186
+ }}
187
+ >
188
+ <Typography
189
+ text={`Tipo atividade: `}
190
+ size={theme.fontSizes.xs}
191
+ color={theme.colors.gray[700]}
192
+ fontFamily={theme.fonts.inter_regular_400}
193
+ />
194
+
195
+ <Typography
196
+ text={`${type_activitie}`}
197
+ size={theme.fontSizes.sm}
198
+ color={theme.colors.black[100]}
199
+ fontFamily={theme.fonts.inter_semi_bold_600}
200
+ marginLeft={4}
201
+ />
202
+ </Box>
203
+ </Box>
204
+ </Box>
205
+ );
206
+ }
207
+ );
208
+
209
+ HistoryActivitiesCard.displayName = "HistoryActivitiesCard";
210
+
211
+ const HistoryActivitiesCardComponent = asBaseComponent(HistoryActivitiesCard);
212
+
213
+ /**
214
+ * Componente Box para a interação da ui.
215
+ */
216
+ export default HistoryActivitiesCardComponent;
217
+ export { HistoryActivitiesCardComponent as HistoryActivitiesCard };