@undp/data-viz 1.3.1 → 1.4.0

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 (103) hide show
  1. package/dist/DataCards.cjs +21 -1
  2. package/dist/DataCards.cjs.map +1 -1
  3. package/dist/DataCards.js +622 -12
  4. package/dist/DataCards.js.map +1 -1
  5. package/dist/GraphEl-B6SoGRFW.cjs +2 -0
  6. package/dist/GraphEl-B6SoGRFW.cjs.map +1 -0
  7. package/dist/{checkIfMultiple-BB7PlCNh.js → GraphEl-Cw2tDUb3.js} +129 -1163
  8. package/dist/GraphEl-Cw2tDUb3.js.map +1 -0
  9. package/dist/GriddedGraphs.cjs +1 -1
  10. package/dist/GriddedGraphs.cjs.map +1 -1
  11. package/dist/GriddedGraphs.d.ts +2 -4
  12. package/dist/GriddedGraphs.js +9 -8
  13. package/dist/GriddedGraphs.js.map +1 -1
  14. package/dist/GriddedGraphsFromConfig.d.ts +2 -4
  15. package/dist/MultiGraphDashboard.cjs +1 -1
  16. package/dist/MultiGraphDashboard.cjs.map +1 -1
  17. package/dist/MultiGraphDashboard.d.ts +16 -12
  18. package/dist/MultiGraphDashboard.js +2 -2
  19. package/dist/MultiGraphDashboardFromConfig.d.ts +16 -12
  20. package/dist/MultiGraphDashboardWideToLongFormat.cjs +1 -1
  21. package/dist/MultiGraphDashboardWideToLongFormat.js +1 -1
  22. package/dist/PerformanceIntensiveMultiGraphDashboard.cjs +2 -0
  23. package/dist/PerformanceIntensiveMultiGraphDashboard.cjs.map +1 -0
  24. package/dist/PerformanceIntensiveMultiGraphDashboard.d.ts +566 -0
  25. package/dist/PerformanceIntensiveMultiGraphDashboard.js +353 -0
  26. package/dist/PerformanceIntensiveMultiGraphDashboard.js.map +1 -0
  27. package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.cjs +2 -0
  28. package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.cjs.map +1 -0
  29. package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.d.ts +570 -0
  30. package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.js +38 -0
  31. package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.js.map +1 -0
  32. package/dist/PerformanceIntensiveScrollStory.cjs +2 -0
  33. package/dist/PerformanceIntensiveScrollStory.cjs.map +1 -0
  34. package/dist/PerformanceIntensiveScrollStory.d.ts +493 -0
  35. package/dist/PerformanceIntensiveScrollStory.js +122 -0
  36. package/dist/PerformanceIntensiveScrollStory.js.map +1 -0
  37. package/dist/ScrollStory.cjs.map +1 -1
  38. package/dist/ScrollStory.d.ts +3 -5
  39. package/dist/ScrollStory.js.map +1 -1
  40. package/dist/SingleGraphDashboard.cjs +1 -1
  41. package/dist/SingleGraphDashboard.cjs.map +1 -1
  42. package/dist/SingleGraphDashboard.d.ts +2 -5
  43. package/dist/SingleGraphDashboard.js +194 -194
  44. package/dist/SingleGraphDashboard.js.map +1 -1
  45. package/dist/SingleGraphDashboardFromConfig.d.ts +2 -4
  46. package/dist/SingleGraphDashboardGeoHubMaps.cjs +2 -0
  47. package/dist/SingleGraphDashboardGeoHubMaps.cjs.map +1 -0
  48. package/dist/SingleGraphDashboardGeoHubMaps.d.ts +428 -0
  49. package/dist/SingleGraphDashboardGeoHubMaps.js +185 -0
  50. package/dist/SingleGraphDashboardGeoHubMaps.js.map +1 -0
  51. package/dist/SingleGraphDashboardGeoHubMapsFromConfig.cjs +2 -0
  52. package/dist/SingleGraphDashboardGeoHubMapsFromConfig.cjs.map +1 -0
  53. package/dist/SingleGraphDashboardGeoHubMapsFromConfig.d.ts +432 -0
  54. package/dist/SingleGraphDashboardGeoHubMapsFromConfig.js +25 -0
  55. package/dist/SingleGraphDashboardGeoHubMapsFromConfig.js.map +1 -0
  56. package/dist/SingleGraphDashboardThreeDGraphs.cjs +2 -0
  57. package/dist/SingleGraphDashboardThreeDGraphs.cjs.map +1 -0
  58. package/dist/SingleGraphDashboardThreeDGraphs.d.ts +540 -0
  59. package/dist/SingleGraphDashboardThreeDGraphs.js +610 -0
  60. package/dist/SingleGraphDashboardThreeDGraphs.js.map +1 -0
  61. package/dist/SingleGraphDashboardThreeDGraphsFromConfig.cjs +2 -0
  62. package/dist/SingleGraphDashboardThreeDGraphsFromConfig.cjs.map +1 -0
  63. package/dist/SingleGraphDashboardThreeDGraphsFromConfig.d.ts +543 -0
  64. package/dist/SingleGraphDashboardThreeDGraphsFromConfig.js +35 -0
  65. package/dist/SingleGraphDashboardThreeDGraphsFromConfig.js.map +1 -0
  66. package/dist/Types.d.ts +38 -11
  67. package/dist/checkIfMultiple-CYp3vADF.js +912 -0
  68. package/dist/checkIfMultiple-CYp3vADF.js.map +1 -0
  69. package/dist/checkIfMultiple-Do4kADNr.cjs +12 -0
  70. package/dist/checkIfMultiple-Do4kADNr.cjs.map +1 -0
  71. package/dist/getSchema.cjs.map +1 -1
  72. package/dist/getSchema.d.ts +7 -5
  73. package/dist/getSchema.js.map +1 -1
  74. package/dist/index.cjs +1 -1
  75. package/dist/index.d.ts +330 -163
  76. package/dist/index.js +150 -136
  77. package/dist/index.js.map +1 -1
  78. package/dist/transformData.cjs +1 -1
  79. package/dist/transformData.d.ts +5 -5
  80. package/dist/transformData.js +2 -2
  81. package/dist/{transformDataForAggregation-DAQJWGNL.js → transformDataForAggregation-CdcwlnNe.js} +2 -2
  82. package/dist/transformDataForAggregation-CdcwlnNe.js.map +1 -0
  83. package/dist/{transformDataForAggregation-BUGJnson.cjs → transformDataForAggregation-Du-Hei-W.cjs} +2 -2
  84. package/dist/transformDataForAggregation-Du-Hei-W.cjs.map +1 -0
  85. package/dist/{transformDataForGraphFromFile-DdNiOWeC.js → transformDataForGraphFromFile-CA0rw80A.js} +2 -2
  86. package/dist/{transformDataForGraphFromFile-DdNiOWeC.js.map → transformDataForGraphFromFile-CA0rw80A.js.map} +1 -1
  87. package/dist/{transformDataForGraphFromFile-CrntpaMU.cjs → transformDataForGraphFromFile-D9G3ToQf.cjs} +2 -2
  88. package/dist/{transformDataForGraphFromFile-CrntpaMU.cjs.map → transformDataForGraphFromFile-D9G3ToQf.cjs.map} +1 -1
  89. package/dist/transformDataForSelect-D8AuvYdf.js +14 -0
  90. package/dist/transformDataForSelect-D8AuvYdf.js.map +1 -0
  91. package/dist/transformDataForSelect-YmStusCI.cjs +2 -0
  92. package/dist/transformDataForSelect-YmStusCI.cjs.map +1 -0
  93. package/dist/validateSchema.d.ts +2 -4
  94. package/package.json +36 -1
  95. package/dist/checkIfMultiple-BB7PlCNh.js.map +0 -1
  96. package/dist/checkIfMultiple-D5ysrI7G.cjs +0 -12
  97. package/dist/checkIfMultiple-D5ysrI7G.cjs.map +0 -1
  98. package/dist/index-D9h2WYDS.cjs +0 -22
  99. package/dist/index-D9h2WYDS.cjs.map +0 -1
  100. package/dist/index-OCoyy1wG.js +0 -635
  101. package/dist/index-OCoyy1wG.js.map +0 -1
  102. package/dist/transformDataForAggregation-BUGJnson.cjs.map +0 -1
  103. package/dist/transformDataForAggregation-DAQJWGNL.js.map +0 -1
