@lobehub/ui
Version:
Lobe UI is an open-source UI component library for building AIGC web apps
42 lines (41 loc) • 1.42 kB
JavaScript
"use client";
import Skeleton from "../Skeleton/index.mjs";
import { formatStatisticValue } from "./formatValue.mjs";
import { styles } from "./style.mjs";
import { memo } from "react";
import { jsx, jsxs } from "react/jsx-runtime";
import { cx } from "antd-style";
//#region src/base-ui/Statistic/Statistic.tsx
const Statistic = memo(({ className, classNames, formatter, loading = false, precision, prefix, ref, styles: customStyles, suffix, title, value, ...rest }) => {
return /* @__PURE__ */ jsxs("div", {
className: cx(styles.root, className),
ref,
...rest,
children: [title != null && /* @__PURE__ */ jsx("div", {
className: cx(styles.title, classNames?.title),
style: customStyles?.title,
children: title
}), loading ? /* @__PURE__ */ jsx(Skeleton, {
height: 30,
width: 96
}) : /* @__PURE__ */ jsxs("div", {
className: cx(styles.value, classNames?.value),
style: customStyles?.value,
children: [
prefix != null && /* @__PURE__ */ jsx("span", {
className: styles.affix,
children: prefix
}),
/* @__PURE__ */ jsx("span", { children: formatter ? formatter(value) : formatStatisticValue(value, precision) }),
suffix != null && /* @__PURE__ */ jsx("span", {
className: styles.affix,
children: suffix
})
]
})]
});
});
Statistic.displayName = "Statistic";
//#endregion
export { Statistic as default };
//# sourceMappingURL=Statistic.mjs.map