@undp/data-viz 1.2.8 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (496) hide show
  1. package/dist/AreaChart.d.ts +224 -0
  2. package/dist/AreaChart.js +2 -0
  3. package/dist/AreaChart.js.map +1 -0
  4. package/dist/Axis-BlyBRMNw.cjs +2 -0
  5. package/dist/Axis-BlyBRMNw.cjs.map +1 -0
  6. package/dist/Axis-CvK-w3E2.js +44 -0
  7. package/dist/Axis-CvK-w3E2.js.map +1 -0
  8. package/dist/AxisTitle-BY8MI9jC.cjs +2 -0
  9. package/dist/AxisTitle-BY8MI9jC.cjs.map +1 -0
  10. package/dist/AxisTitle-BeMxcw5I.js +21 -0
  11. package/dist/AxisTitle-BeMxcw5I.js.map +1 -0
  12. package/dist/BarGraph.d.ts +460 -0
  13. package/dist/BarGraph.js +2 -0
  14. package/dist/BarGraph.js.map +1 -0
  15. package/dist/BasicStatCard.d.ts +106 -0
  16. package/dist/BasicStatCard.js +2 -0
  17. package/dist/BasicStatCard.js.map +1 -0
  18. package/dist/BeeSwarmChart.d.ts +189 -0
  19. package/dist/BeeSwarmChart.js +2 -0
  20. package/dist/BeeSwarmChart.js.map +1 -0
  21. package/dist/BiVariateChoroplethMap.d.ts +189 -0
  22. package/dist/BiVariateChoroplethMap.js +2 -0
  23. package/dist/BiVariateChoroplethMap.js.map +1 -0
  24. package/dist/BulletChart.d.ts +219 -0
  25. package/dist/BulletChart.js +2 -0
  26. package/dist/BulletChart.js.map +1 -0
  27. package/dist/ButterflyChart.d.ts +201 -0
  28. package/dist/ButterflyChart.js +2 -0
  29. package/dist/ButterflyChart.js.map +1 -0
  30. package/dist/ChoroplethMap.d.ts +190 -0
  31. package/dist/ChoroplethMap.js +2 -0
  32. package/dist/ChoroplethMap.js.map +1 -0
  33. package/dist/CirclePackingGraph.d.ts +161 -0
  34. package/dist/CirclePackingGraph.js +2 -0
  35. package/dist/CirclePackingGraph.js.map +1 -0
  36. package/dist/ColorLegend.d.ts +17 -0
  37. package/dist/ColorLegend.js +2 -0
  38. package/dist/ColorLegend.js.map +1 -0
  39. package/dist/ColorLegendWithMouseOver.d.ts +16 -0
  40. package/dist/ColorLegendWithMouseOver.js +2 -0
  41. package/dist/ColorLegendWithMouseOver.js.map +1 -0
  42. package/dist/Colors.d.ts +174 -0
  43. package/dist/Colors.js +2 -0
  44. package/dist/Colors.js.map +1 -0
  45. package/dist/CopyTextButton.d.ts +13 -0
  46. package/dist/CopyTextButton.js +17 -0
  47. package/dist/CopyTextButton.js.map +1 -0
  48. package/dist/CsvDownloadButton.d.ts +22 -0
  49. package/dist/CsvDownloadButton.js +23 -0
  50. package/dist/CsvDownloadButton.js.map +1 -0
  51. package/dist/DataCards.d.ts +131 -0
  52. package/dist/DataCards.js +2 -0
  53. package/dist/DataCards.js.map +1 -0
  54. package/dist/DataTable.d.ts +122 -0
  55. package/dist/DataTable.js +2 -0
  56. package/dist/DataTable.js.map +1 -0
  57. package/dist/DifferenceLineChart.d.ts +237 -0
  58. package/dist/DifferenceLineChart.js +2 -0
  59. package/dist/DifferenceLineChart.js.map +1 -0
  60. package/dist/DonutChart.d.ts +148 -0
  61. package/dist/DonutChart.js +2 -0
  62. package/dist/DonutChart.js.map +1 -0
  63. package/dist/DotDensityMap.d.ts +191 -0
  64. package/dist/DotDensityMap.js +2 -0
  65. package/dist/DotDensityMap.js.map +1 -0
  66. package/dist/DropdownSelect-CuzV7gdj.cjs +29 -0
  67. package/dist/DropdownSelect-CuzV7gdj.cjs.map +1 -0
  68. package/dist/DropdownSelect-DmZsXrhY.js +2698 -0
  69. package/dist/DropdownSelect-DmZsXrhY.js.map +1 -0
  70. package/dist/DualAxisLineChart.d.ts +180 -0
  71. package/dist/DualAxisLineChart.js +2 -0
  72. package/dist/DualAxisLineChart.js.map +1 -0
  73. package/dist/DumbbellChart.d.ts +224 -0
  74. package/dist/DumbbellChart.js +2 -0
  75. package/dist/DumbbellChart.js.map +1 -0
  76. package/dist/EmptyState-BQguKAp5.cjs +2 -0
  77. package/dist/EmptyState-BQguKAp5.cjs.map +1 -0
  78. package/dist/EmptyState-b2Ln487i.js +22 -0
  79. package/dist/EmptyState-b2Ln487i.js.map +1 -0
  80. package/dist/ExcelDownloadButton.d.ts +22 -0
  81. package/dist/ExcelDownloadButton.js +2 -0
  82. package/dist/ExcelDownloadButton.js.map +1 -0
  83. package/dist/FootNote.d.ts +12 -0
  84. package/dist/FootNote.js +2 -0
  85. package/dist/FootNote.js.map +1 -0
  86. package/dist/GeoHubCompareMaps.d.ts +103 -0
  87. package/dist/GeoHubCompareMaps.js +2 -0
  88. package/dist/GeoHubCompareMaps.js.map +1 -0
  89. package/dist/GeoHubMap.d.ts +118 -0
  90. package/dist/GeoHubMap.js +2 -0
  91. package/dist/GeoHubMap.js.map +1 -0
  92. package/dist/GeoHubMapWithLayerSelection.d.ts +117 -0
  93. package/dist/GeoHubMapWithLayerSelection.js +2 -0
  94. package/dist/GeoHubMapWithLayerSelection.js.map +1 -0
  95. package/dist/GraphDescription.d.ts +12 -0
  96. package/dist/GraphDescription.js +2 -0
  97. package/dist/GraphDescription.js.map +1 -0
  98. package/dist/GraphFooter.d.ts +24 -0
  99. package/dist/GraphFooter.js +2 -0
  100. package/dist/GraphFooter.js.map +1 -0
  101. package/dist/GraphHeader.d.ts +22 -0
  102. package/dist/GraphHeader.js +2 -0
  103. package/dist/GraphHeader.js.map +1 -0
  104. package/dist/GraphTitle.d.ts +13 -0
  105. package/dist/GraphTitle.js +2 -0
  106. package/dist/GraphTitle.js.map +1 -0
  107. package/dist/GriddedGraphs.d.ts +540 -0
  108. package/dist/GriddedGraphs.js +2 -0
  109. package/dist/GriddedGraphs.js.map +1 -0
  110. package/dist/GriddedGraphsFromConfig.d.ts +543 -0
  111. package/dist/GriddedGraphsFromConfig.js +2 -0
  112. package/dist/GriddedGraphsFromConfig.js.map +1 -0
  113. package/dist/HeatMap.d.ts +166 -0
  114. package/dist/HeatMap.js +2 -0
  115. package/dist/HeatMap.js.map +1 -0
  116. package/dist/Histogram.d.ts +165 -0
  117. package/dist/Histogram.js +2 -0
  118. package/dist/Histogram.js.map +1 -0
  119. package/dist/ImageDownloadButton.d.ts +15 -0
  120. package/dist/ImageDownloadButton.js +2 -0
  121. package/dist/ImageDownloadButton.js.map +1 -0
  122. package/dist/LineChartWithConfidenceInterval.d.ts +250 -0
  123. package/dist/LineChartWithConfidenceInterval.js +2 -0
  124. package/dist/LineChartWithConfidenceInterval.js.map +1 -0
  125. package/dist/LinearColorLegend.d.ts +13 -0
  126. package/dist/LinearColorLegend.js +2 -0
  127. package/dist/LinearColorLegend.js.map +1 -0
  128. package/dist/Modal-C9txyGOk.js +723 -0
  129. package/dist/Modal-C9txyGOk.js.map +1 -0
  130. package/dist/Modal-cQF2UQIa.cjs +46 -0
  131. package/dist/Modal-cQF2UQIa.cjs.map +1 -0
  132. package/dist/MultiGraphDashboard.d.ts +558 -0
  133. package/dist/MultiGraphDashboard.js +2 -0
  134. package/dist/MultiGraphDashboard.js.map +1 -0
  135. package/dist/MultiGraphDashboardFromConfig.d.ts +562 -0
  136. package/dist/MultiGraphDashboardFromConfig.js +2 -0
  137. package/dist/MultiGraphDashboardFromConfig.js.map +1 -0
  138. package/dist/MultiGraphDashboardWideToLongFormat.d.ts +128 -0
  139. package/dist/MultiGraphDashboardWideToLongFormat.js +2 -0
  140. package/dist/MultiGraphDashboardWideToLongFormat.js.map +1 -0
  141. package/dist/MultiGraphDashboardWideToLongFormatFromConfig.d.ts +133 -0
  142. package/dist/MultiGraphDashboardWideToLongFormatFromConfig.js +2 -0
  143. package/dist/MultiGraphDashboardWideToLongFormatFromConfig.js.map +1 -0
  144. package/dist/MultiLineAltChart.d.ts +244 -0
  145. package/dist/MultiLineAltChart.js +2 -0
  146. package/dist/MultiLineAltChart.js.map +1 -0
  147. package/dist/MultiLineChart.d.ts +246 -0
  148. package/dist/MultiLineChart.js +2 -0
  149. package/dist/MultiLineChart.js.map +1 -0
  150. package/dist/ParetoChart.d.ts +178 -0
  151. package/dist/ParetoChart.js +2 -0
  152. package/dist/ParetoChart.js.map +1 -0
  153. package/dist/RadarChart.d.ts +176 -0
  154. package/dist/RadarChart.js +2 -0
  155. package/dist/RadarChart.js.map +1 -0
  156. package/dist/ReferenceLine-BgDdQbDI.js +129 -0
  157. package/dist/ReferenceLine-BgDdQbDI.js.map +1 -0
  158. package/dist/ReferenceLine-Bsb5jeE4.cjs +2 -0
  159. package/dist/ReferenceLine-Bsb5jeE4.cjs.map +1 -0
  160. package/dist/RegressionLine-BfpCuD7B.cjs +2 -0
  161. package/dist/RegressionLine-BfpCuD7B.cjs.map +1 -0
  162. package/dist/RegressionLine-cSljpHaE.js +49 -0
  163. package/dist/RegressionLine-cSljpHaE.js.map +1 -0
  164. package/dist/SVGDownloadButton.d.ts +15 -0
  165. package/dist/SVGDownloadButton.js +2 -0
  166. package/dist/SVGDownloadButton.js.map +1 -0
  167. package/dist/SankeyChart.d.ts +178 -0
  168. package/dist/SankeyChart.js +2 -0
  169. package/dist/SankeyChart.js.map +1 -0
  170. package/dist/ScatterPlot.d.ts +266 -0
  171. package/dist/ScatterPlot.js +2 -0
  172. package/dist/ScatterPlot.js.map +1 -0
  173. package/dist/ScrollStory.d.ts +491 -0
  174. package/dist/ScrollStory.js +2 -0
  175. package/dist/ScrollStory.js.map +1 -0
  176. package/dist/SimpleLineChart.d.ts +230 -0
  177. package/dist/SimpleLineChart.js +2 -0
  178. package/dist/SimpleLineChart.js.map +1 -0
  179. package/dist/SingleGraphDashboard.d.ts +545 -0
  180. package/dist/SingleGraphDashboard.js +2 -0
  181. package/dist/SingleGraphDashboard.js.map +1 -0
  182. package/dist/SingleGraphDashboardFromConfig.d.ts +547 -0
  183. package/dist/SingleGraphDashboardFromConfig.js +2 -0
  184. package/dist/SingleGraphDashboardFromConfig.js.map +1 -0
  185. package/dist/SlopeChart.d.ts +167 -0
  186. package/dist/SlopeChart.js +2 -0
  187. package/dist/SlopeChart.js.map +1 -0
  188. package/dist/Source.d.ts +16 -0
  189. package/dist/Source.js +2 -0
  190. package/dist/Source.js.map +1 -0
  191. package/dist/SparkLine.d.ts +139 -0
  192. package/dist/SparkLine.js +2 -0
  193. package/dist/SparkLine.js.map +1 -0
  194. package/dist/Spinner-DN3s4S0H.js +17 -0
  195. package/dist/Spinner-DN3s4S0H.js.map +1 -0
  196. package/dist/Spinner-UmN-KPe9.cjs +2 -0
  197. package/dist/Spinner-UmN-KPe9.cjs.map +1 -0
  198. package/dist/StatCardFromData.d.ts +115 -0
  199. package/dist/StatCardFromData.js +2 -0
  200. package/dist/StatCardFromData.js.map +1 -0
  201. package/dist/StripChart.d.ts +178 -0
  202. package/dist/StripChart.js +2 -0
  203. package/dist/StripChart.js.map +1 -0
  204. package/dist/ThreeDGlobe.d.ts +158 -0
  205. package/dist/ThreeDGlobe.js +2 -0
  206. package/dist/ThreeDGlobe.js.map +1 -0
  207. package/dist/ThresholdColorLegendWithMouseOver.d.ts +16 -0
  208. package/dist/ThresholdColorLegendWithMouseOver.js +2 -0
  209. package/dist/ThresholdColorLegendWithMouseOver.js.map +1 -0
  210. package/dist/Tooltip-BM18N_3l.cjs +2 -0
  211. package/dist/Tooltip-BM18N_3l.cjs.map +1 -0
  212. package/dist/Tooltip-CzZ1wFyF.js +47 -0
  213. package/dist/Tooltip-CzZ1wFyF.js.map +1 -0
  214. package/dist/TreeMapGraph.d.ts +158 -0
  215. package/dist/TreeMapGraph.js +2 -0
  216. package/dist/TreeMapGraph.js.map +1 -0
  217. package/dist/Types.d.ts +883 -0
  218. package/dist/Types.js +2 -0
  219. package/dist/Types.js.map +1 -0
  220. package/dist/Typography-CDR-DAHH.cjs +2 -0
  221. package/dist/Typography-CDR-DAHH.cjs.map +1 -0
  222. package/dist/Typography-XJoSE-By.js +58 -0
  223. package/dist/Typography-XJoSE-By.js.map +1 -0
  224. package/dist/UnitChart.d.ts +132 -0
  225. package/dist/UnitChart.js +2 -0
  226. package/dist/UnitChart.js.map +1 -0
  227. package/dist/XAxesLabels-C9REbQQs.cjs +2 -0
  228. package/dist/XAxesLabels-C9REbQQs.cjs.map +1 -0
  229. package/dist/XAxesLabels-DVw7Lvuz.js +58 -0
  230. package/dist/XAxesLabels-DVw7Lvuz.js.map +1 -0
  231. package/dist/XTicksAndGridLines-CUefTINd.js +57 -0
  232. package/dist/XTicksAndGridLines-CUefTINd.js.map +1 -0
  233. package/dist/XTicksAndGridLines-DuK35ROS.cjs +2 -0
  234. package/dist/XTicksAndGridLines-DuK35ROS.cjs.map +1 -0
  235. package/dist/YAxesLabels-CYVY053X.js +53 -0
  236. package/dist/YAxesLabels-CYVY053X.js.map +1 -0
  237. package/dist/YAxesLabels-DhBdLk3Z.cjs +2 -0
  238. package/dist/YAxesLabels-DhBdLk3Z.cjs.map +1 -0
  239. package/dist/YTicksAndGridLines-BJRXuBdC.js +57 -0
  240. package/dist/YTicksAndGridLines-BJRXuBdC.js.map +1 -0
  241. package/dist/YTicksAndGridLines-CtLvzExe.cjs +2 -0
  242. package/dist/YTicksAndGridLines-CtLvzExe.cjs.map +1 -0
  243. package/dist/_commonjsHelpers-DKOUU3wS.cjs +2 -0
  244. package/dist/_commonjsHelpers-DKOUU3wS.cjs.map +1 -0
  245. package/dist/_commonjsHelpers-DaMA6jEr.js +9 -0
  246. package/dist/_commonjsHelpers-DaMA6jEr.js.map +1 -0
  247. package/dist/area-BE2wo7fv.js +53 -0
  248. package/dist/area-BE2wo7fv.js.map +1 -0
  249. package/dist/area-D3Qx7k7K.cjs +2 -0
  250. package/dist/area-D3Qx7k7K.cjs.map +1 -0
  251. package/dist/array-B7TkkRH0.js +89 -0
  252. package/dist/array-B7TkkRH0.js.map +1 -0
  253. package/dist/array-DKbXV8lR.cjs +2 -0
  254. package/dist/array-DKbXV8lR.cjs.map +1 -0
  255. package/dist/band-BEjh2CHI.js +47 -0
  256. package/dist/band-BEjh2CHI.js.map +1 -0
  257. package/dist/band-CAApY4Pd.cjs +2 -0
  258. package/dist/band-CAApY4Pd.cjs.map +1 -0
  259. package/dist/checkIfMultiple-CaefP4X2.js +2264 -0
  260. package/dist/checkIfMultiple-CaefP4X2.js.map +1 -0
  261. package/dist/checkIfMultiple-D3h8to1T.cjs +12 -0
  262. package/dist/checkIfMultiple-D3h8to1T.cjs.map +1 -0
  263. package/dist/checkIfNullOrUndefined.d.ts +15 -0
  264. package/dist/checkIfNullOrUndefined.js +2 -0
  265. package/dist/checkIfNullOrUndefined.js.map +1 -0
  266. package/dist/customArea-B47Ew5cT.cjs +2 -0
  267. package/dist/customArea-B47Ew5cT.cjs.map +1 -0
  268. package/dist/customArea-I3MsoqIl.js +176 -0
  269. package/dist/customArea-I3MsoqIl.js.map +1 -0
  270. package/dist/defaultLocale-BEa-49Qz.js +172 -0
  271. package/dist/defaultLocale-BEa-49Qz.js.map +1 -0
  272. package/dist/defaultLocale-DIVzfLaQ.cjs +2 -0
  273. package/dist/defaultLocale-DIVzfLaQ.cjs.map +1 -0
  274. package/dist/delaunay-C1uAf38t.js +684 -0
  275. package/dist/delaunay-C1uAf38t.js.map +1 -0
  276. package/dist/delaunay-rcy0HhZi.cjs +2 -0
  277. package/dist/delaunay-rcy0HhZi.cjs.map +1 -0
  278. package/dist/ensureCompleteData-BBDZbDCE.js +102 -0
  279. package/dist/ensureCompleteData-BBDZbDCE.js.map +1 -0
  280. package/dist/ensureCompleteData-DqWQ2Zbi.cjs +2 -0
  281. package/dist/ensureCompleteData-DqWQ2Zbi.cjs.map +1 -0
  282. package/dist/excelDownload.d.ts +31 -0
  283. package/dist/excelDownload.js +2 -0
  284. package/dist/excelDownload.js.map +1 -0
  285. package/dist/fetchAndParseData.d.ts +84 -0
  286. package/dist/fetchAndParseData.js +16 -0
  287. package/dist/fetchAndParseData.js.map +1 -0
  288. package/dist/filterData-B8ocT57s.js +14 -0
  289. package/dist/filterData-B8ocT57s.js.map +1 -0
  290. package/dist/filterData-DN6py7y_.cjs +2 -0
  291. package/dist/filterData-DN6py7y_.cjs.map +1 -0
  292. package/dist/generateCodes.d.ts +25 -0
  293. package/dist/generateCodes.js +2 -0
  294. package/dist/generateCodes.js.map +1 -0
  295. package/dist/generateRandomString-B5zBiJzS.cjs +2 -0
  296. package/dist/generateRandomString-B5zBiJzS.cjs.map +1 -0
  297. package/dist/generateRandomString-za3IQGfQ.js +11 -0
  298. package/dist/generateRandomString-za3IQGfQ.js.map +1 -0
  299. package/dist/getJenks.d.ts +17 -0
  300. package/dist/getJenks.js +2 -0
  301. package/dist/getJenks.js.map +1 -0
  302. package/dist/getPercentileValue.d.ts +13 -0
  303. package/dist/getPercentileValue.js +2 -0
  304. package/dist/getPercentileValue.js.map +1 -0
  305. package/dist/getQueryParamsFromLink.d.ts +18 -0
  306. package/dist/getQueryParamsFromLink.js +2 -0
  307. package/dist/getQueryParamsFromLink.js.map +1 -0
  308. package/dist/getSchema.d.ts +3256 -0
  309. package/dist/getSchema.js +2 -0
  310. package/dist/getSchema.js.map +1 -0
  311. package/dist/getSliderMarks-CWajGCGq.js +719 -0
  312. package/dist/getSliderMarks-CWajGCGq.js.map +1 -0
  313. package/dist/getSliderMarks-DDJ1CdhL.cjs +6 -0
  314. package/dist/getSliderMarks-DDJ1CdhL.cjs.map +1 -0
  315. package/dist/getTextColorBasedOnBgColor.d.ts +13 -0
  316. package/dist/getTextColorBasedOnBgColor.js +2 -0
  317. package/dist/getTextColorBasedOnBgColor.js.map +1 -0
  318. package/dist/getUniqValue.d.ts +18 -0
  319. package/dist/getUniqValue.js +2 -0
  320. package/dist/getUniqValue.js.map +1 -0
  321. package/dist/graphList.d.ts +9 -0
  322. package/dist/graphList.js +2 -0
  323. package/dist/graphList.js.map +1 -0
  324. package/dist/imageDownload.d.ts +16 -0
  325. package/dist/imageDownload.js +3 -0
  326. package/dist/imageDownload.js.map +1 -0
  327. package/dist/index-01r5X3Gr-9jE0ObrK.cjs +2 -0
  328. package/dist/index-01r5X3Gr-9jE0ObrK.cjs.map +1 -0
  329. package/dist/index-01r5X3Gr-kH7FxQ7P.js +451 -0
  330. package/dist/index-01r5X3Gr-kH7FxQ7P.js.map +1 -0
  331. package/dist/index-27yTRcko.js +35 -0
  332. package/dist/index-27yTRcko.js.map +1 -0
  333. package/dist/index-B0rbzOoC.cjs +2 -0
  334. package/dist/index-B0rbzOoC.cjs.map +1 -0
  335. package/dist/index-BGMGC-HN.cjs +22 -0
  336. package/dist/index-BGMGC-HN.cjs.map +1 -0
  337. package/dist/index-BHm2KTjD-2e-Fu8L-.js +702 -0
  338. package/dist/index-BHm2KTjD-2e-Fu8L-.js.map +1 -0
  339. package/dist/index-BHm2KTjD-D8FylaKc.cjs +44 -0
  340. package/dist/index-BHm2KTjD-D8FylaKc.cjs.map +1 -0
  341. package/dist/index-BIPNFFja.js +506 -0
  342. package/dist/index-BIPNFFja.js.map +1 -0
  343. package/dist/index-BLizQDlg.js +658 -0
  344. package/dist/index-BLizQDlg.js.map +1 -0
  345. package/dist/index-BXns0-ng.cjs +2 -0
  346. package/dist/index-BXns0-ng.cjs.map +1 -0
  347. package/dist/index-BYroABPm.cjs +2 -0
  348. package/dist/index-BYroABPm.cjs.map +1 -0
  349. package/dist/index-BczVvEBZ.cjs +2 -0
  350. package/dist/index-BczVvEBZ.cjs.map +1 -0
  351. package/dist/index-BzeLQvXk.cjs +2 -0
  352. package/dist/index-BzeLQvXk.cjs.map +1 -0
  353. package/dist/index-C1rRk_50.js +273 -0
  354. package/dist/index-C1rRk_50.js.map +1 -0
  355. package/dist/index-C21TvELx.cjs +2 -0
  356. package/dist/index-C21TvELx.cjs.map +1 -0
  357. package/dist/index-CEc_9zWy.cjs +2 -0
  358. package/dist/index-CEc_9zWy.cjs.map +1 -0
  359. package/dist/index-CZbIGs8q.cjs +2 -0
  360. package/dist/index-CZbIGs8q.cjs.map +1 -0
  361. package/dist/index-CaAIPGZo.js +631 -0
  362. package/dist/index-CaAIPGZo.js.map +1 -0
  363. package/dist/index-CbVeVrla.cjs +2 -0
  364. package/dist/index-CbVeVrla.cjs.map +1 -0
  365. package/dist/index-CqzhBPuO-CfQywbdq.js +41 -0
  366. package/dist/index-CqzhBPuO-CfQywbdq.js.map +1 -0
  367. package/dist/index-CqzhBPuO-raKZqS7l.cjs +2 -0
  368. package/dist/index-CqzhBPuO-raKZqS7l.cjs.map +1 -0
  369. package/dist/index-D7ltPi18.js +26 -0
  370. package/dist/index-D7ltPi18.js.map +1 -0
  371. package/dist/index-DSnvdkHZ.js +495 -0
  372. package/dist/index-DSnvdkHZ.js.map +1 -0
  373. package/dist/index-DXmF_0ez.js +308 -0
  374. package/dist/index-DXmF_0ez.js.map +1 -0
  375. package/dist/index-Db-Yg_Ud.js +120 -0
  376. package/dist/index-Db-Yg_Ud.js.map +1 -0
  377. package/dist/index-Ds0uHjK9.cjs +2 -0
  378. package/dist/index-Ds0uHjK9.cjs.map +1 -0
  379. package/dist/index-DxagiOHo.js +707 -0
  380. package/dist/index-DxagiOHo.js.map +1 -0
  381. package/dist/index-DzdwZ2OA.js +77 -0
  382. package/dist/index-DzdwZ2OA.js.map +1 -0
  383. package/dist/index-UV9hjG_S.js +53 -0
  384. package/dist/index-UV9hjG_S.js.map +1 -0
  385. package/dist/index-a2C2Bqn2.cjs +10 -0
  386. package/dist/index-a2C2Bqn2.cjs.map +1 -0
  387. package/dist/index.js +1 -52488
  388. package/dist/index.js.map +1 -1
  389. package/dist/init-BhZylTFx.js +63 -0
  390. package/dist/init-BhZylTFx.js.map +1 -0
  391. package/dist/init-DU0ybBc_.cjs +2 -0
  392. package/dist/init-DU0ybBc_.cjs.map +1 -0
  393. package/dist/line-CPfhohvF.js +68 -0
  394. package/dist/line-CPfhohvF.js.map +1 -0
  395. package/dist/line-DHV4JwCR.cjs +2 -0
  396. package/dist/line-DHV4JwCR.cjs.map +1 -0
  397. package/dist/linear-BVckp9RD.cjs +2 -0
  398. package/dist/linear-BVckp9RD.cjs.map +1 -0
  399. package/dist/linear-DUdu7l2G.js +221 -0
  400. package/dist/linear-DUdu7l2G.js.map +1 -0
  401. package/dist/numberFormattingFunction.d.ts +22 -0
  402. package/dist/numberFormattingFunction.js +2 -0
  403. package/dist/numberFormattingFunction.js.map +1 -0
  404. package/dist/ordinal-BOeNbyae.cjs +2 -0
  405. package/dist/ordinal-BOeNbyae.cjs.map +1 -0
  406. package/dist/ordinal-w9Lu4Stb.js +62 -0
  407. package/dist/ordinal-w9Lu4Stb.js.map +1 -0
  408. package/dist/parse-DlCRUFh_.js +2768 -0
  409. package/dist/parse-DlCRUFh_.js.map +1 -0
  410. package/dist/parse-hMnG_lRV.cjs +2 -0
  411. package/dist/parse-hMnG_lRV.cjs.map +1 -0
  412. package/dist/pointer-CWRWOsrb.js +23 -0
  413. package/dist/pointer-CWRWOsrb.js.map +1 -0
  414. package/dist/pointer-Dkq5NV1q.cjs +2 -0
  415. package/dist/pointer-Dkq5NV1q.cjs.map +1 -0
  416. package/dist/pow-B5-jkdHU.cjs +2 -0
  417. package/dist/pow-B5-jkdHU.cjs.map +1 -0
  418. package/dist/pow-e8zx3AQJ.js +35 -0
  419. package/dist/pow-e8zx3AQJ.js.map +1 -0
  420. package/dist/removeOutliers.d.ts +16 -0
  421. package/dist/removeOutliers.js +2 -0
  422. package/dist/removeOutliers.js.map +1 -0
  423. package/dist/select-Bnfk0lJx.cjs +2 -0
  424. package/dist/select-Bnfk0lJx.cjs.map +1 -0
  425. package/dist/select-DKy99ogv.js +584 -0
  426. package/dist/select-DKy99ogv.js.map +1 -0
  427. package/dist/simple-statistics-flVzqVtt.js +65 -0
  428. package/dist/simple-statistics-flVzqVtt.js.map +1 -0
  429. package/dist/simple-statistics-xm8c0LQQ.cjs +2 -0
  430. package/dist/simple-statistics-xm8c0LQQ.cjs.map +1 -0
  431. package/dist/step-BZ3C8QFW.cjs +2 -0
  432. package/dist/step-BZ3C8QFW.cjs.map +1 -0
  433. package/dist/step-BrDul-H4.js +119 -0
  434. package/dist/step-BrDul-H4.js.map +1 -0
  435. package/dist/string-B8KlVSPX.js +364 -0
  436. package/dist/string-B8KlVSPX.js.map +1 -0
  437. package/dist/string-CRoCZCYa.cjs +2 -0
  438. package/dist/string-CRoCZCYa.cjs.map +1 -0
  439. package/dist/string2HTML-BX0oNw83.js +758 -0
  440. package/dist/string2HTML-BX0oNw83.js.map +1 -0
  441. package/dist/string2HTML-X4ZYX5jI.cjs +3 -0
  442. package/dist/string2HTML-X4ZYX5jI.cjs.map +1 -0
  443. package/dist/style.css +1 -1
  444. package/dist/svgDownload.d.ts +16 -0
  445. package/dist/svgDownload.js +2 -0
  446. package/dist/svgDownload.js.map +1 -0
  447. package/dist/threshold-DFfqcDMa.js +23 -0
  448. package/dist/threshold-DFfqcDMa.js.map +1 -0
  449. package/dist/threshold-DNsSUf8Q.cjs +2 -0
  450. package/dist/threshold-DNsSUf8Q.cjs.map +1 -0
  451. package/dist/time-Byw_jYQ7.cjs +2 -0
  452. package/dist/time-Byw_jYQ7.cjs.map +1 -0
  453. package/dist/time-BzJP5SPC.js +715 -0
  454. package/dist/time-BzJP5SPC.js.map +1 -0
  455. package/dist/timer-B39XOBYL.js +124 -0
  456. package/dist/timer-B39XOBYL.js.map +1 -0
  457. package/dist/timer-CKyBCVzT.cjs +2 -0
  458. package/dist/timer-CKyBCVzT.cjs.map +1 -0
  459. package/dist/toConsumableArray-BSMMWi3w-Cu4vcE-m.js +139 -0
  460. package/dist/toConsumableArray-BSMMWi3w-Cu4vcE-m.js.map +1 -0
  461. package/dist/toConsumableArray-BSMMWi3w-DJL7-zAp.cjs +4 -0
  462. package/dist/toConsumableArray-BSMMWi3w-DJL7-zAp.cjs.map +1 -0
  463. package/dist/transformColumnsToArray.d.ts +38 -0
  464. package/dist/transformColumnsToArray.js +2 -0
  465. package/dist/transformColumnsToArray.js.map +1 -0
  466. package/dist/transformDataForAggregation.d.ts +38 -0
  467. package/dist/transformDataForAggregation.js +2 -0
  468. package/dist/transformDataForAggregation.js.map +1 -0
  469. package/dist/transformDataForGraph.d.ts +47 -0
  470. package/dist/transformDataForGraph.js +2 -0
  471. package/dist/transformDataForGraph.js.map +1 -0
  472. package/dist/transformDataForGraphFromFile.d.ts +66 -0
  473. package/dist/transformDataForGraphFromFile.js +2 -0
  474. package/dist/transformDataForGraphFromFile.js.map +1 -0
  475. package/dist/use-in-view-CZPXmTZM.js +4645 -0
  476. package/dist/use-in-view-CZPXmTZM.js.map +1 -0
  477. package/dist/use-in-view-Dl1CsAIo.cjs +2 -0
  478. package/dist/use-in-view-Dl1CsAIo.cjs.map +1 -0
  479. package/dist/validateSchema.d.ts +68 -0
  480. package/dist/validateSchema.js +2 -0
  481. package/dist/validateSchema.js.map +1 -0
  482. package/dist/x-Dft9NVe_-DcB7wtv5.js +61 -0
  483. package/dist/x-Dft9NVe_-DcB7wtv5.js.map +1 -0
  484. package/dist/x-Dft9NVe_-LeyJu02C.cjs +27 -0
  485. package/dist/x-Dft9NVe_-LeyJu02C.cjs.map +1 -0
  486. package/dist/y-D0sAaVii.js +421 -0
  487. package/dist/y-D0sAaVii.js.map +1 -0
  488. package/dist/y-QcCbqrzx.cjs +2 -0
  489. package/dist/y-QcCbqrzx.cjs.map +1 -0
  490. package/dist/zoom-Lo7IAUfC.cjs +2 -0
  491. package/dist/zoom-Lo7IAUfC.cjs.map +1 -0
  492. package/dist/zoom-_lqdiGoI.js +1983 -0
  493. package/dist/zoom-_lqdiGoI.js.map +1 -0
  494. package/package.json +415 -4
  495. package/dist/index.cjs +0 -68
  496. package/dist/index.cjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GeoHubCompareMaps.js","sources":["../src/Components/Graphs/Maps/GeoHubMaps/CompareMaps/Graph.tsx","../src/Components/Graphs/Maps/GeoHubMaps/CompareMaps/index.tsx"],"sourcesContent":["import { useRef, useEffect, useState } from 'react';\r\nimport * as maplibreGl from 'maplibre-gl';\r\nimport * as pmtiles from 'pmtiles';\r\nimport 'maplibre-gl/dist/maplibre-gl.css';\r\nimport { select } from 'd3-selection';\r\nimport {\r\n DndContext,\r\n useDraggable,\r\n useSensor,\r\n useSensors,\r\n PointerSensor,\r\n DragMoveEvent,\r\n} from '@dnd-kit/core';\r\nimport { restrictToHorizontalAxis } from '@dnd-kit/modifiers';\r\nimport React from 'react';\r\n\r\nimport { ChevronLeftRight, X } from '@/Components/Icons';\r\nimport { string2HTML } from '@/Utils/string2HTML';\r\n\r\ninterface Props {\r\n width: number;\r\n height: number;\r\n mapStyles: [string, string];\r\n center: [number, number];\r\n mapLegend?: string | React.ReactNode;\r\n zoomLevel: number;\r\n}\r\n\r\nfunction synchronizeMap(map1: maplibreGl.Map, map2: maplibreGl.Map) {\r\n let isSyncing = false;\r\n function syncMap(sourceMap: maplibreGl.Map, targetMap: maplibreGl.Map) {\r\n if (!isSyncing) {\r\n isSyncing = true;\r\n const center = sourceMap.getCenter();\r\n const zoom = sourceMap.getZoom();\r\n const bearing = sourceMap.getBearing();\r\n const pitch = sourceMap.getPitch();\r\n targetMap.jumpTo({\r\n center,\r\n zoom,\r\n bearing,\r\n pitch,\r\n });\r\n isSyncing = false;\r\n }\r\n }\r\n\r\n // Event listeners for map1\r\n map1.on('move', () => {\r\n syncMap(map1, map2);\r\n });\r\n\r\n // Event listeners for map2\r\n map2.on('move', () => {\r\n syncMap(map2, map1);\r\n });\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const { height, width, mapStyles, center, zoomLevel, mapLegend } = props;\r\n const [position, setPosition] = useState(50);\r\n const [isDragging, setIsDragging] = useState(false);\r\n const containerRef = useRef<HTMLDivElement>(null);\r\n const [showLegend, setShowLegend] = useState(true);\r\n const dragStartPositionRef = useRef(50);\r\n const sliderWidthRef = useRef(0);\r\n\r\n const sensors = useSensors(useSensor(PointerSensor, { activationConstraint: { distance: 0 } }));\r\n\r\n const handleDragStart = () => {\r\n setIsDragging(true);\r\n dragStartPositionRef.current = position;\r\n\r\n if (containerRef.current) {\r\n sliderWidthRef.current = containerRef.current.getBoundingClientRect().width;\r\n }\r\n };\r\n\r\n const handleDragMove = (event: DragMoveEvent) => {\r\n if (!containerRef.current || sliderWidthRef.current === 0) return;\r\n\r\n // Calculate position change as percentage of width\r\n const deltaPercentage = (event.delta.x / sliderWidthRef.current) * 100;\r\n const newPosition = Math.max(0, Math.min(100, dragStartPositionRef.current + deltaPercentage));\r\n\r\n setPosition(newPosition);\r\n };\r\n\r\n const handleDragEnd = () => {\r\n setIsDragging(false);\r\n };\r\n\r\n const handleClick = (e: React.MouseEvent) => {\r\n if (isDragging || !containerRef.current) return;\r\n\r\n const rect = containerRef.current.getBoundingClientRect();\r\n const clickX = e.clientX - rect.left;\r\n const newPosition = (clickX / rect.width) * 100;\r\n\r\n setPosition(Math.max(0, Math.min(100, newPosition)));\r\n };\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const leftMapRef = useRef<HTMLDivElement>(null);\r\n const rightMapRef = useRef<HTMLDivElement>(null);\r\n const mapContainer = useRef<HTMLDivElement>(null);\r\n useEffect(() => {\r\n if (mapContainer.current && leftMapRef.current && rightMapRef.current && width) {\r\n const mapDiv = select(mapContainer.current);\r\n mapDiv.selectAll('.maplibregl-compare').remove();\r\n const leftMapDiv = select(leftMapRef.current);\r\n leftMapDiv.selectAll('div').remove();\r\n const rightMapDiv = select(rightMapRef.current);\r\n rightMapDiv.selectAll('div').remove();\r\n const protocol = new pmtiles.Protocol();\r\n maplibreGl.addProtocol('pmtiles', protocol.tile);\r\n const leftMap = new maplibreGl.Map({\r\n container: leftMapRef.current,\r\n style: mapStyles[0],\r\n center: center || [0, 0],\r\n zoom: zoomLevel || 4,\r\n });\r\n\r\n const rightMap = new maplibreGl.Map({\r\n container: rightMapRef.current,\r\n style: mapStyles[1],\r\n center: center || [0, 0],\r\n zoom: zoomLevel || 4,\r\n });\r\n rightMap.addControl(\r\n new maplibreGl.NavigationControl({\r\n visualizePitch: true,\r\n showZoom: true,\r\n showCompass: true,\r\n }),\r\n 'bottom-right',\r\n );\r\n leftMap.addControl(new maplibreGl.ScaleControl(), 'bottom-left');\r\n leftMap.addControl(\r\n new maplibreGl.NavigationControl({\r\n visualizePitch: true,\r\n showZoom: true,\r\n showCompass: true,\r\n }),\r\n 'bottom-right',\r\n );\r\n rightMap.addControl(new maplibreGl.ScaleControl(), 'bottom-left');\r\n synchronizeMap(leftMap, rightMap);\r\n }\r\n }, [width, mapStyles, center, zoomLevel]);\r\n return (\r\n <div\r\n className='flex flex-col grow justify-center leading-0'\r\n ref={graphDiv}\r\n aria-label='Map area'\r\n >\r\n <div\r\n style={{\r\n width,\r\n height,\r\n }}\r\n >\r\n <div\r\n ref={mapContainer}\r\n className='map maplibre-show-control relative w-full h-full'\r\n style={{ inset: 0 }}\r\n >\r\n <DndContext\r\n sensors={sensors}\r\n modifiers={[restrictToHorizontalAxis]}\r\n onDragStart={handleDragStart}\r\n onDragMove={handleDragMove}\r\n onDragEnd={handleDragEnd}\r\n >\r\n <div\r\n ref={containerRef}\r\n style={{\r\n position: 'relative',\r\n width,\r\n height,\r\n overflow: 'hidden',\r\n cursor: isDragging ? 'grabbing' : 'col-resize',\r\n userSelect: 'none', // Prevent text selection during drag\r\n }}\r\n onClick={handleClick}\r\n >\r\n <div\r\n ref={rightMapRef}\r\n className='absolute h-full rightMap w-full'\r\n style={{\r\n position: 'absolute',\r\n top: 0,\r\n left: 0,\r\n clipPath: `polygon(${position}% 0%, ${position}% 100%, 100% 100%, 100% 0%)`,\r\n }}\r\n />\r\n <div\r\n ref={leftMapRef}\r\n className='absolute h-full leftMap w-full'\r\n style={{\r\n position: 'absolute',\r\n top: 0,\r\n left: 0,\r\n inset: 0,\r\n clipPath: `polygon(0% 0%, ${position}% 0%, ${position}% 100%, 0% 100%)`,\r\n }}\r\n />\r\n\r\n <SliderHandle position={position} />\r\n </div>\r\n </DndContext>\r\n </div>\r\n </div>\r\n {mapLegend ? (\r\n <div className='absolute left-[22px] bottom-13'>\r\n {showLegend ? (\r\n <>\r\n <div\r\n style={{\r\n backgroundColor: 'rgba(240,240,240, 0.7)',\r\n border: '1px solid var(--gray-400)',\r\n borderRadius: '999px',\r\n width: '24px',\r\n height: '24px',\r\n padding: '3px',\r\n cursor: 'pointer',\r\n zIndex: 10,\r\n position: 'absolute',\r\n right: '-0.75rem',\r\n top: '-0.75rem',\r\n }}\r\n onClick={() => {\r\n setShowLegend(false);\r\n }}\r\n >\r\n <X />\r\n </div>\r\n <div\r\n className='p-2'\r\n style={{\r\n backgroundColor: 'rgba(240,240,240, 0.7)',\r\n }}\r\n dangerouslySetInnerHTML={\r\n typeof mapLegend === 'string' ? { __html: string2HTML(mapLegend) } : undefined\r\n }\r\n >\r\n {React.isValidElement(mapLegend) ? mapLegend : null}\r\n </div>\r\n </>\r\n ) : (\r\n <button\r\n type='button'\r\n className='mb-0 border-0 bg-transparent p-0 self-start'\r\n onClick={() => {\r\n setShowLegend(true);\r\n }}\r\n >\r\n <div className='items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-550 border-primary-gray-400 dark:border-primary-gray-500'>\r\n Show Legend\r\n </div>\r\n </button>\r\n )}\r\n </div>\r\n ) : null}\r\n </div>\r\n );\r\n}\r\n\r\ninterface HandleProps {\r\n position: number;\r\n}\r\n\r\nfunction SliderHandle(props: HandleProps) {\r\n const { position } = props;\r\n const { attributes, listeners, setNodeRef } = useDraggable({ id: 'slider-handle' });\r\n\r\n return (\r\n <div\r\n ref={setNodeRef}\r\n style={{\r\n position: 'absolute',\r\n left: `${position}%`,\r\n top: 0,\r\n bottom: 0,\r\n width: '40px',\r\n transform: 'translateX(-50%)',\r\n cursor: 'col-resize',\r\n display: 'flex',\r\n justifyContent: 'center',\r\n alignItems: 'center',\r\n zIndex: 10,\r\n touchAction: 'none',\r\n }}\r\n {...listeners}\r\n {...attributes}\r\n >\r\n <div\r\n className='h-full bg-primary-blue-600 dark:bg-primary-blue-400'\r\n style={{ width: '2px' }}\r\n />\r\n <div\r\n className='flex bg-primary-blue-600 dark:bg-primary-blue-400 rounded-full absolute items-center justify-center text-primary-white font-primary-white'\r\n style={{\r\n boxShadow: 'inset 0 0 0 1px #fff',\r\n width: '42px',\r\n height: '42px',\r\n top: 'calc(50% - 21px)',\r\n left: '0',\r\n cursor: 'col-resize',\r\n }}\r\n >\r\n <ChevronLeftRight />\r\n </div>\r\n </div>\r\n );\r\n}\r\n","import { useRef, useEffect, useState } from 'react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { ClassNameObject, Languages, SourcesDataType, StyleObject } from '@/Types';\r\n\r\ninterface Props {\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 /** Background color of the graph */\r\n backgroundColor?: string | boolean;\r\n /** Custom styles for the graph. Each object should be a valid React CSS style object. */\r\n styles?: StyleObject;\r\n /** Custom class names */\r\n classNames?: ClassNameObject;\r\n\r\n // Size and Spacing\r\n /** Width of the graph */\r\n width?: number;\r\n /** Height of the graph */\r\n height?: number;\r\n /** Minimum height of the graph */\r\n minHeight?: number;\r\n /** Relative height scaling factor. This overwrites the height props */\r\n relativeHeight?: number;\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n\r\n // Graph Parameters\r\n /** URLs for mapStyles JSON user wants to compare */\r\n mapStyles: [string, string];\r\n /** Defines the legend for the map. mapLegend with type string is show as innerHTML. */\r\n mapLegend?: string | React.ReactNode;\r\n /** Starting center point of the map */\r\n center?: [number, number];\r\n /** Starting zoom level of the map */\r\n zoomLevel?: number;\r\n\r\n // Configuration and Options\r\n /** Language setting */\r\n language?: Languages;\r\n /** Color theme */\r\n theme?: 'light' | 'dark';\r\n /** Unique ID for the graph */\r\n graphID?: string;\r\n}\r\n\r\n/** For using these maps you will have to install [`maplibre`](https://maplibre.org/maplibre-gl-js/docs/#npm), [pmtiles](https://www.npmjs.com/package/pmtiles), [dnd-kit/core](https://www.npmjs.com/package/@dnd-kit/core), and [dnd-kit/modifier](https://www.npmjs.com/package/@dnd-kit/modifiers) package to your project */\r\nexport function GeoHubCompareMaps(props: Props) {\r\n const {\r\n graphTitle,\r\n height,\r\n width,\r\n relativeHeight,\r\n sources,\r\n graphDescription,\r\n footNote,\r\n padding,\r\n backgroundColor = false,\r\n graphID,\r\n mapStyles,\r\n center = [0, 0],\r\n zoomLevel = 3,\r\n language = 'en',\r\n minHeight = 0,\r\n theme = 'light',\r\n ariaLabel,\r\n styles,\r\n classNames,\r\n mapLegend,\r\n } = props;\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n const graphDiv = 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 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 classNames?.graphContainer,\r\n )}\r\n style={{\r\n ...(styles?.graphContainer || {}),\r\n ...(backgroundColor && backgroundColor !== true ? { backgroundColor } : {}),\r\n }}\r\n id={graphID}\r\n aria-label={\r\n ariaLabel ||\r\n `${\r\n graphTitle ? `The graph shows ${graphTitle}. ` : ''\r\n }This is a comparison between two maps.${graphDescription ? ` ${graphDescription}` : ''}`\r\n }\r\n >\r\n <div\r\n className='flex grow'\r\n style={{ padding: backgroundColor ? padding || '1rem' : padding || 0 }}\r\n >\r\n <div className='flex flex-col w-full gap-4 grow justify-between'>\r\n {graphTitle || graphDescription ? (\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 />\r\n ) : null}\r\n <div\r\n className='flex flex-col grow justify-center leading-0'\r\n ref={graphDiv}\r\n aria-label='map area'\r\n >\r\n {(width || svgWidth) && (height || svgHeight) ? (\r\n <Graph\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 mapStyles={mapStyles}\r\n center={center}\r\n zoomLevel={zoomLevel}\r\n mapLegend={mapLegend}\r\n />\r\n ) : null}\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":["synchronizeMap","map1","map2","isSyncing","syncMap","sourceMap","targetMap","center","zoom","bearing","pitch","Graph","props","height","width","mapStyles","zoomLevel","mapLegend","position","setPosition","useState","isDragging","setIsDragging","containerRef","useRef","showLegend","setShowLegend","dragStartPositionRef","sliderWidthRef","sensors","useSensors","useSensor","PointerSensor","handleDragStart","handleDragMove","event","deltaPercentage","newPosition","handleDragEnd","handleClick","e","rect","graphDiv","leftMapRef","rightMapRef","mapContainer","useEffect","select","protocol","pmtiles","maplibreGl","leftMap","rightMap","jsxs","jsx","DndContext","restrictToHorizontalAxis","SliderHandle","Fragment","X","string2HTML","React","attributes","listeners","setNodeRef","useDraggable","ChevronLeftRight","GeoHubCompareMaps","graphTitle","relativeHeight","sources","graphDescription","footNote","padding","backgroundColor","graphID","language","minHeight","theme","ariaLabel","styles","classNames","svgWidth","setSvgWidth","svgHeight","setSvgHeight","resizeObserver","entries","cn","GraphHeader","GraphFooter"],"mappings":"0xBA4BA,SAASA,EAAeC,EAAsBC,EAAsB,CAClE,IAAIC,EAAY,GAChB,SAASC,EAAQC,EAA2BC,EAA2B,CACrE,GAAI,CAACH,EAAW,CACdA,EAAY,GACZ,MAAMI,EAASF,EAAU,UAAA,EACnBG,EAAOH,EAAU,QAAA,EACjBI,EAAUJ,EAAU,WAAA,EACpBK,EAAQL,EAAU,SAAA,EACxBC,EAAU,OAAO,CACf,OAAAC,EACA,KAAAC,EACA,QAAAC,EACA,MAAAC,CAAA,CACD,EACDP,EAAY,EACd,CACF,CAGAF,EAAK,GAAG,OAAQ,IAAM,CACpBG,EAAQH,EAAMC,CAAI,CACpB,CAAC,EAGDA,EAAK,GAAG,OAAQ,IAAM,CACpBE,EAAQF,EAAMD,CAAI,CACpB,CAAC,CACH,CAEO,SAASU,EAAMC,EAAc,CAClC,KAAM,CAAE,OAAAC,EAAQ,MAAAC,EAAO,UAAAC,EAAW,OAAAR,EAAQ,UAAAS,EAAW,UAAAC,GAAcL,EAC7D,CAACM,EAAUC,CAAW,EAAIC,EAAAA,SAAS,EAAE,EACrC,CAACC,EAAYC,CAAa,EAA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IA,CAAgB,GAAK,EAAE,GAGzF,SAAAjB,EAAAA,kBAAAA,IAAC,MAAA,CACC,UAAU,YACV,MAAO,CAAE,QAASoB,EAAkBD,GAAW,OAASA,GAAW,CAAA,EAEnE,SAAApB,EAAAA,kBAAAA,KAAC,MAAA,CAAI,UAAU,kDACZ,SAAA,CAAAe,GAAcG,EACbjB,EAAAA,kBAAAA,IAACmC,EAAAA,YAAA,CACC,OAAQ,CACN,MAAOT,GAAQ,MACf,YAAaA,GAAQ,WAAA,EAEvB,WAAY,CACV,MAAOC,GAAY,MACnB,YAAaA,GAAY,WAAA,EAE3B,WAAAb,EACA,iBAAAG,EACA,MAAAzD,CAAA,CAAA,EAEA,KACJwC,EAAAA,kBAAAA,IAAC,MAAA,CACC,UAAU,8CACV,IAAKZ,EACL,aAAW,WAET,UAAA5B,GAASoE,KAAcrE,GAAUuE,GACjC9B,EAAAA,kBAAAA,IAAC3C,EAAA,CACC,MAAOG,GAASoE,EAChB,OAAQ,KAAK,IACXL,EACAhE,IACGwD,EACGQ,GACG/D,GAASoE,GAAYb,EAAiBQ,GACpC/D,GAASoE,GAAYb,EACtBQ,GACD/D,GAASoE,GAAYb,EACxBe,EAAA,EAER,UAAArE,EACA,OAAAR,EACA,UAAAS,EACA,UAAAC,CAAA,CAAA,EAEA,IAAA,CAAA,EAELqD,GAAWE,EACVlB,EAAAA,kBAAAA,IAACoC,EAAAA,YAAA,CACC,OAAQ,CAAE,SAAUV,GAAQ,SAAU,OAAQA,GAAQ,MAAA,EACtD,WAAY,CACV,SAAUC,GAAY,SACtB,OAAQA,GAAY,MAAA,EAEtB,QAAAX,EACA,SAAAE,EACA,MAAA1D,CAAA,CAAA,EAEA,IAAA,CAAA,CACN,CAAA,CAAA,CACF,CAAA,CACF,CAAA,CAGN"}
@@ -0,0 +1,118 @@
1
+ import { default as default_2 } from 'react';
2
+ import { JSX } from 'react/jsx-runtime';
3
+
4
+ declare interface AxesClassNameObject {
5
+ gridLines?: string;
6
+ labels?: string;
7
+ title?: string;
8
+ axis?: string;
9
+ }
10
+
11
+ declare interface AxesStyleObject {
12
+ gridLines?: React.CSSProperties;
13
+ labels?: React.CSSProperties;
14
+ title?: React.CSSProperties;
15
+ axis?: React.CSSProperties;
16
+ }
17
+
18
+ declare interface ClassNameObject {
19
+ title?: string;
20
+ footnote?: string;
21
+ source?: string;
22
+ description?: string;
23
+ tooltip?: string;
24
+ xAxis?: AxesClassNameObject;
25
+ yAxis?: AxesClassNameObject;
26
+ legend?: string;
27
+ graphContainer?: string;
28
+ graphObjectValues?: string;
29
+ dataConnectors?: string;
30
+ mouseOverLine?: string;
31
+ regLine?: string;
32
+ dataCards?: string;
33
+ }
34
+
35
+ /** For using these maps you will have to install [`maplibre`](https://maplibre.org/maplibre-gl-js/docs/#npm) and [pmtiles](https://www.npmjs.com/package/pmtiles) package to your project */
36
+ export declare function GeoHubMap(props: Props): JSX.Element;
37
+
38
+ declare type Languages = 'en' | 'ar' | 'az' | 'bn' | 'cy' | 'he' | 'hi' | 'jp' | 'ka' | 'km' | 'ko' | 'my' | 'ne' | 'zh' | 'custom';
39
+
40
+ declare interface MapLegendDataType {
41
+ mapStyleName: string;
42
+ legend: string | React.ReactNode;
43
+ }
44
+
45
+ declare interface Props {
46
+ /** Title of the graph */
47
+ graphTitle?: string | default_2.ReactNode;
48
+ /** Description of the graph */
49
+ graphDescription?: string | default_2.ReactNode;
50
+ /** Footnote for the graph */
51
+ footNote?: string | default_2.ReactNode;
52
+ /** Source data for the graph */
53
+ sources?: SourcesDataType[];
54
+ /** Accessibility label */
55
+ ariaLabel?: string;
56
+ /** Background color of the graph */
57
+ backgroundColor?: string | boolean;
58
+ /** Custom styles for the graph. Each object should be a valid React CSS style object. */
59
+ styles?: StyleObject;
60
+ /** Custom class names */
61
+ classNames?: ClassNameObject;
62
+ /** Width of the graph */
63
+ width?: number;
64
+ /** Height of the graph */
65
+ height?: number;
66
+ /** Minimum height of the graph */
67
+ minHeight?: number;
68
+ /** Relative height scaling factor. This overwrites the height props */
69
+ relativeHeight?: number;
70
+ /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */
71
+ padding?: string;
72
+ /** URL for mapStyle JSON. If the type is string, otherwise it creates and dropdown and provide end user to select the map style they would like to */
73
+ mapStyle: string | {
74
+ style: string;
75
+ name: string;
76
+ }[];
77
+ /** Defines the legend for the map. If the mapStyle is string, mapLegend can be string or ReactNode. mapLegend with type string is show as innerHTML. If the mapStyle is not string, mapLegend is of type { mapStyleName: string; legend: string | React.ReactNode }[] where mapStyleName corresponds to the each name in the mapStyle. */
78
+ mapLegend?: string | default_2.ReactNode | MapLegendDataType[];
79
+ /** Starting center point of the map */
80
+ center?: [number, number];
81
+ /** Starting zoom level of the map */
82
+ zoomLevel?: number;
83
+ /** List of layer IDs to be included in the visualization. If this is present only these layers are included. */
84
+ includeLayers?: string[];
85
+ /** List of layer IDs to be excluded from the visualization */
86
+ excludeLayers?: string[];
87
+ /** Language setting */
88
+ language?: Languages;
89
+ /** Color theme */
90
+ theme?: 'light' | 'dark';
91
+ /** Theme for the UI elements */
92
+ uiMode?: 'light' | 'normal';
93
+ /** Unique ID for the graph */
94
+ graphID?: string;
95
+ }
96
+
97
+ declare interface SourcesDataType {
98
+ source: string;
99
+ link?: string;
100
+ }
101
+
102
+ declare interface StyleObject {
103
+ title?: React.CSSProperties;
104
+ footnote?: React.CSSProperties;
105
+ source?: React.CSSProperties;
106
+ description?: React.CSSProperties;
107
+ graphContainer?: React.CSSProperties;
108
+ tooltip?: React.CSSProperties;
109
+ xAxis?: AxesStyleObject;
110
+ yAxis?: AxesStyleObject;
111
+ graphObjectValues?: React.CSSProperties;
112
+ dataConnectors?: React.CSSProperties;
113
+ mouseOverLine?: React.CSSProperties;
114
+ regLine?: React.CSSProperties;
115
+ dataCards?: React.CSSProperties;
116
+ }
117
+
118
+ export { }
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-BHm2KTjD-D8FylaKc.cjs"),s=require("react"),k=require("./DropdownSelect-CuzV7gdj.cjs"),$=require("./Typography-CDR-DAHH.cjs"),R=require("maplibre-gl"),G=require("pmtiles");;/* empty css */const H=require("./fetchAndParseData.js"),L=require("./filterData-DN6py7y_.cjs"),O=require("./index-CEc_9zWy.cjs"),q=require("./string2HTML-X4ZYX5jI.cjs"),z=require("./select-Bnfk0lJx.cjs"),W=require("./GraphHeader.js"),A=require("./GraphFooter.js");function _(h){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(h){for(const n in h)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(h,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>h[n]})}}return t.default=h,Object.freeze(t)}const P=_(G);function F(h){const{mapStyle:t,height:n,width:r,relativeHeight:a,center:b,zoomLevel:j,minHeight:u,includeLayers:m,excludeLayers:g,mapLegend:i}=h,[o,w]=s.useState(0),[S,f]=s.useState(0),[N,E]=s.useState(!0),d=s.useRef(null),x=s.useRef(null),l=s.useRef(null);return s.useEffect(()=>{const c=new ResizeObserver(p=>{w(r||p[0].target.clientWidth||620),f(n||p[0].target.clientHeight||480)});return d.current&&(f(d.current.clientHeight||480),w(d.current.clientWidth||620),r||c.observe(d.current)),()=>c.disconnect()},[r,n]),s.useEffect(()=>{x.current&&o&&!l.current&&H.fetchAndParseJSON(t).then(c=>{z.select(x.current).selectAll("div").remove();const y=new P.Protocol;R.addProtocol("pmtiles",y.tile);const v={container:x.current,style:m.length===0&&g.length===0?c:{...c,layers:L.filterData(c.layers,[{column:"id",includeValues:m,excludeValues:g}])},attributionControl:!0};b&&(v.center=b),j&&(v.zoom=j),l.current=new R.Map(v),l.current.addControl(new R.NavigationControl({visualizePitch:!0,showZoom:!0,showCompass:!0}),"bottom-right"),l.current.addControl(new R.ScaleControl,"bottom-left")})},[o,b,j,m,g,t]),s.useEffect(()=>{l.current&&H.fetchAndParseJSON(t).then(c=>{const p={...c,layers:L.filterData(c.layers,[{column:"id",includeValues:m,excludeValues:g}])};l.current.setStyle(p)})},[g,m,t]),e.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:d,"aria-label":"Map area",children:(r||o)&&(n||S)?e.jsxRuntimeExports.jsxs("div",{style:{width:r||o,height:Math.max(u,n||(a?u?(r||o)*a>u?(r||o)*a:u:(r||o)*a:S))},children:[e.jsxRuntimeExports.jsx("div",{ref:x,className:"map maplibre-show-control",style:{width:"100%",height:"100%"}}),i?e.jsxRuntimeExports.jsx("div",{className:"absolute left-[22px] bottom-13",children:N?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{style:{backgroundColor:"rgba(240,240,240, 0.7)",border:"1px solid var(--gray-400)",borderRadius:"999px",width:"24px",height:"24px",padding:"3px",cursor:"pointer",zIndex:10,position:"absolute",right:"-0.75rem",top:"-0.75rem"},onClick:()=>{E(!1)},children:e.jsxRuntimeExports.jsx(O.X,{})}),e.jsxRuntimeExports.jsx("div",{className:"p-2",style:{backgroundColor:"rgba(240,240,240, 0.7)"},dangerouslySetInnerHTML:typeof i=="string"?{__html:q.string2HTML(i)}:void 0,children:s.isValidElement(i)?i:null})]}):e.jsxRuntimeExports.jsx("button",{type:"button",className:"mb-0 border-0 bg-transparent p-0 self-start",onClick:()=>{E(!0)},children:e.jsxRuntimeExports.jsx("div",{className:"items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-550 border-primary-gray-400 dark:border-primary-gray-500",children:"Show Legend"})})}):null]}):null})}function I(h){const{mapStyle:t,height:n,width:r,relativeHeight:a,center:b,zoomLevel:j,minHeight:u,includeLayers:m,excludeLayers:g,mapLegend:i}=h,[o,w]=s.useState(0),[S,f]=s.useState(0),[N,E]=s.useState(!0),d=s.useRef(null),x=s.useRef(null);return s.useEffect(()=>{const l=new ResizeObserver(c=>{w(r||c[0].target.clientWidth||620),f(n||c[0].target.clientHeight||480)});return d.current&&(f(d.current.clientHeight||480),w(d.current.clientWidth||620),r||l.observe(d.current)),()=>l.disconnect()},[r,n]),s.useEffect(()=>{x.current&&o&&H.fetchAndParseJSON(t).then(l=>{z.select(x.current).selectAll("div").remove();const p=new P.Protocol;R.addProtocol("pmtiles",p.tile);const y={container:x.current,style:m.length===0&&g.length===0?l:{...l,layers:L.filterData(l.layers,[{column:"id",includeValues:m,excludeValues:g}])},attributionControl:!0};b&&(y.center=b),j&&(y.zoom=j);const v=new R.Map(y);v.addControl(new R.NavigationControl({visualizePitch:!0,showZoom:!0,showCompass:!0}),"bottom-right"),v.addControl(new R.ScaleControl,"bottom-left")})},[o,t,b,j,m,g]),e.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:d,"aria-label":"Map area",children:(r||o)&&(n||S)?e.jsxRuntimeExports.jsxs("div",{style:{width:r||o,height:Math.max(u,n||(a?u?(r||o)*a>u?(r||o)*a:u:(r||o)*a:S))},children:[e.jsxRuntimeExports.jsx("div",{ref:x,className:"map maplibre-show-control",style:{width:"100%",height:"100%"}}),i?e.jsxRuntimeExports.jsx("div",{className:"absolute left-[22px] bottom-13",children:N?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{style:{backgroundColor:"rgba(240,240,240, 0.7)",border:"1px solid var(--gray-400)",borderRadius:"999px",width:"24px",height:"24px",padding:"3px",cursor:"pointer",zIndex:10,position:"absolute",right:"-0.75rem",top:"-0.75rem"},onClick:()=>{E(!1)},children:e.jsxRuntimeExports.jsx(O.X,{})}),e.jsxRuntimeExports.jsx("div",{className:"p-2",style:{backgroundColor:"rgba(240,240,240, 0.7)"},dangerouslySetInnerHTML:typeof i=="string"?{__html:q.string2HTML(i)}:void 0,children:s.isValidElement(i)?i:null})]}):e.jsxRuntimeExports.jsx("button",{type:"button",className:"mb-0 border-0 bg-transparent p-0 self-start",onClick:()=>{E(!0)},children:e.jsxRuntimeExports.jsx("div",{className:"items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-550 border-primary-gray-400 dark:border-primary-gray-500",children:"Show Legend"})})}):null]}):null})}function J(h){const{mapStyle:t,graphTitle:n,height:r,width:a,relativeHeight:b,sources:j,graphDescription:u,footNote:m,padding:g,backgroundColor:i=!1,center:o,zoomLevel:w,graphID:S,language:f="en",minHeight:N=0,theme:E="light",includeLayers:d=[],excludeLayers:x=[],ariaLabel:l,uiMode:c="normal",styles:p,classNames:y,mapLegend:v}=h,[M,D]=s.useState(typeof t=="string"?t:t[0].style);s.useEffect(()=>{D(typeof t=="string"?t:t[0].style)},[t]);const T=s.useMemo(()=>({ignoreCase:!0,ignoreAccents:!0,trim:!0}),[]);return e.jsxRuntimeExports.jsx("div",{className:`${E||"light"} flex ${a?"w-fit grow-0":"w-full grow"}`,dir:f==="he"||f==="ar"?"rtl":void 0,children:e.jsxRuntimeExports.jsx("div",{className:$.cnExports.cn(`${i?i===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${f||"en"}`,y?.graphContainer),style:{...p?.graphContainer||{},...i&&i!==!0?{backgroundColor:i}:{}},id:S,"aria-label":l||`${n?`The graph shows ${n}. `:""}This is a map.${u?` ${u}`:""}`,children:e.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:i?g||"1rem":g||0},children:e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[n||u?e.jsxRuntimeExports.jsx(W.GraphHeader,{styles:{title:p?.title,description:p?.description},classNames:{title:y?.title,description:y?.description},graphTitle:n,graphDescription:u,width:a}):null,typeof t=="string"?null:e.jsxRuntimeExports.jsx(k.DropdownSelectExports.DropdownSelect,{options:t.map(C=>({label:C.name,value:C.style})),isClearable:!1,size:"sm",variant:c,isRtl:f==="he"||f==="ar",isSearchable:!0,filterOption:k.DropdownSelectExports.createFilter(T),defaultValue:{label:t[0].name,value:t[0].style},controlShouldRenderValue:!0,onChange:C=>{C&&D(C.value)}}),typeof t=="string"?e.jsxRuntimeExports.jsx(I,{mapStyle:t,center:o,zoomLevel:w,width:a,height:r,relativeHeight:b,minHeight:N,includeLayers:d,excludeLayers:x,mapLegend:v}):e.jsxRuntimeExports.jsx(F,{mapStyle:M,center:o,zoomLevel:w,width:a,height:r,relativeHeight:b,minHeight:N,includeLayers:d,excludeLayers:x,mapLegend:(v||[]).find(C=>C.mapStyleName===t.find(V=>V.style===M)?.name)?.legend}),j||m?e.jsxRuntimeExports.jsx(A.GraphFooter,{styles:{footnote:p?.footnote,source:p?.source},classNames:{footnote:y?.footnote,source:y?.source},sources:j,footNote:m,width:a}):null]})})})})}exports.GeoHubMap=J;
2
+ //# sourceMappingURL=GeoHubMap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GeoHubMap.js","sources":["../src/Components/Graphs/Maps/GeoHubMaps/SimpleMap/GeoHubMultipleMap.tsx","../src/Components/Graphs/Maps/GeoHubMaps/SimpleMap/GeoHubSingleMap.tsx","../src/Components/Graphs/Maps/GeoHubMaps/SimpleMap/index.tsx"],"sourcesContent":["import { useRef, useEffect, useState } from 'react';\r\nimport maplibreGl from 'maplibre-gl';\r\nimport * as pmtiles from 'pmtiles';\r\nimport 'maplibre-gl/dist/maplibre-gl.css';\r\nimport { select } from 'd3-selection';\r\nimport React from 'react';\r\n\r\nimport { fetchAndParseJSON } from '@/Utils/fetchAndParseData';\r\nimport { filterData } from '@/Utils/transformData/filterData';\r\nimport { X } from '@/Components/Icons';\r\nimport { string2HTML } from '@/Utils/string2HTML';\r\n\r\ninterface Props {\r\n mapStyle: string;\r\n center?: [number, number];\r\n zoomLevel?: number;\r\n width?: number;\r\n height?: number;\r\n relativeHeight?: number;\r\n minHeight: number;\r\n includeLayers: string[];\r\n excludeLayers: string[];\r\n mapLegend?: string | React.ReactNode;\r\n}\r\n\r\nexport function GeoHubMultipleMap(props: Props) {\r\n const {\r\n mapStyle,\r\n height,\r\n width,\r\n relativeHeight,\r\n center,\r\n zoomLevel,\r\n minHeight,\r\n includeLayers,\r\n excludeLayers,\r\n mapLegend,\r\n } = props;\r\n\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n const [showLegend, setShowLegend] = useState(true);\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const mapContainer = useRef<HTMLDivElement>(null);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const mapRef = useRef<any>(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 useEffect(() => {\r\n if (mapContainer.current && svgWidth && !mapRef.current) {\r\n fetchAndParseJSON(mapStyle).then(d => {\r\n const mapDiv = select(mapContainer.current);\r\n mapDiv.selectAll('div').remove();\r\n const protocol = new pmtiles.Protocol();\r\n maplibreGl.addProtocol('pmtiles', protocol.tile);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const mapObj: any = {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n container: mapContainer.current as any,\r\n style:\r\n includeLayers.length === 0 && excludeLayers.length === 0\r\n ? d\r\n : {\r\n ...d,\r\n layers: filterData(d.layers, [\r\n {\r\n column: 'id',\r\n includeValues: includeLayers,\r\n excludeValues: excludeLayers,\r\n },\r\n ]),\r\n },\r\n attributionControl: true,\r\n };\r\n if (center) {\r\n mapObj.center = center;\r\n }\r\n if (zoomLevel) {\r\n mapObj.zoom = zoomLevel;\r\n }\r\n mapRef.current = new maplibreGl.Map(mapObj);\r\n mapRef.current.addControl(\r\n new maplibreGl.NavigationControl({\r\n visualizePitch: true,\r\n showZoom: true,\r\n showCompass: true,\r\n }),\r\n 'bottom-right',\r\n );\r\n mapRef.current.addControl(new maplibreGl.ScaleControl(), 'bottom-left');\r\n });\r\n }\r\n }, [svgWidth, center, zoomLevel, includeLayers, excludeLayers, mapStyle]);\r\n useEffect(() => {\r\n if (mapRef.current) {\r\n fetchAndParseJSON(mapStyle).then(d => {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const mapStyleObj: any = {\r\n ...d,\r\n layers: filterData(d.layers, [\r\n {\r\n column: 'id',\r\n includeValues: includeLayers,\r\n excludeValues: excludeLayers,\r\n },\r\n ]),\r\n };\r\n mapRef.current.setStyle(mapStyleObj);\r\n });\r\n }\r\n }, [excludeLayers, includeLayers, mapStyle]);\r\n return (\r\n <div\r\n className='flex flex-col grow justify-center leading-0'\r\n ref={graphDiv}\r\n aria-label='Map area'\r\n >\r\n {(width || svgWidth) && (height || svgHeight) ? (\r\n <div\r\n style={{\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 }}\r\n >\r\n <div\r\n ref={mapContainer}\r\n className='map maplibre-show-control'\r\n style={{ width: '100%', height: '100%' }}\r\n />\r\n {mapLegend ? (\r\n <div className='absolute left-[22px] bottom-13'>\r\n {showLegend ? (\r\n <>\r\n <div\r\n style={{\r\n backgroundColor: 'rgba(240,240,240, 0.7)',\r\n border: '1px solid var(--gray-400)',\r\n borderRadius: '999px',\r\n width: '24px',\r\n height: '24px',\r\n padding: '3px',\r\n cursor: 'pointer',\r\n zIndex: 10,\r\n position: 'absolute',\r\n right: '-0.75rem',\r\n top: '-0.75rem',\r\n }}\r\n onClick={() => {\r\n setShowLegend(false);\r\n }}\r\n >\r\n <X />\r\n </div>\r\n <div\r\n className='p-2'\r\n style={{\r\n backgroundColor: 'rgba(240,240,240, 0.7)',\r\n }}\r\n dangerouslySetInnerHTML={\r\n typeof mapLegend === 'string' ? { __html: string2HTML(mapLegend) } : undefined\r\n }\r\n >\r\n {React.isValidElement(mapLegend) ? mapLegend : null}\r\n </div>\r\n </>\r\n ) : (\r\n <button\r\n type='button'\r\n className='mb-0 border-0 bg-transparent p-0 self-start'\r\n onClick={() => {\r\n setShowLegend(true);\r\n }}\r\n >\r\n <div className='items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-550 border-primary-gray-400 dark:border-primary-gray-500'>\r\n Show Legend\r\n </div>\r\n </button>\r\n )}\r\n </div>\r\n ) : null}\r\n </div>\r\n ) : null}\r\n </div>\r\n );\r\n}\r\n","import { useRef, useEffect, useState } from 'react';\r\nimport maplibreGl from 'maplibre-gl';\r\nimport * as pmtiles from 'pmtiles';\r\nimport 'maplibre-gl/dist/maplibre-gl.css';\r\nimport { select } from 'd3-selection';\r\nimport React from 'react';\r\n\r\nimport { fetchAndParseJSON } from '@/Utils/fetchAndParseData';\r\nimport { filterData } from '@/Utils/transformData/filterData';\r\nimport { X } from '@/Components/Icons';\r\nimport { string2HTML } from '@/Utils/string2HTML';\r\n\r\ninterface Props {\r\n mapStyle: string;\r\n center?: [number, number];\r\n zoomLevel?: number;\r\n width?: number;\r\n height?: number;\r\n relativeHeight?: number;\r\n minHeight: number;\r\n mapLegend?: string | React.ReactNode;\r\n includeLayers: string[];\r\n excludeLayers: string[];\r\n}\r\n\r\nexport function GeoHubSingleMap(props: Props) {\r\n const {\r\n mapStyle,\r\n height,\r\n width,\r\n relativeHeight,\r\n center,\r\n zoomLevel,\r\n minHeight,\r\n includeLayers,\r\n excludeLayers,\r\n mapLegend,\r\n } = props;\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n const [showLegend, setShowLegend] = useState(true);\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const mapContainer = 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 useEffect(() => {\r\n if (mapContainer.current && svgWidth) {\r\n fetchAndParseJSON(mapStyle).then(d => {\r\n const mapDiv = select(mapContainer.current);\r\n mapDiv.selectAll('div').remove();\r\n const protocol = new pmtiles.Protocol();\r\n maplibreGl.addProtocol('pmtiles', protocol.tile);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const mapObj: any = {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n container: mapContainer.current as any,\r\n style:\r\n includeLayers.length === 0 && excludeLayers.length === 0\r\n ? d\r\n : {\r\n ...d,\r\n layers: filterData(d.layers, [\r\n {\r\n column: 'id',\r\n includeValues: includeLayers,\r\n excludeValues: excludeLayers,\r\n },\r\n ]),\r\n },\r\n attributionControl: true,\r\n };\r\n if (center) {\r\n mapObj.center = center;\r\n }\r\n if (zoomLevel) {\r\n mapObj.zoom = zoomLevel;\r\n }\r\n const map = new maplibreGl.Map(mapObj);\r\n map.addControl(\r\n new maplibreGl.NavigationControl({\r\n visualizePitch: true,\r\n showZoom: true,\r\n showCompass: true,\r\n }),\r\n 'bottom-right',\r\n );\r\n map.addControl(new maplibreGl.ScaleControl(), 'bottom-left');\r\n });\r\n }\r\n }, [svgWidth, mapStyle, center, zoomLevel, includeLayers, excludeLayers]);\r\n return (\r\n <div\r\n className='flex flex-col grow justify-center leading-0'\r\n ref={graphDiv}\r\n aria-label='Map area'\r\n >\r\n {(width || svgWidth) && (height || svgHeight) ? (\r\n <div\r\n style={{\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 }}\r\n >\r\n <div\r\n ref={mapContainer}\r\n className='map maplibre-show-control'\r\n style={{ width: '100%', height: '100%' }}\r\n />\r\n {mapLegend ? (\r\n <div className='absolute left-[22px] bottom-13'>\r\n {showLegend ? (\r\n <>\r\n <div\r\n style={{\r\n backgroundColor: 'rgba(240,240,240, 0.7)',\r\n border: '1px solid var(--gray-400)',\r\n borderRadius: '999px',\r\n width: '24px',\r\n height: '24px',\r\n padding: '3px',\r\n cursor: 'pointer',\r\n zIndex: 10,\r\n position: 'absolute',\r\n right: '-0.75rem',\r\n top: '-0.75rem',\r\n }}\r\n onClick={() => {\r\n setShowLegend(false);\r\n }}\r\n >\r\n <X />\r\n </div>\r\n <div\r\n className='p-2'\r\n style={{\r\n backgroundColor: 'rgba(240,240,240, 0.7)',\r\n }}\r\n dangerouslySetInnerHTML={\r\n typeof mapLegend === 'string' ? { __html: string2HTML(mapLegend) } : undefined\r\n }\r\n >\r\n {React.isValidElement(mapLegend) ? mapLegend : null}\r\n </div>\r\n </>\r\n ) : (\r\n <button\r\n type='button'\r\n className='mb-0 border-0 bg-transparent p-0 self-start'\r\n onClick={() => {\r\n setShowLegend(true);\r\n }}\r\n >\r\n <div className='items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-550 border-primary-gray-400 dark:border-primary-gray-500'>\r\n Show Legend\r\n </div>\r\n </button>\r\n )}\r\n </div>\r\n ) : null}\r\n </div>\r\n ) : null}\r\n </div>\r\n );\r\n}\r\n","import React, { useEffect, useMemo, useState } from 'react';\r\nimport { DropdownSelect, createFilter } from '@undp/design-system-react/DropdownSelect';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport { GeoHubMultipleMap } from './GeoHubMultipleMap';\r\nimport { GeoHubSingleMap } from './GeoHubSingleMap';\r\n\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport {\r\n ClassNameObject,\r\n Languages,\r\n MapLegendDataType,\r\n SourcesDataType,\r\n StyleObject,\r\n} from '@/Types';\r\n\r\ninterface Props {\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 /** Background color of the graph */\r\n backgroundColor?: string | boolean;\r\n /** Custom styles for the graph. Each object should be a valid React CSS style object. */\r\n styles?: StyleObject;\r\n /** Custom class names */\r\n classNames?: ClassNameObject;\r\n\r\n // Size and Spacing\r\n /** Width of the graph */\r\n width?: number;\r\n /** Height of the graph */\r\n height?: number;\r\n /** Minimum height of the graph */\r\n minHeight?: number;\r\n /** Relative height scaling factor. This overwrites the height props */\r\n relativeHeight?: number;\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n\r\n // Graph Parameters\r\n /** URL for mapStyle JSON. If the type is string, otherwise it creates and dropdown and provide end user to select the map style they would like to */\r\n mapStyle: string | { style: string; name: string }[];\r\n /** Defines the legend for the map. If the mapStyle is string, mapLegend can be string or ReactNode. mapLegend with type string is show as innerHTML. If the mapStyle is not string, mapLegend is of type { mapStyleName: string; legend: string | React.ReactNode }[] where mapStyleName corresponds to the each name in the mapStyle. */\r\n mapLegend?: string | React.ReactNode | MapLegendDataType[];\r\n /** Starting center point of the map */\r\n center?: [number, number];\r\n /** Starting zoom level of the map */\r\n zoomLevel?: number;\r\n /** List of layer IDs to be included in the visualization. If this is present only these layers are included. */\r\n includeLayers?: string[];\r\n /** List of layer IDs to be excluded from the visualization */\r\n excludeLayers?: string[];\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 /** Theme for the UI elements */\r\n uiMode?: 'light' | 'normal';\r\n /** Unique ID for the graph */\r\n graphID?: string;\r\n}\r\n\r\n/** For using these maps you will have to install [`maplibre`](https://maplibre.org/maplibre-gl-js/docs/#npm) and [pmtiles](https://www.npmjs.com/package/pmtiles) package to your project */\r\nexport function GeoHubMap(props: Props) {\r\n const {\r\n mapStyle,\r\n graphTitle,\r\n height,\r\n width,\r\n relativeHeight,\r\n sources,\r\n graphDescription,\r\n footNote,\r\n padding,\r\n backgroundColor = false,\r\n center,\r\n zoomLevel,\r\n graphID,\r\n language = 'en',\r\n minHeight = 0,\r\n theme = 'light',\r\n includeLayers = [],\r\n excludeLayers = [],\r\n ariaLabel,\r\n uiMode = 'normal',\r\n styles,\r\n classNames,\r\n mapLegend,\r\n } = props;\r\n\r\n const [selectedMapStyle, setSelectedMapStyle] = useState(\r\n typeof mapStyle === 'string' ? mapStyle : mapStyle[0].style,\r\n );\r\n\r\n useEffect(() => {\r\n setSelectedMapStyle(typeof mapStyle === 'string' ? mapStyle : mapStyle[0].style);\r\n }, [mapStyle]);\r\n\r\n const filterConfig = useMemo(\r\n () => ({\r\n ignoreCase: true,\r\n ignoreAccents: true,\r\n trim: true,\r\n }),\r\n [],\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 classNames?.graphContainer,\r\n )}\r\n style={{\r\n ...(styles?.graphContainer || {}),\r\n ...(backgroundColor && backgroundColor !== true ? { backgroundColor } : {}),\r\n }}\r\n id={graphID}\r\n aria-label={\r\n ariaLabel ||\r\n `${\r\n graphTitle ? `The graph shows ${graphTitle}. ` : ''\r\n }This is a map.${graphDescription ? ` ${graphDescription}` : ''}`\r\n }\r\n >\r\n <div\r\n className='flex grow'\r\n style={{ padding: backgroundColor ? padding || '1rem' : padding || 0 }}\r\n >\r\n <div className='flex flex-col w-full gap-4 grow justify-between'>\r\n {graphTitle || graphDescription ? (\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 />\r\n ) : null}\r\n {typeof mapStyle === 'string' ? null : (\r\n <DropdownSelect\r\n options={mapStyle.map(d => ({ label: d.name, value: d.style }))}\r\n isClearable={false}\r\n size='sm'\r\n variant={uiMode}\r\n isRtl={language === 'he' || language === 'ar'}\r\n isSearchable\r\n filterOption={createFilter(filterConfig)}\r\n defaultValue={{\r\n label: mapStyle[0].name,\r\n value: mapStyle[0].style,\r\n }}\r\n controlShouldRenderValue\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onChange={(el: any) => {\r\n if (el) setSelectedMapStyle(el.value);\r\n }}\r\n />\r\n )}\r\n {typeof mapStyle === 'string' ? (\r\n <GeoHubSingleMap\r\n mapStyle={mapStyle}\r\n center={center}\r\n zoomLevel={zoomLevel}\r\n width={width}\r\n height={height}\r\n relativeHeight={relativeHeight}\r\n minHeight={minHeight}\r\n includeLayers={includeLayers}\r\n excludeLayers={excludeLayers}\r\n mapLegend={mapLegend as string | React.ReactNode | undefined}\r\n />\r\n ) : (\r\n <GeoHubMultipleMap\r\n mapStyle={selectedMapStyle}\r\n center={center}\r\n zoomLevel={zoomLevel}\r\n width={width}\r\n height={height}\r\n relativeHeight={relativeHeight}\r\n minHeight={minHeight}\r\n includeLayers={includeLayers}\r\n excludeLayers={excludeLayers}\r\n mapLegend={\r\n ((mapLegend || []) as MapLegendDataType[]).find(\r\n d =>\r\n d.mapStyleName === mapStyle.find(el => el.style === selectedMapStyle)?.name,\r\n )?.legend\r\n }\r\n />\r\n )}\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n}\r\n"],"names":["GeoHubMultipleMap","props","mapStyle","height","width","relativeHeight","center","zoomLevel","minHeight","includeLayers","excludeLayers","mapLegend","svgWidth","setSvgWidth","useState","svgHeight","setSvgHeight","showLegend","setShowLegend","graphDiv","useRef","mapContainer","mapRef","useEffect","resizeObserver","entries","fetchAndParseJSON","d","select","protocol","pmtiles","maplibreGl","mapObj","filterData","mapStyleObj","jsx","jsxs","Fragment","X","string2HTML","React","GeoHubSingleMap","map","GeoHubMap","graphTitle","sources","graphDescription","footNote","padding","backgroundColor","graphID","language","theme","ariaLabel","uiMode","styles","classNames","selectedMapStyle","setSelectedMapStyle","filterConfig","useMemo","cn","GraphHeader","DropdownSelect","createFilter","el","GraphFooter"],"mappings":"80BAyBO,SAASA,EAAkBC,EAAc,CAC9C,KAAM,CACJ,SAAAC,EACA,OAAAC,EACA,MAAAC,EACA,eAAAC,EACA,OAAAC,EACA,UAAAC,EACA,UAAAC,EACA,cAAAC,EACA,cAAAC,EACA,UAAAC,CAAA,EACEV,EAEE,CAACW,EAAUC,CAAW,EAA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zB,EAAS,KAAK+D,GAAMA,EAAG,QAAUR,CAAgB,GAAG,IAAA,GACxE,MAAA,CAAA,EAIRZ,GAAWE,EACVZ,EAAAA,kBAAAA,IAAC+B,EAAAA,YAAA,CACC,OAAQ,CAAE,SAAUX,GAAQ,SAAU,OAAQA,GAAQ,MAAA,EACtD,WAAY,CACV,SAAUC,GAAY,SACtB,OAAQA,GAAY,MAAA,EAEtB,QAAAX,EACA,SAAAE,EACA,MAAA3C,CAAA,CAAA,EAEA,IAAA,CAAA,CACN,CAAA,CAAA,CACF,CAAA,CACF,CAAA,CAGN"}
@@ -0,0 +1,117 @@
1
+ import { JSX } from 'react/jsx-runtime';
2
+
3
+ declare interface AxesClassNameObject {
4
+ gridLines?: string;
5
+ labels?: string;
6
+ title?: string;
7
+ axis?: string;
8
+ }
9
+
10
+ declare interface AxesStyleObject {
11
+ gridLines?: React.CSSProperties;
12
+ labels?: React.CSSProperties;
13
+ title?: React.CSSProperties;
14
+ axis?: React.CSSProperties;
15
+ }
16
+
17
+ declare interface ClassNameObject {
18
+ title?: string;
19
+ footnote?: string;
20
+ source?: string;
21
+ description?: string;
22
+ tooltip?: string;
23
+ xAxis?: AxesClassNameObject;
24
+ yAxis?: AxesClassNameObject;
25
+ legend?: string;
26
+ graphContainer?: string;
27
+ graphObjectValues?: string;
28
+ dataConnectors?: string;
29
+ mouseOverLine?: string;
30
+ regLine?: string;
31
+ dataCards?: string;
32
+ }
33
+
34
+ /** For using these maps you will have to install [`maplibre`](https://maplibre.org/maplibre-gl-js/docs/#npm) and [pmtiles](https://www.npmjs.com/package/pmtiles) package to your project */
35
+ export declare function GeoHubMapWithLayerSelection(props: Props): JSX.Element;
36
+
37
+ declare type Languages = 'en' | 'ar' | 'az' | 'bn' | 'cy' | 'he' | 'hi' | 'jp' | 'ka' | 'km' | 'ko' | 'my' | 'ne' | 'zh' | 'custom';
38
+
39
+ declare interface MapLegendDataType {
40
+ mapStyleName: string;
41
+ legend: string | React.ReactNode;
42
+ }
43
+
44
+ declare interface Props {
45
+ /** Title of the graph */
46
+ graphTitle?: string | React.ReactNode;
47
+ /** Description of the graph */
48
+ graphDescription?: string | React.ReactNode;
49
+ /** Footnote for the graph */
50
+ footNote?: string | React.ReactNode;
51
+ /** Source data for the graph */
52
+ sources?: SourcesDataType[];
53
+ /** Accessibility label */
54
+ ariaLabel?: string;
55
+ /** Background color of the graph */
56
+ backgroundColor?: string | boolean;
57
+ /** Custom styles for the graph. Each object should be a valid React CSS style object. */
58
+ styles?: StyleObject;
59
+ /** Custom class names */
60
+ classNames?: ClassNameObject;
61
+ /** Width of the graph */
62
+ width?: number;
63
+ /** Height of the graph */
64
+ height?: number;
65
+ /** Minimum height of the graph */
66
+ minHeight?: number;
67
+ /** Relative height scaling factor. This overwrites the height props */
68
+ relativeHeight?: number;
69
+ /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */
70
+ padding?: string;
71
+ /** URL for mapStyle JSON */
72
+ mapStyle: string;
73
+ /** Starting center point of the map */
74
+ center?: [number, number];
75
+ /** Starting zoom level of the map */
76
+ zoomLevel?: number;
77
+ /** List of the layers that the user select and switch between sing a drop down */
78
+ layerSelection: {
79
+ layerID: string[];
80
+ name: string;
81
+ }[];
82
+ /** Defines the legend for the map. mapLegend is of type { mapStyleName: string; legend: string | React.ReactNode }[] where mapStyleName corresponds to the each name in the layerSelection. */
83
+ mapLegend?: MapLegendDataType[];
84
+ /** List of layer IDs to be excluded from the visualization */
85
+ excludeLayers?: string[];
86
+ /** Language setting */
87
+ language?: Languages;
88
+ /** Color theme */
89
+ theme?: 'light' | 'dark';
90
+ /** Theme for the UI elements */
91
+ uiMode?: 'light' | 'normal';
92
+ /** Unique ID for the graph */
93
+ graphID?: string;
94
+ }
95
+
96
+ declare interface SourcesDataType {
97
+ source: string;
98
+ link?: string;
99
+ }
100
+
101
+ declare interface StyleObject {
102
+ title?: React.CSSProperties;
103
+ footnote?: React.CSSProperties;
104
+ source?: React.CSSProperties;
105
+ description?: React.CSSProperties;
106
+ graphContainer?: React.CSSProperties;
107
+ tooltip?: React.CSSProperties;
108
+ xAxis?: AxesStyleObject;
109
+ yAxis?: AxesStyleObject;
110
+ graphObjectValues?: React.CSSProperties;
111
+ dataConnectors?: React.CSSProperties;
112
+ mouseOverLine?: React.CSSProperties;
113
+ regLine?: React.CSSProperties;
114
+ dataCards?: React.CSSProperties;
115
+ }
116
+
117
+ export { }
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-BHm2KTjD-D8FylaKc.cjs"),r=require("react"),I=require("./index-B0rbzOoC.cjs"),H=require("./DropdownSelect-CuzV7gdj.cjs"),$=require("./Typography-CDR-DAHH.cjs"),N=require("maplibre-gl"),T=require("pmtiles");;/* empty css */const M=require("./fetchAndParseData.js"),q=require("./filterData-DN6py7y_.cjs"),z=require("./string2HTML-X4ZYX5jI.cjs"),P=require("./index-CEc_9zWy.cjs"),G=require("./select-Bnfk0lJx.cjs"),V=require("./GraphHeader.js"),W=require("./GraphFooter.js");function A(p){const c=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(p){for(const t in p)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(p,t);Object.defineProperty(c,t,s.get?s:{enumerable:!0,get:()=>p[t]})}}return c.default=p,Object.freeze(c)}const _=A(T);function F(p){const{mapStyle:c,height:t,width:s,relativeHeight:m,center:E,zoomLevel:v,minHeight:x,selectedLayer:f,layerIdList:h,excludeLayers:n,mapLegend:b}=p,[g,D]=r.useState(0),[y,L]=r.useState(0),[C,o]=r.useState(!0),[S,O]=r.useState(void 0),j=r.useRef(null),u=r.useRef(null),a=r.useRef(null);return r.useEffect(()=>{const i=new ResizeObserver(d=>{D(s||d[0].target.clientWidth||620),L(t||d[0].target.clientHeight||480)});return j.current&&(L(j.current.clientHeight||480),D(j.current.clientWidth||620),s||i.observe(j.current)),()=>i.disconnect()},[s,t]),r.useEffect(()=>{u.current&&g&&!a.current&&M.fetchAndParseJSON(c).then(i=>{O(i),G.select(u.current).selectAll("div").remove();const w=new _.Protocol;N.addProtocol("pmtiles",w.tile);const R={container:u.current,style:{...i,layers:q.filterData(i.layers,[{column:"id",excludeValues:[...n,...h.filter(l=>f.indexOf(l)===-1)]}])},attributionControl:!0};E&&(R.center=E),v&&(R.zoom=v),a.current=new N.Map(R),a.current.addControl(new N.NavigationControl({visualizePitch:!0,showZoom:!0,showCompass:!0}),"bottom-right"),a.current.addControl(new N.ScaleControl,"bottom-left")})},[g,E,v,h,c,n,f]),r.useEffect(()=>{if(a.current)if(S){const i={...S,layers:q.filterData(S.layers,[{column:"id",excludeValues:[...n,...h.filter(d=>f.indexOf(d)===-1)]}])};a.current.setStyle(i)}else M.fetchAndParseJSON(c).then(i=>{const d={...i,layers:q.filterData(i.layers,[{column:"id",excludeValues:[...n,...h.filter(w=>f.indexOf(w)===-1)]}])};a.current.setStyle(d)})},[n,h,c,S,f]),e.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:j,"aria-label":"Map area",children:(s||g)&&(t||y)?e.jsxRuntimeExports.jsxs("div",{style:{width:s||g,height:Math.max(x,t||(m?x?(s||g)*m>x?(s||g)*m:x:(s||g)*m:y))},children:[e.jsxRuntimeExports.jsx("div",{ref:u,className:"map maplibre-show-control w-full h-full"}),b?e.jsxRuntimeExports.jsx("div",{className:"absolute left-[22px] bottom-13",children:C?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{style:{backgroundColor:"rgba(240,240,240, 0.7)",border:"1px solid var(--gray-400)",borderRadius:"999px",width:"24px",height:"24px",padding:"3px",cursor:"pointer",zIndex:10,position:"absolute",right:"-0.75rem",top:"-0.75rem"},onClick:()=>{o(!1)},children:e.jsxRuntimeExports.jsx(P.X,{})}),e.jsxRuntimeExports.jsx("div",{className:"p-2",style:{backgroundColor:"rgba(240,240,240, 0.7)"},dangerouslySetInnerHTML:typeof b=="string"?{__html:z.string2HTML(b)}:void 0,children:r.isValidElement(b)?b:null})]}):e.jsxRuntimeExports.jsx("button",{type:"button",className:"mb-0 border-0 bg-transparent p-0 self-start",onClick:()=>{o(!0)},children:e.jsxRuntimeExports.jsx("div",{className:"items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-550 border-primary-gray-400 dark:border-primary-gray-500",children:"Show Legend"})})}):null]}):null})}function J(p){const{mapStyle:c,graphTitle:t,height:s,width:m,relativeHeight:E,sources:v,graphDescription:x,footNote:f,padding:h,backgroundColor:n=!1,center:b,zoomLevel:g,graphID:D,language:y="en",minHeight:L=0,theme:C="light",layerSelection:o,excludeLayers:S=[],ariaLabel:O,uiMode:j="normal",styles:u,classNames:a,mapLegend:i=[]}=p,[d,w]=r.useState(o[0].layerID);r.useEffect(()=>{w(o[0].layerID)},[o]);const R=r.useMemo(()=>({ignoreCase:!0,ignoreAccents:!0,trim:!0}),[]);return e.jsxRuntimeExports.jsx("div",{className:`${C||"light"} flex ${m?"w-fit grow-0":"w-full grow"}`,dir:y==="he"||y==="ar"?"rtl":void 0,children:e.jsxRuntimeExports.jsx("div",{className:$.cnExports.cn(`${n?n===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${y||"en"}`,a?.graphContainer),style:{...u?.graphContainer||{},...n&&n!==!0?{backgroundColor:n}:{}},id:D,"aria-label":O||`${t?`The graph shows ${t}. `:""}This is a map.${x?` ${x}`:""}`,children:e.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:n?h||"1rem":h||0},children:e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[t||x?e.jsxRuntimeExports.jsx(V.GraphHeader,{styles:{title:u?.title,description:u?.description},classNames:{title:a?.title,description:a?.description},graphTitle:t,graphDescription:x,width:m}):null,e.jsxRuntimeExports.jsx(H.DropdownSelectExports.DropdownSelect,{options:o.map(l=>({label:l.name,value:l.layerID})),size:"sm",isClearable:!1,variant:j,isRtl:y==="he"||y==="ar",isSearchable:!0,filterOption:H.DropdownSelectExports.createFilter(R),defaultValue:{label:o[0].name,value:o[0].layerID},controlShouldRenderValue:!0,onChange:l=>{l&&w(l.value)}}),e.jsxRuntimeExports.jsx(F,{mapStyle:c,center:b,zoomLevel:g,width:m,height:s,relativeHeight:E,minHeight:L,selectedLayer:d,layerIdList:I.flattenDeep(o.map(l=>l.layerID)),excludeLayers:S,mapLegend:i.find(l=>l.mapStyleName===o.find(k=>k.layerID===d)?.name)?.legend}),v||f?e.jsxRuntimeExports.jsx(W.GraphFooter,{styles:{footnote:u?.footnote,source:u?.source},classNames:{footnote:a?.footnote,source:a?.source},sources:v,footNote:f,width:m}):null]})})})})}exports.GeoHubMapWithLayerSelection=J;
2
+ //# sourceMappingURL=GeoHubMapWithLayerSelection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GeoHubMapWithLayerSelection.js","sources":["../src/Components/Graphs/Maps/GeoHubMaps/MapWithLayerSelection/MapEl.tsx","../src/Components/Graphs/Maps/GeoHubMaps/MapWithLayerSelection/index.tsx"],"sourcesContent":["import { useRef, useEffect, useState } from 'react';\r\nimport maplibreGl from 'maplibre-gl';\r\nimport * as pmtiles from 'pmtiles';\r\nimport 'maplibre-gl/dist/maplibre-gl.css';\r\nimport { select } from 'd3-selection';\r\nimport React from 'react';\r\n\r\nimport { fetchAndParseJSON } from '@/Utils/fetchAndParseData';\r\nimport { filterData } from '@/Utils/transformData/filterData';\r\nimport { string2HTML } from '@/Utils/string2HTML';\r\nimport { X } from '@/Components/Icons';\r\n\r\ninterface Props {\r\n mapStyle: string;\r\n center?: [number, number];\r\n zoomLevel?: number;\r\n width?: number;\r\n height?: number;\r\n relativeHeight?: number;\r\n minHeight: number;\r\n selectedLayer: string[];\r\n layerIdList: string[];\r\n excludeLayers: string[];\r\n mapLegend?: string | React.ReactNode;\r\n}\r\n\r\nexport function MapEl(props: Props) {\r\n const {\r\n mapStyle,\r\n height,\r\n width,\r\n relativeHeight,\r\n center,\r\n zoomLevel,\r\n minHeight,\r\n selectedLayer,\r\n layerIdList,\r\n excludeLayers,\r\n mapLegend,\r\n } = props;\r\n\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n const [showLegend, setShowLegend] = useState(true);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mapStyleData, setMapStyleData] = useState<any>(undefined);\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const mapContainer = useRef<HTMLDivElement>(null);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const mapRef = useRef<any>(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 useEffect(() => {\r\n if (mapContainer.current && svgWidth && !mapRef.current) {\r\n fetchAndParseJSON(mapStyle).then(d => {\r\n setMapStyleData(d);\r\n const mapDiv = select(mapContainer.current);\r\n mapDiv.selectAll('div').remove();\r\n const protocol = new pmtiles.Protocol();\r\n maplibreGl.addProtocol('pmtiles', protocol.tile);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const mapObj: any = {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n container: mapContainer.current as any,\r\n style: {\r\n ...d,\r\n layers: filterData(d.layers, [\r\n {\r\n column: 'id',\r\n excludeValues: [\r\n ...excludeLayers,\r\n ...layerIdList.filter(el => selectedLayer.indexOf(el) === -1),\r\n ],\r\n },\r\n ]),\r\n },\r\n attributionControl: true,\r\n };\r\n if (center) {\r\n mapObj.center = center;\r\n }\r\n if (zoomLevel) {\r\n mapObj.zoom = zoomLevel;\r\n }\r\n mapRef.current = new maplibreGl.Map(mapObj);\r\n mapRef.current.addControl(\r\n new maplibreGl.NavigationControl({\r\n visualizePitch: true,\r\n showZoom: true,\r\n showCompass: true,\r\n }),\r\n 'bottom-right',\r\n );\r\n mapRef.current.addControl(new maplibreGl.ScaleControl(), 'bottom-left');\r\n });\r\n }\r\n }, [svgWidth, center, zoomLevel, layerIdList, mapStyle, excludeLayers, selectedLayer]);\r\n useEffect(() => {\r\n if (mapRef.current) {\r\n if (mapStyleData) {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const mapStyleObj: any = {\r\n ...mapStyleData,\r\n layers: filterData(mapStyleData.layers, [\r\n {\r\n column: 'id',\r\n excludeValues: [\r\n ...excludeLayers,\r\n ...layerIdList.filter(el => selectedLayer.indexOf(el) === -1),\r\n ],\r\n },\r\n ]),\r\n };\r\n mapRef.current.setStyle(mapStyleObj);\r\n } else\r\n fetchAndParseJSON(mapStyle).then(d => {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const mapStyleObj: any = {\r\n ...d,\r\n layers: filterData(d.layers, [\r\n {\r\n column: 'id',\r\n excludeValues: [\r\n ...excludeLayers,\r\n ...layerIdList.filter(el => selectedLayer.indexOf(el) === -1),\r\n ],\r\n },\r\n ]),\r\n };\r\n mapRef.current.setStyle(mapStyleObj);\r\n });\r\n }\r\n }, [excludeLayers, layerIdList, mapStyle, mapStyleData, selectedLayer]);\r\n return (\r\n <div\r\n className='flex flex-col grow justify-center leading-0'\r\n ref={graphDiv}\r\n aria-label='Map area'\r\n >\r\n {(width || svgWidth) && (height || svgHeight) ? (\r\n <div\r\n style={{\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 }}\r\n >\r\n <div ref={mapContainer} className='map maplibre-show-control w-full h-full' />\r\n\r\n {mapLegend ? (\r\n <div className='absolute left-[22px] bottom-13'>\r\n {showLegend ? (\r\n <>\r\n <div\r\n style={{\r\n backgroundColor: 'rgba(240,240,240, 0.7)',\r\n border: '1px solid var(--gray-400)',\r\n borderRadius: '999px',\r\n width: '24px',\r\n height: '24px',\r\n padding: '3px',\r\n cursor: 'pointer',\r\n zIndex: 10,\r\n position: 'absolute',\r\n right: '-0.75rem',\r\n top: '-0.75rem',\r\n }}\r\n onClick={() => {\r\n setShowLegend(false);\r\n }}\r\n >\r\n <X />\r\n </div>\r\n <div\r\n className='p-2'\r\n style={{\r\n backgroundColor: 'rgba(240,240,240, 0.7)',\r\n }}\r\n dangerouslySetInnerHTML={\r\n typeof mapLegend === 'string' ? { __html: string2HTML(mapLegend) } : undefined\r\n }\r\n >\r\n {React.isValidElement(mapLegend) ? mapLegend : null}\r\n </div>\r\n </>\r\n ) : (\r\n <button\r\n type='button'\r\n className='mb-0 border-0 bg-transparent p-0 self-start'\r\n onClick={() => {\r\n setShowLegend(true);\r\n }}\r\n >\r\n <div className='items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-550 border-primary-gray-400 dark:border-primary-gray-500'>\r\n Show Legend\r\n </div>\r\n </button>\r\n )}\r\n </div>\r\n ) : null}\r\n </div>\r\n ) : null}\r\n </div>\r\n );\r\n}\r\n","import { useEffect, useMemo, useState } from 'react';\r\nimport flattenDeep from 'lodash.flattendeep';\r\nimport { createFilter, DropdownSelect } from '@undp/design-system-react/DropdownSelect';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport { MapEl } from './MapEl';\r\n\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport {\r\n ClassNameObject,\r\n Languages,\r\n MapLegendDataType,\r\n SourcesDataType,\r\n StyleObject,\r\n} from '@/Types';\r\n\r\ninterface Props {\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 /** Background color of the graph */\r\n backgroundColor?: string | boolean;\r\n /** Custom styles for the graph. Each object should be a valid React CSS style object. */\r\n styles?: StyleObject;\r\n /** Custom class names */\r\n classNames?: ClassNameObject;\r\n\r\n // Size and Spacing\r\n /** Width of the graph */\r\n width?: number;\r\n /** Height of the graph */\r\n height?: number;\r\n /** Minimum height of the graph */\r\n minHeight?: number;\r\n /** Relative height scaling factor. This overwrites the height props */\r\n relativeHeight?: number;\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n\r\n // Graph Parameters\r\n /** URL for mapStyle JSON */\r\n mapStyle: string;\r\n /** Starting center point of the map */\r\n center?: [number, number];\r\n /** Starting zoom level of the map */\r\n zoomLevel?: number;\r\n /** List of the layers that the user select and switch between sing a drop down */\r\n layerSelection: { layerID: string[]; name: string }[];\r\n /** Defines the legend for the map. mapLegend is of type { mapStyleName: string; legend: string | React.ReactNode }[] where mapStyleName corresponds to the each name in the layerSelection. */\r\n mapLegend?: MapLegendDataType[];\r\n /** List of layer IDs to be excluded from the visualization */\r\n excludeLayers?: string[];\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 /** Theme for the UI elements */\r\n uiMode?: 'light' | 'normal';\r\n /** Unique ID for the graph */\r\n graphID?: string;\r\n}\r\n\r\n/** For using these maps you will have to install [`maplibre`](https://maplibre.org/maplibre-gl-js/docs/#npm) and [pmtiles](https://www.npmjs.com/package/pmtiles) package to your project */\r\nexport function GeoHubMapWithLayerSelection(props: Props) {\r\n const {\r\n mapStyle,\r\n graphTitle,\r\n height,\r\n width,\r\n relativeHeight,\r\n sources,\r\n graphDescription,\r\n footNote,\r\n padding,\r\n backgroundColor = false,\r\n center,\r\n zoomLevel,\r\n graphID,\r\n language = 'en',\r\n minHeight = 0,\r\n theme = 'light',\r\n layerSelection,\r\n excludeLayers = [],\r\n ariaLabel,\r\n uiMode = 'normal',\r\n styles,\r\n classNames,\r\n mapLegend = [],\r\n } = props;\r\n\r\n const [selectedLayer, setSelectedLayer] = useState(layerSelection[0].layerID);\r\n\r\n useEffect(() => {\r\n setSelectedLayer(layerSelection[0].layerID);\r\n }, [layerSelection]);\r\n\r\n const filterConfig = useMemo(\r\n () => ({\r\n ignoreCase: true,\r\n ignoreAccents: true,\r\n trim: true,\r\n }),\r\n [],\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 classNames?.graphContainer,\r\n )}\r\n style={{\r\n ...(styles?.graphContainer || {}),\r\n ...(backgroundColor && backgroundColor !== true ? { backgroundColor } : {}),\r\n }}\r\n id={graphID}\r\n aria-label={\r\n ariaLabel ||\r\n `${\r\n graphTitle ? `The graph shows ${graphTitle}. ` : ''\r\n }This is a map.${graphDescription ? ` ${graphDescription}` : ''}`\r\n }\r\n >\r\n <div\r\n className='flex grow'\r\n style={{ padding: backgroundColor ? padding || '1rem' : padding || 0 }}\r\n >\r\n <div className='flex flex-col w-full gap-4 grow justify-between'>\r\n {graphTitle || graphDescription ? (\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 />\r\n ) : null}\r\n <DropdownSelect\r\n options={layerSelection.map(d => ({\r\n label: d.name,\r\n value: d.layerID,\r\n }))}\r\n size='sm'\r\n isClearable={false}\r\n variant={uiMode}\r\n isRtl={language === 'he' || language === 'ar'}\r\n isSearchable\r\n filterOption={createFilter(filterConfig)}\r\n defaultValue={{\r\n label: layerSelection[0].name,\r\n value: layerSelection[0].layerID,\r\n }}\r\n controlShouldRenderValue\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onChange={(el: any) => {\r\n if (el) setSelectedLayer(el.value);\r\n }}\r\n />\r\n <MapEl\r\n mapStyle={mapStyle}\r\n center={center}\r\n zoomLevel={zoomLevel}\r\n width={width}\r\n height={height}\r\n relativeHeight={relativeHeight}\r\n minHeight={minHeight}\r\n selectedLayer={selectedLayer}\r\n layerIdList={flattenDeep(layerSelection.map(d => d.layerID))}\r\n excludeLayers={excludeLayers}\r\n mapLegend={\r\n (mapLegend as MapLegendDataType[]).find(\r\n d =>\r\n d.mapStyleName ===\r\n layerSelection.find(el => el.layerID === selectedLayer)?.name,\r\n )?.legend\r\n }\r\n />\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n}\r\n"],"names":["MapEl","props","mapStyle","height","width","relativeHeight","center","zoomLevel","minHeight","selectedLayer","layerIdList","excludeLayers","mapLegend","svgWidth","setSvgWidth","useState","svgHeight","setSvgHeight","showLegend","setShowLegend","mapStyleData","setMapStyleData","graphDiv","useRef","mapContainer","mapRef","useEffect","resizeObserver","entries","fetchAndParseJSON","d","select","protocol","pmtiles","maplibreGl","mapObj","filterData","el","mapStyleObj","jsx","jsxs","Fragment","X","string2HTML","React","GeoHubMapWithLayerSelection","graphTitle","sources","graphDescription","footNote","padding","backgroundColor","graphID","language","theme","layerSelection","ariaLabel","uiMode","styles","classNames","setSelectedLayer","filterConfig","useMemo","cn","GraphHeader","DropdownSelect","createFilter","flattenDeep","GraphFooter"],"mappings":"g3BA0BO,SAASA,EAAMC,EAAc,CAClC,KAAM,CACJ,SAAAC,EACA,OAAAC,EACA,MAAAC,EACA,eAAAC,EACA,OAAAC,EACA,UAAAC,EACA,UAAAC,EACA,cAAAC,EACA,YAAAC,EACA,cAAAC,EACA,UAAAC,CAAA,EACEX,EAEE,CAACY,EAAUC,CAAW,EAAIC,EAAAA,SAAS,CAAC,EACpC,CAACC,EAAWC,CAAY,EAAIF,EAAAA,SAAS,CAAC,EACtC,CAACG,EAAYC,CAAa,EAAIJ,EAAAA,SAAS,EAAI,EAE3C,CAACK,EAAcC,CAAe,EAAIN,EAAAA,SAAc,MAAS,EACzDO,EAAWC,EAAAA,OAAuB,IAAI,EACtCC,EAAeD,EAAAA,OAAuB,IAAI,EAE1CE,EAASF,EAAAA,OAAY,IAAI,EAC/BG,OAAAA,EAAAA,UAAU,IAAM,CACd,MAAMC,EAAiB,IAAI,eAAeC,GAAW,CACnDd,EAAYV,GAASwB,EAAQ,CAAC,EAAE,OAAO,aAAe,GAAG,EACzDX,EAAad,GAAUyB,EAAQ,CAAC,EAAE,OAAO,cAAgB,GAAG,CAC9D,CAAC,EACD,OAAIN,EAAS,UACXL,EAAaK,EAAS,QAAQ,cAAgB,GAAG,EACjDR,EAAYQ,EAAS,QAAQ,aAAe,GAAG,EAC1ClB,GAAOuB,EAAe,QAAQL,EAAS,OAAO,GAE9C,IAAMK,EAAe,WAAA,CAC9B,EAAG,CAACvB,EAAO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A,EAEFE,EAAAA,kBAAAA,IAACvC,EAAA,CACC,SAAAE,EACA,OAAAI,EACA,UAAAC,EACA,MAAAH,EACA,OAAAD,EACA,eAAAE,EACA,UAAAG,EACA,cAAAC,EACA,YAAa0D,EAAAA,YAAYZ,EAAe,IAAIzB,GAAKA,EAAE,OAAO,CAAC,EAC3D,cAAAnB,EACA,UACGC,EAAkC,KACjCkB,GACEA,EAAE,eACFyB,EAAe,KAAKlB,GAAMA,EAAG,UAAY5B,CAAa,GAAG,IAAA,GAC1D,MAAA,CAAA,EAGNsC,GAAWE,EACVV,EAAAA,kBAAAA,IAAC6B,EAAAA,YAAA,CACC,OAAQ,CAAE,SAAUV,GAAQ,SAAU,OAAQA,GAAQ,MAAA,EACtD,WAAY,CACV,SAAUC,GAAY,SACtB,OAAQA,GAAY,MAAA,EAEtB,QAAAZ,EACA,SAAAE,EACA,MAAA7C,CAAA,CAAA,EAEA,IAAA,CAAA,CACN,CAAA,CAAA,CACF,CAAA,CACF,CAAA,CAGN"}
@@ -0,0 +1,12 @@
1
+ import { default as default_2 } from 'react';
2
+ import { JSX } from 'react/jsx-runtime';
3
+
4
+ export declare function GraphDescription(props: Props): JSX.Element | null;
5
+
6
+ declare interface Props {
7
+ text: string | default_2.ReactNode;
8
+ style?: default_2.CSSProperties;
9
+ className?: string;
10
+ }
11
+
12
+ export { }
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index-BHm2KTjD-D8FylaKc.cjs"),n=require("./Typography-CDR-DAHH.cjs"),o=require("react");function a(s){const{text:r,style:e,className:t}=s;return typeof r=="string"?r.trim()===""?null:i.jsxRuntimeExports.jsx(n.TypographyExports.P,{size:"sm",marginBottom:"none",className:n.cnExports.cn("text-primary-gray-550 dark:text-primary-gray-400",t),"aria-label":"Graph description",style:e,children:r}):o.isValidElement(r)?i.jsxRuntimeExports.jsx("div",{className:t,style:e,children:r}):(console.error("GraphDescription: Invalid text type. Expected string or React element."),null)}exports.GraphDescription=a;
2
+ //# sourceMappingURL=GraphDescription.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphDescription.js","sources":["../src/Components/Typography/GraphDescription.tsx"],"sourcesContent":["import { cn } from '@undp/design-system-react/cn';\r\nimport { P } from '@undp/design-system-react/Typography';\r\nimport React from 'react';\r\n\r\ninterface Props {\r\n text: string | React.ReactNode;\r\n style?: React.CSSProperties;\r\n className?: string;\r\n}\r\n\r\nexport function GraphDescription(props: Props) {\r\n const { text, style, className } = props;\r\n if (typeof text === 'string') {\r\n if (text.trim() === '') return null;\r\n return (\r\n <P\r\n size='sm'\r\n marginBottom='none'\r\n className={cn('text-primary-gray-550 dark:text-primary-gray-400', className)}\r\n aria-label='Graph description'\r\n style={style}\r\n >\r\n {text}\r\n </P>\r\n );\r\n }\r\n\r\n if (React.isValidElement(text))\r\n return (\r\n <div className={className} style={style}>\r\n {text}\r\n </div>\r\n );\r\n console.error('GraphDescription: Invalid text type. Expected string or React element.');\r\n return null;\r\n}\r\n"],"names":["GraphDescription","props","text","style","className","jsx","P","cn","React"],"mappings":"2LAUO,SAASA,EAAiBC,EAAc,CAC7C,KAAM,CAAE,KAAAC,EAAM,MAAAC,EAAO,UAAAC,CAAA,EAAcH,EACnC,OAAI,OAAOC,GAAS,SACdA,EAAK,SAAW,GAAW,KAE7BG,EAAAA,kBAAAA,IAACC,EAAAA,kBAAAA,EAAA,CACC,KAAK,KACL,aAAa,OACb,UAAWC,EAAAA,UAAAA,GAAG,mDAAoDH,CAAS,EAC3E,aAAW,oBACX,MAAAD,EAEC,SAAAD,CAAA,CAAA,EAKHM,EAAM,eAAeN,CAAI,EAEzBG,EAAAA,kBAAAA,IAAC,MAAA,CAAI,UAAAD,EAAsB,MAAAD,EACxB,SAAAD,EACH,GAEJ,QAAQ,MAAM,wEAAwE,EAC/E,KACT"}
@@ -0,0 +1,24 @@
1
+ import { JSX } from 'react/jsx-runtime';
2
+
3
+ export declare function GraphFooter(props: Props): JSX.Element | null;
4
+
5
+ declare interface Props {
6
+ footNote?: string | React.ReactNode;
7
+ sources?: SourcesDataType[];
8
+ width?: number;
9
+ styles?: {
10
+ footnote?: React.CSSProperties;
11
+ source?: React.CSSProperties;
12
+ };
13
+ classNames?: {
14
+ footnote?: string;
15
+ source?: string;
16
+ };
17
+ }
18
+
19
+ declare interface SourcesDataType {
20
+ source: string;
21
+ link?: string;
22
+ }
23
+
24
+ export { }
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-BHm2KTjD-D8FylaKc.cjs"),u=require("./FootNote.js"),i=require("./Source.js");function a(n){const{sources:e,footNote:o,width:s,styles:r,classNames:l}=n;return(e===void 0||(e||[]).length===0)&&o===void 0?null:t.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 flex-col",style:{maxWidth:s?`${s}px`:"none"},"aria-label":"Graph footer",children:[e?t.jsxRuntimeExports.jsx(i.Source,{sources:e,style:r?.source,className:l?.source}):null,o?t.jsxRuntimeExports.jsx(u.FootNote,{text:o,style:r?.footnote,className:l?.footnote}):null]})}exports.GraphFooter=a;
2
+ //# sourceMappingURL=GraphFooter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphFooter.js","sources":["../src/Components/Elements/GraphFooter.tsx"],"sourcesContent":["import { SourcesDataType } from '@/Types';\r\nimport { FootNote } from '@/Components/Typography/FootNote';\r\nimport { Source } from '@/Components/Typography/Source';\r\n\r\ninterface Props {\r\n footNote?: string | React.ReactNode;\r\n sources?: SourcesDataType[];\r\n width?: number;\r\n styles?: { footnote?: React.CSSProperties; source?: React.CSSProperties };\r\n classNames?: { footnote?: string; source?: string };\r\n}\r\n\r\nexport function GraphFooter(props: Props) {\r\n const { sources, footNote, width, styles, classNames } = props;\r\n if ((sources === undefined || (sources || []).length === 0) && footNote === undefined)\r\n return null;\r\n return (\r\n <div\r\n className='flex gap-2 flex-col'\r\n style={{ maxWidth: width ? `${width}px` : 'none' }}\r\n aria-label='Graph footer'\r\n >\r\n {sources ? (\r\n <Source sources={sources} style={styles?.source} className={classNames?.source} />\r\n ) : null}\r\n {footNote ? (\r\n <FootNote text={footNote} style={styles?.footnote} className={classNames?.footnote} />\r\n ) : null}\r\n </div>\r\n );\r\n}\r\n"],"names":["GraphFooter","props","sources","footNote","width","styles","classNames","jsxs","jsx","Source","FootNote"],"mappings":"qLAYO,SAASA,EAAYC,EAAc,CACxC,KAAM,CAAE,QAAAC,EAAS,SAAAC,EAAU,MAAAC,EAAO,OAAAC,EAAQ,WAAAC,GAAeL,EACzD,OAAKC,IAAY,SAAcA,GAAW,CAAA,GAAI,SAAW,IAAMC,IAAa,OACnE,KAEPI,EAAAA,kBAAAA,KAAC,MAAA,CACC,UAAU,sBACV,MAAO,CAAE,SAAUH,EAAQ,GAAGA,CAAK,KAAO,MAAA,EAC1C,aAAW,eAEV,SAAA,CAAAF,EACCM,EAAAA,kBAAAA,IAACC,UAAO,QAAAP,EAAkB,MAAOG,GAAQ,OAAQ,UAAWC,GAAY,MAAA,CAAQ,EAC9E,KACHH,EACCK,EAAAA,kBAAAA,IAACE,EAAAA,SAAA,CAAS,KAAMP,EAAU,MAAOE,GAAQ,SAAU,UAAWC,GAAY,QAAA,CAAU,EAClF,IAAA,CAAA,CAAA,CAGV"}
@@ -0,0 +1,22 @@
1
+ import { JSX } from 'react/jsx-runtime';
2
+
3
+ export declare function GraphHeader(props: Props): JSX.Element;
4
+
5
+ declare interface Props {
6
+ graphTitle?: string | React.ReactNode;
7
+ graphDescription?: string | React.ReactNode;
8
+ width?: number;
9
+ graphDownload?: HTMLDivElement | null;
10
+ dataDownload?: any;
11
+ isDashboard?: boolean;
12
+ styles?: {
13
+ title?: React.CSSProperties;
14
+ description?: React.CSSProperties;
15
+ };
16
+ classNames?: {
17
+ title?: string;
18
+ description?: string;
19
+ };
20
+ }
21
+
22
+ export { }
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-BHm2KTjD-D8FylaKc.cjs"),p=require("./CsvDownloadButton.js"),c=require("./ImageDownloadButton.js"),d=require("./GraphDescription.js"),m=require("./GraphTitle.js");function h(u){const{graphTitle:s,graphDescription:a,width:r,graphDownload:l,dataDownload:t,isDashboard:x,styles:n,classNames:i}=u;return e.jsxRuntimeExports.jsxs("div",{className:`flex gap-2 justify-between ${a&&s?"items-start":"items-center"}`,style:{maxWidth:r?`${r}px`:"none"},"aria-label":"Graph header",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex-col flex gap-1",children:[s?e.jsxRuntimeExports.jsx(m.GraphTitle,{text:s,isDashboard:x,style:n?.title,className:i?.title}):null,a?e.jsxRuntimeExports.jsx(d.GraphDescription,{text:a,style:n?.description,className:i?.description}):null]}),l||t?e.jsxRuntimeExports.jsxs("div",{className:"flex gap-3",children:[l?e.jsxRuntimeExports.jsx(c.ImageDownloadButton,{nodeID:l,buttonSmall:!0}):null,t&&t.length>0?e.jsxRuntimeExports.jsx(p.CsvDownloadButton,{csvData:t,buttonSmall:!0,headers:Object.keys(t[0]).map(o=>({label:o,key:o}))}):null]}):null]})}exports.GraphHeader=h;
2
+ //# sourceMappingURL=GraphHeader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphHeader.js","sources":["../src/Components/Elements/GraphHeader.tsx"],"sourcesContent":["import { CsvDownloadButton } from '@/Components/Actions/CsvDownloadButton';\r\nimport { ImageDownloadButton } from '@/Components/Actions/ImageDownloadButton';\r\nimport { GraphDescription } from '@/Components/Typography/GraphDescription';\r\nimport { GraphTitle } from '@/Components/Typography/GraphTitle';\r\n\r\ninterface Props {\r\n graphTitle?: string | React.ReactNode;\r\n graphDescription?: string | React.ReactNode;\r\n width?: number;\r\n graphDownload?: HTMLDivElement | null;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n dataDownload?: any;\r\n isDashboard?: boolean;\r\n styles?: { title?: React.CSSProperties; description?: React.CSSProperties };\r\n classNames?: { title?: string; description?: string };\r\n}\r\n\r\nexport function GraphHeader(props: Props) {\r\n const {\r\n graphTitle,\r\n graphDescription,\r\n width,\r\n graphDownload,\r\n dataDownload,\r\n isDashboard,\r\n styles,\r\n classNames,\r\n } = props;\r\n return (\r\n <div\r\n className={`flex gap-2 justify-between ${\r\n graphDescription && graphTitle ? 'items-start' : 'items-center'\r\n }`}\r\n style={{ maxWidth: width ? `${width}px` : 'none' }}\r\n aria-label='Graph header'\r\n >\r\n <div className='flex-col flex gap-1'>\r\n {graphTitle ? (\r\n <GraphTitle\r\n text={graphTitle}\r\n isDashboard={isDashboard}\r\n style={styles?.title}\r\n className={classNames?.title}\r\n />\r\n ) : null}\r\n {graphDescription ? (\r\n <GraphDescription\r\n text={graphDescription}\r\n style={styles?.description}\r\n className={classNames?.description}\r\n />\r\n ) : null}\r\n </div>\r\n {graphDownload || dataDownload ? (\r\n <div className='flex gap-3'>\r\n {graphDownload ? <ImageDownloadButton nodeID={graphDownload} buttonSmall /> : null}\r\n {dataDownload && dataDownload.length > 0 ? (\r\n <CsvDownloadButton\r\n csvData={dataDownload}\r\n buttonSmall\r\n headers={Object.keys(dataDownload[0]).map(d => ({\r\n label: d,\r\n key: d,\r\n }))}\r\n />\r\n ) : null}\r\n </div>\r\n ) : null}\r\n </div>\r\n );\r\n}\r\n"],"names":["GraphHeader","props","graphTitle","graphDescription","width","graphDownload","dataDownload","isDashboard","styles","classNames","jsxs","jsx","GraphTitle","GraphDescription","ImageDownloadButton","CsvDownloadButton","d"],"mappings":"2QAiBO,SAASA,EAAYC,EAAc,CACxC,KAAM,CACJ,WAAAC,EACA,iBAAAC,EACA,MAAAC,EACA,cAAAC,EACA,aAAAC,EACA,YAAAC,EACA,OAAAC,EACA,WAAAC,CAAA,EACER,EACJ,OACES,EAAAA,kBAAAA,KAAC,MAAA,CACC,UAAW,8BACTP,GAAoBD,EAAa,cAAgB,cACnD,GACA,MAAO,CAAE,SAAUE,EAAQ,GAAGA,CAAK,KAAO,MAAA,EAC1C,aAAW,eAEX,SAAA,CAAAM,EAAAA,kBAAAA,KAAC,MAAA,CAAI,UAAU,sBACZ,SAAA,CAAAR,EACCS,EAAAA,kBAAAA,IAACC,EAAAA,WAAA,CACC,KAAMV,EACN,YAAAK,EACA,MAAOC,GAAQ,MACf,UAAWC,GAAY,KAAA,CAAA,EAEvB,KACHN,EACCQ,EAAAA,kBAAAA,IAACE,EAAAA,iBAAA,CACC,KAAMV,EACN,MAAOK,GAAQ,YACf,UAAWC,GAAY,WAAA,CAAA,EAEvB,IAAA,EACN,EACCJ,GAAiBC,EAChBI,yBAAC,MAAA,CAAI,UAAU,aACZ,SAAA,CAAAL,0BAAiBS,EAAAA,oBAAA,CAAoB,OAAQT,EAAe,YAAW,GAAC,EAAK,KAC7EC,GAAgBA,EAAa,OAAS,EACrCK,EAAAA,kBAAAA,IAACI,EAAAA,kBAAA,CACC,QAAST,EACT,YAAW,GACX,QAAS,OAAO,KAAKA,EAAa,CAAC,CAAC,EAAE,IAAIU,IAAM,CAC9C,MAAOA,EACP,IAAKA,CAAA,EACL,CAAA,CAAA,EAEF,IAAA,CAAA,CACN,EACE,IAAA,CAAA,CAAA,CAGV"}
@@ -0,0 +1,13 @@
1
+ import { default as default_2 } from 'react';
2
+ import { JSX } from 'react/jsx-runtime';
3
+
4
+ export declare function GraphTitle(props: Props): JSX.Element | null;
5
+
6
+ declare interface Props {
7
+ text: string | default_2.ReactNode;
8
+ isDashboard?: boolean;
9
+ style?: default_2.CSSProperties;
10
+ className?: string;
11
+ }
12
+
13
+ export { }
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index-BHm2KTjD-D8FylaKc.cjs"),t=require("./Typography-CDR-DAHH.cjs"),o=require("react");function l(n){const{text:r,isDashboard:s,style:e,className:a}=n;return typeof r=="string"?r.trim()===""?null:s?i.jsxRuntimeExports.jsx(t.TypographyExports.H5,{marginBottom:"base",className:t.cnExports.cn("font-bold pb-3 text-primary-black dark:text-primary-gray-100",a),"aria-label":"Dashboard title",style:e,children:r}):i.jsxRuntimeExports.jsx(t.TypographyExports.P,{marginBottom:"none",className:t.cnExports.cn("text-primary-black dark:text-primary-gray-100",a),"aria-label":"Graph title",style:e,children:r}):o.isValidElement(r)?i.jsxRuntimeExports.jsx("div",{className:a,style:e,children:r}):(console.error("GraphTitle: Invalid text type. Expected string or React element."),null)}exports.GraphTitle=l;
2
+ //# sourceMappingURL=GraphTitle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphTitle.js","sources":["../src/Components/Typography/GraphTitle.tsx"],"sourcesContent":["import { cn } from '@undp/design-system-react/cn';\r\nimport { H5, P } from '@undp/design-system-react/Typography';\r\nimport React from 'react';\r\n\r\ninterface Props {\r\n text: string | React.ReactNode;\r\n isDashboard?: boolean;\r\n style?: React.CSSProperties;\r\n className?: string;\r\n}\r\n\r\nexport function GraphTitle(props: Props) {\r\n const { text, isDashboard, style, className } = props;\r\n if (typeof text === 'string') {\r\n if (text.trim() === '') return null;\r\n if (isDashboard)\r\n return (\r\n <H5\r\n marginBottom='base'\r\n className={cn('font-bold pb-3 text-primary-black dark:text-primary-gray-100', className)}\r\n aria-label='Dashboard title'\r\n style={style}\r\n >\r\n {text}\r\n </H5>\r\n );\r\n return (\r\n <P\r\n marginBottom='none'\r\n className={cn('text-primary-black dark:text-primary-gray-100', className)}\r\n aria-label='Graph title'\r\n style={style}\r\n >\r\n {text}\r\n </P>\r\n );\r\n }\r\n if (React.isValidElement(text))\r\n return (\r\n <div className={className} style={style}>\r\n {text}\r\n </div>\r\n );\r\n console.error('GraphTitle: Invalid text type. Expected string or React element.');\r\n return null;\r\n}\r\n"],"names":["GraphTitle","props","text","isDashboard","style","className","jsx","H5","cn","P","React"],"mappings":"2LAWO,SAASA,EAAWC,EAAc,CACvC,KAAM,CAAE,KAAAC,EAAM,YAAAC,EAAa,MAAAC,EAAO,UAAAC,GAAcJ,EAChD,OAAI,OAAOC,GAAS,SACdA,EAAK,SAAW,GAAW,KAC3BC,EAEAG,EAAAA,kBAAAA,IAACC,EAAAA,kBAAAA,GAAA,CACC,aAAa,OACb,UAAWC,EAAAA,UAAAA,GAAG,+DAAgEH,CAAS,EACvF,aAAW,kBACX,MAAAD,EAEC,SAAAF,CAAA,CAAA,EAILI,EAAAA,kBAAAA,IAACG,EAAAA,kBAAAA,EAAA,CACC,aAAa,OACb,UAAWD,EAAAA,UAAAA,GAAG,gDAAiDH,CAAS,EACxE,aAAW,cACX,MAAAD,EAEC,SAAAF,CAAA,CAAA,EAIHQ,EAAM,eAAeR,CAAI,EAEzBI,EAAAA,kBAAAA,IAAC,MAAA,CAAI,UAAAD,EAAsB,MAAAD,EACxB,SAAAF,EACH,GAEJ,QAAQ,MAAM,kEAAkE,EACzE,KACT"}