@undp/data-viz 1.4.16 → 1.5.1

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 (225) hide show
  1. package/dist/AreaChart.cjs +1 -1
  2. package/dist/AreaChart.js +3 -3
  3. package/dist/BarGraph.cjs +1 -1
  4. package/dist/BarGraph.js +8 -8
  5. package/dist/BeeSwarmChart.cjs +1 -1
  6. package/dist/BeeSwarmChart.js +5 -5
  7. package/dist/BiVariateChoroplethMap.cjs +1 -1
  8. package/dist/BiVariateChoroplethMap.cjs.map +1 -1
  9. package/dist/BiVariateChoroplethMap.js +35 -34
  10. package/dist/BiVariateChoroplethMap.js.map +1 -1
  11. package/dist/BulletChart.cjs +1 -1
  12. package/dist/BulletChart.js +5 -5
  13. package/dist/ButterflyChart.cjs +1 -1
  14. package/dist/ButterflyChart.js +5 -5
  15. package/dist/ChoroplethMap.cjs +1 -1
  16. package/dist/ChoroplethMap.cjs.map +1 -1
  17. package/dist/ChoroplethMap.js +52 -51
  18. package/dist/ChoroplethMap.js.map +1 -1
  19. package/dist/CirclePackingGraph.cjs +1 -1
  20. package/dist/CirclePackingGraph.js +3 -3
  21. package/dist/DataCards.cjs +1 -1
  22. package/dist/DataCards.js +5 -5
  23. package/dist/DataTable.cjs +1 -1
  24. package/dist/DataTable.js +3 -3
  25. package/dist/DifferenceLineChart.cjs +1 -1
  26. package/dist/DifferenceLineChart.js +2 -2
  27. package/dist/DonutChart.cjs +1 -1
  28. package/dist/DonutChart.js +4 -4
  29. package/dist/DotDensityMap.cjs +1 -1
  30. package/dist/DotDensityMap.cjs.map +1 -1
  31. package/dist/DotDensityMap.js +39 -38
  32. package/dist/DotDensityMap.js.map +1 -1
  33. package/dist/DualAxisLineChart.cjs +1 -1
  34. package/dist/DualAxisLineChart.js +2 -2
  35. package/dist/DumbbellChart.cjs +1 -1
  36. package/dist/DumbbellChart.js +6 -6
  37. package/dist/GeoHubCompareMaps.cjs +1 -1
  38. package/dist/GeoHubCompareMaps.js +1 -1
  39. package/dist/GeoHubMap.cjs +1 -1
  40. package/dist/GeoHubMap.js +3 -3
  41. package/dist/GeoHubMapWithLayerSelection.cjs +1 -1
  42. package/dist/GeoHubMapWithLayerSelection.js +4 -4
  43. package/dist/{GraphEl-Bz2jatkM.cjs → GraphEl-4RUlclvW.cjs} +2 -2
  44. package/dist/{GraphEl-Bz2jatkM.cjs.map → GraphEl-4RUlclvW.cjs.map} +1 -1
  45. package/dist/{GraphEl-zNOHBYrK.js → GraphEl-ClIxlWa3.js} +2 -2
  46. package/dist/{GraphEl-zNOHBYrK.js.map → GraphEl-ClIxlWa3.js.map} +1 -1
  47. package/dist/GriddedGraphs.cjs +1 -1
  48. package/dist/GriddedGraphs.d.ts +58 -1
  49. package/dist/GriddedGraphs.js +7 -7
  50. package/dist/GriddedGraphsFromConfig.cjs +1 -1
  51. package/dist/GriddedGraphsFromConfig.d.ts +58 -1
  52. package/dist/GriddedGraphsFromConfig.js +1 -1
  53. package/dist/HeatMap.cjs +1 -1
  54. package/dist/HeatMap.js +4 -4
  55. package/dist/Histogram.cjs +1 -1
  56. package/dist/Histogram.js +1 -1
  57. package/dist/LineChartWithConfidenceInterval.cjs +1 -1
  58. package/dist/LineChartWithConfidenceInterval.js +2 -2
  59. package/dist/MultiGraphDashboard.cjs +1 -1
  60. package/dist/MultiGraphDashboard.d.ts +58 -1
  61. package/dist/MultiGraphDashboard.js +5 -5
  62. package/dist/MultiGraphDashboardFromConfig.cjs +1 -1
  63. package/dist/MultiGraphDashboardFromConfig.d.ts +58 -1
  64. package/dist/MultiGraphDashboardFromConfig.js +1 -1
  65. package/dist/MultiGraphDashboardWideToLongFormat.cjs +1 -1
  66. package/dist/MultiGraphDashboardWideToLongFormat.js +2 -2
  67. package/dist/MultiGraphDashboardWideToLongFormatFromConfig.cjs +1 -1
  68. package/dist/MultiGraphDashboardWideToLongFormatFromConfig.js +1 -1
  69. package/dist/MultiLineAltChart.cjs +1 -1
  70. package/dist/MultiLineAltChart.js +3 -3
  71. package/dist/MultiLineChart.cjs +1 -1
  72. package/dist/MultiLineChart.js +2 -2
  73. package/dist/ParetoChart.cjs +1 -1
  74. package/dist/ParetoChart.js +3 -3
  75. package/dist/PerformanceIntensiveMultiGraphDashboard.cjs +1 -1
  76. package/dist/PerformanceIntensiveMultiGraphDashboard.d.ts +58 -1
  77. package/dist/PerformanceIntensiveMultiGraphDashboard.js +5 -5
  78. package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.cjs +1 -1
  79. package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.d.ts +58 -1
  80. package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.js +1 -1
  81. package/dist/PerformanceIntensiveScrollStory.d.ts +58 -1
  82. package/dist/RadarChart.cjs +1 -1
  83. package/dist/RadarChart.js +4 -4
  84. package/dist/SankeyChart.cjs +1 -1
  85. package/dist/SankeyChart.js +6 -6
  86. package/dist/ScatterPlot.cjs +1 -1
  87. package/dist/ScatterPlot.js +6 -6
  88. package/dist/ScrollStory.d.ts +58 -1
  89. package/dist/SimpleLineChart.cjs +1 -1
  90. package/dist/SimpleLineChart.js +2 -2
  91. package/dist/SingleGraphDashboard.cjs +1 -1
  92. package/dist/SingleGraphDashboard.d.ts +58 -1
  93. package/dist/SingleGraphDashboard.js +8 -8
  94. package/dist/SingleGraphDashboardFromConfig.cjs +1 -1
  95. package/dist/SingleGraphDashboardFromConfig.d.ts +58 -1
  96. package/dist/SingleGraphDashboardFromConfig.js +1 -1
  97. package/dist/SingleGraphDashboardGeoHubMaps.d.ts +58 -1
  98. package/dist/SingleGraphDashboardGeoHubMapsFromConfig.cjs +1 -1
  99. package/dist/SingleGraphDashboardGeoHubMapsFromConfig.d.ts +58 -1
  100. package/dist/SingleGraphDashboardGeoHubMapsFromConfig.js +1 -1
  101. package/dist/SingleGraphDashboardThreeDGraphs.cjs +1 -1
  102. package/dist/SingleGraphDashboardThreeDGraphs.cjs.map +1 -1
  103. package/dist/SingleGraphDashboardThreeDGraphs.d.ts +58 -1
  104. package/dist/SingleGraphDashboardThreeDGraphs.js +20 -19
  105. package/dist/SingleGraphDashboardThreeDGraphs.js.map +1 -1
  106. package/dist/SingleGraphDashboardThreeDGraphsFromConfig.cjs +1 -1
  107. package/dist/SingleGraphDashboardThreeDGraphsFromConfig.d.ts +58 -1
  108. package/dist/SingleGraphDashboardThreeDGraphsFromConfig.js +1 -1
  109. package/dist/SlopeChart.cjs +1 -1
  110. package/dist/SlopeChart.js +4 -4
  111. package/dist/SparkLine.cjs +1 -1
  112. package/dist/SparkLine.js +2 -2
  113. package/dist/StatCardFromData.cjs +1 -1
  114. package/dist/StatCardFromData.js +1 -1
  115. package/dist/StripChart.cjs +1 -1
  116. package/dist/StripChart.js +5 -5
  117. package/dist/ThreeDGlobe.cjs +1 -1
  118. package/dist/ThreeDGlobe.cjs.map +1 -1
  119. package/dist/ThreeDGlobe.d.ts +61 -6
  120. package/dist/ThreeDGlobe.js +385 -314
  121. package/dist/ThreeDGlobe.js.map +1 -1
  122. package/dist/{Tooltip-DyM5snqx.js → Tooltip-CVCGWyzw.js} +2 -2
  123. package/dist/{Tooltip-DyM5snqx.js.map → Tooltip-CVCGWyzw.js.map} +1 -1
  124. package/dist/{Tooltip-n8z5bfav.cjs → Tooltip-De16GWhY.cjs} +2 -2
  125. package/dist/{Tooltip-n8z5bfav.cjs.map → Tooltip-De16GWhY.cjs.map} +1 -1
  126. package/dist/TreeMapGraph.cjs +1 -1
  127. package/dist/TreeMapGraph.js +3 -3
  128. package/dist/Types.d.ts +58 -1
  129. package/dist/UnitChart.cjs +1 -1
  130. package/dist/UnitChart.js +1 -1
  131. package/dist/_commonjsHelpers-BH3jXuIh.cjs +2 -0
  132. package/dist/_commonjsHelpers-BH3jXuIh.cjs.map +1 -0
  133. package/dist/_commonjsHelpers-ByX85dGu.js +34 -0
  134. package/dist/_commonjsHelpers-ByX85dGu.js.map +1 -0
  135. package/dist/{ensureCompleteData-BBDZbDCE.js → ensureCompleteData-BALdOrsS.js} +2 -2
  136. package/dist/{ensureCompleteData-BBDZbDCE.js.map → ensureCompleteData-BALdOrsS.js.map} +1 -1
  137. package/dist/{ensureCompleteData-DqWQ2Zbi.cjs → ensureCompleteData-BU5Zlccy.cjs} +2 -2
  138. package/dist/{ensureCompleteData-DqWQ2Zbi.cjs.map → ensureCompleteData-BU5Zlccy.cjs.map} +1 -1
  139. package/dist/{fetchAndParseData-4gsYTy6_.js → fetchAndParseData-DBOl1Icl.js} +2 -2
  140. package/dist/{fetchAndParseData-4gsYTy6_.js.map → fetchAndParseData-DBOl1Icl.js.map} +1 -1
  141. package/dist/{fetchAndParseData-CQyVGCul.cjs → fetchAndParseData-Dcy7AS_0.cjs} +2 -2
  142. package/dist/{fetchAndParseData-CQyVGCul.cjs.map → fetchAndParseData-Dcy7AS_0.cjs.map} +1 -1
  143. package/dist/fetchAndParseData.cjs +1 -1
  144. package/dist/fetchAndParseData.js +1 -1
  145. package/dist/{filterData-B8ocT57s.js → filterData-9nEcQ-Jp.js} +3 -3
  146. package/dist/{filterData-B8ocT57s.js.map → filterData-9nEcQ-Jp.js.map} +1 -1
  147. package/dist/{filterData-DN6py7y_.cjs → filterData-BoYadk0l.cjs} +2 -2
  148. package/dist/{filterData-DN6py7y_.cjs.map → filterData-BoYadk0l.cjs.map} +1 -1
  149. package/dist/{getJenks-VhM3GIoC.js → getJenks-DW96UYNE.js} +2 -2
  150. package/dist/{getJenks-VhM3GIoC.js.map → getJenks-DW96UYNE.js.map} +1 -1
  151. package/dist/{getJenks-TWQvbuOz.cjs → getJenks-vofIZmeb.cjs} +2 -2
  152. package/dist/{getJenks-TWQvbuOz.cjs.map → getJenks-vofIZmeb.cjs.map} +1 -1
  153. package/dist/{getUniqValue-CHqgSss5.cjs → getUniqValue-CfuE_l9c.cjs} +2 -2
  154. package/dist/{getUniqValue-CHqgSss5.cjs.map → getUniqValue-CfuE_l9c.cjs.map} +1 -1
  155. package/dist/{getUniqValue-BtUENB2H.js → getUniqValue-CttuU_wn.js} +4 -4
  156. package/dist/{getUniqValue-BtUENB2H.js.map → getUniqValue-CttuU_wn.js.map} +1 -1
  157. package/dist/{index-CaAIPGZo.js → index-AqnpA7_O.js} +2 -2
  158. package/dist/{index-CaAIPGZo.js.map → index-AqnpA7_O.js.map} +1 -1
  159. package/dist/{index-CZbIGs8q.cjs → index-BJOeaYTk.cjs} +2 -2
  160. package/dist/{index-CZbIGs8q.cjs.map → index-BJOeaYTk.cjs.map} +1 -1
  161. package/dist/{index-Bc5VF70V.js → index-BMgDMxKJ.js} +6 -6
  162. package/dist/{index-Bc5VF70V.js.map → index-BMgDMxKJ.js.map} +1 -1
  163. package/dist/{index-B0rbzOoC.cjs → index-BS2TADPj.cjs} +2 -2
  164. package/dist/{index-B0rbzOoC.cjs.map → index-BS2TADPj.cjs.map} +1 -1
  165. package/dist/{index-27yTRcko.js → index-Bwrro8-q.js} +2 -2
  166. package/dist/{index-27yTRcko.js.map → index-Bwrro8-q.js.map} +1 -1
  167. package/dist/{index-BczVvEBZ.cjs → index-CQ3e6Ewi.cjs} +2 -2
  168. package/dist/{index-BczVvEBZ.cjs.map → index-CQ3e6Ewi.cjs.map} +1 -1
  169. package/dist/{index-C21TvELx.cjs → index-CSNtgibC.cjs} +2 -2
  170. package/dist/{index-C21TvELx.cjs.map → index-CSNtgibC.cjs.map} +1 -1
  171. package/dist/{index-D7ltPi18.js → index-CeVNqhMO.js} +2 -2
  172. package/dist/{index-D7ltPi18.js.map → index-CeVNqhMO.js.map} +1 -1
  173. package/dist/index-D05lK1Te.cjs +2 -0
  174. package/dist/index-D05lK1Te.cjs.map +1 -0
  175. package/dist/{index-Ds0uHjK9.cjs → index-D72cOtq7.cjs} +2 -2
  176. package/dist/{index-Ds0uHjK9.cjs.map → index-D72cOtq7.cjs.map} +1 -1
  177. package/dist/{index-BXns0-ng.cjs → index-DQA8q5sC.cjs} +2 -2
  178. package/dist/{index-BXns0-ng.cjs.map → index-DQA8q5sC.cjs.map} +1 -1
  179. package/dist/{index-BzeLQvXk.cjs → index-DYH8g9WA.cjs} +2 -2
  180. package/dist/{index-BzeLQvXk.cjs.map → index-DYH8g9WA.cjs.map} +1 -1
  181. package/dist/{index-BbNoLJ_w.cjs → index-Da2GUKrr.cjs} +2 -2
  182. package/dist/{index-BbNoLJ_w.cjs.map → index-Da2GUKrr.cjs.map} +1 -1
  183. package/dist/{index-BLizQDlg.js → index-DvVprvy6.js} +2 -2
  184. package/dist/{index-BLizQDlg.js.map → index-DvVprvy6.js.map} +1 -1
  185. package/dist/{index-UV9hjG_S.js → index-EArKRVKg.js} +2 -2
  186. package/dist/{index-UV9hjG_S.js.map → index-EArKRVKg.js.map} +1 -1
  187. package/dist/{index-C1rRk_50.js → index-V_JXij1_.js} +2 -2
  188. package/dist/{index-C1rRk_50.js.map → index-V_JXij1_.js.map} +1 -1
  189. package/dist/{index-DxagiOHo.js → index-fwdktvAS.js} +2 -2
  190. package/dist/{index-DxagiOHo.js.map → index-fwdktvAS.js.map} +1 -1
  191. package/dist/index-qfWCwobm.js +682 -0
  192. package/dist/index-qfWCwobm.js.map +1 -0
  193. package/dist/index.cjs +1 -1
  194. package/dist/index.d.ts +63 -7
  195. package/dist/index.js +6 -6
  196. package/dist/{string2HTML-CWHGfz_d.js → string2HTML-oFCROsus.js} +2 -2
  197. package/dist/{string2HTML-CWHGfz_d.js.map → string2HTML-oFCROsus.js.map} +1 -1
  198. package/dist/{string2HTML-D2Avudmb.cjs → string2HTML-z7CwHXcx.cjs} +2 -2
  199. package/dist/{string2HTML-D2Avudmb.cjs.map → string2HTML-z7CwHXcx.cjs.map} +1 -1
  200. package/dist/style.css +1 -1
  201. package/dist/transformData.cjs +1 -1
  202. package/dist/transformData.js +3 -3
  203. package/dist/{transformDataForAggregation-CdcwlnNe.js → transformDataForAggregation-1BYVFqvF.js} +4 -4
  204. package/dist/{transformDataForAggregation-CdcwlnNe.js.map → transformDataForAggregation-1BYVFqvF.js.map} +1 -1
  205. package/dist/{transformDataForAggregation-Du-Hei-W.cjs → transformDataForAggregation-BVxVu4yY.cjs} +2 -2
  206. package/dist/{transformDataForAggregation-Du-Hei-W.cjs.map → transformDataForAggregation-BVxVu4yY.cjs.map} +1 -1
  207. package/dist/{transformDataForGraphFromFile-BCjsizvb.js → transformDataForGraphFromFile-BC9Ha8hF.js} +3 -3
  208. package/dist/{transformDataForGraphFromFile-BCjsizvb.js.map → transformDataForGraphFromFile-BC9Ha8hF.js.map} +1 -1
  209. package/dist/{transformDataForGraphFromFile-B1A0AS-Z.cjs → transformDataForGraphFromFile-b41aNQYY.cjs} +2 -2
  210. package/dist/{transformDataForGraphFromFile-B1A0AS-Z.cjs.map → transformDataForGraphFromFile-b41aNQYY.cjs.map} +1 -1
  211. package/dist/utils.cjs +1 -1
  212. package/dist/utils.js +2 -2
  213. package/dist/zoom-Bsbhil-K.cjs +2 -0
  214. package/dist/zoom-Bsbhil-K.cjs.map +1 -0
  215. package/dist/zoom-DAu91HKr.js +1864 -0
  216. package/dist/zoom-DAu91HKr.js.map +1 -0
  217. package/package.json +3 -3
  218. package/dist/_commonjsHelpers-DKOUU3wS.cjs +0 -2
  219. package/dist/_commonjsHelpers-DKOUU3wS.cjs.map +0 -1
  220. package/dist/_commonjsHelpers-DaMA6jEr.js +0 -9
  221. package/dist/_commonjsHelpers-DaMA6jEr.js.map +0 -1
  222. package/dist/zoom-Lo7IAUfC.cjs +0 -2
  223. package/dist/zoom-Lo7IAUfC.cjs.map +0 -1
  224. package/dist/zoom-_lqdiGoI.js +0 -1983
  225. package/dist/zoom-_lqdiGoI.js.map +0 -1
@@ -27,6 +27,10 @@ declare interface AggregationSettingsDataType {
27
27
  aggregationMethod?: 'sum' | 'average' | 'min' | 'max';
28
28
  }
29
29
 
