cdslibrary 1.2.90 → 1.2.92

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.
@@ -35,7 +35,7 @@ export const CDSImageButtonGroup = ({ array, onSelect, isCentered }) => {
35
35
  };
36
36
 
37
37
  return (
38
- <View style={[
38
+ <Animated.View style={[
39
39
  animatedLayout,
40
40
  { width: '100%' } // Asegura que el contenedor ocupe todo el ancho disponible
41
41
  ]}>
@@ -65,7 +65,7 @@ export const CDSImageButtonGroup = ({ array, onSelect, isCentered }) => {
65
65
  />
66
66
  ))}
67
67
  </ScrollView>
68
- </View>
68
+ </Animated.View>
69
69
  );
70
70
  }
71
71
 
@@ -0,0 +1,140 @@
1
+ import React from "react";
2
+ import {
3
+ View, Text, TouchableOpacity, StyleSheet,
4
+ Pressable, Modal, SafeAreaView, ScrollView
5
+ } from "react-native";
6
+ import { MaterialIcons } from "@expo/vector-icons";
7
+ import { useTheme } from "../context/CDSThemeContext";
8
+ import { CDSButton } from "./CDSButton";
9
+
10
+ export const CDSModal = ({
11
+ isVisible,
12
+ title,
13
+ message,
14
+ onClose,
15
+ type = 'informative',
16
+ onPressPrimary,
17
+ labelPrimary = 'Aceptar',
18
+ onPressSecondary,
19
+ labelSecondary = 'Cancelar',
20
+ children
21
+ }) => {
22
+ const { theme } = useTheme();
23
+
24
+ if (!theme) return null;
25
+
26
+ return (
27
+ <Modal
28
+ visible={isVisible}
29
+ transparent={true}
30
+ animationType="fade"
31
+ onRequestClose={onClose}
32
+ >
33
+ <Pressable
34
+ style={styles.modalOverlay}
35
+ onPress={onClose}
36
+ >
37
+ <Pressable style={styles.modalContent} onPress={(e) => e.stopPropagation()}>
38
+ <SafeAreaView style={[
39
+ styles.optionsContainer,
40
+ {
41
+ backgroundColor: theme.surface.neutral.primary,
42
+ borderRadius: theme.radius.md,
43
+ }
44
+ ]}>
45
+ {/* Header */}
46
+ <View style={[styles.modalHeader, { borderBottomColor: theme.outline.neutral.primary }]}>
47
+ <Text style={[theme.typography.semiBold.md, { color: theme.text.neutral.primary, flex: 1 }]}>
48
+ {title}
49
+ </Text>
50
+ <TouchableOpacity onPress={onClose} hitSlop={{ top: 10, bottom: 10, left: 10, right: 10 }}>
51
+ <MaterialIcons name="close" size={24} color={theme.text.neutral.primary} />
52
+ </TouchableOpacity>
53
+ </View>
54
+
55
+ {/* Body */}
56
+ <ScrollView style={styles.body} bounces={false}>
57
+ {message && (
58
+ <Text style={[
59
+ theme.typography.regular.md,
60
+ { color: theme.text.neutral.secondary, marginBottom: children ? theme.space.md : 0 }
61
+ ]}>
62
+ {message}
63
+ </Text>
64
+ )}
65
+ {children}
66
+ </ScrollView>
67
+
68
+ {/* Footer - Solo se muestra si es interactive */}
69
+ {type === 'interactive' && (
70
+ <View style={[styles.footer, { gap: theme.space.sm }]}>
71
+ {onPressSecondary && (
72
+ <CDSButton
73
+ label={labelSecondary}
74
+ onPress={onPressSecondary}
75
+ >
76
+ </CDSButton>
77
+ )}
78
+ <CDSButton
79
+ label={labelPrimary}
80
+ onPress={onPressPrimary}
81
+ >
82
+ </CDSButton>
83
+ </View>
84
+ )}
85
+ </SafeAreaView>
86
+ </Pressable>
87
+ </Pressable>
88
+ </Modal>
89
+ );
90
+ };
91
+
92
+ const styles = StyleSheet.create({
93
+ modalOverlay: {
94
+ flex: 1,
95
+ backgroundColor: 'rgba(0,0,0,0.6)',
96
+ justifyContent: 'center',
97
+ alignItems: 'center',
98
+ padding: 24
99
+ },
100
+ modalContent: {
101
+ width: '100%',
102
+ maxWidth: 400,
103
+ },
104
+ optionsContainer: {
105
+ width: '100%',
106
+ overflow: 'hidden',
107
+ elevation: 5,
108
+ shadowColor: '#000',
109
+ shadowOffset: { width: 0, height: 4 },
110
+ shadowOpacity: 0.3,
111
+ shadowRadius: 4.65,
112
+ },
113
+ modalHeader: {
114
+ flexDirection: 'row',
115
+ justifyContent: 'space-between',
116
+ alignItems: 'center',
117
+ padding: 16,
118
+ borderBottomWidth: 1,
119
+ },
120
+ body: {
121
+ padding: 16,
122
+ maxHeight: 400,
123
+ },
124
+ footer: {
125
+ flexDirection: 'row',
126
+ justifyContent: 'flex-end',
127
+ padding: 16,
128
+ alignItems: 'center'
129
+ },
130
+ primaryBtn: {
131
+ paddingVertical: 10,
132
+ paddingHorizontal: 16,
133
+ minWidth: 100,
134
+ alignItems: 'center'
135
+ },
136
+ secondaryBtn: {
137
+ paddingVertical: 10,
138
+ paddingHorizontal: 16,
139
+ }
140
+ });
@@ -69,7 +69,6 @@ export const CDSTable = ({ columns, data, breakpoint = 500 }) => {
69
69
  styles.cell,
70
70
  { padding: theme.space.sm },
71
71
  col.width ? { width: col.width } : { flex: 1 },
72
- // Alinea el contenedor para móvil (Expo Go)
73
72
  col.align === 'right' ? { alignItems: 'flex-end' } : { alignItems: 'flex-start' }
74
73
  ]}
75
74
  >
@@ -78,7 +77,6 @@ export const CDSTable = ({ columns, data, breakpoint = 500 }) => {
78
77
  {
79
78
  color: theme.text.neutral.secondary,
80
79
  textAlign: col.align || 'left',
81
- // Tabular-nums asegura que los números tengan el mismo ancho (perfecto para precios)
82
80
  fontVariant: col.align === 'right' ? ['tabular-nums'] : [],
83
81
  }
84
82
  ]}>
package/index.js CHANGED
@@ -26,6 +26,7 @@ export {CDSImageButton} from './components/CDSImageButton'
26
26
  export {CDSImageButtonGroup} from './components/CDSImageButtonGroup'
27
27
  export {CDSCheckbox} from './components/CDSCheckbox';
28
28
  export {CDSTooltip} from './components/CDSTooltip';
29
+ export {CDSModal} from './components/CDSModal'
29
30
 
30
31
 
31
32
  export {CDSThemeProvider, useTheme} from './context/CDSThemeContext';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cdslibrary",
3
3
  "license": "0BSD",
4
- "version": "1.2.90",
4
+ "version": "1.2.92",
5
5
  "main": "index.js",
6
6
  "author": "Nat Viramontes",
7
7
  "description": "A library of components for the CDS project",