@undp/data-viz 1.5.7 → 1.5.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (342) hide show
  1. package/dist/AreaChart.cjs +1 -1
  2. package/dist/AreaChart.js +13 -13
  3. package/dist/{Axis-Ddg-seDi.js → Axis-4gUOL8B7.js} +2 -2
  4. package/dist/{Axis-Ddg-seDi.js.map → Axis-4gUOL8B7.js.map} +1 -1
  5. package/dist/{Axis-DE7dSn1_.cjs → Axis-CkNn1wit.cjs} +2 -2
  6. package/dist/{Axis-DE7dSn1_.cjs.map → Axis-CkNn1wit.cjs.map} +1 -1
  7. package/dist/{AxisTitle-CK9YeovX.cjs → AxisTitle-Wkz-xeQL.cjs} +2 -2
  8. package/dist/{AxisTitle-CK9YeovX.cjs.map → AxisTitle-Wkz-xeQL.cjs.map} +1 -1
  9. package/dist/{AxisTitle-BmHLMRJZ.js → AxisTitle-v6_xcXZ-.js} +2 -2
  10. package/dist/{AxisTitle-BmHLMRJZ.js.map → AxisTitle-v6_xcXZ-.js.map} +1 -1
  11. package/dist/BarGraph.cjs +1 -1
  12. package/dist/BarGraph.cjs.map +1 -1
  13. package/dist/BarGraph.js +666 -664
  14. package/dist/BarGraph.js.map +1 -1
  15. package/dist/BasicStatCard.cjs +1 -1
  16. package/dist/BasicStatCard.js +2 -2
  17. package/dist/BeeSwarmChart.cjs +1 -1
  18. package/dist/BeeSwarmChart.js +42 -42
  19. package/dist/BiVariateChoroplethMap.cjs +1 -1
  20. package/dist/BiVariateChoroplethMap.cjs.map +1 -1
  21. package/dist/BiVariateChoroplethMap.d.ts +2 -0
  22. package/dist/BiVariateChoroplethMap.js +257 -264
  23. package/dist/BiVariateChoroplethMap.js.map +1 -1
  24. package/dist/BulletChart.cjs +1 -1
  25. package/dist/BulletChart.cjs.map +1 -1
  26. package/dist/BulletChart.js +223 -221
  27. package/dist/BulletChart.js.map +1 -1
  28. package/dist/ButterflyChart.cjs +1 -1
  29. package/dist/ButterflyChart.cjs.map +1 -1
  30. package/dist/ButterflyChart.js +84 -82
  31. package/dist/ButterflyChart.js.map +1 -1
  32. package/dist/ChoroplethMap.cjs +1 -1
  33. package/dist/ChoroplethMap.cjs.map +1 -1
  34. package/dist/ChoroplethMap.d.ts +2 -0
  35. package/dist/ChoroplethMap.js +296 -304
  36. package/dist/ChoroplethMap.js.map +1 -1
  37. package/dist/CirclePackingGraph.cjs +1 -1
  38. package/dist/CirclePackingGraph.js +3 -3
  39. package/dist/ColorLegend.cjs +1 -1
  40. package/dist/ColorLegend.js +2 -2
  41. package/dist/ColorLegendWithMouseOver.cjs +1 -1
  42. package/dist/ColorLegendWithMouseOver.js +2 -2
  43. package/dist/CopyTextButton.cjs +4 -4
  44. package/dist/CopyTextButton.cjs.map +1 -1
  45. package/dist/CopyTextButton.js +27 -27
  46. package/dist/CopyTextButton.js.map +1 -1
  47. package/dist/CsvDownloadButton.cjs +1 -1
  48. package/dist/CsvDownloadButton.js +2 -2
  49. package/dist/DataCards.cjs +3 -3
  50. package/dist/DataCards.cjs.map +1 -1
  51. package/dist/DataCards.js +16 -16
  52. package/dist/DataCards.js.map +1 -1
  53. package/dist/DataTable.cjs +1 -1
  54. package/dist/DataTable.js +3 -3
  55. package/dist/DifferenceLineChart.cjs +1 -1
  56. package/dist/DifferenceLineChart.cjs.map +1 -1
  57. package/dist/DifferenceLineChart.js +133 -131
  58. package/dist/DifferenceLineChart.js.map +1 -1
  59. package/dist/DonutChart.cjs +1 -1
  60. package/dist/DonutChart.js +20 -20
  61. package/dist/DotDensityMap.cjs +1 -1
  62. package/dist/DotDensityMap.cjs.map +1 -1
  63. package/dist/DotDensityMap.d.ts +2 -0
  64. package/dist/DotDensityMap.js +282 -289
  65. package/dist/DotDensityMap.js.map +1 -1
  66. package/dist/{DropdownSelect-CtOKZHD0.js → DropdownSelect-6kjXM6oW.js} +2 -2
  67. package/dist/DropdownSelect-6kjXM6oW.js.map +1 -0
  68. package/dist/{DropdownSelect-DBDM64B5.cjs → DropdownSelect-vt8yiB-g.cjs} +5 -5
  69. package/dist/DropdownSelect-vt8yiB-g.cjs.map +1 -0
  70. package/dist/DualAxisLineChart.cjs +1 -1
  71. package/dist/DualAxisLineChart.cjs.map +1 -1
  72. package/dist/DualAxisLineChart.js +141 -121
  73. package/dist/DualAxisLineChart.js.map +1 -1
  74. package/dist/DumbbellChart.cjs +1 -1
  75. package/dist/DumbbellChart.cjs.map +1 -1
  76. package/dist/DumbbellChart.js +307 -307
  77. package/dist/DumbbellChart.js.map +1 -1
  78. package/dist/{EmptyState-DdTp-Mdn.js → EmptyState-36lXXyui.js} +4 -4
  79. package/dist/{EmptyState-DdTp-Mdn.js.map → EmptyState-36lXXyui.js.map} +1 -1
  80. package/dist/{EmptyState-d8_8SxeW.cjs → EmptyState-B8IpKGcL.cjs} +2 -2
  81. package/dist/{EmptyState-d8_8SxeW.cjs.map → EmptyState-B8IpKGcL.cjs.map} +1 -1
  82. package/dist/ExcelDownloadButton.cjs +1 -1
  83. package/dist/ExcelDownloadButton.js +2 -2
  84. package/dist/FootNote.cjs +1 -1
  85. package/dist/FootNote.js +2 -2
  86. package/dist/GeoHubCompareMaps.cjs +1 -1
  87. package/dist/GeoHubCompareMaps.cjs.map +1 -1
  88. package/dist/GeoHubCompareMaps.js +65 -80
  89. package/dist/GeoHubCompareMaps.js.map +1 -1
  90. package/dist/GeoHubMap.cjs +1 -1
  91. package/dist/GeoHubMap.cjs.map +1 -1
  92. package/dist/GeoHubMap.js +95 -125
  93. package/dist/GeoHubMap.js.map +1 -1
  94. package/dist/GeoHubMapWithLayerSelection.cjs +1 -1
  95. package/dist/GeoHubMapWithLayerSelection.cjs.map +1 -1
  96. package/dist/GeoHubMapWithLayerSelection.js +73 -88
  97. package/dist/GeoHubMapWithLayerSelection.js.map +1 -1
  98. package/dist/GraphDescription.cjs +1 -1
  99. package/dist/GraphDescription.js +2 -2
  100. package/dist/{GraphEl-CqWzvOyr.js → GraphEl-2IiUDxjR.js} +15 -12
  101. package/dist/GraphEl-2IiUDxjR.js.map +1 -0
  102. package/dist/GraphEl-qrlfGPe3.cjs +2 -0
  103. package/dist/GraphEl-qrlfGPe3.cjs.map +1 -0
  104. package/dist/GraphFooter.cjs +1 -1
  105. package/dist/GraphFooter.js +1 -1
  106. package/dist/GraphHeader.cjs +1 -1
  107. package/dist/GraphHeader.js +1 -1
  108. package/dist/GraphTitle.cjs +1 -1
  109. package/dist/GraphTitle.js +2 -2
  110. package/dist/GriddedGraphs.cjs +1 -1
  111. package/dist/GriddedGraphs.d.ts +1 -0
  112. package/dist/GriddedGraphs.js +5 -5
  113. package/dist/GriddedGraphsFromConfig.cjs +1 -1
  114. package/dist/GriddedGraphsFromConfig.d.ts +1 -0
  115. package/dist/GriddedGraphsFromConfig.js +2 -2
  116. package/dist/HeatMap.cjs +1 -1
  117. package/dist/HeatMap.js +19 -19
  118. package/dist/Histogram.cjs +1 -1
  119. package/dist/Histogram.js +3 -3
  120. package/dist/ImageDownloadButton.cjs +1 -1
  121. package/dist/ImageDownloadButton.js +2 -2
  122. package/dist/LineChartWithConfidenceInterval.cjs +1 -1
  123. package/dist/LineChartWithConfidenceInterval.cjs.map +1 -1
  124. package/dist/LineChartWithConfidenceInterval.js +204 -184
  125. package/dist/LineChartWithConfidenceInterval.js.map +1 -1
  126. package/dist/LinearColorLegend.cjs +1 -1
  127. package/dist/LinearColorLegend.js +2 -2
  128. package/dist/{Modal-DVVwpKhP.js → Modal-Cg8daIlV.js} +198 -187
  129. package/dist/Modal-Cg8daIlV.js.map +1 -0
  130. package/dist/Modal-CuuJdWkD.cjs +46 -0
  131. package/dist/Modal-CuuJdWkD.cjs.map +1 -0
  132. package/dist/MultiGraphDashboard.cjs +1 -1
  133. package/dist/MultiGraphDashboard.d.ts +1 -0
  134. package/dist/MultiGraphDashboard.js +3 -3
  135. package/dist/MultiGraphDashboardFromConfig.cjs +1 -1
  136. package/dist/MultiGraphDashboardFromConfig.d.ts +1 -0
  137. package/dist/MultiGraphDashboardFromConfig.js +2 -2
  138. package/dist/MultiGraphDashboardWideToLongFormat.cjs +1 -1
  139. package/dist/MultiGraphDashboardWideToLongFormat.js +4 -4
  140. package/dist/MultiGraphDashboardWideToLongFormatFromConfig.cjs +1 -1
  141. package/dist/MultiGraphDashboardWideToLongFormatFromConfig.js +2 -2
  142. package/dist/MultiLineAltChart.cjs +1 -1
  143. package/dist/MultiLineAltChart.cjs.map +1 -1
  144. package/dist/MultiLineAltChart.js +172 -173
  145. package/dist/MultiLineAltChart.js.map +1 -1
  146. package/dist/MultiLineChart.cjs +1 -1
  147. package/dist/MultiLineChart.cjs.map +1 -1
  148. package/dist/MultiLineChart.js +89 -78
  149. package/dist/MultiLineChart.js.map +1 -1
  150. package/dist/ParetoChart.cjs +1 -1
  151. package/dist/ParetoChart.cjs.map +1 -1
  152. package/dist/ParetoChart.js +186 -181
  153. package/dist/ParetoChart.js.map +1 -1
  154. package/dist/PerformanceIntensiveMultiGraphDashboard.cjs +1 -1
  155. package/dist/PerformanceIntensiveMultiGraphDashboard.d.ts +1 -0
  156. package/dist/PerformanceIntensiveMultiGraphDashboard.js +3 -3
  157. package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.cjs +1 -1
  158. package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.d.ts +1 -0
  159. package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.js +2 -2
  160. package/dist/PerformanceIntensiveScrollStory.cjs +1 -1
  161. package/dist/PerformanceIntensiveScrollStory.d.ts +1 -0
  162. package/dist/PerformanceIntensiveScrollStory.js +3 -3
  163. package/dist/RadarChart.cjs +1 -1
  164. package/dist/RadarChart.cjs.map +1 -1
  165. package/dist/RadarChart.js +256 -244
  166. package/dist/RadarChart.js.map +1 -1
  167. package/dist/{ReferenceLine-CfAW3vKJ.js → ReferenceLine-CPMaAX0r.js} +3 -3
  168. package/dist/{ReferenceLine-CfAW3vKJ.js.map → ReferenceLine-CPMaAX0r.js.map} +1 -1
  169. package/dist/{ReferenceLine-CFVBBN__.cjs → ReferenceLine-D04j-zeV.cjs} +2 -2
  170. package/dist/{ReferenceLine-CFVBBN__.cjs.map → ReferenceLine-D04j-zeV.cjs.map} +1 -1
  171. package/dist/{RegressionLine-mH7UKOPi.js → RegressionLine-CW7iViH2.js} +13 -12
  172. package/dist/RegressionLine-CW7iViH2.js.map +1 -0
  173. package/dist/RegressionLine-D-49RaHa.cjs +2 -0
  174. package/dist/RegressionLine-D-49RaHa.cjs.map +1 -0
  175. package/dist/SVGDownloadButton.cjs +1 -1
  176. package/dist/SVGDownloadButton.js +2 -2
  177. package/dist/SankeyChart.cjs +1 -1
  178. package/dist/SankeyChart.js +27 -27
  179. package/dist/ScatterPlot.cjs +1 -1
  180. package/dist/ScatterPlot.cjs.map +1 -1
  181. package/dist/ScatterPlot.js +145 -144
  182. package/dist/ScatterPlot.js.map +1 -1
  183. package/dist/ScrollStory.cjs +1 -1
  184. package/dist/ScrollStory.d.ts +1 -0
  185. package/dist/ScrollStory.js +3 -3
  186. package/dist/SimpleLineChart.cjs +1 -1
  187. package/dist/SimpleLineChart.cjs.map +1 -1
  188. package/dist/SimpleLineChart.js +53 -48
  189. package/dist/SimpleLineChart.js.map +1 -1
  190. package/dist/SingleGraphDashboard.cjs +1 -1
  191. package/dist/SingleGraphDashboard.d.ts +1 -0
  192. package/dist/SingleGraphDashboard.js +6 -6
  193. package/dist/SingleGraphDashboardFromConfig.cjs +1 -1
  194. package/dist/SingleGraphDashboardFromConfig.d.ts +1 -0
  195. package/dist/SingleGraphDashboardFromConfig.js +2 -2
  196. package/dist/SingleGraphDashboardGeoHubMaps.cjs +1 -1
  197. package/dist/SingleGraphDashboardGeoHubMaps.d.ts +1 -0
  198. package/dist/SingleGraphDashboardGeoHubMaps.js +2 -2
  199. package/dist/SingleGraphDashboardGeoHubMapsFromConfig.cjs +1 -1
  200. package/dist/SingleGraphDashboardGeoHubMapsFromConfig.d.ts +1 -0
  201. package/dist/SingleGraphDashboardGeoHubMapsFromConfig.js +2 -2
  202. package/dist/SingleGraphDashboardThreeDGraphs.cjs +1 -1
  203. package/dist/SingleGraphDashboardThreeDGraphs.cjs.map +1 -1
  204. package/dist/SingleGraphDashboardThreeDGraphs.d.ts +1 -0
  205. package/dist/SingleGraphDashboardThreeDGraphs.js +14 -13
  206. package/dist/SingleGraphDashboardThreeDGraphs.js.map +1 -1
  207. package/dist/SingleGraphDashboardThreeDGraphsFromConfig.cjs +1 -1
  208. package/dist/SingleGraphDashboardThreeDGraphsFromConfig.d.ts +1 -0
  209. package/dist/SingleGraphDashboardThreeDGraphsFromConfig.js +2 -2
  210. package/dist/SlopeChart.cjs +1 -1
  211. package/dist/SlopeChart.cjs.map +1 -1
  212. package/dist/SlopeChart.js +137 -133
  213. package/dist/SlopeChart.js.map +1 -1
  214. package/dist/Source.cjs +1 -1
  215. package/dist/Source.js +2 -2
  216. package/dist/SparkLine.cjs +1 -1
  217. package/dist/SparkLine.js +2 -2
  218. package/dist/{Spinner-C85UF28E.js → Spinner-Bpz70q_g.js} +2 -2
  219. package/dist/{Spinner-C85UF28E.js.map → Spinner-Bpz70q_g.js.map} +1 -1
  220. package/dist/{Spinner-DA6Z5E4n.cjs → Spinner-C6wLp85s.cjs} +2 -2
  221. package/dist/{Spinner-DA6Z5E4n.cjs.map → Spinner-C6wLp85s.cjs.map} +1 -1
  222. package/dist/StatCardFromData.cjs +1 -1
  223. package/dist/StatCardFromData.js +2 -2
  224. package/dist/StripChart.cjs +1 -1
  225. package/dist/StripChart.cjs.map +1 -1
  226. package/dist/StripChart.js +307 -295
  227. package/dist/StripChart.js.map +1 -1
  228. package/dist/ThreeDGlobe.cjs +1 -1
  229. package/dist/ThreeDGlobe.cjs.map +1 -1
  230. package/dist/ThreeDGlobe.d.ts +2 -0
  231. package/dist/ThreeDGlobe.js +220 -228
  232. package/dist/ThreeDGlobe.js.map +1 -1
  233. package/dist/ThresholdColorLegendWithMouseOver.cjs +1 -1
  234. package/dist/ThresholdColorLegendWithMouseOver.js +2 -2
  235. package/dist/{Tooltip-CVCGWyzw.js → Tooltip-6LIdPQGC.js} +2 -2
  236. package/dist/{Tooltip-CVCGWyzw.js.map → Tooltip-6LIdPQGC.js.map} +1 -1
  237. package/dist/{Tooltip-De16GWhY.cjs → Tooltip-Cpv0QohJ.cjs} +2 -2
  238. package/dist/{Tooltip-De16GWhY.cjs.map → Tooltip-Cpv0QohJ.cjs.map} +1 -1
  239. package/dist/TreeMapGraph.cjs +1 -1
  240. package/dist/TreeMapGraph.js +24 -24
  241. package/dist/Types.d.ts +1 -0
  242. package/dist/{Typography-k-kOjICQ.cjs → Typography-BDULiwlF.cjs} +2 -2
  243. package/dist/{Typography-k-kOjICQ.cjs.map → Typography-BDULiwlF.cjs.map} +1 -1
  244. package/dist/{Typography-Ctgfl1J5.js → Typography-LmZ9LEpe.js} +2 -2
  245. package/dist/{Typography-Ctgfl1J5.js.map → Typography-LmZ9LEpe.js.map} +1 -1
  246. package/dist/UnitChart.cjs +1 -1
  247. package/dist/UnitChart.cjs.map +1 -1
  248. package/dist/UnitChart.js +25 -26
  249. package/dist/UnitChart.js.map +1 -1
  250. package/dist/{XAxesLabels-Drf7M3YK.cjs → XAxesLabels-CLZnBgSr.cjs} +2 -2
  251. package/dist/{XAxesLabels-Drf7M3YK.cjs.map → XAxesLabels-CLZnBgSr.cjs.map} +1 -1
  252. package/dist/{XAxesLabels-loO78vUO.js → XAxesLabels-SOSmso5J.js} +3 -3
  253. package/dist/{XAxesLabels-loO78vUO.js.map → XAxesLabels-SOSmso5J.js.map} +1 -1
  254. package/dist/{XTicksAndGridLines-Bn9u5gOM.js → XTicksAndGridLines-DuydSnZ_.js} +2 -2
  255. package/dist/{XTicksAndGridLines-Bn9u5gOM.js.map → XTicksAndGridLines-DuydSnZ_.js.map} +1 -1
  256. package/dist/{XTicksAndGridLines-CCzXIV8d.cjs → XTicksAndGridLines-RKy7BVCO.cjs} +2 -2
  257. package/dist/{XTicksAndGridLines-CCzXIV8d.cjs.map → XTicksAndGridLines-RKy7BVCO.cjs.map} +1 -1
  258. package/dist/{YAxesLabels-DECkMgq8.js → YAxesLabels-DlDyLvhi.js} +3 -3
  259. package/dist/{YAxesLabels-DECkMgq8.js.map → YAxesLabels-DlDyLvhi.js.map} +1 -1
  260. package/dist/{YAxesLabels-yRFFdx1s.cjs → YAxesLabels-Dqd259-t.cjs} +2 -2
  261. package/dist/{YAxesLabels-yRFFdx1s.cjs.map → YAxesLabels-Dqd259-t.cjs.map} +1 -1
  262. package/dist/{YTicksAndGridLines-B6ah7CRf.js → YTicksAndGridLines-7t4MKtGw.js} +2 -2
  263. package/dist/{YTicksAndGridLines-B6ah7CRf.js.map → YTicksAndGridLines-7t4MKtGw.js.map} +1 -1
  264. package/dist/{YTicksAndGridLines-DBDuz6vb.cjs → YTicksAndGridLines-qGpRo_t1.cjs} +2 -2
  265. package/dist/{YTicksAndGridLines-DBDuz6vb.cjs.map → YTicksAndGridLines-qGpRo_t1.cjs.map} +1 -1
  266. package/dist/checkIfMultiple-Dko_cBvE.cjs +12 -0
  267. package/dist/checkIfMultiple-Dko_cBvE.cjs.map +1 -0
  268. package/dist/{checkIfMultiple-ChTJk2Tk.js → checkIfMultiple-u2SmbiCf.js} +11 -11
  269. package/dist/checkIfMultiple-u2SmbiCf.js.map +1 -0
  270. package/dist/{customArea-CK768gCn.cjs → customArea-1G1S78s_.cjs} +2 -2
  271. package/dist/{customArea-CK768gCn.cjs.map → customArea-1G1S78s_.cjs.map} +1 -1
  272. package/dist/{customArea-B-dWU0zZ.js → customArea-x4L4xwLl.js} +3 -3
  273. package/dist/{customArea-B-dWU0zZ.js.map → customArea-x4L4xwLl.js.map} +1 -1
  274. package/dist/getCentroidCoordinates-Dfk6IqEG.js.map +1 -1
  275. package/dist/getCentroidCoordinates-DxTBqzp2.cjs.map +1 -1
  276. package/dist/getSliderMarks-CUxPy36E.cjs +6 -0
  277. package/dist/getSliderMarks-CUxPy36E.cjs.map +1 -0
  278. package/dist/{getSliderMarks-9cNoRkDx.js → getSliderMarks-_pYOWEtO.js} +3 -3
  279. package/dist/getSliderMarks-_pYOWEtO.js.map +1 -0
  280. package/dist/{index-BYzIB5V6.cjs → index-BHe3wsWF.cjs} +2 -2
  281. package/dist/{index-BYzIB5V6.cjs.map → index-BHe3wsWF.cjs.map} +1 -1
  282. package/dist/{index-DKCxu1Gh.js → index-Bw_eHBVN.js} +3 -3
  283. package/dist/{index-DKCxu1Gh.js.map → index-Bw_eHBVN.js.map} +1 -1
  284. package/dist/{index-BW_-wD2k.cjs → index-C0bpbS4F.cjs} +2 -2
  285. package/dist/{index-BW_-wD2k.cjs.map → index-C0bpbS4F.cjs.map} +1 -1
  286. package/dist/{index-37q0ULNQ.js → index-CE9pmfxt.js} +17 -17
  287. package/dist/{index-37q0ULNQ.js.map → index-CE9pmfxt.js.map} +1 -1
  288. package/dist/{index-CVlCtJbC.cjs → index-CEJwW3lL.cjs} +2 -2
  289. package/dist/{index-CVlCtJbC.cjs.map → index-CEJwW3lL.cjs.map} +1 -1
  290. package/dist/{index-CHPV5EwG-BPSP-7Jg.js → index-CHPV5EwG-DBWUSD9b.js} +539 -543
  291. package/dist/index-CHPV5EwG-DBWUSD9b.js.map +1 -0
  292. package/dist/index-CHPV5EwG-DjM48pIC.cjs +44 -0
  293. package/dist/index-CHPV5EwG-DjM48pIC.cjs.map +1 -0
  294. package/dist/{index-BW8iNx7E.cjs → index-Cm8NIdOO.cjs} +2 -2
  295. package/dist/{index-BW8iNx7E.cjs.map → index-Cm8NIdOO.cjs.map} +1 -1
  296. package/dist/{index-tvAyXPPW-DBlMKnNB.js → index-Cw8sCyo_-BuI_jX5Z.js} +3 -3
  297. package/dist/{index-tvAyXPPW-DBlMKnNB.js.map → index-Cw8sCyo_-BuI_jX5Z.js.map} +1 -1
  298. package/dist/index-Cw8sCyo_-gxT8ADyn.cjs +2 -0
  299. package/dist/index-Cw8sCyo_-gxT8ADyn.cjs.map +1 -0
  300. package/dist/{index-CNvov0eg.js → index-Cwgh7i7X.js} +3 -3
  301. package/dist/{index-CNvov0eg.js.map → index-Cwgh7i7X.js.map} +1 -1
  302. package/dist/{index-DG3YrCr5-D3FrrXj8.js → index-Dzc_aaI9-BKklH89r.js} +2 -2
  303. package/dist/{index-DG3YrCr5-D3FrrXj8.js.map → index-Dzc_aaI9-BKklH89r.js.map} +1 -1
  304. package/dist/{index-DG3YrCr5-v7rayV3N.cjs → index-Dzc_aaI9-RIk2GRHD.cjs} +2 -2
  305. package/dist/{index-DG3YrCr5-v7rayV3N.cjs.map → index-Dzc_aaI9-RIk2GRHD.cjs.map} +1 -1
  306. package/dist/{index-BmCqpO1B.js → index-zZjQEHlm.js} +2 -2
  307. package/dist/{index-BmCqpO1B.js.map → index-zZjQEHlm.js.map} +1 -1
  308. package/dist/index.cjs +1 -1
  309. package/dist/index.d.ts +9 -0
  310. package/dist/index.js +1 -1
  311. package/dist/{proxy-CkpFesk1.js → proxy-BYIC9BuT.js} +2 -2
  312. package/dist/{proxy-CkpFesk1.js.map → proxy-BYIC9BuT.js.map} +1 -1
  313. package/dist/{proxy-BHRoeZgd.cjs → proxy-CKadx4lC.cjs} +2 -2
  314. package/dist/{proxy-BHRoeZgd.cjs.map → proxy-CKadx4lC.cjs.map} +1 -1
  315. package/dist/style.css +1 -1
  316. package/dist/{use-in-view-sQJZ_xDO.cjs → use-in-view-CEwlc_dd.cjs} +2 -2
  317. package/dist/{use-in-view-sQJZ_xDO.cjs.map → use-in-view-CEwlc_dd.cjs.map} +1 -1
  318. package/dist/{use-in-view-yS6jzJAp.js → use-in-view-DR-UTB96.js} +2 -2
  319. package/dist/{use-in-view-yS6jzJAp.js.map → use-in-view-DR-UTB96.js.map} +1 -1
  320. package/package.json +4 -4
  321. package/dist/DropdownSelect-CtOKZHD0.js.map +0 -1
  322. package/dist/DropdownSelect-DBDM64B5.cjs.map +0 -1
  323. package/dist/GraphEl-C6yjl1VM.cjs +0 -2
  324. package/dist/GraphEl-C6yjl1VM.cjs.map +0 -1
  325. package/dist/GraphEl-CqWzvOyr.js.map +0 -1
  326. package/dist/Modal-DVVwpKhP.js.map +0 -1
  327. package/dist/Modal-tXZlLE5s.cjs +0 -46
  328. package/dist/Modal-tXZlLE5s.cjs.map +0 -1
  329. package/dist/RegressionLine-mH7UKOPi.js.map +0 -1
  330. package/dist/RegressionLine-xKdiJ8sw.cjs +0 -2
  331. package/dist/RegressionLine-xKdiJ8sw.cjs.map +0 -1
  332. package/dist/checkIfMultiple-BXbHUCWM.cjs +0 -12
  333. package/dist/checkIfMultiple-BXbHUCWM.cjs.map +0 -1
  334. package/dist/checkIfMultiple-ChTJk2Tk.js.map +0 -1
  335. package/dist/getSliderMarks-9cNoRkDx.js.map +0 -1
  336. package/dist/getSliderMarks-CRIbTGYV.cjs +0 -6
  337. package/dist/getSliderMarks-CRIbTGYV.cjs.map +0 -1
  338. package/dist/index-CHPV5EwG-BPSP-7Jg.js.map +0 -1
  339. package/dist/index-CHPV5EwG-DDoeWRVt.cjs +0 -44
  340. package/dist/index-CHPV5EwG-DDoeWRVt.cjs.map +0 -1
  341. package/dist/index-tvAyXPPW-DPOG-C2i.cjs +0 -2
  342. package/dist/index-tvAyXPPW-DPOG-C2i.cjs.map +0 -1
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-CHPV5EwG-DDoeWRVt.cjs"),H=require("./index-DQA8q5sC.cjs"),l=require("react"),U=require("./index-D72cOtq7.cjs"),y=require("./Typography-k-kOjICQ.cjs"),Z=require("./index-CQ3e6Ewi.cjs"),R=require("./numberFormattingFunction-02t-wJta.cjs"),_=require("./GraphFooter.cjs"),tt=require("./GraphHeader.cjs"),j=require("./index-BW_-wD2k.cjs"),S=require("./getTextColorBasedOnBgColor-nqY-bsM_.cjs"),M=v=>v.map(c=>c||1).reduce((c,b)=>c+b,0);function rt(v){const{width:p,height:N,graphTitle:c,sources:b,graphDescription:C,footNote:B,graphID:V,data:d,columnData:n,onSeriesMouseClick:I,language:k="en",theme:X="light",ariaLabel:L,backgroundColor:u=!1,padding:F,resetSelectionOnDoubleClick:Y=!0,styles:m,classNames:x,minWidth:D,naLabel:w="NA",precision:E=2}=v,[g,T]=l.useState(void 0),[q,z]=l.useState(void 0),[h,W]=l.useState("asc"),[f,G]=l.useState(void 0),[J,K]=l.useState({}),[a,P]=l.useState(n.filter(r=>r.filterOptions&&r.filterOptions.length>0).map(r=>({id:r.columnId,option:r.filterOptions}))),[Q,A]=l.useState(d);return l.useEffect(()=>{const r=[];d.forEach(s=>{let t=!0;a.forEach(e=>{if(typeof s[e.id]!="object"&&typeof s[e.id]!="function"&&typeof s[e.id]!="symbol")if(n[n.findIndex(i=>i.columnId===e.id)].separator){const i=s[e.id].split(n[n.findIndex($=>$.columnId===e.id)].separator);U.intersection(i,e.option).length===0&&(t=!1)}else e.option.indexOf(s[e.id])===-1&&(t=!1)}),t&&r.push(s)}),A(g&&d?Z.orderBy(r,[g],[h]):r)},[g,h,d,a,n]),o.jsxRuntimeExports.jsx("div",{className:`${X||"light"} flex ${p?"w-fit grow-0":"w-full grow"}`,dir:k==="he"||k==="ar"?"rtl":void 0,children:o.jsxRuntimeExports.jsx("div",{className:o.mo(`${u?u===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${k||"en"} w-full`,p?"w-fit":"w-full",x?.graphContainer),style:{...m?.graphContainer||{},...u&&u!==!0?{backgroundColor:u}:{}},id:V,"aria-label":L||`${c?`The graph shows ${c}. `:""}This is an data table. ${C?` ${C}`:""}`,children:o.jsxRuntimeExports.jsxs("div",{className:"flex grow",style:{padding:u?F||"1rem":F||0},children:[o.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-3 w-full justify-between grow",children:[c||C?o.jsxRuntimeExports.jsx(tt.GraphHeader,{styles:{title:m?.title,description:m?.description},classNames:{title:x?.title,description:x?.description},graphTitle:c,graphDescription:C,width:p}):null,o.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center",children:o.jsxRuntimeExports.jsx("div",{className:"undp-scrollbar",style:{width:p?`${p}px`:"100%",height:N?`${N}px`:"auto"},children:o.jsxRuntimeExports.jsx("div",{style:D?{minWidth:D}:void 0,children:d?o.jsxRuntimeExports.jsxs("table",{className:"w-full",style:{borderCollapse:"collapse"},children:[o.jsxRuntimeExports.jsx("thead",{className:"text-left bg-primary-gray-300 dark:bg-primary-gray-550",children:o.jsxRuntimeExports.jsx("tr",{children:n?.map((r,s)=>o.jsxRuntimeExports.jsx("th",{className:"text-primary-gray-700 dark:text-primary-gray-100 text-sm",style:{width:`calc(${100*(r.columnWidth||1)/M(n.map(t=>t.columnWidth||1))}%`},children:o.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 justify-between items-center p-4",children:[o.jsxRuntimeExports.jsx(y.u,{size:"sm",marginBottom:"none",className:`w-fit grow text-${r.align||"left"} font-bold`,children:r.columnTitle||r.columnId}),r.sortable?o.jsxRuntimeExports.jsx("button",{type:"button",className:"bg-transparent cursor-pointer p-0 m-0 border-0",onClick:()=>{g===r.columnId?(h==="asc"&&W("desc"),h==="desc"&&T(void 0)):(T(r.columnId),W("asc"))},children:g===r.columnId?h==="asc"?o.jsxRuntimeExports.jsx(j.SortingIconAscending,{}):o.jsxRuntimeExports.jsx(j.SortingIconDescending,{}):o.jsxRuntimeExports.jsx(j.SortingIcon,{})}):null,r.filterOptions&&r.filterOptions.length?o.jsxRuntimeExports.jsx("button",{type:"button",className:"bg-transparent cursor-pointer m-0 p-0 border-0",onClick:t=>{if(f===r.columnId)G(void 0);else if(t.currentTarget){G(r.columnId);const e=t.currentTarget.getBoundingClientRect();K({top:e.bottom+window.scrollY,left:e.left+window.scrollX-160<0?e.left+window.scrollX:e.left+window.scrollX-160,width:"10rem"})}},children:a[a.findIndex(t=>t.id===r.columnId)].option.length===r.filterOptions?.length?o.jsxRuntimeExports.jsx(j.FilterIcon,{}):o.jsxRuntimeExports.jsx(j.FilterIconApplied,{})}):null]})},s))})}),o.jsxRuntimeExports.jsx("tbody",{children:Q?.map((r,s)=>o.jsxRuntimeExports.jsx("tr",{className:`cursor-${I?"pointer":"auto"} border-b border-b-primary-gray-400 dark:border-b-primary-gray-500 ${H.isEqual(q,r)?"bg-primary-gray-200 dark:bg-primary-gray-600":"bg-transparent"}`,style:r.rowStyle,onClick:()=>{I&&(H.isEqual(q,r)&&Y?(z(void 0),I(void 0)):(z(r),I(r)))},children:n.map((t,e)=>o.jsxRuntimeExports.jsx("td",{className:`text-primary-gray-700 dark:text-primary-gray-100 text-sm text-${t.align||"left"}`,style:{width:`calc(${100*(r.columnWidth||1)/M(n.map(i=>i.columnWidth||1))}%`},children:o.jsxRuntimeExports.jsx("div",{className:`text-primary-gray-700 dark:text-primary-gray-100 flex p-4 ${t.align==="right"?"justify-end":t.align==="center"?"justify-center":"justify-start"}`,children:typeof r[t.columnId]=="number"?o.jsxRuntimeExports.jsx(y.u,{marginBottom:"none",size:"sm",className:`text-primary-gray-700 dark:text-primary-gray-100 w-fit ${t.chip?"grow-0 rounded-sm p-2":"grow rounded-none p-0"} text-${t.align||"left"} ${t.chip?t.chipColors?"":"bg-primary-gray-300 dark:bg-primary-gray-500":"bg-transparent"}`,style:{...t.chip&&t.chipColors?{backgroundColor:t.chipColors[t.chipColors.findIndex(i=>i.value===r[t.chipColumnId||t.columnId])].color,color:S.getTextColorBasedOnBgColor(t.chipColors[t.chipColors.findIndex(i=>i.value===r[t.chipColumnId||t.columnId])].color)}:{}},children:R.numberFormattingFunction(r[t.columnId],w,E,t.prefix,t.suffix)}):typeof r[t.columnId]=="string"?t.separator?o.jsxRuntimeExports.jsx("div",{className:"text-primary-gray-700 dark:text-primary-gray-100 flex flex-wrap gap-2",children:r[t.columnId].split(t.separator).map((i,$)=>o.jsxRuntimeExports.jsx(y.u,{marginBottom:"none",size:"sm",className:`text-primary-gray-700 dark:text-primary-gray-100 w-fit ${t.chip?"grow-0 rounded-sm p-2":"grow rounded-none p-0"} text-${t.align||"left"} ${t.chip?t.chipColors?"":"bg-primary-gray-300 dark:bg-primary-gray-500":"bg-transparent"}`,style:{...t.chip&&t.chipColors?{backgroundColor:t.chipColors[t.chipColors.findIndex(O=>O.value===(t.chipColumnId?r[t.chipColumnId]:i))].color,color:S.getTextColorBasedOnBgColor(t.chipColors[t.chipColors.findIndex(O=>O.value===(t.chipColumnId?r[t.chipColumnId]:i))].color)}:{}},children:R.numberFormattingFunction(i,w,E,t.prefix,t.suffix)},$))}):o.jsxRuntimeExports.jsx(y.u,{marginBottom:"none",size:"sm",className:`text-primary-gray-700 dark:text-primary-gray-100 w-fit ${t.chip?"grow-0 rounded-sm p-2":"grow rounded-none p-0"} text-${t.align||"left"} ${t.chip?t.chipColors?"":"bg-primary-gray-300 dark:bg-primary-gray-500":"bg-transparent"}`,style:{...t.chip&&t.chipColors?{backgroundColor:t.chipColors[t.chipColors.findIndex(i=>i.value===r[t.chipColumnId||t.columnId])].color,color:S.getTextColorBasedOnBgColor(t.chipColors[t.chipColors.findIndex(i=>i.value===r[t.chipColumnId||t.columnId])].color)}:{}},children:R.numberFormattingFunction(r[t.columnId],w,E,t.prefix,t.suffix)}):o.jsxRuntimeExports.jsx("div",{children:R.numberFormattingFunction(r[t.columnId],w,E,t.prefix,t.suffix)})})},e))},s))})]}):null})})}),b||B?o.jsxRuntimeExports.jsx(_.GraphFooter,{styles:{footnote:m?.footnote,source:m?.source},classNames:{footnote:x?.footnote,source:x?.source},sources:b,footNote:B,width:p}):null]}),f&&o.jsxRuntimeExports.jsx("div",{style:J,className:"absolute p-3 border z-[1000] rounded-sm bg-primary-white dark:bg-primary-gray-700 border-primary-gray-300 dark:border-primary-gray-550",children:o.jsxRuntimeExports.jsxs("div",{className:"max-w-60",children:[o.jsxRuntimeExports.jsx(y.u,{size:"sm",marginBottom:"2xs",className:"font-bold",children:"Filter data by"}),o.jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-2",children:n[n.findIndex(r=>r.columnId===f)].filterOptions?.map((r,s)=>o.jsxRuntimeExports.jsx("div",{children:o.jsxRuntimeExports.jsxs("label",{className:"undp-viz-label",children:[o.jsxRuntimeExports.jsx("input",{type:"checkbox",className:"undp-viz-checkbox",checked:a[a.findIndex(t=>t.id===f)].option.indexOf(r)!==-1,onChange:()=>{const t=a.findIndex(i=>i.id===f),e=[...a[t].option];if(e.indexOf(r)!==-1){e.splice(e.indexOf(r),1);const i=[...a];i[t].option=e,P(i)}else{e.push(r);const i=[...a];i[t].option=e,P(i)}}}),r]},s)},s))})]})})]})})})}exports.DataTable=rt;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-CHPV5EwG-DjM48pIC.cjs"),H=require("./index-DQA8q5sC.cjs"),l=require("react"),U=require("./index-D72cOtq7.cjs"),y=require("./Typography-BDULiwlF.cjs"),Z=require("./index-CQ3e6Ewi.cjs"),R=require("./numberFormattingFunction-02t-wJta.cjs"),_=require("./GraphFooter.cjs"),tt=require("./GraphHeader.cjs"),j=require("./index-C0bpbS4F.cjs"),S=require("./getTextColorBasedOnBgColor-nqY-bsM_.cjs"),M=v=>v.map(c=>c||1).reduce((c,b)=>c+b,0);function rt(v){const{width:p,height:N,graphTitle:c,sources:b,graphDescription:C,footNote:B,graphID:V,data:d,columnData:n,onSeriesMouseClick:I,language:k="en",theme:X="light",ariaLabel:L,backgroundColor:u=!1,padding:F,resetSelectionOnDoubleClick:Y=!0,styles:m,classNames:x,minWidth:D,naLabel:w="NA",precision:E=2}=v,[g,T]=l.useState(void 0),[q,z]=l.useState(void 0),[h,W]=l.useState("asc"),[f,G]=l.useState(void 0),[J,K]=l.useState({}),[a,P]=l.useState(n.filter(r=>r.filterOptions&&r.filterOptions.length>0).map(r=>({id:r.columnId,option:r.filterOptions}))),[Q,A]=l.useState(d);return l.useEffect(()=>{const r=[];d.forEach(s=>{let t=!0;a.forEach(e=>{if(typeof s[e.id]!="object"&&typeof s[e.id]!="function"&&typeof s[e.id]!="symbol")if(n[n.findIndex(i=>i.columnId===e.id)].separator){const i=s[e.id].split(n[n.findIndex($=>$.columnId===e.id)].separator);U.intersection(i,e.option).length===0&&(t=!1)}else e.option.indexOf(s[e.id])===-1&&(t=!1)}),t&&r.push(s)}),A(g&&d?Z.orderBy(r,[g],[h]):r)},[g,h,d,a,n]),o.jsxRuntimeExports.jsx("div",{className:`${X||"light"} flex ${p?"w-fit grow-0":"w-full grow"}`,dir:k==="he"||k==="ar"?"rtl":void 0,children:o.jsxRuntimeExports.jsx("div",{className:o.mo(`${u?u===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${k||"en"} w-full`,p?"w-fit":"w-full",x?.graphContainer),style:{...m?.graphContainer||{},...u&&u!==!0?{backgroundColor:u}:{}},id:V,"aria-label":L||`${c?`The graph shows ${c}. `:""}This is an data table. ${C?` ${C}`:""}`,children:o.jsxRuntimeExports.jsxs("div",{className:"flex grow",style:{padding:u?F||"1rem":F||0},children:[o.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-3 w-full justify-between grow",children:[c||C?o.jsxRuntimeExports.jsx(tt.GraphHeader,{styles:{title:m?.title,description:m?.description},classNames:{title:x?.title,description:x?.description},graphTitle:c,graphDescription:C,width:p}):null,o.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center",children:o.jsxRuntimeExports.jsx("div",{className:"undp-scrollbar",style:{width:p?`${p}px`:"100%",height:N?`${N}px`:"auto"},children:o.jsxRuntimeExports.jsx("div",{style:D?{minWidth:D}:void 0,children:d?o.jsxRuntimeExports.jsxs("table",{className:"w-full",style:{borderCollapse:"collapse"},children:[o.jsxRuntimeExports.jsx("thead",{className:"text-left bg-primary-gray-300 dark:bg-primary-gray-550",children:o.jsxRuntimeExports.jsx("tr",{children:n?.map((r,s)=>o.jsxRuntimeExports.jsx("th",{className:"text-primary-gray-700 dark:text-primary-gray-100 text-sm",style:{width:`calc(${100*(r.columnWidth||1)/M(n.map(t=>t.columnWidth||1))}%`},children:o.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 justify-between items-center p-4",children:[o.jsxRuntimeExports.jsx(y.u,{size:"sm",marginBottom:"none",className:`w-fit grow text-${r.align||"left"} font-bold`,children:r.columnTitle||r.columnId}),r.sortable?o.jsxRuntimeExports.jsx("button",{type:"button",className:"bg-transparent cursor-pointer p-0 m-0 border-0",onClick:()=>{g===r.columnId?(h==="asc"&&W("desc"),h==="desc"&&T(void 0)):(T(r.columnId),W("asc"))},children:g===r.columnId?h==="asc"?o.jsxRuntimeExports.jsx(j.SortingIconAscending,{}):o.jsxRuntimeExports.jsx(j.SortingIconDescending,{}):o.jsxRuntimeExports.jsx(j.SortingIcon,{})}):null,r.filterOptions&&r.filterOptions.length?o.jsxRuntimeExports.jsx("button",{type:"button",className:"bg-transparent cursor-pointer m-0 p-0 border-0",onClick:t=>{if(f===r.columnId)G(void 0);else if(t.currentTarget){G(r.columnId);const e=t.currentTarget.getBoundingClientRect();K({top:e.bottom+window.scrollY,left:e.left+window.scrollX-160<0?e.left+window.scrollX:e.left+window.scrollX-160,width:"10rem"})}},children:a[a.findIndex(t=>t.id===r.columnId)].option.length===r.filterOptions?.length?o.jsxRuntimeExports.jsx(j.FilterIcon,{}):o.jsxRuntimeExports.jsx(j.FilterIconApplied,{})}):null]})},s))})}),o.jsxRuntimeExports.jsx("tbody",{children:Q?.map((r,s)=>o.jsxRuntimeExports.jsx("tr",{className:`cursor-${I?"pointer":"auto"} border-b border-b-primary-gray-400 dark:border-b-primary-gray-500 ${H.isEqual(q,r)?"bg-primary-gray-200 dark:bg-primary-gray-600":"bg-transparent"}`,style:r.rowStyle,onClick:()=>{I&&(H.isEqual(q,r)&&Y?(z(void 0),I(void 0)):(z(r),I(r)))},children:n.map((t,e)=>o.jsxRuntimeExports.jsx("td",{className:`text-primary-gray-700 dark:text-primary-gray-100 text-sm text-${t.align||"left"}`,style:{width:`calc(${100*(r.columnWidth||1)/M(n.map(i=>i.columnWidth||1))}%`},children:o.jsxRuntimeExports.jsx("div",{className:`text-primary-gray-700 dark:text-primary-gray-100 flex p-4 ${t.align==="right"?"justify-end":t.align==="center"?"justify-center":"justify-start"}`,children:typeof r[t.columnId]=="number"?o.jsxRuntimeExports.jsx(y.u,{marginBottom:"none",size:"sm",className:`text-primary-gray-700 dark:text-primary-gray-100 w-fit ${t.chip?"grow-0 rounded-sm p-2":"grow rounded-none p-0"} text-${t.align||"left"} ${t.chip?t.chipColors?"":"bg-primary-gray-300 dark:bg-primary-gray-500":"bg-transparent"}`,style:{...t.chip&&t.chipColors?{backgroundColor:t.chipColors[t.chipColors.findIndex(i=>i.value===r[t.chipColumnId||t.columnId])].color,color:S.getTextColorBasedOnBgColor(t.chipColors[t.chipColors.findIndex(i=>i.value===r[t.chipColumnId||t.columnId])].color)}:{}},children:R.numberFormattingFunction(r[t.columnId],w,E,t.prefix,t.suffix)}):typeof r[t.columnId]=="string"?t.separator?o.jsxRuntimeExports.jsx("div",{className:"text-primary-gray-700 dark:text-primary-gray-100 flex flex-wrap gap-2",children:r[t.columnId].split(t.separator).map((i,$)=>o.jsxRuntimeExports.jsx(y.u,{marginBottom:"none",size:"sm",className:`text-primary-gray-700 dark:text-primary-gray-100 w-fit ${t.chip?"grow-0 rounded-sm p-2":"grow rounded-none p-0"} text-${t.align||"left"} ${t.chip?t.chipColors?"":"bg-primary-gray-300 dark:bg-primary-gray-500":"bg-transparent"}`,style:{...t.chip&&t.chipColors?{backgroundColor:t.chipColors[t.chipColors.findIndex(O=>O.value===(t.chipColumnId?r[t.chipColumnId]:i))].color,color:S.getTextColorBasedOnBgColor(t.chipColors[t.chipColors.findIndex(O=>O.value===(t.chipColumnId?r[t.chipColumnId]:i))].color)}:{}},children:R.numberFormattingFunction(i,w,E,t.prefix,t.suffix)},$))}):o.jsxRuntimeExports.jsx(y.u,{marginBottom:"none",size:"sm",className:`text-primary-gray-700 dark:text-primary-gray-100 w-fit ${t.chip?"grow-0 rounded-sm p-2":"grow rounded-none p-0"} text-${t.align||"left"} ${t.chip?t.chipColors?"":"bg-primary-gray-300 dark:bg-primary-gray-500":"bg-transparent"}`,style:{...t.chip&&t.chipColors?{backgroundColor:t.chipColors[t.chipColors.findIndex(i=>i.value===r[t.chipColumnId||t.columnId])].color,color:S.getTextColorBasedOnBgColor(t.chipColors[t.chipColors.findIndex(i=>i.value===r[t.chipColumnId||t.columnId])].color)}:{}},children:R.numberFormattingFunction(r[t.columnId],w,E,t.prefix,t.suffix)}):o.jsxRuntimeExports.jsx("div",{children:R.numberFormattingFunction(r[t.columnId],w,E,t.prefix,t.suffix)})})},e))},s))})]}):null})})}),b||B?o.jsxRuntimeExports.jsx(_.GraphFooter,{styles:{footnote:m?.footnote,source:m?.source},classNames:{footnote:x?.footnote,source:x?.source},sources:b,footNote:B,width:p}):null]}),f&&o.jsxRuntimeExports.jsx("div",{style:J,className:"absolute p-3 border z-[1000] rounded-sm bg-primary-white dark:bg-primary-gray-700 border-primary-gray-300 dark:border-primary-gray-550",children:o.jsxRuntimeExports.jsxs("div",{className:"max-w-60",children:[o.jsxRuntimeExports.jsx(y.u,{size:"sm",marginBottom:"2xs",className:"font-bold",children:"Filter data by"}),o.jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-2",children:n[n.findIndex(r=>r.columnId===f)].filterOptions?.map((r,s)=>o.jsxRuntimeExports.jsx("div",{children:o.jsxRuntimeExports.jsxs("label",{className:"undp-viz-label",children:[o.jsxRuntimeExports.jsx("input",{type:"checkbox",className:"undp-viz-checkbox",checked:a[a.findIndex(t=>t.id===f)].option.indexOf(r)!==-1,onChange:()=>{const t=a.findIndex(i=>i.id===f),e=[...a[t].option];if(e.indexOf(r)!==-1){e.splice(e.indexOf(r),1);const i=[...a];i[t].option=e,P(i)}else{e.push(r);const i=[...a];i[t].option=e,P(i)}}}),r]},s)},s))})]})})]})})})}exports.DataTable=rt;
2
2
  //# sourceMappingURL=DataTable.cjs.map
package/dist/DataTable.js CHANGED
@@ -1,13 +1,13 @@
1
- import { j as i, m as Q } from "./index-CHPV5EwG-BPSP-7Jg.js";
1
+ import { j as i, m as Q } from "./index-CHPV5EwG-DBWUSD9b.js";
2
2
  import { i as M } from "./index-Bwrro8-q.js";
3
3
  import { useState as p, useEffect as U } from "react";
4
4
  import { i as Z } from "./index-V_JXij1_.js";
5
- import { u as y } from "./Typography-Ctgfl1J5.js";
5
+ import { u as y } from "./Typography-LmZ9LEpe.js";
6
6
  import { o as _ } from "./index-DvVprvy6.js";
7
7
  import { n as v } from "./numberFormattingFunction-14YCbkN2.js";
8
8
  import { GraphFooter as rr } from "./GraphFooter.js";
9
9
  import { GraphHeader as or } from "./GraphHeader.js";
10
- import { S as ir, a as tr, b as er, F as sr, c as ar } from "./index-BmCqpO1B.js";
10
+ import { S as ir, a as tr, b as er, F as sr, c as ar } from "./index-zZjQEHlm.js";
11
11
  import { g as S } from "./getTextColorBasedOnBgColor-B6Nk2WBf.js";
12
12
  const P = (N) => N.map((c) => c || 1).reduce((c, b) => c + b, 0);
13
13
  function yr(N) {
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CHPV5EwG-DDoeWRVt.cjs"),d=require("react"),m=require("./parse-hMnG_lRV.cjs"),qt=require("./index-CQ3e6Ewi.cjs"),Et=require("./numberFormattingFunction-02t-wJta.cjs"),Tt=require("./Tooltip-De16GWhY.cjs"),T=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),bt=require("./customArea-CK768gCn.cjs"),Mt=require("./AxisTitle-CK9YeovX.cjs"),Ft=require("./Axis-DE7dSn1_.cjs"),Pt=require("./XTicksAndGridLines-CCzXIV8d.cjs"),Gt=require("./ReferenceLine-CFVBBN__.cjs"),Ht=require("./YTicksAndGridLines-DBDuz6vb.cjs"),Wt=require("./index-BYzIB5V6.cjs"),Yt=require("./time-Byw_jYQ7.cjs"),Xt=require("./linear-BVckp9RD.cjs"),At=require("./line-DHV4JwCR.cjs"),ht=require("./step-BZ3C8QFW.cjs"),Ct=require("./area-D3Qx7k7K.cjs"),Ut=require("./select-Bnfk0lJx.cjs"),Bt=require("./init-DU0ybBc_.cjs"),zt=require("./pointer-Dkq5NV1q.cjs"),Jt=require("./use-in-view-sQJZ_xDO.cjs"),f=require("./proxy-BHRoeZgd.cjs"),Kt=require("./GraphFooter.cjs"),Qt=require("./GraphHeader.cjs"),Zt=require("./ColorLegend.cjs"),pt=require("./Colors.cjs"),_t=require("./generateRandomString-B5zBiJzS.cjs"),te=require("./EmptyState-d8_8SxeW.cjs");function ee(dt){const{data:V,width:O,height:G,lineColors:j,suffix:D,prefix:w,dateFormat:o,showValues:l,noOfXTicks:z,rightMargin:yt,leftMargin:R,topMargin:gt,bottomMargin:J,tooltip:H,highlightAreaSettings:N,onSeriesMouseOver:W,animate:n,rtl:K,showColorLegendAtTop:ft,colorDomain:M,diffAreaColors:Q,idSuffix:E,strokeWidth:Z,showDots:_,refValues:Y,minValue:k,maxValue:X,annotations:L,customHighlightAreaSettings:F,yAxisTitle:U,noOfYTicks:tt,minDate:et,maxDate:it,curveType:P,styles:h,classNames:p,precision:S,customLayers:nt}=dt,at=d.useRef(null),r=Jt.useInView(at,{once:n.once,amount:n.amount}),[c,jt]=d.useState(!1);d.useEffect(()=>{if(r&&!c){const t=setTimeout(()=>{jt(!0)},(n.duration+.5)*1e3);return()=>clearTimeout(t)}},[r,c,n.duration]);const $=P==="linear"?At.curveLinear:P==="step"?ht.curveStep:P==="stepAfter"?ht.stepAfter:P==="stepBefore"?ht.stepBefore:ht.monotoneX,[q,st]=d.useState(void 0),[ot,rt]=d.useState(void 0),[b,A]=d.useState(void 0),y={top:gt,bottom:J,left:U?R+30:R,right:yt},lt=d.useRef(null),i=qt.orderBy(V.map(t=>({...t,date:m.parse(`${t.date}`,o,new Date)})),["date"],["asc"]),ct=N.map(t=>({...t,coordinates:[t.coordinates[0]===null?null:m.parse(`${t.coordinates[0]}`,o,new Date),t.coordinates[1]===null?null:m.parse(`${t.coordinates[1]}`,o,new Date)]})),xt=F.map(t=>({...t,coordinates:t.coordinates.map((v,I)=>I%2===0?m.parse(`${v}`,o,new Date):v)})),x=O-y.left-y.right,g=G-y.top-y.bottom,ut=et?m.parse(`${et}`,o,new Date):i[0].date,u=it?m.parse(`${it}`,o,new Date):i[i.length-1].date,B=Math.min(...i.map(t=>t.y1))!==1/0?Math.min(...i.map(t=>t.y1))>0?0:Math.min(...i.map(t=>t.y1)):0,Ot=Math.min(...i.map(t=>t.y2))!==1/0?Math.min(...i.map(t=>t.y2))>0?0:Math.min(...i.map(t=>t.y2)):0,Nt=Math.max(...i.map(t=>t.y1))!==1/0?Math.max(...i.map(t=>t.y1)):0,It=Math.max(...i.map(t=>t.y2))!==1/0?Math.max(...i.map(t=>t.y2)):0,C=T.checkIfNullOrUndefined(k)?B<Ot?B:Ot:k,wt=Nt>It?Nt:It,a=Yt.time().domain([ut,u]).range([0,x]),s=Xt.linear().domain([T.checkIfNullOrUndefined(k)?C:k,T.checkIfNullOrUndefined(X)?wt>0?wt:0:X]).range([g,0]).nice(),vt=At.line().x(t=>a(t.date)).y(t=>s(t.y1)).curve($),Vt=At.line().x(t=>a(t.date)).y(t=>s(t.y2)).curve($),Dt=Ct.area().x(t=>a(t.date)).y1(t=>s(t.y1)).y0(t=>s(t.y2)).curve($),St=Ct.area().x(t=>a(t.date)).y1(t=>s(t.y1)).y0(0).curve($),$t=Ct.area().x(t=>a(t.date)).y1(t=>s(t.y2)).y0(0).curve($),kt=s.ticks(tt),Lt=a.ticks(z);return d.useEffect(()=>{const t=I=>{const mt=i[Bt.bisectCenter(i.map(Rt=>Rt.date),a.invert(zt.pointer(I)[0]),0)];st(mt||i[i.length-1]),W?.(mt||i[i.length-1]),A(I.clientY),rt(I.clientX)},v=()=>{st(void 0),rt(void 0),A(void 0),W?.(void 0)};Ut.select(lt.current).on("mousemove",t).on("mouseout",v)},[a,i,W]),e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(f.motion.svg,{width:`${O}px`,height:`${G}px`,viewBox:`0 0 ${O} ${G}`,direction:"ltr",ref:at,children:e.jsxRuntimeExports.jsxs("g",{transform:`translate(${y.left},${y.top})`,children:[e.jsxRuntimeExports.jsx("clipPath",{id:`above${E}`,children:e.jsxRuntimeExports.jsx("path",{d:$t(i),style:{fill:"none"}})}),e.jsxRuntimeExports.jsx("clipPath",{id:`below${E}`,children:e.jsxRuntimeExports.jsx("path",{d:St(i),style:{fill:"none"}})}),e.jsxRuntimeExports.jsx(Wt.HighlightArea,{areaSettings:ct,width:x,height:g,scale:a,animate:n,isInView:r}),e.jsxRuntimeExports.jsx(bt.CustomArea,{areaSettings:xt,scaleX:a,scaleY:s,animate:n,isInView:r}),e.jsxRuntimeExports.jsx("g",{children:e.jsxRuntimeExports.jsxs("g",{children:[e.jsxRuntimeExports.jsx(Ht.YTicksAndGridLines,{values:kt.filter(t=>t!==0),y:kt.filter(t=>t!==0).map(t=>s(t)),x1:0-R,x2:x+y.right,styles:{gridLines:h?.yAxis?.gridLines,labels:h?.yAxis?.labels},classNames:{gridLines:p?.yAxis?.gridLines,labels:p?.yAxis?.labels},suffix:D,prefix:w,labelType:"secondary",showGridLines:!0,labelPos:"vertical",precision:S}),e.jsxRuntimeExports.jsx(Ft.Axis,{y1:s(C<0?0:C),y2:s(C<0?0:C),x1:0-R,x2:x+y.right,label:Et.numberFormattingFunction(C<0?0:C,"NA",S,w,D),labelPos:{x:0-R,y:s(C<0?0:C),dx:0,dy:wt<0?"1rem":-5},classNames:{axis:p?.xAxis?.axis,label:p?.yAxis?.labels},styles:{axis:h?.xAxis?.axis,label:h?.yAxis?.labels}}),e.jsxRuntimeExports.jsx(Mt.AxisTitle,{x:0-R-15,y:g/2,style:h?.yAxis?.title,className:p?.yAxis?.title,text:U,rotate90:!0})]})}),e.jsxRuntimeExports.jsx(Pt.XTicksAndGridLines,{values:Lt.map(t=>m.format(t,o)),x:Lt.map(t=>a(t)),y1:0,y2:g,styles:{gridLines:h?.xAxis?.gridLines,labels:h?.xAxis?.labels},classNames:{gridLines:e.mo("opacity-0",p?.xAxis?.gridLines),labels:e.mo("fill-primary-gray-700 dark:fill-primary-gray-300 xs:max-[360px]:hidden text-[9px] md:text-[10px] lg:text-xs",p?.xAxis?.labels)},suffix:D,prefix:w,labelType:"primary",showGridLines:!0,precision:S}),nt.filter(t=>t.position==="before").map(t=>t.layer),e.jsxRuntimeExports.jsxs("g",{children:[e.jsxRuntimeExports.jsx(f.motion.path,{clipPath:`url(#below${E})`,d:Dt(i)||"",style:{fill:Q[1]},exit:{opacity:0,transition:{duration:n.duration}},variants:{initial:{opacity:1},whileInView:{opacity:1,transition:{duration:n.duration}}},initial:"initial",animate:r?"whileInView":"initial"}),e.jsxRuntimeExports.jsx(f.motion.path,{clipPath:`url(#above${E})`,d:Dt(i)||"",style:{fill:Q[0]},exit:{opacity:0,transition:{duration:n.duration}},variants:{initial:{opacity:0},whileInView:{opacity:1,transition:{duration:n.duration}}},initial:"initial",animate:r?"whileInView":"initial"})]}),e.jsxRuntimeExports.jsxs("g",{children:[e.jsxRuntimeExports.jsx(f.motion.path,{d:vt(i)||"",style:{fill:"none",stroke:j[0],strokeWidth:Z},exit:{opacity:0,transition:{duration:n.duration}},variants:{initial:{pathLength:0,d:vt(i)||"",opacity:1},whileInView:{pathLength:1,d:vt(i)||"",opacity:1,transition:{duration:n.duration}}},initial:"initial",animate:r?"whileInView":"initial"}),e.jsxRuntimeExports.jsx(f.motion.path,{style:{fill:"none",stroke:j[1],strokeWidth:Z},exit:{opacity:0,transition:{duration:n.duration}},variants:{initial:{pathLength:0,d:Vt(i)||"",opacity:1},whileInView:{pathLength:1,d:Vt(i)||"",opacity:1,transition:{duration:n.duration}}},initial:"initial",animate:r?"whileInView":"initial"}),ft?null:e.jsxRuntimeExports.jsxs("g",{children:[e.jsxRuntimeExports.jsx(f.motion.text,{style:{fill:j[0]},className:"text-xs",dx:5,dy:4,exit:{opacity:0,transition:{duration:n.duration}},variants:{initial:{opacity:0,x:a(i[i.length-1].date),y:s(i[i.length-1].y1)},whileInView:{opacity:1,x:a(i[i.length-1].date),y:s(i[i.length-1].y1),transition:{duration:c?n.duration:.5,delay:c?0:n.duration}}},initial:"initial",animate:r?"whileInView":"initial",children:M[0]},M[0]),e.jsxRuntimeExports.jsx(f.motion.text,{style:{fill:j[1]},className:"text-xs",dx:5,dy:4,exit:{opacity:0,transition:{duration:n.duration}},variants:{initial:{opacity:0,x:a(i[i.length-1].date),y:s(i[i.length-1].y2)},whileInView:{opacity:1,x:a(i[i.length-1].date),y:s(i[i.length-1].y2),transition:{duration:c?n.duration:.5,delay:c?0:n.duration}}},initial:"initial",animate:r?"whileInView":"initial",children:M[1]},M[1])]}),q?e.jsxRuntimeExports.jsx("line",{y1:0,y2:g,x1:a(q.date),x2:a(q.date),className:e.mo("undp-tick-line stroke-primary-gray-700 dark:stroke-primary-gray-100",p?.mouseOverLine),style:h?.mouseOverLine}):null,i.map((t,v)=>e.jsxRuntimeExports.jsxs(f.motion.g,{children:[T.checkIfNullOrUndefined(t.y1)?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[_?e.jsxRuntimeExports.jsx(f.motion.circle,{r:x/i.length<5?0:x/i.length<20?2:4,style:{fill:j[0]},exit:{opacity:0,transition:{duration:n.duration}},variants:{initial:{opacity:0,cx:a(t.date),cy:s(t.y1)},whileInView:{opacity:1,transition:{duration:.5,delay:n.duration},cx:a(t.date),cy:s(t.y1)}},initial:"initial",animate:r?"whileInView":"initial"}):null,l?e.jsxRuntimeExports.jsx(f.motion.text,{dy:t.y2<t.y1?-8:"1em",style:{fill:j[0],textAnchor:"middle",...h?.graphObjectValues||{}},className:e.mo("graph-value graph-value-line-1 text-xs font-bold",p?.graphObjectValues),exit:{opacity:0,transition:{duration:n.duration}},variants:{initial:{opacity:0,x:a(t.date),y:s(t.y1)},whileInView:{opacity:1,x:a(t.date),y:s(t.y1),transition:{duration:c?n.duration:.5,delay:c?0:n.duration}}},initial:"initial",animate:r?"whileInView":"initial",children:Et.numberFormattingFunction(t.y1,"NA",S,w,D)}):null]}),T.checkIfNullOrUndefined(t.y2)?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[_?e.jsxRuntimeExports.jsx(f.motion.circle,{r:x/i.length<5?0:x/i.length<20?2:4,style:{fill:j[1]},exit:{opacity:0,transition:{duration:n.duration}},variants:{initial:{opacity:0,cx:a(t.date),cy:s(t.y2)},whileInView:{opacity:1,transition:{duration:c?n.duration:.5,delay:c?0:n.duration},cx:a(t.date),cy:s(t.y2)}},initial:"initial",animate:r?"whileInView":"initial"}):null,l?e.jsxRuntimeExports.jsx(f.motion.text,{dy:t.y2>t.y1?-8:"1em",style:{fill:j[1],textAnchor:"middle",...h?.graphObjectValues||{}},className:e.mo("graph-value graph-value-line-2 text-xs font-bold",p?.graphObjectValues),exit:{opacity:0,transition:{duration:n.duration}},variants:{initial:{opacity:0,x:a(t.date),y:s(t.y2)},whileInView:{opacity:1,x:a(t.date),y:s(t.y2),transition:{duration:c?n.duration:.5,delay:c?0:n.duration}}},initial:"initial",animate:r?"whileInView":"initial",children:Et.numberFormattingFunction(t.y2,"NA",S,w,D)}):null]})]},v))]}),Y?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:Y.map((t,v)=>e.jsxRuntimeExports.jsx(Gt.RefLineY,{text:t.text,color:t.color,y:s(t.value),x1:0-R,x2:x+y.right,classNames:t.classNames,styles:t.styles,animate:n,isInView:r},v))}):null,e.jsxRuntimeExports.jsx("g",{children:L.map((t,v)=>{const I=bt.getLineEndPoint({x:t.xCoordinate?a(m.parse(`${t.xCoordinate}`,o,new Date))+(t.xOffset||0):0+(t.xOffset||0),y:t.yCoordinate?s(t.yCoordinate)+(t.yOffset||0)-8:0+(t.yOffset||0)-8},{x:t.xCoordinate?a(m.parse(`${t.xCoordinate}`,o,new Date)):0,y:t.yCoordinate?s(t.yCoordinate):0},T.checkIfNullOrUndefined(t.connectorRadius)?3.5:t.connectorRadius),mt=t.showConnector?{y1:I.y,x1:I.x,y2:t.yCoordinate?s(t.yCoordinate)+(t.yOffset||0):0+(t.yOffset||0),x2:t.xCoordinate?a(m.parse(`${t.xCoordinate}`,o,new Date))+(t.xOffset||0):0+(t.xOffset||0),cy:t.yCoordinate?s(t.yCoordinate):0,cx:t.xCoordinate?a(m.parse(`${t.xCoordinate}`,o,new Date)):0,circleRadius:T.checkIfNullOrUndefined(t.connectorRadius)?3.5:t.connectorRadius,strokeWidth:t.showConnector===!0?2:Math.min(t.showConnector||0,1)}:void 0,Rt={y:t.yCoordinate?s(t.yCoordinate)+(t.yOffset||0)-8:0+(t.yOffset||0)-8,x:K?0:t.xCoordinate?a(m.parse(`${t.xCoordinate}`,o,new Date))+(t.xOffset||0):0+(t.xOffset||0),width:K?t.xCoordinate?a(m.parse(`${t.xCoordinate}`,o,new Date))+(t.xOffset||0):0+(t.xOffset||0):x+y.right-(t.xCoordinate?a(m.parse(`${t.xCoordinate}`,o,new Date))+(t.xOffset||0):0+(t.xOffset||0)),maxWidth:t.maxWidth,fontWeight:t.fontWeight,align:t.align};return e.jsxRuntimeExports.jsx(bt.Annotation,{color:t.color,connectorsSettings:mt,labelSettings:Rt,text:t.text,classNames:t.classNames,styles:t.styles,animate:n,isInView:r},v)})}),nt.filter(t=>t.position==="after").map(t=>t.layer),e.jsxRuntimeExports.jsx("rect",{ref:lt,style:{fill:"none",pointerEvents:"all"},width:x,height:g})]})}),q&&H&&ot&&b?e.jsxRuntimeExports.jsx(Tt.Tooltip,{data:q,body:H,xPos:ot,yPos:b,backgroundStyle:h?.tooltip,className:p?.tooltip}):null]})}function ie(dt){const{data:V,graphTitle:O,suffix:G="",sources:j,prefix:D="",graphDescription:w,height:o,width:l,footNote:z,noOfXTicks:yt=10,dateFormat:R="yyyy",showValues:gt=!1,padding:J,lineColors:H=[pt.Colors.light.categoricalColors.colors[0],pt.Colors.light.categoricalColors.colors[1]],backgroundColor:N=!1,leftMargin:W=30,rightMargin:n=50,topMargin:K=20,bottomMargin:ft=25,tooltip:M,highlightAreaSettings:Q=[],relativeHeight:E,onSeriesMouseOver:Z,graphID:_,graphDownload:Y=!1,dataDownload:k=!1,animate:X=!1,language:L="en",minHeight:F=0,labels:U,showColorLegendAtTop:tt=!1,colorLegendTitle:et,diffAreaColors:it=[pt.Colors.alerts.red,pt.Colors.alerts.darkGreen],strokeWidth:P=2,showDots:h=!0,refValues:p=[],minValue:S,maxValue:nt,annotations:at=[],customHighlightAreaSettings:r=[],theme:c="light",ariaLabel:jt,yAxisTitle:$,noOfYTicks:q=5,minDate:st,maxDate:ot,curveType:rt="curve",styles:b,classNames:A,precision:y=2,customLayers:lt=[]}=dt,[i,ct]=d.useState(0),[xt,x]=d.useState(0),g=d.useRef(null),ut=d.useRef(null);return d.useEffect(()=>{const u=new ResizeObserver(B=>{ct(l||B[0].target.clientWidth||620),x(o||B[0].target.clientHeight||480)});return g.current&&(x(g.current.clientHeight||480),ct(g.current.clientWidth||620),l||u.observe(g.current)),()=>u.disconnect()},[l,o]),e.jsxRuntimeExports.jsx("div",{className:`${c||"light"} flex ${l?"w-fit grow-0":"w-full grow"}`,dir:L==="he"||L==="ar"?"rtl":void 0,children:e.jsxRuntimeExports.jsx("div",{className:e.mo(`${N?N===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${L||"en"}`,l?"w-fit":"w-full",A?.graphContainer),style:{...b?.graphContainer||{},...N&&N!==!0?{backgroundColor:N}:{}},id:_,ref:ut,"aria-label":jt||`${O?`The graph shows ${O}. `:""}This is a line chart that highlights the difference between two datasets over time.${w?` ${w}`:""}`,children:e.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:N?J||"1rem":J||0},children:e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[O||w||Y||k?e.jsxRuntimeExports.jsx(Qt.GraphHeader,{styles:{title:b?.title,description:b?.description},classNames:{title:A?.title,description:A?.description},graphTitle:O,graphDescription:w,width:l,graphDownload:Y?ut.current:void 0,dataDownload:k?V.map(u=>u.data).filter(u=>u!==void 0).length>0?V.map(u=>u.data).filter(u=>u!==void 0):V.filter(u=>u!==void 0):null}):null,e.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:V.length===0?e.jsxRuntimeExports.jsx(te.EmptyState,{}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[tt?e.jsxRuntimeExports.jsx(Zt.ColorLegend,{colorDomain:U,colorLegendTitle:et,colors:H,showNAColor:!1}):null,e.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:g,"aria-label":"Graph area",children:(l||i)&&(o||xt)?e.jsxRuntimeExports.jsx(ee,{data:V,lineColors:H,colorDomain:U,width:l||i,height:Math.max(F,o||(E?F?(l||i)*E>F?(l||i)*E:F:(l||i)*E:xt)),suffix:G,prefix:D,dateFormat:R,showValues:gt,noOfXTicks:yt,leftMargin:W,rightMargin:n,topMargin:K,bottomMargin:ft,highlightAreaSettings:Q,tooltip:M,onSeriesMouseOver:Z,showColorLegendAtTop:tt,animate:X===!0?{duration:.5,once:!0,amount:.5}:X||{duration:0,once:!0,amount:0},rtl:L==="he"||L==="ar",diffAreaColors:it,idSuffix:_t.generateRandomString(8),strokeWidth:P,showDots:h,refValues:p,minValue:S,maxValue:nt,annotations:at,customHighlightAreaSettings:r,yAxisTitle:$,noOfYTicks:q,minDate:st,maxDate:ot,curveType:rt,styles:b,classNames:A,precision:y,customLayers:lt}):null})]})}),j||z?e.jsxRuntimeExports.jsx(Kt.GraphFooter,{styles:{footnote:b?.footnote,source:b?.source},classNames:{footnote:A?.footnote,source:A?.source},sources:j,footNote:z,width:l}):null]})})})})}exports.DifferenceLineChart=ie;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CHPV5EwG-DjM48pIC.cjs"),y=require("react"),h=require("./parse-hMnG_lRV.cjs"),qt=require("./index-CQ3e6Ewi.cjs"),Et=require("./numberFormattingFunction-02t-wJta.cjs"),Tt=require("./Tooltip-Cpv0QohJ.cjs"),T=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),bt=require("./customArea-1G1S78s_.cjs"),Mt=require("./AxisTitle-Wkz-xeQL.cjs"),Ft=require("./Axis-CkNn1wit.cjs"),Pt=require("./XTicksAndGridLines-RKy7BVCO.cjs"),Gt=require("./ReferenceLine-D04j-zeV.cjs"),Ht=require("./YTicksAndGridLines-qGpRo_t1.cjs"),Wt=require("./index-BHe3wsWF.cjs"),Yt=require("./time-Byw_jYQ7.cjs"),Xt=require("./linear-BVckp9RD.cjs"),At=require("./line-DHV4JwCR.cjs"),ht=require("./step-BZ3C8QFW.cjs"),Ct=require("./area-D3Qx7k7K.cjs"),Ut=require("./select-Bnfk0lJx.cjs"),Bt=require("./init-DU0ybBc_.cjs"),zt=require("./pointer-Dkq5NV1q.cjs"),Jt=require("./use-in-view-CEwlc_dd.cjs"),j=require("./proxy-CKadx4lC.cjs"),Kt=require("./GraphFooter.cjs"),Qt=require("./GraphHeader.cjs"),Zt=require("./ColorLegend.cjs"),pt=require("./Colors.cjs"),_t=require("./generateRandomString-B5zBiJzS.cjs"),te=require("./EmptyState-B8IpKGcL.cjs");function ee(dt){const{data:V,width:O,height:G,lineColors:l,suffix:D,prefix:w,dateFormat:o,showValues:c,noOfXTicks:z,rightMargin:yt,leftMargin:R,topMargin:gt,bottomMargin:J,tooltip:H,highlightAreaSettings:N,onSeriesMouseOver:W,animate:n,rtl:K,showColorLegendAtTop:ft,colorDomain:M,diffAreaColors:Q,idSuffix:E,strokeWidth:Z,showDots:_,refValues:Y,minValue:k,maxValue:X,annotations:L,customHighlightAreaSettings:F,yAxisTitle:U,noOfYTicks:tt,minDate:et,maxDate:it,curveType:P,styles:p,classNames:d,precision:S,customLayers:nt}=dt,at=y.useRef(null),r=Jt.useInView(at,{once:n.once,amount:n.amount}),[x,jt]=y.useState(!1);y.useEffect(()=>{if(r&&!x){const t=setTimeout(()=>{jt(!0)},(n.duration+.5)*1e3);return()=>clearTimeout(t)}},[r,x,n.duration]);const $=P==="linear"?At.curveLinear:P==="step"?ht.curveStep:P==="stepAfter"?ht.stepAfter:P==="stepBefore"?ht.stepBefore:ht.monotoneX,[q,st]=y.useState(void 0),[ot,rt]=y.useState(void 0),[b,A]=y.useState(void 0),g={top:gt,bottom:J,left:U?R+30:R,right:yt},lt=y.useRef(null),i=qt.orderBy(V.map(t=>({...t,date:h.parse(`${t.date}`,o,new Date)})),["date"],["asc"]),ct=N.map(t=>({...t,coordinates:[t.coordinates[0]===null?null:h.parse(`${t.coordinates[0]}`,o,new Date),t.coordinates[1]===null?null:h.parse(`${t.coordinates[1]}`,o,new Date)]})),xt=F.map(t=>({...t,coordinates:t.coordinates.map((v,I)=>I%2===0?h.parse(`${v}`,o,new Date):v)})),u=O-g.left-g.right,f=G-g.top-g.bottom,ut=et?h.parse(`${et}`,o,new Date):i[0].date,m=it?h.parse(`${it}`,o,new Date):i[i.length-1].date,B=Math.min(...i.map(t=>t.y1))!==1/0?Math.min(...i.map(t=>t.y1))>0?0:Math.min(...i.map(t=>t.y1)):0,Ot=Math.min(...i.map(t=>t.y2))!==1/0?Math.min(...i.map(t=>t.y2))>0?0:Math.min(...i.map(t=>t.y2)):0,Nt=Math.max(...i.map(t=>t.y1))!==1/0?Math.max(...i.map(t=>t.y1)):0,It=Math.max(...i.map(t=>t.y2))!==1/0?Math.max(...i.map(t=>t.y2)):0,C=T.checkIfNullOrUndefined(k)?B<Ot?B:Ot:k,wt=Nt>It?Nt:It,a=Yt.time().domain([ut,m]).range([0,u]),s=Xt.linear().domain([T.checkIfNullOrUndefined(k)?C:k,T.checkIfNullOrUndefined(X)?wt>0?wt:0:X]).range([f,0]).nice(),vt=At.line().x(t=>a(t.date)).y(t=>s(t.y1)).curve($),Vt=At.line().x(t=>a(t.date)).y(t=>s(t.y2)).curve($),Dt=Ct.area().x(t=>a(t.date)).y1(t=>s(t.y1)).y0(t=>s(t.y2)).curve($),St=Ct.area().x(t=>a(t.date)).y1(t=>s(t.y1)).y0(0).curve($),$t=Ct.area().x(t=>a(t.date)).y1(t=>s(t.y2)).y0(0).curve($),kt=s.ticks(tt),Lt=a.ticks(z);return y.useEffect(()=>{const t=I=>{const mt=i[Bt.bisectCenter(i.map(Rt=>Rt.date),a.invert(zt.pointer(I)[0]),0)];st(mt||i[i.length-1]),W?.(mt||i[i.length-1]),A(I.clientY),rt(I.clientX)},v=()=>{st(void 0),rt(void 0),A(void 0),W?.(void 0)};Ut.select(lt.current).on("mousemove",t).on("mouseout",v)},[a,i,W]),e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(j.motion.svg,{width:`${O}px`,height:`${G}px`,viewBox:`0 0 ${O} ${G}`,direction:"ltr",ref:at,children:e.jsxRuntimeExports.jsxs("g",{transform:`translate(${g.left},${g.top})`,children:[e.jsxRuntimeExports.jsx("clipPath",{id:`above${E}`,children:e.jsxRuntimeExports.jsx("path",{d:$t(i),style:{fill:"none"}})}),e.jsxRuntimeExports.jsx("clipPath",{id:`below${E}`,children:e.jsxRuntimeExports.jsx("path",{d:St(i),style:{fill:"none"}})}),e.jsxRuntimeExports.jsx(Wt.HighlightArea,{areaSettings:ct,width:u,height:f,scale:a,animate:n,isInView:r}),e.jsxRuntimeExports.jsx(bt.CustomArea,{areaSettings:xt,scaleX:a,scaleY:s,animate:n,isInView:r}),e.jsxRuntimeExports.jsx("g",{children:e.jsxRuntimeExports.jsxs("g",{children:[e.jsxRuntimeExports.jsx(Ht.YTicksAndGridLines,{values:kt.filter(t=>t!==0),y:kt.filter(t=>t!==0).map(t=>s(t)),x1:0-R,x2:u+g.right,styles:{gridLines:p?.yAxis?.gridLines,labels:p?.yAxis?.labels},classNames:{gridLines:d?.yAxis?.gridLines,labels:d?.yAxis?.labels},suffix:D,prefix:w,labelType:"secondary",showGridLines:!0,labelPos:"vertical",precision:S}),e.jsxRuntimeExports.jsx(Ft.Axis,{y1:s(C<0?0:C),y2:s(C<0?0:C),x1:0-R,x2:u+g.right,label:Et.numberFormattingFunction(C<0?0:C,"NA",S,w,D),labelPos:{x:0-R,y:s(C<0?0:C),dx:0,dy:wt<0?"1rem":-5},classNames:{axis:d?.xAxis?.axis,label:d?.yAxis?.labels},styles:{axis:p?.xAxis?.axis,label:p?.yAxis?.labels}}),e.jsxRuntimeExports.jsx(Mt.AxisTitle,{x:0-R-15,y:f/2,style:p?.yAxis?.title,className:d?.yAxis?.title,text:U,rotate90:!0})]})}),e.jsxRuntimeExports.jsx(Pt.XTicksAndGridLines,{values:Lt.map(t=>h.format(t,o)),x:Lt.map(t=>a(t)),y1:0,y2:f,styles:{gridLines:p?.xAxis?.gridLines,labels:p?.xAxis?.labels},classNames:{gridLines:e.mo("opacity-0",d?.xAxis?.gridLines),labels:e.mo("fill-primary-gray-700 dark:fill-primary-gray-300 xs:max-[360px]:hidden text-[9px] md:text-[10px] lg:text-xs",d?.xAxis?.labels)},suffix:D,prefix:w,labelType:"primary",showGridLines:!0,precision:S}),nt.filter(t=>t.position==="before").map(t=>t.layer),e.jsxRuntimeExports.jsxs("g",{children:[e.jsxRuntimeExports.jsx(j.motion.path,{clipPath:`url(#below${E})`,d:Dt(i)||"",style:{fill:Q[1]},exit:{opacity:0,transition:{duration:n.duration}},variants:{initial:{opacity:1},whileInView:{opacity:1,transition:{duration:n.duration}}},initial:"initial",animate:r?"whileInView":"initial"}),e.jsxRuntimeExports.jsx(j.motion.path,{clipPath:`url(#above${E})`,d:Dt(i)||"",style:{fill:Q[0]},exit:{opacity:0,transition:{duration:n.duration}},variants:{initial:{opacity:0},whileInView:{opacity:1,transition:{duration:n.duration}}},initial:"initial",animate:r?"whileInView":"initial"})]}),e.jsxRuntimeExports.jsxs("g",{children:[e.jsxRuntimeExports.jsx(j.motion.path,{d:vt(i)||"",style:{fill:"none",stroke:l[0],strokeWidth:Z},exit:{opacity:0,transition:{duration:n.duration}},variants:{initial:{pathLength:0,d:vt(i)||"",opacity:1},whileInView:{pathLength:1,d:vt(i)||"",opacity:1,transition:{duration:n.duration}}},initial:"initial",animate:r?"whileInView":"initial"}),e.jsxRuntimeExports.jsx(j.motion.path,{style:{fill:"none",stroke:l[1],strokeWidth:Z},exit:{opacity:0,transition:{duration:n.duration}},variants:{initial:{pathLength:0,d:Vt(i)||"",opacity:1},whileInView:{pathLength:1,d:Vt(i)||"",opacity:1,transition:{duration:n.duration}}},initial:"initial",animate:r?"whileInView":"initial"}),ft?null:e.jsxRuntimeExports.jsxs("g",{children:[e.jsxRuntimeExports.jsx(j.motion.text,{className:"text-xs",dx:5,dy:4,exit:{opacity:0,transition:{duration:n.duration}},variants:{initial:{opacity:0,x:a(i[i.length-1].date),y:s(i[i.length-1].y1),fill:l[0]},whileInView:{opacity:1,x:a(i[i.length-1].date),y:s(i[i.length-1].y1),fill:l[0],transition:{duration:x?n.duration:.5,delay:x?0:n.duration}}},initial:"initial",animate:r?"whileInView":"initial",children:M[0]},M[0]),e.jsxRuntimeExports.jsx(j.motion.text,{className:"text-xs",dx:5,dy:4,exit:{opacity:0,transition:{duration:n.duration}},variants:{initial:{opacity:0,x:a(i[i.length-1].date),y:s(i[i.length-1].y2),fill:l[1]},whileInView:{opacity:1,x:a(i[i.length-1].date),y:s(i[i.length-1].y2),fill:l[1],transition:{duration:x?n.duration:.5,delay:x?0:n.duration}}},initial:"initial",animate:r?"whileInView":"initial",children:M[1]},M[1])]}),q?e.jsxRuntimeExports.jsx("line",{y1:0,y2:f,x1:a(q.date),x2:a(q.date),className:e.mo("undp-tick-line stroke-primary-gray-700 dark:stroke-primary-gray-100",d?.mouseOverLine),style:p?.mouseOverLine}):null,i.map((t,v)=>e.jsxRuntimeExports.jsxs(j.motion.g,{children:[T.checkIfNullOrUndefined(t.y1)?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[_?e.jsxRuntimeExports.jsx(j.motion.circle,{r:u/i.length<5?0:u/i.length<20?2:4,exit:{opacity:0,transition:{duration:n.duration}},variants:{initial:{opacity:0,cx:a(t.date),cy:s(t.y1),fill:l[0]},whileInView:{opacity:1,fill:l[0],transition:{duration:.5,delay:n.duration},cx:a(t.date),cy:s(t.y1)}},initial:"initial",animate:r?"whileInView":"initial"}):null,c?e.jsxRuntimeExports.jsx(j.motion.text,{dy:t.y2<t.y1?-8:"1em",style:{textAnchor:"middle",...p?.graphObjectValues||{}},className:e.mo("graph-value graph-value-line-1 text-xs font-bold",d?.graphObjectValues),exit:{opacity:0,transition:{duration:n.duration}},variants:{initial:{opacity:0,x:a(t.date),y:s(t.y1),fill:l[0]},whileInView:{opacity:1,fill:l[0],x:a(t.date),y:s(t.y1),transition:{duration:x?n.duration:.5,delay:x?0:n.duration}}},initial:"initial",animate:r?"whileInView":"initial",children:Et.numberFormattingFunction(t.y1,"NA",S,w,D)}):null]}),T.checkIfNullOrUndefined(t.y2)?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[_?e.jsxRuntimeExports.jsx(j.motion.circle,{r:u/i.length<5?0:u/i.length<20?2:4,exit:{opacity:0,transition:{duration:n.duration}},variants:{initial:{opacity:0,cx:a(t.date),cy:s(t.y2),fill:l[1]},whileInView:{opacity:1,fill:l[1],transition:{duration:x?n.duration:.5,delay:x?0:n.duration},cx:a(t.date),cy:s(t.y2)}},initial:"initial",animate:r?"whileInView":"initial"}):null,c?e.jsxRuntimeExports.jsx(j.motion.text,{dy:t.y2>t.y1?-8:"1em",style:{textAnchor:"middle",...p?.graphObjectValues||{}},className:e.mo("graph-value graph-value-line-2 text-xs font-bold",d?.graphObjectValues),exit:{opacity:0,transition:{duration:n.duration}},variants:{initial:{opacity:0,x:a(t.date),y:s(t.y2),fill:l[1]},whileInView:{opacity:1,x:a(t.date),y:s(t.y2),fill:l[1],transition:{duration:x?n.duration:.5,delay:x?0:n.duration}}},initial:"initial",animate:r?"whileInView":"initial",children:Et.numberFormattingFunction(t.y2,"NA",S,w,D)}):null]})]},v))]}),Y?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:Y.map((t,v)=>e.jsxRuntimeExports.jsx(Gt.RefLineY,{text:t.text,color:t.color,y:s(t.value),x1:0-R,x2:u+g.right,classNames:t.classNames,styles:t.styles,animate:n,isInView:r},v))}):null,e.jsxRuntimeExports.jsx("g",{children:L.map((t,v)=>{const I=bt.getLineEndPoint({x:t.xCoordinate?a(h.parse(`${t.xCoordinate}`,o,new Date))+(t.xOffset||0):0+(t.xOffset||0),y:t.yCoordinate?s(t.yCoordinate)+(t.yOffset||0)-8:0+(t.yOffset||0)-8},{x:t.xCoordinate?a(h.parse(`${t.xCoordinate}`,o,new Date)):0,y:t.yCoordinate?s(t.yCoordinate):0},T.checkIfNullOrUndefined(t.connectorRadius)?3.5:t.connectorRadius),mt=t.showConnector?{y1:I.y,x1:I.x,y2:t.yCoordinate?s(t.yCoordinate)+(t.yOffset||0):0+(t.yOffset||0),x2:t.xCoordinate?a(h.parse(`${t.xCoordinate}`,o,new Date))+(t.xOffset||0):0+(t.xOffset||0),cy:t.yCoordinate?s(t.yCoordinate):0,cx:t.xCoordinate?a(h.parse(`${t.xCoordinate}`,o,new Date)):0,circleRadius:T.checkIfNullOrUndefined(t.connectorRadius)?3.5:t.connectorRadius,strokeWidth:t.showConnector===!0?2:Math.min(t.showConnector||0,1)}:void 0,Rt={y:t.yCoordinate?s(t.yCoordinate)+(t.yOffset||0)-8:0+(t.yOffset||0)-8,x:K?0:t.xCoordinate?a(h.parse(`${t.xCoordinate}`,o,new Date))+(t.xOffset||0):0+(t.xOffset||0),width:K?t.xCoordinate?a(h.parse(`${t.xCoordinate}`,o,new Date))+(t.xOffset||0):0+(t.xOffset||0):u+g.right-(t.xCoordinate?a(h.parse(`${t.xCoordinate}`,o,new Date))+(t.xOffset||0):0+(t.xOffset||0)),maxWidth:t.maxWidth,fontWeight:t.fontWeight,align:t.align};return e.jsxRuntimeExports.jsx(bt.Annotation,{color:t.color,connectorsSettings:mt,labelSettings:Rt,text:t.text,classNames:t.classNames,styles:t.styles,animate:n,isInView:r},v)})}),nt.filter(t=>t.position==="after").map(t=>t.layer),e.jsxRuntimeExports.jsx("rect",{ref:lt,style:{fill:"none",pointerEvents:"all"},width:u,height:f})]})}),q&&H&&ot&&b?e.jsxRuntimeExports.jsx(Tt.Tooltip,{data:q,body:H,xPos:ot,yPos:b,backgroundStyle:p?.tooltip,className:d?.tooltip}):null]})}function ie(dt){const{data:V,graphTitle:O,suffix:G="",sources:l,prefix:D="",graphDescription:w,height:o,width:c,footNote:z,noOfXTicks:yt=10,dateFormat:R="yyyy",showValues:gt=!1,padding:J,lineColors:H=[pt.Colors.light.categoricalColors.colors[0],pt.Colors.light.categoricalColors.colors[1]],backgroundColor:N=!1,leftMargin:W=30,rightMargin:n=50,topMargin:K=20,bottomMargin:ft=25,tooltip:M,highlightAreaSettings:Q=[],relativeHeight:E,onSeriesMouseOver:Z,graphID:_,graphDownload:Y=!1,dataDownload:k=!1,animate:X=!1,language:L="en",minHeight:F=0,labels:U,showColorLegendAtTop:tt=!1,colorLegendTitle:et,diffAreaColors:it=[pt.Colors.alerts.red,pt.Colors.alerts.darkGreen],strokeWidth:P=2,showDots:p=!0,refValues:d=[],minValue:S,maxValue:nt,annotations:at=[],customHighlightAreaSettings:r=[],theme:x="light",ariaLabel:jt,yAxisTitle:$,noOfYTicks:q=5,minDate:st,maxDate:ot,curveType:rt="curve",styles:b,classNames:A,precision:g=2,customLayers:lt=[]}=dt,[i,ct]=y.useState(0),[xt,u]=y.useState(0),f=y.useRef(null),ut=y.useRef(null);return y.useEffect(()=>{const m=new ResizeObserver(B=>{ct(c||B[0].target.clientWidth||620),u(o||B[0].target.clientHeight||480)});return f.current&&(u(f.current.clientHeight||480),ct(f.current.clientWidth||620),c||m.observe(f.current)),()=>m.disconnect()},[c,o]),e.jsxRuntimeExports.jsx("div",{className:`${x||"light"} flex ${c?"w-fit grow-0":"w-full grow"}`,dir:L==="he"||L==="ar"?"rtl":void 0,children:e.jsxRuntimeExports.jsx("div",{className:e.mo(`${N?N===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${L||"en"}`,c?"w-fit":"w-full",A?.graphContainer),style:{...b?.graphContainer||{},...N&&N!==!0?{backgroundColor:N}:{}},id:_,ref:ut,"aria-label":jt||`${O?`The graph shows ${O}. `:""}This is a line chart that highlights the difference between two datasets over time.${w?` ${w}`:""}`,children:e.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:N?J||"1rem":J||0},children:e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[O||w||Y||k?e.jsxRuntimeExports.jsx(Qt.GraphHeader,{styles:{title:b?.title,description:b?.description},classNames:{title:A?.title,description:A?.description},graphTitle:O,graphDescription:w,width:c,graphDownload:Y?ut.current:void 0,dataDownload:k?V.map(m=>m.data).filter(m=>m!==void 0).length>0?V.map(m=>m.data).filter(m=>m!==void 0):V.filter(m=>m!==void 0):null}):null,e.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:V.length===0?e.jsxRuntimeExports.jsx(te.EmptyState,{}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[tt?e.jsxRuntimeExports.jsx(Zt.ColorLegend,{colorDomain:U,colorLegendTitle:et,colors:H,showNAColor:!1}):null,e.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:f,"aria-label":"Graph area",children:(c||i)&&(o||xt)?e.jsxRuntimeExports.jsx(ee,{data:V,lineColors:H,colorDomain:U,width:c||i,height:Math.max(F,o||(E?F?(c||i)*E>F?(c||i)*E:F:(c||i)*E:xt)),suffix:G,prefix:D,dateFormat:R,showValues:gt,noOfXTicks:yt,leftMargin:W,rightMargin:n,topMargin:K,bottomMargin:ft,highlightAreaSettings:Q,tooltip:M,onSeriesMouseOver:Z,showColorLegendAtTop:tt,animate:X===!0?{duration:.5,once:!0,amount:.5}:X||{duration:0,once:!0,amount:0},rtl:L==="he"||L==="ar",diffAreaColors:it,idSuffix:_t.generateRandomString(8),strokeWidth:P,showDots:p,refValues:d,minValue:S,maxValue:nt,annotations:at,customHighlightAreaSettings:r,yAxisTitle:$,noOfYTicks:q,minDate:st,maxDate:ot,curveType:rt,styles:b,classNames:A,precision:g,customLayers:lt}):null})]})}),l||z?e.jsxRuntimeExports.jsx(Kt.GraphFooter,{styles:{footnote:b?.footnote,source:b?.source},classNames:{footnote:A?.footnote,source:A?.source},sources:l,footNote:z,width:c}):null]})})})})}exports.DifferenceLineChart=ie;
2
2
  //# sourceMappingURL=DifferenceLineChart.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"DifferenceLineChart.cjs","sources":["../src/Components/Graphs/LineCharts/DifferenceLineChart/Graph.tsx","../src/Components/Graphs/LineCharts/DifferenceLineChart/index.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\r\nimport {\r\n line,\r\n curveMonotoneX,\r\n area,\r\n curveLinear,\r\n curveStep,\r\n curveStepAfter,\r\n curveStepBefore,\r\n} from 'd3-shape';\r\nimport { scaleLinear, scaleTime } from 'd3-scale';\r\nimport { format } from 'date-fns/format';\r\nimport { parse } from 'date-fns/parse';\r\nimport { bisectCenter } from 'd3-array';\r\nimport { pointer, select } from 'd3-selection';\r\nimport { motion, useInView } from 'motion/react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport orderBy from 'lodash.orderby';\r\n\r\nimport {\r\n AnimateDataType,\r\n AnnotationSettingsDataType,\r\n ClassNameObject,\r\n CurveTypes,\r\n CustomHighlightAreaSettingsDataType,\r\n CustomLayerDataType,\r\n DifferenceLineChartDataType,\r\n HighlightAreaSettingsDataType,\r\n ReferenceDataType,\r\n StyleObject,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { getLineEndPoint } from '@/Utils/getLineEndPoint';\r\nimport { AxisTitle } from '@/Components/Elements/Axes/AxisTitle';\r\nimport { Axis } from '@/Components/Elements/Axes/Axis';\r\nimport { XTicksAndGridLines } from '@/Components/Elements/Axes/XTicksAndGridLines';\r\nimport { RefLineY } from '@/Components/Elements/ReferenceLine';\r\nimport { Annotation } from '@/Components/Elements/Annotations';\r\nimport { YTicksAndGridLines } from '@/Components/Elements/Axes/YTicksAndGridLines';\r\nimport { HighlightArea } from '@/Components/Elements/HighlightArea';\r\nimport { CustomArea } from '@/Components/Elements/HighlightArea/customArea';\r\n\r\ninterface Props {\r\n data: DifferenceLineChartDataType[];\r\n lineColors: [string, string];\r\n diffAreaColors: [string, string];\r\n width: number;\r\n height: number;\r\n suffix: string;\r\n prefix: string;\r\n dateFormat: string;\r\n showValues: boolean;\r\n noOfXTicks: number;\r\n rightMargin: number;\r\n leftMargin: number;\r\n topMargin: number;\r\n bottomMargin: number;\r\n highlightAreaSettings: HighlightAreaSettingsDataType[];\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n animate: AnimateDataType;\r\n rtl: boolean;\r\n colorDomain: [string, string];\r\n showColorLegendAtTop?: boolean;\r\n idSuffix: string;\r\n strokeWidth: number;\r\n showDots: boolean;\r\n refValues: ReferenceDataType[];\r\n maxValue?: number;\r\n minValue?: number;\r\n annotations: AnnotationSettingsDataType[];\r\n customHighlightAreaSettings: CustomHighlightAreaSettingsDataType[];\r\n yAxisTitle?: string;\r\n noOfYTicks: number;\r\n minDate?: string | number;\r\n maxDate?: string | number;\r\n curveType: CurveTypes;\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n precision: number;\r\n customLayers: CustomLayerDataType[];\r\n}\r\n\r\ninterface FormattedDataType {\r\n y1: number;\r\n y2: number;\r\n date: Date;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n width,\r\n height,\r\n lineColors,\r\n suffix,\r\n prefix,\r\n dateFormat,\r\n showValues,\r\n noOfXTicks,\r\n rightMargin,\r\n leftMargin,\r\n topMargin,\r\n bottomMargin,\r\n tooltip,\r\n highlightAreaSettings,\r\n onSeriesMouseOver,\r\n animate,\r\n rtl,\r\n showColorLegendAtTop,\r\n colorDomain,\r\n diffAreaColors,\r\n idSuffix,\r\n strokeWidth,\r\n showDots,\r\n refValues,\r\n minValue,\r\n maxValue,\r\n annotations,\r\n customHighlightAreaSettings,\r\n yAxisTitle,\r\n noOfYTicks,\r\n minDate,\r\n maxDate,\r\n curveType,\r\n styles,\r\n classNames,\r\n precision,\r\n customLayers,\r\n } = props;\r\n const svgRef = useRef(null);\r\n const isInView = useInView(svgRef, {\r\n once: animate.once,\r\n amount: animate.amount,\r\n });\r\n const [hasAnimatedOnce, setHasAnimatedOnce] = useState(false);\r\n\r\n useEffect(() => {\r\n if (isInView && !hasAnimatedOnce) {\r\n const timeout = setTimeout(\r\n () => {\r\n setHasAnimatedOnce(true);\r\n },\r\n (animate.duration + 0.5) * 1000,\r\n );\r\n return () => clearTimeout(timeout);\r\n }\r\n }, [isInView, hasAnimatedOnce, animate.duration]);\r\n const curve =\r\n curveType === 'linear'\r\n ? curveLinear\r\n : curveType === 'step'\r\n ? curveStep\r\n : curveType === 'stepAfter'\r\n ? curveStepAfter\r\n : curveType === 'stepBefore'\r\n ? curveStepBefore\r\n : curveMonotoneX;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n const margin = {\r\n top: topMargin,\r\n bottom: bottomMargin,\r\n left: yAxisTitle ? leftMargin + 30 : leftMargin,\r\n right: rightMargin,\r\n };\r\n const MouseoverRectRef = useRef(null);\r\n const dataFormatted = orderBy(\r\n data.map(d => ({\r\n ...d,\r\n date: parse(`${d.date}`, dateFormat, new Date()),\r\n })),\r\n ['date'],\r\n ['asc'],\r\n );\r\n const highlightAreaSettingsFormatted = highlightAreaSettings.map(d => ({\r\n ...d,\r\n coordinates: [\r\n d.coordinates[0] === null ? null : parse(`${d.coordinates[0]}`, dateFormat, new Date()),\r\n d.coordinates[1] === null ? null : parse(`${d.coordinates[1]}`, dateFormat, new Date()),\r\n ],\r\n }));\r\n const customHighlightAreaSettingsFormatted = customHighlightAreaSettings.map(d => ({\r\n ...d,\r\n coordinates: d.coordinates.map((el, j) =>\r\n j % 2 === 0 ? parse(`${el}`, dateFormat, new Date()) : (el as number),\r\n ),\r\n }));\r\n const graphWidth = width - margin.left - margin.right;\r\n const graphHeight = height - margin.top - margin.bottom;\r\n const minYear = minDate ? parse(`${minDate}`, dateFormat, new Date()) : dataFormatted[0].date;\r\n const maxYear = maxDate\r\n ? parse(`${maxDate}`, dateFormat, new Date())\r\n : dataFormatted[dataFormatted.length - 1].date;\r\n const minParam1 =\r\n Math.min(...dataFormatted.map(d => d.y1)) !== Infinity\r\n ? Math.min(...dataFormatted.map(d => d.y1)) > 0\r\n ? 0\r\n : Math.min(...dataFormatted.map(d => d.y1))\r\n : 0;\r\n const minParam2 =\r\n Math.min(...dataFormatted.map(d => d.y2)) !== Infinity\r\n ? Math.min(...dataFormatted.map(d => d.y2)) > 0\r\n ? 0\r\n : Math.min(...dataFormatted.map(d => d.y2))\r\n : 0;\r\n const maxParam1 =\r\n Math.max(...dataFormatted.map(d => d.y1)) !== Infinity\r\n ? Math.max(...dataFormatted.map(d => d.y1))\r\n : 0;\r\n const maxParam2 =\r\n Math.max(...dataFormatted.map(d => d.y2)) !== Infinity\r\n ? Math.max(...dataFormatted.map(d => d.y2))\r\n : 0;\r\n\r\n const minParam = checkIfNullOrUndefined(minValue)\r\n ? minParam1 < minParam2\r\n ? minParam1\r\n : minParam2\r\n : (minValue as number);\r\n const maxParam = maxParam1 > maxParam2 ? maxParam1 : maxParam2;\r\n const x = scaleTime().domain([minYear, maxYear]).range([0, graphWidth]);\r\n\r\n const y = scaleLinear()\r\n .domain([\r\n checkIfNullOrUndefined(minValue) ? minParam : (minValue as number),\r\n checkIfNullOrUndefined(maxValue) ? (maxParam > 0 ? maxParam : 0) : (maxValue as number),\r\n ])\r\n .range([graphHeight, 0])\r\n .nice();\r\n\r\n const lineShape1 = line<FormattedDataType>()\r\n .x(d => x(d.date))\r\n .y(d => y(d.y1))\r\n .curve(curve);\r\n\r\n const lineShape2 = line<FormattedDataType>()\r\n .x(d => x(d.date))\r\n .y(d => y(d.y2))\r\n .curve(curve);\r\n\r\n const mainGraphArea = area<FormattedDataType>()\r\n .x(d => x(d.date))\r\n .y1(d => y(d.y1))\r\n .y0(d => y(d.y2))\r\n .curve(curve);\r\n const mainGraphArea1 = area<FormattedDataType>()\r\n .x(d => x(d.date))\r\n .y1(d => y(d.y1))\r\n .y0(0)\r\n .curve(curve);\r\n const mainGraphArea2 = area<FormattedDataType>()\r\n .x(d => x(d.date))\r\n .y1(d => y(d.y2))\r\n .y0(0)\r\n .curve(curve);\r\n const yTicks = y.ticks(noOfYTicks);\r\n const xTicks = x.ticks(noOfXTicks);\r\n useEffect(() => {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const mousemove = (event: any) => {\r\n const selectedData =\r\n dataFormatted[\r\n bisectCenter(\r\n dataFormatted.map(d => d.date),\r\n x.invert(pointer(event)[0]),\r\n 0,\r\n )\r\n ];\r\n setMouseOverData(selectedData || dataFormatted[dataFormatted.length - 1]);\r\n onSeriesMouseOver?.(selectedData || dataFormatted[dataFormatted.length - 1]);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n };\r\n const mouseout = () => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n };\r\n select(MouseoverRectRef.current).on('mousemove', mousemove).on('mouseout', mouseout);\r\n }, [x, dataFormatted, onSeriesMouseOver]);\r\n return (\r\n <>\r\n <motion.svg\r\n width={`${width}px`}\r\n height={`${height}px`}\r\n viewBox={`0 0 ${width} ${height}`}\r\n direction='ltr'\r\n ref={svgRef}\r\n >\r\n <g transform={`translate(${margin.left},${margin.top})`}>\r\n <clipPath id={`above${idSuffix}`}>\r\n <path\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d={mainGraphArea2(dataFormatted as any) as string}\r\n style={{ fill: 'none' }}\r\n />\r\n </clipPath>\r\n <clipPath id={`below${idSuffix}`}>\r\n <path\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d={mainGraphArea1(dataFormatted as any) as string}\r\n style={{ fill: 'none' }}\r\n />\r\n </clipPath>\r\n <HighlightArea\r\n areaSettings={highlightAreaSettingsFormatted}\r\n width={graphWidth}\r\n height={graphHeight}\r\n scale={x}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n <CustomArea\r\n areaSettings={customHighlightAreaSettingsFormatted}\r\n scaleX={x}\r\n scaleY={y}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n <g>\r\n <g>\r\n <YTicksAndGridLines\r\n values={yTicks.filter(d => d !== 0)}\r\n y={yTicks.filter(d => d !== 0).map(d => y(d))}\r\n x1={0 - leftMargin}\r\n x2={graphWidth + margin.right}\r\n styles={{\r\n gridLines: styles?.yAxis?.gridLines,\r\n labels: styles?.yAxis?.labels,\r\n }}\r\n classNames={{\r\n gridLines: classNames?.yAxis?.gridLines,\r\n labels: classNames?.yAxis?.labels,\r\n }}\r\n suffix={suffix}\r\n prefix={prefix}\r\n labelType='secondary'\r\n showGridLines\r\n labelPos='vertical'\r\n precision={precision}\r\n />\r\n <Axis\r\n y1={y(minParam < 0 ? 0 : minParam)}\r\n y2={y(minParam < 0 ? 0 : minParam)}\r\n x1={0 - leftMargin}\r\n x2={graphWidth + margin.right}\r\n label={numberFormattingFunction(\r\n minParam < 0 ? 0 : minParam,\r\n 'NA',\r\n precision,\r\n prefix,\r\n suffix,\r\n )}\r\n labelPos={{\r\n x: 0 - leftMargin,\r\n y: y(minParam < 0 ? 0 : minParam),\r\n dx: 0,\r\n dy: maxParam < 0 ? '1rem' : -5,\r\n }}\r\n classNames={{\r\n axis: classNames?.xAxis?.axis,\r\n label: classNames?.yAxis?.labels,\r\n }}\r\n styles={{\r\n axis: styles?.xAxis?.axis,\r\n label: styles?.yAxis?.labels,\r\n }}\r\n />\r\n <AxisTitle\r\n x={0 - leftMargin - 15}\r\n y={graphHeight / 2}\r\n style={styles?.yAxis?.title}\r\n className={classNames?.yAxis?.title}\r\n text={yAxisTitle}\r\n rotate90\r\n />\r\n </g>\r\n </g>\r\n <XTicksAndGridLines\r\n values={xTicks.map(d => format(d, dateFormat))}\r\n x={xTicks.map(d => x(d))}\r\n y1={0}\r\n y2={graphHeight}\r\n styles={{\r\n gridLines: styles?.xAxis?.gridLines,\r\n labels: styles?.xAxis?.labels,\r\n }}\r\n classNames={{\r\n gridLines: cn('opacity-0', classNames?.xAxis?.gridLines),\r\n labels: cn(\r\n 'fill-primary-gray-700 dark:fill-primary-gray-300 xs:max-[360px]:hidden text-[9px] md:text-[10px] lg:text-xs',\r\n classNames?.xAxis?.labels,\r\n ),\r\n }}\r\n suffix={suffix}\r\n prefix={prefix}\r\n labelType='primary'\r\n showGridLines\r\n precision={precision}\r\n />\r\n {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n <g>\r\n <motion.path\r\n clipPath={`url(#below${idSuffix})`}\r\n d={mainGraphArea(dataFormatted) || ''}\r\n style={{ fill: diffAreaColors[1] }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 1 },\r\n whileInView: { opacity: 1, transition: { duration: animate.duration } },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n <motion.path\r\n clipPath={`url(#above${idSuffix})`}\r\n d={mainGraphArea(dataFormatted) || ''}\r\n style={{ fill: diffAreaColors[0] }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 0 },\r\n whileInView: { opacity: 1, transition: { duration: animate.duration } },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n </g>\r\n <g>\r\n <motion.path\r\n d={lineShape1(dataFormatted) || ''}\r\n style={{\r\n fill: 'none',\r\n stroke: lineColors[0],\r\n strokeWidth,\r\n }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { pathLength: 0, d: lineShape1(dataFormatted) || '', opacity: 1 },\r\n whileInView: {\r\n pathLength: 1,\r\n d: lineShape1(dataFormatted) || '',\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n <motion.path\r\n style={{\r\n fill: 'none',\r\n stroke: lineColors[1],\r\n strokeWidth,\r\n }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { pathLength: 0, d: lineShape2(dataFormatted) || '', opacity: 1 },\r\n whileInView: {\r\n pathLength: 1,\r\n d: lineShape2(dataFormatted) || '',\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n {showColorLegendAtTop ? null : (\r\n <g>\r\n <motion.text\r\n key={colorDomain[0]}\r\n style={{ fill: lineColors[0] }}\r\n className='text-xs'\r\n dx={5}\r\n dy={4}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: {\r\n opacity: 0,\r\n x: x(dataFormatted[dataFormatted.length - 1].date),\r\n y: y(dataFormatted[dataFormatted.length - 1].y1 as number),\r\n },\r\n whileInView: {\r\n opacity: 1,\r\n x: x(dataFormatted[dataFormatted.length - 1].date),\r\n y: y(dataFormatted[dataFormatted.length - 1].y1 as number),\r\n transition: {\r\n duration: hasAnimatedOnce ? animate.duration : 0.5,\r\n delay: hasAnimatedOnce ? 0 : animate.duration,\r\n },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n >\r\n {colorDomain[0]}\r\n </motion.text>\r\n <motion.text\r\n key={colorDomain[1]}\r\n style={{ fill: lineColors[1] }}\r\n className='text-xs'\r\n dx={5}\r\n dy={4}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: {\r\n opacity: 0,\r\n x: x(dataFormatted[dataFormatted.length - 1].date),\r\n y: y(dataFormatted[dataFormatted.length - 1].y2 as number),\r\n },\r\n whileInView: {\r\n opacity: 1,\r\n x: x(dataFormatted[dataFormatted.length - 1].date),\r\n y: y(dataFormatted[dataFormatted.length - 1].y2 as number),\r\n transition: {\r\n duration: hasAnimatedOnce ? animate.duration : 0.5,\r\n delay: hasAnimatedOnce ? 0 : animate.duration,\r\n },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n >\r\n {colorDomain[1]}\r\n </motion.text>\r\n </g>\r\n )}\r\n {mouseOverData ? (\r\n <line\r\n y1={0}\r\n y2={graphHeight}\r\n x1={x(mouseOverData.date)}\r\n x2={x(mouseOverData.date)}\r\n className={cn(\r\n 'undp-tick-line stroke-primary-gray-700 dark:stroke-primary-gray-100',\r\n classNames?.mouseOverLine,\r\n )}\r\n style={styles?.mouseOverLine}\r\n />\r\n ) : null}\r\n {dataFormatted.map((d, i) => (\r\n <motion.g key={i}>\r\n {!checkIfNullOrUndefined(d.y1) ? (\r\n <>\r\n {showDots ? (\r\n <motion.circle\r\n r={\r\n graphWidth / dataFormatted.length < 5\r\n ? 0\r\n : graphWidth / dataFormatted.length < 20\r\n ? 2\r\n : 4\r\n }\r\n style={{ fill: lineColors[0] }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 0, cx: x(d.date), cy: y(d.y1) },\r\n whileInView: {\r\n opacity: 1,\r\n transition: { duration: 0.5, delay: animate.duration },\r\n cx: x(d.date),\r\n cy: y(d.y1),\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n ) : null}\r\n {showValues ? (\r\n <motion.text\r\n dy={d.y2 < d.y1 ? -8 : '1em'}\r\n style={{\r\n fill: lineColors[0],\r\n textAnchor: 'middle',\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n className={cn(\r\n 'graph-value graph-value-line-1 text-xs font-bold',\r\n classNames?.graphObjectValues,\r\n )}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 0, x: x(d.date), y: y(d.y1) },\r\n whileInView: {\r\n opacity: 1,\r\n x: x(d.date),\r\n y: y(d.y1),\r\n transition: {\r\n duration: hasAnimatedOnce ? animate.duration : 0.5,\r\n delay: hasAnimatedOnce ? 0 : animate.duration,\r\n },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n >\r\n {numberFormattingFunction(d.y1, 'NA', precision, prefix, suffix)}\r\n </motion.text>\r\n ) : null}\r\n </>\r\n ) : null}\r\n {!checkIfNullOrUndefined(d.y2) ? (\r\n <>\r\n {showDots ? (\r\n <motion.circle\r\n r={\r\n graphWidth / dataFormatted.length < 5\r\n ? 0\r\n : graphWidth / dataFormatted.length < 20\r\n ? 2\r\n : 4\r\n }\r\n style={{ fill: lineColors[1] }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 0, cx: x(d.date), cy: y(d.y2) },\r\n whileInView: {\r\n opacity: 1,\r\n transition: {\r\n duration: hasAnimatedOnce ? animate.duration : 0.5,\r\n delay: hasAnimatedOnce ? 0 : animate.duration,\r\n },\r\n cx: x(d.date),\r\n cy: y(d.y2),\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n ) : null}\r\n {showValues ? (\r\n <motion.text\r\n dy={d.y2 > d.y1 ? -8 : '1em'}\r\n style={{\r\n fill: lineColors[1],\r\n textAnchor: 'middle',\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n className={cn(\r\n 'graph-value graph-value-line-2 text-xs font-bold',\r\n classNames?.graphObjectValues,\r\n )}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 0, x: x(d.date), y: y(d.y2) },\r\n whileInView: {\r\n opacity: 1,\r\n x: x(d.date),\r\n y: y(d.y2),\r\n transition: {\r\n duration: hasAnimatedOnce ? animate.duration : 0.5,\r\n delay: hasAnimatedOnce ? 0 : animate.duration,\r\n },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n >\r\n {numberFormattingFunction(d.y2, 'NA', precision, prefix, suffix)}\r\n </motion.text>\r\n ) : null}\r\n </>\r\n ) : null}\r\n </motion.g>\r\n ))}\r\n </g>\r\n {refValues ? (\r\n <>\r\n {refValues.map((el, i) => (\r\n <RefLineY\r\n key={i}\r\n text={el.text}\r\n color={el.color}\r\n y={y(el.value as number)}\r\n x1={0 - leftMargin}\r\n x2={graphWidth + margin.right}\r\n classNames={el.classNames}\r\n styles={el.styles}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n ))}\r\n </>\r\n ) : null}\r\n <g>\r\n {annotations.map((d, i) => {\r\n const endPoints = getLineEndPoint(\r\n {\r\n x: d.xCoordinate\r\n ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) + (d.xOffset || 0)\r\n : 0 + (d.xOffset || 0),\r\n y: d.yCoordinate\r\n ? y(d.yCoordinate as number) + (d.yOffset || 0) - 8\r\n : 0 + (d.yOffset || 0) - 8,\r\n },\r\n {\r\n x: d.xCoordinate ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) : 0,\r\n y: d.yCoordinate ? y(d.yCoordinate as number) : 0,\r\n },\r\n checkIfNullOrUndefined(d.connectorRadius) ? 3.5 : (d.connectorRadius as number),\r\n );\r\n const connectorSettings = d.showConnector\r\n ? {\r\n y1: endPoints.y,\r\n x1: endPoints.x,\r\n y2: d.yCoordinate\r\n ? y(d.yCoordinate as number) + (d.yOffset || 0)\r\n : 0 + (d.yOffset || 0),\r\n x2: d.xCoordinate\r\n ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) + (d.xOffset || 0)\r\n : 0 + (d.xOffset || 0),\r\n cy: d.yCoordinate ? y(d.yCoordinate as number) : 0,\r\n cx: d.xCoordinate ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) : 0,\r\n circleRadius: checkIfNullOrUndefined(d.connectorRadius)\r\n ? 3.5\r\n : (d.connectorRadius as number),\r\n strokeWidth: d.showConnector === true ? 2 : Math.min(d.showConnector || 0, 1),\r\n }\r\n : undefined;\r\n const labelSettings = {\r\n y: d.yCoordinate\r\n ? y(d.yCoordinate as number) + (d.yOffset || 0) - 8\r\n : 0 + (d.yOffset || 0) - 8,\r\n x: rtl\r\n ? 0\r\n : d.xCoordinate\r\n ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) + (d.xOffset || 0)\r\n : 0 + (d.xOffset || 0),\r\n width: rtl\r\n ? d.xCoordinate\r\n ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) + (d.xOffset || 0)\r\n : 0 + (d.xOffset || 0)\r\n : graphWidth +\r\n margin.right -\r\n (d.xCoordinate\r\n ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) + (d.xOffset || 0)\r\n : 0 + (d.xOffset || 0)),\r\n maxWidth: d.maxWidth,\r\n fontWeight: d.fontWeight,\r\n align: d.align,\r\n };\r\n return (\r\n <Annotation\r\n key={i}\r\n color={d.color}\r\n connectorsSettings={connectorSettings}\r\n labelSettings={labelSettings}\r\n text={d.text}\r\n classNames={d.classNames}\r\n styles={d.styles}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n );\r\n })}\r\n </g>\r\n {customLayers.filter(d => d.position === 'after').map(d => d.layer)}\r\n <rect\r\n ref={MouseoverRectRef}\r\n style={{\r\n fill: 'none',\r\n pointerEvents: 'all',\r\n }}\r\n width={graphWidth}\r\n height={graphHeight}\r\n />\r\n </g>\r\n </motion.svg>\r\n {mouseOverData && tooltip && eventX && eventY ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={eventX}\r\n yPos={eventY}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import { useState, useRef, useEffect } from 'react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { ColorLegend } from '@/Components/Elements/ColorLegend';\r\nimport {\r\n AnnotationSettingsDataType,\r\n CustomHighlightAreaSettingsDataType,\r\n DifferenceLineChartDataType,\r\n Languages,\r\n ReferenceDataType,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n HighlightAreaSettingsDataType,\r\n CurveTypes,\r\n CustomLayerDataType,\r\n AnimateDataType,\r\n} from '@/Types';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { generateRandomString } from '@/Utils/generateRandomString';\r\nimport { EmptyState } from '@/Components/Elements/EmptyState';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: DifferenceLineChartDataType[];\r\n\r\n // Titles, Labels, and Sources\r\n /** Title of the graph */\r\n graphTitle?: string | React.ReactNode;\r\n /** Description of the graph */\r\n graphDescription?: string | React.ReactNode;\r\n /** Footnote for the graph */\r\n footNote?: string | React.ReactNode;\r\n /** Source data for the graph */\r\n sources?: SourcesDataType[];\r\n /** Accessibility label */\r\n ariaLabel?: string;\r\n\r\n // Colors and Styling\r\n /** Array of colors for the 2 lines */\r\n lineColors?: [string, string];\r\n /** Array of colors to highlight the negative and positive difference between the lines */\r\n diffAreaColors?: [string, string];\r\n /** Toggle the visibility of color legend between the top of the graphs and next to the line */\r\n showColorLegendAtTop?: boolean;\r\n /** Title for the color legend */\r\n colorLegendTitle?: string;\r\n /** Background color of the graph */\r\n backgroundColor?: string | boolean;\r\n /** Custom styles for the graph. Each object should be a valid React CSS style object. */\r\n styles?: StyleObject;\r\n /** Custom class names */\r\n classNames?: ClassNameObject;\r\n\r\n // Size and Spacing\r\n /** Width of the graph */\r\n width?: number;\r\n /** Height of the graph */\r\n height?: number;\r\n /** Minimum height of the graph */\r\n minHeight?: number;\r\n /** Relative height scaling factor. This overwrites the height props */\r\n relativeHeight?: number;\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n /** Left margin of the graph */\r\n leftMargin?: number;\r\n /** Right margin of the graph */\r\n rightMargin?: number;\r\n /** Top margin of the graph */\r\n topMargin?: number;\r\n /** Bottom margin of the graph */\r\n bottomMargin?: number;\r\n\r\n // Values and Ticks\r\n /** Prefix for values */\r\n prefix?: string;\r\n /** Suffix for values */\r\n suffix?: string;\r\n /** Maximum value for the chart */\r\n maxValue?: number;\r\n /** Minimum value for the chart */\r\n minValue?: number;\r\n /** Maximum value of the date for the chart */\r\n maxDate?: string | number;\r\n /** Minimum value of the date for the chart */\r\n minDate?: string | number;\r\n /** Reference values for comparison */\r\n refValues?: ReferenceDataType[];\r\n /** No. of ticks on the x-axis */\r\n noOfXTicks?: number;\r\n /** No. of ticks on the y-axis */\r\n noOfYTicks?: number;\r\n\r\n // Graph Parameters\r\n /** Toggle visibility of values */\r\n showValues?: boolean;\r\n /** Toggle visibility of dots on the line */\r\n showDots?: boolean;\r\n /** Stroke width of the line */\r\n strokeWidth?: number;\r\n /** Toggle the initial animation of the line. If the type is number then it uses the number as the time in seconds for animation. */\r\n animate?: boolean | AnimateDataType;\r\n /** Labels for the lines */\r\n labels: [string, string];\r\n /** Format of the date in the data object. Available formats can be found [here](https://date-fns.org/docs/format) */\r\n dateFormat?: string;\r\n /** Title for the Y-axis */\r\n yAxisTitle?: string;\r\n /** Annotations on the chart */\r\n annotations?: AnnotationSettingsDataType[];\r\n /** Highlighted area(square) on the chart */\r\n highlightAreaSettings?: HighlightAreaSettingsDataType[];\r\n /** Highlighted area(custom shape) on the chart */\r\n customHighlightAreaSettings?: CustomHighlightAreaSettingsDataType[];\r\n /** Curve type for the line */\r\n curveType?: CurveTypes;\r\n /** Specifies the number of decimal places to display in the value. */\r\n precision?: number;\r\n /** Optional SVG <g> element or function that renders custom content behind or in front of the graph. */\r\n customLayers?: CustomLayerDataType[];\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n\r\n // Interactions and Callbacks\r\n /** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n /** Callback for mouse over event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n\r\n // Configuration and Options\r\n /** Language setting */\r\n language?: Languages;\r\n /** Color theme */\r\n theme?: 'light' | 'dark';\r\n /** Unique ID for the graph */\r\n graphID?: string;\r\n}\r\n\r\nexport function DifferenceLineChart(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n suffix = '',\r\n sources,\r\n prefix = '',\r\n graphDescription,\r\n height,\r\n width,\r\n footNote,\r\n noOfXTicks = 10,\r\n dateFormat = 'yyyy',\r\n showValues = false,\r\n padding,\r\n lineColors = [\r\n Colors.light.categoricalColors.colors[0],\r\n Colors.light.categoricalColors.colors[1],\r\n ],\r\n backgroundColor = false,\r\n leftMargin = 30,\r\n rightMargin = 50,\r\n topMargin = 20,\r\n bottomMargin = 25,\r\n tooltip,\r\n highlightAreaSettings = [],\r\n relativeHeight,\r\n onSeriesMouseOver,\r\n graphID,\r\n graphDownload = false,\r\n dataDownload = false,\r\n animate = false,\r\n language = 'en',\r\n minHeight = 0,\r\n labels,\r\n showColorLegendAtTop = false,\r\n colorLegendTitle,\r\n diffAreaColors = [Colors.alerts.red, Colors.alerts.darkGreen],\r\n strokeWidth = 2,\r\n showDots = true,\r\n refValues = [],\r\n minValue,\r\n maxValue,\r\n annotations = [],\r\n customHighlightAreaSettings = [],\r\n theme = 'light',\r\n ariaLabel,\r\n yAxisTitle,\r\n noOfYTicks = 5,\r\n minDate,\r\n maxDate,\r\n curveType = 'curve',\r\n styles,\r\n classNames,\r\n precision = 2,\r\n customLayers = [],\r\n } = props;\r\n\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(width || entries[0].target.clientWidth || 620);\r\n setSvgHeight(height || entries[0].target.clientHeight || 480);\r\n });\r\n if (graphDiv.current) {\r\n setSvgHeight(graphDiv.current.clientHeight || 480);\r\n setSvgWidth(graphDiv.current.clientWidth || 620);\r\n if (!width) resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, [width, height]);\r\n\r\n return (\r\n <div\r\n className={`${theme || 'light'} flex ${width ? 'w-fit grow-0' : 'w-full grow'}`}\r\n dir={language === 'he' || language === 'ar' ? 'rtl' : undefined}\r\n >\r\n <div\r\n className={cn(\r\n `${\r\n !backgroundColor\r\n ? 'bg-transparent '\r\n : backgroundColor === true\r\n ? 'bg-primary-gray-200 dark:bg-primary-gray-650 '\r\n : ''\r\n }ml-auto mr-auto flex flex-col grow h-inherit ${language || 'en'}`,\r\n width ? 'w-fit' : 'w-full',\r\n classNames?.graphContainer,\r\n )}\r\n style={{\r\n ...(styles?.graphContainer || {}),\r\n ...(backgroundColor && backgroundColor !== true ? { backgroundColor } : {}),\r\n }}\r\n id={graphID}\r\n ref={graphParentDiv}\r\n aria-label={\r\n ariaLabel ||\r\n `${\r\n graphTitle ? `The graph shows ${graphTitle}. ` : ''\r\n }This is a line chart that highlights the difference between two datasets over time.${\r\n graphDescription ? ` ${graphDescription}` : ''\r\n }`\r\n }\r\n >\r\n <div\r\n className='flex grow'\r\n style={{ padding: backgroundColor ? padding || '1rem' : padding || 0 }}\r\n >\r\n <div className='flex flex-col w-full gap-4 grow justify-between'>\r\n {graphTitle || graphDescription || graphDownload || dataDownload ? (\r\n <GraphHeader\r\n styles={{\r\n title: styles?.title,\r\n description: styles?.description,\r\n }}\r\n classNames={{\r\n title: classNames?.title,\r\n description: classNames?.description,\r\n }}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n width={width}\r\n graphDownload={graphDownload ? graphParentDiv.current : undefined}\r\n dataDownload={\r\n dataDownload\r\n ? data.map(d => d.data).filter(d => d !== undefined).length > 0\r\n ? data.map(d => d.data).filter(d => d !== undefined)\r\n : data.filter(d => d !== undefined)\r\n : null\r\n }\r\n />\r\n ) : null}\r\n <div className='grow flex flex-col justify-center gap-3 w-full'>\r\n {data.length === 0 ? (\r\n <EmptyState />\r\n ) : (\r\n <>\r\n {showColorLegendAtTop ? (\r\n <ColorLegend\r\n colorDomain={labels}\r\n colorLegendTitle={colorLegendTitle}\r\n colors={lineColors}\r\n showNAColor={false}\r\n />\r\n ) : null}\r\n <div\r\n className='flex flex-col grow justify-center leading-0'\r\n ref={graphDiv}\r\n aria-label='Graph area'\r\n >\r\n {(width || svgWidth) && (height || svgHeight) ? (\r\n <Graph\r\n data={data}\r\n lineColors={lineColors}\r\n colorDomain={labels}\r\n width={width || svgWidth}\r\n height={Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}\r\n suffix={suffix}\r\n prefix={prefix}\r\n dateFormat={dateFormat}\r\n showValues={showValues}\r\n noOfXTicks={noOfXTicks}\r\n leftMargin={leftMargin}\r\n rightMargin={rightMargin}\r\n topMargin={topMargin}\r\n bottomMargin={bottomMargin}\r\n highlightAreaSettings={highlightAreaSettings}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n showColorLegendAtTop={showColorLegendAtTop}\r\n animate={\r\n animate === true\r\n ? { duration: 0.5, once: true, amount: 0.5 }\r\n : animate || { duration: 0, once: true, amount: 0 }\r\n }\r\n rtl={language === 'he' || language === 'ar'}\r\n diffAreaColors={diffAreaColors}\r\n idSuffix={generateRandomString(8)}\r\n strokeWidth={strokeWidth}\r\n showDots={showDots}\r\n refValues={refValues}\r\n minValue={minValue}\r\n maxValue={maxValue}\r\n annotations={annotations}\r\n customHighlightAreaSettings={customHighlightAreaSettings}\r\n yAxisTitle={yAxisTitle}\r\n noOfYTicks={noOfYTicks}\r\n minDate={minDate}\r\n maxDate={maxDate}\r\n curveType={curveType}\r\n styles={styles}\r\n classNames={classNames}\r\n precision={precision}\r\n customLayers={customLayers}\r\n />\r\n ) : null}\r\n </div>\r\n </>\r\n )}\r\n </div>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n}\r\n"],"names":["Graph","props","data","width","height","lineColors","suffix","prefix","dateFormat","showValues","noOfXTicks","rightMargin","leftMargin","topMargin","bottomMargin","tooltip","highlightAreaSettings","onSeriesMouseOver","animate","rtl","showColorLegendAtTop","colorDomain","diffAreaColors","idSuffix","strokeWidth","showDots","refValues","minValue","maxValue","annotations","customHighlightAreaSettings","yAxisTitle","noOfYTicks","minDate","maxDate","curveType","styles","classNames","precision","customLayers","svgRef","useRef","isInView","useInView","hasAnimatedOnce","setHasAnimatedOnce","useState","useEffect","timeout","curve","curveLinear","curveStep","curveStepAfter","curveStepBefore","curveMonotoneX","mouseOverData","setMouseOverData","eventX","setEventX","eventY","setEventY","margin","MouseoverRectRef","dataFormatted","orderBy","d","parse","highlightAreaSettingsFormatted","customHighlightAreaSettingsFormatted","el","j","graphWidth","graphHeight","minYear","maxYear","minParam1","minParam2","maxParam1","maxParam2","minParam","checkIfNullOrUndefined","maxParam","x","scaleTime","y","scaleLinear","lineShape1","line","lineShape2","mainGraphArea","area","mainGraphArea1","mainGraphArea2","yTicks","xTicks","mousemove","event","selectedData","bisectCenter","pointer","mouseout","select","jsxs","Fragment","jsx","motion","HighlightArea","CustomArea","YTicksAndGridLines","Axis","numberFormattingFunction","AxisTitle","XTicksAndGridLines","format","cn","i","RefLineY","endPoints","getLineEndPoint","connectorSettings","labelSettings","Annotation","Tooltip","DifferenceLineChart","graphTitle","sources","graphDescription","footNote","padding","Colors","backgroundColor","relativeHeight","graphID","graphDownload","dataDownload","language","minHeight","labels","colorLegendTitle","theme","ariaLabel","svgWidth","setSvgWidth","svgHeight","setSvgHeight","graphDiv","graphParentDiv","resizeObserver","entries","GraphHeader","EmptyState","ColorLegend","generateRandomString","GraphFooter"],"mappings":"6rCA6FO,SAASA,GAAMC,GAAc,CAClC,KAAM,CACJ,KAAAC,EACA,MAAAC,EACA,OAAAC,EACA,WAAAC,EACA,OAAAC,EACA,OAAAC,EACA,WAAAC,EACA,WAAAC,EACA,WAAAC,EACA,YAAAC,GACA,WAAAC,EACA,UAAAC,GACA,aAAAC,EACA,QAAAC,EACA,sBAAAC,EACA,kBAAAC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AC,EACA,aAAAC,EAAA,CAAA,EAEA,IAAA,CAAA,CACN,CAAA,CACF,CAAA,CAEJ,EACCsF,GAAWE,EACVvB,EAAAA,kBAAAA,IAACiD,GAAAA,YAAA,CACC,OAAQ,CAAE,SAAUrH,GAAQ,SAAU,OAAQA,GAAQ,MAAA,EACtD,WAAY,CACV,SAAUC,GAAY,SACtB,OAAQA,GAAY,MAAA,EAEtB,QAAAwF,EACA,SAAAE,EACA,MAAA5H,CAAA,CAAA,EAEA,IAAA,CAAA,CACN,CAAA,CAAA,CACF,CAAA,CACF,CAAA,CAGN"}
