zenno: format
This commit is contained in:
@@ -83,48 +83,60 @@
|
||||
<div class={className} style={`anchor-name: --anchor-${id}`}>
|
||||
<span
|
||||
{id}
|
||||
class="block h-9 content-center hover:cursor-pointer bg-mist-300 dark:bg-mist-900"
|
||||
class="block h-9 content-center bg-mist-300 hover:cursor-pointer dark:bg-mist-900"
|
||||
role="combobox"
|
||||
aria-expanded={expanded}
|
||||
aria-controls="charaOptions"
|
||||
aria-haspopup="listbox"
|
||||
onclick={() => popover?.togglePopover()}
|
||||
{onkeydown}
|
||||
tabindex="0"
|
||||
>{value?.name ?? ''}</span>
|
||||
tabindex="0">{value?.name ?? ''}</span
|
||||
>
|
||||
<div
|
||||
class="absolute top-2 shadow-lg open:flex flex-col px-2 skill-tip"
|
||||
class="skill-tip absolute top-2 flex-col px-2 shadow-lg open:flex"
|
||||
style={`position-anchor: --anchor-${id}; position-area: bottom;`}
|
||||
id="charaOptions"
|
||||
role="listbox"
|
||||
popover
|
||||
bind:this={popover}
|
||||
>
|
||||
<input class="my-2 border rounded-md min-h-8 pointer-coarse:min-h-12" placeholder=" Search" role="searchbox" bind:value={search} />
|
||||
<input
|
||||
class="my-2 min-h-8 rounded-md border pointer-coarse:min-h-12"
|
||||
placeholder=" Search"
|
||||
role="searchbox"
|
||||
bind:value={search}
|
||||
/>
|
||||
<div class="max-h-72 overflow-y-scroll" bind:this={optionsContainer}>
|
||||
{#if !required}
|
||||
<div
|
||||
class="w-full h-8 hover:cursor-pointer hover:bg-mist-300 hover:dark:bg-mist-900 text-lg"
|
||||
class="h-8 w-full text-lg hover:cursor-pointer hover:bg-mist-300 hover:dark:bg-mist-900"
|
||||
role="option"
|
||||
aria-selected={value == undefined}
|
||||
tabindex="0"
|
||||
data-chara-id=""
|
||||
onmousedown={() => {value = undefined; search = ''; popover!.hidePopover()}}
|
||||
onfocus={() => value = undefined}
|
||||
onmousedown={() => {
|
||||
value = undefined;
|
||||
search = '';
|
||||
popover!.hidePopover();
|
||||
}}
|
||||
onfocus={() => (value = undefined)}
|
||||
{onkeydown}
|
||||
>
|
||||
<span class="italic text-sm">Reset</span>
|
||||
<span class="text-sm italic">Reset</span>
|
||||
</div>
|
||||
{/if}
|
||||
{#each searchedCharas as c (c.chara_id)}
|
||||
<div
|
||||
class="w-full h-8 hover:cursor-pointer hover:bg-mist-300 hover:dark:bg-mist-900 text-lg"
|
||||
class="h-8 w-full text-lg hover:cursor-pointer hover:bg-mist-300 hover:dark:bg-mist-900"
|
||||
role="option"
|
||||
aria-selected={value?.chara_id === c.chara_id}
|
||||
tabindex="0"
|
||||
data-chara-id={c.chara_id}
|
||||
onmousedown={() => {value = c; popover!.hidePopover()}}
|
||||
onfocus={() => value = c}
|
||||
onmousedown={() => {
|
||||
value = c;
|
||||
popover!.hidePopover();
|
||||
}}
|
||||
onfocus={() => (value = c)}
|
||||
{onkeydown}
|
||||
>
|
||||
{#if option != null}
|
||||
|
||||
@@ -52,5 +52,5 @@ export function stringsearch<T>(sub: string, terms: Iterable<T>, map: (t: T) =>
|
||||
scored.push([t, sc]);
|
||||
}
|
||||
}
|
||||
return scored.sort(([, a], [, b]) => b - a).map(([t,]) => t);
|
||||
return scored.sort(([, a], [, b]) => b - a).map(([t]) => t);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user