react-native-exp-fig 0.1.1 → 0.1.2
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/package.json +4 -4
- package/src/common/constants/index.ts +5 -0
- package/src/common/icons-svg/arrow-drop-down/index.tsx +28 -28
- package/src/common/icons-svg/arrow-left/index.tsx +32 -32
- package/src/common/icons-svg/bluetooth/index.tsx +37 -37
- package/src/common/icons-svg/bluetooth-connected/index.tsx +41 -41
- package/src/common/icons-svg/calendar/index.tsx +40 -40
- package/src/common/icons-svg/call-bell/index.tsx +29 -29
- package/src/common/icons-svg/camera-plus/index.tsx +40 -40
- package/src/common/icons-svg/chart-bar/index.tsx +29 -0
- package/src/common/icons-svg/check-box-fill/index.tsx +30 -30
- package/src/common/icons-svg/check-box-outline/index.tsx +30 -30
- package/src/common/icons-svg/check-circle/index.tsx +27 -27
- package/src/common/icons-svg/closed/index.tsx +34 -34
- package/src/common/icons-svg/constants/index.ts +46 -43
- package/src/common/icons-svg/credit-card/index.tsx +32 -32
- package/src/common/icons-svg/currency/index.tsx +39 -39
- package/src/common/icons-svg/currency-circle-dollar/index.tsx +29 -0
- package/src/common/icons-svg/eye/index.tsx +31 -31
- package/src/common/icons-svg/eye-slash/index.tsx +31 -31
- package/src/common/icons-svg/file-text/index.tsx +39 -39
- package/src/common/icons-svg/gas-pump/index.tsx +39 -39
- package/src/common/icons-svg/gauge/index.tsx +39 -39
- package/src/common/icons-svg/gear/index.tsx +39 -39
- package/src/common/icons-svg/index.tsx +167 -149
- package/src/common/icons-svg/interface.d.ts +18 -18
- package/src/common/icons-svg/list/index.tsx +58 -58
- package/src/common/icons-svg/moon-stars/index.tsx +29 -29
- package/src/common/icons-svg/note-pincel/index.tsx +40 -40
- package/src/common/icons-svg/package/index.tsx +29 -0
- package/src/common/icons-svg/package-check/index.tsx +45 -45
- package/src/common/icons-svg/shopping-cart/index.tsx +39 -39
- package/src/common/icons-svg/steering-wheel/index.tsx +49 -49
- package/src/common/icons-svg/steering-wheel-fill/index.tsx +36 -36
- package/src/common/icons-svg/timer/index.tsx +39 -39
- package/src/common/icons-svg/trophy/index.tsx +29 -29
- package/src/common/icons-svg/truck/index.tsx +39 -39
- package/src/common/icons-svg/truck-trailer/index.tsx +36 -0
- package/src/common/icons-svg/wifi-high/index.tsx +43 -43
- package/src/common/icons-svg/wifi-x/index.tsx +50 -50
- package/src/components/box/index.tsx +47 -47
- package/src/components/box/interface.d.ts +31 -31
- package/src/components/box/styles.ts +21 -21
- package/src/components/button/index.tsx +61 -61
- package/src/components/button/interface.d.ts +40 -40
- package/src/components/button/styles.ts +34 -34
- package/src/components/capture-photo/index.tsx +125 -125
- package/src/components/capture-photo/interface.d.ts +44 -44
- package/src/components/capture-photo/styles.ts +24 -24
- package/src/components/card-hours/index.tsx +118 -118
- package/src/components/card-hours/interface.d.ts +37 -37
- package/src/components/card-scheduled-journey/index.tsx +138 -138
- package/src/components/card-scheduled-journey/interface.ts +42 -42
- package/src/components/card-scheduled-journey/styles.ts +26 -26
- package/src/components/header-profile/index.tsx +128 -128
- package/src/components/header-profile/interface.d.ts +52 -52
- package/src/components/input/index.tsx +176 -180
- package/src/components/input/interface.d.ts +55 -55
- package/src/components/input/styles.ts +23 -23
- package/src/components/menu-item/index.tsx +78 -0
- package/src/components/menu-item/interface.d.ts +19 -0
- package/src/components/menu-item/styles.ts +0 -0
- package/src/components/scheduled-journey-indicators/index.tsx +99 -99
- package/src/components/scheduled-journey-indicators/interface.d.ts +18 -18
- package/src/components/selects/select-option/index.tsx +104 -104
- package/src/components/selects/select-option/interface.d.ts +18 -18
- package/src/components/selects/select-option/styles.ts +75 -75
- package/src/components/step-indicator/helpers/get-icon-by-status.tsx +20 -20
- package/src/components/step-indicator/index.tsx +164 -164
- package/src/components/step-indicator/interface.d.ts +34 -34
- package/src/components/step-indicator/styles.ts +67 -67
- package/src/components/typography/index.tsx +67 -67
- package/src/components/typography/interface.d.ts +102 -102
- package/src/components/typography/styles.ts +34 -34
- package/src/components/user-profile/index.tsx +216 -0
- package/src/components/user-profile/interface.d.ts +22 -0
- package/src/{index.ts → index.tsx} +2 -0
- package/src/stories/box/box.stories.tsx +106 -106
- package/src/stories/button/button.stories.tsx +143 -143
- package/src/stories/capture-photo/capture-photo.stories.tsx +170 -170
- package/src/stories/card-hours/card-hours.stories.tsx +102 -102
- package/src/stories/card-scheduled-journey/card-scheduled-journey.stories.tsx +101 -101
- package/src/stories/header-profile/header-profile.stories.tsx +84 -84
- package/src/stories/input/input.stories.tsx +286 -286
- package/src/stories/menu-item/menu-item.stories.tsx +76 -0
- package/src/stories/scheduled-journey-indicators/sheduled-journey-indicators.stories.tsx +74 -74
- package/src/stories/select-option/select-option.stories.tsx +46 -46
- package/src/stories/step-indicator/step-indicator.stories.tsx +116 -116
- package/src/stories/typography/typography.stories.tsx +146 -146
- package/src/stories/user-profile/user-profile.stories.tsx +56 -0
- package/src/styles/global/interface.d.ts +131 -131
- package/src/styles/global/styles.ts +63 -63
- package/src/styles/global/theme-provider.tsx +10 -10
- package/src/styles/theme/theme.ts +158 -156
- package/src/utils/format-data/index.ts +14 -14
- package/src/utils/mutiply/index.ts +3 -3
|
@@ -1,99 +1,99 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* IMPORTS
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import React from "react";
|
|
6
|
-
import { Dimensions, TouchableOpacity } from "react-native";
|
|
7
|
-
|
|
8
|
-
// components
|
|
9
|
-
import { Box } from "../box";
|
|
10
|
-
import { Typography } from "../typography";
|
|
11
|
-
|
|
12
|
-
// commons / Icon
|
|
13
|
-
import { Icons } from "../../common/icons-svg";
|
|
14
|
-
|
|
15
|
-
// typings
|
|
16
|
-
import { IScheduledJourneyIndicators } from "./interface";
|
|
17
|
-
|
|
18
|
-
// styles
|
|
19
|
-
import { theme } from "../../styles/theme/theme";
|
|
20
|
-
|
|
21
|
-
const { width: widthScreen } = Dimensions.get("window");
|
|
22
|
-
const isMobile = widthScreen < 768;
|
|
23
|
-
|
|
24
|
-
const ScheduledJourneyIndicators: React.FC<IScheduledJourneyIndicators> = ({
|
|
25
|
-
journey,
|
|
26
|
-
isEdit,
|
|
27
|
-
handleOpenEditModal,
|
|
28
|
-
}) => {
|
|
29
|
-
return (
|
|
30
|
-
<TouchableOpacity
|
|
31
|
-
onPress={handleOpenEditModal}
|
|
32
|
-
disabled={!isEdit}
|
|
33
|
-
activeOpacity={0.7}
|
|
34
|
-
style={{
|
|
35
|
-
backgroundColor: theme.colors.neutral[25],
|
|
36
|
-
borderRadius: 8,
|
|
37
|
-
flexDirection: "row",
|
|
38
|
-
alignItems: "center",
|
|
39
|
-
justifyContent: "space-between",
|
|
40
|
-
padding: theme.paddings.xs,
|
|
41
|
-
marginBottom: 16,
|
|
42
|
-
}}
|
|
43
|
-
>
|
|
44
|
-
<Box
|
|
45
|
-
flexStyle={{
|
|
46
|
-
alignItems: "center",
|
|
47
|
-
justifyContent: "center",
|
|
48
|
-
}}
|
|
49
|
-
marginStyle={{ marginLeft: isMobile ? 0 : theme.margins.xs }}
|
|
50
|
-
>
|
|
51
|
-
<Icons
|
|
52
|
-
icon={isEdit ? "NOTE_PINCEL" : "CHECK_CIRCLE"}
|
|
53
|
-
color={isEdit ? theme.colors.blue[350] : theme.colors.green[400]}
|
|
54
|
-
/>
|
|
55
|
-
</Box>
|
|
56
|
-
|
|
57
|
-
<Box
|
|
58
|
-
flexStyle={{
|
|
59
|
-
flex: 0.72,
|
|
60
|
-
alignItems: "flex-start",
|
|
61
|
-
}}
|
|
62
|
-
>
|
|
63
|
-
<Typography
|
|
64
|
-
text={journey?.descricao}
|
|
65
|
-
color={theme.colors.black[100]}
|
|
66
|
-
size={theme.fontSizes.sm}
|
|
67
|
-
fontWeight="700"
|
|
68
|
-
fontFamily={theme.fonts.inter_bold}
|
|
69
|
-
lineHeight={theme.fontSizes.lg}
|
|
70
|
-
letterSpacing={"o_16"}
|
|
71
|
-
numberOfLines={1}
|
|
72
|
-
ellipsizeMode="tail"
|
|
73
|
-
/>
|
|
74
|
-
</Box>
|
|
75
|
-
|
|
76
|
-
<Box
|
|
77
|
-
flexStyle={{
|
|
78
|
-
flex: 0.22,
|
|
79
|
-
alignItems: "flex-end",
|
|
80
|
-
}}
|
|
81
|
-
>
|
|
82
|
-
<Typography
|
|
83
|
-
text={journey?.duracao_horas}
|
|
84
|
-
color={theme.colors.gray[700]}
|
|
85
|
-
size={theme.fontSizes.sm}
|
|
86
|
-
fontWeight="600"
|
|
87
|
-
fontFamily={theme.fonts.inter_semi_bold_600}
|
|
88
|
-
lineHeight={24}
|
|
89
|
-
letterSpacing={"o_16"}
|
|
90
|
-
/>
|
|
91
|
-
</Box>
|
|
92
|
-
</TouchableOpacity>
|
|
93
|
-
);
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* EXPORTS
|
|
98
|
-
*/
|
|
99
|
-
export { ScheduledJourneyIndicators };
|
|
1
|
+
/**
|
|
2
|
+
* IMPORTS
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import React from "react";
|
|
6
|
+
import { Dimensions, TouchableOpacity } from "react-native";
|
|
7
|
+
|
|
8
|
+
// components
|
|
9
|
+
import { Box } from "../box";
|
|
10
|
+
import { Typography } from "../typography";
|
|
11
|
+
|
|
12
|
+
// commons / Icon
|
|
13
|
+
import { Icons } from "../../common/icons-svg";
|
|
14
|
+
|
|
15
|
+
// typings
|
|
16
|
+
import { IScheduledJourneyIndicators } from "./interface";
|
|
17
|
+
|
|
18
|
+
// styles
|
|
19
|
+
import { theme } from "../../styles/theme/theme";
|
|
20
|
+
|
|
21
|
+
const { width: widthScreen } = Dimensions.get("window");
|
|
22
|
+
const isMobile = widthScreen < 768;
|
|
23
|
+
|
|
24
|
+
const ScheduledJourneyIndicators: React.FC<IScheduledJourneyIndicators> = ({
|
|
25
|
+
journey,
|
|
26
|
+
isEdit,
|
|
27
|
+
handleOpenEditModal,
|
|
28
|
+
}) => {
|
|
29
|
+
return (
|
|
30
|
+
<TouchableOpacity
|
|
31
|
+
onPress={handleOpenEditModal}
|
|
32
|
+
disabled={!isEdit}
|
|
33
|
+
activeOpacity={0.7}
|
|
34
|
+
style={{
|
|
35
|
+
backgroundColor: theme.colors.neutral[25],
|
|
36
|
+
borderRadius: 8,
|
|
37
|
+
flexDirection: "row",
|
|
38
|
+
alignItems: "center",
|
|
39
|
+
justifyContent: "space-between",
|
|
40
|
+
padding: theme.paddings.xs,
|
|
41
|
+
marginBottom: 16,
|
|
42
|
+
}}
|
|
43
|
+
>
|
|
44
|
+
<Box
|
|
45
|
+
flexStyle={{
|
|
46
|
+
alignItems: "center",
|
|
47
|
+
justifyContent: "center",
|
|
48
|
+
}}
|
|
49
|
+
marginStyle={{ marginLeft: isMobile ? 0 : theme.margins.xs }}
|
|
50
|
+
>
|
|
51
|
+
<Icons
|
|
52
|
+
icon={isEdit ? "NOTE_PINCEL" : "CHECK_CIRCLE"}
|
|
53
|
+
color={isEdit ? theme.colors.blue[350] : theme.colors.green[400]}
|
|
54
|
+
/>
|
|
55
|
+
</Box>
|
|
56
|
+
|
|
57
|
+
<Box
|
|
58
|
+
flexStyle={{
|
|
59
|
+
flex: 0.72,
|
|
60
|
+
alignItems: "flex-start",
|
|
61
|
+
}}
|
|
62
|
+
>
|
|
63
|
+
<Typography
|
|
64
|
+
text={journey?.descricao}
|
|
65
|
+
color={theme.colors.black[100]}
|
|
66
|
+
size={theme.fontSizes.sm}
|
|
67
|
+
fontWeight="700"
|
|
68
|
+
fontFamily={theme.fonts.inter_bold}
|
|
69
|
+
lineHeight={theme.fontSizes.lg}
|
|
70
|
+
letterSpacing={"o_16"}
|
|
71
|
+
numberOfLines={1}
|
|
72
|
+
ellipsizeMode="tail"
|
|
73
|
+
/>
|
|
74
|
+
</Box>
|
|
75
|
+
|
|
76
|
+
<Box
|
|
77
|
+
flexStyle={{
|
|
78
|
+
flex: 0.22,
|
|
79
|
+
alignItems: "flex-end",
|
|
80
|
+
}}
|
|
81
|
+
>
|
|
82
|
+
<Typography
|
|
83
|
+
text={journey?.duracao_horas}
|
|
84
|
+
color={theme.colors.gray[700]}
|
|
85
|
+
size={theme.fontSizes.sm}
|
|
86
|
+
fontWeight="600"
|
|
87
|
+
fontFamily={theme.fonts.inter_semi_bold_600}
|
|
88
|
+
lineHeight={24}
|
|
89
|
+
letterSpacing={"o_16"}
|
|
90
|
+
/>
|
|
91
|
+
</Box>
|
|
92
|
+
</TouchableOpacity>
|
|
93
|
+
);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* EXPORTS
|
|
98
|
+
*/
|
|
99
|
+
export { ScheduledJourneyIndicators };
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* IMPORTS
|
|
3
|
-
*/
|
|
4
|
-
import { TouchableOpacityProps } from "react-native";
|
|
5
|
-
|
|
6
|
-
// typing
|
|
7
|
-
import { IGlobalCss } from "../../styles/global/interface";
|
|
8
|
-
|
|
9
|
-
interface IScheduledJourneyIndicators extends TouchableOpacityProps, IGlobalCss {
|
|
10
|
-
journey: any;
|
|
11
|
-
isEdit: boolean;
|
|
12
|
-
handleOpenEditModal: () => void;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* EXPORTS
|
|
17
|
-
*/
|
|
18
|
-
export { IScheduledJourneyIndicators };
|
|
1
|
+
/**
|
|
2
|
+
* IMPORTS
|
|
3
|
+
*/
|
|
4
|
+
import { TouchableOpacityProps } from "react-native";
|
|
5
|
+
|
|
6
|
+
// typing
|
|
7
|
+
import { IGlobalCss } from "../../styles/global/interface";
|
|
8
|
+
|
|
9
|
+
interface IScheduledJourneyIndicators extends TouchableOpacityProps, IGlobalCss {
|
|
10
|
+
journey: any;
|
|
11
|
+
isEdit: boolean;
|
|
12
|
+
handleOpenEditModal: () => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* EXPORTS
|
|
17
|
+
*/
|
|
18
|
+
export { IScheduledJourneyIndicators };
|
|
@@ -1,104 +1,104 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* IMPORTS
|
|
3
|
-
*/
|
|
4
|
-
import React from "react";
|
|
5
|
-
import { useState } from "react";
|
|
6
|
-
import { View, Text, TouchableOpacity, Modal, FlatList } from "react-native";
|
|
7
|
-
|
|
8
|
-
// common / svg
|
|
9
|
-
import { SvgIconArrowDropDown } from "../../../common/icons-svg/arrow-drop-down";
|
|
10
|
-
import { SvgIconClosed } from "../../../common/icons-svg/closed";
|
|
11
|
-
|
|
12
|
-
// typings
|
|
13
|
-
import { ISelectDropDownProps } from "./interface";
|
|
14
|
-
|
|
15
|
-
// styles
|
|
16
|
-
import { styles } from "./styles";
|
|
17
|
-
import { Icons } from "../../../common/icons-svg";
|
|
18
|
-
import { theme } from "../../../styles/theme/theme";
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Componente SelectOption para a interação da ui.
|
|
22
|
-
*/
|
|
23
|
-
const SelectOption: React.FC<ISelectDropDownProps> = ({
|
|
24
|
-
dataOption,
|
|
25
|
-
handleSelectDown,
|
|
26
|
-
titleLabel,
|
|
27
|
-
sizeTitleLabel,
|
|
28
|
-
colortitleLabel,
|
|
29
|
-
}: ISelectDropDownProps) => {
|
|
30
|
-
const [selectedValue, setSelectedValue] = useState(dataOption[0]?.value || "");
|
|
31
|
-
const [modalVisible, setModalVisible] = useState(false);
|
|
32
|
-
|
|
33
|
-
const handleSelect = (value: string) => {
|
|
34
|
-
setSelectedValue(value);
|
|
35
|
-
setModalVisible(false);
|
|
36
|
-
handleSelectDown(value);
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
const styleProps = {
|
|
40
|
-
dataOption,
|
|
41
|
-
handleSelectDown,
|
|
42
|
-
titleLabel,
|
|
43
|
-
sizeTitleLabel,
|
|
44
|
-
colortitleLabel,
|
|
45
|
-
} as ISelectDropDownProps;
|
|
46
|
-
|
|
47
|
-
return (
|
|
48
|
-
<View style={styles(styleProps).container}>
|
|
49
|
-
{/* Titulo para exibir o label */}
|
|
50
|
-
<Text style={styles(styleProps).label}>{`${titleLabel ?? "Selecione uma opção"}`}:</Text>
|
|
51
|
-
|
|
52
|
-
{/* Botão para abrir o modal */}
|
|
53
|
-
<TouchableOpacity
|
|
54
|
-
testID="select-box"
|
|
55
|
-
style={styles(styleProps).selectBox}
|
|
56
|
-
onPress={() => setModalVisible(true)}
|
|
57
|
-
>
|
|
58
|
-
<Text style={styles(styleProps).selectedText}>
|
|
59
|
-
{dataOption.find((item) => item.value === selectedValue)?.label}
|
|
60
|
-
</Text>
|
|
61
|
-
|
|
62
|
-
<Icons
|
|
63
|
-
size={theme.fontSizes["md"]}
|
|
64
|
-
color={theme.colors.blue[500]}
|
|
65
|
-
icon={"ARROW_DROP_DOWN"}
|
|
66
|
-
/>
|
|
67
|
-
</TouchableOpacity>
|
|
68
|
-
|
|
69
|
-
{/* Modal para exibir as opções */}
|
|
70
|
-
<Modal testID="modal-container" visible={modalVisible} transparent animationType="fade">
|
|
71
|
-
<View style={styles(styleProps).modalOverlay}>
|
|
72
|
-
<View style={styles(styleProps).modalContainer}>
|
|
73
|
-
<View style={{ width: "100%", alignItems: "flex-end" }}>
|
|
74
|
-
<TouchableOpacity testID="close-icon" onPress={() => setModalVisible(false)}>
|
|
75
|
-
<Icons
|
|
76
|
-
size={theme.fontSizes["md"]}
|
|
77
|
-
color={theme.colors.blue[500]}
|
|
78
|
-
icon={"CLOSED"}
|
|
79
|
-
/>
|
|
80
|
-
</TouchableOpacity>
|
|
81
|
-
</View>
|
|
82
|
-
<FlatList
|
|
83
|
-
data={dataOption || []}
|
|
84
|
-
keyExtractor={(item) => item.value}
|
|
85
|
-
renderItem={({ item }) => (
|
|
86
|
-
<TouchableOpacity
|
|
87
|
-
style={styles(styleProps).option}
|
|
88
|
-
onPress={() => handleSelect(item.value)}
|
|
89
|
-
>
|
|
90
|
-
<Text style={styles(styleProps).optionText}>{item.label}</Text>
|
|
91
|
-
</TouchableOpacity>
|
|
92
|
-
)}
|
|
93
|
-
/>
|
|
94
|
-
</View>
|
|
95
|
-
</View>
|
|
96
|
-
</Modal>
|
|
97
|
-
</View>
|
|
98
|
-
);
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* EXPORTS
|
|
103
|
-
*/
|
|
104
|
-
export { SelectOption };
|
|
1
|
+
/**
|
|
2
|
+
* IMPORTS
|
|
3
|
+
*/
|
|
4
|
+
import React from "react";
|
|
5
|
+
import { useState } from "react";
|
|
6
|
+
import { View, Text, TouchableOpacity, Modal, FlatList } from "react-native";
|
|
7
|
+
|
|
8
|
+
// common / svg
|
|
9
|
+
import { SvgIconArrowDropDown } from "../../../common/icons-svg/arrow-drop-down";
|
|
10
|
+
import { SvgIconClosed } from "../../../common/icons-svg/closed";
|
|
11
|
+
|
|
12
|
+
// typings
|
|
13
|
+
import { ISelectDropDownProps } from "./interface";
|
|
14
|
+
|
|
15
|
+
// styles
|
|
16
|
+
import { styles } from "./styles";
|
|
17
|
+
import { Icons } from "../../../common/icons-svg";
|
|
18
|
+
import { theme } from "../../../styles/theme/theme";
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Componente SelectOption para a interação da ui.
|
|
22
|
+
*/
|
|
23
|
+
const SelectOption: React.FC<ISelectDropDownProps> = ({
|
|
24
|
+
dataOption,
|
|
25
|
+
handleSelectDown,
|
|
26
|
+
titleLabel,
|
|
27
|
+
sizeTitleLabel,
|
|
28
|
+
colortitleLabel,
|
|
29
|
+
}: ISelectDropDownProps) => {
|
|
30
|
+
const [selectedValue, setSelectedValue] = useState(dataOption[0]?.value || "");
|
|
31
|
+
const [modalVisible, setModalVisible] = useState(false);
|
|
32
|
+
|
|
33
|
+
const handleSelect = (value: string) => {
|
|
34
|
+
setSelectedValue(value);
|
|
35
|
+
setModalVisible(false);
|
|
36
|
+
handleSelectDown(value);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const styleProps = {
|
|
40
|
+
dataOption,
|
|
41
|
+
handleSelectDown,
|
|
42
|
+
titleLabel,
|
|
43
|
+
sizeTitleLabel,
|
|
44
|
+
colortitleLabel,
|
|
45
|
+
} as ISelectDropDownProps;
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<View style={styles(styleProps).container}>
|
|
49
|
+
{/* Titulo para exibir o label */}
|
|
50
|
+
<Text style={styles(styleProps).label}>{`${titleLabel ?? "Selecione uma opção"}`}:</Text>
|
|
51
|
+
|
|
52
|
+
{/* Botão para abrir o modal */}
|
|
53
|
+
<TouchableOpacity
|
|
54
|
+
testID="select-box"
|
|
55
|
+
style={styles(styleProps).selectBox}
|
|
56
|
+
onPress={() => setModalVisible(true)}
|
|
57
|
+
>
|
|
58
|
+
<Text style={styles(styleProps).selectedText}>
|
|
59
|
+
{dataOption.find((item) => item.value === selectedValue)?.label}
|
|
60
|
+
</Text>
|
|
61
|
+
|
|
62
|
+
<Icons
|
|
63
|
+
size={theme.fontSizes["md"]}
|
|
64
|
+
color={theme.colors.blue[500]}
|
|
65
|
+
icon={"ARROW_DROP_DOWN"}
|
|
66
|
+
/>
|
|
67
|
+
</TouchableOpacity>
|
|
68
|
+
|
|
69
|
+
{/* Modal para exibir as opções */}
|
|
70
|
+
<Modal testID="modal-container" visible={modalVisible} transparent animationType="fade">
|
|
71
|
+
<View style={styles(styleProps).modalOverlay}>
|
|
72
|
+
<View style={styles(styleProps).modalContainer}>
|
|
73
|
+
<View style={{ width: "100%", alignItems: "flex-end" }}>
|
|
74
|
+
<TouchableOpacity testID="close-icon" onPress={() => setModalVisible(false)}>
|
|
75
|
+
<Icons
|
|
76
|
+
size={theme.fontSizes["md"]}
|
|
77
|
+
color={theme.colors.blue[500]}
|
|
78
|
+
icon={"CLOSED"}
|
|
79
|
+
/>
|
|
80
|
+
</TouchableOpacity>
|
|
81
|
+
</View>
|
|
82
|
+
<FlatList
|
|
83
|
+
data={dataOption || []}
|
|
84
|
+
keyExtractor={(item) => item.value}
|
|
85
|
+
renderItem={({ item }) => (
|
|
86
|
+
<TouchableOpacity
|
|
87
|
+
style={styles(styleProps).option}
|
|
88
|
+
onPress={() => handleSelect(item.value)}
|
|
89
|
+
>
|
|
90
|
+
<Text style={styles(styleProps).optionText}>{item.label}</Text>
|
|
91
|
+
</TouchableOpacity>
|
|
92
|
+
)}
|
|
93
|
+
/>
|
|
94
|
+
</View>
|
|
95
|
+
</View>
|
|
96
|
+
</Modal>
|
|
97
|
+
</View>
|
|
98
|
+
);
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* EXPORTS
|
|
103
|
+
*/
|
|
104
|
+
export { SelectOption };
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* IMPORTS
|
|
3
|
-
*/
|
|
4
|
-
type ISelectDropDownProps = {
|
|
5
|
-
dataOption: any[];
|
|
6
|
-
titleLabel: string;
|
|
7
|
-
sizeTitleLabel?: number;
|
|
8
|
-
colortitleLabel?: string;
|
|
9
|
-
|
|
10
|
-
/**retorna o valor selecionado */
|
|
11
|
-
// eslint-disable-next-line no-unused-vars
|
|
12
|
-
handleSelectDown: (value: string) => void;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* EXPORTS
|
|
17
|
-
*/
|
|
18
|
-
export { ISelectDropDownProps };
|
|
1
|
+
/**
|
|
2
|
+
* IMPORTS
|
|
3
|
+
*/
|
|
4
|
+
type ISelectDropDownProps = {
|
|
5
|
+
dataOption: any[];
|
|
6
|
+
titleLabel: string;
|
|
7
|
+
sizeTitleLabel?: number;
|
|
8
|
+
colortitleLabel?: string;
|
|
9
|
+
|
|
10
|
+
/**retorna o valor selecionado */
|
|
11
|
+
// eslint-disable-next-line no-unused-vars
|
|
12
|
+
handleSelectDown: (value: string) => void;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* EXPORTS
|
|
17
|
+
*/
|
|
18
|
+
export { ISelectDropDownProps };
|
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* IMPORTS
|
|
3
|
-
*/
|
|
4
|
-
import { StyleSheet } from "react-native";
|
|
5
|
-
|
|
6
|
-
// typings
|
|
7
|
-
import { ISelectDropDownProps } from "./interface";
|
|
8
|
-
|
|
9
|
-
// theme
|
|
10
|
-
import { theme } from "../../../styles/theme/theme";
|
|
11
|
-
|
|
12
|
-
const styles = (props: ISelectDropDownProps) =>
|
|
13
|
-
StyleSheet.create({
|
|
14
|
-
container: {
|
|
15
|
-
width: "100%",
|
|
16
|
-
marginBottom: 16,
|
|
17
|
-
},
|
|
18
|
-
label: {
|
|
19
|
-
fontSize: props.sizeTitleLabel ?? 16,
|
|
20
|
-
fontWeight: "bold",
|
|
21
|
-
color: props.colortitleLabel ?? theme.colors.black[100],
|
|
22
|
-
marginBottom: 5,
|
|
23
|
-
},
|
|
24
|
-
selectBox: {
|
|
25
|
-
flexDirection: "row",
|
|
26
|
-
alignItems: "center",
|
|
27
|
-
justifyContent: "space-between",
|
|
28
|
-
width: "100%",
|
|
29
|
-
height: 45,
|
|
30
|
-
borderWidth: 1,
|
|
31
|
-
borderColor: theme.colors.gray[700],
|
|
32
|
-
borderRadius: 10,
|
|
33
|
-
backgroundColor: theme.colors.neutral[25],
|
|
34
|
-
paddingHorizontal: 10,
|
|
35
|
-
},
|
|
36
|
-
selectedText: {
|
|
37
|
-
fontSize: 14,
|
|
38
|
-
color: "#666",
|
|
39
|
-
},
|
|
40
|
-
modalOverlay: {
|
|
41
|
-
flex: 1,
|
|
42
|
-
backgroundColor: "rgba(0,0,0,0.5)",
|
|
43
|
-
justifyContent: "center",
|
|
44
|
-
alignItems: "center",
|
|
45
|
-
padding: 24,
|
|
46
|
-
},
|
|
47
|
-
modalContainer: {
|
|
48
|
-
width: "100%",
|
|
49
|
-
backgroundColor: theme.colors.neutral[25],
|
|
50
|
-
borderRadius: 10,
|
|
51
|
-
padding: 15,
|
|
52
|
-
alignItems: "center",
|
|
53
|
-
},
|
|
54
|
-
option: {
|
|
55
|
-
width: "100%",
|
|
56
|
-
padding: 10,
|
|
57
|
-
alignItems: "flex-start",
|
|
58
|
-
borderBottomWidth: 1,
|
|
59
|
-
borderBottomColor: theme.colors.gray[300],
|
|
60
|
-
},
|
|
61
|
-
optionText: {
|
|
62
|
-
fontSize: 14,
|
|
63
|
-
color: theme.colors.black[100],
|
|
64
|
-
fontWeight: "500",
|
|
65
|
-
},
|
|
66
|
-
closeButtonText: {
|
|
67
|
-
color: theme.colors.neutral[25],
|
|
68
|
-
fontWeight: "bold",
|
|
69
|
-
},
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* EXPORTS
|
|
74
|
-
*/
|
|
75
|
-
export { styles };
|
|
1
|
+
/**
|
|
2
|
+
* IMPORTS
|
|
3
|
+
*/
|
|
4
|
+
import { StyleSheet } from "react-native";
|
|
5
|
+
|
|
6
|
+
// typings
|
|
7
|
+
import { ISelectDropDownProps } from "./interface";
|
|
8
|
+
|
|
9
|
+
// theme
|
|
10
|
+
import { theme } from "../../../styles/theme/theme";
|
|
11
|
+
|
|
12
|
+
const styles = (props: ISelectDropDownProps) =>
|
|
13
|
+
StyleSheet.create({
|
|
14
|
+
container: {
|
|
15
|
+
width: "100%",
|
|
16
|
+
marginBottom: 16,
|
|
17
|
+
},
|
|
18
|
+
label: {
|
|
19
|
+
fontSize: props.sizeTitleLabel ?? 16,
|
|
20
|
+
fontWeight: "bold",
|
|
21
|
+
color: props.colortitleLabel ?? theme.colors.black[100],
|
|
22
|
+
marginBottom: 5,
|
|
23
|
+
},
|
|
24
|
+
selectBox: {
|
|
25
|
+
flexDirection: "row",
|
|
26
|
+
alignItems: "center",
|
|
27
|
+
justifyContent: "space-between",
|
|
28
|
+
width: "100%",
|
|
29
|
+
height: 45,
|
|
30
|
+
borderWidth: 1,
|
|
31
|
+
borderColor: theme.colors.gray[700],
|
|
32
|
+
borderRadius: 10,
|
|
33
|
+
backgroundColor: theme.colors.neutral[25],
|
|
34
|
+
paddingHorizontal: 10,
|
|
35
|
+
},
|
|
36
|
+
selectedText: {
|
|
37
|
+
fontSize: 14,
|
|
38
|
+
color: "#666",
|
|
39
|
+
},
|
|
40
|
+
modalOverlay: {
|
|
41
|
+
flex: 1,
|
|
42
|
+
backgroundColor: "rgba(0,0,0,0.5)",
|
|
43
|
+
justifyContent: "center",
|
|
44
|
+
alignItems: "center",
|
|
45
|
+
padding: 24,
|
|
46
|
+
},
|
|
47
|
+
modalContainer: {
|
|
48
|
+
width: "100%",
|
|
49
|
+
backgroundColor: theme.colors.neutral[25],
|
|
50
|
+
borderRadius: 10,
|
|
51
|
+
padding: 15,
|
|
52
|
+
alignItems: "center",
|
|
53
|
+
},
|
|
54
|
+
option: {
|
|
55
|
+
width: "100%",
|
|
56
|
+
padding: 10,
|
|
57
|
+
alignItems: "flex-start",
|
|
58
|
+
borderBottomWidth: 1,
|
|
59
|
+
borderBottomColor: theme.colors.gray[300],
|
|
60
|
+
},
|
|
61
|
+
optionText: {
|
|
62
|
+
fontSize: 14,
|
|
63
|
+
color: theme.colors.black[100],
|
|
64
|
+
fontWeight: "500",
|
|
65
|
+
},
|
|
66
|
+
closeButtonText: {
|
|
67
|
+
color: theme.colors.neutral[25],
|
|
68
|
+
fontWeight: "bold",
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* EXPORTS
|
|
74
|
+
*/
|
|
75
|
+
export { styles };
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* IMPORTS
|
|
3
|
-
*/
|
|
4
|
-
import { SVG_NAME } from "../../../common/icons-svg/constants";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Função que mapeará os ícones correspondentes em SVG 🛠️.
|
|
8
|
-
* @param propertyType
|
|
9
|
-
* @returns SVG
|
|
10
|
-
*/
|
|
11
|
-
const getIconKeyByValue = (propertyType: string): keyof typeof SVG_NAME | undefined => {
|
|
12
|
-
return (Object.keys(SVG_NAME) as Array<keyof typeof SVG_NAME>).find(
|
|
13
|
-
(key) => SVG_NAME[key] === propertyType
|
|
14
|
-
);
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* EXPORTS
|
|
19
|
-
*/
|
|
20
|
-
export { getIconKeyByValue };
|
|
1
|
+
/**
|
|
2
|
+
* IMPORTS
|
|
3
|
+
*/
|
|
4
|
+
import { SVG_NAME } from "../../../common/icons-svg/constants";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Função que mapeará os ícones correspondentes em SVG 🛠️.
|
|
8
|
+
* @param propertyType
|
|
9
|
+
* @returns SVG
|
|
10
|
+
*/
|
|
11
|
+
const getIconKeyByValue = (propertyType: string): keyof typeof SVG_NAME | undefined => {
|
|
12
|
+
return (Object.keys(SVG_NAME) as Array<keyof typeof SVG_NAME>).find(
|
|
13
|
+
(key) => SVG_NAME[key] === propertyType
|
|
14
|
+
);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* EXPORTS
|
|
19
|
+
*/
|
|
20
|
+
export { getIconKeyByValue };
|