@undp/data-viz 1.5.6 → 1.5.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/dist/BarGraph.cjs +1 -1
  2. package/dist/BarGraph.cjs.map +1 -1
  3. package/dist/BarGraph.js +650 -648
  4. package/dist/BarGraph.js.map +1 -1
  5. package/dist/BulletChart.cjs +1 -1
  6. package/dist/BulletChart.cjs.map +1 -1
  7. package/dist/BulletChart.js +210 -208
  8. package/dist/BulletChart.js.map +1 -1
  9. package/dist/ButterflyChart.cjs +1 -1
  10. package/dist/ButterflyChart.cjs.map +1 -1
  11. package/dist/ButterflyChart.js +42 -40
  12. package/dist/ButterflyChart.js.map +1 -1
  13. package/dist/DifferenceLineChart.cjs +1 -1
  14. package/dist/DifferenceLineChart.cjs.map +1 -1
  15. package/dist/DifferenceLineChart.js +122 -120
  16. package/dist/DifferenceLineChart.js.map +1 -1
  17. package/dist/DualAxisLineChart.cjs +1 -1
  18. package/dist/DualAxisLineChart.cjs.map +1 -1
  19. package/dist/DualAxisLineChart.js +133 -113
  20. package/dist/DualAxisLineChart.js.map +1 -1
  21. package/dist/DumbbellChart.cjs +1 -1
  22. package/dist/DumbbellChart.cjs.map +1 -1
  23. package/dist/DumbbellChart.js +274 -274
  24. package/dist/DumbbellChart.js.map +1 -1
  25. package/dist/LineChartWithConfidenceInterval.cjs +1 -1
  26. package/dist/LineChartWithConfidenceInterval.cjs.map +1 -1
  27. package/dist/LineChartWithConfidenceInterval.js +194 -174
  28. package/dist/LineChartWithConfidenceInterval.js.map +1 -1
  29. package/dist/MultiLineAltChart.cjs +1 -1
  30. package/dist/MultiLineAltChart.cjs.map +1 -1
  31. package/dist/MultiLineAltChart.js +160 -161
  32. package/dist/MultiLineAltChart.js.map +1 -1
  33. package/dist/MultiLineChart.cjs +1 -1
  34. package/dist/MultiLineChart.cjs.map +1 -1
  35. package/dist/MultiLineChart.js +77 -66
  36. package/dist/MultiLineChart.js.map +1 -1
  37. package/dist/ParetoChart.cjs +1 -1
  38. package/dist/ParetoChart.cjs.map +1 -1
  39. package/dist/ParetoChart.js +166 -161
  40. package/dist/ParetoChart.js.map +1 -1
  41. package/dist/RadarChart.cjs +1 -1
  42. package/dist/RadarChart.cjs.map +1 -1
  43. package/dist/RadarChart.js +253 -241
  44. package/dist/RadarChart.js.map +1 -1
  45. package/dist/{RegressionLine-mH7UKOPi.js → RegressionLine-C2--oMQq.js} +10 -9
  46. package/dist/RegressionLine-C2--oMQq.js.map +1 -0
  47. package/dist/RegressionLine-Dj0GSiAp.cjs +2 -0
  48. package/dist/RegressionLine-Dj0GSiAp.cjs.map +1 -0
  49. package/dist/ScatterPlot.cjs +1 -1
  50. package/dist/ScatterPlot.cjs.map +1 -1
  51. package/dist/ScatterPlot.js +130 -129
  52. package/dist/ScatterPlot.js.map +1 -1
  53. package/dist/SimpleLineChart.cjs +1 -1
  54. package/dist/SimpleLineChart.cjs.map +1 -1
  55. package/dist/SimpleLineChart.js +43 -38
  56. package/dist/SimpleLineChart.js.map +1 -1
  57. package/dist/SlopeChart.cjs +1 -1
  58. package/dist/SlopeChart.cjs.map +1 -1
  59. package/dist/SlopeChart.js +113 -109
  60. package/dist/SlopeChart.js.map +1 -1
  61. package/dist/StripChart.cjs +1 -1
  62. package/dist/StripChart.cjs.map +1 -1
  63. package/dist/StripChart.js +282 -270
  64. package/dist/StripChart.js.map +1 -1
  65. package/dist/ThreeDGlobe.cjs +1 -1
  66. package/dist/ThreeDGlobe.cjs.map +1 -1
  67. package/dist/ThreeDGlobe.js +284 -349
  68. package/dist/ThreeDGlobe.js.map +1 -1
  69. package/dist/UnitChart.cjs +1 -1
  70. package/dist/UnitChart.cjs.map +1 -1
  71. package/dist/UnitChart.js +20 -21
  72. package/dist/UnitChart.js.map +1 -1
  73. package/dist/getCentroidCoordinates-Dfk6IqEG.js +70 -0
  74. package/dist/getCentroidCoordinates-Dfk6IqEG.js.map +1 -0
  75. package/dist/getCentroidCoordinates-DxTBqzp2.cjs +2 -0
  76. package/dist/getCentroidCoordinates-DxTBqzp2.cjs.map +1 -0
  77. package/dist/index.cjs +1 -1
  78. package/dist/index.d.ts +7 -0
  79. package/dist/index.js +34 -32
  80. package/dist/index.js.map +1 -1
  81. package/dist/utils.cjs +1 -1
  82. package/dist/utils.d.ts +8 -0
  83. package/dist/utils.js +16 -14
  84. package/dist/utils.js.map +1 -1
  85. package/package.json +1 -1
  86. package/dist/RegressionLine-mH7UKOPi.js.map +0 -1
  87. package/dist/RegressionLine-xKdiJ8sw.cjs +0 -2
  88. package/dist/RegressionLine-xKdiJ8sw.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"DifferenceLineChart.cjs","sources":["../src/Components/Graphs/LineCharts/DifferenceLineChart/Graph.tsx","../src/Components/Graphs/LineCharts/DifferenceLineChart/index.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\r\nimport {\r\n line,\r\n curveMonotoneX,\r\n area,\r\n curveLinear,\r\n curveStep,\r\n curveStepAfter,\r\n curveStepBefore,\r\n} from 'd3-shape';\r\nimport { scaleLinear, scaleTime } from 'd3-scale';\r\nimport { format } from 'date-fns/format';\r\nimport { parse } from 'date-fns/parse';\r\nimport { bisectCenter } from 'd3-array';\r\nimport { pointer, select } from 'd3-selection';\r\nimport { motion, useInView } from 'motion/react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport orderBy from 'lodash.orderby';\r\n\r\nimport {\r\n AnimateDataType,\r\n AnnotationSettingsDataType,\r\n ClassNameObject,\r\n CurveTypes,\r\n CustomHighlightAreaSettingsDataType,\r\n CustomLayerDataType,\r\n DifferenceLineChartDataType,\r\n HighlightAreaSettingsDataType,\r\n ReferenceDataType,\r\n StyleObject,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { getLineEndPoint } from '@/Utils/getLineEndPoint';\r\nimport { AxisTitle } from '@/Components/Elements/Axes/AxisTitle';\r\nimport { Axis } from '@/Components/Elements/Axes/Axis';\r\nimport { XTicksAndGridLines } from '@/Components/Elements/Axes/XTicksAndGridLines';\r\nimport { RefLineY } from '@/Components/Elements/ReferenceLine';\r\nimport { Annotation } from '@/Components/Elements/Annotations';\r\nimport { YTicksAndGridLines } from '@/Components/Elements/Axes/YTicksAndGridLines';\r\nimport { HighlightArea } from '@/Components/Elements/HighlightArea';\r\nimport { CustomArea } from '@/Components/Elements/HighlightArea/customArea';\r\n\r\ninterface Props {\r\n data: DifferenceLineChartDataType[];\r\n lineColors: [string, string];\r\n diffAreaColors: [string, string];\r\n width: number;\r\n height: number;\r\n suffix: string;\r\n prefix: string;\r\n dateFormat: string;\r\n showValues: boolean;\r\n noOfXTicks: number;\r\n rightMargin: number;\r\n leftMargin: number;\r\n topMargin: number;\r\n bottomMargin: number;\r\n highlightAreaSettings: HighlightAreaSettingsDataType[];\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n animate: AnimateDataType;\r\n rtl: boolean;\r\n colorDomain: [string, string];\r\n showColorLegendAtTop?: boolean;\r\n idSuffix: string;\r\n strokeWidth: number;\r\n showDots: boolean;\r\n refValues: ReferenceDataType[];\r\n maxValue?: number;\r\n minValue?: number;\r\n annotations: AnnotationSettingsDataType[];\r\n customHighlightAreaSettings: CustomHighlightAreaSettingsDataType[];\r\n yAxisTitle?: string;\r\n noOfYTicks: number;\r\n minDate?: string | number;\r\n maxDate?: string | number;\r\n curveType: CurveTypes;\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n precision: number;\r\n customLayers: CustomLayerDataType[];\r\n}\r\n\r\ninterface FormattedDataType {\r\n y1: number;\r\n y2: number;\r\n date: Date;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n width,\r\n height,\r\n lineColors,\r\n suffix,\r\n prefix,\r\n dateFormat,\r\n showValues,\r\n noOfXTicks,\r\n rightMargin,\r\n leftMargin,\r\n topMargin,\r\n bottomMargin,\r\n tooltip,\r\n highlightAreaSettings,\r\n onSeriesMouseOver,\r\n animate,\r\n rtl,\r\n showColorLegendAtTop,\r\n colorDomain,\r\n diffAreaColors,\r\n idSuffix,\r\n strokeWidth,\r\n showDots,\r\n refValues,\r\n minValue,\r\n maxValue,\r\n annotations,\r\n customHighlightAreaSettings,\r\n yAxisTitle,\r\n noOfYTicks,\r\n minDate,\r\n maxDate,\r\n curveType,\r\n styles,\r\n classNames,\r\n precision,\r\n customLayers,\r\n } = props;\r\n const svgRef = useRef(null);\r\n const isInView = useInView(svgRef, {\r\n once: animate.once,\r\n amount: animate.amount,\r\n });\r\n const [hasAnimatedOnce, setHasAnimatedOnce] = useState(false);\r\n\r\n useEffect(() => {\r\n if (isInView && !hasAnimatedOnce) {\r\n const timeout = setTimeout(\r\n () => {\r\n setHasAnimatedOnce(true);\r\n },\r\n (animate.duration + 0.5) * 1000,\r\n );\r\n return () => clearTimeout(timeout);\r\n }\r\n }, [isInView, hasAnimatedOnce, animate.duration]);\r\n const curve =\r\n curveType === 'linear'\r\n ? curveLinear\r\n : curveType === 'step'\r\n ? curveStep\r\n : curveType === 'stepAfter'\r\n ? curveStepAfter\r\n : curveType === 'stepBefore'\r\n ? curveStepBefore\r\n : curveMonotoneX;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n const margin = {\r\n top: topMargin,\r\n bottom: bottomMargin,\r\n left: yAxisTitle ? leftMargin + 30 : leftMargin,\r\n right: rightMargin,\r\n };\r\n const MouseoverRectRef = useRef(null);\r\n const dataFormatted = orderBy(\r\n data.map(d => ({\r\n ...d,\r\n date: parse(`${d.date}`, dateFormat, new Date()),\r\n })),\r\n ['date'],\r\n ['asc'],\r\n );\r\n const highlightAreaSettingsFormatted = highlightAreaSettings.map(d => ({\r\n ...d,\r\n coordinates: [\r\n d.coordinates[0] === null ? null : parse(`${d.coordinates[0]}`, dateFormat, new Date()),\r\n d.coordinates[1] === null ? null : parse(`${d.coordinates[1]}`, dateFormat, new Date()),\r\n ],\r\n }));\r\n const customHighlightAreaSettingsFormatted = customHighlightAreaSettings.map(d => ({\r\n ...d,\r\n coordinates: d.coordinates.map((el, j) =>\r\n j % 2 === 0 ? parse(`${el}`, dateFormat, new Date()) : (el as number),\r\n ),\r\n }));\r\n const graphWidth = width - margin.left - margin.right;\r\n const graphHeight = height - margin.top - margin.bottom;\r\n const minYear = minDate ? parse(`${minDate}`, dateFormat, new Date()) : dataFormatted[0].date;\r\n const maxYear = maxDate\r\n ? parse(`${maxDate}`, dateFormat, new Date())\r\n : dataFormatted[dataFormatted.length - 1].date;\r\n const minParam1 =\r\n Math.min(...dataFormatted.map(d => d.y1)) !== Infinity\r\n ? Math.min(...dataFormatted.map(d => d.y1)) > 0\r\n ? 0\r\n : Math.min(...dataFormatted.map(d => d.y1))\r\n : 0;\r\n const minParam2 =\r\n Math.min(...dataFormatted.map(d => d.y2)) !== Infinity\r\n ? Math.min(...dataFormatted.map(d => d.y2)) > 0\r\n ? 0\r\n : Math.min(...dataFormatted.map(d => d.y2))\r\n : 0;\r\n const maxParam1 =\r\n Math.max(...dataFormatted.map(d => d.y1)) !== Infinity\r\n ? Math.max(...dataFormatted.map(d => d.y1))\r\n : 0;\r\n const maxParam2 =\r\n Math.max(...dataFormatted.map(d => d.y2)) !== Infinity\r\n ? Math.max(...dataFormatted.map(d => d.y2))\r\n : 0;\r\n\r\n const minParam = checkIfNullOrUndefined(minValue)\r\n ? minParam1 < minParam2\r\n ? minParam1\r\n : minParam2\r\n : (minValue as number);\r\n const maxParam = maxParam1 > maxParam2 ? maxParam1 : maxParam2;\r\n const x = scaleTime().domain([minYear, maxYear]).range([0, graphWidth]);\r\n\r\n const y = scaleLinear()\r\n .domain([\r\n checkIfNullOrUndefined(minValue) ? minParam : (minValue as number),\r\n checkIfNullOrUndefined(maxValue) ? (maxParam > 0 ? maxParam : 0) : (maxValue as number),\r\n ])\r\n .range([graphHeight, 0])\r\n .nice();\r\n\r\n const lineShape1 = line<FormattedDataType>()\r\n .x(d => x(d.date))\r\n .y(d => y(d.y1))\r\n .curve(curve);\r\n\r\n const lineShape2 = line<FormattedDataType>()\r\n .x(d => x(d.date))\r\n .y(d => y(d.y2))\r\n .curve(curve);\r\n\r\n const mainGraphArea = area<FormattedDataType>()\r\n .x(d => x(d.date))\r\n .y1(d => y(d.y1))\r\n .y0(d => y(d.y2))\r\n .curve(curve);\r\n const mainGraphArea1 = area<FormattedDataType>()\r\n .x(d => x(d.date))\r\n .y1(d => y(d.y1))\r\n .y0(0)\r\n .curve(curve);\r\n const mainGraphArea2 = area<FormattedDataType>()\r\n .x(d => x(d.date))\r\n .y1(d => y(d.y2))\r\n .y0(0)\r\n .curve(curve);\r\n const yTicks = y.ticks(noOfYTicks);\r\n const xTicks = x.ticks(noOfXTicks);\r\n useEffect(() => {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const mousemove = (event: any) => {\r\n const selectedData =\r\n dataFormatted[\r\n bisectCenter(\r\n dataFormatted.map(d => d.date),\r\n x.invert(pointer(event)[0]),\r\n 0,\r\n )\r\n ];\r\n setMouseOverData(selectedData || dataFormatted[dataFormatted.length - 1]);\r\n onSeriesMouseOver?.(selectedData || dataFormatted[dataFormatted.length - 1]);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n };\r\n const mouseout = () => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n };\r\n select(MouseoverRectRef.current).on('mousemove', mousemove).on('mouseout', mouseout);\r\n }, [x, dataFormatted, onSeriesMouseOver]);\r\n return (\r\n <>\r\n <motion.svg\r\n width={`${width}px`}\r\n height={`${height}px`}\r\n viewBox={`0 0 ${width} ${height}`}\r\n direction='ltr'\r\n ref={svgRef}\r\n >\r\n <g transform={`translate(${margin.left},${margin.top})`}>\r\n <clipPath id={`above${idSuffix}`}>\r\n <path\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d={mainGraphArea2(dataFormatted as any) as string}\r\n style={{ fill: 'none' }}\r\n />\r\n </clipPath>\r\n <clipPath id={`below${idSuffix}`}>\r\n <path\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d={mainGraphArea1(dataFormatted as any) as string}\r\n style={{ fill: 'none' }}\r\n />\r\n </clipPath>\r\n <HighlightArea\r\n areaSettings={highlightAreaSettingsFormatted}\r\n width={graphWidth}\r\n height={graphHeight}\r\n scale={x}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n <CustomArea\r\n areaSettings={customHighlightAreaSettingsFormatted}\r\n scaleX={x}\r\n scaleY={y}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n <g>\r\n <g>\r\n <YTicksAndGridLines\r\n values={yTicks.filter(d => d !== 0)}\r\n y={yTicks.filter(d => d !== 0).map(d => y(d))}\r\n x1={0 - leftMargin}\r\n x2={graphWidth + margin.right}\r\n styles={{\r\n gridLines: styles?.yAxis?.gridLines,\r\n labels: styles?.yAxis?.labels,\r\n }}\r\n classNames={{\r\n gridLines: classNames?.yAxis?.gridLines,\r\n labels: classNames?.yAxis?.labels,\r\n }}\r\n suffix={suffix}\r\n prefix={prefix}\r\n labelType='secondary'\r\n showGridLines\r\n labelPos='vertical'\r\n precision={precision}\r\n />\r\n <Axis\r\n y1={y(minParam < 0 ? 0 : minParam)}\r\n y2={y(minParam < 0 ? 0 : minParam)}\r\n x1={0 - leftMargin}\r\n x2={graphWidth + margin.right}\r\n label={numberFormattingFunction(\r\n minParam < 0 ? 0 : minParam,\r\n 'NA',\r\n precision,\r\n prefix,\r\n suffix,\r\n )}\r\n labelPos={{\r\n x: 0 - leftMargin,\r\n y: y(minParam < 0 ? 0 : minParam),\r\n dx: 0,\r\n dy: maxParam < 0 ? '1rem' : -5,\r\n }}\r\n classNames={{\r\n axis: classNames?.xAxis?.axis,\r\n label: classNames?.yAxis?.labels,\r\n }}\r\n styles={{\r\n axis: styles?.xAxis?.axis,\r\n label: styles?.yAxis?.labels,\r\n }}\r\n />\r\n <AxisTitle\r\n x={0 - leftMargin - 15}\r\n y={graphHeight / 2}\r\n style={styles?.yAxis?.title}\r\n className={classNames?.yAxis?.title}\r\n text={yAxisTitle}\r\n rotate90\r\n />\r\n </g>\r\n </g>\r\n <XTicksAndGridLines\r\n values={xTicks.map(d => format(d, dateFormat))}\r\n x={xTicks.map(d => x(d))}\r\n y1={0}\r\n y2={graphHeight}\r\n styles={{\r\n gridLines: styles?.xAxis?.gridLines,\r\n labels: styles?.xAxis?.labels,\r\n }}\r\n classNames={{\r\n gridLines: cn('opacity-0', classNames?.xAxis?.gridLines),\r\n labels: cn(\r\n 'fill-primary-gray-700 dark:fill-primary-gray-300 xs:max-[360px]:hidden text-[9px] md:text-[10px] lg:text-xs',\r\n classNames?.xAxis?.labels,\r\n ),\r\n }}\r\n suffix={suffix}\r\n prefix={prefix}\r\n labelType='primary'\r\n showGridLines\r\n precision={precision}\r\n />\r\n {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n <g>\r\n <motion.path\r\n clipPath={`url(#below${idSuffix})`}\r\n d={mainGraphArea(dataFormatted) || ''}\r\n style={{ fill: diffAreaColors[1] }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 1 },\r\n whileInView: { opacity: 1, transition: { duration: animate.duration } },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n <motion.path\r\n clipPath={`url(#above${idSuffix})`}\r\n d={mainGraphArea(dataFormatted) || ''}\r\n style={{ fill: diffAreaColors[0] }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 0 },\r\n whileInView: { opacity: 1, transition: { duration: animate.duration } },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n </g>\r\n <g>\r\n <motion.path\r\n d={lineShape1(dataFormatted) || ''}\r\n style={{\r\n fill: 'none',\r\n stroke: lineColors[0],\r\n strokeWidth,\r\n }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { pathLength: 0, d: lineShape1(dataFormatted) || '', opacity: 1 },\r\n whileInView: {\r\n pathLength: 1,\r\n d: lineShape1(dataFormatted) || '',\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n <motion.path\r\n style={{\r\n fill: 'none',\r\n stroke: lineColors[1],\r\n strokeWidth,\r\n }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { pathLength: 0, d: lineShape2(dataFormatted) || '', opacity: 1 },\r\n whileInView: {\r\n pathLength: 1,\r\n d: lineShape2(dataFormatted) || '',\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n {showColorLegendAtTop ? null : (\r\n <g>\r\n <motion.text\r\n key={colorDomain[0]}\r\n style={{ fill: lineColors[0] }}\r\n className='text-xs'\r\n dx={5}\r\n dy={4}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: {\r\n opacity: 0,\r\n x: x(dataFormatted[dataFormatted.length - 1].date),\r\n y: y(dataFormatted[dataFormatted.length - 1].y1 as number),\r\n },\r\n whileInView: {\r\n opacity: 1,\r\n x: x(dataFormatted[dataFormatted.length - 1].date),\r\n y: y(dataFormatted[dataFormatted.length - 1].y1 as number),\r\n transition: {\r\n duration: hasAnimatedOnce ? animate.duration : 0.5,\r\n delay: hasAnimatedOnce ? 0 : animate.duration,\r\n },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n >\r\n {colorDomain[0]}\r\n </motion.text>\r\n <motion.text\r\n key={colorDomain[1]}\r\n style={{ fill: lineColors[1] }}\r\n className='text-xs'\r\n dx={5}\r\n dy={4}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: {\r\n opacity: 0,\r\n x: x(dataFormatted[dataFormatted.length - 1].date),\r\n y: y(dataFormatted[dataFormatted.length - 1].y2 as number),\r\n },\r\n whileInView: {\r\n opacity: 1,\r\n x: x(dataFormatted[dataFormatted.length - 1].date),\r\n y: y(dataFormatted[dataFormatted.length - 1].y2 as number),\r\n transition: {\r\n duration: hasAnimatedOnce ? animate.duration : 0.5,\r\n delay: hasAnimatedOnce ? 0 : animate.duration,\r\n },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n >\r\n {colorDomain[1]}\r\n </motion.text>\r\n </g>\r\n )}\r\n {mouseOverData ? (\r\n <line\r\n y1={0}\r\n y2={graphHeight}\r\n x1={x(mouseOverData.date)}\r\n x2={x(mouseOverData.date)}\r\n className={cn(\r\n 'undp-tick-line stroke-primary-gray-700 dark:stroke-primary-gray-100',\r\n classNames?.mouseOverLine,\r\n )}\r\n style={styles?.mouseOverLine}\r\n />\r\n ) : null}\r\n {dataFormatted.map((d, i) => (\r\n <motion.g key={i}>\r\n {!checkIfNullOrUndefined(d.y1) ? (\r\n <>\r\n {showDots ? (\r\n <motion.circle\r\n r={\r\n graphWidth / dataFormatted.length < 5\r\n ? 0\r\n : graphWidth / dataFormatted.length < 20\r\n ? 2\r\n : 4\r\n }\r\n style={{ fill: lineColors[0] }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 0, cx: x(d.date), cy: y(d.y1) },\r\n whileInView: {\r\n opacity: 1,\r\n transition: { duration: 0.5, delay: animate.duration },\r\n cx: x(d.date),\r\n cy: y(d.y1),\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n ) : null}\r\n {showValues ? (\r\n <motion.text\r\n dy={d.y2 < d.y1 ? -8 : '1em'}\r\n style={{\r\n fill: lineColors[0],\r\n textAnchor: 'middle',\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n className={cn(\r\n 'graph-value graph-value-line-1 text-xs font-bold',\r\n classNames?.graphObjectValues,\r\n )}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 0, x: x(d.date), y: y(d.y1) },\r\n whileInView: {\r\n opacity: 1,\r\n x: x(d.date),\r\n y: y(d.y1),\r\n transition: {\r\n duration: hasAnimatedOnce ? animate.duration : 0.5,\r\n delay: hasAnimatedOnce ? 0 : animate.duration,\r\n },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n >\r\n {numberFormattingFunction(d.y1, 'NA', precision, prefix, suffix)}\r\n </motion.text>\r\n ) : null}\r\n </>\r\n ) : null}\r\n {!checkIfNullOrUndefined(d.y2) ? (\r\n <>\r\n {showDots ? (\r\n <motion.circle\r\n r={\r\n graphWidth / dataFormatted.length < 5\r\n ? 0\r\n : graphWidth / dataFormatted.length < 20\r\n ? 2\r\n : 4\r\n }\r\n style={{ fill: lineColors[1] }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 0, cx: x(d.date), cy: y(d.y2) },\r\n whileInView: {\r\n opacity: 1,\r\n transition: {\r\n duration: hasAnimatedOnce ? animate.duration : 0.5,\r\n delay: hasAnimatedOnce ? 0 : animate.duration,\r\n },\r\n cx: x(d.date),\r\n cy: y(d.y2),\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n ) : null}\r\n {showValues ? (\r\n <motion.text\r\n dy={d.y2 > d.y1 ? -8 : '1em'}\r\n style={{\r\n fill: lineColors[1],\r\n textAnchor: 'middle',\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n className={cn(\r\n 'graph-value graph-value-line-2 text-xs font-bold',\r\n classNames?.graphObjectValues,\r\n )}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 0, x: x(d.date), y: y(d.y2) },\r\n whileInView: {\r\n opacity: 1,\r\n x: x(d.date),\r\n y: y(d.y2),\r\n transition: {\r\n duration: hasAnimatedOnce ? animate.duration : 0.5,\r\n delay: hasAnimatedOnce ? 0 : animate.duration,\r\n },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n >\r\n {numberFormattingFunction(d.y2, 'NA', precision, prefix, suffix)}\r\n </motion.text>\r\n ) : null}\r\n </>\r\n ) : null}\r\n </motion.g>\r\n ))}\r\n </g>\r\n {refValues ? (\r\n <>\r\n {refValues.map((el, i) => (\r\n <RefLineY\r\n key={i}\r\n text={el.text}\r\n color={el.color}\r\n y={y(el.value as number)}\r\n x1={0 - leftMargin}\r\n x2={graphWidth + margin.right}\r\n classNames={el.classNames}\r\n styles={el.styles}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n ))}\r\n </>\r\n ) : null}\r\n <g>\r\n {annotations.map((d, i) => {\r\n const endPoints = getLineEndPoint(\r\n {\r\n x: d.xCoordinate\r\n ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) + (d.xOffset || 0)\r\n : 0 + (d.xOffset || 0),\r\n y: d.yCoordinate\r\n ? y(d.yCoordinate as number) + (d.yOffset || 0) - 8\r\n : 0 + (d.yOffset || 0) - 8,\r\n },\r\n {\r\n x: d.xCoordinate ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) : 0,\r\n y: d.yCoordinate ? y(d.yCoordinate as number) : 0,\r\n },\r\n checkIfNullOrUndefined(d.connectorRadius) ? 3.5 : (d.connectorRadius as number),\r\n );\r\n const connectorSettings = d.showConnector\r\n ? {\r\n y1: endPoints.y,\r\n x1: endPoints.x,\r\n y2: d.yCoordinate\r\n ? y(d.yCoordinate as number) + (d.yOffset || 0)\r\n : 0 + (d.yOffset || 0),\r\n x2: d.xCoordinate\r\n ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) + (d.xOffset || 0)\r\n : 0 + (d.xOffset || 0),\r\n cy: d.yCoordinate ? y(d.yCoordinate as number) : 0,\r\n cx: d.xCoordinate ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) : 0,\r\n circleRadius: checkIfNullOrUndefined(d.connectorRadius)\r\n ? 3.5\r\n : (d.connectorRadius as number),\r\n strokeWidth: d.showConnector === true ? 2 : Math.min(d.showConnector || 0, 1),\r\n }\r\n : undefined;\r\n const labelSettings = {\r\n y: d.yCoordinate\r\n ? y(d.yCoordinate as number) + (d.yOffset || 0) - 8\r\n : 0 + (d.yOffset || 0) - 8,\r\n x: rtl\r\n ? 0\r\n : d.xCoordinate\r\n ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) + (d.xOffset || 0)\r\n : 0 + (d.xOffset || 0),\r\n width: rtl\r\n ? d.xCoordinate\r\n ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) + (d.xOffset || 0)\r\n : 0 + (d.xOffset || 0)\r\n : graphWidth +\r\n margin.right -\r\n (d.xCoordinate\r\n ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) + (d.xOffset || 0)\r\n : 0 + (d.xOffset || 0)),\r\n maxWidth: d.maxWidth,\r\n fontWeight: d.fontWeight,\r\n align: d.align,\r\n };\r\n return (\r\n <Annotation\r\n key={i}\r\n color={d.color}\r\n connectorsSettings={connectorSettings}\r\n labelSettings={labelSettings}\r\n text={d.text}\r\n classNames={d.classNames}\r\n styles={d.styles}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n );\r\n })}\r\n </g>\r\n {customLayers.filter(d => d.position === 'after').map(d => d.layer)}\r\n <rect\r\n ref={MouseoverRectRef}\r\n style={{\r\n fill: 'none',\r\n pointerEvents: 'all',\r\n }}\r\n width={graphWidth}\r\n height={graphHeight}\r\n />\r\n </g>\r\n </motion.svg>\r\n {mouseOverData && tooltip && eventX && eventY ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={eventX}\r\n yPos={eventY}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import { useState, useRef, useEffect } from 'react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { ColorLegend } from '@/Components/Elements/ColorLegend';\r\nimport {\r\n AnnotationSettingsDataType,\r\n CustomHighlightAreaSettingsDataType,\r\n DifferenceLineChartDataType,\r\n Languages,\r\n ReferenceDataType,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n HighlightAreaSettingsDataType,\r\n CurveTypes,\r\n CustomLayerDataType,\r\n AnimateDataType,\r\n} from '@/Types';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { generateRandomString } from '@/Utils/generateRandomString';\r\nimport { EmptyState } from '@/Components/Elements/EmptyState';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: DifferenceLineChartDataType[];\r\n\r\n // Titles, Labels, and Sources\r\n /** Title of the graph */\r\n graphTitle?: string | React.ReactNode;\r\n /** Description of the graph */\r\n graphDescription?: string | React.ReactNode;\r\n /** Footnote for the graph */\r\n footNote?: string | React.ReactNode;\r\n /** Source data for the graph */\r\n sources?: SourcesDataType[];\r\n /** Accessibility label */\r\n ariaLabel?: string;\r\n\r\n // Colors and Styling\r\n /** Array of colors for the 2 lines */\r\n lineColors?: [string, string];\r\n /** Array of colors to highlight the negative and positive difference between the lines */\r\n diffAreaColors?: [string, string];\r\n /** Toggle the visibility of color legend between the top of the graphs and next to the line */\r\n showColorLegendAtTop?: boolean;\r\n /** Title for the color legend */\r\n colorLegendTitle?: string;\r\n /** Background color of the graph */\r\n backgroundColor?: string | boolean;\r\n /** Custom styles for the graph. Each object should be a valid React CSS style object. */\r\n styles?: StyleObject;\r\n /** Custom class names */\r\n classNames?: ClassNameObject;\r\n\r\n // Size and Spacing\r\n /** Width of the graph */\r\n width?: number;\r\n /** Height of the graph */\r\n height?: number;\r\n /** Minimum height of the graph */\r\n minHeight?: number;\r\n /** Relative height scaling factor. This overwrites the height props */\r\n relativeHeight?: number;\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n /** Left margin of the graph */\r\n leftMargin?: number;\r\n /** Right margin of the graph */\r\n rightMargin?: number;\r\n /** Top margin of the graph */\r\n topMargin?: number;\r\n /** Bottom margin of the graph */\r\n bottomMargin?: number;\r\n\r\n // Values and Ticks\r\n /** Prefix for values */\r\n prefix?: string;\r\n /** Suffix for values */\r\n suffix?: string;\r\n /** Maximum value for the chart */\r\n maxValue?: number;\r\n /** Minimum value for the chart */\r\n minValue?: number;\r\n /** Maximum value of the date for the chart */\r\n maxDate?: string | number;\r\n /** Minimum value of the date for the chart */\r\n minDate?: string | number;\r\n /** Reference values for comparison */\r\n refValues?: ReferenceDataType[];\r\n /** No. of ticks on the x-axis */\r\n noOfXTicks?: number;\r\n /** No. of ticks on the y-axis */\r\n noOfYTicks?: number;\r\n\r\n // Graph Parameters\r\n /** Toggle visibility of values */\r\n showValues?: boolean;\r\n /** Toggle visibility of dots on the line */\r\n showDots?: boolean;\r\n /** Stroke width of the line */\r\n strokeWidth?: number;\r\n /** Toggle the initial animation of the line. If the type is number then it uses the number as the time in seconds for animation. */\r\n animate?: boolean | AnimateDataType;\r\n /** Labels for the lines */\r\n labels: [string, string];\r\n /** Format of the date in the data object. Available formats can be found [here](https://date-fns.org/docs/format) */\r\n dateFormat?: string;\r\n /** Title for the Y-axis */\r\n yAxisTitle?: string;\r\n /** Annotations on the chart */\r\n annotations?: AnnotationSettingsDataType[];\r\n /** Highlighted area(square) on the chart */\r\n highlightAreaSettings?: HighlightAreaSettingsDataType[];\r\n /** Highlighted area(custom shape) on the chart */\r\n customHighlightAreaSettings?: CustomHighlightAreaSettingsDataType[];\r\n /** Curve type for the line */\r\n curveType?: CurveTypes;\r\n /** Specifies the number of decimal places to display in the value. */\r\n precision?: number;\r\n /** Optional SVG <g> element or function that renders custom content behind or in front of the graph. */\r\n customLayers?: CustomLayerDataType[];\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n\r\n // Interactions and Callbacks\r\n /** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n /** Callback for mouse over event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n\r\n // Configuration and Options\r\n /** Language setting */\r\n language?: Languages;\r\n /** Color theme */\r\n theme?: 'light' | 'dark';\r\n /** Unique ID for the graph */\r\n graphID?: string;\r\n}\r\n\r\nexport function DifferenceLineChart(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n suffix = '',\r\n sources,\r\n prefix = '',\r\n graphDescription,\r\n height,\r\n width,\r\n footNote,\r\n noOfXTicks = 10,\r\n dateFormat = 'yyyy',\r\n showValues = false,\r\n padding,\r\n lineColors = [\r\n Colors.light.categoricalColors.colors[0],\r\n Colors.light.categoricalColors.colors[1],\r\n ],\r\n backgroundColor = false,\r\n leftMargin = 30,\r\n rightMargin = 50,\r\n topMargin = 20,\r\n bottomMargin = 25,\r\n tooltip,\r\n highlightAreaSettings = [],\r\n relativeHeight,\r\n onSeriesMouseOver,\r\n graphID,\r\n graphDownload = false,\r\n dataDownload = false,\r\n animate = false,\r\n language = 'en',\r\n minHeight = 0,\r\n labels,\r\n showColorLegendAtTop = false,\r\n colorLegendTitle,\r\n diffAreaColors = [Colors.alerts.red, Colors.alerts.darkGreen],\r\n strokeWidth = 2,\r\n showDots = true,\r\n refValues = [],\r\n minValue,\r\n maxValue,\r\n annotations = [],\r\n customHighlightAreaSettings = [],\r\n theme = 'light',\r\n ariaLabel,\r\n yAxisTitle,\r\n noOfYTicks = 5,\r\n minDate,\r\n maxDate,\r\n curveType = 'curve',\r\n styles,\r\n classNames,\r\n precision = 2,\r\n customLayers = [],\r\n } = props;\r\n\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(width || entries[0].target.clientWidth || 620);\r\n setSvgHeight(height || entries[0].target.clientHeight || 480);\r\n });\r\n if (graphDiv.current) {\r\n setSvgHeight(graphDiv.current.clientHeight || 480);\r\n setSvgWidth(graphDiv.current.clientWidth || 620);\r\n if (!width) resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, [width, height]);\r\n\r\n return (\r\n <div\r\n className={`${theme || 'light'} flex ${width ? 'w-fit grow-0' : 'w-full grow'}`}\r\n dir={language === 'he' || language === 'ar' ? 'rtl' : undefined}\r\n >\r\n <div\r\n className={cn(\r\n `${\r\n !backgroundColor\r\n ? 'bg-transparent '\r\n : backgroundColor === true\r\n ? 'bg-primary-gray-200 dark:bg-primary-gray-650 '\r\n : ''\r\n }ml-auto mr-auto flex flex-col grow h-inherit ${language || 'en'}`,\r\n width ? 'w-fit' : 'w-full',\r\n classNames?.graphContainer,\r\n )}\r\n style={{\r\n ...(styles?.graphContainer || {}),\r\n ...(backgroundColor && backgroundColor !== true ? { backgroundColor } : {}),\r\n }}\r\n id={graphID}\r\n ref={graphParentDiv}\r\n aria-label={\r\n ariaLabel ||\r\n `${\r\n graphTitle ? `The graph shows ${graphTitle}. ` : ''\r\n }This is a line chart that highlights the difference between two datasets over time.${\r\n graphDescription ? ` ${graphDescription}` : ''\r\n }`\r\n }\r\n >\r\n <div\r\n className='flex grow'\r\n style={{ padding: backgroundColor ? padding || '1rem' : padding || 0 }}\r\n >\r\n <div className='flex flex-col w-full gap-4 grow justify-between'>\r\n {graphTitle || graphDescription || graphDownload || dataDownload ? (\r\n <GraphHeader\r\n styles={{\r\n title: styles?.title,\r\n description: styles?.description,\r\n }}\r\n classNames={{\r\n title: classNames?.title,\r\n description: classNames?.description,\r\n }}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n width={width}\r\n graphDownload={graphDownload ? graphParentDiv.current : undefined}\r\n dataDownload={\r\n dataDownload\r\n ? data.map(d => d.data).filter(d => d !== undefined).length > 0\r\n ? data.map(d => d.data).filter(d => d !== undefined)\r\n : data.filter(d => d !== undefined)\r\n : null\r\n }\r\n />\r\n ) : null}\r\n <div className='grow flex flex-col justify-center gap-3 w-full'>\r\n {data.length === 0 ? (\r\n <EmptyState />\r\n ) : (\r\n <>\r\n {showColorLegendAtTop ? (\r\n <ColorLegend\r\n colorDomain={labels}\r\n colorLegendTitle={colorLegendTitle}\r\n colors={lineColors}\r\n showNAColor={false}\r\n />\r\n ) : null}\r\n <div\r\n className='flex flex-col grow justify-center leading-0'\r\n ref={graphDiv}\r\n aria-label='Graph area'\r\n >\r\n {(width || svgWidth) && (height || svgHeight) ? (\r\n <Graph\r\n data={data}\r\n lineColors={lineColors}\r\n colorDomain={labels}\r\n width={width || svgWidth}\r\n height={Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}\r\n suffix={suffix}\r\n prefix={prefix}\r\n dateFormat={dateFormat}\r\n showValues={showValues}\r\n noOfXTicks={noOfXTicks}\r\n leftMargin={leftMargin}\r\n rightMargin={rightMargin}\r\n topMargin={topMargin}\r\n bottomMargin={bottomMargin}\r\n highlightAreaSettings={highlightAreaSettings}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n showColorLegendAtTop={showColorLegendAtTop}\r\n animate={\r\n animate === true\r\n ? { duration: 0.5, once: true, amount: 0.5 }\r\n : animate || { duration: 0, once: true, amount: 0 }\r\n }\r\n rtl={language === 'he' || language === 'ar'}\r\n diffAreaColors={diffAreaColors}\r\n idSuffix={generateRandomString(8)}\r\n strokeWidth={strokeWidth}\r\n showDots={showDots}\r\n refValues={refValues}\r\n minValue={minValue}\r\n maxValue={maxValue}\r\n annotations={annotations}\r\n customHighlightAreaSettings={customHighlightAreaSettings}\r\n yAxisTitle={yAxisTitle}\r\n noOfYTicks={noOfYTicks}\r\n minDate={minDate}\r\n maxDate={maxDate}\r\n curveType={curveType}\r\n styles={styles}\r\n classNames={classNames}\r\n precision={precision}\r\n customLayers={customLayers}\r\n />\r\n ) : null}\r\n </div>\r\n </>\r\n )}\r\n </div>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n}\r\n"],"names":["Graph","props","data","width","height","lineColors","suffix","prefix","dateFormat","showValues","noOfXTicks","rightMargin","leftMargin","topMargin","bottomMargin","tooltip","highlightAreaSettings","onSeriesMouseOver","animate","rtl","showColorLegendAtTop","colorDomain","diffAreaColors","idSuffix","strokeWidth","showDots","refValues","minValue","maxValue","annotations","customHighlightAreaSettings","yAxisTitle","noOfYTicks","minDate","maxDate","curveType","styles","classNames","precision","customLayers","svgRef","useRef","isInView","useInView","hasAnimatedOnce","setHasAnimatedOnce","useState","useEffect","timeout","curve","curveLinear","curveStep","curveStepAfter","curveStepBefore","curveMonotoneX","mouseOverData","setMouseOverData","eventX","setEventX","eventY","setEventY","margin","MouseoverRectRef","dataFormatted","orderBy","d","parse","highlightAreaSettingsFormatted","customHighlightAreaSettingsFormatted","el","j","graphWidth","graphHeight","minYear","maxYear","minParam1","minParam2","maxParam1","maxParam2","minParam","checkIfNullOrUndefined","maxParam","x","scaleTime","y","scaleLinear","lineShape1","line","lineShape2","mainGraphArea","area","mainGraphArea1","mainGraphArea2","yTicks","xTicks","mousemove","event","selectedData","bisectCenter","pointer","mouseout","select","jsxs","Fragment","jsx","motion","HighlightArea","CustomArea","YTicksAndGridLines","Axis","numberFormattingFunction","AxisTitle","XTicksAndGridLines","format","cn","i","RefLineY","endPoints","getLineEndPoint","connectorSettings","labelSettings","Annotation","Tooltip","DifferenceLineChart","graphTitle","sources","graphDescription","footNote","padding","Colors","backgroundColor","relativeHeight","graphID","graphDownload","dataDownload","language","minHeight","labels","colorLegendTitle","theme","ariaLabel","svgWidth","setSvgWidth","svgHeight","setSvgHeight","graphDiv","graphParentDiv","resizeObserver","entries","GraphHeader","EmptyState","ColorLegend","generateRandomString","GraphFooter"],"mappings":"6rCA6FO,SAASA,GAAMC,GAAc,CAClC,KAAM,CACJ,KAAAC,EACA,MAAAC,EACA,OAAAC,EACA,WAAAC,EACA,OAAAC,EACA,OAAAC,EACA,WAAAC,EACA,WAAAC,EACA,WAAAC,EACA,YAAAC,GACA,WAAAC,EACA,UAAAC,GACA,aAAAC,EACA,QAAAC,EACA,sBAAAC,EACA,kBAAAC,EACA,QAAAC,EACA,IAAAC,EACA,qBAAAC,GACA,YAAAC,EACA,eAAAC,EACA,SAAAC,EACA,YAAAC,EACA,SAAAC,EACA,UAAAC,EACA,SAAAC,EACA,SAAAC,E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,OAAQ,CAAE,SAAUrH,GAAQ,SAAU,OAAQA,GAAQ,MAAA,EACtD,WAAY,CACV,SAAUC,GAAY,SACtB,OAAQA,GAAY,MAAA,EAEtB,QAAAwF,EACA,SAAAE,EACA,MAAA5H,CAAA,CAAA,EAEA,IAAA,CAAA,CACN,CAAA,CAAA,CACF,CAAA,CACF,CAAA,CAGN"}
