cdslibrary 1.2.40 → 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.
@@ -76,10 +76,18 @@ 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 (
@@ -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
  />
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cdslibrary",
3
3
  "license": "0BSD",
4
- "version": "1.2.40",
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",