@duro-app/ui 0.31.0 → 0.32.0
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.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@duro-app/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.32.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@duro-app/tokens": "^0.
|
|
56
|
+
"@duro-app/tokens": "^0.32.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@babel/preset-typescript": "^7.28.0",
|
|
@@ -190,12 +190,26 @@ export function useComboboxRoot({
|
|
|
190
190
|
item?.element.scrollIntoView({block: 'nearest'})
|
|
191
191
|
}, [highlightedId])
|
|
192
192
|
|
|
193
|
-
//
|
|
193
|
+
// Reconcile input text with the committed value once the popup closes.
|
|
194
|
+
// Three cases when transitioning from open → closed:
|
|
195
|
+
// - inputValue is empty: user cleared the field, treat that as
|
|
196
|
+
// "remove the selection" so the consumer's onValueChange fires
|
|
197
|
+
// with null and downstream UI (e.g. dependent fields) can reset.
|
|
198
|
+
// - inputValue doesn't match the selected label: user typed something
|
|
199
|
+
// but didn't pick anything; restore the label so the visible text
|
|
200
|
+
// and the committed value stay consistent.
|
|
201
|
+
// - inputValue equals the selected label: nothing to do.
|
|
194
202
|
useEffect(() => {
|
|
195
|
-
if (
|
|
203
|
+
if (open) return
|
|
204
|
+
if (value === null) return
|
|
205
|
+
if (inputValue === '') {
|
|
206
|
+
setValue(null)
|
|
207
|
+
return
|
|
208
|
+
}
|
|
209
|
+
if (labels[value] && inputValue !== labels[value]) {
|
|
196
210
|
setInputValue(labels[value])
|
|
197
211
|
}
|
|
198
|
-
}, [value, labels,
|
|
212
|
+
}, [open, value, labels, inputValue, setInputValue, setValue])
|
|
199
213
|
|
|
200
214
|
const ctx: ComboboxContextValue = useMemo(
|
|
201
215
|
() => ({
|