react-native-exp-fig 0.1.0
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/LICENSE +20 -0
- package/README.md +119 -0
- package/package.json +200 -0
- package/react-native.config.js +4 -0
- package/src/assets/fonts/Inter-Black.ttf +0 -0
- package/src/assets/fonts/Inter-Bold.ttf +0 -0
- package/src/assets/fonts/Inter-ExtraBold.ttf +0 -0
- package/src/assets/fonts/Inter-ExtraLight.ttf +0 -0
- package/src/assets/fonts/Inter-Light.ttf +0 -0
- package/src/assets/fonts/Inter-Medium.ttf +0 -0
- package/src/assets/fonts/Inter-Regular.ttf +0 -0
- package/src/assets/fonts/Inter-SemiBold.ttf +0 -0
- package/src/assets/fonts/Inter-Thin.ttf +0 -0
- package/src/common/icons-svg/arrow-drop-down/index.tsx +28 -0
- package/src/common/icons-svg/arrow-left/index.tsx +32 -0
- package/src/common/icons-svg/bluetooth/index.tsx +37 -0
- package/src/common/icons-svg/bluetooth-connected/index.tsx +41 -0
- package/src/common/icons-svg/calendar/index.tsx +40 -0
- package/src/common/icons-svg/call-bell/index.tsx +29 -0
- package/src/common/icons-svg/camera-plus/index.tsx +40 -0
- package/src/common/icons-svg/check-box-fill/index.tsx +30 -0
- package/src/common/icons-svg/check-box-outline/index.tsx +30 -0
- package/src/common/icons-svg/check-circle/index.tsx +27 -0
- package/src/common/icons-svg/closed/index.tsx +34 -0
- package/src/common/icons-svg/constants/index.ts +43 -0
- package/src/common/icons-svg/credit-card/index.tsx +32 -0
- package/src/common/icons-svg/currency/index.tsx +39 -0
- package/src/common/icons-svg/eye/index.tsx +31 -0
- package/src/common/icons-svg/eye-slash/index.tsx +31 -0
- package/src/common/icons-svg/file-text/index.tsx +39 -0
- package/src/common/icons-svg/gas-pump/index.tsx +39 -0
- package/src/common/icons-svg/gauge/index.tsx +39 -0
- package/src/common/icons-svg/gear/index.tsx +39 -0
- package/src/common/icons-svg/index.tsx +149 -0
- package/src/common/icons-svg/interface.d.ts +18 -0
- package/src/common/icons-svg/list/index.tsx +58 -0
- package/src/common/icons-svg/moon-stars/index.tsx +29 -0
- package/src/common/icons-svg/note-pincel/index.tsx +40 -0
- package/src/common/icons-svg/package-check/index.tsx +45 -0
- package/src/common/icons-svg/shopping-cart/index.tsx +39 -0
- package/src/common/icons-svg/steering-wheel/index.tsx +49 -0
- package/src/common/icons-svg/steering-wheel-fill/index.tsx +36 -0
- package/src/common/icons-svg/timer/index.tsx +39 -0
- package/src/common/icons-svg/trophy/index.tsx +29 -0
- package/src/common/icons-svg/truck/index.tsx +39 -0
- package/src/common/icons-svg/wifi-high/index.tsx +43 -0
- package/src/common/icons-svg/wifi-x/index.tsx +50 -0
- package/src/components/box/index.tsx +47 -0
- package/src/components/box/interface.d.ts +31 -0
- package/src/components/box/styles.ts +21 -0
- package/src/components/button/index.tsx +61 -0
- package/src/components/button/interface.d.ts +40 -0
- package/src/components/button/styles.ts +34 -0
- package/src/components/capture-photo/index.tsx +125 -0
- package/src/components/capture-photo/interface.d.ts +44 -0
- package/src/components/capture-photo/styles.ts +24 -0
- package/src/components/card-hours/index.tsx +118 -0
- package/src/components/card-hours/interface.d.ts +37 -0
- package/src/components/card-scheduled-journey/index.tsx +138 -0
- package/src/components/card-scheduled-journey/interface.ts +42 -0
- package/src/components/card-scheduled-journey/styles.ts +26 -0
- package/src/components/header-profile/index.tsx +128 -0
- package/src/components/header-profile/interface.d.ts +52 -0
- package/src/components/input/index.tsx +180 -0
- package/src/components/input/interface.d.ts +55 -0
- package/src/components/input/styles.ts +23 -0
- package/src/components/scheduled-journey-indicators/index.tsx +99 -0
- package/src/components/scheduled-journey-indicators/interface.d.ts +18 -0
- package/src/components/selects/select-option/index.tsx +104 -0
- package/src/components/selects/select-option/interface.d.ts +18 -0
- package/src/components/selects/select-option/styles.ts +75 -0
- package/src/components/step-indicator/helpers/get-icon-by-status.tsx +20 -0
- package/src/components/step-indicator/index.tsx +164 -0
- package/src/components/step-indicator/interface.d.ts +34 -0
- package/src/components/step-indicator/styles.ts +67 -0
- package/src/components/typography/index.tsx +67 -0
- package/src/components/typography/interface.d.ts +102 -0
- package/src/components/typography/styles.ts +34 -0
- package/src/index.tsx +23 -0
- package/src/stories/box/box.stories.tsx +106 -0
- package/src/stories/button/button.stories.tsx +143 -0
- package/src/stories/capture-photo/capture-photo.stories.tsx +170 -0
- package/src/stories/card-hours/card-hours.stories.tsx +102 -0
- package/src/stories/card-scheduled-journey/card-scheduled-journey.stories.tsx +101 -0
- package/src/stories/header-profile/header-profile.stories.tsx +84 -0
- package/src/stories/input/input.stories.tsx +286 -0
- package/src/stories/scheduled-journey-indicators/sheduled-journey-indicators.stories.tsx +74 -0
- package/src/stories/select-option/select-option.stories.tsx +46 -0
- package/src/stories/step-indicator/step-indicator.stories.tsx +116 -0
- package/src/stories/typography/typography.stories.tsx +146 -0
- package/src/styles/global/interface.d.ts +131 -0
- package/src/styles/global/styles.ts +63 -0
- package/src/styles/global/theme-provider.tsx +10 -0
- package/src/styles/theme/theme.ts +156 -0
- package/src/utils/format-data/index.ts +14 -0
- package/src/utils/mutiply/index.ts +3 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IMPORTS
|
|
3
|
+
*/
|
|
4
|
+
import { ViewProps } from "react-native";
|
|
5
|
+
|
|
6
|
+
// typing
|
|
7
|
+
import { IGlobalCss } from "../../styles/global/interface";
|
|
8
|
+
|
|
9
|
+
interface IHeaderProps extends ViewProps, IGlobalCss {
|
|
10
|
+
title: string;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* TestID para testes automático e identificação
|
|
14
|
+
*/
|
|
15
|
+
testID?: string;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* prop de navegação
|
|
19
|
+
*/
|
|
20
|
+
propsNav?: any;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* arrow para coloca o ícone da flecha ou lista
|
|
24
|
+
*/
|
|
25
|
+
arrow: boolean;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* permission boolean
|
|
29
|
+
*/
|
|
30
|
+
permission: boolean;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* isInternetReachable boolean que consta se está conectado a internet
|
|
34
|
+
*/
|
|
35
|
+
isInternetReachable: boolean;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* verifica se o bluetooth esta conectado
|
|
39
|
+
*/
|
|
40
|
+
bluetoothIsConnected: boolean;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* direciona para navegação correspondente
|
|
44
|
+
*/
|
|
45
|
+
// eslint-disable-next-line no-unused-vars
|
|
46
|
+
handleNavigation: (propsNav: any) => void;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* EXPORTS
|
|
51
|
+
*/
|
|
52
|
+
export type { IHeaderProps };
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IMPORTS
|
|
3
|
+
*/
|
|
4
|
+
import React from "react";
|
|
5
|
+
import { Dimensions, TouchableOpacity, TextInput, ViewStyle } from "react-native";
|
|
6
|
+
|
|
7
|
+
// components
|
|
8
|
+
import { Box } from "../box";
|
|
9
|
+
import { Typography } from "../typography";
|
|
10
|
+
import { Icons } from "../../common/icons-svg";
|
|
11
|
+
|
|
12
|
+
// typings
|
|
13
|
+
import { type IInputProps } from "./interface";
|
|
14
|
+
|
|
15
|
+
// styles
|
|
16
|
+
import { theme } from "../../styles/theme/theme";
|
|
17
|
+
import { styles } from "./styles";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
* Componente Input para a interação do usuário com ui.
|
|
22
|
+
*/
|
|
23
|
+
const Input: React.FC<IInputProps> = ({
|
|
24
|
+
name,
|
|
25
|
+
textLabel,
|
|
26
|
+
messageError,
|
|
27
|
+
width,
|
|
28
|
+
backgroundColor,
|
|
29
|
+
marginStyle,
|
|
30
|
+
paddingStyle,
|
|
31
|
+
borderStyled,
|
|
32
|
+
isVisiblyPassword, // password
|
|
33
|
+
testID,
|
|
34
|
+
opacity,
|
|
35
|
+
children,
|
|
36
|
+
fontStyle,
|
|
37
|
+
style,
|
|
38
|
+
flexStyle,
|
|
39
|
+
handlePressIsVisiblyPassword, // password
|
|
40
|
+
append,
|
|
41
|
+
color,
|
|
42
|
+
placeholder,
|
|
43
|
+
textLabelPlaceholder,
|
|
44
|
+
secureTextEntry,
|
|
45
|
+
...props
|
|
46
|
+
}) => {
|
|
47
|
+
const styleProps = {
|
|
48
|
+
width,
|
|
49
|
+
backgroundColor,
|
|
50
|
+
borderStyled,
|
|
51
|
+
flexStyle,
|
|
52
|
+
paddingStyle,
|
|
53
|
+
marginStyle,
|
|
54
|
+
testID,
|
|
55
|
+
opacity,
|
|
56
|
+
children,
|
|
57
|
+
fontStyle,
|
|
58
|
+
color,
|
|
59
|
+
style,
|
|
60
|
+
name,
|
|
61
|
+
} as IInputProps;
|
|
62
|
+
|
|
63
|
+
const { width: widthScreen } = Dimensions.get("window");
|
|
64
|
+
const isMobile = widthScreen < 768;
|
|
65
|
+
|
|
66
|
+
const positionIcon: ViewStyle = {
|
|
67
|
+
position: "absolute",
|
|
68
|
+
right: 15,
|
|
69
|
+
top: isMobile ? 65 : 40,
|
|
70
|
+
};
|
|
71
|
+
const positionIconPassword: ViewStyle = {
|
|
72
|
+
position: "absolute",
|
|
73
|
+
right: 25,
|
|
74
|
+
top: isMobile ? 60 : 38,
|
|
75
|
+
};
|
|
76
|
+
const positionLabel: ViewStyle = { position: "absolute", right: 35, top: 60 };
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<Box paddingStyle={paddingStyle} marginStyle={marginStyle} style={{ position: "relative" }}>
|
|
80
|
+
<Box>
|
|
81
|
+
<Typography
|
|
82
|
+
size={theme.fontSizes["lg"]}
|
|
83
|
+
text={String(textLabel)}
|
|
84
|
+
color={color?.colorText ?? theme.colors.black[100]}
|
|
85
|
+
/>
|
|
86
|
+
|
|
87
|
+
<TextInput
|
|
88
|
+
// @ts-ignore
|
|
89
|
+
style={[styles(styleProps).input, { backgroundColor }, style]}
|
|
90
|
+
placeholder={placeholder}
|
|
91
|
+
secureTextEntry={secureTextEntry}
|
|
92
|
+
{...props}
|
|
93
|
+
/>
|
|
94
|
+
</Box>
|
|
95
|
+
{append && (
|
|
96
|
+
<Box>
|
|
97
|
+
<Typography
|
|
98
|
+
size={theme.fontSizes["lg"]}
|
|
99
|
+
text={append.appendText ?? ""}
|
|
100
|
+
color={append.appendColor ?? "#000"}
|
|
101
|
+
/>
|
|
102
|
+
</Box>
|
|
103
|
+
)}
|
|
104
|
+
|
|
105
|
+
{name === "label" && (
|
|
106
|
+
<Box backgroundColor={"transparent"} style={positionLabel}>
|
|
107
|
+
<Typography
|
|
108
|
+
text={textLabelPlaceholder ?? ""}
|
|
109
|
+
size={theme.fontSizes["sm"]}
|
|
110
|
+
fontWeight="400"
|
|
111
|
+
fontFamily={theme.fonts.inter_regular_400}
|
|
112
|
+
color={theme.colors.blue[500]}
|
|
113
|
+
lineHeight={24}
|
|
114
|
+
letterSpacing={"regular"}
|
|
115
|
+
/>
|
|
116
|
+
</Box>
|
|
117
|
+
)}
|
|
118
|
+
|
|
119
|
+
{name === "password" ||
|
|
120
|
+
(name === "senha" && (
|
|
121
|
+
<Box backgroundColor={"transparent"} style={positionIconPassword}>
|
|
122
|
+
<TouchableOpacity
|
|
123
|
+
activeOpacity={0.7}
|
|
124
|
+
testID="eye-icon"
|
|
125
|
+
onPress={handlePressIsVisiblyPassword}
|
|
126
|
+
>
|
|
127
|
+
<Icons
|
|
128
|
+
size={theme.fontSizes["3xl"]}
|
|
129
|
+
color={theme.colors.blue[500]}
|
|
130
|
+
icon={isVisiblyPassword ? "EYE" : "EYE_SLASH"}
|
|
131
|
+
/>
|
|
132
|
+
</TouchableOpacity>
|
|
133
|
+
</Box>
|
|
134
|
+
))}
|
|
135
|
+
{name === "data" && (
|
|
136
|
+
<Box width={40} height={70} backgroundColor={"transparent"} style={positionIcon}>
|
|
137
|
+
<Icons
|
|
138
|
+
testID="CALENDAR"
|
|
139
|
+
size={theme.fontSizes["lg"]}
|
|
140
|
+
color={theme.colors.gray[700]}
|
|
141
|
+
icon={"CALENDAR"}
|
|
142
|
+
/>
|
|
143
|
+
</Box>
|
|
144
|
+
)}
|
|
145
|
+
{name === "hours" && (
|
|
146
|
+
<Box width={40} height={70} backgroundColor={"transparent"} style={positionIcon}>
|
|
147
|
+
<Icons size={theme.fontSizes["lg"]} color={theme.colors.gray[700]} icon={"TIMER"} />
|
|
148
|
+
</Box>
|
|
149
|
+
)}
|
|
150
|
+
{name === "litragem" && (
|
|
151
|
+
<Box width={40} height={70} backgroundColor={"transparent"} style={positionIcon}>
|
|
152
|
+
<Icons size={theme.fontSizes["lg"]} color={theme.colors.gray[700]} icon={"GAS_PUMP"} />
|
|
153
|
+
</Box>
|
|
154
|
+
)}
|
|
155
|
+
{name === "value" && (
|
|
156
|
+
<Box width={40} height={70} backgroundColor={"transparent"} style={positionIcon}>
|
|
157
|
+
<Icons size={theme.fontSizes["lg"]} color={theme.colors.gray[700]} icon={"CURRENCY"} />
|
|
158
|
+
</Box>
|
|
159
|
+
)}
|
|
160
|
+
{Boolean(messageError) && (
|
|
161
|
+
<Box width={"100%"} backgroundColor={backgroundColor}>
|
|
162
|
+
<Typography
|
|
163
|
+
text={messageError ?? ""}
|
|
164
|
+
size={theme.fontSizes["sm"]}
|
|
165
|
+
fontFamily="inter_regular_400"
|
|
166
|
+
color={theme.colors.red[900] ?? "#9F0000"}
|
|
167
|
+
lineHeight={24}
|
|
168
|
+
letterSpacing={"regular"}
|
|
169
|
+
marginTop={2}
|
|
170
|
+
/>
|
|
171
|
+
</Box>
|
|
172
|
+
)}
|
|
173
|
+
</Box>
|
|
174
|
+
);
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* EXPORTS
|
|
179
|
+
*/
|
|
180
|
+
export { Input };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IMPORTS
|
|
3
|
+
*/
|
|
4
|
+
import { type TextInputProps } from "react-native";
|
|
5
|
+
|
|
6
|
+
// typing
|
|
7
|
+
import { IGlobalCss } from "../../styles/global/interface";
|
|
8
|
+
|
|
9
|
+
interface IInputProps extends TextInputProps, IGlobalCss {
|
|
10
|
+
/**
|
|
11
|
+
* Propriedade que define se o botão estará visivel ou não a senha.
|
|
12
|
+
*/
|
|
13
|
+
handlePressIsVisiblyPassword?: () => void;
|
|
14
|
+
isVisiblyPassword?: boolean;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Propriedade que define o nome que vem no input.
|
|
18
|
+
*/
|
|
19
|
+
name: string;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Propriedade que define a label.
|
|
23
|
+
*/
|
|
24
|
+
textLabel?: string;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Propriedade que define o placeholder dentro do input
|
|
28
|
+
*/
|
|
29
|
+
textLabelPlaceholder?: string;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Propriedade que define a mensagem de erro.
|
|
33
|
+
*/
|
|
34
|
+
messageError?: string;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* A propriedade CSS de Shadow Box adiciona efeitos de sombra em torno da estrutura de um elemento. Você pode definir vários efeitos separados por vírgulas. Uma sombra de caixa é descrita por compensações x e y em relação ao elemento, borrão e raio espalhado e cor.
|
|
38
|
+
*/
|
|
39
|
+
boxShadow?: string;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* A propriedade CSS opacity define a transparência de um elemento, ou seja, o grau em que o fundo atrás do elemento é sobreposto. A propriedade aceita um valor entre 0,0 (totalmente transparente) e 1,0 (totalmente opaco).
|
|
43
|
+
*/
|
|
44
|
+
opacity?: number;
|
|
45
|
+
|
|
46
|
+
append?: {
|
|
47
|
+
appendText?: string;
|
|
48
|
+
appendColor?: string;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* EXPORT
|
|
54
|
+
*/
|
|
55
|
+
export type { IInputProps };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IMPORTS
|
|
3
|
+
*/
|
|
4
|
+
import { StyleSheet } from "react-native";
|
|
5
|
+
|
|
6
|
+
// typings
|
|
7
|
+
import { type IInputProps } from "./interface";
|
|
8
|
+
|
|
9
|
+
import { stylesGlobal } from "../../styles/global/styles";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Interface InputProps
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
const styles = (props: IInputProps) =>
|
|
16
|
+
StyleSheet.create({
|
|
17
|
+
input: { ...stylesGlobal(props), ...props } as IInputProps,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* EXPORTS
|
|
22
|
+
*/
|
|
23
|
+
export { styles };
|
|
@@ -0,0 +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 };
|
|
@@ -0,0 +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 };
|
|
@@ -0,0 +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 };
|
|
@@ -0,0 +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 };
|
|
@@ -0,0 +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 };
|
|
@@ -0,0 +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 };
|