@grafana/ui
Version:
Grafana Components Library
44 lines (39 loc) • 1.19 kB
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
var jsxRuntime = require('react/jsx-runtime');
var css = require('@emotion/css');
var lodash = require('lodash');
var data = require('@grafana/data');
var ThemeContext = require('../../themes/ThemeContext.cjs');
var InlineList = require('../List/InlineList.cjs');
;
const VizLegendStatsList = ({ stats }) => {
const styles = ThemeContext.useStyles2(getStyles);
if (stats.length === 0) {
return null;
}
return /* @__PURE__ */ jsxRuntime.jsx(
InlineList.InlineList,
{
className: styles.list,
items: stats,
renderItem: (stat) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.item, title: stat.description, children: [
stat.title && `${lodash.capitalize(stat.title)}:`,
" ",
data.formattedValueToString(stat)
] })
}
);
};
const getStyles = () => ({
list: css.css({
flexGrow: 1,
textAlign: "right"
}),
item: css.css({
marginLeft: "8px"
})
});
VizLegendStatsList.displayName = "VizLegendStatsList";
exports.VizLegendStatsList = VizLegendStatsList;
//# sourceMappingURL=VizLegendStatsList.cjs.map