@undp/data-viz 2.1.3 → 2.1.4

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 (118) hide show
  1. package/dist/AreaChart.cjs +1 -1
  2. package/dist/AreaChart.cjs.map +1 -1
  3. package/dist/AreaChart.js +279 -272
  4. package/dist/AreaChart.js.map +1 -1
  5. package/dist/BarGraph.cjs +1 -1
  6. package/dist/BarGraph.cjs.map +1 -1
  7. package/dist/BarGraph.d.ts +2 -0
  8. package/dist/BarGraph.js +1795 -1724
  9. package/dist/BarGraph.js.map +1 -1
  10. package/dist/BeeSwarmChart.cjs +1 -1
  11. package/dist/BeeSwarmChart.cjs.map +1 -1
  12. package/dist/BeeSwarmChart.js +312 -305
  13. package/dist/BeeSwarmChart.js.map +1 -1
  14. package/dist/BulletChart.cjs +1 -1
  15. package/dist/BulletChart.cjs.map +1 -1
  16. package/dist/BulletChart.js +298 -287
  17. package/dist/BulletChart.js.map +1 -1
  18. package/dist/ButterflyChart.cjs +1 -1
  19. package/dist/ButterflyChart.cjs.map +1 -1
  20. package/dist/ButterflyChart.js +224 -217
  21. package/dist/ButterflyChart.js.map +1 -1
  22. package/dist/CirclePackingGraph.cjs +1 -1
  23. package/dist/CirclePackingGraph.js +2 -2
  24. package/dist/DifferenceLineChart.cjs +1 -1
  25. package/dist/DifferenceLineChart.cjs.map +1 -1
  26. package/dist/DifferenceLineChart.js +404 -397
  27. package/dist/DifferenceLineChart.js.map +1 -1
  28. package/dist/DonutChart.cjs +1 -1
  29. package/dist/DonutChart.cjs.map +1 -1
  30. package/dist/DonutChart.js +42 -39
  31. package/dist/DonutChart.js.map +1 -1
  32. package/dist/DualAxisLineChart.cjs +1 -1
  33. package/dist/DualAxisLineChart.cjs.map +1 -1
  34. package/dist/DualAxisLineChart.js +320 -313
  35. package/dist/DualAxisLineChart.js.map +1 -1
  36. package/dist/DumbbellChart.cjs +1 -1
  37. package/dist/DumbbellChart.cjs.map +1 -1
  38. package/dist/DumbbellChart.js +298 -291
  39. package/dist/DumbbellChart.js.map +1 -1
  40. package/dist/{EmptyState-BZo1BbAn.js → EmptyState-C7ZXkZWd.js} +4 -4
  41. package/dist/EmptyState-C7ZXkZWd.js.map +1 -0
  42. package/dist/EmptyState-gLDRXBHm.cjs +2 -0
  43. package/dist/EmptyState-gLDRXBHm.cjs.map +1 -0
  44. package/dist/GraphEl-C2Fgg8PA.cjs +2 -0
  45. package/dist/GraphEl-C2Fgg8PA.cjs.map +1 -0
  46. package/dist/{GraphEl-CRrAlbcr.js → GraphEl-oZwZiTHI.js} +3 -2
  47. package/dist/GraphEl-oZwZiTHI.js.map +1 -0
  48. package/dist/GriddedGraphs.cjs +1 -1
  49. package/dist/GriddedGraphs.js +1 -1
  50. package/dist/HeatMap.cjs +1 -1
  51. package/dist/HeatMap.cjs.map +1 -1
  52. package/dist/HeatMap.js +179 -172
  53. package/dist/HeatMap.js.map +1 -1
  54. package/dist/Histogram.cjs +1 -1
  55. package/dist/Histogram.js +1 -1
  56. package/dist/LineChartWithConfidenceInterval.cjs +1 -1
  57. package/dist/LineChartWithConfidenceInterval.cjs.map +1 -1
  58. package/dist/LineChartWithConfidenceInterval.js +368 -361
  59. package/dist/LineChartWithConfidenceInterval.js.map +1 -1
  60. package/dist/MultiLineAltChart.cjs +1 -1
  61. package/dist/MultiLineAltChart.cjs.map +1 -1
  62. package/dist/MultiLineAltChart.js +327 -320
  63. package/dist/MultiLineAltChart.js.map +1 -1
  64. package/dist/MultiLineChart.cjs +1 -1
  65. package/dist/MultiLineChart.cjs.map +1 -1
  66. package/dist/MultiLineChart.js +374 -367
  67. package/dist/MultiLineChart.js.map +1 -1
  68. package/dist/ParetoChart.cjs +1 -1
  69. package/dist/ParetoChart.cjs.map +1 -1
  70. package/dist/ParetoChart.js +385 -378
  71. package/dist/ParetoChart.js.map +1 -1
  72. package/dist/RadarChart.cjs +1 -1
  73. package/dist/RadarChart.cjs.map +1 -1
  74. package/dist/RadarChart.js +34 -33
  75. package/dist/RadarChart.js.map +1 -1
  76. package/dist/SankeyChart.cjs +1 -1
  77. package/dist/SankeyChart.cjs.map +1 -1
  78. package/dist/SankeyChart.js +176 -169
  79. package/dist/SankeyChart.js.map +1 -1
  80. package/dist/ScatterPlot.cjs +1 -1
  81. package/dist/ScatterPlot.cjs.map +1 -1
  82. package/dist/ScatterPlot.js +366 -359
  83. package/dist/ScatterPlot.js.map +1 -1
  84. package/dist/SimpleLineChart.cjs +1 -1
  85. package/dist/SimpleLineChart.cjs.map +1 -1
  86. package/dist/SimpleLineChart.js +285 -278
  87. package/dist/SimpleLineChart.js.map +1 -1
  88. package/dist/SingleGraphDashboard.cjs +1 -1
  89. package/dist/SingleGraphDashboard.js +1 -1
  90. package/dist/SlopeChart.cjs +1 -1
  91. package/dist/SlopeChart.cjs.map +1 -1
  92. package/dist/SlopeChart.js +243 -236
  93. package/dist/SlopeChart.js.map +1 -1
  94. package/dist/StripChart.cjs +1 -1
  95. package/dist/StripChart.cjs.map +1 -1
  96. package/dist/StripChart.js +293 -286
  97. package/dist/StripChart.js.map +1 -1
  98. package/dist/TreeMapGraph.cjs +1 -1
  99. package/dist/TreeMapGraph.cjs.map +1 -1
  100. package/dist/TreeMapGraph.js +222 -215
  101. package/dist/TreeMapGraph.js.map +1 -1
  102. package/dist/index-Blvf-Q3U.cjs +2 -0
  103. package/dist/{index-CF5hnGvG.cjs.map → index-Blvf-Q3U.cjs.map} +1 -1
  104. package/dist/index-D1RrKgK6.js +337 -0
  105. package/dist/index-D1RrKgK6.js.map +1 -0
  106. package/dist/index.cjs +1 -1
  107. package/dist/index.d.ts +2 -0
  108. package/dist/index.js +1 -1
  109. package/package.json +1 -1
  110. package/dist/EmptyState-BZo1BbAn.js.map +0 -1
  111. package/dist/EmptyState-sAEZ_5rU.cjs +0 -2
  112. package/dist/EmptyState-sAEZ_5rU.cjs.map +0 -1
  113. package/dist/GraphEl-BLMih7RN.cjs +0 -2
  114. package/dist/GraphEl-BLMih7RN.cjs.map +0 -1
  115. package/dist/GraphEl-CRrAlbcr.js.map +0 -1
  116. package/dist/index-CF5hnGvG.cjs +0 -2
  117. package/dist/index-DPGq3eIL.js +0 -330
  118. package/dist/index-DPGq3eIL.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"DonutChart.cjs","sources":["../node_modules/d3-shape/src/math.js","../node_modules/d3-shape/src/descending.js","../node_modules/d3-shape/src/identity.js","../node_modules/d3-shape/src/pie.js","../src/Utils/getArc.ts","../src/Components/Graphs/DonutChart/Graph.tsx","../src/Components/Graphs/DonutChart/index.tsx"],"sourcesContent":["export const abs = Math.abs;\nexport const atan2 = Math.atan2;\nexport const cos = Math.cos;\nexport const max = Math.max;\nexport const min = Math.min;\nexport const sin = Math.sin;\nexport const sqrt = Math.sqrt;\n\nexport const epsilon = 1e-12;\nexport const pi = Math.PI;\nexport const halfPi = pi / 2;\nexport const tau = 2 * pi;\n\nexport function acos(x) {\n return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);\n}\n\nexport function asin(x) {\n return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x);\n}\n","export default function(a, b) {\n return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;\n}\n","export default function(d) {\n return d;\n}\n","import array from \"./array.js\";\nimport constant from \"./constant.js\";\nimport descending from \"./descending.js\";\nimport identity from \"./identity.js\";\nimport {tau} from \"./math.js\";\n\nexport default function() {\n var value = identity,\n sortValues = descending,\n sort = null,\n startAngle = constant(0),\n endAngle = constant(tau),\n padAngle = constant(0);\n\n function pie(data) {\n var i,\n n = (data = array(data)).length,\n j,\n k,\n sum = 0,\n index = new Array(n),\n arcs = new Array(n),\n a0 = +startAngle.apply(this, arguments),\n da = Math.min(tau, Math.max(-tau, endAngle.apply(this, arguments) - a0)),\n a1,\n p = Math.min(Math.abs(da) / n, padAngle.apply(this, arguments)),\n pa = p * (da < 0 ? -1 : 1),\n v;\n\n for (i = 0; i < n; ++i) {\n if ((v = arcs[index[i] = i] = +value(data[i], i, data)) > 0) {\n sum += v;\n }\n }\n\n // Optionally sort the arcs by previously-computed values or by data.\n if (sortValues != null) index.sort(function(i, j) { return sortValues(arcs[i], arcs[j]); });\n else if (sort != null) index.sort(function(i, j) { return sort(data[i], data[j]); });\n\n // Compute the arcs! They are stored in the original data's order.\n for (i = 0, k = sum ? (da - n * pa) / sum : 0; i < n; ++i, a0 = a1) {\n j = index[i], v = arcs[j], a1 = a0 + (v > 0 ? v * k : 0) + pa, arcs[j] = {\n data: data[j],\n index: i,\n value: v,\n startAngle: a0,\n endAngle: a1,\n padAngle: p\n };\n }\n\n return arcs;\n }\n\n pie.value = function(_) {\n return arguments.length ? (value = typeof _ === \"function\" ? _ : constant(+_), pie) : value;\n };\n\n pie.sortValues = function(_) {\n return arguments.length ? (sortValues = _, sort = null, pie) : sortValues;\n };\n\n pie.sort = function(_) {\n return arguments.length ? (sort = _, sortValues = null, pie) : sort;\n };\n\n pie.startAngle = function(_) {\n return arguments.length ? (startAngle = typeof _ === \"function\" ? _ : constant(+_), pie) : startAngle;\n };\n\n pie.endAngle = function(_) {\n return arguments.length ? (endAngle = typeof _ === \"function\" ? _ : constant(+_), pie) : endAngle;\n };\n\n pie.padAngle = function(_) {\n return arguments.length ? (padAngle = typeof _ === \"function\" ? _ : constant(+_), pie) : padAngle;\n };\n\n return pie;\n}\n","const polarToCartesian = (\r\n centerX: number,\r\n centerY: number,\r\n radius: number,\r\n angleInRadians: number,\r\n) => {\r\n return {\r\n x: centerX + radius * Math.cos(angleInRadians),\r\n y: centerY + radius * Math.sin(angleInRadians),\r\n };\r\n};\r\n\r\nexport function getArc(\r\n x: number,\r\n y: number,\r\n radius: number,\r\n startAngleInRadians: number,\r\n endAngleInRadians: number,\r\n) {\r\n const start = polarToCartesian(x, y, radius, startAngleInRadians);\r\n const end = polarToCartesian(x, y, radius, endAngleInRadians);\r\n const largeArcFlag = endAngleInRadians - startAngleInRadians <= Math.PI ? '0' : '1';\r\n const d = ['M', start.x, start.y, 'A', radius, radius, 0, largeArcFlag, 1, end.x, end.y].join(\r\n ' ',\r\n );\r\n return d;\r\n}\r\n","/* eslint-disable @typescript-eslint/no-explicit-any */\r\nimport isEqual from 'fast-deep-equal';\r\nimport { pie } from 'd3-shape';\r\nimport { useRef, useState } from 'react';\r\nimport { H2, P } from '@undp/design-system-react/Typography';\r\nimport { AnimatePresence, motion, useInView } from 'motion/react';\r\n\r\nimport { AnimateDataType, ClassNameObject, DonutChartDataType, StyleObject } from '@/Types';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { DetailsModal } from '@/Components/Elements/DetailsModal';\r\nimport { getArc } from '@/Utils/getArc';\r\n\r\ninterface Props {\r\n mainText?: string | { label: string; suffix?: string; prefix?: string };\r\n radius: number;\r\n colors: string[];\r\n subNote?: string;\r\n strokeWidth: number;\r\n data: DonutChartDataType[];\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n onSeriesMouseOver?: (_d: any) => void;\r\n onSeriesMouseClick?: (_d: any) => void;\r\n colorDomain: string[];\r\n resetSelectionOnDoubleClick: boolean;\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n precision: number;\r\n animate: AnimateDataType;\r\n trackColor: string;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n mainText,\r\n data,\r\n radius,\r\n colors,\r\n subNote,\r\n strokeWidth,\r\n tooltip,\r\n onSeriesMouseOver,\r\n onSeriesMouseClick,\r\n colorDomain,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n precision,\r\n animate,\r\n trackColor,\r\n } = props;\r\n const svgRef = useRef(null);\r\n const isInView = useInView(svgRef, {\r\n once: animate.once,\r\n amount: animate.amount,\r\n });\r\n const pieData = pie()\r\n .sort(null)\r\n .startAngle(0)\r\n .value((d: any) => d.size);\r\n\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n\r\n const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n return (\r\n <>\r\n <motion.svg\r\n ref={svgRef}\r\n width={`${radius * 2}px`}\r\n height={`${radius * 2}px`}\r\n viewBox={`0 0 ${radius * 2} ${radius * 2}`}\r\n direction='ltr'\r\n className='mx-auto'\r\n >\r\n <motion.g transform={`translate(${radius} ${radius})`}>\r\n {mainText || subNote ? (\r\n <foreignObject\r\n y={0 - (radius - strokeWidth)}\r\n x={0 - (radius - strokeWidth)}\r\n width={2 * (radius - strokeWidth)}\r\n height={2 * (radius - strokeWidth)}\r\n >\r\n <div className='flex flex-col gap-0.5 justify-center items-center h-inherit py-0 px-4'>\r\n {mainText ? (\r\n <H2\r\n marginBottom='none'\r\n className='donut-main-text text-primary-gray-700 dark:text-primary-gray-100 leading-none text-center'\r\n >\r\n {typeof mainText === 'string'\r\n ? mainText\r\n : data.findIndex(d => d.label === mainText.label) !== -1\r\n ? numberFormattingFunction(\r\n data[data.findIndex(d => d.label === mainText.label)].size,\r\n 'NA',\r\n precision,\r\n mainText.prefix,\r\n mainText.suffix,\r\n )\r\n : 'NA'}\r\n </H2>\r\n ) : null}\r\n {subNote ? (\r\n <P\r\n marginBottom='none'\r\n size='base'\r\n leading='none'\r\n className='donut-sub-note text-primary-gray-700 dark:text-primary-gray-100 text-center font-bold'\r\n >\r\n {subNote}\r\n </P>\r\n ) : typeof mainText === 'string' || !mainText ? null : (\r\n <P\r\n size='base'\r\n marginBottom='none'\r\n leading='none'\r\n className='donut-label text-primary-gray-700 dark:text-primary-gray-100 text-center font-bold'\r\n >\r\n {mainText.label}\r\n </P>\r\n )}\r\n </div>\r\n </foreignObject>\r\n ) : null}\r\n <circle\r\n cx={0}\r\n cy={0}\r\n r={radius - strokeWidth / 2}\r\n fill='none'\r\n stroke={trackColor}\r\n strokeWidth={strokeWidth}\r\n />\r\n <AnimatePresence>\r\n {pieData(data as any).map((d, i) => (\r\n <motion.path\r\n key={i}\r\n variants={{\r\n initial: {\r\n pathLength: 0,\r\n d: getArc(\r\n 0,\r\n 0,\r\n radius - strokeWidth / 2,\r\n d.startAngle - Math.PI / 2,\r\n d.endAngle - Math.PI / 2,\r\n ),\r\n opacity: mouseOverData\r\n ? mouseOverData.label === (d.data as any).label\r\n ? 1\r\n : 0.3\r\n : 1,\r\n },\r\n whileInView: {\r\n pathLength: 1,\r\n d: getArc(\r\n 0,\r\n 0,\r\n radius - strokeWidth / 2,\r\n d.startAngle - Math.PI / 2,\r\n d.endAngle - Math.PI / 2,\r\n ),\r\n opacity: mouseOverData\r\n ? mouseOverData.label === (d.data as any).label\r\n ? 1\r\n : 0.3\r\n : 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n style={{\r\n stroke:\r\n colorDomain.indexOf((d.data as any).label) !== -1\r\n ? colors[colorDomain.indexOf((d.data as any).label) % colors.length]\r\n : Colors.gray,\r\n strokeWidth,\r\n fill: 'none',\r\n }}\r\n onMouseEnter={event => {\r\n setMouseOverData(d.data);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.(d);\r\n }}\r\n onClick={() => {\r\n if (onSeriesMouseClick || detailsOnClick) {\r\n if (isEqual(mouseClickData, d.data) && resetSelectionOnDoubleClick) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n setMouseClickData(d.data);\r\n if (onSeriesMouseClick) onSeriesMouseClick(d.data);\r\n }\r\n }\r\n }}\r\n onMouseMove={event => {\r\n setMouseOverData(d.data);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n }}\r\n onMouseLeave={() => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n }}\r\n />\r\n ))}\r\n </AnimatePresence>\r\n </motion.g>\r\n </motion.svg>\r\n {mouseOverData && tooltip && eventX && eventY ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={eventX}\r\n yPos={eventY}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n {detailsOnClick && mouseClickData !== undefined ? (\r\n <DetailsModal\r\n body={detailsOnClick}\r\n data={mouseClickData}\r\n setData={setMouseClickData}\r\n className={classNames?.modal}\r\n />\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import { useEffect, useRef, useState } from 'react';\r\nimport { P } from '@undp/design-system-react/Typography';\r\nimport orderBy from 'lodash.orderby';\r\nimport { Spacer } from '@undp/design-system-react/Spacer';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport {\r\n DonutChartDataType,\r\n Languages,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n AnimateDataType,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { EmptyState } from '@/Components/Elements/EmptyState';\r\nimport { GraphArea, GraphContainer } from '@/Components/Elements/GraphContainer';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: DonutChartDataType[];\r\n\r\n // Titles, Labels, and Sources\r\n /** Title of the graph */\r\n graphTitle?: string | React.ReactNode;\r\n /** Description of the graph */\r\n graphDescription?: string | React.ReactNode;\r\n /** Footnote for the graph */\r\n footNote?: string | React.ReactNode;\r\n /** Source data for the graph */\r\n sources?: SourcesDataType[];\r\n /** Accessibility label */\r\n ariaLabel?: string;\r\n\r\n // Colors and Styling\r\n /** Array of colors for each segment */\r\n colors?: string[];\r\n /** Domain of colors for the graph */\r\n colorDomain?: string[];\r\n /** Background color of the graph */\r\n backgroundColor?: string | boolean;\r\n /** Custom styles for the graph. Each object should be a valid React CSS style object. */\r\n styles?: StyleObject;\r\n /** Custom class names */\r\n classNames?: ClassNameObject;\r\n\r\n // Size and Spacing\r\n /** Width of the graph */\r\n width?: number;\r\n /** Height of the graph */\r\n height?: number;\r\n /** Minimum height of the graph */\r\n minHeight?: number;\r\n /** Relative height scaling factor. This overwrites the height props */\r\n relativeHeight?: number;\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n /** Radius of the donut chart */\r\n radius?: number;\r\n\r\n // Values and Ticks\r\n /** Prefix for values */\r\n prefix?: string;\r\n /** Suffix for values */\r\n suffix?: string;\r\n\r\n // Graph Parameters\r\n /** Toggle visibility of color scale. This is only applicable if the data props hae color parameter */\r\n showColorScale?: boolean;\r\n /** Max width of the color scale as a css property */\r\n colorScaleMaxWidth?: string;\r\n /** Stroke width of the arcs and circle of the donut */\r\n strokeWidth?: number;\r\n /** Sorting order for data. This is overwritten by labelOrder prop */\r\n sortData?: 'asc' | 'desc';\r\n /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\r\n /** Large text at the center of the donut chart. If the type is an object then the text is the value in the data for the label mentioned in the object */\r\n mainText?: string | { label: string; suffix?: string; prefix?: string };\r\n /** Small text at the center of the donut chart */\r\n subNote?: string;\r\n /** Specifies the number of decimal places to display in the value. */\r\n precision?: number;\r\n /** Track color (i.e. the color of the donut chart's background) of the donut chart */\r\n trackColor?: string;\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n /** Reset selection on double-click. Only applicable when used in a dashboard context with filters. */\r\n resetSelectionOnDoubleClick?: boolean;\r\n\r\n // Interactions and Callbacks\r\n /** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n /** Details displayed on the modal when user clicks of a data point. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n /** Callback for mouse over event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n /** Callback for mouse click event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n\r\n // Configuration and Options\r\n /** Language setting */\r\n language?: Languages;\r\n /** Color theme */\r\n theme?: 'light' | 'dark';\r\n /** Unique ID for the graph */\r\n graphID?: string;\r\n}\r\n\r\nexport function DonutChart(props: Props) {\r\n const {\r\n mainText,\r\n graphTitle,\r\n colors = Colors.light.categoricalColors.colors,\r\n suffix = '',\r\n sources,\r\n prefix = '',\r\n strokeWidth = 50,\r\n graphDescription,\r\n subNote,\r\n footNote,\r\n radius,\r\n data,\r\n showColorScale = true,\r\n padding,\r\n backgroundColor = false,\r\n tooltip,\r\n onSeriesMouseOver,\r\n graphID,\r\n onSeriesMouseClick,\r\n graphDownload = false,\r\n dataDownload = false,\r\n colorDomain,\r\n sortData,\r\n language = 'en',\r\n theme = 'light',\r\n width,\r\n height,\r\n minHeight = 0,\r\n relativeHeight,\r\n ariaLabel,\r\n resetSelectionOnDoubleClick = true,\r\n colorScaleMaxWidth,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n precision = 2,\r\n animate = false,\r\n trackColor = Colors.light.grays['gray-200'],\r\n } = props;\r\n\r\n const [graphRadius, setGraphRadius] = useState(0);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setGraphRadius(\r\n (Math.min(\r\n ...[\r\n entries[0].target.clientWidth || 620,\r\n entries[0].target.clientHeight || 480,\r\n radius || Infinity,\r\n ],\r\n ) || 420) / 2,\r\n );\r\n });\r\n if (graphDiv.current) {\r\n resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, [radius]);\r\n\r\n const sortedData = sortData ? orderBy(data, ['size'], [sortData]) : data;\r\n\r\n return (\r\n <GraphContainer\r\n className={classNames?.graphContainer}\r\n style={styles?.graphContainer}\r\n id={graphID}\r\n ref={graphParentDiv}\r\n aria-label={ariaLabel}\r\n backgroundColor={backgroundColor}\r\n theme={theme}\r\n language={language}\r\n minHeight={minHeight}\r\n width={width}\r\n height={height}\r\n relativeHeight={relativeHeight}\r\n padding={padding}\r\n >\r\n {graphTitle || graphDescription || graphDownload || dataDownload ? (\r\n <GraphHeader\r\n styles={{\r\n title: styles?.title,\r\n description: styles?.description,\r\n }}\r\n classNames={{\r\n title: classNames?.title,\r\n description: classNames?.description,\r\n }}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n width={width}\r\n graphDownload={graphDownload ? graphParentDiv : undefined}\r\n dataDownload={\r\n dataDownload\r\n ? data.map(d => d.data).filter(d => d !== undefined).length > 0\r\n ? data.map(d => d.data).filter(d => d !== undefined)\r\n : data.filter(d => d !== undefined)\r\n : null\r\n }\r\n />\r\n ) : null}\r\n {data.length === 0 ? (\r\n <EmptyState />\r\n ) : (\r\n <>\r\n {showColorScale ? (\r\n <div\r\n className={cn(\r\n 'leading-0 flex mb-0 ml-auto mr-auto justify-center gap-x-3 gap-y-0 flex-wrap',\r\n classNames?.colorLegend,\r\n )}\r\n style={{ maxWidth: colorScaleMaxWidth }}\r\n aria-label='Color legend'\r\n >\r\n {sortedData.map((d, i) => (\r\n <div className='flex gap-2 items-center pb-3' key={i}>\r\n <div\r\n className='w-3 h-3 rounded-full'\r\n style={{\r\n backgroundColor:\r\n (colorDomain || sortedData.map(el => el.label)).indexOf(d.label) !== -1\r\n ? (colors || Colors[theme].categoricalColors.colors)[\r\n (colorDomain || sortedData.map(el => el.label)).indexOf(d.label) %\r\n (colors || Colors[theme].categoricalColors.colors).length\r\n ]\r\n : Colors.gray,\r\n }}\r\n />\r\n <P\r\n marginBottom='none'\r\n size='sm'\r\n className='text-primary-gray-700 dark:text-primary-gray-100'\r\n >\r\n {d.label}:{' '}\r\n <span className='font-bold' style={{ fontSize: 'inherit' }}>\r\n {numberFormattingFunction(d.size, 'NA', precision, prefix, suffix)}\r\n </span>\r\n </P>\r\n </div>\r\n ))}\r\n </div>\r\n ) : null}\r\n <Spacer size='lg' />\r\n <GraphArea ref={graphDiv}>\r\n {graphRadius ? (\r\n <Graph\r\n mainText={mainText}\r\n data={sortedData}\r\n colors={colors}\r\n radius={graphRadius}\r\n subNote={subNote}\r\n strokeWidth={strokeWidth}\r\n tooltip={tooltip}\r\n colorDomain={colorDomain || sortedData.map(d => d.label)}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n styles={styles}\r\n detailsOnClick={detailsOnClick}\r\n precision={precision}\r\n animate={\r\n animate === true\r\n ? { duration: 0.5, once: true, amount: 0.5 }\r\n : animate || { duration: 0, once: true, amount: 0 }\r\n }\r\n trackColor={trackColor}\r\n />\r\n ) : null}\r\n </GraphArea>\r\n </>\r\n )}\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </GraphContainer>\r\n );\r\n}\r\n"],"names":["pi","tau","descending","a","b","identity","d","pie","value","sortValues","sort","startAngle","constant","endAngle","padAngle","data","i","n","array","j","k","sum","index","arcs","a0","da","a1","p","pa","v","_","polarToCartesian","centerX","centerY","radius","angleInRadians","x","Math","cos","y","sin","getArc","startAngleInRadians","endAngleInRadians","start","end","largeArcFlag","PI","join","Graph","props","$","_c","mainText","colors","subNote","strokeWidth","tooltip","onSeriesMouseOver","onSeriesMouseClick","colorDomain","resetSelectionOnDoubleClick","detailsOnClick","styles","classNames","precision","animate","trackColor","svgRef","useRef","t0","amount","once","isInView","useInView","pieData","_temp","mouseOverData","setMouseOverData","useState","undefined","mouseClickData","setMouseClickData","eventX","setEventX","eventY","setEventY","t1","motion","t2","t3","t4","t5","t6","t7","t8","t9","jsx","jsxs","H2","findIndex","d_1","label","numberFormattingFunction","d_0","size","prefix","suffix","P","t10","t11","T0","AnimatePresence","t12","duration","d_2","initial","pathLength","opacity","whileInView","transition","stroke","indexOf","length","Colors","gray","fill","event","clientY","clientX","isEqual","event_0","t13","map","t14","t15","g","t16","svg","t17","Tooltip","t18","modal","DetailsModal","t19","Fragment","DonutChart","graphTitle","light","categoricalColors","sources","graphDescription","footNote","showColorScale","padding","backgroundColor","graphID","graphDownload","dataDownload","sortData","language","theme","width","height","minHeight","relativeHeight","ariaLabel","colorScaleMaxWidth","grays","graphRadius","setGraphRadius","graphDiv","graphParentDiv","useEffect","resizeObserver","ResizeObserver","entries","min","target","clientWidth","clientHeight","Infinity","current","observe","disconnect","sortedData","orderBy","GraphContainer","graphContainer","GraphHeader","title","description","filter","EmptyState","cn","colorLegend","maxWidth","el","fontSize","Spacer","GraphArea","GraphFooter","footnote","source"],"mappings":"0uBASaA,GAAK,KAAK,GAEVC,GAAM,EAAID,GCXR,SAAAE,GAASC,EAAGC,EAAG,CAC5B,OAAOA,EAAID,EAAI,GAAKC,EAAID,EAAI,EAAIC,GAAKD,EAAI,EAAI,GAC/C,CCFe,SAAAE,GAASC,EAAG,CACzB,OAAOA,CACT,CCIe,SAAAC,IAAW,CACxB,IAAIC,EAAQH,GACRI,EAAa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AAA,kBAAAA,IAACwG,GAAAA,YAAA,CACC,OAAQ,CAAEC,SAAU3I,GAAQ2I,SAAUC,OAAQ5I,GAAQ4I,MAAAA,EACtD,WAAY,CACVD,SAAU1I,GAAY0I,SACtBC,OAAQ3I,GAAY2I,MAAAA,EAEtB,QAAArD,EACA,SAAAE,EACA,MAAAU,CAAA,CAAa,EAEb,IAAA,EACN,CAEJ","x_google_ignoreList":[0,1,2,3]}
