ToolTip: Fix flexbox bug with tooltip when `maxWidth` is set manually (#107145)

Fix flexbox bug with tooltip when maxWidth is set manually.

fix for #105517

Co-authored-by: Jason <jdmarshall@users.noreply.github.com>
pull/107149/head
Jesse David Peterson 3 days ago committed by GitHub
parent c80fe53620
commit cff743fcd5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      packages/grafana-ui/src/components/VizTooltip/VizTooltipColorIndicator.tsx
  2. 9
      packages/grafana-ui/src/components/VizTooltip/VizTooltipRow.tsx

@ -56,9 +56,11 @@ export const VizTooltipColorIndicator = ({
const getStyles = (theme: GrafanaTheme2) => ({ const getStyles = (theme: GrafanaTheme2) => ({
leading: css({ leading: css({
marginRight: theme.spacing(0.5), marginRight: theme.spacing(0.5),
flex: 'none',
}), }),
trailing: css({ trailing: css({
marginLeft: theme.spacing(0.5), marginLeft: theme.spacing(0.5),
flex: 'none',
}), }),
value: css({ value: css({
width: '12px', width: '12px',

@ -129,7 +129,7 @@ export const VizTooltipRow = ({
return ( return (
<div className={styles.contentWrapper}> <div className={styles.contentWrapper}>
{(color || label) && ( {(color || label) && (
<div className={styles.valueWrapper}> <div className={styles.labelWrapper}>
{color && colorPlacement === ColorPlacement.first && ( {color && colorPlacement === ColorPlacement.first && (
<VizTooltipColorIndicator color={color} colorIndicator={colorIndicator} lineStyle={lineStyle} /> <VizTooltipColorIndicator color={color} colorIndicator={colorIndicator} lineStyle={lineStyle} />
)} )}
@ -221,6 +221,12 @@ const getStyles = (theme: GrafanaTheme2, justify: string, marginRight: string) =
overflow: 'hidden', overflow: 'hidden',
marginRight: theme.spacing(2), marginRight: theme.spacing(2),
}), }),
labelWrapper: css({
display: 'flex',
alignItems: 'center',
flex: '2',
minWidth: 0,
}),
value: css({ value: css({
fontWeight: 500, fontWeight: 500,
textOverflow: 'ellipsis', textOverflow: 'ellipsis',
@ -229,6 +235,7 @@ const getStyles = (theme: GrafanaTheme2, justify: string, marginRight: string) =
valueWrapper: css({ valueWrapper: css({
display: 'flex', display: 'flex',
alignItems: 'center', alignItems: 'center',
flex: '1',
}), }),
activeSeries: css({ activeSeries: css({
fontWeight: theme.typography.fontWeightBold, fontWeight: theme.typography.fontWeightBold,

Loading…
Cancel
Save