@undp/data-viz 1.4.6 → 1.4.7

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.
@@ -32,7 +32,7 @@ function st(be) {
32
32
  xColorLegendTitle: E,
33
33
  yDomain: W,
34
34
  yColorLegendTitle: T,
35
- width: m,
35
+ width: d,
36
36
  height: l,
37
37
  colors: q,
38
38
  scale: G,
@@ -49,15 +49,15 @@ function st(be) {
49
49
  mapProperty: V,
50
50
  resetSelectionOnDoubleClick: w,
51
51
  detailsOnClick: M,
52
- showColorScale: de,
52
+ showColorScale: me,
53
53
  styles: we,
54
54
  classNames: je,
55
55
  mapProjection: F,
56
56
  zoomInteraction: P,
57
57
  animate: j,
58
58
  dimmedOpacity: H,
59
- customLayers: me
60
- } = be, [pe, J] = v(!(m < 680)), [X, R] = v(void 0), [g, K] = v(void 0), [_, Z] = v(void 0), [he, $] = v(void 0), [D, Q] = v(void 0), I = ie(null), U = tt(I, {
59
+ customLayers: de
60
+ } = be, [pe, J] = v(!(d < 680)), [X, R] = v(void 0), [g, K] = v(void 0), [_, Z] = v(void 0), [he, $] = v(void 0), [D, Q] = v(void 0), I = ie(null), U = tt(I, {
61
61
  once: j.once,
62
62
  amount: j.amount
63
63
  }), ge = ie(null), ee = ie(null);
@@ -65,19 +65,19 @@ function st(be) {
65
65
  const e = $e(ge.current), n = $e(I.current), r = (a) => {
66
66
  if (P === "noZoom") return !1;
67
67
  if (P === "button") return !a.type.includes("wheel");
68
- const i = a.type === "wheel", d = a.type.startsWith("touch"), s = a.type === "mousedown" || a.type === "mousemove";
69
- return d ? !0 : i ? P === "scroll" ? !0 : a.ctrlKey : s && !a.button && !a.ctrlKey;
68
+ const i = a.type === "wheel", m = a.type.startsWith("touch"), s = a.type === "mousedown" || a.type === "mousemove";
69
+ return m ? !0 : i ? P === "scroll" ? !0 : a.ctrlKey : s && !a.button && !a.ctrlKey;
70
70
  }, o = Fe().scaleExtent(ce).translateExtent(
71
71
  ke || [
72
72
  [-20, -20],
73
- [m + 20, l + 20]
73
+ [d + 20, l + 20]
74
74
  ]
75
75
  ).filter(r).on("zoom", ({ transform: a }) => {
76
76
  e.attr("transform", a);
77
77
  });
78
78
  n.call(o), ee.current = o;
79
- }, [l, m, P]);
80
- const p = He(f), u = Xe(f), ue = p[2] - p[0], te = p[3] - p[1], ye = m * 190 / 960 * 360 / ue, L = l * 190 / 678 * 180 / te, z = G * Math.min(ye, L), c = F === "mercator" ? Re().rotate([0, 0]).center(N || u.geometry.coordinates).translate([m / 2, l / 2]).scale(z) : F === "equalEarth" ? _e().rotate([0, 0]).center(N || u.geometry.coordinates).translate([m / 2, l / 2]).scale(z) : F === "naturalEarth" ? Ue().rotate([0, 0]).center(N || u.geometry.coordinates).translate([m / 2, l / 2]).scale(z) : F === "orthographic" ? Ye().rotate([0, 0]).center(N || u.geometry.coordinates).translate([m / 2, l / 2]).scale(z) : qe().rotate([0, 0]).center(N || u.geometry.coordinates).translate([m / 2, l / 2]).scale(z), re = Array.from({ length: C.length }, (e, n) => n), ae = Array.from({ length: W.length }, (e, n) => n), Y = Se().domain(C).range(re), fe = Se().domain(W).range(ae), S = (e) => {
79
+ }, [l, d, P]);
80
+ const p = He(f), y = Xe(f), ye = p[2] - p[0], te = p[3] - p[1], ue = d * 190 / 960 * 360 / ye, L = l * 190 / 678 * 180 / te, z = G * Math.min(ue, L), c = F === "mercator" ? Re().rotate([0, 0]).center(N || y.geometry.coordinates).translate([d / 2, l / 2]).scale(z) : F === "equalEarth" ? _e().rotate([0, 0]).center(N || y.geometry.coordinates).translate([d / 2, l / 2]).scale(z) : F === "naturalEarth" ? Ue().rotate([0, 0]).center(N || y.geometry.coordinates).translate([d / 2, l / 2]).scale(z) : F === "orthographic" ? Ye().rotate([0, 0]).center(N || y.geometry.coordinates).translate([d / 2, l / 2]).scale(z) : qe().rotate([0, 0]).center(N || y.geometry.coordinates).translate([d / 2, l / 2]).scale(z), re = Array.from({ length: C.length }, (e, n) => n), ae = Array.from({ length: W.length }, (e, n) => n), Y = Se().domain(C).range(re), fe = Se().domain(W).range(ae), S = (e) => {
81
81
  if (!I.current || !ee.current) return;
82
82
  $e(I.current).call(ee.current.scaleBy, e === "in" ? 1.2 : 1 / 1.2);
83
83
  };
