mertani-web-toolkit 0.1.51 → 0.1.52
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.
|
@@ -161,6 +161,7 @@
|
|
|
161
161
|
let showList = $state(false);
|
|
162
162
|
let activeIndex = $state(-1);
|
|
163
163
|
let wrapperEl: HTMLDivElement | null = $state(null);
|
|
164
|
+
let inputEl: HTMLInputElement | null = $state(null);
|
|
164
165
|
let searchByValue = $state(searchBy);
|
|
165
166
|
let searchByOpen = $state(false);
|
|
166
167
|
|
|
@@ -346,6 +347,7 @@
|
|
|
346
347
|
function closeSuggestions() {
|
|
347
348
|
showList = false;
|
|
348
349
|
activeIndex = -1;
|
|
350
|
+
inputEl?.blur();
|
|
349
351
|
}
|
|
350
352
|
|
|
351
353
|
function validateInput(value: string): string {
|
|
@@ -454,6 +456,9 @@
|
|
|
454
456
|
|
|
455
457
|
function selectSuggestion(item: { label: string; value: string; raw: SuggestionOption }) {
|
|
456
458
|
onSelectSuggestion?.(item.value, item.raw);
|
|
459
|
+
if (closeOnSelect) {
|
|
460
|
+
closeSuggestions();
|
|
461
|
+
}
|
|
457
462
|
}
|
|
458
463
|
|
|
459
464
|
function handleClickOutside(e: MouseEvent) {
|
|
@@ -543,6 +548,7 @@
|
|
|
543
548
|
</div>
|
|
544
549
|
{/if}
|
|
545
550
|
<input
|
|
551
|
+
bind:this={inputEl}
|
|
546
552
|
{id}
|
|
547
553
|
class="input-field"
|
|
548
554
|
style={inputStyles()}
|