@undp/data-viz 1.5.5 → 1.5.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.
Files changed (67) hide show
  1. package/dist/BiVariateChoroplethMap.cjs +1 -1
  2. package/dist/BiVariateChoroplethMap.js +2 -2
  3. package/dist/ChoroplethMap.cjs +1 -1
  4. package/dist/ChoroplethMap.cjs.map +1 -1
  5. package/dist/ChoroplethMap.d.ts +0 -2
  6. package/dist/ChoroplethMap.js +2 -2
  7. package/dist/ChoroplethMap.js.map +1 -1
  8. package/dist/DotDensityMap.cjs +1 -1
  9. package/dist/DotDensityMap.js +2 -2
  10. package/dist/GraphEl-C6yjl1VM.cjs +2 -0
  11. package/dist/GraphEl-C6yjl1VM.cjs.map +1 -0
  12. package/dist/{GraphEl-CMWeARJ3.js → GraphEl-CqWzvOyr.js} +1 -2
  13. package/dist/GraphEl-CqWzvOyr.js.map +1 -0
  14. package/dist/GriddedGraphs.cjs +1 -1
  15. package/dist/GriddedGraphs.d.ts +1 -1
  16. package/dist/GriddedGraphs.js +1 -1
  17. package/dist/GriddedGraphsFromConfig.d.ts +1 -1
  18. package/dist/MultiGraphDashboard.d.ts +1 -1
  19. package/dist/MultiGraphDashboardFromConfig.d.ts +1 -1
  20. package/dist/PerformanceIntensiveMultiGraphDashboard.d.ts +1 -1
  21. package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.d.ts +1 -1
  22. package/dist/PerformanceIntensiveScrollStory.d.ts +1 -1
  23. package/dist/ScrollStory.d.ts +1 -1
  24. package/dist/SingleGraphDashboard.cjs +1 -1
  25. package/dist/SingleGraphDashboard.d.ts +1 -1
  26. package/dist/SingleGraphDashboard.js +1 -1
  27. package/dist/SingleGraphDashboardFromConfig.d.ts +1 -1
  28. package/dist/SingleGraphDashboardGeoHubMaps.d.ts +1 -1
  29. package/dist/SingleGraphDashboardGeoHubMapsFromConfig.d.ts +1 -1
  30. package/dist/SingleGraphDashboardThreeDGraphs.cjs +1 -1
  31. package/dist/SingleGraphDashboardThreeDGraphs.cjs.map +1 -1
  32. package/dist/SingleGraphDashboardThreeDGraphs.d.ts +1 -1
  33. package/dist/SingleGraphDashboardThreeDGraphs.js +2 -2
  34. package/dist/SingleGraphDashboardThreeDGraphs.js.map +1 -1
  35. package/dist/SingleGraphDashboardThreeDGraphsFromConfig.d.ts +1 -1
  36. package/dist/ThreeDGlobe.cjs +1 -1
  37. package/dist/ThreeDGlobe.cjs.map +1 -1
  38. package/dist/ThreeDGlobe.d.ts +2 -2
  39. package/dist/ThreeDGlobe.js +276 -280
  40. package/dist/ThreeDGlobe.js.map +1 -1
  41. package/dist/Types.d.ts +1 -1
  42. package/dist/getCentroidCoordinates-Dfk6IqEG.js +70 -0
  43. package/dist/getCentroidCoordinates-Dfk6IqEG.js.map +1 -0
  44. package/dist/getCentroidCoordinates-DxTBqzp2.cjs +2 -0
  45. package/dist/getCentroidCoordinates-DxTBqzp2.cjs.map +1 -0
  46. package/dist/index-9tDEUqOZ.js +752 -0
  47. package/dist/{index-qfWCwobm.js.map → index-9tDEUqOZ.js.map} +1 -1
  48. package/dist/index-CoZbeNM9.cjs +2 -0
  49. package/dist/{index-D05lK1Te.cjs.map → index-CoZbeNM9.cjs.map} +1 -1
  50. package/dist/index.cjs +1 -1
  51. package/dist/index.d.ts +10 -5
  52. package/dist/index.js +34 -32
  53. package/dist/index.js.map +1 -1
  54. package/dist/utils.cjs +1 -1
  55. package/dist/utils.d.ts +8 -0
  56. package/dist/utils.js +16 -14
  57. package/dist/utils.js.map +1 -1
  58. package/dist/{zoom-Bsbhil-K.cjs → zoom-BiMNsz72.cjs} +2 -2
  59. package/dist/{zoom-Bsbhil-K.cjs.map → zoom-BiMNsz72.cjs.map} +1 -1
  60. package/dist/{zoom-DAu91HKr.js → zoom-QipiAl5W.js} +2 -2
  61. package/dist/{zoom-DAu91HKr.js.map → zoom-QipiAl5W.js.map} +1 -1
  62. package/package.json +2 -1
  63. package/dist/GraphEl-BcYgMnN2.cjs +0 -2
  64. package/dist/GraphEl-BcYgMnN2.cjs.map +0 -1
  65. package/dist/GraphEl-CMWeARJ3.js.map +0 -1
  66. package/dist/index-D05lK1Te.cjs +0 -2
  67. package/dist/index-qfWCwobm.js +0 -682
