@adyen/lume-vue3 1.12.3 → 1.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/README.md +1 -1
  2. package/dist/@types/components/groups/lume-alluvial-group/composables/alluvial-expandable-nodes.d.ts +46 -0
  3. package/dist/@types/components/groups/lume-alluvial-group/composables/alluvial-expandable-nodes.d.ts.map +1 -0
  4. package/dist/@types/components/groups/lume-alluvial-group/composables/alluvial-graph.d.ts +2 -0
  5. package/dist/@types/components/groups/lume-alluvial-group/composables/alluvial-graph.d.ts.map +1 -1
  6. package/dist/@types/components/groups/lume-alluvial-group/composables/alluvial-hover.d.ts +22 -0
  7. package/dist/@types/components/groups/lume-alluvial-group/composables/alluvial-hover.d.ts.map +1 -1
  8. package/dist/@types/components/groups/lume-alluvial-group/constants.d.ts +2 -0
  9. package/dist/@types/components/groups/lume-alluvial-group/constants.d.ts.map +1 -1
  10. package/dist/@types/components/groups/lume-alluvial-group/lume-alluvial-group.vue.d.ts +10 -0
  11. package/dist/@types/components/groups/lume-alluvial-group/lume-alluvial-group.vue.d.ts.map +1 -1
  12. package/dist/@types/docs/storybook-data/alluvial-data.d.ts +11 -0
  13. package/dist/@types/docs/storybook-data/alluvial-data.d.ts.map +1 -1
  14. package/dist/@types/types/alluvial.d.ts +4 -0
  15. package/dist/@types/types/alluvial.d.ts.map +1 -1
  16. package/dist/@types/types/events.d.ts +1 -1
  17. package/dist/@types/types/events.d.ts.map +1 -1
  18. package/dist/common/BLNpY0T8.js +5 -0
  19. package/dist/common/BLNpY0T8.js.map +1 -0
  20. package/dist/common/CHY93RZ1.js +5 -0
  21. package/dist/common/CHY93RZ1.js.map +1 -0
  22. package/dist/common/DUD16QeY.js +5 -0
  23. package/dist/common/DUD16QeY.js.map +1 -0
  24. package/dist/common/ETblYeao.js +3662 -0
  25. package/dist/common/ETblYeao.js.map +1 -0
  26. package/dist/index.js +1 -1
  27. package/dist/plugin.js +3 -3
  28. package/dist/scss/_utilities.scss +2 -2
  29. package/dist/scss/components/lume-alluvial-group.scss +24 -1
  30. package/dist/scss/main.scss +4 -4
  31. package/dist/styles/main.css +1 -1
  32. package/package.json +5 -5
  33. package/dist/common/D9nPdsLp.js +0 -5
  34. package/dist/common/D9nPdsLp.js.map +0 -1
  35. package/dist/common/DZ46vFew.js +0 -5
  36. package/dist/common/DZ46vFew.js.map +0 -1
  37. package/dist/common/Dl4ux2JP.js +0 -3353
  38. package/dist/common/Dl4ux2JP.js.map +0 -1
  39. package/dist/common/EIr2w3Kr.js +0 -5
  40. package/dist/common/EIr2w3Kr.js.map +0 -1
