vpt-sebraeds 0.0.48 → 0.0.49
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/components/SEIcon/CustomIcon/boletoDasMei.jsx +1 -1
- package/components/SEIcon/CustomIcon/calculadoraPrecoIdeal.jsx +1 -1
- package/components/SEIcon/CustomIcon/calculadoraValuation.jsx +1 -1
- package/components/SEIcon/CustomIcon/capacidadePagamento.jsx +1 -1
- package/components/SEIcon/CustomIcon/capitalGiro.jsx +1 -1
- package/components/SEIcon/CustomIcon/catalogoFornecedores.jsx +1 -1
- package/components/SEIcon/CustomIcon/creditoPermutas.jsx +1 -1
- package/components/SEIcon/CustomIcon/dataValidadeEpi.jsx +1 -1
- package/components/SEIcon/CustomIcon/diagnosticoEstrategico.jsx +1 -1
- package/components/SEIcon/CustomIcon/dominandoRedesSociais.jsx +1 -1
- package/components/SEIcon/CustomIcon/empresaGoogle.jsx +1 -1
- package/components/SEIcon/CustomIcon/fluxoCaixa.jsx +1 -1
- package/components/SEIcon/CustomIcon/fornecedoresTi.jsx +1 -1
- package/components/SEIcon/CustomIcon/geradoresIdeiasIA.jsx +1 -1
- package/components/SEIcon/CustomIcon/gestaoAgendamento.jsx +1 -1
- package/components/SEIcon/CustomIcon/impostoMei.jsx +1 -1
- package/components/SEIcon/CustomIcon/indicadoresMercado.jsx +1 -1
- package/components/SEIcon/CustomIcon/listaEpi.jsx +1 -1
- package/components/SEIcon/CustomIcon/lucroPotencial.jsx +1 -1
- package/components/SEIcon/CustomIcon/melhoresRegioesComerciais.jsx +1 -1
- package/components/SEIcon/CustomIcon/ncmComCodigoDeBarras.jsx +1 -1
- package/components/SEIcon/CustomIcon/postsInteligentes.jsx +1 -1
- package/components/SEIcon/CustomIcon/sebraeConecta.jsx +1 -1
- package/components/SEIcon/CustomIcon/segurancaTrabalho.jsx +1 -1
- package/components/SEIcon/CustomIcon/simuladorEmprestimo.jsx +1 -1
- package/components/Tools/NavigationButton/NavigationButton.stories.jsx +140 -0
- package/components/Tools/NavigationButton/index.jsx +317 -0
- package/dist/components/Tools/NavigationButton/index.d.ts +49 -0
- package/dist/components/Tools/NavigationButton/index.d.ts.map +1 -0
- package/dist/components/Tools/NavigationButton/index.js +208 -0
- package/package.json +1 -1
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, ScrollView } from 'react-native';
|
|
3
|
+
import NavigationButton from './index';
|
|
4
|
+
import SEText from '../../SEText';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'Tools/NavigationButton',
|
|
8
|
+
component: NavigationButton,
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: 'fullscreen',
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const Default = {
|
|
15
|
+
render: () => (
|
|
16
|
+
<ScrollView style={{ flex: 1, backgroundColor: '#F8F9FC' }}>
|
|
17
|
+
<View style={{ padding: 16 }}>
|
|
18
|
+
{/* Structural variants */}
|
|
19
|
+
<SEText type="ns-sm-body-bold" color="#3B5BDB" style={{ marginBottom: 16 }}>
|
|
20
|
+
Structural variants
|
|
21
|
+
</SEText>
|
|
22
|
+
|
|
23
|
+
{/* Dois botões */}
|
|
24
|
+
<NavigationButton
|
|
25
|
+
title="Tool's Name"
|
|
26
|
+
description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse et quam sit."
|
|
27
|
+
labels={[
|
|
28
|
+
{ text: 'Label', leftIcon: 'home-4-line', rightIcon: 'home-4-line' },
|
|
29
|
+
{ text: 'Label', leftIcon: 'home-4-line', rightIcon: 'home-4-line' },
|
|
30
|
+
]}
|
|
31
|
+
style={{ marginBottom: 12 }}
|
|
32
|
+
/>
|
|
33
|
+
|
|
34
|
+
{/* Um botão */}
|
|
35
|
+
<NavigationButton
|
|
36
|
+
title="Tool's Name"
|
|
37
|
+
description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse et quam sit."
|
|
38
|
+
labels={[
|
|
39
|
+
{ text: 'Label', leftIcon: 'home-4-line', rightIcon: 'home-4-line' },
|
|
40
|
+
]}
|
|
41
|
+
style={{ marginBottom: 12 }}
|
|
42
|
+
/>
|
|
43
|
+
|
|
44
|
+
{/* Sem botão */}
|
|
45
|
+
<NavigationButton
|
|
46
|
+
title="Tool's Name"
|
|
47
|
+
description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse et quam sit."
|
|
48
|
+
labels={[]}
|
|
49
|
+
style={{ marginBottom: 32 }}
|
|
50
|
+
/>
|
|
51
|
+
|
|
52
|
+
{/* Structural configurations */}
|
|
53
|
+
<SEText type="ns-sm-body-bold" color="#3B5BDB" style={{ marginBottom: 16, marginTop: 8 }}>
|
|
54
|
+
Structural configurations
|
|
55
|
+
</SEText>
|
|
56
|
+
|
|
57
|
+
{/* default status */}
|
|
58
|
+
<NavigationButton
|
|
59
|
+
title="Tool's Name"
|
|
60
|
+
description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse et quam sit."
|
|
61
|
+
labels={[
|
|
62
|
+
{ text: 'Label', leftIcon: 'home-4-line', rightIcon: 'home-4-line' },
|
|
63
|
+
{ text: 'Label', leftIcon: 'home-4-line', rightIcon: 'home-4-line' },
|
|
64
|
+
]}
|
|
65
|
+
variant="filled"
|
|
66
|
+
style={{ marginBottom: 12 }}
|
|
67
|
+
/>
|
|
68
|
+
|
|
69
|
+
{/* alert status */}
|
|
70
|
+
<NavigationButton
|
|
71
|
+
title="Tool's Name"
|
|
72
|
+
alertMessage="Lorem ipsum dolor sit amet."
|
|
73
|
+
labels={[
|
|
74
|
+
{ text: 'Label', leftIcon: 'home-4-line', rightIcon: 'home-4-line' },
|
|
75
|
+
{ text: 'Label', leftIcon: 'home-4-line', rightIcon: 'home-4-line' },
|
|
76
|
+
]}
|
|
77
|
+
variant="filled"
|
|
78
|
+
style={{ marginBottom: 12 }}
|
|
79
|
+
/>
|
|
80
|
+
|
|
81
|
+
{/* default status com info */}
|
|
82
|
+
<SEText type="ns-xs-body" color="#485274" style={{ marginTop: 16, marginBottom: 8 }}>
|
|
83
|
+
default status
|
|
84
|
+
</SEText>
|
|
85
|
+
<NavigationButton
|
|
86
|
+
title="Tool's Name"
|
|
87
|
+
description="R$ 5.021,01"
|
|
88
|
+
showValueIcon={true}
|
|
89
|
+
labels={[
|
|
90
|
+
{ text: 'Label', leftIcon: 'home-4-line', rightIcon: 'home-4-line' },
|
|
91
|
+
{ text: 'Label', leftIcon: 'home-4-line', rightIcon: 'home-4-line' },
|
|
92
|
+
]}
|
|
93
|
+
style={{ marginBottom: 12 }}
|
|
94
|
+
/>
|
|
95
|
+
|
|
96
|
+
{/* hidden content (masked) */}
|
|
97
|
+
<NavigationButton
|
|
98
|
+
title="Tool's Name"
|
|
99
|
+
maskedContent={true}
|
|
100
|
+
labels={[
|
|
101
|
+
{ text: 'Label', leftIcon: 'home-4-line', rightIcon: 'home-4-line' },
|
|
102
|
+
{ text: 'Label', leftIcon: 'home-4-line', rightIcon: 'home-4-line' },
|
|
103
|
+
]}
|
|
104
|
+
style={{ marginBottom: 12 }}
|
|
105
|
+
/>
|
|
106
|
+
|
|
107
|
+
{/* Hide content */}
|
|
108
|
+
<SEText type="ns-xs-body" color="#485274" style={{ marginTop: 16, marginBottom: 8 }}>
|
|
109
|
+
Hide content / Hidden content
|
|
110
|
+
</SEText>
|
|
111
|
+
<NavigationButton
|
|
112
|
+
title="Tool's Name"
|
|
113
|
+
hideContent={true}
|
|
114
|
+
labels={[]}
|
|
115
|
+
/>
|
|
116
|
+
|
|
117
|
+
<NavigationButton
|
|
118
|
+
title="Tool's Name"
|
|
119
|
+
maskedContent={true}
|
|
120
|
+
labels={[]}
|
|
121
|
+
/>
|
|
122
|
+
|
|
123
|
+
{/* notification message */}
|
|
124
|
+
<SEText type="ns-xs-body" color="#485274" style={{ marginTop: 16, marginBottom: 8 }}>
|
|
125
|
+
notification message
|
|
126
|
+
</SEText>
|
|
127
|
+
<NavigationButton
|
|
128
|
+
title="Tool's Name"
|
|
129
|
+
alertMessage="Lorem ipsum dolor sit amet, consectetur adipiscing elit."
|
|
130
|
+
labels={[
|
|
131
|
+
{ text: 'Label', leftIcon: 'home-4-line', rightIcon: 'home-4-line' },
|
|
132
|
+
{ text: 'Label', leftIcon: 'home-4-line', rightIcon: 'home-4-line' },
|
|
133
|
+
]}
|
|
134
|
+
variant="filled"
|
|
135
|
+
style={{ marginVertical: 8 }}
|
|
136
|
+
/>
|
|
137
|
+
</View>
|
|
138
|
+
</ScrollView>
|
|
139
|
+
),
|
|
140
|
+
};
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, StyleSheet, TouchableOpacity } from 'react-native';
|
|
3
|
+
import SEText from '../../SEText';
|
|
4
|
+
import Icon from '../../Icon';
|
|
5
|
+
import SEIcon from '../../SEIcon';
|
|
6
|
+
|
|
7
|
+
const NavigationButton = ({
|
|
8
|
+
// Conteúdo
|
|
9
|
+
title = "Tool's Name",
|
|
10
|
+
description = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
|
|
11
|
+
alertMessage = null,
|
|
12
|
+
hideContent = false,
|
|
13
|
+
maskedContent = false,
|
|
14
|
+
showValueIcon = false,
|
|
15
|
+
|
|
16
|
+
// Ícone principal
|
|
17
|
+
iconType = null,
|
|
18
|
+
iconName = 'image-line',
|
|
19
|
+
iconSize = 16,
|
|
20
|
+
iconColor = '#3B5BDB',
|
|
21
|
+
iconContainerSize = 32,
|
|
22
|
+
iconContainerRadius = 6,
|
|
23
|
+
iconContainerColor = '#E6ECFF',
|
|
24
|
+
|
|
25
|
+
// Título
|
|
26
|
+
titleType = 'ns-sm-body-bold',
|
|
27
|
+
titleColor = '#1B244B',
|
|
28
|
+
|
|
29
|
+
// Descrição
|
|
30
|
+
descriptionType = 'ns-xs-body',
|
|
31
|
+
descriptionColor = '#485274',
|
|
32
|
+
|
|
33
|
+
// Alerta
|
|
34
|
+
alertIconName = 'alert-line',
|
|
35
|
+
alertIconSize = 16,
|
|
36
|
+
alertColor = '#E53935',
|
|
37
|
+
|
|
38
|
+
// Valor com ícone
|
|
39
|
+
valueIconName = 'eye-line',
|
|
40
|
+
valueIconSize = 16,
|
|
41
|
+
valueIconColor = '#485274',
|
|
42
|
+
|
|
43
|
+
// Seta
|
|
44
|
+
showArrow = true,
|
|
45
|
+
arrowIconName = 'arrow-right-line',
|
|
46
|
+
arrowIconSize = 20,
|
|
47
|
+
arrowIconColor = '#1B244B',
|
|
48
|
+
|
|
49
|
+
// Labels
|
|
50
|
+
labels = [],
|
|
51
|
+
labelTextType = 'ns-xs-body',
|
|
52
|
+
labelTextColor = '#3B5BDB',
|
|
53
|
+
labelIconSize = 16,
|
|
54
|
+
labelIconColor = '#3B5BDB',
|
|
55
|
+
|
|
56
|
+
// Dividers
|
|
57
|
+
dividerColor = '#E2E9FC',
|
|
58
|
+
|
|
59
|
+
// Container
|
|
60
|
+
variant = 'default',
|
|
61
|
+
backgroundColor = '#FFFFFF',
|
|
62
|
+
filledBackgroundColor = '#E2E9FC',
|
|
63
|
+
borderColor = '#E2E9FC',
|
|
64
|
+
borderWidth = 1.5,
|
|
65
|
+
borderRadius = 8,
|
|
66
|
+
paddingHorizontal = 12,
|
|
67
|
+
paddingVertical = 16,
|
|
68
|
+
minHeight = 92,
|
|
69
|
+
|
|
70
|
+
// Outros
|
|
71
|
+
onPress,
|
|
72
|
+
style,
|
|
73
|
+
}) => {
|
|
74
|
+
// labels pode ser array de strings ou array de objetos { text, leftIcon, rightIcon }
|
|
75
|
+
const normalizeLabel = (label) => {
|
|
76
|
+
if (typeof label === 'string') {
|
|
77
|
+
return { text: label, leftIcon: 'home-4-line', rightIcon: 'home-4-line' };
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
text: label.text || 'Label',
|
|
81
|
+
leftIcon: label.leftIcon,
|
|
82
|
+
rightIcon: label.rightIcon,
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const isCustomIcon = iconType && iconType !== 'Remix';
|
|
87
|
+
|
|
88
|
+
const renderDescription = () => {
|
|
89
|
+
if (hideContent) {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (maskedContent) {
|
|
94
|
+
return (
|
|
95
|
+
<View style={styles.valueContainer}>
|
|
96
|
+
<Icon name={valueIconName} size={valueIconSize} color={valueIconColor} />
|
|
97
|
+
<SEText
|
|
98
|
+
type={descriptionType}
|
|
99
|
+
color={descriptionColor}
|
|
100
|
+
style={styles.valueText}
|
|
101
|
+
>
|
|
102
|
+
••••••
|
|
103
|
+
</SEText>
|
|
104
|
+
</View>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (alertMessage) {
|
|
109
|
+
return (
|
|
110
|
+
<View style={styles.alertContainer}>
|
|
111
|
+
<Icon name={alertIconName} size={alertIconSize} color={alertColor} />
|
|
112
|
+
<SEText
|
|
113
|
+
type={descriptionType}
|
|
114
|
+
color={alertColor}
|
|
115
|
+
style={styles.alertText}
|
|
116
|
+
>
|
|
117
|
+
{alertMessage}
|
|
118
|
+
</SEText>
|
|
119
|
+
</View>
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (showValueIcon) {
|
|
124
|
+
return (
|
|
125
|
+
<View style={styles.valueContainer}>
|
|
126
|
+
<Icon name={valueIconName} size={valueIconSize} color={valueIconColor} />
|
|
127
|
+
<SEText
|
|
128
|
+
type={descriptionType}
|
|
129
|
+
color={descriptionColor}
|
|
130
|
+
style={styles.valueText}
|
|
131
|
+
>
|
|
132
|
+
{description}
|
|
133
|
+
</SEText>
|
|
134
|
+
</View>
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return (
|
|
139
|
+
<SEText
|
|
140
|
+
type={descriptionType}
|
|
141
|
+
color={descriptionColor}
|
|
142
|
+
style={styles.description}
|
|
143
|
+
>
|
|
144
|
+
{description}
|
|
145
|
+
</SEText>
|
|
146
|
+
);
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
const renderLabels = () => {
|
|
150
|
+
if (labels.length === 0) return null;
|
|
151
|
+
|
|
152
|
+
const labelsDividerStyle = {
|
|
153
|
+
height: 1,
|
|
154
|
+
backgroundColor: dividerColor,
|
|
155
|
+
marginTop: 12,
|
|
156
|
+
marginLeft: -(iconContainerSize + 16),
|
|
157
|
+
marginRight: -24,
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
const labelsContainerStyle = {
|
|
161
|
+
flexDirection: 'row',
|
|
162
|
+
marginLeft: -(iconContainerSize + 16 + paddingHorizontal),
|
|
163
|
+
marginRight: -(paddingHorizontal + 12 + arrowIconSize),
|
|
164
|
+
marginBottom: -paddingVertical,
|
|
165
|
+
paddingBottom: 12,
|
|
166
|
+
backgroundColor: '#FFFFFF',
|
|
167
|
+
borderBottomLeftRadius: borderRadius,
|
|
168
|
+
borderBottomRightRadius: borderRadius,
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
const labelVerticalDividerStyle = {
|
|
172
|
+
width: 1,
|
|
173
|
+
backgroundColor: dividerColor,
|
|
174
|
+
marginTop: 8,
|
|
175
|
+
marginBottom: 0,
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
return (
|
|
179
|
+
<>
|
|
180
|
+
<View style={labelsDividerStyle} />
|
|
181
|
+
<View style={labelsContainerStyle}>
|
|
182
|
+
{labels.map((label, index) => {
|
|
183
|
+
const normalizedLabel = normalizeLabel(label);
|
|
184
|
+
return (
|
|
185
|
+
<React.Fragment key={index}>
|
|
186
|
+
{index > 0 && <View style={labelVerticalDividerStyle} />}
|
|
187
|
+
<View style={styles.labelButton}>
|
|
188
|
+
{normalizedLabel.leftIcon && (
|
|
189
|
+
<Icon name={normalizedLabel.leftIcon} size={labelIconSize} color={labelIconColor} />
|
|
190
|
+
)}
|
|
191
|
+
<SEText type={labelTextType} color={labelTextColor} style={styles.labelText}>
|
|
192
|
+
{normalizedLabel.text}
|
|
193
|
+
</SEText>
|
|
194
|
+
{normalizedLabel.rightIcon && (
|
|
195
|
+
<Icon name={normalizedLabel.rightIcon} size={labelIconSize} color={labelIconColor} style={{ marginLeft: 4 }} />
|
|
196
|
+
)}
|
|
197
|
+
</View>
|
|
198
|
+
</React.Fragment>
|
|
199
|
+
);
|
|
200
|
+
})}
|
|
201
|
+
</View>
|
|
202
|
+
</>
|
|
203
|
+
);
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
const containerStyle = {
|
|
207
|
+
flexDirection: 'row',
|
|
208
|
+
alignItems: 'flex-start',
|
|
209
|
+
backgroundColor: variant === 'filled' ? filledBackgroundColor : backgroundColor,
|
|
210
|
+
paddingHorizontal,
|
|
211
|
+
paddingVertical,
|
|
212
|
+
minHeight,
|
|
213
|
+
width: '100%',
|
|
214
|
+
borderWidth: variant === 'filled' ? 0 : borderWidth,
|
|
215
|
+
borderColor,
|
|
216
|
+
borderRadius,
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
const iconContainerStyle = {
|
|
220
|
+
marginRight: 16,
|
|
221
|
+
justifyContent: 'flex-start',
|
|
222
|
+
alignItems: 'center',
|
|
223
|
+
width: iconContainerSize,
|
|
224
|
+
height: iconContainerSize,
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
const iconPlaceholderStyle = {
|
|
228
|
+
width: iconContainerSize,
|
|
229
|
+
height: iconContainerSize,
|
|
230
|
+
borderRadius: iconContainerRadius,
|
|
231
|
+
backgroundColor: iconContainerColor,
|
|
232
|
+
justifyContent: 'center',
|
|
233
|
+
alignItems: 'center',
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
return (
|
|
237
|
+
<TouchableOpacity
|
|
238
|
+
style={[containerStyle, style]}
|
|
239
|
+
onPress={onPress}
|
|
240
|
+
activeOpacity={0.7}
|
|
241
|
+
>
|
|
242
|
+
<View style={iconContainerStyle}>
|
|
243
|
+
{isCustomIcon ? (
|
|
244
|
+
<SEIcon type={iconType} size={iconContainerSize} />
|
|
245
|
+
) : (
|
|
246
|
+
<View style={iconPlaceholderStyle}>
|
|
247
|
+
<Icon name={iconName} size={iconSize} color={iconColor} />
|
|
248
|
+
</View>
|
|
249
|
+
)}
|
|
250
|
+
</View>
|
|
251
|
+
|
|
252
|
+
<View style={styles.contentContainer}>
|
|
253
|
+
<SEText
|
|
254
|
+
type={titleType}
|
|
255
|
+
color={titleColor}
|
|
256
|
+
style={styles.title}
|
|
257
|
+
>
|
|
258
|
+
{title}
|
|
259
|
+
</SEText>
|
|
260
|
+
{renderDescription()}
|
|
261
|
+
{renderLabels()}
|
|
262
|
+
</View>
|
|
263
|
+
|
|
264
|
+
{showArrow && (
|
|
265
|
+
<View style={styles.arrowContainer}>
|
|
266
|
+
<Icon name={arrowIconName} size={arrowIconSize} color={arrowIconColor} />
|
|
267
|
+
</View>
|
|
268
|
+
)}
|
|
269
|
+
</TouchableOpacity>
|
|
270
|
+
);
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
const styles = StyleSheet.create({
|
|
274
|
+
contentContainer: {
|
|
275
|
+
flex: 1,
|
|
276
|
+
justifyContent: 'flex-start',
|
|
277
|
+
},
|
|
278
|
+
title: {
|
|
279
|
+
marginBottom: 4,
|
|
280
|
+
},
|
|
281
|
+
description: {
|
|
282
|
+
lineHeight: 20,
|
|
283
|
+
},
|
|
284
|
+
alertContainer: {
|
|
285
|
+
flexDirection: 'row',
|
|
286
|
+
alignItems: 'center',
|
|
287
|
+
},
|
|
288
|
+
alertText: {
|
|
289
|
+
marginLeft: 4,
|
|
290
|
+
},
|
|
291
|
+
valueContainer: {
|
|
292
|
+
flexDirection: 'row',
|
|
293
|
+
alignItems: 'center',
|
|
294
|
+
},
|
|
295
|
+
valueText: {
|
|
296
|
+
marginLeft: 4,
|
|
297
|
+
},
|
|
298
|
+
labelButton: {
|
|
299
|
+
flex: 1,
|
|
300
|
+
flexDirection: 'row',
|
|
301
|
+
alignItems: 'center',
|
|
302
|
+
justifyContent: 'center',
|
|
303
|
+
paddingTop: 16,
|
|
304
|
+
paddingBottom: 4,
|
|
305
|
+
},
|
|
306
|
+
labelText: {
|
|
307
|
+
marginLeft: 4,
|
|
308
|
+
},
|
|
309
|
+
arrowContainer: {
|
|
310
|
+
marginLeft: 12,
|
|
311
|
+
justifyContent: 'flex-start',
|
|
312
|
+
alignItems: 'center',
|
|
313
|
+
paddingTop: 2,
|
|
314
|
+
},
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
export default NavigationButton;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export default NavigationButton;
|
|
2
|
+
declare function NavigationButton({ title, description, alertMessage, hideContent, maskedContent, showValueIcon, iconType, iconName, iconSize, iconColor, iconContainerSize, iconContainerRadius, iconContainerColor, titleType, titleColor, descriptionType, descriptionColor, alertIconName, alertIconSize, alertColor, valueIconName, valueIconSize, valueIconColor, showArrow, arrowIconName, arrowIconSize, arrowIconColor, labels, labelTextType, labelTextColor, labelIconSize, labelIconColor, dividerColor, variant, backgroundColor, filledBackgroundColor, borderColor, borderWidth, borderRadius, paddingHorizontal, paddingVertical, minHeight, onPress, style, }: {
|
|
3
|
+
title?: string | undefined;
|
|
4
|
+
description?: string | undefined;
|
|
5
|
+
alertMessage?: null | undefined;
|
|
6
|
+
hideContent?: boolean | undefined;
|
|
7
|
+
maskedContent?: boolean | undefined;
|
|
8
|
+
showValueIcon?: boolean | undefined;
|
|
9
|
+
iconType?: null | undefined;
|
|
10
|
+
iconName?: string | undefined;
|
|
11
|
+
iconSize?: number | undefined;
|
|
12
|
+
iconColor?: string | undefined;
|
|
13
|
+
iconContainerSize?: number | undefined;
|
|
14
|
+
iconContainerRadius?: number | undefined;
|
|
15
|
+
iconContainerColor?: string | undefined;
|
|
16
|
+
titleType?: string | undefined;
|
|
17
|
+
titleColor?: string | undefined;
|
|
18
|
+
descriptionType?: string | undefined;
|
|
19
|
+
descriptionColor?: string | undefined;
|
|
20
|
+
alertIconName?: string | undefined;
|
|
21
|
+
alertIconSize?: number | undefined;
|
|
22
|
+
alertColor?: string | undefined;
|
|
23
|
+
valueIconName?: string | undefined;
|
|
24
|
+
valueIconSize?: number | undefined;
|
|
25
|
+
valueIconColor?: string | undefined;
|
|
26
|
+
showArrow?: boolean | undefined;
|
|
27
|
+
arrowIconName?: string | undefined;
|
|
28
|
+
arrowIconSize?: number | undefined;
|
|
29
|
+
arrowIconColor?: string | undefined;
|
|
30
|
+
labels?: never[] | undefined;
|
|
31
|
+
labelTextType?: string | undefined;
|
|
32
|
+
labelTextColor?: string | undefined;
|
|
33
|
+
labelIconSize?: number | undefined;
|
|
34
|
+
labelIconColor?: string | undefined;
|
|
35
|
+
dividerColor?: string | undefined;
|
|
36
|
+
variant?: string | undefined;
|
|
37
|
+
backgroundColor?: string | undefined;
|
|
38
|
+
filledBackgroundColor?: string | undefined;
|
|
39
|
+
borderColor?: string | undefined;
|
|
40
|
+
borderWidth?: number | undefined;
|
|
41
|
+
borderRadius?: number | undefined;
|
|
42
|
+
paddingHorizontal?: number | undefined;
|
|
43
|
+
paddingVertical?: number | undefined;
|
|
44
|
+
minHeight?: number | undefined;
|
|
45
|
+
onPress: any;
|
|
46
|
+
style: any;
|
|
47
|
+
}): React.JSX.Element;
|
|
48
|
+
import React from 'react';
|
|
49
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/Tools/NavigationButton/index.jsx"],"names":[],"mappings":";AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAwQC;kBA9QiB,OAAO"}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, StyleSheet, TouchableOpacity } from 'react-native';
|
|
3
|
+
import SEText from '../../SEText';
|
|
4
|
+
import Icon from '../../Icon';
|
|
5
|
+
import SEIcon from '../../SEIcon';
|
|
6
|
+
const NavigationButton = ({
|
|
7
|
+
// Conteúdo
|
|
8
|
+
title = "Tool's Name", description = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.', alertMessage = null, hideContent = false, maskedContent = false, showValueIcon = false,
|
|
9
|
+
// Ícone principal
|
|
10
|
+
iconType = null, iconName = 'image-line', iconSize = 16, iconColor = '#3B5BDB', iconContainerSize = 32, iconContainerRadius = 6, iconContainerColor = '#E6ECFF',
|
|
11
|
+
// Título
|
|
12
|
+
titleType = 'ns-sm-body-bold', titleColor = '#1B244B',
|
|
13
|
+
// Descrição
|
|
14
|
+
descriptionType = 'ns-xs-body', descriptionColor = '#485274',
|
|
15
|
+
// Alerta
|
|
16
|
+
alertIconName = 'alert-line', alertIconSize = 16, alertColor = '#E53935',
|
|
17
|
+
// Valor com ícone
|
|
18
|
+
valueIconName = 'eye-line', valueIconSize = 16, valueIconColor = '#485274',
|
|
19
|
+
// Seta
|
|
20
|
+
showArrow = true, arrowIconName = 'arrow-right-line', arrowIconSize = 20, arrowIconColor = '#1B244B',
|
|
21
|
+
// Labels
|
|
22
|
+
labels = [], labelTextType = 'ns-xs-body', labelTextColor = '#3B5BDB', labelIconSize = 16, labelIconColor = '#3B5BDB',
|
|
23
|
+
// Dividers
|
|
24
|
+
dividerColor = '#E2E9FC',
|
|
25
|
+
// Container
|
|
26
|
+
variant = 'default', backgroundColor = '#FFFFFF', filledBackgroundColor = '#E2E9FC', borderColor = '#E2E9FC', borderWidth = 1.5, borderRadius = 8, paddingHorizontal = 12, paddingVertical = 16, minHeight = 92,
|
|
27
|
+
// Outros
|
|
28
|
+
onPress, style, }) => {
|
|
29
|
+
// labels pode ser array de strings ou array de objetos { text, leftIcon, rightIcon }
|
|
30
|
+
const normalizeLabel = (label) => {
|
|
31
|
+
if (typeof label === 'string') {
|
|
32
|
+
return { text: label, leftIcon: 'home-4-line', rightIcon: 'home-4-line' };
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
text: label.text || 'Label',
|
|
36
|
+
leftIcon: label.leftIcon,
|
|
37
|
+
rightIcon: label.rightIcon,
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
const isCustomIcon = iconType && iconType !== 'Remix';
|
|
41
|
+
const renderDescription = () => {
|
|
42
|
+
if (hideContent) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
if (maskedContent) {
|
|
46
|
+
return (<View style={styles.valueContainer}>
|
|
47
|
+
<Icon name={valueIconName} size={valueIconSize} color={valueIconColor}/>
|
|
48
|
+
<SEText type={descriptionType} color={descriptionColor} style={styles.valueText}>
|
|
49
|
+
••••••
|
|
50
|
+
</SEText>
|
|
51
|
+
</View>);
|
|
52
|
+
}
|
|
53
|
+
if (alertMessage) {
|
|
54
|
+
return (<View style={styles.alertContainer}>
|
|
55
|
+
<Icon name={alertIconName} size={alertIconSize} color={alertColor}/>
|
|
56
|
+
<SEText type={descriptionType} color={alertColor} style={styles.alertText}>
|
|
57
|
+
{alertMessage}
|
|
58
|
+
</SEText>
|
|
59
|
+
</View>);
|
|
60
|
+
}
|
|
61
|
+
if (showValueIcon) {
|
|
62
|
+
return (<View style={styles.valueContainer}>
|
|
63
|
+
<Icon name={valueIconName} size={valueIconSize} color={valueIconColor}/>
|
|
64
|
+
<SEText type={descriptionType} color={descriptionColor} style={styles.valueText}>
|
|
65
|
+
{description}
|
|
66
|
+
</SEText>
|
|
67
|
+
</View>);
|
|
68
|
+
}
|
|
69
|
+
return (<SEText type={descriptionType} color={descriptionColor} style={styles.description}>
|
|
70
|
+
{description}
|
|
71
|
+
</SEText>);
|
|
72
|
+
};
|
|
73
|
+
const renderLabels = () => {
|
|
74
|
+
if (labels.length === 0)
|
|
75
|
+
return null;
|
|
76
|
+
const labelsDividerStyle = {
|
|
77
|
+
height: 1,
|
|
78
|
+
backgroundColor: dividerColor,
|
|
79
|
+
marginTop: 12,
|
|
80
|
+
marginLeft: -(iconContainerSize + 16),
|
|
81
|
+
marginRight: -24,
|
|
82
|
+
};
|
|
83
|
+
const labelsContainerStyle = {
|
|
84
|
+
flexDirection: 'row',
|
|
85
|
+
marginLeft: -(iconContainerSize + 16 + paddingHorizontal),
|
|
86
|
+
marginRight: -(paddingHorizontal + 12 + arrowIconSize),
|
|
87
|
+
marginBottom: -paddingVertical,
|
|
88
|
+
paddingBottom: 12,
|
|
89
|
+
backgroundColor: '#FFFFFF',
|
|
90
|
+
borderBottomLeftRadius: borderRadius,
|
|
91
|
+
borderBottomRightRadius: borderRadius,
|
|
92
|
+
};
|
|
93
|
+
const labelVerticalDividerStyle = {
|
|
94
|
+
width: 1,
|
|
95
|
+
backgroundColor: dividerColor,
|
|
96
|
+
marginTop: 8,
|
|
97
|
+
marginBottom: 0,
|
|
98
|
+
};
|
|
99
|
+
return (<>
|
|
100
|
+
<View style={labelsDividerStyle}/>
|
|
101
|
+
<View style={labelsContainerStyle}>
|
|
102
|
+
{labels.map((label, index) => {
|
|
103
|
+
const normalizedLabel = normalizeLabel(label);
|
|
104
|
+
return (<React.Fragment key={index}>
|
|
105
|
+
{index > 0 && <View style={labelVerticalDividerStyle}/>}
|
|
106
|
+
<View style={styles.labelButton}>
|
|
107
|
+
{normalizedLabel.leftIcon && (<Icon name={normalizedLabel.leftIcon} size={labelIconSize} color={labelIconColor}/>)}
|
|
108
|
+
<SEText type={labelTextType} color={labelTextColor} style={styles.labelText}>
|
|
109
|
+
{normalizedLabel.text}
|
|
110
|
+
</SEText>
|
|
111
|
+
{normalizedLabel.rightIcon && (<Icon name={normalizedLabel.rightIcon} size={labelIconSize} color={labelIconColor} style={{ marginLeft: 4 }}/>)}
|
|
112
|
+
</View>
|
|
113
|
+
</React.Fragment>);
|
|
114
|
+
})}
|
|
115
|
+
</View>
|
|
116
|
+
</>);
|
|
117
|
+
};
|
|
118
|
+
const containerStyle = {
|
|
119
|
+
flexDirection: 'row',
|
|
120
|
+
alignItems: 'flex-start',
|
|
121
|
+
backgroundColor: variant === 'filled' ? filledBackgroundColor : backgroundColor,
|
|
122
|
+
paddingHorizontal,
|
|
123
|
+
paddingVertical,
|
|
124
|
+
minHeight,
|
|
125
|
+
width: '100%',
|
|
126
|
+
borderWidth: variant === 'filled' ? 0 : borderWidth,
|
|
127
|
+
borderColor,
|
|
128
|
+
borderRadius,
|
|
129
|
+
};
|
|
130
|
+
const iconContainerStyle = {
|
|
131
|
+
marginRight: 16,
|
|
132
|
+
justifyContent: 'flex-start',
|
|
133
|
+
alignItems: 'center',
|
|
134
|
+
width: iconContainerSize,
|
|
135
|
+
height: iconContainerSize,
|
|
136
|
+
};
|
|
137
|
+
const iconPlaceholderStyle = {
|
|
138
|
+
width: iconContainerSize,
|
|
139
|
+
height: iconContainerSize,
|
|
140
|
+
borderRadius: iconContainerRadius,
|
|
141
|
+
backgroundColor: iconContainerColor,
|
|
142
|
+
justifyContent: 'center',
|
|
143
|
+
alignItems: 'center',
|
|
144
|
+
};
|
|
145
|
+
return (<TouchableOpacity style={[containerStyle, style]} onPress={onPress} activeOpacity={0.7}>
|
|
146
|
+
<View style={iconContainerStyle}>
|
|
147
|
+
{isCustomIcon ? (<SEIcon type={iconType} size={iconContainerSize}/>) : (<View style={iconPlaceholderStyle}>
|
|
148
|
+
<Icon name={iconName} size={iconSize} color={iconColor}/>
|
|
149
|
+
</View>)}
|
|
150
|
+
</View>
|
|
151
|
+
|
|
152
|
+
<View style={styles.contentContainer}>
|
|
153
|
+
<SEText type={titleType} color={titleColor} style={styles.title}>
|
|
154
|
+
{title}
|
|
155
|
+
</SEText>
|
|
156
|
+
{renderDescription()}
|
|
157
|
+
{renderLabels()}
|
|
158
|
+
</View>
|
|
159
|
+
|
|
160
|
+
{showArrow && (<View style={styles.arrowContainer}>
|
|
161
|
+
<Icon name={arrowIconName} size={arrowIconSize} color={arrowIconColor}/>
|
|
162
|
+
</View>)}
|
|
163
|
+
</TouchableOpacity>);
|
|
164
|
+
};
|
|
165
|
+
const styles = StyleSheet.create({
|
|
166
|
+
contentContainer: {
|
|
167
|
+
flex: 1,
|
|
168
|
+
justifyContent: 'flex-start',
|
|
169
|
+
},
|
|
170
|
+
title: {
|
|
171
|
+
marginBottom: 4,
|
|
172
|
+
},
|
|
173
|
+
description: {
|
|
174
|
+
lineHeight: 20,
|
|
175
|
+
},
|
|
176
|
+
alertContainer: {
|
|
177
|
+
flexDirection: 'row',
|
|
178
|
+
alignItems: 'center',
|
|
179
|
+
},
|
|
180
|
+
alertText: {
|
|
181
|
+
marginLeft: 4,
|
|
182
|
+
},
|
|
183
|
+
valueContainer: {
|
|
184
|
+
flexDirection: 'row',
|
|
185
|
+
alignItems: 'center',
|
|
186
|
+
},
|
|
187
|
+
valueText: {
|
|
188
|
+
marginLeft: 4,
|
|
189
|
+
},
|
|
190
|
+
labelButton: {
|
|
191
|
+
flex: 1,
|
|
192
|
+
flexDirection: 'row',
|
|
193
|
+
alignItems: 'center',
|
|
194
|
+
justifyContent: 'center',
|
|
195
|
+
paddingTop: 16,
|
|
196
|
+
paddingBottom: 4,
|
|
197
|
+
},
|
|
198
|
+
labelText: {
|
|
199
|
+
marginLeft: 4,
|
|
200
|
+
},
|
|
201
|
+
arrowContainer: {
|
|
202
|
+
marginLeft: 12,
|
|
203
|
+
justifyContent: 'flex-start',
|
|
204
|
+
alignItems: 'center',
|
|
205
|
+
paddingTop: 2,
|
|
206
|
+
},
|
|
207
|
+
});
|
|
208
|
+
export default NavigationButton;
|