1
+ {"version":3,"file":"DifferenceLineChart.cjs","sources":["../src/Components/Graphs/LineCharts/DifferenceLineChart/Graph.tsx","../src/Components/Graphs/LineCharts/DifferenceLineChart/index.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\r\nimport {\r\n line,\r\n curveMonotoneX,\r\n area,\r\n curveLinear,\r\n curveStep,\r\n curveStepAfter,\r\n curveStepBefore,\r\n} from 'd3-shape';\r\nimport { scaleLinear, scaleTime } from 'd3-scale';\r\nimport { format } from 'date-fns/format';\r\nimport { parse } from 'date-fns/parse';\r\nimport { bisectCenter } from 'd3-array';\r\nimport { pointer, select } from 'd3-selection';\r\nimport { motion, useInView } from 'motion/react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport orderBy from 'lodash.orderby';\r\n\r\nimport {\r\n AnimateDataType,\r\n AnnotationSettingsDataType,\r\n ClassNameObject,\r\n CurveTypes,\r\n CustomHighlightAreaSettingsDataType,\r\n CustomLayerDataType,\r\n DifferenceLineChartDataType,\r\n HighlightAreaSettingsDataType,\r\n ReferenceDataType,\r\n StyleObject,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { getLineEndPoint } from '@/Utils/getLineEndPoint';\r\nimport { AxisTitle } from '@/Components/Elements/Axes/AxisTitle';\r\nimport { Axis } from '@/Components/Elements/Axes/Axis';\r\nimport { XTicksAndGridLines } from '@/Components/Elements/Axes/XTicksAndGridLines';\r\nimport { RefLineY } from '@/Components/Elements/ReferenceLine';\r\nimport { Annotation } from '@/Components/Elements/Annotations';\r\nimport { YTicksAndGridLines } from '@/Components/Elements/Axes/YTicksAndGridLines';\r\nimport { HighlightArea } from '@/Components/Elements/HighlightArea';\r\nimport { CustomArea } from '@/Components/Elements/HighlightArea/customArea';\r\n\r\ninterface Props {\r\n data: DifferenceLineChartDataType[];\r\n lineColors: [string, string];\r\n diffAreaColors: [string, string];\r\n width: number;\r\n height: number;\r\n suffix: string;\r\n prefix: string;\r\n dateFormat: string;\r\n showValues: boolean;\r\n noOfXTicks: number;\r\n rightMargin: number;\r\n leftMargin: number;\r\n topMargin: number;\r\n bottomMargin: number;\r\n highlightAreaSettings: HighlightAreaSettingsDataType[];\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n animate: AnimateDataType;\r\n rtl: boolean;\r\n colorDomain: [string, string];\r\n showColorLegendAtTop?: boolean;\r\n idSuffix: string;\r\n strokeWidth: number;\r\n showDots: boolean;\r\n refValues: ReferenceDataType[];\r\n maxValue?: number;\r\n minValue?: number;\r\n annotations: AnnotationSettingsDataType[];\r\n customHighlightAreaSettings: CustomHighlightAreaSettingsDataType[];\r\n yAxisTitle?: string;\r\n noOfYTicks: number;\r\n minDate?: string | number;\r\n maxDate?: string | number;\r\n curveType: CurveTypes;\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n precision: number;\r\n customLayers: CustomLayerDataType[];\r\n}\r\n\r\ninterface FormattedDataType {\r\n y1: number;\r\n y2: number;\r\n date: Date;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n width,\r\n height,\r\n lineColors,\r\n suffix,\r\n prefix,\r\n dateFormat,\r\n showValues,\r\n noOfXTicks,\r\n rightMargin,\r\n leftMargin,\r\n topMargin,\r\n bottomMargin,\r\n tooltip,\r\n highlightAreaSettings,\r\n onSeriesMouseOver,\r\n animate,\r\n rtl,\r\n showColorLegendAtTop,\r\n colorDomain,\r\n diffAreaColors,\r\n idSuffix,\r\n strokeWidth,\r\n showDots,\r\n refValues,\r\n minValue,\r\n maxValue,\r\n annotations,\r\n customHighlightAreaSettings,\r\n yAxisTitle,\r\n noOfYTicks,\r\n minDate,\r\n maxDate,\r\n curveType,\r\n styles,\r\n classNames,\r\n precision,\r\n customLayers,\r\n } = props;\r\n const svgRef = useRef(null);\r\n const isInView = useInView(svgRef, {\r\n once: animate.once,\r\n amount: animate.amount,\r\n });\r\n const [hasAnimatedOnce, setHasAnimatedOnce] = useState(false);\r\n\r\n useEffect(() => {\r\n if (isInView && !hasAnimatedOnce) {\r\n const timeout = setTimeout(\r\n () => {\r\n setHasAnimatedOnce(true);\r\n },\r\n (animate.duration + 0.5) * 1000,\r\n );\r\n return () => clearTimeout(timeout);\r\n }\r\n }, [isInView, hasAnimatedOnce, animate.duration]);\r\n const curve =\r\n curveType === 'linear'\r\n ? curveLinear\r\n : curveType === 'step'\r\n ? curveStep\r\n : curveType === 'stepAfter'\r\n ? curveStepAfter\r\n : curveType === 'stepBefore'\r\n ? curveStepBefore\r\n : curveMonotoneX;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n const margin = {\r\n top: topMargin,\r\n bottom: bottomMargin,\r\n left: yAxisTitle ? leftMargin + 30 : leftMargin,\r\n right: rightMargin,\r\n };\r\n const MouseoverRectRef = useRef(null);\r\n const dataFormatted = orderBy(\r\n data.map(d => ({\r\n ...d,\r\n date: parse(`${d.date}`, dateFormat, new Date()),\r\n })),\r\n ['date'],\r\n ['asc'],\r\n );\r\n const highlightAreaSettingsFormatted = highlightAreaSettings.map(d => ({\r\n ...d,\r\n coordinates: [\r\n d.coordinates[0] === null ? null : parse(`${d.coordinates[0]}`, dateFormat, new Date()),\r\n d.coordinates[1] === null ? null : parse(`${d.coordinates[1]}`, dateFormat, new Date()),\r\n ],\r\n }));\r\n const customHighlightAreaSettingsFormatted = customHighlightAreaSettings.map(d => ({\r\n ...d,\r\n coordinates: d.coordinates.map((el, j) =>\r\n j % 2 === 0 ? parse(`${el}`, dateFormat, new Date()) : (el as number),\r\n ),\r\n }));\r\n const graphWidth = width - margin.left - margin.right;\r\n const graphHeight = height - margin.top - margin.bottom;\r\n const minYear = minDate ? parse(`${minDate}`, dateFormat, new Date()) : dataFormatted[0].date;\r\n const maxYear = maxDate\r\n ? parse(`${maxDate}`, dateFormat, new Date())\r\n : dataFormatted[dataFormatted.length - 1].date;\r\n const minParam1 =\r\n Math.min(...dataFormatted.map(d => d.y1)) !== Infinity\r\n ? Math.min(...dataFormatted.map(d => d.y1)) > 0\r\n ? 0\r\n : Math.min(...dataFormatted.map(d => d.y1))\r\n : 0;\r\n const minParam2 =\r\n Math.min(...dataFormatted.map(d => d.y2)) !== Infinity\r\n ? Math.min(...dataFormatted.map(d => d.y2)) > 0\r\n ? 0\r\n : Math.min(...dataFormatted.map(d => d.y2))\r\n : 0;\r\n const maxParam1 =\r\n Math.max(...dataFormatted.map(d => d.y1)) !== Infinity\r\n ? Math.max(...dataFormatted.map(d => d.y1))\r\n : 0;\r\n const maxParam2 =\r\n Math.max(...dataFormatted.map(d => d.y2)) !== Infinity\r\n ? Math.max(...dataFormatted.map(d => d.y2))\r\n : 0;\r\n\r\n const minParam = checkIfNullOrUndefined(minValue)\r\n ? minParam1 < minParam2\r\n ? minParam1\r\n : minParam2\r\n : (minValue as number);\r\n const maxParam = maxParam1 > maxParam2 ? maxParam1 : maxParam2;\r\n const x = scaleTime().domain([minYear, maxYear]).range([0, graphWidth]);\r\n\r\n const y = scaleLinear()\r\n .domain([\r\n checkIfNullOrUndefined(minValue) ? minParam : (minValue as number),\r\n checkIfNullOrUndefined(maxValue) ? (maxParam > 0 ? maxParam : 0) : (maxValue as number),\r\n ])\r\n .range([graphHeight, 0])\r\n .nice();\r\n\r\n const lineShape1 = line<FormattedDataType>()\r\n .x(d => x(d.date))\r\n .y(d => y(d.y1))\r\n .curve(curve);\r\n\r\n const lineShape2 = line<FormattedDataType>()\r\n .x(d => x(d.date))\r\n .y(d => y(d.y2))\r\n .curve(curve);\r\n\r\n const mainGraphArea = area<FormattedDataType>()\r\n .x(d => x(d.date))\r\n .y1(d => y(d.y1))\r\n .y0(d => y(d.y2))\r\n .curve(curve);\r\n const mainGraphArea1 = area<FormattedDataType>()\r\n .x(d => x(d.date))\r\n .y1(d => y(d.y1))\r\n .y0(0)\r\n .curve(curve);\r\n const mainGraphArea2 = area<FormattedDataType>()\r\n .x(d => x(d.date))\r\n .y1(d => y(d.y2))\r\n .y0(0)\r\n .curve(curve);\r\n const yTicks = y.ticks(noOfYTicks);\r\n const xTicks = x.ticks(noOfXTicks);\r\n useEffect(() => {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const mousemove = (event: any) => {\r\n const selectedData =\r\n dataFormatted[\r\n bisectCenter(\r\n dataFormatted.map(d => d.date),\r\n x.invert(pointer(event)[0]),\r\n 0,\r\n )\r\n ];\r\n setMouseOverData(selectedData || dataFormatted[dataFormatted.length - 1]);\r\n onSeriesMouseOver?.(selectedData || dataFormatted[dataFormatted.length - 1]);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n };\r\n const mouseout = () => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n };\r\n select(MouseoverRectRef.current).on('mousemove', mousemove).on('mouseout', mouseout);\r\n }, [x, dataFormatted, onSeriesMouseOver]);\r\n return (\r\n <>\r\n <motion.svg\r\n width={`${width}px`}\r\n height={`${height}px`}\r\n viewBox={`0 0 ${width} ${height}`}\r\n direction='ltr'\r\n ref={svgRef}\r\n >\r\n <g transform={`translate(${margin.left},${margin.top})`}>\r\n <clipPath id={`above${idSuffix}`}>\r\n <path\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d={mainGraphArea2(dataFormatted as any) as string}\r\n style={{ fill: 'none' }}\r\n />\r\n </clipPath>\r\n <clipPath id={`below${idSuffix}`}>\r\n <path\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d={mainGraphArea1(dataFormatted as any) as string}\r\n style={{ fill: 'none' }}\r\n />\r\n </clipPath>\r\n <HighlightArea\r\n areaSettings={highlightAreaSettingsFormatted}\r\n width={graphWidth}\r\n height={graphHeight}\r\n scale={x}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n <CustomArea\r\n areaSettings={customHighlightAreaSettingsFormatted}\r\n scaleX={x}\r\n scaleY={y}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n <g>\r\n <g>\r\n <YTicksAndGridLines\r\n values={yTicks.filter(d => d !== 0)}\r\n y={yTicks.filter(d => d !== 0).map(d => y(d))}\r\n x1={0 - leftMargin}\r\n x2={graphWidth + margin.right}\r\n styles={{\r\n gridLines: styles?.yAxis?.gridLines,\r\n labels: styles?.yAxis?.labels,\r\n }}\r\n classNames={{\r\n gridLines: classNames?.yAxis?.gridLines,\r\n labels: classNames?.yAxis?.labels,\r\n }}\r\n suffix={suffix}\r\n prefix={prefix}\r\n labelType='secondary'\r\n showGridLines\r\n labelPos='vertical'\r\n precision={precision}\r\n />\r\n <Axis\r\n y1={y(minParam < 0 ? 0 : minParam)}\r\n y2={y(minParam < 0 ? 0 : minParam)}\r\n x1={0 - leftMargin}\r\n x2={graphWidth + margin.right}\r\n label={numberFormattingFunction(\r\n minParam < 0 ? 0 : minParam,\r\n 'NA',\r\n precision,\r\n prefix,\r\n suffix,\r\n )}\r\n labelPos={{\r\n x: 0 - leftMargin,\r\n y: y(minParam < 0 ? 0 : minParam),\r\n dx: 0,\r\n dy: maxParam < 0 ? '1rem' : -5,\r\n }}\r\n classNames={{\r\n axis: classNames?.xAxis?.axis,\r\n label: classNames?.yAxis?.labels,\r\n }}\r\n styles={{\r\n axis: styles?.xAxis?.axis,\r\n label: styles?.yAxis?.labels,\r\n }}\r\n />\r\n <AxisTitle\r\n x={0 - leftMargin - 15}\r\n y={graphHeight / 2}\r\n style={styles?.yAxis?.title}\r\n className={classNames?.yAxis?.title}\r\n text={yAxisTitle}\r\n rotate90\r\n />\r\n </g>\r\n </g>\r\n <XTicksAndGridLines\r\n values={xTicks.map(d => format(d, dateFormat))}\r\n x={xTicks.map(d => x(d))}\r\n y1={0}\r\n y2={graphHeight}\r\n styles={{\r\n gridLines: styles?.xAxis?.gridLines,\r\n labels: styles?.xAxis?.labels,\r\n }}\r\n classNames={{\r\n gridLines: cn('opacity-0', classNames?.xAxis?.gridLines),\r\n labels: cn(\r\n 'fill-primary-gray-700 dark:fill-primary-gray-300 xs:max-[360px]:hidden text-[9px] md:text-[10px] lg:text-xs',\r\n classNames?.xAxis?.labels,\r\n ),\r\n }}\r\n suffix={suffix}\r\n prefix={prefix}\r\n labelType='primary'\r\n showGridLines\r\n precision={precision}\r\n />\r\n {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n <g>\r\n <motion.path\r\n clipPath={`url(#below${idSuffix})`}\r\n d={mainGraphArea(dataFormatted) || ''}\r\n style={{ fill: diffAreaColors[1] }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 1 },\r\n whileInView: { opacity: 1, transition: { duration: animate.duration } },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n <motion.path\r\n clipPath={`url(#above${idSuffix})`}\r\n d={mainGraphArea(dataFormatted) || ''}\r\n style={{ fill: diffAreaColors[0] }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 0 },\r\n whileInView: { opacity: 1, transition: { duration: animate.duration } },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n </g>\r\n <g>\r\n <motion.path\r\n d={lineShape1(dataFormatted) || ''}\r\n style={{\r\n fill: 'none',\r\n stroke: lineColors[0],\r\n strokeWidth,\r\n }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { pathLength: 0, d: lineShape1(dataFormatted) || '', opacity: 1 },\r\n whileInView: {\r\n pathLength: 1,\r\n d: lineShape1(dataFormatted) || '',\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n <motion.path\r\n style={{\r\n fill: 'none',\r\n stroke: lineColors[1],\r\n strokeWidth,\r\n }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { pathLength: 0, d: lineShape2(dataFormatted) || '', opacity: 1 },\r\n whileInView: {\r\n pathLength: 1,\r\n d: lineShape2(dataFormatted) || '',\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n {showColorLegendAtTop ? null : (\r\n <g>\r\n <motion.text\r\n key={colorDomain[0]}\r\n className='text-xs'\r\n dx={5}\r\n dy={4}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: {\r\n opacity: 0,\r\n x: x(dataFormatted[dataFormatted.length - 1].date),\r\n y: y(dataFormatted[dataFormatted.length - 1].y1 as number),\r\n fill: lineColors[0],\r\n },\r\n whileInView: {\r\n opacity: 1,\r\n x: x(dataFormatted[dataFormatted.length - 1].date),\r\n y: y(dataFormatted[dataFormatted.length - 1].y1 as number),\r\n fill: lineColors[0],\r\n transition: {\r\n duration: hasAnimatedOnce ? animate.duration : 0.5,\r\n delay: hasAnimatedOnce ? 0 : animate.duration,\r\n },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n >\r\n {colorDomain[0]}\r\n </motion.text>\r\n <motion.text\r\n key={colorDomain[1]}\r\n className='text-xs'\r\n dx={5}\r\n dy={4}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: {\r\n opacity: 0,\r\n x: x(dataFormatted[dataFormatted.length - 1].date),\r\n y: y(dataFormatted[dataFormatted.length - 1].y2 as number),\r\n fill: lineColors[1],\r\n },\r\n whileInView: {\r\n opacity: 1,\r\n x: x(dataFormatted[dataFormatted.length - 1].date),\r\n y: y(dataFormatted[dataFormatted.length - 1].y2 as number),\r\n fill: lineColors[1],\r\n transition: {\r\n duration: hasAnimatedOnce ? animate.duration : 0.5,\r\n delay: hasAnimatedOnce ? 0 : animate.duration,\r\n },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n >\r\n {colorDomain[1]}\r\n </motion.text>\r\n </g>\r\n )}\r\n {mouseOverData ? (\r\n <line\r\n y1={0}\r\n y2={graphHeight}\r\n x1={x(mouseOverData.date)}\r\n x2={x(mouseOverData.date)}\r\n className={cn(\r\n 'undp-tick-line stroke-primary-gray-700 dark:stroke-primary-gray-100',\r\n classNames?.mouseOverLine,\r\n )}\r\n style={styles?.mouseOverLine}\r\n />\r\n ) : null}\r\n {dataFormatted.map((d, i) => (\r\n <motion.g key={i}>\r\n {!checkIfNullOrUndefined(d.y1) ? (\r\n <>\r\n {showDots ? (\r\n <motion.circle\r\n r={\r\n graphWidth / dataFormatted.length < 5\r\n ? 0\r\n : graphWidth / dataFormatted.length < 20\r\n ? 2\r\n : 4\r\n }\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 0, cx: x(d.date), cy: y(d.y1), fill: lineColors[0] },\r\n whileInView: {\r\n opacity: 1,\r\n fill: lineColors[0],\r\n transition: { duration: 0.5, delay: animate.duration },\r\n cx: x(d.date),\r\n cy: y(d.y1),\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n ) : null}\r\n {showValues ? (\r\n <motion.text\r\n dy={d.y2 < d.y1 ? -8 : '1em'}\r\n style={{\r\n textAnchor: 'middle',\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n className={cn(\r\n 'graph-value graph-value-line-1 text-xs font-bold',\r\n classNames?.graphObjectValues,\r\n )}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 0, x: x(d.date), y: y(d.y1), fill: lineColors[0] },\r\n whileInView: {\r\n opacity: 1,\r\n fill: lineColors[0],\r\n x: x(d.date),\r\n y: y(d.y1),\r\n transition: {\r\n duration: hasAnimatedOnce ? animate.duration : 0.5,\r\n delay: hasAnimatedOnce ? 0 : animate.duration,\r\n },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n >\r\n {numberFormattingFunction(d.y1, 'NA', precision, prefix, suffix)}\r\n </motion.text>\r\n ) : null}\r\n </>\r\n ) : null}\r\n {!checkIfNullOrUndefined(d.y2) ? (\r\n <>\r\n {showDots ? (\r\n <motion.circle\r\n r={\r\n graphWidth / dataFormatted.length < 5\r\n ? 0\r\n : graphWidth / dataFormatted.length < 20\r\n ? 2\r\n : 4\r\n }\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 0, cx: x(d.date), cy: y(d.y2), fill: lineColors[1] },\r\n whileInView: {\r\n opacity: 1,\r\n fill: lineColors[1],\r\n transition: {\r\n duration: hasAnimatedOnce ? animate.duration : 0.5,\r\n delay: hasAnimatedOnce ? 0 : animate.duration,\r\n },\r\n cx: x(d.date),\r\n cy: y(d.y2),\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n ) : null}\r\n {showValues ? (\r\n <motion.text\r\n dy={d.y2 > d.y1 ? -8 : '1em'}\r\n style={{\r\n textAnchor: 'middle',\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n className={cn(\r\n 'graph-value graph-value-line-2 text-xs font-bold',\r\n classNames?.graphObjectValues,\r\n )}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 0, x: x(d.date), y: y(d.y2), fill: lineColors[1] },\r\n whileInView: {\r\n opacity: 1,\r\n x: x(d.date),\r\n y: y(d.y2),\r\n fill: lineColors[1],\r\n transition: {\r\n duration: hasAnimatedOnce ? animate.duration : 0.5,\r\n delay: hasAnimatedOnce ? 0 : animate.duration,\r\n },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n >\r\n {numberFormattingFunction(d.y2, 'NA', precision, prefix, suffix)}\r\n </motion.text>\r\n ) : null}\r\n </>\r\n ) : null}\r\n </motion.g>\r\n ))}\r\n </g>\r\n {refValues ? (\r\n <>\r\n {refValues.map((el, i) => (\r\n <RefLineY\r\n key={i}\r\n text={el.text}\r\n color={el.color}\r\n y={y(el.value as number)}\r\n x1={0 - leftMargin}\r\n x2={graphWidth + margin.right}\r\n classNames={el.classNames}\r\n styles={el.styles}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n ))}\r\n </>\r\n ) : null}\r\n <g>\r\n {annotations.map((d, i) => {\r\n const endPoints = getLineEndPoint(\r\n {\r\n x: d.xCoordinate\r\n ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) + (d.xOffset || 0)\r\n : 0 + (d.xOffset || 0),\r\n y: d.yCoordinate\r\n ? y(d.yCoordinate as number) + (d.yOffset || 0) - 8\r\n : 0 + (d.yOffset || 0) - 8,\r\n },\r\n {\r\n x: d.xCoordinate ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) : 0,\r\n y: d.yCoordinate ? y(d.yCoordinate as number) : 0,\r\n },\r\n checkIfNullOrUndefined(d.connectorRadius) ? 3.5 : (d.connectorRadius as number),\r\n );\r\n const connectorSettings = d.showConnector\r\n ? {\r\n y1: endPoints.y,\r\n x1: endPoints.x,\r\n y2: d.yCoordinate\r\n ? y(d.yCoordinate as number) + (d.yOffset || 0)\r\n : 0 + (d.yOffset || 0),\r\n x2: d.xCoordinate\r\n ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) + (d.xOffset || 0)\r\n : 0 + (d.xOffset || 0),\r\n cy: d.yCoordinate ? y(d.yCoordinate as number) : 0,\r\n cx: d.xCoordinate ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) : 0,\r\n circleRadius: checkIfNullOrUndefined(d.connectorRadius)\r\n ? 3.5\r\n : (d.connectorRadius as number),\r\n strokeWidth: d.showConnector === true ? 2 : Math.min(d.showConnector || 0, 1),\r\n }\r\n : undefined;\r\n const labelSettings = {\r\n y: d.yCoordinate\r\n ? y(d.yCoordinate as number) + (d.yOffset || 0) - 8\r\n : 0 + (d.yOffset || 0) - 8,\r\n x: rtl\r\n ? 0\r\n : d.xCoordinate\r\n ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) + (d.xOffset || 0)\r\n : 0 + (d.xOffset || 0),\r\n width: rtl\r\n ? d.xCoordinate\r\n ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) + (d.xOffset || 0)\r\n : 0 + (d.xOffset || 0)\r\n : graphWidth +\r\n margin.right -\r\n (d.xCoordinate\r\n ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) + (d.xOffset || 0)\r\n : 0 + (d.xOffset || 0)),\r\n maxWidth: d.maxWidth,\r\n fontWeight: d.fontWeight,\r\n align: d.align,\r\n };\r\n return (\r\n <Annotation\r\n key={i}\r\n color={d.color}\r\n connectorsSettings={connectorSettings}\r\n labelSettings={labelSettings}\r\n text={d.text}\r\n classNames={d.classNames}\r\n styles={d.styles}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n );\r\n })}\r\n </g>\r\n {customLayers.filter(d => d.position === 'after').map(d => d.layer)}\r\n <rect\r\n ref={MouseoverRectRef}\r\n style={{\r\n fill: 'none',\r\n pointerEvents: 'all',\r\n }}\r\n width={graphWidth}\r\n height={graphHeight}\r\n />\r\n </g>\r\n </motion.svg>\r\n {mouseOverData && tooltip && eventX && eventY ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={eventX}\r\n yPos={eventY}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import { useState, useRef, useEffect } from 'react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { ColorLegend } from '@/Components/Elements/ColorLegend';\r\nimport {\r\n AnnotationSettingsDataType,\r\n CustomHighlightAreaSettingsDataType,\r\n DifferenceLineChartDataType,\r\n Languages,\r\n ReferenceDataType,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n HighlightAreaSettingsDataType,\r\n CurveTypes,\r\n CustomLayerDataType,\r\n AnimateDataType,\r\n} from '@/Types';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { generateRandomString } from '@/Utils/generateRandomString';\r\nimport { EmptyState } from '@/Components/Elements/EmptyState';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: DifferenceLineChartDataType[];\r\n\r\n // Titles, Labels, and Sources\r\n /** Title of the graph */\r\n graphTitle?: string | React.ReactNode;\r\n /** Description of the graph */\r\n graphDescription?: string | React.ReactNode;\r\n /** Footnote for the graph */\r\n footNote?: string | React.ReactNode;\r\n /** Source data for the graph */\r\n sources?: SourcesDataType[];\r\n /** Accessibility label */\r\n ariaLabel?: string;\r\n\r\n // Colors and Styling\r\n /** Array of colors for the 2 lines */\r\n lineColors?: [string, string];\r\n /** Array of colors to highlight the negative and positive difference between the lines */\r\n diffAreaColors?: [string, string];\r\n /** Toggle the visibility of color legend between the top of the graphs and next to the line */\r\n showColorLegendAtTop?: boolean;\r\n /** Title for the color legend */\r\n colorLegendTitle?: string;\r\n /** Background color of the graph */\r\n backgroundColor?: string | boolean;\r\n /** Custom styles for the graph. Each object should be a valid React CSS style object. */\r\n styles?: StyleObject;\r\n /** Custom class names */\r\n classNames?: ClassNameObject;\r\n\r\n // Size and Spacing\r\n /** Width of the graph */\r\n width?: number;\r\n /** Height of the graph */\r\n height?: number;\r\n /** Minimum height of the graph */\r\n minHeight?: number;\r\n /** Relative height scaling factor. This overwrites the height props */\r\n relativeHeight?: number;\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n /** Left margin of the graph */\r\n leftMargin?: number;\r\n /** Right margin of the graph */\r\n rightMargin?: number;\r\n /** Top margin of the graph */\r\n topMargin?: number;\r\n /** Bottom margin of the graph */\r\n bottomMargin?: number;\r\n\r\n // Values and Ticks\r\n /** Prefix for values */\r\n prefix?: string;\r\n /** Suffix for values */\r\n suffix?: string;\r\n /** Maximum value for the chart */\r\n maxValue?: number;\r\n /** Minimum value for the chart */\r\n minValue?: number;\r\n /** Maximum value of the date for the chart */\r\n maxDate?: string | number;\r\n /** Minimum value of the date for the chart */\r\n minDate?: string | number;\r\n /** Reference values for comparison */\r\n refValues?: ReferenceDataType[];\r\n /** No. of ticks on the x-axis */\r\n noOfXTicks?: number;\r\n /** No. of ticks on the y-axis */\r\n noOfYTicks?: number;\r\n\r\n // Graph Parameters\r\n /** Toggle visibility of values */\r\n showValues?: boolean;\r\n /** Toggle visibility of dots on the line */\r\n showDots?: boolean;\r\n /** Stroke width of the line */\r\n strokeWidth?: number;\r\n /** Toggle the initial animation of the line. If the type is number then it uses the number as the time in seconds for animation. */\r\n animate?: boolean | AnimateDataType;\r\n /** Labels for the lines */\r\n labels: [string, string];\r\n /** Format of the date in the data object. Available formats can be found [here](https://date-fns.org/docs/format) */\r\n dateFormat?: string;\r\n /** Title for the Y-axis */\r\n yAxisTitle?: string;\r\n /** Annotations on the chart */\r\n annotations?: AnnotationSettingsDataType[];\r\n /** Highlighted area(square) on the chart */\r\n highlightAreaSettings?: HighlightAreaSettingsDataType[];\r\n /** Highlighted area(custom shape) on the chart */\r\n customHighlightAreaSettings?: CustomHighlightAreaSettingsDataType[];\r\n /** Curve type for the line */\r\n curveType?: CurveTypes;\r\n /** Specifies the number of decimal places to display in the value. */\r\n precision?: number;\r\n /** Optional SVG <g> element or function that renders custom content behind or in front of the graph. */\r\n customLayers?: CustomLayerDataType[];\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n\r\n // Interactions and Callbacks\r\n /** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n /** Callback for mouse over event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n\r\n // Configuration and Options\r\n /** Language setting */\r\n language?: Languages;\r\n /** Color theme */\r\n theme?: 'light' | 'dark';\r\n /** Unique ID for the graph */\r\n graphID?: string;\r\n}\r\n\r\nexport function DifferenceLineChart(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n suffix = '',\r\n sources,\r\n prefix = '',\r\n graphDescription,\r\n height,\r\n width,\r\n footNote,\r\n noOfXTicks = 10,\r\n dateFormat = 'yyyy',\r\n showValues = false,\r\n padding,\r\n lineColors = [\r\n Colors.light.categoricalColors.colors[0],\r\n Colors.light.categoricalColors.colors[1],\r\n ],\r\n backgroundColor = false,\r\n leftMargin = 30,\r\n rightMargin = 50,\r\n topMargin = 20,\r\n bottomMargin = 25,\r\n tooltip,\r\n highlightAreaSettings = [],\r\n relativeHeight,\r\n onSeriesMouseOver,\r\n graphID,\r\n graphDownload = false,\r\n dataDownload = false,\r\n animate = false,\r\n language = 'en',\r\n minHeight = 0,\r\n labels,\r\n showColorLegendAtTop = false,\r\n colorLegendTitle,\r\n diffAreaColors = [Colors.alerts.red, Colors.alerts.darkGreen],\r\n strokeWidth = 2,\r\n showDots = true,\r\n refValues = [],\r\n minValue,\r\n maxValue,\r\n annotations = [],\r\n customHighlightAreaSettings = [],\r\n theme = 'light',\r\n ariaLabel,\r\n yAxisTitle,\r\n noOfYTicks = 5,\r\n minDate,\r\n maxDate,\r\n curveType = 'curve',\r\n styles,\r\n classNames,\r\n precision = 2,\r\n customLayers = [],\r\n } = props;\r\n\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(width || entries[0].target.clientWidth || 620);\r\n setSvgHeight(height || entries[0].target.clientHeight || 480);\r\n });\r\n if (graphDiv.current) {\r\n setSvgHeight(graphDiv.current.clientHeight || 480);\r\n setSvgWidth(graphDiv.current.clientWidth || 620);\r\n if (!width) resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, [width, height]);\r\n\r\n return (\r\n <div\r\n className={`${theme || 'light'} flex ${width ? 'w-fit grow-0' : 'w-full grow'}`}\r\n dir={language === 'he' || language === 'ar' ? 'rtl' : undefined}\r\n >\r\n <div\r\n className={cn(\r\n `${\r\n !backgroundColor\r\n ? 'bg-transparent '\r\n : backgroundColor === true\r\n ? 'bg-primary-gray-200 dark:bg-primary-gray-650 '\r\n : ''\r\n }ml-auto mr-auto flex flex-col grow h-inherit ${language || 'en'}`,\r\n width ? 'w-fit' : 'w-full',\r\n classNames?.graphContainer,\r\n )}\r\n style={{\r\n ...(styles?.graphContainer || {}),\r\n ...(backgroundColor && backgroundColor !== true ? { backgroundColor } : {}),\r\n }}\r\n id={graphID}\r\n ref={graphParentDiv}\r\n aria-label={\r\n ariaLabel ||\r\n `${\r\n graphTitle ? `The graph shows ${graphTitle}. ` : ''\r\n }This is a line chart that highlights the difference between two datasets over time.${\r\n graphDescription ? ` ${graphDescription}` : ''\r\n }`\r\n }\r\n >\r\n <div\r\n className='flex grow'\r\n style={{ padding: backgroundColor ? padding || '1rem' : padding || 0 }}\r\n >\r\n <div className='flex flex-col w-full gap-4 grow justify-between'>\r\n {graphTitle || graphDescription || graphDownload || dataDownload ? (\r\n <GraphHeader\r\n styles={{\r\n title: styles?.title,\r\n description: styles?.description,\r\n }}\r\n classNames={{\r\n title: classNames?.title,\r\n description: classNames?.description,\r\n }}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n width={width}\r\n graphDownload={graphDownload ? graphParentDiv.current : undefined}\r\n dataDownload={\r\n dataDownload\r\n ? data.map(d => d.data).filter(d => d !== undefined).length > 0\r\n ? data.map(d => d.data).filter(d => d !== undefined)\r\n : data.filter(d => d !== undefined)\r\n : null\r\n }\r\n />\r\n ) : null}\r\n <div className='grow flex flex-col justify-center gap-3 w-full'>\r\n {data.length === 0 ? (\r\n <EmptyState />\r\n ) : (\r\n <>\r\n {showColorLegendAtTop ? (\r\n <ColorLegend\r\n colorDomain={labels}\r\n colorLegendTitle={colorLegendTitle}\r\n colors={lineColors}\r\n showNAColor={false}\r\n />\r\n ) : null}\r\n <div\r\n className='flex flex-col grow justify-center leading-0'\r\n ref={graphDiv}\r\n aria-label='Graph area'\r\n >\r\n {(width || svgWidth) && (height || svgHeight) ? (\r\n <Graph\r\n data={data}\r\n lineColors={lineColors}\r\n colorDomain={labels}\r\n width={width || svgWidth}\r\n height={Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}\r\n suffix={suffix}\r\n prefix={prefix}\r\n dateFormat={dateFormat}\r\n showValues={showValues}\r\n noOfXTicks={noOfXTicks}\r\n leftMargin={leftMargin}\r\n rightMargin={rightMargin}\r\n topMargin={topMargin}\r\n bottomMargin={bottomMargin}\r\n highlightAreaSettings={highlightAreaSettings}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n showColorLegendAtTop={showColorLegendAtTop}\r\n animate={\r\n animate === true\r\n ? { duration: 0.5, once: true, amount: 0.5 }\r\n : animate || { duration: 0, once: true, amount: 0 }\r\n }\r\n rtl={language === 'he' || language === 'ar'}\r\n diffAreaColors={diffAreaColors}\r\n idSuffix={generateRandomString(8)}\r\n strokeWidth={strokeWidth}\r\n showDots={showDots}\r\n refValues={refValues}\r\n minValue={minValue}\r\n maxValue={maxValue}\r\n annotations={annotations}\r\n customHighlightAreaSettings={customHighlightAreaSettings}\r\n yAxisTitle={yAxisTitle}\r\n noOfYTicks={noOfYTicks}\r\n minDate={minDate}\r\n maxDate={maxDate}\r\n curveType={curveType}\r\n styles={styles}\r\n classNames={classNames}\r\n precision={precision}\r\n customLayers={customLayers}\r\n />\r\n ) : null}\r\n </div>\r\n </>\r\n )}\r\n </div>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n}\r\n"],"names":["Graph","props","data","width","height","lineColors","suffix","prefix","dateFormat","showValues","noOfXTicks","rightMargin","leftMargin","topMargin","bottomMargin","tooltip","highlightAreaSettings","onSeriesMouseOver","animate","rtl","showColorLegendAtTop","colorDomain","diffAreaColors","idSuffix","strokeWidth","showDots","refValues","minValue","maxValue","annotations","customHighlightAreaSettings","yAxisTitle","noOfYTicks","minDate","maxDate","curveType","styles","classNames","precision","customLayers","svgRef","useRef","isInView","useInView","hasAnimatedOnce","setHasAnimatedOnce","useState","useEffect","timeout","curve","curveLinear","curveStep","curveStepAfter","curveStepBefore","curveMonotoneX","mouseOverData","setMouseOverData","eventX","setEventX","eventY","setEventY","margin","MouseoverRectRef","dataFormatted","orderBy","d","parse","highlightAreaSettingsFormatted","customHighlightAreaSettingsFormatted","el","j","graphWidth","graphHeight","minYear","maxYear","minParam1","minParam2","maxParam1","maxParam2","minParam","checkIfNullOrUndefined","maxParam","x","scaleTime","y","scaleLinear","lineShape1","line","lineShape2","mainGraphArea","area","mainGraphArea1","mainGraphArea2","yTicks","xTicks","mousemove","event","selectedData","bisectCenter","pointer","mouseout","select","jsxs","Fragment","jsx","motion","HighlightArea","CustomArea","YTicksAndGridLines","Axis","numberFormattingFunction","AxisTitle","XTicksAndGridLines","format","cn","i","RefLineY","endPoints","getLineEndPoint","connectorSettings","labelSettings","Annotation","Tooltip","DifferenceLineChart","graphTitle","sources","graphDescription","footNote","padding","Colors","backgroundColor","relativeHeight","graphID","graphDownload","dataDownload","language","minHeight","labels","colorLegendTitle","theme","ariaLabel","svgWidth","setSvgWidth","svgHeight","setSvgHeight","graphDiv","graphParentDiv","resizeObserver","entries","GraphHeader","EmptyState","ColorLegend","generateRandomString","GraphFooter"],"mappings":"6rCA6FO,SAASA,GAAMC,GAAc,CAClC,KAAM,CACJ,KAAAC,EACA,MAAAC,EACA,OAAAC,EACA,WAAAC,EACA,OAAAC,EACA,OAAAC,EACA,WAAAC,EACA,WAAAC,EACA,WAAAC,EACA,YAAAC,GACA,WAAAC,EACA,UAAAC,GACA,aAAAC,EACA,QAAAC,EACA,sBAAAC,EACA,kBAAAC,EACA,QAAAC,EACA,IAAAC,EACA,qBAAAC,GACA,YAAAC,EACA,eAAAC,EACA,SAAAC,EACA,YAAAC,EACA,SAAAC,EACA,UAAAC,EACA,SAAAC,EACA,SAAAC,EACA,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