@@ -184,41 +184,42 @@ export const FilterList = ({
184
184
< FilterInput placeholder = "Filter values" onChange = { setSearchFilter } value = { searchFilter } />
185
185
</ Stack >
186
186
) }
187
- { ! items . length && < Label > No values</ Label > }
188
- { items . length && (
189
- < List
190
- height = { height }
191
- itemCount = { items . length }
192
- itemSize = { ITEM_HEIGHT }
193
- width = "100%"
194
- className = { styles . filterList }
195
- >
196
- { ( { index, style } ) => {
197
- const option = items [ index ] ;
198
- const { value, label } = option ;
199
- const isChecked = values . find ( ( s ) => s . value === value ) !== undefined ;
200
-
201
- return (
202
- < div className = { styles . filterListRow } style = { style } title = { label } >
203
- < Checkbox value = { isChecked } label = { label } onChange = { onCheckedChanged ( option ) } />
204
- </ div >
205
- ) ;
206
- } }
207
- </ List >
208
- ) }
209
- { items . length && (
210
- < Stack direction = "column" gap = { 0.25 } >
211
- < div className = { cx ( styles . selectDivider ) } />
212
- < div className = { cx ( styles . filterListRow ) } >
213
- < Checkbox
214
- value = { selectCheckValue }
215
- indeterminate = { selectCheckIndeterminate }
216
- label = { selectCheckLabel }
217
- description = { selectCheckDescription }
218
- onChange = { onSelectChanged }
219
- />
220
- </ div >
221
- </ Stack >
187
+ { items . length > 0 ? (
188
+ < >
189
+ < List
190
+ height = { height }
191
+ itemCount = { items . length }
192
+ itemSize = { ITEM_HEIGHT }
193
+ width = "100%"
194
+ className = { styles . filterList }
195
+ >
196
+ { ( { index, style } ) => {
197
+ const option = items [ index ] ;
198
+ const { value, label } = option ;
199
+ const isChecked = values . find ( ( s ) => s . value === value ) !== undefined ;
200
+
201
+ return (
202
+ < div className = { styles . filterListRow } style = { style } title = { label } >
203
+ < Checkbox value = { isChecked } label = { label } onChange = { onCheckedChanged ( option ) } />
204
+ </ div >
205
+ ) ;
206
+ } }
207
+ </ List >
208
+ < Stack direction = "column" gap = { 0.25 } >
209
+ < div className = { cx ( styles . selectDivider ) } />
210
+ < div className = { cx ( styles . filterListRow ) } >
211
+ < Checkbox
212
+ value = { selectCheckValue }
213
+ indeterminate = { selectCheckIndeterminate }
214
+ label = { selectCheckLabel }
215
+ description = { selectCheckDescription }
216
+ onChange = { onSelectChanged }
217
+ />
218
+ </ div >
219
+ </ Stack >
220
+ </ >
221
+ ) : (
222
+ < Label className = { styles . noValuesLabel } > No values</ Label >
222
223
) }
223
224
</ Stack >
224
225
) ;
@@ -246,4 +247,7 @@ const getStyles = (theme: GrafanaTheme2) => ({
246
247
borderTop : `1px solid ${ theme . colors . border . medium } ` ,
247
248
padding : theme . spacing ( 0.5 , 2 ) ,
248
249
} ) ,
250
+ noValuesLabel : css ( {
251
+ paddingTop : theme . spacing ( 1 ) ,
252
+ } ) ,
249
253
} ) ;
0 commit comments