Add shared core attribute allocation
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
value = $bindable(''),
|
||||
columns = Math.min(items.length, 4),
|
||||
searchable = false,
|
||||
iconOnly = false,
|
||||
required = false,
|
||||
onchange
|
||||
}: {
|
||||
@@ -15,6 +16,7 @@
|
||||
value?: string;
|
||||
columns?: number;
|
||||
searchable?: boolean;
|
||||
iconOnly?: boolean;
|
||||
required?: boolean;
|
||||
onchange?: (id: string) => void;
|
||||
} = $props();
|
||||
@@ -30,7 +32,7 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<fieldset class="builder-radio-grid" style={`--builder-radio-columns:${Math.max(1, columns)}`}>
|
||||
<fieldset class="builder-radio-grid" class:icon-only={iconOnly} style={`--builder-radio-columns:${Math.max(1, columns)}`}>
|
||||
<legend>{label}</legend>
|
||||
{#if searchable}
|
||||
<input class="builder-radio-search" type="search" bind:value={query} placeholder="SEARCH AVAILABLE OPTIONS" aria-label={`Search ${label.toLocaleLowerCase()}`}/>
|
||||
@@ -38,7 +40,7 @@
|
||||
<div>
|
||||
{#each visible as item}
|
||||
<label title={item.name}>
|
||||
<input type="radio" {name} value={item.id} checked={value === item.id} {required} onchange={() => choose(item.id)}/>
|
||||
<input type="radio" {name} value={item.id} checked={value === item.id} {required} aria-label={item.name} onchange={() => choose(item.id)}/>
|
||||
<span>
|
||||
{#if item.iconUrl}<img src={item.iconUrl} alt=""/>{:else}<i>{item.name.slice(0,2).toUpperCase()}</i>{/if}
|
||||
<b>{item.name}</b>
|
||||
|
||||
Reference in New Issue
Block a user