fix PhoneInput combobox icon override

This commit is contained in:
2026-05-06 19:06:41 -07:00
parent e8440bc106
commit 7386bff7be
+8 -9
View File
@@ -50,8 +50,7 @@
const options: ComboboxOption[] = countries.map((country) => ({ const options: ComboboxOption[] = countries.map((country) => ({
value: country.isoCode, value: country.isoCode,
label: `${country.name} (+${country.phonecode})`, label: `${country.name} (+${country.phonecode})`,
preview: `+${country.phonecode}`, preview: `+${country.phonecode}`
icon: renderIcon
})); }));
let phonecode: string = $derived.by(() => { let phonecode: string = $derived.by(() => {
@@ -118,12 +117,6 @@
}); });
</script> </script>
{#snippet renderIcon(item: ComboboxOption)}
{#if countrycodeMap[item.value]?.flag}
{countrycodeMap[item.value].flag}
{/if}
{/snippet}
<div class={classValue}> <div class={classValue}>
{#if label} {#if label}
<Label for={id}>{label}</Label> <Label for={id}>{label}</Label>
@@ -149,7 +142,13 @@
countriesValid = e.detail.valid; countriesValid = e.detail.valid;
}} }}
invalidMessage={null} invalidMessage={null}
/> >
{#snippet iconRender(opt)}
{#if countrycodeMap[opt.value]?.flag}
{countrycodeMap[opt.value].flag}
{/if}
{/snippet}
</Combobox>
</div> </div>
<div class="w-full"> <div class="w-full">