@logicplanes/kaeso-ui 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/ai/component-guides.md +27 -1
  2. package/ai/component-registry.json +91 -1
  3. package/ai/component-registry.md +23 -1
  4. package/ai/icons.md +1 -1
  5. package/ai/tokens.md +1 -1
  6. package/dist/chunks/release-art-DEc9HNa6.js +555 -0
  7. package/dist/chunks/release-art-DEc9HNa6.js.map +1 -0
  8. package/dist/chunks/status-dot-BzMlYuMe.js +29 -0
  9. package/dist/chunks/status-dot-BzMlYuMe.js.map +1 -0
  10. package/dist/components/charts/timeseries.js +72 -69
  11. package/dist/components/charts/timeseries.js.map +1 -1
  12. package/dist/components/data-table.js +1 -1
  13. package/dist/components/date-picker.js +1 -1
  14. package/dist/components/date-picker.js.map +1 -1
  15. package/dist/components/release-art.js +2 -0
  16. package/dist/components/status-dot.js +1 -1
  17. package/dist/format.js +84 -68
  18. package/dist/format.js.map +1 -1
  19. package/dist/index.js +27 -26
  20. package/dist/kaeso.css +23 -1
  21. package/dist/styles.css +1 -1
  22. package/dist/types/components/release-art/docs.d.ts +13 -0
  23. package/dist/types/components/release-art/drawing.d.ts +48 -0
  24. package/dist/types/components/release-art/index.d.ts +1 -0
  25. package/dist/types/components/release-art/release-art.d.ts +37 -0
  26. package/dist/types/components/status-dot/docs.d.ts +2 -0
  27. package/dist/types/components/status-dot/status-dot.d.ts +2 -0
  28. package/dist/types/format/index.d.ts +2 -0
  29. package/dist/types/index.d.ts +1 -0
  30. package/foundations/accessibility.md +1 -0
  31. package/package.json +2 -2
  32. package/dist/chunks/status-dot-CBoQpyL4.js +0 -25
  33. package/dist/chunks/status-dot-CBoQpyL4.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status-dot-BzMlYuMe.js","names":["cn","Icon","KAESO_STATUS_DOT_VARIANTS","KAESO_STATUS_DOT_DEFAULT_VARIANTS","StatusDot","children","devWarn","size","tone","className","icon","Status"],"sources":["../../src/components/status-dot/status-dot.tsx"],"sourcesContent":["import { forwardRef, type ReactNode } from \"react\";\nimport { cn } from \"../../utils/cn.js\";\nimport { devWarn } from \"../../utils/dev.js\";\nimport { Icon, type IconData } from \"../icon/icon.js\";\n\nexport const KAESO_STATUS_DOT_VARIANTS = {\n tone: {\n success: { classes: \"text-success-text\" },\n warning: { classes: \"text-warning-text\" },\n danger: { classes: \"text-danger-text\" },\n info: { classes: \"text-info-text\" },\n neutral: { classes: \"text-fg-secondary\" },\n },\n} as const;\nexport const KAESO_STATUS_DOT_DEFAULT_VARIANTS = { tone: \"neutral\" } as const;\n\nexport interface StatusDotProps {\n tone?: keyof typeof KAESO_STATUS_DOT_VARIANTS.tone | undefined;\n children?: ReactNode | undefined;\n size?: \"sm\" | \"md\" | undefined;\n icon?: IconData | undefined;\n className?: string | undefined;\n}\n\nexport const StatusDot = /* @__PURE__ */ forwardRef<HTMLSpanElement, StatusDotProps>(function StatusDot({ tone = \"neutral\", children, size = \"md\", icon, className }, ref) {\n if (children === undefined || children === null || children === \"\")\n devWarn(\"StatusDot: a status is a word in its color; pass the word as children (it renders nothing without one).\");\n return (\n <span\n ref={ref}\n className={cn(\n \"inline-flex items-center gap-6 font-medium\",\n size === \"md\" ? \"text-body\" : \"text-small\",\n KAESO_STATUS_DOT_VARIANTS.tone[tone].classes,\n className,\n )}\n >\n {icon && <Icon icon={icon} size=\"sm\" />}\n {children}\n </span>\n );\n});\nif (process.env.NODE_ENV !== \"production\") StatusDot.displayName = \"StatusDot\";\n\nexport const Status = StatusDot;\n"],"mappings":";;;;;;;AAKA,IAAaE,IAA4B,EACvC,MAAM;CACJ,SAAS,EAAE,SAAS,oBAAoB;CACxC,SAAS,EAAE,SAAS,oBAAoB;CACxC,QAAQ,EAAE,SAAS,mBAAmB;CACtC,MAAM,EAAE,SAAS,iBAAiB;CAClC,SAAS,EAAE,SAAS,oBAAoB;AAC1C,EACF,GACaC,IAAoC,EAAE,MAAM,UAAU,GAUtDC,IAA4B,kBAA4C,SAAmB,EAAE,UAAO,WAAW,aAAU,UAAO,MAAM,SAAM,gBAAa,GAAK;CAGzK,QAFIC,KAAuC,QAAQA,MAAa,OAC9DC,EAAQ,yGAAyG,GAEjH,kBAAC,QAAD;EACO;EACL,WAAWN,EACT,8CACAO,MAAS,OAAO,cAAc,cAC9BL,EAA0B,KAAKM,EAAK,CAAC,SACrCC,CACF;EAPF,UAAA,CASGC,KAAQ,kBAACT,GAAD;GAAY;GAAM,MAAK;EAAM,CAAA,GACrCI,CACG;;AAEV,CAAC;AACD,QAAA,IAAA,aAA6B,iBAAc,EAAU,cAAc;AAEnE,IAAaM,IAASP"}
@@ -1,14 +1,14 @@
1
1
  "use client";
2
2
  import { t as e } from "../../chunks/cn-CidVUKMm.js";
3
3
  import { i as t, r as n } from "../../chunks/context-BELWW79w.js";
4
- import { formatNumber as r, formatPercent as ee } from "../../format.js";
5
- import { A as te, D as ne, E as re, S as ie, _ as ae, b as oe, g as se, i as ce, k as le, n as ue, r as de, s as fe, t as i, v as pe } from "../../chunks/core-K960A4OT.js";
4
+ import { formatNumber as r, formatPercent as ee, formatTimeZone as i } from "../../format.js";
5
+ import { A as te, D as ne, E as re, S as ie, _ as ae, b as oe, g as se, i as ce, k as le, n as ue, r as de, s as fe, t as a, v as pe } from "../../chunks/core-K960A4OT.js";
6
6
  import { t as me } from "../../chunks/linear-scale-BWKeRqDX.js";
7
- import { forwardRef as a, useId as he, useMemo as o, useState as s } from "react";
8
- import { jsx as c, jsxs as l } from "react/jsx-runtime";
9
- import { area as u, curveMonotoneX as d, line as f, stack as ge } from "d3-shape";
10
- import { bisector as _e, max as p, min as ve } from "d3-array";
11
- import { timeTicks as ye } from "d3-time";
7
+ import { forwardRef as o, useId as he, useMemo as s, useState as c } from "react";
8
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
9
+ import { area as ge, curveMonotoneX as d, line as f, stack as _e } from "d3-shape";
10
+ import { bisector as ve, max as p, min as ye } from "d3-array";
11
+ import { timeTicks as be } from "d3-time";
12
12
  //#region src/components/charts/timeseries.tsx
