@quantumwake/terminal-ux-dashboard-components 0.1.21 → 0.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +13 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +13 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -711,7 +711,7 @@ function LineView({ records, xColumn, yColumn, data: presetData, dashedIds, styl
|
|
|
711
711
|
}
|
|
712
712
|
) });
|
|
713
713
|
}
|
|
714
|
-
function SparklineView({ data, height = 56, color = "#3987e5" }) {
|
|
714
|
+
function SparklineView({ data, height = 56, color = "#3987e5", showValue = false, format }) {
|
|
715
715
|
const gradientId = react.useId();
|
|
716
716
|
const width = 260;
|
|
717
717
|
const pts = data && data.length ? data : [0];
|
|
@@ -720,13 +720,18 @@ function SparklineView({ data, height = 56, color = "#3987e5" }) {
|
|
|
720
720
|
const xy = (v, i) => [i * dx, height - v / max * (height - 4) - 2];
|
|
721
721
|
const line = pts.map((v, i) => `${i === 0 ? "M" : "L"} ${xy(v, i)[0].toFixed(1)} ${xy(v, i)[1].toFixed(1)}`).join(" ");
|
|
722
722
|
const area = `${line} L ${width} ${height} L 0 ${height} Z`;
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
723
|
+
const current = pts[pts.length - 1];
|
|
724
|
+
const readout = format ? format(current) : current.toLocaleString(void 0, { maximumFractionDigits: 1 });
|
|
725
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
726
|
+
/* @__PURE__ */ jsxRuntime.jsxs("svg", { viewBox: `0 0 ${width} ${height}`, height, className: "w-full", preserveAspectRatio: "none", children: [
|
|
727
|
+
/* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsxs("linearGradient", { id: gradientId, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
728
|
+
/* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "0%", stopColor: color, stopOpacity: "0.25" }),
|
|
729
|
+
/* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "100%", stopColor: color, stopOpacity: "0" })
|
|
730
|
+
] }) }),
|
|
731
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: area, fill: `url(#${gradientId})` }),
|
|
732
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: line, fill: "none", stroke: color, strokeWidth: "2", vectorEffect: "non-scaling-stroke" })
|
|
733
|
+
] }),
|
|
734
|
+
showValue && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute right-1 top-0 font-mono text-lg text-midnight-text-primary", children: readout })
|
|
730
735
|
] });
|
|
731
736
|
}
|
|
732
737
|
function ScatterView({ records, xColumn, yColumn, data: presetData, style }) {
|