@lilt-ui/charts 0.11.0 → 0.12.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.
@@ -79,12 +79,6 @@ export declare function useBoardItem(): {
79
79
  acknowledge: () => void;
80
80
  pin: (pinned: boolean) => void;
81
81
  };
82
- /**
83
- * A board of charts that arranges itself: what needs attention rises to the top, what you have
84
- * seen calms down, and what clears settles back. Nothing moves while you point at or work inside
85
- * the board; changes wait and apply when you leave, or when you ask.
86
- */
87
- export declare function ChartBoard({ children, 'aria-label': label, settleAfter, memory, storage, onEvent, toast, toolbar, status, motion: motionMode, className, style, }: ChartBoardProps): ReactElement;
88
82
  /**
89
83
  * The default tab for an item's card: what is going on, how new it is, and quiet actions to
90
84
  * acknowledge it or keep it pinned.
@@ -95,3 +89,5 @@ export declare function BoardItemTab(): ReactElement;
95
89
  * to finish reading; `useBoard` builds a summary of your own.
96
90
  */
97
91
  export declare function BoardToolbar(): ReactElement | null;
92
+ /** ChartBoard with its own MotionScope, so it animates wherever it is rendered. */
93
+ export declare function ChartBoard(props: ChartBoardProps): ReactElement;
package/dist/watch.js CHANGED
@@ -1,8 +1,8 @@
1
1
  "use client";
2
- import { C as e, a as t, b as n, i as r, l as i, n as a, o, r as s, s as c, t as l } from "./report-context-UrwaoLYZ.js";
3
- import { Children as u, createContext as d, isValidElement as f, useCallback as p, useContext as m, useEffect as h, useMemo as g, useReducer as ee, useRef as _, useState as v } from "react";
4
- import { Fragment as y, jsx as b, jsxs as x } from "react/jsx-runtime";
5
- import { AnimatePresence as S, motion as C } from "motion/react";
2
+ import { C as e, a as t, b as n, i as r, l as i, n as a, o, r as s, s as c, t as l, w as u } from "./report-context-DLA3I57K.js";
3
+ import { Children as d, createContext as f, isValidElement as ee, useCallback as p, useContext as m, useEffect as h, useMemo as g, useReducer as te, useRef as _, useState as v } from "react";
4
+ import { AnimatePresence as y, m as b } from "motion/react";
5
+ import { Fragment as x, jsx as S, jsxs as C } from "react/jsx-runtime";
6
6
  import { createPortal as w } from "react-dom";
7
7
  //#region src/watch/engine/rules.ts
8
8
  function T({ points: e = 6, severity: t = "warning", message: n = "Value has not changed" } = {}) {
@@ -153,7 +153,7 @@ function M(e) {
153
153
  }).map((e) => e.id);
154
154
  }
155
155
  var N = (e) => e.sinceAt ?? e.raisedAt ?? Infinity, P = 8e3;
