cdslibrary 1.2.38 → 1.2.40

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'
@@ -84,7 +84,7 @@ export const CDSSelect = ({ label, options = [], onSelect, selectedValue = null
84
84
 
85
85
  return (
86
86
  <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>}
87
+ {label && <Text style={[theme.typography.label, { color: theme.text.neutral.primary, marginBottom: theme.space.sm }]}>{label}</Text>}
88
88
 
89
89
  <TouchableOpacity
90
90
  activeOpacity={0.8}
@@ -94,7 +94,7 @@ export const CDSSelect = ({ label, options = [], onSelect, selectedValue = null
94
94
  backgroundColor: theme.surface.neutral.primary,
95
95
  borderColor: selectedItem ? theme.outline.neutral.tertiaryVariant : theme.outline.neutral.primary,
96
96
  borderRadius: theme.radius.sm,
97
- paddingHorizontal: theme.space.xs
97
+ paddingHorizontal: theme.space.sm
98
98
  }
99
99
  ]}
100
100
  onPress={toggleDropdown}
@@ -110,7 +110,7 @@ export const CDSSelect = ({ label, options = [], onSelect, selectedValue = null
110
110
  style={[
111
111
  styles.dropdownInline,
112
112
  {
113
- marginTop: theme.space.xs,
113
+ marginTop: theme.space.sm,
114
114
  backgroundColor: theme.surface.neutral.primary,
115
115
  borderRadius: theme.radius.sm,
116
116
  borderColor: theme.outline.neutral.primary,
@@ -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.38",
4
+ "version": "1.2.40",
5
5
  "main": "index.js",
6
6
  "author": "Nat Viramontes",
7
7
  "description": "A library of components for the CDS project",
@@ -90,35 +90,35 @@ export const CDSprimitiveFontValues = {
90
90
  size: {
91
91
  typography: {
92
92
  mobile: {
93
- xs: 12,
94
- sm: 14,
95
- md: 17,
96
- lg: 21,
97
- xl: 25,
98
- "2xl": 30,
99
- "3xl": 36,
93
+ xs: 12, // Captions
94
+ sm: 14, // Etiquetas secundarias
95
+ md: 16, // BASE: Inputs y Párrafos
96
+ lg: 20, // H3 / Títulos pequeños
97
+ xl: 25, // H2 / Títulos medianos
98
+ "2xl": 31, // H1 / Títulos grandes
99
+ "3xl": 39, // Hero
100
100
  },
101
101
  desktop: {
102
102
  xs: 14,
103
103
  sm: 16,
104
- md: 21,
105
- lg: 27,
106
- xl: 36,
107
- "2xl": 47,
108
- "3xl": 61,
104
+ md: 18, // Base desktop más cómoda
105
+ lg: 24,
106
+ xl: 32,
107
+ "2xl": 48,
108
+ "3xl": 64,
109
109
  },
110
110
  },
111
111
  iconography: {
112
112
  mobile: {
113
- xs: 14,
114
- sm: 18,
115
- md: 22,
116
- lg: 40,
113
+ xs: 14, // Para acompañar texto xs/sm
114
+ sm: 20, // Estándar para botones pequeños
115
+ md: 24, // Estándar de la industria para botones y menú
116
+ lg: 32, // Iconos destacados
117
117
  },
118
118
  desktop: {
119
119
  xs: 16,
120
- sm: 20,
121
- md: 24,
120
+ sm: 24,
121
+ md: 32,
122
122
  lg: 48,
123
123
  },
124
124
  },
@@ -126,40 +126,45 @@ export const CDSprimitiveFontValues = {
126
126
 
127
127
  lineHeight: {
128
128
  mobile: {
129
- sm: 18,
129
+ xs: 16,
130
+ sm: 20,
130
131
  md: 24,
131
132
  lg: 28,
132
- xl: 31,
133
- "2xl": 38,
134
- "3xl": 44,
133
+ xl: 32,
134
+ "2xl": 40,
135
+ "3xl": 48,
135
136
  },
136
137
  desktop: {
137
- sm: 18,
138
+ xs: 18,
139
+ sm: 24,
138
140
  md: 28,
139
- lg: 35,
140
- xl: 43,
141
+ lg: 32,
142
+ xl: 40,
141
143
  "2xl": 56,
142
- "3xl": 71,
144
+ "3xl": 72,
143
145
  },
144
146
  },
145
147
  };
146
148
 
147
149
  export const CDSPrimiviteRadius = {
148
- none: 0,
149
- sm: 8,
150
- md: 16,
151
- lg: 24,
150
+ none: 0,
151
+ xs: 4, // Detalles mínimos
152
+ sm: 12, // Botones e Inputs (más suave que 8px)
153
+ md: 20, // Tarjetas y modales (se ve muy premium en móvil)
154
+ lg: 32, // BottomSheets (el estándar de Apple para hojas que suben)
155
+ xl: 40, // Contenedores muy grandes o secciones decorativas
152
156
  full: 9999,
153
157
  };
154
158
 
155
159
  export const CDSPrimitiveSpacing =
156
160
  {
157
161
  none: { mobile: 0, desktop: 0 },
158
- xs: { mobile: 8, desktop: 16 },
159
- sm: { mobile: 16, desktop: 24 },
160
- md: { mobile: 24, desktop: 32 },
161
- lg: { mobile: 32, desktop: 48 },
162
- xl: { mobile: 48, desktop: 64 },
162
+ xs: { mobile: 4, desktop: 8 }, // Micro-ajustes (icon+text)
163
+ sm: { mobile: 8, desktop: 12 }, // Entre elementos pequeños
164
+ md: { mobile: 16, desktop: 24 }, // Padding interno de tarjetas
165
+ lg: { mobile: 24, desktop: 32 }, // Espacio entre secciones
166
+ xl: { mobile: 32, desktop: 48 }, // Márgenes de página
167
+ "2xl": { mobile: 48, desktop: 64 }, // Espacios hero
163
168
  };
164
169
 
165
170
  export const CDSPrimitiveShadows = (mode) => ({
@@ -168,7 +173,7 @@ export const CDSPrimitiveShadows = (mode) => ({
168
173
  boxShadow: `0px 2px 4px ${mode === 'dark' ? 'rgba(0,0,0,0.4)' : 'rgba(0,0,0,0.08)'}`,
169
174
  elevation: 3, // Indispensable para Android nativo
170
175
  },
171
-
176
+
172
177
  lg: {
173
178
  // Sombra más elegante con más blur (8px) y desplazamiento (4px)
174
179
  boxShadow: `0px 4px 12px ${mode === 'dark' ? 'rgba(0,0,0,0.6)' : 'rgba(0,0,0,0.15)'}`,
@@ -178,7 +183,7 @@ export const CDSPrimitiveShadows = (mode) => ({
178
183
 
179
184
  export const resolveTokens = (primitives, isMobile) => {
180
185
  const resolved = {};
181
-
186
+
182
187
  for (const key in primitives) {
183
188
  const value = primitives[key];
184
189
  // Si el valor tiene la estructura { mobile, desktop }, elegimos uno
@@ -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
  },