@undp/data-viz 1.2.8 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AreaChart.d.ts +224 -0
- package/dist/AreaChart.js +2 -0
- package/dist/AreaChart.js.map +1 -0
- package/dist/Axis-BlyBRMNw.cjs +2 -0
- package/dist/Axis-BlyBRMNw.cjs.map +1 -0
- package/dist/Axis-CvK-w3E2.js +44 -0
- package/dist/Axis-CvK-w3E2.js.map +1 -0
- package/dist/AxisTitle-BY8MI9jC.cjs +2 -0
- package/dist/AxisTitle-BY8MI9jC.cjs.map +1 -0
- package/dist/AxisTitle-BeMxcw5I.js +21 -0
- package/dist/AxisTitle-BeMxcw5I.js.map +1 -0
- package/dist/BarGraph.d.ts +460 -0
- package/dist/BarGraph.js +2 -0
- package/dist/BarGraph.js.map +1 -0
- package/dist/BasicStatCard.d.ts +106 -0
- package/dist/BasicStatCard.js +2 -0
- package/dist/BasicStatCard.js.map +1 -0
- package/dist/BeeSwarmChart.d.ts +189 -0
- package/dist/BeeSwarmChart.js +2 -0
- package/dist/BeeSwarmChart.js.map +1 -0
- package/dist/BiVariateChoroplethMap.d.ts +189 -0
- package/dist/BiVariateChoroplethMap.js +2 -0
- package/dist/BiVariateChoroplethMap.js.map +1 -0
- package/dist/BulletChart.d.ts +219 -0
- package/dist/BulletChart.js +2 -0
- package/dist/BulletChart.js.map +1 -0
- package/dist/ButterflyChart.d.ts +201 -0
- package/dist/ButterflyChart.js +2 -0
- package/dist/ButterflyChart.js.map +1 -0
- package/dist/ChoroplethMap.d.ts +190 -0
- package/dist/ChoroplethMap.js +2 -0
- package/dist/ChoroplethMap.js.map +1 -0
- package/dist/CirclePackingGraph.d.ts +161 -0
- package/dist/CirclePackingGraph.js +2 -0
- package/dist/CirclePackingGraph.js.map +1 -0
- package/dist/ColorLegend.d.ts +17 -0
- package/dist/ColorLegend.js +2 -0
- package/dist/ColorLegend.js.map +1 -0
- package/dist/ColorLegendWithMouseOver.d.ts +16 -0
- package/dist/ColorLegendWithMouseOver.js +2 -0
- package/dist/ColorLegendWithMouseOver.js.map +1 -0
- package/dist/Colors.d.ts +174 -0
- package/dist/Colors.js +2 -0
- package/dist/Colors.js.map +1 -0
- package/dist/CopyTextButton.d.ts +13 -0
- package/dist/CopyTextButton.js +17 -0
- package/dist/CopyTextButton.js.map +1 -0
- package/dist/CsvDownloadButton.d.ts +22 -0
- package/dist/CsvDownloadButton.js +23 -0
- package/dist/CsvDownloadButton.js.map +1 -0
- package/dist/DataCards.d.ts +131 -0
- package/dist/DataCards.js +2 -0
- package/dist/DataCards.js.map +1 -0
- package/dist/DataTable.d.ts +122 -0
- package/dist/DataTable.js +2 -0
- package/dist/DataTable.js.map +1 -0
- package/dist/DifferenceLineChart.d.ts +237 -0
- package/dist/DifferenceLineChart.js +2 -0
- package/dist/DifferenceLineChart.js.map +1 -0
- package/dist/DonutChart.d.ts +148 -0
- package/dist/DonutChart.js +2 -0
- package/dist/DonutChart.js.map +1 -0
- package/dist/DotDensityMap.d.ts +191 -0
- package/dist/DotDensityMap.js +2 -0
- package/dist/DotDensityMap.js.map +1 -0
- package/dist/DropdownSelect-CuzV7gdj.cjs +29 -0
- package/dist/DropdownSelect-CuzV7gdj.cjs.map +1 -0
- package/dist/DropdownSelect-DmZsXrhY.js +2698 -0
- package/dist/DropdownSelect-DmZsXrhY.js.map +1 -0
- package/dist/DualAxisLineChart.d.ts +180 -0
- package/dist/DualAxisLineChart.js +2 -0
- package/dist/DualAxisLineChart.js.map +1 -0
- package/dist/DumbbellChart.d.ts +224 -0
- package/dist/DumbbellChart.js +2 -0
- package/dist/DumbbellChart.js.map +1 -0
- package/dist/EmptyState-BQguKAp5.cjs +2 -0
- package/dist/EmptyState-BQguKAp5.cjs.map +1 -0
- package/dist/EmptyState-b2Ln487i.js +22 -0
- package/dist/EmptyState-b2Ln487i.js.map +1 -0
- package/dist/ExcelDownloadButton.d.ts +22 -0
- package/dist/ExcelDownloadButton.js +2 -0
- package/dist/ExcelDownloadButton.js.map +1 -0
- package/dist/FootNote.d.ts +12 -0
- package/dist/FootNote.js +2 -0
- package/dist/FootNote.js.map +1 -0
- package/dist/GeoHubCompareMaps.d.ts +103 -0
- package/dist/GeoHubCompareMaps.js +2 -0
- package/dist/GeoHubCompareMaps.js.map +1 -0
- package/dist/GeoHubMap.d.ts +118 -0
- package/dist/GeoHubMap.js +2 -0
- package/dist/GeoHubMap.js.map +1 -0
- package/dist/GeoHubMapWithLayerSelection.d.ts +117 -0
- package/dist/GeoHubMapWithLayerSelection.js +2 -0
- package/dist/GeoHubMapWithLayerSelection.js.map +1 -0
- package/dist/GraphDescription.d.ts +12 -0
- package/dist/GraphDescription.js +2 -0
- package/dist/GraphDescription.js.map +1 -0
- package/dist/GraphFooter.d.ts +24 -0
- package/dist/GraphFooter.js +2 -0
- package/dist/GraphFooter.js.map +1 -0
- package/dist/GraphHeader.d.ts +22 -0
- package/dist/GraphHeader.js +2 -0
- package/dist/GraphHeader.js.map +1 -0
- package/dist/GraphTitle.d.ts +13 -0
- package/dist/GraphTitle.js +2 -0
- package/dist/GraphTitle.js.map +1 -0
- package/dist/GriddedGraphs.d.ts +540 -0
- package/dist/GriddedGraphs.js +2 -0
- package/dist/GriddedGraphs.js.map +1 -0
- package/dist/GriddedGraphsFromConfig.d.ts +543 -0
- package/dist/GriddedGraphsFromConfig.js +2 -0
- package/dist/GriddedGraphsFromConfig.js.map +1 -0
- package/dist/HeatMap.d.ts +166 -0
- package/dist/HeatMap.js +2 -0
- package/dist/HeatMap.js.map +1 -0
- package/dist/Histogram.d.ts +165 -0
- package/dist/Histogram.js +2 -0
- package/dist/Histogram.js.map +1 -0
- package/dist/ImageDownloadButton.d.ts +15 -0
- package/dist/ImageDownloadButton.js +2 -0
- package/dist/ImageDownloadButton.js.map +1 -0
- package/dist/LineChartWithConfidenceInterval.d.ts +250 -0
- package/dist/LineChartWithConfidenceInterval.js +2 -0
- package/dist/LineChartWithConfidenceInterval.js.map +1 -0
- package/dist/LinearColorLegend.d.ts +13 -0
- package/dist/LinearColorLegend.js +2 -0
- package/dist/LinearColorLegend.js.map +1 -0
- package/dist/Modal-C9txyGOk.js +723 -0
- package/dist/Modal-C9txyGOk.js.map +1 -0
- package/dist/Modal-cQF2UQIa.cjs +46 -0
- package/dist/Modal-cQF2UQIa.cjs.map +1 -0
- package/dist/MultiGraphDashboard.d.ts +558 -0
- package/dist/MultiGraphDashboard.js +2 -0
- package/dist/MultiGraphDashboard.js.map +1 -0
- package/dist/MultiGraphDashboardFromConfig.d.ts +562 -0
- package/dist/MultiGraphDashboardFromConfig.js +2 -0
- package/dist/MultiGraphDashboardFromConfig.js.map +1 -0
- package/dist/MultiGraphDashboardWideToLongFormat.d.ts +128 -0
- package/dist/MultiGraphDashboardWideToLongFormat.js +2 -0
- package/dist/MultiGraphDashboardWideToLongFormat.js.map +1 -0
- package/dist/MultiGraphDashboardWideToLongFormatFromConfig.d.ts +133 -0
- package/dist/MultiGraphDashboardWideToLongFormatFromConfig.js +2 -0
- package/dist/MultiGraphDashboardWideToLongFormatFromConfig.js.map +1 -0
- package/dist/MultiLineAltChart.d.ts +244 -0
- package/dist/MultiLineAltChart.js +2 -0
- package/dist/MultiLineAltChart.js.map +1 -0
- package/dist/MultiLineChart.d.ts +246 -0
- package/dist/MultiLineChart.js +2 -0
- package/dist/MultiLineChart.js.map +1 -0
- package/dist/ParetoChart.d.ts +178 -0
- package/dist/ParetoChart.js +2 -0
- package/dist/ParetoChart.js.map +1 -0
- package/dist/RadarChart.d.ts +176 -0
- package/dist/RadarChart.js +2 -0
- package/dist/RadarChart.js.map +1 -0
- package/dist/ReferenceLine-BgDdQbDI.js +129 -0
- package/dist/ReferenceLine-BgDdQbDI.js.map +1 -0
- package/dist/ReferenceLine-Bsb5jeE4.cjs +2 -0
- package/dist/ReferenceLine-Bsb5jeE4.cjs.map +1 -0
- package/dist/RegressionLine-BfpCuD7B.cjs +2 -0
- package/dist/RegressionLine-BfpCuD7B.cjs.map +1 -0
- package/dist/RegressionLine-cSljpHaE.js +49 -0
- package/dist/RegressionLine-cSljpHaE.js.map +1 -0
- package/dist/SVGDownloadButton.d.ts +15 -0
- package/dist/SVGDownloadButton.js +2 -0
- package/dist/SVGDownloadButton.js.map +1 -0
- package/dist/SankeyChart.d.ts +178 -0
- package/dist/SankeyChart.js +2 -0
- package/dist/SankeyChart.js.map +1 -0
- package/dist/ScatterPlot.d.ts +266 -0
- package/dist/ScatterPlot.js +2 -0
- package/dist/ScatterPlot.js.map +1 -0
- package/dist/ScrollStory.d.ts +491 -0
- package/dist/ScrollStory.js +2 -0
- package/dist/ScrollStory.js.map +1 -0
- package/dist/SimpleLineChart.d.ts +230 -0
- package/dist/SimpleLineChart.js +2 -0
- package/dist/SimpleLineChart.js.map +1 -0
- package/dist/SingleGraphDashboard.d.ts +545 -0
- package/dist/SingleGraphDashboard.js +2 -0
- package/dist/SingleGraphDashboard.js.map +1 -0
- package/dist/SingleGraphDashboardFromConfig.d.ts +547 -0
- package/dist/SingleGraphDashboardFromConfig.js +2 -0
- package/dist/SingleGraphDashboardFromConfig.js.map +1 -0
- package/dist/SlopeChart.d.ts +167 -0
- package/dist/SlopeChart.js +2 -0
- package/dist/SlopeChart.js.map +1 -0
- package/dist/Source.d.ts +16 -0
- package/dist/Source.js +2 -0
- package/dist/Source.js.map +1 -0
- package/dist/SparkLine.d.ts +139 -0
- package/dist/SparkLine.js +2 -0
- package/dist/SparkLine.js.map +1 -0
- package/dist/Spinner-DN3s4S0H.js +17 -0
- package/dist/Spinner-DN3s4S0H.js.map +1 -0
- package/dist/Spinner-UmN-KPe9.cjs +2 -0
- package/dist/Spinner-UmN-KPe9.cjs.map +1 -0
- package/dist/StatCardFromData.d.ts +115 -0
- package/dist/StatCardFromData.js +2 -0
- package/dist/StatCardFromData.js.map +1 -0
- package/dist/StripChart.d.ts +178 -0
- package/dist/StripChart.js +2 -0
- package/dist/StripChart.js.map +1 -0
- package/dist/ThreeDGlobe.d.ts +158 -0
- package/dist/ThreeDGlobe.js +2 -0
- package/dist/ThreeDGlobe.js.map +1 -0
- package/dist/ThresholdColorLegendWithMouseOver.d.ts +16 -0
- package/dist/ThresholdColorLegendWithMouseOver.js +2 -0
- package/dist/ThresholdColorLegendWithMouseOver.js.map +1 -0
- package/dist/Tooltip-BM18N_3l.cjs +2 -0
- package/dist/Tooltip-BM18N_3l.cjs.map +1 -0
- package/dist/Tooltip-CzZ1wFyF.js +47 -0
- package/dist/Tooltip-CzZ1wFyF.js.map +1 -0
- package/dist/TreeMapGraph.d.ts +158 -0
- package/dist/TreeMapGraph.js +2 -0
- package/dist/TreeMapGraph.js.map +1 -0
- package/dist/Types.d.ts +883 -0
- package/dist/Types.js +2 -0
- package/dist/Types.js.map +1 -0
- package/dist/Typography-CDR-DAHH.cjs +2 -0
- package/dist/Typography-CDR-DAHH.cjs.map +1 -0
- package/dist/Typography-XJoSE-By.js +58 -0
- package/dist/Typography-XJoSE-By.js.map +1 -0
- package/dist/UnitChart.d.ts +132 -0
- package/dist/UnitChart.js +2 -0
- package/dist/UnitChart.js.map +1 -0
- package/dist/XAxesLabels-C9REbQQs.cjs +2 -0
- package/dist/XAxesLabels-C9REbQQs.cjs.map +1 -0
- package/dist/XAxesLabels-DVw7Lvuz.js +58 -0
- package/dist/XAxesLabels-DVw7Lvuz.js.map +1 -0
- package/dist/XTicksAndGridLines-CUefTINd.js +57 -0
- package/dist/XTicksAndGridLines-CUefTINd.js.map +1 -0
- package/dist/XTicksAndGridLines-DuK35ROS.cjs +2 -0
- package/dist/XTicksAndGridLines-DuK35ROS.cjs.map +1 -0
- package/dist/YAxesLabels-CYVY053X.js +53 -0
- package/dist/YAxesLabels-CYVY053X.js.map +1 -0
- package/dist/YAxesLabels-DhBdLk3Z.cjs +2 -0
- package/dist/YAxesLabels-DhBdLk3Z.cjs.map +1 -0
- package/dist/YTicksAndGridLines-BJRXuBdC.js +57 -0
- package/dist/YTicksAndGridLines-BJRXuBdC.js.map +1 -0
- package/dist/YTicksAndGridLines-CtLvzExe.cjs +2 -0
- package/dist/YTicksAndGridLines-CtLvzExe.cjs.map +1 -0
- package/dist/_commonjsHelpers-DKOUU3wS.cjs +2 -0
- package/dist/_commonjsHelpers-DKOUU3wS.cjs.map +1 -0
- package/dist/_commonjsHelpers-DaMA6jEr.js +9 -0
- package/dist/_commonjsHelpers-DaMA6jEr.js.map +1 -0
- package/dist/area-BE2wo7fv.js +53 -0
- package/dist/area-BE2wo7fv.js.map +1 -0
- package/dist/area-D3Qx7k7K.cjs +2 -0
- package/dist/area-D3Qx7k7K.cjs.map +1 -0
- package/dist/array-B7TkkRH0.js +89 -0
- package/dist/array-B7TkkRH0.js.map +1 -0
- package/dist/array-DKbXV8lR.cjs +2 -0
- package/dist/array-DKbXV8lR.cjs.map +1 -0
- package/dist/band-BEjh2CHI.js +47 -0
- package/dist/band-BEjh2CHI.js.map +1 -0
- package/dist/band-CAApY4Pd.cjs +2 -0
- package/dist/band-CAApY4Pd.cjs.map +1 -0
- package/dist/checkIfMultiple-CaefP4X2.js +2264 -0
- package/dist/checkIfMultiple-CaefP4X2.js.map +1 -0
- package/dist/checkIfMultiple-D3h8to1T.cjs +12 -0
- package/dist/checkIfMultiple-D3h8to1T.cjs.map +1 -0
- package/dist/checkIfNullOrUndefined.d.ts +15 -0
- package/dist/checkIfNullOrUndefined.js +2 -0
- package/dist/checkIfNullOrUndefined.js.map +1 -0
- package/dist/customArea-B47Ew5cT.cjs +2 -0
- package/dist/customArea-B47Ew5cT.cjs.map +1 -0
- package/dist/customArea-I3MsoqIl.js +176 -0
- package/dist/customArea-I3MsoqIl.js.map +1 -0
- package/dist/defaultLocale-BEa-49Qz.js +172 -0
- package/dist/defaultLocale-BEa-49Qz.js.map +1 -0
- package/dist/defaultLocale-DIVzfLaQ.cjs +2 -0
- package/dist/defaultLocale-DIVzfLaQ.cjs.map +1 -0
- package/dist/delaunay-C1uAf38t.js +684 -0
- package/dist/delaunay-C1uAf38t.js.map +1 -0
- package/dist/delaunay-rcy0HhZi.cjs +2 -0
- package/dist/delaunay-rcy0HhZi.cjs.map +1 -0
- package/dist/ensureCompleteData-BBDZbDCE.js +102 -0
- package/dist/ensureCompleteData-BBDZbDCE.js.map +1 -0
- package/dist/ensureCompleteData-DqWQ2Zbi.cjs +2 -0
- package/dist/ensureCompleteData-DqWQ2Zbi.cjs.map +1 -0
- package/dist/excelDownload.d.ts +31 -0
- package/dist/excelDownload.js +2 -0
- package/dist/excelDownload.js.map +1 -0
- package/dist/fetchAndParseData.d.ts +84 -0
- package/dist/fetchAndParseData.js +16 -0
- package/dist/fetchAndParseData.js.map +1 -0
- package/dist/filterData-B8ocT57s.js +14 -0
- package/dist/filterData-B8ocT57s.js.map +1 -0
- package/dist/filterData-DN6py7y_.cjs +2 -0
- package/dist/filterData-DN6py7y_.cjs.map +1 -0
- package/dist/generateCodes.d.ts +25 -0
- package/dist/generateCodes.js +2 -0
- package/dist/generateCodes.js.map +1 -0
- package/dist/generateRandomString-B5zBiJzS.cjs +2 -0
- package/dist/generateRandomString-B5zBiJzS.cjs.map +1 -0
- package/dist/generateRandomString-za3IQGfQ.js +11 -0
- package/dist/generateRandomString-za3IQGfQ.js.map +1 -0
- package/dist/getJenks.d.ts +17 -0
- package/dist/getJenks.js +2 -0
- package/dist/getJenks.js.map +1 -0
- package/dist/getPercentileValue.d.ts +13 -0
- package/dist/getPercentileValue.js +2 -0
- package/dist/getPercentileValue.js.map +1 -0
- package/dist/getQueryParamsFromLink.d.ts +18 -0
- package/dist/getQueryParamsFromLink.js +2 -0
- package/dist/getQueryParamsFromLink.js.map +1 -0
- package/dist/getSchema.d.ts +3256 -0
- package/dist/getSchema.js +2 -0
- package/dist/getSchema.js.map +1 -0
- package/dist/getSliderMarks-CWajGCGq.js +719 -0
- package/dist/getSliderMarks-CWajGCGq.js.map +1 -0
- package/dist/getSliderMarks-DDJ1CdhL.cjs +6 -0
- package/dist/getSliderMarks-DDJ1CdhL.cjs.map +1 -0
- package/dist/getTextColorBasedOnBgColor.d.ts +13 -0
- package/dist/getTextColorBasedOnBgColor.js +2 -0
- package/dist/getTextColorBasedOnBgColor.js.map +1 -0
- package/dist/getUniqValue.d.ts +18 -0
- package/dist/getUniqValue.js +2 -0
- package/dist/getUniqValue.js.map +1 -0
- package/dist/graphList.d.ts +9 -0
- package/dist/graphList.js +2 -0
- package/dist/graphList.js.map +1 -0
- package/dist/imageDownload.d.ts +16 -0
- package/dist/imageDownload.js +3 -0
- package/dist/imageDownload.js.map +1 -0
- package/dist/index-01r5X3Gr-9jE0ObrK.cjs +2 -0
- package/dist/index-01r5X3Gr-9jE0ObrK.cjs.map +1 -0
- package/dist/index-01r5X3Gr-kH7FxQ7P.js +451 -0
- package/dist/index-01r5X3Gr-kH7FxQ7P.js.map +1 -0
- package/dist/index-27yTRcko.js +35 -0
- package/dist/index-27yTRcko.js.map +1 -0
- package/dist/index-B0rbzOoC.cjs +2 -0
- package/dist/index-B0rbzOoC.cjs.map +1 -0
- package/dist/index-BGMGC-HN.cjs +22 -0
- package/dist/index-BGMGC-HN.cjs.map +1 -0
- package/dist/index-BHm2KTjD-2e-Fu8L-.js +702 -0
- package/dist/index-BHm2KTjD-2e-Fu8L-.js.map +1 -0
- package/dist/index-BHm2KTjD-D8FylaKc.cjs +44 -0
- package/dist/index-BHm2KTjD-D8FylaKc.cjs.map +1 -0
- package/dist/index-BIPNFFja.js +506 -0
- package/dist/index-BIPNFFja.js.map +1 -0
- package/dist/index-BLizQDlg.js +658 -0
- package/dist/index-BLizQDlg.js.map +1 -0
- package/dist/index-BXns0-ng.cjs +2 -0
- package/dist/index-BXns0-ng.cjs.map +1 -0
- package/dist/index-BYroABPm.cjs +2 -0
- package/dist/index-BYroABPm.cjs.map +1 -0
- package/dist/index-BczVvEBZ.cjs +2 -0
- package/dist/index-BczVvEBZ.cjs.map +1 -0
- package/dist/index-BzeLQvXk.cjs +2 -0
- package/dist/index-BzeLQvXk.cjs.map +1 -0
- package/dist/index-C1rRk_50.js +273 -0
- package/dist/index-C1rRk_50.js.map +1 -0
- package/dist/index-C21TvELx.cjs +2 -0
- package/dist/index-C21TvELx.cjs.map +1 -0
- package/dist/index-CEc_9zWy.cjs +2 -0
- package/dist/index-CEc_9zWy.cjs.map +1 -0
- package/dist/index-CZbIGs8q.cjs +2 -0
- package/dist/index-CZbIGs8q.cjs.map +1 -0
- package/dist/index-CaAIPGZo.js +631 -0
- package/dist/index-CaAIPGZo.js.map +1 -0
- package/dist/index-CbVeVrla.cjs +2 -0
- package/dist/index-CbVeVrla.cjs.map +1 -0
- package/dist/index-CqzhBPuO-CfQywbdq.js +41 -0
- package/dist/index-CqzhBPuO-CfQywbdq.js.map +1 -0
- package/dist/index-CqzhBPuO-raKZqS7l.cjs +2 -0
- package/dist/index-CqzhBPuO-raKZqS7l.cjs.map +1 -0
- package/dist/index-D7ltPi18.js +26 -0
- package/dist/index-D7ltPi18.js.map +1 -0
- package/dist/index-DSnvdkHZ.js +495 -0
- package/dist/index-DSnvdkHZ.js.map +1 -0
- package/dist/index-DXmF_0ez.js +308 -0
- package/dist/index-DXmF_0ez.js.map +1 -0
- package/dist/index-Db-Yg_Ud.js +120 -0
- package/dist/index-Db-Yg_Ud.js.map +1 -0
- package/dist/index-Ds0uHjK9.cjs +2 -0
- package/dist/index-Ds0uHjK9.cjs.map +1 -0
- package/dist/index-DxagiOHo.js +707 -0
- package/dist/index-DxagiOHo.js.map +1 -0
- package/dist/index-DzdwZ2OA.js +77 -0
- package/dist/index-DzdwZ2OA.js.map +1 -0
- package/dist/index-UV9hjG_S.js +53 -0
- package/dist/index-UV9hjG_S.js.map +1 -0
- package/dist/index-a2C2Bqn2.cjs +10 -0
- package/dist/index-a2C2Bqn2.cjs.map +1 -0
- package/dist/index.js +1 -52488
- package/dist/index.js.map +1 -1
- package/dist/init-BhZylTFx.js +63 -0
- package/dist/init-BhZylTFx.js.map +1 -0
- package/dist/init-DU0ybBc_.cjs +2 -0
- package/dist/init-DU0ybBc_.cjs.map +1 -0
- package/dist/line-CPfhohvF.js +68 -0
- package/dist/line-CPfhohvF.js.map +1 -0
- package/dist/line-DHV4JwCR.cjs +2 -0
- package/dist/line-DHV4JwCR.cjs.map +1 -0
- package/dist/linear-BVckp9RD.cjs +2 -0
- package/dist/linear-BVckp9RD.cjs.map +1 -0
- package/dist/linear-DUdu7l2G.js +221 -0
- package/dist/linear-DUdu7l2G.js.map +1 -0
- package/dist/numberFormattingFunction.d.ts +22 -0
- package/dist/numberFormattingFunction.js +2 -0
- package/dist/numberFormattingFunction.js.map +1 -0
- package/dist/ordinal-BOeNbyae.cjs +2 -0
- package/dist/ordinal-BOeNbyae.cjs.map +1 -0
- package/dist/ordinal-w9Lu4Stb.js +62 -0
- package/dist/ordinal-w9Lu4Stb.js.map +1 -0
- package/dist/parse-DlCRUFh_.js +2768 -0
- package/dist/parse-DlCRUFh_.js.map +1 -0
- package/dist/parse-hMnG_lRV.cjs +2 -0
- package/dist/parse-hMnG_lRV.cjs.map +1 -0
- package/dist/pointer-CWRWOsrb.js +23 -0
- package/dist/pointer-CWRWOsrb.js.map +1 -0
- package/dist/pointer-Dkq5NV1q.cjs +2 -0
- package/dist/pointer-Dkq5NV1q.cjs.map +1 -0
- package/dist/pow-B5-jkdHU.cjs +2 -0
- package/dist/pow-B5-jkdHU.cjs.map +1 -0
- package/dist/pow-e8zx3AQJ.js +35 -0
- package/dist/pow-e8zx3AQJ.js.map +1 -0
- package/dist/removeOutliers.d.ts +16 -0
- package/dist/removeOutliers.js +2 -0
- package/dist/removeOutliers.js.map +1 -0
- package/dist/select-Bnfk0lJx.cjs +2 -0
- package/dist/select-Bnfk0lJx.cjs.map +1 -0
- package/dist/select-DKy99ogv.js +584 -0
- package/dist/select-DKy99ogv.js.map +1 -0
- package/dist/simple-statistics-flVzqVtt.js +65 -0
- package/dist/simple-statistics-flVzqVtt.js.map +1 -0
- package/dist/simple-statistics-xm8c0LQQ.cjs +2 -0
- package/dist/simple-statistics-xm8c0LQQ.cjs.map +1 -0
- package/dist/step-BZ3C8QFW.cjs +2 -0
- package/dist/step-BZ3C8QFW.cjs.map +1 -0
- package/dist/step-BrDul-H4.js +119 -0
- package/dist/step-BrDul-H4.js.map +1 -0
- package/dist/string-B8KlVSPX.js +364 -0
- package/dist/string-B8KlVSPX.js.map +1 -0
- package/dist/string-CRoCZCYa.cjs +2 -0
- package/dist/string-CRoCZCYa.cjs.map +1 -0
- package/dist/string2HTML-BX0oNw83.js +758 -0
- package/dist/string2HTML-BX0oNw83.js.map +1 -0
- package/dist/string2HTML-X4ZYX5jI.cjs +3 -0
- package/dist/string2HTML-X4ZYX5jI.cjs.map +1 -0
- package/dist/style.css +1 -1
- package/dist/svgDownload.d.ts +16 -0
- package/dist/svgDownload.js +2 -0
- package/dist/svgDownload.js.map +1 -0
- package/dist/threshold-DFfqcDMa.js +23 -0
- package/dist/threshold-DFfqcDMa.js.map +1 -0
- package/dist/threshold-DNsSUf8Q.cjs +2 -0
- package/dist/threshold-DNsSUf8Q.cjs.map +1 -0
- package/dist/time-Byw_jYQ7.cjs +2 -0
- package/dist/time-Byw_jYQ7.cjs.map +1 -0
- package/dist/time-BzJP5SPC.js +715 -0
- package/dist/time-BzJP5SPC.js.map +1 -0
- package/dist/timer-B39XOBYL.js +124 -0
- package/dist/timer-B39XOBYL.js.map +1 -0
- package/dist/timer-CKyBCVzT.cjs +2 -0
- package/dist/timer-CKyBCVzT.cjs.map +1 -0
- package/dist/toConsumableArray-BSMMWi3w-Cu4vcE-m.js +139 -0
- package/dist/toConsumableArray-BSMMWi3w-Cu4vcE-m.js.map +1 -0
- package/dist/toConsumableArray-BSMMWi3w-DJL7-zAp.cjs +4 -0
- package/dist/toConsumableArray-BSMMWi3w-DJL7-zAp.cjs.map +1 -0
- package/dist/transformColumnsToArray.d.ts +38 -0
- package/dist/transformColumnsToArray.js +2 -0
- package/dist/transformColumnsToArray.js.map +1 -0
- package/dist/transformDataForAggregation.d.ts +38 -0
- package/dist/transformDataForAggregation.js +2 -0
- package/dist/transformDataForAggregation.js.map +1 -0
- package/dist/transformDataForGraph.d.ts +47 -0
- package/dist/transformDataForGraph.js +2 -0
- package/dist/transformDataForGraph.js.map +1 -0
- package/dist/transformDataForGraphFromFile.d.ts +66 -0
- package/dist/transformDataForGraphFromFile.js +2 -0
- package/dist/transformDataForGraphFromFile.js.map +1 -0
- package/dist/use-in-view-CZPXmTZM.js +4645 -0
- package/dist/use-in-view-CZPXmTZM.js.map +1 -0
- package/dist/use-in-view-Dl1CsAIo.cjs +2 -0
- package/dist/use-in-view-Dl1CsAIo.cjs.map +1 -0
- package/dist/validateSchema.d.ts +68 -0
- package/dist/validateSchema.js +2 -0
- package/dist/validateSchema.js.map +1 -0
- package/dist/x-Dft9NVe_-DcB7wtv5.js +61 -0
- package/dist/x-Dft9NVe_-DcB7wtv5.js.map +1 -0
- package/dist/x-Dft9NVe_-LeyJu02C.cjs +27 -0
- package/dist/x-Dft9NVe_-LeyJu02C.cjs.map +1 -0
- package/dist/y-D0sAaVii.js +421 -0
- package/dist/y-D0sAaVii.js.map +1 -0
- package/dist/y-QcCbqrzx.cjs +2 -0
- package/dist/y-QcCbqrzx.cjs.map +1 -0
- package/dist/zoom-Lo7IAUfC.cjs +2 -0
- package/dist/zoom-Lo7IAUfC.cjs.map +1 -0
- package/dist/zoom-_lqdiGoI.js +1983 -0
- package/dist/zoom-_lqdiGoI.js.map +1 -0
- package/package.json +415 -4
- package/dist/index.cjs +0 -68
- package/dist/index.cjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SingleGraphDashboardFromConfig.js","sources":["../src/Components/Dashboard/SingleGraphDashboardFromConfig.tsx"],"sourcesContent":["import { useEffect, useState } from 'react';\r\nimport { Spinner } from '@undp/design-system-react/Spinner';\r\n\r\nimport { SingleGraphDashboard } from './SingleGraphDashboard';\r\n\r\nimport {\r\n AdvancedDataSelectionDataType,\r\n AggregationSettingsDataType,\r\n DataFilterDataType,\r\n DataSelectionDataType,\r\n DataSettingsDataType,\r\n FilterUiSettingsDataType,\r\n GraphConfigurationDataType,\r\n GraphSettingsDataType,\r\n GraphType,\r\n HighlightDataPointSettingsDataType,\r\n} from '@/Types';\r\nimport { fetchAndParseJSON } from '@/Utils/fetchAndParseData';\r\n\r\ninterface ConfigObject {\r\n graphSettings?: GraphSettingsDataType;\r\n dataSettings?: DataSettingsDataType;\r\n filters?: FilterUiSettingsDataType[];\r\n graphType: GraphType;\r\n noOfFiltersPerRow?: number;\r\n dataTransform?: {\r\n keyColumn: string;\r\n aggregationColumnsSetting?: AggregationSettingsDataType[];\r\n };\r\n dataFilters?: DataFilterDataType[];\r\n graphDataConfiguration?: GraphConfigurationDataType[];\r\n debugMode?: boolean;\r\n dataSelectionOptions?: DataSelectionDataType[];\r\n advancedDataSelectionOptions?: AdvancedDataSelectionDataType[];\r\n highlightDataPointSettings?: HighlightDataPointSettingsDataType;\r\n readableHeader?: {\r\n value: string;\r\n label: string;\r\n }[];\r\n uiMode?: 'light' | 'normal';\r\n}\r\n\r\ninterface Props {\r\n config: string | ConfigObject;\r\n}\r\n\r\nexport function SingleGraphDashboardFromConfig(props: Props) {\r\n const { config } = props;\r\n const [configSettings, setConfigSettings] = useState<ConfigObject | undefined>(undefined);\r\n\r\n useEffect(() => {\r\n if (typeof config === 'string') {\r\n const fetchData = fetchAndParseJSON(config);\r\n fetchData.then(d => {\r\n setConfigSettings(d);\r\n });\r\n } else {\r\n setConfigSettings(config);\r\n }\r\n }, [config]);\r\n if (!configSettings)\r\n return (\r\n <div className='w-full flex justify-center p-4'>\r\n <Spinner />\r\n </div>\r\n );\r\n return (\r\n <SingleGraphDashboard\r\n graphSettings={configSettings.graphSettings}\r\n dataSettings={configSettings.dataSettings}\r\n filters={configSettings.filters}\r\n graphType={configSettings.graphType}\r\n dataTransform={configSettings.dataTransform}\r\n graphDataConfiguration={configSettings.graphDataConfiguration}\r\n dataFilters={configSettings.dataFilters}\r\n debugMode={configSettings.debugMode}\r\n dataSelectionOptions={configSettings.dataSelectionOptions}\r\n advancedDataSelectionOptions={configSettings.advancedDataSelectionOptions}\r\n readableHeader={configSettings.readableHeader}\r\n noOfFiltersPerRow={configSettings.noOfFiltersPerRow}\r\n uiMode={configSettings.uiMode}\r\n highlightDataPointSettings={configSettings.highlightDataPointSettings}\r\n />\r\n );\r\n}\r\n"],"names":["SingleGraphDashboardFromConfig","props","config","configSettings","setConfigSettings","useState","useEffect","fetchAndParseJSON","d","jsx","SingleGraphDashboard","Spinner"],"mappings":"mQA8CO,SAASA,EAA+BC,EAAc,CAC3D,KAAM,CAAE,OAAAC,GAAWD,EACb,CAACE,EAAgBC,CAAiB,EAAIC,EAAAA,SAAmC,MAAS,EAYxF,OAVAC,EAAAA,UAAU,IAAM,CACV,OAAOJ,GAAW,SACFK,EAAAA,kBAAkBL,CAAM,EAChC,KAAKM,GAAK,CAClBJ,EAAkBI,CAAC,CACrB,CAAC,EAEDJ,EAAkBF,CAAM,CAE5B,EAAG,CAACA,CAAM,CAAC,EACNC,EAOHM,EAAAA,kBAAAA,IAACC,EAAAA,qBAAA,CACC,cAAeP,EAAe,cAC9B,aAAcA,EAAe,aAC7B,QAASA,EAAe,QACxB,UAAWA,EAAe,UAC1B,cAAeA,EAAe,cAC9B,uBAAwBA,EAAe,uBACvC,YAAaA,EAAe,YAC5B,UAAWA,EAAe,UAC1B,qBAAsBA,EAAe,qBACrC,6BAA8BA,EAAe,6BAC7C,eAAgBA,EAAe,eAC/B,kBAAmBA,EAAe,kBAClC,OAAQA,EAAe,OACvB,2BAA4BA,EAAe,0BAAA,CAAA,0BAnB1C,MAAA,CAAI,UAAU,iCACb,SAAAM,wBAACE,EAAAA,eAAAA,UAAQ,EACX,CAoBN"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { JSX } from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
declare interface AnimateDataType {
|
|
4
|
+
duration: number;
|
|
5
|
+
once: boolean;
|
|
6
|
+
amount: 'some' | 'all' | number;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
declare interface AxesClassNameObject {
|
|
10
|
+
gridLines?: string;
|
|
11
|
+
labels?: string;
|
|
12
|
+
title?: string;
|
|
13
|
+
axis?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
declare interface AxesStyleObject {
|
|
17
|
+
gridLines?: React.CSSProperties;
|
|
18
|
+
labels?: React.CSSProperties;
|
|
19
|
+
title?: React.CSSProperties;
|
|
20
|
+
axis?: React.CSSProperties;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
declare interface ClassNameObject {
|
|
24
|
+
title?: string;
|
|
25
|
+
footnote?: string;
|
|
26
|
+
source?: string;
|
|
27
|
+
description?: string;
|
|
28
|
+
tooltip?: string;
|
|
29
|
+
xAxis?: AxesClassNameObject;
|
|
30
|
+
yAxis?: AxesClassNameObject;
|
|
31
|
+
legend?: string;
|
|
32
|
+
graphContainer?: string;
|
|
33
|
+
graphObjectValues?: string;
|
|
34
|
+
dataConnectors?: string;
|
|
35
|
+
mouseOverLine?: string;
|
|
36
|
+
regLine?: string;
|
|
37
|
+
dataCards?: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
declare interface CustomLayerDataType {
|
|
41
|
+
position: 'before' | 'after';
|
|
42
|
+
layer: React.ReactNode;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
declare type Languages = 'en' | 'ar' | 'az' | 'bn' | 'cy' | 'he' | 'hi' | 'jp' | 'ka' | 'km' | 'ko' | 'my' | 'ne' | 'zh' | 'custom';
|
|
46
|
+
|
|
47
|
+
declare interface Props {
|
|
48
|
+
/** Array of data objects */
|
|
49
|
+
data: SlopeChartDataType[];
|
|
50
|
+
/** Title of the graph */
|
|
51
|
+
graphTitle?: string | React.ReactNode;
|
|
52
|
+
/** Description of the graph */
|
|
53
|
+
graphDescription?: string | React.ReactNode;
|
|
54
|
+
/** Footnote for the graph */
|
|
55
|
+
footNote?: string | React.ReactNode;
|
|
56
|
+
/** Source data for the graph */
|
|
57
|
+
sources?: SourcesDataType[];
|
|
58
|
+
/** Accessibility label */
|
|
59
|
+
ariaLabel?: string;
|
|
60
|
+
/** Color or array of colors for circles */
|
|
61
|
+
colors?: string | string[];
|
|
62
|
+
/** Domain of colors for the graph */
|
|
63
|
+
colorDomain?: string[];
|
|
64
|
+
/** Title for the color legend */
|
|
65
|
+
colorLegendTitle?: string;
|
|
66
|
+
/** Background color of the graph */
|
|
67
|
+
backgroundColor?: string | boolean;
|
|
68
|
+
/** Custom styles for the graph. Each object should be a valid React CSS style object. */
|
|
69
|
+
styles?: StyleObject;
|
|
70
|
+
/** Custom class names */
|
|
71
|
+
classNames?: ClassNameObject;
|
|
72
|
+
/** Width of the graph */
|
|
73
|
+
width?: number;
|
|
74
|
+
/** Height of the graph */
|
|
75
|
+
height?: number;
|
|
76
|
+
/** Minimum height of the graph */
|
|
77
|
+
minHeight?: number;
|
|
78
|
+
/** Relative height scaling factor. This overwrites the height props */
|
|
79
|
+
relativeHeight?: number;
|
|
80
|
+
/** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */
|
|
81
|
+
padding?: string;
|
|
82
|
+
/** Left margin of the graph */
|
|
83
|
+
leftMargin?: number;
|
|
84
|
+
/** Right margin of the graph */
|
|
85
|
+
rightMargin?: number;
|
|
86
|
+
/** Top margin of the graph */
|
|
87
|
+
topMargin?: number;
|
|
88
|
+
/** Bottom margin of the graph */
|
|
89
|
+
bottomMargin?: number;
|
|
90
|
+
/** Toggles the background to fill the container. This only works if the width of the graph is defined. */
|
|
91
|
+
fillContainer?: boolean;
|
|
92
|
+
/** Maximum value for the chart */
|
|
93
|
+
maxValue?: number;
|
|
94
|
+
/** Minimum value for the chart */
|
|
95
|
+
minValue?: number;
|
|
96
|
+
/** Toggle visibility of labels */
|
|
97
|
+
showLabels?: boolean;
|
|
98
|
+
/** Radius of the circles */
|
|
99
|
+
radius?: number;
|
|
100
|
+
/** Title for the two axis */
|
|
101
|
+
axisTitles?: [string, string];
|
|
102
|
+
/** Toggle visibility of color scale. This is only applicable if the data props hae color parameter */
|
|
103
|
+
showColorScale?: boolean;
|
|
104
|
+
/** Toggle visibility of NA color in the color scale. This is only applicable if the data props hae color parameter and showColorScale prop is true */
|
|
105
|
+
showNAColor?: boolean;
|
|
106
|
+
/** Data points to highlight. Use the label value from data to highlight the data point */
|
|
107
|
+
highlightedDataPoints?: (string | number)[];
|
|
108
|
+
/** Defines the opacity of the non-highlighted data */
|
|
109
|
+
dimmedOpacity?: number;
|
|
110
|
+
/** Toggles if the graph animates in when loaded. */
|
|
111
|
+
animate?: boolean | AnimateDataType;
|
|
112
|
+
/** Optional SVG <g> element or function that renders custom content behind or in front of the graph. */
|
|
113
|
+
customLayers?: CustomLayerDataType[];
|
|
114
|
+
/** Enable graph download option as png */
|
|
115
|
+
graphDownload?: boolean;
|
|
116
|
+
/** Enable data download option as a csv */
|
|
117
|
+
dataDownload?: boolean;
|
|
118
|
+
/** Reset selection on double-click. Only applicable when used in a dashboard context with filters. */
|
|
119
|
+
resetSelectionOnDoubleClick?: boolean;
|
|
120
|
+
/** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */
|
|
121
|
+
tooltip?: string | ((_d: any) => React.ReactNode);
|
|
122
|
+
/** Details displayed on the modal when user clicks of a data point. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */
|
|
123
|
+
detailsOnClick?: string | ((_d: any) => React.ReactNode);
|
|
124
|
+
/** Callback for mouse over event */
|
|
125
|
+
onSeriesMouseOver?: (_d: any) => void;
|
|
126
|
+
/** Callback for mouse click event */
|
|
127
|
+
onSeriesMouseClick?: (_d: any) => void;
|
|
128
|
+
/** Language setting */
|
|
129
|
+
language?: Languages;
|
|
130
|
+
/** Color theme */
|
|
131
|
+
theme?: 'light' | 'dark';
|
|
132
|
+
/** Unique ID for the graph */
|
|
133
|
+
graphID?: string;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export declare function SlopeChart(props: Props): JSX.Element;
|
|
137
|
+
|
|
138
|
+
declare interface SlopeChartDataType {
|
|
139
|
+
y1: number;
|
|
140
|
+
y2: number;
|
|
141
|
+
color?: string | number;
|
|
142
|
+
label: string | number;
|
|
143
|
+
data?: object;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
declare interface SourcesDataType {
|
|
147
|
+
source: string;
|
|
148
|
+
link?: string;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
declare interface StyleObject {
|
|
152
|
+
title?: React.CSSProperties;
|
|
153
|
+
footnote?: React.CSSProperties;
|
|
154
|
+
source?: React.CSSProperties;
|
|
155
|
+
description?: React.CSSProperties;
|
|
156
|
+
graphContainer?: React.CSSProperties;
|
|
157
|
+
tooltip?: React.CSSProperties;
|
|
158
|
+
xAxis?: AxesStyleObject;
|
|
159
|
+
yAxis?: AxesStyleObject;
|
|
160
|
+
graphObjectValues?: React.CSSProperties;
|
|
161
|
+
dataConnectors?: React.CSSProperties;
|
|
162
|
+
mouseOverLine?: React.CSSProperties;
|
|
163
|
+
regLine?: React.CSSProperties;
|
|
164
|
+
dataCards?: React.CSSProperties;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export { }
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-BHm2KTjD-D8FylaKc.cjs"),rt=require("./index-CZbIGs8q.cjs"),p=require("react"),b=require("./Typography-CDR-DAHH.cjs"),ct=require("./index-BXns0-ng.cjs"),xt=require("./Modal-cQF2UQIa.cjs"),ut=require("./Tooltip-BM18N_3l.cjs"),K=require("./checkIfNullOrUndefined.js"),a=require("./Colors.js"),yt=require("./string2HTML-X4ZYX5jI.cjs"),lt=require("./Axis-BlyBRMNw.cjs"),nt=require("./AxisTitle-BY8MI9jC.cjs"),w=require("./use-in-view-Dl1CsAIo.cjs"),ht=require("./linear-BVckp9RD.cjs"),mt=require("./index-a2C2Bqn2.cjs"),gt=require("./GraphFooter.js"),pt=require("./GraphHeader.js"),ft=require("./ColorLegendWithMouseOver.js"),dt=require("./EmptyState-BQguKAp5.cjs");function jt(J){const{data:r,width:O,height:R,showLabels:V,colors:e,colorDomain:n,radius:c,leftMargin:y,rightMargin:P,topMargin:G,bottomMargin:Q,tooltip:Y,onSeriesMouseOver:U,axisTitles:D,highlightedDataPoints:u,selectedColor:I,minValue:B,maxValue:F,onSeriesMouseClick:T,resetSelectionOnDoubleClick:Z,detailsOnClick:g,styles:f,classNames:h,animate:s,dimmedOpacity:d,customLayers:X}=J,z=p.useRef(null),j=w.useInView(z,{once:s.once,amount:s.amount}),[v,S]=p.useState(void 0),[M,N]=p.useState(void 0),[_,$]=p.useState(void 0),[q,H]=p.useState(void 0),k={top:G,bottom:Q,left:y,right:P},E=O-k.left-k.right,m=R-k.top-k.bottom,C=Math.min(Math.min(...r.map(t=>t.y1)),Math.min(...r.map(t=>t.y2))),L=Math.max(Math.max(...r.map(t=>t.y1)),Math.max(...r.map(t=>t.y2))),x=ht.linear().domain([K.checkIfNullOrUndefined(B)?C>0?0:C:B,K.checkIfNullOrUndefined(F)?L>0?L:0:F]).range([m,0]).nice();return o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[o.jsxRuntimeExports.jsx(w.motion.svg,{width:`${O}px`,height:`${R}px`,viewBox:`0 0 ${O} ${R}`,className:"mx-auto",direction:"ltr",ref:z,children:o.jsxRuntimeExports.jsxs("g",{transform:`translate(${k.left},${k.top})`,children:[o.jsxRuntimeExports.jsxs("g",{children:[o.jsxRuntimeExports.jsx(lt.Axis,{y1:0,y2:m,x1:c,x2:c,classNames:{axis:b.cnExports.cn("stroke-1 stroke-primary-gray-500 dark:stroke-primary-gray-550",h?.yAxis?.axis)}}),o.jsxRuntimeExports.jsx(nt.AxisTitle,{x:c,y:m+15,style:f?.yAxis?.title,className:b.cnExports.cn("fill-primary-gray-700 dark:fill-primary-gray-300 text-xs",h?.yAxis?.title),text:D[0]})]}),o.jsxRuntimeExports.jsxs("g",{children:[o.jsxRuntimeExports.jsx(lt.Axis,{y1:0,y2:m,x1:E-c,x2:E-c,classNames:{axis:b.cnExports.cn("stroke-1 stroke-primary-gray-500 dark:stroke-primary-gray-550",h?.yAxis?.axis)}}),o.jsxRuntimeExports.jsx(nt.AxisTitle,{x:E-c,y:m+15,style:f?.yAxis?.title,className:b.cnExports.cn("fill-primary-gray-700 dark:fill-primary-gray-300 text-xs",h?.yAxis?.title),text:D[1]})]}),X.filter(t=>t.position==="before").map(t=>t.layer),o.jsxRuntimeExports.jsx(mt.AnimatePresence,{children:r.map((t,A)=>o.jsxRuntimeExports.jsxs(w.motion.g,{variants:{initial:{opacity:I?t.color&&e[n.indexOf(`${t.color}`)]===I?1:d:v?v.label===t.label?1:d:u.length!==0?u.indexOf(t.label)!==-1?1:d:1},whileInView:{opacity:I?t.color&&e[n.indexOf(`${t.color}`)]===I?1:d:v?v.label===t.label?1:d:u.length!==0?u.indexOf(t.label)!==-1?1:d:1,transition:{duration:s.duration}}},initial:"initial",animate:j?"whileInView":"initial",exit:{opacity:0,transition:{duration:s.duration}},onMouseEnter:i=>{S(t),H(i.clientY),$(i.clientX),U?.(t)},onMouseMove:i=>{S(t),H(i.clientY),$(i.clientX)},onMouseLeave:()=>{S(void 0),$(void 0),H(void 0),U?.(void 0)},onClick:()=>{(T||g)&&(ct.isEqual(M,t)&&Z?(N(void 0),T?.(void 0)):(N(t),T?.(t)))},children:[o.jsxRuntimeExports.jsx(w.motion.circle,{cx:c,variants:{initial:{cy:x(t.y1),fill:r.filter(i=>i.color).length===0?e[0]:t.color?e[n.indexOf(`${t.color}`)]:a.Colors.gray,stroke:r.filter(i=>i.color).length===0?e[0]:t.color?e[n.indexOf(`${t.color}`)]:a.Colors.gray,opacity:0},whileInView:{cy:x(t.y1),fill:r.filter(i=>i.color).length===0?e[0]:t.color?e[n.indexOf(`${t.color}`)]:a.Colors.gray,stroke:r.filter(i=>i.color).length===0?e[0]:t.color?e[n.indexOf(`${t.color}`)]:a.Colors.gray,opacity:1,transition:{duration:s.duration}}},initial:"initial",animate:j?"whileInView":"initial",exit:{opacity:0,transition:{duration:s.duration}},r:c,style:{fillOpacity:.6}}),V?o.jsxRuntimeExports.jsx(w.motion.text,{variants:{initial:{y:x(t.y1),fill:r.filter(i=>i.color).length===0?e[0]:t.color?e[n.indexOf(`${t.color}`)]:a.Colors.gray,opacity:0},whileInView:{y:x(t.y1),fill:r.filter(i=>i.color).length===0?e[0]:t.color?e[n.indexOf(`${t.color}`)]:a.Colors.gray,opacity:1,transition:{duration:s.duration}}},initial:"initial",animate:j?"whileInView":"initial",exit:{opacity:0,transition:{duration:s.duration}},style:{textAnchor:"end",...f?.yAxis?.labels||{}},className:b.cnExports.cn("text-xs",h?.yAxis?.labels),x:5,dy:"0.33em",textAnchor:"end",dx:0-c-3,children:t.label}):u.length!==0&&u.indexOf(t.label)!==-1?o.jsxRuntimeExports.jsx(w.motion.text,{variants:{initial:{y:x(t.y1),fill:r.filter(i=>i.color).length===0?e[0]:t.color?e[n.indexOf(`${t.color}`)]:a.Colors.gray,opacity:0},whileInView:{y:x(t.y1),fill:r.filter(i=>i.color).length===0?e[0]:t.color?e[n.indexOf(`${t.color}`)]:a.Colors.gray,opacity:1,transition:{duration:s.duration}}},initial:"initial",animate:j?"whileInView":"initial",exit:{opacity:0,transition:{duration:s.duration}},style:{textAnchor:"end",...f?.yAxis?.labels||{}},className:b.cnExports.cn("text-xs",h?.yAxis?.labels),x:5,dy:"0.33em",dx:-3,children:t.label}):null,o.jsxRuntimeExports.jsx(w.motion.circle,{cx:E-c,variants:{initial:{cy:x(t.y2),fill:r.filter(i=>i.color).length===0?e[0]:t.color?e[n.indexOf(`${t.color}`)]:a.Colors.gray,stroke:r.filter(i=>i.color).length===0?e[0]:t.color?e[n.indexOf(`${t.color}`)]:a.Colors.gray,opacity:0},whileInView:{cy:x(t.y2),fill:r.filter(i=>i.color).length===0?e[0]:t.color?e[n.indexOf(`${t.color}`)]:a.Colors.gray,stroke:r.filter(i=>i.color).length===0?e[0]:t.color?e[n.indexOf(`${t.color}`)]:a.Colors.gray,opacity:1,transition:{duration:s.duration}}},initial:"initial",animate:j?"whileInView":"initial",exit:{opacity:0,transition:{duration:s.duration}},r:c,style:{fillOpacity:.6}}),V?o.jsxRuntimeExports.jsx(w.motion.text,{variants:{initial:{y:x(t.y2),fill:r.filter(i=>i.color).length===0?e[0]:t.color?e[n.indexOf(`${t.color}`)]:a.Colors.gray,opacity:0},whileInView:{y:x(t.y2),fill:r.filter(i=>i.color).length===0?e[0]:t.color?e[n.indexOf(`${t.color}`)]:a.Colors.gray,opacity:1,transition:{duration:s.duration}}},initial:"initial",animate:j?"whileInView":"initial",exit:{opacity:0,transition:{duration:s.duration}},style:{textAnchor:"start",...f?.yAxis?.labels||{}},className:b.cnExports.cn("text-xs",h?.yAxis?.labels),x:E-5,dy:"0.33em",dx:c+3,children:t.label}):u.length!==0&&u.indexOf(t.label)!==-1?o.jsxRuntimeExports.jsx(w.motion.text,{variants:{initial:{y:x(t.y2),fill:r.filter(i=>i.color).length===0?e[0]:t.color?e[n.indexOf(`${t.color}`)]:a.Colors.gray,opacity:0},whileInView:{y:x(t.y2),fill:r.filter(i=>i.color).length===0?e[0]:t.color?e[n.indexOf(`${t.color}`)]:a.Colors.gray,opacity:1,transition:{duration:s.duration}}},initial:"initial",animate:j?"whileInView":"initial",exit:{opacity:0,transition:{duration:s.duration}},style:{textAnchor:"start",...f?.yAxis?.labels||{}},className:b.cnExports.cn("text-xs",h?.yAxis?.labels),x:E-5,dy:"0.33em",dx:3,children:t.label}):null,o.jsxRuntimeExports.jsx(w.motion.line,{x1:c,x2:E-c,variants:{initial:{y1:x(t.y1),y2:x(t.y1),stroke:r.filter(i=>i.color).length===0?e[0]:t.color?e[n.indexOf(`${t.color}`)]:a.Colors.gray},whileInView:{y1:x(t.y1),y2:x(t.y2),stroke:r.filter(i=>i.color).length===0?e[0]:t.color?e[n.indexOf(`${t.color}`)]:a.Colors.gray,transition:{duration:s.duration}}},initial:"initial",animate:j?"whileInView":"initial",exit:{opacity:0,transition:{duration:s.duration}},className:h?.dataConnectors,style:{fill:"none",strokeWidth:1,...f?.dataConnectors}})]},A))}),X.filter(t=>t.position==="after").map(t=>t.layer)]})}),v&&Y&&_&&q?o.jsxRuntimeExports.jsx(ut.Tooltip,{data:v,body:Y,xPos:_,yPos:q,backgroundStyle:f?.tooltip,className:h?.tooltip}):null,g&&M!==void 0?o.jsxRuntimeExports.jsx(xt.ModalExports.Modal,{open:M!==void 0,onClose:()=>{N(void 0)},children:o.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof g=="string"?{__html:yt.string2HTML(g,M)}:void 0,children:typeof g=="function"?g(M):null})}):null]})}function wt(J){const{data:r,graphTitle:O,colors:R,sources:V,graphDescription:e,showLabels:n=!1,height:c,width:y,footNote:P,colorDomain:G,colorLegendTitle:Q,radius:Y=5,axisTitles:U=["",""],padding:D,backgroundColor:u=!1,leftMargin:I=50,rightMargin:B=50,topMargin:F=20,bottomMargin:T=20,tooltip:Z,relativeHeight:g,onSeriesMouseOver:f,showColorScale:h=!0,highlightedDataPoints:s=[],graphID:d,minValue:X,maxValue:z,onSeriesMouseClick:j,graphDownload:v=!1,dataDownload:S=!1,fillContainer:M=!0,language:N="en",showNAColor:_=!0,minHeight:$=0,theme:q="light",ariaLabel:H,resetSelectionOnDoubleClick:k=!0,detailsOnClick:E,styles:m,classNames:C,animate:L=!1,dimmedOpacity:x=.3,customLayers:t=[]}=J,[A,i]=p.useState(0),[tt,it]=p.useState(0),[at,st]=p.useState(void 0),W=p.useRef(null),et=p.useRef(null);return p.useEffect(()=>{const l=new ResizeObserver(ot=>{i(y||ot[0].target.clientWidth||620),it(c||ot[0].target.clientHeight||480)});return W.current&&(it(W.current.clientHeight||480),i(W.current.clientWidth||620),y||l.observe(W.current)),()=>l.disconnect()},[y,c]),o.jsxRuntimeExports.jsx("div",{className:`${q||"light"} flex ${y?"grow-0":"grow"} ${M?"w-full":"w-fit"} `,dir:N==="he"||N==="ar"?"rtl":void 0,children:o.jsxRuntimeExports.jsx("div",{className:b.cnExports.cn(`${u?u===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${N||"en"}`,C?.graphContainer),style:{...m?.graphContainer||{},...u&&u!==!0?{backgroundColor:u}:{}},id:d,ref:et,"aria-label":H||`${O?`The graph shows ${O}. `:""}This is a slope chart showing changes in data between two category or starting and ending time. Each line represents a different row in data, with lines sloping up or down to show increase or decrease over two categories or time.${e?` ${e}`:""}`,children:o.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:u?D||"1rem":D||0},children:o.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[O||e||v||S?o.jsxRuntimeExports.jsx(pt.GraphHeader,{styles:{title:m?.title,description:m?.description},classNames:{title:C?.title,description:C?.description},graphTitle:O,graphDescription:e,width:y,graphDownload:v?et.current:void 0,dataDownload:S?r.map(l=>l.data).filter(l=>l!==void 0).length>0?r.map(l=>l.data).filter(l=>l!==void 0):r.filter(l=>l!==void 0):null}):null,o.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:r.length===0?o.jsxRuntimeExports.jsx(dt.EmptyState,{}):o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[h&&r.filter(l=>l.color).length!==0?o.jsxRuntimeExports.jsx(ft.ColorLegendWithMouseOver,{width:y,colorLegendTitle:Q,colors:R||a.Colors[q].categoricalColors.colors,colorDomain:G||rt.uniqBy(r.filter(l=>l.color),"color").map(l=>l.color),setSelectedColor:st,showNAColor:_}):null,o.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center w-full leading-0",ref:W,"aria-label":"Graph area",children:(y||A)&&(c||tt)?o.jsxRuntimeExports.jsx(jt,{data:r.filter(l=>!K.checkIfNullOrUndefined(l.y1)&&!K.checkIfNullOrUndefined(l.y2)),width:y||A,height:Math.max($,c||(g?$?(y||A)*g>$?(y||A)*g:$:(y||A)*g:tt)),colorDomain:r.filter(l=>l.color).length===0?[]:G||rt.uniqBy(r.filter(l=>l.color),"color").map(l=>l.color),colors:r.filter(l=>l.color).length===0?R?[R]:[a.Colors.primaryColors["blue-600"]]:R||a.Colors[q].categoricalColors.colors,selectedColor:at,axisTitles:U,showLabels:n,radius:Y,leftMargin:I,rightMargin:B,topMargin:F,bottomMargin:T,tooltip:Z,onSeriesMouseOver:f,highlightedDataPoints:s,minValue:X,maxValue:z,onSeriesMouseClick:j,resetSelectionOnDoubleClick:k,detailsOnClick:E,styles:m,classNames:C,animate:L===!0?{duration:.5,once:!0,amount:.5}:L||{duration:0,once:!0,amount:0},dimmedOpacity:x,customLayers:t}):null})]})}),V||P?o.jsxRuntimeExports.jsx(gt.GraphFooter,{styles:{footnote:m?.footnote,source:m?.source},classNames:{footnote:C?.footnote,source:C?.source},sources:V,footNote:P,width:y}):null]})})})})}exports.SlopeChart=wt;
|
|
2
|
+
//# sourceMappingURL=SlopeChart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SlopeChart.js","sources":["../src/Components/Graphs/SlopeChart/Graph.tsx","../src/Components/Graphs/SlopeChart/index.tsx"],"sourcesContent":["import isEqual from 'fast-deep-equal';\r\nimport { useRef, useState } from 'react';\r\nimport { scaleLinear } from 'd3-scale';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport { Modal } from '@undp/design-system-react/Modal';\r\nimport { AnimatePresence, motion, useInView } from 'motion/react';\r\n\r\nimport {\r\n AnimateDataType,\r\n ClassNameObject,\r\n CustomLayerDataType,\r\n SlopeChartDataType,\r\n StyleObject,\r\n} from '@/Types';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { string2HTML } from '@/Utils/string2HTML';\r\nimport { Axis } from '@/Components/Elements/Axes/Axis';\r\nimport { AxisTitle } from '@/Components/Elements/Axes/AxisTitle';\r\n\r\ninterface Props {\r\n data: SlopeChartDataType[];\r\n width: number;\r\n height: number;\r\n selectedColor?: string;\r\n showLabels: boolean;\r\n colors: string[];\r\n colorDomain: string[];\r\n radius: number;\r\n leftMargin: number;\r\n rightMargin: number;\r\n topMargin: number;\r\n bottomMargin: number;\r\n axisTitles: [string, string];\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n highlightedDataPoints: (string | number)[];\r\n maxValue?: number;\r\n minValue?: number;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n resetSelectionOnDoubleClick: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n animate: AnimateDataType;\r\n dimmedOpacity: number;\r\n customLayers: CustomLayerDataType[];\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n width,\r\n height,\r\n showLabels,\r\n colors,\r\n colorDomain,\r\n radius,\r\n leftMargin,\r\n rightMargin,\r\n topMargin,\r\n bottomMargin,\r\n tooltip,\r\n onSeriesMouseOver,\r\n axisTitles,\r\n highlightedDataPoints,\r\n selectedColor,\r\n minValue,\r\n maxValue,\r\n onSeriesMouseClick,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n animate,\r\n dimmedOpacity,\r\n customLayers,\r\n } = props;\r\n const svgRef = useRef(null);\r\n const isInView = useInView(svgRef, {\r\n once: animate.once,\r\n amount: animate.amount,\r\n });\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n const margin = {\r\n top: topMargin,\r\n bottom: bottomMargin,\r\n left: leftMargin,\r\n right: rightMargin,\r\n };\r\n const graphWidth = width - margin.left - margin.right;\r\n const graphHeight = height - margin.top - margin.bottom;\r\n const minY = Math.min(Math.min(...data.map(d => d.y1)), Math.min(...data.map(d => d.y2)));\r\n const maxY = Math.max(Math.max(...data.map(d => d.y1)), Math.max(...data.map(d => d.y2)));\r\n const y = scaleLinear()\r\n .domain([\r\n checkIfNullOrUndefined(minValue) ? (minY > 0 ? 0 : minY) : (minValue as number),\r\n checkIfNullOrUndefined(maxValue) ? (maxY > 0 ? maxY : 0) : (maxValue as number),\r\n ])\r\n .range([graphHeight, 0])\r\n .nice();\r\n return (\r\n <>\r\n <motion.svg\r\n width={`${width}px`}\r\n height={`${height}px`}\r\n viewBox={`0 0 ${width} ${height}`}\r\n className='mx-auto'\r\n direction='ltr'\r\n ref={svgRef}\r\n >\r\n <g transform={`translate(${margin.left},${margin.top})`}>\r\n <g>\r\n <Axis\r\n y1={0}\r\n y2={graphHeight}\r\n x1={radius}\r\n x2={radius}\r\n classNames={{\r\n axis: cn(\r\n 'stroke-1 stroke-primary-gray-500 dark:stroke-primary-gray-550',\r\n classNames?.yAxis?.axis,\r\n ),\r\n }}\r\n />\r\n <AxisTitle\r\n x={radius}\r\n y={graphHeight + 15}\r\n style={styles?.yAxis?.title}\r\n className={cn(\r\n 'fill-primary-gray-700 dark:fill-primary-gray-300 text-xs',\r\n classNames?.yAxis?.title,\r\n )}\r\n text={axisTitles[0]}\r\n />\r\n </g>\r\n <g>\r\n <Axis\r\n y1={0}\r\n y2={graphHeight}\r\n x1={graphWidth - radius}\r\n x2={graphWidth - radius}\r\n classNames={{\r\n axis: cn(\r\n 'stroke-1 stroke-primary-gray-500 dark:stroke-primary-gray-550',\r\n classNames?.yAxis?.axis,\r\n ),\r\n }}\r\n />\r\n <AxisTitle\r\n x={graphWidth - radius}\r\n y={graphHeight + 15}\r\n style={styles?.yAxis?.title}\r\n className={cn(\r\n 'fill-primary-gray-700 dark:fill-primary-gray-300 text-xs',\r\n classNames?.yAxis?.title,\r\n )}\r\n text={axisTitles[1]}\r\n />\r\n </g>\r\n {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n <AnimatePresence>\r\n {data.map((d, i) => {\r\n return (\r\n <motion.g\r\n key={i}\r\n variants={{\r\n initial: {\r\n opacity: selectedColor\r\n ? d.color\r\n ? colors[colorDomain.indexOf(`${d.color}`)] === selectedColor\r\n ? 1\r\n : dimmedOpacity\r\n : dimmedOpacity\r\n : mouseOverData\r\n ? mouseOverData.label === d.label\r\n ? 1\r\n : dimmedOpacity\r\n : highlightedDataPoints.length !== 0\r\n ? highlightedDataPoints.indexOf(d.label) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1,\r\n },\r\n whileInView: {\r\n opacity: selectedColor\r\n ? d.color\r\n ? colors[colorDomain.indexOf(`${d.color}`)] === selectedColor\r\n ? 1\r\n : dimmedOpacity\r\n : dimmedOpacity\r\n : mouseOverData\r\n ? mouseOverData.label === d.label\r\n ? 1\r\n : dimmedOpacity\r\n : highlightedDataPoints.length !== 0\r\n ? highlightedDataPoints.indexOf(d.label) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n onMouseEnter={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.(d);\r\n }}\r\n onMouseMove={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n }}\r\n onMouseLeave={() => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n }}\r\n onClick={() => {\r\n if (onSeriesMouseClick || detailsOnClick) {\r\n if (isEqual(mouseClickData, d) && resetSelectionOnDoubleClick) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n setMouseClickData(d);\r\n onSeriesMouseClick?.(d);\r\n }\r\n }\r\n }}\r\n >\r\n <motion.circle\r\n cx={radius}\r\n variants={{\r\n initial: {\r\n cy: y(d.y1),\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\r\n stroke:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\r\n opacity: 0,\r\n },\r\n whileInView: {\r\n cy: y(d.y1),\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\r\n stroke:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n r={radius}\r\n style={{\r\n fillOpacity: 0.6,\r\n }}\r\n />\r\n {showLabels ? (\r\n <motion.text\r\n variants={{\r\n initial: {\r\n y: y(d.y1),\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\r\n opacity: 0,\r\n },\r\n whileInView: {\r\n y: y(d.y1),\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n style={{\r\n textAnchor: 'end',\r\n ...(styles?.yAxis?.labels || {}),\r\n }}\r\n className={cn('text-xs', classNames?.yAxis?.labels)}\r\n x={5}\r\n dy='0.33em'\r\n textAnchor='end'\r\n dx={0 - radius - 3}\r\n >\r\n {d.label}\r\n </motion.text>\r\n ) : highlightedDataPoints.length !== 0 ? (\r\n highlightedDataPoints.indexOf(d.label) !== -1 ? (\r\n <motion.text\r\n variants={{\r\n initial: {\r\n y: y(d.y1),\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\r\n opacity: 0,\r\n },\r\n whileInView: {\r\n y: y(d.y1),\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n style={{\r\n textAnchor: 'end',\r\n ...(styles?.yAxis?.labels || {}),\r\n }}\r\n className={cn('text-xs', classNames?.yAxis?.labels)}\r\n x={5}\r\n dy='0.33em'\r\n dx={-3}\r\n >\r\n {d.label}\r\n </motion.text>\r\n ) : null\r\n ) : null}\r\n <motion.circle\r\n cx={graphWidth - radius}\r\n variants={{\r\n initial: {\r\n cy: y(d.y2),\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\r\n stroke:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\r\n opacity: 0,\r\n },\r\n whileInView: {\r\n cy: y(d.y2),\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\r\n stroke:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n r={radius}\r\n style={{\r\n fillOpacity: 0.6,\r\n }}\r\n />\r\n {showLabels ? (\r\n <motion.text\r\n variants={{\r\n initial: {\r\n y: y(d.y2),\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\r\n opacity: 0,\r\n },\r\n whileInView: {\r\n y: y(d.y2),\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n style={{\r\n textAnchor: 'start',\r\n ...(styles?.yAxis?.labels || {}),\r\n }}\r\n className={cn('text-xs', classNames?.yAxis?.labels)}\r\n x={graphWidth - 5}\r\n dy='0.33em'\r\n dx={radius + 3}\r\n >\r\n {d.label}\r\n </motion.text>\r\n ) : highlightedDataPoints.length !== 0 ? (\r\n highlightedDataPoints.indexOf(d.label) !== -1 ? (\r\n <motion.text\r\n variants={{\r\n initial: {\r\n y: y(d.y2),\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\r\n opacity: 0,\r\n },\r\n whileInView: {\r\n y: y(d.y2),\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n style={{\r\n textAnchor: 'start',\r\n ...(styles?.yAxis?.labels || {}),\r\n }}\r\n className={cn('text-xs', classNames?.yAxis?.labels)}\r\n x={graphWidth - 5}\r\n dy='0.33em'\r\n dx={3}\r\n >\r\n {d.label}\r\n </motion.text>\r\n ) : null\r\n ) : null}\r\n <motion.line\r\n x1={radius}\r\n x2={graphWidth - radius}\r\n variants={{\r\n initial: {\r\n y1: y(d.y1),\r\n y2: y(d.y1),\r\n stroke:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\r\n },\r\n whileInView: {\r\n y1: y(d.y1),\r\n y2: y(d.y2),\r\n stroke:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n className={classNames?.dataConnectors}\r\n style={{\r\n fill: 'none',\r\n strokeWidth: 1,\r\n ...styles?.dataConnectors,\r\n }}\r\n />\r\n </motion.g>\r\n );\r\n })}\r\n </AnimatePresence>\r\n {customLayers.filter(d => d.position === 'after').map(d => d.layer)}\r\n </g>\r\n </motion.svg>\r\n {mouseOverData && tooltip && eventX && eventY ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={eventX}\r\n yPos={eventY}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n {detailsOnClick && mouseClickData !== undefined ? (\r\n <Modal\r\n open={mouseClickData !== undefined}\r\n onClose={() => {\r\n setMouseClickData(undefined);\r\n }}\r\n >\r\n <div\r\n className='graph-modal-content m-0'\r\n dangerouslySetInnerHTML={\r\n typeof detailsOnClick === 'string'\r\n ? { __html: string2HTML(detailsOnClick, mouseClickData) }\r\n : undefined\r\n }\r\n >\r\n {typeof detailsOnClick === 'function' ? detailsOnClick(mouseClickData) : null}\r\n </div>\r\n </Modal>\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import uniqBy from 'lodash.uniqby';\r\nimport { useState, useRef, useEffect } from 'react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport {\r\n Languages,\r\n SlopeChartDataType,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n CustomLayerDataType,\r\n AnimateDataType,\r\n} from '@/Types';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { ColorLegendWithMouseOver } from '@/Components/Elements/ColorLegendWithMouseOver';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { EmptyState } from '@/Components/Elements/EmptyState';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: SlopeChartDataType[];\r\n\r\n // Titles, Labels, and Sources\r\n /** Title of the graph */\r\n graphTitle?: string | React.ReactNode;\r\n /** Description of the graph */\r\n graphDescription?: string | React.ReactNode;\r\n /** Footnote for the graph */\r\n footNote?: string | React.ReactNode;\r\n /** Source data for the graph */\r\n sources?: SourcesDataType[];\r\n /** Accessibility label */\r\n ariaLabel?: string;\r\n\r\n // Colors and Styling\r\n /** Color or array of colors for circles */\r\n colors?: string | string[];\r\n /** Domain of colors for the graph */\r\n colorDomain?: string[];\r\n /** Title for the color legend */\r\n colorLegendTitle?: string;\r\n /** Background color of the graph */\r\n backgroundColor?: string | boolean;\r\n /** Custom styles for the graph. Each object should be a valid React CSS style object. */\r\n styles?: StyleObject;\r\n /** Custom class names */\r\n classNames?: ClassNameObject;\r\n\r\n // Size and Spacing\r\n /** Width of the graph */\r\n width?: number;\r\n /** Height of the graph */\r\n height?: number;\r\n /** Minimum height of the graph */\r\n minHeight?: number;\r\n /** Relative height scaling factor. This overwrites the height props */\r\n relativeHeight?: number;\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n /** Left margin of the graph */\r\n leftMargin?: number;\r\n /** Right margin of the graph */\r\n rightMargin?: number;\r\n /** Top margin of the graph */\r\n topMargin?: number;\r\n /** Bottom margin of the graph */\r\n bottomMargin?: number;\r\n /** Toggles the background to fill the container. This only works if the width of the graph is defined. */\r\n fillContainer?: boolean;\r\n\r\n // Values and Ticks\r\n /** Maximum value for the chart */\r\n maxValue?: number;\r\n /** Minimum value for the chart */\r\n minValue?: number;\r\n\r\n // Graph Parameters\r\n /** Toggle visibility of labels */\r\n showLabels?: boolean;\r\n /** Radius of the circles */\r\n radius?: number;\r\n /** Title for the two axis */\r\n axisTitles?: [string, string];\r\n /** Toggle visibility of color scale. This is only applicable if the data props hae color parameter */\r\n showColorScale?: boolean;\r\n /** Toggle visibility of NA color in the color scale. This is only applicable if the data props hae color parameter and showColorScale prop is true */\r\n showNAColor?: boolean;\r\n /** Data points to highlight. Use the label value from data to highlight the data point */\r\n highlightedDataPoints?: (string | number)[];\r\n /** Defines the opacity of the non-highlighted data */\r\n dimmedOpacity?: number;\r\n /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\r\n /** Optional SVG <g> element or function that renders custom content behind or in front of the graph. */\r\n customLayers?: CustomLayerDataType[];\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n /** Reset selection on double-click. Only applicable when used in a dashboard context with filters. */\r\n resetSelectionOnDoubleClick?: boolean;\r\n\r\n // Interactions and Callbacks\r\n /** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n /** Details displayed on the modal when user clicks of a data point. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n /** Callback for mouse over event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n /** Callback for mouse click event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n\r\n // Configuration and Options\r\n /** Language setting */\r\n language?: Languages;\r\n /** Color theme */\r\n theme?: 'light' | 'dark';\r\n /** Unique ID for the graph */\r\n graphID?: string;\r\n}\r\n\r\nexport function SlopeChart(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n colors,\r\n sources,\r\n graphDescription,\r\n showLabels = false,\r\n height,\r\n width,\r\n footNote,\r\n colorDomain,\r\n colorLegendTitle,\r\n radius = 5,\r\n axisTitles = ['', ''],\r\n padding,\r\n backgroundColor = false,\r\n leftMargin = 50,\r\n rightMargin = 50,\r\n topMargin = 20,\r\n bottomMargin = 20,\r\n tooltip,\r\n relativeHeight,\r\n onSeriesMouseOver,\r\n showColorScale = true,\r\n highlightedDataPoints = [],\r\n graphID,\r\n minValue,\r\n maxValue,\r\n onSeriesMouseClick,\r\n graphDownload = false,\r\n dataDownload = false,\r\n fillContainer = true,\r\n language = 'en',\r\n showNAColor = true,\r\n minHeight = 0,\r\n theme = 'light',\r\n ariaLabel,\r\n resetSelectionOnDoubleClick = true,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n animate = false,\r\n dimmedOpacity = 0.3,\r\n customLayers = [],\r\n } = props;\r\n\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n const [selectedColor, setSelectedColor] = useState<string | undefined>(undefined);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(width || entries[0].target.clientWidth || 620);\r\n setSvgHeight(height || entries[0].target.clientHeight || 480);\r\n });\r\n if (graphDiv.current) {\r\n setSvgHeight(graphDiv.current.clientHeight || 480);\r\n setSvgWidth(graphDiv.current.clientWidth || 620);\r\n if (!width) resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, [width, height]);\r\n return (\r\n <div\r\n className={`${theme || 'light'} flex ${width ? 'grow-0' : 'grow'} ${\r\n !fillContainer ? 'w-fit' : 'w-full'\r\n } `}\r\n dir={language === 'he' || language === 'ar' ? 'rtl' : undefined}\r\n >\r\n <div\r\n className={cn(\r\n `${\r\n !backgroundColor\r\n ? 'bg-transparent '\r\n : backgroundColor === true\r\n ? 'bg-primary-gray-200 dark:bg-primary-gray-650 '\r\n : ''\r\n }ml-auto mr-auto flex flex-col grow h-inherit ${language || 'en'}`,\r\n classNames?.graphContainer,\r\n )}\r\n style={{\r\n ...(styles?.graphContainer || {}),\r\n ...(backgroundColor && backgroundColor !== true ? { backgroundColor } : {}),\r\n }}\r\n id={graphID}\r\n ref={graphParentDiv}\r\n aria-label={\r\n ariaLabel ||\r\n `${\r\n graphTitle ? `The graph shows ${graphTitle}. ` : ''\r\n }This is a slope chart showing changes in data between two category or starting and ending time. Each line represents a different row in data, with lines sloping up or down to show increase or decrease over two categories or time.${\r\n graphDescription ? ` ${graphDescription}` : ''\r\n }`\r\n }\r\n >\r\n <div\r\n className='flex grow'\r\n style={{ padding: backgroundColor ? padding || '1rem' : padding || 0 }}\r\n >\r\n <div className='flex flex-col w-full gap-4 grow justify-between'>\r\n {graphTitle || graphDescription || graphDownload || dataDownload ? (\r\n <GraphHeader\r\n styles={{\r\n title: styles?.title,\r\n description: styles?.description,\r\n }}\r\n classNames={{\r\n title: classNames?.title,\r\n description: classNames?.description,\r\n }}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n width={width}\r\n graphDownload={graphDownload ? graphParentDiv.current : undefined}\r\n dataDownload={\r\n dataDownload\r\n ? data.map(d => d.data).filter(d => d !== undefined).length > 0\r\n ? data.map(d => d.data).filter(d => d !== undefined)\r\n : data.filter(d => d !== undefined)\r\n : null\r\n }\r\n />\r\n ) : null}\r\n <div className='grow flex flex-col justify-center gap-3 w-full'>\r\n {data.length === 0 ? (\r\n <EmptyState />\r\n ) : (\r\n <>\r\n {showColorScale && data.filter(el => el.color).length !== 0 ? (\r\n <ColorLegendWithMouseOver\r\n width={width}\r\n colorLegendTitle={colorLegendTitle}\r\n colors={\r\n (colors as string[] | undefined) || Colors[theme].categoricalColors.colors\r\n }\r\n colorDomain={\r\n colorDomain ||\r\n (uniqBy(\r\n data.filter(el => el.color),\r\n 'color',\r\n ).map(d => d.color) as string[])\r\n }\r\n setSelectedColor={setSelectedColor}\r\n showNAColor={showNAColor}\r\n />\r\n ) : null}\r\n <div\r\n className='flex flex-col grow justify-center w-full leading-0'\r\n ref={graphDiv}\r\n aria-label='Graph area'\r\n >\r\n {(width || svgWidth) && (height || svgHeight) ? (\r\n <Graph\r\n data={data.filter(\r\n d => !checkIfNullOrUndefined(d.y1) && !checkIfNullOrUndefined(d.y2),\r\n )}\r\n width={width || svgWidth}\r\n height={Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}\r\n colorDomain={\r\n data.filter(el => el.color).length === 0\r\n ? []\r\n : colorDomain ||\r\n (uniqBy(\r\n data.filter(el => el.color),\r\n 'color',\r\n ).map(d => d.color) as string[])\r\n }\r\n colors={\r\n data.filter(el => el.color).length === 0\r\n ? colors\r\n ? [colors as string]\r\n : [Colors.primaryColors['blue-600']]\r\n : (colors as string[] | undefined) ||\r\n Colors[theme].categoricalColors.colors\r\n }\r\n selectedColor={selectedColor}\r\n axisTitles={axisTitles}\r\n showLabels={showLabels}\r\n radius={radius}\r\n leftMargin={leftMargin}\r\n rightMargin={rightMargin}\r\n topMargin={topMargin}\r\n bottomMargin={bottomMargin}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n highlightedDataPoints={highlightedDataPoints}\r\n minValue={minValue}\r\n maxValue={maxValue}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n detailsOnClick={detailsOnClick}\r\n styles={styles}\r\n classNames={classNames}\r\n animate={\r\n animate === true\r\n ? { duration: 0.5, once: true, amount: 0.5 }\r\n : animate || { duration: 0, once: true, amount: 0 }\r\n }\r\n dimmedOpacity={dimmedOpacity}\r\n customLayers={customLayers}\r\n />\r\n ) : null}\r\n </div>\r\n </>\r\n )}\r\n </div>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n}\r\n"],"names":["Graph","props","data","width","height","showLabels","colors","colorDomain","radius","leftMargin","rightMargin","topMargin","bottomMargin","tooltip","onSeriesMouseOver","axisTitles","highlightedDataPoints","selectedColor","minValue","maxValue","onSeriesMouseClick","resetSelectionOnDoubleClick","detailsOnClick","styles","classNames","animate","dimmedOpacity","customLayers","svgRef","useRef","isInView","useInView","mouseOverData","setMouseOverData","useState","mouseClickData","setMouseClickData","eventX","setEventX","eventY","setEventY","margin","graphWidth","graphHeight","minY","d","maxY","y","scaleLinear","checkIfNullOrUndefined","jsxs","Fragment","jsx","motion","Axis","cn","AxisTitle","AnimatePresence","i","event","isEqual","el","Colors","Tooltip","Modal","string2HTML","SlopeChart","graphTitle","sources","graphDescription","footNote","colorLegendTitle","padding","backgroundColor","relativeHeight","showColorScale","graphID","graphDownload","dataDownload","fillContainer","language","showNAColor","minHeight","theme","ariaLabel","svgWidth","setSvgWidth","svgHeight","setSvgHeight","setSelectedColor","graphDiv","graphParentDiv","useEffect","resizeObserver","entries","GraphHeader","EmptyState","ColorLegendWithMouseOver","uniqBy","GraphFooter"],"mappings":"8vBAsDO,SAASA,GAAMC,EAAc,CAClC,KAAM,CACJ,KAAAC,EACA,MAAAC,EACA,OAAAC,EACA,WAAAC,EACA,OAAAC,EACA,YAAAC,EACA,OAAAC,EACA,WAAAC,EACA,YAAAC,EACA,UAAAC,EACA,aAAAC,EACA,QAAAC,EACA,kBAAAC,EACA,WAAAC,EACA,sBAAAC,EACA,cAAAC,EACA,SAAAC,EACA,SAAAC,EACA,mBAAAC,EACA,4BAAAC,EACA,eAAAC,EACA,OAAAC,EACA,WAAAC,EACA,QAAAC,EACA,cAAAC,EACA,aAAAC,CAAA,EACE1B,EACE2B,EAASC,EAAAA,OAAO,IAAI,EACpBC,EAAWC,EAAAA,UAAUH,EAAQ,CACjC,KAAMH,EAAQ,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B,OAAA,EACA,IAAIhB,GAAKA,EAAE,KAAK,EAExB,OACE3C,EAAK,OAAO2D,GAAMA,EAAG,KAAK,EAAE,SAAW,EACnCvD,EACE,CAACA,CAAgB,EACjB,CAACwD,EAAAA,OAAO,cAAc,UAAU,CAAC,EAClCxD,GACDwD,SAAOqB,CAAK,EAAE,kBAAkB,OAEtC,cAAAlE,GACA,WAAAF,EACA,WAAAV,EACA,OAAAG,EACA,WAAAC,EACA,YAAAC,EACA,UAAAC,EACA,aAAAC,EACA,QAAAC,EACA,kBAAAC,EACA,sBAAAE,EACA,SAAAE,EACA,SAAAC,EACA,mBAAAC,EACA,4BAAAC,EACA,eAAAC,EACA,OAAAC,EACA,WAAAC,EACA,QACEC,IAAY,GACR,CAAE,SAAU,GAAK,KAAM,GAAM,OAAQ,EAAA,EACrCA,GAAW,CAAE,SAAU,EAAG,KAAM,GAAM,OAAQ,CAAA,EAEpD,cAAAC,EACA,aAAAC,CAAA,CAAA,EAEA,IAAA,CAAA,CACN,CAAA,CACF,CAAA,CAEJ,EACCyC,GAAWE,EACVlB,EAAAA,kBAAAA,IAAC+C,GAAAA,YAAA,CACC,OAAQ,CAAE,SAAU5E,GAAQ,SAAU,OAAQA,GAAQ,MAAA,EACtD,WAAY,CACV,SAAUC,GAAY,SACtB,OAAQA,GAAY,MAAA,EAEtB,QAAA4C,EACA,SAAAE,EACA,MAAAnE,CAAA,CAAA,EAEA,IAAA,CAAA,CACN,CAAA,CAAA,CACF,CAAA,CACF,CAAA,CAGN"}
|
package/dist/Source.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { JSX } from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
export declare function Source(props: SourceProps): JSX.Element;
|
|
4
|
+
|
|
5
|
+
declare interface SourceProps {
|
|
6
|
+
sources: SourcesDataType[];
|
|
7
|
+
style?: React.CSSProperties;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare interface SourcesDataType {
|
|
12
|
+
source: string;
|
|
13
|
+
link?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { }
|
package/dist/Source.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index-BHm2KTjD-D8FylaKc.cjs"),r=require("./Typography-CDR-DAHH.cjs");function c(s){const{sources:n,style:o={},className:t}=s;return a.jsxRuntimeExports.jsxs(r.TypographyExports.P,{size:"sm",marginBottom:"none","aria-label":"Data sources",className:r.cnExports.cn("text-primary-gray-550 dark:text-primary-gray-400",t),style:o,children:["Source:"," ",n.map((e,i)=>a.jsxRuntimeExports.jsx("span",{className:r.cnExports.cn("text-primary-gray-550 dark:text-primary-gray-400",t),style:{fontFamily:"inherit"},children:e.link?a.jsxRuntimeExports.jsx(r.TypographyExports.A,{className:r.cnExports.cn("text-primary-gray-550 dark:text-primary-gray-400",t),href:e.link,target:"_blank",rel:"noreferrer",children:e.source}):e.source},i))]})}exports.Source=c;
|
|
2
|
+
//# sourceMappingURL=Source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Source.js","sources":["../src/Components/Typography/Source.tsx"],"sourcesContent":["import { A, P } from '@undp/design-system-react/Typography';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport { SourcesDataType } from '@/Types';\r\n\r\ninterface SourceProps {\r\n sources: SourcesDataType[];\r\n style?: React.CSSProperties;\r\n className?: string;\r\n}\r\n\r\nexport function Source(props: SourceProps) {\r\n const { sources, style = {}, className } = props;\r\n return (\r\n <P\r\n size='sm'\r\n marginBottom='none'\r\n aria-label='Data sources'\r\n className={cn('text-primary-gray-550 dark:text-primary-gray-400', className)}\r\n style={style}\r\n >\r\n Source:{' '}\r\n {sources.map((d, i) => (\r\n <span\r\n key={i}\r\n className={cn('text-primary-gray-550 dark:text-primary-gray-400', className)}\r\n style={{ fontFamily: 'inherit' }}\r\n >\r\n {d.link ? (\r\n <A\r\n className={cn('text-primary-gray-550 dark:text-primary-gray-400', className)}\r\n href={d.link}\r\n target='_blank'\r\n rel='noreferrer'\r\n >\r\n {d.source}\r\n </A>\r\n ) : (\r\n d.source\r\n )}\r\n </span>\r\n ))}\r\n </P>\r\n );\r\n}\r\n"],"names":["Source","props","sources","style","className","jsxs","P","cn","d","jsx","A"],"mappings":"wKAWO,SAASA,EAAOC,EAAoB,CACzC,KAAM,CAAE,QAAAC,EAAS,MAAAC,EAAQ,CAAA,EAAI,UAAAC,GAAcH,EAC3C,OACEI,EAAAA,kBAAAA,KAACC,EAAAA,kBAAAA,EAAA,CACC,KAAK,KACL,aAAa,OACb,aAAW,eACX,UAAWC,EAAAA,UAAAA,GAAG,mDAAoDH,CAAS,EAC3E,MAAAD,EACD,SAAA,CAAA,UACS,IACPD,EAAQ,IAAI,CAACM,EAAG,IACfC,EAAAA,kBAAAA,IAAC,OAAA,CAEC,UAAWF,EAAAA,UAAAA,GAAG,mDAAoDH,CAAS,EAC3E,MAAO,CAAE,WAAY,SAAA,EAEpB,WAAE,KACDK,EAAAA,kBAAAA,IAACC,EAAAA,kBAAAA,EAAA,CACC,UAAWH,EAAAA,UAAAA,GAAG,mDAAoDH,CAAS,EAC3E,KAAMI,EAAE,KACR,OAAO,SACP,IAAI,aAEH,SAAAA,EAAE,MAAA,CAAA,EAGLA,EAAE,MAAA,EAdC,CAAA,CAiBR,CAAA,CAAA,CAAA,CAGP"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { JSX } from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
declare interface AxesClassNameObject {
|
|
4
|
+
gridLines?: string;
|
|
5
|
+
labels?: string;
|
|
6
|
+
title?: string;
|
|
7
|
+
axis?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
declare interface AxesStyleObject {
|
|
11
|
+
gridLines?: React.CSSProperties;
|
|
12
|
+
labels?: React.CSSProperties;
|
|
13
|
+
title?: React.CSSProperties;
|
|
14
|
+
axis?: React.CSSProperties;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
declare interface ClassNameObject {
|
|
18
|
+
title?: string;
|
|
19
|
+
footnote?: string;
|
|
20
|
+
source?: string;
|
|
21
|
+
description?: string;
|
|
22
|
+
tooltip?: string;
|
|
23
|
+
xAxis?: AxesClassNameObject;
|
|
24
|
+
yAxis?: AxesClassNameObject;
|
|
25
|
+
legend?: string;
|
|
26
|
+
graphContainer?: string;
|
|
27
|
+
graphObjectValues?: string;
|
|
28
|
+
dataConnectors?: string;
|
|
29
|
+
mouseOverLine?: string;
|
|
30
|
+
regLine?: string;
|
|
31
|
+
dataCards?: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
declare type CurveTypes = 'linear' | 'curve' | 'step' | 'stepAfter' | 'stepBefore';
|
|
35
|
+
|
|
36
|
+
declare interface CustomLayerDataType {
|
|
37
|
+
position: 'before' | 'after';
|
|
38
|
+
layer: React.ReactNode;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
declare type Languages = 'en' | 'ar' | 'az' | 'bn' | 'cy' | 'he' | 'hi' | 'jp' | 'ka' | 'km' | 'ko' | 'my' | 'ne' | 'zh' | 'custom';
|
|
42
|
+
|
|
43
|
+
declare interface LineChartDataType {
|
|
44
|
+
date: number | string;
|
|
45
|
+
y: number;
|
|
46
|
+
data?: object;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
declare interface Props {
|
|
50
|
+
/** Array of data objects */
|
|
51
|
+
data: LineChartDataType[];
|
|
52
|
+
/** Title of the graph */
|
|
53
|
+
graphTitle?: string | React.ReactNode;
|
|
54
|
+
/** Description of the graph */
|
|
55
|
+
graphDescription?: string | React.ReactNode;
|
|
56
|
+
/** Footnote for the graph */
|
|
57
|
+
footNote?: string | React.ReactNode;
|
|
58
|
+
/** Source data for the graph */
|
|
59
|
+
sources?: SourcesDataType[];
|
|
60
|
+
/** Accessibility label */
|
|
61
|
+
ariaLabel?: string;
|
|
62
|
+
/** Colors of the lines */
|
|
63
|
+
lineColor?: string;
|
|
64
|
+
/** Background color of the graph */
|
|
65
|
+
backgroundColor?: string | boolean;
|
|
66
|
+
/** Custom styles for the graph. Each object should be a valid React CSS style object. */
|
|
67
|
+
styles?: StyleObject;
|
|
68
|
+
/** Custom class names */
|
|
69
|
+
classNames?: ClassNameObject;
|
|
70
|
+
/** Width of the graph */
|
|
71
|
+
width?: number;
|
|
72
|
+
/** Height of the graph */
|
|
73
|
+
height?: number;
|
|
74
|
+
/** Minimum height of the graph */
|
|
75
|
+
minHeight?: number;
|
|
76
|
+
/** Relative height scaling factor. This overwrites the height props */
|
|
77
|
+
relativeHeight?: number;
|
|
78
|
+
/** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */
|
|
79
|
+
padding?: string;
|
|
80
|
+
/** Left margin of the graph */
|
|
81
|
+
leftMargin?: number;
|
|
82
|
+
/** Right margin of the graph */
|
|
83
|
+
rightMargin?: number;
|
|
84
|
+
/** Top margin of the graph */
|
|
85
|
+
topMargin?: number;
|
|
86
|
+
/** Bottom margin of the graph */
|
|
87
|
+
bottomMargin?: number;
|
|
88
|
+
/** Maximum value for the chart */
|
|
89
|
+
maxValue?: number;
|
|
90
|
+
/** Minimum value for the chart */
|
|
91
|
+
minValue?: number;
|
|
92
|
+
/** Format of the date in the data object. Available formats can be found [here](https://date-fns.org/docs/format) */
|
|
93
|
+
dateFormat?: string;
|
|
94
|
+
/** Toggles the visibility of the area below the line */
|
|
95
|
+
area?: boolean;
|
|
96
|
+
/** Curve type for the line */
|
|
97
|
+
curveType?: CurveTypes;
|
|
98
|
+
/** Optional SVG <g> element or function that renders custom content behind or in front of the graph. */
|
|
99
|
+
customLayers?: CustomLayerDataType[];
|
|
100
|
+
/** Enable graph download option as png */
|
|
101
|
+
graphDownload?: boolean;
|
|
102
|
+
/** Enable data download option as a csv */
|
|
103
|
+
dataDownload?: boolean;
|
|
104
|
+
/** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */
|
|
105
|
+
tooltip?: string | ((_d: any) => React.ReactNode);
|
|
106
|
+
/** Callback for mouse over event */
|
|
107
|
+
onSeriesMouseOver?: (_d: any) => void;
|
|
108
|
+
/** Language setting */
|
|
109
|
+
language?: Languages;
|
|
110
|
+
/** Color theme */
|
|
111
|
+
theme?: 'light' | 'dark';
|
|
112
|
+
/** Unique ID for the graph */
|
|
113
|
+
graphID?: string;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
declare interface SourcesDataType {
|
|
117
|
+
source: string;
|
|
118
|
+
link?: string;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export declare function SparkLine(props: Props): JSX.Element;
|
|
122
|
+
|
|
123
|
+
declare interface StyleObject {
|
|
124
|
+
title?: React.CSSProperties;
|
|
125
|
+
footnote?: React.CSSProperties;
|
|
126
|
+
source?: React.CSSProperties;
|
|
127
|
+
description?: React.CSSProperties;
|
|
128
|
+
graphContainer?: React.CSSProperties;
|
|
129
|
+
tooltip?: React.CSSProperties;
|
|
130
|
+
xAxis?: AxesStyleObject;
|
|
131
|
+
yAxis?: AxesStyleObject;
|
|
132
|
+
graphObjectValues?: React.CSSProperties;
|
|
133
|
+
dataConnectors?: React.CSSProperties;
|
|
134
|
+
mouseOverLine?: React.CSSProperties;
|
|
135
|
+
regLine?: React.CSSProperties;
|
|
136
|
+
dataCards?: React.CSSProperties;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export { }
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-BHm2KTjD-D8FylaKc.cjs"),l=require("react"),X=require("./Typography-CDR-DAHH.cjs"),V=require("./parse-hMnG_lRV.cjs"),Q=require("./index-BzeLQvXk.cjs"),Z=require("./Tooltip-BM18N_3l.cjs"),z=require("./checkIfNullOrUndefined.js"),_=require("./time-Byw_jYQ7.cjs"),ee=require("./linear-BVckp9RD.cjs"),te=require("./area-D3Qx7k7K.cjs"),K=require("./line-DHV4JwCR.cjs"),P=require("./step-BZ3C8QFW.cjs"),re=require("./select-Bnfk0lJx.cjs"),se=require("./init-DU0ybBc_.cjs"),ie=require("./pointer-Dkq5NV1q.cjs"),oe=require("./GraphFooter.js"),ne=require("./GraphHeader.js"),ae=require("./Colors.js"),le=require("./generateRandomString-B5zBiJzS.cjs");function ce(F){const{data:y,width:c,height:R,lineColor:d,dateFormat:x,areaId:u,leftMargin:s,rightMargin:N,topMargin:L,bottomMargin:W,tooltip:b,onSeriesMouseOver:o,minValue:D,maxValue:k,curveType:v,styles:w,classNames:q,customLayers:m}=F,C=v==="linear"?K.curveLinear:v==="step"?P.curveStep:v==="stepAfter"?P.stepAfter:v==="stepBefore"?P.stepBefore:P.monotoneX,[h,O]=l.useState(void 0),[H,M]=l.useState(void 0),[S,j]=l.useState(void 0),n={top:L,bottom:W,left:s,right:N},T=l.useRef(null),t=Q.sortBy(y.map(e=>({...e,date:V.parse(`${e.date}`,x,new Date)})),"date"),A=c-n.left-n.right,i=R-n.top-n.bottom,p=t[0].date,B=t[t.length-1].date,g=Math.min(...t.map(e=>e.y).filter(e=>e!=null))!==1/0?Math.min(...t.map(e=>e.y).filter(e=>e!=null))>0?0:Math.min(...t.map(e=>e.y).filter(e=>e!=null)):0,$=Math.max(...t.map(e=>e.y).filter(e=>e!=null))!==1/0?Math.max(...t.map(e=>e.y).filter(e=>e!=null)):0,a=_.time().domain([p,B]).range([0,A]),E=ee.linear().domain([z.checkIfNullOrUndefined(D)?g:D,z.checkIfNullOrUndefined(k)?$>0?$:0:k]).range([i,0]).nice(),f=te.area().x(e=>a(e.date)).y1(e=>E(e.y)).y0(i).curve(C),G=K.line().x(e=>a(e.date)).y(e=>E(e.y)).curve(C);return l.useEffect(()=>{const e=Y=>{const U=t[se.bisectCenter(t.map(J=>J.date),a.invert(ie.pointer(Y)[0]),1)];O(U||t[t.length-1]),o?.(U||t[t.length-1]),j(Y.clientY),M(Y.clientX)},I=()=>{O(void 0),o?.(void 0),M(void 0),j(void 0)};re.select(T.current).on("mousemove",e).on("mouseout",I),o?.(void 0)},[a,t,o]),r.jsxRuntimeExports.jsxs(r.jsxRuntimeExports.Fragment,{children:[r.jsxRuntimeExports.jsxs("svg",{width:`${c}px`,height:`${R}px`,viewBox:`0 0 ${c} ${R}`,direction:"ltr",children:[u?r.jsxRuntimeExports.jsxs("linearGradient",{id:u,x1:"0",x2:"0",y1:"0",y2:"1",children:[r.jsxRuntimeExports.jsx("stop",{style:{stopColor:d},stopOpacity:"0.1",offset:"0%"}),r.jsxRuntimeExports.jsx("stop",{style:{stopColor:d},stopOpacity:"0",offset:"100%"})]}):null,r.jsxRuntimeExports.jsxs("g",{transform:`translate(${n.left},${n.top})`,children:[m.filter(e=>e.position==="before").map(e=>e.layer),r.jsxRuntimeExports.jsxs("g",{children:[r.jsxRuntimeExports.jsx("text",{className:X.cnExports.cn("xs:max-[360px]:hidden fill-primary-gray-700 dark:fill-primary-gray-300 text-[9px] md:text-[10px] lg:text-xs",q?.xAxis?.labels),y:i,x:a(t[t.length-1].date),style:{textAnchor:"end",...w?.xAxis?.labels},dy:"1em",children:V.format(t[t.length-1].date,x)}),r.jsxRuntimeExports.jsx("text",{y:i,x:a(t[0].date),style:{textAnchor:"start",...w?.xAxis?.labels},className:X.cnExports.cn("xs:max-[360px]:hidden fill-primary-gray-700 dark:fill-primary-gray-300 text-[9px] md:text-[10px] lg:text-xs",q?.xAxis?.labels),dy:"1em",children:V.format(t[0].date,x)})]}),r.jsxRuntimeExports.jsxs("g",{children:[r.jsxRuntimeExports.jsx("path",{d:f(t)||"",style:{fill:`url(#${u})`,clipPath:"url(#clip)"}}),r.jsxRuntimeExports.jsx("path",{d:G(t)||"",style:{stroke:d,fill:"none",strokeWidth:2}}),h?r.jsxRuntimeExports.jsx("circle",{y1:0,cy:E(h.y),cx:a(h.date),r:5,style:{fill:d}}):null]}),m.filter(e=>e.position==="after").map(e=>e.layer),r.jsxRuntimeExports.jsx("rect",{ref:T,style:{fill:"none",pointerEvents:"all"},width:A,height:i})]})]}),h&&b&&H&&S?r.jsxRuntimeExports.jsx(Z.Tooltip,{data:h,body:b,xPos:H,yPos:S,backgroundStyle:w?.tooltip,className:q?.tooltip}):null]})}function xe(F){const{data:y,graphTitle:c,lineColor:R,sources:d,graphDescription:x,height:u,width:s,footNote:N,dateFormat:L="yyyy",area:W=!1,padding:b,backgroundColor:o,leftMargin:D=5,rightMargin:k=5,topMargin:v=10,bottomMargin:w=20,tooltip:q,relativeHeight:m,onSeriesMouseOver:C,graphID:h,minValue:O,maxValue:H,graphDownload:M=!1,dataDownload:S=!1,language:j="en",minHeight:n=0,theme:T="light",ariaLabel:t,curveType:A="curve",styles:i,classNames:p,customLayers:B=[]}=F,[g,$]=l.useState(0),[a,E]=l.useState(0),f=l.useRef(null),G=l.useRef(null);return l.useEffect(()=>{const e=new ResizeObserver(I=>{$(s||I[0].target.clientWidth||620),E(u||I[0].target.clientHeight||480)});return f.current&&(E(f.current.clientHeight||480),$(f.current.clientWidth||620),s||e.observe(f.current)),()=>e.disconnect()},[s,u]),r.jsxRuntimeExports.jsx("div",{className:`${T||"light"} flex ${s?"w-fit grow-0":"w-full grow"}`,dir:j==="he"||j==="ar"?"rtl":void 0,children:r.jsxRuntimeExports.jsx("div",{className:X.cnExports.cn(`${o?o===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${j||"en"}`,p?.graphContainer),style:{...i?.graphContainer||{},...o&&o!==!0?{backgroundColor:o}:{}},id:h,ref:G,"aria-label":t||`${c?`The graph shows ${c}. `:""}This is a line chart that show trends over time.${x?` ${x}`:""}`,children:r.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:o?b||"1rem":b||0},children:r.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[c||x||M||S?r.jsxRuntimeExports.jsx(ne.GraphHeader,{styles:{title:i?.title,description:i?.description},classNames:{title:p?.title,description:p?.description},graphTitle:c,graphDescription:x,width:s,graphDownload:M?G.current:void 0,dataDownload:S?y.map(e=>e.data).filter(e=>e!==void 0).length>0?y.map(e=>e.data).filter(e=>e!==void 0):y.filter(e=>e!==void 0):null}):null,r.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:f,"aria-label":"Graph area",children:(s||g)&&(u||a)?r.jsxRuntimeExports.jsx(ce,{data:y,lineColor:R||ae.Colors.primaryColors["blue-600"],width:s||g,height:Math.max(n,u||(m?n?(s||g)*m>n?(s||g)*m:n:(s||g)*m:a)),dateFormat:L,areaId:W?le.generateRandomString(8):void 0,leftMargin:D,rightMargin:k,topMargin:v,bottomMargin:w,tooltip:q,onSeriesMouseOver:C,minValue:O,maxValue:H,curveType:A,styles:i,classNames:p,customLayers:B}):null}),d||N?r.jsxRuntimeExports.jsx(oe.GraphFooter,{styles:{footnote:i?.footnote,source:i?.source},classNames:{footnote:p?.footnote,source:p?.source},sources:d,footNote:N,width:s}):null]})})})})}exports.SparkLine=xe;
|
|
2
|
+
//# sourceMappingURL=SparkLine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SparkLine.js","sources":["../src/Components/Graphs/LineCharts/SparkLine/Graph.tsx","../src/Components/Graphs/LineCharts/SparkLine/index.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\r\nimport {\r\n line,\r\n curveMonotoneX,\r\n area,\r\n curveLinear,\r\n curveStep,\r\n curveStepAfter,\r\n curveStepBefore,\r\n} from 'd3-shape';\r\nimport { scaleLinear, scaleTime } from 'd3-scale';\r\nimport { format } from 'date-fns/format';\r\nimport { parse } from 'date-fns/parse';\r\nimport { bisectCenter } from 'd3-array';\r\nimport { pointer, select } from 'd3-selection';\r\nimport sortBy from 'lodash.sortby';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport {\r\n ClassNameObject,\r\n CurveTypes,\r\n CustomLayerDataType,\r\n LineChartDataType,\r\n StyleObject,\r\n} from '@/Types';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\n\r\ninterface Props {\r\n data: LineChartDataType[];\r\n lineColor: string;\r\n width: number;\r\n height: number;\r\n dateFormat: string;\r\n areaId?: string;\r\n leftMargin: number;\r\n rightMargin: number;\r\n topMargin: number;\r\n bottomMargin: number;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n maxValue?: number;\r\n minValue?: number;\r\n curveType: CurveTypes;\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n customLayers: CustomLayerDataType[];\r\n}\r\n\r\ninterface FormattedDataType {\r\n y: number;\r\n date: Date;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n width,\r\n height,\r\n lineColor,\r\n dateFormat,\r\n areaId,\r\n leftMargin,\r\n rightMargin,\r\n topMargin,\r\n bottomMargin,\r\n tooltip,\r\n onSeriesMouseOver,\r\n minValue,\r\n maxValue,\r\n curveType,\r\n styles,\r\n classNames,\r\n customLayers,\r\n } = props;\r\n const curve =\r\n curveType === 'linear'\r\n ? curveLinear\r\n : curveType === 'step'\r\n ? curveStep\r\n : curveType === 'stepAfter'\r\n ? curveStepAfter\r\n : curveType === 'stepBefore'\r\n ? curveStepBefore\r\n : curveMonotoneX;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n const margin = {\r\n top: topMargin,\r\n bottom: bottomMargin,\r\n left: leftMargin,\r\n right: rightMargin,\r\n };\r\n const MouseoverRectRef = useRef(null);\r\n const dataFormatted = sortBy(\r\n data.map(d => ({\r\n ...d,\r\n date: parse(`${d.date}`, dateFormat, new Date()),\r\n })),\r\n 'date',\r\n );\r\n const graphWidth = width - margin.left - margin.right;\r\n const graphHeight = height - margin.top - margin.bottom;\r\n const minYear = dataFormatted[0].date;\r\n const maxYear = dataFormatted[dataFormatted.length - 1].date;\r\n const minParam: number =\r\n Math.min(...dataFormatted.map(d => d.y).filter(d => d !== undefined && d !== null)) !== Infinity\r\n ? Math.min(...dataFormatted.map(d => d.y).filter(d => d !== undefined && d !== null)) > 0\r\n ? 0\r\n : Math.min(...dataFormatted.map(d => d.y).filter(d => d !== undefined && d !== null))\r\n : 0;\r\n const maxParam: number =\r\n Math.max(...dataFormatted.map(d => d.y).filter(d => d !== undefined && d !== null)) !== Infinity\r\n ? Math.max(...dataFormatted.map(d => d.y).filter(d => d !== undefined && d !== null))\r\n : 0;\r\n\r\n const x = scaleTime().domain([minYear, maxYear]).range([0, graphWidth]);\r\n const y = scaleLinear()\r\n .domain([\r\n checkIfNullOrUndefined(minValue) ? minParam : (minValue as number),\r\n checkIfNullOrUndefined(maxValue) ? (maxParam > 0 ? maxParam : 0) : (maxValue as number),\r\n ])\r\n .range([graphHeight, 0])\r\n .nice();\r\n\r\n const mainGraphArea = area<FormattedDataType>()\r\n .x(d => x(d.date))\r\n .y1(d => y(d.y))\r\n .y0(graphHeight)\r\n .curve(curve);\r\n const lineShape = line<FormattedDataType>()\r\n .x(d => x(d.date))\r\n .y(d => y(d.y))\r\n .curve(curve);\r\n useEffect(() => {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const mousemove = (event: any) => {\r\n const selectedData =\r\n dataFormatted[\r\n bisectCenter(\r\n dataFormatted.map(d => d.date),\r\n x.invert(pointer(event)[0]),\r\n 1,\r\n )\r\n ];\r\n setMouseOverData(selectedData || dataFormatted[dataFormatted.length - 1]);\r\n onSeriesMouseOver?.(selectedData || dataFormatted[dataFormatted.length - 1]);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n };\r\n const mouseout = () => {\r\n setMouseOverData(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n };\r\n select(MouseoverRectRef.current).on('mousemove', mousemove).on('mouseout', mouseout);\r\n onSeriesMouseOver?.(undefined);\r\n }, [x, dataFormatted, onSeriesMouseOver]);\r\n return (\r\n <>\r\n <svg\r\n width={`${width}px`}\r\n height={`${height}px`}\r\n viewBox={`0 0 ${width} ${height}`}\r\n direction='ltr'\r\n >\r\n {areaId ? (\r\n <linearGradient id={areaId} x1='0' x2='0' y1='0' y2='1'>\r\n <stop style={{ stopColor: lineColor }} stopOpacity='0.1' offset='0%' />\r\n <stop style={{ stopColor: lineColor }} stopOpacity='0' offset='100%' />\r\n </linearGradient>\r\n ) : null}\r\n <g transform={`translate(${margin.left},${margin.top})`}>\r\n {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n <g>\r\n <text\r\n className={cn(\r\n 'xs:max-[360px]:hidden fill-primary-gray-700 dark:fill-primary-gray-300 text-[9px] md:text-[10px] lg:text-xs',\r\n classNames?.xAxis?.labels,\r\n )}\r\n y={graphHeight}\r\n x={x(dataFormatted[dataFormatted.length - 1].date)}\r\n style={{\r\n textAnchor: 'end',\r\n ...styles?.xAxis?.labels,\r\n }}\r\n dy='1em'\r\n >\r\n {format(dataFormatted[dataFormatted.length - 1].date, dateFormat)}\r\n </text>\r\n <text\r\n y={graphHeight}\r\n x={x(dataFormatted[0].date)}\r\n style={{\r\n textAnchor: 'start',\r\n ...styles?.xAxis?.labels,\r\n }}\r\n className={cn(\r\n 'xs:max-[360px]:hidden fill-primary-gray-700 dark:fill-primary-gray-300 text-[9px] md:text-[10px] lg:text-xs',\r\n classNames?.xAxis?.labels,\r\n )}\r\n dy='1em'\r\n >\r\n {format(dataFormatted[0].date, dateFormat)}\r\n </text>\r\n </g>\r\n <g>\r\n <path\r\n d={mainGraphArea(dataFormatted) || ''}\r\n style={{\r\n fill: `url(#${areaId})`,\r\n clipPath: 'url(#clip)',\r\n }}\r\n />\r\n <path\r\n d={lineShape(dataFormatted) || ''}\r\n style={{\r\n stroke: lineColor,\r\n fill: 'none',\r\n strokeWidth: 2,\r\n }}\r\n />\r\n {mouseOverData ? (\r\n <circle\r\n y1={0}\r\n cy={y(mouseOverData.y)}\r\n cx={x(mouseOverData.date)}\r\n r={5}\r\n style={{ fill: lineColor }}\r\n />\r\n ) : null}\r\n </g>\r\n {customLayers.filter(d => d.position === 'after').map(d => d.layer)}\r\n <rect\r\n ref={MouseoverRectRef}\r\n style={{\r\n fill: 'none',\r\n pointerEvents: 'all',\r\n }}\r\n width={graphWidth}\r\n height={graphHeight}\r\n />\r\n </g>\r\n </svg>\r\n {mouseOverData && tooltip && eventX && eventY ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={eventX}\r\n yPos={eventY}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import { useState, useRef, useEffect } from 'react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport {\r\n Languages,\r\n LineChartDataType,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n CurveTypes,\r\n CustomLayerDataType,\r\n} from '@/Types';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { generateRandomString } from '@/Utils/generateRandomString';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: LineChartDataType[];\r\n\r\n // Titles, Labels, and Sources\r\n /** Title of the graph */\r\n graphTitle?: string | React.ReactNode;\r\n /** Description of the graph */\r\n graphDescription?: string | React.ReactNode;\r\n /** Footnote for the graph */\r\n footNote?: string | React.ReactNode;\r\n /** Source data for the graph */\r\n sources?: SourcesDataType[];\r\n /** Accessibility label */\r\n ariaLabel?: string;\r\n\r\n // Colors and Styling\r\n /** Colors of the lines */\r\n lineColor?: string;\r\n /** Background color of the graph */\r\n backgroundColor?: string | boolean;\r\n /** Custom styles for the graph. Each object should be a valid React CSS style object. */\r\n styles?: StyleObject;\r\n /** Custom class names */\r\n classNames?: ClassNameObject;\r\n\r\n // Size and Spacing\r\n /** Width of the graph */\r\n width?: number;\r\n /** Height of the graph */\r\n height?: number;\r\n /** Minimum height of the graph */\r\n minHeight?: number;\r\n /** Relative height scaling factor. This overwrites the height props */\r\n relativeHeight?: number;\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n /** Left margin of the graph */\r\n leftMargin?: number;\r\n /** Right margin of the graph */\r\n rightMargin?: number;\r\n /** Top margin of the graph */\r\n topMargin?: number;\r\n /** Bottom margin of the graph */\r\n bottomMargin?: number;\r\n\r\n // Values and Ticks\r\n /** Maximum value for the chart */\r\n maxValue?: number;\r\n /** Minimum value for the chart */\r\n minValue?: number;\r\n\r\n // Graph Parameters\r\n /** Format of the date in the data object. Available formats can be found [here](https://date-fns.org/docs/format) */\r\n dateFormat?: string;\r\n /** Toggles the visibility of the area below the line */\r\n area?: boolean;\r\n /** Curve type for the line */\r\n curveType?: CurveTypes;\r\n /** Optional SVG <g> element or function that renders custom content behind or in front of the graph. */\r\n customLayers?: CustomLayerDataType[];\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n\r\n // Interactions and Callbacks\r\n /** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n /** Callback for mouse over event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n\r\n // Configuration and Options\r\n /** Language setting */\r\n language?: Languages;\r\n /** Color theme */\r\n theme?: 'light' | 'dark';\r\n /** Unique ID for the graph */\r\n graphID?: string;\r\n}\r\n\r\nexport function SparkLine(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n lineColor,\r\n sources,\r\n graphDescription,\r\n height,\r\n width,\r\n footNote,\r\n dateFormat = 'yyyy',\r\n area = false,\r\n padding,\r\n backgroundColor,\r\n leftMargin = 5,\r\n rightMargin = 5,\r\n topMargin = 10,\r\n bottomMargin = 20,\r\n tooltip,\r\n relativeHeight,\r\n onSeriesMouseOver,\r\n graphID,\r\n minValue,\r\n maxValue,\r\n graphDownload = false,\r\n dataDownload = false,\r\n language = 'en',\r\n minHeight = 0,\r\n theme = 'light',\r\n ariaLabel,\r\n curveType = 'curve',\r\n styles,\r\n classNames,\r\n customLayers = [],\r\n } = props;\r\n\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(width || entries[0].target.clientWidth || 620);\r\n setSvgHeight(height || entries[0].target.clientHeight || 480);\r\n });\r\n if (graphDiv.current) {\r\n setSvgHeight(graphDiv.current.clientHeight || 480);\r\n setSvgWidth(graphDiv.current.clientWidth || 620);\r\n if (!width) resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, [width, height]);\r\n\r\n return (\r\n <div\r\n className={`${theme || 'light'} flex ${width ? 'w-fit grow-0' : 'w-full grow'}`}\r\n dir={language === 'he' || language === 'ar' ? 'rtl' : undefined}\r\n >\r\n <div\r\n className={cn(\r\n `${\r\n !backgroundColor\r\n ? 'bg-transparent '\r\n : backgroundColor === true\r\n ? 'bg-primary-gray-200 dark:bg-primary-gray-650 '\r\n : ''\r\n }ml-auto mr-auto flex flex-col grow h-inherit ${language || 'en'}`,\r\n classNames?.graphContainer,\r\n )}\r\n style={{\r\n ...(styles?.graphContainer || {}),\r\n ...(backgroundColor && backgroundColor !== true ? { backgroundColor } : {}),\r\n }}\r\n id={graphID}\r\n ref={graphParentDiv}\r\n aria-label={\r\n ariaLabel ||\r\n `${\r\n graphTitle ? `The graph shows ${graphTitle}. ` : ''\r\n }This is a line chart that show trends over time.${\r\n graphDescription ? ` ${graphDescription}` : ''\r\n }`\r\n }\r\n >\r\n <div\r\n className='flex grow'\r\n style={{ padding: backgroundColor ? padding || '1rem' : padding || 0 }}\r\n >\r\n <div className='flex flex-col w-full gap-4 grow justify-between'>\r\n {graphTitle || graphDescription || graphDownload || dataDownload ? (\r\n <GraphHeader\r\n styles={{\r\n title: styles?.title,\r\n description: styles?.description,\r\n }}\r\n classNames={{\r\n title: classNames?.title,\r\n description: classNames?.description,\r\n }}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n width={width}\r\n graphDownload={graphDownload ? graphParentDiv.current : undefined}\r\n dataDownload={\r\n dataDownload\r\n ? data.map(d => d.data).filter(d => d !== undefined).length > 0\r\n ? data.map(d => d.data).filter(d => d !== undefined)\r\n : data.filter(d => d !== undefined)\r\n : null\r\n }\r\n />\r\n ) : null}\r\n <div\r\n className='flex flex-col grow justify-center leading-0'\r\n ref={graphDiv}\r\n aria-label='Graph area'\r\n >\r\n {(width || svgWidth) && (height || svgHeight) ? (\r\n <Graph\r\n data={data}\r\n lineColor={lineColor || Colors.primaryColors['blue-600']}\r\n width={width || svgWidth}\r\n height={Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}\r\n dateFormat={dateFormat}\r\n areaId={area ? generateRandomString(8) : undefined}\r\n leftMargin={leftMargin}\r\n rightMargin={rightMargin}\r\n topMargin={topMargin}\r\n bottomMargin={bottomMargin}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n minValue={minValue}\r\n maxValue={maxValue}\r\n curveType={curveType}\r\n styles={styles}\r\n classNames={classNames}\r\n customLayers={customLayers}\r\n />\r\n ) : null}\r\n </div>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n}\r\n"],"names":["Graph","props","data","width","height","lineColor","dateFormat","areaId","leftMargin","rightMargin","topMargin","bottomMargin","tooltip","onSeriesMouseOver","minValue","maxValue","curveType","styles","classNames","customLayers","curve","curveLinear","curveStep","curveStepAfter","curveStepBefore","curveMonotoneX","mouseOverData","setMouseOverData","useState","eventX","setEventX","eventY","setEventY","margin","MouseoverRectRef","useRef","dataFormatted","sortBy","d","parse","graphWidth","graphHeight","minYear","maxYear","minParam","maxParam","x","scaleTime","y","scaleLinear","checkIfNullOrUndefined","mainGraphArea","area","lineShape","line","useEffect","mousemove","event","selectedData","bisectCenter","pointer","mouseout","select","jsxs","Fragment","jsx","cn","format","Tooltip","SparkLine","graphTitle","sources","graphDescription","footNote","padding","backgroundColor","relativeHeight","graphID","graphDownload","dataDownload","language","minHeight","theme","ariaLabel","svgWidth","setSvgWidth","svgHeight","setSvgHeight","graphDiv","graphParentDiv","resizeObserver","entries","GraphHeader","Colors","generateRandomString","GraphFooter"],"mappings":"0uBAwDO,SAASA,GAAMC,EAAc,CAClC,KAAM,CACJ,KAAAC,EACA,MAAAC,EACA,OAAAC,EACA,UAAAC,EACA,WAAAC,EACA,OAAAC,EACA,WAAAC,EACA,YAAAC,EACA,UAAAC,EACA,aAAA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KAAAE,EACA,UAAWG,GAAawF,UAAO,cAAc,UAAU,EACvD,MAAO1F,GAASiF,EAChB,OAAQ,KAAK,IACXH,EACA7E,IACGwE,EACGK,GACG9E,GAASiF,GAAYR,EAAiBK,GACpC9E,GAASiF,GAAYR,EACtBK,GACD9E,GAASiF,GAAYR,EACxBU,EAAA,EAER,WAAAhF,EACA,OAAQ8C,EAAO0C,wBAAqB,CAAC,EAAI,OACzC,WAAAtF,EACA,YAAAC,EACA,UAAAC,EACA,aAAAC,EACA,QAAAC,EACA,kBAAAC,EACA,SAAAC,EACA,SAAAC,EACA,UAAAC,EACA,OAAAC,EACA,WAAAC,EACA,aAAAC,CAAA,CAAA,EAEA,IAAA,CAAA,EAELoD,GAAWE,EACVR,EAAAA,kBAAAA,IAAC8B,GAAAA,YAAA,CACC,OAAQ,CAAE,SAAU9E,GAAQ,SAAU,OAAQA,GAAQ,MAAA,EACtD,WAAY,CACV,SAAUC,GAAY,SACtB,OAAQA,GAAY,MAAA,EAEtB,QAAAqD,EACA,SAAAE,EACA,MAAAtE,CAAA,CAAA,EAEA,IAAA,CAAA,CACN,CAAA,CAAA,CACF,CAAA,CACF,CAAA,CAGN"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { a as y, r as c, b as l } from "./index-BHm2KTjD-2e-Fu8L-.js";
|
|
2
|
+
var r = {}, n;
|
|
3
|
+
function x() {
|
|
4
|
+
return n || (n = 1, function(e) {
|
|
5
|
+
Object.defineProperty(e, Symbol.toStringTag, { value: "Module" });
|
|
6
|
+
const a = /* @__PURE__ */ c(), d = /* @__PURE__ */ y(), i = /* @__PURE__ */ l(), o = d.cva("animate-spin border-[5px] rounded-full inline-block box-border", { variants: { variant: { red: "border-accent-dark-red dark:border-accent-red border-b-primary-gray-300 dark:border-b-primary-gray-550", blue: "border-primary-blue-600 dark:border-primary-blue-500 border-b-primary-gray-300 dark:border-b-primary-gray-550", black: "border-primary-gray-600 dark:border-primary-gray-200 border-b-primary-gray-300 dark:border-b-primary-gray-550", custom: "border-custom-color-600 border-b-primary-gray-300 dark:border-b-primary-gray-550" }, size: { sm: "border-[2px] h-6 w-6", base: "border-[4px] h-8 w-8", lg: "border-[6px] h-12 w-12" } }, defaultVariants: { size: "base", variant: "blue" } });
|
|
7
|
+
function b({ size: s, variant: t, show: p = !0, children: m, className: u }) {
|
|
8
|
+
return a.jsxRuntimeExports.jsxs("span", { className: i.cn("flex-col items-center justify-center", p ? "flex" : "hidden"), children: [a.jsxRuntimeExports.jsx("div", { className: i.cn(o({ variant: t, size: s }), u) }), m] });
|
|
9
|
+
}
|
|
10
|
+
e.Spinner = b;
|
|
11
|
+
}(r)), r;
|
|
12
|
+
}
|
|
13
|
+
var f = /* @__PURE__ */ x();
|
|
14
|
+
export {
|
|
15
|
+
f as S
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=Spinner-DN3s4S0H.js.map
|