@undp/data-viz 1.4.12 → 1.4.14

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 (180) hide show
  1. package/dist/AreaChart.cjs +1 -1
  2. package/dist/AreaChart.cjs.map +1 -1
  3. package/dist/AreaChart.js +25 -24
  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.js +638 -632
  8. package/dist/BarGraph.js.map +1 -1
  9. package/dist/BeeSwarmChart.cjs +1 -1
  10. package/dist/BeeSwarmChart.cjs.map +1 -1
  11. package/dist/BeeSwarmChart.js +134 -132
  12. package/dist/BeeSwarmChart.js.map +1 -1
  13. package/dist/BiVariateChoroplethMap.cjs +1 -1
  14. package/dist/BiVariateChoroplethMap.cjs.map +1 -1
  15. package/dist/BiVariateChoroplethMap.js +35 -34
  16. package/dist/BiVariateChoroplethMap.js.map +1 -1
  17. package/dist/BulletChart.cjs +1 -1
  18. package/dist/BulletChart.cjs.map +1 -1
  19. package/dist/BulletChart.js +226 -224
  20. package/dist/BulletChart.js.map +1 -1
  21. package/dist/ButterflyChart.cjs +1 -1
  22. package/dist/ButterflyChart.cjs.map +1 -1
  23. package/dist/ButterflyChart.js +48 -47
  24. package/dist/ButterflyChart.js.map +1 -1
  25. package/dist/ChoroplethMap.cjs +1 -1
  26. package/dist/ChoroplethMap.cjs.map +1 -1
  27. package/dist/ChoroplethMap.js +56 -55
  28. package/dist/ChoroplethMap.js.map +1 -1
  29. package/dist/CirclePackingGraph.cjs +1 -1
  30. package/dist/CirclePackingGraph.js +1 -1
  31. package/dist/DataCards.cjs +3 -3
  32. package/dist/DataCards.cjs.map +1 -1
  33. package/dist/DataCards.js +2 -1
  34. package/dist/DataCards.js.map +1 -1
  35. package/dist/DataTable.cjs +1 -1
  36. package/dist/DataTable.cjs.map +1 -1
  37. package/dist/DataTable.js +9 -8
  38. package/dist/DataTable.js.map +1 -1
  39. package/dist/DifferenceLineChart.cjs +1 -1
  40. package/dist/DifferenceLineChart.cjs.map +1 -1
  41. package/dist/DifferenceLineChart.js +1 -0
  42. package/dist/DifferenceLineChart.js.map +1 -1
  43. package/dist/DonutChart.cjs +1 -1
  44. package/dist/DonutChart.cjs.map +1 -1
  45. package/dist/DonutChart.js +77 -76
  46. package/dist/DonutChart.js.map +1 -1
  47. package/dist/DotDensityMap.cjs +1 -1
  48. package/dist/DotDensityMap.cjs.map +1 -1
  49. package/dist/DotDensityMap.js +1 -0
  50. package/dist/DotDensityMap.js.map +1 -1
  51. package/dist/{DropdownSelect-CeHog_ih.js → DropdownSelect-CtOKZHD0.js} +22 -20
  52. package/dist/{DropdownSelect-CeHog_ih.js.map → DropdownSelect-CtOKZHD0.js.map} +1 -1
  53. package/dist/{DropdownSelect-BmE5JaeE.cjs → DropdownSelect-DBDM64B5.cjs} +2 -2
  54. package/dist/{DropdownSelect-BmE5JaeE.cjs.map → DropdownSelect-DBDM64B5.cjs.map} +1 -1
  55. package/dist/DualAxisLineChart.cjs +1 -1
  56. package/dist/DualAxisLineChart.cjs.map +1 -1
  57. package/dist/DualAxisLineChart.d.ts +3 -1
  58. package/dist/DualAxisLineChart.js +265 -261
  59. package/dist/DualAxisLineChart.js.map +1 -1
  60. package/dist/DumbbellChart.cjs +1 -1
  61. package/dist/DumbbellChart.cjs.map +1 -1
  62. package/dist/DumbbellChart.js +216 -214
  63. package/dist/DumbbellChart.js.map +1 -1
  64. package/dist/GeoHubCompareMaps.cjs +1 -1
  65. package/dist/GeoHubCompareMaps.cjs.map +1 -1
  66. package/dist/GeoHubCompareMaps.js +1 -0
  67. package/dist/GeoHubCompareMaps.js.map +1 -1
  68. package/dist/GeoHubMap.cjs +1 -1
  69. package/dist/GeoHubMap.cjs.map +1 -1
  70. package/dist/GeoHubMap.js +29 -28
  71. package/dist/GeoHubMap.js.map +1 -1
  72. package/dist/GeoHubMapWithLayerSelection.cjs +1 -1
  73. package/dist/GeoHubMapWithLayerSelection.cjs.map +1 -1
  74. package/dist/GeoHubMapWithLayerSelection.js +34 -33
  75. package/dist/GeoHubMapWithLayerSelection.js.map +1 -1
  76. package/dist/{GraphEl-s3ctz7oA.js → GraphEl-N6vuMRw_.js} +6 -2
  77. package/dist/GraphEl-N6vuMRw_.js.map +1 -0
  78. package/dist/GraphEl-Zl0W-LK9.cjs +2 -0
  79. package/dist/GraphEl-Zl0W-LK9.cjs.map +1 -0
  80. package/dist/GriddedGraphs.cjs +1 -1
  81. package/dist/GriddedGraphs.d.ts +1 -0
  82. package/dist/GriddedGraphs.js +2 -2
  83. package/dist/GriddedGraphsFromConfig.d.ts +1 -0
  84. package/dist/HeatMap.cjs +1 -1
  85. package/dist/HeatMap.cjs.map +1 -1
  86. package/dist/HeatMap.js +55 -54
  87. package/dist/HeatMap.js.map +1 -1
  88. package/dist/Histogram.cjs +1 -1
  89. package/dist/Histogram.js +1 -1
  90. package/dist/LineChartWithConfidenceInterval.cjs +1 -1
  91. package/dist/LineChartWithConfidenceInterval.cjs.map +1 -1
  92. package/dist/LineChartWithConfidenceInterval.js +22 -21
  93. package/dist/LineChartWithConfidenceInterval.js.map +1 -1
  94. package/dist/MultiGraphDashboard.cjs +1 -1
  95. package/dist/MultiGraphDashboard.d.ts +1 -0
  96. package/dist/MultiGraphDashboard.js +1 -1
  97. package/dist/MultiGraphDashboardFromConfig.d.ts +1 -0
  98. package/dist/MultiGraphDashboardWideToLongFormat.cjs +1 -1
  99. package/dist/MultiGraphDashboardWideToLongFormat.js +1 -1
  100. package/dist/MultiLineAltChart.cjs +1 -1
  101. package/dist/MultiLineAltChart.cjs.map +1 -1
  102. package/dist/MultiLineAltChart.js +34 -33
  103. package/dist/MultiLineAltChart.js.map +1 -1
  104. package/dist/MultiLineChart.cjs +1 -1
  105. package/dist/MultiLineChart.cjs.map +1 -1
  106. package/dist/MultiLineChart.js +72 -71
  107. package/dist/MultiLineChart.js.map +1 -1
  108. package/dist/ParetoChart.cjs +1 -1
  109. package/dist/ParetoChart.cjs.map +1 -1
  110. package/dist/ParetoChart.d.ts +4 -0
  111. package/dist/ParetoChart.js +317 -312
  112. package/dist/ParetoChart.js.map +1 -1
  113. package/dist/PerformanceIntensiveMultiGraphDashboard.cjs +1 -1
  114. package/dist/PerformanceIntensiveMultiGraphDashboard.d.ts +1 -0
  115. package/dist/PerformanceIntensiveMultiGraphDashboard.js +1 -1
  116. package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.d.ts +1 -0
  117. package/dist/PerformanceIntensiveScrollStory.d.ts +1 -0
  118. package/dist/RadarChart.cjs +1 -1
  119. package/dist/RadarChart.cjs.map +1 -1
  120. package/dist/RadarChart.js +27 -26
  121. package/dist/RadarChart.js.map +1 -1
  122. package/dist/SankeyChart.cjs +1 -1
  123. package/dist/SankeyChart.cjs.map +1 -1
  124. package/dist/SankeyChart.js +30 -29
  125. package/dist/SankeyChart.js.map +1 -1
  126. package/dist/ScatterPlot.cjs +1 -1
  127. package/dist/ScatterPlot.cjs.map +1 -1
  128. package/dist/ScatterPlot.js +119 -118
  129. package/dist/ScatterPlot.js.map +1 -1
  130. package/dist/ScrollStory.d.ts +1 -0
  131. package/dist/SimpleLineChart.cjs +1 -1
  132. package/dist/SimpleLineChart.cjs.map +1 -1
  133. package/dist/SimpleLineChart.js +16 -15
  134. package/dist/SimpleLineChart.js.map +1 -1
  135. package/dist/SingleGraphDashboard.cjs +1 -1
  136. package/dist/SingleGraphDashboard.d.ts +1 -0
  137. package/dist/SingleGraphDashboard.js +2 -2
  138. package/dist/SingleGraphDashboardFromConfig.d.ts +1 -0
  139. package/dist/SingleGraphDashboardGeoHubMaps.d.ts +1 -0
  140. package/dist/SingleGraphDashboardGeoHubMapsFromConfig.d.ts +1 -0
  141. package/dist/SingleGraphDashboardThreeDGraphs.cjs +1 -1
  142. package/dist/SingleGraphDashboardThreeDGraphs.d.ts +1 -0
  143. package/dist/SingleGraphDashboardThreeDGraphs.js +1 -1
  144. package/dist/SingleGraphDashboardThreeDGraphsFromConfig.d.ts +1 -0
  145. package/dist/SlopeChart.cjs +1 -1
  146. package/dist/SlopeChart.cjs.map +1 -1
  147. package/dist/SlopeChart.js +46 -45
  148. package/dist/SlopeChart.js.map +1 -1
  149. package/dist/SparkLine.cjs +1 -1
  150. package/dist/SparkLine.cjs.map +1 -1
  151. package/dist/SparkLine.js +12 -11
  152. package/dist/SparkLine.js.map +1 -1
  153. package/dist/StripChart.cjs +1 -1
  154. package/dist/StripChart.cjs.map +1 -1
  155. package/dist/StripChart.js +81 -79
  156. package/dist/StripChart.js.map +1 -1
  157. package/dist/ThreeDGlobe.cjs +1 -1
  158. package/dist/ThreeDGlobe.cjs.map +1 -1
  159. package/dist/ThreeDGlobe.js +1 -0
  160. package/dist/ThreeDGlobe.js.map +1 -1
  161. package/dist/TreeMapGraph.cjs +1 -1
  162. package/dist/TreeMapGraph.cjs.map +1 -1
  163. package/dist/TreeMapGraph.js +114 -113
  164. package/dist/TreeMapGraph.js.map +1 -1
  165. package/dist/Types.d.ts +1 -0
  166. package/dist/UnitChart.cjs +1 -1
  167. package/dist/UnitChart.cjs.map +1 -1
  168. package/dist/UnitChart.js +10 -9
  169. package/dist/UnitChart.js.map +1 -1
  170. package/dist/{index-CZLvTu6p.cjs → index-BbNoLJ_w.cjs} +2 -2
  171. package/dist/{index-CZLvTu6p.cjs.map → index-BbNoLJ_w.cjs.map} +1 -1
  172. package/dist/{index-DGAaLNu9.js → index-Bc5VF70V.js} +46 -45
  173. package/dist/{index-DGAaLNu9.js.map → index-Bc5VF70V.js.map} +1 -1
  174. package/dist/index.cjs +1 -1
  175. package/dist/index.d.ts +8 -1
  176. package/dist/index.js +1 -1
  177. package/package.json +2 -2
  178. package/dist/GraphEl-OzC-icbr.cjs +0 -2
  179. package/dist/GraphEl-OzC-icbr.cjs.map +0 -1
  180. package/dist/GraphEl-s3ctz7oA.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"HeatMap.cjs","sources":["../src/Components/Graphs/HeatMap/Graph.tsx","../src/Components/Graphs/HeatMap/index.tsx"],"sourcesContent":["import isEqual from 'fast-deep-equal';\r\nimport { scaleLinear, scaleBand, scaleOrdinal, scaleThreshold } from 'd3-scale';\r\nimport { useRef, useState } from 'react';\r\nimport uniqBy from 'lodash.uniqby';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport { Modal } from '@undp/design-system-react/Modal';\r\nimport { motion, useInView } from 'motion/react';\r\n\r\nimport {\r\n AnimateDataType,\r\n ClassNameObject,\r\n HeatMapDataType,\r\n ScaleDataType,\r\n StyleObject,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { getTextColorBasedOnBgColor } from '@/Utils/getTextColorBasedOnBgColor';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { string2HTML } from '@/Utils/string2HTML';\r\nimport { XAxesLabels } from '@/Components/Elements/Axes/XAxesLabels';\r\nimport { YAxesLabels } from '@/Components/Elements/Axes/YAxesLabels';\r\n\r\ninterface Props {\r\n data: HeatMapDataType[];\r\n colorDomain: string[] | number[];\r\n colors: string[];\r\n noDataColor: string;\r\n scaleType: ScaleDataType;\r\n showColumnLabels: boolean;\r\n leftMargin: number;\r\n truncateBy: number;\r\n width: number;\r\n height: number;\r\n rightMargin: number;\r\n topMargin: number;\r\n showRowLabels: boolean;\r\n bottomMargin: number;\r\n suffix: string;\r\n prefix: string;\r\n showValues?: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n selectedColor?: string;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n resetSelectionOnDoubleClick: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n animate: AnimateDataType;\r\n precision: number;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n showColumnLabels,\r\n leftMargin,\r\n rightMargin,\r\n truncateBy,\r\n width,\r\n height,\r\n topMargin,\r\n bottomMargin,\r\n tooltip,\r\n onSeriesMouseOver,\r\n suffix,\r\n prefix,\r\n showValues,\r\n colorDomain,\r\n colors,\r\n noDataColor,\r\n scaleType,\r\n showRowLabels,\r\n selectedColor,\r\n onSeriesMouseClick,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n animate,\r\n precision,\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 margin = {\r\n top: topMargin,\r\n bottom: bottomMargin,\r\n left: leftMargin,\r\n right: rightMargin,\r\n };\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n const [mouseOverData, setMouseOverData] = useState<HeatMapDataType | undefined>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n const graphWidth = width - margin.left - margin.right;\r\n const graphHeight = height - margin.top - margin.bottom;\r\n const columns = uniqBy(data, d => d.column).map(d => d.column);\r\n const rows = uniqBy(data, d => d.row).map(d => d.row);\r\n const y = scaleBand().domain(rows).range([0, graphHeight]);\r\n const barHeight = y.bandwidth();\r\n const x = scaleBand().domain(columns).range([0, graphWidth]);\r\n const barWidth = x.bandwidth();\r\n const colorScale =\r\n scaleType === 'categorical'\r\n ? scaleOrdinal<number | string, string>().domain(colorDomain).range(colors)\r\n : scaleType === 'threshold'\r\n ? scaleThreshold<number, string>()\r\n .domain(colorDomain as number[])\r\n .range(colors)\r\n : scaleLinear<string, string>()\r\n .domain(colorDomain as number[])\r\n .range(colors);\r\n return (\r\n <>\r\n <motion.svg\r\n width={`${width}px`}\r\n height={`${height}px`}\r\n viewBox={`0 0 ${width} ${height}`}\r\n style={{ marginLeft: 'auto', marginRight: 'auto' }}\r\n direction='ltr'\r\n ref={svgRef}\r\n >\r\n <g transform={`translate(${margin.left},${0})`}>\r\n {showColumnLabels\r\n ? columns.map((d, i) => (\r\n <XAxesLabels\r\n key={i}\r\n y={0}\r\n x={x(d) as number}\r\n width={barWidth}\r\n height={margin.top - 5}\r\n value={\r\n `${d}`.length < truncateBy ? `${d}` : `${`${d}`.substring(0, truncateBy)}...`\r\n }\r\n style={styles?.xAxis?.labels}\r\n className={classNames?.xAxis?.labels}\r\n alignment='bottom'\r\n animate={{ duration: 0, once: true, amount: 0 }}\r\n isInView={isInView}\r\n />\r\n ))\r\n : null}\r\n </g>\r\n <g transform={`translate(${0},${margin.top})`}>\r\n {showRowLabels\r\n ? rows.map((d, i) => (\r\n <YAxesLabels\r\n value={\r\n `${d}`.length < truncateBy ? `${d}` : `${`${d}`.substring(0, truncateBy)}...`\r\n }\r\n key={i}\r\n y={y(d) as number}\r\n x={0}\r\n width={margin.left}\r\n height={barHeight}\r\n alignment='right'\r\n style={styles?.yAxis?.labels}\r\n className={classNames?.yAxis?.labels}\r\n animate={{ duration: 0, once: true, amount: 0 }}\r\n isInView={isInView}\r\n />\r\n ))\r\n : null}\r\n </g>\r\n <g transform={`translate(${margin.left},${margin.top})`}>\r\n {rows.map((d, i) => (\r\n <g key={i} transform={`translate(0,${y(d)})`}>\r\n {columns.map(el => (\r\n <rect\r\n key={`${d}-${el}`}\r\n x={x(el)}\r\n y={0}\r\n width={barWidth}\r\n height={barHeight}\r\n style={{ fill: noDataColor }}\r\n className='stroke-1 stroke-primary-white dark:stroke-primary-gray-700'\r\n />\r\n ))}\r\n </g>\r\n ))}\r\n {data\r\n .filter(d => !checkIfNullOrUndefined(d.value))\r\n .map((d, i) => {\r\n const color = !checkIfNullOrUndefined(d.value)\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n colorScale(d.value as any)\r\n : noDataColor;\r\n return (\r\n <g\r\n key={`${d.column}-${d.row}`}\r\n transform={`translate(${x(d.column)},${y(d.row)})`}\r\n onMouseEnter={event => {\r\n setMouseOverData(d);\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) && resetSelectionOnDoubleClick) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n setMouseClickData(d);\r\n onSeriesMouseClick?.(d);\r\n }\r\n }\r\n }}\r\n onMouseMove={event => {\r\n setMouseOverData(d);\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 opacity={selectedColor ? (selectedColor === color ? 1 : 0.3) : 1}\r\n >\r\n <motion.rect\r\n x={0}\r\n y={0}\r\n width={barWidth}\r\n height={barHeight}\r\n className='stroke-1 stroke-primary-white dark:stroke-primary-gray-700'\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { fill: color, opacity: 0 },\r\n whileInView: {\r\n fill: color,\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n {showValues && !checkIfNullOrUndefined(d.value) ? (\r\n <motion.g\r\n variants={{\r\n initial: { opacity: 0 },\r\n whileInView: { opacity: 1, transition: { duration: animate.duration } },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n >\r\n <foreignObject key={i} y={0} x={0} width={barWidth} height={barHeight}>\r\n <div className='flex flex-col justify-center items-center h-inherit p-1'>\r\n <p\r\n className={cn(\r\n 'text-xs text-center m-0 leading-[1.25] graph-value',\r\n classNames?.graphObjectValues,\r\n )}\r\n style={{\r\n color: getTextColorBasedOnBgColor(color),\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n >\r\n {numberFormattingFunction(d.value, 'NA', precision, prefix, suffix)}\r\n </p>\r\n </div>\r\n </foreignObject>\r\n </motion.g>\r\n ) : null}\r\n </g>\r\n );\r\n })}\r\n {mouseOverData ? (\r\n <rect\r\n x={x(mouseOverData.column)}\r\n y={y(mouseOverData.row)}\r\n width={barWidth}\r\n height={barHeight}\r\n style={{\r\n fill: 'none',\r\n fillOpacity: 0,\r\n strokeWidth: 1.5,\r\n }}\r\n className='stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n />\r\n ) : null}\r\n </g>\r\n </motion.svg>\r\n {mouseOverData && tooltip && eventX && eventY ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={eventX}\r\n yPos={eventY}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n {detailsOnClick && mouseClickData !== undefined ? (\r\n <Modal\r\n open={mouseClickData !== undefined}\r\n onClose={() => {\r\n setMouseClickData(undefined);\r\n }}\r\n >\r\n <div\r\n className='graph-modal-content m-0'\r\n dangerouslySetInnerHTML={\r\n typeof detailsOnClick === 'string'\r\n ? { __html: string2HTML(detailsOnClick, mouseClickData) }\r\n : undefined\r\n }\r\n >\r\n {typeof detailsOnClick === 'function' ? detailsOnClick(mouseClickData) : null}\r\n </div>\r\n </Modal>\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import { useState, useRef, useEffect } from 'react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport {\r\n HeatMapDataType,\r\n Languages,\r\n ScaleDataType,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n AnimateDataType,\r\n} from '@/Types';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { ColorLegendWithMouseOver } from '@/Components/Elements/ColorLegendWithMouseOver';\r\nimport { LinearColorLegend } from '@/Components/Elements/LinearColorLegend';\r\nimport { ThresholdColorLegendWithMouseOver } from '@/Components/Elements/ThresholdColorLegendWithMouseOver';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { EmptyState } from '@/Components/Elements/EmptyState';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: HeatMapDataType[];\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 cells */\r\n colors?: string[];\r\n /** Color where data is not available */\r\n noDataColor?: string;\r\n /** Title for the color legend */\r\n colorLegendTitle?: string;\r\n /** Background color of the graph */\r\n backgroundColor?: string | boolean;\r\n /** Custom styles for the graph. Each object should be a valid React CSS style object. */\r\n styles?: StyleObject;\r\n /** Custom class names */\r\n classNames?: ClassNameObject;\r\n\r\n // Size and Spacing\r\n /** Width of the graph */\r\n width?: number;\r\n /** Height of the graph */\r\n height?: number;\r\n /** Minimum height of the graph */\r\n minHeight?: number;\r\n /** Relative height scaling factor. This overwrites the height props */\r\n relativeHeight?: number;\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n /** Left margin of the graph */\r\n leftMargin?: number;\r\n /** Right margin of the graph */\r\n rightMargin?: number;\r\n /** Top margin of the graph */\r\n topMargin?: number;\r\n /** Bottom margin of the graph */\r\n bottomMargin?: number;\r\n /** Toggles the background to fill the container. This only works if the width of the graph is defined. */\r\n fillContainer?: boolean;\r\n\r\n // Values and Ticks\r\n /** Prefix for values */\r\n prefix?: string;\r\n /** Suffix for values */\r\n suffix?: string;\r\n /** Maximum value for the chart */\r\n truncateBy?: number;\r\n /** Reference values for comparison */\r\n\r\n // Graph Parameters\r\n /** Toggle visibility of labels in the column */\r\n showColumnLabels?: boolean;\r\n /** Toggle visibility of labels in the row */\r\n showRowLabels?: boolean;\r\n /** Scale for the colors in the cell */\r\n scaleType?: ScaleDataType;\r\n /** Toggle visibility of values */\r\n showValues?: boolean;\r\n /** Toggle visibility of color scale. This is only applicable if the data props hae color parameter */\r\n showColorScale?: boolean;\r\n /** Toggle visibility of NA color in the color scale. This is only applicable if the data props hae color parameter and showColorScale prop is true */\r\n showNAColor?: boolean;\r\n /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\r\n /** Domain for the colors in the cell. */\r\n colorDomain: number[] | string[];\r\n /** Specifies the number of decimal places to display in the value. */\r\n precision?: number;\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 HeatMap(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n colors,\r\n sources,\r\n graphDescription,\r\n showColumnLabels = true,\r\n leftMargin = 100,\r\n rightMargin = 10,\r\n truncateBy = 999,\r\n height,\r\n width,\r\n scaleType,\r\n colorDomain,\r\n footNote,\r\n colorLegendTitle,\r\n padding,\r\n backgroundColor = false,\r\n topMargin = 30,\r\n bottomMargin = 10,\r\n tooltip,\r\n onSeriesMouseOver,\r\n suffix = '',\r\n prefix = '',\r\n showRowLabels = true,\r\n relativeHeight,\r\n showValues,\r\n graphID,\r\n noDataColor = Colors.gray,\r\n showColorScale = true,\r\n onSeriesMouseClick,\r\n graphDownload = false,\r\n dataDownload = false,\r\n fillContainer = true,\r\n language = 'en',\r\n showNAColor = true,\r\n minHeight = 0,\r\n theme = 'light',\r\n ariaLabel,\r\n resetSelectionOnDoubleClick = true,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n animate = false,\r\n precision = 2,\r\n } = props;\r\n\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n const [selectedColor, setSelectedColor] = useState<string | undefined>(undefined);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(width || entries[0].target.clientWidth || 620);\r\n setSvgHeight(height || entries[0].target.clientHeight || 480);\r\n });\r\n if (graphDiv.current) {\r\n setSvgHeight(graphDiv.current.clientHeight || 480);\r\n setSvgWidth(graphDiv.current.clientWidth || 620);\r\n if (!width) resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, [width, height]);\r\n const scale =\r\n scaleType ||\r\n (typeof colorDomain[0] === 'string'\r\n ? 'categorical'\r\n : colorDomain.length === 2\r\n ? 'linear'\r\n : 'threshold');\r\n\r\n return (\r\n <div\r\n className={`${theme || 'light'} flex ${width ? 'grow-0' : 'grow'} ${\r\n !fillContainer ? 'w-fit' : 'w-full'\r\n }`}\r\n dir={language === 'he' || language === 'ar' ? 'rtl' : undefined}\r\n >\r\n <div\r\n className={cn(\r\n `${\r\n !backgroundColor\r\n ? 'bg-transparent '\r\n : backgroundColor === true\r\n ? 'bg-primary-gray-200 dark:bg-primary-gray-650 '\r\n : ''\r\n }ml-auto mr-auto flex flex-col grow h-inherit ${language || 'en'}`,\r\n classNames?.graphContainer,\r\n )}\r\n style={{\r\n ...(styles?.graphContainer || {}),\r\n ...(backgroundColor && backgroundColor !== true ? { backgroundColor } : {}),\r\n }}\r\n id={graphID}\r\n ref={graphParentDiv}\r\n aria-label={\r\n ariaLabel ||\r\n `${\r\n graphTitle ? `The graph shows ${graphTitle}. ` : ''\r\n }This is a heatmap. ${graphDescription ? ` ${graphDescription}` : ''}`\r\n }\r\n >\r\n <div\r\n className='flex grow'\r\n style={{ padding: backgroundColor ? padding || '1rem' : padding || 0 }}\r\n >\r\n <div className='flex flex-col w-full gap-4 grow justify-between'>\r\n {graphTitle || graphDescription || graphDownload || dataDownload ? (\r\n <GraphHeader\r\n styles={{\r\n title: styles?.title,\r\n description: styles?.description,\r\n }}\r\n classNames={{\r\n title: classNames?.title,\r\n description: classNames?.description,\r\n }}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n width={width}\r\n graphDownload={graphDownload ? graphParentDiv.current : undefined}\r\n dataDownload={\r\n dataDownload\r\n ? data.map(d => d.data).filter(d => d !== undefined).length > 0\r\n ? data.map(d => d.data).filter(d => d !== undefined)\r\n : data.filter(d => d !== undefined)\r\n : null\r\n }\r\n />\r\n ) : null}\r\n <div className='grow flex flex-col justify-center gap-3 w-full'>\r\n {data.length === 0 ? (\r\n <EmptyState />\r\n ) : (\r\n <>\r\n {showColorScale ? (\r\n scale === 'categorical' ? (\r\n <ColorLegendWithMouseOver\r\n width={fillContainer ? undefined : width}\r\n colorLegendTitle={colorLegendTitle}\r\n colors={\r\n colors ||\r\n (typeof colorDomain[0] === 'string'\r\n ? Colors[theme].categoricalColors.colors\r\n : colorDomain.length === 2\r\n ? [\r\n Colors[theme].sequentialColors.neutralColorsx09[0],\r\n Colors[theme].sequentialColors.neutralColorsx09[8],\r\n ]\r\n : Colors[theme].sequentialColors[\r\n `neutralColorsx0${\r\n (colorDomain.length + 1) as 4 | 5 | 6 | 7 | 8 | 9\r\n }`\r\n ])\r\n }\r\n colorDomain={colorDomain.map(d => `${d}`)}\r\n setSelectedColor={setSelectedColor}\r\n showNAColor={showNAColor}\r\n />\r\n ) : scale === 'threshold' ? (\r\n <ThresholdColorLegendWithMouseOver\r\n width={fillContainer ? undefined : width}\r\n colorLegendTitle={colorLegendTitle}\r\n colors={\r\n colors ||\r\n (typeof colorDomain[0] === 'string'\r\n ? Colors[theme].categoricalColors.colors\r\n : colorDomain.length === 2\r\n ? [\r\n Colors[theme].sequentialColors.neutralColorsx09[0],\r\n Colors[theme].sequentialColors.neutralColorsx09[8],\r\n ]\r\n : Colors[theme].sequentialColors[\r\n `neutralColorsx0${\r\n (colorDomain.length + 1) as 4 | 5 | 6 | 7 | 8 | 9\r\n }`\r\n ])\r\n }\r\n colorDomain={colorDomain as number[]}\r\n setSelectedColor={setSelectedColor}\r\n naColor={noDataColor}\r\n showNAColor={showNAColor}\r\n />\r\n ) : (\r\n <LinearColorLegend\r\n width={fillContainer ? undefined : width}\r\n colorLegendTitle={colorLegendTitle}\r\n colors={\r\n colors || [\r\n Colors[theme].sequentialColors.neutralColorsx09[0],\r\n Colors[theme].sequentialColors.neutralColorsx09[8],\r\n ]\r\n }\r\n colorDomain={colorDomain as number[]}\r\n />\r\n )\r\n ) : null}\r\n <div\r\n className='flex grow flex-col justify-center w-full leading-0'\r\n ref={graphDiv}\r\n aria-label='Graph area'\r\n >\r\n {(width || svgWidth) && (height || svgHeight) ? (\r\n <Graph\r\n data={data}\r\n colorDomain={colorDomain}\r\n width={width || svgWidth}\r\n colors={\r\n colors ||\r\n (typeof colorDomain[0] === 'string'\r\n ? Colors[theme].categoricalColors.colors\r\n : colorDomain.length === 2\r\n ? [\r\n Colors[theme].sequentialColors.neutralColorsx09[0],\r\n Colors[theme].sequentialColors.neutralColorsx09[8],\r\n ]\r\n : Colors[theme].sequentialColors[\r\n `neutralColorsx0${\r\n (colorDomain.length + 1) as 4 | 5 | 6 | 7 | 8 | 9\r\n }`\r\n ])\r\n }\r\n noDataColor={noDataColor}\r\n scaleType={scale}\r\n height={Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}\r\n showColumnLabels={showColumnLabels}\r\n leftMargin={leftMargin}\r\n rightMargin={rightMargin}\r\n topMargin={topMargin}\r\n bottomMargin={bottomMargin}\r\n selectedColor={selectedColor}\r\n truncateBy={truncateBy}\r\n showRowLabels={showRowLabels}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n showValues={showValues}\r\n suffix={suffix}\r\n prefix={prefix}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n detailsOnClick={detailsOnClick}\r\n styles={styles}\r\n classNames={classNames}\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 precision={precision}\r\n />\r\n ) : null}\r\n </div>\r\n </>\r\n )}\r\n </div>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n}\r\n"],"names":["Graph","props","data","showColumnLabels","leftMargin","rightMargin","truncateBy","width","height","topMargin","bottomMargin","tooltip","onSeriesMouseOver","suffix","prefix","showValues","colorDomain","colors","noDataColor","scaleType","showRowLabels","selectedColor","onSeriesMouseClick","resetSelectionOnDoubleClick","detailsOnClick","styles","classNames","animate","precision","svgRef","useRef","isInView","useInView","margin","mouseClickData","setMouseClickData","useState","mouseOverData","setMouseOverData","eventX","setEventX","eventY","setEventY","graphWidth","graphHeight","columns","uniqBy","d","rows","y","scaleBand","barHeight","x","barWidth","colorScale","scaleOrdinal","scaleThreshold","scaleLinear","jsxs","Fragment","motion","jsx","i","XAxesLabels","YAxesLabels","el","checkIfNullOrUndefined","color","event","isEqual","cn","getTextColorBasedOnBgColor","Tooltip","Modal","string2HTML","HeatMap","graphTitle","sources","graphDescription","footNote","colorLegendTitle","padding","backgroundColor","relativeHeight","graphID","Colors","showColorScale","graphDownload","dataDownload","fillContainer","language","showNAColor","minHeight","theme","ariaLabel","svgWidth","setSvgWidth","svgHeight","setSvgHeight","setSelectedColor","graphDiv","graphParentDiv","useEffect","resizeObserver","entries","scale","GraphHeader","EmptyState","ColorLegendWithMouseOver","ThresholdColorLegendWithMouseOver","LinearColorLegend","GraphFooter"],"mappings":"wiCAyDO,SAASA,GAAMC,EAAc,CAClC,KAAM,CACJ,KAAAC,EACA,iBAAAC,EACA,WAAAC,EACA,YAAAC,EACA,WAAAC,EACA,MAAAC,EACA,OAAAC,EACA,UAAAC,EACA,aAAAC,EACA,QAAAC,EACA,kBAAAC,EACA,OAAAC,EACA,OAAAC,EACA,WAAAC,EACA,YAAAC,EACA,OAAAC,EACA,YAAAC,EACA,UAAAC,EACA,c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AA,CAAA,CACN,CAAA,CACF,CAAA,CAEJ,EACCiD,GAAWE,EACVlB,EAAAA,kBAAAA,IAACkD,GAAAA,YAAA,CACC,OAAQ,CAAE,SAAUtF,GAAQ,SAAU,OAAQA,GAAQ,MAAA,EACtD,WAAY,CACV,SAAUC,GAAY,SACtB,OAAQA,GAAY,MAAA,EAEtB,QAAAmD,EACA,SAAAE,EACA,MAAAxE,CAAA,CAAA,EAEA,IAAA,CAAA,CACN,CAAA,CAAA,CACF,CAAA,CACF,CAAA,CAGN"}
