@undp/data-viz 1.4.13 → 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 (159) 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.js +52 -51
  58. package/dist/DualAxisLineChart.js.map +1 -1
  59. package/dist/DumbbellChart.cjs +1 -1
  60. package/dist/DumbbellChart.cjs.map +1 -1
  61. package/dist/DumbbellChart.js +216 -214
  62. package/dist/DumbbellChart.js.map +1 -1
  63. package/dist/GeoHubCompareMaps.cjs +1 -1
  64. package/dist/GeoHubCompareMaps.cjs.map +1 -1
  65. package/dist/GeoHubCompareMaps.js +1 -0
  66. package/dist/GeoHubCompareMaps.js.map +1 -1
  67. package/dist/GeoHubMap.cjs +1 -1
  68. package/dist/GeoHubMap.cjs.map +1 -1
  69. package/dist/GeoHubMap.js +29 -28
  70. package/dist/GeoHubMap.js.map +1 -1
  71. package/dist/GeoHubMapWithLayerSelection.cjs +1 -1
  72. package/dist/GeoHubMapWithLayerSelection.cjs.map +1 -1
  73. package/dist/GeoHubMapWithLayerSelection.js +34 -33
  74. package/dist/GeoHubMapWithLayerSelection.js.map +1 -1
  75. package/dist/{GraphEl-B3xVlimz.js → GraphEl-N6vuMRw_.js} +2 -2
  76. package/dist/{GraphEl-B3xVlimz.js.map → GraphEl-N6vuMRw_.js.map} +1 -1
  77. package/dist/{GraphEl-DO-juRN8.cjs → GraphEl-Zl0W-LK9.cjs} +2 -2
  78. package/dist/{GraphEl-DO-juRN8.cjs.map → GraphEl-Zl0W-LK9.cjs.map} +1 -1
  79. package/dist/GriddedGraphs.cjs +1 -1
  80. package/dist/GriddedGraphs.js +2 -2
  81. package/dist/HeatMap.cjs +1 -1
  82. package/dist/HeatMap.cjs.map +1 -1
  83. package/dist/HeatMap.js +55 -54
  84. package/dist/HeatMap.js.map +1 -1
  85. package/dist/Histogram.cjs +1 -1
  86. package/dist/Histogram.js +1 -1
  87. package/dist/LineChartWithConfidenceInterval.cjs +1 -1
  88. package/dist/LineChartWithConfidenceInterval.cjs.map +1 -1
  89. package/dist/LineChartWithConfidenceInterval.js +22 -21
  90. package/dist/LineChartWithConfidenceInterval.js.map +1 -1
  91. package/dist/MultiGraphDashboard.cjs +1 -1
  92. package/dist/MultiGraphDashboard.js +1 -1
  93. package/dist/MultiGraphDashboardWideToLongFormat.cjs +1 -1
  94. package/dist/MultiGraphDashboardWideToLongFormat.js +1 -1
  95. package/dist/MultiLineAltChart.cjs +1 -1
  96. package/dist/MultiLineAltChart.cjs.map +1 -1
  97. package/dist/MultiLineAltChart.js +34 -33
  98. package/dist/MultiLineAltChart.js.map +1 -1
  99. package/dist/MultiLineChart.cjs +1 -1
  100. package/dist/MultiLineChart.cjs.map +1 -1
  101. package/dist/MultiLineChart.js +72 -71
  102. package/dist/MultiLineChart.js.map +1 -1
  103. package/dist/ParetoChart.cjs +1 -1
  104. package/dist/ParetoChart.cjs.map +1 -1
  105. package/dist/ParetoChart.js +22 -21
  106. package/dist/ParetoChart.js.map +1 -1
  107. package/dist/PerformanceIntensiveMultiGraphDashboard.cjs +1 -1
  108. package/dist/PerformanceIntensiveMultiGraphDashboard.js +1 -1
  109. package/dist/RadarChart.cjs +1 -1
  110. package/dist/RadarChart.cjs.map +1 -1
  111. package/dist/RadarChart.js +27 -26
  112. package/dist/RadarChart.js.map +1 -1
  113. package/dist/SankeyChart.cjs +1 -1
  114. package/dist/SankeyChart.cjs.map +1 -1
  115. package/dist/SankeyChart.js +30 -29
  116. package/dist/SankeyChart.js.map +1 -1
  117. package/dist/ScatterPlot.cjs +1 -1
  118. package/dist/ScatterPlot.cjs.map +1 -1
  119. package/dist/ScatterPlot.js +119 -118
  120. package/dist/ScatterPlot.js.map +1 -1
  121. package/dist/SimpleLineChart.cjs +1 -1
  122. package/dist/SimpleLineChart.cjs.map +1 -1
  123. package/dist/SimpleLineChart.js +16 -15
  124. package/dist/SimpleLineChart.js.map +1 -1
  125. package/dist/SingleGraphDashboard.cjs +1 -1
  126. package/dist/SingleGraphDashboard.js +2 -2
  127. package/dist/SingleGraphDashboardThreeDGraphs.cjs +1 -1
  128. package/dist/SingleGraphDashboardThreeDGraphs.js +1 -1
  129. package/dist/SlopeChart.cjs +1 -1
  130. package/dist/SlopeChart.cjs.map +1 -1
  131. package/dist/SlopeChart.js +46 -45
  132. package/dist/SlopeChart.js.map +1 -1
  133. package/dist/SparkLine.cjs +1 -1
  134. package/dist/SparkLine.cjs.map +1 -1
  135. package/dist/SparkLine.js +12 -11
  136. package/dist/SparkLine.js.map +1 -1
  137. package/dist/StripChart.cjs +1 -1
  138. package/dist/StripChart.cjs.map +1 -1
  139. package/dist/StripChart.js +81 -79
  140. package/dist/StripChart.js.map +1 -1
  141. package/dist/ThreeDGlobe.cjs +1 -1
  142. package/dist/ThreeDGlobe.cjs.map +1 -1
  143. package/dist/ThreeDGlobe.js +1 -0
  144. package/dist/ThreeDGlobe.js.map +1 -1
  145. package/dist/TreeMapGraph.cjs +1 -1
  146. package/dist/TreeMapGraph.cjs.map +1 -1
  147. package/dist/TreeMapGraph.js +114 -113
  148. package/dist/TreeMapGraph.js.map +1 -1
  149. package/dist/UnitChart.cjs +1 -1
  150. package/dist/UnitChart.cjs.map +1 -1
  151. package/dist/UnitChart.js +10 -9
  152. package/dist/UnitChart.js.map +1 -1
  153. package/dist/{index-CZLvTu6p.cjs → index-BbNoLJ_w.cjs} +2 -2
  154. package/dist/{index-CZLvTu6p.cjs.map → index-BbNoLJ_w.cjs.map} +1 -1
  155. package/dist/{index-DGAaLNu9.js → index-Bc5VF70V.js} +46 -45
  156. package/dist/{index-DGAaLNu9.js.map → index-Bc5VF70V.js.map} +1 -1
  157. package/dist/index.cjs +1 -1
  158. package/dist/index.js +1 -1
  159. package/package.json +2 -2
package/dist/HeatMap.js CHANGED
@@ -8,10 +8,10 @@ import { T as pe } from "./Tooltip-DyM5snqx.js";
8
8
  import { g as fe } from "./getTextColorBasedOnBgColor-B6Nk2WBf.js";
9
9
  import { c as re } from "./checkIfNullOrUndefined-DmfiKkNw.js";
10
10
  import { s as xe } from "./string2HTML-CWHGfz_d.js";
11
- import { X as ye } from "./XAxesLabels-CaV2q-6H.js";
12
- import { Y as ve } from "./YAxesLabels-CPGZjmZJ.js";
11
+ import { X as we } from "./XAxesLabels-CaV2q-6H.js";
12
+ import { Y as ye } from "./YAxesLabels-CPGZjmZJ.js";
13
13
  import { b as ce } from "./band-BEjh2CHI.js";
14
- import { o as we } from "./ordinal-w9Lu4Stb.js";
14
+ import { o as ve } from "./ordinal-w9Lu4Stb.js";
15
15
  import { t as Ce } from "./threshold-DFfqcDMa.js";
16
16
  import { a as be } from "./linear-DUdu7l2G.js";
17
17
  import { u as je } from "./use-in-view-yS6jzJAp.js";
@@ -47,20 +47,20 @@ function Le(z) {
47
47
  selectedColor: G,
48
48
  onSeriesMouseClick: A,
49
49
  resetSelectionOnDoubleClick: Q,
50
- detailsOnClick: v,
50
+ detailsOnClick: y,
51
51
  styles: T,
52
52
  classNames: x,
53
- animate: w,
53
+ animate: v,
54
54
  precision: Z
55
55
  } = z, E = ae(null), H = je(E, {
56
- once: w.once,
57
- amount: w.amount
56
+ once: v.once,
57
+ amount: v.amount
58
58
  }), s = {
59
59
  top: _,
60
60
  bottom: U,
61
61
  left: S,
62
62
  right: B
63
- }, [C, V] = O(void 0), [m, N] = O(void 0), [R, b] = O(void 0), [o, X] = O(void 0), ee = I - s.left - s.right, te = W - s.top - s.bottom, u = ne(d, (e) => e.column).map((e) => e.column), h = ne(d, (e) => e.row).map((e) => e.row), j = ce().domain(h).range([0, te]), D = j.bandwidth(), n = ce().domain(u).range([0, ee]), $ = n.bandwidth(), P = F === "categorical" ? we().domain(M).range(q) : F === "threshold" ? Ce().domain(M).range(q) : be().domain(M).range(q);
63
+ }, [C, V] = O(void 0), [n, N] = O(void 0), [R, b] = O(void 0), [o, X] = O(void 0), ee = I - s.left - s.right, te = W - s.top - s.bottom, u = ne(d, (e) => e.column).map((e) => e.column), h = ne(d, (e) => e.row).map((e) => e.row), j = ce().domain(h).range([0, te]), D = j.bandwidth(), c = ce().domain(u).range([0, ee]), $ = c.bandwidth(), P = F === "categorical" ? ve().domain(M).range(q) : F === "threshold" ? Ce().domain(M).range(q) : be().domain(M).range(q);
64
64
  return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