@@ -86,13 +86,13 @@ function st(be) {
86
86
  /* @__PURE__ */ t.jsx(
87
87
  oe.svg,
88
88
  {
89
- viewBox: `0 0 ${m} ${l}`,
90
- width: `${m}px`,
89
+ viewBox: `0 0 ${d} ${l}`,
90
+ width: `${d}px`,
91
91
  height: `${l}px`,
92
92
  ref: I,
93
93
  direction: "ltr",
94
94
  children: /* @__PURE__ */ t.jsxs("g", { ref: ge, children: [
95
- me.filter((e) => e.position === "before").map((e) => e.layer),
95
+ de.filter((e) => e.position === "before").map((e) => e.layer),
96
96
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
97
97
  f.features.map((e, n) => b.findIndex((o) => o.id === e.properties[V]) !== -1 ? null : /* @__PURE__ */ t.jsx(
98
98
  oe.g,
@@ -102,11 +102,11 @@ function st(be) {
102
102
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
103
103
  e.geometry.coordinates.map((o, a) => {
104
104
  let i = "";
105
- return o.forEach((d) => {
105
+ return o.forEach((m) => {
106
106
  let s = " M";
107
- d.forEach((h, y) => {
107
+ m.forEach((h, u) => {
108
108
  const x = c([h[0], h[1]]);
109
- y !== d.length - 1 ? s = `${s}${x[0]} ${x[1]}L` : s = `${s}${x[0]} ${x[1]}`;
109
+ u !== m.length - 1 ? s = `${s}${x[0]} ${x[1]}L` : s = `${s}${x[0]} ${x[1]}`;
110
110
  }), i += s;
111
111
  }), /* @__PURE__ */ t.jsx(
112
112
  "path",
@@ -125,8 +125,8 @@ function st(be) {
125
125
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
126
126
  e.geometry.coordinates.map((o, a) => {
127
127
  let i = "M";
128
- return o.forEach((d, s) => {
129
- const h = c([d[0], d[1]]);
128
+ return o.forEach((m, s) => {
129
+ const h = c([m[0], m[1]]);
130
130
  s !== o.length - 1 ? i = `${i}${h[0]} ${h[1]}L` : i = `${i}${h[0]} ${h[1]}`;
131
131
  }), /* @__PURE__ */ t.jsx(
132
132
  "path",
@@ -177,14 +177,14 @@ function st(be) {
177
177
  },
178
178
  children: n === -1 ? null : f.features[n].geometry.type === "MultiPolygon" ? f.features[n].geometry.coordinates.map(
179
179
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
180
- (i, d) => {
180
+ (i, m) => {
181
181
  let s = "";
182
182
  return i.forEach((h) => {
183
- let y = " M";
183
+ let u = " M";
184
184
  h.forEach((x, Oe) => {
185
185
  const xe = c([x[0], x[1]]);
186
- Oe !== h.length - 1 ? y = `${y}${xe[0]} ${xe[1]}L` : y = `${y}${xe[0]} ${xe[1]}`;
187
- }), s += y;
186
+ Oe !== h.length - 1 ? u = `${u}${xe[0]} ${xe[1]}L` : u = `${u}${xe[0]} ${xe[1]}`;
187
+ }), s += u;
188
188
  }), /* @__PURE__ */ t.jsx(
189
189
  oe.path,
190
190
  {
@@ -205,16 +205,16 @@ function st(be) {
205
205
  strokeWidth: A
206
206
  }
207
207
  },
208
- `${e.id}-${d}`
208
+ `${e.id}-${m}`
209
209
  );
210
210
  }
211
211
  ) : f.features[n].geometry.coordinates.map(
212
212
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
213
- (i, d) => {
213
+ (i, m) => {
214
214
  let s = "M";
215
- return i.forEach((h, y) => {
215
+ return i.forEach((h, u) => {
216
216
  const x = c([h[0], h[1]]);
217
- y !== i.length - 1 ? s = `${s}${x[0]} ${x[1]}L` : s = `${s}${x[0]} ${x[1]}`;
217
+ u !== i.length - 1 ? s = `${s}${x[0]} ${x[1]}L` : s = `${s}${x[0]} ${x[1]}`;
218
218
  }), /* @__PURE__ */ t.jsx(
219
219
  oe.path,
220
220
  {
@@ -235,7 +235,7 @@ function st(be) {
235
235
  strokeWidth: A
236
236
  }
237
237
  },
238
- `${e.id}-${d}`
238
+ `${e.id}-${m}`
239
239
  );
240
240
  }
241
241
  )
@@ -251,11 +251,11 @@ function st(be) {
251
251
  e.geometry.coordinates.map((r, o) => {
252
252
  let a = "";
253
253
  return r.forEach((i) => {
254
- let d = " M";
254
+ let m = " M";
255
255
  i.forEach((s, h) => {
256
- const y = c([s[0], s[1]]);
257
- h !== i.length - 1 ? d = `${d}${y[0]} ${y[1]}L` : d = `${d}${y[0]} ${y[1]}`;
258
- }), a += d;
256
+ const u = c([s[0], s[1]]);
257
+ h !== i.length - 1 ? m = `${m}${u[0]} ${u[1]}L` : m = `${m}${u[0]} ${u[1]}`;
258
+ }), a += m;
259
259
  }), /* @__PURE__ */ t.jsx(
260
260
  "path",
261
261
  {
@@ -274,9 +274,9 @@ function st(be) {
274
274
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
275
275
  e.geometry.coordinates.map((r, o) => {
276
276
  let a = "M";
277
- return r.forEach((i, d) => {
277
+ return r.forEach((i, m) => {
278
278
  const s = c([i[0], i[1]]);
279
- d !== r.length - 1 ? a = `${a}${s[0]} ${s[1]}L` : a = `${a}${s[0]} ${s[1]}`;
279
+ m !== r.length - 1 ? a = `${a}${s[0]} ${s[1]}L` : a = `${a}${s[0]} ${s[1]}`;
280
280
  }), /* @__PURE__ */ t.jsx(
281
281
  "path",
282
282
  {
@@ -292,11 +292,11 @@ function st(be) {
292
292
  );
293
293
  })
294
294
  ) }, n)) : null,
295
- me.filter((e) => e.position === "after").map((e) => e.layer)
295
+ de.filter((e) => e.position === "after").map((e) => e.layer)
296
296
  ] })
297
297
  }
298
298
  ),
299
- de === !1 ? null : /* @__PURE__ */ t.jsx("div", { className: "absolute left-4 bottom-4", children: pe ? /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
299
+ me === !1 ? null : /* @__PURE__ */ t.jsx("div", { className: "absolute left-4 bottom-4", children: pe ? /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
300
300
  /* @__PURE__ */ t.jsx(
301
301
  "div",
302
302
  {
@@ -420,7 +420,7 @@ function st(be) {
420
420
  "button",
421
421
  {
422
422
  onClick: () => S("in"),
423
- className: "leading-0 px-2 py-3.5 border border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-400 dark:bg-primary-gray-600 dark:text-primary-gray-100",
423
+ className: "leading-0 px-2 py-3.5 border text-primary-gray-700 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-400 dark:bg-primary-gray-600 dark:text-primary-gray-100",
424
424
  children: "+"
425
425
  }
426
426
  ),
@@ -428,7 +428,7 @@ function st(be) {
428
428
  "button",
429
429
  {
430
430
  onClick: () => S("out"),
431
- className: "leading-0 px-2 py-3.5 border border-t-0 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-400 dark:bg-primary-gray-600 dark:text-primary-gray-100",
431
+ className: "leading-0 px-2 py-3.5 border text-primary-gray-700 border-t-0 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-400 dark:bg-primary-gray-600 dark:text-primary-gray-100",
432
432
  children: "–"
433
433
  }
434
434
  )
@@ -472,7 +472,7 @@ function Lt(be) {
472
472
  colors: E = Ce.light.bivariateColors.colors05x05,
473
473
  sources: W,
474
474
  graphDescription: T,
475
- height: m,
475
+ height: d,
476
476
  width: l,
477
477
  footNote: q = "The designations employed and the presentation of material on this map do not imply the expression of any opinion whatsoever on the part of the Secretariat of the United Nations or UNDP concerning the legal status of any country, territory, city or area or its authorities, or concerning the delimitation of its frontiers or boundaries.",
478
478
  xDomain: G,
@@ -489,14 +489,14 @@ function Lt(be) {
489
489
  mapBorderColor: V = Ce.light.grays["gray-500"],
490
490
  relativeHeight: w,
491
491
  onSeriesMouseOver: M,
492
- isWorldMap: de = !0,
492
+ isWorldMap: me = !0,
493
493
  zoomScaleExtend: we = [0.8, 6],
494
494
  zoomTranslateExtend: je,
495
495
  graphID: F,
496
496
  showColorScale: P = !0,
497
497
  highlightedIds: j = [],
498
498
  onSeriesMouseClick: H,
499
- mapProperty: me = "ISO3",
499
+ mapProperty: de = "ISO3",
500
500
  graphDownload: pe = !1,
501
501
  dataDownload: J = !1,
502
502
  showAntarctica: X = !1,
@@ -514,7 +514,7 @@ function Lt(be) {
514
514
  dimmedOpacity: ge = 0.3,
515
515
  customLayers: ee = [],
516
516
  timeline: p = { enabled: !1, autoplay: !1, showOnlyActiveDate: !0 }
517
- } = be, [u, ue] = v(0), [te, ye] = v(0), [L, z] = v(p.autoplay), c = Ie(
517
+ } = be, [y, ye] = v(0), [te, ue] = v(0), [L, z] = v(p.autoplay), c = Ie(
518
518
  Be(
519
519
  b.filter((r) => r.date !== void 0 && r.date !== null),
520
520
  (r) => r.date
@@ -523,10 +523,10 @@ function Lt(be) {
523
523
  ), [re, ae] = v(p.autoplay ? 0 : c.length - 1), [Y, fe] = v(void 0), S = ie(null), e = ie(null);
524
524
  ve(() => {
525
525
  const r = new ResizeObserver((o) => {
526
- ue(l || o[0].contentRect.width || 760), ye(m || o[0].target.clientHeight || 480);
526
+ ye(l || o[0].contentRect.width || 760), ue(d || o[0].target.clientHeight || 480);
527
527
  });
528
- return S.current && (ye(S.current.clientHeight || 480), ue(S.current.clientWidth || 760), l || r.observe(S.current)), () => r.disconnect();
529
- }, [l, m]), ve(() => {
528
+ return S.current && (ue(S.current.clientHeight || 480), ye(S.current.clientWidth || 760), l || r.observe(S.current)), () => r.disconnect();
529
+ }, [l, d]), ve(() => {
530
530
  typeof f == "string" ? it(f).then((o) => {
531
531
  fe(o);
532
532
  }) : fe(f);
@@ -626,7 +626,7 @@ function Lt(be) {
626
626
  className: "flex flex-col grow justify-center leading-0",
627
627
  ref: S,
628
628
  "aria-label": "Map area",
629
- children: (l || u) && (m || te) && Y ? /* @__PURE__ */ t.jsx(
629
+ children: (l || y) && (d || te) && Y ? /* @__PURE__ */ t.jsx(
630
630
  st,
631
631
  {
632
632
  data: b.filter(
@@ -647,10 +647,10 @@ function Lt(be) {
647
647
  b.map((r) => r.y),
648
648
  E.length
649
649
  ),
650
- width: l || u,
650
+ width: l || y,
651
651
  height: Math.max(
652
652
  g,
653
- m || (w ? g ? (l || u) * w > g ? (l || u) * w : g : (l || u) * w : te)
653
+ d || (w ? g ? (l || y) * w > g ? (l || y) * w : g : (l || y) * w : te)
654
654
  ),
655
655
  scale: se,
656
656
  centerPoint: le,
@@ -662,17 +662,17 @@ function Lt(be) {
662
662
  mapBorderColor: V,
663
663
  tooltip: ne,
664
664
  onSeriesMouseOver: M,
665
- isWorldMap: de,
665
+ isWorldMap: me,
666
666
  zoomScaleExtend: we,
667
667
  zoomTranslateExtend: je,
668
668
  onSeriesMouseClick: H,
669
- mapProperty: me,
669
+ mapProperty: de,
670
670
  highlightedIds: j,
671
671
  resetSelectionOnDoubleClick: Z,
672
672
  styles: $,
673
673
  showColorScale: P,
674
674
  classNames: D,
675
- mapProjection: Q || (de ? "naturalEarth" : "mercator"),
675
+ mapProjection: Q || (me ? "naturalEarth" : "mercator"),
676
676
  detailsOnClick: he,
677
677
  zoomInteraction: I,
678
678
  animate: U === !0 ? { duration: 0.5, once: !0, amount: 0.5 } : U || { duration: 0, once: !0, amount: 0 },
@@ -685,7 +685,7 @@ function Lt(be) {
685
685
  style: {
686
686
  height: `${Math.max(
687
687
  g,
688
- m || (w ? g ? (l || u) * w > g ? (l || u) * w : g : (l || u) * w : te)
688
+ d || (w ? g ? (l || y) * w > g ? (l || y) * w : g : (l || y) * w : te)
689
689
  )}px`
690
690
  },
691
691
  className: "flex items-center justify-center",