cdslibrary 1.2.99 → 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
|
-
|
|
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({
|
|
@@ -34,7 +36,6 @@ export const CDSImageButton = ({ object, isActive, onPress, hasHelper, helperMes
|
|
|
34
36
|
setTooltipVisible(true);
|
|
35
37
|
};
|
|
36
38
|
|
|
37
|
-
console.log(isGrid)
|
|
38
39
|
return (
|
|
39
40
|
<>
|
|
40
41
|
<TouchableOpacity
|
|
@@ -43,7 +44,7 @@ export const CDSImageButton = ({ object, isActive, onPress, hasHelper, helperMes
|
|
|
43
44
|
style={[
|
|
44
45
|
styles.mainContainer,
|
|
45
46
|
{
|
|
46
|
-
width: isGrid ? 192 : 'auto'
|
|
47
|
+
width: isGrid ? 192 : 'auto',
|
|
47
48
|
maxWidth: isGrid ? 192 : 160,
|
|
48
49
|
backgroundColor: isActive
|
|
49
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/components/CDSSelect.jsx
CHANGED