open-nomad/ui/app/templates/components/multi-select-dropdown.hbs
Buck Doyle e9e52e0dfe
Update Ember/Ember CLI to 3.20 (#9641)
This doesn’t include Ember Data, as we are still back on 3.12.

Most changes are deprecation updates, linting fixes, and dependencies. It can
be read commit-by-commit, though many of them are mechanical and skimmable.
For the new linting exclusions, I’ve added them to the Tech Debt list.

The decrease in test count is because linting is no longer included in ember test.

There’s a new deprecation warning in the logs that can be fixed by updating Ember
Power Select but when I tried that it caused it to render incorrectly, so I decided to
ignore it for now and address it separately.
2021-02-17 15:01:44 -06:00

48 lines
1.6 KiB
Handlebars

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