@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,166 @@
1
+ import { JSX } from 'react/jsx-runtime';
2
+
3
+ declare interface AnimateDataType {
4
+ duration: number;
5
+ once: boolean;
6
+ amount: 'some' | 'all' | number;
7
+ }
8
+
9
+ declare interface AxesClassNameObject {
10
+ gridLines?: string;
11
+ labels?: string;
12
+ title?: string;
13
+ axis?: string;
14
+ }
15
+
16
+ declare interface AxesStyleObject {
17
+ gridLines?: React.CSSProperties;
18
+ labels?: React.CSSProperties;
19
+ title?: React.CSSProperties;
20
+ axis?: React.CSSProperties;
21
+ }
22
+
23
+ declare interface ClassNameObject {
24
+ title?: string;
25
+ footnote?: string;
26
+ source?: string;
27
+ description?: string;
28
+ tooltip?: string;
29
+ xAxis?: AxesClassNameObject;
30
+ yAxis?: AxesClassNameObject;
31
+ legend?: string;
32
+ graphContainer?: string;
33
+ graphObjectValues?: string;
34
+ dataConnectors?: string;
35
+ mouseOverLine?: string;
36
+ regLine?: string;
37
+ dataCards?: string;
38
+ }
39
+
40
+ export declare function HeatMap(props: Props): JSX.Element;
41
+
42
+ declare interface HeatMapDataType {
43
+ row: string;
44
+ column: string;
45
+ value?: string | number;
46
+ data?: object;
47
+ }
48
+
49
+ declare type Languages = 'en' | 'ar' | 'az' | 'bn' | 'cy' | 'he' | 'hi' | 'jp' | 'ka' | 'km' | 'ko' | 'my' | 'ne' | 'zh' | 'custom';
50
+
51
+ declare interface Props {
52
+ /** Array of data objects */
53
+ data: HeatMapDataType[];
54
+ /** Title of the graph */
55
+ graphTitle?: string | React.ReactNode;
56
+ /** Description of the graph */
57
+ graphDescription?: string | React.ReactNode;
58
+ /** Footnote for the graph */
59
+ footNote?: string | React.ReactNode;
60
+ /** Source data for the graph */
61
+ sources?: SourcesDataType[];
62
+ /** Accessibility label */
63
+ ariaLabel?: string;
64
+ /** Array of colors for cells */
65
+ colors?: string[];
66
+ /** Color where data is not available */
67
+ noDataColor?: string;
68
+ /** Title for the color legend */
69
+ colorLegendTitle?: string;
70
+ /** Background color of the graph */
71
+ backgroundColor?: string | boolean;
72
+ /** Custom styles for the graph. Each object should be a valid React CSS style object. */
73
+ styles?: StyleObject;
74
+ /** Custom class names */
75
+ classNames?: ClassNameObject;
76
+ /** Width of the graph */
77
+ width?: number;
78
+ /** Height of the graph */
79
+ height?: number;
80
+ /** Minimum height of the graph */
81
+ minHeight?: number;
82
+ /** Relative height scaling factor. This overwrites the height props */
83
+ relativeHeight?: number;
84
+ /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */
85
+ padding?: string;
86
+ /** Left margin of the graph */
87
+ leftMargin?: number;
88
+ /** Right margin of the graph */
89
+ rightMargin?: number;
90
+ /** Top margin of the graph */
91
+ topMargin?: number;
92
+ /** Bottom margin of the graph */
93
+ bottomMargin?: number;
94
+ /** Toggles the background to fill the container. This only works if the width of the graph is defined. */
95
+ fillContainer?: boolean;
96
+ /** Prefix for values */
97
+ prefix?: string;
98
+ /** Suffix for values */
99
+ suffix?: string;
100
+ /** Maximum value for the chart */
101
+ truncateBy?: number;
102
+ /** Reference values for comparison */
103
+ /** Toggle visibility of labels in the column */
104
+ showColumnLabels?: boolean;
105
+ /** Toggle visibility of labels in the row */
106
+ showRowLabels?: boolean;
107
+ /** Scale for the colors in the cell */
108
+ scaleType?: ScaleDataType;
109
+ /** Toggle visibility of values */
110
+ showValues?: boolean;
111
+ /** Toggle visibility of color scale. This is only applicable if the data props hae color parameter */
112
+ showColorScale?: boolean;
113
+ /** Toggle visibility of NA color in the color scale. This is only applicable if the data props hae color parameter and showColorScale prop is true */
114
+ showNAColor?: boolean;
115
+ /** Toggles if the graph animates in when loaded. */
116
+ animate?: boolean | AnimateDataType;
117
+ /** Domain for the colors in the cell. */
118
+ colorDomain: number[] | string[];
119
+ /** Specifies the number of decimal places to display in the value. */
120
+ precision?: number;
121
+ /** Enable graph download option as png */
122
+ graphDownload?: boolean;
123
+ /** Enable data download option as a csv */
124
+ dataDownload?: boolean;
125
+ /** Reset selection on double-click. Only applicable when used in a dashboard context with filters. */
126
+ resetSelectionOnDoubleClick?: boolean;
127
+ /** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */
128
+ tooltip?: string | ((_d: any) => React.ReactNode);
129
+ /** Details displayed on the modal when user clicks of a data point. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */
130
+ detailsOnClick?: string | ((_d: any) => React.ReactNode);
131
+ /** Callback for mouse over event */
132
+ onSeriesMouseOver?: (_d: any) => void;
133
+ /** Callback for mouse click event */
134
+ onSeriesMouseClick?: (_d: any) => void;
135
+ /** Language setting */
136
+ language?: Languages;
137
+ /** Color theme */
138
+ theme?: 'light' | 'dark';
139
+ /** Unique ID for the graph */
140
+ graphID?: string;
141
+ }
142
+
143
+ declare type ScaleDataType = 'categorical' | 'linear' | 'threshold';
144
+
145
+ declare interface SourcesDataType {
146
+ source: string;
147
+ link?: string;
148
+ }
149
+
150
+ declare interface StyleObject {
151
+ title?: React.CSSProperties;
152
+ footnote?: React.CSSProperties;
153
+ source?: React.CSSProperties;
154
+ description?: React.CSSProperties;
155
+ graphContainer?: React.CSSProperties;
156
+ tooltip?: React.CSSProperties;
157
+ xAxis?: AxesStyleObject;
158
+ yAxis?: AxesStyleObject;
159
+ graphObjectValues?: React.CSSProperties;
160
+ dataConnectors?: React.CSSProperties;
161
+ mouseOverLine?: React.CSSProperties;
162
+ regLine?: React.CSSProperties;
163
+ dataCards?: React.CSSProperties;
164
+ }
165
+
166
+ export { }
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-BHm2KTjD-D8FylaKc.cjs"),c=require("react"),ue=require("./Typography-CDR-DAHH.cjs"),ce=require("./index-BXns0-ng.cjs"),le=require("./index-CZbIGs8q.cjs"),xe=require("./Modal-cQF2UQIa.cjs"),he=require("./numberFormattingFunction.js"),de=require("./Tooltip-BM18N_3l.cjs"),ge=require("./getTextColorBasedOnBgColor.js"),se=require("./checkIfNullOrUndefined.js"),me=require("./string2HTML-X4ZYX5jI.cjs"),pe=require("./XAxesLabels-C9REbQQs.cjs"),fe=require("./YAxesLabels-DhBdLk3Z.cjs"),U=require("./use-in-view-Dl1CsAIo.cjs"),ae=require("./band-CAApY4Pd.cjs"),je=require("./ordinal-BOeNbyae.cjs"),Ce=require("./threshold-DNsSUf8Q.cjs"),ye=require("./linear-BVckp9RD.cjs"),ve=require("./GraphHeader.js"),we=require("./GraphFooter.js"),be=require("./ColorLegendWithMouseOver.js"),Ee=require("./LinearColorLegend.js"),Re=require("./ThresholdColorLegendWithMouseOver.js"),i=require("./Colors.js"),$e=require("./EmptyState-BQguKAp5.cjs");function qe(z){const{data:m,showColumnLabels:N,leftMargin:O,rightMargin:F,truncateBy:p,width:H,height:I,topMargin:_,bottomMargin:K,tooltip:$,onSeriesMouseOver:r,suffix:J,prefix:s,showValues:G,colorDomain:q,colors:S,noDataColor:f,scaleType:X,showRowLabels:Q,selectedColor:Y,onSeriesMouseClick:V,resetSelectionOnDoubleClick:Z,detailsOnClick:y,styles:L,classNames:j,animate:v,precision:ee}=z,W=c.useRef(null),D=U.useInView(W,{once:v.once,amount:v.amount}),l={top:_,bottom:K,left:O,right:F},[w,T]=c.useState(void 0),[x,M]=c.useState(void 0),[A,b]=c.useState(void 0),[o,B]=c.useState(void 0),te=H-l.left-l.right,oe=I-l.top-l.bottom,h=le.uniqBy(m,e=>e.column).map(e=>e.column),d=le.uniqBy(m,e=>e.row).map(e=>e.row),E=ae.band().domain(d).range([0,oe]),k=E.bandwidth(),a=ae.band().domain(h).range([0,te]),R=a.bandwidth(),P=X==="categorical"?je.ordinal().domain(q).range(S):X==="threshold"?Ce.threshold().domain(q).range(S):ye.linear().domain(q).range(S);return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs(U.motion.svg,{width:`${H}px`,height:`${I}px`,viewBox:`0 0 ${H} ${I}`,style:{marginLeft:"auto",marginRight:"auto"},direction:"ltr",ref:W,children:[t.jsxRuntimeExports.jsx("g",{transform:`translate(${l.left},0)`,children:N?h.map((e,C)=>t.jsxRuntimeExports.jsx(pe.XAxesLabels,{y:0,x:a(e),width:R,height:l.top-5,value:`${e}`.length<p?`${e}`:`${`${e}`.substring(0,p)}...`,style:L?.xAxis?.labels,className:j?.xAxis?.labels,alignment:"bottom",animate:{duration:0,once:!0,amount:0},isInView:D},C)):null}),t.jsxRuntimeExports.jsx("g",{transform:`translate(0,${l.top})`,children:Q?d.map((e,C)=>t.jsxRuntimeExports.jsx(fe.YAxesLabels,{value:`${e}`.length<p?`${e}`:`${`${e}`.substring(0,p)}...`,y:E(e),x:0,width:l.left,height:k,alignment:"right",style:L?.yAxis?.labels,className:j?.yAxis?.labels,animate:{duration:0,once:!0,amount:0},isInView:D},C)):null}),t.jsxRuntimeExports.jsxs("g",{transform:`translate(${l.left},${l.top})`,children:[d.map((e,C)=>t.jsxRuntimeExports.jsx("g",{transform:`translate(0,${E(e)})`,children:h.map(g=>t.jsxRuntimeExports.jsx("rect",{x:a(g),y:0,width:R,height:k,style:{fill:f},className:"stroke-1 stroke-primary-white dark:stroke-primary-gray-700"},`${e}-${g}`))},C)),m.filter(e=>!se.checkIfNullOrUndefined(e.value)).map((e,C)=>{const g=se.checkIfNullOrUndefined(e.value)?f:P(e.value);return t.jsxRuntimeExports.jsxs("g",{transform:`translate(${a(e.column)},${E(e.row)})`,onMouseEnter:u=>{M(e),B(u.clientY),b(u.clientX),r?.(e)},onClick:()=>{(V||y)&&(ce.isEqual(w,e)&&Z?(T(void 0),V?.(void 0)):(T(e),V?.(e)))},onMouseMove:u=>{M(e),B(u.clientY),b(u.clientX)},onMouseLeave:()=>{M(void 0),b(void 0),B(void 0),r?.(void 0)},opacity:Y?Y===g?1:.3:1,children:[t.jsxRuntimeExports.jsx(U.motion.rect,{x:0,y:0,width:R,height:k,className:"stroke-1 stroke-primary-white dark:stroke-primary-gray-700",exit:{opacity:0,transition:{duration:v.duration}},variants:{initial:{fill:g,opacity:0},whileInView:{fill:g,opacity:1,transition:{duration:v.duration}}},initial:"initial",animate:D?"whileInView":"initial"}),G&&!se.checkIfNullOrUndefined(e.value)?t.jsxRuntimeExports.jsx(U.motion.g,{variants:{initial:{opacity:0},whileInView:{opacity:1,transition:{duration:v.duration}}},initial:"initial",animate:D?"whileInView":"initial",exit:{opacity:0,transition:{duration:v.duration}},children:t.jsxRuntimeExports.jsx("foreignObject",{y:0,x:0,width:R,height:k,children:t.jsxRuntimeExports.jsx("div",{className:"flex flex-col justify-center items-center h-inherit p-1",children:t.jsxRuntimeExports.jsx("p",{className:ue.cnExports.cn("text-xs text-center m-0 leading-[1.25] graph-value",j?.graphObjectValues),style:{color:ge.getTextColorBasedOnBgColor(g),...L?.graphObjectValues||{}},children:he.numberFormattingFunction(e.value,"NA",ee,s,J)})})},C)}):null]},`${e.column}-${e.row}`)}),x?t.jsxRuntimeExports.jsx("rect",{x:a(x.column),y:E(x.row),width:R,height:k,style:{fill:"none",fillOpacity:0,strokeWidth:1.5},className:"stroke-primary-gray-700 dark:stroke-primary-gray-300"}):null]})]}),x&&$&&A&&o?t.jsxRuntimeExports.jsx(de.Tooltip,{data:x,body:$,xPos:A,yPos:o,backgroundStyle:L?.tooltip,className:j?.tooltip}):null,y&&w!==void 0?t.jsxRuntimeExports.jsx(xe.ModalExports.Modal,{open:w!==void 0,onClose:()=>{T(void 0)},children:t.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof y=="string"?{__html:me.string2HTML(y,w)}:void 0,children:typeof y=="function"?y(w):null})}):null]})}function Me(z){const{data:m,graphTitle:N,colors:O,sources:F,graphDescription:p,showColumnLabels:H=!0,leftMargin:I=100,rightMargin:_=10,truncateBy:K=999,height:$,width:r,scaleType:J,colorDomain:s,footNote:G,colorLegendTitle:q,padding:S,backgroundColor:f=!1,topMargin:X=30,bottomMargin:Q=10,tooltip:Y,onSeriesMouseOver:V,suffix:Z="",prefix:y="",showRowLabels:L=!0,relativeHeight:j,showValues:v,graphID:ee,noDataColor:W=i.Colors.gray,showColorScale:D=!0,onSeriesMouseClick:l,graphDownload:w=!1,dataDownload:T=!1,fillContainer:x=!0,language:M="en",showNAColor:A=!0,minHeight:b=0,theme:o="light",ariaLabel:B,resetSelectionOnDoubleClick:te=!0,detailsOnClick:oe,styles:h,classNames:d,animate:E=!1,precision:k=2}=z,[a,R]=c.useState(0),[P,e]=c.useState(0),[C,g]=c.useState(void 0),u=c.useRef(null),ie=c.useRef(null);c.useEffect(()=>{const n=new ResizeObserver(ne=>{R(r||ne[0].target.clientWidth||620),e($||ne[0].target.clientHeight||480)});return u.current&&(e(u.current.clientHeight||480),R(u.current.clientWidth||620),r||n.observe(u.current)),()=>n.disconnect()},[r,$]);const re=J||(typeof s[0]=="string"?"categorical":s.length===2?"linear":"threshold");return t.jsxRuntimeExports.jsx("div",{className:`${o||"light"} flex ${r?"grow-0":"grow"} ${x?"w-full":"w-fit"}`,dir:M==="he"||M==="ar"?"rtl":void 0,children:t.jsxRuntimeExports.jsx("div",{className:ue.cnExports.cn(`${f?f===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${M||"en"}`,d?.graphContainer),style:{...h?.graphContainer||{},...f&&f!==!0?{backgroundColor:f}:{}},id:ee,ref:ie,"aria-label":B||`${N?`The graph shows ${N}. `:""}This is a heatmap. ${p?` ${p}`:""}`,children:t.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:f?S||"1rem":S||0},children:t.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[N||p||w||T?t.jsxRuntimeExports.jsx(ve.GraphHeader,{styles:{title:h?.title,description:h?.description},classNames:{title:d?.title,description:d?.description},graphTitle:N,graphDescription:p,width:r,graphDownload:w?ie.current:void 0,dataDownload:T?m.map(n=>n.data).filter(n=>n!==void 0).length>0?m.map(n=>n.data).filter(n=>n!==void 0):m.filter(n=>n!==void 0):null}):null,t.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:m.length===0?t.jsxRuntimeExports.jsx($e.EmptyState,{}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[D?re==="categorical"?t.jsxRuntimeExports.jsx(be.ColorLegendWithMouseOver,{width:x?void 0:r,colorLegendTitle:q,colors:O||(typeof s[0]=="string"?i.Colors[o].categoricalColors.colors:s.length===2?[i.Colors[o].sequentialColors.neutralColorsx09[0],i.Colors[o].sequentialColors.neutralColorsx09[8]]:i.Colors[o].sequentialColors[`neutralColorsx0${s.length+1}`]),colorDomain:s.map(n=>`${n}`),setSelectedColor:g,showNAColor:A}):re==="threshold"?t.jsxRuntimeExports.jsx(Re.ThresholdColorLegendWithMouseOver,{width:x?void 0:r,colorLegendTitle:q,colors:O||(typeof s[0]=="string"?i.Colors[o].categoricalColors.colors:s.length===2?[i.Colors[o].sequentialColors.neutralColorsx09[0],i.Colors[o].sequentialColors.neutralColorsx09[8]]:i.Colors[o].sequentialColors[`neutralColorsx0${s.length+1}`]),colorDomain:s,setSelectedColor:g,naColor:W,showNAColor:A}):t.jsxRuntimeExports.jsx(Ee.LinearColorLegend,{width:x?void 0:r,colorLegendTitle:q,colors:O||[i.Colors[o].sequentialColors.neutralColorsx09[0],i.Colors[o].sequentialColors.neutralColorsx09[8]],colorDomain:s}):null,t.jsxRuntimeExports.jsx("div",{className:"flex grow flex-col justify-center w-full leading-0",ref:u,"aria-label":"Graph area",children:(r||a)&&($||P)?t.jsxRuntimeExports.jsx(qe,{data:m,colorDomain:s,width:r||a,colors:O||(typeof s[0]=="string"?i.Colors[o].categoricalColors.colors:s.length===2?[i.Colors[o].sequentialColors.neutralColorsx09[0],i.Colors[o].sequentialColors.neutralColorsx09[8]]:i.Colors[o].sequentialColors[`neutralColorsx0${s.length+1}`]),noDataColor:W,scaleType:re,height:Math.max(b,$||(j?b?(r||a)*j>b?(r||a)*j:b:(r||a)*j:P)),showColumnLabels:H,leftMargin:I,rightMargin:_,topMargin:X,bottomMargin:Q,selectedColor:C,truncateBy:K,showRowLabels:L,tooltip:Y,onSeriesMouseOver:V,showValues:v,suffix:Z,prefix:y,onSeriesMouseClick:l,resetSelectionOnDoubleClick:te,detailsOnClick:oe,styles:h,classNames:d,animate:E===!0?{duration:.5,once:!0,amount:.5}:E||{duration:0,once:!0,amount:0},precision:k}):null})]})}),F||G?t.jsxRuntimeExports.jsx(we.GraphFooter,{styles:{footnote:h?.footnote,source:h?.source},classNames:{footnote:d?.footnote,source:d?.source},sources:F,footNote:G,width:r}):null]})})})})}exports.HeatMap=Me;
2
+ //# sourceMappingURL=HeatMap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HeatMap.js","sources":["../src/Components/Graphs/HeatMap/Graph.tsx","../src/Components/Graphs/HeatMap/index.tsx"],"sourcesContent":["import isEqual from 'fast-deep-equal';\r\nimport { scaleLinear, scaleBand, scaleOrdinal, scaleThreshold } from 'd3-scale';\r\nimport { useRef, useState } from 'react';\r\nimport uniqBy from 'lodash.uniqby';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport { Modal } from '@undp/design-system-react/Modal';\r\nimport { motion, useInView } from 'motion/react';\r\n\r\nimport {\r\n AnimateDataType,\r\n ClassNameObject,\r\n HeatMapDataType,\r\n ScaleDataType,\r\n StyleObject,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { getTextColorBasedOnBgColor } from '@/Utils/getTextColorBasedOnBgColor';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { string2HTML } from '@/Utils/string2HTML';\r\nimport { XAxesLabels } from '@/Components/Elements/Axes/XAxesLabels';\r\nimport { YAxesLabels } from '@/Components/Elements/Axes/YAxesLabels';\r\n\r\ninterface Props {\r\n data: HeatMapDataType[];\r\n colorDomain: string[] | number[];\r\n colors: string[];\r\n noDataColor: string;\r\n scaleType: ScaleDataType;\r\n showColumnLabels: boolean;\r\n leftMargin: number;\r\n truncateBy: number;\r\n width: number;\r\n height: number;\r\n rightMargin: number;\r\n topMargin: number;\r\n showRowLabels: boolean;\r\n bottomMargin: number;\r\n suffix: string;\r\n prefix: string;\r\n showValues?: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n selectedColor?: string;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n resetSelectionOnDoubleClick: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n animate: AnimateDataType;\r\n precision: number;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n showColumnLabels,\r\n leftMargin,\r\n rightMargin,\r\n truncateBy,\r\n width,\r\n height,\r\n topMargin,\r\n bottomMargin,\r\n tooltip,\r\n onSeriesMouseOver,\r\n suffix,\r\n prefix,\r\n showValues,\r\n colorDomain,\r\n colors,\r\n noDataColor,\r\n scaleType,\r\n showRowLabels,\r\n selectedColor,\r\n onSeriesMouseClick,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n animate,\r\n precision,\r\n } = props;\r\n const svgRef = useRef(null);\r\n const isInView = useInView(svgRef, {\r\n once: animate.once,\r\n amount: animate.amount,\r\n });\r\n const margin = {\r\n top: topMargin,\r\n bottom: bottomMargin,\r\n left: leftMargin,\r\n right: rightMargin,\r\n };\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n const [mouseOverData, setMouseOverData] = useState<HeatMapDataType | undefined>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n const graphWidth = width - margin.left - margin.right;\r\n const graphHeight = height - margin.top - margin.bottom;\r\n const columns = uniqBy(data, d => d.column).map(d => d.column);\r\n const rows = uniqBy(data, d => d.row).map(d => d.row);\r\n const y = scaleBand().domain(rows).range([0, graphHeight]);\r\n const barHeight = y.bandwidth();\r\n const x = scaleBand().domain(columns).range([0, graphWidth]);\r\n const barWidth = x.bandwidth();\r\n const colorScale =\r\n scaleType === 'categorical'\r\n ? scaleOrdinal<number | string, string>().domain(colorDomain).range(colors)\r\n : scaleType === 'threshold'\r\n ? scaleThreshold<number, string>()\r\n .domain(colorDomain as number[])\r\n .range(colors)\r\n : scaleLinear<string, string>()\r\n .domain(colorDomain as number[])\r\n .range(colors);\r\n return (\r\n <>\r\n <motion.svg\r\n width={`${width}px`}\r\n height={`${height}px`}\r\n viewBox={`0 0 ${width} ${height}`}\r\n style={{ marginLeft: 'auto', marginRight: 'auto' }}\r\n direction='ltr'\r\n ref={svgRef}\r\n >\r\n <g transform={`translate(${margin.left},${0})`}>\r\n {showColumnLabels\r\n ? columns.map((d, i) => (\r\n <XAxesLabels\r\n key={i}\r\n y={0}\r\n x={x(d) as number}\r\n width={barWidth}\r\n height={margin.top - 5}\r\n value={\r\n `${d}`.length < truncateBy ? `${d}` : `${`${d}`.substring(0, truncateBy)}...`\r\n }\r\n style={styles?.xAxis?.labels}\r\n className={classNames?.xAxis?.labels}\r\n alignment='bottom'\r\n animate={{ duration: 0, once: true, amount: 0 }}\r\n isInView={isInView}\r\n />\r\n ))\r\n : null}\r\n </g>\r\n <g transform={`translate(${0},${margin.top})`}>\r\n {showRowLabels\r\n ? rows.map((d, i) => (\r\n <YAxesLabels\r\n value={\r\n `${d}`.length < truncateBy ? `${d}` : `${`${d}`.substring(0, truncateBy)}...`\r\n }\r\n key={i}\r\n y={y(d) as number}\r\n x={0}\r\n width={margin.left}\r\n height={barHeight}\r\n alignment='right'\r\n style={styles?.yAxis?.labels}\r\n className={classNames?.yAxis?.labels}\r\n animate={{ duration: 0, once: true, amount: 0 }}\r\n isInView={isInView}\r\n />\r\n ))\r\n : null}\r\n </g>\r\n <g transform={`translate(${margin.left},${margin.top})`}>\r\n {rows.map((d, i) => (\r\n <g key={i} transform={`translate(0,${y(d)})`}>\r\n {columns.map(el => (\r\n <rect\r\n key={`${d}-${el}`}\r\n x={x(el)}\r\n y={0}\r\n width={barWidth}\r\n height={barHeight}\r\n style={{ fill: noDataColor }}\r\n className='stroke-1 stroke-primary-white dark:stroke-primary-gray-700'\r\n />\r\n ))}\r\n </g>\r\n ))}\r\n {data\r\n .filter(d => !checkIfNullOrUndefined(d.value))\r\n .map((d, i) => {\r\n const color = !checkIfNullOrUndefined(d.value)\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n colorScale(d.value as any)\r\n : noDataColor;\r\n return (\r\n <g\r\n key={`${d.column}-${d.row}`}\r\n transform={`translate(${x(d.column)},${y(d.row)})`}\r\n onMouseEnter={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.(d);\r\n }}\r\n onClick={() => {\r\n if (onSeriesMouseClick || detailsOnClick) {\r\n if (isEqual(mouseClickData, d) && resetSelectionOnDoubleClick) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n setMouseClickData(d);\r\n onSeriesMouseClick?.(d);\r\n }\r\n }\r\n }}\r\n onMouseMove={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n }}\r\n onMouseLeave={() => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n }}\r\n opacity={selectedColor ? (selectedColor === color ? 1 : 0.3) : 1}\r\n >\r\n <motion.rect\r\n x={0}\r\n y={0}\r\n width={barWidth}\r\n height={barHeight}\r\n className='stroke-1 stroke-primary-white dark:stroke-primary-gray-700'\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { fill: color, opacity: 0 },\r\n whileInView: {\r\n fill: color,\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n {showValues && !checkIfNullOrUndefined(d.value) ? (\r\n <motion.g\r\n variants={{\r\n initial: { opacity: 0 },\r\n whileInView: { opacity: 1, transition: { duration: animate.duration } },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n >\r\n <foreignObject key={i} y={0} x={0} width={barWidth} height={barHeight}>\r\n <div className='flex flex-col justify-center items-center h-inherit p-1'>\r\n <p\r\n className={cn(\r\n 'text-xs text-center m-0 leading-[1.25] graph-value',\r\n classNames?.graphObjectValues,\r\n )}\r\n style={{\r\n color: getTextColorBasedOnBgColor(color),\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n >\r\n {numberFormattingFunction(d.value, 'NA', precision, prefix, suffix)}\r\n </p>\r\n </div>\r\n </foreignObject>\r\n </motion.g>\r\n ) : null}\r\n </g>\r\n );\r\n })}\r\n {mouseOverData ? (\r\n <rect\r\n x={x(mouseOverData.column)}\r\n y={y(mouseOverData.row)}\r\n width={barWidth}\r\n height={barHeight}\r\n style={{\r\n fill: 'none',\r\n fillOpacity: 0,\r\n strokeWidth: 1.5,\r\n }}\r\n className='stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n />\r\n ) : null}\r\n </g>\r\n </motion.svg>\r\n {mouseOverData && tooltip && eventX && eventY ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={eventX}\r\n yPos={eventY}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n {detailsOnClick && mouseClickData !== undefined ? (\r\n <Modal\r\n open={mouseClickData !== undefined}\r\n onClose={() => {\r\n setMouseClickData(undefined);\r\n }}\r\n >\r\n <div\r\n className='graph-modal-content m-0'\r\n dangerouslySetInnerHTML={\r\n typeof detailsOnClick === 'string'\r\n ? { __html: string2HTML(detailsOnClick, mouseClickData) }\r\n : undefined\r\n }\r\n >\r\n {typeof detailsOnClick === 'function' ? detailsOnClick(mouseClickData) : null}\r\n </div>\r\n </Modal>\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import { useState, useRef, useEffect } from 'react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport {\r\n HeatMapDataType,\r\n Languages,\r\n ScaleDataType,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n AnimateDataType,\r\n} from '@/Types';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { ColorLegendWithMouseOver } from '@/Components/Elements/ColorLegendWithMouseOver';\r\nimport { LinearColorLegend } from '@/Components/Elements/LinearColorLegend';\r\nimport { ThresholdColorLegendWithMouseOver } from '@/Components/Elements/ThresholdColorLegendWithMouseOver';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { EmptyState } from '@/Components/Elements/EmptyState';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: HeatMapDataType[];\r\n\r\n // Titles, Labels, and Sources\r\n /** Title of the graph */\r\n graphTitle?: string | React.ReactNode;\r\n /** Description of the graph */\r\n graphDescription?: string | React.ReactNode;\r\n /** Footnote for the graph */\r\n footNote?: string | React.ReactNode;\r\n /** Source data for the graph */\r\n sources?: SourcesDataType[];\r\n /** Accessibility label */\r\n ariaLabel?: string;\r\n\r\n // Colors and Styling\r\n /** Array of colors for cells */\r\n colors?: string[];\r\n /** Color where data is not available */\r\n noDataColor?: string;\r\n /** Title for the color legend */\r\n colorLegendTitle?: string;\r\n /** Background color of the graph */\r\n backgroundColor?: string | boolean;\r\n /** Custom styles for the graph. Each object should be a valid React CSS style object. */\r\n styles?: StyleObject;\r\n /** Custom class names */\r\n classNames?: ClassNameObject;\r\n\r\n // Size and Spacing\r\n /** Width of the graph */\r\n width?: number;\r\n /** Height of the graph */\r\n height?: number;\r\n /** Minimum height of the graph */\r\n minHeight?: number;\r\n /** Relative height scaling factor. This overwrites the height props */\r\n relativeHeight?: number;\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n /** Left margin of the graph */\r\n leftMargin?: number;\r\n /** Right margin of the graph */\r\n rightMargin?: number;\r\n /** Top margin of the graph */\r\n topMargin?: number;\r\n /** Bottom margin of the graph */\r\n bottomMargin?: number;\r\n /** Toggles the background to fill the container. This only works if the width of the graph is defined. */\r\n fillContainer?: boolean;\r\n\r\n // Values and Ticks\r\n /** Prefix for values */\r\n prefix?: string;\r\n /** Suffix for values */\r\n suffix?: string;\r\n /** Maximum value for the chart */\r\n truncateBy?: number;\r\n /** Reference values for comparison */\r\n\r\n // Graph Parameters\r\n /** Toggle visibility of labels in the column */\r\n showColumnLabels?: boolean;\r\n /** Toggle visibility of labels in the row */\r\n showRowLabels?: boolean;\r\n /** Scale for the colors in the cell */\r\n scaleType?: ScaleDataType;\r\n /** Toggle visibility of values */\r\n showValues?: boolean;\r\n /** Toggle visibility of color scale. This is only applicable if the data props hae color parameter */\r\n showColorScale?: boolean;\r\n /** Toggle visibility of NA color in the color scale. This is only applicable if the data props hae color parameter and showColorScale prop is true */\r\n showNAColor?: boolean;\r\n /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\r\n /** Domain for the colors in the cell. */\r\n colorDomain: number[] | string[];\r\n /** Specifies the number of decimal places to display in the value. */\r\n precision?: number;\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n /** Reset selection on double-click. Only applicable when used in a dashboard context with filters. */\r\n resetSelectionOnDoubleClick?: boolean;\r\n\r\n // Interactions and Callbacks\r\n /** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n /** Details displayed on the modal when user clicks of a data point. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n /** Callback for mouse over event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n /** Callback for mouse click event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n\r\n // Configuration and Options\r\n /** Language setting */\r\n language?: Languages;\r\n /** Color theme */\r\n theme?: 'light' | 'dark';\r\n /** Unique ID for the graph */\r\n graphID?: string;\r\n}\r\n\r\nexport function HeatMap(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n colors,\r\n sources,\r\n graphDescription,\r\n showColumnLabels = true,\r\n leftMargin = 100,\r\n rightMargin = 10,\r\n truncateBy = 999,\r\n height,\r\n width,\r\n scaleType,\r\n colorDomain,\r\n footNote,\r\n colorLegendTitle,\r\n padding,\r\n backgroundColor = false,\r\n topMargin = 30,\r\n bottomMargin = 10,\r\n tooltip,\r\n onSeriesMouseOver,\r\n suffix = '',\r\n prefix = '',\r\n showRowLabels = true,\r\n relativeHeight,\r\n showValues,\r\n graphID,\r\n noDataColor = Colors.gray,\r\n showColorScale = true,\r\n onSeriesMouseClick,\r\n graphDownload = false,\r\n dataDownload = false,\r\n fillContainer = true,\r\n language = 'en',\r\n showNAColor = true,\r\n minHeight = 0,\r\n theme = 'light',\r\n ariaLabel,\r\n resetSelectionOnDoubleClick = true,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n animate = false,\r\n precision = 2,\r\n } = props;\r\n\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n const [selectedColor, setSelectedColor] = useState<string | undefined>(undefined);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(width || entries[0].target.clientWidth || 620);\r\n setSvgHeight(height || entries[0].target.clientHeight || 480);\r\n });\r\n if (graphDiv.current) {\r\n setSvgHeight(graphDiv.current.clientHeight || 480);\r\n setSvgWidth(graphDiv.current.clientWidth || 620);\r\n if (!width) resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, [width, height]);\r\n const scale =\r\n scaleType ||\r\n (typeof colorDomain[0] === 'string'\r\n ? 'categorical'\r\n : colorDomain.length === 2\r\n ? 'linear'\r\n : 'threshold');\r\n\r\n return (\r\n <div\r\n className={`${theme || 'light'} flex ${width ? 'grow-0' : 'grow'} ${\r\n !fillContainer ? 'w-fit' : 'w-full'\r\n }`}\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 ref={graphParentDiv}\r\n aria-label={\r\n ariaLabel ||\r\n `${\r\n graphTitle ? `The graph shows ${graphTitle}. ` : ''\r\n }This is a heatmap. ${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 || graphDownload || dataDownload ? (\r\n <GraphHeader\r\n styles={{\r\n title: styles?.title,\r\n description: styles?.description,\r\n }}\r\n classNames={{\r\n title: classNames?.title,\r\n description: classNames?.description,\r\n }}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n width={width}\r\n graphDownload={graphDownload ? graphParentDiv.current : undefined}\r\n dataDownload={\r\n dataDownload\r\n ? data.map(d => d.data).filter(d => d !== undefined).length > 0\r\n ? data.map(d => d.data).filter(d => d !== undefined)\r\n : data.filter(d => d !== undefined)\r\n : null\r\n }\r\n />\r\n ) : null}\r\n <div className='grow flex flex-col justify-center gap-3 w-full'>\r\n {data.length === 0 ? (\r\n <EmptyState />\r\n ) : (\r\n <>\r\n {showColorScale ? (\r\n scale === 'categorical' ? (\r\n <ColorLegendWithMouseOver\r\n width={fillContainer ? undefined : width}\r\n colorLegendTitle={colorLegendTitle}\r\n colors={\r\n colors ||\r\n (typeof colorDomain[0] === 'string'\r\n ? Colors[theme].categoricalColors.colors\r\n : colorDomain.length === 2\r\n ? [\r\n Colors[theme].sequentialColors.neutralColorsx09[0],\r\n Colors[theme].sequentialColors.neutralColorsx09[8],\r\n ]\r\n : Colors[theme].sequentialColors[\r\n `neutralColorsx0${\r\n (colorDomain.length + 1) as 4 | 5 | 6 | 7 | 8 | 9\r\n }`\r\n ])\r\n }\r\n colorDomain={colorDomain.map(d => `${d}`)}\r\n setSelectedColor={setSelectedColor}\r\n showNAColor={showNAColor}\r\n />\r\n ) : scale === 'threshold' ? (\r\n <ThresholdColorLegendWithMouseOver\r\n width={fillContainer ? undefined : width}\r\n colorLegendTitle={colorLegendTitle}\r\n colors={\r\n colors ||\r\n (typeof colorDomain[0] === 'string'\r\n ? Colors[theme].categoricalColors.colors\r\n : colorDomain.length === 2\r\n ? [\r\n Colors[theme].sequentialColors.neutralColorsx09[0],\r\n Colors[theme].sequentialColors.neutralColorsx09[8],\r\n ]\r\n : Colors[theme].sequentialColors[\r\n `neutralColorsx0${\r\n (colorDomain.length + 1) as 4 | 5 | 6 | 7 | 8 | 9\r\n }`\r\n ])\r\n }\r\n colorDomain={colorDomain as number[]}\r\n setSelectedColor={setSelectedColor}\r\n naColor={noDataColor}\r\n showNAColor={showNAColor}\r\n />\r\n ) : (\r\n <LinearColorLegend\r\n width={fillContainer ? undefined : width}\r\n colorLegendTitle={colorLegendTitle}\r\n colors={\r\n colors || [\r\n Colors[theme].sequentialColors.neutralColorsx09[0],\r\n Colors[theme].sequentialColors.neutralColorsx09[8],\r\n ]\r\n }\r\n colorDomain={colorDomain as number[]}\r\n />\r\n )\r\n ) : null}\r\n <div\r\n className='flex grow flex-col justify-center w-full leading-0'\r\n ref={graphDiv}\r\n aria-label='Graph area'\r\n >\r\n {(width || svgWidth) && (height || svgHeight) ? (\r\n <Graph\r\n data={data}\r\n colorDomain={colorDomain}\r\n width={width || svgWidth}\r\n colors={\r\n colors ||\r\n (typeof colorDomain[0] === 'string'\r\n ? Colors[theme].categoricalColors.colors\r\n : colorDomain.length === 2\r\n ? [\r\n Colors[theme].sequentialColors.neutralColorsx09[0],\r\n Colors[theme].sequentialColors.neutralColorsx09[8],\r\n ]\r\n : Colors[theme].sequentialColors[\r\n `neutralColorsx0${\r\n (colorDomain.length + 1) as 4 | 5 | 6 | 7 | 8 | 9\r\n }`\r\n ])\r\n }\r\n noDataColor={noDataColor}\r\n scaleType={scale}\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 showColumnLabels={showColumnLabels}\r\n leftMargin={leftMargin}\r\n rightMargin={rightMargin}\r\n topMargin={topMargin}\r\n bottomMargin={bottomMargin}\r\n selectedColor={selectedColor}\r\n truncateBy={truncateBy}\r\n showRowLabels={showRowLabels}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n showValues={showValues}\r\n suffix={suffix}\r\n prefix={prefix}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n detailsOnClick={detailsOnClick}\r\n styles={styles}\r\n classNames={classNames}\r\n animate={\r\n animate === true\r\n ? { duration: 0.5, once: true, amount: 0.5 }\r\n : animate || { duration: 0, once: true, amount: 0 }\r\n }\r\n precision={precision}\r\n />\r\n ) : null}\r\n </div>\r\n </>\r\n )}\r\n </div>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n}\r\n"],"names":["Graph","props","data","showColumnLabels","leftMargin","rightMargin","truncateBy","width","height","topMargin","bottomMargin","tooltip","onSeriesMouseOver","suffix","prefix","showValues","colorDomain","colors","noDataColor","scaleType","showRowLabels","selectedColor","onSeriesMouseClick","resetSelectionOnDoubleClick","detailsOnClick","styles","classNames","animate","precision","svgRef","useRef","isInView","useInView","margin","mouseClickData","setMouseClickData","useState","mouseOverData","setMouseOverData","eventX","setEventX","eventY","setEventY","graphWidth","graphHeight","columns","uniqBy","d","rows","y","scaleBand","barHeight","x","barWidth","colorScale","scaleOrdinal","scaleThreshold","scaleLinear","jsxs","Fragment","motion","jsx","i","XAxesLabels","YAxesLabels","el","checkIfNullOrUndefined","color","event","isEqual","cn","getTextColorBasedOnBgColor","Tooltip","Modal","string2HTML","HeatMap","graphTitle","sources","graphDescription","footNote","colorLegendTitle","padding","backgroundColor","relativeHeight","graphID","Colors","showColorScale","graphDownload","dataDownload","fillContainer","language","showNAColor","minHeight","theme","ariaLabel","svgWidth","setSvgWidth","svgHeight","setSvgHeight","setSelectedColor","graphDiv","graphParentDiv","useEffect","resizeObserver","entries","scale","GraphHeader","EmptyState","ColorLegendWithMouseOver","ThresholdColorLegendWithMouseOver","LinearColorLegend","GraphFooter"],"mappings":"wgCAyDO,SAASA,GAAMC,EAAc,CAClC,KAAM,CACJ,KAAAC,EACA,iBAAAC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C,EACA,mBAAAQ,EACA,4BAAAC,GACA,eAAAC,GACA,OAAAC,EACA,WAAAC,EACA,QACEC,IAAY,GACR,CAAE,SAAU,GAAK,KAAM,GAAM,OAAQ,EAAA,EACrCA,GAAW,CAAE,SAAU,EAAG,KAAM,GAAM,OAAQ,CAAA,EAEpD,UAAAC,CAAA,CAAA,EAEA,IAAA,CAAA,CACN,CAAA,CACF,CAAA,CAEJ,EACCiD,GAAWE,EACVlB,EAAAA,kBAAAA,IAACkD,GAAAA,YAAA,CACC,OAAQ,CAAE,SAAUtF,GAAQ,SAAU,OAAQA,GAAQ,MAAA,EACtD,WAAY,CACV,SAAUC,GAAY,SACtB,OAAQA,GAAY,MAAA,EAEtB,QAAAmD,EACA,SAAAE,EACA,MAAAxE,CAAA,CAAA,EAEA,IAAA,CAAA,CACN,CAAA,CAAA,CACF,CAAA,CACF,CAAA,CAGN"}
@@ -0,0 +1,165 @@
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
+ export declare function Histogram(props: Props): JSX.Element;
35
+
36
+ declare interface HistogramDataType {
37
+ value: number;
38
+ data?: object;
39
+ }
40
+
41
+ declare type Languages = 'en' | 'ar' | 'az' | 'bn' | 'cy' | 'he' | 'hi' | 'jp' | 'ka' | 'km' | 'ko' | 'my' | 'ne' | 'zh' | 'custom';
42
+
43
+ declare interface Props {
44
+ /** Array of data objects */
45
+ data: HistogramDataType[];
46
+ /** Type of the graph for histogram */
47
+ graphType?: 'circlePacking' | 'treeMap' | 'barGraph' | 'donutChart';
48
+ /** Title of the graph */
49
+ graphTitle?: string | React.ReactNode;
50
+ /** Description of the graph */
51
+ graphDescription?: string | React.ReactNode;
52
+ /** Footnote for the graph */
53
+ footNote?: string | React.ReactNode;
54
+ /** Source data for the graph */
55
+ sources?: SourcesDataType[];
56
+ /** Accessibility label */
57
+ ariaLabel?: string;
58
+ /** Colors for visualization */
59
+ colors?: string[] | string;
60
+ /** Background color of the graph */
61
+ backgroundColor?: string | boolean;
62
+ /** Custom styles for the graph. Each object should be a valid React CSS style object. */
63
+ styles?: StyleObject;
64
+ /** Custom class names */
65
+ classNames?: ClassNameObject;
66
+ /** Width of the graph */
67
+ width?: number;
68
+ /** Height of the graph */
69
+ height?: number;
70
+ /** Minimum height of the graph */
71
+ minHeight?: number;
72
+ /** Relative height scaling factor. This overwrites the height props */
73
+ relativeHeight?: number;
74
+ /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */
75
+ padding?: string;
76
+ /** Left margin of the graph */
77
+ leftMargin?: number;
78
+ /** Right margin of the graph */
79
+ rightMargin?: number;
80
+ /** Top margin of the graph */
81
+ topMargin?: number;
82
+ /** Bottom margin of the graph */
83
+ bottomMargin?: number;
84
+ /** Padding between bars */
85
+ barPadding?: number;
86
+ /** Maximum thickness of bars */
87
+ maxBarThickness?: number;
88
+ /** Maximum value for the chart */
89
+ maxValue?: number;
90
+ /** Truncate labels by specified length */
91
+ truncateBy?: number;
92
+ /** Reference values for comparison */
93
+ refValues?: ReferenceDataType[];
94
+ /** Number of bins for the histogram */
95
+ numberOfBins?: number;
96
+ /** Orientation of the bar graph. Only applicable if graphType is barGraph. */
97
+ barGraphLayout?: 'vertical' | 'horizontal';
98
+ /** Stroke width of the arcs and circle of the donut. Only applicable if graphType is donutChart. */
99
+ donutStrokeWidth?: number;
100
+ /** Sorting order for data. This is overwritten by labelOrder prop */
101
+ sortData?: 'asc' | 'desc';
102
+ /** Toggle visibility of labels */
103
+ showLabels?: boolean;
104
+ /** Toggle visibility of values */
105
+ showValues?: boolean;
106
+ /** Toggle visibility of axis ticks */
107
+ showTicks?: boolean;
108
+ /** Specifies the number of decimal places to display in the value. */
109
+ precision?: number;
110
+ /** Enable graph download option as png */
111
+ graphDownload?: boolean;
112
+ /** Enable data download option as a csv */
113
+ dataDownload?: boolean;
114
+ /** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */
115
+ tooltip?: string | ((_d: any) => React.ReactNode);
116
+ /** Details displayed on the modal when user clicks of a data point. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */
117
+ detailsOnClick?: string | ((_d: any) => React.ReactNode);
118
+ /** Callback for mouse over event */
119
+ onSeriesMouseOver?: (_d: any) => void;
120
+ /** Callback for mouse click event */
121
+ onSeriesMouseClick?: (_d: any) => void;
122
+ /** Language setting */
123
+ language?: Languages;
124
+ /** Color theme */
125
+ theme?: 'light' | 'dark';
126
+ /** Unique ID for the graph */
127
+ graphID?: string;
128
+ }
129
+
130
+ declare interface ReferenceDataType {
131
+ value: number | null;
132
+ text: string;
133
+ color?: string;
134
+ styles?: {
135
+ line?: React.CSSProperties;
136
+ text?: React.CSSProperties;
137
+ };
138
+ classNames?: {
139
+ line?: string;
140
+ text?: string;
141
+ };
142
+ }
143
+
144
+ declare interface SourcesDataType {
145
+ source: string;
146
+ link?: string;
147
+ }
148
+
149
+ declare interface StyleObject {
150
+ title?: React.CSSProperties;
151
+ footnote?: React.CSSProperties;
152
+ source?: React.CSSProperties;
153
+ description?: React.CSSProperties;
154
+ graphContainer?: React.CSSProperties;
155
+ tooltip?: React.CSSProperties;
156
+ xAxis?: AxesStyleObject;
157
+ yAxis?: AxesStyleObject;
158
+ graphObjectValues?: React.CSSProperties;
159
+ dataConnectors?: React.CSSProperties;
160
+ mouseOverLine?: React.CSSProperties;
161
+ regLine?: React.CSSProperties;
162
+ dataCards?: React.CSSProperties;
163
+ }
164
+
165
+ export { }
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const j=require("./index-BHm2KTjD-D8FylaKc.cjs"),V=require("react"),_=require("./Spinner-UmN-KPe9.cjs"),H=require("./index-CbVeVrla.cjs"),ee=require("./TreeMapGraph.js"),re=require("./DonutChart.js"),te=require("./BarGraph.js"),F=require("./Colors.js"),ie=require("./init-DU0ybBc_.cjs"),P=require("./linear-BVckp9RD.cjs");function ne(o,s){let c=0;for(let a of o)a!=null&&(a=+a)>=a&&++c;return c}function oe(o){return o}var ae=Array.prototype,se=ae.slice;function N(o){return()=>o}function le(o,s,c){let a;for(;;){const e=P.tickIncrement(o,s,c);if(e===a||e===0||!isFinite(e))return[o,s];e>0?(o=Math.floor(o/e)*e,s=Math.ceil(s/e)*e):e<0&&(o=Math.ceil(o*e)/e,s=Math.floor(s*e)/e),a=e}}function ue(o){return Math.max(1,Math.ceil(Math.log(ne(o))/Math.LN2)+1)}function ce(){var o=oe,s=H.extent,c=ue;function a(e){Array.isArray(e)||(e=Array.from(e));var r,m=e.length,l,p,g=new Array(m);for(r=0;r<m;++r)g[r]=o(e[r],r,e);var f=s(g),t=f[0],i=f[1],n=c(g,t,i);if(!Array.isArray(n)){const C=i,y=+n;if(s===H.extent&&([t,i]=le(t,i,y)),n=P.ticks(t,i,y),n[0]<=t&&(p=P.tickIncrement(t,i,y)),n[n.length-1]>=i)if(C>=i&&s===H.extent){const h=P.tickIncrement(t,i,y);isFinite(h)&&(h>0?i=(Math.floor(i/h)+1)*h:h<0&&(i=(Math.ceil(i*-h)+1)/-h))}else n.pop()}for(var u=n.length,x=0,d=u;n[x]<=t;)++x;for(;n[d-1]>i;)--d;(x||d<u)&&(n=n.slice(x,d),u=d-x);var M=new Array(u+1),b;for(r=0;r<=u;++r)b=M[r]=[],b.x0=r>0?n[r-1]:t,b.x1=r<u?n[r]:i;if(isFinite(p)){if(p>0)for(r=0;r<m;++r)(l=g[r])!=null&&t<=l&&l<=i&&M[Math.min(u,Math.floor((l-t)/p))].push(e[r]);else if(p<0){for(r=0;r<m;++r)if((l=g[r])!=null&&t<=l&&l<=i){const C=Math.floor((t-l)*p);M[Math.min(u,C+(n[C]<=l))].push(e[r])}}}else for(r=0;r<m;++r)(l=g[r])!=null&&t<=l&&l<=i&&M[ie.bisectRight(n,l,0,u)].push(e[r]);return M}return a.value=function(e){return arguments.length?(o=typeof e=="function"?e:N(e),a):o},a.domain=function(e){return arguments.length?(s=typeof e=="function"?e:N([e[0],e[1]]),a):s},a.thresholds=function(e){return arguments.length?(c=typeof e=="function"?e:N(Array.isArray(e)?se.call(e):e),a):c},a}function he(o){const{data:s,graphTitle:c,sources:a,graphDescription:e,barPadding:r,showValues:m,showTicks:l,leftMargin:p,rightMargin:g,height:f,width:t,footNote:i,colors:n,padding:u,backgroundColor:x,topMargin:d,bottomMargin:M,showLabels:b,relativeHeight:C,tooltip:y,onSeriesMouseOver:h,refValues:W,graphID:k,maxValue:K,onSeriesMouseClick:q,graphDownload:A,dataDownload:D,numberOfBins:O,truncateBy:U,graphType:I,barGraphLayout:J,donutStrokeWidth:Q,sortData:z,language:E,minHeight:L,theme:w="light",maxBarThickness:X,ariaLabel:R,detailsOnClick:T,styles:$,classNames:G,precision:B}=o,[S,Y]=V.useState([]);return V.useEffect(()=>{const Z=ce().thresholds(O||10).value(v=>v.value)(s).map(v=>({label:`${v.x0}-${v.x1}`,size:v.length,data:{options:`${v.x0}-${v.x1}`,frequency:v.length}}));Y(Z)},[s,O]),S.length===0?j.jsxRuntimeExports.jsx("div",{style:{width:`${t}px`,height:`${f}px`,margin:"auto"},children:j.jsxRuntimeExports.jsx("div",{className:"flex m-auto items-center justify-center p-0 leading-none text-base h-40",children:j.jsxRuntimeExports.jsx(_.SpinnerExports.Spinner,{})})}):I==="circlePacking"?j.jsxRuntimeExports.jsx(H.CirclePackingGraph,{colors:n||F.Colors.graphMainColor,graphTitle:c,graphDescription:e,footNote:i,width:t,height:f,sources:a,leftMargin:p,rightMargin:g,backgroundColor:x,padding:u,topMargin:d,bottomMargin:M,relativeHeight:C,showLabels:b,tooltip:y,onSeriesMouseOver:h,showColorScale:!1,showValues:m,graphID:k,onSeriesMouseClick:q,graphDownload:A,dataDownload:D,data:S,language:E,minHeight:L,theme:w,ariaLabel:R,detailsOnClick:T,styles:$,classNames:G,precision:B}):I==="treeMap"?j.jsxRuntimeExports.jsx(ee.TreeMapGraph,{colors:n||F.Colors.graphMainColor,graphTitle:c,graphDescription:e,footNote:i,width:t,height:f,sources:a,leftMargin:p,rightMargin:g,backgroundColor:x,padding:u,topMargin:d,bottomMargin:M,relativeHeight:C,showLabels:b,tooltip:y,onSeriesMouseOver:h,showColorScale:!1,showValues:m,graphID:k,onSeriesMouseClick:q,graphDownload:A,dataDownload:D,data:S,language:E,minHeight:L,theme:w,ariaLabel:R,detailsOnClick:T,styles:$,classNames:G,precision:B}):I==="donutChart"?j.jsxRuntimeExports.jsx(re.DonutChart,{colors:n||F.Colors[w].categoricalColors.colors,graphTitle:c,graphDescription:e,footNote:i,radius:t&&f?t<f?t:f:t||f||void 0,sources:a,backgroundColor:x,padding:u,tooltip:y,onSeriesMouseOver:h,graphID:k,onSeriesMouseClick:q,graphDownload:A,dataDownload:D,data:S,strokeWidth:Q,showColorScale:!0,sortData:z,language:E,theme:w,ariaLabel:R,detailsOnClick:T,styles:$,classNames:G,precision:B}):j.jsxRuntimeExports.jsx(te.SimpleBarGraph,{colors:n||F.Colors.graphMainColor,graphTitle:c,graphDescription:e,footNote:i,width:t,height:f,sources:a,leftMargin:p,rightMargin:g,backgroundColor:x,padding:u,topMargin:d,bottomMargin:M,relativeHeight:C,showLabels:b,tooltip:y,onSeriesMouseOver:h,showColorScale:!1,showValues:m,graphID:k,onSeriesMouseClick:q,graphDownload:A,dataDownload:D,data:S,barPadding:r,refValues:W,truncateBy:U,maxValue:K,showTicks:l,sortData:z,language:E,minHeight:L,theme:w,maxBarThickness:X,ariaLabel:R,orientation:J,detailsOnClick:T,styles:$,classNames:G,precision:B})}exports.Histogram=he;
2
+ //# sourceMappingURL=Histogram.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Histogram.js","sources":["../node_modules/d3-array/src/count.js","../node_modules/d3-array/src/identity.js","../node_modules/d3-array/src/array.js","../node_modules/d3-array/src/constant.js","../node_modules/d3-array/src/nice.js","../node_modules/d3-array/src/threshold/sturges.js","../node_modules/d3-array/src/bin.js","../src/Components/Graphs/Histogram/index.tsx"],"sourcesContent":["export default function count(values, valueof) {\n let count = 0;\n if (valueof === undefined) {\n for (let value of values) {\n if (value != null && (value = +value) >= value) {\n ++count;\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {\n ++count;\n }\n }\n }\n return count;\n}\n","export default function identity(x) {\n return x;\n}\n","var array = Array.prototype;\n\nexport var slice = array.slice;\nexport var map = array.map;\n","export default function constant(x) {\n return () => x;\n}\n","import {tickIncrement} from \"./ticks.js\";\n\nexport default function nice(start, stop, count) {\n let prestep;\n while (true) {\n const step = tickIncrement(start, stop, count);\n if (step === prestep || step === 0 || !isFinite(step)) {\n return [start, stop];\n } else if (step > 0) {\n start = Math.floor(start / step) * step;\n stop = Math.ceil(stop / step) * step;\n } else if (step < 0) {\n start = Math.ceil(start * step) / step;\n stop = Math.floor(stop * step) / step;\n }\n prestep = step;\n }\n}\n","import count from \"../count.js\";\n\nexport default function thresholdSturges(values) {\n return Math.max(1, Math.ceil(Math.log(count(values)) / Math.LN2) + 1);\n}\n","import {slice} from \"./array.js\";\nimport bisect from \"./bisect.js\";\nimport constant from \"./constant.js\";\nimport extent from \"./extent.js\";\nimport identity from \"./identity.js\";\nimport nice from \"./nice.js\";\nimport ticks, {tickIncrement} from \"./ticks.js\";\nimport sturges from \"./threshold/sturges.js\";\n\nexport default function bin() {\n var value = identity,\n domain = extent,\n threshold = sturges;\n\n function histogram(data) {\n if (!Array.isArray(data)) data = Array.from(data);\n\n var i,\n n = data.length,\n x,\n step,\n values = new Array(n);\n\n for (i = 0; i < n; ++i) {\n values[i] = value(data[i], i, data);\n }\n\n var xz = domain(values),\n x0 = xz[0],\n x1 = xz[1],\n tz = threshold(values, x0, x1);\n\n // Convert number of thresholds into uniform thresholds, and nice the\n // default domain accordingly.\n if (!Array.isArray(tz)) {\n const max = x1, tn = +tz;\n if (domain === extent) [x0, x1] = nice(x0, x1, tn);\n tz = ticks(x0, x1, tn);\n\n // If the domain is aligned with the first tick (which it will by\n // default), then we can use quantization rather than bisection to bin\n // values, which is substantially faster.\n if (tz[0] <= x0) step = tickIncrement(x0, x1, tn);\n\n // If the last threshold is coincident with the domain’s upper bound, the\n // last bin will be zero-width. If the default domain is used, and this\n // last threshold is coincident with the maximum input value, we can\n // extend the niced upper bound by one tick to ensure uniform bin widths;\n // otherwise, we simply remove the last threshold. Note that we don’t\n // coerce values or the domain to numbers, and thus must be careful to\n // compare order (>=) rather than strict equality (===)!\n if (tz[tz.length - 1] >= x1) {\n if (max >= x1 && domain === extent) {\n const step = tickIncrement(x0, x1, tn);\n if (isFinite(step)) {\n if (step > 0) {\n x1 = (Math.floor(x1 / step) + 1) * step;\n } else if (step < 0) {\n x1 = (Math.ceil(x1 * -step) + 1) / -step;\n }\n }\n } else {\n tz.pop();\n }\n }\n }\n\n // Remove any thresholds outside the domain.\n // Be careful not to mutate an array owned by the user!\n var m = tz.length, a = 0, b = m;\n while (tz[a] <= x0) ++a;\n while (tz[b - 1] > x1) --b;\n if (a || b < m) tz = tz.slice(a, b), m = b - a;\n\n var bins = new Array(m + 1),\n bin;\n\n // Initialize bins.\n for (i = 0; i <= m; ++i) {\n bin = bins[i] = [];\n bin.x0 = i > 0 ? tz[i - 1] : x0;\n bin.x1 = i < m ? tz[i] : x1;\n }\n\n // Assign data to bins by value, ignoring any outside the domain.\n if (isFinite(step)) {\n if (step > 0) {\n for (i = 0; i < n; ++i) {\n if ((x = values[i]) != null && x0 <= x && x <= x1) {\n bins[Math.min(m, Math.floor((x - x0) / step))].push(data[i]);\n }\n }\n } else if (step < 0) {\n for (i = 0; i < n; ++i) {\n if ((x = values[i]) != null && x0 <= x && x <= x1) {\n const j = Math.floor((x0 - x) * step);\n bins[Math.min(m, j + (tz[j] <= x))].push(data[i]); // handle off-by-one due to rounding\n }\n }\n }\n } else {\n for (i = 0; i < n; ++i) {\n if ((x = values[i]) != null && x0 <= x && x <= x1) {\n bins[bisect(tz, x, 0, m)].push(data[i]);\n }\n }\n }\n\n return bins;\n }\n\n histogram.value = function(_) {\n return arguments.length ? (value = typeof _ === \"function\" ? _ : constant(_), histogram) : value;\n };\n\n histogram.domain = function(_) {\n return arguments.length ? (domain = typeof _ === \"function\" ? _ : constant([_[0], _[1]]), histogram) : domain;\n };\n\n histogram.thresholds = function(_) {\n return arguments.length ? (threshold = typeof _ === \"function\" ? _ : constant(Array.isArray(_) ? slice.call(_) : _), histogram) : threshold;\n };\n\n return histogram;\n}\n","import { useState, useEffect } from 'react';\r\nimport { bin } from 'd3-array';\r\nimport { Spinner } from '@undp/design-system-react/Spinner';\r\n\r\nimport { CirclePackingGraph } from '../CirclePackingGraph';\r\nimport { TreeMapGraph } from '../TreeMapGraph';\r\nimport { DonutChart } from '../DonutChart';\r\nimport { SimpleBarGraph } from '../BarGraph';\r\n\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport {\r\n TreeMapDataType,\r\n ReferenceDataType,\r\n HistogramDataType,\r\n DonutChartDataType,\r\n SourcesDataType,\r\n Languages,\r\n StyleObject,\r\n ClassNameObject,\r\n} from '@/Types';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: HistogramDataType[];\r\n\r\n /** Type of the graph for histogram */\r\n graphType?: 'circlePacking' | 'treeMap' | 'barGraph' | 'donutChart';\r\n\r\n // Titles, Labels, and Sources\r\n /** Title of the graph */\r\n graphTitle?: string | React.ReactNode;\r\n /** Description of the graph */\r\n graphDescription?: string | React.ReactNode;\r\n /** Footnote for the graph */\r\n footNote?: string | React.ReactNode;\r\n /** Source data for the graph */\r\n sources?: SourcesDataType[];\r\n /** Accessibility label */\r\n ariaLabel?: string;\r\n\r\n // Colors and Styling\r\n /** Colors for visualization */\r\n colors?: string[] | string;\r\n /** Background color of the graph */\r\n backgroundColor?: string | boolean;\r\n /** Custom styles for the graph. Each object should be a valid React CSS style object. */\r\n styles?: StyleObject;\r\n /** Custom class names */\r\n classNames?: ClassNameObject;\r\n\r\n // Size and Spacing\r\n /** Width of the graph */\r\n width?: number;\r\n /** Height of the graph */\r\n height?: number;\r\n /** Minimum height of the graph */\r\n minHeight?: number;\r\n /** Relative height scaling factor. This overwrites the height props */\r\n relativeHeight?: number;\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n /** Left margin of the graph */\r\n leftMargin?: number;\r\n /** Right margin of the graph */\r\n rightMargin?: number;\r\n /** Top margin of the graph */\r\n topMargin?: number;\r\n /** Bottom margin of the graph */\r\n bottomMargin?: number;\r\n /** Padding between bars */\r\n barPadding?: number;\r\n /** Maximum thickness of bars */\r\n maxBarThickness?: number;\r\n\r\n // Values and Ticks\r\n /** Maximum value for the chart */\r\n maxValue?: number;\r\n /** Truncate labels by specified length */\r\n truncateBy?: number;\r\n /** Reference values for comparison */\r\n refValues?: ReferenceDataType[];\r\n\r\n // Graph Parameters\r\n /** Number of bins for the histogram */\r\n numberOfBins?: number;\r\n /** Orientation of the bar graph. Only applicable if graphType is barGraph. */\r\n barGraphLayout?: 'vertical' | 'horizontal';\r\n /** Stroke width of the arcs and circle of the donut. Only applicable if graphType is donutChart. */\r\n donutStrokeWidth?: number;\r\n /** Sorting order for data. This is overwritten by labelOrder prop */\r\n sortData?: 'asc' | 'desc';\r\n /** Toggle visibility of labels */\r\n showLabels?: boolean;\r\n /** Toggle visibility of values */\r\n showValues?: boolean;\r\n /** Toggle visibility of axis ticks */\r\n showTicks?: boolean;\r\n /** Specifies the number of decimal places to display in the value. */\r\n precision?: number;\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n\r\n // Interactions and Callbacks\r\n /** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n /** Details displayed on the modal when user clicks of a data point. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n /** Callback for mouse over event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n /** Callback for mouse click event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n\r\n // Configuration and Options\r\n /** Language setting */\r\n language?: Languages;\r\n /** Color theme */\r\n theme?: 'light' | 'dark';\r\n /** Unique ID for the graph */\r\n graphID?: string;\r\n}\r\n\r\nexport function Histogram(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n sources,\r\n graphDescription,\r\n barPadding,\r\n showValues,\r\n showTicks,\r\n leftMargin,\r\n rightMargin,\r\n height,\r\n width,\r\n footNote,\r\n colors,\r\n padding,\r\n backgroundColor,\r\n topMargin,\r\n bottomMargin,\r\n showLabels,\r\n relativeHeight,\r\n tooltip,\r\n onSeriesMouseOver,\r\n refValues,\r\n graphID,\r\n maxValue,\r\n onSeriesMouseClick,\r\n graphDownload,\r\n dataDownload,\r\n numberOfBins,\r\n truncateBy,\r\n graphType,\r\n barGraphLayout,\r\n donutStrokeWidth,\r\n sortData,\r\n language,\r\n minHeight,\r\n theme = 'light',\r\n maxBarThickness,\r\n ariaLabel,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n precision,\r\n } = props;\r\n\r\n const [dataFormatted, setDataFormatted] = useState<TreeMapDataType[]>([]);\r\n useEffect(() => {\r\n const bins = bin()\r\n .thresholds(numberOfBins || 10)\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n .value((d: any) => d.value)(data as any);\r\n const dataUpdates = bins.map(d => ({\r\n label: `${d.x0}-${d.x1}`,\r\n size: d.length,\r\n data: {\r\n options: `${d.x0}-${d.x1}`,\r\n frequency: d.length,\r\n },\r\n }));\r\n setDataFormatted(dataUpdates);\r\n }, [data, numberOfBins]);\r\n if (dataFormatted.length === 0)\r\n return (\r\n <div style={{ width: `${width}px`, height: `${height}px`, margin: 'auto' }}>\r\n <div className='flex m-auto items-center justify-center p-0 leading-none text-base h-40'>\r\n <Spinner />\r\n </div>\r\n </div>\r\n );\r\n if (graphType === 'circlePacking')\r\n return (\r\n <CirclePackingGraph\r\n colors={colors || Colors.graphMainColor}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n footNote={footNote}\r\n width={width}\r\n height={height}\r\n sources={sources}\r\n leftMargin={leftMargin}\r\n rightMargin={rightMargin}\r\n backgroundColor={backgroundColor}\r\n padding={padding}\r\n topMargin={topMargin}\r\n bottomMargin={bottomMargin}\r\n relativeHeight={relativeHeight}\r\n showLabels={showLabels}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n showColorScale={false}\r\n showValues={showValues}\r\n graphID={graphID}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n graphDownload={graphDownload}\r\n dataDownload={dataDownload}\r\n data={dataFormatted}\r\n language={language}\r\n minHeight={minHeight}\r\n theme={theme}\r\n ariaLabel={ariaLabel}\r\n detailsOnClick={detailsOnClick}\r\n styles={styles}\r\n classNames={classNames}\r\n precision={precision}\r\n />\r\n );\r\n if (graphType === 'treeMap')\r\n return (\r\n <TreeMapGraph\r\n colors={colors || Colors.graphMainColor}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n footNote={footNote}\r\n width={width}\r\n height={height}\r\n sources={sources}\r\n leftMargin={leftMargin}\r\n rightMargin={rightMargin}\r\n backgroundColor={backgroundColor}\r\n padding={padding}\r\n topMargin={topMargin}\r\n bottomMargin={bottomMargin}\r\n relativeHeight={relativeHeight}\r\n showLabels={showLabels}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n showColorScale={false}\r\n showValues={showValues}\r\n graphID={graphID}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n graphDownload={graphDownload}\r\n dataDownload={dataDownload}\r\n data={dataFormatted}\r\n language={language}\r\n minHeight={minHeight}\r\n theme={theme}\r\n ariaLabel={ariaLabel}\r\n detailsOnClick={detailsOnClick}\r\n styles={styles}\r\n classNames={classNames}\r\n precision={precision}\r\n />\r\n );\r\n if (graphType === 'donutChart')\r\n return (\r\n <DonutChart\r\n colors={(colors as string[] | undefined) || Colors[theme].categoricalColors.colors}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n footNote={footNote}\r\n radius={width && height ? (width < height ? width : height) : width || height || undefined}\r\n sources={sources}\r\n backgroundColor={backgroundColor}\r\n padding={padding}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n graphID={graphID}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n graphDownload={graphDownload}\r\n dataDownload={dataDownload}\r\n data={dataFormatted as DonutChartDataType[]}\r\n strokeWidth={donutStrokeWidth}\r\n showColorScale\r\n sortData={sortData}\r\n language={language}\r\n theme={theme}\r\n ariaLabel={ariaLabel}\r\n detailsOnClick={detailsOnClick}\r\n styles={styles}\r\n classNames={classNames}\r\n precision={precision}\r\n />\r\n );\r\n return (\r\n <SimpleBarGraph\r\n colors={colors || Colors.graphMainColor}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n footNote={footNote}\r\n width={width}\r\n height={height}\r\n sources={sources}\r\n leftMargin={leftMargin}\r\n rightMargin={rightMargin}\r\n backgroundColor={backgroundColor}\r\n padding={padding}\r\n topMargin={topMargin}\r\n bottomMargin={bottomMargin}\r\n relativeHeight={relativeHeight}\r\n showLabels={showLabels}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n showColorScale={false}\r\n showValues={showValues}\r\n graphID={graphID}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n graphDownload={graphDownload}\r\n dataDownload={dataDownload}\r\n data={dataFormatted}\r\n barPadding={barPadding}\r\n refValues={refValues}\r\n truncateBy={truncateBy}\r\n maxValue={maxValue}\r\n showTicks={showTicks}\r\n sortData={sortData}\r\n language={language}\r\n minHeight={minHeight}\r\n theme={theme}\r\n maxBarThickness={maxBarThickness}\r\n ariaLabel={ariaLabel}\r\n orientation={barGraphLayout}\r\n detailsOnClick={detailsOnClick}\r\n styles={styles}\r\n classNames={classNames}\r\n precision={precision}\r\n />\r\n );\r\n}\r\n"],"names":["count","values","valueof","value","identity","x","array","slice","constant","nice","start","stop","prestep","step","tickIncrement","thresholdSturges","bin","domain","extent","threshold","sturges","histogram","data","i","n","xz","x0","x1","tz","max","tn","ticks","m","a","b","bins","j","bisect","_","Histogram","props","graphTitle","sources","graphDescription","barPadding","showValues","showTicks","leftMargin","rightMargin","height","width","footNote","colors","padding","backgroundColor","topMargin","bottomMargin","showLabels","relativeHeight","tooltip","onSeriesMouseOver","refValues","graphID","maxValue","onSeriesMouseClick","graphDownload","dataDownload","numberOfBins","truncateBy","graphType","barGraphLayout","donutStrokeWidth","sortData","language","minHeight","theme","maxBarThickness","ariaLabel","detailsOnClick","styles","classNames","precision","dataFormatted","setDataFormatted","useState","useEffect","dataUpdates","d","jsx","Spinner","CirclePackingGraph","Colors","TreeMapGraph","DonutChart","Simple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C,GAAmCuC,EAAAA,OAAOhB,CAAK,EAAE,kBAAkB,OAC5E,WAAAlC,EACA,iBAAAE,EACA,SAAAQ,EACA,OAAQD,GAASD,EAAUC,EAAQD,EAASC,EAAQD,EAAUC,GAASD,GAAU,OACjF,QAAAP,EACA,gBAAAY,EACA,QAAAD,EACA,QAAAM,EACA,kBAAAC,EACA,QAAAE,EACA,mBAAAE,EACA,cAAAC,EACA,aAAAC,EACA,KAAMgB,EACN,YAAaX,EACb,eAAc,GACd,SAAAC,EACA,SAAAC,EACA,MAAAE,EACA,UAAAE,EACA,eAAAC,EACA,OAAAC,EACA,WAAAC,EACA,UAAAC,CAAA,CAAA,EAIJO,EAAAA,kBAAAA,IAACM,GAAAA,eAAA,CACC,OAAQ1C,GAAUuC,EAAAA,OAAO,eACzB,WAAAlD,EACA,iBAAAE,EACA,SAAAQ,EACA,MAAAD,EACA,OAAAD,EACA,QAAAP,EACA,WAAAK,EACA,YAAAC,EACA,gBAAAM,EACA,QAAAD,EACA,UAAAE,EACA,aAAAC,EACA,eAAAE,EACA,WAAAD,EACA,QAAAE,EACA,kBAAAC,EACA,eAAgB,GAChB,WAAAf,EACA,QAAAiB,EACA,mBAAAE,EACA,cAAAC,EACA,aAAAC,EACA,KAAMgB,EACN,WAAAtC,EACA,UAAAiB,EACA,WAAAO,EACA,SAAAL,EACA,UAAAjB,EACA,SAAA0B,EACA,SAAAC,EACA,UAAAC,EACA,MAAAC,EACA,gBAAAC,EACA,UAAAC,EACA,YAAaP,EACb,eAAAQ,EACA,OAAAC,EACA,WAAAC,EACA,UAAAC,CAAA,CAAA,CAGN","x_google_ignoreList":[0,1,2,3,4,5,6]}
@@ -0,0 +1,15 @@
1
+ import { JSX } from 'react';
2
+ import { JSX as JSX_2 } from 'react/jsx-runtime';
3
+
4
+ export declare function ImageDownloadButton(props: Props): JSX_2.Element;
5
+
6
+ declare interface Props {
7
+ buttonContent?: string | JSX.Element;
8
+ buttonType?: 'primary' | 'primary-without-icon' | 'secondary' | 'secondary-without-icon' | 'tertiary';
9
+ nodeID: string | HTMLElement;
10
+ filename?: string;
11
+ buttonSmall?: boolean;
12
+ className?: string;
13
+ }
14
+
15
+ export { }
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-BHm2KTjD-D8FylaKc.cjs"),n=require("./index-CEc_9zWy.cjs"),r=require("./imageDownload.js");function s(a){const{nodeID:e,filename:t="image",buttonContent:i,buttonType:l="tertiary",buttonSmall:d,className:m=""}=a;return o.jsxRuntimeExports.jsx(n.ButtonExports.Button,{variant:l,className:`undp-viz-download-button ${d?"p-2":"py-4 px-6"} ${m} border border-primary-gray-400 dark:border-primary-gray-550`,onClick:()=>{typeof e=="string"?document.getElementById(e)?r.imageDownload(document.getElementById(e),t):console.error("Cannot find the html element"):r.imageDownload(e,t)},"aria-label":"Click to download the graph as image",children:i||o.jsxRuntimeExports.jsx(n.ImageDown,{})})}exports.ImageDownloadButton=s;
2
+ //# sourceMappingURL=ImageDownloadButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ImageDownloadButton.js","sources":["../src/Components/Actions/ImageDownloadButton.tsx"],"sourcesContent":["import { JSX } from 'react';\r\nimport { Button } from '@undp/design-system-react/Button';\r\n\r\nimport { imageDownload } from '@/Utils/imageDownload';\r\nimport { ImageDown } from '@/Components/Icons';\r\n\r\ninterface Props {\r\n buttonContent?: string | JSX.Element;\r\n buttonType?:\r\n | 'primary'\r\n | 'primary-without-icon'\r\n | 'secondary'\r\n | 'secondary-without-icon'\r\n | 'tertiary';\r\n nodeID: string | HTMLElement;\r\n filename?: string;\r\n buttonSmall?: boolean;\r\n className?: string;\r\n}\r\n\r\nexport function ImageDownloadButton(props: Props) {\r\n const {\r\n nodeID,\r\n filename = 'image',\r\n buttonContent,\r\n buttonType = 'tertiary',\r\n buttonSmall,\r\n className = '',\r\n } = props;\r\n return (\r\n <Button\r\n variant={buttonType}\r\n className={`undp-viz-download-button ${\r\n buttonSmall ? 'p-2' : 'py-4 px-6'\r\n } ${className} border border-primary-gray-400 dark:border-primary-gray-550`}\r\n onClick={() => {\r\n if (typeof nodeID === 'string') {\r\n if (document.getElementById(nodeID)) {\r\n imageDownload(document.getElementById(nodeID) as HTMLElement, filename);\r\n } else {\r\n console.error('Cannot find the html element');\r\n }\r\n } else {\r\n imageDownload(nodeID as HTMLElement, filename);\r\n }\r\n }}\r\n aria-label='Click to download the graph as image'\r\n >\r\n {buttonContent || <ImageDown />}\r\n </Button>\r\n );\r\n}\r\n"],"names":["ImageDownloadButton","props","nodeID","filename","buttonContent","buttonType","buttonSmall","className","jsx","Button","imageDownload","ImageDown"],"mappings":"mMAoBO,SAASA,EAAoBC,EAAc,CAChD,KAAM,CACJ,OAAAC,EACA,SAAAC,EAAW,QACX,cAAAC,EACA,WAAAC,EAAa,WACb,YAAAC,EACA,UAAAC,EAAY,EAAA,EACVN,EACJ,OACEO,EAAAA,kBAAAA,IAACC,EAAAA,cAAAA,OAAA,CACC,QAASJ,EACT,UAAW,4BACTC,EAAc,MAAQ,WACxB,IAAIC,CAAS,+DACb,QAAS,IAAM,CACT,OAAOL,GAAW,SAChB,SAAS,eAAeA,CAAM,EAChCQ,EAAAA,cAAc,SAAS,eAAeR,CAAM,EAAkBC,CAAQ,EAEtE,QAAQ,MAAM,8BAA8B,EAG9CO,EAAAA,cAAcR,EAAuBC,CAAQ,CAEjD,EACA,aAAW,uCAEV,SAAAC,2BAAkBO,EAAAA,UAAA,CAAA,CAAU,CAAA,CAAA,CAGnC"}