1
+ {"version":3,"file":"DifferenceLineChart.cjs","sources":["../src/Components/Graphs/LineCharts/DifferenceLineChart/Graph.tsx","../src/Components/Graphs/LineCharts/DifferenceLineChart/index.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\r\nimport {\r\n line,\r\n curveMonotoneX,\r\n area,\r\n curveLinear,\r\n curveStep,\r\n curveStepAfter,\r\n curveStepBefore,\r\n} from 'd3-shape';\r\nimport { scaleLinear, scaleTime } from 'd3-scale';\r\nimport { format } from 'date-fns/format';\r\nimport { parse } from 'date-fns/parse';\r\nimport { bisectCenter } from 'd3-array';\r\nimport { pointer, select } from 'd3-selection';\r\nimport { motion, useInView } from 'motion/react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport orderBy from 'lodash.orderby';\r\n\r\nimport {\r\n AnimateDataType,\r\n AnnotationSettingsDataType,\r\n ClassNameObject,\r\n CurveTypes,\r\n CustomHighlightAreaSettingsDataType,\r\n CustomLayerDataType,\r\n DifferenceLineChartDataType,\r\n HighlightAreaSettingsDataType,\r\n ReferenceDataType,\r\n StyleObject,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { getLineEndPoint } from '@/Utils/getLineEndPoint';\r\nimport { AxisTitle } from '@/Components/Elements/Axes/AxisTitle';\r\nimport { Axis } from '@/Components/Elements/Axes/Axis';\r\nimport { XTicksAndGridLines } from '@/Components/Elements/Axes/XTicksAndGridLines';\r\nimport { RefLineY } from '@/Components/Elements/ReferenceLine';\r\nimport { Annotation } from '@/Components/Elements/Annotations';\r\nimport { YTicksAndGridLines } from '@/Components/Elements/Axes/YTicksAndGridLines';\r\nimport { HighlightArea } from '@/Components/Elements/HighlightArea';\r\nimport { CustomArea } from '@/Components/Elements/HighlightArea/customArea';\r\n\r\ninterface Props {\r\n data: DifferenceLineChartDataType[];\r\n lineColors: [string, string];\r\n diffAreaColors: [string, string];\r\n width: number;\r\n height: number;\r\n suffix: string;\r\n prefix: string;\r\n dateFormat: string;\r\n showValues: boolean;\r\n noOfXTicks: number;\r\n rightMargin: number;\r\n leftMargin: number;\r\n topMargin: number;\r\n bottomMargin: number;\r\n highlightAreaSettings: HighlightAreaSettingsDataType[];\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n animate: AnimateDataType;\r\n rtl: boolean;\r\n colorDomain: [string, string];\r\n showColorLegendAtTop?: boolean;\r\n idSuffix: string;\r\n strokeWidth: number;\r\n showDots: boolean;\r\n refValues: ReferenceDataType[];\r\n maxValue?: number;\r\n minValue?: number;\r\n annotations: AnnotationSettingsDataType[];\r\n customHighlightAreaSettings: CustomHighlightAreaSettingsDataType[];\r\n yAxisTitle?: string;\r\n noOfYTicks: number;\r\n minDate?: string | number;\r\n maxDate?: string | number;\r\n curveType: CurveTypes;\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n precision: number;\r\n customLayers: CustomLayerDataType[];\r\n}\r\n\r\ninterface FormattedDataType {\r\n y1: number;\r\n y2: number;\r\n date: Date;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n width,\r\n height,\r\n lineColors,\r\n suffix,\r\n prefix,\r\n dateFormat,\r\n showValues,\r\n noOfXTicks,\r\n rightMargin,\r\n leftMargin,\r\n topMargin,\r\n bottomMargin,\r\n tooltip,\r\n highlightAreaSettings,\r\n onSeriesMouseOver,\r\n animate,\r\n rtl,\r\n showColorLegendAtTop,\r\n colorDomain,\r\n diffAreaColors,\r\n idSuffix,\r\n strokeWidth,\r\n showDots,\r\n refValues,\r\n minValue,\r\n maxValue,\r\n annotations,\r\n customHighlightAreaSettings,\r\n yAxisTitle,\r\n noOfYTicks,\r\n minDate,\r\n maxDate,\r\n curveType,\r\n styles,\r\n classNames,\r\n precision,\r\n customLayers,\r\n } = props;\r\n const svgRef = useRef(null);\r\n const isInView = useInView(svgRef, {\r\n once: animate.once,\r\n amount: animate.amount,\r\n });\r\n const [hasAnimatedOnce, setHasAnimatedOnce] = useState(false);\r\n\r\n useEffect(() => {\r\n if (isInView && !hasAnimatedOnce) {\r\n const timeout = setTimeout(\r\n () => {\r\n setHasAnimatedOnce(true);\r\n },\r\n (animate.duration + 0.5) * 1000,\r\n );\r\n return () => clearTimeout(timeout);\r\n }\r\n }, [isInView, hasAnimatedOnce, animate.duration]);\r\n const curve =\r\n curveType === 'linear'\r\n ? curveLinear\r\n : curveType === 'step'\r\n ? curveStep\r\n : curveType === 'stepAfter'\r\n ? curveStepAfter\r\n : curveType === 'stepBefore'\r\n ? curveStepBefore\r\n : curveMonotoneX;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n const margin = {\r\n top: topMargin,\r\n bottom: bottomMargin,\r\n left: yAxisTitle ? leftMargin + 30 : leftMargin,\r\n right: rightMargin,\r\n };\r\n const MouseoverRectRef = useRef(null);\r\n const dataFormatted = orderBy(\r\n data.map(d => ({\r\n ...d,\r\n date: parse(`${d.date}`, dateFormat, new Date()),\r\n })),\r\n ['date'],\r\n ['asc'],\r\n );\r\n const highlightAreaSettingsFormatted = highlightAreaSettings.map(d => ({\r\n ...d,\r\n coordinates: [\r\n d.coordinates[0] === null ? null : parse(`${d.coordinates[0]}`, dateFormat, new Date()),\r\n d.coordinates[1] === null ? null : parse(`${d.coordinates[1]}`, dateFormat, new Date()),\r\n ],\r\n }));\r\n const customHighlightAreaSettingsFormatted = customHighlightAreaSettings.map(d => ({\r\n ...d,\r\n coordinates: d.coordinates.map((el, j) =>\r\n j % 2 === 0 ? parse(`${el}`, dateFormat, new Date()) : (el as number),\r\n ),\r\n }));\r\n const graphWidth = width - margin.left - margin.right;\r\n const graphHeight = height - margin.top - margin.bottom;\r\n const minYear = minDate ? parse(`${minDate}`, dateFormat, new Date()) : dataFormatted[0].date;\r\n const maxYear = maxDate\r\n ? parse(`${maxDate}`, dateFormat, new Date())\r\n : dataFormatted[dataFormatted.length - 1].date;\r\n const minParam1 =\r\n Math.min(...dataFormatted.map(d => d.y1)) !== Infinity\r\n ? Math.min(...dataFormatted.map(d => d.y1)) > 0\r\n ? 0\r\n : Math.min(...dataFormatted.map(d => d.y1))\r\n : 0;\r\n const minParam2 =\r\n Math.min(...dataFormatted.map(d => d.y2)) !== Infinity\r\n ? Math.min(...dataFormatted.map(d => d.y2)) > 0\r\n ? 0\r\n : Math.min(...dataFormatted.map(d => d.y2))\r\n : 0;\r\n const maxParam1 =\r\n Math.max(...dataFormatted.map(d => d.y1)) !== Infinity\r\n ? Math.max(...dataFormatted.map(d => d.y1))\r\n : 0;\r\n const maxParam2 =\r\n Math.max(...dataFormatted.map(d => d.y2)) !== Infinity\r\n ? Math.max(...dataFormatted.map(d => d.y2))\r\n : 0;\r\n\r\n const minParam = checkIfNullOrUndefined(minValue)\r\n ? minParam1 < minParam2\r\n ? minParam1\r\n : minParam2\r\n : (minValue as number);\r\n const maxParam = maxParam1 > maxParam2 ? maxParam1 : maxParam2;\r\n const x = scaleTime().domain([minYear, maxYear]).range([0, graphWidth]);\r\n\r\n const y = scaleLinear()\r\n .domain([\r\n checkIfNullOrUndefined(minValue) ? minParam : (minValue as number),\r\n checkIfNullOrUndefined(maxValue) ? (maxParam > 0 ? maxParam : 0) : (maxValue as number),\r\n ])\r\n .range([graphHeight, 0])\r\n .nice();\r\n\r\n const lineShape1 = line<FormattedDataType>()\r\n .x(d => x(d.date))\r\n .y(d => y(d.y1))\r\n .curve(curve);\r\n\r\n const lineShape2 = line<FormattedDataType>()\r\n .x(d => x(d.date))\r\n .y(d => y(d.y2))\r\n .curve(curve);\r\n\r\n const mainGraphArea = area<FormattedDataType>()\r\n .x(d => x(d.date))\r\n .y1(d => y(d.y1))\r\n .y0(d => y(d.y2))\r\n .curve(curve);\r\n const mainGraphArea1 = area<FormattedDataType>()\r\n .x(d => x(d.date))\r\n .y1(d => y(d.y1))\r\n .y0(0)\r\n .curve(curve);\r\n const mainGraphArea2 = area<FormattedDataType>()\r\n .x(d => x(d.date))\r\n .y1(d => y(d.y2))\r\n .y0(0)\r\n .curve(curve);\r\n const yTicks = y.ticks(noOfYTicks);\r\n const xTicks = x.ticks(noOfXTicks);\r\n useEffect(() => {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const mousemove = (event: any) => {\r\n const selectedData =\r\n dataFormatted[\r\n bisectCenter(\r\n dataFormatted.map(d => d.date),\r\n x.invert(pointer(event)[0]),\r\n 0,\r\n )\r\n ];\r\n setMouseOverData(selectedData || dataFormatted[dataFormatted.length - 1]);\r\n onSeriesMouseOver?.(selectedData || dataFormatted[dataFormatted.length - 1]);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n };\r\n const mouseout = () => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n };\r\n select(MouseoverRectRef.current).on('mousemove', mousemove).on('mouseout', mouseout);\r\n }, [x, dataFormatted, onSeriesMouseOver]);\r\n return (\r\n <>\r\n <motion.svg\r\n width={`${width}px`}\r\n height={`${height}px`}\r\n viewBox={`0 0 ${width} ${height}`}\r\n direction='ltr'\r\n ref={svgRef}\r\n >\r\n <g transform={`translate(${margin.left},${margin.top})`}>\r\n <clipPath id={`above${idSuffix}`}>\r\n <path\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d={mainGraphArea2(dataFormatted as any) as string}\r\n style={{ fill: 'none' }}\r\n />\r\n </clipPath>\r\n <clipPath id={`below${idSuffix}`}>\r\n <path\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d={mainGraphArea1(dataFormatted as any) as string}\r\n style={{ fill: 'none' }}\r\n />\r\n </clipPath>\r\n <HighlightArea\r\n areaSettings={highlightAreaSettingsFormatted}\r\n width={graphWidth}\r\n height={graphHeight}\r\n scale={x}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n <CustomArea\r\n areaSettings={customHighlightAreaSettingsFormatted}\r\n scaleX={x}\r\n scaleY={y}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n <g>\r\n <g>\r\n <YTicksAndGridLines\r\n values={yTicks.filter(d => d !== 0)}\r\n y={yTicks.filter(d => d !== 0).map(d => y(d))}\r\n x1={0 - leftMargin}\r\n x2={graphWidth + margin.right}\r\n styles={{\r\n gridLines: styles?.yAxis?.gridLines,\r\n labels: styles?.yAxis?.labels,\r\n }}\r\n classNames={{\r\n gridLines: classNames?.yAxis?.gridLines,\r\n labels: classNames?.yAxis?.labels,\r\n }}\r\n suffix={suffix}\r\n prefix={prefix}\r\n labelType='secondary'\r\n showGridLines\r\n labelPos='vertical'\r\n precision={precision}\r\n />\r\n <Axis\r\n y1={y(minParam < 0 ? 0 : minParam)}\r\n y2={y(minParam < 0 ? 0 : minParam)}\r\n x1={0 - leftMargin}\r\n x2={graphWidth + margin.right}\r\n label={numberFormattingFunction(\r\n minParam < 0 ? 0 : minParam,\r\n 'NA',\r\n precision,\r\n prefix,\r\n suffix,\r\n )}\r\n labelPos={{\r\n x: 0 - leftMargin,\r\n y: y(minParam < 0 ? 0 : minParam),\r\n dx: 0,\r\n dy: maxParam < 0 ? '1rem' : -5,\r\n }}\r\n classNames={{\r\n axis: classNames?.xAxis?.axis,\r\n label: classNames?.yAxis?.labels,\r\n }}\r\n styles={{\r\n axis: styles?.xAxis?.axis,\r\n label: styles?.yAxis?.labels,\r\n }}\r\n />\r\n <AxisTitle\r\n x={0 - leftMargin - 15}\r\n y={graphHeight / 2}\r\n style={styles?.yAxis?.title}\r\n className={classNames?.yAxis?.title}\r\n text={yAxisTitle}\r\n rotate90\r\n />\r\n </g>\r\n </g>\r\n <XTicksAndGridLines\r\n values={xTicks.map(d => format(d, dateFormat))}\r\n x={xTicks.map(d => x(d))}\r\n y1={0}\r\n y2={graphHeight}\r\n styles={{\r\n gridLines: styles?.xAxis?.gridLines,\r\n labels: styles?.xAxis?.labels,\r\n }}\r\n classNames={{\r\n gridLines: cn('opacity-0', classNames?.xAxis?.gridLines),\r\n labels: cn(\r\n 'fill-primary-gray-700 dark:fill-primary-gray-300 xs:max-[360px]:hidden text-[9px] md:text-[10px] lg:text-xs',\r\n classNames?.xAxis?.labels,\r\n ),\r\n }}\r\n suffix={suffix}\r\n prefix={prefix}\r\n labelType='primary'\r\n showGridLines\r\n precision={precision}\r\n />\r\n {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n <g>\r\n <motion.path\r\n clipPath={`url(#below${idSuffix})`}\r\n d={mainGraphArea(dataFormatted) || ''}\r\n style={{ fill: diffAreaColors[1] }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 1 },\r\n whileInView: { opacity: 1, transition: { duration: animate.duration } },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n <motion.path\r\n clipPath={`url(#above${idSuffix})`}\r\n d={mainGraphArea(dataFormatted) || ''}\r\n style={{ fill: diffAreaColors[0] }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 0 },\r\n whileInView: { opacity: 1, transition: { duration: animate.duration } },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n </g>\r\n <g>\r\n <motion.path\r\n d={lineShape1(dataFormatted) || ''}\r\n style={{\r\n fill: 'none',\r\n stroke: lineColors[0],\r\n strokeWidth,\r\n }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { pathLength: 0, d: lineShape1(dataFormatted) || '', opacity: 1 },\r\n whileInView: {\r\n pathLength: 1,\r\n d: lineShape1(dataFormatted) || '',\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n <motion.path\r\n style={{\r\n fill: 'none',\r\n stroke: lineColors[1],\r\n strokeWidth,\r\n }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { pathLength: 0, d: lineShape2(dataFormatted) || '', opacity: 1 },\r\n whileInView: {\r\n pathLength: 1,\r\n d: lineShape2(dataFormatted) || '',\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n {showColorLegendAtTop ? null : (\r\n <g>\r\n <motion.text\r\n key={colorDomain[0]}\r\n className='text-xs'\r\n dx={5}\r\n dy={4}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: {\r\n opacity: 0,\r\n x: x(dataFormatted[dataFormatted.length - 1].date),\r\n y: y(dataFormatted[dataFormatted.length - 1].y1 as number),\r\n fill: lineColors[0],\r\n },\r\n whileInView: {\r\n opacity: 1,\r\n x: x(dataFormatted[dataFormatted.length - 1].date),\r\n y: y(dataFormatted[dataFormatted.length - 1].y1 as number),\r\n fill: lineColors[0],\r\n transition: {\r\n duration: hasAnimatedOnce ? animate.duration : 0.5,\r\n delay: hasAnimatedOnce ? 0 : animate.duration,\r\n },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n >\r\n {colorDomain[0]}\r\n </motion.text>\r\n <motion.text\r\n key={colorDomain[1]}\r\n className='text-xs'\r\n dx={5}\r\n dy={4}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: {\r\n opacity: 0,\r\n x: x(dataFormatted[dataFormatted.length - 1].date),\r\n y: y(dataFormatted[dataFormatted.length - 1].y2 as number),\r\n fill: lineColors[1],\r\n },\r\n whileInView: {\r\n opacity: 1,\r\n x: x(dataFormatted[dataFormatted.length - 1].date),\r\n y: y(dataFormatted[dataFormatted.length - 1].y2 as number),\r\n fill: lineColors[1],\r\n transition: {\r\n duration: hasAnimatedOnce ? animate.duration : 0.5,\r\n delay: hasAnimatedOnce ? 0 : animate.duration,\r\n },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n >\r\n {colorDomain[1]}\r\n </motion.text>\r\n </g>\r\n )}\r\n {mouseOverData ? (\r\n <line\r\n y1={0}\r\n y2={graphHeight}\r\n x1={x(mouseOverData.date)}\r\n x2={x(mouseOverData.date)}\r\n className={cn(\r\n 'undp-tick-line stroke-primary-gray-700 dark:stroke-primary-gray-100',\r\n classNames?.mouseOverLine,\r\n )}\r\n style={styles?.mouseOverLine}\r\n />\r\n ) : null}\r\n {dataFormatted.map((d, i) => (\r\n <motion.g key={i}>\r\n {!checkIfNullOrUndefined(d.y1) ? (\r\n <>\r\n {showDots ? (\r\n <motion.circle\r\n r={\r\n graphWidth / dataFormatted.length < 5\r\n ? 0\r\n : graphWidth / dataFormatted.length < 20\r\n ? 2\r\n : 4\r\n }\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 0, cx: x(d.date), cy: y(d.y1), fill: lineColors[0] },\r\n whileInView: {\r\n opacity: 1,\r\n fill: lineColors[0],\r\n transition: { duration: 0.5, delay: animate.duration },\r\n cx: x(d.date),\r\n cy: y(d.y1),\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n ) : null}\r\n {showValues ? (\r\n <motion.text\r\n dy={d.y2 < d.y1 ? -8 : '1em'}\r\n style={{\r\n textAnchor: 'middle',\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n className={cn(\r\n 'graph-value graph-value-line-1 text-xs font-bold',\r\n classNames?.graphObjectValues,\r\n )}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 0, x: x(d.date), y: y(d.y1), fill: lineColors[0] },\r\n whileInView: {\r\n opacity: 1,\r\n fill: lineColors[0],\r\n x: x(d.date),\r\n y: y(d.y1),\r\n transition: {\r\n duration: hasAnimatedOnce ? animate.duration : 0.5,\r\n delay: hasAnimatedOnce ? 0 : animate.duration,\r\n },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n >\r\n {numberFormattingFunction(d.y1, 'NA', precision, prefix, suffix)}\r\n </motion.text>\r\n ) : null}\r\n </>\r\n ) : null}\r\n {!checkIfNullOrUndefined(d.y2) ? (\r\n <>\r\n {showDots ? (\r\n <motion.circle\r\n r={\r\n graphWidth / dataFormatted.length < 5\r\n ? 0\r\n : graphWidth / dataFormatted.length < 20\r\n ? 2\r\n : 4\r\n }\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 0, cx: x(d.date), cy: y(d.y2), fill: lineColors[1] },\r\n whileInView: {\r\n opacity: 1,\r\n fill: lineColors[1],\r\n transition: {\r\n duration: hasAnimatedOnce ? animate.duration : 0.5,\r\n delay: hasAnimatedOnce ? 0 : animate.duration,\r\n },\r\n cx: x(d.date),\r\n cy: y(d.y2),\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n ) : null}\r\n {showValues ? (\r\n <motion.text\r\n dy={d.y2 > d.y1 ? -8 : '1em'}\r\n style={{\r\n textAnchor: 'middle',\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n className={cn(\r\n 'graph-value graph-value-line-2 text-xs font-bold',\r\n classNames?.graphObjectValues,\r\n )}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 0, x: x(d.date), y: y(d.y2), fill: lineColors[1] },\r\n whileInView: {\r\n opacity: 1,\r\n x: x(d.date),\r\n y: y(d.y2),\r\n fill: lineColors[1],\r\n transition: {\r\n duration: hasAnimatedOnce ? animate.duration : 0.5,\r\n delay: hasAnimatedOnce ? 0 : animate.duration,\r\n },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n >\r\n {numberFormattingFunction(d.y2, 'NA', precision, prefix, suffix)}\r\n </motion.text>\r\n ) : null}\r\n </>\r\n ) : null}\r\n </motion.g>\r\n ))}\r\n </g>\r\n {refValues ? (\r\n <>\r\n {refValues.map((el, i) => (\r\n <RefLineY\r\n key={i}\r\n text={el.text}\r\n color={el.color}\r\n y={y(el.value as number)}\r\n x1={0 - leftMargin}\r\n x2={graphWidth + margin.right}\r\n classNames={el.classNames}\r\n styles={el.styles}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n ))}\r\n </>\r\n ) : null}\r\n <g>\r\n {annotations.map((d, i) => {\r\n const endPoints = getLineEndPoint(\r\n {\r\n x: d.xCoordinate\r\n ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) + (d.xOffset || 0)\r\n : 0 + (d.xOffset || 0),\r\n y: d.yCoordinate\r\n ? y(d.yCoordinate as number) + (d.yOffset || 0) - 8\r\n : 0 + (d.yOffset || 0) - 8,\r\n },\r\n {\r\n x: d.xCoordinate ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) : 0,\r\n y: d.yCoordinate ? y(d.yCoordinate as number) : 0,\r\n },\r\n checkIfNullOrUndefined(d.connectorRadius) ? 3.5 : (d.connectorRadius as number),\r\n );\r\n const connectorSettings = d.showConnector\r\n ? {\r\n y1: endPoints.y,\r\n x1: endPoints.x,\r\n y2: d.yCoordinate\r\n ? y(d.yCoordinate as number) + (d.yOffset || 0)\r\n : 0 + (d.yOffset || 0),\r\n x2: d.xCoordinate\r\n ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) + (d.xOffset || 0)\r\n : 0 + (d.xOffset || 0),\r\n cy: d.yCoordinate ? y(d.yCoordinate as number) : 0,\r\n cx: d.xCoordinate ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) : 0,\r\n circleRadius: checkIfNullOrUndefined(d.connectorRadius)\r\n ? 3.5\r\n : (d.connectorRadius as number),\r\n strokeWidth: d.showConnector === true ? 2 : Math.min(d.showConnector || 0, 1),\r\n }\r\n : undefined;\r\n const labelSettings = {\r\n y: d.yCoordinate\r\n ? y(d.yCoordinate as number) + (d.yOffset || 0) - 8\r\n : 0 + (d.yOffset || 0) - 8,\r\n x: rtl\r\n ? 0\r\n : d.xCoordinate\r\n ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) + (d.xOffset || 0)\r\n : 0 + (d.xOffset || 0),\r\n width: rtl\r\n ? d.xCoordinate\r\n ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) + (d.xOffset || 0)\r\n : 0 + (d.xOffset || 0)\r\n : graphWidth +\r\n margin.right -\r\n (d.xCoordinate\r\n ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) + (d.xOffset || 0)\r\n : 0 + (d.xOffset || 0)),\r\n maxWidth: d.maxWidth,\r\n fontWeight: d.fontWeight,\r\n align: d.align,\r\n };\r\n return (\r\n <Annotation\r\n key={i}\r\n color={d.color}\r\n connectorsSettings={connectorSettings}\r\n labelSettings={labelSettings}\r\n text={d.text}\r\n classNames={d.classNames}\r\n styles={d.styles}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n );\r\n })}\r\n </g>\r\n {customLayers.filter(d => d.position === 'after').map(d => d.layer)}\r\n <rect\r\n ref={MouseoverRectRef}\r\n style={{\r\n fill: 'none',\r\n pointerEvents: 'all',\r\n }}\r\n width={graphWidth}\r\n height={graphHeight}\r\n />\r\n </g>\r\n </motion.svg>\r\n {mouseOverData && tooltip && eventX && eventY ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={eventX}\r\n yPos={eventY}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import { useState, useRef, useEffect } from 'react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { ColorLegend } from '@/Components/Elements/ColorLegend';\r\nimport {\r\n AnnotationSettingsDataType,\r\n CustomHighlightAreaSettingsDataType,\r\n DifferenceLineChartDataType,\r\n Languages,\r\n ReferenceDataType,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n HighlightAreaSettingsDataType,\r\n CurveTypes,\r\n CustomLayerDataType,\r\n AnimateDataType,\r\n} from '@/Types';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { generateRandomString } from '@/Utils/generateRandomString';\r\nimport { EmptyState } from '@/Components/Elements/EmptyState';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: DifferenceLineChartDataType[];\r\n\r\n // Titles, Labels, and Sources\r\n /** Title of the graph */\r\n graphTitle?: string | React.ReactNode;\r\n /** Description of the graph */\r\n graphDescription?: string | React.ReactNode;\r\n /** Footnote for the graph */\r\n footNote?: string | React.ReactNode;\r\n /** Source data for the graph */\r\n sources?: SourcesDataType[];\r\n /** Accessibility label */\r\n ariaLabel?: string;\r\n\r\n // Colors and Styling\r\n /** Array of colors for the 2 lines */\r\n lineColors?: [string, string];\r\n /** Array of colors to highlight the negative and positive difference between the lines */\r\n diffAreaColors?: [string, string];\r\n /** Toggle the visibility of color legend between the top of the graphs and next to the line */\r\n showColorLegendAtTop?: boolean;\r\n /** Title for the color legend */\r\n colorLegendTitle?: string;\r\n /** Background color of the graph */\r\n backgroundColor?: string | boolean;\r\n /** Custom styles for the graph. Each object should be a valid React CSS style object. */\r\n styles?: StyleObject;\r\n /** Custom class names */\r\n classNames?: ClassNameObject;\r\n\r\n // Size and Spacing\r\n /** Width of the graph */\r\n width?: number;\r\n /** Height of the graph */\r\n height?: number;\r\n /** Minimum height of the graph */\r\n minHeight?: number;\r\n /** Relative height scaling factor. This overwrites the height props */\r\n relativeHeight?: number;\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n /** Left margin of the graph */\r\n leftMargin?: number;\r\n /** Right margin of the graph */\r\n rightMargin?: number;\r\n /** Top margin of the graph */\r\n topMargin?: number;\r\n /** Bottom margin of the graph */\r\n bottomMargin?: number;\r\n\r\n // Values and Ticks\r\n /** Prefix for values */\r\n prefix?: string;\r\n /** Suffix for values */\r\n suffix?: string;\r\n /** Maximum value for the chart */\r\n maxValue?: number;\r\n /** Minimum value for the chart */\r\n minValue?: number;\r\n /** Maximum value of the date for the chart */\r\n maxDate?: string | number;\r\n /** Minimum value of the date for the chart */\r\n minDate?: string | number;\r\n /** Reference values for comparison */\r\n refValues?: ReferenceDataType[];\r\n /** No. of ticks on the x-axis */\r\n noOfXTicks?: number;\r\n /** No. of ticks on the y-axis */\r\n noOfYTicks?: number;\r\n\r\n // Graph Parameters\r\n /** Toggle visibility of values */\r\n showValues?: boolean;\r\n /** Toggle visibility of dots on the line */\r\n showDots?: boolean;\r\n /** Stroke width of the line */\r\n strokeWidth?: number;\r\n /** Toggle the initial animation of the line. If the type is number then it uses the number as the time in seconds for animation. */\r\n animate?: boolean | AnimateDataType;\r\n /** Labels for the lines */\r\n labels: [string, string];\r\n /** Format of the date in the data object. Available formats can be found [here](https://date-fns.org/docs/format) */\r\n dateFormat?: string;\r\n /** Title for the Y-axis */\r\n yAxisTitle?: string;\r\n /** Annotations on the chart */\r\n annotations?: AnnotationSettingsDataType[];\r\n /** Highlighted area(square) on the chart */\r\n highlightAreaSettings?: HighlightAreaSettingsDataType[];\r\n /** Highlighted area(custom shape) on the chart */\r\n customHighlightAreaSettings?: CustomHighlightAreaSettingsDataType[];\r\n /** Curve type for the line */\r\n curveType?: CurveTypes;\r\n /** Specifies the number of decimal places to display in the value. */\r\n precision?: number;\r\n /** Optional SVG <g> element or function that renders custom content behind or in front of the graph. */\r\n customLayers?: CustomLayerDataType[];\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n\r\n // Interactions and Callbacks\r\n /** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n /** Callback for mouse over event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n\r\n // Configuration and Options\r\n /** Language setting */\r\n language?: Languages;\r\n /** Color theme */\r\n theme?: 'light' | 'dark';\r\n /** Unique ID for the graph */\r\n graphID?: string;\r\n}\r\n\r\nexport function DifferenceLineChart(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n suffix = '',\r\n sources,\r\n prefix = '',\r\n graphDescription,\r\n height,\r\n width,\r\n footNote,\r\n noOfXTicks = 10,\r\n dateFormat = 'yyyy',\r\n showValues = false,\r\n padding,\r\n lineColors = [\r\n Colors.light.categoricalColors.colors[0],\r\n Colors.light.categoricalColors.colors[1],\r\n ],\r\n backgroundColor = false,\r\n leftMargin = 30,\r\n rightMargin = 50,\r\n topMargin = 20,\r\n bottomMargin = 25,\r\n tooltip,\r\n highlightAreaSettings = [],\r\n relativeHeight,\r\n onSeriesMouseOver,\r\n graphID,\r\n graphDownload = false,\r\n dataDownload = false,\r\n animate = false,\r\n language = 'en',\r\n minHeight = 0,\r\n labels,\r\n showColorLegendAtTop = false,\r\n colorLegendTitle,\r\n diffAreaColors = [Colors.alerts.red, Colors.alerts.darkGreen],\r\n strokeWidth = 2,\r\n showDots = true,\r\n refValues = [],\r\n minValue,\r\n maxValue,\r\n annotations = [],\r\n customHighlightAreaSettings = [],\r\n theme = 'light',\r\n ariaLabel,\r\n yAxisTitle,\r\n noOfYTicks = 5,\r\n minDate,\r\n maxDate,\r\n curveType = 'curve',\r\n styles,\r\n classNames,\r\n precision = 2,\r\n customLayers = [],\r\n } = props;\r\n\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(width || entries[0].target.clientWidth || 620);\r\n setSvgHeight(height || entries[0].target.clientHeight || 480);\r\n });\r\n if (graphDiv.current) {\r\n setSvgHeight(graphDiv.current.clientHeight || 480);\r\n setSvgWidth(graphDiv.current.clientWidth || 620);\r\n if (!width) resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, [width, height]);\r\n\r\n return (\r\n <div\r\n className={`${theme || 'light'} flex ${width ? 'w-fit grow-0' : 'w-full grow'}`}\r\n dir={language === 'he' || language === 'ar' ? 'rtl' : undefined}\r\n >\r\n <div\r\n className={cn(\r\n `${\r\n !backgroundColor\r\n ? 'bg-transparent '\r\n : backgroundColor === true\r\n ? 'bg-primary-gray-200 dark:bg-primary-gray-650 '\r\n : ''\r\n }ml-auto mr-auto flex flex-col grow h-inherit ${language || 'en'}`,\r\n width ? 'w-fit' : 'w-full',\r\n classNames?.graphContainer,\r\n )}\r\n style={{\r\n ...(styles?.graphContainer || {}),\r\n ...(backgroundColor && backgroundColor !== true ? { backgroundColor } : {}),\r\n }}\r\n id={graphID}\r\n ref={graphParentDiv}\r\n aria-label={\r\n ariaLabel ||\r\n `${\r\n graphTitle ? `The graph shows ${graphTitle}. ` : ''\r\n }This is a line chart that highlights the difference between two datasets over time.${\r\n graphDescription ? ` ${graphDescription}` : ''\r\n }`\r\n }\r\n >\r\n <div\r\n className='flex grow'\r\n style={{ padding: backgroundColor ? padding || '1rem' : padding || 0 }}\r\n >\r\n <div className='flex flex-col w-full gap-4 grow justify-between'>\r\n {graphTitle || graphDescription || graphDownload || dataDownload ? (\r\n <GraphHeader\r\n styles={{\r\n title: styles?.title,\r\n description: styles?.description,\r\n }}\r\n classNames={{\r\n title: classNames?.title,\r\n description: classNames?.description,\r\n }}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n width={width}\r\n graphDownload={graphDownload ? graphParentDiv.current : undefined}\r\n dataDownload={\r\n dataDownload\r\n ? data.map(d => d.data).filter(d => d !== undefined).length > 0\r\n ? data.map(d => d.data).filter(d => d !== undefined)\r\n : data.filter(d => d !== undefined)\r\n : null\r\n }\r\n />\r\n ) : null}\r\n <div className='grow flex flex-col justify-center gap-3 w-full'>\r\n {data.length === 0 ? (\r\n <EmptyState />\r\n ) : (\r\n <>\r\n {showColorLegendAtTop ? (\r\n <ColorLegend\r\n colorDomain={labels}\r\n colorLegendTitle={colorLegendTitle}\r\n colors={lineColors}\r\n showNAColor={false}\r\n />\r\n ) : null}\r\n <div\r\n className='flex flex-col grow justify-center leading-0'\r\n ref={graphDiv}\r\n aria-label='Graph area'\r\n >\r\n {(width || svgWidth) && (height || svgHeight) ? (\r\n <Graph\r\n data={data}\r\n lineColors={lineColors}\r\n colorDomain={labels}\r\n width={width || svgWidth}\r\n height={Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}\r\n suffix={suffix}\r\n prefix={prefix}\r\n dateFormat={dateFormat}\r\n showValues={showValues}\r\n noOfXTicks={noOfXTicks}\r\n leftMargin={leftMargin}\r\n rightMargin={rightMargin}\r\n topMargin={topMargin}\r\n bottomMargin={bottomMargin}\r\n highlightAreaSettings={highlightAreaSettings}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n showColorLegendAtTop={showColorLegendAtTop}\r\n animate={\r\n animate === true\r\n ? { duration: 0.5, once: true, amount: 0.5 }\r\n : animate || { duration: 0, once: true, amount: 0 }\r\n }\r\n rtl={language === 'he' || language === 'ar'}\r\n diffAreaColors={diffAreaColors}\r\n idSuffix={generateRandomString(8)}\r\n strokeWidth={strokeWidth}\r\n showDots={showDots}\r\n refValues={refValues}\r\n minValue={minValue}\r\n maxValue={maxValue}\r\n annotations={annotations}\r\n customHighlightAreaSettings={customHighlightAreaSettings}\r\n yAxisTitle={yAxisTitle}\r\n noOfYTicks={noOfYTicks}\r\n minDate={minDate}\r\n maxDate={maxDate}\r\n curveType={curveType}\r\n styles={styles}\r\n classNames={classNames}\r\n precision={precision}\r\n customLayers={customLayers}\r\n />\r\n ) : null}\r\n </div>\r\n </>\r\n )}\r\n </div>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n}\r\n"],"names":["Graph","props","data","width","height","lineColors","suffix","prefix","dateFormat","showValues","noOfXTicks","rightMargin","leftMargin","topMargin","bottomMargin","tooltip","highlightAreaSettings","onSeriesMouseOver","animate","rtl","showColorLegendAtTop","colorDomain","diffAreaColors","idSuffix","strokeWidth","showDots","refValues","minValue","maxValue","annotations","customHighlightAreaSettings","yAxisTitle","noOfYTicks","minDate","maxDate","curveType","styles","classNames","precision","customLayers","svgRef","useRef","isInView","useInView","hasAnimatedOnce","setHasAnimatedOnce","useState","useEffect","timeout","curve","curveLinear","curveStep","curveStepAfter","curveStepBefore","curveMonotoneX","mouseOverData","setMouseOverData","eventX","setEventX","eventY","setEventY","margin","MouseoverRectRef","dataFormatted","orderBy","d","parse","highlightAreaSettingsFormatted","customHighlightAreaSettingsFormatted","el","j","graphWidth","graphHeight","minYear","maxYear","minParam1","minParam2","maxParam1","maxParam2","minParam","checkIfNullOrUndefined","maxParam","x","scaleTime","y","scaleLinear","lineShape1","line","lineShape2","mainGraphArea","area","mainGraphArea1","mainGraphArea2","yTicks","xTicks","mousemove","event","selectedData","bisectCenter","pointer","mouseout","select","jsxs","Fragment","jsx","motion","HighlightArea","CustomArea","YTicksAndGridLines","Axis","numberFormattingFunction","AxisTitle","XTicksAndGridLines","format","cn","i","RefLineY","endPoints","getLineEndPoint","connectorSettings","labelSettings","Annotation","Tooltip","DifferenceLineChart","graphTitle","sources","graphDescription","footNote","padding","Colors","backgroundColor","relativeHeight","graphID","graphDownload","dataDownload","language","minHeight","labels","colorLegendTitle","theme","ariaLabel","svgWidth","setSvgWidth","svgHeight","setSvgHeight","graphDiv","graphParentDiv","resizeObserver","entries","GraphHeader","EmptyState","ColorLegend","generateRandomString","GraphFooter"],"mappings":"6rCA6FO,SAASA,GAAMC,GAAc,CAClC,KAAM,CACJ,KAAAC,EACA,MAAAC,EACA,OAAAC,EACA,WAAAC,EACA,OAAAC,EACA,OAAAC,EACA,WAAAC,EACA,WAAAC,EACA,WAAAC,EACA,YAAAC,GACA,WAAAC,EACA,UAAAC,GACA,aAAAC,EACA,QAAAC,EACA,sBAAAC,EACA,kBAAAC,EACA,QAAAC,EACA,IAAAC,EACA,qBAAAC,GACA,YAAAC,EACA,eAAAC,EACA,SAAAC,EACA,YAAAC,EACA,SAAAC,EACA,UAAAC,EACA,SAAAC,EACA,SAAAC,EACA,YAAAC,EACA,4BAAAC,EACA,WAAAC,EACA,WAAAC,GACA,QAAAC,GACA,QAAAC,GACA,UAAAC,EACA,OAAAC,EACA,WAAAC,EACA,UAAAC,EACA,aAAAC,EAAA,E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