@@ -1,3353 +0,0 @@
1
- import { defineComponent as Z, ref as R, openBlock as _, createElementBlock as I, mergeProps as j, createElementVNode as G, toDisplayString as oe, createCommentVNode as C, isRef as St, computed as v, watch as X, toRefs as te, inject as Fe, reactive as Ce, onMounted as _e, unref as d, Fragment as q, renderList as W, createBlock as Y, normalizeStyle as jt, normalizeClass as ne, watchEffect as Vt, onBeforeUnmount as Pt, renderSlot as B, createTextVNode as ce, useSlots as re, nextTick as Qe, withCtx as V, createSlots as de, pushScopeId as sn, popScopeId as cn, provide as Ke, createVNode as ue, toHandlers as ae, normalizeProps as he, guardReactiveProps as ge, defineAsyncComponent as Je, resolveDynamicComponent as dn } from "vue";
2
- import { sankeyLinkHorizontal as vn, sankey as mn, sankeyJustify as fn } from "d3-sankey";
3
- import { format as pn, ticks as hn, scaleLinear as Be, scaleBand as Me, link as gn, line as yn, area as _n } from "d3";
4
- import { createPopper as kn } from "@popperjs/core";
5
- const bn = {
6
- class: "axis__tick-label lume-typography--axis",
7
- "pointer-events": "all",
8
- "data-j-axis__tick-label": ""
9
- }, An = /* @__PURE__ */ Z({
10
- __name: "lume-tick",
11
- props: {
12
- value: {
13
- type: [String, Number],
14
- required: !0
15
- },
16
- group: {
17
- type: Object,
18
- required: !0
19
- },
20
- ghost: {
21
- type: Object,
22
- required: !0
23
- },
24
- label: {
25
- type: Object,
26
- required: !0
27
- },
28
- gridline: {
29
- type: Object,
30
- required: !0
31
- },
32
- isHovered: {
33
- type: Boolean,
34
- default: !1
35
- },
36
- isHidden: {
37
- type: Boolean,
38
- default: !1
39
- },
40
- withGridlines: {
41
- type: Boolean,
42
- default: !0
43
- }
44
- },
45
- emits: ["click", "mouseenter"],
46
- setup(e, { expose: n, emit: t }) {
47
- const o = t, a = R(null);
48
- return n({ ref: a }), (r, l) => (_(), I("g", j(e.group, {
49
- class: ["axis__tick", {
50
- "axis__tick--hovered": e.isHovered,
51
- "axis__tick--hidden": e.isHidden
52
- }],
53
- "data-j-axis__tick": "",
54
- onMouseenter: l[0] || (l[0] = (i) => o("mouseenter", i)),
55
- onClick: l[1] || (l[1] = (i) => o("click", i))
56
- }), [
57
- G("g", bn, [
58
- G("rect", j(e.ghost, {
59
- class: "axis__ghost",
60
- fill: "url(#lume-tick-gradient)"
61
- }), null, 16),
62
- G("text", j(e.label, {
63
- ref_key: "labelRef",
64
- ref: a,
65
- class: "axis__label"
66
- }), oe(e.value), 17)
67
- ]),
68
- e.withGridlines ? (_(), I("line", j({ key: 0 }, e.gridline, { class: "axis__grid-line" }), null, 16)) : C("", !0)
69
- ], 16));
70
- }
71
- }), ee = (e, n) => {
72
- const t = e.__vccOpts || e;
73
- for (const [o, a] of n)
74
- t[o] = a;
75
- return t;
76
- }, At = /* @__PURE__ */ ee(An, [["__scopeId", "data-v-59ddc0a6"]]), Tn = [
77
- "controls",
78
- "legend",
79
- "axes",
80
- "groups",
81
- "tooltip",
82
- "tooltip-content"
83
- ];
84
- function Ft() {
85
- return process.env.NODE_ENV === "production";
86
- }
87
- function Ct(e) {
88
- return (e == null ? void 0 : e.map(
89
- (n) => n.values.map((t) => t == null ? void 0 : t.value).flat()
90
- ).flat()) || [];
91
- }
92
- function st(e) {
93
- return e.length === 1;
94
- }
95
- function Ln(e) {
96
- return !!e && e.every(
97
- (n) => "color" in n
98
- );
99
- }
100
- function qe(e) {
101
- return !!e && typeof e == "object" && !Array.isArray(e);
102
- }
103
- function zt(e, n) {
104
- const t = { ...e };
105
- return Object.entries(n).forEach(([o, a]) => {
106
- t[o] = qe(e[o]) && qe(a) ? zt(e[o], a) : a;
107
- }), t;
108
- }
109
- function $n(e) {
110
- return e != null && qe(e) && "value" in e;
111
- }
112
- function ve(e) {
113
- return (e == null ? void 0 : e.bandwidth) !== void 0;
114
- }
115
- function On(e) {
116
- return ve(e) ? e.step() : Math.max(...e.range()) / Math.max(...e.domain());
117
- }
118
- function In(e) {
119
- const [n, t] = e.domain();
120
- return n == null || t == null || n === 0 && t === 0;
121
- }
122
- const wn = (e, n) => {
123
- if (!e)
124
- throw new Error("Data is not a valid array");
125
- if (e.length === 0)
126
- throw new Error("Cannot get highest value from empty array");
127
- e.some(
128
- ({ values: o }) => o.length - 1 >= n
129
- ) || ye(me.IndexExceedsLengthOfDataSets);
130
- };
131
- function xn(e, n) {
132
- var t;
133
- return wn(e, n), ((t = e.reduce(
134
- (o, a) => {
135
- var r, l;
136
- return (((r = o.values[n]) == null ? void 0 : r.value) ?? 0) > (((l = a.values[n]) == null ? void 0 : l.value) ?? 0) ? o : a;
137
- }
138
- ).values[n]) == null ? void 0 : t.value) || 0;
139
- }
140
- function Wt(e) {
141
- const n = St(e) ? e.value : e;
142
- if (!n)
143
- throw new Error("No empty array can be created from specified data value");
144
- const t = Math.max(
145
- ...n.map((o) => o.values.length),
146
- 0
147
- );
148
- return Array(t).fill(null);
149
- }
150
- function En(e) {
151
- return ve(e) ? e.domain().length : Math.max(...e.domain());
152
- }
153
- function Nn(e, n) {
154
- return (t) => Math.round(e * (1 - t) + n * t);
155
- }
156
- function Dn(e, n, t) {
157
- const o = n, a = e.slice(0, o);
158
- return e.slice(o).concat(a);
159
- }
160
- function Te(e) {
161
- if (e.groups) {
162
- const n = Object.keys(e);
163
- return Object.assign(
164
- {},
165
- ...n.map((t) => t !== "groups" ? { [t]: e[t] } : {})
166
- );
167
- }
168
- return e;
169
- }
170
- function Hn(e) {
171
- return Object.assign(
172
- {},
173
- ...Object.keys(e).map(
174
- (n) => Tn.includes(n) ? {} : { [n]: e[n] }
175
- )
176
- );
177
- }
178
- function ct(e, n) {
179
- const t = n - e.length;
180
- return t > 0 ? [...e, ...Array(t).fill({ value: null })] : e;
181
- }
182
- var me = /* @__PURE__ */ ((e) => (e.DatasetLength = `Our guidelines highly recommend not having more than 5 datasets in one chart.
183
- Learn more: https://lume.design/guidelines/datasets`, e.ColorLoop = "Colors will loop around after the 5th dataset. You can prevent this by setting specific colors for your datasets.", e.Empty = "The dataset(s) provided are empty.", e.InvalidFormat = "The string provided to format is invalid. Please refer to https://github.com/d3/d3-format for valid arguments.", e.NotContainedInSvg = "This component is an `SVGElement`, thus it is required to be inside an `<svg>` container.", e.InvalidHoveredIndex = "The provided hovered index is not valid for the data of this chart.", e.InvalidHoveredElement = "The provided hovered element is not valid for the data of this diagram.", e.IndexExceedsLengthOfDataSets = "Index exceeds length of all of the datasets", e))(me || {});
184
- const Bn = "[lume] ";
185
- function ye(e, n = !0) {
186
- n && Ft() || console.warn(Bn + "Warning: " + e);
187
- }
188
- const Ve = (e) => {
189
- let n = null;
190
- switch (typeof e) {
191
- case "string":
192
- try {
193
- n = pn(e);
194
- } catch {
195
- ye(me.InvalidFormat), n = null;
196
- }
197
- break;
198
- case "function":
199
- n = e;
200
- break;
201
- default:
202
- n = null;
203
- }
204
- function t(...o) {
205
- return n ? n(...o) : o[0];
206
- }
207
- return t;
208
- }, Re = () => ({
209
- options: {
210
- type: Object,
211
- default: () => ({})
212
- }
213
- });
214
- function fe(e, n) {
215
- return { allOptions: v(() => {
216
- const o = St(n) ? n == null ? void 0 : n.value : n;
217
- return o ? zt(o, e.value) : e.value;
218
- }) };
219
- }
220
- const Mn = 0.2;
221
- function Rn(e, n, t) {
222
- const o = R(), a = v(() => Math.max(...e.value.range())), r = v(() => n.value.length);
223
- function l() {
224
- if (!n.value) return;
225
- const c = n.value.reduce(
226
- (m, u) => m + u.ref.getBoundingClientRect().width,
227
- 0
228
- ), s = Math.ceil(c / r.value);
229
- o.value = s + s * Mn;
230
- }
231
- function i(c) {
232
- if (!n.value) return !0;
233
- const s = t.value.skip, m = n.value.length;
234
- if (c === 0) return !0;
235
- const u = a.value / m, f = typeof s == "number" && s > 0 && s + 1 || Math.ceil(o.value / u);
236
- return c % f === 0;
237
- }
238
- return X(n, l), { showTick: i };
239
- }
240
- const H = {
241
- HORIZONTAL: "horizontal",
242
- VERTICAL: "vertical"
243
- }, Gn = {
244
- SINGLE: "single",
245
- GROUPED: "grouped",
246
- STACKED: "stacked"
247
- }, Zt = "No data", Tt = 20, Ut = 0.33, Xt = 0.5, Yt = 12, Ge = 8, Sn = 1, jn = [
248
- "auto",
249
- "auto-start",
250
- "auto-end",
251
- "top",
252
- "top-start",
253
- "top-end",
254
- "right",
255
- "right-start",
256
- "right-end",
257
- "bottom",
258
- "bottom-start",
259
- "bottom-end",
260
- "left",
261
- "left-start",
262
- "left-end"
263
- ];
264
- function ze(e) {
265
- e != null && e.closest("svg") || ye(me.NotContainedInSvg);
266
- }
267
- const Kt = {
268
- /** Displays a line for each tick. */
269
- gridLines: !1,
270
- /** Displays the axis title. */
271
- withTitle: !0,
272
- //
273
- //// Tick settings
274
- //
275
- /** Controls if the tick labels should be displayed. */
276
- showTicks: !0,
277
- /** Amount of ticks to display in the axis. */
278
- tickCount: 10,
279
- /** Formatting string/function for the tick label. */
280
- tickFormat: null,
281
- /** Space between the tick label and the axis line. */
282
- tickPadding: 12
283
- }, Vn = {
284
- ...Kt,
285
- withTitle: !1,
286
- skip: !0
287
- }, Pn = {
288
- ...Kt,
289
- gridLines: !0
290
- }, Fn = function(e, n, t) {
291
- const o = v(() => e.value.step() * e.value.paddingInner() / 2);
292
- function a(c, s) {
293
- return {
294
- transform: `translate(${(e.value(s) ?? e.value(c)) - o.value}, 0)`
295
- };
296
- }
297
- function r(c) {
298
- var m;
299
- const s = Math.max(
300
- e.value.step(),
301
- (c ? (m = c.getComputedTextLength) == null ? void 0 : m.call(c) : e.value.step()) + 20
302
- );
303
- return {
304
- x: -(s - e.value.step()) / 2,
305
- width: s,
306
- height: t.value.tickPadding + Yt + Ge
307
- };
308
- }
309
- function l() {
310
- const c = e.value.step() / 2;
311
- return {
312
- x1: c,
313
- x2: c,
314
- y1: -n.value.height
315
- // Negative height means it goes from bottom to top
316
- };
317
- }
318
- function i() {
319
- return {
320
- x: e.value.step() / 2,
321
- y: t.value.tickPadding,
322
- dy: "0.8em",
323
- "text-anchor": "middle"
324
- };
325
- }
326
- return {
327
- getGridLinesAttributes: l,
328
- getTickGhostAttributes: r,
329
- getTickGroupAttributes: a,
330
- getTickLabelAttributes: i
331
- };
332
- }, Cn = function(e, n, t) {
333
- const o = v(() => e.value.step() * e.value.paddingInner() / 2);
334
- function a(c, s) {
335
- return {
336
- transform: `translate(0, ${(e.value(s) ?? e.value(c)) - o.value})`
337
- };
338
- }
339
- function r(c) {
340
- var m;
341
- const s = (c ? (m = c.getComputedTextLength) == null ? void 0 : m.call(c) : 42) + t.value.tickPadding + Ge;
342
- return {
343
- x: -s,
344
- width: s,
345
- height: e.value.step()
346
- };
347
- }
348
- function l() {
349
- const c = e.value.step() / 2;
350
- return {
351
- y1: c,
352
- y2: c,
353
- x1: n.value.width
354
- };
355
- }
356
- function i() {
357
- return {
358
- x: -t.value.tickPadding,
359
- y: e.value.step() / 2,
360
- "text-anchor": "end",
361
- "alignment-baseline": "middle"
362
- };
363
- }
364
- return {
365
- getGridLinesAttributes: l,
366
- getTickGhostAttributes: r,
367
- getTickGroupAttributes: a,
368
- getTickLabelAttributes: i
369
- };
370
- }, zn = function(e, n, t) {
371
- const o = v(() => {
372
- const c = e.value.ticks();
373
- return c.length > 1 ? e.value(c[1]) - e.value(c[0]) : 0;
374
- });
375
- function a(c) {
376
- return {
377
- transform: `translate(${e.value(c)}, 0)`
378
- };
379
- }
380
- function r() {
381
- return {
382
- height: t.value.tickPadding + Yt + Ge,
383
- width: o.value,
384
- x: -(o.value / 2)
385
- };
386
- }
387
- function l() {
388
- return {
389
- y1: -n.value.height
390
- };
391
- }
392
- function i() {
393
- return {
394
- y: t.value.tickPadding,
395
- dy: "0.8em",
396
- "text-anchor": "middle"
397
- };
398
- }
399
- return {
400
- getGridLinesAttributes: l,
401
- getTickGhostAttributes: r,
402
- getTickGroupAttributes: a,
403
- getTickLabelAttributes: i
404
- };
405
- }, Wn = function(e, n, t) {
406
- const o = v(() => {
407
- const c = e.value.ticks();
408
- return c.length > 1 ? e.value(c[1]) - e.value(c[0]) : 0;
409
- });
410
- function a(c) {
411
- return {
412
- transform: `translate(0, ${e.value(c)})`
413
- };
414
- }
415
- function r(c) {
416
- var m;
417
- const s = (((m = c == null ? void 0 : c.getComputedTextLength) == null ? void 0 : m.call(c)) || 0) + t.value.tickPadding + Ge;
418
- return {
419
- width: s,
420
- height: o.value,
421
- x: -s,
422
- y: -(o.value / 2)
423
- };
424
- }
425
- function l() {
426
- return {
427
- x1: n.value.width
428
- };
429
- }
430
- function i() {
431
- return {
432
- x: -t.value.tickPadding,
433
- dy: "0.4em",
434
- "text-anchor": "end"
435
- };
436
- }
437
- return {
438
- getGridLinesAttributes: l,
439
- getTickGhostAttributes: r,
440
- getTickGroupAttributes: a,
441
- getTickLabelAttributes: i
442
- };
443
- }, Zn = {
444
- "x-band-scale-axis": Fn,
445
- "y-band-scale-axis": Cn,
446
- "x-linear-scale-axis": zn,
447
- "y-linear-scale-axis": Wn
448
- }, Un = ["transform"], Xn = { key: 0 }, Yn = /* @__PURE__ */ G("linearGradient", { id: "lume-tick-gradient" }, [
449
- /* @__PURE__ */ G("stop", {
450
- offset: "0%",
451
- "stop-color": "rgba(255,255,255,0)"
452
- }),
453
- /* @__PURE__ */ G("stop", {
454
- offset: "10%",
455
- "stop-color": "var(--lume-chart-background-color)"
456
- }),
457
- /* @__PURE__ */ G("stop", {
458
- offset: "90%",
459
- "stop-color": "var(--lume-chart-background-color)"
460
- }),
461
- /* @__PURE__ */ G("stop", {
462
- offset: "100%",
463
- "stop-color": "rgba(255,255,255,0)"
464
- })
465
- ], -1), Kn = [
466
- Yn
467
- ];
468
- var Jt = /* @__PURE__ */ ((e) => (e.bandScale = "band-scale-axis", e.linearScale = "linear-scale-axis", e))(Jt || {}), Qt = /* @__PURE__ */ ((e) => (e.left = "left", e.bottom = "bottom", e))(Qt || {}), et = /* @__PURE__ */ ((e) => (e.x = "bottom", e.y = "left", e))(et || {});
469
- const Lt = /* @__PURE__ */ Z({
470
- __name: "lume-axis",
471
- props: {
472
- scale: {
473
- type: Function,
474
- default: null
475
- },
476
- type: {
477
- type: String,
478
- default: void 0,
479
- validator: (e) => e in et
480
- },
481
- position: {
482
- type: String,
483
- default: void 0,
484
- validator: (e) => e in Qt
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: H.VERTICAL
497
- },
498
- ...Re()
499
- },
500
- emits: ["mouseenter", "click", "mouseleave", "lume__internal--axis-size"],
501
- setup(e, { emit: n }) {
502
- const o = e, a = n, { scale: r, containerSize: l, hoveredIndex: i, options: c, orientation: s } = te(o), m = Fe("isEmpty", R(!1)), u = Ce({}), f = R(null), y = R(null), g = R(null), A = v(
503
- () => o.type ? et[o.type] : o.position
504
- ), $ = v(
505
- () => o.type || (A.value === "left" ? "y" : "x")
506
- ), k = v(
507
- () => $.value === "x" && s.value === H.VERTICAL || $.value === "y" && s.value === H.HORIZONTAL
508
- ), { allOptions: p } = fe(
509
- c,
510
- $.value === "x" ? Vn : Pn
511
- ), { showTick: O } = Rn(r, f, p), N = v(
512
- () => m.value || !r.value || In(r.value)
513
- ), D = v(() => {
514
- var b, x, h, M;
515
- return $.value === "y" && N.value ? `translate(0, ${((b = l.value) == null ? void 0 : b.height) / 2})` : $.value === "x" && N.value ? `translate(-${((x = l.value) == null ? void 0 : x.width) / 2}, ${(h = l.value) == null ? void 0 : h.height})` : `translate(0, ${$.value === "x" ? (M = l.value) == null ? void 0 : M.height : 0})`;
516
- }), P = v(() => {
517
- if (!r.value) return [];
518
- if (ve(r.value))
519
- return r.value.labels || r.value.domain();
520
- const { tickCount: b } = p.value, [x, h] = r.value.domain();
521
- return hn(x, h, b);
522
- }), S = v(() => {
523
- const { tickFormat: b } = p.value;
524
- return Ve(b);
525
- }), E = v(
526
- () => p.value.withHover && k.value && i.value > -1
527
- ), K = v(
528
- () => p.value.tickPadding + Ge || 16
529
- ), U = v(() => $.value === "x" ? (
530
- // If x axis, get the tick height
531
- Math.max(
532
- ...(f.value || []).map(
533
- (b) => {
534
- var x, h;
535
- return ((h = (x = b.ref).getBBox) == null ? void 0 : h.call(x).height) + K.value;
536
- }
537
- )
538
- )
539
- ) : (
540
- // If y axis, get the tick width
541
- Math.max(
542
- ...(f.value || []).map(
543
- (b) => {
544
- var x, h;
545
- return ((h = (x = b.ref).getBBox) == null ? void 0 : h.call(x).width) + K.value;
546
- }
547
- )
548
- )
549
- ));
550
- function F(b) {
551
- const { showTicks: x } = p.value;
552
- return x === !1 ? "" : S.value(b);
553
- }
554
- function Q(b, x, h) {
555
- a("mouseenter", { index: k.value ? b : null, value: x, event: h });
556
- }
557
- function J(b, x, h) {
558
- a("click", { index: b, value: x, event: h });
559
- }
560
- function se(b) {
561
- var x;
562
- if (!(!f.value || !f.value.length))
563
- return (x = f.value[b]) == null ? void 0 : x.ref;
564
- }
565
- function pe() {
566
- g.value = P.value.map(
567
- (b, x) => ({
568
- value: F(b),
569
- group: u.getTickGroupAttributes(b, x),
570
- ghost: u.getTickGhostAttributes(se(x)),
571
- label: u.getTickLabelAttributes(),
572
- gridline: u.getGridLinesAttributes()
573
- })
574
- );
575
- }
576
- function Le() {
577
- g.value && g.value.map((b) => (b.gridline = u.getGridLinesAttributes(), b));
578
- }
579
- function $e() {
580
- if (!r.value) return;
581
- const b = r.value.step ? "bandScale" : "linearScale", x = Zn[`${$.value}-${Jt[b]}`];
582
- Object.entries(x(r, l, p) || []).forEach(
583
- ([h, M]) => {
584
- u[h] = M;
585
- }
586
- );
587
- }
588
- return X(r, $e, { flush: "sync", immediate: !0 }), X(r, pe, { immediate: !0 }), X(f, pe), X(U, (b) => a("lume__internal--axis-size", b)), X(o.containerSize, Le), _e(() => ze(y.value)), (b, x) => d(r) ? (_(), I("g", {
589
- key: 0,
590
- ref_key: "root",
591
- ref: y,
592
- class: "axis",
593
- transform: D.value,
594
- "data-j-axis": "",
595
- onMouseleave: x[1] || (x[1] = (h) => a("mouseleave", h))
596
- }, [
597
- $.value === "x" ? (_(), I("defs", Xn, Kn)) : C("", !0),
598
- (_(!0), I(q, null, W(g.value, (h, M) => (_(), Y(d(At), j({
599
- key: `${h.value}_${M}`,
600
- ref_for: !0,
601
- ref_key: "tickRefs",
602
- ref: f
603
- }, h, {
604
- "is-hidden": d(p).skip && !d(O)(M),
605
- "with-gridlines": d(p).gridLines,
606
- onMouseenter: (z) => Q(M, h.value, z),
607
- onClick: (z) => J(M, h.value, z)
608
- }), null, 16, ["is-hidden", "with-gridlines", "onMouseenter", "onClick"]))), 128)),
609
- E.value ? (_(), Y(d(At), j({ key: 1 }, g.value[d(i)], {
610
- "with-gridlines": !1,
611
- "is-hovered": "",
612
- onClick: x[0] || (x[0] = (h) => J(
613
- d(i),
614
- g.value[d(i)].value,
615
- h
616
- ))
617
- }), null, 16)) : C("", !0)
618
- ], 40, Un)) : C("", !0);
619
- }
620
- });
621
- function Jn(e, n, t, o) {
622
- const a = v(() => t.value > 0 && t.value < 1), r = v(
623
- () => o.value > 0 && o.value < 1
624
- ), l = v(
625
- () => a.value ? e.value - 0.5 : e.value
626
- // draws the 1px bar closer to the axis
627
- ), i = v(
628
- () => r.value ? n.value - 0.5 : n.value
629
- // draws the 1px bar closer to the axis
630
- );
631
- return { computedX: l, computedY: i, shouldHaveMinWidth: a, shouldHaveMinHeight: r };
632
- }
633
- function Qn(e, n, t, o) {
634
- const a = R(0), r = R(0), l = v(() => `${e.value + t.value / 2}px ${n.value + o.value / 2}px`);
635
- return _e(() => {
636
- a.value = t.value, r.value = o.value;
637
- }), X(t, (i) => a.value = i), X(o, (i) => r.value = i), { computedWidth: a, computedHeight: r, transformOrigin: l };
638
- }
639
- const qn = ["x", "y", "width", "height"], eo = /* @__PURE__ */ Z({
640
- __name: "lume-bar",
641
- props: {
642
- x: {
643
- type: Number,
644
- default: 0
645
- },
646
- y: {
647
- type: Number,
648
- default: 0
649
- },
650
- width: {
651
- type: Number,
652
- required: !0
653
- },
654
- height: {
655
- type: Number,
656
- required: !0
657
- },
658
- classList: {
659
- type: [String, Array],
660
- default: ""
661
- },
662
- isFaded: {
663
- type: Boolean,
664
- default: !1
665
- },
666
- isNegative: {
667
- type: Boolean,
668
- default: !1
669
- },
670
- transition: {
671
- type: [String, Boolean],
672
- default: !1
673
- }
674
- },
675
- emits: ["click", "mouseover", "mouseleave"],
676
- setup(e, { emit: n }) {
677
- const t = e, o = n, { x: a, y: r, width: l, height: i, transition: c, classList: s } = te(t), m = R(null), u = v(
678
- () => typeof s.value == "string" ? [s.value] : s.value
679
- ), f = v(() => c.value === "width"), y = v(() => c.value === "height"), g = Qn(a, r, l, i), { computedX: A, computedY: $, shouldHaveMinWidth: k, shouldHaveMinHeight: p } = Jn(a, r, l, i), O = v(() => k.value ? 1 : (f.value ? g.computedWidth : l).value), N = v(() => p.value ? 1 : (y.value ? g.computedHeight : i).value), D = f.value || y.value ? g.transformOrigin : null;
680
- return _e(() => ze(m.value)), (P, S) => (_(), I("rect", {
681
- ref_key: "root",
682
- ref: m,
683
- class: ne(["lume-bar", [
684
- {
685
- "lume-fill--faded": e.isFaded,
686
- "lume-bar--negative": e.isNegative,
687
- "lume-bar--transition-width": f.value,
688
- "lume-bar--transition-height": y.value
689
- },
690
- ...u.value
691
- ]]),
692
- style: jt({ transformOrigin: d(D) }),
693
- x: d(A),
694
- y: d($),
695
- width: O.value,
696
- height: N.value,
697
- "data-j-bar": "",
698
- onClick: S[0] || (S[0] = (E) => o("click", E)),
699
- onMouseover: S[1] || (S[1] = (E) => o("mouseover", E)),
700
- onMouseleave: S[2] || (S[2] = (E) => o("mouseleave", E))
701
- }, null, 46, qn));
702
- }
703
- }), dt = /* @__PURE__ */ ee(eo, [["__scopeId", "data-v-8e8f732a"]]);
704
- var be = /* @__PURE__ */ ((e) => (e.Categorical = "categorical", e.Sequential = "sequential", e.Divergent = "divergent", e))(be || {}), ie = /* @__PURE__ */ ((e) => (e.Skyblue = "skyblue", e.Royalblue = "royalblue", e.Violet = "violet", e.Darkteal = "darkteal", e.Gold = "gold", e))(ie || {}), qt = /* @__PURE__ */ ((e) => (e.Skyblue10 = "skyblue-10", e.Skyblue20 = "skyblue-20", e.Skyblue30 = "skyblue-30", e.Skyblue40 = "skyblue-40", e.Skyblue50 = "skyblue-50", e.Skyblue60 = "skyblue-60", e.Skyblue70 = "skyblue-70", e.Skyblue80 = "skyblue-80", e.Skyblue90 = "skyblue-90", e.Skyblue100 = "skyblue-100", e.Royalblue10 = "royalblue-10", e.Royalblue20 = "royalblue-20", e.Royalblue30 = "royalblue-30", e.Royalblue40 = "royalblue-40", e.Royalblue50 = "royalblue-50", e.Royalblue60 = "royalblue-60", e.Royalblue70 = "royalblue-70", e.Royalblue80 = "royalblue-80", e.Royalblue90 = "royalblue-90", e.Royalblue100 = "royalblue-100", e.Violet10 = "violet-10", e.Violet20 = "violet-20", e.Violet30 = "violet-30", e.Violet40 = "violet-40", e.Violet50 = "violet-50", e.Violet60 = "violet-60", e.Violet70 = "violet-70", e.Violet80 = "violet-80", e.Violet90 = "violet-90", e.Violet100 = "violet-100", e.Darkteal10 = "darkteal-10", e.Darkteal20 = "darkteal-20", e.Darkteal30 = "darkteal-30", e.Darkteal40 = "darkteal-40", e.Darkteal50 = "darkteal-50", e.Darkteal60 = "darkteal-60", e.Darkteal70 = "darkteal-70", e.Darkteal80 = "darkteal-80", e.Darkteal90 = "darkteal-90", e.Darkteal100 = "darkteal-100", e.Gold10 = "gold-10", e.Gold20 = "gold-20", e.Gold30 = "gold-30", e.Gold40 = "gold-40", e.Gold50 = "gold-50", e.Gold60 = "gold-60", e.Gold70 = "gold-70", e.Gold80 = "gold-80", e.Gold90 = "gold-90", e.Gold100 = "gold-100", e))(qt || {}), vt = /* @__PURE__ */ ((e) => (e.SkyTeal = "skyblue-darkteal", e.VioletRoyal = "violet-royalblue", e.VioletTeal = "violet-darkteal", e.GoldTeal = "gold-darkteal", e.GoldRoyal = "gold-royalblue", e))(vt || {}), mt = /* @__PURE__ */ ((e) => (e.White = "white", e.Black = "black", e.Green = "green", e.Orange = "orange", e.Red = "red", e.Grey = "grey", e.Grey10 = "grey-10", e.Grey20 = "grey-20", e.Grey30 = "grey-30", e.Grey40 = "grey-40", e.Grey50 = "grey-50", e.Grey60 = "grey-60", e.Grey70 = "grey-70", e.Grey80 = "grey-80", e.Grey90 = "grey-90", e.Grey100 = "grey-100", e))(mt || {}), ft = /* @__PURE__ */ ((e) => (e["01"] = "01", e["02"] = "02", e["03"] = "03", e["04"] = "04", e["05"] = "05", e["06"] = "06", e["07"] = "07", e["08"] = "08", e["09"] = "09", e))(ft || {});
705
- const to = be.Categorical, Se = ie.Skyblue, no = vt.SkyTeal;
706
- function oo(e) {
707
- return e === be.Divergent ? no : Se;
708
- }
709
- function ao(e) {
710
- return Object.values(ft).includes(e);
711
- }
712
- function $t(e, n) {
713
- return n === be.Divergent ? Object.values(vt).includes(e) : Object.values({
714
- ...ie,
715
- ...qt,
716
- ...mt,
717
- ...ft
718
- }).includes(e);
719
- }
720
- function lo(e, n) {
721
- const t = Object.values(ie).indexOf(e);
722
- return Dn(Object.values(ie), t > -1 ? t : 0)[n];
723
- }
724
- function ro(e, n) {
725
- const t = 50 + n * 10;
726
- return `${e}-${t}`;
727
- }
728
- function uo(e, n) {
729
- const t = (n + 1) * 10;
730
- return `${e}-${t}`;
731
- }
732
- function Ot(e, n, t) {
733
- switch (n) {
734
- default:
735
- case be.Categorical:
736
- return ao(e) ? e : lo(e, t);
737
- case be.Sequential:
738
- return ro(e, t);
739
- case be.Divergent:
740
- return uo(e, t);
741
- }
742
- }
743
- function io(e, n, t = to, o) {
744
- return $t(e, t) ? e : (o > 4 && (ye(me.ColorLoop), o = o % 5), $t(n, t) ? Ot(n, t, o) : Ot(oo(t), t, o));
745
- }
746
- function so(e) {
747
- return e.map((n) => $n(n) ? n : { value: n });
748
- }
749
- function co(e) {
750
- return e.__internal === !0;
751
- }
752
- const pt = (e = null) => ({
753
- data: {
754
- type: Array,
755
- required: !0,
756
- validator: e || void 0
757
- },
758
- labels: {
759
- type: Array,
760
- default: void 0
761
- },
762
- color: {
763
- type: String,
764
- default: ie.Skyblue
765
- },
766
- title: {
767
- type: String,
768
- default: null
769
- }
770
- });
771
- function ht(e, n, t, o, a) {
772
- const r = Ce({
773
- width: 0,
774
- height: 0
775
- }), l = crypto.randomUUID(), i = v(() => {
776
- var m;
777
- return e.value.length > 5 && ye(me.DatasetLength), (m = e.value) == null ? void 0 : m.map(
778
- (u, f) => {
779
- if (co(u)) return u;
780
- const y = so(u.values), g = io(
781
- u.color,
782
- t == null ? void 0 : t.value,
783
- o == null ? void 0 : o.value.colorPalette,
784
- f
785
- );
786
- return {
787
- ...u,
788
- values: y,
789
- color: g,
790
- __internal: !0
791
- };
792
- }
793
- );
794
- }), c = v(() => Array.isArray(n.value) ? n.value : Wt(e.value).map((m, u) => u));
795
- function s(m) {
796
- const u = (a == null ? void 0 : a.value) === H.HORIZONTAL && c.value.length * (((o == null ? void 0 : o.value.barHeight) || Tt) * 2) + ((o == null ? void 0 : o.value.barHeight) || Tt) || m.height;
797
- r.width = m.width, r.height = u;
798
- }
799
- return {
800
- chartID: l,
801
- computedLabels: c,
802
- containerSize: r,
803
- internalData: i,
804
- updateSize: s
805
- };
806
- }
807
- const vo = () => ({
808
- xScale: {
809
- type: Function,
810
- default: null
811
- },
812
- yScale: {
813
- type: Function,
814
- default: null
815
- }
816
- });
817
- function mo(e, n, t, o, a) {
818
- const r = R(null), l = R(null);
819
- function i() {
820
- var m, u, f, y;
821
- const { width: c, height: s } = t;
822
- !c && !s || (o.value === H.HORIZONTAL ? (r.value = (m = e.value) != null && m.length ? wt(
823
- e.value,
824
- c,
825
- o.value,
826
- a.value.startOnZero
827
- ) : null, l.value = (u = n.value) != null && u.length ? It(
828
- n.value,
829
- s,
830
- o.value,
831
- a.value
832
- ) : null) : (r.value = (f = n.value) != null && f.length ? It(
833
- n.value,
834
- c,
835
- o.value,
836
- a.value
837
- ) : null, l.value = (y = e.value) != null && y.length ? wt(
838
- e.value,
839
- s,
840
- o.value,
841
- a.value.startOnZero
842
- ) : null));
843
- }
844
- return Vt(i), { xScale: r, yScale: l };
845
- }
846
- function It(e, n, t, o) {
847
- const a = [0, n], { padding: r, paddingInner: l, paddingOuter: i } = o, c = r ?? (t === H.HORIZONTAL ? Xt : Ut);
848
- return Object.assign(
849
- Me().range(a).paddingInner(l ?? c).paddingOuter(i ?? c).domain(e.map((s, m) => m)),
850
- { labels: e }
851
- );
852
- }
853
- function wt(e, n, t, o) {
854
- const a = Ct(e).filter((m) => m != null), r = [0, n];
855
- if (a.length === 0)
856
- return Be().range(r).domain([0, 0]).nice();
857
- const l = Math.min(...a), i = o && l > 0 ? 0 : l;
858
- let c = Math.max(...a);
859
- o && c < 0 && (c = 0);
860
- const s = t === H.HORIZONTAL ? [i, c] : [c, i];
861
- return Be().range(r).domain(s).nice();
862
- }
863
- function xt(e) {
864
- return (e == null ? void 0 : e.range) !== void 0 || (e == null ? void 0 : e.copy) !== void 0;
865
- }
866
- function tt(e, n) {
867
- return ve(e) ? e.bandwidth() / 2 + e(e.domain()[n]) : e(n);
868
- }
869
- function Et(e, n, {
870
- padding: t,
871
- paddingInner: o,
872
- paddingOuter: a
873
- } = {}) {
874
- const r = t ?? (n === H.HORIZONTAL ? Xt : Ut);
875
- return e.copy().paddingInner(o ?? r).paddingOuter(a ?? r);
876
- }
877
- function gt(e) {
878
- return Object.values(H).includes(e);
879
- }
880
- const we = (e, n = !0) => ({
881
- ...pt(e),
882
- ...vo(),
883
- ...Re(),
884
- classList: {
885
- type: [String, Array],
886
- default: () => []
887
- },
888
- hoveredIndex: {
889
- type: Number,
890
- default: null
891
- },
892
- ...n ? {
893
- orientation: {
894
- type: String,
895
- default: H.VERTICAL,
896
- validator: gt
897
- }
898
- } : {}
899
- }), fo = (e) => ({
900
- ...pt(e),
901
- ...Re(),
902
- hoveredElement: {
903
- type: [Number, String],
904
- default: null
905
- }
906
- });
907
- function po() {
908
- const e = R(), n = Ce({
909
- dimensions: {}
910
- }), t = new ResizeObserver((o) => {
911
- o.forEach((a) => {
912
- n.dimensions = a.contentRect;
913
- });
914
- });
915
- return _e(() => {
916
- t.observe(e.value);
917
- }), Pt(() => {
918
- t.unobserve(e.value);
919
- }), { resizeState: n, resizeRef: e };
920
- }
921
- const ho = ["height"], go = ["transform"], yo = /* @__PURE__ */ Z({
922
- __name: "lume-chart-container",
923
- props: {
924
- margins: {
925
- type: Object,
926
- required: !0
927
- },
928
- containerSize: {
929
- type: Object,
930
- default: () => ({ width: 0, height: 0 })
931
- },
932
- transparentBackground: {
933
- type: Boolean,
934
- default: !1
935
- },
936
- noMinSize: {
937
- type: Boolean,
938
- default: !1
939
- },
940
- orientation: {
941
- type: String,
942
- default: H.VERTICAL,
943
- validator: gt
944
- }
945
- },
946
- emits: ["click", "mouseenter", "mouseleave", "resize"],
947
- setup(e, { emit: n }) {
948
- const t = e, o = n, { margins: a, containerSize: r } = te(t), l = R(null), { resizeRef: i, resizeState: c } = po(), s = v(
949
- () => r.value.height + a.value.top + a.value.bottom
950
- );
951
- return Vt(() => {
952
- if (!l.value) return;
953
- const { width: m } = c.dimensions, { height: u } = l.value.getBoundingClientRect();
954
- if (!m || t.orientation === H.VERTICAL && !u)
955
- return;
956
- const f = m - a.value.left - a.value.right, y = u - a.value.top - a.value.bottom, g = {
957
- width: f > 0 ? f : 0,
958
- height: y > 0 ? y : 0,
959
- outerWidth: m,
960
- outerHeight: u
961
- };
962
- o("resize", g);
963
- }), (m, u) => (_(), I("div", {
964
- ref_key: "resizeRef",
965
- ref: i,
966
- class: ne(["lume-chart-container", {
967
- "lume-chart-container--minimum": !e.noMinSize
968
- }]),
969
- "data-j-chart-container": ""
970
- }, [
971
- B(m.$slots, "header", {}, void 0, !0),
972
- (_(), I("svg", {
973
- ref_key: "root",
974
- ref: l,
975
- class: ne(["lume-chart-container__svg", {
976
- "lume-chart-container__svg--transparent": e.transparentBackground
977
- }]),
978
- height: s.value,
979
- "data-j-chart-container__root": "",
980
- onClick: u[0] || (u[0] = (f) => o("click", f)),
981
- onMouseenter: u[1] || (u[1] = (f) => o("mouseenter", f)),
982
- onMouseleave: u[2] || (u[2] = (f) => o("mouseleave", f))
983
- }, [
984
- G("g", {
985
- transform: `translate(${d(a).left}, ${d(a).top})`,
986
- class: "lume-chart-container__group",
987
- "data-j-chart-container__group": ""
988
- }, [
989
- B(m.$slots, "default", {}, void 0, !0)
990
- ], 8, go)
991
- ], 42, ho)),
992
- B(m.$slots, "footer", {}, void 0, !0),
993
- B(m.$slots, "extra", {}, void 0, !0)
994
- ], 2));
995
- }
996
- }), _o = /* @__PURE__ */ ee(yo, [["__scopeId", "data-v-d53cdc3e"]]), ko = ["onClick", "onMouseenter"], bo = /* @__PURE__ */ Z({
997
- __name: "lume-chart-legend",
998
- props: {
999
- data: {
1000
- type: Array,
1001
- validator: Ln,
1002
- required: !0
1003
- }
1004
- },
1005
- emits: ["click", "mouseenter", "mouseleave"],
1006
- setup(e, { emit: n }) {
1007
- const t = n;
1008
- return (o, a) => (_(), I("div", {
1009
- class: "lume-chart-legend",
1010
- "data-j-chart-legend": "",
1011
- onMouseleave: a[0] || (a[0] = (r) => t("mouseleave"))
1012
- }, [
1013
- (_(!0), I(q, null, W(e.data, (r, l) => (_(), I("div", {
1014
- key: `legend-item-${l}`,
1015
- class: "lume-chart-legend__item lume-typography--caption",
1016
- tabindex: "0",
1017
- "data-j-chart-legend__symbol-wrapper": "",
1018
- onClick: (i) => t("click", { index: l, dataset: r, event: i }),
1019
- onMouseenter: (i) => t("mouseenter", { index: l, dataset: r, event: i })
1020
- }, [
1021
- G("span", {
1022
- class: ne(["lume-chart-legend__symbol", `lume-background-color--${r.color}`]),
1023
- "data-j-chart-legend__symbol": ""
1024
- }, null, 2),
1025
- ce(" " + oe(r.label || l), 1)
1026
- ], 40, ko))), 128))
1027
- ], 32));
1028
- }
1029
- }), Nt = /* @__PURE__ */ ee(bo, [["__scopeId", "data-v-6f1d1c44"]]), Ao = {}, To = {
1030
- class: "lume-tooltip__title",
1031
- "data-j-tooltip__title": ""
1032
- };
1033
- function Lo(e, n) {
1034
- return _(), I("div", To, [
1035
- B(e.$slots, "default", {}, void 0, !0)
1036
- ]);
1037
- }
1038
- const $o = /* @__PURE__ */ ee(Ao, [["render", Lo], ["__scopeId", "data-v-8af3fac6"]]), Oo = {}, Io = {
1039
- class: "lume-tooltip__item",
1040
- "data-j-tooltip__summary-item": ""
1041
- }, wo = { class: "lume-tooltip__value" };
1042
- function xo(e, n) {
1043
- return _(), I("li", Io, [
1044
- G("span", null, [
1045
- B(e.$slots, "default", {}, void 0, !0)
1046
- ]),
1047
- G("strong", wo, [
1048
- B(e.$slots, "value", {}, void 0, !0)
1049
- ])
1050
- ]);
1051
- }
1052
- const Eo = /* @__PURE__ */ ee(Oo, [["render", xo], ["__scopeId", "data-v-4ed7ec1b"]]), No = {
1053
- class: "lume-tooltip__item",
1054
- "data-j-tooltip__item": ""
1055
- }, Do = { "data-j-tooltip__item__label": "" }, Ho = {
1056
- class: "lume-tooltip__value",
1057
- "data-j-tooltip__item__value": ""
1058
- }, Bo = /* @__PURE__ */ Z({
1059
- __name: "lume-tooltip-item",
1060
- props: {
1061
- color: {
1062
- type: String,
1063
- default: null
1064
- }
1065
- },
1066
- setup(e) {
1067
- return (n, t) => (_(), I("li", No, [
1068
- e.color ? (_(), I("span", {
1069
- key: 0,
1070
- class: ne([[`lume-background-color--${e.color}`], "lume-tooltip__symbol"]),
1071
- "data-j-tooltip__item__symbol": ""
1072
- }, null, 2)) : C("", !0),
1073
- G("span", Do, [
1074
- B(n.$slots, "label", {}, void 0, !0)
1075
- ]),
1076
- G("strong", Ho, [
1077
- B(n.$slots, "value", {}, void 0, !0)
1078
- ])
1079
- ]));
1080
- }
1081
- }), Mo = /* @__PURE__ */ ee(Bo, [["__scopeId", "data-v-4f995c3c"]]), Ro = (e) => (sn("data-v-6f13599d"), e = e(), cn(), e), Go = { class: "lume-tooltip__items" }, So = {
1082
- key: 0,
1083
- class: "lume-tooltip__break"
1084
- }, jo = /* @__PURE__ */ Ro(() => /* @__PURE__ */ G("hr", null, null, -1)), Vo = [
1085
- jo
1086
- ], Po = /* @__PURE__ */ Z({
1087
- __name: "lume-tooltip",
1088
- props: {
1089
- opened: {
1090
- type: Boolean,
1091
- default: !1
1092
- },
1093
- targetElement: {
1094
- type: Element,
1095
- default: null
1096
- },
1097
- items: {
1098
- type: Array,
1099
- required: !0
1100
- },
1101
- position: {
1102
- type: String,
1103
- default: "auto",
1104
- validator: (e) => jn.includes(e)
1105
- },
1106
- fixedPositioning: {
1107
- type: Boolean,
1108
- default: !1
1109
- },
1110
- inverse: {
1111
- type: Boolean,
1112
- default: !1
1113
- },
1114
- modifiers: {
1115
- type: Array,
1116
- default: null
1117
- },
1118
- title: {
1119
- type: [String, Number],
1120
- default: null
1121
- },
1122
- summary: {
1123
- type: String,
1124
- default: null
1125
- },
1126
- ...Re()
1127
- },
1128
- emits: ["opened", "moved", "closed", "tooltip-mouseenter", "tooltip-mouseleave"],
1129
- setup(e, { emit: n }) {
1130
- const t = e, o = n, a = R(null), { items: r, options: l } = te(t), i = re(), c = R(null), { allOptions: s } = fe(l), m = v(
1131
- () => s.value.fixedPositioning ?? t.fixedPositioning
1132
- ), u = v(
1133
- () => m.value ? "fixed" : "absolute"
1134
- ), f = v(() => [
1135
- {
1136
- name: "computeStyles",
1137
- options: {
1138
- adaptive: !1
1139
- // so that we can have smooth transitions
1140
- }
1141
- },
1142
- {
1143
- name: "offset",
1144
- options: { offset: [0, s.value.offset || 8] }
1145
- },
1146
- ...t.modifiers || []
1147
- ]), y = v(
1148
- () => s.value.showTitle !== !1 && t.title != null
1149
- ), g = v(() => Ve(s.value.valueFormat)), A = v(() => Ve(s.value.titleFormat)), $ = v(
1150
- () => {
1151
- var P;
1152
- return ((P = r.value) == null ? void 0 : P.find((S) => S.isSummary)) || {
1153
- label: s.value.summary ?? t.summary
1154
- };
1155
- }
1156
- ), k = v(() => i.summary || $.value.label), p = v(() => t.inverse || s.value.inverse ? [...r.value].reverse() : r.value);
1157
- function O() {
1158
- t.targetElement && a.value && (c.value = kn(t.targetElement, a.value, {
1159
- placement: t.position,
1160
- strategy: u.value,
1161
- modifiers: f.value
1162
- }), o("opened", t.targetElement));
1163
- }
1164
- function N() {
1165
- c.value && (c.value.destroy(), o("closed"), a.value && a.value.classList.remove("lume-tooltip--animated"));
1166
- }
1167
- function D() {
1168
- c.value && (s.value.withAnimation !== !1 && a.value && a.value.classList.add("lume-tooltip--animated"), t.targetElement ? (function() {
1169
- c.value.state.elements.reference = t.targetElement, c.value.update(), o("moved", t.targetElement);
1170
- })() : N());
1171
- }
1172
- return X(
1173
- () => t.targetElement,
1174
- async (P, S) => {
1175
- !S && P ? (await Qe(), O()) : D();
1176
- }
1177
- ), _e(O), Pt(N), (P, S) => e.opened && e.targetElement ? (_(), I("div", {
1178
- key: 0,
1179
- ref_key: "root",
1180
- ref: a,
1181
- class: ne(["lume-tooltip lume-typography--caption", {
1182
- "lume-tooltip--pointer-events": d(l).withPointerEvents
1183
- }]),
1184
- "data-j-tooltip": "",
1185
- onMouseenter: S[0] || (S[0] = (E) => o("tooltip-mouseenter")),
1186
- onMouseleave: S[1] || (S[1] = (E) => o("tooltip-mouseleave"))
1187
- }, [
1188
- B(P.$slots, "default", {}, () => [
1189
- B(P.$slots, "title", {}, () => [
1190
- y.value ? (_(), Y(d($o), { key: 0 }, {
1191
- default: V(() => [
1192
- ce(oe(A.value(e.title)), 1)
1193
- ]),
1194
- _: 1
1195
- })) : C("", !0)
1196
- ], !0),
1197
- G("ul", Go, [
1198
- B(P.$slots, "summary", {}, () => [
1199
- k.value ? (_(), Y(d(Eo), { key: 0 }, de({
1200
- default: V(() => [
1201
- ce(oe($.value.label) + " ", 1)
1202
- ]),
1203
- _: 2
1204
- }, [
1205
- $.value.value ? {
1206
- name: "value",
1207
- fn: V(() => [
1208
- ce(oe(g.value($.value.value)), 1)
1209
- ]),
1210
- key: "0"
1211
- } : void 0
1212
- ]), 1024)) : C("", !0)
1213
- ], !0),
1214
- k.value ? (_(), I("li", So, Vo)) : C("", !0),
1215
- B(P.$slots, "items", {}, () => [
1216
- (_(!0), I(q, null, W(p.value, (E) => (_(), Y(d(Mo), {
1217
- key: E.label,
1218
- color: E.color
1219
- }, {
1220
- label: V(() => [
1221
- ce(oe(E.label), 1)
1222
- ]),
1223
- value: V(() => [
1224
- ce(oe(g.value(E.value)), 1)
1225
- ]),
1226
- _: 2
1227
- }, 1032, ["color"]))), 128))
1228
- ], !0)
1229
- ])
1230
- ], !0)
1231
- ], 34)) : C("", !0);
1232
- }
1233
- }), Fo = /* @__PURE__ */ ee(Po, [["__scopeId", "data-v-6f13599d"]]), We = () => ({
1234
- data: {
1235
- type: Array,
1236
- required: !0
1237
- },
1238
- labels: {
1239
- type: Array,
1240
- default: () => []
1241
- },
1242
- options: {
1243
- type: Object,
1244
- default: () => ({})
1245
- },
1246
- orientation: {
1247
- type: String,
1248
- default: H.VERTICAL,
1249
- validator: gt
1250
- },
1251
- xScale: {
1252
- type: Function,
1253
- default: () => null
1254
- },
1255
- yScale: {
1256
- type: Function,
1257
- default: () => null
1258
- },
1259
- hoveredIndex: {
1260
- type: Number,
1261
- default: -1
1262
- },
1263
- containerSize: {
1264
- type: Object,
1265
- default: () => ({ width: 0, height: 0 })
1266
- },
1267
- transition: {
1268
- type: Boolean,
1269
- default: !0
1270
- },
1271
- classList: {
1272
- type: [String, Array],
1273
- default: () => []
1274
- }
1275
- }), Co = { class: "lume-overlay-group" }, zo = /* @__PURE__ */ Z({
1276
- __name: "lume-overlay-group",
1277
- props: {
1278
- ...We(),
1279
- orientation: {
1280
- type: String,
1281
- default: H.VERTICAL
1282
- }
1283
- },
1284
- emits: ["click", "lume__internal--hover", "mouseover"],
1285
- setup(e, { emit: n }) {
1286
- const t = e, o = n, { data: a, orientation: r, xScale: l, yScale: i } = te(t), c = v(() => Wt(a));
1287
- function s(m) {
1288
- var k;
1289
- const u = r.value === H.HORIZONTAL ? i.value : l.value, f = u.domain(), y = On(u), g = ((k = u.paddingInner) == null ? void 0 : k.call(u)) ?? 0, A = y * g, $ = ve(u) ? u(f[m]) - A / 2 : u(m) - y / 2;
1290
- return r.value === H.HORIZONTAL ? {
1291
- width: Math.max(...l.value.range()),
1292
- height: y,
1293
- transform: `translate(0, ${$})`
1294
- } : {
1295
- width: y,
1296
- height: Math.max(...i.value.range()),
1297
- transform: `translate(${$}, 0)`
1298
- };
1299
- }
1300
- return (m, u) => (_(), I("g", Co, [
1301
- (_(!0), I(q, null, W(c.value, (f, y) => (_(), Y(d(dt), j(s(y), {
1302
- key: `overlay-${y}`,
1303
- "data-j-lume-overlay-group": y,
1304
- transition: !1,
1305
- "class-list": "lume-fill--transparent",
1306
- onMouseover: (g) => o("lume__internal--hover", y),
1307
- onClick: (g) => o("click", { index: y, event: g })
1308
- }), null, 16, ["data-j-lume-overlay-group", "onMouseover", "onClick"]))), 128))
1309
- ]));
1310
- }
1311
- }), ke = (e, n) => {
1312
- function t(r, ...l) {
1313
- }
1314
- function o(r, l) {
1315
- }
1316
- return { componentEventPropagator: {}, emitInternalEvent: t, listenInternalEvent: o };
1317
- };
1318
- function Wo(e) {
1319
- return { hasNegativeValues: v(
1320
- () => Ct(e.value).some((t) => t < 0)
1321
- ) };
1322
- }
1323
- function Zo(e, n, t, o) {
1324
- const a = v(
1325
- () => o.value === H.HORIZONTAL
1326
- ), r = v(
1327
- () => {
1328
- var s;
1329
- return e.height - (a != null && a.value ? 0 : ((s = t.value) == null ? void 0 : s.call(t, 0)) || 0);
1330
- }
1331
- ), l = v(
1332
- () => {
1333
- var s;
1334
- return a != null && a.value ? ((s = n.value) == null ? void 0 : s.call(n, 0)) || 0 : e.width;
1335
- }
1336
- ), i = v(
1337
- () => {
1338
- var s;
1339
- return a != null && a.value ? "translate(0, 0)" : `translate(0, ${((s = t.value) == null ? void 0 : s.call(t, 0)) || 0})`;
1340
- }
1341
- );
1342
- return { negativeBarAttributes: v(() => ({
1343
- width: l.value,
1344
- height: r.value,
1345
- transform: i.value
1346
- })) };
1347
- }
1348
- function Uo(e, n) {
1349
- return e.reduce((t, o) => ct(o.values, n).map(
1350
- (a, r) => t[r] ? a.value > t[r] ? a.value : t[r] : a.value ?? 0
1351
- ), []);
1352
- }
1353
- function Xo(e, n) {
1354
- return e.reduce((t, o) => ct(o.values, n).map(
1355
- (a, r) => {
1356
- const l = a.value == null || a.value < 0 ? 0 : a.value;
1357
- return t[r] ? t[r] + l : l;
1358
- }
1359
- ), []);
1360
- }
1361
- const Dt = {
1362
- "stacked-bar": Xo
1363
- };
1364
- function en(e, n, t, o, a, r, l, i) {
1365
- const c = v(
1366
- () => {
1367
- var m;
1368
- return n.value.withTooltip !== !1 && !((m = n.value.tooltipOptions) != null && m.targetElement);
1369
- }
1370
- );
1371
- function s(m) {
1372
- var y;
1373
- const u = ((y = a == null ? void 0 : a.value) == null ? void 0 : y.length) ?? 0, f = i != null && i.value && Dt[i.value] ? Dt[i.value](
1374
- m,
1375
- u
1376
- ) : Uo(m, u);
1377
- e.value = f.map((g, A) => ({
1378
- cx: (r == null ? void 0 : r.value) === H.HORIZONTAL ? t.value(g) : tt(t.value, A),
1379
- cy: (r == null ? void 0 : r.value) === H.HORIZONTAL ? tt(o.value, A) : o.value(g)
1380
- }));
1381
- }
1382
- return X(
1383
- [t, o],
1384
- () => {
1385
- t.value && o.value && (l != null && l.value) && c.value && s(l.value);
1386
- },
1387
- { immediate: !0 }
1388
- ), { shouldGenerateTooltipAnchors: c, updateTooltipAnchorAttributes: s };
1389
- }
1390
- function Yo() {
1391
- const e = Ce({
1392
- opened: !1,
1393
- targetElement: null
1394
- });
1395
- return { tooltipConfig: e, showTooltip: (o) => {
1396
- e.opened = !0, e.targetElement = o;
1397
- }, hideTooltip: () => {
1398
- e.opened = !1, e.targetElement = null;
1399
- } };
1400
- }
1401
- function Ko(e) {
1402
- return { getTooltipItems: v(
1403
- () => (t) => e.value.map(({ color: o, label: a, values: r }) => {
1404
- var l, i, c;
1405
- return {
1406
- color: ((l = r[t]) == null ? void 0 : l.color) || o,
1407
- label: a,
1408
- value: ((i = r[t]) == null ? void 0 : i.label) ?? ((c = r[t]) == null ? void 0 : c.value) ?? Zt
1409
- };
1410
- })
1411
- ) };
1412
- }
1413
- const nt = 16, ot = 8, at = 28, lt = 24, Ae = {
1414
- VERTICAL: {
1415
- top: nt,
1416
- right: ot,
1417
- bottom: at,
1418
- left: lt
1419
- },
1420
- HORIZONTAL: {
1421
- top: nt,
1422
- right: ot,
1423
- bottom: at,
1424
- left: lt
1425
- }
1426
- };
1427
- function Jo(e) {
1428
- return !e || e === "auto" || e.top == null || e.top === "auto" ? nt : e.top;
1429
- }
1430
- function Qo(e) {
1431
- return !e || e === "auto" || e.right == null || e.right === "auto" ? ot : e.right;
1432
- }
1433
- function qo(e, n) {
1434
- return !e || e === "auto" || e.bottom == null || e.bottom === "auto" ? n || at : e.bottom;
1435
- }
1436
- function ea(e, n) {
1437
- return !e || e === "auto" || e.left == null || e.left === "auto" ? n || lt : e.left;
1438
- }
1439
- const ta = { class: "lume-chart__header" }, na = { class: "lume-chart__header-section" }, oa = {
1440
- key: 0,
1441
- class: "lume-chart__title lume-chart-title lume-typography--display"
1442
- }, aa = { class: "lume-chart__controls" }, la = { class: "lume-chart__header-section" }, ra = {
1443
- key: 0,
1444
- class: "lume-chart__axis-title lume-axis-title lume-typography--caption"
1445
- }, ua = { key: 3 }, ia = ["r"], sa = {
1446
- key: 0,
1447
- class: "lume-chart__axis-title lume-chart__axis-title--centered lume-axis-title lume-typography--body"
1448
- }, ca = /* @__PURE__ */ Z({
1449
- __name: "lume-chart",
1450
- props: {
1451
- ...we(),
1452
- chartType: {
1453
- type: String,
1454
- default: null
1455
- }
1456
- },
1457
- setup(e, { emit: n }) {
1458
- const t = e, o = re(), a = n, { data: r, labels: l, color: i, options: c, orientation: s, chartType: m } = te(t), u = R(-1), f = R(null), y = R(null), g = R([]), A = R(null), $ = R(0), k = R(0), { allOptions: p } = fe(c), { internalData: O, computedLabels: N, containerSize: D, updateSize: P, chartID: S } = ht(r, l, i, p, s), { xScale: E, yScale: K } = mo(
1459
- O,
1460
- N,
1461
- D,
1462
- s,
1463
- p
1464
- ), U = v(() => ({
1465
- top: Jo(p.value.margins),
1466
- right: Qo(p.value.margins),
1467
- bottom: qo(p.value.margins, $.value),
1468
- left: ea(p.value.margins, k.value)
1469
- })), F = v(() => {
1470
- var T;
1471
- return t.xScale ? xt(t.xScale) ? t.xScale : (T = t.xScale) == null ? void 0 : T.call(t, O.value, l.value, D) : E.value;
1472
- }), Q = v(() => {
1473
- var T;
1474
- return t.yScale ? xt(t.yScale) ? t.yScale : (T = t.yScale) == null ? void 0 : T.call(t, O.value, l.value, D) : K.value;
1475
- }), J = v(() => ({
1476
- ...p.value.xAxisOptions,
1477
- withHover: s.value === H.VERTICAL
1478
- })), se = v(() => ({
1479
- ...p.value.yAxisOptions,
1480
- withHover: s.value === H.HORIZONTAL
1481
- })), pe = v(() => {
1482
- var T;
1483
- return (T = p.value.xAxisOptions) == null ? void 0 : T.title;
1484
- }), Le = v(() => {
1485
- var T;
1486
- return (T = p.value.yAxisOptions) == null ? void 0 : T.title;
1487
- }), $e = v(() => {
1488
- var T;
1489
- return ((T = p.value.xAxisOptions) == null ? void 0 : T.withTitle) !== !1 && pe.value;
1490
- }), b = v(() => {
1491
- var T;
1492
- return ((T = p.value.yAxisOptions) == null ? void 0 : T.withTitle) !== !1 && Le.value;
1493
- }), x = v(
1494
- () => r.value.every((T) => !T.values.length) || r.value.every((T) => T.values.every((L) => L === null))
1495
- ), h = v(() => {
1496
- const T = [], { noBaseScales: L } = p.value;
1497
- return L || T.push(() => !!(F.value && Q.value)), T.every((w) => w() === !0);
1498
- }), { hasNegativeValues: M } = Wo(O), { negativeBarAttributes: z } = Zo(
1499
- D,
1500
- F,
1501
- Q,
1502
- s
1503
- ), { shouldGenerateTooltipAnchors: le } = en(
1504
- g,
1505
- p,
1506
- F,
1507
- Q,
1508
- l,
1509
- s,
1510
- O,
1511
- m
1512
- ), { tooltipConfig: Ee, showTooltip: Ze, hideTooltip: Ue } = Yo(), { getTooltipItems: Ne } = Ko(O), De = v(
1513
- () => {
1514
- var T;
1515
- return ((T = p.value.tooltipOptions) == null ? void 0 : T.position) || "top";
1516
- }
1517
- ), Oe = v(() => {
1518
- var L;
1519
- const T = (L = p.value.tooltipOptions) == null ? void 0 : L.withPointerEvents;
1520
- return Ee.opened && (!T || T && A.value === !1);
1521
- });
1522
- function je(T) {
1523
- var w;
1524
- if (p.value.withHover === !1 || T === u.value) return;
1525
- const L = u.value;
1526
- if (u.value = T, p.value.withTooltip !== !1) {
1527
- const Ye = (w = p.value.tooltipOptions) != null && w.targetElement ? p.value.tooltipOptions.targetElement === "self" ? y.value.$el : p.value.tooltipOptions.targetElement : f.value[T];
1528
- Ze(Ye);
1529
- }
1530
- a("hovered-index-changed", { newIndex: T, oldIndex: L }), a("update:hoveredIndex", T);
1531
- }
1532
- function Xe() {
1533
- Ue(), u.value = -1, a("update:hoveredIndex", -1);
1534
- }
1535
- function _t(T) {
1536
- if (!r.value.some(
1537
- ({ values: w }) => T <= w.length - 1
1538
- )) {
1539
- ye(me.InvalidHoveredIndex);
1540
- return;
1541
- }
1542
- T == null || T === -1 ? Xe() : je(T);
1543
- }
1544
- function rn() {
1545
- setTimeout(() => {
1546
- Oe.value && Xe(), a("chart-mouseleave");
1547
- }, 0);
1548
- }
1549
- function un(T) {
1550
- P(T), a("resize", T);
1551
- }
1552
- function kt({ index: T, value: L, event: w }) {
1553
- T !== null && je(T), a("axis-mouseenter", { index: T, value: L, event: w });
1554
- }
1555
- function bt({ index: T, value: L, event: w }) {
1556
- a("axis-click", { index: T, value: L, event: w });
1557
- }
1558
- return X(
1559
- r,
1560
- (T, L) => a("data-changed", { newValue: T, oldValue: L })
1561
- ), X(
1562
- l,
1563
- (T, L) => a("labels-changed", { newValue: T, oldValue: L })
1564
- ), X(x, (T) => T && ye(me.Empty), { immediate: !0 }), X(() => t.hoveredIndex, _t), X(
1565
- g,
1566
- (T) => {
1567
- T && t.hoveredIndex != null && u.value === -1 && _t(t.hoveredIndex);
1568
- },
1569
- { flush: "post" }
1570
- ), X(A, (T) => {
1571
- T === !1 && Ee.opened && Xe();
1572
- }), _e(async () => {
1573
- a("rendered"), o.groups || console.error('"groups" `<slot>` must have content.');
1574
- }), Ke("chartID", S), Ke("isEmpty", x), Ke("tooltipAnchorAttributes", g), (T, L) => (_(), Y(d(_o), {
1575
- id: `lume-chart_${d(S)}`,
1576
- ref_key: "chartContainer",
1577
- ref: y,
1578
- margins: U.value,
1579
- "container-size": d(D),
1580
- "no-min-size": d(p).noMinSize,
1581
- "transparent-background": d(p).transparentBackground,
1582
- orientation: d(s),
1583
- "data-j-lume-chart": "",
1584
- onResize: un,
1585
- onClick: L[24] || (L[24] = (w) => a("chart-click", w)),
1586
- onMouseenter: L[25] || (L[25] = (w) => a("chart-mouseenter", w)),
1587
- onMouseleave: rn
1588
- }, {
1589
- header: V(() => [
1590
- G("div", ta, [
1591
- G("div", na, [
1592
- T.title ? (_(), I("h1", oa, oe(T.title), 1)) : C("", !0),
1593
- G("div", aa, [
1594
- B(T.$slots, "controls", {}, void 0, !0)
1595
- ])
1596
- ]),
1597
- G("div", la, [
1598
- b.value ? (_(), I("h3", ra, oe(Le.value), 1)) : C("", !0),
1599
- B(T.$slots, "legend", { data: d(O) }, () => [
1600
- d(p).withLegend !== !1 && d(p).legendPosition !== "bottom" ? (_(), Y(d(Nt), {
1601
- key: 0,
1602
- data: d(O),
1603
- class: "lume-chart__legend",
1604
- "data-j-lume-chart__legend": "",
1605
- onClick: L[0] || (L[0] = (w) => a("legend-click", w)),
1606
- onMouseenter: L[1] || (L[1] = (w) => a("legend-mouseenter", w)),
1607
- onMouseleave: L[2] || (L[2] = (w) => a("legend-mouseleave"))
1608
- }, null, 8, ["data"])) : C("", !0)
1609
- ], !0)
1610
- ])
1611
- ])
1612
- ]),
1613
- footer: V(() => [
1614
- $e.value ? (_(), I("h3", sa, oe(pe.value), 1)) : C("", !0),
1615
- d(p).withLegend !== !1 && d(p).legendPosition == "bottom" ? (_(), Y(d(Nt), {
1616
- key: 1,
1617
- data: d(O),
1618
- class: "lume-chart__legend lume-chart__legend--bottom",
1619
- "data-j-lume-chart__legend": "",
1620
- onClick: L[16] || (L[16] = (w) => a("legend-click", w)),
1621
- onMouseenter: L[17] || (L[17] = (w) => a("legend-mouseenter", w)),
1622
- onMouseleave: L[18] || (L[18] = (w) => a("legend-mouseleave"))
1623
- }, null, 8, ["data"])) : C("", !0)
1624
- ]),
1625
- extra: V(() => [
1626
- B(T.$slots, "tooltip", j(d(Ee), {
1627
- data: d(O),
1628
- labels: d(N),
1629
- title: d(N)[u.value],
1630
- items: d(Ne)(u.value),
1631
- position: De.value,
1632
- withTooltip: d(p).withTooltip !== !1,
1633
- hoveredIndex: u.value,
1634
- handleMouseEnter: () => A.value = !0,
1635
- handleMouseLeave: () => A.value = !1,
1636
- options: d(p).tooltipOptions
1637
- }), () => [
1638
- d(p).withTooltip !== !1 ? (_(), Y(d(Fo), j({ key: 0 }, d(Ee), {
1639
- position: De.value,
1640
- title: d(N)[u.value],
1641
- items: d(Ne)(u.value),
1642
- options: d(p).tooltipOptions,
1643
- "data-j-lume-chart__tooltip": "",
1644
- onOpened: L[19] || (L[19] = (w) => a("tooltip-opened", {
1645
- index: u.value,
1646
- targetElement: w
1647
- })),
1648
- onMoved: L[20] || (L[20] = (w) => a("tooltip-moved", {
1649
- index: u.value,
1650
- targetElement: w
1651
- })),
1652
- onClosed: L[21] || (L[21] = (w) => a("tooltip-closed")),
1653
- onTooltipMouseenter: L[22] || (L[22] = (w) => A.value = !0),
1654
- onTooltipMouseleave: L[23] || (L[23] = (w) => A.value = !1)
1655
- }), {
1656
- default: V(() => [
1657
- B(T.$slots, "tooltip-content", {
1658
- data: d(O),
1659
- labels: d(N),
1660
- hoveredIndex: u.value
1661
- }, void 0, !0)
1662
- ]),
1663
- _: 3
1664
- }, 16, ["position", "title", "items", "options"])) : C("", !0)
1665
- ], !0)
1666
- ]),
1667
- default: V(() => [
1668
- h.value ? (_(), I(q, { key: 0 }, [
1669
- d(M) ? (_(), Y(d(dt), j({ key: 0 }, d(z), {
1670
- "class-list": "lume-fill--negative",
1671
- transition: !1,
1672
- "data-j-lume-chart__negative-values": ""
1673
- }), null, 16)) : C("", !0),
1674
- d(p).withAxes !== !1 ? B(T.$slots, "axes", {
1675
- key: 1,
1676
- xScale: F.value,
1677
- yScale: Q.value,
1678
- containerSize: d(D),
1679
- options: d(p),
1680
- hoveredIndex: u.value
1681
- }, () => [
1682
- ue(d(Lt), {
1683
- type: "x",
1684
- scale: F.value,
1685
- "container-size": d(D),
1686
- options: J.value,
1687
- "hovered-index": u.value,
1688
- orientation: d(s),
1689
- "data-j-lume-chart__x-axis": "",
1690
- onClick: bt,
1691
- onMouseenter: kt,
1692
- onMouseleave: L[3] || (L[3] = (w) => a("axis-mouseleave")),
1693
- "onLume__internal-AxisSize": L[4] || (L[4] = (w) => $.value = w)
1694
- }, null, 8, ["scale", "container-size", "options", "hovered-index", "orientation"]),
1695
- ue(d(Lt), {
1696
- type: "y",
1697
- scale: Q.value,
1698
- "container-size": d(D),
1699
- options: se.value,
1700
- "hovered-index": u.value,
1701
- orientation: d(s),
1702
- "data-j-lume-chart__y-axis": "",
1703
- onClick: bt,
1704
- onMouseenter: kt,
1705
- onMouseleave: L[5] || (L[5] = (w) => a("axis-mouseleave")),
1706
- "onLume__internal-AxisSize": L[6] || (L[6] = (w) => k.value = w)
1707
- }, null, 8, ["scale", "container-size", "options", "hovered-index", "orientation"])
1708
- ], !0) : C("", !0),
1709
- d(p).withHover !== !1 ? (_(), Y(d(zo), {
1710
- key: 2,
1711
- data: d(O),
1712
- orientation: d(s),
1713
- "x-scale": F.value,
1714
- "y-scale": Q.value,
1715
- "data-j-lume-chart__overlay-group": "",
1716
- "onLume__internal-Hover": je
1717
- }, null, 8, ["data", "orientation", "x-scale", "y-scale"])) : C("", !0),
1718
- d(le) ? (_(), I("g", ua, [
1719
- (_(!0), I(q, null, W(g.value, (w, Ye) => (_(), I("circle", j(w, {
1720
- ref_for: !0,
1721
- ref_key: "tooltipAnchor",
1722
- ref: f,
1723
- key: `anchor_${Ye}`,
1724
- r: d(Sn),
1725
- class: "lume-fill--transparent"
1726
- }), null, 16, ia))), 128))
1727
- ])) : C("", !0),
1728
- B(T.$slots, "groups", {
1729
- data: d(O),
1730
- labels: d(N),
1731
- options: d(p),
1732
- orientation: d(s),
1733
- xScale: F.value,
1734
- yScale: Q.value,
1735
- hoveredIndex: u.value,
1736
- containerSize: d(D),
1737
- transition: d(p).withTransition !== !1,
1738
- classList: T.classList,
1739
- onNodeClick: L[7] || (L[7] = (w) => a("node-click", w)),
1740
- onNodeMouseenter: L[8] || (L[8] = (w) => a("node-mouseenter", w)),
1741
- onNodeMouseleave: L[9] || (L[9] = (w) => a("node-mouseleave", w)),
1742
- onLinkClick: L[10] || (L[10] = (w) => a("link-click", w)),
1743
- onLinkMouseenter: L[11] || (L[11] = (w) => a("link-mouseenter", w)),
1744
- onLinkMouseleave: L[12] || (L[12] = (w) => a("link-mouseleave", w)),
1745
- onBarClick: L[13] || (L[13] = (w) => a("bar-click", w)),
1746
- onLineClick: L[14] || (L[14] = (w) => a("line-click", w)),
1747
- onPointClick: L[15] || (L[15] = (w) => a("point-click", w)),
1748
- "onLume__internal-Hover": je
1749
- }, void 0, !0)
1750
- ], 64)) : C("", !0)
1751
- ]),
1752
- _: 3
1753
- }, 8, ["id", "margins", "container-size", "no-min-size", "transparent-background", "orientation"]));
1754
- }
1755
- }), xe = /* @__PURE__ */ ee(ca, [["__scopeId", "data-v-17c48844"]]), Ht = 8, da = 8, va = 20, He = 2, Bt = 2, ma = ["dy", "dominant-baseline"], fa = ["y", "x", "width", "height"], pa = { class: "lume-alluvial-group__label-wrapper" }, ha = /* @__PURE__ */ Z({
1756
- __name: "lume-alluvial-node-label",
1757
- props: {
1758
- bottom: { type: Boolean, default: !1 },
1759
- left: { type: Boolean, default: !1 },
1760
- maxWidth: { type: Number, default: 0 }
1761
- },
1762
- emits: ["lume__internal--node-resize"],
1763
- setup(e, { emit: n }) {
1764
- const t = e, o = n, a = R(null), r = R(t.maxWidth), l = R(1);
1765
- return X(
1766
- [a, () => t.maxWidth],
1767
- async ([i, c]) => {
1768
- if (i && c) {
1769
- r.value = c, await Qe();
1770
- const { width: s, height: m } = i.getBoundingClientRect();
1771
- r.value = s + Bt > c ? c : s + Bt, l.value = Math.ceil(m);
1772
- }
1773
- },
1774
- { immediate: !0 }
1775
- ), X(r, async (i) => {
1776
- i !== t.maxWidth && (await Qe(), o("lume__internal--node-resize"));
1777
- }), (i, c) => e.maxWidth ? (_(), I("foreignObject", {
1778
- key: 1,
1779
- class: "lume-alluvial-group__node-foreign",
1780
- y: e.bottom ? "0.1em" : -l.value + 1,
1781
- x: e.left ? -r.value : 0,
1782
- width: r.value,
1783
- height: l.value
1784
- }, [
1785
- G("div", pa, [
1786
- G("span", {
1787
- ref_key: "text",
1788
- ref: a,
1789
- class: "lume-alluvial-group__node-label"
1790
- }, [
1791
- B(i.$slots, "default", {}, void 0, !0)
1792
- ], 512)
1793
- ])
1794
- ], 8, fa)) : (_(), I("text", {
1795
- key: 0,
1796
- class: "lume-alluvial-group__node-label",
1797
- dy: e.bottom ? ".2em" : "-.2em",
1798
- "dominant-baseline": e.bottom ? "hanging" : "auto"
1799
- }, [
1800
- B(i.$slots, "default", {}, void 0, !0)
1801
- ], 8, ma));
1802
- }
1803
- }), ga = /* @__PURE__ */ ee(ha, [["__scopeId", "data-v-7126dfdb"]]), ya = ["y", "dominant-baseline"], _a = /* @__PURE__ */ Z({
1804
- __name: "lume-alluvial-node-value",
1805
- props: {
1806
- bottom: { type: Boolean, default: !0 }
1807
- },
1808
- setup(e) {
1809
- return (n, t) => (_(), I("text", {
1810
- class: "lume-alluvial-group__node-value",
1811
- y: e.bottom ? ".2em" : "-.2em",
1812
- "dominant-baseline": e.bottom ? "hanging" : "auto"
1813
- }, [
1814
- B(n.$slots, "default", {}, void 0, !0)
1815
- ], 8, ya));
1816
- }
1817
- }), ka = /* @__PURE__ */ ee(_a, [["__scopeId", "data-v-b4fc758b"]]), ba = ["transform"], Aa = ["transform"], Ta = ["transform"], La = /* @__PURE__ */ Z({
1818
- __name: "lume-alluvial-node-header",
1819
- props: {
1820
- x: { type: Number, required: !0 },
1821
- y: { type: Number, required: !0 }
1822
- },
1823
- setup(e) {
1824
- const n = R(null), t = v(
1825
- () => n.value && `translate(${-n.value.getBBox().width / 2}, 0)`
1826
- ), o = v(
1827
- () => n.value && `translate(${n.value.getBBox().width / 2}, 0)`
1828
- );
1829
- return (a, r) => (_(), I("g", {
1830
- transform: `translate(${e.x}, ${e.y})`
1831
- }, [
1832
- G("g", { transform: t.value }, [
1833
- B(a.$slots, "before", {}, void 0, !0)
1834
- ], 8, Aa),
1835
- G("text", {
1836
- ref_key: "textRef",
1837
- ref: n,
1838
- class: "lume-alluvial-group__node-header lume-typography--caption"
1839
- }, [
1840
- B(a.$slots, "default", {}, void 0, !0)
1841
- ], 512),
1842
- G("g", { transform: o.value }, [
1843
- B(a.$slots, "after", {}, void 0, !0)
1844
- ], 8, Ta)
1845
- ], 8, ba));
1846
- }
1847
- }), $a = /* @__PURE__ */ ee(La, [["__scopeId", "data-v-0e483453"]]);
1848
- function Mt(e, n) {
1849
- return {
1850
- x0: 0 + (n ? n.left : 0),
1851
- y0: 0 + (n ? n.top : 0),
1852
- x1: e.width - (n ? n.right : 0),
1853
- y1: e.height - (n ? n.bottom : 0)
1854
- };
1855
- }
1856
- function Oa(e) {
1857
- const n = R(Mt(e));
1858
- function t(o) {
1859
- n.value = Mt(e, o);
1860
- }
1861
- return { extents: n, updateExtents: t };
1862
- }
1863
- var Pe = /* @__PURE__ */ ((e) => (e.GraphProblem = "There was an issue generating your alluvial graph.", e.BarScaleDomainAbove0 = "Bar linear scale domain cannot start above 0!", e.BarScaleNull = "Bar linear scale cannot be `null`", e))(Pe || {});
1864
- const Ia = "[lume] ";
1865
- function rt(e, n, t = !0) {
1866
- t && Ft() || console.error(Ia + "Error: " + e, n);
1867
- }
1868
- const wa = 200;
1869
- function Ie(e) {
1870
- return typeof e == "string" || typeof e == "number" ? e : e.id ?? e.label;
1871
- }
1872
- function xa(e, n) {
1873
- return n.nodes.find((t) => t.id === e);
1874
- }
1875
- function Ea(e, n) {
1876
- return n.links.find((t) => t.id === e);
1877
- }
1878
- function tn(e) {
1879
- return !!(e.sourceLinks && e.targetLinks);
1880
- }
1881
- function Na(e, n) {
1882
- if (!n) return;
1883
- const t = e.nodes.filter((l) => l.targetLinks.length === 0).map((l) => `${l.id}`), o = e.nodes.filter((l) => l.sourceLinks.length === 0).map((l) => `${l.id}`), a = n.filter((l) => t.includes(l.dataset.id)).reduce(
1884
- (l, i) => Math.max(l, i.getBBox().width),
1885
- -1 / 0
1886
- ), r = n.filter((l) => o.includes(l.dataset.id)).reduce(
1887
- (l, i) => Math.max(l, i.getBBox().width),
1888
- -1 / 0
1889
- );
1890
- return {
1891
- left: a,
1892
- top: 0,
1893
- right: r,
1894
- bottom: 0
1895
- };
1896
- }
1897
- function Da(e) {
1898
- return e.map((n) => {
1899
- const t = n.y1 - n.y0 < He;
1900
- return {
1901
- x: n.x0,
1902
- y: n.y0 - (t ? He / 2 : 0),
1903
- // Negative offset to account for the min. height
1904
- width: n.x1 - n.x0,
1905
- height: t ? He : n.y1 - n.y0,
1906
- textTransform: {
1907
- x: n.depth > 0 ? n.x1 + Ht : n.x0 - Ht,
1908
- y: (n.y1 + n.y0) / 2
1909
- },
1910
- node: n
1911
- };
1912
- });
1913
- }
1914
- function Ha(e) {
1915
- return [e.source.x1, e.y0];
1916
- }
1917
- function Ba(e) {
1918
- return [e.target.x0, e.y1];
1919
- }
1920
- function Ma(e) {
1921
- return e.curveFunction ? gn(e.curveFunction).source(Ha).target(Ba) : vn();
1922
- }
1923
- function Ra(e) {
1924
- return e.map((n) => {
1925
- var t;
1926
- return {
1927
- id: n.id,
1928
- color: n.color || ((t = n.source) == null ? void 0 : t.color) || Se,
1929
- d: Ma(n)(n),
1930
- strokeWidth: Math.max(1, n.width),
1931
- link: n
1932
- };
1933
- });
1934
- }
1935
- function Rt(e, n, t, o, a) {
1936
- if (o === !1) {
1937
- e.node = {
1938
- ...e.node,
1939
- transitionValue: a ? void 0 : t
1940
- };
1941
- return;
1942
- }
1943
- const r = Date.now(), l = Nn(n, t), i = () => {
1944
- let s = (Date.now() - r) / wa;
1945
- s > 1 && (s = 1), e.node = {
1946
- ...e.node,
1947
- transitionValue: a && s === 1 ? void 0 : l(s)
1948
- }, s < 1 && requestAnimationFrame(i);
1949
- };
1950
- requestAnimationFrame(i);
1951
- }
1952
- const Ga = {
1953
- nodes: [],
1954
- links: []
1955
- };
1956
- function Gt(e, n) {
1957
- return n.find((t) => t.every((o) => o.x0 === e.x0));
1958
- }
1959
- function Sa(e, n, t) {
1960
- const o = R(null), a = v(() => {
1961
- var u, f;
1962
- return (f = (u = e.value) == null ? void 0 : u[0]) == null ? void 0 : f.values.map(
1963
- ({ label: y, color: g, value: A, deriveColorFromIncomingLinks: $, offset: k }) => ({
1964
- label: y || A.toString(),
1965
- color: g,
1966
- fallbackColor: g || Se,
1967
- id: A,
1968
- deriveColorFromIncomingLinks: $,
1969
- offset: k
1970
- })
1971
- );
1972
- }), r = v(
1973
- () => {
1974
- var u, f;
1975
- return (f = (u = e.value) == null ? void 0 : u[0]) == null ? void 0 : f.values.map(
1976
- (y) => {
1977
- var g;
1978
- return (g = y.targets) == null ? void 0 : g.map(
1979
- ({ node: A, value: $, color: k, curveFunction: p }) => ({
1980
- id: `${y.value}:${A}`,
1981
- color: k,
1982
- curveFunction: p,
1983
- source: y.value ?? y.label,
1984
- target: A,
1985
- value: $
1986
- })
1987
- );
1988
- }
1989
- ).filter(Boolean).flat();
1990
- }
1991
- ), l = v(() => mn().nodeId(Ie).nodeAlign(n.value.nodeAlign).nodePadding(n.value.nodePadding).nodeSort(n.value.nodeSort).nodeWidth(n.value.nodeWidth).linkSort(n.value.linkSort).iterations(n.value.iterations)), i = v(() => {
1992
- var u;
1993
- return (u = o.value) == null ? void 0 : u.nodes.reduce(
1994
- (f, y) => {
1995
- const g = Gt(y, f);
1996
- return g ? (g.push(y), g.sort((A, $) => (A._y0 || A.y0) - ($._y0 || $.y0))) : f.push([y]), f;
1997
- },
1998
- []
1999
- );
2000
- });
2001
- function c(u) {
2002
- const { offset: f } = u, y = Gt(u, i.value);
2003
- if (!y) return;
2004
- const g = y[y.findIndex(($) => $.id === u.id) - 1], A = g && y.length !== 1 ? g.y1 + f : f;
2005
- u._y0 = u.y0, u._y1 = u.y1, u.y0 = A, u.y1 = u.y0 + (u._y1 - u._y0);
2006
- }
2007
- function s(u, f) {
2008
- const { id: y, _y0: g, y0: A } = u, $ = f.links.filter(
2009
- (O) => O.source.id === y
2010
- ), k = f.links.filter(
2011
- (O) => O.target.id === y
2012
- ), p = A - g;
2013
- $.forEach((O) => O.y0 += p), k.forEach((O) => O.y1 += p);
2014
- }
2015
- const m = v(() => {
2016
- var u;
2017
- return o.value && ((u = a.value) == null || u.forEach((f) => {
2018
- f.value === 0 && (f.fallbackColor = mt.Grey), typeof f.offset == "number" && (c(f), s(f, o.value));
2019
- })), o.value;
2020
- });
2021
- return X([l, t], () => {
2022
- try {
2023
- const { x0: u, y0: f, x1: y, y1: g } = t.value;
2024
- o.value = l.value.extent([
2025
- [u, f],
2026
- [y, g]
2027
- ])({ nodes: a.value, links: r.value });
2028
- } catch (u) {
2029
- rt(Pe.GraphProblem, u), o.value = Ga;
2030
- }
2031
- }), { columns: i, graph: m };
2032
- }
2033
- function ut(e, n) {
2034
- return n || (n = {}), e.targetLinks && e.targetLinks.forEach(({ source: t, value: o }) => {
2035
- n[t.id] = o, ut(
2036
- t,
2037
- n
2038
- );
2039
- }), n;
2040
- }
2041
- function it(e, n) {
2042
- return n || (n = {}), e.sourceLinks && e.sourceLinks.forEach(({ target: t, value: o }) => {
2043
- n[t.id] = o, it(
2044
- t,
2045
- n
2046
- );
2047
- }), n;
2048
- }
2049
- function ja(e, n) {
2050
- return n.links.reduce((t, o) => (o.source.id in e && o.target.id in e && t.push(o.id), t), []);
2051
- }
2052
- const Va = (e, n) => {
2053
- let t;
2054
- tn(e) ? t = {
2055
- [e.id]: e.value,
2056
- ...ut(e),
2057
- ...it(e)
2058
- } : t = {
2059
- [e.source.id]: e.source.value,
2060
- [e.target.id]: e.target.value,
2061
- ...ut(e.source),
2062
- ...it(e.target)
2063
- };
2064
- const o = ja(t, n);
2065
- return { nodes: t, links: o };
2066
- }, Pa = (e) => {
2067
- if (tn(e)) {
2068
- const n = [...e.sourceLinks, ...e.targetLinks];
2069
- return {
2070
- nodes: n.reduce(
2071
- (t, { source: o, target: a, value: r }) => o === e ? { ...t, [Ie(a)]: r } : { ...t, [Ie(o)]: r },
2072
- { [Ie(e)]: e.value }
2073
- ),
2074
- links: n.map(({ id: t }) => t)
2075
- };
2076
- }
2077
- return {
2078
- nodes: {
2079
- [Ie(e.target)]: e.value,
2080
- [Ie(e.source)]: e.source.value
2081
- },
2082
- links: [e.id]
2083
- };
2084
- };
2085
- function Fa(e, n, t) {
2086
- const o = R(null), a = v(() => o.value ? typeof n.value.highlightedElements == "function" ? n.value.highlightedElements(
2087
- o.value,
2088
- t.value
2089
- ) : n.value.highlightedElements === "closest" ? Pa(o.value, t.value) : Va(o.value, t.value) : { nodes: {}, links: [] });
2090
- return X(a, (r, l) => {
2091
- if (r.links.length === 0 && Object.keys(r.nodes).length === 0) {
2092
- e.value.forEach((i) => {
2093
- i.node.id in l.nodes && Rt(
2094
- i,
2095
- l.nodes[i.node.id],
2096
- i.node.value,
2097
- n.value.withTransition,
2098
- !0
2099
- );
2100
- });
2101
- return;
2102
- }
2103
- e.value.forEach((i) => {
2104
- i.node.id in r.nodes && Rt(
2105
- i,
2106
- i.node.value,
2107
- r.nodes[i.node.id],
2108
- n.value.withTransition
2109
- );
2110
- });
2111
- }), { highlightedElements: a, hoveredElement: o };
2112
- }
2113
- const Ca = {
2114
- class: "lume-alluvial-group",
2115
- "data-j-alluvial-group": ""
2116
- }, za = { key: 0 }, Wa = { key: 0 }, Za = ["id", "x1", "x2"], Ua = ["stop-color"], Xa = ["stop-color"], Ya = ["d", "stroke-width", "onClick", "onMouseover"], Ka = ["d", "stroke", "stroke-dasharray", "stroke-dashoffset", "stroke-width", "data-id", "onClick", "onMouseover"], Ja = ["onClick", "onMouseenter", "onMouseleave", "onMouseover"], Qa = ["x", "y", "height", "width"], qa = ["transform", "data-id", "width"], el = /* @__PURE__ */ Z({
2117
- __name: "lume-alluvial-group",
2118
- props: {
2119
- ...We(),
2120
- hoveredElementId: {
2121
- type: [Number, String],
2122
- default: null
2123
- }
2124
- },
2125
- emits: ["node-click", "node-mouseenter", "node-mouseleave", "link-click", "link-mouseenter", "link-mouseleave"],
2126
- setup(e, { emit: n }) {
2127
- const t = e, o = n, a = Fe("chartID"), { data: r, options: l } = te(t), i = R([]), c = R([]), s = R(null), { extents: m, updateExtents: u } = Oa(t.containerSize), { columns: f, graph: y } = Sa(r, l, m), { hoveredElement: g, highlightedElements: A } = Fa(
2128
- i,
2129
- l,
2130
- y
2131
- ), $ = v(() => Ve(l.value.valueFormat)), k = v(
2132
- () => Object.keys(A.value.nodes)
2133
- ), p = v(() => f.value ? f.value.map(
2134
- (b) => b[0].x0 + l.value.nodeWidth / 2
2135
- ) : []), O = v(() => {
2136
- if (!(!l.value.nodeHeaders || !l.value.nodeHeaders.length))
2137
- return l.value.nodeHeaders.slice(0, p.value.length).map((b, x) => ({
2138
- label: b,
2139
- x: p.value[x]
2140
- }));
2141
- }), N = v(
2142
- () => l.value.nodeHeaderPadding ?? va
2143
- ), D = v(() => {
2144
- if (!(!l.value.gradient || !y.value))
2145
- return y.value.links.reduce((b, x) => {
2146
- const { source: h, target: M } = x, z = h.color || h.fallbackColor, le = M.deriveColorFromIncomingLinks ? z : M.color || M.fallbackColor;
2147
- return b[x.id] = {
2148
- source: z,
2149
- target: le,
2150
- x1: h.x1,
2151
- x2: M.x0
2152
- }, b;
2153
- }, {});
2154
- }), P = v(() => {
2155
- const b = i.value.filter(
2156
- (h) => Q(h)
2157
- ), x = [];
2158
- return b.forEach((h) => {
2159
- const M = [];
2160
- c.value.filter(({ link: z }) => z.target.id === h.node.id).reverse().reduce((z, le, Ee, Ze) => {
2161
- const Ue = le.link.target.y1 - le.link.target.y0 > He;
2162
- let Ne, De, Oe;
2163
- return Ue ? (Ne = le.link.target.y1 - le.link.target.y0, De = le.link.value / h.node.value, Oe = De * Ne) : Oe = He / Ze.length, M.push({
2164
- x: h.x,
2165
- y: h.y + z,
2166
- height: Oe,
2167
- width: h.width,
2168
- key: `node-block-${h.node.id}-source-link-${le.link.source.id}`,
2169
- class: `lume-alluvial-group__node-block lume-fill--${le.link.source.color || Se}`
2170
- }), z + Oe;
2171
- }, 0), x.push({
2172
- id: h.node.id,
2173
- subNodes: M
2174
- });
2175
- }), x;
2176
- });
2177
- function S(b) {
2178
- return l.value.gradient && `url('#${a}_${b.id}')`;
2179
- }
2180
- function E(b) {
2181
- return k.value.length > 0 && !k.value.includes(b.toString());
2182
- }
2183
- function K(b) {
2184
- return k.value.length > 0 && k.value.includes(b.toString());
2185
- }
2186
- function U(b) {
2187
- return A.value.links.length > 0 && !A.value.links.includes(b);
2188
- }
2189
- function F(b) {
2190
- return A.value.links.length > 0 && A.value.links.includes(b);
2191
- }
2192
- function Q(b) {
2193
- return !b.node.color && b.node.deriveColorFromIncomingLinks;
2194
- }
2195
- function J(b, x) {
2196
- b !== g.value && (g.value = b, o("link-mouseenter", { link: b, event: x }));
2197
- }
2198
- function se(b) {
2199
- const x = g.value;
2200
- g.value = null, o("link-mouseleave", { link: x, event: b });
2201
- }
2202
- function pe(b) {
2203
- if (b == null) {
2204
- g.value = null;
2205
- return;
2206
- }
2207
- const x = xa(b, y.value) || Ea(b, y.value);
2208
- if (!x) {
2209
- ye(me.InvalidHoveredElement);
2210
- return;
2211
- }
2212
- g.value = x;
2213
- }
2214
- function Le(b) {
2215
- var x;
2216
- return ((x = P.value.find(({ id: h }) => b === h)) == null ? void 0 : x.subNodes) ?? [];
2217
- }
2218
- function $e() {
2219
- const b = Na(y.value, s.value);
2220
- u(b);
2221
- }
2222
- return X(y, (b) => {
2223
- i.value = Da(b.nodes), c.value = Ra(b.links).reverse(), g.value == null && t.hoveredElementId != null && pe(t.hoveredElementId);
2224
- }), X([t.containerSize, s], () => {
2225
- t.containerSize.width && t.containerSize.height && $e();
2226
- }), X(() => t.hoveredElementId, pe), (b, x) => (_(), I("g", Ca, [
2227
- O.value ? (_(), I("g", za, [
2228
- (_(!0), I(q, null, W(O.value, (h, M) => B(b.$slots, `node-header-${M}`, {
2229
- x: h.x,
2230
- y: -N.value
2231
- }, () => [
2232
- (_(), Y(d($a), {
2233
- key: `header_${h.x}`,
2234
- x: h.x,
2235
- y: -N.value
2236
- }, {
2237
- default: V(() => [
2238
- ce(oe(h.label), 1)
2239
- ]),
2240
- _: 2
2241
- }, 1032, ["x", "y"]))
2242
- ], !0)), 256))
2243
- ])) : C("", !0),
2244
- G("g", {
2245
- class: "lume-alluvial-link-group",
2246
- onMouseleave: se
2247
- }, [
2248
- d(l).gradient ? (_(), I("defs", Wa, [
2249
- (_(!0), I(q, null, W(D.value, (h, M) => (_(), I("linearGradient", {
2250
- id: `${d(a)}_${M}`,
2251
- key: M,
2252
- gradientUnits: "userSpaceOnUse",
2253
- x1: h.x1,
2254
- x2: h.x2
2255
- }, [
2256
- G("stop", {
2257
- offset: "0%",
2258
- "stop-color": `var(--lume-color--${h.source})`
2259
- }, null, 8, Ua),
2260
- G("stop", {
2261
- offset: "100%",
2262
- "stop-color": `var(--lume-color--${h.target})`
2263
- }, null, 8, Xa)
2264
- ], 8, Za))), 128))
2265
- ])) : C("", !0),
2266
- (_(!0), I(q, null, W(c.value, (h) => (_(), I("path", {
2267
- key: `link-ghost_${h.id}`,
2268
- class: ne(["lume-alluvial-group__link", [
2269
- "lume-stroke--transparent",
2270
- "lume-alluvial-group__link--ghost"
2271
- ]]),
2272
- d: h.d,
2273
- "stroke-width": h.strokeWidth + d(da),
2274
- "data-j-alluvial-ghost": "",
2275
- onClick: (M) => o("link-click", { link: h.link, event: M }),
2276
- onMouseover: (M) => J(h.link, M)
2277
- }, null, 40, Ya))), 128)),
2278
- (_(!0), I(q, null, W(c.value, (h) => (_(), I("path", {
2279
- key: `link_${h.id}`,
2280
- class: ne(["lume-alluvial-group__link", {
2281
- [`lume-stroke--${h.color}`]: !d(l).gradient && h.color,
2282
- "lume-alluvial-group__link--faded": U(h.id),
2283
- "lume-alluvial-group__link--focused": F(h.id)
2284
- }]),
2285
- d: h.d,
2286
- stroke: S(h.link),
2287
- "stroke-dasharray": b.containerSize.width,
2288
- "stroke-dashoffset": b.containerSize.width,
2289
- "stroke-width": h.strokeWidth,
2290
- "data-j-alluvial-path": "",
2291
- "data-id": h.id,
2292
- onClick: (M) => o("link-click", { link: h.link, event: M }),
2293
- onMouseover: (M) => J(h.link, M)
2294
- }, null, 42, Ka))), 128))
2295
- ], 32),
2296
- (_(!0), I(q, null, W(i.value, (h, M) => (_(), I("g", {
2297
- key: `node-block_${M}`,
2298
- class: ne(["lume-alluvial-group__node", {
2299
- "lume-alluvial-group__node--faded": E(h.node.id),
2300
- "lume-alluvial-group__node--focused": K(h.node.id)
2301
- }]),
2302
- "data-j-alluvial-group__node-block": ""
2303
- }, [
2304
- G("g", {
2305
- onClick: (z) => o("node-click", { node: h.node, event: z }),
2306
- onMouseenter: (z) => o("node-mouseenter", { node: h.node, event: z }),
2307
- onMouseleave: (z) => o("node-mouseleave", { node: h.node, event: z }),
2308
- onMouseover: (z) => g.value = h.node,
2309
- onMouseout: x[0] || (x[0] = (z) => g.value = null)
2310
- }, [
2311
- Q(h) ? (_(!0), I(q, { key: 0 }, W(Le(
2312
- h.node.id
2313
- ), (z) => (_(), I("rect", j(z, {
2314
- key: z.key,
2315
- "data-j-alluvial-sub-nodes": ""
2316
- }), null, 16))), 128)) : (_(), I("rect", {
2317
- key: 1,
2318
- class: ne(["lume-alluvial-group__node-block", `lume-fill--${h.node.color || h.node.fallbackColor}`]),
2319
- x: h.x,
2320
- y: h.y,
2321
- height: h.height,
2322
- width: h.width
2323
- }, null, 10, Qa)),
2324
- G("g", {
2325
- ref_for: !0,
2326
- ref_key: "nodeTextRefs",
2327
- ref: s,
2328
- class: ne(["lume-alluvial-group__node-text lume-typography--caption", {
2329
- "lume-alluvial-group__node-text--left": h.node.depth === 0
2330
- }]),
2331
- transform: `translate(${h.textTransform.x},${h.textTransform.y})`,
2332
- "data-id": h.node.id,
2333
- width: d(l).nodeLabelMaxWidth
2334
- }, [
2335
- B(b.$slots, `node-text-${h.node.id}`, {
2336
- node: h.node,
2337
- value: $.value(
2338
- h.node.transitionValue || h.node.value,
2339
- h.node.value
2340
- )
2341
- }, () => [
2342
- ue(d(ga), {
2343
- bottom: d(l).switchText,
2344
- left: h.node.depth === 0,
2345
- "max-width": d(l).nodeLabelMaxWidth,
2346
- "onLume__internal-NodeResize": $e
2347
- }, {
2348
- default: V(() => [
2349
- ce(oe(h.node.label), 1)
2350
- ]),
2351
- _: 2
2352
- }, 1032, ["bottom", "left", "max-width"]),
2353
- ue(d(ka), {
2354
- bottom: !d(l).switchText
2355
- }, {
2356
- default: V(() => [
2357
- ce(oe($.value(
2358
- h.node.transitionValue || h.node.value,
2359
- h.node.value
2360
- )), 1)
2361
- ]),
2362
- _: 2
2363
- }, 1032, ["bottom"])
2364
- ], !0)
2365
- ], 10, qa)
2366
- ], 40, Ja)
2367
- ], 2))), 128))
2368
- ]));
2369
- }
2370
- }), tl = /* @__PURE__ */ ee(el, [["__scopeId", "data-v-2a790ee0"]]), nl = {
2371
- margins: {
2372
- top: 0,
2373
- right: 0,
2374
- bottom: 0,
2375
- left: 0
2376
- },
2377
- withAxes: !1,
2378
- withTooltip: !1,
2379
- withHover: !1,
2380
- withLegend: !1,
2381
- // Alluvial options
2382
- gradient: !1,
2383
- highlightedElements: "closest",
2384
- nodePadding: 16,
2385
- nodeWidth: 16,
2386
- nodeAlign: fn,
2387
- valueFormat: (e) => String(e),
2388
- iterations: 6
2389
- }, Zl = /* @__PURE__ */ Z({
2390
- __name: "lume-alluvial-diagram",
2391
- props: {
2392
- ...fo(st)
2393
- },
2394
- setup(e, { emit: n }) {
2395
- const t = e, { componentEventPropagator: o } = ke(), a = Te(re()), r = Hn(re()), { options: l } = te(t), { allOptions: i } = fe(l, nl);
2396
- function c(s) {
2397
- return {
2398
- ...s,
2399
- noBaseScales: !0
2400
- // Alluvial chart never uses base scales
2401
- };
2402
- }
2403
- return (s, m) => (_(), Y(d(xe), j({ ...t, ...s.$attrs }, {
2404
- options: c(d(i)),
2405
- "data-j-alluvial-diagram": ""
2406
- }, ae(d(o))), de({
2407
- groups: V((u) => [
2408
- ue(d(tl), j(u, { "hovered-element-id": s.hoveredElement }, ae(d(o))), de({ _: 2 }, [
2409
- W(d(r), (f, y) => ({
2410
- name: y,
2411
- fn: V((g) => [
2412
- B(s.$slots, y, he(ge(g || {})))
2413
- ])
2414
- }))
2415
- ]), 1040, ["hovered-element-id"])
2416
- ]),
2417
- _: 2
2418
- }, [
2419
- W(d(a), (u, f) => ({
2420
- name: f,
2421
- fn: V((y) => [
2422
- B(s.$slots, f, he(ge(y || {})))
2423
- ])
2424
- }))
2425
- ]), 1040, ["options"]));
2426
- }
2427
- });
2428
- var nn = /* @__PURE__ */ ((e) => (e.grouped = "grouped", e.stacked = "stacked", e))(nn || {});
2429
- const Ul = /* @__PURE__ */ Z({
2430
- __name: "lume-bar-chart",
2431
- props: {
2432
- ...we(),
2433
- type: {
2434
- type: String,
2435
- default: null,
2436
- validator: (e) => e in nn || e == null
2437
- }
2438
- },
2439
- setup(e, { emit: n }) {
2440
- const t = Je(
2441
- () => import("./EIr2w3Kr.js")
2442
- ), o = Je(
2443
- () => import("./DZ46vFew.js")
2444
- ), a = Je(
2445
- () => import("./D9nPdsLp.js")
2446
- ), r = /* @__PURE__ */ new Map([
2447
- ["single", t],
2448
- ["grouped", o],
2449
- ["stacked", a]
2450
- ]), l = e, { componentEventPropagator: i } = ke(), c = Te(re());
2451
- function s(u) {
2452
- return {
2453
- ...u,
2454
- startOnZero: !0,
2455
- // Bar chart always starts on zero,
2456
- tooltipOptions: {
2457
- ...(u == null ? void 0 : u.tooltipOptions) || {},
2458
- position: l.orientation === H.HORIZONTAL ? "right" : void 0
2459
- }
2460
- };
2461
- }
2462
- const m = v(() => {
2463
- if (st(l.data)) return r.get("single");
2464
- if (!l.type)
2465
- throw new Error("Bar chart needs a type when there's multiple datasets.");
2466
- return r.get(l.type);
2467
- });
2468
- return (u, f) => (_(), Y(dn(m.value), j({ ...l, ...u.$attrs }, {
2469
- options: s(u.options)
2470
- }, ae(d(i))), de({ _: 2 }, [
2471
- W(d(c), (y, g) => ({
2472
- name: g,
2473
- fn: V((A) => [
2474
- B(u.$slots, g, he(ge(A || {})))
2475
- ])
2476
- }))
2477
- ]), 1040, ["options"]));
2478
- }
2479
- });
2480
- function ol(e) {
2481
- return Object.values(Gn).includes(e) || e == null;
2482
- }
2483
- function al(e) {
2484
- return Object.values(H).includes(e);
2485
- }
2486
- const ll = (e = !1) => ({
2487
- type: {
2488
- type: String,
2489
- default: null,
2490
- validator: ol
2491
- },
2492
- ...e ? {
2493
- orientation: {
2494
- type: String,
2495
- default: H.VERTICAL,
2496
- validator: al
2497
- }
2498
- } : {}
2499
- });
2500
- function on(e, n) {
2501
- const t = v(() => e.value.map((a) => {
2502
- var r;
2503
- return {
2504
- ...a,
2505
- values: ct(
2506
- a.values,
2507
- ((r = n == null ? void 0 : n.value) == null ? void 0 : r.length) ?? 0
2508
- ).map((l) => ({
2509
- ...l,
2510
- value: (l == null ? void 0 : l.value) || 0
2511
- }))
2512
- };
2513
- })), o = v(() => {
2514
- var a;
2515
- return (a = t.value) == null ? void 0 : a.reduce((r, l) => (l.values.forEach((i, c) => {
2516
- r[c] ? r[c].push(i) : r[c] = [i];
2517
- }), r), []);
2518
- });
2519
- return { multiBarData: t, groupedData: o };
2520
- }
2521
- function rl(e, n) {
2522
- return e.value.length === 1 ? "single" : n.value;
2523
- }
2524
- function ul(e, n, t) {
2525
- const o = v(
2526
- () => t.value === H.HORIZONTAL
2527
- );
2528
- function a(i) {
2529
- i || rt(Pe.BarScaleNull), Math.min(...i.domain()) > 0 && rt(Pe.BarScaleDomainAbove0);
2530
- }
2531
- const r = v(() => o.value ? (a(e.value), e.value) : e.value), l = v(() => o.value ? n.value : (a(n.value), n.value));
2532
- return { barXScale: r, barYScale: l };
2533
- }
2534
- const il = {
2535
- x: 0,
2536
- y: 0,
2537
- width: 0,
2538
- height: 0
2539
- };
2540
- function sl(e, n, t, o, a, r) {
2541
- const l = v(
2542
- () => o.value === H.HORIZONTAL
2543
- );
2544
- function i(u, f) {
2545
- let y, g;
2546
- return l.value ? (y = u >= 0 ? n.value(0) : n.value(u), g = t.value(t.value.domain()[f])) : (y = n.value(n.value.domain()[f]), g = u < 0 ? t.value(0) : t.value(u)), { x: y, y: g };
2547
- }
2548
- function c(u) {
2549
- return l.value ? u < 0 ? n.value(0) - n.value(u) : n.value(u) - n.value(0) : n.value.bandwidth();
2550
- }
2551
- function s(u) {
2552
- return l.value ? t.value.bandwidth() : u < 0 ? t.value(u) - t.value(0) : t.value(0) - t.value(u);
2553
- }
2554
- function m(u, f, y) {
2555
- if (!(n.value && t.value)) return il;
2556
- const { value: A, color: $ } = u, k = $ ?? e.value[f].color ?? Se, { x: p, y: O } = i(A, y), N = c(A), D = s(A);
2557
- return {
2558
- classList: [`lume-fill--${k}`, ...r],
2559
- x: p,
2560
- y: O,
2561
- width: N,
2562
- height: D,
2563
- isFaded: a.value !== -1 && a.value !== y,
2564
- isNegative: A < 0
2565
- };
2566
- }
2567
- return { barAttributeGenerator: m };
2568
- }
2569
- const cl = {
2570
- x: 0,
2571
- y: 0,
2572
- width: 0,
2573
- height: 0
2574
- };
2575
- function dl(e, n, t, o, a, r) {
2576
- const l = v(
2577
- () => o.value === H.HORIZONTAL
2578
- ), i = v(() => Me().domain(e.value.map((g, A) => A)).range([0, n.value.bandwidth()]).padding(0)), c = v(() => Me().domain(e.value.map((g, A) => A)).range([0, t.value.bandwidth()]).padding(0));
2579
- function s(g, A, $) {
2580
- if (l.value)
2581
- return g >= 0 ? n.value(0) : n.value(g);
2582
- const k = n.value.domain();
2583
- return n.value(k[A]) + i.value($);
2584
- }
2585
- function m(g, A, $) {
2586
- if (l.value) {
2587
- const k = t.value.domain();
2588
- return t.value(k[A]) + c.value($);
2589
- }
2590
- return g < 0 ? t.value(0) : t.value(g);
2591
- }
2592
- function u(g) {
2593
- return l.value ? g < 0 ? n.value(0) - n.value(g) : n.value(g) - n.value(0) : i.value.bandwidth();
2594
- }
2595
- function f(g) {
2596
- return l.value ? c.value.bandwidth() : g < 0 ? t.value(g) - t.value(0) : t.value(0) - t.value(g);
2597
- }
2598
- function y(g, A, $) {
2599
- if (!(n.value && t.value)) return cl;
2600
- const { value: p, color: O } = g, N = O ?? e.value[A].color ?? Object.values(ie)[A], D = s(p, $, A), P = m(p, $, A), S = u(p), E = f(p);
2601
- return {
2602
- classList: [`lume-fill--${N}`, ...r],
2603
- x: D,
2604
- y: P,
2605
- width: S,
2606
- height: E,
2607
- isFaded: a.value !== -1 && a.value !== $,
2608
- isNegative: p < 0
2609
- };
2610
- }
2611
- return { barAttributeGenerator: y };
2612
- }
2613
- function vl(e, n, t) {
2614
- const o = v(
2615
- () => n.value === H.HORIZONTAL
2616
- ), a = v(() => {
2617
- const c = e.value.map(
2618
- (s) => s.filter((m) => m.value < 0).reduce((m, u) => m + u.value, 0)
2619
- );
2620
- return Math.min(...c);
2621
- }), r = v(() => {
2622
- const c = e.value.map(
2623
- (s) => s.reduce(
2624
- (m, u) => u.value >= 0 ? m + u.value : m,
2625
- 0
2626
- )
2627
- );
2628
- return Math.max(...c);
2629
- });
2630
- function l(c, s, m) {
2631
- return s.length ? o.value ? Be().domain([a.value, r.value]).range([0, m.width]) : Object.assign(
2632
- Et(
2633
- Me().domain(s.map((u, f) => f)).range([0, m.width]),
2634
- n.value,
2635
- t.value
2636
- ),
2637
- { labels: s }
2638
- ) : null;
2639
- }
2640
- function i(c, s, m) {
2641
- return s.length ? o.value ? Object.assign(
2642
- Et(
2643
- Me().domain(s.map((u, f) => f)).range([0, m.height]),
2644
- n.value,
2645
- t.value
2646
- ),
2647
- { labels: s }
2648
- ) : Be().domain([r.value, a.value]).range([0, m.height]) : null;
2649
- }
2650
- return { stackedXScaleGenerator: l, stackedYScaleGenerator: i };
2651
- }
2652
- function ml(e, n, t, o, a, r) {
2653
- const l = v(
2654
- () => o.value === H.HORIZONTAL
2655
- ), i = v(
2656
- () => l.value ? t.value.domain() : n.value.domain()
2657
- ), c = v(
2658
- () => e.value.map((k) => k.values.map((p) => p == null ? void 0 : p.value))
2659
- );
2660
- function s(k, p, O) {
2661
- let N, D;
2662
- return l.value ? (N = n.value(k >= 0 ? 0 + O : k + O), D = t.value(i.value[p])) : (N = n.value(i.value[p]), D = t.value(k >= 0 ? k + O : 0 + O)), { x: N, y: D };
2663
- }
2664
- function m(k) {
2665
- return l.value ? n.value(k) - n.value(0) : n.value.bandwidth();
2666
- }
2667
- function u(k) {
2668
- return l.value ? n.value(0) - n.value(k) : n.value.bandwidth();
2669
- }
2670
- function f(k) {
2671
- return l.value ? t.value.bandwidth() : t.value(0) - t.value(k);
2672
- }
2673
- function y(k) {
2674
- return l.value ? t.value.bandwidth() : t.value(k) - t.value(0);
2675
- }
2676
- function g(k, p) {
2677
- return k ? c.value.reduce((O, N, D) => (D < k && N[p] >= 0 && (O += N[p]), O), 0) : 0;
2678
- }
2679
- function A(k, p) {
2680
- return k ? c.value.reduce((O, N, D) => (D < k && N[p] < 0 && (O += N[p]), O), 0) : 0;
2681
- }
2682
- function $(k, p, O) {
2683
- const { value: N, color: D } = k, P = N >= 0 ? m(N) : u(N), S = N >= 0 ? f(N) : y(N), E = N >= 0 ? g(p, O) : A(p, O), { x: K, y: U } = s(N, O, E);
2684
- return {
2685
- classList: [`lume-fill--${D ?? e.value[p].color ?? Object.values(ie)[p]}`, ...r],
2686
- width: P,
2687
- height: S,
2688
- x: K,
2689
- y: U,
2690
- isFaded: a.value !== -1 && a.value !== O,
2691
- isNegative: N < 0
2692
- };
2693
- }
2694
- return { barAttributeGenerator: $ };
2695
- }
2696
- const fl = {
2697
- class: "lume-bar-group",
2698
- "data-j-bars-group": ""
2699
- }, pl = ["onMouseenter"], hl = {
2700
- single: sl,
2701
- grouped: dl,
2702
- stacked: ml
2703
- }, yt = /* @__PURE__ */ Z({
2704
- __name: "lume-bar-group",
2705
- props: {
2706
- ...We(),
2707
- classList: {
2708
- type: [String, Array],
2709
- default: () => []
2710
- },
2711
- ...ll(!0),
2712
- transition: {
2713
- type: Boolean,
2714
- default: !0
2715
- }
2716
- },
2717
- emits: ["bar-click", "lume__internal--hover"],
2718
- setup(e, { emit: n }) {
2719
- const t = e, o = n, {
2720
- data: a,
2721
- hoveredIndex: r,
2722
- orientation: l,
2723
- transition: i,
2724
- type: c,
2725
- xScale: s,
2726
- yScale: m,
2727
- classList: u,
2728
- labels: f
2729
- } = te(t);
2730
- Fe("chartID");
2731
- const { emitInternalEvent: y } = ke(), { groupedData: g } = on(a, f), { barXScale: A, barYScale: $ } = ul(s, m, l), k = v(() => typeof u.value == "string" ? [u.value] : u.value), p = v(() => {
2732
- const D = rl(a, c), { barAttributeGenerator: P } = hl[D](
2733
- a,
2734
- A,
2735
- $,
2736
- l,
2737
- r,
2738
- k.value
2739
- );
2740
- return P;
2741
- }), O = v(() => {
2742
- if (i.value)
2743
- return l.value === H.HORIZONTAL ? "width" : "height";
2744
- });
2745
- async function N(D) {
2746
- o("lume__internal--hover", D), y("lume__internal--hover", D);
2747
- }
2748
- return (D, P) => (_(), I("g", fl, [
2749
- (_(!0), I(q, null, W(d(g), (S, E) => (_(), I("g", {
2750
- key: E,
2751
- onMouseenter: (K) => N(E)
2752
- }, [
2753
- (_(!0), I(q, null, W(S, (K, U) => (_(), Y(d(dt), j(p.value(K, U, E, S), {
2754
- key: `bar-${U}`,
2755
- transition: O.value,
2756
- "data-j-lume-bar": "",
2757
- onClick: (F) => o("bar-click", {
2758
- index: E,
2759
- datasetIndex: U,
2760
- event: F
2761
- })
2762
- }), null, 16, ["transition", "onClick"]))), 128))
2763
- ], 40, pl))), 128))
2764
- ]));
2765
- }
2766
- }), gl = {
2767
- [H.VERTICAL]: {
2768
- withTooltip: !0,
2769
- xAxisOptions: {},
2770
- yAxisOptions: { gridLines: !0 },
2771
- margins: Ae.VERTICAL
2772
- },
2773
- [H.HORIZONTAL]: {
2774
- withTooltip: !0,
2775
- xAxisOptions: { gridLines: !0 },
2776
- yAxisOptions: { gridLines: !1 },
2777
- margins: Ae.HORIZONTAL
2778
- }
2779
- }, Xl = /* @__PURE__ */ Z({
2780
- __name: "lume-single-bar-chart",
2781
- props: {
2782
- ...we(st)
2783
- },
2784
- setup(e, { emit: n }) {
2785
- const t = e, { componentEventPropagator: o } = ke(), a = Te(re()), { orientation: r, options: l } = te(t), i = v(
2786
- () => gl[r.value || H.VERTICAL]
2787
- // needs to be computed so that default options are reactive
2788
- ), { allOptions: c } = fe(l, i);
2789
- return (s, m) => (_(), Y(d(xe), j({ ...t, ...s.$attrs }, {
2790
- "chart-type": "single-bar",
2791
- options: d(c),
2792
- "data-j-single-bar-chart": ""
2793
- }, ae(d(o))), de({
2794
- groups: V((u) => [
2795
- ue(d(yt), j(u, { orientation: d(r) }, ae(d(o))), null, 16, ["orientation"])
2796
- ]),
2797
- _: 2
2798
- }, [
2799
- W(d(a), (u, f) => ({
2800
- name: f,
2801
- fn: V((y) => [
2802
- B(s.$slots, f, he(ge(y || {})))
2803
- ])
2804
- }))
2805
- ]), 1040, ["options"]));
2806
- }
2807
- }), yl = {
2808
- [H.VERTICAL]: {
2809
- withTooltip: !0,
2810
- xAxisOptions: {},
2811
- yAxisOptions: { gridLines: !0 },
2812
- margins: Ae.VERTICAL
2813
- },
2814
- [H.HORIZONTAL]: {
2815
- withTooltip: !0,
2816
- xAxisOptions: { gridLines: !0 },
2817
- yAxisOptions: { gridLines: !1 },
2818
- margins: Ae.HORIZONTAL,
2819
- tooltipOptions: { position: "right" }
2820
- }
2821
- }, Yl = /* @__PURE__ */ Z({
2822
- __name: "lume-grouped-bar-chart",
2823
- props: {
2824
- ...we()
2825
- },
2826
- setup(e, { emit: n }) {
2827
- const t = e, { componentEventPropagator: o } = ke(), a = Te(re()), { orientation: r, options: l } = te(t), i = v(
2828
- () => yl[r.value || H.VERTICAL]
2829
- // needs to be computed so that default options are reactive
2830
- ), { allOptions: c } = fe(
2831
- l,
2832
- i
2833
- );
2834
- return (s, m) => (_(), Y(d(xe), j({ ...t, ...s.$attrs }, {
2835
- "chart-type": "grouped-bar",
2836
- options: d(c),
2837
- "data-j-grouped-bar-chart": ""
2838
- }, ae(d(o))), de({
2839
- groups: V((u) => [
2840
- ue(d(yt), j(u, { type: "grouped" }, ae(d(o))), null, 16)
2841
- ]),
2842
- _: 2
2843
- }, [
2844
- W(d(a), (u, f) => ({
2845
- name: f,
2846
- fn: V((y) => [
2847
- B(s.$slots, f, he(ge(y || {})))
2848
- ])
2849
- }))
2850
- ]), 1040, ["options"]));
2851
- }
2852
- }), _l = {
2853
- [H.VERTICAL]: {
2854
- withTooltip: !0,
2855
- xAxisOptions: {},
2856
- yAxisOptions: { gridLines: !0 },
2857
- margins: Ae.VERTICAL,
2858
- tooltipOptions: { inverse: !0 }
2859
- },
2860
- [H.HORIZONTAL]: {
2861
- withTooltip: !0,
2862
- xAxisOptions: { gridLines: !0 },
2863
- yAxisOptions: { gridLines: !1 },
2864
- margins: Ae.HORIZONTAL,
2865
- tooltipOptions: { position: "right" }
2866
- }
2867
- }, Kl = /* @__PURE__ */ Z({
2868
- __name: "lume-stacked-bar-chart",
2869
- props: {
2870
- ...we()
2871
- },
2872
- setup(e, { emit: n }) {
2873
- const t = e, { componentEventPropagator: o } = ke(), a = Te(re()), { data: r, orientation: l, options: i, labels: c } = te(t), s = v(
2874
- () => _l[l.value || H.VERTICAL]
2875
- // needs to be computed so that default options are reactive
2876
- ), { allOptions: m } = fe(
2877
- i,
2878
- s
2879
- ), { internalData: u } = ht(r), { groupedData: f } = on(u, c), { stackedXScaleGenerator: y, stackedYScaleGenerator: g } = vl(
2880
- f,
2881
- l,
2882
- i
2883
- ), A = v(() => t.xScale || y), $ = v(() => t.yScale || g);
2884
- return (k, p) => (_(), Y(d(xe), j({ ...t, ...k.$attrs }, {
2885
- "chart-type": "stacked-bar",
2886
- options: d(m),
2887
- "x-scale": A.value,
2888
- "y-scale": $.value,
2889
- "data-j-stacked-bar-chart": ""
2890
- }, ae(d(o))), de({
2891
- groups: V((O) => [
2892
- ue(d(yt), j(O, { type: "stacked" }, ae(d(o))), null, 16)
2893
- ]),
2894
- _: 2
2895
- }, [
2896
- W(d(a), (O, N) => ({
2897
- name: N,
2898
- fn: V((D) => [
2899
- B(k.$slots, N, he(ge(D || {})))
2900
- ])
2901
- }))
2902
- ]), 1040, ["options", "x-scale", "y-scale"]));
2903
- }
2904
- }), kl = ["d", "stroke-width"], bl = 2, Al = /* @__PURE__ */ Z({
2905
- __name: "lume-line",
2906
- props: {
2907
- pathDefinition: {
2908
- type: String,
2909
- required: !0
2910
- },
2911
- width: {
2912
- type: Number,
2913
- default: bl
2914
- },
2915
- color: {
2916
- type: String,
2917
- default: ie.Skyblue
2918
- },
2919
- dashed: {
2920
- type: Boolean,
2921
- default: !1
2922
- },
2923
- transition: {
2924
- type: Boolean,
2925
- default: !0
2926
- },
2927
- animationDelay: {
2928
- type: Number,
2929
- default: 0
2930
- },
2931
- animationDuration: {
2932
- type: Number,
2933
- default: 0.2
2934
- }
2935
- },
2936
- emits: ["click"],
2937
- setup(e, { emit: n }) {
2938
- const t = n, o = R(null);
2939
- return _e(() => ze(o.value)), (a, r) => (_(), I("path", {
2940
- ref_key: "root",
2941
- ref: o,
2942
- class: ne(["lume-line", {
2943
- [`lume-stroke--${e.color}`]: !0,
2944
- "lume-line--dashed": e.dashed,
2945
- "lume-line--transition": e.transition
2946
- }]),
2947
- d: e.pathDefinition,
2948
- "stroke-width": e.width,
2949
- style: jt({
2950
- animationDelay: e.transition && e.animationDelay + "s",
2951
- animationDuration: e.transition && e.animationDuration + "s"
2952
- }),
2953
- "data-j-line": "",
2954
- onClick: r[0] || (r[0] = (l) => t("click", l))
2955
- }, null, 14, kl));
2956
- }
2957
- }), Tl = /* @__PURE__ */ ee(Al, [["__scopeId", "data-v-59449838"]]), Ll = ["cx", "cy", "r", "stroke-width"], $l = 4, Ol = 3, Il = /* @__PURE__ */ Z({
2958
- __name: "lume-point",
2959
- props: {
2960
- x: {},
2961
- y: {},
2962
- color: { default: ie.Skyblue },
2963
- radius: { default: $l },
2964
- active: { type: Boolean, default: !1 },
2965
- visible: { type: Boolean, default: !1 }
2966
- },
2967
- emits: ["click"],
2968
- setup(e, { emit: n }) {
2969
- const t = e, o = n, a = R(null), r = v(() => t.radius / 2), l = v(() => t.active ? t.radius : t.visible ? Ol : 0);
2970
- return _e(() => ze(a.value)), (i, c) => (_(), I("circle", {
2971
- ref_key: "root",
2972
- ref: a,
2973
- class: ne(["lume-point", {
2974
- [`lume-stroke--${i.color}`]: !0,
2975
- "lume-point--active": i.active,
2976
- [`lume-point--visible lume-fill--${i.color}`]: i.visible
2977
- }]),
2978
- cx: i.x,
2979
- cy: i.y,
2980
- r: l.value,
2981
- "stroke-width": r.value,
2982
- "data-j-point": "",
2983
- onClick: c[0] || (c[0] = (s) => o("click", s))
2984
- }, null, 10, Ll));
2985
- }
2986
- }), wl = /* @__PURE__ */ ee(Il, [["__scopeId", "data-v-080270c0"]]);
2987
- function an(e, n) {
2988
- function t(l) {
2989
- let i = null;
2990
- return l == null ? void 0 : l.reduce((c, s, m) => (s == null || s.value == null ? (i ? i.push(m) : i = [m], m === (l == null ? void 0 : l.length) - 1 && c.push(i)) : i && (c.push(i), i = null), c), []);
2991
- }
2992
- function o(l, i, c, s) {
2993
- const f = Math.abs(l - i) / (c + 1) * (s + 1);
2994
- return l == null && i == null ? null : l > i ? l - f : l + f;
2995
- }
2996
- function a(l) {
2997
- return function(c) {
2998
- return !!l.find(
2999
- (s) => s.includes(c) || s.includes(c - 1)
3000
- );
3001
- };
3002
- }
3003
- return { computedLineData: v(
3004
- () => e.value.map((l) => {
3005
- const i = t(l.values);
3006
- return {
3007
- ...l,
3008
- isDashed: a(i),
3009
- values: l.values.map((c, s) => {
3010
- var u, f, y, g;
3011
- const m = i.find(
3012
- (A) => A.includes(s)
3013
- );
3014
- if (m) {
3015
- const A = m[0] - 1, $ = m[m.length - 1] + 1;
3016
- let k = (u = l.values[A]) == null ? void 0 : u.value, p = (f = l.values[$]) == null ? void 0 : f.value;
3017
- if (k == null) {
3018
- const O = (g = (y = n == null ? void 0 : n.value) == null ? void 0 : y.domain) == null ? void 0 : g.call(y);
3019
- k = (O == null ? void 0 : O[1]) ?? 0, p = k;
3020
- } else p == null && (p = k);
3021
- return {
3022
- value: o(
3023
- k,
3024
- p,
3025
- m.length,
3026
- m.indexOf(s)
3027
- ),
3028
- label: Zt,
3029
- isNull: !0
3030
- };
3031
- }
3032
- return c;
3033
- })
3034
- };
3035
- })
3036
- ) };
3037
- }
3038
- function xl(e, n) {
3039
- const t = e.bandwidth() / 2;
3040
- return (o, a) => e(e.domain()[n + (a - 1)]) + t;
3041
- }
3042
- function El(e, n) {
3043
- return (t, o) => e(n + (o - 1));
3044
- }
3045
- function Nl(e, n, t, o) {
3046
- const a = yn().x(
3047
- ve(t) ? xl(t, e) : El(t, e)
3048
- ).y((r) => o(r));
3049
- return n.every((r) => r == null) ? null : a(n);
3050
- }
3051
- const Dl = {
3052
- class: "lume-line-group",
3053
- "data-j-lume-line-group": ""
3054
- }, Hl = { class: "lume-line-group__lines" }, Bl = {
3055
- key: 0,
3056
- class: "lume-line-group__points",
3057
- "data-j-lume-line-group__points": ""
3058
- }, Ml = 1, Rl = /* @__PURE__ */ Z({
3059
- __name: "lume-line-group",
3060
- props: {
3061
- ...We(),
3062
- withPoints: {
3063
- type: [Boolean, String],
3064
- default: !0
3065
- },
3066
- transition: {
3067
- type: Boolean,
3068
- default: !0
3069
- }
3070
- },
3071
- emits: ["line-click", "point-click", "lume__internal--hover"],
3072
- setup(e, { emit: n }) {
3073
- const t = e, o = n, { data: a, options: r, xScale: l, yScale: i, labels: c } = te(t), s = Fe(
3074
- "tooltipAnchorAttributes",
3075
- null
3076
- ), { updateTooltipAnchorAttributes: m } = en(
3077
- s,
3078
- r,
3079
- l,
3080
- i,
3081
- c
3082
- ), u = v(() => {
3083
- if (a.value.every((K) => K.isDashed))
3084
- return a.value;
3085
- const { computedLineData: E } = an(
3086
- a,
3087
- i
3088
- );
3089
- return r.value.withTooltip !== !1 && (s != null && s.value) && m(E.value), E.value;
3090
- }), f = v(() => {
3091
- if (t.hoveredIndex === -1) return;
3092
- const E = xn(
3093
- u.value,
3094
- t.hoveredIndex
3095
- );
3096
- return {
3097
- d: `M ${tt(l.value, t.hoveredIndex)},${i.value.range()[1]}
3098
- V ${i.value(E)}`
3099
- // Move to X index, Vertical line to the highest point
3100
- };
3101
- }), y = v(
3102
- () => l.value && Ml / (En(l.value) - 1)
3103
- // Subtracting the first line (read below)
3104
- ), g = v(
3105
- () => {
3106
- var E;
3107
- return ((E = r.value) == null ? void 0 : E.lineWidth) * 2 || void 0;
3108
- }
3109
- // If no `lineWidth`, returns NaN which needs to be undefined
3110
- ), A = v(
3111
- () => l.value.bandwidth() / 2
3112
- ), $ = v(() => l.value.domain()), k = v(
3113
- () => r.value.withPoints ?? t.withPoints
3114
- ), p = v(
3115
- () => r.value.withPoints === "visible" || t.withPoints === "visible"
3116
- );
3117
- function O(E) {
3118
- return u.value[E].values;
3119
- }
3120
- function N(E, K) {
3121
- var F, Q;
3122
- const U = E === 0 ? [] : [
3123
- (F = O(K)[E - 1]) == null ? void 0 : F.value,
3124
- (Q = O(K)[E]) == null ? void 0 : Q.value
3125
- ];
3126
- return Nl(
3127
- E,
3128
- U,
3129
- l.value,
3130
- i.value
3131
- ) || "";
3132
- }
3133
- function D(E) {
3134
- return {
3135
- animationDelay: E < 2 ? 0 : (E - 1) * y.value,
3136
- animationDuration: y.value
3137
- };
3138
- }
3139
- function P(E, K) {
3140
- var F;
3141
- const U = (F = O(K)[E]) == null ? void 0 : F.value;
3142
- return {
3143
- x: ve(l.value) ? t.xScale($.value[E]) + A.value : t.xScale(E),
3144
- y: U === null ? i.value(i.value.domain()[1]) : i.value(U)
3145
- };
3146
- }
3147
- function S(E) {
3148
- return t.hoveredIndex === E;
3149
- }
3150
- return (E, K) => (_(), I("g", Dl, [
3151
- G("path", j(f.value, {
3152
- class: "lume-line-group__overlay-line",
3153
- "data-j-lume-line-group__overlay-line": ""
3154
- }), null, 16),
3155
- (_(!0), I(q, null, W(u.value, (U, F) => (_(), I("g", {
3156
- key: U.label,
3157
- class: "lume-line-group__group"
3158
- }, [
3159
- G("g", Hl, [
3160
- (_(!0), I(q, null, W(U.values, (Q, J) => (_(), Y(d(Tl), j(D(J), {
3161
- key: `line-${J}`,
3162
- color: U.color,
3163
- dashed: U.isDashed(J),
3164
- "path-definition": N(J, F),
3165
- transition: e.transition,
3166
- width: d(r).lineWidth,
3167
- onClick: (se) => o("line-click", { index: J, datasetIndex: F, event: se })
3168
- }), null, 16, ["color", "dashed", "path-definition", "transition", "width", "onClick"]))), 128))
3169
- ]),
3170
- k.value ? (_(), I("g", Bl, [
3171
- (_(!0), I(q, null, W(U.values, (Q, J) => (_(), I(q, {
3172
- key: `point-${J}`
3173
- }, [
3174
- Q.isNull ? C("", !0) : (_(), Y(d(wl), j({ key: 0 }, P(J, F), {
3175
- active: S(J),
3176
- color: U.color,
3177
- index: J,
3178
- radius: g.value,
3179
- visible: p.value,
3180
- onClick: (se) => o("point-click", { index: J, datasetIndex: F, event: se })
3181
- }), null, 16, ["active", "color", "index", "radius", "visible", "onClick"]))
3182
- ], 64))), 128))
3183
- ])) : C("", !0)
3184
- ]))), 128))
3185
- ]));
3186
- }
3187
- }), ln = /* @__PURE__ */ ee(Rl, [["__scopeId", "data-v-898c2e7a"]]), Gl = {
3188
- margins: Ae.VERTICAL,
3189
- startOnZero: !0,
3190
- withTooltip: !0,
3191
- xAxisOptions: {},
3192
- yAxisOptions: { gridLines: !0 }
3193
- }, Jl = /* @__PURE__ */ Z({
3194
- __name: "lume-line-chart",
3195
- props: {
3196
- ...we(null, !1)
3197
- },
3198
- setup(e, { emit: n }) {
3199
- const t = e, { componentEventPropagator: o } = ke(), a = Te(re()), { options: r } = te(t), { allOptions: l } = fe(r, Gl);
3200
- return (i, c) => (_(), Y(d(xe), j({ ...t, ...i.$attrs }, {
3201
- "chart-type": "line",
3202
- options: d(l),
3203
- "data-j-lume-line-chart": ""
3204
- }, ae(d(o))), de({
3205
- groups: V((s) => [
3206
- ue(d(ln), j(s, ae(d(o))), null, 16)
3207
- ]),
3208
- _: 2
3209
- }, [
3210
- W(d(a), (s, m) => ({
3211
- name: m,
3212
- fn: V((u) => [
3213
- B(i.$slots, m, he(ge(u || {})))
3214
- ])
3215
- }))
3216
- ]), 1040, ["options"]));
3217
- }
3218
- });
3219
- function Sl(e) {
3220
- return { areaPathDefinition: v(
3221
- () => function(t, o) {
3222
- if (!t || !o || ve(t) || ve(o))
3223
- return;
3224
- const a = e.value[0].values;
3225
- return _n().x((r, l) => t(l)).y0(o(Math.min(...o.domain()))).y1((r) => o(r.value))(a);
3226
- }
3227
- ) };
3228
- }
3229
- const jl = {
3230
- margins: {
3231
- top: 0,
3232
- right: 0,
3233
- bottom: 0,
3234
- left: 0
3235
- },
3236
- withAxes: !1,
3237
- showArea: !0,
3238
- startOnZero: !0,
3239
- withLegend: !1,
3240
- tooltipOptions: {
3241
- showTitle: !1
3242
- }
3243
- }, Vl = ["d"], Pl = /* @__PURE__ */ Z({
3244
- __name: "lume-sparkline-chart",
3245
- props: {
3246
- ...pt(null),
3247
- ...Re()
3248
- },
3249
- setup(e, { expose: n, emit: t }) {
3250
- const o = e, { componentEventPropagator: a } = ke(), r = Te(re()), { data: l, options: i } = te(o), { internalData: c } = ht(l), { allOptions: s } = fe(i, jl), { computedLineData: m } = an(c), { areaPathDefinition: u } = Sl(m), f = v(() => {
3251
- var $, k;
3252
- return (k = ($ = c.value) == null ? void 0 : $[0]) == null ? void 0 : k.color;
3253
- }), y = v(
3254
- () => {
3255
- var $, k;
3256
- return ((k = ($ = l.value) == null ? void 0 : $[0]) == null ? void 0 : k.areaColor) || f.value;
3257
- }
3258
- );
3259
- function g($) {
3260
- return {
3261
- ...$,
3262
- noMinSize: !0
3263
- };
3264
- }
3265
- function A($, k, p) {
3266
- if ($.length)
3267
- return Be().range([0, p.width]).domain([0, $[0].values.length - 1]);
3268
- }
3269
- return n({
3270
- areaPathDefinition: u
3271
- }), ($, k) => (_(), Y(d(xe), j(o, {
3272
- "chart-type": "line",
3273
- options: g(d(s)),
3274
- "x-scale": A
3275
- }, ae(d(a))), de({
3276
- groups: V((p) => [
3277
- d(s).showArea ? (_(), I("path", {
3278
- key: 0,
3279
- class: ne([
3280
- "sparkline-chart__area",
3281
- d(i).withTransition !== !1 ? "sparkline-chart__area--transition" : "",
3282
- `lume-fill--${y.value || f.value}`,
3283
- "lume-fill--faded"
3284
- ]),
3285
- d: d(u)(p.xScale, p.yScale),
3286
- "data-j-sparkline__area": ""
3287
- }, null, 10, Vl)) : C("", !0),
3288
- ue(d(ln), j(p, { "with-points": !1 }, ae(d(a))), null, 16)
3289
- ]),
3290
- _: 2
3291
- }, [
3292
- W(d(r), (p, O) => ({
3293
- name: O,
3294
- fn: V((N) => [
3295
- B($.$slots, O, he(ge(N || {})), void 0, !0)
3296
- ])
3297
- }))
3298
- ]), 1040, ["options"]));
3299
- }
3300
- }), Ql = /* @__PURE__ */ ee(Pl, [["__scopeId", "data-v-579f7e32"]]);
3301
- export {
3302
- tt as A,
3303
- xt as B,
3304
- be as C,
3305
- vt as D,
3306
- Ql as E,
3307
- gt as F,
3308
- ht as G,
3309
- mo as H,
3310
- an as I,
3311
- Zo as J,
3312
- fe as K,
3313
- ft as L,
3314
- po as M,
3315
- Yo as N,
3316
- mt as O,
3317
- en as P,
3318
- Ko as Q,
3319
- pt as R,
3320
- qt as S,
3321
- we as T,
3322
- fo as U,
3323
- Re as V,
3324
- vo as W,
3325
- Zl as _,
3326
- ie as a,
3327
- tl as b,
3328
- $a as c,
3329
- ga as d,
3330
- ka as e,
3331
- dt as f,
3332
- xe as g,
3333
- _o as h,
3334
- Nt as i,
3335
- Tl as j,
3336
- ln as k,
3337
- wl as l,
3338
- Fo as m,
3339
- Mo as n,
3340
- Eo as o,
3341
- $o as p,
3342
- Lt as q,
3343
- Ul as r,
3344
- yt as s,
3345
- Yl as t,
3346
- Jl as u,
3347
- zo as v,
3348
- Xl as w,
3349
- Kl as x,
3350
- Wo as y,
3351
- Et as z
3352
- };
3353
- //# sourceMappingURL=Dl4ux2JP.js.map