open-nomad/ui/app/templates/components/multi-select-dropdown.hbs
Buck Doyle 9b2fb14e51
UI: Update Ember to 3.12 LTS (#6419)
This is mostly deprecation fixes and blueprint changes. There
are some dependency updates too; the changes to Ember
Basic Dropdown necessitated changing it to angle bracket
component invocation. The conversion of the rest of the
templates will happen separately.
2019-10-15 13:32:58 -05:00

43 lines
1.3 KiB
Handlebars

<BasicDropdown
@horizontalPosition="left"
@onOpen={{action (queue (action (mut isOpen) true) (action capture))}}
@onClose={{action (mut isOpen) false}} as |dd|
>
<dd.Trigger data-test-dropdown-trigger class="dropdown-trigger" {{on "keydown" (action "openOnArrowDown" dd)}}>
<div class="dropdown-trigger-label">
{{label}}
{{#if selection.length}}
<span data-test-dropdown-count class="tag is-light">
{{selection.length}}
</span>
{{/if}}
</div>
<span class="dropdown-trigger-icon ember-power-select-status-icon"></span>
</dd.Trigger>
<dd.Content class="dropdown-options">
<ul role="listbox" data-test-dropdown-options>
{{#each options key="key" as |option|}}
<li
data-test-dropdown-option={{option.key}}
class="dropdown-option"
tabindex="1"
onkeydown={{action "traverseList" option}}
>
<label>
<input
type="checkbox"
tabindex="-1"
checked={{contains option.key selection}}
onchange={{action "toggle" option}}
/>
{{option.label}}
</label>
</li>
{{else}}
<em data-test-dropdown-empty class="dropdown-empty">
No options
</em>
{{/each}}
</ul>
</dd.Content>
</BasicDropdown>