@adyen/lume-vue3 1.11.0 → 1.11.2

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