@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.es.js CHANGED
@@ -1723,6 +1723,29 @@ var TrendText = function TrendText(_ref2) {
1723
1723
  });
1724
1724
  };
1725
1725
 
1726
+ // ─── SVG path helpers ─────────────────────────────────────────────────────────
1727
+ var buildSmoothPath = function buildSmoothPath(points) {
1728
+ if (!points.length) return "";
1729
+ if (points.length === 1) return "M".concat(points[0][0].toFixed(1), ",").concat(points[0][1].toFixed(1));
1730
+ if (points.length === 2) {
1731
+ 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));
1732
+ }
1733
+ var d = "M".concat(points[0][0].toFixed(1), ",").concat(points[0][1].toFixed(1));
1734
+ for (var i = 0; i < points.length - 1; i++) {
1735
+ var _points, _points2;
1736
+ var p0 = (_points = points[i - 1]) !== null && _points !== void 0 ? _points : points[i];
1737
+ var p1 = points[i];
1738
+ var p2 = points[i + 1];
1739
+ var p3 = (_points2 = points[i + 2]) !== null && _points2 !== void 0 ? _points2 : p2;
1740
+ var cp1x = p1[0] + (p2[0] - p0[0]) / 6;
1741
+ var cp1y = p1[1] + (p2[1] - p0[1]) / 6;
1742
+ var cp2x = p2[0] - (p3[0] - p1[0]) / 6;
1743
+ var cp2y = p2[1] - (p3[1] - p1[1]) / 6;
1744
+ 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));
1745
+ }
1746
+ return d;
1747
+ };
1748
+
1726
1749
  // ─── SVG line sparkline ───────────────────────────────────────────────────────
1727
1750
  var Sparkline = function Sparkline(_ref3) {
1728
1751
  var _ref3$data = _ref3.data,
@@ -1741,9 +1764,7 @@ var Sparkline = function Sparkline(_ref3) {
1741
1764
  var pts = vals.map(function (v, i) {
1742
1765
  return [pad + i / (vals.length - 1) * (width - pad * 2), pad + (height - pad * 2) - (v - min) / range * (height - pad * 2)];
1743
1766
  });
1744
- var d = pts.map(function (p, i) {
1745
- return "".concat(i === 0 ? "M" : "L").concat(p[0].toFixed(1), ",").concat(p[1].toFixed(1));
1746
- }).join(" ");
1767
+ var d = buildSmoothPath(pts);
1747
1768
  var area = "".concat(d, " L").concat((width - pad).toFixed(1), ",").concat(height, " L").concat(pad, ",").concat(height, " Z");
1748
1769
  var gradId = "sp-".concat(color.replace(/[^a-z0-9]/gi, ""));
1749
1770
  return /*#__PURE__*/jsxs("svg", {
@@ -1863,9 +1884,10 @@ var LineChart = function LineChart(_ref4) {
1863
1884
  }), series.map(function (s, si) {
1864
1885
  var data = s.data || [];
1865
1886
  if (!data.length) return null;
1866
- var pathD = data.map(function (v, i) {
1867
- return "".concat(i === 0 ? "M" : "L").concat(xp(i, data.length).toFixed(1), ",").concat(yp(v).toFixed(1));
1868
- }).join(" ");
1887
+ var points = data.map(function (v, i) {
1888
+ return [xp(i, data.length), yp(v)];
1889
+ });
1890
+ var pathD = buildSmoothPath(points);
1869
1891
  return /*#__PURE__*/jsx("path", {
1870
1892
  d: pathD,
1871
1893
  fill: "none",