@ammarkhalidfarooq/dashboard-package 0.6.60 → 0.6.62
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.js +31 -8
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +31 -8
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1725,6 +1725,29 @@ var TrendText = function TrendText(_ref2) {
|
|
|
1725
1725
|
});
|
|
1726
1726
|
};
|
|
1727
1727
|
|
|
1728
|
+
// ─── SVG path helpers ─────────────────────────────────────────────────────────
|
|
1729
|
+
var buildSmoothPath = function buildSmoothPath(points) {
|
|
1730
|
+
if (!points.length) return "";
|
|
1731
|
+
if (points.length === 1) return "M".concat(points[0][0].toFixed(1), ",").concat(points[0][1].toFixed(1));
|
|
1732
|
+
if (points.length === 2) {
|
|
1733
|
+
return "M".concat(points[0][0].toFixed(1), ",").concat(points[0][1].toFixed(1), " L").concat(points[1][0].toFixed(1), ",").concat(points[1][1].toFixed(1));
|
|
1734
|
+
}
|
|
1735
|
+
var d = "M".concat(points[0][0].toFixed(1), ",").concat(points[0][1].toFixed(1));
|
|
1736
|
+
for (var i = 0; i < points.length - 1; i++) {
|
|
1737
|
+
var _points, _points2;
|
|
1738
|
+
var p0 = (_points = points[i - 1]) !== null && _points !== void 0 ? _points : points[i];
|
|
1739
|
+
var p1 = points[i];
|
|
1740
|
+
var p2 = points[i + 1];
|
|
1741
|
+
var p3 = (_points2 = points[i + 2]) !== null && _points2 !== void 0 ? _points2 : p2;
|
|
1742
|
+
var cp1x = p1[0] + (p2[0] - p0[0]) / 6;
|
|
1743
|
+
var cp1y = p1[1] + (p2[1] - p0[1]) / 6;
|
|
1744
|
+
var cp2x = p2[0] - (p3[0] - p1[0]) / 6;
|
|
1745
|
+
var cp2y = p2[1] - (p3[1] - p1[1]) / 6;
|
|
1746
|
+
d += " C".concat(cp1x.toFixed(1), ",").concat(cp1y.toFixed(1), " ").concat(cp2x.toFixed(1), ",").concat(cp2y.toFixed(1), " ").concat(p2[0].toFixed(1), ",").concat(p2[1].toFixed(1));
|
|
1747
|
+
}
|
|
1748
|
+
return d;
|
|
1749
|
+
};
|
|
1750
|
+
|
|
1728
1751
|
// ─── SVG line sparkline ───────────────────────────────────────────────────────
|
|
1729
1752
|
var Sparkline = function Sparkline(_ref3) {
|
|
1730
1753
|
var _ref3$data = _ref3.data,
|
|
@@ -1743,9 +1766,7 @@ var Sparkline = function Sparkline(_ref3) {
|
|
|
1743
1766
|
var pts = vals.map(function (v, i) {
|
|
1744
1767
|
return [pad + i / (vals.length - 1) * (width - pad * 2), pad + (height - pad * 2) - (v - min) / range * (height - pad * 2)];
|
|
1745
1768
|
});
|
|
1746
|
-
var d = pts
|
|
1747
|
-
return "".concat(i === 0 ? "M" : "L").concat(p[0].toFixed(1), ",").concat(p[1].toFixed(1));
|
|
1748
|
-
}).join(" ");
|
|
1769
|
+
var d = buildSmoothPath(pts);
|
|
1749
1770
|
var area = "".concat(d, " L").concat((width - pad).toFixed(1), ",").concat(height, " L").concat(pad, ",").concat(height, " Z");
|
|
1750
1771
|
var gradId = "sp-".concat(color.replace(/[^a-z0-9]/gi, ""));
|
|
1751
1772
|
return /*#__PURE__*/jsxRuntime.jsxs("svg", {
|
|
@@ -1865,9 +1886,10 @@ var LineChart = function LineChart(_ref4) {
|
|
|
1865
1886
|
}), series.map(function (s, si) {
|
|
1866
1887
|
var data = s.data || [];
|
|
1867
1888
|
if (!data.length) return null;
|
|
1868
|
-
var
|
|
1869
|
-
return
|
|
1870
|
-
})
|
|
1889
|
+
var points = data.map(function (v, i) {
|
|
1890
|
+
return [xp(i, data.length), yp(v)];
|
|
1891
|
+
});
|
|
1892
|
+
var pathD = buildSmoothPath(points);
|
|
1871
1893
|
return /*#__PURE__*/jsxRuntime.jsx("path", {
|
|
1872
1894
|
d: pathD,
|
|
1873
1895
|
fill: "none",
|
|
@@ -2088,7 +2110,8 @@ var ProgressBar = function ProgressBar(_ref9) {
|
|
|
2088
2110
|
color = _ref9$color === void 0 ? "rgb(99, 99, 230)" : _ref9$color,
|
|
2089
2111
|
_ref9$height = _ref9.height,
|
|
2090
2112
|
height = _ref9$height === void 0 ? 6 : _ref9$height;
|
|
2091
|
-
var pct = Math.
|
|
2113
|
+
var pct = Math.max(0, Number(value !== null && value !== void 0 ? value : 0));
|
|
2114
|
+
var barWidth = Math.min(100, pct);
|
|
2092
2115
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
2093
2116
|
style: {
|
|
2094
2117
|
display: "flex",
|
|
@@ -2110,7 +2133,7 @@ var ProgressBar = function ProgressBar(_ref9) {
|
|
|
2110
2133
|
},
|
|
2111
2134
|
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2112
2135
|
style: {
|
|
2113
|
-
width: "".concat(
|
|
2136
|
+
width: "".concat(barWidth, "%"),
|
|
2114
2137
|
height: "100%",
|
|
2115
2138
|
background: color,
|
|
2116
2139
|
borderRadius: 4
|