@undp/data-viz 1.4.15 → 1.5.0
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 +4 -4
- package/dist/BarGraph.cjs +1 -1
- package/dist/BarGraph.js +8 -8
- package/dist/BeeSwarmChart.cjs +1 -1
- package/dist/BeeSwarmChart.js +5 -5
- package/dist/BiVariateChoroplethMap.cjs +1 -1
- package/dist/BiVariateChoroplethMap.cjs.map +1 -1
- package/dist/BiVariateChoroplethMap.js +35 -34
- package/dist/BiVariateChoroplethMap.js.map +1 -1
- package/dist/BulletChart.cjs +1 -1
- package/dist/BulletChart.js +5 -5
- package/dist/ButterflyChart.cjs +1 -1
- package/dist/ButterflyChart.js +5 -5
- package/dist/ChoroplethMap.cjs +1 -1
- package/dist/ChoroplethMap.cjs.map +1 -1
- package/dist/ChoroplethMap.js +52 -51
- package/dist/ChoroplethMap.js.map +1 -1
- package/dist/CirclePackingGraph.cjs +1 -1
- package/dist/CirclePackingGraph.js +3 -3
- package/dist/DataCards.cjs +1 -1
- package/dist/DataCards.js +5 -5
- package/dist/DataTable.cjs +1 -1
- package/dist/DataTable.js +3 -3
- package/dist/DifferenceLineChart.cjs +1 -1
- package/dist/DifferenceLineChart.js +3 -3
- package/dist/DonutChart.cjs +1 -1
- package/dist/DonutChart.js +4 -4
- package/dist/DotDensityMap.cjs +1 -1
- package/dist/DotDensityMap.cjs.map +1 -1
- package/dist/DotDensityMap.js +39 -38
- package/dist/DotDensityMap.js.map +1 -1
- package/dist/DualAxisLineChart.cjs +1 -1
- package/dist/DualAxisLineChart.js +3 -3
- package/dist/DumbbellChart.cjs +1 -1
- package/dist/DumbbellChart.js +6 -6
- package/dist/GeoHubCompareMaps.cjs +1 -1
- package/dist/GeoHubCompareMaps.js +1 -1
- package/dist/GeoHubMap.cjs +1 -1
- package/dist/GeoHubMap.js +3 -3
- package/dist/GeoHubMapWithLayerSelection.cjs +1 -1
- package/dist/GeoHubMapWithLayerSelection.js +4 -4
- package/dist/{GraphEl-Bz2jatkM.cjs → GraphEl-4RUlclvW.cjs} +2 -2
- package/dist/{GraphEl-Bz2jatkM.cjs.map → GraphEl-4RUlclvW.cjs.map} +1 -1
- package/dist/{GraphEl-zNOHBYrK.js → GraphEl-ClIxlWa3.js} +2 -2
- package/dist/{GraphEl-zNOHBYrK.js.map → GraphEl-ClIxlWa3.js.map} +1 -1
- package/dist/GriddedGraphs.cjs +1 -1
- package/dist/GriddedGraphs.d.ts +58 -1
- package/dist/GriddedGraphs.js +7 -7
- package/dist/GriddedGraphsFromConfig.cjs +1 -1
- package/dist/GriddedGraphsFromConfig.d.ts +58 -1
- package/dist/GriddedGraphsFromConfig.js +1 -1
- package/dist/HeatMap.cjs +1 -1
- package/dist/HeatMap.js +4 -4
- package/dist/Histogram.cjs +1 -1
- package/dist/Histogram.js +1 -1
- package/dist/LineChartWithConfidenceInterval.cjs +1 -1
- package/dist/LineChartWithConfidenceInterval.js +3 -3
- package/dist/MultiGraphDashboard.cjs +1 -1
- package/dist/MultiGraphDashboard.d.ts +58 -1
- package/dist/MultiGraphDashboard.js +5 -5
- package/dist/MultiGraphDashboardFromConfig.cjs +1 -1
- package/dist/MultiGraphDashboardFromConfig.d.ts +58 -1
- package/dist/MultiGraphDashboardFromConfig.js +1 -1
- package/dist/MultiGraphDashboardWideToLongFormat.cjs +1 -1
- package/dist/MultiGraphDashboardWideToLongFormat.js +2 -2
- package/dist/MultiGraphDashboardWideToLongFormatFromConfig.cjs +1 -1
- package/dist/MultiGraphDashboardWideToLongFormatFromConfig.js +1 -1
- package/dist/MultiLineAltChart.cjs +1 -1
- package/dist/MultiLineAltChart.js +4 -4
- package/dist/MultiLineChart.cjs +1 -1
- package/dist/MultiLineChart.js +3 -3
- package/dist/ParetoChart.cjs +1 -1
- package/dist/ParetoChart.js +3 -3
- package/dist/PerformanceIntensiveMultiGraphDashboard.cjs +1 -1
- package/dist/PerformanceIntensiveMultiGraphDashboard.d.ts +58 -1
- package/dist/PerformanceIntensiveMultiGraphDashboard.js +5 -5
- package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.cjs +1 -1
- package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.d.ts +58 -1
- package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.js +1 -1
- package/dist/PerformanceIntensiveScrollStory.d.ts +58 -1
- package/dist/RadarChart.cjs +1 -1
- package/dist/RadarChart.js +4 -4
- package/dist/SankeyChart.cjs +1 -1
- package/dist/SankeyChart.js +6 -6
- package/dist/ScatterPlot.cjs +1 -1
- package/dist/ScatterPlot.cjs.map +1 -1
- package/dist/ScatterPlot.js +31 -29
- package/dist/ScatterPlot.js.map +1 -1
- package/dist/ScrollStory.d.ts +58 -1
- package/dist/SimpleLineChart.cjs +1 -1
- package/dist/SimpleLineChart.js +3 -3
- package/dist/SingleGraphDashboard.cjs +1 -1
- package/dist/SingleGraphDashboard.d.ts +58 -1
- package/dist/SingleGraphDashboard.js +8 -8
- package/dist/SingleGraphDashboardFromConfig.cjs +1 -1
- package/dist/SingleGraphDashboardFromConfig.d.ts +58 -1
- package/dist/SingleGraphDashboardFromConfig.js +1 -1
- package/dist/SingleGraphDashboardGeoHubMaps.d.ts +58 -1
- package/dist/SingleGraphDashboardGeoHubMapsFromConfig.cjs +1 -1
- package/dist/SingleGraphDashboardGeoHubMapsFromConfig.d.ts +58 -1
- package/dist/SingleGraphDashboardGeoHubMapsFromConfig.js +1 -1
- package/dist/SingleGraphDashboardThreeDGraphs.cjs +1 -1
- package/dist/SingleGraphDashboardThreeDGraphs.cjs.map +1 -1
- package/dist/SingleGraphDashboardThreeDGraphs.d.ts +58 -1
- package/dist/SingleGraphDashboardThreeDGraphs.js +20 -19
- package/dist/SingleGraphDashboardThreeDGraphs.js.map +1 -1
- package/dist/SingleGraphDashboardThreeDGraphsFromConfig.cjs +1 -1
- package/dist/SingleGraphDashboardThreeDGraphsFromConfig.d.ts +58 -1
- package/dist/SingleGraphDashboardThreeDGraphsFromConfig.js +1 -1
- package/dist/SlopeChart.cjs +1 -1
- package/dist/SlopeChart.js +4 -4
- package/dist/SparkLine.cjs +1 -1
- package/dist/SparkLine.js +2 -2
- package/dist/StatCardFromData.cjs +1 -1
- package/dist/StatCardFromData.js +1 -1
- package/dist/StripChart.cjs +1 -1
- package/dist/StripChart.js +5 -5
- package/dist/ThreeDGlobe.cjs +1 -1
- package/dist/ThreeDGlobe.cjs.map +1 -1
- package/dist/ThreeDGlobe.d.ts +61 -6
- package/dist/ThreeDGlobe.js +385 -314
- package/dist/ThreeDGlobe.js.map +1 -1
- package/dist/{Tooltip-DyM5snqx.js → Tooltip-CVCGWyzw.js} +2 -2
- package/dist/{Tooltip-DyM5snqx.js.map → Tooltip-CVCGWyzw.js.map} +1 -1
- package/dist/{Tooltip-n8z5bfav.cjs → Tooltip-De16GWhY.cjs} +2 -2
- package/dist/{Tooltip-n8z5bfav.cjs.map → Tooltip-De16GWhY.cjs.map} +1 -1
- package/dist/TreeMapGraph.cjs +1 -1
- package/dist/TreeMapGraph.js +3 -3
- package/dist/Types.d.ts +58 -1
- package/dist/UnitChart.cjs +1 -1
- package/dist/UnitChart.js +1 -1
- package/dist/_commonjsHelpers-BH3jXuIh.cjs +2 -0
- package/dist/_commonjsHelpers-BH3jXuIh.cjs.map +1 -0
- package/dist/_commonjsHelpers-ByX85dGu.js +34 -0
- package/dist/_commonjsHelpers-ByX85dGu.js.map +1 -0
- package/dist/{ensureCompleteData-BBDZbDCE.js → ensureCompleteData-BALdOrsS.js} +2 -2
- package/dist/{ensureCompleteData-BBDZbDCE.js.map → ensureCompleteData-BALdOrsS.js.map} +1 -1
- package/dist/{ensureCompleteData-DqWQ2Zbi.cjs → ensureCompleteData-BU5Zlccy.cjs} +2 -2
- package/dist/{ensureCompleteData-DqWQ2Zbi.cjs.map → ensureCompleteData-BU5Zlccy.cjs.map} +1 -1
- package/dist/{fetchAndParseData-4gsYTy6_.js → fetchAndParseData-DBOl1Icl.js} +2 -2
- package/dist/{fetchAndParseData-4gsYTy6_.js.map → fetchAndParseData-DBOl1Icl.js.map} +1 -1
- package/dist/{fetchAndParseData-CQyVGCul.cjs → fetchAndParseData-Dcy7AS_0.cjs} +2 -2
- package/dist/{fetchAndParseData-CQyVGCul.cjs.map → fetchAndParseData-Dcy7AS_0.cjs.map} +1 -1
- package/dist/fetchAndParseData.cjs +1 -1
- package/dist/fetchAndParseData.js +1 -1
- package/dist/{filterData-B8ocT57s.js → filterData-9nEcQ-Jp.js} +3 -3
- package/dist/{filterData-B8ocT57s.js.map → filterData-9nEcQ-Jp.js.map} +1 -1
- package/dist/{filterData-DN6py7y_.cjs → filterData-BoYadk0l.cjs} +2 -2
- package/dist/{filterData-DN6py7y_.cjs.map → filterData-BoYadk0l.cjs.map} +1 -1
- package/dist/{getJenks-VhM3GIoC.js → getJenks-DW96UYNE.js} +2 -2
- package/dist/{getJenks-VhM3GIoC.js.map → getJenks-DW96UYNE.js.map} +1 -1
- package/dist/{getJenks-TWQvbuOz.cjs → getJenks-vofIZmeb.cjs} +2 -2
- package/dist/{getJenks-TWQvbuOz.cjs.map → getJenks-vofIZmeb.cjs.map} +1 -1
- package/dist/{getUniqValue-CHqgSss5.cjs → getUniqValue-CfuE_l9c.cjs} +2 -2
- package/dist/{getUniqValue-CHqgSss5.cjs.map → getUniqValue-CfuE_l9c.cjs.map} +1 -1
- package/dist/{getUniqValue-BtUENB2H.js → getUniqValue-CttuU_wn.js} +4 -4
- package/dist/{getUniqValue-BtUENB2H.js.map → getUniqValue-CttuU_wn.js.map} +1 -1
- package/dist/{index-CaAIPGZo.js → index-AqnpA7_O.js} +2 -2
- package/dist/{index-CaAIPGZo.js.map → index-AqnpA7_O.js.map} +1 -1
- package/dist/{index-CZbIGs8q.cjs → index-BJOeaYTk.cjs} +2 -2
- package/dist/{index-CZbIGs8q.cjs.map → index-BJOeaYTk.cjs.map} +1 -1
- package/dist/{index-Bc5VF70V.js → index-BMgDMxKJ.js} +6 -6
- package/dist/{index-Bc5VF70V.js.map → index-BMgDMxKJ.js.map} +1 -1
- package/dist/{index-B0rbzOoC.cjs → index-BS2TADPj.cjs} +2 -2
- package/dist/{index-B0rbzOoC.cjs.map → index-BS2TADPj.cjs.map} +1 -1
- package/dist/{index-DNj994Pv.cjs → index-BYzIB5V6.cjs} +2 -2
- package/dist/index-BYzIB5V6.cjs.map +1 -0
- package/dist/{index-27yTRcko.js → index-Bwrro8-q.js} +2 -2
- package/dist/{index-27yTRcko.js.map → index-Bwrro8-q.js.map} +1 -1
- package/dist/{index-BczVvEBZ.cjs → index-CQ3e6Ewi.cjs} +2 -2
- package/dist/{index-BczVvEBZ.cjs.map → index-CQ3e6Ewi.cjs.map} +1 -1
- package/dist/{index-C21TvELx.cjs → index-CSNtgibC.cjs} +2 -2
- package/dist/{index-C21TvELx.cjs.map → index-CSNtgibC.cjs.map} +1 -1
- package/dist/{index-D7ltPi18.js → index-CeVNqhMO.js} +2 -2
- package/dist/{index-D7ltPi18.js.map → index-CeVNqhMO.js.map} +1 -1
- package/dist/index-D05lK1Te.cjs +2 -0
- package/dist/index-D05lK1Te.cjs.map +1 -0
- package/dist/{index-Ds0uHjK9.cjs → index-D72cOtq7.cjs} +2 -2
- package/dist/{index-Ds0uHjK9.cjs.map → index-D72cOtq7.cjs.map} +1 -1
- package/dist/{index-Cdcfp4nk.js → index-DKCxu1Gh.js} +2 -2
- package/dist/index-DKCxu1Gh.js.map +1 -0
- package/dist/{index-BXns0-ng.cjs → index-DQA8q5sC.cjs} +2 -2
- package/dist/{index-BXns0-ng.cjs.map → index-DQA8q5sC.cjs.map} +1 -1
- package/dist/{index-BzeLQvXk.cjs → index-DYH8g9WA.cjs} +2 -2
- package/dist/{index-BzeLQvXk.cjs.map → index-DYH8g9WA.cjs.map} +1 -1
- package/dist/{index-BbNoLJ_w.cjs → index-Da2GUKrr.cjs} +2 -2
- package/dist/{index-BbNoLJ_w.cjs.map → index-Da2GUKrr.cjs.map} +1 -1
- package/dist/{index-BLizQDlg.js → index-DvVprvy6.js} +2 -2
- package/dist/{index-BLizQDlg.js.map → index-DvVprvy6.js.map} +1 -1
- package/dist/{index-UV9hjG_S.js → index-EArKRVKg.js} +2 -2
- package/dist/{index-UV9hjG_S.js.map → index-EArKRVKg.js.map} +1 -1
- package/dist/{index-C1rRk_50.js → index-V_JXij1_.js} +2 -2
- package/dist/{index-C1rRk_50.js.map → index-V_JXij1_.js.map} +1 -1
- package/dist/{index-DxagiOHo.js → index-fwdktvAS.js} +2 -2
- package/dist/{index-DxagiOHo.js.map → index-fwdktvAS.js.map} +1 -1
- package/dist/index-qfWCwobm.js +682 -0
- package/dist/index-qfWCwobm.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +63 -7
- package/dist/index.js +6 -6
- package/dist/{string2HTML-CWHGfz_d.js → string2HTML-oFCROsus.js} +2 -2
- package/dist/{string2HTML-CWHGfz_d.js.map → string2HTML-oFCROsus.js.map} +1 -1
- package/dist/{string2HTML-D2Avudmb.cjs → string2HTML-z7CwHXcx.cjs} +2 -2
- package/dist/{string2HTML-D2Avudmb.cjs.map → string2HTML-z7CwHXcx.cjs.map} +1 -1
- package/dist/transformData.cjs +1 -1
- package/dist/transformData.js +3 -3
- package/dist/{transformDataForAggregation-CdcwlnNe.js → transformDataForAggregation-1BYVFqvF.js} +4 -4
- package/dist/{transformDataForAggregation-CdcwlnNe.js.map → transformDataForAggregation-1BYVFqvF.js.map} +1 -1
- package/dist/{transformDataForAggregation-Du-Hei-W.cjs → transformDataForAggregation-BVxVu4yY.cjs} +2 -2
- package/dist/{transformDataForAggregation-Du-Hei-W.cjs.map → transformDataForAggregation-BVxVu4yY.cjs.map} +1 -1
- package/dist/{transformDataForGraphFromFile-BCjsizvb.js → transformDataForGraphFromFile-BC9Ha8hF.js} +3 -3
- package/dist/{transformDataForGraphFromFile-BCjsizvb.js.map → transformDataForGraphFromFile-BC9Ha8hF.js.map} +1 -1
- package/dist/{transformDataForGraphFromFile-B1A0AS-Z.cjs → transformDataForGraphFromFile-b41aNQYY.cjs} +2 -2
- package/dist/{transformDataForGraphFromFile-B1A0AS-Z.cjs.map → transformDataForGraphFromFile-b41aNQYY.cjs.map} +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +2 -2
- package/dist/zoom-Bsbhil-K.cjs +2 -0
- package/dist/zoom-Bsbhil-K.cjs.map +1 -0
- package/dist/zoom-DAu91HKr.js +1864 -0
- package/dist/zoom-DAu91HKr.js.map +1 -0
- package/package.json +2 -2
- package/dist/_commonjsHelpers-DKOUU3wS.cjs +0 -2
- package/dist/_commonjsHelpers-DKOUU3wS.cjs.map +0 -1
- package/dist/_commonjsHelpers-DaMA6jEr.js +0 -9
- package/dist/_commonjsHelpers-DaMA6jEr.js.map +0 -1
- package/dist/index-Cdcfp4nk.js.map +0 -1
- package/dist/index-DNj994Pv.cjs.map +0 -1
- package/dist/zoom-Lo7IAUfC.cjs +0 -2
- package/dist/zoom-Lo7IAUfC.cjs.map +0 -1
- package/dist/zoom-_lqdiGoI.js +0 -1983
- package/dist/zoom-_lqdiGoI.js.map +0 -1
package/dist/SlopeChart.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { j as o, m as j } from "./index-CHPV5EwG-BPSP-7Jg.js";
|
|
2
|
-
import { u as ri } from "./index-
|
|
2
|
+
import { u as ri } from "./index-AqnpA7_O.js";
|
|
3
3
|
import { useRef as ii, useState as I, useEffect as yi } from "react";
|
|
4
|
-
import { i as mi } from "./index-
|
|
4
|
+
import { i as mi } from "./index-Bwrro8-q.js";
|
|
5
5
|
import { X as xi } from "./Modal-DVVwpKhP.js";
|
|
6
|
-
import { T as fi } from "./Tooltip-
|
|
6
|
+
import { T as fi } from "./Tooltip-CVCGWyzw.js";
|
|
7
7
|
import { c as J } from "./checkIfNullOrUndefined-DmfiKkNw.js";
|
|
8
8
|
import { Colors as n } from "./Colors.js";
|
|
9
|
-
import { s as hi } from "./string2HTML-
|
|
9
|
+
import { s as hi } from "./string2HTML-oFCROsus.js";
|
|
10
10
|
import { A as ai } from "./Axis-Ddg-seDi.js";
|
|
11
11
|
import { A as ni } from "./AxisTitle-BmHLMRJZ.js";
|
|
12
12
|
import { a as gi } from "./linear-DUdu7l2G.js";
|
package/dist/SparkLine.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-CHPV5EwG-DDoeWRVt.cjs"),l=require("react"),B=require("./parse-hMnG_lRV.cjs"),K=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-CHPV5EwG-DDoeWRVt.cjs"),l=require("react"),B=require("./parse-hMnG_lRV.cjs"),K=require("./index-DYH8g9WA.cjs"),Q=require("./Tooltip-De16GWhY.cjs"),U=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),Z=require("./time-Byw_jYQ7.cjs"),_=require("./linear-BVckp9RD.cjs"),ee=require("./area-D3Qx7k7K.cjs"),z=require("./line-DHV4JwCR.cjs"),T=require("./step-BZ3C8QFW.cjs"),te=require("./select-Bnfk0lJx.cjs"),re=require("./init-DU0ybBc_.cjs"),se=require("./pointer-Dkq5NV1q.cjs"),ie=require("./GraphFooter.cjs"),oe=require("./GraphHeader.cjs"),ae=require("./Colors.cjs"),ne=require("./generateRandomString-B5zBiJzS.cjs");function le(F){const{data:y,width:c,height:E,lineColor:p,dateFormat:u,areaId:x,leftMargin:s,rightMargin:$,topMargin:L,bottomMargin:W,tooltip:w,onSeriesMouseOver:o,minValue:C,maxValue:k,curveType:v,styles:b,classNames:M,customLayers:m}=F,D=v==="linear"?z.curveLinear:v==="step"?T.curveStep:v==="stepAfter"?T.stepAfter:v==="stepBefore"?T.stepBefore:T.monotoneX,[h,O]=l.useState(void 0),[H,q]=l.useState(void 0),[S,j]=l.useState(void 0),a={top:L,bottom:W,left:s,right:$},A=l.useRef(null),r=K.sortBy(y.map(e=>({...e,date:B.parse(`${e.date}`,u,new Date)})),"date"),G=c-a.left-a.right,i=E-a.top-a.bottom,d=r[0].date,V=r[r.length-1].date,g=Math.min(...r.map(e=>e.y).filter(e=>e!=null))!==1/0?Math.min(...r.map(e=>e.y).filter(e=>e!=null))>0?0:Math.min(...r.map(e=>e.y).filter(e=>e!=null)):0,N=Math.max(...r.map(e=>e.y).filter(e=>e!=null))!==1/0?Math.max(...r.map(e=>e.y).filter(e=>e!=null)):0,n=Z.time().domain([d,V]).range([0,G]),R=_.linear().domain([U.checkIfNullOrUndefined(C)?g:C,U.checkIfNullOrUndefined(k)?N>0?N:0:k]).range([i,0]).nice(),f=ee.area().x(e=>n(e.date)).y1(e=>R(e.y)).y0(i).curve(D),I=z.line().x(e=>n(e.date)).y(e=>R(e.y)).curve(D);return l.useEffect(()=>{const e=Y=>{const X=r[re.bisectCenter(r.map(J=>J.date),n.invert(se.pointer(Y)[0]),0)];O(X||r[r.length-1]),o?.(X||r[r.length-1]),j(Y.clientY),q(Y.clientX)},P=()=>{O(void 0),o?.(void 0),q(void 0),j(void 0)};te.select(A.current).on("mousemove",e).on("mouseout",P),o?.(void 0)},[n,r,o]),t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs("svg",{width:`${c}px`,height:`${E}px`,viewBox:`0 0 ${c} ${E}`,direction:"ltr",children:[x?t.jsxRuntimeExports.jsxs("linearGradient",{id:x,x1:"0",x2:"0",y1:"0",y2:"1",children:[t.jsxRuntimeExports.jsx("stop",{style:{stopColor:p},stopOpacity:"0.1",offset:"0%"}),t.jsxRuntimeExports.jsx("stop",{style:{stopColor:p},stopOpacity:"0",offset:"100%"})]}):null,t.jsxRuntimeExports.jsxs("g",{transform:`translate(${a.left},${a.top})`,children:[m.filter(e=>e.position==="before").map(e=>e.layer),t.jsxRuntimeExports.jsxs("g",{children:[t.jsxRuntimeExports.jsx("text",{className:t.mo("xs:max-[360px]:hidden fill-primary-gray-700 dark:fill-primary-gray-300 text-[9px] md:text-[10px] lg:text-xs",M?.xAxis?.labels),y:i,x:n(r[r.length-1].date),style:{textAnchor:"end",...b?.xAxis?.labels},dy:"1em",children:B.format(r[r.length-1].date,u)}),t.jsxRuntimeExports.jsx("text",{y:i,x:n(r[0].date),style:{textAnchor:"start",...b?.xAxis?.labels},className:t.mo("xs:max-[360px]:hidden fill-primary-gray-700 dark:fill-primary-gray-300 text-[9px] md:text-[10px] lg:text-xs",M?.xAxis?.labels),dy:"1em",children:B.format(r[0].date,u)})]}),t.jsxRuntimeExports.jsxs("g",{children:[t.jsxRuntimeExports.jsx("path",{d:f(r)||"",style:{fill:`url(#${x})`,clipPath:"url(#clip)"}}),t.jsxRuntimeExports.jsx("path",{d:I(r)||"",style:{stroke:p,fill:"none",strokeWidth:2}}),h?t.jsxRuntimeExports.jsx("circle",{y1:0,cy:R(h.y),cx:n(h.date),r:5,style:{fill:p}}):null]}),m.filter(e=>e.position==="after").map(e=>e.layer),t.jsxRuntimeExports.jsx("rect",{ref:A,style:{fill:"none",pointerEvents:"all"},width:G,height:i})]})]}),h&&w&&H&&S?t.jsxRuntimeExports.jsx(Q.Tooltip,{data:h,body:w,xPos:H,yPos:S,backgroundStyle:b?.tooltip,className:M?.tooltip}):null]})}function ce(F){const{data:y,graphTitle:c,lineColor:E,sources:p,graphDescription:u,height:x,width:s,footNote:$,dateFormat:L="yyyy",area:W=!1,padding:w,backgroundColor:o,leftMargin:C=5,rightMargin:k=5,topMargin:v=10,bottomMargin:b=20,tooltip:M,relativeHeight:m,onSeriesMouseOver:D,graphID:h,minValue:O,maxValue:H,graphDownload:q=!1,dataDownload:S=!1,language:j="en",minHeight:a=0,theme:A="light",ariaLabel:r,curveType:G="curve",styles:i,classNames:d,customLayers:V=[]}=F,[g,N]=l.useState(0),[n,R]=l.useState(0),f=l.useRef(null),I=l.useRef(null);return l.useEffect(()=>{const e=new ResizeObserver(P=>{N(s||P[0].target.clientWidth||620),R(x||P[0].target.clientHeight||480)});return f.current&&(R(f.current.clientHeight||480),N(f.current.clientWidth||620),s||e.observe(f.current)),()=>e.disconnect()},[s,x]),t.jsxRuntimeExports.jsx("div",{className:`${A||"light"} flex ${s?"w-fit grow-0":"w-full grow"}`,dir:j==="he"||j==="ar"?"rtl":void 0,children:t.jsxRuntimeExports.jsx("div",{className:t.mo(`${o?o===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${j||"en"}`,s?"w-fit":"w-full",d?.graphContainer),style:{...i?.graphContainer||{},...o&&o!==!0?{backgroundColor:o}:{}},id:h,ref:I,"aria-label":r||`${c?`The graph shows ${c}. `:""}This is a line chart that show trends over time.${u?` ${u}`:""}`,children:t.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:o?w||"1rem":w||0},children:t.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[c||u||q||S?t.jsxRuntimeExports.jsx(oe.GraphHeader,{styles:{title:i?.title,description:i?.description},classNames:{title:d?.title,description:d?.description},graphTitle:c,graphDescription:u,width:s,graphDownload:q?I.current:void 0,dataDownload:S?y.map(e=>e.data).filter(e=>e!==void 0).length>0?y.map(e=>e.data).filter(e=>e!==void 0):y.filter(e=>e!==void 0):null}):null,t.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:f,"aria-label":"Graph area",children:(s||g)&&(x||n)?t.jsxRuntimeExports.jsx(le,{data:y,lineColor:E||ae.Colors.primaryColors["blue-600"],width:s||g,height:Math.max(a,x||(m?a?(s||g)*m>a?(s||g)*m:a:(s||g)*m:n)),dateFormat:L,areaId:W?ne.generateRandomString(8):void 0,leftMargin:C,rightMargin:k,topMargin:v,bottomMargin:b,tooltip:M,onSeriesMouseOver:D,minValue:O,maxValue:H,curveType:G,styles:i,classNames:d,customLayers:V}):null}),p||$?t.jsxRuntimeExports.jsx(ie.GraphFooter,{styles:{footnote:i?.footnote,source:i?.source},classNames:{footnote:d?.footnote,source:d?.source},sources:p,footNote:$,width:s}):null]})})})})}exports.SparkLine=ce;
|
|
2
2
|
//# sourceMappingURL=SparkLine.cjs.map
|
package/dist/SparkLine.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { j as r, m as V } from "./index-CHPV5EwG-BPSP-7Jg.js";
|
|
2
2
|
import { useState as S, useRef as X, useEffect as J } from "react";
|
|
3
3
|
import { p as Q, f as U } from "./parse-DlCRUFh_.js";
|
|
4
|
-
import { s as Z } from "./index-
|
|
5
|
-
import { T as _ } from "./Tooltip-
|
|
4
|
+
import { s as Z } from "./index-fwdktvAS.js";
|
|
5
|
+
import { T as _ } from "./Tooltip-CVCGWyzw.js";
|
|
6
6
|
import { c as q } from "./checkIfNullOrUndefined-DmfiKkNw.js";
|
|
7
7
|
import { t as ee } from "./time-BzJP5SPC.js";
|
|
8
8
|
import { a as te } from "./linear-DUdu7l2G.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-CHPV5EwG-DDoeWRVt.cjs"),y=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-CHPV5EwG-DDoeWRVt.cjs"),y=require("./index-CSNtgibC.cjs"),E=require("./Typography-k-kOjICQ.cjs"),R=require("./GraphFooter.cjs"),k=require("./GraphHeader.cjs"),m=require("./numberFormattingFunction-02t-wJta.cjs");function T(S){const{year:d,data:t,graphTitle:x,suffix:i="",sources:h,prefix:s="",graphDescription:c,footNote:f,padding:j,backgroundColor:g=!1,graphID:$,aggregationMethod:o="count",language:u="en",countOnly:p,theme:A="light",ariaLabel:G,textBackground:b=!1,headingFontSize:F="4.375rem",centerAlign:v=!1,verticalAlign:N="center",layout:w="primary",styles:n,classNames:a,precision:l=2}=S;return r.jsxRuntimeExports.jsx("div",{className:`${A||"light"} flex w-full`,dir:u==="he"||u==="ar"?"rtl":void 0,children:r.jsxRuntimeExports.jsx("div",{className:r.mo(`${g?g===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}flex flex-col w-full h-inherit ${u||"en"}`,a?.graphContainer),style:{...n?.graphContainer||{},...g&&g!==!0?{backgroundColor:g}:{}},id:$,"aria-label":G||`${x?`The graph shows ${x}. `:""}This is a statistic card.${c?` ${c}`:""}`,children:r.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:g?j||"1rem":j||0},children:w!=="secondary"?r.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-12 justify-between grow",children:[x||c?r.jsxRuntimeExports.jsx(k.GraphHeader,{styles:{title:n?.title,description:n?.description},classNames:{title:a?.title,description:a?.description},graphTitle:x,graphDescription:c}):null,r.jsxRuntimeExports.jsx("div",{className:`flex flex-col justify-between grow ${N==="top"?"justify-start":N==="bottom"?"justify-end":"justify-center"}`,children:r.jsxRuntimeExports.jsxs(E.h,{marginBottom:"base",className:`leading-none text-outline font-heading ${v?"text-center":u==="he"||u==="ar"?"text-right":"text-left"} ${b?"text-primary-black dark:text-primary-white":"transparent"}`,style:{fontSize:F,letterSpacing:"0.05rem"},children:[t.filter(e=>typeof e.value=="string").length>0||o==="count"?p&&p?.length!==0?t.filter(e=>p.indexOf(e.value)!==-1).length:t.length:o==="sum"?m.numberFormattingFunction(y.sum(t.map(e=>e.value)),"NA",l,s,i):o==="average"?m.numberFormattingFunction(parseFloat((y.sum(t.map(e=>e.value))/t.length).toFixed(2)),"NA",l,s,i):o==="max"?m.numberFormattingFunction(Math.max(...t.map(e=>e.value).filter(e=>e!==void 0)),"NA",l,s,i):m.numberFormattingFunction(Math.min(...t.map(e=>e.value).filter(e=>e!==void 0)),"NA",l,s,i)," ",d?r.jsxRuntimeExports.jsxs("span",{className:"text-lg font-normal mt-0 mb-4 text-primary-gray-550 dark:text-primary-gray-400",style:{marginLeft:"-8px",lineHeight:"1.09",textShadow:"none",WebkitTextStrokeWidth:0},children:["(",d,")"]}):null]})}),h||f?r.jsxRuntimeExports.jsx(R.GraphFooter,{styles:{footnote:n?.footnote,source:n?.source},classNames:{footnote:a?.footnote,source:a?.source},sources:h,footNote:f}):null]}):r.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-center",children:[r.jsxRuntimeExports.jsxs(E.h,{marginBottom:w==="secondary"?"none":"base",className:`leading-none text-outline font-heading ${v?"text-center":u==="he"||u==="ar"?"text-right":"text-left"} ${b?"text-primary-black dark:text-primary-white":"transparent"}`,style:{fontSize:F,letterSpacing:"0.05rem"},children:[t.filter(e=>typeof e.value=="string").length>0||o==="count"?p&&p?.length!==0?t.filter(e=>p.indexOf(e.value)!==-1).length:t.length:o==="sum"?m.numberFormattingFunction(y.sum(t.map(e=>e.value)),"NA",l,s,i):o==="average"?m.numberFormattingFunction(parseFloat((y.sum(t.map(e=>e.value))/t.length).toFixed(2)),"NA",l,s,i):o==="max"?m.numberFormattingFunction(Math.max(...t.map(e=>e.value).filter(e=>e!==void 0)),"NA",l,s,i):m.numberFormattingFunction(Math.min(...t.map(e=>e.value).filter(e=>e!==void 0)),"NA",l,s,i)," ",d?r.jsxRuntimeExports.jsxs("span",{className:"text-lg font-normal mt-0 mb-4 text-primary-gray-550 dark:text-primary-gray-400",style:{marginLeft:"-8px",lineHeight:"1.09",textShadow:"none",WebkitTextStrokeWidth:0},children:["(",d,")"]}):null]}),x||c?r.jsxRuntimeExports.jsx(k.GraphHeader,{styles:{title:n?.title,description:n?.description},classNames:{title:a?.title,description:a?.description},graphTitle:x,graphDescription:c}):null,h||f?r.jsxRuntimeExports.jsx(R.GraphFooter,{styles:{footnote:n?.footnote,source:n?.source},classNames:{footnote:a?.footnote,source:a?.source},sources:h,footNote:f}):null]})})})})}exports.StatCardFromData=T;
|
|
2
2
|
//# sourceMappingURL=StatCardFromData.cjs.map
|
package/dist/StatCardFromData.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { j as a, m as W } from "./index-CHPV5EwG-BPSP-7Jg.js";
|
|
2
|
-
import { s as y } from "./index-
|
|
2
|
+
import { s as y } from "./index-CeVNqhMO.js";
|
|
3
3
|
import { h as $ } from "./Typography-Ctgfl1J5.js";
|
|
4
4
|
import { GraphFooter as A } from "./GraphFooter.js";
|
|
5
5
|
import { GraphHeader as S } from "./GraphHeader.js";
|
package/dist/StripChart.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index-CHPV5EwG-DDoeWRVt.cjs"),ce=require("./index-CZbIGs8q.cjs"),p=require("react"),xe=require("./index-BXns0-ng.cjs"),de=require("./index-BzeLQvXk.cjs"),ge=require("./Modal-tXZlLE5s.cjs"),pe=require("./Tooltip-n8z5bfav.cjs"),J=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),ue=require("./numberFormattingFunction-02t-wJta.cjs"),c=require("./Colors.cjs"),fe=require("./string2HTML-D2Avudmb.cjs"),me=require("./linear-BVckp9RD.cjs"),ye=require("./use-in-view-sQJZ_xDO.cjs"),le=require("./proxy-BHRoeZgd.cjs"),ve=require("./index-BW8iNx7E.cjs"),je=require("./GraphFooter.cjs"),we=require("./GraphHeader.cjs"),Oe=require("./ColorLegendWithMouseOver.cjs"),Ce=require("./EmptyState-d8_8SxeW.cjs");function be(L,o){if(L<2)return[];const x=o/(L-1);return Array.from({length:L},(f,r)=>r*x)}function Ee(L){const{data:o,width:x,height:f,colors:r,colorDomain:a,radius:u,leftMargin:s,rightMargin:P,topMargin:W,bottomMargin:ee,tooltip:U,onSeriesMouseOver:k,highlightedDataPoints:l,selectedColor:z,minValue:G,maxValue:X,onSeriesMouseClick:D,prefix:K,suffix:C,stripType:Q,highlightColor:v,dotOpacity:j,resetSelectionOnDoubleClick:te,detailsOnClick:N,styles:E,classNames:I,valueColor:V,animate:m,noOfTicks:w,dimmedOpacity:$,precision:B,customLayers:M}=L,Y=p.useRef(null),R=ye.useInView(Y,{once:m.once,amount:m.amount}),[T,y]=p.useState(void 0),[d,H]=p.useState(void 0),[_,q]=p.useState(void 0),[g,h]=p.useState(void 0),O={top:W,bottom:ee,left:s,right:P},S=x-O.left-O.right,A=f-O.top-O.bottom,ie=o.map((e,t)=>({...e,id:`${t}`})),oe=de.sortBy(ie,e=>{const t=(l||[]).indexOf(e.label);return t===-1?1/0:t}).reverse(),re=J.checkIfNullOrUndefined(X)?Math.max(...o.filter(e=>!J.checkIfNullOrUndefined(e.position)).map(e=>e.position))<0?0:Math.max(...o.filter(e=>!J.checkIfNullOrUndefined(e.position)).map(e=>e.position)):X,b=J.checkIfNullOrUndefined(G)?Math.min(...o.filter(e=>!J.checkIfNullOrUndefined(e.position)).map(e=>e.position))>=0?0:Math.min(...o.filter(e=>!J.checkIfNullOrUndefined(e.position)).map(e=>e.position)):G,F=me.linear().domain([b,re]).range([0,S]).nice(),ne=be(w,S);return i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[i.jsxRuntimeExports.jsx(le.motion.svg,{width:`${x}px`,height:`${f}px`,viewBox:`0 0 ${x} ${f}`,direction:"ltr",ref:Y,children:i.jsxRuntimeExports.jsxs("g",{transform:`translate(${O.left},${O.top})`,children:[M.filter(e=>e.position==="before").map(e=>e.layer),i.jsxRuntimeExports.jsxs(ve.AnimatePresence,{children:[oe.map(e=>i.jsxRuntimeExports.jsxs(le.motion.g,{className:"undp-viz-g-with-hover",variants:{initial:{opacity:0,x:F(0),y:A/2},whileInView:{x:F(e.position),y:A/2,opacity:z?e.color&&r[a.indexOf(e.color)]===z?.95:$:l.length!==0?l.indexOf(e.label)!==-1?.95:$:j,transition:{duration:m.duration}}},initial:"initial",animate:R?"whileInView":"initial",exit:{opacity:0,transition:{duration:m.duration}},onMouseEnter:t=>{y(e),h(t.clientY),q(t.clientX),k?.(e)},onClick:()=>{(D||N)&&(xe.isEqual(d,e)&&te?(H(void 0),D?.(void 0)):(H(e),D?.(e)))},onMouseMove:t=>{y(e),h(t.clientY),q(t.clientX)},onMouseLeave:()=>{y(void 0),q(void 0),h(void 0),k?.(void 0)},children:[Q==="dot"?i.jsxRuntimeExports.jsx(le.motion.circle,{cy:0,cx:0,variants:{initial:{fill:v&&l?l.indexOf(e.label)!==-1?v:o.filter(t=>t.color).length===0?r[0]:e.color?r[a.indexOf(e.color)]:c.Colors.gray:o.filter(t=>t.color).length===0?r[0]:e.color?r[a.indexOf(e.color)]:c.Colors.gray},whileInView:{fill:v&&l?l.indexOf(e.label)!==-1?v:o.filter(t=>t.color).length===0?r[0]:e.color?r[a.indexOf(e.color)]:c.Colors.gray:o.filter(t=>t.color).length===0?r[0]:e.color?r[a.indexOf(e.color)]:c.Colors.gray,transition:{duration:m.duration}}},initial:"initial",animate:R?"whileInView":"initial",exit:{opacity:0,transition:{duration:m.duration}},r:u}):i.jsxRuntimeExports.jsx(le.motion.rect,{y:0-u,x:-1,height:u*2,width:2,variants:{initial:{fill:v&&l?l.indexOf(e.label)!==-1?v:o.filter(t=>t.color).length===0?r[0]:e.color?r[a.indexOf(e.color)]:c.Colors.gray:o.filter(t=>t.color).length===0?r[0]:e.color?r[a.indexOf(e.color)]:c.Colors.gray},whileInView:{fill:v&&l?l.indexOf(e.label)!==-1?v:o.filter(t=>t.color).length===0?r[0]:e.color?r[a.indexOf(e.color)]:c.Colors.gray:o.filter(t=>t.color).length===0?r[0]:e.color?r[a.indexOf(e.color)]:c.Colors.gray,transition:{duration:m.duration}}},initial:"initial",animate:R?"whileInView":"initial",exit:{opacity:0,transition:{duration:m.duration}}}),l.length!==0&&l.indexOf(e.label)!==-1?i.jsxRuntimeExports.jsx(le.motion.text,{x:0,y:0-u-5,variants:{initial:{opacity:0},whileInView:{opacity:1,transition:{duration:m.duration}}},initial:"initial",animate:R?"whileInView":"initial",exit:{opacity:0,transition:{duration:m.duration}},style:{fill:V||(v&&l?l.indexOf(e.label)!==-1?v:o.filter(t=>t.color).length===0?r[0]:e.color?r[a.indexOf(e.color)]:c.Colors.gray:o.filter(t=>t.color).length===0?r[0]:e.color?r[a.indexOf(e.color)]:c.Colors.gray),textAnchor:"middle",...E?.graphObjectValues||{}},className:i.mo("graph-value text-sm font-bold",I?.graphObjectValues),children:ue.numberFormattingFunction(e.position,"NA",B,K,C)}):null]},e.label)),ne.map((e,t)=>i.jsxRuntimeExports.jsx("text",{x:e,y:A/2+u,style:{textAnchor:t===0?"start":t===ne.length-1?"end":"middle",...E?.xAxis?.labels||{}},className:i.mo("fill-primary-gray-550 dark:fill-primary-gray-500 text-xs",I?.xAxis?.labels),dy:"1em",children:ue.numberFormattingFunction(F.invert(e),"NA",B,K,C)},t))]}),M.filter(e=>e.position==="after").map(e=>e.layer)]})}),T&&U&&_&&g?i.jsxRuntimeExports.jsx(pe.Tooltip,{data:T,body:U,xPos:_,yPos:g,backgroundStyle:E?.tooltip,className:I?.tooltip}):null,N&&d!==void 0?i.jsxRuntimeExports.jsx(ge.X,{open:d!==void 0,onClose:()=>{H(void 0)},children:i.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof N=="string"?{__html:fe.string2HTML(N,d)}:void 0,children:typeof N=="function"?N(d):null})}):null]})}function Me(L){const{data:o,graphTitle:x,colors:f,sources:r,graphDescription:a,height:u,width:s,footNote:P,colorDomain:W,colorLegendTitle:ee,radius:U=5,padding:k,backgroundColor:l=!1,leftMargin:z=5,rightMargin:G=5,topMargin:X=10,bottomMargin:D=10,tooltip:K,relativeHeight:C,onSeriesMouseOver:Q,showColorScale:v=!0,highlightedDataPoints:j=[],graphID:te,minValue:N,maxValue:E,onSeriesMouseClick:I,graphDownload:V=!1,dataDownload:m=!1,prefix:w="",suffix:$="",stripType:B="dot",language:M="en",highlightColor:Y,dotOpacity:R=.3,showNAColor:T=!0,minHeight:y=0,theme:d="light",ariaLabel:H,resetSelectionOnDoubleClick:_=!0,detailsOnClick:q,styles:g,classNames:h,valueColor:O,animate:S=!1,noOfTicks:A=2,dimmedOpacity:ie=.3,precision:oe=2,customLayers:re=[]}=L,[b,F]=p.useState(0),[ne,e]=p.useState(0),[t,he]=p.useState(void 0),Z=p.useRef(null),ae=p.useRef(null);return p.useEffect(()=>{const n=new ResizeObserver(se=>{F(s||se[0].target.clientWidth||620),e(u||se[0].target.clientHeight||480)});return Z.current&&(e(Z.current.clientHeight||480),F(Z.current.clientWidth||620),s||n.observe(Z.current)),()=>n.disconnect()},[s,u]),i.jsxRuntimeExports.jsx("div",{className:`${d||"light"} flex ${s?"w-fit grow-0":"w-full grow"}`,dir:M==="he"||M==="ar"?"rtl":void 0,children:i.jsxRuntimeExports.jsx("div",{className:i.mo(`${l?l===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${M||"en"}`,s?"w-fit":"w-full",h?.graphContainer),style:{...g?.graphContainer||{},...l&&l!==!0?{backgroundColor:l}:{}},id:te,ref:ae,"aria-label":H||`${x?`The graph shows ${x}. `:""}This is a strip chart showing distribution of data along the horizontal axis. Each dot represents an individual data point, helping to visualize the spread and clustering of values.${a?` ${a}`:""}`,children:i.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:l?k||"1rem":k||0},children:i.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[x||a||V||m?i.jsxRuntimeExports.jsx(we.GraphHeader,{styles:{title:g?.title,description:g?.description},classNames:{title:h?.title,description:h?.description},graphTitle:x,graphDescription:a,width:s,graphDownload:V?ae.current:void 0,dataDownload:m?o.map(n=>n.data).filter(n=>n!==void 0).length>0?o.map(n=>n.data).filter(n=>n!==void 0):o.filter(n=>n!==void 0):null}):null,i.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:o.length===0?i.jsxRuntimeExports.jsx(Ce.EmptyState,{}):i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[v!==!1&&o.filter(n=>n.color).length!==0?i.jsxRuntimeExports.jsx(Oe.ColorLegendWithMouseOver,{width:s,colorLegendTitle:ee,colors:f||c.Colors[d].categoricalColors.colors,colorDomain:W||ce.uniqBy(o.filter(n=>n.color),"color").map(n=>n.color),setSelectedColor:he,showNAColor:T??!0}):null,i.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center w-full leading-0",ref:Z,"aria-label":"Graph area",children:(s||b)&&(u||ne)?i.jsxRuntimeExports.jsx(Ee,{data:o,width:s||b,height:Math.max(y,u||(C?y?(s||b)*C>y?(s||b)*C:y:(s||b)*C:ne)),colorDomain:o.filter(n=>n.color).length===0?[]:W||ce.uniqBy(o.filter(n=>n.color),"color").map(n=>n.color),colors:o.filter(n=>n.color).length===0?f?[f]:[c.Colors.primaryColors["blue-600"]]:f||c.Colors[d].categoricalColors.colors,selectedColor:t,radius:U,leftMargin:z,rightMargin:G,topMargin:X,bottomMargin:D,tooltip:K,onSeriesMouseOver:Q,highlightedDataPoints:j,minValue:N,maxValue:E,onSeriesMouseClick:I,prefix:w,suffix:$,stripType:B,highlightColor:Y,dotOpacity:R,resetSelectionOnDoubleClick:_,detailsOnClick:q,styles:g,classNames:h,valueColor:O,animate:S===!0?{duration:.5,once:!0,amount:.5}:S||{duration:0,once:!0,amount:0},noOfTicks:A,dimmedOpacity:ie,precision:oe,customLayers:re}):null})]})}),r||P?i.jsxRuntimeExports.jsx(je.GraphFooter,{styles:{footnote:g?.footnote,source:g?.source},classNames:{footnote:h?.footnote,source:h?.source},sources:r,footNote:P,width:s}):null]})})})})}function Re(L){const{data:o,width:x,height:f,colors:r,colorDomain:a,radius:u,leftMargin:s,rightMargin:P,topMargin:W,bottomMargin:ee,tooltip:U,onSeriesMouseOver:k,highlightedDataPoints:l,selectedColor:z,minValue:G,maxValue:X,onSeriesMouseClick:D,noOfTicks:K,prefix:C,suffix:Q,stripType:v,highlightColor:j,dotOpacity:te,resetSelectionOnDoubleClick:N,detailsOnClick:E,styles:I,classNames:V,valueColor:m,animate:w,dimmedOpacity:$,precision:B,customLayers:M}=L,Y=p.useRef(null),R=ye.useInView(Y,{once:w.once,amount:w.amount}),[T,y]=p.useState(void 0),[d,H]=p.useState(void 0),[_,q]=p.useState(void 0),[g,h]=p.useState(void 0),O={top:W,bottom:ee,left:s,right:P},S=x-O.left-O.right,A=f-O.top-O.bottom,ie=o.map((e,t)=>({...e,id:`${t}`})),oe=de.sortBy(ie,e=>{const t=(l||[]).indexOf(e.label);return t===-1?1/0:t}).reverse(),re=J.checkIfNullOrUndefined(X)?Math.max(...o.filter(e=>!J.checkIfNullOrUndefined(e.position)).map(e=>e.position))<0?0:Math.max(...o.filter(e=>!J.checkIfNullOrUndefined(e.position)).map(e=>e.position)):X,b=J.checkIfNullOrUndefined(G)?Math.min(...o.filter(e=>!J.checkIfNullOrUndefined(e.position)).map(e=>e.position))>=0?0:Math.min(...o.filter(e=>!J.checkIfNullOrUndefined(e.position)).map(e=>e.position)):G,F=me.linear().domain([b,re]).range([A,0]).nice(),ne=be(K,A);return i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[i.jsxRuntimeExports.jsx(le.motion.svg,{width:`${x}px`,height:`${f}px`,viewBox:`0 0 ${x} ${f}`,direction:"ltr",ref:Y,children:i.jsxRuntimeExports.jsxs("g",{transform:`translate(${O.left},${O.top})`,children:[M.filter(e=>e.position==="before").map(e=>e.layer),i.jsxRuntimeExports.jsxs(ve.AnimatePresence,{children:[oe.map(e=>i.jsxRuntimeExports.jsxs(le.motion.g,{className:"undp-viz-g-with-hover",variants:{initial:{opacity:0,x:S/2,y:F(0)},whileInView:{x:S/2,y:F(e.position),opacity:z?e.color&&r[a.indexOf(e.color)]===z?.95:$:l.length!==0?l.indexOf(e.label)!==-1?.95:$:te,transition:{duration:w.duration}}},initial:"initial",animate:R?"whileInView":"initial",exit:{opacity:0,transition:{duration:w.duration}},onMouseEnter:t=>{y(e),h(t.clientY),q(t.clientX),k?.(e)},onClick:()=>{(D||E)&&(xe.isEqual(d,e)&&N?(H(void 0),D?.(void 0)):(H(e),D?.(e)))},onMouseMove:t=>{y(e),h(t.clientY),q(t.clientX)},onMouseLeave:()=>{y(void 0),q(void 0),h(void 0),k?.(void 0)},children:[v==="dot"?i.jsxRuntimeExports.jsx(le.motion.circle,{cy:0,cx:0,variants:{initial:{fill:j&&l?l.indexOf(e.label)!==-1?j:o.filter(t=>t.color).length===0?r[0]:e.color?r[a.indexOf(e.color)]:c.Colors.gray:o.filter(t=>t.color).length===0?r[0]:e.color?r[a.indexOf(e.color)]:c.Colors.gray},whileInView:{fill:j&&l?l.indexOf(e.label)!==-1?j:o.filter(t=>t.color).length===0?r[0]:e.color?r[a.indexOf(e.color)]:c.Colors.gray:o.filter(t=>t.color).length===0?r[0]:e.color?r[a.indexOf(e.color)]:c.Colors.gray,transition:{duration:w.duration}}},initial:"initial",animate:R?"whileInView":"initial",exit:{opacity:0,transition:{duration:w.duration}},r:u}):i.jsxRuntimeExports.jsx(le.motion.rect,{x:0-u,y:-1,width:u*2,height:2,variants:{initial:{fill:j&&l?l.indexOf(e.label)!==-1?j:o.filter(t=>t.color).length===0?r[0]:e.color?r[a.indexOf(e.color)]:c.Colors.gray:o.filter(t=>t.color).length===0?r[0]:e.color?r[a.indexOf(e.color)]:c.Colors.gray},whileInView:{fill:j&&l?l.indexOf(e.label)!==-1?j:o.filter(t=>t.color).length===0?r[0]:e.color?r[a.indexOf(e.color)]:c.Colors.gray:o.filter(t=>t.color).length===0?r[0]:e.color?r[a.indexOf(e.color)]:c.Colors.gray,transition:{duration:w.duration}}},initial:"initial",animate:R?"whileInView":"initial",exit:{opacity:0,transition:{duration:w.duration}}}),l.length!==0&&l.indexOf(e.label)!==-1?i.jsxRuntimeExports.jsx(le.motion.text,{y:0,dy:"0.33em",x:0+u+3,variants:{initial:{opacity:0},whileInView:{opacity:1,transition:{duration:w.duration}}},initial:"initial",animate:R?"whileInView":"initial",exit:{opacity:0,transition:{duration:w.duration}},style:{fill:m||(j&&l?l.indexOf(e.label)!==-1?j:o.filter(t=>t.color).length===0?r[0]:e.color?r[a.indexOf(e.color)]:c.Colors.gray:o.filter(t=>t.color).length===0?r[0]:e.color?r[a.indexOf(e.color)]:c.Colors.gray),textAnchor:"start",...I?.graphObjectValues||{}},className:i.mo("graph-value text-sm font-bold",V?.graphObjectValues),children:ue.numberFormattingFunction(e.position,"NA",B,C,Q)}):null]},e.label)),ne.map((e,t)=>i.jsxRuntimeExports.jsx("text",{y:e,x:S/2+u+5,style:{textAnchor:"start",...I?.yAxis?.labels||{}},className:i.mo("fill-primary-gray-550 dark:fill-primary-gray-500 text-xs",V?.yAxis?.labels),children:ue.numberFormattingFunction(F.invert(e),"NA",B,C,Q)},t))]}),M.filter(e=>e.position==="after").map(e=>e.layer)]})}),T&&U&&_&&g?i.jsxRuntimeExports.jsx(pe.Tooltip,{data:T,body:U,xPos:_,yPos:g,backgroundStyle:I?.tooltip,className:V?.tooltip}):null,E&&d!==void 0?i.jsxRuntimeExports.jsx(ge.X,{open:d!==void 0,onClose:()=>{H(void 0)},children:i.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof E=="string"?{__html:fe.string2HTML(E,d)}:void 0,children:typeof E=="function"?E(d):null})}):null]})}function Ne(L){const{data:o,graphTitle:x,colors:f,sources:r,graphDescription:a,height:u,width:s,footNote:P,colorDomain:W,colorLegendTitle:ee,radius:U=5,padding:k,backgroundColor:l=!1,leftMargin:z=20,rightMargin:G=20,topMargin:X=10,bottomMargin:D=10,tooltip:K,relativeHeight:C,onSeriesMouseOver:Q,showColorScale:v=!0,highlightedDataPoints:j=[],graphID:te,minValue:N,maxValue:E,onSeriesMouseClick:I,graphDownload:V=!1,dataDownload:m=!1,prefix:w="",suffix:$="",stripType:B="dot",language:M="en",highlightColor:Y,dotOpacity:R=.3,showNAColor:T=!0,minHeight:y=0,theme:d="light",ariaLabel:H,resetSelectionOnDoubleClick:_=!0,detailsOnClick:q,styles:g,classNames:h,valueColor:O,animate:S=!1,noOfTicks:A=2,dimmedOpacity:ie=.3,precision:oe=2,customLayers:re=[]}=L,[b,F]=p.useState(0),[ne,e]=p.useState(0),[t,he]=p.useState(void 0),Z=p.useRef(null),ae=p.useRef(null);return p.useEffect(()=>{const n=new ResizeObserver(se=>{F(s||se[0].target.clientWidth||620),e(u||se[0].target.clientHeight||480)});return Z.current&&(e(Z.current.clientHeight||480),F(Z.current.clientWidth||620),s||n.observe(Z.current)),()=>n.disconnect()},[s,u]),i.jsxRuntimeExports.jsx("div",{className:`${d||"light"} flex ${s?"w-fit grow-0":"w-full grow"}`,dir:M==="he"||M==="ar"?"rtl":void 0,children:i.jsxRuntimeExports.jsx("div",{className:i.mo(`${l?l===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${M||"en"}`,s?"w-fit":"w-full",h?.graphContainer),style:{...g?.graphContainer||{},...l&&l!==!0?{backgroundColor:l}:{}},id:te,ref:ae,"aria-label":H||`${x?`The graph shows ${x}. `:""}This is a strip chart showing distribution of data along the vertical axis. Each dot represents an individual data point, helping to visualize the spread and clustering of values.${a?` ${a}`:""}`,children:i.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:l?k||"1rem":k||0},children:i.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[x||a||V||m?i.jsxRuntimeExports.jsx(we.GraphHeader,{styles:{title:g?.title,description:g?.description},classNames:{title:h?.title,description:h?.description},graphTitle:x,graphDescription:a,width:s,graphDownload:V?ae.current:void 0,dataDownload:m?o.map(n=>n.data).filter(n=>n!==void 0).length>0?o.map(n=>n.data).filter(n=>n!==void 0):o.filter(n=>n!==void 0):null}):null,i.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:o.length===0?i.jsxRuntimeExports.jsx(Ce.EmptyState,{}):i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[v!==!1&&o.filter(n=>n.color).length!==0?i.jsxRuntimeExports.jsx(Oe.ColorLegendWithMouseOver,{width:s,colorLegendTitle:ee,colors:f||c.Colors[d].categoricalColors.colors,colorDomain:W||ce.uniqBy(o.filter(n=>n.color),"color").map(n=>n.color),setSelectedColor:he,showNAColor:T}):null,i.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center w-full leading-0",ref:Z,children:(s||b)&&(u||ne)?i.jsxRuntimeExports.jsx(Re,{data:o,width:s||b,height:Math.max(y,u||(C?y?(s||b)*C>y?(s||b)*C:y:(s||b)*C:ne)),colorDomain:o.filter(n=>n.color).length===0?[]:W||ce.uniqBy(o.filter(n=>n.color),"color").map(n=>n.color),colors:o.filter(n=>n.color).length===0?f?[f]:[c.Colors.primaryColors["blue-600"]]:f||c.Colors[d].categoricalColors.colors,selectedColor:t,radius:U,leftMargin:z,rightMargin:G,topMargin:X,bottomMargin:D,tooltip:K,onSeriesMouseOver:Q,highlightedDataPoints:j,minValue:N,maxValue:E,onSeriesMouseClick:I,prefix:w,suffix:$,stripType:B,highlightColor:Y,dotOpacity:R,resetSelectionOnDoubleClick:_,detailsOnClick:q,styles:g,classNames:h,valueColor:O,animate:S===!0?{duration:.5,once:!0,amount:.5}:S||{duration:0,once:!0,amount:0},noOfTicks:A,dimmedOpacity:ie,precision:oe,customLayers:re}):null})]})}),r||P?i.jsxRuntimeExports.jsx(je.GraphFooter,{styles:{footnote:g?.footnote,source:g?.source},classNames:{footnote:h?.footnote,source:h?.source},sources:r,footNote:P,width:s}):null]})})})})}function Se(L){const{data:o,graphTitle:x,colors:f,sources:r,graphDescription:a,height:u,width:s,footNote:P,colorDomain:W,colorLegendTitle:ee,radius:U,padding:k,backgroundColor:l,leftMargin:z,rightMargin:G,topMargin:X,bottomMargin:D,tooltip:K,relativeHeight:C,onSeriesMouseOver:Q,showColorScale:v,highlightedDataPoints:j,graphID:te,minValue:N,maxValue:E,onSeriesMouseClick:I,noOfTicks:V,graphDownload:m,dataDownload:w,prefix:$,suffix:B,stripType:M,language:Y,highlightColor:R,dotOpacity:T,showNAColor:y,minHeight:d,theme:H,ariaLabel:_,valueColor:q,resetSelectionOnDoubleClick:g,detailsOnClick:h,orientation:O="vertical",styles:S,classNames:A,animate:ie,dimmedOpacity:oe=.3,precision:re,customLayers:b}=L;return O==="vertical"?i.jsxRuntimeExports.jsx(Ne,{data:o,graphTitle:x,colors:f,sources:r,graphDescription:a,height:u,width:s,footNote:P,colorDomain:W,colorLegendTitle:ee,radius:U,padding:k,backgroundColor:l,leftMargin:z,rightMargin:G,topMargin:X,bottomMargin:D,tooltip:K,relativeHeight:C,onSeriesMouseOver:Q,showColorScale:v,highlightedDataPoints:j,graphID:te,minValue:N,maxValue:E,onSeriesMouseClick:I,noOfTicks:V,graphDownload:m,dataDownload:w,prefix:$,suffix:B,stripType:M,language:Y,highlightColor:R,dotOpacity:T,showNAColor:y,minHeight:d,theme:H,ariaLabel:_,resetSelectionOnDoubleClick:g,styles:S,valueColor:q,detailsOnClick:h,classNames:A,animate:ie,dimmedOpacity:oe,precision:re,customLayers:b}):i.jsxRuntimeExports.jsx(Me,{data:o,graphTitle:x,colors:f,sources:r,graphDescription:a,height:u,width:s,footNote:P,colorDomain:W,colorLegendTitle:ee,radius:U,padding:k,backgroundColor:l,leftMargin:z,rightMargin:G,topMargin:X,bottomMargin:D,tooltip:K,relativeHeight:C,onSeriesMouseOver:Q,showColorScale:v,highlightedDataPoints:j,graphID:te,minValue:N,maxValue:E,onSeriesMouseClick:I,noOfTicks:V,graphDownload:m,dataDownload:w,prefix:$,suffix:B,stripType:M,language:Y,highlightColor:R,dotOpacity:T,showNAColor:y,minHeight:d,theme:H,ariaLabel:_,resetSelectionOnDoubleClick:g,styles:S,valueColor:q,detailsOnClick:h,classNames:A,animate:ie,dimmedOpacity:oe,precision:re,customLayers:b})}exports.StripChart=Se;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index-CHPV5EwG-DDoeWRVt.cjs"),ce=require("./index-BJOeaYTk.cjs"),p=require("react"),xe=require("./index-DQA8q5sC.cjs"),de=require("./index-DYH8g9WA.cjs"),ge=require("./Modal-tXZlLE5s.cjs"),pe=require("./Tooltip-De16GWhY.cjs"),J=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),ue=require("./numberFormattingFunction-02t-wJta.cjs"),c=require("./Colors.cjs"),fe=require("./string2HTML-z7CwHXcx.cjs"),me=require("./linear-BVckp9RD.cjs"),ye=require("./use-in-view-sQJZ_xDO.cjs"),le=require("./proxy-BHRoeZgd.cjs"),ve=require("./index-BW8iNx7E.cjs"),je=require("./GraphFooter.cjs"),we=require("./GraphHeader.cjs"),Oe=require("./ColorLegendWithMouseOver.cjs"),Ce=require("./EmptyState-d8_8SxeW.cjs");function be(L,o){if(L<2)return[];const x=o/(L-1);return Array.from({length:L},(f,r)=>r*x)}function Ee(L){const{data:o,width:x,height:f,colors:r,colorDomain:a,radius:u,leftMargin:s,rightMargin:P,topMargin:W,bottomMargin:ee,tooltip:U,onSeriesMouseOver:k,highlightedDataPoints:l,selectedColor:z,minValue:G,maxValue:X,onSeriesMouseClick:D,prefix:K,suffix:C,stripType:Q,highlightColor:v,dotOpacity:j,resetSelectionOnDoubleClick:te,detailsOnClick:N,styles:E,classNames:I,valueColor:V,animate:m,noOfTicks:w,dimmedOpacity:$,precision:B,customLayers:M}=L,Y=p.useRef(null),R=ye.useInView(Y,{once:m.once,amount:m.amount}),[T,y]=p.useState(void 0),[d,H]=p.useState(void 0),[_,q]=p.useState(void 0),[g,h]=p.useState(void 0),O={top:W,bottom:ee,left:s,right:P},S=x-O.left-O.right,A=f-O.top-O.bottom,ie=o.map((e,t)=>({...e,id:`${t}`})),oe=de.sortBy(ie,e=>{const t=(l||[]).indexOf(e.label);return t===-1?1/0:t}).reverse(),re=J.checkIfNullOrUndefined(X)?Math.max(...o.filter(e=>!J.checkIfNullOrUndefined(e.position)).map(e=>e.position))<0?0:Math.max(...o.filter(e=>!J.checkIfNullOrUndefined(e.position)).map(e=>e.position)):X,b=J.checkIfNullOrUndefined(G)?Math.min(...o.filter(e=>!J.checkIfNullOrUndefined(e.position)).map(e=>e.position))>=0?0:Math.min(...o.filter(e=>!J.checkIfNullOrUndefined(e.position)).map(e=>e.position)):G,F=me.linear().domain([b,re]).range([0,S]).nice(),ne=be(w,S);return i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[i.jsxRuntimeExports.jsx(le.motion.svg,{width:`${x}px`,height:`${f}px`,viewBox:`0 0 ${x} ${f}`,direction:"ltr",ref:Y,children:i.jsxRuntimeExports.jsxs("g",{transform:`translate(${O.left},${O.top})`,children:[M.filter(e=>e.position==="before").map(e=>e.layer),i.jsxRuntimeExports.jsxs(ve.AnimatePresence,{children:[oe.map(e=>i.jsxRuntimeExports.jsxs(le.motion.g,{className:"undp-viz-g-with-hover",variants:{initial:{opacity:0,x:F(0),y:A/2},whileInView:{x:F(e.position),y:A/2,opacity:z?e.color&&r[a.indexOf(e.color)]===z?.95:$:l.length!==0?l.indexOf(e.label)!==-1?.95:$:j,transition:{duration:m.duration}}},initial:"initial",animate:R?"whileInView":"initial",exit:{opacity:0,transition:{duration:m.duration}},onMouseEnter:t=>{y(e),h(t.clientY),q(t.clientX),k?.(e)},onClick:()=>{(D||N)&&(xe.isEqual(d,e)&&te?(H(void 0),D?.(void 0)):(H(e),D?.(e)))},onMouseMove:t=>{y(e),h(t.clientY),q(t.clientX)},onMouseLeave:()=>{y(void 0),q(void 0),h(void 0),k?.(void 0)},children:[Q==="dot"?i.jsxRuntimeExports.jsx(le.motion.circle,{cy:0,cx:0,variants:{initial:{fill:v&&l?l.indexOf(e.label)!==-1?v:o.filter(t=>t.color).length===0?r[0]:e.color?r[a.indexOf(e.color)]:c.Colors.gray:o.filter(t=>t.color).length===0?r[0]:e.color?r[a.indexOf(e.color)]:c.Colors.gray},whileInView:{fill:v&&l?l.indexOf(e.label)!==-1?v:o.filter(t=>t.color).length===0?r[0]:e.color?r[a.indexOf(e.color)]:c.Colors.gray:o.filter(t=>t.color).length===0?r[0]:e.color?r[a.indexOf(e.color)]:c.Colors.gray,transition:{duration:m.duration}}},initial:"initial",animate:R?"whileInView":"initial",exit:{opacity:0,transition:{duration:m.duration}},r:u}):i.jsxRuntimeExports.jsx(le.motion.rect,{y:0-u,x:-1,height:u*2,width:2,variants:{initial:{fill:v&&l?l.indexOf(e.label)!==-1?v:o.filter(t=>t.color).length===0?r[0]:e.color?r[a.indexOf(e.color)]:c.Colors.gray:o.filter(t=>t.color).length===0?r[0]:e.color?r[a.indexOf(e.color)]:c.Colors.gray},whileInView:{fill:v&&l?l.indexOf(e.label)!==-1?v:o.filter(t=>t.color).length===0?r[0]:e.color?r[a.indexOf(e.color)]:c.Colors.gray:o.filter(t=>t.color).length===0?r[0]:e.color?r[a.indexOf(e.color)]:c.Colors.gray,transition:{duration:m.duration}}},initial:"initial",animate:R?"whileInView":"initial",exit:{opacity:0,transition:{duration:m.duration}}}),l.length!==0&&l.indexOf(e.label)!==-1?i.jsxRuntimeExports.jsx(le.motion.text,{x:0,y:0-u-5,variants:{initial:{opacity:0},whileInView:{opacity:1,transition:{duration:m.duration}}},initial:"initial",animate:R?"whileInView":"initial",exit:{opacity:0,transition:{duration:m.duration}},style:{fill:V||(v&&l?l.indexOf(e.label)!==-1?v:o.filter(t=>t.color).length===0?r[0]:e.color?r[a.indexOf(e.color)]:c.Colors.gray:o.filter(t=>t.color).length===0?r[0]:e.color?r[a.indexOf(e.color)]:c.Colors.gray),textAnchor:"middle",...E?.graphObjectValues||{}},className:i.mo("graph-value text-sm font-bold",I?.graphObjectValues),children:ue.numberFormattingFunction(e.position,"NA",B,K,C)}):null]},e.label)),ne.map((e,t)=>i.jsxRuntimeExports.jsx("text",{x:e,y:A/2+u,style:{textAnchor:t===0?"start":t===ne.length-1?"end":"middle",...E?.xAxis?.labels||{}},className:i.mo("fill-primary-gray-550 dark:fill-primary-gray-500 text-xs",I?.xAxis?.labels),dy:"1em",children:ue.numberFormattingFunction(F.invert(e),"NA",B,K,C)},t))]}),M.filter(e=>e.position==="after").map(e=>e.layer)]})}),T&&U&&_&&g?i.jsxRuntimeExports.jsx(pe.Tooltip,{data:T,body:U,xPos:_,yPos:g,backgroundStyle:E?.tooltip,className:I?.tooltip}):null,N&&d!==void 0?i.jsxRuntimeExports.jsx(ge.X,{open:d!==void 0,onClose:()=>{H(void 0)},children:i.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof N=="string"?{__html:fe.string2HTML(N,d)}:void 0,children:typeof N=="function"?N(d):null})}):null]})}function Me(L){const{data:o,graphTitle:x,colors:f,sources:r,graphDescription:a,height:u,width:s,footNote:P,colorDomain:W,colorLegendTitle:ee,radius:U=5,padding:k,backgroundColor:l=!1,leftMargin:z=5,rightMargin:G=5,topMargin:X=10,bottomMargin:D=10,tooltip:K,relativeHeight:C,onSeriesMouseOver:Q,showColorScale:v=!0,highlightedDataPoints:j=[],graphID:te,minValue:N,maxValue:E,onSeriesMouseClick:I,graphDownload:V=!1,dataDownload:m=!1,prefix:w="",suffix:$="",stripType:B="dot",language:M="en",highlightColor:Y,dotOpacity:R=.3,showNAColor:T=!0,minHeight:y=0,theme:d="light",ariaLabel:H,resetSelectionOnDoubleClick:_=!0,detailsOnClick:q,styles:g,classNames:h,valueColor:O,animate:S=!1,noOfTicks:A=2,dimmedOpacity:ie=.3,precision:oe=2,customLayers:re=[]}=L,[b,F]=p.useState(0),[ne,e]=p.useState(0),[t,he]=p.useState(void 0),Z=p.useRef(null),ae=p.useRef(null);return p.useEffect(()=>{const n=new ResizeObserver(se=>{F(s||se[0].target.clientWidth||620),e(u||se[0].target.clientHeight||480)});return Z.current&&(e(Z.current.clientHeight||480),F(Z.current.clientWidth||620),s||n.observe(Z.current)),()=>n.disconnect()},[s,u]),i.jsxRuntimeExports.jsx("div",{className:`${d||"light"} flex ${s?"w-fit grow-0":"w-full grow"}`,dir:M==="he"||M==="ar"?"rtl":void 0,children:i.jsxRuntimeExports.jsx("div",{className:i.mo(`${l?l===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${M||"en"}`,s?"w-fit":"w-full",h?.graphContainer),style:{...g?.graphContainer||{},...l&&l!==!0?{backgroundColor:l}:{}},id:te,ref:ae,"aria-label":H||`${x?`The graph shows ${x}. `:""}This is a strip chart showing distribution of data along the horizontal axis. Each dot represents an individual data point, helping to visualize the spread and clustering of values.${a?` ${a}`:""}`,children:i.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:l?k||"1rem":k||0},children:i.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[x||a||V||m?i.jsxRuntimeExports.jsx(we.GraphHeader,{styles:{title:g?.title,description:g?.description},classNames:{title:h?.title,description:h?.description},graphTitle:x,graphDescription:a,width:s,graphDownload:V?ae.current:void 0,dataDownload:m?o.map(n=>n.data).filter(n=>n!==void 0).length>0?o.map(n=>n.data).filter(n=>n!==void 0):o.filter(n=>n!==void 0):null}):null,i.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:o.length===0?i.jsxRuntimeExports.jsx(Ce.EmptyState,{}):i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[v!==!1&&o.filter(n=>n.color).length!==0?i.jsxRuntimeExports.jsx(Oe.ColorLegendWithMouseOver,{width:s,colorLegendTitle:ee,colors:f||c.Colors[d].categoricalColors.colors,colorDomain:W||ce.uniqBy(o.filter(n=>n.color),"color").map(n=>n.color),setSelectedColor:he,showNAColor:T??!0}):null,i.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center w-full leading-0",ref:Z,"aria-label":"Graph area",children:(s||b)&&(u||ne)?i.jsxRuntimeExports.jsx(Ee,{data:o,width:s||b,height:Math.max(y,u||(C?y?(s||b)*C>y?(s||b)*C:y:(s||b)*C:ne)),colorDomain:o.filter(n=>n.color).length===0?[]:W||ce.uniqBy(o.filter(n=>n.color),"color").map(n=>n.color),colors:o.filter(n=>n.color).length===0?f?[f]:[c.Colors.primaryColors["blue-600"]]:f||c.Colors[d].categoricalColors.colors,selectedColor:t,radius:U,leftMargin:z,rightMargin:G,topMargin:X,bottomMargin:D,tooltip:K,onSeriesMouseOver:Q,highlightedDataPoints:j,minValue:N,maxValue:E,onSeriesMouseClick:I,prefix:w,suffix:$,stripType:B,highlightColor:Y,dotOpacity:R,resetSelectionOnDoubleClick:_,detailsOnClick:q,styles:g,classNames:h,valueColor:O,animate:S===!0?{duration:.5,once:!0,amount:.5}:S||{duration:0,once:!0,amount:0},noOfTicks:A,dimmedOpacity:ie,precision:oe,customLayers:re}):null})]})}),r||P?i.jsxRuntimeExports.jsx(je.GraphFooter,{styles:{footnote:g?.footnote,source:g?.source},classNames:{footnote:h?.footnote,source:h?.source},sources:r,footNote:P,width:s}):null]})})})})}function Re(L){const{data:o,width:x,height:f,colors:r,colorDomain:a,radius:u,leftMargin:s,rightMargin:P,topMargin:W,bottomMargin:ee,tooltip:U,onSeriesMouseOver:k,highlightedDataPoints:l,selectedColor:z,minValue:G,maxValue:X,onSeriesMouseClick:D,noOfTicks:K,prefix:C,suffix:Q,stripType:v,highlightColor:j,dotOpacity:te,resetSelectionOnDoubleClick:N,detailsOnClick:E,styles:I,classNames:V,valueColor:m,animate:w,dimmedOpacity:$,precision:B,customLayers:M}=L,Y=p.useRef(null),R=ye.useInView(Y,{once:w.once,amount:w.amount}),[T,y]=p.useState(void 0),[d,H]=p.useState(void 0),[_,q]=p.useState(void 0),[g,h]=p.useState(void 0),O={top:W,bottom:ee,left:s,right:P},S=x-O.left-O.right,A=f-O.top-O.bottom,ie=o.map((e,t)=>({...e,id:`${t}`})),oe=de.sortBy(ie,e=>{const t=(l||[]).indexOf(e.label);return t===-1?1/0:t}).reverse(),re=J.checkIfNullOrUndefined(X)?Math.max(...o.filter(e=>!J.checkIfNullOrUndefined(e.position)).map(e=>e.position))<0?0:Math.max(...o.filter(e=>!J.checkIfNullOrUndefined(e.position)).map(e=>e.position)):X,b=J.checkIfNullOrUndefined(G)?Math.min(...o.filter(e=>!J.checkIfNullOrUndefined(e.position)).map(e=>e.position))>=0?0:Math.min(...o.filter(e=>!J.checkIfNullOrUndefined(e.position)).map(e=>e.position)):G,F=me.linear().domain([b,re]).range([A,0]).nice(),ne=be(K,A);return i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[i.jsxRuntimeExports.jsx(le.motion.svg,{width:`${x}px`,height:`${f}px`,viewBox:`0 0 ${x} ${f}`,direction:"ltr",ref:Y,children:i.jsxRuntimeExports.jsxs("g",{transform:`translate(${O.left},${O.top})`,children:[M.filter(e=>e.position==="before").map(e=>e.layer),i.jsxRuntimeExports.jsxs(ve.AnimatePresence,{children:[oe.map(e=>i.jsxRuntimeExports.jsxs(le.motion.g,{className:"undp-viz-g-with-hover",variants:{initial:{opacity:0,x:S/2,y:F(0)},whileInView:{x:S/2,y:F(e.position),opacity:z?e.color&&r[a.indexOf(e.color)]===z?.95:$:l.length!==0?l.indexOf(e.label)!==-1?.95:$:te,transition:{duration:w.duration}}},initial:"initial",animate:R?"whileInView":"initial",exit:{opacity:0,transition:{duration:w.duration}},onMouseEnter:t=>{y(e),h(t.clientY),q(t.clientX),k?.(e)},onClick:()=>{(D||E)&&(xe.isEqual(d,e)&&N?(H(void 0),D?.(void 0)):(H(e),D?.(e)))},onMouseMove:t=>{y(e),h(t.clientY),q(t.clientX)},onMouseLeave:()=>{y(void 0),q(void 0),h(void 0),k?.(void 0)},children:[v==="dot"?i.jsxRuntimeExports.jsx(le.motion.circle,{cy:0,cx:0,variants:{initial:{fill:j&&l?l.indexOf(e.label)!==-1?j:o.filter(t=>t.color).length===0?r[0]:e.color?r[a.indexOf(e.color)]:c.Colors.gray:o.filter(t=>t.color).length===0?r[0]:e.color?r[a.indexOf(e.color)]:c.Colors.gray},whileInView:{fill:j&&l?l.indexOf(e.label)!==-1?j:o.filter(t=>t.color).length===0?r[0]:e.color?r[a.indexOf(e.color)]:c.Colors.gray:o.filter(t=>t.color).length===0?r[0]:e.color?r[a.indexOf(e.color)]:c.Colors.gray,transition:{duration:w.duration}}},initial:"initial",animate:R?"whileInView":"initial",exit:{opacity:0,transition:{duration:w.duration}},r:u}):i.jsxRuntimeExports.jsx(le.motion.rect,{x:0-u,y:-1,width:u*2,height:2,variants:{initial:{fill:j&&l?l.indexOf(e.label)!==-1?j:o.filter(t=>t.color).length===0?r[0]:e.color?r[a.indexOf(e.color)]:c.Colors.gray:o.filter(t=>t.color).length===0?r[0]:e.color?r[a.indexOf(e.color)]:c.Colors.gray},whileInView:{fill:j&&l?l.indexOf(e.label)!==-1?j:o.filter(t=>t.color).length===0?r[0]:e.color?r[a.indexOf(e.color)]:c.Colors.gray:o.filter(t=>t.color).length===0?r[0]:e.color?r[a.indexOf(e.color)]:c.Colors.gray,transition:{duration:w.duration}}},initial:"initial",animate:R?"whileInView":"initial",exit:{opacity:0,transition:{duration:w.duration}}}),l.length!==0&&l.indexOf(e.label)!==-1?i.jsxRuntimeExports.jsx(le.motion.text,{y:0,dy:"0.33em",x:0+u+3,variants:{initial:{opacity:0},whileInView:{opacity:1,transition:{duration:w.duration}}},initial:"initial",animate:R?"whileInView":"initial",exit:{opacity:0,transition:{duration:w.duration}},style:{fill:m||(j&&l?l.indexOf(e.label)!==-1?j:o.filter(t=>t.color).length===0?r[0]:e.color?r[a.indexOf(e.color)]:c.Colors.gray:o.filter(t=>t.color).length===0?r[0]:e.color?r[a.indexOf(e.color)]:c.Colors.gray),textAnchor:"start",...I?.graphObjectValues||{}},className:i.mo("graph-value text-sm font-bold",V?.graphObjectValues),children:ue.numberFormattingFunction(e.position,"NA",B,C,Q)}):null]},e.label)),ne.map((e,t)=>i.jsxRuntimeExports.jsx("text",{y:e,x:S/2+u+5,style:{textAnchor:"start",...I?.yAxis?.labels||{}},className:i.mo("fill-primary-gray-550 dark:fill-primary-gray-500 text-xs",V?.yAxis?.labels),children:ue.numberFormattingFunction(F.invert(e),"NA",B,C,Q)},t))]}),M.filter(e=>e.position==="after").map(e=>e.layer)]})}),T&&U&&_&&g?i.jsxRuntimeExports.jsx(pe.Tooltip,{data:T,body:U,xPos:_,yPos:g,backgroundStyle:I?.tooltip,className:V?.tooltip}):null,E&&d!==void 0?i.jsxRuntimeExports.jsx(ge.X,{open:d!==void 0,onClose:()=>{H(void 0)},children:i.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof E=="string"?{__html:fe.string2HTML(E,d)}:void 0,children:typeof E=="function"?E(d):null})}):null]})}function Ne(L){const{data:o,graphTitle:x,colors:f,sources:r,graphDescription:a,height:u,width:s,footNote:P,colorDomain:W,colorLegendTitle:ee,radius:U=5,padding:k,backgroundColor:l=!1,leftMargin:z=20,rightMargin:G=20,topMargin:X=10,bottomMargin:D=10,tooltip:K,relativeHeight:C,onSeriesMouseOver:Q,showColorScale:v=!0,highlightedDataPoints:j=[],graphID:te,minValue:N,maxValue:E,onSeriesMouseClick:I,graphDownload:V=!1,dataDownload:m=!1,prefix:w="",suffix:$="",stripType:B="dot",language:M="en",highlightColor:Y,dotOpacity:R=.3,showNAColor:T=!0,minHeight:y=0,theme:d="light",ariaLabel:H,resetSelectionOnDoubleClick:_=!0,detailsOnClick:q,styles:g,classNames:h,valueColor:O,animate:S=!1,noOfTicks:A=2,dimmedOpacity:ie=.3,precision:oe=2,customLayers:re=[]}=L,[b,F]=p.useState(0),[ne,e]=p.useState(0),[t,he]=p.useState(void 0),Z=p.useRef(null),ae=p.useRef(null);return p.useEffect(()=>{const n=new ResizeObserver(se=>{F(s||se[0].target.clientWidth||620),e(u||se[0].target.clientHeight||480)});return Z.current&&(e(Z.current.clientHeight||480),F(Z.current.clientWidth||620),s||n.observe(Z.current)),()=>n.disconnect()},[s,u]),i.jsxRuntimeExports.jsx("div",{className:`${d||"light"} flex ${s?"w-fit grow-0":"w-full grow"}`,dir:M==="he"||M==="ar"?"rtl":void 0,children:i.jsxRuntimeExports.jsx("div",{className:i.mo(`${l?l===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${M||"en"}`,s?"w-fit":"w-full",h?.graphContainer),style:{...g?.graphContainer||{},...l&&l!==!0?{backgroundColor:l}:{}},id:te,ref:ae,"aria-label":H||`${x?`The graph shows ${x}. `:""}This is a strip chart showing distribution of data along the vertical axis. Each dot represents an individual data point, helping to visualize the spread and clustering of values.${a?` ${a}`:""}`,children:i.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:l?k||"1rem":k||0},children:i.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[x||a||V||m?i.jsxRuntimeExports.jsx(we.GraphHeader,{styles:{title:g?.title,description:g?.description},classNames:{title:h?.title,description:h?.description},graphTitle:x,graphDescription:a,width:s,graphDownload:V?ae.current:void 0,dataDownload:m?o.map(n=>n.data).filter(n=>n!==void 0).length>0?o.map(n=>n.data).filter(n=>n!==void 0):o.filter(n=>n!==void 0):null}):null,i.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:o.length===0?i.jsxRuntimeExports.jsx(Ce.EmptyState,{}):i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[v!==!1&&o.filter(n=>n.color).length!==0?i.jsxRuntimeExports.jsx(Oe.ColorLegendWithMouseOver,{width:s,colorLegendTitle:ee,colors:f||c.Colors[d].categoricalColors.colors,colorDomain:W||ce.uniqBy(o.filter(n=>n.color),"color").map(n=>n.color),setSelectedColor:he,showNAColor:T}):null,i.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center w-full leading-0",ref:Z,children:(s||b)&&(u||ne)?i.jsxRuntimeExports.jsx(Re,{data:o,width:s||b,height:Math.max(y,u||(C?y?(s||b)*C>y?(s||b)*C:y:(s||b)*C:ne)),colorDomain:o.filter(n=>n.color).length===0?[]:W||ce.uniqBy(o.filter(n=>n.color),"color").map(n=>n.color),colors:o.filter(n=>n.color).length===0?f?[f]:[c.Colors.primaryColors["blue-600"]]:f||c.Colors[d].categoricalColors.colors,selectedColor:t,radius:U,leftMargin:z,rightMargin:G,topMargin:X,bottomMargin:D,tooltip:K,onSeriesMouseOver:Q,highlightedDataPoints:j,minValue:N,maxValue:E,onSeriesMouseClick:I,prefix:w,suffix:$,stripType:B,highlightColor:Y,dotOpacity:R,resetSelectionOnDoubleClick:_,detailsOnClick:q,styles:g,classNames:h,valueColor:O,animate:S===!0?{duration:.5,once:!0,amount:.5}:S||{duration:0,once:!0,amount:0},noOfTicks:A,dimmedOpacity:ie,precision:oe,customLayers:re}):null})]})}),r||P?i.jsxRuntimeExports.jsx(je.GraphFooter,{styles:{footnote:g?.footnote,source:g?.source},classNames:{footnote:h?.footnote,source:h?.source},sources:r,footNote:P,width:s}):null]})})})})}function Se(L){const{data:o,graphTitle:x,colors:f,sources:r,graphDescription:a,height:u,width:s,footNote:P,colorDomain:W,colorLegendTitle:ee,radius:U,padding:k,backgroundColor:l,leftMargin:z,rightMargin:G,topMargin:X,bottomMargin:D,tooltip:K,relativeHeight:C,onSeriesMouseOver:Q,showColorScale:v,highlightedDataPoints:j,graphID:te,minValue:N,maxValue:E,onSeriesMouseClick:I,noOfTicks:V,graphDownload:m,dataDownload:w,prefix:$,suffix:B,stripType:M,language:Y,highlightColor:R,dotOpacity:T,showNAColor:y,minHeight:d,theme:H,ariaLabel:_,valueColor:q,resetSelectionOnDoubleClick:g,detailsOnClick:h,orientation:O="vertical",styles:S,classNames:A,animate:ie,dimmedOpacity:oe=.3,precision:re,customLayers:b}=L;return O==="vertical"?i.jsxRuntimeExports.jsx(Ne,{data:o,graphTitle:x,colors:f,sources:r,graphDescription:a,height:u,width:s,footNote:P,colorDomain:W,colorLegendTitle:ee,radius:U,padding:k,backgroundColor:l,leftMargin:z,rightMargin:G,topMargin:X,bottomMargin:D,tooltip:K,relativeHeight:C,onSeriesMouseOver:Q,showColorScale:v,highlightedDataPoints:j,graphID:te,minValue:N,maxValue:E,onSeriesMouseClick:I,noOfTicks:V,graphDownload:m,dataDownload:w,prefix:$,suffix:B,stripType:M,language:Y,highlightColor:R,dotOpacity:T,showNAColor:y,minHeight:d,theme:H,ariaLabel:_,resetSelectionOnDoubleClick:g,styles:S,valueColor:q,detailsOnClick:h,classNames:A,animate:ie,dimmedOpacity:oe,precision:re,customLayers:b}):i.jsxRuntimeExports.jsx(Me,{data:o,graphTitle:x,colors:f,sources:r,graphDescription:a,height:u,width:s,footNote:P,colorDomain:W,colorLegendTitle:ee,radius:U,padding:k,backgroundColor:l,leftMargin:z,rightMargin:G,topMargin:X,bottomMargin:D,tooltip:K,relativeHeight:C,onSeriesMouseOver:Q,showColorScale:v,highlightedDataPoints:j,graphID:te,minValue:N,maxValue:E,onSeriesMouseClick:I,noOfTicks:V,graphDownload:m,dataDownload:w,prefix:$,suffix:B,stripType:M,language:Y,highlightColor:R,dotOpacity:T,showNAColor:y,minHeight:d,theme:H,ariaLabel:_,resetSelectionOnDoubleClick:g,styles:S,valueColor:q,detailsOnClick:h,classNames:A,animate:ie,dimmedOpacity:oe,precision:re,customLayers:b})}exports.StripChart=Se;
|
|
2
2
|
//# sourceMappingURL=StripChart.cjs.map
|
package/dist/StripChart.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { j as l, m as ni } from "./index-CHPV5EwG-BPSP-7Jg.js";
|
|
2
|
-
import { u as gi } from "./index-
|
|
2
|
+
import { u as gi } from "./index-AqnpA7_O.js";
|
|
3
3
|
import { useRef as si, useState as E, useEffect as ui } from "react";
|
|
4
|
-
import { i as pi } from "./index-
|
|
5
|
-
import { s as mi } from "./index-
|
|
4
|
+
import { i as pi } from "./index-Bwrro8-q.js";
|
|
5
|
+
import { s as mi } from "./index-fwdktvAS.js";
|
|
6
6
|
import { X as xi } from "./Modal-DVVwpKhP.js";
|
|
7
|
-
import { T as yi } from "./Tooltip-
|
|
7
|
+
import { T as yi } from "./Tooltip-CVCGWyzw.js";
|
|
8
8
|
import { c as J } from "./checkIfNullOrUndefined-DmfiKkNw.js";
|
|
9
9
|
import { n as di } from "./numberFormattingFunction-14YCbkN2.js";
|
|
10
10
|
import { Colors as c } from "./Colors.js";
|
|
11
|
-
import { s as vi } from "./string2HTML-
|
|
11
|
+
import { s as vi } from "./string2HTML-oFCROsus.js";
|
|
12
12
|
import { a as wi } from "./linear-DUdu7l2G.js";
|
|
13
13
|
import { u as Oi } from "./use-in-view-yS6jzJAp.js";
|
|
14
14
|
import { m as ai } from "./proxy-CkpFesk1.js";
|
package/dist/ThreeDGlobe.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-CHPV5EwG-DDoeWRVt.cjs"),a=require("react"),pe=require("./Spinner-DA6Z5E4n.cjs"),he=require("react-globe.gl"),me=require("./index-BXns0-ng.cjs"),xe=require("three"),fe=require("./Modal-tXZlLE5s.cjs"),de=require("./Typography-k-kOjICQ.cjs"),ye=require("./Tooltip-n8z5bfav.cjs"),je=require("./numberFormattingFunction-02t-wJta.cjs"),ve=require("./index-BW_-wD2k.cjs"),be=require("./string2HTML-D2Avudmb.cjs"),Ee=require("./ordinal-BOeNbyae.cjs"),Ce=require("./threshold-DNsSUf8Q.cjs"),Re=require("./GraphHeader.cjs"),we=require("./GraphFooter.cjs"),De=require("./fetchAndParseData-CQyVGCul.cjs"),O=require("./Colors.cjs"),Se=require("./getUniqValue-CHqgSss5.cjs"),ke=require("./getJenks-TWQvbuOz.cjs");function Ne(y){const d=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(y){for(const c in y)if(c!=="default"){const u=Object.getOwnPropertyDescriptor(y,c);Object.defineProperty(d,c,u.get?u:{enumerable:!0,get:()=>y[c]})}}return d.default=y,Object.freeze(d)}const z=Ne(xe);function Me(y){const{width:d,autoRotate:c,data:u,enableZoom:T,categorical:M,colorDomain:g,colors:s,globeMaterial:n,height:I,polygonData:Y,mapProperty:p,mapBorderColor:P,atmosphereColor:U,tooltip:W,styles:b,classNames:K,mapNoDataColor:h,colorLegendTitle:H,showColorScale:Q,hoverStrokeColor:ee,detailsOnClick:j,onSeriesMouseClick:E,onSeriesMouseOver:m,resetSelectionOnDoubleClick:q,highlightedIds:V,scale:x,globeOffset:C,polygonAltitude:A,centerLng:$,centerLat:F,atmosphereAltitude:_,globeCurvatureResolution:te,lightColor:G,fogSettings:D}=y,i=a.useRef(void 0),[S,L]=a.useState(void 0),[re,J]=a.useState(!(d<680)),[X,oe]=a.useState({x:0,y:0}),[R,se]=a.useState(void 0),Z=M?Ee.ordinal().domain(g).range(s):Ce.threshold().domain(g).range(s);a.useEffect(()=>{i.current&&(i.current.controls().enableZoom=T)},[T]),a.useEffect(()=>{i.current&&(R?i.current.controls().autoRotate=!1:(i.current.controls().autoRotate=c!==0,i.current.controls().autoRotateSpeed=c))},[R,c]),a.useEffect(()=>{const e=i.current?.renderer().domElement;if(!e)return;const r=o=>{oe({x:o.clientX,y:o.clientY})};return e.addEventListener("mousemove",r),()=>e.removeEventListener("mousemove",r)},[]),a.useEffect(()=>{i.current&&i.current.pointOfView({lat:F,lng:$,altitude:x},1e3)},[x,$,F]);const ie=n||new z.MeshBasicMaterial({color:"#FFF"});return a.useEffect(()=>{if(!i.current)return;const e=i.current.scene();e.children.filter(o=>o.type==="DirectionalLight"||o.type==="AmbientLight").forEach(o=>e.remove(o));const r=new z.AmbientLight(G,.2);e.add(r),setTimeout(()=>{(e.children[3]?.children[0]?.children[4]?.children||[]).forEach(f=>{const v=f.children[1];v&&(v.renderOrder=2)})},300),D&&(e.fog=new z.Fog(D.color,D.near,D.far))},[G,x,D]),t.jsxRuntimeExports.jsxs("div",{className:"relative",children:[t.jsxRuntimeExports.jsx(he,{ref:i,height:I,width:d,globeOffset:C,lineHoverPrecision:0,polygonsData:Y,polygonAltitude:e=>V.includes(e?.properties?.[p])?.1:e?.properties?.[p]===R?.id?.01:A,polygonCapColor:e=>{const r=e?.properties?.[p],o=u.find(f=>f.id===r)?.x;return o!=null?Z(o):h},polygonSideColor:e=>{const r=e?.properties?.[p],o=u.find(v=>v.id===r)?.x,f=o!=null?Z(o):h;return V.includes(e?.properties?.[p])?f:"rgba(100,100,100,0)"},polygonStrokeColor:e=>e?.properties?.[p]===R?.id?ee:P,onPolygonClick:e=>{const r=e?.properties?.[p]?u.find(o=>o.id===e?.properties?.[p]):void 0;(E||j)&&(me.isEqual(S,r)&&q&&r?(L(void 0),E?.(void 0)):(L(r),E?.(r))),L(r),E?.(r)},onPolygonHover:e=>{const r=e?.properties?.[p]?u.find(o=>o.id===e?.properties?.[p]):void 0;se(r),m?.(r)},atmosphereColor:U,atmosphereAltitude:_,globeCurvatureResolution:te,globeMaterial:ie,backgroundColor:"rgba(0, 0, 0, 0)",polygonsTransitionDuration:100,onGlobeReady:()=>{if(i.current){i.current.pointOfView({lat:F,lng:$});const e=i.current.scene();setTimeout(()=>{e.children.filter(w=>w.type==="DirectionalLight").map(w=>{e.remove(w)});const f=new z.AmbientLight(G,.2);e.add(f),(e.children[3]?.children[0]?.children[4]?.children||[]).forEach(w=>{const k=w.children[1];k.renderOrder=2})},300);const r=new z.DirectionalLight(16777215,.1),o=i.current.camera();r.position.set(0,0,1),o.add(r),e.add(o)}}}),Q===!1?null:t.jsxRuntimeExports.jsx("div",{className:"absolute left-4 bottom-4",children:re?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx("div",{style:{backgroundColor:"rgba(240,240,240, 0.7)",border:"1px solid var(--gray-400)",borderRadius:"999px",width:"24px",height:"24px",padding:"3px",cursor:"pointer",zIndex:10,position:"absolute",right:"-0.75rem",top:"-0.75rem"},onClick:()=>{J(!1)},children:t.jsxRuntimeExports.jsx(ve.X,{})}),t.jsxRuntimeExports.jsxs("div",{className:"p-2",style:{backgroundColor:"rgba(240,240,240, 0.7)",width:M?void 0:"340px"},children:[H&&H!==""?t.jsxRuntimeExports.jsx(de.u,{size:"xs",marginBottom:"xs",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:H}):null,M?t.jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-3",children:g.map((e,r)=>t.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 items-center",children:[t.jsxRuntimeExports.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:s[r%s.length]}}),t.jsxRuntimeExports.jsx(de.u,{size:"sm",marginBottom:"none",leading:"none",children:e})]},r))}):t.jsxRuntimeExports.jsx("svg",{width:"100%",viewBox:"0 0 320 30",direction:"ltr",children:t.jsxRuntimeExports.jsxs("g",{children:[g.map((e,r)=>t.jsxRuntimeExports.jsxs("g",{className:"cursor-pointer",children:[t.jsxRuntimeExports.jsx("rect",{x:r*320/s.length+1,y:1,width:320/s.length-2,height:8,style:{fill:s[r],stroke:s[r]}}),t.jsxRuntimeExports.jsx("text",{x:(r+1)*320/s.length,y:25,className:"fill-primary-gray-700 dark:fill-primary-gray-300 text-xs",style:{textAnchor:"middle"},children:je.numberFormattingFunction(e,"NA")})]},r)),t.jsxRuntimeExports.jsx("g",{children:t.jsxRuntimeExports.jsx("rect",{x:g.length*320/s.length+1,y:1,width:320/s.length-2,height:8,style:{fill:s[g.length],stroke:s[g.length]}})})]})})]})]}):t.jsxRuntimeExports.jsx("button",{type:"button",className:"mb-0 border-0 bg-transparent p-0 self-start",onClick:()=>{J(!0)},children:t.jsxRuntimeExports.jsx("div",{className:"items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-550 border-primary-gray-400 dark:border-primary-gray-500",children:"Show Legend"})})}),R&&W?t.jsxRuntimeExports.jsx(ye.Tooltip,{data:R,body:W,xPos:X.x,yPos:X.y,backgroundStyle:b?.tooltip,className:K?.tooltip}):null,j&&S!==void 0?t.jsxRuntimeExports.jsx(fe.X,{open:S!==void 0,onClose:()=>{L(void 0)},children:t.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof j=="string"?{__html:be.string2HTML(j,S)}:void 0,children:typeof j=="function"?j(S):null})}):null]})}function qe(y){const{data:d,mapData:c="https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap-simplified.json",graphTitle:u,colors:T,sources:M,graphDescription:g,height:s,width:n,footNote:I="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.",colorDomain:Y,colorLegendTitle:p,scaleType:P="threshold",padding:U,mapNoDataColor:W=O.Colors.light.graphNoData,backgroundColor:b=!1,mapBorderColor:K=O.Colors.light.grays["gray-500"],relativeHeight:h,tooltip:H,graphID:Q,mapProperty:ee="ISO3",dataDownload:j=!1,language:E="en",minHeight:m=0,theme:q="light",ariaLabel:V,styles:x,classNames:C,autoRotate:A=!0,enableZoom:$=!0,globeMaterial:F,centerPoint:_=[0,0],atmosphereColor:te="#999",showColorScale:G=!0,resetSelectionOnDoubleClick:D=!0,detailsOnClick:i,onSeriesMouseOver:S,onSeriesMouseClick:L,highlightedIds:re=[],scale:J=1,globeOffset:X=[0,0],polygonAltitude:oe=.01,globeCurvatureResolution:R=4,atmosphereAltitude:se=.15,lightColor:Z="#dce9fe",fogSettings:ie}=y,[e,r]=a.useState(void 0),[o,f]=a.useState(0),[v,w]=a.useState(0),k=a.useRef(null);a.useEffect(()=>{const l=new ResizeObserver(B=>{f(n||B[0].target.clientWidth||760),w(s||B[0].target.clientHeight||480)});return k.current&&(w(k.current.clientHeight||480),f(k.current.clientWidth||760),n||l.observe(k.current)),()=>l.disconnect()},[n,s]),a.useEffect(()=>{typeof c=="string"?De.fetchAndParseJSON(c).then(B=>{if(c==="https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap-simplified.json"){const ue=B.features.map(N=>{if(N.geometry.type==="Polygon"){const ae=[...N.geometry.coordinates[0]].reverse(),le={...N.geometry,coordinates:[ae]};return{...N,geometry:le}}const ce=[];N.geometry.coordinates.forEach(ae=>{const le=[...ae[0]].reverse();ce.push([le])});const ge={...N.geometry,coordinates:ce};return{...N,geometry:ge}});r(ue)}else r(B.features)}):r(c.features)},[c]);const ne=Y||(P==="categorical"?Se.getUniqValue(d,"x"):ke.getJenks(d.map(l=>l.x),T?.length||4));return t.jsxRuntimeExports.jsx("div",{className:`${q||"light"} flex ${n?"w-fit grow-0":"w-full grow"}`,dir:E==="he"||E==="ar"?"rtl":void 0,children:t.jsxRuntimeExports.jsx("div",{className:t.mo(`${b?b===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${E||"en"}`,n?"w-fit":"w-full",C?.graphContainer),style:{...x?.graphContainer||{},...b&&b!==!0?{backgroundColor:b}:{}},id:Q,"aria-label":V||`${u?`The graph shows ${u}. `:""}This is a map.${g?` ${g}`:""}`,children:t.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:b?U||"1rem":U||0},children:t.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[u||g||j?t.jsxRuntimeExports.jsx(Re.GraphHeader,{styles:{title:x?.title,description:x?.description},classNames:{title:C?.title,description:C?.description},graphTitle:u,graphDescription:g,width:n,graphDownload:void 0,dataDownload:j?d.map(l=>l.data).filter(l=>l!==void 0).length>0?d.map(l=>l.data).filter(l=>l!==void 0):d.filter(l=>l!==void 0):null}):null,t.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:k,"aria-label":"Map area",children:(n||o)&&(s||v)&&e?t.jsxRuntimeExports.jsx(Me,{data:d,globeOffset:X,polygonData:e,colorDomain:ne,width:n||o,height:Math.max(m,s||(h?m?(n||o)*h>m?(n||o)*h:m:(n||o)*h:v)),colors:T||(P==="categorical"?O.Colors[q].sequentialColors[`neutralColorsx0${ne.length}`]:O.Colors[q].sequentialColors[`neutralColorsx0${ne.length+1}`]),mapNoDataColor:W,categorical:P==="categorical",mapBorderColor:K,tooltip:H,mapProperty:ee,styles:x,classNames:C,autoRotate:A===!0?1.5:A===!1?0:A,enableZoom:$,globeMaterial:F,atmosphereColor:te,colorLegendTitle:p,showColorScale:G,hoverStrokeColor:q==="light"?O.Colors.light.grays["gray-700"]:O.Colors.light.grays["gray-300"],highlightedIds:re,resetSelectionOnDoubleClick:D,detailsOnClick:i,onSeriesMouseOver:S,onSeriesMouseClick:L,scale:J,polygonAltitude:oe,centerLat:_[0],centerLng:_[1],atmosphereAltitude:se,globeCurvatureResolution:R,lightColor:Z,fogSettings:ie}):t.jsxRuntimeExports.jsx("div",{style:{height:`${Math.max(m,s||(h?m?(n||o)*h>m?(n||o)*h:m:(n||o)*h:v))}px`},className:"flex items-center justify-center",children:t.jsxRuntimeExports.jsx(pe.y,{"aria-label":"Loading graph"})})}),M||I?t.jsxRuntimeExports.jsx(we.GraphFooter,{styles:{footnote:x?.footnote,source:x?.source},classNames:{footnote:C?.footnote,source:C?.source},sources:M,footNote:I,width:n}):null]})})})})}exports.ThreeDGlobe=qe;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-CHPV5EwG-DDoeWRVt.cjs"),n=require("react"),me=require("./Spinner-DA6Z5E4n.cjs"),ge=require("react-globe.gl"),xe=require("./index-DQA8q5sC.cjs"),ye=require("three"),fe=require("./Modal-tXZlLE5s.cjs"),pe=require("./Typography-k-kOjICQ.cjs"),be=require("./index-D05lK1Te.cjs"),ve=require("./Tooltip-De16GWhY.cjs"),je=require("./numberFormattingFunction-02t-wJta.cjs"),we=require("./index-BW_-wD2k.cjs"),Ce=require("./string2HTML-z7CwHXcx.cjs"),Ee=require("./ordinal-BOeNbyae.cjs"),Re=require("./threshold-DNsSUf8Q.cjs"),Se=require("./GraphHeader.cjs"),ke=require("./GraphFooter.cjs"),De=require("./fetchAndParseData-Dcy7AS_0.cjs"),T=require("./Colors.cjs"),Ne=require("./getUniqValue-CfuE_l9c.cjs"),Me=require("./getJenks-vofIZmeb.cjs");function qe(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const u in e)if(u!=="default"){const m=Object.getOwnPropertyDescriptor(e,u);Object.defineProperty(o,u,m.get?m:{enumerable:!0,get:()=>e[u]})}}return o.default=e,Object.freeze(o)}const M=qe(ye);function Oe(e){let o;switch(e.type){case"ambient":o=new M.AmbientLight(e.color,e.intensity);break;case"directional":o=new M.DirectionalLight(e.color,e.intensity),e.position&&(e.position==="camera"?o.position.set(0,0,0):o.position.set(e.position.x,e.position.y,e.position.z)),(e.target||e.position==="camera")&&o.target.position.set(e.target?.x||0,e.target?.y||0,e.target?.z===void 0?-1:e.target.z),e.castShadow&&(o.castShadow=!0,e.shadow&&(o.shadow.mapSize.width=e.shadow.mapSize.width,o.shadow.mapSize.height=e.shadow.mapSize.height,o.shadow.camera.near=e.shadow.camera.near,o.shadow.camera.far=e.shadow.camera.far));break;case"point":o=new M.PointLight(e.color,e.intensity,e.distance||0,e.decay||2),e.position&&(e.position==="camera"?o.position.set(0,0,0):o.position.set(e.position.x,e.position.y,e.position.z));break;case"spot":o=new M.SpotLight(e.color,e.intensity,e.distance||0,e.angle||Math.PI/3,e.penumbra||0,e.decay||2),e.position&&(e.position==="camera"?o.position.set(0,0,0):o.position.set(e.position.x,e.position.y,e.position.z)),(e.target||e.position==="camera")&&o.target.position.set(e.target?.x||0,e.target?.y||0,e.target?.z||0),e.castShadow&&(o.castShadow=!0,e.shadow&&(o.shadow.mapSize.width=e.shadow.mapSize.width,o.shadow.mapSize.height=e.shadow.mapSize.height,o.shadow.camera.near=e.shadow.camera.near,o.shadow.camera.far=e.shadow.camera.far));break;default:throw new Error("Unknown light type")}return o}function Le(e){const{width:o,autoRotate:u,data:m,enableZoom:z,categorical:q,colorDomain:g,colors:l,globeMaterial:c,height:B,polygonData:te,mapProperty:h,mapBorderColor:H,atmosphereColor:I,tooltip:U,styles:E,classNames:re,mapNoDataColor:x,colorLegendTitle:A,showColorScale:oe,hoverStrokeColor:se,detailsOnClick:w,onSeriesMouseClick:k,onSeriesMouseOver:v,resetSelectionOnDoubleClick:O,highlightedIds:V,scale:y,globeOffset:R,polygonAltitude:G,centerLng:$,centerLat:F,atmosphereAltitude:W,globeCurvatureResolution:ae,fogSettings:D,lights:N,highlightedAltitude:J}=e,[X,ie]=n.useState(!1),i=n.useRef(void 0),[j,L]=n.useState(void 0),[P,Z]=n.useState(void 0),[ne,Y]=n.useState(!(o<680)),[K,le]=n.useState({x:0,y:0}),[C,_]=n.useState(void 0),f=q?Ee.ordinal().domain(g).range(l):Re.threshold().domain(g).range(l);n.useEffect(()=>{i.current&&(i.current.controls().enableZoom=z)},[z]),n.useEffect(()=>{i.current&&(C||j?i.current.controls().autoRotate=!1:(i.current.controls().autoRotate=u!==0,i.current.controls().autoRotateSpeed=u))},[C,j,u]),n.useEffect(()=>{i.current&&P&&i.current.pointOfView({lat:P[1],lng:P[0],altitude:y},1e3)},[P,y]),n.useEffect(()=>{const t=i.current?.renderer().domElement;if(!t)return;const a=r=>{le({x:r.clientX,y:r.clientY})};return t.addEventListener("mousemove",a),()=>t.removeEventListener("mousemove",a)},[]),n.useEffect(()=>{i.current&&i.current.pointOfView({lat:F,lng:$,altitude:y},1e3)},[y,$,F]);const Q=c||new M.MeshBasicMaterial({color:"#FFF"}),S=n.useCallback(()=>{if(!i.current)return;const t=i.current.scene(),a=i.current.camera();let r=[];t.traverse(d=>{d instanceof M.Light&&r.push(d)}),r=[...r,...a.children],r.forEach(d=>d.parent?.remove(d)),N.map(d=>Oe(d)).forEach((d,b)=>{N[b].type!=="ambient"&&N[b].position==="camera"?(a.add(d),N[b].type!=="point"&&a.add(d.target)):t.add(d)}),D&&(t.fog=new M.Fog(D.color,D.near,D.far))},[N,D]),ee=n.useCallback(()=>{ie(!0),S()},[S]);return n.useEffect(()=>{X&&S()},[X,S]),s.jsxRuntimeExports.jsxs("div",{className:"relative",children:[s.jsxRuntimeExports.jsx(ge,{ref:i,height:B,width:o,globeOffset:R,lineHoverPrecision:0,polygonsData:te,polygonAltitude:t=>V.includes(t?.properties?.[h])||t?.properties?.[h]===C?.id||t?.properties?.[h]===j?.id?J:G,polygonCapColor:t=>{const a=t?.properties?.[h],r=m.find(p=>p.id===a)?.x;return r!=null?f(r):x},polygonSideColor:t=>{const a=t?.properties?.[h],r=m.find(d=>d.id===a)?.x,p=r!=null?f(r):x;return V.includes(t?.properties?.[h])?p:"rgba(100,100,100,0)"},polygonStrokeColor:t=>t?.properties?.[h]===C?.id?se:H,onGlobeClick:()=>{L(void 0)},onPolygonClick:t=>{const a=t?.properties?.[h]?m.find(r=>r.id===t?.properties?.[h]):void 0;if(k||w)if(xe.isEqual(j,a)&&O&&a)L(void 0),k?.(void 0),Z(void 0);else{L(a),k?.(a);const[r,p]=be.turf_center_of_mass_default(t).geometry.coordinates;Z([r,p])}},onPolygonHover:t=>{const a=t?.properties?.[h]?m.find(r=>r.id===t?.properties?.[h]):void 0;_(a),v?.(a)},atmosphereColor:I,atmosphereAltitude:W,globeCurvatureResolution:ae,globeMaterial:Q,backgroundColor:"rgba(0, 0, 0, 0)",polygonsTransitionDuration:100,onGlobeReady:()=>{if(i.current){i.current.pointOfView({lat:F,lng:$});const t=i.current.scene();setTimeout(()=>{(t.children[3]?.children[0]?.children[4]?.children||[]).forEach(p=>{const d=p.children[1];d.renderOrder=2})},300);const a=i.current.camera();t.add(a),ee()}}}),oe===!1?null:s.jsxRuntimeExports.jsx("div",{className:"absolute left-4 bottom-4",children:ne?s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx("div",{style:{backgroundColor:"rgba(240,240,240, 0.7)",border:"1px solid var(--gray-400)",borderRadius:"999px",width:"24px",height:"24px",padding:"3px",cursor:"pointer",zIndex:10,position:"absolute",right:"-0.75rem",top:"-0.75rem"},onClick:()=>{Y(!1)},children:s.jsxRuntimeExports.jsx(we.X,{})}),s.jsxRuntimeExports.jsxs("div",{className:"p-2",style:{backgroundColor:"rgba(240,240,240, 0.7)",width:q?void 0:"340px"},children:[A&&A!==""?s.jsxRuntimeExports.jsx(pe.u,{size:"xs",marginBottom:"xs",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:A}):null,q?s.jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-3",children:g.map((t,a)=>s.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 items-center",children:[s.jsxRuntimeExports.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:l[a%l.length]}}),s.jsxRuntimeExports.jsx(pe.u,{size:"sm",marginBottom:"none",leading:"none",children:t})]},a))}):s.jsxRuntimeExports.jsx("svg",{width:"100%",viewBox:"0 0 320 30",direction:"ltr",children:s.jsxRuntimeExports.jsxs("g",{children:[g.map((t,a)=>s.jsxRuntimeExports.jsxs("g",{className:"cursor-pointer",children:[s.jsxRuntimeExports.jsx("rect",{x:a*320/l.length+1,y:1,width:320/l.length-2,height:8,style:{fill:l[a],stroke:l[a]}}),s.jsxRuntimeExports.jsx("text",{x:(a+1)*320/l.length,y:25,className:"fill-primary-gray-700 dark:fill-primary-gray-300 text-xs",style:{textAnchor:"middle"},children:je.numberFormattingFunction(t,"NA")})]},a)),s.jsxRuntimeExports.jsx("g",{children:s.jsxRuntimeExports.jsx("rect",{x:g.length*320/l.length+1,y:1,width:320/l.length-2,height:8,style:{fill:l[g.length],stroke:l[g.length]}})})]})})]})]}):s.jsxRuntimeExports.jsx("button",{type:"button",className:"mb-0 border-0 bg-transparent p-0 self-start",onClick:()=>{Y(!0)},children:s.jsxRuntimeExports.jsx("div",{className:"items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-550 border-primary-gray-400 dark:border-primary-gray-500",children:"Show Legend"})})}),C&&U?s.jsxRuntimeExports.jsx(ve.Tooltip,{data:C,body:U,xPos:K.x,yPos:K.y,backgroundStyle:E?.tooltip,className:re?.tooltip}):null,w&&j!==void 0?s.jsxRuntimeExports.jsx(fe.X,{open:j!==void 0,onClose:()=>{L(void 0)},children:s.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof w=="string"?{__html:Ce.string2HTML(w,j)}:void 0,children:typeof w=="function"?w(j):null})}):null]})}function Pe(e){const{data:o,mapData:u="https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap-simplified.json",graphTitle:m,colors:z,sources:q,graphDescription:g,height:l,width:c,footNote:B="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.",colorDomain:te,colorLegendTitle:h,scaleType:H="threshold",padding:I,mapNoDataColor:U=T.Colors.light.graphNoData,backgroundColor:E=!1,mapBorderColor:re=T.Colors.light.grays["gray-500"],relativeHeight:x,tooltip:A,graphID:oe,mapProperty:se="ISO3",dataDownload:w=!1,language:k="en",minHeight:v=0,theme:O="light",ariaLabel:V,styles:y,classNames:R,autoRotate:G=!0,enableZoom:$=!0,globeMaterial:F,centerPoint:W=[0,0],atmosphereColor:ae="#999",showColorScale:D=!0,resetSelectionOnDoubleClick:N=!0,detailsOnClick:J,onSeriesMouseOver:X,onSeriesMouseClick:ie,highlightedIds:i=[],highlightedAltitude:j=.1,scale:L=1,globeOffset:P=[0,0],polygonAltitude:Z=.01,globeCurvatureResolution:ne=4,atmosphereAltitude:Y=.15,fogSettings:K,lights:le=[{type:"ambient",color:4210752,intensity:.4},{type:"directional",color:16777215,intensity:1,position:{x:5,y:10,z:5}}]}=e,[C,_]=n.useState(void 0),[f,Q]=n.useState(0),[S,ee]=n.useState(0),t=n.useRef(null);n.useEffect(()=>{const r=new ResizeObserver(p=>{Q(c||p[0].target.clientWidth||760),ee(l||p[0].target.clientHeight||480)});return t.current&&(ee(t.current.clientHeight||480),Q(t.current.clientWidth||760),c||r.observe(t.current)),()=>r.disconnect()},[c,l]),n.useEffect(()=>{typeof u=="string"?De.fetchAndParseJSON(u).then(p=>{if(u==="https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap-simplified.json"){const d=p.features.map(b=>{if(b.geometry.type==="Polygon"){const ce=[...b.geometry.coordinates[0]].reverse(),de={...b.geometry,coordinates:[ce]};return{...b,geometry:de}}const ue=[];b.geometry.coordinates.forEach(ce=>{const de=[...ce[0]].reverse();ue.push([de])});const he={...b.geometry,coordinates:ue};return{...b,geometry:he}});_(d)}else _(p.features)}):_(u.features)},[u]);const a=te||(H==="categorical"?Ne.getUniqValue(o,"x"):Me.getJenks(o.map(r=>r.x),z?.length||4));return s.jsxRuntimeExports.jsx("div",{className:`${O||"light"} flex ${c?"w-fit grow-0":"w-full grow"}`,dir:k==="he"||k==="ar"?"rtl":void 0,children:s.jsxRuntimeExports.jsx("div",{className:s.mo(`${E?E===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${k||"en"}`,c?"w-fit":"w-full",R?.graphContainer),style:{...y?.graphContainer||{},...E&&E!==!0?{backgroundColor:E}:{}},id:oe,"aria-label":V||`${m?`The graph shows ${m}. `:""}This is a map.${g?` ${g}`:""}`,children:s.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:E?I||"1rem":I||0},children:s.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[m||g||w?s.jsxRuntimeExports.jsx(Se.GraphHeader,{styles:{title:y?.title,description:y?.description},classNames:{title:R?.title,description:R?.description},graphTitle:m,graphDescription:g,width:c,graphDownload:void 0,dataDownload:w?o.map(r=>r.data).filter(r=>r!==void 0).length>0?o.map(r=>r.data).filter(r=>r!==void 0):o.filter(r=>r!==void 0):null}):null,s.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:t,"aria-label":"Map area",children:(c||f)&&(l||S)&&C?s.jsxRuntimeExports.jsx(Le,{data:o,globeOffset:P,polygonData:C,colorDomain:a,width:c||f,height:Math.max(v,l||(x?v?(c||f)*x>v?(c||f)*x:v:(c||f)*x:S)),colors:z||(H==="categorical"?T.Colors[O].sequentialColors[`neutralColorsx0${a.length}`]:T.Colors[O].sequentialColors[`neutralColorsx0${a.length+1}`]),mapNoDataColor:U,categorical:H==="categorical",mapBorderColor:re,tooltip:A,mapProperty:se,styles:y,classNames:R,autoRotate:G===!0?1.5:G===!1?0:G,enableZoom:$,globeMaterial:F,atmosphereColor:ae,colorLegendTitle:h,showColorScale:D,hoverStrokeColor:O==="light"?T.Colors.light.grays["gray-700"]:T.Colors.light.grays["gray-300"],highlightedIds:i,resetSelectionOnDoubleClick:N,detailsOnClick:J,onSeriesMouseOver:X,onSeriesMouseClick:ie,scale:L,polygonAltitude:Z,centerLat:W[0],centerLng:W[1],atmosphereAltitude:Y,globeCurvatureResolution:ne,fogSettings:K,lights:le,highlightedAltitude:j}):s.jsxRuntimeExports.jsx("div",{style:{height:`${Math.max(v,l||(x?v?(c||f)*x>v?(c||f)*x:v:(c||f)*x:S))}px`},className:"flex items-center justify-center",children:s.jsxRuntimeExports.jsx(me.y,{"aria-label":"Loading graph"})})}),q||B?s.jsxRuntimeExports.jsx(ke.GraphFooter,{styles:{footnote:y?.footnote,source:y?.source},classNames:{footnote:R?.footnote,source:R?.source},sources:q,footNote:B,width:c}):null]})})})})}exports.ThreeDGlobe=Pe;
|
|
2
2
|
//# sourceMappingURL=ThreeDGlobe.cjs.map
|
package/dist/ThreeDGlobe.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThreeDGlobe.cjs","sources":["../src/Components/Graphs/Maps/ThreeDGlobe/Graph.tsx","../src/Components/Graphs/Maps/ThreeDGlobe/index.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\r\nimport Globe, { GlobeMethods } from 'react-globe.gl';\r\nimport isEqual from 'fast-deep-equal';\r\nimport { useEffect, useRef, useState } from 'react';\r\nimport { scaleOrdinal, scaleThreshold } from 'd3-scale';\r\nimport * as THREE from 'three';\r\nimport { Modal } from '@undp/design-system-react/Modal';\r\nimport { P } from '@undp/design-system-react/Typography';\r\n\r\nimport { ChoroplethMapDataType, ClassNameObject, FogDataType, StyleObject } from '@/Types';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { X } from '@/Components/Icons';\r\nimport { string2HTML } from '@/Utils/string2HTML';\r\n\r\ninterface Props {\r\n width: number;\r\n data: ChoroplethMapDataType[];\r\n autoRotate: number;\r\n enableZoom: boolean;\r\n categorical: boolean;\r\n colorDomain: number[] | string[];\r\n colors: string[];\r\n height: number;\r\n globeMaterial?: THREE.Material;\r\n polygonData: any;\r\n mapProperty: string;\r\n mapBorderColor: string;\r\n atmosphereColor: string;\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n onSeriesMouseOver?: (_d: any) => void;\r\n onSeriesMouseClick?: (_d: any) => void;\r\n mapNoDataColor: string;\r\n colorLegendTitle?: string;\r\n showColorScale: boolean;\r\n hoverStrokeColor: string;\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n resetSelectionOnDoubleClick: boolean;\r\n highlightedIds: string[];\r\n scale: number;\r\n globeOffset: [number, number];\r\n polygonAltitude: number;\r\n centerLng: number;\r\n centerLat: number;\r\n atmosphereAltitude: number;\r\n globeCurvatureResolution: number;\r\n lightColor: string;\r\n fogSettings?: FogDataType;\r\n}\r\n\r\nfunction Graph(props: Props) {\r\n const {\r\n width,\r\n autoRotate,\r\n data,\r\n enableZoom,\r\n categorical,\r\n colorDomain,\r\n colors,\r\n globeMaterial,\r\n height,\r\n polygonData,\r\n mapProperty,\r\n mapBorderColor,\r\n atmosphereColor,\r\n tooltip,\r\n styles,\r\n classNames,\r\n mapNoDataColor,\r\n colorLegendTitle,\r\n showColorScale,\r\n hoverStrokeColor,\r\n detailsOnClick,\r\n onSeriesMouseClick,\r\n onSeriesMouseOver,\r\n resetSelectionOnDoubleClick,\r\n highlightedIds,\r\n scale,\r\n globeOffset,\r\n polygonAltitude,\r\n centerLng,\r\n centerLat,\r\n atmosphereAltitude,\r\n globeCurvatureResolution,\r\n lightColor,\r\n fogSettings,\r\n } = props;\r\n const globeEl = useRef<GlobeMethods | undefined>(undefined);\r\n const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n const [showLegend, setShowLegend] = useState(!(width < 680));\r\n const [mousePos, setMousePos] = useState({ x: 0, y: 0 });\r\n const [mouseOverData, setMouseOverData] = useState<ChoroplethMapDataType | undefined>(undefined);\r\n const colorScale = categorical\r\n ? scaleOrdinal<number | string, string>().domain(colorDomain).range(colors)\r\n : scaleThreshold<number, string>()\r\n .domain(colorDomain as number[])\r\n .range(colors);\r\n useEffect(() => {\r\n if (globeEl.current) {\r\n globeEl.current.controls().enableZoom = enableZoom;\r\n }\r\n }, [enableZoom]);\r\n useEffect(() => {\r\n if (globeEl.current) {\r\n if (mouseOverData) {\r\n globeEl.current.controls().autoRotate = false;\r\n } else {\r\n globeEl.current.controls().autoRotate = autoRotate === 0 ? false : true;\r\n globeEl.current.controls().autoRotateSpeed = autoRotate;\r\n }\r\n }\r\n }, [mouseOverData, autoRotate]);\r\n\r\n useEffect(() => {\r\n const canvas = globeEl.current?.renderer().domElement;\r\n if (!canvas) return;\r\n\r\n const handleMouseMove = (e: MouseEvent) => {\r\n setMousePos({ x: e.clientX, y: e.clientY });\r\n };\r\n\r\n canvas.addEventListener('mousemove', handleMouseMove);\r\n return () => canvas.removeEventListener('mousemove', handleMouseMove);\r\n }, []);\r\n\r\n useEffect(() => {\r\n if (globeEl.current) {\r\n globeEl.current.pointOfView({ lat: centerLat, lng: centerLng, altitude: scale }, 1000);\r\n }\r\n }, [scale, centerLng, centerLat]);\r\n const materials =\r\n globeMaterial ||\r\n new THREE.MeshBasicMaterial({\r\n color: '#FFF',\r\n });\r\n useEffect(() => {\r\n if (!globeEl.current) return;\r\n\r\n const scene = globeEl.current.scene();\r\n scene.children\r\n .filter(d => d.type === 'DirectionalLight' || d.type === 'AmbientLight')\r\n .forEach(d => scene.remove(d));\r\n const ambientLight = new THREE.AmbientLight(lightColor, 0.2);\r\n scene.add(ambientLight);\r\n setTimeout(() => {\r\n const polygons = scene.children[3]?.children[0]?.children[4]?.children || [];\r\n polygons.forEach(d => {\r\n const line = d.children[1];\r\n if (line) line.renderOrder = 2;\r\n });\r\n }, 300);\r\n if (fogSettings)\r\n scene.fog = new THREE.Fog(fogSettings.color, fogSettings.near, fogSettings.far);\r\n }, [lightColor, scale, fogSettings]);\r\n return (\r\n <div className='relative'>\r\n <Globe\r\n ref={globeEl}\r\n height={height}\r\n width={width}\r\n globeOffset={globeOffset}\r\n lineHoverPrecision={0}\r\n polygonsData={polygonData}\r\n polygonAltitude={(polygon: any) =>\r\n highlightedIds.includes(polygon?.properties?.[mapProperty])\r\n ? 0.1\r\n : polygon?.properties?.[mapProperty] === mouseOverData?.id\r\n ? 0.01\r\n : polygonAltitude\r\n }\r\n polygonCapColor={(polygon: any) => {\r\n const id = polygon?.properties?.[mapProperty];\r\n const val = data.find(el => el.id === id)?.x;\r\n if (val !== undefined && val !== null) {\r\n return colorScale(val as any);\r\n }\r\n return mapNoDataColor;\r\n }}\r\n polygonSideColor={(polygon: any) => {\r\n const id = polygon?.properties?.[mapProperty];\r\n const val = data.find(el => el.id === id)?.x;\r\n const color = val !== undefined && val !== null ? colorScale(val as any) : mapNoDataColor;\r\n return highlightedIds.includes(polygon?.properties?.[mapProperty])\r\n ? color\r\n : 'rgba(100,100,100,0)';\r\n }}\r\n polygonStrokeColor={(polygon: any) =>\r\n polygon?.properties?.[mapProperty] === mouseOverData?.id\r\n ? hoverStrokeColor\r\n : mapBorderColor\r\n }\r\n onPolygonClick={(polygon: any) => {\r\n const clickedData = polygon?.properties?.[mapProperty]\r\n ? data.find(el => el.id === polygon?.properties?.[mapProperty])\r\n : undefined;\r\n if (onSeriesMouseClick || detailsOnClick) {\r\n if (\r\n isEqual(mouseClickData, clickedData) &&\r\n resetSelectionOnDoubleClick &&\r\n clickedData\r\n ) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n setMouseClickData(clickedData);\r\n onSeriesMouseClick?.(clickedData);\r\n }\r\n }\r\n setMouseClickData(clickedData);\r\n onSeriesMouseClick?.(clickedData);\r\n }}\r\n onPolygonHover={(polygon: any) => {\r\n const hoverData = polygon?.properties?.[mapProperty]\r\n ? data.find(el => el.id === polygon?.properties?.[mapProperty])\r\n : undefined;\r\n setMouseOverData(hoverData);\r\n onSeriesMouseOver?.(hoverData);\r\n }}\r\n atmosphereColor={atmosphereColor}\r\n atmosphereAltitude={atmosphereAltitude}\r\n globeCurvatureResolution={globeCurvatureResolution}\r\n globeMaterial={materials}\r\n backgroundColor='rgba(0, 0, 0, 0)'\r\n polygonsTransitionDuration={100}\r\n onGlobeReady={() => {\r\n if (globeEl.current) {\r\n globeEl.current.pointOfView({\r\n lat: centerLat,\r\n lng: centerLng,\r\n });\r\n const scene = globeEl.current.scene();\r\n setTimeout(() => {\r\n scene.children\r\n .filter(d => d.type === 'DirectionalLight')\r\n .map(d => {\r\n scene.remove(d);\r\n });\r\n const ambientLight = new THREE.AmbientLight(lightColor, 0.2);\r\n scene.add(ambientLight);\r\n\r\n const polygons = scene.children[3]?.children[0]?.children[4]?.children || [];\r\n polygons.forEach(d => {\r\n const line = d.children[1];\r\n line.renderOrder = 2;\r\n });\r\n }, 300);\r\n const light = new THREE.DirectionalLight(0xffffff, 0.1);\r\n const camera = globeEl.current.camera();\r\n light.position.set(0, 0, 1);\r\n camera.add(light);\r\n scene.add(camera);\r\n }\r\n }}\r\n />\r\n {showColorScale === false ? null : (\r\n <div className='absolute left-4 bottom-4'>\r\n {showLegend ? (\r\n <>\r\n <div\r\n style={{\r\n backgroundColor: 'rgba(240,240,240, 0.7)',\r\n border: '1px solid var(--gray-400)',\r\n borderRadius: '999px',\r\n width: '24px',\r\n height: '24px',\r\n padding: '3px',\r\n cursor: 'pointer',\r\n zIndex: 10,\r\n position: 'absolute',\r\n right: '-0.75rem',\r\n top: '-0.75rem',\r\n }}\r\n onClick={() => {\r\n setShowLegend(false);\r\n }}\r\n >\r\n <X />\r\n </div>\r\n <div\r\n className='p-2'\r\n style={{\r\n backgroundColor: 'rgba(240,240,240, 0.7)',\r\n width: categorical ? undefined : '340px',\r\n }}\r\n >\r\n {colorLegendTitle && colorLegendTitle !== '' ? (\r\n <P\r\n size='xs'\r\n marginBottom='xs'\r\n className='p-0 leading-normal overflow-hidden text-primary-gray-700 dark:text-primary-gray-300'\r\n style={{\r\n display: '-webkit-box',\r\n WebkitLineClamp: '1',\r\n WebkitBoxOrient: 'vertical',\r\n }}\r\n >\r\n {colorLegendTitle}\r\n </P>\r\n ) : null}\r\n {!categorical ? (\r\n <svg width='100%' viewBox='0 0 320 30' direction='ltr'>\r\n <g>\r\n {colorDomain.map((d, i) => (\r\n <g key={i} className='cursor-pointer'>\r\n <rect\r\n x={(i * 320) / colors.length + 1}\r\n y={1}\r\n width={320 / colors.length - 2}\r\n height={8}\r\n style={{\r\n fill: colors[i],\r\n stroke: colors[i],\r\n }}\r\n />\r\n <text\r\n x={((i + 1) * 320) / colors.length}\r\n y={25}\r\n className='fill-primary-gray-700 dark:fill-primary-gray-300 text-xs'\r\n style={{ textAnchor: 'middle' }}\r\n >\r\n {numberFormattingFunction(d as number, 'NA')}\r\n </text>\r\n </g>\r\n ))}\r\n <g>\r\n <rect\r\n x={(colorDomain.length * 320) / colors.length + 1}\r\n y={1}\r\n width={320 / colors.length - 2}\r\n height={8}\r\n style={{\r\n fill: colors[colorDomain.length],\r\n stroke: colors[colorDomain.length],\r\n }}\r\n />\r\n </g>\r\n </g>\r\n </svg>\r\n ) : (\r\n <div className='flex flex-col gap-3'>\r\n {colorDomain.map((d, i) => (\r\n <div key={i} className='flex gap-2 items-center'>\r\n <div\r\n className='w-2 h-2 rounded-full'\r\n style={{ backgroundColor: colors[i % colors.length] }}\r\n />\r\n <P size='sm' marginBottom='none' leading='none'>\r\n {d}\r\n </P>\r\n </div>\r\n ))}\r\n </div>\r\n )}\r\n </div>\r\n </>\r\n ) : (\r\n <button\r\n type='button'\r\n className='mb-0 border-0 bg-transparent p-0 self-start'\r\n onClick={() => {\r\n setShowLegend(true);\r\n }}\r\n >\r\n <div className='items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-550 border-primary-gray-400 dark:border-primary-gray-500'>\r\n Show Legend\r\n </div>\r\n </button>\r\n )}\r\n </div>\r\n )}\r\n {mouseOverData && tooltip ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={mousePos.x}\r\n yPos={mousePos.y}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n {detailsOnClick && mouseClickData !== undefined ? (\r\n <Modal\r\n open={mouseClickData !== undefined}\r\n onClose={() => {\r\n setMouseClickData(undefined);\r\n }}\r\n >\r\n <div\r\n className='graph-modal-content m-0'\r\n dangerouslySetInnerHTML={\r\n typeof detailsOnClick === 'string'\r\n ? { __html: string2HTML(detailsOnClick, mouseClickData) }\r\n : undefined\r\n }\r\n >\r\n {typeof detailsOnClick === 'function' ? detailsOnClick(mouseClickData) : null}\r\n </div>\r\n </Modal>\r\n ) : null}\r\n </div>\r\n );\r\n}\r\n\r\nexport default Graph;\r\n","import React, { useEffect, useRef, useState } from 'react';\r\nimport { Spinner } from '@undp/design-system-react/Spinner';\r\nimport * as THREE from 'three';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport Globe from 'react-globe.gl';\r\n\r\nimport Graph from './Graph';\r\n\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport {\r\n ChoroplethMapDataType,\r\n ClassNameObject,\r\n FogDataType,\r\n Languages,\r\n ScaleDataType,\r\n SourcesDataType,\r\n StyleObject,\r\n} from '@/Types';\r\nimport { fetchAndParseJSON } from '@/Utils/fetchAndParseData';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { getUniqValue } from '@/Utils/getUniqValue';\r\nimport { getJenks } from '@/Utils/getJenks';\r\n\r\ntype GlobeProps = React.ComponentProps<typeof Globe>;\r\ninterface Props extends Partial<Omit<GlobeProps, 'backgroundColor'>> {\r\n // Data\r\n /** Array of data objects */\r\n data: ChoroplethMapDataType[];\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 /** Colors for the choropleth map */\r\n colors?: string[];\r\n /** Domain of colors for the graph */\r\n colorDomain?: number[] | string[];\r\n /** Title for the color legend */\r\n colorLegendTitle?: string;\r\n /** Color for the areas where data is no available */\r\n mapNoDataColor?: 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\r\n // Graph Parameters\r\n /** Map data as an object in geoJson format or a url for geoJson */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapData?: any;\r\n /** Stroke color of the regions in the map */\r\n mapBorderColor?: string;\r\n /** Center point of the map */\r\n centerPoint?: [number, number];\r\n /** Defines if the globe rotates automatically */\r\n autoRotate?: number | boolean;\r\n /** Defines the material property applied to the sphere of the globe */\r\n globeMaterial?: THREE.Material;\r\n /** Defines the colo of the glow around the globe */\r\n atmosphereColor?: string;\r\n /** Defines if the globe can be zoomed when scrolled */\r\n enableZoom?: boolean;\r\n /** Position offset of the globe relative to the canvas center */\r\n globeOffset?: [number, number];\r\n /** Defines the camera distance from Earth. This helps in defining the default size of the globe. Smaller = closer camera therefore the globe is bigger) */\r\n scale?: number;\r\n /** Defines the spacing between the country shape polygon with the sphere */\r\n polygonAltitude?: number;\r\n /** Scale for the colors */\r\n scaleType?: Exclude<ScaleDataType, 'linear'>;\r\n /** Toggles if the color scaling is categorical or not */\r\n categorical?: boolean;\r\n /** Toggle visibility of color scale. */\r\n showColorScale?: boolean;\r\n /** The max altitude of the atmosphere, in terms of globe radius units. */\r\n atmosphereAltitude?: number;\r\n /** Resolution in angular degrees of the sphere curvature. The finer the resolution, the more the globe is fragmented into smaller faces to approximate the spheric surface, at the cost of performance. */\r\n globeCurvatureResolution?: number;\r\n /** Defines the color of the light and atmosphere. */\r\n lightColor?: string;\r\n /** Defines fog settings for the scene. */\r\n fogSettings?: FogDataType;\r\n /** Property in the property object in mapData geoJson object is used to match to the id in the data object */\r\n mapProperty?: string;\r\n /** Countries or regions to be highlighted */\r\n highlightedIds?: string[];\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\n/** For using these maps you will have to install [`three`](https://threejs.org/manual/) and [react-globe.gl](https://www.npmjs.com/package/react-globe.gl) package to your project */\r\nexport function ThreeDGlobe(props: Props) {\r\n const {\r\n data,\r\n mapData = 'https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap-simplified.json',\r\n graphTitle,\r\n colors,\r\n sources,\r\n graphDescription,\r\n height,\r\n width,\r\n footNote = '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.',\r\n colorDomain,\r\n colorLegendTitle,\r\n scaleType = 'threshold',\r\n padding,\r\n mapNoDataColor = Colors.light.graphNoData,\r\n backgroundColor = false,\r\n mapBorderColor = Colors.light.grays['gray-500'],\r\n relativeHeight,\r\n tooltip,\r\n graphID,\r\n mapProperty = 'ISO3',\r\n dataDownload = false,\r\n language = 'en',\r\n minHeight = 0,\r\n theme = 'light',\r\n ariaLabel,\r\n styles,\r\n classNames,\r\n autoRotate = true,\r\n enableZoom = true,\r\n globeMaterial,\r\n centerPoint = [0, 0],\r\n atmosphereColor = '#999',\r\n showColorScale = true,\r\n resetSelectionOnDoubleClick = true,\r\n detailsOnClick,\r\n onSeriesMouseOver,\r\n onSeriesMouseClick,\r\n highlightedIds = [],\r\n scale = 1,\r\n globeOffset = [0, 0],\r\n polygonAltitude = 0.01,\r\n globeCurvatureResolution = 4,\r\n atmosphereAltitude = 0.15,\r\n lightColor = '#dce9fe',\r\n fogSettings,\r\n } = props;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mapShape, setMapShape] = useState<any>(undefined);\r\n\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(width || entries[0].target.clientWidth || 760);\r\n setSvgHeight(height || entries[0].target.clientHeight || 480);\r\n });\r\n if (graphDiv.current) {\r\n setSvgHeight(graphDiv.current.clientHeight || 480);\r\n setSvgWidth(graphDiv.current.clientWidth || 760);\r\n if (!width) resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, [width, height]);\r\n useEffect(() => {\r\n if (typeof mapData === 'string') {\r\n const fetchData = fetchAndParseJSON(mapData);\r\n fetchData.then(d => {\r\n if (\r\n mapData ===\r\n 'https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap-simplified.json'\r\n ) {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const features = d.features.map((el: any) => {\r\n if (el.geometry.type === 'Polygon') {\r\n const reversed = [...el.geometry.coordinates[0]].reverse();\r\n const geometry = { ...el.geometry, coordinates: [reversed] };\r\n return { ...el, geometry };\r\n }\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const coord: any = [];\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n el.geometry.coordinates.forEach((c: any) => {\r\n const reversed = [...c[0]].reverse();\r\n coord.push([reversed]);\r\n });\r\n const geometry = { ...el.geometry, coordinates: coord };\r\n return { ...el, geometry };\r\n });\r\n setMapShape(features);\r\n } else setMapShape(d.features);\r\n });\r\n } else {\r\n setMapShape(mapData.features);\r\n }\r\n }, [mapData]);\r\n\r\n const domain =\r\n colorDomain ||\r\n (scaleType === 'categorical'\r\n ? getUniqValue(data, 'x')\r\n : getJenks(\r\n data.map(d => d.x as number | null | undefined),\r\n colors?.length || 4,\r\n ));\r\n return (\r\n <div\r\n className={`${theme || 'light'} flex ${width ? 'w-fit grow-0' : 'w-full grow'}`}\r\n dir={language === 'he' || language === 'ar' ? 'rtl' : undefined}\r\n >\r\n <div\r\n className={cn(\r\n `${\r\n !backgroundColor\r\n ? 'bg-transparent '\r\n : backgroundColor === true\r\n ? 'bg-primary-gray-200 dark:bg-primary-gray-650 '\r\n : ''\r\n }ml-auto mr-auto flex flex-col grow h-inherit ${language || 'en'}`,\r\n width ? 'w-fit' : 'w-full',\r\n classNames?.graphContainer,\r\n )}\r\n style={{\r\n ...(styles?.graphContainer || {}),\r\n ...(backgroundColor && backgroundColor !== true ? { backgroundColor } : {}),\r\n }}\r\n id={graphID}\r\n aria-label={\r\n ariaLabel ||\r\n `${\r\n graphTitle ? `The graph shows ${graphTitle}. ` : ''\r\n }This is a map.${graphDescription ? ` ${graphDescription}` : ''}`\r\n }\r\n >\r\n <div\r\n className='flex grow'\r\n style={{ padding: backgroundColor ? padding || '1rem' : padding || 0 }}\r\n >\r\n <div className='flex flex-col w-full gap-4 grow justify-between'>\r\n {graphTitle || graphDescription || 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={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 <div\r\n className='flex flex-col grow justify-center leading-0'\r\n ref={graphDiv}\r\n aria-label='Map area'\r\n >\r\n {(width || svgWidth) && (height || svgHeight) && mapShape ? (\r\n <Graph\r\n data={data}\r\n globeOffset={globeOffset}\r\n polygonData={mapShape}\r\n colorDomain={domain}\r\n width={width || svgWidth}\r\n height={Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}\r\n colors={\r\n colors ||\r\n (scaleType === 'categorical'\r\n ? Colors[theme].sequentialColors[\r\n `neutralColorsx0${domain.length as 4 | 5 | 6 | 7 | 8 | 9}`\r\n ]\r\n : Colors[theme].sequentialColors[\r\n `neutralColorsx0${(domain.length + 1) as 4 | 5 | 6 | 7 | 8 | 9}`\r\n ])\r\n }\r\n mapNoDataColor={mapNoDataColor}\r\n categorical={scaleType === 'categorical'}\r\n mapBorderColor={mapBorderColor}\r\n tooltip={tooltip}\r\n mapProperty={mapProperty}\r\n styles={styles}\r\n classNames={classNames}\r\n autoRotate={autoRotate === true ? 1.5 : autoRotate === false ? 0 : autoRotate}\r\n enableZoom={enableZoom}\r\n globeMaterial={globeMaterial}\r\n atmosphereColor={atmosphereColor}\r\n colorLegendTitle={colorLegendTitle}\r\n showColorScale={showColorScale}\r\n hoverStrokeColor={\r\n theme === 'light'\r\n ? Colors.light.grays['gray-700']\r\n : Colors.light.grays['gray-300']\r\n }\r\n highlightedIds={highlightedIds}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n detailsOnClick={detailsOnClick}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n scale={scale}\r\n polygonAltitude={polygonAltitude}\r\n centerLat={centerPoint[0]}\r\n centerLng={centerPoint[1]}\r\n atmosphereAltitude={atmosphereAltitude}\r\n globeCurvatureResolution={globeCurvatureResolution}\r\n lightColor={lightColor}\r\n fogSettings={fogSettings}\r\n />\r\n ) : (\r\n <div\r\n style={{\r\n height: `${Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}px`,\r\n }}\r\n className='flex items-center justify-center'\r\n >\r\n <Spinner aria-label='Loading graph' />\r\n </div>\r\n )}\r\n </div>\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 </div>\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n}\r\n"],"names":["Graph","props","width","autoRotate","data","enableZoom","categorical","colorDomain","colors","globeMaterial","height","polygonData","mapProperty","mapBorderColor","atmosphereColor","tooltip","styles","classNames","mapNoDataColor","colorLegendTitle","showColorScale","hoverStrokeColor","detailsOnClick","onSeriesMouseClick","onSeriesMouseOver","resetSelectionOnDoubleClick","highlightedIds","scale","globeOffset","polygonAltitude","centerLng","centerLat","atmosphereAltitude","globeCurvatureResolution","lightColor","fogSettings","globeEl","useRef","mouseClickData","setMouseClickData","useState","showLegend","setShowLegend","mousePos","setMousePos","mouseOverData","setMouseOverData","colorScale","scaleOrdinal","scaleThreshold","useEffect","canvas","handleMouseMove","e","materials","THREE","scene","d","ambientLight","line","jsxs","jsx","Globe","polygon","id","val","el","color","clickedData","isEqual","hoverData","light","camera","Fragment","X","P","i","numberFormattingFunction","Tooltip","Modal","string2HTML","ThreeDGlobe","mapData","graphTitle","sources","graphDescription","footNote","scaleType","padding","Colors","backgroundColor","relativeHeight","graphID","dataDownload","language","minHeight","theme","ariaLabel","centerPoint","mapShape","setMapShape","svgWidth","setSvgWidth","svgHeight","setSvgHeight","graphDiv","resizeObserver","entries","fetchAndParseJSON","features","reversed","geometry","coord","c","domain","getUniqValue","getJenks","cn","GraphHeader","Spinner","GraphFooter"],"mappings":"ikCAoDA,SAASA,GAAMC,EAAc,CAC3B,KAAM,CACJ,MAAAC,EACA,WAAAC,EACA,KAAAC,EACA,WAAAC,EACA,YAAAC,EACA,YAAAC,EACA,OAAAC,EACA,cAAAC,EACA,OAAAC,EACA,YAAAC,EACA,YAAAC,EACA,eAAAC,EACA,gBAAAC,EACA,QAAAC,EACA,OAAAC,EACA,WAAAC,EACA,eAAAC,EACA,iBAAAC,EACA,eAAAC,EACA,iBAAAC,GACA,eAAAC,EACA,mBAAAC,EACA,kBAAAC,EACA,4BAAAC,EACA,eAAAC,EACA,MAAAC,EACA,YAAAC,EACA,gBAAAC,EACA,UAAAC,EACA,UAAAC,EACA,mBAAAC,EACA,yBAAAC,GACA,WAAAC,EACA,YAAAC,CAAA,EACElC,EACEmC,EAAUC,EAAAA,OAAiC,MAAS,EACpD,CAACC,EAAgBC,CAAiB,EAAIC,EAAAA,SAAc,MAAS,EAC7D,CAACC,GAAYC,CAAa,EAAIF,EAAAA,SAAS,EAAEtC,EAAQ,IAAI,EACrD,CAACyC,EAAUC,EAAW,EAAIJ,EAAAA,SAAS,CAAE,EAAG,EAAG,EAAG,EAAG,EACjD,CAACK,EAAeC,EAAgB,EAAIN,EAAAA,SAA4C,MAAS,EACzFO,EAAazC,EACf0C,GAAAA,QAAA,EAAwC,OAAOzC,C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,EACnE,WAAAE,EACA,cAAAI,EACA,gBAAAK,GACA,iBAAAK,EACA,eAAAC,EACA,iBACE4E,IAAU,QACNP,EAAAA,OAAO,MAAM,MAAM,UAAU,EAC7BA,EAAAA,OAAO,MAAM,MAAM,UAAU,EAEnC,eAAA/D,GACA,4BAAAD,EACA,eAAAH,EACA,kBAAAE,EACA,mBAAAD,EACA,MAAAI,EACA,gBAAAE,GACA,UAAWqE,EAAY,CAAC,EACxB,UAAWA,EAAY,CAAC,EACxB,mBAAAlE,GACA,yBAAAC,EACA,WAAAC,EACA,YAAAC,EAAA,CAAA,EAGF0B,EAAAA,kBAAAA,IAAC,MAAA,CACC,MAAO,CACL,OAAQ,GAAG,KAAK,IACdkC,EACArF,IACGiF,EACGI,GACG7F,GAASmG,GAAYV,EAAiBI,GACpC7F,GAASmG,GAAYV,EACtBI,GACD7F,GAASmG,GAAYV,EACxBY,EAAA,CACP,IAAA,EAEH,UAAU,mCAEV,SAAA1C,EAAAA,kBAAAA,IAAC0D,GAAAA,EAAA,CAAQ,aAAW,eAAA,CAAgB,CAAA,CAAA,CACtC,CAAA,EAGHnC,GAAWE,EACVzB,EAAAA,kBAAAA,IAAC2D,GAAAA,YAAA,CACC,OAAQ,CAAE,SAAUxG,GAAQ,SAAU,OAAQA,GAAQ,MAAA,EACtD,WAAY,CACV,SAAUC,GAAY,SACtB,OAAQA,GAAY,MAAA,EAEtB,QAAAmE,EACA,SAAAE,EACA,MAAApF,CAAA,CAAA,EAEA,IAAA,CAAA,CACN,CAAA,CAAA,CACF,CAAA,CACF,CAAA,CAGN"}
|
|
1
|
+
{"version":3,"file":"ThreeDGlobe.cjs","sources":["../src/Components/Graphs/Maps/ThreeDGlobe/Graph.tsx","../src/Components/Graphs/Maps/ThreeDGlobe/index.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\r\nimport Globe, { GlobeMethods } from 'react-globe.gl';\r\nimport isEqual from 'fast-deep-equal';\r\nimport { useCallback, useEffect, useRef, useState } from 'react';\r\nimport { scaleOrdinal, scaleThreshold } from 'd3-scale';\r\nimport * as THREE from 'three';\r\nimport { Modal } from '@undp/design-system-react/Modal';\r\nimport { P } from '@undp/design-system-react/Typography';\r\nimport centerOfMass from '@turf/center-of-mass';\r\n\r\nimport {\r\n ChoroplethMapDataType,\r\n ClassNameObject,\r\n FogDataType,\r\n LightConfig,\r\n StyleObject,\r\n} from '@/Types';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { X } from '@/Components/Icons';\r\nimport { string2HTML } from '@/Utils/string2HTML';\r\n\r\ninterface Props {\r\n width: number;\r\n data: ChoroplethMapDataType[];\r\n autoRotate: number;\r\n enableZoom: boolean;\r\n categorical: boolean;\r\n colorDomain: number[] | string[];\r\n colors: string[];\r\n height: number;\r\n globeMaterial?: THREE.Material;\r\n lights: LightConfig[];\r\n polygonData: any;\r\n mapProperty: string;\r\n mapBorderColor: string;\r\n atmosphereColor: string;\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n onSeriesMouseOver?: (_d: any) => void;\r\n onSeriesMouseClick?: (_d: any) => void;\r\n mapNoDataColor: string;\r\n colorLegendTitle?: string;\r\n showColorScale: boolean;\r\n hoverStrokeColor: string;\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n resetSelectionOnDoubleClick: boolean;\r\n highlightedIds: string[];\r\n scale: number;\r\n globeOffset: [number, number];\r\n polygonAltitude: number;\r\n centerLng: number;\r\n centerLat: number;\r\n atmosphereAltitude: number;\r\n globeCurvatureResolution: number;\r\n fogSettings?: FogDataType;\r\n highlightedAltitude: number;\r\n}\r\n\r\nfunction createLightFromConfig(config: LightConfig): THREE.Light {\r\n let light: THREE.Light;\r\n\r\n switch (config.type) {\r\n case 'ambient':\r\n light = new THREE.AmbientLight(config.color, config.intensity);\r\n break;\r\n case 'directional':\r\n light = new THREE.DirectionalLight(config.color, config.intensity);\r\n if (config.position) {\r\n if (config.position === 'camera') light.position.set(0, 0, 0);\r\n else light.position.set(config.position.x, config.position.y, config.position.z);\r\n }\r\n if (config.target || config.position === 'camera') {\r\n (light as THREE.SpotLight).target.position.set(\r\n config.target?.x || 0,\r\n config.target?.y || 0,\r\n config.target?.z === undefined ? -1 : config.target.z,\r\n );\r\n }\r\n if (config.castShadow) {\r\n (light as THREE.DirectionalLight).castShadow = true;\r\n if (config.shadow) {\r\n (light as THREE.DirectionalLight).shadow.mapSize.width = config.shadow.mapSize.width;\r\n (light as THREE.DirectionalLight).shadow.mapSize.height = config.shadow.mapSize.height;\r\n (light as THREE.DirectionalLight).shadow.camera.near = config.shadow.camera.near;\r\n (light as THREE.DirectionalLight).shadow.camera.far = config.shadow.camera.far;\r\n }\r\n }\r\n break;\r\n case 'point':\r\n light = new THREE.PointLight(\r\n config.color,\r\n config.intensity,\r\n config.distance || 0,\r\n config.decay || 2,\r\n );\r\n if (config.position) {\r\n if (config.position === 'camera') light.position.set(0, 0, 0);\r\n else light.position.set(config.position.x, config.position.y, config.position.z);\r\n }\r\n break;\r\n case 'spot':\r\n light = new THREE.SpotLight(\r\n config.color,\r\n config.intensity,\r\n config.distance || 0,\r\n config.angle || Math.PI / 3,\r\n config.penumbra || 0,\r\n config.decay || 2,\r\n );\r\n if (config.position) {\r\n if (config.position === 'camera') light.position.set(0, 0, 0);\r\n else light.position.set(config.position.x, config.position.y, config.position.z);\r\n }\r\n if (config.target || config.position === 'camera') {\r\n (light as THREE.SpotLight).target.position.set(\r\n config.target?.x || 0,\r\n config.target?.y || 0,\r\n config.target?.z || 0,\r\n );\r\n }\r\n if (config.castShadow) {\r\n (light as THREE.SpotLight).castShadow = true;\r\n if (config.shadow) {\r\n (light as THREE.SpotLight).shadow.mapSize.width = config.shadow.mapSize.width;\r\n (light as THREE.SpotLight).shadow.mapSize.height = config.shadow.mapSize.height;\r\n (light as THREE.SpotLight).shadow.camera.near = config.shadow.camera.near;\r\n (light as THREE.SpotLight).shadow.camera.far = config.shadow.camera.far;\r\n }\r\n }\r\n break;\r\n default:\r\n throw new Error('Unknown light type');\r\n }\r\n\r\n return light;\r\n}\r\nfunction Graph(props: Props) {\r\n const {\r\n width,\r\n autoRotate,\r\n data,\r\n enableZoom,\r\n categorical,\r\n colorDomain,\r\n colors,\r\n globeMaterial,\r\n height,\r\n polygonData,\r\n mapProperty,\r\n mapBorderColor,\r\n atmosphereColor,\r\n tooltip,\r\n styles,\r\n classNames,\r\n mapNoDataColor,\r\n colorLegendTitle,\r\n showColorScale,\r\n hoverStrokeColor,\r\n detailsOnClick,\r\n onSeriesMouseClick,\r\n onSeriesMouseOver,\r\n resetSelectionOnDoubleClick,\r\n highlightedIds,\r\n scale,\r\n globeOffset,\r\n polygonAltitude,\r\n centerLng,\r\n centerLat,\r\n atmosphereAltitude,\r\n globeCurvatureResolution,\r\n fogSettings,\r\n lights,\r\n highlightedAltitude,\r\n } = props;\r\n const [globeReady, setGlobeReady] = useState(false);\r\n const globeEl = useRef<GlobeMethods | undefined>(undefined);\r\n const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n const [mouseClickCentroid, setMouseClickCentroid] = useState<[number, number] | undefined>(\r\n undefined,\r\n );\r\n const [showLegend, setShowLegend] = useState(!(width < 680));\r\n const [mousePos, setMousePos] = useState({ x: 0, y: 0 });\r\n const [mouseOverData, setMouseOverData] = useState<ChoroplethMapDataType | undefined>(undefined);\r\n const colorScale = categorical\r\n ? scaleOrdinal<number | string, string>().domain(colorDomain).range(colors)\r\n : scaleThreshold<number, string>()\r\n .domain(colorDomain as number[])\r\n .range(colors);\r\n useEffect(() => {\r\n if (globeEl.current) {\r\n globeEl.current.controls().enableZoom = enableZoom;\r\n }\r\n }, [enableZoom]);\r\n useEffect(() => {\r\n if (globeEl.current) {\r\n if (mouseOverData || mouseClickData) {\r\n globeEl.current.controls().autoRotate = false;\r\n } else {\r\n globeEl.current.controls().autoRotate = autoRotate === 0 ? false : true;\r\n globeEl.current.controls().autoRotateSpeed = autoRotate;\r\n }\r\n }\r\n }, [mouseOverData, mouseClickData, autoRotate]);\r\n useEffect(() => {\r\n if (globeEl.current && mouseClickCentroid) {\r\n globeEl.current.pointOfView(\r\n { lat: mouseClickCentroid[1], lng: mouseClickCentroid[0], altitude: scale },\r\n 1000,\r\n );\r\n }\r\n }, [mouseClickCentroid, scale]);\r\n\r\n useEffect(() => {\r\n const canvas = globeEl.current?.renderer().domElement;\r\n if (!canvas) return;\r\n\r\n const handleMouseMove = (e: MouseEvent) => {\r\n setMousePos({ x: e.clientX, y: e.clientY });\r\n };\r\n\r\n canvas.addEventListener('mousemove', handleMouseMove);\r\n return () => canvas.removeEventListener('mousemove', handleMouseMove);\r\n }, []);\r\n\r\n useEffect(() => {\r\n if (globeEl.current) {\r\n globeEl.current.pointOfView({ lat: centerLat, lng: centerLng, altitude: scale }, 1000);\r\n }\r\n }, [scale, centerLng, centerLat]);\r\n const materials =\r\n globeMaterial ||\r\n new THREE.MeshBasicMaterial({\r\n color: '#FFF',\r\n });\r\n const setupCustomLighting = useCallback(() => {\r\n if (!globeEl.current) return;\r\n\r\n const scene = globeEl.current.scene();\r\n const camera = globeEl.current.camera();\r\n\r\n let lightsAndObjToRemove: THREE.Object3D[] = [];\r\n scene.traverse(obj => {\r\n if (obj instanceof THREE.Light) {\r\n lightsAndObjToRemove.push(obj);\r\n }\r\n });\r\n lightsAndObjToRemove = [...lightsAndObjToRemove, ...camera.children];\r\n lightsAndObjToRemove.forEach(light => light.parent?.remove(light));\r\n\r\n const lightConfig = lights.map(config => createLightFromConfig(config));\r\n lightConfig.forEach((light, i) => {\r\n if (lights[i].type !== 'ambient' && lights[i].position === 'camera') {\r\n camera.add(light);\r\n if (lights[i].type !== 'point') {\r\n camera.add((light as THREE.DirectionalLight | THREE.SpotLight).target);\r\n }\r\n } else {\r\n scene.add(light);\r\n }\r\n });\r\n\r\n if (fogSettings) {\r\n scene.fog = new THREE.Fog(fogSettings.color, fogSettings.near, fogSettings.far);\r\n }\r\n }, [lights, fogSettings]);\r\n\r\n const handleGlobeReady = useCallback(() => {\r\n setGlobeReady(true);\r\n setupCustomLighting();\r\n }, [setupCustomLighting]);\r\n useEffect(() => {\r\n if (globeReady) {\r\n setupCustomLighting();\r\n }\r\n }, [globeReady, setupCustomLighting]);\r\n return (\r\n <div className='relative'>\r\n <Globe\r\n ref={globeEl}\r\n height={height}\r\n width={width}\r\n globeOffset={globeOffset}\r\n lineHoverPrecision={0}\r\n polygonsData={polygonData}\r\n polygonAltitude={(polygon: any) =>\r\n highlightedIds.includes(polygon?.properties?.[mapProperty])\r\n ? highlightedAltitude\r\n : polygon?.properties?.[mapProperty] === mouseOverData?.id ||\r\n polygon?.properties?.[mapProperty] === mouseClickData?.id\r\n ? highlightedAltitude\r\n : polygonAltitude\r\n }\r\n polygonCapColor={(polygon: any) => {\r\n const id = polygon?.properties?.[mapProperty];\r\n const val = data.find(el => el.id === id)?.x;\r\n if (val !== undefined && val !== null) {\r\n return colorScale(val as any);\r\n }\r\n return mapNoDataColor;\r\n }}\r\n polygonSideColor={(polygon: any) => {\r\n const id = polygon?.properties?.[mapProperty];\r\n const val = data.find(el => el.id === id)?.x;\r\n const color = val !== undefined && val !== null ? colorScale(val as any) : mapNoDataColor;\r\n return highlightedIds.includes(polygon?.properties?.[mapProperty])\r\n ? color\r\n : 'rgba(100,100,100,0)';\r\n }}\r\n polygonStrokeColor={(polygon: any) =>\r\n polygon?.properties?.[mapProperty] === mouseOverData?.id\r\n ? hoverStrokeColor\r\n : mapBorderColor\r\n }\r\n onGlobeClick={() => {\r\n setMouseClickData(undefined);\r\n }}\r\n onPolygonClick={(polygon: any) => {\r\n const clickedData = polygon?.properties?.[mapProperty]\r\n ? data.find(el => el.id === polygon?.properties?.[mapProperty])\r\n : undefined;\r\n if (onSeriesMouseClick || detailsOnClick) {\r\n if (\r\n isEqual(mouseClickData, clickedData) &&\r\n resetSelectionOnDoubleClick &&\r\n clickedData\r\n ) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n setMouseClickCentroid(undefined);\r\n } else {\r\n setMouseClickData(clickedData);\r\n onSeriesMouseClick?.(clickedData);\r\n const [lng, lat] = centerOfMass(polygon).geometry.coordinates;\r\n setMouseClickCentroid([lng, lat]);\r\n }\r\n }\r\n }}\r\n onPolygonHover={(polygon: any) => {\r\n const hoverData = polygon?.properties?.[mapProperty]\r\n ? data.find(el => el.id === polygon?.properties?.[mapProperty])\r\n : undefined;\r\n setMouseOverData(hoverData);\r\n onSeriesMouseOver?.(hoverData);\r\n }}\r\n atmosphereColor={atmosphereColor}\r\n atmosphereAltitude={atmosphereAltitude}\r\n globeCurvatureResolution={globeCurvatureResolution}\r\n globeMaterial={materials}\r\n backgroundColor='rgba(0, 0, 0, 0)'\r\n polygonsTransitionDuration={100}\r\n onGlobeReady={() => {\r\n if (globeEl.current) {\r\n globeEl.current.pointOfView({\r\n lat: centerLat,\r\n lng: centerLng,\r\n });\r\n const scene = globeEl.current.scene();\r\n setTimeout(() => {\r\n const polygons = scene.children[3]?.children[0]?.children[4]?.children || [];\r\n polygons.forEach(d => {\r\n const line = d.children[1];\r\n line.renderOrder = 2;\r\n });\r\n }, 300);\r\n const camera = globeEl.current.camera();\r\n scene.add(camera);\r\n handleGlobeReady();\r\n }\r\n }}\r\n />\r\n {showColorScale === false ? null : (\r\n <div className='absolute left-4 bottom-4'>\r\n {showLegend ? (\r\n <>\r\n <div\r\n style={{\r\n backgroundColor: 'rgba(240,240,240, 0.7)',\r\n border: '1px solid var(--gray-400)',\r\n borderRadius: '999px',\r\n width: '24px',\r\n height: '24px',\r\n padding: '3px',\r\n cursor: 'pointer',\r\n zIndex: 10,\r\n position: 'absolute',\r\n right: '-0.75rem',\r\n top: '-0.75rem',\r\n }}\r\n onClick={() => {\r\n setShowLegend(false);\r\n }}\r\n >\r\n <X />\r\n </div>\r\n <div\r\n className='p-2'\r\n style={{\r\n backgroundColor: 'rgba(240,240,240, 0.7)',\r\n width: categorical ? undefined : '340px',\r\n }}\r\n >\r\n {colorLegendTitle && colorLegendTitle !== '' ? (\r\n <P\r\n size='xs'\r\n marginBottom='xs'\r\n className='p-0 leading-normal overflow-hidden text-primary-gray-700 dark:text-primary-gray-300'\r\n style={{\r\n display: '-webkit-box',\r\n WebkitLineClamp: '1',\r\n WebkitBoxOrient: 'vertical',\r\n }}\r\n >\r\n {colorLegendTitle}\r\n </P>\r\n ) : null}\r\n {!categorical ? (\r\n <svg width='100%' viewBox='0 0 320 30' direction='ltr'>\r\n <g>\r\n {colorDomain.map((d, i) => (\r\n <g key={i} className='cursor-pointer'>\r\n <rect\r\n x={(i * 320) / colors.length + 1}\r\n y={1}\r\n width={320 / colors.length - 2}\r\n height={8}\r\n style={{\r\n fill: colors[i],\r\n stroke: colors[i],\r\n }}\r\n />\r\n <text\r\n x={((i + 1) * 320) / colors.length}\r\n y={25}\r\n className='fill-primary-gray-700 dark:fill-primary-gray-300 text-xs'\r\n style={{ textAnchor: 'middle' }}\r\n >\r\n {numberFormattingFunction(d as number, 'NA')}\r\n </text>\r\n </g>\r\n ))}\r\n <g>\r\n <rect\r\n x={(colorDomain.length * 320) / colors.length + 1}\r\n y={1}\r\n width={320 / colors.length - 2}\r\n height={8}\r\n style={{\r\n fill: colors[colorDomain.length],\r\n stroke: colors[colorDomain.length],\r\n }}\r\n />\r\n </g>\r\n </g>\r\n </svg>\r\n ) : (\r\n <div className='flex flex-col gap-3'>\r\n {colorDomain.map((d, i) => (\r\n <div key={i} className='flex gap-2 items-center'>\r\n <div\r\n className='w-2 h-2 rounded-full'\r\n style={{ backgroundColor: colors[i % colors.length] }}\r\n />\r\n <P size='sm' marginBottom='none' leading='none'>\r\n {d}\r\n </P>\r\n </div>\r\n ))}\r\n </div>\r\n )}\r\n </div>\r\n </>\r\n ) : (\r\n <button\r\n type='button'\r\n className='mb-0 border-0 bg-transparent p-0 self-start'\r\n onClick={() => {\r\n setShowLegend(true);\r\n }}\r\n >\r\n <div className='items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-550 border-primary-gray-400 dark:border-primary-gray-500'>\r\n Show Legend\r\n </div>\r\n </button>\r\n )}\r\n </div>\r\n )}\r\n {mouseOverData && tooltip ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={mousePos.x}\r\n yPos={mousePos.y}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n {detailsOnClick && mouseClickData !== undefined ? (\r\n <Modal\r\n open={mouseClickData !== undefined}\r\n onClose={() => {\r\n setMouseClickData(undefined);\r\n }}\r\n >\r\n <div\r\n className='graph-modal-content m-0'\r\n dangerouslySetInnerHTML={\r\n typeof detailsOnClick === 'string'\r\n ? { __html: string2HTML(detailsOnClick, mouseClickData) }\r\n : undefined\r\n }\r\n >\r\n {typeof detailsOnClick === 'function' ? detailsOnClick(mouseClickData) : null}\r\n </div>\r\n </Modal>\r\n ) : null}\r\n </div>\r\n );\r\n}\r\n\r\nexport default Graph;\r\n","import React, { useEffect, useRef, useState } from 'react';\r\nimport { Spinner } from '@undp/design-system-react/Spinner';\r\nimport * as THREE from 'three';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport Graph from './Graph';\r\n\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport {\r\n ChoroplethMapDataType,\r\n ClassNameObject,\r\n FogDataType,\r\n Languages,\r\n LightConfig,\r\n ScaleDataType,\r\n SourcesDataType,\r\n StyleObject,\r\n} from '@/Types';\r\nimport { fetchAndParseJSON } from '@/Utils/fetchAndParseData';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { getUniqValue } from '@/Utils/getUniqValue';\r\nimport { getJenks } from '@/Utils/getJenks';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: ChoroplethMapDataType[];\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 /** Colors for the choropleth map */\r\n colors?: string[];\r\n /** Domain of colors for the graph */\r\n colorDomain?: number[] | string[];\r\n /** Title for the color legend */\r\n colorLegendTitle?: string;\r\n /** Color for the areas where data is no available */\r\n mapNoDataColor?: 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\r\n // Graph Parameters\r\n /** Map data as an object in geoJson format or a url for geoJson */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapData?: any;\r\n /** Stroke color of the regions in the map */\r\n mapBorderColor?: string;\r\n /** Center point of the map */\r\n centerPoint?: [number, number];\r\n /** Defines if the globe rotates automatically */\r\n autoRotate?: number | boolean;\r\n /** Defines the material property applied to the sphere of the globe */\r\n globeMaterial?: THREE.Material;\r\n /** Defines the lights for the 3D scene */\r\n lights?: LightConfig[];\r\n /** Defines the colo of the glow around the globe */\r\n atmosphereColor?: string;\r\n /** Defines if the globe can be zoomed when scrolled */\r\n enableZoom?: boolean;\r\n /** Position offset of the globe relative to the canvas center */\r\n globeOffset?: [number, number];\r\n /** Defines the camera distance from Earth. This helps in defining the default size of the globe. Smaller = closer camera therefore the globe is bigger) */\r\n scale?: number;\r\n /** Defines the spacing between the country shape polygon with the sphere */\r\n polygonAltitude?: number;\r\n /** Scale for the colors */\r\n scaleType?: Exclude<ScaleDataType, 'linear'>;\r\n /** Toggles if the color scaling is categorical or not */\r\n categorical?: boolean;\r\n /** Toggle visibility of color scale. */\r\n showColorScale?: boolean;\r\n /** The max altitude of the atmosphere, in terms of globe radius units. */\r\n atmosphereAltitude?: number;\r\n /** Resolution in angular degrees of the sphere curvature. The finer the resolution, the more the globe is fragmented into smaller faces to approximate the spheric surface, at the cost of performance. */\r\n globeCurvatureResolution?: number;\r\n /** Defines fog settings for the scene. */\r\n fogSettings?: FogDataType;\r\n /** Property in the property object in mapData geoJson object is used to match to the id in the data object */\r\n mapProperty?: string;\r\n /** Countries or regions to be highlighted */\r\n highlightedIds?: string[];\r\n /** Defines the altitude of the highlighted countries or the countries on mouseover. */\r\n highlightedAltitude?: number;\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\n/** For using these maps you will have to install [`three`](https://threejs.org/manual/) and [react-globe.gl](https://www.npmjs.com/package/react-globe.gl) package to your project */\r\nexport function ThreeDGlobe(props: Props) {\r\n const {\r\n data,\r\n mapData = 'https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap-simplified.json',\r\n graphTitle,\r\n colors,\r\n sources,\r\n graphDescription,\r\n height,\r\n width,\r\n footNote = '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.',\r\n colorDomain,\r\n colorLegendTitle,\r\n scaleType = 'threshold',\r\n padding,\r\n mapNoDataColor = Colors.light.graphNoData,\r\n backgroundColor = false,\r\n mapBorderColor = Colors.light.grays['gray-500'],\r\n relativeHeight,\r\n tooltip,\r\n graphID,\r\n mapProperty = 'ISO3',\r\n dataDownload = false,\r\n language = 'en',\r\n minHeight = 0,\r\n theme = 'light',\r\n ariaLabel,\r\n styles,\r\n classNames,\r\n autoRotate = true,\r\n enableZoom = true,\r\n globeMaterial,\r\n centerPoint = [0, 0],\r\n atmosphereColor = '#999',\r\n showColorScale = true,\r\n resetSelectionOnDoubleClick = true,\r\n detailsOnClick,\r\n onSeriesMouseOver,\r\n onSeriesMouseClick,\r\n highlightedIds = [],\r\n highlightedAltitude = 0.1,\r\n scale = 1,\r\n globeOffset = [0, 0],\r\n polygonAltitude = 0.01,\r\n globeCurvatureResolution = 4,\r\n atmosphereAltitude = 0.15,\r\n fogSettings,\r\n lights = [\r\n {\r\n type: 'ambient',\r\n color: 0x404040,\r\n intensity: 0.4,\r\n },\r\n {\r\n type: 'directional',\r\n color: 0xffffff,\r\n intensity: 1,\r\n position: { x: 5, y: 10, z: 5 },\r\n },\r\n ],\r\n } = props;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mapShape, setMapShape] = useState<any>(undefined);\r\n\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(width || entries[0].target.clientWidth || 760);\r\n setSvgHeight(height || entries[0].target.clientHeight || 480);\r\n });\r\n if (graphDiv.current) {\r\n setSvgHeight(graphDiv.current.clientHeight || 480);\r\n setSvgWidth(graphDiv.current.clientWidth || 760);\r\n if (!width) resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, [width, height]);\r\n useEffect(() => {\r\n if (typeof mapData === 'string') {\r\n const fetchData = fetchAndParseJSON(mapData);\r\n fetchData.then(d => {\r\n if (\r\n mapData ===\r\n 'https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap-simplified.json'\r\n ) {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const features = d.features.map((el: any) => {\r\n if (el.geometry.type === 'Polygon') {\r\n const reversed = [...el.geometry.coordinates[0]].reverse();\r\n const geometry = { ...el.geometry, coordinates: [reversed] };\r\n return { ...el, geometry };\r\n }\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const coord: any = [];\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n el.geometry.coordinates.forEach((c: any) => {\r\n const reversed = [...c[0]].reverse();\r\n coord.push([reversed]);\r\n });\r\n const geometry = { ...el.geometry, coordinates: coord };\r\n return { ...el, geometry };\r\n });\r\n setMapShape(features);\r\n } else setMapShape(d.features);\r\n });\r\n } else {\r\n setMapShape(mapData.features);\r\n }\r\n }, [mapData]);\r\n\r\n const domain =\r\n colorDomain ||\r\n (scaleType === 'categorical'\r\n ? getUniqValue(data, 'x')\r\n : getJenks(\r\n data.map(d => d.x as number | null | undefined),\r\n colors?.length || 4,\r\n ));\r\n return (\r\n <div\r\n className={`${theme || 'light'} flex ${width ? 'w-fit grow-0' : 'w-full grow'}`}\r\n dir={language === 'he' || language === 'ar' ? 'rtl' : undefined}\r\n >\r\n <div\r\n className={cn(\r\n `${\r\n !backgroundColor\r\n ? 'bg-transparent '\r\n : backgroundColor === true\r\n ? 'bg-primary-gray-200 dark:bg-primary-gray-650 '\r\n : ''\r\n }ml-auto mr-auto flex flex-col grow h-inherit ${language || 'en'}`,\r\n width ? 'w-fit' : 'w-full',\r\n classNames?.graphContainer,\r\n )}\r\n style={{\r\n ...(styles?.graphContainer || {}),\r\n ...(backgroundColor && backgroundColor !== true ? { backgroundColor } : {}),\r\n }}\r\n id={graphID}\r\n aria-label={\r\n ariaLabel ||\r\n `${\r\n graphTitle ? `The graph shows ${graphTitle}. ` : ''\r\n }This is a map.${graphDescription ? ` ${graphDescription}` : ''}`\r\n }\r\n >\r\n <div\r\n className='flex grow'\r\n style={{ padding: backgroundColor ? padding || '1rem' : padding || 0 }}\r\n >\r\n <div className='flex flex-col w-full gap-4 grow justify-between'>\r\n {graphTitle || graphDescription || 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={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 <div\r\n className='flex flex-col grow justify-center leading-0'\r\n ref={graphDiv}\r\n aria-label='Map area'\r\n >\r\n {(width || svgWidth) && (height || svgHeight) && mapShape ? (\r\n <Graph\r\n data={data}\r\n globeOffset={globeOffset}\r\n polygonData={mapShape}\r\n colorDomain={domain}\r\n width={width || svgWidth}\r\n height={Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}\r\n colors={\r\n colors ||\r\n (scaleType === 'categorical'\r\n ? Colors[theme].sequentialColors[\r\n `neutralColorsx0${domain.length as 4 | 5 | 6 | 7 | 8 | 9}`\r\n ]\r\n : Colors[theme].sequentialColors[\r\n `neutralColorsx0${(domain.length + 1) as 4 | 5 | 6 | 7 | 8 | 9}`\r\n ])\r\n }\r\n mapNoDataColor={mapNoDataColor}\r\n categorical={scaleType === 'categorical'}\r\n mapBorderColor={mapBorderColor}\r\n tooltip={tooltip}\r\n mapProperty={mapProperty}\r\n styles={styles}\r\n classNames={classNames}\r\n autoRotate={autoRotate === true ? 1.5 : autoRotate === false ? 0 : autoRotate}\r\n enableZoom={enableZoom}\r\n globeMaterial={globeMaterial}\r\n atmosphereColor={atmosphereColor}\r\n colorLegendTitle={colorLegendTitle}\r\n showColorScale={showColorScale}\r\n hoverStrokeColor={\r\n theme === 'light'\r\n ? Colors.light.grays['gray-700']\r\n : Colors.light.grays['gray-300']\r\n }\r\n highlightedIds={highlightedIds}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n detailsOnClick={detailsOnClick}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n scale={scale}\r\n polygonAltitude={polygonAltitude}\r\n centerLat={centerPoint[0]}\r\n centerLng={centerPoint[1]}\r\n atmosphereAltitude={atmosphereAltitude}\r\n globeCurvatureResolution={globeCurvatureResolution}\r\n fogSettings={fogSettings}\r\n lights={lights}\r\n highlightedAltitude={highlightedAltitude}\r\n />\r\n ) : (\r\n <div\r\n style={{\r\n height: `${Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}px`,\r\n }}\r\n className='flex items-center justify-center'\r\n >\r\n <Spinner aria-label='Loading graph' />\r\n </div>\r\n )}\r\n </div>\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 </div>\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n}\r\n"],"names":["createLightFromConfig","config","light","THREE","Graph","props","width","autoRotate","data","enableZoom","categorical","colorDomain","colors","globeMaterial","height","polygonData","mapProperty","mapBorderColor","atmosphereColor","tooltip","styles","classNames","mapNoDataColor","colorLegendTitle","showColorScale","hoverStrokeColor","detailsOnClick","onSeriesMouseClick","onSeriesMouseOver","resetSelectionOnDoubleClick","highlightedIds","scale","globeOffset","polygonAltitude","centerLng","centerLat","atmosphereAltitude","globeCurvatureResolution","fogSettings","lights","highlightedAltitude","globeReady","setGlobeReady","useState","globeEl","useRef","mouseClickData","setMouseClickData","mouseClickCentroid","setMouseClickCentroid","showLegend","setShowLegend","mousePos","setMousePos","mouseOverData","setMouseOverData","colorScale","scaleOrdinal","scaleThreshold","useEffect","canvas","handleMouseMove","e","materials","setupCustomLighting","useCallback","scene","camera","lightsAndObjToRemove","obj","i","handleGlobeReady","jsxs","jsx","Globe","polygon","id","val","el","color","clickedData","isEqual","lng","lat","centerOfMass","hoverData","d","line","Fragment","X","P","numberFormattingFunction","Tooltip","Modal","string2HTML","ThreeDGlobe","mapData","graphTitle","sources","graphDescription","footNote","scaleType","padding","Colors","backgroundColor","relativeHeight","graphID","dataDownload","language","minHeight","theme","ariaLabel","centerPoint","mapShape","setMapShape","svgWidth","setSvgWidth","svgHeight","setSvgHeight","graphDiv","resizeObserver","entries","fetchAndParseJSON","features","reversed","geometry","coord","c","domain","getUniqValue","getJenks","cn","GraphHeader","Spinner","GraphFooter"],"mappings":"omCA4DA,SAASA,GAAsBC,EAAkC,CAC/D,IAAIC,EAEJ,OAAQD,EAAO,KAAA,CACb,IAAK,UACHC,EAAQ,IAAIC,EAAM,aAAaF,EAAO,MAAOA,EAAO,SAAS,EAC7D,MACF,IAAK,cACHC,EAAQ,IAAIC,EAAM,iBAAiBF,EAAO,MAAOA,EAAO,SAAS,EAC7DA,EAAO,WACLA,EAAO,WAAa,SAAUC,EAAM,SAAS,IAAI,EAAG,EAAG,CAAC,EACvDA,EAAM,SAAS,IAAID,EAAO,SAAS,EAAGA,EAAO,SAAS,EAAGA,EAAO,SAAS,CAAC,IAE7EA,EAAO,QAAUA,EAAO,WAAa,WACtCC,EAA0B,OAAO,SAAS,IACzCD,EAAO,QAAQ,GAAK,EACpBA,EAAO,QAAQ,GAAK,EACpBA,EAAO,QAAQ,IAAM,OAAY,GAAKA,EAAO,OAAO,CAAA,EAGpDA,EAAO,aACRC,EAAiC,WAAa,GAC3CD,EAAO,SACRC,EAAiC,OAAO,QAAQ,MAAQD,EAAO,OAAO,QAAQ,MAC9EC,EAAiC,OAAO,QAAQ,OAASD,EAAO,OAAO,QAAQ,OAC/EC,EAAiC,OAAO,OAAO,KAAOD,EAAO,OAAO,OAAO,KAC3EC,EAAiC,OAAO,OAAO,IAAMD,EAAO,OAAO,OAAO,MAG/E,MACF,IAAK,QACHC,EAAQ,IAAIC,EAAM,WAChBF,EAAO,MACPA,EAAO,UACPA,EAAO,UAAY,EACnBA,EAAO,OAAS,CAAA,EAEdA,EAAO,WACLA,EAAO,WAAa,SAAUC,EAAM,SAAS,IAAI,EAAG,EAAG,CAAC,EACvDA,EAAM,SAAS,IAAID,EAAO,SAAS,EAAGA,EAAO,SAAS,EAAGA,EAAO,SAAS,CAAC,GAEjF,MACF,IAAK,OACHC,EAAQ,IAAIC,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