@undp/data-viz 1.4.0 → 1.4.2
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.js +21 -21
- package/dist/BarGraph.cjs +1 -1
- package/dist/BarGraph.js +7 -7
- package/dist/BeeSwarmChart.cjs +1 -1
- package/dist/BeeSwarmChart.js +2 -2
- package/dist/BiVariateChoroplethMap.cjs +1 -1
- package/dist/BiVariateChoroplethMap.js +5 -5
- package/dist/BulletChart.cjs +1 -1
- package/dist/BulletChart.js +14 -14
- package/dist/ButterflyChart.cjs +1 -1
- package/dist/ButterflyChart.js +9 -9
- package/dist/ChoroplethMap.cjs +1 -1
- package/dist/ChoroplethMap.js +9 -9
- package/dist/CirclePackingGraph.cjs +1 -1
- package/dist/CirclePackingGraph.js +1 -1
- package/dist/CopyTextButton.cjs +7 -7
- package/dist/CopyTextButton.cjs.map +1 -1
- package/dist/CopyTextButton.js +4 -4
- package/dist/CopyTextButton.js.map +1 -1
- package/dist/DataCards.cjs +9 -9
- package/dist/DataCards.cjs.map +1 -1
- package/dist/DataCards.js +93 -93
- package/dist/DataCards.js.map +1 -1
- package/dist/DifferenceLineChart.cjs +1 -1
- package/dist/DifferenceLineChart.js +18 -18
- package/dist/DonutChart.cjs +1 -1
- package/dist/DonutChart.js +1 -1
- package/dist/DotDensityMap.cjs +1 -1
- package/dist/DotDensityMap.js +8 -8
- package/dist/{DropdownSelect-0I2QxaVy.cjs → DropdownSelect-BmE5JaeE.cjs} +6 -6
- package/dist/{DropdownSelect-0I2QxaVy.cjs.map → DropdownSelect-BmE5JaeE.cjs.map} +1 -1
- package/dist/{DropdownSelect-CDC9lEqU.js → DropdownSelect-CeHog_ih.js} +4 -4
- package/dist/{DropdownSelect-CDC9lEqU.js.map → DropdownSelect-CeHog_ih.js.map} +1 -1
- package/dist/DualAxisLineChart.cjs +1 -1
- package/dist/DualAxisLineChart.js +15 -15
- package/dist/DumbbellChart.cjs +1 -1
- package/dist/DumbbellChart.js +13 -13
- package/dist/GeoHubMap.cjs +1 -1
- package/dist/GeoHubMap.js +2 -2
- package/dist/GeoHubMapWithLayerSelection.cjs +1 -1
- package/dist/GeoHubMapWithLayerSelection.js +2 -2
- package/dist/{GraphEl-B6SoGRFW.cjs → GraphEl-B5gAX1IQ.cjs} +2 -2
- package/dist/{GraphEl-B6SoGRFW.cjs.map → GraphEl-B5gAX1IQ.cjs.map} +1 -1
- package/dist/{GraphEl-Cw2tDUb3.js → GraphEl-BdIyscdt.js} +3 -3
- package/dist/{GraphEl-Cw2tDUb3.js.map → GraphEl-BdIyscdt.js.map} +1 -1
- package/dist/GriddedGraphs.cjs +1 -1
- package/dist/GriddedGraphs.js +4 -4
- package/dist/GriddedGraphsFromConfig.cjs +1 -1
- package/dist/GriddedGraphsFromConfig.js +1 -1
- package/dist/HeatMap.cjs +1 -1
- package/dist/HeatMap.js +10 -10
- package/dist/Histogram.cjs +1 -1
- package/dist/Histogram.js +1 -1
- package/dist/LineChartWithConfidenceInterval.cjs +1 -1
- package/dist/LineChartWithConfidenceInterval.js +21 -21
- package/dist/{Modal-CUU6ZK3U.js → Modal-DVVwpKhP.js} +2 -2
- package/dist/{Modal-CUU6ZK3U.js.map → Modal-DVVwpKhP.js.map} +1 -1
- package/dist/{Modal-C_dl0EtQ.cjs → Modal-tXZlLE5s.cjs} +4 -4
- package/dist/{Modal-C_dl0EtQ.cjs.map → Modal-tXZlLE5s.cjs.map} +1 -1
- package/dist/MultiGraphDashboard.cjs +1 -1
- package/dist/MultiGraphDashboard.js +3 -3
- package/dist/MultiGraphDashboardFromConfig.cjs +1 -1
- package/dist/MultiGraphDashboardFromConfig.js +1 -1
- package/dist/MultiGraphDashboardWideToLongFormat.cjs +1 -1
- package/dist/MultiGraphDashboardWideToLongFormat.js +3 -3
- package/dist/MultiGraphDashboardWideToLongFormatFromConfig.cjs +1 -1
- package/dist/MultiGraphDashboardWideToLongFormatFromConfig.js +1 -1
- package/dist/MultiLineAltChart.cjs +1 -1
- package/dist/MultiLineAltChart.js +21 -21
- package/dist/MultiLineChart.cjs +1 -1
- package/dist/MultiLineChart.js +19 -19
- package/dist/ParetoChart.cjs +1 -1
- package/dist/ParetoChart.js +12 -12
- package/dist/PerformanceIntensiveMultiGraphDashboard.cjs +1 -1
- package/dist/PerformanceIntensiveMultiGraphDashboard.js +3 -3
- package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.cjs +1 -1
- package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.js +1 -1
- package/dist/PerformanceIntensiveScrollStory.cjs +1 -1
- package/dist/PerformanceIntensiveScrollStory.js +2 -2
- package/dist/RadarChart.cjs +1 -1
- package/dist/RadarChart.js +8 -8
- package/dist/{ReferenceLine-CuFMk0cI.cjs → ReferenceLine-CFVBBN__.cjs} +2 -2
- package/dist/{ReferenceLine-CuFMk0cI.cjs.map → ReferenceLine-CFVBBN__.cjs.map} +1 -1
- package/dist/{ReferenceLine-C1GpoG9d.js → ReferenceLine-CfAW3vKJ.js} +2 -2
- package/dist/{ReferenceLine-C1GpoG9d.js.map → ReferenceLine-CfAW3vKJ.js.map} +1 -1
- package/dist/{RegressionLine-BFwDCTUU.js → RegressionLine-mH7UKOPi.js} +3 -3
- package/dist/{RegressionLine-BFwDCTUU.js.map → RegressionLine-mH7UKOPi.js.map} +1 -1
- package/dist/{RegressionLine-7_rKTHN_.cjs → RegressionLine-xKdiJ8sw.cjs} +2 -2
- package/dist/{RegressionLine-7_rKTHN_.cjs.map → RegressionLine-xKdiJ8sw.cjs.map} +1 -1
- package/dist/SankeyChart.cjs +1 -1
- package/dist/SankeyChart.js +4 -4
- package/dist/ScatterPlot.cjs +1 -1
- package/dist/ScatterPlot.js +13 -13
- package/dist/ScrollStory.cjs +1 -1
- package/dist/ScrollStory.js +2 -2
- package/dist/SimpleLineChart.cjs +1 -1
- package/dist/SimpleLineChart.js +20 -20
- package/dist/SingleGraphDashboard.cjs +1 -1
- package/dist/SingleGraphDashboard.js +4 -4
- package/dist/SingleGraphDashboardFromConfig.cjs +1 -1
- package/dist/SingleGraphDashboardFromConfig.js +1 -1
- package/dist/SingleGraphDashboardGeoHubMapsFromConfig.cjs +1 -1
- package/dist/SingleGraphDashboardGeoHubMapsFromConfig.js +1 -1
- package/dist/SingleGraphDashboardThreeDGraphs.cjs +1 -1
- package/dist/SingleGraphDashboardThreeDGraphs.js +3 -3
- package/dist/SingleGraphDashboardThreeDGraphsFromConfig.cjs +1 -1
- package/dist/SingleGraphDashboardThreeDGraphsFromConfig.js +1 -1
- package/dist/SlopeChart.cjs +1 -1
- package/dist/SlopeChart.js +7 -7
- package/dist/StripChart.cjs +1 -1
- package/dist/StripChart.js +9 -9
- package/dist/ThreeDGlobe.cjs +1 -1
- package/dist/ThreeDGlobe.js +2 -2
- package/dist/TreeMapGraph.cjs +1 -1
- package/dist/TreeMapGraph.js +4 -4
- package/dist/UnitChart.cjs +1 -1
- package/dist/UnitChart.js +3 -3
- package/dist/{XAxesLabels-DQFo_z2R.js → XAxesLabels-CaV2q-6H.js} +2 -2
- package/dist/{XAxesLabels-DQFo_z2R.js.map → XAxesLabels-CaV2q-6H.js.map} +1 -1
- package/dist/{XAxesLabels-CJMQbfVy.cjs → XAxesLabels-OjBNl_lS.cjs} +2 -2
- package/dist/{XAxesLabels-CJMQbfVy.cjs.map → XAxesLabels-OjBNl_lS.cjs.map} +1 -1
- package/dist/{YAxesLabels-H5-002X5.js → YAxesLabels-CPGZjmZJ.js} +2 -2
- package/dist/{YAxesLabels-H5-002X5.js.map → YAxesLabels-CPGZjmZJ.js.map} +1 -1
- package/dist/{YAxesLabels-BXLTX7AI.cjs → YAxesLabels-D8IydyZj.cjs} +2 -2
- package/dist/{YAxesLabels-BXLTX7AI.cjs.map → YAxesLabels-D8IydyZj.cjs.map} +1 -1
- package/dist/{checkIfMultiple-Do4kADNr.cjs → checkIfMultiple-BXbHUCWM.cjs} +6 -6
- package/dist/{checkIfMultiple-Do4kADNr.cjs.map → checkIfMultiple-BXbHUCWM.cjs.map} +1 -1
- package/dist/{checkIfMultiple-CYp3vADF.js → checkIfMultiple-ChTJk2Tk.js} +5 -5
- package/dist/{checkIfMultiple-CYp3vADF.js.map → checkIfMultiple-ChTJk2Tk.js.map} +1 -1
- package/dist/{customArea-CaxScFmW.js → customArea-B-dWU0zZ.js} +2 -2
- package/dist/{customArea-CaxScFmW.js.map → customArea-B-dWU0zZ.js.map} +1 -1
- package/dist/{customArea-BYNyxAkm.cjs → customArea-CK768gCn.cjs} +2 -2
- package/dist/{customArea-BYNyxAkm.cjs.map → customArea-CK768gCn.cjs.map} +1 -1
- package/dist/{fetchAndParseData-Bcmr659B.js → fetchAndParseData-4gsYTy6_.js} +3 -3
- package/dist/fetchAndParseData-4gsYTy6_.js.map +1 -0
- package/dist/{fetchAndParseData-DmgQtB9n.cjs → fetchAndParseData-CQyVGCul.cjs} +6 -6
- package/dist/fetchAndParseData-CQyVGCul.cjs.map +1 -0
- package/dist/fetchAndParseData.cjs +1 -1
- package/dist/fetchAndParseData.js +1 -1
- package/dist/index-BW8iNx7E.cjs +10 -0
- package/dist/index-BW8iNx7E.cjs.map +1 -0
- package/dist/index-CNvov0eg.js +122 -0
- package/dist/index-CNvov0eg.js.map +1 -0
- package/dist/{index-D_n8aamX.cjs → index-CZLvTu6p.cjs} +2 -2
- package/dist/{index-D_n8aamX.cjs.map → index-CZLvTu6p.cjs.map} +1 -1
- package/dist/{index-n_RI8T0n.js → index-Cdcfp4nk.js} +2 -2
- package/dist/{index-n_RI8T0n.js.map → index-Cdcfp4nk.js.map} +1 -1
- package/dist/{index-BVnYktl4.js → index-DGAaLNu9.js} +2 -2
- package/dist/{index-BVnYktl4.js.map → index-DGAaLNu9.js.map} +1 -1
- package/dist/{index-CylX-pWB.cjs → index-DNj994Pv.cjs} +2 -2
- package/dist/{index-CylX-pWB.cjs.map → index-DNj994Pv.cjs.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +3 -3
- package/dist/proxy-BHRoeZgd.cjs +2 -0
- package/dist/proxy-BHRoeZgd.cjs.map +1 -0
- package/dist/{proxy-DJxJg1kD.js → proxy-CkpFesk1.js} +4123 -4075
- package/dist/proxy-CkpFesk1.js.map +1 -0
- package/dist/style.css +1 -1
- package/dist/transformData.cjs +1 -1
- package/dist/transformData.js +2 -2
- package/dist/{transformDataForGraphFromFile-D9G3ToQf.cjs → transformDataForGraphFromFile-B1A0AS-Z.cjs} +2 -2
- package/dist/{transformDataForGraphFromFile-D9G3ToQf.cjs.map → transformDataForGraphFromFile-B1A0AS-Z.cjs.map} +1 -1
- package/dist/{transformDataForGraphFromFile-CA0rw80A.js → transformDataForGraphFromFile-BCjsizvb.js} +2 -2
- package/dist/{transformDataForGraphFromFile-CA0rw80A.js.map → transformDataForGraphFromFile-BCjsizvb.js.map} +1 -1
- package/dist/{use-in-view-BCmzDU2O.cjs → use-in-view-sQJZ_xDO.cjs} +2 -2
- package/dist/use-in-view-sQJZ_xDO.cjs.map +1 -0
- package/dist/{use-in-view-BAHrBy6b.js → use-in-view-yS6jzJAp.js} +2 -2
- package/dist/use-in-view-yS6jzJAp.js.map +1 -0
- package/dist/x-BBpi7a_7-Dz2vKSfu.cjs +27 -0
- package/dist/x-BBpi7a_7-Dz2vKSfu.cjs.map +1 -0
- package/dist/x-BBpi7a_7-WVdj1j6r.js +106 -0
- package/dist/x-BBpi7a_7-WVdj1j6r.js.map +1 -0
- package/package.json +50 -51
- package/dist/fetchAndParseData-Bcmr659B.js.map +0 -1
- package/dist/fetchAndParseData-DmgQtB9n.cjs.map +0 -1
- package/dist/index-BxAUvrua.js +0 -120
- package/dist/index-BxAUvrua.js.map +0 -1
- package/dist/index-DVOJ7vxH.cjs +0 -10
- package/dist/index-DVOJ7vxH.cjs.map +0 -1
- package/dist/proxy-DJxJg1kD.js.map +0 -1
- package/dist/proxy-PQd2AItT.cjs +0 -2
- package/dist/proxy-PQd2AItT.cjs.map +0 -1
- package/dist/use-in-view-BAHrBy6b.js.map +0 -1
- package/dist/use-in-view-BCmzDU2O.cjs.map +0 -1
- package/dist/x-CnsEH4Ox-CGGXQl4M.cjs +0 -27
- package/dist/x-CnsEH4Ox-CGGXQl4M.cjs.map +0 -1
- package/dist/x-CnsEH4Ox-DDvAJndW.js +0 -101
- package/dist/x-CnsEH4Ox-DDvAJndW.js.map +0 -1
package/dist/RadarChart.js
CHANGED
|
@@ -2,22 +2,22 @@ import { j as a, m as E } from "./index-CHPV5EwG-BPSP-7Jg.js";
|
|
|
2
2
|
import { useRef as ut, useState as j, useEffect as kt } from "react";
|
|
3
3
|
import { u as pt } from "./index-CaAIPGZo.js";
|
|
4
4
|
import { i as jt } from "./index-27yTRcko.js";
|
|
5
|
-
import { X as It } from "./Modal-
|
|
5
|
+
import { X as It } from "./Modal-DVVwpKhP.js";
|
|
6
6
|
import { T as Ct } from "./Tooltip-DyM5snqx.js";
|
|
7
7
|
import { Colors as L } from "./Colors.js";
|
|
8
8
|
import { n as xt } from "./numberFormattingFunction-14YCbkN2.js";
|
|
9
9
|
import { s as Nt } from "./string2HTML-CWHGfz_d.js";
|
|
10
10
|
import { c as O } from "./checkIfNullOrUndefined-DmfiKkNw.js";
|
|
11
|
-
import { u as Pt } from "./use-in-view-BAHrBy6b.js";
|
|
12
11
|
import { a as ft } from "./linear-DUdu7l2G.js";
|
|
13
|
-
import { c as
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
12
|
+
import { c as Pt, l as St } from "./line-CPfhohvF.js";
|
|
13
|
+
import { u as Ot } from "./use-in-view-yS6jzJAp.js";
|
|
14
|
+
import { m as X } from "./proxy-CkpFesk1.js";
|
|
15
|
+
import { A as Tt } from "./index-CNvov0eg.js";
|
|
16
16
|
import { GraphFooter as $t } from "./GraphFooter.js";
|
|
17
17
|
import { GraphHeader as Dt } from "./GraphHeader.js";
|
|
18
18
|
import { E as Vt } from "./EmptyState-DdTp-Mdn.js";
|
|
19
19
|
import { ColorLegendWithMouseOver as Et } from "./ColorLegendWithMouseOver.js";
|
|
20
|
-
var Lt = _t(
|
|
20
|
+
var Lt = _t(Pt);
|
|
21
21
|
function gt(t) {
|
|
22
22
|
this._curve = t;
|
|
23
23
|
}
|
|
@@ -51,7 +51,7 @@ function At(t) {
|
|
|
51
51
|
}, t;
|
|
52
52
|
}
|
|
53
53
|
function Ht() {
|
|
54
|
-
return At(
|
|
54
|
+
return At(St().curve(Lt));
|
|
55
55
|
}
|
|
56
56
|
function et() {
|
|
57
57
|
}
|
|
@@ -217,7 +217,7 @@ function Ft(t) {
|
|
|
217
217
|
dimmedOpacity: g,
|
|
218
218
|
precision: C,
|
|
219
219
|
customLayers: U
|
|
220
|
-
} = t, J = ut(null), V =
|
|
220
|
+
} = t, J = ut(null), V = Ot(J, {
|
|
221
221
|
once: d.once,
|
|
222
222
|
amount: d.amount
|
|
223
223
|
}), w = q === "linear" ? Wt : Rt, b = {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const t=require("./index-CHPV5EwG-DDoeWRVt.cjs"),d=require("./proxy-
|
|
2
|
-
//# sourceMappingURL=ReferenceLine-
|
|
1
|
+
"use strict";const t=require("./index-CHPV5EwG-DDoeWRVt.cjs"),d=require("./proxy-BHRoeZgd.cjs");function c(y){const{text:a,x1:n,x2:r,y:e,classNames:s,styles:o,color:i,animate:l,isInView:x}=y;return a?t.jsxRuntimeExports.jsxs(d.motion.g,{exit:{opacity:0,transition:{duration:l?.duration||0}},variants:{initial:{opacity:0},whileInView:{opacity:1,transition:{duration:l?.duration||0}}},initial:"initial",animate:x?"whileInView":"initial",children:[t.jsxRuntimeExports.jsx("line",{className:t.mo("undp-ref-line",i?void 0:"stroke-primary-gray-700 dark:stroke-primary-gray-300",s?.line),style:{...i&&{stroke:i},...o?.line||{}},y1:e,y2:e,x1:n,x2:r}),t.jsxRuntimeExports.jsx("text",{x:r,y:e,style:{...i&&{fill:i},textAnchor:"end",...o?.text||{}},className:t.mo("text-xs font-bold",i?void 0:" fill-primary-gray-700 dark:fill-primary-gray-300",s?.text),dy:-5,children:a})]},`${n}-${r}-${e}`):null}function u(y){const{text:a,y1:n,y2:r,x:e,classNames:s,styles:o,color:i,textSide:l,animate:x,isInView:m}=y;return a?t.jsxRuntimeExports.jsxs(d.motion.g,{exit:{opacity:0,transition:{duration:x?.duration||0}},variants:{initial:{opacity:0},whileInView:{opacity:1,transition:{duration:x?.duration||0}}},initial:"initial",animate:m?"whileInView":"initial",children:[t.jsxRuntimeExports.jsx("line",{className:t.mo("undp-ref-line",i?void 0:"stroke-primary-gray-700 dark:stroke-primary-gray-300",s?.line),style:{...i&&{stroke:i},...o?.line||{}},y1:n,y2:r,x1:e,x2:e}),t.jsxRuntimeExports.jsx("text",{x:e,y:n,style:{...i&&{fill:i},textAnchor:l==="left"?"end":"start",...o?.text||{}},className:t.mo("text-xs font-bold",i?void 0:"fill-primary-gray-700 dark:fill-primary-gray-300",s?.text),dy:12.5,dx:l==="left"?-5:5,children:a})]},`${n}-${r}-${e}`):null}exports.RefLineX=u;exports.RefLineY=c;
|
|
2
|
+
//# sourceMappingURL=ReferenceLine-CFVBBN__.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReferenceLine-
|
|
1
|
+
{"version":3,"file":"ReferenceLine-CFVBBN__.cjs","sources":["../src/Components/Elements/ReferenceLine.tsx"],"sourcesContent":["import { cn } from '@undp/design-system-react/cn';\r\nimport { motion } from 'motion/react';\r\n\r\nimport { AnimateDataType } from '@/Types';\r\n\r\ninterface RefLineYProps {\r\n text?: string;\r\n color?: string;\r\n y: number;\r\n x1: number;\r\n x2: number;\r\n classNames?: {\r\n line?: string;\r\n text?: string;\r\n };\r\n styles?: {\r\n line?: React.CSSProperties;\r\n text?: React.CSSProperties;\r\n };\r\n animate?: AnimateDataType;\r\n isInView: boolean;\r\n}\r\n\r\nexport function RefLineY(props: RefLineYProps) {\r\n const { text, x1, x2, y, classNames, styles, color, animate, isInView } = props;\r\n if (!text) return null;\r\n return (\r\n <motion.g\r\n key={`${x1}-${x2}-${y}`}\r\n exit={{ opacity: 0, transition: { duration: animate?.duration || 0 } }}\r\n variants={{\r\n initial: {\r\n opacity: 0,\r\n },\r\n whileInView: {\r\n opacity: 1,\r\n transition: { duration: animate?.duration || 0 },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n >\r\n <line\r\n className={cn(\r\n 'undp-ref-line',\r\n !color ? 'stroke-primary-gray-700 dark:stroke-primary-gray-300' : undefined,\r\n classNames?.line,\r\n )}\r\n style={{\r\n ...(color && { stroke: color }),\r\n ...(styles?.line || {}),\r\n }}\r\n y1={y}\r\n y2={y}\r\n x1={x1}\r\n x2={x2}\r\n />\r\n <text\r\n x={x2}\r\n y={y}\r\n style={{\r\n ...(color && { fill: color }),\r\n textAnchor: 'end',\r\n ...(styles?.text || {}),\r\n }}\r\n className={cn(\r\n 'text-xs font-bold',\r\n !color ? ' fill-primary-gray-700 dark:fill-primary-gray-300' : undefined,\r\n classNames?.text,\r\n )}\r\n dy={-5}\r\n >\r\n {text}\r\n </text>\r\n </motion.g>\r\n );\r\n}\r\n\r\ninterface RefLineXProps {\r\n text?: string;\r\n color?: string;\r\n x: number;\r\n y1: number;\r\n y2: number;\r\n textSide: 'left' | 'right';\r\n classNames?: {\r\n line?: string;\r\n text?: string;\r\n };\r\n styles?: {\r\n line?: React.CSSProperties;\r\n text?: React.CSSProperties;\r\n };\r\n animate?: AnimateDataType;\r\n isInView: boolean;\r\n}\r\n\r\nexport function RefLineX(props: RefLineXProps) {\r\n const { text, y1, y2, x, classNames, styles, color, textSide, animate, isInView } = props;\r\n if (!text) return null;\r\n return (\r\n <motion.g\r\n key={`${y1}-${y2}-${x}`}\r\n exit={{ opacity: 0, transition: { duration: animate?.duration || 0 } }}\r\n variants={{\r\n initial: {\r\n opacity: 0,\r\n },\r\n whileInView: {\r\n opacity: 1,\r\n transition: { duration: animate?.duration || 0 },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n >\r\n <line\r\n className={cn(\r\n 'undp-ref-line',\r\n !color ? 'stroke-primary-gray-700 dark:stroke-primary-gray-300' : undefined,\r\n classNames?.line,\r\n )}\r\n style={{\r\n ...(color && { stroke: color }),\r\n ...(styles?.line || {}),\r\n }}\r\n y1={y1}\r\n y2={y2}\r\n x1={x}\r\n x2={x}\r\n />\r\n <text\r\n x={x}\r\n y={y1}\r\n style={{\r\n ...(color && { fill: color }),\r\n textAnchor: textSide === 'left' ? 'end' : 'start',\r\n ...(styles?.text || {}),\r\n }}\r\n className={cn(\r\n 'text-xs font-bold',\r\n !color ? 'fill-primary-gray-700 dark:fill-primary-gray-300' : undefined,\r\n classNames?.text,\r\n )}\r\n dy={12.5}\r\n dx={textSide === 'left' ? -5 : 5}\r\n >\r\n {text}\r\n </text>\r\n </motion.g>\r\n );\r\n}\r\n"],"names":["RefLineY","props","text","x1","x2","y","classNames","styles","color","animate","isInView","jsxs","motion","jsx","cn","RefLineX","y1","y2","x","textSide"],"mappings":"gGAuBO,SAASA,EAASC,EAAsB,CAC7C,KAAM,CAAE,KAAAC,EAAM,GAAAC,EAAI,GAAAC,EAAI,EAAAC,EAAG,WAAAC,EAAY,OAAAC,EAAQ,MAAAC,EAAO,QAAAC,EAAS,SAAAC,CAAA,EAAaT,EAC1E,OAAKC,EAEHS,EAAAA,kBAAAA,KAACC,EAAAA,OAAO,EAAP,CAEC,KAAM,CAAE,QAAS,EAAG,WAAY,CAAE,SAAUH,GAAS,UAAY,EAAE,EACnE,SAAU,CACR,QAAS,CACP,QAAS,CAAA,EAEX,YAAa,CACX,QAAS,EACT,WAAY,CAAE,SAAUA,GAAS,UAAY,CAAA,CAAE,CACjD,EAEF,QAAQ,UACR,QAASC,EAAW,cAAgB,UAEpC,SAAA,CAAAG,EAAAA,kBAAAA,IAAC,OAAA,CACC,UAAWC,EAAAA,GACT,gBACCN,EAAiE,OAAzD,uDACTF,GAAY,IAAA,EAEd,MAAO,CACL,GAAIE,GAAS,CAAE,OAAQA,CAAA,EACvB,GAAID,GAAQ,MAAQ,CAAA,CAAC,EAEvB,GAAIF,EACJ,GAAIA,EACJ,GAAAF,EACA,GAAAC,CAAA,CAAA,EAEFS,EAAAA,kBAAAA,IAAC,OAAA,CACC,EAAGT,EACH,EAAAC,EACA,MAAO,CACL,GAAIG,GAAS,CAAE,KAAMA,CAAA,EACrB,WAAY,MACZ,GAAID,GAAQ,MAAQ,CAAA,CAAC,EAEvB,UAAWO,EAAAA,GACT,oBACCN,EAA8D,OAAtD,oDACTF,GAAY,IAAA,EAEd,GAAI,GAEH,SAAAJ,CAAA,CAAA,CACH,CAAA,EA7CK,GAAGC,CAAE,IAAIC,CAAE,IAAIC,CAAC,EAAA,EAHP,IAmDpB,CAqBO,SAASU,EAASd,EAAsB,CAC7C,KAAM,CAAE,KAAAC,EAAM,GAAAc,EAAI,GAAAC,EAAI,EAAAC,EAAG,WAAAZ,EAAY,OAAAC,EAAQ,MAAAC,EAAO,SAAAW,EAAU,QAAAV,EAAS,SAAAC,CAAA,EAAaT,EACpF,OAAKC,EAEHS,EAAAA,kBAAAA,KAACC,EAAAA,OAAO,EAAP,CAEC,KAAM,CAAE,QAAS,EAAG,WAAY,CAAE,SAAUH,GAAS,UAAY,EAAE,EACnE,SAAU,CACR,QAAS,CACP,QAAS,CAAA,EAEX,YAAa,CACX,QAAS,EACT,WAAY,CAAE,SAAUA,GAAS,UAAY,CAAA,CAAE,CACjD,EAEF,QAAQ,UACR,QAASC,EAAW,cAAgB,UAEpC,SAAA,CAAAG,EAAAA,kBAAAA,IAAC,OAAA,CACC,UAAWC,EAAAA,GACT,gBACCN,EAAiE,OAAzD,uDACTF,GAAY,IAAA,EAEd,MAAO,CACL,GAAIE,GAAS,CAAE,OAAQA,CAAA,EACvB,GAAID,GAAQ,MAAQ,CAAA,CAAC,EAEvB,GAAAS,EACA,GAAAC,EACA,GAAIC,EACJ,GAAIA,CAAA,CAAA,EAENL,EAAAA,kBAAAA,IAAC,OAAA,CACC,EAAAK,EACA,EAAGF,EACH,MAAO,CACL,GAAIR,GAAS,CAAE,KAAMA,CAAA,EACrB,WAAYW,IAAa,OAAS,MAAQ,QAC1C,GAAIZ,GAAQ,MAAQ,CAAA,CAAC,EAEvB,UAAWO,EAAAA,GACT,oBACCN,EAA6D,OAArD,mDACTF,GAAY,IAAA,EAEd,GAAI,KACJ,GAAIa,IAAa,OAAS,GAAK,EAE9B,SAAAjB,CAAA,CAAA,CACH,CAAA,EA9CK,GAAGc,CAAE,IAAIC,CAAE,IAAIC,CAAC,EAAA,EAHP,IAoDpB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { j as r, m as x } from "./index-CHPV5EwG-BPSP-7Jg.js";
|
|
2
|
-
import { m } from "./proxy-
|
|
2
|
+
import { m } from "./proxy-CkpFesk1.js";
|
|
3
3
|
function u(d) {
|
|
4
4
|
const { text: n, x1: a, x2: e, y: t, classNames: l, styles: s, color: i, animate: o, isInView: y } = d;
|
|
5
5
|
return n ? /* @__PURE__ */ r.jsxs(
|
|
@@ -125,4 +125,4 @@ export {
|
|
|
125
125
|
u as R,
|
|
126
126
|
g as a
|
|
127
127
|
};
|
|
128
|
-
//# sourceMappingURL=ReferenceLine-
|
|
128
|
+
//# sourceMappingURL=ReferenceLine-CfAW3vKJ.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReferenceLine-
|
|
1
|
+
{"version":3,"file":"ReferenceLine-CfAW3vKJ.js","sources":["../src/Components/Elements/ReferenceLine.tsx"],"sourcesContent":["import { cn } from '@undp/design-system-react/cn';\r\nimport { motion } from 'motion/react';\r\n\r\nimport { AnimateDataType } from '@/Types';\r\n\r\ninterface RefLineYProps {\r\n text?: string;\r\n color?: string;\r\n y: number;\r\n x1: number;\r\n x2: number;\r\n classNames?: {\r\n line?: string;\r\n text?: string;\r\n };\r\n styles?: {\r\n line?: React.CSSProperties;\r\n text?: React.CSSProperties;\r\n };\r\n animate?: AnimateDataType;\r\n isInView: boolean;\r\n}\r\n\r\nexport function RefLineY(props: RefLineYProps) {\r\n const { text, x1, x2, y, classNames, styles, color, animate, isInView } = props;\r\n if (!text) return null;\r\n return (\r\n <motion.g\r\n key={`${x1}-${x2}-${y}`}\r\n exit={{ opacity: 0, transition: { duration: animate?.duration || 0 } }}\r\n variants={{\r\n initial: {\r\n opacity: 0,\r\n },\r\n whileInView: {\r\n opacity: 1,\r\n transition: { duration: animate?.duration || 0 },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n >\r\n <line\r\n className={cn(\r\n 'undp-ref-line',\r\n !color ? 'stroke-primary-gray-700 dark:stroke-primary-gray-300' : undefined,\r\n classNames?.line,\r\n )}\r\n style={{\r\n ...(color && { stroke: color }),\r\n ...(styles?.line || {}),\r\n }}\r\n y1={y}\r\n y2={y}\r\n x1={x1}\r\n x2={x2}\r\n />\r\n <text\r\n x={x2}\r\n y={y}\r\n style={{\r\n ...(color && { fill: color }),\r\n textAnchor: 'end',\r\n ...(styles?.text || {}),\r\n }}\r\n className={cn(\r\n 'text-xs font-bold',\r\n !color ? ' fill-primary-gray-700 dark:fill-primary-gray-300' : undefined,\r\n classNames?.text,\r\n )}\r\n dy={-5}\r\n >\r\n {text}\r\n </text>\r\n </motion.g>\r\n );\r\n}\r\n\r\ninterface RefLineXProps {\r\n text?: string;\r\n color?: string;\r\n x: number;\r\n y1: number;\r\n y2: number;\r\n textSide: 'left' | 'right';\r\n classNames?: {\r\n line?: string;\r\n text?: string;\r\n };\r\n styles?: {\r\n line?: React.CSSProperties;\r\n text?: React.CSSProperties;\r\n };\r\n animate?: AnimateDataType;\r\n isInView: boolean;\r\n}\r\n\r\nexport function RefLineX(props: RefLineXProps) {\r\n const { text, y1, y2, x, classNames, styles, color, textSide, animate, isInView } = props;\r\n if (!text) return null;\r\n return (\r\n <motion.g\r\n key={`${y1}-${y2}-${x}`}\r\n exit={{ opacity: 0, transition: { duration: animate?.duration || 0 } }}\r\n variants={{\r\n initial: {\r\n opacity: 0,\r\n },\r\n whileInView: {\r\n opacity: 1,\r\n transition: { duration: animate?.duration || 0 },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n >\r\n <line\r\n className={cn(\r\n 'undp-ref-line',\r\n !color ? 'stroke-primary-gray-700 dark:stroke-primary-gray-300' : undefined,\r\n classNames?.line,\r\n )}\r\n style={{\r\n ...(color && { stroke: color }),\r\n ...(styles?.line || {}),\r\n }}\r\n y1={y1}\r\n y2={y2}\r\n x1={x}\r\n x2={x}\r\n />\r\n <text\r\n x={x}\r\n y={y1}\r\n style={{\r\n ...(color && { fill: color }),\r\n textAnchor: textSide === 'left' ? 'end' : 'start',\r\n ...(styles?.text || {}),\r\n }}\r\n className={cn(\r\n 'text-xs font-bold',\r\n !color ? 'fill-primary-gray-700 dark:fill-primary-gray-300' : undefined,\r\n classNames?.text,\r\n )}\r\n dy={12.5}\r\n dx={textSide === 'left' ? -5 : 5}\r\n >\r\n {text}\r\n </text>\r\n </motion.g>\r\n );\r\n}\r\n"],"names":["RefLineY","props","text","x1","x2","y","classNames","styles","color","animate","isInView","jsxs","motion","jsx","cn","RefLineX","y1","y2","x","textSide"],"mappings":";;AAuBO,SAASA,EAASC,GAAsB;AAC7C,QAAM,EAAE,MAAAC,GAAM,IAAAC,GAAI,IAAAC,GAAI,GAAAC,GAAG,YAAAC,GAAY,QAAAC,GAAQ,OAAAC,GAAO,SAAAC,GAAS,UAAAC,EAAA,IAAaT;AAC1E,SAAKC,IAEHS,gBAAAA,EAAAA;AAAAA,IAACC,EAAO;AAAA,IAAP;AAAA,MAEC,MAAM,EAAE,SAAS,GAAG,YAAY,EAAE,UAAUH,GAAS,YAAY,IAAE;AAAA,MACnE,UAAU;AAAA,QACR,SAAS;AAAA,UACP,SAAS;AAAA,QAAA;AAAA,QAEX,aAAa;AAAA,UACX,SAAS;AAAA,UACT,YAAY,EAAE,UAAUA,GAAS,YAAY,EAAA;AAAA,QAAE;AAAA,MACjD;AAAA,MAEF,SAAQ;AAAA,MACR,SAASC,IAAW,gBAAgB;AAAA,MAEpC,UAAA;AAAA,QAAAG,gBAAAA,EAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAWC;AAAAA,cACT;AAAA,cACCN,IAAiE,SAAzD;AAAA,cACTF,GAAY;AAAA,YAAA;AAAA,YAEd,OAAO;AAAA,cACL,GAAIE,KAAS,EAAE,QAAQA,EAAA;AAAA,cACvB,GAAID,GAAQ,QAAQ,CAAA;AAAA,YAAC;AAAA,YAEvB,IAAIF;AAAA,YACJ,IAAIA;AAAA,YACJ,IAAAF;AAAA,YACA,IAAAC;AAAA,UAAA;AAAA,QAAA;AAAA,QAEFS,gBAAAA,EAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACC,GAAGT;AAAA,YACH,GAAAC;AAAA,YACA,OAAO;AAAA,cACL,GAAIG,KAAS,EAAE,MAAMA,EAAA;AAAA,cACrB,YAAY;AAAA,cACZ,GAAID,GAAQ,QAAQ,CAAA;AAAA,YAAC;AAAA,YAEvB,WAAWO;AAAAA,cACT;AAAA,cACCN,IAA8D,SAAtD;AAAA,cACTF,GAAY;AAAA,YAAA;AAAA,YAEd,IAAI;AAAA,YAEH,UAAAJ;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,IA7CK,GAAGC,CAAE,IAAIC,CAAE,IAAIC,CAAC;AAAA,EAAA,IAHP;AAmDpB;AAqBO,SAASU,EAASd,GAAsB;AAC7C,QAAM,EAAE,MAAAC,GAAM,IAAAc,GAAI,IAAAC,GAAI,GAAAC,GAAG,YAAAZ,GAAY,QAAAC,GAAQ,OAAAC,GAAO,UAAAW,GAAU,SAAAV,GAAS,UAAAC,EAAA,IAAaT;AACpF,SAAKC,IAEHS,gBAAAA,EAAAA;AAAAA,IAACC,EAAO;AAAA,IAAP;AAAA,MAEC,MAAM,EAAE,SAAS,GAAG,YAAY,EAAE,UAAUH,GAAS,YAAY,IAAE;AAAA,MACnE,UAAU;AAAA,QACR,SAAS;AAAA,UACP,SAAS;AAAA,QAAA;AAAA,QAEX,aAAa;AAAA,UACX,SAAS;AAAA,UACT,YAAY,EAAE,UAAUA,GAAS,YAAY,EAAA;AAAA,QAAE;AAAA,MACjD;AAAA,MAEF,SAAQ;AAAA,MACR,SAASC,IAAW,gBAAgB;AAAA,MAEpC,UAAA;AAAA,QAAAG,gBAAAA,EAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAWC;AAAAA,cACT;AAAA,cACCN,IAAiE,SAAzD;AAAA,cACTF,GAAY;AAAA,YAAA;AAAA,YAEd,OAAO;AAAA,cACL,GAAIE,KAAS,EAAE,QAAQA,EAAA;AAAA,cACvB,GAAID,GAAQ,QAAQ,CAAA;AAAA,YAAC;AAAA,YAEvB,IAAAS;AAAA,YACA,IAAAC;AAAA,YACA,IAAIC;AAAA,YACJ,IAAIA;AAAA,UAAA;AAAA,QAAA;AAAA,QAENL,gBAAAA,EAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACC,GAAAK;AAAA,YACA,GAAGF;AAAA,YACH,OAAO;AAAA,cACL,GAAIR,KAAS,EAAE,MAAMA,EAAA;AAAA,cACrB,YAAYW,MAAa,SAAS,QAAQ;AAAA,cAC1C,GAAIZ,GAAQ,QAAQ,CAAA;AAAA,YAAC;AAAA,YAEvB,WAAWO;AAAAA,cACT;AAAA,cACCN,IAA6D,SAArD;AAAA,cACTF,GAAY;AAAA,YAAA;AAAA,YAEd,IAAI;AAAA,YACJ,IAAIa,MAAa,SAAS,KAAK;AAAA,YAE9B,UAAAjB;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,IA9CK,GAAGc,CAAE,IAAIC,CAAE,IAAIC,CAAC;AAAA,EAAA,IAHP;AAoDpB;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { j as i, m as x } from "./index-CHPV5EwG-BPSP-7Jg.js";
|
|
2
2
|
import { g } from "./generateRandomString-za3IQGfQ.js";
|
|
3
|
-
import { A as y } from "./index-
|
|
4
|
-
import { m as u } from "./proxy-
|
|
3
|
+
import { A as y } from "./index-CNvov0eg.js";
|
|
4
|
+
import { m as u } from "./proxy-CkpFesk1.js";
|
|
5
5
|
function R(s) {
|
|
6
6
|
const { color: t, x1: r, x2: o, y1: n, y2: l, className: m, style: d, animate: e, isInView: c, graphWidth: h, graphHeight: p } = s, a = g(8);
|
|
7
7
|
return /* @__PURE__ */ i.jsxs("g", { children: [
|
|
@@ -45,4 +45,4 @@ function R(s) {
|
|
|
45
45
|
export {
|
|
46
46
|
R
|
|
47
47
|
};
|
|
48
|
-
//# sourceMappingURL=RegressionLine-
|
|
48
|
+
//# sourceMappingURL=RegressionLine-mH7UKOPi.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RegressionLine-
|
|
1
|
+
{"version":3,"file":"RegressionLine-mH7UKOPi.js","sources":["../src/Components/Elements/RegressionLine.tsx"],"sourcesContent":["import { cn } from '@undp/design-system-react/cn';\r\nimport { AnimatePresence, motion } from 'motion/react';\r\n\r\nimport { AnimateDataType } from '@/Types';\r\nimport { generateRandomString } from '@/Utils/generateRandomString';\r\n\r\ninterface Props {\r\n color?: string;\r\n y1: number;\r\n y2: number;\r\n x1: number;\r\n x2: number;\r\n graphWidth: number;\r\n graphHeight: number;\r\n className?: string;\r\n style?: React.CSSProperties;\r\n animate: AnimateDataType;\r\n isInView: boolean;\r\n}\r\n\r\nexport function RegressionLine(props: Props) {\r\n const { color, x1, x2, y1, y2, className, style, animate, isInView, graphWidth, graphHeight } =\r\n props;\r\n const id = generateRandomString(8);\r\n return (\r\n <g>\r\n <defs>\r\n <clipPath id={id}>\r\n <rect x='0' y='0' width={graphWidth} height={graphHeight} />\r\n </clipPath>\r\n </defs>\r\n <AnimatePresence>\r\n <motion.line\r\n clipPath={`url(#${id})`}\r\n className={cn(\r\n 'undp-ref-line',\r\n !color ? 'stroke-primary-gray-700 dark:stroke-primary-gray-300' : undefined,\r\n className,\r\n )}\r\n style={{\r\n ...(color && { stroke: color }),\r\n fill: 'none',\r\n ...(style || {}),\r\n }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: {\r\n y1,\r\n y2: y1,\r\n x1,\r\n x2: x1,\r\n },\r\n whileInView: {\r\n y1,\r\n y2,\r\n x1,\r\n x2,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n </AnimatePresence>\r\n </g>\r\n );\r\n}\r\n"],"names":["RegressionLine","props","color","x1","x2","y1","y2","className","style","animate","isInView","graphWidth","graphHeight","id","generateRandomString","jsx","AnimatePresence","motion","cn"],"mappings":";;;;AAoBO,SAASA,EAAeC,GAAc;AAC3C,QAAM,EAAE,OAAAC,GAAO,IAAAC,GAAI,IAAAC,GAAI,IAAAC,GAAI,IAAAC,GAAI,WAAAC,GAAW,OAAAC,GAAO,SAAAC,GAAS,UAAAC,GAAU,YAAAC,GAAY,aAAAC,EAAA,IAC9EX,GACIY,IAAKC,EAAqB,CAAC;AACjC,gCACG,KAAA,EACC,UAAA;AAAA,IAAAC,gBAAAA,MAAC,QAAA,EACC,UAAAA,gBAAAA,EAAAA,IAAC,YAAA,EAAS,IAAAF,GACR,gCAAC,QAAA,EAAK,GAAE,KAAI,GAAE,KAAI,OAAOF,GAAY,QAAQC,EAAA,CAAa,GAC5D,GACF;AAAA,0BACCI,GAAA,EACC,UAAAD,gBAAAA,EAAAA;AAAAA,MAACE,EAAO;AAAA,MAAP;AAAA,QACC,UAAU,QAAQJ,CAAE;AAAA,QACpB,WAAWK;AAAAA,UACT;AAAA,UACChB,IAAiE,SAAzD;AAAA,UACTK;AAAA,QAAA;AAAA,QAEF,OAAO;AAAA,UACL,GAAIL,KAAS,EAAE,QAAQA,EAAA;AAAA,UACvB,MAAM;AAAA,UACN,GAAIM,KAAS,CAAA;AAAA,QAAC;AAAA,QAEhB,MAAM,EAAE,SAAS,GAAG,YAAY,EAAE,UAAUC,EAAQ,WAAS;AAAA,QAC7D,UAAU;AAAA,UACR,SAAS;AAAA,YACP,IAAAJ;AAAA,YACA,IAAIA;AAAA,YACJ,IAAAF;AAAA,YACA,IAAIA;AAAA,UAAA;AAAA,UAEN,aAAa;AAAA,YACX,IAAAE;AAAA,YACA,IAAAC;AAAA,YACA,IAAAH;AAAA,YACA,IAAAC;AAAA,YACA,YAAY,EAAE,UAAUK,EAAQ,SAAA;AAAA,UAAS;AAAA,QAC3C;AAAA,QAEF,SAAQ;AAAA,QACR,SAASC,IAAW,gBAAgB;AAAA,MAAA;AAAA,IAAA,EACtC,CACF;AAAA,EAAA,GACF;AAEJ;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const i=require("./index-CHPV5EwG-DDoeWRVt.cjs"),h=require("./generateRandomString-B5zBiJzS.cjs"),p=require("./index-
|
|
2
|
-
//# sourceMappingURL=RegressionLine-
|
|
1
|
+
"use strict";const i=require("./index-CHPV5EwG-DDoeWRVt.cjs"),h=require("./generateRandomString-B5zBiJzS.cjs"),p=require("./index-BW8iNx7E.cjs"),g=require("./proxy-BHRoeZgd.cjs");function j(a){const{color:e,x1:n,x2:o,y1:t,y2:x,className:l,style:c,animate:r,isInView:d,graphWidth:u,graphHeight:m}=a,s=h.generateRandomString(8);return i.jsxRuntimeExports.jsxs("g",{children:[i.jsxRuntimeExports.jsx("defs",{children:i.jsxRuntimeExports.jsx("clipPath",{id:s,children:i.jsxRuntimeExports.jsx("rect",{x:"0",y:"0",width:u,height:m})})}),i.jsxRuntimeExports.jsx(p.AnimatePresence,{children:i.jsxRuntimeExports.jsx(g.motion.line,{clipPath:`url(#${s})`,className:i.mo("undp-ref-line",e?void 0:"stroke-primary-gray-700 dark:stroke-primary-gray-300",l),style:{...e&&{stroke:e},fill:"none",...c||{}},exit:{opacity:0,transition:{duration:r.duration}},variants:{initial:{y1:t,y2:t,x1:n,x2:n},whileInView:{y1:t,y2:x,x1:n,x2:o,transition:{duration:r.duration}}},initial:"initial",animate:d?"whileInView":"initial"})})]})}exports.RegressionLine=j;
|
|
2
|
+
//# sourceMappingURL=RegressionLine-xKdiJ8sw.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RegressionLine-
|
|
1
|
+
{"version":3,"file":"RegressionLine-xKdiJ8sw.cjs","sources":["../src/Components/Elements/RegressionLine.tsx"],"sourcesContent":["import { cn } from '@undp/design-system-react/cn';\r\nimport { AnimatePresence, motion } from 'motion/react';\r\n\r\nimport { AnimateDataType } from '@/Types';\r\nimport { generateRandomString } from '@/Utils/generateRandomString';\r\n\r\ninterface Props {\r\n color?: string;\r\n y1: number;\r\n y2: number;\r\n x1: number;\r\n x2: number;\r\n graphWidth: number;\r\n graphHeight: number;\r\n className?: string;\r\n style?: React.CSSProperties;\r\n animate: AnimateDataType;\r\n isInView: boolean;\r\n}\r\n\r\nexport function RegressionLine(props: Props) {\r\n const { color, x1, x2, y1, y2, className, style, animate, isInView, graphWidth, graphHeight } =\r\n props;\r\n const id = generateRandomString(8);\r\n return (\r\n <g>\r\n <defs>\r\n <clipPath id={id}>\r\n <rect x='0' y='0' width={graphWidth} height={graphHeight} />\r\n </clipPath>\r\n </defs>\r\n <AnimatePresence>\r\n <motion.line\r\n clipPath={`url(#${id})`}\r\n className={cn(\r\n 'undp-ref-line',\r\n !color ? 'stroke-primary-gray-700 dark:stroke-primary-gray-300' : undefined,\r\n className,\r\n )}\r\n style={{\r\n ...(color && { stroke: color }),\r\n fill: 'none',\r\n ...(style || {}),\r\n }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: {\r\n y1,\r\n y2: y1,\r\n x1,\r\n x2: x1,\r\n },\r\n whileInView: {\r\n y1,\r\n y2,\r\n x1,\r\n x2,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n </AnimatePresence>\r\n </g>\r\n );\r\n}\r\n"],"names":["RegressionLine","props","color","x1","x2","y1","y2","className","style","animate","isInView","graphWidth","graphHeight","id","generateRandomString","jsx","AnimatePresence","motion","cn"],"mappings":"mLAoBO,SAASA,EAAeC,EAAc,CAC3C,KAAM,CAAE,MAAAC,EAAO,GAAAC,EAAI,GAAAC,EAAI,GAAAC,EAAI,GAAAC,EAAI,UAAAC,EAAW,MAAAC,EAAO,QAAAC,EAAS,SAAAC,EAAU,WAAAC,EAAY,YAAAC,CAAA,EAC9EX,EACIY,EAAKC,EAAAA,qBAAqB,CAAC,EACjC,gCACG,IAAA,CACC,SAAA,CAAAC,wBAAC,OAAA,CACC,SAAAA,EAAAA,kBAAAA,IAAC,WAAA,CAAS,GAAAF,EACR,iCAAC,OAAA,CAAK,EAAE,IAAI,EAAE,IAAI,MAAOF,EAAY,OAAQC,CAAA,CAAa,EAC5D,EACF,0BACCI,EAAAA,gBAAA,CACC,SAAAD,EAAAA,kBAAAA,IAACE,EAAAA,OAAO,KAAP,CACC,SAAU,QAAQJ,CAAE,IACpB,UAAWK,EAAAA,GACT,gBACChB,EAAiE,OAAzD,uDACTK,CAAA,EAEF,MAAO,CACL,GAAIL,GAAS,CAAE,OAAQA,CAAA,EACvB,KAAM,OACN,GAAIM,GAAS,CAAA,CAAC,EAEhB,KAAM,CAAE,QAAS,EAAG,WAAY,CAAE,SAAUC,EAAQ,SAAS,EAC7D,SAAU,CACR,QAAS,CACP,GAAAJ,EACA,GAAIA,EACJ,GAAAF,EACA,GAAIA,CAAA,EAEN,YAAa,CACX,GAAAE,EACA,GAAAC,EACA,GAAAH,EACA,GAAAC,EACA,WAAY,CAAE,SAAUK,EAAQ,QAAA,CAAS,CAC3C,EAEF,QAAQ,UACR,QAASC,EAAW,cAAgB,SAAA,CAAA,CACtC,CACF,CAAA,EACF,CAEJ"}
|
package/dist/SankeyChart.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./index-CHPV5EwG-DDoeWRVt.cjs"),q=require("react"),ot=require("./index-CZbIGs8q.cjs"),ut=require("./index-BzeLQvXk.cjs"),Et=require("./index-C21TvELx.cjs"),Dt=require("./index-BXns0-ng.cjs"),Pt=require("./Modal-C_dl0EtQ.cjs"),ct=require("./Typography-k-kOjICQ.cjs"),Lt=require("./numberFormattingFunction-02t-wJta.cjs"),zt=require("./Tooltip-n8z5bfav.cjs"),It=require("./string2HTML-D2Avudmb.cjs"),Ht=require("./use-in-view-BCmzDU2O.cjs"),xt=require("./proxy-PQd2AItT.cjs"),At=require("./index-DVOJ7vxH.cjs"),Wt=require("./GraphHeader.cjs"),Gt=require("./GraphFooter.cjs"),Mt=require("./Colors.cjs"),Ft=require("./generateRandomString-B5zBiJzS.cjs"),Xt=require("./EmptyState-d8_8SxeW.cjs");function Rt(e,n){let i;if(n===void 0)for(const a of e)a!=null&&(i<a||i===void 0&&a>=a)&&(i=a);else{let a=-1;for(let l of e)(l=n(l,++a,e))!=null&&(i<l||i===void 0&&l>=l)&&(i=l)}return i}function Ot(e,n){let i;if(n===void 0)for(const a of e)a!=null&&(i>a||i===void 0&&a>=a)&&(i=a);else{let a=-1;for(let l of e)(l=n(l,++a,e))!=null&&(i>l||i===void 0&&l>=l)&&(i=l)}return i}function pt(e,n){let i=0;if(n===void 0)for(let a of e)(a=+a)&&(i+=a);else{let a=-1;for(let l of e)(l=+n(l,++a,e))&&(i+=l)}return i}function Yt(e){return e.target.depth}function Ut(e,n){return e.sourceLinks.length?e.depth:n-1}function mt(e){return e.targetLinks.length?e.depth:e.sourceLinks.length?Ot(e.sourceLinks,Yt)-1:0}function ft(e){return function(){return e}}function St(e,n){return ht(e.source,n.source)||e.index-n.index}function _t(e,n){return ht(e.target,n.target)||e.index-n.index}function ht(e,n){return e.y0-n.y0}function yt(e){return e.value}function Zt(e){return e.index}function Qt(e){return e.nodes}function Jt(e){return e.links}function Nt(e,n){const i=e.get(n);if(!i)throw new Error("missing: "+n);return i}function Ct({nodes:e}){for(const n of e){let i=n.y0,a=i;for(const l of n.sourceLinks)l.y0=i+l.width/2,i+=l.width;for(const l of n.targetLinks)l.y1=a+l.width/2,a+=l.width}}function vt(){let e=0,n=0,i=1,a=1,l=24,m=8,g,x=Zt,v=Ut,w,j,b=Qt,$=Jt,R=6;function d(){const t={nodes:b.apply(null,arguments),links:$.apply(null,arguments)};return S(t),L(t),V(t),X(t),A(t),Ct(t),t}d.update=function(t){return Ct(t),t},d.nodeId=function(t){return arguments.length?(x=typeof t=="function"?t:ft(t),d):x},d.nodeAlign=function(t){return arguments.length?(v=typeof t=="function"?t:ft(t),d):v},d.nodeSort=function(t){return arguments.length?(w=t,d):w},d.nodeWidth=function(t){return arguments.length?(l=+t,d):l},d.nodePadding=function(t){return arguments.length?(m=g=+t,d):m},d.nodes=function(t){return arguments.length?(b=typeof t=="function"?t:ft(t),d):b},d.links=function(t){return arguments.length?($=typeof t=="function"?t:ft(t),d):$},d.linkSort=function(t){return arguments.length?(j=t,d):j},d.size=function(t){return arguments.length?(e=n=0,i=+t[0],a=+t[1],d):[i-e,a-n]},d.extent=function(t){return arguments.length?(e=+t[0][0],i=+t[1][0],n=+t[0][1],a=+t[1][1],d):[[e,n],[i,a]]},d.iterations=function(t){return arguments.length?(R=+t,d):R};function S({nodes:t,links:u}){for(const[c,r]of t.entries())r.index=c,r.sourceLinks=[],r.targetLinks=[];const s=new Map(t.map((c,r)=>[x(c,r,t),c]));for(const[c,r]of u.entries()){r.index=c;let{source:f,target:p}=r;typeof f!="object"&&(f=r.source=Nt(s,f)),typeof p!="object"&&(p=r.target=Nt(s,p)),f.sourceLinks.push(r),p.targetLinks.push(r)}if(j!=null)for(const{sourceLinks:c,targetLinks:r}of t)c.sort(j),r.sort(j)}function L({nodes:t}){for(const u of t)u.value=u.fixedValue===void 0?Math.max(pt(u.sourceLinks,yt),pt(u.targetLinks,yt)):u.fixedValue}function V({nodes:t}){const u=t.length;let s=new Set(t),c=new Set,r=0;for(;s.size;){for(const f of s){f.depth=r;for(const{target:p}of f.sourceLinks)c.add(p)}if(++r>u)throw new Error("circular link");s=c,c=new Set}}function X({nodes:t}){const u=t.length;let s=new Set(t),c=new Set,r=0;for(;s.size;){for(const f of s){f.height=r;for(const{source:p}of f.targetLinks)c.add(p)}if(++r>u)throw new Error("circular link");s=c,c=new Set}}function B({nodes:t}){const u=Rt(t,r=>r.depth)+1,s=(i-e-l)/(u-1),c=new Array(u);for(const r of t){const f=Math.max(0,Math.min(u-1,Math.floor(v.call(null,r,u))));r.layer=f,r.x0=e+f*s,r.x1=r.x0+l,c[f]?c[f].push(r):c[f]=[r]}if(w)for(const r of c)r.sort(w);return c}function _(t){const u=Ot(t,s=>(a-n-(s.length-1)*g)/pt(s,yt));for(const s of t){let c=n;for(const r of s){r.y0=c,r.y1=c+r.value*u,c=r.y1+g;for(const f of r.sourceLinks)f.width=f.value*u}c=(a-c+g)/(s.length+1);for(let r=0;r<s.length;++r){const f=s[r];f.y0+=c*(r+1),f.y1+=c*(r+1)}P(s)}}function A(t){const u=B(t);g=Math.min(m,(a-n)/(Rt(u,s=>s.length)-1)),_(u);for(let s=0;s<R;++s){const c=Math.pow(.99,s),r=Math.max(1-c,(s+1)/R);tt(u,c,r),K(u,c,r)}}function K(t,u,s){for(let c=1,r=t.length;c<r;++c){const f=t[c];for(const p of f){let N=0,C=0;for(const{source:I,value:O}of p.targetLinks){let H=O*(p.layer-I.layer);N+=U(I,p)*H,C+=H}if(!(C>0))continue;let W=(N/C-p.y0)*u;p.y0+=W,p.y1+=W,T(p)}w===void 0&&f.sort(ht),D(f,s)}}function tt(t,u,s){for(let c=t.length,r=c-2;r>=0;--r){const f=t[r];for(const p of f){let N=0,C=0;for(const{target:I,value:O}of p.sourceLinks){let H=O*(I.layer-p.layer);N+=nt(p,I)*H,C+=H}if(!(C>0))continue;let W=(N/C-p.y0)*u;p.y0+=W,p.y1+=W,T(p)}w===void 0&&f.sort(ht),D(f,s)}}function D(t,u){const s=t.length>>1,c=t[s];et(t,c.y0-g,s-1,u),Y(t,c.y1+g,s+1,u),et(t,a,t.length-1,u),Y(t,n,0,u)}function Y(t,u,s,c){for(;s<t.length;++s){const r=t[s],f=(u-r.y0)*c;f>1e-6&&(r.y0+=f,r.y1+=f),u=r.y1+g}}function et(t,u,s,c){for(;s>=0;--s){const r=t[s],f=(r.y1-u)*c;f>1e-6&&(r.y0-=f,r.y1-=f),u=r.y0-g}}function T({sourceLinks:t,targetLinks:u}){if(j===void 0){for(const{source:{sourceLinks:s}}of u)s.sort(_t);for(const{target:{targetLinks:s}}of t)s.sort(St)}}function P(t){if(j===void 0)for(const{sourceLinks:u,targetLinks:s}of t)u.sort(_t),s.sort(St)}function U(t,u){let s=t.y0-(t.sourceLinks.length-1)*g/2;for(const{target:c,width:r}of t.sourceLinks){if(c===u)break;s+=r+g}for(const{source:c,width:r}of u.targetLinks){if(c===t)break;s-=r}return s}function nt(t,u){let s=u.y0-(u.targetLinks.length-1)*g/2;for(const{source:c,width:r}of u.targetLinks){if(c===t)break;s+=r+g}for(const{target:c,width:r}of t.sourceLinks){if(c===u)break;s-=r}return s}return d}var jt=Math.PI,kt=2*jt,J=1e-6,Kt=kt-J;function wt(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function qt(){return new wt}wt.prototype=qt.prototype={constructor:wt,moveTo:function(e,n){this._+="M"+(this._x0=this._x1=+e)+","+(this._y0=this._y1=+n)},closePath:function(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(e,n){this._+="L"+(this._x1=+e)+","+(this._y1=+n)},quadraticCurveTo:function(e,n,i,a){this._+="Q"+ +e+","+ +n+","+(this._x1=+i)+","+(this._y1=+a)},bezierCurveTo:function(e,n,i,a,l,m){this._+="C"+ +e+","+ +n+","+ +i+","+ +a+","+(this._x1=+l)+","+(this._y1=+m)},arcTo:function(e,n,i,a,l){e=+e,n=+n,i=+i,a=+a,l=+l;var m=this._x1,g=this._y1,x=i-e,v=a-n,w=m-e,j=g-n,b=w*w+j*j;if(l<0)throw new Error("negative radius: "+l);if(this._x1===null)this._+="M"+(this._x1=e)+","+(this._y1=n);else if(b>J)if(!(Math.abs(j*x-v*w)>J)||!l)this._+="L"+(this._x1=e)+","+(this._y1=n);else{var $=i-m,R=a-g,d=x*x+v*v,S=$*$+R*R,L=Math.sqrt(d),V=Math.sqrt(b),X=l*Math.tan((jt-Math.acos((d+b-S)/(2*L*V)))/2),B=X/V,_=X/L;Math.abs(B-1)>J&&(this._+="L"+(e+B*w)+","+(n+B*j)),this._+="A"+l+","+l+",0,0,"+ +(j*$>w*R)+","+(this._x1=e+_*x)+","+(this._y1=n+_*v)}},arc:function(e,n,i,a,l,m){e=+e,n=+n,i=+i,m=!!m;var g=i*Math.cos(a),x=i*Math.sin(a),v=e+g,w=n+x,j=1^m,b=m?a-l:l-a;if(i<0)throw new Error("negative radius: "+i);this._x1===null?this._+="M"+v+","+w:(Math.abs(this._x1-v)>J||Math.abs(this._y1-w)>J)&&(this._+="L"+v+","+w),i&&(b<0&&(b=b%kt+kt),b>Kt?this._+="A"+i+","+i+",0,1,"+j+","+(e-g)+","+(n-x)+"A"+i+","+i+",0,1,"+j+","+(this._x1=v)+","+(this._y1=w):b>J&&(this._+="A"+i+","+i+",0,"+ +(b>=jt)+","+j+","+(this._x1=e+i*Math.cos(l))+","+(this._y1=n+i*Math.sin(l))))},rect:function(e,n,i,a){this._+="M"+(this._x0=this._x1=+e)+","+(this._y0=this._y1=+n)+"h"+ +i+"v"+ +a+"h"+-i+"Z"},toString:function(){return this._}};function Tt(e){return function(){return e}}function te(e){return e[0]}function ee(e){return e[1]}var ne=Array.prototype.slice;function oe(e){return e.source}function ie(e){return e.target}function re(e){var n=oe,i=ie,a=te,l=ee,m=null;function g(){var x,v=ne.call(arguments),w=n.apply(this,v),j=i.apply(this,v);if(m||(m=x=qt()),e(m,+a.apply(this,(v[0]=w,v)),+l.apply(this,v),+a.apply(this,(v[0]=j,v)),+l.apply(this,v)),x)return m=null,x+""||null}return g.source=function(x){return arguments.length?(n=x,g):n},g.target=function(x){return arguments.length?(i=x,g):i},g.x=function(x){return arguments.length?(a=typeof x=="function"?x:Tt(+x),g):a},g.y=function(x){return arguments.length?(l=typeof x=="function"?x:Tt(+x),g):l},g.context=function(x){return arguments.length?(m=x??null,g):m},g}function se(e,n,i,a,l){e.moveTo(n,i),e.bezierCurveTo(n=(n+a)/2,i,n,l,a,l)}function ae(){return re(se)}function le(e){return[e.source.x1,e.y0]}function ue(e){return[e.target.x0,e.y1]}function ce(){return ae().source(le).target(ue)}function fe(e){const{data:n,showLabels:i,leftMargin:a,rightMargin:l,truncateBy:m,width:g,height:x,topMargin:v,bottomMargin:w,tooltip:j,onSeriesMouseOver:b,suffix:$,prefix:R,showValues:d,onSeriesMouseClick:S,nodePadding:L,nodeWidth:V,id:X,highlightedSourceDataPoints:B,highlightedTargetDataPoints:_,defaultLinkOpacity:A,sourceTitle:K,targetTitle:tt,animate:D,sortNodes:Y,resetSelectionOnDoubleClick:et,detailsOnClick:T,styles:P,classNames:U,precision:nt,customLayers:t}=e,u=q.useRef(null),s=Ht.useInView(u,{once:D.once,amount:D.amount}),[c,r]=q.useState(void 0),[f,p]=q.useState(void 0),[N,C]=q.useState(void 0),[W,I]=q.useState(void 0),[O,H]=q.useState(void 0),z={top:v,bottom:w,left:a,right:l},G=g-z.left-z.right,F=x-z.top-z.bottom,rt=Y==="mostReadable"?vt().nodeWidth(V).nodePadding(L).size([G,F]).nodeAlign(mt):Y==="none"?vt().nodeWidth(V).nodePadding(L).size([G,F]).nodeAlign(mt).nodeSort(()=>null).linkSort(()=>null):vt().nodeWidth(V).nodePadding(L).size([G,F]).nodeAlign(mt).nodeSort(Y==="desc"?(o,M)=>(M.value||0)-(o.value||0):(o,M)=>(o.value||0)-(M.value||0)),{nodes:st,links:at}=rt(n),Q=ce();return h.jsxRuntimeExports.jsxs(h.jsxRuntimeExports.Fragment,{children:[h.jsxRuntimeExports.jsxs(xt.motion.svg,{width:`${g}px`,height:`${x}px`,viewBox:`0 0 ${g} ${x}`,style:{marginLeft:"auto",marginRight:"auto"},direction:"ltr",ref:u,children:[K?h.jsxRuntimeExports.jsx("text",{x:z.left,y:z.top-10,className:"text-base font-bold fill-primary-gray-700 dark:fill-primary-gray-100",style:{textAnchor:"start"},children:K}):null,tt?h.jsxRuntimeExports.jsx("text",{x:g-z.right,y:z.top-10,className:"text-base font-bold fill-primary-gray-700 dark:fill-primary-gray-100",style:{textAnchor:"end"},children:tt}):null,h.jsxRuntimeExports.jsxs("g",{transform:`translate(${z.left},${z.top})`,children:[t.filter(o=>o.position==="before").map(o=>o.layer),st.filter(o=>o.type==="source").map((o,M)=>h.jsxRuntimeExports.jsx("g",{onMouseEnter:()=>{C(o)},onMouseLeave:()=>{C(void 0)},children:h.jsxRuntimeExports.jsxs("g",{transform:`translate(${o.x0},${o.y0})`,children:[h.jsxRuntimeExports.jsx("rect",{x:0,y:0,width:(o.x1||0)-(o.x0||0),height:(o.y1||0)-(o.y0||0),style:{fill:o.color}}),i||d?h.jsxRuntimeExports.jsx("foreignObject",{y:0-L/2,x:0-a,width:a,height:(o.y1||0)-(o.y0||0)+L,children:h.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-0.5 justify-center py-0 px-1.5",style:{height:`${(o.y1||0)-(o.y0||0)+L}px`,overflow:"visible"},children:[i?h.jsxRuntimeExports.jsx(ct.u,{marginBottom:d?"3xs":"none",size:"sm",leading:"none",className:h.mo("sankey-right-label text-right",U?.graphObjectValues),style:{hyphens:"auto",color:o.color,...P?.graphObjectValues},children:`${o.label}`.length<m?`${o.label}`:`${`${o.label}`.substring(0,m)}...`}):null,d?h.jsxRuntimeExports.jsx(ct.u,{marginBottom:"none",size:"sm",leading:"none",className:h.mo("sankey-right-value text-right font-bold",U?.graphObjectValues),style:{hyphens:"auto",color:o.color,...P?.graphObjectValues},children:Lt.numberFormattingFunction(o.value,"NA",nt,R,$)}):null]})}):null]})},M)),st.filter(o=>o.type==="target").map((o,M)=>h.jsxRuntimeExports.jsx("g",{onMouseEnter:()=>{C(o)},onMouseLeave:()=>{C(void 0)},children:h.jsxRuntimeExports.jsxs("g",{transform:`translate(${o.x0},${o.y0})`,children:[h.jsxRuntimeExports.jsx("rect",{x:0,y:0,width:(o.x1||0)-(o.x0||0),height:(o.y1||0)-(o.y0||0),style:{fill:o.color}}),i||d?h.jsxRuntimeExports.jsx("foreignObject",{y:0-L/2,x:V,width:l-V,height:(o.y1||0)-(o.y0||0)+L,children:h.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-0.5 justify-center py-0 px-1.5",style:{height:`${(o.y1||0)-(o.y0||0)+L}px`},children:[i?h.jsxRuntimeExports.jsx(ct.u,{marginBottom:d?"3xs":"none",size:"sm",leading:"none",className:h.mo("sankey-left-label text-left",U?.graphObjectValues),style:{hyphens:"auto",color:o.color,...P?.graphObjectValues},children:`${o.label}`.length<m?`${o.label}`:`${`${o.label}`.substring(0,m)}...`}):null,d?h.jsxRuntimeExports.jsx(ct.u,{size:"sm",leading:"none",marginBottom:"none",className:h.mo("sankey-left-value text-left font-bold",U?.graphObjectValues),style:{hyphens:"auto",color:o.color,...P?.graphObjectValues},children:Lt.numberFormattingFunction(o.value,"NA",nt,R,$)}):null]})}):null]})},M)),h.jsxRuntimeExports.jsx("defs",{children:at.map((o,M)=>h.jsxRuntimeExports.jsxs("linearGradient",{id:`${X}-gradient-${M}`,x1:"0%",y1:"0%",x2:"100%",y2:"0%",gradientUnits:"userSpaceOnUse",children:[h.jsxRuntimeExports.jsx("stop",{offset:"0%",style:{stopColor:o.source.color,stopOpacity:1}}),h.jsxRuntimeExports.jsx("stop",{offset:"100%",style:{stopColor:o.target.color,stopOpacity:1}})]},M))}),h.jsxRuntimeExports.jsx("g",{children:h.jsxRuntimeExports.jsx(At.AnimatePresence,{children:at.map((o,M)=>h.jsxRuntimeExports.jsx(xt.motion.g,{className:"undp-viz-g-with-hover",onMouseEnter:Z=>{r(o.data),H(Z.clientY),I(Z.clientX),b?.(o)},onMouseMove:Z=>{r(o.data),H(Z.clientY),I(Z.clientX)},onClick:()=>{(S||T)&&(Dt.isEqual(f,o.data)&&et?(p(void 0),S?.(void 0)):(p(o.data),S?.(o.data)))},onMouseLeave:()=>{r(void 0),I(void 0),H(void 0),b?.(void 0)},variants:{initial:{opacity:N?o.source.name===N.name||o.target.name===N.name?.85:A:(B.length!==0||_.length!==0)&&(B.indexOf(o.source.label)!==-1||_.indexOf(o.target.label)!==-1)?.85:A},whileInView:{opacity:N?o.source.name===N.name||o.target.name===N.name?.85:A:(B.length!==0||_.length!==0)&&(B.indexOf(o.source.label)!==-1||_.indexOf(o.target.label)!==-1)?.85:A,transition:{duration:D.duration}}},initial:"initial",animate:s?"whileInView":"initial",exit:{opacity:0,transition:{duration:D.duration}},children:h.jsxRuntimeExports.jsx(xt.motion.path,{d:Q(o)||"",style:{stroke:`url(#${X}-gradient-${M})`,strokeWidth:o.width,fill:"none"},exit:{opacity:0,transition:{duration:D.duration}},variants:{initial:{pathLength:0,opacity:1},whileInView:{pathLength:1,opacity:1,transition:{duration:D.duration}}},initial:"initial",animate:s?"whileInView":"initial"},`${o.source}-${o.target}`)},`${o.source}-${o.target}`))})}),t.filter(o=>o.position==="after").map(o=>o.layer)]})]}),c&&j&&W&&O?h.jsxRuntimeExports.jsx(zt.Tooltip,{data:c,body:j,xPos:W,yPos:O,backgroundStyle:P?.tooltip,className:U?.tooltip}):null,T&&f!==void 0?h.jsxRuntimeExports.jsx(Pt.X,{open:f!==void 0,onClose:()=>{p(void 0)},children:h.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof T=="string"?{__html:It.string2HTML(T,f)}:void 0,children:typeof T=="function"?T(f):null})}):null]})}function he(e){const{data:n,graphTitle:i,sources:a,graphDescription:l,showLabels:m=!0,leftMargin:g=75,rightMargin:x=75,topMargin:v=30,bottomMargin:w=10,truncateBy:j=999,height:b,width:$,footNote:R,padding:d,backgroundColor:S,tooltip:L,onSeriesMouseOver:V,suffix:X="",prefix:B="",relativeHeight:_,showValues:A=!0,graphID:K,onSeriesMouseClick:tt,graphDownload:D=!1,dataDownload:Y=!1,fillContainer:et=!0,language:T="en",minHeight:P=0,theme:U="light",ariaLabel:nt,sourceColors:t,targetColors:u,sourceColorDomain:s,targetColorDomain:c,nodePadding:r=5,nodeWidth:f=5,highlightedSourceDataPoints:p=[],highlightedTargetDataPoints:N=[],defaultLinkOpacity:C=.3,sourceTitle:W,targetTitle:I,sortNodes:O="mostReadable",resetSelectionOnDoubleClick:H=!0,detailsOnClick:z,styles:G,classNames:F,animate:rt=!1,precision:st=2,customLayers:at=[]}=e,[Q,o]=q.useState(0),[M,Z]=q.useState(0),[bt,Vt]=q.useState(void 0),it=q.useRef(null),$t=q.useRef(null);return q.useEffect(()=>{const E=ot.uniqBy(n,"source").map(k=>({name:`source_${k.source}`,type:"source",label:`${k.source}`,color:typeof t=="string"||!t?t||Mt.Colors.graphMainColor:t[(s||ot.uniqBy(n,"source").map(y=>`${y.source}`)).findIndex(y=>`${y}`==`${k.source}`)>t.length?t.length-1:(s||ot.uniqBy(n,"source").map(y=>`${y.source}`)).findIndex(y=>`${y}`==`${k.source}`)],totalValue:Et.sum(n.filter(y=>`${y.source}`==`${k.source}`).map(y=>y.value))})),lt=O==="asc"?ut.sortBy(E,k=>k.totalValue):O==="desc"?ut.sortBy(E,k=>k.totalValue).reverse():E,gt=ot.uniqBy(n,"target").map(k=>({name:`target_${k.target}`,type:"target",label:`${k.target}`,color:typeof u=="string"||!u?u||Mt.Colors.graphMainColor:u[(c||ot.uniqBy(n,"target").map(y=>`${y.target}`)).findIndex(y=>`${y}`==`${k.target}`)>u.length?u.length-1:(c||ot.uniqBy(n,"target").map(y=>`${y.target}`)).findIndex(y=>`${y}`==`${k.target}`)],totalValue:Et.sum(n.filter(y=>`${y.target}`==`${k.target}`).map(y=>y.value))})),Bt=O==="asc"?ut.sortBy(gt,k=>k.totalValue):O==="desc"?ut.sortBy(gt,k=>k.totalValue).reverse():gt,dt=[...lt,...Bt];Vt({nodes:dt,links:n.map(k=>({source:dt.findIndex(y=>y.name===`source_${k.source}`),target:dt.findIndex(y=>y.name===`target_${k.target}`),value:k.value,data:{...k}}))})},[n,O,s,t,c,u]),q.useEffect(()=>{const E=new ResizeObserver(lt=>{o($||lt[0].target.clientWidth||620),Z(b||lt[0].target.clientHeight||480)});return it.current&&(Z(it.current.clientHeight||480),o(it.current.clientWidth||620),$||E.observe(it.current)),()=>E.disconnect()},[$,b]),h.jsxRuntimeExports.jsx("div",{className:`${U||"light"} flex ${$?"grow-0":"grow"} ${et?"w-full":"w-fit"} `,dir:T==="he"||T==="ar"?"rtl":void 0,children:h.jsxRuntimeExports.jsx("div",{className:h.mo(`${S?S===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${T||"en"}`,F?.graphContainer),style:{...G?.graphContainer||{},...S&&S!==!0?{backgroundColor:S}:{}},id:K,ref:$t,"aria-label":nt||`${i?`The graph shows ${i}. `:""}This is a sankey chart showing flow. ${l?` ${l}`:""}`,children:h.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:S?d||"1rem":d||0},children:h.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-4 w-full grow justify-between",children:[i||l||D||Y?h.jsxRuntimeExports.jsx(Wt.GraphHeader,{styles:{title:G?.title,description:G?.description},classNames:{title:F?.title,description:F?.description},graphTitle:i,graphDescription:l,width:$,graphDownload:D?$t.current:void 0,dataDownload:Y?n.map(E=>E.data).filter(E=>E!==void 0).length>0?n.map(E=>E.data).filter(E=>E!==void 0):n.filter(E=>E!==void 0):null}):null,h.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:n.length===0?h.jsxRuntimeExports.jsx(Xt.EmptyState,{}):h.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center gap-3 w-full leading-0",ref:it,"aria-label":"Graph area",children:($||Q)&&(b||M)&&bt?h.jsxRuntimeExports.jsx(fe,{data:bt,width:$||Q,nodePadding:r,nodeWidth:f,height:Math.max(P,b||(_?P?($||Q)*_>P?($||Q)*_:P:($||Q)*_:M)),showLabels:m,leftMargin:g,rightMargin:x,topMargin:v,bottomMargin:w,truncateBy:j,tooltip:L,onSeriesMouseOver:V,showValues:A,suffix:X,prefix:B,onSeriesMouseClick:tt,id:Ft.generateRandomString(8),highlightedSourceDataPoints:p.map(E=>`${E}`),highlightedTargetDataPoints:N.map(E=>`${E}`),defaultLinkOpacity:C,sourceTitle:W,targetTitle:I,sortNodes:O,resetSelectionOnDoubleClick:H,styles:G,classNames:F,detailsOnClick:z,animate:rt===!0?{duration:.5,once:!0,amount:.5}:rt||{duration:0,once:!0,amount:0},precision:st,customLayers:at}):null})}),a||R?h.jsxRuntimeExports.jsx(Gt.GraphFooter,{styles:{footnote:G?.footnote,source:G?.source},classNames:{footnote:F?.footnote,source:F?.source},sources:a,footNote:R,width:$}):null]})})})})}exports.SankeyChart=he;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./index-CHPV5EwG-DDoeWRVt.cjs"),q=require("react"),ot=require("./index-CZbIGs8q.cjs"),ut=require("./index-BzeLQvXk.cjs"),Et=require("./index-C21TvELx.cjs"),Dt=require("./index-BXns0-ng.cjs"),Pt=require("./Modal-tXZlLE5s.cjs"),ct=require("./Typography-k-kOjICQ.cjs"),Lt=require("./numberFormattingFunction-02t-wJta.cjs"),zt=require("./Tooltip-n8z5bfav.cjs"),It=require("./string2HTML-D2Avudmb.cjs"),Ht=require("./use-in-view-sQJZ_xDO.cjs"),xt=require("./proxy-BHRoeZgd.cjs"),At=require("./index-BW8iNx7E.cjs"),Wt=require("./GraphHeader.cjs"),Gt=require("./GraphFooter.cjs"),Mt=require("./Colors.cjs"),Ft=require("./generateRandomString-B5zBiJzS.cjs"),Xt=require("./EmptyState-d8_8SxeW.cjs");function Rt(e,n){let i;if(n===void 0)for(const a of e)a!=null&&(i<a||i===void 0&&a>=a)&&(i=a);else{let a=-1;for(let l of e)(l=n(l,++a,e))!=null&&(i<l||i===void 0&&l>=l)&&(i=l)}return i}function Ot(e,n){let i;if(n===void 0)for(const a of e)a!=null&&(i>a||i===void 0&&a>=a)&&(i=a);else{let a=-1;for(let l of e)(l=n(l,++a,e))!=null&&(i>l||i===void 0&&l>=l)&&(i=l)}return i}function pt(e,n){let i=0;if(n===void 0)for(let a of e)(a=+a)&&(i+=a);else{let a=-1;for(let l of e)(l=+n(l,++a,e))&&(i+=l)}return i}function Yt(e){return e.target.depth}function Ut(e,n){return e.sourceLinks.length?e.depth:n-1}function mt(e){return e.targetLinks.length?e.depth:e.sourceLinks.length?Ot(e.sourceLinks,Yt)-1:0}function ft(e){return function(){return e}}function St(e,n){return ht(e.source,n.source)||e.index-n.index}function _t(e,n){return ht(e.target,n.target)||e.index-n.index}function ht(e,n){return e.y0-n.y0}function yt(e){return e.value}function Zt(e){return e.index}function Qt(e){return e.nodes}function Jt(e){return e.links}function Nt(e,n){const i=e.get(n);if(!i)throw new Error("missing: "+n);return i}function Ct({nodes:e}){for(const n of e){let i=n.y0,a=i;for(const l of n.sourceLinks)l.y0=i+l.width/2,i+=l.width;for(const l of n.targetLinks)l.y1=a+l.width/2,a+=l.width}}function vt(){let e=0,n=0,i=1,a=1,l=24,m=8,g,x=Zt,v=Ut,w,j,b=Qt,$=Jt,R=6;function d(){const t={nodes:b.apply(null,arguments),links:$.apply(null,arguments)};return S(t),L(t),V(t),X(t),A(t),Ct(t),t}d.update=function(t){return Ct(t),t},d.nodeId=function(t){return arguments.length?(x=typeof t=="function"?t:ft(t),d):x},d.nodeAlign=function(t){return arguments.length?(v=typeof t=="function"?t:ft(t),d):v},d.nodeSort=function(t){return arguments.length?(w=t,d):w},d.nodeWidth=function(t){return arguments.length?(l=+t,d):l},d.nodePadding=function(t){return arguments.length?(m=g=+t,d):m},d.nodes=function(t){return arguments.length?(b=typeof t=="function"?t:ft(t),d):b},d.links=function(t){return arguments.length?($=typeof t=="function"?t:ft(t),d):$},d.linkSort=function(t){return arguments.length?(j=t,d):j},d.size=function(t){return arguments.length?(e=n=0,i=+t[0],a=+t[1],d):[i-e,a-n]},d.extent=function(t){return arguments.length?(e=+t[0][0],i=+t[1][0],n=+t[0][1],a=+t[1][1],d):[[e,n],[i,a]]},d.iterations=function(t){return arguments.length?(R=+t,d):R};function S({nodes:t,links:u}){for(const[c,r]of t.entries())r.index=c,r.sourceLinks=[],r.targetLinks=[];const s=new Map(t.map((c,r)=>[x(c,r,t),c]));for(const[c,r]of u.entries()){r.index=c;let{source:f,target:p}=r;typeof f!="object"&&(f=r.source=Nt(s,f)),typeof p!="object"&&(p=r.target=Nt(s,p)),f.sourceLinks.push(r),p.targetLinks.push(r)}if(j!=null)for(const{sourceLinks:c,targetLinks:r}of t)c.sort(j),r.sort(j)}function L({nodes:t}){for(const u of t)u.value=u.fixedValue===void 0?Math.max(pt(u.sourceLinks,yt),pt(u.targetLinks,yt)):u.fixedValue}function V({nodes:t}){const u=t.length;let s=new Set(t),c=new Set,r=0;for(;s.size;){for(const f of s){f.depth=r;for(const{target:p}of f.sourceLinks)c.add(p)}if(++r>u)throw new Error("circular link");s=c,c=new Set}}function X({nodes:t}){const u=t.length;let s=new Set(t),c=new Set,r=0;for(;s.size;){for(const f of s){f.height=r;for(const{source:p}of f.targetLinks)c.add(p)}if(++r>u)throw new Error("circular link");s=c,c=new Set}}function B({nodes:t}){const u=Rt(t,r=>r.depth)+1,s=(i-e-l)/(u-1),c=new Array(u);for(const r of t){const f=Math.max(0,Math.min(u-1,Math.floor(v.call(null,r,u))));r.layer=f,r.x0=e+f*s,r.x1=r.x0+l,c[f]?c[f].push(r):c[f]=[r]}if(w)for(const r of c)r.sort(w);return c}function _(t){const u=Ot(t,s=>(a-n-(s.length-1)*g)/pt(s,yt));for(const s of t){let c=n;for(const r of s){r.y0=c,r.y1=c+r.value*u,c=r.y1+g;for(const f of r.sourceLinks)f.width=f.value*u}c=(a-c+g)/(s.length+1);for(let r=0;r<s.length;++r){const f=s[r];f.y0+=c*(r+1),f.y1+=c*(r+1)}P(s)}}function A(t){const u=B(t);g=Math.min(m,(a-n)/(Rt(u,s=>s.length)-1)),_(u);for(let s=0;s<R;++s){const c=Math.pow(.99,s),r=Math.max(1-c,(s+1)/R);tt(u,c,r),K(u,c,r)}}function K(t,u,s){for(let c=1,r=t.length;c<r;++c){const f=t[c];for(const p of f){let N=0,C=0;for(const{source:I,value:O}of p.targetLinks){let H=O*(p.layer-I.layer);N+=U(I,p)*H,C+=H}if(!(C>0))continue;let W=(N/C-p.y0)*u;p.y0+=W,p.y1+=W,T(p)}w===void 0&&f.sort(ht),D(f,s)}}function tt(t,u,s){for(let c=t.length,r=c-2;r>=0;--r){const f=t[r];for(const p of f){let N=0,C=0;for(const{target:I,value:O}of p.sourceLinks){let H=O*(I.layer-p.layer);N+=nt(p,I)*H,C+=H}if(!(C>0))continue;let W=(N/C-p.y0)*u;p.y0+=W,p.y1+=W,T(p)}w===void 0&&f.sort(ht),D(f,s)}}function D(t,u){const s=t.length>>1,c=t[s];et(t,c.y0-g,s-1,u),Y(t,c.y1+g,s+1,u),et(t,a,t.length-1,u),Y(t,n,0,u)}function Y(t,u,s,c){for(;s<t.length;++s){const r=t[s],f=(u-r.y0)*c;f>1e-6&&(r.y0+=f,r.y1+=f),u=r.y1+g}}function et(t,u,s,c){for(;s>=0;--s){const r=t[s],f=(r.y1-u)*c;f>1e-6&&(r.y0-=f,r.y1-=f),u=r.y0-g}}function T({sourceLinks:t,targetLinks:u}){if(j===void 0){for(const{source:{sourceLinks:s}}of u)s.sort(_t);for(const{target:{targetLinks:s}}of t)s.sort(St)}}function P(t){if(j===void 0)for(const{sourceLinks:u,targetLinks:s}of t)u.sort(_t),s.sort(St)}function U(t,u){let s=t.y0-(t.sourceLinks.length-1)*g/2;for(const{target:c,width:r}of t.sourceLinks){if(c===u)break;s+=r+g}for(const{source:c,width:r}of u.targetLinks){if(c===t)break;s-=r}return s}function nt(t,u){let s=u.y0-(u.targetLinks.length-1)*g/2;for(const{source:c,width:r}of u.targetLinks){if(c===t)break;s+=r+g}for(const{target:c,width:r}of t.sourceLinks){if(c===u)break;s-=r}return s}return d}var jt=Math.PI,kt=2*jt,J=1e-6,Kt=kt-J;function wt(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function qt(){return new wt}wt.prototype=qt.prototype={constructor:wt,moveTo:function(e,n){this._+="M"+(this._x0=this._x1=+e)+","+(this._y0=this._y1=+n)},closePath:function(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(e,n){this._+="L"+(this._x1=+e)+","+(this._y1=+n)},quadraticCurveTo:function(e,n,i,a){this._+="Q"+ +e+","+ +n+","+(this._x1=+i)+","+(this._y1=+a)},bezierCurveTo:function(e,n,i,a,l,m){this._+="C"+ +e+","+ +n+","+ +i+","+ +a+","+(this._x1=+l)+","+(this._y1=+m)},arcTo:function(e,n,i,a,l){e=+e,n=+n,i=+i,a=+a,l=+l;var m=this._x1,g=this._y1,x=i-e,v=a-n,w=m-e,j=g-n,b=w*w+j*j;if(l<0)throw new Error("negative radius: "+l);if(this._x1===null)this._+="M"+(this._x1=e)+","+(this._y1=n);else if(b>J)if(!(Math.abs(j*x-v*w)>J)||!l)this._+="L"+(this._x1=e)+","+(this._y1=n);else{var $=i-m,R=a-g,d=x*x+v*v,S=$*$+R*R,L=Math.sqrt(d),V=Math.sqrt(b),X=l*Math.tan((jt-Math.acos((d+b-S)/(2*L*V)))/2),B=X/V,_=X/L;Math.abs(B-1)>J&&(this._+="L"+(e+B*w)+","+(n+B*j)),this._+="A"+l+","+l+",0,0,"+ +(j*$>w*R)+","+(this._x1=e+_*x)+","+(this._y1=n+_*v)}},arc:function(e,n,i,a,l,m){e=+e,n=+n,i=+i,m=!!m;var g=i*Math.cos(a),x=i*Math.sin(a),v=e+g,w=n+x,j=1^m,b=m?a-l:l-a;if(i<0)throw new Error("negative radius: "+i);this._x1===null?this._+="M"+v+","+w:(Math.abs(this._x1-v)>J||Math.abs(this._y1-w)>J)&&(this._+="L"+v+","+w),i&&(b<0&&(b=b%kt+kt),b>Kt?this._+="A"+i+","+i+",0,1,"+j+","+(e-g)+","+(n-x)+"A"+i+","+i+",0,1,"+j+","+(this._x1=v)+","+(this._y1=w):b>J&&(this._+="A"+i+","+i+",0,"+ +(b>=jt)+","+j+","+(this._x1=e+i*Math.cos(l))+","+(this._y1=n+i*Math.sin(l))))},rect:function(e,n,i,a){this._+="M"+(this._x0=this._x1=+e)+","+(this._y0=this._y1=+n)+"h"+ +i+"v"+ +a+"h"+-i+"Z"},toString:function(){return this._}};function Tt(e){return function(){return e}}function te(e){return e[0]}function ee(e){return e[1]}var ne=Array.prototype.slice;function oe(e){return e.source}function ie(e){return e.target}function re(e){var n=oe,i=ie,a=te,l=ee,m=null;function g(){var x,v=ne.call(arguments),w=n.apply(this,v),j=i.apply(this,v);if(m||(m=x=qt()),e(m,+a.apply(this,(v[0]=w,v)),+l.apply(this,v),+a.apply(this,(v[0]=j,v)),+l.apply(this,v)),x)return m=null,x+""||null}return g.source=function(x){return arguments.length?(n=x,g):n},g.target=function(x){return arguments.length?(i=x,g):i},g.x=function(x){return arguments.length?(a=typeof x=="function"?x:Tt(+x),g):a},g.y=function(x){return arguments.length?(l=typeof x=="function"?x:Tt(+x),g):l},g.context=function(x){return arguments.length?(m=x??null,g):m},g}function se(e,n,i,a,l){e.moveTo(n,i),e.bezierCurveTo(n=(n+a)/2,i,n,l,a,l)}function ae(){return re(se)}function le(e){return[e.source.x1,e.y0]}function ue(e){return[e.target.x0,e.y1]}function ce(){return ae().source(le).target(ue)}function fe(e){const{data:n,showLabels:i,leftMargin:a,rightMargin:l,truncateBy:m,width:g,height:x,topMargin:v,bottomMargin:w,tooltip:j,onSeriesMouseOver:b,suffix:$,prefix:R,showValues:d,onSeriesMouseClick:S,nodePadding:L,nodeWidth:V,id:X,highlightedSourceDataPoints:B,highlightedTargetDataPoints:_,defaultLinkOpacity:A,sourceTitle:K,targetTitle:tt,animate:D,sortNodes:Y,resetSelectionOnDoubleClick:et,detailsOnClick:T,styles:P,classNames:U,precision:nt,customLayers:t}=e,u=q.useRef(null),s=Ht.useInView(u,{once:D.once,amount:D.amount}),[c,r]=q.useState(void 0),[f,p]=q.useState(void 0),[N,C]=q.useState(void 0),[W,I]=q.useState(void 0),[O,H]=q.useState(void 0),z={top:v,bottom:w,left:a,right:l},G=g-z.left-z.right,F=x-z.top-z.bottom,rt=Y==="mostReadable"?vt().nodeWidth(V).nodePadding(L).size([G,F]).nodeAlign(mt):Y==="none"?vt().nodeWidth(V).nodePadding(L).size([G,F]).nodeAlign(mt).nodeSort(()=>null).linkSort(()=>null):vt().nodeWidth(V).nodePadding(L).size([G,F]).nodeAlign(mt).nodeSort(Y==="desc"?(o,M)=>(M.value||0)-(o.value||0):(o,M)=>(o.value||0)-(M.value||0)),{nodes:st,links:at}=rt(n),Q=ce();return h.jsxRuntimeExports.jsxs(h.jsxRuntimeExports.Fragment,{children:[h.jsxRuntimeExports.jsxs(xt.motion.svg,{width:`${g}px`,height:`${x}px`,viewBox:`0 0 ${g} ${x}`,style:{marginLeft:"auto",marginRight:"auto"},direction:"ltr",ref:u,children:[K?h.jsxRuntimeExports.jsx("text",{x:z.left,y:z.top-10,className:"text-base font-bold fill-primary-gray-700 dark:fill-primary-gray-100",style:{textAnchor:"start"},children:K}):null,tt?h.jsxRuntimeExports.jsx("text",{x:g-z.right,y:z.top-10,className:"text-base font-bold fill-primary-gray-700 dark:fill-primary-gray-100",style:{textAnchor:"end"},children:tt}):null,h.jsxRuntimeExports.jsxs("g",{transform:`translate(${z.left},${z.top})`,children:[t.filter(o=>o.position==="before").map(o=>o.layer),st.filter(o=>o.type==="source").map((o,M)=>h.jsxRuntimeExports.jsx("g",{onMouseEnter:()=>{C(o)},onMouseLeave:()=>{C(void 0)},children:h.jsxRuntimeExports.jsxs("g",{transform:`translate(${o.x0},${o.y0})`,children:[h.jsxRuntimeExports.jsx("rect",{x:0,y:0,width:(o.x1||0)-(o.x0||0),height:(o.y1||0)-(o.y0||0),style:{fill:o.color}}),i||d?h.jsxRuntimeExports.jsx("foreignObject",{y:0-L/2,x:0-a,width:a,height:(o.y1||0)-(o.y0||0)+L,children:h.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-0.5 justify-center py-0 px-1.5",style:{height:`${(o.y1||0)-(o.y0||0)+L}px`,overflow:"visible"},children:[i?h.jsxRuntimeExports.jsx(ct.u,{marginBottom:d?"3xs":"none",size:"sm",leading:"none",className:h.mo("sankey-right-label text-right",U?.graphObjectValues),style:{hyphens:"auto",color:o.color,...P?.graphObjectValues},children:`${o.label}`.length<m?`${o.label}`:`${`${o.label}`.substring(0,m)}...`}):null,d?h.jsxRuntimeExports.jsx(ct.u,{marginBottom:"none",size:"sm",leading:"none",className:h.mo("sankey-right-value text-right font-bold",U?.graphObjectValues),style:{hyphens:"auto",color:o.color,...P?.graphObjectValues},children:Lt.numberFormattingFunction(o.value,"NA",nt,R,$)}):null]})}):null]})},M)),st.filter(o=>o.type==="target").map((o,M)=>h.jsxRuntimeExports.jsx("g",{onMouseEnter:()=>{C(o)},onMouseLeave:()=>{C(void 0)},children:h.jsxRuntimeExports.jsxs("g",{transform:`translate(${o.x0},${o.y0})`,children:[h.jsxRuntimeExports.jsx("rect",{x:0,y:0,width:(o.x1||0)-(o.x0||0),height:(o.y1||0)-(o.y0||0),style:{fill:o.color}}),i||d?h.jsxRuntimeExports.jsx("foreignObject",{y:0-L/2,x:V,width:l-V,height:(o.y1||0)-(o.y0||0)+L,children:h.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-0.5 justify-center py-0 px-1.5",style:{height:`${(o.y1||0)-(o.y0||0)+L}px`},children:[i?h.jsxRuntimeExports.jsx(ct.u,{marginBottom:d?"3xs":"none",size:"sm",leading:"none",className:h.mo("sankey-left-label text-left",U?.graphObjectValues),style:{hyphens:"auto",color:o.color,...P?.graphObjectValues},children:`${o.label}`.length<m?`${o.label}`:`${`${o.label}`.substring(0,m)}...`}):null,d?h.jsxRuntimeExports.jsx(ct.u,{size:"sm",leading:"none",marginBottom:"none",className:h.mo("sankey-left-value text-left font-bold",U?.graphObjectValues),style:{hyphens:"auto",color:o.color,...P?.graphObjectValues},children:Lt.numberFormattingFunction(o.value,"NA",nt,R,$)}):null]})}):null]})},M)),h.jsxRuntimeExports.jsx("defs",{children:at.map((o,M)=>h.jsxRuntimeExports.jsxs("linearGradient",{id:`${X}-gradient-${M}`,x1:"0%",y1:"0%",x2:"100%",y2:"0%",gradientUnits:"userSpaceOnUse",children:[h.jsxRuntimeExports.jsx("stop",{offset:"0%",style:{stopColor:o.source.color,stopOpacity:1}}),h.jsxRuntimeExports.jsx("stop",{offset:"100%",style:{stopColor:o.target.color,stopOpacity:1}})]},M))}),h.jsxRuntimeExports.jsx("g",{children:h.jsxRuntimeExports.jsx(At.AnimatePresence,{children:at.map((o,M)=>h.jsxRuntimeExports.jsx(xt.motion.g,{className:"undp-viz-g-with-hover",onMouseEnter:Z=>{r(o.data),H(Z.clientY),I(Z.clientX),b?.(o)},onMouseMove:Z=>{r(o.data),H(Z.clientY),I(Z.clientX)},onClick:()=>{(S||T)&&(Dt.isEqual(f,o.data)&&et?(p(void 0),S?.(void 0)):(p(o.data),S?.(o.data)))},onMouseLeave:()=>{r(void 0),I(void 0),H(void 0),b?.(void 0)},variants:{initial:{opacity:N?o.source.name===N.name||o.target.name===N.name?.85:A:(B.length!==0||_.length!==0)&&(B.indexOf(o.source.label)!==-1||_.indexOf(o.target.label)!==-1)?.85:A},whileInView:{opacity:N?o.source.name===N.name||o.target.name===N.name?.85:A:(B.length!==0||_.length!==0)&&(B.indexOf(o.source.label)!==-1||_.indexOf(o.target.label)!==-1)?.85:A,transition:{duration:D.duration}}},initial:"initial",animate:s?"whileInView":"initial",exit:{opacity:0,transition:{duration:D.duration}},children:h.jsxRuntimeExports.jsx(xt.motion.path,{d:Q(o)||"",style:{stroke:`url(#${X}-gradient-${M})`,strokeWidth:o.width,fill:"none"},exit:{opacity:0,transition:{duration:D.duration}},variants:{initial:{pathLength:0,opacity:1},whileInView:{pathLength:1,opacity:1,transition:{duration:D.duration}}},initial:"initial",animate:s?"whileInView":"initial"},`${o.source}-${o.target}`)},`${o.source}-${o.target}`))})}),t.filter(o=>o.position==="after").map(o=>o.layer)]})]}),c&&j&&W&&O?h.jsxRuntimeExports.jsx(zt.Tooltip,{data:c,body:j,xPos:W,yPos:O,backgroundStyle:P?.tooltip,className:U?.tooltip}):null,T&&f!==void 0?h.jsxRuntimeExports.jsx(Pt.X,{open:f!==void 0,onClose:()=>{p(void 0)},children:h.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof T=="string"?{__html:It.string2HTML(T,f)}:void 0,children:typeof T=="function"?T(f):null})}):null]})}function he(e){const{data:n,graphTitle:i,sources:a,graphDescription:l,showLabels:m=!0,leftMargin:g=75,rightMargin:x=75,topMargin:v=30,bottomMargin:w=10,truncateBy:j=999,height:b,width:$,footNote:R,padding:d,backgroundColor:S,tooltip:L,onSeriesMouseOver:V,suffix:X="",prefix:B="",relativeHeight:_,showValues:A=!0,graphID:K,onSeriesMouseClick:tt,graphDownload:D=!1,dataDownload:Y=!1,fillContainer:et=!0,language:T="en",minHeight:P=0,theme:U="light",ariaLabel:nt,sourceColors:t,targetColors:u,sourceColorDomain:s,targetColorDomain:c,nodePadding:r=5,nodeWidth:f=5,highlightedSourceDataPoints:p=[],highlightedTargetDataPoints:N=[],defaultLinkOpacity:C=.3,sourceTitle:W,targetTitle:I,sortNodes:O="mostReadable",resetSelectionOnDoubleClick:H=!0,detailsOnClick:z,styles:G,classNames:F,animate:rt=!1,precision:st=2,customLayers:at=[]}=e,[Q,o]=q.useState(0),[M,Z]=q.useState(0),[bt,Vt]=q.useState(void 0),it=q.useRef(null),$t=q.useRef(null);return q.useEffect(()=>{const E=ot.uniqBy(n,"source").map(k=>({name:`source_${k.source}`,type:"source",label:`${k.source}`,color:typeof t=="string"||!t?t||Mt.Colors.graphMainColor:t[(s||ot.uniqBy(n,"source").map(y=>`${y.source}`)).findIndex(y=>`${y}`==`${k.source}`)>t.length?t.length-1:(s||ot.uniqBy(n,"source").map(y=>`${y.source}`)).findIndex(y=>`${y}`==`${k.source}`)],totalValue:Et.sum(n.filter(y=>`${y.source}`==`${k.source}`).map(y=>y.value))})),lt=O==="asc"?ut.sortBy(E,k=>k.totalValue):O==="desc"?ut.sortBy(E,k=>k.totalValue).reverse():E,gt=ot.uniqBy(n,"target").map(k=>({name:`target_${k.target}`,type:"target",label:`${k.target}`,color:typeof u=="string"||!u?u||Mt.Colors.graphMainColor:u[(c||ot.uniqBy(n,"target").map(y=>`${y.target}`)).findIndex(y=>`${y}`==`${k.target}`)>u.length?u.length-1:(c||ot.uniqBy(n,"target").map(y=>`${y.target}`)).findIndex(y=>`${y}`==`${k.target}`)],totalValue:Et.sum(n.filter(y=>`${y.target}`==`${k.target}`).map(y=>y.value))})),Bt=O==="asc"?ut.sortBy(gt,k=>k.totalValue):O==="desc"?ut.sortBy(gt,k=>k.totalValue).reverse():gt,dt=[...lt,...Bt];Vt({nodes:dt,links:n.map(k=>({source:dt.findIndex(y=>y.name===`source_${k.source}`),target:dt.findIndex(y=>y.name===`target_${k.target}`),value:k.value,data:{...k}}))})},[n,O,s,t,c,u]),q.useEffect(()=>{const E=new ResizeObserver(lt=>{o($||lt[0].target.clientWidth||620),Z(b||lt[0].target.clientHeight||480)});return it.current&&(Z(it.current.clientHeight||480),o(it.current.clientWidth||620),$||E.observe(it.current)),()=>E.disconnect()},[$,b]),h.jsxRuntimeExports.jsx("div",{className:`${U||"light"} flex ${$?"grow-0":"grow"} ${et?"w-full":"w-fit"} `,dir:T==="he"||T==="ar"?"rtl":void 0,children:h.jsxRuntimeExports.jsx("div",{className:h.mo(`${S?S===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${T||"en"}`,F?.graphContainer),style:{...G?.graphContainer||{},...S&&S!==!0?{backgroundColor:S}:{}},id:K,ref:$t,"aria-label":nt||`${i?`The graph shows ${i}. `:""}This is a sankey chart showing flow. ${l?` ${l}`:""}`,children:h.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:S?d||"1rem":d||0},children:h.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-4 w-full grow justify-between",children:[i||l||D||Y?h.jsxRuntimeExports.jsx(Wt.GraphHeader,{styles:{title:G?.title,description:G?.description},classNames:{title:F?.title,description:F?.description},graphTitle:i,graphDescription:l,width:$,graphDownload:D?$t.current:void 0,dataDownload:Y?n.map(E=>E.data).filter(E=>E!==void 0).length>0?n.map(E=>E.data).filter(E=>E!==void 0):n.filter(E=>E!==void 0):null}):null,h.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:n.length===0?h.jsxRuntimeExports.jsx(Xt.EmptyState,{}):h.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center gap-3 w-full leading-0",ref:it,"aria-label":"Graph area",children:($||Q)&&(b||M)&&bt?h.jsxRuntimeExports.jsx(fe,{data:bt,width:$||Q,nodePadding:r,nodeWidth:f,height:Math.max(P,b||(_?P?($||Q)*_>P?($||Q)*_:P:($||Q)*_:M)),showLabels:m,leftMargin:g,rightMargin:x,topMargin:v,bottomMargin:w,truncateBy:j,tooltip:L,onSeriesMouseOver:V,showValues:A,suffix:X,prefix:B,onSeriesMouseClick:tt,id:Ft.generateRandomString(8),highlightedSourceDataPoints:p.map(E=>`${E}`),highlightedTargetDataPoints:N.map(E=>`${E}`),defaultLinkOpacity:C,sourceTitle:W,targetTitle:I,sortNodes:O,resetSelectionOnDoubleClick:H,styles:G,classNames:F,detailsOnClick:z,animate:rt===!0?{duration:.5,once:!0,amount:.5}:rt||{duration:0,once:!0,amount:0},precision:st,customLayers:at}):null})}),a||R?h.jsxRuntimeExports.jsx(Gt.GraphFooter,{styles:{footnote:G?.footnote,source:G?.source},classNames:{footnote:F?.footnote,source:F?.source},sources:a,footNote:R,width:$}):null]})})})})}exports.SankeyChart=he;
|
|
2
2
|
//# sourceMappingURL=SankeyChart.cjs.map
|
package/dist/SankeyChart.js
CHANGED
|
@@ -4,14 +4,14 @@ import { u as ot } from "./index-CaAIPGZo.js";
|
|
|
4
4
|
import { s as ct } from "./index-DxagiOHo.js";
|
|
5
5
|
import { s as Nt } from "./index-D7ltPi18.js";
|
|
6
6
|
import { i as Ht } from "./index-27yTRcko.js";
|
|
7
|
-
import { X as Wt } from "./Modal-
|
|
7
|
+
import { X as Wt } from "./Modal-DVVwpKhP.js";
|
|
8
8
|
import { u as ft } from "./Typography-Ctgfl1J5.js";
|
|
9
9
|
import { n as St } from "./numberFormattingFunction-14YCbkN2.js";
|
|
10
10
|
import { T as Rt } from "./Tooltip-DyM5snqx.js";
|
|
11
11
|
import { s as Gt } from "./string2HTML-CWHGfz_d.js";
|
|
12
|
-
import { u as qt } from "./use-in-view-
|
|
13
|
-
import { m as mt } from "./proxy-
|
|
14
|
-
import { A as Xt } from "./index-
|
|
12
|
+
import { u as qt } from "./use-in-view-yS6jzJAp.js";
|
|
13
|
+
import { m as mt } from "./proxy-CkpFesk1.js";
|
|
14
|
+
import { A as Xt } from "./index-CNvov0eg.js";
|
|
15
15
|
import { GraphHeader as Ft } from "./GraphHeader.js";
|
|
16
16
|
import { GraphFooter as Yt } from "./GraphFooter.js";
|
|
17
17
|
import { Colors as Tt } from "./Colors.js";
|
package/dist/ScatterPlot.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index-CHPV5EwG-DDoeWRVt.cjs"),ke=require("./index-CZbIGs8q.cjs"),Me=require("./parse-hMnG_lRV.cjs"),j=require("react"),Ae=require("./getSliderMarks-CtsEXiLV.cjs"),Ie=require("./index-BXns0-ng.cjs"),Ue=require("./index-BczVvEBZ.cjs"),Le=require("./simple-statistics-xm8c0LQQ.cjs"),Fe=require("./Modal-C_dl0EtQ.cjs"),He=require("./Tooltip-n8z5bfav.cjs"),c=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),N=require("./Colors.cjs"),Ve=require("./numberFormattingFunction-02t-wJta.cjs"),Ne=require("./customArea-BYNyxAkm.cjs"),Ge=require("./string2HTML-D2Avudmb.cjs"),$e=require("./Axis-DE7dSn1_.cjs"),Te=require("./AxisTitle-CK9YeovX.cjs"),We=require("./XTicksAndGridLines-CCzXIV8d.cjs"),De=require("./ReferenceLine-CuFMk0cI.cjs"),Be=require("./RegressionLine-7_rKTHN_.cjs"),ze=require("./YTicksAndGridLines-DBDuz6vb.cjs"),_e=require("./index-CylX-pWB.cjs"),Je=require("./use-in-view-BCmzDU2O.cjs"),Ke=require("./pow-B5-jkdHU.cjs"),Pe=require("./linear-BVckp9RD.cjs"),Qe=require("./delaunay-rcy0HhZi.cjs"),ie=require("./proxy-PQd2AItT.cjs"),Xe=require("./index-DVOJ7vxH.cjs"),Ze=require("./GraphFooter.cjs"),et=require("./GraphHeader.cjs"),tt=require("./ColorLegendWithMouseOver.cjs"),it=require("./EmptyState-d8_8SxeW.cjs"),Ye=require("./index-BW_-wD2k.cjs"),st=require("./ensureCompleteData-DqWQ2Zbi.cjs"),ot=require("./init-DU0ybBc_.cjs");function rt(ge){const{data:s,width:q,height:M,showLabels:se,colors:l,colorDomain:C,radius:R,xAxisTitle:d,yAxisTitle:J,leftMargin:G,rightMargin:ye,topMargin:pe,bottomMargin:oe,tooltip:re,onSeriesMouseOver:X,refXValues:I,refYValues:je,highlightAreaSettings:ve,selectedColor:W,highlightedDataPoints:L,maxRadiusValue:be,maxXValue:B,minXValue:w,maxYValue:Oe,minYValue:E,onSeriesMouseClick:V,rtl:K,annotations:Ce,customHighlightAreaSettings:Re,regressionLine:z,resetSelectionOnDoubleClick:Q,detailsOnClick:k,noOfXTicks:ne,noOfYTicks:le,labelColor:Z,xSuffix:ae,ySuffix:ce,xPrefix:xe,yPrefix:ue,styles:x,classNames:u,animate:n,dimmedOpacity:A,precision:S,customLayers:fe}=ge,me=j.useRef(null),p=Je.useInView(me,{once:n.once,amount:n.amount}),[$,T]=j.useState(void 0),[D,Y]=j.useState(void 0),[de,P]=j.useState(void 0),[he,v]=j.useState(void 0),h={top:pe,bottom:d?oe+50:oe,left:J?G+30:G,right:ye},_=s.map((e,y)=>({...e,id:`${y}`})),g=q-h.left-h.right,b=M-h.top-h.bottom,O=s.filter(e=>e.radius===void 0||e.radius===null).length!==s.length?Ke.sqrt().domain([0,be]).range([.25,R]).nice():void 0,m=_.filter(e=>!c.checkIfNullOrUndefined(e.radius)).length===0?_:Ue.orderBy(_.filter(e=>!c.checkIfNullOrUndefined(e.radius)),"radius","desc"),r=Pe.linear().domain([w,B]).range([0,g]).nice(),a=Pe.linear().domain([E,Oe]).range([b,0]).nice(),ee=r.ticks(ne),te=a.ticks(le),U=Qe.Delaunay.from(m.filter(e=>!c.checkIfNullOrUndefined(e.x)&&!c.checkIfNullOrUndefined(e.y)),e=>r(e.x),e=>a(e.y)).voronoi([0,0,g<0?0:g,b<0?0:b]),we=Le.linearRegression(s.filter(e=>!c.checkIfNullOrUndefined(e.x)&&!c.checkIfNullOrUndefined(e.y)).map(e=>[r(e.x),a(e.y)])),f=Le.linearRegressionLine(we);return i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[i.jsxRuntimeExports.jsx(ie.motion.svg,{width:`${q}px`,height:`${M}px`,viewBox:`0 0 ${q} ${M}`,direction:"ltr",ref:me,children:i.jsxRuntimeExports.jsxs("g",{transform:`translate(${h.left},${h.top})`,children:[i.jsxRuntimeExports.jsxs(Xe.AnimatePresence,{children:[i.jsxRuntimeExports.jsx(_e.HighlightAreaForScatterPlot,{areaSettings:ve,width:g,height:b,scaleX:r,scaleY:a,animate:n,isInView:p}),i.jsxRuntimeExports.jsx(Ne.CustomArea,{areaSettings:Re,scaleX:r,scaleY:a,animate:n,isInView:p})]}),i.jsxRuntimeExports.jsxs("g",{children:[i.jsxRuntimeExports.jsx(ze.YTicksAndGridLines,{values:te.filter(e=>e!==0),y:te.filter(e=>e!==0).map(e=>a(e)),x1:0,x2:g+h.right,styles:{gridLines:x?.yAxis?.gridLines,labels:x?.yAxis?.labels},classNames:{gridLines:u?.yAxis?.gridLines,labels:u?.yAxis?.labels},suffix:ce,prefix:ue,labelType:"secondary",showGridLines:!0,labelPos:"side",precision:S}),i.jsxRuntimeExports.jsx($e.Axis,{y1:a(E<0?0:E),y2:a(E<0?0:E),x1:0,x2:g+h.right,label:Ve.numberFormattingFunction(E<0?0:E,"NA",S,ue,ce),labelPos:{x:0,y:a(E<0?0:E),dy:"0.33em",dx:-4},classNames:{axis:u?.xAxis?.axis,label:u?.yAxis?.labels},styles:{axis:x?.xAxis?.axis,label:{textAnchor:"end",...x?.yAxis?.labels||{}}}}),i.jsxRuntimeExports.jsx(Te.AxisTitle,{x:0-G-15,y:b/2,style:x?.yAxis?.title,className:u?.yAxis?.title,text:J,rotate90:!0})]}),i.jsxRuntimeExports.jsxs("g",{children:[i.jsxRuntimeExports.jsx(We.XTicksAndGridLines,{values:ee.filter(e=>e!==0),x:ee.filter(e=>e!==0).map(e=>r(e)),y1:0,y2:b,styles:{gridLines:x?.xAxis?.gridLines,labels:x?.xAxis?.labels},classNames:{gridLines:u?.xAxis?.gridLines,labels:u?.xAxis?.labels},suffix:ae,prefix:xe,labelType:"primary",showGridLines:!0,precision:S}),i.jsxRuntimeExports.jsx($e.Axis,{x1:r(w<0?0:w),x2:r(w<0?0:w),y1:0,y2:b,label:Ve.numberFormattingFunction(w<0?0:w,"NA",S,xe,ae),labelPos:{x:r(w<0?0:w),y:b,dy:"1em",dx:0},classNames:{axis:u?.xAxis?.axis,label:u?.yAxis?.labels},styles:{axis:x?.xAxis?.axis,label:{textAnchor:"middle",...x?.yAxis?.labels||{}}}}),i.jsxRuntimeExports.jsx(Te.AxisTitle,{x:g/2,y:b+30,style:x?.xAxis?.title,className:u?.xAxis?.title,text:d})]}),fe.filter(e=>e.position==="before").map(e=>e.layer),i.jsxRuntimeExports.jsxs(Xe.AnimatePresence,{children:[m.filter(e=>!c.checkIfNullOrUndefined(e.x)&&!c.checkIfNullOrUndefined(e.y)).map((e,y)=>i.jsxRuntimeExports.jsx("path",{d:U.renderCell(m.findIndex(o=>o.id===e.id)),opacity:0,onMouseEnter:o=>{T(e),v(o.clientY),P(o.clientX),X?.(e)},onMouseMove:o=>{T(e),v(o.clientY),P(o.clientX)},onMouseLeave:()=>{T(void 0),P(void 0),v(void 0),X?.(void 0)},onClick:()=>{(V||k)&&(Ie.isEqual(D,e)&&Q?(Y(void 0),V?.(void 0)):(Y(e),V?.(e)))}},`${e.label||y}`)),m.filter(e=>!c.checkIfNullOrUndefined(e.x)&&!c.checkIfNullOrUndefined(e.y)).map((e,y)=>i.jsxRuntimeExports.jsxs(ie.motion.g,{variants:{initial:{x:r(e.x),y:a(e.y),opacity:W?e.color&&l[C.indexOf(`${e.color}`)]===W?1:A:$?$.id===e.id?1:A:L.length!==0?L.indexOf(e.label||"")!==-1?1:A:1},whileInView:{x:r(e.x),y:a(e.y),opacity:W?e.color&&l[C.indexOf(`${e.color}`)]===W?1:A:$?$.id===e.id?1:A:L.length!==0?L.indexOf(e.label||"")!==-1?1:A:1,transition:{duration:n.duration}}},initial:"initial",animate:p?"whileInView":"initial",exit:{opacity:0,transition:{duration:n.duration}},onMouseEnter:o=>{T(e),v(o.clientY),P(o.clientX),X?.(e)},onMouseMove:o=>{T(e),v(o.clientY),P(o.clientX)},onMouseLeave:()=>{T(void 0),P(void 0),v(void 0),X?.(void 0)},onClick:()=>{(V||k)&&(Ie.isEqual(D,e)&&Q?(Y(void 0),V?.(void 0)):(Y(e),V?.(e)))},children:[i.jsxRuntimeExports.jsx(ie.motion.circle,{cx:0,cy:0,exit:{r:0,transition:{duration:n.duration}},variants:{initial:{r:0,fill:s.filter(o=>o.color).length===0?l[0]:e.color?l[C.indexOf(`${e.color}`)]:N.Colors.gray,stroke:s.filter(o=>o.color).length===0?l[0]:e.color?l[C.indexOf(`${e.color}`)]:N.Colors.gray},whileInView:{r:O?O(e.radius||0):R,fill:s.filter(o=>o.color).length===0?l[0]:e.color?l[C.indexOf(`${e.color}`)]:N.Colors.gray,stroke:s.filter(o=>o.color).length===0?l[0]:e.color?l[C.indexOf(`${e.color}`)]:N.Colors.gray,transition:{duration:n.duration}}},initial:"initial",animate:p?"whileInView":"initial",style:{fillOpacity:.6}}),se&&!c.checkIfNullOrUndefined(e.label)?i.jsxRuntimeExports.jsx(ie.motion.text,{style:{...x?.graphObjectValues||{}},className:i.mo("graph-value text-sm",u?.graphObjectValues),y:0,exit:{opacity:0,transition:{duration:n.duration}},variants:{initial:{x:O?O(e.radius||0):R,opacity:0,fill:Z||(s.filter(o=>o.color).length===0?l[0]:e.color?l[C.indexOf(`${e.color}`)]:N.Colors.gray)},whileInView:{x:O?O(e.radius||0):R,opacity:1,fill:Z||(s.filter(o=>o.color).length===0?l[0]:e.color?l[C.indexOf(`${e.color}`)]:N.Colors.gray),transition:{duration:n.duration}}},initial:"initial",animate:p?"whileInView":"initial",dy:"0.33em",dx:3,children:e.label}):L.length!==0&&!c.checkIfNullOrUndefined(e.label)&&L.indexOf(e.label)!==-1?i.jsxRuntimeExports.jsx(ie.motion.text,{style:{fill:Z||(s.filter(o=>o.color).length===0?l[0]:e.color?l[C.indexOf(`${e.color}`)]:N.Colors.gray),...x?.graphObjectValues||{}},className:i.mo("graph-value text-sm",u?.graphObjectValues),y:0,exit:{opacity:0,transition:{duration:n.duration}},variants:{initial:{x:O?O(e.radius||0):R,opacity:0},whileInView:{x:O?O(e.radius||0):R,opacity:1,transition:{duration:n.duration}}},initial:"initial",animate:p?"whileInView":"initial",dy:"0.33em",dx:3,children:e.label}):null]},`${e.label||y}`)),I.map((e,y)=>i.jsxRuntimeExports.jsx(De.RefLineX,{text:e.text,color:e.color,x:r(e.value),y1:0,y2:b,textSide:r(e.value)>g*.75||K?"left":"right",classNames:e.classNames,styles:e.styles,animate:n,isInView:p},y)),je.map((e,y)=>i.jsxRuntimeExports.jsx(De.RefLineY,{text:e.text,color:e.color,y:a(e.value),x1:0,x2:g,classNames:e.classNames,styles:e.styles,animate:n,isInView:p},y)),i.jsxRuntimeExports.jsx("g",{children:Ce.map((e,y)=>{const o=Ne.getLineEndPoint({x:e.xCoordinate?r(e.xCoordinate)+(e.xOffset||0):0+(e.xOffset||0),y:e.yCoordinate?a(e.yCoordinate)+(e.yOffset||0)-8:0+(e.yOffset||0)-8},{x:e.xCoordinate?r(e.xCoordinate):0,y:e.yCoordinate?a(e.yCoordinate):0},c.checkIfNullOrUndefined(e.connectorRadius)?3.5:e.connectorRadius),Ee=e.showConnector?{y1:o.y,x1:o.x,y2:e.yCoordinate?a(e.yCoordinate)+(e.yOffset||0):0+(e.yOffset||0),x2:e.xCoordinate?r(e.xCoordinate)+(e.xOffset||0):0+(e.xOffset||0),cy:e.yCoordinate?a(e.yCoordinate):0,cx:e.xCoordinate?r(e.xCoordinate):0,circleRadius:c.checkIfNullOrUndefined(e.connectorRadius)?3.5:e.connectorRadius,strokeWidth:e.showConnector===!0?2:Math.min(e.showConnector||0,1)}:void 0,F={y:e.yCoordinate?a(e.yCoordinate)+(e.yOffset||0)-8:0+(e.yOffset||0)-8,x:K?0:e.xCoordinate?r(e.xCoordinate)+(e.xOffset||0):0+(e.xOffset||0),width:K?e.xCoordinate?r(e.xCoordinate)+(e.xOffset||0):0+(e.xOffset||0):g-(e.xCoordinate?r(e.xCoordinate)+(e.xOffset||0):0+(e.xOffset||0)),maxWidth:e.maxWidth,fontWeight:e.fontWeight,align:e.align};return i.jsxRuntimeExports.jsx(Ne.Annotation,{color:e.color,connectorsSettings:Ee,labelSettings:F,text:e.text,classNames:e.classNames,styles:e.styles,animate:n,isInView:p},y)})}),z?i.jsxRuntimeExports.jsx(Be.RegressionLine,{x1:0,x2:g,y1:f(0),y2:f(g),graphHeight:b,graphWidth:g,className:u?.regLine,style:x?.regLine,color:typeof z=="string"?z:void 0,animate:n,isInView:p}):null]}),fe.filter(e=>e.position==="after").map(e=>e.layer)]})}),$&&re&&de&&he?i.jsxRuntimeExports.jsx(He.Tooltip,{data:$,body:re,xPos:de,yPos:he,backgroundStyle:x?.tooltip,className:u?.tooltip}):null,k&&D!==void 0?i.jsxRuntimeExports.jsx(Fe.X,{open:D!==void 0,onClose:()=>{Y(void 0)},children:i.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof k=="string"?{__html:Ge.string2HTML(k,D)}:void 0,children:typeof k=="function"?k(D):null})}):null]})}function nt(ge){const{data:s,graphTitle:q,colors:M,sources:se,graphDescription:l,showLabels:C=!1,height:R,width:d,footNote:J,colorDomain:G,colorLegendTitle:ye,radius:pe=5,xAxisTitle:oe="X Axis",yAxisTitle:re="Y Axis",padding:X,backgroundColor:I=!1,leftMargin:je=0,rightMargin:ve=10,topMargin:W=20,bottomMargin:L=50,tooltip:be,relativeHeight:B,onSeriesMouseOver:w,refXValues:Oe=[],refYValues:E=[],highlightAreaSettings:V=[],showColorScale:K=!0,highlightedDataPoints:Ce=[],graphID:Re,maxRadiusValue:z,maxXValue:Q,minXValue:k,maxYValue:ne,minYValue:le,xSuffix:Z="",ySuffix:ae="",xPrefix:ce="",yPrefix:xe="",onSeriesMouseClick:ue,graphDownload:x=!1,dataDownload:u=!1,language:n="en",showNAColor:A=!0,minHeight:S=0,annotations:fe=[],customHighlightAreaSettings:me=[],theme:p="light",regressionLine:$=!1,ariaLabel:T,resetSelectionOnDoubleClick:D=!0,detailsOnClick:Y,noOfXTicks:de=5,noOfYTicks:P=5,labelColor:he,styles:v,classNames:h,animate:_=!1,dimmedOpacity:g=.3,precision:b=2,customLayers:O=[],timeline:m={enabled:!1,autoplay:!1,showOnlyActiveDate:!0}}=ge,[r,a]=j.useState(0),[ee,te]=j.useState(0),[U,we]=j.useState(m.autoplay),f=Ae.sort(ke.uniqBy(s.filter(t=>t.date!==void 0&&t.date!==null),t=>t.date).map(t=>Me.parse(`${t.date}`,m.dateFormat||"yyyy",new Date).getTime()),(t,H)=>ot.ascending(t,H)),[e,y]=j.useState(m.autoplay?0:f.length-1),[o,Ee]=j.useState(void 0),F=j.useRef(null),Se=j.useRef(null);j.useEffect(()=>{const t=new ResizeObserver(H=>{a(d||H[0].target.clientWidth||620),te(R||H[0].target.clientHeight||480)});return F.current&&(te(F.current.clientHeight||480),a(F.current.clientWidth||620),d||t.observe(F.current)),()=>t.disconnect()},[d,R]),j.useEffect(()=>{const t=setInterval(()=>{y(H=>H<f.length-1?H+1:0)},(m.speed||2)*1e3);return U||clearInterval(t),()=>clearInterval(t)},[f,U,m.speed]);const qe=Ae.getSliderMarks(f,e,m.showOnlyActiveDate,m.dateFormat||"yyyy");return i.jsxRuntimeExports.jsx("div",{className:`${p||"light"} flex ${d?"w-fit grow-0":"w-full grow"}`,dir:n==="he"||n==="ar"?"rtl":void 0,children:i.jsxRuntimeExports.jsx("div",{className:i.mo(`${I?I===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${n||"en"}`,h?.graphContainer),style:{...v?.graphContainer||{},...I&&I!==!0?{backgroundColor:I}:{}},id:Re,ref:Se,"aria-label":T||`${q?`The graph shows ${q}. `:""}This is a scatter plot that shows correlation between two variables.${l?` ${l}`:""}`,children:i.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:I?X||"1rem":X||0},children:i.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[q||l||x||u?i.jsxRuntimeExports.jsx(et.GraphHeader,{styles:{title:v?.title,description:v?.description},classNames:{title:h?.title,description:h?.description},graphTitle:q,graphDescription:l,width:d,graphDownload:x?Se.current:void 0,dataDownload:u?s.map(t=>t.data).filter(t=>t!==void 0).length>0?s.map(t=>t.data).filter(t=>t!==void 0):s.filter(t=>t!==void 0):null}):null,m.enabled&&f.length>0&&qe?i.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[i.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{we(!U)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":U?"Click to pause animation":"Click to play animation",children:U?i.jsxRuntimeExports.jsx(Ye.Pause,{}):i.jsxRuntimeExports.jsx(Ye.Play,{})}),i.jsxRuntimeExports.jsx(Ae.xr,{min:f[0],max:f[f.length-1],marks:qe,step:null,defaultValue:f[f.length-1],value:f[e],onChangeComplete:t=>{y(f.indexOf(t))},onChange:t=>{y(f.indexOf(t))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,i.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:s.length===0?i.jsxRuntimeExports.jsx(it.EmptyState,{}):i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[K&&s.filter(t=>t.color).length!==0?i.jsxRuntimeExports.jsx(tt.ColorLegendWithMouseOver,{width:d,colorLegendTitle:ye,colors:M||N.Colors[p].categoricalColors.colors,colorDomain:G||ke.uniqBy(s.filter(t=>t.color),"color").map(t=>t.color),setSelectedColor:Ee,showNAColor:A}):null,i.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center w-full leading-0",ref:F,"aria-label":"Graph area",children:(d||r)&&(R||ee)?i.jsxRuntimeExports.jsx(rt,{data:st.ensureCompleteDataForScatterPlot(s,m.dateFormat||"yyyy").filter(t=>m.enabled?t.date===Me.format(new Date(f[e]),m.dateFormat||"yyyy"):t),width:d||r,height:Math.max(S,R||(B?S?(d||r)*B>S?(d||r)*B:S:(d||r)*B:ee)),colorDomain:s.filter(t=>t.color).length===0?[]:G||ke.uniqBy(s.filter(t=>t.color),"color").map(t=>t.color),colors:s.filter(t=>t.color).length===0?M?[M]:[N.Colors.primaryColors["blue-600"]]:M||N.Colors[p].categoricalColors.colors,xAxisTitle:oe,yAxisTitle:re,refXValues:Oe,refYValues:E,showLabels:C,radius:pe,leftMargin:je,rightMargin:ve,topMargin:W,bottomMargin:L,tooltip:be,onSeriesMouseOver:w,highlightAreaSettings:V,highlightedDataPoints:s.filter(t=>t.label).length===0?[]:Ce,selectedColor:o,maxRadiusValue:c.checkIfNullOrUndefined(z)?Math.max(...s.map(t=>t.radius).filter(t=>t!=null)):z,maxXValue:c.checkIfNullOrUndefined(Q)?Math.max(...s.map(t=>t.x).filter(t=>t!=null))>0?Math.max(...s.map(t=>t.x).filter(t=>t!=null)):0:Q,minXValue:c.checkIfNullOrUndefined(k)?Math.min(...s.map(t=>t.x).filter(t=>t!=null))>0?0:Math.min(...s.map(t=>t.x).filter(t=>t!=null)):k,maxYValue:c.checkIfNullOrUndefined(ne)?Math.max(...s.map(t=>t.y).filter(t=>t!=null))>0?Math.max(...s.map(t=>t.y).filter(t=>t!=null)):0:ne,minYValue:c.checkIfNullOrUndefined(le)?Math.min(...s.map(t=>t.y).filter(t=>t!=null))>0?0:Math.min(...s.map(t=>t.y).filter(t=>t!=null)):le,onSeriesMouseClick:ue,rtl:n==="he"||n==="ar",annotations:fe,customHighlightAreaSettings:me,regressionLine:$,resetSelectionOnDoubleClick:D,detailsOnClick:Y,noOfXTicks:de,noOfYTicks:P,labelColor:he,xSuffix:Z,ySuffix:ae,xPrefix:ce,yPrefix:xe,styles:v,classNames:h,animate:_===!0?{duration:.5,once:!0,amount:.5}:_||{duration:0,once:!0,amount:0},dimmedOpacity:g,precision:b,customLayers:O}):null})]})}),se||J?i.jsxRuntimeExports.jsx(Ze.GraphFooter,{styles:{footnote:v?.footnote,source:v?.source},classNames:{footnote:h?.footnote,source:h?.source},sources:se,footNote:J,width:d}):null]})})})})}exports.ScatterPlot=nt;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index-CHPV5EwG-DDoeWRVt.cjs"),ke=require("./index-CZbIGs8q.cjs"),Me=require("./parse-hMnG_lRV.cjs"),j=require("react"),Ae=require("./getSliderMarks-CtsEXiLV.cjs"),Ie=require("./index-BXns0-ng.cjs"),Ue=require("./index-BczVvEBZ.cjs"),Le=require("./simple-statistics-xm8c0LQQ.cjs"),Fe=require("./Modal-tXZlLE5s.cjs"),He=require("./Tooltip-n8z5bfav.cjs"),c=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),N=require("./Colors.cjs"),Ve=require("./numberFormattingFunction-02t-wJta.cjs"),Ne=require("./customArea-CK768gCn.cjs"),Ge=require("./string2HTML-D2Avudmb.cjs"),$e=require("./Axis-DE7dSn1_.cjs"),Te=require("./AxisTitle-CK9YeovX.cjs"),We=require("./XTicksAndGridLines-CCzXIV8d.cjs"),De=require("./ReferenceLine-CFVBBN__.cjs"),Be=require("./RegressionLine-xKdiJ8sw.cjs"),ze=require("./YTicksAndGridLines-DBDuz6vb.cjs"),_e=require("./index-DNj994Pv.cjs"),Je=require("./pow-B5-jkdHU.cjs"),Pe=require("./linear-BVckp9RD.cjs"),Ke=require("./delaunay-rcy0HhZi.cjs"),Qe=require("./use-in-view-sQJZ_xDO.cjs"),ie=require("./proxy-BHRoeZgd.cjs"),Xe=require("./index-BW8iNx7E.cjs"),Ze=require("./GraphFooter.cjs"),et=require("./GraphHeader.cjs"),tt=require("./ColorLegendWithMouseOver.cjs"),it=require("./EmptyState-d8_8SxeW.cjs"),Ye=require("./index-BW_-wD2k.cjs"),st=require("./ensureCompleteData-DqWQ2Zbi.cjs"),ot=require("./init-DU0ybBc_.cjs");function rt(ge){const{data:s,width:q,height:M,showLabels:se,colors:l,colorDomain:C,radius:R,xAxisTitle:d,yAxisTitle:J,leftMargin:G,rightMargin:ye,topMargin:pe,bottomMargin:oe,tooltip:re,onSeriesMouseOver:X,refXValues:I,refYValues:je,highlightAreaSettings:ve,selectedColor:W,highlightedDataPoints:L,maxRadiusValue:be,maxXValue:B,minXValue:w,maxYValue:Oe,minYValue:E,onSeriesMouseClick:V,rtl:K,annotations:Ce,customHighlightAreaSettings:Re,regressionLine:z,resetSelectionOnDoubleClick:Q,detailsOnClick:k,noOfXTicks:ne,noOfYTicks:le,labelColor:Z,xSuffix:ae,ySuffix:ce,xPrefix:xe,yPrefix:ue,styles:x,classNames:u,animate:n,dimmedOpacity:A,precision:S,customLayers:fe}=ge,me=j.useRef(null),p=Qe.useInView(me,{once:n.once,amount:n.amount}),[$,T]=j.useState(void 0),[D,Y]=j.useState(void 0),[de,P]=j.useState(void 0),[he,v]=j.useState(void 0),h={top:pe,bottom:d?oe+50:oe,left:J?G+30:G,right:ye},_=s.map((e,y)=>({...e,id:`${y}`})),g=q-h.left-h.right,b=M-h.top-h.bottom,O=s.filter(e=>e.radius===void 0||e.radius===null).length!==s.length?Je.sqrt().domain([0,be]).range([.25,R]).nice():void 0,m=_.filter(e=>!c.checkIfNullOrUndefined(e.radius)).length===0?_:Ue.orderBy(_.filter(e=>!c.checkIfNullOrUndefined(e.radius)),"radius","desc"),r=Pe.linear().domain([w,B]).range([0,g]).nice(),a=Pe.linear().domain([E,Oe]).range([b,0]).nice(),ee=r.ticks(ne),te=a.ticks(le),U=Ke.Delaunay.from(m.filter(e=>!c.checkIfNullOrUndefined(e.x)&&!c.checkIfNullOrUndefined(e.y)),e=>r(e.x),e=>a(e.y)).voronoi([0,0,g<0?0:g,b<0?0:b]),we=Le.linearRegression(s.filter(e=>!c.checkIfNullOrUndefined(e.x)&&!c.checkIfNullOrUndefined(e.y)).map(e=>[r(e.x),a(e.y)])),f=Le.linearRegressionLine(we);return i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[i.jsxRuntimeExports.jsx(ie.motion.svg,{width:`${q}px`,height:`${M}px`,viewBox:`0 0 ${q} ${M}`,direction:"ltr",ref:me,children:i.jsxRuntimeExports.jsxs("g",{transform:`translate(${h.left},${h.top})`,children:[i.jsxRuntimeExports.jsxs(Xe.AnimatePresence,{children:[i.jsxRuntimeExports.jsx(_e.HighlightAreaForScatterPlot,{areaSettings:ve,width:g,height:b,scaleX:r,scaleY:a,animate:n,isInView:p}),i.jsxRuntimeExports.jsx(Ne.CustomArea,{areaSettings:Re,scaleX:r,scaleY:a,animate:n,isInView:p})]}),i.jsxRuntimeExports.jsxs("g",{children:[i.jsxRuntimeExports.jsx(ze.YTicksAndGridLines,{values:te.filter(e=>e!==0),y:te.filter(e=>e!==0).map(e=>a(e)),x1:0,x2:g+h.right,styles:{gridLines:x?.yAxis?.gridLines,labels:x?.yAxis?.labels},classNames:{gridLines:u?.yAxis?.gridLines,labels:u?.yAxis?.labels},suffix:ce,prefix:ue,labelType:"secondary",showGridLines:!0,labelPos:"side",precision:S}),i.jsxRuntimeExports.jsx($e.Axis,{y1:a(E<0?0:E),y2:a(E<0?0:E),x1:0,x2:g+h.right,label:Ve.numberFormattingFunction(E<0?0:E,"NA",S,ue,ce),labelPos:{x:0,y:a(E<0?0:E),dy:"0.33em",dx:-4},classNames:{axis:u?.xAxis?.axis,label:u?.yAxis?.labels},styles:{axis:x?.xAxis?.axis,label:{textAnchor:"end",...x?.yAxis?.labels||{}}}}),i.jsxRuntimeExports.jsx(Te.AxisTitle,{x:0-G-15,y:b/2,style:x?.yAxis?.title,className:u?.yAxis?.title,text:J,rotate90:!0})]}),i.jsxRuntimeExports.jsxs("g",{children:[i.jsxRuntimeExports.jsx(We.XTicksAndGridLines,{values:ee.filter(e=>e!==0),x:ee.filter(e=>e!==0).map(e=>r(e)),y1:0,y2:b,styles:{gridLines:x?.xAxis?.gridLines,labels:x?.xAxis?.labels},classNames:{gridLines:u?.xAxis?.gridLines,labels:u?.xAxis?.labels},suffix:ae,prefix:xe,labelType:"primary",showGridLines:!0,precision:S}),i.jsxRuntimeExports.jsx($e.Axis,{x1:r(w<0?0:w),x2:r(w<0?0:w),y1:0,y2:b,label:Ve.numberFormattingFunction(w<0?0:w,"NA",S,xe,ae),labelPos:{x:r(w<0?0:w),y:b,dy:"1em",dx:0},classNames:{axis:u?.xAxis?.axis,label:u?.yAxis?.labels},styles:{axis:x?.xAxis?.axis,label:{textAnchor:"middle",...x?.yAxis?.labels||{}}}}),i.jsxRuntimeExports.jsx(Te.AxisTitle,{x:g/2,y:b+30,style:x?.xAxis?.title,className:u?.xAxis?.title,text:d})]}),fe.filter(e=>e.position==="before").map(e=>e.layer),i.jsxRuntimeExports.jsxs(Xe.AnimatePresence,{children:[m.filter(e=>!c.checkIfNullOrUndefined(e.x)&&!c.checkIfNullOrUndefined(e.y)).map((e,y)=>i.jsxRuntimeExports.jsx("path",{d:U.renderCell(m.findIndex(o=>o.id===e.id)),opacity:0,onMouseEnter:o=>{T(e),v(o.clientY),P(o.clientX),X?.(e)},onMouseMove:o=>{T(e),v(o.clientY),P(o.clientX)},onMouseLeave:()=>{T(void 0),P(void 0),v(void 0),X?.(void 0)},onClick:()=>{(V||k)&&(Ie.isEqual(D,e)&&Q?(Y(void 0),V?.(void 0)):(Y(e),V?.(e)))}},`${e.label||y}`)),m.filter(e=>!c.checkIfNullOrUndefined(e.x)&&!c.checkIfNullOrUndefined(e.y)).map((e,y)=>i.jsxRuntimeExports.jsxs(ie.motion.g,{variants:{initial:{x:r(e.x),y:a(e.y),opacity:W?e.color&&l[C.indexOf(`${e.color}`)]===W?1:A:$?$.id===e.id?1:A:L.length!==0?L.indexOf(e.label||"")!==-1?1:A:1},whileInView:{x:r(e.x),y:a(e.y),opacity:W?e.color&&l[C.indexOf(`${e.color}`)]===W?1:A:$?$.id===e.id?1:A:L.length!==0?L.indexOf(e.label||"")!==-1?1:A:1,transition:{duration:n.duration}}},initial:"initial",animate:p?"whileInView":"initial",exit:{opacity:0,transition:{duration:n.duration}},onMouseEnter:o=>{T(e),v(o.clientY),P(o.clientX),X?.(e)},onMouseMove:o=>{T(e),v(o.clientY),P(o.clientX)},onMouseLeave:()=>{T(void 0),P(void 0),v(void 0),X?.(void 0)},onClick:()=>{(V||k)&&(Ie.isEqual(D,e)&&Q?(Y(void 0),V?.(void 0)):(Y(e),V?.(e)))},children:[i.jsxRuntimeExports.jsx(ie.motion.circle,{cx:0,cy:0,exit:{r:0,transition:{duration:n.duration}},variants:{initial:{r:0,fill:s.filter(o=>o.color).length===0?l[0]:e.color?l[C.indexOf(`${e.color}`)]:N.Colors.gray,stroke:s.filter(o=>o.color).length===0?l[0]:e.color?l[C.indexOf(`${e.color}`)]:N.Colors.gray},whileInView:{r:O?O(e.radius||0):R,fill:s.filter(o=>o.color).length===0?l[0]:e.color?l[C.indexOf(`${e.color}`)]:N.Colors.gray,stroke:s.filter(o=>o.color).length===0?l[0]:e.color?l[C.indexOf(`${e.color}`)]:N.Colors.gray,transition:{duration:n.duration}}},initial:"initial",animate:p?"whileInView":"initial",style:{fillOpacity:.6}}),se&&!c.checkIfNullOrUndefined(e.label)?i.jsxRuntimeExports.jsx(ie.motion.text,{style:{...x?.graphObjectValues||{}},className:i.mo("graph-value text-sm",u?.graphObjectValues),y:0,exit:{opacity:0,transition:{duration:n.duration}},variants:{initial:{x:O?O(e.radius||0):R,opacity:0,fill:Z||(s.filter(o=>o.color).length===0?l[0]:e.color?l[C.indexOf(`${e.color}`)]:N.Colors.gray)},whileInView:{x:O?O(e.radius||0):R,opacity:1,fill:Z||(s.filter(o=>o.color).length===0?l[0]:e.color?l[C.indexOf(`${e.color}`)]:N.Colors.gray),transition:{duration:n.duration}}},initial:"initial",animate:p?"whileInView":"initial",dy:"0.33em",dx:3,children:e.label}):L.length!==0&&!c.checkIfNullOrUndefined(e.label)&&L.indexOf(e.label)!==-1?i.jsxRuntimeExports.jsx(ie.motion.text,{style:{fill:Z||(s.filter(o=>o.color).length===0?l[0]:e.color?l[C.indexOf(`${e.color}`)]:N.Colors.gray),...x?.graphObjectValues||{}},className:i.mo("graph-value text-sm",u?.graphObjectValues),y:0,exit:{opacity:0,transition:{duration:n.duration}},variants:{initial:{x:O?O(e.radius||0):R,opacity:0},whileInView:{x:O?O(e.radius||0):R,opacity:1,transition:{duration:n.duration}}},initial:"initial",animate:p?"whileInView":"initial",dy:"0.33em",dx:3,children:e.label}):null]},`${e.label||y}`)),I.map((e,y)=>i.jsxRuntimeExports.jsx(De.RefLineX,{text:e.text,color:e.color,x:r(e.value),y1:0,y2:b,textSide:r(e.value)>g*.75||K?"left":"right",classNames:e.classNames,styles:e.styles,animate:n,isInView:p},y)),je.map((e,y)=>i.jsxRuntimeExports.jsx(De.RefLineY,{text:e.text,color:e.color,y:a(e.value),x1:0,x2:g,classNames:e.classNames,styles:e.styles,animate:n,isInView:p},y)),i.jsxRuntimeExports.jsx("g",{children:Ce.map((e,y)=>{const o=Ne.getLineEndPoint({x:e.xCoordinate?r(e.xCoordinate)+(e.xOffset||0):0+(e.xOffset||0),y:e.yCoordinate?a(e.yCoordinate)+(e.yOffset||0)-8:0+(e.yOffset||0)-8},{x:e.xCoordinate?r(e.xCoordinate):0,y:e.yCoordinate?a(e.yCoordinate):0},c.checkIfNullOrUndefined(e.connectorRadius)?3.5:e.connectorRadius),Ee=e.showConnector?{y1:o.y,x1:o.x,y2:e.yCoordinate?a(e.yCoordinate)+(e.yOffset||0):0+(e.yOffset||0),x2:e.xCoordinate?r(e.xCoordinate)+(e.xOffset||0):0+(e.xOffset||0),cy:e.yCoordinate?a(e.yCoordinate):0,cx:e.xCoordinate?r(e.xCoordinate):0,circleRadius:c.checkIfNullOrUndefined(e.connectorRadius)?3.5:e.connectorRadius,strokeWidth:e.showConnector===!0?2:Math.min(e.showConnector||0,1)}:void 0,F={y:e.yCoordinate?a(e.yCoordinate)+(e.yOffset||0)-8:0+(e.yOffset||0)-8,x:K?0:e.xCoordinate?r(e.xCoordinate)+(e.xOffset||0):0+(e.xOffset||0),width:K?e.xCoordinate?r(e.xCoordinate)+(e.xOffset||0):0+(e.xOffset||0):g-(e.xCoordinate?r(e.xCoordinate)+(e.xOffset||0):0+(e.xOffset||0)),maxWidth:e.maxWidth,fontWeight:e.fontWeight,align:e.align};return i.jsxRuntimeExports.jsx(Ne.Annotation,{color:e.color,connectorsSettings:Ee,labelSettings:F,text:e.text,classNames:e.classNames,styles:e.styles,animate:n,isInView:p},y)})}),z?i.jsxRuntimeExports.jsx(Be.RegressionLine,{x1:0,x2:g,y1:f(0),y2:f(g),graphHeight:b,graphWidth:g,className:u?.regLine,style:x?.regLine,color:typeof z=="string"?z:void 0,animate:n,isInView:p}):null]}),fe.filter(e=>e.position==="after").map(e=>e.layer)]})}),$&&re&&de&&he?i.jsxRuntimeExports.jsx(He.Tooltip,{data:$,body:re,xPos:de,yPos:he,backgroundStyle:x?.tooltip,className:u?.tooltip}):null,k&&D!==void 0?i.jsxRuntimeExports.jsx(Fe.X,{open:D!==void 0,onClose:()=>{Y(void 0)},children:i.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof k=="string"?{__html:Ge.string2HTML(k,D)}:void 0,children:typeof k=="function"?k(D):null})}):null]})}function nt(ge){const{data:s,graphTitle:q,colors:M,sources:se,graphDescription:l,showLabels:C=!1,height:R,width:d,footNote:J,colorDomain:G,colorLegendTitle:ye,radius:pe=5,xAxisTitle:oe="X Axis",yAxisTitle:re="Y Axis",padding:X,backgroundColor:I=!1,leftMargin:je=0,rightMargin:ve=10,topMargin:W=20,bottomMargin:L=50,tooltip:be,relativeHeight:B,onSeriesMouseOver:w,refXValues:Oe=[],refYValues:E=[],highlightAreaSettings:V=[],showColorScale:K=!0,highlightedDataPoints:Ce=[],graphID:Re,maxRadiusValue:z,maxXValue:Q,minXValue:k,maxYValue:ne,minYValue:le,xSuffix:Z="",ySuffix:ae="",xPrefix:ce="",yPrefix:xe="",onSeriesMouseClick:ue,graphDownload:x=!1,dataDownload:u=!1,language:n="en",showNAColor:A=!0,minHeight:S=0,annotations:fe=[],customHighlightAreaSettings:me=[],theme:p="light",regressionLine:$=!1,ariaLabel:T,resetSelectionOnDoubleClick:D=!0,detailsOnClick:Y,noOfXTicks:de=5,noOfYTicks:P=5,labelColor:he,styles:v,classNames:h,animate:_=!1,dimmedOpacity:g=.3,precision:b=2,customLayers:O=[],timeline:m={enabled:!1,autoplay:!1,showOnlyActiveDate:!0}}=ge,[r,a]=j.useState(0),[ee,te]=j.useState(0),[U,we]=j.useState(m.autoplay),f=Ae.sort(ke.uniqBy(s.filter(t=>t.date!==void 0&&t.date!==null),t=>t.date).map(t=>Me.parse(`${t.date}`,m.dateFormat||"yyyy",new Date).getTime()),(t,H)=>ot.ascending(t,H)),[e,y]=j.useState(m.autoplay?0:f.length-1),[o,Ee]=j.useState(void 0),F=j.useRef(null),Se=j.useRef(null);j.useEffect(()=>{const t=new ResizeObserver(H=>{a(d||H[0].target.clientWidth||620),te(R||H[0].target.clientHeight||480)});return F.current&&(te(F.current.clientHeight||480),a(F.current.clientWidth||620),d||t.observe(F.current)),()=>t.disconnect()},[d,R]),j.useEffect(()=>{const t=setInterval(()=>{y(H=>H<f.length-1?H+1:0)},(m.speed||2)*1e3);return U||clearInterval(t),()=>clearInterval(t)},[f,U,m.speed]);const qe=Ae.getSliderMarks(f,e,m.showOnlyActiveDate,m.dateFormat||"yyyy");return i.jsxRuntimeExports.jsx("div",{className:`${p||"light"} flex ${d?"w-fit grow-0":"w-full grow"}`,dir:n==="he"||n==="ar"?"rtl":void 0,children:i.jsxRuntimeExports.jsx("div",{className:i.mo(`${I?I===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${n||"en"}`,h?.graphContainer),style:{...v?.graphContainer||{},...I&&I!==!0?{backgroundColor:I}:{}},id:Re,ref:Se,"aria-label":T||`${q?`The graph shows ${q}. `:""}This is a scatter plot that shows correlation between two variables.${l?` ${l}`:""}`,children:i.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:I?X||"1rem":X||0},children:i.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[q||l||x||u?i.jsxRuntimeExports.jsx(et.GraphHeader,{styles:{title:v?.title,description:v?.description},classNames:{title:h?.title,description:h?.description},graphTitle:q,graphDescription:l,width:d,graphDownload:x?Se.current:void 0,dataDownload:u?s.map(t=>t.data).filter(t=>t!==void 0).length>0?s.map(t=>t.data).filter(t=>t!==void 0):s.filter(t=>t!==void 0):null}):null,m.enabled&&f.length>0&&qe?i.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[i.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{we(!U)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":U?"Click to pause animation":"Click to play animation",children:U?i.jsxRuntimeExports.jsx(Ye.Pause,{}):i.jsxRuntimeExports.jsx(Ye.Play,{})}),i.jsxRuntimeExports.jsx(Ae.xr,{min:f[0],max:f[f.length-1],marks:qe,step:null,defaultValue:f[f.length-1],value:f[e],onChangeComplete:t=>{y(f.indexOf(t))},onChange:t=>{y(f.indexOf(t))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,i.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:s.length===0?i.jsxRuntimeExports.jsx(it.EmptyState,{}):i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[K&&s.filter(t=>t.color).length!==0?i.jsxRuntimeExports.jsx(tt.ColorLegendWithMouseOver,{width:d,colorLegendTitle:ye,colors:M||N.Colors[p].categoricalColors.colors,colorDomain:G||ke.uniqBy(s.filter(t=>t.color),"color").map(t=>t.color),setSelectedColor:Ee,showNAColor:A}):null,i.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center w-full leading-0",ref:F,"aria-label":"Graph area",children:(d||r)&&(R||ee)?i.jsxRuntimeExports.jsx(rt,{data:st.ensureCompleteDataForScatterPlot(s,m.dateFormat||"yyyy").filter(t=>m.enabled?t.date===Me.format(new Date(f[e]),m.dateFormat||"yyyy"):t),width:d||r,height:Math.max(S,R||(B?S?(d||r)*B>S?(d||r)*B:S:(d||r)*B:ee)),colorDomain:s.filter(t=>t.color).length===0?[]:G||ke.uniqBy(s.filter(t=>t.color),"color").map(t=>t.color),colors:s.filter(t=>t.color).length===0?M?[M]:[N.Colors.primaryColors["blue-600"]]:M||N.Colors[p].categoricalColors.colors,xAxisTitle:oe,yAxisTitle:re,refXValues:Oe,refYValues:E,showLabels:C,radius:pe,leftMargin:je,rightMargin:ve,topMargin:W,bottomMargin:L,tooltip:be,onSeriesMouseOver:w,highlightAreaSettings:V,highlightedDataPoints:s.filter(t=>t.label).length===0?[]:Ce,selectedColor:o,maxRadiusValue:c.checkIfNullOrUndefined(z)?Math.max(...s.map(t=>t.radius).filter(t=>t!=null)):z,maxXValue:c.checkIfNullOrUndefined(Q)?Math.max(...s.map(t=>t.x).filter(t=>t!=null))>0?Math.max(...s.map(t=>t.x).filter(t=>t!=null)):0:Q,minXValue:c.checkIfNullOrUndefined(k)?Math.min(...s.map(t=>t.x).filter(t=>t!=null))>0?0:Math.min(...s.map(t=>t.x).filter(t=>t!=null)):k,maxYValue:c.checkIfNullOrUndefined(ne)?Math.max(...s.map(t=>t.y).filter(t=>t!=null))>0?Math.max(...s.map(t=>t.y).filter(t=>t!=null)):0:ne,minYValue:c.checkIfNullOrUndefined(le)?Math.min(...s.map(t=>t.y).filter(t=>t!=null))>0?0:Math.min(...s.map(t=>t.y).filter(t=>t!=null)):le,onSeriesMouseClick:ue,rtl:n==="he"||n==="ar",annotations:fe,customHighlightAreaSettings:me,regressionLine:$,resetSelectionOnDoubleClick:D,detailsOnClick:Y,noOfXTicks:de,noOfYTicks:P,labelColor:he,xSuffix:Z,ySuffix:ae,xPrefix:ce,yPrefix:xe,styles:v,classNames:h,animate:_===!0?{duration:.5,once:!0,amount:.5}:_||{duration:0,once:!0,amount:0},dimmedOpacity:g,precision:b,customLayers:O}):null})]})}),se||J?i.jsxRuntimeExports.jsx(Ze.GraphFooter,{styles:{footnote:v?.footnote,source:v?.source},classNames:{footnote:h?.footnote,source:h?.source},sources:se,footNote:J,width:d}):null]})})})})}exports.ScatterPlot=nt;
|
|
2
2
|
//# sourceMappingURL=ScatterPlot.cjs.map
|
package/dist/ScatterPlot.js
CHANGED
|
@@ -6,26 +6,26 @@ import { s as We, g as Fe, x as Ee } from "./getSliderMarks-C0jptXeP.js";
|
|
|
6
6
|
import { i as $e } from "./index-27yTRcko.js";
|
|
7
7
|
import { o as Ge } from "./index-BLizQDlg.js";
|
|
8
8
|
import { l as qe, a as Be } from "./simple-statistics-flVzqVtt.js";
|
|
9
|
-
import { X as ze } from "./Modal-
|
|
9
|
+
import { X as ze } from "./Modal-DVVwpKhP.js";
|
|
10
10
|
import { T as Ue } from "./Tooltip-DyM5snqx.js";
|
|
11
11
|
import { c } from "./checkIfNullOrUndefined-DmfiKkNw.js";
|
|
12
12
|
import { Colors as N } from "./Colors.js";
|
|
13
13
|
import { n as Te } from "./numberFormattingFunction-14YCbkN2.js";
|
|
14
|
-
import { C as _e, g as Je, A as Ke } from "./customArea-
|
|
14
|
+
import { C as _e, g as Je, A as Ke } from "./customArea-B-dWU0zZ.js";
|
|
15
15
|
import { s as Qe } from "./string2HTML-CWHGfz_d.js";
|
|
16
16
|
import { A as Pe } from "./Axis-Ddg-seDi.js";
|
|
17
17
|
import { A as Xe } from "./AxisTitle-BmHLMRJZ.js";
|
|
18
18
|
import { X as Ze } from "./XTicksAndGridLines-Bn9u5gOM.js";
|
|
19
|
-
import { a as ei, R as ii } from "./ReferenceLine-
|
|
20
|
-
import { R as ti } from "./RegressionLine-
|
|
19
|
+
import { a as ei, R as ii } from "./ReferenceLine-CfAW3vKJ.js";
|
|
20
|
+
import { R as ti } from "./RegressionLine-mH7UKOPi.js";
|
|
21
21
|
import { Y as oi } from "./YTicksAndGridLines-B6ah7CRf.js";
|
|
22
|
-
import { a as ai } from "./index-
|
|
23
|
-
import {
|
|
24
|
-
import { s as li } from "./pow-e8zx3AQJ.js";
|
|
22
|
+
import { a as ai } from "./index-Cdcfp4nk.js";
|
|
23
|
+
import { s as ri } from "./pow-e8zx3AQJ.js";
|
|
25
24
|
import { a as Ye } from "./linear-DUdu7l2G.js";
|
|
26
|
-
import { D as
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
25
|
+
import { D as li } from "./delaunay-C1uAf38t.js";
|
|
26
|
+
import { u as si } from "./use-in-view-yS6jzJAp.js";
|
|
27
|
+
import { m as te } from "./proxy-CkpFesk1.js";
|
|
28
|
+
import { A as Ie } from "./index-CNvov0eg.js";
|
|
29
29
|
import { GraphFooter as ni } from "./GraphFooter.js";
|
|
30
30
|
import { GraphHeader as ci } from "./GraphHeader.js";
|
|
31
31
|
import { ColorLegendWithMouseOver as xi } from "./ColorLegendWithMouseOver.js";
|
|
@@ -80,7 +80,7 @@ function yi(ye) {
|
|
|
80
80
|
dimmedOpacity: k,
|
|
81
81
|
precision: S,
|
|
82
82
|
customLayers: fe
|
|
83
|
-
} = ye, ue = Se(null), p =
|
|
83
|
+
} = ye, ue = Se(null), p = si(ue, {
|
|
84
84
|
once: l.once,
|
|
85
85
|
amount: l.amount
|
|
86
86
|
}), [X, Y] = V(void 0), [I, W] = V(void 0), [ge, R] = V(void 0), [he, v] = V(void 0), h = {
|
|
@@ -88,11 +88,11 @@ function yi(ye) {
|
|
|
88
88
|
bottom: g ? ae + 50 : ae,
|
|
89
89
|
left: J ? q + 30 : q,
|
|
90
90
|
right: de
|
|
91
|
-
}, _ = o.map((e, d) => ({ ...e, id: `${d}` })), y = L - h.left - h.right, b = D - h.top - h.bottom, C = o.filter((e) => e.radius === void 0 || e.radius === null).length !== o.length ?
|
|
91
|
+
}, _ = o.map((e, d) => ({ ...e, id: `${d}` })), y = L - h.left - h.right, b = D - h.top - h.bottom, C = o.filter((e) => e.radius === void 0 || e.radius === null).length !== o.length ? ri().domain([0, Ce]).range([0.25, O]).nice() : void 0, u = _.filter((e) => !c(e.radius)).length === 0 ? _ : Ge(
|
|
92
92
|
_.filter((e) => !c(e.radius)),
|
|
93
93
|
"radius",
|
|
94
94
|
"desc"
|
|
95
|
-
), r = Ye().domain([j, z]).range([0, y]).nice(), n = Ye().domain([A, we]).range([b, 0]).nice(), ee = r.ticks(le), ie = n.ticks(se), F =
|
|
95
|
+
), r = Ye().domain([j, z]).range([0, y]).nice(), n = Ye().domain([A, we]).range([b, 0]).nice(), ee = r.ticks(le), ie = n.ticks(se), F = li.from(
|
|
96
96
|
u.filter((e) => !c(e.x) && !c(e.y)),
|
|
97
97
|
(e) => r(e.x),
|
|
98
98
|
(e) => n(e.y)
|
package/dist/ScrollStory.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-CHPV5EwG-DDoeWRVt.cjs"),x=require("react"),d=require("./SingleGraphDashboard.cjs"),y=require("./proxy-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-CHPV5EwG-DDoeWRVt.cjs"),x=require("react"),d=require("./SingleGraphDashboard.cjs"),y=require("./proxy-BHRoeZgd.cjs"),m=require("./use-in-view-sQJZ_xDO.cjs");function S(o){const{chapters:l,visibilityThreshold:u=.5,mode:n="overlay",infoWidth:a="320px",infoPosition:s="left",infoBackgroundColor:h="rgba(255,255,255,0.8)"}=o,[i,c]=x.useState(0),e=[];return l.forEach((t,p)=>{t.sections.forEach((g,f)=>{e.push({chapter:p,dataSettings:t.dataSettings,section:f,graphType:t.graphType,infoBox:g.infoBox,graphSettings:{...t.graphSettings,...g.graphSettings||{},animate:!0},graphDataConfiguration:g.graphDataConfiguration||t.graphDataConfiguration||[]})})}),r.jsxRuntimeExports.jsxs("div",{className:"relative w-full h-full",children:[r.jsxRuntimeExports.jsx(y.motion.div,{className:"fixed top-0 h-full -z-10",initial:{opacity:0},animate:{opacity:1},transition:{duration:.5},style:{left:n==="overlay"||s==="right"?0:a,width:n==="overlay"?"100%":`calc(100% - ${a})`},children:r.jsxRuntimeExports.jsx(d.SingleGraphDashboard,{graphType:e[i].graphType,dataSettings:e[i].dataSettings,graphSettings:e[i].graphSettings,graphDataConfiguration:e[i].graphDataConfiguration})},e[i].chapter),r.jsxRuntimeExports.jsx("div",{children:e.map((t,p)=>r.jsxRuntimeExports.jsx(j,{width:a,index:p,infoBox:t.infoBox,setActiveIndex:c,position:s,mode:n,visibilityThreshold:u,backgroundColor:h},`${t.chapter}-${t.section}`))})]})}function j({infoBox:o,index:l,setActiveIndex:u,position:n,mode:a,visibilityThreshold:s,backgroundColor:h,width:i}){const c=x.useRef(null);return m.useInView(c,{once:!1,amount:s})&&u(l),r.jsxRuntimeExports.jsx("section",{ref:c,className:`min-h-screen flex ${n==="center"?"justify-center":n==="right"?"justify-end":"justify-start"}`,children:r.jsxRuntimeExports.jsxs("div",{className:`p-8 ${a==="overlay"?"h-fit mx-10 ":""}`,style:{backgroundColor:h,width:i},children:[o.title,o.description]})})}exports.ScrollStory=S;
|
|
2
2
|
//# sourceMappingURL=ScrollStory.cjs.map
|
package/dist/ScrollStory.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { j as e } from "./index-CHPV5EwG-BPSP-7Jg.js";
|
|
2
2
|
import { useState as d, useRef as m } from "react";
|
|
3
3
|
import { SingleGraphDashboard as x } from "./SingleGraphDashboard.js";
|
|
4
|
-
import { m as y } from "./proxy-
|
|
5
|
-
import { u as S } from "./use-in-view-
|
|
4
|
+
import { m as y } from "./proxy-CkpFesk1.js";
|
|
5
|
+
import { u as S } from "./use-in-view-yS6jzJAp.js";
|
|
6
6
|
function T(o) {
|
|
7
7
|
const {
|
|
8
8
|
chapters: l,
|
package/dist/SimpleLineChart.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-CHPV5EwG-DDoeWRVt.cjs"),h=require("react"),x=require("./parse-hMnG_lRV.cjs"),Ce=require("./index-BzeLQvXk.cjs"),Re=require("./simple-statistics-xm8c0LQQ.cjs"),Ee=require("./numberFormattingFunction-02t-wJta.cjs"),Oe=require("./Tooltip-n8z5bfav.cjs"),S=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),fe=require("./customArea-BYNyxAkm.cjs"),Le=require("./Axis-DE7dSn1_.cjs"),Ne=require("./AxisTitle-CK9YeovX.cjs"),ke=require("./XTicksAndGridLines-CCzXIV8d.cjs"),Se=require("./ReferenceLine-CuFMk0cI.cjs"),De=require("./RegressionLine-7_rKTHN_.cjs"),qe=require("./YTicksAndGridLines-DBDuz6vb.cjs"),$e=require("./index-CylX-pWB.cjs"),Te=require("./use-in-view-BCmzDU2O.cjs"),Ie=require("./time-Byw_jYQ7.cjs"),Me=require("./linear-BVckp9RD.cjs"),be=require("./line-DHV4JwCR.cjs"),ne=require("./step-BZ3C8QFW.cjs"),Ve=require("./select-Bnfk0lJx.cjs"),F=require("./proxy-PQd2AItT.cjs"),Fe=require("./init-DU0ybBc_.cjs"),He=require("./pointer-Dkq5NV1q.cjs"),Ge=require("./GraphFooter.cjs"),Pe=require("./GraphHeader.cjs"),We=require("./Colors.cjs"),Ye=require("./EmptyState-d8_8SxeW.cjs");function Xe(re){const{data:O,width:b,height:$,lineColor:H,suffix:L,prefix:D,dateFormat:r,highlightAreaSettings:q,showValues:u,noOfXTicks:G,rightMargin:oe,leftMargin:j,topMargin:ae,bottomMargin:P,tooltip:v,onSeriesMouseOver:T,refValues:W,minValue:Y,maxValue:X,animate:s,rtl:U,strokeWidth:le,showDots:ce,annotations:xe,customHighlightAreaSettings:ue,regressionLine:I,yAxisTitle:B,noOfYTicks:me,maxDate:M,minDate:V,curveType:N,styles:a,classNames:m,precision:w,customLayers:z}=re,J=h.useRef(null),d=Te.useInView(J,{once:s.once,amount:s.amount}),[A,pe]=h.useState(!1);h.useEffect(()=>{if(d&&!A){const e=setTimeout(()=>{pe(!0)},(s.duration+.5)*1e3);return()=>clearTimeout(e)}},[d,A,s.duration]);const he=N==="linear"?be.curveLinear:N==="step"?ne.curveStep:N==="stepAfter"?ne.stepAfter:N==="stepBefore"?ne.stepBefore:ne.monotoneX,[k,K]=h.useState(void 0),[Q,Z]=h.useState(void 0),[R,E]=h.useState(void 0),f={top:ae,bottom:P,left:B?j+30:j,right:oe},_=h.useRef(null),i=Ce.sortBy(O.map(e=>({...e,date:x.parse(`${e.date}`,r,new Date)})),"date"),ee=q.map(e=>({...e,coordinates:[e.coordinates[0]===null?null:x.parse(`${e.coordinates[0]}`,r,new Date),e.coordinates[1]===null?null:x.parse(`${e.coordinates[1]}`,r,new Date)]})),te=ue.map(e=>({...e,coordinates:e.coordinates.map((y,C)=>C%2===0?x.parse(`${y}`,r,new Date):y)})),l=b-f.left-f.right,p=$-f.top-f.bottom,ie=V?x.parse(`${V}`,r,new Date):i[0].date,c=M?x.parse(`${M}`,r,new Date):i[i.length-1].date,g=S.checkIfNullOrUndefined(Y)?Math.min(...i.map(e=>e.y).filter(e=>e!=null))!==1/0?Math.min(...i.map(e=>e.y).filter(e=>e!=null))>0?0:Math.min(...i.map(e=>e.y).filter(e=>e!=null)):0:Y,de=Math.max(...i.map(e=>e.y).filter(e=>e!=null))!==1/0?Math.max(...i.map(e=>e.y).filter(e=>e!=null)):0,n=Ie.time().domain([ie,c]).range([0,l]),o=Me.linear().domain([g,S.checkIfNullOrUndefined(X)?de>0?de:0:X]).range([p,0]).nice(),ye=be.line().x(e=>n(e.date)).y(e=>o(e.y)).curve(he),je=o.ticks(me),ve=n.ticks(G);h.useEffect(()=>{const e=C=>{const se=i[Fe.bisectCenter(i.map(ge=>ge.date),n.invert(He.pointer(C)[0]),1)];K(se||i[i.length-1]),T?.(se||i[i.length-1]),E(C.clientY),Z(C.clientX)},y=()=>{K(void 0),Z(void 0),E(void 0),T?.(void 0)};Ve.select(_.current).on("mousemove",e).on("mouseout",y)},[n,i,T]);const Ae=Re.linearRegression(i.filter(e=>!S.checkIfNullOrUndefined(e.date)&&!S.checkIfNullOrUndefined(e.y)).map(e=>[n(e.date),o(e.y)])),we=Re.linearRegressionLine(Ae);return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(F.motion.svg,{width:`${b}px`,height:`${$}px`,viewBox:`0 0 ${b} ${$}`,direction:"ltr",ref:J,children:t.jsxRuntimeExports.jsxs("g",{transform:`translate(${f.left},${f.top})`,children:[t.jsxRuntimeExports.jsx($e.HighlightArea,{areaSettings:ee,width:l,height:p,scale:n,animate:s,isInView:d}),t.jsxRuntimeExports.jsx(fe.CustomArea,{areaSettings:te,scaleX:n,scaleY:o,animate:s,isInView:d}),t.jsxRuntimeExports.jsxs("g",{children:[t.jsxRuntimeExports.jsx(qe.YTicksAndGridLines,{values:je.filter(e=>e!==0),y:je.filter(e=>e!==0).map(e=>o(e)),x1:0-j,x2:l+f.right,styles:{gridLines:a?.yAxis?.gridLines,labels:a?.yAxis?.labels},classNames:{gridLines:m?.yAxis?.gridLines,labels:m?.yAxis?.labels},suffix:L,prefix:D,labelType:"secondary",showGridLines:!0,labelPos:"vertical",precision:w}),t.jsxRuntimeExports.jsx(Le.Axis,{y1:o(g<0?0:g),y2:o(g<0?0:g),x1:0-j,x2:l+f.right,label:Ee.numberFormattingFunction(g<0?0:g,"NA",w,D,L),labelPos:{x:0-j,y:o(g<0?0:g),dx:0,dy:de<0?"1em":-5},classNames:{axis:m?.xAxis?.axis,label:m?.yAxis?.labels},styles:{axis:a?.xAxis?.axis,label:a?.yAxis?.labels}}),t.jsxRuntimeExports.jsx(Ne.AxisTitle,{x:0-j-15,y:p/2,style:a?.yAxis?.title,className:m?.yAxis?.title,text:B,rotate90:!0})]}),t.jsxRuntimeExports.jsx(ke.XTicksAndGridLines,{values:ve.map(e=>x.format(e,r)),x:ve.map(e=>n(e)),y1:0,y2:p,styles:{gridLines:a?.xAxis?.gridLines,labels:a?.xAxis?.labels},classNames:{gridLines:t.mo("opacity-0",m?.xAxis?.gridLines),labels:t.mo("fill-primary-gray-700 dark:fill-primary-gray-300 xs:max-[360px]:hidden text-[9px] md:text-[10px] lg:text-xs",m?.xAxis?.labels)},suffix:L,prefix:D,labelType:"primary",showGridLines:!0,precision:w}),z.filter(e=>e.position==="before").map(e=>e.layer),t.jsxRuntimeExports.jsxs("g",{children:[t.jsxRuntimeExports.jsx(F.motion.path,{style:{stroke:H,fill:"none",strokeWidth:le},exit:{opacity:0,transition:{duration:s.duration}},variants:{initial:{pathLength:0,d:ye(i)||"",opacity:1},whileInView:{pathLength:1,d:ye(i)||"",opacity:1,transition:{duration:s.duration}}},initial:"initial",animate:d?"whileInView":"initial"}),k?t.jsxRuntimeExports.jsx("line",{y1:0,y2:p,x1:n(k.date),x2:n(k.date),className:t.mo("undp-tick-line stroke-primary-gray-700 dark:stroke-primary-gray-100",m?.mouseOverLine),style:a?.mouseOverLine}):null]}),t.jsxRuntimeExports.jsx("g",{children:i.map((e,y)=>t.jsxRuntimeExports.jsx(F.motion.g,{children:S.checkIfNullOrUndefined(e.y)?null:t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[ce?t.jsxRuntimeExports.jsx(F.motion.circle,{r:l/i.length<5?0:l/i.length<20?2:4,style:{fill:H},exit:{opacity:0,transition:{duration:s.duration}},variants:{initial:{opacity:0,cx:n(e.date),cy:o(e.y)},whileInView:{opacity:1,transition:{duration:A?s.duration:.5,delay:A?0:s.duration},cx:n(e.date),cy:o(e.y)}},initial:"initial",animate:d?"whileInView":"initial"}):null,u?t.jsxRuntimeExports.jsx(F.motion.text,{dy:-8,style:{textAnchor:"middle",...a?.graphObjectValues||{}},className:t.mo("graph-value text-xs font-bold",m?.graphObjectValues),exit:{opacity:0,transition:{duration:s.duration}},variants:{initial:{opacity:0,x:n(e.date),y:o(e.y)},whileInView:{opacity:1,x:n(e.date),y:o(e.y),transition:{duration:A?s.duration:.5,delay:A?0:s.duration}}},initial:"initial",animate:d?"whileInView":"initial",children:Ee.numberFormattingFunction(e.y,"NA",w,D,L)}):null]})},y))}),W?t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:W.map((e,y)=>t.jsxRuntimeExports.jsx(Se.RefLineY,{text:e.text,color:e.color,y:o(e.value),x1:0-j,x2:l+f.right,classNames:e.classNames,styles:e.styles,animate:s,isInView:d},y))}):null,t.jsxRuntimeExports.jsx("g",{children:xe.map((e,y)=>{const C=fe.getLineEndPoint({x:e.xCoordinate?n(x.parse(`${e.xCoordinate}`,r,new Date))+(e.xOffset||0):0+(e.xOffset||0),y:e.yCoordinate?o(e.yCoordinate)+(e.yOffset||0)-8:0+(e.yOffset||0)-8},{x:e.xCoordinate?n(x.parse(`${e.xCoordinate}`,r,new Date)):0,y:e.yCoordinate?o(e.yCoordinate):0},S.checkIfNullOrUndefined(e.connectorRadius)?3.5:e.connectorRadius),se=e.showConnector?{y1:C.y,x1:C.x,y2:e.yCoordinate?o(e.yCoordinate)+(e.yOffset||0):0+(e.yOffset||0),x2:e.xCoordinate?n(x.parse(`${e.xCoordinate}`,r,new Date))+(e.xOffset||0):0+(e.xOffset||0),cy:e.yCoordinate?o(e.yCoordinate):0,cx:e.xCoordinate?n(x.parse(`${e.xCoordinate}`,r,new Date)):0,circleRadius:S.checkIfNullOrUndefined(e.connectorRadius)?3.5:e.connectorRadius,strokeWidth:e.showConnector===!0?2:Math.min(e.showConnector||0,1)}:void 0,ge={y:e.yCoordinate?o(e.yCoordinate)+(e.yOffset||0)-8:0+(e.yOffset||0)-8,x:U?0:e.xCoordinate?n(x.parse(`${e.xCoordinate}`,r,new Date))+(e.xOffset||0):0+(e.xOffset||0),width:U?e.xCoordinate?n(x.parse(`${e.xCoordinate}`,r,new Date))+(e.xOffset||0):0+(e.xOffset||0):l-(e.xCoordinate?n(x.parse(`${e.xCoordinate}`,r,new Date))+(e.xOffset||0):0+(e.xOffset||0)),maxWidth:e.maxWidth,fontWeight:e.fontWeight,align:e.align};return t.jsxRuntimeExports.jsx(fe.Annotation,{color:e.color,connectorsSettings:se,labelSettings:ge,text:e.text,classNames:e.classNames,styles:e.styles,animate:s,isInView:d},y)})}),t.jsxRuntimeExports.jsx("g",{children:I?t.jsxRuntimeExports.jsx(De.RegressionLine,{x1:0,x2:l,y1:we(0),y2:we(l),graphHeight:p,graphWidth:l,className:m?.regLine,style:a?.regLine,color:typeof I=="string"?I:void 0,animate:s,isInView:d}):null}),z.filter(e=>e.position==="after").map(e=>e.layer),t.jsxRuntimeExports.jsx("rect",{ref:_,style:{fill:"none",pointerEvents:"all"},width:l,height:p})]})}),k&&v&&Q&&R?t.jsxRuntimeExports.jsx(Oe.Tooltip,{data:k,body:v,xPos:Q,yPos:R,backgroundStyle:a?.tooltip,className:m?.tooltip}):null]})}function Ue(re){const{data:O,graphTitle:b,lineColor:$,suffix:H="",sources:L,prefix:D="",graphDescription:r,height:q,width:u,footNote:G,noOfXTicks:oe=10,dateFormat:j="yyyy",showValues:ae=!1,padding:P,backgroundColor:v=!1,leftMargin:T=30,rightMargin:W=30,topMargin:Y=20,bottomMargin:X=25,relativeHeight:s,tooltip:U,onSeriesMouseOver:le,highlightAreaSettings:ce=[],graphID:xe,minValue:ue,maxValue:I,maxDate:B,minDate:me,graphDownload:M=!1,dataDownload:V=!1,animate:N=!1,language:a="en",refValues:m=[],minHeight:w=0,strokeWidth:z=2,showDots:J=!0,annotations:d=[],customHighlightAreaSettings:A=[],theme:pe="light",ariaLabel:he,regressionLine:k=!1,yAxisTitle:K,noOfYTicks:Q=5,curveType:Z="curve",styles:R,classNames:E,precision:f=2,customLayers:_=[]}=re,[i,ee]=h.useState(0),[te,l]=h.useState(0),p=h.useRef(null),ie=h.useRef(null);return h.useEffect(()=>{const c=new ResizeObserver(g=>{ee(u||g[0].target.clientWidth||620),l(q||g[0].target.clientHeight||480)});return p.current&&(l(p.current.clientHeight||480),ee(p.current.clientWidth||620),u||c.observe(p.current)),()=>c.disconnect()},[u,q]),t.jsxRuntimeExports.jsx("div",{className:`${pe||"light"} flex ${u?"w-fit grow-0":"w-full grow"}`,dir:a==="he"||a==="ar"?"rtl":void 0,children:t.jsxRuntimeExports.jsx("div",{className:t.mo(`${v?v===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${a||"en"}`,E?.graphContainer),style:{...R?.graphContainer||{},...v&&v!==!0?{backgroundColor:v}:{}},id:xe,ref:ie,"aria-label":he||`${b?`The graph shows ${b}. `:""}This is a line chart that shows trends over time.${r?` ${r}`:""}`,children:t.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:v?P||"1rem":P||0},children:t.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[b||r||M||V?t.jsxRuntimeExports.jsx(Pe.GraphHeader,{styles:{title:R?.title,description:R?.description},classNames:{title:E?.title,description:E?.description},graphTitle:b,graphDescription:r,width:u,graphDownload:M?ie.current:void 0,dataDownload:V?O.map(c=>c.data).filter(c=>c!==void 0).length>0?O.map(c=>c.data).filter(c=>c!==void 0):O.filter(c=>c!==void 0):null}):null,O.length===0?t.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:t.jsxRuntimeExports.jsx(Ye.EmptyState,{})}):t.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:p,"aria-label":"Graph area",children:(u||i)&&(q||te)?t.jsxRuntimeExports.jsx(Xe,{data:O,lineColor:$||We.Colors.primaryColors["blue-600"],width:u||i,height:Math.max(w,q||(s?w?(u||i)*s>w?(u||i)*s:w:(u||i)*s:te)),suffix:H,prefix:D,dateFormat:j,showValues:ae,noOfXTicks:oe,leftMargin:T,rightMargin:W,topMargin:Y,bottomMargin:X,tooltip:U,highlightAreaSettings:ce,onSeriesMouseOver:le,refValues:m,minValue:ue,maxValue:I,animate:N===!0?{duration:.5,once:!0,amount:.5}:N||{duration:0,once:!0,amount:0},rtl:a==="he"||a==="ar",strokeWidth:z,showDots:J,annotations:d,customHighlightAreaSettings:A,regressionLine:k,yAxisTitle:K,noOfYTicks:Q,maxDate:B,minDate:me,curveType:Z,styles:R,classNames:E,precision:f,customLayers:_}):null}),L||G?t.jsxRuntimeExports.jsx(Ge.GraphFooter,{styles:{footnote:R?.footnote,source:R?.source},classNames:{footnote:E?.footnote,source:E?.source},sources:L,footNote:G,width:u}):null]})})})})}exports.SimpleLineChart=Ue;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-CHPV5EwG-DDoeWRVt.cjs"),h=require("react"),x=require("./parse-hMnG_lRV.cjs"),Ce=require("./index-BzeLQvXk.cjs"),Re=require("./simple-statistics-xm8c0LQQ.cjs"),Ee=require("./numberFormattingFunction-02t-wJta.cjs"),Oe=require("./Tooltip-n8z5bfav.cjs"),S=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),fe=require("./customArea-CK768gCn.cjs"),Le=require("./Axis-DE7dSn1_.cjs"),Ne=require("./AxisTitle-CK9YeovX.cjs"),ke=require("./XTicksAndGridLines-CCzXIV8d.cjs"),Se=require("./ReferenceLine-CFVBBN__.cjs"),De=require("./RegressionLine-xKdiJ8sw.cjs"),qe=require("./YTicksAndGridLines-DBDuz6vb.cjs"),$e=require("./index-DNj994Pv.cjs"),Te=require("./time-Byw_jYQ7.cjs"),Ie=require("./linear-BVckp9RD.cjs"),be=require("./line-DHV4JwCR.cjs"),ne=require("./step-BZ3C8QFW.cjs"),Me=require("./select-Bnfk0lJx.cjs"),Ve=require("./init-DU0ybBc_.cjs"),Fe=require("./pointer-Dkq5NV1q.cjs"),He=require("./use-in-view-sQJZ_xDO.cjs"),F=require("./proxy-BHRoeZgd.cjs"),Ge=require("./GraphFooter.cjs"),Pe=require("./GraphHeader.cjs"),We=require("./Colors.cjs"),Ye=require("./EmptyState-d8_8SxeW.cjs");function Xe(re){const{data:O,width:b,height:$,lineColor:H,suffix:L,prefix:D,dateFormat:r,highlightAreaSettings:q,showValues:u,noOfXTicks:G,rightMargin:oe,leftMargin:j,topMargin:ae,bottomMargin:P,tooltip:v,onSeriesMouseOver:T,refValues:W,minValue:Y,maxValue:X,animate:s,rtl:U,strokeWidth:le,showDots:ce,annotations:xe,customHighlightAreaSettings:ue,regressionLine:I,yAxisTitle:B,noOfYTicks:me,maxDate:M,minDate:V,curveType:N,styles:a,classNames:m,precision:w,customLayers:z}=re,J=h.useRef(null),d=He.useInView(J,{once:s.once,amount:s.amount}),[A,pe]=h.useState(!1);h.useEffect(()=>{if(d&&!A){const e=setTimeout(()=>{pe(!0)},(s.duration+.5)*1e3);return()=>clearTimeout(e)}},[d,A,s.duration]);const he=N==="linear"?be.curveLinear:N==="step"?ne.curveStep:N==="stepAfter"?ne.stepAfter:N==="stepBefore"?ne.stepBefore:ne.monotoneX,[k,K]=h.useState(void 0),[Q,Z]=h.useState(void 0),[R,E]=h.useState(void 0),f={top:ae,bottom:P,left:B?j+30:j,right:oe},_=h.useRef(null),i=Ce.sortBy(O.map(e=>({...e,date:x.parse(`${e.date}`,r,new Date)})),"date"),ee=q.map(e=>({...e,coordinates:[e.coordinates[0]===null?null:x.parse(`${e.coordinates[0]}`,r,new Date),e.coordinates[1]===null?null:x.parse(`${e.coordinates[1]}`,r,new Date)]})),te=ue.map(e=>({...e,coordinates:e.coordinates.map((y,C)=>C%2===0?x.parse(`${y}`,r,new Date):y)})),l=b-f.left-f.right,p=$-f.top-f.bottom,ie=V?x.parse(`${V}`,r,new Date):i[0].date,c=M?x.parse(`${M}`,r,new Date):i[i.length-1].date,g=S.checkIfNullOrUndefined(Y)?Math.min(...i.map(e=>e.y).filter(e=>e!=null))!==1/0?Math.min(...i.map(e=>e.y).filter(e=>e!=null))>0?0:Math.min(...i.map(e=>e.y).filter(e=>e!=null)):0:Y,de=Math.max(...i.map(e=>e.y).filter(e=>e!=null))!==1/0?Math.max(...i.map(e=>e.y).filter(e=>e!=null)):0,n=Te.time().domain([ie,c]).range([0,l]),o=Ie.linear().domain([g,S.checkIfNullOrUndefined(X)?de>0?de:0:X]).range([p,0]).nice(),ye=be.line().x(e=>n(e.date)).y(e=>o(e.y)).curve(he),je=o.ticks(me),ve=n.ticks(G);h.useEffect(()=>{const e=C=>{const se=i[Ve.bisectCenter(i.map(ge=>ge.date),n.invert(Fe.pointer(C)[0]),1)];K(se||i[i.length-1]),T?.(se||i[i.length-1]),E(C.clientY),Z(C.clientX)},y=()=>{K(void 0),Z(void 0),E(void 0),T?.(void 0)};Me.select(_.current).on("mousemove",e).on("mouseout",y)},[n,i,T]);const Ae=Re.linearRegression(i.filter(e=>!S.checkIfNullOrUndefined(e.date)&&!S.checkIfNullOrUndefined(e.y)).map(e=>[n(e.date),o(e.y)])),we=Re.linearRegressionLine(Ae);return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(F.motion.svg,{width:`${b}px`,height:`${$}px`,viewBox:`0 0 ${b} ${$}`,direction:"ltr",ref:J,children:t.jsxRuntimeExports.jsxs("g",{transform:`translate(${f.left},${f.top})`,children:[t.jsxRuntimeExports.jsx($e.HighlightArea,{areaSettings:ee,width:l,height:p,scale:n,animate:s,isInView:d}),t.jsxRuntimeExports.jsx(fe.CustomArea,{areaSettings:te,scaleX:n,scaleY:o,animate:s,isInView:d}),t.jsxRuntimeExports.jsxs("g",{children:[t.jsxRuntimeExports.jsx(qe.YTicksAndGridLines,{values:je.filter(e=>e!==0),y:je.filter(e=>e!==0).map(e=>o(e)),x1:0-j,x2:l+f.right,styles:{gridLines:a?.yAxis?.gridLines,labels:a?.yAxis?.labels},classNames:{gridLines:m?.yAxis?.gridLines,labels:m?.yAxis?.labels},suffix:L,prefix:D,labelType:"secondary",showGridLines:!0,labelPos:"vertical",precision:w}),t.jsxRuntimeExports.jsx(Le.Axis,{y1:o(g<0?0:g),y2:o(g<0?0:g),x1:0-j,x2:l+f.right,label:Ee.numberFormattingFunction(g<0?0:g,"NA",w,D,L),labelPos:{x:0-j,y:o(g<0?0:g),dx:0,dy:de<0?"1em":-5},classNames:{axis:m?.xAxis?.axis,label:m?.yAxis?.labels},styles:{axis:a?.xAxis?.axis,label:a?.yAxis?.labels}}),t.jsxRuntimeExports.jsx(Ne.AxisTitle,{x:0-j-15,y:p/2,style:a?.yAxis?.title,className:m?.yAxis?.title,text:B,rotate90:!0})]}),t.jsxRuntimeExports.jsx(ke.XTicksAndGridLines,{values:ve.map(e=>x.format(e,r)),x:ve.map(e=>n(e)),y1:0,y2:p,styles:{gridLines:a?.xAxis?.gridLines,labels:a?.xAxis?.labels},classNames:{gridLines:t.mo("opacity-0",m?.xAxis?.gridLines),labels:t.mo("fill-primary-gray-700 dark:fill-primary-gray-300 xs:max-[360px]:hidden text-[9px] md:text-[10px] lg:text-xs",m?.xAxis?.labels)},suffix:L,prefix:D,labelType:"primary",showGridLines:!0,precision:w}),z.filter(e=>e.position==="before").map(e=>e.layer),t.jsxRuntimeExports.jsxs("g",{children:[t.jsxRuntimeExports.jsx(F.motion.path,{style:{stroke:H,fill:"none",strokeWidth:le},exit:{opacity:0,transition:{duration:s.duration}},variants:{initial:{pathLength:0,d:ye(i)||"",opacity:1},whileInView:{pathLength:1,d:ye(i)||"",opacity:1,transition:{duration:s.duration}}},initial:"initial",animate:d?"whileInView":"initial"}),k?t.jsxRuntimeExports.jsx("line",{y1:0,y2:p,x1:n(k.date),x2:n(k.date),className:t.mo("undp-tick-line stroke-primary-gray-700 dark:stroke-primary-gray-100",m?.mouseOverLine),style:a?.mouseOverLine}):null]}),t.jsxRuntimeExports.jsx("g",{children:i.map((e,y)=>t.jsxRuntimeExports.jsx(F.motion.g,{children:S.checkIfNullOrUndefined(e.y)?null:t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[ce?t.jsxRuntimeExports.jsx(F.motion.circle,{r:l/i.length<5?0:l/i.length<20?2:4,style:{fill:H},exit:{opacity:0,transition:{duration:s.duration}},variants:{initial:{opacity:0,cx:n(e.date),cy:o(e.y)},whileInView:{opacity:1,transition:{duration:A?s.duration:.5,delay:A?0:s.duration},cx:n(e.date),cy:o(e.y)}},initial:"initial",animate:d?"whileInView":"initial"}):null,u?t.jsxRuntimeExports.jsx(F.motion.text,{dy:-8,style:{textAnchor:"middle",...a?.graphObjectValues||{}},className:t.mo("graph-value text-xs font-bold",m?.graphObjectValues),exit:{opacity:0,transition:{duration:s.duration}},variants:{initial:{opacity:0,x:n(e.date),y:o(e.y)},whileInView:{opacity:1,x:n(e.date),y:o(e.y),transition:{duration:A?s.duration:.5,delay:A?0:s.duration}}},initial:"initial",animate:d?"whileInView":"initial",children:Ee.numberFormattingFunction(e.y,"NA",w,D,L)}):null]})},y))}),W?t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:W.map((e,y)=>t.jsxRuntimeExports.jsx(Se.RefLineY,{text:e.text,color:e.color,y:o(e.value),x1:0-j,x2:l+f.right,classNames:e.classNames,styles:e.styles,animate:s,isInView:d},y))}):null,t.jsxRuntimeExports.jsx("g",{children:xe.map((e,y)=>{const C=fe.getLineEndPoint({x:e.xCoordinate?n(x.parse(`${e.xCoordinate}`,r,new Date))+(e.xOffset||0):0+(e.xOffset||0),y:e.yCoordinate?o(e.yCoordinate)+(e.yOffset||0)-8:0+(e.yOffset||0)-8},{x:e.xCoordinate?n(x.parse(`${e.xCoordinate}`,r,new Date)):0,y:e.yCoordinate?o(e.yCoordinate):0},S.checkIfNullOrUndefined(e.connectorRadius)?3.5:e.connectorRadius),se=e.showConnector?{y1:C.y,x1:C.x,y2:e.yCoordinate?o(e.yCoordinate)+(e.yOffset||0):0+(e.yOffset||0),x2:e.xCoordinate?n(x.parse(`${e.xCoordinate}`,r,new Date))+(e.xOffset||0):0+(e.xOffset||0),cy:e.yCoordinate?o(e.yCoordinate):0,cx:e.xCoordinate?n(x.parse(`${e.xCoordinate}`,r,new Date)):0,circleRadius:S.checkIfNullOrUndefined(e.connectorRadius)?3.5:e.connectorRadius,strokeWidth:e.showConnector===!0?2:Math.min(e.showConnector||0,1)}:void 0,ge={y:e.yCoordinate?o(e.yCoordinate)+(e.yOffset||0)-8:0+(e.yOffset||0)-8,x:U?0:e.xCoordinate?n(x.parse(`${e.xCoordinate}`,r,new Date))+(e.xOffset||0):0+(e.xOffset||0),width:U?e.xCoordinate?n(x.parse(`${e.xCoordinate}`,r,new Date))+(e.xOffset||0):0+(e.xOffset||0):l-(e.xCoordinate?n(x.parse(`${e.xCoordinate}`,r,new Date))+(e.xOffset||0):0+(e.xOffset||0)),maxWidth:e.maxWidth,fontWeight:e.fontWeight,align:e.align};return t.jsxRuntimeExports.jsx(fe.Annotation,{color:e.color,connectorsSettings:se,labelSettings:ge,text:e.text,classNames:e.classNames,styles:e.styles,animate:s,isInView:d},y)})}),t.jsxRuntimeExports.jsx("g",{children:I?t.jsxRuntimeExports.jsx(De.RegressionLine,{x1:0,x2:l,y1:we(0),y2:we(l),graphHeight:p,graphWidth:l,className:m?.regLine,style:a?.regLine,color:typeof I=="string"?I:void 0,animate:s,isInView:d}):null}),z.filter(e=>e.position==="after").map(e=>e.layer),t.jsxRuntimeExports.jsx("rect",{ref:_,style:{fill:"none",pointerEvents:"all"},width:l,height:p})]})}),k&&v&&Q&&R?t.jsxRuntimeExports.jsx(Oe.Tooltip,{data:k,body:v,xPos:Q,yPos:R,backgroundStyle:a?.tooltip,className:m?.tooltip}):null]})}function Ue(re){const{data:O,graphTitle:b,lineColor:$,suffix:H="",sources:L,prefix:D="",graphDescription:r,height:q,width:u,footNote:G,noOfXTicks:oe=10,dateFormat:j="yyyy",showValues:ae=!1,padding:P,backgroundColor:v=!1,leftMargin:T=30,rightMargin:W=30,topMargin:Y=20,bottomMargin:X=25,relativeHeight:s,tooltip:U,onSeriesMouseOver:le,highlightAreaSettings:ce=[],graphID:xe,minValue:ue,maxValue:I,maxDate:B,minDate:me,graphDownload:M=!1,dataDownload:V=!1,animate:N=!1,language:a="en",refValues:m=[],minHeight:w=0,strokeWidth:z=2,showDots:J=!0,annotations:d=[],customHighlightAreaSettings:A=[],theme:pe="light",ariaLabel:he,regressionLine:k=!1,yAxisTitle:K,noOfYTicks:Q=5,curveType:Z="curve",styles:R,classNames:E,precision:f=2,customLayers:_=[]}=re,[i,ee]=h.useState(0),[te,l]=h.useState(0),p=h.useRef(null),ie=h.useRef(null);return h.useEffect(()=>{const c=new ResizeObserver(g=>{ee(u||g[0].target.clientWidth||620),l(q||g[0].target.clientHeight||480)});return p.current&&(l(p.current.clientHeight||480),ee(p.current.clientWidth||620),u||c.observe(p.current)),()=>c.disconnect()},[u,q]),t.jsxRuntimeExports.jsx("div",{className:`${pe||"light"} flex ${u?"w-fit grow-0":"w-full grow"}`,dir:a==="he"||a==="ar"?"rtl":void 0,children:t.jsxRuntimeExports.jsx("div",{className:t.mo(`${v?v===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${a||"en"}`,E?.graphContainer),style:{...R?.graphContainer||{},...v&&v!==!0?{backgroundColor:v}:{}},id:xe,ref:ie,"aria-label":he||`${b?`The graph shows ${b}. `:""}This is a line chart that shows trends over time.${r?` ${r}`:""}`,children:t.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:v?P||"1rem":P||0},children:t.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[b||r||M||V?t.jsxRuntimeExports.jsx(Pe.GraphHeader,{styles:{title:R?.title,description:R?.description},classNames:{title:E?.title,description:E?.description},graphTitle:b,graphDescription:r,width:u,graphDownload:M?ie.current:void 0,dataDownload:V?O.map(c=>c.data).filter(c=>c!==void 0).length>0?O.map(c=>c.data).filter(c=>c!==void 0):O.filter(c=>c!==void 0):null}):null,O.length===0?t.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:t.jsxRuntimeExports.jsx(Ye.EmptyState,{})}):t.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:p,"aria-label":"Graph area",children:(u||i)&&(q||te)?t.jsxRuntimeExports.jsx(Xe,{data:O,lineColor:$||We.Colors.primaryColors["blue-600"],width:u||i,height:Math.max(w,q||(s?w?(u||i)*s>w?(u||i)*s:w:(u||i)*s:te)),suffix:H,prefix:D,dateFormat:j,showValues:ae,noOfXTicks:oe,leftMargin:T,rightMargin:W,topMargin:Y,bottomMargin:X,tooltip:U,highlightAreaSettings:ce,onSeriesMouseOver:le,refValues:m,minValue:ue,maxValue:I,animate:N===!0?{duration:.5,once:!0,amount:.5}:N||{duration:0,once:!0,amount:0},rtl:a==="he"||a==="ar",strokeWidth:z,showDots:J,annotations:d,customHighlightAreaSettings:A,regressionLine:k,yAxisTitle:K,noOfYTicks:Q,maxDate:B,minDate:me,curveType:Z,styles:R,classNames:E,precision:f,customLayers:_}):null}),L||G?t.jsxRuntimeExports.jsx(Ge.GraphFooter,{styles:{footnote:R?.footnote,source:R?.source},classNames:{footnote:E?.footnote,source:E?.source},sources:L,footNote:G,width:u}):null]})})})})}exports.SimpleLineChart=Ue;
|
|
2
2
|
//# sourceMappingURL=SimpleLineChart.cjs.map
|