@undp/data-viz 2.5.3 → 2.6.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.cjs +1 -1
- package/dist/AreaChart.cjs.map +1 -1
- package/dist/AreaChart.js +17 -16
- package/dist/AreaChart.js.map +1 -1
- package/dist/Axis-DY7jsk1Y.cjs +2 -0
- package/dist/{Axis-BTaS9oPQ.cjs.map → Axis-DY7jsk1Y.cjs.map} +1 -1
- package/dist/{Axis-CNZYWzH0.js → Axis-RRx-0Rlw.js} +9 -8
- package/dist/{Axis-CNZYWzH0.js.map → Axis-RRx-0Rlw.js.map} +1 -1
- package/dist/AxisTitle-B9F80_Z0.js +30 -0
- package/dist/AxisTitle-B9F80_Z0.js.map +1 -0
- package/dist/AxisTitle-CyFFbdNU.cjs +2 -0
- package/dist/{AxisTitle-DP_evhbe.cjs.map → AxisTitle-CyFFbdNU.cjs.map} +1 -1
- package/dist/BarGraph.cjs +1 -1
- package/dist/BarGraph.cjs.map +1 -1
- package/dist/BarGraph.js +203 -201
- package/dist/BarGraph.js.map +1 -1
- package/dist/BasicStatCard.cjs +1 -1
- package/dist/BasicStatCard.cjs.map +1 -1
- package/dist/BasicStatCard.js +15 -14
- package/dist/BasicStatCard.js.map +1 -1
- package/dist/BeeSwarmChart.cjs +1 -1
- package/dist/BeeSwarmChart.cjs.map +1 -1
- package/dist/BeeSwarmChart.js +60 -59
- package/dist/BeeSwarmChart.js.map +1 -1
- package/dist/BiVariateChoroplethMap.cjs +1 -1
- package/dist/BiVariateChoroplethMap.cjs.map +1 -1
- package/dist/BiVariateChoroplethMap.js +88 -86
- package/dist/BiVariateChoroplethMap.js.map +1 -1
- package/dist/BulletChart.cjs +1 -1
- package/dist/BulletChart.cjs.map +1 -1
- package/dist/BulletChart.js +88 -86
- package/dist/BulletChart.js.map +1 -1
- package/dist/ButterflyChart.cjs +1 -1
- package/dist/ButterflyChart.cjs.map +1 -1
- package/dist/ButterflyChart.js +100 -98
- package/dist/ButterflyChart.js.map +1 -1
- package/dist/ChoroplethMap.cjs +1 -1
- package/dist/ChoroplethMap.cjs.map +1 -1
- package/dist/ChoroplethMap.js +266 -243
- package/dist/ChoroplethMap.js.map +1 -1
- package/dist/CirclePackingGraph.cjs +1 -1
- package/dist/CirclePackingGraph.js +4 -4
- package/dist/ColorLegend.cjs +1 -1
- package/dist/ColorLegend.cjs.map +1 -1
- package/dist/ColorLegend.js +17 -16
- package/dist/ColorLegend.js.map +1 -1
- package/dist/ColorLegendWithMouseOver.cjs +1 -1
- package/dist/ColorLegendWithMouseOver.cjs.map +1 -1
- package/dist/ColorLegendWithMouseOver.js +13 -12
- package/dist/ColorLegendWithMouseOver.js.map +1 -1
- package/dist/Colors.cjs +1 -1
- package/dist/Colors.cjs.map +1 -1
- package/dist/Colors.d.ts +16 -0
- package/dist/Colors.js +16 -0
- package/dist/Colors.js.map +1 -1
- package/dist/CopyTextButton.cjs +1 -1
- package/dist/CopyTextButton.cjs.map +1 -1
- package/dist/CopyTextButton.js +37 -754
- package/dist/CopyTextButton.js.map +1 -1
- package/dist/CsvDownloadButton.cjs +4 -4
- package/dist/CsvDownloadButton.cjs.map +1 -1
- package/dist/CsvDownloadButton.js +47 -45
- package/dist/CsvDownloadButton.js.map +1 -1
- package/dist/DataCards.cjs +1 -1
- package/dist/DataCards.cjs.map +1 -1
- package/dist/DataCards.js +213 -467
- package/dist/DataCards.js.map +1 -1
- package/dist/DataTable.cjs +1 -1
- package/dist/DataTable.cjs.map +1 -1
- package/dist/DataTable.js +19 -19
- package/dist/DetailsModal-BmjtLqrZ.cjs +2 -0
- package/dist/{DetailsModal-Du8Fr1QD.cjs.map → DetailsModal-BmjtLqrZ.cjs.map} +1 -1
- package/dist/{DetailsModal-GqEbGHY2.js → DetailsModal-k-Me_U_T.js} +3 -3
- package/dist/{DetailsModal-GqEbGHY2.js.map → DetailsModal-k-Me_U_T.js.map} +1 -1
- package/dist/DifferenceLineChart.cjs +1 -1
- package/dist/DifferenceLineChart.cjs.map +1 -1
- package/dist/DifferenceLineChart.js +61 -60
- package/dist/DifferenceLineChart.js.map +1 -1
- package/dist/DonutChart.cjs +1 -1
- package/dist/DonutChart.cjs.map +1 -1
- package/dist/DonutChart.js +47 -46
- package/dist/DonutChart.js.map +1 -1
- package/dist/DotDensityMap.cjs +1 -1
- package/dist/DotDensityMap.cjs.map +1 -1
- package/dist/DotDensityMap.js +112 -110
- package/dist/DotDensityMap.js.map +1 -1
- package/dist/DualAxisLineChart.cjs +1 -1
- package/dist/DualAxisLineChart.cjs.map +1 -1
- package/dist/DualAxisLineChart.js +13 -12
- package/dist/DualAxisLineChart.js.map +1 -1
- package/dist/DumbbellChart.cjs +1 -1
- package/dist/DumbbellChart.cjs.map +1 -1
- package/dist/DumbbellChart.js +104 -102
- package/dist/DumbbellChart.js.map +1 -1
- package/dist/EmptyState-BoaUUuo6.cjs +2 -0
- package/dist/{EmptyState-CFmiFPHz.cjs.map → EmptyState-BoaUUuo6.cjs.map} +1 -1
- package/dist/{EmptyState-CaxXCkiN.js → EmptyState-prZ8OnEs.js} +4 -4
- package/dist/{EmptyState-CaxXCkiN.js.map → EmptyState-prZ8OnEs.js.map} +1 -1
- package/dist/ExcelDownloadButton.cjs +1 -1
- package/dist/ExcelDownloadButton.cjs.map +1 -1
- package/dist/ExcelDownloadButton.js +15 -13
- package/dist/ExcelDownloadButton.js.map +1 -1
- package/dist/FootNote.cjs +1 -1
- package/dist/FootNote.cjs.map +1 -1
- package/dist/FootNote.js +10 -9
- package/dist/FootNote.js.map +1 -1
- package/dist/GeoHubCompareMaps.cjs +1 -1
- package/dist/GeoHubCompareMaps.cjs.map +1 -1
- package/dist/GeoHubCompareMaps.js +14 -14
- package/dist/GeoHubMap.cjs +1 -1
- package/dist/GeoHubMap.cjs.map +1 -1
- package/dist/GeoHubMap.js +59 -59
- package/dist/GeoHubMapWithLayerSelection.cjs +1 -1
- package/dist/GeoHubMapWithLayerSelection.cjs.map +1 -1
- package/dist/GeoHubMapWithLayerSelection.js +50 -50
- package/dist/{GraphContainer-B8ZqOzKI.js → GraphContainer-DcOM2CI6.js} +28 -27
- package/dist/GraphContainer-DcOM2CI6.js.map +1 -0
- package/dist/GraphContainer-gaG9TSy4.cjs +2 -0
- package/dist/{GraphContainer-Cul9b74X.cjs.map → GraphContainer-gaG9TSy4.cjs.map} +1 -1
- package/dist/GraphDescription.cjs +1 -1
- package/dist/GraphDescription.cjs.map +1 -1
- package/dist/GraphDescription.js +14 -13
- package/dist/GraphDescription.js.map +1 -1
- package/dist/{GraphEl-Ch0uAeZw.js → GraphEl-C7KBBHvB.js} +9 -9
- package/dist/{GraphEl-Ch0uAeZw.js.map → GraphEl-C7KBBHvB.js.map} +1 -1
- package/dist/GraphEl-CGALp07K.cjs +2 -0
- package/dist/{GraphEl-BgkDbq50.cjs.map → GraphEl-CGALp07K.cjs.map} +1 -1
- package/dist/GraphFooter.cjs +1 -1
- package/dist/GraphFooter.cjs.map +1 -1
- package/dist/GraphFooter.js +2 -2
- package/dist/GraphHeader.cjs +1 -1
- package/dist/GraphHeader.cjs.map +1 -1
- package/dist/GraphHeader.js +1 -1
- package/dist/GraphTitle.cjs +1 -1
- package/dist/GraphTitle.cjs.map +1 -1
- package/dist/GraphTitle.js +14 -13
- package/dist/GraphTitle.js.map +1 -1
- package/dist/GriddedGraphs.cjs +1 -1
- package/dist/GriddedGraphs.cjs.map +1 -1
- package/dist/GriddedGraphs.js +58 -55
- package/dist/GriddedGraphs.js.map +1 -1
- package/dist/GriddedGraphsFromConfig.cjs +1 -1
- package/dist/GriddedGraphsFromConfig.cjs.map +1 -1
- package/dist/GriddedGraphsFromConfig.js +15 -15
- package/dist/HeatMap.cjs +1 -1
- package/dist/HeatMap.cjs.map +1 -1
- package/dist/HeatMap.js +17 -16
- package/dist/HeatMap.js.map +1 -1
- package/dist/Histogram.cjs +1 -1
- package/dist/Histogram.cjs.map +1 -1
- package/dist/Histogram.js +3 -3
- package/dist/HybridMap.cjs +1 -1
- package/dist/HybridMap.cjs.map +1 -1
- package/dist/HybridMap.js +409 -420
- package/dist/HybridMap.js.map +1 -1
- package/dist/ImageDownloadButton.cjs +1 -1
- package/dist/ImageDownloadButton.cjs.map +1 -1
- package/dist/ImageDownloadButton.js +16 -14
- package/dist/ImageDownloadButton.js.map +1 -1
- package/dist/LineChartWithConfidenceInterval.cjs +1 -1
- package/dist/LineChartWithConfidenceInterval.cjs.map +1 -1
- package/dist/LineChartWithConfidenceInterval.js +16 -15
- package/dist/LineChartWithConfidenceInterval.js.map +1 -1
- package/dist/LinearColorLegend.cjs +1 -1
- package/dist/LinearColorLegend.cjs.map +1 -1
- package/dist/LinearColorLegend.js +5 -4
- package/dist/LinearColorLegend.js.map +1 -1
- package/dist/MultiGraphDashboard.cjs +1 -1
- package/dist/MultiGraphDashboard.cjs.map +1 -1
- package/dist/MultiGraphDashboard.js +62 -60
- package/dist/MultiGraphDashboard.js.map +1 -1
- package/dist/MultiGraphDashboardFromConfig.cjs +1 -1
- package/dist/MultiGraphDashboardFromConfig.cjs.map +1 -1
- package/dist/MultiGraphDashboardFromConfig.js +7 -7
- package/dist/MultiGraphDashboardWideToLongFormat.cjs +1 -1
- package/dist/MultiGraphDashboardWideToLongFormat.cjs.map +1 -1
- package/dist/MultiGraphDashboardWideToLongFormat.js +21 -21
- package/dist/MultiGraphDashboardWideToLongFormat.js.map +1 -1
- package/dist/MultiGraphDashboardWideToLongFormatFromConfig.cjs +1 -1
- package/dist/MultiGraphDashboardWideToLongFormatFromConfig.cjs.map +1 -1
- package/dist/MultiGraphDashboardWideToLongFormatFromConfig.js +3 -3
- package/dist/MultiLineAltChart.cjs +1 -1
- package/dist/MultiLineAltChart.cjs.map +1 -1
- package/dist/MultiLineAltChart.js +16 -15
- package/dist/MultiLineAltChart.js.map +1 -1
- package/dist/MultiLineChart.cjs +1 -1
- package/dist/MultiLineChart.cjs.map +1 -1
- package/dist/MultiLineChart.js +16 -15
- package/dist/MultiLineChart.js.map +1 -1
- package/dist/ParetoChart.cjs +1 -1
- package/dist/ParetoChart.cjs.map +1 -1
- package/dist/ParetoChart.js +14 -13
- package/dist/ParetoChart.js.map +1 -1
- package/dist/PerformanceIntensiveMultiGraphDashboard.cjs +1 -1
- package/dist/PerformanceIntensiveMultiGraphDashboard.cjs.map +1 -1
- package/dist/PerformanceIntensiveMultiGraphDashboard.js +67 -65
- package/dist/PerformanceIntensiveMultiGraphDashboard.js.map +1 -1
- package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.cjs +1 -1
- package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.cjs.map +1 -1
- package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.js +8 -8
- package/dist/PerformanceIntensiveScrollStory.cjs +1 -1
- package/dist/PerformanceIntensiveScrollStory.cjs.map +1 -1
- package/dist/PerformanceIntensiveScrollStory.js +3 -3
- package/dist/RadarChart.cjs +1 -1
- package/dist/RadarChart.cjs.map +1 -1
- package/dist/RadarChart.js +11 -10
- package/dist/RadarChart.js.map +1 -1
- package/dist/ReferenceLine-CxITVT1K.cjs +2 -0
- package/dist/{ReferenceLine-CpU4G01Y.cjs.map → ReferenceLine-CxITVT1K.cjs.map} +1 -1
- package/dist/{ReferenceLine-D41VuUhE.js → ReferenceLine-NF4g3Reh.js} +26 -25
- package/dist/ReferenceLine-NF4g3Reh.js.map +1 -0
- package/dist/RegressionLine-BQ6h-NZP.js +88 -0
- package/dist/RegressionLine-BQ6h-NZP.js.map +1 -0
- package/dist/RegressionLine-BpcVBjL0.cjs +2 -0
- package/dist/{RegressionLine-BFoBiVJk.cjs.map → RegressionLine-BpcVBjL0.cjs.map} +1 -1
- package/dist/SVGDownloadButton.cjs +1 -1
- package/dist/SVGDownloadButton.cjs.map +1 -1
- package/dist/SVGDownloadButton.js +11 -9
- package/dist/SVGDownloadButton.js.map +1 -1
- package/dist/SankeyChart.cjs +1 -1
- package/dist/SankeyChart.cjs.map +1 -1
- package/dist/SankeyChart.js +63 -62
- package/dist/SankeyChart.js.map +1 -1
- package/dist/ScatterPlot.cjs +1 -1
- package/dist/ScatterPlot.cjs.map +1 -1
- package/dist/ScatterPlot.js +109 -107
- package/dist/ScatterPlot.js.map +1 -1
- package/dist/ScrollStory.cjs +1 -1
- package/dist/ScrollStory.cjs.map +1 -1
- package/dist/ScrollStory.js +3 -3
- package/dist/SimpleLineChart.cjs +1 -1
- package/dist/SimpleLineChart.cjs.map +1 -1
- package/dist/SimpleLineChart.js +17 -16
- package/dist/SimpleLineChart.js.map +1 -1
- package/dist/SingleGraphDashboard.cjs +1 -1
- package/dist/SingleGraphDashboard.cjs.map +1 -1
- package/dist/SingleGraphDashboard.js +59 -56
- package/dist/SingleGraphDashboard.js.map +1 -1
- package/dist/SingleGraphDashboardFromConfig.cjs +1 -1
- package/dist/SingleGraphDashboardFromConfig.cjs.map +1 -1
- package/dist/SingleGraphDashboardFromConfig.js +6 -6
- package/dist/SingleGraphDashboardGeoHubMaps.cjs +1 -1
- package/dist/SingleGraphDashboardGeoHubMaps.cjs.map +1 -1
- package/dist/SingleGraphDashboardGeoHubMaps.js +12 -12
- package/dist/SingleGraphDashboardGeoHubMapsFromConfig.cjs +1 -1
- package/dist/SingleGraphDashboardGeoHubMapsFromConfig.cjs.map +1 -1
- package/dist/SingleGraphDashboardGeoHubMapsFromConfig.js +8 -8
- package/dist/SingleGraphDashboardThreeDGraphs.cjs +1 -1
- package/dist/SingleGraphDashboardThreeDGraphs.cjs.map +1 -1
- package/dist/SingleGraphDashboardThreeDGraphs.js +59 -56
- package/dist/SingleGraphDashboardThreeDGraphs.js.map +1 -1
- package/dist/SingleGraphDashboardThreeDGraphsFromConfig.cjs +1 -1
- package/dist/SingleGraphDashboardThreeDGraphsFromConfig.cjs.map +1 -1
- package/dist/SingleGraphDashboardThreeDGraphsFromConfig.js +7 -7
- package/dist/SlopeChart.cjs +1 -1
- package/dist/SlopeChart.cjs.map +1 -1
- package/dist/SlopeChart.js +60 -59
- package/dist/SlopeChart.js.map +1 -1
- package/dist/Source.cjs +1 -1
- package/dist/Source.cjs.map +1 -1
- package/dist/Source.js +38 -4
- package/dist/Source.js.map +1 -1
- package/dist/SparkLine.cjs +1 -1
- package/dist/SparkLine.cjs.map +1 -1
- package/dist/SparkLine.js +11 -10
- package/dist/SparkLine.js.map +1 -1
- package/dist/StatCardFromData.cjs +1 -1
- package/dist/StatCardFromData.cjs.map +1 -1
- package/dist/StatCardFromData.js +15 -14
- package/dist/StatCardFromData.js.map +1 -1
- package/dist/StripChart.cjs +1 -1
- package/dist/StripChart.cjs.map +1 -1
- package/dist/StripChart.js +11 -10
- package/dist/StripChart.js.map +1 -1
- package/dist/ThreeDGlobe.cjs +1 -1
- package/dist/ThreeDGlobe.cjs.map +1 -1
- package/dist/ThreeDGlobe.js +52 -51
- package/dist/ThreeDGlobe.js.map +1 -1
- package/dist/ThresholdColorLegendWithMouseOver.cjs +1 -1
- package/dist/ThresholdColorLegendWithMouseOver.cjs.map +1 -1
- package/dist/ThresholdColorLegendWithMouseOver.js +17 -16
- package/dist/ThresholdColorLegendWithMouseOver.js.map +1 -1
- package/dist/{Tooltip-3EYDVa3w.js → Tooltip-DO56mY4b.js} +11 -10
- package/dist/{Tooltip-3EYDVa3w.js.map → Tooltip-DO56mY4b.js.map} +1 -1
- package/dist/Tooltip-DwUFLDrj.cjs +2 -0
- package/dist/{Tooltip-C9F3uYG0.cjs.map → Tooltip-DwUFLDrj.cjs.map} +1 -1
- package/dist/TreeMapGraph.cjs +1 -1
- package/dist/TreeMapGraph.cjs.map +1 -1
- package/dist/TreeMapGraph.js +34 -33
- package/dist/TreeMapGraph.js.map +1 -1
- package/dist/UnitChart.cjs +1 -1
- package/dist/UnitChart.cjs.map +1 -1
- package/dist/UnitChart.js +27 -27
- package/dist/WaterfallChart.cjs +1 -1
- package/dist/WaterfallChart.cjs.map +1 -1
- package/dist/WaterfallChart.js +21 -20
- package/dist/WaterfallChart.js.map +1 -1
- package/dist/XAxesLabels-0ROJnigy.cjs +2 -0
- package/dist/{XAxesLabels-C03jHniq.cjs.map → XAxesLabels-0ROJnigy.cjs.map} +1 -1
- package/dist/{XAxesLabels-B9gkjUiC.js → XAxesLabels-CPZX3OJN.js} +12 -11
- package/dist/XAxesLabels-CPZX3OJN.js.map +1 -0
- package/dist/XTicksAndGridLines-BO6KJc8d.cjs +2 -0
- package/dist/{XTicksAndGridLines-B4UhDVyU.cjs.map → XTicksAndGridLines-BO6KJc8d.cjs.map} +1 -1
- package/dist/{XTicksAndGridLines-CkYwVshF.js → XTicksAndGridLines-obTK2e7G.js} +10 -9
- package/dist/{XTicksAndGridLines-CkYwVshF.js.map → XTicksAndGridLines-obTK2e7G.js.map} +1 -1
- package/dist/{YAxesLabels-hWEUCTvs.js → YAxesLabels-CwVnFG2a.js} +13 -12
- package/dist/YAxesLabels-CwVnFG2a.js.map +1 -0
- package/dist/YAxesLabels-DIa2cEXL.cjs +2 -0
- package/dist/{YAxesLabels-DeENFC2M.cjs.map → YAxesLabels-DIa2cEXL.cjs.map} +1 -1
- package/dist/YTicksAndGridLines-C7glLI5b.cjs +2 -0
- package/dist/{YTicksAndGridLines-sT3zdCs6.cjs.map → YTicksAndGridLines-C7glLI5b.cjs.map} +1 -1
- package/dist/{YTicksAndGridLines-BbujwxOB.js → YTicksAndGridLines-wtuAKNeT.js} +10 -9
- package/dist/{YTicksAndGridLines-BbujwxOB.js.map → YTicksAndGridLines-wtuAKNeT.js.map} +1 -1
- package/dist/checkIfMultiple-BIEQDuA3.cjs +2 -0
- package/dist/checkIfMultiple-BIEQDuA3.cjs.map +1 -0
- package/dist/checkIfMultiple-D2tgEnYM.js +11 -0
- package/dist/checkIfMultiple-D2tgEnYM.js.map +1 -0
- package/dist/compiler-runtime-oPPev21o.cjs +11 -0
- package/dist/compiler-runtime-oPPev21o.cjs.map +1 -0
- package/dist/compiler-runtime-qHgugrLy.js +297 -0
- package/dist/compiler-runtime-qHgugrLy.js.map +1 -0
- package/dist/customArea-BCGIYDQa.cjs +2 -0
- package/dist/{customArea-BAcQ3pBM.cjs.map → customArea-BCGIYDQa.cjs.map} +1 -1
- package/dist/{customArea-D89lETG0.js → customArea-Dixg0NtQ.js} +10 -9
- package/dist/{customArea-D89lETG0.js.map → customArea-Dixg0NtQ.js.map} +1 -1
- package/dist/{fetchAndParseData-BAXhgTDM.js → fetchAndParseData-CDjQZ1fL.js} +5 -5
- package/dist/{fetchAndParseData-BAXhgTDM.js.map → fetchAndParseData-CDjQZ1fL.js.map} +1 -1
- package/dist/fetchAndParseData.js +1 -1
- package/dist/getSliderMarks-Bj_JJTtX.cjs +2 -0
- package/dist/getSliderMarks-Bj_JJTtX.cjs.map +1 -0
- package/dist/getSliderMarks-DSxFGb1f.js +21 -0
- package/dist/getSliderMarks-DSxFGb1f.js.map +1 -0
- package/dist/index-5BQWR1Z8.cjs +10 -0
- package/dist/{index-FXfr51ZM.cjs.map → index-5BQWR1Z8.cjs.map} +1 -1
- package/dist/index-BaXzoD4r.cjs +2 -0
- package/dist/{index-BuhBhuCq.cjs.map → index-BaXzoD4r.cjs.map} +1 -1
- package/dist/{index-Cv_5q6Rb.js → index-CNUlPiEL.js} +3 -3
- package/dist/{index-Cv_5q6Rb.js.map → index-CNUlPiEL.js.map} +1 -1
- package/dist/{index-DHVGV8Df.js → index-CmkqqFRG.js} +3 -3
- package/dist/{index-DHVGV8Df.js.map → index-CmkqqFRG.js.map} +1 -1
- package/dist/index-D_ls5oK8.js +142 -0
- package/dist/index-D_ls5oK8.js.map +1 -0
- package/dist/index-DbSnila_.cjs +2 -0
- package/dist/index-DbSnila_.cjs.map +1 -0
- package/dist/{index-BPyj_6hG.js → index-_w-CQAbR.js} +113 -112
- package/dist/{index-BPyj_6hG.js.map → index-_w-CQAbR.js.map} +1 -1
- package/dist/index-dN3wiQgD.cjs +2 -0
- package/dist/{index-DuLvdHo2.cjs.map → index-dN3wiQgD.cjs.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +16 -0
- package/dist/index.js +181 -180
- package/dist/index.js.map +1 -1
- package/dist/{proxy-BsxtcZKa.js → proxy-D31SA_aE.js} +2 -2
- package/dist/{proxy-BsxtcZKa.js.map → proxy-D31SA_aE.js.map} +1 -1
- package/dist/proxy-QMeVVqam.cjs +2 -0
- package/dist/{proxy-CqH8m8IQ.cjs.map → proxy-QMeVVqam.cjs.map} +1 -1
- package/dist/style.css +1 -1
- package/dist/transformData.js +2 -2
- package/dist/{transformDataForGraphFromFile-dt9sHTVy.js → transformDataForGraphFromFile-COZC6A0_.js} +4 -4
- package/dist/{transformDataForGraphFromFile-dt9sHTVy.js.map → transformDataForGraphFromFile-COZC6A0_.js.map} +1 -1
- package/dist/{use-in-view-KOXq5Kmc.js → use-in-view-Co5SmzfT.js} +2 -2
- package/dist/{use-in-view-KOXq5Kmc.js.map → use-in-view-Co5SmzfT.js.map} +1 -1
- package/dist/use-in-view-DjR_gqJP.cjs +2 -0
- package/dist/{use-in-view-dnRv_qqF.cjs.map → use-in-view-DjR_gqJP.cjs.map} +1 -1
- package/package.json +1 -1
- package/dist/Axis-BTaS9oPQ.cjs +0 -2
- package/dist/AxisTitle-CyLCqpW6.js +0 -29
- package/dist/AxisTitle-CyLCqpW6.js.map +0 -1
- package/dist/AxisTitle-DP_evhbe.cjs +0 -2
- package/dist/DetailsModal-Du8Fr1QD.cjs +0 -2
- package/dist/DropdownSelect-CX1yMemd.cjs +0 -5
- package/dist/DropdownSelect-CX1yMemd.cjs.map +0 -1
- package/dist/DropdownSelect-Dz7imdTB.js +0 -4191
- package/dist/DropdownSelect-Dz7imdTB.js.map +0 -1
- package/dist/EmptyState-CFmiFPHz.cjs +0 -2
- package/dist/GraphContainer-B8ZqOzKI.js.map +0 -1
- package/dist/GraphContainer-Cul9b74X.cjs +0 -2
- package/dist/GraphEl-BgkDbq50.cjs +0 -2
- package/dist/Modal-BIErPPKT.cjs +0 -46
- package/dist/Modal-BIErPPKT.cjs.map +0 -1
- package/dist/Modal-CrUYln5V.js +0 -1047
- package/dist/Modal-CrUYln5V.js.map +0 -1
- package/dist/ReferenceLine-CpU4G01Y.cjs +0 -2
- package/dist/ReferenceLine-D41VuUhE.js.map +0 -1
- package/dist/RegressionLine-BFoBiVJk.cjs +0 -2
- package/dist/RegressionLine-CuwB42I6.js +0 -87
- package/dist/RegressionLine-CuwB42I6.js.map +0 -1
- package/dist/Source-PKuwZOn3.cjs +0 -2
- package/dist/Source-PKuwZOn3.cjs.map +0 -1
- package/dist/Source-QGk8vhkS.js +0 -78
- package/dist/Source-QGk8vhkS.js.map +0 -1
- package/dist/Spinner-B2IIKg9r.js +0 -47
- package/dist/Spinner-B2IIKg9r.js.map +0 -1
- package/dist/Spinner-WHzzloYQ.cjs +0 -2
- package/dist/Spinner-WHzzloYQ.cjs.map +0 -1
- package/dist/Tooltip-C9F3uYG0.cjs +0 -2
- package/dist/Typography-BO0gQDIT.js +0 -270
- package/dist/Typography-BO0gQDIT.js.map +0 -1
- package/dist/Typography-BqmyF1gP.cjs +0 -2
- package/dist/Typography-BqmyF1gP.cjs.map +0 -1
- package/dist/XAxesLabels-B9gkjUiC.js.map +0 -1
- package/dist/XAxesLabels-C03jHniq.cjs +0 -2
- package/dist/XTicksAndGridLines-B4UhDVyU.cjs +0 -2
- package/dist/YAxesLabels-DeENFC2M.cjs +0 -2
- package/dist/YAxesLabels-hWEUCTvs.js.map +0 -1
- package/dist/YTicksAndGridLines-sT3zdCs6.cjs +0 -2
- package/dist/checkIfMultiple-CH5tqj4q.cjs +0 -2
- package/dist/checkIfMultiple-CH5tqj4q.cjs.map +0 -1
- package/dist/checkIfMultiple-Dpyy6BUP.js +0 -938
- package/dist/checkIfMultiple-Dpyy6BUP.js.map +0 -1
- package/dist/customArea-BAcQ3pBM.cjs +0 -2
- package/dist/getSliderMarks-BzrpHrHS.cjs +0 -2
- package/dist/getSliderMarks-BzrpHrHS.cjs.map +0 -1
- package/dist/getSliderMarks-X-_goqH9.js +0 -1027
- package/dist/getSliderMarks-X-_goqH9.js.map +0 -1
- package/dist/index-ApTBN0kp.js +0 -196
- package/dist/index-ApTBN0kp.js.map +0 -1
- package/dist/index-BhI7mBJx.cjs +0 -2
- package/dist/index-BhI7mBJx.cjs.map +0 -1
- package/dist/index-BuhBhuCq.cjs +0 -2
- package/dist/index-CHPV5EwG-BzibaIRc.js +0 -3360
- package/dist/index-CHPV5EwG-BzibaIRc.js.map +0 -1
- package/dist/index-CHPV5EwG-D4pAp7u0.cjs +0 -20
- package/dist/index-CHPV5EwG-D4pAp7u0.cjs.map +0 -1
- package/dist/index-DuLvdHo2.cjs +0 -2
- package/dist/index-FXfr51ZM.cjs +0 -10
- package/dist/index-Scxs_wcm-BAjU0Cob.js +0 -49
- package/dist/index-Scxs_wcm-BAjU0Cob.js.map +0 -1
- package/dist/index-Scxs_wcm-DUDU-Gll.cjs +0 -2
- package/dist/index-Scxs_wcm-DUDU-Gll.cjs.map +0 -1
- package/dist/index-w64Zl8io-DrMm5QSb.cjs +0 -2
- package/dist/index-w64Zl8io-DrMm5QSb.cjs.map +0 -1
- package/dist/index-w64Zl8io-ihagHOdP.js +0 -459
- package/dist/index-w64Zl8io-ihagHOdP.js.map +0 -1
- package/dist/proxy-CqH8m8IQ.cjs +0 -2
- package/dist/toConsumableArray-DiWOvh_d-DcLaZvDq.cjs +0 -4
- package/dist/toConsumableArray-DiWOvh_d-DcLaZvDq.cjs.map +0 -1
- package/dist/toConsumableArray-DiWOvh_d-DlpOlgap.js +0 -145
- package/dist/toConsumableArray-DiWOvh_d-DlpOlgap.js.map +0 -1
- package/dist/use-in-view-dnRv_qqF.cjs +0 -2
- package/dist/x-BXShoIAM-BC2sxios.cjs +0 -2
- package/dist/x-BXShoIAM-BC2sxios.cjs.map +0 -1
- package/dist/x-BXShoIAM-D6VWO6z5.js +0 -74
- package/dist/x-BXShoIAM-D6VWO6z5.js.map +0 -1
package/dist/DonutChart.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DonutChart.cjs","sources":["../node_modules/d3-shape/src/math.js","../node_modules/d3-shape/src/descending.js","../node_modules/d3-shape/src/identity.js","../node_modules/d3-shape/src/pie.js","../src/Utils/getArc.ts","../src/Components/Graphs/DonutChart/Graph.tsx","../src/Components/Graphs/DonutChart/index.tsx"],"sourcesContent":["export const abs = Math.abs;\nexport const atan2 = Math.atan2;\nexport const cos = Math.cos;\nexport const max = Math.max;\nexport const min = Math.min;\nexport const sin = Math.sin;\nexport const sqrt = Math.sqrt;\n\nexport const epsilon = 1e-12;\nexport const pi = Math.PI;\nexport const halfPi = pi / 2;\nexport const tau = 2 * pi;\n\nexport function acos(x) {\n return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);\n}\n\nexport function asin(x) {\n return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x);\n}\n","export default function(a, b) {\n return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;\n}\n","export default function(d) {\n return d;\n}\n","import array from \"./array.js\";\nimport constant from \"./constant.js\";\nimport descending from \"./descending.js\";\nimport identity from \"./identity.js\";\nimport {tau} from \"./math.js\";\n\nexport default function() {\n var value = identity,\n sortValues = descending,\n sort = null,\n startAngle = constant(0),\n endAngle = constant(tau),\n padAngle = constant(0);\n\n function pie(data) {\n var i,\n n = (data = array(data)).length,\n j,\n k,\n sum = 0,\n index = new Array(n),\n arcs = new Array(n),\n a0 = +startAngle.apply(this, arguments),\n da = Math.min(tau, Math.max(-tau, endAngle.apply(this, arguments) - a0)),\n a1,\n p = Math.min(Math.abs(da) / n, padAngle.apply(this, arguments)),\n pa = p * (da < 0 ? -1 : 1),\n v;\n\n for (i = 0; i < n; ++i) {\n if ((v = arcs[index[i] = i] = +value(data[i], i, data)) > 0) {\n sum += v;\n }\n }\n\n // Optionally sort the arcs by previously-computed values or by data.\n if (sortValues != null) index.sort(function(i, j) { return sortValues(arcs[i], arcs[j]); });\n else if (sort != null) index.sort(function(i, j) { return sort(data[i], data[j]); });\n\n // Compute the arcs! They are stored in the original data's order.\n for (i = 0, k = sum ? (da - n * pa) / sum : 0; i < n; ++i, a0 = a1) {\n j = index[i], v = arcs[j], a1 = a0 + (v > 0 ? v * k : 0) + pa, arcs[j] = {\n data: data[j],\n index: i,\n value: v,\n startAngle: a0,\n endAngle: a1,\n padAngle: p\n };\n }\n\n return arcs;\n }\n\n pie.value = function(_) {\n return arguments.length ? (value = typeof _ === \"function\" ? _ : constant(+_), pie) : value;\n };\n\n pie.sortValues = function(_) {\n return arguments.length ? (sortValues = _, sort = null, pie) : sortValues;\n };\n\n pie.sort = function(_) {\n return arguments.length ? (sort = _, sortValues = null, pie) : sort;\n };\n\n pie.startAngle = function(_) {\n return arguments.length ? (startAngle = typeof _ === \"function\" ? _ : constant(+_), pie) : startAngle;\n };\n\n pie.endAngle = function(_) {\n return arguments.length ? (endAngle = typeof _ === \"function\" ? _ : constant(+_), pie) : endAngle;\n };\n\n pie.padAngle = function(_) {\n return arguments.length ? (padAngle = typeof _ === \"function\" ? _ : constant(+_), pie) : padAngle;\n };\n\n return pie;\n}\n","const polarToCartesian = (\r\n centerX: number,\r\n centerY: number,\r\n radius: number,\r\n angleInRadians: number,\r\n) => {\r\n return {\r\n x: centerX + radius * Math.cos(angleInRadians),\r\n y: centerY + radius * Math.sin(angleInRadians),\r\n };\r\n};\r\n\r\nexport function getArc(\r\n x: number,\r\n y: number,\r\n radius: number,\r\n startAngleInRadians: number,\r\n endAngleInRadians: number,\r\n) {\r\n const start = polarToCartesian(x, y, radius, startAngleInRadians);\r\n const end = polarToCartesian(\r\n x,\r\n y,\r\n radius,\r\n Math.abs(endAngleInRadians - startAngleInRadians) === 2 * Math.PI\r\n ? 0.999999 * endAngleInRadians\r\n : endAngleInRadians,\r\n );\r\n const largeArcFlag = endAngleInRadians - startAngleInRadians <= Math.PI ? '0' : '1';\r\n const d = ['M', start.x, start.y, 'A', radius, radius, 0, largeArcFlag, 1, end.x, end.y].join(\r\n ' ',\r\n );\r\n return d;\r\n}\r\n","/* eslint-disable @typescript-eslint/no-explicit-any */\r\nimport isEqual from 'fast-deep-equal';\r\nimport { pie } from 'd3-shape';\r\nimport { isValidElement, ReactElement, useRef, useState } from 'react';\r\nimport { H2, P } from '@undp/design-system-react/Typography';\r\nimport { AnimatePresence, motion, useInView } from 'motion/react';\r\n\r\nimport { AnimateDataType, ClassNameObject, DonutChartDataType, StyleObject } from '@/Types';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { DetailsModal } from '@/Components/Elements/DetailsModal';\r\nimport { getArc } from '@/Utils/getArc';\r\n\r\ninterface Props {\r\n mainText?:\r\n | string\r\n | {\r\n label: string;\r\n suffix?: string;\r\n prefix?: string;\r\n locale?: string;\r\n padZeros?: boolean;\r\n precision?: number;\r\n }\r\n | ReactElement;\r\n radius: number;\r\n colors: string[];\r\n subNote?: string;\r\n strokeWidth: number;\r\n data: DonutChartDataType[];\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n onSeriesMouseOver?: (_d: any) => void;\r\n onSeriesMouseClick?: (_d: any) => void;\r\n colorDomain: string[];\r\n resetSelectionOnDoubleClick: boolean;\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n animate: AnimateDataType;\r\n trackColor: string;\r\n naLabel: string;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n mainText,\r\n data,\r\n radius,\r\n colors,\r\n subNote,\r\n strokeWidth,\r\n tooltip,\r\n onSeriesMouseOver,\r\n onSeriesMouseClick,\r\n colorDomain,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n animate,\r\n trackColor,\r\n naLabel,\r\n } = props;\r\n const svgRef = useRef(null);\r\n const isInView = useInView(svgRef, {\r\n once: animate.once,\r\n amount: animate.amount,\r\n });\r\n const pieData = pie()\r\n .sort(null)\r\n .startAngle(0)\r\n .value((d: any) => d.size);\r\n\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n\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 return (\r\n <>\r\n <motion.svg\r\n ref={svgRef}\r\n width={`${radius * 2}px`}\r\n height={`${radius * 2}px`}\r\n viewBox={`0 0 ${radius * 2} ${radius * 2}`}\r\n direction='ltr'\r\n className='mx-auto'\r\n >\r\n <motion.g transform={`translate(${radius} ${radius})`}>\r\n {mainText || subNote ? (\r\n <foreignObject\r\n y={0 - (radius - strokeWidth)}\r\n x={0 - (radius - strokeWidth)}\r\n width={2 * (radius - strokeWidth)}\r\n height={2 * (radius - strokeWidth)}\r\n >\r\n <div className='flex flex-col gap-0.5 justify-center items-center h-inherit py-0 px-4'>\r\n {mainText ? (\r\n isValidElement(mainText) ? (\r\n mainText\r\n ) : (\r\n <H2\r\n marginBottom='none'\r\n className='donut-main-text text-primary-gray-700 dark:text-primary-gray-100 leading-none text-center'\r\n >\r\n {typeof mainText === 'string'\r\n ? mainText\r\n : data.findIndex(d => d.label === mainText.label) !== -1\r\n ? numberFormattingFunction(\r\n data[data.findIndex(d => d.label === mainText.label)].size,\r\n naLabel,\r\n mainText.precision,\r\n mainText.prefix,\r\n mainText.suffix,\r\n mainText.locale,\r\n mainText.padZeros,\r\n )\r\n : naLabel}\r\n </H2>\r\n )\r\n ) : null}\r\n {subNote ? (\r\n <P\r\n marginBottom='none'\r\n size='base'\r\n leading='none'\r\n className='donut-sub-note text-primary-gray-700 dark:text-primary-gray-100 text-center font-bold'\r\n >\r\n {subNote}\r\n </P>\r\n ) : typeof mainText === 'string' || !mainText || isValidElement(mainText) ? null : (\r\n <P\r\n size='base'\r\n marginBottom='none'\r\n leading='none'\r\n className='donut-label text-primary-gray-700 dark:text-primary-gray-100 text-center font-bold'\r\n >\r\n {mainText.label}\r\n </P>\r\n )}\r\n </div>\r\n </foreignObject>\r\n ) : null}\r\n <circle\r\n cx={0}\r\n cy={0}\r\n r={radius - strokeWidth / 2}\r\n fill='none'\r\n stroke={trackColor}\r\n strokeWidth={strokeWidth}\r\n />\r\n <AnimatePresence>\r\n {pieData(data as any).map((d, i) => (\r\n <motion.path\r\n key={i}\r\n variants={{\r\n initial: {\r\n pathLength: 0,\r\n d: getArc(\r\n 0,\r\n 0,\r\n radius - strokeWidth / 2,\r\n d.startAngle - Math.PI / 2,\r\n d.endAngle - Math.PI / 2,\r\n ),\r\n opacity: mouseOverData\r\n ? mouseOverData.label === (d.data as any).label\r\n ? 1\r\n : 0.3\r\n : 1,\r\n },\r\n whileInView: {\r\n pathLength: 1,\r\n d: getArc(\r\n 0,\r\n 0,\r\n radius - strokeWidth / 2,\r\n d.startAngle - Math.PI / 2,\r\n d.endAngle - Math.PI / 2,\r\n ),\r\n opacity: mouseOverData\r\n ? mouseOverData.label === (d.data as any).label\r\n ? 1\r\n : 0.3\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 style={{\r\n stroke:\r\n colorDomain.indexOf((d.data as any).label) !== -1\r\n ? colors[colorDomain.indexOf((d.data as any).label) % colors.length]\r\n : Colors.gray,\r\n strokeWidth,\r\n fill: 'none',\r\n }}\r\n onMouseEnter={event => {\r\n setMouseOverData(d.data);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.(d);\r\n }}\r\n onClick={() => {\r\n if (onSeriesMouseClick || detailsOnClick) {\r\n if (isEqual(mouseClickData, d.data) && resetSelectionOnDoubleClick) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n setMouseClickData(d.data);\r\n if (onSeriesMouseClick) onSeriesMouseClick(d.data);\r\n }\r\n }\r\n }}\r\n onMouseMove={event => {\r\n setMouseOverData(d.data);\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 />\r\n ))}\r\n </AnimatePresence>\r\n </motion.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 <DetailsModal\r\n body={detailsOnClick}\r\n data={mouseClickData}\r\n setData={setMouseClickData}\r\n className={classNames?.modal}\r\n />\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import { ReactElement, useEffect, useRef, useState } from 'react';\r\nimport { P } from '@undp/design-system-react/Typography';\r\nimport orderBy from 'lodash.orderby';\r\nimport { Spacer } from '@undp/design-system-react/Spacer';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport {\r\n DonutChartDataType,\r\n Languages,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n AnimateDataType,\r\n NumberFormatOptions,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { EmptyState } from '@/Components/Elements/EmptyState';\r\nimport { GraphArea, GraphContainer } from '@/Components/Elements/GraphContainer';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: DonutChartDataType[];\r\n\r\n // Titles, Labels, and Sources\r\n /** Title of the graph */\r\n graphTitle?: string | React.ReactNode;\r\n /** Description of the graph */\r\n graphDescription?: string | React.ReactNode;\r\n /** Footnote for the graph */\r\n footNote?: string | React.ReactNode;\r\n /** Source data for the graph */\r\n sources?: SourcesDataType[];\r\n /** Accessibility label */\r\n ariaLabel?: string;\r\n\r\n // Colors and Styling\r\n /** Array of colors for each segment */\r\n colors?: string[];\r\n /** Domain of colors for the graph */\r\n colorDomain?: 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 /** Radius of the donut chart */\r\n radius?: number;\r\n\r\n // Graph Parameters\r\n /** Toggle visibility of color scale. This is only applicable if the data props hae color parameter */\r\n showColorScale?: boolean;\r\n /** Max width of the color scale as a css property */\r\n colorScaleMaxWidth?: string;\r\n /** Stroke width of the arcs and circle of the donut */\r\n strokeWidth?: number;\r\n /** Sorting order for data. This is overwritten by labelOrder prop */\r\n sortData?: 'asc' | 'desc';\r\n /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\r\n /** Large text at the center of the donut chart. If the type is an object then the text is the value in the data for the label mentioned in the object */\r\n mainText?:\r\n | string\r\n | {\r\n label: string;\r\n suffix?: string;\r\n prefix?: string;\r\n locale?: string;\r\n padZeros?: boolean;\r\n precision?: number;\r\n }\r\n | ReactElement;\r\n /** Small text at the center of the donut chart */\r\n subNote?: string;\r\n /** Track color (i.e. the color of the donut chart's background) of the donut chart */\r\n trackColor?: string;\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 /** Configuration options for controlling number formatting, localization, prefixes/suffixes, precision, and zero padding. */\r\n numberDisplayOptions?: NumberFormatOptions;\r\n /** Defines how “NA” values should be displayed/labelled in the graph */\r\n naLabel?: string;\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 DonutChart(props: Props) {\r\n const {\r\n mainText,\r\n graphTitle,\r\n colors = Colors.light.categoricalColors.colors,\r\n sources,\r\n strokeWidth = 50,\r\n graphDescription,\r\n subNote,\r\n footNote,\r\n radius,\r\n data,\r\n showColorScale = true,\r\n padding,\r\n backgroundColor = false,\r\n tooltip,\r\n onSeriesMouseOver,\r\n graphID,\r\n onSeriesMouseClick,\r\n graphDownload = false,\r\n dataDownload = false,\r\n colorDomain,\r\n sortData,\r\n language = 'en',\r\n theme = 'light',\r\n width,\r\n height,\r\n minHeight = 0,\r\n relativeHeight,\r\n ariaLabel,\r\n resetSelectionOnDoubleClick = true,\r\n colorScaleMaxWidth,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n animate = false,\r\n trackColor = Colors.light.grays['gray-200'],\r\n naLabel = 'NA',\r\n numberDisplayOptions,\r\n } = props;\r\n\r\n const [graphRadius, setGraphRadius] = useState(0);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setGraphRadius(\r\n (Math.min(\r\n ...[entries[0].target.clientWidth || 620, entries[0].target.clientHeight || 480],\r\n ) || 420) / 2,\r\n );\r\n });\r\n if (graphDiv.current) {\r\n resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, []);\r\n\r\n const sortedData = sortData ? orderBy(data, ['size'], [sortData]) : data;\r\n\r\n return (\r\n <GraphContainer\r\n className={classNames?.graphContainer}\r\n style={styles?.graphContainer}\r\n id={graphID}\r\n ref={graphParentDiv}\r\n aria-label={ariaLabel}\r\n backgroundColor={backgroundColor}\r\n theme={theme}\r\n language={language}\r\n minHeight={minHeight}\r\n width={width}\r\n height={height}\r\n relativeHeight={relativeHeight}\r\n padding={padding}\r\n >\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 : 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 {showColorScale && data.length > 0 ? (\r\n <>\r\n <div\r\n className={cn(\r\n 'leading-0 flex mb-0 ml-auto mr-auto justify-center gap-x-3 gap-y-0 flex-wrap',\r\n classNames?.colorLegend,\r\n )}\r\n style={{ maxWidth: colorScaleMaxWidth }}\r\n aria-label='Color legend'\r\n >\r\n {sortedData.map((d, i) => (\r\n <div className='flex gap-2 items-center pb-3' key={i}>\r\n <div\r\n className='w-3 h-3 rounded-full'\r\n style={{\r\n backgroundColor:\r\n (colorDomain || sortedData.map(el => el.label)).indexOf(d.label) !== -1\r\n ? (colors || Colors[theme].categoricalColors.colors)[\r\n (colorDomain || sortedData.map(el => el.label)).indexOf(d.label) %\r\n (colors || Colors[theme].categoricalColors.colors).length\r\n ]\r\n : Colors.gray,\r\n }}\r\n />\r\n <P\r\n marginBottom='none'\r\n size='sm'\r\n className='text-primary-gray-700 dark:text-primary-gray-100'\r\n >\r\n {d.label}:{' '}\r\n <span className='font-bold' style={{ fontSize: 'inherit' }}>\r\n {numberFormattingFunction(\r\n d.size,\r\n naLabel,\r\n numberDisplayOptions?.precision,\r\n numberDisplayOptions?.prefix,\r\n numberDisplayOptions?.suffix,\r\n numberDisplayOptions?.locale,\r\n numberDisplayOptions?.padZeros,\r\n )}\r\n </span>\r\n </P>\r\n </div>\r\n ))}\r\n </div>\r\n <Spacer size='lg' />\r\n </>\r\n ) : null}\r\n <GraphArea ref={graphDiv}>\r\n {data.length === 0 && <EmptyState />}\r\n {graphRadius && data.length > 0 ? (\r\n <Graph\r\n mainText={mainText}\r\n data={sortedData}\r\n colors={colors}\r\n radius={radius || graphRadius}\r\n subNote={subNote}\r\n strokeWidth={strokeWidth}\r\n tooltip={tooltip}\r\n colorDomain={colorDomain || sortedData.map(d => d.label)}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n styles={styles}\r\n detailsOnClick={detailsOnClick}\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 trackColor={trackColor}\r\n naLabel={naLabel}\r\n />\r\n ) : null}\r\n </GraphArea>\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 </GraphContainer>\r\n );\r\n}\r\n"],"names":["pi","tau","descending","a","b","identity","d","pie","value","sortValues","sort","startAngle","constant","endAngle","padAngle","data","i","n","array","j","k","sum","index","arcs","a0","da","a1","p","pa","v","_","polarToCartesian","centerX","centerY","radius","angleInRadians","x","Math","cos","y","sin","getArc","startAngleInRadians","endAngleInRadians","start","end","abs","PI","largeArcFlag","join","Graph","props","$","_c","mainText","colors","subNote","strokeWidth","tooltip","onSeriesMouseOver","onSeriesMouseClick","colorDomain","resetSelectionOnDoubleClick","detailsOnClick","styles","classNames","animate","trackColor","naLabel","svgRef","useRef","t0","amount","once","isInView","useInView","pieData","_temp","mouseOverData","setMouseOverData","useState","undefined","mouseClickData","setMouseClickData","eventX","setEventX","eventY","setEventY","t1","motion","t2","t3","t4","t5","t6","t7","t8","t9","jsx","jsxs","isValidElement","H2","findIndex","d_1","label","numberFormattingFunction","size","precision","prefix","suffix","locale","padZeros","P","t10","t11","T0","AnimatePresence","t12","duration","d_2","initial","pathLength","opacity","whileInView","transition","stroke","indexOf","length","Colors","gray","fill","event","clientY","clientX","isEqual","event_0","t13","map","t14","t15","g","t16","svg","t17","Tooltip","t18","modal","DetailsModal","t19","Fragment","DonutChart","graphTitle","light","categoricalColors","sources","graphDescription","footNote","showColorScale","padding","backgroundColor","graphID","graphDownload","dataDownload","sortData","language","theme","width","height","minHeight","relativeHeight","ariaLabel","colorScaleMaxWidth","grays","numberDisplayOptions","graphRadius","setGraphRadius","graphDiv","graphParentDiv","useEffect","resizeObserver","ResizeObserver","entries","min","target","clientWidth","clientHeight","current","observe","disconnect","sortedData","orderBy","GraphContainer","graphContainer","GraphHeader","title","description","filter","cn","colorLegend","maxWidth","el","fontSize","Spacer","GraphArea","EmptyState","GraphFooter","footnote","source"],"mappings":"0uBASaA,GAAK,KAAK,GAEVC,GAAM,EAAID,GCXR,SAAAE,GAASC,EAAGC,EAAG,CAC5B,OAAOA,EAAID,EAAI,GAAKC,EAAID,EAAI,EAAIC,GAAKD,EAAI,EAAI,GAC/C,CCFe,SAAAE,GAASC,EAAG,CACzB,OAAOA,CACT,CCIe,SAAAC,IAAW,CACxB,IAAIC,EAAQH,GACRI,EAAaP,GACbQ,EAAO,KACPC,EAAaC,EAAAA,SAAS,CAAC,EACvBC,EAAWD,EAAAA,SAASX,EAAG,EACvBa,EAAWF,EAAAA,SAAS,CAAC,EAEzB,SAASL,EAAIQ,EAAM,CACjB,IAAIC,EACAC,GAAKF,EAAOG,QAAMH,CAAI,GAAG,OACzBI,EACAC,EACAC,EAAM,EACNC,EAAQ,IAAI,MAAML,CAAC,EACnBM,EAAO,IAAI,MAAMN,CAAC,EAClBO,EAAK,CAACb,EAAW,MAAM,KAAM,SAAS,EACtCc,EAAK,KAAK,IAAIxB,GAAK,KAAK,IAAI,CAACA,GAAKY,EAAS,MAAM,KAAM,SAAS,EAAIW,CAAE,CAAC,EACvEE,EACAC,EAAI,KAAK,IAAI,KAAK,IAAIF,CAAE,EAAIR,EAAGH,EAAS,MAAM,KAAM,SAAS,CAAC,EAC9Dc,EAAKD,GAAKF,EAAK,EAAI,GAAK,GACxBI,EAEJ,IAAKb,EAAI,EAAGA,EAAIC,EAAG,EAAED,GACda,EAAIN,EAAKD,EAAMN,CAAC,EAAIA,CAAC,EAAI,CAACR,EAAMO,EAAKC,CAAC,EAAGA,EAAGD,CAAI,GAAK,IACxDM,GAAOQ,GASX,IAJIpB,GAAc,KAAMa,EAAM,KAAK,SAASN,EAAGG,EAAG,CAAE,OAAOV,EAAWc,EAAKP,CAAC,EAAGO,EAAKJ,CAAC,CAAC,CAAG,CAAC,EACjFT,GAAQ,MAAMY,E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K3B,EACbjK,SAAAA,CAAAA,EAAKgH,SAAW,GAAK7B,EAAAA,kBAAAA,IAAC0G,GAAAA,WAAA,CAAA,CAAU,EAChC9B,GAAe/J,EAAKgH,OAAS,EAC5B7B,EAAAA,kBAAAA,IAAChD,GAAA,CACC,SAAAI,EACA,KAAMuI,EACN,OAAAtI,EACA,OAAQrB,GAAU4I,EAClB,QAAAtH,EACA,YAAAC,EACA,QAAAC,EACA,YAAaG,GAAegI,EAAWpD,IAAInI,GAAKA,EAAEkG,KAAK,EACvD,kBAAA7C,EACA,mBAAAC,EACA,4BAAAE,EACA,OAAAE,EACA,eAAAD,EACA,QACEG,IAAY,GACR,CAAEoD,SAAU,GAAK7C,KAAM,GAAMD,OAAQ,EAAA,EACrCN,GAAW,CAAEoD,SAAU,EAAG7C,KAAM,GAAMD,OAAQ,CAAA,EAEpD,WAAAL,GACA,QAAAC,EAAA,CAAiB,EAEjB,IAAA,EACN,EACCsF,GAAWE,EACV1D,EAAAA,kBAAAA,IAAC2G,GAAAA,YAAA,CACC,OAAQ,CAAEC,SAAU9I,GAAQ8I,SAAUC,OAAQ/I,GAAQ+I,MAAAA,EACtD,WAAY,CACVD,SAAU7I,GAAY6I,SACtBC,OAAQ9I,GAAY8I,MAAAA,EAEtB,QAAArD,EACA,SAAAE,EACA,MAAAU,CAAA,CAAa,EAEb,IAAA,EACN,CAEJ","x_google_ignoreList":[0,1,2,3]}
|
|
1
|
+
{"version":3,"file":"DonutChart.cjs","sources":["../node_modules/d3-shape/src/math.js","../node_modules/d3-shape/src/descending.js","../node_modules/d3-shape/src/identity.js","../node_modules/d3-shape/src/pie.js","../src/Utils/getArc.ts","../src/Components/Graphs/DonutChart/Graph.tsx","../src/Components/Graphs/DonutChart/index.tsx"],"sourcesContent":["export const abs = Math.abs;\nexport const atan2 = Math.atan2;\nexport const cos = Math.cos;\nexport const max = Math.max;\nexport const min = Math.min;\nexport const sin = Math.sin;\nexport const sqrt = Math.sqrt;\n\nexport const epsilon = 1e-12;\nexport const pi = Math.PI;\nexport const halfPi = pi / 2;\nexport const tau = 2 * pi;\n\nexport function acos(x) {\n return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);\n}\n\nexport function asin(x) {\n return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x);\n}\n","export default function(a, b) {\n return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;\n}\n","export default function(d) {\n return d;\n}\n","import array from \"./array.js\";\nimport constant from \"./constant.js\";\nimport descending from \"./descending.js\";\nimport identity from \"./identity.js\";\nimport {tau} from \"./math.js\";\n\nexport default function() {\n var value = identity,\n sortValues = descending,\n sort = null,\n startAngle = constant(0),\n endAngle = constant(tau),\n padAngle = constant(0);\n\n function pie(data) {\n var i,\n n = (data = array(data)).length,\n j,\n k,\n sum = 0,\n index = new Array(n),\n arcs = new Array(n),\n a0 = +startAngle.apply(this, arguments),\n da = Math.min(tau, Math.max(-tau, endAngle.apply(this, arguments) - a0)),\n a1,\n p = Math.min(Math.abs(da) / n, padAngle.apply(this, arguments)),\n pa = p * (da < 0 ? -1 : 1),\n v;\n\n for (i = 0; i < n; ++i) {\n if ((v = arcs[index[i] = i] = +value(data[i], i, data)) > 0) {\n sum += v;\n }\n }\n\n // Optionally sort the arcs by previously-computed values or by data.\n if (sortValues != null) index.sort(function(i, j) { return sortValues(arcs[i], arcs[j]); });\n else if (sort != null) index.sort(function(i, j) { return sort(data[i], data[j]); });\n\n // Compute the arcs! They are stored in the original data's order.\n for (i = 0, k = sum ? (da - n * pa) / sum : 0; i < n; ++i, a0 = a1) {\n j = index[i], v = arcs[j], a1 = a0 + (v > 0 ? v * k : 0) + pa, arcs[j] = {\n data: data[j],\n index: i,\n value: v,\n startAngle: a0,\n endAngle: a1,\n padAngle: p\n };\n }\n\n return arcs;\n }\n\n pie.value = function(_) {\n return arguments.length ? (value = typeof _ === \"function\" ? _ : constant(+_), pie) : value;\n };\n\n pie.sortValues = function(_) {\n return arguments.length ? (sortValues = _, sort = null, pie) : sortValues;\n };\n\n pie.sort = function(_) {\n return arguments.length ? (sort = _, sortValues = null, pie) : sort;\n };\n\n pie.startAngle = function(_) {\n return arguments.length ? (startAngle = typeof _ === \"function\" ? _ : constant(+_), pie) : startAngle;\n };\n\n pie.endAngle = function(_) {\n return arguments.length ? (endAngle = typeof _ === \"function\" ? _ : constant(+_), pie) : endAngle;\n };\n\n pie.padAngle = function(_) {\n return arguments.length ? (padAngle = typeof _ === \"function\" ? _ : constant(+_), pie) : padAngle;\n };\n\n return pie;\n}\n","const polarToCartesian = (\r\n centerX: number,\r\n centerY: number,\r\n radius: number,\r\n angleInRadians: number,\r\n) => {\r\n return {\r\n x: centerX + radius * Math.cos(angleInRadians),\r\n y: centerY + radius * Math.sin(angleInRadians),\r\n };\r\n};\r\n\r\nexport function getArc(\r\n x: number,\r\n y: number,\r\n radius: number,\r\n startAngleInRadians: number,\r\n endAngleInRadians: number,\r\n) {\r\n const start = polarToCartesian(x, y, radius, startAngleInRadians);\r\n const end = polarToCartesian(\r\n x,\r\n y,\r\n radius,\r\n Math.abs(endAngleInRadians - startAngleInRadians) === 2 * Math.PI\r\n ? 0.999999 * endAngleInRadians\r\n : endAngleInRadians,\r\n );\r\n const largeArcFlag = endAngleInRadians - startAngleInRadians <= Math.PI ? '0' : '1';\r\n const d = ['M', start.x, start.y, 'A', radius, radius, 0, largeArcFlag, 1, end.x, end.y].join(\r\n ' ',\r\n );\r\n return d;\r\n}\r\n","/* eslint-disable @typescript-eslint/no-explicit-any */\r\nimport isEqual from 'fast-deep-equal';\r\nimport { pie } from 'd3-shape';\r\nimport { isValidElement, ReactElement, useRef, useState } from 'react';\r\nimport { H2, P } from '@undp/design-system-react/Typography';\r\nimport { AnimatePresence, motion, useInView } from 'motion/react';\r\n\r\nimport { AnimateDataType, ClassNameObject, DonutChartDataType, StyleObject } from '@/Types';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { DetailsModal } from '@/Components/Elements/DetailsModal';\r\nimport { getArc } from '@/Utils/getArc';\r\n\r\ninterface Props {\r\n mainText?:\r\n | string\r\n | {\r\n label: string;\r\n suffix?: string;\r\n prefix?: string;\r\n locale?: string;\r\n padZeros?: boolean;\r\n precision?: number;\r\n }\r\n | ReactElement;\r\n radius: number;\r\n colors: string[];\r\n subNote?: string;\r\n strokeWidth: number;\r\n data: DonutChartDataType[];\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n onSeriesMouseOver?: (_d: any) => void;\r\n onSeriesMouseClick?: (_d: any) => void;\r\n colorDomain: string[];\r\n resetSelectionOnDoubleClick: boolean;\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n animate: AnimateDataType;\r\n trackColor: string;\r\n naLabel: string;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n mainText,\r\n data,\r\n radius,\r\n colors,\r\n subNote,\r\n strokeWidth,\r\n tooltip,\r\n onSeriesMouseOver,\r\n onSeriesMouseClick,\r\n colorDomain,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n animate,\r\n trackColor,\r\n naLabel,\r\n } = props;\r\n const svgRef = useRef(null);\r\n const isInView = useInView(svgRef, {\r\n once: animate.once,\r\n amount: animate.amount,\r\n });\r\n const pieData = pie()\r\n .sort(null)\r\n .startAngle(0)\r\n .value((d: any) => d.size);\r\n\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n\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 return (\r\n <>\r\n <motion.svg\r\n ref={svgRef}\r\n width={`${radius * 2}px`}\r\n height={`${radius * 2}px`}\r\n viewBox={`0 0 ${radius * 2} ${radius * 2}`}\r\n direction='ltr'\r\n className='mx-auto'\r\n >\r\n <motion.g transform={`translate(${radius} ${radius})`}>\r\n {mainText || subNote ? (\r\n <foreignObject\r\n y={0 - (radius - strokeWidth)}\r\n x={0 - (radius - strokeWidth)}\r\n width={2 * (radius - strokeWidth)}\r\n height={2 * (radius - strokeWidth)}\r\n >\r\n <div className='flex flex-col gap-0.5 justify-center items-center h-inherit py-0 px-4'>\r\n {mainText ? (\r\n isValidElement(mainText) ? (\r\n mainText\r\n ) : (\r\n <H2\r\n marginBottom='none'\r\n className='donut-main-text text-primary-gray-700 dark:text-primary-gray-100 leading-none text-center'\r\n >\r\n {typeof mainText === 'string'\r\n ? mainText\r\n : data.findIndex(d => d.label === mainText.label) !== -1\r\n ? numberFormattingFunction(\r\n data[data.findIndex(d => d.label === mainText.label)].size,\r\n naLabel,\r\n mainText.precision,\r\n mainText.prefix,\r\n mainText.suffix,\r\n mainText.locale,\r\n mainText.padZeros,\r\n )\r\n : naLabel}\r\n </H2>\r\n )\r\n ) : null}\r\n {subNote ? (\r\n <P\r\n marginBottom='none'\r\n size='base'\r\n leading='none'\r\n className='donut-sub-note text-primary-gray-700 dark:text-primary-gray-100 text-center font-bold'\r\n >\r\n {subNote}\r\n </P>\r\n ) : typeof mainText === 'string' || !mainText || isValidElement(mainText) ? null : (\r\n <P\r\n size='base'\r\n marginBottom='none'\r\n leading='none'\r\n className='donut-label text-primary-gray-700 dark:text-primary-gray-100 text-center font-bold'\r\n >\r\n {mainText.label}\r\n </P>\r\n )}\r\n </div>\r\n </foreignObject>\r\n ) : null}\r\n <circle\r\n cx={0}\r\n cy={0}\r\n r={radius - strokeWidth / 2}\r\n fill='none'\r\n stroke={trackColor}\r\n strokeWidth={strokeWidth}\r\n />\r\n <AnimatePresence>\r\n {pieData(data as any).map((d, i) => (\r\n <motion.path\r\n key={i}\r\n variants={{\r\n initial: {\r\n pathLength: 0,\r\n d: getArc(\r\n 0,\r\n 0,\r\n radius - strokeWidth / 2,\r\n d.startAngle - Math.PI / 2,\r\n d.endAngle - Math.PI / 2,\r\n ),\r\n opacity: mouseOverData\r\n ? mouseOverData.label === (d.data as any).label\r\n ? 1\r\n : 0.3\r\n : 1,\r\n },\r\n whileInView: {\r\n pathLength: 1,\r\n d: getArc(\r\n 0,\r\n 0,\r\n radius - strokeWidth / 2,\r\n d.startAngle - Math.PI / 2,\r\n d.endAngle - Math.PI / 2,\r\n ),\r\n opacity: mouseOverData\r\n ? mouseOverData.label === (d.data as any).label\r\n ? 1\r\n : 0.3\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 style={{\r\n stroke:\r\n colorDomain.indexOf((d.data as any).label) !== -1\r\n ? colors[colorDomain.indexOf((d.data as any).label) % colors.length]\r\n : Colors.gray,\r\n strokeWidth,\r\n fill: 'none',\r\n }}\r\n onMouseEnter={event => {\r\n setMouseOverData(d.data);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.(d);\r\n }}\r\n onClick={() => {\r\n if (onSeriesMouseClick || detailsOnClick) {\r\n if (isEqual(mouseClickData, d.data) && resetSelectionOnDoubleClick) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n setMouseClickData(d.data);\r\n if (onSeriesMouseClick) onSeriesMouseClick(d.data);\r\n }\r\n }\r\n }}\r\n onMouseMove={event => {\r\n setMouseOverData(d.data);\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 />\r\n ))}\r\n </AnimatePresence>\r\n </motion.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 <DetailsModal\r\n body={detailsOnClick}\r\n data={mouseClickData}\r\n setData={setMouseClickData}\r\n className={classNames?.modal}\r\n />\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import { ReactElement, useEffect, useRef, useState } from 'react';\r\nimport { P } from '@undp/design-system-react/Typography';\r\nimport orderBy from 'lodash.orderby';\r\nimport { Spacer } from '@undp/design-system-react/Spacer';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport {\r\n DonutChartDataType,\r\n Languages,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n AnimateDataType,\r\n NumberFormatOptions,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { EmptyState } from '@/Components/Elements/EmptyState';\r\nimport { GraphArea, GraphContainer } from '@/Components/Elements/GraphContainer';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: DonutChartDataType[];\r\n\r\n // Titles, Labels, and Sources\r\n /** Title of the graph */\r\n graphTitle?: string | React.ReactNode;\r\n /** Description of the graph */\r\n graphDescription?: string | React.ReactNode;\r\n /** Footnote for the graph */\r\n footNote?: string | React.ReactNode;\r\n /** Source data for the graph */\r\n sources?: SourcesDataType[];\r\n /** Accessibility label */\r\n ariaLabel?: string;\r\n\r\n // Colors and Styling\r\n /** Array of colors for each segment */\r\n colors?: string[];\r\n /** Domain of colors for the graph */\r\n colorDomain?: 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 /** Radius of the donut chart */\r\n radius?: number;\r\n\r\n // Graph Parameters\r\n /** Toggle visibility of color scale. This is only applicable if the data props hae color parameter */\r\n showColorScale?: boolean;\r\n /** Max width of the color scale as a css property */\r\n colorScaleMaxWidth?: string;\r\n /** Stroke width of the arcs and circle of the donut */\r\n strokeWidth?: number;\r\n /** Sorting order for data. This is overwritten by labelOrder prop */\r\n sortData?: 'asc' | 'desc';\r\n /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\r\n /** Large text at the center of the donut chart. If the type is an object then the text is the value in the data for the label mentioned in the object */\r\n mainText?:\r\n | string\r\n | {\r\n label: string;\r\n suffix?: string;\r\n prefix?: string;\r\n locale?: string;\r\n padZeros?: boolean;\r\n precision?: number;\r\n }\r\n | ReactElement;\r\n /** Small text at the center of the donut chart */\r\n subNote?: string;\r\n /** Track color (i.e. the color of the donut chart's background) of the donut chart */\r\n trackColor?: string;\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 /** Configuration options for controlling number formatting, localization, prefixes/suffixes, precision, and zero padding. */\r\n numberDisplayOptions?: NumberFormatOptions;\r\n /** Defines how “NA” values should be displayed/labelled in the graph */\r\n naLabel?: string;\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 DonutChart(props: Props) {\r\n const {\r\n mainText,\r\n graphTitle,\r\n colors = Colors.light.categoricalColors.colors,\r\n sources,\r\n strokeWidth = 50,\r\n graphDescription,\r\n subNote,\r\n footNote,\r\n radius,\r\n data,\r\n showColorScale = true,\r\n padding,\r\n backgroundColor = false,\r\n tooltip,\r\n onSeriesMouseOver,\r\n graphID,\r\n onSeriesMouseClick,\r\n graphDownload = false,\r\n dataDownload = false,\r\n colorDomain,\r\n sortData,\r\n language = 'en',\r\n theme = 'light',\r\n width,\r\n height,\r\n minHeight = 0,\r\n relativeHeight,\r\n ariaLabel,\r\n resetSelectionOnDoubleClick = true,\r\n colorScaleMaxWidth,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n animate = false,\r\n trackColor = Colors.light.grays['gray-200'],\r\n naLabel = 'NA',\r\n numberDisplayOptions,\r\n } = props;\r\n\r\n const [graphRadius, setGraphRadius] = useState(0);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setGraphRadius(\r\n (Math.min(\r\n ...[entries[0].target.clientWidth || 620, entries[0].target.clientHeight || 480],\r\n ) || 420) / 2,\r\n );\r\n });\r\n if (graphDiv.current) {\r\n resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, []);\r\n\r\n const sortedData = sortData ? orderBy(data, ['size'], [sortData]) : data;\r\n\r\n return (\r\n <GraphContainer\r\n className={classNames?.graphContainer}\r\n style={styles?.graphContainer}\r\n id={graphID}\r\n ref={graphParentDiv}\r\n aria-label={ariaLabel}\r\n backgroundColor={backgroundColor}\r\n theme={theme}\r\n language={language}\r\n minHeight={minHeight}\r\n width={width}\r\n height={height}\r\n relativeHeight={relativeHeight}\r\n padding={padding}\r\n >\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 : 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 {showColorScale && data.length > 0 ? (\r\n <>\r\n <div\r\n className={cn(\r\n 'leading-0 flex mb-0 ml-auto mr-auto justify-center gap-x-3 gap-y-0 flex-wrap',\r\n classNames?.colorLegend,\r\n )}\r\n style={{ maxWidth: colorScaleMaxWidth }}\r\n aria-label='Color legend'\r\n >\r\n {sortedData.map((d, i) => (\r\n <div className='flex gap-2 items-center pb-3' key={i}>\r\n <div\r\n className='w-3 h-3 rounded-full'\r\n style={{\r\n backgroundColor:\r\n (colorDomain || sortedData.map(el => el.label)).indexOf(d.label) !== -1\r\n ? (colors || Colors[theme].categoricalColors.colors)[\r\n (colorDomain || sortedData.map(el => el.label)).indexOf(d.label) %\r\n (colors || Colors[theme].categoricalColors.colors).length\r\n ]\r\n : Colors.gray,\r\n }}\r\n />\r\n <P\r\n marginBottom='none'\r\n size='sm'\r\n className='text-primary-gray-700 dark:text-primary-gray-100'\r\n >\r\n {d.label}:{' '}\r\n <span className='font-bold' style={{ fontSize: 'inherit' }}>\r\n {numberFormattingFunction(\r\n d.size,\r\n naLabel,\r\n numberDisplayOptions?.precision,\r\n numberDisplayOptions?.prefix,\r\n numberDisplayOptions?.suffix,\r\n numberDisplayOptions?.locale,\r\n numberDisplayOptions?.padZeros,\r\n )}\r\n </span>\r\n </P>\r\n </div>\r\n ))}\r\n </div>\r\n <Spacer size='lg' />\r\n </>\r\n ) : null}\r\n <GraphArea ref={graphDiv}>\r\n {data.length === 0 && <EmptyState />}\r\n {graphRadius && data.length > 0 ? (\r\n <Graph\r\n mainText={mainText}\r\n data={sortedData}\r\n colors={colors}\r\n radius={radius || graphRadius}\r\n subNote={subNote}\r\n strokeWidth={strokeWidth}\r\n tooltip={tooltip}\r\n colorDomain={colorDomain || sortedData.map(d => d.label)}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n styles={styles}\r\n detailsOnClick={detailsOnClick}\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 trackColor={trackColor}\r\n naLabel={naLabel}\r\n />\r\n ) : null}\r\n </GraphArea>\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 </GraphContainer>\r\n );\r\n}\r\n"],"names":["pi","tau","descending","a","b","identity","d","pie","value","sortValues","sort","startAngle","constant","endAngle","padAngle","data","i","n","array","j","k","sum","index","arcs","a0","da","a1","p","pa","v","_","polarToCartesian","centerX","centerY","radius","angleInRadians","x","Math","cos","y","sin","getArc","startAngleInRadians","endAngleInRadians","start","end","abs","PI","largeArcFlag","join","Graph","props","$","_c","mainText","colors","subNote","strokeWidth","tooltip","onSeriesMouseOver","onSeriesMouseClick","colorDomain","resetSelectionOnDoubleClick","detailsOnClick","styles","classNames","animate","trackColor","naLabel","svgRef","useRef","t0","amount","once","isInView","useInView","pieData","_temp","mouseOverData","setMouseOverData","useState","undefined","mouseClickData","setMouseClickData","eventX","setEventX","eventY","setEventY","t1","motion","t2","t3","t4","t5","t6","t7","t8","t9","jsx","jsxs","isValidElement","H2","findIndex","d_1","label","numberFormattingFunction","size","precision","prefix","suffix","locale","padZeros","P","t10","t11","T0","AnimatePresence","t12","duration","d_2","initial","pathLength","opacity","whileInView","transition","stroke","indexOf","length","Colors","gray","fill","event","clientY","clientX","isEqual","event_0","t13","map","t14","t15","g","t16","svg","t17","Tooltip","t18","modal","DetailsModal","t19","Fragment","DonutChart","graphTitle","light","categoricalColors","sources","graphDescription","footNote","showColorScale","padding","backgroundColor","graphID","graphDownload","dataDownload","sortData","language","theme","width","height","minHeight","relativeHeight","ariaLabel","colorScaleMaxWidth","grays","numberDisplayOptions","graphRadius","setGraphRadius","graphDiv","graphParentDiv","useEffect","resizeObserver","ResizeObserver","entries","min","target","clientWidth","clientHeight","current","observe","disconnect","sortedData","orderBy","GraphContainer","graphContainer","GraphHeader","title","description","filter","cn","colorLegend","maxWidth","el","fontSize","Spacer","GraphArea","EmptyState","GraphFooter","footnote","source"],"mappings":"6yBASaA,GAAK,KAAK,GAEVC,GAAM,EAAID,GCXR,SAAAE,GAASC,EAAGC,EAAG,CAC5B,OAAOA,EAAID,EAAI,GAAKC,EAAID,EAAI,EAAIC,GAAKD,EAAI,EAAI,GAC/C,CCFe,SAAAE,GAASC,EAAG,CACzB,OAAOA,CACT,CCIe,SAAAC,IAAW,CACxB,IAAIC,EAAQH,G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vD,kBAAA7C,EACA,mBAAAC,EACA,4BAAAE,EACA,OAAAE,EACA,eAAAD,EACA,QACEG,IAAY,GACR,CAAEoD,SAAU,GAAK7C,KAAM,GAAMD,OAAQ,EAAA,EACrCN,GAAW,CAAEoD,SAAU,EAAG7C,KAAM,GAAMD,OAAQ,CAAA,EAEpD,WAAAL,GACA,QAAAC,EAAA,CAAiB,EAEjB,IAAA,EACN,EACCsF,GAAWE,EACV1D,EAAAA,kBAAAA,IAAC2G,GAAAA,YAAA,CACC,OAAQ,CAAEC,SAAU9I,GAAQ8I,SAAUC,OAAQ/I,GAAQ+I,MAAAA,EACtD,WAAY,CACVD,SAAU7I,GAAY6I,SACtBC,OAAQ9I,GAAY8I,MAAAA,EAEtB,QAAArD,EACA,SAAAE,EACA,MAAAU,CAAA,CAAa,EAEb,IAAA,EACN,CAEJ","x_google_ignoreList":[0,1,2,3]}
|
package/dist/DonutChart.js
CHANGED
|
@@ -1,40 +1,41 @@
|
|
|
1
|
-
import { c as pt, j as a
|
|
2
|
-
import { useRef as rt, useState as _, isValidElement as lt, useEffect as
|
|
3
|
-
import {
|
|
4
|
-
import { o as
|
|
5
|
-
import {
|
|
1
|
+
import { c as pt, j as a } from "./compiler-runtime-qHgugrLy.js";
|
|
2
|
+
import { useRef as rt, useState as _, isValidElement as lt, useEffect as dt } from "react";
|
|
3
|
+
import { H2 as ft, P as it } from "@undp/design-system-react/Typography";
|
|
4
|
+
import { o as gt } from "./index-BZQYSqar.js";
|
|
5
|
+
import { Spacer as ht } from "@undp/design-system-react/Spacer";
|
|
6
|
+
import { cn as xt } from "@undp/design-system-react/cn";
|
|
6
7
|
import { i as yt } from "./index-Bwrro8-q.js";
|
|
7
|
-
import { T as bt } from "./Tooltip-
|
|
8
|
+
import { T as bt } from "./Tooltip-DO56mY4b.js";
|
|
8
9
|
import { Colors as R } from "./Colors.js";
|
|
9
10
|
import { n as ut } from "./numberFormattingFunction-BUUV_luR.js";
|
|
10
|
-
import { D as vt } from "./DetailsModal-
|
|
11
|
+
import { D as vt } from "./DetailsModal-k-Me_U_T.js";
|
|
11
12
|
import { c as $, a as jt } from "./array-USo-Szhp.js";
|
|
12
|
-
import { m as nt } from "./proxy-
|
|
13
|
-
import { u as Mt } from "./use-in-view-
|
|
14
|
-
import { A as Dt } from "./index-
|
|
13
|
+
import { m as nt } from "./proxy-D31SA_aE.js";
|
|
14
|
+
import { u as Mt } from "./use-in-view-Co5SmzfT.js";
|
|
15
|
+
import { A as Dt } from "./index-CNUlPiEL.js";
|
|
15
16
|
import { GraphFooter as Ct } from "./GraphFooter.js";
|
|
16
17
|
import { GraphHeader as kt } from "./GraphHeader.js";
|
|
17
|
-
import { E as Nt } from "./EmptyState-
|
|
18
|
-
import { G as wt, a as At } from "./GraphContainer-
|
|
18
|
+
import { E as Nt } from "./EmptyState-prZ8OnEs.js";
|
|
19
|
+
import { G as wt, a as At } from "./GraphContainer-DcOM2CI6.js";
|
|
19
20
|
const Ot = Math.PI, at = 2 * Ot;
|
|
20
21
|
function St(c, t) {
|
|
21
22
|
return t < c ? -1 : t > c ? 1 : t >= c ? 0 : NaN;
|
|
22
23
|
}
|
|
23
|
-
function
|
|
24
|
+
function Pt(c) {
|
|
24
25
|
return c;
|
|
25
26
|
}
|
|
26
|
-
function
|
|
27
|
-
var c =
|
|
27
|
+
function zt() {
|
|
28
|
+
var c = Pt, t = St, o = null, l = $(0), n = $(at), h = $(0);
|
|
28
29
|
function r(e) {
|
|
29
|
-
var s, x = (e = jt(e)).length, u, k, N = 0, f = new Array(x), b = new Array(x), y = +l.apply(this, arguments), p = Math.min(at, Math.max(-at, n.apply(this, arguments) - y)), w, v = Math.min(Math.abs(p) / x, h.apply(this, arguments)),
|
|
30
|
+
var s, x = (e = jt(e)).length, u, k, N = 0, f = new Array(x), b = new Array(x), y = +l.apply(this, arguments), p = Math.min(at, Math.max(-at, n.apply(this, arguments) - y)), w, v = Math.min(Math.abs(p) / x, h.apply(this, arguments)), E = v * (p < 0 ? -1 : 1), d;
|
|
30
31
|
for (s = 0; s < x; ++s)
|
|
31
32
|
(d = b[f[s] = s] = +c(e[s], s, e)) > 0 && (N += d);
|
|
32
33
|
for (t != null ? f.sort(function(j, L) {
|
|
33
34
|
return t(b[j], b[L]);
|
|
34
35
|
}) : o != null && f.sort(function(j, L) {
|
|
35
36
|
return o(e[j], e[L]);
|
|
36
|
-
}), s = 0, k = N ? (p - x *
|
|
37
|
-
u = f[s], d = b[u], w = y + (d > 0 ? d * k : 0) +
|
|
37
|
+
}), s = 0, k = N ? (p - x * E) / N : 0; s < x; ++s, y = w)
|
|
38
|
+
u = f[s], d = b[u], w = y + (d > 0 ? d * k : 0) + E, b[u] = {
|
|
38
39
|
data: e[u],
|
|
39
40
|
index: s,
|
|
40
41
|
value: d,
|
|
@@ -66,7 +67,7 @@ function ct(c, t, o, l, n) {
|
|
|
66
67
|
const h = st(c, t, o, l), r = st(c, t, o, Math.abs(n - l) === 2 * Math.PI ? 0.999999 * n : n), e = n - l <= Math.PI ? "0" : "1";
|
|
67
68
|
return ["M", h.x, h.y, "A", o, o, 0, e, 1, r.x, r.y].join(" ");
|
|
68
69
|
}
|
|
69
|
-
function
|
|
70
|
+
function Et(c) {
|
|
70
71
|
const t = pt.c(59), {
|
|
71
72
|
mainText: o,
|
|
72
73
|
data: l,
|
|
@@ -85,22 +86,22 @@ function Pt(c) {
|
|
|
85
86
|
animate: p,
|
|
86
87
|
trackColor: w,
|
|
87
88
|
naLabel: v
|
|
88
|
-
} = c,
|
|
89
|
+
} = c, E = rt(null);
|
|
89
90
|
let d;
|
|
90
91
|
t[0] !== p.amount || t[1] !== p.once ? (d = {
|
|
91
92
|
once: p.once,
|
|
92
93
|
amount: p.amount
|
|
93
94
|
}, t[0] = p.amount, t[1] = p.once, t[2] = d) : d = t[2];
|
|
94
|
-
const j = Mt(
|
|
95
|
+
const j = Mt(E, d), L = zt().sort(null).startAngle(0).value(It), [g, T] = _(void 0), [A, O] = _(void 0), [B, J] = _(void 0), [F, K] = _(void 0), Q = nt, M = `${n * 2}px`, D = `${n * 2}px`, H = `0 0 ${n * 2} ${n * 2}`, ot = "ltr", tt = "mx-auto", S = nt, W = `translate(${n} ${n})`;
|
|
95
96
|
let I;
|
|
96
97
|
t[3] !== l || t[4] !== o || t[5] !== v || t[6] !== n || t[7] !== e || t[8] !== r ? (I = o || r ? /* @__PURE__ */ a.jsx("foreignObject", { y: 0 - (n - e), x: 0 - (n - e), width: 2 * (n - e), height: 2 * (n - e), children: /* @__PURE__ */ a.jsxs("div", { className: "flex flex-col gap-0.5 justify-center items-center h-inherit py-0 px-4", children: [
|
|
97
|
-
o ? lt(o) ? o : /* @__PURE__ */ a.jsx(
|
|
98
|
+
o ? lt(o) ? o : /* @__PURE__ */ a.jsx(ft, { marginBottom: "none", className: "donut-main-text text-primary-gray-700 dark:text-primary-gray-100 leading-none text-center", children: typeof o == "string" ? o : l.findIndex((m) => m.label === o.label) !== -1 ? ut(l[l.findIndex((m) => m.label === o.label)].size, v, o.precision, o.prefix, o.suffix, o.locale, o.padZeros) : v }) : null,
|
|
98
99
|
r ? /* @__PURE__ */ a.jsx(it, { marginBottom: "none", size: "base", leading: "none", className: "donut-sub-note text-primary-gray-700 dark:text-primary-gray-100 text-center font-bold", children: r }) : typeof o == "string" || !o || lt(o) ? null : /* @__PURE__ */ a.jsx(it, { size: "base", marginBottom: "none", leading: "none", className: "donut-label text-primary-gray-700 dark:text-primary-gray-100 text-center font-bold", children: o.label })
|
|
99
100
|
] }) }) : null, t[3] = l, t[4] = o, t[5] = v, t[6] = n, t[7] = e, t[8] = r, t[9] = I) : I = t[9];
|
|
100
101
|
const V = n - e / 2;
|
|
101
|
-
let
|
|
102
|
-
t[10] !== e || t[11] !== V || t[12] !== w ? (
|
|
103
|
-
const
|
|
102
|
+
let P;
|
|
103
|
+
t[10] !== e || t[11] !== V || t[12] !== w ? (P = /* @__PURE__ */ a.jsx("circle", { cx: 0, cy: 0, r: V, fill: "none", stroke: w, strokeWidth: e }), t[10] = e, t[11] = V, t[12] = w, t[13] = P) : P = t[13];
|
|
104
|
+
const z = Dt;
|
|
104
105
|
let i;
|
|
105
106
|
t[14] !== p.duration || t[15] !== k || t[16] !== h || t[17] !== f || t[18] !== j || t[19] !== A || t[20] !== g || t[21] !== u || t[22] !== x || t[23] !== n || t[24] !== N || t[25] !== O || t[26] !== e ? (i = (m, mt) => /* @__PURE__ */ a.jsx(nt.path, { variants: {
|
|
106
107
|
initial: {
|
|
@@ -136,15 +137,15 @@ function Pt(c) {
|
|
|
136
137
|
} }, mt), t[14] = p.duration, t[15] = k, t[16] = h, t[17] = f, t[18] = j, t[19] = A, t[20] = g, t[21] = u, t[22] = x, t[23] = n, t[24] = N, t[25] = O, t[26] = e, t[27] = i) : i = t[27];
|
|
137
138
|
const G = L(l).map(i);
|
|
138
139
|
let C;
|
|
139
|
-
t[28] !==
|
|
140
|
+
t[28] !== z || t[29] !== G ? (C = /* @__PURE__ */ a.jsx(z, { children: G }), t[28] = z, t[29] = G, t[30] = C) : C = t[30];
|
|
140
141
|
let X;
|
|
141
|
-
t[31] !==
|
|
142
|
+
t[31] !== P || t[32] !== C || t[33] !== S.g || t[34] !== W || t[35] !== I ? (X = /* @__PURE__ */ a.jsxs(S.g, { transform: W, children: [
|
|
142
143
|
I,
|
|
143
|
-
|
|
144
|
+
P,
|
|
144
145
|
C
|
|
145
|
-
] }), t[31] =
|
|
146
|
+
] }), t[31] = P, t[32] = C, t[33] = S.g, t[34] = W, t[35] = I, t[36] = X) : X = t[36];
|
|
146
147
|
let Y;
|
|
147
|
-
t[37] !== Q.svg || t[38] !== X || t[39] !== M || t[40] !== D || t[41] !==
|
|
148
|
+
t[37] !== Q.svg || t[38] !== X || t[39] !== M || t[40] !== D || t[41] !== H ? (Y = /* @__PURE__ */ a.jsx(Q.svg, { ref: E, width: M, height: D, viewBox: H, direction: ot, className: tt, children: X }), t[37] = Q.svg, t[38] = X, t[39] = M, t[40] = D, t[41] = H, t[42] = Y) : Y = t[42];
|
|
148
149
|
let Z;
|
|
149
150
|
t[43] !== y?.tooltip || t[44] !== B || t[45] !== F || t[46] !== g || t[47] !== b?.tooltip || t[48] !== s ? (Z = g && s && B && F ? /* @__PURE__ */ a.jsx(bt, { data: g, body: s, xPos: B, yPos: F, backgroundStyle: b?.tooltip, className: y?.tooltip }) : null, t[43] = y?.tooltip, t[44] = B, t[45] = F, t[46] = g, t[47] = b?.tooltip, t[48] = s, t[49] = Z) : Z = t[49];
|
|
150
151
|
let q;
|
|
@@ -159,7 +160,7 @@ function Pt(c) {
|
|
|
159
160
|
function It(c) {
|
|
160
161
|
return c.size;
|
|
161
162
|
}
|
|
162
|
-
function
|
|
163
|
+
function te(c) {
|
|
163
164
|
const {
|
|
164
165
|
mainText: t,
|
|
165
166
|
graphTitle: o,
|
|
@@ -179,7 +180,7 @@ function _t(c) {
|
|
|
179
180
|
graphID: p,
|
|
180
181
|
onSeriesMouseClick: w,
|
|
181
182
|
graphDownload: v = !1,
|
|
182
|
-
dataDownload:
|
|
183
|
+
dataDownload: E = !1,
|
|
183
184
|
colorDomain: d,
|
|
184
185
|
sortData: j,
|
|
185
186
|
language: L = "en",
|
|
@@ -194,32 +195,32 @@ function _t(c) {
|
|
|
194
195
|
detailsOnClick: Q,
|
|
195
196
|
styles: M,
|
|
196
197
|
classNames: D,
|
|
197
|
-
animate:
|
|
198
|
+
animate: H = !1,
|
|
198
199
|
trackColor: ot = R.light.grays["gray-200"],
|
|
199
200
|
naLabel: tt = "NA",
|
|
200
201
|
numberDisplayOptions: S
|
|
201
|
-
} = c, [
|
|
202
|
-
|
|
202
|
+
} = c, [W, I] = _(0), V = rt(null), P = rt(null);
|
|
203
|
+
dt(() => {
|
|
203
204
|
const i = new ResizeObserver((G) => {
|
|
204
205
|
I((Math.min(G[0].target.clientWidth || 620, G[0].target.clientHeight || 480) || 420) / 2);
|
|
205
206
|
});
|
|
206
207
|
return V.current && i.observe(V.current), () => i.disconnect();
|
|
207
208
|
}, []);
|
|
208
|
-
const
|
|
209
|
-
return /* @__PURE__ */ a.jsxs(wt, { className: D?.graphContainer, style: M?.graphContainer, id: p, ref:
|
|
210
|
-
o || r || v ||
|
|
209
|
+
const z = j ? gt(u, ["size"], [j]) : u;
|
|
210
|
+
return /* @__PURE__ */ a.jsxs(wt, { className: D?.graphContainer, style: M?.graphContainer, id: p, ref: P, "aria-label": J, backgroundColor: f, theme: g, language: L, minHeight: O, width: T, height: A, relativeHeight: B, padding: N, children: [
|
|
211
|
+
o || r || v || E ? /* @__PURE__ */ a.jsx(kt, { styles: {
|
|
211
212
|
title: M?.title,
|
|
212
213
|
description: M?.description
|
|
213
214
|
}, classNames: {
|
|
214
215
|
title: D?.title,
|
|
215
216
|
description: D?.description
|
|
216
|
-
}, graphTitle: o, graphDescription: r, width: T, graphDownload: v ?
|
|
217
|
+
}, graphTitle: o, graphDescription: r, width: T, graphDownload: v ? P : void 0, dataDownload: E ? u.map((i) => i.data).filter((i) => i !== void 0).length > 0 ? u.map((i) => i.data).filter((i) => i !== void 0) : u.filter((i) => i !== void 0) : null }) : null,
|
|
217
218
|
k && u.length > 0 ? /* @__PURE__ */ a.jsxs(a.Fragment, { children: [
|
|
218
|
-
/* @__PURE__ */ a.jsx("div", { className:
|
|
219
|
+
/* @__PURE__ */ a.jsx("div", { className: xt("leading-0 flex mb-0 ml-auto mr-auto justify-center gap-x-3 gap-y-0 flex-wrap", D?.colorLegend), style: {
|
|
219
220
|
maxWidth: K
|
|
220
|
-
}, "aria-label": "Color legend", children:
|
|
221
|
+
}, "aria-label": "Color legend", children: z.map((i, G) => /* @__PURE__ */ a.jsxs("div", { className: "flex gap-2 items-center pb-3", children: [
|
|
221
222
|
/* @__PURE__ */ a.jsx("div", { className: "w-3 h-3 rounded-full", style: {
|
|
222
|
-
backgroundColor: (d ||
|
|
223
|
+
backgroundColor: (d || z.map((C) => C.label)).indexOf(i.label) !== -1 ? (l || R[g].categoricalColors.colors)[(d || z.map((C) => C.label)).indexOf(i.label) % (l || R[g].categoricalColors.colors).length] : R.gray
|
|
223
224
|
} }),
|
|
224
225
|
/* @__PURE__ */ a.jsxs(it, { marginBottom: "none", size: "sm", className: "text-primary-gray-700 dark:text-primary-gray-100", children: [
|
|
225
226
|
i.label,
|
|
@@ -230,15 +231,15 @@ function _t(c) {
|
|
|
230
231
|
}, children: ut(i.size, tt, S?.precision, S?.prefix, S?.suffix, S?.locale, S?.padZeros) })
|
|
231
232
|
] })
|
|
232
233
|
] }, G)) }),
|
|
233
|
-
/* @__PURE__ */ a.jsx(
|
|
234
|
+
/* @__PURE__ */ a.jsx(ht, { size: "lg" })
|
|
234
235
|
] }) : null,
|
|
235
236
|
/* @__PURE__ */ a.jsxs(At, { ref: V, children: [
|
|
236
237
|
u.length === 0 && /* @__PURE__ */ a.jsx(Nt, {}),
|
|
237
|
-
|
|
238
|
+
W && u.length > 0 ? /* @__PURE__ */ a.jsx(Et, { mainText: t, data: z, colors: l, radius: x || W, subNote: e, strokeWidth: h, tooltip: b, colorDomain: d || z.map((i) => i.label), onSeriesMouseOver: y, onSeriesMouseClick: w, resetSelectionOnDoubleClick: F, styles: M, detailsOnClick: Q, animate: H === !0 ? {
|
|
238
239
|
duration: 0.5,
|
|
239
240
|
once: !0,
|
|
240
241
|
amount: 0.5
|
|
241
|
-
} :
|
|
242
|
+
} : H || {
|
|
242
243
|
duration: 0,
|
|
243
244
|
once: !0,
|
|
244
245
|
amount: 0
|
|
@@ -254,6 +255,6 @@ function _t(c) {
|
|
|
254
255
|
] });
|
|
255
256
|
}
|
|
256
257
|
export {
|
|
257
|
-
|
|
258
|
+
te as DonutChart
|
|
258
259
|
};
|
|
259
260
|
//# sourceMappingURL=DonutChart.js.map
|