Files
threshold-ui/addons/core/addon/components/dropdown/index.hbs
T

68 lines
1.8 KiB
Handlebars
Raw Normal View History

{{!
2026-02-03 12:08:35 -05:00
Copyright IBM Corp. 2021, 2026
SPDX-License-Identifier: BUSL-1.1
}}
2023-12-21 15:13:14 -08:00
<Hds::Dropdown
...attributes
2023-12-21 15:13:14 -08:00
@height='314px'
@onClose={{this.close}}
@listPosition={{@listPosition}}
as |DD|
>
<DD.ToggleButton
@color='secondary'
@text={{@toggleText}}
@count={{@checkedItems.length}}
{{on 'click' this.open}}
/>
{{#if @isSearchable}}
<DD.Header @hasDivider={{true}}>
<Hds::Form::TextInput::Base
@type='search'
2025-10-31 16:58:05 -04:00
@value={{or this.searchTerm @searchTerm}}
placeholder={{t 'actions.narrow-results'}}
aria-label={{t 'actions.narrow-results'}}
{{on 'input' this.filterItems}}
data-test-dropdown-search
/>
</DD.Header>
{{/if}}
2025-10-31 16:58:05 -04:00
{{#unless (or this.itemOptions @isLoading)}}
<DD.Description @text={{t 'titles.no-results'}} />
{{/unless}}
2025-10-31 16:58:05 -04:00
{{#if @isLoading}}
<DD.Generic>
<Hds::Layout::Flex @align='center' @justify='center'>
<Hds::Icon @name='loading' @size='24' class='margin-y-xs' />
</Hds::Layout::Flex>
</DD.Generic>
{{else if (has-block)}}
{{yield DD this.selectItem this.itemOptions}}
{{else}}
{{#each this.itemOptions as |itemOption|}}
<DD.Checkbox
@value={{itemOption.id}}
data-test-checkbox={{itemOption.id}}
checked={{includes itemOption.id @checkedItems}}
{{on 'change' this.selectItem}}
>
2023-12-21 15:13:14 -08:00
{{if itemOption.name itemOption.name itemOption.id}}
</DD.Checkbox>
{{/each}}
{{/if}}
2025-10-31 16:58:05 -04:00
{{#unless @isLoading}}
<DD.Footer @hasDivider={{true}}>
<Hds::Button
@text='Apply'
@isFullWidth={{true}}
@size='small'
{{on 'click' (fn this.applyFilter DD.close)}}
data-test-dropdown-apply-button
/>
</DD.Footer>
{{/unless}}
</Hds::Dropdown>