@undp/data-viz 2.1.4 → 2.1.6

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 (61) hide show
  1. package/dist/BeeSwarmChart.cjs +1 -1
  2. package/dist/BeeSwarmChart.js +1 -1
  3. package/dist/BiVariateChoroplethMap.cjs +1 -1
  4. package/dist/BiVariateChoroplethMap.js +1 -1
  5. package/dist/ChoroplethMap.cjs +1 -1
  6. package/dist/ChoroplethMap.js +1 -1
  7. package/dist/CirclePackingGraph.cjs +1 -1
  8. package/dist/CirclePackingGraph.js +1 -1
  9. package/dist/DonutChart.cjs +1 -1
  10. package/dist/DonutChart.cjs.map +1 -1
  11. package/dist/DonutChart.js +92 -92
  12. package/dist/DonutChart.js.map +1 -1
  13. package/dist/DotDensityMap.cjs +1 -1
  14. package/dist/DotDensityMap.js +1 -1
  15. package/dist/{GraphEl-C2Fgg8PA.cjs → GraphEl-BixTEyKW.cjs} +2 -2
  16. package/dist/{GraphEl-C2Fgg8PA.cjs.map → GraphEl-BixTEyKW.cjs.map} +1 -1
  17. package/dist/{GraphEl-oZwZiTHI.js → GraphEl-Dyu_EIQb.js} +2 -2
  18. package/dist/{GraphEl-oZwZiTHI.js.map → GraphEl-Dyu_EIQb.js.map} +1 -1
  19. package/dist/GriddedGraphs.cjs +1 -1
  20. package/dist/GriddedGraphs.js +2 -2
  21. package/dist/GriddedGraphsFromConfig.cjs +1 -1
  22. package/dist/GriddedGraphsFromConfig.js +1 -1
  23. package/dist/Histogram.cjs +1 -1
  24. package/dist/Histogram.js +2 -2
  25. package/dist/HybridMap.cjs +1 -1
  26. package/dist/HybridMap.js +1 -1
  27. package/dist/MultiGraphDashboardFromConfig.cjs +1 -1
  28. package/dist/MultiGraphDashboardFromConfig.js +1 -1
  29. package/dist/MultiGraphDashboardWideToLongFormat.cjs +1 -1
  30. package/dist/MultiGraphDashboardWideToLongFormat.js +1 -1
  31. package/dist/MultiGraphDashboardWideToLongFormatFromConfig.cjs +1 -1
  32. package/dist/MultiGraphDashboardWideToLongFormatFromConfig.js +1 -1
  33. package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.cjs +1 -1
  34. package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.js +1 -1
  35. package/dist/SingleGraphDashboard.cjs +1 -1
  36. package/dist/SingleGraphDashboard.js +2 -2
  37. package/dist/SingleGraphDashboardFromConfig.cjs +1 -1
  38. package/dist/SingleGraphDashboardFromConfig.js +1 -1
  39. package/dist/SingleGraphDashboardGeoHubMapsFromConfig.cjs +1 -1
  40. package/dist/SingleGraphDashboardGeoHubMapsFromConfig.js +1 -1
  41. package/dist/SingleGraphDashboardThreeDGraphs.cjs +1 -1
  42. package/dist/SingleGraphDashboardThreeDGraphs.js +1 -1
  43. package/dist/SingleGraphDashboardThreeDGraphsFromConfig.cjs +1 -1
  44. package/dist/SingleGraphDashboardThreeDGraphsFromConfig.js +1 -1
  45. package/dist/Spinner-CQZcjzwd.cjs +2 -0
  46. package/dist/Spinner-CQZcjzwd.cjs.map +1 -0
  47. package/dist/{Spinner-D7rnnwnA.js → Spinner-DVBnY6Vg.js} +5 -5
  48. package/dist/Spinner-DVBnY6Vg.js.map +1 -0
  49. package/dist/ThreeDGlobe.cjs +1 -1
  50. package/dist/ThreeDGlobe.js +1 -1
  51. package/dist/{index-D1RrKgK6.js → index-R1gTfap5.js} +2 -2
  52. package/dist/{index-D1RrKgK6.js.map → index-R1gTfap5.js.map} +1 -1
  53. package/dist/{index-Blvf-Q3U.cjs → index-WML2dCZ0.cjs} +2 -2
  54. package/dist/{index-Blvf-Q3U.cjs.map → index-WML2dCZ0.cjs.map} +1 -1
  55. package/dist/index.cjs +1 -1
  56. package/dist/index.js +1 -1
  57. package/dist/style.css +1 -1
  58. package/package.json +4 -4
  59. package/dist/Spinner-D7rnnwnA.js.map +0 -1
  60. package/dist/Spinner-DRMBUsX7.cjs +0 -2
  61. package/dist/Spinner-DRMBUsX7.cjs.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 {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,GAC/C,CCFe,SAAAE,GAASC,EAAG,CACzB,OAAOA,CACT,CCIe,SAAAC,IAAW,CACxB,IAAIC,EAAQH,GACRI,EAAaP,GACbQ,EAAO,KACPC,EAAaC,EAAAA,SAAS,CAAC,EACvBC,EAAWD,EAAAA,SAASX,EAAG,EACvBa,EAAWF,EAAAA,SAAS,CAAC,EAEzB,SAASL,EAAIQ,EAAM,CACjB,IAAIC,EAC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,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(\r\n x,\r\n y,\r\n radius,\r\n endAngleInRadians === 2 * Math.PI ? 1.9999999999 * Math.PI : endAngleInRadians,\r\n );\r\n const largeArcFlag = endAngleInRadians - startAngleInRadians <= Math.PI ? '0' : '1';\r\n const d = ['M', start.x, start.y, 'A', radius, radius, 0, largeArcFlag, 1, end.x, end.y].join(\r\n ' ',\r\n );\r\n return d;\r\n}\r\n","/* eslint-disable @typescript-eslint/no-explicit-any */\r\nimport isEqual from 'fast-deep-equal';\r\nimport { pie } from 'd3-shape';\r\nimport { 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 ...[entries[0].target.clientWidth || 620, entries[0].target.clientHeight || 480],\r\n ) || 420) / 2,\r\n );\r\n });\r\n if (graphDiv.current) {\r\n resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, []);\r\n\r\n const sortedData = sortData ? orderBy(data, ['size'], [sortData]) : data;\r\n\r\n return (\r\n <GraphContainer\r\n className={classNames?.graphContainer}\r\n style={styles?.graphContainer}\r\n id={graphID}\r\n ref={graphParentDiv}\r\n aria-label={ariaLabel}\r\n backgroundColor={backgroundColor}\r\n theme={theme}\r\n language={language}\r\n minHeight={minHeight}\r\n width={width}\r\n height={height}\r\n relativeHeight={relativeHeight}\r\n padding={padding}\r\n >\r\n {graphTitle || graphDescription || graphDownload || dataDownload ? (\r\n <GraphHeader\r\n styles={{\r\n title: styles?.title,\r\n description: styles?.description,\r\n }}\r\n classNames={{\r\n title: classNames?.title,\r\n description: classNames?.description,\r\n }}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n width={width}\r\n graphDownload={graphDownload ? graphParentDiv : undefined}\r\n dataDownload={\r\n dataDownload\r\n ? data.map(d => d.data).filter(d => d !== undefined).length > 0\r\n ? data.map(d => d.data).filter(d => d !== undefined)\r\n : data.filter(d => d !== undefined)\r\n : null\r\n }\r\n />\r\n ) : null}\r\n {showColorScale && data.length > 0 ? (\r\n <>\r\n <div\r\n className={cn(\r\n 'leading-0 flex mb-0 ml-auto mr-auto justify-center gap-x-3 gap-y-0 flex-wrap',\r\n classNames?.colorLegend,\r\n )}\r\n style={{ maxWidth: colorScaleMaxWidth }}\r\n aria-label='Color legend'\r\n >\r\n {sortedData.map((d, i) => (\r\n <div className='flex gap-2 items-center pb-3' key={i}>\r\n <div\r\n className='w-3 h-3 rounded-full'\r\n style={{\r\n backgroundColor:\r\n (colorDomain || sortedData.map(el => el.label)).indexOf(d.label) !== -1\r\n ? (colors || Colors[theme].categoricalColors.colors)[\r\n (colorDomain || sortedData.map(el => el.label)).indexOf(d.label) %\r\n (colors || Colors[theme].categoricalColors.colors).length\r\n ]\r\n : Colors.gray,\r\n }}\r\n />\r\n <P\r\n marginBottom='none'\r\n size='sm'\r\n className='text-primary-gray-700 dark:text-primary-gray-100'\r\n >\r\n {d.label}:{' '}\r\n <span className='font-bold' style={{ fontSize: 'inherit' }}>\r\n {numberFormattingFunction(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={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","PI","largeArcFlag","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","current","observe","disconnect","sortedData","orderBy","GraphContainer","graphContainer","GraphHeader","title","description","filter","cn","colorLegend","maxWidth","el","fontSize","Spacer","GraphArea","EmptyState","GraphFooter","footnote","source"],"mappings":"0uBASaA,GAAK,KAAK,GAEVC,GAAM,EAAID,GCXR,SAAAE,GAASC,EAAGC,EAAG,CAC5B,OAAOA,EAAID,EAAI,GAAKC,EAAID,EAAI,EAAIC,GAAKD,EAAI,EAAI,GAC/C,CCFe,SAAAE,GAASC,EAAG,CACzB,OAA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M,GAAMD,OAAQ,EAAA,EACrCL,GAAW,CAAEgD,SAAU,EAAG1C,KAAM,GAAMD,OAAQ,CAAA,EAEpD,WAAAJ,EAAuB,EAEvB,IAAA,EACN,EACCmF,GAAWE,EACVvD,EAAAA,kBAAAA,IAACuG,GAAAA,YAAA,CACC,OAAQ,CAAEC,SAAU1I,GAAQ0I,SAAUC,OAAQ3I,GAAQ2I,MAAAA,EACtD,WAAY,CACVD,SAAUzI,GAAYyI,SACtBC,OAAQ1I,GAAY0I,MAAAA,EAEtB,QAAApD,EACA,SAAAE,EACA,MAAAU,CAAA,CAAa,EAEb,IAAA,EACN,CAEJ","x_google_ignoreList":[0,1,2,3]}
@@ -1,17 +1,17 @@
1
- import { c as mt, j as o, m as dt } from "./index-CHPV5EwG-Curnpaqc.js";
1
+ import { c as mt, j as n, m as dt } from "./index-CHPV5EwG-Curnpaqc.js";
2
2
  import { useRef as rt, useState as tt, useEffect as pt } from "react";
3
3
  import { v as ft, j as it } from "./Typography-PxtFcnJb.js";
4
4
  import { o as gt } from "./index-BZQYSqar.js";
5
5
  import { n as ht } from "./Source-DwTHB8fn.js";
6
6
  import { i as xt } from "./index-Bwrro8-q.js";
7
7
  import { T as yt } from "./Tooltip-Dj5eVppQ.js";
8
- import { Colors as R } from "./Colors.js";
8
+ import { Colors as X } from "./Colors.js";
9
9
  import { n as ct } from "./numberFormattingFunction-14YCbkN2.js";
10
10
  import { D as vt } from "./DetailsModal-0Ry5nXiC.js";
11
11
  import { c as T, a as bt } from "./array-USo-Szhp.js";
12
12
  import { u as jt } from "./use-in-view-Cxa7y1TH.js";
13
13
  import { A as Mt } from "./index-BqfRwk1n.js";
14
- import { m as ot } from "./proxy-BxkFHwUw.js";
14
+ import { m as nt } from "./proxy-BxkFHwUw.js";
15
15
  import { GraphFooter as Nt } from "./GraphFooter.js";
16
16
  import { GraphHeader as Ct } from "./GraphHeader.js";
17
17
  import { E as Dt } from "./EmptyState-C7ZXkZWd.js";
@@ -20,36 +20,36 @@ const wt = Math.PI, at = 2 * wt;
20
20
  function Ot(s, t) {
21
21
  return t < s ? -1 : t > s ? 1 : t >= s ? 0 : NaN;
22
22
  }
23
- function St(s) {
23
+ function Pt(s) {
24
24
  return s;
25
25
  }
26
- function zt() {
27
- var s = St, t = Ot, n = null, c = T(0), a = T(at), p = T(0);
26
+ function St() {
27
+ var s = Pt, t = Ot, o = null, c = T(0), a = T(at), p = T(0);
28
28
  function r(e) {
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;
29
+ var l, x = (e = bt(e)).length, f, O, m = 0, g = new Array(x), b = new Array(x), y = +c.apply(this, arguments), P = Math.min(at, Math.max(-at, a.apply(this, arguments) - y)), d, I = Math.min(Math.abs(P) / x, p.apply(this, arguments)), G = I * (P < 0 ? -1 : 1), h;
30
30
  for (l = 0; l < x; ++l)
31
31
  (h = b[g[l] = l] = +s(e[l], l, e)) > 0 && (m += h);
32
- for (t != null ? g.sort(function(D, z) {
33
- return t(b[D], b[z]);
34
- }) : n != null && g.sort(function(D, z) {
35
- return n(e[D], e[z]);
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] = {
32
+ for (t != null ? g.sort(function(C, S) {
33
+ return t(b[C], b[S]);
34
+ }) : o != null && g.sort(function(C, S) {
35
+ return o(e[C], e[S]);
36
+ }), l = 0, O = m ? (P - x * G) / m : 0; l < x; ++l, y = d)
37
+ f = g[l], h = b[f], d = y + (h > 0 ? h * O : 0) + G, b[f] = {
38
38
  data: e[f],
39
39
  index: l,
40
40
  value: h,
41
41
  startAngle: y,
42
42
  endAngle: d,
43
- padAngle: P
43
+ padAngle: I
44
44
  };
45
45
  return b;
46
46
  }
47
47
  return r.value = function(e) {
48
48
  return arguments.length ? (s = typeof e == "function" ? e : T(+e), r) : s;
49
49
  }, r.sortValues = function(e) {
50
- return arguments.length ? (t = e, n = null, r) : t;
50
+ return arguments.length ? (t = e, o = null, r) : t;
51
51
  }, r.sort = function(e) {
52
- return arguments.length ? (n = e, t = null, r) : n;
52
+ return arguments.length ? (o = e, t = null, r) : o;
53
53
  }, r.startAngle = function(e) {
54
54
  return arguments.length ? (c = typeof e == "function" ? e : T(+e), r) : c;
55
55
  }, r.endAngle = function(e) {
@@ -58,17 +58,17 @@ function zt() {
58
58
  return arguments.length ? (p = typeof e == "function" ? e : T(+e), r) : p;
59
59
  }, r;
60
60
  }
61
- const lt = (s, t, n, c) => ({
62
- x: s + n * Math.cos(c),
63
- y: t + n * Math.sin(c)
61
+ const lt = (s, t, o, c) => ({
62
+ x: s + o * Math.cos(c),
63
+ y: t + o * Math.sin(c)
64
64
  });
65
- function st(s, t, n, c, a) {
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(" ");
65
+ function st(s, t, o, c, a) {
66
+ const p = lt(s, t, o, c), r = lt(s, t, o, a === 2 * Math.PI ? 1.9999999999 * Math.PI : a), e = a - c <= Math.PI ? "0" : "1";
67
+ return ["M", p.x, p.y, "A", o, o, 0, e, 1, r.x, r.y].join(" ");
68
68
  }
69
- function It(s) {
69
+ function zt(s) {
70
70
  const t = mt.c(59), {
71
- mainText: n,
71
+ mainText: o,
72
72
  data: c,
73
73
  radius: a,
74
74
  colors: p,
@@ -77,32 +77,32 @@ function It(s) {
77
77
  tooltip: l,
78
78
  onSeriesMouseOver: x,
79
79
  onSeriesMouseClick: f,
80
- colorDomain: C,
80
+ colorDomain: O,
81
81
  resetSelectionOnDoubleClick: m,
82
82
  detailsOnClick: g,
83
83
  styles: b,
84
84
  classNames: y,
85
- precision: S,
85
+ precision: P,
86
86
  animate: d,
87
- trackColor: P
87
+ trackColor: I
88
88
  } = s, G = rt(null);
89
89
  let h;
90
90
  t[0] !== d.amount || t[1] !== d.once ? (h = {
91
91
  once: d.once,
92
92
  amount: d.amount
93
93
  }, t[0] = d.amount, t[1] = d.once, t[2] = h) : h = t[2];
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
- let I;
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: [
97
- n ? /* @__PURE__ */ o.jsx(ft, { marginBottom: "none", className: "donut-main-text text-primary-gray-700 dark:text-primary-gray-100 leading-none text-center", children: typeof n == "string" ? n : c.findIndex((u) => u.label === n.label) !== -1 ? ct(c[c.findIndex((u) => u.label === n.label)].size, "NA", S, n.prefix, n.suffix) : "NA" }) : null,
98
- r ? /* @__PURE__ */ o.jsx(it, { marginBottom: "none", size: "base", leading: "none", className: "donut-sub-note text-primary-gray-700 dark:text-primary-gray-100 text-center font-bold", children: r }) : typeof n == "string" || !n ? null : /* @__PURE__ */ o.jsx(it, { size: "base", marginBottom: "none", leading: "none", className: "donut-label text-primary-gray-700 dark:text-primary-gray-100 text-center font-bold", children: n.label })
99
- ] }) }) : null, t[3] = c, t[4] = n, t[5] = S, t[6] = a, t[7] = e, t[8] = r, t[9] = I) : I = t[9];
94
+ const C = jt(G, h), S = St().sort(null).startAngle(0).value(It), [v, Y] = tt(void 0), [j, M] = tt(void 0), [$, R] = tt(void 0), [B, q] = tt(void 0), J = nt, K = `${a * 2}px`, Q = `${a * 2}px`, D = `0 0 ${a * 2} ${a * 2}`, E = "ltr", et = "mx-auto", F = nt, U = `translate(${a} ${a})`;
95
+ let z;
96
+ t[3] !== c || t[4] !== o || t[5] !== P || t[6] !== a || t[7] !== e || t[8] !== r ? (z = o || r ? /* @__PURE__ */ n.jsx("foreignObject", { y: 0 - (a - e), x: 0 - (a - e), width: 2 * (a - e), height: 2 * (a - e), children: /* @__PURE__ */ n.jsxs("div", { className: "flex flex-col gap-0.5 justify-center items-center h-inherit py-0 px-4", children: [
97
+ o ? /* @__PURE__ */ n.jsx(ft, { marginBottom: "none", className: "donut-main-text text-primary-gray-700 dark:text-primary-gray-100 leading-none text-center", children: typeof o == "string" ? o : c.findIndex((u) => u.label === o.label) !== -1 ? ct(c[c.findIndex((u) => u.label === o.label)].size, "NA", P, o.prefix, o.suffix) : "NA" }) : null,
98
+ r ? /* @__PURE__ */ n.jsx(it, { marginBottom: "none", size: "base", leading: "none", className: "donut-sub-note text-primary-gray-700 dark:text-primary-gray-100 text-center font-bold", children: r }) : typeof o == "string" || !o ? null : /* @__PURE__ */ n.jsx(it, { size: "base", marginBottom: "none", leading: "none", className: "donut-label text-primary-gray-700 dark:text-primary-gray-100 text-center font-bold", children: o.label })
99
+ ] }) }) : null, t[3] = c, t[4] = o, t[5] = P, t[6] = a, t[7] = e, t[8] = r, t[9] = z) : z = t[9];
100
100
  const Z = a - e / 2;
101
- let A;
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];
101
+ let k;
102
+ t[10] !== e || t[11] !== Z || t[12] !== I ? (k = /* @__PURE__ */ n.jsx("circle", { cx: 0, cy: 0, r: Z, fill: "none", stroke: I, strokeWidth: e }), t[10] = e, t[11] = Z, t[12] = I, t[13] = k) : k = t[13];
103
103
  const V = Mt;
104
- let w;
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: {
104
+ let A;
105
+ t[14] !== d.duration || t[15] !== O || t[16] !== p || t[17] !== g || t[18] !== C || t[19] !== j || t[20] !== v || t[21] !== f || t[22] !== x || t[23] !== a || t[24] !== m || t[25] !== M || t[26] !== e ? (A = (u, ut) => /* @__PURE__ */ n.jsx(nt.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),
@@ -116,54 +116,54 @@ function It(s) {
116
116
  duration: d.duration
117
117
  }
118
118
  }
119
- }, initial: "initial", animate: D ? "whileInView" : "initial", exit: {
119
+ }, initial: "initial", animate: C ? "whileInView" : "initial", exit: {
120
120
  opacity: 0,
121
121
  transition: {
122
122
  duration: d.duration
123
123
  }
124
124
  }, style: {
125
- stroke: C.indexOf(u.data.label) !== -1 ? p[C.indexOf(u.data.label) % p.length] : R.gray,
125
+ stroke: O.indexOf(u.data.label) !== -1 ? p[O.indexOf(u.data.label) % p.length] : X.gray,
126
126
  strokeWidth: e,
127
127
  fill: "none"
128
128
  }, onMouseEnter: (_) => {
129
- X(u.data), q(_.clientY), Y(_.clientX), x?.(u);
129
+ Y(u.data), q(_.clientY), R(_.clientX), x?.(u);
130
130
  }, onClick: () => {
131
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
- X(u.data), q(_.clientY), Y(_.clientX);
133
+ Y(u.data), q(_.clientY), R(_.clientX);
134
134
  }, onMouseLeave: () => {
135
- X(void 0), Y(void 0), q(void 0), x?.(void 0);
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
- const i = z(c).map(w);
135
+ Y(void 0), R(void 0), q(void 0), x?.(void 0);
136
+ } }, ut), t[14] = d.duration, t[15] = O, t[16] = p, t[17] = g, t[18] = C, 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] = A) : A = t[27];
137
+ const i = S(c).map(A);
138
138
  let N;
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];
140
- let O;
141
- t[31] !== A || t[32] !== N || t[33] !== F.g || t[34] !== U || t[35] !== I ? (O = /* @__PURE__ */ o.jsxs(F.g, { transform: U, children: [
142
- I,
143
- A,
139
+ t[28] !== V || t[29] !== i ? (N = /* @__PURE__ */ n.jsx(V, { children: i }), t[28] = V, t[29] = i, t[30] = N) : N = t[30];
140
+ let w;
141
+ t[31] !== k || t[32] !== N || t[33] !== F.g || t[34] !== U || t[35] !== z ? (w = /* @__PURE__ */ n.jsxs(F.g, { transform: U, children: [
142
+ z,
143
+ k,
144
144
  N
145
- ] }), t[31] = A, t[32] = N, t[33] = F.g, t[34] = U, t[35] = I, t[36] = O) : O = t[36];
145
+ ] }), t[31] = k, t[32] = N, t[33] = F.g, t[34] = U, t[35] = z, t[36] = w) : w = t[36];
146
146
  let L;
147
- t[37] !== J.svg || t[38] !== O || t[39] !== K || t[40] !== Q || t[41] !== k ? (L = /* @__PURE__ */ o.jsx(J.svg, { ref: G, width: K, height: Q, viewBox: k, direction: E, className: et, children: O }), t[37] = J.svg, t[38] = O, t[39] = K, t[40] = Q, t[41] = k, t[42] = L) : L = t[42];
147
+ t[37] !== J.svg || t[38] !== w || t[39] !== K || t[40] !== Q || t[41] !== D ? (L = /* @__PURE__ */ n.jsx(J.svg, { ref: G, width: K, height: Q, viewBox: D, direction: E, className: et, children: w }), t[37] = J.svg, t[38] = w, t[39] = K, t[40] = Q, t[41] = D, t[42] = L) : L = t[42];
148
148
  let W;
149
- t[43] !== y?.tooltip || t[44] !== $ || t[45] !== B || t[46] !== v || t[47] !== b?.tooltip || t[48] !== l ? (W = v && l && $ && B ? /* @__PURE__ */ o.jsx(yt, { data: v, body: l, xPos: $, yPos: B, backgroundStyle: b?.tooltip, className: y?.tooltip }) : null, t[43] = y?.tooltip, t[44] = $, t[45] = B, t[46] = v, t[47] = b?.tooltip, t[48] = l, t[49] = W) : W = t[49];
149
+ t[43] !== y?.tooltip || t[44] !== $ || t[45] !== B || t[46] !== v || t[47] !== b?.tooltip || t[48] !== l ? (W = v && l && $ && B ? /* @__PURE__ */ n.jsx(yt, { data: v, body: l, xPos: $, yPos: B, backgroundStyle: b?.tooltip, className: y?.tooltip }) : null, t[43] = y?.tooltip, t[44] = $, t[45] = B, t[46] = v, t[47] = b?.tooltip, t[48] = l, t[49] = W) : W = t[49];
150
150
  let H;
151
- t[50] !== y?.modal || t[51] !== g || t[52] !== j || t[53] !== M ? (H = g && j !== void 0 ? /* @__PURE__ */ o.jsx(vt, { body: g, data: j, setData: M, className: y?.modal }) : null, t[50] = y?.modal, t[51] = g, t[52] = j, t[53] = M, t[54] = H) : H = t[54];
152
- let nt;
153
- return t[55] !== L || t[56] !== W || t[57] !== H ? (nt = /* @__PURE__ */ o.jsxs(o.Fragment, { children: [
151
+ t[50] !== y?.modal || t[51] !== g || t[52] !== j || t[53] !== M ? (H = g && j !== void 0 ? /* @__PURE__ */ n.jsx(vt, { body: g, data: j, setData: M, className: y?.modal }) : null, t[50] = y?.modal, t[51] = g, t[52] = j, t[53] = M, t[54] = H) : H = t[54];
152
+ let ot;
153
+ return t[55] !== L || t[56] !== W || t[57] !== H ? (ot = /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
154
154
  L,
155
155
  W,
156
156
  H
157
- ] }), t[55] = L, t[56] = W, t[57] = H, t[58] = nt) : nt = t[58], nt;
157
+ ] }), t[55] = L, t[56] = W, t[57] = H, t[58] = ot) : ot = t[58], ot;
158
158
  }
159
- function Pt(s) {
159
+ function It(s) {
160
160
  return s.size;
161
161
  }
162
162
  function Zt(s) {
163
163
  const {
164
164
  mainText: t,
165
- graphTitle: n,
166
- colors: c = R.light.categoricalColors.colors,
165
+ graphTitle: o,
166
+ colors: c = X.light.categoricalColors.colors,
167
167
  suffix: a = "",
168
168
  sources: p,
169
169
  prefix: r = "",
@@ -171,71 +171,71 @@ function Zt(s) {
171
171
  graphDescription: l,
172
172
  subNote: x,
173
173
  footNote: f,
174
- radius: C,
174
+ radius: O,
175
175
  data: m,
176
176
  showColorScale: g = !0,
177
177
  padding: b,
178
178
  backgroundColor: y = !1,
179
- tooltip: S,
179
+ tooltip: P,
180
180
  onSeriesMouseOver: d,
181
- graphID: P,
181
+ graphID: I,
182
182
  onSeriesMouseClick: G,
183
183
  graphDownload: h = !1,
184
- dataDownload: D = !1,
185
- colorDomain: z,
184
+ dataDownload: C = !1,
185
+ colorDomain: S,
186
186
  sortData: v,
187
- language: X = "en",
187
+ language: Y = "en",
188
188
  theme: j = "light",
189
189
  width: M,
190
190
  height: $,
191
- minHeight: Y = 0,
191
+ minHeight: R = 0,
192
192
  relativeHeight: B,
193
193
  ariaLabel: q,
194
194
  resetSelectionOnDoubleClick: J = !0,
195
195
  colorScaleMaxWidth: K,
196
196
  detailsOnClick: Q,
197
- styles: k,
197
+ styles: D,
198
198
  classNames: E,
199
199
  precision: et = 2,
200
200
  animate: F = !1,
201
- trackColor: U = R.light.grays["gray-200"]
202
- } = s, [I, Z] = tt(0), A = rt(null), V = rt(null);
201
+ trackColor: U = X.light.grays["gray-200"]
202
+ } = s, [z, Z] = tt(0), k = rt(null), V = rt(null);
203
203
  pt(() => {
204
204
  const i = new ResizeObserver((N) => {
205
- Z((Math.min(N[0].target.clientWidth || 620, N[0].target.clientHeight || 480, C || 1 / 0) || 420) / 2);
205
+ Z((Math.min(N[0].target.clientWidth || 620, N[0].target.clientHeight || 480) || 420) / 2);
206
206
  });
207
- return A.current && i.observe(A.current), () => i.disconnect();
208
- }, [C]);
209
- const w = v ? gt(m, ["size"], [v]) : m;
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
- n || l || h || D ? /* @__PURE__ */ o.jsx(Ct, { styles: {
212
- title: k?.title,
213
- description: k?.description
207
+ return k.current && i.observe(k.current), () => i.disconnect();
208
+ }, []);
209
+ const A = v ? gt(m, ["size"], [v]) : m;
210
+ return /* @__PURE__ */ n.jsxs(kt, { className: E?.graphContainer, style: D?.graphContainer, id: I, ref: V, "aria-label": q, backgroundColor: y, theme: j, language: Y, minHeight: R, width: M, height: $, relativeHeight: B, padding: b, children: [
211
+ o || l || h || C ? /* @__PURE__ */ n.jsx(Ct, { styles: {
212
+ title: D?.title,
213
+ description: D?.description
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 ? 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: {
217
+ }, graphTitle: o, graphDescription: l, width: M, graphDownload: h ? V : void 0, dataDownload: C ? 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__ */ n.jsxs(n.Fragment, { children: [
219
+ /* @__PURE__ */ n.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
- }, "aria-label": "Color legend", children: w.map((i, N) => /* @__PURE__ */ o.jsxs("div", { className: "flex gap-2 items-center pb-3", children: [
222
- /* @__PURE__ */ o.jsx("div", { className: "w-3 h-3 rounded-full", style: {
223
- backgroundColor: (z || w.map((O) => O.label)).indexOf(i.label) !== -1 ? (c || R[j].categoricalColors.colors)[(z || w.map((O) => O.label)).indexOf(i.label) % (c || R[j].categoricalColors.colors).length] : R.gray
221
+ }, "aria-label": "Color legend", children: A.map((i, N) => /* @__PURE__ */ n.jsxs("div", { className: "flex gap-2 items-center pb-3", children: [
222
+ /* @__PURE__ */ n.jsx("div", { className: "w-3 h-3 rounded-full", style: {
223
+ backgroundColor: (S || A.map((w) => w.label)).indexOf(i.label) !== -1 ? (c || X[j].categoricalColors.colors)[(S || A.map((w) => w.label)).indexOf(i.label) % (c || X[j].categoricalColors.colors).length] : X.gray
224
224
  } }),
225
- /* @__PURE__ */ o.jsxs(it, { marginBottom: "none", size: "sm", className: "text-primary-gray-700 dark:text-primary-gray-100", children: [
225
+ /* @__PURE__ */ n.jsxs(it, { marginBottom: "none", size: "sm", className: "text-primary-gray-700 dark:text-primary-gray-100", children: [
226
226
  i.label,
227
227
  ":",
228
228
  " ",
229
- /* @__PURE__ */ o.jsx("span", { className: "font-bold", style: {
229
+ /* @__PURE__ */ n.jsx("span", { className: "font-bold", style: {
230
230
  fontSize: "inherit"
231
231
  }, children: ct(i.size, "NA", et, r, a) })
232
232
  ] })
233
233
  ] }, N)) }),
234
- /* @__PURE__ */ o.jsx(ht, { size: "lg" })
234
+ /* @__PURE__ */ n.jsx(ht, { size: "lg" })
235
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
+ /* @__PURE__ */ n.jsxs(At, { ref: k, children: [
237
+ m.length === 0 && /* @__PURE__ */ n.jsx(Dt, {}),
238
+ z && m.length > 0 ? /* @__PURE__ */ n.jsx(zt, { mainText: t, data: A, colors: c, radius: O || z, subNote: x, strokeWidth: e, tooltip: P, colorDomain: S || A.map((i) => i.label), onSeriesMouseOver: d, onSeriesMouseClick: G, resetSelectionOnDoubleClick: J, styles: D, detailsOnClick: Q, precision: et, animate: F === !0 ? {
239
239
  duration: 0.5,
240
240
  once: !0,
241
241
  amount: 0.5
@@ -245,9 +245,9 @@ function Zt(s) {
245
245
  amount: 0
246
246
  }, trackColor: U }) : null
247
247
  ] }),
248
- p || f ? /* @__PURE__ */ o.jsx(Nt, { styles: {
249
- footnote: k?.footnote,
250
- source: k?.source
248
+ p || f ? /* @__PURE__ */ n.jsx(Nt, { styles: {
249
+ footnote: D?.footnote,
250
+ source: D?.source
251
251
  }, classNames: {
252
252
  footnote: E?.footnote,
253
253
  source: E?.source