vpt-sebraeds 0.0.46 → 0.0.48
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/FilterableMultiSelect/index.jsx +89 -133
- 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/SearchResult/SearchResult.stories.jsx +118 -0
- package/components/Tools/SearchResult/index.jsx +114 -0
- package/dist/components/FilterableMultiSelect/index.d.ts.map +1 -1
- package/dist/components/FilterableMultiSelect/index.js +67 -95
- package/dist/components/Tools/SearchResult/index.d.ts +13 -0
- package/dist/components/Tools/SearchResult/index.d.ts.map +1 -0
- package/dist/components/Tools/SearchResult/index.js +81 -0
- package/package.json +1 -1
|
@@ -1,31 +1,19 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import React, { useState, useRef } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
TextInput,
|
|
5
|
+
StyleSheet,
|
|
6
|
+
TouchableOpacity,
|
|
7
|
+
Platform,
|
|
8
|
+
Keyboard,
|
|
9
|
+
TouchableWithoutFeedback
|
|
10
|
+
} from 'react-native';
|
|
4
11
|
import Icon from '../Icon';
|
|
5
|
-
import ScrollBar from '../ScrollBar';
|
|
6
12
|
import SEText from '../SEText';
|
|
13
|
+
import ScrollBar from '../ScrollBar';
|
|
14
|
+
import { set } from 'lodash';
|
|
7
15
|
|
|
8
16
|
const CustomCheckbox = ({ selected, iconColor, size = 21 }) => {
|
|
9
|
-
if (selected) {
|
|
10
|
-
return (
|
|
11
|
-
<View style={{
|
|
12
|
-
width: size,
|
|
13
|
-
height: size,
|
|
14
|
-
borderWidth: 1.5,
|
|
15
|
-
borderColor: iconColor,
|
|
16
|
-
borderRadius: 4,
|
|
17
|
-
backgroundColor: iconColor,
|
|
18
|
-
alignItems: 'center',
|
|
19
|
-
justifyContent: 'center',
|
|
20
|
-
}}>
|
|
21
|
-
<Icon
|
|
22
|
-
name="check-line"
|
|
23
|
-
size={size - 8}
|
|
24
|
-
color="#FFFFFF"
|
|
25
|
-
/>
|
|
26
|
-
</View>
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
17
|
return (
|
|
30
18
|
<View style={{
|
|
31
19
|
width: size,
|
|
@@ -33,8 +21,12 @@ const CustomCheckbox = ({ selected, iconColor, size = 21 }) => {
|
|
|
33
21
|
borderWidth: 1.5,
|
|
34
22
|
borderColor: iconColor,
|
|
35
23
|
borderRadius: 4,
|
|
36
|
-
backgroundColor: 'transparent',
|
|
37
|
-
|
|
24
|
+
backgroundColor: selected ? iconColor : 'transparent',
|
|
25
|
+
alignItems: 'center',
|
|
26
|
+
justifyContent: 'center',
|
|
27
|
+
}}>
|
|
28
|
+
{selected && <Icon name="check-line" size={size - 8} color="#FFFFFF" />}
|
|
29
|
+
</View>
|
|
38
30
|
);
|
|
39
31
|
};
|
|
40
32
|
|
|
@@ -48,6 +40,10 @@ const FilterableMultiSelect = ({
|
|
|
48
40
|
}) => {
|
|
49
41
|
const [search, setSearch] = useState(searchedValue);
|
|
50
42
|
const [isFocused, setIsFocused] = useState(false);
|
|
43
|
+
const [onPressIn, setOnPressIn] = useState(false);
|
|
44
|
+
|
|
45
|
+
// 1. Criamos uma referência para o input
|
|
46
|
+
const inputRef = useRef(null);
|
|
51
47
|
|
|
52
48
|
const handleSearch = (value) => {
|
|
53
49
|
setSearch(value);
|
|
@@ -59,31 +55,35 @@ const FilterableMultiSelect = ({
|
|
|
59
55
|
onSearch('');
|
|
60
56
|
};
|
|
61
57
|
|
|
62
|
-
|
|
58
|
+
// 2. Função para fechar o teclado e tirar o foco
|
|
59
|
+
const dismissAll = () => {
|
|
60
|
+
Keyboard.dismiss();
|
|
61
|
+
inputRef.current?.blur();
|
|
62
|
+
};
|
|
63
63
|
|
|
64
|
-
// Filtrar opções baseado na busca
|
|
65
64
|
const filteredOptions = options.filter(option =>
|
|
66
65
|
option.label.toLowerCase().includes(search.toLowerCase())
|
|
67
66
|
);
|
|
68
67
|
|
|
69
68
|
return (
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
/* 3. O TouchableWithoutFeedback aqui garante que o clique fora feche o teclado */
|
|
70
|
+
<TouchableWithoutFeedback onPress={dismissAll}>
|
|
71
|
+
<View style={styles.container}>
|
|
72
72
|
<View style={[
|
|
73
73
|
styles.inputWrapper,
|
|
74
|
-
|
|
74
|
+
isFocused && styles.inputWrapperActive,
|
|
75
|
+
onPressIn && styles.inputOnpressIn
|
|
75
76
|
]}>
|
|
76
77
|
<View style={styles.searchIconWrapper}>
|
|
77
|
-
<Icon
|
|
78
|
-
name="search-line"
|
|
79
|
-
size={16}
|
|
80
|
-
color="#687499"
|
|
81
|
-
/>
|
|
78
|
+
<Icon name="search-line" size={16} color="#687499" />
|
|
82
79
|
</View>
|
|
83
80
|
<TextInput
|
|
84
|
-
|
|
81
|
+
ref={inputRef} // Atribuindo a ref
|
|
82
|
+
style={[styles.input, search.length > 0 && styles.inputActive]}
|
|
85
83
|
value={search}
|
|
86
84
|
onChangeText={handleSearch}
|
|
85
|
+
onPressIn={()=> setOnPressIn(true)}
|
|
86
|
+
onPressOut={()=> setOnPressIn(false)}
|
|
87
87
|
onFocus={() => setIsFocused(true)}
|
|
88
88
|
onBlur={() => setIsFocused(false)}
|
|
89
89
|
placeholder={placeholder}
|
|
@@ -91,53 +91,32 @@ const FilterableMultiSelect = ({
|
|
|
91
91
|
cursorColor="#1B244B"
|
|
92
92
|
autoCorrect={false}
|
|
93
93
|
underlineColorAndroid="transparent"
|
|
94
|
+
returnKeyType="done" // Muda o botão do teclado para "Concluído"
|
|
95
|
+
onSubmitEditing={dismissAll} // CORREÇÃO: Fecha o teclado no botão circulado
|
|
94
96
|
/>
|
|
95
|
-
{
|
|
96
|
-
<TouchableOpacity
|
|
97
|
-
|
|
98
|
-
style={styles.clearIconWrapper}
|
|
99
|
-
>
|
|
100
|
-
<Icon
|
|
101
|
-
name="close-line"
|
|
102
|
-
size={14}
|
|
103
|
-
color="#2A4FDA"
|
|
104
|
-
/>
|
|
97
|
+
{search.length > 0 && (
|
|
98
|
+
<TouchableOpacity onPress={handleClear} style={styles.clearIconWrapper}>
|
|
99
|
+
<Icon name="close-line" size={14} color="#2A4FDA" />
|
|
105
100
|
</TouchableOpacity>
|
|
106
101
|
)}
|
|
107
102
|
</View>
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
{
|
|
116
|
-
|
|
117
|
-
<
|
|
118
|
-
type="ns-sm-body-bold"
|
|
119
|
-
style={styles.
|
|
120
|
-
>
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
<SEText
|
|
124
|
-
type="ns-sm-body"
|
|
125
|
-
style={styles.emptySubtitle}
|
|
126
|
-
>
|
|
127
|
-
Escreva palavras diferentes
|
|
128
|
-
</SEText>
|
|
129
|
-
</View>
|
|
130
|
-
) : (
|
|
131
|
-
filteredOptions.map((option, idx) => (
|
|
132
|
-
<View
|
|
133
|
-
key={option.value}
|
|
134
|
-
style={{
|
|
135
|
-
width: '100%',
|
|
136
|
-
// Adiciona marginBottom apenas se não for o último item
|
|
137
|
-
marginBottom: idx === filteredOptions.length - 1 ? 0 : 8,
|
|
138
|
-
}}
|
|
139
|
-
>
|
|
103
|
+
|
|
104
|
+
<ScrollBar
|
|
105
|
+
style={styles.scroll}
|
|
106
|
+
barColor="#C9D5FF"
|
|
107
|
+
barThickness={6}
|
|
108
|
+
>
|
|
109
|
+
{/* 4. View de conteúdo com paddingBottom para não colar no teclado */}
|
|
110
|
+
<View style={{ paddingRight: 5, paddingBottom: 20 }}>
|
|
111
|
+
{filteredOptions.length === 0 ? (
|
|
112
|
+
<View style={styles.emptyContainer}>
|
|
113
|
+
<SEText type="ns-sm-body-bold" style={styles.emptyTitle}>Nenhum resultado</SEText>
|
|
114
|
+
<SEText type="ns-sm-body" style={styles.emptySubtitle}>Escreva palavras diferentes</SEText>
|
|
115
|
+
</View>
|
|
116
|
+
) : (
|
|
117
|
+
filteredOptions.map((option, idx) => (
|
|
140
118
|
<TouchableOpacity
|
|
119
|
+
key={option.value}
|
|
141
120
|
style={{
|
|
142
121
|
flexDirection: 'row',
|
|
143
122
|
alignItems: 'center',
|
|
@@ -148,13 +127,17 @@ const FilterableMultiSelect = ({
|
|
|
148
127
|
borderColor: selected.includes(option.value) ? '#2A4FDA' : '#E2E9FC',
|
|
149
128
|
backgroundColor: selected.includes(option.value) ? '#E3E9FF' : '#FFFFFF',
|
|
150
129
|
paddingHorizontal: 16,
|
|
130
|
+
marginBottom: 8,
|
|
131
|
+
}}
|
|
132
|
+
onPress={() => {
|
|
133
|
+
// 5. Opcional: Se quiser que o teclado feche ao selecionar
|
|
134
|
+
// dismissAll();
|
|
135
|
+
onSelect(option.value);
|
|
151
136
|
}}
|
|
152
|
-
disabled={option.disabled}
|
|
153
|
-
onPress={() => onSelect(option.value)}
|
|
154
137
|
>
|
|
155
138
|
<CustomCheckbox
|
|
156
139
|
selected={selected.includes(option.value)}
|
|
157
|
-
iconColor={
|
|
140
|
+
iconColor={'#2A4FDA'}
|
|
158
141
|
size={20}
|
|
159
142
|
/>
|
|
160
143
|
<SEText
|
|
@@ -167,86 +150,59 @@ const FilterableMultiSelect = ({
|
|
|
167
150
|
{option.label}
|
|
168
151
|
</SEText>
|
|
169
152
|
</TouchableOpacity>
|
|
170
|
-
|
|
171
|
-
)
|
|
172
|
-
|
|
173
|
-
</
|
|
174
|
-
</
|
|
175
|
-
</
|
|
153
|
+
))
|
|
154
|
+
)}
|
|
155
|
+
</View>
|
|
156
|
+
</ScrollBar>
|
|
157
|
+
</View>
|
|
158
|
+
</TouchableWithoutFeedback>
|
|
176
159
|
);
|
|
177
160
|
};
|
|
178
161
|
|
|
179
162
|
const styles = StyleSheet.create({
|
|
180
163
|
container: {
|
|
164
|
+
flex: 1,
|
|
181
165
|
width: '100%',
|
|
182
|
-
alignSelf: 'center',
|
|
183
166
|
backgroundColor: '#fff',
|
|
184
|
-
borderRadius: 8,
|
|
185
|
-
padding: 0,
|
|
186
|
-
flex: 1,
|
|
187
167
|
},
|
|
188
168
|
inputWrapper: {
|
|
189
|
-
position: 'relative',
|
|
190
169
|
flexDirection: 'row',
|
|
191
170
|
alignItems: 'center',
|
|
192
171
|
borderRadius: 8,
|
|
193
|
-
borderWidth:
|
|
194
|
-
borderColor: '#
|
|
172
|
+
borderWidth: 2,
|
|
173
|
+
borderColor: '#96ACFF',
|
|
195
174
|
marginBottom: 24,
|
|
196
175
|
height: 49,
|
|
197
176
|
backgroundColor: '#FFFFFF',
|
|
198
177
|
},
|
|
199
178
|
inputWrapperActive: {
|
|
179
|
+
borderWidth: 2,
|
|
200
180
|
borderColor: '#2A4FDA',
|
|
181
|
+
outlineColor: '#96ACFF',
|
|
182
|
+
outlineWidth: 3,
|
|
201
183
|
},
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
},
|
|
206
|
-
clearIconWrapper: {
|
|
207
|
-
position: 'absolute',
|
|
208
|
-
right: 16,
|
|
209
|
-
top: 17,
|
|
184
|
+
inputOnpressIn:{
|
|
185
|
+
borderWidth: 2,
|
|
186
|
+
borderColor: '#2A4FDA',
|
|
210
187
|
},
|
|
188
|
+
searchIconWrapper: { paddingLeft: 16 },
|
|
189
|
+
clearIconWrapper: { position: 'absolute', right: 16 },
|
|
211
190
|
input: {
|
|
212
191
|
flex: 1,
|
|
213
192
|
height: '100%',
|
|
214
193
|
paddingHorizontal: 12,
|
|
215
|
-
|
|
194
|
+
fontSize: 16,
|
|
195
|
+
color: '#687499',
|
|
216
196
|
...Platform.select({
|
|
217
197
|
ios: { fontFamily: 'Nunito Sans 10pt Regular' },
|
|
218
198
|
android: { fontFamily: 'NunitoSans_10pt-Regular' },
|
|
219
199
|
}),
|
|
220
|
-
fontSize: 16,
|
|
221
|
-
lineHeight: 24,
|
|
222
|
-
letterSpacing: 0,
|
|
223
|
-
color: '#687499',
|
|
224
|
-
backgroundColor: 'transparent',
|
|
225
|
-
},
|
|
226
|
-
inputActive: {
|
|
227
|
-
color: '#1B244B',
|
|
228
|
-
},
|
|
229
|
-
scroll: {
|
|
230
|
-
zIndex : 1,
|
|
231
|
-
paddingTop: 0,
|
|
232
|
-
flex: 1,
|
|
233
|
-
minHeight: 0,
|
|
234
|
-
paddingRight: 5,
|
|
235
|
-
},
|
|
236
|
-
emptyContainer: {
|
|
237
|
-
alignItems: 'center',
|
|
238
|
-
justifyContent: 'center',
|
|
239
|
-
paddingVertical: 12,
|
|
240
|
-
},
|
|
241
|
-
emptyTitle: {
|
|
242
|
-
color: '#1B244B',
|
|
243
|
-
fontSize: 16,
|
|
244
|
-
marginBottom: 4,
|
|
245
|
-
},
|
|
246
|
-
emptySubtitle: {
|
|
247
|
-
color: '#687499',
|
|
248
|
-
fontSize: 14,
|
|
249
200
|
},
|
|
201
|
+
inputActive: { color: '#1B244B' },
|
|
202
|
+
scroll: { flex: 1 },
|
|
203
|
+
emptyContainer: { alignItems: 'center', marginTop: 20 },
|
|
204
|
+
emptyTitle: { color: '#1B244B', fontSize: 16 },
|
|
205
|
+
emptySubtitle: { color: '#687499', fontSize: 14 },
|
|
250
206
|
});
|
|
251
207
|
|
|
252
208
|
export default FilterableMultiSelect;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import SearchResult from './index.jsx';
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'Tools/SearchResult',
|
|
7
|
+
component: SearchResult,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: 'padded',
|
|
11
|
+
backgrounds: {
|
|
12
|
+
default: 'light',
|
|
13
|
+
values: [
|
|
14
|
+
{ name: 'light', value: '#ffffff' },
|
|
15
|
+
{ name: 'gray', value: '#f4f4f4' },
|
|
16
|
+
],
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
argTypes: {
|
|
20
|
+
title: {
|
|
21
|
+
description: 'Título do resultado',
|
|
22
|
+
control: 'text',
|
|
23
|
+
},
|
|
24
|
+
description: {
|
|
25
|
+
description: 'Descrição do resultado',
|
|
26
|
+
control: 'text',
|
|
27
|
+
},
|
|
28
|
+
iconType: {
|
|
29
|
+
description: 'Tipo do ícone customizado (SEIcon)',
|
|
30
|
+
control: 'select',
|
|
31
|
+
options: [
|
|
32
|
+
null,
|
|
33
|
+
'boletoDasMei',
|
|
34
|
+
'listaEpi',
|
|
35
|
+
'indicadorPorRegiao',
|
|
36
|
+
'dominandoRedesSociais',
|
|
37
|
+
'fluxoCaixa',
|
|
38
|
+
'capitalGiro',
|
|
39
|
+
'catalogoFornecedores',
|
|
40
|
+
'gestaoAgendamento',
|
|
41
|
+
'melhoresRegioesComerciais',
|
|
42
|
+
'geradoresIdeiasIA',
|
|
43
|
+
'simuladorEmprestimo',
|
|
44
|
+
'impostoMei',
|
|
45
|
+
'fornecedoresTi',
|
|
46
|
+
'diagnosticoEstrategico',
|
|
47
|
+
'postsInteligentes',
|
|
48
|
+
'indicadoresMercado',
|
|
49
|
+
'capacidadePagamento',
|
|
50
|
+
'calculadoraPrecoIdeal',
|
|
51
|
+
'segurancaTrabalho',
|
|
52
|
+
'empresaGoogle',
|
|
53
|
+
'planoNegocios',
|
|
54
|
+
'lucroPotencial',
|
|
55
|
+
'ncmComCodigoDeBarras',
|
|
56
|
+
'dataValidadeEpi',
|
|
57
|
+
'sebraeConecta',
|
|
58
|
+
'pesquisaRegistroDeMarca',
|
|
59
|
+
'creditoPermutas',
|
|
60
|
+
'calculadoraValuation',
|
|
61
|
+
],
|
|
62
|
+
},
|
|
63
|
+
iconName: {
|
|
64
|
+
description: 'Nome do ícone Remix (quando iconType é null)',
|
|
65
|
+
control: 'text',
|
|
66
|
+
},
|
|
67
|
+
variant: {
|
|
68
|
+
description: 'Variante visual',
|
|
69
|
+
control: 'select',
|
|
70
|
+
options: ['default', 'filled'],
|
|
71
|
+
},
|
|
72
|
+
showArrow: {
|
|
73
|
+
description: 'Mostrar seta à direita',
|
|
74
|
+
control: 'boolean',
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export default meta;
|
|
80
|
+
|
|
81
|
+
export const Default = {
|
|
82
|
+
render: () => (
|
|
83
|
+
<View style={{ padding: 16 }}>
|
|
84
|
+
<SearchResult
|
|
85
|
+
title="Boleto DAS-MEI"
|
|
86
|
+
description="Seu histórico de pagamentos mensais e boletos DAS-MEI em um só lugar."
|
|
87
|
+
iconType="boletoDasMei"
|
|
88
|
+
variant="default"
|
|
89
|
+
/>
|
|
90
|
+
<SearchResult
|
|
91
|
+
title="Fluxo de caixa"
|
|
92
|
+
description="Registre suas entradas e saídas e controle suas finanças com nossa ferramenta gratuita."
|
|
93
|
+
iconType="fluxoCaixa"
|
|
94
|
+
variant="default"
|
|
95
|
+
/>
|
|
96
|
+
<SearchResult
|
|
97
|
+
title="Meu capital de giro"
|
|
98
|
+
description="Calcule quanto você precisa ter disponível em caixa para manter sua empresa funcionando com tranquilidade."
|
|
99
|
+
iconType="capitalGiro"
|
|
100
|
+
variant="filled"
|
|
101
|
+
style={{ marginVertical: 8 }}
|
|
102
|
+
/>
|
|
103
|
+
<SearchResult
|
|
104
|
+
title="Simulador de empréstimo"
|
|
105
|
+
description="Informe o valor, prazo e juros de um possível empréstimo e descubra o valor das parcelas."
|
|
106
|
+
iconType="simuladorEmprestimo"
|
|
107
|
+
variant="default"
|
|
108
|
+
/>
|
|
109
|
+
<SearchResult
|
|
110
|
+
title="PNbox - Plano de negócio"
|
|
111
|
+
description="Conheça seu público e crie um plano de negócio completo. Crie do zero ou adapte modelos para se destacar no mercado."
|
|
112
|
+
iconType="planoNegocios"
|
|
113
|
+
variant="filled"
|
|
114
|
+
style={{ marginVertical: 8 }}
|
|
115
|
+
/>
|
|
116
|
+
</View>
|
|
117
|
+
),
|
|
118
|
+
};
|
|
@@ -0,0 +1,114 @@
|
|
|
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 SearchResult = ({
|
|
8
|
+
title = 'Title',
|
|
9
|
+
description = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse et quam sit.',
|
|
10
|
+
iconType = null,
|
|
11
|
+
iconName = 'image-line',
|
|
12
|
+
variant = 'default',
|
|
13
|
+
onPress,
|
|
14
|
+
style,
|
|
15
|
+
showArrow = true,
|
|
16
|
+
}) => {
|
|
17
|
+
const isCustomIcon = iconType && iconType !== 'Remix';
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<TouchableOpacity
|
|
21
|
+
style={[
|
|
22
|
+
styles.container,
|
|
23
|
+
variant === 'filled' && styles.containerFilled,
|
|
24
|
+
style,
|
|
25
|
+
]}
|
|
26
|
+
onPress={onPress}
|
|
27
|
+
activeOpacity={0.7}
|
|
28
|
+
>
|
|
29
|
+
<View style={styles.iconContainer}>
|
|
30
|
+
{isCustomIcon ? (
|
|
31
|
+
<SEIcon type={iconType} size={60} />
|
|
32
|
+
) : (
|
|
33
|
+
<View style={styles.iconPlaceholder}>
|
|
34
|
+
<Icon name={iconName} size={24} color="#3B5BDB" />
|
|
35
|
+
</View>
|
|
36
|
+
)}
|
|
37
|
+
</View>
|
|
38
|
+
|
|
39
|
+
<View style={styles.contentContainer}>
|
|
40
|
+
<SEText
|
|
41
|
+
type="ns-sm-body-bold"
|
|
42
|
+
color="#1B244B"
|
|
43
|
+
style={styles.title}
|
|
44
|
+
>
|
|
45
|
+
{title}
|
|
46
|
+
</SEText>
|
|
47
|
+
<SEText
|
|
48
|
+
type="ns-xs-body"
|
|
49
|
+
color="#485274"
|
|
50
|
+
style={styles.description}
|
|
51
|
+
>
|
|
52
|
+
{description}
|
|
53
|
+
</SEText>
|
|
54
|
+
</View>
|
|
55
|
+
|
|
56
|
+
{showArrow && (
|
|
57
|
+
<View style={styles.arrowContainer}>
|
|
58
|
+
<Icon name="arrow-right-line" size={20} color="#1B244B" />
|
|
59
|
+
</View>
|
|
60
|
+
)}
|
|
61
|
+
</TouchableOpacity>
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const styles = StyleSheet.create({
|
|
66
|
+
container: {
|
|
67
|
+
flexDirection: 'row',
|
|
68
|
+
alignItems: 'flex-start',
|
|
69
|
+
backgroundColor: '#FFFFFF',
|
|
70
|
+
paddingHorizontal: 12,
|
|
71
|
+
paddingVertical: 16,
|
|
72
|
+
minHeight: 92,
|
|
73
|
+
width: '100%',
|
|
74
|
+
borderBottomWidth: 1,
|
|
75
|
+
borderBottomColor: '#E2E9FC',
|
|
76
|
+
},
|
|
77
|
+
containerFilled: {
|
|
78
|
+
backgroundColor: '#E2E9FC',
|
|
79
|
+
borderBottomWidth: 0,
|
|
80
|
+
},
|
|
81
|
+
iconContainer: {
|
|
82
|
+
marginRight: 16,
|
|
83
|
+
justifyContent: 'flex-start',
|
|
84
|
+
alignItems: 'center',
|
|
85
|
+
width: 60,
|
|
86
|
+
height: 60,
|
|
87
|
+
},
|
|
88
|
+
iconPlaceholder: {
|
|
89
|
+
width: 48,
|
|
90
|
+
height: 48,
|
|
91
|
+
borderRadius: 8,
|
|
92
|
+
backgroundColor: '#E6ECFF',
|
|
93
|
+
justifyContent: 'center',
|
|
94
|
+
alignItems: 'center',
|
|
95
|
+
},
|
|
96
|
+
contentContainer: {
|
|
97
|
+
flex: 1,
|
|
98
|
+
justifyContent: 'flex-start',
|
|
99
|
+
},
|
|
100
|
+
title: {
|
|
101
|
+
marginBottom: 4,
|
|
102
|
+
},
|
|
103
|
+
description: {
|
|
104
|
+
lineHeight: 20,
|
|
105
|
+
},
|
|
106
|
+
arrowContainer: {
|
|
107
|
+
marginLeft: 12,
|
|
108
|
+
justifyContent: 'flex-start',
|
|
109
|
+
alignItems: 'center',
|
|
110
|
+
paddingTop: 2,
|
|
111
|
+
},
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
export default SearchResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../components/FilterableMultiSelect/index.jsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../components/FilterableMultiSelect/index.jsx"],"names":[],"mappings":";AAgCA;;;;;;;sBA+HC;kBA/JuC,OAAO"}
|
|
@@ -1,36 +1,29 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import { View, TextInput, StyleSheet, TouchableOpacity, Platform } from 'react-native';
|
|
3
|
-
import SelectItem from '../SelectItem';
|
|
1
|
+
import React, { useState, useRef } from 'react';
|
|
2
|
+
import { View, TextInput, StyleSheet, TouchableOpacity, Platform, Keyboard, TouchableWithoutFeedback } from 'react-native';
|
|
4
3
|
import Icon from '../Icon';
|
|
5
|
-
import ScrollBar from '../ScrollBar';
|
|
6
4
|
import SEText from '../SEText';
|
|
5
|
+
import ScrollBar from '../ScrollBar';
|
|
6
|
+
import { set } from 'lodash';
|
|
7
7
|
const CustomCheckbox = ({ selected, iconColor, size = 21 }) => {
|
|
8
|
-
if (selected) {
|
|
9
|
-
return (<View style={{
|
|
10
|
-
width: size,
|
|
11
|
-
height: size,
|
|
12
|
-
borderWidth: 1.5,
|
|
13
|
-
borderColor: iconColor,
|
|
14
|
-
borderRadius: 4,
|
|
15
|
-
backgroundColor: iconColor,
|
|
16
|
-
alignItems: 'center',
|
|
17
|
-
justifyContent: 'center',
|
|
18
|
-
}}>
|
|
19
|
-
<Icon name="check-line" size={size - 8} color="#FFFFFF"/>
|
|
20
|
-
</View>);
|
|
21
|
-
}
|
|
22
8
|
return (<View style={{
|
|
23
9
|
width: size,
|
|
24
10
|
height: size,
|
|
25
11
|
borderWidth: 1.5,
|
|
26
12
|
borderColor: iconColor,
|
|
27
13
|
borderRadius: 4,
|
|
28
|
-
backgroundColor: 'transparent',
|
|
29
|
-
|
|
14
|
+
backgroundColor: selected ? iconColor : 'transparent',
|
|
15
|
+
alignItems: 'center',
|
|
16
|
+
justifyContent: 'center',
|
|
17
|
+
}}>
|
|
18
|
+
{selected && <Icon name="check-line" size={size - 8} color="#FFFFFF"/>}
|
|
19
|
+
</View>);
|
|
30
20
|
};
|
|
31
21
|
const FilterableMultiSelect = ({ options = [], placeholder = 'O que você procura?', searchedValue = '', onSearch = () => { }, selected = [], onSelect = () => { }, }) => {
|
|
32
22
|
const [search, setSearch] = useState(searchedValue);
|
|
33
23
|
const [isFocused, setIsFocused] = useState(false);
|
|
24
|
+
const [onPressIn, setOnPressIn] = useState(false);
|
|
25
|
+
// 1. Criamos uma referência para o input
|
|
26
|
+
const inputRef = useRef(null);
|
|
34
27
|
const handleSearch = (value) => {
|
|
35
28
|
setSearch(value);
|
|
36
29
|
onSearch(value);
|
|
@@ -39,39 +32,40 @@ const FilterableMultiSelect = ({ options = [], placeholder = 'O que você procur
|
|
|
39
32
|
setSearch('');
|
|
40
33
|
onSearch('');
|
|
41
34
|
};
|
|
42
|
-
|
|
43
|
-
|
|
35
|
+
// 2. Função para fechar o teclado e tirar o foco
|
|
36
|
+
const dismissAll = () => {
|
|
37
|
+
Keyboard.dismiss();
|
|
38
|
+
inputRef.current?.blur();
|
|
39
|
+
};
|
|
44
40
|
const filteredOptions = options.filter(option => option.label.toLowerCase().includes(search.toLowerCase()));
|
|
45
|
-
return (
|
|
46
|
-
|
|
41
|
+
return (
|
|
42
|
+
/* 3. O TouchableWithoutFeedback aqui garante que o clique fora feche o teclado */
|
|
43
|
+
<TouchableWithoutFeedback onPress={dismissAll}>
|
|
44
|
+
<View style={styles.container}>
|
|
47
45
|
<View style={[
|
|
48
46
|
styles.inputWrapper,
|
|
49
|
-
|
|
47
|
+
isFocused && styles.inputWrapperActive,
|
|
48
|
+
onPressIn && styles.inputOnpressIn
|
|
50
49
|
]}>
|
|
51
50
|
<View style={styles.searchIconWrapper}>
|
|
52
51
|
<Icon name="search-line" size={16} color="#687499"/>
|
|
53
52
|
</View>
|
|
54
|
-
<TextInput
|
|
55
|
-
|
|
53
|
+
<TextInput ref={inputRef} // Atribuindo a ref
|
|
54
|
+
style={[styles.input, search.length > 0 && styles.inputActive]} value={search} onChangeText={handleSearch} onPressIn={() => setOnPressIn(true)} onPressOut={() => setOnPressIn(false)} onFocus={() => setIsFocused(true)} onBlur={() => setIsFocused(false)} placeholder={placeholder} placeholderTextColor="#687499" cursorColor="#1B244B" autoCorrect={false} underlineColorAndroid="transparent" returnKeyType="done" // Muda o botão do teclado para "Concluído"
|
|
55
|
+
onSubmitEditing={dismissAll} // CORREÇÃO: Fecha o teclado no botão circulado
|
|
56
|
+
/>
|
|
57
|
+
{search.length > 0 && (<TouchableOpacity onPress={handleClear} style={styles.clearIconWrapper}>
|
|
56
58
|
<Icon name="close-line" size={14} color="#2A4FDA"/>
|
|
57
59
|
</TouchableOpacity>)}
|
|
58
60
|
</View>
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
{
|
|
63
|
-
|
|
64
|
-
Nenhum resultado
|
|
65
|
-
|
|
66
|
-
<
|
|
67
|
-
Escreva palavras diferentes
|
|
68
|
-
</SEText>
|
|
69
|
-
</View>) : (filteredOptions.map((option, idx) => (<View key={option.value} style={{
|
|
70
|
-
width: '100%',
|
|
71
|
-
// Adiciona marginBottom apenas se não for o último item
|
|
72
|
-
marginBottom: idx === filteredOptions.length - 1 ? 0 : 8,
|
|
73
|
-
}}>
|
|
74
|
-
<TouchableOpacity style={{
|
|
61
|
+
|
|
62
|
+
<ScrollBar style={styles.scroll} barColor="#C9D5FF" barThickness={6}>
|
|
63
|
+
{/* 4. View de conteúdo com paddingBottom para não colar no teclado */}
|
|
64
|
+
<View style={{ paddingRight: 5, paddingBottom: 20 }}>
|
|
65
|
+
{filteredOptions.length === 0 ? (<View style={styles.emptyContainer}>
|
|
66
|
+
<SEText type="ns-sm-body-bold" style={styles.emptyTitle}>Nenhum resultado</SEText>
|
|
67
|
+
<SEText type="ns-sm-body" style={styles.emptySubtitle}>Escreva palavras diferentes</SEText>
|
|
68
|
+
</View>) : (filteredOptions.map((option, idx) => (<TouchableOpacity key={option.value} style={{
|
|
75
69
|
flexDirection: 'row',
|
|
76
70
|
alignItems: 'center',
|
|
77
71
|
width: '100%',
|
|
@@ -81,90 +75,68 @@ const FilterableMultiSelect = ({ options = [], placeholder = 'O que você procur
|
|
|
81
75
|
borderColor: selected.includes(option.value) ? '#2A4FDA' : '#E2E9FC',
|
|
82
76
|
backgroundColor: selected.includes(option.value) ? '#E3E9FF' : '#FFFFFF',
|
|
83
77
|
paddingHorizontal: 16,
|
|
84
|
-
|
|
85
|
-
|
|
78
|
+
marginBottom: 8,
|
|
79
|
+
}} onPress={() => {
|
|
80
|
+
// 5. Opcional: Se quiser que o teclado feche ao selecionar
|
|
81
|
+
// dismissAll();
|
|
82
|
+
onSelect(option.value);
|
|
83
|
+
}}>
|
|
84
|
+
<CustomCheckbox selected={selected.includes(option.value)} iconColor={'#2A4FDA'} size={20}/>
|
|
86
85
|
<SEText type="ns-sm-body" style={{
|
|
87
86
|
color: selected.includes(option.value) ? '#2A4FDA' : '#485274',
|
|
88
87
|
marginLeft: 12,
|
|
89
88
|
}}>
|
|
90
89
|
{option.label}
|
|
91
90
|
</SEText>
|
|
92
|
-
</TouchableOpacity>
|
|
93
|
-
|
|
94
|
-
</
|
|
95
|
-
</
|
|
96
|
-
</
|
|
91
|
+
</TouchableOpacity>)))}
|
|
92
|
+
</View>
|
|
93
|
+
</ScrollBar>
|
|
94
|
+
</View>
|
|
95
|
+
</TouchableWithoutFeedback>);
|
|
97
96
|
};
|
|
98
97
|
const styles = StyleSheet.create({
|
|
99
98
|
container: {
|
|
99
|
+
flex: 1,
|
|
100
100
|
width: '100%',
|
|
101
|
-
alignSelf: 'center',
|
|
102
101
|
backgroundColor: '#fff',
|
|
103
|
-
borderRadius: 8,
|
|
104
|
-
padding: 0,
|
|
105
|
-
flex: 1,
|
|
106
102
|
},
|
|
107
103
|
inputWrapper: {
|
|
108
|
-
position: 'relative',
|
|
109
104
|
flexDirection: 'row',
|
|
110
105
|
alignItems: 'center',
|
|
111
106
|
borderRadius: 8,
|
|
112
|
-
borderWidth:
|
|
113
|
-
borderColor: '#
|
|
107
|
+
borderWidth: 2,
|
|
108
|
+
borderColor: '#96ACFF',
|
|
114
109
|
marginBottom: 24,
|
|
115
110
|
height: 49,
|
|
116
111
|
backgroundColor: '#FFFFFF',
|
|
117
112
|
},
|
|
118
113
|
inputWrapperActive: {
|
|
114
|
+
borderWidth: 2,
|
|
119
115
|
borderColor: '#2A4FDA',
|
|
116
|
+
outlineColor: '#96ACFF',
|
|
117
|
+
outlineWidth: 3,
|
|
120
118
|
},
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
},
|
|
125
|
-
clearIconWrapper: {
|
|
126
|
-
position: 'absolute',
|
|
127
|
-
right: 16,
|
|
128
|
-
top: 17,
|
|
119
|
+
inputOnpressIn: {
|
|
120
|
+
borderWidth: 2,
|
|
121
|
+
borderColor: '#2A4FDA',
|
|
129
122
|
},
|
|
123
|
+
searchIconWrapper: { paddingLeft: 16 },
|
|
124
|
+
clearIconWrapper: { position: 'absolute', right: 16 },
|
|
130
125
|
input: {
|
|
131
126
|
flex: 1,
|
|
132
127
|
height: '100%',
|
|
133
128
|
paddingHorizontal: 12,
|
|
134
|
-
|
|
129
|
+
fontSize: 16,
|
|
130
|
+
color: '#687499',
|
|
135
131
|
...Platform.select({
|
|
136
132
|
ios: { fontFamily: 'Nunito Sans 10pt Regular' },
|
|
137
133
|
android: { fontFamily: 'NunitoSans_10pt-Regular' },
|
|
138
134
|
}),
|
|
139
|
-
fontSize: 16,
|
|
140
|
-
lineHeight: 24,
|
|
141
|
-
letterSpacing: 0,
|
|
142
|
-
color: '#687499',
|
|
143
|
-
backgroundColor: 'transparent',
|
|
144
|
-
},
|
|
145
|
-
inputActive: {
|
|
146
|
-
color: '#1B244B',
|
|
147
|
-
},
|
|
148
|
-
scroll: {
|
|
149
|
-
zIndex: 1,
|
|
150
|
-
paddingTop: 0,
|
|
151
|
-
flex: 1,
|
|
152
|
-
minHeight: 0,
|
|
153
|
-
paddingRight: 5,
|
|
154
|
-
},
|
|
155
|
-
emptyContainer: {
|
|
156
|
-
alignItems: 'center',
|
|
157
|
-
justifyContent: 'center',
|
|
158
|
-
paddingVertical: 12,
|
|
159
|
-
},
|
|
160
|
-
emptyTitle: {
|
|
161
|
-
color: '#1B244B',
|
|
162
|
-
fontSize: 16,
|
|
163
|
-
marginBottom: 4,
|
|
164
|
-
},
|
|
165
|
-
emptySubtitle: {
|
|
166
|
-
color: '#687499',
|
|
167
|
-
fontSize: 14,
|
|
168
135
|
},
|
|
136
|
+
inputActive: { color: '#1B244B' },
|
|
137
|
+
scroll: { flex: 1 },
|
|
138
|
+
emptyContainer: { alignItems: 'center', marginTop: 20 },
|
|
139
|
+
emptyTitle: { color: '#1B244B', fontSize: 16 },
|
|
140
|
+
emptySubtitle: { color: '#687499', fontSize: 14 },
|
|
169
141
|
});
|
|
170
142
|
export default FilterableMultiSelect;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export default SearchResult;
|
|
2
|
+
declare function SearchResult({ title, description, iconType, iconName, variant, onPress, style, showArrow, }: {
|
|
3
|
+
title?: string | undefined;
|
|
4
|
+
description?: string | undefined;
|
|
5
|
+
iconType?: null | undefined;
|
|
6
|
+
iconName?: string | undefined;
|
|
7
|
+
variant?: string | undefined;
|
|
8
|
+
onPress: any;
|
|
9
|
+
style: any;
|
|
10
|
+
showArrow?: boolean | undefined;
|
|
11
|
+
}): React.JSX.Element;
|
|
12
|
+
import React from 'react';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/Tools/SearchResult/index.jsx"],"names":[],"mappings":";AAMA;;;;;;;;;sBAwDC;kBA9DiB,OAAO"}
|
|
@@ -0,0 +1,81 @@
|
|
|
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 SearchResult = ({ title = 'Title', description = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse et quam sit.', iconType = null, iconName = 'image-line', variant = 'default', onPress, style, showArrow = true, }) => {
|
|
7
|
+
const isCustomIcon = iconType && iconType !== 'Remix';
|
|
8
|
+
return (<TouchableOpacity style={[
|
|
9
|
+
styles.container,
|
|
10
|
+
variant === 'filled' && styles.containerFilled,
|
|
11
|
+
style,
|
|
12
|
+
]} onPress={onPress} activeOpacity={0.7}>
|
|
13
|
+
<View style={styles.iconContainer}>
|
|
14
|
+
{isCustomIcon ? (<SEIcon type={iconType} size={60}/>) : (<View style={styles.iconPlaceholder}>
|
|
15
|
+
<Icon name={iconName} size={24} color="#3B5BDB"/>
|
|
16
|
+
</View>)}
|
|
17
|
+
</View>
|
|
18
|
+
|
|
19
|
+
<View style={styles.contentContainer}>
|
|
20
|
+
<SEText type="ns-sm-body-bold" color="#1B244B" style={styles.title}>
|
|
21
|
+
{title}
|
|
22
|
+
</SEText>
|
|
23
|
+
<SEText type="ns-xs-body" color="#485274" style={styles.description}>
|
|
24
|
+
{description}
|
|
25
|
+
</SEText>
|
|
26
|
+
</View>
|
|
27
|
+
|
|
28
|
+
{showArrow && (<View style={styles.arrowContainer}>
|
|
29
|
+
<Icon name="arrow-right-line" size={20} color="#1B244B"/>
|
|
30
|
+
</View>)}
|
|
31
|
+
</TouchableOpacity>);
|
|
32
|
+
};
|
|
33
|
+
const styles = StyleSheet.create({
|
|
34
|
+
container: {
|
|
35
|
+
flexDirection: 'row',
|
|
36
|
+
alignItems: 'flex-start',
|
|
37
|
+
backgroundColor: '#FFFFFF',
|
|
38
|
+
paddingHorizontal: 12,
|
|
39
|
+
paddingVertical: 16,
|
|
40
|
+
minHeight: 92,
|
|
41
|
+
width: '100%',
|
|
42
|
+
borderBottomWidth: 1,
|
|
43
|
+
borderBottomColor: '#E2E9FC',
|
|
44
|
+
},
|
|
45
|
+
containerFilled: {
|
|
46
|
+
backgroundColor: '#E2E9FC',
|
|
47
|
+
borderBottomWidth: 0,
|
|
48
|
+
},
|
|
49
|
+
iconContainer: {
|
|
50
|
+
marginRight: 16,
|
|
51
|
+
justifyContent: 'flex-start',
|
|
52
|
+
alignItems: 'center',
|
|
53
|
+
width: 60,
|
|
54
|
+
height: 60,
|
|
55
|
+
},
|
|
56
|
+
iconPlaceholder: {
|
|
57
|
+
width: 48,
|
|
58
|
+
height: 48,
|
|
59
|
+
borderRadius: 8,
|
|
60
|
+
backgroundColor: '#E6ECFF',
|
|
61
|
+
justifyContent: 'center',
|
|
62
|
+
alignItems: 'center',
|
|
63
|
+
},
|
|
64
|
+
contentContainer: {
|
|
65
|
+
flex: 1,
|
|
66
|
+
justifyContent: 'flex-start',
|
|
67
|
+
},
|
|
68
|
+
title: {
|
|
69
|
+
marginBottom: 4,
|
|
70
|
+
},
|
|
71
|
+
description: {
|
|
72
|
+
lineHeight: 20,
|
|
73
|
+
},
|
|
74
|
+
arrowContainer: {
|
|
75
|
+
marginLeft: 12,
|
|
76
|
+
justifyContent: 'flex-start',
|
|
77
|
+
alignItems: 'center',
|
|
78
|
+
paddingTop: 2,
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
export default SearchResult;
|