@undp/data-viz 1.4.1 → 1.4.2
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 +21 -21
- package/dist/BarGraph.cjs +1 -1
- package/dist/BarGraph.js +7 -7
- package/dist/BeeSwarmChart.cjs +1 -1
- package/dist/BeeSwarmChart.js +2 -2
- package/dist/BiVariateChoroplethMap.cjs +1 -1
- package/dist/BiVariateChoroplethMap.js +5 -5
- package/dist/BulletChart.cjs +1 -1
- package/dist/BulletChart.js +14 -14
- package/dist/ButterflyChart.cjs +1 -1
- package/dist/ButterflyChart.js +9 -9
- package/dist/ChoroplethMap.cjs +1 -1
- package/dist/ChoroplethMap.js +9 -9
- package/dist/CirclePackingGraph.cjs +1 -1
- package/dist/CirclePackingGraph.js +1 -1
- package/dist/CopyTextButton.cjs +7 -7
- package/dist/CopyTextButton.cjs.map +1 -1
- package/dist/CopyTextButton.js +4 -4
- package/dist/CopyTextButton.js.map +1 -1
- package/dist/DataCards.cjs +9 -9
- package/dist/DataCards.cjs.map +1 -1
- package/dist/DataCards.js +93 -93
- package/dist/DataCards.js.map +1 -1
- package/dist/DifferenceLineChart.cjs +1 -1
- package/dist/DifferenceLineChart.js +18 -18
- package/dist/DonutChart.cjs +1 -1
- package/dist/DonutChart.js +1 -1
- package/dist/DotDensityMap.cjs +1 -1
- package/dist/DotDensityMap.js +8 -8
- package/dist/{DropdownSelect-0I2QxaVy.cjs → DropdownSelect-BmE5JaeE.cjs} +6 -6
- package/dist/{DropdownSelect-0I2QxaVy.cjs.map → DropdownSelect-BmE5JaeE.cjs.map} +1 -1
- package/dist/{DropdownSelect-CDC9lEqU.js → DropdownSelect-CeHog_ih.js} +4 -4
- package/dist/{DropdownSelect-CDC9lEqU.js.map → DropdownSelect-CeHog_ih.js.map} +1 -1
- package/dist/DualAxisLineChart.cjs +1 -1
- package/dist/DualAxisLineChart.js +15 -15
- package/dist/DumbbellChart.cjs +1 -1
- package/dist/DumbbellChart.js +13 -13
- package/dist/GeoHubMap.cjs +1 -1
- package/dist/GeoHubMap.js +2 -2
- package/dist/GeoHubMapWithLayerSelection.cjs +1 -1
- package/dist/GeoHubMapWithLayerSelection.js +2 -2
- package/dist/{GraphEl-B6SoGRFW.cjs → GraphEl-B5gAX1IQ.cjs} +2 -2
- package/dist/{GraphEl-B6SoGRFW.cjs.map → GraphEl-B5gAX1IQ.cjs.map} +1 -1
- package/dist/{GraphEl-Cw2tDUb3.js → GraphEl-BdIyscdt.js} +3 -3
- package/dist/{GraphEl-Cw2tDUb3.js.map → GraphEl-BdIyscdt.js.map} +1 -1
- package/dist/GriddedGraphs.cjs +1 -1
- package/dist/GriddedGraphs.js +4 -4
- package/dist/GriddedGraphsFromConfig.cjs +1 -1
- package/dist/GriddedGraphsFromConfig.js +1 -1
- package/dist/HeatMap.cjs +1 -1
- package/dist/HeatMap.js +10 -10
- package/dist/Histogram.cjs +1 -1
- package/dist/Histogram.js +1 -1
- package/dist/LineChartWithConfidenceInterval.cjs +1 -1
- package/dist/LineChartWithConfidenceInterval.js +21 -21
- package/dist/{Modal-CUU6ZK3U.js → Modal-DVVwpKhP.js} +2 -2
- package/dist/{Modal-CUU6ZK3U.js.map → Modal-DVVwpKhP.js.map} +1 -1
- package/dist/{Modal-C_dl0EtQ.cjs → Modal-tXZlLE5s.cjs} +4 -4
- package/dist/{Modal-C_dl0EtQ.cjs.map → Modal-tXZlLE5s.cjs.map} +1 -1
- package/dist/MultiGraphDashboard.cjs +1 -1
- package/dist/MultiGraphDashboard.js +3 -3
- package/dist/MultiGraphDashboardFromConfig.cjs +1 -1
- package/dist/MultiGraphDashboardFromConfig.js +1 -1
- package/dist/MultiGraphDashboardWideToLongFormat.cjs +1 -1
- package/dist/MultiGraphDashboardWideToLongFormat.js +3 -3
- package/dist/MultiGraphDashboardWideToLongFormatFromConfig.cjs +1 -1
- package/dist/MultiGraphDashboardWideToLongFormatFromConfig.js +1 -1
- package/dist/MultiLineAltChart.cjs +1 -1
- package/dist/MultiLineAltChart.js +21 -21
- package/dist/MultiLineChart.cjs +1 -1
- package/dist/MultiLineChart.js +19 -19
- package/dist/ParetoChart.cjs +1 -1
- package/dist/ParetoChart.js +12 -12
- package/dist/PerformanceIntensiveMultiGraphDashboard.cjs +1 -1
- package/dist/PerformanceIntensiveMultiGraphDashboard.js +3 -3
- package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.cjs +1 -1
- package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.js +1 -1
- package/dist/PerformanceIntensiveScrollStory.cjs +1 -1
- package/dist/PerformanceIntensiveScrollStory.js +2 -2
- package/dist/RadarChart.cjs +1 -1
- package/dist/RadarChart.js +8 -8
- package/dist/{ReferenceLine-CuFMk0cI.cjs → ReferenceLine-CFVBBN__.cjs} +2 -2
- package/dist/{ReferenceLine-CuFMk0cI.cjs.map → ReferenceLine-CFVBBN__.cjs.map} +1 -1
- package/dist/{ReferenceLine-C1GpoG9d.js → ReferenceLine-CfAW3vKJ.js} +2 -2
- package/dist/{ReferenceLine-C1GpoG9d.js.map → ReferenceLine-CfAW3vKJ.js.map} +1 -1
- package/dist/{RegressionLine-BFwDCTUU.js → RegressionLine-mH7UKOPi.js} +3 -3
- package/dist/{RegressionLine-BFwDCTUU.js.map → RegressionLine-mH7UKOPi.js.map} +1 -1
- package/dist/{RegressionLine-7_rKTHN_.cjs → RegressionLine-xKdiJ8sw.cjs} +2 -2
- package/dist/{RegressionLine-7_rKTHN_.cjs.map → RegressionLine-xKdiJ8sw.cjs.map} +1 -1
- package/dist/SankeyChart.cjs +1 -1
- package/dist/SankeyChart.js +4 -4
- package/dist/ScatterPlot.cjs +1 -1
- package/dist/ScatterPlot.js +13 -13
- package/dist/ScrollStory.cjs +1 -1
- package/dist/ScrollStory.js +2 -2
- package/dist/SimpleLineChart.cjs +1 -1
- package/dist/SimpleLineChart.js +20 -20
- package/dist/SingleGraphDashboard.cjs +1 -1
- package/dist/SingleGraphDashboard.js +4 -4
- package/dist/SingleGraphDashboardFromConfig.cjs +1 -1
- package/dist/SingleGraphDashboardFromConfig.js +1 -1
- package/dist/SingleGraphDashboardGeoHubMapsFromConfig.cjs +1 -1
- package/dist/SingleGraphDashboardGeoHubMapsFromConfig.js +1 -1
- package/dist/SingleGraphDashboardThreeDGraphs.cjs +1 -1
- package/dist/SingleGraphDashboardThreeDGraphs.js +3 -3
- package/dist/SingleGraphDashboardThreeDGraphsFromConfig.cjs +1 -1
- package/dist/SingleGraphDashboardThreeDGraphsFromConfig.js +1 -1
- package/dist/SlopeChart.cjs +1 -1
- package/dist/SlopeChart.js +7 -7
- package/dist/StripChart.cjs +1 -1
- package/dist/StripChart.js +9 -9
- package/dist/ThreeDGlobe.cjs +1 -1
- package/dist/ThreeDGlobe.js +2 -2
- package/dist/TreeMapGraph.cjs +1 -1
- package/dist/TreeMapGraph.js +4 -4
- package/dist/UnitChart.cjs +1 -1
- package/dist/UnitChart.js +3 -3
- package/dist/{XAxesLabels-DQFo_z2R.js → XAxesLabels-CaV2q-6H.js} +2 -2
- package/dist/{XAxesLabels-DQFo_z2R.js.map → XAxesLabels-CaV2q-6H.js.map} +1 -1
- package/dist/{XAxesLabels-CJMQbfVy.cjs → XAxesLabels-OjBNl_lS.cjs} +2 -2
- package/dist/{XAxesLabels-CJMQbfVy.cjs.map → XAxesLabels-OjBNl_lS.cjs.map} +1 -1
- package/dist/{YAxesLabels-H5-002X5.js → YAxesLabels-CPGZjmZJ.js} +2 -2
- package/dist/{YAxesLabels-H5-002X5.js.map → YAxesLabels-CPGZjmZJ.js.map} +1 -1
- package/dist/{YAxesLabels-BXLTX7AI.cjs → YAxesLabels-D8IydyZj.cjs} +2 -2
- package/dist/{YAxesLabels-BXLTX7AI.cjs.map → YAxesLabels-D8IydyZj.cjs.map} +1 -1
- package/dist/{checkIfMultiple-Do4kADNr.cjs → checkIfMultiple-BXbHUCWM.cjs} +6 -6
- package/dist/{checkIfMultiple-Do4kADNr.cjs.map → checkIfMultiple-BXbHUCWM.cjs.map} +1 -1
- package/dist/{checkIfMultiple-CYp3vADF.js → checkIfMultiple-ChTJk2Tk.js} +5 -5
- package/dist/{checkIfMultiple-CYp3vADF.js.map → checkIfMultiple-ChTJk2Tk.js.map} +1 -1
- package/dist/{customArea-CaxScFmW.js → customArea-B-dWU0zZ.js} +2 -2
- package/dist/{customArea-CaxScFmW.js.map → customArea-B-dWU0zZ.js.map} +1 -1
- package/dist/{customArea-BYNyxAkm.cjs → customArea-CK768gCn.cjs} +2 -2
- package/dist/{customArea-BYNyxAkm.cjs.map → customArea-CK768gCn.cjs.map} +1 -1
- package/dist/{fetchAndParseData-Bcmr659B.js → fetchAndParseData-4gsYTy6_.js} +3 -3
- package/dist/fetchAndParseData-4gsYTy6_.js.map +1 -0
- package/dist/{fetchAndParseData-DmgQtB9n.cjs → fetchAndParseData-CQyVGCul.cjs} +6 -6
- package/dist/fetchAndParseData-CQyVGCul.cjs.map +1 -0
- package/dist/fetchAndParseData.cjs +1 -1
- package/dist/fetchAndParseData.js +1 -1
- package/dist/index-BW8iNx7E.cjs +10 -0
- package/dist/index-BW8iNx7E.cjs.map +1 -0
- package/dist/index-CNvov0eg.js +122 -0
- package/dist/index-CNvov0eg.js.map +1 -0
- package/dist/{index-D_n8aamX.cjs → index-CZLvTu6p.cjs} +2 -2
- package/dist/{index-D_n8aamX.cjs.map → index-CZLvTu6p.cjs.map} +1 -1
- package/dist/{index-n_RI8T0n.js → index-Cdcfp4nk.js} +2 -2
- package/dist/{index-n_RI8T0n.js.map → index-Cdcfp4nk.js.map} +1 -1
- package/dist/{index-BVnYktl4.js → index-DGAaLNu9.js} +2 -2
- package/dist/{index-BVnYktl4.js.map → index-DGAaLNu9.js.map} +1 -1
- package/dist/{index-CylX-pWB.cjs → index-DNj994Pv.cjs} +2 -2
- package/dist/{index-CylX-pWB.cjs.map → index-DNj994Pv.cjs.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +3 -3
- package/dist/proxy-BHRoeZgd.cjs +2 -0
- package/dist/proxy-BHRoeZgd.cjs.map +1 -0
- package/dist/{proxy-DJxJg1kD.js → proxy-CkpFesk1.js} +4123 -4075
- package/dist/proxy-CkpFesk1.js.map +1 -0
- package/dist/style.css +1 -1
- package/dist/transformData.cjs +1 -1
- package/dist/transformData.js +2 -2
- package/dist/{transformDataForGraphFromFile-D9G3ToQf.cjs → transformDataForGraphFromFile-B1A0AS-Z.cjs} +2 -2
- package/dist/{transformDataForGraphFromFile-D9G3ToQf.cjs.map → transformDataForGraphFromFile-B1A0AS-Z.cjs.map} +1 -1
- package/dist/{transformDataForGraphFromFile-CA0rw80A.js → transformDataForGraphFromFile-BCjsizvb.js} +2 -2
- package/dist/{transformDataForGraphFromFile-CA0rw80A.js.map → transformDataForGraphFromFile-BCjsizvb.js.map} +1 -1
- package/dist/{use-in-view-BCmzDU2O.cjs → use-in-view-sQJZ_xDO.cjs} +2 -2
- package/dist/use-in-view-sQJZ_xDO.cjs.map +1 -0
- package/dist/{use-in-view-BAHrBy6b.js → use-in-view-yS6jzJAp.js} +2 -2
- package/dist/use-in-view-yS6jzJAp.js.map +1 -0
- package/dist/x-BBpi7a_7-Dz2vKSfu.cjs +27 -0
- package/dist/x-BBpi7a_7-Dz2vKSfu.cjs.map +1 -0
- package/dist/x-BBpi7a_7-WVdj1j6r.js +106 -0
- package/dist/x-BBpi7a_7-WVdj1j6r.js.map +1 -0
- package/package.json +50 -51
- package/dist/fetchAndParseData-Bcmr659B.js.map +0 -1
- package/dist/fetchAndParseData-DmgQtB9n.cjs.map +0 -1
- package/dist/index-BxAUvrua.js +0 -120
- package/dist/index-BxAUvrua.js.map +0 -1
- package/dist/index-DVOJ7vxH.cjs +0 -10
- package/dist/index-DVOJ7vxH.cjs.map +0 -1
- package/dist/proxy-DJxJg1kD.js.map +0 -1
- package/dist/proxy-PQd2AItT.cjs +0 -2
- package/dist/proxy-PQd2AItT.cjs.map +0 -1
- package/dist/use-in-view-BAHrBy6b.js.map +0 -1
- package/dist/use-in-view-BCmzDU2O.cjs.map +0 -1
- package/dist/x-CnsEH4Ox-CGGXQl4M.cjs +0 -27
- package/dist/x-CnsEH4Ox-CGGXQl4M.cjs.map +0 -1
- package/dist/x-CnsEH4Ox-DDvAJndW.js +0 -101
- package/dist/x-CnsEH4Ox-DDvAJndW.js.map +0 -1
package/dist/BeeSwarmChart.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"),a=require("react"),ue=require("./index-BXns0-ng.cjs"),xe=require("./index-BczVvEBZ.cjs"),de=require("./Modal-C_dl0EtQ.cjs"),he=require("./Spinner-DA6Z5E4n.cjs"),me=require("./numberFormattingFunction-02t-wJta.cjs"),pe=require("./Tooltip-n8z5bfav.cjs"),O=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),fe=require("./getTextColorBasedOnBgColor-nqY-bsM_.cjs"),le=require("./Colors.cjs"),ge=require("./string2HTML-D2Avudmb.cjs"),je=require("./Axis-DE7dSn1_.cjs"),Me=require("./XTicksAndGridLines-CCzXIV8d.cjs"),ye=require("./ReferenceLine-CuFMk0cI.cjs"),ve=require("./pow-B5-jkdHU.cjs"),be=require("./linear-BVckp9RD.cjs"),re=require("./y-QcCbqrzx.cjs"),Re=require("./GraphFooter.cjs"),Ee=require("./GraphHeader.cjs"),we=require("./ColorLegendWithMouseOver.cjs"),Ce=require("./EmptyState-d8_8SxeW.cjs"),Oe=require("./YTicksAndGridLines-DBDuz6vb.cjs");function ke(ne){const{data:o,circleColors:u,showTicks:C,leftMargin:ie,width:b,height:R,colorDomain:c,rightMargin:se,topMargin:I,bottomMargin:F,showLabels:A,tooltip:j,onSeriesMouseOver:$,refValues:m,selectedColor:B,startFromZero:U,radius:g,maxRadiusValue:G,maxValue:n,minValue:Z,highlightedDataPoints:J,onSeriesMouseClick:P,rtl:oe,resetSelectionOnDoubleClick:K,detailsOnClick:L,suffix:N,prefix:S,styles:y,classNames:q,noOfTicks:Q,dimmedOpacity:V,precision:H,customLayers:k}=ne,X=a.useRef(null),[E,v]=a.useState(void 0),[D,W]=a.useState(void 0),[Y,z]=a.useState(null),[ee,p]=a.useState(void 0),[f,x]=a.useState(void 0),d={top:I,bottom:F,left:ie,right:se},_=b-d.left-d.right,te=R-d.top-d.bottom,M=o.filter(e=>!O.checkIfNullOrUndefined(e.radius)).length===0?o:xe.orderBy(o.filter(e=>!O.checkIfNullOrUndefined(e.radius)),"radius","desc"),w=O.checkIfNullOrUndefined(n)?Math.max(...o.filter(e=>!O.checkIfNullOrUndefined(e.position)).map(e=>e.position))<0&&!U?0:Math.max(...o.filter(e=>!O.checkIfNullOrUndefined(e.position)).map(e=>e.position)):n,r=O.checkIfNullOrUndefined(Z)?Math.min(...o.filter(e=>!O.checkIfNullOrUndefined(e.position)).map(e=>e.position))>=0&&!U?0:Math.min(...o.filter(e=>!O.checkIfNullOrUndefined(e.position)).map(e=>e.position)):Z,l=o.filter(e=>e.radius===void 0||e.radius===null).length!==o.length?ve.sqrt().domain([0,O.checkIfNullOrUndefined(G)?Math.max(...o.map(e=>e.radius).filter(e=>e!=null)):G]).range([.25,g]).nice():void 0,T=be.linear().domain([r,w]).range([0,_]).nice(),t=T.ticks(Q);return a.useEffect(()=>{z(null);const e=M.filter(h=>h.position);re.forceSimulation(e).force("x",re.forceX(h=>T(h.position)).strength(5)).force("y",re.forceY(h=>te/2).strength(1)).force("collide",re.forceCollide(h=>l?l(h.radius||0)+1:g+1)).force("charge",re.forceManyBody().strength(-15)).alphaDecay(.05).tick(1e4).on("tick",()=>{z(e)}).on("end",()=>{z(e)})},[o,g,te,_,r,w,M,T,l]),i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[Y?i.jsxRuntimeExports.jsx("svg",{width:`${b}px`,height:`${R}px`,viewBox:`0 0 ${b} ${R}`,direction:"ltr",ref:X,children:i.jsxRuntimeExports.jsxs("g",{transform:`translate(${d.left},${d.top})`,children:[C?i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[i.jsxRuntimeExports.jsx(je.Axis,{x1:T(r<0?0:r),x2:T(r<0?0:r),y1:0-d.top,y2:te+d.bottom,label:me.numberFormattingFunction(r<0?0:r,"NA",H,S,N),labelPos:{x:T(r<0?0:r),y:0-I,dy:"0.75em",dx:3},classNames:{axis:q?.xAxis?.axis,label:q?.yAxis?.labels},styles:{axis:y?.xAxis?.axis,label:y?.yAxis?.labels}}),i.jsxRuntimeExports.jsx(Me.XTicksAndGridLines,{values:t.filter(e=>e!==0),x:t.filter(e=>e!==0).map(e=>T(e)),y1:0-I,y2:te+d.bottom,styles:{gridLines:y?.xAxis?.gridLines,labels:y?.xAxis?.labels},classNames:{gridLines:q?.xAxis?.gridLines,labels:q?.xAxis?.labels},suffix:N,prefix:S,labelType:"secondary",showGridLines:!0,precision:H})]}):null,k.filter(e=>e.position==="before").map(e=>e.layer),Y.map(e=>i.jsxRuntimeExports.jsxs("g",{className:"undp-viz-g-with-hover",transform:`translate(${e.x},${e.y})`,opacity:B?e.color&&u[c.indexOf(e.color)]===B?1:V:J.length!==0?J.indexOf(e.label)!==-1?.85:V:.85,onMouseEnter:h=>{v(e),x(h.clientY),p(h.clientX),$?.(e)},onMouseMove:h=>{v(e),x(h.clientY),p(h.clientX)},onClick:()=>{(P||L)&&(ue.isEqual(D,e)&&K?(W(void 0),P?.(void 0)):(W(e),P?.(e)))},onMouseLeave:()=>{v(void 0),p(void 0),x(void 0),$?.(void 0)},children:[i.jsxRuntimeExports.jsx("circle",{cx:0,cy:0,fill:o.filter(h=>h.color).length===0?u[0]:e.color?u[c.indexOf(e.color)]:le.Colors.gray,radius:l?l(e.radius||0):g}),(l?l(e.radius||0):g)>10&&A?i.jsxRuntimeExports.jsx("g",{children:i.jsxRuntimeExports.jsx("foreignObject",{y:0-(l?l(e.radius||0):g),x:0-(l?l(e.radius||0):g),width:2*(l?l(e.radius||0):g),height:2*(l?l(e.radius||0):g),children:i.jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-0.5 justify-center items-center h-inherit py-0 px-1.5",children:A?i.jsxRuntimeExports.jsx("p",{className:i.mo("text-center leading-none m-0",q?.graphObjectValues),style:{fontSize:`${Math.min(Math.max(Math.round((l?l(e.radius||0):g)/4),10),Math.max(Math.round((l?l(e.radius||0):g)*12/`${e.label}`.length),10),20)}px`,color:fe.getTextColorBasedOnBgColor(o.filter(h=>h.color).length===0?u[0]:e.color?u[c.indexOf(e.color)]:le.Colors.gray),hyphens:"auto",...y?.graphObjectValues||{}},children:e.label}):null})})}):null]},e.label)),m?i.jsxRuntimeExports.jsx(i.jsxRuntimeExports.Fragment,{children:m.map((e,h)=>i.jsxRuntimeExports.jsx(ye.RefLineX,{text:e.text,color:e.color,x:T(e.value),y1:0-d.top,y2:te+d.bottom,textSide:T(e.value)>_*.75||oe?"left":"right",classNames:e.classNames,styles:e.styles,isInView:!0},h))}):null,k.filter(e=>e.position==="after").map(e=>e.layer)]})}):i.jsxRuntimeExports.jsx("div",{style:{width:`${b}px`,height:`${R}px`},children:i.jsxRuntimeExports.jsx("div",{className:"flex m-auto items-center justify-center p-0 leading-none text-base h-40",children:i.jsxRuntimeExports.jsx(he.y,{})})}),E&&j&&ee&&f?i.jsxRuntimeExports.jsx(pe.Tooltip,{data:E,body:j,xPos:ee,yPos:f,backgroundStyle:y?.tooltip,className:q?.tooltip}):null,L&&D!==void 0?i.jsxRuntimeExports.jsx(de.X,{open:D!==void 0,onClose:()=>{W(void 0)},children:i.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof L=="string"?{__html:ge.string2HTML(L,D)}:void 0,children:typeof L=="function"?L(D):null})}):null]})}function Ne(ne){const{data:o,graphTitle:u,backgroundColor:C=!1,topMargin:ie=25,bottomMargin:b=10,leftMargin:R=10,rightMargin:c=10,showLabels:se=!0,showTicks:I=!0,colors:F,sources:A,graphDescription:j,height:$,width:m,footNote:B,colorDomain:U,colorLegendTitle:g,padding:G,relativeHeight:n,tooltip:Z,onSeriesMouseOver:J,refValues:P,showColorScale:oe,graphID:K,radius:L=5,maxRadiusValue:N,maxValue:S,minValue:y,highlightedDataPoints:q=[],onSeriesMouseClick:Q,graphDownload:V=!1,dataDownload:H=!1,language:k="en",showNAColor:X=!0,minHeight:E=0,theme:v="light",ariaLabel:D,resetSelectionOnDoubleClick:W=!0,detailsOnClick:Y,suffix:z="",prefix:ee="",styles:p,classNames:f,noOfTicks:x,dimmedOpacity:d=.3,precision:_=2,customLayers:te=[]}=ne,[M,w]=a.useState(0),[r,l]=a.useState(0),[T,t]=a.useState(void 0),e=a.useRef(null),h=a.useRef(null);return a.useEffect(()=>{const s=new ResizeObserver(ae=>{w(m||ae[0].target.clientWidth||620),l($||ae[0].target.clientHeight||480)});return e.current&&(l(e.current.clientHeight||480),w(e.current.clientWidth||620),m||s.observe(e.current)),()=>s.disconnect()},[m,$]),i.jsxRuntimeExports.jsx("div",{className:`${v||"light"} flex ${m?"w-fit grow-0":"w-full grow"}`,dir:k==="he"||k==="ar"?"rtl":void 0,children:i.jsxRuntimeExports.jsx("div",{className:i.mo(`${C?C===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${k||"en"}`,f?.graphContainer),style:{...p?.graphContainer||{},...C&&C!==!0?{backgroundColor:C}:{}},id:K,ref:h,"aria-label":D||`${u?`The graph shows ${u}. `:""}This is a bee swarm chart showing the distribution along the x-axes. ${j?` ${j}`:""}`,children:i.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:C?G||"1rem":G||0},children:i.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[u||j||V||H?i.jsxRuntimeExports.jsx(Ee.GraphHeader,{styles:{title:p?.title,description:p?.description},classNames:{title:f?.title,description:f?.description},graphTitle:u,graphDescription:j,width:m,graphDownload:V?h.current:void 0,dataDownload:H?o.map(s=>s.data).filter(s=>s!==void 0).length>0?o.map(s=>s.data).filter(s=>s!==void 0):o.filter(s=>s!==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:[oe!==!1&&o.filter(s=>s.color).length!==0?i.jsxRuntimeExports.jsx(we.ColorLegendWithMouseOver,{width:m,colorLegendTitle:g,colors:F||le.Colors[v].categoricalColors.colors,colorDomain:U||ce.uniqBy(o.filter(s=>s.color),"color").map(s=>s.color),setSelectedColor:t,showNAColor:X??!0}):null,i.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center w-full leading-0",ref:e,"aria-label":"Graph area",children:(m||M)&&($||r)?i.jsxRuntimeExports.jsx(ke,{data:o,circleColors:o.filter(s=>s.color).length===0?F?[F]:[le.Colors.primaryColors["blue-600"]]:F||le.Colors[v].categoricalColors.colors,colorDomain:o.filter(s=>s.color).length===0?[]:U||ce.uniqBy(o.filter(s=>s.color),"color").map(s=>s.color),width:m||M,selectedColor:T,height:Math.max(E,$||(n?E?(m||M)*n>E?(m||M)*n:E:(m||M)*n:r)),showTicks:I,leftMargin:R,rightMargin:c,topMargin:ie,bottomMargin:b,showLabels:se,tooltip:Z,onSeriesMouseOver:J,refValues:P,startFromZero:!1,radius:L,maxRadiusValue:N,maxValue:S,minValue:y,highlightedDataPoints:q,onSeriesMouseClick:Q,rtl:k==="he"||k==="ar",resetSelectionOnDoubleClick:W,detailsOnClick:Y,suffix:z,prefix:ee,styles:p,classNames:f,noOfTicks:x||5,dimmedOpacity:d,precision:_,customLayers:te}):null})]})}),A||B?i.jsxRuntimeExports.jsx(Re.GraphFooter,{styles:{footnote:p?.footnote,source:p?.source},classNames:{footnote:f?.footnote,source:f?.source},sources:A,footNote:B,width:m}):null]})})})})}function Se(ne){const{data:o,circleColors:u,showTicks:C,leftMargin:ie,width:b,height:R,colorDomain:c,rightMargin:se,topMargin:I,bottomMargin:F,suffix:A,prefix:j,showLabels:$,tooltip:m,onSeriesMouseOver:B,refValues:U,selectedColor:g,startFromZero:G,radius:n,maxRadiusValue:Z,maxValue:J,minValue:P,highlightedDataPoints:oe,onSeriesMouseClick:K,resetSelectionOnDoubleClick:L,detailsOnClick:N,styles:S,classNames:y,noOfTicks:q,dimmedOpacity:Q,precision:V,customLayers:H}=ne,k=a.useRef(null),[X,E]=a.useState(void 0),[v,D]=a.useState(void 0),[W,Y]=a.useState(null),[z,ee]=a.useState(void 0),[p,f]=a.useState(void 0),x={top:I,bottom:F,left:ie,right:se},d=b-x.left-x.right,_=R-x.top-x.bottom,te=o.filter(t=>!O.checkIfNullOrUndefined(t.radius)).length===0?o:xe.orderBy(o.filter(t=>!O.checkIfNullOrUndefined(t.radius)),"radius","desc"),M=O.checkIfNullOrUndefined(J)?Math.max(...o.filter(t=>!O.checkIfNullOrUndefined(t.position)).map(t=>t.position))<0&&!G?0:Math.max(...o.filter(t=>!O.checkIfNullOrUndefined(t.position)).map(t=>t.position)):J,w=O.checkIfNullOrUndefined(P)?Math.min(...o.filter(t=>!O.checkIfNullOrUndefined(t.position)).map(t=>t.position))>=0&&!G?0:Math.min(...o.filter(t=>!O.checkIfNullOrUndefined(t.position)).map(t=>t.position)):P,r=o.filter(t=>t.radius===void 0||t.radius===null).length!==o.length?ve.sqrt().domain([0,O.checkIfNullOrUndefined(Z)?Math.max(...o.map(t=>t.radius).filter(t=>t!=null)):Z]).range([.25,n]).nice():void 0,l=be.linear().domain([w,M]).range([_,0]).nice(),T=l.ticks(q);return a.useEffect(()=>{Y(null);const t=te.filter(e=>e.position);re.forceSimulation(t).force("y",re.forceY(e=>l(e.position)).strength(5)).force("x",re.forceX(e=>d/2).strength(1)).force("collide",re.forceCollide(e=>r?r(e.radius||0)+1:n+1)).force("charge",re.forceManyBody().strength(-15)).alphaDecay(.05).tick(1e4).on("tick",()=>{Y(t)}).on("end",()=>{Y(t)})},[o,n,_,d,w,M,te,l,r]),i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[W?i.jsxRuntimeExports.jsx("svg",{width:`${b}px`,height:`${R}px`,viewBox:`0 0 ${b} ${R}`,direction:"ltr",ref:k,children:i.jsxRuntimeExports.jsxs("g",{transform:`translate(${x.left},${x.top})`,children:[C?i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[i.jsxRuntimeExports.jsx(je.Axis,{y1:l(w<0?0:w),y2:l(w<0?0:w),x1:0-x.left,x2:d+x.right,label:me.numberFormattingFunction(w<0?0:w,"NA",V,j,A),labelPos:{x:0-x.left,y:l(w<0?0:w),dx:0,dy:M<0?"1em":-5},classNames:{axis:y?.xAxis?.axis,label:y?.yAxis?.labels},styles:{axis:S?.xAxis?.axis,label:S?.yAxis?.labels}}),i.jsxRuntimeExports.jsx(Oe.YTicksAndGridLines,{values:T.filter(t=>t!==0),y:T.filter(t=>t!==0).map(t=>l(t)),x1:0-x.left,x2:d+x.right,styles:{gridLines:S?.yAxis?.gridLines,labels:S?.yAxis?.labels},classNames:{gridLines:y?.yAxis?.gridLines,labels:y?.yAxis?.labels},suffix:A,prefix:j,labelType:"secondary",showGridLines:!0,labelPos:"vertical",precision:V})]}):null,H.filter(t=>t.position==="before").map(t=>t.layer),W.map(t=>i.jsxRuntimeExports.jsxs("g",{className:"undp-viz-g-with-hover",transform:`translate(${t.x},${t.y})`,opacity:g?t.color&&u[c.indexOf(t.color)]===g?1:Q:oe.length!==0?oe.indexOf(t.label)!==-1?.85:Q:.85,onMouseEnter:e=>{E(t),f(e.clientY),ee(e.clientX),B?.(t)},onMouseMove:e=>{E(t),f(e.clientY),ee(e.clientX)},onClick:()=>{(K||N)&&(ue.isEqual(v,t)&&L?(D(void 0),K?.(void 0)):(D(t),K?.(t)))},onMouseLeave:()=>{E(void 0),ee(void 0),f(void 0),B?.(void 0)},children:[i.jsxRuntimeExports.jsx("circle",{cx:0,cy:0,r:r?r(t.radius||0):n,fill:o.filter(e=>e.color).length===0?u[0]:t.color?u[c.indexOf(t.color)]:le.Colors.gray}),(r?r(t.radius||0):n)>10&&$?i.jsxRuntimeExports.jsx("g",{children:i.jsxRuntimeExports.jsx("foreignObject",{y:0-(r?r(t.radius||0):n),x:0-(r?r(t.radius||0):n),width:2*(r?r(t.radius||0):n),height:2*(r?r(t.radius||0):n),children:i.jsxRuntimeExports.jsx("div",{className:"flex flex-col justify-center items-center h-inherit py-0 px-1.5",children:$?i.jsxRuntimeExports.jsx("p",{className:i.mo("text-center leading-none m-0",y?.graphObjectValues),style:{fontSize:`${Math.min(Math.max(Math.round((r?r(t.radius||0):n)/4),10),Math.max(Math.round((r?r(t.radius||0):n)*12/`${t.label}`.length),10),20)}px`,hyphens:"auto",color:fe.getTextColorBasedOnBgColor(o.filter(e=>e.color).length===0?u[0]:t.color?u[c.indexOf(t.color)]:le.Colors.gray),...S?.graphObjectValues||{}},children:t.label}):null})})}):null]},t.label)),U?i.jsxRuntimeExports.jsx(i.jsxRuntimeExports.Fragment,{children:U.map((t,e)=>i.jsxRuntimeExports.jsx(ye.RefLineY,{text:t.text,color:t.color,y:l(t.value),x1:0-x.left,x2:d+x.right,classNames:t.classNames,styles:t.styles,isInView:!0},e))}):null,H.filter(t=>t.position==="after").map(t=>t.layer)]})}):i.jsxRuntimeExports.jsx("div",{style:{width:`${b}px`,height:`${R}px`},children:i.jsxRuntimeExports.jsx("div",{className:"flex m-auto items-center justify-center p-0 leading-none text-base h-40",children:i.jsxRuntimeExports.jsx(he.y,{})})}),X&&m&&z&&p?i.jsxRuntimeExports.jsx(pe.Tooltip,{data:X,body:m,xPos:z,yPos:p,backgroundStyle:S?.tooltip,className:y?.tooltip}):null,N&&v!==void 0?i.jsxRuntimeExports.jsx(de.X,{open:v!==void 0,onClose:()=>{D(void 0)},children:i.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof N=="string"?{__html:ge.string2HTML(N,v)}:void 0,children:typeof N=="function"?N(v):null})}):null]})}function De(ne){const{data:o,graphTitle:u,colors:C,sources:ie,graphDescription:b,height:R,width:c,footNote:se,colorDomain:I,colorLegendTitle:F,padding:A,backgroundColor:j=!1,topMargin:$=25,bottomMargin:m=10,leftMargin:B=100,rightMargin:U=40,showLabels:g=!0,showTicks:G=!0,relativeHeight:n,tooltip:Z,onSeriesMouseOver:J,refValues:P,showColorScale:oe,graphID:K,radius:L=5,maxRadiusValue:N,maxValue:S,minValue:y,highlightedDataPoints:q=[],onSeriesMouseClick:Q,graphDownload:V=!1,dataDownload:H=!1,language:k="en",showNAColor:X=!0,minHeight:E=0,theme:v="light",ariaLabel:D,resetSelectionOnDoubleClick:W=!0,detailsOnClick:Y,suffix:z="",prefix:ee="",styles:p,classNames:f,noOfTicks:x,dimmedOpacity:d=.3,precision:_=2,customLayers:te=[]}=ne,[M,w]=a.useState(0),[r,l]=a.useState(0),[T,t]=a.useState(void 0),e=a.useRef(null),h=a.useRef(null);return a.useEffect(()=>{const s=new ResizeObserver(ae=>{w(c||ae[0].target.clientWidth||620),l(R||ae[0].target.clientHeight||480)});return e.current&&(l(e.current.clientHeight||480),w(e.current.clientWidth||620),c||s.observe(e.current)),()=>s.disconnect()},[c,R]),i.jsxRuntimeExports.jsx("div",{className:`${v||"light"} flex ${c?"w-fit grow-0":"w-full grow"}`,dir:k==="he"||k==="ar"?"rtl":void 0,children:i.jsxRuntimeExports.jsx("div",{className:i.mo(`${j?j===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${k||"en"}`,f?.graphContainer),style:{...p?.graphContainer||{},...j&&j!==!0?{backgroundColor:j}:{}},id:K,ref:h,"aria-label":D||`${u?`The graph shows ${u}. `:""}This is a bee swarm chart showing the distribution along the y-axes. ${b?` ${b}`:""}`,children:i.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:j?A||"1rem":A||0},children:i.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[u||b||V||H?i.jsxRuntimeExports.jsx(Ee.GraphHeader,{styles:{title:p?.title,description:p?.description},classNames:{title:f?.title,description:f?.description},graphTitle:u,graphDescription:b,width:c,graphDownload:V?h.current:void 0,dataDownload:H?o.map(s=>s.data).filter(s=>s!==void 0).length>0?o.map(s=>s.data).filter(s=>s!==void 0):o.filter(s=>s!==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:[oe!==!1&&o.filter(s=>s.color).length!==0?i.jsxRuntimeExports.jsx(we.ColorLegendWithMouseOver,{width:c,colorLegendTitle:F,colors:C||le.Colors[v].categoricalColors.colors,colorDomain:I||ce.uniqBy(o.filter(s=>s.color),"color").map(s=>s.color),setSelectedColor:t,showNAColor:X}):null,i.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center w-full leading-0",ref:e,"aria-label":"Graph area",children:(c||M)&&(R||r)?i.jsxRuntimeExports.jsx(Se,{data:o,circleColors:o.filter(s=>s.color).length===0?C?[C]:[le.Colors.primaryColors["blue-600"]]:C||le.Colors[v].categoricalColors.colors,colorDomain:o.filter(s=>s.color).length===0?[]:I||ce.uniqBy(o.filter(s=>s.color),"color").map(s=>s.color),width:c||M,selectedColor:T,height:Math.max(E,R||(n?E?(c||M)*n>E?(c||M)*n:E:(c||M)*n:r)),showTicks:G,leftMargin:B,rightMargin:U,topMargin:$,bottomMargin:m,showLabels:g,tooltip:Z,onSeriesMouseOver:J,refValues:P,startFromZero:!1,radius:L,maxRadiusValue:N,maxValue:S,minValue:y,highlightedDataPoints:q,onSeriesMouseClick:Q,resetSelectionOnDoubleClick:W,detailsOnClick:Y,styles:p,classNames:f,suffix:z,prefix:ee,noOfTicks:x||5,dimmedOpacity:d,precision:_,customLayers:te}):null})]})}),ie||se?i.jsxRuntimeExports.jsx(Re.GraphFooter,{styles:{footnote:p?.footnote,source:p?.source},classNames:{footnote:f?.footnote,source:f?.source},sources:ie,footNote:se,width:c}):null]})})})})}function Te(ne){const{data:o,graphTitle:u,backgroundColor:C,topMargin:ie,bottomMargin:b,leftMargin:R,rightMargin:c,showLabels:se,showTicks:I,colors:F,sources:A,graphDescription:j,height:$,width:m,footNote:B,colorDomain:U,colorLegendTitle:g,padding:G,relativeHeight:n,tooltip:Z,onSeriesMouseOver:J,refValues:P,showColorScale:oe,graphID:K,radius:L,maxRadiusValue:N,maxValue:S,minValue:y,highlightedDataPoints:q,onSeriesMouseClick:Q,graphDownload:V,dataDownload:H,language:k,showNAColor:X,minHeight:E,theme:v,ariaLabel:D,resetSelectionOnDoubleClick:W,detailsOnClick:Y,noOfTicks:z,orientation:ee="vertical",styles:p,classNames:f,dimmedOpacity:x,precision:d,customLayers:_}=ne;return ee==="vertical"?i.jsxRuntimeExports.jsx(De,{data:o,graphTitle:u,backgroundColor:C,topMargin:ie,bottomMargin:b,leftMargin:R,rightMargin:c,showLabels:se,showTicks:I,colors:F,sources:A,graphDescription:j,height:$,width:m,footNote:B,colorDomain:U,colorLegendTitle:g,padding:G,relativeHeight:n,tooltip:Z,onSeriesMouseOver:J,refValues:P,showColorScale:oe,graphID:K,radius:L,maxRadiusValue:N,maxValue:S,minValue:y,highlightedDataPoints:q,onSeriesMouseClick:Q,graphDownload:V,dataDownload:H,language:k,showNAColor:X,minHeight:E,theme:v,ariaLabel:D,resetSelectionOnDoubleClick:W,styles:p,detailsOnClick:Y,classNames:f,noOfTicks:z,dimmedOpacity:x,precision:d,customLayers:_}):i.jsxRuntimeExports.jsx(Ne,{data:o,graphTitle:u,backgroundColor:C,topMargin:ie,bottomMargin:b,leftMargin:R,rightMargin:c,showLabels:se,showTicks:I,colors:F,sources:A,graphDescription:j,height:$,width:m,footNote:B,colorDomain:U,colorLegendTitle:g,padding:G,relativeHeight:n,tooltip:Z,onSeriesMouseOver:J,refValues:P,showColorScale:oe,graphID:K,radius:L,maxRadiusValue:N,maxValue:S,minValue:y,highlightedDataPoints:q,onSeriesMouseClick:Q,graphDownload:V,dataDownload:H,language:k,showNAColor:X,minHeight:E,theme:v,ariaLabel:D,resetSelectionOnDoubleClick:W,styles:p,detailsOnClick:Y,classNames:f,noOfTicks:z,dimmedOpacity:x,precision:d,customLayers:_})}exports.BeeSwarmChart=Te;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index-CHPV5EwG-DDoeWRVt.cjs"),ce=require("./index-CZbIGs8q.cjs"),a=require("react"),ue=require("./index-BXns0-ng.cjs"),xe=require("./index-BczVvEBZ.cjs"),de=require("./Modal-tXZlLE5s.cjs"),he=require("./Spinner-DA6Z5E4n.cjs"),me=require("./numberFormattingFunction-02t-wJta.cjs"),pe=require("./Tooltip-n8z5bfav.cjs"),O=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),fe=require("./getTextColorBasedOnBgColor-nqY-bsM_.cjs"),le=require("./Colors.cjs"),ge=require("./string2HTML-D2Avudmb.cjs"),je=require("./Axis-DE7dSn1_.cjs"),Me=require("./XTicksAndGridLines-CCzXIV8d.cjs"),ye=require("./ReferenceLine-CFVBBN__.cjs"),ve=require("./pow-B5-jkdHU.cjs"),be=require("./linear-BVckp9RD.cjs"),re=require("./y-QcCbqrzx.cjs"),Re=require("./GraphFooter.cjs"),Ee=require("./GraphHeader.cjs"),we=require("./ColorLegendWithMouseOver.cjs"),Ce=require("./EmptyState-d8_8SxeW.cjs"),Oe=require("./YTicksAndGridLines-DBDuz6vb.cjs");function ke(ne){const{data:o,circleColors:u,showTicks:C,leftMargin:ie,width:b,height:R,colorDomain:c,rightMargin:se,topMargin:I,bottomMargin:F,showLabels:A,tooltip:j,onSeriesMouseOver:$,refValues:m,selectedColor:B,startFromZero:U,radius:g,maxRadiusValue:G,maxValue:n,minValue:Z,highlightedDataPoints:J,onSeriesMouseClick:P,rtl:oe,resetSelectionOnDoubleClick:K,detailsOnClick:L,suffix:N,prefix:S,styles:y,classNames:q,noOfTicks:Q,dimmedOpacity:V,precision:H,customLayers:k}=ne,X=a.useRef(null),[E,v]=a.useState(void 0),[D,W]=a.useState(void 0),[Y,z]=a.useState(null),[ee,p]=a.useState(void 0),[f,x]=a.useState(void 0),d={top:I,bottom:F,left:ie,right:se},_=b-d.left-d.right,te=R-d.top-d.bottom,M=o.filter(e=>!O.checkIfNullOrUndefined(e.radius)).length===0?o:xe.orderBy(o.filter(e=>!O.checkIfNullOrUndefined(e.radius)),"radius","desc"),w=O.checkIfNullOrUndefined(n)?Math.max(...o.filter(e=>!O.checkIfNullOrUndefined(e.position)).map(e=>e.position))<0&&!U?0:Math.max(...o.filter(e=>!O.checkIfNullOrUndefined(e.position)).map(e=>e.position)):n,r=O.checkIfNullOrUndefined(Z)?Math.min(...o.filter(e=>!O.checkIfNullOrUndefined(e.position)).map(e=>e.position))>=0&&!U?0:Math.min(...o.filter(e=>!O.checkIfNullOrUndefined(e.position)).map(e=>e.position)):Z,l=o.filter(e=>e.radius===void 0||e.radius===null).length!==o.length?ve.sqrt().domain([0,O.checkIfNullOrUndefined(G)?Math.max(...o.map(e=>e.radius).filter(e=>e!=null)):G]).range([.25,g]).nice():void 0,T=be.linear().domain([r,w]).range([0,_]).nice(),t=T.ticks(Q);return a.useEffect(()=>{z(null);const e=M.filter(h=>h.position);re.forceSimulation(e).force("x",re.forceX(h=>T(h.position)).strength(5)).force("y",re.forceY(h=>te/2).strength(1)).force("collide",re.forceCollide(h=>l?l(h.radius||0)+1:g+1)).force("charge",re.forceManyBody().strength(-15)).alphaDecay(.05).tick(1e4).on("tick",()=>{z(e)}).on("end",()=>{z(e)})},[o,g,te,_,r,w,M,T,l]),i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[Y?i.jsxRuntimeExports.jsx("svg",{width:`${b}px`,height:`${R}px`,viewBox:`0 0 ${b} ${R}`,direction:"ltr",ref:X,children:i.jsxRuntimeExports.jsxs("g",{transform:`translate(${d.left},${d.top})`,children:[C?i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[i.jsxRuntimeExports.jsx(je.Axis,{x1:T(r<0?0:r),x2:T(r<0?0:r),y1:0-d.top,y2:te+d.bottom,label:me.numberFormattingFunction(r<0?0:r,"NA",H,S,N),labelPos:{x:T(r<0?0:r),y:0-I,dy:"0.75em",dx:3},classNames:{axis:q?.xAxis?.axis,label:q?.yAxis?.labels},styles:{axis:y?.xAxis?.axis,label:y?.yAxis?.labels}}),i.jsxRuntimeExports.jsx(Me.XTicksAndGridLines,{values:t.filter(e=>e!==0),x:t.filter(e=>e!==0).map(e=>T(e)),y1:0-I,y2:te+d.bottom,styles:{gridLines:y?.xAxis?.gridLines,labels:y?.xAxis?.labels},classNames:{gridLines:q?.xAxis?.gridLines,labels:q?.xAxis?.labels},suffix:N,prefix:S,labelType:"secondary",showGridLines:!0,precision:H})]}):null,k.filter(e=>e.position==="before").map(e=>e.layer),Y.map(e=>i.jsxRuntimeExports.jsxs("g",{className:"undp-viz-g-with-hover",transform:`translate(${e.x},${e.y})`,opacity:B?e.color&&u[c.indexOf(e.color)]===B?1:V:J.length!==0?J.indexOf(e.label)!==-1?.85:V:.85,onMouseEnter:h=>{v(e),x(h.clientY),p(h.clientX),$?.(e)},onMouseMove:h=>{v(e),x(h.clientY),p(h.clientX)},onClick:()=>{(P||L)&&(ue.isEqual(D,e)&&K?(W(void 0),P?.(void 0)):(W(e),P?.(e)))},onMouseLeave:()=>{v(void 0),p(void 0),x(void 0),$?.(void 0)},children:[i.jsxRuntimeExports.jsx("circle",{cx:0,cy:0,fill:o.filter(h=>h.color).length===0?u[0]:e.color?u[c.indexOf(e.color)]:le.Colors.gray,radius:l?l(e.radius||0):g}),(l?l(e.radius||0):g)>10&&A?i.jsxRuntimeExports.jsx("g",{children:i.jsxRuntimeExports.jsx("foreignObject",{y:0-(l?l(e.radius||0):g),x:0-(l?l(e.radius||0):g),width:2*(l?l(e.radius||0):g),height:2*(l?l(e.radius||0):g),children:i.jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-0.5 justify-center items-center h-inherit py-0 px-1.5",children:A?i.jsxRuntimeExports.jsx("p",{className:i.mo("text-center leading-none m-0",q?.graphObjectValues),style:{fontSize:`${Math.min(Math.max(Math.round((l?l(e.radius||0):g)/4),10),Math.max(Math.round((l?l(e.radius||0):g)*12/`${e.label}`.length),10),20)}px`,color:fe.getTextColorBasedOnBgColor(o.filter(h=>h.color).length===0?u[0]:e.color?u[c.indexOf(e.color)]:le.Colors.gray),hyphens:"auto",...y?.graphObjectValues||{}},children:e.label}):null})})}):null]},e.label)),m?i.jsxRuntimeExports.jsx(i.jsxRuntimeExports.Fragment,{children:m.map((e,h)=>i.jsxRuntimeExports.jsx(ye.RefLineX,{text:e.text,color:e.color,x:T(e.value),y1:0-d.top,y2:te+d.bottom,textSide:T(e.value)>_*.75||oe?"left":"right",classNames:e.classNames,styles:e.styles,isInView:!0},h))}):null,k.filter(e=>e.position==="after").map(e=>e.layer)]})}):i.jsxRuntimeExports.jsx("div",{style:{width:`${b}px`,height:`${R}px`},children:i.jsxRuntimeExports.jsx("div",{className:"flex m-auto items-center justify-center p-0 leading-none text-base h-40",children:i.jsxRuntimeExports.jsx(he.y,{})})}),E&&j&&ee&&f?i.jsxRuntimeExports.jsx(pe.Tooltip,{data:E,body:j,xPos:ee,yPos:f,backgroundStyle:y?.tooltip,className:q?.tooltip}):null,L&&D!==void 0?i.jsxRuntimeExports.jsx(de.X,{open:D!==void 0,onClose:()=>{W(void 0)},children:i.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof L=="string"?{__html:ge.string2HTML(L,D)}:void 0,children:typeof L=="function"?L(D):null})}):null]})}function Ne(ne){const{data:o,graphTitle:u,backgroundColor:C=!1,topMargin:ie=25,bottomMargin:b=10,leftMargin:R=10,rightMargin:c=10,showLabels:se=!0,showTicks:I=!0,colors:F,sources:A,graphDescription:j,height:$,width:m,footNote:B,colorDomain:U,colorLegendTitle:g,padding:G,relativeHeight:n,tooltip:Z,onSeriesMouseOver:J,refValues:P,showColorScale:oe,graphID:K,radius:L=5,maxRadiusValue:N,maxValue:S,minValue:y,highlightedDataPoints:q=[],onSeriesMouseClick:Q,graphDownload:V=!1,dataDownload:H=!1,language:k="en",showNAColor:X=!0,minHeight:E=0,theme:v="light",ariaLabel:D,resetSelectionOnDoubleClick:W=!0,detailsOnClick:Y,suffix:z="",prefix:ee="",styles:p,classNames:f,noOfTicks:x,dimmedOpacity:d=.3,precision:_=2,customLayers:te=[]}=ne,[M,w]=a.useState(0),[r,l]=a.useState(0),[T,t]=a.useState(void 0),e=a.useRef(null),h=a.useRef(null);return a.useEffect(()=>{const s=new ResizeObserver(ae=>{w(m||ae[0].target.clientWidth||620),l($||ae[0].target.clientHeight||480)});return e.current&&(l(e.current.clientHeight||480),w(e.current.clientWidth||620),m||s.observe(e.current)),()=>s.disconnect()},[m,$]),i.jsxRuntimeExports.jsx("div",{className:`${v||"light"} flex ${m?"w-fit grow-0":"w-full grow"}`,dir:k==="he"||k==="ar"?"rtl":void 0,children:i.jsxRuntimeExports.jsx("div",{className:i.mo(`${C?C===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${k||"en"}`,f?.graphContainer),style:{...p?.graphContainer||{},...C&&C!==!0?{backgroundColor:C}:{}},id:K,ref:h,"aria-label":D||`${u?`The graph shows ${u}. `:""}This is a bee swarm chart showing the distribution along the x-axes. ${j?` ${j}`:""}`,children:i.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:C?G||"1rem":G||0},children:i.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[u||j||V||H?i.jsxRuntimeExports.jsx(Ee.GraphHeader,{styles:{title:p?.title,description:p?.description},classNames:{title:f?.title,description:f?.description},graphTitle:u,graphDescription:j,width:m,graphDownload:V?h.current:void 0,dataDownload:H?o.map(s=>s.data).filter(s=>s!==void 0).length>0?o.map(s=>s.data).filter(s=>s!==void 0):o.filter(s=>s!==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:[oe!==!1&&o.filter(s=>s.color).length!==0?i.jsxRuntimeExports.jsx(we.ColorLegendWithMouseOver,{width:m,colorLegendTitle:g,colors:F||le.Colors[v].categoricalColors.colors,colorDomain:U||ce.uniqBy(o.filter(s=>s.color),"color").map(s=>s.color),setSelectedColor:t,showNAColor:X??!0}):null,i.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center w-full leading-0",ref:e,"aria-label":"Graph area",children:(m||M)&&($||r)?i.jsxRuntimeExports.jsx(ke,{data:o,circleColors:o.filter(s=>s.color).length===0?F?[F]:[le.Colors.primaryColors["blue-600"]]:F||le.Colors[v].categoricalColors.colors,colorDomain:o.filter(s=>s.color).length===0?[]:U||ce.uniqBy(o.filter(s=>s.color),"color").map(s=>s.color),width:m||M,selectedColor:T,height:Math.max(E,$||(n?E?(m||M)*n>E?(m||M)*n:E:(m||M)*n:r)),showTicks:I,leftMargin:R,rightMargin:c,topMargin:ie,bottomMargin:b,showLabels:se,tooltip:Z,onSeriesMouseOver:J,refValues:P,startFromZero:!1,radius:L,maxRadiusValue:N,maxValue:S,minValue:y,highlightedDataPoints:q,onSeriesMouseClick:Q,rtl:k==="he"||k==="ar",resetSelectionOnDoubleClick:W,detailsOnClick:Y,suffix:z,prefix:ee,styles:p,classNames:f,noOfTicks:x||5,dimmedOpacity:d,precision:_,customLayers:te}):null})]})}),A||B?i.jsxRuntimeExports.jsx(Re.GraphFooter,{styles:{footnote:p?.footnote,source:p?.source},classNames:{footnote:f?.footnote,source:f?.source},sources:A,footNote:B,width:m}):null]})})})})}function Se(ne){const{data:o,circleColors:u,showTicks:C,leftMargin:ie,width:b,height:R,colorDomain:c,rightMargin:se,topMargin:I,bottomMargin:F,suffix:A,prefix:j,showLabels:$,tooltip:m,onSeriesMouseOver:B,refValues:U,selectedColor:g,startFromZero:G,radius:n,maxRadiusValue:Z,maxValue:J,minValue:P,highlightedDataPoints:oe,onSeriesMouseClick:K,resetSelectionOnDoubleClick:L,detailsOnClick:N,styles:S,classNames:y,noOfTicks:q,dimmedOpacity:Q,precision:V,customLayers:H}=ne,k=a.useRef(null),[X,E]=a.useState(void 0),[v,D]=a.useState(void 0),[W,Y]=a.useState(null),[z,ee]=a.useState(void 0),[p,f]=a.useState(void 0),x={top:I,bottom:F,left:ie,right:se},d=b-x.left-x.right,_=R-x.top-x.bottom,te=o.filter(t=>!O.checkIfNullOrUndefined(t.radius)).length===0?o:xe.orderBy(o.filter(t=>!O.checkIfNullOrUndefined(t.radius)),"radius","desc"),M=O.checkIfNullOrUndefined(J)?Math.max(...o.filter(t=>!O.checkIfNullOrUndefined(t.position)).map(t=>t.position))<0&&!G?0:Math.max(...o.filter(t=>!O.checkIfNullOrUndefined(t.position)).map(t=>t.position)):J,w=O.checkIfNullOrUndefined(P)?Math.min(...o.filter(t=>!O.checkIfNullOrUndefined(t.position)).map(t=>t.position))>=0&&!G?0:Math.min(...o.filter(t=>!O.checkIfNullOrUndefined(t.position)).map(t=>t.position)):P,r=o.filter(t=>t.radius===void 0||t.radius===null).length!==o.length?ve.sqrt().domain([0,O.checkIfNullOrUndefined(Z)?Math.max(...o.map(t=>t.radius).filter(t=>t!=null)):Z]).range([.25,n]).nice():void 0,l=be.linear().domain([w,M]).range([_,0]).nice(),T=l.ticks(q);return a.useEffect(()=>{Y(null);const t=te.filter(e=>e.position);re.forceSimulation(t).force("y",re.forceY(e=>l(e.position)).strength(5)).force("x",re.forceX(e=>d/2).strength(1)).force("collide",re.forceCollide(e=>r?r(e.radius||0)+1:n+1)).force("charge",re.forceManyBody().strength(-15)).alphaDecay(.05).tick(1e4).on("tick",()=>{Y(t)}).on("end",()=>{Y(t)})},[o,n,_,d,w,M,te,l,r]),i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[W?i.jsxRuntimeExports.jsx("svg",{width:`${b}px`,height:`${R}px`,viewBox:`0 0 ${b} ${R}`,direction:"ltr",ref:k,children:i.jsxRuntimeExports.jsxs("g",{transform:`translate(${x.left},${x.top})`,children:[C?i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[i.jsxRuntimeExports.jsx(je.Axis,{y1:l(w<0?0:w),y2:l(w<0?0:w),x1:0-x.left,x2:d+x.right,label:me.numberFormattingFunction(w<0?0:w,"NA",V,j,A),labelPos:{x:0-x.left,y:l(w<0?0:w),dx:0,dy:M<0?"1em":-5},classNames:{axis:y?.xAxis?.axis,label:y?.yAxis?.labels},styles:{axis:S?.xAxis?.axis,label:S?.yAxis?.labels}}),i.jsxRuntimeExports.jsx(Oe.YTicksAndGridLines,{values:T.filter(t=>t!==0),y:T.filter(t=>t!==0).map(t=>l(t)),x1:0-x.left,x2:d+x.right,styles:{gridLines:S?.yAxis?.gridLines,labels:S?.yAxis?.labels},classNames:{gridLines:y?.yAxis?.gridLines,labels:y?.yAxis?.labels},suffix:A,prefix:j,labelType:"secondary",showGridLines:!0,labelPos:"vertical",precision:V})]}):null,H.filter(t=>t.position==="before").map(t=>t.layer),W.map(t=>i.jsxRuntimeExports.jsxs("g",{className:"undp-viz-g-with-hover",transform:`translate(${t.x},${t.y})`,opacity:g?t.color&&u[c.indexOf(t.color)]===g?1:Q:oe.length!==0?oe.indexOf(t.label)!==-1?.85:Q:.85,onMouseEnter:e=>{E(t),f(e.clientY),ee(e.clientX),B?.(t)},onMouseMove:e=>{E(t),f(e.clientY),ee(e.clientX)},onClick:()=>{(K||N)&&(ue.isEqual(v,t)&&L?(D(void 0),K?.(void 0)):(D(t),K?.(t)))},onMouseLeave:()=>{E(void 0),ee(void 0),f(void 0),B?.(void 0)},children:[i.jsxRuntimeExports.jsx("circle",{cx:0,cy:0,r:r?r(t.radius||0):n,fill:o.filter(e=>e.color).length===0?u[0]:t.color?u[c.indexOf(t.color)]:le.Colors.gray}),(r?r(t.radius||0):n)>10&&$?i.jsxRuntimeExports.jsx("g",{children:i.jsxRuntimeExports.jsx("foreignObject",{y:0-(r?r(t.radius||0):n),x:0-(r?r(t.radius||0):n),width:2*(r?r(t.radius||0):n),height:2*(r?r(t.radius||0):n),children:i.jsxRuntimeExports.jsx("div",{className:"flex flex-col justify-center items-center h-inherit py-0 px-1.5",children:$?i.jsxRuntimeExports.jsx("p",{className:i.mo("text-center leading-none m-0",y?.graphObjectValues),style:{fontSize:`${Math.min(Math.max(Math.round((r?r(t.radius||0):n)/4),10),Math.max(Math.round((r?r(t.radius||0):n)*12/`${t.label}`.length),10),20)}px`,hyphens:"auto",color:fe.getTextColorBasedOnBgColor(o.filter(e=>e.color).length===0?u[0]:t.color?u[c.indexOf(t.color)]:le.Colors.gray),...S?.graphObjectValues||{}},children:t.label}):null})})}):null]},t.label)),U?i.jsxRuntimeExports.jsx(i.jsxRuntimeExports.Fragment,{children:U.map((t,e)=>i.jsxRuntimeExports.jsx(ye.RefLineY,{text:t.text,color:t.color,y:l(t.value),x1:0-x.left,x2:d+x.right,classNames:t.classNames,styles:t.styles,isInView:!0},e))}):null,H.filter(t=>t.position==="after").map(t=>t.layer)]})}):i.jsxRuntimeExports.jsx("div",{style:{width:`${b}px`,height:`${R}px`},children:i.jsxRuntimeExports.jsx("div",{className:"flex m-auto items-center justify-center p-0 leading-none text-base h-40",children:i.jsxRuntimeExports.jsx(he.y,{})})}),X&&m&&z&&p?i.jsxRuntimeExports.jsx(pe.Tooltip,{data:X,body:m,xPos:z,yPos:p,backgroundStyle:S?.tooltip,className:y?.tooltip}):null,N&&v!==void 0?i.jsxRuntimeExports.jsx(de.X,{open:v!==void 0,onClose:()=>{D(void 0)},children:i.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof N=="string"?{__html:ge.string2HTML(N,v)}:void 0,children:typeof N=="function"?N(v):null})}):null]})}function De(ne){const{data:o,graphTitle:u,colors:C,sources:ie,graphDescription:b,height:R,width:c,footNote:se,colorDomain:I,colorLegendTitle:F,padding:A,backgroundColor:j=!1,topMargin:$=25,bottomMargin:m=10,leftMargin:B=100,rightMargin:U=40,showLabels:g=!0,showTicks:G=!0,relativeHeight:n,tooltip:Z,onSeriesMouseOver:J,refValues:P,showColorScale:oe,graphID:K,radius:L=5,maxRadiusValue:N,maxValue:S,minValue:y,highlightedDataPoints:q=[],onSeriesMouseClick:Q,graphDownload:V=!1,dataDownload:H=!1,language:k="en",showNAColor:X=!0,minHeight:E=0,theme:v="light",ariaLabel:D,resetSelectionOnDoubleClick:W=!0,detailsOnClick:Y,suffix:z="",prefix:ee="",styles:p,classNames:f,noOfTicks:x,dimmedOpacity:d=.3,precision:_=2,customLayers:te=[]}=ne,[M,w]=a.useState(0),[r,l]=a.useState(0),[T,t]=a.useState(void 0),e=a.useRef(null),h=a.useRef(null);return a.useEffect(()=>{const s=new ResizeObserver(ae=>{w(c||ae[0].target.clientWidth||620),l(R||ae[0].target.clientHeight||480)});return e.current&&(l(e.current.clientHeight||480),w(e.current.clientWidth||620),c||s.observe(e.current)),()=>s.disconnect()},[c,R]),i.jsxRuntimeExports.jsx("div",{className:`${v||"light"} flex ${c?"w-fit grow-0":"w-full grow"}`,dir:k==="he"||k==="ar"?"rtl":void 0,children:i.jsxRuntimeExports.jsx("div",{className:i.mo(`${j?j===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${k||"en"}`,f?.graphContainer),style:{...p?.graphContainer||{},...j&&j!==!0?{backgroundColor:j}:{}},id:K,ref:h,"aria-label":D||`${u?`The graph shows ${u}. `:""}This is a bee swarm chart showing the distribution along the y-axes. ${b?` ${b}`:""}`,children:i.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:j?A||"1rem":A||0},children:i.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[u||b||V||H?i.jsxRuntimeExports.jsx(Ee.GraphHeader,{styles:{title:p?.title,description:p?.description},classNames:{title:f?.title,description:f?.description},graphTitle:u,graphDescription:b,width:c,graphDownload:V?h.current:void 0,dataDownload:H?o.map(s=>s.data).filter(s=>s!==void 0).length>0?o.map(s=>s.data).filter(s=>s!==void 0):o.filter(s=>s!==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:[oe!==!1&&o.filter(s=>s.color).length!==0?i.jsxRuntimeExports.jsx(we.ColorLegendWithMouseOver,{width:c,colorLegendTitle:F,colors:C||le.Colors[v].categoricalColors.colors,colorDomain:I||ce.uniqBy(o.filter(s=>s.color),"color").map(s=>s.color),setSelectedColor:t,showNAColor:X}):null,i.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center w-full leading-0",ref:e,"aria-label":"Graph area",children:(c||M)&&(R||r)?i.jsxRuntimeExports.jsx(Se,{data:o,circleColors:o.filter(s=>s.color).length===0?C?[C]:[le.Colors.primaryColors["blue-600"]]:C||le.Colors[v].categoricalColors.colors,colorDomain:o.filter(s=>s.color).length===0?[]:I||ce.uniqBy(o.filter(s=>s.color),"color").map(s=>s.color),width:c||M,selectedColor:T,height:Math.max(E,R||(n?E?(c||M)*n>E?(c||M)*n:E:(c||M)*n:r)),showTicks:G,leftMargin:B,rightMargin:U,topMargin:$,bottomMargin:m,showLabels:g,tooltip:Z,onSeriesMouseOver:J,refValues:P,startFromZero:!1,radius:L,maxRadiusValue:N,maxValue:S,minValue:y,highlightedDataPoints:q,onSeriesMouseClick:Q,resetSelectionOnDoubleClick:W,detailsOnClick:Y,styles:p,classNames:f,suffix:z,prefix:ee,noOfTicks:x||5,dimmedOpacity:d,precision:_,customLayers:te}):null})]})}),ie||se?i.jsxRuntimeExports.jsx(Re.GraphFooter,{styles:{footnote:p?.footnote,source:p?.source},classNames:{footnote:f?.footnote,source:f?.source},sources:ie,footNote:se,width:c}):null]})})})})}function Te(ne){const{data:o,graphTitle:u,backgroundColor:C,topMargin:ie,bottomMargin:b,leftMargin:R,rightMargin:c,showLabels:se,showTicks:I,colors:F,sources:A,graphDescription:j,height:$,width:m,footNote:B,colorDomain:U,colorLegendTitle:g,padding:G,relativeHeight:n,tooltip:Z,onSeriesMouseOver:J,refValues:P,showColorScale:oe,graphID:K,radius:L,maxRadiusValue:N,maxValue:S,minValue:y,highlightedDataPoints:q,onSeriesMouseClick:Q,graphDownload:V,dataDownload:H,language:k,showNAColor:X,minHeight:E,theme:v,ariaLabel:D,resetSelectionOnDoubleClick:W,detailsOnClick:Y,noOfTicks:z,orientation:ee="vertical",styles:p,classNames:f,dimmedOpacity:x,precision:d,customLayers:_}=ne;return ee==="vertical"?i.jsxRuntimeExports.jsx(De,{data:o,graphTitle:u,backgroundColor:C,topMargin:ie,bottomMargin:b,leftMargin:R,rightMargin:c,showLabels:se,showTicks:I,colors:F,sources:A,graphDescription:j,height:$,width:m,footNote:B,colorDomain:U,colorLegendTitle:g,padding:G,relativeHeight:n,tooltip:Z,onSeriesMouseOver:J,refValues:P,showColorScale:oe,graphID:K,radius:L,maxRadiusValue:N,maxValue:S,minValue:y,highlightedDataPoints:q,onSeriesMouseClick:Q,graphDownload:V,dataDownload:H,language:k,showNAColor:X,minHeight:E,theme:v,ariaLabel:D,resetSelectionOnDoubleClick:W,styles:p,detailsOnClick:Y,classNames:f,noOfTicks:z,dimmedOpacity:x,precision:d,customLayers:_}):i.jsxRuntimeExports.jsx(Ne,{data:o,graphTitle:u,backgroundColor:C,topMargin:ie,bottomMargin:b,leftMargin:R,rightMargin:c,showLabels:se,showTicks:I,colors:F,sources:A,graphDescription:j,height:$,width:m,footNote:B,colorDomain:U,colorLegendTitle:g,padding:G,relativeHeight:n,tooltip:Z,onSeriesMouseOver:J,refValues:P,showColorScale:oe,graphID:K,radius:L,maxRadiusValue:N,maxValue:S,minValue:y,highlightedDataPoints:q,onSeriesMouseClick:Q,graphDownload:V,dataDownload:H,language:k,showNAColor:X,minHeight:E,theme:v,ariaLabel:D,resetSelectionOnDoubleClick:W,styles:p,detailsOnClick:Y,classNames:f,noOfTicks:z,dimmedOpacity:x,precision:d,customLayers:_})}exports.BeeSwarmChart=Te;
|
|
2
2
|
//# sourceMappingURL=BeeSwarmChart.cjs.map
|
package/dist/BeeSwarmChart.js
CHANGED
|
@@ -3,7 +3,7 @@ import { u as ce } from "./index-CaAIPGZo.js";
|
|
|
3
3
|
import { useRef as ae, useState as T, useEffect as de } from "react";
|
|
4
4
|
import { i as ge } from "./index-27yTRcko.js";
|
|
5
5
|
import { o as ue } from "./index-BLizQDlg.js";
|
|
6
|
-
import { X as me } from "./Modal-
|
|
6
|
+
import { X as me } from "./Modal-DVVwpKhP.js";
|
|
7
7
|
import { y as fe } from "./Spinner-C85UF28E.js";
|
|
8
8
|
import { n as xe } from "./numberFormattingFunction-14YCbkN2.js";
|
|
9
9
|
import { T as pe } from "./Tooltip-DyM5snqx.js";
|
|
@@ -13,7 +13,7 @@ import { Colors as le } from "./Colors.js";
|
|
|
13
13
|
import { s as ve } from "./string2HTML-CWHGfz_d.js";
|
|
14
14
|
import { A as be } from "./Axis-Ddg-seDi.js";
|
|
15
15
|
import { X as Te } from "./XTicksAndGridLines-Bn9u5gOM.js";
|
|
16
|
-
import { a as Ve, R as Ae } from "./ReferenceLine-
|
|
16
|
+
import { a as Ve, R as Ae } from "./ReferenceLine-CfAW3vKJ.js";
|
|
17
17
|
import { s as we } from "./pow-e8zx3AQJ.js";
|
|
18
18
|
import { a as je } from "./linear-DUdu7l2G.js";
|
|
19
19
|
import { f as Me, b as Ce, a as Oe, c as De, d as ke } from "./y-D0sAaVii.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-CHPV5EwG-DDoeWRVt.cjs"),d=require("react"),ke=require("./getSliderMarks-CtsEXiLV.cjs"),Ie=require("./Spinner-DA6Z5E4n.cjs"),Ce=require("./parse-hMnG_lRV.cjs"),Pe=require("./index-CZbIGs8q.cjs"),Le=require("./index-BXns0-ng.cjs"),D=require("./zoom-Lo7IAUfC.cjs"),Te=require("./Modal-C_dl0EtQ.cjs"),Se=require("./Typography-k-kOjICQ.cjs"),Ne=require("./numberFormattingFunction-02t-wJta.cjs"),ze=require("./Tooltip-n8z5bfav.cjs"),We=require("./string2HTML-D2Avudmb.cjs"),De=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),$e=require("./index-BW_-wD2k.cjs"),Ae=require("./use-in-view-BCmzDU2O.cjs"),we=require("./select-Bnfk0lJx.cjs"),Me=require("./threshold-DNsSUf8Q.cjs"),ae=require("./proxy-PQd2AItT.cjs"),Be=require("./index-DVOJ7vxH.cjs"),Fe=require("./GraphHeader.cjs"),Ve=require("./GraphFooter.cjs"),Re=require("./Colors.cjs"),He=require("./fetchAndParseData-DmgQtB9n.cjs"),qe=require("./getJenks-TWQvbuOz.cjs"),Ge=require("./init-DU0ybBc_.cjs");function Ue(je){const{data:v,xDomain:R,mapData:f,xColorLegendTitle:M,yDomain:T,yColorLegendTitle:z,width:u,height:l,colors:Y,scale:J,centerPoint:$,mapBorderWidth:W,mapNoDataColor:q,mapBorderColor:ne,tooltip:se,onSeriesMouseOver:le,zoomScaleExtend:ce,zoomTranslateExtend:ve,highlightedIds:A,onSeriesMouseClick:b,mapProperty:B,resetSelectionOnDoubleClick:E,detailsOnClick:S,showColorScale:de,styles:be,classNames:Ee,mapProjection:F,zoomInteraction:O,animate:k,dimmedOpacity:V,customLayers:me}=je,[ue,K]=d.useState(!(u<680)),[H,G]=d.useState(void 0),[h,Z]=d.useState(void 0),[U,Q]=d.useState(void 0),[pe,w]=d.useState(void 0),[C,ee]=d.useState(void 0),I=d.useRef(null),X=Ae.useInView(I,{once:k.once,amount:k.amount}),xe=d.useRef(null),te=d.useRef(null);d.useEffect(()=>{const e=we.select(xe.current),n=we.select(I.current),r=o=>{if(O==="noZoom")return!1;if(O==="button")return!o.type.includes("wheel");const a=o.type==="wheel",m=o.type.startsWith("touch"),s=o.type==="mousedown"||o.type==="mousemove";return m?!0:a?O==="scroll"?!0:o.ctrlKey:s&&!o.button&&!o.ctrlKey},i=D.zoom().scaleExtent(ce).translateExtent(ve||[[-20,-20],[u+20,l+20]]).filter(r).on("zoom",({transform:o})=>{e.attr("transform",o)});n.call(i),te.current=i},[l,u,O]);const p=D.turf_bbox_default(f),g=D.turf_centroid_default(f),he=p[2]-p[0],re=p[3]-p[1],ge=u*190/960*360/he,P=l*190/678*180/re,L=J*Math.min(ge,P),c=F==="mercator"?D.geoMercator().rotate([0,0]).center($||g.geometry.coordinates).translate([u/2,l/2]).scale(L):F==="equalEarth"?D.geoEqualEarth().rotate([0,0]).center($||g.geometry.coordinates).translate([u/2,l/2]).scale(L):F==="naturalEarth"?D.geoNaturalEarth1().rotate([0,0]).center($||g.geometry.coordinates).translate([u/2,l/2]).scale(L):F==="orthographic"?D.geoOrthographic().rotate([0,0]).center($||g.geometry.coordinates).translate([u/2,l/2]).scale(L):D.geoAlbersUsa().rotate([0,0]).center($||g.geometry.coordinates).translate([u/2,l/2]).scale(L),oe=Array.from({length:R.length},(e,n)=>n),ie=Array.from({length:T.length},(e,n)=>n),_=Me.threshold().domain(R).range(oe),ye=Me.threshold().domain(T).range(ie),N=e=>{if(!I.current||!te.current)return;we.select(I.current).call(te.current.scaleBy,e==="in"?1.2:1/1.2)};return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs("div",{className:"relative",children:[t.jsxRuntimeExports.jsx(ae.motion.svg,{viewBox:`0 0 ${u} ${l}`,width:`${u}px`,height:`${l}px`,ref:I,direction:"ltr",children:t.jsxRuntimeExports.jsxs("g",{ref:xe,children:[me.filter(e=>e.position==="before").map(e=>e.layer),f.features.map((e,n)=>v.findIndex(i=>i.id===e.properties[B])!==-1?null:t.jsxRuntimeExports.jsx(ae.motion.g,{opacity:H?V:A.length!==0?A.indexOf(e.properties[B])!==-1?1:V:1,children:e.geometry.type==="MultiPolygon"?e.geometry.coordinates.map((i,o)=>{let a="";return i.forEach(m=>{let s=" M";m.forEach((x,y)=>{const j=c([x[0],x[1]]);y!==m.length-1?s=`${s}${j[0]} ${j[1]}L`:s=`${s}${j[0]} ${j[1]}`}),a+=s}),t.jsxRuntimeExports.jsx("path",{d:a,style:{stroke:ne,strokeWidth:W,fill:q}},o)}):e.geometry.coordinates.map((i,o)=>{let a="M";return i.forEach((m,s)=>{const x=c([m[0],m[1]]);s!==i.length-1?a=`${a}${x[0]} ${x[1]}L`:a=`${a}${x[0]} ${x[1]}`}),t.jsxRuntimeExports.jsx("path",{d:a,style:{stroke:ne,strokeWidth:W,fill:q}},o)})},n)),t.jsxRuntimeExports.jsx(Be.AnimatePresence,{children:v.map(e=>{const n=f.features.findIndex(a=>e.id===a.properties[B]),r=De.checkIfNullOrUndefined(e.x)?void 0:_(e.x),i=De.checkIfNullOrUndefined(e.y)?void 0:ye(e.y),o=r!==void 0&&i!==void 0?Y[i][r]:q;return t.jsxRuntimeExports.jsx(ae.motion.g,{variants:{initial:{opacity:0},whileInView:{opacity:H?H===o?1:V:A.length!==0?A.indexOf(e.id)!==-1?1:V:1,transition:{duration:k.duration}}},initial:"initial",animate:X?"whileInView":"initial",exit:{opacity:0,transition:{duration:k.duration}},onMouseEnter:a=>{Q(e),ee(a.clientY),w(a.clientX),le?.(e)},onClick:()=>{(b||S)&&(Le.isEqual(h,e)&&E?(Z(void 0),b?.(void 0)):(Z(e),b?.(e)))},onMouseMove:a=>{Q(e),ee(a.clientY),w(a.clientX)},onMouseLeave:()=>{Q(void 0),w(void 0),ee(void 0),le?.(void 0)},children:n===-1?null:f.features[n].geometry.type==="MultiPolygon"?f.features[n].geometry.coordinates.map((a,m)=>{let s="";return a.forEach(x=>{let y=" M";x.forEach((j,Oe)=>{const fe=c([j[0],j[1]]);Oe!==x.length-1?y=`${y}${fe[0]} ${fe[1]}L`:y=`${y}${fe[0]} ${fe[1]}`}),s+=y}),t.jsxRuntimeExports.jsx(ae.motion.path,{variants:{initial:{fill:o,opacity:0},whileInView:{fill:o,opacity:1,transition:{duration:k.duration}}},initial:"initial",animate:X?"whileInView":"initial",exit:{opacity:0,transition:{duration:k.duration}},d:s,className:`${o===q?"stroke-primary-gray-400 dark:stroke-primary-gray-500":"stroke-primary-white dark:stroke-primary-gray-650"}`,style:{strokeWidth:W}},`${e.id}-${m}`)}):f.features[n].geometry.coordinates.map((a,m)=>{let s="M";return a.forEach((x,y)=>{const j=c([x[0],x[1]]);y!==a.length-1?s=`${s}${j[0]} ${j[1]}L`:s=`${s}${j[0]} ${j[1]}`}),t.jsxRuntimeExports.jsx(ae.motion.path,{d:s,variants:{initial:{fill:o,opacity:0},whileInView:{fill:o,opacity:1,transition:{duration:k.duration}}},initial:"initial",animate:X?"whileInView":"initial",exit:{opacity:0,transition:{duration:k.duration}},className:`${o===q?"stroke-primary-gray-400 dark:stroke-primary-gray-500":"stroke-primary-white dark:stroke-primary-gray-650"}`,style:{strokeWidth:W}},`${e.id}-${m}`)})},e.id)})}),U?f.features.filter(e=>e.properties[B]===U.id).map((e,n)=>t.jsxRuntimeExports.jsx("g",{children:e.geometry.type==="MultiPolygon"?e.geometry.coordinates.map((r,i)=>{let o="";return r.forEach(a=>{let m=" M";a.forEach((s,x)=>{const y=c([s[0],s[1]]);x!==a.length-1?m=`${m}${y[0]} ${y[1]}L`:m=`${m}${y[0]} ${y[1]}`}),o+=m}),t.jsxRuntimeExports.jsx("path",{d:o,className:"stroke-primary-gray-700 dark:stroke-primary-gray-300",style:{fill:"none",fillOpacity:0,strokeWidth:"0.5"}},i)}):e.geometry.coordinates.map((r,i)=>{let o="M";return r.forEach((a,m)=>{const s=c([a[0],a[1]]);m!==r.length-1?o=`${o}${s[0]} ${s[1]}L`:o=`${o}${s[0]} ${s[1]}`}),t.jsxRuntimeExports.jsx("path",{d:o,className:"stroke-primary-gray-700 dark:stroke-primary-gray-300",style:{fill:"none",fillOpacity:0,strokeWidth:"0.5"}},i)})},n)):null,me.filter(e=>e.position==="after").map(e=>e.layer)]})}),de===!1?null:t.jsxRuntimeExports.jsx("div",{className:"absolute left-4 bottom-4",children:ue?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:()=>{K(!1)},children:t.jsxRuntimeExports.jsx($e.X,{})}),t.jsxRuntimeExports.jsxs("div",{className:"p-2",style:{backgroundColor:"rgba(240,240,240, 0.7)",width:"175px"},children:[t.jsxRuntimeExports.jsxs("div",{className:"flex gap-1 items-center",children:[t.jsxRuntimeExports.jsx("svg",{width:"136px",viewBox:"0 0 136 136",className:"shrink-0",children:t.jsxRuntimeExports.jsxs("g",{children:[Y.map((e,n)=>t.jsxRuntimeExports.jsx("g",{transform:`translate(0,${100-n*25})`,children:e.map((r,i)=>t.jsxRuntimeExports.jsx("rect",{y:1,x:i*25+1,fill:r,width:23,height:23,strokeWidth:H===r?2:.25,style:{cursor:"pointer"},onMouseOver:()=>{G(r)},onMouseLeave:()=>{G(void 0)}},i))},n)),t.jsxRuntimeExports.jsx("g",{transform:"translate(0,125)",children:R.map((e,n)=>t.jsxRuntimeExports.jsx("text",{y:10,x:(n+1)*25,fontSize:10,textAnchor:"middle",children:typeof e=="string"||e<1?e:Ne.numberFormattingFunction(e,"NA")},n))}),T.map((e,n)=>t.jsxRuntimeExports.jsx("g",{transform:`translate(${Math.max(Math.min(R.length+1,5),4)*25+10},${100-n*25})`,children:t.jsxRuntimeExports.jsx("text",{x:0,transform:"rotate(-90)",y:0,fontSize:10,textAnchor:"middle",children:typeof e=="string"||e<1?e:Ne.numberFormattingFunction(e,"NA")})},n))]})}),t.jsxRuntimeExports.jsx(Se.u,{marginBottom:"none",size:"xs",className:"leading-normal text-center shrink-0",style:{display:"-webkit-box",WebkitLineClamp:"1",WebkitBoxOrient:"vertical",overflow:"hidden",writingMode:"vertical-rl",height:"8.5rem",transform:"rotate(180deg)"},children:z})]}),t.jsxRuntimeExports.jsx(Se.u,{marginBottom:"none",size:"xs",className:"mt-1 leading-normal text-center",style:{display:"-webkit-box",WebkitLineClamp:"1",width:"8.5rem",WebkitBoxOrient:"vertical",overflow:"hidden"},children:M})]})]}):t.jsxRuntimeExports.jsx("button",{type:"button",className:"mb-0 border-0 bg-transparent p-0 self-start",onClick:()=>{K(!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"})})}),O==="button"&&t.jsxRuntimeExports.jsxs("div",{className:"absolute left-4 top-4 flex flex-col",children:[t.jsxRuntimeExports.jsx("button",{onClick:()=>N("in"),className:"leading-0 px-2 py-3.5 border border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-400 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"+"}),t.jsxRuntimeExports.jsx("button",{onClick:()=>N("out"),className:"leading-0 px-2 py-3.5 border border-t-0 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-400 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"–"})]})]}),U&&se&&pe&&C?t.jsxRuntimeExports.jsx(ze.Tooltip,{data:U,body:se,xPos:pe,yPos:C,backgroundStyle:be?.tooltip,className:Ee?.tooltip}):null,S&&h!==void 0?t.jsxRuntimeExports.jsx(Te.X,{open:h!==void 0,onClose:()=>{Z(void 0)},children:t.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof S=="string"?{__html:We.string2HTML(S,h)}:void 0,children:typeof S=="function"?S(h):null})}):null]})}function Xe(je){const{data:v,graphTitle:R,mapData:f="https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap.json",colors:M=Re.Colors.light.bivariateColors.colors05x05,sources:T,graphDescription:z,height:u,width:l,footNote:Y="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.",xDomain:J,yDomain:$,xColorLegendTitle:W="X Color key",yColorLegendTitle:q="Y Color key",tooltip:ne,scale:se=.95,centerPoint:le,padding:ce,mapBorderWidth:ve=.5,mapNoDataColor:A=Re.Colors.light.graphNoData,backgroundColor:b=!1,mapBorderColor:B=Re.Colors.light.grays["gray-500"],relativeHeight:E,onSeriesMouseOver:S,isWorldMap:de=!0,zoomScaleExtend:be=[.8,6],zoomTranslateExtend:Ee,graphID:F,showColorScale:O=!0,highlightedIds:k=[],onSeriesMouseClick:V,mapProperty:me="ISO3",graphDownload:ue=!1,dataDownload:K=!1,showAntarctica:H=!1,language:G="en",minHeight:h=0,theme:Z="light",ariaLabel:U,resetSelectionOnDoubleClick:Q=!0,detailsOnClick:pe,styles:w,classNames:C,mapProjection:ee,zoomInteraction:I="button",animate:X=!1,dimmedOpacity:xe=.3,customLayers:te=[],timeline:p={enabled:!1,autoplay:!1,showOnlyActiveDate:!0}}=je,[g,he]=d.useState(0),[re,ge]=d.useState(0),[P,L]=d.useState(p.autoplay),c=ke.sort(Pe.uniqBy(v.filter(r=>r.date!==void 0&&r.date!==null),r=>r.date).map(r=>Ce.parse(`${r.date}`,p.dateFormat||"yyyy",new Date).getTime()),(r,i)=>Ge.ascending(r,i)),[oe,ie]=d.useState(p.autoplay?0:c.length-1),[_,ye]=d.useState(void 0),N=d.useRef(null),e=d.useRef(null);d.useEffect(()=>{const r=new ResizeObserver(i=>{he(l||i[0].contentRect.width||760),ge(u||i[0].target.clientHeight||480)});return N.current&&(ge(N.current.clientHeight||480),he(N.current.clientWidth||760),l||r.observe(N.current)),()=>r.disconnect()},[l,u]),d.useEffect(()=>{typeof f=="string"?He.fetchAndParseJSON(f).then(i=>{ye(i)}):ye(f)},[f]),d.useEffect(()=>{const r=setInterval(()=>{ie(i=>i<c.length-1?i+1:0)},(p.speed||2)*1e3);return P||clearInterval(r),()=>clearInterval(r)},[c,P,p.speed]);const n=ke.getSliderMarks(c,oe,p.showOnlyActiveDate,p.dateFormat||"yyyy");return J&&$&&(J.length!==M[0].length-1||$.length!==M.length-1)?(console.error("the xDomain and yDomain array length don't match to the color array length"),null):t.jsxRuntimeExports.jsx("div",{className:`${Z||"light"} flex ${l?"w-fit grow-0":"w-full grow"}`,dir:G==="he"||G==="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 ${G||"en"}`,C?.graphContainer),style:{...w?.graphContainer||{},...b&&b!==!0?{backgroundColor:b}:{}},id:F,ref:e,"aria-label":U||`${R?`The graph shows ${R}. `:""}This is bi-variate choropleth map where geographic areas are colored in proportion to two variables.${z?` ${z}`:""}`,children:t.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:b?ce||"1rem":ce||0},children:t.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[R||z||ue||K?t.jsxRuntimeExports.jsx(Fe.GraphHeader,{styles:{title:w?.title,description:w?.description},classNames:{title:C?.title,description:C?.description},graphTitle:R,graphDescription:z,width:l,graphDownload:ue?e.current:void 0,dataDownload:K?v.map(r=>r.data).filter(r=>r!==void 0).length>0?v.map(r=>r.data).filter(r=>r!==void 0):v.filter(r=>r!==void 0):null}):null,p.enabled&&c.length>0&&n?t.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[t.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{L(!P)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":P?"Click to pause animation":"Click to play animation",children:P?t.jsxRuntimeExports.jsx($e.Pause,{}):t.jsxRuntimeExports.jsx($e.Play,{})}),t.jsxRuntimeExports.jsx(ke.xr,{min:c[0],max:c[c.length-1],marks:n,step:null,defaultValue:c[c.length-1],value:c[oe],onChangeComplete:r=>{ie(c.indexOf(r))},onChange:r=>{ie(c.indexOf(r))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,t.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:N,"aria-label":"Map area",children:(l||g)&&(u||re)&&_?t.jsxRuntimeExports.jsx(Ue,{data:v.filter(r=>p.enabled?r.date===Ce.format(new Date(c[oe]),p.dateFormat||"yyyy"):r),mapData:H?_:{..._,features:_.features.filter(r=>r.properties.NAME!=="Antarctica")},xDomain:J||qe.getJenks(v.map(r=>r.x),M[0].length),yDomain:$||qe.getJenks(v.map(r=>r.y),M.length),width:l||g,height:Math.max(h,u||(E?h?(l||g)*E>h?(l||g)*E:h:(l||g)*E:re)),scale:se,centerPoint:le,colors:M,xColorLegendTitle:W,yColorLegendTitle:q,mapBorderWidth:ve,mapNoDataColor:A,mapBorderColor:B,tooltip:ne,onSeriesMouseOver:S,isWorldMap:de,zoomScaleExtend:be,zoomTranslateExtend:Ee,onSeriesMouseClick:V,mapProperty:me,highlightedIds:k,resetSelectionOnDoubleClick:Q,styles:w,showColorScale:O,classNames:C,mapProjection:ee||(de?"naturalEarth":"mercator"),detailsOnClick:pe,zoomInteraction:I,animate:X===!0?{duration:.5,once:!0,amount:.5}:X||{duration:0,once:!0,amount:0},dimmedOpacity:xe,customLayers:te}):t.jsxRuntimeExports.jsx("div",{style:{height:`${Math.max(h,u||(E?h?(l||g)*E>h?(l||g)*E:h:(l||g)*E:re))}px`},className:"flex items-center justify-center",children:t.jsxRuntimeExports.jsx(Ie.y,{"aria-label":"Loading graph"})})}),T||Y?t.jsxRuntimeExports.jsx(Ve.GraphFooter,{styles:{footnote:w?.footnote,source:w?.source},classNames:{footnote:C?.footnote,source:C?.source},sources:T,footNote:Y,width:l}):null]})})})})}exports.BiVariateChoroplethMap=Xe;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-CHPV5EwG-DDoeWRVt.cjs"),d=require("react"),ke=require("./getSliderMarks-CtsEXiLV.cjs"),Ie=require("./Spinner-DA6Z5E4n.cjs"),Ce=require("./parse-hMnG_lRV.cjs"),Pe=require("./index-CZbIGs8q.cjs"),Le=require("./index-BXns0-ng.cjs"),D=require("./zoom-Lo7IAUfC.cjs"),Te=require("./Modal-tXZlLE5s.cjs"),Se=require("./Typography-k-kOjICQ.cjs"),Ne=require("./numberFormattingFunction-02t-wJta.cjs"),ze=require("./Tooltip-n8z5bfav.cjs"),We=require("./string2HTML-D2Avudmb.cjs"),De=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),$e=require("./index-BW_-wD2k.cjs"),we=require("./select-Bnfk0lJx.cjs"),Me=require("./threshold-DNsSUf8Q.cjs"),Ae=require("./use-in-view-sQJZ_xDO.cjs"),ae=require("./proxy-BHRoeZgd.cjs"),Be=require("./index-BW8iNx7E.cjs"),Fe=require("./GraphHeader.cjs"),Ve=require("./GraphFooter.cjs"),Re=require("./Colors.cjs"),He=require("./fetchAndParseData-CQyVGCul.cjs"),qe=require("./getJenks-TWQvbuOz.cjs"),Ge=require("./init-DU0ybBc_.cjs");function Ue(je){const{data:v,xDomain:R,mapData:f,xColorLegendTitle:M,yDomain:T,yColorLegendTitle:z,width:u,height:l,colors:Y,scale:J,centerPoint:$,mapBorderWidth:W,mapNoDataColor:q,mapBorderColor:ne,tooltip:se,onSeriesMouseOver:le,zoomScaleExtend:ce,zoomTranslateExtend:ve,highlightedIds:A,onSeriesMouseClick:b,mapProperty:B,resetSelectionOnDoubleClick:E,detailsOnClick:S,showColorScale:de,styles:be,classNames:Ee,mapProjection:F,zoomInteraction:O,animate:k,dimmedOpacity:V,customLayers:me}=je,[ue,K]=d.useState(!(u<680)),[H,G]=d.useState(void 0),[h,Z]=d.useState(void 0),[U,Q]=d.useState(void 0),[pe,w]=d.useState(void 0),[C,ee]=d.useState(void 0),I=d.useRef(null),X=Ae.useInView(I,{once:k.once,amount:k.amount}),xe=d.useRef(null),te=d.useRef(null);d.useEffect(()=>{const e=we.select(xe.current),n=we.select(I.current),r=o=>{if(O==="noZoom")return!1;if(O==="button")return!o.type.includes("wheel");const a=o.type==="wheel",m=o.type.startsWith("touch"),s=o.type==="mousedown"||o.type==="mousemove";return m?!0:a?O==="scroll"?!0:o.ctrlKey:s&&!o.button&&!o.ctrlKey},i=D.zoom().scaleExtent(ce).translateExtent(ve||[[-20,-20],[u+20,l+20]]).filter(r).on("zoom",({transform:o})=>{e.attr("transform",o)});n.call(i),te.current=i},[l,u,O]);const p=D.turf_bbox_default(f),g=D.turf_centroid_default(f),he=p[2]-p[0],re=p[3]-p[1],ge=u*190/960*360/he,P=l*190/678*180/re,L=J*Math.min(ge,P),c=F==="mercator"?D.geoMercator().rotate([0,0]).center($||g.geometry.coordinates).translate([u/2,l/2]).scale(L):F==="equalEarth"?D.geoEqualEarth().rotate([0,0]).center($||g.geometry.coordinates).translate([u/2,l/2]).scale(L):F==="naturalEarth"?D.geoNaturalEarth1().rotate([0,0]).center($||g.geometry.coordinates).translate([u/2,l/2]).scale(L):F==="orthographic"?D.geoOrthographic().rotate([0,0]).center($||g.geometry.coordinates).translate([u/2,l/2]).scale(L):D.geoAlbersUsa().rotate([0,0]).center($||g.geometry.coordinates).translate([u/2,l/2]).scale(L),oe=Array.from({length:R.length},(e,n)=>n),ie=Array.from({length:T.length},(e,n)=>n),_=Me.threshold().domain(R).range(oe),ye=Me.threshold().domain(T).range(ie),N=e=>{if(!I.current||!te.current)return;we.select(I.current).call(te.current.scaleBy,e==="in"?1.2:1/1.2)};return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs("div",{className:"relative",children:[t.jsxRuntimeExports.jsx(ae.motion.svg,{viewBox:`0 0 ${u} ${l}`,width:`${u}px`,height:`${l}px`,ref:I,direction:"ltr",children:t.jsxRuntimeExports.jsxs("g",{ref:xe,children:[me.filter(e=>e.position==="before").map(e=>e.layer),f.features.map((e,n)=>v.findIndex(i=>i.id===e.properties[B])!==-1?null:t.jsxRuntimeExports.jsx(ae.motion.g,{opacity:H?V:A.length!==0?A.indexOf(e.properties[B])!==-1?1:V:1,children:e.geometry.type==="MultiPolygon"?e.geometry.coordinates.map((i,o)=>{let a="";return i.forEach(m=>{let s=" M";m.forEach((x,y)=>{const j=c([x[0],x[1]]);y!==m.length-1?s=`${s}${j[0]} ${j[1]}L`:s=`${s}${j[0]} ${j[1]}`}),a+=s}),t.jsxRuntimeExports.jsx("path",{d:a,style:{stroke:ne,strokeWidth:W,fill:q}},o)}):e.geometry.coordinates.map((i,o)=>{let a="M";return i.forEach((m,s)=>{const x=c([m[0],m[1]]);s!==i.length-1?a=`${a}${x[0]} ${x[1]}L`:a=`${a}${x[0]} ${x[1]}`}),t.jsxRuntimeExports.jsx("path",{d:a,style:{stroke:ne,strokeWidth:W,fill:q}},o)})},n)),t.jsxRuntimeExports.jsx(Be.AnimatePresence,{children:v.map(e=>{const n=f.features.findIndex(a=>e.id===a.properties[B]),r=De.checkIfNullOrUndefined(e.x)?void 0:_(e.x),i=De.checkIfNullOrUndefined(e.y)?void 0:ye(e.y),o=r!==void 0&&i!==void 0?Y[i][r]:q;return t.jsxRuntimeExports.jsx(ae.motion.g,{variants:{initial:{opacity:0},whileInView:{opacity:H?H===o?1:V:A.length!==0?A.indexOf(e.id)!==-1?1:V:1,transition:{duration:k.duration}}},initial:"initial",animate:X?"whileInView":"initial",exit:{opacity:0,transition:{duration:k.duration}},onMouseEnter:a=>{Q(e),ee(a.clientY),w(a.clientX),le?.(e)},onClick:()=>{(b||S)&&(Le.isEqual(h,e)&&E?(Z(void 0),b?.(void 0)):(Z(e),b?.(e)))},onMouseMove:a=>{Q(e),ee(a.clientY),w(a.clientX)},onMouseLeave:()=>{Q(void 0),w(void 0),ee(void 0),le?.(void 0)},children:n===-1?null:f.features[n].geometry.type==="MultiPolygon"?f.features[n].geometry.coordinates.map((a,m)=>{let s="";return a.forEach(x=>{let y=" M";x.forEach((j,Oe)=>{const fe=c([j[0],j[1]]);Oe!==x.length-1?y=`${y}${fe[0]} ${fe[1]}L`:y=`${y}${fe[0]} ${fe[1]}`}),s+=y}),t.jsxRuntimeExports.jsx(ae.motion.path,{variants:{initial:{fill:o,opacity:0},whileInView:{fill:o,opacity:1,transition:{duration:k.duration}}},initial:"initial",animate:X?"whileInView":"initial",exit:{opacity:0,transition:{duration:k.duration}},d:s,className:`${o===q?"stroke-primary-gray-400 dark:stroke-primary-gray-500":"stroke-primary-white dark:stroke-primary-gray-650"}`,style:{strokeWidth:W}},`${e.id}-${m}`)}):f.features[n].geometry.coordinates.map((a,m)=>{let s="M";return a.forEach((x,y)=>{const j=c([x[0],x[1]]);y!==a.length-1?s=`${s}${j[0]} ${j[1]}L`:s=`${s}${j[0]} ${j[1]}`}),t.jsxRuntimeExports.jsx(ae.motion.path,{d:s,variants:{initial:{fill:o,opacity:0},whileInView:{fill:o,opacity:1,transition:{duration:k.duration}}},initial:"initial",animate:X?"whileInView":"initial",exit:{opacity:0,transition:{duration:k.duration}},className:`${o===q?"stroke-primary-gray-400 dark:stroke-primary-gray-500":"stroke-primary-white dark:stroke-primary-gray-650"}`,style:{strokeWidth:W}},`${e.id}-${m}`)})},e.id)})}),U?f.features.filter(e=>e.properties[B]===U.id).map((e,n)=>t.jsxRuntimeExports.jsx("g",{children:e.geometry.type==="MultiPolygon"?e.geometry.coordinates.map((r,i)=>{let o="";return r.forEach(a=>{let m=" M";a.forEach((s,x)=>{const y=c([s[0],s[1]]);x!==a.length-1?m=`${m}${y[0]} ${y[1]}L`:m=`${m}${y[0]} ${y[1]}`}),o+=m}),t.jsxRuntimeExports.jsx("path",{d:o,className:"stroke-primary-gray-700 dark:stroke-primary-gray-300",style:{fill:"none",fillOpacity:0,strokeWidth:"0.5"}},i)}):e.geometry.coordinates.map((r,i)=>{let o="M";return r.forEach((a,m)=>{const s=c([a[0],a[1]]);m!==r.length-1?o=`${o}${s[0]} ${s[1]}L`:o=`${o}${s[0]} ${s[1]}`}),t.jsxRuntimeExports.jsx("path",{d:o,className:"stroke-primary-gray-700 dark:stroke-primary-gray-300",style:{fill:"none",fillOpacity:0,strokeWidth:"0.5"}},i)})},n)):null,me.filter(e=>e.position==="after").map(e=>e.layer)]})}),de===!1?null:t.jsxRuntimeExports.jsx("div",{className:"absolute left-4 bottom-4",children:ue?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:()=>{K(!1)},children:t.jsxRuntimeExports.jsx($e.X,{})}),t.jsxRuntimeExports.jsxs("div",{className:"p-2",style:{backgroundColor:"rgba(240,240,240, 0.7)",width:"175px"},children:[t.jsxRuntimeExports.jsxs("div",{className:"flex gap-1 items-center",children:[t.jsxRuntimeExports.jsx("svg",{width:"136px",viewBox:"0 0 136 136",className:"shrink-0",children:t.jsxRuntimeExports.jsxs("g",{children:[Y.map((e,n)=>t.jsxRuntimeExports.jsx("g",{transform:`translate(0,${100-n*25})`,children:e.map((r,i)=>t.jsxRuntimeExports.jsx("rect",{y:1,x:i*25+1,fill:r,width:23,height:23,strokeWidth:H===r?2:.25,style:{cursor:"pointer"},onMouseOver:()=>{G(r)},onMouseLeave:()=>{G(void 0)}},i))},n)),t.jsxRuntimeExports.jsx("g",{transform:"translate(0,125)",children:R.map((e,n)=>t.jsxRuntimeExports.jsx("text",{y:10,x:(n+1)*25,fontSize:10,textAnchor:"middle",children:typeof e=="string"||e<1?e:Ne.numberFormattingFunction(e,"NA")},n))}),T.map((e,n)=>t.jsxRuntimeExports.jsx("g",{transform:`translate(${Math.max(Math.min(R.length+1,5),4)*25+10},${100-n*25})`,children:t.jsxRuntimeExports.jsx("text",{x:0,transform:"rotate(-90)",y:0,fontSize:10,textAnchor:"middle",children:typeof e=="string"||e<1?e:Ne.numberFormattingFunction(e,"NA")})},n))]})}),t.jsxRuntimeExports.jsx(Se.u,{marginBottom:"none",size:"xs",className:"leading-normal text-center shrink-0",style:{display:"-webkit-box",WebkitLineClamp:"1",WebkitBoxOrient:"vertical",overflow:"hidden",writingMode:"vertical-rl",height:"8.5rem",transform:"rotate(180deg)"},children:z})]}),t.jsxRuntimeExports.jsx(Se.u,{marginBottom:"none",size:"xs",className:"mt-1 leading-normal text-center",style:{display:"-webkit-box",WebkitLineClamp:"1",width:"8.5rem",WebkitBoxOrient:"vertical",overflow:"hidden"},children:M})]})]}):t.jsxRuntimeExports.jsx("button",{type:"button",className:"mb-0 border-0 bg-transparent p-0 self-start",onClick:()=>{K(!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"})})}),O==="button"&&t.jsxRuntimeExports.jsxs("div",{className:"absolute left-4 top-4 flex flex-col",children:[t.jsxRuntimeExports.jsx("button",{onClick:()=>N("in"),className:"leading-0 px-2 py-3.5 border border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-400 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"+"}),t.jsxRuntimeExports.jsx("button",{onClick:()=>N("out"),className:"leading-0 px-2 py-3.5 border border-t-0 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-400 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"–"})]})]}),U&&se&&pe&&C?t.jsxRuntimeExports.jsx(ze.Tooltip,{data:U,body:se,xPos:pe,yPos:C,backgroundStyle:be?.tooltip,className:Ee?.tooltip}):null,S&&h!==void 0?t.jsxRuntimeExports.jsx(Te.X,{open:h!==void 0,onClose:()=>{Z(void 0)},children:t.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof S=="string"?{__html:We.string2HTML(S,h)}:void 0,children:typeof S=="function"?S(h):null})}):null]})}function Xe(je){const{data:v,graphTitle:R,mapData:f="https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap.json",colors:M=Re.Colors.light.bivariateColors.colors05x05,sources:T,graphDescription:z,height:u,width:l,footNote:Y="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.",xDomain:J,yDomain:$,xColorLegendTitle:W="X Color key",yColorLegendTitle:q="Y Color key",tooltip:ne,scale:se=.95,centerPoint:le,padding:ce,mapBorderWidth:ve=.5,mapNoDataColor:A=Re.Colors.light.graphNoData,backgroundColor:b=!1,mapBorderColor:B=Re.Colors.light.grays["gray-500"],relativeHeight:E,onSeriesMouseOver:S,isWorldMap:de=!0,zoomScaleExtend:be=[.8,6],zoomTranslateExtend:Ee,graphID:F,showColorScale:O=!0,highlightedIds:k=[],onSeriesMouseClick:V,mapProperty:me="ISO3",graphDownload:ue=!1,dataDownload:K=!1,showAntarctica:H=!1,language:G="en",minHeight:h=0,theme:Z="light",ariaLabel:U,resetSelectionOnDoubleClick:Q=!0,detailsOnClick:pe,styles:w,classNames:C,mapProjection:ee,zoomInteraction:I="button",animate:X=!1,dimmedOpacity:xe=.3,customLayers:te=[],timeline:p={enabled:!1,autoplay:!1,showOnlyActiveDate:!0}}=je,[g,he]=d.useState(0),[re,ge]=d.useState(0),[P,L]=d.useState(p.autoplay),c=ke.sort(Pe.uniqBy(v.filter(r=>r.date!==void 0&&r.date!==null),r=>r.date).map(r=>Ce.parse(`${r.date}`,p.dateFormat||"yyyy",new Date).getTime()),(r,i)=>Ge.ascending(r,i)),[oe,ie]=d.useState(p.autoplay?0:c.length-1),[_,ye]=d.useState(void 0),N=d.useRef(null),e=d.useRef(null);d.useEffect(()=>{const r=new ResizeObserver(i=>{he(l||i[0].contentRect.width||760),ge(u||i[0].target.clientHeight||480)});return N.current&&(ge(N.current.clientHeight||480),he(N.current.clientWidth||760),l||r.observe(N.current)),()=>r.disconnect()},[l,u]),d.useEffect(()=>{typeof f=="string"?He.fetchAndParseJSON(f).then(i=>{ye(i)}):ye(f)},[f]),d.useEffect(()=>{const r=setInterval(()=>{ie(i=>i<c.length-1?i+1:0)},(p.speed||2)*1e3);return P||clearInterval(r),()=>clearInterval(r)},[c,P,p.speed]);const n=ke.getSliderMarks(c,oe,p.showOnlyActiveDate,p.dateFormat||"yyyy");return J&&$&&(J.length!==M[0].length-1||$.length!==M.length-1)?(console.error("the xDomain and yDomain array length don't match to the color array length"),null):t.jsxRuntimeExports.jsx("div",{className:`${Z||"light"} flex ${l?"w-fit grow-0":"w-full grow"}`,dir:G==="he"||G==="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 ${G||"en"}`,C?.graphContainer),style:{...w?.graphContainer||{},...b&&b!==!0?{backgroundColor:b}:{}},id:F,ref:e,"aria-label":U||`${R?`The graph shows ${R}. `:""}This is bi-variate choropleth map where geographic areas are colored in proportion to two variables.${z?` ${z}`:""}`,children:t.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:b?ce||"1rem":ce||0},children:t.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[R||z||ue||K?t.jsxRuntimeExports.jsx(Fe.GraphHeader,{styles:{title:w?.title,description:w?.description},classNames:{title:C?.title,description:C?.description},graphTitle:R,graphDescription:z,width:l,graphDownload:ue?e.current:void 0,dataDownload:K?v.map(r=>r.data).filter(r=>r!==void 0).length>0?v.map(r=>r.data).filter(r=>r!==void 0):v.filter(r=>r!==void 0):null}):null,p.enabled&&c.length>0&&n?t.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[t.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{L(!P)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":P?"Click to pause animation":"Click to play animation",children:P?t.jsxRuntimeExports.jsx($e.Pause,{}):t.jsxRuntimeExports.jsx($e.Play,{})}),t.jsxRuntimeExports.jsx(ke.xr,{min:c[0],max:c[c.length-1],marks:n,step:null,defaultValue:c[c.length-1],value:c[oe],onChangeComplete:r=>{ie(c.indexOf(r))},onChange:r=>{ie(c.indexOf(r))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,t.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:N,"aria-label":"Map area",children:(l||g)&&(u||re)&&_?t.jsxRuntimeExports.jsx(Ue,{data:v.filter(r=>p.enabled?r.date===Ce.format(new Date(c[oe]),p.dateFormat||"yyyy"):r),mapData:H?_:{..._,features:_.features.filter(r=>r.properties.NAME!=="Antarctica")},xDomain:J||qe.getJenks(v.map(r=>r.x),M[0].length),yDomain:$||qe.getJenks(v.map(r=>r.y),M.length),width:l||g,height:Math.max(h,u||(E?h?(l||g)*E>h?(l||g)*E:h:(l||g)*E:re)),scale:se,centerPoint:le,colors:M,xColorLegendTitle:W,yColorLegendTitle:q,mapBorderWidth:ve,mapNoDataColor:A,mapBorderColor:B,tooltip:ne,onSeriesMouseOver:S,isWorldMap:de,zoomScaleExtend:be,zoomTranslateExtend:Ee,onSeriesMouseClick:V,mapProperty:me,highlightedIds:k,resetSelectionOnDoubleClick:Q,styles:w,showColorScale:O,classNames:C,mapProjection:ee||(de?"naturalEarth":"mercator"),detailsOnClick:pe,zoomInteraction:I,animate:X===!0?{duration:.5,once:!0,amount:.5}:X||{duration:0,once:!0,amount:0},dimmedOpacity:xe,customLayers:te}):t.jsxRuntimeExports.jsx("div",{style:{height:`${Math.max(h,u||(E?h?(l||g)*E>h?(l||g)*E:h:(l||g)*E:re))}px`},className:"flex items-center justify-center",children:t.jsxRuntimeExports.jsx(Ie.y,{"aria-label":"Loading graph"})})}),T||Y?t.jsxRuntimeExports.jsx(Ve.GraphFooter,{styles:{footnote:w?.footnote,source:w?.source},classNames:{footnote:C?.footnote,source:C?.source},sources:T,footNote:Y,width:l}):null]})})})})}exports.BiVariateChoroplethMap=Xe;
|
|
2
2
|
//# sourceMappingURL=BiVariateChoroplethMap.cjs.map
|
|
@@ -6,22 +6,22 @@ import { p as Te, f as Ae } from "./parse-DlCRUFh_.js";
|
|
|
6
6
|
import { u as Be } from "./index-CaAIPGZo.js";
|
|
7
7
|
import { i as Ve } from "./index-27yTRcko.js";
|
|
8
8
|
import { z as Fe, t as He, a as Xe, g as Re, b as _e, c as Ue, d as Ye, e as qe } from "./zoom-_lqdiGoI.js";
|
|
9
|
-
import { X as Ge } from "./Modal-
|
|
9
|
+
import { X as Ge } from "./Modal-DVVwpKhP.js";
|
|
10
10
|
import { u as Ne } from "./Typography-Ctgfl1J5.js";
|
|
11
11
|
import { n as De } from "./numberFormattingFunction-14YCbkN2.js";
|
|
12
12
|
import { T as Je } from "./Tooltip-DyM5snqx.js";
|
|
13
13
|
import { s as Ke } from "./string2HTML-CWHGfz_d.js";
|
|
14
14
|
import { c as Me } from "./checkIfNullOrUndefined-DmfiKkNw.js";
|
|
15
15
|
import { X as Ze, P as Qe, f as et } from "./index-BmCqpO1B.js";
|
|
16
|
-
import { u as tt } from "./use-in-view-BAHrBy6b.js";
|
|
17
16
|
import { s as $e } from "./select-DKy99ogv.js";
|
|
18
17
|
import { t as Se } from "./threshold-DFfqcDMa.js";
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
18
|
+
import { u as tt } from "./use-in-view-yS6jzJAp.js";
|
|
19
|
+
import { m as oe } from "./proxy-CkpFesk1.js";
|
|
20
|
+
import { A as rt } from "./index-CNvov0eg.js";
|
|
21
21
|
import { GraphHeader as at } from "./GraphHeader.js";
|
|
22
22
|
import { GraphFooter as ot } from "./GraphFooter.js";
|
|
23
23
|
import { Colors as Ce } from "./Colors.js";
|
|
24
|
-
import { f as it } from "./fetchAndParseData-
|
|
24
|
+
import { f as it } from "./fetchAndParseData-4gsYTy6_.js";
|
|
25
25
|
import { g as Ee } from "./getJenks-VhM3GIoC.js";
|
|
26
26
|
import { c as nt } from "./init-BhZylTFx.js";
|
|
27
27
|
function st(be) {
|
package/dist/BulletChart.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index-CHPV5EwG-DDoeWRVt.cjs"),j=require("react"),Me=require("./index-BzeLQvXk.cjs"),ke=require("./index-BXns0-ng.cjs"),Ce=require("./Modal-C_dl0EtQ.cjs"),Re=require("./index-C21TvELx.cjs"),Ne=require("./numberFormattingFunction-02t-wJta.cjs"),Ee=require("./Tooltip-n8z5bfav.cjs"),o=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),Oe=require("./string2HTML-D2Avudmb.cjs"),Fe=require("./XTicksAndGridLines-CCzXIV8d.cjs"),He=require("./YAxesLabels-BXLTX7AI.cjs"),Ie=require("./AxisTitle-CK9YeovX.cjs"),Ve=require("./Axis-DE7dSn1_.cjs"),ze=require("./ReferenceLine-CuFMk0cI.cjs"),Te=require("./use-in-view-BCmzDU2O.cjs"),qe=require("./linear-BVckp9RD.cjs"),Ae=require("./band-CAApY4Pd.cjs"),_=require("./proxy-PQd2AItT.cjs"),Le=require("./index-DVOJ7vxH.cjs"),$e=require("./GraphFooter.cjs"),Se=require("./GraphHeader.cjs"),ve=require("./Colors.cjs"),De=require("./EmptyState-d8_8SxeW.cjs"),Be=require("./ColorLegend.cjs"),Pe=require("./XAxesLabels-CJMQbfVy.cjs"),Ge=require("./YTicksAndGridLines-DBDuz6vb.cjs");function We(we){const{data:s,barColor:b,suffix:J,prefix:K,barPadding:Q,showValues:re,showTicks:Z,leftMargin:ye,truncateBy:de,width:ee,height:te,rightMargin:be,topMargin:C,bottomMargin:ie,showLabels:c,tooltip:D,onSeriesMouseOver:V,refValues:q,highlightedDataPoints:d,maxValue:B,minValue:w,onSeriesMouseClick:U,labelOrder:ae,rtl:F,maxBarThickness:A,minBarThickness:me,resetSelectionOnDoubleClick:L,detailsOnClick:z,barAxisTitle:ne,valueColor:le,noOfTicks:E,styles:g,classNames:M,targetStyle:se,targetColor:H,qualitativeRangeColors:P,measureBarWidthFactor:u,animate:l,dimmedOpacity:O,precision:G,customLayers:$,naLabel:T}=we,f=j.useRef(null),h=Te.useInView(f,{once:l.once,amount:l.amount}),[oe,W]=j.useState(void 0),[N,X]=j.useState(void 0),[ue,k]=j.useState(void 0),[p,y]=j.useState(void 0),x={top:ne?C+25:C,bottom:ie,left:ye,right:be},S=ee-x.left-x.right,I=te-x.top-x.bottom,ce=Math.max(...s.filter(e=>!o.checkIfNullOrUndefined(e.size)).map(e=>e.size))<0?0:Math.max(...s.filter(e=>!o.checkIfNullOrUndefined(e.size)).map(e=>e.size)),Y=Math.max(...s.filter(e=>!o.checkIfNullOrUndefined(e.target)).map(e=>e.target))<0?0:Math.max(...s.filter(e=>!o.checkIfNullOrUndefined(e.target)).map(e=>e.target)),xe=Math.max(...s.map(e=>Re.sum((e.qualitativeRange||[]).filter(r=>!o.checkIfNullOrUndefined(r)))||0)),ge=o.checkIfNullOrUndefined(B)?Math.max(...[ce,Y,xe].filter(Number.isFinite))<0?0:Math.max(...[ce,Y,xe].filter(Number.isFinite)):B,he=Math.min(...s.filter(e=>!o.checkIfNullOrUndefined(e.size)).map(e=>e.size))>=0?0:Math.min(...s.filter(e=>!o.checkIfNullOrUndefined(e.size)).map(e=>e.size)),R=Math.min(...s.filter(e=>!o.checkIfNullOrUndefined(e.target)).map(e=>e.target))>=0?0:Math.min(...s.filter(e=>!o.checkIfNullOrUndefined(e.target)).map(e=>e.target)),a=o.checkIfNullOrUndefined(w)?Math.min(...[he,R].filter(Number.isFinite))>=0?0:Math.min(...[he,R].filter(Number.isFinite)):w,fe=s.map((e,r)=>({...e,id:ae?`${e.label}`:`${r}`})),n=qe.linear().domain([a,ge]).range([0,S]).nice(),v=ae||fe.map(e=>`${e.id}`),m=Ae.band().domain(v).range([0,me?Math.max(I,me*v.length):A?Math.min(I,A*v.length):I]).paddingInner(Q),t=n.ticks(E);return i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[i.jsxRuntimeExports.jsx(_.motion.svg,{width:`${ee}px`,height:`${te}px`,viewBox:`0 0 ${ee} ${te}`,direction:"ltr",ref:f,children:i.jsxRuntimeExports.jsxs("g",{transform:`translate(${x.left},${x.top})`,children:[Z?i.jsxRuntimeExports.jsx(Fe.XTicksAndGridLines,{values:t.filter(e=>e!==0),x:t.filter(e=>e!==0).map(e=>n(e)),y1:0-C,y2:I+x.bottom,styles:{gridLines:g?.xAxis?.gridLines,labels:g?.xAxis?.labels},classNames:{gridLines:M?.xAxis?.gridLines,labels:M?.xAxis?.labels},suffix:J,prefix:K,labelType:"secondary",showGridLines:!0,precision:G}):null,i.jsxRuntimeExports.jsx(Ie.AxisTitle,{x:S/2,y:0-x.top+15,style:g?.xAxis?.title,className:M?.xAxis?.title,text:ne}),i.jsxRuntimeExports.jsx(Ve.Axis,{x1:n(a<0?0:a),x2:n(a<0?0:a),y1:-2.5,y2:I+x.bottom,classNames:{axis:M?.yAxis?.axis},styles:{axis:g?.yAxis?.axis}}),$.filter(e=>e.position==="before").map(e=>e.layer),i.jsxRuntimeExports.jsxs(Le.AnimatePresence,{children:[fe.map(e=>o.checkIfNullOrUndefined(m(e.id))?null:i.jsxRuntimeExports.jsxs(_.motion.g,{className:"undp-viz-g-with-hover",onMouseEnter:r=>{W(e),y(r.clientY),k(r.clientX),V?.(e)},onClick:()=>{(U||z)&&(ke.isEqual(N,e)&&L?(X(void 0),U?.(void 0)):(X(e),U?.(e)))},onMouseMove:r=>{W(e),y(r.clientY),k(r.clientX)},onMouseLeave:()=>{W(void 0),k(void 0),y(void 0),V?.(void 0)},exit:{opacity:0,transition:{duration:l.duration}},variants:{initial:{x:0,y:m(`${e.id}`),opacity:d.length!==0?d.indexOf(e.label)!==-1?.85:O:.85},whileInView:{x:0,y:m(`${e.id}`),opacity:d.length!==0?d.indexOf(e.label)!==-1?.85:O:.85,transition:{duration:l.duration}}},initial:"initial",animate:h?"whileInView":"initial",children:[e.qualitativeRange?e.qualitativeRange.map((r,pe)=>i.jsxRuntimeExports.jsx(_.motion.rect,{exit:{width:0,x:n(0),transition:{duration:l.duration}},variants:{initial:{x:n(0),width:0,fill:P[pe]},whileInView:{x:n(pe===0?0:Re.sum(e.qualitativeRange.filter((je,Ue)=>Ue<pe&&je))),width:n(r),fill:P[pe],transition:{duration:l.duration}}},initial:"initial",animate:h?"whileInView":"initial",y:0,height:m.bandwidth()},pe)):null,e.target&&se==="background"?i.jsxRuntimeExports.jsx(_.motion.rect,{y:0,x:e.target>=0?n(0):n(e.target),height:m.bandwidth(),style:{fill:H},exit:{width:0,x:n(0),transition:{duration:l.duration}},variants:{initial:{x:n(0),width:0},whileInView:{x:e.target>=0?n(0):n(e.target),width:e.target>=0?n(e.target)-n(0):n(0)-n(e.target),transition:{duration:l.duration}}},initial:"initial",animate:h?"whileInView":"initial"}):null,e.size?i.jsxRuntimeExports.jsx(_.motion.rect,{y:m.bandwidth()*((1-u)/2),style:{fill:b},height:m.bandwidth()*u,exit:{width:0,x:n(0),transition:{duration:l.duration}},variants:{initial:{x:n(0),width:0},whileInView:{x:e.size>=0?n(0):n(e.size),width:e.size>=0?n(e.size)-n(0):n(0)-n(e.size),transition:{duration:l.duration}}},initial:"initial",animate:h?"whileInView":"initial"}):null,e.target&&se==="line"?i.jsxRuntimeExports.jsx(_.motion.rect,{y:0,height:m.bandwidth(),style:{fill:H},width:2,exit:{opacity:0,x:n(0),transition:{duration:l.duration}},variants:{initial:{x:n(0),opacity:0},whileInView:{x:n(e.target)-1,opacity:1,transition:{duration:l.duration}}},initial:"initial",animate:h?"whileInView":"initial"}):null,c?i.jsxRuntimeExports.jsx(He.YAxesLabels,{value:`${e.label}`.length<de?`${e.label}`:`${`${e.label}`.substring(0,de)}...`,y:0,x:(e.size||0)<0?n(0):0-x.left,width:(e.size||0)<0?ee-n(0):n(0)+x.left,height:m.bandwidth(),alignment:e.size&&e.size<0?"left":"right",style:g?.yAxis?.labels,className:M?.yAxis?.labels,animate:l,isInView:h}):null,re?i.jsxRuntimeExports.jsx(_.motion.text,{y:m.bandwidth()/2,style:{...le?{fill:le}:{fill:b},textAnchor:e.size&&e.size<0?"end":"start",...g?.graphObjectValues||{}},className:i.mo("graph-value text-sm",!le&&b.length>1?" fill-primary-gray-600 dark:fill-primary-gray-300":"",M?.graphObjectValues),dx:e.size&&e.size<0?-5:5,dy:"0.33em",exit:{opacity:0,transition:{duration:l.duration}},variants:{initial:{x:n(0),opacity:0},whileInView:{x:e.size?n(e.size):n(0),opacity:1,transition:{duration:l.duration}}},initial:"initial",animate:h?"whileInView":"initial",children:Ne.numberFormattingFunction(e.size,T,G,K,J)}):null]},e.label)),q?i.jsxRuntimeExports.jsx(i.jsxRuntimeExports.Fragment,{children:q.map((e,r)=>i.jsxRuntimeExports.jsx(ze.RefLineX,{text:e.text,color:e.color,x:n(e.value),y1:0-x.top,y2:I+x.bottom,textSide:n(e.value)>S*.75||F?"left":"right",classNames:e.classNames,styles:e.styles,animate:l,isInView:h},r))}):null]}),$.filter(e=>e.position==="after").map(e=>e.layer)]})}),oe&&D&&ue&&p?i.jsxRuntimeExports.jsx(Ee.Tooltip,{data:oe,body:D,xPos:ue,yPos:p,backgroundStyle:g?.tooltip,className:M?.tooltip}):null,z&&N!==void 0?i.jsxRuntimeExports.jsx(Ce.X,{open:N!==void 0,onClose:()=>{X(void 0)},children:i.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof z=="string"?{__html:Oe.string2HTML(z,N)}:void 0,children:typeof z=="function"?z(N):null})}):null]})}function Xe(we){const{data:s,graphTitle:b,barColor:J=ve.Colors.primaryColors["blue-600"],suffix:K="",sources:Q,prefix:re="",graphDescription:Z,barPadding:ye=.25,showValues:de=!0,showTicks:ee=!0,leftMargin:te=100,rightMargin:be=40,truncateBy:C=999,height:ie,width:c,footNote:D,colorDomain:V,colorLegendTitle:q,highlightedDataPoints:d=[],padding:B,backgroundColor:w=!1,topMargin:U=25,bottomMargin:ae=10,showLabels:F=!0,relativeHeight:A,tooltip:me,onSeriesMouseOver:L,refValues:z,showColorScale:ne=!0,graphID:le,maxValue:E,minValue:g,onSeriesMouseClick:M,graphDownload:se=!1,dataDownload:H=!1,sortData:P,labelOrder:u,language:l="en",minHeight:O=0,theme:G="light",maxBarThickness:$,maxNumberOfBars:T,minBarThickness:f,ariaLabel:h,resetSelectionOnDoubleClick:oe=!0,detailsOnClick:W,barAxisTitle:N,noOfTicks:X=5,valueColor:ue,styles:k,classNames:p,filterNA:y=!0,targetStyle:x="line",targetColor:S=ve.Colors.light.grays["gray-700"],qualitativeRangeColors:I,measureBarWidthFactor:ce=.4,animate:Y=!1,dimmedOpacity:xe=.3,precision:ge=2,customLayers:he=[],naLabel:R="NA"}=we,[a,fe]=j.useState(0),[n,v]=j.useState(0),m=j.useRef(null),t=j.useRef(null);return j.useEffect(()=>{const e=new ResizeObserver(r=>{fe(c||r[0].target.clientWidth||620),v(ie||r[0].target.clientHeight||480)});return m.current&&(v(m.current.clientHeight||480),fe(m.current.clientWidth||620),c||e.observe(m.current)),()=>e.disconnect()},[c,ie]),i.jsxRuntimeExports.jsx("div",{className:`${G||"light"} flex ${c?"w-fit grow-0":"w-full grow"}`,dir:l==="he"||l==="ar"?"rtl":void 0,children:i.jsxRuntimeExports.jsx("div",{className:i.mo(`${w?w===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${l||"en"}`,p?.graphContainer),style:{...k?.graphContainer||{},...w&&w!==!0?{backgroundColor:w}:{}},id:le,ref:t,"aria-label":h||`${b?`The graph shows ${b}. `:""}This is a bar chart. ${Z?` ${Z}`:""}`,children:i.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:w?B||"1rem":B||0},children:i.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[b||Z||se||H?i.jsxRuntimeExports.jsx(Se.GraphHeader,{styles:{title:k?.title,description:k?.description},classNames:{title:p?.title,description:p?.description},graphTitle:b,graphDescription:Z,width:c,graphDownload:se?t.current:void 0,dataDownload:H?s.map(e=>e.data).filter(e=>e!==void 0).length>0?s.map(e=>e.data).filter(e=>e!==void 0):s.filter(e=>e!==void 0):null}):null,i.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:s.length===0?i.jsxRuntimeExports.jsx(De.EmptyState,{}):i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[ne&&s.filter(e=>e.qualitativeRange).length!==0&&V?i.jsxRuntimeExports.jsx(Be.ColorLegend,{width:c,colorLegendTitle:q,colors:I||ve.Colors[G].sequentialColors.positiveColorsx10,colorDomain:V,showNAColor:!1}):null,i.jsxRuntimeExports.jsx("div",{className:"flex grow flex-col justify-center w-full leading-0",ref:m,"aria-label":"Graph area",children:(c||a)&&(ie||n)?i.jsxRuntimeExports.jsx(We,{data:P==="asc"?Me.sortBy(s.filter(e=>y?!o.checkIfNullOrUndefined(e.size):e),e=>e.size).filter((e,r)=>T?r<T:!0):P==="desc"?Me.sortBy(s.filter(e=>y?!o.checkIfNullOrUndefined(e.size):e),e=>e.size).reverse().filter((e,r)=>T?r<T:!0):s.filter(e=>y?!o.checkIfNullOrUndefined(e.size):e).filter((e,r)=>T?r<T:!0),barColor:J,targetColor:S,width:c||a,height:Math.max(O,ie||(A?O?(c||a)*A>O?(c||a)*A:O:(c||a)*A:n)),suffix:K,prefix:re,barPadding:ye,showValues:de,showTicks:ee,leftMargin:te,rightMargin:be,topMargin:U,bottomMargin:ae,truncateBy:C,showLabels:F,tooltip:me,onSeriesMouseOver:L,refValues:z,maxValue:E,minValue:g,highlightedDataPoints:d,onSeriesMouseClick:M,labelOrder:u,rtl:l==="he"||l==="ar",maxBarThickness:$,minBarThickness:f,resetSelectionOnDoubleClick:oe,detailsOnClick:W,barAxisTitle:N,noOfTicks:X,valueColor:ue,classNames:p,styles:k,targetStyle:x,qualitativeRangeColors:I||ve.Colors[G].sequentialColors.positiveColorsx10,measureBarWidthFactor:ce,animate:Y===!0?{duration:.5,once:!0,amount:.5}:Y||{duration:0,once:!0,amount:0},dimmedOpacity:xe,precision:ge,customLayers:he,naLabel:R}):null})]})}),Q||D?i.jsxRuntimeExports.jsx($e.GraphFooter,{sources:Q,footNote:D,width:c,styles:{footnote:k?.footnote,source:k?.source},classNames:{footnote:p?.footnote,source:p?.source}}):null]})})})})}function Ye(we){const{data:s,width:b,height:J,barColor:K,suffix:Q,prefix:re,barPadding:Z,showLabels:ye,showValues:de,showTicks:ee,truncateBy:te,rightMargin:be,topMargin:C,bottomMargin:ie,leftMargin:c,tooltip:D,onSeriesMouseOver:V,refValues:q,maxValue:d,minValue:B,highlightedDataPoints:w,onSeriesMouseClick:U,labelOrder:ae,maxBarThickness:F,minBarThickness:A,resetSelectionOnDoubleClick:me,detailsOnClick:L,barAxisTitle:z,valueColor:ne,noOfTicks:le,styles:E,classNames:g,targetStyle:M,targetColor:se,qualitativeRangeColors:H,measureBarWidthFactor:P,animate:u,dimmedOpacity:l,precision:O,customLayers:G,naLabel:$}=we,T=j.useRef(null),f=Te.useInView(T,{once:u.once,amount:u.amount}),h={top:C,bottom:ie,left:z?c+30:c,right:be},[oe,W]=j.useState(void 0),[N,X]=j.useState(void 0),[ue,k]=j.useState(void 0),[p,y]=j.useState(void 0),x=b-h.left-h.right,S=J-h.top-h.bottom,I=Math.max(...s.filter(t=>!o.checkIfNullOrUndefined(t.size)).map(t=>t.size))<0?0:Math.max(...s.filter(t=>!o.checkIfNullOrUndefined(t.size)).map(t=>t.size)),ce=Math.max(...s.filter(t=>!o.checkIfNullOrUndefined(t.target)).map(t=>t.target))<0?0:Math.max(...s.filter(t=>!o.checkIfNullOrUndefined(t.size)).map(t=>t.target)),Y=Math.max(...s.map(t=>Re.sum((t.qualitativeRange||[]).filter(e=>!o.checkIfNullOrUndefined(e)))||0)),xe=o.checkIfNullOrUndefined(d)?Math.max(...[I,ce,Y].filter(Number.isFinite))<0?0:Math.max(...[I,ce,Y].filter(Number.isFinite)):d,ge=Math.min(...s.filter(t=>!o.checkIfNullOrUndefined(t.size)).map(t=>t.size))>=0?0:Math.min(...s.filter(t=>!o.checkIfNullOrUndefined(t.size)).map(t=>t.size)),he=Math.min(...s.filter(t=>!o.checkIfNullOrUndefined(t.target)).map(t=>t.target))>=0?0:Math.min(...s.filter(t=>!o.checkIfNullOrUndefined(t.target)).map(t=>t.target)),R=o.checkIfNullOrUndefined(B)?Math.min(...[ge,he].filter(Number.isFinite))>=0?0:Math.min(...[ge,he].filter(Number.isFinite)):B,a=qe.linear().domain([R,xe]).range([S,0]).nice(),fe=s.map((t,e)=>({...t,id:ae?`${t.label}`:`${e}`})),n=ae||fe.map(t=>`${t.id}`),v=Ae.band().domain(n).range([0,A?Math.max(x,A*n.length):F?Math.min(x,F*n.length):x]).paddingInner(Z),m=a.ticks(le);return i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[i.jsxRuntimeExports.jsx(_.motion.svg,{width:`${b}px`,height:`${J}px`,viewBox:`0 0 ${b} ${J}`,direction:"ltr",ref:T,children:i.jsxRuntimeExports.jsxs("g",{transform:`translate(${h.left},${h.top})`,children:[i.jsxRuntimeExports.jsx(Ve.Axis,{y1:a(R<0?0:R),y2:a(R<0?0:R),x1:0-c,x2:x+h.right,label:Ne.numberFormattingFunction(R<0?0:R,$,O,re,Q),labelPos:{x:0-c,dx:0,dy:xe<0?"1em":-5,y:a(R<0?0:R)},classNames:{axis:g?.xAxis?.axis,label:g?.yAxis?.labels},styles:{axis:E?.xAxis?.axis,label:E?.yAxis?.labels}}),ee?i.jsxRuntimeExports.jsx(Ge.YTicksAndGridLines,{values:m.filter(t=>t!==0),y:m.filter(t=>t!==0).map(t=>a(t)),x1:0-c,x2:x+h.right,styles:{gridLines:E?.yAxis?.gridLines,labels:E?.yAxis?.labels},classNames:{gridLines:g?.yAxis?.gridLines,labels:g?.yAxis?.labels},suffix:Q,prefix:re,labelType:"secondary",showGridLines:!0,labelPos:"vertical",precision:O}):null,i.jsxRuntimeExports.jsx(Ie.AxisTitle,{x:0-c-15,y:S/2,style:E?.yAxis?.title,className:g?.yAxis?.title,text:z,rotate90:!0}),G.filter(t=>t.position==="before").map(t=>t.layer),i.jsxRuntimeExports.jsxs(Le.AnimatePresence,{children:[fe.map(t=>o.checkIfNullOrUndefined(v(t.id))?null:i.jsxRuntimeExports.jsxs(_.motion.g,{className:"undp-viz-g-with-hover",onMouseEnter:e=>{W(t),y(e.clientY),k(e.clientX),V?.(t)},onClick:()=>{(U||L)&&(ke.isEqual(N,t)&&me?(X(void 0),U?.(void 0)):(X(t),U?.(t)))},onMouseMove:e=>{W(t),y(e.clientY),k(e.clientX)},onMouseLeave:()=>{W(void 0),k(void 0),y(void 0),V?.(void 0)},exit:{opacity:0,transition:{duration:u.duration}},variants:{initial:{x:v(`${t.id}`),y:0,opacity:w.length!==0?w.indexOf(t.label)!==-1?.85:l:.85},whileInView:{x:v(`${t.id}`),y:0,opacity:w.length!==0?w.indexOf(t.label)!==-1?.85:l:.85,transition:{duration:u.duration}}},initial:"initial",animate:f?"whileInView":"initial",children:[t.qualitativeRange?t.qualitativeRange.map((e,r)=>i.jsxRuntimeExports.jsx(_.motion.rect,{x:0,exit:{height:0,y:a(0),transition:{duration:u.duration}},variants:{initial:{height:0,y:a(0),fill:H[r]},whileInView:{height:Math.abs(a(Re.sum(t.qualitativeRange.filter((pe,je)=>je<=r&&pe)))-a(Re.sum(t.qualitativeRange.filter((pe,je)=>je<r&&pe)))),y:a(Re.sum(t.qualitativeRange.filter((pe,je)=>je<=r&&pe))),fill:H[r],transition:{duration:u.duration}}},initial:"initial",animate:f?"whileInView":"initial",width:v.bandwidth()},r)):null,t.target&&M==="background"?i.jsxRuntimeExports.jsx(_.motion.rect,{x:0,width:v.bandwidth(),style:{fill:se},exit:{height:0,y:a(0),transition:{duration:u.duration}},variants:{initial:{height:0,y:a(0)},whileInView:{height:Math.abs(a(t.target)-a(0)),y:t.target>0?a(t.target):a(0),transition:{duration:u.duration}}},initial:"initial",animate:f?"whileInView":"initial"}):null,t.size?i.jsxRuntimeExports.jsx(_.motion.rect,{x:v.bandwidth()*((1-P)/2),width:v.bandwidth()*P,style:{fill:K},exit:{height:0,y:a(0),transition:{duration:u.duration}},variants:{initial:{height:0,y:a(0)},whileInView:{height:Math.abs(a(t.size)-a(0)),y:t.size>0?a(t.size):a(0),transition:{duration:u.duration}}},initial:"initial",animate:f?"whileInView":"initial"}):null,t.target&&M==="line"?i.jsxRuntimeExports.jsx(_.motion.rect,{x:0,width:v.bandwidth(),style:{fill:se},exit:{y:a(0),opacity:0,transition:{duration:u.duration}},variants:{initial:{y:a(0),opacity:0},whileInView:{y:a(t.target)-1,opacity:1,transition:{duration:u.duration}}},initial:"initial",animate:f?"whileInView":"initial",height:2}):null,ye?i.jsxRuntimeExports.jsx(Pe.XAxesLabels,{value:`${t.label}`.length<te?`${t.label}`:`${`${t.label}`.substring(0,te)}...`,y:(t.size||0)<0?0:a(0)+5,x:0,width:v.bandwidth(),height:(t.size||0)<0?a(0)-5:h.bottom,style:E?.xAxis?.labels,className:g?.xAxis?.labels,alignment:(t.size||0)<0?"bottom":"top",animate:u,isInView:f}):null,de?i.jsxRuntimeExports.jsx(_.motion.text,{x:v.bandwidth()/2,style:{...ne?{fill:ne}:{fill:K},textAnchor:"middle",...E?.graphObjectValues||{}},className:i.mo("graph-value text-sm",!ne&&K.length>1?" fill-primary-gray-600 dark:fill-primary-gray-300":"",g?.graphObjectValues),dy:t.size?t.size>=0?"-5px":"1em":"-5px",exit:{opacity:0,transition:{duration:u.duration}},variants:{initial:{y:a(0),opacity:0},whileInView:{y:a(t.size||0),opacity:1,transition:{duration:u.duration}}},initial:"initial",animate:f?"whileInView":"initial",children:Ne.numberFormattingFunction(t.size,$,O,re,Q)}):null]},t.label)),q?i.jsxRuntimeExports.jsx(i.jsxRuntimeExports.Fragment,{children:q.map((t,e)=>i.jsxRuntimeExports.jsx(ze.RefLineY,{text:t.text,color:t.color,y:a(t.value),x1:0-c,x2:x+h.right,classNames:t.classNames,styles:t.styles,animate:u,isInView:f},e))}):null]}),G.filter(t=>t.position==="after").map(t=>t.layer)]})}),oe&&D&&ue&&p?i.jsxRuntimeExports.jsx(Ee.Tooltip,{data:oe,body:D,xPos:ue,yPos:p,backgroundStyle:E?.tooltip,className:g?.tooltip}):null,L&&N!==void 0?i.jsxRuntimeExports.jsx(Ce.X,{open:N!==void 0,onClose:()=>{X(void 0)},children:i.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof L=="string"?{__html:Oe.string2HTML(L,N)}:void 0,children:typeof L=="function"?L(N):null})}):null]})}function _e(we){const{data:s,graphTitle:b,barColor:J=ve.Colors.primaryColors["blue-600"],barPadding:K=.25,showTicks:Q=!0,leftMargin:re=20,rightMargin:Z=20,topMargin:ye=20,bottomMargin:de=25,truncateBy:ee=999,showLabels:te=!0,showValues:be=!0,backgroundColor:C=!1,suffix:ie="",prefix:c="",sources:D,graphDescription:V,height:q,width:d,footNote:B,colorDomain:w,colorLegendTitle:U,padding:ae,relativeHeight:F,tooltip:A,onSeriesMouseOver:me,refValues:L,showColorScale:z=!0,graphID:ne,maxValue:le,minValue:E,highlightedDataPoints:g=[],qualitativeRangeColors:M,onSeriesMouseClick:se,graphDownload:H=!1,dataDownload:P=!1,language:u="en",theme:l="light",sortData:O,labelOrder:G,minHeight:$=0,maxBarThickness:T,maxNumberOfBars:f,minBarThickness:h,ariaLabel:oe,resetSelectionOnDoubleClick:W=!0,detailsOnClick:N,barAxisTitle:X,noOfTicks:ue=5,valueColor:k,styles:p,classNames:y,targetColor:x=ve.Colors.light.grays["gray-700"],filterNA:S=!0,targetStyle:I="line",measureBarWidthFactor:ce=.4,animate:Y=!1,dimmedOpacity:xe=.3,precision:ge=2,customLayers:he=[],naLabel:R="NA"}=we,[a,fe]=j.useState(0),[n,v]=j.useState(0),m=j.useRef(null),t=j.useRef(null);return j.useEffect(()=>{const e=new ResizeObserver(r=>{fe(d||r[0].target.clientWidth||620),v(q||r[0].target.clientHeight||480)});return m.current&&(v(m.current.clientHeight||480),fe(m.current.clientWidth||620),d||e.observe(m.current)),()=>e.disconnect()},[d,q]),i.jsxRuntimeExports.jsx("div",{className:`${l||"light"} flex ${d?"w-fit grow-0":"w-full grow"}`,dir:u==="he"||u==="ar"?"rtl":void 0,children:i.jsxRuntimeExports.jsx("div",{className:i.mo(`${C?C===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${u||"en"}`,y?.graphContainer),style:{...p?.graphContainer||{},...C&&C!==!0?{backgroundColor:C}:{}},id:ne,ref:t,"aria-label":oe||`${b?`The graph shows ${b}. `:""}This is a grouped bar chart. ${V?` ${V}`:""}`,children:i.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:C?ae||"1rem":ae||0},children:i.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[b||V||H||P?i.jsxRuntimeExports.jsx(Se.GraphHeader,{styles:{title:p?.title,description:p?.description},classNames:{title:y?.title,description:y?.description},graphTitle:b,graphDescription:V,width:d,graphDownload:H?t.current:void 0,dataDownload:P?s.map(e=>e.data).filter(e=>e!==void 0).length>0?s.map(e=>e.data).filter(e=>e!==void 0):s.filter(e=>e!==void 0):null}):null,i.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:s.length===0?i.jsxRuntimeExports.jsx(De.EmptyState,{}):i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[z&&s.filter(e=>e.qualitativeRange).length!==0&&w?i.jsxRuntimeExports.jsx(Be.ColorLegend,{width:d,colorLegendTitle:U,colors:M||ve.Colors[l].sequentialColors.positiveColorsx10,colorDomain:w,showNAColor:!1}):null,i.jsxRuntimeExports.jsx("div",{className:"flex grow flex-col justify-center w-full leading-0",ref:m,"aria-label":"Graph area",children:(d||a)&&(q||n)?i.jsxRuntimeExports.jsx(Ye,{data:O==="asc"?Me.sortBy(s.filter(e=>S?!o.checkIfNullOrUndefined(e.size):e),e=>e.size).filter((e,r)=>f?r<f:!0):O==="desc"?Me.sortBy(s.filter(e=>S?!o.checkIfNullOrUndefined(e.size):e),e=>e.size).reverse().filter((e,r)=>f?r<f:!0):s.filter(e=>S?!o.checkIfNullOrUndefined(e.size):e).filter((e,r)=>f?r<f:!0),barColor:J,targetColor:x,width:d||a,refValues:L,height:Math.max($,q||(F?$?(d||a)*F>$?(d||a)*F:$:(d||a)*F:n)),suffix:ie,prefix:c,barPadding:K,showLabels:te,showValues:be,showTicks:Q,truncateBy:ee,leftMargin:re,rightMargin:Z,qualitativeRangeColors:M||ve.Colors[l].sequentialColors.positiveColorsx10,topMargin:ye,bottomMargin:de,tooltip:A,onSeriesMouseOver:me,maxValue:le,minValue:E,highlightedDataPoints:g,onSeriesMouseClick:se,labelOrder:G,maxBarThickness:T,minBarThickness:h,resetSelectionOnDoubleClick:W,detailsOnClick:N,barAxisTitle:X,noOfTicks:ue,valueColor:k,styles:p,classNames:y,targetStyle:I,dimmedOpacity:xe,measureBarWidthFactor:ce,animate:Y===!0?{duration:.5,once:!0,amount:.5}:Y||{duration:0,once:!0,amount:0},precision:ge,customLayers:he,naLabel:R}):null})]})}),D||B?i.jsxRuntimeExports.jsx($e.GraphFooter,{styles:{footnote:p?.footnote,source:p?.source},classNames:{footnote:y?.footnote,source:y?.source},sources:D,footNote:B,width:d}):null]})})})})}function Je(we){const{data:s,graphTitle:b,barColor:J,barPadding:K,showTicks:Q,leftMargin:re,rightMargin:Z,topMargin:ye,bottomMargin:de,truncateBy:ee,showLabels:te,showValues:be,backgroundColor:C,suffix:ie,prefix:c,sources:D,graphDescription:V,height:q,width:d,footNote:B,colorDomain:w,colorLegendTitle:U,padding:ae,relativeHeight:F,tooltip:A,onSeriesMouseOver:me,refValues:L,showColorScale:z,graphID:ne,maxValue:le,minValue:E,highlightedDataPoints:g,onSeriesMouseClick:M,graphDownload:se,dataDownload:H,language:P,theme:u,sortData:l,labelOrder:O,minHeight:G,maxBarThickness:$,maxNumberOfBars:T,minBarThickness:f,ariaLabel:h,resetSelectionOnDoubleClick:oe,detailsOnClick:W,barAxisTitle:N,noOfTicks:X,valueColor:ue,orientation:k="vertical",styles:p,classNames:y,filterNA:x,targetStyle:S,targetColor:I,qualitativeRangeColors:ce,measureBarWidthFactor:Y,animate:xe,dimmedOpacity:ge,precision:he,naLabel:R}=we;return k==="vertical"?i.jsxRuntimeExports.jsx(_e,{data:s,graphTitle:b,barColor:J,barPadding:K,showTicks:Q,leftMargin:re,rightMargin:Z,topMargin:ye,bottomMargin:de,truncateBy:ee,showLabels:te,showValues:be,backgroundColor:C,suffix:ie,prefix:c,sources:D,graphDescription:V,height:q,width:d,footNote:B,colorDomain:w,colorLegendTitle:U,padding:ae,relativeHeight:F,tooltip:A,onSeriesMouseOver:me,refValues:L,showColorScale:z,graphID:ne,maxValue:le,minValue:E,highlightedDataPoints:g,onSeriesMouseClick:M,graphDownload:se,dataDownload:H,language:P,theme:u,sortData:l,labelOrder:O,minHeight:G,maxBarThickness:$,maxNumberOfBars:T,minBarThickness:f,ariaLabel:h,resetSelectionOnDoubleClick:oe,styles:p,detailsOnClick:W,barAxisTitle:N,noOfTicks:X,valueColor:ue,classNames:y,filterNA:x,targetStyle:S,targetColor:I,measureBarWidthFactor:Y,qualitativeRangeColors:ce,animate:xe,dimmedOpacity:ge,precision:he,naLabel:R}):i.jsxRuntimeExports.jsx(Xe,{data:s,graphTitle:b,barColor:J,barPadding:K,showTicks:Q,leftMargin:re,rightMargin:Z,topMargin:ye,bottomMargin:de,truncateBy:ee,showLabels:te,showValues:be,backgroundColor:C,suffix:ie,prefix:c,sources:D,graphDescription:V,height:q,width:d,footNote:B,colorDomain:w,colorLegendTitle:U,padding:ae,relativeHeight:F,tooltip:A,onSeriesMouseOver:me,refValues:L,showColorScale:z,graphID:ne,maxValue:le,minValue:E,highlightedDataPoints:g,onSeriesMouseClick:M,graphDownload:se,dataDownload:H,language:P,theme:u,sortData:l,labelOrder:O,minHeight:G,maxBarThickness:$,maxNumberOfBars:T,minBarThickness:f,ariaLabel:h,resetSelectionOnDoubleClick:oe,styles:p,detailsOnClick:W,barAxisTitle:N,noOfTicks:X,valueColor:ue,classNames:y,filterNA:x,targetStyle:S,targetColor:I,measureBarWidthFactor:Y,qualitativeRangeColors:ce,animate:xe,dimmedOpacity:ge,precision:he,naLabel:R})}exports.BulletChart=Je;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index-CHPV5EwG-DDoeWRVt.cjs"),j=require("react"),Me=require("./index-BzeLQvXk.cjs"),ke=require("./index-BXns0-ng.cjs"),Ce=require("./Modal-tXZlLE5s.cjs"),Re=require("./index-C21TvELx.cjs"),Ne=require("./numberFormattingFunction-02t-wJta.cjs"),Ee=require("./Tooltip-n8z5bfav.cjs"),o=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),Oe=require("./string2HTML-D2Avudmb.cjs"),Fe=require("./XTicksAndGridLines-CCzXIV8d.cjs"),He=require("./YAxesLabels-D8IydyZj.cjs"),Ie=require("./AxisTitle-CK9YeovX.cjs"),Ve=require("./Axis-DE7dSn1_.cjs"),ze=require("./ReferenceLine-CFVBBN__.cjs"),Te=require("./linear-BVckp9RD.cjs"),qe=require("./band-CAApY4Pd.cjs"),Ae=require("./use-in-view-sQJZ_xDO.cjs"),_=require("./proxy-BHRoeZgd.cjs"),Le=require("./index-BW8iNx7E.cjs"),$e=require("./GraphFooter.cjs"),Se=require("./GraphHeader.cjs"),ve=require("./Colors.cjs"),De=require("./EmptyState-d8_8SxeW.cjs"),Be=require("./ColorLegend.cjs"),Pe=require("./XAxesLabels-OjBNl_lS.cjs"),Ge=require("./YTicksAndGridLines-DBDuz6vb.cjs");function We(we){const{data:s,barColor:b,suffix:J,prefix:K,barPadding:Q,showValues:re,showTicks:Z,leftMargin:ye,truncateBy:de,width:ee,height:te,rightMargin:be,topMargin:C,bottomMargin:ie,showLabels:c,tooltip:D,onSeriesMouseOver:V,refValues:q,highlightedDataPoints:d,maxValue:B,minValue:w,onSeriesMouseClick:U,labelOrder:ae,rtl:F,maxBarThickness:A,minBarThickness:me,resetSelectionOnDoubleClick:L,detailsOnClick:z,barAxisTitle:ne,valueColor:le,noOfTicks:E,styles:g,classNames:M,targetStyle:se,targetColor:H,qualitativeRangeColors:P,measureBarWidthFactor:u,animate:l,dimmedOpacity:O,precision:G,customLayers:$,naLabel:T}=we,f=j.useRef(null),h=Ae.useInView(f,{once:l.once,amount:l.amount}),[oe,W]=j.useState(void 0),[N,X]=j.useState(void 0),[ue,k]=j.useState(void 0),[p,y]=j.useState(void 0),x={top:ne?C+25:C,bottom:ie,left:ye,right:be},S=ee-x.left-x.right,I=te-x.top-x.bottom,ce=Math.max(...s.filter(e=>!o.checkIfNullOrUndefined(e.size)).map(e=>e.size))<0?0:Math.max(...s.filter(e=>!o.checkIfNullOrUndefined(e.size)).map(e=>e.size)),Y=Math.max(...s.filter(e=>!o.checkIfNullOrUndefined(e.target)).map(e=>e.target))<0?0:Math.max(...s.filter(e=>!o.checkIfNullOrUndefined(e.target)).map(e=>e.target)),xe=Math.max(...s.map(e=>Re.sum((e.qualitativeRange||[]).filter(r=>!o.checkIfNullOrUndefined(r)))||0)),ge=o.checkIfNullOrUndefined(B)?Math.max(...[ce,Y,xe].filter(Number.isFinite))<0?0:Math.max(...[ce,Y,xe].filter(Number.isFinite)):B,he=Math.min(...s.filter(e=>!o.checkIfNullOrUndefined(e.size)).map(e=>e.size))>=0?0:Math.min(...s.filter(e=>!o.checkIfNullOrUndefined(e.size)).map(e=>e.size)),R=Math.min(...s.filter(e=>!o.checkIfNullOrUndefined(e.target)).map(e=>e.target))>=0?0:Math.min(...s.filter(e=>!o.checkIfNullOrUndefined(e.target)).map(e=>e.target)),a=o.checkIfNullOrUndefined(w)?Math.min(...[he,R].filter(Number.isFinite))>=0?0:Math.min(...[he,R].filter(Number.isFinite)):w,fe=s.map((e,r)=>({...e,id:ae?`${e.label}`:`${r}`})),n=Te.linear().domain([a,ge]).range([0,S]).nice(),v=ae||fe.map(e=>`${e.id}`),m=qe.band().domain(v).range([0,me?Math.max(I,me*v.length):A?Math.min(I,A*v.length):I]).paddingInner(Q),t=n.ticks(E);return i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[i.jsxRuntimeExports.jsx(_.motion.svg,{width:`${ee}px`,height:`${te}px`,viewBox:`0 0 ${ee} ${te}`,direction:"ltr",ref:f,children:i.jsxRuntimeExports.jsxs("g",{transform:`translate(${x.left},${x.top})`,children:[Z?i.jsxRuntimeExports.jsx(Fe.XTicksAndGridLines,{values:t.filter(e=>e!==0),x:t.filter(e=>e!==0).map(e=>n(e)),y1:0-C,y2:I+x.bottom,styles:{gridLines:g?.xAxis?.gridLines,labels:g?.xAxis?.labels},classNames:{gridLines:M?.xAxis?.gridLines,labels:M?.xAxis?.labels},suffix:J,prefix:K,labelType:"secondary",showGridLines:!0,precision:G}):null,i.jsxRuntimeExports.jsx(Ie.AxisTitle,{x:S/2,y:0-x.top+15,style:g?.xAxis?.title,className:M?.xAxis?.title,text:ne}),i.jsxRuntimeExports.jsx(Ve.Axis,{x1:n(a<0?0:a),x2:n(a<0?0:a),y1:-2.5,y2:I+x.bottom,classNames:{axis:M?.yAxis?.axis},styles:{axis:g?.yAxis?.axis}}),$.filter(e=>e.position==="before").map(e=>e.layer),i.jsxRuntimeExports.jsxs(Le.AnimatePresence,{children:[fe.map(e=>o.checkIfNullOrUndefined(m(e.id))?null:i.jsxRuntimeExports.jsxs(_.motion.g,{className:"undp-viz-g-with-hover",onMouseEnter:r=>{W(e),y(r.clientY),k(r.clientX),V?.(e)},onClick:()=>{(U||z)&&(ke.isEqual(N,e)&&L?(X(void 0),U?.(void 0)):(X(e),U?.(e)))},onMouseMove:r=>{W(e),y(r.clientY),k(r.clientX)},onMouseLeave:()=>{W(void 0),k(void 0),y(void 0),V?.(void 0)},exit:{opacity:0,transition:{duration:l.duration}},variants:{initial:{x:0,y:m(`${e.id}`),opacity:d.length!==0?d.indexOf(e.label)!==-1?.85:O:.85},whileInView:{x:0,y:m(`${e.id}`),opacity:d.length!==0?d.indexOf(e.label)!==-1?.85:O:.85,transition:{duration:l.duration}}},initial:"initial",animate:h?"whileInView":"initial",children:[e.qualitativeRange?e.qualitativeRange.map((r,pe)=>i.jsxRuntimeExports.jsx(_.motion.rect,{exit:{width:0,x:n(0),transition:{duration:l.duration}},variants:{initial:{x:n(0),width:0,fill:P[pe]},whileInView:{x:n(pe===0?0:Re.sum(e.qualitativeRange.filter((je,Ue)=>Ue<pe&&je))),width:n(r),fill:P[pe],transition:{duration:l.duration}}},initial:"initial",animate:h?"whileInView":"initial",y:0,height:m.bandwidth()},pe)):null,e.target&&se==="background"?i.jsxRuntimeExports.jsx(_.motion.rect,{y:0,x:e.target>=0?n(0):n(e.target),height:m.bandwidth(),style:{fill:H},exit:{width:0,x:n(0),transition:{duration:l.duration}},variants:{initial:{x:n(0),width:0},whileInView:{x:e.target>=0?n(0):n(e.target),width:e.target>=0?n(e.target)-n(0):n(0)-n(e.target),transition:{duration:l.duration}}},initial:"initial",animate:h?"whileInView":"initial"}):null,e.size?i.jsxRuntimeExports.jsx(_.motion.rect,{y:m.bandwidth()*((1-u)/2),style:{fill:b},height:m.bandwidth()*u,exit:{width:0,x:n(0),transition:{duration:l.duration}},variants:{initial:{x:n(0),width:0},whileInView:{x:e.size>=0?n(0):n(e.size),width:e.size>=0?n(e.size)-n(0):n(0)-n(e.size),transition:{duration:l.duration}}},initial:"initial",animate:h?"whileInView":"initial"}):null,e.target&&se==="line"?i.jsxRuntimeExports.jsx(_.motion.rect,{y:0,height:m.bandwidth(),style:{fill:H},width:2,exit:{opacity:0,x:n(0),transition:{duration:l.duration}},variants:{initial:{x:n(0),opacity:0},whileInView:{x:n(e.target)-1,opacity:1,transition:{duration:l.duration}}},initial:"initial",animate:h?"whileInView":"initial"}):null,c?i.jsxRuntimeExports.jsx(He.YAxesLabels,{value:`${e.label}`.length<de?`${e.label}`:`${`${e.label}`.substring(0,de)}...`,y:0,x:(e.size||0)<0?n(0):0-x.left,width:(e.size||0)<0?ee-n(0):n(0)+x.left,height:m.bandwidth(),alignment:e.size&&e.size<0?"left":"right",style:g?.yAxis?.labels,className:M?.yAxis?.labels,animate:l,isInView:h}):null,re?i.jsxRuntimeExports.jsx(_.motion.text,{y:m.bandwidth()/2,style:{...le?{fill:le}:{fill:b},textAnchor:e.size&&e.size<0?"end":"start",...g?.graphObjectValues||{}},className:i.mo("graph-value text-sm",!le&&b.length>1?" fill-primary-gray-600 dark:fill-primary-gray-300":"",M?.graphObjectValues),dx:e.size&&e.size<0?-5:5,dy:"0.33em",exit:{opacity:0,transition:{duration:l.duration}},variants:{initial:{x:n(0),opacity:0},whileInView:{x:e.size?n(e.size):n(0),opacity:1,transition:{duration:l.duration}}},initial:"initial",animate:h?"whileInView":"initial",children:Ne.numberFormattingFunction(e.size,T,G,K,J)}):null]},e.label)),q?i.jsxRuntimeExports.jsx(i.jsxRuntimeExports.Fragment,{children:q.map((e,r)=>i.jsxRuntimeExports.jsx(ze.RefLineX,{text:e.text,color:e.color,x:n(e.value),y1:0-x.top,y2:I+x.bottom,textSide:n(e.value)>S*.75||F?"left":"right",classNames:e.classNames,styles:e.styles,animate:l,isInView:h},r))}):null]}),$.filter(e=>e.position==="after").map(e=>e.layer)]})}),oe&&D&&ue&&p?i.jsxRuntimeExports.jsx(Ee.Tooltip,{data:oe,body:D,xPos:ue,yPos:p,backgroundStyle:g?.tooltip,className:M?.tooltip}):null,z&&N!==void 0?i.jsxRuntimeExports.jsx(Ce.X,{open:N!==void 0,onClose:()=>{X(void 0)},children:i.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof z=="string"?{__html:Oe.string2HTML(z,N)}:void 0,children:typeof z=="function"?z(N):null})}):null]})}function Xe(we){const{data:s,graphTitle:b,barColor:J=ve.Colors.primaryColors["blue-600"],suffix:K="",sources:Q,prefix:re="",graphDescription:Z,barPadding:ye=.25,showValues:de=!0,showTicks:ee=!0,leftMargin:te=100,rightMargin:be=40,truncateBy:C=999,height:ie,width:c,footNote:D,colorDomain:V,colorLegendTitle:q,highlightedDataPoints:d=[],padding:B,backgroundColor:w=!1,topMargin:U=25,bottomMargin:ae=10,showLabels:F=!0,relativeHeight:A,tooltip:me,onSeriesMouseOver:L,refValues:z,showColorScale:ne=!0,graphID:le,maxValue:E,minValue:g,onSeriesMouseClick:M,graphDownload:se=!1,dataDownload:H=!1,sortData:P,labelOrder:u,language:l="en",minHeight:O=0,theme:G="light",maxBarThickness:$,maxNumberOfBars:T,minBarThickness:f,ariaLabel:h,resetSelectionOnDoubleClick:oe=!0,detailsOnClick:W,barAxisTitle:N,noOfTicks:X=5,valueColor:ue,styles:k,classNames:p,filterNA:y=!0,targetStyle:x="line",targetColor:S=ve.Colors.light.grays["gray-700"],qualitativeRangeColors:I,measureBarWidthFactor:ce=.4,animate:Y=!1,dimmedOpacity:xe=.3,precision:ge=2,customLayers:he=[],naLabel:R="NA"}=we,[a,fe]=j.useState(0),[n,v]=j.useState(0),m=j.useRef(null),t=j.useRef(null);return j.useEffect(()=>{const e=new ResizeObserver(r=>{fe(c||r[0].target.clientWidth||620),v(ie||r[0].target.clientHeight||480)});return m.current&&(v(m.current.clientHeight||480),fe(m.current.clientWidth||620),c||e.observe(m.current)),()=>e.disconnect()},[c,ie]),i.jsxRuntimeExports.jsx("div",{className:`${G||"light"} flex ${c?"w-fit grow-0":"w-full grow"}`,dir:l==="he"||l==="ar"?"rtl":void 0,children:i.jsxRuntimeExports.jsx("div",{className:i.mo(`${w?w===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${l||"en"}`,p?.graphContainer),style:{...k?.graphContainer||{},...w&&w!==!0?{backgroundColor:w}:{}},id:le,ref:t,"aria-label":h||`${b?`The graph shows ${b}. `:""}This is a bar chart. ${Z?` ${Z}`:""}`,children:i.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:w?B||"1rem":B||0},children:i.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[b||Z||se||H?i.jsxRuntimeExports.jsx(Se.GraphHeader,{styles:{title:k?.title,description:k?.description},classNames:{title:p?.title,description:p?.description},graphTitle:b,graphDescription:Z,width:c,graphDownload:se?t.current:void 0,dataDownload:H?s.map(e=>e.data).filter(e=>e!==void 0).length>0?s.map(e=>e.data).filter(e=>e!==void 0):s.filter(e=>e!==void 0):null}):null,i.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:s.length===0?i.jsxRuntimeExports.jsx(De.EmptyState,{}):i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[ne&&s.filter(e=>e.qualitativeRange).length!==0&&V?i.jsxRuntimeExports.jsx(Be.ColorLegend,{width:c,colorLegendTitle:q,colors:I||ve.Colors[G].sequentialColors.positiveColorsx10,colorDomain:V,showNAColor:!1}):null,i.jsxRuntimeExports.jsx("div",{className:"flex grow flex-col justify-center w-full leading-0",ref:m,"aria-label":"Graph area",children:(c||a)&&(ie||n)?i.jsxRuntimeExports.jsx(We,{data:P==="asc"?Me.sortBy(s.filter(e=>y?!o.checkIfNullOrUndefined(e.size):e),e=>e.size).filter((e,r)=>T?r<T:!0):P==="desc"?Me.sortBy(s.filter(e=>y?!o.checkIfNullOrUndefined(e.size):e),e=>e.size).reverse().filter((e,r)=>T?r<T:!0):s.filter(e=>y?!o.checkIfNullOrUndefined(e.size):e).filter((e,r)=>T?r<T:!0),barColor:J,targetColor:S,width:c||a,height:Math.max(O,ie||(A?O?(c||a)*A>O?(c||a)*A:O:(c||a)*A:n)),suffix:K,prefix:re,barPadding:ye,showValues:de,showTicks:ee,leftMargin:te,rightMargin:be,topMargin:U,bottomMargin:ae,truncateBy:C,showLabels:F,tooltip:me,onSeriesMouseOver:L,refValues:z,maxValue:E,minValue:g,highlightedDataPoints:d,onSeriesMouseClick:M,labelOrder:u,rtl:l==="he"||l==="ar",maxBarThickness:$,minBarThickness:f,resetSelectionOnDoubleClick:oe,detailsOnClick:W,barAxisTitle:N,noOfTicks:X,valueColor:ue,classNames:p,styles:k,targetStyle:x,qualitativeRangeColors:I||ve.Colors[G].sequentialColors.positiveColorsx10,measureBarWidthFactor:ce,animate:Y===!0?{duration:.5,once:!0,amount:.5}:Y||{duration:0,once:!0,amount:0},dimmedOpacity:xe,precision:ge,customLayers:he,naLabel:R}):null})]})}),Q||D?i.jsxRuntimeExports.jsx($e.GraphFooter,{sources:Q,footNote:D,width:c,styles:{footnote:k?.footnote,source:k?.source},classNames:{footnote:p?.footnote,source:p?.source}}):null]})})})})}function Ye(we){const{data:s,width:b,height:J,barColor:K,suffix:Q,prefix:re,barPadding:Z,showLabels:ye,showValues:de,showTicks:ee,truncateBy:te,rightMargin:be,topMargin:C,bottomMargin:ie,leftMargin:c,tooltip:D,onSeriesMouseOver:V,refValues:q,maxValue:d,minValue:B,highlightedDataPoints:w,onSeriesMouseClick:U,labelOrder:ae,maxBarThickness:F,minBarThickness:A,resetSelectionOnDoubleClick:me,detailsOnClick:L,barAxisTitle:z,valueColor:ne,noOfTicks:le,styles:E,classNames:g,targetStyle:M,targetColor:se,qualitativeRangeColors:H,measureBarWidthFactor:P,animate:u,dimmedOpacity:l,precision:O,customLayers:G,naLabel:$}=we,T=j.useRef(null),f=Ae.useInView(T,{once:u.once,amount:u.amount}),h={top:C,bottom:ie,left:z?c+30:c,right:be},[oe,W]=j.useState(void 0),[N,X]=j.useState(void 0),[ue,k]=j.useState(void 0),[p,y]=j.useState(void 0),x=b-h.left-h.right,S=J-h.top-h.bottom,I=Math.max(...s.filter(t=>!o.checkIfNullOrUndefined(t.size)).map(t=>t.size))<0?0:Math.max(...s.filter(t=>!o.checkIfNullOrUndefined(t.size)).map(t=>t.size)),ce=Math.max(...s.filter(t=>!o.checkIfNullOrUndefined(t.target)).map(t=>t.target))<0?0:Math.max(...s.filter(t=>!o.checkIfNullOrUndefined(t.size)).map(t=>t.target)),Y=Math.max(...s.map(t=>Re.sum((t.qualitativeRange||[]).filter(e=>!o.checkIfNullOrUndefined(e)))||0)),xe=o.checkIfNullOrUndefined(d)?Math.max(...[I,ce,Y].filter(Number.isFinite))<0?0:Math.max(...[I,ce,Y].filter(Number.isFinite)):d,ge=Math.min(...s.filter(t=>!o.checkIfNullOrUndefined(t.size)).map(t=>t.size))>=0?0:Math.min(...s.filter(t=>!o.checkIfNullOrUndefined(t.size)).map(t=>t.size)),he=Math.min(...s.filter(t=>!o.checkIfNullOrUndefined(t.target)).map(t=>t.target))>=0?0:Math.min(...s.filter(t=>!o.checkIfNullOrUndefined(t.target)).map(t=>t.target)),R=o.checkIfNullOrUndefined(B)?Math.min(...[ge,he].filter(Number.isFinite))>=0?0:Math.min(...[ge,he].filter(Number.isFinite)):B,a=Te.linear().domain([R,xe]).range([S,0]).nice(),fe=s.map((t,e)=>({...t,id:ae?`${t.label}`:`${e}`})),n=ae||fe.map(t=>`${t.id}`),v=qe.band().domain(n).range([0,A?Math.max(x,A*n.length):F?Math.min(x,F*n.length):x]).paddingInner(Z),m=a.ticks(le);return i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[i.jsxRuntimeExports.jsx(_.motion.svg,{width:`${b}px`,height:`${J}px`,viewBox:`0 0 ${b} ${J}`,direction:"ltr",ref:T,children:i.jsxRuntimeExports.jsxs("g",{transform:`translate(${h.left},${h.top})`,children:[i.jsxRuntimeExports.jsx(Ve.Axis,{y1:a(R<0?0:R),y2:a(R<0?0:R),x1:0-c,x2:x+h.right,label:Ne.numberFormattingFunction(R<0?0:R,$,O,re,Q),labelPos:{x:0-c,dx:0,dy:xe<0?"1em":-5,y:a(R<0?0:R)},classNames:{axis:g?.xAxis?.axis,label:g?.yAxis?.labels},styles:{axis:E?.xAxis?.axis,label:E?.yAxis?.labels}}),ee?i.jsxRuntimeExports.jsx(Ge.YTicksAndGridLines,{values:m.filter(t=>t!==0),y:m.filter(t=>t!==0).map(t=>a(t)),x1:0-c,x2:x+h.right,styles:{gridLines:E?.yAxis?.gridLines,labels:E?.yAxis?.labels},classNames:{gridLines:g?.yAxis?.gridLines,labels:g?.yAxis?.labels},suffix:Q,prefix:re,labelType:"secondary",showGridLines:!0,labelPos:"vertical",precision:O}):null,i.jsxRuntimeExports.jsx(Ie.AxisTitle,{x:0-c-15,y:S/2,style:E?.yAxis?.title,className:g?.yAxis?.title,text:z,rotate90:!0}),G.filter(t=>t.position==="before").map(t=>t.layer),i.jsxRuntimeExports.jsxs(Le.AnimatePresence,{children:[fe.map(t=>o.checkIfNullOrUndefined(v(t.id))?null:i.jsxRuntimeExports.jsxs(_.motion.g,{className:"undp-viz-g-with-hover",onMouseEnter:e=>{W(t),y(e.clientY),k(e.clientX),V?.(t)},onClick:()=>{(U||L)&&(ke.isEqual(N,t)&&me?(X(void 0),U?.(void 0)):(X(t),U?.(t)))},onMouseMove:e=>{W(t),y(e.clientY),k(e.clientX)},onMouseLeave:()=>{W(void 0),k(void 0),y(void 0),V?.(void 0)},exit:{opacity:0,transition:{duration:u.duration}},variants:{initial:{x:v(`${t.id}`),y:0,opacity:w.length!==0?w.indexOf(t.label)!==-1?.85:l:.85},whileInView:{x:v(`${t.id}`),y:0,opacity:w.length!==0?w.indexOf(t.label)!==-1?.85:l:.85,transition:{duration:u.duration}}},initial:"initial",animate:f?"whileInView":"initial",children:[t.qualitativeRange?t.qualitativeRange.map((e,r)=>i.jsxRuntimeExports.jsx(_.motion.rect,{x:0,exit:{height:0,y:a(0),transition:{duration:u.duration}},variants:{initial:{height:0,y:a(0),fill:H[r]},whileInView:{height:Math.abs(a(Re.sum(t.qualitativeRange.filter((pe,je)=>je<=r&&pe)))-a(Re.sum(t.qualitativeRange.filter((pe,je)=>je<r&&pe)))),y:a(Re.sum(t.qualitativeRange.filter((pe,je)=>je<=r&&pe))),fill:H[r],transition:{duration:u.duration}}},initial:"initial",animate:f?"whileInView":"initial",width:v.bandwidth()},r)):null,t.target&&M==="background"?i.jsxRuntimeExports.jsx(_.motion.rect,{x:0,width:v.bandwidth(),style:{fill:se},exit:{height:0,y:a(0),transition:{duration:u.duration}},variants:{initial:{height:0,y:a(0)},whileInView:{height:Math.abs(a(t.target)-a(0)),y:t.target>0?a(t.target):a(0),transition:{duration:u.duration}}},initial:"initial",animate:f?"whileInView":"initial"}):null,t.size?i.jsxRuntimeExports.jsx(_.motion.rect,{x:v.bandwidth()*((1-P)/2),width:v.bandwidth()*P,style:{fill:K},exit:{height:0,y:a(0),transition:{duration:u.duration}},variants:{initial:{height:0,y:a(0)},whileInView:{height:Math.abs(a(t.size)-a(0)),y:t.size>0?a(t.size):a(0),transition:{duration:u.duration}}},initial:"initial",animate:f?"whileInView":"initial"}):null,t.target&&M==="line"?i.jsxRuntimeExports.jsx(_.motion.rect,{x:0,width:v.bandwidth(),style:{fill:se},exit:{y:a(0),opacity:0,transition:{duration:u.duration}},variants:{initial:{y:a(0),opacity:0},whileInView:{y:a(t.target)-1,opacity:1,transition:{duration:u.duration}}},initial:"initial",animate:f?"whileInView":"initial",height:2}):null,ye?i.jsxRuntimeExports.jsx(Pe.XAxesLabels,{value:`${t.label}`.length<te?`${t.label}`:`${`${t.label}`.substring(0,te)}...`,y:(t.size||0)<0?0:a(0)+5,x:0,width:v.bandwidth(),height:(t.size||0)<0?a(0)-5:h.bottom,style:E?.xAxis?.labels,className:g?.xAxis?.labels,alignment:(t.size||0)<0?"bottom":"top",animate:u,isInView:f}):null,de?i.jsxRuntimeExports.jsx(_.motion.text,{x:v.bandwidth()/2,style:{...ne?{fill:ne}:{fill:K},textAnchor:"middle",...E?.graphObjectValues||{}},className:i.mo("graph-value text-sm",!ne&&K.length>1?" fill-primary-gray-600 dark:fill-primary-gray-300":"",g?.graphObjectValues),dy:t.size?t.size>=0?"-5px":"1em":"-5px",exit:{opacity:0,transition:{duration:u.duration}},variants:{initial:{y:a(0),opacity:0},whileInView:{y:a(t.size||0),opacity:1,transition:{duration:u.duration}}},initial:"initial",animate:f?"whileInView":"initial",children:Ne.numberFormattingFunction(t.size,$,O,re,Q)}):null]},t.label)),q?i.jsxRuntimeExports.jsx(i.jsxRuntimeExports.Fragment,{children:q.map((t,e)=>i.jsxRuntimeExports.jsx(ze.RefLineY,{text:t.text,color:t.color,y:a(t.value),x1:0-c,x2:x+h.right,classNames:t.classNames,styles:t.styles,animate:u,isInView:f},e))}):null]}),G.filter(t=>t.position==="after").map(t=>t.layer)]})}),oe&&D&&ue&&p?i.jsxRuntimeExports.jsx(Ee.Tooltip,{data:oe,body:D,xPos:ue,yPos:p,backgroundStyle:E?.tooltip,className:g?.tooltip}):null,L&&N!==void 0?i.jsxRuntimeExports.jsx(Ce.X,{open:N!==void 0,onClose:()=>{X(void 0)},children:i.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof L=="string"?{__html:Oe.string2HTML(L,N)}:void 0,children:typeof L=="function"?L(N):null})}):null]})}function _e(we){const{data:s,graphTitle:b,barColor:J=ve.Colors.primaryColors["blue-600"],barPadding:K=.25,showTicks:Q=!0,leftMargin:re=20,rightMargin:Z=20,topMargin:ye=20,bottomMargin:de=25,truncateBy:ee=999,showLabels:te=!0,showValues:be=!0,backgroundColor:C=!1,suffix:ie="",prefix:c="",sources:D,graphDescription:V,height:q,width:d,footNote:B,colorDomain:w,colorLegendTitle:U,padding:ae,relativeHeight:F,tooltip:A,onSeriesMouseOver:me,refValues:L,showColorScale:z=!0,graphID:ne,maxValue:le,minValue:E,highlightedDataPoints:g=[],qualitativeRangeColors:M,onSeriesMouseClick:se,graphDownload:H=!1,dataDownload:P=!1,language:u="en",theme:l="light",sortData:O,labelOrder:G,minHeight:$=0,maxBarThickness:T,maxNumberOfBars:f,minBarThickness:h,ariaLabel:oe,resetSelectionOnDoubleClick:W=!0,detailsOnClick:N,barAxisTitle:X,noOfTicks:ue=5,valueColor:k,styles:p,classNames:y,targetColor:x=ve.Colors.light.grays["gray-700"],filterNA:S=!0,targetStyle:I="line",measureBarWidthFactor:ce=.4,animate:Y=!1,dimmedOpacity:xe=.3,precision:ge=2,customLayers:he=[],naLabel:R="NA"}=we,[a,fe]=j.useState(0),[n,v]=j.useState(0),m=j.useRef(null),t=j.useRef(null);return j.useEffect(()=>{const e=new ResizeObserver(r=>{fe(d||r[0].target.clientWidth||620),v(q||r[0].target.clientHeight||480)});return m.current&&(v(m.current.clientHeight||480),fe(m.current.clientWidth||620),d||e.observe(m.current)),()=>e.disconnect()},[d,q]),i.jsxRuntimeExports.jsx("div",{className:`${l||"light"} flex ${d?"w-fit grow-0":"w-full grow"}`,dir:u==="he"||u==="ar"?"rtl":void 0,children:i.jsxRuntimeExports.jsx("div",{className:i.mo(`${C?C===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${u||"en"}`,y?.graphContainer),style:{...p?.graphContainer||{},...C&&C!==!0?{backgroundColor:C}:{}},id:ne,ref:t,"aria-label":oe||`${b?`The graph shows ${b}. `:""}This is a grouped bar chart. ${V?` ${V}`:""}`,children:i.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:C?ae||"1rem":ae||0},children:i.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[b||V||H||P?i.jsxRuntimeExports.jsx(Se.GraphHeader,{styles:{title:p?.title,description:p?.description},classNames:{title:y?.title,description:y?.description},graphTitle:b,graphDescription:V,width:d,graphDownload:H?t.current:void 0,dataDownload:P?s.map(e=>e.data).filter(e=>e!==void 0).length>0?s.map(e=>e.data).filter(e=>e!==void 0):s.filter(e=>e!==void 0):null}):null,i.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:s.length===0?i.jsxRuntimeExports.jsx(De.EmptyState,{}):i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[z&&s.filter(e=>e.qualitativeRange).length!==0&&w?i.jsxRuntimeExports.jsx(Be.ColorLegend,{width:d,colorLegendTitle:U,colors:M||ve.Colors[l].sequentialColors.positiveColorsx10,colorDomain:w,showNAColor:!1}):null,i.jsxRuntimeExports.jsx("div",{className:"flex grow flex-col justify-center w-full leading-0",ref:m,"aria-label":"Graph area",children:(d||a)&&(q||n)?i.jsxRuntimeExports.jsx(Ye,{data:O==="asc"?Me.sortBy(s.filter(e=>S?!o.checkIfNullOrUndefined(e.size):e),e=>e.size).filter((e,r)=>f?r<f:!0):O==="desc"?Me.sortBy(s.filter(e=>S?!o.checkIfNullOrUndefined(e.size):e),e=>e.size).reverse().filter((e,r)=>f?r<f:!0):s.filter(e=>S?!o.checkIfNullOrUndefined(e.size):e).filter((e,r)=>f?r<f:!0),barColor:J,targetColor:x,width:d||a,refValues:L,height:Math.max($,q||(F?$?(d||a)*F>$?(d||a)*F:$:(d||a)*F:n)),suffix:ie,prefix:c,barPadding:K,showLabels:te,showValues:be,showTicks:Q,truncateBy:ee,leftMargin:re,rightMargin:Z,qualitativeRangeColors:M||ve.Colors[l].sequentialColors.positiveColorsx10,topMargin:ye,bottomMargin:de,tooltip:A,onSeriesMouseOver:me,maxValue:le,minValue:E,highlightedDataPoints:g,onSeriesMouseClick:se,labelOrder:G,maxBarThickness:T,minBarThickness:h,resetSelectionOnDoubleClick:W,detailsOnClick:N,barAxisTitle:X,noOfTicks:ue,valueColor:k,styles:p,classNames:y,targetStyle:I,dimmedOpacity:xe,measureBarWidthFactor:ce,animate:Y===!0?{duration:.5,once:!0,amount:.5}:Y||{duration:0,once:!0,amount:0},precision:ge,customLayers:he,naLabel:R}):null})]})}),D||B?i.jsxRuntimeExports.jsx($e.GraphFooter,{styles:{footnote:p?.footnote,source:p?.source},classNames:{footnote:y?.footnote,source:y?.source},sources:D,footNote:B,width:d}):null]})})})})}function Je(we){const{data:s,graphTitle:b,barColor:J,barPadding:K,showTicks:Q,leftMargin:re,rightMargin:Z,topMargin:ye,bottomMargin:de,truncateBy:ee,showLabels:te,showValues:be,backgroundColor:C,suffix:ie,prefix:c,sources:D,graphDescription:V,height:q,width:d,footNote:B,colorDomain:w,colorLegendTitle:U,padding:ae,relativeHeight:F,tooltip:A,onSeriesMouseOver:me,refValues:L,showColorScale:z,graphID:ne,maxValue:le,minValue:E,highlightedDataPoints:g,onSeriesMouseClick:M,graphDownload:se,dataDownload:H,language:P,theme:u,sortData:l,labelOrder:O,minHeight:G,maxBarThickness:$,maxNumberOfBars:T,minBarThickness:f,ariaLabel:h,resetSelectionOnDoubleClick:oe,detailsOnClick:W,barAxisTitle:N,noOfTicks:X,valueColor:ue,orientation:k="vertical",styles:p,classNames:y,filterNA:x,targetStyle:S,targetColor:I,qualitativeRangeColors:ce,measureBarWidthFactor:Y,animate:xe,dimmedOpacity:ge,precision:he,naLabel:R}=we;return k==="vertical"?i.jsxRuntimeExports.jsx(_e,{data:s,graphTitle:b,barColor:J,barPadding:K,showTicks:Q,leftMargin:re,rightMargin:Z,topMargin:ye,bottomMargin:de,truncateBy:ee,showLabels:te,showValues:be,backgroundColor:C,suffix:ie,prefix:c,sources:D,graphDescription:V,height:q,width:d,footNote:B,colorDomain:w,colorLegendTitle:U,padding:ae,relativeHeight:F,tooltip:A,onSeriesMouseOver:me,refValues:L,showColorScale:z,graphID:ne,maxValue:le,minValue:E,highlightedDataPoints:g,onSeriesMouseClick:M,graphDownload:se,dataDownload:H,language:P,theme:u,sortData:l,labelOrder:O,minHeight:G,maxBarThickness:$,maxNumberOfBars:T,minBarThickness:f,ariaLabel:h,resetSelectionOnDoubleClick:oe,styles:p,detailsOnClick:W,barAxisTitle:N,noOfTicks:X,valueColor:ue,classNames:y,filterNA:x,targetStyle:S,targetColor:I,measureBarWidthFactor:Y,qualitativeRangeColors:ce,animate:xe,dimmedOpacity:ge,precision:he,naLabel:R}):i.jsxRuntimeExports.jsx(Xe,{data:s,graphTitle:b,barColor:J,barPadding:K,showTicks:Q,leftMargin:re,rightMargin:Z,topMargin:ye,bottomMargin:de,truncateBy:ee,showLabels:te,showValues:be,backgroundColor:C,suffix:ie,prefix:c,sources:D,graphDescription:V,height:q,width:d,footNote:B,colorDomain:w,colorLegendTitle:U,padding:ae,relativeHeight:F,tooltip:A,onSeriesMouseOver:me,refValues:L,showColorScale:z,graphID:ne,maxValue:le,minValue:E,highlightedDataPoints:g,onSeriesMouseClick:M,graphDownload:se,dataDownload:H,language:P,theme:u,sortData:l,labelOrder:O,minHeight:G,maxBarThickness:$,maxNumberOfBars:T,minBarThickness:f,ariaLabel:h,resetSelectionOnDoubleClick:oe,styles:p,detailsOnClick:W,barAxisTitle:N,noOfTicks:X,valueColor:ue,classNames:y,filterNA:x,targetStyle:S,targetColor:I,measureBarWidthFactor:Y,qualitativeRangeColors:ce,animate:xe,dimmedOpacity:ge,precision:he,naLabel:R})}exports.BulletChart=Je;
|
|
2
2
|
//# sourceMappingURL=BulletChart.cjs.map
|
package/dist/BulletChart.js
CHANGED
|
@@ -2,28 +2,28 @@ import { j as e, m as Ni } from "./index-CHPV5EwG-BPSP-7Jg.js";
|
|
|
2
2
|
import { useRef as ji, useState as gi, useEffect as ki } from "react";
|
|
3
3
|
import { s as Vi } from "./index-DxagiOHo.js";
|
|
4
4
|
import { i as Oi } from "./index-27yTRcko.js";
|
|
5
|
-
import { X as Ti } from "./Modal-
|
|
5
|
+
import { X as Ti } from "./Modal-DVVwpKhP.js";
|
|
6
6
|
import { s as Ci } from "./index-D7ltPi18.js";
|
|
7
7
|
import { n as zi } from "./numberFormattingFunction-14YCbkN2.js";
|
|
8
8
|
import { T as $i } from "./Tooltip-DyM5snqx.js";
|
|
9
9
|
import { c as o } from "./checkIfNullOrUndefined-DmfiKkNw.js";
|
|
10
10
|
import { s as Ai } from "./string2HTML-CWHGfz_d.js";
|
|
11
11
|
import { X as Xi } from "./XTicksAndGridLines-Bn9u5gOM.js";
|
|
12
|
-
import { Y as Yi } from "./YAxesLabels-
|
|
12
|
+
import { Y as Yi } from "./YAxesLabels-CPGZjmZJ.js";
|
|
13
13
|
import { A as Di } from "./AxisTitle-BmHLMRJZ.js";
|
|
14
14
|
import { A as Li } from "./Axis-Ddg-seDi.js";
|
|
15
|
-
import { a as Ei, R as _i } from "./ReferenceLine-
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import { m as G } from "./proxy-
|
|
20
|
-
import { A as Bi } from "./index-
|
|
15
|
+
import { a as Ei, R as _i } from "./ReferenceLine-CfAW3vKJ.js";
|
|
16
|
+
import { a as Ii } from "./linear-DUdu7l2G.js";
|
|
17
|
+
import { b as Si } from "./band-BEjh2CHI.js";
|
|
18
|
+
import { u as Ri } from "./use-in-view-yS6jzJAp.js";
|
|
19
|
+
import { m as G } from "./proxy-CkpFesk1.js";
|
|
20
|
+
import { A as Bi } from "./index-CNvov0eg.js";
|
|
21
21
|
import { GraphFooter as qi } from "./GraphFooter.js";
|
|
22
22
|
import { GraphHeader as Fi } from "./GraphHeader.js";
|
|
23
23
|
import { Colors as wi } from "./Colors.js";
|
|
24
24
|
import { E as Hi } from "./EmptyState-DdTp-Mdn.js";
|
|
25
25
|
import { ColorLegend as Pi } from "./ColorLegend.js";
|
|
26
|
-
import { X as Gi } from "./XAxesLabels-
|
|
26
|
+
import { X as Gi } from "./XAxesLabels-CaV2q-6H.js";
|
|
27
27
|
import { Y as Ui } from "./YTicksAndGridLines-B6ah7CRf.js";
|
|
28
28
|
function Ji(vi) {
|
|
29
29
|
const {
|
|
@@ -69,7 +69,7 @@ function Ji(vi) {
|
|
|
69
69
|
precision: X,
|
|
70
70
|
customLayers: S,
|
|
71
71
|
naLabel: A
|
|
72
|
-
} = vi, f = ji(null), g =
|
|
72
|
+
} = vi, f = ji(null), g = Ri(f, {
|
|
73
73
|
once: n.once,
|
|
74
74
|
amount: n.amount
|
|
75
75
|
}), [ni, Y] = gi(void 0), [j, E] = gi(void 0), [oi, V] = gi(void 0), [p, y] = gi(void 0), u = {
|
|
@@ -88,7 +88,7 @@ function Ji(vi) {
|
|
|
88
88
|
), a = o(v) ? Math.min(...[ui, M].filter(Number.isFinite)) >= 0 ? 0 : Math.min(...[ui, M].filter(Number.isFinite)) : v, fi = l.map((i, s) => ({
|
|
89
89
|
...i,
|
|
90
90
|
id: ei ? `${i.label}` : `${s}`
|
|
91
|
-
})), r =
|
|
91
|
+
})), r = Ii().domain([a, xi]).range([0, R]).nice(), w = ei || fi.map((i) => `${i.id}`), d = Si().domain(w).range([
|
|
92
92
|
0,
|
|
93
93
|
di ? Math.max(O, di * w.length) : L ? Math.min(O, L * w.length) : O
|
|
94
94
|
]).paddingInner(K), t = r.ticks(z);
|
|
@@ -659,7 +659,7 @@ function Qi(vi) {
|
|
|
659
659
|
precision: k,
|
|
660
660
|
customLayers: X,
|
|
661
661
|
naLabel: S
|
|
662
|
-
} = vi, A = ji(null), f =
|
|
662
|
+
} = vi, A = ji(null), f = Ri(A, {
|
|
663
663
|
once: h.once,
|
|
664
664
|
amount: h.amount
|
|
665
665
|
}), g = {
|
|
@@ -673,10 +673,10 @@ function Qi(vi) {
|
|
|
673
673
|
...[O, hi, _].filter(Number.isFinite)
|
|
674
674
|
) : m, xi = Math.min(...l.filter((t) => !o(t.size)).map((t) => t.size)) >= 0 ? 0 : Math.min(...l.filter((t) => !o(t.size)).map((t) => t.size)), ui = Math.min(...l.filter((t) => !o(t.target)).map((t) => t.target)) >= 0 ? 0 : Math.min(
|
|
675
675
|
...l.filter((t) => !o(t.target)).map((t) => t.target)
|
|
676
|
-
), M = o(q) ? Math.min(...[xi, ui].filter(Number.isFinite)) >= 0 ? 0 : Math.min(...[xi, ui].filter(Number.isFinite)) : q, a =
|
|
676
|
+
), M = o(q) ? Math.min(...[xi, ui].filter(Number.isFinite)) >= 0 ? 0 : Math.min(...[xi, ui].filter(Number.isFinite)) : q, a = Ii().domain([M, ci]).range([R, 0]).nice(), fi = l.map((t, i) => ({
|
|
677
677
|
...t,
|
|
678
678
|
id: ei ? `${t.label}` : `${i}`
|
|
679
|
-
})), r = ei || fi.map((t) => `${t.id}`), w =
|
|
679
|
+
})), r = ei || fi.map((t) => `${t.id}`), w = Si().domain(r).range([
|
|
680
680
|
0,
|
|
681
681
|
L ? Math.max(u, L * r.length) : H ? Math.min(u, H * r.length) : u
|
|
682
682
|
]).paddingInner(Q), d = a.ticks(si);
|
package/dist/ButterflyChart.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-CHPV5EwG-DDoeWRVt.cjs"),y=require("react"),me=require("./getSliderMarks-CtsEXiLV.cjs"),fe=require("./parse-hMnG_lRV.cjs"),Me=require("./index-CZbIGs8q.cjs"),ye=require("./index-BXns0-ng.cjs"),Ae=require("./Modal-C_dl0EtQ.cjs"),je=require("./numberFormattingFunction-02t-wJta.cjs"),Ce=require("./Tooltip-n8z5bfav.cjs"),Le=require("./string2HTML-D2Avudmb.cjs"),be=require("./XTicksAndGridLines-CCzXIV8d.cjs"),ve=require("./Axis-DE7dSn1_.cjs"),$e=require("./YAxesLabels-BXLTX7AI.cjs"),we=require("./ReferenceLine-CuFMk0cI.cjs"),ke=require("./use-in-view-BCmzDU2O.cjs"),Ne=require("./band-CAApY4Pd.cjs"),Re=require("./linear-BVckp9RD.cjs"),T=require("./proxy-PQd2AItT.cjs"),de=require("./index-DVOJ7vxH.cjs"),qe=require("./GraphFooter.cjs"),Ve=require("./GraphHeader.cjs"),Se=require("./ColorLegend.cjs"),Ee=require("./Colors.cjs"),Te=require("./EmptyState-d8_8SxeW.cjs"),Be=require("./index-BW_-wD2k.cjs"),he=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),Oe=require("./ensureCompleteData-DqWQ2Zbi.cjs"),Ie=require("./init-DU0ybBc_.cjs");function De(W){const{data:x,width:j,height:R,barColors:u,centerGap:d,refValues:o,maxValue:E,minValue:U,showValues:z,axisTitles:B,rightMargin:ne,leftMargin:oe,topMargin:_,bottomMargin:le,tooltip:J,onSeriesMouseOver:O,barPadding:xe,truncateBy:I,onSeriesMouseClick:$,showTicks:te,suffix:G,prefix:H,resetSelectionOnDoubleClick:ie,detailsOnClick:M,styles:h,classNames:a,noOfTicks:A,animate:m,precision:P,customLayers:se,minValueLeftBar:k,minValueRightBar:N,naLabel:K}=W,Q=y.useRef(null),b=ke.useInView(Q,{once:m.once,amount:m.amount}),[re,v]=y.useState(void 0),[q,D]=y.useState(void 0),[ae,V]=y.useState(void 0),[C,p]=y.useState(void 0),c={top:_,bottom:le,left:oe,right:ne},L=j-c.left-c.right,w=R-c.top-c.bottom,X=x.map((e,r)=>({...e,id:`${r}`})),s=Ne.band().domain(X.map(e=>`${e.id}`)).range([w,0]).paddingInner(xe),l=Re.linear().domain([U,E]).range([0,(L-d)/2]).nice(),S=l.ticks(A),n=Re.linear().domain([U,E]).range([(L-d)/2,0]).nice(),Z=n.ticks(A);return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(T.motion.svg,{width:`${j}px`,height:`${R}px`,viewBox:`0 0 ${j} ${R}`,direction:"ltr",ref:Q,children:t.jsxRuntimeExports.jsxs("g",{transform:`translate(${c.left},${c.top})`,children:[se.filter(e=>e.position==="before").map(e=>e.layer),t.jsxRuntimeExports.jsxs("g",{transform:"translate(0,0)",children:[te?t.jsxRuntimeExports.jsx(be.XTicksAndGridLines,{values:Z.filter(e=>e!==0),x:Z.filter(e=>e!==0).map(e=>n(e)),y1:0-_,y2:w+c.bottom,styles:{gridLines:h?.xAxis?.gridLines,labels:h?.xAxis?.labels},classNames:{gridLines:a?.xAxis?.gridLines,labels:a?.xAxis?.labels},suffix:G,prefix:H,labelType:"secondary",showGridLines:!0,leftLabel:!0,precision:P}):null,t.jsxRuntimeExports.jsxs(de.AnimatePresence,{children:[X.map((e,r)=>t.jsxRuntimeExports.jsxs(T.motion.g,{className:"undp-viz-g-with-hover",opacity:.85,onMouseEnter:f=>{v(e),p(f.clientY),V(f.clientX),O?.(e)},onClick:()=>{($||M)&&(ye.isEqual(q,e)&&ie?(D(void 0),$?.(void 0)):(D(e),$?.(e)))},onMouseMove:f=>{v(e),p(f.clientY),V(f.clientX)},onMouseLeave:()=>{v(void 0),V(void 0),p(void 0),O?.(void 0)},children:[e.leftBar?t.jsxRuntimeExports.jsx(T.motion.rect,{y:s(`${r}`),style:{fill:u[0]},height:s.bandwidth(),variants:{initial:{x:n(0),width:0},whileInView:{x:e.leftBar<0?n(0):n(e.leftBar),width:e.leftBar<0?n(e.leftBar)-n(0):n(0)-n(e.leftBar),transition:{duration:m.duration}}},initial:"initial",animate:b?"whileInView":"initial",exit:{x:n(0),width:0,transition:{duration:m.duration}}}):null,z?t.jsxRuntimeExports.jsx(T.motion.text,{y:s(`${r}`)+s.bandwidth()/2,style:{fill:u[0],textAnchor:e.rightBar&&e.rightBar>0?"end":"start",...h?.graphObjectValues||{}},dx:e.rightBar&&e.rightBar>0?-5:5,dy:"0.33em",className:t.mo("graph-value text-sm",a?.graphObjectValues),exit:{opacity:0,transition:{duration:m.duration}},variants:{initial:{x:n(0),opacity:0},whileInView:{x:e.leftBar?n(e.leftBar):n(k<0?0:k),opacity:1,transition:{duration:m.duration}}},initial:"initial",animate:b?"whileInView":"initial",children:je.numberFormattingFunction(e.rightBar,K,P,H,G)}):null]},e.label)),t.jsxRuntimeExports.jsx(ve.Axis,{y1:-2.5,y2:w+c.bottom,x1:n(k<0?0:k),x2:n(k<0?0:k),classNames:{axis:a?.yAxis?.axis},styles:{axis:h?.yAxis?.axis}}),o?t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:o.map((e,r)=>t.jsxRuntimeExports.jsx(we.RefLineX,{text:e.text,color:e.color,x:n(e.value),y1:0-c.top,y2:w+c.bottom,textSide:"left",classNames:e.classNames,styles:e.styles,animate:m,isInView:b},r))}):null]})]}),t.jsxRuntimeExports.jsxs("g",{transform:`translate(${(L+d)/2},0)`,children:[te?t.jsxRuntimeExports.jsx(be.XTicksAndGridLines,{values:S.filter(e=>e!==0),x:S.filter(e=>e!==0).map(e=>l(e)),y1:0-_,y2:w+c.bottom,styles:{gridLines:h?.xAxis?.gridLines,labels:h?.xAxis?.labels},classNames:{gridLines:a?.xAxis?.gridLines,labels:a?.xAxis?.labels},suffix:G,prefix:H,labelType:"secondary",showGridLines:!0,precision:P}):null,t.jsxRuntimeExports.jsxs(de.AnimatePresence,{children:[X.map((e,r)=>t.jsxRuntimeExports.jsxs(T.motion.g,{className:"undp-viz-g-with-hover",opacity:.85,onMouseEnter:f=>{v(e),p(f.clientY),V(f.clientX),O?.(e)},onClick:()=>{($||M)&&(ye.isEqual(q,e)&&ie?(D(void 0),$?.(void 0)):(D(e),$?.(e)))},onMouseMove:f=>{v(e),p(f.clientY),V(f.clientX)},onMouseLeave:()=>{v(void 0),V(void 0),p(void 0),O?.(void 0)},children:[e.rightBar?t.jsxRuntimeExports.jsx(T.motion.rect,{y:s(`${r}`),style:{fill:u[1]},height:s.bandwidth(),exit:{x:l(0),width:0,transition:{duration:m.duration}},variants:{initial:{x:l(0),width:0},whileInView:{x:e.rightBar>=0?l(0):l(e.rightBar),width:e.rightBar>=0?l(e.rightBar)-l(0):l(0)-l(e.rightBar),transition:{duration:m.duration}}},initial:"initial",animate:b?"whileInView":"initial"}):null,z?t.jsxRuntimeExports.jsx(T.motion.text,{y:s(`${r}`)+s.bandwidth()/2,style:{fill:u[1],textAnchor:e.rightBar&&e.rightBar<0?"end":"start",...h?.graphObjectValues||{}},className:t.mo("graph-value text-sm",a?.graphObjectValues),dx:e.rightBar&&e.rightBar<0?-5:5,dy:"0.33em",exit:{opacity:0,transition:{duration:m.duration}},variants:{initial:{x:l(0),opacity:0},whileInView:{x:e.rightBar?l(e.rightBar):l(N<0?0:N),opacity:1,transition:{duration:m.duration}}},initial:"initial",animate:b?"whileInView":"initial",children:je.numberFormattingFunction(e.rightBar,K,P,H,G)}):null]},r)),t.jsxRuntimeExports.jsx(ve.Axis,{y1:-2.5,y2:w+c.bottom,x1:l(N<0?0:N),x2:l(N<0?0:N),classNames:{axis:a?.yAxis?.axis},styles:{axis:h?.yAxis?.axis}}),o?t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:o.map((e,r)=>t.jsxRuntimeExports.jsx(we.RefLineX,{text:e.text,color:e.color,x:l(e.value),y1:0-c.top,y2:w+c.bottom,textSide:"right",classNames:e.classNames,styles:e.styles,animate:m,isInView:b},r))}):null]})]}),t.jsxRuntimeExports.jsx(de.AnimatePresence,{children:t.jsxRuntimeExports.jsx(T.motion.g,{transform:`translate(${L/2},0)`,children:X.map((e,r)=>t.jsxRuntimeExports.jsx($e.YAxesLabels,{value:`${e.label}`.length<I?`${e.label}`:`${`${e.label}`.substring(0,I)}...`,y:s(`${e.id}`),x:0-d/2,width:d,height:s.bandwidth(),alignment:"center",style:h?.yAxis?.labels,className:a?.yAxis?.labels,animate:m,isInView:b},r))})}),t.jsxRuntimeExports.jsxs("g",{transform:`translate(0,${w})`,children:[t.jsxRuntimeExports.jsx("text",{style:{fill:u[0],textAnchor:"end",...h?.yAxis?.title},className:t.mo("text-base",a?.yAxis?.title),x:L/2-d/2,y:0,dx:-5,dy:20,children:B[0]}),t.jsxRuntimeExports.jsx("text",{style:{fill:u[1],textAnchor:"start",...h?.yAxis?.title},className:t.mo("text-base",a?.yAxis?.title),x:L/2+d/2,y:0,dx:5,dy:20,children:B[1]})]}),se.filter(e=>e.position==="after").map(e=>e.layer)]})}),re&&J&&ae&&C?t.jsxRuntimeExports.jsx(Ce.Tooltip,{data:re,body:J,xPos:ae,yPos:C,backgroundStyle:h?.tooltip,className:a?.tooltip}):null,M&&q!==void 0?t.jsxRuntimeExports.jsx(Ae.X,{open:q!==void 0,onClose:()=>{D(void 0)},children:t.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof M=="string"?{__html:Le.string2HTML(M,q)}:void 0,children:typeof M=="function"?M(q):null})}):null]})}function Y(W,x,j,R){const u=W.map(E=>E[x]).filter(E=>!he.checkIfNullOrUndefined(E)),d=he.checkIfNullOrUndefined(j)?Math.min(...u)>=0?0:Math.min(...u):j,o=he.checkIfNullOrUndefined(R)?Math.max(...u)<0?0:Math.max(...u):R;return{min:d,max:o}}function Fe(W){const{data:x,graphTitle:j,sources:R,graphDescription:u,height:d,width:o,footNote:E,padding:U,barColors:z=[Ee.Colors.light.categoricalColors.colors[0],Ee.Colors.light.categoricalColors.colors[1]],backgroundColor:B=!1,leftMargin:ne=20,rightMargin:oe=20,topMargin:_=25,bottomMargin:le=30,rightBarTitle:J="Right bar graph",leftBarTitle:O="Left bar graph",tooltip:xe,relativeHeight:I,onSeriesMouseOver:$,graphID:te,barPadding:G=.25,truncateBy:H=999,onSeriesMouseClick:ie,centerGap:M=100,showValues:h=!0,maxValue:a,minValue:A,refValues:m=[],suffix:P="",prefix:se="",showTicks:k=!0,showColorScale:N=!1,graphDownload:K=!1,dataDownload:Q=!1,language:b="en",colorLegendTitle:re,minHeight:v=0,theme:q="light",ariaLabel:D,resetSelectionOnDoubleClick:ae=!0,detailsOnClick:V,styles:C,classNames:p,noOfTicks:c=5,animate:L=!1,precision:w=2,customLayers:X=[],timeline:s={enabled:!1,autoplay:!1,showOnlyActiveDate:!0},naLabel:l="NA"}=W,[S,n]=y.useState(0),[Z,e]=y.useState(0),[r,f]=y.useState(s.autoplay),g=me.sort(Me.uniqBy(x.filter(i=>i.date!==void 0&&i.date!==null),i=>i.date).map(i=>fe.parse(`${i.date}`,s.dateFormat||"yyyy",new Date).getTime()),(i,F)=>Ie.ascending(i,F)),[ue,ce]=y.useState(s.autoplay?0:g.length-1),ee=y.useRef(null),ge=y.useRef(null);y.useEffect(()=>{const i=new ResizeObserver(F=>{n(o||F[0].target.clientWidth||620),e(d||F[0].target.clientHeight||480)});return ee.current&&(e(ee.current.clientHeight||480),n(ee.current.clientWidth||620),o||i.observe(ee.current)),()=>i.disconnect()},[o,d]),y.useEffect(()=>{const i=setInterval(()=>{ce(F=>F<g.length-1?F+1:0)},(s.speed||2)*1e3);return r||clearInterval(i),()=>clearInterval(i)},[g,r,s.speed]);const pe=me.getSliderMarks(g,ue,s.showOnlyActiveDate,s.dateFormat||"yyyy");return t.jsxRuntimeExports.jsx("div",{className:`${q||"light"} flex ${o?"w-fit grow-0":"w-full grow"}`,dir:b==="he"||b==="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 ${b||"en"}`,p?.graphContainer),style:{...C?.graphContainer||{},...B&&B!==!0?{backgroundColor:B}:{}},id:te,ref:ge,"aria-label":D||`${j?`The graph shows ${j}. `:""}This is a diverging bar chart. ${u?` ${u}`:""}`,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:[j||u||K||Q?t.jsxRuntimeExports.jsx(Ve.GraphHeader,{styles:{title:C?.title,description:C?.description},classNames:{title:p?.title,description:p?.description},graphTitle:j,graphDescription:u,width:o,graphDownload:K?ge.current:void 0,dataDownload:Q?x.map(i=>i.data).filter(i=>i!==void 0).length>0?x.map(i=>i.data).filter(i=>i!==void 0):x.filter(i=>i!==void 0):null}):null,s.enabled&&g.length>0&&pe?t.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[t.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{f(!r)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":r?"Click to pause animation":"Click to play animation",children:r?t.jsxRuntimeExports.jsx(Be.Pause,{}):t.jsxRuntimeExports.jsx(Be.Play,{})}),t.jsxRuntimeExports.jsx(me.xr,{min:g[0],max:g[g.length-1],marks:pe,step:null,defaultValue:g[g.length-1],value:g[ue],onChangeComplete:i=>{ce(g.indexOf(i))},onChange:i=>{ce(g.indexOf(i))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,t.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:x.length===0?t.jsxRuntimeExports.jsx(Te.EmptyState,{}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[N?t.jsxRuntimeExports.jsx(Se.ColorLegend,{colorLegendTitle:re,colorDomain:[O,J],colors:z,showNAColor:!1}):null,t.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:ee,"aria-label":"Graph area",children:(o||S)&&(d||Z)?t.jsxRuntimeExports.jsx(De,{data:Oe.ensureCompleteDataForButterFlyChart(x,s.dateFormat||"yyyy").filter(i=>s.enabled?i.date===fe.format(new Date(g[ue]),s.dateFormat||"yyyy"):i),barColors:z,width:o||S,centerGap:M,height:Math.max(v,d||(I?v?(o||S)*I>v?(o||S)*I:v:(o||S)*I:Z)),truncateBy:H,leftMargin:ne,rightMargin:oe,topMargin:_,bottomMargin:le,axisTitles:[O,J],tooltip:xe,onSeriesMouseOver:$,barPadding:G,refValues:m,maxValue:Math.max(Y(x,"leftBar",A,a).max,Y(x,"rightBar",A,a).max),minValue:Math.min(Y(x,"leftBar",A,a).min,Y(x,"rightBar",A,a).min),minValueLeftBar:Y(x,"leftBar",A,a).min,minValueRightBar:Y(x,"rightBar",A,a).min,showValues:h,onSeriesMouseClick:ie,showTicks:k,suffix:P,prefix:se,resetSelectionOnDoubleClick:ae,detailsOnClick:V,styles:C,classNames:p,noOfTicks:c,animate:L===!0?{duration:.5,once:!0,amount:.5}:L||{duration:0,once:!0,amount:0},precision:w,customLayers:X,naLabel:l}):null})]})}),R||E?t.jsxRuntimeExports.jsx(qe.GraphFooter,{styles:{footnote:C?.footnote,source:C?.source},classNames:{footnote:p?.footnote,source:p?.source},sources:R,footNote:E,width:o}):null]})})})})}exports.ButterflyChart=Fe;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-CHPV5EwG-DDoeWRVt.cjs"),y=require("react"),me=require("./getSliderMarks-CtsEXiLV.cjs"),fe=require("./parse-hMnG_lRV.cjs"),Me=require("./index-CZbIGs8q.cjs"),ye=require("./index-BXns0-ng.cjs"),Ae=require("./Modal-tXZlLE5s.cjs"),je=require("./numberFormattingFunction-02t-wJta.cjs"),Ce=require("./Tooltip-n8z5bfav.cjs"),Le=require("./string2HTML-D2Avudmb.cjs"),be=require("./XTicksAndGridLines-CCzXIV8d.cjs"),ve=require("./Axis-DE7dSn1_.cjs"),$e=require("./YAxesLabels-D8IydyZj.cjs"),we=require("./ReferenceLine-CFVBBN__.cjs"),ke=require("./band-CAApY4Pd.cjs"),Re=require("./linear-BVckp9RD.cjs"),Ne=require("./use-in-view-sQJZ_xDO.cjs"),T=require("./proxy-BHRoeZgd.cjs"),de=require("./index-BW8iNx7E.cjs"),qe=require("./GraphFooter.cjs"),Ve=require("./GraphHeader.cjs"),Se=require("./ColorLegend.cjs"),Ee=require("./Colors.cjs"),Te=require("./EmptyState-d8_8SxeW.cjs"),Be=require("./index-BW_-wD2k.cjs"),he=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),Oe=require("./ensureCompleteData-DqWQ2Zbi.cjs"),Ie=require("./init-DU0ybBc_.cjs");function De(W){const{data:x,width:j,height:R,barColors:u,centerGap:d,refValues:o,maxValue:E,minValue:U,showValues:z,axisTitles:B,rightMargin:ne,leftMargin:oe,topMargin:_,bottomMargin:le,tooltip:J,onSeriesMouseOver:O,barPadding:xe,truncateBy:I,onSeriesMouseClick:$,showTicks:te,suffix:G,prefix:H,resetSelectionOnDoubleClick:ie,detailsOnClick:M,styles:h,classNames:a,noOfTicks:A,animate:m,precision:P,customLayers:se,minValueLeftBar:k,minValueRightBar:N,naLabel:K}=W,Q=y.useRef(null),b=Ne.useInView(Q,{once:m.once,amount:m.amount}),[re,v]=y.useState(void 0),[q,D]=y.useState(void 0),[ae,V]=y.useState(void 0),[C,p]=y.useState(void 0),c={top:_,bottom:le,left:oe,right:ne},L=j-c.left-c.right,w=R-c.top-c.bottom,X=x.map((e,r)=>({...e,id:`${r}`})),s=ke.band().domain(X.map(e=>`${e.id}`)).range([w,0]).paddingInner(xe),l=Re.linear().domain([U,E]).range([0,(L-d)/2]).nice(),S=l.ticks(A),n=Re.linear().domain([U,E]).range([(L-d)/2,0]).nice(),Z=n.ticks(A);return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(T.motion.svg,{width:`${j}px`,height:`${R}px`,viewBox:`0 0 ${j} ${R}`,direction:"ltr",ref:Q,children:t.jsxRuntimeExports.jsxs("g",{transform:`translate(${c.left},${c.top})`,children:[se.filter(e=>e.position==="before").map(e=>e.layer),t.jsxRuntimeExports.jsxs("g",{transform:"translate(0,0)",children:[te?t.jsxRuntimeExports.jsx(be.XTicksAndGridLines,{values:Z.filter(e=>e!==0),x:Z.filter(e=>e!==0).map(e=>n(e)),y1:0-_,y2:w+c.bottom,styles:{gridLines:h?.xAxis?.gridLines,labels:h?.xAxis?.labels},classNames:{gridLines:a?.xAxis?.gridLines,labels:a?.xAxis?.labels},suffix:G,prefix:H,labelType:"secondary",showGridLines:!0,leftLabel:!0,precision:P}):null,t.jsxRuntimeExports.jsxs(de.AnimatePresence,{children:[X.map((e,r)=>t.jsxRuntimeExports.jsxs(T.motion.g,{className:"undp-viz-g-with-hover",opacity:.85,onMouseEnter:f=>{v(e),p(f.clientY),V(f.clientX),O?.(e)},onClick:()=>{($||M)&&(ye.isEqual(q,e)&&ie?(D(void 0),$?.(void 0)):(D(e),$?.(e)))},onMouseMove:f=>{v(e),p(f.clientY),V(f.clientX)},onMouseLeave:()=>{v(void 0),V(void 0),p(void 0),O?.(void 0)},children:[e.leftBar?t.jsxRuntimeExports.jsx(T.motion.rect,{y:s(`${r}`),style:{fill:u[0]},height:s.bandwidth(),variants:{initial:{x:n(0),width:0},whileInView:{x:e.leftBar<0?n(0):n(e.leftBar),width:e.leftBar<0?n(e.leftBar)-n(0):n(0)-n(e.leftBar),transition:{duration:m.duration}}},initial:"initial",animate:b?"whileInView":"initial",exit:{x:n(0),width:0,transition:{duration:m.duration}}}):null,z?t.jsxRuntimeExports.jsx(T.motion.text,{y:s(`${r}`)+s.bandwidth()/2,style:{fill:u[0],textAnchor:e.rightBar&&e.rightBar>0?"end":"start",...h?.graphObjectValues||{}},dx:e.rightBar&&e.rightBar>0?-5:5,dy:"0.33em",className:t.mo("graph-value text-sm",a?.graphObjectValues),exit:{opacity:0,transition:{duration:m.duration}},variants:{initial:{x:n(0),opacity:0},whileInView:{x:e.leftBar?n(e.leftBar):n(k<0?0:k),opacity:1,transition:{duration:m.duration}}},initial:"initial",animate:b?"whileInView":"initial",children:je.numberFormattingFunction(e.rightBar,K,P,H,G)}):null]},e.label)),t.jsxRuntimeExports.jsx(ve.Axis,{y1:-2.5,y2:w+c.bottom,x1:n(k<0?0:k),x2:n(k<0?0:k),classNames:{axis:a?.yAxis?.axis},styles:{axis:h?.yAxis?.axis}}),o?t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:o.map((e,r)=>t.jsxRuntimeExports.jsx(we.RefLineX,{text:e.text,color:e.color,x:n(e.value),y1:0-c.top,y2:w+c.bottom,textSide:"left",classNames:e.classNames,styles:e.styles,animate:m,isInView:b},r))}):null]})]}),t.jsxRuntimeExports.jsxs("g",{transform:`translate(${(L+d)/2},0)`,children:[te?t.jsxRuntimeExports.jsx(be.XTicksAndGridLines,{values:S.filter(e=>e!==0),x:S.filter(e=>e!==0).map(e=>l(e)),y1:0-_,y2:w+c.bottom,styles:{gridLines:h?.xAxis?.gridLines,labels:h?.xAxis?.labels},classNames:{gridLines:a?.xAxis?.gridLines,labels:a?.xAxis?.labels},suffix:G,prefix:H,labelType:"secondary",showGridLines:!0,precision:P}):null,t.jsxRuntimeExports.jsxs(de.AnimatePresence,{children:[X.map((e,r)=>t.jsxRuntimeExports.jsxs(T.motion.g,{className:"undp-viz-g-with-hover",opacity:.85,onMouseEnter:f=>{v(e),p(f.clientY),V(f.clientX),O?.(e)},onClick:()=>{($||M)&&(ye.isEqual(q,e)&&ie?(D(void 0),$?.(void 0)):(D(e),$?.(e)))},onMouseMove:f=>{v(e),p(f.clientY),V(f.clientX)},onMouseLeave:()=>{v(void 0),V(void 0),p(void 0),O?.(void 0)},children:[e.rightBar?t.jsxRuntimeExports.jsx(T.motion.rect,{y:s(`${r}`),style:{fill:u[1]},height:s.bandwidth(),exit:{x:l(0),width:0,transition:{duration:m.duration}},variants:{initial:{x:l(0),width:0},whileInView:{x:e.rightBar>=0?l(0):l(e.rightBar),width:e.rightBar>=0?l(e.rightBar)-l(0):l(0)-l(e.rightBar),transition:{duration:m.duration}}},initial:"initial",animate:b?"whileInView":"initial"}):null,z?t.jsxRuntimeExports.jsx(T.motion.text,{y:s(`${r}`)+s.bandwidth()/2,style:{fill:u[1],textAnchor:e.rightBar&&e.rightBar<0?"end":"start",...h?.graphObjectValues||{}},className:t.mo("graph-value text-sm",a?.graphObjectValues),dx:e.rightBar&&e.rightBar<0?-5:5,dy:"0.33em",exit:{opacity:0,transition:{duration:m.duration}},variants:{initial:{x:l(0),opacity:0},whileInView:{x:e.rightBar?l(e.rightBar):l(N<0?0:N),opacity:1,transition:{duration:m.duration}}},initial:"initial",animate:b?"whileInView":"initial",children:je.numberFormattingFunction(e.rightBar,K,P,H,G)}):null]},r)),t.jsxRuntimeExports.jsx(ve.Axis,{y1:-2.5,y2:w+c.bottom,x1:l(N<0?0:N),x2:l(N<0?0:N),classNames:{axis:a?.yAxis?.axis},styles:{axis:h?.yAxis?.axis}}),o?t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:o.map((e,r)=>t.jsxRuntimeExports.jsx(we.RefLineX,{text:e.text,color:e.color,x:l(e.value),y1:0-c.top,y2:w+c.bottom,textSide:"right",classNames:e.classNames,styles:e.styles,animate:m,isInView:b},r))}):null]})]}),t.jsxRuntimeExports.jsx(de.AnimatePresence,{children:t.jsxRuntimeExports.jsx(T.motion.g,{transform:`translate(${L/2},0)`,children:X.map((e,r)=>t.jsxRuntimeExports.jsx($e.YAxesLabels,{value:`${e.label}`.length<I?`${e.label}`:`${`${e.label}`.substring(0,I)}...`,y:s(`${e.id}`),x:0-d/2,width:d,height:s.bandwidth(),alignment:"center",style:h?.yAxis?.labels,className:a?.yAxis?.labels,animate:m,isInView:b},r))})}),t.jsxRuntimeExports.jsxs("g",{transform:`translate(0,${w})`,children:[t.jsxRuntimeExports.jsx("text",{style:{fill:u[0],textAnchor:"end",...h?.yAxis?.title},className:t.mo("text-base",a?.yAxis?.title),x:L/2-d/2,y:0,dx:-5,dy:20,children:B[0]}),t.jsxRuntimeExports.jsx("text",{style:{fill:u[1],textAnchor:"start",...h?.yAxis?.title},className:t.mo("text-base",a?.yAxis?.title),x:L/2+d/2,y:0,dx:5,dy:20,children:B[1]})]}),se.filter(e=>e.position==="after").map(e=>e.layer)]})}),re&&J&&ae&&C?t.jsxRuntimeExports.jsx(Ce.Tooltip,{data:re,body:J,xPos:ae,yPos:C,backgroundStyle:h?.tooltip,className:a?.tooltip}):null,M&&q!==void 0?t.jsxRuntimeExports.jsx(Ae.X,{open:q!==void 0,onClose:()=>{D(void 0)},children:t.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof M=="string"?{__html:Le.string2HTML(M,q)}:void 0,children:typeof M=="function"?M(q):null})}):null]})}function Y(W,x,j,R){const u=W.map(E=>E[x]).filter(E=>!he.checkIfNullOrUndefined(E)),d=he.checkIfNullOrUndefined(j)?Math.min(...u)>=0?0:Math.min(...u):j,o=he.checkIfNullOrUndefined(R)?Math.max(...u)<0?0:Math.max(...u):R;return{min:d,max:o}}function Fe(W){const{data:x,graphTitle:j,sources:R,graphDescription:u,height:d,width:o,footNote:E,padding:U,barColors:z=[Ee.Colors.light.categoricalColors.colors[0],Ee.Colors.light.categoricalColors.colors[1]],backgroundColor:B=!1,leftMargin:ne=20,rightMargin:oe=20,topMargin:_=25,bottomMargin:le=30,rightBarTitle:J="Right bar graph",leftBarTitle:O="Left bar graph",tooltip:xe,relativeHeight:I,onSeriesMouseOver:$,graphID:te,barPadding:G=.25,truncateBy:H=999,onSeriesMouseClick:ie,centerGap:M=100,showValues:h=!0,maxValue:a,minValue:A,refValues:m=[],suffix:P="",prefix:se="",showTicks:k=!0,showColorScale:N=!1,graphDownload:K=!1,dataDownload:Q=!1,language:b="en",colorLegendTitle:re,minHeight:v=0,theme:q="light",ariaLabel:D,resetSelectionOnDoubleClick:ae=!0,detailsOnClick:V,styles:C,classNames:p,noOfTicks:c=5,animate:L=!1,precision:w=2,customLayers:X=[],timeline:s={enabled:!1,autoplay:!1,showOnlyActiveDate:!0},naLabel:l="NA"}=W,[S,n]=y.useState(0),[Z,e]=y.useState(0),[r,f]=y.useState(s.autoplay),g=me.sort(Me.uniqBy(x.filter(i=>i.date!==void 0&&i.date!==null),i=>i.date).map(i=>fe.parse(`${i.date}`,s.dateFormat||"yyyy",new Date).getTime()),(i,F)=>Ie.ascending(i,F)),[ue,ce]=y.useState(s.autoplay?0:g.length-1),ee=y.useRef(null),ge=y.useRef(null);y.useEffect(()=>{const i=new ResizeObserver(F=>{n(o||F[0].target.clientWidth||620),e(d||F[0].target.clientHeight||480)});return ee.current&&(e(ee.current.clientHeight||480),n(ee.current.clientWidth||620),o||i.observe(ee.current)),()=>i.disconnect()},[o,d]),y.useEffect(()=>{const i=setInterval(()=>{ce(F=>F<g.length-1?F+1:0)},(s.speed||2)*1e3);return r||clearInterval(i),()=>clearInterval(i)},[g,r,s.speed]);const pe=me.getSliderMarks(g,ue,s.showOnlyActiveDate,s.dateFormat||"yyyy");return t.jsxRuntimeExports.jsx("div",{className:`${q||"light"} flex ${o?"w-fit grow-0":"w-full grow"}`,dir:b==="he"||b==="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 ${b||"en"}`,p?.graphContainer),style:{...C?.graphContainer||{},...B&&B!==!0?{backgroundColor:B}:{}},id:te,ref:ge,"aria-label":D||`${j?`The graph shows ${j}. `:""}This is a diverging bar chart. ${u?` ${u}`:""}`,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:[j||u||K||Q?t.jsxRuntimeExports.jsx(Ve.GraphHeader,{styles:{title:C?.title,description:C?.description},classNames:{title:p?.title,description:p?.description},graphTitle:j,graphDescription:u,width:o,graphDownload:K?ge.current:void 0,dataDownload:Q?x.map(i=>i.data).filter(i=>i!==void 0).length>0?x.map(i=>i.data).filter(i=>i!==void 0):x.filter(i=>i!==void 0):null}):null,s.enabled&&g.length>0&&pe?t.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[t.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{f(!r)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":r?"Click to pause animation":"Click to play animation",children:r?t.jsxRuntimeExports.jsx(Be.Pause,{}):t.jsxRuntimeExports.jsx(Be.Play,{})}),t.jsxRuntimeExports.jsx(me.xr,{min:g[0],max:g[g.length-1],marks:pe,step:null,defaultValue:g[g.length-1],value:g[ue],onChangeComplete:i=>{ce(g.indexOf(i))},onChange:i=>{ce(g.indexOf(i))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,t.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:x.length===0?t.jsxRuntimeExports.jsx(Te.EmptyState,{}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[N?t.jsxRuntimeExports.jsx(Se.ColorLegend,{colorLegendTitle:re,colorDomain:[O,J],colors:z,showNAColor:!1}):null,t.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:ee,"aria-label":"Graph area",children:(o||S)&&(d||Z)?t.jsxRuntimeExports.jsx(De,{data:Oe.ensureCompleteDataForButterFlyChart(x,s.dateFormat||"yyyy").filter(i=>s.enabled?i.date===fe.format(new Date(g[ue]),s.dateFormat||"yyyy"):i),barColors:z,width:o||S,centerGap:M,height:Math.max(v,d||(I?v?(o||S)*I>v?(o||S)*I:v:(o||S)*I:Z)),truncateBy:H,leftMargin:ne,rightMargin:oe,topMargin:_,bottomMargin:le,axisTitles:[O,J],tooltip:xe,onSeriesMouseOver:$,barPadding:G,refValues:m,maxValue:Math.max(Y(x,"leftBar",A,a).max,Y(x,"rightBar",A,a).max),minValue:Math.min(Y(x,"leftBar",A,a).min,Y(x,"rightBar",A,a).min),minValueLeftBar:Y(x,"leftBar",A,a).min,minValueRightBar:Y(x,"rightBar",A,a).min,showValues:h,onSeriesMouseClick:ie,showTicks:k,suffix:P,prefix:se,resetSelectionOnDoubleClick:ae,detailsOnClick:V,styles:C,classNames:p,noOfTicks:c,animate:L===!0?{duration:.5,once:!0,amount:.5}:L||{duration:0,once:!0,amount:0},precision:w,customLayers:X,naLabel:l}):null})]})}),R||E?t.jsxRuntimeExports.jsx(qe.GraphFooter,{styles:{footnote:C?.footnote,source:C?.source},classNames:{footnote:p?.footnote,source:p?.source},sources:R,footNote:E,width:o}):null]})})})})}exports.ButterflyChart=Fe;
|
|
2
2
|
//# sourceMappingURL=ButterflyChart.cjs.map
|
package/dist/ButterflyChart.js
CHANGED
|
@@ -4,19 +4,19 @@ import { s as Nt, g as At, x as Ct } from "./getSliderMarks-C0jptXeP.js";
|
|
|
4
4
|
import { p as kt, f as Lt } from "./parse-DlCRUFh_.js";
|
|
5
5
|
import { u as Vt } from "./index-CaAIPGZo.js";
|
|
6
6
|
import { i as vt } from "./index-27yTRcko.js";
|
|
7
|
-
import { X as Tt } from "./Modal-
|
|
7
|
+
import { X as Tt } from "./Modal-DVVwpKhP.js";
|
|
8
8
|
import { n as bt } from "./numberFormattingFunction-14YCbkN2.js";
|
|
9
9
|
import { T as Ot } from "./Tooltip-DyM5snqx.js";
|
|
10
10
|
import { s as Dt } from "./string2HTML-CWHGfz_d.js";
|
|
11
11
|
import { X as wt } from "./XTicksAndGridLines-Bn9u5gOM.js";
|
|
12
12
|
import { A as jt } from "./Axis-Ddg-seDi.js";
|
|
13
|
-
import { Y as It } from "./YAxesLabels-
|
|
14
|
-
import { a as Bt } from "./ReferenceLine-
|
|
15
|
-
import {
|
|
16
|
-
import { b as Ft } from "./band-BEjh2CHI.js";
|
|
13
|
+
import { Y as It } from "./YAxesLabels-CPGZjmZJ.js";
|
|
14
|
+
import { a as Bt } from "./ReferenceLine-CfAW3vKJ.js";
|
|
15
|
+
import { b as St } from "./band-BEjh2CHI.js";
|
|
17
16
|
import { a as Mt } from "./linear-DUdu7l2G.js";
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
17
|
+
import { u as Ft } from "./use-in-view-yS6jzJAp.js";
|
|
18
|
+
import { m as I } from "./proxy-CkpFesk1.js";
|
|
19
|
+
import { A as xt } from "./index-CNvov0eg.js";
|
|
20
20
|
import { GraphFooter as Ht } from "./GraphFooter.js";
|
|
21
21
|
import { GraphHeader as Pt } from "./GraphHeader.js";
|
|
22
22
|
import { ColorLegend as Rt } from "./ColorLegend.js";
|
|
@@ -61,7 +61,7 @@ function zt(z) {
|
|
|
61
61
|
minValueLeftBar: L,
|
|
62
62
|
minValueRightBar: V,
|
|
63
63
|
naLabel: K
|
|
64
|
-
} = z, Q = gt(null), v =
|
|
64
|
+
} = z, Q = gt(null), v = Ft(Q, {
|
|
65
65
|
once: d.once,
|
|
66
66
|
amount: d.amount
|
|
67
67
|
}), [st, b] = S(void 0), [T, P] = S(void 0), [lt, O] = S(void 0), [A, f] = S(void 0), h = {
|
|
@@ -69,7 +69,7 @@ function zt(z) {
|
|
|
69
69
|
bottom: ct,
|
|
70
70
|
left: ot,
|
|
71
71
|
right: nt
|
|
72
|
-
}, C = y - h.left - h.right, w = j - h.top - h.bottom, Y = c.map((t, r) => ({ ...t, id: `${r}` })), a =
|
|
72
|
+
}, C = y - h.left - h.right, w = j - h.top - h.bottom, Y = c.map((t, r) => ({ ...t, id: `${r}` })), a = St().domain(Y.map((t) => `${t.id}`)).range([w, 0]).paddingInner(mt), o = Mt().domain([q, B]).range([0, (C - x) / 2]).nice(), D = o.ticks(N), l = Mt().domain([q, B]).range([(C - x) / 2, 0]).nice(), Z = l.ticks(N);
|
|
73
73
|
return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
74
74
|
/* @__PURE__ */ e.jsx(
|
|
75
75
|
I.svg,
|