@undp/data-viz 1.4.7 → 1.4.9

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.
Files changed (38) hide show
  1. package/dist/AreaChart.cjs +1 -1
  2. package/dist/AreaChart.cjs.map +1 -1
  3. package/dist/AreaChart.js +58 -58
  4. package/dist/AreaChart.js.map +1 -1
  5. package/dist/DifferenceLineChart.cjs +1 -1
  6. package/dist/DifferenceLineChart.cjs.map +1 -1
  7. package/dist/DifferenceLineChart.js +44 -44
  8. package/dist/DifferenceLineChart.js.map +1 -1
  9. package/dist/DualAxisLineChart.cjs +1 -1
  10. package/dist/DualAxisLineChart.cjs.map +1 -1
  11. package/dist/DualAxisLineChart.js +1 -1
  12. package/dist/DualAxisLineChart.js.map +1 -1
  13. package/dist/LineChartWithConfidenceInterval.cjs +1 -1
  14. package/dist/LineChartWithConfidenceInterval.cjs.map +1 -1
  15. package/dist/LineChartWithConfidenceInterval.js +33 -33
  16. package/dist/LineChartWithConfidenceInterval.js.map +1 -1
  17. package/dist/MultiLineAltChart.cjs +1 -1
  18. package/dist/MultiLineAltChart.cjs.map +1 -1
  19. package/dist/MultiLineAltChart.js +78 -78
  20. package/dist/MultiLineAltChart.js.map +1 -1
  21. package/dist/MultiLineChart.cjs +1 -1
  22. package/dist/MultiLineChart.cjs.map +1 -1
  23. package/dist/MultiLineChart.js +28 -28
  24. package/dist/MultiLineChart.js.map +1 -1
  25. package/dist/ScatterPlot.cjs +1 -1
  26. package/dist/ScatterPlot.cjs.map +1 -1
  27. package/dist/ScatterPlot.js +43 -43
  28. package/dist/ScatterPlot.js.map +1 -1
  29. package/dist/SimpleLineChart.cjs +1 -1
  30. package/dist/SimpleLineChart.cjs.map +1 -1
  31. package/dist/SimpleLineChart.js +17 -17
  32. package/dist/SimpleLineChart.js.map +1 -1
  33. package/dist/SparkLine.cjs +1 -1
  34. package/dist/SparkLine.cjs.map +1 -1
  35. package/dist/SparkLine.js +1 -1
  36. package/dist/SparkLine.js.map +1 -1
  37. package/dist/style.css +1 -1
  38. package/package.json +2 -2
