use global modal for popup messages
All checks were successful
delpoy / build-and-deploy (push) Successful in 51s

This commit is contained in:
2024-12-02 21:02:23 +01:00
parent a1965c62e2
commit e30446598c
14 changed files with 252 additions and 284 deletions

View File

@@ -14,7 +14,7 @@
required = false,
disabled = false,
readonly = false,
checked = false,
checked = $bindable(false),
size = 'md',
pickyWidth = true,
containerClass = '',
@@ -109,10 +109,15 @@
{readonly}
bind:this={inputElement}
autocomplete="off"
onchange={() => {
if (type === 'checkbox') {
checked = !checked;
}
}}
oninput={(e: Event & { currentTarget: EventTarget & HTMLInputElement }) => {
value = e.currentTarget.value;
if (pattern && !pattern.test(value)) return;
oninput && oninput(e);
oninput?.(e);
}}
onpaste={(e) => {
if (pattern && e.clipboardData && !pattern.test(e.clipboardData.getData('text'))) {

View File

@@ -63,14 +63,14 @@
value = searchSuggestion.value;
searchSuggestions = [];
e.currentTarget.setCustomValidity('');
onsubmit && onsubmit(Object.assign(e, { input: inputValue, value: value }));
onsubmit?.(Object.assign(e, { input: inputValue, value: value }));
} else if (inputValue === '' && emptyAllowed) {
onsubmit && onsubmit(Object.assign(e, { input: '', value: '' }));
onsubmit?.(Object.assign(e, { input: '', value: '' }));
}
});
}}
oninvalid={(e: Event & { currentTarget: EventTarget & HTMLInputElement }) => {
invalidMessage && e.currentTarget.setCustomValidity(invalidMessage);
if (invalidMessage) e.currentTarget.setCustomValidity(invalidMessage);
}}
pattern={suggestionRequired
? `${value ? inputValue : 'a^' + (emptyAllowed ? '|$^' : '')}`
@@ -89,7 +89,7 @@
inputValue = searchSuggestion.name;
value = searchSuggestion.value;
searchSuggestions = [];
onsubmit && onsubmit(Object.assign(e, { input: inputValue, value: value }));
onsubmit?.(Object.assign(e, { input: inputValue, value: value }));
}}>{searchSuggestion.name}</button
>
</li>