iryx-ui 0.22.0 → 0.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,34 +4,34 @@ import { cartesianLayout as n, clampTooltip as r, seriesColor as i, slotOf as a,
4
4
  import { useChartAnimation as s, useChartReveal as c } from "../composables/chart-reveal.js";
5
5
  import l from "./ChartLegend.js";
6
6
  import { lineChartTheme as u } from "../theme/line-chart.js";
7
- import { Fragment as d, computed as f, createBlock as ee, createCommentVNode as p, createElementBlock as m, createElementVNode as h, defineComponent as g, guardReactiveProps as _, normalizeClass as v, normalizeProps as y, normalizeStyle as b, openBlock as x, ref as S, renderList as C, renderSlot as w, toDisplayString as T, unref as E, useId as D } from "vue";
7
+ import { Fragment as d, computed as f, createBlock as ee, createCommentVNode as p, createElementBlock as m, createElementVNode as h, defineComponent as g, guardReactiveProps as _, normalizeClass as v, normalizeProps as y, normalizeStyle as b, openBlock as x, ref as S, renderList as C, renderSlot as w, toDisplayString as T, unref as E, useId as te } from "vue";
8
8
  //#region src/components/LineChart.vue?vue&type=script&setup=true&lang.ts
9
- var te = ["role", "aria-label"], ne = [
9
+ var ne = ["role", "aria-label"], re = [
10
10
  "width",
11
11
  "height",
12
12
  "viewBox"
13
- ], O = [
13
+ ], ie = [
14
14
  "x1",
15
15
  "y1",
16
16
  "x2",
17
17
  "y2"
18
- ], re = ["x", "y"], ie = { key: 1 }, ae = [
18
+ ], ae = ["x", "y"], oe = [
19
19
  "x",
20
20
  "y",
21
21
  "width",
22
22
  "height"
23
- ], oe = [
23
+ ], se = [
24
24
  "x1",
25
25
  "y1",
26
26
  "x2",
27
27
  "y2"
28
- ], se = ["clip-path"], ce = ["d", "fill"], le = ["d"], ue = ["cx", "cy"], de = ["cx", "cy"], fe = ["x", "y"], pe = [
28
+ ], ce = ["clip-path"], le = ["d", "fill"], ue = ["d"], de = ["d"], fe = ["cx", "cy"], pe = ["cx", "cy"], me = ["x", "y"], he = [
29
29
  "x",
30
30
  "y",
31
31
  "width",
32
32
  "height",
33
33
  "onPointerenter"
34
- ], me = { scope: "row" }, k = /*@__PURE__*/ g({
34
+ ], ge = { scope: "row" }, D = /*@__PURE__*/ g({
35
35
  __name: "LineChart",
36
36
  props: {
37
37
  data: { default: () => [] },
@@ -76,52 +76,68 @@ var te = ["role", "aria-label"], ne = [
76
76
  ui: {}
77
77
  },
78
78
  setup(g) {
79
- let k = g, he = e(), A = f(() => k.unstyled ?? he.unstyled), j = S(), { width: M } = t(j), ge = f(() => new Intl.NumberFormat(k.locale, k.format));
80
- function N(e) {
81
- return ge.value.format(e);
79
+ let D = g, _e = e(), O = f(() => D.unstyled ?? _e.unstyled), k = S(), { width: A } = t(k), ve = f(() => new Intl.NumberFormat(D.locale, D.format));
80
+ function j(e) {
81
+ return ve.value.format(e);
82
82
  }
83
- let P = f(() => {
84
- let e = k.series?.length ? [...k.series] : [{ key: "value" }];
83
+ let M = f(() => {
84
+ let e = D.series?.length ? [...D.series] : [{ key: "value" }];
85
85
  return o(e.length), e;
86
- }), F = f(() => P.value.length > 1), _e = f(() => F.value || k.legend && P.value[0].name != null);
87
- function I(e, t) {
86
+ }), N = f(() => M.value.length > 1), ye = f(() => N.value || D.legend && M.value[0].name != null);
87
+ function P(e, t) {
88
88
  let n = e[t];
89
89
  return typeof n == "number" && Number.isFinite(n) ? n : null;
90
90
  }
91
- let L = f(() => n({
92
- values: k.data.flatMap((e) => P.value.map((t) => I(e, t.key))),
93
- categories: k.data.length,
94
- longestLabel: Math.max(...k.data.map((e) => e.label.length), 1),
95
- width: M.value,
96
- height: k.height,
97
- tickCount: k.ticks,
98
- showAxis: k.axis,
99
- formatTick: N,
100
- includeZero: k.zero
91
+ let F = f(() => D.variant === "stacked" && N.value), I = f(() => D.data.map((e) => M.value.reduce((t, n) => {
92
+ let r = t[t.length - 1] ?? 0;
93
+ return t.push(r + (P(e, n.key) ?? 0)), t;
94
+ }, []))), L = f(() => n({
95
+ values: F.value ? I.value.map((e) => e[e.length - 1]) : D.data.flatMap((e) => M.value.map((t) => P(e, t.key))),
96
+ categories: D.data.length,
97
+ longestLabel: Math.max(...D.data.map((e) => e.label.length), 1),
98
+ width: A.value,
99
+ height: D.height,
100
+ tickCount: D.ticks,
101
+ showAxis: D.axis,
102
+ formatTick: j,
103
+ includeZero: D.zero || F.value
101
104
  }));
102
105
  function R(e) {
103
106
  return Math.round(e * 100) / 100;
104
107
  }
105
- let z = f(() => M.value ? P.value.map((e, t) => {
108
+ let z = f(() => A.value ? M.value.map((e, t) => {
106
109
  let n = [], r = [];
107
- return k.data.forEach((t, i) => {
108
- let a = I(t, e.key);
109
- if (a == null) {
110
+ return D.data.forEach((i, a) => {
111
+ let o = F.value ? I.value[a][t] : P(i, e.key);
112
+ if (o == null) {
110
113
  r.length && n.push(r), r = [];
111
114
  return;
112
115
  }
113
116
  r.push({
114
- x: R(L.value.pointAt(i)),
115
- y: R(L.value.y(a)),
116
- index: i
117
+ x: R(L.value.pointAt(a)),
118
+ y: R(L.value.y(o)),
119
+ index: a
117
120
  });
118
121
  }), r.length && n.push(r), {
119
122
  runs: n,
120
123
  color: i(a(e, t)),
121
124
  seriesIndex: t
122
125
  };
123
- }) : []), B = f(() => k.variant === "area" && !F.value && z.value.length > 0), V = f(() => {
124
- let e = k.data?.length ?? 0;
126
+ }) : []), B = f(() => (D.variant === "area" || D.variant === "stacked") && !N.value && z.value.length > 0), be = f(() => !F.value || !A.value ? [] : M.value.map((e, t) => ({
127
+ top: D.data.map((e, n) => ({
128
+ x: R(L.value.pointAt(n)),
129
+ y: R(L.value.y(I.value[n][t])),
130
+ index: n
131
+ })),
132
+ base: D.data.map((e, n) => ({
133
+ x: R(L.value.pointAt(n)),
134
+ y: R(L.value.y(t === 0 ? 0 : I.value[n][t - 1])),
135
+ index: n
136
+ })),
137
+ color: i(a(e, t)),
138
+ seriesIndex: t
139
+ }))), V = f(() => {
140
+ let e = D.data?.length ?? 0;
125
141
  return {
126
142
  first: e ? R(L.value.pointAt(0)) : 0,
127
143
  last: e ? R(L.value.pointAt(e - 1)) : 0,
@@ -130,11 +146,11 @@ var te = ["role", "aria-label"], ne = [
130
146
  };
131
147
  });
132
148
  function H(e) {
133
- return k.flush && e.x === V.value.last ? `L${V.value.right} ${e.y}` : "";
149
+ return D.flush && e.x === V.value.last ? `L${V.value.right} ${e.y}` : "";
134
150
  }
135
- let U = f(() => Math.min(Math.max(k.tension, 0), 1) / 6);
151
+ let U = f(() => Math.min(Math.max(D.tension, 0), 1) / 6);
136
152
  function W(e) {
137
- let t = e[0], n = e[e.length - 1], r = k.flush && t.x === V.value.first ? `M${V.value.left} ${t.y} L${t.x} ${t.y}` : `M${t.x} ${t.y}`;
153
+ let t = e[0], n = e[e.length - 1], r = D.flush && t.x === V.value.first ? `M${V.value.left} ${t.y} L${t.x} ${t.y}` : `M${t.x} ${t.y}`;
138
154
  if (U.value === 0 || e.length < 2) return [
139
155
  r,
140
156
  ...e.slice(1).map((e) => `L${e.x} ${e.y}`),
@@ -150,11 +166,14 @@ var te = ["role", "aria-label"], ne = [
150
166
  H(n)
151
167
  ].filter(Boolean).join(" ");
152
168
  }
153
- function ve(e) {
154
- let t = L.value.plot.top + L.value.plot.height, n = e[0], r = e[e.length - 1], i = k.flush && n.x === V.value.first ? V.value.left : n.x, a = k.flush && r.x === V.value.last ? V.value.right : r.x;
169
+ function xe(e) {
170
+ let t = L.value.plot.top + L.value.plot.height, n = e[0], r = e[e.length - 1], i = D.flush && n.x === V.value.first ? V.value.left : n.x, a = D.flush && r.x === V.value.last ? V.value.right : r.x;
155
171
  return `${W(e)} L${a} ${t} L${i} ${t} Z`;
156
172
  }
157
- let G = `iryx-area-${D()}`, K = `iryx-plot-clip-${D()}`, q = S(), J = f(() => q.value == null ? [] : z.value.flatMap((e) => {
173
+ function Se(e, t) {
174
+ return `${W(e)} ${W([...t].reverse()).replace("M", "L")} Z`;
175
+ }
176
+ let G = `iryx-area-${te()}`, K = `iryx-plot-clip-${te()}`, q = S(), J = f(() => q.value == null ? [] : z.value.flatMap((e) => {
158
177
  for (let t of e.runs) {
159
178
  let n = t.find((e) => e.index === q.value);
160
179
  if (n) return [{
@@ -165,69 +184,70 @@ var te = ["role", "aria-label"], ne = [
165
184
  return [];
166
185
  })), Y = f(() => q.value == null ? void 0 : R(L.value.pointAt(q.value))), X = f(() => {
167
186
  if (q.value == null) return;
168
- let e = k.data[q.value];
187
+ let e = D.data[q.value];
169
188
  if (!e) return;
170
- let t = P.value.map((t, n) => ({
189
+ let t = M.value.map((t, n) => ({
171
190
  name: t.name ?? t.key,
172
191
  color: i(a(t, n)),
173
- value: I(e, t.key)
192
+ value: P(e, t.key)
174
193
  })).filter((e) => e.value != null).map((e) => ({
175
194
  ...e,
176
- value: N(e.value)
195
+ value: j(e.value)
177
196
  }));
178
197
  if (!t.length) return;
179
- let n = F.value ? Math.max(e.label.length, ...t.map((e) => e.name.length + e.value.length + 3)) : e.label.length + t[0].value.length + 2;
198
+ let n = N.value ? Math.max(e.label.length, ...t.map((e) => e.name.length + e.value.length + 3)) : e.label.length + t[0].value.length + 2;
180
199
  return {
181
200
  label: e.label,
182
201
  rows: t,
183
- multi: F.value,
184
- x: r(L.value.pointAt(q.value), "x".repeat(n), M.value),
202
+ multi: N.value,
203
+ x: r(L.value.pointAt(q.value), "x".repeat(n), A.value),
185
204
  y: Math.min(...J.value.map((e) => e.y), L.value.plot.top + L.value.plot.height)
186
205
  };
187
- }), Z = s(f(() => k.animate)), { revealed: ye } = c(f(() => !!(M.value && z.value.length)), Z), be = f(() => ({
188
- transform: `scaleX(${+!!ye.value})`,
206
+ }), Z = s(f(() => D.animate)), { revealed: Ce } = c(f(() => !!(A.value && z.value.length)), Z), we = f(() => ({
207
+ transform: `scaleX(${+!!Ce.value})`,
189
208
  transformOrigin: `${L.value.plot.left}px 0px`,
190
209
  transition: `transform ${Z.value.duration}ms ${Z.value.css}`
191
210
  })), Q = f(() => u());
192
211
  function $(e, t) {
193
- let n = k.ui?.[e];
194
- return A.value ? [n, t] : Q.value[e]({ class: [n, t] });
212
+ let n = D.ui?.[e];
213
+ return O.value ? [n, t] : Q.value[e]({ class: [n, t] });
195
214
  }
196
215
  return (e, t) => (x(), m("div", {
197
216
  ref_key: "root",
198
- ref: j,
199
- role: k.label ? "figure" : void 0,
200
- "aria-label": k.label,
201
- class: v($("root", k.class))
217
+ ref: k,
218
+ role: D.label ? "figure" : void 0,
219
+ "aria-label": D.label,
220
+ class: v($("root", D.class))
202
221
  }, [
203
- _e.value ? (x(), ee(l, {
222
+ ye.value ? (x(), ee(l, {
204
223
  key: 0,
205
- series: P.value,
206
- unstyled: k.unstyled
224
+ series: M.value,
225
+ unstyled: D.unstyled
207
226
  }, null, 8, ["series", "unstyled"])) : p("", !0),
208
- h("div", { class: v(A.value ? void 0 : Q.value.plot()) }, [(x(), m("svg", {
209
- width: E(M),
210
- height: k.height,
211
- viewBox: `0 0 ${E(M)} ${k.height}`,
227
+ h("div", { class: v(O.value ? void 0 : Q.value.plot()) }, [(x(), m("svg", {
228
+ width: E(A),
229
+ height: D.height,
230
+ viewBox: `0 0 ${E(A)} ${D.height}`,
212
231
  "aria-hidden": "true",
213
232
  class: v($("svg"))
214
233
  }, [
215
- k.axis ? (x(!0), m(d, { key: 0 }, C(L.value.ticks, (e) => (x(), m("g", { key: `tick-${e}` }, [h("line", {
234
+ D.axis ? (x(!0), m(d, { key: 0 }, C(L.value.ticks, (e) => (x(), m("g", { key: `tick-${e}` }, [h("line", {
216
235
  x1: L.value.plot.left,
217
236
  y1: L.value.y(e),
218
237
  x2: L.value.plot.left + L.value.plot.width,
219
238
  y2: L.value.y(e),
220
239
  "stroke-width": "1",
221
240
  class: v($("grid"))
222
- }, null, 10, O), h("text", {
241
+ }, null, 10, ie), h("text", {
223
242
  x: L.value.plot.left - E(8),
224
243
  y: L.value.y(e),
225
244
  "text-anchor": "end",
226
245
  "dominant-baseline": "middle",
227
246
  class: v($("tick"))
228
- }, T(N(e)), 11, re)]))), 128)) : p("", !0),
247
+ }, T(j(e)), 11, ae)]))), 128)) : p("", !0),
229
248
  w(e.$slots, "underlay", y(_(L.value))),
230
- B.value ? (x(), m("defs", ie, [h("linearGradient", {
249
+ h("defs", null, [B.value ? (x(), m("linearGradient", {
250
+ key: 0,
231
251
  id: G,
232
252
  x1: "0",
233
253
  y1: "0",
@@ -241,65 +261,74 @@ var te = ["role", "aria-label"], ne = [
241
261
  offset: "100%",
242
262
  "stop-color": "currentColor",
243
263
  "stop-opacity": "0"
244
- }, null, -1)]]), h("clipPath", { id: K }, [h("rect", {
264
+ }, null, -1)]])) : p("", !0), h("clipPath", { id: K }, [h("rect", {
245
265
  x: L.value.plot.left,
246
266
  y: L.value.plot.top,
247
267
  width: L.value.plot.width,
248
268
  height: L.value.plot.height,
249
- style: b(be.value)
250
- }, null, 12, ae)])])) : p("", !0),
269
+ style: b(we.value)
270
+ }, null, 12, oe)])]),
251
271
  Y.value == null ? p("", !0) : (x(), m("line", {
252
- key: 2,
272
+ key: 1,
253
273
  x1: Y.value,
254
274
  y1: L.value.plot.top,
255
275
  x2: Y.value,
256
276
  y2: L.value.plot.top + L.value.plot.height,
257
277
  "stroke-width": "1",
258
278
  class: v($("crosshair"))
259
- }, null, 10, oe)),
260
- h("g", { "clip-path": `url(#${K})` }, [(x(!0), m(d, null, C(B.value ? z.value[0].runs : [], (e, t) => (x(), m("path", {
261
- key: `area-${t}`,
262
- d: ve(e),
263
- fill: `url(#${G})`,
264
- style: b({ color: z.value[0].color }),
265
- class: v($("area"))
266
- }, null, 14, ce))), 128)), (x(!0), m(d, null, C(z.value, (e) => (x(), m(d, { key: `series-${e.seriesIndex}` }, [(x(!0), m(d, null, C(e.runs, (t, n) => (x(), m("path", {
267
- key: `line-${e.seriesIndex}-${n}`,
268
- d: W(t),
269
- style: b({ stroke: e.color }),
270
- class: v($("line"))
271
- }, null, 14, le))), 128))], 64))), 128))], 8, se),
279
+ }, null, 10, se)),
280
+ h("g", { "clip-path": `url(#${K})` }, [
281
+ (x(!0), m(d, null, C(B.value ? z.value[0].runs : [], (e, t) => (x(), m("path", {
282
+ key: `area-${t}`,
283
+ d: xe(e),
284
+ fill: `url(#${G})`,
285
+ style: b({ color: z.value[0].color }),
286
+ class: v($("area"))
287
+ }, null, 14, le))), 128)),
288
+ (x(!0), m(d, null, C(be.value, (e) => (x(), m("path", {
289
+ key: `band-${e.seriesIndex}`,
290
+ d: Se(e.top, e.base),
291
+ style: b({ fill: e.color }),
292
+ class: v($("band"))
293
+ }, null, 14, ue))), 128)),
294
+ (x(!0), m(d, null, C(z.value, (e) => (x(), m(d, { key: `series-${e.seriesIndex}` }, [(x(!0), m(d, null, C(e.runs, (t, n) => (x(), m("path", {
295
+ key: `line-${e.seriesIndex}-${n}`,
296
+ d: W(t),
297
+ style: b({ stroke: e.color }),
298
+ class: v($("line"))
299
+ }, null, 14, de))), 128))], 64))), 128))
300
+ ], 8, ce),
272
301
  (x(!0), m(d, null, C(J.value, (e, t) => (x(), m(d, { key: `marker-${t}` }, [h("circle", {
273
302
  cx: e.x,
274
303
  cy: e.y,
275
304
  r: "6",
276
305
  class: v($("markerRing"))
277
- }, null, 10, ue), h("circle", {
306
+ }, null, 10, fe), h("circle", {
278
307
  cx: e.x,
279
308
  cy: e.y,
280
309
  r: "4",
281
310
  style: b({ fill: e.color }),
282
311
  class: v($("marker"))
283
- }, null, 14, de)], 64))), 128)),
284
- (x(!0), m(d, null, C(k.data, (e, t) => (x(), m(d, { key: `label-${e.label}-${t}` }, [t % L.value.labelStep === 0 ? (x(), m("text", {
312
+ }, null, 14, pe)], 64))), 128)),
313
+ (x(!0), m(d, null, C(D.data, (e, t) => (x(), m(d, { key: `label-${e.label}-${t}` }, [t % L.value.labelStep === 0 ? (x(), m("text", {
285
314
  key: 0,
286
315
  x: L.value.pointAt(t),
287
316
  y: L.value.plot.top + L.value.plot.height + 14,
288
317
  "text-anchor": "middle",
289
318
  class: v($("category"))
290
- }, T(e.label), 11, fe)) : p("", !0)], 64))), 128)),
319
+ }, T(e.label), 11, me)) : p("", !0)], 64))), 128)),
291
320
  w(e.$slots, "overlay", y(_(L.value))),
292
- (x(!0), m(d, null, C(k.data, (e, n) => (x(), m("rect", {
321
+ (x(!0), m(d, null, C(D.data, (e, n) => (x(), m("rect", {
293
322
  key: `hit-${e.label}-${n}`,
294
323
  x: L.value.plot.left + L.value.bandWidth * n,
295
324
  y: L.value.plot.top,
296
325
  width: L.value.bandWidth,
297
326
  height: L.value.plot.height,
298
- class: v(A.value ? void 0 : Q.value.hit()),
327
+ class: v(O.value ? void 0 : Q.value.hit()),
299
328
  onPointerenter: (e) => q.value = n,
300
329
  onPointerleave: t[0] ||= (e) => q.value = void 0
301
- }, null, 42, pe))), 128))
302
- ], 10, ne)), X.value ? (x(), m("div", {
330
+ }, null, 42, he))), 128))
331
+ ], 10, re)), X.value ? (x(), m("div", {
303
332
  key: 0,
304
333
  class: v($("tooltip", X.value.multi ? "flex-col items-start gap-1" : void 0)),
305
334
  style: b({
@@ -322,15 +351,15 @@ var te = ["role", "aria-label"], ne = [
322
351
  class: v($("tooltipValue"))
323
352
  }, T(X.value.rows[0].value), 3))], 6)) : p("", !0)], 2),
324
353
  h("div", { class: v($("table")) }, [h("table", null, [
325
- h("caption", null, T(k.label), 1),
326
- h("thead", null, [h("tr", null, [t[2] ||= h("th", { scope: "col" }, " Category ", -1), (x(!0), m(d, null, C(P.value, (e) => (x(), m("th", {
354
+ h("caption", null, T(D.label), 1),
355
+ h("thead", null, [h("tr", null, [t[2] ||= h("th", { scope: "col" }, " Category ", -1), (x(!0), m(d, null, C(M.value, (e) => (x(), m("th", {
327
356
  key: e.key,
328
357
  scope: "col"
329
358
  }, T(e.name ?? "Value"), 1))), 128))])]),
330
- h("tbody", null, [(x(!0), m(d, null, C(k.data, (e, t) => (x(), m("tr", { key: `row-${e.label}-${t}` }, [h("th", me, T(e.label), 1), (x(!0), m(d, null, C(P.value, (t) => (x(), m("td", { key: t.key }, T(I(e, t.key) == null ? "—" : N(I(e, t.key))), 1))), 128))]))), 128))])
359
+ h("tbody", null, [(x(!0), m(d, null, C(D.data, (e, t) => (x(), m("tr", { key: `row-${e.label}-${t}` }, [h("th", ge, T(e.label), 1), (x(!0), m(d, null, C(M.value, (t) => (x(), m("td", { key: t.key }, T(P(e, t.key) == null ? "—" : j(P(e, t.key))), 1))), 128))]))), 128))])
331
360
  ])], 2)
332
- ], 10, te));
361
+ ], 10, ne));
333
362
  }
334
363
  });
335
364
  //#endregion
336
- export { k as default };
365
+ export { D as default };
@@ -17,16 +17,19 @@ export { default as Card } from './Card.vue';
17
17
  export { default as Carousel } from './Carousel.vue';
18
18
  export { default as ChartLegend } from './ChartLegend.vue';
19
19
  export { default as Checkbox } from './Checkbox.vue';
20
+ export { default as Code } from './Code.vue';
20
21
  export { default as Collapsible } from './Collapsible.vue';
21
22
  export { default as ColorPicker } from './ColorPicker.vue';
22
23
  export { default as Combobox } from './Combobox.vue';
23
24
  export { default as CommandPalette } from './CommandPalette.vue';
24
25
  export { default as ConfirmDialog } from './ConfirmDialog.vue';
26
+ export { default as ConfirmPopover } from './ConfirmPopover.vue';
25
27
  export { default as Container } from './Container.vue';
26
28
  export { default as ContextMenu } from './ContextMenu.vue';
27
29
  export { default as DateField } from './DateField.vue';
28
30
  export { default as DatePicker } from './DatePicker.vue';
29
31
  export { default as DateRangePicker } from './DateRangePicker.vue';
32
+ export { default as DescriptionList } from './DescriptionList.vue';
30
33
  export { default as Dialog } from './Dialog.vue';
31
34
  export { default as DonutChart } from './DonutChart.vue';
32
35
  export { default as Drawer } from './Drawer.vue';