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.
- package/lib/commonjs/@types/as-base-component.js +12 -0
- package/lib/commonjs/@types/as-base-component.js.map +1 -0
- package/lib/commonjs/common/icons-svg/constants/index.js +2 -1
- package/lib/commonjs/common/icons-svg/constants/index.js.map +1 -1
- package/lib/commonjs/common/icons-svg/eclamation-triangle/index.js +33 -0
- package/lib/commonjs/common/icons-svg/eclamation-triangle/index.js.map +1 -0
- package/lib/commonjs/common/icons-svg/index.js +8 -0
- package/lib/commonjs/common/icons-svg/index.js.map +1 -1
- package/lib/commonjs/common/icons-svg/truck/index.js +2 -2
- package/lib/commonjs/common/icons-svg/truck/index.js.map +1 -1
- package/lib/commonjs/components/box/index.js +11 -11
- package/lib/commonjs/components/box/index.js.map +1 -1
- package/lib/commonjs/components/history-activities-card/index.js +197 -0
- package/lib/commonjs/components/history-activities-card/index.js.map +1 -0
- package/lib/commonjs/components/history-activities-card/interface.js +6 -0
- package/lib/commonjs/components/history-activities-card/interface.js.map +1 -0
- package/lib/commonjs/components/modal-change-activity/index.js +216 -0
- package/lib/commonjs/components/modal-change-activity/index.js.map +1 -0
- package/lib/commonjs/components/selects/select-option/index.js +28 -11
- package/lib/commonjs/components/selects/select-option/index.js.map +1 -1
- package/lib/commonjs/components/selects/select-option/interface.d.js.map +1 -1
- package/lib/commonjs/components/step-indicator/index.js +45 -7
- package/lib/commonjs/components/step-indicator/index.js.map +1 -1
- package/lib/commonjs/helpers/text-utils.js +21 -0
- package/lib/commonjs/helpers/text-utils.js.map +1 -0
- package/lib/commonjs/index.js +14 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/stories/history-activities-card/history-activities-card.stories.js +104 -0
- package/lib/commonjs/stories/history-activities-card/history-activities-card.stories.js.map +1 -0
- package/lib/commonjs/stories/modal-change-activity/modal-change-activity.stories.js +52 -0
- package/lib/commonjs/stories/modal-change-activity/modal-change-activity.stories.js.map +1 -0
- package/lib/commonjs/utils/get-icon-by-property/index.js.map +1 -1
- package/lib/module/@types/as-base-component.js +6 -0
- package/lib/module/@types/as-base-component.js.map +1 -0
- package/lib/module/common/icons-svg/constants/index.js +2 -1
- package/lib/module/common/icons-svg/constants/index.js.map +1 -1
- package/lib/module/common/icons-svg/eclamation-triangle/index.js +25 -0
- package/lib/module/common/icons-svg/eclamation-triangle/index.js.map +1 -0
- package/lib/module/common/icons-svg/index.js +8 -0
- package/lib/module/common/icons-svg/index.js.map +1 -1
- package/lib/module/common/icons-svg/truck/index.js +2 -2
- package/lib/module/common/icons-svg/truck/index.js.map +1 -1
- package/lib/module/components/box/index.js +10 -8
- package/lib/module/components/box/index.js.map +1 -1
- package/lib/module/components/history-activities-card/index.js +190 -0
- package/lib/module/components/history-activities-card/index.js.map +1 -0
- package/lib/module/components/history-activities-card/interface.js +2 -0
- package/lib/module/components/history-activities-card/interface.js.map +1 -0
- package/lib/module/components/modal-change-activity/index.js +207 -0
- package/lib/module/components/modal-change-activity/index.js.map +1 -0
- package/lib/module/components/selects/select-option/index.js +28 -11
- package/lib/module/components/selects/select-option/index.js.map +1 -1
- package/lib/module/components/selects/select-option/interface.d.js.map +1 -1
- package/lib/module/components/step-indicator/index.js +45 -7
- package/lib/module/components/step-indicator/index.js.map +1 -1
- package/lib/module/helpers/text-utils.js +14 -0
- package/lib/module/helpers/text-utils.js.map +1 -0
- package/lib/module/index.js +4 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/stories/history-activities-card/history-activities-card.stories.js +97 -0
- package/lib/module/stories/history-activities-card/history-activities-card.stories.js.map +1 -0
- package/lib/module/stories/modal-change-activity/modal-change-activity.stories.js +45 -0
- package/lib/module/stories/modal-change-activity/modal-change-activity.stories.js.map +1 -0
- package/lib/module/utils/get-icon-by-property/index.js +0 -1
- package/lib/module/utils/get-icon-by-property/index.js.map +1 -1
- package/lib/typescript/src/@types/as-base-component.d.ts +2 -0
- package/lib/typescript/src/common/icons-svg/constants/index.d.ts +1 -0
- package/lib/typescript/src/common/icons-svg/eclamation-triangle/index.d.ts +4 -0
- package/lib/typescript/src/components/box/index.d.ts +3 -5
- package/lib/typescript/src/components/history-activities-card/index.d.ts +76 -0
- package/lib/typescript/src/components/history-activities-card/interface.d.ts +120 -0
- package/lib/typescript/src/components/modal-change-activity/index.d.ts +24 -0
- package/lib/typescript/src/helpers/text-utils.d.ts +7 -0
- package/lib/typescript/src/index.d.ts +2 -0
- package/lib/typescript/src/stories/history-activities-card/history-activities-card.stories.d.ts +10 -0
- package/lib/typescript/src/stories/modal-change-activity/modal-change-activity.stories.d.ts +9 -0
- package/lib/typescript/src/utils/get-icon-by-property/index.d.ts +2 -1
- package/package.json +11 -8
- package/src/@types/as-base-component.ts +9 -0
- package/src/common/icons-svg/constants/index.ts +1 -0
- package/src/common/icons-svg/eclamation-triangle/index.tsx +46 -0
- package/src/common/icons-svg/index.tsx +5 -1
- package/src/common/icons-svg/truck/index.tsx +2 -2
- package/src/components/box/index.tsx +49 -47
- package/src/components/history-activities-card/index.tsx +217 -0
- package/src/components/history-activities-card/interface.ts +147 -0
- package/src/components/modal-change-activity/index.tsx +202 -0
- package/src/components/selects/select-option/index.tsx +115 -100
- package/src/components/selects/select-option/interface.d.ts +18 -18
- package/src/components/step-indicator/index.tsx +63 -7
- package/src/helpers/text-utils.ts +15 -0
- package/src/index.ts +45 -43
- package/src/stories/history-activities-card/history-activities-card.stories.tsx +107 -0
- package/src/stories/modal-change-activity/modal-change-activity.stories.tsx +52 -0
- package/src/utils/get-icon-by-property/index.tsx +13 -1
|
@@ -12,6 +12,7 @@ import { styles } from "./styles";
|
|
|
12
12
|
import { Icons } from "../../common/icons-svg";
|
|
13
13
|
import { formHoursMinute } from "../../utils/format-data";
|
|
14
14
|
import { theme } from "../../styles/theme/theme";
|
|
15
|
+
import { ModalChangeActivity } from "../modal-change-activity";
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* Componente StepIndicator para a interação da ui.
|
|
@@ -25,15 +26,45 @@ const StepIndicator = ({
|
|
|
25
26
|
titleNumberColor
|
|
26
27
|
}) => {
|
|
27
28
|
const StepDefault = () => {
|
|
28
|
-
|
|
29
|
+
var _stepData;
|
|
30
|
+
const [isModalVisible, setIsModalVisible] = React.useState(false);
|
|
31
|
+
const [currentStepIndex, setCurrentStepIndex] = React.useState(null);
|
|
32
|
+
const [stepData, setStepData] = React.useState(data);
|
|
33
|
+
const handleOpenModal = index => {
|
|
34
|
+
var _stepItem$descricao, _stepItem$descricao$t;
|
|
35
|
+
const stepItem = stepData[index];
|
|
36
|
+
const desc = stepItem === null || stepItem === void 0 || (_stepItem$descricao = stepItem.descricao) === null || _stepItem$descricao === void 0 || (_stepItem$descricao$t = _stepItem$descricao.toLowerCase) === null || _stepItem$descricao$t === void 0 ? void 0 : _stepItem$descricao$t.call(_stepItem$descricao);
|
|
37
|
+
if (!desc) return;
|
|
38
|
+
const isDescanso = ["descanso", "refeição", "repouso_noturno", "repouso_semanal"].includes(desc.replace(/\s+/g, "_"));
|
|
39
|
+
|
|
40
|
+
// Só abre o modal se for do tipo descanso E se estiver sincronizado
|
|
41
|
+
if (isDescanso && (stepItem === null || stepItem === void 0 ? void 0 : stepItem.sincronizado) === true) {
|
|
42
|
+
setCurrentStepIndex(index);
|
|
43
|
+
setIsModalVisible(true);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
const handleConfirmModal = newData => {
|
|
47
|
+
if (currentStepIndex !== null) {
|
|
48
|
+
const newSteps = stepData.map((item, index) => index === currentStepIndex ? {
|
|
49
|
+
...item,
|
|
50
|
+
descricao: newData.label,
|
|
51
|
+
tipo_atividade: newData.value,
|
|
52
|
+
identificador: newData.key
|
|
53
|
+
} : item);
|
|
54
|
+
setStepData(newSteps);
|
|
55
|
+
}
|
|
56
|
+
setIsModalVisible(false);
|
|
57
|
+
setCurrentStepIndex(null);
|
|
58
|
+
};
|
|
59
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, stepData.length > 0 && stepData.map((history, index) => /*#__PURE__*/React.createElement(View, {
|
|
29
60
|
testID: "step-indicator",
|
|
30
61
|
style: styles({}).containerIndicator,
|
|
31
|
-
key: history.id
|
|
62
|
+
key: `${history.id}-${index}`
|
|
32
63
|
}, /*#__PURE__*/React.createElement(View, {
|
|
33
64
|
style: styles({
|
|
34
65
|
sincronizado: history.sincronizado
|
|
35
66
|
}).containerBall
|
|
36
|
-
},
|
|
67
|
+
}, stepData.length > 1 && index < stepData.length - 1 && /*#__PURE__*/React.createElement(View, {
|
|
37
68
|
style: {
|
|
38
69
|
width: 2,
|
|
39
70
|
height: 84,
|
|
@@ -45,8 +76,9 @@ const StepIndicator = ({
|
|
|
45
76
|
style: styles({
|
|
46
77
|
titleNumberColor
|
|
47
78
|
}).titleNumber
|
|
48
|
-
},
|
|
49
|
-
style: styles({}).containerMain
|
|
79
|
+
}, stepData.length - index)), /*#__PURE__*/React.createElement(View, {
|
|
80
|
+
style: styles({}).containerMain,
|
|
81
|
+
onTouchEnd: () => handleOpenModal(index)
|
|
50
82
|
}, /*#__PURE__*/React.createElement(Text, {
|
|
51
83
|
style: styles({
|
|
52
84
|
titleColor
|
|
@@ -55,11 +87,17 @@ const StepIndicator = ({
|
|
|
55
87
|
style: styles({
|
|
56
88
|
textColorDescription
|
|
57
89
|
}).titleDescription
|
|
58
|
-
}, `Inicio: ${history.data_inicio}
|
|
90
|
+
}, `Inicio: ${history.data_inicio} às ${history.data_fim}`), history.duracao_segundos && /*#__PURE__*/React.createElement(Text, {
|
|
59
91
|
style: styles({
|
|
60
92
|
textColorDescription
|
|
61
93
|
}).titleDescription
|
|
62
|
-
}, "Dura\xE7\xE3o: ", formHoursMinute(history === null || history === void 0 ? void 0 : history.duracao_segundos)))))
|
|
94
|
+
}, "Dura\xE7\xE3o: ", formHoursMinute(history === null || history === void 0 ? void 0 : history.duracao_segundos))))), isModalVisible && currentStepIndex !== null && /*#__PURE__*/React.createElement(ModalChangeActivity, {
|
|
95
|
+
visible: isModalVisible,
|
|
96
|
+
onClose: () => setIsModalVisible(false),
|
|
97
|
+
modalConfirm: handleConfirmModal,
|
|
98
|
+
dataRegistro: "",
|
|
99
|
+
descricao: ((_stepData = stepData[currentStepIndex]) === null || _stepData === void 0 ? void 0 : _stepData.descricao) || ""
|
|
100
|
+
}));
|
|
63
101
|
};
|
|
64
102
|
const StepCustom = () => {
|
|
65
103
|
return /*#__PURE__*/React.createElement(View, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","View","Text","getIconKeyByValue","styles","Icons","formHoursMinute","theme","StepIndicator","data","type","textColorDescription","titleColor","titleNumberColor","StepDefault","createElement","Fragment","length","map","history","index","testID","style","containerIndicator","key","id","sincronizado","containerBall","width","height","marginTop","position","backgroundColor","colors","blue","orange","titleNumber","containerMain","title","descricao","data_inicio","titleDescription","data_fim","duracao_segundos","StepCustom","paddingHorizontal","display","flexDirection","step","indexCustom","borderRadius","alignItems","justifyContent","borderWidth","borderColor","icon","top","fontWeight","fontSize","lineHeight","textAlign","color","handleRenderComponent","stepType"],"sources":["index.tsx"],"sourcesContent":["/**\r\n * IMPORTS\r\n */\r\nimport React from \"react\";\r\nimport { View, Text } from \"react-native\";\r\n\r\nimport { getIconKeyByValue } from \"./helpers/get-icon-by-status\";\r\n\r\n// typings\r\nimport { IStepIndicator } from \"./interface\";\r\n\r\n// styles\r\nimport { styles } from \"./styles\";\r\nimport { Icons } from \"../../common/icons-svg\";\r\nimport { formHoursMinute } from \"../../utils/format-data\";\r\nimport { theme } from \"../../styles/theme/theme\";\r\n\r\n/**\r\n * Componente StepIndicator para a interação da ui.\r\n */\r\n\r\nconst StepIndicator: React.FC<IStepIndicator> = ({\r\n data = [],\r\n type,\r\n textColorDescription,\r\n titleColor,\r\n titleNumberColor,\r\n}) => {\r\n const StepDefault = () => {\r\n return (\r\n <>\r\n {data!.length > 0 &&\r\n data!.map((history, index) => (\r\n <View testID=\"step-indicator\" style={styles({}).containerIndicator} key={history.id}>\r\n <View style={styles({ sincronizado: history.sincronizado }).containerBall}>\r\n {data!?.length > 1 && index < data!?.length - 1 && (\r\n <View\r\n style={{\r\n width: 2,\r\n height: 84,\r\n marginTop: 116,\r\n position: \"relative\",\r\n backgroundColor: history.sincronizado\r\n ? theme.colors.blue[500]\r\n : theme.colors.orange[150],\r\n }}\r\n />\r\n )}\r\n <Text style={styles({ titleNumberColor }).titleNumber}>\r\n {data!?.length - index}\r\n </Text>\r\n </View>\r\n\r\n <View style={styles({}).containerMain}>\r\n <Text style={styles({ titleColor }).title}>{history?.descricao}</Text>\r\n\r\n {history?.data_inicio && (\r\n <Text style={styles({ textColorDescription }).titleDescription}>\r\n {`Inicio: ${history.data_inicio} ás ${history.data_fim}`}\r\n </Text>\r\n )}\r\n\r\n {history.duracao_segundos && (\r\n <Text style={styles({ textColorDescription }).titleDescription}>\r\n Duração: {formHoursMinute(history?.duracao_segundos as string)}\r\n </Text>\r\n )}\r\n </View>\r\n </View>\r\n ))}\r\n </>\r\n );\r\n };\r\n\r\n const StepCustom = () => {\r\n return (\r\n <View\r\n style={{\r\n width: \"100%\",\r\n height: 84,\r\n paddingHorizontal: 24,\r\n display: \"flex\",\r\n flexDirection: \"row\",\r\n }}\r\n >\r\n {data.map((step, indexCustom) => {\r\n const descricao = getIconKeyByValue(step.descricao);\r\n\r\n return (\r\n <React.Fragment key={`step-${indexCustom}`}>\r\n <View\r\n style={{\r\n width: 45,\r\n height: 45,\r\n backgroundColor: indexCustom <= 3 ? \"orange\" : \"transparent\",\r\n borderRadius: 50,\r\n alignItems: \"center\",\r\n justifyContent: \"center\",\r\n borderWidth: 1,\r\n borderColor: \"#fff\",\r\n }}\r\n >\r\n <View\r\n style={{\r\n width: 45,\r\n height: 45,\r\n backgroundColor: \"transparent\",\r\n borderRadius: 50,\r\n alignItems: \"center\",\r\n justifyContent: \"center\",\r\n }}\r\n >\r\n {descricao && <Icons icon={descricao} />}\r\n </View>\r\n <Text\r\n style={{\r\n position: \"absolute\",\r\n top: 56,\r\n fontWeight: \"600\",\r\n fontSize: 10,\r\n lineHeight: 14,\r\n textAlign: \"center\",\r\n color: \"#fff\",\r\n width: 75,\r\n }}\r\n >\r\n {step.descricao}\r\n </Text>\r\n </View>\r\n\r\n {data?.length > 1 && indexCustom < data?.length - 1 && (\r\n <View\r\n style={{\r\n width: 35,\r\n height: 2,\r\n marginTop: 24,\r\n position: \"relative\",\r\n backgroundColor: \"orange\",\r\n }}\r\n />\r\n )}\r\n </React.Fragment>\r\n );\r\n })}\r\n </View>\r\n );\r\n };\r\n\r\n const handleRenderComponent = (stepType: \"default\" | \"custom\") => {\r\n switch (stepType) {\r\n case \"default\":\r\n return <StepDefault />;\r\n case \"custom\":\r\n return <StepCustom />;\r\n default:\r\n return <View />;\r\n }\r\n };\r\n\r\n return <>{handleRenderComponent(type!)}</>;\r\n};\r\n\r\n/**\r\n * EXPORTS\r\n */\r\nexport { StepIndicator };\r\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,IAAI,QAAQ,cAAc;AAEzC,SAASC,iBAAiB,QAAQ,8BAA8B;;AAEhE;;AAGA;AACA,SAASC,MAAM,QAAQ,UAAU;AACjC,SAASC,KAAK,QAAQ,wBAAwB;AAC9C,SAASC,eAAe,QAAQ,yBAAyB;AACzD,SAASC,KAAK,QAAQ,0BAA0B;;AAEhD;AACA;AACA;;AAEA,MAAMC,aAAuC,GAAGA,CAAC;EAC/CC,IAAI,GAAG,EAAE;EACTC,IAAI;EACJC,oBAAoB;EACpBC,UAAU;EACVC;AACF,CAAC,KAAK;EACJ,MAAMC,WAAW,GAAGA,CAAA,KAAM;IACxB,oBACEd,KAAA,CAAAe,aAAA,CAAAf,KAAA,CAAAgB,QAAA,QACGP,IAAI,CAAEQ,MAAM,GAAG,CAAC,IACfR,IAAI,CAAES,GAAG,CAAC,CAACC,OAAO,EAAEC,KAAK,kBACvB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CAAAe,aAAA,CAACD,WAAW,MAAE,CAAC;MACxB,KAAK,QAAQ;QACX,oBAAOd,KAAA,CAAAe,aAAA,CAAC6B,UAAU,MAAE,CAAC;MACvB;QACE,oBAAO5C,KAAA,CAAAe,aAAA,CAACd,IAAI,MAAE,CAAC;IACnB;EACF,CAAC;EAED,oBAAOD,KAAA,CAAAe,aAAA,CAAAf,KAAA,CAAAgB,QAAA,QAAG8C,qBAAqB,CAACpD,IAAK,CAAI,CAAC;AAC5C,CAAC;;AAED;AACA;AACA;AACA,SAASF,aAAa","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["React","View","Text","getIconKeyByValue","styles","Icons","formHoursMinute","theme","ModalChangeActivity","StepIndicator","data","type","textColorDescription","titleColor","titleNumberColor","StepDefault","_stepData","isModalVisible","setIsModalVisible","useState","currentStepIndex","setCurrentStepIndex","stepData","setStepData","handleOpenModal","index","_stepItem$descricao","_stepItem$descricao$t","stepItem","desc","descricao","toLowerCase","call","isDescanso","includes","replace","sincronizado","handleConfirmModal","newData","newSteps","map","item","label","tipo_atividade","value","identificador","key","createElement","Fragment","length","history","testID","style","containerIndicator","id","containerBall","width","height","marginTop","position","backgroundColor","colors","blue","orange","titleNumber","containerMain","onTouchEnd","title","data_inicio","titleDescription","data_fim","duracao_segundos","visible","onClose","modalConfirm","dataRegistro","StepCustom","paddingHorizontal","display","flexDirection","step","indexCustom","borderRadius","alignItems","justifyContent","borderWidth","borderColor","icon","top","fontWeight","fontSize","lineHeight","textAlign","color","handleRenderComponent","stepType"],"sources":["index.tsx"],"sourcesContent":["/**\r\n * IMPORTS\r\n */\r\nimport React from \"react\";\r\nimport { View, Text } from \"react-native\";\r\n\r\nimport { getIconKeyByValue } from \"./helpers/get-icon-by-status\";\r\n\r\n// typings\r\nimport { IStepIndicator } from \"./interface\";\r\n\r\n// styles\r\nimport { styles } from \"./styles\";\r\nimport { Icons } from \"../../common/icons-svg\";\r\nimport { formHoursMinute } from \"../../utils/format-data\";\r\nimport { theme } from \"../../styles/theme/theme\";\r\nimport { ModalChangeActivity } from \"../modal-change-activity\";\r\n\r\n/**\r\n * Componente StepIndicator para a interação da ui.\r\n */\r\n\r\nconst StepIndicator: React.FC<IStepIndicator> = ({\r\n data = [],\r\n type,\r\n textColorDescription,\r\n titleColor,\r\n titleNumberColor,\r\n}) => {\r\n const StepDefault = () => {\r\n const [isModalVisible, setIsModalVisible] = React.useState(false);\r\n const [currentStepIndex, setCurrentStepIndex] = React.useState<number | null>(null);\r\n const [stepData, setStepData] = React.useState(data);\r\n\r\n const handleOpenModal = (index: number) => {\r\n const stepItem = stepData[index];\r\n const desc = stepItem?.descricao?.toLowerCase?.();\r\n if (!desc) return;\r\n \r\n const isDescanso = [\r\n \"descanso\",\r\n \"refeição\",\r\n \"repouso_noturno\",\r\n \"repouso_semanal\",\r\n ].includes(desc.replace(/\\s+/g, \"_\"));\r\n\r\n // Só abre o modal se for do tipo descanso E se estiver sincronizado\r\n if (isDescanso && stepItem?.sincronizado === true) {\r\n setCurrentStepIndex(index);\r\n setIsModalVisible(true);\r\n }\r\n };\r\n\r\n const handleConfirmModal = (newData: { label: string; value: string; key: number }) => {\r\n if (currentStepIndex !== null) {\r\n const newSteps = stepData.map((item, index) =>\r\n index === currentStepIndex\r\n ? { ...item, descricao: newData.label, tipo_atividade: newData.value, identificador: newData.key }\r\n : item\r\n );\r\n setStepData(newSteps);\r\n }\r\n\r\n setIsModalVisible(false);\r\n setCurrentStepIndex(null);\r\n };\r\n\r\n return (\r\n <>\r\n {stepData.length > 0 &&\r\n stepData.map((history, index) => (\r\n <View\r\n testID=\"step-indicator\"\r\n style={styles({}).containerIndicator}\r\n key={`${history.id}-${index}`}\r\n >\r\n <View style={styles({ sincronizado: history.sincronizado }).containerBall}>\r\n {stepData.length > 1 && index < stepData.length - 1 && (\r\n <View\r\n style={{\r\n width: 2,\r\n height: 84,\r\n marginTop: 116,\r\n position: \"relative\",\r\n backgroundColor: history.sincronizado\r\n ? theme.colors.blue[500]\r\n : theme.colors.orange[150],\r\n }}\r\n />\r\n )}\r\n <Text style={styles({ titleNumberColor }).titleNumber}>\r\n {stepData.length - index}\r\n </Text>\r\n </View>\r\n\r\n <View\r\n style={styles({}).containerMain}\r\n onTouchEnd={() => handleOpenModal(index)}\r\n >\r\n <Text style={styles({ titleColor }).title}>{history?.descricao}</Text>\r\n\r\n {history?.data_inicio && (\r\n <Text style={styles({ textColorDescription }).titleDescription}>\r\n {`Inicio: ${history.data_inicio} às ${history.data_fim}`}\r\n </Text>\r\n )}\r\n\r\n {history.duracao_segundos && (\r\n <Text style={styles({ textColorDescription }).titleDescription}>\r\n Duração: {formHoursMinute(history?.duracao_segundos as string)}\r\n </Text>\r\n )}\r\n </View>\r\n </View>\r\n ))}\r\n\r\n {isModalVisible && currentStepIndex !== null && (\r\n <ModalChangeActivity\r\n visible={isModalVisible}\r\n onClose={() => setIsModalVisible(false)}\r\n modalConfirm={handleConfirmModal}\r\n dataRegistro={\"\"}\r\n descricao={stepData[currentStepIndex!]?.descricao || \"\"}\r\n />\r\n )}\r\n </>\r\n );\r\n };\r\n\r\n\r\n const StepCustom = () => {\r\n return (\r\n <View\r\n style={{\r\n width: \"100%\",\r\n height: 84,\r\n paddingHorizontal: 24,\r\n display: \"flex\",\r\n flexDirection: \"row\",\r\n }}\r\n >\r\n {data.map((step, indexCustom) => {\r\n const descricao = getIconKeyByValue(step.descricao);\r\n\r\n return (\r\n <React.Fragment key={`step-${indexCustom}`}>\r\n <View\r\n style={{\r\n width: 45,\r\n height: 45,\r\n backgroundColor: indexCustom <= 3 ? \"orange\" : \"transparent\",\r\n borderRadius: 50,\r\n alignItems: \"center\",\r\n justifyContent: \"center\",\r\n borderWidth: 1,\r\n borderColor: \"#fff\",\r\n }}\r\n >\r\n <View\r\n style={{\r\n width: 45,\r\n height: 45,\r\n backgroundColor: \"transparent\",\r\n borderRadius: 50,\r\n alignItems: \"center\",\r\n justifyContent: \"center\",\r\n }}\r\n >\r\n {descricao && <Icons icon={descricao} />}\r\n </View>\r\n <Text\r\n style={{\r\n position: \"absolute\",\r\n top: 56,\r\n fontWeight: \"600\",\r\n fontSize: 10,\r\n lineHeight: 14,\r\n textAlign: \"center\",\r\n color: \"#fff\",\r\n width: 75,\r\n }}\r\n >\r\n {step.descricao}\r\n </Text>\r\n </View>\r\n\r\n {data?.length > 1 && indexCustom < data?.length - 1 && (\r\n <View\r\n style={{\r\n width: 35,\r\n height: 2,\r\n marginTop: 24,\r\n position: \"relative\",\r\n backgroundColor: \"orange\",\r\n }}\r\n />\r\n )}\r\n </React.Fragment>\r\n );\r\n })}\r\n </View>\r\n );\r\n };\r\n\r\n const handleRenderComponent = (stepType: \"default\" | \"custom\") => {\r\n switch (stepType) {\r\n case \"default\":\r\n return <StepDefault />;\r\n case \"custom\":\r\n return <StepCustom />;\r\n default:\r\n return <View />;\r\n }\r\n };\r\n\r\n return <>{handleRenderComponent(type!)}</>;\r\n};\r\n\r\n/**\r\n * EXPORTS\r\n */\r\nexport { StepIndicator };\r\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,IAAI,QAAQ,cAAc;AAEzC,SAASC,iBAAiB,QAAQ,8BAA8B;;AAEhE;;AAGA;AACA,SAASC,MAAM,QAAQ,UAAU;AACjC,SAASC,KAAK,QAAQ,wBAAwB;AAC9C,SAASC,eAAe,QAAQ,yBAAyB;AACzD,SAASC,KAAK,QAAQ,0BAA0B;AAChD,SAASC,mBAAmB,QAAQ,0BAA0B;;AAE9D;AACA;AACA;;AAEA,MAAMC,aAAuC,GAAGA,CAAC;EAC/CC,IAAI,GAAG,EAAE;EACTC,IAAI;EACJC,oBAAoB;EACpBC,UAAU;EACVC;AACF,CAAC,KAAK;EACJ,MAAMC,WAAW,GAAGA,CAAA,KAAM;IAAA,IAAAC,SAAA;IACxB,MAAM,CAACC,cAAc,EAAEC,iBAAiB,CAAC,GAAGlB,KAAK,CAACmB,QAAQ,CAAC,KA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
|
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 const truncateText = (text, maxLength = 20) => {
|
|
8
|
+
if (!text) return "";
|
|
9
|
+
if (text.length <= maxLength) {
|
|
10
|
+
return text;
|
|
11
|
+
}
|
|
12
|
+
return text.substring(0, maxLength) + "...";
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=text-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["truncateText","text","maxLength","length","substring"],"sources":["text-utils.ts"],"sourcesContent":["/**\n * Função para limitar a quantidade de caracteres de um texto\n * @param text - O texto a ser limitado\n * @param maxLength - Número máximo de caracteres (padrão: 20)\n * @returns Texto limitado com \"...\" se exceder o limite\n */\nexport const truncateText = (text: string, maxLength: number = 20): string => {\n if (!text) return \"\";\n\n if (text.length <= maxLength) {\n return text;\n }\n\n return text.substring(0, maxLength) + \"...\";\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,YAAY,GAAGA,CAACC,IAAY,EAAEC,SAAiB,GAAG,EAAE,KAAa;EAC5E,IAAI,CAACD,IAAI,EAAE,OAAO,EAAE;EAEpB,IAAIA,IAAI,CAACE,MAAM,IAAID,SAAS,EAAE;IAC5B,OAAOD,IAAI;EACb;EAEA,OAAOA,IAAI,CAACG,SAAS,CAAC,CAAC,EAAEF,SAAS,CAAC,GAAG,KAAK;AAC7C,CAAC","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* EXPORTS
|
|
1
|
+
/**
|
|
2
|
+
* EXPORTS
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
// Components
|
|
@@ -34,6 +34,8 @@ export { ActivitiesDaily } from "./components/activities-daily";
|
|
|
34
34
|
export { ActivitiesProgress } from "./components/activities-progress";
|
|
35
35
|
export { ProfileMenuOption } from "./components/profile-menu-option";
|
|
36
36
|
export { ModalActivities } from "./components/modal-activities";
|
|
37
|
+
export { HistoryActivitiesCard } from "./components/history-activities-card";
|
|
38
|
+
export { ModalChangeActivity } from "./components/modal-change-activity";
|
|
37
39
|
|
|
38
40
|
// Utilities
|
|
39
41
|
export { multiply } from "./utils/mutiply";
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Box","Button","StepIndicator","Typography","Input","CapturePhoto","CardHours","SelectOption","Header","ScheduledJourneyIndicators","CardScheduledJourney","UserProfile","MenuItem","CardLoading","CardWorkSession","LoadingProgress","NoData","FilterJourney","Coil","FilterDateSelector","CardHistory","NotificationLoading","CheckBox","ImageCaptureWithRemove","LoadingDetails","AvatarProfile","HistoryDetails","ActivitiesDaily","ActivitiesProgress","ProfileMenuOption","ModalActivities","multiply","formatDate","getLastSevenDays","formHoursMinute","theme"],"sources":["index.ts"],"sourcesContent":["/**\n * EXPORTS\n */\n\n// Components\nexport { Box } from \"./components/box\";\nexport { Button } from \"./components/button\";\nexport { StepIndicator } from \"./components/step-indicator\";\nexport { Typography } from \"./components/typography\";\nexport { Input } from \"./components/input\";\nexport { CapturePhoto } from \"./components/capture-photo\";\nexport { CardHours } from \"./components/card-hours\";\nexport { SelectOption } from \"./components/selects/select-option\";\nexport { Header } from \"./components/header-profile\";\nexport { ScheduledJourneyIndicators } from \"./components/scheduled-journey-indicators\";\nexport { CardScheduledJourney } from \"./components/card-scheduled-journey\";\nexport { UserProfile } from \"./components/user-profile\";\nexport { MenuItem } from \"./components/menu-item\";\nexport { CardLoading } from \"./components/card-loading\";\nexport { CardWorkSession } from \"./components/card-work-session\";\nexport { LoadingProgress } from \"./components/loading-progress\";\nexport { NoData } from \"./components/no-data\";\nexport { FilterJourney } from \"./components/filter-journey\";\nexport { Coil } from \"./components/coil\";\nexport { FilterDateSelector } from \"./components/filter-date-selector\";\nexport { CardHistory } from \"./components/card-history\";\nexport { NotificationLoading } from \"./components/notification-loading\";\nexport { CheckBox } from \"./components/check-box\";\nexport { ImageCaptureWithRemove } from \"./components/image-capture-with-remove\";\nexport { LoadingDetails } from \"./components/loading-details\";\nexport { AvatarProfile } from \"./components/avatar-profile\";\nexport { HistoryDetails } from \"./components/history-details\";\nexport { ActivitiesDaily } from \"./components/activities-daily\";\nexport { ActivitiesProgress } from \"./components/activities-progress\";\nexport { ProfileMenuOption } from \"./components/profile-menu-option\";\nexport { ModalActivities } from \"./components/modal-activities\";\n\n// Utilities\nexport { multiply } from \"./utils/mutiply\";\nexport { formatDate, getLastSevenDays, formHoursMinute } from \"./utils/format-data\";\n\n// Styles\nexport { theme } from \"./styles/theme/theme\";\n"],"mappings":"AAAA;AACA;AACA;;AAEA;AACA,SAASA,GAAG,QAAQ,kBAAkB;AACtC,SAASC,MAAM,QAAQ,qBAAqB;AAC5C,SAASC,aAAa,QAAQ,6BAA6B;AAC3D,SAASC,UAAU,QAAQ,yBAAyB;AACpD,SAASC,KAAK,QAAQ,oBAAoB;AAC1C,SAASC,YAAY,QAAQ,4BAA4B;AACzD,SAASC,SAAS,QAAQ,yBAAyB;AACnD,SAASC,YAAY,QAAQ,oCAAoC;AACjE,SAASC,MAAM,QAAQ,6BAA6B;AACpD,SAASC,0BAA0B,QAAQ,2CAA2C;AACtF,SAASC,oBAAoB,QAAQ,qCAAqC;AAC1E,SAASC,WAAW,QAAQ,2BAA2B;AACvD,SAASC,QAAQ,QAAQ,wBAAwB;AACjD,SAASC,WAAW,QAAQ,2BAA2B;AACvD,SAASC,eAAe,QAAQ,gCAAgC;AAChE,SAASC,eAAe,QAAQ,+BAA+B;AAC/D,SAASC,MAAM,QAAQ,sBAAsB;AAC7C,SAASC,aAAa,QAAQ,6BAA6B;AAC3D,SAASC,IAAI,QAAQ,mBAAmB;AACxC,SAASC,kBAAkB,QAAQ,mCAAmC;AACtE,SAASC,WAAW,QAAQ,2BAA2B;AACvD,SAASC,mBAAmB,QAAQ,mCAAmC;AACvE,SAASC,QAAQ,QAAQ,wBAAwB;AACjD,SAASC,sBAAsB,QAAQ,wCAAwC;AAC/E,SAASC,cAAc,QAAQ,8BAA8B;AAC7D,SAASC,aAAa,QAAQ,6BAA6B;AAC3D,SAASC,cAAc,QAAQ,8BAA8B;AAC7D,SAASC,eAAe,QAAQ,+BAA+B;AAC/D,SAASC,kBAAkB,QAAQ,kCAAkC;AACrE,SAASC,iBAAiB,QAAQ,kCAAkC;AACpE,SAASC,eAAe,QAAQ,+BAA+B
|
|
1
|
+
{"version":3,"names":["Box","Button","StepIndicator","Typography","Input","CapturePhoto","CardHours","SelectOption","Header","ScheduledJourneyIndicators","CardScheduledJourney","UserProfile","MenuItem","CardLoading","CardWorkSession","LoadingProgress","NoData","FilterJourney","Coil","FilterDateSelector","CardHistory","NotificationLoading","CheckBox","ImageCaptureWithRemove","LoadingDetails","AvatarProfile","HistoryDetails","ActivitiesDaily","ActivitiesProgress","ProfileMenuOption","ModalActivities","HistoryActivitiesCard","ModalChangeActivity","multiply","formatDate","getLastSevenDays","formHoursMinute","theme"],"sources":["index.ts"],"sourcesContent":["/**\r\n * EXPORTS\r\n */\r\n\r\n// Components\r\nexport { Box } from \"./components/box\";\r\nexport { Button } from \"./components/button\";\r\nexport { StepIndicator } from \"./components/step-indicator\";\r\nexport { Typography } from \"./components/typography\";\r\nexport { Input } from \"./components/input\";\r\nexport { CapturePhoto } from \"./components/capture-photo\";\r\nexport { CardHours } from \"./components/card-hours\";\r\nexport { SelectOption } from \"./components/selects/select-option\";\r\nexport { Header } from \"./components/header-profile\";\r\nexport { ScheduledJourneyIndicators } from \"./components/scheduled-journey-indicators\";\r\nexport { CardScheduledJourney } from \"./components/card-scheduled-journey\";\r\nexport { UserProfile } from \"./components/user-profile\";\r\nexport { MenuItem } from \"./components/menu-item\";\r\nexport { CardLoading } from \"./components/card-loading\";\r\nexport { CardWorkSession } from \"./components/card-work-session\";\r\nexport { LoadingProgress } from \"./components/loading-progress\";\r\nexport { NoData } from \"./components/no-data\";\r\nexport { FilterJourney } from \"./components/filter-journey\";\r\nexport { Coil } from \"./components/coil\";\r\nexport { FilterDateSelector } from \"./components/filter-date-selector\";\r\nexport { CardHistory } from \"./components/card-history\";\r\nexport { NotificationLoading } from \"./components/notification-loading\";\r\nexport { CheckBox } from \"./components/check-box\";\r\nexport { ImageCaptureWithRemove } from \"./components/image-capture-with-remove\";\r\nexport { LoadingDetails } from \"./components/loading-details\";\r\nexport { AvatarProfile } from \"./components/avatar-profile\";\r\nexport { HistoryDetails } from \"./components/history-details\";\r\nexport { ActivitiesDaily } from \"./components/activities-daily\";\r\nexport { ActivitiesProgress } from \"./components/activities-progress\";\r\nexport { ProfileMenuOption } from \"./components/profile-menu-option\";\r\nexport { ModalActivities } from \"./components/modal-activities\";\r\nexport { HistoryActivitiesCard } from \"./components/history-activities-card\";\r\nexport { ModalChangeActivity } from \"./components/modal-change-activity\";\r\n\r\n// Utilities\r\nexport { multiply } from \"./utils/mutiply\";\r\nexport { formatDate, getLastSevenDays, formHoursMinute } from \"./utils/format-data\";\r\n\r\n// Styles\r\nexport { theme } from \"./styles/theme/theme\";\r\n"],"mappings":"AAAA;AACA;AACA;;AAEA;AACA,SAASA,GAAG,QAAQ,kBAAkB;AACtC,SAASC,MAAM,QAAQ,qBAAqB;AAC5C,SAASC,aAAa,QAAQ,6BAA6B;AAC3D,SAASC,UAAU,QAAQ,yBAAyB;AACpD,SAASC,KAAK,QAAQ,oBAAoB;AAC1C,SAASC,YAAY,QAAQ,4BAA4B;AACzD,SAASC,SAAS,QAAQ,yBAAyB;AACnD,SAASC,YAAY,QAAQ,oCAAoC;AACjE,SAASC,MAAM,QAAQ,6BAA6B;AACpD,SAASC,0BAA0B,QAAQ,2CAA2C;AACtF,SAASC,oBAAoB,QAAQ,qCAAqC;AAC1E,SAASC,WAAW,QAAQ,2BAA2B;AACvD,SAASC,QAAQ,QAAQ,wBAAwB;AACjD,SAASC,WAAW,QAAQ,2BAA2B;AACvD,SAASC,eAAe,QAAQ,gCAAgC;AAChE,SAASC,eAAe,QAAQ,+BAA+B;AAC/D,SAASC,MAAM,QAAQ,sBAAsB;AAC7C,SAASC,aAAa,QAAQ,6BAA6B;AAC3D,SAASC,IAAI,QAAQ,mBAAmB;AACxC,SAASC,kBAAkB,QAAQ,mCAAmC;AACtE,SAASC,WAAW,QAAQ,2BAA2B;AACvD,SAASC,mBAAmB,QAAQ,mCAAmC;AACvE,SAASC,QAAQ,QAAQ,wBAAwB;AACjD,SAASC,sBAAsB,QAAQ,wCAAwC;AAC/E,SAASC,cAAc,QAAQ,8BAA8B;AAC7D,SAASC,aAAa,QAAQ,6BAA6B;AAC3D,SAASC,cAAc,QAAQ,8BAA8B;AAC7D,SAASC,eAAe,QAAQ,+BAA+B;AAC/D,SAASC,kBAAkB,QAAQ,kCAAkC;AACrE,SAASC,iBAAiB,QAAQ,kCAAkC;AACpE,SAASC,eAAe,QAAQ,+BAA+B;AAC/D,SAASC,qBAAqB,QAAQ,sCAAsC;AAC5E,SAASC,mBAAmB,QAAQ,oCAAoC;;AAExE;AACA,SAASC,QAAQ,QAAQ,iBAAiB;AAC1C,SAASC,UAAU,EAAEC,gBAAgB,EAAEC,eAAe,QAAQ,qBAAqB;;AAEnF;AACA,SAASC,KAAK,QAAQ,sBAAsB","ignoreList":[]}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import HistoryActivitiesCard from "../../components/history-activities-card";
|
|
2
|
+
import { IMAGES } from "../../common/constants";
|
|
3
|
+
const meta = {
|
|
4
|
+
title: "componente/HistoryActivitiesCard",
|
|
5
|
+
component: HistoryActivitiesCard,
|
|
6
|
+
args: {
|
|
7
|
+
name: "João Silva",
|
|
8
|
+
ciclo: "Ciclo 1",
|
|
9
|
+
data_start: "08:00",
|
|
10
|
+
data_end: "17:00",
|
|
11
|
+
idAtividade: 12345,
|
|
12
|
+
duration: "9:00m",
|
|
13
|
+
name_activitie: "Operação de Veículo",
|
|
14
|
+
referencia: "operacao_veiculo",
|
|
15
|
+
type_activitie: "Operação Veículo",
|
|
16
|
+
avatar: IMAGES.IMAGE_ANONIMA
|
|
17
|
+
},
|
|
18
|
+
parameters: {
|
|
19
|
+
notes: `
|
|
20
|
+
# HistoryActivitiesCard
|
|
21
|
+
|
|
22
|
+
Este é um componente de Card de histórico de atividades.
|
|
23
|
+
|
|
24
|
+
## Uso
|
|
25
|
+
|
|
26
|
+
\`\`\`tsx
|
|
27
|
+
<HistoryActivitiesCard
|
|
28
|
+
name="João Silva"
|
|
29
|
+
ciclo="Ciclo 1"
|
|
30
|
+
data_start="08:00"
|
|
31
|
+
data_end="17:00"
|
|
32
|
+
idAtividade={12345}
|
|
33
|
+
duration="9h 00m"
|
|
34
|
+
name_activitie="Operação de Veículo"
|
|
35
|
+
referencia="operacao_veiculo"
|
|
36
|
+
type_activitie="Operação Veículo"
|
|
37
|
+
avatar="https://randomuser.me/api/portraits/men/1.jpg"
|
|
38
|
+
/>
|
|
39
|
+
\`\`\`
|
|
40
|
+
`
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
export default meta;
|
|
44
|
+
export const Default = {
|
|
45
|
+
name: "default"
|
|
46
|
+
};
|
|
47
|
+
export const WithoutAvatar = {
|
|
48
|
+
name: "sem-avatar",
|
|
49
|
+
args: {
|
|
50
|
+
avatar: "",
|
|
51
|
+
name: "Maria Santos"
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
export const LongActivity = {
|
|
55
|
+
name: "atividade-longa",
|
|
56
|
+
args: {
|
|
57
|
+
name: "Pedro Oliveira",
|
|
58
|
+
ciclo: "Ciclo 2",
|
|
59
|
+
data_start: "06:00",
|
|
60
|
+
data_end: "22:00",
|
|
61
|
+
idAtividade: 67890,
|
|
62
|
+
duration: "16h 00m",
|
|
63
|
+
name_activitie: "Viagem Longa Distância",
|
|
64
|
+
referencia: "operacao_veiculo",
|
|
65
|
+
type_activitie: "Viagem Longa Distância",
|
|
66
|
+
avatar: "https://randomuser.me/api/portraits/men/2.jpg"
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
export const MinimalData = {
|
|
70
|
+
name: "dados-minimos",
|
|
71
|
+
args: {
|
|
72
|
+
name: "Ana Costa",
|
|
73
|
+
data_start: "08:00",
|
|
74
|
+
duration: "8h 00m",
|
|
75
|
+
name_activitie: "Atividade Básica",
|
|
76
|
+
referencia: "descanso",
|
|
77
|
+
type_activitie: "Básico",
|
|
78
|
+
idAtividade: 11111
|
|
79
|
+
// Outros campos serão undefined para testar fallbacks
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
export const CompleteData = {
|
|
83
|
+
name: "dados-completos",
|
|
84
|
+
args: {
|
|
85
|
+
name: "Carlos Ferreira",
|
|
86
|
+
ciclo: "Ciclo 3",
|
|
87
|
+
data_start: "14:30",
|
|
88
|
+
data_end: "18:45",
|
|
89
|
+
idAtividade: 54321,
|
|
90
|
+
duration: "4h 15m",
|
|
91
|
+
name_activitie: "Manutenção de Equipamentos",
|
|
92
|
+
referencia: "manutencao",
|
|
93
|
+
type_activitie: "Manutenção",
|
|
94
|
+
avatar: "https://randomuser.me/api/portraits/men/3.jpg"
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
//# sourceMappingURL=history-activities-card.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["HistoryActivitiesCard","IMAGES","meta","title","component","args","name","ciclo","data_start","data_end","idAtividade","duration","name_activitie","referencia","type_activitie","avatar","IMAGE_ANONIMA","parameters","notes","Default","WithoutAvatar","LongActivity","MinimalData","CompleteData"],"sources":["history-activities-card.stories.tsx"],"sourcesContent":["import type { StoryObj, Meta } from \"@storybook/react\";\r\n\r\nimport HistoryActivitiesCard from \"../../components/history-activities-card\";\r\nimport { IMAGES } from \"../../common/constants\";\r\n\r\nconst meta: Meta<typeof HistoryActivitiesCard> = {\r\n title: \"componente/HistoryActivitiesCard\",\r\n component: HistoryActivitiesCard,\r\n args: {\r\n name: \"João Silva\",\r\n ciclo: \"Ciclo 1\",\r\n data_start: \"08:00\",\r\n data_end: \"17:00\",\r\n idAtividade: 12345,\r\n duration: \"9:00m\",\r\n name_activitie: \"Operação de Veículo\",\r\n referencia: \"operacao_veiculo\",\r\n type_activitie: \"Operação Veículo\",\r\n avatar: IMAGES.IMAGE_ANONIMA,\r\n },\r\n parameters: {\r\n notes: `\r\n# HistoryActivitiesCard\r\n\r\nEste é um componente de Card de histórico de atividades.\r\n\r\n## Uso\r\n\r\n\\`\\`\\`tsx\r\n<HistoryActivitiesCard\r\n name=\"João Silva\"\r\n ciclo=\"Ciclo 1\"\r\n data_start=\"08:00\"\r\n data_end=\"17:00\"\r\n idAtividade={12345}\r\n duration=\"9h 00m\"\r\n name_activitie=\"Operação de Veículo\"\r\n referencia=\"operacao_veiculo\"\r\n type_activitie=\"Operação Veículo\"\r\n avatar=\"https://randomuser.me/api/portraits/men/1.jpg\"\r\n/>\r\n\\`\\`\\`\r\n`,\r\n },\r\n};\r\n\r\nexport default meta;\r\n\r\ntype Story = StoryObj<typeof meta>;\r\n\r\nexport const Default: Story = {\r\n name: \"default\",\r\n};\r\n\r\nexport const WithoutAvatar: Story = {\r\n name: \"sem-avatar\",\r\n args: {\r\n avatar: \"\",\r\n name: \"Maria Santos\",\r\n },\r\n};\r\n\r\nexport const LongActivity: Story = {\r\n name: \"atividade-longa\",\r\n args: {\r\n name: \"Pedro Oliveira\",\r\n ciclo: \"Ciclo 2\",\r\n data_start: \"06:00\",\r\n data_end: \"22:00\",\r\n idAtividade: 67890,\r\n duration: \"16h 00m\",\r\n name_activitie: \"Viagem Longa Distância\",\r\n referencia: \"operacao_veiculo\",\r\n type_activitie: \"Viagem Longa Distância\",\r\n avatar: \"https://randomuser.me/api/portraits/men/2.jpg\",\r\n },\r\n};\r\n\r\nexport const MinimalData: Story = {\r\n name: \"dados-minimos\",\r\n args: {\r\n name: \"Ana Costa\",\r\n data_start: \"08:00\",\r\n duration: \"8h 00m\",\r\n name_activitie: \"Atividade Básica\",\r\n referencia: \"descanso\",\r\n type_activitie: \"Básico\",\r\n idAtividade: 11111,\r\n // Outros campos serão undefined para testar fallbacks\r\n },\r\n};\r\n\r\nexport const CompleteData: Story = {\r\n name: \"dados-completos\",\r\n args: {\r\n name: \"Carlos Ferreira\",\r\n ciclo: \"Ciclo 3\",\r\n data_start: \"14:30\",\r\n data_end: \"18:45\",\r\n idAtividade: 54321,\r\n duration: \"4h 15m\",\r\n name_activitie: \"Manutenção de Equipamentos\",\r\n referencia: \"manutencao\",\r\n type_activitie: \"Manutenção\",\r\n avatar: \"https://randomuser.me/api/portraits/men/3.jpg\",\r\n },\r\n};"],"mappings":"AAEA,OAAOA,qBAAqB,MAAM,0CAA0C;AAC5E,SAASC,MAAM,QAAQ,wBAAwB;AAE/C,MAAMC,IAAwC,GAAG;EAC/CC,KAAK,EAAE,kCAAkC;EACzCC,SAAS,EAAEJ,qBAAqB;EAChCK,IAAI,EAAE;IACJC,IAAI,EAAE,YAAY;IAClBC,KAAK,EAAE,SAAS;IAChBC,UAAU,EAAE,OAAO;IACnBC,QAAQ,EAAE,OAAO;IACjBC,WAAW,EAAE,KAAK;IAClBC,QAAQ,EAAE,OAAO;IACjBC,cAAc,EAAE,qBAAqB;IACrCC,UAAU,EAAE,kBAAkB;IAC9BC,cAAc,EAAE,kBAAkB;IAClCC,MAAM,EAAEd,MAAM,CAACe;EACjB,CAAC;EACDC,UAAU,EAAE;IACVC,KAAK,EAAE;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE;AACF,CAAC;AAED,eAAehB,IAAI;AAInB,OAAO,MAAMiB,OAAc,GAAG;EAC5Bb,IAAI,EAAE;AACR,CAAC;AAED,OAAO,MAAMc,aAAoB,GAAG;EAClCd,IAAI,EAAE,YAAY;EAClBD,IAAI,EAAE;IACJU,MAAM,EAAE,EAAE;IACVT,IAAI,EAAE;EACR;AACF,CAAC;AAED,OAAO,MAAMe,YAAmB,GAAG;EACjCf,IAAI,EAAE,iBAAiB;EACvBD,IAAI,EAAE;IACJC,IAAI,EAAE,gBAAgB;IACtBC,KAAK,EAAE,SAAS;IAChBC,UAAU,EAAE,OAAO;IACnBC,QAAQ,EAAE,OAAO;IACjBC,WAAW,EAAE,KAAK;IAClBC,QAAQ,EAAE,SAAS;IACnBC,cAAc,EAAE,wBAAwB;IACxCC,UAAU,EAAE,kBAAkB;IAC9BC,cAAc,EAAE,wBAAwB;IACxCC,MAAM,EAAE;EACV;AACF,CAAC;AAED,OAAO,MAAMO,WAAkB,GAAG;EAChChB,IAAI,EAAE,eAAe;EACrBD,IAAI,EAAE;IACJC,IAAI,EAAE,WAAW;IACjBE,UAAU,EAAE,OAAO;IACnBG,QAAQ,EAAE,QAAQ;IAClBC,cAAc,EAAE,kBAAkB;IAClCC,UAAU,EAAE,UAAU;IACtBC,cAAc,EAAE,QAAQ;IACxBJ,WAAW,EAAE;IACb;EACF;AACF,CAAC;AAED,OAAO,MAAMa,YAAmB,GAAG;EACjCjB,IAAI,EAAE,iBAAiB;EACvBD,IAAI,EAAE;IACJC,IAAI,EAAE,iBAAiB;IACvBC,KAAK,EAAE,SAAS;IAChBC,UAAU,EAAE,OAAO;IACnBC,QAAQ,EAAE,OAAO;IACjBC,WAAW,EAAE,KAAK;IAClBC,QAAQ,EAAE,QAAQ;IAClBC,cAAc,EAAE,4BAA4B;IAC5CC,UAAU,EAAE,YAAY;IACxBC,cAAc,EAAE,YAAY;IAC5BC,MAAM,EAAE;EACV;AACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IMPORTS
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
// component
|
|
6
|
+
import { ModalChangeActivity } from "../../components/modal-change-activity";
|
|
7
|
+
const meta = {
|
|
8
|
+
title: "Componente/ModalChangeActivity",
|
|
9
|
+
component: ModalChangeActivity,
|
|
10
|
+
args: {
|
|
11
|
+
visible: true,
|
|
12
|
+
dataRegistro: "07/03/2024",
|
|
13
|
+
descricao: "Repouso Noturno",
|
|
14
|
+
imagemUrl: "https://via.placeholder.com/150",
|
|
15
|
+
onClose: () => console.log("Modal fechado"),
|
|
16
|
+
modalConfirm: data => console.log("Confirmado:", data)
|
|
17
|
+
},
|
|
18
|
+
parameters: {
|
|
19
|
+
docs: {
|
|
20
|
+
description: {
|
|
21
|
+
component: `
|
|
22
|
+
# ModalChangeActivity
|
|
23
|
+
|
|
24
|
+
Componente de modal para alterar a atividade do usuário.
|
|
25
|
+
|
|
26
|
+
## Uso
|
|
27
|
+
\`\`\`tsx
|
|
28
|
+
<ModalChangeActivity
|
|
29
|
+
visible
|
|
30
|
+
dataRegistro="07/03/2024"
|
|
31
|
+
descricao="Repouso Noturno"
|
|
32
|
+
modalConfirm={(data) => console.log(data)}
|
|
33
|
+
onClose={() => console.log("fechar modal")}
|
|
34
|
+
/>
|
|
35
|
+
\`\`\`
|
|
36
|
+
`
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
export default meta;
|
|
42
|
+
export const Default = {
|
|
43
|
+
name: "Modal - Alterar Descanso"
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=modal-change-activity.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ModalChangeActivity","meta","title","component","args","visible","dataRegistro","descricao","imagemUrl","onClose","console","log","modalConfirm","data","parameters","docs","description","Default","name"],"sources":["modal-change-activity.stories.tsx"],"sourcesContent":["/**\r\n * IMPORTS\r\n */\r\n\r\nimport type { Meta, StoryObj } from \"@storybook/react\";\r\n\r\n// component\r\nimport { ModalChangeActivity } from \"../../components/modal-change-activity\";\r\n\r\nconst meta: Meta<typeof ModalChangeActivity> = {\r\n title: \"Componente/ModalChangeActivity\",\r\n component: ModalChangeActivity,\r\n args: {\r\n visible: true,\r\n dataRegistro: \"07/03/2024\",\r\n descricao: \"Repouso Noturno\",\r\n imagemUrl: \"https://via.placeholder.com/150\",\r\n onClose: () => console.log(\"Modal fechado\"),\r\n modalConfirm: (data: { label: string; value: string; key: number }) =>\r\n console.log(\"Confirmado:\", data),\r\n },\r\n parameters: {\r\n docs: {\r\n description: {\r\n component: `\r\n# ModalChangeActivity\r\n\r\nComponente de modal para alterar a atividade do usuário.\r\n\r\n## Uso\r\n\\`\\`\\`tsx\r\n<ModalChangeActivity\r\n visible\r\n dataRegistro=\"07/03/2024\"\r\n descricao=\"Repouso Noturno\"\r\n modalConfirm={(data) => console.log(data)}\r\n onClose={() => console.log(\"fechar modal\")}\r\n/>\r\n\\`\\`\\`\r\n `,\r\n },\r\n },\r\n },\r\n};\r\n\r\nexport default meta;\r\n\r\ntype Story = StoryObj<typeof meta>;\r\n\r\nexport const Default: Story = {\r\n name: \"Modal - Alterar Descanso\",\r\n};\r\n"],"mappings":"AAAA;AACA;AACA;;AAIA;AACA,SAASA,mBAAmB,QAAQ,wCAAwC;AAE5E,MAAMC,IAAsC,GAAG;EAC7CC,KAAK,EAAE,gCAAgC;EACvCC,SAAS,EAAEH,mBAAmB;EAC9BI,IAAI,EAAE;IACJC,OAAO,EAAE,IAAI;IACbC,YAAY,EAAE,YAAY;IAC1BC,SAAS,EAAE,iBAAiB;IAC5BC,SAAS,EAAE,iCAAiC;IAC5CC,OAAO,EAAEA,CAAA,KAAMC,OAAO,CAACC,GAAG,CAAC,eAAe,CAAC;IAC3CC,YAAY,EAAGC,IAAmD,IAChEH,OAAO,CAACC,GAAG,CAAC,aAAa,EAAEE,IAAI;EACnC,CAAC;EACDC,UAAU,EAAE;IACVC,IAAI,EAAE;MACJC,WAAW,EAAE;QACXb,SAAS,EAAE;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACM;IACF;EACF;AACF,CAAC;AAED,eAAeF,IAAI;AAInB,OAAO,MAAMgB,OAAc,GAAG;EAC5BC,IAAI,EAAE;AACR,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Icons","theme","getIconByProperty","propertyType","color","createElement","icon","colors","blue","size"],"sources":["index.tsx"],"sourcesContent":["/**\r\n * IMPORTS\r\n */\r\n\r\nimport React from \"react\";\r\nimport { Icons } from \"../../common/icons-svg\";\r\nimport { theme } from \"../../styles/theme/theme\";\r\n\r\n/**\r\n * Function that will map property types to corresponding icons in SVG 🛠️.\r\n * @param propertyType\r\n * @param color\r\n * @returns SVG\r\n */\r\nconst getIconByProperty
|
|
1
|
+
{"version":3,"names":["React","Icons","theme","getIconByProperty","propertyType","color","createElement","icon","colors","blue","size"],"sources":["index.tsx"],"sourcesContent":["/**\r\n * IMPORTS\r\n */\r\n\r\nimport React from \"react\";\r\nimport { Icons } from \"../../common/icons-svg\";\r\nimport { theme } from \"../../styles/theme/theme\";\r\n\r\nexport type PropertyType =\r\n | \"operacao_veiculo\"\r\n | \"manutencao\"\r\n | \"aguardando_carga\"\r\n | \"disposicao_veiculo_parado\"\r\n | \"aguardando_descarga\"\r\n | \"descanso\"\r\n | \"repouso_semanal\"\r\n | \"repouso_noturno\"\r\n | \"refeicao\"\r\n | \"ferias\";\r\n\r\n/**\r\n * Function that will map property types to corresponding icons in SVG 🛠️.\r\n * @param propertyType\r\n * @param color\r\n * @returns SVG\r\n */\r\nconst getIconByProperty = (propertyType: PropertyType, color?: string): React.ReactNode => {\r\n switch (propertyType) {\r\n \r\n case \"operacao_veiculo\":\r\n return <Icons color={color} icon=\"STEERING_WHEEL\" />;\r\n\r\n case \"manutencao\":\r\n return <Icons color={color} icon=\"GEAR\" />;\r\n\r\n case \"aguardando_carga\":\r\n return <Icons color={color} icon=\"TIMER\" />;\r\n\r\n case \"disposicao_veiculo_parado\":\r\n return <Icons color={theme.colors.blue[500]} size={20} icon=\"TRUCK_ACTIVITY\" />;\r\n\r\n case \"aguardando_descarga\":\r\n return <Icons color={color} icon=\"HOURGLASS\" />;\r\n\r\n case \"descanso\":\r\n return <Icons color={color} icon=\"COFFEE\" />;\r\n\r\n case \"repouso_semanal\":\r\n return <Icons color={color} icon=\"HOUSE\" />;\r\n\r\n case \"repouso_noturno\":\r\n return <Icons color={color} icon=\"MOON_STARS\" />;\r\n\r\n case \"refeicao\":\r\n return <Icons color={color} icon=\"CALL_BELL\" />;\r\n\r\n case \"ferias\":\r\n return <Icons color={color} icon=\"ISLAND\" />;\r\n default:\r\n return <Icons color={color} icon=\"STEERING_WHEEL\" />; // Retorna uma Svg default caso o tipo de propriedade não for reconhecido.\r\n }\r\n};\r\n\r\n/**\r\n * EXPORTS\r\n */\r\nexport { getIconByProperty };\r\n"],"mappings":"AAAA;AACA;AACA;;AAEA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,KAAK,QAAQ,wBAAwB;AAC9C,SAASC,KAAK,QAAQ,0BAA0B;AAchD;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,iBAAiB,GAAGA,CAACC,YAA0B,EAAEC,KAAc,KAAsB;EACzF,QAAQD,YAAY;IAElB,KAAK,kBAAkB;MACrB,oBAAOJ,KAAA,CAAAM,aAAA,CAACL,KAAK;QAACI,KAAK,EAAEA,KAAM;QAACE,IAAI,EAAC;MAAgB,CAAE,CAAC;IAEtD,KAAK,YAAY;MACf,oBAAOP,KAAA,CAAAM,aAAA,CAACL,KAAK;QAACI,KAAK,EAAEA,KAAM;QAACE,IAAI,EAAC;MAAM,CAAE,CAAC;IAE5C,KAAK,kBAAkB;MACrB,oBAAOP,KAAA,CAAAM,aAAA,CAACL,KAAK;QAACI,KAAK,EAAEA,KAAM;QAACE,IAAI,EAAC;MAAO,CAAE,CAAC;IAE7C,KAAK,2BAA2B;MAC9B,oBAAOP,KAAA,CAAAM,aAAA,CAACL,KAAK;QAACI,KAAK,EAAEH,KAAK,CAACM,MAAM,CAACC,IAAI,CAAC,GAAG,CAAE;QAACC,IAAI,EAAE,EAAG;QAACH,IAAI,EAAC;MAAgB,CAAE,CAAC;IAEjF,KAAK,qBAAqB;MACxB,oBAAOP,KAAA,CAAAM,aAAA,CAACL,KAAK;QAACI,KAAK,EAAEA,KAAM;QAACE,IAAI,EAAC;MAAW,CAAE,CAAC;IAEjD,KAAK,UAAU;MACb,oBAAOP,KAAA,CAAAM,aAAA,CAACL,KAAK;QAACI,KAAK,EAAEA,KAAM;QAACE,IAAI,EAAC;MAAQ,CAAE,CAAC;IAE9C,KAAK,iBAAiB;MACpB,oBAAOP,KAAA,CAAAM,aAAA,CAACL,KAAK;QAACI,KAAK,EAAEA,KAAM;QAACE,IAAI,EAAC;MAAO,CAAE,CAAC;IAE7C,KAAK,iBAAiB;MACpB,oBAAOP,KAAA,CAAAM,aAAA,CAACL,KAAK;QAACI,KAAK,EAAEA,KAAM;QAACE,IAAI,EAAC;MAAY,CAAE,CAAC;IAElD,KAAK,UAAU;MACb,oBAAOP,KAAA,CAAAM,aAAA,CAACL,KAAK;QAACI,KAAK,EAAEA,KAAM;QAACE,IAAI,EAAC;MAAW,CAAE,CAAC;IAEjD,KAAK,QAAQ;MACX,oBAAOP,KAAA,CAAAM,aAAA,CAACL,KAAK;QAACI,KAAK,EAAEA,KAAM;QAACE,IAAI,EAAC;MAAQ,CAAE,CAAC;IAC9C;MACE,oBAAOP,KAAA,CAAAM,aAAA,CAACL,KAAK;QAACI,KAAK,EAAEA,KAAM;QAACE,IAAI,EAAC;MAAgB,CAAE,CAAC;IAAE;EAC1D;AACF,CAAC;;AAED;AACA;AACA;AACA,SAASJ,iBAAiB","ignoreList":[]}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*/
|
|
4
|
-
import React from "react";
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { View } from "react-native";
|
|
5
3
|
import { IBoxProps } from "./interface";
|
|
6
4
|
/**
|
|
7
5
|
* Componente Box para envolver outros componentes de forma flexível.
|
|
8
6
|
*/
|
|
9
|
-
export declare const Box:
|
|
7
|
+
export declare const Box: import("react").ForwardRefExoticComponent<IBoxProps & import("react").RefAttributes<View>>;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IMPORTS
|
|
3
|
+
*/
|
|
4
|
+
import React from "react";
|
|
5
|
+
declare const HistoryActivitiesCardComponent: React.ComponentType<import("react-native").ViewProps & {
|
|
6
|
+
name?: string | undefined;
|
|
7
|
+
ciclo?: string | undefined;
|
|
8
|
+
data_start: string;
|
|
9
|
+
data_end?: string | null | undefined;
|
|
10
|
+
duration: string;
|
|
11
|
+
status?: string | undefined;
|
|
12
|
+
name_activitie: string;
|
|
13
|
+
referencia: import("../../utils/get-icon-by-property").PropertyType;
|
|
14
|
+
type_activitie: string;
|
|
15
|
+
avatar?: string | undefined;
|
|
16
|
+
idAtividade: number;
|
|
17
|
+
children?: React.ReactNode;
|
|
18
|
+
testID?: string | undefined;
|
|
19
|
+
borderStyled?: {
|
|
20
|
+
borderStyle?: "solid" | "dotted" | "dashed" | undefined;
|
|
21
|
+
borderRadius?: import("react-native").DimensionValue | undefined;
|
|
22
|
+
borderTopRightRadius?: import("react-native").DimensionValue | undefined;
|
|
23
|
+
borderTopLeftRadius?: import("react-native").DimensionValue | undefined;
|
|
24
|
+
borderBottomRightRadius?: import("react-native").DimensionValue | undefined;
|
|
25
|
+
borderBottomLeftRadius?: import("react-native").DimensionValue | undefined;
|
|
26
|
+
borderWidth?: import("react-native").DimensionValue | undefined;
|
|
27
|
+
borderLeftWidth?: import("react-native").DimensionValue | undefined;
|
|
28
|
+
borderRightWidth?: import("react-native").DimensionValue | undefined;
|
|
29
|
+
borderTopWidth?: import("react-native").DimensionValue | undefined;
|
|
30
|
+
borderBottomWidth?: import("react-native").DimensionValue | undefined;
|
|
31
|
+
borderColor?: string | undefined;
|
|
32
|
+
borderBottomColor?: string | undefined;
|
|
33
|
+
borderLeftColor?: string | undefined;
|
|
34
|
+
borderRightColor?: string | undefined;
|
|
35
|
+
borderTopColor?: string | undefined;
|
|
36
|
+
} | undefined;
|
|
37
|
+
flexStyle?: {
|
|
38
|
+
alignItems?: "flex-start" | "flex-end" | "center" | "stretch" | "baseline" | undefined;
|
|
39
|
+
alignSelf?: "auto" | "flex-start" | "flex-end" | "center" | "stretch" | "baseline" | undefined;
|
|
40
|
+
flex?: string | number | undefined;
|
|
41
|
+
flexDirection?: "column" | "column-reverse" | "row" | "row-reverse" | undefined;
|
|
42
|
+
flexWrap?: "wrap" | "nowrap" | "wrap-reverse" | undefined;
|
|
43
|
+
textAlign?: "auto" | "center" | "left" | "right" | "justify" | undefined;
|
|
44
|
+
justifyContent?: "flex-start" | "flex-end" | "center" | "space-between" | "space-around" | "space-evenly" | undefined;
|
|
45
|
+
} | undefined;
|
|
46
|
+
marginStyle?: {
|
|
47
|
+
margin?: import("react-native").DimensionValue | undefined;
|
|
48
|
+
marginLeft?: import("react-native").DimensionValue | undefined;
|
|
49
|
+
marginRight?: import("react-native").DimensionValue | undefined;
|
|
50
|
+
marginTop?: import("react-native").DimensionValue | undefined;
|
|
51
|
+
marginBottom?: import("react-native").DimensionValue | undefined;
|
|
52
|
+
} | undefined;
|
|
53
|
+
paddingStyle?: {
|
|
54
|
+
padding?: import("react-native").DimensionValue | undefined;
|
|
55
|
+
paddingLeft?: import("react-native").DimensionValue | undefined;
|
|
56
|
+
paddingRight?: import("react-native").DimensionValue | undefined;
|
|
57
|
+
paddingTop?: import("react-native").DimensionValue | undefined;
|
|
58
|
+
paddingBottom?: import("react-native").DimensionValue | undefined;
|
|
59
|
+
} | undefined;
|
|
60
|
+
height?: import("react-native").DimensionValue | undefined;
|
|
61
|
+
width?: import("react-native").DimensionValue | undefined;
|
|
62
|
+
backgroundColor?: string | undefined;
|
|
63
|
+
text?: string | undefined;
|
|
64
|
+
color?: {
|
|
65
|
+
colorSvg?: string | undefined;
|
|
66
|
+
colorText?: string | undefined;
|
|
67
|
+
colorTextBold?: string | undefined;
|
|
68
|
+
colorTextData?: string | undefined;
|
|
69
|
+
} | undefined;
|
|
70
|
+
iconColor?: string | undefined;
|
|
71
|
+
} & React.RefAttributes<any>>;
|
|
72
|
+
/**
|
|
73
|
+
* Componente Box para a interação da ui.
|
|
74
|
+
*/
|
|
75
|
+
export default HistoryActivitiesCardComponent;
|
|
76
|
+
export { HistoryActivitiesCardComponent as HistoryActivitiesCard };
|