vpt-sebraeds 0.0.26 → 0.0.28

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.
@@ -263,6 +263,8 @@ const Dropdown = ({
263
263
  )
264
264
  };
265
265
 
266
+ const hasCheckboxes = options.some(item => item.isCheckbox);
267
+
266
268
  return (
267
269
  <View style={styles.wrapper}>
268
270
  <Modal
@@ -271,46 +273,53 @@ const Dropdown = ({
271
273
  animationType="fade"
272
274
  onRequestClose={() => setIsOpen(false)}
273
275
  >
274
- <TouchableOpacity
275
- style={styles.overlay}
276
- activeOpacity={1}
277
- onPress={() => setIsOpen(false)}
278
- >
276
+ <View style={styles.overlay}>
277
+ {/* Área clicável separada para fechar o modal */}
278
+ <TouchableOpacity
279
+ style={styles.overlayTouchable}
280
+ activeOpacity={1}
281
+ onPress={() => setIsOpen(false)}
282
+ />
283
+
284
+ {/* Conteúdo do modal - não propaga toque para o overlay */}
279
285
  <View style={styles.modalContainer}>
280
- <View style={styles.dropdownList}>
281
- <View style={styles.modalHeader}>
282
- <TouchableOpacity
283
- onPress={() => setIsOpen(false)}
284
- style={styles.closeButton}
285
- >
286
- <Icon name="subtract-line" size={26} color="#687499" />
287
- </TouchableOpacity>
288
- <Text style={styles.modalTitle}>{title || "Título"}</Text>
289
- </View>
286
+ <View style={styles.modalHeader}>
287
+ <TouchableOpacity
288
+ onPress={() => setIsOpen(false)}
289
+ style={styles.closeButton}
290
+ >
291
+ <Icon name="subtract-line" size={26} color="#687499" />
292
+ </TouchableOpacity>
293
+ <Text style={styles.modalTitle}>{title || "Título"}</Text>
294
+ </View>
290
295
 
291
- <FlatList
292
- data={options}
293
- renderItem={(props) => <RenderItem {...props} />}
294
- keyExtractor={(item, index) => index.toString()}
295
- style={styles.optionsList}
296
- showsVerticalScrollIndicator={false}
297
- bounces={false}
298
- />
296
+ <ScrollView
297
+ style={styles.optionsList}
298
+ contentContainerStyle={{ paddingBottom: 8 }}
299
+ showsVerticalScrollIndicator={false}
300
+ bounces={false}
301
+ >
302
+ {options.map((item, index) => (
303
+ <RenderItem key={index.toString()} item={item} index={index} />
304
+ ))}
305
+ </ScrollView>
299
306
 
300
- {confirmButtonLabel && onConfirm && (
301
- <View style={styles.buttonContainer}>
302
- <Button
303
- label={confirmButtonLabel}
304
- onPress={onConfirm}
305
- size="large"
306
- variant="filled"
307
- expand
308
- />
309
- </View>
310
- )}
311
- </View>
307
+ {hasCheckboxes && (
308
+ <View style={styles.buttonContainer}>
309
+ <Button
310
+ label={confirmButtonLabel || "Confirmar"}
311
+ onPress={() => {
312
+ if (onConfirm) onConfirm();
313
+ setIsOpen(false);
314
+ }}
315
+ size="large"
316
+ variant="filled"
317
+ expand
318
+ />
319
+ </View>
320
+ )}
312
321
  </View>
313
- </TouchableOpacity>
322
+ </View>
314
323
  </Modal>
315
324
  </View>
316
325
  );
@@ -338,20 +347,22 @@ const styles = StyleSheet.create({
338
347
  backgroundColor: 'rgba(0, 0, 0, 0.5)',
339
348
  justifyContent: 'flex-end',
340
349
  },
350
+ overlayTouchable: {
351
+ flex: 1,
352
+ },
341
353
  modalContainer: {
342
354
  backgroundColor: 'white',
343
355
  borderTopLeftRadius: 20,
344
356
  borderTopRightRadius: 20,
345
- maxHeight: screenHeight * 0.6,
357
+ maxHeight: screenHeight * 0.7,
346
358
  paddingBottom: 34, // Safe area para iPhone
347
359
  },
348
360
  modalHeader: {
349
361
  alignItems: 'center',
350
362
  justifyContent: 'space-between',
351
363
  paddingHorizontal: 20,
364
+ paddingTop: 8,
352
365
  paddingBottom: 16,
353
- // borderBottomWidth: 1,
354
- // borderBottomColor: '#F0F0F0',
355
366
  },
356
367
  modalTitle: {
357
368
  fontSize: 18,
@@ -362,13 +373,9 @@ const styles = StyleSheet.create({
362
373
  closeButton: {
363
374
  margin: -4,
364
375
  },
365
- dropdownList: {
366
- backgroundColor: 'white',
367
- borderTopLeftRadius: 20,
368
- borderTopRightRadius: 20,
369
- },
370
376
  optionsList: {
371
377
  paddingHorizontal: 20,
378
+ flexGrow: 0,
372
379
  },
373
380
  optionItem: {
374
381
  paddingVertical: 16,
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../components/Dropdown/index.jsx"],"names":[],"mappings":"AA+FO,yDA6DN;;kBA3JkD,OAAO;AA+J1D;;;;;;;;;;sBA4JC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../components/Dropdown/index.jsx"],"names":[],"mappings":"AA+FO,yDA6DN;;kBA3JkD,OAAO;AA+J1D;;;;;;;;;;sBAqKC"}
@@ -198,26 +198,35 @@ const Dropdown = ({ title, onSelect, options = [], withSeparator = false, isOpen
198
198
  const [isChecked, setIsChecked] = useState(false);
199
199
  return item.isCheckbox ? (<Checkbox checked={isChecked} onChange={() => setIsChecked(curr => !curr)} label={item.label || item} variant="check-line"/>) : (<RippleItem item={item} index={index} onPress={handleSelect}/>);
200
200
  };
201
+ const hasCheckboxes = options.some(item => item.isCheckbox);
201
202
  return (<View style={styles.wrapper}>
202
203
  <Modal visible={isOpen} transparent={true} animationType="fade" onRequestClose={() => setIsOpen(false)}>
203
- <TouchableOpacity style={styles.overlay} activeOpacity={1} onPress={() => setIsOpen(false)}>
204
+ <View style={styles.overlay}>
205
+ {/* Área clicável separada para fechar o modal */}
206
+ <TouchableOpacity style={styles.overlayTouchable} activeOpacity={1} onPress={() => setIsOpen(false)}/>
207
+
208
+ {/* Conteúdo do modal - não propaga toque para o overlay */}
204
209
  <View style={styles.modalContainer}>
205
- <View style={styles.dropdownList}>
206
- <View style={styles.modalHeader}>
207
- <TouchableOpacity onPress={() => setIsOpen(false)} style={styles.closeButton}>
208
- <Icon name="subtract-line" size={26} color="#687499"/>
209
- </TouchableOpacity>
210
- <Text style={styles.modalTitle}>{title || "Título"}</Text>
211
- </View>
210
+ <View style={styles.modalHeader}>
211
+ <TouchableOpacity onPress={() => setIsOpen(false)} style={styles.closeButton}>
212
+ <Icon name="subtract-line" size={26} color="#687499"/>
213
+ </TouchableOpacity>
214
+ <Text style={styles.modalTitle}>{title || "Título"}</Text>
215
+ </View>
212
216
 
213
- <FlatList data={options} renderItem={(props) => <RenderItem {...props}/>} keyExtractor={(item, index) => index.toString()} style={styles.optionsList} showsVerticalScrollIndicator={false} bounces={false}/>
217
+ <ScrollView style={styles.optionsList} contentContainerStyle={{ paddingBottom: 8 }} showsVerticalScrollIndicator={false} bounces={false}>
218
+ {options.map((item, index) => (<RenderItem key={index.toString()} item={item} index={index}/>))}
219
+ </ScrollView>
214
220
 
215
- {confirmButtonLabel && onConfirm && (<View style={styles.buttonContainer}>
216
- <Button label={confirmButtonLabel} onPress={onConfirm} size="large" variant="filled" expand/>
217
- </View>)}
218
- </View>
221
+ {hasCheckboxes && (<View style={styles.buttonContainer}>
222
+ <Button label={confirmButtonLabel || "Confirmar"} onPress={() => {
223
+ if (onConfirm)
224
+ onConfirm();
225
+ setIsOpen(false);
226
+ }} size="large" variant="filled" expand/>
227
+ </View>)}
219
228
  </View>
220
- </TouchableOpacity>
229
+ </View>
221
230
  </Modal>
222
231
  </View>);
223
232
  };
@@ -243,20 +252,22 @@ const styles = StyleSheet.create({
243
252
  backgroundColor: 'rgba(0, 0, 0, 0.5)',
244
253
  justifyContent: 'flex-end',
245
254
  },
255
+ overlayTouchable: {
256
+ flex: 1,
257
+ },
246
258
  modalContainer: {
247
259
  backgroundColor: 'white',
248
260
  borderTopLeftRadius: 20,
249
261
  borderTopRightRadius: 20,
250
- maxHeight: screenHeight * 0.6,
262
+ maxHeight: screenHeight * 0.7,
251
263
  paddingBottom: 34, // Safe area para iPhone
252
264
  },
253
265
  modalHeader: {
254
266
  alignItems: 'center',
255
267
  justifyContent: 'space-between',
256
268
  paddingHorizontal: 20,
269
+ paddingTop: 8,
257
270
  paddingBottom: 16,
258
- // borderBottomWidth: 1,
259
- // borderBottomColor: '#F0F0F0',
260
271
  },
261
272
  modalTitle: {
262
273
  fontSize: 18,
@@ -267,13 +278,9 @@ const styles = StyleSheet.create({
267
278
  closeButton: {
268
279
  margin: -4,
269
280
  },
270
- dropdownList: {
271
- backgroundColor: 'white',
272
- borderTopLeftRadius: 20,
273
- borderTopRightRadius: 20,
274
- },
275
281
  optionsList: {
276
282
  paddingHorizontal: 20,
283
+ flexGrow: 0,
277
284
  },
278
285
  optionItem: {
279
286
  paddingVertical: 16,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vpt-sebraeds",
3
- "version": "0.0.26",
3
+ "version": "0.0.28",
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",