cdslibrary 1.2.84 → 1.2.85

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.
@@ -73,17 +73,24 @@ const bottomSheetRender = ({
73
73
 
74
74
  useEffect(() => {
75
75
  if (isVisible) {
76
+ // Animación de Entrada
76
77
  translation.value = withTiming(0, {
77
78
  duration: 300,
78
79
  easing: Easing.out(Easing.exp),
79
80
  });
80
81
  opacity.value = withTiming(1, { duration: 200 });
82
+ } else {
83
+ // Animación de Salida (ESTO ES LO QUE FALTABA)
84
+ translation.value = withTiming(startPos, { duration: 300 });
85
+ opacity.value = withTiming(0, { duration: 300 });
81
86
  }
82
- }, [isVisible]);
87
+ }, [isVisible, startPos]); // Asegúrate de incluir startPos
83
88
 
84
- const animatedStyle = useAnimatedStyle(() => {
89
+ const animatedStyle = useAnimatedStyle(() => {
85
90
  return {
86
91
  opacity: opacity.value,
92
+ // Ocultamos el layout completamente si terminó de salir
93
+ display: (translation.value >= startPos && !isVisible) ? 'none' : 'flex',
87
94
  transform: [
88
95
  isMobile
89
96
  ? { translateY: translation.value }
@@ -94,15 +101,24 @@ const bottomSheetRender = ({
94
101
 
95
102
  const backdropStyle = useAnimatedStyle(() => {
96
103
  const currentY = translation.value;
97
- const opacityVal = interpolate(currentY, [0, height], [1, 0], Extrapolation.CLAMP);
104
+ // Si está en la posición inicial (startPos), la opacidad es 0
105
+ const opacityVal = interpolate(
106
+ currentY,
107
+ [0, startPos],
108
+ [1, 0],
109
+ Extrapolation.CLAMP
110
+ );
111
+
98
112
  return {
99
113
  opacity: opacityVal,
114
+ display: opacityVal <= 0 ? 'none' : 'flex',
100
115
  };
101
116
  });
102
117
 
103
118
  return (
104
119
  <>
105
120
  <Animated.View
121
+ pointerEvents={isVisible ? "auto" : "none"} // Evita clics fantasma
106
122
  style={[
107
123
  styles.overlay,
108
124
  { backgroundColor: theme.surface.special.overlay },
@@ -111,7 +127,6 @@ const bottomSheetRender = ({
111
127
  >
112
128
  <Pressable onPress={() => runOnJS(handleClose)()} style={{ flex: 1 }} />
113
129
  </Animated.View>
114
-
115
130
  <Animated.View
116
131
  style={[
117
132
  isMobile ? styles.container.typeBottomSheet : styles.container.typeDrawer,
@@ -213,17 +228,20 @@ const styles = StyleSheet.create({
213
228
  left: 0,
214
229
  right: 0,
215
230
  zIndex: 99,
216
- ...Platform.select({web:{maxHeight: '95%'}})
231
+ ...Platform.select({ web: { maxHeight: '95%' } })
217
232
  },
218
233
  typeDrawer: {
219
234
  position: "absolute",
220
235
  right: 0,
221
- top: 0,
222
236
  bottom: 0,
223
237
  width: 600,
238
+ maxHeight: height * .95, // Evita que se salga de la pantalla si hay mucho texto
224
239
  zIndex: 99,
225
240
  ...Platform.select({
226
- web: { boxShadow: '-10px 0px 15px rgba(0,0,0,0.1)' }
241
+ web: {
242
+ boxShadow: '-10px 0px 15px rgba(0,0,0,0.1)',
243
+ height: 'auto', // En web forzamos que sea auto
244
+ }
227
245
  })
228
246
  },
229
247
  },
@@ -232,7 +250,7 @@ const styles = StyleSheet.create({
232
250
  width: '100%',
233
251
  },
234
252
  scrollArea: {
235
- width: '100%', // Quitamos el flex: 1 de aquí para que sea dinámico
253
+ width: '100%',
236
254
  },
237
255
  scrollContent: {
238
256
  gap: 16,
@@ -80,6 +80,7 @@ const animatedLayout = {
80
80
  backgroundColor: currentStyle.bg,
81
81
  borderColor: currentStyle.border,
82
82
  borderRadius: theme.radius.md,
83
+ borderWidth: 1,
83
84
  paddingHorizontal: theme.space.md,
84
85
  gap: theme.space.sm,
85
86
  overflow: 'hidden', // Evita que el texto se salga mientras se achica
@@ -29,7 +29,7 @@ export const CDSInput = ({ label, type, keyboard, placeholder, value, onChangeTe
29
29
  const handleTextChange = (inputText) => {
30
30
  isInternalChange.current = true;
31
31
 
32
- if (keyboard === "numeric" || keyboard === "decimal-pad") {
32
+ if (keyboard === "decimal-pad") {
33
33
  let cleaned = inputText.replace(',', '.').replace(/[^0-9.]/g, "");
34
34
  const parts = cleaned.split('.');
35
35
  if (parts.length > 2) cleaned = parts[0] + '.' + parts.slice(1).join('');
@@ -57,6 +57,7 @@ export const CDSInput = ({ label, type, keyboard, placeholder, value, onChangeTe
57
57
  };
58
58
  });
59
59
 
60
+
60
61
  return (
61
62
  <View style={styles.container}>
62
63
  {label && (
@@ -91,7 +92,7 @@ export const CDSInput = ({ label, type, keyboard, placeholder, value, onChangeTe
91
92
  ]}
92
93
  placeholder={placeholder}
93
94
  placeholderTextColor={theme.text.neutral.placeholder}
94
- keyboardType={keyboard === "numeric" ? (Platform.OS === 'ios' ? 'decimal-pad' : 'numeric') : keyboard}
95
+ keyboardType={keyboard}
95
96
  onChangeText={handleTextChange}
96
97
  value={value}
97
98
  editable={type !== 'readOnly'}
@@ -9,7 +9,7 @@ export const CDSSwitch = ({ label, onValueChange, value }) => {
9
9
  <View style={[styles.container, { }]}>
10
10
  {label && (
11
11
  <Text style={[
12
- theme.typography.label,
12
+ theme.typography.regular.md,
13
13
  { color: theme.text.neutral.primary, flex: 1, marginRight: theme.space.md }
14
14
  ]}>
15
15
  {label}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cdslibrary",
3
3
  "license": "0BSD",
4
- "version": "1.2.84",
4
+ "version": "1.2.85",
5
5
  "main": "index.js",
6
6
  "author": "Nat Viramontes",
7
7
  "description": "A library of components for the CDS project",