1
+ {"version":3,"file":"HeatMap.cjs","sources":["../src/Components/Graphs/HeatMap/Graph.tsx","../src/Components/Graphs/HeatMap/index.tsx"],"sourcesContent":["import isEqual from 'fast-deep-equal';\r\nimport { scaleLinear, scaleBand, scaleOrdinal, scaleThreshold } from 'd3-scale';\r\nimport { useRef, useState } from 'react';\r\nimport uniqBy from 'lodash.uniqby';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport { Modal } from '@undp/design-system-react/Modal';\r\nimport { motion, useInView } from 'motion/react';\r\n\r\nimport {\r\n AnimateDataType,\r\n ClassNameObject,\r\n HeatMapDataType,\r\n ScaleDataType,\r\n StyleObject,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { getTextColorBasedOnBgColor } from '@/Utils/getTextColorBasedOnBgColor';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { string2HTML } from '@/Utils/string2HTML';\r\nimport { XAxesLabels } from '@/Components/Elements/Axes/XAxesLabels';\r\nimport { YAxesLabels } from '@/Components/Elements/Axes/YAxesLabels';\r\n\r\ninterface Props {\r\n data: HeatMapDataType[];\r\n colorDomain: string[] | number[];\r\n colors: string[];\r\n noDataColor: string;\r\n scaleType: ScaleDataType;\r\n showColumnLabels: boolean;\r\n leftMargin: number;\r\n truncateBy: number;\r\n width: number;\r\n height: number;\r\n rightMargin: number;\r\n topMargin: number;\r\n showRowLabels: boolean;\r\n bottomMargin: number;\r\n suffix: string;\r\n prefix: string;\r\n showValues?: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n selectedColor?: string;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n resetSelectionOnDoubleClick: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n animate: AnimateDataType;\r\n precision: number;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n showColumnLabels,\r\n leftMargin,\r\n rightMargin,\r\n truncateBy,\r\n width,\r\n height,\r\n topMargin,\r\n bottomMargin,\r\n tooltip,\r\n onSeriesMouseOver,\r\n suffix,\r\n prefix,\r\n showValues,\r\n colorDomain,\r\n colors,\r\n noDataColor,\r\n scaleType,\r\n showRowLabels,\r\n selectedColor,\r\n onSeriesMouseClick,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n animate,\r\n precision,\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 margin = {\r\n top: topMargin,\r\n bottom: bottomMargin,\r\n left: leftMargin,\r\n right: rightMargin,\r\n };\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n const [mouseOverData, setMouseOverData] = useState<HeatMapDataType | undefined>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n const graphWidth = width - margin.left - margin.right;\r\n const graphHeight = height - margin.top - margin.bottom;\r\n const columns = uniqBy(data, d => d.column).map(d => d.column);\r\n const rows = uniqBy(data, d => d.row).map(d => d.row);\r\n const y = scaleBand().domain(rows).range([0, graphHeight]);\r\n const barHeight = y.bandwidth();\r\n const x = scaleBand().domain(columns).range([0, graphWidth]);\r\n const barWidth = x.bandwidth();\r\n const colorScale =\r\n scaleType === 'categorical'\r\n ? scaleOrdinal<number | string, string>().domain(colorDomain).range(colors)\r\n : scaleType === 'threshold'\r\n ? scaleThreshold<number, string>()\r\n .domain(colorDomain as number[])\r\n .range(colors)\r\n : scaleLinear<string, string>()\r\n .domain(colorDomain as number[])\r\n .range(colors);\r\n return (\r\n <>\r\n <motion.svg\r\n width={`${width}px`}\r\n height={`${height}px`}\r\n viewBox={`0 0 ${width} ${height}`}\r\n style={{ marginLeft: 'auto', marginRight: 'auto' }}\r\n direction='ltr'\r\n ref={svgRef}\r\n >\r\n <g transform={`translate(${margin.left},${0})`}>\r\n {showColumnLabels\r\n ? columns.map((d, i) => (\r\n <XAxesLabels\r\n key={i}\r\n y={0}\r\n x={x(d) as number}\r\n width={barWidth}\r\n height={margin.top - 5}\r\n value={\r\n `${d}`.length < truncateBy ? `${d}` : `${`${d}`.substring(0, truncateBy)}...`\r\n }\r\n style={styles?.xAxis?.labels}\r\n className={classNames?.xAxis?.labels}\r\n alignment='bottom'\r\n animate={{ duration: 0, once: true, amount: 0 }}\r\n isInView={isInView}\r\n />\r\n ))\r\n : null}\r\n </g>\r\n <g transform={`translate(${0},${margin.top})`}>\r\n {showRowLabels\r\n ? rows.map((d, i) => (\r\n <YAxesLabels\r\n value={\r\n `${d}`.length < truncateBy ? `${d}` : `${`${d}`.substring(0, truncateBy)}...`\r\n }\r\n key={i}\r\n y={y(d) as number}\r\n x={0}\r\n width={margin.left}\r\n height={barHeight}\r\n alignment='right'\r\n style={styles?.yAxis?.labels}\r\n className={classNames?.yAxis?.labels}\r\n animate={{ duration: 0, once: true, amount: 0 }}\r\n isInView={isInView}\r\n />\r\n ))\r\n : null}\r\n </g>\r\n <g transform={`translate(${margin.left},${margin.top})`}>\r\n {rows.map((d, i) => (\r\n <g key={i} transform={`translate(0,${y(d)})`}>\r\n {columns.map(el => (\r\n <rect\r\n key={`${d}-${el}`}\r\n x={x(el)}\r\n y={0}\r\n width={barWidth}\r\n height={barHeight}\r\n style={{ fill: noDataColor }}\r\n className='stroke-1 stroke-primary-white dark:stroke-primary-gray-700'\r\n />\r\n ))}\r\n </g>\r\n ))}\r\n {data\r\n .filter(d => !checkIfNullOrUndefined(d.value))\r\n .map((d, i) => {\r\n const color = !checkIfNullOrUndefined(d.value)\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n colorScale(d.value as any)\r\n : noDataColor;\r\n return (\r\n <g\r\n key={`${d.column}-${d.row}`}\r\n transform={`translate(${x(d.column)},${y(d.row)})`}\r\n onMouseEnter={event => {\r\n setMouseOverData(d);\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) && resetSelectionOnDoubleClick) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n setMouseClickData(d);\r\n onSeriesMouseClick?.(d);\r\n }\r\n }\r\n }}\r\n onMouseMove={event => {\r\n setMouseOverData(d);\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 opacity={selectedColor ? (selectedColor === color ? 1 : 0.3) : 1}\r\n >\r\n <motion.rect\r\n x={0}\r\n y={0}\r\n width={barWidth}\r\n height={barHeight}\r\n className='stroke-1 stroke-primary-white dark:stroke-primary-gray-700'\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { fill: color, opacity: 0 },\r\n whileInView: {\r\n fill: color,\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n {showValues && !checkIfNullOrUndefined(d.value) ? (\r\n <motion.g\r\n variants={{\r\n initial: { opacity: 0 },\r\n whileInView: { opacity: 1, transition: { duration: animate.duration } },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n >\r\n <foreignObject key={i} y={0} x={0} width={barWidth} height={barHeight}>\r\n <div className='flex flex-col justify-center items-center h-inherit p-1'>\r\n <p\r\n className={cn(\r\n 'text-xs text-center m-0 leading-[1.25] graph-value',\r\n classNames?.graphObjectValues,\r\n )}\r\n style={{\r\n color: getTextColorBasedOnBgColor(color),\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n >\r\n {numberFormattingFunction(d.value, 'NA', precision, prefix, suffix)}\r\n </p>\r\n </div>\r\n </foreignObject>\r\n </motion.g>\r\n ) : null}\r\n </g>\r\n );\r\n })}\r\n {mouseOverData ? (\r\n <rect\r\n x={x(mouseOverData.column)}\r\n y={y(mouseOverData.row)}\r\n width={barWidth}\r\n height={barHeight}\r\n style={{\r\n fill: 'none',\r\n fillOpacity: 0,\r\n strokeWidth: 1.5,\r\n }}\r\n className='stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n />\r\n ) : null}\r\n </g>\r\n </motion.svg>\r\n {mouseOverData && tooltip && eventX && eventY ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={eventX}\r\n yPos={eventY}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n {detailsOnClick && mouseClickData !== undefined ? (\r\n <Modal\r\n open={mouseClickData !== undefined}\r\n onClose={() => {\r\n setMouseClickData(undefined);\r\n }}\r\n >\r\n <div\r\n className='graph-modal-content m-0'\r\n dangerouslySetInnerHTML={\r\n typeof detailsOnClick === 'string'\r\n ? { __html: string2HTML(detailsOnClick, mouseClickData) }\r\n : undefined\r\n }\r\n >\r\n {typeof detailsOnClick === 'function' ? detailsOnClick(mouseClickData) : null}\r\n </div>\r\n </Modal>\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import { useState, useRef, useEffect } from 'react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport {\r\n HeatMapDataType,\r\n Languages,\r\n ScaleDataType,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n AnimateDataType,\r\n} from '@/Types';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { ColorLegendWithMouseOver } from '@/Components/Elements/ColorLegendWithMouseOver';\r\nimport { LinearColorLegend } from '@/Components/Elements/LinearColorLegend';\r\nimport { ThresholdColorLegendWithMouseOver } from '@/Components/Elements/ThresholdColorLegendWithMouseOver';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { EmptyState } from '@/Components/Elements/EmptyState';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: HeatMapDataType[];\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 cells */\r\n colors?: string[];\r\n /** Color where data is not available */\r\n noDataColor?: string;\r\n /** Title for the color legend */\r\n colorLegendTitle?: string;\r\n /** Background color of the graph */\r\n backgroundColor?: string | boolean;\r\n /** Custom styles for the graph. Each object should be a valid React CSS style object. */\r\n styles?: StyleObject;\r\n /** Custom class names */\r\n classNames?: ClassNameObject;\r\n\r\n // Size and Spacing\r\n /** Width of the graph */\r\n width?: number;\r\n /** Height of the graph */\r\n height?: number;\r\n /** Minimum height of the graph */\r\n minHeight?: number;\r\n /** Relative height scaling factor. This overwrites the height props */\r\n relativeHeight?: number;\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n /** Left margin of the graph */\r\n leftMargin?: number;\r\n /** Right margin of the graph */\r\n rightMargin?: number;\r\n /** Top margin of the graph */\r\n topMargin?: number;\r\n /** Bottom margin of the graph */\r\n bottomMargin?: number;\r\n /** Toggles the background to fill the container. This only works if the width of the graph is defined. */\r\n fillContainer?: boolean;\r\n\r\n // Values and Ticks\r\n /** Prefix for values */\r\n prefix?: string;\r\n /** Suffix for values */\r\n suffix?: string;\r\n /** Maximum value for the chart */\r\n truncateBy?: number;\r\n /** Reference values for comparison */\r\n\r\n // Graph Parameters\r\n /** Toggle visibility of labels in the column */\r\n showColumnLabels?: boolean;\r\n /** Toggle visibility of labels in the row */\r\n showRowLabels?: boolean;\r\n /** Scale for the colors in the cell */\r\n scaleType?: ScaleDataType;\r\n /** Toggle visibility of values */\r\n showValues?: boolean;\r\n /** Toggle visibility of color scale. This is only applicable if the data props hae color parameter */\r\n showColorScale?: boolean;\r\n /** Toggle visibility of NA color in the color scale. This is only applicable if the data props hae color parameter and showColorScale prop is true */\r\n showNAColor?: boolean;\r\n /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\r\n /** Domain for the colors in the cell. */\r\n colorDomain: number[] | string[];\r\n /** Specifies the number of decimal places to display in the value. */\r\n precision?: number;\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 HeatMap(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n colors,\r\n sources,\r\n graphDescription,\r\n showColumnLabels = true,\r\n leftMargin = 100,\r\n rightMargin = 10,\r\n truncateBy = 999,\r\n height,\r\n width,\r\n scaleType,\r\n colorDomain,\r\n footNote,\r\n colorLegendTitle,\r\n padding,\r\n backgroundColor = false,\r\n topMargin = 30,\r\n bottomMargin = 10,\r\n tooltip,\r\n onSeriesMouseOver,\r\n suffix = '',\r\n prefix = '',\r\n showRowLabels = true,\r\n relativeHeight,\r\n showValues,\r\n graphID,\r\n noDataColor = Colors.gray,\r\n showColorScale = true,\r\n onSeriesMouseClick,\r\n graphDownload = false,\r\n dataDownload = false,\r\n fillContainer = true,\r\n language = 'en',\r\n showNAColor = true,\r\n minHeight = 0,\r\n theme = 'light',\r\n ariaLabel,\r\n resetSelectionOnDoubleClick = true,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n animate = false,\r\n precision = 2,\r\n } = props;\r\n\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n const [selectedColor, setSelectedColor] = useState<string | undefined>(undefined);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(width || entries[0].target.clientWidth || 620);\r\n setSvgHeight(height || entries[0].target.clientHeight || 480);\r\n });\r\n if (graphDiv.current) {\r\n setSvgHeight(graphDiv.current.clientHeight || 480);\r\n setSvgWidth(graphDiv.current.clientWidth || 620);\r\n if (!width) resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, [width, height]);\r\n const scale =\r\n scaleType ||\r\n (typeof colorDomain[0] === 'string'\r\n ? 'categorical'\r\n : colorDomain.length === 2\r\n ? 'linear'\r\n : 'threshold');\r\n\r\n return (\r\n <div\r\n className={`${theme || 'light'} flex ${width ? 'grow-0' : 'grow'} ${\r\n !fillContainer ? 'w-fit' : 'w-full'\r\n }`}\r\n dir={language === 'he' || language === 'ar' ? 'rtl' : undefined}\r\n >\r\n <div\r\n className={cn(\r\n `${\r\n !backgroundColor\r\n ? 'bg-transparent '\r\n : backgroundColor === true\r\n ? 'bg-primary-gray-200 dark:bg-primary-gray-650 '\r\n : ''\r\n }ml-auto mr-auto flex flex-col grow h-inherit ${language || 'en'}`,\r\n !fillContainer ? 'w-fit' : 'w-full',\r\n classNames?.graphContainer,\r\n )}\r\n style={{\r\n ...(styles?.graphContainer || {}),\r\n ...(backgroundColor && backgroundColor !== true ? { backgroundColor } : {}),\r\n }}\r\n id={graphID}\r\n ref={graphParentDiv}\r\n aria-label={\r\n ariaLabel ||\r\n `${\r\n graphTitle ? `The graph shows ${graphTitle}. ` : ''\r\n }This is a heatmap. ${graphDescription ? ` ${graphDescription}` : ''}`\r\n }\r\n >\r\n <div\r\n className='flex grow'\r\n style={{ padding: backgroundColor ? padding || '1rem' : padding || 0 }}\r\n >\r\n <div className='flex flex-col w-full gap-4 grow justify-between'>\r\n {graphTitle || graphDescription || graphDownload || dataDownload ? (\r\n <GraphHeader\r\n styles={{\r\n title: styles?.title,\r\n description: styles?.description,\r\n }}\r\n classNames={{\r\n title: classNames?.title,\r\n description: classNames?.description,\r\n }}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n width={width}\r\n graphDownload={graphDownload ? graphParentDiv.current : undefined}\r\n dataDownload={\r\n dataDownload\r\n ? data.map(d => d.data).filter(d => d !== undefined).length > 0\r\n ? data.map(d => d.data).filter(d => d !== undefined)\r\n : data.filter(d => d !== undefined)\r\n : null\r\n }\r\n />\r\n ) : null}\r\n <div className='grow flex flex-col justify-center gap-3 w-full'>\r\n {data.length === 0 ? (\r\n <EmptyState />\r\n ) : (\r\n <>\r\n {showColorScale ? (\r\n scale === 'categorical' ? (\r\n <ColorLegendWithMouseOver\r\n width={fillContainer ? undefined : width}\r\n colorLegendTitle={colorLegendTitle}\r\n colors={\r\n colors ||\r\n (typeof colorDomain[0] === 'string'\r\n ? Colors[theme].categoricalColors.colors\r\n : colorDomain.length === 2\r\n ? [\r\n Colors[theme].sequentialColors.neutralColorsx09[0],\r\n Colors[theme].sequentialColors.neutralColorsx09[8],\r\n ]\r\n : Colors[theme].sequentialColors[\r\n `neutralColorsx0${\r\n (colorDomain.length + 1) as 4 | 5 | 6 | 7 | 8 | 9\r\n }`\r\n ])\r\n }\r\n colorDomain={colorDomain.map(d => `${d}`)}\r\n setSelectedColor={setSelectedColor}\r\n showNAColor={showNAColor}\r\n />\r\n ) : scale === 'threshold' ? (\r\n <ThresholdColorLegendWithMouseOver\r\n width={fillContainer ? undefined : width}\r\n colorLegendTitle={colorLegendTitle}\r\n colors={\r\n colors ||\r\n (typeof colorDomain[0] === 'string'\r\n ? Colors[theme].categoricalColors.colors\r\n : colorDomain.length === 2\r\n ? [\r\n Colors[theme].sequentialColors.neutralColorsx09[0],\r\n Colors[theme].sequentialColors.neutralColorsx09[8],\r\n ]\r\n : Colors[theme].sequentialColors[\r\n `neutralColorsx0${\r\n (colorDomain.length + 1) as 4 | 5 | 6 | 7 | 8 | 9\r\n }`\r\n ])\r\n }\r\n colorDomain={colorDomain as number[]}\r\n setSelectedColor={setSelectedColor}\r\n naColor={noDataColor}\r\n showNAColor={showNAColor}\r\n />\r\n ) : (\r\n <LinearColorLegend\r\n width={fillContainer ? undefined : width}\r\n colorLegendTitle={colorLegendTitle}\r\n colors={\r\n colors || [\r\n Colors[theme].sequentialColors.neutralColorsx09[0],\r\n Colors[theme].sequentialColors.neutralColorsx09[8],\r\n ]\r\n }\r\n colorDomain={colorDomain as number[]}\r\n />\r\n )\r\n ) : null}\r\n <div\r\n className='flex grow flex-col justify-center w-full leading-0'\r\n ref={graphDiv}\r\n aria-label='Graph area'\r\n >\r\n {(width || svgWidth) && (height || svgHeight) ? (\r\n <Graph\r\n data={data}\r\n colorDomain={colorDomain}\r\n width={width || svgWidth}\r\n colors={\r\n colors ||\r\n (typeof colorDomain[0] === 'string'\r\n ? Colors[theme].categoricalColors.colors\r\n : colorDomain.length === 2\r\n ? [\r\n Colors[theme].sequentialColors.neutralColorsx09[0],\r\n Colors[theme].sequentialColors.neutralColorsx09[8],\r\n ]\r\n : Colors[theme].sequentialColors[\r\n `neutralColorsx0${\r\n (colorDomain.length + 1) as 4 | 5 | 6 | 7 | 8 | 9\r\n }`\r\n ])\r\n }\r\n noDataColor={noDataColor}\r\n scaleType={scale}\r\n height={Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}\r\n showColumnLabels={showColumnLabels}\r\n leftMargin={leftMargin}\r\n rightMargin={rightMargin}\r\n topMargin={topMargin}\r\n bottomMargin={bottomMargin}\r\n selectedColor={selectedColor}\r\n truncateBy={truncateBy}\r\n showRowLabels={showRowLabels}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n showValues={showValues}\r\n suffix={suffix}\r\n prefix={prefix}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n detailsOnClick={detailsOnClick}\r\n styles={styles}\r\n classNames={classNames}\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 precision={precision}\r\n />\r\n ) : null}\r\n </div>\r\n </>\r\n )}\r\n </div>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n}\r\n"],"names":["Graph","props","data","showColumnLabels","leftMargin","rightMargin","truncateBy","width","height","topMargin","bottomMargin","tooltip","onSeriesMouseOver","suffix","prefix","showValues","colorDomain","colors","noDataColor","scaleType","showRowLabels","selectedColor","onSeriesMouseClick","resetSelectionOnDoubleClick","detailsOnClick","styles","classNames","animate","precision","svgRef","useRef","isInView","useInView","margin","mouseClickData","setMouseClickData","useState","mouseOverData","setMouseOverData","eventX","setEventX","eventY","setEventY","graphWidth","graphHeight","columns","uniqBy","d","rows","y","scaleBand","barHeight","x","barWidth","colorScale","scaleOrdinal","scaleThreshold","scaleLinear","jsxs","Fragment","motion","jsx","i","XAxesLabels","YAxesLabels","el","checkIfNullOrUndefined","color","event","isEqual","cn","getTextColorBasedOnBgColor","Tooltip","Modal","string2HTML","HeatMap","graphTitle","sources","graphDescription","footNote","colorLegendTitle","padding","backgroundColor","relativeHeight","graphID","Colors","showColorScale","graphDownload","dataDownload","fillContainer","language","showNAColor","minHeight","theme","ariaLabel","svgWidth","setSvgWidth","svgHeight","setSvgHeight","setSelectedColor","graphDiv","graphParentDiv","useEffect","resizeObserver","entries","scale","GraphHeader","EmptyState","ColorLegendWithMouseOver","ThresholdColorLegendWithMouseOver","LinearColorLegend","GraphFooter"],"mappings":"wiCAyDO,SAASA,GAAMC,EAAc,CAClC,KAAM,CACJ,KAAAC,EACA,iBAAAC,EACA,WAAAC,EACA,YAAAC,EACA,WAAAC,EACA,MAAAC,EACA,OAAAC,EACA,UAAAC,EACA,aAAAC,EACA,QAAAC,EACA,kBAAAC,EACA,OAAAC,EACA,OAAAC,EACA,WAAAC,EACA,YAAAC,EACA,OAAAC,EACA,YAAAC,EACA,UAAAC,EACA,cAAAC,EACA,cAAAC,EACA,mBAAAC,EACA,4BAAAC,EACA,eAAAC,EACA,OAAAC,EACA,WAAAC,EACA,QAAAC,EACA,UAAAC,CAAA,EACE3B,EACE4B,EAASC,EAAAA,OAAO,IAAI,EACpBC,EAAWC,GAAAA,UAAUH,EAAQ,CACjC,KAAMF,EAAQ,KACd,OAAQA,EAAQ,MAAA,CACjB,EACKM,EAAS,CACb,IAAKxB,EACL,OAAQC,EACR,KAAMN,EACN,MAAOC,CAAA,EAGH,CAAC6B,EAAgBC,CAAiB,EAAIC,EAAAA,SAAc,MAAS,EAC7D,CAACC,EAAeC,CAAgB,EAAIF,EAAAA,SAAsC,MAAS,EACnF,CAACG,EAAQC,CAAS,EAAIJ,EAAAA,SAA6B,MAAS,EAC5D,CAACK,EAAQC,CAAS,EAAIN,EAAAA,SAA6B,MAAS,EAC5DO,GAAapC,EAAQ0B,EAAO,KAAOA,EAAO,MAC1CW,GAAcpC,EAASyB,EAAO,IAAMA,EAAO,OAC3CY,EAAUC,GAAAA,OAAO5C,EAAM6C,GAAKA,EAAE,MAAM,EAAE,IAAIA,GAAKA,EAAE,MAAM,EACvDC,EAAOF,GAAAA,OAAO5C,EAAM6C,GAAKA,EAAE,GAAG,EAAE,IAAIA,GAAKA,EAAE,GAAG,EAC9CE,EAAIC,QAAA,EAAY,OAAOF,CAAI,EAAE,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F,GAASwF,GAAYZ,EACxBc,EAAA,EAER,iBAAA9F,EACA,WAAAC,EACA,YAAAC,EACA,UAAAI,EACA,aAAAC,EACA,cAAAW,EACA,WAAAf,EACA,cAAAc,EACA,QAAAT,EACA,kBAAAC,EACA,WAAAG,EACA,OAAAF,EACA,OAAAC,EACA,mBAAAQ,EACA,4BAAAC,GACA,eAAAC,GACA,OAAAC,EACA,WAAAC,EACA,QACEC,IAAY,GACR,CAAE,SAAU,GAAK,KAAM,GAAM,OAAQ,EAAA,EACrCA,GAAW,CAAE,SAAU,EAAG,KAAM,GAAM,OAAQ,CAAA,EAEpD,UAAAC,CAAA,CAAA,EAEA,IAAA,CAAA,CACN,CAAA,CACF,CAAA,CAEJ,EACCiD,GAAWE,EACVlB,EAAAA,kBAAAA,IAACkD,GAAAA,YAAA,CACC,OAAQ,CAAE,SAAUtF,GAAQ,SAAU,OAAQA,GAAQ,MAAA,EACtD,WAAY,CACV,SAAUC,GAAY,SACtB,OAAQA,GAAY,MAAA,EAEtB,QAAAmD,EACA,SAAAE,EACA,MAAAxE,CAAA,CAAA,EAEA,IAAA,CAAA,CACN,CAAA,CAAA,CACF,CAAA,CACF,CAAA,CAGN"}
package/dist/HeatMap.js CHANGED
@@ -8,10 +8,10 @@ import { T as pe } from "./Tooltip-DyM5snqx.js";
8
8
  import { g as fe } from "./getTextColorBasedOnBgColor-B6Nk2WBf.js";