30
+ declare interface AmbientLightConfig extends BaseLightConfig {
31
+ type: 'ambient';
32
+ }
33
+
30
34
  declare interface AnimateDataType {
31
35
  duration: number;
32
36
  once: boolean;
@@ -69,6 +73,12 @@ declare interface AxesStyleObject {
69
73
  axis?: React.CSSProperties;
70
74
  }
71
75
 
76
+ declare interface BaseLightConfig {
77
+ type: string;
78
+ color: number;
79
+ intensity: number;
80
+ }
81
+
72
82
  declare interface ClassNameObject {
73
83
  title?: string;
74
84
  footnote?: string;
@@ -187,6 +197,14 @@ declare interface DataTableColumnDataType {
187
197
  columnWidth?: number;
188
198
  }
189
199
 
200
+ declare interface DirectionalLightConfig extends BaseLightConfig {
201
+ type: 'directional';
202
+ target?: Position;
203
+ castShadow?: boolean;
204
+ shadow?: ShadowConfig;
205
+ position?: Position | 'camera';
206
+ }
207
+
190
208
  declare interface FileSettingsDataType {
191
209
  dataURL: string;
192
210
  idColumnName: string;
@@ -462,9 +480,10 @@ declare interface GraphSettingsDataType {
462
480
  polygonAltitude?: number;
463
481
  atmosphereAltitude?: number;
464
482
  globeCurvatureResolution?: number;
465
- lightColor?: string;
483
+ lights?: LightConfig[];
466
484
  fogSetting?: FogDataType;
467
485
  showAxisLabels?: boolean;
486
+ highlightedAltitude?: number;
468
487
  }
469
488
 
470
489
  declare type GraphType = GraphTypeForGriddedGraph;
@@ -489,6 +508,8 @@ declare interface HighlightAreaSettingsForScatterPlotDataType {
489
508
 
490
509
  declare type Languages = 'en' | 'ar' | 'az' | 'bn' | 'cy' | 'he' | 'hi' | 'jp' | 'ka' | 'km' | 'ko' | 'my' | 'ne' | 'zh' | 'custom';
491
510
 
511
+ declare type LightConfig = AmbientLightConfig | DirectionalLightConfig | PointLightConfig | SpotLightConfig;
512
+
492
513
  declare interface MapLegendDataType {
493
514
  mapStyleName: string;
494
515
  legend: string | React.ReactNode;
@@ -498,6 +519,19 @@ declare type MapProjectionTypes = 'mercator' | 'equalEarth' | 'naturalEarth' | '
498
519
 
499
520
  export declare function MultiGraphDashboard(props: Props): JSX.Element;
500
521
 
522
+ declare interface PointLightConfig extends BaseLightConfig {
523
+ type: 'point';
524
+ distance?: number;
525
+ decay?: number;
526
+ position?: Position | 'camera';
527
+ }
528
+
529
+ declare interface Position {
530
+ x: number;
531
+ y: number;
532
+ z: number;
533
+ }
534
+
501
535
  declare interface Props {
502
536
  dashboardID?: string;
503
537
  dashboardLayout: DashboardLayoutDataType;
@@ -533,11 +567,34 @@ declare interface ReferenceDataType {
533
567
 
534
568
  declare type ScaleDataType = 'categorical' | 'linear' | 'threshold';
535
569
 
570
+ declare interface ShadowConfig {
571
+ mapSize: {
572
+ width: number;
573
+ height: number;
574
+ };
575
+ camera: {
576
+ near: number;
577
+ far: number;
578
+ };
579
+ }
580
+
536
581
  declare interface SourcesDataType {
537
582
  source: string;
538
583
  link?: string;
539
584
  }
540
585
 
586
+ declare interface SpotLightConfig extends BaseLightConfig {
587
+ type: 'spot';
588
+ target?: Position;
589
+ distance?: number;
590
+ angle?: number;
591
+ penumbra?: number;
592
+ decay?: number;
593
+ castShadow?: boolean;
594
+ shadow?: ShadowConfig;
595
+ position?: Position | 'camera';
596
+ }
597
+
541
598
  declare interface StyleObject {
542
599
  title?: React.CSSProperties;
543
600
  footnote?: React.CSSProperties;
@@ -1,14 +1,14 @@
1
1
  import { j as l } from "./index-CHPV5EwG-BPSP-7Jg.js";
2
2
  import { useState as g, useMemo as T, useEffect as V, useCallback as A } from "react";
3
- import { i as I } from "./index-C1rRk_50.js";
4
- import { f as x } from "./index-UV9hjG_S.js";
3
+ import { i as I } from "./index-V_JXij1_.js";
4
+ import { f as x } from "./index-EArKRVKg.js";
5
5
  import { Z as k, H as O } from "./DropdownSelect-CtOKZHD0.js";
6
6
  import { f as z } from "./checkIfMultiple-ChTJk2Tk.js";
7
7
  import { SingleGraphDashboard as E } from "./SingleGraphDashboard.js";
8
- import { f as Z, a as q, b as J, c as B, t as K } from "./fetchAndParseData-4gsYTy6_.js";
9
- import { g as Q } from "./getUniqValue-BtUENB2H.js";
8
+ import { f as Z, a as q, b as J, c as B, t as K } from "./fetchAndParseData-DBOl1Icl.js";
9
+ import { g as Q } from "./getUniqValue-CttuU_wn.js";
10
10
  import { GraphHeader as X } from "./GraphHeader.js";
11
- import { f as Y } from "./filterData-B8ocT57s.js";
11
+ import { f as Y } from "./filterData-9nEcQ-Jp.js";
12
12
  import { t as W } from "./transformDataForSelect-D8AuvYdf.js";
13
13
  const b = (p) => p.map((t) => t.columnWidth || 1).reduce((t, d) => t + d, 0), _ = [
14
14
  "barChart",
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index-CHPV5EwG-DDoeWRVt.cjs"),s=require("react"),n=require("./Spinner-DA6Z5E4n.cjs"),d=require("./MultiGraphDashboard.cjs"),u=require("./fetchAndParseData-CQyVGCul.cjs");function l(i){const{config:t}=i,[e,r]=s.useState(void 0);return s.useEffect(()=>{(async()=>{if(typeof t=="string"){const o=await u.fetchAndParseJSON(t);r(o)}else r(t)})()},[t]),e?a.jsxRuntimeExports.jsx(d.MultiGraphDashboard,{dashboardID:e.dashboardID,dashboardLayout:e.dashboardLayout,dataSettings:e.dataSettings,filters:e.filters,debugMode:e.debugMode,theme:e.theme,readableHeader:e.readableHeader,dataFilters:e.dataFilters,noOfFiltersPerRow:e.noOfFiltersPerRow,filterPosition:e.filterPosition,uiMode:e.uiMode,graphStyles:e.graphStyles,graphClassNames:e.graphClassNames}):a.jsxRuntimeExports.jsx("div",{className:"w-full flex justify-center p-4",children:a.jsxRuntimeExports.jsx(n.y,{})})}exports.MultiGraphDashboardFromConfig=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index-CHPV5EwG-DDoeWRVt.cjs"),s=require("react"),n=require("./Spinner-DA6Z5E4n.cjs"),d=require("./MultiGraphDashboard.cjs"),u=require("./fetchAndParseData-Dcy7AS_0.cjs");function l(i){const{config:t}=i,[e,r]=s.useState(void 0);return s.useEffect(()=>{(async()=>{if(typeof t=="string"){const o=await u.fetchAndParseJSON(t);r(o)}else r(t)})()},[t]),e?a.jsxRuntimeExports.jsx(d.MultiGraphDashboard,{dashboardID:e.dashboardID,dashboardLayout:e.dashboardLayout,dataSettings:e.dataSettings,filters:e.filters,debugMode:e.debugMode,theme:e.theme,readableHeader:e.readableHeader,dataFilters:e.dataFilters,noOfFiltersPerRow:e.noOfFiltersPerRow,filterPosition:e.filterPosition,uiMode:e.uiMode,graphStyles:e.graphStyles,graphClassNames:e.graphClassNames}):a.jsxRuntimeExports.jsx("div",{className:"w-full flex justify-center p-4",children:a.jsxRuntimeExports.jsx(n.y,{})})}exports.MultiGraphDashboardFromConfig=l;
2
2
  //# sourceMappingURL=MultiGraphDashboardFromConfig.cjs.map
@@ -27,6 +27,10 @@ declare interface AggregationSettingsDataType {
27
27
  aggregationMethod?: 'sum' | 'average' | 'min' | 'max';
28
28
  }
29
29
 
30
+ declare interface AmbientLightConfig extends BaseLightConfig {
31
+ type: 'ambient';
32
+ }
33
+
30
34
  declare interface AnimateDataType {
31
35
  duration: number;
32
36
  once: boolean;
@@ -69,6 +73,12 @@ declare interface AxesStyleObject {
69
73
  axis?: React.CSSProperties;
70
74
  }
71
75
 
76
+ declare interface BaseLightConfig {
77
+ type: string;
78
+ color: number;
79
+ intensity: number;
80
+ }
81
+
72
82
  declare interface ClassNameObject {
73
83
  title?: string;
74
84
  footnote?: string;
@@ -206,6 +216,14 @@ declare interface DataTableColumnDataType {
206
216
  columnWidth?: number;
207
217
  }
208
218
 
219
+ declare interface DirectionalLightConfig extends BaseLightConfig {
220
+ type: 'directional';
221
+ target?: Position;
222
+ castShadow?: boolean;
223
+ shadow?: ShadowConfig;
224
+ position?: Position | 'camera';
225
+ }
226
+
209
227
  declare interface FileSettingsDataType {
210
228
  dataURL: string;
211
229
  idColumnName: string;
@@ -481,9 +499,10 @@ declare interface GraphSettingsDataType {
481
499
  polygonAltitude?: number;
482
500
  atmosphereAltitude?: number;
483
501
  globeCurvatureResolution?: number;
484
- lightColor?: string;
502
+ lights?: LightConfig[];
485
503
  fogSetting?: FogDataType;
486
504
  showAxisLabels?: boolean;
505
+ highlightedAltitude?: number;
487
506
  }
488
507
 
489
508
  declare type GraphType = GraphTypeForGriddedGraph;
@@ -508,6 +527,8 @@ declare interface HighlightAreaSettingsForScatterPlotDataType {
508
527
 
509
528
  declare type Languages = 'en' | 'ar' | 'az' | 'bn' | 'cy' | 'he' | 'hi' | 'jp' | 'ka' | 'km' | 'ko' | 'my' | 'ne' | 'zh' | 'custom';
510
529
 
530
+ declare type LightConfig = AmbientLightConfig | DirectionalLightConfig | PointLightConfig | SpotLightConfig;
531
+
511
532
  declare interface MapLegendDataType {
512
533
  mapStyleName: string;
513
534
  legend: string | React.ReactNode;
@@ -517,6 +538,19 @@ declare type MapProjectionTypes = 'mercator' | 'equalEarth' | 'naturalEarth' | '
517
538
 
518
539
  export declare function MultiGraphDashboardFromConfig(props: Props): JSX.Element;
519
540
 
541
+ declare interface PointLightConfig extends BaseLightConfig {
542
+ type: 'point';
543
+ distance?: number;
544
+ decay?: number;
545
+ position?: Position | 'camera';
546
+ }
547
+
548
+ declare interface Position {
549
+ x: number;
550
+ y: number;
551
+ z: number;
552
+ }
553
+
520
554
  declare interface Props {
521
555
  config: string | ConfigObject;
522
556
  }
@@ -537,11 +571,34 @@ declare interface ReferenceDataType {
537
571
 
538
572
  declare type ScaleDataType = 'categorical' | 'linear' | 'threshold';
539
573
 
574
+ declare interface ShadowConfig {
575
+ mapSize: {
576
+ width: number;
577
+ height: number;
578
+ };
579
+ camera: {
580
+ near: number;
581
+ far: number;
582
+ };
583
+ }
584
+
540
585
  declare interface SourcesDataType {
541
586
  source: string;
542
587
  link?: string;
543
588
  }
544
589
 
590
+ declare interface SpotLightConfig extends BaseLightConfig {
591
+ type: 'spot';
592
+ target?: Position;
593
+ distance?: number;
594
+ angle?: number;
595
+ penumbra?: number;
596
+ decay?: number;
597
+ castShadow?: boolean;
598
+ shadow?: ShadowConfig;
599
+ position?: Position | 'camera';
600
+ }
601
+
545
602
  declare interface StyleObject {
546
603
  title?: React.CSSProperties;
547
604
  footnote?: React.CSSProperties;
@@ -2,7 +2,7 @@ import { j as a } from "./index-CHPV5EwG-BPSP-7Jg.js";
2
2
  import { useState as i, useEffect as d } from "react";
3
3
  import { y as f } from "./Spinner-C85UF28E.js";
4
4
  import { MultiGraphDashboard as n } from "./MultiGraphDashboard.js";
5
- import { f as l } from "./fetchAndParseData-4gsYTy6_.js";
5
+ import { f as l } from "./fetchAndParseData-DBOl1Icl.js";
6
6
  function b(s) {
7
7
  const { config: e } = s, [t, r] = i(void 0);
8
8
  return d(() => {
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-CHPV5EwG-DDoeWRVt.cjs"),o=require("react"),D=require("./DropdownSelect-DBDM64B5.cjs"),L=require("./checkIfMultiple-BXbHUCWM.cjs"),k=require("./Spinner-DA6Z5E4n.cjs"),N=require("./SingleGraphDashboard.cjs"),m=require("./fetchAndParseData-CQyVGCul.cjs"),W=require("./GraphHeader.cjs"),q=require("./filterData-DN6py7y_.cjs");function A(d,l,e,t){const i=[];return d.forEach(u=>{Object.entries(u).forEach(([n,p])=>{if(n!==l){const c={indicator:e.findIndex(h=>h.value===n)!==-1?e[e.findIndex(h=>h.value===n)].label:n,value:p};c[l]=u[l],i.push(c)}})}),t&&console.log(i),i}const b=d=>d.map(t=>t.columnWidth||1).reduce((t,i)=>t+i,0);function G(d){const{dashboardID:l,dashboardLayout:e,dataSettings:t,debugMode:i,theme:u="light",readableHeader:n,dataFilters:p,uiMode:c="normal",graphStyles:h,graphClassNames:w}=d,R=o.useMemo(()=>({ignoreCase:!0,ignoreAccents:!0,trim:!0}),[]),[y,E]=o.useState(void 0),[S,T]=o.useState([]),[f,v]=o.useState(void 0),[x,I]=o.useState(void 0);o.useEffect(()=>{if(x){const s=x.filter(g=>g[t.keyColumn]===f);E(s)}},[x,f,t.keyColumn]);const C=o.useCallback(async()=>{if(t)try{const g=await(t.dataURL?typeof t.dataURL=="string"?t.fileType==="json"?m.fetchAndParseJSON(t.dataURL,void 0,t.dataTransformation,i):t.fileType==="api"?m.fetchAndTransformDataFromAPI(t.dataURL,t.apiHeaders,void 0,t.dataTransformation,i):m.fetchAndParseCSV(t.dataURL,t.dataTransformation,void 0,i,t.delimiter,!0):m.fetchAndParseMultipleDataSources(t.dataURL,t.idColumnTitle):m.transformColumnsToArray(t.data,void 0)),a=q.filterData(g,p||[]);T(a.map(F=>F[t.keyColumn])),v(a[0][t.keyColumn]);const j=A(a,t.keyColumn,n||[],i);I(j)}catch(s){console.error("Data fetching error:",s)}},[t,i,p,n]);return o.useEffect(()=>{C()},[C]),r.jsxRuntimeExports.jsx("div",{className:`${u||"light"} flex grow`,dir:e.language==="he"||e.language==="ar"?"rtl":void 0,children:r.jsxRuntimeExports.jsx("div",{className:`${e?.backgroundColor?e?.backgroundColor===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}flex flex-col h-inherit w-full ml-auto mr-auto grow gap-4 ${e?.language||"en"}`,style:{...e?.backgroundColor&&e?.backgroundColor!==!0?{backgroundColor:e?.backgroundColor}:{}},id:l,children:r.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:e.backgroundColor?e.padding||"1rem":e.padding||0},children:r.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[e.title||e.description?r.jsxRuntimeExports.jsx(W.GraphHeader,{graphTitle:e.title,graphDescription:e.description,isDashboard:!0}):null,y?r.jsxRuntimeExports.jsxs(r.jsxRuntimeExports.Fragment,{children:[r.jsxRuntimeExports.jsx("div",{style:{display:"flex",gap:"1rem",flexWrap:"wrap",alignItems:"flex-start",width:"100%"},children:r.jsxRuntimeExports.jsxs("div",{style:{width:"100%",flexGrow:1,flexShrink:0,minWidth:"240px"},children:[e.dropdownLabel?r.jsxRuntimeExports.jsx(L.f,{className:"mb-2",children:e.dropdownLabel}):null,r.jsxRuntimeExports.jsx(D.Za,{options:S.map(s=>({value:s,label:s})),size:"sm",variant:c,isClearable:!1,isSearchable:!0,controlShouldRenderValue:!0,filterOption:D.Hu(R),onChange:s=>{v(s?.value)},defaultValue:{value:f,label:f}})]})}),e.rows.map((s,g)=>r.jsxRuntimeExports.jsx("div",{style:{display:"flex",gap:"1rem",alignItems:"stretch",minHeight:`${s.height||0}px`,height:"auto",width:"100%",flexWrap:"wrap"},children:s.columns.map((a,j)=>r.jsxRuntimeExports.jsx("div",{className:"flex bg-transparent h-inherit grow min-w-60",style:{width:`calc(${100*(a.columnWidth||1)/b(s.columns)}% - ${(b(s.columns)-(a.columnWidth||1))/b(s.columns)}rem)`,minHeight:"inherit"},children:r.jsxRuntimeExports.jsx(N.SingleGraphDashboard,{graphType:a.graphType,dataFilters:a.dataFilters,uiMode:c,graphSettings:{...a.settings||{},width:void 0,height:void 0,radius:a.graphType==="donutChart"?void 0:a.settings?.radius,size:a.graphType==="unitChart"?a.settings.size:void 0,language:a.settings?.language||e.language,theme:a.settings?.theme||u,styles:a.settings?.styles||h,classNames:a.settings?.classNames||w},dataSettings:{data:y},graphDataConfiguration:a.graphDataConfiguration?a.graphDataConfiguration:a.graphType==="unitChart"?[{columnId:"indicator",chartConfigId:"label"},{columnId:"value",chartConfigId:"value"}]:[{columnId:"indicator",chartConfigId:"label"},{columnId:"value",chartConfigId:"size"}],debugMode:i,readableHeader:n||[]})},j))},g))]}):r.jsxRuntimeExports.jsx("div",{className:"w-full flex justify-center p-4",children:r.jsxRuntimeExports.jsx(k.y,{})})]})})})})}exports.MultiGraphDashboardWideToLongFormat=G;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-CHPV5EwG-DDoeWRVt.cjs"),o=require("react"),D=require("./DropdownSelect-DBDM64B5.cjs"),L=require("./checkIfMultiple-BXbHUCWM.cjs"),k=require("./Spinner-DA6Z5E4n.cjs"),N=require("./SingleGraphDashboard.cjs"),m=require("./fetchAndParseData-Dcy7AS_0.cjs"),W=require("./GraphHeader.cjs"),q=require("./filterData-BoYadk0l.cjs");function A(d,l,e,t){const i=[];return d.forEach(u=>{Object.entries(u).forEach(([n,p])=>{if(n!==l){const c={indicator:e.findIndex(h=>h.value===n)!==-1?e[e.findIndex(h=>h.value===n)].label:n,value:p};c[l]=u[l],i.push(c)}})}),t&&console.log(i),i}const b=d=>d.map(t=>t.columnWidth||1).reduce((t,i)=>t+i,0);function G(d){const{dashboardID:l,dashboardLayout:e,dataSettings:t,debugMode:i,theme:u="light",readableHeader:n,dataFilters:p,uiMode:c="normal",graphStyles:h,graphClassNames:w}=d,R=o.useMemo(()=>({ignoreCase:!0,ignoreAccents:!0,trim:!0}),[]),[y,E]=o.useState(void 0),[S,T]=o.useState([]),[f,v]=o.useState(void 0),[x,I]=o.useState(void 0);o.useEffect(()=>{if(x){const s=x.filter(g=>g[t.keyColumn]===f);E(s)}},[x,f,t.keyColumn]);const C=o.useCallback(async()=>{if(t)try{const g=await(t.dataURL?typeof t.dataURL=="string"?t.fileType==="json"?m.fetchAndParseJSON(t.dataURL,void 0,t.dataTransformation,i):t.fileType==="api"?m.fetchAndTransformDataFromAPI(t.dataURL,t.apiHeaders,void 0,t.dataTransformation,i):m.fetchAndParseCSV(t.dataURL,t.dataTransformation,void 0,i,t.delimiter,!0):m.fetchAndParseMultipleDataSources(t.dataURL,t.idColumnTitle):m.transformColumnsToArray(t.data,void 0)),a=q.filterData(g,p||[]);T(a.map(F=>F[t.keyColumn])),v(a[0][t.keyColumn]);const j=A(a,t.keyColumn,n||[],i);I(j)}catch(s){console.error("Data fetching error:",s)}},[t,i,p,n]);return o.useEffect(()=>{C()},[C]),r.jsxRuntimeExports.jsx("div",{className:`${u||"light"} flex grow`,dir:e.language==="he"||e.language==="ar"?"rtl":void 0,children:r.jsxRuntimeExports.jsx("div",{className:`${e?.backgroundColor?e?.backgroundColor===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}flex flex-col h-inherit w-full ml-auto mr-auto grow gap-4 ${e?.language||"en"}`,style:{...e?.backgroundColor&&e?.backgroundColor!==!0?{backgroundColor:e?.backgroundColor}:{}},id:l,children:r.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:e.backgroundColor?e.padding||"1rem":e.padding||0},children:r.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[e.title||e.description?r.jsxRuntimeExports.jsx(W.GraphHeader,{graphTitle:e.title,graphDescription:e.description,isDashboard:!0}):null,y?r.jsxRuntimeExports.jsxs(r.jsxRuntimeExports.Fragment,{children:[r.jsxRuntimeExports.jsx("div",{style:{display:"flex",gap:"1rem",flexWrap:"wrap",alignItems:"flex-start",width:"100%"},children:r.jsxRuntimeExports.jsxs("div",{style:{width:"100%",flexGrow:1,flexShrink:0,minWidth:"240px"},children:[e.dropdownLabel?r.jsxRuntimeExports.jsx(L.f,{className:"mb-2",children:e.dropdownLabel}):null,r.jsxRuntimeExports.jsx(D.Za,{options:S.map(s=>({value:s,label:s})),size:"sm",variant:c,isClearable:!1,isSearchable:!0,controlShouldRenderValue:!0,filterOption:D.Hu(R),onChange:s=>{v(s?.value)},defaultValue:{value:f,label:f}})]})}),e.rows.map((s,g)=>r.jsxRuntimeExports.jsx("div",{style:{display:"flex",gap:"1rem",alignItems:"stretch",minHeight:`${s.height||0}px`,height:"auto",width:"100%",flexWrap:"wrap"},children:s.columns.map((a,j)=>r.jsxRuntimeExports.jsx("div",{className:"flex bg-transparent h-inherit grow min-w-60",style:{width:`calc(${100*(a.columnWidth||1)/b(s.columns)}% - ${(b(s.columns)-(a.columnWidth||1))/b(s.columns)}rem)`,minHeight:"inherit"},children:r.jsxRuntimeExports.jsx(N.SingleGraphDashboard,{graphType:a.graphType,dataFilters:a.dataFilters,uiMode:c,graphSettings:{...a.settings||{},width:void 0,height:void 0,radius:a.graphType==="donutChart"?void 0:a.settings?.radius,size:a.graphType==="unitChart"?a.settings.size:void 0,language:a.settings?.language||e.language,theme:a.settings?.theme||u,styles:a.settings?.styles||h,classNames:a.settings?.classNames||w},dataSettings:{data:y},graphDataConfiguration:a.graphDataConfiguration?a.graphDataConfiguration:a.graphType==="unitChart"?[{columnId:"indicator",chartConfigId:"label"},{columnId:"value",chartConfigId:"value"}]:[{columnId:"indicator",chartConfigId:"label"},{columnId:"value",chartConfigId:"size"}],debugMode:i,readableHeader:n||[]})},j))},g))]}):r.jsxRuntimeExports.jsx("div",{className:"w-full flex justify-center p-4",children:r.jsxRuntimeExports.jsx(k.y,{})})]})})})})}exports.MultiGraphDashboardWideToLongFormat=G;
2
2
  //# sourceMappingURL=MultiGraphDashboardWideToLongFormat.cjs.map
@@ -4,9 +4,9 @@ import { Z as W, H as R } from "./DropdownSelect-CtOKZHD0.js";
4
4
  import { f as A } from "./checkIfMultiple-ChTJk2Tk.js";
5
5
  import { y as H } from "./Spinner-C85UF28E.js";
6
6
  import { SingleGraphDashboard as V } from "./SingleGraphDashboard.js";
7
- import { f as U, a as $, b as M, c as z, t as E } from "./fetchAndParseData-4gsYTy6_.js";
7
+ import { f as U, a as $, b as M, c as z, t as E } from "./fetchAndParseData-DBOl1Icl.js";
8
8
  import { GraphHeader as G } from "./GraphHeader.js";
9
- import { f as P } from "./filterData-B8ocT57s.js";
9
+ import { f as P } from "./filterData-9nEcQ-Jp.js";
10
10
  function O(l, n, t, a) {
11
11
  const o = [];
12
12
  return l.forEach((d) => {
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index-CHPV5EwG-DDoeWRVt.cjs"),o=require("react"),n=require("./Spinner-DA6Z5E4n.cjs"),d=require("./MultiGraphDashboardWideToLongFormat.cjs"),u=require("./fetchAndParseData-CQyVGCul.cjs");function h(s){const{config:t}=s,[e,r]=o.useState(void 0);return o.useEffect(()=>{typeof t=="string"?u.fetchAndParseJSON(t).then(i=>{r(i)}):r(t)},[t]),e?a.jsxRuntimeExports.jsx(d.MultiGraphDashboardWideToLongFormat,{dashboardID:e.dashboardID,dashboardLayout:e.dashboardLayout,dataSettings:e.dataSettings,debugMode:e.debugMode,theme:e.theme,readableHeader:e.readableHeader,dataFilters:e.dataFilters,uiMode:e.uiMode,graphStyles:e.graphStyles,graphClassNames:e.graphClassNames}):a.jsxRuntimeExports.jsx("div",{className:"w-full flex justify-center p-4",children:a.jsxRuntimeExports.jsx(n.y,{})})}exports.MultiGraphDashboardWideToLongFormatFromConfig=h;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index-CHPV5EwG-DDoeWRVt.cjs"),o=require("react"),n=require("./Spinner-DA6Z5E4n.cjs"),d=require("./MultiGraphDashboardWideToLongFormat.cjs"),u=require("./fetchAndParseData-Dcy7AS_0.cjs");function h(s){const{config:t}=s,[e,r]=o.useState(void 0);return o.useEffect(()=>{typeof t=="string"?u.fetchAndParseJSON(t).then(i=>{r(i)}):r(t)},[t]),e?a.jsxRuntimeExports.jsx(d.MultiGraphDashboardWideToLongFormat,{dashboardID:e.dashboardID,dashboardLayout:e.dashboardLayout,dataSettings:e.dataSettings,debugMode:e.debugMode,theme:e.theme,readableHeader:e.readableHeader,dataFilters:e.dataFilters,uiMode:e.uiMode,graphStyles:e.graphStyles,graphClassNames:e.graphClassNames}):a.jsxRuntimeExports.jsx("div",{className:"w-full flex justify-center p-4",children:a.jsxRuntimeExports.jsx(n.y,{})})}exports.MultiGraphDashboardWideToLongFormatFromConfig=h;
2
2
  //# sourceMappingURL=MultiGraphDashboardWideToLongFormatFromConfig.cjs.map
@@ -2,7 +2,7 @@ import { j as a } from "./index-CHPV5EwG-BPSP-7Jg.js";
2
2
  import { useState as d, useEffect as i } from "react";
3
3
  import { y as n } from "./Spinner-C85UF28E.js";
4
4
  import { MultiGraphDashboardWideToLongFormat as f } from "./MultiGraphDashboardWideToLongFormat.js";
5
- import { f as h } from "./fetchAndParseData-4gsYTy6_.js";
5
+ import { f as h } from "./fetchAndParseData-DBOl1Icl.js";
6
6
  function b(r) {
7
7
  const { config: t } = r, [e, o] = d(void 0);
8
8
  return i(() => {
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-CHPV5EwG-DDoeWRVt.cjs"),p=require("react"),fe=require("./index-CZbIGs8q.cjs"),d=require("./parse-hMnG_lRV.cjs"),Ae=require("./index-BzeLQvXk.cjs"),Le=require("./numberFormattingFunction-02t-wJta.cjs"),Se=require("./Tooltip-n8z5bfav.cjs"),h=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),Ne=require("./customArea-CK768gCn.cjs"),Me=require("./AxisTitle-CK9YeovX.cjs"),$e=require("./Axis-DE7dSn1_.cjs"),Te=require("./XTicksAndGridLines-CCzXIV8d.cjs"),Ve=require("./ReferenceLine-CFVBBN__.cjs"),Ue=require("./YTicksAndGridLines-DBDuz6vb.cjs"),Fe=require("./index-BYzIB5V6.cjs"),q=require("./Colors.cjs"),He=require("./time-Byw_jYQ7.cjs"),We=require("./linear-BVckp9RD.cjs"),Ge=require("./delaunay-rcy0HhZi.cjs"),qe=require("./line-DHV4JwCR.cjs"),he=require("./step-BZ3C8QFW.cjs"),Ye=require("./select-Bnfk0lJx.cjs"),Pe=require("./init-DU0ybBc_.cjs"),Xe=require("./pointer-Dkq5NV1q.cjs"),Be=require("./use-in-view-sQJZ_xDO.cjs"),Y=require("./proxy-BHRoeZgd.cjs"),ze=require("./GraphFooter.cjs"),Je=require("./GraphHeader.cjs"),Ke=require("./EmptyState-d8_8SxeW.cjs"),Qe=require("./ColorLegendWithMouseOver.cjs");function Ze(de){const{data:s,width:I,height:K,lineColors:a,dateFormat:u,noOfXTicks:pe,rightMargin:_,topMargin:ge,bottomMargin:P,suffix:A,prefix:m,leftMargin:C,tooltip:ee,onSeriesMouseOver:T,refValues:Q,highlightAreaSettings:S,minValue:X,maxValue:te,highlightedLines:N,animate:r,rtl:ie,strokeWidth:k,showDots:B,annotations:ye,customHighlightAreaSettings:je,yAxisTitle:oe,noOfYTicks:we,minDate:re,maxDate:ne,curveType:z,styles:v,colorDomain:O,selectedColor:V,classNames:g,showLabels:U,dimmedOpacity:R,precision:D,naLabel:be,customLayers:se}=de,ae=p.useRef(null),y=Be.useInView(ae,{once:r.once,amount:r.amount}),[E,ve]=p.useState(!1);p.useEffect(()=>{if(y&&!E){const e=setTimeout(()=>{ve(!0)},(r.duration+.5)*1e3);return()=>clearTimeout(e)}},[y,E,r.duration]);const Oe=z==="linear"?qe.curveLinear:z==="step"?he.curveStep:z==="stepAfter"?he.stepAfter:z==="stepBefore"?he.stepBefore:he.monotoneX,l=Ae.sortBy(s.map(e=>({...e,date:d.parse(`${e.date}`,u,new Date)})),"date").filter(e=>!h.checkIfNullOrUndefined(e.y)),Ce=fe.uniqBy(l,e=>e.label).map(e=>e.label),Z=fe.uniqBy(Ae.sortBy(s.map(e=>({...e,date:d.parse(`${e.date}`,u,new Date)})),"date"),e=>e.date).map(e=>e.date),[f,j]=p.useState(void 0),[L,F]=p.useState(void 0),[le,H]=p.useState(void 0),w={top:ge,bottom:P,left:oe?C+30:C,right:_},W=p.useRef(null),ce=Ce.map(e=>Ae.sortBy(l.filter(o=>o.label==e),"date")),xe=S.map(e=>({...e,coordinates:[e.coordinates[0]===null?null:d.parse(`${e.coordinates[0]}`,u,new Date),e.coordinates[1]===null?null:d.parse(`${e.coordinates[1]}`,u,new Date)]})),ue=je.map(e=>({...e,coordinates:e.coordinates.map((o,x)=>x%2===0?d.parse(`${o}`,u,new Date):o)})),b=I-w.left-w.right,M=K-w.top-w.bottom,G=re?d.parse(`${re}`,u,new Date):Z[0],me=ne?d.parse(`${ne}`,u,new Date):Z[Z.length-1],i=h.checkIfNullOrUndefined(X)?Math.min(...l.map(e=>e.y).filter(e=>!h.checkIfNullOrUndefined(e)))?Math.min(...l.map(e=>e.y).filter(e=>!h.checkIfNullOrUndefined(e)))>0?0:Math.min(...l.map(e=>e.y).filter(e=>!h.checkIfNullOrUndefined(e))):0:X,J=Math.max(...l.map(e=>e.y).filter(e=>!h.checkIfNullOrUndefined(e)))?Math.max(...l.map(e=>e.y).filter(e=>!h.checkIfNullOrUndefined(e))):0,n=He.time().domain([G,me]).range([0,b]),c=We.linear().domain([h.checkIfNullOrUndefined(X)?i:X,h.checkIfNullOrUndefined(te)?J>0?J:0:te]).range([M,0]).nice(),Ie=Ge.Delaunay.from(l.filter(e=>!h.checkIfNullOrUndefined(e.date)&&!h.checkIfNullOrUndefined(e.y)),e=>n(e.date),e=>c(e.y)).voronoi([0,0,b<0?0:b,M<0?0:M]),Re=qe.line().x(e=>n(e.date)).y(e=>c(e.y)).curve(Oe),ke=c.ticks(we),De=n.ticks(pe);return p.useEffect(()=>{const e=x=>{const $=l[Pe.bisectCenter(l.map(Ee=>Ee.date),n.invert(Xe.pointer(x)[0]),0)];j($||l[l.length-1]),H(x.clientY),F(x.clientX),T?.($||l[l.length-1])},o=()=>{j(void 0),F(void 0),H(void 0)};Ye.select(W.current).on("mousemove",e).on("mouseout",o),T?.(void 0)},[n,l,T]),t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(Y.motion.svg,{width:`${I}px`,height:`${K}px`,viewBox:`0 0 ${I} ${K}`,direction:"ltr",ref:ae,children:t.jsxRuntimeExports.jsxs("g",{transform:`translate(${w.left},${w.top})`,children:[t.jsxRuntimeExports.jsx(Fe.HighlightArea,{areaSettings:xe,width:b,height:M,scale:n,animate:r,isInView:y}),t.jsxRuntimeExports.jsx(Ne.CustomArea,{areaSettings:ue,scaleX:n,scaleY:c,animate:r,isInView:y}),t.jsxRuntimeExports.jsxs("g",{children:[t.jsxRuntimeExports.jsx(Ue.YTicksAndGridLines,{values:ke.filter(e=>e!==0),y:ke.filter(e=>e!==0).map(e=>c(e)),x1:0-C,x2:b+w.right,styles:{gridLines:v?.yAxis?.gridLines,labels:v?.yAxis?.labels},classNames:{gridLines:g?.yAxis?.gridLines,labels:g?.yAxis?.labels},suffix:A,prefix:m,labelType:"secondary",showGridLines:!0,labelPos:"vertical",precision:D}),t.jsxRuntimeExports.jsx($e.Axis,{y1:c(i<0?0:i),y2:c(i<0?0:i),x1:0-C,x2:b+w.right,label:Le.numberFormattingFunction(i<0?0:i,"NA",D,m,A),labelPos:{x:0-C,y:c(i<0?0:i),dx:0,dy:J<0?"1em":-5},classNames:{axis:g?.xAxis?.axis,label:g?.yAxis?.labels},styles:{axis:v?.xAxis?.axis,label:v?.yAxis?.labels}}),t.jsxRuntimeExports.jsx(Me.AxisTitle,{x:0-C-15,y:M/2,style:v?.yAxis?.title,className:g?.yAxis?.title,text:oe,rotate90:!0})]}),t.jsxRuntimeExports.jsx("g",{children:t.jsxRuntimeExports.jsx(Te.XTicksAndGridLines,{values:De.map(e=>d.format(e,u)),x:De.map(e=>n(e)),y1:0,y2:M,styles:{gridLines:v?.xAxis?.gridLines,labels:v?.xAxis?.labels},classNames:{gridLines:t.mo("opacity-0",g?.xAxis?.gridLines),labels:t.mo("fill-primary-gray-700 dark:fill-primary-gray-300 xs:max-[360px]:hidden text-[9px] md:text-[10px] lg:text-xs",g?.xAxis?.labels)},suffix:A,prefix:m,labelType:"primary",showGridLines:!0,precision:D})}),se.filter(e=>e.position==="before").map(e=>e.layer),t.jsxRuntimeExports.jsxs(Y.motion.g,{children:[ce.map(e=>t.jsxRuntimeExports.jsxs(Y.motion.g,{exit:{opacity:0,transition:{duration:r.duration}},variants:{initial:{opacity:f?e[0].label===f.label?1:R:V?e[0].color&&a[O.indexOf(e[0].color)]===V?1:R:N.length!==0?N.indexOf(e[0].label)!==-1?1:R:1},whileInView:{opacity:f?e[0].label===f.label?1:R:V?e[0].color&&a[O.indexOf(e[0].color)]===V?1:R:N.length!==0?N.indexOf(e[0].label)!==-1?1:R:1,transition:{duration:r.duration}}},initial:"initial",animate:y?"whileInView":"initial",children:[t.jsxRuntimeExports.jsx(Y.motion.path,{d:Re(e.filter(o=>!h.checkIfNullOrUndefined(o.y)))||"",style:{fill:"none",strokeWidth:f?e[0].label===f.label?k+Math.max(2,.5*k):k:N.length!==0&&N.indexOf(e[0].label)!==-1?k+Math.max(2,.5*k):k},exit:{opacity:0,transition:{duration:r.duration}},variants:{initial:{pathLength:0,d:Re(e.filter(o=>!h.checkIfNullOrUndefined(o.y)))||"",opacity:1,stroke:s.filter(o=>o.color).length===0?a[0]:e[0].color?a[O.indexOf(e[0].color)]:q.Colors.gray},whileInView:{pathLength:1,d:Re(e.filter(o=>!h.checkIfNullOrUndefined(o.y)))||"",opacity:1,stroke:s.filter(o=>o.color).length===0?a[0]:e[0].color?a[O.indexOf(e[0].color)]:q.Colors.gray,transition:{duration:r.duration}}},initial:"initial",animate:y?"whileInView":"initial"}),e.map((o,x)=>t.jsxRuntimeExports.jsx(Y.motion.g,{children:h.checkIfNullOrUndefined(o.y)?null:t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:B?t.jsxRuntimeExports.jsx(Y.motion.circle,{r:b/e.length<5?0:b/e.length<20?2:4,exit:{opacity:0,transition:{duration:r.duration}},variants:{initial:{opacity:0,fill:s.filter($=>$.color).length===0?a[0]:e[0].color?a[O.indexOf(e[0].color)]:q.Colors.gray,cx:n(o.date),cy:c(o.y)},whileInView:{opacity:1,fill:s.filter($=>$.color).length===0?a[0]:e[0].color?a[O.indexOf(e[0].color)]:q.Colors.gray,transition:{duration:E?r.duration:.5,delay:E?0:r.duration},cx:n(o.date),cy:c(o.y)}},initial:"initial",animate:y?"whileInView":"initial"}):null})},x)),(N.indexOf(e[0].label)!==-1||f?.label===e[0].label)&&U?t.jsxRuntimeExports.jsx(Y.motion.text,{style:{fill:s.filter(o=>o.color).length===0?a[0]:e[0].color?a[O.indexOf(e[0].color)]:q.Colors.gray},className:"text-sm font-bold",dx:5,dy:4,exit:{opacity:0,transition:{duration:r.duration}},variants:{initial:{opacity:0,x:n(e[e.length-1].date),y:c(e[e.length-1].y)},whileInView:{opacity:1,x:n(e[e.length-1].date),y:c(e[e.length-1].y),transition:{duration:E?r.duration:.5,delay:E?0:r.duration}}},initial:"initial",animate:y?"whileInView":"initial",children:e[0].label}):null]},e[0].label)),f?t.jsxRuntimeExports.jsx("text",{y:c(f.y)-8,x:n(f.date),className:t.mo("graph-value text-sm font-bold",g?.graphObjectValues),style:{fill:s.filter(e=>e.color).length===0?a[0]:f.color?a[O.indexOf(f.color)]:q.Colors.gray,textAnchor:"middle",...v?.graphObjectValues||{}},children:Le.numberFormattingFunction(f.y,be,D,m,A)}):null]}),l.filter(e=>!h.checkIfNullOrUndefined(e.y)).map((e,o)=>t.jsxRuntimeExports.jsx("g",{children:t.jsxRuntimeExports.jsx("path",{d:Ie.renderCell(l.findIndex(x=>x.label===e.label&&x.date===e.date)),opacity:0,onMouseEnter:x=>{j(e),H(x.clientY),F(x.clientX),T?.(e)},onMouseMove:x=>{j(e),H(x.clientY),F(x.clientX)},onMouseLeave:()=>{j(void 0),F(void 0),H(void 0),T?.(void 0)}})},o)),Q?t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:Q.map((e,o)=>t.jsxRuntimeExports.jsx(Ve.RefLineY,{text:e.text,color:e.color,y:c(e.value),x1:0-C,x2:b+w.right,classNames:e.classNames,styles:e.styles,animate:r,isInView:y},o))}):null,t.jsxRuntimeExports.jsx("g",{children:ye.map((e,o)=>{const x=Ne.getLineEndPoint({x:e.xCoordinate?n(d.parse(`${e.xCoordinate}`,u,new Date))+(e.xOffset||0):0+(e.xOffset||0),y:e.yCoordinate?c(e.yCoordinate)+(e.yOffset||0)-8:0+(e.yOffset||0)-8},{x:e.xCoordinate?n(d.parse(`${e.xCoordinate}`,u,new Date)):0,y:e.yCoordinate?c(e.yCoordinate):0},h.checkIfNullOrUndefined(e.connectorRadius)?3.5:e.connectorRadius),$=e.showConnector?{y1:x.y,x1:x.x,y2:e.yCoordinate?c(e.yCoordinate)+(e.yOffset||0):0+(e.yOffset||0),x2:e.xCoordinate?n(d.parse(`${e.xCoordinate}`,u,new Date))+(e.xOffset||0):0+(e.xOffset||0),cy:e.yCoordinate?c(e.yCoordinate):0,cx:e.xCoordinate?n(d.parse(`${e.xCoordinate}`,u,new Date)):0,circleRadius:h.checkIfNullOrUndefined(e.connectorRadius)?3.5:e.connectorRadius,strokeWidth:e.showConnector===!0?2:Math.min(e.showConnector||0,1)}:void 0,Ee={y:e.yCoordinate?c(e.yCoordinate)+(e.yOffset||0)-8:0+(e.yOffset||0)-8,x:ie?0:e.xCoordinate?n(d.parse(`${e.xCoordinate}`,u,new Date))+(e.xOffset||0):0+(e.xOffset||0),width:ie?e.xCoordinate?n(d.parse(`${e.xCoordinate}`,u,new Date))+(e.xOffset||0):0+(e.xOffset||0):b+w.right-(e.xCoordinate?n(d.parse(`${e.xCoordinate}`,u,new Date))+(e.xOffset||0):0+(e.xOffset||0)),maxWidth:e.maxWidth,fontWeight:e.fontWeight,align:e.align};return t.jsxRuntimeExports.jsx(Ne.Annotation,{color:e.color,connectorsSettings:$,labelSettings:Ee,text:e.text,classNames:e.classNames,styles:e.styles,animate:r,isInView:y},o)})}),se.filter(e=>e.position==="after").map(e=>e.layer)]})}),f&&ee&&L&&le?t.jsxRuntimeExports.jsx(Se.Tooltip,{data:f,body:ee,xPos:L,yPos:le,backgroundStyle:v?.tooltip,className:g?.tooltip}):null]})}function _e(de){const{data:s,graphTitle:I,showNAColor:K=!0,colors:a,colorDomain:u,suffix:pe="",sources:_,prefix:ge="",graphDescription:P,height:A,width:m,footNote:C,noOfXTicks:ee=10,dateFormat:T="yyyy",padding:Q,backgroundColor:S=!1,leftMargin:X=30,rightMargin:te=50,topMargin:N=20,bottomMargin:r=25,showColorScale:ie=!0,tooltip:k,relativeHeight:B,onSeriesMouseOver:ye,showLabels:je=!0,refValues:oe=[],highlightAreaSettings:we=[],graphID:re,minValue:ne,maxValue:z,highlightedLines:v=[],graphDownload:O=!1,dataDownload:V=!1,animate:g=!1,language:U="en",colorLegendTitle:R,minHeight:D=0,strokeWidth:be=2,showDots:se=!0,annotations:ae=[],customHighlightAreaSettings:y=[],theme:E="light",ariaLabel:ve,yAxisTitle:Oe,noOfYTicks:l=5,minDate:Ce,maxDate:Z,curveType:f="curve",styles:j,classNames:L,dimmedOpacity:F=.3,precision:le=2,customLayers:H=[],naLabel:w="NA"}=de,[W,ce]=p.useState(0),[xe,ue]=p.useState(0),[b,M]=p.useState(void 0),G=p.useRef(null),me=p.useRef(null);return p.useEffect(()=>{const i=new ResizeObserver(J=>{ce(m||J[0].target.clientWidth||620),ue(A||J[0].target.clientHeight||480)});return G.current&&(ue(G.current.clientHeight||480),ce(G.current.clientWidth||620),m||i.observe(G.current)),()=>i.disconnect()},[m,A]),t.jsxRuntimeExports.jsx("div",{className:`${E||"light"} flex ${m?"w-fit grow-0":"w-full grow"}`,dir:U==="he"||U==="ar"?"rtl":void 0,children:t.jsxRuntimeExports.jsx("div",{className:t.mo(`${S?S===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${U||"en"}`,m?"w-fit":"w-full",L?.graphContainer),style:{...j?.graphContainer||{},...S&&S!==!0?{backgroundColor:S}:{}},id:re,ref:me,"aria-label":ve||`${I?`The graph shows ${I}. `:""}This is a multi-line chart that shows trends over time.${P?` ${P}`:""}`,children:t.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:S?Q||"1rem":Q||0},children:t.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[I||P||O||V?t.jsxRuntimeExports.jsx(Je.GraphHeader,{styles:{title:j?.title,description:j?.description},classNames:{title:L?.title,description:L?.description},graphTitle:I,graphDescription:P,width:m,graphDownload:O?me.current:void 0,dataDownload:V?s.map(i=>i.data).filter(i=>i!==void 0).length>0?s.map(i=>i.data).filter(i=>i!==void 0):s.filter(i=>i!==void 0):null}):null,t.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:s.length===0?t.jsxRuntimeExports.jsx(Ke.EmptyState,{}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[ie&&s.filter(i=>i.color).length!==0?t.jsxRuntimeExports.jsx(Qe.ColorLegendWithMouseOver,{width:m,colorLegendTitle:R,colors:a||q.Colors[E].categoricalColors.colors,colorDomain:u||fe.uniqBy(s.filter(i=>i.color),"color").map(i=>i.color).filter(i=>i!==void 0),setSelectedColor:M,showNAColor:K}):null,t.jsxRuntimeExports.jsx("div",{className:"w-full grow leading-0",ref:G,"aria-label":"Graph area",children:(m||W)&&(A||xe)?t.jsxRuntimeExports.jsx(Ze,{data:s,lineColors:s.filter(i=>i.color).length===0?a?[a]:[q.Colors.primaryColors["blue-600"]]:a||q.Colors[E].categoricalColors.colors,width:m||W,height:Math.max(D,A||(B?D?(m||W)*B>D?(m||W)*B:D:(m||W)*B:xe)),dateFormat:T,noOfXTicks:ee,leftMargin:X,rightMargin:te,topMargin:N,bottomMargin:r,tooltip:k,onSeriesMouseOver:ye,suffix:pe,prefix:ge,highlightAreaSettings:we,refValues:oe,minValue:ne,maxValue:z,highlightedLines:v,animate:g===!0?{duration:.5,once:!0,amount:.5}:g||{duration:0,once:!0,amount:0},rtl:U==="he"||U==="ar",strokeWidth:be,showDots:se,annotations:ae,customHighlightAreaSettings:y,yAxisTitle:Oe,noOfYTicks:l,minDate:Ce,maxDate:Z,curveType:f,styles:j,classNames:L,selectedColor:b,showLabels:je,colorDomain:s.filter(i=>i.color).length===0?[]:u||fe.uniqBy(s.filter(i=>i.color),"color").map(i=>i.color),dimmedOpacity:F,precision:le,customLayers:H,naLabel:w}):null})]})}),_||C?t.jsxRuntimeExports.jsx(ze.GraphFooter,{styles:{footnote:j?.footnote,source:j?.source},classNames:{footnote:L?.footnote,source:L?.source},sources:_,footNote:C,width:m}):null]})})})})}exports.MultiLineAltChart=_e;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-CHPV5EwG-DDoeWRVt.cjs"),p=require("react"),fe=require("./index-BJOeaYTk.cjs"),d=require("./parse-hMnG_lRV.cjs"),Ae=require("./index-DYH8g9WA.cjs"),Le=require("./numberFormattingFunction-02t-wJta.cjs"),Se=require("./Tooltip-De16GWhY.cjs"),h=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),Ne=require("./customArea-CK768gCn.cjs"),Me=require("./AxisTitle-CK9YeovX.cjs"),$e=require("./Axis-DE7dSn1_.cjs"),Te=require("./XTicksAndGridLines-CCzXIV8d.cjs"),Ve=require("./ReferenceLine-CFVBBN__.cjs"),Ue=require("./YTicksAndGridLines-DBDuz6vb.cjs"),Fe=require("./index-BYzIB5V6.cjs"),q=require("./Colors.cjs"),He=require("./time-Byw_jYQ7.cjs"),We=require("./linear-BVckp9RD.cjs"),Ge=require("./delaunay-rcy0HhZi.cjs"),qe=require("./line-DHV4JwCR.cjs"),he=require("./step-BZ3C8QFW.cjs"),Ye=require("./select-Bnfk0lJx.cjs"),Pe=require("./init-DU0ybBc_.cjs"),Xe=require("./pointer-Dkq5NV1q.cjs"),Be=require("./use-in-view-sQJZ_xDO.cjs"),Y=require("./proxy-BHRoeZgd.cjs"),ze=require("./GraphFooter.cjs"),Je=require("./GraphHeader.cjs"),Ke=require("./EmptyState-d8_8SxeW.cjs"),Qe=require("./ColorLegendWithMouseOver.cjs");function Ze(de){const{data:s,width:I,height:K,lineColors:a,dateFormat:u,noOfXTicks:pe,rightMargin:_,topMargin:ge,bottomMargin:P,suffix:A,prefix:m,leftMargin:C,tooltip:ee,onSeriesMouseOver:T,refValues:Q,highlightAreaSettings:S,minValue:X,maxValue:te,highlightedLines:N,animate:r,rtl:ie,strokeWidth:k,showDots:B,annotations:ye,customHighlightAreaSettings:je,yAxisTitle:oe,noOfYTicks:we,minDate:re,maxDate:ne,curveType:z,styles:v,colorDomain:O,selectedColor:V,classNames:g,showLabels:U,dimmedOpacity:R,precision:D,naLabel:be,customLayers:se}=de,ae=p.useRef(null),y=Be.useInView(ae,{once:r.once,amount:r.amount}),[E,ve]=p.useState(!1);p.useEffect(()=>{if(y&&!E){const e=setTimeout(()=>{ve(!0)},(r.duration+.5)*1e3);return()=>clearTimeout(e)}},[y,E,r.duration]);const Oe=z==="linear"?qe.curveLinear:z==="step"?he.curveStep:z==="stepAfter"?he.stepAfter:z==="stepBefore"?he.stepBefore:he.monotoneX,l=Ae.sortBy(s.map(e=>({...e,date:d.parse(`${e.date}`,u,new Date)})),"date").filter(e=>!h.checkIfNullOrUndefined(e.y)),Ce=fe.uniqBy(l,e=>e.label).map(e=>e.label),Z=fe.uniqBy(Ae.sortBy(s.map(e=>({...e,date:d.parse(`${e.date}`,u,new Date)})),"date"),e=>e.date).map(e=>e.date),[f,j]=p.useState(void 0),[L,F]=p.useState(void 0),[le,H]=p.useState(void 0),w={top:ge,bottom:P,left:oe?C+30:C,right:_},W=p.useRef(null),ce=Ce.map(e=>Ae.sortBy(l.filter(o=>o.label==e),"date")),xe=S.map(e=>({...e,coordinates:[e.coordinates[0]===null?null:d.parse(`${e.coordinates[0]}`,u,new Date),e.coordinates[1]===null?null:d.parse(`${e.coordinates[1]}`,u,new Date)]})),ue=je.map(e=>({...e,coordinates:e.coordinates.map((o,x)=>x%2===0?d.parse(`${o}`,u,new Date):o)})),b=I-w.left-w.right,M=K-w.top-w.bottom,G=re?d.parse(`${re}`,u,new Date):Z[0],me=ne?d.parse(`${ne}`,u,new Date):Z[Z.length-1],i=h.checkIfNullOrUndefined(X)?Math.min(...l.map(e=>e.y).filter(e=>!h.checkIfNullOrUndefined(e)))?Math.min(...l.map(e=>e.y).filter(e=>!h.checkIfNullOrUndefined(e)))>0?0:Math.min(...l.map(e=>e.y).filter(e=>!h.checkIfNullOrUndefined(e))):0:X,J=Math.max(...l.map(e=>e.y).filter(e=>!h.checkIfNullOrUndefined(e)))?Math.max(...l.map(e=>e.y).filter(e=>!h.checkIfNullOrUndefined(e))):0,n=He.time().domain([G,me]).range([0,b]),c=We.linear().domain([h.checkIfNullOrUndefined(X)?i:X,h.checkIfNullOrUndefined(te)?J>0?J:0:te]).range([M,0]).nice(),Ie=Ge.Delaunay.from(l.filter(e=>!h.checkIfNullOrUndefined(e.date)&&!h.checkIfNullOrUndefined(e.y)),e=>n(e.date),e=>c(e.y)).voronoi([0,0,b<0?0:b,M<0?0:M]),Re=qe.line().x(e=>n(e.date)).y(e=>c(e.y)).curve(Oe),ke=c.ticks(we),De=n.ticks(pe);return p.useEffect(()=>{const e=x=>{const $=l[Pe.bisectCenter(l.map(Ee=>Ee.date),n.invert(Xe.pointer(x)[0]),0)];j($||l[l.length-1]),H(x.clientY),F(x.clientX),T?.($||l[l.length-1])},o=()=>{j(void 0),F(void 0),H(void 0)};Ye.select(W.current).on("mousemove",e).on("mouseout",o),T?.(void 0)},[n,l,T]),t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(Y.motion.svg,{width:`${I}px`,height:`${K}px`,viewBox:`0 0 ${I} ${K}`,direction:"ltr",ref:ae,children:t.jsxRuntimeExports.jsxs("g",{transform:`translate(${w.left},${w.top})`,children:[t.jsxRuntimeExports.jsx(Fe.HighlightArea,{areaSettings:xe,width:b,height:M,scale:n,animate:r,isInView:y}),t.jsxRuntimeExports.jsx(Ne.CustomArea,{areaSettings:ue,scaleX:n,scaleY:c,animate:r,isInView:y}),t.jsxRuntimeExports.jsxs("g",{children:[t.jsxRuntimeExports.jsx(Ue.YTicksAndGridLines,{values:ke.filter(e=>e!==0),y:ke.filter(e=>e!==0).map(e=>c(e)),x1:0-C,x2:b+w.right,styles:{gridLines:v?.yAxis?.gridLines,labels:v?.yAxis?.labels},classNames:{gridLines:g?.yAxis?.gridLines,labels:g?.yAxis?.labels},suffix:A,prefix:m,labelType:"secondary",showGridLines:!0,labelPos:"vertical",precision:D}),t.jsxRuntimeExports.jsx($e.Axis,{y1:c(i<0?0:i),y2:c(i<0?0:i),x1:0-C,x2:b+w.right,label:Le.numberFormattingFunction(i<0?0:i,"NA",D,m,A),labelPos:{x:0-C,y:c(i<0?0:i),dx:0,dy:J<0?"1em":-5},classNames:{axis:g?.xAxis?.axis,label:g?.yAxis?.labels},styles:{axis:v?.xAxis?.axis,label:v?.yAxis?.labels}}),t.jsxRuntimeExports.jsx(Me.AxisTitle,{x:0-C-15,y:M/2,style:v?.yAxis?.title,className:g?.yAxis?.title,text:oe,rotate90:!0})]}),t.jsxRuntimeExports.jsx("g",{children:t.jsxRuntimeExports.jsx(Te.XTicksAndGridLines,{values:De.map(e=>d.format(e,u)),x:De.map(e=>n(e)),y1:0,y2:M,styles:{gridLines:v?.xAxis?.gridLines,labels:v?.xAxis?.labels},classNames:{gridLines:t.mo("opacity-0",g?.xAxis?.gridLines),labels:t.mo("fill-primary-gray-700 dark:fill-primary-gray-300 xs:max-[360px]:hidden text-[9px] md:text-[10px] lg:text-xs",g?.xAxis?.labels)},suffix:A,prefix:m,labelType:"primary",showGridLines:!0,precision:D})}),se.filter(e=>e.position==="before").map(e=>e.layer),t.jsxRuntimeExports.jsxs(Y.motion.g,{children:[ce.map(e=>t.jsxRuntimeExports.jsxs(Y.motion.g,{exit:{opacity:0,transition:{duration:r.duration}},variants:{initial:{opacity:f?e[0].label===f.label?1:R:V?e[0].color&&a[O.indexOf(e[0].color)]===V?1:R:N.length!==0?N.indexOf(e[0].label)!==-1?1:R:1},whileInView:{opacity:f?e[0].label===f.label?1:R:V?e[0].color&&a[O.indexOf(e[0].color)]===V?1:R:N.length!==0?N.indexOf(e[0].label)!==-1?1:R:1,transition:{duration:r.duration}}},initial:"initial",animate:y?"whileInView":"initial",children:[t.jsxRuntimeExports.jsx(Y.motion.path,{d:Re(e.filter(o=>!h.checkIfNullOrUndefined(o.y)))||"",style:{fill:"none",strokeWidth:f?e[0].label===f.label?k+Math.max(2,.5*k):k:N.length!==0&&N.indexOf(e[0].label)!==-1?k+Math.max(2,.5*k):k},exit:{opacity:0,transition:{duration:r.duration}},variants:{initial:{pathLength:0,d:Re(e.filter(o=>!h.checkIfNullOrUndefined(o.y)))||"",opacity:1,stroke:s.filter(o=>o.color).length===0?a[0]:e[0].color?a[O.indexOf(e[0].color)]:q.Colors.gray},whileInView:{pathLength:1,d:Re(e.filter(o=>!h.checkIfNullOrUndefined(o.y)))||"",opacity:1,stroke:s.filter(o=>o.color).length===0?a[0]:e[0].color?a[O.indexOf(e[0].color)]:q.Colors.gray,transition:{duration:r.duration}}},initial:"initial",animate:y?"whileInView":"initial"}),e.map((o,x)=>t.jsxRuntimeExports.jsx(Y.motion.g,{children:h.checkIfNullOrUndefined(o.y)?null:t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:B?t.jsxRuntimeExports.jsx(Y.motion.circle,{r:b/e.length<5?0:b/e.length<20?2:4,exit:{opacity:0,transition:{duration:r.duration}},variants:{initial:{opacity:0,fill:s.filter($=>$.color).length===0?a[0]:e[0].color?a[O.indexOf(e[0].color)]:q.Colors.gray,cx:n(o.date),cy:c(o.y)},whileInView:{opacity:1,fill:s.filter($=>$.color).length===0?a[0]:e[0].color?a[O.indexOf(e[0].color)]:q.Colors.gray,transition:{duration:E?r.duration:.5,delay:E?0:r.duration},cx:n(o.date),cy:c(o.y)}},initial:"initial",animate:y?"whileInView":"initial"}):null})},x)),(N.indexOf(e[0].label)!==-1||f?.label===e[0].label)&&U?t.jsxRuntimeExports.jsx(Y.motion.text,{style:{fill:s.filter(o=>o.color).length===0?a[0]:e[0].color?a[O.indexOf(e[0].color)]:q.Colors.gray},className:"text-sm font-bold",dx:5,dy:4,exit:{opacity:0,transition:{duration:r.duration}},variants:{initial:{opacity:0,x:n(e[e.length-1].date),y:c(e[e.length-1].y)},whileInView:{opacity:1,x:n(e[e.length-1].date),y:c(e[e.length-1].y),transition:{duration:E?r.duration:.5,delay:E?0:r.duration}}},initial:"initial",animate:y?"whileInView":"initial",children:e[0].label}):null]},e[0].label)),f?t.jsxRuntimeExports.jsx("text",{y:c(f.y)-8,x:n(f.date),className:t.mo("graph-value text-sm font-bold",g?.graphObjectValues),style:{fill:s.filter(e=>e.color).length===0?a[0]:f.color?a[O.indexOf(f.color)]:q.Colors.gray,textAnchor:"middle",...v?.graphObjectValues||{}},children:Le.numberFormattingFunction(f.y,be,D,m,A)}):null]}),l.filter(e=>!h.checkIfNullOrUndefined(e.y)).map((e,o)=>t.jsxRuntimeExports.jsx("g",{children:t.jsxRuntimeExports.jsx("path",{d:Ie.renderCell(l.findIndex(x=>x.label===e.label&&x.date===e.date)),opacity:0,onMouseEnter:x=>{j(e),H(x.clientY),F(x.clientX),T?.(e)},onMouseMove:x=>{j(e),H(x.clientY),F(x.clientX)},onMouseLeave:()=>{j(void 0),F(void 0),H(void 0),T?.(void 0)}})},o)),Q?t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:Q.map((e,o)=>t.jsxRuntimeExports.jsx(Ve.RefLineY,{text:e.text,color:e.color,y:c(e.value),x1:0-C,x2:b+w.right,classNames:e.classNames,styles:e.styles,animate:r,isInView:y},o))}):null,t.jsxRuntimeExports.jsx("g",{children:ye.map((e,o)=>{const x=Ne.getLineEndPoint({x:e.xCoordinate?n(d.parse(`${e.xCoordinate}`,u,new Date))+(e.xOffset||0):0+(e.xOffset||0),y:e.yCoordinate?c(e.yCoordinate)+(e.yOffset||0)-8:0+(e.yOffset||0)-8},{x:e.xCoordinate?n(d.parse(`${e.xCoordinate}`,u,new Date)):0,y:e.yCoordinate?c(e.yCoordinate):0},h.checkIfNullOrUndefined(e.connectorRadius)?3.5:e.connectorRadius),$=e.showConnector?{y1:x.y,x1:x.x,y2:e.yCoordinate?c(e.yCoordinate)+(e.yOffset||0):0+(e.yOffset||0),x2:e.xCoordinate?n(d.parse(`${e.xCoordinate}`,u,new Date))+(e.xOffset||0):0+(e.xOffset||0),cy:e.yCoordinate?c(e.yCoordinate):0,cx:e.xCoordinate?n(d.parse(`${e.xCoordinate}`,u,new Date)):0,circleRadius:h.checkIfNullOrUndefined(e.connectorRadius)?3.5:e.connectorRadius,strokeWidth:e.showConnector===!0?2:Math.min(e.showConnector||0,1)}:void 0,Ee={y:e.yCoordinate?c(e.yCoordinate)+(e.yOffset||0)-8:0+(e.yOffset||0)-8,x:ie?0:e.xCoordinate?n(d.parse(`${e.xCoordinate}`,u,new Date))+(e.xOffset||0):0+(e.xOffset||0),width:ie?e.xCoordinate?n(d.parse(`${e.xCoordinate}`,u,new Date))+(e.xOffset||0):0+(e.xOffset||0):b+w.right-(e.xCoordinate?n(d.parse(`${e.xCoordinate}`,u,new Date))+(e.xOffset||0):0+(e.xOffset||0)),maxWidth:e.maxWidth,fontWeight:e.fontWeight,align:e.align};return t.jsxRuntimeExports.jsx(Ne.Annotation,{color:e.color,connectorsSettings:$,labelSettings:Ee,text:e.text,classNames:e.classNames,styles:e.styles,animate:r,isInView:y},o)})}),se.filter(e=>e.position==="after").map(e=>e.layer)]})}),f&&ee&&L&&le?t.jsxRuntimeExports.jsx(Se.Tooltip,{data:f,body:ee,xPos:L,yPos:le,backgroundStyle:v?.tooltip,className:g?.tooltip}):null]})}function _e(de){const{data:s,graphTitle:I,showNAColor:K=!0,colors:a,colorDomain:u,suffix:pe="",sources:_,prefix:ge="",graphDescription:P,height:A,width:m,footNote:C,noOfXTicks:ee=10,dateFormat:T="yyyy",padding:Q,backgroundColor:S=!1,leftMargin:X=30,rightMargin:te=50,topMargin:N=20,bottomMargin:r=25,showColorScale:ie=!0,tooltip:k,relativeHeight:B,onSeriesMouseOver:ye,showLabels:je=!0,refValues:oe=[],highlightAreaSettings:we=[],graphID:re,minValue:ne,maxValue:z,highlightedLines:v=[],graphDownload:O=!1,dataDownload:V=!1,animate:g=!1,language:U="en",colorLegendTitle:R,minHeight:D=0,strokeWidth:be=2,showDots:se=!0,annotations:ae=[],customHighlightAreaSettings:y=[],theme:E="light",ariaLabel:ve,yAxisTitle:Oe,noOfYTicks:l=5,minDate:Ce,maxDate:Z,curveType:f="curve",styles:j,classNames:L,dimmedOpacity:F=.3,precision:le=2,customLayers:H=[],naLabel:w="NA"}=de,[W,ce]=p.useState(0),[xe,ue]=p.useState(0),[b,M]=p.useState(void 0),G=p.useRef(null),me=p.useRef(null);return p.useEffect(()=>{const i=new ResizeObserver(J=>{ce(m||J[0].target.clientWidth||620),ue(A||J[0].target.clientHeight||480)});return G.current&&(ue(G.current.clientHeight||480),ce(G.current.clientWidth||620),m||i.observe(G.current)),()=>i.disconnect()},[m,A]),t.jsxRuntimeExports.jsx("div",{className:`${E||"light"} flex ${m?"w-fit grow-0":"w-full grow"}`,dir:U==="he"||U==="ar"?"rtl":void 0,children:t.jsxRuntimeExports.jsx("div",{className:t.mo(`${S?S===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${U||"en"}`,m?"w-fit":"w-full",L?.graphContainer),style:{...j?.graphContainer||{},...S&&S!==!0?{backgroundColor:S}:{}},id:re,ref:me,"aria-label":ve||`${I?`The graph shows ${I}. `:""}This is a multi-line chart that shows trends over time.${P?` ${P}`:""}`,children:t.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:S?Q||"1rem":Q||0},children:t.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[I||P||O||V?t.jsxRuntimeExports.jsx(Je.GraphHeader,{styles:{title:j?.title,description:j?.description},classNames:{title:L?.title,description:L?.description},graphTitle:I,graphDescription:P,width:m,graphDownload:O?me.current:void 0,dataDownload:V?s.map(i=>i.data).filter(i=>i!==void 0).length>0?s.map(i=>i.data).filter(i=>i!==void 0):s.filter(i=>i!==void 0):null}):null,t.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:s.length===0?t.jsxRuntimeExports.jsx(Ke.EmptyState,{}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[ie&&s.filter(i=>i.color).length!==0?t.jsxRuntimeExports.jsx(Qe.ColorLegendWithMouseOver,{width:m,colorLegendTitle:R,colors:a||q.Colors[E].categoricalColors.colors,colorDomain:u||fe.uniqBy(s.filter(i=>i.color),"color").map(i=>i.color).filter(i=>i!==void 0),setSelectedColor:M,showNAColor:K}):null,t.jsxRuntimeExports.jsx("div",{className:"w-full grow leading-0",ref:G,"aria-label":"Graph area",children:(m||W)&&(A||xe)?t.jsxRuntimeExports.jsx(Ze,{data:s,lineColors:s.filter(i=>i.color).length===0?a?[a]:[q.Colors.primaryColors["blue-600"]]:a||q.Colors[E].categoricalColors.colors,width:m||W,height:Math.max(D,A||(B?D?(m||W)*B>D?(m||W)*B:D:(m||W)*B:xe)),dateFormat:T,noOfXTicks:ee,leftMargin:X,rightMargin:te,topMargin:N,bottomMargin:r,tooltip:k,onSeriesMouseOver:ye,suffix:pe,prefix:ge,highlightAreaSettings:we,refValues:oe,minValue:ne,maxValue:z,highlightedLines:v,animate:g===!0?{duration:.5,once:!0,amount:.5}:g||{duration:0,once:!0,amount:0},rtl:U==="he"||U==="ar",strokeWidth:be,showDots:se,annotations:ae,customHighlightAreaSettings:y,yAxisTitle:Oe,noOfYTicks:l,minDate:Ce,maxDate:Z,curveType:f,styles:j,classNames:L,selectedColor:b,showLabels:je,colorDomain:s.filter(i=>i.color).length===0?[]:u||fe.uniqBy(s.filter(i=>i.color),"color").map(i=>i.color),dimmedOpacity:F,precision:le,customLayers:H,naLabel:w}):null})]})}),_||C?t.jsxRuntimeExports.jsx(ze.GraphFooter,{styles:{footnote:j?.footnote,source:j?.source},classNames:{footnote:L?.footnote,source:L?.source},sources:_,footNote:C,width:m}):null]})})})})}exports.MultiLineAltChart=_e;
2
2
  //# sourceMappingURL=MultiLineAltChart.cjs.map