13
13
  var m = { kind: {
14
14
  line: { classes: "" },
@@ -21,8 +21,11 @@ var m = { kind: {
21
21
  left: 0
22
22
  };
23
23
  function _(e, t) {
24
- let n = new Intl.DateTimeFormat(e === "en" ? "en-US" : e, t);
25
- return (e) => n.format(e);
24
+ let n = i(), r = new Intl.DateTimeFormat(e === "en" ? "en-US" : e, {
25
+ ...t,
26
+ ...n ? { timeZone: n } : {}
27
+ });
28
+ return (e) => r.format(e);
26
29
  }
27
30
  var v = {
28
31
  hour: "2-digit",
@@ -32,18 +35,18 @@ var v = {
32
35
  month: "short",
33
36
  day: "numeric"
34
37
  };
35
- function be(e, t) {
38
+ function xe(e, t) {
36
39
  let n = 36e5;
37
40
  if (t <= 48 * n) return _(e, v);
38
41
  if (t <= 2160 * n) return _(e, y);
39
42
  let r = _(e, { month: "short" });
40
43
  return (e) => e.getMonth() === 0 ? String(e.getFullYear()) : r(e);
41
44
  }
42
- var b = /* @__PURE__ */ a(function({ series: a, kind: m = "line", height: h = 240, formatValue: b = (e) => r(e), threshold: x, hideLegend: xe, highlight: S, formatTime: C, className: Se, "aria-label": w, ...T }, Ce) {
43
- let we = t(), Te = n(), [Ee, E] = ne(), D = he().replace(/:/g, ""), De = ie(b), [O, Oe] = s(/* @__PURE__ */ new Set()), [k, ke] = s(null), [A, Ae] = s(null), j = a.filter((e) => !O.has(e.id)), M = o(() => (a[0]?.points ?? []).map((e) => new Date(e.t)), [a]), N = j.flatMap((e) => e.points.map((e) => e.v)), P = Math.max(0, E.width - g.left - g.right), F = Math.max(0, h - g.top - g.bottom), I = m === "stacked", je = I ? p(M.map((e, t) => j.reduce((e, n) => e + (n.points[t]?.v ?? 0), 0))) ?? 0 : p(N) ?? 0, L = me().domain([0, Math.max(je, x?.value ?? 0) * 1.08 || 1]).nice(4).range([F, 0]), R = le(N, L.domain()[1] ?? 1, !!T.loading), z = o(() => {
45
+ var b = /* @__PURE__ */ o(function({ series: i, kind: o = "line", height: m = 240, formatValue: h = (e) => r(e), threshold: b, hideLegend: Se, highlight: x, formatTime: S, className: Ce, "aria-label": C, ...w }, we) {
46
+ let Te = t(), Ee = n(), [De, T] = ne(), E = he().replace(/:/g, ""), D = ie(h), [O, Oe] = c(/* @__PURE__ */ new Set()), [k, ke] = c(null), [A, Ae] = c(null), j = i.filter((e) => !O.has(e.id)), M = s(() => (i[0]?.points ?? []).map((e) => new Date(e.t)), [i]), N = j.flatMap((e) => e.points.map((e) => e.v)), P = Math.max(0, T.width - g.left - g.right), F = Math.max(0, m - g.top - g.bottom), I = o === "stacked", je = I ? p(M.map((e, t) => j.reduce((e, n) => e + (n.points[t]?.v ?? 0), 0))) ?? 0 : p(N) ?? 0, L = me().domain([0, Math.max(je, b?.value ?? 0) * 1.08 || 1]).nice(4).range([F, 0]), R = le(N, L.domain()[1] ?? 1, !!w.loading), z = s(() => {
44
47
  let e = 0;
45
48
  return j.map((t) => t.points.map(() => R.values[e++] ?? 0));
46
- }, [j, R.values]), Me = L.copy().domain([0, R.top || 1]), B = ve(M) ?? /* @__PURE__ */ new Date(), V = p(M) ?? /* @__PURE__ */ new Date(), H = me().domain([B.getTime(), V.getTime()]).range([0, P]), U = I ? ge().keys(j.map((e, t) => String(t)))(M.map((e, t) => j.map((e, n) => z[n]?.[t] ?? 0))) : null, W = (e) => Math.max(0, Me(e)), Ne = (T.loading ? L.ticks(4) : te(pe(L, De), N)).filter((e) => e <= (R.top || 1) + 1e-9), Pe = ye(B, V, Math.max(2, Math.min(8, Math.floor(P / 96)))), G = (M[M.length - 1]?.getTime() ?? 0) - (M[0]?.getTime() ?? 0), K = be(Te, G), q = (M[1]?.getTime() ?? 0) - (M[0]?.getTime() ?? 0), J = C ?? _(Te, q && q < 864e5 ? {
49
+ }, [j, R.values]), Me = L.copy().domain([0, R.top || 1]), B = ye(M) ?? /* @__PURE__ */ new Date(), V = p(M) ?? /* @__PURE__ */ new Date(), H = me().domain([B.getTime(), V.getTime()]).range([0, P]), U = I ? _e().keys(j.map((e, t) => String(t)))(M.map((e, t) => j.map((e, n) => z[n]?.[t] ?? 0))) : null, W = (e) => Math.max(0, Me(e)), Ne = (w.loading ? L.ticks(4) : te(pe(L, D), N)).filter((e) => e <= (R.top || 1) + 1e-9), Pe = be(B, V, Math.max(2, Math.min(8, Math.floor(P / 96)))), G = (M[M.length - 1]?.getTime() ?? 0) - (M[0]?.getTime() ?? 0), K = xe(Ee, G), q = (M[1]?.getTime() ?? 0) - (M[0]?.getTime() ?? 0), J = S ?? _(Ee, q && q < 864e5 ? {
47
50
  weekday: "short",
48
51
  ...y,
49
52
  ...v
@@ -53,119 +56,119 @@ var b = /* @__PURE__ */ a(function({ series: a, kind: m = "line", height: h = 24
53
56
  } : {
54
57
  ...y,
55
58
  year: "numeric"
56
- }), Fe = f().x((e, t) => Math.round(H(M[t] ?? /* @__PURE__ */ new Date()))).y((e) => W(e)).curve(d), Ie = u().x((e, t) => Math.round(H(M[t] ?? /* @__PURE__ */ new Date()))).y0(F).y1((e) => W(e)).curve(d), Le = u().x((e, t) => Math.round(H(M[t] ?? /* @__PURE__ */ new Date()))).y0((e) => W(e[0])).y1((e) => W(e[1])).curve(d), Re = f().x((e, t) => Math.round(H(M[t] ?? /* @__PURE__ */ new Date()))).y((e) => W(e[1])).curve(d), ze = o(() => oe(a.map((e) => e.id)), [a]), Y = (e) => e.color ?? ze.get(e.id), Be = _e((e) => e.getTime()).center, Ve = (e) => {
59
+ }), Fe = f().x((e, t) => Math.round(H(M[t] ?? /* @__PURE__ */ new Date()))).y((e) => W(e)).curve(d), Ie = ge().x((e, t) => Math.round(H(M[t] ?? /* @__PURE__ */ new Date()))).y0(F).y1((e) => W(e)).curve(d), Le = ge().x((e, t) => Math.round(H(M[t] ?? /* @__PURE__ */ new Date()))).y0((e) => W(e[0])).y1((e) => W(e[1])).curve(d), Re = f().x((e, t) => Math.round(H(M[t] ?? /* @__PURE__ */ new Date()))).y((e) => W(e[1])).curve(d), ze = s(() => oe(i.map((e) => e.id)), [i]), Y = (e) => e.color ?? ze.get(e.id), Be = ve((e) => e.getTime()).center, Ve = (e) => {
57
60
  let t = e.currentTarget.getBoundingClientRect(), n = Be(M, H.invert(e.clientX - t.left));
58
61
  Ae({
59
62
  i: n,
60
63
  y: Math.round(e.clientY - t.top + g.top)
61
64
  });
62
65
  }, He = {
63
- columns: [we("timeseriesChart.time", "Time"), ...a.map((e) => e.label)],
64
- rows: M.map((e, t) => [(C ?? K)(e), ...a.map((e) => b(e.points[t]?.v ?? 0))])
65
- }, Ue = T.empty ?? a.every((e) => e.points.every((e) => e.v === 0)), X = !!T.loading || Ue, Z = re(X || T.error ? 0 : M.length), Q = X || T.error ? null : A?.i ?? Z.index ?? (S !== void 0 && S < M.length ? S : null), $ = Q === null ? 0 : Math.round(H(M[Q])) + g.left, We = Q === null ? 0 : A && A.i === Q ? A.y : g.top + Math.round(W(I ? U?.[U.length - 1]?.[Q]?.[1] ?? 0 : Math.max(0, ...z.map((e) => e[Q] ?? 0)))), Ge = (e) => j.map((t) => {
66
+ columns: [Te("timeseriesChart.time", "Time"), ...i.map((e) => e.label)],
67
+ rows: M.map((e, t) => [(S ?? K)(e), ...i.map((e) => h(e.points[t]?.v ?? 0))])
68
+ }, Ue = w.empty ?? i.every((e) => e.points.every((e) => e.v === 0)), X = !!w.loading || Ue, Z = re(X || w.error ? 0 : M.length), Q = X || w.error ? null : A?.i ?? Z.index ?? (x !== void 0 && x < M.length ? x : null), $ = Q === null ? 0 : Math.round(H(M[Q])) + g.left, We = Q === null ? 0 : A && A.i === Q ? A.y : g.top + Math.round(W(I ? U?.[U.length - 1]?.[Q]?.[1] ?? 0 : Math.max(0, ...z.map((e) => e[Q] ?? 0)))), Ge = (e) => j.map((t) => {
66
69
  let n = t.points[e]?.v ?? 0, r = j.reduce((t, n) => t + (n.points[e]?.v ?? 0), 0);
67
70
  return {
68
71
  id: t.id,
69
72
  label: t.label,
70
73
  color: Y(t),
71
- value: b(n),
74
+ value: h(n),
72
75
  ...j.length > 1 && r ? { share: ee(Math.round(n / r * 100) / 100, 0) } : {}
73
76
  };
74
77
  });
75
- return /* @__PURE__ */ c("div", {
76
- ref: Ce,
77
- className: e("min-w-0", Se),
78
- children: /* @__PURE__ */ c(ue, {
79
- label: w,
80
- height: h,
78
+ return /* @__PURE__ */ l("div", {
79
+ ref: we,
80
+ className: e("min-w-0", Ce),
81
+ children: /* @__PURE__ */ l(ue, {
82
+ label: C,
83
+ height: m,
81
84
  table: He,
82
85
  state: {
83
- ...T,
86
+ ...w,
84
87
  empty: Ue
85
88
  },
86
- legend: !xe && a.length > 1 ? /* @__PURE__ */ c(fe, {
87
- items: a.map((e) => ({
89
+ legend: !Se && i.length > 1 ? /* @__PURE__ */ l(fe, {
90
+ items: i.map((e) => ({
88
91
  id: e.id,
89
92
  label: e.label,
90
93
  color: Y(e)
91
94
  })),
92
95
  hidden: O,
93
- shape: m === "line" ? "line" : "square",
96
+ shape: o === "line" ? "line" : "square",
94
97
  onToggle: (e) => {
95
98
  let t = new Set(O);
96
99
  t.has(e) ? t.delete(e) : t.add(e), Oe(t);
97
100
  },
98
101
  onHover: ke
99
102
  }) : void 0,
100
- children: /* @__PURE__ */ l("div", {
101
- ref: Ee,
103
+ children: /* @__PURE__ */ u("div", {
104
+ ref: De,
102
105
  role: "group",
103
- "aria-label": w,
106
+ "aria-label": C,
104
107
  ...Z.props,
105
108
  className: "absolute inset-0 rounded-cell focus-ring",
106
109
  children: [
107
- E.width > 0 && /* @__PURE__ */ l("svg", {
108
- width: E.width,
109
- height: h,
110
+ T.width > 0 && /* @__PURE__ */ u("svg", {
111
+ width: T.width,
112
+ height: m,
110
113
  className: "block overflow-visible",
111
114
  role: "presentation",
112
- children: [/* @__PURE__ */ c("defs", { children: j.map((e) => /* @__PURE__ */ l("linearGradient", {
113
- id: `${D}-${e.id}`,
115
+ children: [/* @__PURE__ */ l("defs", { children: j.map((e) => /* @__PURE__ */ u("linearGradient", {
116
+ id: `${E}-${e.id}`,
114
117
  x1: "0",
115
118
  y1: "0",
116
119
  x2: "0",
117
120
  y2: "1",
118
- children: [/* @__PURE__ */ c("stop", {
121
+ children: [/* @__PURE__ */ l("stop", {
119
122
  offset: "0%",
120
123
  stopColor: Y(e),
121
124
  className: "chart-fill-top"
122
- }), /* @__PURE__ */ c("stop", {
125
+ }), /* @__PURE__ */ l("stop", {
123
126
  offset: "100%",
124
127
  stopColor: Y(e),
125
128
  stopOpacity: 0
126
129
  })]
127
- }, e.id)) }), /* @__PURE__ */ l("g", {
130
+ }, e.id)) }), /* @__PURE__ */ u("g", {
128
131
  transform: `translate(${g.left},${g.top})`,
129
132
  children: [
130
- Ne.map((e) => /* @__PURE__ */ l("g", {
133
+ Ne.map((e) => /* @__PURE__ */ u("g", {
131
134
  transform: `translate(0,${Math.round(W(e)) + .5})`,
132
- children: [e !== 0 && /* @__PURE__ */ c("line", {
135
+ children: [e !== 0 && /* @__PURE__ */ l("line", {
133
136
  x2: P,
134
- ...i.grid
135
- }), !T.loading && /* @__PURE__ */ c("text", {
137
+ ...a.grid
138
+ }), !w.loading && /* @__PURE__ */ l("text", {
136
139
  x: P + 12,
137
140
  dy: "0.32em",
138
- ...i.label,
139
- children: De(e)
141
+ ...a.label,
142
+ children: D(e)
140
143
  })]
141
144
  }, e)),
142
- /* @__PURE__ */ c("line", {
145
+ /* @__PURE__ */ l("line", {
143
146
  x2: P,
144
147
  y1: F + .5,
145
148
  y2: F + .5,
146
- ...i.baseline
149
+ ...a.baseline
147
150
  }),
148
151
  ae(Pe.map((e) => ({
149
152
  key: e.getTime(),
150
153
  at: Math.round(H(e)),
151
154
  label: K(e)
152
- })), P + g.right).map((e) => /* @__PURE__ */ c("text", {
155
+ })), P + g.right).map((e) => /* @__PURE__ */ l("text", {
153
156
  x: e.x,
154
157
  y: F + 20,
155
158
  textAnchor: e.anchor,
156
- ...i.label,
159
+ ...a.label,
157
160
  children: e.label
158
161
  }, e.key)),
159
162
  X ? null : I && U ? U.map((e, t) => {
160
163
  let n = j[t];
161
- return /* @__PURE__ */ l("g", {
164
+ return /* @__PURE__ */ u("g", {
162
165
  opacity: k && k !== n.id ? .3 : 1,
163
166
  className: "opacity-motion",
164
- children: [/* @__PURE__ */ c("path", {
167
+ children: [/* @__PURE__ */ l("path", {
165
168
  d: Le(e) ?? "",
166
169
  fill: Y(n),
167
170
  className: "chart-stack-fill"
168
- }), /* @__PURE__ */ c("path", {
171
+ }), /* @__PURE__ */ l("path", {
169
172
  d: Re(e) ?? "",
170
173
  fill: "none",
171
174
  stroke: Y(n),
@@ -174,13 +177,13 @@ var b = /* @__PURE__ */ a(function({ series: a, kind: m = "line", height: h = 24
174
177
  strokeLinecap: "round"
175
178
  })]
176
179
  }, n.id);
177
- }) : j.map((e, t) => /* @__PURE__ */ l("g", {
180
+ }) : j.map((e, t) => /* @__PURE__ */ u("g", {
178
181
  opacity: k && k !== e.id ? .3 : 1,
179
182
  className: "opacity-motion",
180
- children: [m === "area" && /* @__PURE__ */ c("path", {
183
+ children: [o === "area" && /* @__PURE__ */ l("path", {
181
184
  d: Ie(z[t] ?? []) ?? "",
182
- fill: `url(#${D}-${e.id})`
183
- }), /* @__PURE__ */ c("path", {
185
+ fill: `url(#${E}-${e.id})`
186
+ }), /* @__PURE__ */ l("path", {
184
187
  d: Fe(z[t] ?? []) ?? "",
185
188
  fill: "none",
186
189
  stroke: Y(e),
@@ -189,31 +192,31 @@ var b = /* @__PURE__ */ a(function({ series: a, kind: m = "line", height: h = 24
189
192
  strokeLinecap: "round"
190
193
  })]
191
194
  }, e.id)),
192
- x && /* @__PURE__ */ l("g", {
193
- transform: `translate(0,${Math.round(W(x.value)) + .5})`,
194
- children: [/* @__PURE__ */ c("line", {
195
+ b && /* @__PURE__ */ u("g", {
196
+ transform: `translate(0,${Math.round(W(b.value)) + .5})`,
197
+ children: [/* @__PURE__ */ l("line", {
195
198
  x2: P,
196
199
  stroke: "var(--k-danger)",
197
200
  strokeDasharray: "4 4",
198
201
  strokeWidth: 1
199
- }), /* @__PURE__ */ c("text", {
202
+ }), /* @__PURE__ */ l("text", {
200
203
  x: 0,
201
204
  dy: -6,
202
205
  fill: "var(--k-danger-text)",
203
206
  fontSize: 12,
204
207
  fontWeight: 500,
205
- children: x.label
208
+ children: b.label
206
209
  })]
207
210
  }),
208
- Q !== null && /* @__PURE__ */ l("g", {
211
+ Q !== null && /* @__PURE__ */ u("g", {
209
212
  "aria-hidden": !0,
210
- children: [/* @__PURE__ */ c("line", {
213
+ children: [/* @__PURE__ */ l("line", {
211
214
  x1: $ - g.left + .5,
212
215
  x2: $ - g.left + .5,
213
216
  y2: F,
214
- ...i.grid,
217
+ ...a.grid,
215
218
  stroke: "var(--k-line-strong)"
216
- }), !I && j.map((e, t) => /* @__PURE__ */ c("circle", {
219
+ }), !I && j.map((e, t) => /* @__PURE__ */ l("circle", {
217
220
  cx: $ - g.left,
218
221
  cy: W(z[t]?.[Q] ?? 0),
219
222
  r: 4,
@@ -222,7 +225,7 @@ var b = /* @__PURE__ */ a(function({ series: a, kind: m = "line", height: h = 24
222
225
  strokeWidth: 2
223
226
  }, e.id))]
224
227
  }),
225
- /* @__PURE__ */ c("rect", {
228
+ /* @__PURE__ */ l("rect", {
226
229
  width: P,
227
230
  height: F,
228
231
  fill: "transparent",
@@ -232,15 +235,15 @@ var b = /* @__PURE__ */ a(function({ series: a, kind: m = "line", height: h = 24
232
235
  ]
233
236
  })]
234
237
  }),
235
- Q !== null && M[Q] && /* @__PURE__ */ c(ce, {
238
+ Q !== null && M[Q] && /* @__PURE__ */ l(ce, {
236
239
  x: $,
237
240
  y: We,
238
- width: E.width,
241
+ width: T.width,
239
242
  visible: !0,
240
243
  heading: J(M[Q]),
241
244
  rows: Ge(Q)
242
245
  }),
243
- /* @__PURE__ */ c(de, { children: Z.index !== null && Q !== null && M[Z.index] ? se(J(M[Z.index]), Ge(Z.index), we) : null })
246
+ /* @__PURE__ */ l(de, { children: Z.index !== null && Q !== null && M[Z.index] ? se(J(M[Z.index]), Ge(Z.index), Te) : null })
244
247
  ]
245
248
  })
246
249
  })
@@ -1 +1 @@
1
- {"version":3,"file":"timeseries.js","names":["d3max","d3min","d3stack","d3line","d3area","cn","useUiText","useLocale","wholeTicks","useSize","useChartKeys","tickLabel","placeTimeLabels","seriesColors","liveLine","ChartTooltip","useTweenedScale","ChartFrame","ChartLive","Legend","AXIS","readableTicks","scaleLinear","KAESO_TIMESERIES_CHART_VARIANTS","KAESO_TIMESERIES_CHART_DEFAULT_VARIANTS","M","timeFormat","f","locale","options","d","CLOCK","DAY","tickFormat","h","span","month","TimeseriesChart","formatNumber","v","ariaLabel","state","t","box","size","gid","useId","axisLabel","formatValue","hidden","setHidden","useState","focus","setFocus","hover","setHover","visible","series","s","times","useMemo","p","flatValues","w","height","stacked","kind","top","max","a","ti","axis","threshold","tween","values","k","yScale","t0","min","t1","x","stackData","stack","i","si","y","yTicks","xTicks","timeTicks","fmt","step","headingFormat","formatTime","lineGen","line","curveMonotoneX","areaGen","area","stackArea","stackTop","palette","color","bis","bisector","onMove","r","table","empty","blank","keys","active","highlight","activeX","activeY","sv","rowsFor","total","acc","ss","formatPercent","className","hideLegend","n","id","l","li","layer"],"sources":["../../../src/components/charts/timeseries.tsx"],"sourcesContent":["import type * as React from \"react\";\nimport { forwardRef, useId, useMemo, useState, type ReactNode } from \"react\";\nimport { scaleLinear } from \"./linear-scale.js\";\nimport { area as d3area, curveMonotoneX, line as d3line, stack as d3stack } from \"d3-shape\";\nimport { bisector, max as d3max, min as d3min } from \"d3-array\";\nimport { timeTicks } from \"d3-time\";\nimport { cn } from \"../../utils/cn.js\";\nimport { formatNumber, formatPercent } from \"../../format/index.js\";\nimport { useLocale, useUiText } from \"../../i18n/context.js\";\nimport {\n AXIS,\n ChartFrame,\n ChartLive,\n ChartTooltip,\n Legend,\n placeTimeLabels,\n liveLine,\n seriesColors,\n readableTicks,\n tickLabel,\n useChartKeys,\n useSize,\n useTweenedScale,\n wholeTicks,\n type ChartState,\n} from \"./core.js\";\n\nexport const KAESO_TIMESERIES_CHART_VARIANTS = {\n kind: {\n line: { classes: \"\" },\n area: { classes: \"\" },\n stacked: { classes: \"\" },\n },\n} as const;\nexport const KAESO_TIMESERIES_CHART_DEFAULT_VARIANTS = { kind: \"line\" } as const;\n\nexport interface TimePoint {\n t: Date | number | string;\n v: number;\n}\nexport interface TimeSeries {\n id: string;\n label: string;\n points: TimePoint[];\n color?: string | undefined;\n}\n\nexport interface TimeseriesChartProps extends ChartState {\n series: TimeSeries[];\n kind?: keyof typeof KAESO_TIMESERIES_CHART_VARIANTS.kind | undefined;\n height?: number | undefined;\n formatValue?: ((v: number) => string) | undefined;\n threshold?: { value: number; label: string } | undefined;\n hideLegend?: boolean | undefined;\n highlight?: number | undefined;\n formatTime?: ((t: Date) => string) | undefined;\n \"aria-label\": string;\n className?: string | undefined;\n}\n\nconst M = { top: 8, right: 52, bottom: 28, left: 0 };\n\nfunction timeFormat(locale: string, options: Intl.DateTimeFormatOptions): (d: Date) => string {\n const f = new Intl.DateTimeFormat(locale === \"en\" ? \"en-US\" : locale, options);\n return (d) => f.format(d);\n}\nconst CLOCK = { hour: \"2-digit\", minute: \"2-digit\", hourCycle: \"h23\" } as const;\nconst DAY = { month: \"short\", day: \"numeric\" } as const;\n\nfunction tickFormat(locale: string, span: number) {\n const h = 3_600_000;\n if (span <= 48 * h) return timeFormat(locale, CLOCK);\n if (span <= 90 * 24 * h) return timeFormat(locale, DAY);\n const month = timeFormat(locale, { month: \"short\" });\n return (d: Date) => (d.getMonth() === 0 ? String(d.getFullYear()) : month(d));\n}\n\nexport const TimeseriesChart = /* @__PURE__ */ forwardRef<HTMLDivElement, TimeseriesChartProps>(function TimeseriesChart(\n {\n series,\n kind = \"line\",\n height = 240,\n formatValue = (v) => formatNumber(v),\n threshold,\n hideLegend,\n highlight,\n formatTime,\n className,\n \"aria-label\": ariaLabel,\n ...state\n },\n ref,\n) {\n const t = useUiText();\n const locale = useLocale();\n const [box, size] = useSize<HTMLDivElement>();\n const gid = useId().replace(/:/g, \"\");\n const axisLabel = tickLabel(formatValue);\n const [hidden, setHidden] = useState<Set<string>>(new Set());\n const [focus, setFocus] = useState<string | null>(null);\n const [hover, setHover] = useState<{ i: number; y: number } | null>(null);\n const visible = series.filter((s) => !hidden.has(s.id));\n const times = useMemo(() => (series[0]?.points ?? []).map((p) => new Date(p.t)), [series]);\n const flatValues = visible.flatMap((s) => s.points.map((p) => p.v));\n const w = Math.max(0, size.width - M.left - M.right);\n const h = Math.max(0, height - M.top - M.bottom);\n const stacked = kind === \"stacked\";\n const top = stacked ? (d3max(times.map((_, ti) => visible.reduce((a, s) => a + (s.points[ti]?.v ?? 0), 0))) ?? 0) : (d3max(flatValues) ?? 0);\n const axis = scaleLinear()\n .domain([0, Math.max(top, threshold?.value ?? 0) * 1.08 || 1])\n .nice(4)\n .range([h, 0]);\n const tween = useTweenedScale(flatValues, axis.domain()[1] ?? 1, !!state.loading);\n const values = useMemo(() => {\n let k = 0;\n return visible.map((s) => s.points.map(() => tween.values[k++] ?? 0));\n }, [visible, tween.values]);\n const yScale = axis.copy().domain([0, tween.top || 1]);\n const t0 = d3min(times) ?? new Date();\n const t1 = d3max(times) ?? new Date();\n const x = scaleLinear().domain([t0.getTime(), t1.getTime()]).range([0, w]);\n const stackData = stacked\n ? d3stack<number[]>().keys(visible.map((_, i) => String(i)))(times.map((_, ti) => visible.map((_, si) => values[si]?.[ti] ?? 0)))\n : null;\n const y = (v: number) => Math.max(0, yScale(v));\n const yTicks = (state.loading ? axis.ticks(4) : wholeTicks(readableTicks(axis, axisLabel), flatValues)).filter((t) => t <= (tween.top || 1) + 1e-9);\n const xTicks = timeTicks(t0, t1, Math.max(2, Math.min(8, Math.floor(w / 96))));\n const span = (times[times.length - 1]?.getTime() ?? 0) - (times[0]?.getTime() ?? 0);\n const fmt = tickFormat(locale, span);\n const step = (times[1]?.getTime() ?? 0) - (times[0]?.getTime() ?? 0);\n const headingFormat =\n formatTime ??\n timeFormat(\n locale,\n step && step < 86_400_000 ? { weekday: \"short\", ...DAY, ...CLOCK } : span <= 90 * 86_400_000 ? { weekday: \"short\", ...DAY } : { ...DAY, year: \"numeric\" },\n );\n const lineGen = d3line<number>()\n .x((_, i) => Math.round(x(times[i] ?? new Date())))\n .y((v) => y(v))\n .curve(curveMonotoneX);\n const areaGen = d3area<number>()\n .x((_, i) => Math.round(x(times[i] ?? new Date())))\n .y0(h)\n .y1((v) => y(v))\n .curve(curveMonotoneX);\n const stackArea = d3area<[number, number]>()\n .x((_, i) => Math.round(x(times[i] ?? new Date())))\n .y0((d) => y(d[0]))\n .y1((d) => y(d[1]))\n .curve(curveMonotoneX);\n\n const stackTop = d3line<[number, number]>()\n .x((_, i) => Math.round(x(times[i] ?? new Date())))\n .y((d) => y(d[1]))\n .curve(curveMonotoneX);\n const palette = useMemo(() => seriesColors(series.map((s) => s.id)), [series]);\n const color = (s: TimeSeries) => s.color ?? palette.get(s.id)!;\n const bis = bisector((d: Date) => d.getTime()).center;\n const onMove = (e: React.PointerEvent<SVGRectElement>) => {\n const r = e.currentTarget.getBoundingClientRect();\n const i = bis(times, x.invert(e.clientX - r.left));\n setHover({ i, y: Math.round(e.clientY - r.top + M.top) });\n };\n\n const table = {\n columns: [t(\"timeseriesChart.time\", \"Time\"), ...series.map((s) => s.label)],\n rows: times.map((t, i) => [(formatTime ?? fmt)(t), ...series.map((s) => formatValue(s.points[i]?.v ?? 0))]),\n };\n\n const empty = state.empty ?? series.every((s) => s.points.every((p) => p.v === 0));\n const blank = !!state.loading || empty;\n const keys = useChartKeys(blank || state.error ? 0 : times.length);\n const active = blank || !!state.error ? null : (hover?.i ?? keys.index ?? (highlight !== undefined && highlight < times.length ? highlight : null));\n const activeX = active === null ? 0 : Math.round(x(times[active]!)) + M.left;\n const activeY =\n active === null\n ? 0\n : hover && hover.i === active\n ? hover.y\n : M.top + Math.round(y(stacked ? (stackData?.[stackData.length - 1]?.[active]?.[1] ?? 0) : Math.max(0, ...values.map((sv) => sv[active] ?? 0))));\n const rowsFor = (i: number) =>\n visible.map((s) => {\n const v = s.points[i]?.v ?? 0;\n const total = visible.reduce((acc, ss) => acc + (ss.points[i]?.v ?? 0), 0);\n return {\n id: s.id,\n label: s.label,\n color: color(s),\n value: formatValue(v),\n ...(visible.length > 1 && total ? { share: formatPercent(Math.round((v / total) * 100) / 100, 0) } : {}),\n } as { id: string; label: ReactNode; color: string; value: ReactNode; share?: ReactNode | undefined };\n });\n\n return (\n <div ref={ref} className={cn(\"min-w-0\", className)}>\n <ChartFrame\n label={ariaLabel}\n height={height}\n table={table}\n state={{ ...state, empty }}\n legend={\n !hideLegend && series.length > 1 ? (\n <Legend\n items={series.map((s) => ({ id: s.id, label: s.label, color: color(s) }))}\n hidden={hidden}\n shape={kind === \"line\" ? \"line\" : \"square\"}\n onToggle={(id) => {\n const n = new Set(hidden);\n if (n.has(id)) n.delete(id);\n else n.add(id);\n setHidden(n);\n }}\n onHover={setFocus}\n />\n ) : undefined\n }\n >\n <div ref={box} role=\"group\" aria-label={ariaLabel} {...keys.props} className=\"absolute inset-0 rounded-cell focus-ring\">\n {size.width > 0 && (\n <svg width={size.width} height={height} className=\"block overflow-visible\" role=\"presentation\">\n <defs>\n {visible.map((s) => (\n <linearGradient key={s.id} id={`${gid}-${s.id}`} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop offset=\"0%\" stopColor={color(s)} className=\"chart-fill-top\" />\n <stop offset=\"100%\" stopColor={color(s)} stopOpacity={0} />\n </linearGradient>\n ))}\n </defs>\n <g transform={`translate(${M.left},${M.top})`}>\n {yTicks.map((t) => (\n <g key={t} transform={`translate(0,${Math.round(y(t)) + 0.5})`}>\n {t !== 0 && <line x2={w} {...AXIS.grid} />}\n {!state.loading && (\n <text x={w + 12} dy=\"0.32em\" {...AXIS.label}>\n {axisLabel(t)}\n </text>\n )}\n </g>\n ))}\n <line x2={w} y1={h + 0.5} y2={h + 0.5} {...AXIS.baseline} />\n {placeTimeLabels(\n xTicks.map((t) => ({ key: t.getTime(), at: Math.round(x(t)), label: fmt(t) })),\n w + M.right,\n ).map((l) => (\n <text key={l.key} x={l.x} y={h + 20} textAnchor={l.anchor} {...AXIS.label}>\n {l.label}\n </text>\n ))}\n {blank\n ? null\n : stacked && stackData\n ? stackData.map((layer, li) => {\n const s = visible[li]!;\n return (\n <g key={s.id} opacity={focus && focus !== s.id ? 0.3 : 1} className=\"opacity-motion\">\n <path d={stackArea(layer as unknown as [number, number][]) ?? \"\"} fill={color(s)} className=\"chart-stack-fill\" />\n <path\n d={stackTop(layer as unknown as [number, number][]) ?? \"\"}\n fill=\"none\"\n stroke={color(s)}\n strokeWidth={1.5}\n strokeLinejoin=\"round\"\n strokeLinecap=\"round\"\n />\n </g>\n );\n })\n : visible.map((s, si) => (\n <g key={s.id} opacity={focus && focus !== s.id ? 0.3 : 1} className=\"opacity-motion\">\n {kind === \"area\" && <path d={areaGen(values[si] ?? []) ?? \"\"} fill={`url(#${gid}-${s.id})`} />}\n <path\n d={lineGen(values[si] ?? []) ?? \"\"}\n fill=\"none\"\n stroke={color(s)}\n strokeWidth={2}\n strokeLinejoin=\"round\"\n strokeLinecap=\"round\"\n />\n </g>\n ))}\n {threshold && (\n <g transform={`translate(0,${Math.round(y(threshold.value)) + 0.5})`}>\n <line x2={w} stroke=\"var(--k-danger)\" strokeDasharray=\"4 4\" strokeWidth={1} />\n <text x={0} dy={-6} fill=\"var(--k-danger-text)\" fontSize={12} fontWeight={500}>\n {threshold.label}\n </text>\n </g>\n )}\n {active !== null && (\n <g aria-hidden>\n <line x1={activeX - M.left + 0.5} x2={activeX - M.left + 0.5} y2={h} {...AXIS.grid} stroke=\"var(--k-line-strong)\" />\n {!stacked &&\n visible.map((s, si) => (\n <circle\n key={s.id}\n cx={activeX - M.left}\n cy={y(values[si]?.[active] ?? 0)}\n r={4}\n fill={color(s)}\n stroke=\"var(--k-bg-panel)\"\n strokeWidth={2}\n />\n ))}\n </g>\n )}\n <rect width={w} height={h} fill=\"transparent\" onPointerMove={onMove} onPointerLeave={() => setHover(null)} />\n </g>\n </svg>\n )}\n {active !== null && times[active] && (\n <ChartTooltip x={activeX} y={activeY} width={size.width} visible heading={headingFormat(times[active]!)} rows={rowsFor(active)} />\n )}\n <ChartLive>\n {keys.index !== null && active !== null && times[keys.index] ? liveLine(headingFormat(times[keys.index]!), rowsFor(keys.index), t) : null}\n </ChartLive>\n </div>\n </ChartFrame>\n </div>\n );\n});\nif (process.env.NODE_ENV !== \"production\") TimeseriesChart.displayName = \"TimeseriesChart\";\n"],"mappings":";;;;;;;;;;;;AA2BA,IAAauB,IAAkC,EAC7C,MAAM;CACJ,MAAM,EAAE,SAAS,GAAG;CACpB,MAAM,EAAE,SAAS,GAAG;CACpB,SAAS,EAAE,SAAS,GAAG;AACzB,EACF,GACaC,IAA0C,EAAE,MAAM,OAAO,GA0BhEC,IAAI;CAAE,KAAK;CAAG,OAAO;CAAI,QAAQ;CAAI,MAAM;AAAE;AAEnD,SAASC,EAAW,GAAgB,GAA0D;CAC5F,IAAMC,IAAI,IAAI,KAAK,eAAeC,MAAW,OAAO,UAAUA,GAAQC,CAAO;CAC7E,QAAQ,MAAMF,EAAE,OAAOG,CAAC;AAC1B;AACA,IAAMC,IAAQ;CAAE,MAAM;CAAW,QAAQ;CAAW,WAAW;AAAM,GAC/DC,IAAM;CAAE,OAAO;CAAS,KAAK;AAAU;AAE7C,SAASC,GAAW,GAAgB,GAAc;CAChD,IAAMC,IAAI;CACV,IAAIC,KAAQ,KAAKD,GAAG,OAAOR,EAAWE,GAAQG,CAAK;CACnD,IAAII,KAAQ,OAAUD,GAAG,OAAOR,EAAWE,GAAQI,CAAG;CACtD,IAAMI,IAAQV,EAAWE,GAAQ,EAAE,OAAO,QAAQ,CAAC;CACnD,QAAQ,MAAaE,EAAE,SAAS,MAAM,IAAI,OAAOA,EAAE,YAAY,CAAC,IAAIM,EAAMN,CAAC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aAA6B,iBAAc,EAAgB,cAAc"}
1
+ {"version":3,"file":"timeseries.js","names":["d3max","d3min","d3stack","d3line","d3area","cn","useUiText","useLocale","wholeTicks","useSize","useChartKeys","tickLabel","placeTimeLabels","seriesColors","liveLine","ChartTooltip","useTweenedScale","ChartFrame","ChartLive","Legend","AXIS","readableTicks","scaleLinear","KAESO_TIMESERIES_CHART_VARIANTS","KAESO_TIMESERIES_CHART_DEFAULT_VARIANTS","M","timeFormat","timeZone","formatTimeZone","f","locale","options","d","CLOCK","DAY","tickFormat","h","span","month","TimeseriesChart","formatNumber","v","ariaLabel","state","t","box","size","gid","useId","axisLabel","formatValue","hidden","setHidden","useState","focus","setFocus","hover","setHover","visible","series","s","times","useMemo","p","flatValues","w","height","stacked","kind","top","max","a","ti","axis","threshold","tween","values","k","yScale","t0","min","t1","x","stackData","stack","i","si","y","yTicks","xTicks","timeTicks","fmt","step","headingFormat","formatTime","lineGen","line","curveMonotoneX","areaGen","area","stackArea","stackTop","palette","color","bis","bisector","onMove","r","table","empty","blank","keys","active","highlight","activeX","activeY","sv","rowsFor","total","acc","ss","formatPercent","className","hideLegend","n","id","l","li","layer"],"sources":["../../../src/components/charts/timeseries.tsx"],"sourcesContent":["import type * as React from \"react\";\nimport { forwardRef, useId, useMemo, useState, type ReactNode } from \"react\";\nimport { scaleLinear } from \"./linear-scale.js\";\nimport { area as d3area, curveMonotoneX, line as d3line, stack as d3stack } from \"d3-shape\";\nimport { bisector, max as d3max, min as d3min } from \"d3-array\";\nimport { timeTicks } from \"d3-time\";\nimport { cn } from \"../../utils/cn.js\";\nimport { formatNumber, formatPercent, formatTimeZone } from \"../../format/index.js\";\nimport { useLocale, useUiText } from \"../../i18n/context.js\";\nimport {\n AXIS,\n ChartFrame,\n ChartLive,\n ChartTooltip,\n Legend,\n placeTimeLabels,\n liveLine,\n seriesColors,\n readableTicks,\n tickLabel,\n useChartKeys,\n useSize,\n useTweenedScale,\n wholeTicks,\n type ChartState,\n} from \"./core.js\";\n\nexport const KAESO_TIMESERIES_CHART_VARIANTS = {\n kind: {\n line: { classes: \"\" },\n area: { classes: \"\" },\n stacked: { classes: \"\" },\n },\n} as const;\nexport const KAESO_TIMESERIES_CHART_DEFAULT_VARIANTS = { kind: \"line\" } as const;\n\nexport interface TimePoint {\n t: Date | number | string;\n v: number;\n}\nexport interface TimeSeries {\n id: string;\n label: string;\n points: TimePoint[];\n color?: string | undefined;\n}\n\nexport interface TimeseriesChartProps extends ChartState {\n series: TimeSeries[];\n kind?: keyof typeof KAESO_TIMESERIES_CHART_VARIANTS.kind | undefined;\n height?: number | undefined;\n formatValue?: ((v: number) => string) | undefined;\n threshold?: { value: number; label: string } | undefined;\n hideLegend?: boolean | undefined;\n highlight?: number | undefined;\n formatTime?: ((t: Date) => string) | undefined;\n \"aria-label\": string;\n className?: string | undefined;\n}\n\nconst M = { top: 8, right: 52, bottom: 28, left: 0 };\n\nfunction timeFormat(locale: string, options: Intl.DateTimeFormatOptions): (d: Date) => string {\n const timeZone = formatTimeZone();\n const f = new Intl.DateTimeFormat(locale === \"en\" ? \"en-US\" : locale, { ...options, ...(timeZone ? { timeZone } : {}) });\n return (d) => f.format(d);\n}\nconst CLOCK = { hour: \"2-digit\", minute: \"2-digit\", hourCycle: \"h23\" } as const;\nconst DAY = { month: \"short\", day: \"numeric\" } as const;\n\nfunction tickFormat(locale: string, span: number) {\n const h = 3_600_000;\n if (span <= 48 * h) return timeFormat(locale, CLOCK);\n if (span <= 90 * 24 * h) return timeFormat(locale, DAY);\n const month = timeFormat(locale, { month: \"short\" });\n return (d: Date) => (d.getMonth() === 0 ? String(d.getFullYear()) : month(d));\n}\n\nexport const TimeseriesChart = /* @__PURE__ */ forwardRef<HTMLDivElement, TimeseriesChartProps>(function TimeseriesChart(\n {\n series,\n kind = \"line\",\n height = 240,\n formatValue = (v) => formatNumber(v),\n threshold,\n hideLegend,\n highlight,\n formatTime,\n className,\n \"aria-label\": ariaLabel,\n ...state\n },\n ref,\n) {\n const t = useUiText();\n const locale = useLocale();\n const [box, size] = useSize<HTMLDivElement>();\n const gid = useId().replace(/:/g, \"\");\n const axisLabel = tickLabel(formatValue);\n const [hidden, setHidden] = useState<Set<string>>(new Set());\n const [focus, setFocus] = useState<string | null>(null);\n const [hover, setHover] = useState<{ i: number; y: number } | null>(null);\n const visible = series.filter((s) => !hidden.has(s.id));\n const times = useMemo(() => (series[0]?.points ?? []).map((p) => new Date(p.t)), [series]);\n const flatValues = visible.flatMap((s) => s.points.map((p) => p.v));\n const w = Math.max(0, size.width - M.left - M.right);\n const h = Math.max(0, height - M.top - M.bottom);\n const stacked = kind === \"stacked\";\n const top = stacked ? (d3max(times.map((_, ti) => visible.reduce((a, s) => a + (s.points[ti]?.v ?? 0), 0))) ?? 0) : (d3max(flatValues) ?? 0);\n const axis = scaleLinear()\n .domain([0, Math.max(top, threshold?.value ?? 0) * 1.08 || 1])\n .nice(4)\n .range([h, 0]);\n const tween = useTweenedScale(flatValues, axis.domain()[1] ?? 1, !!state.loading);\n const values = useMemo(() => {\n let k = 0;\n return visible.map((s) => s.points.map(() => tween.values[k++] ?? 0));\n }, [visible, tween.values]);\n const yScale = axis.copy().domain([0, tween.top || 1]);\n const t0 = d3min(times) ?? new Date();\n const t1 = d3max(times) ?? new Date();\n const x = scaleLinear().domain([t0.getTime(), t1.getTime()]).range([0, w]);\n const stackData = stacked\n ? d3stack<number[]>().keys(visible.map((_, i) => String(i)))(times.map((_, ti) => visible.map((_, si) => values[si]?.[ti] ?? 0)))\n : null;\n const y = (v: number) => Math.max(0, yScale(v));\n const yTicks = (state.loading ? axis.ticks(4) : wholeTicks(readableTicks(axis, axisLabel), flatValues)).filter((t) => t <= (tween.top || 1) + 1e-9);\n const xTicks = timeTicks(t0, t1, Math.max(2, Math.min(8, Math.floor(w / 96))));\n const span = (times[times.length - 1]?.getTime() ?? 0) - (times[0]?.getTime() ?? 0);\n const fmt = tickFormat(locale, span);\n const step = (times[1]?.getTime() ?? 0) - (times[0]?.getTime() ?? 0);\n const headingFormat =\n formatTime ??\n timeFormat(\n locale,\n step && step < 86_400_000 ? { weekday: \"short\", ...DAY, ...CLOCK } : span <= 90 * 86_400_000 ? { weekday: \"short\", ...DAY } : { ...DAY, year: \"numeric\" },\n );\n const lineGen = d3line<number>()\n .x((_, i) => Math.round(x(times[i] ?? new Date())))\n .y((v) => y(v))\n .curve(curveMonotoneX);\n const areaGen = d3area<number>()\n .x((_, i) => Math.round(x(times[i] ?? new Date())))\n .y0(h)\n .y1((v) => y(v))\n .curve(curveMonotoneX);\n const stackArea = d3area<[number, number]>()\n .x((_, i) => Math.round(x(times[i] ?? new Date())))\n .y0((d) => y(d[0]))\n .y1((d) => y(d[1]))\n .curve(curveMonotoneX);\n\n const stackTop = d3line<[number, number]>()\n .x((_, i) => Math.round(x(times[i] ?? new Date())))\n .y((d) => y(d[1]))\n .curve(curveMonotoneX);\n const palette = useMemo(() => seriesColors(series.map((s) => s.id)), [series]);\n const color = (s: TimeSeries) => s.color ?? palette.get(s.id)!;\n const bis = bisector((d: Date) => d.getTime()).center;\n const onMove = (e: React.PointerEvent<SVGRectElement>) => {\n const r = e.currentTarget.getBoundingClientRect();\n const i = bis(times, x.invert(e.clientX - r.left));\n setHover({ i, y: Math.round(e.clientY - r.top + M.top) });\n };\n\n const table = {\n columns: [t(\"timeseriesChart.time\", \"Time\"), ...series.map((s) => s.label)],\n rows: times.map((t, i) => [(formatTime ?? fmt)(t), ...series.map((s) => formatValue(s.points[i]?.v ?? 0))]),\n };\n\n const empty = state.empty ?? series.every((s) => s.points.every((p) => p.v === 0));\n const blank = !!state.loading || empty;\n const keys = useChartKeys(blank || state.error ? 0 : times.length);\n const active = blank || !!state.error ? null : (hover?.i ?? keys.index ?? (highlight !== undefined && highlight < times.length ? highlight : null));\n const activeX = active === null ? 0 : Math.round(x(times[active]!)) + M.left;\n const activeY =\n active === null\n ? 0\n : hover && hover.i === active\n ? hover.y\n : M.top + Math.round(y(stacked ? (stackData?.[stackData.length - 1]?.[active]?.[1] ?? 0) : Math.max(0, ...values.map((sv) => sv[active] ?? 0))));\n const rowsFor = (i: number) =>\n visible.map((s) => {\n const v = s.points[i]?.v ?? 0;\n const total = visible.reduce((acc, ss) => acc + (ss.points[i]?.v ?? 0), 0);\n return {\n id: s.id,\n label: s.label,\n color: color(s),\n value: formatValue(v),\n ...(visible.length > 1 && total ? { share: formatPercent(Math.round((v / total) * 100) / 100, 0) } : {}),\n } as { id: string; label: ReactNode; color: string; value: ReactNode; share?: ReactNode | undefined };\n });\n\n return (\n <div ref={ref} className={cn(\"min-w-0\", className)}>\n <ChartFrame\n label={ariaLabel}\n height={height}\n table={table}\n state={{ ...state, empty }}\n legend={\n !hideLegend && series.length > 1 ? (\n <Legend\n items={series.map((s) => ({ id: s.id, label: s.label, color: color(s) }))}\n hidden={hidden}\n shape={kind === \"line\" ? \"line\" : \"square\"}\n onToggle={(id) => {\n const n = new Set(hidden);\n if (n.has(id)) n.delete(id);\n else n.add(id);\n setHidden(n);\n }}\n onHover={setFocus}\n />\n ) : undefined\n }\n >\n <div ref={box} role=\"group\" aria-label={ariaLabel} {...keys.props} className=\"absolute inset-0 rounded-cell focus-ring\">\n {size.width > 0 && (\n <svg width={size.width} height={height} className=\"block overflow-visible\" role=\"presentation\">\n <defs>\n {visible.map((s) => (\n <linearGradient key={s.id} id={`${gid}-${s.id}`} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop offset=\"0%\" stopColor={color(s)} className=\"chart-fill-top\" />\n <stop offset=\"100%\" stopColor={color(s)} stopOpacity={0} />\n </linearGradient>\n ))}\n </defs>\n <g transform={`translate(${M.left},${M.top})`}>\n {yTicks.map((t) => (\n <g key={t} transform={`translate(0,${Math.round(y(t)) + 0.5})`}>\n {t !== 0 && <line x2={w} {...AXIS.grid} />}\n {!state.loading && (\n <text x={w + 12} dy=\"0.32em\" {...AXIS.label}>\n {axisLabel(t)}\n </text>\n )}\n </g>\n ))}\n <line x2={w} y1={h + 0.5} y2={h + 0.5} {...AXIS.baseline} />\n {placeTimeLabels(\n xTicks.map((t) => ({ key: t.getTime(), at: Math.round(x(t)), label: fmt(t) })),\n w + M.right,\n ).map((l) => (\n <text key={l.key} x={l.x} y={h + 20} textAnchor={l.anchor} {...AXIS.label}>\n {l.label}\n </text>\n ))}\n {blank\n ? null\n : stacked && stackData\n ? stackData.map((layer, li) => {\n const s = visible[li]!;\n return (\n <g key={s.id} opacity={focus && focus !== s.id ? 0.3 : 1} className=\"opacity-motion\">\n <path d={stackArea(layer as unknown as [number, number][]) ?? \"\"} fill={color(s)} className=\"chart-stack-fill\" />\n <path\n d={stackTop(layer as unknown as [number, number][]) ?? \"\"}\n fill=\"none\"\n stroke={color(s)}\n strokeWidth={1.5}\n strokeLinejoin=\"round\"\n strokeLinecap=\"round\"\n />\n </g>\n );\n })\n : visible.map((s, si) => (\n <g key={s.id} opacity={focus && focus !== s.id ? 0.3 : 1} className=\"opacity-motion\">\n {kind === \"area\" && <path d={areaGen(values[si] ?? []) ?? \"\"} fill={`url(#${gid}-${s.id})`} />}\n <path\n d={lineGen(values[si] ?? []) ?? \"\"}\n fill=\"none\"\n stroke={color(s)}\n strokeWidth={2}\n strokeLinejoin=\"round\"\n strokeLinecap=\"round\"\n />\n </g>\n ))}\n {threshold && (\n <g transform={`translate(0,${Math.round(y(threshold.value)) + 0.5})`}>\n <line x2={w} stroke=\"var(--k-danger)\" strokeDasharray=\"4 4\" strokeWidth={1} />\n <text x={0} dy={-6} fill=\"var(--k-danger-text)\" fontSize={12} fontWeight={500}>\n {threshold.label}\n </text>\n </g>\n )}\n {active !== null && (\n <g aria-hidden>\n <line x1={activeX - M.left + 0.5} x2={activeX - M.left + 0.5} y2={h} {...AXIS.grid} stroke=\"var(--k-line-strong)\" />\n {!stacked &&\n visible.map((s, si) => (\n <circle\n key={s.id}\n cx={activeX - M.left}\n cy={y(values[si]?.[active] ?? 0)}\n r={4}\n fill={color(s)}\n stroke=\"var(--k-bg-panel)\"\n strokeWidth={2}\n />\n ))}\n </g>\n )}\n <rect width={w} height={h} fill=\"transparent\" onPointerMove={onMove} onPointerLeave={() => setHover(null)} />\n </g>\n </svg>\n )}\n {active !== null && times[active] && (\n <ChartTooltip x={activeX} y={activeY} width={size.width} visible heading={headingFormat(times[active]!)} rows={rowsFor(active)} />\n )}\n <ChartLive>\n {keys.index !== null && active !== null && times[keys.index] ? liveLine(headingFormat(times[keys.index]!), rowsFor(keys.index), t) : null}\n </ChartLive>\n </div>\n </ChartFrame>\n </div>\n );\n});\nif (process.env.NODE_ENV !== \"production\") TimeseriesChart.displayName = \"TimeseriesChart\";\n"],"mappings":";;;;;;;;;;;;AA2BA,IAAauB,IAAkC,EAC7C,MAAM;CACJ,MAAM,EAAE,SAAS,GAAG;CACpB,MAAM,EAAE,SAAS,GAAG;CACpB,SAAS,EAAE,SAAS,GAAG;AACzB,EACF,GACaC,IAA0C,EAAE,MAAM,OAAO,GA0BhEC,IAAI;CAAE,KAAK;CAAG,OAAO;CAAI,QAAQ;CAAI,MAAM;AAAE;AAEnD,SAASC,EAAW,GAAgB,GAA0D;CAC5F,IAAMC,IAAWC,EAAe,GAC1BC,IAAI,IAAI,KAAK,eAAeC,MAAW,OAAO,UAAUA,GAAQ;EAAE,GAAGC;EAAS,GAAIJ,IAAW,EAAE,YAAS,IAAI,CAAC;CAAG,CAAC;CACvH,QAAQ,MAAME,EAAE,OAAOG,CAAC;AAC1B;AACA,IAAMC,IAAQ;CAAE,MAAM;CAAW,QAAQ;CAAW,WAAW;AAAM,GAC/DC,IAAM;CAAE,OAAO;CAAS,KAAK;AAAU;AAE7C,SAASC,GAAW,GAAgB,GAAc;CAChD,IAAMC,IAAI;CACV,IAAIC,KAAQ,KAAKD,GAAG,OAAOV,EAAWI,GAAQG,CAAK;CACnD,IAAII,KAAQ,OAAUD,GAAG,OAAOV,EAAWI,GAAQI,CAAG;CACtD,IAAMI,IAAQZ,EAAWI,GAAQ,EAAE,OAAO,QAAQ,CAAC;CACnD,QAAQ,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EAAC,IAAI,KAC5H,CAAA;IACR;;EACK,CAAA;CACT,CAAA;AAET,CAAC;AACD,QAAA,IAAA,aAA6B,iBAAc,EAAgB,cAAc"}
@@ -13,7 +13,7 @@ import { t as d } from "../chunks/menu-DyVPwgfF.js";
13
13
  import { r as ie } from "../chunks/skeleton-kfuqdl1a.js";
14
14
  import { r as ae } from "../chunks/pagination-CCMxQ5pH.js";
15
15
  import { t as oe } from "../chunks/empty-DIbBpytW.js";
16
- import { i as f } from "../chunks/status-dot-CBoQpyL4.js";
16
+ import { i as f } from "../chunks/status-dot-BzMlYuMe.js";
17
17
  import { t as p } from "../chunks/avatar-D2nJNbtC.js";
18
18
  import { t as se } from "../chunks/scroll-parent-WXvzQcUo.js";
19
19
  import { t as ce } from "../chunks/tone-CWpsHPb6.js";
@@ -268,7 +268,7 @@ var K = { size: f.size }, q = { size: "md" }, J = (e) => String(e).padStart(2, "
268
268
  let t = z.current[e];
269
269
  t !== void 0 && K(e, t);
270
270
  },
271
- className: "w-20 flex-none bg-transparent text-center tabular text-fg outline-none"
271
+ className: "w-20 flex-none bg-transparent text-center tabular text-fg outline-none coarse:w-24"
272
272
  }), Y = /* @__PURE__ */ E(p, {
273
273
  ref: i,
274
274
  size: f,