1
+ {"version":3,"file":"DonutChart.cjs","sources":["../node_modules/d3-shape/src/math.js","../node_modules/d3-shape/src/descending.js","../node_modules/d3-shape/src/identity.js","../node_modules/d3-shape/src/pie.js","../src/Utils/getArc.ts","../src/Components/Graphs/DonutChart/Graph.tsx","../src/Components/Graphs/DonutChart/index.tsx"],"sourcesContent":["export const abs = Math.abs;\nexport const atan2 = Math.atan2;\nexport const cos = Math.cos;\nexport const max = Math.max;\nexport const min = Math.min;\nexport const sin = Math.sin;\nexport const sqrt = Math.sqrt;\n\nexport const epsilon = 1e-12;\nexport const pi = Math.PI;\nexport const halfPi = pi / 2;\nexport const tau = 2 * pi;\n\nexport function acos(x) {\n return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);\n}\n\nexport function asin(x) {\n return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x);\n}\n","export default function(a, b) {\n return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;\n}\n","export default function(d) {\n return d;\n}\n","import array from \"./array.js\";\nimport constant from \"./constant.js\";\nimport descending from \"./descending.js\";\nimport identity from \"./identity.js\";\nimport {tau} from \"./math.js\";\n\nexport default function() {\n var value = identity,\n sortValues = descending,\n sort = null,\n startAngle = constant(0),\n endAngle = constant(tau),\n padAngle = constant(0);\n\n function pie(data) {\n var i,\n n = (data = array(data)).length,\n j,\n k,\n sum = 0,\n index = new Array(n),\n arcs = new Array(n),\n a0 = +startAngle.apply(this, arguments),\n da = Math.min(tau, Math.max(-tau, endAngle.apply(this, arguments) - a0)),\n a1,\n p = Math.min(Math.abs(da) / n, padAngle.apply(this, arguments)),\n pa = p * (da < 0 ? -1 : 1),\n v;\n\n for (i = 0; i < n; ++i) {\n if ((v = arcs[index[i] = i] = +value(data[i], i, data)) > 0) {\n sum += v;\n }\n }\n\n // Optionally sort the arcs by previously-computed values or by data.\n if (sortValues != null) index.sort(function(i, j) { return sortValues(arcs[i], arcs[j]); });\n else if (sort != null) index.sort(function(i, j) { return sort(data[i], data[j]); });\n\n // Compute the arcs! They are stored in the original data's order.\n for (i = 0, k = sum ? (da - n * pa) / sum : 0; i < n; ++i, a0 = a1) {\n j = index[i], v = arcs[j], a1 = a0 + (v > 0 ? v * k : 0) + pa, arcs[j] = {\n data: data[j],\n index: i,\n value: v,\n startAngle: a0,\n endAngle: a1,\n padAngle: p\n };\n }\n\n return arcs;\n }\n\n pie.value = function(_) {\n return arguments.length ? (value = typeof _ === \"function\" ? _ : constant(+_), pie) : value;\n };\n\n pie.sortValues = function(_) {\n return arguments.length ? (sortValues = _, sort = null, pie) : sortValues;\n };\n\n pie.sort = function(_) {\n return arguments.length ? (sort = _, sortValues = null, pie) : sort;\n };\n\n pie.startAngle = function(_) {\n return arguments.length ? (startAngle = typeof _ === \"function\" ? _ : constant(+_), pie) : startAngle;\n };\n\n pie.endAngle = function(_) {\n return arguments.length ? (endAngle = typeof _ === \"function\" ? _ : constant(+_), pie) : endAngle;\n };\n\n pie.padAngle = function(_) {\n return arguments.length ? (padAngle = typeof _ === \"function\" ? _ : constant(+_), pie) : padAngle;\n };\n\n return pie;\n}\n","const polarToCartesian = (\r\n centerX: number,\r\n centerY: number,\r\n radius: number,\r\n angleInRadians: number,\r\n) => {\r\n return {\r\n x: centerX + radius * Math.cos(angleInRadians),\r\n y: centerY + radius * Math.sin(angleInRadians),\r\n };\r\n};\r\n\r\nexport function getArc(\r\n x: number,\r\n y: number,\r\n radius: number,\r\n startAngleInRadians: number,\r\n endAngleInRadians: number,\r\n) {\r\n const start = polarToCartesian(x, y, radius, startAngleInRadians);\r\n const end = polarToCartesian(x, y, radius, endAngleInRadians);\r\n const largeArcFlag = endAngleInRadians - startAngleInRadians <= Math.PI ? '0' : '1';\r\n const d = ['M', start.x, start.y, 'A', radius, radius, 0, largeArcFlag, 1, end.x, end.y].join(\r\n ' ',\r\n );\r\n return d;\r\n}\r\n","/* eslint-disable @typescript-eslint/no-explicit-any */\r\nimport isEqual from 'fast-deep-equal';\r\nimport { pie } from 'd3-shape';\r\nimport { useRef, useState } from 'react';\r\nimport { H2, P } from '@undp/design-system-react/Typography';\r\nimport { AnimatePresence, motion, useInView } from 'motion/react';\r\n\r\nimport { AnimateDataType, ClassNameObject, DonutChartDataType, StyleObject } from '@/Types';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { DetailsModal } from '@/Components/Elements/DetailsModal';\r\nimport { getArc } from '@/Utils/getArc';\r\n\r\ninterface Props {\r\n mainText?: string | { label: string; suffix?: string; prefix?: string };\r\n radius: number;\r\n colors: string[];\r\n subNote?: string;\r\n strokeWidth: number;\r\n data: DonutChartDataType[];\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n onSeriesMouseOver?: (_d: any) => void;\r\n onSeriesMouseClick?: (_d: any) => void;\r\n colorDomain: string[];\r\n resetSelectionOnDoubleClick: boolean;\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n precision: number;\r\n animate: AnimateDataType;\r\n trackColor: string;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n mainText,\r\n data,\r\n radius,\r\n colors,\r\n subNote,\r\n strokeWidth,\r\n tooltip,\r\n onSeriesMouseOver,\r\n onSeriesMouseClick,\r\n colorDomain,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n precision,\r\n animate,\r\n trackColor,\r\n } = props;\r\n const svgRef = useRef(null);\r\n const isInView = useInView(svgRef, {\r\n once: animate.once,\r\n amount: animate.amount,\r\n });\r\n const pieData = pie()\r\n .sort(null)\r\n .startAngle(0)\r\n .value((d: any) => d.size);\r\n\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n\r\n const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n return (\r\n <>\r\n <motion.svg\r\n ref={svgRef}\r\n width={`${radius * 2}px`}\r\n height={`${radius * 2}px`}\r\n viewBox={`0 0 ${radius * 2} ${radius * 2}`}\r\n direction='ltr'\r\n className='mx-auto'\r\n >\r\n <motion.g transform={`translate(${radius} ${radius})`}>\r\n {mainText || subNote ? (\r\n <foreignObject\r\n y={0 - (radius - strokeWidth)}\r\n x={0 - (radius - strokeWidth)}\r\n width={2 * (radius - strokeWidth)}\r\n height={2 * (radius - strokeWidth)}\r\n >\r\n <div className='flex flex-col gap-0.5 justify-center items-center h-inherit py-0 px-4'>\r\n {mainText ? (\r\n <H2\r\n marginBottom='none'\r\n className='donut-main-text text-primary-gray-700 dark:text-primary-gray-100 leading-none text-center'\r\n >\r\n {typeof mainText === 'string'\r\n ? mainText\r\n : data.findIndex(d => d.label === mainText.label) !== -1\r\n ? numberFormattingFunction(\r\n data[data.findIndex(d => d.label === mainText.label)].size,\r\n 'NA',\r\n precision,\r\n mainText.prefix,\r\n mainText.suffix,\r\n )\r\n : 'NA'}\r\n </H2>\r\n ) : null}\r\n {subNote ? (\r\n <P\r\n marginBottom='none'\r\n size='base'\r\n leading='none'\r\n className='donut-sub-note text-primary-gray-700 dark:text-primary-gray-100 text-center font-bold'\r\n >\r\n {subNote}\r\n </P>\r\n ) : typeof mainText === 'string' || !mainText ? null : (\r\n <P\r\n size='base'\r\n marginBottom='none'\r\n leading='none'\r\n className='donut-label text-primary-gray-700 dark:text-primary-gray-100 text-center font-bold'\r\n >\r\n {mainText.label}\r\n </P>\r\n )}\r\n </div>\r\n </foreignObject>\r\n ) : null}\r\n <circle\r\n cx={0}\r\n cy={0}\r\n r={radius - strokeWidth / 2}\r\n fill='none'\r\n stroke={trackColor}\r\n strokeWidth={strokeWidth}\r\n />\r\n <AnimatePresence>\r\n {pieData(data as any).map((d, i) => (\r\n <motion.path\r\n key={i}\r\n variants={{\r\n initial: {\r\n pathLength: 0,\r\n d: getArc(\r\n 0,\r\n 0,\r\n radius - strokeWidth / 2,\r\n d.startAngle - Math.PI / 2,\r\n d.endAngle - Math.PI / 2,\r\n ),\r\n opacity: mouseOverData\r\n ? mouseOverData.label === (d.data as any).label\r\n ? 1\r\n : 0.3\r\n : 1,\r\n },\r\n whileInView: {\r\n pathLength: 1,\r\n d: getArc(\r\n 0,\r\n 0,\r\n radius - strokeWidth / 2,\r\n d.startAngle - Math.PI / 2,\r\n d.endAngle - Math.PI / 2,\r\n ),\r\n opacity: mouseOverData\r\n ? mouseOverData.label === (d.data as any).label\r\n ? 1\r\n : 0.3\r\n : 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n style={{\r\n stroke:\r\n colorDomain.indexOf((d.data as any).label) !== -1\r\n ? colors[colorDomain.indexOf((d.data as any).label) % colors.length]\r\n : Colors.gray,\r\n strokeWidth,\r\n fill: 'none',\r\n }}\r\n onMouseEnter={event => {\r\n setMouseOverData(d.data);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.(d);\r\n }}\r\n onClick={() => {\r\n if (onSeriesMouseClick || detailsOnClick) {\r\n if (isEqual(mouseClickData, d.data) && resetSelectionOnDoubleClick) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n setMouseClickData(d.data);\r\n if (onSeriesMouseClick) onSeriesMouseClick(d.data);\r\n }\r\n }\r\n }}\r\n onMouseMove={event => {\r\n setMouseOverData(d.data);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n }}\r\n onMouseLeave={() => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n }}\r\n />\r\n ))}\r\n </AnimatePresence>\r\n </motion.g>\r\n </motion.svg>\r\n {mouseOverData && tooltip && eventX && eventY ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={eventX}\r\n yPos={eventY}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n {detailsOnClick && mouseClickData !== undefined ? (\r\n <DetailsModal\r\n body={detailsOnClick}\r\n data={mouseClickData}\r\n setData={setMouseClickData}\r\n className={classNames?.modal}\r\n />\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import { useEffect, useRef, useState } from 'react';\r\nimport { P } from '@undp/design-system-react/Typography';\r\nimport orderBy from 'lodash.orderby';\r\nimport { Spacer } from '@undp/design-system-react/Spacer';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport {\r\n DonutChartDataType,\r\n Languages,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n AnimateDataType,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { EmptyState } from '@/Components/Elements/EmptyState';\r\nimport { GraphArea, GraphContainer } from '@/Components/Elements/GraphContainer';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: DonutChartDataType[];\r\n\r\n // Titles, Labels, and Sources\r\n /** Title of the graph */\r\n graphTitle?: string | React.ReactNode;\r\n /** Description of the graph */\r\n graphDescription?: string | React.ReactNode;\r\n /** Footnote for the graph */\r\n footNote?: string | React.ReactNode;\r\n /** Source data for the graph */\r\n sources?: SourcesDataType[];\r\n /** Accessibility label */\r\n ariaLabel?: string;\r\n\r\n // Colors and Styling\r\n /** Array of colors for each segment */\r\n colors?: string[];\r\n /** Domain of colors for the graph */\r\n colorDomain?: string[];\r\n /** Background color of the graph */\r\n backgroundColor?: string | boolean;\r\n /** Custom styles for the graph. Each object should be a valid React CSS style object. */\r\n styles?: StyleObject;\r\n /** Custom class names */\r\n classNames?: ClassNameObject;\r\n\r\n // Size and Spacing\r\n /** Width of the graph */\r\n width?: number;\r\n /** Height of the graph */\r\n height?: number;\r\n /** Minimum height of the graph */\r\n minHeight?: number;\r\n /** Relative height scaling factor. This overwrites the height props */\r\n relativeHeight?: number;\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n /** Radius of the donut chart */\r\n radius?: number;\r\n\r\n // Values and Ticks\r\n /** Prefix for values */\r\n prefix?: string;\r\n /** Suffix for values */\r\n suffix?: string;\r\n\r\n // Graph Parameters\r\n /** Toggle visibility of color scale. This is only applicable if the data props hae color parameter */\r\n showColorScale?: boolean;\r\n /** Max width of the color scale as a css property */\r\n colorScaleMaxWidth?: string;\r\n /** Stroke width of the arcs and circle of the donut */\r\n strokeWidth?: number;\r\n /** Sorting order for data. This is overwritten by labelOrder prop */\r\n sortData?: 'asc' | 'desc';\r\n /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\r\n /** Large text at the center of the donut chart. If the type is an object then the text is the value in the data for the label mentioned in the object */\r\n mainText?: string | { label: string; suffix?: string; prefix?: string };\r\n /** Small text at the center of the donut chart */\r\n subNote?: string;\r\n /** Specifies the number of decimal places to display in the value. */\r\n precision?: number;\r\n /** Track color (i.e. the color of the donut chart's background) of the donut chart */\r\n trackColor?: string;\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n /** Reset selection on double-click. Only applicable when used in a dashboard context with filters. */\r\n resetSelectionOnDoubleClick?: boolean;\r\n\r\n // Interactions and Callbacks\r\n /** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n /** Details displayed on the modal when user clicks of a data point. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n /** Callback for mouse over event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n /** Callback for mouse click event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n\r\n // Configuration and Options\r\n /** Language setting */\r\n language?: Languages;\r\n /** Color theme */\r\n theme?: 'light' | 'dark';\r\n /** Unique ID for the graph */\r\n graphID?: string;\r\n}\r\n\r\nexport function DonutChart(props: Props) {\r\n const {\r\n mainText,\r\n graphTitle,\r\n colors = Colors.light.categoricalColors.colors,\r\n suffix = '',\r\n sources,\r\n prefix = '',\r\n strokeWidth = 50,\r\n graphDescription,\r\n subNote,\r\n footNote,\r\n radius,\r\n data,\r\n showColorScale = true,\r\n padding,\r\n backgroundColor = false,\r\n tooltip,\r\n onSeriesMouseOver,\r\n graphID,\r\n onSeriesMouseClick,\r\n graphDownload = false,\r\n dataDownload = false,\r\n colorDomain,\r\n sortData,\r\n language = 'en',\r\n theme = 'light',\r\n width,\r\n height,\r\n minHeight = 0,\r\n relativeHeight,\r\n ariaLabel,\r\n resetSelectionOnDoubleClick = true,\r\n colorScaleMaxWidth,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n precision = 2,\r\n animate = false,\r\n trackColor = Colors.light.grays['gray-200'],\r\n } = props;\r\n\r\n const [graphRadius, setGraphRadius] = useState(0);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setGraphRadius(\r\n (Math.min(\r\n ...[\r\n entries[0].target.clientWidth || 620,\r\n entries[0].target.clientHeight || 480,\r\n radius || Infinity,\r\n ],\r\n ) || 420) / 2,\r\n );\r\n });\r\n if (graphDiv.current) {\r\n resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, [radius]);\r\n\r\n const sortedData = sortData ? orderBy(data, ['size'], [sortData]) : data;\r\n\r\n return (\r\n <GraphContainer\r\n className={classNames?.graphContainer}\r\n style={styles?.graphContainer}\r\n id={graphID}\r\n ref={graphParentDiv}\r\n aria-label={ariaLabel}\r\n backgroundColor={backgroundColor}\r\n theme={theme}\r\n language={language}\r\n minHeight={minHeight}\r\n width={width}\r\n height={height}\r\n relativeHeight={relativeHeight}\r\n padding={padding}\r\n >\r\n {graphTitle || graphDescription || graphDownload || dataDownload ? (\r\n <GraphHeader\r\n styles={{\r\n title: styles?.title,\r\n description: styles?.description,\r\n }}\r\n classNames={{\r\n title: classNames?.title,\r\n description: classNames?.description,\r\n }}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n width={width}\r\n graphDownload={graphDownload ? graphParentDiv : undefined}\r\n dataDownload={\r\n dataDownload\r\n ? data.map(d => d.data).filter(d => d !== undefined).length > 0\r\n ? data.map(d => d.data).filter(d => d !== undefined)\r\n : data.filter(d => d !== undefined)\r\n : null\r\n }\r\n />\r\n ) : null}\r\n {showColorScale && data.length > 0 ? (\r\n <>\r\n <div\r\n className={cn(\r\n 'leading-0 flex mb-0 ml-auto mr-auto justify-center gap-x-3 gap-y-0 flex-wrap',\r\n classNames?.colorLegend,\r\n )}\r\n style={{ maxWidth: colorScaleMaxWidth }}\r\n aria-label='Color legend'\r\n >\r\n {sortedData.map((d, i) => (\r\n <div className='flex gap-2 items-center pb-3' key={i}>\r\n <div\r\n className='w-3 h-3 rounded-full'\r\n style={{\r\n backgroundColor:\r\n (colorDomain || sortedData.map(el => el.label)).indexOf(d.label) !== -1\r\n ? (colors || Colors[theme].categoricalColors.colors)[\r\n (colorDomain || sortedData.map(el => el.label)).indexOf(d.label) %\r\n (colors || Colors[theme].categoricalColors.colors).length\r\n ]\r\n : Colors.gray,\r\n }}\r\n />\r\n <P\r\n marginBottom='none'\r\n size='sm'\r\n className='text-primary-gray-700 dark:text-primary-gray-100'\r\n >\r\n {d.label}:{' '}\r\n <span className='font-bold' style={{ fontSize: 'inherit' }}>\r\n {numberFormattingFunction(d.size, 'NA', precision, prefix, suffix)}\r\n </span>\r\n </P>\r\n </div>\r\n ))}\r\n </div>\r\n <Spacer size='lg' />\r\n </>\r\n ) : null}\r\n <GraphArea ref={graphDiv}>\r\n {data.length === 0 && <EmptyState />}\r\n {graphRadius && data.length > 0 ? (\r\n <Graph\r\n mainText={mainText}\r\n data={sortedData}\r\n colors={colors}\r\n radius={graphRadius}\r\n subNote={subNote}\r\n strokeWidth={strokeWidth}\r\n tooltip={tooltip}\r\n colorDomain={colorDomain || sortedData.map(d => d.label)}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n styles={styles}\r\n detailsOnClick={detailsOnClick}\r\n precision={precision}\r\n animate={\r\n animate === true\r\n ? { duration: 0.5, once: true, amount: 0.5 }\r\n : animate || { duration: 0, once: true, amount: 0 }\r\n }\r\n trackColor={trackColor}\r\n />\r\n ) : null}\r\n </GraphArea>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </GraphContainer>\r\n );\r\n}\r\n"],"names":["pi","tau","descending","a","b","identity","d","pie","value","sortValues","sort","startAngle","constant","endAngle","padAngle","data","i","n","array","j","k","sum","index","arcs","a0","da","a1","p","pa","v","_","polarToCartesian","centerX","centerY","radius","angleInRadians","x","Math","cos","y","sin","getArc","startAngleInRadians","endAngleInRadians","start","end","largeArcFlag","PI","join","Graph","props","$","_c","mainText","colors","subNote","strokeWidth","tooltip","onSeriesMouseOver","onSeriesMouseClick","colorDomain","resetSelectionOnDoubleClick","detailsOnClick","styles","classNames","precision","animate","trackColor","svgRef","useRef","t0","amount","once","isInView","useInView","pieData","_temp","mouseOverData","setMouseOverData","useState","undefined","mouseClickData","setMouseClickData","eventX","setEventX","eventY","setEventY","t1","motion","t2","t3","t4","t5","t6","t7","t8","t9","jsx","jsxs","H2","findIndex","d_1","label","numberFormattingFunction","d_0","size","prefix","suffix","P","t10","t11","T0","AnimatePresence","t12","duration","d_2","initial","pathLength","opacity","whileInView","transition","stroke","indexOf","length","Colors","gray","fill","event","clientY","clientX","isEqual","event_0","t13","map","t14","t15","g","t16","svg","t17","Tooltip","t18","modal","DetailsModal","t19","Fragment","DonutChart","graphTitle","light","categoricalColors","sources","graphDescription","footNote","showColorScale","padding","backgroundColor","graphID","graphDownload","dataDownload","sortData","language","theme","width","height","minHeight","relativeHeight","ariaLabel","colorScaleMaxWidth","grays","graphRadius","setGraphRadius","graphDiv","graphParentDiv","useEffect","resizeObserver","ResizeObserver","entries","min","target","clientWidth","clientHeight","Infinity","current","observe","disconnect","sortedData","orderBy","GraphContainer","graphContainer","GraphHeader","title","description","filter","cn","colorLegend","maxWidth","el","fontSize","Spacer","GraphArea","EmptyState","GraphFooter","footnote","source"],"mappings":"0uBASaA,GAAK,KAAK,GAEVC,GAAM,EAAID,GCXR,SAAAE,GAASC,EAAGC,EAAG,CAC5B,OAAOA,EAAID,EAAI,GAAKC,EAAID,EAAI,EAAIC,GAAKD,EAAI,EAAI,GA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IAAY,GACR,CAAEgD,SAAU,GAAK1C,KAAM,GAAMD,OAAQ,EAAA,EACrCL,GAAW,CAAEgD,SAAU,EAAG1C,KAAM,GAAMD,OAAQ,CAAA,EAEpD,WAAAJ,EAAuB,EAEvB,IAAA,EACN,EACCmF,GAAWE,EACVvD,EAAAA,kBAAAA,IAACwG,GAAAA,YAAA,CACC,OAAQ,CAAEC,SAAU3I,GAAQ2I,SAAUC,OAAQ5I,GAAQ4I,MAAAA,EACtD,WAAY,CACVD,SAAU1I,GAAY0I,SACtBC,OAAQ3I,GAAY2I,MAAAA,EAEtB,QAAArD,EACA,SAAAE,EACA,MAAAU,CAAA,CAAa,EAEb,IAAA,EACN,CAEJ","x_google_ignoreList":[0,1,2,3]}
@@ -14,7 +14,7 @@ import { A as Mt } from "./index-BqfRwk1n.js";
14
14
  import { m as ot } from "./proxy-BxkFHwUw.js";