@@ -42,7 +42,7 @@ function yi(ye) {
42
42
  colors: s,
43
43
  colorDomain: w,
44
44
  radius: O,
45
- xAxisTitle: g,
45
+ xAxisTitle: h,
46
46
  yAxisTitle: J,
47
47
  leftMargin: q,
48
48
  rightMargin: de,
@@ -83,17 +83,17 @@ function yi(ye) {
83
83
  } = ye, ue = Se(null), p = si(ue, {
84
84
  once: l.once,
85
85
  amount: l.amount
86
- }), [X, Y] = V(void 0), [I, W] = V(void 0), [ge, R] = V(void 0), [he, v] = V(void 0), h = {
86
+ }), [X, Y] = V(void 0), [I, W] = V(void 0), [ge, R] = V(void 0), [he, v] = V(void 0), u = {
87
87
  top: pe,
88
- bottom: g ? ae + 50 : ae,
88
+ bottom: h ? ae + 50 : ae,
89
89
  left: J ? q + 30 : q,
90
90
  right: de
91
- }, _ = o.map((e, d) => ({ ...e, id: `${d}` })), y = L - h.left - h.right, b = D - h.top - h.bottom, C = o.filter((e) => e.radius === void 0 || e.radius === null).length !== o.length ? ri().domain([0, Ce]).range([0.25, O]).nice() : void 0, u = _.filter((e) => !c(e.radius)).length === 0 ? _ : Ge(
91
+ }, _ = o.map((e, d) => ({ ...e, id: `${d}` })), y = L - u.left - u.right, b = D - u.top - u.bottom, C = o.filter((e) => e.radius === void 0 || e.radius === null).length !== o.length ? ri().domain([0, Ce]).range([0.25, O]).nice() : void 0, g = _.filter((e) => !c(e.radius)).length === 0 ? _ : Ge(
92
92
  _.filter((e) => !c(e.radius)),
93
93
  "radius",
94
94
  "desc"
95
95
  ), r = Ye().domain([j, z]).range([0, y]).nice(), n = Ye().domain([A, we]).range([b, 0]).nice(), ee = r.ticks(le), ie = n.ticks(se), F = li.from(
96
- u.filter((e) => !c(e.x) && !c(e.y)),
96
+ g.filter((e) => !c(e.x) && !c(e.y)),
97
97
  (e) => r(e.x),
98
98
  (e) => n(e.y)
99
99
  ).voronoi([0, 0, y < 0 ? 0 : y, b < 0 ? 0 : b]), Ae = qe(
@@ -108,7 +108,7 @@ function yi(ye) {
108
108
  viewBox: `0 0 ${L} ${D}`,
109
109
  direction: "ltr",
110
110
  ref: ue,
111
- children: /* @__PURE__ */ t.jsxs("g", { transform: `translate(${h.left},${h.top})`, children: [
111
+ children: /* @__PURE__ */ t.jsxs("g", { transform: `translate(${u.left},${u.top})`, children: [
112
112
  /* @__PURE__ */ t.jsxs(Ie, { children: [
113
113
  /* @__PURE__ */ t.jsx(
114
114
  ai,
@@ -140,7 +140,7 @@ function yi(ye) {
140
140
  values: ie.filter((e) => e !== 0),
141
141
  y: ie.filter((e) => e !== 0).map((e) => n(e)),
142
142
  x1: 0,
143
- x2: y + h.right,
143
+ x2: y + u.right,
144
144
  styles: {
145
145
  gridLines: x?.yAxis?.gridLines,
146
146
  labels: x?.yAxis?.labels
@@ -163,7 +163,7 @@ function yi(ye) {
163
163
  y1: n(A < 0 ? 0 : A),
164
164
  y2: n(A < 0 ? 0 : A),
165
165
  x1: 0,
166
- x2: y + h.right,
166
+ x2: y + u.right,
167
167
  label: Te(
168
168
  A < 0 ? 0 : A,
169
169
  "NA",
@@ -262,16 +262,16 @@ function yi(ye) {
262
262
  y: b + 30,
263
263
  style: x?.xAxis?.title,
264
264
  className: m?.xAxis?.title,
265
- text: g
265
+ text: h
266
266
  }
267
267
  )
268
268
  ] }),
269
269
  fe.filter((e) => e.position === "before").map((e) => e.layer),
270
270
  /* @__PURE__ */ t.jsxs(Ie, { children: [
271
- u.filter((e) => !c(e.x) && !c(e.y)).map((e, d) => /* @__PURE__ */ t.jsx(
271
+ g.filter((e) => !c(e.x) && !c(e.y)).map((e, d) => /* @__PURE__ */ t.jsx(
272
272
  "path",
273
273
  {
274
- d: F.renderCell(u.findIndex((a) => a.id === e.id)),
274
+ d: F.renderCell(g.findIndex((a) => a.id === e.id)),
275
275
  opacity: 0,
276
276
  onMouseEnter: (a) => {
277
277
  Y(e), v(a.clientY), R(a.clientX), H?.(e);
@@ -288,7 +288,7 @@ function yi(ye) {
288
288
  },
289
289
  `${e.label || d}`
290
290
  )),
291
- u.filter((e) => !c(e.x) && !c(e.y)).map((e, d) => /* @__PURE__ */ t.jsxs(
291
+ g.filter((e) => !c(e.x) && !c(e.y)).map((e, d) => /* @__PURE__ */ t.jsxs(
292
292
  te.g,
293
293
  {
294
294
  variants: {
@@ -460,7 +460,7 @@ function yi(ye) {
460
460
  } : void 0, E = {
461
461
  y: e.yCoordinate ? n(e.yCoordinate) + (e.yOffset || 0) - 8 : 0 + (e.yOffset || 0) - 8,
462
462
  x: K ? 0 : e.xCoordinate ? r(e.xCoordinate) + (e.xOffset || 0) : 0 + (e.xOffset || 0),
463
- width: K ? e.xCoordinate ? r(e.xCoordinate) + (e.xOffset || 0) : 0 + (e.xOffset || 0) : y - (e.xCoordinate ? r(e.xCoordinate) + (e.xOffset || 0) : 0 + (e.xOffset || 0)),
463
+ width: K ? e.xCoordinate ? r(e.xCoordinate) + (e.xOffset || 0) : 0 + (e.xOffset || 0) : y + u.right - (e.xCoordinate ? r(e.xCoordinate) + (e.xOffset || 0) : 0 + (e.xOffset || 0)),
464
464
  maxWidth: e.maxWidth,
465
465
  fontWeight: e.fontWeight,
466
466
  align: e.align
@@ -540,7 +540,7 @@ function Qi(ye) {
540
540
  graphDescription: s,
541
541
  showLabels: w = !1,
542
542
  height: O,
543
- width: g,
543
+ width: h,
544
544
  footNote: J,
545
545
  colorDomain: q,
546
546
  colorLegendTitle: de,
@@ -588,50 +588,50 @@ function Qi(ye) {
588
588
  noOfYTicks: R = 5,
589
589
  labelColor: he,
590
590
  styles: v,
591
- classNames: h,
591
+ classNames: u,
592
592
  animate: _ = !1,
593
593
  dimmedOpacity: y = 0.3,
594
594
  precision: b = 2,
595
595
  customLayers: C = [],
596
- timeline: u = { enabled: !1, autoplay: !1, showOnlyActiveDate: !0 }
597
- } = ye, [r, n] = V(0), [ee, ie] = V(0), [F, Ae] = V(u.autoplay), f = We(
596
+ timeline: g = { enabled: !1, autoplay: !1, showOnlyActiveDate: !0 }
597
+ } = ye, [r, n] = V(0), [ee, ie] = V(0), [F, Ae] = V(g.autoplay), f = We(
598
598
  ke(
599
599
  o.filter((i) => i.date !== void 0 && i.date !== null),
600
600
  (i) => i.date
601
- ).map((i) => Re(`${i.date}`, u.dateFormat || "yyyy", /* @__PURE__ */ new Date()).getTime()),
601
+ ).map((i) => Re(`${i.date}`, g.dateFormat || "yyyy", /* @__PURE__ */ new Date()).getTime()),
602
602
  (i, G) => hi(i, G)
603
- ), [e, d] = V(u.autoplay ? 0 : f.length - 1), [a, Me] = V(void 0), E = Se(null), Ve = Se(null);
603
+ ), [e, d] = V(g.autoplay ? 0 : f.length - 1), [a, Me] = V(void 0), E = Se(null), Ve = Se(null);
604
604
  De(() => {
605
605
  const i = new ResizeObserver((G) => {
606
- n(g || G[0].target.clientWidth || 620), ie(O || G[0].target.clientHeight || 480);
606
+ n(h || G[0].target.clientWidth || 620), ie(O || G[0].target.clientHeight || 480);
607
607
  });
608
- return E.current && (ie(E.current.clientHeight || 480), n(E.current.clientWidth || 620), g || i.observe(E.current)), () => i.disconnect();
609
- }, [g, O]), De(() => {
608
+ return E.current && (ie(E.current.clientHeight || 480), n(E.current.clientWidth || 620), h || i.observe(E.current)), () => i.disconnect();
609
+ }, [h, O]), De(() => {
610
610
  const i = setInterval(
611
611
  () => {
612
612
  d((G) => G < f.length - 1 ? G + 1 : 0);
613
613
  },
614
- (u.speed || 2) * 1e3
614
+ (g.speed || 2) * 1e3
615
615
  );
616
616
  return F || clearInterval(i), () => clearInterval(i);
617
- }, [f, F, u.speed]);
617
+ }, [f, F, g.speed]);
618
618
  const Le = Fe(
619
619
  f,
620
620
  e,
621
- u.showOnlyActiveDate,
622
- u.dateFormat || "yyyy"
621
+ g.showOnlyActiveDate,
622
+ g.dateFormat || "yyyy"
623
623
  );
624
624
  return /* @__PURE__ */ t.jsx(
625
625
  "div",
626
626
  {
627
- className: `${p || "light"} flex ${g ? "w-fit grow-0" : "w-full grow"}`,
627
+ className: `${p || "light"} flex ${h ? "w-fit grow-0" : "w-full grow"}`,
628
628
  dir: l === "he" || l === "ar" ? "rtl" : void 0,
629
629
  children: /* @__PURE__ */ t.jsx(
630
630
  "div",
631
631
  {
632
632
  className: Ne(
633
633
  `${$ ? $ === !0 ? "bg-primary-gray-200 dark:bg-primary-gray-650 " : "" : "bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${l || "en"}`,
634
- h?.graphContainer
634
+ u?.graphContainer
635
635
  ),
636
636
  style: {
637
637
  ...v?.graphContainer || {},
@@ -654,17 +654,17 @@ function Qi(ye) {
654
654
  description: v?.description
655
655
  },
656
656
  classNames: {
657
- title: h?.title,
658
- description: h?.description
657
+ title: u?.title,
658
+ description: u?.description
659
659
  },
660
660
  graphTitle: L,
661
661
  graphDescription: s,
662
- width: g,
662
+ width: h,
663
663
  graphDownload: x ? Ve.current : void 0,
664
664
  dataDownload: m ? o.map((i) => i.data).filter((i) => i !== void 0).length > 0 ? o.map((i) => i.data).filter((i) => i !== void 0) : o.filter((i) => i !== void 0) : null
665
665
  }
666
666
  ) : null,
667
- u.enabled && f.length > 0 && Le ? /* @__PURE__ */ t.jsxs("div", { className: "flex gap-6 items-center", dir: "ltr", children: [
667
+ g.enabled && f.length > 0 && Le ? /* @__PURE__ */ t.jsxs("div", { className: "flex gap-6 items-center", dir: "ltr", children: [
668
668
  /* @__PURE__ */ t.jsx(
669
669
  "button",
670
670
  {
@@ -700,7 +700,7 @@ function Qi(ye) {
700
700
  K && o.filter((i) => i.color).length !== 0 ? /* @__PURE__ */ t.jsx(
701
701
  xi,
702
702
  {
703
- width: g,
703
+ width: h,
704
704
  colorLegendTitle: de,
705
705
  colors: D || N[p].categoricalColors.colors,
706
706
  colorDomain: q || ke(
@@ -717,22 +717,22 @@ function Qi(ye) {
717
717
  className: "flex flex-col grow justify-center w-full leading-0",
718
718
  ref: E,
719
719
  "aria-label": "Graph area",
720
- children: (g || r) && (O || ee) ? /* @__PURE__ */ t.jsx(
720
+ children: (h || r) && (O || ee) ? /* @__PURE__ */ t.jsx(
721
721
  yi,
722
722
  {
723
723
  data: gi(
724
724
  o,
725
- u.dateFormat || "yyyy"
725
+ g.dateFormat || "yyyy"
726
726
  ).filter(
727
- (i) => u.enabled ? i.date === He(
727
+ (i) => g.enabled ? i.date === He(
728
728
  new Date(f[e]),
729
- u.dateFormat || "yyyy"
729
+ g.dateFormat || "yyyy"
730
730
  ) : i
731
731
  ),
732
- width: g || r,
732
+ width: h || r,
733
733
  height: Math.max(
734
734
  S,
735
- O || (z ? S ? (g || r) * z > S ? (g || r) * z : S : (g || r) * z : ee)
735
+ O || (z ? S ? (h || r) * z > S ? (h || r) * z : S : (h || r) * z : ee)
736
736
  ),
737
737
  colorDomain: o.filter((i) => i.color).length === 0 ? [] : q || ke(
738
738
  o.filter((i) => i.color),
@@ -792,7 +792,7 @@ function Qi(ye) {
792
792
  xPrefix: ce,
793
793
  yPrefix: xe,
794
794
  styles: v,
795
- classNames: h,
795
+ classNames: u,
796
796
  animate: _ === !0 ? { duration: 0.5, once: !0, amount: 0.5 } : _ || { duration: 0, once: !0, amount: 0 },
797
797
  dimmedOpacity: y,
798
798
  precision: b,
@@ -807,12 +807,12 @@ function Qi(ye) {
807
807
  {
808
808
  styles: { footnote: v?.footnote, source: v?.source },
809
809
  classNames: {
810
- footnote: h?.footnote,
811
- source: h?.source
810
+ footnote: u?.footnote,
811
+ source: u?.source
812
812
  },
813
813
  sources: oe,
814
814
  footNote: J,
815
- width: g
815
+ width: h
816
816
  }
817
817
  ) : null
818
818
  ] })