import{r as e,e as t,h as i,H as s}from"./p-3d23a42a.js";const o=class{constructor(s){e(this,s),this.selection=t(this,"selection",7),this.optionRenderer=e=>e,this.select=e=>{this.selected=e},this.toOption=e=>{const t=this.selected===e;return i("div",{class:{"Select-option":!0,"Select-option--selected":t},role:"menuitemradio","aria-checked":t?"true":"false",tabindex:"0",onClick:()=>{this.select(e),this.dropdown.close()},onKeyUp:t=>{"Enter"===t.key&&(this.select(e),this.dropdown.focus())}},this.optionRenderer(e))}}handleSelect(e){this.selection.emit(e)}componentWillLoad(){this.selected="function"==typeof this.initializer?this.initializer(this.options):this.options[0]}hostData(){return{class:{Select:!0}}}__stencil_render(){return i("sparkle-dropdown",{ref:e=>{this.dropdown=e},label:this.optionRenderer(this.selected)},this.options.map(this.toOption))}static get watchers(){return{selected:["handleSelect"]}}render(){return i(s,this.hostData(),this.__stencil_render())}};o.style=".Select{cursor:pointer;display:inline-block;font-weight:500}.Select .Dropdown-button{align-items:center;border:solid 1px #dee3ea;border-radius:6px;display:inline-flex;justify-content:space-between;min-width:100px;padding:0.5em 1em}.Select .Dropdown-panel{padding:0.5em 0}.Select .Dropdown-arrow{margin-left:0.5em}.Select-option{--bg-alpha:0;background-color:rgba(0, 0, 0, var(--bg-alpha));padding:0.5em 1.5em}.Select-option:focus{--bg-alpha:0.025;outline:none}.Select-option--selected{--bg-alpha:0.05}.Select-option--selected:focus{--bg-alpha:0.075}@media (hover: hover){.Select-option:hover{--bg-alpha:0.025}.Select-option--selected:hover{--bg-alpha:0.075}}";export{o as sparkle_select}