@@ -1,10 +1,10 @@
1
1
  import { j as t, m as xe } from "./index-CHPV5EwG-BPSP-7Jg.js";
2
2
  import { useRef as ge, useState as G, useEffect as Me } from "react";
3
- import { u as ue } from "./index-CaAIPGZo.js";
3
+ import { u as ue } from "./index-AqnpA7_O.js";
4
4
  import { p as u, f as Ve } from "./parse-DlCRUFh_.js";
5
- import { s as $e } from "./index-DxagiOHo.js";
5
+ import { s as $e } from "./index-fwdktvAS.js";
6
6
  import { n as Se } from "./numberFormattingFunction-14YCbkN2.js";
7
- import { T as He } from "./Tooltip-DyM5snqx.js";
7
+ import { T as He } from "./Tooltip-CVCGWyzw.js";
8
8
  import { c as x } from "./checkIfNullOrUndefined-DmfiKkNw.js";
9
9
  import { C as We, g as Ie, A as Re } from "./customArea-B-dWU0zZ.js";
10
10
  import { A as Ye } from "./AxisTitle-BmHLMRJZ.js";
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-CHPV5EwG-DDoeWRVt.cjs"),f=require("react"),m=require("./parse-hMnG_lRV.cjs"),Ie=require("./index-BzeLQvXk.cjs"),Ne=require("./numberFormattingFunction-02t-wJta.cjs"),Se=require("./Tooltip-n8z5bfav.cjs"),h=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),be=require("./customArea-CK768gCn.cjs"),De=require("./AxisTitle-CK9YeovX.cjs"),Te=require("./Axis-DE7dSn1_.cjs"),qe=require("./XTicksAndGridLines-CCzXIV8d.cjs"),$e=require("./ReferenceLine-CFVBBN__.cjs"),Me=require("./YTicksAndGridLines-DBDuz6vb.cjs"),Ve=require("./index-BYzIB5V6.cjs"),Fe=require("./time-Byw_jYQ7.cjs"),He=require("./linear-BVckp9RD.cjs"),Le=require("./line-DHV4JwCR.cjs"),xe=require("./step-BZ3C8QFW.cjs"),Ue=require("./select-Bnfk0lJx.cjs"),Ge=require("./init-DU0ybBc_.cjs"),Pe=require("./pointer-Dkq5NV1q.cjs"),We=require("./use-in-view-sQJZ_xDO.cjs"),T=require("./proxy-BHRoeZgd.cjs"),Ye=require("./GraphFooter.cjs"),Xe=require("./GraphHeader.cjs"),Be=require("./ColorLegend.cjs"),ze=require("./Colors.cjs"),_e=require("./EmptyState-d8_8SxeW.cjs"),Je=require("./generateRandomString-B5zBiJzS.cjs");function Ke(ue){const{data:N,width:A,height:q,lineColors:L,dateFormat:l,noOfXTicks:de,labels:R,rightMargin:$,topMargin:x,bottomMargin:_,suffix:M,prefix:V,leftMargin:E,tooltip:G,onSeriesMouseOver:P,showValues:k,showColorLegendAtTop:me,refValues:J,highlightAreaSettings:he,minValue:F,maxValue:K,highlightedLines:b,animate:s,rtl:W,strokeWidth:pe,showDots:ge,annotations:fe,customHighlightAreaSettings:ye,yAxisTitle:Q,noOfYTicks:je,minDate:Y,maxDate:X,curveType:I,styles:c,classNames:y,dimmedOpacity:S,precision:H,customLayers:Z,dashedLines:B,dashSettings:ee,labelsToBeHidden:we,revealClipId:te}=ue,ie=f.useRef(null),u=We.useInView(ie,{once:s.once,amount:s.amount}),[O,ve]=f.useState(!1);f.useEffect(()=>{if(u&&!O){const e=setTimeout(()=>{ve(!0)},(s.duration+.5)*1e3);return()=>clearTimeout(e)}},[u,O,s.duration]);const Re=I==="linear"?Le.curveLinear:I==="step"?xe.curveStep:I==="stepAfter"?xe.stepAfter:I==="stepBefore"?xe.stepBefore:xe.monotoneX,[j,C]=f.useState(void 0),[ne,se]=f.useState(void 0),[re,ae]=f.useState(void 0),w={top:x,bottom:_,left:Q?E+30:E,right:$},z=f.useRef(null),r=Ie.sortBy(N.map(e=>({...e,date:m.parse(`${e.date}`,l,new Date)})),"date"),D=r[0].y.map((e,i)=>r.map(n=>({...n,y:n.y[i]})).filter(n=>!h.checkIfNullOrUndefined(n.y))),oe=he.map(e=>({...e,coordinates:[e.coordinates[0]===null?null:m.parse(`${e.coordinates[0]}`,l,new Date),e.coordinates[1]===null?null:m.parse(`${e.coordinates[1]}`,l,new Date)]})),le=ye.map(e=>({...e,coordinates:e.coordinates.map((i,n)=>n%2===0?m.parse(`${i}`,l,new Date):i)})),p=A-w.left-w.right,g=q-w.top-w.bottom,ce=Y?m.parse(`${Y}`,l,new Date):r[0].date,d=X?m.parse(`${X}`,l,new Date):r[r.length-1].date,v=h.checkIfNullOrUndefined(F)?Math.min(...r.map(e=>Math.min(...e.y.filter(i=>!h.checkIfNullOrUndefined(i)))))?Math.min(...r.map(e=>Math.min(...e.y.filter(i=>!h.checkIfNullOrUndefined(i)))))>0?0:Math.min(...r.map(e=>Math.min(...e.y.filter(i=>!h.checkIfNullOrUndefined(i))))):0:F,Ee=Math.max(...r.map(e=>Math.max(...e.y.filter(i=>!h.checkIfNullOrUndefined(i)))))?Math.max(...r.map(e=>Math.max(...e.y.filter(i=>!h.checkIfNullOrUndefined(i))))):0,a=Fe.time().domain([ce,d]).range([0,p]),o=He.linear().domain([h.checkIfNullOrUndefined(F)?v:F,h.checkIfNullOrUndefined(K)?Ee>0?Ee:0:K]).range([g,0]).nice(),Ce=Le.line().x(e=>a(e.date)).y(e=>o(e.y)).curve(Re),Ae=o.ticks(je),ke=a.ticks(de);return f.useEffect(()=>{const e=n=>{const U=r[Ge.bisectCenter(r.map(Oe=>Oe.date),a.invert(Pe.pointer(n)[0]),0)];C(U||r[r.length-1]),ae(n.clientY),se(n.clientX),P?.(U||r[r.length-1])},i=()=>{C(void 0),se(void 0),ae(void 0)};Ue.select(z.current).on("mousemove",e).on("mouseout",i),P?.(void 0)},[a,r,P]),t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(T.motion.svg,{width:`${A}px`,height:`${q}px`,viewBox:`0 0 ${A} ${q}`,direction:"ltr",ref:ie,children:t.jsxRuntimeExports.jsxs("g",{transform:`translate(${w.left},${w.top})`,children:[t.jsxRuntimeExports.jsx("defs",{children:t.jsxRuntimeExports.jsx("clipPath",{id:te,children:t.jsxRuntimeExports.jsx(T.motion.rect,{x:0,y:0,height:g,variants:{initial:{width:0},whileInView:{width:p,transition:{duration:s.duration}}},initial:"initial",animate:u?"whileInView":"initial"})})}),t.jsxRuntimeExports.jsx(Ve.HighlightArea,{areaSettings:oe,width:p,height:g,scale:a,animate:s,isInView:u}),t.jsxRuntimeExports.jsx(be.CustomArea,{areaSettings:le,scaleX:a,scaleY:o,animate:s,isInView:u}),t.jsxRuntimeExports.jsxs("g",{children:[t.jsxRuntimeExports.jsx(Me.YTicksAndGridLines,{values:Ae.filter(e=>e!==0),y:Ae.filter(e=>e!==0).map(e=>o(e)),x1:0-E,x2:p+w.right,styles:{gridLines:c?.yAxis?.gridLines,labels:c?.yAxis?.labels},classNames:{gridLines:y?.yAxis?.gridLines,labels:y?.yAxis?.labels},suffix:M,prefix:V,labelType:"secondary",showGridLines:!0,labelPos:"vertical",precision:H}),t.jsxRuntimeExports.jsx(Te.Axis,{y1:o(v<0?0:v),y2:o(v<0?0:v),x1:0-E,x2:p+w.right,label:Ne.numberFormattingFunction(v<0?0:v,"NA",H,V,M),labelPos:{x:0-E,y:o(v<0?0:v),dx:0,dy:Ee<0?"1em":-5},classNames:{axis:y?.xAxis?.axis,label:y?.yAxis?.labels},styles:{axis:c?.xAxis?.axis,label:c?.yAxis?.labels}}),t.jsxRuntimeExports.jsx(De.AxisTitle,{x:0-E-15,y:g/2,style:c?.yAxis?.title,className:y?.yAxis?.title,text:Q,rotate90:!0})]}),t.jsxRuntimeExports.jsx("g",{children:t.jsxRuntimeExports.jsx(qe.XTicksAndGridLines,{values:ke.map(e=>m.format(e,l)),x:ke.map(e=>a(e)),y1:0,y2:g,styles:{gridLines:c?.xAxis?.gridLines,labels:c?.xAxis?.labels},classNames:{gridLines:t.mo("opacity-0",y?.xAxis?.gridLines),labels:t.mo("fill-primary-gray-700 dark:fill-primary-gray-300 xs:max-[360px]:hidden text-[9px] md:text-[10px] lg:text-xs",y?.xAxis?.labels)},suffix:M,prefix:V,labelType:"primary",showGridLines:!0,precision:H})}),Z.filter(e=>e.position==="before").map(e=>e.layer),t.jsxRuntimeExports.jsxs("g",{children:[D.map((e,i)=>t.jsxRuntimeExports.jsxs(T.motion.g,{exit:{opacity:0,transition:{duration:s.duration}},variants:{initial:{opacity:b.length!==0?b.indexOf(R[i])!==-1?1:S:1},whileInView:{opacity:b.length!==0?b.indexOf(R[i])!==-1?1:S:1,transition:{duration:s.duration}}},initial:"initial",animate:u?"whileInView":"initial",children:[t.jsxRuntimeExports.jsx(T.motion.path,{style:{fill:"none",strokeWidth:pe},clipPath:`url(#${te})`,exit:{opacity:0,transition:{duration:s.duration}},variants:{initial:{...B.length===0?{pathLength:0}:{},d:Ce(e.filter(n=>!h.checkIfNullOrUndefined(n.y)))||"",opacity:1,stroke:L[i]},whileInView:{...B.length===0?{pathLength:1}:{},d:Ce(e.filter(n=>!h.checkIfNullOrUndefined(n.y)))||"",opacity:1,stroke:L[i],transition:{duration:s.duration}}},strokeDasharray:B.includes(R[i])?ee[i%ee.length]:void 0,initial:"initial",animate:u?"whileInView":"initial"}),e.map((n,U)=>t.jsxRuntimeExports.jsx("g",{children:h.checkIfNullOrUndefined(n.y)?null:t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[ge?t.jsxRuntimeExports.jsx(T.motion.circle,{r:p/r.length<5?0:p/r.length<20?2:4,style:{fill:L[i]},exit:{opacity:0,transition:{duration:s.duration}},variants:{initial:{opacity:0,cx:a(n.date),cy:o(n.y)},whileInView:{opacity:1,transition:{duration:O?s.duration:.5,delay:O?0:s.duration},cx:a(n.date),cy:o(n.y)}},initial:"initial",animate:u?"whileInView":"initial"}):null,k?t.jsxRuntimeExports.jsx(T.motion.text,{dy:-8,style:{fill:L[i],textAnchor:"middle",...c?.graphObjectValues||{}},className:t.mo("graph-value text-xs font-bold",y?.graphObjectValues),exit:{opacity:0,transition:{duration:s.duration}},variants:{initial:{opacity:0,x:a(n.date),y:o(n.y)},whileInView:{opacity:1,x:a(n.date),y:o(n.y),transition:{duration:O?s.duration:.5,delay:O?0:s.duration}}},initial:"initial",animate:u?"whileInView":"initial",children:Ne.numberFormattingFunction(n.y,"NA",H,V,M)}):null]})},U)),me||we.includes(R[i])?null:t.jsxRuntimeExports.jsx(T.motion.text,{style:{fill:L[i]},className:"text-xs",dx:5,dy:4,exit:{opacity:0,transition:{duration:s.duration}},variants:{initial:{opacity:0,x:a(e[e.length-1].date),y:o(e[e.length-1].y)},whileInView:{opacity:1,x:a(e[e.length-1].date),y:o(e[e.length-1].y),transition:{duration:O?s.duration:.5,delay:O?0:s.duration}}},initial:"initial",animate:u?"whileInView":"initial",children:R[i]})]},R[i])),j?t.jsxRuntimeExports.jsx("line",{y1:0,y2:g,x1:a(j.date),x2:a(j.date),className:t.mo("undp-tick-line stroke-primary-gray-700 dark:stroke-primary-gray-100",y?.mouseOverLine),style:c?.mouseOverLine}):null]}),J?t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:J.map((e,i)=>t.jsxRuntimeExports.jsx($e.RefLineY,{text:e.text,color:e.color,y:o(e.value),x1:0-E,x2:p+w.right,classNames:e.classNames,styles:e.styles,animate:s,isInView:u},i))}):null,t.jsxRuntimeExports.jsx("g",{children:fe.map((e,i)=>{const n=be.getLineEndPoint({x:e.xCoordinate?a(m.parse(`${e.xCoordinate}`,l,new Date))+(e.xOffset||0):0+(e.xOffset||0),y:e.yCoordinate?o(e.yCoordinate)+(e.yOffset||0)-8:0+(e.yOffset||0)-8},{x:e.xCoordinate?a(m.parse(`${e.xCoordinate}`,l,new Date)):0,y:e.yCoordinate?o(e.yCoordinate):0},h.checkIfNullOrUndefined(e.connectorRadius)?3.5:e.connectorRadius),U=e.showConnector?{y1:n.y,x1:n.x,y2:e.yCoordinate?o(e.yCoordinate)+(e.yOffset||0):0+(e.yOffset||0),x2:e.xCoordinate?a(m.parse(`${e.xCoordinate}`,l,new Date))+(e.xOffset||0):0+(e.xOffset||0),cy:e.yCoordinate?o(e.yCoordinate):0,cx:e.xCoordinate?a(m.parse(`${e.xCoordinate}`,l,new Date)):0,circleRadius:h.checkIfNullOrUndefined(e.connectorRadius)?3.5:e.connectorRadius,strokeWidth:e.showConnector===!0?2:Math.min(e.showConnector||0,1)}:void 0,Oe={y:e.yCoordinate?o(e.yCoordinate)+(e.yOffset||0)-8:0+(e.yOffset||0)-8,x:W?0:e.xCoordinate?a(m.parse(`${e.xCoordinate}`,l,new Date))+(e.xOffset||0):0+(e.xOffset||0),width:W?e.xCoordinate?a(m.parse(`${e.xCoordinate}`,l,new Date))+(e.xOffset||0):0+(e.xOffset||0):p+w.right-(e.xCoordinate?a(m.parse(`${e.xCoordinate}`,l,new Date))+(e.xOffset||0):0+(e.xOffset||0)),maxWidth:e.maxWidth,fontWeight:e.fontWeight,align:e.align};return t.jsxRuntimeExports.jsx(be.Annotation,{color:e.color,connectorsSettings:U,labelSettings:Oe,text:e.text,classNames:e.classNames,styles:e.styles,animate:s,isInView:u},i)})}),Z.filter(e=>e.position==="after").map(e=>e.layer),t.jsxRuntimeExports.jsx("rect",{ref:z,style:{fill:"none",pointerEvents:"all"},width:p,height:g})]})}),j&&G&&ne&&re?t.jsxRuntimeExports.jsx(Se.Tooltip,{data:j,body:G,xPos:ne,yPos:re,backgroundStyle:c?.tooltip,className:y?.tooltip}):null]})}function Qe(ue){const{data:N,graphTitle:A,lineColors:q=ze.Colors.light.categoricalColors.colors,suffix:L="",sources:l,prefix:de="",graphDescription:R,height:$,width:x,footNote:_,noOfXTicks:M=10,dateFormat:V="yyyy",labels:E,padding:G,showValues:P=!1,backgroundColor:k=!1,leftMargin:me=30,rightMargin:J=50,topMargin:he=20,bottomMargin:F=25,tooltip:K,relativeHeight:b,onSeriesMouseOver:s,showColorLegendAtTop:W=!1,refValues:pe=[],highlightAreaSettings:ge=[],graphID:fe,minValue:ye,maxValue:Q,highlightedLines:je=[],graphDownload:Y=!1,dataDownload:X=!1,animate:I=!1,language:c="en",colorLegendTitle:y,minHeight:S=0,strokeWidth:H=2,showDots:Z=!0,annotations:B=[],customHighlightAreaSettings:ee=[],theme:we="light",ariaLabel:te,yAxisTitle:ie,noOfYTicks:u=5,minDate:O,maxDate:ve,curveType:Re="curve",styles:j,classNames:C,dimmedOpacity:ne=.3,precision:se=2,customLayers:re=[],dashedLines:ae=[],dashSettings:w=["5 5"],labelsToBeHidden:z=[],showColorScale:r=!0}=ue,[D,oe]=f.useState(0),[le,p]=f.useState(0),g=f.useRef(null),ce=f.useRef(null);return f.useEffect(()=>{const d=new ResizeObserver(v=>{oe(x||v[0].target.clientWidth||620),p($||v[0].target.clientHeight||480)});return g.current&&(p(g.current.clientHeight||480),oe(g.current.clientWidth||620),x||d.observe(g.current)),()=>d.disconnect()},[x,$]),t.jsxRuntimeExports.jsx("div",{className:`${we||"light"} flex ${x?"w-fit grow-0":"w-full grow"}`,dir:c==="he"||c==="ar"?"rtl":void 0,children:t.jsxRuntimeExports.jsx("div",{className:t.mo(`${k?k===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${c||"en"}`,x?"w-fit":"w-full",C?.graphContainer),style:{...j?.graphContainer||{},...k&&k!==!0?{backgroundColor:k}:{}},id:fe,ref:ce,"aria-label":te||`${A?`The graph shows ${A}. `:""}This is a multi-line chart that shows trends over time.${R?` ${R}`:""}`,children:t.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:k?G||"1rem":G||0},children:t.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[A||R||Y||X?t.jsxRuntimeExports.jsx(Xe.GraphHeader,{styles:{title:j?.title,description:j?.description},classNames:{title:C?.title,description:C?.description},graphTitle:A,graphDescription:R,width:x,graphDownload:Y?ce.current:void 0,dataDownload:X?N.map(d=>d.data).filter(d=>d!==void 0).length>0?N.map(d=>d.data).filter(d=>d!==void 0):N.filter(d=>d!==void 0):null}):null,t.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:N.length===0?t.jsxRuntimeExports.jsx(_e.EmptyState,{}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[W&&r?t.jsxRuntimeExports.jsx(Be.ColorLegend,{colorDomain:E,colorLegendTitle:y,labelsToBeHidden:z,colors:q,showNAColor:!1}):null,t.jsxRuntimeExports.jsx("div",{className:"w-full grow leading-0",ref:g,"aria-label":"Graph area",children:(x||D)&&($||le)?t.jsxRuntimeExports.jsx(Ke,{data:N,lineColors:q,width:x||D,height:Math.max(S,$||(b?S?(x||D)*b>S?(x||D)*b:S:(x||D)*b:le)),dateFormat:V,noOfXTicks:M,leftMargin:me,rightMargin:J,topMargin:he,bottomMargin:F,labels:E,tooltip:K,onSeriesMouseOver:s,showColorLegendAtTop:r?W:!0,showValues:P,suffix:L,prefix:de,highlightAreaSettings:ge,refValues:pe,minValue:ye,maxValue:Q,highlightedLines:je,animate:I===!0?{duration:.5,once:!0,amount:.5}:I||{duration:0,once:!0,amount:0},rtl:c==="he"||c==="ar",strokeWidth:H,showDots:Z,annotations:B,customHighlightAreaSettings:ee,yAxisTitle:ie,noOfYTicks:u,minDate:O,maxDate:ve,curveType:Re,styles:j,classNames:C,dimmedOpacity:ne,precision:se,customLayers:re,labelsToBeHidden:z,dashedLines:ae,dashSettings:w,revealClipId:Je.generateRandomString(8)}):null})]})}),l||_?t.jsxRuntimeExports.jsx(Ye.GraphFooter,{styles:{footnote:j?.footnote,source:j?.source},classNames:{footnote:C?.footnote,source:C?.source},sources:l,footNote:_,width:x}):null]})})})})}exports.MultiLineChart=Qe;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-CHPV5EwG-DDoeWRVt.cjs"),f=require("react"),m=require("./parse-hMnG_lRV.cjs"),Ie=require("./index-DYH8g9WA.cjs"),Ne=require("./numberFormattingFunction-02t-wJta.cjs"),Se=require("./Tooltip-De16GWhY.cjs"),h=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),be=require("./customArea-CK768gCn.cjs"),De=require("./AxisTitle-CK9YeovX.cjs"),Te=require("./Axis-DE7dSn1_.cjs"),qe=require("./XTicksAndGridLines-CCzXIV8d.cjs"),$e=require("./ReferenceLine-CFVBBN__.cjs"),Me=require("./YTicksAndGridLines-DBDuz6vb.cjs"),Ve=require("./index-BYzIB5V6.cjs"),Fe=require("./time-Byw_jYQ7.cjs"),He=require("./linear-BVckp9RD.cjs"),Le=require("./line-DHV4JwCR.cjs"),xe=require("./step-BZ3C8QFW.cjs"),Ue=require("./select-Bnfk0lJx.cjs"),Ge=require("./init-DU0ybBc_.cjs"),Pe=require("./pointer-Dkq5NV1q.cjs"),We=require("./use-in-view-sQJZ_xDO.cjs"),T=require("./proxy-BHRoeZgd.cjs"),Ye=require("./GraphFooter.cjs"),Xe=require("./GraphHeader.cjs"),Be=require("./ColorLegend.cjs"),ze=require("./Colors.cjs"),_e=require("./EmptyState-d8_8SxeW.cjs"),Je=require("./generateRandomString-B5zBiJzS.cjs");function Ke(ue){const{data:N,width:A,height:q,lineColors:L,dateFormat:l,noOfXTicks:de,labels:R,rightMargin:$,topMargin:x,bottomMargin:_,suffix:M,prefix:V,leftMargin:E,tooltip:G,onSeriesMouseOver:P,showValues:k,showColorLegendAtTop:me,refValues:J,highlightAreaSettings:he,minValue:F,maxValue:K,highlightedLines:b,animate:s,rtl:W,strokeWidth:pe,showDots:ge,annotations:fe,customHighlightAreaSettings:ye,yAxisTitle:Q,noOfYTicks:je,minDate:Y,maxDate:X,curveType:I,styles:c,classNames:y,dimmedOpacity:S,precision:H,customLayers:Z,dashedLines:B,dashSettings:ee,labelsToBeHidden:we,revealClipId:te}=ue,ie=f.useRef(null),u=We.useInView(ie,{once:s.once,amount:s.amount}),[O,ve]=f.useState(!1);f.useEffect(()=>{if(u&&!O){const e=setTimeout(()=>{ve(!0)},(s.duration+.5)*1e3);return()=>clearTimeout(e)}},[u,O,s.duration]);const Re=I==="linear"?Le.curveLinear:I==="step"?xe.curveStep:I==="stepAfter"?xe.stepAfter:I==="stepBefore"?xe.stepBefore:xe.monotoneX,[j,C]=f.useState(void 0),[ne,se]=f.useState(void 0),[re,ae]=f.useState(void 0),w={top:x,bottom:_,left:Q?E+30:E,right:$},z=f.useRef(null),r=Ie.sortBy(N.map(e=>({...e,date:m.parse(`${e.date}`,l,new Date)})),"date"),D=r[0].y.map((e,i)=>r.map(n=>({...n,y:n.y[i]})).filter(n=>!h.checkIfNullOrUndefined(n.y))),oe=he.map(e=>({...e,coordinates:[e.coordinates[0]===null?null:m.parse(`${e.coordinates[0]}`,l,new Date),e.coordinates[1]===null?null:m.parse(`${e.coordinates[1]}`,l,new Date)]})),le=ye.map(e=>({...e,coordinates:e.coordinates.map((i,n)=>n%2===0?m.parse(`${i}`,l,new Date):i)})),p=A-w.left-w.right,g=q-w.top-w.bottom,ce=Y?m.parse(`${Y}`,l,new Date):r[0].date,d=X?m.parse(`${X}`,l,new Date):r[r.length-1].date,v=h.checkIfNullOrUndefined(F)?Math.min(...r.map(e=>Math.min(...e.y.filter(i=>!h.checkIfNullOrUndefined(i)))))?Math.min(...r.map(e=>Math.min(...e.y.filter(i=>!h.checkIfNullOrUndefined(i)))))>0?0:Math.min(...r.map(e=>Math.min(...e.y.filter(i=>!h.checkIfNullOrUndefined(i))))):0:F,Ee=Math.max(...r.map(e=>Math.max(...e.y.filter(i=>!h.checkIfNullOrUndefined(i)))))?Math.max(...r.map(e=>Math.max(...e.y.filter(i=>!h.checkIfNullOrUndefined(i))))):0,a=Fe.time().domain([ce,d]).range([0,p]),o=He.linear().domain([h.checkIfNullOrUndefined(F)?v:F,h.checkIfNullOrUndefined(K)?Ee>0?Ee:0:K]).range([g,0]).nice(),Ce=Le.line().x(e=>a(e.date)).y(e=>o(e.y)).curve(Re),Ae=o.ticks(je),ke=a.ticks(de);return f.useEffect(()=>{const e=n=>{const U=r[Ge.bisectCenter(r.map(Oe=>Oe.date),a.invert(Pe.pointer(n)[0]),0)];C(U||r[r.length-1]),ae(n.clientY),se(n.clientX),P?.(U||r[r.length-1])},i=()=>{C(void 0),se(void 0),ae(void 0)};Ue.select(z.current).on("mousemove",e).on("mouseout",i),P?.(void 0)},[a,r,P]),t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(T.motion.svg,{width:`${A}px`,height:`${q}px`,viewBox:`0 0 ${A} ${q}`,direction:"ltr",ref:ie,children:t.jsxRuntimeExports.jsxs("g",{transform:`translate(${w.left},${w.top})`,children:[t.jsxRuntimeExports.jsx("defs",{children:t.jsxRuntimeExports.jsx("clipPath",{id:te,children:t.jsxRuntimeExports.jsx(T.motion.rect,{x:0,y:0,height:g,variants:{initial:{width:0},whileInView:{width:p,transition:{duration:s.duration}}},initial:"initial",animate:u?"whileInView":"initial"})})}),t.jsxRuntimeExports.jsx(Ve.HighlightArea,{areaSettings:oe,width:p,height:g,scale:a,animate:s,isInView:u}),t.jsxRuntimeExports.jsx(be.CustomArea,{areaSettings:le,scaleX:a,scaleY:o,animate:s,isInView:u}),t.jsxRuntimeExports.jsxs("g",{children:[t.jsxRuntimeExports.jsx(Me.YTicksAndGridLines,{values:Ae.filter(e=>e!==0),y:Ae.filter(e=>e!==0).map(e=>o(e)),x1:0-E,x2:p+w.right,styles:{gridLines:c?.yAxis?.gridLines,labels:c?.yAxis?.labels},classNames:{gridLines:y?.yAxis?.gridLines,labels:y?.yAxis?.labels},suffix:M,prefix:V,labelType:"secondary",showGridLines:!0,labelPos:"vertical",precision:H}),t.jsxRuntimeExports.jsx(Te.Axis,{y1:o(v<0?0:v),y2:o(v<0?0:v),x1:0-E,x2:p+w.right,label:Ne.numberFormattingFunction(v<0?0:v,"NA",H,V,M),labelPos:{x:0-E,y:o(v<0?0:v),dx:0,dy:Ee<0?"1em":-5},classNames:{axis:y?.xAxis?.axis,label:y?.yAxis?.labels},styles:{axis:c?.xAxis?.axis,label:c?.yAxis?.labels}}),t.jsxRuntimeExports.jsx(De.AxisTitle,{x:0-E-15,y:g/2,style:c?.yAxis?.title,className:y?.yAxis?.title,text:Q,rotate90:!0})]}),t.jsxRuntimeExports.jsx("g",{children:t.jsxRuntimeExports.jsx(qe.XTicksAndGridLines,{values:ke.map(e=>m.format(e,l)),x:ke.map(e=>a(e)),y1:0,y2:g,styles:{gridLines:c?.xAxis?.gridLines,labels:c?.xAxis?.labels},classNames:{gridLines:t.mo("opacity-0",y?.xAxis?.gridLines),labels:t.mo("fill-primary-gray-700 dark:fill-primary-gray-300 xs:max-[360px]:hidden text-[9px] md:text-[10px] lg:text-xs",y?.xAxis?.labels)},suffix:M,prefix:V,labelType:"primary",showGridLines:!0,precision:H})}),Z.filter(e=>e.position==="before").map(e=>e.layer),t.jsxRuntimeExports.jsxs("g",{children:[D.map((e,i)=>t.jsxRuntimeExports.jsxs(T.motion.g,{exit:{opacity:0,transition:{duration:s.duration}},variants:{initial:{opacity:b.length!==0?b.indexOf(R[i])!==-1?1:S:1},whileInView:{opacity:b.length!==0?b.indexOf(R[i])!==-1?1:S:1,transition:{duration:s.duration}}},initial:"initial",animate:u?"whileInView":"initial",children:[t.jsxRuntimeExports.jsx(T.motion.path,{style:{fill:"none",strokeWidth:pe},clipPath:`url(#${te})`,exit:{opacity:0,transition:{duration:s.duration}},variants:{initial:{...B.length===0?{pathLength:0}:{},d:Ce(e.filter(n=>!h.checkIfNullOrUndefined(n.y)))||"",opacity:1,stroke:L[i]},whileInView:{...B.length===0?{pathLength:1}:{},d:Ce(e.filter(n=>!h.checkIfNullOrUndefined(n.y)))||"",opacity:1,stroke:L[i],transition:{duration:s.duration}}},strokeDasharray:B.includes(R[i])?ee[i%ee.length]:void 0,initial:"initial",animate:u?"whileInView":"initial"}),e.map((n,U)=>t.jsxRuntimeExports.jsx("g",{children:h.checkIfNullOrUndefined(n.y)?null:t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[ge?t.jsxRuntimeExports.jsx(T.motion.circle,{r:p/r.length<5?0:p/r.length<20?2:4,style:{fill:L[i]},exit:{opacity:0,transition:{duration:s.duration}},variants:{initial:{opacity:0,cx:a(n.date),cy:o(n.y)},whileInView:{opacity:1,transition:{duration:O?s.duration:.5,delay:O?0:s.duration},cx:a(n.date),cy:o(n.y)}},initial:"initial",animate:u?"whileInView":"initial"}):null,k?t.jsxRuntimeExports.jsx(T.motion.text,{dy:-8,style:{fill:L[i],textAnchor:"middle",...c?.graphObjectValues||{}},className:t.mo("graph-value text-xs font-bold",y?.graphObjectValues),exit:{opacity:0,transition:{duration:s.duration}},variants:{initial:{opacity:0,x:a(n.date),y:o(n.y)},whileInView:{opacity:1,x:a(n.date),y:o(n.y),transition:{duration:O?s.duration:.5,delay:O?0:s.duration}}},initial:"initial",animate:u?"whileInView":"initial",children:Ne.numberFormattingFunction(n.y,"NA",H,V,M)}):null]})},U)),me||we.includes(R[i])?null:t.jsxRuntimeExports.jsx(T.motion.text,{style:{fill:L[i]},className:"text-xs",dx:5,dy:4,exit:{opacity:0,transition:{duration:s.duration}},variants:{initial:{opacity:0,x:a(e[e.length-1].date),y:o(e[e.length-1].y)},whileInView:{opacity:1,x:a(e[e.length-1].date),y:o(e[e.length-1].y),transition:{duration:O?s.duration:.5,delay:O?0:s.duration}}},initial:"initial",animate:u?"whileInView":"initial",children:R[i]})]},R[i])),j?t.jsxRuntimeExports.jsx("line",{y1:0,y2:g,x1:a(j.date),x2:a(j.date),className:t.mo("undp-tick-line stroke-primary-gray-700 dark:stroke-primary-gray-100",y?.mouseOverLine),style:c?.mouseOverLine}):null]}),J?t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:J.map((e,i)=>t.jsxRuntimeExports.jsx($e.RefLineY,{text:e.text,color:e.color,y:o(e.value),x1:0-E,x2:p+w.right,classNames:e.classNames,styles:e.styles,animate:s,isInView:u},i))}):null,t.jsxRuntimeExports.jsx("g",{children:fe.map((e,i)=>{const n=be.getLineEndPoint({x:e.xCoordinate?a(m.parse(`${e.xCoordinate}`,l,new Date))+(e.xOffset||0):0+(e.xOffset||0),y:e.yCoordinate?o(e.yCoordinate)+(e.yOffset||0)-8:0+(e.yOffset||0)-8},{x:e.xCoordinate?a(m.parse(`${e.xCoordinate}`,l,new Date)):0,y:e.yCoordinate?o(e.yCoordinate):0},h.checkIfNullOrUndefined(e.connectorRadius)?3.5:e.connectorRadius),U=e.showConnector?{y1:n.y,x1:n.x,y2:e.yCoordinate?o(e.yCoordinate)+(e.yOffset||0):0+(e.yOffset||0),x2:e.xCoordinate?a(m.parse(`${e.xCoordinate}`,l,new Date))+(e.xOffset||0):0+(e.xOffset||0),cy:e.yCoordinate?o(e.yCoordinate):0,cx:e.xCoordinate?a(m.parse(`${e.xCoordinate}`,l,new Date)):0,circleRadius:h.checkIfNullOrUndefined(e.connectorRadius)?3.5:e.connectorRadius,strokeWidth:e.showConnector===!0?2:Math.min(e.showConnector||0,1)}:void 0,Oe={y:e.yCoordinate?o(e.yCoordinate)+(e.yOffset||0)-8:0+(e.yOffset||0)-8,x:W?0:e.xCoordinate?a(m.parse(`${e.xCoordinate}`,l,new Date))+(e.xOffset||0):0+(e.xOffset||0),width:W?e.xCoordinate?a(m.parse(`${e.xCoordinate}`,l,new Date))+(e.xOffset||0):0+(e.xOffset||0):p+w.right-(e.xCoordinate?a(m.parse(`${e.xCoordinate}`,l,new Date))+(e.xOffset||0):0+(e.xOffset||0)),maxWidth:e.maxWidth,fontWeight:e.fontWeight,align:e.align};return t.jsxRuntimeExports.jsx(be.Annotation,{color:e.color,connectorsSettings:U,labelSettings:Oe,text:e.text,classNames:e.classNames,styles:e.styles,animate:s,isInView:u},i)})}),Z.filter(e=>e.position==="after").map(e=>e.layer),t.jsxRuntimeExports.jsx("rect",{ref:z,style:{fill:"none",pointerEvents:"all"},width:p,height:g})]})}),j&&G&&ne&&re?t.jsxRuntimeExports.jsx(Se.Tooltip,{data:j,body:G,xPos:ne,yPos:re,backgroundStyle:c?.tooltip,className:y?.tooltip}):null]})}function Qe(ue){const{data:N,graphTitle:A,lineColors:q=ze.Colors.light.categoricalColors.colors,suffix:L="",sources:l,prefix:de="",graphDescription:R,height:$,width:x,footNote:_,noOfXTicks:M=10,dateFormat:V="yyyy",labels:E,padding:G,showValues:P=!1,backgroundColor:k=!1,leftMargin:me=30,rightMargin:J=50,topMargin:he=20,bottomMargin:F=25,tooltip:K,relativeHeight:b,onSeriesMouseOver:s,showColorLegendAtTop:W=!1,refValues:pe=[],highlightAreaSettings:ge=[],graphID:fe,minValue:ye,maxValue:Q,highlightedLines:je=[],graphDownload:Y=!1,dataDownload:X=!1,animate:I=!1,language:c="en",colorLegendTitle:y,minHeight:S=0,strokeWidth:H=2,showDots:Z=!0,annotations:B=[],customHighlightAreaSettings:ee=[],theme:we="light",ariaLabel:te,yAxisTitle:ie,noOfYTicks:u=5,minDate:O,maxDate:ve,curveType:Re="curve",styles:j,classNames:C,dimmedOpacity:ne=.3,precision:se=2,customLayers:re=[],dashedLines:ae=[],dashSettings:w=["5 5"],labelsToBeHidden:z=[],showColorScale:r=!0}=ue,[D,oe]=f.useState(0),[le,p]=f.useState(0),g=f.useRef(null),ce=f.useRef(null);return f.useEffect(()=>{const d=new ResizeObserver(v=>{oe(x||v[0].target.clientWidth||620),p($||v[0].target.clientHeight||480)});return g.current&&(p(g.current.clientHeight||480),oe(g.current.clientWidth||620),x||d.observe(g.current)),()=>d.disconnect()},[x,$]),t.jsxRuntimeExports.jsx("div",{className:`${we||"light"} flex ${x?"w-fit grow-0":"w-full grow"}`,dir:c==="he"||c==="ar"?"rtl":void 0,children:t.jsxRuntimeExports.jsx("div",{className:t.mo(`${k?k===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${c||"en"}`,x?"w-fit":"w-full",C?.graphContainer),style:{...j?.graphContainer||{},...k&&k!==!0?{backgroundColor:k}:{}},id:fe,ref:ce,"aria-label":te||`${A?`The graph shows ${A}. `:""}This is a multi-line chart that shows trends over time.${R?` ${R}`:""}`,children:t.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:k?G||"1rem":G||0},children:t.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[A||R||Y||X?t.jsxRuntimeExports.jsx(Xe.GraphHeader,{styles:{title:j?.title,description:j?.description},classNames:{title:C?.title,description:C?.description},graphTitle:A,graphDescription:R,width:x,graphDownload:Y?ce.current:void 0,dataDownload:X?N.map(d=>d.data).filter(d=>d!==void 0).length>0?N.map(d=>d.data).filter(d=>d!==void 0):N.filter(d=>d!==void 0):null}):null,t.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:N.length===0?t.jsxRuntimeExports.jsx(_e.EmptyState,{}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[W&&r?t.jsxRuntimeExports.jsx(Be.ColorLegend,{colorDomain:E,colorLegendTitle:y,labelsToBeHidden:z,colors:q,showNAColor:!1}):null,t.jsxRuntimeExports.jsx("div",{className:"w-full grow leading-0",ref:g,"aria-label":"Graph area",children:(x||D)&&($||le)?t.jsxRuntimeExports.jsx(Ke,{data:N,lineColors:q,width:x||D,height:Math.max(S,$||(b?S?(x||D)*b>S?(x||D)*b:S:(x||D)*b:le)),dateFormat:V,noOfXTicks:M,leftMargin:me,rightMargin:J,topMargin:he,bottomMargin:F,labels:E,tooltip:K,onSeriesMouseOver:s,showColorLegendAtTop:r?W:!0,showValues:P,suffix:L,prefix:de,highlightAreaSettings:ge,refValues:pe,minValue:ye,maxValue:Q,highlightedLines:je,animate:I===!0?{duration:.5,once:!0,amount:.5}:I||{duration:0,once:!0,amount:0},rtl:c==="he"||c==="ar",strokeWidth:H,showDots:Z,annotations:B,customHighlightAreaSettings:ee,yAxisTitle:ie,noOfYTicks:u,minDate:O,maxDate:ve,curveType:Re,styles:j,classNames:C,dimmedOpacity:ne,precision:se,customLayers:re,labelsToBeHidden:z,dashedLines:ae,dashSettings:w,revealClipId:Je.generateRandomString(8)}):null})]})}),l||_?t.jsxRuntimeExports.jsx(Ye.GraphFooter,{styles:{footnote:j?.footnote,source:j?.source},classNames:{footnote:C?.footnote,source:C?.source},sources:l,footNote:_,width:x}):null]})})})})}exports.MultiLineChart=Qe;
2
2
  //# sourceMappingURL=MultiLineChart.cjs.map
