@lincyaw/aegis-ui 0.7.0 → 0.8.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.
Files changed (104) hide show
  1. package/dist/components/ui/ChartLegend.cjs +2 -0
  2. package/dist/components/ui/ChartLegend.cjs.map +1 -0
  3. package/dist/components/ui/ChartLegend.d.ts +15 -0
  4. package/dist/components/ui/ChartLegend.js +36 -0
  5. package/dist/components/ui/ChartLegend.js.map +1 -0
  6. package/dist/components/ui/DataTable.cjs +1 -1
  7. package/dist/components/ui/DataTable.cjs.map +1 -1
  8. package/dist/components/ui/DataTable.d.ts +25 -1
  9. package/dist/components/ui/DataTable.js +305 -231
  10. package/dist/components/ui/DataTable.js.map +1 -1
  11. package/dist/components/ui/ParetoChart.cjs +1 -1
  12. package/dist/components/ui/ParetoChart.cjs.map +1 -1
  13. package/dist/components/ui/ParetoChart.d.ts +11 -4
  14. package/dist/components/ui/ParetoChart.js +150 -136
  15. package/dist/components/ui/ParetoChart.js.map +1 -1
  16. package/dist/components/ui/RankBar.cjs +1 -1
  17. package/dist/components/ui/RankBar.cjs.map +1 -1
  18. package/dist/components/ui/RankBar.d.ts +17 -2
  19. package/dist/components/ui/RankBar.js +46 -31
  20. package/dist/components/ui/RankBar.js.map +1 -1
  21. package/dist/components/ui/ReplayScrubber.cjs +2 -0
  22. package/dist/components/ui/ReplayScrubber.cjs.map +1 -0
  23. package/dist/components/ui/ReplayScrubber.d.ts +35 -0
  24. package/dist/components/ui/ReplayScrubber.js +119 -0
  25. package/dist/components/ui/ReplayScrubber.js.map +1 -0
  26. package/dist/components/ui/ReplayStepStrip.cjs +2 -0
  27. package/dist/components/ui/ReplayStepStrip.cjs.map +1 -0
  28. package/dist/components/ui/ReplayStepStrip.d.ts +33 -0
  29. package/dist/components/ui/ReplayStepStrip.js +119 -0
  30. package/dist/components/ui/ReplayStepStrip.js.map +1 -0
  31. package/dist/components/ui/ReplayTransport.cjs +2 -0
  32. package/dist/components/ui/ReplayTransport.cjs.map +1 -0
  33. package/dist/components/ui/ReplayTransport.d.ts +25 -0
  34. package/dist/components/ui/ReplayTransport.js +103 -0
  35. package/dist/components/ui/ReplayTransport.js.map +1 -0
  36. package/dist/components/ui/StackedBar.cjs +1 -1
  37. package/dist/components/ui/StackedBar.cjs.map +1 -1
  38. package/dist/components/ui/StackedBar.d.ts +9 -8
  39. package/dist/components/ui/StackedBar.js +69 -54
  40. package/dist/components/ui/StackedBar.js.map +1 -1
  41. package/dist/components/ui/TimelineChart.cjs +1 -1
  42. package/dist/components/ui/TimelineChart.cjs.map +1 -1
  43. package/dist/components/ui/TimelineChart.d.ts +12 -15
  44. package/dist/components/ui/TimelineChart.js +160 -150
  45. package/dist/components/ui/TimelineChart.js.map +1 -1
  46. package/dist/components/ui/TraceSpanInspector.cjs +1 -1
  47. package/dist/components/ui/TraceSpanInspector.cjs.map +1 -1
  48. package/dist/components/ui/TraceSpanInspector.js +25 -25
  49. package/dist/components/ui/TraceSpanInspector.js.map +1 -1
  50. package/dist/components/ui/TraceTree.cjs +1 -1
  51. package/dist/components/ui/TraceTree.cjs.map +1 -1
  52. package/dist/components/ui/TraceTree.d.ts +13 -2
  53. package/dist/components/ui/TraceTree.js +22 -22
  54. package/dist/components/ui/TraceTree.js.map +1 -1
  55. package/dist/components/ui/index.d.ts +11 -5
  56. package/dist/components/ui/traceFormat.cjs +1 -1
  57. package/dist/components/ui/traceFormat.cjs.map +1 -1
  58. package/dist/components/ui/traceFormat.d.ts +0 -2
  59. package/dist/components/ui/traceFormat.js +2 -6
  60. package/dist/components/ui/traceFormat.js.map +1 -1
  61. package/dist/hooks/index.d.ts +2 -0
  62. package/dist/hooks/useReplayPlayback.cjs +2 -0
  63. package/dist/hooks/useReplayPlayback.cjs.map +1 -0
  64. package/dist/hooks/useReplayPlayback.d.ts +44 -0
  65. package/dist/hooks/useReplayPlayback.js +73 -0
  66. package/dist/hooks/useReplayPlayback.js.map +1 -0
  67. package/dist/index.cjs +1 -1
  68. package/dist/index.d.ts +4 -2
  69. package/dist/index.js +312 -300
  70. package/dist/index.js.map +1 -1
  71. package/dist/layouts/SkipLink.cjs +2 -0
  72. package/dist/layouts/SkipLink.cjs.map +1 -0
  73. package/dist/layouts/SkipLink.d.ts +13 -0
  74. package/dist/layouts/SkipLink.js +21 -0
  75. package/dist/layouts/SkipLink.js.map +1 -0
  76. package/dist/layouts/shell/AegisShell.cjs +1 -1
  77. package/dist/layouts/shell/AegisShell.cjs.map +1 -1
  78. package/dist/layouts/shell/AegisShell.js +174 -193
  79. package/dist/layouts/shell/AegisShell.js.map +1 -1
  80. package/dist/layouts/site/SiteLayout.cjs +1 -1
  81. package/dist/layouts/site/SiteLayout.cjs.map +1 -1
  82. package/dist/layouts/site/SiteLayout.js +18 -28
  83. package/dist/layouts/site/SiteLayout.js.map +1 -1
  84. package/dist/layouts/site/SiteNav.cjs +1 -1
  85. package/dist/layouts/site/SiteNav.cjs.map +1 -1
  86. package/dist/layouts/site/SiteNav.js +50 -48
  87. package/dist/layouts/site/SiteNav.js.map +1 -1
  88. package/dist/lib/chart.cjs +2 -0
  89. package/dist/lib/chart.cjs.map +1 -0
  90. package/dist/lib/chart.d.ts +33 -0
  91. package/dist/lib/chart.js +47 -0
  92. package/dist/lib/chart.js.map +1 -0
  93. package/dist/locale/strings.cjs +1 -1
  94. package/dist/locale/strings.cjs.map +1 -1
  95. package/dist/locale/strings.d.ts +9 -8
  96. package/dist/locale/strings.js +36 -34
  97. package/dist/locale/strings.js.map +1 -1
  98. package/dist/style.css +1 -1
  99. package/package.json +1 -1
  100. package/dist/components/ui/SessionRunView.cjs +0 -4
  101. package/dist/components/ui/SessionRunView.cjs.map +0 -1
  102. package/dist/components/ui/SessionRunView.d.ts +0 -50
  103. package/dist/components/ui/SessionRunView.js +0 -379
  104. package/dist/components/ui/SessionRunView.js.map +0 -1
