@adyen/lume 0.5.2 → 0.6.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.
@@ -1,2660 +0,0 @@
1
- import { defineComponent as I, ref as x, isRef as We, computed as c, watch as N, toRefs as R, reactive as ae, onMounted as j, onBeforeUnmount as Ze, watchEffect as Xe, useSlots as V, provide as Ee, defineAsyncComponent as de, inject as kt } from "vue";
2
- import { sankeyLinkHorizontal as At, sankey as Ot, sankeyJustify as Tt } from "d3-sankey";
3
- import { format as Lt, ticks as xt, scaleBand as J, scaleLinear as Q, line as wt, area as $t } from "d3";
4
- import { createPopper as It } from "@popperjs/core";
5
- const Dt = /* @__PURE__ */ I({
6
- __name: "lume-tick",
7
- props: {
8
- value: {
9
- type: [String, Number],
10
- required: !0
11
- },
12
- group: {
13
- type: Object,
14
- required: !0
15
- },
16
- ghost: {
17
- type: Object,
18
- required: !0
19
- },
20
- label: {
21
- type: Object,
22
- required: !0
23
- },
24
- gridline: {
25
- type: Object,
26
- required: !0
27
- },
28
- isHovered: {
29
- type: Boolean,
30
- default: !1
31
- },
32
- isHidden: {
33
- type: Boolean,
34
- default: !1
35
- },
36
- withGridlines: {
37
- type: Boolean,
38
- default: !0
39
- }
40
- },
41
- emits: ["click", "mouseenter"],
42
- setup(t, { expose: e, emit: r }) {
43
- const n = x(null);
44
- return e({ ref: n }), { __sfc: !0, emit: r, labelRef: n };
45
- }
46
- });
47
- function D(t, e, r, n, a, o, u, s) {
48
- var l = typeof t == "function" ? t.options : t;
49
- e && (l.render = e, l.staticRenderFns = r, l._compiled = !0), n && (l.functional = !0), o && (l._scopeId = "data-v-" + o);
50
- var i;
51
- if (u ? (i = function(f) {
52
- f = f || // cached call
53
- this.$vnode && this.$vnode.ssrContext || // stateful
54
- this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext, !f && typeof __VUE_SSR_CONTEXT__ < "u" && (f = __VUE_SSR_CONTEXT__), a && a.call(this, f), f && f._registeredComponents && f._registeredComponents.add(u);
55
- }, l._ssrRegister = i) : a && (i = s ? function() {
56
- a.call(
57
- this,
58
- (l.functional ? this.parent : this).$root.$options.shadowRoot
59
- );
60
- } : a), i)
61
- if (l.functional) {
62
- l._injectStyles = i;
63
- var v = l.render;
64
- l.render = function(h, _) {
65
- return i.call(_), v(h, _);
66
- };
67
- } else {
68
- var d = l.beforeCreate;
69
- l.beforeCreate = d ? [].concat(d, i) : [i];
70
- }
71
- return {
72
- exports: t,
73
- options: l
74
- };
75
- }
76
- var Et = function() {
77
- var e = this, r = e._self._c, n = e._self._setupProxy;
78
- return r("g", e._b({ staticClass: "axis__tick", class: {
79
- "axis__tick--hovered": e.isHovered,
80
- "axis__tick--hidden": e.isHidden
81
- }, attrs: { "data-j-axis__tick": "" }, on: { mouseenter: function(a) {
82
- return n.emit("mouseenter", a);
83
- }, click: function(a) {
84
- return n.emit("click", a);
85
- } } }, "g", e.group, !1), [r("g", { staticClass: "axis__tick-label lume-typography--axis", attrs: { "pointer-events": "all", "data-j-axis__tick-label": "" } }, [r("rect", e._b({ staticClass: "axis__ghost", attrs: { fill: "url(#lume-tick-gradient)" } }, "rect", e.ghost, !1)), r("text", e._b({ ref: "labelRef", staticClass: "axis__label" }, "text", e.label, !1), [e._v(" " + e._s(e.value) + " ")])]), e.withGridlines ? r("line", e._b({ staticClass: "axis__grid-line" }, "line", e.gridline, !1)) : e._e()]);
86
- }, Ct = [], Rt = /* @__PURE__ */ D(
87
- Dt,
88
- Et,
89
- Ct,
90
- !1,
91
- null,
92
- "59ddc0a6",
93
- null,
94
- null
95
- );
96
- const Nt = Rt.exports;
97
- function Ye() {
98
- return process.env.NODE_ENV === "production";
99
- }
100
- function Ue(t) {
101
- return (t == null ? void 0 : t.map(
102
- (e) => e.values.map((r) => r == null ? void 0 : r.value).flat()
103
- ).flat()) || [];
104
- }
105
- function be(t) {
106
- return t.length === 1;
107
- }
108
- function Bt(t) {
109
- return !!t && t.every(
110
- (e) => "color" in e
111
- );
112
- }
113
- function ve(t) {
114
- return !!t && typeof t == "object" && !Array.isArray(t);
115
- }
116
- function Ke(t, e) {
117
- const r = { ...t };
118
- return Object.entries(e).forEach(([n, a]) => {
119
- r[n] = ve(t[n]) && ve(a) ? Ke(t[n], a) : a;
120
- }), r;
121
- }
122
- function Ht(t) {
123
- return t != null && ve(t) && "value" in t;
124
- }
125
- function W(t) {
126
- return (t == null ? void 0 : t.bandwidth) !== void 0;
127
- }
128
- function ke(t) {
129
- return W(t) ? t.bandwidth() : Math.max(...t.range()) / Math.max(...t.domain());
130
- }
131
- const Pt = (t, e) => {
132
- if (!t)
133
- throw new Error("Data is not a valid array");
134
- if (t.length === 0)
135
- throw new Error("Cannot get highest value from empty array");
136
- t.forEach(({ values: r }) => {
137
- if (r.length - 1 < e)
138
- throw new Error("Index exceeds length of at least one of the datasets");
139
- });
140
- };
141
- function St(t, e) {
142
- var r;
143
- return Pt(t, e), ((r = t.reduce(
144
- (n, a) => {
145
- var o, u;
146
- return (((o = n.values[e]) == null ? void 0 : o.value) ?? 0) > (((u = a.values[e]) == null ? void 0 : u.value) ?? 0) ? n : a;
147
- }
148
- ).values[e]) == null ? void 0 : r.value) || 0;
149
- }
150
- function _e(t) {
151
- const e = We(t) ? t.value : t;
152
- if (!e)
153
- throw new Error("No empty array can be created from specified data value");
154
- const r = Math.max(
155
- ...e.map((n) => n.values.length),
156
- 0
157
- );
158
- return Array(r).fill(null);
159
- }
160
- function Gt(t) {
161
- return W(t) ? t.domain().length : Math.max(...t.domain());
162
- }
163
- function jt(t, e) {
164
- return (r) => Math.round(t * (1 - r) + e * r);
165
- }
166
- function Vt(t, e, r) {
167
- const n = r ? t.length - e : e, a = t.slice(0, n);
168
- return t.slice(n).concat(a);
169
- }
170
- function Z(t) {
171
- if (t.groups) {
172
- const e = Object.keys(t);
173
- return Object.assign(
174
- {},
175
- ...e.map((r) => r !== "groups" ? { [r]: t[r] } : {})
176
- );
177
- }
178
- return t;
179
- }
180
- const Ft = (t = 21) => crypto.getRandomValues(new Uint8Array(t)).reduce(
181
- (e, r) => e += (r &= 63) < 36 ? r.toString(36) : r < 62 ? (r - 26).toString(36).toUpperCase() : r > 62 ? "-" : "_",
182
- ""
183
- );
184
- var q = /* @__PURE__ */ ((t) => (t.DatasetLength = `Our guidelines highly recommend not having more than 5 datasets in one chart.
185
- Learn more: https://lume.design/guidelines/datasets`, t.ColorLoop = "Colors will loop around after the 5th dataset. You can prevent this by setting specific colors for your datasets.", t.InvalidFormat = "The string provided to format is invalid. Please refer to https://github.com/d3/d3-format for valid arguments.", t.NotContainedInSvg = "This component is an `SVGElement`, thus it is required to be inside an `<svg>` container.", t))(q || {});
186
- const Mt = "[lume] ";
187
- function oe(t, e = !0) {
188
- e && Ye() || console.warn(Mt + "Warning: " + t);
189
- }
190
- const te = (t) => {
191
- let e = null;
192
- switch (typeof t) {
193
- case "string":
194
- try {
195
- e = Lt(t);
196
- } catch {
197
- oe(q.InvalidFormat), e = null;
198
- }
199
- break;
200
- case "function":
201
- e = t;
202
- break;
203
- default:
204
- e = null;
205
- }
206
- function r(...n) {
207
- return e ? e(...n) : n[0];
208
- }
209
- return r;
210
- }, ue = () => ({
211
- options: {
212
- type: Object,
213
- default: () => ({})
214
- }
215
- });
216
- function G(t, e) {
217
- return { allOptions: c(() => {
218
- const n = We(e) ? e == null ? void 0 : e.value : e;
219
- return n ? Ke(n, t.value) : t.value;
220
- }) };
221
- }
222
- const zt = 0.15;
223
- function Wt(t, e, r) {
224
- const n = x(), a = c(() => Math.max(...t.value.range())), o = c(() => e.value.length);
225
- function u() {
226
- if (!e.value)
227
- return;
228
- const l = e.value.reduce(
229
- (v, d) => v + d.ref.getBoundingClientRect().width,
230
- 0
231
- ), i = Math.ceil(l / o.value);
232
- n.value = i + i * zt;
233
- }
234
- function s(l) {
235
- if (!e.value)
236
- return !0;
237
- const i = e.value.length;
238
- if (l === 0)
239
- return !0;
240
- const v = a.value / i, d = typeof r == "number" && r > 0 && r + 1 || Math.ceil(n.value / v);
241
- return l % d === 0;
242
- }
243
- return N(e, u), { showTick: s };
244
- }
245
- var P = /* @__PURE__ */ ((t) => (t.Skyblue = "skyblue", t.Royalblue = "royalblue", t.Violet = "violet", t.Darkteal = "darkteal", t.Gold = "gold", t))(P || {}), Je = /* @__PURE__ */ ((t) => (t.Skyblue10 = "skyblue-10", t.Skyblue20 = "skyblue-20", t.Skyblue30 = "skyblue-30", t.Skyblue40 = "skyblue-40", t.Skyblue50 = "skyblue-50", t.Skyblue60 = "skyblue-60", t.Skyblue70 = "skyblue-70", t.Skyblue80 = "skyblue-80", t.Skyblue90 = "skyblue-90", t.Skyblue100 = "skyblue-100", t.Royalblue10 = "royalblue-10", t.Royalblue20 = "royalblue-20", t.Royalblue30 = "royalblue-30", t.Royalblue40 = "royalblue-40", t.Royalblue50 = "royalblue-50", t.Royalblue60 = "royalblue-60", t.Royalblue70 = "royalblue-70", t.Royalblue80 = "royalblue-80", t.Royalblue90 = "royalblue-90", t.Royalblue100 = "royalblue-100", t.Violet10 = "violet-10", t.Violet20 = "violet-20", t.Violet30 = "violet-30", t.Violet40 = "violet-40", t.Violet50 = "violet-50", t.Violet60 = "violet-60", t.Violet70 = "violet-70", t.Violet80 = "violet-80", t.Violet90 = "violet-90", t.Violet100 = "violet-100", t.Darkteal10 = "darkteal-10", t.Darkteal20 = "darkteal-20", t.Darkteal30 = "darkteal-30", t.Darkteal40 = "darkteal-40", t.Darkteal50 = "darkteal-50", t.Darkteal60 = "darkteal-60", t.Darkteal70 = "darkteal-70", t.Darkteal80 = "darkteal-80", t.Darkteal90 = "darkteal-90", t.Darkteal100 = "darkteal-100", t.Gold10 = "gold-10", t.Gold20 = "gold-20", t.Gold30 = "gold-30", t.Gold40 = "gold-40", t.Gold50 = "gold-50", t.Gold60 = "gold-60", t.Gold70 = "gold-70", t.Gold80 = "gold-80", t.Gold90 = "gold-90", t.Gold100 = "gold-100", t))(Je || {}), Ae = /* @__PURE__ */ ((t) => (t.SkyTeal = "skyblue-darkteal", t.VioletRoyal = "violet-royalblue", t.VioletTeal = "violet-darkteal", t.GoldTeal = "gold-darkteal", t.GoldRoyal = "gold-royalblue", t))(Ae || {}), Qe = /* @__PURE__ */ ((t) => (t.Grey = "grey", t.Green = "green", t.Orange = "orange", t.Red = "red", t))(Qe || {}), Oe = /* @__PURE__ */ ((t) => (t["01"] = "01", t["02"] = "02", t["03"] = "03", t["04"] = "04", t["05"] = "05", t["06"] = "06", t["07"] = "07", t["08"] = "08", t["09"] = "09", t))(Oe || {});
246
- const T = {
247
- HORIZONTAL: "horizontal",
248
- VERTICAL: "vertical"
249
- }, Zt = {
250
- SINGLE: "single",
251
- GROUPED: "grouped",
252
- STACKED: "stacked"
253
- }, z = {
254
- VERTICAL: {
255
- top: 16,
256
- right: 0,
257
- bottom: 28,
258
- left: 24
259
- },
260
- HORIZONTAL: {
261
- top: 16,
262
- right: 0,
263
- bottom: 28,
264
- left: 24
265
- }
266
- }, qe = "No data", Xt = 20, Yt = 0.33, Ut = 0.5, et = 12, tt = 8, Kt = 1, Jt = [
267
- "auto",
268
- "auto-start",
269
- "auto-end",
270
- "top",
271
- "top-start",
272
- "top-end",
273
- "right",
274
- "right-start",
275
- "right-end",
276
- "bottom",
277
- "bottom-start",
278
- "bottom-end",
279
- "left",
280
- "left-start",
281
- "left-end"
282
- ];
283
- function le(t) {
284
- t != null && t.closest("svg") || oe(q.NotContainedInSvg);
285
- }
286
- const nt = {
287
- /** Displays a line for each tick. */
288
- gridLines: !1,
289
- /** Displays the axis title. */
290
- withTitle: !0,
291
- //
292
- //// Tick settings
293
- //
294
- /** Controls if the tick labels should be displayed. */
295
- showTicks: !0,
296
- /** Amount of ticks to display in the axis. */
297
- tickCount: 10,
298
- /** Formatting string/function for the tick label. */
299
- tickFormat: null,
300
- /** Space between the tick label and the axis line. */
301
- tickPadding: 8
302
- }, Qt = {
303
- ...nt,
304
- withTitle: !1,
305
- skip: !0
306
- }, qt = {
307
- ...nt,
308
- gridLines: !0
309
- }, en = function(t, e, r) {
310
- const n = c(() => t.value.step() * t.value.paddingInner() / 2);
311
- function a(l, i) {
312
- return {
313
- transform: `translate(${(t.value(i) ?? t.value(l)) - n.value}, 0)`
314
- };
315
- }
316
- function o(l) {
317
- var v;
318
- const i = Math.max(
319
- t.value.step(),
320
- (l ? (v = l.getComputedTextLength) == null ? void 0 : v.call(l) : t.value.step()) + 20
321
- );
322
- return {
323
- x: -(i - t.value.step()) / 2,
324
- width: i,
325
- height: r.value.tickPadding + et + tt
326
- };
327
- }
328
- function u() {
329
- const l = t.value.step() / 2;
330
- return {
331
- x1: l,
332
- x2: l,
333
- y1: -e.value.height
334
- // Negative height means it goes from bottom to top
335
- };
336
- }
337
- function s() {
338
- return {
339
- x: t.value.step() / 2,
340
- y: r.value.tickPadding,
341
- dy: "0.8em",
342
- "text-anchor": "middle"
343
- };
344
- }
345
- return {
346
- getGridLinesAttributes: u,
347
- getTickGhostAttributes: o,
348
- getTickGroupAttributes: a,
349
- getTickLabelAttributes: s
350
- };
351
- }, tn = function(t, e, r) {
352
- const n = c(() => t.value.step() * t.value.paddingInner() / 2);
353
- function a(l, i) {
354
- return {
355
- transform: `translate(0, ${(t.value(i) ?? t.value(l)) - n.value})`
356
- };
357
- }
358
- function o(l) {
359
- var v;
360
- const i = (l ? (v = l.getComputedTextLength) == null ? void 0 : v.call(l) : 42) + r.value.tickPadding * 2;
361
- return {
362
- x: -i,
363
- width: i,
364
- height: t.value.step()
365
- };
366
- }
367
- function u() {
368
- const l = t.value.step() / 2;
369
- return {
370
- y1: l,
371
- y2: l,
372
- x1: e.value.width
373
- };
374
- }
375
- function s() {
376
- return {
377
- x: -r.value.tickPadding,
378
- y: t.value.step() / 2,
379
- "text-anchor": "end",
380
- "alignment-baseline": "middle"
381
- };
382
- }
383
- return {
384
- getGridLinesAttributes: u,
385
- getTickGhostAttributes: o,
386
- getTickGroupAttributes: a,
387
- getTickLabelAttributes: s
388
- };
389
- }, nn = function(t, e, r) {
390
- const n = c(() => {
391
- const l = t.value.ticks();
392
- return t.value(l[1]) - t.value(l[0]);
393
- });
394
- function a(l) {
395
- return {
396
- transform: `translate(${t.value(l)}, 0)`
397
- };
398
- }
399
- function o() {
400
- return {
401
- height: r.value.tickPadding + et + tt,
402
- width: n.value,
403
- x: -(n.value / 2)
404
- };
405
- }
406
- function u() {
407
- return {
408
- y1: -e.value.height
409
- };
410
- }
411
- function s() {
412
- return {
413
- y: r.value.tickPadding,
414
- dy: "0.8em",
415
- "text-anchor": "middle"
416
- };
417
- }
418
- return {
419
- getGridLinesAttributes: u,
420
- getTickGhostAttributes: o,
421
- getTickGroupAttributes: a,
422
- getTickLabelAttributes: s
423
- };
424
- }, rn = function(t, e, r) {
425
- const n = c(() => {
426
- const l = t.value.ticks();
427
- return t.value(l[1]) - t.value(l[0]);
428
- });
429
- function a(l) {
430
- return {
431
- transform: `translate(0, ${t.value(l)})`
432
- };
433
- }
434
- function o(l) {
435
- var v;
436
- const i = (((v = l == null ? void 0 : l.getComputedTextLength) == null ? void 0 : v.call(l)) || 0) + r.value.tickPadding * 2;
437
- return {
438
- width: i,
439
- height: n.value,
440
- x: -i,
441
- y: -(n.value / 2)
442
- };
443
- }
444
- function u() {
445
- return {
446
- x1: e.value.width
447
- };
448
- }
449
- function s() {
450
- return {
451
- x: -r.value.tickPadding,
452
- dy: "0.4em",
453
- "text-anchor": "end"
454
- };
455
- }
456
- return {
457
- getGridLinesAttributes: u,
458
- getTickGhostAttributes: o,
459
- getTickGroupAttributes: a,
460
- getTickLabelAttributes: s
461
- };
462
- }, an = {
463
- "x-band-scale-axis": en,
464
- "y-band-scale-axis": tn,
465
- "x-linear-scale-axis": nn,
466
- "y-linear-scale-axis": rn
467
- };
468
- var pe = /* @__PURE__ */ ((t) => (t.bandScale = "band-scale-axis", t.linearScale = "linear-scale-axis", t))(pe || {}), fe = /* @__PURE__ */ ((t) => (t.left = "left", t.bottom = "bottom", t))(fe || {}), ee = /* @__PURE__ */ ((t) => (t.x = "bottom", t.y = "left", t))(ee || {});
469
- const on = /* @__PURE__ */ I({
470
- __name: "lume-axis",
471
- props: {
472
- scale: {
473
- type: Function,
474
- required: !0
475
- },
476
- type: {
477
- type: String,
478
- default: void 0,
479
- validator: (t) => t in ee
480
- },
481
- position: {
482
- type: String,
483
- default: void 0,
484
- validator: (t) => t in fe
485
- },
486
- containerSize: {
487
- type: Object,
488
- default: () => ({ width: 0, height: 0 })
489
- },
490
- hoveredIndex: {
491
- type: Number,
492
- default: -1
493
- },
494
- orientation: {
495
- type: String,
496
- default: T.VERTICAL
497
- },
498
- ...ue()
499
- },
500
- emits: ["mouseenter", "click", "mouseleave"],
501
- setup(t, { emit: e }) {
502
- const r = t, { scale: n, containerSize: a, hoveredIndex: o, options: u, orientation: s } = R(r), l = ae({}), i = x(null), v = x(null), d = x(null), f = c(
503
- () => r.type ? ee[r.type] : r.position
504
- ), h = c(
505
- () => r.type || (f.value === "left" ? "y" : "x")
506
- ), _ = c(
507
- () => h.value === "x" && s.value === T.VERTICAL || h.value === "y" && s.value === T.HORIZONTAL
508
- ), { allOptions: p } = G(
509
- u,
510
- h.value === "x" ? Qt : qt
511
- ), { showTick: b } = Wt(n, i, p.value.skip), m = c(
512
- () => {
513
- var w;
514
- return `translate(0, ${h.value === "x" ? (w = a.value) == null ? void 0 : w.height : 0})`;
515
- }
516
- ), g = c(() => {
517
- if (W(n.value))
518
- return n.value.labels || n.value.domain();
519
- const { tickCount: w } = p.value, [C, S] = n.value.domain();
520
- return xt(C, S, w);
521
- }), O = c(() => {
522
- const { tickFormat: w } = p.value;
523
- return te(w);
524
- }), L = c(
525
- () => p.value.withHover && _.value && o.value > -1
526
- );
527
- function y(w) {
528
- const { showTicks: C } = p.value;
529
- return C === !1 ? "" : O.value(w);
530
- }
531
- function k(w, C, S) {
532
- e("mouseenter", { index: _.value ? w : null, value: C, event: S });
533
- }
534
- function $(w, C, S) {
535
- e("click", { index: w, value: C, event: S });
536
- }
537
- function E(w) {
538
- if (!(!i.value || !i.value.length))
539
- return i.value[w].ref;
540
- }
541
- function H() {
542
- d.value = g.value.map(
543
- (w, C) => ({
544
- value: y(w),
545
- group: l.getTickGroupAttributes(w, C),
546
- ghost: l.getTickGhostAttributes(E(C)),
547
- label: l.getTickLabelAttributes(),
548
- gridline: l.getGridLinesAttributes()
549
- })
550
- );
551
- }
552
- function Y() {
553
- const w = n.value.step ? "bandScale" : "linearScale", C = an[`${h.value}-${pe[w]}`];
554
- Object.entries(C(n, a, p) || []).forEach(
555
- ([S, ce]) => {
556
- l[S] = ce;
557
- }
558
- );
559
- }
560
- return N(n, Y, { flush: "sync", immediate: !0 }), N(n, H, { immediate: !0 }), N(i, H), j(() => le(v.value)), { __sfc: !0, SCALE_MIXIN_MAP: pe, POSITIONS: fe, TYPES: ee, props: r, emit: e, scale: n, containerSize: a, hoveredIndex: o, options: u, orientation: s, mixins: l, tickRefs: i, root: v, ticksWithAttributes: d, computedPosition: f, computedType: h, shouldHover: _, allOptions: p, showTick: b, axisTransform: m, ticks: g, tickFormatter: O, isHovering: L, formatTick: y, handleTickMouseenter: k, handleTickClick: $, getTextNode: E, setTicks: H, init: Y, LumeTick: Nt };
561
- }
562
- });
563
- var un = function() {
564
- var e = this, r = e._self._c, n = e._self._setupProxy;
565
- return n.scale ? r("g", { ref: "root", staticClass: "axis", attrs: { transform: n.axisTransform, "data-j-axis": "" }, on: { mouseleave: function(a) {
566
- return n.emit("mouseleave", a);
567
- } } }, [n.computedType === "x" ? r("defs", [r("linearGradient", { attrs: { id: "lume-tick-gradient" } }, [r("stop", { attrs: { offset: "0%", "stop-color": "rgba(255,255,255,0)" } }), r("stop", { attrs: { offset: "10%", "stop-color": "var(--lume-chart-background-color)" } }), r("stop", { attrs: { offset: "90%", "stop-color": "var(--lume-chart-background-color)" } }), r("stop", { attrs: { offset: "100%", "stop-color": "rgba(255,255,255,0)" } })], 1)], 1) : e._e(), e._l(n.ticksWithAttributes, function(a, o) {
568
- return r(n.LumeTick, e._b({ key: `${a.value}_${o}`, ref: "tickRefs", refInFor: !0, attrs: { "is-hidden": n.allOptions.skip && !n.showTick(o), "with-gridlines": n.allOptions.gridLines }, on: { mouseenter: function(u) {
569
- return n.handleTickMouseenter(o, a.value, u);
570
- }, click: function(u) {
571
- return n.handleTickClick(o, a.value, u);
572
- } } }, "lume-tick", a, !1));
573
- }), n.isHovering ? r(n.LumeTick, e._b({ attrs: { "with-gridlines": !1, "is-hovered": "" }, on: { click: function(a) {
574
- return n.handleTickClick(
575
- n.hoveredIndex,
576
- n.ticksWithAttributes[n.hoveredIndex].value,
577
- a
578
- );
579
- } } }, "lume-tick", n.ticksWithAttributes[n.hoveredIndex], !1)) : e._e()], 2) : e._e();
580
- }, ln = [], sn = /* @__PURE__ */ D(
581
- on,
582
- un,
583
- ln,
584
- !1,
585
- null,
586
- null,
587
- null,
588
- null
589
- );
590
- const cn = sn.exports;
591
- function dn(t, e, r, n) {
592
- const a = c(() => r.value > 0 && r.value < 1), o = c(
593
- () => n.value > 0 && n.value < 1
594
- ), u = c(
595
- () => a.value ? t.value - 0.5 : t.value
596
- // draws the 1px bar closer to the axis
597
- ), s = c(
598
- () => o.value ? e.value - 0.5 : e.value
599
- // draws the 1px bar closer to the axis
600
- );
601
- return { computedX: u, computedY: s, shouldHaveMinWidth: a, shouldHaveMinHeight: o };
602
- }
603
- function vn(t, e, r, n) {
604
- const a = x(0), o = x(0), u = c(() => `${t.value + r.value / 2}px ${e.value + n.value / 2}px`);
605
- return j(() => {
606
- a.value = r.value, o.value = n.value;
607
- }), N(r, (s) => a.value = s), N(n, (s) => o.value = s), { computedWidth: a, computedHeight: o, transformOrigin: u };
608
- }
609
- const _n = /* @__PURE__ */ I({
610
- __name: "lume-bar",
611
- props: {
612
- x: {
613
- type: Number,
614
- default: 0
615
- },
616
- y: {
617
- type: Number,
618
- default: 0
619
- },
620
- width: {
621
- type: Number,
622
- required: !0
623
- },
624
- height: {
625
- type: Number,
626
- required: !0
627
- },
628
- classList: {
629
- type: [String, Array],
630
- default: ""
631
- },
632
- isFaded: {
633
- type: Boolean,
634
- default: !1
635
- },
636
- isNegative: {
637
- type: Boolean,
638
- default: !1
639
- },
640
- transition: {
641
- type: [String, Boolean],
642
- default: !1
643
- }
644
- },
645
- emits: ["click", "mouseover", "mouseleave"],
646
- setup(t, { emit: e }) {
647
- const r = t, { x: n, y: a, width: o, height: u, transition: s, classList: l } = R(r), i = x(null), v = c(
648
- () => typeof l.value == "string" ? [l.value] : l.value
649
- ), d = c(() => s.value === "width"), f = c(() => s.value === "height"), h = vn(n, a, o, u), { computedX: _, computedY: p, shouldHaveMinWidth: b, shouldHaveMinHeight: m } = dn(n, a, o, u), g = c(() => b.value ? 1 : (d.value ? h.computedWidth : o).value), O = c(() => m.value ? 1 : (f.value ? h.computedHeight : u).value), L = d.value || f.value ? h.transformOrigin : null;
650
- return j(() => le(i.value)), { __sfc: !0, props: r, emit: e, x: n, y: a, width: o, height: u, transition: s, classList: l, root: i, computedClasses: v, shouldTransitionWidth: d, shouldTransitionHeight: f, transitionProps: h, computedX: _, computedY: p, shouldHaveMinWidth: b, shouldHaveMinHeight: m, computedWidth: g, computedHeight: O, transformOrigin: L };
651
- }
652
- });
653
- var pn = function() {
654
- var e = this, r = e._self._c, n = e._self._setupProxy;
655
- return r("rect", { ref: "root", staticClass: "lume-bar", class: [
656
- {
657
- "lume-fill--faded": e.isFaded,
658
- "lume-bar--negative": e.isNegative,
659
- "lume-bar--transition-width": n.shouldTransitionWidth,
660
- "lume-bar--transition-height": n.shouldTransitionHeight
661
- },
662
- ...n.computedClasses
663
- ], style: { transformOrigin: n.transformOrigin }, attrs: { x: n.computedX, y: n.computedY, width: n.computedWidth, height: n.computedHeight, "data-j-bar": "" }, on: { click: function(a) {
664
- return n.emit("click", a);
665
- }, mouseover: function(a) {
666
- return n.emit("mouseover", a);
667
- }, mouseleave: function(a) {
668
- return n.emit("mouseleave", a);
669
- } } });
670
- }, fn = [], mn = /* @__PURE__ */ D(
671
- _n,
672
- pn,
673
- fn,
674
- !1,
675
- null,
676
- "8e8f732a",
677
- null,
678
- null
679
- );
680
- const Te = mn.exports;
681
- function hn() {
682
- const t = x(), e = ae({
683
- dimensions: {}
684
- }), r = new ResizeObserver((n) => {
685
- n.forEach((a) => {
686
- e.dimensions = a.contentRect;
687
- });
688
- });
689
- return j(() => {
690
- r.observe(t.value);
691
- }), Ze(() => {
692
- r.unobserve(t.value);
693
- }), { resizeState: e, resizeRef: t };
694
- }
695
- const gn = /* @__PURE__ */ I({
696
- __name: "lume-chart-container",
697
- props: {
698
- margins: {
699
- type: Object,
700
- default: () => ({})
701
- },
702
- containerSize: {
703
- type: Object,
704
- default: () => ({ width: 0, height: 0 })
705
- },
706
- transparentBackground: {
707
- type: Boolean,
708
- default: !1
709
- },
710
- noMinSize: {
711
- type: Boolean,
712
- default: !1
713
- }
714
- },
715
- emits: ["click", "mouseenter", "mouseleave", "resize"],
716
- setup(t, { emit: e }) {
717
- const r = t, n = {
718
- left: 0,
719
- right: 0,
720
- top: 0,
721
- bottom: 0
722
- }, { margins: a, containerSize: o } = R(r), u = x(null), { resizeRef: s, resizeState: l } = hn(), i = c(() => ({
723
- ...n,
724
- // Default values
725
- ...a.value
726
- // Prop overrides
727
- })), v = c(
728
- () => o.value.height + i.value.top + i.value.bottom
729
- );
730
- return Xe(() => {
731
- if (!u.value)
732
- return;
733
- const { width: d } = l.dimensions, { height: f } = u.value.getBoundingClientRect();
734
- if (!d || !f)
735
- return;
736
- const h = d - i.value.left - i.value.right, _ = f - i.value.top - i.value.bottom, p = {
737
- width: h > 0 ? h : 0,
738
- height: _ > 0 ? _ : 0,
739
- outerWidth: d,
740
- outerHeight: f
741
- };
742
- e("resize", p);
743
- }), { __sfc: !0, BASE_MARGINS: n, props: r, emit: e, margins: a, containerSize: o, root: u, resizeRef: s, resizeState: l, computedMargins: i, svgHeight: v };
744
- }
745
- });
746
- var yn = function() {
747
- var e = this, r = e._self._c, n = e._self._setupProxy;
748
- return r("div", { ref: "resizeRef", staticClass: "lume-chart-container", class: {
749
- "lume-chart-container--minimum": !e.noMinSize
750
- }, attrs: { "data-j-chart-container": "" } }, [e._t("header"), r("svg", { ref: "root", staticClass: "lume-chart-container__svg", class: {
751
- "lume-chart-container__svg--transparent": e.transparentBackground
752
- }, attrs: { height: n.svgHeight, "data-j-chart-container__root": "" }, on: { click: function(a) {
753
- return n.emit("click", a);
754
- }, mouseenter: function(a) {
755
- return n.emit("mouseenter", a);
756
- }, mouseleave: function(a) {
757
- return n.emit("mouseleave", a);
758
- } } }, [r("g", { staticClass: "lume-chart-container__group", attrs: { transform: `translate(${n.computedMargins.left}, ${n.computedMargins.top})`, "data-j-chart-container__group": "" } }, [e._t("default")], 2)]), e._t("footer"), e._t("extra")], 2);
759
- }, bn = [], kn = /* @__PURE__ */ D(
760
- gn,
761
- yn,
762
- bn,
763
- !1,
764
- null,
765
- "d53fd184",
766
- null,
767
- null
768
- );
769
- const An = kn.exports, On = /* @__PURE__ */ I({
770
- __name: "lume-chart-legend",
771
- props: {
772
- data: {
773
- type: Array,
774
- validator: Bt,
775
- required: !0
776
- }
777
- },
778
- emits: ["click", "mouseenter", "mouseleave"],
779
- setup(t, { emit: e }) {
780
- return { __sfc: !0, emit: e };
781
- }
782
- });
783
- var Tn = function() {
784
- var e = this, r = e._self._c, n = e._self._setupProxy;
785
- return r("div", { staticClass: "lume-chart-legend", attrs: { "data-j-chart-legend": "" }, on: { mouseleave: function(a) {
786
- return n.emit("mouseleave");
787
- } } }, e._l(e.data, function(a, o) {
788
- return r("div", { key: `legend-item-${o}`, staticClass: "lume-chart-legend__item lume-typography--body", attrs: { tabindex: "0", "data-j-chart-legend__symbol-wrapper": "" }, on: { click: function(u) {
789
- return n.emit("click", { index: o, dataset: a, event: u });
790
- }, mouseenter: function(u) {
791
- return n.emit("mouseenter", { index: o, dataset: a, event: u });
792
- } } }, [r("span", { staticClass: "lume-chart-legend__symbol", class: `lume-background-color--${a.color}`, attrs: { "data-j-chart-legend__symbol": "" } }), e._v(" " + e._s(a.label || o) + " ")]);
793
- }), 0);
794
- }, Ln = [], xn = /* @__PURE__ */ D(
795
- On,
796
- Tn,
797
- Ln,
798
- !1,
799
- null,
800
- "f8ebd3b9",
801
- null,
802
- null
803
- );
804
- const wn = xn.exports, $n = /* @__PURE__ */ I({
805
- __name: "lume-tooltip",
806
- props: {
807
- targetElement: {
808
- type: Element,
809
- default: null
810
- },
811
- items: {
812
- type: Array,
813
- required: !0
814
- },
815
- position: {
816
- type: String,
817
- default: "auto",
818
- validator: (t) => Jt.includes(t)
819
- },
820
- fixedPositioning: {
821
- type: Boolean,
822
- default: !1
823
- },
824
- modifiers: {
825
- type: Array,
826
- default: null
827
- },
828
- title: {
829
- type: [String, Number],
830
- default: null
831
- },
832
- summary: {
833
- type: String,
834
- default: null
835
- },
836
- ...ue()
837
- },
838
- emits: ["opened", "moved", "closed"],
839
- setup(t, { emit: e }) {
840
- const r = t, n = x(null), { items: a, options: o } = R(r), u = x(null), { allOptions: s } = G(o), l = c(
841
- () => s.value.fixedPositioning ?? r.fixedPositioning
842
- ), i = c(
843
- () => l.value ? "fixed" : "absolute"
844
- ), v = c(() => [
845
- {
846
- name: "computeStyles",
847
- options: {
848
- adaptive: !1
849
- // so that we can have smooth transitions
850
- }
851
- },
852
- {
853
- name: "offset",
854
- options: { offset: [0, s.value.offset || 8] }
855
- },
856
- ...r.modifiers || []
857
- ]), d = c(
858
- () => s.value.showTitle !== !1 && r.title != null
859
- ), f = c(() => te(s.value.valueFormat)), h = c(() => te(s.value.titleFormat)), _ = c(
860
- () => {
861
- var g;
862
- return ((g = a.value) == null ? void 0 : g.find((O) => O.isSummary)) || {
863
- label: s.value.summary ?? r.summary
864
- };
865
- }
866
- );
867
- function p() {
868
- r.targetElement && n.value && (u.value = It(r.targetElement, n.value, {
869
- placement: r.position,
870
- strategy: i.value,
871
- modifiers: v.value
872
- }), e("opened", r.targetElement));
873
- }
874
- function b() {
875
- u.value && (u.value.destroy(), e("closed"));
876
- }
877
- function m() {
878
- u.value && (n.value.classList.add("lume-tooltip--animated"), r.targetElement ? function() {
879
- u.value.state.elements.reference = r.targetElement, u.value.update(), e("moved", r.targetElement);
880
- }() : b());
881
- }
882
- return N(
883
- () => r.targetElement,
884
- (g, O) => {
885
- !O && g ? p() : m();
886
- }
887
- ), j(p), Ze(b), { __sfc: !0, props: r, emit: e, root: n, items: a, options: o, popper: u, allOptions: s, computedFixedPositioning: l, strategy: i, allModifiers: v, showTitle: d, formatValue: f, formatTitle: h, summaryItem: _, initPopper: p, destroyPopper: b, updatePopper: m };
888
- }
889
- });
890
- var In = function() {
891
- var e = this, r = e._self._c, n = e._self._setupProxy;
892
- return r("div", { directives: [{ name: "show", rawName: "v-show", value: e.targetElement, expression: "targetElement" }], ref: "root", staticClass: "lume-tooltip lume-typography--caption", attrs: { "data-j-tooltip": "" } }, [e._t("default", function() {
893
- return [n.showTitle ? r("div", { staticClass: "lume-tooltip__title", attrs: { "data-j-tooltip__title": "" } }, [e._v(" " + e._s(n.formatTitle(e.title)) + " ")]) : e._e(), r("ul", { staticClass: "lume-tooltip__items" }, [n.summaryItem.label ? [r("li", { staticClass: "lume-tooltip__item", attrs: { "data-j-tooltip__summary-item": "" } }, [r("span", [e._v(" " + e._s(n.summaryItem.label) + " ")]), n.summaryItem.value ? r("strong", { staticClass: "lume-tooltip__value" }, [e._v(" " + e._s(n.formatValue(n.summaryItem.value)) + " ")]) : e._e()]), e._m(0)] : e._e(), e._l(n.items, function(a) {
894
- return r("li", { key: a.label, staticClass: "lume-tooltip__item", attrs: { "data-j-tooltip__item": "" } }, [r("span", { staticClass: "lume-tooltip__symbol", class: [`lume-background-color--${a.color}`], attrs: { "data-j-tooltip__item__symbol": "" } }), r("span", { attrs: { "data-j-tooltip__item__label": "" } }, [e._v(" " + e._s(a.label) + " ")]), r("strong", { staticClass: "lume-tooltip__value", attrs: { "data-j-tooltip__item__value": "" } }, [e._v(" " + e._s(n.formatValue(a.value)) + " ")])]);
895
- })], 2)];
896
- })], 2);
897
- }, Dn = [function() {
898
- var t = this, e = t._self._c;
899
- return t._self._setupProxy, e("li", { staticClass: "lume-tooltip__break" }, [e("hr")]);
900
- }], En = /* @__PURE__ */ D(
901
- $n,
902
- In,
903
- Dn,
904
- !1,
905
- null,
906
- "f73a5e06",
907
- null,
908
- null
909
- );
910
- const Cn = En.exports;
911
- var M = /* @__PURE__ */ ((t) => (t.Categorical = "categorical", t.Sequential = "sequential", t.Divergent = "divergent", t))(M || {});
912
- const Rn = M.Categorical, ie = P.Skyblue, Nn = Ae.SkyTeal;
913
- function Bn(t) {
914
- return t === M.Divergent ? Nn : ie;
915
- }
916
- function Hn(t) {
917
- return Object.values(Oe).includes(t);
918
- }
919
- function Ce(t, e) {
920
- return e === M.Divergent ? Object.values(Ae).includes(t) : Object.values({
921
- ...P,
922
- ...Je,
923
- ...Qe,
924
- ...Oe
925
- }).includes(t);
926
- }
927
- function Pn(t, e) {
928
- const r = Object.values(P).indexOf(t);
929
- return Vt(Object.values(P), r > -1 ? r : 0)[e];
930
- }
931
- function Sn(t, e) {
932
- const r = 50 + e * 10;
933
- return `${t}-${r}`;
934
- }
935
- function Gn(t, e) {
936
- const r = (e + 1) * 10;
937
- return `${t}-${r}`;
938
- }
939
- function Re(t, e, r) {
940
- switch (e) {
941
- default:
942
- case M.Categorical:
943
- return Hn(t) ? t : Pn(t, r);
944
- case M.Sequential:
945
- return Sn(t, r);
946
- case M.Divergent:
947
- return Gn(t, r);
948
- }
949
- }
950
- function jn(t, e, r = Rn, n) {
951
- return Ce(t, r) ? t : (n > 4 && (oe(q.ColorLoop), n = n % 5), Ce(e, r) ? Re(e, r, n) : Re(Bn(r), r, n));
952
- }
953
- function Vn(t) {
954
- return t.map((e) => Ht(e) ? e : { value: e });
955
- }
956
- function Fn(t) {
957
- return t.__internal === !0;
958
- }
959
- const rt = (t = null) => ({
960
- data: {
961
- type: Array,
962
- required: !0,
963
- validator: t || void 0
964
- },
965
- labels: {
966
- type: Array,
967
- default: void 0
968
- },
969
- color: {
970
- type: String,
971
- default: P.Skyblue
972
- }
973
- });
974
- function Le(t, e, r, n, a) {
975
- const o = ae({
976
- width: 0,
977
- height: 0
978
- }), u = Ft(12), s = c(() => {
979
- var v;
980
- return t.value.length > 5 && oe(q.DatasetLength), (v = t.value) == null ? void 0 : v.map(
981
- (d, f) => {
982
- if (Fn(d))
983
- return d;
984
- const h = Vn(d.values), _ = jn(
985
- d.color,
986
- r == null ? void 0 : r.value,
987
- n == null ? void 0 : n.value.colorPalette,
988
- f
989
- );
990
- return {
991
- ...d,
992
- values: h,
993
- color: _,
994
- __internal: !0
995
- };
996
- }
997
- );
998
- }), l = c(() => Array.isArray(e.value) ? e.value : _e(t.value).map((v, d) => d));
999
- function i(v) {
1000
- const d = (a == null ? void 0 : a.value) === T.HORIZONTAL ? _e(t).length * (Xt * 2) : v.height;
1001
- o.width = v.width, o.height = d;
1002
- }
1003
- return {
1004
- chartID: u,
1005
- computedLabels: l,
1006
- containerSize: o,
1007
- internalData: s,
1008
- updateSize: i
1009
- };
1010
- }
1011
- const Mn = () => ({
1012
- xScale: {
1013
- type: Function,
1014
- default: null
1015
- },
1016
- yScale: {
1017
- type: Function,
1018
- default: null
1019
- }
1020
- });
1021
- function zn(t, e, r, n, a) {
1022
- const o = x(null), u = x(null);
1023
- function s() {
1024
- const { width: l, height: i } = r;
1025
- !l && !i || !e.value || !t.value || (n.value === T.HORIZONTAL ? (o.value = Be(
1026
- t.value,
1027
- l,
1028
- n.value,
1029
- a.value.startOnZero
1030
- ), u.value = Ne(e.value, i)) : (o.value = Ne(e.value, l), u.value = Be(
1031
- t.value,
1032
- i,
1033
- n.value,
1034
- a.value.startOnZero
1035
- )));
1036
- }
1037
- return Xe(s), { xScale: o, yScale: u };
1038
- }
1039
- function Ne(t, e) {
1040
- const r = [0, e];
1041
- return Object.assign(
1042
- J().range(r).domain(t.map((n, a) => a)),
1043
- { labels: t }
1044
- );
1045
- }
1046
- function Be(t, e, r, n) {
1047
- const a = Ue(t).filter((v) => v != null), o = [0, e];
1048
- if (a.length === 0)
1049
- return Q().range(o).domain([0, 0]).nice();
1050
- const u = Math.min(...a), s = n && u > 0 ? 0 : u, l = Math.max(...a), i = r === T.HORIZONTAL ? [s, l] : [l, s];
1051
- return Q().range(o).domain(i).nice();
1052
- }
1053
- function He(t) {
1054
- return (t == null ? void 0 : t.range) !== void 0 || (t == null ? void 0 : t.copy) !== void 0;
1055
- }
1056
- function me(t, e) {
1057
- return W(t) ? t.bandwidth() / 2 + t(t.domain()[e]) : t(e);
1058
- }
1059
- function ne(t, e, {
1060
- padding: r,
1061
- paddingInner: n,
1062
- paddingOuter: a
1063
- } = {}) {
1064
- const o = r ?? (e === T.HORIZONTAL ? Ut : Yt);
1065
- return t.copy().paddingInner(n ?? o).paddingOuter(a ?? o / 2);
1066
- }
1067
- function at(t) {
1068
- return Object.values(T).includes(t);
1069
- }
1070
- const X = (t, e = !0, r = !0) => ({
1071
- ...rt(t),
1072
- ...r ? Mn() : {},
1073
- ...ue(),
1074
- title: {
1075
- type: String,
1076
- default: null
1077
- },
1078
- ...e ? {
1079
- orientation: {
1080
- type: String,
1081
- default: T.VERTICAL,
1082
- validator: at
1083
- }
1084
- } : {},
1085
- classList: {
1086
- type: [String, Array],
1087
- default: () => []
1088
- }
1089
- }), se = () => ({
1090
- data: {
1091
- type: Array,
1092
- required: !0
1093
- },
1094
- labels: {
1095
- type: Array,
1096
- default: () => []
1097
- },
1098
- options: {
1099
- type: Object,
1100
- default: () => ({})
1101
- },
1102
- orientation: {
1103
- type: String,
1104
- default: T.VERTICAL,
1105
- validator: at
1106
- },
1107
- xScale: {
1108
- type: Function,
1109
- default: () => null
1110
- },
1111
- yScale: {
1112
- type: Function,
1113
- default: () => null
1114
- },
1115
- hoveredIndex: {
1116
- type: Number,
1117
- default: -1
1118
- },
1119
- containerSize: {
1120
- type: Object,
1121
- default: () => ({ width: 0, height: 0 })
1122
- },
1123
- transition: {
1124
- type: Boolean,
1125
- default: !0
1126
- },
1127
- classList: {
1128
- type: [String, Array],
1129
- default: () => []
1130
- }
1131
- }), Wn = /* @__PURE__ */ I({
1132
- __name: "lume-overlay-group",
1133
- props: {
1134
- ...se(),
1135
- orientation: {
1136
- type: String,
1137
- default: T.VERTICAL
1138
- }
1139
- },
1140
- emits: ["click", "lume__internal--hover", "mouseover"],
1141
- setup(t, { emit: e }) {
1142
- const r = t, { data: n, orientation: a, xScale: o, yScale: u } = R(r), s = c(() => _e(n));
1143
- function l(i) {
1144
- const v = a.value === T.HORIZONTAL ? u.value : o.value, d = v.domain(), f = ke(v), h = W(v) ? v(d[i]) : v(i) - f / 2;
1145
- return a.value === T.HORIZONTAL ? {
1146
- width: Math.max(...o.value.range()),
1147
- height: f,
1148
- transform: `translate(0, ${h})`
1149
- } : {
1150
- width: f,
1151
- height: Math.max(...u.value.range()),
1152
- transform: `translate(${h}, 0)`
1153
- };
1154
- }
1155
- return { __sfc: !0, props: r, emit: e, data: n, orientation: a, xScale: o, yScale: u, overlayData: s, getOverlayBarAttributes: l, LumeBar: Te };
1156
- }
1157
- });
1158
- var Zn = function() {
1159
- var e = this, r = e._self._c, n = e._self._setupProxy;
1160
- return r("g", { staticClass: "lume-overlay-group" }, e._l(n.overlayData, function(a, o) {
1161
- return r(n.LumeBar, e._b({ key: `overlay-${o}`, attrs: { "data-j-lume-overlay-group": o, transition: !1, "class-list": "lume-fill--transparent" }, on: { mouseover: function(u) {
1162
- return n.emit("lume__internal--hover", o);
1163
- }, click: function(u) {
1164
- return n.emit("click", { index: o, event: u });
1165
- } } }, "lume-bar", n.getOverlayBarAttributes(o), !1));
1166
- }), 1);
1167
- }, Xn = [], Yn = /* @__PURE__ */ D(
1168
- Wn,
1169
- Zn,
1170
- Xn,
1171
- !1,
1172
- null,
1173
- null,
1174
- null,
1175
- null
1176
- );
1177
- const Un = Yn.exports;
1178
- function Kn(t) {
1179
- return { hasNegativeValues: c(
1180
- () => Ue(t.value).some((r) => r < 0)
1181
- ) };
1182
- }
1183
- function Jn(t, e, r, n) {
1184
- const a = c(
1185
- () => n.value === T.HORIZONTAL
1186
- ), o = c(
1187
- () => {
1188
- var i;
1189
- return t.height - (a != null && a.value ? 0 : ((i = r.value) == null ? void 0 : i.call(r, 0)) || 0);
1190
- }
1191
- ), u = c(
1192
- () => {
1193
- var i;
1194
- return a != null && a.value ? ((i = e.value) == null ? void 0 : i.call(e, 0)) || 0 : t.width;
1195
- }
1196
- ), s = c(
1197
- () => {
1198
- var i;
1199
- return a != null && a.value ? "translate(0, 0)" : `translate(0, ${((i = r.value) == null ? void 0 : i.call(r, 0)) || 0})`;
1200
- }
1201
- );
1202
- return { negativeBarAttributes: c(() => ({
1203
- width: u.value,
1204
- height: o.value,
1205
- transform: s.value
1206
- })) };
1207
- }
1208
- function Qn(t) {
1209
- return t.reduce((e, r) => r.values.map((n, a) => e[a] ? n.value > e[a] ? n.value : e[a] : n.value ?? 0), []);
1210
- }
1211
- function qn(t) {
1212
- return t.reduce((e, r) => r.values.map((n, a) => e[a] ? n.value + e[a] : n.value ?? 0), []);
1213
- }
1214
- const Pe = {
1215
- "stacked-bar": qn
1216
- };
1217
- function ot(t, e, r, n, a, o, u) {
1218
- const s = c(
1219
- () => {
1220
- var i;
1221
- return e.value.withTooltip !== !1 && !((i = e.value.tooltipOptions) != null && i.targetElement);
1222
- }
1223
- );
1224
- function l(i) {
1225
- const v = u != null && u.value && Pe[u.value] ? Pe[u.value](i) : Qn(i);
1226
- t.value = v.map((d, f) => ({
1227
- cx: (a == null ? void 0 : a.value) === T.HORIZONTAL ? r.value(d) : me(r.value, f),
1228
- cy: (a == null ? void 0 : a.value) === T.HORIZONTAL ? me(n.value, f) : n.value(d)
1229
- }));
1230
- }
1231
- return N(
1232
- [r, n],
1233
- () => {
1234
- r.value && n.value && (o != null && o.value) && s.value && l(o.value);
1235
- },
1236
- { immediate: !0 }
1237
- ), { shouldGenerateTooltipAnchors: s, updateTooltipAnchorAttributes: l };
1238
- }
1239
- function er() {
1240
- const t = ae({
1241
- opened: !1,
1242
- targetElement: null
1243
- });
1244
- return { tooltipConfig: t, showTooltip: (n) => {
1245
- t.opened = !0, t.targetElement = n;
1246
- }, hideTooltip: () => {
1247
- t.opened = !1, t.targetElement = null;
1248
- } };
1249
- }
1250
- function tr(t) {
1251
- return { getTooltipItems: c(
1252
- () => (r) => t.value.map(({ color: n, label: a, values: o }) => {
1253
- var u, s, l;
1254
- return {
1255
- color: ((u = o[r]) == null ? void 0 : u.color) || n,
1256
- label: a,
1257
- value: ((s = o[r]) == null ? void 0 : s.label) ?? ((l = o[r]) == null ? void 0 : l.value) ?? qe
1258
- };
1259
- })
1260
- ) };
1261
- }
1262
- const nr = /* @__PURE__ */ I({
1263
- __name: "lume-chart",
1264
- props: {
1265
- ...X(),
1266
- chartType: {
1267
- type: String,
1268
- default: null
1269
- }
1270
- },
1271
- setup(t, { emit: e }) {
1272
- const r = t, n = V(), a = Kt, { data: o, labels: u, color: s, options: l, orientation: i, chartType: v } = R(r), d = x(-1), f = x(null), h = x(null), _ = x([]), { allOptions: p } = G(l), { internalData: b, computedLabels: m, containerSize: g, updateSize: O, chartID: L } = Le(o, u, s, p, i), { xScale: y, yScale: k } = zn(
1273
- b,
1274
- m,
1275
- g,
1276
- i,
1277
- p
1278
- ), $ = c(() => {
1279
- var A;
1280
- return r.xScale ? He(r.xScale) ? r.xScale : (A = r.xScale) == null ? void 0 : A.call(r, b.value, u.value, g) : y.value;
1281
- }), E = c(() => {
1282
- var A;
1283
- return r.yScale ? He(r.yScale) ? r.yScale : (A = r.yScale) == null ? void 0 : A.call(r, b.value, u.value, g) : k.value;
1284
- }), H = c(() => ({
1285
- ...p.value.xAxisOptions,
1286
- withHover: i.value === T.VERTICAL
1287
- })), Y = c(() => ({
1288
- ...p.value.yAxisOptions,
1289
- withHover: i.value === T.HORIZONTAL
1290
- })), w = c(() => {
1291
- var A;
1292
- return (A = p.value.xAxisOptions) == null ? void 0 : A.title;
1293
- }), C = c(() => {
1294
- var A;
1295
- return (A = p.value.yAxisOptions) == null ? void 0 : A.title;
1296
- }), S = c(() => {
1297
- var A;
1298
- return ((A = p.value.xAxisOptions) == null ? void 0 : A.withTitle) !== !1 && w.value;
1299
- }), ce = c(() => {
1300
- var A;
1301
- return ((A = p.value.yAxisOptions) == null ? void 0 : A.withTitle) !== !1 && C.value;
1302
- }), dt = c(() => {
1303
- const A = [], { noBaseScales: B } = p.value;
1304
- return B || A.push(() => !!($.value && E.value)), A.every((F) => F() === !0);
1305
- }), { hasNegativeValues: vt } = Kn(b), { negativeBarAttributes: _t } = Jn(
1306
- g,
1307
- $,
1308
- E,
1309
- i
1310
- ), { shouldGenerateTooltipAnchors: pt } = ot(
1311
- _,
1312
- p,
1313
- $,
1314
- E,
1315
- i,
1316
- b,
1317
- v
1318
- ), { tooltipConfig: we, showTooltip: $e, hideTooltip: Ie } = er(), { getTooltipItems: ft } = tr(b), mt = c(
1319
- () => p.value.withTooltip !== !1 && we.opened
1320
- ), ht = c(
1321
- () => {
1322
- var A;
1323
- return ((A = p.value.tooltipOptions) == null ? void 0 : A.position) || "top";
1324
- }
1325
- );
1326
- function De(A) {
1327
- var B;
1328
- if (A !== d.value && (p.value.withHover !== !1 && (d.value = A), p.value.withTooltip !== !1)) {
1329
- const F = (B = p.value.tooltipOptions) != null && B.targetElement ? p.value.tooltipOptions.targetElement === "self" ? h.value.$el : p.value.tooltipOptions.targetElement : f.value[A];
1330
- $e(F);
1331
- }
1332
- }
1333
- function gt() {
1334
- Ie(), d.value = -1, e("chart-mouseleave");
1335
- }
1336
- function yt({ index: A, value: B, event: F }) {
1337
- A !== null && De(A), e("axis-mouseenter", { index: A, value: B, event: F });
1338
- }
1339
- function bt({ index: A, value: B, event: F }) {
1340
- e("axis-click", { index: A, value: B, event: F });
1341
- }
1342
- return N(
1343
- o,
1344
- (A, B) => e("data-changed", { newValue: A, oldValue: B })
1345
- ), N(
1346
- u,
1347
- (A, B) => e("labels-changed", { newValue: A, oldValue: B })
1348
- ), j(() => {
1349
- e("rendered"), n.groups || console.error('"groups" `<slot>` must have content.');
1350
- }), Ee("chartID", L), Ee("tooltipAnchorAttributes", _), { __sfc: !0, props: r, slots: n, emit: e, tooltipAnchorRadius: a, data: o, labels: u, color: s, options: l, orientation: i, chartType: v, hoveredIndex: d, tooltipAnchor: f, chartContainer: h, tooltipAnchorAttributes: _, allOptions: p, internalData: b, computedLabels: m, containerSize: g, updateSize: O, chartID: L, xScale: y, yScale: k, computedXScale: $, computedYScale: E, computedXAxisOptions: H, computedYAxisOptions: Y, xAxisTitle: w, yAxisTitle: C, showXAxisTitle: S, showYAxisTitle: ce, isReady: dt, hasNegativeValues: vt, negativeBarAttributes: _t, shouldGenerateTooltipAnchors: pt, tooltipConfig: we, showTooltip: $e, hideTooltip: Ie, getTooltipItems: ft, isTooltipOpened: mt, tooltipPosition: ht, handleInternalHover: De, handleMouseleave: gt, handleAxisMouseenter: yt, handleAxisClick: bt, LumeAxis: cn, LumeBar: Te, LumeChartContainer: An, LumeChartLegend: wn, LumeTooltip: Cn, LumeOverlayGroup: Un };
1351
- }
1352
- });
1353
- var rr = function() {
1354
- var e = this, r = e._self._c, n = e._self._setupProxy;
1355
- return r(n.LumeChartContainer, { ref: "chartContainer", attrs: { id: `lume-chart_${n.chartID}`, margins: n.allOptions.margins, "container-size": n.containerSize, "no-min-size": n.allOptions.noMinSize, "transparent-background": n.allOptions.transparentBackground, "data-j-lume-chart": "" }, on: { resize: n.updateSize, click: function(a) {
1356
- return n.emit("chart-click", a);
1357
- }, mouseenter: function(a) {
1358
- return n.emit("chart-mouseenter", a);
1359
- }, mouseleave: n.handleMouseleave }, scopedSlots: e._u([{ key: "header", fn: function() {
1360
- return [r("div", { staticClass: "lume-chart__header" }, [r("div", { staticClass: "lume-chart__header-section" }, [e.title ? r("h1", { staticClass: "lume-chart__title lume-chart-title lume-typography--display" }, [e._v(" " + e._s(e.title) + " ")]) : e._e(), r("div", { staticClass: "lume-chart__controls" }, [e._t("controls")], 2)]), r("div", { staticClass: "lume-chart__header-section" }, [n.showYAxisTitle ? r("h3", { staticClass: "lume-chart__axis-title lume-axis-title lume-typography--body" }, [e._v(" " + e._s(n.yAxisTitle) + " ")]) : e._e(), e._t("legend", function() {
1361
- return [n.allOptions.withLegend !== !1 && n.allOptions.legendPosition !== "bottom" ? r(n.LumeChartLegend, { staticClass: "lume-chart__legend", attrs: { data: n.internalData, "data-j-lume-chart__legend": "" }, on: { click: function(a) {
1362
- return n.emit("legend-click", a);
1363
- }, mouseenter: function(a) {
1364
- return n.emit("legend-mouseenter", a);
1365
- }, mouseleave: function(a) {
1366
- return n.emit("legend-mouseleave");
1367
- } } }) : e._e()];
1368
- }, { data: n.internalData })], 2)])];
1369
- }, proxy: !0 }, { key: "footer", fn: function() {
1370
- return [n.showXAxisTitle ? r("h3", { staticClass: "lume-chart__axis-title lume-chart__axis-title--centered lume-axis-title" }, [e._v(" " + e._s(n.xAxisTitle) + " ")]) : e._e(), n.allOptions.withLegend !== !1 && n.allOptions.legendPosition == "bottom" ? r(n.LumeChartLegend, { staticClass: "lume-chart__legend lume-chart__legend--bottom", attrs: { data: n.internalData, "data-j-lume-chart__legend": "" }, on: { click: function(a) {
1371
- return n.emit("legend-click", a);
1372
- }, mouseenter: function(a) {
1373
- return n.emit("legend-mouseenter", a);
1374
- }, mouseleave: function(a) {
1375
- return n.emit("legend-mouseleave");
1376
- } } }) : e._e()];
1377
- }, proxy: !0 }, { key: "extra", fn: function() {
1378
- return [e._t("tooltip", function() {
1379
- return [n.isTooltipOpened ? r(n.LumeTooltip, e._b({ attrs: { position: n.tooltipPosition, title: n.computedLabels[n.hoveredIndex], items: n.getTooltipItems(n.hoveredIndex), options: n.allOptions.tooltipOptions, "data-j-lume-chart__tooltip": "" }, on: { opened: function(a) {
1380
- return n.emit("tooltip-opened", {
1381
- index: n.hoveredIndex,
1382
- targetElement: a
1383
- });
1384
- }, moved: function(a) {
1385
- return n.emit("tooltip-moved", {
1386
- index: n.hoveredIndex,
1387
- targetElement: a
1388
- });
1389
- }, closed: function(a) {
1390
- return n.emit("tooltip-closed");
1391
- } } }, "lume-tooltip", n.tooltipConfig, !1), [e._t("tooltip-content", null, { data: n.internalData, labels: n.computedLabels, hoveredIndex: n.hoveredIndex })], 2) : e._e()];
1392
- }, { data: n.internalData, labels: n.computedLabels, withTooltip: n.allOptions.withTooltip !== !1, hoveredIndex: n.hoveredIndex, options: n.allOptions.tooltipOptions }, n.tooltipConfig)];
1393
- }, proxy: !0 }], null, !0) }, [n.isReady ? [n.hasNegativeValues ? r(n.LumeBar, e._b({ attrs: { "class-list": "lume-fill--negative", transition: !1, "data-j-lume-chart__negative-values": "" } }, "lume-bar", n.negativeBarAttributes, !1)) : e._e(), n.allOptions.withAxes !== !1 ? e._t("axes", function() {
1394
- return [r(n.LumeAxis, { attrs: { type: "x", scale: n.computedXScale, "container-size": n.containerSize, options: n.computedXAxisOptions, "hovered-index": n.hoveredIndex, orientation: n.orientation, "data-j-lume-chart__x-axis": "" }, on: { click: n.handleAxisClick, mouseenter: n.handleAxisMouseenter, mouseleave: function(a) {
1395
- return n.emit("axis-mouseleave");
1396
- } } }), r(n.LumeAxis, { attrs: { type: "y", scale: n.computedYScale, "container-size": n.containerSize, options: n.computedYAxisOptions, "hovered-index": n.hoveredIndex, orientation: n.orientation, "data-j-lume-chart__y-axis": "" }, on: { click: n.handleAxisClick, mouseenter: n.handleAxisMouseenter, mouseleave: function(a) {
1397
- return n.emit("axis-mouseleave");
1398
- } } })];
1399
- }, { xScale: n.computedXScale, yScale: n.computedYScale, containerSize: n.containerSize, options: n.allOptions, hoveredIndex: n.hoveredIndex }) : e._e(), n.allOptions.withHover !== !1 ? r(n.LumeOverlayGroup, { attrs: { data: n.internalData, orientation: n.orientation, "x-scale": n.computedXScale, "y-scale": n.computedYScale, "data-j-lume-chart__overlay-group": "" }, on: { "lume__internal--hover": n.handleInternalHover } }) : e._e(), n.shouldGenerateTooltipAnchors ? r("g", e._l(n.tooltipAnchorAttributes, function(a, o) {
1400
- return r("circle", e._b({ key: `anchor_${o}`, ref: "tooltipAnchor", refInFor: !0, staticClass: "lume-fill--transparent", attrs: { r: n.tooltipAnchorRadius } }, "circle", a, !1));
1401
- }), 0) : e._e(), e._t("groups", null, { data: n.internalData, labels: n.computedLabels, options: n.allOptions, orientation: n.orientation, xScale: n.computedXScale, yScale: n.computedYScale, hoveredIndex: n.hoveredIndex, containerSize: n.containerSize, transition: n.allOptions.withTransition !== !1, classList: e.classList })] : e._e()], 2);
1402
- }, ar = [], or = /* @__PURE__ */ D(
1403
- nr,
1404
- rr,
1405
- ar,
1406
- !1,
1407
- null,
1408
- "9c6832ae",
1409
- null,
1410
- null
1411
- );
1412
- const K = or.exports;
1413
- function Se(t, e) {
1414
- return {
1415
- x0: 0 + (e ? e.left : 0),
1416
- y0: 0 + (e ? e.top : 0),
1417
- x1: t.width - (e ? e.right : 0),
1418
- y1: t.height - (e ? e.bottom : 0)
1419
- };
1420
- }
1421
- function ur(t) {
1422
- const e = x(Se(t));
1423
- function r(n) {
1424
- e.value = Se(t, n);
1425
- }
1426
- return { extents: e, updateExtents: r };
1427
- }
1428
- var ut = /* @__PURE__ */ ((t) => (t.GraphProblem = "There was an issue generating your alluvial graph.", t))(ut || {});
1429
- const lr = "[lume] ";
1430
- function ir(t, e, r = !0) {
1431
- r && Ye() || console.error(lr + "Error: " + t, e);
1432
- }
1433
- const Ge = 8, sr = 8, cr = 20, dr = 200;
1434
- function U(t) {
1435
- return typeof t == "string" || typeof t == "number" ? t : t.id ?? t.label;
1436
- }
1437
- function re(t) {
1438
- return t.source.id + ":" + t.target.id;
1439
- }
1440
- function lt(t) {
1441
- return !!(t.sourceLinks && t.targetLinks);
1442
- }
1443
- function vr(t, e) {
1444
- if (!e)
1445
- return;
1446
- const r = t.nodes.filter((u) => u.targetLinks.length === 0).map((u) => `${u.id}`), n = t.nodes.filter((u) => u.sourceLinks.length === 0).map((u) => `${u.id}`), a = e.filter((u) => r.includes(u.dataset.id)).reduce(
1447
- (u, s) => Math.max(u, s.getBBox().width),
1448
- -1 / 0
1449
- ), o = e.filter((u) => n.includes(u.dataset.id)).reduce(
1450
- (u, s) => Math.max(u, s.getBBox().width),
1451
- -1 / 0
1452
- );
1453
- return {
1454
- left: a,
1455
- top: 0,
1456
- right: o,
1457
- bottom: 0
1458
- };
1459
- }
1460
- function _r(t) {
1461
- return t.map((e) => ({
1462
- x: e.x0,
1463
- y: e.y0,
1464
- width: e.x1 - e.x0,
1465
- height: e.y1 - e.y0,
1466
- textTransform: {
1467
- x: e.depth > 0 ? e.x1 + Ge : e.x0 - Ge,
1468
- y: (e.y1 + e.y0) / 2
1469
- },
1470
- node: e
1471
- }));
1472
- }
1473
- function pr(t) {
1474
- const e = At();
1475
- return t.map((r) => {
1476
- var n;
1477
- return {
1478
- id: re(r),
1479
- color: r.color || ((n = r.source) == null ? void 0 : n.color) || ie,
1480
- d: e(r),
1481
- strokeWidth: Math.max(1, r.width),
1482
- link: r
1483
- };
1484
- });
1485
- }
1486
- function je(t, e, r, n, a) {
1487
- if (n === !1) {
1488
- t.node = {
1489
- ...t.node,
1490
- transitionValue: a ? void 0 : r
1491
- };
1492
- return;
1493
- }
1494
- const o = Date.now(), u = jt(e, r), s = () => {
1495
- let i = (Date.now() - o) / dr;
1496
- i > 1 && (i = 1), t.node = {
1497
- ...t.node,
1498
- transitionValue: a && i === 1 ? void 0 : u(i)
1499
- }, i < 1 && requestAnimationFrame(s);
1500
- };
1501
- requestAnimationFrame(s);
1502
- }
1503
- const fr = {
1504
- nodes: [],
1505
- links: []
1506
- };
1507
- function mr(t, e, r) {
1508
- const n = x(null), a = c(() => {
1509
- var s;
1510
- return (s = t.value) == null ? void 0 : s[0].values.map(({ label: l, color: i, value: v }) => ({
1511
- label: l || v.toString(),
1512
- color: i,
1513
- id: v
1514
- }));
1515
- }), o = c(() => {
1516
- var s;
1517
- return (s = t.value) == null ? void 0 : s[0].values.map(
1518
- (l) => {
1519
- var i;
1520
- return (i = l.targets) == null ? void 0 : i.map(({ node: v, value: d, color: f }) => ({
1521
- color: f,
1522
- source: l.value ?? l.label,
1523
- target: v,
1524
- value: d
1525
- }));
1526
- }
1527
- ).filter(Boolean).flat();
1528
- }), u = c(() => Ot().nodeId(U).nodeAlign(e.value.nodeAlign).nodePadding(e.value.nodePadding).nodeSort(e.value.nodeSort).nodeWidth(e.value.nodeWidth).linkSort(e.value.linkSort));
1529
- return N([u, r], () => {
1530
- try {
1531
- const { x0: s, y0: l, x1: i, y1: v } = r.value;
1532
- n.value = u.value.extent([
1533
- [s, l],
1534
- [i, v]
1535
- ])({ nodes: a.value, links: o.value });
1536
- } catch (s) {
1537
- ir(ut.GraphProblem, s), n.value = fr;
1538
- }
1539
- }), { graph: n };
1540
- }
1541
- function he(t, e) {
1542
- return e || (e = {}), t.targetLinks && t.targetLinks.forEach(({ source: r, value: n }) => {
1543
- e[r.id] = n, he(r, e);
1544
- }), e;
1545
- }
1546
- function ge(t, e) {
1547
- return e || (e = {}), t.sourceLinks && t.sourceLinks.forEach(({ target: r, value: n }) => {
1548
- e[r.id] = n, ge(r, e);
1549
- }), e;
1550
- }
1551
- function hr(t, e) {
1552
- return e.links.reduce((r, n) => (n.source.id in t && n.target.id in t && r.push(re(n)), r), []);
1553
- }
1554
- const gr = (t, e) => {
1555
- let r;
1556
- lt(t) ? r = {
1557
- [t.id]: t.value,
1558
- ...he(t),
1559
- ...ge(t)
1560
- } : r = {
1561
- [t.source.id]: t.source.value,
1562
- [t.target.id]: t.target.value,
1563
- ...he(t.source),
1564
- ...ge(t.target)
1565
- };
1566
- const n = hr(r, e);
1567
- return { nodes: r, links: n };
1568
- }, yr = (t) => {
1569
- if (lt(t)) {
1570
- const e = [...t.sourceLinks, ...t.targetLinks];
1571
- return {
1572
- nodes: e.reduce(
1573
- (r, { source: n, target: a, value: o }) => n === t ? { ...r, [U(a)]: o } : { ...r, [U(n)]: o },
1574
- { [U(t)]: t.value }
1575
- ),
1576
- links: e.map((r) => re(r))
1577
- };
1578
- }
1579
- return {
1580
- nodes: {
1581
- [U(t.target)]: t.value,
1582
- [U(t.source)]: t.source.value
1583
- },
1584
- links: [re(t)]
1585
- };
1586
- };
1587
- function br(t, e, r) {
1588
- const n = x(null), a = c(() => n.value ? typeof e.value.highlightedElements == "function" ? e.value.highlightedElements(
1589
- n.value,
1590
- r.value
1591
- ) : e.value.highlightedElements === "closest" ? yr(n.value, r.value) : gr(n.value, r.value) : { nodes: {}, links: [] });
1592
- return N(a, (o, u) => {
1593
- if (o.links.length === 0 && Object.keys(o.nodes).length === 0) {
1594
- t.value.forEach((s) => {
1595
- s.node.id in u.nodes && je(
1596
- s,
1597
- u.nodes[s.node.id],
1598
- s.node.value,
1599
- e.value.withTransition,
1600
- !0
1601
- );
1602
- });
1603
- return;
1604
- }
1605
- t.value.forEach((s) => {
1606
- s.node.id in o.nodes && je(
1607
- s,
1608
- s.node.value,
1609
- o.nodes[s.node.id],
1610
- e.value.withTransition
1611
- );
1612
- });
1613
- }), { highlightedElements: a, hoveredElement: n };
1614
- }
1615
- const kr = /* @__PURE__ */ I({
1616
- __name: "lume-alluvial-group",
1617
- props: {
1618
- ...se()
1619
- },
1620
- emits: ["node-click", "node-mouseenter", "node-mouseleave", "link-click", "link-mouseenter", "link-mouseleave"],
1621
- setup(t, { emit: e }) {
1622
- const r = t, { data: n, options: a } = R(r), o = x([]), u = x([]), s = x(null), { extents: l, updateExtents: i } = ur(r.containerSize), { graph: v } = mr(n, a, l), { hoveredElement: d, highlightedElements: f } = br(
1623
- o,
1624
- a,
1625
- v
1626
- ), h = c(() => te(a.value.valueFormat)), _ = c(
1627
- () => Object.keys(f.value.nodes)
1628
- ), p = c(
1629
- () => o.value.reduce((k, $) => {
1630
- const E = $.x + a.value.nodeWidth / 2;
1631
- return k.includes(E) ? k : [...k, E];
1632
- }, [])
1633
- ), b = c(() => {
1634
- if (!(!a.value.nodeHeaders || !a.value.nodeHeaders.length))
1635
- return a.value.nodeHeaders.slice(0, p.value.length).map((k, $) => ({
1636
- label: k,
1637
- x: p.value[$]
1638
- }));
1639
- }), m = c(
1640
- () => a.value.nodeHeaderPadding ?? cr
1641
- );
1642
- function g(k) {
1643
- return _.value.length > 0 && !_.value.includes(k.toString());
1644
- }
1645
- function O(k) {
1646
- return f.value.links.length > 0 && !f.value.links.includes(k);
1647
- }
1648
- function L(k, $) {
1649
- k !== d.value && (d.value = k, e("link-mouseenter", { link: k, event: $ }));
1650
- }
1651
- function y(k) {
1652
- const $ = d.value;
1653
- d.value = null, e("link-mouseleave", { link: $, event: k });
1654
- }
1655
- return N(v, (k) => {
1656
- o.value = _r(k.nodes), u.value = pr(k.links).reverse();
1657
- }), N([r.containerSize, s], () => {
1658
- if (r.containerSize.width && r.containerSize.height) {
1659
- const k = vr(v.value, s.value);
1660
- i(k);
1661
- }
1662
- }), { __sfc: !0, props: r, emit: e, data: n, options: a, nodeBlocks: o, linkPaths: u, nodeTextRefs: s, extents: l, updateExtents: i, graph: v, hoveredElement: d, highlightedElements: f, formatValue: h, hoveredNodeIds: _, nodeColumnPositions: p, nodeHeaders: b, computedNodeHeaderPadding: m, isNodeFaded: g, isLinkFaded: O, handleLinkMouseover: L, handleLinkMouseleave: y, GHOST_STROKE_WIDTH_OFFSET: sr, DEFAULT_COLOR: ie };
1663
- }
1664
- });
1665
- var Ar = function() {
1666
- var e = this, r = e._self._c, n = e._self._setupProxy;
1667
- return r("g", { staticClass: "lume-alluvial-group", attrs: { "data-j-alluvial-group": "" } }, [n.nodeHeaders ? r("g", e._l(n.nodeHeaders, function(a) {
1668
- return r("text", { key: `header_${a.x}`, staticClass: "lume-alluvial-group__node-header lume-typography--caption", attrs: { x: a.x, y: -n.computedNodeHeaderPadding } }, [e._v(" " + e._s(a.label) + " ")]);
1669
- }), 0) : e._e(), r("g", { staticClass: "lume-alluvial-link-group", on: { mouseleave: n.handleLinkMouseleave } }, [e._l(n.linkPaths, function(a) {
1670
- return r("path", { key: `link-ghost_${a.id}`, staticClass: "lume-alluvial-group__link", class: [
1671
- "lume-stroke--transparent",
1672
- "lume-alluvial-group__link--ghost"
1673
- ], attrs: { d: a.d, "stroke-width": a.strokeWidth + n.GHOST_STROKE_WIDTH_OFFSET, "data-j-alluvial-ghost": "" }, on: { click: function(o) {
1674
- return n.emit("link-click", { link: a.link, event: o });
1675
- }, mouseover: function(o) {
1676
- return n.handleLinkMouseover(a.link, o);
1677
- } } });
1678
- }), e._l(n.linkPaths, function(a) {
1679
- return r("path", { key: `link_${a.id}`, staticClass: "lume-alluvial-group__link", class: {
1680
- [`lume-stroke--${a.color}`]: a.color,
1681
- "lume-alluvial-group__link--faded": n.isLinkFaded(a.id)
1682
- }, attrs: { d: a.d, "stroke-dasharray": e.containerSize.width, "stroke-dashoffset": e.containerSize.width, "stroke-width": a.strokeWidth, "data-j-alluvial-path": "", "data-id": a.id }, on: { click: function(o) {
1683
- return n.emit("link-click", { link: a.link, event: o });
1684
- }, mouseover: function(o) {
1685
- return n.handleLinkMouseover(a.link, o);
1686
- } } });
1687
- })], 2), e._l(n.nodeBlocks, function(a, o) {
1688
- return r("g", { key: `node-block_${o}`, staticClass: "lume-alluvial-group__node", class: {
1689
- "lume-alluvial-group__node--faded": n.isNodeFaded(a.node.id)
1690
- }, attrs: { "data-j-alluvial-group__node-block": "" } }, [r("g", { on: { click: function(u) {
1691
- return n.emit("node-click", { node: a.node, event: u });
1692
- }, mouseenter: function(u) {
1693
- return n.emit("node-mouseenter", { node: a.node, event: u });
1694
- }, mouseleave: function(u) {
1695
- return n.emit("node-mouseleave", { node: a.node, event: u });
1696
- }, mouseover: function(u) {
1697
- n.hoveredElement = a.node;
1698
- }, mouseout: function(u) {
1699
- n.hoveredElement = null;
1700
- } } }, [r("rect", { class: `lume-alluvial-group__node-block--${a.node.color || n.DEFAULT_COLOR}`, attrs: { x: a.x, y: a.y, height: a.height, width: a.width } }), r("text", { ref: "nodeTextRefs", refInFor: !0, staticClass: "lume-alluvial-group__node-text lume-typography--caption", class: {
1701
- "lume-alluvial-group__node-text--right": a.node.depth === 0
1702
- }, attrs: { transform: `translate(${a.textTransform.x},${a.textTransform.y})`, "data-id": a.node.id } }, [r("tspan", { staticClass: "lume-alluvial-group__node-title", domProps: { textContent: e._s(a.node.label) } }), r("tspan", { staticClass: "lume-alluvial-group__node-value", attrs: { x: "0", dy: "1.2em" }, domProps: { textContent: e._s(
1703
- n.formatValue(
1704
- a.node.transitionValue || a.node.value,
1705
- a.node.value
1706
- )
1707
- ) } })])])]);
1708
- })], 2);
1709
- }, Or = [], Tr = /* @__PURE__ */ D(
1710
- kr,
1711
- Ar,
1712
- Or,
1713
- !1,
1714
- null,
1715
- "806a6de2",
1716
- null,
1717
- null
1718
- );
1719
- const Lr = Tr.exports, xr = {
1720
- margins: {
1721
- top: 0,
1722
- right: 0,
1723
- bottom: 0,
1724
- left: 0
1725
- },
1726
- withAxes: !1,
1727
- withTooltip: !1,
1728
- withHover: !1,
1729
- withLegend: !1,
1730
- // Alluvial options
1731
- highlightedElements: "full",
1732
- nodePadding: 16,
1733
- nodeWidth: 16,
1734
- nodeAlign: Tt,
1735
- valueFormat: (t) => String(t)
1736
- }, wr = /* @__PURE__ */ I({
1737
- __name: "lume-alluvial-diagram",
1738
- props: {
1739
- ...X(
1740
- be,
1741
- !1,
1742
- !1
1743
- )
1744
- },
1745
- setup(t) {
1746
- const e = t, r = Z(V()), { options: n } = R(e), { allOptions: a } = G(n, xr);
1747
- function o(u) {
1748
- return {
1749
- ...u,
1750
- noBaseScales: !0
1751
- // Alluvial chart never uses base scales
1752
- };
1753
- }
1754
- return { __sfc: !0, props: e, slots: r, options: n, allOptions: a, getAlluvialDiagramOptions: o, LumeChart: K, LumeAlluvialGroup: Lr };
1755
- }
1756
- });
1757
- var $r = function() {
1758
- var e = this, r = e._self._c, n = e._self._setupProxy;
1759
- return r(n.LumeChart, e._b({ attrs: { options: n.getAlluvialDiagramOptions(n.allOptions), "data-j-alluvial-diagram": "" }, scopedSlots: e._u([{ key: "groups", fn: function(a) {
1760
- return [r(n.LumeAlluvialGroup, e._b({}, "lume-alluvial-group", a, !1))];
1761
- } }, e._l(n.slots, function(a, o) {
1762
- return { key: o, fn: function(u) {
1763
- return [e._t(o, null, null, u || {})];
1764
- } };
1765
- })], null, !0) }, "lume-chart", n.props, !1));
1766
- }, Ir = [], Dr = /* @__PURE__ */ D(
1767
- wr,
1768
- $r,
1769
- Ir,
1770
- !1,
1771
- null,
1772
- null,
1773
- null,
1774
- null
1775
- );
1776
- const Va = Dr.exports;
1777
- var ye = /* @__PURE__ */ ((t) => (t.grouped = "grouped", t.stacked = "stacked", t))(ye || {});
1778
- const Er = /* @__PURE__ */ I({
1779
- __name: "lume-bar-chart",
1780
- props: {
1781
- ...X(),
1782
- type: {
1783
- type: String,
1784
- default: null,
1785
- validator: (t) => t in ye || t == null
1786
- }
1787
- },
1788
- setup(t) {
1789
- const e = t, r = de(
1790
- () => import("./dcda0a87.js")
1791
- ), n = de(
1792
- () => import("./0170c38e.js")
1793
- ), a = de(
1794
- () => import("./e6a6f2b0.js")
1795
- ), o = /* @__PURE__ */ new Map([
1796
- ["single", r],
1797
- ["grouped", n],
1798
- ["stacked", a]
1799
- ]), u = Z(V());
1800
- function s(i) {
1801
- return {
1802
- ...i,
1803
- startOnZero: !0,
1804
- // Bar chart always starts on zero,
1805
- tooltipOptions: {
1806
- ...(i == null ? void 0 : i.tooltipOptions) || {},
1807
- position: e.orientation === T.HORIZONTAL && "right"
1808
- }
1809
- };
1810
- }
1811
- const l = c(() => {
1812
- if (e.data) {
1813
- if (be(e.data))
1814
- return o.get("single");
1815
- if (!e.type)
1816
- throw new Error("Bar chart needs a type when there's multiple datasets.");
1817
- return o.get(e.type);
1818
- }
1819
- });
1820
- return { __sfc: !0, TYPES: ye, LumeSingleBarChart: r, LumeGroupedBarChart: n, LumeStackedBarChart: a, COMPONENT_MAP: o, props: e, slots: u, getBarChartOptions: s, component: l };
1821
- }
1822
- });
1823
- var Cr = function() {
1824
- var e = this, r = e._self._c, n = e._self._setupProxy;
1825
- return r(n.component, e._b({ tag: "component", attrs: { options: n.getBarChartOptions(e.options) }, scopedSlots: e._u([e._l(n.slots, function(a, o) {
1826
- return { key: o, fn: function(u) {
1827
- return [e._t(o, null, null, u || {})];
1828
- } };
1829
- })], null, !0) }, "component", { ...n.props, ...e.$attrs }, !1));
1830
- }, Rr = [], Nr = /* @__PURE__ */ D(
1831
- Er,
1832
- Cr,
1833
- Rr,
1834
- !1,
1835
- null,
1836
- null,
1837
- null,
1838
- null
1839
- );
1840
- const Fa = Nr.exports;
1841
- function Br(t) {
1842
- return Object.values(Zt).includes(t) || t == null;
1843
- }
1844
- function Hr(t) {
1845
- return Object.values(T).includes(t);
1846
- }
1847
- const Pr = (t = !1) => ({
1848
- type: {
1849
- type: String,
1850
- default: null,
1851
- validator: Br
1852
- },
1853
- ...t ? {
1854
- orientation: {
1855
- type: String,
1856
- default: T.VERTICAL,
1857
- validator: Hr
1858
- }
1859
- } : {}
1860
- });
1861
- function it(t) {
1862
- const e = c(() => t.value.map((n) => ({
1863
- ...n,
1864
- values: n.values.map((a) => ({
1865
- ...a,
1866
- value: (a == null ? void 0 : a.value) || 0
1867
- }))
1868
- }))), r = c(() => {
1869
- var n;
1870
- return (n = e.value) == null ? void 0 : n.reduce((a, o) => (o.values.forEach((u, s) => {
1871
- a[s] ? a[s].push(u) : a[s] = [u];
1872
- }), a), []);
1873
- });
1874
- return { multiBarData: e, groupedData: r };
1875
- }
1876
- function Sr(t, e) {
1877
- return t.value.length === 1 ? "single" : e.value;
1878
- }
1879
- function Gr(t, e, r, n) {
1880
- const a = c(
1881
- () => n.value === T.HORIZONTAL
1882
- );
1883
- function o(l) {
1884
- Math.min(...l.domain()) > 0 && console.error("Bar linear scale domain cannot start above 0!");
1885
- }
1886
- const u = c(() => {
1887
- const { padding: l, paddingInner: i, paddingOuter: v } = r.value;
1888
- return a.value ? (() => (o(t.value), t.value))() : ne(
1889
- t.value,
1890
- n.value,
1891
- { padding: l, paddingInner: i, paddingOuter: v }
1892
- );
1893
- }), s = c(() => {
1894
- const { padding: l, paddingInner: i, paddingOuter: v } = r.value;
1895
- return a.value ? ne(
1896
- e.value,
1897
- n.value,
1898
- { padding: l, paddingInner: i, paddingOuter: v }
1899
- ) : (() => (o(e.value), e.value))();
1900
- });
1901
- return { barXScale: u, barYScale: s };
1902
- }
1903
- function jr(t, e, r, n, a, o) {
1904
- const u = c(
1905
- () => n.value === T.HORIZONTAL
1906
- );
1907
- function s(d, f) {
1908
- let h, _;
1909
- return u.value ? (h = d >= 0 ? e.value(0) : e.value(d), _ = r.value(r.value.domain()[f])) : (h = e.value(e.value.domain()[f]), _ = d < 0 ? r.value(0) : r.value(d)), { x: h, y: _ };
1910
- }
1911
- function l(d) {
1912
- return u.value ? d < 0 ? e.value(0) - e.value(d) : e.value(d) - e.value(0) : e.value.bandwidth();
1913
- }
1914
- function i(d) {
1915
- return u.value ? r.value.bandwidth() : d < 0 ? r.value(d) - r.value(0) : r.value(0) - r.value(d);
1916
- }
1917
- function v(d, f, h) {
1918
- const { value: _, color: p } = d, b = p ?? t.value[f].color ?? ie, { x: m, y: g } = s(_, h), O = l(_), L = i(_);
1919
- return {
1920
- classList: [`lume-fill--${b}`, ...o],
1921
- x: m,
1922
- y: g,
1923
- width: O,
1924
- height: L,
1925
- isFaded: a.value !== -1 && a.value !== h,
1926
- isNegative: _ < 0
1927
- };
1928
- }
1929
- return { barAttributeGenerator: v };
1930
- }
1931
- function Vr(t, e, r, n, a, o) {
1932
- const u = c(
1933
- () => n.value === T.HORIZONTAL
1934
- ), s = c(() => J().domain(t.value.map((_, p) => p)).range([0, e.value.bandwidth()]).padding(0)), l = c(() => J().domain(t.value.map((_, p) => p)).range([0, r.value.bandwidth()]).padding(0));
1935
- function i(_, p, b) {
1936
- if (u.value)
1937
- return _ >= 0 ? e.value(0) : e.value(_);
1938
- const m = e.value.domain();
1939
- return e.value(m[p]) + s.value(b);
1940
- }
1941
- function v(_, p, b) {
1942
- if (u.value) {
1943
- const m = r.value.domain();
1944
- return r.value(m[p]) + l.value(b);
1945
- }
1946
- return _ < 0 ? r.value(0) : r.value(_);
1947
- }
1948
- function d(_) {
1949
- return u.value ? _ < 0 ? e.value(0) - e.value(_) : e.value(_) - e.value(0) : s.value.bandwidth();
1950
- }
1951
- function f(_) {
1952
- return u.value ? l.value.bandwidth() : _ < 0 ? r.value(_) - r.value(0) : r.value(0) - r.value(_);
1953
- }
1954
- function h(_, p, b) {
1955
- const { value: m, color: g } = _, O = g ?? t.value[p].color ?? Object.values(P)[p], L = i(m, b, p), y = v(m, b, p), k = d(m), $ = f(m);
1956
- return {
1957
- classList: [`lume-fill--${O}`, ...o],
1958
- x: L,
1959
- y,
1960
- width: k,
1961
- height: $,
1962
- isFaded: a.value !== -1 && a.value !== b,
1963
- isNegative: m < 0
1964
- };
1965
- }
1966
- return { barAttributeGenerator: h };
1967
- }
1968
- function Fr(t, e) {
1969
- const r = c(
1970
- () => e.value === T.HORIZONTAL
1971
- ), n = c(() => {
1972
- const s = t.value.map(
1973
- (l) => l.filter((i) => i.value < 0).reduce((i, v) => i + v.value, 0)
1974
- );
1975
- return Math.min(...s);
1976
- }), a = c(() => {
1977
- const s = t.value.map(
1978
- (l) => l.reduce(
1979
- (i, v) => v.value >= 0 ? i + v.value : i,
1980
- 0
1981
- )
1982
- );
1983
- return Math.max(...s);
1984
- });
1985
- function o(s, l, i) {
1986
- return r.value ? Q().domain([n.value, a.value]).range([0, i.width]) : Object.assign(
1987
- ne(
1988
- J().domain(l.map((v, d) => d)).range([0, i.width])
1989
- ),
1990
- { labels: l }
1991
- );
1992
- }
1993
- function u(s, l, i) {
1994
- return r.value ? Object.assign(
1995
- ne(
1996
- J().domain(l.map((v, d) => d)).range([0, i.height])
1997
- ),
1998
- { labels: l }
1999
- ) : Q().domain([a.value, n.value]).range([0, i.height]);
2000
- }
2001
- return { stackedXScaleGenerator: o, stackedYScaleGenerator: u };
2002
- }
2003
- function Mr(t, e, r, n, a, o) {
2004
- const u = c(
2005
- () => n.value === T.HORIZONTAL
2006
- ), s = c(
2007
- () => u.value ? r.value.domain() : e.value.domain()
2008
- ), l = c(
2009
- () => t.value.map((m) => m.values.map((g) => g == null ? void 0 : g.value))
2010
- );
2011
- function i(m, g, O) {
2012
- let L, y;
2013
- return u.value ? (L = e.value(m >= 0 ? 0 + O : m + O), y = r.value(s.value[g])) : (L = e.value(s.value[g]), y = r.value(m >= 0 ? m + O : 0 + O)), { x: L, y };
2014
- }
2015
- function v(m) {
2016
- return u.value ? e.value(m) - e.value(0) : e.value.bandwidth();
2017
- }
2018
- function d(m) {
2019
- return u.value ? e.value(0) - e.value(m) : e.value.bandwidth();
2020
- }
2021
- function f(m) {
2022
- return u.value ? r.value.bandwidth() : r.value(0) - r.value(m);
2023
- }
2024
- function h(m) {
2025
- return u.value ? r.value.bandwidth() : r.value(m) - r.value(0);
2026
- }
2027
- function _(m, g) {
2028
- return m ? l.value.reduce((O, L, y) => (y < m && L[g] >= 0 && (O += L[g]), O), 0) : 0;
2029
- }
2030
- function p(m, g) {
2031
- return m ? l.value.reduce((O, L, y) => (y < m && L[g] < 0 && (O += L[g]), O), 0) : 0;
2032
- }
2033
- function b(m, g, O) {
2034
- const { value: L, color: y } = m, k = L >= 0 ? v(L) : d(L), $ = L >= 0 ? f(L) : h(L), E = L >= 0 ? _(g, O) : p(g, O), { x: H, y: Y } = i(L, O, E);
2035
- return {
2036
- classList: [`lume-fill--${y ?? t.value[g].color ?? Object.values(P)[g]}`, ...o],
2037
- width: k,
2038
- height: $,
2039
- x: H,
2040
- y: Y,
2041
- isFaded: a.value !== -1 && a.value !== O,
2042
- isNegative: L < 0
2043
- };
2044
- }
2045
- return { barAttributeGenerator: b };
2046
- }
2047
- const Ve = {
2048
- single: jr,
2049
- grouped: Vr,
2050
- stacked: Mr
2051
- }, zr = /* @__PURE__ */ I({
2052
- __name: "lume-bar-group",
2053
- props: {
2054
- ...se(),
2055
- classList: {
2056
- type: [String, Array],
2057
- default: () => []
2058
- },
2059
- ...Pr(!0),
2060
- transition: {
2061
- type: Boolean,
2062
- default: !0
2063
- }
2064
- },
2065
- emits: ["bar-click", "lume__internal--hover"],
2066
- setup(t, { emit: e }) {
2067
- const r = t, {
2068
- data: n,
2069
- hoveredIndex: a,
2070
- options: o,
2071
- orientation: u,
2072
- transition: s,
2073
- type: l,
2074
- xScale: i,
2075
- yScale: v,
2076
- classList: d
2077
- } = R(r), { groupedData: f } = it(n), { barXScale: h, barYScale: _ } = Gr(
2078
- i,
2079
- v,
2080
- o,
2081
- u
2082
- ), p = c(() => typeof d.value == "string" ? [d.value] : d.value), b = c(() => {
2083
- const g = Sr(n, l), { barAttributeGenerator: O } = Ve[g](
2084
- n,
2085
- h,
2086
- _,
2087
- u,
2088
- a,
2089
- p.value
2090
- );
2091
- return O;
2092
- }), m = c(() => {
2093
- if (s.value)
2094
- return u.value === T.HORIZONTAL ? "width" : "height";
2095
- });
2096
- return { __sfc: !0, MIXIN_MAP: Ve, props: r, emit: e, data: n, hoveredIndex: a, options: o, orientation: u, transition: s, type: l, xScale: i, yScale: v, classList: d, groupedData: f, barXScale: h, barYScale: _, computedClasses: p, getBarAttributes: b, computedTransition: m, LumeBar: Te };
2097
- }
2098
- });
2099
- var Wr = function() {
2100
- var e = this, r = e._self._c, n = e._self._setupProxy;
2101
- return r("g", { staticClass: "lume-bar-group", attrs: { "data-j-bars-group": "" } }, e._l(n.groupedData, function(a, o) {
2102
- return r("g", { key: o, on: { mouseenter: function(u) {
2103
- return n.emit("lume__internal--hover", o);
2104
- } } }, e._l(a, function(u, s) {
2105
- return r(n.LumeBar, e._b({ key: `bar-${s}`, attrs: { transition: n.computedTransition, "data-j-lume-bar": "" }, on: { click: function(l) {
2106
- return n.emit("bar-click", {
2107
- index: o,
2108
- datasetIndex: s,
2109
- event: l
2110
- });
2111
- } } }, "lume-bar", n.getBarAttributes(u, s, o, a), !1));
2112
- }), 1);
2113
- }), 0);
2114
- }, Zr = [], Xr = /* @__PURE__ */ D(
2115
- zr,
2116
- Wr,
2117
- Zr,
2118
- !1,
2119
- null,
2120
- null,
2121
- null,
2122
- null
2123
- );
2124
- const xe = Xr.exports, Yr = {
2125
- [T.VERTICAL]: {
2126
- withTooltip: !0,
2127
- xAxisOptions: {},
2128
- yAxisOptions: { gridLines: !0 },
2129
- margins: z.VERTICAL
2130
- },
2131
- [T.HORIZONTAL]: {
2132
- withTooltip: !0,
2133
- xAxisOptions: { gridLines: !0 },
2134
- yAxisOptions: { gridLines: !1 },
2135
- margins: z.HORIZONTAL
2136
- }
2137
- }, Ur = /* @__PURE__ */ I({
2138
- __name: "lume-single-bar-chart",
2139
- props: {
2140
- ...X(be)
2141
- },
2142
- setup(t) {
2143
- const e = t, r = Z(V()), { orientation: n, options: a } = R(e), o = c(
2144
- () => Yr[n.value || T.VERTICAL]
2145
- // needs to be computed so that default options are reactive
2146
- ), { allOptions: u } = G(a, o);
2147
- return { __sfc: !0, props: e, slots: r, orientation: n, options: a, baseOptions: o, allOptions: u, LumeChart: K, LumeBarGroup: xe };
2148
- }
2149
- });
2150
- var Kr = function() {
2151
- var e = this, r = e._self._c, n = e._self._setupProxy;
2152
- return r(n.LumeChart, e._b({ attrs: { "chart-type": "single-bar", options: n.allOptions, "data-j-single-bar-chart": "" }, scopedSlots: e._u([{ key: "groups", fn: function(a) {
2153
- return [r(n.LumeBarGroup, e._b({ attrs: { orientation: n.orientation } }, "lume-bar-group", a, !1))];
2154
- } }, e._l(n.slots, function(a, o) {
2155
- return { key: o, fn: function(u) {
2156
- return [e._t(o, null, null, u || {})];
2157
- } };
2158
- })], null, !0) }, "lume-chart", n.props, !1));
2159
- }, Jr = [], Qr = /* @__PURE__ */ D(
2160
- Ur,
2161
- Kr,
2162
- Jr,
2163
- !1,
2164
- null,
2165
- null,
2166
- null,
2167
- null
2168
- );
2169
- const Ma = Qr.exports, qr = {
2170
- [T.VERTICAL]: {
2171
- withTooltip: !0,
2172
- xAxisOptions: {},
2173
- yAxisOptions: { gridLines: !0 },
2174
- margins: z.VERTICAL
2175
- },
2176
- [T.HORIZONTAL]: {
2177
- withTooltip: !0,
2178
- xAxisOptions: { gridLines: !0 },
2179
- yAxisOptions: { gridLines: !1 },
2180
- margins: z.HORIZONTAL,
2181
- tooltipOptions: { position: "right" }
2182
- }
2183
- }, ea = /* @__PURE__ */ I({
2184
- __name: "lume-grouped-bar-chart",
2185
- props: {
2186
- ...X()
2187
- },
2188
- setup(t) {
2189
- const e = t, r = Z(V()), { orientation: n, options: a } = R(e), o = c(
2190
- () => qr[n.value || T.VERTICAL]
2191
- // needs to be computed so that default options are reactive
2192
- ), { allOptions: u } = G(a, o);
2193
- return { __sfc: !0, props: e, slots: r, orientation: n, options: a, baseOptions: o, allOptions: u, LumeChart: K, LumeBarGroup: xe };
2194
- }
2195
- });
2196
- var ta = function() {
2197
- var e = this, r = e._self._c, n = e._self._setupProxy;
2198
- return r(n.LumeChart, e._b({ attrs: { "chart-type": "grouped-bar", options: n.allOptions, "data-j-grouped-bar-chart": "" }, scopedSlots: e._u([{ key: "groups", fn: function(a) {
2199
- return [r(n.LumeBarGroup, e._b({ attrs: { type: "grouped" } }, "lume-bar-group", a, !1))];
2200
- } }, e._l(n.slots, function(a, o) {
2201
- return { key: o, fn: function(u) {
2202
- return [e._t(o, null, null, u || {})];
2203
- } };
2204
- })], null, !0) }, "lume-chart", n.props, !1));
2205
- }, na = [], ra = /* @__PURE__ */ D(
2206
- ea,
2207
- ta,
2208
- na,
2209
- !1,
2210
- null,
2211
- null,
2212
- null,
2213
- null
2214
- );
2215
- const za = ra.exports, aa = {
2216
- [T.VERTICAL]: {
2217
- withTooltip: !0,
2218
- xAxisOptions: {},
2219
- yAxisOptions: { gridLines: !0 },
2220
- margins: z.VERTICAL
2221
- },
2222
- [T.HORIZONTAL]: {
2223
- withTooltip: !0,
2224
- xAxisOptions: { gridLines: !0 },
2225
- yAxisOptions: { gridLines: !1 },
2226
- margins: z.HORIZONTAL,
2227
- tooltipOptions: { position: "right" }
2228
- }
2229
- }, oa = /* @__PURE__ */ I({
2230
- __name: "lume-stacked-bar-chart",
2231
- props: {
2232
- ...X()
2233
- },
2234
- setup(t) {
2235
- const e = t, r = Z(V()), { data: n, orientation: a, options: o } = R(e), u = c(
2236
- () => aa[a.value || T.VERTICAL]
2237
- // needs to be computed so that default options are reactive
2238
- ), { allOptions: s } = G(o, u), { internalData: l } = Le(n), { groupedData: i } = it(l), { stackedXScaleGenerator: v, stackedYScaleGenerator: d } = Fr(
2239
- i,
2240
- a
2241
- );
2242
- return { __sfc: !0, props: e, slots: r, data: n, orientation: a, options: o, baseOptions: u, allOptions: s, internalData: l, groupedData: i, stackedXScaleGenerator: v, stackedYScaleGenerator: d, LumeChart: K, LumeBarGroup: xe };
2243
- }
2244
- });
2245
- var ua = function() {
2246
- var e = this, r = e._self._c, n = e._self._setupProxy;
2247
- return r(n.LumeChart, e._b({ attrs: { "chart-type": "stacked-bar", options: n.allOptions, "x-scale": n.stackedXScaleGenerator, "y-scale": n.stackedYScaleGenerator, "data-j-stacked-bar-chart": "" }, scopedSlots: e._u([{ key: "groups", fn: function(a) {
2248
- return [r(n.LumeBarGroup, e._b({ attrs: { type: "stacked" } }, "lume-bar-group", a, !1))];
2249
- } }, e._l(n.slots, function(a, o) {
2250
- return { key: o, fn: function(u) {
2251
- return [e._t(o, null, null, u || {})];
2252
- } };
2253
- })], null, !0) }, "lume-chart", n.props, !1));
2254
- }, la = [], ia = /* @__PURE__ */ D(
2255
- oa,
2256
- ua,
2257
- la,
2258
- !1,
2259
- null,
2260
- null,
2261
- null,
2262
- null
2263
- );
2264
- const Wa = ia.exports, Fe = 2, sa = /* @__PURE__ */ I({
2265
- __name: "lume-line",
2266
- props: {
2267
- pathDefinition: {
2268
- type: String,
2269
- required: !0
2270
- },
2271
- width: {
2272
- type: Number,
2273
- default: Fe
2274
- },
2275
- color: {
2276
- type: String,
2277
- default: P.Skyblue
2278
- },
2279
- dashed: {
2280
- type: Boolean,
2281
- default: !1
2282
- },
2283
- transition: {
2284
- type: Boolean,
2285
- default: !0
2286
- },
2287
- animationDelay: {
2288
- type: Number,
2289
- default: 0
2290
- },
2291
- animationDuration: {
2292
- type: Number,
2293
- default: 0.2
2294
- }
2295
- },
2296
- emits: ["click"],
2297
- setup(t, { emit: e }) {
2298
- const r = x(null);
2299
- return j(() => le(r.value)), { __sfc: !0, DEFAULT_LINE_WIDTH: Fe, emit: e, root: r };
2300
- }
2301
- });
2302
- var ca = function() {
2303
- var e = this, r = e._self._c, n = e._self._setupProxy;
2304
- return r("path", { ref: "root", staticClass: "lume-line", class: {
2305
- [`lume-stroke--${e.color}`]: !0,
2306
- "lume-line--dashed": e.dashed,
2307
- "lume-line--transition": e.transition
2308
- }, style: {
2309
- animationDelay: e.transition && e.animationDelay + "s",
2310
- animationDuration: e.transition && e.animationDuration + "s"
2311
- }, attrs: { d: e.pathDefinition, "stroke-width": e.width, "data-j-line": "" }, on: { click: function(a) {
2312
- return n.emit("click", a);
2313
- } } });
2314
- }, da = [], va = /* @__PURE__ */ D(
2315
- sa,
2316
- ca,
2317
- da,
2318
- !1,
2319
- null,
2320
- "08896455",
2321
- null,
2322
- null
2323
- );
2324
- const _a = va.exports, Me = 4, pa = /* @__PURE__ */ I({
2325
- __name: "lume-point",
2326
- props: {
2327
- x: { type: Number, required: !0 },
2328
- y: { type: Number, required: !0 },
2329
- color: {
2330
- type: String,
2331
- default: P.Skyblue
2332
- },
2333
- radius: {
2334
- type: Number,
2335
- default: Me
2336
- },
2337
- active: {
2338
- type: Boolean,
2339
- default: !1
2340
- }
2341
- },
2342
- emits: ["click"],
2343
- setup(t, { emit: e }) {
2344
- const r = t, n = x(null), a = c(() => r.radius / 2);
2345
- return j(() => le(n.value)), { __sfc: !0, DEFAULT_RADIUS: Me, props: r, emit: e, root: n, strokeWidth: a };
2346
- }
2347
- });
2348
- var fa = function() {
2349
- var e = this, r = e._self._c, n = e._self._setupProxy;
2350
- return r("circle", { ref: "root", staticClass: "lume-point", class: `lume-stroke--${e.color}`, attrs: { cx: e.x, cy: e.y, r: e.active ? e.radius : 0, "stroke-width": n.strokeWidth, "data-j-point": "" }, on: { click: function(a) {
2351
- return n.emit("click", a);
2352
- } } });
2353
- }, ma = [], ha = /* @__PURE__ */ D(
2354
- pa,
2355
- fa,
2356
- ma,
2357
- !1,
2358
- null,
2359
- "9bacbd7d",
2360
- null,
2361
- null
2362
- );
2363
- const ga = ha.exports;
2364
- function st(t) {
2365
- function e(o) {
2366
- let u = null;
2367
- return o == null ? void 0 : o.reduce((s, l, i) => (l == null || l.value == null ? (u ? u.push(i) : u = [i], i === (o == null ? void 0 : o.length) - 1 && s.push(u)) : u && (s.push(u), u = null), s), []);
2368
- }
2369
- function r(o, u, s, l) {
2370
- const d = Math.abs(o - u) / (s + 1) * (l + 1);
2371
- return o > u ? o - d : o + d;
2372
- }
2373
- function n(o) {
2374
- return function(s) {
2375
- return !!o.find(
2376
- (l) => l.includes(s) || l.includes(s - 1)
2377
- );
2378
- };
2379
- }
2380
- return { computedLineData: c(() => t.value.map((o) => {
2381
- const u = e(o.values);
2382
- return {
2383
- ...o,
2384
- isDashed: n(u),
2385
- values: o.values.map((s, l) => {
2386
- var v, d;
2387
- const i = u.find(
2388
- (f) => f.includes(l)
2389
- );
2390
- if (i) {
2391
- const f = i[0] - 1, h = i[i.length - 1] + 1;
2392
- let _ = (v = o.values[f]) == null ? void 0 : v.value, p = (d = o.values[h]) == null ? void 0 : d.value;
2393
- return _ == null && (_ = p), p == null && (p = _), {
2394
- value: r(
2395
- _,
2396
- p,
2397
- i.length,
2398
- i.indexOf(l)
2399
- ),
2400
- label: qe
2401
- };
2402
- }
2403
- return s;
2404
- })
2405
- };
2406
- })) };
2407
- }
2408
- function ya(t, e) {
2409
- const r = ke(t) / 2;
2410
- return (n, a) => t(t.domain()[e + (a - 1)]) + r;
2411
- }
2412
- function ba(t, e) {
2413
- return (r, n) => t(e + (n - 1));
2414
- }
2415
- function ka(t, e, r, n) {
2416
- return wt().x(
2417
- W(r) ? ya(r, t) : ba(r, t)
2418
- ).y((o) => n(o))(e);
2419
- }
2420
- const ze = 1, Aa = /* @__PURE__ */ I({
2421
- __name: "lume-line-group",
2422
- props: {
2423
- ...se(),
2424
- withPoints: {
2425
- type: Boolean,
2426
- default: !0
2427
- },
2428
- transition: {
2429
- type: Boolean,
2430
- default: !0
2431
- }
2432
- },
2433
- emits: ["line-click", "point-click", "lume__internal--hover"],
2434
- setup(t, { emit: e }) {
2435
- const r = t, { data: n, options: a, xScale: o, yScale: u } = R(r), s = kt(
2436
- "tooltipAnchorAttributes",
2437
- null
2438
- ), { updateTooltipAnchorAttributes: l } = ot(
2439
- s,
2440
- a,
2441
- o,
2442
- u
2443
- ), i = c(() => {
2444
- if (n.value.every((k) => k.isDashed))
2445
- return n.value;
2446
- const { computedLineData: y } = st(n);
2447
- return a.value.withTooltip !== !1 && (s != null && s.value) && l(y.value), y.value;
2448
- }), v = c(() => {
2449
- if (r.hoveredIndex === -1)
2450
- return;
2451
- const y = St(
2452
- i.value,
2453
- r.hoveredIndex
2454
- );
2455
- return {
2456
- d: `M ${me(o.value, r.hoveredIndex)},${u.value.range()[1]}
2457
- V ${u.value(y)}`
2458
- // Move to X index, Vertical line to the highest point
2459
- };
2460
- }), d = c(
2461
- () => o.value && ze / (Gt(o.value) - 1)
2462
- // Subtracting the first line (read below)
2463
- ), f = c(
2464
- () => {
2465
- var y;
2466
- return ((y = a.value) == null ? void 0 : y.lineWidth) * 2 || void 0;
2467
- }
2468
- // If no `lineWidth`, returns NaN which needs to be undefined
2469
- ), h = c(() => ke(o.value) / 2), _ = c(() => o.value.domain()), p = c(
2470
- () => a.value.withPoints ?? r.withPoints
2471
- );
2472
- function b(y) {
2473
- return i.value[y].values;
2474
- }
2475
- function m(y, k) {
2476
- var E, H;
2477
- const $ = y === 0 ? [] : [
2478
- (E = b(k)[y - 1]) == null ? void 0 : E.value,
2479
- (H = b(k)[y]) == null ? void 0 : H.value
2480
- ];
2481
- return ka(
2482
- y,
2483
- $,
2484
- o.value,
2485
- u.value
2486
- ) || "";
2487
- }
2488
- function g(y) {
2489
- return {
2490
- animationDelay: y < 2 ? 0 : (y - 1) * d.value,
2491
- animationDuration: d.value
2492
- };
2493
- }
2494
- function O(y, k) {
2495
- var E;
2496
- const $ = (E = b(k)[y]) == null ? void 0 : E.value;
2497
- return {
2498
- x: W(o.value) ? r.xScale(_.value[y]) + h.value : r.xScale(y),
2499
- y: u.value($)
2500
- };
2501
- }
2502
- function L(y) {
2503
- return r.hoveredIndex === y;
2504
- }
2505
- return { __sfc: !0, LUME_TRANSITION_TIME_FULL: ze, props: r, emit: e, data: n, options: a, xScale: o, yScale: u, tooltipAnchorAttributes: s, updateTooltipAnchorAttributes: l, computedGroupData: i, overlayLineAttributes: v, animationDuration: d, pointRadius: f, xAxisOffset: h, domain: _, computedWithPoints: p, getValuesFromDataset: b, getPathDefinition: m, getLineTransitionParams: g, getPointPosition: O, isPointActive: L, LumeLine: _a, LumePoint: ga };
2506
- }
2507
- });
2508
- var Oa = function() {
2509
- var e = this, r = e._self._c, n = e._self._setupProxy;
2510
- return r("g", { staticClass: "lume-line-group", attrs: { "data-j-lume-line-group": "" } }, [r("path", e._b({ staticClass: "lume-line-group__overlay-line", attrs: { "data-j-lume-line-group__overlay-line": "" } }, "path", n.overlayLineAttributes, !1)), e._l(n.computedGroupData, function(a, o) {
2511
- return r("g", { key: a.label, staticClass: "lume-line-group__group" }, [r("g", { staticClass: "lume-line-group__lines" }, e._l(a.values, function(u, s) {
2512
- return r(n.LumeLine, e._b({ key: `line-${s}`, attrs: { color: a.color, dashed: a.isDashed(s), "path-definition": n.getPathDefinition(s, o), transition: e.transition, width: n.options.lineWidth }, on: { click: function(l) {
2513
- return n.emit("line-click", { index: s, datasetIndex: o, event: l });
2514
- } } }, "lume-line", n.getLineTransitionParams(s), !1));
2515
- }), 1), n.computedWithPoints ? r("g", { staticClass: "lume-line-group__points", attrs: { "data-j-lume-line-group__points": "" } }, e._l(a.values, function(u, s) {
2516
- return r(n.LumePoint, e._b({ key: `point-${s}`, attrs: { active: n.isPointActive(s), color: a.color, index: s, radius: n.pointRadius }, on: { click: function(l) {
2517
- return n.emit("point-click", { index: s, datasetIndex: o, event: l });
2518
- } } }, "lume-point", n.getPointPosition(s, o), !1));
2519
- }), 1) : e._e()]);
2520
- })], 2);
2521
- }, Ta = [], La = /* @__PURE__ */ D(
2522
- Aa,
2523
- Oa,
2524
- Ta,
2525
- !1,
2526
- null,
2527
- "299f46e4",
2528
- null,
2529
- null
2530
- );
2531
- const ct = La.exports, xa = {
2532
- margins: z.VERTICAL,
2533
- startOnZero: !0,
2534
- withTooltip: !0,
2535
- xAxisOptions: {},
2536
- yAxisOptions: { gridLines: !0 }
2537
- }, wa = /* @__PURE__ */ I({
2538
- __name: "lume-line-chart",
2539
- props: {
2540
- ...X(null, !1)
2541
- },
2542
- setup(t) {
2543
- const e = t, r = Z(V()), { options: n } = R(e), { allOptions: a } = G(n, xa);
2544
- return { __sfc: !0, props: e, slots: r, options: n, allOptions: a, LumeChart: K, LumeLineGroup: ct };
2545
- }
2546
- });
2547
- var $a = function() {
2548
- var e = this, r = e._self._c, n = e._self._setupProxy;
2549
- return r(n.LumeChart, e._b({ attrs: { "chart-type": "line", options: n.allOptions, "data-j-lume-line-chart": "" }, scopedSlots: e._u([{ key: "groups", fn: function(a) {
2550
- return [r(n.LumeLineGroup, e._b({}, "lume-line-group", a, !1))];
2551
- } }, e._l(n.slots, function(a, o) {
2552
- return { key: o, fn: function(u) {
2553
- return [e._t(o, null, null, u || {})];
2554
- } };
2555
- })], null, !0) }, "lume-chart", n.props, !1));
2556
- }, Ia = [], Da = /* @__PURE__ */ D(
2557
- wa,
2558
- $a,
2559
- Ia,
2560
- !1,
2561
- null,
2562
- null,
2563
- null,
2564
- null
2565
- );
2566
- const Za = Da.exports;
2567
- function Ea(t) {
2568
- return { areaPathDefinition: c(
2569
- () => function(r, n) {
2570
- if (!r || !n)
2571
- return;
2572
- const a = t.value[0].values;
2573
- return $t().x((o, u) => r(u)).y0(n(Math.min(...n.domain()))).y1((o) => n(o.value))(a);
2574
- }
2575
- ) };
2576
- }
2577
- const Ca = {
2578
- margins: {
2579
- top: 0,
2580
- right: 0,
2581
- bottom: 0,
2582
- left: 0
2583
- },
2584
- withAxes: !1,
2585
- showArea: !0,
2586
- startOnZero: !0,
2587
- withLegend: !1,
2588
- tooltipOptions: {
2589
- showTitle: !1
2590
- }
2591
- }, Ra = /* @__PURE__ */ I({
2592
- __name: "lume-sparkline-chart",
2593
- props: {
2594
- ...rt(null),
2595
- ...ue()
2596
- },
2597
- setup(t, { expose: e }) {
2598
- const r = t, n = Z(V()), { data: a, options: o } = R(r), { internalData: u } = Le(a), { allOptions: s } = G(o, Ca), { computedLineData: l } = st(u), { areaPathDefinition: i } = Ea(l), v = c(() => u.value[0].color), d = c(
2599
- () => a.value[0].areaColor || v.value
2600
- );
2601
- function f(_) {
2602
- return {
2603
- ..._,
2604
- noMinSize: !0
2605
- };
2606
- }
2607
- function h(_, p, b) {
2608
- return Q().range([0, b.width]).domain([0, _[0].values.length - 1]);
2609
- }
2610
- return e({
2611
- areaPathDefinition: i
2612
- }), { __sfc: !0, props: r, slots: n, data: a, options: o, internalData: u, allOptions: s, computedLineData: l, areaPathDefinition: i, computedColor: v, areaColor: d, getSparklineOptions: f, xScaleGenerator: h, LumeChart: K, LumeLineGroup: ct };
2613
- }
2614
- });
2615
- var Na = function() {
2616
- var e = this, r = e._self._c, n = e._self._setupProxy;
2617
- return r(n.LumeChart, e._b({ attrs: { "chart-type": "line", options: n.getSparklineOptions(n.allOptions), "x-scale": n.xScaleGenerator }, scopedSlots: e._u([{ key: "groups", fn: function(a) {
2618
- return [n.allOptions.showArea ? r("path", { class: [
2619
- "sparkline-chart__area",
2620
- `lume-fill--${n.areaColor || n.computedColor}`,
2621
- "lume-fill--faded"
2622
- ], attrs: { d: n.areaPathDefinition(a.xScale, a.yScale), "data-j-sparkline__area": "" } }) : e._e(), r(n.LumeLineGroup, e._b({ attrs: { "with-points": !1 } }, "lume-line-group", a, !1))];
2623
- } }, e._l(n.slots, function(a, o) {
2624
- return { key: o, fn: function(u) {
2625
- return [e._t(o, null, null, u || {})];
2626
- } };
2627
- })], null, !0) }, "lume-chart", n.props, !1));
2628
- }, Ba = [], Ha = /* @__PURE__ */ D(
2629
- Ra,
2630
- Na,
2631
- Ba,
2632
- !1,
2633
- null,
2634
- "60a59b77",
2635
- null,
2636
- null
2637
- );
2638
- const Xa = Ha.exports;
2639
- export {
2640
- cn as L,
2641
- Fa as a,
2642
- Ma as b,
2643
- za as c,
2644
- Wa as d,
2645
- Za as e,
2646
- Xa as f,
2647
- K as g,
2648
- An as h,
2649
- wn as i,
2650
- Cn as j,
2651
- Te as k,
2652
- Va as l,
2653
- _a as m,
2654
- ga as n,
2655
- Lr as o,
2656
- xe as p,
2657
- ct as q,
2658
- Un as r
2659
- };
2660
- //# sourceMappingURL=fc36b37b.js.map