Files
nomad/ui/app/templates/components/multi-select-dropdown.hbs
Phil Renaud 15b06e8505 [ui] HashiCorp Design System upgraded to 3.6.0 (#19872)
* HashiCorp Design System upgraded to 3.6.0

* Fresh yarn

* Responses out of range are brought back within

* General pass at a11y fixes with updated components and node

* Further tooltip updates

* 3 more partitions worth of toggle and tooltip updates

* scale-events-accordion and topo-viz node fixes
2024-02-07 16:08:41 -05:00

65 lines
1.8 KiB
Handlebars

{{!
Copyright (c) HashiCorp, Inc.
SPDX-License-Identifier: BUSL-1.1
~}}
<BasicDropdown
@horizontalPosition="auto"
@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 "keyup" (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"
onkeyup={{action "traverseList" option}}
role="group"
>
<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>