consul/ui-v2/app/components/popover-select/index.hbs

29 lines
814 B
Handlebars

<div class="popover-select" ...attributes>
<PopoverMenu as |components menu|>
<BlockSlot @name="trigger">
<span>
{{selected.value}}
</span>
</BlockSlot>
<BlockSlot @name="menu">
{{#let components.MenuItem components.MenuSeparator as |MenuItem MenuSeparator|}}
<MenuSeparator>
<BlockSlot @name="label">
{{title}}
</BlockSlot>
</MenuSeparator>
{{#each options as |option|}}
<MenuItem
class={{if (eq selected.key option.key) 'is-active'}}
@onclick={{action (queue (action 'change' option) (if multiple (noop) menu.toggle))}}
>
<BlockSlot @name="label">
{{option.value}}
</BlockSlot>
</MenuItem>
{{/each}}
{{/let}}
</BlockSlot>
</PopoverMenu>
</div>