@sit-onyx/headless 1.0.0-alpha.8 → 1.0.0-alpha.9
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
|
@@ -54,8 +54,10 @@ export type CreateComboboxOptions<
|
|
|
54
54
|
templateRef: Ref<HTMLElement | undefined>;
|
|
55
55
|
/**
|
|
56
56
|
* Hook when the popover should toggle.
|
|
57
|
+
*
|
|
58
|
+
* @param preventFocus If `true`, the parent combobox should not be focused (e.g. on outside click).
|
|
57
59
|
*/
|
|
58
|
-
onToggle?: () => void;
|
|
60
|
+
onToggle?: (preventFocus?: boolean) => void;
|
|
59
61
|
/**
|
|
60
62
|
* Hook when an option is (un-)selected.
|
|
61
63
|
*/
|
|
@@ -217,7 +219,7 @@ export const createComboBox = createBuilder(
|
|
|
217
219
|
queryComponent: () => templateRef.value,
|
|
218
220
|
onOutsideClick() {
|
|
219
221
|
if (!isExpanded.value) return;
|
|
220
|
-
onToggle?.();
|
|
222
|
+
onToggle?.(true);
|
|
221
223
|
},
|
|
222
224
|
});
|
|
223
225
|
|
|
@@ -231,6 +233,8 @@ export const createComboBox = createBuilder(
|
|
|
231
233
|
listbox: computed(() => ({
|
|
232
234
|
...listbox.value,
|
|
233
235
|
id: controlsId,
|
|
236
|
+
// preventDefault to not lose focus of the combobox
|
|
237
|
+
onMousedown: (e) => e.preventDefault(),
|
|
234
238
|
})),
|
|
235
239
|
/**
|
|
236
240
|
* An input that controls another element, that can dynamically pop-up to help the user set the value of the input.
|
|
@@ -253,7 +257,7 @@ export const createComboBox = createBuilder(
|
|
|
253
257
|
*/
|
|
254
258
|
button: computed(() => ({
|
|
255
259
|
tabindex: "-1",
|
|
256
|
-
onClick: onToggle,
|
|
260
|
+
onClick: () => onToggle?.(),
|
|
257
261
|
})),
|
|
258
262
|
},
|
|
259
263
|
};
|