@undp/data-viz 2.1.6 → 2.1.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.
- package/dist/BarGraph.cjs +1 -1
- package/dist/BarGraph.cjs.map +1 -1
- package/dist/BarGraph.js +1 -1
- package/dist/BarGraph.js.map +1 -1
- package/dist/DonutChart.cjs +1 -1
- package/dist/DonutChart.cjs.map +1 -1
- package/dist/DonutChart.d.ts +2 -1
- package/dist/DonutChart.js +118 -118
- package/dist/DonutChart.js.map +1 -1
- package/dist/DotDensityMap.cjs +1 -1
- package/dist/DotDensityMap.cjs.map +1 -1
- package/dist/DotDensityMap.js +212 -209
- package/dist/DotDensityMap.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/package.json +2 -2
package/dist/DonutChart.js
CHANGED
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
import { c as
|
|
2
|
-
import { useRef as rt, useState as tt, useEffect as
|
|
3
|
-
import { v as
|
|
4
|
-
import { o as
|
|
5
|
-
import { n as
|
|
6
|
-
import { i as
|
|
7
|
-
import { T as
|
|
1
|
+
import { c as dt, j as a, m as pt } from "./index-CHPV5EwG-Curnpaqc.js";
|
|
2
|
+
import { useRef as rt, useState as tt, isValidElement as lt, useEffect as ft } from "react";
|
|
3
|
+
import { v as gt, j as it } from "./Typography-PxtFcnJb.js";
|
|
4
|
+
import { o as ht } from "./index-BZQYSqar.js";
|
|
5
|
+
import { n as xt } from "./Source-DwTHB8fn.js";
|
|
6
|
+
import { i as yt } from "./index-Bwrro8-q.js";
|
|
7
|
+
import { T as vt } from "./Tooltip-Dj5eVppQ.js";
|
|
8
8
|
import { Colors as X } from "./Colors.js";
|
|
9
|
-
import { n as
|
|
10
|
-
import { D as
|
|
11
|
-
import { c as T, a as
|
|
12
|
-
import { u as
|
|
13
|
-
import { A as
|
|
9
|
+
import { n as ut } from "./numberFormattingFunction-14YCbkN2.js";
|
|
10
|
+
import { D as bt } from "./DetailsModal-0Ry5nXiC.js";
|
|
11
|
+
import { c as T, a as jt } from "./array-USo-Szhp.js";
|
|
12
|
+
import { u as Mt } from "./use-in-view-Cxa7y1TH.js";
|
|
13
|
+
import { A as Nt } from "./index-BqfRwk1n.js";
|
|
14
14
|
import { m as nt } from "./proxy-BxkFHwUw.js";
|
|
15
|
-
import { GraphFooter as
|
|
16
|
-
import { GraphHeader as
|
|
17
|
-
import { E as
|
|
18
|
-
import { G as
|
|
19
|
-
const
|
|
20
|
-
function
|
|
21
|
-
return t <
|
|
15
|
+
import { GraphFooter as Ct } from "./GraphFooter.js";
|
|
16
|
+
import { GraphHeader as Dt } from "./GraphHeader.js";
|
|
17
|
+
import { E as kt } from "./EmptyState-C7ZXkZWd.js";
|
|
18
|
+
import { G as wt, a as At } from "./GraphContainer-CRqzdKu2.js";
|
|
19
|
+
const Ot = Math.PI, at = 2 * Ot;
|
|
20
|
+
function St(c, t) {
|
|
21
|
+
return t < c ? -1 : t > c ? 1 : t >= c ? 0 : NaN;
|
|
22
22
|
}
|
|
23
|
-
function
|
|
24
|
-
return
|
|
23
|
+
function zt(c) {
|
|
24
|
+
return c;
|
|
25
25
|
}
|
|
26
|
-
function
|
|
27
|
-
var
|
|
26
|
+
function Pt() {
|
|
27
|
+
var c = zt, t = St, o = null, l = T(0), n = T(at), p = T(0);
|
|
28
28
|
function r(e) {
|
|
29
|
-
var
|
|
30
|
-
for (
|
|
31
|
-
(h = b[g[
|
|
32
|
-
for (t != null ? g.sort(function(C,
|
|
33
|
-
return t(b[C], b[
|
|
34
|
-
}) : o != null && g.sort(function(C,
|
|
35
|
-
return o(e[C], e[
|
|
36
|
-
}),
|
|
37
|
-
f = g[
|
|
29
|
+
var s, x = (e = jt(e)).length, f, O, m = 0, g = new Array(x), b = new Array(x), y = +l.apply(this, arguments), S = Math.min(at, Math.max(-at, n.apply(this, arguments) - y)), d, E = Math.min(Math.abs(S) / x, p.apply(this, arguments)), G = E * (S < 0 ? -1 : 1), h;
|
|
30
|
+
for (s = 0; s < x; ++s)
|
|
31
|
+
(h = b[g[s] = s] = +c(e[s], s, e)) > 0 && (m += h);
|
|
32
|
+
for (t != null ? g.sort(function(C, z) {
|
|
33
|
+
return t(b[C], b[z]);
|
|
34
|
+
}) : o != null && g.sort(function(C, z) {
|
|
35
|
+
return o(e[C], e[z]);
|
|
36
|
+
}), s = 0, O = m ? (S - x * G) / m : 0; s < x; ++s, y = d)
|
|
37
|
+
f = g[s], h = b[f], d = y + (h > 0 ? h * O : 0) + G, b[f] = {
|
|
38
38
|
data: e[f],
|
|
39
|
-
index:
|
|
39
|
+
index: s,
|
|
40
40
|
value: h,
|
|
41
41
|
startAngle: y,
|
|
42
42
|
endAngle: d,
|
|
43
|
-
padAngle:
|
|
43
|
+
padAngle: E
|
|
44
44
|
};
|
|
45
45
|
return b;
|
|
46
46
|
}
|
|
47
47
|
return r.value = function(e) {
|
|
48
|
-
return arguments.length ? (
|
|
48
|
+
return arguments.length ? (c = typeof e == "function" ? e : T(+e), r) : c;
|
|
49
49
|
}, r.sortValues = function(e) {
|
|
50
50
|
return arguments.length ? (t = e, o = null, r) : t;
|
|
51
51
|
}, r.sort = function(e) {
|
|
52
52
|
return arguments.length ? (o = e, t = null, r) : o;
|
|
53
53
|
}, r.startAngle = function(e) {
|
|
54
|
-
return arguments.length ? (
|
|
54
|
+
return arguments.length ? (l = typeof e == "function" ? e : T(+e), r) : l;
|
|
55
55
|
}, r.endAngle = function(e) {
|
|
56
|
-
return arguments.length ? (
|
|
56
|
+
return arguments.length ? (n = typeof e == "function" ? e : T(+e), r) : n;
|
|
57
57
|
}, r.padAngle = function(e) {
|
|
58
58
|
return arguments.length ? (p = typeof e == "function" ? e : T(+e), r) : p;
|
|
59
59
|
}, r;
|
|
60
60
|
}
|
|
61
|
-
const
|
|
62
|
-
x:
|
|
63
|
-
y: t + o * Math.sin(
|
|
61
|
+
const st = (c, t, o, l) => ({
|
|
62
|
+
x: c + o * Math.cos(l),
|
|
63
|
+
y: t + o * Math.sin(l)
|
|
64
64
|
});
|
|
65
|
-
function
|
|
66
|
-
const p =
|
|
65
|
+
function ct(c, t, o, l, n) {
|
|
66
|
+
const p = st(c, t, o, l), r = st(c, t, o, Math.abs(n - l) === 2 * Math.PI ? 0.999999 * n : n), e = n - l <= Math.PI ? "0" : "1";
|
|
67
67
|
return ["M", p.x, p.y, "A", o, o, 0, e, 1, r.x, r.y].join(" ");
|
|
68
68
|
}
|
|
69
|
-
function
|
|
70
|
-
const t =
|
|
69
|
+
function Et(c) {
|
|
70
|
+
const t = dt.c(59), {
|
|
71
71
|
mainText: o,
|
|
72
|
-
data:
|
|
73
|
-
radius:
|
|
72
|
+
data: l,
|
|
73
|
+
radius: n,
|
|
74
74
|
colors: p,
|
|
75
75
|
subNote: r,
|
|
76
76
|
strokeWidth: e,
|
|
77
|
-
tooltip:
|
|
77
|
+
tooltip: s,
|
|
78
78
|
onSeriesMouseOver: x,
|
|
79
79
|
onSeriesMouseClick: f,
|
|
80
80
|
colorDomain: O,
|
|
@@ -82,35 +82,35 @@ function zt(s) {
|
|
|
82
82
|
detailsOnClick: g,
|
|
83
83
|
styles: b,
|
|
84
84
|
classNames: y,
|
|
85
|
-
precision:
|
|
85
|
+
precision: S,
|
|
86
86
|
animate: d,
|
|
87
|
-
trackColor:
|
|
88
|
-
} =
|
|
87
|
+
trackColor: E
|
|
88
|
+
} = c, G = rt(null);
|
|
89
89
|
let h;
|
|
90
90
|
t[0] !== d.amount || t[1] !== d.once ? (h = {
|
|
91
91
|
once: d.once,
|
|
92
92
|
amount: d.amount
|
|
93
93
|
}, t[0] = d.amount, t[1] = d.once, t[2] = h) : h = t[2];
|
|
94
|
-
const C =
|
|
95
|
-
let
|
|
96
|
-
t[3] !==
|
|
97
|
-
o ? /* @__PURE__ */
|
|
98
|
-
r ? /* @__PURE__ */
|
|
99
|
-
] }) }) : null, t[3] =
|
|
100
|
-
const Z =
|
|
94
|
+
const C = Mt(G, h), z = Pt().sort(null).startAngle(0).value(It), [v, Y] = tt(void 0), [j, M] = tt(void 0), [V, q] = tt(void 0), [$, R] = tt(void 0), J = nt, K = `${n * 2}px`, Q = `${n * 2}px`, D = `0 0 ${n * 2} ${n * 2}`, I = "ltr", et = "mx-auto", B = nt, U = `translate(${n} ${n})`;
|
|
95
|
+
let P;
|
|
96
|
+
t[3] !== l || t[4] !== o || t[5] !== S || t[6] !== n || t[7] !== e || t[8] !== r ? (P = o || r ? /* @__PURE__ */ a.jsx("foreignObject", { y: 0 - (n - e), x: 0 - (n - e), width: 2 * (n - e), height: 2 * (n - e), children: /* @__PURE__ */ a.jsxs("div", { className: "flex flex-col gap-0.5 justify-center items-center h-inherit py-0 px-4", children: [
|
|
97
|
+
o ? lt(o) ? o : /* @__PURE__ */ a.jsx(gt, { marginBottom: "none", className: "donut-main-text text-primary-gray-700 dark:text-primary-gray-100 leading-none text-center", children: typeof o == "string" ? o : l.findIndex((u) => u.label === o.label) !== -1 ? ut(l[l.findIndex((u) => u.label === o.label)].size, "NA", S, o.prefix, o.suffix) : "NA" }) : null,
|
|
98
|
+
r ? /* @__PURE__ */ a.jsx(it, { marginBottom: "none", size: "base", leading: "none", className: "donut-sub-note text-primary-gray-700 dark:text-primary-gray-100 text-center font-bold", children: r }) : typeof o == "string" || !o || lt(o) ? null : /* @__PURE__ */ a.jsx(it, { size: "base", marginBottom: "none", leading: "none", className: "donut-label text-primary-gray-700 dark:text-primary-gray-100 text-center font-bold", children: o.label })
|
|
99
|
+
] }) }) : null, t[3] = l, t[4] = o, t[5] = S, t[6] = n, t[7] = e, t[8] = r, t[9] = P) : P = t[9];
|
|
100
|
+
const Z = n - e / 2;
|
|
101
101
|
let k;
|
|
102
|
-
t[10] !== e || t[11] !== Z || t[12] !==
|
|
103
|
-
const
|
|
104
|
-
let
|
|
105
|
-
t[14] !== d.duration || t[15] !== O || t[16] !== p || t[17] !== g || t[18] !== C || t[19] !== j || t[20] !== v || t[21] !== f || t[22] !== x || t[23] !==
|
|
102
|
+
t[10] !== e || t[11] !== Z || t[12] !== E ? (k = /* @__PURE__ */ a.jsx("circle", { cx: 0, cy: 0, r: Z, fill: "none", stroke: E, strokeWidth: e }), t[10] = e, t[11] = Z, t[12] = E, t[13] = k) : k = t[13];
|
|
103
|
+
const F = Nt;
|
|
104
|
+
let w;
|
|
105
|
+
t[14] !== d.duration || t[15] !== O || t[16] !== p || t[17] !== g || t[18] !== C || t[19] !== j || t[20] !== v || t[21] !== f || t[22] !== x || t[23] !== n || t[24] !== m || t[25] !== M || t[26] !== e ? (w = (u, mt) => /* @__PURE__ */ a.jsx(nt.path, { variants: {
|
|
106
106
|
initial: {
|
|
107
107
|
pathLength: 0,
|
|
108
|
-
d:
|
|
108
|
+
d: ct(0, 0, n - e / 2, u.startAngle - Math.PI / 2, u.endAngle - Math.PI / 2),
|
|
109
109
|
opacity: v ? v.label === u.data.label ? 1 : 0.3 : 1
|
|
110
110
|
},
|
|
111
111
|
whileInView: {
|
|
112
112
|
pathLength: 1,
|
|
113
|
-
d:
|
|
113
|
+
d: ct(0, 0, n - e / 2, u.startAngle - Math.PI / 2, u.endAngle - Math.PI / 2),
|
|
114
114
|
opacity: v ? v.label === u.data.label ? 1 : 0.3 : 1,
|
|
115
115
|
transition: {
|
|
116
116
|
duration: d.duration
|
|
@@ -126,49 +126,49 @@ function zt(s) {
|
|
|
126
126
|
strokeWidth: e,
|
|
127
127
|
fill: "none"
|
|
128
128
|
}, onMouseEnter: (_) => {
|
|
129
|
-
Y(u.data),
|
|
129
|
+
Y(u.data), R(_.clientY), q(_.clientX), x?.(u);
|
|
130
130
|
}, onClick: () => {
|
|
131
|
-
(f || g) && (
|
|
131
|
+
(f || g) && (yt(j, u.data) && m ? (M(void 0), f?.(void 0)) : (M(u.data), f && f(u.data)));
|
|
132
132
|
}, onMouseMove: (_) => {
|
|
133
|
-
Y(u.data),
|
|
133
|
+
Y(u.data), R(_.clientY), q(_.clientX);
|
|
134
134
|
}, onMouseLeave: () => {
|
|
135
|
-
Y(void 0),
|
|
136
|
-
} },
|
|
137
|
-
const i =
|
|
135
|
+
Y(void 0), q(void 0), R(void 0), x?.(void 0);
|
|
136
|
+
} }, mt), t[14] = d.duration, t[15] = O, t[16] = p, t[17] = g, t[18] = C, t[19] = j, t[20] = v, t[21] = f, t[22] = x, t[23] = n, t[24] = m, t[25] = M, t[26] = e, t[27] = w) : w = t[27];
|
|
137
|
+
const i = z(l).map(w);
|
|
138
138
|
let N;
|
|
139
|
-
t[28] !==
|
|
140
|
-
let
|
|
141
|
-
t[31] !== k || t[32] !== N || t[33] !==
|
|
142
|
-
|
|
139
|
+
t[28] !== F || t[29] !== i ? (N = /* @__PURE__ */ a.jsx(F, { children: i }), t[28] = F, t[29] = i, t[30] = N) : N = t[30];
|
|
140
|
+
let A;
|
|
141
|
+
t[31] !== k || t[32] !== N || t[33] !== B.g || t[34] !== U || t[35] !== P ? (A = /* @__PURE__ */ a.jsxs(B.g, { transform: U, children: [
|
|
142
|
+
P,
|
|
143
143
|
k,
|
|
144
144
|
N
|
|
145
|
-
] }), t[31] = k, t[32] = N, t[33] =
|
|
145
|
+
] }), t[31] = k, t[32] = N, t[33] = B.g, t[34] = U, t[35] = P, t[36] = A) : A = t[36];
|
|
146
146
|
let L;
|
|
147
|
-
t[37] !== J.svg || t[38] !==
|
|
147
|
+
t[37] !== J.svg || t[38] !== A || t[39] !== K || t[40] !== Q || t[41] !== D ? (L = /* @__PURE__ */ a.jsx(J.svg, { ref: G, width: K, height: Q, viewBox: D, direction: I, className: et, children: A }), t[37] = J.svg, t[38] = A, t[39] = K, t[40] = Q, t[41] = D, t[42] = L) : L = t[42];
|
|
148
148
|
let W;
|
|
149
|
-
t[43] !== y?.tooltip || t[44] !==
|
|
149
|
+
t[43] !== y?.tooltip || t[44] !== V || t[45] !== $ || t[46] !== v || t[47] !== b?.tooltip || t[48] !== s ? (W = v && s && V && $ ? /* @__PURE__ */ a.jsx(vt, { data: v, body: s, xPos: V, yPos: $, backgroundStyle: b?.tooltip, className: y?.tooltip }) : null, t[43] = y?.tooltip, t[44] = V, t[45] = $, t[46] = v, t[47] = b?.tooltip, t[48] = s, t[49] = W) : W = t[49];
|
|
150
150
|
let H;
|
|
151
|
-
t[50] !== y?.modal || t[51] !== g || t[52] !== j || t[53] !== M ? (H = g && j !== void 0 ? /* @__PURE__ */
|
|
151
|
+
t[50] !== y?.modal || t[51] !== g || t[52] !== j || t[53] !== M ? (H = g && j !== void 0 ? /* @__PURE__ */ a.jsx(bt, { body: g, data: j, setData: M, className: y?.modal }) : null, t[50] = y?.modal, t[51] = g, t[52] = j, t[53] = M, t[54] = H) : H = t[54];
|
|
152
152
|
let ot;
|
|
153
|
-
return t[55] !== L || t[56] !== W || t[57] !== H ? (ot = /* @__PURE__ */
|
|
153
|
+
return t[55] !== L || t[56] !== W || t[57] !== H ? (ot = /* @__PURE__ */ a.jsxs(a.Fragment, { children: [
|
|
154
154
|
L,
|
|
155
155
|
W,
|
|
156
156
|
H
|
|
157
157
|
] }), t[55] = L, t[56] = W, t[57] = H, t[58] = ot) : ot = t[58], ot;
|
|
158
158
|
}
|
|
159
|
-
function It(
|
|
160
|
-
return
|
|
159
|
+
function It(c) {
|
|
160
|
+
return c.size;
|
|
161
161
|
}
|
|
162
|
-
function
|
|
162
|
+
function _t(c) {
|
|
163
163
|
const {
|
|
164
164
|
mainText: t,
|
|
165
165
|
graphTitle: o,
|
|
166
|
-
colors:
|
|
167
|
-
suffix:
|
|
166
|
+
colors: l = X.light.categoricalColors.colors,
|
|
167
|
+
suffix: n = "",
|
|
168
168
|
sources: p,
|
|
169
169
|
prefix: r = "",
|
|
170
170
|
strokeWidth: e = 50,
|
|
171
|
-
graphDescription:
|
|
171
|
+
graphDescription: s,
|
|
172
172
|
subNote: x,
|
|
173
173
|
footNote: f,
|
|
174
174
|
radius: O,
|
|
@@ -176,85 +176,85 @@ function Zt(s) {
|
|
|
176
176
|
showColorScale: g = !0,
|
|
177
177
|
padding: b,
|
|
178
178
|
backgroundColor: y = !1,
|
|
179
|
-
tooltip:
|
|
179
|
+
tooltip: S,
|
|
180
180
|
onSeriesMouseOver: d,
|
|
181
|
-
graphID:
|
|
181
|
+
graphID: E,
|
|
182
182
|
onSeriesMouseClick: G,
|
|
183
183
|
graphDownload: h = !1,
|
|
184
184
|
dataDownload: C = !1,
|
|
185
|
-
colorDomain:
|
|
185
|
+
colorDomain: z,
|
|
186
186
|
sortData: v,
|
|
187
187
|
language: Y = "en",
|
|
188
188
|
theme: j = "light",
|
|
189
189
|
width: M,
|
|
190
|
-
height:
|
|
191
|
-
minHeight:
|
|
192
|
-
relativeHeight:
|
|
193
|
-
ariaLabel:
|
|
190
|
+
height: V,
|
|
191
|
+
minHeight: q = 0,
|
|
192
|
+
relativeHeight: $,
|
|
193
|
+
ariaLabel: R,
|
|
194
194
|
resetSelectionOnDoubleClick: J = !0,
|
|
195
195
|
colorScaleMaxWidth: K,
|
|
196
196
|
detailsOnClick: Q,
|
|
197
197
|
styles: D,
|
|
198
|
-
classNames:
|
|
198
|
+
classNames: I,
|
|
199
199
|
precision: et = 2,
|
|
200
|
-
animate:
|
|
200
|
+
animate: B = !1,
|
|
201
201
|
trackColor: U = X.light.grays["gray-200"]
|
|
202
|
-
} =
|
|
203
|
-
|
|
202
|
+
} = c, [P, Z] = tt(0), k = rt(null), F = rt(null);
|
|
203
|
+
ft(() => {
|
|
204
204
|
const i = new ResizeObserver((N) => {
|
|
205
205
|
Z((Math.min(N[0].target.clientWidth || 620, N[0].target.clientHeight || 480) || 420) / 2);
|
|
206
206
|
});
|
|
207
207
|
return k.current && i.observe(k.current), () => i.disconnect();
|
|
208
208
|
}, []);
|
|
209
|
-
const
|
|
210
|
-
return /* @__PURE__ */
|
|
211
|
-
o ||
|
|
209
|
+
const w = v ? ht(m, ["size"], [v]) : m;
|
|
210
|
+
return /* @__PURE__ */ a.jsxs(wt, { className: I?.graphContainer, style: D?.graphContainer, id: E, ref: F, "aria-label": R, backgroundColor: y, theme: j, language: Y, minHeight: q, width: M, height: V, relativeHeight: $, padding: b, children: [
|
|
211
|
+
o || s || h || C ? /* @__PURE__ */ a.jsx(Dt, { styles: {
|
|
212
212
|
title: D?.title,
|
|
213
213
|
description: D?.description
|
|
214
214
|
}, classNames: {
|
|
215
|
-
title:
|
|
216
|
-
description:
|
|
217
|
-
}, graphTitle: o, graphDescription:
|
|
218
|
-
g && m.length > 0 ? /* @__PURE__ */
|
|
219
|
-
/* @__PURE__ */
|
|
215
|
+
title: I?.title,
|
|
216
|
+
description: I?.description
|
|
217
|
+
}, graphTitle: o, graphDescription: s, width: M, graphDownload: h ? F : void 0, dataDownload: C ? m.map((i) => i.data).filter((i) => i !== void 0).length > 0 ? m.map((i) => i.data).filter((i) => i !== void 0) : m.filter((i) => i !== void 0) : null }) : null,
|
|
218
|
+
g && m.length > 0 ? /* @__PURE__ */ a.jsxs(a.Fragment, { children: [
|
|
219
|
+
/* @__PURE__ */ a.jsx("div", { className: pt("leading-0 flex mb-0 ml-auto mr-auto justify-center gap-x-3 gap-y-0 flex-wrap", I?.colorLegend), style: {
|
|
220
220
|
maxWidth: K
|
|
221
|
-
}, "aria-label": "Color legend", children:
|
|
222
|
-
/* @__PURE__ */
|
|
223
|
-
backgroundColor: (
|
|
221
|
+
}, "aria-label": "Color legend", children: w.map((i, N) => /* @__PURE__ */ a.jsxs("div", { className: "flex gap-2 items-center pb-3", children: [
|
|
222
|
+
/* @__PURE__ */ a.jsx("div", { className: "w-3 h-3 rounded-full", style: {
|
|
223
|
+
backgroundColor: (z || w.map((A) => A.label)).indexOf(i.label) !== -1 ? (l || X[j].categoricalColors.colors)[(z || w.map((A) => A.label)).indexOf(i.label) % (l || X[j].categoricalColors.colors).length] : X.gray
|
|
224
224
|
} }),
|
|
225
|
-
/* @__PURE__ */
|
|
225
|
+
/* @__PURE__ */ a.jsxs(it, { marginBottom: "none", size: "sm", className: "text-primary-gray-700 dark:text-primary-gray-100", children: [
|
|
226
226
|
i.label,
|
|
227
227
|
":",
|
|
228
228
|
" ",
|
|
229
|
-
/* @__PURE__ */
|
|
229
|
+
/* @__PURE__ */ a.jsx("span", { className: "font-bold", style: {
|
|
230
230
|
fontSize: "inherit"
|
|
231
|
-
}, children:
|
|
231
|
+
}, children: ut(i.size, "NA", et, r, n) })
|
|
232
232
|
] })
|
|
233
233
|
] }, N)) }),
|
|
234
|
-
/* @__PURE__ */
|
|
234
|
+
/* @__PURE__ */ a.jsx(xt, { size: "lg" })
|
|
235
235
|
] }) : null,
|
|
236
|
-
/* @__PURE__ */
|
|
237
|
-
m.length === 0 && /* @__PURE__ */
|
|
238
|
-
|
|
236
|
+
/* @__PURE__ */ a.jsxs(At, { ref: k, children: [
|
|
237
|
+
m.length === 0 && /* @__PURE__ */ a.jsx(kt, {}),
|
|
238
|
+
P && m.length > 0 ? /* @__PURE__ */ a.jsx(Et, { mainText: t, data: w, colors: l, radius: O || P, subNote: x, strokeWidth: e, tooltip: S, colorDomain: z || w.map((i) => i.label), onSeriesMouseOver: d, onSeriesMouseClick: G, resetSelectionOnDoubleClick: J, styles: D, detailsOnClick: Q, precision: et, animate: B === !0 ? {
|
|
239
239
|
duration: 0.5,
|
|
240
240
|
once: !0,
|
|
241
241
|
amount: 0.5
|
|
242
|
-
} :
|
|
242
|
+
} : B || {
|
|
243
243
|
duration: 0,
|
|
244
244
|
once: !0,
|
|
245
245
|
amount: 0
|
|
246
246
|
}, trackColor: U }) : null
|
|
247
247
|
] }),
|
|
248
|
-
p || f ? /* @__PURE__ */
|
|
248
|
+
p || f ? /* @__PURE__ */ a.jsx(Ct, { styles: {
|
|
249
249
|
footnote: D?.footnote,
|
|
250
250
|
source: D?.source
|
|
251
251
|
}, classNames: {
|
|
252
|
-
footnote:
|
|
253
|
-
source:
|
|
252
|
+
footnote: I?.footnote,
|
|
253
|
+
source: I?.source
|
|
254
254
|
}, sources: p, footNote: f, width: M }) : null
|
|
255
255
|
] });
|
|
256
256
|
}
|
|
257
257
|
export {
|
|
258
|
-
|
|
258
|
+
_t as DonutChart
|
|
259
259
|
};
|
|
260
260
|
//# sourceMappingURL=DonutChart.js.map
|
package/dist/DonutChart.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DonutChart.js","sources":["../node_modules/d3-shape/src/math.js","../node_modules/d3-shape/src/descending.js","../node_modules/d3-shape/src/identity.js","../node_modules/d3-shape/src/pie.js","../src/Utils/getArc.ts","../src/Components/Graphs/DonutChart/Graph.tsx","../src/Components/Graphs/DonutChart/index.tsx"],"sourcesContent":["export const abs = Math.abs;\nexport const atan2 = Math.atan2;\nexport const cos = Math.cos;\nexport const max = Math.max;\nexport const min = Math.min;\nexport const sin = Math.sin;\nexport const sqrt = Math.sqrt;\n\nexport const epsilon = 1e-12;\nexport const pi = Math.PI;\nexport const halfPi = pi / 2;\nexport const tau = 2 * pi;\n\nexport function acos(x) {\n return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);\n}\n\nexport function asin(x) {\n return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x);\n}\n","export default function(a, b) {\n return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;\n}\n","export default function(d) {\n return d;\n}\n","import array from \"./array.js\";\nimport constant from \"./constant.js\";\nimport descending from \"./descending.js\";\nimport identity from \"./identity.js\";\nimport {tau} from \"./math.js\";\n\nexport default function() {\n var value = identity,\n sortValues = descending,\n sort = null,\n startAngle = constant(0),\n endAngle = constant(tau),\n padAngle = constant(0);\n\n function pie(data) {\n var i,\n n = (data = array(data)).length,\n j,\n k,\n sum = 0,\n index = new Array(n),\n arcs = new Array(n),\n a0 = +startAngle.apply(this, arguments),\n da = Math.min(tau, Math.max(-tau, endAngle.apply(this, arguments) - a0)),\n a1,\n p = Math.min(Math.abs(da) / n, padAngle.apply(this, arguments)),\n pa = p * (da < 0 ? -1 : 1),\n v;\n\n for (i = 0; i < n; ++i) {\n if ((v = arcs[index[i] = i] = +value(data[i], i, data)) > 0) {\n sum += v;\n }\n }\n\n // Optionally sort the arcs by previously-computed values or by data.\n if (sortValues != null) index.sort(function(i, j) { return sortValues(arcs[i], arcs[j]); });\n else if (sort != null) index.sort(function(i, j) { return sort(data[i], data[j]); });\n\n // Compute the arcs! They are stored in the original data's order.\n for (i = 0, k = sum ? (da - n * pa) / sum : 0; i < n; ++i, a0 = a1) {\n j = index[i], v = arcs[j], a1 = a0 + (v > 0 ? v * k : 0) + pa, arcs[j] = {\n data: data[j],\n index: i,\n value: v,\n startAngle: a0,\n endAngle: a1,\n padAngle: p\n };\n }\n\n return arcs;\n }\n\n pie.value = function(_) {\n return arguments.length ? (value = typeof _ === \"function\" ? _ : constant(+_), pie) : value;\n };\n\n pie.sortValues = function(_) {\n return arguments.length ? (sortValues = _, sort = null, pie) : sortValues;\n };\n\n pie.sort = function(_) {\n return arguments.length ? (sort = _, sortValues = null, pie) : sort;\n };\n\n pie.startAngle = function(_) {\n return arguments.length ? (startAngle = typeof _ === \"function\" ? _ : constant(+_), pie) : startAngle;\n };\n\n pie.endAngle = function(_) {\n return arguments.length ? (endAngle = typeof _ === \"function\" ? _ : constant(+_), pie) : endAngle;\n };\n\n pie.padAngle = function(_) {\n return arguments.length ? (padAngle = typeof _ === \"function\" ? _ : constant(+_), pie) : padAngle;\n };\n\n return pie;\n}\n","const polarToCartesian = (\r\n centerX: number,\r\n centerY: number,\r\n radius: number,\r\n angleInRadians: number,\r\n) => {\r\n return {\r\n x: centerX + radius * Math.cos(angleInRadians),\r\n y: centerY + radius * Math.sin(angleInRadians),\r\n };\r\n};\r\n\r\nexport function getArc(\r\n x: number,\r\n y: number,\r\n radius: number,\r\n startAngleInRadians: number,\r\n endAngleInRadians: number,\r\n) {\r\n const start = polarToCartesian(x, y, radius, startAngleInRadians);\r\n const end = polarToCartesian(\r\n x,\r\n y,\r\n radius,\r\n endAngleInRadians === 2 * Math.PI ? 1.9999999999 * Math.PI : endAngleInRadians,\r\n );\r\n const largeArcFlag = endAngleInRadians - startAngleInRadians <= Math.PI ? '0' : '1';\r\n const d = ['M', start.x, start.y, 'A', radius, radius, 0, largeArcFlag, 1, end.x, end.y].join(\r\n ' ',\r\n );\r\n return d;\r\n}\r\n","/* eslint-disable @typescript-eslint/no-explicit-any */\r\nimport isEqual from 'fast-deep-equal';\r\nimport { pie } from 'd3-shape';\r\nimport { useRef, useState } from 'react';\r\nimport { H2, P } from '@undp/design-system-react/Typography';\r\nimport { AnimatePresence, motion, useInView } from 'motion/react';\r\n\r\nimport { AnimateDataType, ClassNameObject, DonutChartDataType, StyleObject } from '@/Types';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { DetailsModal } from '@/Components/Elements/DetailsModal';\r\nimport { getArc } from '@/Utils/getArc';\r\n\r\ninterface Props {\r\n mainText?: string | { label: string; suffix?: string; prefix?: string };\r\n radius: number;\r\n colors: string[];\r\n subNote?: string;\r\n strokeWidth: number;\r\n data: DonutChartDataType[];\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n onSeriesMouseOver?: (_d: any) => void;\r\n onSeriesMouseClick?: (_d: any) => void;\r\n colorDomain: string[];\r\n resetSelectionOnDoubleClick: boolean;\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n precision: number;\r\n animate: AnimateDataType;\r\n trackColor: string;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n mainText,\r\n data,\r\n radius,\r\n colors,\r\n subNote,\r\n strokeWidth,\r\n tooltip,\r\n onSeriesMouseOver,\r\n onSeriesMouseClick,\r\n colorDomain,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n precision,\r\n animate,\r\n trackColor,\r\n } = props;\r\n const svgRef = useRef(null);\r\n const isInView = useInView(svgRef, {\r\n once: animate.once,\r\n amount: animate.amount,\r\n });\r\n const pieData = pie()\r\n .sort(null)\r\n .startAngle(0)\r\n .value((d: any) => d.size);\r\n\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n\r\n const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n return (\r\n <>\r\n <motion.svg\r\n ref={svgRef}\r\n width={`${radius * 2}px`}\r\n height={`${radius * 2}px`}\r\n viewBox={`0 0 ${radius * 2} ${radius * 2}`}\r\n direction='ltr'\r\n className='mx-auto'\r\n >\r\n <motion.g transform={`translate(${radius} ${radius})`}>\r\n {mainText || subNote ? (\r\n <foreignObject\r\n y={0 - (radius - strokeWidth)}\r\n x={0 - (radius - strokeWidth)}\r\n width={2 * (radius - strokeWidth)}\r\n height={2 * (radius - strokeWidth)}\r\n >\r\n <div className='flex flex-col gap-0.5 justify-center items-center h-inherit py-0 px-4'>\r\n {mainText ? (\r\n <H2\r\n marginBottom='none'\r\n className='donut-main-text text-primary-gray-700 dark:text-primary-gray-100 leading-none text-center'\r\n >\r\n {typeof mainText === 'string'\r\n ? mainText\r\n : data.findIndex(d => d.label === mainText.label) !== -1\r\n ? numberFormattingFunction(\r\n data[data.findIndex(d => d.label === mainText.label)].size,\r\n 'NA',\r\n precision,\r\n mainText.prefix,\r\n mainText.suffix,\r\n )\r\n : 'NA'}\r\n </H2>\r\n ) : null}\r\n {subNote ? (\r\n <P\r\n marginBottom='none'\r\n size='base'\r\n leading='none'\r\n className='donut-sub-note text-primary-gray-700 dark:text-primary-gray-100 text-center font-bold'\r\n >\r\n {subNote}\r\n </P>\r\n ) : typeof mainText === 'string' || !mainText ? null : (\r\n <P\r\n size='base'\r\n marginBottom='none'\r\n leading='none'\r\n className='donut-label text-primary-gray-700 dark:text-primary-gray-100 text-center font-bold'\r\n >\r\n {mainText.label}\r\n </P>\r\n )}\r\n </div>\r\n </foreignObject>\r\n ) : null}\r\n <circle\r\n cx={0}\r\n cy={0}\r\n r={radius - strokeWidth / 2}\r\n fill='none'\r\n stroke={trackColor}\r\n strokeWidth={strokeWidth}\r\n />\r\n <AnimatePresence>\r\n {pieData(data as any).map((d, i) => (\r\n <motion.path\r\n key={i}\r\n variants={{\r\n initial: {\r\n pathLength: 0,\r\n d: getArc(\r\n 0,\r\n 0,\r\n radius - strokeWidth / 2,\r\n d.startAngle - Math.PI / 2,\r\n d.endAngle - Math.PI / 2,\r\n ),\r\n opacity: mouseOverData\r\n ? mouseOverData.label === (d.data as any).label\r\n ? 1\r\n : 0.3\r\n : 1,\r\n },\r\n whileInView: {\r\n pathLength: 1,\r\n d: getArc(\r\n 0,\r\n 0,\r\n radius - strokeWidth / 2,\r\n d.startAngle - Math.PI / 2,\r\n d.endAngle - Math.PI / 2,\r\n ),\r\n opacity: mouseOverData\r\n ? mouseOverData.label === (d.data as any).label\r\n ? 1\r\n : 0.3\r\n : 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n style={{\r\n stroke:\r\n colorDomain.indexOf((d.data as any).label) !== -1\r\n ? colors[colorDomain.indexOf((d.data as any).label) % colors.length]\r\n : Colors.gray,\r\n strokeWidth,\r\n fill: 'none',\r\n }}\r\n onMouseEnter={event => {\r\n setMouseOverData(d.data);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.(d);\r\n }}\r\n onClick={() => {\r\n if (onSeriesMouseClick || detailsOnClick) {\r\n if (isEqual(mouseClickData, d.data) && resetSelectionOnDoubleClick) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n setMouseClickData(d.data);\r\n if (onSeriesMouseClick) onSeriesMouseClick(d.data);\r\n }\r\n }\r\n }}\r\n onMouseMove={event => {\r\n setMouseOverData(d.data);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n }}\r\n onMouseLeave={() => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n }}\r\n />\r\n ))}\r\n </AnimatePresence>\r\n </motion.g>\r\n </motion.svg>\r\n {mouseOverData && tooltip && eventX && eventY ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={eventX}\r\n yPos={eventY}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n {detailsOnClick && mouseClickData !== undefined ? (\r\n <DetailsModal\r\n body={detailsOnClick}\r\n data={mouseClickData}\r\n setData={setMouseClickData}\r\n className={classNames?.modal}\r\n />\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import { useEffect, useRef, useState } from 'react';\r\nimport { P } from '@undp/design-system-react/Typography';\r\nimport orderBy from 'lodash.orderby';\r\nimport { Spacer } from '@undp/design-system-react/Spacer';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport {\r\n DonutChartDataType,\r\n Languages,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n AnimateDataType,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { EmptyState } from '@/Components/Elements/EmptyState';\r\nimport { GraphArea, GraphContainer } from '@/Components/Elements/GraphContainer';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: DonutChartDataType[];\r\n\r\n // Titles, Labels, and Sources\r\n /** Title of the graph */\r\n graphTitle?: string | React.ReactNode;\r\n /** Description of the graph */\r\n graphDescription?: string | React.ReactNode;\r\n /** Footnote for the graph */\r\n footNote?: string | React.ReactNode;\r\n /** Source data for the graph */\r\n sources?: SourcesDataType[];\r\n /** Accessibility label */\r\n ariaLabel?: string;\r\n\r\n // Colors and Styling\r\n /** Array of colors for each segment */\r\n colors?: string[];\r\n /** Domain of colors for the graph */\r\n colorDomain?: string[];\r\n /** Background color of the graph */\r\n backgroundColor?: string | boolean;\r\n /** Custom styles for the graph. Each object should be a valid React CSS style object. */\r\n styles?: StyleObject;\r\n /** Custom class names */\r\n classNames?: ClassNameObject;\r\n\r\n // Size and Spacing\r\n /** Width of the graph */\r\n width?: number;\r\n /** Height of the graph */\r\n height?: number;\r\n /** Minimum height of the graph */\r\n minHeight?: number;\r\n /** Relative height scaling factor. This overwrites the height props */\r\n relativeHeight?: number;\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n /** Radius of the donut chart */\r\n radius?: number;\r\n\r\n // Values and Ticks\r\n /** Prefix for values */\r\n prefix?: string;\r\n /** Suffix for values */\r\n suffix?: string;\r\n\r\n // Graph Parameters\r\n /** Toggle visibility of color scale. This is only applicable if the data props hae color parameter */\r\n showColorScale?: boolean;\r\n /** Max width of the color scale as a css property */\r\n colorScaleMaxWidth?: string;\r\n /** Stroke width of the arcs and circle of the donut */\r\n strokeWidth?: number;\r\n /** Sorting order for data. This is overwritten by labelOrder prop */\r\n sortData?: 'asc' | 'desc';\r\n /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\r\n /** Large text at the center of the donut chart. If the type is an object then the text is the value in the data for the label mentioned in the object */\r\n mainText?: string | { label: string; suffix?: string; prefix?: string };\r\n /** Small text at the center of the donut chart */\r\n subNote?: string;\r\n /** Specifies the number of decimal places to display in the value. */\r\n precision?: number;\r\n /** Track color (i.e. the color of the donut chart's background) of the donut chart */\r\n trackColor?: string;\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n /** Reset selection on double-click. Only applicable when used in a dashboard context with filters. */\r\n resetSelectionOnDoubleClick?: boolean;\r\n\r\n // Interactions and Callbacks\r\n /** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n /** Details displayed on the modal when user clicks of a data point. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n /** Callback for mouse over event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n /** Callback for mouse click event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n\r\n // Configuration and Options\r\n /** Language setting */\r\n language?: Languages;\r\n /** Color theme */\r\n theme?: 'light' | 'dark';\r\n /** Unique ID for the graph */\r\n graphID?: string;\r\n}\r\n\r\nexport function DonutChart(props: Props) {\r\n const {\r\n mainText,\r\n graphTitle,\r\n colors = Colors.light.categoricalColors.colors,\r\n suffix = '',\r\n sources,\r\n prefix = '',\r\n strokeWidth = 50,\r\n graphDescription,\r\n subNote,\r\n footNote,\r\n radius,\r\n data,\r\n showColorScale = true,\r\n padding,\r\n backgroundColor = false,\r\n tooltip,\r\n onSeriesMouseOver,\r\n graphID,\r\n onSeriesMouseClick,\r\n graphDownload = false,\r\n dataDownload = false,\r\n colorDomain,\r\n sortData,\r\n language = 'en',\r\n theme = 'light',\r\n width,\r\n height,\r\n minHeight = 0,\r\n relativeHeight,\r\n ariaLabel,\r\n resetSelectionOnDoubleClick = true,\r\n colorScaleMaxWidth,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n precision = 2,\r\n animate = false,\r\n trackColor = Colors.light.grays['gray-200'],\r\n } = props;\r\n\r\n const [graphRadius, setGraphRadius] = useState(0);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setGraphRadius(\r\n (Math.min(\r\n ...[entries[0].target.clientWidth || 620, entries[0].target.clientHeight || 480],\r\n ) || 420) / 2,\r\n );\r\n });\r\n if (graphDiv.current) {\r\n resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, []);\r\n\r\n const sortedData = sortData ? orderBy(data, ['size'], [sortData]) : data;\r\n\r\n return (\r\n <GraphContainer\r\n className={classNames?.graphContainer}\r\n style={styles?.graphContainer}\r\n id={graphID}\r\n ref={graphParentDiv}\r\n aria-label={ariaLabel}\r\n backgroundColor={backgroundColor}\r\n theme={theme}\r\n language={language}\r\n minHeight={minHeight}\r\n width={width}\r\n height={height}\r\n relativeHeight={relativeHeight}\r\n padding={padding}\r\n >\r\n {graphTitle || graphDescription || graphDownload || dataDownload ? (\r\n <GraphHeader\r\n styles={{\r\n title: styles?.title,\r\n description: styles?.description,\r\n }}\r\n classNames={{\r\n title: classNames?.title,\r\n description: classNames?.description,\r\n }}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n width={width}\r\n graphDownload={graphDownload ? graphParentDiv : undefined}\r\n dataDownload={\r\n dataDownload\r\n ? data.map(d => d.data).filter(d => d !== undefined).length > 0\r\n ? data.map(d => d.data).filter(d => d !== undefined)\r\n : data.filter(d => d !== undefined)\r\n : null\r\n }\r\n />\r\n ) : null}\r\n {showColorScale && data.length > 0 ? (\r\n <>\r\n <div\r\n className={cn(\r\n 'leading-0 flex mb-0 ml-auto mr-auto justify-center gap-x-3 gap-y-0 flex-wrap',\r\n classNames?.colorLegend,\r\n )}\r\n style={{ maxWidth: colorScaleMaxWidth }}\r\n aria-label='Color legend'\r\n >\r\n {sortedData.map((d, i) => (\r\n <div className='flex gap-2 items-center pb-3' key={i}>\r\n <div\r\n className='w-3 h-3 rounded-full'\r\n style={{\r\n backgroundColor:\r\n (colorDomain || sortedData.map(el => el.label)).indexOf(d.label) !== -1\r\n ? (colors || Colors[theme].categoricalColors.colors)[\r\n (colorDomain || sortedData.map(el => el.label)).indexOf(d.label) %\r\n (colors || Colors[theme].categoricalColors.colors).length\r\n ]\r\n : Colors.gray,\r\n }}\r\n />\r\n <P\r\n marginBottom='none'\r\n size='sm'\r\n className='text-primary-gray-700 dark:text-primary-gray-100'\r\n >\r\n {d.label}:{' '}\r\n <span className='font-bold' style={{ fontSize: 'inherit' }}>\r\n {numberFormattingFunction(d.size, 'NA', precision, prefix, suffix)}\r\n </span>\r\n </P>\r\n </div>\r\n ))}\r\n </div>\r\n <Spacer size='lg' />\r\n </>\r\n ) : null}\r\n <GraphArea ref={graphDiv}>\r\n {data.length === 0 && <EmptyState />}\r\n {graphRadius && data.length > 0 ? (\r\n <Graph\r\n mainText={mainText}\r\n data={sortedData}\r\n colors={colors}\r\n radius={radius || graphRadius}\r\n subNote={subNote}\r\n strokeWidth={strokeWidth}\r\n tooltip={tooltip}\r\n colorDomain={colorDomain || sortedData.map(d => d.label)}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n styles={styles}\r\n detailsOnClick={detailsOnClick}\r\n precision={precision}\r\n animate={\r\n animate === true\r\n ? { duration: 0.5, once: true, amount: 0.5 }\r\n : animate || { duration: 0, once: true, amount: 0 }\r\n }\r\n trackColor={trackColor}\r\n />\r\n ) : null}\r\n </GraphArea>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </GraphContainer>\r\n );\r\n}\r\n"],"names":["pi","tau","descending","a","b","identity","d","pie","value","sortValues","sort","startAngle","constant","endAngle","padAngle","data","i","n","array","j","k","sum","index","arcs","a0","da","a1","p","pa","v","_","polarToCartesian","centerX","centerY","radius","angleInRadians","x","Math","cos","y","sin","getArc","startAngleInRadians","endAngleInRadians","start","end","PI","largeArcFlag","join","Graph","props","$","_c","mainText","colors","subNote","strokeWidth","tooltip","onSeriesMouseOver","onSeriesMouseClick","colorDomain","resetSelectionOnDoubleClick","detailsOnClick","styles","classNames","precision","animate","trackColor","svgRef","useRef","t0","amount","once","isInView","useInView","pieData","_temp","mouseOverData","setMouseOverData","useState","undefined","mouseClickData","setMouseClickData","eventX","setEventX","eventY","setEventY","t1","motion","t2","t3","t4","t5","t6","t7","t8","t9","jsx","jsxs","H2","findIndex","d_1","label","numberFormattingFunction","d_0","size","prefix","suffix","P","t10","t11","T0","AnimatePresence","t12","duration","d_2","initial","pathLength","opacity","whileInView","transition","stroke","indexOf","length","Colors","gray","fill","event","clientY","clientX","isEqual","event_0","t13","map","t14","t15","g","t16","svg","t17","Tooltip","t18","modal","DetailsModal","t19","Fragment","DonutChart","graphTitle","light","categoricalColors","sources","graphDescription","footNote","showColorScale","padding","backgroundColor","graphID","graphDownload","dataDownload","sortData","language","theme","width","height","minHeight","relativeHeight","ariaLabel","colorScaleMaxWidth","grays","graphRadius","setGraphRadius","graphDiv","graphParentDiv","useEffect","resizeObserver","ResizeObserver","entries","min","target","clientWidth","clientHeight","current","observe","disconnect","sortedData","orderBy","GraphContainer","graphContainer","GraphHeader","title","description","filter","cn","colorLegend","maxWidth","el","fontSize","Spacer","GraphArea","EmptyState","GraphFooter","footnote","source"],"mappings":";;;;;;;;;;;;;;;;;;AASO,MAAMA,KAAK,KAAK,IAEVC,KAAM,IAAID;ACXR,SAAAE,GAASC,GAAGC,GAAG;AAC5B,SAAOA,IAAID,IAAI,KAAKC,IAAID,IAAI,IAAIC,KAAKD,IAAI,IAAI;AAC/C;ACFe,SAAAE,GAASC,GAAG;AACzB,SAAOA;AACT;ACIe,SAAAC,KAAW;AACxB,MAAIC,IAAQH,IACRI,IAAaP,IACbQ,IAAO,MACPC,IAAaC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,IAAAA,GAEtB,SAAApD,GACA,UAAAE,GACA,OAAAU,EAAA,CAAa,IAEb;AAAA,EAAA,GACN;AAEJ;","x_google_ignoreList":[0,1,2,3]}
|
|
1
|
+
{"version":3,"file":"DonutChart.js","sources":["../node_modules/d3-shape/src/math.js","../node_modules/d3-shape/src/descending.js","../node_modules/d3-shape/src/identity.js","../node_modules/d3-shape/src/pie.js","../src/Utils/getArc.ts","../src/Components/Graphs/DonutChart/Graph.tsx","../src/Components/Graphs/DonutChart/index.tsx"],"sourcesContent":["export const abs = Math.abs;\nexport const atan2 = Math.atan2;\nexport const cos = Math.cos;\nexport const max = Math.max;\nexport const min = Math.min;\nexport const sin = Math.sin;\nexport const sqrt = Math.sqrt;\n\nexport const epsilon = 1e-12;\nexport const pi = Math.PI;\nexport const halfPi = pi / 2;\nexport const tau = 2 * pi;\n\nexport function acos(x) {\n return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);\n}\n\nexport function asin(x) {\n return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x);\n}\n","export default function(a, b) {\n return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;\n}\n","export default function(d) {\n return d;\n}\n","import array from \"./array.js\";\nimport constant from \"./constant.js\";\nimport descending from \"./descending.js\";\nimport identity from \"./identity.js\";\nimport {tau} from \"./math.js\";\n\nexport default function() {\n var value = identity,\n sortValues = descending,\n sort = null,\n startAngle = constant(0),\n endAngle = constant(tau),\n padAngle = constant(0);\n\n function pie(data) {\n var i,\n n = (data = array(data)).length,\n j,\n k,\n sum = 0,\n index = new Array(n),\n arcs = new Array(n),\n a0 = +startAngle.apply(this, arguments),\n da = Math.min(tau, Math.max(-tau, endAngle.apply(this, arguments) - a0)),\n a1,\n p = Math.min(Math.abs(da) / n, padAngle.apply(this, arguments)),\n pa = p * (da < 0 ? -1 : 1),\n v;\n\n for (i = 0; i < n; ++i) {\n if ((v = arcs[index[i] = i] = +value(data[i], i, data)) > 0) {\n sum += v;\n }\n }\n\n // Optionally sort the arcs by previously-computed values or by data.\n if (sortValues != null) index.sort(function(i, j) { return sortValues(arcs[i], arcs[j]); });\n else if (sort != null) index.sort(function(i, j) { return sort(data[i], data[j]); });\n\n // Compute the arcs! They are stored in the original data's order.\n for (i = 0, k = sum ? (da - n * pa) / sum : 0; i < n; ++i, a0 = a1) {\n j = index[i], v = arcs[j], a1 = a0 + (v > 0 ? v * k : 0) + pa, arcs[j] = {\n data: data[j],\n index: i,\n value: v,\n startAngle: a0,\n endAngle: a1,\n padAngle: p\n };\n }\n\n return arcs;\n }\n\n pie.value = function(_) {\n return arguments.length ? (value = typeof _ === \"function\" ? _ : constant(+_), pie) : value;\n };\n\n pie.sortValues = function(_) {\n return arguments.length ? (sortValues = _, sort = null, pie) : sortValues;\n };\n\n pie.sort = function(_) {\n return arguments.length ? (sort = _, sortValues = null, pie) : sort;\n };\n\n pie.startAngle = function(_) {\n return arguments.length ? (startAngle = typeof _ === \"function\" ? _ : constant(+_), pie) : startAngle;\n };\n\n pie.endAngle = function(_) {\n return arguments.length ? (endAngle = typeof _ === \"function\" ? _ : constant(+_), pie) : endAngle;\n };\n\n pie.padAngle = function(_) {\n return arguments.length ? (padAngle = typeof _ === \"function\" ? _ : constant(+_), pie) : padAngle;\n };\n\n return pie;\n}\n","const polarToCartesian = (\r\n centerX: number,\r\n centerY: number,\r\n radius: number,\r\n angleInRadians: number,\r\n) => {\r\n return {\r\n x: centerX + radius * Math.cos(angleInRadians),\r\n y: centerY + radius * Math.sin(angleInRadians),\r\n };\r\n};\r\n\r\nexport function getArc(\r\n x: number,\r\n y: number,\r\n radius: number,\r\n startAngleInRadians: number,\r\n endAngleInRadians: number,\r\n) {\r\n const start = polarToCartesian(x, y, radius, startAngleInRadians);\r\n const end = polarToCartesian(\r\n x,\r\n y,\r\n radius,\r\n Math.abs(endAngleInRadians - startAngleInRadians) === 2 * Math.PI\r\n ? 0.999999 * endAngleInRadians\r\n : endAngleInRadians,\r\n );\r\n const largeArcFlag = endAngleInRadians - startAngleInRadians <= Math.PI ? '0' : '1';\r\n const d = ['M', start.x, start.y, 'A', radius, radius, 0, largeArcFlag, 1, end.x, end.y].join(\r\n ' ',\r\n );\r\n return d;\r\n}\r\n","/* eslint-disable @typescript-eslint/no-explicit-any */\r\nimport isEqual from 'fast-deep-equal';\r\nimport { pie } from 'd3-shape';\r\nimport { isValidElement, ReactElement, useRef, useState } from 'react';\r\nimport { H2, P } from '@undp/design-system-react/Typography';\r\nimport { AnimatePresence, motion, useInView } from 'motion/react';\r\n\r\nimport { AnimateDataType, ClassNameObject, DonutChartDataType, StyleObject } from '@/Types';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { DetailsModal } from '@/Components/Elements/DetailsModal';\r\nimport { getArc } from '@/Utils/getArc';\r\n\r\ninterface Props {\r\n mainText?: string | { label: string; suffix?: string; prefix?: string } | ReactElement;\r\n radius: number;\r\n colors: string[];\r\n subNote?: string;\r\n strokeWidth: number;\r\n data: DonutChartDataType[];\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n onSeriesMouseOver?: (_d: any) => void;\r\n onSeriesMouseClick?: (_d: any) => void;\r\n colorDomain: string[];\r\n resetSelectionOnDoubleClick: boolean;\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n precision: number;\r\n animate: AnimateDataType;\r\n trackColor: string;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n mainText,\r\n data,\r\n radius,\r\n colors,\r\n subNote,\r\n strokeWidth,\r\n tooltip,\r\n onSeriesMouseOver,\r\n onSeriesMouseClick,\r\n colorDomain,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n precision,\r\n animate,\r\n trackColor,\r\n } = props;\r\n const svgRef = useRef(null);\r\n const isInView = useInView(svgRef, {\r\n once: animate.once,\r\n amount: animate.amount,\r\n });\r\n const pieData = pie()\r\n .sort(null)\r\n .startAngle(0)\r\n .value((d: any) => d.size);\r\n\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n\r\n const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n return (\r\n <>\r\n <motion.svg\r\n ref={svgRef}\r\n width={`${radius * 2}px`}\r\n height={`${radius * 2}px`}\r\n viewBox={`0 0 ${radius * 2} ${radius * 2}`}\r\n direction='ltr'\r\n className='mx-auto'\r\n >\r\n <motion.g transform={`translate(${radius} ${radius})`}>\r\n {mainText || subNote ? (\r\n <foreignObject\r\n y={0 - (radius - strokeWidth)}\r\n x={0 - (radius - strokeWidth)}\r\n width={2 * (radius - strokeWidth)}\r\n height={2 * (radius - strokeWidth)}\r\n >\r\n <div className='flex flex-col gap-0.5 justify-center items-center h-inherit py-0 px-4'>\r\n {mainText ? (\r\n isValidElement(mainText) ? (\r\n mainText\r\n ) : (\r\n <H2\r\n marginBottom='none'\r\n className='donut-main-text text-primary-gray-700 dark:text-primary-gray-100 leading-none text-center'\r\n >\r\n {typeof mainText === 'string'\r\n ? mainText\r\n : data.findIndex(d => d.label === mainText.label) !== -1\r\n ? numberFormattingFunction(\r\n data[data.findIndex(d => d.label === mainText.label)].size,\r\n 'NA',\r\n precision,\r\n mainText.prefix,\r\n mainText.suffix,\r\n )\r\n : 'NA'}\r\n </H2>\r\n )\r\n ) : null}\r\n {subNote ? (\r\n <P\r\n marginBottom='none'\r\n size='base'\r\n leading='none'\r\n className='donut-sub-note text-primary-gray-700 dark:text-primary-gray-100 text-center font-bold'\r\n >\r\n {subNote}\r\n </P>\r\n ) : typeof mainText === 'string' || !mainText || isValidElement(mainText) ? null : (\r\n <P\r\n size='base'\r\n marginBottom='none'\r\n leading='none'\r\n className='donut-label text-primary-gray-700 dark:text-primary-gray-100 text-center font-bold'\r\n >\r\n {mainText.label}\r\n </P>\r\n )}\r\n </div>\r\n </foreignObject>\r\n ) : null}\r\n <circle\r\n cx={0}\r\n cy={0}\r\n r={radius - strokeWidth / 2}\r\n fill='none'\r\n stroke={trackColor}\r\n strokeWidth={strokeWidth}\r\n />\r\n <AnimatePresence>\r\n {pieData(data as any).map((d, i) => (\r\n <motion.path\r\n key={i}\r\n variants={{\r\n initial: {\r\n pathLength: 0,\r\n d: getArc(\r\n 0,\r\n 0,\r\n radius - strokeWidth / 2,\r\n d.startAngle - Math.PI / 2,\r\n d.endAngle - Math.PI / 2,\r\n ),\r\n opacity: mouseOverData\r\n ? mouseOverData.label === (d.data as any).label\r\n ? 1\r\n : 0.3\r\n : 1,\r\n },\r\n whileInView: {\r\n pathLength: 1,\r\n d: getArc(\r\n 0,\r\n 0,\r\n radius - strokeWidth / 2,\r\n d.startAngle - Math.PI / 2,\r\n d.endAngle - Math.PI / 2,\r\n ),\r\n opacity: mouseOverData\r\n ? mouseOverData.label === (d.data as any).label\r\n ? 1\r\n : 0.3\r\n : 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n style={{\r\n stroke:\r\n colorDomain.indexOf((d.data as any).label) !== -1\r\n ? colors[colorDomain.indexOf((d.data as any).label) % colors.length]\r\n : Colors.gray,\r\n strokeWidth,\r\n fill: 'none',\r\n }}\r\n onMouseEnter={event => {\r\n setMouseOverData(d.data);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.(d);\r\n }}\r\n onClick={() => {\r\n if (onSeriesMouseClick || detailsOnClick) {\r\n if (isEqual(mouseClickData, d.data) && resetSelectionOnDoubleClick) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n setMouseClickData(d.data);\r\n if (onSeriesMouseClick) onSeriesMouseClick(d.data);\r\n }\r\n }\r\n }}\r\n onMouseMove={event => {\r\n setMouseOverData(d.data);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n }}\r\n onMouseLeave={() => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n }}\r\n />\r\n ))}\r\n </AnimatePresence>\r\n </motion.g>\r\n </motion.svg>\r\n {mouseOverData && tooltip && eventX && eventY ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={eventX}\r\n yPos={eventY}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n {detailsOnClick && mouseClickData !== undefined ? (\r\n <DetailsModal\r\n body={detailsOnClick}\r\n data={mouseClickData}\r\n setData={setMouseClickData}\r\n className={classNames?.modal}\r\n />\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import { ReactElement, useEffect, useRef, useState } from 'react';\r\nimport { P } from '@undp/design-system-react/Typography';\r\nimport orderBy from 'lodash.orderby';\r\nimport { Spacer } from '@undp/design-system-react/Spacer';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport {\r\n DonutChartDataType,\r\n Languages,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n AnimateDataType,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { EmptyState } from '@/Components/Elements/EmptyState';\r\nimport { GraphArea, GraphContainer } from '@/Components/Elements/GraphContainer';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: DonutChartDataType[];\r\n\r\n // Titles, Labels, and Sources\r\n /** Title of the graph */\r\n graphTitle?: string | React.ReactNode;\r\n /** Description of the graph */\r\n graphDescription?: string | React.ReactNode;\r\n /** Footnote for the graph */\r\n footNote?: string | React.ReactNode;\r\n /** Source data for the graph */\r\n sources?: SourcesDataType[];\r\n /** Accessibility label */\r\n ariaLabel?: string;\r\n\r\n // Colors and Styling\r\n /** Array of colors for each segment */\r\n colors?: string[];\r\n /** Domain of colors for the graph */\r\n colorDomain?: string[];\r\n /** Background color of the graph */\r\n backgroundColor?: string | boolean;\r\n /** Custom styles for the graph. Each object should be a valid React CSS style object. */\r\n styles?: StyleObject;\r\n /** Custom class names */\r\n classNames?: ClassNameObject;\r\n\r\n // Size and Spacing\r\n /** Width of the graph */\r\n width?: number;\r\n /** Height of the graph */\r\n height?: number;\r\n /** Minimum height of the graph */\r\n minHeight?: number;\r\n /** Relative height scaling factor. This overwrites the height props */\r\n relativeHeight?: number;\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n /** Radius of the donut chart */\r\n radius?: number;\r\n\r\n // Values and Ticks\r\n /** Prefix for values */\r\n prefix?: string;\r\n /** Suffix for values */\r\n suffix?: string;\r\n\r\n // Graph Parameters\r\n /** Toggle visibility of color scale. This is only applicable if the data props hae color parameter */\r\n showColorScale?: boolean;\r\n /** Max width of the color scale as a css property */\r\n colorScaleMaxWidth?: string;\r\n /** Stroke width of the arcs and circle of the donut */\r\n strokeWidth?: number;\r\n /** Sorting order for data. This is overwritten by labelOrder prop */\r\n sortData?: 'asc' | 'desc';\r\n /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\r\n /** Large text at the center of the donut chart. If the type is an object then the text is the value in the data for the label mentioned in the object */\r\n mainText?: string | { label: string; suffix?: string; prefix?: string } | ReactElement;\r\n /** Small text at the center of the donut chart */\r\n subNote?: string;\r\n /** Specifies the number of decimal places to display in the value. */\r\n precision?: number;\r\n /** Track color (i.e. the color of the donut chart's background) of the donut chart */\r\n trackColor?: string;\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n /** Reset selection on double-click. Only applicable when used in a dashboard context with filters. */\r\n resetSelectionOnDoubleClick?: boolean;\r\n\r\n // Interactions and Callbacks\r\n /** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n /** Details displayed on the modal when user clicks of a data point. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n /** Callback for mouse over event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n /** Callback for mouse click event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n\r\n // Configuration and Options\r\n /** Language setting */\r\n language?: Languages;\r\n /** Color theme */\r\n theme?: 'light' | 'dark';\r\n /** Unique ID for the graph */\r\n graphID?: string;\r\n}\r\n\r\nexport function DonutChart(props: Props) {\r\n const {\r\n mainText,\r\n graphTitle,\r\n colors = Colors.light.categoricalColors.colors,\r\n suffix = '',\r\n sources,\r\n prefix = '',\r\n strokeWidth = 50,\r\n graphDescription,\r\n subNote,\r\n footNote,\r\n radius,\r\n data,\r\n showColorScale = true,\r\n padding,\r\n backgroundColor = false,\r\n tooltip,\r\n onSeriesMouseOver,\r\n graphID,\r\n onSeriesMouseClick,\r\n graphDownload = false,\r\n dataDownload = false,\r\n colorDomain,\r\n sortData,\r\n language = 'en',\r\n theme = 'light',\r\n width,\r\n height,\r\n minHeight = 0,\r\n relativeHeight,\r\n ariaLabel,\r\n resetSelectionOnDoubleClick = true,\r\n colorScaleMaxWidth,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n precision = 2,\r\n animate = false,\r\n trackColor = Colors.light.grays['gray-200'],\r\n } = props;\r\n\r\n const [graphRadius, setGraphRadius] = useState(0);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setGraphRadius(\r\n (Math.min(\r\n ...[entries[0].target.clientWidth || 620, entries[0].target.clientHeight || 480],\r\n ) || 420) / 2,\r\n );\r\n });\r\n if (graphDiv.current) {\r\n resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, []);\r\n\r\n const sortedData = sortData ? orderBy(data, ['size'], [sortData]) : data;\r\n\r\n return (\r\n <GraphContainer\r\n className={classNames?.graphContainer}\r\n style={styles?.graphContainer}\r\n id={graphID}\r\n ref={graphParentDiv}\r\n aria-label={ariaLabel}\r\n backgroundColor={backgroundColor}\r\n theme={theme}\r\n language={language}\r\n minHeight={minHeight}\r\n width={width}\r\n height={height}\r\n relativeHeight={relativeHeight}\r\n padding={padding}\r\n >\r\n {graphTitle || graphDescription || graphDownload || dataDownload ? (\r\n <GraphHeader\r\n styles={{\r\n title: styles?.title,\r\n description: styles?.description,\r\n }}\r\n classNames={{\r\n title: classNames?.title,\r\n description: classNames?.description,\r\n }}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n width={width}\r\n graphDownload={graphDownload ? graphParentDiv : undefined}\r\n dataDownload={\r\n dataDownload\r\n ? data.map(d => d.data).filter(d => d !== undefined).length > 0\r\n ? data.map(d => d.data).filter(d => d !== undefined)\r\n : data.filter(d => d !== undefined)\r\n : null\r\n }\r\n />\r\n ) : null}\r\n {showColorScale && data.length > 0 ? (\r\n <>\r\n <div\r\n className={cn(\r\n 'leading-0 flex mb-0 ml-auto mr-auto justify-center gap-x-3 gap-y-0 flex-wrap',\r\n classNames?.colorLegend,\r\n )}\r\n style={{ maxWidth: colorScaleMaxWidth }}\r\n aria-label='Color legend'\r\n >\r\n {sortedData.map((d, i) => (\r\n <div className='flex gap-2 items-center pb-3' key={i}>\r\n <div\r\n className='w-3 h-3 rounded-full'\r\n style={{\r\n backgroundColor:\r\n (colorDomain || sortedData.map(el => el.label)).indexOf(d.label) !== -1\r\n ? (colors || Colors[theme].categoricalColors.colors)[\r\n (colorDomain || sortedData.map(el => el.label)).indexOf(d.label) %\r\n (colors || Colors[theme].categoricalColors.colors).length\r\n ]\r\n : Colors.gray,\r\n }}\r\n />\r\n <P\r\n marginBottom='none'\r\n size='sm'\r\n className='text-primary-gray-700 dark:text-primary-gray-100'\r\n >\r\n {d.label}:{' '}\r\n <span className='font-bold' style={{ fontSize: 'inherit' }}>\r\n {numberFormattingFunction(d.size, 'NA', precision, prefix, suffix)}\r\n </span>\r\n </P>\r\n </div>\r\n ))}\r\n </div>\r\n <Spacer size='lg' />\r\n </>\r\n ) : null}\r\n <GraphArea ref={graphDiv}>\r\n {data.length === 0 && <EmptyState />}\r\n {graphRadius && data.length > 0 ? (\r\n <Graph\r\n mainText={mainText}\r\n data={sortedData}\r\n colors={colors}\r\n radius={radius || graphRadius}\r\n subNote={subNote}\r\n strokeWidth={strokeWidth}\r\n tooltip={tooltip}\r\n colorDomain={colorDomain || sortedData.map(d => d.label)}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n styles={styles}\r\n detailsOnClick={detailsOnClick}\r\n precision={precision}\r\n animate={\r\n animate === true\r\n ? { duration: 0.5, once: true, amount: 0.5 }\r\n : animate || { duration: 0, once: true, amount: 0 }\r\n }\r\n trackColor={trackColor}\r\n />\r\n ) : null}\r\n </GraphArea>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </GraphContainer>\r\n );\r\n}\r\n"],"names":["pi","tau","descending","a","b","identity","d","pie","value","sortValues","sort","startAngle","constant","endAngle","padAngle","data","i","n","array","j","k","sum","index","arcs","a0","da","a1","p","pa","v","_","polarToCartesian","centerX","centerY","radius","angleInRadians","x","Math","cos","y","sin","getArc","startAngleInRadians","endAngleInRadians","start","end","abs","PI","largeArcFlag","join","Graph","props","$","_c","mainText","colors","subNote","strokeWidth","tooltip","onSeriesMouseOver","onSeriesMouseClick","colorDomain","resetSelectionOnDoubleClick","detailsOnClick","styles","classNames","precision","animate","trackColor","svgRef","useRef","t0","amount","once","isInView","useInView","pieData","_temp","mouseOverData","setMouseOverData","useState","undefined","mouseClickData","setMouseClickData","eventX","setEventX","eventY","setEventY","t1","motion","t2","t3","t4","t5","t6","t7","t8","t9","jsx","jsxs","isValidElement","H2","findIndex","d_1","label","numberFormattingFunction","d_0","size","prefix","suffix","P","t10","t11","T0","AnimatePresence","t12","duration","d_2","initial","pathLength","opacity","whileInView","transition","stroke","indexOf","length","Colors","gray","fill","event","clientY","clientX","isEqual","event_0","t13","map","t14","t15","g","t16","svg","t17","Tooltip","t18","modal","DetailsModal","t19","Fragment","DonutChart","graphTitle","light","categoricalColors","sources","graphDescription","footNote","showColorScale","padding","backgroundColor","graphID","graphDownload","dataDownload","sortData","language","theme","width","height","minHeight","relativeHeight","ariaLabel","colorScaleMaxWidth","grays","graphRadius","setGraphRadius","graphDiv","graphParentDiv","useEffect","resizeObserver","ResizeObserver","entries","min","target","clientWidth","clientHeight","current","observe","disconnect","sortedData","orderBy","GraphContainer","graphContainer","GraphHeader","title","description","filter","cn","colorLegend","maxWidth","el","fontSize","Spacer","GraphArea","EmptyState","GraphFooter","footnote","source"],"mappings":";;;;;;;;;;;;;;;;;;AASO,MAAMA,KAAK,KAAK,IAEVC,KAAM,IAAID;ACXR,SAAAE,GAASC,GAAGC,GAAG;AAC5B,SAAOA,IAAID,IAAI,KAAKC,I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