9
9
  import { c as re } from "./checkIfNullOrUndefined-DmfiKkNw.js";
10
10
  import { s as xe } from "./string2HTML-CWHGfz_d.js";
11
- import { X as ye } from "./XAxesLabels-CaV2q-6H.js";
12
- import { Y as ve } from "./YAxesLabels-CPGZjmZJ.js";
11
+ import { X as we } from "./XAxesLabels-CaV2q-6H.js";
12
+ import { Y as ye } from "./YAxesLabels-CPGZjmZJ.js";
13
13
  import { b as ce } from "./band-BEjh2CHI.js";
14
- import { o as we } from "./ordinal-w9Lu4Stb.js";
14
+ import { o as ve } from "./ordinal-w9Lu4Stb.js";
15
15
  import { t as Ce } from "./threshold-DFfqcDMa.js";
16
16
  import { a as be } from "./linear-DUdu7l2G.js";
17
17
  import { u as je } from "./use-in-view-yS6jzJAp.js";
@@ -47,20 +47,20 @@ function Le(z) {
47
47
  selectedColor: G,
48
48
  onSeriesMouseClick: A,
49
49
  resetSelectionOnDoubleClick: Q,
50
- detailsOnClick: v,
50
+ detailsOnClick: y,
51
51
  styles: T,
52
52
  classNames: x,
53
- animate: w,
53
+ animate: v,
54
54
  precision: Z
55
55
  } = z, E = ae(null), H = je(E, {
56
- once: w.once,
57
- amount: w.amount
56
+ once: v.once,
57
+ amount: v.amount
58
58
  }), s = {
59
59
  top: _,
60
60
  bottom: U,
61
61
  left: S,
62
62
  right: B
63
- }, [C, V] = O(void 0), [m, N] = O(void 0), [R, b] = O(void 0), [o, X] = O(void 0), ee = I - s.left - s.right, te = W - s.top - s.bottom, u = ne(d, (e) => e.column).map((e) => e.column), h = ne(d, (e) => e.row).map((e) => e.row), j = ce().domain(h).range([0, te]), D = j.bandwidth(), n = ce().domain(u).range([0, ee]), $ = n.bandwidth(), P = F === "categorical" ? we().domain(M).range(q) : F === "threshold" ? Ce().domain(M).range(q) : be().domain(M).range(q);
63
+ }, [C, V] = O(void 0), [n, N] = O(void 0), [R, b] = O(void 0), [o, X] = O(void 0), ee = I - s.left - s.right, te = W - s.top - s.bottom, u = ne(d, (e) => e.column).map((e) => e.column), h = ne(d, (e) => e.row).map((e) => e.row), j = ce().domain(h).range([0, te]), D = j.bandwidth(), c = ce().domain(u).range([0, ee]), $ = c.bandwidth(), P = F === "categorical" ? ve().domain(M).range(q) : F === "threshold" ? Ce().domain(M).range(q) : be().domain(M).range(q);
64
64
  return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