@@ -1,194 +1,249 @@
1
- import { jsxs as d, jsx as a, Fragment as Je } from "react/jsx-runtime";
2
- import { useId as Qe, useState as A, useRef as re, useEffect as Ve, useMemo as B, useCallback as qe, Fragment as Ye } from "react";
3
- import { RightOutlined as U, LeftOutlined as Ze } from "@ant-design/icons";
4
- import { usePrimitiveSurface as Ke } from "../../agent/core/usePrimitiveSurface.js";
5
- import { useIsomorphicLayoutEffect as et } from "../../hooks/useIsomorphicLayoutEffect.js";
6
- import { useMediaQuery as tt } from "../../hooks/useMediaQuery.js";
7
- import { readStorage as at, writeStorage as nt } from "../../lib/storage.js";
8
- import { Button as de } from "./Button.js";
9
- import { Checkbox as ce } from "./Checkbox.js";
1
+ import { jsxs as c, jsx as a, Fragment as at } from "react/jsx-runtime";
2
+ import { useId as nt, useState as $, useMemo as M, useRef as _e, useEffect as st, useCallback as it, Fragment as lt } from "react";
3
+ import { RightOutlined as X, LeftOutlined as ot } from "@ant-design/icons";
4
+ import { usePrimitiveSurface as rt } from "../../agent/core/usePrimitiveSurface.js";
5
+ import { useIsomorphicLayoutEffect as dt } from "../../hooks/useIsomorphicLayoutEffect.js";
6
+ import { useMediaQuery as ct } from "../../hooks/useMediaQuery.js";
7
+ import { readStorage as gt, writeStorage as _t } from "../../lib/storage.js";
8
+ import { Button as ue } from "./Button.js";
9
+ import { Checkbox as he } from "./Checkbox.js";
10
10
  /* empty css */
