cdslibrary 1.2.39 → 1.2.41

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.
@@ -89,7 +89,7 @@ export const CDSAccordion = ({ title, description, children, defaultExpanded = f
89
89
  style={styles.measureContainer}
90
90
  pointerEvents="none"
91
91
  >
92
- <View style={{ paddingVertical: theme.space.sm, gap: theme.space.md }}>
92
+ <View style={{ paddingVertical: theme.space.md, gap: theme.space.md }}>
93
93
  {description && (
94
94
  <Text style={[styles.description, theme.typography.regular.sm]}>
95
95
  {description}
@@ -100,7 +100,7 @@ export const CDSAccordion = ({ title, description, children, defaultExpanded = f
100
100
  </View>
101
101
 
102
102
  {/* CONTENEDOR VISIBLE: El que el usuario realmente ve animarse */}
103
- <View style={{ paddingVertical: theme.space.sm, gap: theme.space.md }}>
103
+ <View style={{ paddingVertical: theme.space.md, gap: theme.space.md }}>
104
104
  {description && (
105
105
  <Text style={[styles.description, theme.typography.regular.sm]}>
106
106
  {description}
@@ -76,9 +76,9 @@ export const CDSBottomSheet = ({
76
76
  isMobile ? { translateY: slidePosition } : { translateX: slidePosition }
77
77
  ],
78
78
  backgroundColor: theme.surface.neutral.primary,
79
- paddingHorizontal: theme.space.sm,
79
+ paddingHorizontal: theme.space.md,
80
80
  paddingTop: theme.space.xl,
81
- gap: theme.space.sm,
81
+ gap: theme.space.md,
82
82
  ...(isMobile ? {
83
83
  borderTopLeftRadius: theme.radius.lg,
84
84
  borderTopRightRadius: theme.radius.lg,
@@ -96,7 +96,7 @@ export const CDSBottomSheet = ({
96
96
  size={theme.typography.icon.lg}
97
97
  color={theme.text.neutral.primary}
98
98
  onPress={handleClose}
99
- style={{ position: "absolute", right: theme.space.sm, top: theme.space.sm, zIndex: 10 }}
99
+ style={{ position: "absolute", right: theme.space.md, top: theme.space.md, zIndex: 10 }}
100
100
  />
101
101
  )}
102
102
 
@@ -38,7 +38,7 @@ export const CDSButton = ({
38
38
  activeOpacity={0.7}
39
39
  style={[
40
40
  styles.container,
41
- { flexGrow: (variant === "fill" || isMobile ? 1 : 0), maxHeight: (variant === "fill" || isMobile ? 48 : 56), alignSelf: (variant === "fill" || isMobile) ? "stretch" : "center", paddingHorizontal: type === "icon" ? theme.space.xs : theme.space.sm, paddingVertical: theme.space.xs, backgroundColor, borderRadius: theme.radius.full, gap: theme.space.xs, },
41
+ { flexGrow: (variant === "fill" || isMobile ? 1 : 0), maxHeight: (variant === "fill" || isMobile ? 48 : 56), alignSelf: (variant === "fill" || isMobile) ? "stretch" : "center", paddingHorizontal: type === "icon" ? theme.space.sm : theme.space.md, paddingVertical: theme.space.sm, backgroundColor, borderRadius: theme.radius.full, gap: theme.space.sm, },
42
42
  flexend && { justifyContent: "flex-end", paddingHorizontal: 0 },
43
43
  type === "secondary" && {
44
44
  borderColor: theme.outline.action.primary,
@@ -24,9 +24,9 @@ export const CDSButtonGroup = ({ options, onSelect, label = 'Label', selected =
24
24
  };
25
25
 
26
26
  return (
27
- <View style={[styles.container, { gap: theme.space.xs }]}>
27
+ <View style={[styles.container, { gap: theme.space.sm }]}>
28
28
  <Text style={[theme.typography.label]}>{label}</Text>
29
- <View style={[styles.actionsContainer, { gap: theme.space.xs }]}>
29
+ <View style={[styles.actionsContainer, { gap: theme.space.sm }]}>
30
30
  {options.map((option, index) => (
31
31
  <CDSButton
32
32
  key={index}
@@ -70,8 +70,8 @@ export const CDSCardFeedback = ({
70
70
  backgroundColor: currentStyle.bg,
71
71
  borderColor: currentStyle.border,
72
72
  borderRadius: theme.radius.md,
73
- padding: theme.space.sm,
74
- gap: theme.space.xs,
73
+ padding: theme.space.md,
74
+ gap: theme.space.sm,
75
75
  opacity: fadeAnim,
76
76
  transform: [{
77
77
  scale: fadeAnim.interpolate({
@@ -81,7 +81,7 @@ export const CDSCardFeedback = ({
81
81
  }]
82
82
  }]}>
83
83
 
84
- {title && <View style={[styles.titleContainer, { gap: theme.space.xs }]}>
84
+ {title && <View style={[styles.titleContainer, { gap: theme.space.sm }]}>
85
85
  <MaterialIcons
86
86
  name={currentStyle.icon}
87
87
  size={theme.typography.icon.md}
@@ -90,7 +90,7 @@ export const CDSCardFeedback = ({
90
90
  <Text style={[styles.title, theme.typography.bold.lg, { color: currentStyle.text }]}>{title}</Text>
91
91
  </View>}
92
92
  {description && <Text style={[styles.description, theme.typography.regular.md, { color: currentStyle.text }]}>{description}</Text>}
93
- <View style={[styles.actionsContainer, { gap: theme.space.xs }]}>
93
+ <View style={[styles.actionsContainer, { gap: theme.space.sm }]}>
94
94
  {secondAction && <TouchableOpacity onPress={onPressSecondAction}>{<Text style={[theme.typography.bold.sm, { color: currentStyle.text }]}>{secondAction}</Text>}</TouchableOpacity>}
95
95
  <TouchableOpacity onPress={() => {
96
96
  handleClose()
@@ -17,8 +17,8 @@ export const CDSImageButton = ({ object, isActive, onPress }) => { // 👈 Añad
17
17
  backgroundColor: isActive
18
18
  ? theme.surface.neutral.primaryVariant // Color cuando está presionado
19
19
  : theme.surface.neutral.primary,
20
- gap: theme.space.xs,
21
- padding: theme.space.xs,
20
+ gap: theme.space.sm,
21
+ padding: theme.space.sm,
22
22
  // borderColor: isActive
23
23
  // ? theme.outline.neutral.primary // Borde de color de marca si está activo
24
24
  // : theme.outline.neutral.primary,
@@ -25,7 +25,7 @@ export const CDSInput = ({ label, type, keyboard, placeholder, value, onChangeTe
25
25
  };
26
26
 
27
27
  return (
28
- <View style={[styles.container, { gap: theme.space.xs }]}>
28
+ <View style={[styles.container, { gap: theme.space.sm }]}>
29
29
  {label && (
30
30
  <Text style={[theme.typography.label, { color: theme.text.neutral.primary }]}>
31
31
  {label}
@@ -44,7 +44,7 @@ export const CDSInput = ({ label, type, keyboard, placeholder, value, onChangeTe
44
44
  : value ? theme.outline.neutral.tertiaryVariant // Cambiado 'text' por 'value'
45
45
  : theme.outline.neutral.primary,
46
46
  borderRadius: theme.radius.sm,
47
- paddingHorizontal: theme.space.xs,
47
+ paddingHorizontal: theme.space.sm,
48
48
  color: theme.text.neutral.primary,
49
49
  outlineStyle: 'none',
50
50
 
@@ -12,19 +12,19 @@ export const CDSOffer = ({ description, minValue, maxValue }) => {
12
12
  const { theme } = useTheme();
13
13
  console.log(theme)
14
14
  return (
15
- <View style={[styles.mainContainer, { gap: theme.space.sm }]}>
15
+ <View style={[styles.mainContainer, { gap: theme.space.md }]}>
16
16
  <Text style={theme.typography.regular.md}>Por tu</Text>
17
17
  <Text style={theme.typography.semiBold.lg}>{description}</Text>
18
18
  <Text style={theme.typography.regular.md}>Hoy podrías obtener:</Text>
19
19
  <View style={[styles.minMaxContainer, { flexDirection: isMobile ? 'column' : 'row' }]}>
20
- <View style={[styles.containerMin, { backgroundColor: theme.surface.neutral.secondary, borderColor: theme.outline.neutral.tertiaryVariant, gap: theme.space.xs, padding: theme.space.sm, borderRadius: theme.radius.md }]}>
20
+ <View style={[styles.containerMin, { backgroundColor: theme.surface.neutral.secondary, borderColor: theme.outline.neutral.tertiaryVariant, gap: theme.space.sm, padding: theme.space.md, borderRadius: theme.radius.md }]}>
21
21
  <Text style={[theme.typography.regular.md, { color: theme.text.neutral.primary }]}>Desde</Text>
22
22
  <Text style={[theme.typography.h3, { textAlign: 'center', color: theme.text.neutral.primary }]}>{`$${parseFloat(minValue).toLocaleString('en-US', {
23
23
  minimumFractionDigits: 2,
24
24
  maximumFractionDigits: 2
25
25
  })}`}</Text>
26
26
  </View>
27
- <View style={[styles.containerMax, { marginTop: isMobile ? -theme.space.xs : 0, marginLeft: isMobile ? 0 : -theme.space.xl, backgroundColor: theme.surface.brand.primaryVariant, borderColor: theme.outline.brand.secondary, gap: theme.space.xs, padding: theme.space.sm, borderRadius: theme.radius.md }]}>
27
+ <View style={[styles.containerMax, { marginTop: isMobile ? -theme.space.sm : 0, marginLeft: isMobile ? 0 : -theme.space.xl, backgroundColor: theme.surface.brand.primaryVariant, borderColor: theme.outline.brand.secondary, gap: theme.space.sm, padding: theme.space.md, borderRadius: theme.radius.md }]}>
28
28
  <Text style={[theme.typography.regular.md, { color: theme.text.brand.primary }]}>Hasta</Text>
29
29
  <Text style={[theme.typography.h1, { textAlign: 'center', color: theme.text.brand.primary }]}>{`$${parseFloat(maxValue).toLocaleString('en-US', {
30
30
  minimumFractionDigits: 2,
@@ -19,7 +19,7 @@ const SelectOption = ({ item, isSelected, onSelect, theme }) => {
19
19
  style={({ pressed }) => [
20
20
  styles.optionItem,
21
21
  {
22
- paddingHorizontal: theme.space.xs,
22
+ paddingHorizontal: theme.space.sm,
23
23
  backgroundColor: (pressed || isHovered)
24
24
  ? theme.surface.neutral.secondary
25
25
  : isSelected ? theme.surface.neutral.tertiary : 'transparent'
@@ -76,15 +76,23 @@ export const CDSSelect = ({ label, options = [], onSelect, selectedValue = null
76
76
  }
77
77
  };
78
78
 
79
- const handleSelect = (item) => {
79
+ const handleSelect = (item) => {
80
+ // 1. Actualizamos localmente PRIMERO para que el cambio sea instantáneo
80
81
  setSelectedItem(item);
82
+
83
+ // 2. Cerramos el menú
81
84
  toggleDropdown();
82
- if (onSelect) onSelect(item.value);
85
+
86
+ // 3. Notificamos al padre
87
+ if (onSelect) {
88
+ // Enviamos el valor (o el objeto, según prefieras)
89
+ onSelect(item.value);
90
+ }
83
91
  };
84
92
 
85
93
  return (
86
94
  <View style={styles.mainContainer} ref={containerRef} collapsable={false}>
87
- {label && <Text style={[theme.typography.label, { color: theme.text.neutral.primary, marginBottom: theme.space.xs }]}>{label}</Text>}
95
+ {label && <Text style={[theme.typography.label, { color: theme.text.neutral.primary, marginBottom: theme.space.sm }]}>{label}</Text>}
88
96
 
89
97
  <TouchableOpacity
90
98
  activeOpacity={0.8}
@@ -94,7 +102,7 @@ export const CDSSelect = ({ label, options = [], onSelect, selectedValue = null
94
102
  backgroundColor: theme.surface.neutral.primary,
95
103
  borderColor: selectedItem ? theme.outline.neutral.tertiaryVariant : theme.outline.neutral.primary,
96
104
  borderRadius: theme.radius.sm,
97
- paddingHorizontal: theme.space.xs
105
+ paddingHorizontal: theme.space.sm
98
106
  }
99
107
  ]}
100
108
  onPress={toggleDropdown}
@@ -110,7 +118,7 @@ export const CDSSelect = ({ label, options = [], onSelect, selectedValue = null
110
118
  style={[
111
119
  styles.dropdownInline,
112
120
  {
113
- marginTop: theme.space.xs,
121
+ marginTop: theme.space.sm,
114
122
  backgroundColor: theme.surface.neutral.primary,
115
123
  borderRadius: theme.radius.sm,
116
124
  borderColor: theme.outline.neutral.primary,
@@ -124,7 +132,7 @@ export const CDSSelect = ({ label, options = [], onSelect, selectedValue = null
124
132
  renderItem={({ item }) => (
125
133
  <SelectOption
126
134
  item={item}
127
- isSelected={item.value === selectedValue}
135
+ isSelected={selectedItem?.value === item.value}
128
136
  onSelect={handleSelect}
129
137
  theme={theme}
130
138
  />
@@ -32,7 +32,7 @@ export const CDSSnackBar = ({ message, visible, onDismiss, hasClose }) => {
32
32
  {
33
33
  backgroundColor: theme.surface.special.display,
34
34
  bottom: theme.space.lg,
35
- padding: theme.space.sm,
35
+ padding: theme.space.md,
36
36
  borderRadius: theme.radius.sm,
37
37
  }
38
38
  ]}
@@ -6,11 +6,11 @@ export const CDSSwitch = ({ label, onValueChange, value }) => {
6
6
  const { theme } = useTheme();
7
7
 
8
8
  return (
9
- <View style={[styles.container, { marginVertical: theme.space.xs }]}>
9
+ <View style={[styles.container, { marginVertical: theme.space.sm }]}>
10
10
  {label && (
11
11
  <Text style={[
12
12
  theme.typography.label,
13
- { color: theme.text.neutral.primary, flex: 1, marginRight: theme.space.sm }
13
+ { color: theme.text.neutral.primary, flex: 1, marginRight: theme.space.md }
14
14
  ]}>
15
15
  {label}
16
16
  </Text>
@@ -31,7 +31,7 @@ export const CDSTable = ({ columns, data, breakpoint = 500 }) => {
31
31
  key={`header-${index}`}
32
32
  style={[
33
33
  styles.cell,
34
- { padding: theme.space.xs },
34
+ { padding: theme.space.sm },
35
35
  col.width ? { width: col.width } : { flex: 1 }
36
36
  ]}
37
37
  >
@@ -57,7 +57,7 @@ export const CDSTable = ({ columns, data, breakpoint = 500 }) => {
57
57
  key={`cell-${rowIndex}-${colIndex}`}
58
58
  style={[
59
59
  styles.cell,
60
- { padding: theme.space.xs },
60
+ { padding: theme.space.sm },
61
61
  col.width ? { width: col.width } : { flex: 1 }
62
62
  ]}
63
63
  >
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cdslibrary",
3
3
  "license": "0BSD",
4
- "version": "1.2.39",
4
+ "version": "1.2.41",
5
5
  "main": "index.js",
6
6
  "author": "Nat Viramontes",
7
7
  "description": "A library of components for the CDS project",
@@ -142,14 +142,14 @@ export const getSemanticTextStyles = (theme, isMobile) => {
142
142
  inputText: {
143
143
  placeholder: {
144
144
  fontFamily: CDSprimitiveFontValues.family.interRegular,
145
- fontSize: getVal('size', 'sm'),
146
- lineHeight: getVal('lineHeight', 'sm'),
145
+ fontSize: getVal('size', 'md'),
146
+ lineHeight: getVal('lineHeight', 'md'),
147
147
  color: theme.text.neutral.placeholder,
148
148
  },
149
149
  value: {
150
150
  fontFamily: CDSprimitiveFontValues.family.interRegular,
151
- fontSize: getVal('size', 'sm'),
152
- lineHeight: getVal('lineHeight', 'sm'),
151
+ fontSize: getVal('size', 'md'),
152
+ lineHeight: getVal('lineHeight', 'md'),
153
153
  color: theme.text.neutral.primary,
154
154
  },
155
155
  },