{#if label} {/if} { value = ''; searchSuggestionFunc(inputValue).then((v) => { searchSuggestions = v; const searchSuggestion = v.find((v) => v.name === inputValue); if (searchSuggestion !== undefined) { inputValue = searchSuggestion.name; value = searchSuggestion.value; searchSuggestions = []; e.currentTarget.setCustomValidity(''); onsubmit?.(Object.assign(e, { input: inputValue, value: value })); } else if (inputValue === '' && emptyAllowed) { onsubmit?.(Object.assign(e, { input: '', value: '' })); } }); }} oninvalid={(e: Event & { currentTarget: EventTarget & HTMLInputElement }) => { if (invalidMessage) e.currentTarget.setCustomValidity(invalidMessage); }} pattern={suggestionRequired ? `${value ? inputValue : 'a^' + (emptyAllowed ? '|$^' : '')}` : null} />
{#if inputValue && searchSuggestions.length !== 0} {/if}
{#if inputValue && searchSuggestions.length !== 0} {/if}