11
- import { EmptyState as st } from "./EmptyState.js";
12
- import { PageSizeSelect as it } from "./PageSizeSelect.js";
13
- import { SkeletonText as lt, Skeleton as ot } from "./Skeleton.js";
14
- import { useStrings as he } from "../../locale/useStrings.js";
15
- const rt = 60, dt = 120, T = 44, H = 32, ge = 40, ct = "(max-width: 768px)", gt = 'a, button, input, select, textarea, label, [role="button"], [role="link"], [role="checkbox"]';
16
- function _t(s) {
11
+ import { EmptyState as ut } from "./EmptyState.js";
12
+ import { PageSizeSelect as ht } from "./PageSizeSelect.js";
13
+ import { SkeletonText as mt, Skeleton as bt } from "./Skeleton.js";
14
+ import { useStrings as fe } from "../../locale/useStrings.js";
15
+ const ft = 60, pt = 120, O = 44, V = 32, me = 40, vt = "(max-width: 768px)", yt = 'a, button, input, select, textarea, label, [role="button"], [role="link"], [role="checkbox"]';
16
+ function Nt(s) {
17
17
  if (window.getSelection()?.type === "Range")
18
18
  return !0;
19
- const i = s.target;
20
- if (!(i instanceof Element))
19
+ const o = s.target;
20
+ if (!(o instanceof Element))
21
21
  return !1;
22
- const c = i.closest(gt);
23
- return c !== null && s.currentTarget.contains(c);
22
+ const g = o.closest(yt);
23
+ return g !== null && s.currentTarget.contains(g);
24
24
  }
25
- function ht(s) {
25
+ function wt(s, o, g) {
26
+ const f = o?.sortValue;
27
+ if (!f)
28
+ return s;
29
+ const v = g === "asc" ? 1 : -1;
30
+ return s.map((i, l) => {
31
+ const u = f(i);
32
+ return { row: i, index: l, v: typeof u == "number" && isNaN(u) ? null : u };
33
+ }).sort((i, l) => {
34
+ if (i.v === null || l.v === null)
35
+ return i.v === l.v ? i.index - l.index : i.v === null ? 1 : -1;
36
+ const u = typeof i.v == "number" && typeof l.v == "number" ? i.v - l.v : String(i.v).localeCompare(String(l.v));
37
+ return u === 0 ? i.index - l.index : u * v;
38
+ }).map((i) => i.row);
39
+ }
40
+ function kt({
41
+ direction: s
42
+ }) {
43
+ return /* @__PURE__ */ c(
44
+ "svg",
45
+ {
46
+ className: "aegis-data-table__sort-icon",
47
+ viewBox: "0 0 12 12",
48
+ "aria-hidden": "true",
49
+ children: [
50
+ /* @__PURE__ */ a(
51
+ "path",
52
+ {
53
+ className: s === "asc" ? "aegis-data-table__sort-mark--on" : void 0,
54
+ d: "M3.5 5L6 2.5 8.5 5"
55
+ }
56
+ ),
57
+ /* @__PURE__ */ a(
58
+ "path",
59
+ {
60
+ className: s === "desc" ? "aegis-data-table__sort-mark--on" : void 0,
61
+ d: "M3.5 7L6 9.5 8.5 7"
62
+ }
63
+ )
64
+ ]
65
+ }
66
+ );
67
+ }
68
+ function St(s) {
26
69
  if (s !== void 0)
27
70
  return typeof s == "number" ? `${s}px` : s;
28
71
  }
29
- function F(s) {
72
+ function q(s) {
30
73
  return `aegis-data-table:${s}`;
31
74
  }
32
- function _e(s) {
33
- const i = at(F(s));
34
- if (!i)
75
+ function be(s) {
76
+ const o = gt(q(s));
77
+ if (!o)
35
78
  return {};
36
79
  try {
37
- const c = JSON.parse(i);
38
- return c && typeof c == "object" ? c : {};
80
+ const g = JSON.parse(o);
81
+ return g && typeof g == "object" ? g : {};
39
82
  } catch {
40
83
  return {};
41
84
  }
42
85
  }
43
- function ut(s, i) {
44
- nt(F(s), JSON.stringify(i));
86
+ function Ct(s, o) {
87
+ _t(q(s), JSON.stringify(o));
45
88
  }
46
- function Tt({
89
+ function Bt({
47
90
  columns: s,
48
- data: i,
49
- rowKey: c,
50
- loading: v = !1,
51
- emptyTitle: N = "No data",
52
- emptyDescription: u,
53
- emptyAction: m,
54
- className: S,
55
- framed: x = !0,
56
- persistKey: r,
57
- pagination: k,
58
- selectable: g = !1,
59
- selectedKeys: $,
60
- onSelectedKeysChange: X,
61
- renderExpanded: G,
62
- expandedKeys: J,
63
- defaultExpandedKeys: ue,
64
- onExpandedKeysChange: me,
65
- renderMobileCard: Q,
66
- onRowClick: O,
67
- stickyFirstColumn: be = !1,
68
- stale: V = !1,
69
- surface: fe
91
+ data: o,
92
+ rowKey: g,
93
+ loading: f = !1,
94
+ emptyTitle: v = "No data",
95
+ emptyDescription: i,
96
+ emptyAction: l,
97
+ className: u,
98
+ framed: L = !0,
99
+ persistKey: _,
100
+ pagination: C,
101
+ selectable: h = !1,
102
+ selectedKeys: W,
103
+ onSelectedKeysChange: G,
104
+ renderExpanded: J,
105
+ expandedKeys: Q,
106
+ defaultExpandedKeys: pe,
107
+ onExpandedKeysChange: ve,
108
+ renderMobileCard: Y,
109
+ onRowClick: D,
110
+ stickyFirstColumn: ye = !1,
111
+ stale: Z = !1,
112
+ sort: I,
113
+ defaultSort: Ne,
114
+ onSortChange: we,
115
+ surface: ke
70
116
  }) {
71
- const E = he(), pe = tt(ct), ve = Qe(), b = Q !== void 0 && pe, C = $ ?? [], y = i.map((e, t) => c(e, t)), W = y.filter((e) => C.includes(e)).length, Ne = (e, t) => {
72
- X?.(
73
- t ? [...C, e] : C.filter((n) => n !== e)
117
+ const E = fe(), Se = ct(vt), Ce = nt(), y = Y !== void 0 && Se, [xe, Le] = $(Ne ?? null), p = I === void 0 ? xe : I, K = s.find((e) => e.key === p?.key), P = M(
118
+ () => wt(o, K, p?.direction ?? "asc"),
119
+ [o, K, p?.direction]
120
+ ), Ee = (e) => {
121
+ const t = e.firstSortDirection ?? (e.numeric ? "desc" : "asc"), n = {
122
+ key: e.key,
123
+ direction: p?.key === e.key ? p.direction === "asc" ? "desc" : "asc" : t
124
+ };
125
+ I === void 0 && Le(n), we?.(n);
126
+ }, x = W ?? [], k = P.map((e, t) => g(e, t)), j = k.filter((e) => x.includes(e)).length, Re = (e, t) => {
127
+ G?.(
128
+ t ? [...x, e] : x.filter((n) => n !== e)
74
129
  );
75
- }, ye = (e) => {
76
- const t = C.filter((n) => !y.includes(n));
77
- X?.(e ? [...t, ...y] : t);
78
- }, we = (e, t) => /* @__PURE__ */ a(
79
- ce,
130
+ }, Te = (e) => {
131
+ const t = x.filter((n) => !k.includes(n));
132
+ G?.(e ? [...t, ...k] : t);
133
+ }, $e = (e, t) => /* @__PURE__ */ a(
134
+ he,
80
135
  {
81
136
  checked: e,
82
137
  onChange: t,
83
138
  ariaLabel: E.selectRow
84
139
  }
85
- ), [Se, ke] = A(ue ?? []), p = J ?? Se, [M, Ce] = A(p), q = p.filter((e) => !M.includes(e));
86
- q.length > 0 && Ce([...M, ...q]);
87
- const xe = (e) => {
88
- const t = p.includes(e) ? p.filter((n) => n !== e) : [...p, e];
89
- J === void 0 && ke(t), me?.(t);
90
- }, Y = re(null), Z = re(null), Ee = Ke(fe, i, "table", Z), [_, K] = A(
91
- () => r ? _e(r) : {}
140
+ ), [Me, Oe] = $(pe ?? []), w = Q ?? Me, [z, We] = $(w), ee = w.filter((e) => !z.includes(e));
141
+ ee.length > 0 && We([...z, ...ee]);
142
+ const De = (e) => {
143
+ const t = w.includes(e) ? w.filter((n) => n !== e) : [...w, e];
144
+ Q === void 0 && Oe(t), ve?.(t);
145
+ }, te = _e(null), ae = _e(null), Ie = rt(ke, o, "table", ae), [m, ne] = $(
146
+ () => _ ? be(_) : {}
92
147
  );
93
- Ve(() => {
94
- r && ut(r, _);
95
- }, [r, _]);
96
- const D = B(
148
+ st(() => {
149
+ _ && Ct(_, m);
150
+ }, [_, m]);
151
+ const A = M(
97
152
  () => s.some(
98
- (e) => e.width !== void 0 || e.resizable === !0 || e.key in _
153
+ (e) => e.width !== void 0 || e.resizable === !0 || e.key in m
99
154
  ),
100
- [s, _]
101
- ), ee = B(
102
- () => s.map((e) => e.key in _ ? `${_[e.key]}px` : ht(e.width)),
103
- [s, _]
104
- ), f = G !== void 0, h = O !== void 0, I = (g ? T : 0) + (f ? H : 0), te = h ? ge : 0, ae = B(() => D ? `${s.reduce((t, n) => {
105
- const l = n.key in _ ? _[n.key] : typeof n.width == "number" ? n.width : void 0;
106
- return t + (l ?? n.minWidth ?? dt);
107
- }, I + te).toString()}px` : void 0, [s, _, D, I, te]), Le = qe(
155
+ [s, m]
156
+ ), se = M(
157
+ () => s.map((e) => e.key in m ? `${m[e.key]}px` : St(e.width)),
158
+ [s, m]
159
+ ), N = J !== void 0, b = D !== void 0, B = (h ? O : 0) + (N ? V : 0), ie = b ? me : 0, le = M(() => A ? `${s.reduce((t, n) => {
160
+ const r = n.key in m ? m[n.key] : typeof n.width == "number" ? n.width : void 0;
161
+ return t + (r ?? n.minWidth ?? pt);
162
+ }, B + ie).toString()}px` : void 0, [s, m, A, B, ie]), Pe = it(
108
163
  (e, t) => (n) => {
109
164
  if (n.button !== 0)
110
165
  return;
111
166
  n.preventDefault(), n.stopPropagation();
112
- const l = Y.current;
113
- if (!l)
167
+ const r = te.current;
168
+ if (!r)
114
169
  return;
115
- const o = l.querySelectorAll("thead th")[t];
116
- if (!(o instanceof HTMLElement))
170
+ const d = r.querySelectorAll("thead th")[t];
171
+ if (!(d instanceof HTMLElement))
117
172
  return;
118
- const R = n.clientX, Be = o.getBoundingClientRect().width, He = e.minWidth ?? rt, Ue = e.maxWidth ?? 1 / 0;
173
+ const T = n.clientX, Qe = d.getBoundingClientRect().width, Ye = e.minWidth ?? ft, Ze = e.maxWidth ?? 1 / 0;
119
174
  document.body.style.cursor = "col-resize", document.body.style.userSelect = "none";
120
- const le = (Fe) => {
121
- const Xe = Math.min(
122
- Math.max(Be + (Fe.clientX - R), He),
123
- Ue
175
+ const ce = (Ke) => {
176
+ const et = Math.min(
177
+ Math.max(Qe + (Ke.clientX - T), Ye),
178
+ Ze
124
179
  );
125
- K((Ge) => ({ ...Ge, [e.key]: Math.round(Xe) }));
126
- }, oe = () => {
127
- document.body.style.cursor = "", document.body.style.userSelect = "", window.removeEventListener("pointermove", le), window.removeEventListener("pointerup", oe);
180
+ ne((tt) => ({ ...tt, [e.key]: Math.round(et) }));
181
+ }, ge = () => {
182
+ document.body.style.cursor = "", document.body.style.userSelect = "", window.removeEventListener("pointermove", ce), window.removeEventListener("pointerup", ge);
128
183
  };
129
- window.addEventListener("pointermove", le), window.addEventListener("pointerup", oe);
184
+ window.addEventListener("pointermove", ce), window.addEventListener("pointerup", ge);
130
185
  },
131
186
  []
132
187
  );
133
- et(() => {
134
- if (!r || typeof window > "u")
188
+ dt(() => {
189
+ if (!_ || typeof window > "u")
135
190
  return;
136
191
  const e = (t) => {
137
- t.key === F(r) && K(_e(r));
192
+ t.key === q(_) && ne(be(_));
138
193
  };
139
194
  return window.addEventListener("storage", e), () => window.removeEventListener("storage", e);
140
- }, [r]);
141
- const Re = [
195
+ }, [_]);
196
+ const je = [
142
197
  "aegis-data-table",
143
- x ? "aegis-data-table--framed" : "",
144
- V ? "aegis-data-table--stale" : "",
145
- S ?? ""
146
- ].filter(Boolean).join(" "), P = D && !b, L = be && !b, ne = (b ? 1 : s.length) + (h ? 1 : 0), Te = ne + (g ? 1 : 0) + (f ? 1 : 0), $e = g ? T : 0, w = (e, t) => ({
198
+ L ? "aegis-data-table--framed" : "",
199
+ Z ? "aegis-data-table--stale" : "",
200
+ u ?? ""
201
+ ].filter(Boolean).join(" "), H = A && !y, R = ye && !y, oe = (y ? 1 : s.length) + (b ? 1 : 0), ze = oe + (h ? 1 : 0) + (N ? 1 : 0), Ae = h ? O : 0, S = (e, t) => ({
147
202
  className: [
148
203
  `aegis-data-table__${t}`,
149
204
  `aegis-data-table__${e}-cell`,
150
- L ? `aegis-data-table__${t}--sticky` : ""
205
+ R ? `aegis-data-table__${t}--sticky` : ""
151
206
  ].filter(Boolean).join(" "),
152
207
  style: {
153
- width: e === "select" ? T : H,
154
- left: L ? e === "select" ? 0 : $e : void 0
208
+ width: e === "select" ? O : V,
209
+ left: R ? e === "select" ? 0 : Ae : void 0
155
210
  }
156
- }), j = (e, t, n) => {
157
- const l = `aegis-data-table__${e}`, o = [l];
158
- return L && t === 0 && o.push(`${l}--sticky`), n !== void 0 && (o.push(
211
+ }), U = (e, t, n) => {
212
+ const r = `aegis-data-table__${e}`, d = [r];
213
+ return R && t === 0 && d.push(`${r}--sticky`), n !== void 0 && (d.push(
159
214
  "aegis-data-table__td--tone",
160
215
  `aegis-data-table__td--tone-${n.tone}`
161
- ), n.step !== void 0 && n.step > 1 && o.push(`aegis-data-table__td--step-${String(n.step)}`)), o.join(" ");
162
- }, se = (e) => e.kind === "actions" || e.numeric === !0 ? "right" : e.align ?? "left", z = (e, t) => ({
163
- textAlign: se(e),
164
- left: L && t === 0 ? I : void 0
165
- }), ie = (e, t) => {
216
+ ), n.step !== void 0 && n.step > 1 && d.push(`aegis-data-table__td--step-${String(n.step)}`)), d.join(" ");
217
+ }, re = (e) => e.kind === "actions" || e.numeric === !0 ? "right" : e.align ?? "left", F = (e, t) => ({
218
+ textAlign: re(e),
219
+ left: R && t === 0 ? B : void 0
220
+ }), de = (e, t) => {
166
221
  const n = [
167
222
  "aegis-data-table__cell",
168
- `aegis-data-table__cell--${se(e)}`
223
+ `aegis-data-table__cell--${re(e)}`
169
224
  ];
170
225
  return e.numeric && n.push("aegis-data-table__cell--numeric"), e.kind === "actions" ? n.push("aegis-data-table__cell--actions") : (e.truncate ?? !0) && n.push("aegis-data-table__cell--truncate"), /* @__PURE__ */ a("div", { className: n.join(" "), children: t });
171
- }, Oe = (e, t) => b ? /* @__PURE__ */ a("td", { className: "aegis-data-table__td aegis-data-table__card-cell", children: Q(e, t) }) : s.map((n, l) => /* @__PURE__ */ a(
226
+ }, Be = (e, t) => y ? /* @__PURE__ */ a("td", { className: "aegis-data-table__td aegis-data-table__card-cell", children: Y(e, t) }) : s.map((n, r) => /* @__PURE__ */ a(
172
227
  "td",
173
228
  {
174
- className: j("td", l, n.cellTone?.(e, t)),
175
- style: z(n, l),
176
- children: ie(n, n.render(e, t))
229
+ className: U("td", r, n.cellTone?.(e, t)),
230
+ style: F(n, r),
231
+ children: de(n, n.render(e, t))
177
232
  },
178
233
  n.key
179
- )), We = () => b ? /* @__PURE__ */ a("td", { className: "aegis-data-table__td aegis-data-table__card-cell", children: /* @__PURE__ */ a(lt, { lines: 2 }) }) : s.map((e, t) => /* @__PURE__ */ a(
234
+ )), He = () => y ? /* @__PURE__ */ a("td", { className: "aegis-data-table__td aegis-data-table__card-cell", children: /* @__PURE__ */ a(mt, { lines: 2 }) }) : s.map((e, t) => /* @__PURE__ */ a(
180
235
  "td",
181
236
  {
182
- className: j("td", t),
183
- style: z(e, t),
184
- children: ie(
237
+ className: U("td", t),
238
+ style: F(e, t),
239
+ children: de(
185
240
  e,
186
- /* @__PURE__ */ a(ot, { width: "80%", height: "var(--space-3)" })
241
+ /* @__PURE__ */ a(bt, { width: "80%", height: "var(--space-3)" })
187
242
  )
188
243
  },
189
244
  e.key
190
- )), Me = h && /* @__PURE__ */ a("td", { className: "aegis-data-table__td aegis-data-table__chevron-cell", children: /* @__PURE__ */ a(U, { className: "aegis-data-table__chevron", "aria-hidden": !0 }) }), De = (e, t) => {
191
- const n = p.includes(e);
245
+ )), Ue = b && /* @__PURE__ */ a("td", { className: "aegis-data-table__td aegis-data-table__chevron-cell", children: /* @__PURE__ */ a(X, { className: "aegis-data-table__chevron", "aria-hidden": !0 }) }), Fe = (e, t) => {
246
+ const n = w.includes(e);
192
247
  return /* @__PURE__ */ a(
193
248
  "button",
194
249
  {
@@ -198,90 +253,109 @@ function Tt({
198
253
  "aria-controls": t,
199
254
  "aria-label": n ? E.collapseRow : E.expandRow,
200
255
  onClick: () => {
201
- xe(e);
256
+ De(e);
202
257
  },
203
- children: /* @__PURE__ */ a(U, { className: "aegis-data-table__toggle-icon", "aria-hidden": !0 })
258
+ children: /* @__PURE__ */ a(X, { className: "aegis-data-table__toggle-icon", "aria-hidden": !0 })
204
259
  }
205
260
  );
206
- }, Ie = (e, t, n, l, o) => {
207
- const R = p.includes(n);
208
- return /* @__PURE__ */ d(
261
+ }, Ve = (e, t, n, r, d) => {
262
+ const T = w.includes(n);
263
+ return /* @__PURE__ */ c(
209
264
  "tr",
210
265
  {
211
- className: R ? "aegis-data-table__detail-row aegis-data-table__detail-row--open" : "aegis-data-table__detail-row",
266
+ className: T ? "aegis-data-table__detail-row aegis-data-table__detail-row--open" : "aegis-data-table__detail-row",
212
267
  children: [
213
- g && /* @__PURE__ */ a("td", { className: "aegis-data-table__detail-cell" }),
268
+ h && /* @__PURE__ */ a("td", { className: "aegis-data-table__detail-cell" }),
214
269
  /* @__PURE__ */ a("td", { className: "aegis-data-table__detail-cell" }),
215
270
  /* @__PURE__ */ a(
216
271
  "td",
217
272
  {
218
- id: l,
219
- colSpan: ne,
273
+ id: r,
274
+ colSpan: oe,
220
275
  className: "aegis-data-table__detail-cell",
221
- children: /* @__PURE__ */ a("div", { className: "aegis-data-table__detail", children: /* @__PURE__ */ a("div", { className: "aegis-data-table__detail-clip", children: /* @__PURE__ */ a("div", { className: "aegis-data-table__detail-body", children: (R || M.includes(n)) && o(e, t) }) }) })
276
+ children: /* @__PURE__ */ a("div", { className: "aegis-data-table__detail", children: /* @__PURE__ */ a("div", { className: "aegis-data-table__detail-clip", children: /* @__PURE__ */ a("div", { className: "aegis-data-table__detail-body", children: (T || z.includes(n)) && d(e, t) }) }) })
222
277
  }
223
278
  )
224
279
  ]
225
280
  }
226
281
  );
227
- }, Pe = (e, t, n) => {
228
- _t(e) || O?.(t, n);
229
- }, je = (e, t, n) => {
230
- e.key === "Enter" && e.target === e.currentTarget && (e.preventDefault(), O?.(t, n));
231
- }, ze = [
282
+ }, Xe = (e, t, n) => {
283
+ Nt(e) || D?.(t, n);
284
+ }, qe = (e, t, n) => {
285
+ e.key === "Enter" && e.target === e.currentTarget && (e.preventDefault(), D?.(t, n));
286
+ }, Ge = [
232
287
  "aegis-data-table__row",
233
- h ? "aegis-data-table__row--clickable" : "",
234
- f ? "aegis-data-table__row--expandable" : ""
235
- ].filter(Boolean).join(" "), Ae = [
288
+ b ? "aegis-data-table__row--clickable" : "",
289
+ N ? "aegis-data-table__row--expandable" : ""
290
+ ].filter(Boolean).join(" "), Je = [
236
291
  "aegis-data-table__table",
237
- P ? "aegis-data-table__table--fixed" : "",
238
- b ? "aegis-data-table__table--cards" : ""
292
+ H ? "aegis-data-table__table--fixed" : "",
293
+ y ? "aegis-data-table__table--cards" : ""
239
294
  ].filter(Boolean).join(" ");
240
- return /* @__PURE__ */ d(
295
+ return /* @__PURE__ */ c(
241
296
  "div",
242
297
  {
243
- ref: Z,
244
- className: Re,
245
- "aria-busy": V ? !0 : void 0,
246
- ...Ee,
298
+ ref: ae,
299
+ className: je,
300
+ "aria-busy": Z ? !0 : void 0,
301
+ ...Ie,
247
302
  children: [
248
- /* @__PURE__ */ a("div", { className: "aegis-data-table__scroll", children: /* @__PURE__ */ d(
303
+ /* @__PURE__ */ a("div", { className: "aegis-data-table__scroll", children: /* @__PURE__ */ c(
249
304
  "table",
250
305
  {
251
- ref: Y,
252
- className: Ae,
253
- style: ae && P ? { minWidth: ae } : void 0,
306
+ ref: te,
307
+ className: Je,
308
+ style: le && H ? { minWidth: le } : void 0,
254
309
  children: [
255
- P && /* @__PURE__ */ d("colgroup", { children: [
256
- g && /* @__PURE__ */ a("col", { style: { width: T } }, "__select"),
257
- f && /* @__PURE__ */ a("col", { style: { width: H } }, "__toggle"),
310
+ H && /* @__PURE__ */ c("colgroup", { children: [
311
+ h && /* @__PURE__ */ a("col", { style: { width: O } }, "__select"),
312
+ N && /* @__PURE__ */ a("col", { style: { width: V } }, "__toggle"),
258
313
  s.map((e, t) => /* @__PURE__ */ a(
259
314
  "col",
260
315
  {
261
- style: ee[t] ? { width: ee[t] } : void 0
316
+ style: se[t] ? { width: se[t] } : void 0
262
317
  },
263
318
  e.key
264
319
  )),
265
- h && /* @__PURE__ */ a("col", { style: { width: ge } }, "__chevron")
320
+ b && /* @__PURE__ */ a("col", { style: { width: me } }, "__chevron")
266
321
  ] }),
267
- (!b || g) && /* @__PURE__ */ a("thead", { children: /* @__PURE__ */ d("tr", { children: [
268
- g && /* @__PURE__ */ a("th", { ...w("select", "th"), children: /* @__PURE__ */ a("span", { className: "aegis-data-table__th-label", children: /* @__PURE__ */ a(
269
- ce,
322
+ (!y || h) && /* @__PURE__ */ a("thead", { children: /* @__PURE__ */ c("tr", { children: [
323
+ h && /* @__PURE__ */ a("th", { ...S("select", "th"), children: /* @__PURE__ */ a("span", { className: "aegis-data-table__th-label", children: /* @__PURE__ */ a(
324
+ he,
270
325
  {
271
- checked: y.length > 0 && W === y.length,
272
- indeterminate: W > 0 && W < y.length,
273
- onChange: ye,
326
+ checked: k.length > 0 && j === k.length,
327
+ indeterminate: j > 0 && j < k.length,
328
+ onChange: Te,
274
329
  ariaLabel: E.selectAllRows
275
330
  }
276
331
  ) }) }, "__select"),
277
- f && /* @__PURE__ */ a("th", { ...w("toggle", "th") }, "__toggle"),
278
- b ? /* @__PURE__ */ a("th", { className: "aegis-data-table__th" }) : s.map((e, t) => /* @__PURE__ */ d(
332
+ N && /* @__PURE__ */ a("th", { ...S("toggle", "th") }, "__toggle"),
333
+ y ? /* @__PURE__ */ a("th", { className: "aegis-data-table__th" }) : s.map((e, t) => /* @__PURE__ */ c(
279
334
  "th",
280
335
  {
281
- className: j("th", t),
282
- style: z(e, t),
336
+ className: U("th", t),
337
+ style: F(e, t),
338
+ "aria-sort": e.sortable ? p?.key === e.key ? p.direction === "asc" ? "ascending" : "descending" : "none" : void 0,
283
339
  children: [
284
- /* @__PURE__ */ a("span", { className: "aegis-data-table__th-label", children: e.header }),
340
+ e.sortable ? /* @__PURE__ */ c(
341
+ "button",
342
+ {
343
+ type: "button",
344
+ className: "aegis-data-table__sort",
345
+ onClick: () => {
346
+ Ee(e);
347
+ },
348
+ children: [
349
+ /* @__PURE__ */ a("span", { className: "aegis-data-table__th-label", children: e.header }),
350
+ /* @__PURE__ */ a(
351
+ kt,
352
+ {
353
+ direction: p?.key === e.key ? p.direction : null
354
+ }
355
+ )
356
+ ]
357
+ }
358
+ ) : /* @__PURE__ */ a("span", { className: "aegis-data-table__th-label", children: e.header }),
285
359
  e.resizable && /* @__PURE__ */ a(
286
360
  "span",
287
361
  {
@@ -289,131 +363,131 @@ function Tt({
289
363
  "aria-orientation": "vertical",
290
364
  "aria-label": "Resize column",
291
365
  className: "aegis-data-table__resizer",
292
- onPointerDown: Le(e, t)
366
+ onPointerDown: Pe(e, t)
293
367
  }
294
368
  )
295
369
  ]
296
370
  },
297
371
  e.key
298
372
  )),
299
- h && /* @__PURE__ */ a("th", { className: "aegis-data-table__th aegis-data-table__chevron-cell" })
373
+ b && /* @__PURE__ */ a("th", { className: "aegis-data-table__th aegis-data-table__chevron-cell" })
300
374
  ] }) }),
301
- /* @__PURE__ */ a("tbody", { children: v ? Array.from({ length: 5 }).map((e, t) => /* @__PURE__ */ d("tr", { className: "aegis-data-table__row", children: [
302
- g && /* @__PURE__ */ a("td", { ...w("select", "td") }, "__select"),
303
- f && /* @__PURE__ */ a("td", { ...w("toggle", "td") }, "__toggle"),
304
- We(),
305
- h && /* @__PURE__ */ a("td", { className: "aegis-data-table__td" })
306
- ] }, `sk-${t}`)) : i.length === 0 ? /* @__PURE__ */ a("tr", { children: /* @__PURE__ */ a(
375
+ /* @__PURE__ */ a("tbody", { children: f ? Array.from({ length: 5 }).map((e, t) => /* @__PURE__ */ c("tr", { className: "aegis-data-table__row", children: [
376
+ h && /* @__PURE__ */ a("td", { ...S("select", "td") }, "__select"),
377
+ N && /* @__PURE__ */ a("td", { ...S("toggle", "td") }, "__toggle"),
378
+ He(),
379
+ b && /* @__PURE__ */ a("td", { className: "aegis-data-table__td" })
380
+ ] }, `sk-${t}`)) : P.length === 0 ? /* @__PURE__ */ a("tr", { children: /* @__PURE__ */ a(
307
381
  "td",
308
382
  {
309
- colSpan: Te,
383
+ colSpan: ze,
310
384
  className: "aegis-data-table__empty-cell",
311
385
  children: /* @__PURE__ */ a("div", { className: "aegis-data-table__empty", children: /* @__PURE__ */ a(
312
- st,
386
+ ut,
313
387
  {
314
- title: N,
315
- description: u,
316
- action: m
388
+ title: v,
389
+ description: i,
390
+ action: l
317
391
  }
318
392
  ) })
319
393
  }
320
- ) }) : i.map((e, t) => {
321
- const n = c(e, t), l = `${ve}-detail-${String(t)}`;
322
- return /* @__PURE__ */ d(Ye, { children: [
323
- /* @__PURE__ */ d(
394
+ ) }) : P.map((e, t) => {
395
+ const n = g(e, t), r = `${Ce}-detail-${String(t)}`;
396
+ return /* @__PURE__ */ c(lt, { children: [
397
+ /* @__PURE__ */ c(
324
398
  "tr",
325
399
  {
326
- className: ze,
327
- tabIndex: h ? 0 : void 0,
328
- onClick: h ? (o) => {
329
- Pe(o, e, t);
400
+ className: Ge,
401
+ tabIndex: b ? 0 : void 0,
402
+ onClick: b ? (d) => {
403
+ Xe(d, e, t);
330
404
  } : void 0,
331
- onKeyDown: h ? (o) => {
332
- je(o, e, t);
405
+ onKeyDown: b ? (d) => {
406
+ qe(d, e, t);
333
407
  } : void 0,
334
408
  children: [
335
- g && /* @__PURE__ */ a("td", { ...w("select", "td"), children: we(C.includes(n), (o) => {
336
- Ne(n, o);
409
+ h && /* @__PURE__ */ a("td", { ...S("select", "td"), children: $e(x.includes(n), (d) => {
410
+ Re(n, d);
337
411
  }) }),
338
- f && /* @__PURE__ */ a("td", { ...w("toggle", "td"), children: De(n, l) }),
339
- Oe(e, t),
340
- Me
412
+ N && /* @__PURE__ */ a("td", { ...S("toggle", "td"), children: Fe(n, r) }),
413
+ Be(e, t),
414
+ Ue
341
415
  ]
342
416
  }
343
417
  ),
344
- f && Ie(e, t, n, l, G)
418
+ N && Ve(e, t, n, r, J)
345
419
  ] }, n);
346
420
  }) })
347
421
  ]
348
422
  }
349
423
  ) }),
350
- k && /* @__PURE__ */ a(
351
- mt,
424
+ C && /* @__PURE__ */ a(
425
+ xt,
352
426
  {
353
- pagination: k,
354
- rowCount: i.length,
355
- loading: v
427
+ pagination: C,
428
+ rowCount: o.length,
429
+ loading: f
356
430
  }
357
431
  )
358
432
  ]
359
433
  }
360
434
  );
361
435
  }
362
- function mt({
436
+ function xt({
363
437
  pagination: s,
364
- rowCount: i,
365
- loading: c
438
+ rowCount: o,
439
+ loading: g
366
440
  }) {
367
- const v = he(), { page: N, pageSize: u, total: m, onChange: S, pageSizeOptions: x } = s, r = (N - 1) * u, k = m === void 0 ? i : Math.max(0, Math.min(u, m - r)), g = m === void 0 ? i >= u : r + u < m;
368
- return /* @__PURE__ */ d("div", { className: "aegis-data-table__footer", children: [
369
- x && /* @__PURE__ */ a(
370
- it,
441
+ const f = fe(), { page: v, pageSize: i, total: l, onChange: u, pageSizeOptions: L } = s, _ = (v - 1) * i, C = l === void 0 ? o : Math.max(0, Math.min(i, l - _)), h = l === void 0 ? o >= i : _ + i < l;
442
+ return /* @__PURE__ */ c("div", { className: "aegis-data-table__footer", children: [
443
+ L && /* @__PURE__ */ a(
444
+ ht,
371
445
  {
372
- value: u,
373
- options: x,
374
- onChange: ($) => {
375
- S(1, $);
446
+ value: i,
447
+ options: L,
448
+ onChange: (W) => {
449
+ u(1, W);
376
450
  }
377
451
  }
378
452
  ),
379
- /* @__PURE__ */ d("div", { className: "aegis-data-table__pager", children: [
380
- /* @__PURE__ */ d("span", { className: "aegis-data-table__range", children: [
381
- /* @__PURE__ */ a("span", { className: "aegis-data-table__range-num", children: k > 0 ? `${(r + 1).toLocaleString()}–${(r + k).toLocaleString()}` : "0" }),
382
- m !== void 0 && /* @__PURE__ */ d(Je, { children: [
383
- v.rangeOf,
384
- /* @__PURE__ */ a("span", { className: "aegis-data-table__range-num", children: m.toLocaleString() })
453
+ /* @__PURE__ */ c("div", { className: "aegis-data-table__pager", children: [
454
+ /* @__PURE__ */ c("span", { className: "aegis-data-table__range", children: [
455
+ /* @__PURE__ */ a("span", { className: "aegis-data-table__range-num", children: C > 0 ? `${(_ + 1).toLocaleString()}–${(_ + C).toLocaleString()}` : "0" }),
456
+ l !== void 0 && /* @__PURE__ */ c(at, { children: [
457
+ f.rangeOf,
458
+ /* @__PURE__ */ a("span", { className: "aegis-data-table__range-num", children: l.toLocaleString() })
385
459
  ] })
386
460
  ] }),
387
461
  /* @__PURE__ */ a(
388
- de,
462
+ ue,
389
463
  {
390
464
  tone: "secondary",
391
465
  className: "aegis-data-table__page-btn",
392
- "aria-label": v.previousPage,
393
- disabled: c || N <= 1,
466
+ "aria-label": f.previousPage,
467
+ disabled: g || v <= 1,
394
468
  onClick: () => {
395
- S(N - 1, u);
469
+ u(v - 1, i);
396
470
  },
397
- children: /* @__PURE__ */ a(Ze, {})
471
+ children: /* @__PURE__ */ a(ot, {})
398
472
  }
399
473
  ),
400
474
  /* @__PURE__ */ a(
401
- de,
475
+ ue,
402
476
  {
403
477
  tone: "secondary",
404
478
  className: "aegis-data-table__page-btn",
405
- "aria-label": v.nextPage,
406
- disabled: c || !g,
479
+ "aria-label": f.nextPage,
480
+ disabled: g || !h,
407
481
  onClick: () => {
408
- S(N + 1, u);
482
+ u(v + 1, i);
409
483
  },
410
- children: /* @__PURE__ */ a(U, {})
484
+ children: /* @__PURE__ */ a(X, {})
411
485
  }
412
486
  )
413
487
  ] })
414
488
  ] });
415
489
  }
416
490
  export {
417
- Tt as DataTable
491
+ Bt as DataTable
418
492
  };
419
493
  //# sourceMappingURL=DataTable.js.map