156
- function te({ alerts: e, reducedMotion: t, onView: n, onDismiss: r }) {
156
+ function ne({ alerts: e, reducedMotion: t, onView: n, onDismiss: r }) {
157
157
  let [i, a] = v(null);
158
158
  h(() => a(document.body), []);
159
159
  let [o, s] = v(!1), c = e.some((e) => e.severity === "critical"), l = e.map((e) => `${e.id}:${e.severity}`).join(), u = _(r);
@@ -171,10 +171,10 @@ function te({ alerts: e, reducedMotion: t, onView: n, onDismiss: r }) {
171
171
  y: 16,
172
172
  filter: "blur(6px)"
173
173
  };
174
- return w(/* @__PURE__ */ b("div", {
174
+ return w(/* @__PURE__ */ S("div", {
175
175
  "data-lilt-chart": "",
176
176
  className: "lilt-toast-region",
177
- children: /* @__PURE__ */ b(S, { children: d ? /* @__PURE__ */ x(C.div, {
177
+ children: /* @__PURE__ */ S(y, { children: d ? /* @__PURE__ */ C(b.div, {
178
178
  role: "group",
179
179
  "aria-label": "Chart alert",
180
180
  className: "lilt-toast",
@@ -198,29 +198,29 @@ function te({ alerts: e, reducedMotion: t, onView: n, onDismiss: r }) {
198
198
  e.currentTarget.contains(e.relatedTarget) || s(!1);
199
199
  },
200
200
  children: [
201
- /* @__PURE__ */ b("span", {
201
+ /* @__PURE__ */ S("span", {
202
202
  className: "lilt-toast__text",
203
- children: e.length === 1 ? /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b("strong", { children: d.title }), d.reason ? /* @__PURE__ */ b("span", {
203
+ children: e.length === 1 ? /* @__PURE__ */ C(x, { children: [/* @__PURE__ */ S("strong", { children: d.title }), d.reason ? /* @__PURE__ */ S("span", {
204
204
  className: "lilt-toast__reason",
205
205
  children: d.reason
206
- }) : null] }) : /* @__PURE__ */ x("strong", { children: [e.length, " charts need attention"] })
206
+ }) : null] }) : /* @__PURE__ */ C("strong", { children: [e.length, " charts need attention"] })
207
207
  }),
208
- /* @__PURE__ */ b("button", {
208
+ /* @__PURE__ */ S("button", {
209
209
  type: "button",
210
210
  className: "lilt-toast__view",
211
211
  onClick: n,
212
212
  children: "View"
213
213
  }),
214
- /* @__PURE__ */ b("button", {
214
+ /* @__PURE__ */ S("button", {
215
215
  type: "button",
216
216
  className: "lilt-card-badge__clear",
217
217
  "aria-label": "Dismiss",
218
218
  onClick: r,
219
- children: /* @__PURE__ */ b("svg", {
219
+ children: /* @__PURE__ */ S("svg", {
220
220
  "aria-hidden": "true",
221
221
  viewBox: "0 0 16 16",
222
222
  fill: "none",
223
- children: /* @__PURE__ */ b("path", {
223
+ children: /* @__PURE__ */ S("path", {
224
224
  d: "m4 4 8 8M12 4l-8 8",
225
225
  stroke: "currentColor",
226
226
  strokeWidth: "1.5",
@@ -234,12 +234,12 @@ function te({ alerts: e, reducedMotion: t, onView: n, onDismiss: r }) {
234
234
  }
235
235
  //#endregion
236
236
  //#region src/watch/board/chart-board.tsx
237
- function ne({ children: e }) {
238
- return /* @__PURE__ */ b(y, { children: e });
237
+ function re({ children: e }) {
238
+ return /* @__PURE__ */ S(x, { children: e });
239
239
  }
240
- var F = d(null), re = d(null);
241
- function I() {
242
- let e = m(F);
240
+ var ie = f(null), ae = f(null);
241
+ function F() {
242
+ let e = m(ie);
243
243
  if (!e) throw Error("Lilt Charts: useBoard must be used inside a ChartBoard.");
244
244
  let t = Object.values(e.state);
245
245
  return {
@@ -252,8 +252,8 @@ function I() {
252
252
  pin: e.pin
253
253
  };
254
254
  }
255
- function L() {
256
- let e = m(F), t = m(re);
255
+ function I() {
256
+ let e = m(ie), t = m(ae);
257
257
  if (!e || !t) throw Error("Lilt Charts: useBoardItem must be used inside a BoardItem.");
258
258
  return {
259
259
  item: e.state[t],
@@ -263,74 +263,74 @@ function L() {
263
263
  pin: (n) => e.pin(t, n)
264
264
  };
265
265
  }
266
- var ie = 500;
267
- function R({ children: t, "aria-label": n, settleAfter: r = 8e3, memory: i, storage: a, onEvent: o, toast: s = !1, toolbar: c = !0, status: l = !0, motion: d = "auto", className: m, style: y }) {
268
- let S = g(() => u.toArray(t).flatMap((e) => f(e) && e.type === ne ? [e.props] : []), [t]), w = g(() => new Map(S.map((e) => [e.id, e.title])), [S]), [T, E] = ee(O, S, (e) => e.reduce((e, t, n) => O(e, {
266
+ var oe = 500;
267
+ function L({ children: t, "aria-label": n, settleAfter: r = 8e3, memory: i, storage: a, onEvent: o, toast: s = !1, toolbar: c = !0, status: l = !0, motion: u = "auto", className: f, style: m }) {
268
+ let y = g(() => d.toArray(t).flatMap((e) => ee(e) && e.type === re ? [e.props] : []), [t]), x = g(() => new Map(y.map((e) => [e.id, e.title])), [y]), [w, T] = te(O, y, (e) => e.reduce((e, t, n) => O(e, {
269
269
  type: "register",
270
270
  id: t.id,
271
271
  order: n
272
- }), {})), D = S.map((e) => e.id).join("\0");
272
+ }), {})), E = y.map((e) => e.id).join("\0");
273
273
  h(() => {
274
- let e = new Set(S.map((e) => e.id));
275
- S.forEach((e, t) => E({
274
+ let e = new Set(y.map((e) => e.id));
275
+ y.forEach((e, t) => T({
276
276
  type: "register",
277
277
  id: e.id,
278
278
  order: t
279
279
  }));
280
- for (let t of Object.keys(T)) e.has(t) || E({
280
+ for (let t of Object.keys(w)) e.has(t) || T({
281
281
  type: "unregister",
282
282
  id: t
283
283
  });
284
- }, [D]);
285
- let k = M(T), A = k.join("\0"), [j, N] = v(k), [P, I] = v(!1), L = _(void 0), R = () => {
286
- clearTimeout(L.current), I(!0);
287
- }, z = () => {
288
- clearTimeout(L.current), L.current = setTimeout(() => I(!1), ie);
284
+ }, [E]);
285
+ let D = M(w), k = D.join("\0"), [A, j] = v(D), [N, P] = v(!1), F = _(void 0), I = () => {
286
+ clearTimeout(F.current), P(!0);
287
+ }, L = () => {
288
+ clearTimeout(F.current), F.current = setTimeout(() => P(!1), oe);
289
289
  };
290
- h(() => () => clearTimeout(L.current), []), h(() => {
291
- P || N(k);
292
- }, [P, A]);
293
- let B = [...j.filter((e) => T[e]), ...k.filter((e) => !j.includes(e))], ue = B.join("|"), fe = B.join("\0") !== A, pe = p(() => N(M(T)), [T]);
290
+ h(() => () => clearTimeout(F.current), []), h(() => {
291
+ N || j(D);
292
+ }, [N, k]);
293
+ let R = [...A.filter((e) => w[e]), ...D.filter((e) => !A.includes(e))], z = R.join("|"), B = R.join("\0") !== k, V = p(() => j(M(w)), [w]);
294
294
  h(() => {
295
- let e = Object.values(T).filter((e) => e.alarm === "cleared" && e.clearedAt !== null).map((e) => setTimeout(() => E({
295
+ let e = Object.values(w).filter((e) => e.alarm === "cleared" && e.clearedAt !== null).map((e) => setTimeout(() => T({
296
296
  type: "settle",
297
297
  id: e.id
298
298
  }), Math.max(0, e.clearedAt + r - Date.now())));
299
299
  return () => e.forEach(clearTimeout);
300
- }, [T, r]);
301
- let V = e(d), H = _(/* @__PURE__ */ new Map()), me = _(/* @__PURE__ */ new Map());
300
+ }, [w, r]);
301
+ let H = e(u), U = _(/* @__PURE__ */ new Map()), pe = _(/* @__PURE__ */ new Map());
302
302
  h(() => {
303
303
  if (typeof IntersectionObserver > "u") return;
304
304
  let e = new IntersectionObserver((e) => {
305
305
  for (let t of e) {
306
306
  let e = t.target.dataset.boardItem;
307
- e && me.current.set(e, t.intersectionRatio >= .5);
307
+ e && pe.current.set(e, t.intersectionRatio >= .5);
308
308
  }
309
309
  }, { threshold: [
310
310
  0,
311
311
  .5,
312
312
  1
313
313
  ] });
314
- return H.current.forEach((t) => e.observe(t)), () => e.disconnect();
315
- }, [D]);
316
- let [U, he] = v(null), ge = _(V);
317
- ge.current = V;
318
- let W = p((e) => {
319
- let t = H.current.get(e);
314
+ return U.current.forEach((t) => e.observe(t)), () => e.disconnect();
315
+ }, [E]);
316
+ let [W, me] = v(null), he = _(H);
317
+ he.current = H;
318
+ let G = p((e) => {
319
+ let t = U.current.get(e);
320
320
  t && (t.scrollIntoView?.({
321
- behavior: ge.current ? "auto" : "smooth",
321
+ behavior: he.current ? "auto" : "smooth",
322
322
  block: "center"
323
- }), t.focus({ preventScroll: !0 }), he(e));
323
+ }), t.focus({ preventScroll: !0 }), me(e));
324
324
  }, []);
325
325
  h(() => {
326
- if (!U) return;
327
- let e = setTimeout(() => he(null), 1600);
326
+ if (!W) return;
327
+ let e = setTimeout(() => me(null), 1600);
328
328
  return () => clearTimeout(e);
329
- }, [U]);
330
- let [_e, G] = v([]), K = _(null), q = _(0);
329
+ }, [W]);
330
+ let [ge, K] = v([]), q = _(null), J = _(0);
331
331
  h(() => {
332
332
  let e = () => {
333
- K.current !== null && (document.title = K.current), K.current = null, q.current = 0;
333
+ q.current !== null && (document.title = q.current), q.current = null, J.current = 0;
334
334
  }, t = () => {
335
335
  document.visibilityState === "visible" && e();
336
336
  };
@@ -338,35 +338,35 @@ function R({ children: t, "aria-label": n, settleAfter: r = 8e3, memory: i, stor
338
338
  document.removeEventListener("visibilitychange", t), e();
339
339
  };
340
340
  }, []);
341
- let [ve, ye] = v({
341
+ let [_e, ve] = v({
342
342
  polite: "",
343
343
  assertive: ""
344
- }), be = _(T), J = _({
344
+ }), ye = _(w), Y = _({
345
345
  onEvent: o,
346
- titles: w,
346
+ titles: x,
347
347
  toast: s
348
348
  });
349
- J.current = {
349
+ Y.current = {
350
350
  onEvent: o,
351
- titles: w,
351
+ titles: x,
352
352
  toast: s
353
353
  }, h(() => {
354
- let e = be.current;
355
- be.current = T;
354
+ let e = ye.current;
355
+ ye.current = w;
356
356
  let t = [], n = [], r = [], i = /* @__PURE__ */ new Set();
357
- for (let a of Object.values(T)) {
357
+ for (let a of Object.values(w)) {
358
358
  let o = e[a.id];
359
359
  if (!o) continue;
360
- let s = se(o, a);
360
+ let s = le(o, a);
361
361
  if (!s) continue;
362
- let c = J.current.titles.get(a.id) ?? a.id;
363
- J.current.onEvent?.({
362
+ let c = Y.current.titles.get(a.id) ?? a.id;
363
+ Y.current.onEvent?.({
364
364
  type: s,
365
365
  id: a.id,
366
366
  title: c,
367
367
  item: a,
368
- show: () => W(a.id)
369
- }), s === "raised" || s === "escalated" ? me.current.get(a.id) || r.push({
368
+ show: () => G(a.id)
369
+ }), s === "raised" || s === "escalated" ? pe.current.get(a.id) || r.push({
370
370
  id: a.id,
371
371
  title: c,
372
372
  reason: a.why ?? a.reason,
@@ -375,33 +375,33 @@ function R({ children: t, "aria-label": n, settleAfter: r = 8e3, memory: i, stor
375
375
  let l = a.reason ? `: ${a.reason}${a.since ? ` since ${a.since}` : ""}` : "";
376
376
  s === "raised" || s === "escalated" ? (a.severity === "critical" ? n : t).push(`${c} needs attention${l}.${a.why ? ` ${a.why}.` : ""}`) : s === "cleared" && t.push(`${c} is back to normal.`);
377
377
  }
378
- if ((t.length || n.length) && ye({
378
+ if ((t.length || n.length) && ve({
379
379
  polite: t.join(" "),
380
380
  assertive: n.join(" ")
381
- }), J.current.toast) {
381
+ }), Y.current.toast) {
382
382
  if (r.length || i.size) {
383
383
  let e = new Set(r.map((e) => e.id));
384
- G((t) => [...t.filter((t) => !e.has(t.id) && !i.has(t.id)), ...r].sort((e, t) => oe(e.severity) - oe(t.severity)));
384
+ K((t) => [...t.filter((t) => !e.has(t.id) && !i.has(t.id)), ...r].sort((e, t) => ce(e.severity) - ce(t.severity)));
385
385
  }
386
- r.length && document.visibilityState === "hidden" && (K.current ??= document.title, q.current += r.length, document.title = `(${q.current}) ${K.current}`);
386
+ r.length && document.visibilityState === "hidden" && (q.current ??= document.title, J.current += r.length, document.title = `(${J.current}) ${q.current}`);
387
387
  }
388
- }, [T, W]);
389
- let Y = i ? `lilt-board:${i}` : null, X = _(null), [xe, Se] = v(() => /* @__PURE__ */ new Set()), Z = g(() => a ?? ce(), [a]);
388
+ }, [w, G]);
389
+ let X = i ? `lilt-board:${i}` : null, Z = _(null), [be, xe] = v(() => /* @__PURE__ */ new Set()), Q = g(() => a ?? ue(), [a]);
390
390
  h(() => {
391
- if (!Y || !Z) return;
392
- let e = Z.get(Y);
391
+ if (!X || !Q) return;
392
+ let e = Q.get(X);
393
393
  try {
394
- X.current = e === null ? null : new Set(JSON.parse(e));
394
+ Z.current = e === null ? null : new Set(JSON.parse(e));
395
395
  } catch {
396
- X.current = null;
396
+ Z.current = null;
397
397
  }
398
- }, [Y, Z]);
399
- let Q = (e) => `${e.id}@${e.sinceAt ?? e.since ?? ""}`, Ce = Object.values(T).filter((e) => e.alarm !== "normal" && e.alarm !== "cleared").map(Q).sort().join("\0");
398
+ }, [X, Q]);
399
+ let Se = (e) => `${e.id}@${e.sinceAt ?? e.since ?? ""}`, Ce = Object.values(w).filter((e) => e.alarm !== "normal" && e.alarm !== "cleared").map(Se).sort().join("\0");
400
400
  h(() => {
401
- if (!Y || !Z) return;
402
- let e = X.current, t = Object.values(T).filter((e) => e.alarm === "active" || e.alarm === "acknowledged");
403
- e && Se(new Set(t.filter((t) => t.alarm === "active" && !e.has(Q(t))).map((e) => e.id)));
404
- let n = () => Z.set(Y, JSON.stringify(t.map(Q))), r = () => {
401
+ if (!X || !Q) return;
402
+ let e = Z.current, t = Object.values(w).filter((e) => e.alarm === "active" || e.alarm === "acknowledged");
403
+ e && xe(new Set(t.filter((t) => t.alarm === "active" && !e.has(Se(t))).map((e) => e.id)));
404
+ let n = () => Q.set(X, JSON.stringify(t.map(Se))), r = () => {
405
405
  document.visibilityState === "hidden" && n();
406
406
  };
407
407
  return window.addEventListener("pagehide", n), document.addEventListener("visibilitychange", r), () => {
@@ -409,65 +409,65 @@ function R({ children: t, "aria-label": n, settleAfter: r = 8e3, memory: i, stor
409
409
  };
410
410
  }, [
411
411
  Ce,
412
- Y,
413
- Z
412
+ X,
413
+ Q
414
414
  ]);
415
- let we = p((e) => E({
415
+ let we = p((e) => T({
416
416
  type: "acknowledge",
417
417
  id: e,
418
418
  now: Date.now()
419
- }), []), Te = p((e, t) => E({
419
+ }), []), Te = p((e, t) => T({
420
420
  type: "pin",
421
421
  id: e,
422
422
  pinned: t
423
423
  }), []), Ee = g(() => ({
424
- state: T,
425
- titles: w,
426
- fresh: xe,
424
+ state: w,
425
+ titles: x,
426
+ fresh: be,
427
427
  acknowledge: we,
428
428
  pin: Te,
429
- pending: fe,
430
- apply: pe
429
+ pending: B,
430
+ apply: V
431
431
  }), [
432
- T,
433
432
  w,
434
- xe,
433
+ x,
434
+ be,
435
435
  we,
436
436
  Te,
437
- fe,
438
- pe
439
- ]), De = new Map(S.map((e) => [e.id, e])), $ = _e.filter((e) => T[e.id]);
440
- return /* @__PURE__ */ x(F.Provider, {
437
+ B,
438
+ V
439
+ ]), De = new Map(y.map((e) => [e.id, e])), $ = ge.filter((e) => w[e.id]);
440
+ return /* @__PURE__ */ C(ie.Provider, {
441
441
  value: Ee,
442
- children: [/* @__PURE__ */ x("section", {
442
+ children: [/* @__PURE__ */ C("section", {
443
443
  "data-lilt-chart": "",
444
- className: ["lilt-board", m].filter(Boolean).join(" "),
445
- style: y,
444
+ className: ["lilt-board", f].filter(Boolean).join(" "),
445
+ style: m,
446
446
  "aria-label": n,
447
- onPointerEnter: R,
448
- onPointerLeave: z,
449
- onFocus: R,
447
+ onPointerEnter: I,
448
+ onPointerLeave: L,
449
+ onFocus: I,
450
450
  onBlur: (e) => {
451
- e.currentTarget.contains(e.relatedTarget) || z();
451
+ e.currentTarget.contains(e.relatedTarget) || L();
452
452
  },
453
453
  children: [
454
- c ? /* @__PURE__ */ b(de, {}) : null,
455
- /* @__PURE__ */ b(C.div, {
454
+ c ? /* @__PURE__ */ S(fe, {}) : null,
455
+ /* @__PURE__ */ S(b.div, {
456
456
  layoutRoot: !0,
457
457
  className: "lilt-board__grid",
458
- children: B.map((e) => {
459
- let t = De.get(e), n = T[e];
460
- return !t || !n ? null : /* @__PURE__ */ b(C.div, {
458
+ children: R.map((e) => {
459
+ let t = De.get(e), n = w[e];
460
+ return !t || !n ? null : /* @__PURE__ */ S(b.div, {
461
461
  ref: (t) => {
462
- t ? H.current.set(e, t) : H.current.delete(e);
462
+ t ? U.current.set(e, t) : U.current.delete(e);
463
463
  },
464
464
  role: "group",
465
465
  "aria-label": t.title,
466
466
  tabIndex: -1,
467
467
  "data-board-item": e,
468
- "data-flash": U === e || void 0,
469
- layout: !V && "position",
470
- layoutDependency: ue,
468
+ "data-flash": W === e || void 0,
469
+ layout: !H && "position",
470
+ layoutDependency: z,
471
471
  transition: {
472
472
  type: "spring",
473
473
  stiffness: 420,
@@ -479,14 +479,14 @@ function R({ children: t, "aria-label": n, settleAfter: r = 8e3, memory: i, stor
479
479
  "data-severity": n.severity ?? void 0,
480
480
  "data-pinned": n.pinned || void 0,
481
481
  style: t.span === 2 ? { gridColumn: "span 2" } : void 0,
482
- children: /* @__PURE__ */ b(re.Provider, {
482
+ children: /* @__PURE__ */ S(ae.Provider, {
483
483
  value: e,
484
- children: /* @__PURE__ */ b(le, {
484
+ children: /* @__PURE__ */ S(de, {
485
485
  item: n,
486
486
  status: l,
487
- children: /* @__PURE__ */ b(ae, {
487
+ children: /* @__PURE__ */ S(se, {
488
488
  id: e,
489
- dispatch: E,
489
+ dispatch: T,
490
490
  children: t.children
491
491
  })
492
492
  })
@@ -494,48 +494,48 @@ function R({ children: t, "aria-label": n, settleAfter: r = 8e3, memory: i, stor
494
494
  }, e);
495
495
  })
496
496
  }),
497
- /* @__PURE__ */ b("div", {
497
+ /* @__PURE__ */ S("div", {
498
498
  className: "lilt-chart__sr-only",
499
499
  "aria-live": "polite",
500
- children: ve.polite
500
+ children: _e.polite
501
501
  }),
502
- /* @__PURE__ */ b("div", {
502
+ /* @__PURE__ */ S("div", {
503
503
  className: "lilt-chart__sr-only",
504
504
  "aria-live": "assertive",
505
- children: ve.assertive
505
+ children: _e.assertive
506
506
  })
507
507
  ]
508
- }), s ? /* @__PURE__ */ b(te, {
508
+ }), s ? /* @__PURE__ */ S(ne, {
509
509
  alerts: $,
510
- reducedMotion: V,
510
+ reducedMotion: H,
511
511
  onView: () => {
512
- $[0] && W($[0].id), G([]);
512
+ $[0] && G($[0].id), K([]);
513
513
  },
514
- onDismiss: () => G([])
514
+ onDismiss: () => K([])
515
515
  }) : null]
516
516
  });
517
517
  }
518
- function ae({ id: e, dispatch: t, children: n }) {
518
+ function se({ id: e, dispatch: t, children: n }) {
519
519
  let r = p((n) => t({
520
520
  type: "report",
521
521
  id: e,
522
522
  report: n,
523
523
  now: Date.now()
524
524
  }), [t, e]);
525
- return /* @__PURE__ */ b(l.Provider, {
525
+ return /* @__PURE__ */ S(l.Provider, {
526
526
  value: r,
527
527
  children: n
528
528
  });
529
529
  }
530
- var oe = (e) => e === "critical" ? 0 : 1;
531
- function se(e, t) {
530
+ var ce = (e) => e === "critical" ? 0 : 1;
531
+ function le(e, t) {
532
532
  return e.alarm === t.alarm ? t.alarm === "active" && e.severity === "warning" && t.severity === "critical" ? "escalated" : null : {
533
533
  active: e.alarm === "acknowledged" ? "escalated" : "raised",
534
534
  acknowledged: "acknowledged",
535
535
  cleared: "cleared"
536
536
  }[t.alarm] ?? null;
537
537
  }
538
- function ce() {
538
+ function ue() {
539
539
  return typeof window > "u" ? null : {
540
540
  get: (e) => {
541
541
  try {
@@ -551,74 +551,74 @@ function ce() {
551
551
  }
552
552
  };
553
553
  }
554
- function le({ item: e, status: t, children: n }) {
554
+ function de({ item: e, status: t, children: n }) {
555
555
  let r = t && (e.alarm !== "normal" || e.pinned), a = g(() => ({
556
- badge: r ? /* @__PURE__ */ b(B, {}) : void 0,
556
+ badge: r ? /* @__PURE__ */ S(z, {}) : void 0,
557
557
  tone: e.alarm === "active" ? e.severity : null,
558
- handle: t && !r ? /* @__PURE__ */ b(ue, {}) : void 0
558
+ handle: t && !r ? /* @__PURE__ */ S(B, {}) : void 0
559
559
  }), [
560
560
  r,
561
561
  t,
562
562
  e.alarm,
563
563
  e.severity
564
564
  ]);
565
- return /* @__PURE__ */ b(i.Provider, {
565
+ return /* @__PURE__ */ S(i.Provider, {
566
566
  value: a,
567
567
  children: n
568
568
  });
569
569
  }
570
- var z = new Intl.DateTimeFormat(void 0, {
570
+ var R = new Intl.DateTimeFormat(void 0, {
571
571
  hour: "numeric",
572
572
  minute: "2-digit"
573
573
  });
574
- function B() {
575
- let { item: e, title: t, fresh: r, acknowledge: i, pin: a } = L(), o = e.alarm === "active" ? "Needs attention" : e.alarm === "acknowledged" ? `Seen ${z.format(e.acknowledgedAt)}` : e.alarm === "cleared" ? "Back to normal" : "Pinned";
576
- return /* @__PURE__ */ x("span", {
574
+ function z() {
575
+ let { item: e, title: t, fresh: r, acknowledge: i, pin: a } = I(), o = e.alarm === "active" ? "Needs attention" : e.alarm === "acknowledged" ? `Seen ${R.format(e.acknowledgedAt)}` : e.alarm === "cleared" ? "Back to normal" : "Pinned";
576
+ return /* @__PURE__ */ C("span", {
577
577
  className: "lilt-board-tab",
578
578
  "data-alarm": e.alarm,
579
579
  "data-severity": e.severity ?? void 0,
580
- children: [/* @__PURE__ */ x("span", {
580
+ children: [/* @__PURE__ */ C("span", {
581
581
  className: "lilt-board-tab__state",
582
- children: [o, r ? /* @__PURE__ */ b("span", {
582
+ children: [o, r ? /* @__PURE__ */ S("span", {
583
583
  className: "lilt-board-tab__new",
584
584
  children: "· New"
585
585
  }) : null]
586
- }), /* @__PURE__ */ x("span", {
586
+ }), /* @__PURE__ */ C("span", {
587
587
  className: "lilt-board-tab__actions",
588
- children: [e.alarm === "active" ? /* @__PURE__ */ b("button", {
588
+ children: [e.alarm === "active" ? /* @__PURE__ */ S("button", {
589
589
  type: "button",
590
590
  className: "lilt-board-tab__action",
591
591
  onClick: i,
592
592
  children: "Acknowledge"
593
- }) : null, /* @__PURE__ */ b("button", {
593
+ }) : null, /* @__PURE__ */ S("button", {
594
594
  type: "button",
595
595
  className: "lilt-card-badge__clear lilt-board-tab__pin",
596
596
  "aria-pressed": e.pinned,
597
597
  "aria-label": e.pinned ? `Unpin ${t}` : `Pin ${t}`,
598
598
  title: e.pinned ? "Unpin" : "Keep at the top",
599
599
  onClick: () => a(!e.pinned),
600
- children: /* @__PURE__ */ b(n, { release: e.pinned })
600
+ children: /* @__PURE__ */ S(n, { release: e.pinned })
601
601
  })]
602
602
  })]
603
603
  });
604
604
  }
605
- function ue() {
606
- let { title: e, pin: t } = L();
607
- return /* @__PURE__ */ b("button", {
605
+ function B() {
606
+ let { title: e, pin: t } = I();
607
+ return /* @__PURE__ */ S("button", {
608
608
  type: "button",
609
609
  className: "lilt-board-handle",
610
610
  "aria-pressed": !1,
611
611
  "aria-label": `Pin ${e}`,
612
612
  title: "Keep at the top",
613
613
  onClick: () => t(!0),
614
- children: /* @__PURE__ */ b(n, {})
614
+ children: /* @__PURE__ */ S(n, {})
615
615
  });
616
616
  }
617
- function de() {
618
- let { pending: e, apply: t } = I();
619
- return e ? /* @__PURE__ */ b("div", {
617
+ function fe() {
618
+ let { pending: e, apply: t } = F();
619
+ return e ? /* @__PURE__ */ S("div", {
620
620
  className: "lilt-board__toolbar",
621
- children: /* @__PURE__ */ b("button", {
621
+ children: /* @__PURE__ */ S("button", {
622
622
  type: "button",
623
623
  className: "lilt-board__apply",
624
624
  onClick: t,
@@ -626,5 +626,11 @@ function de() {
626
626
  })
627
627
  }) : null;
628
628
  }
629
+ function V(e) {
630
+ return /* @__PURE__ */ S(u, {
631
+ layout: !0,
632
+ children: /* @__PURE__ */ S(L, { ...e })
633
+ });
634
+ }
629
635
  //#endregion
630
- export { ne as BoardItem, B as BoardItemTab, de as BoardToolbar, R as ChartBoard, O as boardReducer, a as describeExplanation, t as describeFlag, c as evaluateNormal, s as explainDeviation, r as explainReadings, T as flatline, E as jump, M as rankBoard, o as trackNormalStatus, I as useBoard, L as useBoardItem };
636
+ export { re as BoardItem, z as BoardItemTab, fe as BoardToolbar, V as ChartBoard, O as boardReducer, a as describeExplanation, t as describeFlag, c as evaluateNormal, s as explainDeviation, r as explainReadings, T as flatline, E as jump, M as rankBoard, o as trackNormalStatus, F as useBoard, I as useBoardItem };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lilt-ui/charts",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "description": "Beautiful, key-typed React chart cards with linked hover, targets, forecasts, finance charts, and calm motion.",
5
5
  "keywords": [
6
6
  "react",