@undp/data-viz 1.5.6 → 1.5.8

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