@@ -1,39 +1,39 @@
1
- import { j as r, m as fe } from "./index-CHPV5EwG-BPSP-7Jg.js";
2
- import { useState as j, useRef as ge, useEffect as N, useCallback as me } from "react";
3
- import { y as xe } from "./Spinner-C85UF28E.js";
4
- import ve from "react-globe.gl";
5
- import { i as we } from "./index-Bwrro8-q.js";
6
- import * as O from "three";
7
- import { X as be } from "./Modal-DVVwpKhP.js";
1
+ import { j as r, m as xe } from "./index-CHPV5EwG-BPSP-7Jg.js";
2
+ import { useState as N, useRef as ge, useEffect as D, useCallback as me } from "react";
3
+ import { y as ve } from "./Spinner-C85UF28E.js";
4
+ import we from "react-globe.gl";
5
+ import { i as be } from "./index-Bwrro8-q.js";
6
+ import * as P from "three";
7
+ import { X as Ce } from "./Modal-DVVwpKhP.js";
8
8
  import { u as ue } from "./Typography-Ctgfl1J5.js";
9
- import { t as Ce } from "./index-qfWCwobm.js";
10
9
  import { T as je } from "./Tooltip-CVCGWyzw.js";
11
10
  import { n as ke } from "./numberFormattingFunction-14YCbkN2.js";
12
11
  import { X as Se } from "./index-BmCqpO1B.js";
13
12
  import { s as De } from "./string2HTML-oFCROsus.js";
14
- import { o as Ne } from "./ordinal-w9Lu4Stb.js";
13
+ import { g as Ne } from "./getCentroidCoordinates-Dfk6IqEG.js";
14
+ import { o as Le } from "./ordinal-w9Lu4Stb.js";
15
15
  import { t as Me } from "./threshold-DFfqcDMa.js";
16
- import { GraphHeader as Le } from "./GraphHeader.js";
17
- import { GraphFooter as ze } from "./GraphFooter.js";
18
- import { f as Oe } from "./fetchAndParseData-sapWbnYk.js";
16
+ import { GraphHeader as ze } from "./GraphHeader.js";
17
+ import { GraphFooter as Oe } from "./GraphFooter.js";
18
+ import { f as Pe } from "./fetchAndParseData-sapWbnYk.js";
19
19
  import { Colors as A } from "./Colors.js";
20
20
  import { g as Re } from "./getUniqValue-DiCh_MOD.js";
