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