vpt-sebraeds 0.0.50 → 0.0.51

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.
@@ -62,7 +62,6 @@ export const Default = {
62
62
  { text: 'Label', leftIcon: 'home-4-line', rightIcon: 'home-4-line' },
63
63
  { text: 'Label', leftIcon: 'home-4-line', rightIcon: 'home-4-line' },
64
64
  ]}
65
- variant="filled"
66
65
  style={{ marginBottom: 12 }}
67
66
  />
68
67
 
@@ -74,7 +73,6 @@ export const Default = {
74
73
  { text: 'Label', leftIcon: 'home-4-line', rightIcon: 'home-4-line' },
75
74
  { text: 'Label', leftIcon: 'home-4-line', rightIcon: 'home-4-line' },
76
75
  ]}
77
- variant="filled"
78
76
  style={{ marginBottom: 12 }}
79
77
  />
80
78
 
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { View, StyleSheet, TouchableOpacity } from 'react-native';
2
+ import { View, StyleSheet, Pressable } from 'react-native';
3
3
  import SEText from '../../SEText';
4
4
  import Icon from '../../Icon';
5
5
  import SEIcon from '../../SEIcon';
@@ -73,15 +73,16 @@ const NavigationButton = ({
73
73
  onPress,
74
74
  style,
75
75
  }) => {
76
- // labels pode ser array de strings ou array de objetos { text, leftIcon, rightIcon }
76
+ // labels pode ser array de strings ou array de objetos { text, leftIcon, rightIcon, onPress }
77
77
  const normalizeLabel = (label) => {
78
78
  if (typeof label === 'string') {
79
- return { text: label, leftIcon: 'home-4-line', rightIcon: 'home-4-line' };
79
+ return { text: label, leftIcon: 'home-4-line', rightIcon: 'home-4-line', onPress: null };
80
80
  }
81
81
  return {
82
82
  text: label.text || 'Label',
83
83
  leftIcon: label.leftIcon,
84
84
  rightIcon: label.rightIcon,
85
+ onPress: label.onPress || null,
85
86
  };
86
87
  };
87
88
 
@@ -164,10 +165,10 @@ const NavigationButton = ({
164
165
  marginLeft: -(iconContainerSize + 16 + paddingHorizontal),
165
166
  marginRight: -(paddingHorizontal + 8 + arrowIconSize + 15),
166
167
  marginBottom: -paddingVertical,
167
- paddingBottom: 12,
168
168
  backgroundColor: '#FFFFFF',
169
169
  borderBottomLeftRadius: borderRadius - 1,
170
170
  borderBottomRightRadius: borderRadius - 1,
171
+ overflow: 'hidden',
171
172
  };
172
173
 
173
174
  const labelVerticalDividerStyle = {
@@ -177,6 +178,16 @@ const NavigationButton = ({
177
178
  marginBottom: 0,
178
179
  };
179
180
 
181
+ const getLabelButtonStyle = (pressed) => ({
182
+ flex: 1,
183
+ flexDirection: 'row',
184
+ alignItems: 'center',
185
+ justifyContent: 'center',
186
+ paddingTop: 16,
187
+ paddingBottom: 12,
188
+ backgroundColor: pressed ? '#F5F7FA' : 'transparent',
189
+ });
190
+
180
191
  return (
181
192
  <>
182
193
  <View style={labelsDividerStyle} />
@@ -186,7 +197,10 @@ const NavigationButton = ({
186
197
  return (
187
198
  <React.Fragment key={index}>
188
199
  {index > 0 && <View style={labelVerticalDividerStyle} />}
189
- <View style={styles.labelButton}>
200
+ <Pressable
201
+ style={({ pressed }) => getLabelButtonStyle(pressed)}
202
+ onPress={normalizedLabel.onPress}
203
+ >
190
204
  {normalizedLabel.leftIcon && (
191
205
  <Icon name={normalizedLabel.leftIcon} size={labelIconSize} color={labelIconColor} />
192
206
  )}
@@ -196,7 +210,7 @@ const NavigationButton = ({
196
210
  {normalizedLabel.rightIcon && (
197
211
  <Icon name={normalizedLabel.rightIcon} size={labelIconSize} color={labelIconColor} style={{ marginLeft: 8 }} />
198
212
  )}
199
- </View>
213
+ </Pressable>
200
214
  </React.Fragment>
201
215
  );
202
216
  })}
@@ -205,10 +219,10 @@ const NavigationButton = ({
205
219
  );
206
220
  };
207
221
 
208
- const containerStyle = {
222
+ const getContainerStyle = (pressed) => ({
209
223
  flexDirection: 'row',
210
224
  alignItems: 'flex-start',
211
- backgroundColor: variant === 'filled' ? filledBackgroundColor : backgroundColor,
225
+ backgroundColor: variant === 'filled' || pressed ? filledBackgroundColor : backgroundColor,
212
226
  paddingHorizontal,
213
227
  paddingVertical,
214
228
  minHeight,
@@ -216,7 +230,7 @@ const NavigationButton = ({
216
230
  borderWidth,
217
231
  borderColor,
218
232
  borderRadius,
219
- };
233
+ });
220
234
 
221
235
  const iconContainerStyle = {
222
236
  marginRight: 16,
@@ -236,10 +250,9 @@ const NavigationButton = ({
236
250
  };
237
251
 
238
252
  return (
239
- <TouchableOpacity
240
- style={[containerStyle, style]}
253
+ <Pressable
254
+ style={({ pressed }) => [getContainerStyle(pressed), style]}
241
255
  onPress={onPress}
242
- activeOpacity={0.7}
243
256
  >
244
257
  <View style={iconContainerStyle}>
245
258
  {isCustomIcon ? (
@@ -268,7 +281,7 @@ const NavigationButton = ({
268
281
  <Icon name={arrowIconName} size={arrowIconSize} color={arrowIconColor} />
269
282
  </View>
270
283
  )}
271
- </TouchableOpacity>
284
+ </Pressable>
272
285
  );
273
286
  };
274
287
 
@@ -297,14 +310,6 @@ const styles = StyleSheet.create({
297
310
  valueText: {
298
311
  marginLeft: 4,
299
312
  },
300
- labelButton: {
301
- flex: 1,
302
- flexDirection: 'row',
303
- alignItems: 'center',
304
- justifyContent: 'center',
305
- paddingTop: 16,
306
- paddingBottom: 4,
307
- },
308
313
  labelText: {
309
314
  marginLeft: 8,
310
315
  },
@@ -85,33 +85,27 @@ export const Default = {
85
85
  title="Boleto DAS-MEI"
86
86
  description="Seu histórico de pagamentos mensais e boletos DAS-MEI em um só lugar."
87
87
  iconType="boletoDasMei"
88
- variant="default"
89
88
  />
90
89
  <SearchResult
91
90
  title="Fluxo de caixa"
92
91
  description="Registre suas entradas e saídas e controle suas finanças com nossa ferramenta gratuita."
93
92
  iconType="fluxoCaixa"
94
- variant="default"
95
93
  />
96
94
  <SearchResult
97
95
  title="Meu capital de giro"
98
96
  description="Calcule quanto você precisa ter disponível em caixa para manter sua empresa funcionando com tranquilidade."
99
97
  iconType="capitalGiro"
100
- variant="filled"
101
- style={{ marginVertical: 8 }}
102
98
  />
103
99
  <SearchResult
104
100
  title="Simulador de empréstimo"
105
101
  description="Informe o valor, prazo e juros de um possível empréstimo e descubra o valor das parcelas."
106
102
  iconType="simuladorEmprestimo"
107
- variant="default"
108
103
  />
109
104
  <SearchResult
110
105
  title="PNbox - Plano de negócio"
111
106
  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
107
  iconType="planoNegocios"
113
108
  variant="filled"
114
- style={{ marginVertical: 8 }}
115
109
  />
116
110
  </View>
117
111
  ),
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { View, StyleSheet, TouchableOpacity } from 'react-native';
2
+ import { View, StyleSheet, Pressable } from 'react-native';
3
3
  import SEText from '../../SEText';
4
4
  import Icon from '../../Icon';
5
5
  import SEIcon from '../../SEIcon';
@@ -16,15 +16,22 @@ const SearchResult = ({
16
16
  }) => {
17
17
  const isCustomIcon = iconType && iconType !== 'Remix';
18
18
 
19
+ const getContainerStyle = (pressed) => ({
20
+ flexDirection: 'row',
21
+ alignItems: 'flex-start',
22
+ backgroundColor: variant === 'filled' || pressed ? '#E2E9FC' : '#FFFFFF',
23
+ paddingHorizontal: 12,
24
+ paddingVertical: 16,
25
+ minHeight: 92,
26
+ width: '100%',
27
+ borderBottomWidth: variant === 'filled' ? 0 : 1,
28
+ borderBottomColor: '#E2E9FC',
29
+ });
30
+
19
31
  return (
20
- <TouchableOpacity
21
- style={[
22
- styles.container,
23
- variant === 'filled' && styles.containerFilled,
24
- style,
25
- ]}
32
+ <Pressable
33
+ style={({ pressed }) => [getContainerStyle(pressed), style]}
26
34
  onPress={onPress}
27
- activeOpacity={0.7}
28
35
  >
29
36
  <View style={styles.iconContainer}>
30
37
  {isCustomIcon ? (
@@ -58,26 +65,11 @@ const SearchResult = ({
58
65
  <Icon name="arrow-right-line" size={20} color="#1B244B" />
59
66
  </View>
60
67
  )}
61
- </TouchableOpacity>
68
+ </Pressable>
62
69
  );
63
70
  };
64
71
 
65
72
  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
73
  iconContainer: {
82
74
  marginRight: 16,
83
75
  justifyContent: 'flex-start',
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/Tools/NavigationButton/index.jsx"],"names":[],"mappings":";AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBA0QC;kBAhRiB,OAAO"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/Tools/NavigationButton/index.jsx"],"names":[],"mappings":";AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAuRC;kBA7RiB,OAAO"}
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { View, StyleSheet, TouchableOpacity } from 'react-native';
2
+ import { View, StyleSheet, Pressable } from 'react-native';
3
3
  import SEText from '../../SEText';
4
4
  import Icon from '../../Icon';
5
5
  import SEIcon from '../../SEIcon';
@@ -26,15 +26,16 @@ dividerColor = '#E2E9FC',
26
26
  variant = 'default', backgroundColor = '#FFFFFF', filledBackgroundColor = '#E2E9FC', borderColor = '#E2E9FC', borderWidth = 1.5, borderRadius = 8, paddingHorizontal = 12, paddingVertical = 16, minHeight = 92,
27
27
  // Outros
28
28
  onPress, style, }) => {
29
- // labels pode ser array de strings ou array de objetos { text, leftIcon, rightIcon }
29
+ // labels pode ser array de strings ou array de objetos { text, leftIcon, rightIcon, onPress }
30
30
  const normalizeLabel = (label) => {
31
31
  if (typeof label === 'string') {
32
- return { text: label, leftIcon: 'home-4-line', rightIcon: 'home-4-line' };
32
+ return { text: label, leftIcon: 'home-4-line', rightIcon: 'home-4-line', onPress: null };
33
33
  }
34
34
  return {
35
35
  text: label.text || 'Label',
36
36
  leftIcon: label.leftIcon,
37
37
  rightIcon: label.rightIcon,
38
+ onPress: label.onPress || null,
38
39
  };
39
40
  };
40
41
  const isCustomIcon = iconType && iconType !== 'Remix';
@@ -85,10 +86,10 @@ onPress, style, }) => {
85
86
  marginLeft: -(iconContainerSize + 16 + paddingHorizontal),
86
87
  marginRight: -(paddingHorizontal + 8 + arrowIconSize + 15),
87
88
  marginBottom: -paddingVertical,
88
- paddingBottom: 12,
89
89
  backgroundColor: '#FFFFFF',
90
90
  borderBottomLeftRadius: borderRadius - 1,
91
91
  borderBottomRightRadius: borderRadius - 1,
92
+ overflow: 'hidden',
92
93
  };
93
94
  const labelVerticalDividerStyle = {
94
95
  width: 1,
@@ -96,6 +97,15 @@ onPress, style, }) => {
96
97
  marginTop: 8,
97
98
  marginBottom: 0,
98
99
  };
100
+ const getLabelButtonStyle = (pressed) => ({
101
+ flex: 1,
102
+ flexDirection: 'row',
103
+ alignItems: 'center',
104
+ justifyContent: 'center',
105
+ paddingTop: 16,
106
+ paddingBottom: 12,
107
+ backgroundColor: pressed ? '#F5F7FA' : 'transparent',
108
+ });
99
109
  return (<>
100
110
  <View style={labelsDividerStyle}/>
101
111
  <View style={labelsContainerStyle}>
@@ -103,22 +113,22 @@ onPress, style, }) => {
103
113
  const normalizedLabel = normalizeLabel(label);
104
114
  return (<React.Fragment key={index}>
105
115
  {index > 0 && <View style={labelVerticalDividerStyle}/>}
106
- <View style={styles.labelButton}>
116
+ <Pressable style={({ pressed }) => getLabelButtonStyle(pressed)} onPress={normalizedLabel.onPress}>
107
117
  {normalizedLabel.leftIcon && (<Icon name={normalizedLabel.leftIcon} size={labelIconSize} color={labelIconColor}/>)}
108
118
  <SEText type={labelTextType} color={labelTextColor} style={styles.labelText}>
109
119
  {normalizedLabel.text}
110
120
  </SEText>
111
121
  {normalizedLabel.rightIcon && (<Icon name={normalizedLabel.rightIcon} size={labelIconSize} color={labelIconColor} style={{ marginLeft: 8 }}/>)}
112
- </View>
122
+ </Pressable>
113
123
  </React.Fragment>);
114
124
  })}
115
125
  </View>
116
126
  </>);
117
127
  };
118
- const containerStyle = {
128
+ const getContainerStyle = (pressed) => ({
119
129
  flexDirection: 'row',
120
130
  alignItems: 'flex-start',
121
- backgroundColor: variant === 'filled' ? filledBackgroundColor : backgroundColor,
131
+ backgroundColor: variant === 'filled' || pressed ? filledBackgroundColor : backgroundColor,
122
132
  paddingHorizontal,
123
133
  paddingVertical,
124
134
  minHeight,
@@ -126,7 +136,7 @@ onPress, style, }) => {
126
136
  borderWidth,
127
137
  borderColor,
128
138
  borderRadius,
129
- };
139
+ });
130
140
  const iconContainerStyle = {
131
141
  marginRight: 16,
132
142
  justifyContent: 'flex-start',
@@ -142,7 +152,7 @@ onPress, style, }) => {
142
152
  justifyContent: 'center',
143
153
  alignItems: 'center',
144
154
  };
145
- return (<TouchableOpacity style={[containerStyle, style]} onPress={onPress} activeOpacity={0.7}>
155
+ return (<Pressable style={({ pressed }) => [getContainerStyle(pressed), style]} onPress={onPress}>
146
156
  <View style={iconContainerStyle}>
147
157
  {isCustomIcon ? (<SEIcon type={iconType} size={iconContainerSize}/>) : (<View style={iconPlaceholderStyle}>
148
158
  <Icon name={iconName} size={iconSize} color={iconColor}/>
@@ -160,7 +170,7 @@ onPress, style, }) => {
160
170
  {showArrow && (<View style={styles.arrowContainer}>
161
171
  <Icon name={arrowIconName} size={arrowIconSize} color={arrowIconColor}/>
162
172
  </View>)}
163
- </TouchableOpacity>);
173
+ </Pressable>);
164
174
  };
165
175
  const styles = StyleSheet.create({
166
176
  contentContainer: {
@@ -187,14 +197,6 @@ const styles = StyleSheet.create({
187
197
  valueText: {
188
198
  marginLeft: 4,
189
199
  },
190
- labelButton: {
191
- flex: 1,
192
- flexDirection: 'row',
193
- alignItems: 'center',
194
- justifyContent: 'center',
195
- paddingTop: 16,
196
- paddingBottom: 4,
197
- },
198
200
  labelText: {
199
201
  marginLeft: 8,
200
202
  },
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/Tools/SearchResult/index.jsx"],"names":[],"mappings":";AAMA;;;;;;;;;sBAwDC;kBA9DiB,OAAO"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/Tools/SearchResult/index.jsx"],"names":[],"mappings":";AAMA;;;;;;;;;sBA+DC;kBArEiB,OAAO"}
@@ -1,15 +1,22 @@
1
1
  import React from 'react';
2
- import { View, StyleSheet, TouchableOpacity } from 'react-native';
2
+ import { View, StyleSheet, Pressable } from 'react-native';
3
3
  import SEText from '../../SEText';
4
4
  import Icon from '../../Icon';
5
5
  import SEIcon from '../../SEIcon';
6
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
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}>
8
+ const getContainerStyle = (pressed) => ({
9
+ flexDirection: 'row',
10
+ alignItems: 'flex-start',
11
+ backgroundColor: variant === 'filled' || pressed ? '#E2E9FC' : '#FFFFFF',
12
+ paddingHorizontal: 12,
13
+ paddingVertical: 16,
14
+ minHeight: 92,
15
+ width: '100%',
16
+ borderBottomWidth: variant === 'filled' ? 0 : 1,
17
+ borderBottomColor: '#E2E9FC',
18
+ });
19
+ return (<Pressable style={({ pressed }) => [getContainerStyle(pressed), style]} onPress={onPress}>
13
20
  <View style={styles.iconContainer}>
14
21
  {isCustomIcon ? (<SEIcon type={iconType} size={60}/>) : (<View style={styles.iconPlaceholder}>
15
22
  <Icon name={iconName} size={24} color="#3B5BDB"/>
@@ -28,24 +35,9 @@ const SearchResult = ({ title = 'Title', description = 'Lorem ipsum dolor sit am
28
35
  {showArrow && (<View style={styles.arrowContainer}>
29
36
  <Icon name="arrow-right-line" size={20} color="#1B244B"/>
30
37
  </View>)}
31
- </TouchableOpacity>);
38
+ </Pressable>);
32
39
  };
33
40
  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
41
  iconContainer: {
50
42
  marginRight: 16,
51
43
  justifyContent: 'flex-start',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vpt-sebraeds",
3
- "version": "0.0.50",
3
+ "version": "0.0.51",
4
4
  "description": "Biblioteca de componentes React Native do Sebrae",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",