2023-12-12 17:19:39 -06:00
|
|
|
{{!
|
2026-02-03 12:08:35 -05:00
|
|
|
Copyright IBM Corp. 2021, 2026
|
2024-05-31 11:29:24 -07:00
|
|
|
SPDX-License-Identifier: BUSL-1.1
|
2023-12-12 17:19:39 -06:00
|
|
|
}}
|
|
|
|
|
|
2023-12-21 15:13:14 -08:00
|
|
|
<Hds::Dropdown
|
2024-04-04 15:54:23 -05:00
|
|
|
...attributes
|
2023-12-21 15:13:14 -08:00
|
|
|
@height='314px'
|
|
|
|
|
@onClose={{this.close}}
|
|
|
|
|
@listPosition={{@listPosition}}
|
|
|
|
|
as |DD|
|
|
|
|
|
>
|
2023-12-12 17:19:39 -06:00
|
|
|
<DD.ToggleButton
|
|
|
|
|
@color='secondary'
|
2024-04-04 15:54:23 -05:00
|
|
|
@text={{@toggleText}}
|
2023-12-12 17:19:39 -06:00
|
|
|
@count={{@checkedItems.length}}
|
2023-12-22 15:14:59 -06:00
|
|
|
{{on 'click' this.open}}
|
2023-12-12 17:19:39 -06:00
|
|
|
/>
|
|
|
|
|
{{#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}}
|
2023-12-12 17:19:39 -06:00
|
|
|
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)}}
|
2023-12-12 17:19:39 -06:00
|
|
|
<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)}}
|
2023-12-12 17:19:39 -06:00
|
|
|
{{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}}
|
2023-12-12 17:19:39 -06:00
|
|
|
</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}}
|
2023-12-12 17:19:39 -06:00
|
|
|
</Hds::Dropdown>
|