@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":"TreeMapGraph.js","sources":["../node_modules/d3-hierarchy/src/hierarchy/count.js","../node_modules/d3-hierarchy/src/hierarchy/each.js","../node_modules/d3-hierarchy/src/hierarchy/eachBefore.js","../node_modules/d3-hierarchy/src/hierarchy/eachAfter.js","../node_modules/d3-hierarchy/src/hierarchy/find.js","../node_modules/d3-hierarchy/src/hierarchy/sum.js","../node_modules/d3-hierarchy/src/hierarchy/sort.js","../node_modules/d3-hierarchy/src/hierarchy/path.js","../node_modules/d3-hierarchy/src/hierarchy/ancestors.js","../node_modules/d3-hierarchy/src/hierarchy/descendants.js","../node_modules/d3-hierarchy/src/hierarchy/leaves.js","../node_modules/d3-hierarchy/src/hierarchy/links.js","../node_modules/d3-hierarchy/src/hierarchy/iterator.js","../node_modules/d3-hierarchy/src/hierarchy/index.js","../node_modules/d3-hierarchy/src/accessors.js","../node_modules/d3-hierarchy/src/constant.js","../node_modules/d3-hierarchy/src/treemap/round.js","../node_modules/d3-hierarchy/src/treemap/dice.js","../node_modules/d3-hierarchy/src/stratify.js","../node_modules/d3-hierarchy/src/treemap/slice.js","../node_modules/d3-hierarchy/src/treemap/squarify.js","../node_modules/d3-hierarchy/src/treemap/index.js","../src/Components/Graphs/TreeMapGraph/Graph.tsx","../src/Components/Graphs/TreeMapGraph/index.tsx"],"sourcesContent":["function count(node) {\n var sum = 0,\n children = node.children,\n i = children && children.length;\n if (!i) sum = 1;\n else while (--i >= 0) sum += children[i].value;\n node.value = sum;\n}\n\nexport default function() {\n return this.eachAfter(count);\n}\n","export default function(callback, that) {\n let index = -1;\n for (const node of this) {\n callback.call(that, node, ++index, this);\n }\n return this;\n}\n","export default function(callback, that) {\n var node = this, nodes = [node], children, i, index = -1;\n while (node = nodes.pop()) {\n callback.call(that, node, ++index, this);\n if (children = node.children) {\n for (i = children.length - 1; i >= 0; --i) {\n nodes.push(children[i]);\n }\n }\n }\n return this;\n}\n","export default function(callback, that) {\n var node = this, nodes = [node], next = [], children, i, n, index = -1;\n while (node = nodes.pop()) {\n next.push(node);\n if (children = node.children) {\n for (i = 0, n = children.length; i < n; ++i) {\n nodes.push(children[i]);\n }\n }\n }\n while (node = next.pop()) {\n callback.call(that, node, ++index, this);\n }\n return this;\n}\n","export default function(callback, that) {\n let index = -1;\n for (const node of this) {\n if (callback.call(that, node, ++index, this)) {\n return node;\n }\n }\n}\n","export default function(value) {\n return this.eachAfter(function(node) {\n var sum = +value(node.data) || 0,\n children = node.children,\n i = children && children.length;\n while (--i >= 0) sum += children[i].value;\n node.value = sum;\n });\n}\n","export default function(compare) {\n return this.eachBefore(function(node) {\n if (node.children) {\n node.children.sort(compare);\n }\n });\n}\n","export default function(end) {\n var start = this,\n ancestor = leastCommonAncestor(start, end),\n nodes = [start];\n while (start !== ancestor) {\n start = start.parent;\n nodes.push(start);\n }\n var k = nodes.length;\n while (end !== ancestor) {\n nodes.splice(k, 0, end);\n end = end.parent;\n }\n return nodes;\n}\n\nfunction leastCommonAncestor(a, b) {\n if (a === b) return a;\n var aNodes = a.ancestors(),\n bNodes = b.ancestors(),\n c = null;\n a = aNodes.pop();\n b = bNodes.pop();\n while (a === b) {\n c = a;\n a = aNodes.pop();\n b = bNodes.pop();\n }\n return c;\n}\n","export default function() {\n var node = this, nodes = [node];\n while (node = node.parent) {\n nodes.push(node);\n }\n return nodes;\n}\n","export default function() {\n return Array.from(this);\n}\n","export default function() {\n var leaves = [];\n this.eachBefore(function(node) {\n if (!node.children) {\n leaves.push(node);\n }\n });\n return leaves;\n}\n","export default function() {\n var root = this, links = [];\n root.each(function(node) {\n if (node !== root) { // Don’t include the root’s parent, if any.\n links.push({source: node.parent, target: node});\n }\n });\n return links;\n}\n","export default function*() {\n var node = this, current, next = [node], children, i, n;\n do {\n current = next.reverse(), next = [];\n while (node = current.pop()) {\n yield node;\n if (children = node.children) {\n for (i = 0, n = children.length; i < n; ++i) {\n next.push(children[i]);\n }\n }\n }\n } while (next.length);\n}\n","import node_count from \"./count.js\";\nimport node_each from \"./each.js\";\nimport node_eachBefore from \"./eachBefore.js\";\nimport node_eachAfter from \"./eachAfter.js\";\nimport node_find from \"./find.js\";\nimport node_sum from \"./sum.js\";\nimport node_sort from \"./sort.js\";\nimport node_path from \"./path.js\";\nimport node_ancestors from \"./ancestors.js\";\nimport node_descendants from \"./descendants.js\";\nimport node_leaves from \"./leaves.js\";\nimport node_links from \"./links.js\";\nimport node_iterator from \"./iterator.js\";\n\nexport default function hierarchy(data, children) {\n if (data instanceof Map) {\n data = [undefined, data];\n if (children === undefined) children = mapChildren;\n } else if (children === undefined) {\n children = objectChildren;\n }\n\n var root = new Node(data),\n node,\n nodes = [root],\n child,\n childs,\n i,\n n;\n\n while (node = nodes.pop()) {\n if ((childs = children(node.data)) && (n = (childs = Array.from(childs)).length)) {\n node.children = childs;\n for (i = n - 1; i >= 0; --i) {\n nodes.push(child = childs[i] = new Node(childs[i]));\n child.parent = node;\n child.depth = node.depth + 1;\n }\n }\n }\n\n return root.eachBefore(computeHeight);\n}\n\nfunction node_copy() {\n return hierarchy(this).eachBefore(copyData);\n}\n\nfunction objectChildren(d) {\n return d.children;\n}\n\nfunction mapChildren(d) {\n return Array.isArray(d) ? d[1] : null;\n}\n\nfunction copyData(node) {\n if (node.data.value !== undefined) node.value = node.data.value;\n node.data = node.data.data;\n}\n\nexport function computeHeight(node) {\n var height = 0;\n do node.height = height;\n while ((node = node.parent) && (node.height < ++height));\n}\n\nexport function Node(data) {\n this.data = data;\n this.depth =\n this.height = 0;\n this.parent = null;\n}\n\nNode.prototype = hierarchy.prototype = {\n constructor: Node,\n count: node_count,\n each: node_each,\n eachAfter: node_eachAfter,\n eachBefore: node_eachBefore,\n find: node_find,\n sum: node_sum,\n sort: node_sort,\n path: node_path,\n ancestors: node_ancestors,\n descendants: node_descendants,\n leaves: node_leaves,\n links: node_links,\n copy: node_copy,\n [Symbol.iterator]: node_iterator\n};\n","export function optional(f) {\n return f == null ? null : required(f);\n}\n\nexport function required(f) {\n if (typeof f !== \"function\") throw new Error;\n return f;\n}\n","export function constantZero() {\n return 0;\n}\n\nexport default function(x) {\n return function() {\n return x;\n };\n}\n","export default function(node) {\n node.x0 = Math.round(node.x0);\n node.y0 = Math.round(node.y0);\n node.x1 = Math.round(node.x1);\n node.y1 = Math.round(node.y1);\n}\n","export default function(parent, x0, y0, x1, y1) {\n var nodes = parent.children,\n node,\n i = -1,\n n = nodes.length,\n k = parent.value && (x1 - x0) / parent.value;\n\n while (++i < n) {\n node = nodes[i], node.y0 = y0, node.y1 = y1;\n node.x0 = x0, node.x1 = x0 += node.value * k;\n }\n}\n","import {optional} from \"./accessors.js\";\nimport {Node, computeHeight} from \"./hierarchy/index.js\";\n\nvar preroot = {depth: -1},\n ambiguous = {},\n imputed = {};\n\nfunction defaultId(d) {\n return d.id;\n}\n\nfunction defaultParentId(d) {\n return d.parentId;\n}\n\nexport default function() {\n var id = defaultId,\n parentId = defaultParentId,\n path;\n\n function stratify(data) {\n var nodes = Array.from(data),\n currentId = id,\n currentParentId = parentId,\n n,\n d,\n i,\n root,\n parent,\n node,\n nodeId,\n nodeKey,\n nodeByKey = new Map;\n\n if (path != null) {\n const I = nodes.map((d, i) => normalize(path(d, i, data)));\n const P = I.map(parentof);\n const S = new Set(I).add(\"\");\n for (const i of P) {\n if (!S.has(i)) {\n S.add(i);\n I.push(i);\n P.push(parentof(i));\n nodes.push(imputed);\n }\n }\n currentId = (_, i) => I[i];\n currentParentId = (_, i) => P[i];\n }\n\n for (i = 0, n = nodes.length; i < n; ++i) {\n d = nodes[i], node = nodes[i] = new Node(d);\n if ((nodeId = currentId(d, i, data)) != null && (nodeId += \"\")) {\n nodeKey = node.id = nodeId;\n nodeByKey.set(nodeKey, nodeByKey.has(nodeKey) ? ambiguous : node);\n }\n if ((nodeId = currentParentId(d, i, data)) != null && (nodeId += \"\")) {\n node.parent = nodeId;\n }\n }\n\n for (i = 0; i < n; ++i) {\n node = nodes[i];\n if (nodeId = node.parent) {\n parent = nodeByKey.get(nodeId);\n if (!parent) throw new Error(\"missing: \" + nodeId);\n if (parent === ambiguous) throw new Error(\"ambiguous: \" + nodeId);\n if (parent.children) parent.children.push(node);\n else parent.children = [node];\n node.parent = parent;\n } else {\n if (root) throw new Error(\"multiple roots\");\n root = node;\n }\n }\n\n if (!root) throw new Error(\"no root\");\n\n // When imputing internal nodes, only introduce roots if needed.\n // Then replace the imputed marker data with null.\n if (path != null) {\n while (root.data === imputed && root.children.length === 1) {\n root = root.children[0], --n;\n }\n for (let i = nodes.length - 1; i >= 0; --i) {\n node = nodes[i];\n if (node.data !== imputed) break;\n node.data = null;\n }\n }\n\n root.parent = preroot;\n root.eachBefore(function(node) { node.depth = node.parent.depth + 1; --n; }).eachBefore(computeHeight);\n root.parent = null;\n if (n > 0) throw new Error(\"cycle\");\n\n return root;\n }\n\n stratify.id = function(x) {\n return arguments.length ? (id = optional(x), stratify) : id;\n };\n\n stratify.parentId = function(x) {\n return arguments.length ? (parentId = optional(x), stratify) : parentId;\n };\n\n stratify.path = function(x) {\n return arguments.length ? (path = optional(x), stratify) : path;\n };\n\n return stratify;\n}\n\n// To normalize a path, we coerce to a string, strip the trailing slash if any\n// (as long as the trailing slash is not immediately preceded by another slash),\n// and add leading slash if missing.\nfunction normalize(path) {\n path = `${path}`;\n let i = path.length;\n if (slash(path, i - 1) && !slash(path, i - 2)) path = path.slice(0, -1);\n return path[0] === \"/\" ? path : `/${path}`;\n}\n\n// Walk backwards to find the first slash that is not the leading slash, e.g.:\n// \"/foo/bar\" ⇥ \"/foo\", \"/foo\" ⇥ \"/\", \"/\" ↦ \"\". (The root is special-cased\n// because the id of the root must be a truthy value.)\nfunction parentof(path) {\n let i = path.length;\n if (i < 2) return \"\";\n while (--i > 1) if (slash(path, i)) break;\n return path.slice(0, i);\n}\n\n// Slashes can be escaped; to determine whether a slash is a path delimiter, we\n// count the number of preceding backslashes escaping the forward slash: an odd\n// number indicates an escaped forward slash.\nfunction slash(path, i) {\n if (path[i] === \"/\") {\n let k = 0;\n while (i > 0 && path[--i] === \"\\\\\") ++k;\n if ((k & 1) === 0) return true;\n }\n return false;\n}\n","export default function(parent, x0, y0, x1, y1) {\n var nodes = parent.children,\n node,\n i = -1,\n n = nodes.length,\n k = parent.value && (y1 - y0) / parent.value;\n\n while (++i < n) {\n node = nodes[i], node.x0 = x0, node.x1 = x1;\n node.y0 = y0, node.y1 = y0 += node.value * k;\n }\n}\n","import treemapDice from \"./dice.js\";\nimport treemapSlice from \"./slice.js\";\n\nexport var phi = (1 + Math.sqrt(5)) / 2;\n\nexport function squarifyRatio(ratio, parent, x0, y0, x1, y1) {\n var rows = [],\n nodes = parent.children,\n row,\n nodeValue,\n i0 = 0,\n i1 = 0,\n n = nodes.length,\n dx, dy,\n value = parent.value,\n sumValue,\n minValue,\n maxValue,\n newRatio,\n minRatio,\n alpha,\n beta;\n\n while (i0 < n) {\n dx = x1 - x0, dy = y1 - y0;\n\n // Find the next non-empty node.\n do sumValue = nodes[i1++].value; while (!sumValue && i1 < n);\n minValue = maxValue = sumValue;\n alpha = Math.max(dy / dx, dx / dy) / (value * ratio);\n beta = sumValue * sumValue * alpha;\n minRatio = Math.max(maxValue / beta, beta / minValue);\n\n // Keep adding nodes while the aspect ratio maintains or improves.\n for (; i1 < n; ++i1) {\n sumValue += nodeValue = nodes[i1].value;\n if (nodeValue < minValue) minValue = nodeValue;\n if (nodeValue > maxValue) maxValue = nodeValue;\n beta = sumValue * sumValue * alpha;\n newRatio = Math.max(maxValue / beta, beta / minValue);\n if (newRatio > minRatio) { sumValue -= nodeValue; break; }\n minRatio = newRatio;\n }\n\n // Position and record the row orientation.\n rows.push(row = {value: sumValue, dice: dx < dy, children: nodes.slice(i0, i1)});\n if (row.dice) treemapDice(row, x0, y0, x1, value ? y0 += dy * sumValue / value : y1);\n else treemapSlice(row, x0, y0, value ? x0 += dx * sumValue / value : x1, y1);\n value -= sumValue, i0 = i1;\n }\n\n return rows;\n}\n\nexport default (function custom(ratio) {\n\n function squarify(parent, x0, y0, x1, y1) {\n squarifyRatio(ratio, parent, x0, y0, x1, y1);\n }\n\n squarify.ratio = function(x) {\n return custom((x = +x) > 1 ? x : 1);\n };\n\n return squarify;\n})(phi);\n","import roundNode from \"./round.js\";\nimport squarify from \"./squarify.js\";\nimport {required} from \"../accessors.js\";\nimport constant, {constantZero} from \"../constant.js\";\n\nexport default function() {\n var tile = squarify,\n round = false,\n dx = 1,\n dy = 1,\n paddingStack = [0],\n paddingInner = constantZero,\n paddingTop = constantZero,\n paddingRight = constantZero,\n paddingBottom = constantZero,\n paddingLeft = constantZero;\n\n function treemap(root) {\n root.x0 =\n root.y0 = 0;\n root.x1 = dx;\n root.y1 = dy;\n root.eachBefore(positionNode);\n paddingStack = [0];\n if (round) root.eachBefore(roundNode);\n return root;\n }\n\n function positionNode(node) {\n var p = paddingStack[node.depth],\n x0 = node.x0 + p,\n y0 = node.y0 + p,\n x1 = node.x1 - p,\n y1 = node.y1 - p;\n if (x1 < x0) x0 = x1 = (x0 + x1) / 2;\n if (y1 < y0) y0 = y1 = (y0 + y1) / 2;\n node.x0 = x0;\n node.y0 = y0;\n node.x1 = x1;\n node.y1 = y1;\n if (node.children) {\n p = paddingStack[node.depth + 1] = paddingInner(node) / 2;\n x0 += paddingLeft(node) - p;\n y0 += paddingTop(node) - p;\n x1 -= paddingRight(node) - p;\n y1 -= paddingBottom(node) - p;\n if (x1 < x0) x0 = x1 = (x0 + x1) / 2;\n if (y1 < y0) y0 = y1 = (y0 + y1) / 2;\n tile(node, x0, y0, x1, y1);\n }\n }\n\n treemap.round = function(x) {\n return arguments.length ? (round = !!x, treemap) : round;\n };\n\n treemap.size = function(x) {\n return arguments.length ? (dx = +x[0], dy = +x[1], treemap) : [dx, dy];\n };\n\n treemap.tile = function(x) {\n return arguments.length ? (tile = required(x), treemap) : tile;\n };\n\n treemap.padding = function(x) {\n return arguments.length ? treemap.paddingInner(x).paddingOuter(x) : treemap.paddingInner();\n };\n\n treemap.paddingInner = function(x) {\n return arguments.length ? (paddingInner = typeof x === \"function\" ? x : constant(+x), treemap) : paddingInner;\n };\n\n treemap.paddingOuter = function(x) {\n return arguments.length ? treemap.paddingTop(x).paddingRight(x).paddingBottom(x).paddingLeft(x) : treemap.paddingTop();\n };\n\n treemap.paddingTop = function(x) {\n return arguments.length ? (paddingTop = typeof x === \"function\" ? x : constant(+x), treemap) : paddingTop;\n };\n\n treemap.paddingRight = function(x) {\n return arguments.length ? (paddingRight = typeof x === \"function\" ? x : constant(+x), treemap) : paddingRight;\n };\n\n treemap.paddingBottom = function(x) {\n return arguments.length ? (paddingBottom = typeof x === \"function\" ? x : constant(+x), treemap) : paddingBottom;\n };\n\n treemap.paddingLeft = function(x) {\n return arguments.length ? (paddingLeft = typeof x === \"function\" ? x : constant(+x), treemap) : paddingLeft;\n };\n\n return treemap;\n}\n","import { stratify, treemap } from 'd3-hierarchy';\r\nimport { useRef, useState } from 'react';\r\nimport { P } from '@undp/design-system-react/Typography';\r\nimport { AnimatePresence, motion, useInView } from 'motion/react';\r\nimport { Modal } from '@undp/design-system-react/Modal';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport { AnimateDataType, ClassNameObject, Languages, StyleObject, TreeMapDataType } from '@/Types';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { getTextColorBasedOnBgColor } from '@/Utils/getTextColorBasedOnBgColor';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { string2HTML } from '@/Utils/string2HTML';\r\n\r\ninterface Props {\r\n data: TreeMapDataType[];\r\n colors: string[];\r\n colorDomain: string[];\r\n leftMargin: number;\r\n rightMargin: number;\r\n topMargin: number;\r\n bottomMargin: number;\r\n showLabels: boolean;\r\n showValues: boolean;\r\n width: number;\r\n height: number;\r\n suffix: string;\r\n prefix: string;\r\n selectedColor?: string;\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 // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n highlightedDataPoints: (string | number)[];\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 language?: Languages;\r\n animate: AnimateDataType;\r\n dimmedOpacity: number;\r\n precision: number;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n colors,\r\n leftMargin,\r\n width,\r\n height,\r\n colorDomain,\r\n rightMargin,\r\n topMargin,\r\n bottomMargin,\r\n showLabels,\r\n tooltip,\r\n onSeriesMouseOver,\r\n selectedColor,\r\n showValues,\r\n suffix,\r\n prefix,\r\n highlightedDataPoints,\r\n onSeriesMouseClick,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n language,\r\n styles,\r\n classNames,\r\n animate,\r\n dimmedOpacity,\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 // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\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 const margin = {\r\n top: topMargin,\r\n bottom: bottomMargin,\r\n left: leftMargin,\r\n right: rightMargin,\r\n };\r\n const graphWidth = width - margin.left - margin.right;\r\n const graphHeight = height - margin.top - margin.bottom;\r\n\r\n const treeMapData = [\r\n {\r\n id: 'root',\r\n parent: undefined,\r\n value: undefined,\r\n data: undefined,\r\n },\r\n ...data.map((d: TreeMapDataType) => ({\r\n id: d.label,\r\n value: d.size,\r\n parent: 'root',\r\n data: d,\r\n })),\r\n ];\r\n const treeData = stratify()\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n .id((d: any) => d.id)\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n .parentId((d: any) => d.parent)(treeMapData);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n treeData.sum((d: any) => d.value);\r\n const treeMapVizData = treemap().size([graphWidth, graphHeight]).padding(2)(treeData);\r\n\r\n return (\r\n <>\r\n <motion.svg\r\n width={`${width}px`}\r\n height={`${height}px`}\r\n viewBox={`0 0 ${width} ${height}`}\r\n direction='ltr'\r\n ref={svgRef}\r\n >\r\n <g transform={`translate(${margin.left},${margin.top})`}>\r\n <AnimatePresence>\r\n {treeMapVizData.children?.map(d => {\r\n return (\r\n <motion.g\r\n className='undp-viz-g-with-hover'\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n key={(d.data as any).id}\r\n variants={{\r\n initial: {\r\n opacity: 0,\r\n x: d.x0,\r\n y: d.y0,\r\n },\r\n whileInView: {\r\n opacity: selectedColor\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d.data as any).data.color\r\n ? colors[\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n colorDomain.indexOf((d.data as any).data.color)\r\n ] === selectedColor\r\n ? 1\r\n : dimmedOpacity\r\n : dimmedOpacity\r\n : highlightedDataPoints.length !== 0\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n highlightedDataPoints.indexOf((d.data as any).id) !== -1\r\n ? 0.85\r\n : dimmedOpacity\r\n : 0.85,\r\n x: d.x0,\r\n y: d.y0,\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 onMouseEnter={event => {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n setMouseOverData((d.data as any).data);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?.((d.data as any).data);\r\n }}\r\n onClick={() => {\r\n if (onSeriesMouseClick || detailsOnClick) {\r\n if (\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mouseClickData === (d.data as any).id &&\r\n resetSelectionOnDoubleClick\r\n ) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n setMouseClickData((d.data as any).id);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?.((d.data as any).data);\r\n }\r\n }\r\n }}\r\n onMouseMove={event => {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n setMouseOverData((d.data as any).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 <motion.rect\r\n x={0}\r\n y={0}\r\n exit={{\r\n width: 0,\r\n height: 0,\r\n opacity: 0,\r\n transition: { duration: animate.duration },\r\n }}\r\n variants={{\r\n initial: {\r\n width: 0,\r\n height: 0,\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n !(d.data as any).data.color\r\n ? Colors.gray\r\n : colors[\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n colorDomain.indexOf((d.data as any).data.color)\r\n ],\r\n },\r\n whileInView: {\r\n width: d.x1 - d.x0,\r\n height: d.y1 - d.y0,\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n !(d.data as any).data.color\r\n ? Colors.gray\r\n : colors[\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n colorDomain.indexOf((d.data as any).data.color)\r\n ],\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n {d.x1 - d.x0 > 50 && d.y1 - d.y0 > 25 && (showLabels || showValues) ? (\r\n <motion.g\r\n variants={{\r\n initial: { opacity: 0 },\r\n whileInView: {\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 exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n >\r\n <foreignObject y={0} x={0} width={d.x1 - d.x0} height={d.y1 - d.y0}>\r\n <div\r\n className='flex flex-col gap-0.5 p-2 w-full'\r\n style={{\r\n color: getTextColorBasedOnBgColor(\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n !(d.data as any).data.color\r\n ? Colors.gray\r\n : colors[\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n colorDomain.indexOf((d.data as any).data.color)\r\n ],\r\n ),\r\n }}\r\n >\r\n {showLabels ? (\r\n <P\r\n marginBottom='none'\r\n size='sm'\r\n leading='none'\r\n className={cn(\r\n 'w-full treemap-label',\r\n language === 'ar' || language === 'he' ? 'text-right' : 'text-left',\r\n classNames?.graphObjectValues,\r\n )}\r\n style={{\r\n WebkitLineClamp:\r\n d.y1 - d.y0 > 50\r\n ? d.y1 - d.y0 > 100\r\n ? d.y1 - d.y0 > 150\r\n ? undefined\r\n : 3\r\n : 2\r\n : 1,\r\n display: '-webkit-box',\r\n WebkitBoxOrient: 'vertical',\r\n overflow: 'hidden',\r\n color: getTextColorBasedOnBgColor(\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n !(d.data as any).data.color\r\n ? Colors.gray\r\n : colors[\r\n colorDomain.indexOf(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d.data as any).data.color,\r\n )\r\n ],\r\n ),\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n >\r\n {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d.data as any).id\r\n }\r\n </P>\r\n ) : null}\r\n {showValues ? (\r\n <P\r\n marginBottom='none'\r\n size='sm'\r\n leading='none'\r\n className={cn(\r\n 'w-full font-bold treemap-value',\r\n language === 'ar' || language === 'he' ? 'text-right' : 'text-left',\r\n classNames?.graphObjectValues,\r\n )}\r\n style={{\r\n color: getTextColorBasedOnBgColor(\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n !(d.data as any).data.color\r\n ? Colors.gray\r\n : colors[\r\n colorDomain.indexOf(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d.data as any).data.color,\r\n )\r\n ],\r\n ),\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n >\r\n {numberFormattingFunction(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d.data as any).value,\r\n 'NA',\r\n precision,\r\n prefix,\r\n suffix,\r\n )}\r\n </P>\r\n ) : null}\r\n </div>\r\n </foreignObject>\r\n </motion.g>\r\n ) : null}\r\n </motion.g>\r\n );\r\n })}\r\n </AnimatePresence>\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 uniqBy from 'lodash.uniqby';\r\nimport { 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 { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport {\r\n TreeMapDataType,\r\n SourcesDataType,\r\n Languages,\r\n StyleObject,\r\n ClassNameObject,\r\n AnimateDataType,\r\n} from '@/Types';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { ColorLegendWithMouseOver } from '@/Components/Elements/ColorLegendWithMouseOver';\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: TreeMapDataType[];\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 /** Color or array of colors for circle */\r\n colors?: string | string[];\r\n /** Domain of colors for the graph */\r\n colorDomain?: 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 /** Maximum radius of the circle */\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 labels */\r\n showLabels?: boolean;\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 /** Data points to highlight. Use the label value from data to highlight the data point */\r\n highlightedDataPoints?: (string | number)[];\r\n /** Defines the opacity of the non-highlighted data */\r\n dimmedOpacity?: number;\r\n /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\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 TreeMapGraph(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n colors,\r\n suffix = '',\r\n sources,\r\n prefix = '',\r\n graphDescription,\r\n leftMargin = 0,\r\n rightMargin = 0,\r\n topMargin = 0,\r\n bottomMargin = 0,\r\n height,\r\n width,\r\n footNote,\r\n colorDomain,\r\n colorLegendTitle,\r\n padding,\r\n backgroundColor = false,\r\n showLabels = true,\r\n relativeHeight,\r\n tooltip,\r\n onSeriesMouseOver,\r\n showColorScale = true,\r\n showValues = true,\r\n graphID,\r\n highlightedDataPoints = [],\r\n onSeriesMouseClick,\r\n graphDownload = false,\r\n dataDownload = false,\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 dimmedOpacity = 0.3,\r\n precision = 2,\r\n } = props;\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 return (\r\n <div\r\n className={`${theme || 'light'} flex ${width ? 'w-fit grow-0' : 'w-full grow'}`}\r\n dir={language === 'he' || language === 'ar' ? 'rtl' : undefined}\r\n >\r\n <div\r\n className={cn(\r\n `${\r\n !backgroundColor\r\n ? 'bg-transparent '\r\n : backgroundColor === true\r\n ? 'bg-primary-gray-200 dark:bg-primary-gray-650 '\r\n : ''\r\n }ml-auto mr-auto flex flex-col grow h-inherit ${language || 'en'}`,\r\n 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 chart where data points are represented by squares, and their sizes reflect their values. ${\r\n graphDescription ? ` ${graphDescription}` : ''\r\n }`\r\n }\r\n >\r\n <div\r\n className='flex grow'\r\n style={{ padding: backgroundColor ? padding || '1rem' : padding || 0 }}\r\n >\r\n <div className='flex flex-col w-full gap-4 grow justify-between'>\r\n {graphTitle || graphDescription || graphDownload || dataDownload ? (\r\n <GraphHeader\r\n styles={{\r\n title: styles?.title,\r\n description: styles?.description,\r\n }}\r\n classNames={{\r\n title: classNames?.title,\r\n description: classNames?.description,\r\n }}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n width={width}\r\n graphDownload={graphDownload ? graphParentDiv.current : undefined}\r\n dataDownload={\r\n dataDownload\r\n ? data.map(d => d.data).filter(d => d !== undefined).length > 0\r\n ? data.map(d => d.data).filter(d => d !== undefined)\r\n : data.filter(d => d !== undefined)\r\n : null\r\n }\r\n />\r\n ) : null}\r\n <div className='grow flex flex-col justify-center gap-3 w-full'>\r\n {data.length === 0 ? (\r\n <EmptyState />\r\n ) : (\r\n <>\r\n {showColorScale && data.filter(el => el.color).length !== 0 ? (\r\n <ColorLegendWithMouseOver\r\n width={width}\r\n colorLegendTitle={colorLegendTitle}\r\n colors={\r\n (colors as string[] | undefined) || Colors[theme].categoricalColors.colors\r\n }\r\n colorDomain={\r\n colorDomain ||\r\n (uniqBy(\r\n data.filter(el => el.color),\r\n 'color',\r\n ).map(d => d.color) as string[])\r\n }\r\n setSelectedColor={setSelectedColor}\r\n showNAColor={showNAColor}\r\n />\r\n ) : null}\r\n <div\r\n className='flex flex-col grow 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.filter(d => !checkIfNullOrUndefined(d.size))}\r\n colors={\r\n data.filter(el => el.color).length === 0\r\n ? colors\r\n ? [colors as string]\r\n : [Colors.primaryColors['blue-600']]\r\n : (colors as string[] | undefined) ||\r\n Colors[theme].categoricalColors.colors\r\n }\r\n colorDomain={\r\n data.filter(el => el.color).length === 0\r\n ? []\r\n : colorDomain ||\r\n (uniqBy(\r\n data.filter(el => el.color),\r\n 'color',\r\n ).map(d => d.color) as string[])\r\n }\r\n width={width || svgWidth}\r\n height={Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}\r\n leftMargin={leftMargin}\r\n rightMargin={rightMargin}\r\n topMargin={topMargin}\r\n bottomMargin={bottomMargin}\r\n showLabels={showLabels}\r\n showValues={showValues}\r\n suffix={suffix}\r\n prefix={prefix}\r\n selectedColor={selectedColor}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n highlightedDataPoints={highlightedDataPoints}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n detailsOnClick={detailsOnClick}\r\n styles={styles}\r\n classNames={classNames}\r\n language={language}\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 dimmedOpacity={dimmedOpacity}\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":["count","node","sum","children","i","node_count","node_each","callback","that","index","node_eachBefore","nodes","node_eachAfter","next","n","node_find","node_sum","value","node_sort","compare","node_path","end","start","ancestor","leastCommonAncestor","k","a","b","aNodes","bNodes","c","node_ancestors","node_descendants","node_leaves","leaves","node_links","root","links","node_iterator","current","hierarchy","data","mapChildren","objectChildren","Node","child","childs","computeHeight","node_copy","copyData","d","height","optional","f","required","constantZero","constant","x","roundNode","treemapDice","parent","x0","y0","x1","y1","preroot","ambiguous","imputed","defaultId","defaultParentId","stratify","id","parentId","path","currentId","currentParentId","nodeId","nodeKey","nodeByKey","I","normalize","P","parentof","S","_","slash","treemapSlice","phi","squarifyRatio","ratio","rows","row","nodeValue","i0","i1","dx","dy","sumValue","minValue","maxValue","newRatio","minRatio","alpha","beta","squarify","custom","treemap","tile","round","paddingStack","paddingInner","paddingTop","paddingRight","paddingBottom","paddingLeft","positionNode","p","Graph","props","colors","leftMargin","width","colorDomain","rightMargin","topMargin","bottomMargin","showLabels","tooltip","onSeriesMouseOver","selectedColor","showValues","suffix","prefix","highlightedDataPoints","onSeriesMouseClick","resetSelectionOnDoubleClick","detailsOnClick","language","styles","classNames","animate","dimmedOpacity","precision","svgRef","useRef","isInView","useInView","mouseOverData","setMouseOverData","useState","mouseClickData","setMouseClickData","eventX","setEventX","eventY","setEventY","margin","graphWidth","graphHeight","treeMapData","treeData","treeMapVizData","jsxs","Fragment","jsx","motion","AnimatePresence","event","el","Colors","getTextColorBasedOnBgColor","cn","numberFormattingFunction","Tooltip","Modal","string2HTML","TreeMapGraph","graphTitle","sources","graphDescription","footNote","colorLegendTitle","padding","backgroundColor","relativeHeight","showColorScale","graphID","graphDownload","dataDownload","showNAColor","minHeight","theme","ariaLabel","svgWidth","setSvgWidth","svgHeight","setSvgHeight","setSelectedColor","graphDiv","graphParentDiv","useEffect","resizeObserver","entries","GraphHeader","EmptyState","ColorLegendWithMouseOver","uniqBy","checkIfNullOrUndefined","GraphFooter"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,SAASA,GAAMC,GAAM;AACnB,MAAIC,IAAM,GACNC,IAAWF,EAAK,UAChBG,IAAID,KAAYA,EAAS;AAC7B,MAAI,CAACC,EAAG,CAAAF,IAAM;AAAA,MACT,QAAO,EAAEE,KAAK,IAAG,CAAAF,KAAOC,EAASC,CAAC,EAAE;AACzC,EAAAH,EAAK,QAAQC;AACf;AAEe,SAAAG,KAAW;AACxB,SAAO,KAAK,UAAUL,EAAK;AAC7B;ACXe,SAAAM,GAASC,GAAUC,GAAM;AACtC,MAAIC,IAAQ;AACZ,aAAWR,KAAQ;AACjB,IAAAM,EAAS,KAAKC,GAAMP,GAAM,EAAEQ,GAAO,IAAI;AAEzC,SAAO;AACT;ACNe,SAAAC,GAASH,GAAUC,GAAM;AAEtC,WADIP,IAAO,MAAMU,IAAQ,CAACV,CAAI,GAAGE,GAAUC,GAAGK,IAAQ,IAC/CR,IAAOU,EAAM;AAElB,QADAJ,EAAS,KAAKC,GAAMP,GAAM,EAAEQ,GAAO,IAAI,GACnCN,IAAWF,EAAK;AAClB,WAAKG,IAAID,EAAS,SAAS,GA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AAD;AAAA,0BACA,6BAAAE;AAAA,0BACA,gBAAAC;AAAA,0BACA,QAAAE;AAAA,0BACA,YAAAC;AAAA,0BACA,UAAAF;AAAA,0BACA,SACEG,MAAY,KACR,EAAE,UAAU,KAAK,MAAM,IAAM,QAAQ,IAAA,IACrCA,KAAW,EAAE,UAAU,GAAG,MAAM,IAAM,QAAQ,EAAA;AAAA,0BAEpD,eAAAC;AAAA,0BACA,WAAAC;AAAA,wBAAA;AAAA,sBAAA,IAEA;AAAA,oBAAA;AAAA,kBAAA;AAAA,gBACN,EAAA,CACF,EAAA,CAEJ;AAAA,gBACCoC,KAAWE,IACVhB,gBAAAA,EAAAA;AAAAA,kBAAC4C;AAAA,kBAAA;AAAA,oBACC,QAAQ,EAAE,UAAUtE,GAAQ,UAAU,QAAQA,GAAQ,OAAA;AAAA,oBACtD,YAAY;AAAA,sBACV,UAAUC,GAAY;AAAA,sBACtB,QAAQA,GAAY;AAAA,oBAAA;AAAA,oBAEtB,SAAAuC;AAAA,oBACA,UAAAE;AAAA,oBACA,OAAA3D;AAAA,kBAAA;AAAA,gBAAA,IAEA;AAAA,cAAA,EAAA,CACN;AAAA,YAAA;AAAA,UAAA;AAAA,QACF;AAAA,MAAA;AAAA,IACF;AAAA,EAAA;AAGN;","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21]}
1
+ {"version":3,"file":"TreeMapGraph.js","sources":["../node_modules/d3-hierarchy/src/hierarchy/count.js","../node_modules/d3-hierarchy/src/hierarchy/each.js","../node_modules/d3-hierarchy/src/hierarchy/eachBefore.js","../node_modules/d3-hierarchy/src/hierarchy/eachAfter.js","../node_modules/d3-hierarchy/src/hierarchy/find.js","../node_modules/d3-hierarchy/src/hierarchy/sum.js","../node_modules/d3-hierarchy/src/hierarchy/sort.js","../node_modules/d3-hierarchy/src/hierarchy/path.js","../node_modules/d3-hierarchy/src/hierarchy/ancestors.js","../node_modules/d3-hierarchy/src/hierarchy/descendants.js","../node_modules/d3-hierarchy/src/hierarchy/leaves.js","../node_modules/d3-hierarchy/src/hierarchy/links.js","../node_modules/d3-hierarchy/src/hierarchy/iterator.js","../node_modules/d3-hierarchy/src/hierarchy/index.js","../node_modules/d3-hierarchy/src/accessors.js","../node_modules/d3-hierarchy/src/constant.js","../node_modules/d3-hierarchy/src/treemap/round.js","../node_modules/d3-hierarchy/src/treemap/dice.js","../node_modules/d3-hierarchy/src/stratify.js","../node_modules/d3-hierarchy/src/treemap/slice.js","../node_modules/d3-hierarchy/src/treemap/squarify.js","../node_modules/d3-hierarchy/src/treemap/index.js","../src/Components/Graphs/TreeMapGraph/Graph.tsx","../src/Components/Graphs/TreeMapGraph/index.tsx"],"sourcesContent":["function count(node) {\n var sum = 0,\n children = node.children,\n i = children && children.length;\n if (!i) sum = 1;\n else while (--i >= 0) sum += children[i].value;\n node.value = sum;\n}\n\nexport default function() {\n return this.eachAfter(count);\n}\n","export default function(callback, that) {\n let index = -1;\n for (const node of this) {\n callback.call(that, node, ++index, this);\n }\n return this;\n}\n","export default function(callback, that) {\n var node = this, nodes = [node], children, i, index = -1;\n while (node = nodes.pop()) {\n callback.call(that, node, ++index, this);\n if (children = node.children) {\n for (i = children.length - 1; i >= 0; --i) {\n nodes.push(children[i]);\n }\n }\n }\n return this;\n}\n","export default function(callback, that) {\n var node = this, nodes = [node], next = [], children, i, n, index = -1;\n while (node = nodes.pop()) {\n next.push(node);\n if (children = node.children) {\n for (i = 0, n = children.length; i < n; ++i) {\n nodes.push(children[i]);\n }\n }\n }\n while (node = next.pop()) {\n callback.call(that, node, ++index, this);\n }\n return this;\n}\n","export default function(callback, that) {\n let index = -1;\n for (const node of this) {\n if (callback.call(that, node, ++index, this)) {\n return node;\n }\n }\n}\n","export default function(value) {\n return this.eachAfter(function(node) {\n var sum = +value(node.data) || 0,\n children = node.children,\n i = children && children.length;\n while (--i >= 0) sum += children[i].value;\n node.value = sum;\n });\n}\n","export default function(compare) {\n return this.eachBefore(function(node) {\n if (node.children) {\n node.children.sort(compare);\n }\n });\n}\n","export default function(end) {\n var start = this,\n ancestor = leastCommonAncestor(start, end),\n nodes = [start];\n while (start !== ancestor) {\n start = start.parent;\n nodes.push(start);\n }\n var k = nodes.length;\n while (end !== ancestor) {\n nodes.splice(k, 0, end);\n end = end.parent;\n }\n return nodes;\n}\n\nfunction leastCommonAncestor(a, b) {\n if (a === b) return a;\n var aNodes = a.ancestors(),\n bNodes = b.ancestors(),\n c = null;\n a = aNodes.pop();\n b = bNodes.pop();\n while (a === b) {\n c = a;\n a = aNodes.pop();\n b = bNodes.pop();\n }\n return c;\n}\n","export default function() {\n var node = this, nodes = [node];\n while (node = node.parent) {\n nodes.push(node);\n }\n return nodes;\n}\n","export default function() {\n return Array.from(this);\n}\n","export default function() {\n var leaves = [];\n this.eachBefore(function(node) {\n if (!node.children) {\n leaves.push(node);\n }\n });\n return leaves;\n}\n","export default function() {\n var root = this, links = [];\n root.each(function(node) {\n if (node !== root) { // Don’t include the root’s parent, if any.\n links.push({source: node.parent, target: node});\n }\n });\n return links;\n}\n","export default function*() {\n var node = this, current, next = [node], children, i, n;\n do {\n current = next.reverse(), next = [];\n while (node = current.pop()) {\n yield node;\n if (children = node.children) {\n for (i = 0, n = children.length; i < n; ++i) {\n next.push(children[i]);\n }\n }\n }\n } while (next.length);\n}\n","import node_count from \"./count.js\";\nimport node_each from \"./each.js\";\nimport node_eachBefore from \"./eachBefore.js\";\nimport node_eachAfter from \"./eachAfter.js\";\nimport node_find from \"./find.js\";\nimport node_sum from \"./sum.js\";\nimport node_sort from \"./sort.js\";\nimport node_path from \"./path.js\";\nimport node_ancestors from \"./ancestors.js\";\nimport node_descendants from \"./descendants.js\";\nimport node_leaves from \"./leaves.js\";\nimport node_links from \"./links.js\";\nimport node_iterator from \"./iterator.js\";\n\nexport default function hierarchy(data, children) {\n if (data instanceof Map) {\n data = [undefined, data];\n if (children === undefined) children = mapChildren;\n } else if (children === undefined) {\n children = objectChildren;\n }\n\n var root = new Node(data),\n node,\n nodes = [root],\n child,\n childs,\n i,\n n;\n\n while (node = nodes.pop()) {\n if ((childs = children(node.data)) && (n = (childs = Array.from(childs)).length)) {\n node.children = childs;\n for (i = n - 1; i >= 0; --i) {\n nodes.push(child = childs[i] = new Node(childs[i]));\n child.parent = node;\n child.depth = node.depth + 1;\n }\n }\n }\n\n return root.eachBefore(computeHeight);\n}\n\nfunction node_copy() {\n return hierarchy(this).eachBefore(copyData);\n}\n\nfunction objectChildren(d) {\n return d.children;\n}\n\nfunction mapChildren(d) {\n return Array.isArray(d) ? d[1] : null;\n}\n\nfunction copyData(node) {\n if (node.data.value !== undefined) node.value = node.data.value;\n node.data = node.data.data;\n}\n\nexport function computeHeight(node) {\n var height = 0;\n do node.height = height;\n while ((node = node.parent) && (node.height < ++height));\n}\n\nexport function Node(data) {\n this.data = data;\n this.depth =\n this.height = 0;\n this.parent = null;\n}\n\nNode.prototype = hierarchy.prototype = {\n constructor: Node,\n count: node_count,\n each: node_each,\n eachAfter: node_eachAfter,\n eachBefore: node_eachBefore,\n find: node_find,\n sum: node_sum,\n sort: node_sort,\n path: node_path,\n ancestors: node_ancestors,\n descendants: node_descendants,\n leaves: node_leaves,\n links: node_links,\n copy: node_copy,\n [Symbol.iterator]: node_iterator\n};\n","export function optional(f) {\n return f == null ? null : required(f);\n}\n\nexport function required(f) {\n if (typeof f !== \"function\") throw new Error;\n return f;\n}\n","export function constantZero() {\n return 0;\n}\n\nexport default function(x) {\n return function() {\n return x;\n };\n}\n","export default function(node) {\n node.x0 = Math.round(node.x0);\n node.y0 = Math.round(node.y0);\n node.x1 = Math.round(node.x1);\n node.y1 = Math.round(node.y1);\n}\n","export default function(parent, x0, y0, x1, y1) {\n var nodes = parent.children,\n node,\n i = -1,\n n = nodes.length,\n k = parent.value && (x1 - x0) / parent.value;\n\n while (++i < n) {\n node = nodes[i], node.y0 = y0, node.y1 = y1;\n node.x0 = x0, node.x1 = x0 += node.value * k;\n }\n}\n","import {optional} from \"./accessors.js\";\nimport {Node, computeHeight} from \"./hierarchy/index.js\";\n\nvar preroot = {depth: -1},\n ambiguous = {},\n imputed = {};\n\nfunction defaultId(d) {\n return d.id;\n}\n\nfunction defaultParentId(d) {\n return d.parentId;\n}\n\nexport default function() {\n var id = defaultId,\n parentId = defaultParentId,\n path;\n\n function stratify(data) {\n var nodes = Array.from(data),\n currentId = id,\n currentParentId = parentId,\n n,\n d,\n i,\n root,\n parent,\n node,\n nodeId,\n nodeKey,\n nodeByKey = new Map;\n\n if (path != null) {\n const I = nodes.map((d, i) => normalize(path(d, i, data)));\n const P = I.map(parentof);\n const S = new Set(I).add(\"\");\n for (const i of P) {\n if (!S.has(i)) {\n S.add(i);\n I.push(i);\n P.push(parentof(i));\n nodes.push(imputed);\n }\n }\n currentId = (_, i) => I[i];\n currentParentId = (_, i) => P[i];\n }\n\n for (i = 0, n = nodes.length; i < n; ++i) {\n d = nodes[i], node = nodes[i] = new Node(d);\n if ((nodeId = currentId(d, i, data)) != null && (nodeId += \"\")) {\n nodeKey = node.id = nodeId;\n nodeByKey.set(nodeKey, nodeByKey.has(nodeKey) ? ambiguous : node);\n }\n if ((nodeId = currentParentId(d, i, data)) != null && (nodeId += \"\")) {\n node.parent = nodeId;\n }\n }\n\n for (i = 0; i < n; ++i) {\n node = nodes[i];\n if (nodeId = node.parent) {\n parent = nodeByKey.get(nodeId);\n if (!parent) throw new Error(\"missing: \" + nodeId);\n if (parent === ambiguous) throw new Error(\"ambiguous: \" + nodeId);\n if (parent.children) parent.children.push(node);\n else parent.children = [node];\n node.parent = parent;\n } else {\n if (root) throw new Error(\"multiple roots\");\n root = node;\n }\n }\n\n if (!root) throw new Error(\"no root\");\n\n // When imputing internal nodes, only introduce roots if needed.\n // Then replace the imputed marker data with null.\n if (path != null) {\n while (root.data === imputed && root.children.length === 1) {\n root = root.children[0], --n;\n }\n for (let i = nodes.length - 1; i >= 0; --i) {\n node = nodes[i];\n if (node.data !== imputed) break;\n node.data = null;\n }\n }\n\n root.parent = preroot;\n root.eachBefore(function(node) { node.depth = node.parent.depth + 1; --n; }).eachBefore(computeHeight);\n root.parent = null;\n if (n > 0) throw new Error(\"cycle\");\n\n return root;\n }\n\n stratify.id = function(x) {\n return arguments.length ? (id = optional(x), stratify) : id;\n };\n\n stratify.parentId = function(x) {\n return arguments.length ? (parentId = optional(x), stratify) : parentId;\n };\n\n stratify.path = function(x) {\n return arguments.length ? (path = optional(x), stratify) : path;\n };\n\n return stratify;\n}\n\n// To normalize a path, we coerce to a string, strip the trailing slash if any\n// (as long as the trailing slash is not immediately preceded by another slash),\n// and add leading slash if missing.\nfunction normalize(path) {\n path = `${path}`;\n let i = path.length;\n if (slash(path, i - 1) && !slash(path, i - 2)) path = path.slice(0, -1);\n return path[0] === \"/\" ? path : `/${path}`;\n}\n\n// Walk backwards to find the first slash that is not the leading slash, e.g.:\n// \"/foo/bar\" ⇥ \"/foo\", \"/foo\" ⇥ \"/\", \"/\" ↦ \"\". (The root is special-cased\n// because the id of the root must be a truthy value.)\nfunction parentof(path) {\n let i = path.length;\n if (i < 2) return \"\";\n while (--i > 1) if (slash(path, i)) break;\n return path.slice(0, i);\n}\n\n// Slashes can be escaped; to determine whether a slash is a path delimiter, we\n// count the number of preceding backslashes escaping the forward slash: an odd\n// number indicates an escaped forward slash.\nfunction slash(path, i) {\n if (path[i] === \"/\") {\n let k = 0;\n while (i > 0 && path[--i] === \"\\\\\") ++k;\n if ((k & 1) === 0) return true;\n }\n return false;\n}\n","export default function(parent, x0, y0, x1, y1) {\n var nodes = parent.children,\n node,\n i = -1,\n n = nodes.length,\n k = parent.value && (y1 - y0) / parent.value;\n\n while (++i < n) {\n node = nodes[i], node.x0 = x0, node.x1 = x1;\n node.y0 = y0, node.y1 = y0 += node.value * k;\n }\n}\n","import treemapDice from \"./dice.js\";\nimport treemapSlice from \"./slice.js\";\n\nexport var phi = (1 + Math.sqrt(5)) / 2;\n\nexport function squarifyRatio(ratio, parent, x0, y0, x1, y1) {\n var rows = [],\n nodes = parent.children,\n row,\n nodeValue,\n i0 = 0,\n i1 = 0,\n n = nodes.length,\n dx, dy,\n value = parent.value,\n sumValue,\n minValue,\n maxValue,\n newRatio,\n minRatio,\n alpha,\n beta;\n\n while (i0 < n) {\n dx = x1 - x0, dy = y1 - y0;\n\n // Find the next non-empty node.\n do sumValue = nodes[i1++].value; while (!sumValue && i1 < n);\n minValue = maxValue = sumValue;\n alpha = Math.max(dy / dx, dx / dy) / (value * ratio);\n beta = sumValue * sumValue * alpha;\n minRatio = Math.max(maxValue / beta, beta / minValue);\n\n // Keep adding nodes while the aspect ratio maintains or improves.\n for (; i1 < n; ++i1) {\n sumValue += nodeValue = nodes[i1].value;\n if (nodeValue < minValue) minValue = nodeValue;\n if (nodeValue > maxValue) maxValue = nodeValue;\n beta = sumValue * sumValue * alpha;\n newRatio = Math.max(maxValue / beta, beta / minValue);\n if (newRatio > minRatio) { sumValue -= nodeValue; break; }\n minRatio = newRatio;\n }\n\n // Position and record the row orientation.\n rows.push(row = {value: sumValue, dice: dx < dy, children: nodes.slice(i0, i1)});\n if (row.dice) treemapDice(row, x0, y0, x1, value ? y0 += dy * sumValue / value : y1);\n else treemapSlice(row, x0, y0, value ? x0 += dx * sumValue / value : x1, y1);\n value -= sumValue, i0 = i1;\n }\n\n return rows;\n}\n\nexport default (function custom(ratio) {\n\n function squarify(parent, x0, y0, x1, y1) {\n squarifyRatio(ratio, parent, x0, y0, x1, y1);\n }\n\n squarify.ratio = function(x) {\n return custom((x = +x) > 1 ? x : 1);\n };\n\n return squarify;\n})(phi);\n","import roundNode from \"./round.js\";\nimport squarify from \"./squarify.js\";\nimport {required} from \"../accessors.js\";\nimport constant, {constantZero} from \"../constant.js\";\n\nexport default function() {\n var tile = squarify,\n round = false,\n dx = 1,\n dy = 1,\n paddingStack = [0],\n paddingInner = constantZero,\n paddingTop = constantZero,\n paddingRight = constantZero,\n paddingBottom = constantZero,\n paddingLeft = constantZero;\n\n function treemap(root) {\n root.x0 =\n root.y0 = 0;\n root.x1 = dx;\n root.y1 = dy;\n root.eachBefore(positionNode);\n paddingStack = [0];\n if (round) root.eachBefore(roundNode);\n return root;\n }\n\n function positionNode(node) {\n var p = paddingStack[node.depth],\n x0 = node.x0 + p,\n y0 = node.y0 + p,\n x1 = node.x1 - p,\n y1 = node.y1 - p;\n if (x1 < x0) x0 = x1 = (x0 + x1) / 2;\n if (y1 < y0) y0 = y1 = (y0 + y1) / 2;\n node.x0 = x0;\n node.y0 = y0;\n node.x1 = x1;\n node.y1 = y1;\n if (node.children) {\n p = paddingStack[node.depth + 1] = paddingInner(node) / 2;\n x0 += paddingLeft(node) - p;\n y0 += paddingTop(node) - p;\n x1 -= paddingRight(node) - p;\n y1 -= paddingBottom(node) - p;\n if (x1 < x0) x0 = x1 = (x0 + x1) / 2;\n if (y1 < y0) y0 = y1 = (y0 + y1) / 2;\n tile(node, x0, y0, x1, y1);\n }\n }\n\n treemap.round = function(x) {\n return arguments.length ? (round = !!x, treemap) : round;\n };\n\n treemap.size = function(x) {\n return arguments.length ? (dx = +x[0], dy = +x[1], treemap) : [dx, dy];\n };\n\n treemap.tile = function(x) {\n return arguments.length ? (tile = required(x), treemap) : tile;\n };\n\n treemap.padding = function(x) {\n return arguments.length ? treemap.paddingInner(x).paddingOuter(x) : treemap.paddingInner();\n };\n\n treemap.paddingInner = function(x) {\n return arguments.length ? (paddingInner = typeof x === \"function\" ? x : constant(+x), treemap) : paddingInner;\n };\n\n treemap.paddingOuter = function(x) {\n return arguments.length ? treemap.paddingTop(x).paddingRight(x).paddingBottom(x).paddingLeft(x) : treemap.paddingTop();\n };\n\n treemap.paddingTop = function(x) {\n return arguments.length ? (paddingTop = typeof x === \"function\" ? x : constant(+x), treemap) : paddingTop;\n };\n\n treemap.paddingRight = function(x) {\n return arguments.length ? (paddingRight = typeof x === \"function\" ? x : constant(+x), treemap) : paddingRight;\n };\n\n treemap.paddingBottom = function(x) {\n return arguments.length ? (paddingBottom = typeof x === \"function\" ? x : constant(+x), treemap) : paddingBottom;\n };\n\n treemap.paddingLeft = function(x) {\n return arguments.length ? (paddingLeft = typeof x === \"function\" ? x : constant(+x), treemap) : paddingLeft;\n };\n\n return treemap;\n}\n","import { stratify, treemap } from 'd3-hierarchy';\r\nimport { useRef, useState } from 'react';\r\nimport { P } from '@undp/design-system-react/Typography';\r\nimport { AnimatePresence, motion, useInView } from 'motion/react';\r\nimport { Modal } from '@undp/design-system-react/Modal';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport { AnimateDataType, ClassNameObject, Languages, StyleObject, TreeMapDataType } from '@/Types';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { getTextColorBasedOnBgColor } from '@/Utils/getTextColorBasedOnBgColor';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { string2HTML } from '@/Utils/string2HTML';\r\n\r\ninterface Props {\r\n data: TreeMapDataType[];\r\n colors: string[];\r\n colorDomain: string[];\r\n leftMargin: number;\r\n rightMargin: number;\r\n topMargin: number;\r\n bottomMargin: number;\r\n showLabels: boolean;\r\n showValues: boolean;\r\n width: number;\r\n height: number;\r\n suffix: string;\r\n prefix: string;\r\n selectedColor?: string;\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 // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n highlightedDataPoints: (string | number)[];\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 language?: Languages;\r\n animate: AnimateDataType;\r\n dimmedOpacity: number;\r\n precision: number;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n colors,\r\n leftMargin,\r\n width,\r\n height,\r\n colorDomain,\r\n rightMargin,\r\n topMargin,\r\n bottomMargin,\r\n showLabels,\r\n tooltip,\r\n onSeriesMouseOver,\r\n selectedColor,\r\n showValues,\r\n suffix,\r\n prefix,\r\n highlightedDataPoints,\r\n onSeriesMouseClick,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n language,\r\n styles,\r\n classNames,\r\n animate,\r\n dimmedOpacity,\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 // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\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 const margin = {\r\n top: topMargin,\r\n bottom: bottomMargin,\r\n left: leftMargin,\r\n right: rightMargin,\r\n };\r\n const graphWidth = width - margin.left - margin.right;\r\n const graphHeight = height - margin.top - margin.bottom;\r\n\r\n const treeMapData = [\r\n {\r\n id: 'root',\r\n parent: undefined,\r\n value: undefined,\r\n data: undefined,\r\n },\r\n ...data.map((d: TreeMapDataType) => ({\r\n id: d.label,\r\n value: d.size,\r\n parent: 'root',\r\n data: d,\r\n })),\r\n ];\r\n const treeData = stratify()\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n .id((d: any) => d.id)\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n .parentId((d: any) => d.parent)(treeMapData);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n treeData.sum((d: any) => d.value);\r\n const treeMapVizData = treemap().size([graphWidth, graphHeight]).padding(2)(treeData);\r\n\r\n return (\r\n <>\r\n <motion.svg\r\n width={`${width}px`}\r\n height={`${height}px`}\r\n viewBox={`0 0 ${width} ${height}`}\r\n direction='ltr'\r\n ref={svgRef}\r\n >\r\n <g transform={`translate(${margin.left},${margin.top})`}>\r\n <AnimatePresence>\r\n {treeMapVizData.children?.map(d => {\r\n return (\r\n <motion.g\r\n className='undp-viz-g-with-hover'\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n key={(d.data as any).id}\r\n variants={{\r\n initial: {\r\n opacity: 0,\r\n x: d.x0,\r\n y: d.y0,\r\n },\r\n whileInView: {\r\n opacity: selectedColor\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d.data as any).data.color\r\n ? colors[\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n colorDomain.indexOf((d.data as any).data.color)\r\n ] === selectedColor\r\n ? 1\r\n : dimmedOpacity\r\n : dimmedOpacity\r\n : highlightedDataPoints.length !== 0\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n highlightedDataPoints.indexOf((d.data as any).id) !== -1\r\n ? 0.85\r\n : dimmedOpacity\r\n : 0.85,\r\n x: d.x0,\r\n y: d.y0,\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 onMouseEnter={event => {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n setMouseOverData((d.data as any).data);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?.((d.data as any).data);\r\n }}\r\n onClick={() => {\r\n if (onSeriesMouseClick || detailsOnClick) {\r\n if (\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mouseClickData === (d.data as any).id &&\r\n resetSelectionOnDoubleClick\r\n ) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n setMouseClickData((d.data as any).id);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?.((d.data as any).data);\r\n }\r\n }\r\n }}\r\n onMouseMove={event => {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n setMouseOverData((d.data as any).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 <motion.rect\r\n x={0}\r\n y={0}\r\n exit={{\r\n width: 0,\r\n height: 0,\r\n opacity: 0,\r\n transition: { duration: animate.duration },\r\n }}\r\n variants={{\r\n initial: {\r\n width: 0,\r\n height: 0,\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n !(d.data as any).data.color\r\n ? Colors.gray\r\n : colors[\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n colorDomain.indexOf((d.data as any).data.color)\r\n ],\r\n },\r\n whileInView: {\r\n width: d.x1 - d.x0,\r\n height: d.y1 - d.y0,\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n !(d.data as any).data.color\r\n ? Colors.gray\r\n : colors[\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n colorDomain.indexOf((d.data as any).data.color)\r\n ],\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n {d.x1 - d.x0 > 50 && d.y1 - d.y0 > 25 && (showLabels || showValues) ? (\r\n <motion.g\r\n variants={{\r\n initial: { opacity: 0 },\r\n whileInView: {\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 exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n >\r\n <foreignObject y={0} x={0} width={d.x1 - d.x0} height={d.y1 - d.y0}>\r\n <div\r\n className='flex flex-col gap-0.5 p-2 w-full'\r\n style={{\r\n color: getTextColorBasedOnBgColor(\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n !(d.data as any).data.color\r\n ? Colors.gray\r\n : colors[\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n colorDomain.indexOf((d.data as any).data.color)\r\n ],\r\n ),\r\n }}\r\n >\r\n {showLabels ? (\r\n <P\r\n marginBottom='none'\r\n size='sm'\r\n leading='none'\r\n className={cn(\r\n 'w-full treemap-label',\r\n language === 'ar' || language === 'he' ? 'text-right' : 'text-left',\r\n classNames?.graphObjectValues,\r\n )}\r\n style={{\r\n WebkitLineClamp:\r\n d.y1 - d.y0 > 50\r\n ? d.y1 - d.y0 > 100\r\n ? d.y1 - d.y0 > 150\r\n ? undefined\r\n : 3\r\n : 2\r\n : 1,\r\n display: '-webkit-box',\r\n WebkitBoxOrient: 'vertical',\r\n overflow: 'hidden',\r\n color: getTextColorBasedOnBgColor(\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n !(d.data as any).data.color\r\n ? Colors.gray\r\n : colors[\r\n colorDomain.indexOf(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d.data as any).data.color,\r\n )\r\n ],\r\n ),\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n >\r\n {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d.data as any).id\r\n }\r\n </P>\r\n ) : null}\r\n {showValues ? (\r\n <P\r\n marginBottom='none'\r\n size='sm'\r\n leading='none'\r\n className={cn(\r\n 'w-full font-bold treemap-value',\r\n language === 'ar' || language === 'he' ? 'text-right' : 'text-left',\r\n classNames?.graphObjectValues,\r\n )}\r\n style={{\r\n color: getTextColorBasedOnBgColor(\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n !(d.data as any).data.color\r\n ? Colors.gray\r\n : colors[\r\n colorDomain.indexOf(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d.data as any).data.color,\r\n )\r\n ],\r\n ),\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n >\r\n {numberFormattingFunction(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d.data as any).value,\r\n 'NA',\r\n precision,\r\n prefix,\r\n suffix,\r\n )}\r\n </P>\r\n ) : null}\r\n </div>\r\n </foreignObject>\r\n </motion.g>\r\n ) : null}\r\n </motion.g>\r\n );\r\n })}\r\n </AnimatePresence>\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 uniqBy from 'lodash.uniqby';\r\nimport { 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 { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport {\r\n TreeMapDataType,\r\n SourcesDataType,\r\n Languages,\r\n StyleObject,\r\n ClassNameObject,\r\n AnimateDataType,\r\n} from '@/Types';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { ColorLegendWithMouseOver } from '@/Components/Elements/ColorLegendWithMouseOver';\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: TreeMapDataType[];\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 /** Color or array of colors for circle */\r\n colors?: string | string[];\r\n /** Domain of colors for the graph */\r\n colorDomain?: 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 /** Maximum radius of the circle */\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 labels */\r\n showLabels?: boolean;\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 /** Data points to highlight. Use the label value from data to highlight the data point */\r\n highlightedDataPoints?: (string | number)[];\r\n /** Defines the opacity of the non-highlighted data */\r\n dimmedOpacity?: number;\r\n /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\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 TreeMapGraph(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n colors,\r\n suffix = '',\r\n sources,\r\n prefix = '',\r\n graphDescription,\r\n leftMargin = 0,\r\n rightMargin = 0,\r\n topMargin = 0,\r\n bottomMargin = 0,\r\n height,\r\n width,\r\n footNote,\r\n colorDomain,\r\n colorLegendTitle,\r\n padding,\r\n backgroundColor = false,\r\n showLabels = true,\r\n relativeHeight,\r\n tooltip,\r\n onSeriesMouseOver,\r\n showColorScale = true,\r\n showValues = true,\r\n graphID,\r\n highlightedDataPoints = [],\r\n onSeriesMouseClick,\r\n graphDownload = false,\r\n dataDownload = false,\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 dimmedOpacity = 0.3,\r\n precision = 2,\r\n } = props;\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 return (\r\n <div\r\n className={`${theme || 'light'} flex ${width ? 'w-fit grow-0' : 'w-full grow'}`}\r\n dir={language === 'he' || language === 'ar' ? 'rtl' : undefined}\r\n >\r\n <div\r\n className={cn(\r\n `${\r\n !backgroundColor\r\n ? 'bg-transparent '\r\n : backgroundColor === true\r\n ? 'bg-primary-gray-200 dark:bg-primary-gray-650 '\r\n : ''\r\n }ml-auto mr-auto flex flex-col grow h-inherit ${language || 'en'}`,\r\n width ? 'w-fit' : 'w-full',\r\n classNames?.graphContainer,\r\n )}\r\n style={{\r\n ...(styles?.graphContainer || {}),\r\n ...(backgroundColor && backgroundColor !== true ? { backgroundColor } : {}),\r\n }}\r\n id={graphID}\r\n ref={graphParentDiv}\r\n aria-label={\r\n ariaLabel ||\r\n `${\r\n graphTitle ? `The graph shows ${graphTitle}. ` : ''\r\n }This is a chart where data points are represented by squares, and their sizes reflect their values. ${\r\n graphDescription ? ` ${graphDescription}` : ''\r\n }`\r\n }\r\n >\r\n <div\r\n className='flex grow'\r\n style={{ padding: backgroundColor ? padding || '1rem' : padding || 0 }}\r\n >\r\n <div className='flex flex-col w-full gap-4 grow justify-between'>\r\n {graphTitle || graphDescription || graphDownload || dataDownload ? (\r\n <GraphHeader\r\n styles={{\r\n title: styles?.title,\r\n description: styles?.description,\r\n }}\r\n classNames={{\r\n title: classNames?.title,\r\n description: classNames?.description,\r\n }}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n width={width}\r\n graphDownload={graphDownload ? graphParentDiv.current : undefined}\r\n dataDownload={\r\n dataDownload\r\n ? data.map(d => d.data).filter(d => d !== undefined).length > 0\r\n ? data.map(d => d.data).filter(d => d !== undefined)\r\n : data.filter(d => d !== undefined)\r\n : null\r\n }\r\n />\r\n ) : null}\r\n <div className='grow flex flex-col justify-center gap-3 w-full'>\r\n {data.length === 0 ? (\r\n <EmptyState />\r\n ) : (\r\n <>\r\n {showColorScale && data.filter(el => el.color).length !== 0 ? (\r\n <ColorLegendWithMouseOver\r\n width={width}\r\n colorLegendTitle={colorLegendTitle}\r\n colors={\r\n (colors as string[] | undefined) || Colors[theme].categoricalColors.colors\r\n }\r\n colorDomain={\r\n colorDomain ||\r\n (uniqBy(\r\n data.filter(el => el.color),\r\n 'color',\r\n ).map(d => d.color) as string[])\r\n }\r\n setSelectedColor={setSelectedColor}\r\n showNAColor={showNAColor}\r\n />\r\n ) : null}\r\n <div\r\n className='flex flex-col grow 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.filter(d => !checkIfNullOrUndefined(d.size))}\r\n colors={\r\n data.filter(el => el.color).length === 0\r\n ? colors\r\n ? [colors as string]\r\n : [Colors.primaryColors['blue-600']]\r\n : (colors as string[] | undefined) ||\r\n Colors[theme].categoricalColors.colors\r\n }\r\n colorDomain={\r\n data.filter(el => el.color).length === 0\r\n ? []\r\n : colorDomain ||\r\n (uniqBy(\r\n data.filter(el => el.color),\r\n 'color',\r\n ).map(d => d.color) as string[])\r\n }\r\n width={width || svgWidth}\r\n height={Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}\r\n leftMargin={leftMargin}\r\n rightMargin={rightMargin}\r\n topMargin={topMargin}\r\n bottomMargin={bottomMargin}\r\n showLabels={showLabels}\r\n showValues={showValues}\r\n suffix={suffix}\r\n prefix={prefix}\r\n selectedColor={selectedColor}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n highlightedDataPoints={highlightedDataPoints}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n detailsOnClick={detailsOnClick}\r\n styles={styles}\r\n classNames={classNames}\r\n language={language}\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 dimmedOpacity={dimmedOpacity}\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":["count","node","sum","children","i","node_count","node_each","callback","that","index","node_eachBefore","nodes","node_eachAfter","next","n","node_find","node_sum","value","node_sort","compare","node_path","end","start","ancestor","leastCommonAncestor","k","a","b","aNodes","bNodes","c","node_ancestors","node_descendants","node_leaves","leaves","node_links","root","links","node_iterator","current","hierarchy","data","mapChildren","objectChildren","Node","child","childs","computeHeight","node_copy","copyData","d","height","optional","f","required","constantZero","constant","x","roundNode","treemapDice","parent","x0","y0","x1","y1","preroot","ambiguous","imputed","defaultId","defaultParentId","stratify","id","parentId","path","currentId","currentParentId","nodeId","nodeKey","nodeByKey","I","normalize","P","parentof","S","_","slash","treemapSlice","phi","squarifyRatio","ratio","rows","row","nodeValue","i0","i1","dx","dy","sumValue","minValue","maxValue","newRatio","minRatio","alpha","beta","squarify","custom","treemap","tile","round","paddingStack","paddingInner","paddingTop","paddingRight","paddingBottom","paddingLeft","positionNode","p","Graph","props","colors","leftMargin","width","colorDomain","rightMargin","topMargin","bottomMargin","showLabels","tooltip","onSeriesMouseOver","selectedColor","showValues","suffix","prefix","highlightedDataPoints","onSeriesMouseClick","resetSelectionOnDoubleClick","detailsOnClick","language","styles","classNames","animate","dimmedOpacity","precision","svgRef","useRef","isInView","useInView","mouseOverData","setMouseOverData","useState","mouseClickData","setMouseClickData","eventX","setEventX","eventY","setEventY","margin","graphWidth","graphHeight","treeMapData","treeData","treeMapVizData","jsxs","Fragment","jsx","motion","AnimatePresence","event","el","Colors","getTextColorBasedOnBgColor","cn","numberFormattingFunction","Tooltip","Modal","string2HTML","TreeMapGraph","graphTitle","sources","graphDescription","footNote","colorLegendTitle","padding","backgroundColor","relativeHeight","showColorScale","graphID","graphDownload","dataDownload","showNAColor","minHeight","theme","ariaLabel","svgWidth","setSvgWidth","svgHeight","setSvgHeight","setSelectedColor","graphDiv","graphParentDiv","useEffect","resizeObserver","entries","GraphHeader","EmptyState","ColorLegendWithMouseOver","uniqBy","checkIfNullOrUndefined","GraphFooter"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,SAASA,GAAMC,GAAM;AACnB,MAAIC,IAAM,GACNC,IAAWF,EAAK,UAChBG,IAAID,KAAYA,EAAS;AAC7B,MAAI,CAACC,EAAG,CAAAF,IAAM;AAAA,MACT,QAAO,EAAEE,KAAK,IAAG,CAAAF,KAAOC,EAASC,CAAC,EAAE;AACzC,EAAAH,EAAK,QAAQC;AACf;AAEe,SAAAG,KAAW;AACxB,SAAO,KAAK,UAAUL,EAAK;AAC7B;ACXe,SAAAM,GAASC,GAAUC,GAAM;AACtC,MAAIC,IAAQ;AACZ,aAAWR,KAAQ;AACjB,IAAAM,EAAS,KAAKC,GAAMP,GAAM,EAAEQ,GAAO,IAAI;AAEzC,SAAO;AACT;ACNe,SAAAC,GAASH,GAAUC,GAAM;AAEtC,WADIP,IAAO,MAAMU,IAAQ,CAACV,CAAI,GAAGE,GAAUC,GAAGK,IAAQ,IAC/CR,IAAOU,EAAM;AAElB,QADAJ,EAAS,KAAKC,GAAMP,GAAM,EAAEQ,GAAO,IAAI,GACnCN,IAAWF,EAAK;AAClB,WAAKG,IAAID,EAAS,SAAS,GAAGC,KAAK,GAAG,EAAEA;AACtC,QAAAO,EAAM,KAAKR,EAASC,CAAC,CAAC;AAI5B,SAAO;AACT;ACXe,SAAAQ,GAASL,GAAUC,GAAM;AAEtC,WADIP,IAAO,MAAMU,IAAQ,CAACV,CAAI,GAAGY,IAAO,CAAA,GAAIV,GAAUC,GAAGU,GAAGL,IAAQ,IAC7DR,IAAOU,EAAM;AAElB,QADAE,EAAK,KAAKZ,CAAI,GACVE,IAAWF,EAAK;AAClB,WAAKG,IAAI,GAAGU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;AAAA,oBAAA;AAAA,kBAAA;AAAA,gBACN,EAAA,CACF,EAAA,CAEJ;AAAA,gBACCoC,KAAWE,IACVhB,gBAAAA,EAAAA;AAAAA,kBAAC4C;AAAA,kBAAA;AAAA,oBACC,QAAQ,EAAE,UAAUtE,GAAQ,UAAU,QAAQA,GAAQ,OAAA;AAAA,oBACtD,YAAY;AAAA,sBACV,UAAUC,GAAY;AAAA,sBACtB,QAAQA,GAAY;AAAA,oBAAA;AAAA,oBAEtB,SAAAuC;AAAA,oBACA,UAAAE;AAAA,oBACA,OAAA3D;AAAA,kBAAA;AAAA,gBAAA,IAEA;AAAA,cAAA,EAAA,CACN;AAAA,YAAA;AAAA,UAAA;AAAA,QACF;AAAA,MAAA;AAAA,IACF;AAAA,EAAA;AAGN;","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21]}
package/dist/Types.d.ts CHANGED
@@ -637,6 +637,7 @@ export declare interface GraphSettingsDataType {
637
637
  globeCurvatureResolution?: number;
638
638
  lightColor?: string;
639
639
  fogSetting?: FogDataType;
640
+ showAxisLabels?: boolean;
640
641
  }
641
642
 
642
643
  export declare type GraphType = GraphTypeForGriddedGraph;
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-CHPV5EwG-DDoeWRVt.cjs"),F=require("react"),O=require("./index-C21TvELx.cjs"),M=require("./Typography-k-kOjICQ.cjs"),U=require("./GraphFooter.cjs"),J=require("./GraphHeader.cjs"),K=require("./Colors.cjs"),Q=require("./numberFormattingFunction-02t-wJta.cjs"),X=require("./use-in-view-sQJZ_xDO.cjs"),Y=require("./index-BW8iNx7E.cjs"),Z=require("./proxy-BHRoeZgd.cjs");function _(z){const{data:n,size:g=200,graphTitle:x,sources:R,colors:E=K.Colors.light.categoricalColors.colors,graphDescription:d,totalNoOfDots:f=100,unitPadding:G=3,gridSize:c=10,footNote:b,padding:N,backgroundColor:l=!1,graphID:H,graphDownload:k=!1,language:j="en",showColorScale:I=!0,showStrokeForWhiteDots:m=!0,note:C,dataDownload:S=!1,theme:P="light",width:r,height:h,minHeight:s=0,relativeHeight:a,ariaLabel:T,styles:u,classNames:w,animate:$=!1,precision:L=2}=z,q=F.useRef(null),y=$===!0?{duration:.5,once:!0,amount:.5}:$||{duration:0,once:!0,amount:0},W=X.useInView(q,{once:y.once,amount:y.amount}),B=O.sum(n.map(e=>e.value)),D=F.useRef(null),o=g/c,p=(o-G*2)/2;if(p<=0)return console.error("The size of single unit is less than or equal to zero. Check values for ((dimension / gridSize) - (padding * 2)) / 2 is not less than or equal to 0."),null;const v=[];return n.forEach((e,i)=>{const A=Math.round(e.value/B*f);for(let V=0;V<A;V+=1)v.push({color:E[i]})}),t.jsxRuntimeExports.jsx("div",{className:`${P||"light"} flex ${r?"w-fit grow-0":"w-full grow"}`,dir:j==="he"||j==="ar"?"rtl":void 0,children:t.jsxRuntimeExports.jsx("div",{className:t.mo(`${l?l===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${j||"en"}`,w?.graphContainer),style:{...u?.graphContainer||{},minHeight:"inherit",...l&&l!==!0?{backgroundColor:l}:{}},id:H,ref:D,"aria-label":T||`${x?`The graph shows ${x}. `:""}${d?` ${d}`:""}`,children:t.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:l?N||"1rem":N||0},children:t.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-3 w-full grow",children:[x||d||k?t.jsxRuntimeExports.jsx(J.GraphHeader,{styles:{title:u?.title,description:u?.description},classNames:{title:w?.title,description:w?.description},graphTitle:x,graphDescription:d,width:r,graphDownload:k?D.current:void 0,dataDownload:S?n.map(e=>e.data).filter(e=>e!==void 0).length>0?n.map(e=>e.data).filter(e=>e!==void 0):n.filter(e=>e!==void 0):null}):null,C?t.jsxRuntimeExports.jsx(M.f,{marginBottom:"2xs",className:"text-primary-gray-700 dark:text-primary-gray-100 font-bold",style:{width:r?`${r}px`:"100%"},children:C}):null,t.jsxRuntimeExports.jsxs("div",{className:"flex grow flex-col gap-4 justify-between",children:[t.jsxRuntimeExports.jsxs("div",{children:[I?t.jsxRuntimeExports.jsx("div",{className:"mb-4 leading-0",style:{width:r?`${r}px`:"100%"},"aria-label":"Color legend",children:t.jsxRuntimeExports.jsx("div",{className:"flex mb-0 flex-wrap gap-x-4 gap-y-1",children:n.map((e,i)=>t.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 items-center",children:[t.jsxRuntimeExports.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:E[i]}}),t.jsxRuntimeExports.jsxs(M.u,{marginBottom:"none",size:"sm",className:"text-primary-gray-700 dark:text-primary-gray-100",children:[e.label,":"," ",t.jsxRuntimeExports.jsx("span",{className:"font-bold",children:Q.numberFormattingFunction(e.value,"NA",L)})]})]},i))})}):null,t.jsxRuntimeExports.jsx("div",{"aria-label":"Graph area",children:t.jsxRuntimeExports.jsx("svg",{width:`${r||g}px`,height:`${Math.max(s,h?a&&r?s?r*a>s?r*a:s:r*a:h:Math.floor((f-1)/c)*o+o/2+p+5)}px`,ref:q,direction:"ltr",viewBox:`0 0 ${r||g} ${Math.max(s,h?a&&r?s?r*a>s?r*a:s:r*a:h:Math.floor((f-1)/c)*o+o/2+p+5)}`,children:t.jsxRuntimeExports.jsx(Y.AnimatePresence,{children:t.jsxRuntimeExports.jsx("g",{children:v.map((e,i)=>t.jsxRuntimeExports.jsx(Z.motion.circle,{cx:i%c*o+o/2,cy:Math.floor(i/c)*o+o/2,style:{...m?{}:{stroke:e.color},strokeWidth:1},variants:{initial:{fill:"#fff",opacity:0,...m?{}:{stroke:e.color},strokeWidth:1},whileInView:{fill:e.color,opacity:1,...m?{}:{stroke:e.color},strokeWidth:1,transition:{duration:0,delay:y.duration/v.length*i}}},initial:"initial",animate:W?"whileInView":"initial",className:(e.color.toLowerCase()==="#fff"||e.color.toLowerCase()==="#ffffff"||e.color.toLowerCase()==="white")&&m?"stroke-primary-gray-400 dark:stroke-primary-gray-500":"",r:p},i))})})})})]}),R||b?t.jsxRuntimeExports.jsx(U.GraphFooter,{styles:{footnote:u?.footnote,source:u?.source},sources:R,footNote:b,width:r}):null]})]})})})})}exports.UnitChart=_;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-CHPV5EwG-DDoeWRVt.cjs"),F=require("react"),O=require("./index-C21TvELx.cjs"),M=require("./Typography-k-kOjICQ.cjs"),U=require("./GraphFooter.cjs"),J=require("./GraphHeader.cjs"),K=require("./Colors.cjs"),Q=require("./numberFormattingFunction-02t-wJta.cjs"),X=require("./use-in-view-sQJZ_xDO.cjs"),Y=require("./index-BW8iNx7E.cjs"),Z=require("./proxy-BHRoeZgd.cjs");function _(z){const{data:n,size:g=200,graphTitle:x,sources:R,colors:E=K.Colors.light.categoricalColors.colors,graphDescription:d,totalNoOfDots:f=100,unitPadding:G=3,gridSize:c=10,footNote:b,padding:N,backgroundColor:l=!1,graphID:H,graphDownload:k=!1,language:j="en",showColorScale:I=!0,showStrokeForWhiteDots:m=!0,note:C,dataDownload:S=!1,theme:P="light",width:r,height:h,minHeight:s=0,relativeHeight:a,ariaLabel:T,styles:u,classNames:w,animate:$=!1,precision:L=2}=z,q=F.useRef(null),y=$===!0?{duration:.5,once:!0,amount:.5}:$||{duration:0,once:!0,amount:0},W=X.useInView(q,{once:y.once,amount:y.amount}),B=O.sum(n.map(e=>e.value)),D=F.useRef(null),o=g/c,p=(o-G*2)/2;if(p<=0)return console.error("The size of single unit is less than or equal to zero. Check values for ((dimension / gridSize) - (padding * 2)) / 2 is not less than or equal to 0."),null;const v=[];return n.forEach((e,i)=>{const A=Math.round(e.value/B*f);for(let V=0;V<A;V+=1)v.push({color:E[i]})}),t.jsxRuntimeExports.jsx("div",{className:`${P||"light"} flex ${r?"w-fit grow-0":"w-full grow"}`,dir:j==="he"||j==="ar"?"rtl":void 0,children:t.jsxRuntimeExports.jsx("div",{className:t.mo(`${l?l===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${j||"en"}`,r?"w-fit":"w-full",w?.graphContainer),style:{...u?.graphContainer||{},minHeight:"inherit",...l&&l!==!0?{backgroundColor:l}:{}},id:H,ref:D,"aria-label":T||`${x?`The graph shows ${x}. `:""}${d?` ${d}`:""}`,children:t.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:l?N||"1rem":N||0},children:t.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-3 w-full grow",children:[x||d||k?t.jsxRuntimeExports.jsx(J.GraphHeader,{styles:{title:u?.title,description:u?.description},classNames:{title:w?.title,description:w?.description},graphTitle:x,graphDescription:d,width:r,graphDownload:k?D.current:void 0,dataDownload:S?n.map(e=>e.data).filter(e=>e!==void 0).length>0?n.map(e=>e.data).filter(e=>e!==void 0):n.filter(e=>e!==void 0):null}):null,C?t.jsxRuntimeExports.jsx(M.f,{marginBottom:"2xs",className:"text-primary-gray-700 dark:text-primary-gray-100 font-bold",style:{width:r?`${r}px`:"100%"},children:C}):null,t.jsxRuntimeExports.jsxs("div",{className:"flex grow flex-col gap-4 justify-between",children:[t.jsxRuntimeExports.jsxs("div",{children:[I?t.jsxRuntimeExports.jsx("div",{className:"mb-4 leading-0",style:{width:r?`${r}px`:"100%"},"aria-label":"Color legend",children:t.jsxRuntimeExports.jsx("div",{className:"flex mb-0 flex-wrap gap-x-4 gap-y-1",children:n.map((e,i)=>t.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 items-center",children:[t.jsxRuntimeExports.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:E[i]}}),t.jsxRuntimeExports.jsxs(M.u,{marginBottom:"none",size:"sm",className:"text-primary-gray-700 dark:text-primary-gray-100",children:[e.label,":"," ",t.jsxRuntimeExports.jsx("span",{className:"font-bold",children:Q.numberFormattingFunction(e.value,"NA",L)})]})]},i))})}):null,t.jsxRuntimeExports.jsx("div",{"aria-label":"Graph area",children:t.jsxRuntimeExports.jsx("svg",{width:`${r||g}px`,height:`${Math.max(s,h?a&&r?s?r*a>s?r*a:s:r*a:h:Math.floor((f-1)/c)*o+o/2+p+5)}px`,ref:q,direction:"ltr",viewBox:`0 0 ${r||g} ${Math.max(s,h?a&&r?s?r*a>s?r*a:s:r*a:h:Math.floor((f-1)/c)*o+o/2+p+5)}`,children:t.jsxRuntimeExports.jsx(Y.AnimatePresence,{children:t.jsxRuntimeExports.jsx("g",{children:v.map((e,i)=>t.jsxRuntimeExports.jsx(Z.motion.circle,{cx:i%c*o+o/2,cy:Math.floor(i/c)*o+o/2,style:{...m?{}:{stroke:e.color},strokeWidth:1},variants:{initial:{fill:"#fff",opacity:0,...m?{}:{stroke:e.color},strokeWidth:1},whileInView:{fill:e.color,opacity:1,...m?{}:{stroke:e.color},strokeWidth:1,transition:{duration:0,delay:y.duration/v.length*i}}},initial:"initial",animate:W?"whileInView":"initial",className:(e.color.toLowerCase()==="#fff"||e.color.toLowerCase()==="#ffffff"||e.color.toLowerCase()==="white")&&m?"stroke-primary-gray-400 dark:stroke-primary-gray-500":"",r:p},i))})})})})]}),R||b?t.jsxRuntimeExports.jsx(U.GraphFooter,{styles:{footnote:u?.footnote,source:u?.source},sources:R,footNote:b,width:r}):null]})]})})})})}exports.UnitChart=_;
2
2
  //# sourceMappingURL=UnitChart.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"UnitChart.cjs","sources":["../src/Components/Graphs/UnitChart/index.tsx"],"sourcesContent":["import { useRef } from 'react';\r\nimport sum from 'lodash.sum';\r\nimport { H2, P } from '@undp/design-system-react/Typography';\r\nimport { AnimatePresence, motion, useInView } from 'motion/react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport {\r\n UnitChartDataType,\r\n SourcesDataType,\r\n Languages,\r\n StyleObject,\r\n ClassNameObject,\r\n AnimateDataType,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: UnitChartDataType[];\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 /** Note with h2 tag just above the graph. Can be used to highlight text */\r\n note?: string;\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 /** Colors of the highlighted circles */\r\n colors?: 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\r\n // Graph Parameters\r\n /** Size of the visualization */\r\n size?: number;\r\n /** No. of dots in a single row */\r\n gridSize?: number;\r\n /** Spacing between 2 dots */\r\n unitPadding?: number;\r\n /** Total no. of dot that are rendered in the chart */\r\n totalNoOfDots?: number;\r\n /** Toggle visibility of stroke for the unfilled dots */\r\n showStrokeForWhiteDots?: boolean;\r\n /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\r\n /** Toggle visibility of color scale */\r\n showColorScale?: boolean;\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\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 UnitChart(props: Props) {\r\n const {\r\n data,\r\n size = 200,\r\n graphTitle,\r\n sources,\r\n colors = Colors.light.categoricalColors.colors,\r\n graphDescription,\r\n totalNoOfDots = 100,\r\n unitPadding = 3,\r\n gridSize = 10,\r\n footNote,\r\n padding,\r\n backgroundColor = false,\r\n graphID,\r\n graphDownload = false,\r\n language = 'en',\r\n showColorScale = true,\r\n showStrokeForWhiteDots = true,\r\n note,\r\n dataDownload = false,\r\n theme = 'light',\r\n width,\r\n height,\r\n minHeight = 0,\r\n relativeHeight,\r\n ariaLabel,\r\n styles,\r\n classNames,\r\n animate = false,\r\n precision = 2,\r\n } = props;\r\n const svgRef = useRef(null);\r\n const animateValue =\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 const isInView = useInView(svgRef, {\r\n once: animateValue.once,\r\n amount: animateValue.amount,\r\n });\r\n const totalValue = sum(data.map(d => d.value));\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n const gridDimension = size / gridSize;\r\n const radius = (gridDimension - unitPadding * 2) / 2;\r\n if (radius <= 0) {\r\n console.error(\r\n 'The size of single unit is less than or equal to zero. Check values for ((dimension / gridSize) - (padding * 2)) / 2 is not less than or equal to 0.',\r\n );\r\n return null;\r\n }\r\n\r\n const cellsData: { color: string }[] = [];\r\n data.forEach((item, index) => {\r\n const count = Math.round((item.value / totalValue) * totalNoOfDots);\r\n for (let i = 0; i < count; i += 1) {\r\n cellsData.push({ color: colors[index] });\r\n }\r\n });\r\n return (\r\n <div\r\n className={`${theme || 'light'} flex ${width ? 'w-fit grow-0' : 'w-full grow'}`}\r\n dir={language === 'he' || language === 'ar' ? 'rtl' : undefined}\r\n >\r\n <div\r\n className={cn(\r\n `${\r\n !backgroundColor\r\n ? 'bg-transparent '\r\n : backgroundColor === true\r\n ? 'bg-primary-gray-200 dark:bg-primary-gray-650 '\r\n : ''\r\n }ml-auto mr-auto flex flex-col grow h-inherit ${language || 'en'}`,\r\n classNames?.graphContainer,\r\n )}\r\n style={{\r\n ...(styles?.graphContainer || {}),\r\n minHeight: 'inherit',\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 `${graphTitle ? `The graph shows ${graphTitle}. ` : ''}${\r\n graphDescription ? ` ${graphDescription}` : ''\r\n }`\r\n }\r\n >\r\n <div\r\n className='flex grow'\r\n style={{ padding: backgroundColor ? padding || '1rem' : padding || 0 }}\r\n >\r\n <div className='flex flex-col gap-3 w-full grow'>\r\n {graphTitle || graphDescription || graphDownload ? (\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 {note ? (\r\n <H2\r\n marginBottom='2xs'\r\n className='text-primary-gray-700 dark:text-primary-gray-100 font-bold'\r\n style={{ width: width ? `${width}px` : '100%' }}\r\n >\r\n {note}\r\n </H2>\r\n ) : null}\r\n <div className='flex grow flex-col gap-4 justify-between'>\r\n <div>\r\n {showColorScale ? (\r\n <div\r\n className='mb-4 leading-0'\r\n style={{ width: width ? `${width}px` : '100%' }}\r\n aria-label='Color legend'\r\n >\r\n <div className='flex mb-0 flex-wrap gap-x-4 gap-y-1'>\r\n {data.map((d, i) => (\r\n <div className='flex gap-2 items-center' key={i}>\r\n <div\r\n className='w-3 h-3 rounded-full'\r\n style={{ backgroundColor: colors[i] }}\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'>\r\n {numberFormattingFunction(d.value, 'NA', precision)}\r\n </span>\r\n </P>\r\n </div>\r\n ))}\r\n </div>\r\n </div>\r\n ) : null}\r\n <div aria-label='Graph area'>\r\n <svg\r\n width={`${width || size}px`}\r\n height={`${Math.max(\r\n minHeight,\r\n height\r\n ? relativeHeight && width\r\n ? minHeight\r\n ? width * relativeHeight > minHeight\r\n ? width * relativeHeight\r\n : minHeight\r\n : width * relativeHeight\r\n : height\r\n : Math.floor((totalNoOfDots - 1) / gridSize) * gridDimension +\r\n gridDimension / 2 +\r\n radius +\r\n 5,\r\n )}px`}\r\n ref={svgRef}\r\n direction='ltr'\r\n viewBox={`0 0 ${width || size} ${Math.max(\r\n minHeight,\r\n height\r\n ? relativeHeight && width\r\n ? minHeight\r\n ? width * relativeHeight > minHeight\r\n ? width * relativeHeight\r\n : minHeight\r\n : width * relativeHeight\r\n : height\r\n : Math.floor((totalNoOfDots - 1) / gridSize) * gridDimension +\r\n gridDimension / 2 +\r\n radius +\r\n 5,\r\n )}`}\r\n >\r\n <AnimatePresence>\r\n <g>\r\n {cellsData.map((d, i) => (\r\n <motion.circle\r\n key={i}\r\n cx={(i % gridSize) * gridDimension + gridDimension / 2}\r\n cy={Math.floor(i / gridSize) * gridDimension + gridDimension / 2}\r\n style={{\r\n ...(!showStrokeForWhiteDots ? { stroke: d.color } : {}),\r\n strokeWidth: 1,\r\n }}\r\n variants={{\r\n initial: {\r\n fill: '#fff',\r\n opacity: 0,\r\n ...(!showStrokeForWhiteDots ? { stroke: d.color } : {}),\r\n strokeWidth: 1,\r\n },\r\n whileInView: {\r\n fill: d.color,\r\n opacity: 1,\r\n ...(!showStrokeForWhiteDots ? { stroke: d.color } : {}),\r\n strokeWidth: 1,\r\n transition: {\r\n duration: 0,\r\n delay: (animateValue.duration / cellsData.length) * i,\r\n },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n className={\r\n (d.color.toLowerCase() === '#fff' ||\r\n d.color.toLowerCase() === '#ffffff' ||\r\n d.color.toLowerCase() === 'white') &&\r\n showStrokeForWhiteDots\r\n ? 'stroke-primary-gray-400 dark:stroke-primary-gray-500'\r\n : ''\r\n }\r\n r={radius}\r\n />\r\n ))}\r\n </g>\r\n </AnimatePresence>\r\n </svg>\r\n </div>\r\n </div>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{\r\n footnote: styles?.footnote,\r\n source: styles?.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 </div>\r\n );\r\n}\r\n"],"names":["UnitChart","props","data","size","graphTitle","sources","colors","Colors","graphDescription","totalNoOfDots","unitPadding","gridSize","footNote","padding","backgroundColor","graphID","graphDownload","language","showColorScale","showStrokeForWhiteDots","note","dataDownload","theme","width","height","minHeight","relativeHeight","ariaLabel","styles","classNames","animate","precision","svgRef","useRef","animateValue","isInView","useInView","totalValue","sum","d","graphParentDiv","gridDimension","radius","cellsData","item","index","count","i","jsx","cn","jsxs","GraphHeader","H2","P","AnimatePresence","motion","GraphFooter"],"mappings":"sdA2FO,SAASA,EAAUC,EAAc,CACtC,KAAM,CACJ,KAAAC,EACA,KAAAC,EAAO,IACP,WAAAC,EACA,QAAAC,EACA,OAAAC,EAASC,EAAAA,OAAO,MAAM,kBAAkB,OACxC,iBAAAC,EACA,cAAAC,EAAgB,IAChB,YAAAC,EAAc,EACd,SAAAC,EAAW,GACX,SAAAC,EACA,QAAAC,EACA,gBAAAC,EAAkB,GAClB,QAAA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"sourcesContent":["import { useRef } from 'react';\r\nimport sum from 'lodash.sum';\r\nimport { H2, P } from '@undp/design-system-react/Typography';\r\nimport { AnimatePresence, motion, useInView } from 'motion/react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport {\r\n UnitChartDataType,\r\n SourcesDataType,\r\n Languages,\r\n StyleObject,\r\n ClassNameObject,\r\n AnimateDataType,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: UnitChartDataType[];\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 /** Note with h2 tag just above the graph. Can be used to highlight text */\r\n note?: string;\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 /** Colors of the highlighted circles */\r\n colors?: 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\r\n // Graph Parameters\r\n /** Size of the visualization */\r\n size?: number;\r\n /** No. of dots in a single row */\r\n gridSize?: number;\r\n /** Spacing between 2 dots */\r\n unitPadding?: number;\r\n /** Total no. of dot that are rendered in the chart */\r\n totalNoOfDots?: number;\r\n /** Toggle visibility of stroke for the unfilled dots */\r\n showStrokeForWhiteDots?: boolean;\r\n /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\r\n /** Toggle visibility of color scale */\r\n showColorScale?: boolean;\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\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 UnitChart(props: Props) {\r\n const {\r\n data,\r\n size = 200,\r\n graphTitle,\r\n sources,\r\n colors = Colors.light.categoricalColors.colors,\r\n graphDescription,\r\n totalNoOfDots = 100,\r\n unitPadding = 3,\r\n gridSize = 10,\r\n footNote,\r\n padding,\r\n backgroundColor = false,\r\n graphID,\r\n graphDownload = false,\r\n language = 'en',\r\n showColorScale = true,\r\n showStrokeForWhiteDots = true,\r\n note,\r\n dataDownload = false,\r\n theme = 'light',\r\n width,\r\n height,\r\n minHeight = 0,\r\n relativeHeight,\r\n ariaLabel,\r\n styles,\r\n classNames,\r\n animate = false,\r\n precision = 2,\r\n } = props;\r\n const svgRef = useRef(null);\r\n const animateValue =\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 const isInView = useInView(svgRef, {\r\n once: animateValue.once,\r\n amount: animateValue.amount,\r\n });\r\n const totalValue = sum(data.map(d => d.value));\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n const gridDimension = size / gridSize;\r\n const radius = (gridDimension - unitPadding * 2) / 2;\r\n if (radius <= 0) {\r\n console.error(\r\n 'The size of single unit is less than or equal to zero. Check values for ((dimension / gridSize) - (padding * 2)) / 2 is not less than or equal to 0.',\r\n );\r\n return null;\r\n }\r\n\r\n const cellsData: { color: string }[] = [];\r\n data.forEach((item, index) => {\r\n const count = Math.round((item.value / totalValue) * totalNoOfDots);\r\n for (let i = 0; i < count; i += 1) {\r\n cellsData.push({ color: colors[index] });\r\n }\r\n });\r\n return (\r\n <div\r\n className={`${theme || 'light'} flex ${width ? 'w-fit grow-0' : 'w-full grow'}`}\r\n dir={language === 'he' || language === 'ar' ? 'rtl' : undefined}\r\n >\r\n <div\r\n className={cn(\r\n `${\r\n !backgroundColor\r\n ? 'bg-transparent '\r\n : backgroundColor === true\r\n ? 'bg-primary-gray-200 dark:bg-primary-gray-650 '\r\n : ''\r\n }ml-auto mr-auto flex flex-col grow h-inherit ${language || 'en'}`,\r\n width ? 'w-fit' : 'w-full',\r\n classNames?.graphContainer,\r\n )}\r\n style={{\r\n ...(styles?.graphContainer || {}),\r\n minHeight: 'inherit',\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 `${graphTitle ? `The graph shows ${graphTitle}. ` : ''}${\r\n graphDescription ? ` ${graphDescription}` : ''\r\n }`\r\n }\r\n >\r\n <div\r\n className='flex grow'\r\n style={{ padding: backgroundColor ? padding || '1rem' : padding || 0 }}\r\n >\r\n <div className='flex flex-col gap-3 w-full grow'>\r\n {graphTitle || graphDescription || graphDownload ? (\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 {note ? (\r\n <H2\r\n marginBottom='2xs'\r\n className='text-primary-gray-700 dark:text-primary-gray-100 font-bold'\r\n style={{ width: width ? `${width}px` : '100%' }}\r\n >\r\n {note}\r\n </H2>\r\n ) : null}\r\n <div className='flex grow flex-col gap-4 justify-between'>\r\n <div>\r\n {showColorScale ? (\r\n <div\r\n className='mb-4 leading-0'\r\n style={{ width: width ? `${width}px` : '100%' }}\r\n aria-label='Color legend'\r\n >\r\n <div className='flex mb-0 flex-wrap gap-x-4 gap-y-1'>\r\n {data.map((d, i) => (\r\n <div className='flex gap-2 items-center' key={i}>\r\n <div\r\n className='w-3 h-3 rounded-full'\r\n style={{ backgroundColor: colors[i] }}\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'>\r\n {numberFormattingFunction(d.value, 'NA', precision)}\r\n </span>\r\n </P>\r\n </div>\r\n ))}\r\n </div>\r\n </div>\r\n ) : null}\r\n <div aria-label='Graph area'>\r\n <svg\r\n width={`${width || size}px`}\r\n height={`${Math.max(\r\n minHeight,\r\n height\r\n ? relativeHeight && width\r\n ? minHeight\r\n ? width * relativeHeight > minHeight\r\n ? width * relativeHeight\r\n : minHeight\r\n : width * relativeHeight\r\n : height\r\n : Math.floor((totalNoOfDots - 1) / gridSize) * gridDimension +\r\n gridDimension / 2 +\r\n radius +\r\n 5,\r\n )}px`}\r\n ref={svgRef}\r\n direction='ltr'\r\n viewBox={`0 0 ${width || size} ${Math.max(\r\n minHeight,\r\n height\r\n ? relativeHeight && width\r\n ? minHeight\r\n ? width * relativeHeight > minHeight\r\n ? width * relativeHeight\r\n : minHeight\r\n : width * relativeHeight\r\n : height\r\n : Math.floor((totalNoOfDots - 1) / gridSize) * gridDimension +\r\n gridDimension / 2 +\r\n radius +\r\n 5,\r\n )}`}\r\n >\r\n <AnimatePresence>\r\n <g>\r\n {cellsData.map((d, i) => (\r\n <motion.circle\r\n key={i}\r\n cx={(i % gridSize) * gridDimension + gridDimension / 2}\r\n cy={Math.floor(i / gridSize) * gridDimension + gridDimension / 2}\r\n style={{\r\n ...(!showStrokeForWhiteDots ? { stroke: d.color } : {}),\r\n strokeWidth: 1,\r\n }}\r\n variants={{\r\n initial: {\r\n fill: '#fff',\r\n opacity: 0,\r\n ...(!showStrokeForWhiteDots ? { stroke: d.color } : {}),\r\n strokeWidth: 1,\r\n },\r\n whileInView: {\r\n fill: d.color,\r\n opacity: 1,\r\n ...(!showStrokeForWhiteDots ? { stroke: d.color } : {}),\r\n strokeWidth: 1,\r\n transition: {\r\n duration: 0,\r\n delay: (animateValue.duration / cellsData.length) * i,\r\n },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n className={\r\n (d.color.toLowerCase() === '#fff' ||\r\n d.color.toLowerCase() === '#ffffff' ||\r\n d.color.toLowerCase() === 'white') &&\r\n showStrokeForWhiteDots\r\n ? 'stroke-primary-gray-400 dark:stroke-primary-gray-500'\r\n : ''\r\n }\r\n r={radius}\r\n />\r\n ))}\r\n </g>\r\n </AnimatePresence>\r\n </svg>\r\n </div>\r\n </div>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{\r\n footnote: styles?.footnote,\r\n source: styles?.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 </div>\r\n );\r\n}\r\n"],"names":["UnitChart","props","data","size","graphTitle","sources","colors","Colors","graphDescription","totalNoOfDots","unitPadding","gridSize","footNote","padding","backgroundColor","graphID","graphDownload","language","showColorScale","showStrokeForWhiteDots","note","dataDownload","theme","width","height","minHeight","relativeHeight","ariaLabel","styles","classNames","animate","precision","svgRef","useRef","animateValue","isInView","useInView","totalValue","sum","d","graphParentDiv","gridDimension","radius","cellsData","item","index","count","i","jsx","cn","jsxs","GraphHeader","H2","P","AnimatePresence","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rC,GAAWO,EACVoC,EAAAA,kBAAAA,IAACQ,EAAAA,YAAA,CACC,OAAQ,CACN,SAAU5B,GAAQ,SAClB,OAAQA,GAAQ,MAAA,EAElB,QAAAvB,EACA,SAAAO,EACA,MAAAW,CAAA,CAAA,EAEA,IAAA,CAAA,CACN,CAAA,CAAA,CACF,CAAA,CAAA,CACF,CAAA,CACF,CAAA,CAGN"}
package/dist/UnitChart.js CHANGED
@@ -12,7 +12,7 @@ import { m as ee } from "./proxy-CkpFesk1.js";
12
12
  function he(H) {
13
13
  const {
14
14
  data: s,
15
- size: u = 200,
15
+ size: p = 200,
16
16
  graphTitle: d,
17
17
  sources: N,
18
18
  colors: b = X.light.categoricalColors.colors,
@@ -32,7 +32,7 @@ function he(H) {
32
32
  dataDownload: A = !1,
33
33
  theme: B = "light",
34
34
  width: o,
35
- height: g,
35
+ height: u,
36
36
  minHeight: i = 0,
37
37
  relativeHeight: l,
38
38
  ariaLabel: G,
@@ -43,8 +43,8 @@ function he(H) {
43
43
  } = H, M = F(null), v = z === !0 ? { duration: 0.5, once: !0, amount: 0.5 } : z || { duration: 0, once: !0, amount: 0 }, R = Z(M, {
44
44
  once: v.once,
45
45
  amount: v.amount
46
- }), T = O(s.map((e) => e.value)), V = F(null), a = u / c, p = (a - L * 2) / 2;
47
- if (p <= 0)
46
+ }), T = O(s.map((e) => e.value)), V = F(null), a = p / c, g = (a - L * 2) / 2;
47
+ if (g <= 0)
48
48
  return console.error(
49
49
  "The size of single unit is less than or equal to zero. Check values for ((dimension / gridSize) - (padding * 2)) / 2 is not less than or equal to 0."
50
50
  ), null;
@@ -63,6 +63,7 @@ function he(H) {
63
63
  {
64
64
  className: E(
65
65
  `${n ? n === !0 ? "bg-primary-gray-200 dark:bg-primary-gray-650 " : "" : "bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${w || "en"}`,
66
+ o ? "w-fit" : "w-full",
66
67
  y?.graphContainer
67
68
  ),
68
69
  style: {
@@ -142,16 +143,16 @@ function he(H) {
142
143
  /* @__PURE__ */ r.jsx("div", { "aria-label": "Graph area", children: /* @__PURE__ */ r.jsx(
143
144
  "svg",
144
145
  {
145
- width: `${o || u}px`,
146
+ width: `${o || p}px`,
146
147
  height: `${Math.max(
147
148
  i,
148
- g ? l && o ? i ? o * l > i ? o * l : i : o * l : g : Math.floor((x - 1) / c) * a + a / 2 + p + 5
149
+ u ? l && o ? i ? o * l > i ? o * l : i : o * l : u : Math.floor((x - 1) / c) * a + a / 2 + g + 5
149
150
  )}px`,
150
151
  ref: M,
151
152
  direction: "ltr",
152
- viewBox: `0 0 ${o || u} ${Math.max(
153
+ viewBox: `0 0 ${o || p} ${Math.max(
153
154
  i,
154
- g ? l && o ? i ? o * l > i ? o * l : i : o * l : g : Math.floor((x - 1) / c) * a + a / 2 + p + 5
155
+ u ? l && o ? i ? o * l > i ? o * l : i : o * l : u : Math.floor((x - 1) / c) * a + a / 2 + g + 5
155
156
  )}`,
156
157
  children: /* @__PURE__ */ r.jsx(_, { children: /* @__PURE__ */ r.jsx("g", { children: j.map((e, t) => /* @__PURE__ */ r.jsx(
157
158
  ee.circle,
@@ -183,7 +184,7 @@ function he(H) {
183
184
  initial: "initial",
184
185
  animate: R ? "whileInView" : "initial",
185
186
  className: (e.color.toLowerCase() === "#fff" || e.color.toLowerCase() === "#ffffff" || e.color.toLowerCase() === "white") && f ? "stroke-primary-gray-400 dark:stroke-primary-gray-500" : "",
186
- r: p
187
+ r: g
187
188
  },
188
189
  t
189
190
  )) }) })