65
65
  /* @__PURE__ */ t.jsxs(
66
66
  ie.svg,
@@ -72,11 +72,11 @@ function Le(z) {
72
72
  direction: "ltr",
73
73
  ref: E,
74
74
  children: [
75
- /* @__PURE__ */ t.jsx("g", { transform: `translate(${s.left},0)`, children: L ? u.map((e, y) => /* @__PURE__ */ t.jsx(
76
- ye,
75
+ /* @__PURE__ */ t.jsx("g", { transform: `translate(${s.left},0)`, children: L ? u.map((e, w) => /* @__PURE__ */ t.jsx(
76
+ we,
77
77
  {
78
78
  y: 0,
79
- x: n(e),
79
+ x: c(e),
80
80
  width: $,
81
81
  height: s.top - 5,
82
82
  value: `${e}`.length < p ? `${e}` : `${`${e}`.substring(0, p)}...`,
@@ -86,10 +86,10 @@ function Le(z) {
86
86
  animate: { duration: 0, once: !0, amount: 0 },
87
87
  isInView: H
88
88
  },
89
- y
89
+ w
90
90
  )) : null }),
91
- /* @__PURE__ */ t.jsx("g", { transform: `translate(0,${s.top})`, children: K ? h.map((e, y) => /* @__PURE__ */ t.jsx(
92
- ve,
91
+ /* @__PURE__ */ t.jsx("g", { transform: `translate(0,${s.top})`, children: K ? h.map((e, w) => /* @__PURE__ */ t.jsx(
92
+ ye,
93
93
  {
94
94
  value: `${e}`.length < p ? `${e}` : `${`${e}`.substring(0, p)}...`,
95
95
  y: j(e),
@@ -102,13 +102,13 @@ function Le(z) {
102
102
  animate: { duration: 0, once: !0, amount: 0 },
103
103
  isInView: H
104
104
  },
105
- y
105
+ w
106
106
  )) : null }),
107
107
  /* @__PURE__ */ t.jsxs("g", { transform: `translate(${s.left},${s.top})`, children: [
108
- h.map((e, y) => /* @__PURE__ */ t.jsx("g", { transform: `translate(0,${j(e)})`, children: u.map((g) => /* @__PURE__ */ t.jsx(
108
+ h.map((e, w) => /* @__PURE__ */ t.jsx("g", { transform: `translate(0,${j(e)})`, children: u.map((g) => /* @__PURE__ */ t.jsx(
109
109
  "rect",
110
110
  {
111
- x: n(g),
111
+ x: c(g),
112
112
  y: 0,
113
113
  width: $,
114
114
  height: D,
@@ -116,8 +116,8 @@ function Le(z) {
116
116
  className: "stroke-1 stroke-primary-white dark:stroke-primary-gray-700"
117
117
  },
118
118
  `${e}-${g}`
119
- )) }, y)),
120
- d.filter((e) => !re(e.value)).map((e, y) => {
119
+ )) }, w)),
120
+ d.filter((e) => !re(e.value)).map((e, w) => {
121
121
  const g = re(e.value) ? f : (
122
122
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
123
123
  P(e.value)
@@ -125,15 +125,15 @@ function Le(z) {
125
125
  return /* @__PURE__ */ t.jsxs(
126
126
  "g",
127
127
  {
128
- transform: `translate(${n(e.column)},${j(e.row)})`,
129
- onMouseEnter: (c) => {
130
- N(e), X(c.clientY), b(c.clientX), r?.(e);
128
+ transform: `translate(${c(e.column)},${j(e.row)})`,
129
+ onMouseEnter: (m) => {
130
+ N(e), X(m.clientY), b(m.clientX), r?.(e);
131
131
  },
132
132
  onClick: () => {
133
- (A || v) && (he(C, e) && Q ? (V(void 0), A?.(void 0)) : (V(e), A?.(e)));
133
+ (A || y) && (he(C, e) && Q ? (V(void 0), A?.(void 0)) : (V(e), A?.(e)));
134
134
  },
135
- onMouseMove: (c) => {
136
- N(e), X(c.clientY), b(c.clientX);
135
+ onMouseMove: (m) => {
136
+ N(e), X(m.clientY), b(m.clientX);
137
137
  },
138
138
  onMouseLeave: () => {
139
139
  N(void 0), b(void 0), X(void 0), r?.(void 0);
@@ -148,13 +148,13 @@ function Le(z) {
148
148
  width: $,
149
149
  height: D,
150
150
  className: "stroke-1 stroke-primary-white dark:stroke-primary-gray-700",
151
- exit: { opacity: 0, transition: { duration: w.duration } },
151
+ exit: { opacity: 0, transition: { duration: v.duration } },
152
152
  variants: {
153
153
  initial: { fill: g, opacity: 0 },
154
154
  whileInView: {
155
155
  fill: g,
156
156
  opacity: 1,
157
- transition: { duration: w.duration }
157
+ transition: { duration: v.duration }
158
158
  }
159
159
  },
160
160
  initial: "initial",
@@ -166,11 +166,11 @@ function Le(z) {
166
166
  {
167
167
  variants: {
168
168
  initial: { opacity: 0 },
169
- whileInView: { opacity: 1, transition: { duration: w.duration } }
169
+ whileInView: { opacity: 1, transition: { duration: v.duration } }
170
170
  },
171
171
  initial: "initial",
172
172
  animate: H ? "whileInView" : "initial",
173
- exit: { opacity: 0, transition: { duration: w.duration } },
173
+ exit: { opacity: 0, transition: { duration: v.duration } },
174
174
  children: /* @__PURE__ */ t.jsx("foreignObject", { y: 0, x: 0, width: $, height: D, children: /* @__PURE__ */ t.jsx("div", { className: "flex flex-col justify-center items-center h-inherit p-1", children: /* @__PURE__ */ t.jsx(
175
175
  "p",
176
176
  {
@@ -184,7 +184,7 @@ function Le(z) {
184
184
  },
185
185
  children: de(e.value, "NA", Z, i, J)
186
186
  }
187
- ) }) }, y)
187
+ ) }) }, w)
188
188
  }
189
189
  ) : null
190
190
  ]
@@ -192,11 +192,11 @@ function Le(z) {
192
192
  `${e.column}-${e.row}`
193
193
  );
194
194
  }),
195
- m ? /* @__PURE__ */ t.jsx(
195
+ n ? /* @__PURE__ */ t.jsx(
196
196
  "rect",
197
197
  {
198
- x: n(m.column),
199
- y: j(m.row),
198
+ x: c(n.column),
199
+ y: j(n.row),
200
200
  width: $,
201
201
  height: D,
202
202
  style: {
@@ -211,10 +211,10 @@ function Le(z) {
211
211
  ]
212
212
  }
213
213
  ),
214
- m && k && R && o ? /* @__PURE__ */ t.jsx(
214
+ n && k && R && o ? /* @__PURE__ */ t.jsx(
215
215
  pe,
216
216
  {
217
- data: m,
217
+ data: n,
218
218
  body: k,
219
219
  xPos: R,
220
220
  yPos: o,
@@ -222,7 +222,7 @@ function Le(z) {
222
222
  className: x?.tooltip
223
223
  }
224
224
  ) : null,
225
- v && C !== void 0 ? /* @__PURE__ */ t.jsx(
225
+ y && C !== void 0 ? /* @__PURE__ */ t.jsx(
226
226
  ge,
227
227
  {
228
228
  open: C !== void 0,
@@ -233,8 +233,8 @@ function Le(z) {
233
233
  "div",
234
234
  {
235
235
  className: "graph-modal-content m-0",
236
- dangerouslySetInnerHTML: typeof v == "string" ? { __html: xe(v, C) } : void 0,
237
- children: typeof v == "function" ? v(C) : null
236
+ dangerouslySetInnerHTML: typeof y == "string" ? { __html: xe(y, C) } : void 0,
237
+ children: typeof y == "function" ? y(C) : null
238
238
  }
239
239
  )
240
240
  }
@@ -265,17 +265,17 @@ function ot(z) {
265
265
  tooltip: G,
266
266
  onSeriesMouseOver: A,
267
267
  suffix: Q = "",
268
- prefix: v = "",
268
+ prefix: y = "",
269
269
  showRowLabels: T = !0,
270
270
  relativeHeight: x,
271
- showValues: w,
271
+ showValues: v,
272
272
  graphID: Z,
273
273
  noDataColor: E = a.gray,
274
274
  showColorScale: H = !0,
275
275
  onSeriesMouseClick: s,
276
276
  graphDownload: C = !1,
277
277
  dataDownload: V = !1,
278
- fillContainer: m = !0,
278
+ fillContainer: n = !0,
279
279
  language: N = "en",
280
280
  showNAColor: R = !0,
281
281
  minHeight: b = 0,
@@ -287,24 +287,25 @@ function ot(z) {
287
287
  classNames: h,
288
288
  animate: j = !1,
289
289
  precision: D = 2
290
- } = z, [n, $] = O(0), [P, e] = O(0), [y, g] = O(void 0), c = ae(null), le = ae(null);
290
+ } = z, [c, $] = O(0), [P, e] = O(0), [w, g] = O(void 0), m = ae(null), le = ae(null);
291
291
  ue(() => {
292
292
  const l = new ResizeObserver((se) => {
293
293
  $(r || se[0].target.clientWidth || 620), e(k || se[0].target.clientHeight || 480);
294
294
  });
295
- return c.current && (e(c.current.clientHeight || 480), $(c.current.clientWidth || 620), r || l.observe(c.current)), () => l.disconnect();
295
+ return m.current && (e(m.current.clientHeight || 480), $(m.current.clientWidth || 620), r || l.observe(m.current)), () => l.disconnect();
296
296
  }, [r, k]);
297
297
  const oe = J || (typeof i[0] == "string" ? "categorical" : i.length === 2 ? "linear" : "threshold");
298
298
  return /* @__PURE__ */ t.jsx(
299
299
  "div",
300
300
  {
301
- className: `${o || "light"} flex ${r ? "grow-0" : "grow"} ${m ? "w-full" : "w-fit"}`,
301
+ className: `${o || "light"} flex ${r ? "grow-0" : "grow"} ${n ? "w-full" : "w-fit"}`,
302
302
  dir: N === "he" || N === "ar" ? "rtl" : void 0,
303
303
  children: /* @__PURE__ */ t.jsx(
304
304
  "div",
305
305
  {
306
306
  className: me(
307
307
  `${f ? f === !0 ? "bg-primary-gray-200 dark:bg-primary-gray-650 " : "" : "bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${N || "en"}`,
308
+ n ? "w-full" : "w-fit",
308
309
  h?.graphContainer
309
310
  ),
310
311
  style: {
@@ -342,7 +343,7 @@ function ot(z) {
342
343
  H ? oe === "categorical" ? /* @__PURE__ */ t.jsx(
343
344
  Me,
344
345
  {
345
- width: m ? void 0 : r,
346
+ width: n ? void 0 : r,
346
347
  colorLegendTitle: M,
347
348
  colors: S || (typeof i[0] == "string" ? a[o].categoricalColors.colors : i.length === 2 ? [
348
349
  a[o].sequentialColors.neutralColorsx09[0],
@@ -355,7 +356,7 @@ function ot(z) {
355
356
  ) : oe === "threshold" ? /* @__PURE__ */ t.jsx(
356
357
  De,
357
358
  {
358
- width: m ? void 0 : r,
359
+ width: n ? void 0 : r,
359
360
  colorLegendTitle: M,
360
361
  colors: S || (typeof i[0] == "string" ? a[o].categoricalColors.colors : i.length === 2 ? [
361
362
  a[o].sequentialColors.neutralColorsx09[0],
@@ -369,7 +370,7 @@ function ot(z) {
369
370
  ) : /* @__PURE__ */ t.jsx(
370
371
  Ne,
371
372
  {
372
- width: m ? void 0 : r,
373
+ width: n ? void 0 : r,
373
374
  colorLegendTitle: M,
374
375
  colors: S || [
375
376
  a[o].sequentialColors.neutralColorsx09[0],
@@ -382,14 +383,14 @@ function ot(z) {
382
383
  "div",
383
384
  {
384
385
  className: "flex grow flex-col justify-center w-full leading-0",
385
- ref: c,
386
+ ref: m,
386
387
  "aria-label": "Graph area",
387
- children: (r || n) && (k || P) ? /* @__PURE__ */ t.jsx(
388
+ children: (r || c) && (k || P) ? /* @__PURE__ */ t.jsx(
388
389
  Le,
389
390
  {
390
391
  data: d,
391
392
  colorDomain: i,
392
- width: r || n,
393
+ width: r || c,
393
394
  colors: S || (typeof i[0] == "string" ? a[o].categoricalColors.colors : i.length === 2 ? [
394
395
  a[o].sequentialColors.neutralColorsx09[0],
395
396
  a[o].sequentialColors.neutralColorsx09[8]
@@ -398,21 +399,21 @@ function ot(z) {
398
399
  scaleType: oe,
399
400
  height: Math.max(
400
401
  b,
401
- k || (x ? b ? (r || n) * x > b ? (r || n) * x : b : (r || n) * x : P)
402
+ k || (x ? b ? (r || c) * x > b ? (r || c) * x : b : (r || c) * x : P)
402
403
  ),
403
404
  showColumnLabels: I,
404
405
  leftMargin: W,
405
406
  rightMargin: _,
406
407
  topMargin: F,
407
408
  bottomMargin: K,
408
- selectedColor: y,
409
+ selectedColor: w,
409
410
  truncateBy: U,
410
411
  showRowLabels: T,
411
412
  tooltip: G,
412
413
  onSeriesMouseOver: A,
413
- showValues: w,
414
+ showValues: v,
414
415
  suffix: Q,
415
- prefix: v,
416
+ prefix: y,
416
417
  onSeriesMouseClick: s,
417
418
  resetSelectionOnDoubleClick: ee,
418
419
  detailsOnClick: te,
@@ -1 +1 @@
1
- {"version":3,"file":"HeatMap.js","sources":["../src/Components/Graphs/HeatMap/Graph.tsx","../src/Components/Graphs/HeatMap/index.tsx"],"sourcesContent":["import isEqual from 'fast-deep-equal';\r\nimport { scaleLinear, scaleBand, scaleOrdinal, scaleThreshold } from 'd3-scale';\r\nimport { useRef, useState } from 'react';\r\nimport uniqBy from 'lodash.uniqby';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport { Modal } from '@undp/design-system-react/Modal';\r\nimport { motion, useInView } from 'motion/react';\r\n\r\nimport {\r\n AnimateDataType,\r\n ClassNameObject,\r\n HeatMapDataType,\r\n ScaleDataType,\r\n StyleObject,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { getTextColorBasedOnBgColor } from '@/Utils/getTextColorBasedOnBgColor';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { string2HTML } from '@/Utils/string2HTML';\r\nimport { XAxesLabels } from '@/Components/Elements/Axes/XAxesLabels';\r\nimport { YAxesLabels } from '@/Components/Elements/Axes/YAxesLabels';\r\n\r\ninterface Props {\r\n data: HeatMapDataType[];\r\n colorDomain: string[] | number[];\r\n colors: string[];\r\n noDataColor: string;\r\n scaleType: ScaleDataType;\r\n showColumnLabels: boolean;\r\n leftMargin: number;\r\n truncateBy: number;\r\n width: number;\r\n height: number;\r\n rightMargin: number;\r\n topMargin: number;\r\n showRowLabels: boolean;\r\n bottomMargin: number;\r\n suffix: string;\r\n prefix: string;\r\n showValues?: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n selectedColor?: string;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n resetSelectionOnDoubleClick: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n animate: AnimateDataType;\r\n precision: number;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n showColumnLabels,\r\n leftMargin,\r\n rightMargin,\r\n truncateBy,\r\n width,\r\n height,\r\n topMargin,\r\n bottomMargin,\r\n tooltip,\r\n onSeriesMouseOver,\r\n suffix,\r\n prefix,\r\n showValues,\r\n colorDomain,\r\n colors,\r\n noDataColor,\r\n scaleType,\r\n showRowLabels,\r\n selectedColor,\r\n onSeriesMouseClick,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n animate,\r\n precision,\r\n } = props;\r\n const svgRef = useRef(null);\r\n const isInView = useInView(svgRef, {\r\n once: animate.once,\r\n amount: animate.amount,\r\n });\r\n const margin = {\r\n top: topMargin,\r\n bottom: bottomMargin,\r\n left: leftMargin,\r\n right: rightMargin,\r\n };\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n const [mouseOverData, setMouseOverData] = useState<HeatMapDataType | undefined>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n const graphWidth = width - margin.left - margin.right;\r\n const graphHeight = height - margin.top - margin.bottom;\r\n const columns = uniqBy(data, d => d.column).map(d => d.column);\r\n const rows = uniqBy(data, d => d.row).map(d => d.row);\r\n const y = scaleBand().domain(rows).range([0, graphHeight]);\r\n const barHeight = y.bandwidth();\r\n const x = scaleBand().domain(columns).range([0, graphWidth]);\r\n const barWidth = x.bandwidth();\r\n const colorScale =\r\n scaleType === 'categorical'\r\n ? scaleOrdinal<number | string, string>().domain(colorDomain).range(colors)\r\n : scaleType === 'threshold'\r\n ? scaleThreshold<number, string>()\r\n .domain(colorDomain as number[])\r\n .range(colors)\r\n : scaleLinear<string, string>()\r\n .domain(colorDomain as number[])\r\n .range(colors);\r\n return (\r\n <>\r\n <motion.svg\r\n width={`${width}px`}\r\n height={`${height}px`}\r\n viewBox={`0 0 ${width} ${height}`}\r\n style={{ marginLeft: 'auto', marginRight: 'auto' }}\r\n direction='ltr'\r\n ref={svgRef}\r\n >\r\n <g transform={`translate(${margin.left},${0})`}>\r\n {showColumnLabels\r\n ? columns.map((d, i) => (\r\n <XAxesLabels\r\n key={i}\r\n y={0}\r\n x={x(d) as number}\r\n width={barWidth}\r\n height={margin.top - 5}\r\n value={\r\n `${d}`.length < truncateBy ? `${d}` : `${`${d}`.substring(0, truncateBy)}...`\r\n }\r\n style={styles?.xAxis?.labels}\r\n className={classNames?.xAxis?.labels}\r\n alignment='bottom'\r\n animate={{ duration: 0, once: true, amount: 0 }}\r\n isInView={isInView}\r\n />\r\n ))\r\n : null}\r\n </g>\r\n <g transform={`translate(${0},${margin.top})`}>\r\n {showRowLabels\r\n ? rows.map((d, i) => (\r\n <YAxesLabels\r\n value={\r\n `${d}`.length < truncateBy ? `${d}` : `${`${d}`.substring(0, truncateBy)}...`\r\n }\r\n key={i}\r\n y={y(d) as number}\r\n x={0}\r\n width={margin.left}\r\n height={barHeight}\r\n alignment='right'\r\n style={styles?.yAxis?.labels}\r\n className={classNames?.yAxis?.labels}\r\n animate={{ duration: 0, once: true, amount: 0 }}\r\n isInView={isInView}\r\n />\r\n ))\r\n : null}\r\n </g>\r\n <g transform={`translate(${margin.left},${margin.top})`}>\r\n {rows.map((d, i) => (\r\n <g key={i} transform={`translate(0,${y(d)})`}>\r\n {columns.map(el => (\r\n <rect\r\n key={`${d}-${el}`}\r\n x={x(el)}\r\n y={0}\r\n width={barWidth}\r\n height={barHeight}\r\n style={{ fill: noDataColor }}\r\n className='stroke-1 stroke-primary-white dark:stroke-primary-gray-700'\r\n />\r\n ))}\r\n </g>\r\n ))}\r\n {data\r\n .filter(d => !checkIfNullOrUndefined(d.value))\r\n .map((d, i) => {\r\n const color = !checkIfNullOrUndefined(d.value)\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n colorScale(d.value as any)\r\n : noDataColor;\r\n return (\r\n <g\r\n key={`${d.column}-${d.row}`}\r\n transform={`translate(${x(d.column)},${y(d.row)})`}\r\n onMouseEnter={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.(d);\r\n }}\r\n onClick={() => {\r\n if (onSeriesMouseClick || detailsOnClick) {\r\n if (isEqual(mouseClickData, d) && resetSelectionOnDoubleClick) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n setMouseClickData(d);\r\n onSeriesMouseClick?.(d);\r\n }\r\n }\r\n }}\r\n onMouseMove={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n }}\r\n onMouseLeave={() => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n }}\r\n opacity={selectedColor ? (selectedColor === color ? 1 : 0.3) : 1}\r\n >\r\n <motion.rect\r\n x={0}\r\n y={0}\r\n width={barWidth}\r\n height={barHeight}\r\n className='stroke-1 stroke-primary-white dark:stroke-primary-gray-700'\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { fill: color, opacity: 0 },\r\n whileInView: {\r\n fill: color,\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n {showValues && !checkIfNullOrUndefined(d.value) ? (\r\n <motion.g\r\n variants={{\r\n initial: { opacity: 0 },\r\n whileInView: { opacity: 1, transition: { duration: animate.duration } },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n >\r\n <foreignObject key={i} y={0} x={0} width={barWidth} height={barHeight}>\r\n <div className='flex flex-col justify-center items-center h-inherit p-1'>\r\n <p\r\n className={cn(\r\n 'text-xs text-center m-0 leading-[1.25] graph-value',\r\n classNames?.graphObjectValues,\r\n )}\r\n style={{\r\n color: getTextColorBasedOnBgColor(color),\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n >\r\n {numberFormattingFunction(d.value, 'NA', precision, prefix, suffix)}\r\n </p>\r\n </div>\r\n </foreignObject>\r\n </motion.g>\r\n ) : null}\r\n </g>\r\n );\r\n })}\r\n {mouseOverData ? (\r\n <rect\r\n x={x(mouseOverData.column)}\r\n y={y(mouseOverData.row)}\r\n width={barWidth}\r\n height={barHeight}\r\n style={{\r\n fill: 'none',\r\n fillOpacity: 0,\r\n strokeWidth: 1.5,\r\n }}\r\n className='stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n />\r\n ) : null}\r\n </g>\r\n </motion.svg>\r\n {mouseOverData && tooltip && eventX && eventY ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={eventX}\r\n yPos={eventY}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n {detailsOnClick && mouseClickData !== undefined ? (\r\n <Modal\r\n open={mouseClickData !== undefined}\r\n onClose={() => {\r\n setMouseClickData(undefined);\r\n }}\r\n >\r\n <div\r\n className='graph-modal-content m-0'\r\n dangerouslySetInnerHTML={\r\n typeof detailsOnClick === 'string'\r\n ? { __html: string2HTML(detailsOnClick, mouseClickData) }\r\n : undefined\r\n }\r\n >\r\n {typeof detailsOnClick === 'function' ? detailsOnClick(mouseClickData) : null}\r\n </div>\r\n </Modal>\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import { useState, useRef, useEffect } from 'react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport {\r\n HeatMapDataType,\r\n Languages,\r\n ScaleDataType,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n AnimateDataType,\r\n} from '@/Types';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { ColorLegendWithMouseOver } from '@/Components/Elements/ColorLegendWithMouseOver';\r\nimport { LinearColorLegend } from '@/Components/Elements/LinearColorLegend';\r\nimport { ThresholdColorLegendWithMouseOver } from '@/Components/Elements/ThresholdColorLegendWithMouseOver';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { EmptyState } from '@/Components/Elements/EmptyState';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: HeatMapDataType[];\r\n\r\n // Titles, Labels, and Sources\r\n /** Title of the graph */\r\n graphTitle?: string | React.ReactNode;\r\n /** Description of the graph */\r\n graphDescription?: string | React.ReactNode;\r\n /** Footnote for the graph */\r\n footNote?: string | React.ReactNode;\r\n /** Source data for the graph */\r\n sources?: SourcesDataType[];\r\n /** Accessibility label */\r\n ariaLabel?: string;\r\n\r\n // Colors and Styling\r\n /** Array of colors for cells */\r\n colors?: string[];\r\n /** Color where data is not available */\r\n noDataColor?: string;\r\n /** Title for the color legend */\r\n colorLegendTitle?: string;\r\n /** Background color of the graph */\r\n backgroundColor?: string | boolean;\r\n /** Custom styles for the graph. Each object should be a valid React CSS style object. */\r\n styles?: StyleObject;\r\n /** Custom class names */\r\n classNames?: ClassNameObject;\r\n\r\n // Size and Spacing\r\n /** Width of the graph */\r\n width?: number;\r\n /** Height of the graph */\r\n height?: number;\r\n /** Minimum height of the graph */\r\n minHeight?: number;\r\n /** Relative height scaling factor. This overwrites the height props */\r\n relativeHeight?: number;\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n /** Left margin of the graph */\r\n leftMargin?: number;\r\n /** Right margin of the graph */\r\n rightMargin?: number;\r\n /** Top margin of the graph */\r\n topMargin?: number;\r\n /** Bottom margin of the graph */\r\n bottomMargin?: number;\r\n /** Toggles the background to fill the container. This only works if the width of the graph is defined. */\r\n fillContainer?: boolean;\r\n\r\n // Values and Ticks\r\n /** Prefix for values */\r\n prefix?: string;\r\n /** Suffix for values */\r\n suffix?: string;\r\n /** Maximum value for the chart */\r\n truncateBy?: number;\r\n /** Reference values for comparison */\r\n\r\n // Graph Parameters\r\n /** Toggle visibility of labels in the column */\r\n showColumnLabels?: boolean;\r\n /** Toggle visibility of labels in the row */\r\n showRowLabels?: boolean;\r\n /** Scale for the colors in the cell */\r\n scaleType?: ScaleDataType;\r\n /** Toggle visibility of values */\r\n showValues?: boolean;\r\n /** Toggle visibility of color scale. This is only applicable if the data props hae color parameter */\r\n showColorScale?: boolean;\r\n /** Toggle visibility of NA color in the color scale. This is only applicable if the data props hae color parameter and showColorScale prop is true */\r\n showNAColor?: boolean;\r\n /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\r\n /** Domain for the colors in the cell. */\r\n colorDomain: number[] | string[];\r\n /** Specifies the number of decimal places to display in the value. */\r\n precision?: number;\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n /** Reset selection on double-click. Only applicable when used in a dashboard context with filters. */\r\n resetSelectionOnDoubleClick?: boolean;\r\n\r\n // Interactions and Callbacks\r\n /** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n /** Details displayed on the modal when user clicks of a data point. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n /** Callback for mouse over event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n /** Callback for mouse click event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n\r\n // Configuration and Options\r\n /** Language setting */\r\n language?: Languages;\r\n /** Color theme */\r\n theme?: 'light' | 'dark';\r\n /** Unique ID for the graph */\r\n graphID?: string;\r\n}\r\n\r\nexport function HeatMap(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n colors,\r\n sources,\r\n graphDescription,\r\n showColumnLabels = true,\r\n leftMargin = 100,\r\n rightMargin = 10,\r\n truncateBy = 999,\r\n height,\r\n width,\r\n scaleType,\r\n colorDomain,\r\n footNote,\r\n colorLegendTitle,\r\n padding,\r\n backgroundColor = false,\r\n topMargin = 30,\r\n bottomMargin = 10,\r\n tooltip,\r\n onSeriesMouseOver,\r\n suffix = '',\r\n prefix = '',\r\n showRowLabels = true,\r\n relativeHeight,\r\n showValues,\r\n graphID,\r\n noDataColor = Colors.gray,\r\n showColorScale = true,\r\n onSeriesMouseClick,\r\n graphDownload = false,\r\n dataDownload = false,\r\n fillContainer = true,\r\n language = 'en',\r\n showNAColor = true,\r\n minHeight = 0,\r\n theme = 'light',\r\n ariaLabel,\r\n resetSelectionOnDoubleClick = true,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n animate = false,\r\n precision = 2,\r\n } = props;\r\n\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n const [selectedColor, setSelectedColor] = useState<string | undefined>(undefined);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(width || entries[0].target.clientWidth || 620);\r\n setSvgHeight(height || entries[0].target.clientHeight || 480);\r\n });\r\n if (graphDiv.current) {\r\n setSvgHeight(graphDiv.current.clientHeight || 480);\r\n setSvgWidth(graphDiv.current.clientWidth || 620);\r\n if (!width) resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, [width, height]);\r\n const scale =\r\n scaleType ||\r\n (typeof colorDomain[0] === 'string'\r\n ? 'categorical'\r\n : colorDomain.length === 2\r\n ? 'linear'\r\n : 'threshold');\r\n\r\n return (\r\n <div\r\n className={`${theme || 'light'} flex ${width ? 'grow-0' : 'grow'} ${\r\n !fillContainer ? 'w-fit' : 'w-full'\r\n }`}\r\n dir={language === 'he' || language === 'ar' ? 'rtl' : undefined}\r\n >\r\n <div\r\n className={cn(\r\n `${\r\n !backgroundColor\r\n ? 'bg-transparent '\r\n : backgroundColor === true\r\n ? 'bg-primary-gray-200 dark:bg-primary-gray-650 '\r\n : ''\r\n }ml-auto mr-auto flex flex-col grow h-inherit ${language || 'en'}`,\r\n classNames?.graphContainer,\r\n )}\r\n style={{\r\n ...(styles?.graphContainer || {}),\r\n ...(backgroundColor && backgroundColor !== true ? { backgroundColor } : {}),\r\n }}\r\n id={graphID}\r\n ref={graphParentDiv}\r\n aria-label={\r\n ariaLabel ||\r\n `${\r\n graphTitle ? `The graph shows ${graphTitle}. ` : ''\r\n }This is a heatmap. ${graphDescription ? ` ${graphDescription}` : ''}`\r\n }\r\n >\r\n <div\r\n className='flex grow'\r\n style={{ padding: backgroundColor ? padding || '1rem' : padding || 0 }}\r\n >\r\n <div className='flex flex-col w-full gap-4 grow justify-between'>\r\n {graphTitle || graphDescription || graphDownload || dataDownload ? (\r\n <GraphHeader\r\n styles={{\r\n title: styles?.title,\r\n description: styles?.description,\r\n }}\r\n classNames={{\r\n title: classNames?.title,\r\n description: classNames?.description,\r\n }}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n width={width}\r\n graphDownload={graphDownload ? graphParentDiv.current : undefined}\r\n dataDownload={\r\n dataDownload\r\n ? data.map(d => d.data).filter(d => d !== undefined).length > 0\r\n ? data.map(d => d.data).filter(d => d !== undefined)\r\n : data.filter(d => d !== undefined)\r\n : null\r\n }\r\n />\r\n ) : null}\r\n <div className='grow flex flex-col justify-center gap-3 w-full'>\r\n {data.length === 0 ? (\r\n <EmptyState />\r\n ) : (\r\n <>\r\n {showColorScale ? (\r\n scale === 'categorical' ? (\r\n <ColorLegendWithMouseOver\r\n width={fillContainer ? undefined : width}\r\n colorLegendTitle={colorLegendTitle}\r\n colors={\r\n colors ||\r\n (typeof colorDomain[0] === 'string'\r\n ? Colors[theme].categoricalColors.colors\r\n : colorDomain.length === 2\r\n ? [\r\n Colors[theme].sequentialColors.neutralColorsx09[0],\r\n Colors[theme].sequentialColors.neutralColorsx09[8],\r\n ]\r\n : Colors[theme].sequentialColors[\r\n `neutralColorsx0${\r\n (colorDomain.length + 1) as 4 | 5 | 6 | 7 | 8 | 9\r\n }`\r\n ])\r\n }\r\n colorDomain={colorDomain.map(d => `${d}`)}\r\n setSelectedColor={setSelectedColor}\r\n showNAColor={showNAColor}\r\n />\r\n ) : scale === 'threshold' ? (\r\n <ThresholdColorLegendWithMouseOver\r\n width={fillContainer ? undefined : width}\r\n colorLegendTitle={colorLegendTitle}\r\n colors={\r\n colors ||\r\n (typeof colorDomain[0] === 'string'\r\n ? Colors[theme].categoricalColors.colors\r\n : colorDomain.length === 2\r\n ? [\r\n Colors[theme].sequentialColors.neutralColorsx09[0],\r\n Colors[theme].sequentialColors.neutralColorsx09[8],\r\n ]\r\n : Colors[theme].sequentialColors[\r\n `neutralColorsx0${\r\n (colorDomain.length + 1) as 4 | 5 | 6 | 7 | 8 | 9\r\n }`\r\n ])\r\n }\r\n colorDomain={colorDomain as number[]}\r\n setSelectedColor={setSelectedColor}\r\n naColor={noDataColor}\r\n showNAColor={showNAColor}\r\n />\r\n ) : (\r\n <LinearColorLegend\r\n width={fillContainer ? undefined : width}\r\n colorLegendTitle={colorLegendTitle}\r\n colors={\r\n colors || [\r\n Colors[theme].sequentialColors.neutralColorsx09[0],\r\n Colors[theme].sequentialColors.neutralColorsx09[8],\r\n ]\r\n }\r\n colorDomain={colorDomain as number[]}\r\n />\r\n )\r\n ) : null}\r\n <div\r\n className='flex grow flex-col justify-center w-full leading-0'\r\n ref={graphDiv}\r\n aria-label='Graph area'\r\n >\r\n {(width || svgWidth) && (height || svgHeight) ? (\r\n <Graph\r\n data={data}\r\n colorDomain={colorDomain}\r\n width={width || svgWidth}\r\n colors={\r\n colors ||\r\n (typeof colorDomain[0] === 'string'\r\n ? Colors[theme].categoricalColors.colors\r\n : colorDomain.length === 2\r\n ? [\r\n Colors[theme].sequentialColors.neutralColorsx09[0],\r\n Colors[theme].sequentialColors.neutralColorsx09[8],\r\n ]\r\n : Colors[theme].sequentialColors[\r\n `neutralColorsx0${\r\n (colorDomain.length + 1) as 4 | 5 | 6 | 7 | 8 | 9\r\n }`\r\n ])\r\n }\r\n noDataColor={noDataColor}\r\n scaleType={scale}\r\n height={Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}\r\n showColumnLabels={showColumnLabels}\r\n leftMargin={leftMargin}\r\n rightMargin={rightMargin}\r\n topMargin={topMargin}\r\n bottomMargin={bottomMargin}\r\n selectedColor={selectedColor}\r\n truncateBy={truncateBy}\r\n showRowLabels={showRowLabels}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n showValues={showValues}\r\n suffix={suffix}\r\n prefix={prefix}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n detailsOnClick={detailsOnClick}\r\n styles={styles}\r\n classNames={classNames}\r\n animate={\r\n animate === true\r\n ? { duration: 0.5, once: true, amount: 0.5 }\r\n : animate || { duration: 0, once: true, amount: 0 }\r\n }\r\n precision={precision}\r\n />\r\n ) : null}\r\n </div>\r\n </>\r\n )}\r\n </div>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n}\r\n"],"names":["Graph","props","data","showColumnLabels","leftMargin","rightMargin","truncateBy","width","height","topMargin","bottomMargin","tooltip","onSeriesMouseOver","suffix","prefix","showValues","colorDomain","colors","noDataColor","scaleType","showRowLabels","selectedColor","onSeriesMouseClick","resetSelectionOnDoubleClick","detailsOnClick","styles","classNames","animate","precision","svgRef","useRef","isInView","useInView","margin","mouseClickData","setMouseClickData","useState","mouseOverData","setMouseOverData","eventX","setEventX","eventY","setEventY","graphWidth","graphHeight","columns","uniqBy","d","rows","y","scaleBand","barHeight","x","barWidth","colorScale","scaleOrdinal","scaleThreshold","scaleLinear","jsxs","Fragment","motion","jsx","i","XAxesLabels","YAxesLabels","el","checkIfNullOrUndefined","color","event","isEqual","cn","getTextColorBasedOnBgColor","Tooltip","Modal","string2HTML","HeatMap","graphTitle","sources","graphDescription","footNote","colorLegendTitle","padding","backgroundColor","relativeHeight","graphID","Colors","showColorScale","graphDownload","dataDownload","fillContainer","language","showNAColor","minHeight","theme","ariaLabel","svgWidth","setSvgWidth","svgHeight","setSvgHeight","setSelectedColor","graphDiv","graphParentDiv","useEffect","resizeObserver","entries","scale","GraphHeader","EmptyState","ColorLegendWithMouseOver","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,0BACA,YAAAC;AAAA,0BACA,SACEC,MAAY,KACR,EAAE,UAAU,KAAK,MAAM,IAAM,QAAQ,IAAA,IACrCA,KAAW,EAAE,UAAU,GAAG,MAAM,IAAM,QAAQ,EAAA;AAAA,0BAEpD,WAAAC;AAAA,wBAAA;AAAA,sBAAA,IAEA;AAAA,oBAAA;AAAA,kBAAA;AAAA,gBACN,EAAA,CACF,EAAA,CAEJ;AAAA,gBACCiD,KAAWE,IACVlB,gBAAAA,EAAAA;AAAAA,kBAACkD;AAAA,kBAAA;AAAA,oBACC,QAAQ,EAAE,UAAUtF,GAAQ,UAAU,QAAQA,GAAQ,OAAA;AAAA,oBACtD,YAAY;AAAA,sBACV,UAAUC,GAAY;AAAA,sBACtB,QAAQA,GAAY;AAAA,oBAAA;AAAA,oBAEtB,SAAAmD;AAAA,oBACA,UAAAE;AAAA,oBACA,OAAAxE;AAAA,kBAAA;AAAA,gBAAA,IAEA;AAAA,cAAA,EAAA,CACN;AAAA,YAAA;AAAA,UAAA;AAAA,QACF;AAAA,MAAA;AAAA,IACF;AAAA,EAAA;AAGN;"}
1
+ {"version":3,"file":"HeatMap.js","sources":["../src/Components/Graphs/HeatMap/Graph.tsx","../src/Components/Graphs/HeatMap/index.tsx"],"sourcesContent":["import isEqual from 'fast-deep-equal';\r\nimport { scaleLinear, scaleBand, scaleOrdinal, scaleThreshold } from 'd3-scale';\r\nimport { useRef, useState } from 'react';\r\nimport uniqBy from 'lodash.uniqby';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport { Modal } from '@undp/design-system-react/Modal';\r\nimport { motion, useInView } from 'motion/react';\r\n\r\nimport {\r\n AnimateDataType,\r\n ClassNameObject,\r\n HeatMapDataType,\r\n ScaleDataType,\r\n StyleObject,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { getTextColorBasedOnBgColor } from '@/Utils/getTextColorBasedOnBgColor';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { string2HTML } from '@/Utils/string2HTML';\r\nimport { XAxesLabels } from '@/Components/Elements/Axes/XAxesLabels';\r\nimport { YAxesLabels } from '@/Components/Elements/Axes/YAxesLabels';\r\n\r\ninterface Props {\r\n data: HeatMapDataType[];\r\n colorDomain: string[] | number[];\r\n colors: string[];\r\n noDataColor: string;\r\n scaleType: ScaleDataType;\r\n showColumnLabels: boolean;\r\n leftMargin: number;\r\n truncateBy: number;\r\n width: number;\r\n height: number;\r\n rightMargin: number;\r\n topMargin: number;\r\n showRowLabels: boolean;\r\n bottomMargin: number;\r\n suffix: string;\r\n prefix: string;\r\n showValues?: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n selectedColor?: string;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n resetSelectionOnDoubleClick: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n animate: AnimateDataType;\r\n precision: number;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n showColumnLabels,\r\n leftMargin,\r\n rightMargin,\r\n truncateBy,\r\n width,\r\n height,\r\n topMargin,\r\n bottomMargin,\r\n tooltip,\r\n onSeriesMouseOver,\r\n suffix,\r\n prefix,\r\n showValues,\r\n colorDomain,\r\n colors,\r\n noDataColor,\r\n scaleType,\r\n showRowLabels,\r\n selectedColor,\r\n onSeriesMouseClick,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n animate,\r\n precision,\r\n } = props;\r\n const svgRef = useRef(null);\r\n const isInView = useInView(svgRef, {\r\n once: animate.once,\r\n amount: animate.amount,\r\n });\r\n const margin = {\r\n top: topMargin,\r\n bottom: bottomMargin,\r\n left: leftMargin,\r\n right: rightMargin,\r\n };\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n const [mouseOverData, setMouseOverData] = useState<HeatMapDataType | undefined>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n const graphWidth = width - margin.left - margin.right;\r\n const graphHeight = height - margin.top - margin.bottom;\r\n const columns = uniqBy(data, d => d.column).map(d => d.column);\r\n const rows = uniqBy(data, d => d.row).map(d => d.row);\r\n const y = scaleBand().domain(rows).range([0, graphHeight]);\r\n const barHeight = y.bandwidth();\r\n const x = scaleBand().domain(columns).range([0, graphWidth]);\r\n const barWidth = x.bandwidth();\r\n const colorScale =\r\n scaleType === 'categorical'\r\n ? scaleOrdinal<number | string, string>().domain(colorDomain).range(colors)\r\n : scaleType === 'threshold'\r\n ? scaleThreshold<number, string>()\r\n .domain(colorDomain as number[])\r\n .range(colors)\r\n : scaleLinear<string, string>()\r\n .domain(colorDomain as number[])\r\n .range(colors);\r\n return (\r\n <>\r\n <motion.svg\r\n width={`${width}px`}\r\n height={`${height}px`}\r\n viewBox={`0 0 ${width} ${height}`}\r\n style={{ marginLeft: 'auto', marginRight: 'auto' }}\r\n direction='ltr'\r\n ref={svgRef}\r\n >\r\n <g transform={`translate(${margin.left},${0})`}>\r\n {showColumnLabels\r\n ? columns.map((d, i) => (\r\n <XAxesLabels\r\n key={i}\r\n y={0}\r\n x={x(d) as number}\r\n width={barWidth}\r\n height={margin.top - 5}\r\n value={\r\n `${d}`.length < truncateBy ? `${d}` : `${`${d}`.substring(0, truncateBy)}...`\r\n }\r\n style={styles?.xAxis?.labels}\r\n className={classNames?.xAxis?.labels}\r\n alignment='bottom'\r\n animate={{ duration: 0, once: true, amount: 0 }}\r\n isInView={isInView}\r\n />\r\n ))\r\n : null}\r\n </g>\r\n <g transform={`translate(${0},${margin.top})`}>\r\n {showRowLabels\r\n ? rows.map((d, i) => (\r\n <YAxesLabels\r\n value={\r\n `${d}`.length < truncateBy ? `${d}` : `${`${d}`.substring(0, truncateBy)}...`\r\n }\r\n key={i}\r\n y={y(d) as number}\r\n x={0}\r\n width={margin.left}\r\n height={barHeight}\r\n alignment='right'\r\n style={styles?.yAxis?.labels}\r\n className={classNames?.yAxis?.labels}\r\n animate={{ duration: 0, once: true, amount: 0 }}\r\n isInView={isInView}\r\n />\r\n ))\r\n : null}\r\n </g>\r\n <g transform={`translate(${margin.left},${margin.top})`}>\r\n {rows.map((d, i) => (\r\n <g key={i} transform={`translate(0,${y(d)})`}>\r\n {columns.map(el => (\r\n <rect\r\n key={`${d}-${el}`}\r\n x={x(el)}\r\n y={0}\r\n width={barWidth}\r\n height={barHeight}\r\n style={{ fill: noDataColor }}\r\n className='stroke-1 stroke-primary-white dark:stroke-primary-gray-700'\r\n />\r\n ))}\r\n </g>\r\n ))}\r\n {data\r\n .filter(d => !checkIfNullOrUndefined(d.value))\r\n .map((d, i) => {\r\n const color = !checkIfNullOrUndefined(d.value)\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n colorScale(d.value as any)\r\n : noDataColor;\r\n return (\r\n <g\r\n key={`${d.column}-${d.row}`}\r\n transform={`translate(${x(d.column)},${y(d.row)})`}\r\n onMouseEnter={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.(d);\r\n }}\r\n onClick={() => {\r\n if (onSeriesMouseClick || detailsOnClick) {\r\n if (isEqual(mouseClickData, d) && resetSelectionOnDoubleClick) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n setMouseClickData(d);\r\n onSeriesMouseClick?.(d);\r\n }\r\n }\r\n }}\r\n onMouseMove={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n }}\r\n onMouseLeave={() => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n }}\r\n opacity={selectedColor ? (selectedColor === color ? 1 : 0.3) : 1}\r\n >\r\n <motion.rect\r\n x={0}\r\n y={0}\r\n width={barWidth}\r\n height={barHeight}\r\n className='stroke-1 stroke-primary-white dark:stroke-primary-gray-700'\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { fill: color, opacity: 0 },\r\n whileInView: {\r\n fill: color,\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n {showValues && !checkIfNullOrUndefined(d.value) ? (\r\n <motion.g\r\n variants={{\r\n initial: { opacity: 0 },\r\n whileInView: { opacity: 1, transition: { duration: animate.duration } },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n >\r\n <foreignObject key={i} y={0} x={0} width={barWidth} height={barHeight}>\r\n <div className='flex flex-col justify-center items-center h-inherit p-1'>\r\n <p\r\n className={cn(\r\n 'text-xs text-center m-0 leading-[1.25] graph-value',\r\n classNames?.graphObjectValues,\r\n )}\r\n style={{\r\n color: getTextColorBasedOnBgColor(color),\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n >\r\n {numberFormattingFunction(d.value, 'NA', precision, prefix, suffix)}\r\n </p>\r\n </div>\r\n </foreignObject>\r\n </motion.g>\r\n ) : null}\r\n </g>\r\n );\r\n })}\r\n {mouseOverData ? (\r\n <rect\r\n x={x(mouseOverData.column)}\r\n y={y(mouseOverData.row)}\r\n width={barWidth}\r\n height={barHeight}\r\n style={{\r\n fill: 'none',\r\n fillOpacity: 0,\r\n strokeWidth: 1.5,\r\n }}\r\n className='stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n />\r\n ) : null}\r\n </g>\r\n </motion.svg>\r\n {mouseOverData && tooltip && eventX && eventY ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={eventX}\r\n yPos={eventY}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n {detailsOnClick && mouseClickData !== undefined ? (\r\n <Modal\r\n open={mouseClickData !== undefined}\r\n onClose={() => {\r\n setMouseClickData(undefined);\r\n }}\r\n >\r\n <div\r\n className='graph-modal-content m-0'\r\n dangerouslySetInnerHTML={\r\n typeof detailsOnClick === 'string'\r\n ? { __html: string2HTML(detailsOnClick, mouseClickData) }\r\n : undefined\r\n }\r\n >\r\n {typeof detailsOnClick === 'function' ? detailsOnClick(mouseClickData) : null}\r\n </div>\r\n </Modal>\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import { useState, useRef, useEffect } from 'react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport {\r\n HeatMapDataType,\r\n Languages,\r\n ScaleDataType,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n AnimateDataType,\r\n} from '@/Types';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { ColorLegendWithMouseOver } from '@/Components/Elements/ColorLegendWithMouseOver';\r\nimport { LinearColorLegend } from '@/Components/Elements/LinearColorLegend';\r\nimport { ThresholdColorLegendWithMouseOver } from '@/Components/Elements/ThresholdColorLegendWithMouseOver';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { EmptyState } from '@/Components/Elements/EmptyState';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: HeatMapDataType[];\r\n\r\n // Titles, Labels, and Sources\r\n /** Title of the graph */\r\n graphTitle?: string | React.ReactNode;\r\n /** Description of the graph */\r\n graphDescription?: string | React.ReactNode;\r\n /** Footnote for the graph */\r\n footNote?: string | React.ReactNode;\r\n /** Source data for the graph */\r\n sources?: SourcesDataType[];\r\n /** Accessibility label */\r\n ariaLabel?: string;\r\n\r\n // Colors and Styling\r\n /** Array of colors for cells */\r\n colors?: string[];\r\n /** Color where data is not available */\r\n noDataColor?: string;\r\n /** Title for the color legend */\r\n colorLegendTitle?: string;\r\n /** Background color of the graph */\r\n backgroundColor?: string | boolean;\r\n /** Custom styles for the graph. Each object should be a valid React CSS style object. */\r\n styles?: StyleObject;\r\n /** Custom class names */\r\n classNames?: ClassNameObject;\r\n\r\n // Size and Spacing\r\n /** Width of the graph */\r\n width?: number;\r\n /** Height of the graph */\r\n height?: number;\r\n /** Minimum height of the graph */\r\n minHeight?: number;\r\n /** Relative height scaling factor. This overwrites the height props */\r\n relativeHeight?: number;\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n /** Left margin of the graph */\r\n leftMargin?: number;\r\n /** Right margin of the graph */\r\n rightMargin?: number;\r\n /** Top margin of the graph */\r\n topMargin?: number;\r\n /** Bottom margin of the graph */\r\n bottomMargin?: number;\r\n /** Toggles the background to fill the container. This only works if the width of the graph is defined. */\r\n fillContainer?: boolean;\r\n\r\n // Values and Ticks\r\n /** Prefix for values */\r\n prefix?: string;\r\n /** Suffix for values */\r\n suffix?: string;\r\n /** Maximum value for the chart */\r\n truncateBy?: number;\r\n /** Reference values for comparison */\r\n\r\n // Graph Parameters\r\n /** Toggle visibility of labels in the column */\r\n showColumnLabels?: boolean;\r\n /** Toggle visibility of labels in the row */\r\n showRowLabels?: boolean;\r\n /** Scale for the colors in the cell */\r\n scaleType?: ScaleDataType;\r\n /** Toggle visibility of values */\r\n showValues?: boolean;\r\n /** Toggle visibility of color scale. This is only applicable if the data props hae color parameter */\r\n showColorScale?: boolean;\r\n /** Toggle visibility of NA color in the color scale. This is only applicable if the data props hae color parameter and showColorScale prop is true */\r\n showNAColor?: boolean;\r\n /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\r\n /** Domain for the colors in the cell. */\r\n colorDomain: number[] | string[];\r\n /** Specifies the number of decimal places to display in the value. */\r\n precision?: number;\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n /** Reset selection on double-click. Only applicable when used in a dashboard context with filters. */\r\n resetSelectionOnDoubleClick?: boolean;\r\n\r\n // Interactions and Callbacks\r\n /** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n /** Details displayed on the modal when user clicks of a data point. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n /** Callback for mouse over event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n /** Callback for mouse click event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n\r\n // Configuration and Options\r\n /** Language setting */\r\n language?: Languages;\r\n /** Color theme */\r\n theme?: 'light' | 'dark';\r\n /** Unique ID for the graph */\r\n graphID?: string;\r\n}\r\n\r\nexport function HeatMap(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n colors,\r\n sources,\r\n graphDescription,\r\n showColumnLabels = true,\r\n leftMargin = 100,\r\n rightMargin = 10,\r\n truncateBy = 999,\r\n height,\r\n width,\r\n scaleType,\r\n colorDomain,\r\n footNote,\r\n colorLegendTitle,\r\n padding,\r\n backgroundColor = false,\r\n topMargin = 30,\r\n bottomMargin = 10,\r\n tooltip,\r\n onSeriesMouseOver,\r\n suffix = '',\r\n prefix = '',\r\n showRowLabels = true,\r\n relativeHeight,\r\n showValues,\r\n graphID,\r\n noDataColor = Colors.gray,\r\n showColorScale = true,\r\n onSeriesMouseClick,\r\n graphDownload = false,\r\n dataDownload = false,\r\n fillContainer = true,\r\n language = 'en',\r\n showNAColor = true,\r\n minHeight = 0,\r\n theme = 'light',\r\n ariaLabel,\r\n resetSelectionOnDoubleClick = true,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n animate = false,\r\n precision = 2,\r\n } = props;\r\n\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n const [selectedColor, setSelectedColor] = useState<string | undefined>(undefined);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(width || entries[0].target.clientWidth || 620);\r\n setSvgHeight(height || entries[0].target.clientHeight || 480);\r\n });\r\n if (graphDiv.current) {\r\n setSvgHeight(graphDiv.current.clientHeight || 480);\r\n setSvgWidth(graphDiv.current.clientWidth || 620);\r\n if (!width) resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, [width, height]);\r\n const scale =\r\n scaleType ||\r\n (typeof colorDomain[0] === 'string'\r\n ? 'categorical'\r\n : colorDomain.length === 2\r\n ? 'linear'\r\n : 'threshold');\r\n\r\n return (\r\n <div\r\n className={`${theme || 'light'} flex ${width ? 'grow-0' : 'grow'} ${\r\n !fillContainer ? 'w-fit' : 'w-full'\r\n }`}\r\n dir={language === 'he' || language === 'ar' ? 'rtl' : undefined}\r\n >\r\n <div\r\n className={cn(\r\n `${\r\n !backgroundColor\r\n ? 'bg-transparent '\r\n : backgroundColor === true\r\n ? 'bg-primary-gray-200 dark:bg-primary-gray-650 '\r\n : ''\r\n }ml-auto mr-auto flex flex-col grow h-inherit ${language || 'en'}`,\r\n !fillContainer ? 'w-fit' : 'w-full',\r\n classNames?.graphContainer,\r\n )}\r\n style={{\r\n ...(styles?.graphContainer || {}),\r\n ...(backgroundColor && backgroundColor !== true ? { backgroundColor } : {}),\r\n }}\r\n id={graphID}\r\n ref={graphParentDiv}\r\n aria-label={\r\n ariaLabel ||\r\n `${\r\n graphTitle ? `The graph shows ${graphTitle}. ` : ''\r\n }This is a heatmap. ${graphDescription ? ` ${graphDescription}` : ''}`\r\n }\r\n >\r\n <div\r\n className='flex grow'\r\n style={{ padding: backgroundColor ? padding || '1rem' : padding || 0 }}\r\n >\r\n <div className='flex flex-col w-full gap-4 grow justify-between'>\r\n {graphTitle || graphDescription || graphDownload || dataDownload ? (\r\n <GraphHeader\r\n styles={{\r\n title: styles?.title,\r\n description: styles?.description,\r\n }}\r\n classNames={{\r\n title: classNames?.title,\r\n description: classNames?.description,\r\n }}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n width={width}\r\n graphDownload={graphDownload ? graphParentDiv.current : undefined}\r\n dataDownload={\r\n dataDownload\r\n ? data.map(d => d.data).filter(d => d !== undefined).length > 0\r\n ? data.map(d => d.data).filter(d => d !== undefined)\r\n : data.filter(d => d !== undefined)\r\n : null\r\n }\r\n />\r\n ) : null}\r\n <div className='grow flex flex-col justify-center gap-3 w-full'>\r\n {data.length === 0 ? (\r\n <EmptyState />\r\n ) : (\r\n <>\r\n {showColorScale ? (\r\n scale === 'categorical' ? (\r\n <ColorLegendWithMouseOver\r\n width={fillContainer ? undefined : width}\r\n colorLegendTitle={colorLegendTitle}\r\n colors={\r\n colors ||\r\n (typeof colorDomain[0] === 'string'\r\n ? Colors[theme].categoricalColors.colors\r\n : colorDomain.length === 2\r\n ? [\r\n Colors[theme].sequentialColors.neutralColorsx09[0],\r\n Colors[theme].sequentialColors.neutralColorsx09[8],\r\n ]\r\n : Colors[theme].sequentialColors[\r\n `neutralColorsx0${\r\n (colorDomain.length + 1) as 4 | 5 | 6 | 7 | 8 | 9\r\n }`\r\n ])\r\n }\r\n colorDomain={colorDomain.map(d => `${d}`)}\r\n setSelectedColor={setSelectedColor}\r\n showNAColor={showNAColor}\r\n />\r\n ) : scale === 'threshold' ? (\r\n <ThresholdColorLegendWithMouseOver\r\n width={fillContainer ? undefined : width}\r\n colorLegendTitle={colorLegendTitle}\r\n colors={\r\n colors ||\r\n (typeof colorDomain[0] === 'string'\r\n ? Colors[theme].categoricalColors.colors\r\n : colorDomain.length === 2\r\n ? [\r\n Colors[theme].sequentialColors.neutralColorsx09[0],\r\n Colors[theme].sequentialColors.neutralColorsx09[8],\r\n ]\r\n : Colors[theme].sequentialColors[\r\n `neutralColorsx0${\r\n (colorDomain.length + 1) as 4 | 5 | 6 | 7 | 8 | 9\r\n }`\r\n ])\r\n }\r\n colorDomain={colorDomain as number[]}\r\n setSelectedColor={setSelectedColor}\r\n naColor={noDataColor}\r\n showNAColor={showNAColor}\r\n />\r\n ) : (\r\n <LinearColorLegend\r\n width={fillContainer ? undefined : width}\r\n colorLegendTitle={colorLegendTitle}\r\n colors={\r\n colors || [\r\n Colors[theme].sequentialColors.neutralColorsx09[0],\r\n Colors[theme].sequentialColors.neutralColorsx09[8],\r\n ]\r\n }\r\n colorDomain={colorDomain as number[]}\r\n />\r\n )\r\n ) : null}\r\n <div\r\n className='flex grow flex-col justify-center w-full leading-0'\r\n ref={graphDiv}\r\n aria-label='Graph area'\r\n >\r\n {(width || svgWidth) && (height || svgHeight) ? (\r\n <Graph\r\n data={data}\r\n colorDomain={colorDomain}\r\n width={width || svgWidth}\r\n colors={\r\n colors ||\r\n (typeof colorDomain[0] === 'string'\r\n ? Colors[theme].categoricalColors.colors\r\n : colorDomain.length === 2\r\n ? [\r\n Colors[theme].sequentialColors.neutralColorsx09[0],\r\n Colors[theme].sequentialColors.neutralColorsx09[8],\r\n ]\r\n : Colors[theme].sequentialColors[\r\n `neutralColorsx0${\r\n (colorDomain.length + 1) as 4 | 5 | 6 | 7 | 8 | 9\r\n }`\r\n ])\r\n }\r\n noDataColor={noDataColor}\r\n scaleType={scale}\r\n height={Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}\r\n showColumnLabels={showColumnLabels}\r\n leftMargin={leftMargin}\r\n rightMargin={rightMargin}\r\n topMargin={topMargin}\r\n bottomMargin={bottomMargin}\r\n selectedColor={selectedColor}\r\n truncateBy={truncateBy}\r\n showRowLabels={showRowLabels}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n showValues={showValues}\r\n suffix={suffix}\r\n prefix={prefix}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n detailsOnClick={detailsOnClick}\r\n styles={styles}\r\n classNames={classNames}\r\n animate={\r\n animate === true\r\n ? { duration: 0.5, once: true, amount: 0.5 }\r\n : animate || { duration: 0, once: true, amount: 0 }\r\n }\r\n precision={precision}\r\n />\r\n ) : null}\r\n </div>\r\n </>\r\n )}\r\n </div>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n}\r\n"],"names":["Graph","props","data","showColumnLabels","leftMargin","rightMargin","truncateBy","width","height","topMargin","bottomMargin","tooltip","onSeriesMouseOver","suffix","prefix","showValues","colorDomain","colors","noDataColor","scaleType","showRowLabels","selectedColor","onSeriesMouseClick","resetSelectionOnDoubleClick","detailsOnClick","styles","classNames","animate","precision","svgRef","useRef","isInView","useInView","margin","mouseClickData","setMouseClickData","useState","mouseOverData","setMouseOverData","eventX","setEventX","eventY","setEventY","graphWidth","graphHeight","columns","uniqBy","d","rows","y","scaleBand","barHeight","x","barWidth","colorScale","scaleOrdinal","scaleThreshold","scaleLinear","jsxs","Fragment","motion","jsx","i","XAxesLabels","YAxesLabels","el","checkIfNullOrUndefined","color","event","isEqual","cn","getTextColorBasedOnBgColor","Tooltip","Modal","string2HTML","HeatMap","graphTitle","sources","graphDescription","footNote","colorLegendTitle","padding","backgroundColor","relativeHeight","graphID","Colors","showColorScale","graphDownload","dataDownload","fillContainer","language","showNAColor","minHeight","theme","ariaLabel","svgWidth","setSvgWidth","svgHeight","setSvgHeight","setSelectedColor","graphDiv","graphParentDiv","useEffect","resizeObserver","entries","scale","GraphHeader","EmptyState","ColorLegendWithMouseOver","ThresholdColorLegendWithMouseOver","LinearColorLegend","GraphFooter"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAyDO,SAASA,GAAMC,GAAc;AAClC,QAAM;AAAA,IACJ,MAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,YAAAC;AAAA,IACA,aAAAC;AAAA,IACA,YAAAC;AAAA,IACA,OAAAC;AAAA,IACA,QAAAC;AAAA,IACA,WAAAC;AAAA,IACA,cAAAC;AAAA,IACA,SAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,QAAAC;AAAA,IACA,QAAAC;AAAA,IACA,YAAAC;AAAA,IACA,aAAAC;AAAA,IACA,QAAAC;AAAA,IACA,aAAAC;AAAA,IACA,WAAAC;AAAA,IACA,eAAAC;AAAA,IACA,eAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,6BAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,QAAAC;AAAA,IACA,YAAAC;AAAA,IACA,SAAAC;AAAA,IACA,WAAAC;AAAA,EAAA,IACE3B,GACE4B,IAASC,GAAO,IAAI,GACpBC,IAAWC,GAAUH,GAAQ;AAAA,IACjC,MAAMF,EAAQ;AAAA,IACd,QAAQA,EAAQ;AAAA,EAAA,CACjB,GACKM,IAAS;AAAA,IACb,KAAKxB;AAAA,IACL,QAAQC;AAAA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js"),z=require("react"),_=require("./Spinner-DA6Z5E4n.cjs"),F=require("./index-CZLvTu6p.cjs"),ee=require("./TreeMapGraph.cjs"),re=require("./DonutChart.cjs"),te=require("./BarGraph.cjs"),B=require("./Colors.cjs"),ie=require("./init-DU0ybBc_.cjs"),H=require("./linear-BVckp9RD.cjs");function ne(o,s){let c=0;for(let a of o)a!=null&&(a=+a)>=a&&++c;return c}function oe(o){return o}var ae=Array.prototype,se=ae.slice;function N(o){return()=>o}function le(o,s,c){let a;for(;;){const e=H.tickIncrement(o,s,c);if(e===a||e===0||!isFinite(e))return[o,s];e>0?(o=Math.floor(o/e)*e,s=Math.ceil(s/e)*e):e<0&&(o=Math.ceil(o*e)/e,s=Math.floor(s*e)/e),a=e}}function ue(o){return Math.max(1,Math.ceil(Math.log(ne(o))/Math.LN2)+1)}function ce(){var o=oe,s=F.extent,c=ue;function a(e){Array.isArray(e)||(e=Array.from(e));var r,m=e.length,l,p,g=new Array(m);for(r=0;r<m;++r)g[r]=o(e[r],r,e);var f=s(g),t=f[0],i=f[1],n=c(g,t,i);if(!Array.isArray(n)){const C=i,y=+n;if(s===F.extent&&([t,i]=le(t,i,y)),n=H.ticks(t,i,y),n[0]<=t&&(p=H.tickIncrement(t,i,y)),n[n.length-1]>=i)if(C>=i&&s===F.extent){const h=H.tickIncrement(t,i,y);isFinite(h)&&(h>0?i=(Math.floor(i/h)+1)*h:h<0&&(i=(Math.ceil(i*-h)+1)/-h))}else n.pop()}for(var u=n.length,x=0,d=u;n[x]<=t;)++x;for(;n[d-1]>i;)--d;(x||d<u)&&(n=n.slice(x,d),u=d-x);var M=new Array(u+1),b;for(r=0;r<=u;++r)b=M[r]=[],b.x0=r>0?n[r-1]:t,b.x1=r<u?n[r]:i;if(isFinite(p)){if(p>0)for(r=0;r<m;++r)(l=g[r])!=null&&t<=l&&l<=i&&M[Math.min(u,Math.floor((l-t)/p))].push(e[r]);else if(p<0){for(r=0;r<m;++r)if((l=g[r])!=null&&t<=l&&l<=i){const C=Math.floor((t-l)*p);M[Math.min(u,C+(n[C]<=l))].push(e[r])}}}else for(r=0;r<m;++r)(l=g[r])!=null&&t<=l&&l<=i&&M[ie.bisectRight(n,l,0,u)].push(e[r]);return M}return a.value=function(e){return arguments.length?(o=typeof e=="function"?e:N(e),a):o},a.domain=function(e){return arguments.length?(s=typeof e=="function"?e:N([e[0],e[1]]),a):s},a.thresholds=function(e){return arguments.length?(c=typeof e=="function"?e:N(Array.isArray(e)?se.call(e):e),a):c},a}function he(o){const{data:s,graphTitle:c,sources:a,graphDescription:e,barPadding:r,showValues:m,showTicks:l,leftMargin:p,rightMargin:g,height:f,width:t,footNote:i,colors:n,padding:u,backgroundColor:x,topMargin:d,bottomMargin:M,showLabels:b,relativeHeight:C,tooltip:y,onSeriesMouseOver:h,refValues:W,graphID:S,maxValue:U,onSeriesMouseClick:q,graphDownload:A,dataDownload:E,numberOfBins:O,truncateBy:J,graphType:I,barGraphLayout:K,donutStrokeWidth:Q,sortData:V,language:D,minHeight:L,theme:w="light",maxBarThickness:X,ariaLabel:G,detailsOnClick:R,styles:T,classNames:P,precision:$}=o,[k,Y]=z.useState([]);return z.useEffect(()=>{const Z=ce().thresholds(O||10).value(v=>v.value)(s).map(v=>({label:`${v.x0}-${v.x1}`,size:v.length,data:{options:`${v.x0}-${v.x1}`,frequency:v.length}}));Y(Z)},[s,O]),k.length===0?j.jsxRuntimeExports.jsx("div",{style:{width:`${t}px`,height:`${f}px`,margin:"auto"},children:j.jsxRuntimeExports.jsx("div",{className:"flex m-auto items-center justify-center p-0 leading-none text-base h-40",children:j.jsxRuntimeExports.jsx(_.y,{})})}):I==="circlePacking"?j.jsxRuntimeExports.jsx(F.CirclePackingGraph,{colors:n||B.Colors.graphMainColor,graphTitle:c,graphDescription:e,footNote:i,width:t,height:f,sources:a,leftMargin:p,rightMargin:g,backgroundColor:x,padding:u,topMargin:d,bottomMargin:M,relativeHeight:C,showLabels:b,tooltip:y,onSeriesMouseOver:h,showColorScale:!1,showValues:m,graphID:S,onSeriesMouseClick:q,graphDownload:A,dataDownload:E,data:k,language:D,minHeight:L,theme:w,ariaLabel:G,detailsOnClick:R,styles:T,classNames:P,precision:$}):I==="treeMap"?j.jsxRuntimeExports.jsx(ee.TreeMapGraph,{colors:n||B.Colors.graphMainColor,graphTitle:c,graphDescription:e,footNote:i,width:t,height:f,sources:a,leftMargin:p,rightMargin:g,backgroundColor:x,padding:u,topMargin:d,bottomMargin:M,relativeHeight:C,showLabels:b,tooltip:y,onSeriesMouseOver:h,showColorScale:!1,showValues:m,graphID:S,onSeriesMouseClick:q,graphDownload:A,dataDownload:E,data:k,language:D,minHeight:L,theme:w,ariaLabel:G,detailsOnClick:R,styles:T,classNames:P,precision:$}):I==="donutChart"?j.jsxRuntimeExports.jsx(re.DonutChart,{colors:n||B.Colors[w].categoricalColors.colors,graphTitle:c,graphDescription:e,footNote:i,radius:t&&f?t<f?t:f:t||f||void 0,sources:a,backgroundColor:x,padding:u,tooltip:y,onSeriesMouseOver:h,graphID:S,onSeriesMouseClick:q,graphDownload:A,dataDownload:E,data:k,strokeWidth:Q,showColorScale:!0,sortData:V,language:D,theme:w,ariaLabel:G,detailsOnClick:R,styles:T,classNames:P,precision:$}):j.jsxRuntimeExports.jsx(te.SimpleBarGraph,{colors:n||B.Colors.graphMainColor,graphTitle:c,graphDescription:e,footNote:i,width:t,height:f,sources:a,leftMargin:p,rightMargin:g,backgroundColor:x,padding:u,topMargin:d,bottomMargin:M,relativeHeight:C,showLabels:b,tooltip:y,onSeriesMouseOver:h,showColorScale:!1,showValues:m,graphID:S,onSeriesMouseClick:q,graphDownload:A,dataDownload:E,data:k,barPadding:r,refValues:W,truncateBy:J,maxValue:U,showTicks:l,sortData:V,language:D,minHeight:L,theme:w,maxBarThickness:X,ariaLabel:G,orientation:K,detailsOnClick:R,styles:T,classNames:P,precision:$})}exports.Histogram=he;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const j=require("./index-CHPV5EwG-DDoeWRVt.cjs"),z=require("react"),_=require("./Spinner-DA6Z5E4n.cjs"),F=require("./index-BbNoLJ_w.cjs"),ee=require("./TreeMapGraph.cjs"),re=require("./DonutChart.cjs"),te=require("./BarGraph.cjs"),B=require("./Colors.cjs"),ie=require("./init-DU0ybBc_.cjs"),H=require("./linear-BVckp9RD.cjs");function ne(o,s){let c=0;for(let a of o)a!=null&&(a=+a)>=a&&++c;return c}function oe(o){return o}var ae=Array.prototype,se=ae.slice;function N(o){return()=>o}function le(o,s,c){let a;for(;;){const e=H.tickIncrement(o,s,c);if(e===a||e===0||!isFinite(e))return[o,s];e>0?(o=Math.floor(o/e)*e,s=Math.ceil(s/e)*e):e<0&&(o=Math.ceil(o*e)/e,s=Math.floor(s*e)/e),a=e}}function ue(o){return Math.max(1,Math.ceil(Math.log(ne(o))/Math.LN2)+1)}function ce(){var o=oe,s=F.extent,c=ue;function a(e){Array.isArray(e)||(e=Array.from(e));var r,m=e.length,l,p,g=new Array(m);for(r=0;r<m;++r)g[r]=o(e[r],r,e);var f=s(g),t=f[0],i=f[1],n=c(g,t,i);if(!Array.isArray(n)){const C=i,y=+n;if(s===F.extent&&([t,i]=le(t,i,y)),n=H.ticks(t,i,y),n[0]<=t&&(p=H.tickIncrement(t,i,y)),n[n.length-1]>=i)if(C>=i&&s===F.extent){const h=H.tickIncrement(t,i,y);isFinite(h)&&(h>0?i=(Math.floor(i/h)+1)*h:h<0&&(i=(Math.ceil(i*-h)+1)/-h))}else n.pop()}for(var u=n.length,x=0,d=u;n[x]<=t;)++x;for(;n[d-1]>i;)--d;(x||d<u)&&(n=n.slice(x,d),u=d-x);var M=new Array(u+1),b;for(r=0;r<=u;++r)b=M[r]=[],b.x0=r>0?n[r-1]:t,b.x1=r<u?n[r]:i;if(isFinite(p)){if(p>0)for(r=0;r<m;++r)(l=g[r])!=null&&t<=l&&l<=i&&M[Math.min(u,Math.floor((l-t)/p))].push(e[r]);else if(p<0){for(r=0;r<m;++r)if((l=g[r])!=null&&t<=l&&l<=i){const C=Math.floor((t-l)*p);M[Math.min(u,C+(n[C]<=l))].push(e[r])}}}else for(r=0;r<m;++r)(l=g[r])!=null&&t<=l&&l<=i&&M[ie.bisectRight(n,l,0,u)].push(e[r]);return M}return a.value=function(e){return arguments.length?(o=typeof e=="function"?e:N(e),a):o},a.domain=function(e){return arguments.length?(s=typeof e=="function"?e:N([e[0],e[1]]),a):s},a.thresholds=function(e){return arguments.length?(c=typeof e=="function"?e:N(Array.isArray(e)?se.call(e):e),a):c},a}function he(o){const{data:s,graphTitle:c,sources:a,graphDescription:e,barPadding:r,showValues:m,showTicks:l,leftMargin:p,rightMargin:g,height:f,width:t,footNote:i,colors:n,padding:u,backgroundColor:x,topMargin:d,bottomMargin:M,showLabels:b,relativeHeight:C,tooltip:y,onSeriesMouseOver:h,refValues:W,graphID:S,maxValue:U,onSeriesMouseClick:q,graphDownload:A,dataDownload:E,numberOfBins:O,truncateBy:J,graphType:I,barGraphLayout:K,donutStrokeWidth:Q,sortData:V,language:D,minHeight:L,theme:w="light",maxBarThickness:X,ariaLabel:G,detailsOnClick:R,styles:T,classNames:P,precision:$}=o,[k,Y]=z.useState([]);return z.useEffect(()=>{const Z=ce().thresholds(O||10).value(v=>v.value)(s).map(v=>({label:`${v.x0}-${v.x1}`,size:v.length,data:{options:`${v.x0}-${v.x1}`,frequency:v.length}}));Y(Z)},[s,O]),k.length===0?j.jsxRuntimeExports.jsx("div",{style:{width:`${t}px`,height:`${f}px`,margin:"auto"},children:j.jsxRuntimeExports.jsx("div",{className:"flex m-auto items-center justify-center p-0 leading-none text-base h-40",children:j.jsxRuntimeExports.jsx(_.y,{})})}):I==="circlePacking"?j.jsxRuntimeExports.jsx(F.CirclePackingGraph,{colors:n||B.Colors.graphMainColor,graphTitle:c,graphDescription:e,footNote:i,width:t,height:f,sources:a,leftMargin:p,rightMargin:g,backgroundColor:x,padding:u,topMargin:d,bottomMargin:M,relativeHeight:C,showLabels:b,tooltip:y,onSeriesMouseOver:h,showColorScale:!1,showValues:m,graphID:S,onSeriesMouseClick:q,graphDownload:A,dataDownload:E,data:k,language:D,minHeight:L,theme:w,ariaLabel:G,detailsOnClick:R,styles:T,classNames:P,precision:$}):I==="treeMap"?j.jsxRuntimeExports.jsx(ee.TreeMapGraph,{colors:n||B.Colors.graphMainColor,graphTitle:c,graphDescription:e,footNote:i,width:t,height:f,sources:a,leftMargin:p,rightMargin:g,backgroundColor:x,padding:u,topMargin:d,bottomMargin:M,relativeHeight:C,showLabels:b,tooltip:y,onSeriesMouseOver:h,showColorScale:!1,showValues:m,graphID:S,onSeriesMouseClick:q,graphDownload:A,dataDownload:E,data:k,language:D,minHeight:L,theme:w,ariaLabel:G,detailsOnClick:R,styles:T,classNames:P,precision:$}):I==="donutChart"?j.jsxRuntimeExports.jsx(re.DonutChart,{colors:n||B.Colors[w].categoricalColors.colors,graphTitle:c,graphDescription:e,footNote:i,radius:t&&f?t<f?t:f:t||f||void 0,sources:a,backgroundColor:x,padding:u,tooltip:y,onSeriesMouseOver:h,graphID:S,onSeriesMouseClick:q,graphDownload:A,dataDownload:E,data:k,strokeWidth:Q,showColorScale:!0,sortData:V,language:D,theme:w,ariaLabel:G,detailsOnClick:R,styles:T,classNames:P,precision:$}):j.jsxRuntimeExports.jsx(te.SimpleBarGraph,{colors:n||B.Colors.graphMainColor,graphTitle:c,graphDescription:e,footNote:i,width:t,height:f,sources:a,leftMargin:p,rightMargin:g,backgroundColor:x,padding:u,topMargin:d,bottomMargin:M,relativeHeight:C,showLabels:b,tooltip:y,onSeriesMouseOver:h,showColorScale:!1,showValues:m,graphID:S,onSeriesMouseClick:q,graphDownload:A,dataDownload:E,data:k,barPadding:r,refValues:W,truncateBy:J,maxValue:U,showTicks:l,sortData:V,language:D,minHeight:L,theme:w,maxBarThickness:X,ariaLabel:G,orientation:K,detailsOnClick:R,styles:T,classNames:P,precision:$})}exports.Histogram=he;
2
2
  //# sourceMappingURL=Histogram.cjs.map
package/dist/Histogram.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { j as C } from "./index-CHPV5EwG-BPSP-7Jg.js";
2
2
  import { useState as Z, useEffect as _ } from "react";
3
3
  import { y as rr } from "./Spinner-C85UF28E.js";
4
- import { e as P, C as er } from "./index-DGAaLNu9.js";
4
+ import { e as P, C as er } from "./index-Bc5VF70V.js";
5
5
  import { TreeMapGraph as tr } from "./TreeMapGraph.js";
6
6
  import { DonutChart as or } from "./DonutChart.js";
7
7
  import { SimpleBarGraph as ir } from "./BarGraph.js";