cdslibrary 1.2.100 → 1.2.101

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.
@@ -10,7 +10,7 @@ import Animated, {
10
10
  import { useTheme } from "../context/CDSThemeContext";
11
11
  import { MaterialCommunityIcons } from "@expo/vector-icons";
12
12
 
13
- export const CDSAccordion = ({ title, description, children, defaultExpanded = false }) => {
13
+ export const CDSAccordion = ({ title, description, children, defaultExpanded = false, onToggle }) => {
14
14
  const { theme } = useTheme();
15
15
  const [expanded, setExpanded] = useState(defaultExpanded);
16
16
  const [contentHeight, setContentHeight] = useState(0); // Altura real medida
@@ -21,6 +21,10 @@ export const CDSAccordion = ({ title, description, children, defaultExpanded = f
21
21
  const newValue = !expanded;
22
22
  setExpanded(newValue);
23
23
 
24
+ if (onToggle) {
25
+ onToggle(newValue);
26
+ }
27
+
24
28
  animation.value = withTiming(newValue ? 1 : 0, {
25
29
  duration: 250,
26
30
  easing: Easing.bezier(0.4, 0, 0.2, 1)
@@ -88,7 +92,7 @@ export const CDSAccordion = ({ title, description, children, defaultExpanded = f
88
92
  {/* CONTENEDOR DE MEDICIÓN: Es invisible y absoluto, solo sirve para saber cuánto mide el children */}
89
93
  <View
90
94
  onLayout={onLayout}
91
- style={[styles.measureContainer, {pointerEvents: 'none'}]}
95
+ style={[styles.measureContainer, { pointerEvents: 'none' }]}
92
96
  >
93
97
  <View style={{ paddingVertical: theme.space.md, gap: theme.space.md }}>
94
98
  {description && (
@@ -136,7 +140,7 @@ const styles = StyleSheet.create({
136
140
  position: 'absolute',
137
141
  left: 16,
138
142
  right: 16,
139
- opacity: 0,
143
+ opacity: 0,
140
144
  },
141
145
  paddingWrapper: {
142
146
  paddingBottom: 16,
@@ -4,7 +4,7 @@ import { MaterialIcons } from "@expo/vector-icons";
4
4
  import { useTheme } from "../context/CDSThemeContext";
5
5
  import { CDSTooltip } from "./CDSTooltip"; // Asegúrate de importar tu Tooltip
6
6
 
7
- export const CDSImageButton = ({ object, isActive, onPress, hasHelper, helperMessage, arrowAlignment, isGrid }) => {
7
+ export const CDSImageButton = ({ object, isActive, onPress, hasHelper, onPressHelper, helperMessage, arrowAlignment, isGrid }) => {
8
8
  const { theme } = useTheme();
9
9
 
10
10
  // Estados para controlar el Tooltip interno
@@ -12,7 +12,9 @@ export const CDSImageButton = ({ object, isActive, onPress, hasHelper, helperMes
12
12
  const [tooltipPos, setTooltipPos] = useState({ x: 0, y: 0 });
13
13
 
14
14
  const handleHelperPress = (event) => {
15
- // Si estamos en Web, usamos getBoundingClientRect para precisión total
15
+ if (onPressHelper) {
16
+ onPressHelper(object);
17
+ }
16
18
  if (event.target && event.target.getBoundingClientRect) {
17
19
  const rect = event.target.getBoundingClientRect();
18
20
  setTooltipPos({
@@ -42,7 +44,7 @@ export const CDSImageButton = ({ object, isActive, onPress, hasHelper, helperMes
42
44
  style={[
43
45
  styles.mainContainer,
44
46
  {
45
- width: isGrid ? 192 : 'auto' ,
47
+ width: isGrid ? 192 : 'auto',
46
48
  maxWidth: isGrid ? 192 : 160,
47
49
  backgroundColor: isActive
48
50
  ? theme.surface.neutral.primaryVariant
@@ -3,7 +3,7 @@ import { View, Animated, StyleSheet, ScrollView } from 'react-native';
3
3
  import { CDSImageButton } from './CDSImageButton';
4
4
  import { useTheme } from "../context/CDSThemeContext";
5
5
 
6
- export const CDSImageButtonGroup = ({ array, onSelect, isCentered, isGrid }) => {
6
+ export const CDSImageButtonGroup = ({ array, onSelect, isCentered, isGrid, onPressHelper }) => {
7
7
  const { theme } = useTheme();
8
8
  const isMobile = theme.isMobile
9
9
  const [selectedId, setSelectedId] = useState(null);
@@ -73,6 +73,7 @@ export const CDSImageButtonGroup = ({ array, onSelect, isCentered, isGrid }) =>
73
73
  onPress={() => handlePress(item.id)}
74
74
  hasHelper={!!item.helper}
75
75
  helperMessage={item.helper}
76
+ onPressHelper={onPressHelper}
76
77
  arrowAlignment={item.arrowAlignment}
77
78
  // Opcional: Ajustar ancho en grid
78
79
  style={isGrid ? { width: '47%' } : undefined}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cdslibrary",
3
3
  "license": "0BSD",
4
- "version": "1.2.100",
4
+ "version": "1.2.101",
5
5
  "main": "index.js",
6
6
  "author": "Nat Viramontes",
7
7
  "description": "A library of components for the CDS project",