File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
src/platform/packages/shared/content-management/table_list_view_table/src/components Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,8 @@ import type { TagOptionItem } from './use_tag_filter_panel';
3636
3737const isMac = navigator . platform . toLowerCase ( ) . indexOf ( 'mac' ) >= 0 ;
3838const modifierKeyPrefix = isMac ? '⌘' : '^' ;
39+ const shortTagLength = 20 ;
40+ const mediumTagLength = 35 ;
3941
4042const clearSelectionBtnCSS = css `
4143 height : auto;
@@ -82,6 +84,10 @@ export const TagFilterPanel: FC<{}> = ({}) => {
8284 clearTagSelection,
8385 } = componentContext ;
8486 const isSearchVisible = options . length > 10 ;
87+ const longestTagLength = Math . max ( 0 , ...options . map ( ( option ) => ( option . label ?? '' ) . length ) ) ;
88+ const panelWidthFromLongestTagLength =
89+ ( longestTagLength <= shortTagLength ? 18 : longestTagLength <= mediumTagLength ? 25 : 32 ) *
90+ euiTheme . base ;
8591
8692 const searchBoxCSS = css `
8793 padding : ${ euiTheme . size . s } ;
@@ -137,7 +143,7 @@ export const TagFilterPanel: FC<{}> = ({}) => {
137143 closePopover = { closePopover }
138144 panelPaddingSize = "none"
139145 anchorPosition = "downCenter"
140- panelProps = { { css : { width : euiTheme . base * 18 } } }
146+ panelProps = { { css : { width : panelWidthFromLongestTagLength } } }
141147 >
142148 < EuiPopoverTitle paddingSize = "m" css = { popoverTitleCSS } >
143149 < EuiFlexGroup >
You can’t perform that action at this time.
0 commit comments