Close picker on click of listbox

This commit is contained in:
Mel O'Hagan 2022-05-10 13:16:21 +01:00
parent 974cdad8da
commit 516d163ea2
1 changed files with 94 additions and 93 deletions

View File

@ -43,7 +43,7 @@
return return
} }
searchTerm = null searchTerm = null
open = true open = !open
} }
const getSortedOptions = (options, getLabel, sort) => { const getSortedOptions = (options, getLabel, sort) => {
@ -71,6 +71,7 @@
} }
</script> </script>
<div use:clickOutside={() => (open = false)}>
<button <button
{id} {id}
class="spectrum-Picker spectrum-Picker--sizeM" class="spectrum-Picker spectrum-Picker--sizeM"
@ -114,7 +115,6 @@
</button> </button>
{#if open} {#if open}
<div <div
use:clickOutside={() => (open = false)}
transition:fly|local={{ y: -20, duration: 200 }} transition:fly|local={{ y: -20, duration: 200 }}
class="spectrum-Popover spectrum-Popover--bottom spectrum-Picker-popover is-open" class="spectrum-Popover spectrum-Popover--bottom spectrum-Picker-popover is-open"
class:auto-width={autoWidth} class:auto-width={autoWidth}
@ -183,6 +183,7 @@
</ul> </ul>
</div> </div>
{/if} {/if}
</div>
<style> <style>
.spectrum-Popover { .spectrum-Popover {