diff --git a/src/lib/components/Input/Search.svelte b/src/lib/components/Input/Search.svelte new file mode 100644 index 0000000..e0588d5 --- /dev/null +++ b/src/lib/components/Input/Search.svelte @@ -0,0 +1,78 @@ + + +
+
+ {#if label} + + {/if} + { + value = ''; + searchSuggestionFunc(inputValue).then((v) => { + searchSuggestions = v; + let searchSuggestionValue = v.find((v) => v.name === inputValue); + if (searchSuggestionValue !== undefined) { + value = searchSuggestionValue.value; + searchSuggestions = []; + } + }); + }} + pattern={suggestionRequired ? `${value ? inputValue : 'a^'}` : null} + /> +
+ + {#if inputValue && searchSuggestions.length !== 0} + + {/if} +
+ +{#if inputValue && searchSuggestions.length !== 0} +