@grafana/ui
Version:
Grafana Components Library
52 lines (49 loc) • 1.27 kB
JavaScript
import { jsxs, jsx } from 'react/jsx-runtime';
import { css } from '@emotion/css';
import { useStyles2 } from '../../themes/ThemeContext.mjs';
import { VizTooltipRow } from './VizTooltipRow.mjs';
;
const VizTooltipContent = ({
items,
children,
isPinned = false,
scrollable = false,
maxHeight
}) => {
const styles = useStyles2(getStyles);
const scrollableStyle = scrollable ? {
maxHeight,
overflowY: "auto"
} : {};
return /* @__PURE__ */ jsxs("div", { className: styles.wrapper, style: scrollableStyle, children: [
items.map(({ label, value, color, colorIndicator, colorPlacement, isActive, lineStyle, isHiddenFromViz }, i) => /* @__PURE__ */ jsx(
VizTooltipRow,
{
label,
value,
color,
colorIndicator,
colorPlacement,
isActive,
isPinned,
lineStyle,
showValueScroll: !scrollable,
isHiddenFromViz
},
i
)),
children
] });
};
const getStyles = (theme) => ({
wrapper: css({
display: "flex",
flexDirection: "column",
flex: 1,
gap: 2,
borderTop: `1px solid ${theme.colors.border.weak}`,
padding: theme.spacing(1)
})
});
export { VizTooltipContent };
//# sourceMappingURL=VizTooltipContent.mjs.map