File tree Expand file tree Collapse file tree 7 files changed +80
-11
lines changed
components/hds/filter-bar
translations/hds/components/filter-bar Expand file tree Collapse file tree 7 files changed +80
-11
lines changed Original file line number Diff line number Diff line change 2929 {{ #if (eq @type " range" )}}
3030 <Hds::FilterBar::Range @keyFilter ={{ this.keyFilter }} @onChange ={{ this.onRangeChange }} />
3131 {{ else }}
32- <ul class =" hds-filter-bar__filters-dropdown__filter-group__list" >
33- {{ yield
34- (hash
35- Checkbox = (component " hds/filter-bar/checkbox" keyFilter =this.keyFilter onChange =this.onSelectionChange )
36- Radio = (component " hds/filter-bar/radio" keyFilter =this.keyFilter onChange =this.onSelectionChange )
37- )
38- }}
39- </ul >
32+ <div class =" hds-filter-bar__filters-dropdown__filter-group__values-list" >
33+ <div class =" hds-filter-bar__filters-dropdown__clear" >
34+ <Hds::Button
35+ @text ={{ hds-t " hds.components.filter-bar.filter-group.clear" default =" Clear selection" }}
36+ @color =" tertiary"
37+ @icon =" rotate-ccw"
38+ {{ on " click" this.onClear }}
39+ />
40+ </div >
41+ <ul class =" hds-filter-bar__filters-dropdown__filter-group__list" >
42+ {{ yield
43+ (hash
44+ Checkbox = (component " hds/filter-bar/checkbox" keyFilter =this.keyFilter onChange =this.onSelectionChange )
45+ Radio = (component " hds/filter-bar/radio" keyFilter =this.keyFilter onChange =this.onSelectionChange )
46+ )
47+ }}
48+ </ul >
49+ </div >
4050 {{ /if }}
4151 </Panel >
4252{{ /let }}
Original file line number Diff line number Diff line change @@ -177,6 +177,16 @@ export default class HdsFilterBarFilterGroup extends Component<HdsFilterBarFilte
177177 }
178178 }
179179
180+ @action
181+ onClear ( ) : void {
182+ this . internalFilters = undefined ;
183+
184+ const { onChange } = this . args ;
185+ if ( onChange && typeof onChange === 'function' ) {
186+ onChange ( this . args . key , this . formattedFilters ) ;
187+ }
188+ }
189+
180190 get formattedFilters ( ) : HdsFilterBarFilter | undefined {
181191 if (
182192 this . internalFilters === undefined ||
Original file line number Diff line number Diff line change 4747 />
4848 {{ /if }}
4949 </Hds::Layout::Flex >
50+ <div class =" hds-filter-bar__filters-dropdown__clear" >
51+ <Hds::Button
52+ @text ={{ hds-t " hds.components.filter-bar.range.clear" default =" Clear filter" }}
53+ @color =" tertiary"
54+ @icon =" rotate-ccw"
55+ @isInline ={{ true }}
56+ {{ on " click" this.onClear }}
57+ />
58+ </div >
5059</div >
Original file line number Diff line number Diff line change @@ -144,6 +144,12 @@ export default class HdsFilterBarRange extends Component<HdsFilterBarRangeSignat
144144 this . _onChange ( ) ;
145145 }
146146
147+ @action
148+ onClear ( ) : void {
149+ this . _resetInputValues ( ) ;
150+ this . _onChange ( ) ;
151+ }
152+
147153 private _onChange ( ) : void {
148154 const { onChange } = this . args ;
149155 if ( onChange && typeof onChange === 'function' ) {
@@ -172,4 +178,11 @@ export default class HdsFilterBarRange extends Component<HdsFilterBarRangeSignat
172178 }
173179 ) ;
174180 } ;
181+
182+ private _resetInputValues = ( ) : void => {
183+ this . _selector = undefined ;
184+ this . _value = undefined ;
185+ this . _betweenValueStart = undefined ;
186+ this . _betweenValueEnd = undefined ;
187+ } ;
175188}
Original file line number Diff line number Diff line change 6767 gap : 8px ;
6868}
6969
70+ .hds-filter-bar__filters-dropdown__filter-group__search {
71+ padding : 16px ;
72+ border-bottom : 1px solid var (--token-color-border-primary );
73+ }
74+
75+ .hds-filter-bar__filters-dropdown__filter-group__values-list {
76+ padding : 8px 0 ;
77+ }
78+
7079.hds-filter-bar__filters-dropdown__filter-group__list {
71- flex : 1 1 auto ;
80+ display : flex ;
81+ flex-direction : column ;
82+ gap : 4px ;
7283 margin : 0 ;
7384 padding : 0 ;
7485 overflow-y : auto ;
8394
8495.hds-filter-bar__filters-dropdown__filter-option {
8596 display : block ;
86- padding : 8px 0 ;
97+ padding : 8px 16 px ;
8798
8899 & --hidden {
89100 display : none ;
90101 }
91102}
92103
104+ .hds-filter-bar__filters-dropdown__filter-range {
105+ display : flex ;
106+ flex-direction : column ;
107+ gap : 8px ;
108+ padding : 16px 0 ;
109+ }
110+
111+ .hds-filter-bar__filters-dropdown__filter-range .hds-layout-flex {
112+ padding : 0 16px ;
113+ }
114+
115+ .hds-filter-bar__filters-dropdown__clear {
116+ padding : 4px ;
117+ }
118+
93119// TABS
94120//
95121
114140 flex-direction : column ;
115141 gap : 8px ;
116142 width : 50% ;
117- padding : 16px ;
118143 background-color : var (--token-color-surface-primary );
119144 border-top-right-radius : var (--token-border-radius-medium );
120145}
Original file line number Diff line number Diff line change 1+ clear : Clear selection
Original file line number Diff line number Diff line change @@ -12,3 +12,4 @@ value-input:
1212between-value-inputs :
1313 start-placeholder : Start
1414 end-placeholder : End
15+ clear : Clear filter
You can’t perform that action at this time.
0 commit comments