@undp/data-viz 2.1.1 → 2.1.3
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/AreaChart.cjs +1 -1
- package/dist/AreaChart.js +2 -2
- package/dist/BarGraph.cjs +1 -1
- package/dist/BarGraph.cjs.map +1 -1
- package/dist/BarGraph.js +129 -120
- package/dist/BarGraph.js.map +1 -1
- package/dist/BiVariateChoroplethMap.cjs +1 -1
- package/dist/BiVariateChoroplethMap.cjs.map +1 -1
- package/dist/BiVariateChoroplethMap.js +49 -46
- package/dist/BiVariateChoroplethMap.js.map +1 -1
- package/dist/BulletChart.cjs +1 -1
- package/dist/BulletChart.cjs.map +1 -1
- package/dist/BulletChart.d.ts +11 -0
- package/dist/BulletChart.js +758 -711
- package/dist/BulletChart.js.map +1 -1
- package/dist/ButterflyChart.cjs +1 -1
- package/dist/ButterflyChart.cjs.map +1 -1
- package/dist/ButterflyChart.js +7 -4
- package/dist/ButterflyChart.js.map +1 -1
- package/dist/ChoroplethMap.cjs +1 -1
- package/dist/ChoroplethMap.cjs.map +1 -1
- package/dist/ChoroplethMap.js +52 -49
- package/dist/ChoroplethMap.js.map +1 -1
- package/dist/DifferenceLineChart.cjs +1 -1
- package/dist/DifferenceLineChart.js +2 -2
- package/dist/DonutChart.cjs +1 -1
- package/dist/DonutChart.cjs.map +1 -1
- package/dist/DonutChart.d.ts +10 -0
- package/dist/DonutChart.js +230 -264
- package/dist/DonutChart.js.map +1 -1
- package/dist/DotDensityMap.cjs +1 -1
- package/dist/DotDensityMap.cjs.map +1 -1
- package/dist/DotDensityMap.js +37 -34
- package/dist/DotDensityMap.js.map +1 -1
- package/dist/DualAxisLineChart.cjs +1 -1
- package/dist/DualAxisLineChart.js +1 -1
- package/dist/DumbbellChart.cjs +1 -1
- package/dist/DumbbellChart.cjs.map +1 -1
- package/dist/DumbbellChart.js +41 -38
- package/dist/DumbbellChart.js.map +1 -1
- package/dist/GraphEl-BLMih7RN.cjs +2 -0
- package/dist/GraphEl-BLMih7RN.cjs.map +1 -0
- package/dist/{GraphEl-DEzobeOM.js → GraphEl-CRrAlbcr.js} +5 -2
- package/dist/GraphEl-CRrAlbcr.js.map +1 -0
- package/dist/GriddedGraphs.cjs +1 -1
- package/dist/GriddedGraphs.d.ts +1 -0
- package/dist/GriddedGraphs.js +2 -2
- package/dist/GriddedGraphsFromConfig.d.ts +1 -0
- package/dist/HybridMap.cjs +1 -1
- package/dist/HybridMap.cjs.map +1 -1
- package/dist/HybridMap.js +62 -59
- package/dist/HybridMap.js.map +1 -1
- package/dist/LineChartWithConfidenceInterval.cjs +1 -1
- package/dist/LineChartWithConfidenceInterval.js +2 -2
- package/dist/MultiGraphDashboard.d.ts +1 -0
- package/dist/MultiGraphDashboardFromConfig.d.ts +1 -0
- package/dist/MultiLineAltChart.cjs +1 -1
- package/dist/MultiLineAltChart.js +1 -1
- package/dist/MultiLineChart.cjs +1 -1
- package/dist/MultiLineChart.js +1 -1
- package/dist/ParetoChart.cjs +1 -1
- package/dist/ParetoChart.js +1 -1
- package/dist/PerformanceIntensiveMultiGraphDashboard.d.ts +1 -0
- package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.d.ts +1 -0
- package/dist/PerformanceIntensiveScrollStory.d.ts +1 -0
- package/dist/RadarChart.cjs +1 -1
- package/dist/RadarChart.js +1 -1
- package/dist/ScatterPlot.cjs +1 -1
- package/dist/ScatterPlot.cjs.map +1 -1
- package/dist/ScatterPlot.js +7 -4
- package/dist/ScatterPlot.js.map +1 -1
- package/dist/ScrollStory.d.ts +1 -0
- package/dist/SimpleLineChart.cjs +1 -1
- package/dist/SimpleLineChart.js +1 -1
- package/dist/SingleGraphDashboard.cjs +1 -1
- package/dist/SingleGraphDashboard.d.ts +1 -0
- package/dist/SingleGraphDashboard.js +2 -2
- package/dist/SingleGraphDashboardFromConfig.d.ts +1 -0
- package/dist/SingleGraphDashboardGeoHubMaps.d.ts +1 -0
- package/dist/SingleGraphDashboardGeoHubMapsFromConfig.d.ts +1 -0
- package/dist/SingleGraphDashboardThreeDGraphs.cjs +1 -1
- package/dist/SingleGraphDashboardThreeDGraphs.d.ts +1 -0
- package/dist/SingleGraphDashboardThreeDGraphs.js +1 -1
- package/dist/SingleGraphDashboardThreeDGraphsFromConfig.d.ts +1 -0
- package/dist/SparkLine.cjs +1 -1
- package/dist/SparkLine.js +2 -2
- package/dist/Types.d.ts +2 -0
- package/dist/{area-BE2wo7fv.js → area-B6r7cv2o.js} +5 -5
- package/dist/{area-BE2wo7fv.js.map → area-B6r7cv2o.js.map} +1 -1
- package/dist/area-C1gxfNGD.cjs +2 -0
- package/dist/{area-D3Qx7k7K.cjs.map → area-C1gxfNGD.cjs.map} +1 -1
- package/dist/array-DMyR1sql.cjs +2 -0
- package/dist/array-DMyR1sql.cjs.map +1 -0
- package/dist/array-USo-Szhp.js +13 -0
- package/dist/array-USo-Szhp.js.map +1 -0
- package/dist/ensureCompleteData-DH5c52Ub.js +122 -0
- package/dist/ensureCompleteData-DH5c52Ub.js.map +1 -0
- package/dist/ensureCompleteData-pZ9QO6kB.cjs +2 -0
- package/dist/ensureCompleteData-pZ9QO6kB.cjs.map +1 -0
- package/dist/getSchema.cjs +1 -1
- package/dist/getSchema.cjs.map +1 -1
- package/dist/getSchema.js +15 -15
- package/dist/getSchema.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.js +2 -2
- package/dist/line-DFlZsxI1.js +144 -0
- package/dist/line-DFlZsxI1.js.map +1 -0
- package/dist/line-DaEMhXmx.cjs +2 -0
- package/dist/line-DaEMhXmx.cjs.map +1 -0
- package/dist/style.css +1 -1
- package/dist/transformData.cjs +1 -1
- package/dist/transformData.js +2 -2
- package/dist/transformDataForAggregation-CYoB5Xsk.cjs +2 -0
- package/dist/transformDataForAggregation-CYoB5Xsk.cjs.map +1 -0
- package/dist/{transformDataForAggregation-DEU__LUl.js → transformDataForAggregation-j34UL73s.js} +14 -10
- package/dist/transformDataForAggregation-j34UL73s.js.map +1 -0
- package/dist/{transformDataForGraphFromFile-CzepNVGZ.cjs → transformDataForGraphFromFile-CuXxR8uA.cjs} +2 -2
- package/dist/{transformDataForGraphFromFile-CzepNVGZ.cjs.map → transformDataForGraphFromFile-CuXxR8uA.cjs.map} +1 -1
- package/dist/{transformDataForGraphFromFile-CSG24iF6.js → transformDataForGraphFromFile-DyP-83Nh.js} +2 -2
- package/dist/{transformDataForGraphFromFile-CSG24iF6.js.map → transformDataForGraphFromFile-DyP-83Nh.js.map} +1 -1
- package/package.json +1 -1
- package/dist/GraphEl-B16EYkko.cjs +0 -2
- package/dist/GraphEl-B16EYkko.cjs.map +0 -1
- package/dist/GraphEl-DEzobeOM.js.map +0 -1
- package/dist/area-D3Qx7k7K.cjs +0 -2
- package/dist/array-B7TkkRH0.js +0 -89
- package/dist/array-B7TkkRH0.js.map +0 -1
- package/dist/array-DKbXV8lR.cjs +0 -2
- package/dist/array-DKbXV8lR.cjs.map +0 -1
- package/dist/ensureCompleteData-DNKEGRiP.js +0 -102
- package/dist/ensureCompleteData-DNKEGRiP.js.map +0 -1
- package/dist/ensureCompleteData-I6nYmT8E.cjs +0 -2
- package/dist/ensureCompleteData-I6nYmT8E.cjs.map +0 -1
- package/dist/line-CPfhohvF.js +0 -68
- package/dist/line-CPfhohvF.js.map +0 -1
- package/dist/line-DHV4JwCR.cjs +0 -2
- package/dist/line-DHV4JwCR.cjs.map +0 -1
- package/dist/transformDataForAggregation-DEU__LUl.js.map +0 -1
- package/dist/transformDataForAggregation-XNg0OGYE.cjs +0 -2
- package/dist/transformDataForAggregation-XNg0OGYE.cjs.map +0 -1
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/arc.js","../node_modules/d3-shape/src/descending.js","../node_modules/d3-shape/src/identity.js","../node_modules/d3-shape/src/pie.js","../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","import constant from \"./constant.js\";\nimport {abs, acos, asin, atan2, cos, epsilon, halfPi, max, min, pi, sin, sqrt, tau} from \"./math.js\";\nimport {withPath} from \"./path.js\";\n\nfunction arcInnerRadius(d) {\n return d.innerRadius;\n}\n\nfunction arcOuterRadius(d) {\n return d.outerRadius;\n}\n\nfunction arcStartAngle(d) {\n return d.startAngle;\n}\n\nfunction arcEndAngle(d) {\n return d.endAngle;\n}\n\nfunction arcPadAngle(d) {\n return d && d.padAngle; // Note: optional!\n}\n\nfunction intersect(x0, y0, x1, y1, x2, y2, x3, y3) {\n var x10 = x1 - x0, y10 = y1 - y0,\n x32 = x3 - x2, y32 = y3 - y2,\n t = y32 * x10 - x32 * y10;\n if (t * t < epsilon) return;\n t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / t;\n return [x0 + t * x10, y0 + t * y10];\n}\n\n// Compute perpendicular offset line of length rc.\n// http://mathworld.wolfram.com/Circle-LineIntersection.html\nfunction cornerTangents(x0, y0, x1, y1, r1, rc, cw) {\n var x01 = x0 - x1,\n y01 = y0 - y1,\n lo = (cw ? rc : -rc) / sqrt(x01 * x01 + y01 * y01),\n ox = lo * y01,\n oy = -lo * x01,\n x11 = x0 + ox,\n y11 = y0 + oy,\n x10 = x1 + ox,\n y10 = y1 + oy,\n x00 = (x11 + x10) / 2,\n y00 = (y11 + y10) / 2,\n dx = x10 - x11,\n dy = y10 - y11,\n d2 = dx * dx + dy * dy,\n r = r1 - rc,\n D = x11 * y10 - x10 * y11,\n d = (dy < 0 ? -1 : 1) * sqrt(max(0, r * r * d2 - D * D)),\n cx0 = (D * dy - dx * d) / d2,\n cy0 = (-D * dx - dy * d) / d2,\n cx1 = (D * dy + dx * d) / d2,\n cy1 = (-D * dx + dy * d) / d2,\n dx0 = cx0 - x00,\n dy0 = cy0 - y00,\n dx1 = cx1 - x00,\n dy1 = cy1 - y00;\n\n // Pick the closer of the two intersection points.\n // TODO Is there a faster way to determine which intersection to use?\n if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) cx0 = cx1, cy0 = cy1;\n\n return {\n cx: cx0,\n cy: cy0,\n x01: -ox,\n y01: -oy,\n x11: cx0 * (r1 / r - 1),\n y11: cy0 * (r1 / r - 1)\n };\n}\n\nexport default function() {\n var innerRadius = arcInnerRadius,\n outerRadius = arcOuterRadius,\n cornerRadius = constant(0),\n padRadius = null,\n startAngle = arcStartAngle,\n endAngle = arcEndAngle,\n padAngle = arcPadAngle,\n context = null,\n path = withPath(arc);\n\n function arc() {\n var buffer,\n r,\n r0 = +innerRadius.apply(this, arguments),\n r1 = +outerRadius.apply(this, arguments),\n a0 = startAngle.apply(this, arguments) - halfPi,\n a1 = endAngle.apply(this, arguments) - halfPi,\n da = abs(a1 - a0),\n cw = a1 > a0;\n\n if (!context) context = buffer = path();\n\n // Ensure that the outer radius is always larger than the inner radius.\n if (r1 < r0) r = r1, r1 = r0, r0 = r;\n\n // Is it a point?\n if (!(r1 > epsilon)) context.moveTo(0, 0);\n\n // Or is it a circle or annulus?\n else if (da > tau - epsilon) {\n context.moveTo(r1 * cos(a0), r1 * sin(a0));\n context.arc(0, 0, r1, a0, a1, !cw);\n if (r0 > epsilon) {\n context.moveTo(r0 * cos(a1), r0 * sin(a1));\n context.arc(0, 0, r0, a1, a0, cw);\n }\n }\n\n // Or is it a circular or annular sector?\n else {\n var a01 = a0,\n a11 = a1,\n a00 = a0,\n a10 = a1,\n da0 = da,\n da1 = da,\n ap = padAngle.apply(this, arguments) / 2,\n rp = (ap > epsilon) && (padRadius ? +padRadius.apply(this, arguments) : sqrt(r0 * r0 + r1 * r1)),\n rc = min(abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments)),\n rc0 = rc,\n rc1 = rc,\n t0,\n t1;\n\n // Apply padding? Note that since r1 ≥ r0, da1 ≥ da0.\n if (rp > epsilon) {\n var p0 = asin(rp / r0 * sin(ap)),\n p1 = asin(rp / r1 * sin(ap));\n if ((da0 -= p0 * 2) > epsilon) p0 *= (cw ? 1 : -1), a00 += p0, a10 -= p0;\n else da0 = 0, a00 = a10 = (a0 + a1) / 2;\n if ((da1 -= p1 * 2) > epsilon) p1 *= (cw ? 1 : -1), a01 += p1, a11 -= p1;\n else da1 = 0, a01 = a11 = (a0 + a1) / 2;\n }\n\n var x01 = r1 * cos(a01),\n y01 = r1 * sin(a01),\n x10 = r0 * cos(a10),\n y10 = r0 * sin(a10);\n\n // Apply rounded corners?\n if (rc > epsilon) {\n var x11 = r1 * cos(a11),\n y11 = r1 * sin(a11),\n x00 = r0 * cos(a00),\n y00 = r0 * sin(a00),\n oc;\n\n // Restrict the corner radius according to the sector angle. If this\n // intersection fails, it’s probably because the arc is too small, so\n // disable the corner radius entirely.\n if (da < pi) {\n if (oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10)) {\n var ax = x01 - oc[0],\n ay = y01 - oc[1],\n bx = x11 - oc[0],\n by = y11 - oc[1],\n kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2),\n lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]);\n rc0 = min(rc, (r0 - lc) / (kc - 1));\n rc1 = min(rc, (r1 - lc) / (kc + 1));\n } else {\n rc0 = rc1 = 0;\n }\n }\n }\n\n // Is the sector collapsed to a line?\n if (!(da1 > epsilon)) context.moveTo(x01, y01);\n\n // Does the sector’s outer ring have rounded corners?\n else if (rc1 > epsilon) {\n t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw);\n t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw);\n\n context.moveTo(t0.cx + t0.x01, t0.cy + t0.y01);\n\n // Have the corners merged?\n if (rc1 < rc) context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);\n\n // Otherwise, draw the two corners and the ring.\n else {\n context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);\n context.arc(0, 0, r1, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), !cw);\n context.arc(t1.cx, t1.cy, rc1, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);\n }\n }\n\n // Or is the outer ring just a circular arc?\n else context.moveTo(x01, y01), context.arc(0, 0, r1, a01, a11, !cw);\n\n // Is there no inner ring, and it’s a circular sector?\n // Or perhaps it’s an annular sector collapsed due to padding?\n if (!(r0 > epsilon) || !(da0 > epsilon)) context.lineTo(x10, y10);\n\n // Does the sector’s inner ring (or point) have rounded corners?\n else if (rc0 > epsilon) {\n t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw);\n t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw);\n\n context.lineTo(t0.cx + t0.x01, t0.cy + t0.y01);\n\n // Have the corners merged?\n if (rc0 < rc) context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);\n\n // Otherwise, draw the two corners and the ring.\n else {\n context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);\n context.arc(0, 0, r0, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), cw);\n context.arc(t1.cx, t1.cy, rc0, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);\n }\n }\n\n // Or is the inner ring just a circular arc?\n else context.arc(0, 0, r0, a10, a00, cw);\n }\n\n context.closePath();\n\n if (buffer) return context = null, buffer + \"\" || null;\n }\n\n arc.centroid = function() {\n var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2,\n a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi / 2;\n return [cos(a) * r, sin(a) * r];\n };\n\n arc.innerRadius = function(_) {\n return arguments.length ? (innerRadius = typeof _ === \"function\" ? _ : constant(+_), arc) : innerRadius;\n };\n\n arc.outerRadius = function(_) {\n return arguments.length ? (outerRadius = typeof _ === \"function\" ? _ : constant(+_), arc) : outerRadius;\n };\n\n arc.cornerRadius = function(_) {\n return arguments.length ? (cornerRadius = typeof _ === \"function\" ? _ : constant(+_), arc) : cornerRadius;\n };\n\n arc.padRadius = function(_) {\n return arguments.length ? (padRadius = _ == null ? null : typeof _ === \"function\" ? _ : constant(+_), arc) : padRadius;\n };\n\n arc.startAngle = function(_) {\n return arguments.length ? (startAngle = typeof _ === \"function\" ? _ : constant(+_), arc) : startAngle;\n };\n\n arc.endAngle = function(_) {\n return arguments.length ? (endAngle = typeof _ === \"function\" ? _ : constant(+_), arc) : endAngle;\n };\n\n arc.padAngle = function(_) {\n return arguments.length ? (padAngle = typeof _ === \"function\" ? _ : constant(+_), arc) : padAngle;\n };\n\n arc.context = function(_) {\n return arguments.length ? ((context = _ == null ? null : _), arc) : context;\n };\n\n return arc;\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","/* eslint-disable @typescript-eslint/no-explicit-any */\r\nimport isEqual from 'fast-deep-equal';\r\nimport { pie, arc } from 'd3-shape';\r\nimport { useState } from 'react';\r\nimport { H2, P } from '@undp/design-system-react/Typography';\r\n\r\nimport { 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\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\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n\r\n onSeriesMouseOver?: (_d: any) => void;\r\n\r\n onSeriesMouseClick?: (_d: any) => void;\r\n colorDomain: string[];\r\n resetSelectionOnDoubleClick: boolean;\r\n\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n precision: number;\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 } = props;\r\n const pieData = pie()\r\n .sort(null)\r\n .startAngle(0)\r\n\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 <svg\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 <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 {pieData(data as any).map((d, i) => (\r\n <path\r\n key={i}\r\n d={\r\n arc()({\r\n innerRadius: radius - strokeWidth,\r\n outerRadius: radius,\r\n startAngle: d.startAngle,\r\n endAngle: d.endAngle,\r\n }) as string\r\n }\r\n style={{\r\n fill:\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 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 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 </g>\r\n </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} 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 /** 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 /** 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 } = 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 ...[\r\n entries[0].target.clientWidth || 620,\r\n entries[0].target.clientHeight || 480,\r\n radius || Infinity,\r\n ],\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 }, [radius]);\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 {data.length === 0 ? (\r\n <EmptyState />\r\n ) : (\r\n <>\r\n {showColorScale ? (\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 ) : null}\r\n <Spacer size='lg' />\r\n <GraphArea ref={graphDiv}>\r\n {graphRadius ? (\r\n <Graph\r\n mainText={mainText}\r\n data={sortedData}\r\n colors={colors}\r\n 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 />\r\n ) : null}\r\n </GraphArea>\r\n </>\r\n )}\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":["abs","atan2","cos","max","min","sin","sqrt","epsilon","pi","halfPi","tau","acos","x","asin","arcInnerRadius","d","arcOuterRadius","arcStartAngle","arcEndAngle","arcPadAngle","intersect","x0","y0","x1","y1","x2","y2","x3","y3","x10","y10","x32","y32","t","cornerTangents","r1","rc","cw","x01","y01","lo","ox","oy","x11","y11","x00","y00","dx","dy","d2","r","cx0","cy0","cx1","cy1","dx0","dy0","dx1","dy1","arc","innerRadius","outerRadius","cornerRadius","constant","padRadius","startAngle","endAngle","padAngle","context","path","withPath","buffer","r0","a0","a1","da","a01","a11","a00","a10","da0","da1","ap","rp","rc0","rc1","t0","t1","p0","p1","oc","ax","ay","bx","by","kc","lc","a","_","descending","b","identity","pie","value","sortValues","sort","data","i","n","array","j","k","sum","index","arcs","p","pa","v","Graph","props","$","_c","mainText","radius","colors","subNote","strokeWidth","tooltip","onSeriesMouseOver","onSeriesMouseClick","colorDomain","resetSelectionOnDoubleClick","detailsOnClick","styles","classNames","precision","pieData","_temp","mouseOverData","setMouseOverData","useState","undefined","mouseClickData","setMouseClickData","eventX","setEventX","eventY","setEventY","t2","t3","t4","t5","t6","jsx","jsxs","H2","findIndex","d_1","label","numberFormattingFunction","d_0","size","prefix","suffix","P","t7","d_2","fill","indexOf","length","Colors","gray","opacity","event","clientY","clientX","isEqual","event_0","t8","map","t9","t10","t11","Tooltip","t12","modal","DetailsModal","t13","Fragment","DonutChart","graphTitle","light","categoricalColors","sources","graphDescription","footNote","showColorScale","padding","backgroundColor","graphID","graphDownload","dataDownload","sortData","language","theme","width","height","minHeight","relativeHeight","ariaLabel","colorScaleMaxWidth","graphRadius","setGraphRadius","graphDiv","useRef","graphParentDiv","useEffect","resizeObserver","ResizeObserver","entries","Math","target","clientWidth","clientHeight","Infinity","current","observe","disconnect","sortedData","orderBy","GraphContainer","graphContainer","GraphHeader","title","description","filter","EmptyState","cn","colorLegend","maxWidth","el","fontSize","Spacer","GraphArea","GraphFooter","footnote","source"],"mappings":";;;;;;;;;;;;;;;AAAO,MAAMA,KAAM,KAAK,KACXC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AA,MAAEC,UAAUhH,GAAQgH;AAAAA,MAAUC,QAAQjH,GAAQiH;AAAAA,IAAAA,GACtD,YAAY;AAAA,MACVD,UAAU/G,GAAY+G;AAAAA,MACtBC,QAAQhH,GAAYgH;AAAAA,IAAAA,GAEtB,SAAArD,GACA,UAAAE,GACA,OAAAU,EAAA,CAAa,IAEb;AAAA,EAAA,GACN;AAEJ;","x_google_ignoreList":[0,1,2,3,4]}
|
|
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(x, y, radius, endAngleInRadians);\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 ...[\r\n entries[0].target.clientWidth || 620,\r\n entries[0].target.clientHeight || 480,\r\n radius || Infinity,\r\n ],\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 }, [radius]);\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 {data.length === 0 ? (\r\n <EmptyState />\r\n ) : (\r\n <>\r\n {showColorScale ? (\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 ) : null}\r\n <Spacer size='lg' />\r\n <GraphArea ref={graphDiv}>\r\n {graphRadius ? (\r\n <Graph\r\n mainText={mainText}\r\n data={sortedData}\r\n colors={colors}\r\n 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 </>\r\n )}\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","largeArcFlag","PI","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","Infinity","current","observe","disconnect","sortedData","orderBy","GraphContainer","graphContainer","GraphHeader","title","description","filter","EmptyState","cn","colorLegend","maxWidth","el","fontSize","Spacer","GraphArea","GraphFooter","footnote","source"],"mappings":";;;;;;;;;;;;;;;;;;AASO,MAAMA,KAAK,KAAK,IAEVC,KAAM,IAAID;ACXR,SAAAE,GAASC,GAAGC,GAAG;AAC5B,SAAOA,IAAID,IAAI,KAAKC,IAAID,IAAI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;AAAA,MACVD,UAAU1I,GAAY0I;AAAAA,MACtBC,QAAQ3I,GAAY2I;AAAAA,IAAAA,GAEtB,SAAArD,GACA,UAAAE,GACA,OAAAU,EAAA,CAAa,IAEb;AAAA,EAAA,GACN;AAEJ;","x_google_ignoreList":[0,1,2,3]}
|
package/dist/DotDensityMap.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-CHPV5EwG-CTPQjnHt.cjs"),c=require("react"),ct=require("./parse-hMnG_lRV.cjs"),ut=require("./getSliderMarks-BmADcPQt.cjs"),ft=require("./Spinner-DRMBUsX7.cjs"),gt=require("./index-DQA8q5sC.cjs"),U=require("./zoom-DPw8bba-.cjs"),yt=require("./Typography-DX7PlgQU.cjs"),vt=require("./index-DxXnJ8Ti.cjs"),bt=require("./Tooltip-uUdw6wJL.cjs"),$=require("./Colors.cjs"),st=require("./index-DRXx7m-C.cjs"),jt=require("./DetailsModal-BN0HDFlV.cjs"),Et=require("./pow-DgrUorRi.cjs"),it=require("./select-Bnfk0lJx.cjs"),wt=require("./use-in-view-QcfiW0w3.cjs"),Ye=require("./proxy-BxvUI_9l.cjs"),Dt=require("./index-DG2bgAva.cjs"),Ct=require("./GraphFooter.cjs"),Rt=require("./GraphHeader.cjs"),kt=require("./fetchAndParseData-l5HGMAEs.cjs"),St=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),Nt=require("./uniqBy-O05lp2S5.cjs"),dt=require("./GraphContainer-d8A46BK2.cjs");function Ot(a){const{data:e,colors:r,mapData:X,colorLegendTitle:P,colorDomain:j,radius:k,height:x,width:p,scale:h,centerPoint:z,tooltip:Y,showLabels:he,mapBorderWidth:xe,mapBorderColor:fe,mapNoDataColor:K,onSeriesMouseOver:Z,showColorScale:qe,zoomScaleExtend:Me,zoomTranslateExtend:$e,highlightedDataPoints:ge,onSeriesMouseClick:J,resetSelectionOnDoubleClick:ye,detailsOnClick:v,styles:ve,classNames:Q,mapProjection:A,zoomInteraction:R,animate:E,dimmedOpacity:ee,customLayers:F,maxRadiusValue:be,collapseColorScaleByDefault:je}=a,[Ee,we]=c.useState(void 0),[Pe,De]=c.useState(je===void 0?!(p<680):!je),te=c.useRef(null),[W,oe]=c.useState(void 0),[re,u]=c.useState(void 0),[m,T]=c.useState(void 0),[Ce,ae]=c.useState(void 0),I=c.useRef(null),L=wt.useInView(I,{once:E.once,amount:E.amount}),G=c.useRef(null),D=e.filter(t=>t.radius===void 0||t.radius===null).length!==e.length?Et.sqrt().domain([0,be]).range([.25,k]).nice():void 0;c.useEffect(()=>{const t=it.select(G.current),f=it.select(I.current),n=s=>{if(R==="noZoom")return!1;if(R==="button")return!s.type.includes("wheel");const w=s.type==="wheel",b=s.type.startsWith("touch"),y=s.type==="mousedown"||s.type==="mousemove";return b?!0:w?R==="scroll"?!0:s.ctrlKey:y&&!s.button&&!s.ctrlKey},C=U.zoom().scaleExtent(Me).translateExtent($e||[[-20,-20],[p+20,x+20]]).filter(n).on("zoom",({transform:s})=>{t.attr("transform",s)});f.call(C),te.current=C},[x,p,R]);const _=U.turf_bbox_default(X),g=vt.turf_center_of_mass_default(X),ne=_[2]-_[0],Re=_[3]-_[1],ke=p*190/960*360/ne,Se=x*190/678*180/Re,S=h*Math.min(ke,Se),B=A==="mercator"?U.geoMercator().rotate([0,0]).center(z||g.geometry.coordinates).translate([p/2,x/2]).scale(S):A==="equalEarth"?U.geoEqualEarth().rotate([0,0]).center(z||g.geometry.coordinates).translate([p/2,x/2]).scale(S):A==="naturalEarth"?U.geoNaturalEarth1().rotate([0,0]).center(z||g.geometry.coordinates).translate([p/2,x/2]).scale(S):A==="orthographic"?U.geoOrthographic().rotate([0,0]).center(z||g.geometry.coordinates).translate([p/2,x/2]).scale(S):U.geoAlbersUsa().rotate([0,0]).center(z||g.geometry.coordinates).translate([p/2,x/2]).scale(S),ie=t=>{if(!I.current||!te.current)return;it.select(I.current).call(te.current.scaleBy,t==="in"?1.2:1/1.2)};return o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[o.jsxRuntimeExports.jsxs("div",{className:"relative",children:[o.jsxRuntimeExports.jsx(Ye.motion.svg,{width:`${p}px`,height:`${x}px`,viewBox:`0 0 ${p} ${x}`,ref:I,direction:"ltr",children:o.jsxRuntimeExports.jsxs("g",{ref:G,children:[F.filter(t=>t.position==="before").map(t=>t.layer),X.features.map((t,f)=>o.jsxRuntimeExports.jsx("g",{children:t.geometry.type==="MultiPolygon"?t.geometry.coordinates.map((n,C)=>{let s="";return n.forEach(w=>{let b=" M";w.forEach((y,se)=>{const V=B([y[0],y[1]]);se!==w.length-1?b=`${b}${V[0]} ${V[1]}L`:b=`${b}${V[0]} ${V[1]}`}),s+=b}),o.jsxRuntimeExports.jsx("path",{d:s,style:{stroke:fe,strokeWidth:xe,fill:K}},C)}):t.geometry.coordinates.map((n,C)=>{let s="M";return n.forEach((w,b)=>{const y=B([w[0],w[1]]);b!==n.length-1?s=`${s}${y[0]} ${y[1]}L`:s=`${s}${y[0]} ${y[1]}`}),o.jsxRuntimeExports.jsx("path",{d:s,style:{stroke:fe,strokeWidth:xe,fill:K}},C)})},f)),o.jsxRuntimeExports.jsx(Dt.AnimatePresence,{children:e.map(t=>{const f=e.filter(n=>n.color).length===0?r[0]:t.color?r[j.indexOf(`${t.color}`)]:$.Colors.gray;return o.jsxRuntimeExports.jsxs(Ye.motion.g,{variants:{initial:{opacity:0},whileInView:{opacity:Ee?Ee===f?1:ee:ge.length!==0?ge.indexOf(t.label||"")!==-1?1:ee:1,transition:{duration:E.duration}}},initial:"initial",animate:L?"whileInView":"initial",exit:{opacity:0,transition:{duration:E.duration}},onMouseEnter:n=>{u(t),ae(n.clientY),T(n.clientX),Z?.(t)},onMouseMove:n=>{u(t),ae(n.clientY),T(n.clientX)},onMouseLeave:()=>{u(void 0),T(void 0),ae(void 0),Z?.(void 0)},onClick:()=>{(J||v)&&(gt.isEqual(W,t)&&ye?(oe(void 0),J?.(void 0)):(oe(t),J?.(t)))},transform:`translate(${B([t.long,t.lat])[0]},${B([t.long,t.lat])[1]})`,children:[o.jsxRuntimeExports.jsx(Ye.motion.circle,{cx:0,cy:0,variants:{initial:{r:0,fill:e.filter(n=>n.color).length===0?r[0]:t.color?r[j.indexOf(`${t.color}`)]:$.Colors.gray,stroke:e.filter(n=>n.color).length===0?r[0]:t.color?r[j.indexOf(`${t.color}`)]:$.Colors.gray},whileInView:{r:D?D(t.radius||0):k,fill:e.filter(n=>n.color).length===0?r[0]:t.color?r[j.indexOf(`${t.color}`)]:$.Colors.gray,stroke:e.filter(n=>n.color).length===0?r[0]:t.color?r[j.indexOf(`${t.color}`)]:$.Colors.gray,transition:{duration:E.duration}}},initial:"initial",animate:L?"whileInView":"initial",exit:{r:0,transition:{duration:E.duration}},style:{fillOpacity:.8}}),he&&t.label?o.jsxRuntimeExports.jsx(Ye.motion.text,{variants:{initial:{opacity:0,x:D?D(t.radius||0):k},whileInView:{opacity:1,x:D?D(t.radius||0):k,transition:{duration:E.duration}}},initial:"initial",animate:L?"whileInView":"initial",exit:{opacity:0,transition:{duration:E.duration}},y:0,className:"fill-primary-gray-600 dark:fill-primary-gray-300 text-sm",style:{textAnchor:"start"},dx:4,dy:5,children:t.label}):null]},t.label||`${t.lat}-${t.long}`)})}),F.filter(t=>t.position==="after").map(t=>t.layer)]})}),e.filter(t=>t.color).length===0||qe===!1?null:o.jsxRuntimeExports.jsx("div",{className:o.mo("absolute left-4 bottom-4 map-color-legend",Q?.colorLegend),children:Pe?o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[o.jsxRuntimeExports.jsx("div",{className:"color-legend-close-button bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)] border border-[var(--gray-400)] rounded-full w-6 h-6 p-[3px] cursor-pointer z-10 absolute right-[-0.75rem] top-[-0.75rem]",onClick:()=>{De(!1)},children:o.jsxRuntimeExports.jsx(st.X,{})}),o.jsxRuntimeExports.jsxs("div",{className:"p-2",style:{backgroundColor:"rgba(240,240,240, 0.7)"},children:[P&&P!==""?o.jsxRuntimeExports.jsx("p",{className:"p-0 leading-normal overflow-hidden text-primary-gray-700 dark:text-primary-gray-300",style:{display:"-webkit-box",WebkitLineClamp:"1",WebkitBoxOrient:"vertical"},children:P}):null,o.jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-3",children:j.map((t,f)=>o.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 items-center",onMouseOver:()=>{we(r[f%r.length])},onMouseLeave:()=>{we(void 0)},children:[o.jsxRuntimeExports.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:r[f%r.length]}}),o.jsxRuntimeExports.jsx(yt.j,{size:"sm",marginBottom:"none",leading:"none",children:t})]},f))})]})]}):o.jsxRuntimeExports.jsx("button",{type:"button",className:"mb-0 border-0 bg-transparent p-0 self-start",onClick:()=>{De(!0)},children:o.jsxRuntimeExports.jsx("div",{className:"show-color-legend-button 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-600 border-primary-gray-400 dark:border-primary-gray-500",children:"Show Legend"})})}),R==="button"&&o.jsxRuntimeExports.jsxs("div",{className:"absolute left-4 top-4 flex flex-col zoom-buttons",children:[o.jsxRuntimeExports.jsx("button",{onClick:()=>ie("in"),className:"leading-0 px-2 py-3.5 text-primary-gray-700 border border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"+"}),o.jsxRuntimeExports.jsx("button",{onClick:()=>ie("out"),className:"leading-0 px-2 py-3.5 text-primary-gray-700 border border-t-0 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"–"})]})]}),v&&W!==void 0?o.jsxRuntimeExports.jsx(jt.DetailsModal,{body:v,data:W,setData:oe,className:Q?.modal}):null,re&&Y&&m&&Ce?o.jsxRuntimeExports.jsx(bt.Tooltip,{data:re,body:Y,xPos:m,yPos:Ce,backgroundStyle:ve?.tooltip,className:Q?.tooltip}):null]})}function qt(a){const e=o.compilerRuntimeExports.c(117),{data:r,mapData:X,graphTitle:P,colors:j,sources:k,graphDescription:x,height:p,width:h,footNote:z,colorLegendTitle:Y,colorDomain:he,radius:xe,scale:fe,centerPoint:K,padding:Z,mapBorderWidth:qe,mapNoDataColor:Me,backgroundColor:$e,showLabels:ge,mapBorderColor:J,tooltip:ye,relativeHeight:v,onSeriesMouseOver:ve,isWorldMap:Q,showColorScale:A,zoomScaleExtend:R,zoomTranslateExtend:E,graphID:ee,highlightedDataPoints:F,onSeriesMouseClick:be,graphDownload:je,dataDownload:Ee,showAntarctica:we,language:Pe,minHeight:De,theme:te,ariaLabel:W,resetSelectionOnDoubleClick:oe,detailsOnClick:re,styles:u,classNames:m,mapProjection:T,zoomInteraction:Ce,animate:ae,dimmedOpacity:I,customLayers:L,maxRadiusValue:G,timeline:D,collapseColorScaleByDefault:_}=a,g=X===void 0?"https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap.json":X,ne=z===void 0?"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.":z,Re=xe===void 0?5:xe,ke=fe===void 0?.95:fe,Se=qe===void 0?.5:qe,S=Me===void 0?$.Colors.light.graphNoData:Me,B=$e===void 0?!1:$e,ie=ge===void 0?!1:ge,t=J===void 0?$.Colors.light.grays["gray-500"]:J,f=Q===void 0?!0:Q,n=A===void 0?!0:A;let C;e[0]!==R?(C=R===void 0?[.8,6]:R,e[0]=R,e[1]=C):C=e[1];const s=C;let w;e[2]!==F?(w=F===void 0?[]:F,e[2]=F,e[3]=w):w=e[3];const b=w,y=je===void 0?!1:je,se=Ee===void 0?!1:Ee,V=we===void 0?!1:we,Ke=Pe===void 0?"en":Pe,N=De===void 0?0:De,le=te===void 0?"light":te,Ze=oe===void 0?!0:oe,Je=Ce===void 0?"button":Ce,ze=ae===void 0?!1:ae,Qe=I===void 0?.3:I;let Ie;e[4]!==L?(Ie=L===void 0?[]:L,e[4]=L,e[5]=Ie):Ie=e[5];const et=Ie;let Le;e[6]!==D?(Le=D===void 0?{enabled:!1,autoplay:!1,showOnlyActiveDate:!0}:D,e[6]=D,e[7]=Le):Le=e[7];const i=Le,[H,mt]=c.useState(0),[Ne,pt]=c.useState(0),[O,ht]=c.useState(i.autoplay);let Oe;if(e[8]!==r||e[9]!==i.dateFormat){let d;e[11]!==i.dateFormat?(d=M=>ct.parse(`${M}`,i.dateFormat||"yyyy",new Date).getTime(),e[11]=i.dateFormat,e[12]=d):d=e[12],Oe=[...new Set(r.map(d))],Oe.sort(Ft),e[8]=r,e[9]=i.dateFormat,e[10]=Oe}else Oe=e[10];const l=Oe,[q,tt]=c.useState(i.autoplay?0:l.length-1),[ce,xt]=c.useState(void 0),ot=c.useRef(null),lt=c.useRef(null);let _e,Be;e[13]===Symbol.for("react.memo_cache_sentinel")?(_e=()=>{const d=new ResizeObserver(M=>{mt(M[0].target.clientWidth||620),pt(M[0].target.clientHeight||480)});return ot.current&&d.observe(ot.current),()=>d.disconnect()},Be=[],e[13]=_e,e[14]=Be):(_e=e[13],Be=e[14]),c.useEffect(_e,Be);let Ve;e[15]===Symbol.for("react.memo_cache_sentinel")?(Ve=d=>{xt(d)},e[15]=Ve):Ve=e[15];const Ae=c.useEffectEvent(Ve);let Fe;e[16]!==g||e[17]!==Ae?(Fe=()=>{typeof g=="string"?kt.fetchAndParseJSON(g).then(M=>{Ae(M)}):Ae(g)},e[16]=g,e[17]=Ae,e[18]=Fe):Fe=e[18];let We;e[19]!==g?(We=[g],e[19]=g,e[20]=We):We=e[20],c.useEffect(Fe,We);let Te,Ge;e[21]!==O||e[22]!==i.speed||e[23]!==l?(Te=()=>{const d=setInterval(()=>{tt(M=>M<l.length-1?M+1:0)},(i.speed||2)*1e3);return O||clearInterval(d),()=>clearInterval(d)},Ge=[l,O,i.speed],e[21]=O,e[22]=i.speed,e[23]=l,e[24]=Te,e[25]=Ge):(Te=e[24],Ge=e[25]),c.useEffect(Te,Ge);const rt=i.dateFormat||"yyyy";let He;e[26]!==q||e[27]!==rt||e[28]!==i.showOnlyActiveDate||e[29]!==l?(He=ut.getSliderMarks(l,q,i.showOnlyActiveDate,rt),e[26]=q,e[27]=rt,e[28]=i.showOnlyActiveDate,e[29]=l,e[30]=He):He=e[30];const Ue=He,at=m?.graphContainer,nt=u?.graphContainer;let ue;e[31]!==m?.description||e[32]!==m?.title||e[33]!==r||e[34]!==se||e[35]!==x||e[36]!==y||e[37]!==P||e[38]!==u?.description||e[39]!==u?.title||e[40]!==h?(ue=P||x||y||se?o.jsxRuntimeExports.jsx(Rt.GraphHeader,{styles:{title:u?.title,description:u?.description},classNames:{title:m?.title,description:m?.description},graphTitle:P,graphDescription:x,width:h,graphDownload:y?lt:void 0,dataDownload:se?r.map(At).filter(Vt).length>0?r.map(Bt).filter(_t):r.filter(Lt):null}):null,e[31]=m?.description,e[32]=m?.title,e[33]=r,e[34]=se,e[35]=x,e[36]=y,e[37]=P,e[38]=u?.description,e[39]=u?.title,e[40]=h,e[41]=ue):ue=e[41];let de;e[42]!==q||e[43]!==Ue||e[44]!==O||e[45]!==i.enabled||e[46]!==l?(de=i.enabled&&l.length>0&&Ue?o.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[o.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{ht(!O)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":O?"Click to pause animation":"Click to play animation",children:O?o.jsxRuntimeExports.jsx(st.Pause,{}):o.jsxRuntimeExports.jsx(st.Play,{})}),o.jsxRuntimeExports.jsx(ut.Nr,{min:l[0],max:l[l.length-1],marks:Ue,step:null,defaultValue:l[l.length-1],value:l[q],onChangeComplete:d=>{tt(l.indexOf(d))},onChange:d=>{tt(l.indexOf(d))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,e[42]=q,e[43]=Ue,e[44]=O,e[45]=i.enabled,e[46]=l,e[47]=de):de=e[47];let me;e[48]!==ze||e[49]!==K||e[50]!==m||e[51]!==_||e[52]!==he||e[53]!==Y||e[54]!==j||e[55]!==et||e[56]!==r||e[57]!==re||e[58]!==Qe||e[59]!==p||e[60]!==b||e[61]!==q||e[62]!==f||e[63]!==t||e[64]!==Se||e[65]!==S||e[66]!==T||e[67]!==ce||e[68]!==G||e[69]!==N||e[70]!==be||e[71]!==ve||e[72]!==Re||e[73]!==v||e[74]!==Ze||e[75]!==ke||e[76]!==V||e[77]!==n||e[78]!==ie||e[79]!==u||e[80]!==Ne||e[81]!==H||e[82]!==le||e[83]!==i.dateFormat||e[84]!==i.enabled||e[85]!==ye||e[86]!==l||e[87]!==h||e[88]!==Je||e[89]!==s||e[90]!==E?(me=o.jsxRuntimeExports.jsx(dt.GraphArea,{ref:ot,children:H&&Ne&&ce?o.jsxRuntimeExports.jsx(Ot,{data:r.filter(d=>i.enabled?d.date===ct.format(new Date(l[q]),i.dateFormat||"yyyy"):d),mapData:V?ce:{...ce,features:ce.features.filter(It)},colorDomain:r.filter(zt).length===0?[]:he||Nt.uniqBy(r,"color",!0),width:H,height:Ne,scale:ke,centerPoint:K,colors:r.filter(Pt).length===0?j?[j]:[$.Colors.primaryColors["blue-600"]]:j||$.Colors[le].categoricalColors.colors,colorLegendTitle:Y,radius:Re,mapBorderWidth:Se,mapNoDataColor:S,mapBorderColor:t,tooltip:ye,onSeriesMouseOver:ve,showLabels:ie,isWorldMap:f,showColorScale:n,zoomScaleExtend:s,zoomTranslateExtend:E,onSeriesMouseClick:be,highlightedDataPoints:b,resetSelectionOnDoubleClick:Ze,styles:u,classNames:m,zoomInteraction:Je,detailsOnClick:re,mapProjection:T||(f?"naturalEarth":"mercator"),animate:ze===!0?{duration:.5,once:!0,amount:.5}:ze||{duration:0,once:!0,amount:0},dimmedOpacity:Qe,customLayers:et,maxRadiusValue:St.checkIfNullOrUndefined(G)?Math.max(...r.map($t).filter(Mt)):G,collapseColorScaleByDefault:_}):o.jsxRuntimeExports.jsx("div",{style:{height:`${Math.max(N,p||(v?N?(h||H)*v>N?(h||H)*v:N:(h||H)*v:Ne))}px`},className:"flex items-center justify-center",children:o.jsxRuntimeExports.jsx(ft.w,{"aria-label":"Loading graph"})})}),e[48]=ze,e[49]=K,e[50]=m,e[51]=_,e[52]=he,e[53]=Y,e[54]=j,e[55]=et,e[56]=r,e[57]=re,e[58]=Qe,e[59]=p,e[60]=b,e[61]=q,e[62]=f,e[63]=t,e[64]=Se,e[65]=S,e[66]=T,e[67]=ce,e[68]=G,e[69]=N,e[70]=be,e[71]=ve,e[72]=Re,e[73]=v,e[74]=Ze,e[75]=ke,e[76]=V,e[77]=n,e[78]=ie,e[79]=u,e[80]=Ne,e[81]=H,e[82]=le,e[83]=i.dateFormat,e[84]=i.enabled,e[85]=ye,e[86]=l,e[87]=h,e[88]=Je,e[89]=s,e[90]=E,e[91]=me):me=e[91];let pe;e[92]!==m?.footnote||e[93]!==m?.source||e[94]!==ne||e[95]!==k||e[96]!==u?.footnote||e[97]!==u?.source||e[98]!==h?(pe=k||ne?o.jsxRuntimeExports.jsx(Ct.GraphFooter,{styles:{footnote:u?.footnote,source:u?.source},classNames:{footnote:m?.footnote,source:m?.source},sources:k,footNote:ne,width:h}):null,e[92]=m?.footnote,e[93]=m?.source,e[94]=ne,e[95]=k,e[96]=u?.footnote,e[97]=u?.source,e[98]=h,e[99]=pe):pe=e[99];let Xe;return e[100]!==W||e[101]!==B||e[102]!==ee||e[103]!==p||e[104]!==Ke||e[105]!==N||e[106]!==Z||e[107]!==v||e[108]!==at||e[109]!==nt||e[110]!==ue||e[111]!==de||e[112]!==me||e[113]!==pe||e[114]!==le||e[115]!==h?(Xe=o.jsxRuntimeExports.jsxs(dt.GraphContainer,{className:at,style:nt,id:ee,ref:lt,"aria-label":W,backgroundColor:B,theme:le,language:Ke,minHeight:N,width:h,height:p,relativeHeight:v,padding:Z,children:[ue,de,me,pe]}),e[100]=W,e[101]=B,e[102]=ee,e[103]=p,e[104]=Ke,e[105]=N,e[106]=Z,e[107]=v,e[108]=at,e[109]=nt,e[110]=ue,e[111]=de,e[112]=me,e[113]=pe,e[114]=le,e[115]=h,e[116]=Xe):Xe=e[116],Xe}function Mt(a){return a!=null}function $t(a){return a.radius}function Pt(a){return a.color}function zt(a){return a.color}function It(a){return a.properties.NAME!=="Antarctica"}function Lt(a){return a!==void 0}function _t(a){return a!==void 0}function Bt(a){return a.data}function Vt(a){return a!==void 0}function At(a){return a.data}function Ft(a,e){return a-e}exports.DotDensityMap=qt;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-CHPV5EwG-CTPQjnHt.cjs"),c=require("react"),ct=require("./parse-hMnG_lRV.cjs"),ut=require("./getSliderMarks-BmADcPQt.cjs"),ft=require("./Spinner-DRMBUsX7.cjs"),gt=require("./index-DQA8q5sC.cjs"),U=require("./zoom-DPw8bba-.cjs"),yt=require("./Typography-DX7PlgQU.cjs"),vt=require("./index-DxXnJ8Ti.cjs"),bt=require("./Tooltip-uUdw6wJL.cjs"),$=require("./Colors.cjs"),st=require("./index-DRXx7m-C.cjs"),jt=require("./DetailsModal-BN0HDFlV.cjs"),Et=require("./pow-DgrUorRi.cjs"),it=require("./select-Bnfk0lJx.cjs"),wt=require("./use-in-view-QcfiW0w3.cjs"),Ye=require("./proxy-BxvUI_9l.cjs"),Dt=require("./index-DG2bgAva.cjs"),Ct=require("./GraphFooter.cjs"),Rt=require("./GraphHeader.cjs"),kt=require("./fetchAndParseData-l5HGMAEs.cjs"),St=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),Nt=require("./uniqBy-O05lp2S5.cjs"),dt=require("./GraphContainer-d8A46BK2.cjs");function Ot(a){const{data:e,colors:r,mapData:X,colorLegendTitle:P,colorDomain:j,radius:k,height:x,width:p,scale:h,centerPoint:_,tooltip:Y,showLabels:he,mapBorderWidth:xe,mapBorderColor:fe,mapNoDataColor:K,onSeriesMouseOver:Z,showColorScale:qe,zoomScaleExtend:Me,zoomTranslateExtend:$e,highlightedDataPoints:ge,onSeriesMouseClick:J,resetSelectionOnDoubleClick:ye,detailsOnClick:v,styles:ve,classNames:Q,mapProjection:A,zoomInteraction:R,animate:E,dimmedOpacity:ee,customLayers:F,maxRadiusValue:be,collapseColorScaleByDefault:je}=a,[Ee,we]=c.useState(void 0),[Pe,De]=c.useState(je===void 0?!(p<680):!je),te=c.useRef(null),[W,oe]=c.useState(void 0),[re,u]=c.useState(void 0),[m,T]=c.useState(void 0),[Ce,ae]=c.useState(void 0),z=c.useRef(null),I=wt.useInView(z,{once:E.once,amount:E.amount}),G=c.useRef(null),D=e.filter(t=>t.radius===void 0||t.radius===null).length!==e.length?Et.sqrt().domain([0,be]).range([.25,k]).nice():void 0;c.useEffect(()=>{const t=it.select(G.current),f=it.select(z.current),n=s=>{if(R==="noZoom")return!1;if(R==="button")return!s.type.includes("wheel");const w=s.type==="wheel",b=s.type.startsWith("touch"),y=s.type==="mousedown"||s.type==="mousemove";return b?!0:w?R==="scroll"?!0:s.ctrlKey:y&&!s.button&&!s.ctrlKey},C=U.zoom().scaleExtent(Me).translateExtent($e||[[-20,-20],[p+20,x+20]]).filter(n).on("zoom",({transform:s})=>{t.attr("transform",s)});f.call(C),te.current=C},[x,p,R]);const L=U.turf_bbox_default(X),g=vt.turf_center_of_mass_default(X),ne=L[2]-L[0],Re=L[3]-L[1],ke=p*190/960*360/ne,Se=x*190/678*180/Re,S=h*Math.min(ke,Se),B=A==="mercator"?U.geoMercator().rotate([0,0]).center(_||g.geometry.coordinates).translate([p/2,x/2]).scale(S):A==="equalEarth"?U.geoEqualEarth().rotate([0,0]).center(_||g.geometry.coordinates).translate([p/2,x/2]).scale(S):A==="naturalEarth"?U.geoNaturalEarth1().rotate([0,0]).center(_||g.geometry.coordinates).translate([p/2,x/2]).scale(S):A==="orthographic"?U.geoOrthographic().rotate([0,0]).center(_||g.geometry.coordinates).translate([p/2,x/2]).scale(S):U.geoAlbersUsa().rotate([0,0]).center(_||g.geometry.coordinates).translate([p/2,x/2]).scale(S),ie=t=>{if(!z.current||!te.current)return;it.select(z.current).call(te.current.scaleBy,t==="in"?1.2:1/1.2)};return o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[o.jsxRuntimeExports.jsxs("div",{className:"relative",children:[o.jsxRuntimeExports.jsx(Ye.motion.svg,{width:`${p}px`,height:`${x}px`,viewBox:`0 0 ${p} ${x}`,ref:z,direction:"ltr",children:o.jsxRuntimeExports.jsxs("g",{ref:G,children:[F.filter(t=>t.position==="before").map(t=>t.layer),X.features.map((t,f)=>o.jsxRuntimeExports.jsx("g",{children:t.geometry.type==="MultiPolygon"?t.geometry.coordinates.map((n,C)=>{let s="";return n.forEach(w=>{let b=" M";w.forEach((y,se)=>{const V=B([y[0],y[1]]);se!==w.length-1?b=`${b}${V[0]} ${V[1]}L`:b=`${b}${V[0]} ${V[1]}`}),s+=b}),o.jsxRuntimeExports.jsx("path",{d:s,style:{stroke:fe,strokeWidth:xe,fill:K}},C)}):t.geometry.coordinates.map((n,C)=>{let s="M";return n.forEach((w,b)=>{const y=B([w[0],w[1]]);b!==n.length-1?s=`${s}${y[0]} ${y[1]}L`:s=`${s}${y[0]} ${y[1]}`}),o.jsxRuntimeExports.jsx("path",{d:s,style:{stroke:fe,strokeWidth:xe,fill:K}},C)})},f)),o.jsxRuntimeExports.jsx(Dt.AnimatePresence,{children:e.map(t=>{const f=e.filter(n=>n.color).length===0?r[0]:t.color?r[j.indexOf(`${t.color}`)]:$.Colors.gray;return o.jsxRuntimeExports.jsxs(Ye.motion.g,{variants:{initial:{opacity:0},whileInView:{opacity:Ee?Ee===f?1:ee:ge.length!==0?ge.indexOf(t.label||"")!==-1?1:ee:1,transition:{duration:E.duration}}},initial:"initial",animate:I?"whileInView":"initial",exit:{opacity:0,transition:{duration:E.duration}},onMouseEnter:n=>{u(t),ae(n.clientY),T(n.clientX),Z?.(t)},onMouseMove:n=>{u(t),ae(n.clientY),T(n.clientX)},onMouseLeave:()=>{u(void 0),T(void 0),ae(void 0),Z?.(void 0)},onClick:()=>{(J||v)&&(gt.isEqual(W,t)&&ye?(oe(void 0),J?.(void 0)):(oe(t),J?.(t)))},transform:`translate(${B([t.long,t.lat])[0]},${B([t.long,t.lat])[1]})`,children:[o.jsxRuntimeExports.jsx(Ye.motion.circle,{cx:0,cy:0,variants:{initial:{r:0,fill:e.filter(n=>n.color).length===0?r[0]:t.color?r[j.indexOf(`${t.color}`)]:$.Colors.gray,stroke:e.filter(n=>n.color).length===0?r[0]:t.color?r[j.indexOf(`${t.color}`)]:$.Colors.gray},whileInView:{r:D?D(t.radius||0):k,fill:e.filter(n=>n.color).length===0?r[0]:t.color?r[j.indexOf(`${t.color}`)]:$.Colors.gray,stroke:e.filter(n=>n.color).length===0?r[0]:t.color?r[j.indexOf(`${t.color}`)]:$.Colors.gray,transition:{duration:E.duration}}},initial:"initial",animate:I?"whileInView":"initial",exit:{r:0,transition:{duration:E.duration}},style:{fillOpacity:.8}}),he&&t.label?o.jsxRuntimeExports.jsx(Ye.motion.text,{variants:{initial:{opacity:0,x:D?D(t.radius||0):k},whileInView:{opacity:1,x:D?D(t.radius||0):k,transition:{duration:E.duration}}},initial:"initial",animate:I?"whileInView":"initial",exit:{opacity:0,transition:{duration:E.duration}},y:0,className:"fill-primary-gray-600 dark:fill-primary-gray-300 text-sm",style:{textAnchor:"start"},dx:4,dy:5,children:t.label}):null]},t.label||`${t.lat}-${t.long}`)})}),F.filter(t=>t.position==="after").map(t=>t.layer)]})}),e.filter(t=>t.color).length===0||qe===!1?null:o.jsxRuntimeExports.jsx("div",{className:o.mo("absolute left-4 bottom-4 map-color-legend",Q?.colorLegend),children:Pe?o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[o.jsxRuntimeExports.jsx("div",{className:"color-legend-close-button bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)] border border-[var(--gray-400)] rounded-full w-6 h-6 p-[3px] cursor-pointer z-10 absolute right-[-0.75rem] top-[-0.75rem]",onClick:()=>{De(!1)},children:o.jsxRuntimeExports.jsx(st.X,{})}),o.jsxRuntimeExports.jsxs("div",{className:"p-2",style:{backgroundColor:"rgba(240,240,240, 0.7)"},children:[P&&P!==""?o.jsxRuntimeExports.jsx("p",{className:"p-0 leading-normal overflow-hidden text-primary-gray-700 dark:text-primary-gray-300",style:{display:"-webkit-box",WebkitLineClamp:"1",WebkitBoxOrient:"vertical"},children:P}):null,o.jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-3",children:j.map((t,f)=>o.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 items-center",onMouseOver:()=>{we(r[f%r.length])},onMouseLeave:()=>{we(void 0)},children:[o.jsxRuntimeExports.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:r[f%r.length]}}),o.jsxRuntimeExports.jsx(yt.j,{size:"sm",marginBottom:"none",leading:"none",children:t})]},f))})]})]}):o.jsxRuntimeExports.jsx("button",{type:"button",className:"mb-0 border-0 bg-transparent p-0 self-start",onClick:()=>{De(!0)},children:o.jsxRuntimeExports.jsx("div",{className:"show-color-legend-button 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-600 border-primary-gray-400 dark:border-primary-gray-500",children:"Show Legend"})})}),R==="button"&&o.jsxRuntimeExports.jsxs("div",{className:"absolute left-4 top-4 flex flex-col zoom-buttons",children:[o.jsxRuntimeExports.jsx("button",{onClick:()=>ie("in"),className:"leading-0 px-2 py-3.5 text-primary-gray-700 border border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"+"}),o.jsxRuntimeExports.jsx("button",{onClick:()=>ie("out"),className:"leading-0 px-2 py-3.5 text-primary-gray-700 border border-t-0 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"–"})]})]}),v&&W!==void 0?o.jsxRuntimeExports.jsx(jt.DetailsModal,{body:v,data:W,setData:oe,className:Q?.modal}):null,re&&Y&&m&&Ce?o.jsxRuntimeExports.jsx(bt.Tooltip,{data:re,body:Y,xPos:m,yPos:Ce,backgroundStyle:ve?.tooltip,className:Q?.tooltip}):null]})}function qt(a){const e=o.compilerRuntimeExports.c(117),{data:r,mapData:X,graphTitle:P,colors:j,sources:k,graphDescription:x,height:p,width:h,footNote:_,colorLegendTitle:Y,colorDomain:he,radius:xe,scale:fe,centerPoint:K,padding:Z,mapBorderWidth:qe,mapNoDataColor:Me,backgroundColor:$e,showLabels:ge,mapBorderColor:J,tooltip:ye,relativeHeight:v,onSeriesMouseOver:ve,isWorldMap:Q,showColorScale:A,zoomScaleExtend:R,zoomTranslateExtend:E,graphID:ee,highlightedDataPoints:F,onSeriesMouseClick:be,graphDownload:je,dataDownload:Ee,showAntarctica:we,language:Pe,minHeight:De,theme:te,ariaLabel:W,resetSelectionOnDoubleClick:oe,detailsOnClick:re,styles:u,classNames:m,mapProjection:T,zoomInteraction:Ce,animate:ae,dimmedOpacity:z,customLayers:I,maxRadiusValue:G,timeline:D,collapseColorScaleByDefault:L}=a,g=X===void 0?"https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap.json":X,ne=_===void 0?"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.":_,Re=xe===void 0?5:xe,ke=fe===void 0?.95:fe,Se=qe===void 0?.5:qe,S=Me===void 0?$.Colors.light.graphNoData:Me,B=$e===void 0?!1:$e,ie=ge===void 0?!1:ge,t=J===void 0?$.Colors.light.grays["gray-500"]:J,f=Q===void 0?!0:Q,n=A===void 0?!0:A;let C;e[0]!==R?(C=R===void 0?[.8,6]:R,e[0]=R,e[1]=C):C=e[1];const s=C;let w;e[2]!==F?(w=F===void 0?[]:F,e[2]=F,e[3]=w):w=e[3];const b=w,y=je===void 0?!1:je,se=Ee===void 0?!1:Ee,V=we===void 0?!1:we,Ke=Pe===void 0?"en":Pe,N=De===void 0?0:De,le=te===void 0?"light":te,Ze=oe===void 0?!0:oe,Je=Ce===void 0?"button":Ce,_e=ae===void 0?!1:ae,Qe=z===void 0?.3:z;let ze;e[4]!==I?(ze=I===void 0?[]:I,e[4]=I,e[5]=ze):ze=e[5];const et=ze;let Ie;e[6]!==D?(Ie=D===void 0?{enabled:!1,autoplay:!1,showOnlyActiveDate:!0}:D,e[6]=D,e[7]=Ie):Ie=e[7];const i=Ie,[H,mt]=c.useState(0),[Ne,pt]=c.useState(0),[O,ht]=c.useState(i.autoplay);let Oe;if(e[8]!==r||e[9]!==i.dateFormat){let d;e[11]!==i.dateFormat?(d=M=>ct.parse(`${M.date}`,i.dateFormat||"yyyy",new Date).getTime(),e[11]=i.dateFormat,e[12]=d):d=e[12],Oe=[...new Set(r.filter(Wt).map(d))],Oe.sort(Ft),e[8]=r,e[9]=i.dateFormat,e[10]=Oe}else Oe=e[10];const l=Oe,[q,tt]=c.useState(i.autoplay?0:l.length-1),[ce,xt]=c.useState(void 0),ot=c.useRef(null),lt=c.useRef(null);let Le,Be;e[13]===Symbol.for("react.memo_cache_sentinel")?(Le=()=>{const d=new ResizeObserver(M=>{mt(M[0].target.clientWidth||620),pt(M[0].target.clientHeight||480)});return ot.current&&d.observe(ot.current),()=>d.disconnect()},Be=[],e[13]=Le,e[14]=Be):(Le=e[13],Be=e[14]),c.useEffect(Le,Be);let Ve;e[15]===Symbol.for("react.memo_cache_sentinel")?(Ve=d=>{xt(d)},e[15]=Ve):Ve=e[15];const Ae=c.useEffectEvent(Ve);let Fe;e[16]!==g||e[17]!==Ae?(Fe=()=>{typeof g=="string"?kt.fetchAndParseJSON(g).then(M=>{Ae(M)}):Ae(g)},e[16]=g,e[17]=Ae,e[18]=Fe):Fe=e[18];let We;e[19]!==g?(We=[g],e[19]=g,e[20]=We):We=e[20],c.useEffect(Fe,We);let Te,Ge;e[21]!==O||e[22]!==i.speed||e[23]!==l?(Te=()=>{const d=setInterval(()=>{tt(M=>M<l.length-1?M+1:0)},(i.speed||2)*1e3);return O||clearInterval(d),()=>clearInterval(d)},Ge=[l,O,i.speed],e[21]=O,e[22]=i.speed,e[23]=l,e[24]=Te,e[25]=Ge):(Te=e[24],Ge=e[25]),c.useEffect(Te,Ge);const rt=i.dateFormat||"yyyy";let He;e[26]!==q||e[27]!==rt||e[28]!==i.showOnlyActiveDate||e[29]!==l?(He=ut.getSliderMarks(l,q,i.showOnlyActiveDate,rt),e[26]=q,e[27]=rt,e[28]=i.showOnlyActiveDate,e[29]=l,e[30]=He):He=e[30];const Ue=He,at=m?.graphContainer,nt=u?.graphContainer;let ue;e[31]!==m?.description||e[32]!==m?.title||e[33]!==r||e[34]!==se||e[35]!==x||e[36]!==y||e[37]!==P||e[38]!==u?.description||e[39]!==u?.title||e[40]!==h?(ue=P||x||y||se?o.jsxRuntimeExports.jsx(Rt.GraphHeader,{styles:{title:u?.title,description:u?.description},classNames:{title:m?.title,description:m?.description},graphTitle:P,graphDescription:x,width:h,graphDownload:y?lt:void 0,dataDownload:se?r.map(At).filter(Vt).length>0?r.map(Bt).filter(Lt):r.filter(It):null}):null,e[31]=m?.description,e[32]=m?.title,e[33]=r,e[34]=se,e[35]=x,e[36]=y,e[37]=P,e[38]=u?.description,e[39]=u?.title,e[40]=h,e[41]=ue):ue=e[41];let de;e[42]!==q||e[43]!==Ue||e[44]!==O||e[45]!==i.enabled||e[46]!==l?(de=i.enabled&&l.length>0&&Ue?o.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[o.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{ht(!O)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":O?"Click to pause animation":"Click to play animation",children:O?o.jsxRuntimeExports.jsx(st.Pause,{}):o.jsxRuntimeExports.jsx(st.Play,{})}),o.jsxRuntimeExports.jsx(ut.Nr,{min:l[0],max:l[l.length-1],marks:Ue,step:null,defaultValue:l[l.length-1],value:l[q],onChangeComplete:d=>{tt(l.indexOf(d))},onChange:d=>{tt(l.indexOf(d))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,e[42]=q,e[43]=Ue,e[44]=O,e[45]=i.enabled,e[46]=l,e[47]=de):de=e[47];let me;e[48]!==_e||e[49]!==K||e[50]!==m||e[51]!==L||e[52]!==he||e[53]!==Y||e[54]!==j||e[55]!==et||e[56]!==r||e[57]!==re||e[58]!==Qe||e[59]!==p||e[60]!==b||e[61]!==q||e[62]!==f||e[63]!==t||e[64]!==Se||e[65]!==S||e[66]!==T||e[67]!==ce||e[68]!==G||e[69]!==N||e[70]!==be||e[71]!==ve||e[72]!==Re||e[73]!==v||e[74]!==Ze||e[75]!==ke||e[76]!==V||e[77]!==n||e[78]!==ie||e[79]!==u||e[80]!==Ne||e[81]!==H||e[82]!==le||e[83]!==i.dateFormat||e[84]!==i.enabled||e[85]!==ye||e[86]!==l||e[87]!==h||e[88]!==Je||e[89]!==s||e[90]!==E?(me=o.jsxRuntimeExports.jsx(dt.GraphArea,{ref:ot,children:H&&Ne&&ce?o.jsxRuntimeExports.jsx(Ot,{data:r.filter(d=>i.enabled?d.date===ct.format(new Date(l[q]),i.dateFormat||"yyyy"):d),mapData:V?ce:{...ce,features:ce.features.filter(zt)},colorDomain:r.filter(_t).length===0?[]:he||Nt.uniqBy(r,"color",!0),width:H,height:Ne,scale:ke,centerPoint:K,colors:r.filter(Pt).length===0?j?[j]:[$.Colors.primaryColors["blue-600"]]:j||$.Colors[le].categoricalColors.colors,colorLegendTitle:Y,radius:Re,mapBorderWidth:Se,mapNoDataColor:S,mapBorderColor:t,tooltip:ye,onSeriesMouseOver:ve,showLabels:ie,isWorldMap:f,showColorScale:n,zoomScaleExtend:s,zoomTranslateExtend:E,onSeriesMouseClick:be,highlightedDataPoints:b,resetSelectionOnDoubleClick:Ze,styles:u,classNames:m,zoomInteraction:Je,detailsOnClick:re,mapProjection:T||(f?"naturalEarth":"mercator"),animate:_e===!0?{duration:.5,once:!0,amount:.5}:_e||{duration:0,once:!0,amount:0},dimmedOpacity:Qe,customLayers:et,maxRadiusValue:St.checkIfNullOrUndefined(G)?Math.max(...r.map($t).filter(Mt)):G,collapseColorScaleByDefault:L}):o.jsxRuntimeExports.jsx("div",{style:{height:`${Math.max(N,p||(v?N?(h||H)*v>N?(h||H)*v:N:(h||H)*v:Ne))}px`},className:"flex items-center justify-center",children:o.jsxRuntimeExports.jsx(ft.w,{"aria-label":"Loading graph"})})}),e[48]=_e,e[49]=K,e[50]=m,e[51]=L,e[52]=he,e[53]=Y,e[54]=j,e[55]=et,e[56]=r,e[57]=re,e[58]=Qe,e[59]=p,e[60]=b,e[61]=q,e[62]=f,e[63]=t,e[64]=Se,e[65]=S,e[66]=T,e[67]=ce,e[68]=G,e[69]=N,e[70]=be,e[71]=ve,e[72]=Re,e[73]=v,e[74]=Ze,e[75]=ke,e[76]=V,e[77]=n,e[78]=ie,e[79]=u,e[80]=Ne,e[81]=H,e[82]=le,e[83]=i.dateFormat,e[84]=i.enabled,e[85]=ye,e[86]=l,e[87]=h,e[88]=Je,e[89]=s,e[90]=E,e[91]=me):me=e[91];let pe;e[92]!==m?.footnote||e[93]!==m?.source||e[94]!==ne||e[95]!==k||e[96]!==u?.footnote||e[97]!==u?.source||e[98]!==h?(pe=k||ne?o.jsxRuntimeExports.jsx(Ct.GraphFooter,{styles:{footnote:u?.footnote,source:u?.source},classNames:{footnote:m?.footnote,source:m?.source},sources:k,footNote:ne,width:h}):null,e[92]=m?.footnote,e[93]=m?.source,e[94]=ne,e[95]=k,e[96]=u?.footnote,e[97]=u?.source,e[98]=h,e[99]=pe):pe=e[99];let Xe;return e[100]!==W||e[101]!==B||e[102]!==ee||e[103]!==p||e[104]!==Ke||e[105]!==N||e[106]!==Z||e[107]!==v||e[108]!==at||e[109]!==nt||e[110]!==ue||e[111]!==de||e[112]!==me||e[113]!==pe||e[114]!==le||e[115]!==h?(Xe=o.jsxRuntimeExports.jsxs(dt.GraphContainer,{className:at,style:nt,id:ee,ref:lt,"aria-label":W,backgroundColor:B,theme:le,language:Ke,minHeight:N,width:h,height:p,relativeHeight:v,padding:Z,children:[ue,de,me,pe]}),e[100]=W,e[101]=B,e[102]=ee,e[103]=p,e[104]=Ke,e[105]=N,e[106]=Z,e[107]=v,e[108]=at,e[109]=nt,e[110]=ue,e[111]=de,e[112]=me,e[113]=pe,e[114]=le,e[115]=h,e[116]=Xe):Xe=e[116],Xe}function Mt(a){return a!=null}function $t(a){return a.radius}function Pt(a){return a.color}function _t(a){return a.color}function zt(a){return a.properties.NAME!=="Antarctica"}function It(a){return a!==void 0}function Lt(a){return a!==void 0}function Bt(a){return a.data}function Vt(a){return a!==void 0}function At(a){return a.data}function Ft(a,e){return a-e}function Wt(a){return a.date}exports.DotDensityMap=qt;
|
|
2
2
|
//# sourceMappingURL=DotDensityMap.cjs.map
|