@@ -1,9 +1,9 @@
1
1
  import { j as e, m as q } from "./index-CHPV5EwG-BPSP-7Jg.js";
2
2
  import { useRef as ht, useState as Y, useEffect as Dt } from "react";
3
3
  import { p as u, f as kt } from "./parse-DlCRUFh_.js";
4
- import { s as Mt } from "./index-DxagiOHo.js";
4
+ import { s as Mt } from "./index-fwdktvAS.js";
5
5
  import { n as Nt } from "./numberFormattingFunction-14YCbkN2.js";
6
- import { T as St } from "./Tooltip-DyM5snqx.js";
6
+ import { T as St } from "./Tooltip-CVCGWyzw.js";
7
7
  import { c as x } from "./checkIfNullOrUndefined-DmfiKkNw.js";
8
8
  import { C as Vt, g as It, A as Ht } from "./customArea-B-dWU0zZ.js";
9
9
  import { A as Rt } from "./AxisTitle-BmHLMRJZ.js";
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CHPV5EwG-DDoeWRVt.cjs"),j=require("react"),gt=require("./index-BXns0-ng.cjs"),wt=require("./Modal-tXZlLE5s.cjs"),ot=require("./numberFormattingFunction-02t-wJta.cjs"),Et=require("./Tooltip-n8z5bfav.cjs"),Rt=require("./string2HTML-D2Avudmb.cjs"),pt=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),dt=require("./Axis-DE7dSn1_.cjs"),ft=require("./AxisTitle-CK9YeovX.cjs"),At=require("./XAxesLabels-OjBNl_lS.cjs"),Mt=require("./band-CAApY4Pd.cjs"),yt=require("./linear-BVckp9RD.cjs"),jt=require("./line-DHV4JwCR.cjs"),lt=require("./step-BZ3C8QFW.cjs"),Ct=require("./use-in-view-sQJZ_xDO.cjs"),P=require("./proxy-BHRoeZgd.cjs"),Nt=require("./index-BW8iNx7E.cjs"),kt=require("./GraphFooter.cjs"),$t=require("./GraphHeader.cjs"),St=require("./ColorLegend.cjs"),xt=require("./Colors.cjs"),qt=require("./EmptyState-d8_8SxeW.cjs");function It(ct){const{data:q,width:M,height:V,barColor:d,lineColor:u,axisTitles:s,sameAxes:b,rightMargin:U,leftMargin:z,topMargin:_,bottomMargin:ut,tooltip:v,showValues:J,onSeriesMouseOver:D,barPadding:mt,truncateBy:K,showLabels:Q,onSeriesMouseClick:w,resetSelectionOnDoubleClick:Z,detailsOnClick:m,noOfTicks:tt,lineSuffix:et,barSuffix:Y,linePrefix:X,barPrefix:it,curveType:F,styles:o,classNames:l,animate:r,precision:H,customLayers:I,naLabel:C,showAxisLabels:st}=ct,nt=j.useRef(null),N=Ct.useInView(nt,{once:r.once,amount:r.amount}),ht=F==="linear"?jt.curveLinear:F==="step"?lt.curveStep:F==="stepAfter"?lt.stepAfter:F==="stepBefore"?lt.stepBefore:lt.monotoneX,[at,k]=j.useState(void 0),[$,L]=j.useState(void 0),[rt,S]=j.useState(void 0),[E,c]=j.useState(void 0),h={top:_,bottom:ut,left:z+50,right:U+65},p=M-h.left-h.right,g=V-h.top-h.bottom,n=q.map((t,A)=>({...t,id:`${A}`})),x=Mt.band().domain(n.map(t=>`${t.id}`)).range([0,p]).paddingInner(mt),W=Math.min(...n.map(t=>t.bar).filter(t=>t!=null))!==1/0?Math.min(...n.map(t=>t.bar).filter(t=>t!=null))>0?0:Math.min(...n.map(t=>t.bar).filter(t=>t!=null)):0,R=Math.min(...n.map(t=>t.line).filter(t=>t!=null))!==1/0?Math.min(...n.map(t=>t.line).filter(t=>t!=null))>0?0:Math.min(...n.map(t=>t.line).filter(t=>t!=null)):0,T=Math.max(...n.map(t=>t.bar).filter(t=>t!=null))!==1/0?Math.max(...n.map(t=>t.bar).filter(t=>t!=null)):0,O=Math.max(...n.map(t=>t.line).filter(t=>t!=null))!==1/0?Math.max(...n.map(t=>t.line).filter(t=>t!=null)):0,G=W<R?W:R,y=T>O?T:O,a=yt.linear().domain([b?G:W,b?y>0?y:0:T>0?T:0]).range([g,0]).nice(),i=yt.linear().domain([b?G:R,b?y>0?y:0:O>0?O:0]).range([g,0]).nice(),B=jt.line().defined(t=>!pt.checkIfNullOrUndefined(t.line)).x(t=>x(`${t.id}`)+x.bandwidth()/2).y(t=>i(t.line)).curve(ht),bt=a.ticks(tt),vt=i.ticks(tt);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(P.motion.svg,{width:`${M}px`,height:`${V}px`,viewBox:`0 0 ${M} ${V}`,direction:"ltr",ref:nt,children:e.jsxRuntimeExports.jsxs("g",{transform:`translate(${h.left},${h.top})`,children:[e.jsxRuntimeExports.jsxs("g",{children:[bt.map((t,A)=>e.jsxRuntimeExports.jsxs("g",{children:[e.jsxRuntimeExports.jsx("line",{y1:a(t),y2:a(t),x1:-15,x2:-20,style:{stroke:d,strokeWidth:1,...o?.yAxis?.gridLines||{}},className:l?.yAxis?.gridLines}),e.jsxRuntimeExports.jsx("text",{x:-25,y:a(t),dy:"0.33em",className:e.mo("text-xs",l?.yAxis?.labels),style:{textAnchor:"end",fill:d,...o?.yAxis?.labels||{}},children:ot.numberFormattingFunction(t,C,H,it,Y)})]},A)),e.jsxRuntimeExports.jsx(dt.Axis,{y1:0,y2:g,x1:-15,x2:-15,classNames:{axis:l?.xAxis?.axis},styles:{axis:{stroke:d,...o?.xAxis?.axis||{}}}}),st?e.jsxRuntimeExports.jsx(ft.AxisTitle,{x:10-h.left,y:g/2,style:{fill:d,...o?.yAxis?.title||{}},className:l?.yAxis?.title,text:s[0].length>100?`${s[0].substring(0,100)}...`:s[0],rotate90:!0}):null]}),e.jsxRuntimeExports.jsxs("g",{children:[vt.map((t,A)=>e.jsxRuntimeExports.jsxs("g",{children:[e.jsxRuntimeExports.jsx("line",{y1:i(t),y2:i(t),x1:p+15,x2:p+20,style:{stroke:u,strokeWidth:1,...o?.yAxis?.gridLines||{}},className:l?.yAxis?.gridLines}),e.jsxRuntimeExports.jsx("text",{x:p+25,y:i(t),dy:"0.33em",dx:-2,style:{textAnchor:"start",fill:u,...o?.yAxis?.labels||{}},className:e.mo("text-xs",l?.yAxis?.labels),children:ot.numberFormattingFunction(t,C,H,X,et)})]},A)),e.jsxRuntimeExports.jsx(dt.Axis,{y1:0,y2:g,x1:p+15,x2:p+15,classNames:{axis:l?.xAxis?.axis},styles:{axis:{stroke:u,...o?.xAxis?.axis||{}}}}),st?e.jsxRuntimeExports.jsx(ft.AxisTitle,{x:p+h.right-15,y:g/2,style:{fill:u,...o?.yAxis?.title||{}},className:l?.yAxis?.title,text:s[1].length>100?`${s[1].substring(0,100)}...`:s[1],rotate90:!0}):null]}),e.jsxRuntimeExports.jsx(dt.Axis,{y1:b?a(0):g,y2:b?a(0):g,x1:-15,x2:p+15,classNames:{axis:l?.xAxis?.axis},styles:{axis:o?.xAxis?.axis}}),I.filter(t=>t.position==="before").map(t=>t.layer),e.jsxRuntimeExports.jsxs(Nt.AnimatePresence,{children:[n.map((t,A)=>e.jsxRuntimeExports.jsxs(P.motion.g,{className:"undp-viz-g-with-hover",opacity:.85,onMouseEnter:f=>{k(t),c(f.clientY),S(f.clientX),D?.(t)},onClick:()=>{(w||m)&&(gt.isEqual($,t)&&Z?(L(void 0),w?.(void 0)):(L(t),w?.(t)))},onMouseMove:f=>{k(t),c(f.clientY),S(f.clientX)},onMouseLeave:()=>{k(void 0),S(void 0),c(void 0),D?.(void 0)},children:[e.jsxRuntimeExports.jsx(P.motion.rect,{variants:{initial:{attrY:a(0),height:0,opacity:1},whileInView:{attrY:t.bar?t.bar>0?a(t.bar):a(0):0,height:t.bar?Math.abs(a(t.bar)-a(0)):0,opacity:1,transition:{duration:r.duration}}},initial:"initial",animate:N?"whileInView":"initial",exit:{attrY:a(0),height:0,opacity:0,transition:{duration:r.duration}},x:x(`${A}`),width:x.bandwidth(),style:{fill:d}}),J&&!pt.checkIfNullOrUndefined(t.bar)?e.jsxRuntimeExports.jsx(P.motion.text,{x:x(`${t.id}`)+x.bandwidth()/2,exit:{attrY:a(0),opacity:0,transition:{duration:r.duration}},variants:{initial:{attrY:a(0),opacity:0},whileInView:{attrY:a(t.bar||0),opacity:1,transition:{duration:r.duration}}},initial:"initial",animate:N?"whileInView":"initial",style:{fill:d,textAnchor:"middle",...o?.graphObjectValues||{}},className:e.mo("graph-value text-sm",l?.graphObjectValues),dy:t.bar?t.bar>=0?"-5px":"1em":"-5px",children:ot.numberFormattingFunction(t.bar,C,H,it,Y)}):null,Q?e.jsxRuntimeExports.jsx(At.XAxesLabels,{value:`${t.label}`.length<K?`${t.label}`:`${`${t.label}`.substring(0,K)}...`,y:g+5,x:x(`${t.id}`),width:x.bandwidth(),height:h.bottom,style:o?.xAxis?.labels,className:l?.xAxis?.labels,alignment:"top",animate:r,isInView:N}):null]},t.label)),e.jsxRuntimeExports.jsx(P.motion.path,{exit:{opacity:0,transition:{duration:r.duration}},variants:{initial:{d:B(n.map(t=>({...t,line:0}))),opacity:0},whileInView:{d:B(n),opacity:1,transition:{duration:r.duration}}},initial:"initial",animate:N?"whileInView":"initial",style:{stroke:u,fill:"none",strokeWidth:2}}),n.map((t,A)=>e.jsxRuntimeExports.jsx("g",{children:pt.checkIfNullOrUndefined(t.line)?null:e.jsxRuntimeExports.jsxs("g",{onMouseEnter:f=>{k(t),c(f.clientY),S(f.clientX),D?.(t)},onClick:()=>{(w||m)&&(gt.isEqual($,t)&&Z?(L(void 0),w?.(void 0)):(L(t),w?.(t)))},onMouseMove:f=>{k(t),c(f.clientY),S(f.clientX)},onMouseLeave:()=>{k(void 0),S(void 0),c(void 0),D?.(void 0)},children:[e.jsxRuntimeExports.jsx(P.motion.circle,{exit:{cy:i(0),opacity:0,transition:{duration:r.duration}},variants:{initial:{cy:i(0),opacity:0},whileInView:{cy:i(t.line),opacity:1,transition:{duration:r.duration}}},initial:"initial",animate:N?"whileInView":"initial",cx:x(t.id)+x.bandwidth()/2,r:p/n.length<5?0:p/n.length<20?2:4,style:{fill:u}}),J?e.jsxRuntimeExports.jsx(P.motion.text,{x:x(`${t.id}`)+x.bandwidth()/2,exit:{y:i(0),opacity:0,transition:{duration:r.duration}},style:{fill:u,textAnchor:"middle",...o?.graphObjectValues||{}},variants:{initial:{y:i(0),opacity:0},whileInView:{y:i(t.line),opacity:1,transition:{duration:r.duration}}},initial:"initial",animate:N?"whileInView":"initial",className:e.mo("graph-value text-sm",l?.graphObjectValues),dy:"-5px",children:ot.numberFormattingFunction(t.line,C,H,X,et)}):null]})},A))]}),I.filter(t=>t.position==="after").map(t=>t.layer)]})}),at&&v&&rt&&E?e.jsxRuntimeExports.jsx(Et.Tooltip,{data:at,body:v,xPos:rt,yPos:E,backgroundStyle:o?.tooltip,className:l?.tooltip}):null,m&&$!==void 0?e.jsxRuntimeExports.jsx(wt.X,{open:$!==void 0,onClose:()=>{L(void 0)},children:e.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof m=="string"?{__html:Rt.string2HTML(m,$)}:void 0,children:typeof m=="function"?m($):null})}):null]})}function Lt(ct){const{data:q,graphTitle:M,sources:V,graphDescription:d,height:u,width:s,footNote:b,padding:U,lineColor:z=xt.Colors.light.categoricalColors.colors[1],barColor:_=xt.Colors.light.categoricalColors.colors[0],sameAxes:ut=!1,backgroundColor:v=!1,leftMargin:J=80,rightMargin:D=80,topMargin:mt=20,bottomMargin:K=25,lineAxisTitle:Q="Line chart",barAxisTitle:w="Bar graph",tooltip:Z,relativeHeight:m,onSeriesMouseOver:tt,graphID:et,graphDownload:Y=!1,dataDownload:X=!1,barPadding:it=.25,truncateBy:F=999,showLabels:o=!0,onSeriesMouseClick:l,language:r="en",colorLegendTitle:H,minHeight:I=0,theme:C="light",ariaLabel:st,resetSelectionOnDoubleClick:nt=!0,detailsOnClick:N,showValues:ht=!0,noOfTicks:at=5,lineSuffix:k="",barSuffix:$="",linePrefix:L="",barPrefix:rt="",curveType:S="curve",styles:E,classNames:c,animate:h=!1,precision:p=2,customLayers:g=[],naLabel:n="NA",showColorScale:x=!0,showAxisLabels:W=!0}=ct,[R,T]=j.useState(0),[O,G]=j.useState(0),y=j.useRef(null),a=j.useRef(null);return j.useEffect(()=>{const i=new ResizeObserver(B=>{T(s||B[0].target.clientWidth||620),G(u||B[0].target.clientHeight||480)});return y.current&&(G(y.current.clientHeight||480),T(y.current.clientWidth||620),s||i.observe(y.current)),()=>i.disconnect()},[s,u]),e.jsxRuntimeExports.jsx("div",{className:`${C||"light"} flex ${s?"w-fit grow-0":"w-full grow"}`,dir:r==="he"||r==="ar"?"rtl":void 0,children:e.jsxRuntimeExports.jsx("div",{className:e.mo(`${v?v===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${r||"en"}`,s?"w-fit":"w-full",c?.graphContainer),style:{...E?.graphContainer||{},...v&&v!==!0?{backgroundColor:v}:{}},id:et,ref:a,"aria-label":st||`${M?`The graph shows ${M}. `:""}This is a pareto chart that shows a variable as bars and another as line chart.${d?` ${d}`:""}`,children:e.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:v?U||"1rem":U||0},children:e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[M||d||Y||X?e.jsxRuntimeExports.jsx($t.GraphHeader,{styles:{title:E?.title,description:E?.description},classNames:{title:c?.title,description:c?.description},graphTitle:M,graphDescription:d,width:s,graphDownload:Y?a.current:void 0,dataDownload:X?q.map(i=>i.data).filter(i=>i!==void 0).length>0?q.map(i=>i.data).filter(i=>i!==void 0):q.filter(i=>i!==void 0):null}):null,e.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:q.length===0?e.jsxRuntimeExports.jsx(qt.EmptyState,{}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[x?e.jsxRuntimeExports.jsx(St.ColorLegend,{colorDomain:[w,Q],colors:[_||xt.Colors[C].categoricalColors.colors[0],z||xt.Colors[C].categoricalColors.colors[1]],colorLegendTitle:H,showNAColor:!1}):null,e.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:y,"aria-label":"Graph area",children:(s||R)&&(u||O)?e.jsxRuntimeExports.jsx(It,{data:q,sameAxes:ut,lineColor:z,barColor:_,width:s||R,height:Math.max(I,u||(m?I?(s||R)*m>I?(s||R)*m:I:(s||R)*m:O)),truncateBy:F,leftMargin:J,rightMargin:D,topMargin:mt,bottomMargin:K,axisTitles:[w,Q],tooltip:Z,onSeriesMouseOver:tt,barPadding:it,showLabels:o,onSeriesMouseClick:l,resetSelectionOnDoubleClick:nt,detailsOnClick:N,noOfTicks:at,lineSuffix:k,barSuffix:$,linePrefix:L,barPrefix:rt,curveType:S,showValues:ht,styles:E,classNames:c,animate:h===!0?{duration:.5,once:!0,amount:.5}:h||{duration:0,once:!0,amount:0},precision:p,customLayers:g,naLabel:n,showAxisLabels:W}):null})]})}),V||b?e.jsxRuntimeExports.jsx(kt.GraphFooter,{styles:{footnote:E?.footnote,source:E?.source},classNames:{footnote:c?.footnote,source:c?.source},sources:V,footNote:b,width:s}):null]})})})})}exports.ParetoChart=Lt;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CHPV5EwG-DDoeWRVt.cjs"),j=require("react"),gt=require("./index-DQA8q5sC.cjs"),wt=require("./Modal-tXZlLE5s.cjs"),ot=require("./numberFormattingFunction-02t-wJta.cjs"),Et=require("./Tooltip-De16GWhY.cjs"),Rt=require("./string2HTML-z7CwHXcx.cjs"),pt=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),dt=require("./Axis-DE7dSn1_.cjs"),ft=require("./AxisTitle-CK9YeovX.cjs"),At=require("./XAxesLabels-OjBNl_lS.cjs"),Mt=require("./band-CAApY4Pd.cjs"),yt=require("./linear-BVckp9RD.cjs"),jt=require("./line-DHV4JwCR.cjs"),lt=require("./step-BZ3C8QFW.cjs"),Ct=require("./use-in-view-sQJZ_xDO.cjs"),P=require("./proxy-BHRoeZgd.cjs"),Nt=require("./index-BW8iNx7E.cjs"),kt=require("./GraphFooter.cjs"),$t=require("./GraphHeader.cjs"),St=require("./ColorLegend.cjs"),xt=require("./Colors.cjs"),qt=require("./EmptyState-d8_8SxeW.cjs");function It(ct){const{data:q,width:M,height:V,barColor:d,lineColor:u,axisTitles:s,sameAxes:b,rightMargin:U,leftMargin:z,topMargin:_,bottomMargin:ut,tooltip:v,showValues:J,onSeriesMouseOver:D,barPadding:mt,truncateBy:K,showLabels:Q,onSeriesMouseClick:w,resetSelectionOnDoubleClick:Z,detailsOnClick:m,noOfTicks:tt,lineSuffix:et,barSuffix:Y,linePrefix:X,barPrefix:it,curveType:F,styles:o,classNames:l,animate:r,precision:H,customLayers:I,naLabel:C,showAxisLabels:st}=ct,nt=j.useRef(null),N=Ct.useInView(nt,{once:r.once,amount:r.amount}),ht=F==="linear"?jt.curveLinear:F==="step"?lt.curveStep:F==="stepAfter"?lt.stepAfter:F==="stepBefore"?lt.stepBefore:lt.monotoneX,[at,k]=j.useState(void 0),[$,L]=j.useState(void 0),[rt,S]=j.useState(void 0),[E,c]=j.useState(void 0),h={top:_,bottom:ut,left:z+50,right:U+65},p=M-h.left-h.right,g=V-h.top-h.bottom,n=q.map((t,A)=>({...t,id:`${A}`})),x=Mt.band().domain(n.map(t=>`${t.id}`)).range([0,p]).paddingInner(mt),W=Math.min(...n.map(t=>t.bar).filter(t=>t!=null))!==1/0?Math.min(...n.map(t=>t.bar).filter(t=>t!=null))>0?0:Math.min(...n.map(t=>t.bar).filter(t=>t!=null)):0,R=Math.min(...n.map(t=>t.line).filter(t=>t!=null))!==1/0?Math.min(...n.map(t=>t.line).filter(t=>t!=null))>0?0:Math.min(...n.map(t=>t.line).filter(t=>t!=null)):0,T=Math.max(...n.map(t=>t.bar).filter(t=>t!=null))!==1/0?Math.max(...n.map(t=>t.bar).filter(t=>t!=null)):0,O=Math.max(...n.map(t=>t.line).filter(t=>t!=null))!==1/0?Math.max(...n.map(t=>t.line).filter(t=>t!=null)):0,G=W<R?W:R,y=T>O?T:O,a=yt.linear().domain([b?G:W,b?y>0?y:0:T>0?T:0]).range([g,0]).nice(),i=yt.linear().domain([b?G:R,b?y>0?y:0:O>0?O:0]).range([g,0]).nice(),B=jt.line().defined(t=>!pt.checkIfNullOrUndefined(t.line)).x(t=>x(`${t.id}`)+x.bandwidth()/2).y(t=>i(t.line)).curve(ht),bt=a.ticks(tt),vt=i.ticks(tt);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(P.motion.svg,{width:`${M}px`,height:`${V}px`,viewBox:`0 0 ${M} ${V}`,direction:"ltr",ref:nt,children:e.jsxRuntimeExports.jsxs("g",{transform:`translate(${h.left},${h.top})`,children:[e.jsxRuntimeExports.jsxs("g",{children:[bt.map((t,A)=>e.jsxRuntimeExports.jsxs("g",{children:[e.jsxRuntimeExports.jsx("line",{y1:a(t),y2:a(t),x1:-15,x2:-20,style:{stroke:d,strokeWidth:1,...o?.yAxis?.gridLines||{}},className:l?.yAxis?.gridLines}),e.jsxRuntimeExports.jsx("text",{x:-25,y:a(t),dy:"0.33em",className:e.mo("text-xs",l?.yAxis?.labels),style:{textAnchor:"end",fill:d,...o?.yAxis?.labels||{}},children:ot.numberFormattingFunction(t,C,H,it,Y)})]},A)),e.jsxRuntimeExports.jsx(dt.Axis,{y1:0,y2:g,x1:-15,x2:-15,classNames:{axis:l?.xAxis?.axis},styles:{axis:{stroke:d,...o?.xAxis?.axis||{}}}}),st?e.jsxRuntimeExports.jsx(ft.AxisTitle,{x:10-h.left,y:g/2,style:{fill:d,...o?.yAxis?.title||{}},className:l?.yAxis?.title,text:s[0].length>100?`${s[0].substring(0,100)}...`:s[0],rotate90:!0}):null]}),e.jsxRuntimeExports.jsxs("g",{children:[vt.map((t,A)=>e.jsxRuntimeExports.jsxs("g",{children:[e.jsxRuntimeExports.jsx("line",{y1:i(t),y2:i(t),x1:p+15,x2:p+20,style:{stroke:u,strokeWidth:1,...o?.yAxis?.gridLines||{}},className:l?.yAxis?.gridLines}),e.jsxRuntimeExports.jsx("text",{x:p+25,y:i(t),dy:"0.33em",dx:-2,style:{textAnchor:"start",fill:u,...o?.yAxis?.labels||{}},className:e.mo("text-xs",l?.yAxis?.labels),children:ot.numberFormattingFunction(t,C,H,X,et)})]},A)),e.jsxRuntimeExports.jsx(dt.Axis,{y1:0,y2:g,x1:p+15,x2:p+15,classNames:{axis:l?.xAxis?.axis},styles:{axis:{stroke:u,...o?.xAxis?.axis||{}}}}),st?e.jsxRuntimeExports.jsx(ft.AxisTitle,{x:p+h.right-15,y:g/2,style:{fill:u,...o?.yAxis?.title||{}},className:l?.yAxis?.title,text:s[1].length>100?`${s[1].substring(0,100)}...`:s[1],rotate90:!0}):null]}),e.jsxRuntimeExports.jsx(dt.Axis,{y1:b?a(0):g,y2:b?a(0):g,x1:-15,x2:p+15,classNames:{axis:l?.xAxis?.axis},styles:{axis:o?.xAxis?.axis}}),I.filter(t=>t.position==="before").map(t=>t.layer),e.jsxRuntimeExports.jsxs(Nt.AnimatePresence,{children:[n.map((t,A)=>e.jsxRuntimeExports.jsxs(P.motion.g,{className:"undp-viz-g-with-hover",opacity:.85,onMouseEnter:f=>{k(t),c(f.clientY),S(f.clientX),D?.(t)},onClick:()=>{(w||m)&&(gt.isEqual($,t)&&Z?(L(void 0),w?.(void 0)):(L(t),w?.(t)))},onMouseMove:f=>{k(t),c(f.clientY),S(f.clientX)},onMouseLeave:()=>{k(void 0),S(void 0),c(void 0),D?.(void 0)},children:[e.jsxRuntimeExports.jsx(P.motion.rect,{variants:{initial:{attrY:a(0),height:0,opacity:1},whileInView:{attrY:t.bar?t.bar>0?a(t.bar):a(0):0,height:t.bar?Math.abs(a(t.bar)-a(0)):0,opacity:1,transition:{duration:r.duration}}},initial:"initial",animate:N?"whileInView":"initial",exit:{attrY:a(0),height:0,opacity:0,transition:{duration:r.duration}},x:x(`${A}`),width:x.bandwidth(),style:{fill:d}}),J&&!pt.checkIfNullOrUndefined(t.bar)?e.jsxRuntimeExports.jsx(P.motion.text,{x:x(`${t.id}`)+x.bandwidth()/2,exit:{attrY:a(0),opacity:0,transition:{duration:r.duration}},variants:{initial:{attrY:a(0),opacity:0},whileInView:{attrY:a(t.bar||0),opacity:1,transition:{duration:r.duration}}},initial:"initial",animate:N?"whileInView":"initial",style:{fill:d,textAnchor:"middle",...o?.graphObjectValues||{}},className:e.mo("graph-value text-sm",l?.graphObjectValues),dy:t.bar?t.bar>=0?"-5px":"1em":"-5px",children:ot.numberFormattingFunction(t.bar,C,H,it,Y)}):null,Q?e.jsxRuntimeExports.jsx(At.XAxesLabels,{value:`${t.label}`.length<K?`${t.label}`:`${`${t.label}`.substring(0,K)}...`,y:g+5,x:x(`${t.id}`),width:x.bandwidth(),height:h.bottom,style:o?.xAxis?.labels,className:l?.xAxis?.labels,alignment:"top",animate:r,isInView:N}):null]},t.label)),e.jsxRuntimeExports.jsx(P.motion.path,{exit:{opacity:0,transition:{duration:r.duration}},variants:{initial:{d:B(n.map(t=>({...t,line:0}))),opacity:0},whileInView:{d:B(n),opacity:1,transition:{duration:r.duration}}},initial:"initial",animate:N?"whileInView":"initial",style:{stroke:u,fill:"none",strokeWidth:2}}),n.map((t,A)=>e.jsxRuntimeExports.jsx("g",{children:pt.checkIfNullOrUndefined(t.line)?null:e.jsxRuntimeExports.jsxs("g",{onMouseEnter:f=>{k(t),c(f.clientY),S(f.clientX),D?.(t)},onClick:()=>{(w||m)&&(gt.isEqual($,t)&&Z?(L(void 0),w?.(void 0)):(L(t),w?.(t)))},onMouseMove:f=>{k(t),c(f.clientY),S(f.clientX)},onMouseLeave:()=>{k(void 0),S(void 0),c(void 0),D?.(void 0)},children:[e.jsxRuntimeExports.jsx(P.motion.circle,{exit:{cy:i(0),opacity:0,transition:{duration:r.duration}},variants:{initial:{cy:i(0),opacity:0},whileInView:{cy:i(t.line),opacity:1,transition:{duration:r.duration}}},initial:"initial",animate:N?"whileInView":"initial",cx:x(t.id)+x.bandwidth()/2,r:p/n.length<5?0:p/n.length<20?2:4,style:{fill:u}}),J?e.jsxRuntimeExports.jsx(P.motion.text,{x:x(`${t.id}`)+x.bandwidth()/2,exit:{y:i(0),opacity:0,transition:{duration:r.duration}},style:{fill:u,textAnchor:"middle",...o?.graphObjectValues||{}},variants:{initial:{y:i(0),opacity:0},whileInView:{y:i(t.line),opacity:1,transition:{duration:r.duration}}},initial:"initial",animate:N?"whileInView":"initial",className:e.mo("graph-value text-sm",l?.graphObjectValues),dy:"-5px",children:ot.numberFormattingFunction(t.line,C,H,X,et)}):null]})},A))]}),I.filter(t=>t.position==="after").map(t=>t.layer)]})}),at&&v&&rt&&E?e.jsxRuntimeExports.jsx(Et.Tooltip,{data:at,body:v,xPos:rt,yPos:E,backgroundStyle:o?.tooltip,className:l?.tooltip}):null,m&&$!==void 0?e.jsxRuntimeExports.jsx(wt.X,{open:$!==void 0,onClose:()=>{L(void 0)},children:e.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof m=="string"?{__html:Rt.string2HTML(m,$)}:void 0,children:typeof m=="function"?m($):null})}):null]})}function Lt(ct){const{data:q,graphTitle:M,sources:V,graphDescription:d,height:u,width:s,footNote:b,padding:U,lineColor:z=xt.Colors.light.categoricalColors.colors[1],barColor:_=xt.Colors.light.categoricalColors.colors[0],sameAxes:ut=!1,backgroundColor:v=!1,leftMargin:J=80,rightMargin:D=80,topMargin:mt=20,bottomMargin:K=25,lineAxisTitle:Q="Line chart",barAxisTitle:w="Bar graph",tooltip:Z,relativeHeight:m,onSeriesMouseOver:tt,graphID:et,graphDownload:Y=!1,dataDownload:X=!1,barPadding:it=.25,truncateBy:F=999,showLabels:o=!0,onSeriesMouseClick:l,language:r="en",colorLegendTitle:H,minHeight:I=0,theme:C="light",ariaLabel:st,resetSelectionOnDoubleClick:nt=!0,detailsOnClick:N,showValues:ht=!0,noOfTicks:at=5,lineSuffix:k="",barSuffix:$="",linePrefix:L="",barPrefix:rt="",curveType:S="curve",styles:E,classNames:c,animate:h=!1,precision:p=2,customLayers:g=[],naLabel:n="NA",showColorScale:x=!0,showAxisLabels:W=!0}=ct,[R,T]=j.useState(0),[O,G]=j.useState(0),y=j.useRef(null),a=j.useRef(null);return j.useEffect(()=>{const i=new ResizeObserver(B=>{T(s||B[0].target.clientWidth||620),G(u||B[0].target.clientHeight||480)});return y.current&&(G(y.current.clientHeight||480),T(y.current.clientWidth||620),s||i.observe(y.current)),()=>i.disconnect()},[s,u]),e.jsxRuntimeExports.jsx("div",{className:`${C||"light"} flex ${s?"w-fit grow-0":"w-full grow"}`,dir:r==="he"||r==="ar"?"rtl":void 0,children:e.jsxRuntimeExports.jsx("div",{className:e.mo(`${v?v===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${r||"en"}`,s?"w-fit":"w-full",c?.graphContainer),style:{...E?.graphContainer||{},...v&&v!==!0?{backgroundColor:v}:{}},id:et,ref:a,"aria-label":st||`${M?`The graph shows ${M}. `:""}This is a pareto chart that shows a variable as bars and another as line chart.${d?` ${d}`:""}`,children:e.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:v?U||"1rem":U||0},children:e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[M||d||Y||X?e.jsxRuntimeExports.jsx($t.GraphHeader,{styles:{title:E?.title,description:E?.description},classNames:{title:c?.title,description:c?.description},graphTitle:M,graphDescription:d,width:s,graphDownload:Y?a.current:void 0,dataDownload:X?q.map(i=>i.data).filter(i=>i!==void 0).length>0?q.map(i=>i.data).filter(i=>i!==void 0):q.filter(i=>i!==void 0):null}):null,e.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:q.length===0?e.jsxRuntimeExports.jsx(qt.EmptyState,{}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[x?e.jsxRuntimeExports.jsx(St.ColorLegend,{colorDomain:[w,Q],colors:[_||xt.Colors[C].categoricalColors.colors[0],z||xt.Colors[C].categoricalColors.colors[1]],colorLegendTitle:H,showNAColor:!1}):null,e.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:y,"aria-label":"Graph area",children:(s||R)&&(u||O)?e.jsxRuntimeExports.jsx(It,{data:q,sameAxes:ut,lineColor:z,barColor:_,width:s||R,height:Math.max(I,u||(m?I?(s||R)*m>I?(s||R)*m:I:(s||R)*m:O)),truncateBy:F,leftMargin:J,rightMargin:D,topMargin:mt,bottomMargin:K,axisTitles:[w,Q],tooltip:Z,onSeriesMouseOver:tt,barPadding:it,showLabels:o,onSeriesMouseClick:l,resetSelectionOnDoubleClick:nt,detailsOnClick:N,noOfTicks:at,lineSuffix:k,barSuffix:$,linePrefix:L,barPrefix:rt,curveType:S,showValues:ht,styles:E,classNames:c,animate:h===!0?{duration:.5,once:!0,amount:.5}:h||{duration:0,once:!0,amount:0},precision:p,customLayers:g,naLabel:n,showAxisLabels:W}):null})]})}),V||b?e.jsxRuntimeExports.jsx(kt.GraphFooter,{styles:{footnote:E?.footnote,source:E?.source},classNames:{footnote:c?.footnote,source:c?.source},sources:V,footNote:b,width:s}):null]})})})})}exports.ParetoChart=Lt;
2
2
  //# sourceMappingURL=ParetoChart.cjs.map
@@ -1,10 +1,10 @@
1
1
  import { j as t, m as _ } from "./index-CHPV5EwG-BPSP-7Jg.js";
2
2
  import { useRef as fi, useState as W, useEffect as ji } from "react";
3
- import { i as gi } from "./index-27yTRcko.js";
3
+ import { i as gi } from "./index-Bwrro8-q.js";
4
4
  import { X as Ai } from "./Modal-DVVwpKhP.js";
5
5
  import { n as oi } from "./numberFormattingFunction-14YCbkN2.js";
6
- import { T as Mi } from "./Tooltip-DyM5snqx.js";
7
- import { s as Ni } from "./string2HTML-CWHGfz_d.js";
6
+ import { T as Mi } from "./Tooltip-CVCGWyzw.js";
7
+ import { s as Ni } from "./string2HTML-oFCROsus.js";
8
8
  import { c as di } from "./checkIfNullOrUndefined-DmfiKkNw.js";
9
9
  import { A as pi } from "./Axis-Ddg-seDi.js";
10
10
  import { A as yi } from "./AxisTitle-BmHLMRJZ.js";