15
15
  import { GraphFooter as Nt } from "./GraphFooter.js";
16
16
  import { GraphHeader as Ct } from "./GraphHeader.js";
17
- import { E as Dt } from "./EmptyState-BZo1BbAn.js";
17
+ import { E as Dt } from "./EmptyState-C7ZXkZWd.js";
18
18
  import { G as kt, a as At } from "./GraphContainer-CRqzdKu2.js";
19
19
  const wt = Math.PI, at = 2 * wt;
20
20
  function Ot(s, t) {
@@ -24,22 +24,22 @@ function St(s) {
24
24
  return s;
25
25
  }
26
26
  function zt() {
27
- var s = St, t = Ot, n = null, c = T(0), a = T(at), d = T(0);
27
+ var s = St, t = Ot, n = null, c = T(0), a = T(at), p = T(0);
28
28
  function r(e) {
29
- var l, x = (e = bt(e)).length, p, C, f = 0, g = new Array(x), b = new Array(x), y = +c.apply(this, arguments), S = Math.min(at, Math.max(-at, a.apply(this, arguments) - y)), m, P = Math.min(Math.abs(S) / x, d.apply(this, arguments)), G = P * (S < 0 ? -1 : 1), h;
29
+ var l, x = (e = bt(e)).length, f, C, m = 0, g = new Array(x), b = new Array(x), y = +c.apply(this, arguments), S = Math.min(at, Math.max(-at, a.apply(this, arguments) - y)), d, P = Math.min(Math.abs(S) / x, p.apply(this, arguments)), G = P * (S < 0 ? -1 : 1), h;
30
30
  for (l = 0; l < x; ++l)
31
- (h = b[g[l] = l] = +s(e[l], l, e)) > 0 && (f += h);
31
+ (h = b[g[l] = l] = +s(e[l], l, e)) > 0 && (m += h);
32
32
  for (t != null ? g.sort(function(D, z) {
33
33
  return t(b[D], b[z]);
34
34
  }) : n != null && g.sort(function(D, z) {
35
35
  return n(e[D], e[z]);
36
- }), l = 0, C = f ? (S - x * G) / f : 0; l < x; ++l, y = m)
37
- p = g[l], h = b[p], m = y + (h > 0 ? h * C : 0) + G, b[p] = {
38
- data: e[p],
36
+ }), l = 0, C = m ? (S - x * G) / m : 0; l < x; ++l, y = d)
37
+ f = g[l], h = b[f], d = y + (h > 0 ? h * C : 0) + G, b[f] = {
38
+ data: e[f],
39
39
  index: l,
40
40
  value: h,
41
41
  startAngle: y,
42
- endAngle: m,
42
+ endAngle: d,
43
43
  padAngle: P
44
44
  };
45
45
  return b;
@@ -55,7 +55,7 @@ function zt() {
55
55
  }, r.endAngle = function(e) {
56
56
  return arguments.length ? (a = typeof e == "function" ? e : T(+e), r) : a;
57
57
  }, r.padAngle = function(e) {
58
- return arguments.length ? (d = typeof e == "function" ? e : T(+e), r) : d;
58
+ return arguments.length ? (p = typeof e == "function" ? e : T(+e), r) : p;
59
59
  }, r;
60
60
  }
