File tree Expand file tree Collapse file tree 4 files changed +33
-2
lines changed
src/components/hds/filter-bar
translations/hds/components/filter-bar/filters-dropdown Expand file tree Collapse file tree 4 files changed +33
-2
lines changed Original file line number Diff line number Diff line change 1111 {{ this._syncFilters @filters }}
1212 as |D|
1313>
14- <D .ToggleButton @icon =" filter" @text =" Filter" @color =" secondary" @size =" small" />
14+ <D .ToggleButton
15+ @icon =" filter"
16+ @text ={{ hds-t " hds.components.filter-bar.filters-dropdown.toggle-button" default =" Add filter" }}
17+ @color =" secondary"
18+ @size =" small"
19+ />
1520 <D .Generic>
1621 <Hds::FilterBar::Tabs @ariaLabel =" Filter bar tabs" as |T|>
1722 {{ yield
Original file line number Diff line number Diff line change 2020 {{ /if }}
2121 <div class =" hds-filter-bar__actions__right" >
2222 {{ yield (hash ActionsDropdown = (component " hds/dropdown" ))}}
23+ {{ #if this.hasActiveFilters }}
24+ <Hds::Button
25+ @text ={{ if
26+ this._isExpanded
27+ (hds-t " hds.components.filter-bar.expand-collapse-button.collapse" default =" Collapse filters" )
28+ (hds-t " hds.components.filter-bar.expand-collapse-button.expand" default =" Expand filters" )
29+ }}
30+ @color =" secondary"
31+ @size =" small"
32+ @icon ={{ if this._isExpanded " unfold-close" " unfold-open" }}
33+ @isIconOnly ={{ true }}
34+ {{ on " click" this.toggleExpand }}
35+ />
36+ {{ /if }}
2337 </div >
2438 </div >
25- {{ #if this.hasActiveFilters }}
39+ {{ #if ( and this.hasActiveFilters this._isExpanded ) }}
2640 <div class =" hds-filter-bar__filters" >
2741 {{ #each-in @filters as |key filter |}}
2842 {{ #if filter.data }}
Original file line number Diff line number Diff line change 55
66import Component from '@glimmer/component' ;
77import { action } from '@ember/object' ;
8+ import { tracked } from '@glimmer/tracking' ;
89
910import type { ComponentLike , WithBoundArgs } from '@glint/template' ;
1011
@@ -42,6 +43,8 @@ export interface HdsFilterBarSignature {
4243}
4344
4445export default class HdsFilterBar extends Component < HdsFilterBarSignature > {
46+ @tracked _isExpanded : boolean = true ;
47+
4548 @action
4649 onFilter ( filters : HdsFilterBarFilters ) : void {
4750 const { onFilter } = this . args ;
@@ -66,6 +69,11 @@ export default class HdsFilterBar extends Component<HdsFilterBarSignature> {
6669 }
6770 }
6871
72+ @action
73+ toggleExpand ( ) : void {
74+ this . _isExpanded = ! this . _isExpanded ;
75+ }
76+
6977 get hasActiveFilters ( ) : boolean {
7078 return Object . keys ( this . args . filters ) . length > 0 ;
7179 }
Original file line number Diff line number Diff line change 11apply : Apply filters
22clear : Clear all filters
3+ expand-collapse-button :
4+ expand : Expand filters
5+ collapse : Collapse filters
36selected-filters : Filters selected
7+ toggle-button : Add filter
You can’t perform that action at this time.
0 commit comments