package/dist/DataCards.js CHANGED
@@ -1,15 +1,625 @@
1
- import "./index-CHPV5EwG-BPSP-7Jg.js";
2
- import "react";
3
- import "./index-C1rRk_50.js";
4
- import "./index-UV9hjG_S.js";
5
- import "./index-DxagiOHo.js";
6
- import "./DropdownSelect-CDC9lEqU.js";
7
- import "./Typography-Ctgfl1J5.js";
8
- import { D as x } from "./index-OCoyy1wG.js";
9
- import "./GraphFooter.js";
10
- import "./GraphHeader.js";
11
- import "./getUniqValue-BtUENB2H.js";
1
+ import { a as s, m, b as ye, j as i } from "./index-CHPV5EwG-BPSP-7Jg.js";
2
+ import $, { useState as w, useEffect as z, useMemo as Q } from "react";
3
+ import { i as ge } from "./index-C1rRk_50.js";
4
+ import { f as L } from "./index-UV9hjG_S.js";
5
+ import { s as he } from "./index-DxagiOHo.js";
6
+ import { Z as W, H as Z } from "./DropdownSelect-CDC9lEqU.js";
7
+ import { u as X } from "./Typography-Ctgfl1J5.js";
8
+ import { b as P } from "./x-CnsEH4Ox-DDvAJndW.js";
9
+ import { d as xe, e as be } from "./index-BmCqpO1B.js";
10
+ import { X as ve } from "./Modal-CUU6ZK3U.js";
11
+ import { CsvDownloadButton as Ne } from "./CsvDownloadButton.js";
12
+ import { s as J } from "./string2HTML-CWHGfz_d.js";
13
+ import { GraphFooter as je } from "./GraphFooter.js";
14
+ import { GraphHeader as we } from "./GraphHeader.js";
15
+ import { g as ke } from "./getUniqValue-BtUENB2H.js";
16
+ import { t as Y } from "./transformDataForSelect-D8AuvYdf.js";
17
+ /**
18
+ * @license lucide-react v0.488.0 - ISC
19
+ *
20
+ * This source code is licensed under the ISC license.
21
+ * See the LICENSE file in the root directory of this source tree.
22
+ */
23
+ const Ce = [["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]], Se = P("chevron-left", Ce);
24
+ /**
25
+ * @license lucide-react v0.488.0 - ISC
26
+ *
27
+ * This source code is licensed under the ISC license.
28
+ * See the LICENSE file in the root directory of this source tree.
29
+ */
30
+ const Ve = [
31
+ ["circle", { cx: "12", cy: "12", r: "1", key: "41hilf" }],
32
+ ["circle", { cx: "19", cy: "12", r: "1", key: "1wjl8i" }],
33
+ ["circle", { cx: "5", cy: "12", r: "1", key: "1pcz8c" }]
34
+ ], $e = P("ellipsis", Ve);
35
+ /**
36
+ * @license lucide-react v0.488.0 - ISC
37
+ *
38
+ * This source code is licensed under the ISC license.
39
+ * See the LICENSE file in the root directory of this source tree.
40
+ */
41
+ const De = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]], ze = P("chevron-right", De);
42
+ function re({ className: t, ...e }) {
43
+ return /* @__PURE__ */ s.jsx(
44
+ "nav",
45
+ {
46
+ ...e,
47
+ role: "navigation",
48
+ "aria-label": "pagination",
49
+ className: m("mx-auto flex w-full justify-center", t)
50
+ }
51
+ );
52
+ }
53
+ re.displayName = "PaginationUnit";
54
+ const te = $.forwardRef(
55
+ ({ className: t, ...e }, l) => /* @__PURE__ */ s.jsx(
56
+ "ul",
57
+ {
58
+ ...e,
59
+ ref: l,
60
+ className: m("flex flex-row items-center gap-1 list-none", t)
61
+ }
62
+ )
63
+ );
64
+ te.displayName = "PaginationContent";
65
+ const I = $.forwardRef(
66
+ ({ className: t, ...e }, l) => /* @__PURE__ */ s.jsx("li", { ...e, ref: l, className: m("mr-2 last:mr-0", t) })
67
+ );
68
+ I.displayName = "PaginationItem";
69
+ function B({
70
+ className: t,
71
+ children: e,
72
+ ...l
73
+ }) {
74
+ return /* @__PURE__ */ s.jsx(
75
+ "button",
76
+ {
77
+ ...l,
78
+ type: "button",
79
+ className: m(
80
+ "p-4 text-base text-primary-black dark:text-primary-gray-100 dark:hover:bg-primary-gray-600",
81
+ t
82
+ ),
83
+ children: e
84
+ }
85
+ );
86
+ }
87
+ B.displayName = "PaginationLink";
88
+ function se({ className: t, ...e }) {
89
+ return /* @__PURE__ */ s.jsx(
90
+ B,
91
+ {
92
+ ...e,
93
+ "aria-label": "Go to previous page",
94
+ className: m(
95
+ "p-2 bg-primary-gray-300 dark:bg-primary-gray-600 rtl:scale-x-[-1] rounded-full hover:bg-primary-gray-400 dark:hover:bg-primary-gray-550",
96
+ t
97
+ ),
98
+ children: /* @__PURE__ */ s.jsx(Se, { className: "h-6 w-6 stroke-primary-gray-700 dark:stroke-primary-gray-100" })
99
+ }
100
+ );
101
+ }
102
+ se.displayName = "PaginationPrevious";
103
+ function le({ className: t, ...e }) {
104
+ return /* @__PURE__ */ s.jsx(
105
+ B,
106
+ {
107
+ ...e,
108
+ "aria-label": "Go to next page",
109
+ className: m(
110
+ "p-2 bg-primary-gray-300 dark:bg-primary-gray-600 rtl:scale-x-[-1] rounded-full hover:bg-primary-gray-400 dark:hover:bg-primary-gray-550",
111
+ t
112
+ ),
113
+ children: /* @__PURE__ */ s.jsx(ze, { className: "h-6 w-6 stroke-primary-gray-700 dark:stroke-primary-gray-100" })
114
+ }
115
+ );
116
+ }
117
+ le.displayName = "PaginationNext";
118
+ function ie({ className: t, ...e }) {
119
+ return /* @__PURE__ */ s.jsxs(
120
+ "span",
121
+ {
122
+ ...e,
123
+ "aria-hidden": !0,
124
+ className: m("flex h-9 w-9 items-center justify-center", t),
125
+ children: [
126
+ /* @__PURE__ */ s.jsx($e, { className: "h-4 w-4 text-primary-gray-700 dark:text-primary-gray-100" }),
127
+ /* @__PURE__ */ s.jsx("span", { className: "sr-only", children: "More pages" })
128
+ ]
129
+ }
130
+ );
131
+ }
132
+ ie.displayName = "PaginationEllipsis";
133
+ const ee = (t, e) => {
134
+ const l = [];
135
+ return e <= 7 ? Array.from({ length: e }, (n, c) => c + 1) : (l.push(1), t <= 3 ? l.push(2, 3, 4, "ellipsis") : t >= e - 2 ? l.push("ellipsis", e - 3, e - 2, e - 1) : l.push("ellipsis", t - 1, t, t + 1, "ellipsis"), l.push(e), l);
136
+ };
137
+ function Ie(t) {
138
+ const { defaultPage: e = 1, total: l, pageSize: n, onChange: c, className: p } = t, u = Math.ceil(l / n), [d, o] = w(e), [h, f] = w(
139
+ ee(e, u)
140
+ );
141
+ return z(() => {
142
+ f(ee(d, u));
143
+ }, [d, u]), /* @__PURE__ */ s.jsx(re, { className: m("select-none", p), children: /* @__PURE__ */ s.jsxs(te, { children: [
144
+ /* @__PURE__ */ s.jsx(I, { children: /* @__PURE__ */ s.jsx(
145
+ se,
146
+ {
147
+ onClick: () => {
148
+ d > 1 && (c(d - 1), o(d - 1));
149
+ },
150
+ className: m(
151
+ "cursor-pointer",
152
+ d <= 1 && "cursor-not-allowed pointer-events-none opacity-35"
153
+ )
154
+ }
155
+ ) }),
156
+ h.map((g, v) => /* @__PURE__ */ s.jsx(I, { children: g === "ellipsis" ? /* @__PURE__ */ s.jsx(ie, {}) : /* @__PURE__ */ s.jsx(
157
+ B,
158
+ {
159
+ onClick: () => {
160
+ o(g), c(g);
161
+ },
162
+ className: m(
163
+ "cursor-pointer w-[32px] h-[32px] flex items-center justify-center rounded-full hover:bg-primary-gray-300",
164
+ g === d && "bg-primary-blue-600 hover:bg-primary-blue-700 dark:bg-primary-blue-500 dark:hover:bg-primary-blue-400 hover:text-primary-wite text-primary-white"
165
+ ),
166
+ children: g
167
+ }
168
+ ) }, v)),
169
+ /* @__PURE__ */ s.jsx(I, { children: /* @__PURE__ */ s.jsx(
170
+ le,
171
+ {
172
+ onClick: () => {
173
+ d < u && (c(d + 1), o(d + 1));
174
+ },
175
+ className: m(
176
+ "cursor-pointer",
177
+ d >= u && "cursor-not-allowed pointer-events-none opacity-35"
178
+ )
179
+ }
180
+ ) })
181
+ ] }) });
182
+ }
183
+ const Pe = ye(
184
+ "w-full h-auto bg-primary-white dark:bg-primary-gray-650 text-primary-black dark:text-primary-white text-base transition-colors file:border-0 file:bg-transparent file:font-medium file:text-primary-gray-700 dark:file:text-primary-white focus-visible:outline-hidden focus-visible:ring-1 disabled:cursor-not-allowed disabled:opacity-50 placeholder:text-primary-gray-550 dark:placeholder:text-primary-gray-400",
185
+ {
186
+ variants: {
187
+ variant: {
188
+ light: "border border-primary-gray-400 dark:border-primary-gray-500",
189
+ normal: "border-2 border-primary-black dark:border-primary-gray-300"
190
+ },
191
+ inputSize: {
192
+ sm: "px-2.5 py-1",
193
+ base: "p-2.5"
194
+ }
195
+ },
196
+ defaultVariants: {
197
+ inputSize: "base",
198
+ variant: "normal"
199
+ }
200
+ }
201
+ ), ne = $.forwardRef(({ className: t, inputSize: e, variant: l, ...n }, c) => /* @__PURE__ */ s.jsx("input", { ...n, ref: c, className: m(Pe({ inputSize: e, variant: l }), t) }));
202
+ ne.displayName = "Input";
203
+ /**
204
+ * @license lucide-react v0.488.0 - ISC
205
+ *
206
+ * This source code is licensed under the ISC license.
207
+ * See the LICENSE file in the root directory of this source tree.
208
+ */
209
+ const Be = [
210
+ ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
211
+ ["path", { d: "m21 21-4.3-4.3", key: "1qie3q" }]
212
+ ], ae = P("search", Be), oe = $.forwardRef(
213
+ ({
214
+ className: t,
215
+ inputClassName: e,
216
+ buttonClassName: l,
217
+ onSearch: n,
218
+ searchOnlyOnClick: c,
219
+ buttonVariant: p,
220
+ buttonChildren: u,
221
+ showSearchButton: d,
222
+ inputVariant: o,
223
+ inputSize: h,
224
+ placeholder: f,
225
+ ...g
226
+ }, v) => {
227
+ const [x, b] = $.useState(void 0), [N, a] = $.useState(!1);
228
+ return /* @__PURE__ */ s.jsxs("div", { className: m("flex gap-0", t), ref: v, children: [
229
+ /* @__PURE__ */ s.jsxs("div", { className: "relative w-full", children: [
230
+ /* @__PURE__ */ s.jsx(
231
+ ne,
232
+ {
233
+ ...g,
234
+ variant: o,
235
+ type: "text",
236
+ className: e,
237
+ onChange: (y) => {
238
+ b(y.target.value), c || n?.(y.target.value);
239
+ },
240
+ inputSize: h,
241
+ onKeyDown: (y) => {
242
+ y.key === "Enter" && n?.(x);
243
+ },
244
+ onFocus: () => a(!0),
245
+ onBlur: () => a(!1)
246
+ }
247
+ ),
248
+ !N && (x === "" || !x) && /* @__PURE__ */ s.jsxs("div", { className: "absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none", children: [
249
+ u ? null : /* @__PURE__ */ s.jsx(ae, { className: "h-4 w-4 text-primary-gray-500 dark:text-primary-gray-400 mr-2" }),
250
+ /* @__PURE__ */ s.jsx("span", { className: "text-primary-gray-500 dark:text-primary-gray-400", children: f || "Search..." })
251
+ ] })
252
+ ] }),
253
+ d === !1 ? null : /* @__PURE__ */ s.jsx(
254
+ xe,
255
+ {
256
+ variant: p || "icon",
257
+ className: l,
258
+ padding: h,
259
+ onClick: () => {
260
+ n?.(x);
261
+ },
262
+ children: u || /* @__PURE__ */ s.jsx(ae, { className: "stroke-2" })
263
+ }
264
+ )
265
+ ] });
266
+ }
267
+ );
268
+ oe.displayName = "Search";
269
+ const Oe = (t) => t ? Object.entries(t).map(([l, n]) => Array.isArray(n) ? {
270
+ " ": l,
271
+ value: `"${n.join("; ")}"`
272
+ } : {
273
+ " ": l,
274
+ value: `"${n}"`
275
+ }) : {};
276
+ function Fe(t) {
277
+ const {
278
+ width: e,
279
+ height: l,
280
+ data: n,
281
+ onSeriesMouseClick: c,
282
+ cardTemplate: p,
283
+ cardBackgroundColor: u,
284
+ cardMinWidth: d = 320,
285
+ detailsOnClick: o,
286
+ noOfItemsInAPage: h,
287
+ styles: f,
288
+ classNames: g,
289
+ page: v,
290
+ allowDataDownloadOnDetail: x
291
+ } = t, [b, N] = w(void 0);
292
+ return /* @__PURE__ */ i.jsxs(i.Fragment, { children: [
293
+ /* @__PURE__ */ i.jsx(
294
+ "div",
295
+ {
296
+ className: "undp-scrollbar w-full my-0 mx-auto grid gap-4 undp-viz-data-cards-container",
297
+ style: {
298
+ width: e ? `${e}px` : "100%",
299
+ height: l ? `${l}px` : "auto",
300
+ gridTemplateColumns: `repeat(auto-fill, minmax(${d}px, 1fr))`
301
+ },
302
+ children: n.filter(
303
+ (a, y) => h ? y < v * h && y >= (v - 1) * h : !0
304
+ ).map((a, y) => /* @__PURE__ */ i.jsx(
305
+ "div",
306
+ {
307
+ style: {
308
+ ...f?.dataCards || {},
309
+ ...u && { backgroundColor: u }
310
+ },
311
+ className: `w-full flex flex-col ${c || o ? "cursor-pointer" : "cursor-auto"}${u ? "" : "bg-primary-gray-200 dark:bg-primary-gray-600"} ${g?.dataCards || ""}`,
312
+ onClick: () => {
313
+ c?.(a), N(a);
314
+ },
315
+ dangerouslySetInnerHTML: typeof p == "string" ? { __html: J(p, a) } : void 0,
316
+ children: typeof p == "function" ? p(a) : null
317
+ },
318
+ y
319
+ ))
320
+ }
321
+ ),
322
+ o && b !== void 0 ? /* @__PURE__ */ i.jsxs(
323
+ ve,
324
+ {
325
+ open: b !== void 0,
326
+ onClose: () => {
327
+ N(void 0);
328
+ },
329
+ children: [
330
+ /* @__PURE__ */ i.jsx(
331
+ "div",
332
+ {
333
+ className: "graph-modal-content m-0",
334
+ dangerouslySetInnerHTML: typeof o == "string" ? { __html: J(o, b) } : void 0,
335
+ children: typeof o == "function" ? o(b) : null
336
+ }
337
+ ),
338
+ x ? /* @__PURE__ */ i.jsx("div", { className: "flex", children: /* @__PURE__ */ i.jsx(
339
+ Ne,
340
+ {
341
+ csvData: Oe(b),
342
+ headers: [
343
+ {
344
+ label: " ",
345
+ key: " "
346
+ },
347
+ {
348
+ label: "value",
349
+ key: "value"
350
+ }
351
+ ],
352
+ buttonContent: /* @__PURE__ */ i.jsxs("div", { className: "flex items-center gap-4", children: [
353
+ typeof x == "string" ? x : null,
354
+ /* @__PURE__ */ i.jsx(be, {})
355
+ ] })
356
+ }
357
+ ) }) : null
358
+ ]
359
+ }
360
+ ) : null
361
+ ] });
362
+ }
363
+ const Me = (t, e, l) => e.length === 0 ? t : t.filter(
364
+ (n) => e.some((c) => n[c]?.toLowerCase().includes(l.toLowerCase()))
365
+ );
366
+ function Ye(t) {
367
+ const {
368
+ width: e,
369
+ height: l,
370
+ graphTitle: n,
371
+ sources: c,
372
+ graphDescription: p,
373
+ footNote: u,
374
+ graphID: d,
375
+ data: o,
376
+ onSeriesMouseClick: h,
377
+ language: f = "en",
378
+ theme: g = "light",
379
+ ariaLabel: v,
380
+ cardTemplate: x,
381
+ cardBackgroundColor: b,
382
+ cardFilters: N,
383
+ cardSortingOptions: a,
384
+ cardSearchColumns: y,
385
+ cardMinWidth: ce = 320,
386
+ backgroundColor: k = !1,
387
+ padding: _,
388
+ detailsOnClick: de,
389
+ allowDataDownloadOnDetail: ue = !1,
390
+ noOfItemsInAPage: O,
391
+ uiMode: F = "normal",
392
+ styles: C,
393
+ classNames: S
394
+ } = t, [M, H] = w(o), [me, q] = w(1), [A, pe] = w(""), G = Q(
395
+ () => (N || []).map((r) => ({
396
+ filter: r.column,
397
+ label: r.label || `Filter by ${r.column}`,
398
+ singleSelect: !0,
399
+ clearable: !0,
400
+ defaultValue: Y(r.defaultValue),
401
+ availableValues: ke(o, r.column).filter((j) => !r.excludeValues?.includes(`${j}`)).map((j) => ({ value: j, label: j })),
402
+ width: r.width
403
+ })),
404
+ [N, o]
405
+ ), [E, fe] = w(
406
+ (N || []).map((r) => ({
407
+ filter: r.column,
408
+ value: Y(r.defaultValue)
409
+ }))
410
+ ), [D, U] = w(
411
+ a ? !a.defaultValue || a.options.findIndex((r) => r.label === a.defaultValue) === -1 ? a.options[0] : a.options[a.options.findIndex((r) => r.label === a.defaultValue)] : void 0
412
+ ), K = Q(
413
+ () => ({
414
+ ignoreCase: !0,
415
+ ignoreAccents: !0,
416
+ trim: !0
417
+ }),
418
+ []
419
+ );
420
+ return z(() => {
421
+ U(
422
+ a ? !a.defaultValue || a.options.findIndex(
423
+ (r) => r.label === a.defaultValue
424
+ ) === -1 ? a.options[0] : a.options[a.options.findIndex(
425
+ (r) => r.label === a.defaultValue
426
+ )] : void 0
427
+ );
428
+ }, [a]), z(() => {
429
+ const r = Me(o, y || [], A).filter(
430
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
431
+ (j) => E.every(
432
+ (V) => V.value && L([V.value]).length > 0 ? ge(
433
+ L([j[V.filter]]),
434
+ L([V.value]).map((T) => T.value)
435
+ ).length > 0 : !0
436
+ )
437
+ );
438
+ H(D ? he(r, D?.value, D?.type) : r);
439
+ }, [o, y, A, E, D]), z(() => {
440
+ q(1);
441
+ }, [M]), /* @__PURE__ */ i.jsx(
442
+ "div",
443
+ {
444
+ className: `${g || "light"} flex ${e ? "w-fit grow-0" : "w-full grow"}`,
445
+ dir: f === "he" || f === "ar" ? "rtl" : void 0,
446
+ children: /* @__PURE__ */ i.jsx(
447
+ "div",
448
+ {
449
+ className: m(
450
+ `${k ? k === !0 ? "bg-primary-gray-200 dark:bg-primary-gray-650 " : "" : "bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${f || "en"}`,
451
+ S?.graphContainer
452
+ ),
453
+ style: {
454
+ ...C?.graphContainer || {},
455
+ ...k && k !== !0 ? { backgroundColor: k } : {}
456
+ },
457
+ id: d,
458
+ "aria-label": v || `${n ? `The graph shows ${n}. ` : ""}This is an list of cards. ${p ? ` ${p}` : ""}`,
459
+ children: /* @__PURE__ */ i.jsx(
460
+ "div",
461
+ {
462
+ className: "flex grow",
463
+ style: { padding: k ? _ || "1rem" : _ || 0 },
464
+ children: /* @__PURE__ */ i.jsxs("div", { className: "flex flex-col grow gap-3 w-full justify-between", children: [
465
+ n || p ? /* @__PURE__ */ i.jsx(
466
+ we,
467
+ {
468
+ styles: {
469
+ title: C?.title,
470
+ description: C?.description
471
+ },
472
+ classNames: {
473
+ title: S?.title,
474
+ description: S?.description
475
+ },
476
+ graphTitle: n,
477
+ graphDescription: p,
478
+ width: e
479
+ }
480
+ ) : null,
481
+ a || G.length > 0 ? /* @__PURE__ */ i.jsxs("div", { className: "flex gap-4 flex-wrap items-start w-full", children: [
482
+ a ? /* @__PURE__ */ i.jsxs(
483
+ "div",
484
+ {
485
+ className: "grow shrink-0 min-w-[240px]",
486
+ style: { width: a.width || "calc(25% - 0.75rem)" },
487
+ children: [
488
+ /* @__PURE__ */ i.jsx(
489
+ X,
490
+ {
491
+ marginBottom: "xs",
492
+ size: "sm",
493
+ className: "text-primary-gray-700 dark:text-primary-gray-100",
494
+ children: "Sort by"
495
+ }
496
+ ),
497
+ /* @__PURE__ */ i.jsx(
498
+ W,
499
+ {
500
+ options: a.options,
501
+ isRtl: f === "he" || f === "ar",
502
+ isSearchable: !0,
503
+ filterOption: Z(K),
504
+ onChange: (r) => {
505
+ U(r || void 0);
506
+ },
507
+ variant: F,
508
+ size: "sm",
509
+ defaultValue: !a.defaultValue || a.options.findIndex(
510
+ (r) => r.label === a.defaultValue
511
+ ) === -1 ? a.options[0] : a.options[a.options.findIndex(
512
+ (r) => r.label === a.defaultValue
513
+ )]
514
+ }
515
+ )
516
+ ]
517
+ }
518
+ ) : null,
519
+ G?.map((r, j) => /* @__PURE__ */ i.jsxs(
520
+ "div",
521
+ {
522
+ className: "grow shrink-0 min-w-[240px]",
523
+ style: { width: r.width || "calc(25% - 0.75rem)" },
524
+ children: [
525
+ /* @__PURE__ */ i.jsx(
526
+ X,
527
+ {
528
+ marginBottom: "xs",
529
+ size: "sm",
530
+ className: "text-primary-gray-700 dark:text-primary-gray-100",
531
+ children: r.label
532
+ }
533
+ ),
534
+ /* @__PURE__ */ i.jsx(
535
+ W,
536
+ {
537
+ options: r.availableValues,
538
+ isClearable: r.clearable === void 0 ? !0 : r.clearable,
539
+ isRtl: f === "he" || f === "ar",
540
+ isSearchable: !0,
541
+ variant: F,
542
+ size: "sm",
543
+ controlShouldRenderValue: !0,
544
+ filterOption: Z(K),
545
+ onChange: (V) => {
546
+ fe(
547
+ (T) => (
548
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
549
+ T.map((R) => R.filter === r.filter ? { ...R, value: V } : R)
550
+ )
551
+ );
552
+ },
553
+ defaultValue: r.defaultValue
554
+ }
555
+ )
556
+ ]
557
+ },
558
+ j
559
+ ))
560
+ ] }) : null,
561
+ (y || []).length > 0 ? /* @__PURE__ */ i.jsx("div", { style: { paddingTop: "1px" }, children: /* @__PURE__ */ i.jsx(
562
+ oe,
563
+ {
564
+ placeholder: "Search...",
565
+ onSearch: (r) => {
566
+ pe(r || "");
567
+ },
568
+ buttonVariant: "icon",
569
+ inputVariant: F,
570
+ showSearchButton: !1,
571
+ inputSize: "sm"
572
+ }
573
+ ) }) : null,
574
+ /* @__PURE__ */ i.jsx(
575
+ Fe,
576
+ {
577
+ data: M,
578
+ width: e,
579
+ height: l,
580
+ cardTemplate: x,
581
+ cardMinWidth: ce,
582
+ page: me,
583
+ cardBackgroundColor: b,
584
+ styles: C,
585
+ classNames: S,
586
+ noOfItemsInAPage: O,
587
+ detailsOnClick: de,
588
+ onSeriesMouseClick: h,
589
+ allowDataDownloadOnDetail: ue
590
+ }
591
+ ),
592
+ O ? /* @__PURE__ */ i.jsx(
593
+ Ie,
594
+ {
595
+ total: M.length,
596
+ defaultPage: 0,
597
+ pageSize: O,
598
+ onChange: q
599
+ }
600
+ ) : null,
601
+ c || u ? /* @__PURE__ */ i.jsx(
602
+ je,
603
+ {
604
+ styles: { footnote: C?.footnote, source: C?.source },
605
+ classNames: {
606
+ footnote: S?.footnote,
607
+ source: S?.source
608
+ },
609
+ sources: c,
610
+ footNote: u,
611
+ width: e
612
+ }
613
+ ) : null
614
+ ] })
615
+ }
616
+ )
617
+ }
618
+ )
619
+ }
620
+ );
621
+ }
12
622
  export {
13
- x as DataCards
623
+ Ye as DataCards
14
624
  };
15
625
  //# sourceMappingURL=DataCards.js.map