61
61
  const lt = (s, t, n, c) => ({
@@ -63,34 +63,34 @@ const lt = (s, t, n, c) => ({
63
63
  y: t + n * Math.sin(c)
64
64
  });
65
65
  function st(s, t, n, c, a) {
66
- const d = lt(s, t, n, c), r = lt(s, t, n, a), e = a - c <= Math.PI ? "0" : "1";
67
- return ["M", d.x, d.y, "A", n, n, 0, e, 1, r.x, r.y].join(" ");
66
+ const p = lt(s, t, n, c), r = lt(s, t, n, a), e = a - c <= Math.PI ? "0" : "1";
67
+ return ["M", p.x, p.y, "A", n, n, 0, e, 1, r.x, r.y].join(" ");
68
68
  }
69
69
  function It(s) {
70
70
  const t = mt.c(59), {
71
71
  mainText: n,
72
72
  data: c,
73
73
  radius: a,
74
- colors: d,
74
+ colors: p,
75
75
  subNote: r,
76
76
  strokeWidth: e,
77
77
  tooltip: l,
78
78
  onSeriesMouseOver: x,
79
- onSeriesMouseClick: p,
79
+ onSeriesMouseClick: f,
80
80
  colorDomain: C,
81
- resetSelectionOnDoubleClick: f,
81
+ resetSelectionOnDoubleClick: m,
82
82
  detailsOnClick: g,
83
83
  styles: b,
84
84
  classNames: y,
85
85
  precision: S,
86
- animate: m,
86
+ animate: d,
87
87
  trackColor: P
88
88
  } = s, G = rt(null);
89
89
  let h;
90
- t[0] !== m.amount || t[1] !== m.once ? (h = {
91
- once: m.once,
92
- amount: m.amount
93
- }, t[0] = m.amount, t[1] = m.once, t[2] = h) : h = t[2];
90
+ t[0] !== d.amount || t[1] !== d.once ? (h = {
91
+ once: d.once,
92
+ amount: d.amount
93
+ }, t[0] = d.amount, t[1] = d.once, t[2] = h) : h = t[2];
94
94
  const D = jt(G, h), z = zt().sort(null).startAngle(0).value(Pt), [v, X] = tt(void 0), [j, M] = tt(void 0), [$, Y] = tt(void 0), [B, q] = tt(void 0), J = ot, K = `${a * 2}px`, Q = `${a * 2}px`, k = `0 0 ${a * 2} ${a * 2}`, E = "ltr", et = "mx-auto", F = ot, U = `translate(${a} ${a})`;
95
95
  let I;
96
96
  t[3] !== c || t[4] !== n || t[5] !== S || t[6] !== a || t[7] !== e || t[8] !== r ? (I = n || r ? /* @__PURE__ */ o.jsx("foreignObject", { y: 0 - (a - e), x: 0 - (a - e), width: 2 * (a - e), height: 2 * (a - e), children: /* @__PURE__ */ o.jsxs("div", { className: "flex flex-col gap-0.5 justify-center items-center h-inherit py-0 px-4", children: [
@@ -102,7 +102,7 @@ function It(s) {
102
102
  t[10] !== e || t[11] !== Z || t[12] !== P ? (A = /* @__PURE__ */ o.jsx("circle", { cx: 0, cy: 0, r: Z, fill: "none", stroke: P, strokeWidth: e }), t[10] = e, t[11] = Z, t[12] = P, t[13] = A) : A = t[13];
103
103
  const V = Mt;
104
104
  let w;
105
- t[14] !== m.duration || t[15] !== C || t[16] !== d || t[17] !== g || t[18] !== D || t[19] !== j || t[20] !== v || t[21] !== p || t[22] !== x || t[23] !== a || t[24] !== f || t[25] !== M || t[26] !== e ? (w = (u, ut) => /* @__PURE__ */ o.jsx(ot.path, { variants: {
105
+ t[14] !== d.duration || t[15] !== C || t[16] !== p || t[17] !== g || t[18] !== D || t[19] !== j || t[20] !== v || t[21] !== f || t[22] !== x || t[23] !== a || t[24] !== m || t[25] !== M || t[26] !== e ? (w = (u, ut) => /* @__PURE__ */ o.jsx(ot.path, { variants: {
106
106
  initial: {
107
107
  pathLength: 0,
108
108
  d: st(0, 0, a - e / 2, u.startAngle - Math.PI / 2, u.endAngle - Math.PI / 2),
@@ -113,27 +113,27 @@ function It(s) {
113
113
  d: st(0, 0, a - e / 2, u.startAngle - Math.PI / 2, u.endAngle - Math.PI / 2),
114
114
  opacity: v ? v.label === u.data.label ? 1 : 0.3 : 1,
115
115
  transition: {
116
- duration: m.duration
116
+ duration: d.duration
117
117
  }
118
118
  }
119
119
  }, initial: "initial", animate: D ? "whileInView" : "initial", exit: {
120
120
  opacity: 0,
121
121
  transition: {
122
- duration: m.duration
122
+ duration: d.duration
123
123
  }
124
124
  }, style: {
125
- stroke: C.indexOf(u.data.label) !== -1 ? d[C.indexOf(u.data.label) % d.length] : R.gray,
125
+ stroke: C.indexOf(u.data.label) !== -1 ? p[C.indexOf(u.data.label) % p.length] : R.gray,
126
126
  strokeWidth: e,
127
127
  fill: "none"
128
128
  }, onMouseEnter: (_) => {
129
129
  X(u.data), q(_.clientY), Y(_.clientX), x?.(u);
130
130
  }, onClick: () => {
131
- (p || g) && (xt(j, u.data) && f ? (M(void 0), p?.(void 0)) : (M(u.data), p && p(u.data)));
131
+ (f || g) && (xt(j, u.data) && m ? (M(void 0), f?.(void 0)) : (M(u.data), f && f(u.data)));
132
132
  }, onMouseMove: (_) => {
133
133
  X(u.data), q(_.clientY), Y(_.clientX);
134
134
  }, onMouseLeave: () => {
135
135
  X(void 0), Y(void 0), q(void 0), x?.(void 0);
136
- } }, ut), t[14] = m.duration, t[15] = C, t[16] = d, t[17] = g, t[18] = D, t[19] = j, t[20] = v, t[21] = p, t[22] = x, t[23] = a, t[24] = f, t[25] = M, t[26] = e, t[27] = w) : w = t[27];
136
+ } }, ut), t[14] = d.duration, t[15] = C, t[16] = p, t[17] = g, t[18] = D, t[19] = j, t[20] = v, t[21] = f, t[22] = x, t[23] = a, t[24] = m, t[25] = M, t[26] = e, t[27] = w) : w = t[27];
137
137
  const i = z(c).map(w);
138
138
  let N;
139
139
  t[28] !== V || t[29] !== i ? (N = /* @__PURE__ */ o.jsx(V, { children: i }), t[28] = V, t[29] = i, t[30] = N) : N = t[30];
@@ -165,19 +165,19 @@ function Zt(s) {
165
165
  graphTitle: n,
166
166
  colors: c = R.light.categoricalColors.colors,
167
167
  suffix: a = "",
168
- sources: d,
168
+ sources: p,
169
169
  prefix: r = "",
170
170
  strokeWidth: e = 50,
171
171
  graphDescription: l,
172
172
  subNote: x,
173
- footNote: p,
173
+ footNote: f,
174
174
  radius: C,
175
- data: f,
175
+ data: m,
176
176
  showColorScale: g = !0,
177
177
  padding: b,
178
178
  backgroundColor: y = !1,
179
179
  tooltip: S,
180
- onSeriesMouseOver: m,
180
+ onSeriesMouseOver: d,
181
181
  graphID: P,
182
182
  onSeriesMouseClick: G,
183
183
  graphDownload: h = !1,
@@ -206,7 +206,7 @@ function Zt(s) {
206
206
  });
207
207
  return A.current && i.observe(A.current), () => i.disconnect();
208
208
  }, [C]);
209
- const w = v ? gt(f, ["size"], [v]) : f;
209
+ const w = v ? gt(m, ["size"], [v]) : m;
210
210
  return /* @__PURE__ */ o.jsxs(kt, { className: E?.graphContainer, style: k?.graphContainer, id: P, ref: V, "aria-label": q, backgroundColor: y, theme: j, language: X, minHeight: Y, width: M, height: $, relativeHeight: B, padding: b, children: [
211
211
  n || l || h || D ? /* @__PURE__ */ o.jsx(Ct, { styles: {
212
212
  title: k?.title,
@@ -214,9 +214,9 @@ function Zt(s) {
214
214
  }, classNames: {
215
215
  title: E?.title,
216
216
  description: E?.description
217
- }, graphTitle: n, graphDescription: l, width: M, graphDownload: h ? V : void 0, dataDownload: D ? f.map((i) => i.data).filter((i) => i !== void 0).length > 0 ? f.map((i) => i.data).filter((i) => i !== void 0) : f.filter((i) => i !== void 0) : null }) : null,
218
- f.length === 0 ? /* @__PURE__ */ o.jsx(Dt, {}) : /* @__PURE__ */ o.jsxs(o.Fragment, { children: [
219
- g ? /* @__PURE__ */ o.jsx("div", { className: dt("leading-0 flex mb-0 ml-auto mr-auto justify-center gap-x-3 gap-y-0 flex-wrap", E?.colorLegend), style: {
217
+ }, graphTitle: n, graphDescription: l, width: M, graphDownload: h ? V : void 0, dataDownload: D ? m.map((i) => i.data).filter((i) => i !== void 0).length > 0 ? m.map((i) => i.data).filter((i) => i !== void 0) : m.filter((i) => i !== void 0) : null }) : null,
218
+ g && m.length > 0 ? /* @__PURE__ */ o.jsxs(o.Fragment, { children: [
219
+ /* @__PURE__ */ o.jsx("div", { className: dt("leading-0 flex mb-0 ml-auto mr-auto justify-center gap-x-3 gap-y-0 flex-wrap", E?.colorLegend), style: {
220
220
  maxWidth: K
221
221
  }, "aria-label": "Color legend", children: w.map((i, N) => /* @__PURE__ */ o.jsxs("div", { className: "flex gap-2 items-center pb-3", children: [
222
222
  /* @__PURE__ */ o.jsx("div", { className: "w-3 h-3 rounded-full", style: {
@@ -230,9 +230,12 @@ function Zt(s) {
230
230
  fontSize: "inherit"
231
231
  }, children: ct(i.size, "NA", et, r, a) })
232
232
  ] })
233
- ] }, N)) }) : null,
234
- /* @__PURE__ */ o.jsx(ht, { size: "lg" }),
235
- /* @__PURE__ */ o.jsx(At, { ref: A, children: I ? /* @__PURE__ */ o.jsx(It, { mainText: t, data: w, colors: c, radius: I, subNote: x, strokeWidth: e, tooltip: S, colorDomain: z || w.map((i) => i.label), onSeriesMouseOver: m, onSeriesMouseClick: G, resetSelectionOnDoubleClick: J, styles: k, detailsOnClick: Q, precision: et, animate: F === !0 ? {
233
+ ] }, N)) }),
234
+ /* @__PURE__ */ o.jsx(ht, { size: "lg" })
235
+ ] }) : null,
236
+ /* @__PURE__ */ o.jsxs(At, { ref: A, children: [
237
+ m.length === 0 && /* @__PURE__ */ o.jsx(Dt, {}),
238
+ I && m.length > 0 ? /* @__PURE__ */ o.jsx(It, { mainText: t, data: w, colors: c, radius: I, subNote: x, strokeWidth: e, tooltip: S, colorDomain: z || w.map((i) => i.label), onSeriesMouseOver: d, onSeriesMouseClick: G, resetSelectionOnDoubleClick: J, styles: k, detailsOnClick: Q, precision: et, animate: F === !0 ? {
236
239
  duration: 0.5,
237
240
  once: !0,
238
241
  amount: 0.5
@@ -240,15 +243,15 @@ function Zt(s) {
240
243
  duration: 0,
241
244
  once: !0,
242
245
  amount: 0
243
- }, trackColor: U }) : null })
246
+ }, trackColor: U }) : null
244
247
  ] }),
245
- d || p ? /* @__PURE__ */ o.jsx(Nt, { styles: {
248
+ p || f ? /* @__PURE__ */ o.jsx(Nt, { styles: {
246
249
  footnote: k?.footnote,
247
250
  source: k?.source
248
251
  }, classNames: {
249
252
  footnote: E?.footnote,
250
253
  source: E?.source
251
- }, sources: d, footNote: p, width: M }) : null
254
+ }, sources: p, footNote: f, width: M }) : null
252
255
  ] });
253
256
  }
254
257
  export {