@adyen/lume 0.5.3 → 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,2661 +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: k } = Wt(n, i, p.value.skip), m = c(
512
- () => {
513
- var $;
514
- return `translate(0, ${h.value === "x" ? ($ = a.value) == null ? void 0 : $.height : 0})`;
515
- }
516
- ), g = c(() => {
517
- if (W(n.value))
518
- return n.value.labels || n.value.domain();
519
- const { tickCount: $ } = p.value, [C, S] = n.value.domain();
520
- return xt(C, S, $);
521
- }), O = c(() => {
522
- const { tickFormat: $ } = p.value;
523
- return te($);
524
- }), L = c(
525
- () => p.value.withHover && _.value && o.value > -1
526
- );
527
- function y($) {
528
- const { showTicks: C } = p.value;
529
- return C === !1 ? "" : O.value($);
530
- }
531
- function b($, C, S) {
532
- e("mouseenter", { index: _.value ? $ : null, value: C, event: S });
533
- }
534
- function w($, C, S) {
535
- e("click", { index: $, value: C, event: S });
536
- }
537
- function E($) {
538
- if (!(!i.value || !i.value.length))
539
- return i.value[$].ref;
540
- }
541
- function H() {
542
- d.value = g.value.map(
543
- ($, C) => ({
544
- value: y($),
545
- group: l.getTickGroupAttributes($, C),
546
- ghost: l.getTickGhostAttributes(E(C)),
547
- label: l.getTickLabelAttributes(),
548
- gridline: l.getGridLinesAttributes()
549
- })
550
- );
551
- }
552
- function Y() {
553
- const $ = n.value.step ? "bandScale" : "linearScale", C = an[`${h.value}-${pe[$]}`];
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: k, axisTransform: m, ticks: g, tickFormatter: O, isHovering: L, formatTick: y, handleTickMouseenter: b, handleTickClick: w, 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: k, shouldHaveMinHeight: m } = dn(n, a, o, u), g = c(() => k.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: k, 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 k() {
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
- }() : k());
881
- }
882
- return N(
883
- () => r.targetElement,
884
- (g, O) => {
885
- !O && g ? p() : m();
886
- }
887
- ), j(p), Ze(k), { __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: k, 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: k, computedLabels: m, containerSize: g, updateSize: O, chartID: L } = Le(o, u, s, p, i), { xScale: y, yScale: b } = zn(
1273
- k,
1274
- m,
1275
- g,
1276
- i,
1277
- p
1278
- ), w = c(() => {
1279
- var A;
1280
- return r.xScale ? He(r.xScale) ? r.xScale : (A = r.xScale) == null ? void 0 : A.call(r, k.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, k.value, u.value, g) : b.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
- })), $ = 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 && $.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(() => !!(w.value && E.value)), A.every((F) => F() === !0);
1305
- }), { hasNegativeValues: vt } = Kn(k), { negativeBarAttributes: _t } = Jn(
1306
- g,
1307
- w,
1308
- E,
1309
- i
1310
- ), { shouldGenerateTooltipAnchors: pt } = ot(
1311
- _,
1312
- p,
1313
- w,
1314
- E,
1315
- i,
1316
- k,
1317
- v
1318
- ), { tooltipConfig: we, showTooltip: $e, hideTooltip: Ie } = er(), { getTooltipItems: ft } = tr(k), 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: k, computedLabels: m, containerSize: g, updateSize: O, chartID: L, xScale: y, yScale: b, computedXScale: w, computedYScale: E, computedXAxisOptions: H, computedYAxisOptions: Y, xAxisTitle: $, 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((b, w) => {
1630
- const E = w.x + a.value.nodeWidth / 2;
1631
- return b.includes(E) ? b : [...b, E];
1632
- }, []).sort((b, w) => b - w)
1633
- // Make sure positions are sorted in ascending order
1634
- ), k = c(() => {
1635
- if (!(!a.value.nodeHeaders || !a.value.nodeHeaders.length))
1636
- return a.value.nodeHeaders.slice(0, p.value.length).map((b, w) => ({
1637
- label: b,
1638
- x: p.value[w]
1639
- }));
1640
- }), m = c(
1641
- () => a.value.nodeHeaderPadding ?? cr
1642
- );
1643
- function g(b) {
1644
- return _.value.length > 0 && !_.value.includes(b.toString());
1645
- }
1646
- function O(b) {
1647
- return f.value.links.length > 0 && !f.value.links.includes(b);
1648
- }
1649
- function L(b, w) {
1650
- b !== d.value && (d.value = b, e("link-mouseenter", { link: b, event: w }));
1651
- }
1652
- function y(b) {
1653
- const w = d.value;
1654
- d.value = null, e("link-mouseleave", { link: w, event: b });
1655
- }
1656
- return N(v, (b) => {
1657
- o.value = _r(b.nodes), u.value = pr(b.links).reverse();
1658
- }), N([r.containerSize, s], () => {
1659
- if (r.containerSize.width && r.containerSize.height) {
1660
- const b = vr(v.value, s.value);
1661
- i(b);
1662
- }
1663
- }), { __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: k, computedNodeHeaderPadding: m, isNodeFaded: g, isLinkFaded: O, handleLinkMouseover: L, handleLinkMouseleave: y, GHOST_STROKE_WIDTH_OFFSET: sr, DEFAULT_COLOR: ie };
1664
- }
1665
- });
1666
- var Ar = function() {
1667
- var e = this, r = e._self._c, n = e._self._setupProxy;
1668
- return r("g", { staticClass: "lume-alluvial-group", attrs: { "data-j-alluvial-group": "" } }, [n.nodeHeaders ? r("g", e._l(n.nodeHeaders, function(a) {
1669
- 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) + " ")]);
1670
- }), 0) : e._e(), r("g", { staticClass: "lume-alluvial-link-group", on: { mouseleave: n.handleLinkMouseleave } }, [e._l(n.linkPaths, function(a) {
1671
- return r("path", { key: `link-ghost_${a.id}`, staticClass: "lume-alluvial-group__link", class: [
1672
- "lume-stroke--transparent",
1673
- "lume-alluvial-group__link--ghost"
1674
- ], attrs: { d: a.d, "stroke-width": a.strokeWidth + n.GHOST_STROKE_WIDTH_OFFSET, "data-j-alluvial-ghost": "" }, on: { click: function(o) {
1675
- return n.emit("link-click", { link: a.link, event: o });
1676
- }, mouseover: function(o) {
1677
- return n.handleLinkMouseover(a.link, o);
1678
- } } });
1679
- }), e._l(n.linkPaths, function(a) {
1680
- return r("path", { key: `link_${a.id}`, staticClass: "lume-alluvial-group__link", class: {
1681
- [`lume-stroke--${a.color}`]: a.color,
1682
- "lume-alluvial-group__link--faded": n.isLinkFaded(a.id)
1683
- }, 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) {
1684
- return n.emit("link-click", { link: a.link, event: o });
1685
- }, mouseover: function(o) {
1686
- return n.handleLinkMouseover(a.link, o);
1687
- } } });
1688
- })], 2), e._l(n.nodeBlocks, function(a, o) {
1689
- return r("g", { key: `node-block_${o}`, staticClass: "lume-alluvial-group__node", class: {
1690
- "lume-alluvial-group__node--faded": n.isNodeFaded(a.node.id)
1691
- }, attrs: { "data-j-alluvial-group__node-block": "" } }, [r("g", { on: { click: function(u) {
1692
- return n.emit("node-click", { node: a.node, event: u });
1693
- }, mouseenter: function(u) {
1694
- return n.emit("node-mouseenter", { node: a.node, event: u });
1695
- }, mouseleave: function(u) {
1696
- return n.emit("node-mouseleave", { node: a.node, event: u });
1697
- }, mouseover: function(u) {
1698
- n.hoveredElement = a.node;
1699
- }, mouseout: function(u) {
1700
- n.hoveredElement = null;
1701
- } } }, [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: {
1702
- "lume-alluvial-group__node-text--right": a.node.depth === 0
1703
- }, 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(
1704
- n.formatValue(
1705
- a.node.transitionValue || a.node.value,
1706
- a.node.value
1707
- )
1708
- ) } })])])]);
1709
- })], 2);
1710
- }, Or = [], Tr = /* @__PURE__ */ D(
1711
- kr,
1712
- Ar,
1713
- Or,
1714
- !1,
1715
- null,
1716
- "759950af",
1717
- null,
1718
- null
1719
- );
1720
- const Lr = Tr.exports, xr = {
1721
- margins: {
1722
- top: 0,
1723
- right: 0,
1724
- bottom: 0,
1725
- left: 0
1726
- },
1727
- withAxes: !1,
1728
- withTooltip: !1,
1729
- withHover: !1,
1730
- withLegend: !1,
1731
- // Alluvial options
1732
- highlightedElements: "full",
1733
- nodePadding: 16,
1734
- nodeWidth: 16,
1735
- nodeAlign: Tt,
1736
- valueFormat: (t) => String(t)
1737
- }, wr = /* @__PURE__ */ I({
1738
- __name: "lume-alluvial-diagram",
1739
- props: {
1740
- ...X(
1741
- be,
1742
- !1,
1743
- !1
1744
- )
1745
- },
1746
- setup(t) {
1747
- const e = t, r = Z(V()), { options: n } = R(e), { allOptions: a } = G(n, xr);
1748
- function o(u) {
1749
- return {
1750
- ...u,
1751
- noBaseScales: !0
1752
- // Alluvial chart never uses base scales
1753
- };
1754
- }
1755
- return { __sfc: !0, props: e, slots: r, options: n, allOptions: a, getAlluvialDiagramOptions: o, LumeChart: K, LumeAlluvialGroup: Lr };
1756
- }
1757
- });
1758
- var $r = function() {
1759
- var e = this, r = e._self._c, n = e._self._setupProxy;
1760
- return r(n.LumeChart, e._b({ attrs: { options: n.getAlluvialDiagramOptions(n.allOptions), "data-j-alluvial-diagram": "" }, scopedSlots: e._u([{ key: "groups", fn: function(a) {
1761
- return [r(n.LumeAlluvialGroup, e._b({}, "lume-alluvial-group", a, !1))];
1762
- } }, e._l(n.slots, function(a, o) {
1763
- return { key: o, fn: function(u) {
1764
- return [e._t(o, null, null, u || {})];
1765
- } };
1766
- })], null, !0) }, "lume-chart", n.props, !1));
1767
- }, Ir = [], Dr = /* @__PURE__ */ D(
1768
- wr,
1769
- $r,
1770
- Ir,
1771
- !1,
1772
- null,
1773
- null,
1774
- null,
1775
- null
1776
- );
1777
- const Va = Dr.exports;
1778
- var ye = /* @__PURE__ */ ((t) => (t.grouped = "grouped", t.stacked = "stacked", t))(ye || {});
1779
- const Er = /* @__PURE__ */ I({
1780
- __name: "lume-bar-chart",
1781
- props: {
1782
- ...X(),
1783
- type: {
1784
- type: String,
1785
- default: null,
1786
- validator: (t) => t in ye || t == null
1787
- }
1788
- },
1789
- setup(t) {
1790
- const e = t, r = de(
1791
- () => import("./d6697b65.js")
1792
- ), n = de(
1793
- () => import("./d17b4cce.js")
1794
- ), a = de(
1795
- () => import("./cf5a9efb.js")
1796
- ), o = /* @__PURE__ */ new Map([
1797
- ["single", r],
1798
- ["grouped", n],
1799
- ["stacked", a]
1800
- ]), u = Z(V());
1801
- function s(i) {
1802
- return {
1803
- ...i,
1804
- startOnZero: !0,
1805
- // Bar chart always starts on zero,
1806
- tooltipOptions: {
1807
- ...(i == null ? void 0 : i.tooltipOptions) || {},
1808
- position: e.orientation === T.HORIZONTAL && "right"
1809
- }
1810
- };
1811
- }
1812
- const l = c(() => {
1813
- if (e.data) {
1814
- if (be(e.data))
1815
- return o.get("single");
1816
- if (!e.type)
1817
- throw new Error("Bar chart needs a type when there's multiple datasets.");
1818
- return o.get(e.type);
1819
- }
1820
- });
1821
- return { __sfc: !0, TYPES: ye, LumeSingleBarChart: r, LumeGroupedBarChart: n, LumeStackedBarChart: a, COMPONENT_MAP: o, props: e, slots: u, getBarChartOptions: s, component: l };
1822
- }
1823
- });
1824
- var Cr = function() {
1825
- var e = this, r = e._self._c, n = e._self._setupProxy;
1826
- return r(n.component, e._b({ tag: "component", attrs: { options: n.getBarChartOptions(e.options) }, scopedSlots: e._u([e._l(n.slots, function(a, o) {
1827
- return { key: o, fn: function(u) {
1828
- return [e._t(o, null, null, u || {})];
1829
- } };
1830
- })], null, !0) }, "component", { ...n.props, ...e.$attrs }, !1));
1831
- }, Rr = [], Nr = /* @__PURE__ */ D(
1832
- Er,
1833
- Cr,
1834
- Rr,
1835
- !1,
1836
- null,
1837
- null,
1838
- null,
1839
- null
1840
- );
1841
- const Fa = Nr.exports;
1842
- function Br(t) {
1843
- return Object.values(Zt).includes(t) || t == null;
1844
- }
1845
- function Hr(t) {
1846
- return Object.values(T).includes(t);
1847
- }
1848
- const Pr = (t = !1) => ({
1849
- type: {
1850
- type: String,
1851
- default: null,
1852
- validator: Br
1853
- },
1854
- ...t ? {
1855
- orientation: {
1856
- type: String,
1857
- default: T.VERTICAL,
1858
- validator: Hr
1859
- }
1860
- } : {}
1861
- });
1862
- function it(t) {
1863
- const e = c(() => t.value.map((n) => ({
1864
- ...n,
1865
- values: n.values.map((a) => ({
1866
- ...a,
1867
- value: (a == null ? void 0 : a.value) || 0
1868
- }))
1869
- }))), r = c(() => {
1870
- var n;
1871
- return (n = e.value) == null ? void 0 : n.reduce((a, o) => (o.values.forEach((u, s) => {
1872
- a[s] ? a[s].push(u) : a[s] = [u];
1873
- }), a), []);
1874
- });
1875
- return { multiBarData: e, groupedData: r };
1876
- }
1877
- function Sr(t, e) {
1878
- return t.value.length === 1 ? "single" : e.value;
1879
- }
1880
- function Gr(t, e, r, n) {
1881
- const a = c(
1882
- () => n.value === T.HORIZONTAL
1883
- );
1884
- function o(l) {
1885
- Math.min(...l.domain()) > 0 && console.error("Bar linear scale domain cannot start above 0!");
1886
- }
1887
- const u = c(() => {
1888
- const { padding: l, paddingInner: i, paddingOuter: v } = r.value;
1889
- return a.value ? (() => (o(t.value), t.value))() : ne(
1890
- t.value,
1891
- n.value,
1892
- { padding: l, paddingInner: i, paddingOuter: v }
1893
- );
1894
- }), s = c(() => {
1895
- const { padding: l, paddingInner: i, paddingOuter: v } = r.value;
1896
- return a.value ? ne(
1897
- e.value,
1898
- n.value,
1899
- { padding: l, paddingInner: i, paddingOuter: v }
1900
- ) : (() => (o(e.value), e.value))();
1901
- });
1902
- return { barXScale: u, barYScale: s };
1903
- }
1904
- function jr(t, e, r, n, a, o) {
1905
- const u = c(
1906
- () => n.value === T.HORIZONTAL
1907
- );
1908
- function s(d, f) {
1909
- let h, _;
1910
- 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: _ };
1911
- }
1912
- function l(d) {
1913
- return u.value ? d < 0 ? e.value(0) - e.value(d) : e.value(d) - e.value(0) : e.value.bandwidth();
1914
- }
1915
- function i(d) {
1916
- return u.value ? r.value.bandwidth() : d < 0 ? r.value(d) - r.value(0) : r.value(0) - r.value(d);
1917
- }
1918
- function v(d, f, h) {
1919
- const { value: _, color: p } = d, k = p ?? t.value[f].color ?? ie, { x: m, y: g } = s(_, h), O = l(_), L = i(_);
1920
- return {
1921
- classList: [`lume-fill--${k}`, ...o],
1922
- x: m,
1923
- y: g,
1924
- width: O,
1925
- height: L,
1926
- isFaded: a.value !== -1 && a.value !== h,
1927
- isNegative: _ < 0
1928
- };
1929
- }
1930
- return { barAttributeGenerator: v };
1931
- }
1932
- function Vr(t, e, r, n, a, o) {
1933
- const u = c(
1934
- () => n.value === T.HORIZONTAL
1935
- ), 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));
1936
- function i(_, p, k) {
1937
- if (u.value)
1938
- return _ >= 0 ? e.value(0) : e.value(_);
1939
- const m = e.value.domain();
1940
- return e.value(m[p]) + s.value(k);
1941
- }
1942
- function v(_, p, k) {
1943
- if (u.value) {
1944
- const m = r.value.domain();
1945
- return r.value(m[p]) + l.value(k);
1946
- }
1947
- return _ < 0 ? r.value(0) : r.value(_);
1948
- }
1949
- function d(_) {
1950
- return u.value ? _ < 0 ? e.value(0) - e.value(_) : e.value(_) - e.value(0) : s.value.bandwidth();
1951
- }
1952
- function f(_) {
1953
- return u.value ? l.value.bandwidth() : _ < 0 ? r.value(_) - r.value(0) : r.value(0) - r.value(_);
1954
- }
1955
- function h(_, p, k) {
1956
- const { value: m, color: g } = _, O = g ?? t.value[p].color ?? Object.values(P)[p], L = i(m, k, p), y = v(m, k, p), b = d(m), w = f(m);
1957
- return {
1958
- classList: [`lume-fill--${O}`, ...o],
1959
- x: L,
1960
- y,
1961
- width: b,
1962
- height: w,
1963
- isFaded: a.value !== -1 && a.value !== k,
1964
- isNegative: m < 0
1965
- };
1966
- }
1967
- return { barAttributeGenerator: h };
1968
- }
1969
- function Fr(t, e) {
1970
- const r = c(
1971
- () => e.value === T.HORIZONTAL
1972
- ), n = c(() => {
1973
- const s = t.value.map(
1974
- (l) => l.filter((i) => i.value < 0).reduce((i, v) => i + v.value, 0)
1975
- );
1976
- return Math.min(...s);
1977
- }), a = c(() => {
1978
- const s = t.value.map(
1979
- (l) => l.reduce(
1980
- (i, v) => v.value >= 0 ? i + v.value : i,
1981
- 0
1982
- )
1983
- );
1984
- return Math.max(...s);
1985
- });
1986
- function o(s, l, i) {
1987
- return r.value ? Q().domain([n.value, a.value]).range([0, i.width]) : Object.assign(
1988
- ne(
1989
- J().domain(l.map((v, d) => d)).range([0, i.width])
1990
- ),
1991
- { labels: l }
1992
- );
1993
- }
1994
- function u(s, l, i) {
1995
- return r.value ? Object.assign(
1996
- ne(
1997
- J().domain(l.map((v, d) => d)).range([0, i.height])
1998
- ),
1999
- { labels: l }
2000
- ) : Q().domain([a.value, n.value]).range([0, i.height]);
2001
- }
2002
- return { stackedXScaleGenerator: o, stackedYScaleGenerator: u };
2003
- }
2004
- function Mr(t, e, r, n, a, o) {
2005
- const u = c(
2006
- () => n.value === T.HORIZONTAL
2007
- ), s = c(
2008
- () => u.value ? r.value.domain() : e.value.domain()
2009
- ), l = c(
2010
- () => t.value.map((m) => m.values.map((g) => g == null ? void 0 : g.value))
2011
- );
2012
- function i(m, g, O) {
2013
- let L, y;
2014
- 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 };
2015
- }
2016
- function v(m) {
2017
- return u.value ? e.value(m) - e.value(0) : e.value.bandwidth();
2018
- }
2019
- function d(m) {
2020
- return u.value ? e.value(0) - e.value(m) : e.value.bandwidth();
2021
- }
2022
- function f(m) {
2023
- return u.value ? r.value.bandwidth() : r.value(0) - r.value(m);
2024
- }
2025
- function h(m) {
2026
- return u.value ? r.value.bandwidth() : r.value(m) - r.value(0);
2027
- }
2028
- function _(m, g) {
2029
- return m ? l.value.reduce((O, L, y) => (y < m && L[g] >= 0 && (O += L[g]), O), 0) : 0;
2030
- }
2031
- function p(m, g) {
2032
- return m ? l.value.reduce((O, L, y) => (y < m && L[g] < 0 && (O += L[g]), O), 0) : 0;
2033
- }
2034
- function k(m, g, O) {
2035
- const { value: L, color: y } = m, b = L >= 0 ? v(L) : d(L), w = L >= 0 ? f(L) : h(L), E = L >= 0 ? _(g, O) : p(g, O), { x: H, y: Y } = i(L, O, E);
2036
- return {
2037
- classList: [`lume-fill--${y ?? t.value[g].color ?? Object.values(P)[g]}`, ...o],
2038
- width: b,
2039
- height: w,
2040
- x: H,
2041
- y: Y,
2042
- isFaded: a.value !== -1 && a.value !== O,
2043
- isNegative: L < 0
2044
- };
2045
- }
2046
- return { barAttributeGenerator: k };
2047
- }
2048
- const Ve = {
2049
- single: jr,
2050
- grouped: Vr,
2051
- stacked: Mr
2052
- }, zr = /* @__PURE__ */ I({
2053
- __name: "lume-bar-group",
2054
- props: {
2055
- ...se(),
2056
- classList: {
2057
- type: [String, Array],
2058
- default: () => []
2059
- },
2060
- ...Pr(!0),
2061
- transition: {
2062
- type: Boolean,
2063
- default: !0
2064
- }
2065
- },
2066
- emits: ["bar-click", "lume__internal--hover"],
2067
- setup(t, { emit: e }) {
2068
- const r = t, {
2069
- data: n,
2070
- hoveredIndex: a,
2071
- options: o,
2072
- orientation: u,
2073
- transition: s,
2074
- type: l,
2075
- xScale: i,
2076
- yScale: v,
2077
- classList: d
2078
- } = R(r), { groupedData: f } = it(n), { barXScale: h, barYScale: _ } = Gr(
2079
- i,
2080
- v,
2081
- o,
2082
- u
2083
- ), p = c(() => typeof d.value == "string" ? [d.value] : d.value), k = c(() => {
2084
- const g = Sr(n, l), { barAttributeGenerator: O } = Ve[g](
2085
- n,
2086
- h,
2087
- _,
2088
- u,
2089
- a,
2090
- p.value
2091
- );
2092
- return O;
2093
- }), m = c(() => {
2094
- if (s.value)
2095
- return u.value === T.HORIZONTAL ? "width" : "height";
2096
- });
2097
- 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: k, computedTransition: m, LumeBar: Te };
2098
- }
2099
- });
2100
- var Wr = function() {
2101
- var e = this, r = e._self._c, n = e._self._setupProxy;
2102
- return r("g", { staticClass: "lume-bar-group", attrs: { "data-j-bars-group": "" } }, e._l(n.groupedData, function(a, o) {
2103
- return r("g", { key: o, on: { mouseenter: function(u) {
2104
- return n.emit("lume__internal--hover", o);
2105
- } } }, e._l(a, function(u, s) {
2106
- return r(n.LumeBar, e._b({ key: `bar-${s}`, attrs: { transition: n.computedTransition, "data-j-lume-bar": "" }, on: { click: function(l) {
2107
- return n.emit("bar-click", {
2108
- index: o,
2109
- datasetIndex: s,
2110
- event: l
2111
- });
2112
- } } }, "lume-bar", n.getBarAttributes(u, s, o, a), !1));
2113
- }), 1);
2114
- }), 0);
2115
- }, Zr = [], Xr = /* @__PURE__ */ D(
2116
- zr,
2117
- Wr,
2118
- Zr,
2119
- !1,
2120
- null,
2121
- null,
2122
- null,
2123
- null
2124
- );
2125
- const xe = Xr.exports, Yr = {
2126
- [T.VERTICAL]: {
2127
- withTooltip: !0,
2128
- xAxisOptions: {},
2129
- yAxisOptions: { gridLines: !0 },
2130
- margins: z.VERTICAL
2131
- },
2132
- [T.HORIZONTAL]: {
2133
- withTooltip: !0,
2134
- xAxisOptions: { gridLines: !0 },
2135
- yAxisOptions: { gridLines: !1 },
2136
- margins: z.HORIZONTAL
2137
- }
2138
- }, Ur = /* @__PURE__ */ I({
2139
- __name: "lume-single-bar-chart",
2140
- props: {
2141
- ...X(be)
2142
- },
2143
- setup(t) {
2144
- const e = t, r = Z(V()), { orientation: n, options: a } = R(e), o = c(
2145
- () => Yr[n.value || T.VERTICAL]
2146
- // needs to be computed so that default options are reactive
2147
- ), { allOptions: u } = G(a, o);
2148
- return { __sfc: !0, props: e, slots: r, orientation: n, options: a, baseOptions: o, allOptions: u, LumeChart: K, LumeBarGroup: xe };
2149
- }
2150
- });
2151
- var Kr = function() {
2152
- var e = this, r = e._self._c, n = e._self._setupProxy;
2153
- 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) {
2154
- return [r(n.LumeBarGroup, e._b({ attrs: { orientation: n.orientation } }, "lume-bar-group", a, !1))];
2155
- } }, e._l(n.slots, function(a, o) {
2156
- return { key: o, fn: function(u) {
2157
- return [e._t(o, null, null, u || {})];
2158
- } };
2159
- })], null, !0) }, "lume-chart", n.props, !1));
2160
- }, Jr = [], Qr = /* @__PURE__ */ D(
2161
- Ur,
2162
- Kr,
2163
- Jr,
2164
- !1,
2165
- null,
2166
- null,
2167
- null,
2168
- null
2169
- );
2170
- const Ma = Qr.exports, qr = {
2171
- [T.VERTICAL]: {
2172
- withTooltip: !0,
2173
- xAxisOptions: {},
2174
- yAxisOptions: { gridLines: !0 },
2175
- margins: z.VERTICAL
2176
- },
2177
- [T.HORIZONTAL]: {
2178
- withTooltip: !0,
2179
- xAxisOptions: { gridLines: !0 },
2180
- yAxisOptions: { gridLines: !1 },
2181
- margins: z.HORIZONTAL,
2182
- tooltipOptions: { position: "right" }
2183
- }
2184
- }, ea = /* @__PURE__ */ I({
2185
- __name: "lume-grouped-bar-chart",
2186
- props: {
2187
- ...X()
2188
- },
2189
- setup(t) {
2190
- const e = t, r = Z(V()), { orientation: n, options: a } = R(e), o = c(
2191
- () => qr[n.value || T.VERTICAL]
2192
- // needs to be computed so that default options are reactive
2193
- ), { allOptions: u } = G(a, o);
2194
- return { __sfc: !0, props: e, slots: r, orientation: n, options: a, baseOptions: o, allOptions: u, LumeChart: K, LumeBarGroup: xe };
2195
- }
2196
- });
2197
- var ta = function() {
2198
- var e = this, r = e._self._c, n = e._self._setupProxy;
2199
- 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) {
2200
- return [r(n.LumeBarGroup, e._b({ attrs: { type: "grouped" } }, "lume-bar-group", a, !1))];
2201
- } }, e._l(n.slots, function(a, o) {
2202
- return { key: o, fn: function(u) {
2203
- return [e._t(o, null, null, u || {})];
2204
- } };
2205
- })], null, !0) }, "lume-chart", n.props, !1));
2206
- }, na = [], ra = /* @__PURE__ */ D(
2207
- ea,
2208
- ta,
2209
- na,
2210
- !1,
2211
- null,
2212
- null,
2213
- null,
2214
- null
2215
- );
2216
- const za = ra.exports, aa = {
2217
- [T.VERTICAL]: {
2218
- withTooltip: !0,
2219
- xAxisOptions: {},
2220
- yAxisOptions: { gridLines: !0 },
2221
- margins: z.VERTICAL
2222
- },
2223
- [T.HORIZONTAL]: {
2224
- withTooltip: !0,
2225
- xAxisOptions: { gridLines: !0 },
2226
- yAxisOptions: { gridLines: !1 },
2227
- margins: z.HORIZONTAL,
2228
- tooltipOptions: { position: "right" }
2229
- }
2230
- }, oa = /* @__PURE__ */ I({
2231
- __name: "lume-stacked-bar-chart",
2232
- props: {
2233
- ...X()
2234
- },
2235
- setup(t) {
2236
- const e = t, r = Z(V()), { data: n, orientation: a, options: o } = R(e), u = c(
2237
- () => aa[a.value || T.VERTICAL]
2238
- // needs to be computed so that default options are reactive
2239
- ), { allOptions: s } = G(o, u), { internalData: l } = Le(n), { groupedData: i } = it(l), { stackedXScaleGenerator: v, stackedYScaleGenerator: d } = Fr(
2240
- i,
2241
- a
2242
- );
2243
- 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 };
2244
- }
2245
- });
2246
- var ua = function() {
2247
- var e = this, r = e._self._c, n = e._self._setupProxy;
2248
- 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) {
2249
- return [r(n.LumeBarGroup, e._b({ attrs: { type: "stacked" } }, "lume-bar-group", a, !1))];
2250
- } }, e._l(n.slots, function(a, o) {
2251
- return { key: o, fn: function(u) {
2252
- return [e._t(o, null, null, u || {})];
2253
- } };
2254
- })], null, !0) }, "lume-chart", n.props, !1));
2255
- }, la = [], ia = /* @__PURE__ */ D(
2256
- oa,
2257
- ua,
2258
- la,
2259
- !1,
2260
- null,
2261
- null,
2262
- null,
2263
- null
2264
- );
2265
- const Wa = ia.exports, Fe = 2, sa = /* @__PURE__ */ I({
2266
- __name: "lume-line",
2267
- props: {
2268
- pathDefinition: {
2269
- type: String,
2270
- required: !0
2271
- },
2272
- width: {
2273
- type: Number,
2274
- default: Fe
2275
- },
2276
- color: {
2277
- type: String,
2278
- default: P.Skyblue
2279
- },
2280
- dashed: {
2281
- type: Boolean,
2282
- default: !1
2283
- },
2284
- transition: {
2285
- type: Boolean,
2286
- default: !0
2287
- },
2288
- animationDelay: {
2289
- type: Number,
2290
- default: 0
2291
- },
2292
- animationDuration: {
2293
- type: Number,
2294
- default: 0.2
2295
- }
2296
- },
2297
- emits: ["click"],
2298
- setup(t, { emit: e }) {
2299
- const r = x(null);
2300
- return j(() => le(r.value)), { __sfc: !0, DEFAULT_LINE_WIDTH: Fe, emit: e, root: r };
2301
- }
2302
- });
2303
- var ca = function() {
2304
- var e = this, r = e._self._c, n = e._self._setupProxy;
2305
- return r("path", { ref: "root", staticClass: "lume-line", class: {
2306
- [`lume-stroke--${e.color}`]: !0,
2307
- "lume-line--dashed": e.dashed,
2308
- "lume-line--transition": e.transition
2309
- }, style: {
2310
- animationDelay: e.transition && e.animationDelay + "s",
2311
- animationDuration: e.transition && e.animationDuration + "s"
2312
- }, attrs: { d: e.pathDefinition, "stroke-width": e.width, "data-j-line": "" }, on: { click: function(a) {
2313
- return n.emit("click", a);
2314
- } } });
2315
- }, da = [], va = /* @__PURE__ */ D(
2316
- sa,
2317
- ca,
2318
- da,
2319
- !1,
2320
- null,
2321
- "08896455",
2322
- null,
2323
- null
2324
- );
2325
- const _a = va.exports, Me = 4, pa = /* @__PURE__ */ I({
2326
- __name: "lume-point",
2327
- props: {
2328
- x: { type: Number, required: !0 },
2329
- y: { type: Number, required: !0 },
2330
- color: {
2331
- type: String,
2332
- default: P.Skyblue
2333
- },
2334
- radius: {
2335
- type: Number,
2336
- default: Me
2337
- },
2338
- active: {
2339
- type: Boolean,
2340
- default: !1
2341
- }
2342
- },
2343
- emits: ["click"],
2344
- setup(t, { emit: e }) {
2345
- const r = t, n = x(null), a = c(() => r.radius / 2);
2346
- return j(() => le(n.value)), { __sfc: !0, DEFAULT_RADIUS: Me, props: r, emit: e, root: n, strokeWidth: a };
2347
- }
2348
- });
2349
- var fa = function() {
2350
- var e = this, r = e._self._c, n = e._self._setupProxy;
2351
- 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) {
2352
- return n.emit("click", a);
2353
- } } });
2354
- }, ma = [], ha = /* @__PURE__ */ D(
2355
- pa,
2356
- fa,
2357
- ma,
2358
- !1,
2359
- null,
2360
- "9bacbd7d",
2361
- null,
2362
- null
2363
- );
2364
- const ga = ha.exports;
2365
- function st(t) {
2366
- function e(o) {
2367
- let u = null;
2368
- 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), []);
2369
- }
2370
- function r(o, u, s, l) {
2371
- const d = Math.abs(o - u) / (s + 1) * (l + 1);
2372
- return o > u ? o - d : o + d;
2373
- }
2374
- function n(o) {
2375
- return function(s) {
2376
- return !!o.find(
2377
- (l) => l.includes(s) || l.includes(s - 1)
2378
- );
2379
- };
2380
- }
2381
- return { computedLineData: c(() => t.value.map((o) => {
2382
- const u = e(o.values);
2383
- return {
2384
- ...o,
2385
- isDashed: n(u),
2386
- values: o.values.map((s, l) => {
2387
- var v, d;
2388
- const i = u.find(
2389
- (f) => f.includes(l)
2390
- );
2391
- if (i) {
2392
- const f = i[0] - 1, h = i[i.length - 1] + 1;
2393
- let _ = (v = o.values[f]) == null ? void 0 : v.value, p = (d = o.values[h]) == null ? void 0 : d.value;
2394
- return _ == null && (_ = p), p == null && (p = _), {
2395
- value: r(
2396
- _,
2397
- p,
2398
- i.length,
2399
- i.indexOf(l)
2400
- ),
2401
- label: qe
2402
- };
2403
- }
2404
- return s;
2405
- })
2406
- };
2407
- })) };
2408
- }
2409
- function ya(t, e) {
2410
- const r = ke(t) / 2;
2411
- return (n, a) => t(t.domain()[e + (a - 1)]) + r;
2412
- }
2413
- function ba(t, e) {
2414
- return (r, n) => t(e + (n - 1));
2415
- }
2416
- function ka(t, e, r, n) {
2417
- return wt().x(
2418
- W(r) ? ya(r, t) : ba(r, t)
2419
- ).y((o) => n(o))(e);
2420
- }
2421
- const ze = 1, Aa = /* @__PURE__ */ I({
2422
- __name: "lume-line-group",
2423
- props: {
2424
- ...se(),
2425
- withPoints: {
2426
- type: Boolean,
2427
- default: !0
2428
- },
2429
- transition: {
2430
- type: Boolean,
2431
- default: !0
2432
- }
2433
- },
2434
- emits: ["line-click", "point-click", "lume__internal--hover"],
2435
- setup(t, { emit: e }) {
2436
- const r = t, { data: n, options: a, xScale: o, yScale: u } = R(r), s = kt(
2437
- "tooltipAnchorAttributes",
2438
- null
2439
- ), { updateTooltipAnchorAttributes: l } = ot(
2440
- s,
2441
- a,
2442
- o,
2443
- u
2444
- ), i = c(() => {
2445
- if (n.value.every((b) => b.isDashed))
2446
- return n.value;
2447
- const { computedLineData: y } = st(n);
2448
- return a.value.withTooltip !== !1 && (s != null && s.value) && l(y.value), y.value;
2449
- }), v = c(() => {
2450
- if (r.hoveredIndex === -1)
2451
- return;
2452
- const y = St(
2453
- i.value,
2454
- r.hoveredIndex
2455
- );
2456
- return {
2457
- d: `M ${me(o.value, r.hoveredIndex)},${u.value.range()[1]}
2458
- V ${u.value(y)}`
2459
- // Move to X index, Vertical line to the highest point
2460
- };
2461
- }), d = c(
2462
- () => o.value && ze / (Gt(o.value) - 1)
2463
- // Subtracting the first line (read below)
2464
- ), f = c(
2465
- () => {
2466
- var y;
2467
- return ((y = a.value) == null ? void 0 : y.lineWidth) * 2 || void 0;
2468
- }
2469
- // If no `lineWidth`, returns NaN which needs to be undefined
2470
- ), h = c(() => ke(o.value) / 2), _ = c(() => o.value.domain()), p = c(
2471
- () => a.value.withPoints ?? r.withPoints
2472
- );
2473
- function k(y) {
2474
- return i.value[y].values;
2475
- }
2476
- function m(y, b) {
2477
- var E, H;
2478
- const w = y === 0 ? [] : [
2479
- (E = k(b)[y - 1]) == null ? void 0 : E.value,
2480
- (H = k(b)[y]) == null ? void 0 : H.value
2481
- ];
2482
- return ka(
2483
- y,
2484
- w,
2485
- o.value,
2486
- u.value
2487
- ) || "";
2488
- }
2489
- function g(y) {
2490
- return {
2491
- animationDelay: y < 2 ? 0 : (y - 1) * d.value,
2492
- animationDuration: d.value
2493
- };
2494
- }
2495
- function O(y, b) {
2496
- var E;
2497
- const w = (E = k(b)[y]) == null ? void 0 : E.value;
2498
- return {
2499
- x: W(o.value) ? r.xScale(_.value[y]) + h.value : r.xScale(y),
2500
- y: u.value(w)
2501
- };
2502
- }
2503
- function L(y) {
2504
- return r.hoveredIndex === y;
2505
- }
2506
- 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: k, getPathDefinition: m, getLineTransitionParams: g, getPointPosition: O, isPointActive: L, LumeLine: _a, LumePoint: ga };
2507
- }
2508
- });
2509
- var Oa = function() {
2510
- var e = this, r = e._self._c, n = e._self._setupProxy;
2511
- 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) {
2512
- 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) {
2513
- 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) {
2514
- return n.emit("line-click", { index: s, datasetIndex: o, event: l });
2515
- } } }, "lume-line", n.getLineTransitionParams(s), !1));
2516
- }), 1), n.computedWithPoints ? r("g", { staticClass: "lume-line-group__points", attrs: { "data-j-lume-line-group__points": "" } }, e._l(a.values, function(u, s) {
2517
- 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) {
2518
- return n.emit("point-click", { index: s, datasetIndex: o, event: l });
2519
- } } }, "lume-point", n.getPointPosition(s, o), !1));
2520
- }), 1) : e._e()]);
2521
- })], 2);
2522
- }, Ta = [], La = /* @__PURE__ */ D(
2523
- Aa,
2524
- Oa,
2525
- Ta,
2526
- !1,
2527
- null,
2528
- "299f46e4",
2529
- null,
2530
- null
2531
- );
2532
- const ct = La.exports, xa = {
2533
- margins: z.VERTICAL,
2534
- startOnZero: !0,
2535
- withTooltip: !0,
2536
- xAxisOptions: {},
2537
- yAxisOptions: { gridLines: !0 }
2538
- }, wa = /* @__PURE__ */ I({
2539
- __name: "lume-line-chart",
2540
- props: {
2541
- ...X(null, !1)
2542
- },
2543
- setup(t) {
2544
- const e = t, r = Z(V()), { options: n } = R(e), { allOptions: a } = G(n, xa);
2545
- return { __sfc: !0, props: e, slots: r, options: n, allOptions: a, LumeChart: K, LumeLineGroup: ct };
2546
- }
2547
- });
2548
- var $a = function() {
2549
- var e = this, r = e._self._c, n = e._self._setupProxy;
2550
- 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) {
2551
- return [r(n.LumeLineGroup, e._b({}, "lume-line-group", a, !1))];
2552
- } }, e._l(n.slots, function(a, o) {
2553
- return { key: o, fn: function(u) {
2554
- return [e._t(o, null, null, u || {})];
2555
- } };
2556
- })], null, !0) }, "lume-chart", n.props, !1));
2557
- }, Ia = [], Da = /* @__PURE__ */ D(
2558
- wa,
2559
- $a,
2560
- Ia,
2561
- !1,
2562
- null,
2563
- null,
2564
- null,
2565
- null
2566
- );
2567
- const Za = Da.exports;
2568
- function Ea(t) {
2569
- return { areaPathDefinition: c(
2570
- () => function(r, n) {
2571
- if (!r || !n)
2572
- return;
2573
- const a = t.value[0].values;
2574
- return $t().x((o, u) => r(u)).y0(n(Math.min(...n.domain()))).y1((o) => n(o.value))(a);
2575
- }
2576
- ) };
2577
- }
2578
- const Ca = {
2579
- margins: {
2580
- top: 0,
2581
- right: 0,
2582
- bottom: 0,
2583
- left: 0
2584
- },
2585
- withAxes: !1,
2586
- showArea: !0,
2587
- startOnZero: !0,
2588
- withLegend: !1,
2589
- tooltipOptions: {
2590
- showTitle: !1
2591
- }
2592
- }, Ra = /* @__PURE__ */ I({
2593
- __name: "lume-sparkline-chart",
2594
- props: {
2595
- ...rt(null),
2596
- ...ue()
2597
- },
2598
- setup(t, { expose: e }) {
2599
- 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(
2600
- () => a.value[0].areaColor || v.value
2601
- );
2602
- function f(_) {
2603
- return {
2604
- ..._,
2605
- noMinSize: !0
2606
- };
2607
- }
2608
- function h(_, p, k) {
2609
- return Q().range([0, k.width]).domain([0, _[0].values.length - 1]);
2610
- }
2611
- return e({
2612
- areaPathDefinition: i
2613
- }), { __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 };
2614
- }
2615
- });
2616
- var Na = function() {
2617
- var e = this, r = e._self._c, n = e._self._setupProxy;
2618
- 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) {
2619
- return [n.allOptions.showArea ? r("path", { class: [
2620
- "sparkline-chart__area",
2621
- `lume-fill--${n.areaColor || n.computedColor}`,
2622
- "lume-fill--faded"
2623
- ], 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))];
2624
- } }, e._l(n.slots, function(a, o) {
2625
- return { key: o, fn: function(u) {
2626
- return [e._t(o, null, null, u || {})];
2627
- } };
2628
- })], null, !0) }, "lume-chart", n.props, !1));
2629
- }, Ba = [], Ha = /* @__PURE__ */ D(
2630
- Ra,
2631
- Na,
2632
- Ba,
2633
- !1,
2634
- null,
2635
- "60a59b77",
2636
- null,
2637
- null
2638
- );
2639
- const Xa = Ha.exports;
2640
- export {
2641
- cn as L,
2642
- Fa as a,
2643
- Ma as b,
2644
- za as c,
2645
- Wa as d,
2646
- Za as e,
2647
- Xa as f,
2648
- K as g,
2649
- An as h,
2650
- wn as i,
2651
- Cn as j,
2652
- Te as k,
2653
- Va as l,
2654
- _a as m,
2655
- ga as n,
2656
- Lr as o,
2657
- xe as p,
2658
- ct as q,
2659
- Un as r
2660
- };
2661
- //# sourceMappingURL=e8810b11.js.map