cdslibrary 1.2.92 → 1.2.94

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.
@@ -12,7 +12,7 @@ import { useTheme } from "../context/CDSThemeContext";
12
12
 
13
13
  const AnimatedTextInput = Animated.createAnimatedComponent(TextInput);
14
14
 
15
- export const CDSInput = ({ label, type, keyboard, placeholder, value, onChangeText, animationTrigger, returnKeyType, onFocus }) => {
15
+ export const CDSInput = ({ label, type, keyboard, placeholder, value, onChangeText, animationTrigger, onBlur, onFocus }) => {
16
16
  const { theme } = useTheme();
17
17
  const [isFocused, setIsFocused] = useState(false);
18
18
 
@@ -54,13 +54,13 @@ export const CDSInput = ({ label, type, keyboard, placeholder, value, onChangeTe
54
54
  useEffect(() => {
55
55
  // ELIMINAMOS la restricción de !isReadOnly para que se anime siempre
56
56
  if (!isInternalChange.current && value) {
57
- flashValue.value = withDelay(400, withSequence(
58
- withTiming(1, { duration: 400 }),
57
+ flashValue.value = withDelay(300, withSequence(
58
+ withTiming(1, { duration: 300 }),
59
59
  withTiming(0, { duration: 600 })
60
60
  ));
61
61
 
62
62
  textHighlight.value = withSequence(
63
- withTiming(1, { duration: 400 }),
63
+ withTiming(1, { duration: 300 }),
64
64
  withTiming(0, { duration: 600 })
65
65
  );
66
66
  }
@@ -79,8 +79,7 @@ export const CDSInput = ({ label, type, keyboard, placeholder, value, onChangeTe
79
79
 
80
80
  return {
81
81
  borderColor,
82
- borderWidth: 1 + (flashValue.value * 2),
83
- transform: [{ scale: 1 + (flashValue.value * 0.02) }]
82
+ borderWidth: 1 + (flashValue.value * 3),
84
83
  };
85
84
  });
86
85
 
@@ -114,7 +113,8 @@ export const CDSInput = ({ label, type, keyboard, placeholder, value, onChangeTe
114
113
  animatedBoxStyle,
115
114
  {
116
115
  backgroundColor: isReadOnly ? theme.surface.neutral.primaryVariant : theme.surface.neutral.primary,
117
- borderRadius: theme.radius?.sm || 8,
116
+ borderRadius: theme.radius?.sm,
117
+ pointerEvents: isReadOnly ? 'none' : 'auto',
118
118
  }
119
119
  ]}>
120
120
  <AnimatedTextInput
@@ -136,7 +136,10 @@ export const CDSInput = ({ label, type, keyboard, placeholder, value, onChangeTe
136
136
  editable={!isReadOnly}
137
137
  secureTextEntry={type === "password"}
138
138
  onFocus={() => { setIsFocused(true); onFocus && onFocus(); }}
139
- onBlur={() => setIsFocused(false)}
139
+ onBlur={() => {
140
+ setIsFocused(false);
141
+ onBlur && onBlur();
142
+ }}
140
143
  underlineColorAndroid="transparent"
141
144
  />
142
145
  </Animated.View>
@@ -145,14 +148,17 @@ export const CDSInput = ({ label, type, keyboard, placeholder, value, onChangeTe
145
148
  };
146
149
 
147
150
  const styles = StyleSheet.create({
148
- container: { width: "100%", alignSelf: 'stretch' },
151
+ container: {
152
+ width: "100%", alignSelf: 'stretch',
153
+
154
+ },
149
155
  wrapper: {
150
156
  width: '100%',
151
157
  height: 48,
152
158
  flexDirection: 'row',
153
159
  alignItems: 'center',
154
- borderWidth: 1,
155
160
  overflow: 'hidden'
161
+
156
162
  },
157
- textBox: { flex: 1, height: '100%', width: '100%' },
163
+ textBox: { flex: 1, height: '100%', width: '100%', },
158
164
  });
@@ -31,7 +31,7 @@ export const CDSModal = ({
31
31
  onRequestClose={onClose}
32
32
  >
33
33
  <Pressable
34
- style={styles.modalOverlay}
34
+ style={[styles.modalOverlay, {backgroundColor: theme.surface.special.overlay, padding: theme.space.lg}]}
35
35
  onPress={onClose}
36
36
  >
37
37
  <Pressable style={styles.modalContent} onPress={(e) => e.stopPropagation()}>
@@ -40,20 +40,21 @@ export const CDSModal = ({
40
40
  {
41
41
  backgroundColor: theme.surface.neutral.primary,
42
42
  borderRadius: theme.radius.md,
43
+ boxShadow: theme.shadows.lg
43
44
  }
44
45
  ]}>
45
46
  {/* Header */}
46
- <View style={[styles.modalHeader, { borderBottomColor: theme.outline.neutral.primary }]}>
47
+ <View style={[styles.modalHeader, { borderBottomColor: theme.outline.neutral.primary, paddingVertical: theme.space.md, paddingHorizontal: theme.space.sm }]}>
47
48
  <Text style={[theme.typography.semiBold.md, { color: theme.text.neutral.primary, flex: 1 }]}>
48
49
  {title}
49
50
  </Text>
50
- <TouchableOpacity onPress={onClose} hitSlop={{ top: 10, bottom: 10, left: 10, right: 10 }}>
51
+ <TouchableOpacity onPress={onClose} hitSlop={{ top: 12, bottom: 12, left: 12, right: 12 }}>
51
52
  <MaterialIcons name="close" size={24} color={theme.text.neutral.primary} />
52
53
  </TouchableOpacity>
53
54
  </View>
54
55
 
55
56
  {/* Body */}
56
- <ScrollView style={styles.body} bounces={false}>
57
+ <ScrollView style={[styles.body, {padding: theme.space.sm}]} bounces={false}>
57
58
  {message && (
58
59
  <Text style={[
59
60
  theme.typography.regular.md,
@@ -67,7 +68,7 @@ export const CDSModal = ({
67
68
 
68
69
  {/* Footer - Solo se muestra si es interactive */}
69
70
  {type === 'interactive' && (
70
- <View style={[styles.footer, { gap: theme.space.sm }]}>
71
+ <View style={[styles.footer, { gap: theme.space.sm, padding: theme.space.sm }]}>
71
72
  {onPressSecondary && (
72
73
  <CDSButton
73
74
  label={labelSecondary}
@@ -92,10 +93,8 @@ export const CDSModal = ({
92
93
  const styles = StyleSheet.create({
93
94
  modalOverlay: {
94
95
  flex: 1,
95
- backgroundColor: 'rgba(0,0,0,0.6)',
96
96
  justifyContent: 'center',
97
97
  alignItems: 'center',
98
- padding: 24
99
98
  },
100
99
  modalContent: {
101
100
  width: '100%',
@@ -104,37 +103,19 @@ const styles = StyleSheet.create({
104
103
  optionsContainer: {
105
104
  width: '100%',
106
105
  overflow: 'hidden',
107
- elevation: 5,
108
- shadowColor: '#000',
109
- shadowOffset: { width: 0, height: 4 },
110
- shadowOpacity: 0.3,
111
- shadowRadius: 4.65,
112
106
  },
113
107
  modalHeader: {
114
108
  flexDirection: 'row',
115
109
  justifyContent: 'space-between',
116
110
  alignItems: 'center',
117
- padding: 16,
118
111
  borderBottomWidth: 1,
119
112
  },
120
113
  body: {
121
- padding: 16,
122
114
  maxHeight: 400,
123
115
  },
124
116
  footer: {
125
117
  flexDirection: 'row',
126
118
  justifyContent: 'flex-end',
127
- padding: 16,
128
119
  alignItems: 'center'
129
120
  },
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
121
  });
@@ -14,7 +14,7 @@ export const CDSSelect = ({ label, options = [], onSelect, selectedValue = null,
14
14
  );
15
15
 
16
16
  // Altura fija por cada fila (puedes ajustarla según tu diseño)
17
- const ITEM_HEIGHT = 52;
17
+ const ITEM_HEIGHT = 48;
18
18
  // Mostramos 7.5 opciones para que la última se vea cortada y sugiera scroll
19
19
  const MAX_VISIBLE_OPTIONS = 7.5;
20
20
  const MAX_HEIGHT = ITEM_HEIGHT * MAX_VISIBLE_OPTIONS;
@@ -66,20 +66,21 @@ export const CDSSelect = ({ label, options = [], onSelect, selectedValue = null,
66
66
  onRequestClose={() => setModalVisible(false)}
67
67
  >
68
68
  <Pressable
69
- style={styles.modalOverlay}
69
+ style={[styles.modalOverlay, {backgroundColor: theme.surface.special.overlay, padding: theme.space.lg}]}
70
70
  onPress={() => setModalVisible(false)}
71
71
  >
72
72
  <SafeAreaView style={styles.modalContent}>
73
73
  <View style={[
74
74
  styles.optionsContainer,
75
75
  {
76
+ boxShadow: theme.shadows.lg,
76
77
  backgroundColor: theme.surface.neutral.primary,
77
78
  borderRadius: theme.radius.md,
78
- maxHeight: MAX_HEIGHT + 60 // +60 para compensar el header del modal
79
+ maxHeight: MAX_HEIGHT + 54
79
80
  }
80
81
  ]}>
81
82
  {/* Header del Modal */}
82
- <View style={[styles.modalHeader, { borderBottomColor: theme.outline.neutral.primary }]}>
83
+ <View style={[styles.modalHeader, { borderBottomColor: theme.outline.neutral.primary, padding: theme.space.sm }]}>
83
84
  <Text style={theme.typography.semiBold.md}>{'Selecciona una opción'}</Text>
84
85
  <TouchableOpacity onPress={() => setModalVisible(false)} hitSlop={{top: 10, bottom: 10, left: 10, right: 10}}>
85
86
  <MaterialIcons name="close" size={24} color={theme.text.neutral.primary} />
@@ -100,7 +101,9 @@ export const CDSSelect = ({ label, options = [], onSelect, selectedValue = null,
100
101
  styles.optionItem,
101
102
  {
102
103
  height: ITEM_HEIGHT,
103
- backgroundColor: selectedItem?.value === item.value ? theme.surface.neutral.secondary : 'transparent'
104
+ backgroundColor: selectedItem?.value === item.value ? theme.surface.neutral.secondary : 'transparent',
105
+ paddingHorizontal: theme.space.sm
106
+
104
107
  }
105
108
  ]}
106
109
  >
@@ -126,10 +129,8 @@ const styles = StyleSheet.create({
126
129
  inputContainer: { width: '100%', height: 48, borderWidth: 1, flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between' },
127
130
  modalOverlay: {
128
131
  flex: 1,
129
- backgroundColor: 'rgba(0,0,0,0.6)', // Un poco más oscuro para mejor enfoque
130
132
  justifyContent: 'center',
131
133
  alignItems: 'center',
132
- padding: 24
133
134
  },
134
135
  modalContent: {
135
136
  width: '100%',
@@ -138,21 +139,14 @@ const styles = StyleSheet.create({
138
139
  optionsContainer: {
139
140
  width: '100%',
140
141
  overflow: 'hidden',
141
- elevation: 5,
142
- shadowColor: '#000',
143
- shadowOffset: { width: 0, height: 4 },
144
- shadowOpacity: 0.3,
145
- shadowRadius: 4.65,
146
142
  },
147
143
  modalHeader: {
148
144
  flexDirection: 'row',
149
145
  justifyContent: 'space-between',
150
146
  alignItems: 'center',
151
- padding: 16,
152
147
  borderBottomWidth: 1,
153
148
  },
154
149
  optionItem: {
155
- paddingHorizontal: 16,
156
150
  flexDirection: 'row',
157
151
  justifyContent: 'space-between',
158
152
  alignItems: 'center',
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cdslibrary",
3
3
  "license": "0BSD",
4
- "version": "1.2.92",
4
+ "version": "1.2.94",
5
5
  "main": "index.js",
6
6
  "author": "Nat Viramontes",
7
7
  "description": "A library of components for the CDS project",