@ammarkhalidfarooq/dashboard-package 0.6.61 → 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 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.map(function (p, i) {
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 pathD = data.map(function (v, i) {
1869
- return "".concat(i === 0 ? "M" : "L").concat(xp(i, data.length).toFixed(1), ",").concat(yp(v).toFixed(1));
1870
- }).join(" ");
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",