@alfadocs/ui-kit-debug 1.1.0 → 1.2.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.
- package/dist/_chunks/notes-panel-CCz0J140.js +370 -0
- package/dist/_chunks/notes-panel-CCz0J140.js.map +1 -0
- package/dist/_chunks/sparkline-DJtZBe7O.js +501 -0
- package/dist/_chunks/sparkline-DJtZBe7O.js.map +1 -0
- package/dist/agent-catalog.json +27 -1
- package/dist/agent-i18n/en.json +4 -2
- package/dist/components/notes-panel/index.js +1 -1
- package/dist/components/notes-panel/notes-panel.agent.d.ts.map +1 -1
- package/dist/components/notes-panel/notes-panel.d.ts +45 -2
- package/dist/components/notes-panel/notes-panel.d.ts.map +1 -1
- package/dist/components/sparkline/index.js +1 -1
- package/dist/components/sparkline/sparkline.agent.d.ts.map +1 -1
- package/dist/components/sparkline/sparkline.d.ts +24 -0
- package/dist/components/sparkline/sparkline.d.ts.map +1 -1
- package/dist/host-compat.css +4 -1
- package/dist/i18n/locales/ar.d.ts +2 -0
- package/dist/i18n/locales/ar.d.ts.map +1 -1
- package/dist/i18n/locales/ar.js +2 -0
- package/dist/i18n/locales/ar.js.map +1 -1
- package/dist/i18n/locales/de.d.ts +2 -0
- package/dist/i18n/locales/de.d.ts.map +1 -1
- package/dist/i18n/locales/de.js +2 -0
- package/dist/i18n/locales/de.js.map +1 -1
- package/dist/i18n/locales/el.d.ts +2 -0
- package/dist/i18n/locales/el.d.ts.map +1 -1
- package/dist/i18n/locales/el.js +2 -0
- package/dist/i18n/locales/el.js.map +1 -1
- package/dist/i18n/locales/en.d.ts +2 -0
- package/dist/i18n/locales/en.d.ts.map +1 -1
- package/dist/i18n/locales/en.js +2 -0
- package/dist/i18n/locales/en.js.map +1 -1
- package/dist/i18n/locales/es.d.ts +2 -0
- package/dist/i18n/locales/es.d.ts.map +1 -1
- package/dist/i18n/locales/es.js +2 -0
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.d.ts +2 -0
- package/dist/i18n/locales/fr.d.ts.map +1 -1
- package/dist/i18n/locales/fr.js +2 -0
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hi.d.ts +2 -0
- package/dist/i18n/locales/hi.d.ts.map +1 -1
- package/dist/i18n/locales/hi.js +2 -0
- package/dist/i18n/locales/hi.js.map +1 -1
- package/dist/i18n/locales/it.d.ts +2 -0
- package/dist/i18n/locales/it.d.ts.map +1 -1
- package/dist/i18n/locales/it.js +2 -0
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/ja.d.ts +2 -0
- package/dist/i18n/locales/ja.d.ts.map +1 -1
- package/dist/i18n/locales/ja.js +2 -0
- package/dist/i18n/locales/ja.js.map +1 -1
- package/dist/i18n/locales/nl.d.ts +2 -0
- package/dist/i18n/locales/nl.d.ts.map +1 -1
- package/dist/i18n/locales/nl.js +2 -0
- package/dist/i18n/locales/nl.js.map +1 -1
- package/dist/i18n/locales/pl.d.ts +2 -0
- package/dist/i18n/locales/pl.d.ts.map +1 -1
- package/dist/i18n/locales/pl.js +2 -0
- package/dist/i18n/locales/pl.js.map +1 -1
- package/dist/i18n/locales/pt.d.ts +2 -0
- package/dist/i18n/locales/pt.d.ts.map +1 -1
- package/dist/i18n/locales/pt.js +2 -0
- package/dist/i18n/locales/pt.js.map +1 -1
- package/dist/i18n/locales/ro.d.ts +2 -0
- package/dist/i18n/locales/ro.d.ts.map +1 -1
- package/dist/i18n/locales/ro.js +2 -0
- package/dist/i18n/locales/ro.js.map +1 -1
- package/dist/i18n/locales/ru.d.ts +2 -0
- package/dist/i18n/locales/ru.d.ts.map +1 -1
- package/dist/i18n/locales/ru.js +2 -0
- package/dist/i18n/locales/ru.js.map +1 -1
- package/dist/i18n/locales/sq.d.ts +2 -0
- package/dist/i18n/locales/sq.d.ts.map +1 -1
- package/dist/i18n/locales/sq.js +2 -0
- package/dist/i18n/locales/sq.js.map +1 -1
- package/dist/i18n/locales/sv.d.ts +2 -0
- package/dist/i18n/locales/sv.d.ts.map +1 -1
- package/dist/i18n/locales/sv.js +2 -0
- package/dist/i18n/locales/sv.js.map +1 -1
- package/dist/i18n/locales/tr.d.ts +2 -0
- package/dist/i18n/locales/tr.d.ts.map +1 -1
- package/dist/i18n/locales/tr.js +2 -0
- package/dist/i18n/locales/tr.js.map +1 -1
- package/dist/i18n/locales/zh.d.ts +2 -0
- package/dist/i18n/locales/zh.d.ts.map +1 -1
- package/dist/i18n/locales/zh.js +2 -0
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/locales/ar.json +2 -0
- package/dist/locales/de.json +2 -0
- package/dist/locales/el.json +2 -0
- package/dist/locales/en.json +2 -0
- package/dist/locales/es.json +2 -0
- package/dist/locales/fr.json +2 -0
- package/dist/locales/hi.json +2 -0
- package/dist/locales/it.json +2 -0
- package/dist/locales/ja.json +2 -0
- package/dist/locales/nl.json +2 -0
- package/dist/locales/pl.json +2 -0
- package/dist/locales/pt.json +2 -0
- package/dist/locales/ro.json +2 -0
- package/dist/locales/ru.json +2 -0
- package/dist/locales/sq.json +2 -0
- package/dist/locales/sv.json +2 -0
- package/dist/locales/tr.json +2 -0
- package/dist/locales/zh.json +2 -0
- package/dist/tokens.css +1 -1
- package/package.json +1 -1
- package/dist/_chunks/notes-panel-CTcOLLVo.js +0 -324
- package/dist/_chunks/notes-panel-CTcOLLVo.js.map +0 -1
- package/dist/_chunks/sparkline-DLq7xwic.js +0 -394
- package/dist/_chunks/sparkline-DLq7xwic.js.map +0 -1
|
@@ -0,0 +1,501 @@
|
|
|
1
|
+
import { jsx as d, jsxs as D } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as oe, useId as de, useMemo as A, useRef as S, useState as Z, useEffect as P, useImperativeHandle as ce } from "react";
|
|
3
|
+
import { c as E } from "./index-D2ZczOXr.js";
|
|
4
|
+
import { useTranslation as le } from "react-i18next";
|
|
5
|
+
import ue from "react-apexcharts";
|
|
6
|
+
import U from "apexcharts";
|
|
7
|
+
import { g as J, u as pe } from "./apexcharts-theme-B_AxGC_h.js";
|
|
8
|
+
import { m as me } from "./annotation-marker-CsUJGZjQ.js";
|
|
9
|
+
import { u as he } from "./registry-DvAUVLHh.js";
|
|
10
|
+
function fe(n) {
|
|
11
|
+
if (n.length < 2)
|
|
12
|
+
return { slope: 0, direction: "steady" };
|
|
13
|
+
const r = n.length, c = (r - 1) / 2, s = n.reduce((a, i) => a + i, 0) / r;
|
|
14
|
+
let o = 0, h = 0;
|
|
15
|
+
for (let a = 0; a < r; a++) {
|
|
16
|
+
const i = a - c;
|
|
17
|
+
o += i * (n[a] - s), h += i * i;
|
|
18
|
+
}
|
|
19
|
+
const p = h === 0 ? 0 : o / h, y = 0.01 * (Math.max(...n) - Math.min(...n) || 1), m = Math.abs(p) < y ? "steady" : p > 0 ? "increasing" : "decreasing";
|
|
20
|
+
return { slope: p, direction: m };
|
|
21
|
+
}
|
|
22
|
+
const ge = {
|
|
23
|
+
id: "sparkline",
|
|
24
|
+
capabilities: [],
|
|
25
|
+
state: {},
|
|
26
|
+
actions: {
|
|
27
|
+
update_series: {
|
|
28
|
+
// Replacing the rendered series mutates what the chart displays — write,
|
|
29
|
+
// not read.
|
|
30
|
+
safety: "write",
|
|
31
|
+
argsType: "{ data: number[] }",
|
|
32
|
+
argsSchema: {
|
|
33
|
+
type: "object",
|
|
34
|
+
properties: {
|
|
35
|
+
data: {
|
|
36
|
+
type: "array",
|
|
37
|
+
items: { type: "number" },
|
|
38
|
+
description: "The new data points to render."
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
required: ["data"]
|
|
42
|
+
},
|
|
43
|
+
idempotent: !0,
|
|
44
|
+
descriptionKey: "ui.agent.sparkline.actions.updateSeries",
|
|
45
|
+
description: "Replace the sparkline data without remounting.",
|
|
46
|
+
invoke: (n, r) => {
|
|
47
|
+
n.updateSeries(r.data);
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
export_png: {
|
|
51
|
+
// Pure getter — returns an image of the current chart, no state change.
|
|
52
|
+
safety: "read",
|
|
53
|
+
returns: "string",
|
|
54
|
+
returnsSchema: {
|
|
55
|
+
type: "string",
|
|
56
|
+
description: "A PNG image of the sparkline encoded as a data URI."
|
|
57
|
+
},
|
|
58
|
+
descriptionKey: "ui.agent.sparkline.actions.exportPng",
|
|
59
|
+
description: "Return a PNG data URI of the sparkline.",
|
|
60
|
+
invoke: (n) => n.dataURI()
|
|
61
|
+
},
|
|
62
|
+
select_annotation: {
|
|
63
|
+
// Routes the host somewhere — the same thing a pointer press on the
|
|
64
|
+
// annotation's band does. Nothing in the chart changes, but the host's
|
|
65
|
+
// surface does, so it is not a read.
|
|
66
|
+
safety: "write",
|
|
67
|
+
argsType: "{ annotationId: string }",
|
|
68
|
+
argsSchema: {
|
|
69
|
+
type: "object",
|
|
70
|
+
properties: {
|
|
71
|
+
annotationId: {
|
|
72
|
+
type: "string",
|
|
73
|
+
description: "The annotation's id, as carried by data-annotation-hit-id on the pressable band. The decorative drawn marker carries the same value as data-annotation-id, but is not selectable."
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
required: ["annotationId"]
|
|
77
|
+
},
|
|
78
|
+
idempotent: !0,
|
|
79
|
+
descriptionKey: "ui.agent.sparkline.actions.selectAnnotation",
|
|
80
|
+
description: "Select a drawn annotation, as pressing its band would. No-op unless the host wired onAnnotationSelect and the id names an annotation that is currently drawn.",
|
|
81
|
+
invoke: (n, r) => {
|
|
82
|
+
n.selectAnnotation(r.annotationId);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
domHooks: {
|
|
87
|
+
root: { attr: "data-component", value: "sparkline" },
|
|
88
|
+
instanceId: {
|
|
89
|
+
attr: "data-component-id",
|
|
90
|
+
sourceProp: "id",
|
|
91
|
+
description: "Sourced from the id prop."
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}, Q = E("ds:relative ds:inline-block ds:w-full", {
|
|
95
|
+
variants: {
|
|
96
|
+
size: {
|
|
97
|
+
xs: "ds:h-6",
|
|
98
|
+
sm: "ds:h-8",
|
|
99
|
+
md: "ds:h-10",
|
|
100
|
+
// Applied when an explicit `height` prop is given: the wrapper
|
|
101
|
+
// grows with the svg instead of clipping at the size's fixed height.
|
|
102
|
+
auto: ""
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
defaultVariants: { size: "md" }
|
|
106
|
+
}), X = E("", {
|
|
107
|
+
variants: {
|
|
108
|
+
tone: {
|
|
109
|
+
neutral: "ds:[--annotation-color:var(--muted-foreground)]",
|
|
110
|
+
info: "ds:[--annotation-color:var(--info)]",
|
|
111
|
+
success: "ds:[--annotation-color:var(--success)]",
|
|
112
|
+
/* `--warning-readable`, not `--warning`: a 1.5px dashed line is a
|
|
113
|
+
* non-text graphic (WCAG 1.4.11, 3:1), and yellow-500 is ~1.6:1 on a
|
|
114
|
+
* light card. The token aliases back to `--warning` in dark. */
|
|
115
|
+
warning: "ds:[--annotation-color:var(--warning-readable)]",
|
|
116
|
+
error: "ds:[--annotation-color:var(--destructive)]",
|
|
117
|
+
accent: "ds:[--annotation-color:var(--accent)]"
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
defaultVariants: { tone: "neutral" }
|
|
121
|
+
}), ve = E(
|
|
122
|
+
"ds:pointer-events-none ds:absolute ds:inset-x-[2px]",
|
|
123
|
+
{
|
|
124
|
+
variants: {
|
|
125
|
+
size: {
|
|
126
|
+
xs: "ds:inset-y-[-10px]",
|
|
127
|
+
sm: "ds:inset-y-[-6px]",
|
|
128
|
+
md: "ds:inset-y-[-2px]",
|
|
129
|
+
auto: "ds:inset-y-0"
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
defaultVariants: { size: "md" }
|
|
133
|
+
}
|
|
134
|
+
), ye = {
|
|
135
|
+
increasing: "↑",
|
|
136
|
+
decreasing: "↓",
|
|
137
|
+
steady: "→"
|
|
138
|
+
}, be = {
|
|
139
|
+
xs: 24,
|
|
140
|
+
sm: 32,
|
|
141
|
+
md: 40
|
|
142
|
+
}, k = 2, Y = 2.5, ke = 44;
|
|
143
|
+
function we(n, r) {
|
|
144
|
+
const c = n.map((s) => ({
|
|
145
|
+
annotation: s,
|
|
146
|
+
centre: ee(s.position) * r
|
|
147
|
+
})).sort((s, o) => s.centre - o.centre);
|
|
148
|
+
return c.map((s, o) => {
|
|
149
|
+
const h = c[o - 1], p = c[o + 1], w = h ? (h.centre + s.centre) / 2 : 0, y = p ? (s.centre + p.centre) / 2 : r, m = Math.max(0, w), a = Math.min(r, y), i = Math.min(ke, Math.max(0, a - m)), x = Math.min(
|
|
150
|
+
Math.max(s.centre - i / 2, m),
|
|
151
|
+
a - i
|
|
152
|
+
);
|
|
153
|
+
return { annotation: s.annotation, x, width: i };
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
function ee(n) {
|
|
157
|
+
return Number.isFinite(n) ? Math.min(1, Math.max(0, n)) : 0;
|
|
158
|
+
}
|
|
159
|
+
function xe(n) {
|
|
160
|
+
return n.filter((r) => r != null);
|
|
161
|
+
}
|
|
162
|
+
function Ie() {
|
|
163
|
+
return typeof window < "u" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
164
|
+
}
|
|
165
|
+
const Ne = oe(
|
|
166
|
+
({
|
|
167
|
+
id: n,
|
|
168
|
+
data: r,
|
|
169
|
+
variant: c = "line",
|
|
170
|
+
size: s = "md",
|
|
171
|
+
label: o,
|
|
172
|
+
color: h,
|
|
173
|
+
showEndpoint: p = !1,
|
|
174
|
+
showTooltip: w = !1,
|
|
175
|
+
width: y,
|
|
176
|
+
height: m,
|
|
177
|
+
annotations: a,
|
|
178
|
+
onAnnotationSelect: i,
|
|
179
|
+
className: x,
|
|
180
|
+
...V
|
|
181
|
+
}, te) => {
|
|
182
|
+
var q;
|
|
183
|
+
const { t: f, i18n: $ } = le(), j = de(), b = A(
|
|
184
|
+
() => `sparkline-${j.replace(/[^a-zA-Z0-9-_]/g, "")}`,
|
|
185
|
+
[j]
|
|
186
|
+
), I = S(null), [O, ne] = Z(0), l = A(() => xe(r), [r]), { direction: C } = fe(l), B = A(() => {
|
|
187
|
+
const e = a && a.length > 0 ? f("sparkline.annotations", {
|
|
188
|
+
list: a.map((v) => v.label).join(", ")
|
|
189
|
+
}) : "", t = (v) => e ? `${v}. ${e}` : v;
|
|
190
|
+
if (l.length === 0)
|
|
191
|
+
return t(f("sparkline.noData", "No data"));
|
|
192
|
+
const u = (v) => new Intl.NumberFormat($.language).format(v), g = f(`sparkline.direction.${C}`), R = {
|
|
193
|
+
min: u(Math.min(...l)),
|
|
194
|
+
max: u(Math.max(...l)),
|
|
195
|
+
current: u(l[l.length - 1]),
|
|
196
|
+
direction: g
|
|
197
|
+
};
|
|
198
|
+
return t(o ? f("sparkline.summary", { label: o, ...R }) : f("sparkline.summaryNoLabel", R));
|
|
199
|
+
}, [l, a, o, C, $.language, f]), [N, ae] = Z(
|
|
200
|
+
() => {
|
|
201
|
+
try {
|
|
202
|
+
return J();
|
|
203
|
+
} catch {
|
|
204
|
+
return {};
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
);
|
|
208
|
+
P(() => {
|
|
209
|
+
let e;
|
|
210
|
+
const t = new MutationObserver(() => {
|
|
211
|
+
clearTimeout(e), e = setTimeout(() => {
|
|
212
|
+
try {
|
|
213
|
+
ae(J());
|
|
214
|
+
} catch {
|
|
215
|
+
}
|
|
216
|
+
}, 50);
|
|
217
|
+
});
|
|
218
|
+
return t.observe(document.documentElement, {
|
|
219
|
+
attributes: !0,
|
|
220
|
+
attributeFilter: ["class"]
|
|
221
|
+
}), () => {
|
|
222
|
+
clearTimeout(e), t.disconnect();
|
|
223
|
+
};
|
|
224
|
+
}, []), P(() => {
|
|
225
|
+
const e = I.current;
|
|
226
|
+
if (!e) return;
|
|
227
|
+
const t = new ResizeObserver((u) => {
|
|
228
|
+
const g = u[0];
|
|
229
|
+
g && ne(Math.floor(g.contentRect.width));
|
|
230
|
+
});
|
|
231
|
+
return t.observe(e), () => t.disconnect();
|
|
232
|
+
}, []), pe(I);
|
|
233
|
+
const M = S(i);
|
|
234
|
+
P(() => {
|
|
235
|
+
M.current = i;
|
|
236
|
+
}, [i]);
|
|
237
|
+
const F = S(a);
|
|
238
|
+
F.current = a;
|
|
239
|
+
const z = A(
|
|
240
|
+
() => ({
|
|
241
|
+
updateSeries(e) {
|
|
242
|
+
var t;
|
|
243
|
+
(t = U.getChartByID(b)) == null || t.updateSeries([{ data: e }]);
|
|
244
|
+
},
|
|
245
|
+
updateOptions(e) {
|
|
246
|
+
var t;
|
|
247
|
+
(t = U.getChartByID(b)) == null || t.updateOptions(e);
|
|
248
|
+
},
|
|
249
|
+
async dataURI() {
|
|
250
|
+
const e = U.getChartByID(b);
|
|
251
|
+
return e ? (await e.dataURI()).imgURI : "";
|
|
252
|
+
},
|
|
253
|
+
selectAnnotation(e) {
|
|
254
|
+
var u, g;
|
|
255
|
+
(u = F.current) != null && u.some((R) => R.id === e) && ((g = M.current) == null || g.call(M, e));
|
|
256
|
+
}
|
|
257
|
+
}),
|
|
258
|
+
[b]
|
|
259
|
+
);
|
|
260
|
+
ce(te, () => z, [z]), he(ge, z, n);
|
|
261
|
+
const _ = h ?? ((q = N.colors) == null ? void 0 : q[0]) ?? "currentColor";
|
|
262
|
+
if (l.length === 0)
|
|
263
|
+
return /* @__PURE__ */ d(
|
|
264
|
+
"div",
|
|
265
|
+
{
|
|
266
|
+
ref: I,
|
|
267
|
+
role: "img",
|
|
268
|
+
"aria-label": B,
|
|
269
|
+
dir: "ltr",
|
|
270
|
+
className: Q({
|
|
271
|
+
size: m !== void 0 ? "auto" : s,
|
|
272
|
+
className: x
|
|
273
|
+
}),
|
|
274
|
+
"data-component": "sparkline",
|
|
275
|
+
"data-component-id": n,
|
|
276
|
+
...V
|
|
277
|
+
}
|
|
278
|
+
);
|
|
279
|
+
const G = Ie(), H = r.length > l.length, L = H ? r.flatMap((e, t) => e == null ? [] : [{ x: t, y: e }]) : l, re = {
|
|
280
|
+
...N,
|
|
281
|
+
chart: {
|
|
282
|
+
...N.chart,
|
|
283
|
+
id: b,
|
|
284
|
+
type: c,
|
|
285
|
+
sparkline: { enabled: !0 },
|
|
286
|
+
toolbar: { show: !1 },
|
|
287
|
+
animations: {
|
|
288
|
+
enabled: !G,
|
|
289
|
+
// A gapped series is re-rendered as {x, y} pairs, and Apex's
|
|
290
|
+
// update tween interpolates between the old and new paths point by
|
|
291
|
+
// point. Across a width change the two have different lengths and
|
|
292
|
+
// the tween emits `d="… NaN …"` for a few frames. The finished
|
|
293
|
+
// render is correct either way; switching the tween off keeps the
|
|
294
|
+
// console clean.
|
|
295
|
+
dynamicAnimation: { enabled: !G && !H }
|
|
296
|
+
},
|
|
297
|
+
zoom: { enabled: !1 },
|
|
298
|
+
parentHeightOffset: 0
|
|
299
|
+
},
|
|
300
|
+
colors: [_],
|
|
301
|
+
stroke: {
|
|
302
|
+
curve: "smooth",
|
|
303
|
+
width: c === "bar" ? 0 : 2
|
|
304
|
+
},
|
|
305
|
+
fill: {
|
|
306
|
+
opacity: c === "area" ? 0.15 : 1
|
|
307
|
+
},
|
|
308
|
+
xaxis: {
|
|
309
|
+
crosshairs: { show: !1 },
|
|
310
|
+
// Pin the extent to the slot count so a gap at either end still holds
|
|
311
|
+
// its place — otherwise the plot would rescale to the measurements
|
|
312
|
+
// and the annotation fractions would no longer mean the same thing.
|
|
313
|
+
...H ? { type: "numeric", min: 0, max: r.length - 1 } : {}
|
|
314
|
+
},
|
|
315
|
+
tooltip: { enabled: w },
|
|
316
|
+
markers: p ? {
|
|
317
|
+
size: [0],
|
|
318
|
+
discrete: [
|
|
319
|
+
{
|
|
320
|
+
// An index into the SERIES, whose holes have already been
|
|
321
|
+
// removed — so this is the last MEASURED point, never a slot
|
|
322
|
+
// the parameter was not measured at.
|
|
323
|
+
seriesIndex: 0,
|
|
324
|
+
dataPointIndex: L.length - 1,
|
|
325
|
+
fillColor: _,
|
|
326
|
+
strokeColor: _,
|
|
327
|
+
size: 4
|
|
328
|
+
}
|
|
329
|
+
]
|
|
330
|
+
} : { size: 0 },
|
|
331
|
+
grid: {
|
|
332
|
+
...N.grid,
|
|
333
|
+
show: !1,
|
|
334
|
+
// ApexCharts grid.padding uses physical keys (not CSS logical properties).
|
|
335
|
+
// The chart wrapper enforces dir="ltr" so these always resolve correctly.
|
|
336
|
+
padding: {
|
|
337
|
+
top: k,
|
|
338
|
+
right: k,
|
|
339
|
+
bottom: k,
|
|
340
|
+
left: k
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}, se = y ?? (O > 0 ? O : "100%"), ie = m ?? be[s ?? "md"], T = a != null && a.length ? a : void 0, W = O - k * 2, K = i && T && W > 0 ? we(T, W) : void 0;
|
|
344
|
+
return /* @__PURE__ */ D(
|
|
345
|
+
"div",
|
|
346
|
+
{
|
|
347
|
+
ref: I,
|
|
348
|
+
role: "img",
|
|
349
|
+
"aria-label": B,
|
|
350
|
+
dir: "ltr",
|
|
351
|
+
className: Q({
|
|
352
|
+
size: m !== void 0 ? "auto" : s,
|
|
353
|
+
className: x
|
|
354
|
+
}),
|
|
355
|
+
"data-component": "sparkline",
|
|
356
|
+
"data-component-id": n,
|
|
357
|
+
...V,
|
|
358
|
+
children: [
|
|
359
|
+
/* @__PURE__ */ d(
|
|
360
|
+
ue,
|
|
361
|
+
{
|
|
362
|
+
type: c,
|
|
363
|
+
series: [{ data: L }],
|
|
364
|
+
options: re,
|
|
365
|
+
width: se,
|
|
366
|
+
height: ie,
|
|
367
|
+
"aria-hidden": "true"
|
|
368
|
+
}
|
|
369
|
+
),
|
|
370
|
+
T && /* Drawn over the plot rather than through ApexCharts' own xaxis
|
|
371
|
+
annotations: a fraction of the measured extent is the one
|
|
372
|
+
positioning rule that survives series of different lengths, which
|
|
373
|
+
is what makes a column of sparklines share an x. */
|
|
374
|
+
/* The inset lives on a div: an <svg> is a replaced element, so
|
|
375
|
+
left+right do not size it and it would fall back to its intrinsic
|
|
376
|
+
300px. The div is the plot box; the svg fills it. The 2px MUST
|
|
377
|
+
equal PLOT_EDGE_PADDING — Tailwind needs a static literal, so the
|
|
378
|
+
two cannot share one source; change them together or the first and
|
|
379
|
+
last annotation drift off the first and last data point. */
|
|
380
|
+
/* @__PURE__ */ d("div", { className: "ds:pointer-events-none ds:absolute ds:inset-y-0 ds:inset-x-[2px]", children: /* @__PURE__ */ d(
|
|
381
|
+
"svg",
|
|
382
|
+
{
|
|
383
|
+
"aria-hidden": "true",
|
|
384
|
+
focusable: "false",
|
|
385
|
+
"data-testid": "sparkline-annotations",
|
|
386
|
+
className: "ds:size-full",
|
|
387
|
+
children: T.map((e) => {
|
|
388
|
+
const t = ee(e.position);
|
|
389
|
+
return (
|
|
390
|
+
/* A nested viewport placed at a percentage of the plot: the
|
|
391
|
+
one positioning rule that needs no measurement, so a column
|
|
392
|
+
of sparklines shares an x whatever their widths. */
|
|
393
|
+
/* @__PURE__ */ D(
|
|
394
|
+
"svg",
|
|
395
|
+
{
|
|
396
|
+
x: `${t * 100}%`,
|
|
397
|
+
y: "0",
|
|
398
|
+
width: "1",
|
|
399
|
+
height: "100%",
|
|
400
|
+
overflow: "visible",
|
|
401
|
+
"data-annotation-id": e.id,
|
|
402
|
+
"data-annotation-position": t,
|
|
403
|
+
className: X({ tone: e.tone }),
|
|
404
|
+
children: [
|
|
405
|
+
/* @__PURE__ */ d(
|
|
406
|
+
"line",
|
|
407
|
+
{
|
|
408
|
+
x1: 0,
|
|
409
|
+
x2: 0,
|
|
410
|
+
y1: 0,
|
|
411
|
+
y2: "100%",
|
|
412
|
+
className: "ds:[stroke:var(--annotation-color)] ds:[stroke-dasharray:2_3] ds:[stroke-width:1]"
|
|
413
|
+
}
|
|
414
|
+
),
|
|
415
|
+
/* @__PURE__ */ d(
|
|
416
|
+
"path",
|
|
417
|
+
{
|
|
418
|
+
d: me(
|
|
419
|
+
e.shape ?? "diamond",
|
|
420
|
+
0,
|
|
421
|
+
Y,
|
|
422
|
+
Y
|
|
423
|
+
),
|
|
424
|
+
className: "ds:[fill:var(--annotation-color)]"
|
|
425
|
+
}
|
|
426
|
+
)
|
|
427
|
+
]
|
|
428
|
+
},
|
|
429
|
+
e.id
|
|
430
|
+
)
|
|
431
|
+
);
|
|
432
|
+
})
|
|
433
|
+
}
|
|
434
|
+
) }),
|
|
435
|
+
K && i && /* Sized in px, not percentages: 44px is a measurement, not a
|
|
436
|
+
fraction of a box the reader can resize. `pointer-events-none`
|
|
437
|
+
holds all the way down to the bands, so the only live pixels are
|
|
438
|
+
the 44px each annotation owns. */
|
|
439
|
+
/* @__PURE__ */ d(
|
|
440
|
+
"div",
|
|
441
|
+
{
|
|
442
|
+
className: ve({
|
|
443
|
+
size: m !== void 0 ? "auto" : s
|
|
444
|
+
}),
|
|
445
|
+
children: /* @__PURE__ */ d(
|
|
446
|
+
"svg",
|
|
447
|
+
{
|
|
448
|
+
"aria-hidden": "true",
|
|
449
|
+
focusable: "false",
|
|
450
|
+
"data-testid": "sparkline-annotation-hits",
|
|
451
|
+
className: "ds:size-full",
|
|
452
|
+
children: K.map(({ annotation: e, x: t, width: u }) => /* @__PURE__ */ D(
|
|
453
|
+
"g",
|
|
454
|
+
{
|
|
455
|
+
"data-annotation-hit-id": e.id,
|
|
456
|
+
onClick: () => i(e.id),
|
|
457
|
+
className: `ds:group ds:pointer-events-auto ds:cursor-pointer ${X(
|
|
458
|
+
{ tone: e.tone }
|
|
459
|
+
)}`,
|
|
460
|
+
children: [
|
|
461
|
+
/* @__PURE__ */ d("title", { children: f("sparkline.annotationAction", {
|
|
462
|
+
label: e.label
|
|
463
|
+
}) }),
|
|
464
|
+
/* @__PURE__ */ d(
|
|
465
|
+
"rect",
|
|
466
|
+
{
|
|
467
|
+
x: t,
|
|
468
|
+
y: 0,
|
|
469
|
+
width: u,
|
|
470
|
+
height: "100%",
|
|
471
|
+
className: "ds:[fill:var(--annotation-color)] ds:opacity-0 ds:transition-opacity ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none ds:group-hover:opacity-20"
|
|
472
|
+
}
|
|
473
|
+
)
|
|
474
|
+
]
|
|
475
|
+
},
|
|
476
|
+
e.id
|
|
477
|
+
))
|
|
478
|
+
}
|
|
479
|
+
)
|
|
480
|
+
}
|
|
481
|
+
),
|
|
482
|
+
p && /* @__PURE__ */ d(
|
|
483
|
+
"span",
|
|
484
|
+
{
|
|
485
|
+
"aria-hidden": "true",
|
|
486
|
+
className: "ds:pointer-events-none ds:absolute ds:end-0 ds:top-0 ds:text-[length:var(--font-size-xs)] ds:leading-none",
|
|
487
|
+
children: ye[C]
|
|
488
|
+
}
|
|
489
|
+
)
|
|
490
|
+
]
|
|
491
|
+
}
|
|
492
|
+
);
|
|
493
|
+
}
|
|
494
|
+
);
|
|
495
|
+
Ne.displayName = "Sparkline";
|
|
496
|
+
export {
|
|
497
|
+
Ne as S,
|
|
498
|
+
ge as s,
|
|
499
|
+
fe as u
|
|
500
|
+
};
|
|
501
|
+
//# sourceMappingURL=sparkline-DJtZBe7O.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sparkline-DJtZBe7O.js","sources":["../../src/components/sparkline/use-linear-trend.ts","../../src/components/sparkline/sparkline.agent.ts","../../src/components/sparkline/sparkline.tsx"],"sourcesContent":["export type TrendDirection = 'increasing' | 'decreasing' | 'steady';\n\nexport interface LinearTrendResult {\n slope: number;\n direction: TrendDirection;\n}\n\nexport function useLinearTrend(data: number[]): LinearTrendResult {\n if (data.length < 2) {\n return { slope: 0, direction: 'steady' };\n }\n\n const n = data.length;\n const xMean = (n - 1) / 2;\n const yMean = data.reduce((sum, y) => sum + y, 0) / n;\n\n let numerator = 0;\n let denominator = 0;\n\n for (let i = 0; i < n; i++) {\n const dx = i - xMean;\n numerator += dx * (data[i] - yMean);\n denominator += dx * dx;\n }\n\n const slope = denominator === 0 ? 0 : numerator / denominator;\n const range = Math.max(...data) - Math.min(...data);\n const threshold = 0.01 * (range || 1);\n\n const direction: TrendDirection =\n Math.abs(slope) < threshold\n ? 'steady'\n : slope > 0\n ? 'increasing'\n : 'decreasing';\n\n return { slope, direction };\n}\n","import type { AgentAdapter } from '../../agent/types';\nimport type { SparklineHandle } from './sparkline';\n\nexport const sparklineAgent: AgentAdapter<SparklineHandle> = {\n id: 'sparkline',\n capabilities: [],\n state: {},\n actions: {\n update_series: {\n // Replacing the rendered series mutates what the chart displays — write,\n // not read.\n safety: 'write',\n argsType: '{ data: number[] }',\n argsSchema: {\n type: 'object',\n properties: {\n data: {\n type: 'array',\n items: { type: 'number' },\n description: 'The new data points to render.',\n },\n },\n required: ['data'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.sparkline.actions.updateSeries',\n description: 'Replace the sparkline data without remounting.',\n invoke: (handle, args: { data: number[] }) => {\n handle.updateSeries(args.data);\n },\n },\n export_png: {\n // Pure getter — returns an image of the current chart, no state change.\n safety: 'read',\n returns: 'string',\n returnsSchema: {\n type: 'string',\n description: 'A PNG image of the sparkline encoded as a data URI.',\n },\n descriptionKey: 'ui.agent.sparkline.actions.exportPng',\n description: 'Return a PNG data URI of the sparkline.',\n invoke: (handle) => handle.dataURI(),\n },\n select_annotation: {\n // Routes the host somewhere — the same thing a pointer press on the\n // annotation's band does. Nothing in the chart changes, but the host's\n // surface does, so it is not a read.\n safety: 'write',\n argsType: '{ annotationId: string }',\n argsSchema: {\n type: 'object',\n properties: {\n annotationId: {\n type: 'string',\n description:\n \"The annotation's id, as carried by data-annotation-hit-id on the pressable band. The decorative drawn marker carries the same value as data-annotation-id, but is not selectable.\",\n },\n },\n required: ['annotationId'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.sparkline.actions.selectAnnotation',\n description:\n 'Select a drawn annotation, as pressing its band would. No-op unless the host wired onAnnotationSelect and the id names an annotation that is currently drawn.',\n invoke: (handle, args: { annotationId: string }) => {\n handle.selectAnnotation(args.annotationId);\n },\n },\n },\n domHooks: {\n root: { attr: 'data-component', value: 'sparkline' },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop.',\n },\n },\n};\n","import {\n forwardRef,\n useEffect,\n useId,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n type HTMLAttributes,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport ReactApexChart from 'react-apexcharts';\nimport ApexCharts from 'apexcharts';\nimport { getApexChartsTheme } from '../../tokens/apexcharts-theme';\nimport { useNeutraliseHiddenFocus } from '../_shared/use-neutralize-hidden-focus';\nimport { markerPath, type MarkerShape } from '../annotation-marker';\nimport { useLinearTrend } from './use-linear-trend';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { sparklineAgent } from './sparkline.agent';\n\n/* ------------------------------------------------------------------ */\n/* CVA */\n/* ------------------------------------------------------------------ */\n\nconst sparklineVariants = cva('ds:relative ds:inline-block ds:w-full', {\n variants: {\n size: {\n xs: 'ds:h-6',\n sm: 'ds:h-8',\n md: 'ds:h-10',\n // Applied when an explicit `height` prop is given: the wrapper\n // grows with the svg instead of clipping at the size's fixed height.\n auto: '',\n },\n },\n defaultVariants: { size: 'md' },\n});\n\n/* Tone only TINTS the annotation — the shape is what distinguishes one\n * event from another (WCAG 1.4.1), matching AnnotationMarker's vocabulary. */\nconst annotationVariants = cva('', {\n variants: {\n tone: {\n neutral: 'ds:[--annotation-color:var(--muted-foreground)]',\n info: 'ds:[--annotation-color:var(--info)]',\n success: 'ds:[--annotation-color:var(--success)]',\n /* `--warning-readable`, not `--warning`: a 1.5px dashed line is a\n * non-text graphic (WCAG 1.4.11, 3:1), and yellow-500 is ~1.6:1 on a\n * light card. The token aliases back to `--warning` in dark. */\n warning: 'ds:[--annotation-color:var(--warning-readable)]',\n error: 'ds:[--annotation-color:var(--destructive)]',\n accent: 'ds:[--annotation-color:var(--accent)]',\n },\n },\n defaultVariants: { tone: 'neutral' },\n});\n\n/* A 24–40px sparkline cannot hold a 44px target, so the POINTER layer alone is\n * bled outward to reach it — 24+20, 32+12, 40+4. The drawn layer is a separate\n * div at `inset-y-0`; nothing rendered moves.\n *\n * These are LITERAL 44px, not `--min-target-size`: the band's width is a JS\n * constant the CSS has to agree with, so both are pinned to the light/dark\n * value. `.theme-accessible` raises the token to 48px and the band does not\n * follow — see `onAnnotationSelect`. `auto` (an explicit `height`) cannot be\n * computed here at all and inherits whatever the host set. */\nconst annotationHitVariants = cva(\n 'ds:pointer-events-none ds:absolute ds:inset-x-[2px]',\n {\n variants: {\n size: {\n xs: 'ds:inset-y-[-10px]',\n sm: 'ds:inset-y-[-6px]',\n md: 'ds:inset-y-[-2px]',\n auto: 'ds:inset-y-0',\n },\n },\n defaultVariants: { size: 'md' },\n },\n);\n\n/* ------------------------------------------------------------------ */\n/* Constants */\n/* ------------------------------------------------------------------ */\n\nconst DIRECTION_ARROW = {\n increasing: '↑',\n decreasing: '↓',\n steady: '→',\n} as const;\n\nconst SIZE_HEIGHT: Record<'xs' | 'sm' | 'md', number> = {\n xs: 24,\n sm: 32,\n md: 40,\n};\n\n/** ApexCharts grid padding, in px. The plotted extent is the wrapper inset by\n * this on each edge, so the annotation overlay has to use the same number to\n * land its first/last position on the first/last data point. */\nconst PLOT_EDGE_PADDING = 2;\n\n/** Radius of an annotation's shape cap, in svg user units (= px here). Sized\n * against the SMALLEST sparkline it has to sit on (`xs`, 24px): a 5px cap is\n * ~a fifth of that height, still shape-legible, and no longer competes with\n * the series it annotates. */\nconst ANNOTATION_CAP_RADIUS = 2.5;\n\n/** The pointer band an annotation gets, in px, and the widest one is ever\n * allowed to be — wider and a sparse set of annotations would turn the whole\n * trend into a click target. Matches `--min-target-size` in light/dark; it is a\n * literal, so it does NOT rise with the token under `.theme-accessible`. */\nconst ANNOTATION_HIT_WIDTH = 44;\n\ninterface AnnotationHitBand {\n annotation: SparklineAnnotation;\n x: number;\n width: number;\n}\n\n/**\n * The pointer bands for a set of annotations across a plot `plotWidth` px wide.\n * Pure — the geometry is the only part needing a measured width, and keeping it\n * out of the render is what makes it testable.\n *\n * Each annotation owns the strip from the midpoint of the gap behind it to the\n * midpoint of the gap ahead, clamped to the plot. Its band is 44px inside that\n * strip, centred on its line and slid inward where the strip's edge would cut\n * it — so a line on the first data point still gets a full band, and no band\n * reaches past the plot onto whatever sits beside the sparkline. Annotations\n * closer than 44px each keep half the gap: a press must mean exactly one.\n */\nfunction annotationHitBands(\n annotations: readonly SparklineAnnotation[],\n plotWidth: number,\n): AnnotationHitBand[] {\n const centred = annotations\n .map((annotation) => ({\n annotation,\n centre: clampFraction(annotation.position) * plotWidth,\n }))\n .sort((a, b) => a.centre - b.centre);\n\n return centred.map((entry, index) => {\n const before = centred[index - 1];\n const after = centred[index + 1];\n const from = before ? (before.centre + entry.centre) / 2 : 0;\n const to = after ? (entry.centre + after.centre) / 2 : plotWidth;\n const lower = Math.max(0, from);\n const upper = Math.min(plotWidth, to);\n const width = Math.min(ANNOTATION_HIT_WIDTH, Math.max(0, upper - lower));\n const x = Math.min(\n Math.max(entry.centre - width / 2, lower),\n upper - width,\n );\n return { annotation: entry.annotation, x, width };\n });\n}\n\nfunction clampFraction(value: number): number {\n if (!Number.isFinite(value)) return 0;\n return Math.min(1, Math.max(0, value));\n}\n\n/** The measurements in a series, gaps dropped. A `null` is an unmeasured\n * position, not a zero — it must not reach the min/max/trend maths. */\nfunction measured(data: readonly (number | null)[]): number[] {\n return data.filter((value): value is number => value != null);\n}\n\nfunction prefersReducedMotion(): boolean {\n return (\n typeof window !== 'undefined' &&\n window.matchMedia('(prefers-reduced-motion: reduce)').matches\n );\n}\n\n/* ------------------------------------------------------------------ */\n/* Public types */\n/* ------------------------------------------------------------------ */\n\nexport interface SparklineHandle {\n updateSeries: (data: (number | null)[]) => void;\n updateOptions: (opts: ApexCharts.ApexOptions) => void;\n dataURI: () => Promise<string>;\n /** Fire the host's annotation handler for `id`, as a pointer press on that\n * annotation's band would. No-op when the sparkline is not selectable, or\n * when `id` names no currently drawn annotation. */\n selectAnnotation: (id: string) => void;\n}\n\n/** Semantic tint for an annotation. Decorative reinforcement of `shape` —\n * never the only channel carrying which event this is. */\nexport type SparklineAnnotationTone =\n | 'neutral'\n | 'info'\n | 'success'\n | 'warning'\n | 'error'\n | 'accent';\n\n/**\n * A vertical reference line dropped across the plot — the release-annotation\n * pattern: \"something happened here, look at what the line does around it\".\n *\n * `position` is a FRACTION of the plotted x extent, not an index: `0` is the\n * first data point, `1` the last, `0.5` exactly halfway between them. That is\n * what lets an event that falls BETWEEN two points be placed at all, and what\n * lets the same event land at the same x in a column of stacked sparklines —\n * the caller derives the fraction once, from a domain the whole column shares,\n * rather than per-series from a point count that differs row to row.\n */\nexport interface SparklineAnnotation {\n /** Stable key — also emitted as `data-annotation-id` for test/agent hooks. */\n id: string;\n /** Fraction of the plotted x extent: 0 = first point, 1 = last. Clamped. */\n position: number;\n /** Accessible label, already localised by the caller. Folded into the\n * sparkline's own `aria-label` — the line itself says nothing aloud. */\n label: string;\n /** Shape of the cap drawn at the top of the line. The accessible channel. */\n shape?: MarkerShape;\n tone?: SparklineAnnotationTone;\n}\n\nexport interface SparklineProps\n extends\n Omit<HTMLAttributes<HTMLDivElement>, 'role' | 'children'>,\n VariantProps<typeof sparklineVariants> {\n /** Data points in plot order. `null` is an unmeasured position — it holds\n * the point's place on the x extent and draws a gap, so a series measured\n * at some positions and not others stays aligned with one that was measured\n * at all of them. */\n data: (number | null)[];\n /** Chart visual style */\n variant?: 'line' | 'bar' | 'area';\n /** Size preset */\n size?: 'xs' | 'sm' | 'md';\n /** Accessible label prefix, e.g. \"Revenue, 30 days\" */\n label?: string;\n /** Stroke / bar colour override — defaults to var(--primary) via bridge */\n color?: string;\n /** Show end-point dot with trend direction arrow */\n showEndpoint?: boolean;\n /**\n * Show Apex's hover tooltip with the data point value. Defaults to\n * `false` — sparklines are intentionally minimal — opt in when the\n * sparkline is large enough to be a primary metric surface (e.g.\n * dashboard widgets) and the user benefits from per-point readout.\n */\n showTooltip?: boolean;\n /** Width override — defaults to 100% of container */\n width?: string | number;\n /** Height override — defaults to the size variant height */\n height?: string | number;\n /** Vertical reference lines dropped across the plot. Omitted = none, so\n * every existing consumer is unaffected. */\n annotations?: readonly SparklineAnnotation[];\n /**\n * Make the drawn annotations POINTER-selectable — a press anywhere in an\n * annotation's 44px band calls this with its `id`. Omitted (the default, and\n * what every consumer before 1.1.0 gets) leaves them decorative, which is\n * what a dashboard sparkline wants: a trend thumbnail should not be a click\n * target.\n *\n * NOT a keyboard route, and deliberately so. The sparkline is `role=\"img\"`,\n * whose descendants are not exposed to assistive technology at all, so a\n * focusable control drawn inside it would be a tab stop with no accessible\n * name. The host MUST therefore already offer a keyboard control that does\n * the same thing for the same annotation (WCAG 2.1.1) — this is a pointer\n * shortcut to that control, never the only way in.\n *\n * The 44px band is delivered by the `size` variants only. Pass an explicit\n * `height` and the pointer layer falls back to the drawn height, so\n * `height={20}` yields a 20px-tall target — below even WCAG 2.5.8. Under\n * `.theme-accessible`, where `--min-target-size` is 48px, the band stays 44.\n */\n onAnnotationSelect?: (annotationId: string) => void;\n}\n\n/* ------------------------------------------------------------------ */\n/* Sparkline component */\n/* ------------------------------------------------------------------ */\n\nexport const Sparkline = forwardRef<SparklineHandle, SparklineProps>(\n (\n {\n id,\n data,\n variant = 'line',\n size = 'md',\n label,\n color,\n showEndpoint = false,\n showTooltip = false,\n width,\n height,\n annotations,\n onAnnotationSelect,\n className,\n ...props\n },\n ref,\n ) => {\n const { t, i18n } = useTranslation();\n const rawId = useId();\n const chartId = useMemo(\n () => `sparkline-${rawId.replace(/[^a-zA-Z0-9-_]/g, '')}`,\n [rawId],\n );\n const wrapperRef = useRef<HTMLDivElement>(null);\n const [containerWidth, setContainerWidth] = useState(0);\n\n // Gaps are positions, not values: they hold the point's place on the x\n // extent but never reach the trend, the min/max, or the endpoint dot.\n const points = useMemo(() => measured(data), [data]);\n const { direction } = useLinearTrend(points);\n\n /* ---- accessible summary ---------------------------------------- */\n const ariaLabel = useMemo(() => {\n // The annotations are the only thing a vertical line in an SVG can say\n // aloud, so they ride the summary in every branch — including \"no data\",\n // where the marked events are all there is left to report.\n const marks =\n annotations && annotations.length > 0\n ? t('sparkline.annotations', {\n list: annotations.map((a) => a.label).join(', '),\n })\n : '';\n const withMarks = (summary: string) =>\n marks ? `${summary}. ${marks}` : summary;\n\n if (points.length === 0) {\n return withMarks(t('sparkline.noData', 'No data'));\n }\n const fmt = (n: number) => new Intl.NumberFormat(i18n.language).format(n);\n const dirText = t(`sparkline.direction.${direction}`);\n const nums = {\n min: fmt(Math.min(...points)),\n max: fmt(Math.max(...points)),\n current: fmt(points[points.length - 1]),\n direction: dirText,\n };\n if (label) {\n return withMarks(t('sparkline.summary', { label, ...nums }));\n }\n return withMarks(t('sparkline.summaryNoLabel', nums));\n }, [points, annotations, label, direction, i18n.language, t]);\n\n /* ---- theme-reactive state -------------------------------------- */\n const [themeOptions, setThemeOptions] = useState<ApexCharts.ApexOptions>(\n () => {\n try {\n return getApexChartsTheme();\n } catch {\n return {};\n }\n },\n );\n\n /* ---- MutationObserver: re-read theme on class change ----------- */\n useEffect(() => {\n let timer: ReturnType<typeof setTimeout>;\n const observer = new MutationObserver(() => {\n clearTimeout(timer);\n timer = setTimeout(() => {\n try {\n setThemeOptions(getApexChartsTheme());\n } catch {\n /* no-op in non-browser environments */\n }\n }, 50);\n });\n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: ['class'],\n });\n return () => {\n clearTimeout(timer);\n observer.disconnect();\n };\n }, []);\n\n /* ---- ResizeObserver: track container width -------------------- */\n useEffect(() => {\n const el = wrapperRef.current;\n if (!el) return;\n const ro = new ResizeObserver((entries) => {\n const entry = entries[0];\n if (entry) setContainerWidth(Math.floor(entry.contentRect.width));\n });\n ro.observe(el);\n return () => ro.disconnect();\n }, []);\n\n /* ApexCharts injects focusable canvases inside the `aria-hidden` */\n /* chart wrapper. Neutralise their tabindex so axe's */\n /* `aria-hidden-focus` rule passes. Shared hook — same fix in */\n /* `Chart` (full apex) and the calendar's mirror events. */\n useNeutraliseHiddenFocus(wrapperRef);\n\n /* ---- imperative handle ---------------------------------------- */\n // Through a ref so the handle keeps one identity across a host that\n // re-creates the callback on every render — the agent registry keys on it.\n const selectRef = useRef(onAnnotationSelect);\n useEffect(() => {\n selectRef.current = onAnnotationSelect;\n }, [onAnnotationSelect]);\n // Assigned during render, not in an effect: an agent may call before the\n // next commit, and routing the host to an annotation that is not drawn\n // opens a panel addressed to nothing.\n const drawnRef = useRef(annotations);\n drawnRef.current = annotations;\n\n const agentHandle = useMemo<SparklineHandle>(\n () => ({\n updateSeries(newData: (number | null)[]) {\n ApexCharts.getChartByID(chartId)?.updateSeries([{ data: newData }]);\n },\n updateOptions(opts: ApexCharts.ApexOptions) {\n ApexCharts.getChartByID(chartId)?.updateOptions(opts);\n },\n async dataURI(): Promise<string> {\n const instance = ApexCharts.getChartByID(chartId);\n if (!instance) return '';\n const result = await instance.dataURI();\n return (result as { imgURI: string }).imgURI;\n },\n selectAnnotation(annotationId: string) {\n const drawn = drawnRef.current?.some((a) => a.id === annotationId);\n if (!drawn) return;\n selectRef.current?.(annotationId);\n },\n }),\n [chartId],\n );\n useImperativeHandle(ref, () => agentHandle, [agentHandle]);\n useAgentRegistration(sparklineAgent, agentHandle, id);\n\n /* ---- resolve color -------------------------------------------- */\n const resolvedColor = color ?? themeOptions.colors?.[0] ?? 'currentColor';\n\n /* ---- empty state ---------------------------------------------- */\n if (points.length === 0) {\n return (\n <div\n ref={wrapperRef}\n role=\"img\"\n aria-label={ariaLabel}\n dir=\"ltr\"\n className={sparklineVariants({\n size: height !== undefined ? 'auto' : size,\n className,\n })}\n data-component=\"sparkline\"\n data-component-id={id}\n {...props}\n />\n );\n }\n\n /* ---- chart config ---------------------------------------------- */\n const reducedMotion = prefersReducedMotion();\n\n // A gapped series is plotted as {x, y} pairs on a NUMERIC axis pinned to\n // the full slot count, not as an array with holes in it: ApexCharts draws\n // a line only between consecutive non-null points, so a lab measured at\n // slots 0, 4 and 8 would render as three isolated points and no trend at\n // all. Pairs keep each measurement at its own slot, connect across the\n // gap, and leave the extent — and so every annotation — unchanged.\n // Gapless data keeps the plain-array form, so every existing consumer\n // renders byte-identically.\n const gapped = data.length > points.length;\n const seriesData = gapped\n ? data.flatMap((y, x) => (y == null ? [] : [{ x, y }]))\n : points;\n\n const chartOptions: ApexCharts.ApexOptions = {\n ...themeOptions,\n chart: {\n ...themeOptions.chart,\n id: chartId,\n type: variant,\n sparkline: { enabled: true },\n toolbar: { show: false },\n animations: {\n enabled: !reducedMotion,\n // A gapped series is re-rendered as {x, y} pairs, and Apex's\n // update tween interpolates between the old and new paths point by\n // point. Across a width change the two have different lengths and\n // the tween emits `d=\"… NaN …\"` for a few frames. The finished\n // render is correct either way; switching the tween off keeps the\n // console clean.\n dynamicAnimation: { enabled: !reducedMotion && !gapped },\n },\n zoom: { enabled: false },\n parentHeightOffset: 0,\n },\n colors: [resolvedColor],\n stroke: {\n curve: 'smooth',\n width: variant === 'bar' ? 0 : 2,\n },\n fill: {\n opacity: variant === 'area' ? 0.15 : 1,\n },\n xaxis: {\n crosshairs: { show: false },\n // Pin the extent to the slot count so a gap at either end still holds\n // its place — otherwise the plot would rescale to the measurements\n // and the annotation fractions would no longer mean the same thing.\n ...(gapped\n ? { type: 'numeric' as const, min: 0, max: data.length - 1 }\n : {}),\n },\n tooltip: { enabled: showTooltip },\n markers: showEndpoint\n ? {\n size: [0],\n discrete: [\n {\n // An index into the SERIES, whose holes have already been\n // removed — so this is the last MEASURED point, never a slot\n // the parameter was not measured at.\n seriesIndex: 0,\n dataPointIndex: seriesData.length - 1,\n fillColor: resolvedColor,\n strokeColor: resolvedColor,\n size: 4,\n },\n ],\n }\n : { size: 0 },\n grid: {\n ...themeOptions.grid,\n show: false,\n // ApexCharts grid.padding uses physical keys (not CSS logical properties).\n // The chart wrapper enforces dir=\"ltr\" so these always resolve correctly.\n padding: {\n top: PLOT_EDGE_PADDING,\n right: PLOT_EDGE_PADDING,\n bottom: PLOT_EDGE_PADDING,\n left: PLOT_EDGE_PADDING,\n },\n },\n };\n\n const resolvedWidth =\n width ?? (containerWidth > 0 ? containerWidth : '100%');\n const resolvedHeight = height ?? SIZE_HEIGHT[size ?? 'md'];\n\n // Positioned as a percentage of the overlay's own box rather than from a\n // measured width: the overlay is inset to the plot area, so a fraction is\n // exact at any size and cannot lag or disagree with the plot.\n const drawnAnnotations = annotations?.length ? annotations : undefined;\n\n // The plot box in px — the overlay is the wrapper inset by the grid padding\n // on each edge. Nothing is measured before the first ResizeObserver tick,\n // and a band with no width lies about where it is: no width, no bands.\n const plotWidth = containerWidth - PLOT_EDGE_PADDING * 2;\n const hitBands =\n onAnnotationSelect && drawnAnnotations && plotWidth > 0\n ? annotationHitBands(drawnAnnotations, plotWidth)\n : undefined;\n\n return (\n <div\n ref={wrapperRef}\n role=\"img\"\n aria-label={ariaLabel}\n dir=\"ltr\"\n className={sparklineVariants({\n size: height !== undefined ? 'auto' : size,\n className,\n })}\n data-component=\"sparkline\"\n data-component-id={id}\n {...props}\n >\n <ReactApexChart\n type={variant}\n series={[{ data: seriesData }]}\n options={chartOptions}\n width={resolvedWidth}\n height={resolvedHeight}\n aria-hidden=\"true\"\n />\n {drawnAnnotations && (\n /* Drawn over the plot rather than through ApexCharts' own xaxis\n annotations: a fraction of the measured extent is the one\n positioning rule that survives series of different lengths, which\n is what makes a column of sparklines share an x. */\n /* The inset lives on a div: an <svg> is a replaced element, so\n left+right do not size it and it would fall back to its intrinsic\n 300px. The div is the plot box; the svg fills it. The 2px MUST\n equal PLOT_EDGE_PADDING — Tailwind needs a static literal, so the\n two cannot share one source; change them together or the first and\n last annotation drift off the first and last data point. */\n <div className=\"ds:pointer-events-none ds:absolute ds:inset-y-0 ds:inset-x-[2px]\">\n <svg\n aria-hidden=\"true\"\n focusable=\"false\"\n data-testid=\"sparkline-annotations\"\n className=\"ds:size-full\"\n >\n {drawnAnnotations.map((annotation) => {\n const fraction = clampFraction(annotation.position);\n return (\n /* A nested viewport placed at a percentage of the plot: the\n one positioning rule that needs no measurement, so a column\n of sparklines shares an x whatever their widths. */\n <svg\n key={annotation.id}\n x={`${fraction * 100}%`}\n y=\"0\"\n width=\"1\"\n height=\"100%\"\n overflow=\"visible\"\n data-annotation-id={annotation.id}\n data-annotation-position={fraction}\n className={annotationVariants({ tone: annotation.tone })}\n >\n <line\n x1={0}\n x2={0}\n y1={0}\n y2=\"100%\"\n /* 1px, more gap than dash: the line marks WHERE, the\n series is what is read, and at 1.5px the annotation\n was the louder of the two. */\n className=\"ds:[stroke:var(--annotation-color)] ds:[stroke-dasharray:2_3] ds:[stroke-width:1]\"\n />\n <path\n d={markerPath(\n annotation.shape ?? 'diamond',\n 0,\n ANNOTATION_CAP_RADIUS,\n ANNOTATION_CAP_RADIUS,\n )}\n className=\"ds:[fill:var(--annotation-color)]\"\n />\n </svg>\n );\n })}\n </svg>\n </div>\n )}\n {hitBands && onAnnotationSelect && (\n /* Sized in px, not percentages: 44px is a measurement, not a\n fraction of a box the reader can resize. `pointer-events-none`\n holds all the way down to the bands, so the only live pixels are\n the 44px each annotation owns. */\n <div\n className={annotationHitVariants({\n size: height !== undefined ? 'auto' : size,\n })}\n >\n <svg\n aria-hidden=\"true\"\n focusable=\"false\"\n data-testid=\"sparkline-annotation-hits\"\n className=\"ds:size-full\"\n >\n {hitBands.map(({ annotation, x, width }) => (\n <g\n key={annotation.id}\n data-annotation-hit-id={annotation.id}\n onClick={() => onAnnotationSelect(annotation.id)}\n className={`ds:group ds:pointer-events-auto ds:cursor-pointer ${annotationVariants(\n { tone: annotation.tone },\n )}`}\n >\n {/* A native tooltip for the pointer that can act on it. The\n same labels already ride the wrapper's aria-label, and\n this svg is aria-hidden, so nothing is said twice. */}\n <title>\n {t('sparkline.annotationAction', {\n label: annotation.label,\n })}\n </title>\n {/* Target and hover affordance in one rect: it tints on\n hover so the reader sees which event the press means.\n Opacity does not affect hit-testing. */}\n <rect\n x={x}\n y={0}\n width={width}\n height=\"100%\"\n className=\"ds:[fill:var(--annotation-color)] ds:opacity-0 ds:transition-opacity ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none ds:group-hover:opacity-20\"\n />\n </g>\n ))}\n </svg>\n </div>\n )}\n {showEndpoint && (\n <span\n aria-hidden=\"true\"\n className=\"ds:pointer-events-none ds:absolute ds:end-0 ds:top-0 ds:text-[length:var(--font-size-xs)] ds:leading-none\"\n >\n {DIRECTION_ARROW[direction]}\n </span>\n )}\n </div>\n );\n },\n);\n\nSparkline.displayName = 'Sparkline';\n"],"names":["useLinearTrend","data","n","xMean","yMean","sum","y","numerator","denominator","i","dx","slope","threshold","direction","sparklineAgent","handle","args","sparklineVariants","cva","annotationVariants","annotationHitVariants","DIRECTION_ARROW","SIZE_HEIGHT","PLOT_EDGE_PADDING","ANNOTATION_CAP_RADIUS","ANNOTATION_HIT_WIDTH","annotationHitBands","annotations","plotWidth","centred","annotation","clampFraction","a","b","entry","index","before","after","from","to","lower","upper","width","value","measured","prefersReducedMotion","Sparkline","forwardRef","id","variant","size","label","color","showEndpoint","showTooltip","height","onAnnotationSelect","className","props","ref","t","i18n","useTranslation","rawId","useId","chartId","useMemo","wrapperRef","useRef","containerWidth","setContainerWidth","useState","points","ariaLabel","marks","withMarks","summary","fmt","dirText","nums","themeOptions","setThemeOptions","getApexChartsTheme","useEffect","timer","observer","el","ro","entries","useNeutraliseHiddenFocus","selectRef","drawnRef","agentHandle","newData","_a","ApexCharts","opts","instance","annotationId","_b","useImperativeHandle","useAgentRegistration","resolvedColor","jsx","reducedMotion","gapped","seriesData","x","chartOptions","resolvedWidth","resolvedHeight","drawnAnnotations","hitBands","jsxs","ReactApexChart","fraction","markerPath"],"mappings":";;;;;;;;;AAOO,SAASA,GAAeC,GAAmC;AAChE,MAAIA,EAAK,SAAS;AAChB,WAAO,EAAE,OAAO,GAAG,WAAW,SAAA;AAGhC,QAAMC,IAAID,EAAK,QACTE,KAASD,IAAI,KAAK,GAClBE,IAAQH,EAAK,OAAO,C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@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"packageVersion": "1.
|
|
3
|
+
"packageVersion": "1.2.0",
|
|
4
4
|
"components": [
|
|
5
5
|
{
|
|
6
6
|
"kind": "component",
|
|
@@ -6720,6 +6720,12 @@
|
|
|
6720
6720
|
"type": "boolean",
|
|
6721
6721
|
"description": "Whether the current user may write clinical notes (the practice_add_clinical_note permission gate).",
|
|
6722
6722
|
"descriptionKey": "ui.agent.notesPanel.state.canAddClinical"
|
|
6723
|
+
},
|
|
6724
|
+
{
|
|
6725
|
+
"name": "currentNoteId",
|
|
6726
|
+
"type": "string | null",
|
|
6727
|
+
"description": "Id of the note the host has addressed — the one marked, scrolled to and focused. Null when none is. An id only, never note content.",
|
|
6728
|
+
"descriptionKey": "ui.agent.notesPanel.state.currentNoteId"
|
|
6723
6729
|
}
|
|
6724
6730
|
],
|
|
6725
6731
|
"actions": [
|
|
@@ -11099,6 +11105,26 @@
|
|
|
11099
11105
|
},
|
|
11100
11106
|
"description": "Return a PNG data URI of the sparkline.",
|
|
11101
11107
|
"descriptionKey": "ui.agent.sparkline.actions.exportPng"
|
|
11108
|
+
},
|
|
11109
|
+
{
|
|
11110
|
+
"name": "select_annotation",
|
|
11111
|
+
"safety": "write",
|
|
11112
|
+
"argsType": "{ annotationId: string }",
|
|
11113
|
+
"argsSchema": {
|
|
11114
|
+
"type": "object",
|
|
11115
|
+
"properties": {
|
|
11116
|
+
"annotationId": {
|
|
11117
|
+
"type": "string",
|
|
11118
|
+
"description": "The annotation's id, as carried by data-annotation-hit-id on the pressable band. The decorative drawn marker carries the same value as data-annotation-id, but is not selectable."
|
|
11119
|
+
}
|
|
11120
|
+
},
|
|
11121
|
+
"required": [
|
|
11122
|
+
"annotationId"
|
|
11123
|
+
]
|
|
11124
|
+
},
|
|
11125
|
+
"idempotent": true,
|
|
11126
|
+
"description": "Select a drawn annotation, as pressing its band would. No-op unless the host wired onAnnotationSelect and the id names an annotation that is currently drawn.",
|
|
11127
|
+
"descriptionKey": "ui.agent.sparkline.actions.selectAnnotation"
|
|
11102
11128
|
}
|
|
11103
11129
|
],
|
|
11104
11130
|
"domHooks": {
|