65
65
  /* @__PURE__ */ t.jsxs(
66
66
  ie.svg,
@@ -72,11 +72,11 @@ function Le(z) {
72
72
  direction: "ltr",
73
73
  ref: E,
74
74
  children: [
75
- /* @__PURE__ */ t.jsx("g", { transform: `translate(${s.left},0)`, children: L ? u.map((e, y) => /* @__PURE__ */ t.jsx(
76
- ye,
75
+ /* @__PURE__ */ t.jsx("g", { transform: `translate(${s.left},0)`, children: L ? u.map((e, w) => /* @__PURE__ */ t.jsx(
76
+ we,
77
77
  {
78
78
  y: 0,
79
- x: n(e),
79
+ x: c(e),
80
80
  width: $,
81
81
  height: s.top - 5,
82
82
  value: `${e}`.length < p ? `${e}` : `${`${e}`.substring(0, p)}...`,
@@ -86,10 +86,10 @@ function Le(z) {
86
86
  animate: { duration: 0, once: !0, amount: 0 },
87
87
  isInView: H
88
88
  },
89
- y
89
+ w
90
90
  )) : null }),
91
- /* @__PURE__ */ t.jsx("g", { transform: `translate(0,${s.top})`, children: K ? h.map((e, y) => /* @__PURE__ */ t.jsx(
92
- ve,
91
+ /* @__PURE__ */ t.jsx("g", { transform: `translate(0,${s.top})`, children: K ? h.map((e, w) => /* @__PURE__ */ t.jsx(
92
+ ye,
93
93
  {
94
94
  value: `${e}`.length < p ? `${e}` : `${`${e}`.substring(0, p)}...`,
95
95
  y: j(e),
@@ -102,13 +102,13 @@ function Le(z) {
102
102
  animate: { duration: 0, once: !0, amount: 0 },
103
103
  isInView: H
104
104
  },
105
- y
105
+ w
106
106
  )) : null }),
107
107
  /* @__PURE__ */ t.jsxs("g", { transform: `translate(${s.left},${s.top})`, children: [
108
- h.map((e, y) => /* @__PURE__ */ t.jsx("g", { transform: `translate(0,${j(e)})`, children: u.map((g) => /* @__PURE__ */ t.jsx(
108
+ h.map((e, w) => /* @__PURE__ */ t.jsx("g", { transform: `translate(0,${j(e)})`, children: u.map((g) => /* @__PURE__ */ t.jsx(
109
109
  "rect",
110
110
  {
111
- x: n(g),
111
+ x: c(g),
112
112
  y: 0,
113
113
  width: $,
114
114
  height: D,
@@ -116,8 +116,8 @@ function Le(z) {
116
116
  className: "stroke-1 stroke-primary-white dark:stroke-primary-gray-700"
117
117
  },
118
118
  `${e}-${g}`
119
- )) }, y)),
120
- d.filter((e) => !re(e.value)).map((e, y) => {
119
+ )) }, w)),
120
+ d.filter((e) => !re(e.value)).map((e, w) => {
121
121
  const g = re(e.value) ? f : (
122
122
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
123
123
  P(e.value)
@@ -125,15 +125,15 @@ function Le(z) {
125
125
  return /* @__PURE__ */ t.jsxs(
126
126
  "g",
127
127
  {
128
- transform: `translate(${n(e.column)},${j(e.row)})`,
129
- onMouseEnter: (c) => {
130
- N(e), X(c.clientY), b(c.clientX), r?.(e);
128
+ transform: `translate(${c(e.column)},${j(e.row)})`,
129
+ onMouseEnter: (m) => {
130
+ N(e), X(m.clientY), b(m.clientX), r?.(e);
131
131
  },
132
132
  onClick: () => {
133
- (A || v) && (he(C, e) && Q ? (V(void 0), A?.(void 0)) : (V(e), A?.(e)));
133
+ (A || y) && (he(C, e) && Q ? (V(void 0), A?.(void 0)) : (V(e), A?.(e)));
134
134
  },
135
- onMouseMove: (c) => {
136
- N(e), X(c.clientY), b(c.clientX);
135
+ onMouseMove: (m) => {
136
+ N(e), X(m.clientY), b(m.clientX);
137
137
  },
138
138
  onMouseLeave: () => {
139
139
  N(void 0), b(void 0), X(void 0), r?.(void 0);
@@ -148,13 +148,13 @@ function Le(z) {
148
148
  width: $,
149
149
  height: D,
150
150
  className: "stroke-1 stroke-primary-white dark:stroke-primary-gray-700",
151
- exit: { opacity: 0, transition: { duration: w.duration } },
151
+ exit: { opacity: 0, transition: { duration: v.duration } },
152
152
  variants: {
153
153
  initial: { fill: g, opacity: 0 },
154
154
  whileInView: {
155
155
  fill: g,
156
156
  opacity: 1,
157
- transition: { duration: w.duration }
157
+ transition: { duration: v.duration }
158
158
  }
159
159
  },
160
160
  initial: "initial",
@@ -166,11 +166,11 @@ function Le(z) {
166
166
  {
167
167
  variants: {
168
168
  initial: { opacity: 0 },
169
- whileInView: { opacity: 1, transition: { duration: w.duration } }
169
+ whileInView: { opacity: 1, transition: { duration: v.duration } }
170
170
  },
171
171
  initial: "initial",
172
172
  animate: H ? "whileInView" : "initial",
173
- exit: { opacity: 0, transition: { duration: w.duration } },
173
+ exit: { opacity: 0, transition: { duration: v.duration } },
174
174
  children: /* @__PURE__ */ t.jsx("foreignObject", { y: 0, x: 0, width: $, height: D, children: /* @__PURE__ */ t.jsx("div", { className: "flex flex-col justify-center items-center h-inherit p-1", children: /* @__PURE__ */ t.jsx(
175
175
  "p",
176
176
  {
@@ -184,7 +184,7 @@ function Le(z) {
184
184
  },
185
185
  children: de(e.value, "NA", Z, i, J)
186
186
  }
187
- ) }) }, y)
187
+ ) }) }, w)
188
188
  }
189
189
  ) : null
190
190
  ]
@@ -192,11 +192,11 @@ function Le(z) {
192
192
  `${e.column}-${e.row}`
193
193
  );
194
194
  }),
195
- m ? /* @__PURE__ */ t.jsx(
195
+ n ? /* @__PURE__ */ t.jsx(
196
196
  "rect",
197
197
  {
198
- x: n(m.column),
199
- y: j(m.row),
198
+ x: c(n.column),
199
+ y: j(n.row),
200
200
  width: $,
201
201
  height: D,
202
202
  style: {
@@ -211,10 +211,10 @@ function Le(z) {
211
211
  ]
212
212
  }
213
213
  ),
214
- m && k && R && o ? /* @__PURE__ */ t.jsx(
214
+ n && k && R && o ? /* @__PURE__ */ t.jsx(
215
215
  pe,
216
216
  {
217
- data: m,
217
+ data: n,
218
218
  body: k,
219
219
  xPos: R,
220
220
  yPos: o,
@@ -222,7 +222,7 @@ function Le(z) {
222
222
  className: x?.tooltip
223
223
  }
224
224
  ) : null,
225
- v && C !== void 0 ? /* @__PURE__ */ t.jsx(
225
+ y && C !== void 0 ? /* @__PURE__ */ t.jsx(
226
226
  ge,
227
227
  {
228
228
  open: C !== void 0,
@@ -233,8 +233,8 @@ function Le(z) {
233
233
  "div",
234
234
  {
235
235
  className: "graph-modal-content m-0",
236
- dangerouslySetInnerHTML: typeof v == "string" ? { __html: xe(v, C) } : void 0,
237
- children: typeof v == "function" ? v(C) : null
236
+ dangerouslySetInnerHTML: typeof y == "string" ? { __html: xe(y, C) } : void 0,
237
+ children: typeof y == "function" ? y(C) : null
238
238
  }
239
239
  )
240
240
  }
@@ -265,17 +265,17 @@ function ot(z) {
265
265
  tooltip: G,
266
266
  onSeriesMouseOver: A,
267
267
  suffix: Q = "",
268
- prefix: v = "",
268
+ prefix: y = "",
269
269
  showRowLabels: T = !0,
270
270
  relativeHeight: x,
271
- showValues: w,
271
+ showValues: v,
272
272
  graphID: Z,
273
273
  noDataColor: E = a.gray,
274
274
  showColorScale: H = !0,
275
275
  onSeriesMouseClick: s,
276
276
  graphDownload: C = !1,
277
277
  dataDownload: V = !1,
278
- fillContainer: m = !0,
278
+ fillContainer: n = !0,
279
279
  language: N = "en",
280
280
  showNAColor: R = !0,
281
281
  minHeight: b = 0,
@@ -287,24 +287,25 @@ function ot(z) {
287
287
  classNames: h,
288
288
  animate: j = !1,
289
289
  precision: D = 2
290
- } = z, [n, $] = O(0), [P, e] = O(0), [y, g] = O(void 0), c = ae(null), le = ae(null);
290
+ } = z, [c, $] = O(0), [P, e] = O(0), [w, g] = O(void 0), m = ae(null), le = ae(null);
291
291
  ue(() => {
292
292
  const l = new ResizeObserver((se) => {
293
293
  $(r || se[0].target.clientWidth || 620), e(k || se[0].target.clientHeight || 480);
294
294
  });
295
- return c.current && (e(c.current.clientHeight || 480), $(c.current.clientWidth || 620), r || l.observe(c.current)), () => l.disconnect();
295
+ return m.current && (e(m.current.clientHeight || 480), $(m.current.clientWidth || 620), r || l.observe(m.current)), () => l.disconnect();
296
296
  }, [r, k]);
297
297
  const oe = J || (typeof i[0] == "string" ? "categorical" : i.length === 2 ? "linear" : "threshold");
298
298
  return /* @__PURE__ */ t.jsx(
299
299
  "div",
300
300
  {
301
- className: `${o || "light"} flex ${r ? "grow-0" : "grow"} ${m ? "w-full" : "w-fit"}`,
301
+ className: `${o || "light"} flex ${r ? "grow-0" : "grow"} ${n ? "w-full" : "w-fit"}`,
302
302
  dir: N === "he" || N === "ar" ? "rtl" : void 0,
303
303
  children: /* @__PURE__ */ t.jsx(
304
304
  "div",
305
305
  {
306
306
  className: me(
307
307
  `${f ? f === !0 ? "bg-primary-gray-200 dark:bg-primary-gray-650 " : "" : "bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${N || "en"}`,
308
+ n ? "w-full" : "w-fit",
308
309
  h?.graphContainer
309
310
  ),
310
311
  style: {
@@ -342,7 +343,7 @@ function ot(z) {
342
343
  H ? oe === "categorical" ? /* @__PURE__ */ t.jsx(
343
344
  Me,
344
345
  {
345
- width: m ? void 0 : r,
346
+ width: n ? void 0 : r,
346
347
  colorLegendTitle: M,
347
348
  colors: S || (typeof i[0] == "string" ? a[o].categoricalColors.colors : i.length === 2 ? [
348
349
  a[o].sequentialColors.neutralColorsx09[0],
@@ -355,7 +356,7 @@ function ot(z) {
355
356
  ) : oe === "threshold" ? /* @__PURE__ */ t.jsx(
356
357
  De,
357
358
  {
358
- width: m ? void 0 : r,
359
+ width: n ? void 0 : r,
359
360
  colorLegendTitle: M,
360
361
  colors: S || (typeof i[0] == "string" ? a[o].categoricalColors.colors : i.length === 2 ? [
361
362
  a[o].sequentialColors.neutralColorsx09[0],
@@ -369,7 +370,7 @@ function ot(z) {
369
370
  ) : /* @__PURE__ */ t.jsx(
370
371
  Ne,
371
372
  {
372
- width: m ? void 0 : r,
373
+ width: n ? void 0 : r,
373
374
  colorLegendTitle: M,
374
375
  colors: S || [
375
376
  a[o].sequentialColors.neutralColorsx09[0],
@@ -382,14 +383,14 @@ function ot(z) {
382
383
  "div",
383
384
  {
384
385
  className: "flex grow flex-col justify-center w-full leading-0",
385
- ref: c,
386
+ ref: m,
386
387
  "aria-label": "Graph area",
387
- children: (r || n) && (k || P) ? /* @__PURE__ */ t.jsx(
388
+ children: (r || c) && (k || P) ? /* @__PURE__ */ t.jsx(
388
389
  Le,
389
390
  {
390
391
  data: d,
391
392
  colorDomain: i,
392
- width: r || n,
393
+ width: r || c,
393
394
  colors: S || (typeof i[0] == "string" ? a[o].categoricalColors.colors : i.length === 2 ? [
394
395
  a[o].sequentialColors.neutralColorsx09[0],
395
396
  a[o].sequentialColors.neutralColorsx09[8]
@@ -398,21 +399,21 @@ function ot(z) {
398
399
  scaleType: oe,
399
400
  height: Math.max(
400
401
  b,
401
- k || (x ? b ? (r || n) * x > b ? (r || n) * x : b : (r || n) * x : P)
402
+ k || (x ? b ? (r || c) * x > b ? (r || c) * x : b : (r || c) * x : P)
402
403
  ),
403
404
  showColumnLabels: I,
404
405
  leftMargin: W,
405
406
  rightMargin: _,
406
407
  topMargin: F,
407
408
  bottomMargin: K,
408
- selectedColor: y,
409
+ selectedColor: w,
409
410
  truncateBy: U,
410
411
  showRowLabels: T,
411
412
  tooltip: G,
412
413
  onSeriesMouseOver: A,
413
- showValues: w,
414
+ showValues: v,
414
415
  suffix: Q,
415
- prefix: v,
416
+ prefix: y,
416
417
  onSeriesMouseClick: s,
417
418
  resetSelectionOnDoubleClick: ee,
418
419
  detailsOnClick: te,