21
- import { g as Pe } from "./getJenks-BbngDoBQ.js";
22
- function Te(e) {
21
+ import { g as Te } from "./getJenks-BbngDoBQ.js";
22
+ function Ee(e) {
23
23
  let a;
24
24
  switch (e.type) {
25
25
  case "ambient":
26
- a = new O.AmbientLight(e.color, e.intensity);
26
+ a = new P.AmbientLight(e.color, e.intensity);
27
27
  break;
28
28
  case "directional":
29
- a = new O.DirectionalLight(e.color, e.intensity), e.position && (e.position === "camera" ? a.position.set(0, 0, 0) : a.position.set(e.position.x, e.position.y, e.position.z)), (e.target || e.position === "camera") && a.target.position.set(
29
+ a = new P.DirectionalLight(e.color, e.intensity), e.position && (e.position === "camera" ? a.position.set(0, 0, 0) : a.position.set(e.position.x, e.position.y, e.position.z)), (e.target || e.position === "camera") && a.target.position.set(
30
30
  e.target?.x || 0,
31
31
  e.target?.y || 0,
32
32
  e.target?.z === void 0 ? -1 : e.target.z
33
33
  ), e.castShadow && (a.castShadow = !0, e.shadow && (a.shadow.mapSize.width = e.shadow.mapSize.width, a.shadow.mapSize.height = e.shadow.mapSize.height, a.shadow.camera.near = e.shadow.camera.near, a.shadow.camera.far = e.shadow.camera.far));
34
34
  break;
35
35
  case "point":
36
- a = new O.PointLight(
36
+ a = new P.PointLight(
37
37
  e.color,
38
38
  e.intensity,
39
39
  e.distance || 0,
@@ -41,7 +41,7 @@ function Te(e) {
41
41
  ), e.position && (e.position === "camera" ? a.position.set(0, 0, 0) : a.position.set(e.position.x, e.position.y, e.position.z));
42
42
  break;
43
43
  case "spot":
44
- a = new O.SpotLight(
44
+ a = new P.SpotLight(
45
45
  e.color,
46
46
  e.intensity,
47
47
  e.distance || 0,
@@ -59,145 +59,139 @@ function Te(e) {
59
59
  }
60
60
  return a;
61
61
  }
62
- function Ee(e) {
62
+ function Ae(e) {
63
63
  const {
64
64
  width: a,
65
- autoRotate: v,
66
- data: w,
65
+ autoRotate: x,
66
+ data: v,
67
67
  enableZoom: H,
68
68
  categorical: R,
69
- colorDomain: p,
70
- colors: n,
71
- globeMaterial: l,
72
- height: W,
73
- polygonData: oe,
74
- mapProperty: h,
75
- mapBorderColor: $,
76
- atmosphereColor: _,
77
- tooltip: q,
78
- styles: k,
69
+ colorDomain: h,
70
+ colors: l,
71
+ globeMaterial: c,
72
+ height: V,
73
+ polygonData: $,
74
+ mapProperty: d,
75
+ mapBorderColor: F,
76
+ atmosphereColor: X,
77
+ tooltip: Z,
78
+ styles: C,
79
79
  classNames: re,
80
- mapNoDataColor: m,
81
- colorLegendTitle: F,
82
- showColorScale: ae,
83
- hoverStrokeColor: ie,
84
- detailsOnClick: b,
85
- onSeriesMouseClick: M,
86
- onSeriesMouseOver: f,
87
- resetSelectionOnDoubleClick: P,
88
- highlightedIds: V,
89
- scale: u,
90
- globeOffset: S,
91
- polygonAltitude: G,
80
+ mapNoDataColor: u,
81
+ colorLegendTitle: G,
82
+ showColorScale: oe,
83
+ hoverStrokeColor: ae,
84
+ detailsOnClick: w,
85
+ onSeriesMouseClick: L,
86
+ onSeriesMouseOver: y,
87
+ resetSelectionOnDoubleClick: T,
88
+ highlightedIds: J,
89
+ scale: g,
90
+ globeOffset: j,
91
+ polygonAltitude: I,
92
92
  centerLng: B,
93
- centerLat: I,
94
- atmosphereAltitude: X,
95
- globeCurvatureResolution: se,
96
- fogSettings: L,
93
+ centerLat: U,
94
+ atmosphereAltitude: _,
95
+ globeCurvatureResolution: ie,
96
+ fogSettings: M,
97
97
  lights: z,
98
- highlightedAltitude: Z
99
- } = e, [J, ne] = j(!1), s = ge(void 0), [x, T] = j(void 0), [E, Y] = j(
100
- void 0
101
- ), [le, K] = j(!(a < 680)), [Q, de] = j({ x: 0, y: 0 }), [C, U] = j(void 0), g = R ? Ne().domain(p).range(n) : Me().domain(p).range(n);
102
- N(() => {
103
- s.current && (s.current.controls().enableZoom = H);
104
- }, [H]), N(() => {
105
- s.current && (C || x ? s.current.controls().autoRotate = !1 : (s.current.controls().autoRotate = v !== 0, s.current.controls().autoRotateSpeed = v));
106
- }, [C, x, v]), N(() => {
107
- s.current && E && s.current.pointOfView(
108
- { lat: E[1], lng: E[0], altitude: u },
109
- 1e3
110
- );
111
- }, [E, u]), N(() => {
112
- const t = s.current?.renderer().domElement;
98
+ highlightedAltitude: Y,
99
+ selectedId: f
100
+ } = e, [K, se] = N(!1), n = ge(void 0), [k, E] = N(void 0), [ne, Q] = N(!(a < 680)), [ee, le] = N({ x: 0, y: 0 }), [S, de] = N(void 0), W = R ? Le().domain(h).range(l) : Me().domain(h).range(l);
101
+ D(() => {
102
+ n.current && (n.current.controls().enableZoom = H);
103
+ }, [H]), D(() => {
104
+ n.current && (S || f ? n.current.controls().autoRotate = !1 : (n.current.controls().autoRotate = x !== 0, n.current.controls().autoRotateSpeed = x));
105
+ }, [S, f, x]), D(() => {
106
+ if (n.current && f) {
107
+ const t = $.find(
108
+ (m) => m.properties[d] === f
109
+ ), [o, s] = Ne(t);
110
+ n.current.pointOfView({ lat: s, lng: o, altitude: g }, 1e3);
111
+ }
112
+ }, [f, g, $, d]), D(() => {
113
+ const t = n.current?.renderer().domElement;
113
114
  if (!t) return;
114
- const i = (o) => {
115
- de({ x: o.clientX, y: o.clientY });
115
+ const o = (s) => {
116
+ le({ x: s.clientX, y: s.clientY });
116
117
  };
117
- return t.addEventListener("mousemove", i), () => t.removeEventListener("mousemove", i);
118
- }, []), N(() => {
119
- s.current && s.current.pointOfView({ lat: I, lng: B, altitude: u }, 1e3);
120
- }, [u, B, I]);
121
- const ee = l || new O.MeshBasicMaterial({
118
+ return t.addEventListener("mousemove", o), () => t.removeEventListener("mousemove", o);
119
+ }, []), D(() => {
120
+ n.current && n.current.pointOfView({ lat: U, lng: B, altitude: g }, 1e3);
121
+ }, [g, B, U]);
122
+ const q = c || new P.MeshBasicMaterial({
122
123
  color: "#FFF"
123
- }), D = me(() => {
124
- if (!s.current) return;
125
- const t = s.current.scene(), i = s.current.camera();
126
- let o = [];
127
- t.traverse((d) => {
128
- d instanceof O.Light && o.push(d);
129
- }), o = [...o, ...i.children], o.forEach((d) => d.parent?.remove(d)), z.map((d) => Te(d)).forEach((d, y) => {
130
- z[y].type !== "ambient" && z[y].position === "camera" ? (i.add(d), z[y].type !== "point" && i.add(d.target)) : t.add(d);
131
- }), L && (t.fog = new O.Fog(L.color, L.near, L.far));
132
- }, [z, L]), te = me(() => {
133
- ne(!0), D();
134
- }, [D]);
135
- return N(() => {
136
- J && D();
137
- }, [J, D]), /* @__PURE__ */ r.jsxs("div", { className: "relative", children: [
124
+ }), p = me(() => {
125
+ if (!n.current) return;
126
+ const t = n.current.scene(), o = n.current.camera();
127
+ let s = [];
128
+ t.traverse((i) => {
129
+ i instanceof P.Light && s.push(i);
130
+ }), s = [...s, ...o.children], s.forEach((i) => i.parent?.remove(i)), z.map((i) => Ee(i)).forEach((i, b) => {
131
+ z[b].type !== "ambient" && z[b].position === "camera" ? (o.add(i), z[b].type !== "point" && o.add(i.target)) : t.add(i);
132
+ }), M && (t.fog = new P.Fog(M.color, M.near, M.far));
133
+ }, [z, M]), te = me(() => {
134
+ se(!0), p();
135
+ }, [p]);
136
+ return D(() => {
137
+ K && p();
138
+ }, [K, p]), /* @__PURE__ */ r.jsxs("div", { className: "relative", children: [
138
139
  /* @__PURE__ */ r.jsx(
139
- ve,
140
+ we,
140
141
  {
141
- ref: s,
142
- height: W,
142
+ ref: n,
143
+ height: V,
143
144
  width: a,
144
- globeOffset: S,
145
+ globeOffset: j,
145
146
  lineHoverPrecision: 0,
146
- polygonsData: oe,
147
- polygonAltitude: (t) => V.includes(t?.properties?.[h]) || t?.properties?.[h] === C?.id || t?.properties?.[h] === x?.id ? Z : G,
147
+ polygonsData: $,
148
+ polygonAltitude: (t) => J.includes(t?.properties?.[d]) || t?.properties?.[d] === f ? Y * (t?.properties?.[d] === f ? 2 : 1) : t?.properties?.[d] === S?.id || t?.properties?.[d] === k?.id ? Y : I,
148
149
  polygonCapColor: (t) => {
149
- const i = t?.properties?.[h], o = w.find((c) => c.id === i)?.x;
150
- return o != null ? g(o) : m;
150
+ const o = t?.properties?.[d], s = v.find((m) => m.id === o)?.x;
151
+ return s != null ? W(s) : u;
151
152
  },
152
153
  polygonSideColor: (t) => {
153
- const i = t?.properties?.[h], o = w.find((d) => d.id === i)?.x, c = o != null ? g(o) : m;
154
- return V.includes(t?.properties?.[h]) ? c : "rgba(100,100,100,0)";
154
+ const o = t?.properties?.[d], s = v.find((i) => i.id === o)?.x, m = s != null ? W(s) : u;
155
+ return J.includes(t?.properties?.[d]) || t?.properties?.[d] === f ? m : "rgba(100,100,100,0)";
155
156
  },
156
- polygonStrokeColor: (t) => t?.properties?.[h] === C?.id ? ie : $,
157
+ polygonStrokeColor: (t) => t?.properties?.[d] === S?.id ? ae : F,
157
158
  onGlobeClick: () => {
158
- T(void 0);
159
+ E(void 0);
159
160
  },
160
161
  onPolygonClick: (t) => {
161
- const i = t?.properties?.[h] ? w.find((o) => o.id === t?.properties?.[h]) : void 0;
162
- if (M || b)
163
- if (we(x, i) && P && i)
164
- T(void 0), M?.(void 0), Y(void 0);
165
- else {
166
- T(i), M?.(i);
167
- const [o, c] = Ce(t).geometry.coordinates;
168
- Y([o, c]);
169
- }
162
+ const o = t?.properties?.[d] ? v.find((s) => s.id === t?.properties?.[d]) : void 0;
163
+ (L || w) && (be(k, o) && T && o ? (E(void 0), L?.(void 0)) : (E(o), L?.(o)));
170
164
  },
171
165
  onPolygonHover: (t) => {
172
- const i = t?.properties?.[h] ? w.find((o) => o.id === t?.properties?.[h]) : void 0;
173
- U(i), f?.(i);
166
+ const o = t?.properties?.[d] ? v.find((s) => s.id === t?.properties?.[d]) : void 0;
167
+ de(o), y?.(o);
174
168
  },
175
- atmosphereColor: _,
176
- atmosphereAltitude: X,
177
- globeCurvatureResolution: se,
178
- globeMaterial: ee,
169
+ atmosphereColor: X,
170
+ atmosphereAltitude: _,
171
+ globeCurvatureResolution: ie,
172
+ globeMaterial: q,
179
173
  backgroundColor: "rgba(0, 0, 0, 0)",
180
174
  polygonsTransitionDuration: 100,
181
175
  onGlobeReady: () => {
182
- if (s.current) {
183
- s.current.pointOfView({
184
- lat: I,
176
+ if (n.current) {
177
+ n.current.pointOfView({
178
+ lat: U,
185
179
  lng: B
186
180
  });
187
- const t = s.current.scene();
181
+ const t = n.current.scene();
188
182
  setTimeout(() => {
189
- (t.children[3]?.children[0]?.children[4]?.children || []).forEach((c) => {
190
- const d = c.children[1];
191
- d.renderOrder = 2;
183
+ (t.children[3]?.children[0]?.children[4]?.children || []).forEach((m) => {
184
+ const i = m.children[1];
185
+ i.renderOrder = 2;
192
186
  });
193
187
  }, 300);
194
- const i = s.current.camera();
195
- t.add(i), te();
188
+ const o = n.current.camera();
189
+ t.add(o), te();
196
190
  }
197
191
  }
198
192
  }
199
193
  ),
200
- ae === !1 ? null : /* @__PURE__ */ r.jsx("div", { className: "absolute left-4 bottom-4", children: le ? /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
194
+ oe === !1 ? null : /* @__PURE__ */ r.jsx("div", { className: "absolute left-4 bottom-4", children: ne ? /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
201
195
  /* @__PURE__ */ r.jsx(
202
196
  "div",
203
197
  {
@@ -215,7 +209,7 @@ function Ee(e) {
215
209
  top: "-0.75rem"
216
210
  },
217
211
  onClick: () => {
218
- K(!1);
212
+ Q(!1);
219
213
  },
220
214
  children: /* @__PURE__ */ r.jsx(Se, {})
221
215
  }
@@ -229,7 +223,7 @@ function Ee(e) {
229
223
  width: R ? void 0 : "340px"
230
224
  },
231
225
  children: [
232
- F && F !== "" ? /* @__PURE__ */ r.jsx(
226
+ G && G !== "" ? /* @__PURE__ */ r.jsx(
233
227
  ue,
234
228
  {
235
229
  size: "xs",
@@ -240,54 +234,54 @@ function Ee(e) {
240
234
  WebkitLineClamp: "1",
241
235
  WebkitBoxOrient: "vertical"
242
236
  },
243
- children: F
237
+ children: G
244
238
  }
245
239
  ) : null,
246
- R ? /* @__PURE__ */ r.jsx("div", { className: "flex flex-col gap-3", children: p.map((t, i) => /* @__PURE__ */ r.jsxs("div", { className: "flex gap-2 items-center", children: [
240
+ R ? /* @__PURE__ */ r.jsx("div", { className: "flex flex-col gap-3", children: h.map((t, o) => /* @__PURE__ */ r.jsxs("div", { className: "flex gap-2 items-center", children: [
247
241
  /* @__PURE__ */ r.jsx(
248
242
  "div",
249
243
  {
250
244
  className: "w-2 h-2 rounded-full",
251
- style: { backgroundColor: n[i % n.length] }
245
+ style: { backgroundColor: l[o % l.length] }
252
246
  }
253
247
  ),
254
248
  /* @__PURE__ */ r.jsx(ue, { size: "sm", marginBottom: "none", leading: "none", children: t })
255
- ] }, i)) }) : /* @__PURE__ */ r.jsx("svg", { width: "100%", viewBox: "0 0 320 30", direction: "ltr", children: /* @__PURE__ */ r.jsxs("g", { children: [
256
- p.map((t, i) => /* @__PURE__ */ r.jsxs("g", { className: "cursor-pointer", children: [
249
+ ] }, o)) }) : /* @__PURE__ */ r.jsx("svg", { width: "100%", viewBox: "0 0 320 30", direction: "ltr", children: /* @__PURE__ */ r.jsxs("g", { children: [
250
+ h.map((t, o) => /* @__PURE__ */ r.jsxs("g", { className: "cursor-pointer", children: [
257
251
  /* @__PURE__ */ r.jsx(
258
252
  "rect",
259
253
  {
260
- x: i * 320 / n.length + 1,
254
+ x: o * 320 / l.length + 1,
261
255
  y: 1,
262
- width: 320 / n.length - 2,
256
+ width: 320 / l.length - 2,
263
257
  height: 8,
264
258
  style: {
265
- fill: n[i],
266
- stroke: n[i]
259
+ fill: l[o],
260
+ stroke: l[o]
267
261
  }
268
262
  }
269
263
  ),
270
264
  /* @__PURE__ */ r.jsx(
271
265
  "text",
272
266
  {
273
- x: (i + 1) * 320 / n.length,
267
+ x: (o + 1) * 320 / l.length,
274
268
  y: 25,
275
269
  className: "fill-primary-gray-700 dark:fill-primary-gray-300 text-xs",
276
270
  style: { textAnchor: "middle" },
277
271
  children: ke(t, "NA")
278
272
  }
279
273
  )
280
- ] }, i)),
274
+ ] }, o)),
281
275
  /* @__PURE__ */ r.jsx("g", { children: /* @__PURE__ */ r.jsx(
282
276
  "rect",
283
277
  {
284
- x: p.length * 320 / n.length + 1,
278
+ x: h.length * 320 / l.length + 1,
285
279
  y: 1,
286
- width: 320 / n.length - 2,
280
+ width: 320 / l.length - 2,
287
281
  height: 8,
288
282
  style: {
289
- fill: n[p.length],
290
- stroke: n[p.length]
283
+ fill: l[h.length],
284
+ stroke: l[h.length]
291
285
  }
292
286
  }
293
287
  ) })
@@ -301,35 +295,35 @@ function Ee(e) {
301
295
  type: "button",
302
296
  className: "mb-0 border-0 bg-transparent p-0 self-start",
303
297
  onClick: () => {
304
- K(!0);
298
+ Q(!0);
305
299
  },
306
300
  children: /* @__PURE__ */ r.jsx("div", { className: "items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-550 border-primary-gray-400 dark:border-primary-gray-500", children: "Show Legend" })
307
301
  }
308
302
  ) }),
309
- C && q ? /* @__PURE__ */ r.jsx(
303
+ S && Z ? /* @__PURE__ */ r.jsx(
310
304
  je,
311
305
  {
312
- data: C,
313
- body: q,
314
- xPos: Q.x,
315
- yPos: Q.y,
316
- backgroundStyle: k?.tooltip,
306
+ data: S,
307
+ body: Z,
308
+ xPos: ee.x,
309
+ yPos: ee.y,
310
+ backgroundStyle: C?.tooltip,
317
311
  className: re?.tooltip
318
312
  }
319
313
  ) : null,
320
- b && x !== void 0 ? /* @__PURE__ */ r.jsx(
321
- be,
314
+ w && k !== void 0 ? /* @__PURE__ */ r.jsx(
315
+ Ce,
322
316
  {
323
- open: x !== void 0,
317
+ open: k !== void 0,
324
318
  onClose: () => {
325
- T(void 0);
319
+ E(void 0);
326
320
  },
327
321
  children: /* @__PURE__ */ r.jsx(
328
322
  "div",
329
323
  {
330
324
  className: "graph-modal-content m-0",
331
- dangerouslySetInnerHTML: typeof b == "string" ? { __html: De(b, x) } : void 0,
332
- children: typeof b == "function" ? b(x) : null
325
+ dangerouslySetInnerHTML: typeof w == "string" ? { __html: De(w, k) } : void 0,
326
+ children: typeof w == "function" ? w(k) : null
333
327
  }
334
328
  )
335
329
  }
@@ -339,51 +333,51 @@ function Ee(e) {
339
333
  function ot(e) {
340
334
  const {
341
335
  data: a,
342
- mapData: v = "https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap-simplified.json",
343
- graphTitle: w,
336
+ mapData: x = "https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap-simplified.json",
337
+ graphTitle: v,
344
338
  colors: H,
345
339
  sources: R,
346
- graphDescription: p,
347
- height: n,
348
- width: l,
349
- footNote: W = "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.",
350
- colorDomain: oe,
351
- colorLegendTitle: h,
352
- scaleType: $ = "threshold",
353
- padding: _,
354
- mapNoDataColor: q = A.light.graphNoData,
355
- backgroundColor: k = !1,
340
+ graphDescription: h,
341
+ height: l,
342
+ width: c,
343
+ footNote: V = "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.",
344
+ colorDomain: $,
345
+ colorLegendTitle: d,
346
+ scaleType: F = "threshold",
347
+ padding: X,
348
+ mapNoDataColor: Z = A.light.graphNoData,
349
+ backgroundColor: C = !1,
356
350
  mapBorderColor: re = A.light.grays["gray-500"],
357
- relativeHeight: m,
358
- tooltip: F,
359
- graphID: ae,
360
- mapProperty: ie = "ISO3",
361
- dataDownload: b = !1,
362
- language: M = "en",
363
- minHeight: f = 0,
364
- theme: P = "light",
365
- ariaLabel: V,
366
- styles: u,
367
- classNames: S,
368
- autoRotate: G = !0,
351
+ relativeHeight: u,
352
+ tooltip: G,
353
+ graphID: oe,
354
+ mapProperty: ae = "ISO3",
355
+ dataDownload: w = !1,
356
+ language: L = "en",
357
+ minHeight: y = 0,
358
+ theme: T = "light",
359
+ ariaLabel: J,
360
+ styles: g,
361
+ classNames: j,
362
+ autoRotate: I = !0,
369
363
  enableZoom: B = !0,
370
- globeMaterial: I,
371
- centerPoint: X = [0, 0],
372
- atmosphereColor: se = "#999",
373
- showColorScale: L = !0,
364
+ globeMaterial: U,
365
+ centerPoint: _ = [0, 0],
366
+ atmosphereColor: ie = "#999",
367
+ showColorScale: M = !0,
374
368
  resetSelectionOnDoubleClick: z = !0,
375
- detailsOnClick: Z,
376
- onSeriesMouseOver: J,
377
- onSeriesMouseClick: ne,
378
- highlightedIds: s = [],
379
- highlightedAltitude: x = 0.1,
380
- scale: T = 1,
369
+ detailsOnClick: Y,
370
+ onSeriesMouseOver: f,
371
+ onSeriesMouseClick: K,
372
+ highlightedIds: se = [],
373
+ highlightedAltitude: n = 0.1,
374
+ scale: k = 1,
381
375
  globeOffset: E = [0, 0],
382
- polygonAltitude: Y = 0.01,
383
- globeCurvatureResolution: le = 4,
384
- atmosphereAltitude: K = 0.15,
385
- fogSettings: Q,
386
- lights: de = [
376
+ polygonAltitude: ne = 0.01,
377
+ globeCurvatureResolution: Q = 4,
378
+ atmosphereAltitude: ee = 0.15,
379
+ fogSettings: le,
380
+ lights: S = [
387
381
  {
388
382
  type: "ambient",
389
383
  color: 4210752,
@@ -395,154 +389,156 @@ function ot(e) {
395
389
  intensity: 1,
396
390
  position: { x: 5, y: 10, z: 5 }
397
391
  }
398
- ]
399
- } = e, [C, U] = j(void 0), [g, ee] = j(0), [D, te] = j(0), t = ge(null);
400
- N(() => {
401
- const o = new ResizeObserver((c) => {
402
- ee(l || c[0].target.clientWidth || 760), te(n || c[0].target.clientHeight || 480);
392
+ ],
393
+ selectedId: de
394
+ } = e, [W, q] = N(void 0), [p, te] = N(0), [t, o] = N(0), s = ge(null);
395
+ D(() => {
396
+ const i = new ResizeObserver((b) => {
397
+ te(c || b[0].target.clientWidth || 760), o(l || b[0].target.clientHeight || 480);
403
398
  });
404
- return t.current && (te(t.current.clientHeight || 480), ee(t.current.clientWidth || 760), l || o.observe(t.current)), () => o.disconnect();
405
- }, [l, n]), N(() => {
406
- typeof v == "string" ? Oe(v).then((c) => {
407
- if (v === "https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap-simplified.json") {
408
- const d = c.features.map((y) => {
409
- if (y.geometry.type === "Polygon") {
410
- const ce = [...y.geometry.coordinates[0]].reverse(), he = { ...y.geometry, coordinates: [ce] };
411
- return { ...y, geometry: he };
399
+ return s.current && (o(s.current.clientHeight || 480), te(s.current.clientWidth || 760), c || i.observe(s.current)), () => i.disconnect();
400
+ }, [c, l]), D(() => {
401
+ typeof x == "string" ? Pe(x).then((b) => {
402
+ if (x === "https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap-simplified.json") {
403
+ const ye = b.features.map((O) => {
404
+ if (O.geometry.type === "Polygon") {
405
+ const ce = [...O.geometry.coordinates[0]].reverse(), pe = { ...O.geometry, coordinates: [ce] };
406
+ return { ...O, geometry: pe };
412
407
  }
413
- const pe = [];
414
- y.geometry.coordinates.forEach((ce) => {
415
- const he = [...ce[0]].reverse();
416
- pe.push([he]);
408
+ const he = [];
409
+ O.geometry.coordinates.forEach((ce) => {
410
+ const pe = [...ce[0]].reverse();
411
+ he.push([pe]);
417
412
  });
418
- const ye = { ...y.geometry, coordinates: pe };
419
- return { ...y, geometry: ye };
413
+ const fe = { ...O.geometry, coordinates: he };
414
+ return { ...O, geometry: fe };
420
415
  });
421
- U(d);
422
- } else U(c.features);
423
- }) : U(v.features);
424
- }, [v]);
425
- const i = oe || ($ === "categorical" ? Re(a, "x") : Pe(
426
- a.map((o) => o.x),
416
+ q(ye);
417
+ } else q(b.features);
418
+ }) : q(x.features);
419
+ }, [x]);
420
+ const m = $ || (F === "categorical" ? Re(a, "x") : Te(
421
+ a.map((i) => i.x),
427
422
  H?.length || 4
428
423
  ));
429
424
  return /* @__PURE__ */ r.jsx(
430
425
  "div",
431
426
  {
432
- className: `${P || "light"} flex ${l ? "w-fit grow-0" : "w-full grow"}`,
433
- dir: M === "he" || M === "ar" ? "rtl" : void 0,
427
+ className: `${T || "light"} flex ${c ? "w-fit grow-0" : "w-full grow"}`,
428
+ dir: L === "he" || L === "ar" ? "rtl" : void 0,
434
429
  children: /* @__PURE__ */ r.jsx(
435
430
  "div",
436
431
  {
437
- className: fe(
438
- `${k ? k === !0 ? "bg-primary-gray-200 dark:bg-primary-gray-650 " : "" : "bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${M || "en"}`,
439
- l ? "w-fit" : "w-full",
440
- S?.graphContainer
432
+ className: xe(
433
+ `${C ? C === !0 ? "bg-primary-gray-200 dark:bg-primary-gray-650 " : "" : "bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${L || "en"}`,
434
+ c ? "w-fit" : "w-full",
435
+ j?.graphContainer
441
436
  ),
442
437
  style: {
443
- ...u?.graphContainer || {},
444
- ...k && k !== !0 ? { backgroundColor: k } : {}
438
+ ...g?.graphContainer || {},
439
+ ...C && C !== !0 ? { backgroundColor: C } : {}
445
440
  },
446
- id: ae,
447
- "aria-label": V || `${w ? `The graph shows ${w}. ` : ""}This is a map.${p ? ` ${p}` : ""}`,
441
+ id: oe,
442
+ "aria-label": J || `${v ? `The graph shows ${v}. ` : ""}This is a map.${h ? ` ${h}` : ""}`,
448
443
  children: /* @__PURE__ */ r.jsx(
449
444
  "div",
450
445
  {
451
446
  className: "flex grow",
452
- style: { padding: k ? _ || "1rem" : _ || 0 },
447
+ style: { padding: C ? X || "1rem" : X || 0 },
453
448
  children: /* @__PURE__ */ r.jsxs("div", { className: "flex flex-col w-full gap-4 grow justify-between", children: [
454
- w || p || b ? /* @__PURE__ */ r.jsx(
455
- Le,
449
+ v || h || w ? /* @__PURE__ */ r.jsx(
450
+ ze,
456
451
  {
457
452
  styles: {
458
- title: u?.title,
459
- description: u?.description
453
+ title: g?.title,
454
+ description: g?.description
460
455
  },
461
456
  classNames: {
462
- title: S?.title,
463
- description: S?.description
457
+ title: j?.title,
458
+ description: j?.description
464
459
  },
465
- graphTitle: w,
466
- graphDescription: p,
467
- width: l,
460
+ graphTitle: v,
461
+ graphDescription: h,
462
+ width: c,
468
463
  graphDownload: void 0,
469
- dataDownload: b ? a.map((o) => o.data).filter((o) => o !== void 0).length > 0 ? a.map((o) => o.data).filter((o) => o !== void 0) : a.filter((o) => o !== void 0) : null
464
+ dataDownload: w ? a.map((i) => i.data).filter((i) => i !== void 0).length > 0 ? a.map((i) => i.data).filter((i) => i !== void 0) : a.filter((i) => i !== void 0) : null
470
465
  }
471
466
  ) : null,
472
467
  /* @__PURE__ */ r.jsx(
473
468
  "div",
474
469
  {
475
470
  className: "flex flex-col grow justify-center leading-0",
476
- ref: t,
471
+ ref: s,
477
472
  "aria-label": "Map area",
478
- children: (l || g) && (n || D) && C ? /* @__PURE__ */ r.jsx(
479
- Ee,
473
+ children: (c || p) && (l || t) && W ? /* @__PURE__ */ r.jsx(
474
+ Ae,
480
475
  {
481
476
  data: a,
482
477
  globeOffset: E,
483
- polygonData: C,
484
- colorDomain: i,
485
- width: l || g,
478
+ polygonData: W,
479
+ colorDomain: m,
480
+ width: c || p,
486
481
  height: Math.max(
487
- f,
488
- n || (m ? f ? (l || g) * m > f ? (l || g) * m : f : (l || g) * m : D)
482
+ y,
483
+ l || (u ? y ? (c || p) * u > y ? (c || p) * u : y : (c || p) * u : t)
489
484
  ),
490
- colors: H || ($ === "categorical" ? A[P].sequentialColors[`neutralColorsx0${i.length}`] : A[P].sequentialColors[`neutralColorsx0${i.length + 1}`]),
491
- mapNoDataColor: q,
492
- categorical: $ === "categorical",
485
+ colors: H || (F === "categorical" ? A[T].sequentialColors[`neutralColorsx0${m.length}`] : A[T].sequentialColors[`neutralColorsx0${m.length + 1}`]),
486
+ mapNoDataColor: Z,
487
+ categorical: F === "categorical",
493
488
  mapBorderColor: re,
494
- tooltip: F,
495
- mapProperty: ie,
496
- styles: u,
497
- classNames: S,
498
- autoRotate: G === !0 ? 1.5 : G === !1 ? 0 : G,
489
+ tooltip: G,
490
+ mapProperty: ae,
491
+ styles: g,
492
+ classNames: j,
493
+ autoRotate: I === !0 ? 1.5 : I === !1 ? 0 : I,
499
494
  enableZoom: B,
500
- globeMaterial: I,
501
- atmosphereColor: se,
502
- colorLegendTitle: h,
503
- showColorScale: L,
504
- hoverStrokeColor: P === "light" ? A.light.grays["gray-700"] : A.light.grays["gray-300"],
505
- highlightedIds: s,
495
+ globeMaterial: U,
496
+ atmosphereColor: ie,
497
+ colorLegendTitle: d,
498
+ showColorScale: M,
499
+ hoverStrokeColor: T === "light" ? A.light.grays["gray-700"] : A.light.grays["gray-300"],
500
+ highlightedIds: se,
506
501
  resetSelectionOnDoubleClick: z,
507
- detailsOnClick: Z,
508
- onSeriesMouseOver: J,
509
- onSeriesMouseClick: ne,
510
- scale: T,
511
- polygonAltitude: Y,
512
- centerLat: X[0],
513
- centerLng: X[1],
514
- atmosphereAltitude: K,
515
- globeCurvatureResolution: le,
516
- fogSettings: Q,
517
- lights: de,
518
- highlightedAltitude: x
502
+ detailsOnClick: Y,
503
+ onSeriesMouseOver: f,
504
+ onSeriesMouseClick: K,
505
+ scale: k,
506
+ polygonAltitude: ne,
507
+ centerLat: _[0],
508
+ centerLng: _[1],
509
+ atmosphereAltitude: ee,
510
+ globeCurvatureResolution: Q,
511
+ fogSettings: le,
512
+ lights: S,
513
+ highlightedAltitude: n,
514
+ selectedId: de
519
515
  }
520
516
  ) : /* @__PURE__ */ r.jsx(
521
517
  "div",
522
518
  {
523
519
  style: {
524
520
  height: `${Math.max(
525
- f,
526
- n || (m ? f ? (l || g) * m > f ? (l || g) * m : f : (l || g) * m : D)
521
+ y,
522
+ l || (u ? y ? (c || p) * u > y ? (c || p) * u : y : (c || p) * u : t)
527
523
  )}px`
528
524
  },
529
525
  className: "flex items-center justify-center",
530
- children: /* @__PURE__ */ r.jsx(xe, { "aria-label": "Loading graph" })
526
+ children: /* @__PURE__ */ r.jsx(ve, { "aria-label": "Loading graph" })
531
527
  }
532
528
  )
533
529
  }
534
530
  ),
535
- R || W ? /* @__PURE__ */ r.jsx(
536
- ze,
531
+ R || V ? /* @__PURE__ */ r.jsx(
532
+ Oe,
537
533
  {
538
- styles: { footnote: u?.footnote, source: u?.source },
534
+ styles: { footnote: g?.footnote, source: g?.source },
539
535
  classNames: {
540
- footnote: S?.footnote,
541
- source: S?.source
536
+ footnote: j?.footnote,
537
+ source: j?.source
542
538
  },
543
539
  sources: R,
544
- footNote: W,
545
- width: l
540
+ footNote: V,
541
+ width: c
546
542
  }
547
543
  ) : null
548
544
  ] })