@mechane-ai/elements 0.50.0 → 0.51.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/catalog.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "package": "@mechane-ai/elements",
3
- "version": "0.50.0",
3
+ "version": "0.51.0",
4
4
  "recipes": [
5
5
  {
6
6
  "slug": "allocation-report",
@@ -5636,10 +5636,22 @@
5636
5636
  "kind": "type",
5637
5637
  "declaration": "dist/packages/kits/src/research/collection-page.d.ts"
5638
5638
  },
5639
+ "CollectionSectionProps": {
5640
+ "kind": "type",
5641
+ "declaration": "dist/packages/kits/src/research/collection-page.d.ts"
5642
+ },
5643
+ "CollectionStatus": {
5644
+ "kind": "type",
5645
+ "declaration": "dist/packages/kits/src/research/collection-page.d.ts"
5646
+ },
5639
5647
  "CollectionPage": {
5640
5648
  "kind": "value",
5641
5649
  "declaration": "dist/packages/kits/src/research/collection-page.d.ts"
5642
5650
  },
5651
+ "CollectionSection": {
5652
+ "kind": "value",
5653
+ "declaration": "dist/packages/kits/src/research/collection-page.d.ts"
5654
+ },
5643
5655
  "FindingCardLabels": {
5644
5656
  "kind": "type",
5645
5657
  "declaration": "dist/packages/kits/src/research/finding-card.d.ts"
@@ -1,93 +1,159 @@
1
- import { f as e, g as t, h as n, m as r, n as i, o as a, u as o, y as s } from "../src-DNclWY4V.js";
2
- import { T as c, h as l, i as u, n as d } from "../src-DhWMspwr.js";
3
- import { r as f } from "../figure-format-B8kRZMlo.js";
4
- import { c as p, f as m, h, m as g, o as _, p as v, r as y, t as b, v as x } from "../src-9EJskqB_.js";
5
- import { n as S } from "../src-na2DdkKI.js";
6
- import { t as C } from "../tree-diagram-Dau9jeXS.js";
7
- import { m as w, p as T, s as E } from "../src-npqwq3Sa.js";
8
- import { f as D } from "../time-series-CsngFxr1.js";
9
- import { t as O } from "../src-DFW49IAs.js";
10
- import { u as k } from "../src-Dxs3Buo_.js";
1
+ import { d as e, f as t, g as n, h as r, m as i, n as a, o, u as s, y as c } from "../src-DNclWY4V.js";
2
+ import { c as l, f as u, h as d, l as f, m as p, o as m, p as h, r as g, t as _, v } from "../src-9EJskqB_.js";
3
+ import { m as y, p as b, s as x, t as S } from "../src-npqwq3Sa.js";
4
+ import { T as C, h as w, i as T, n as E } from "../src-DhWMspwr.js";
5
+ import { r as D } from "../figure-format-B8kRZMlo.js";
6
+ import { n as O } from "../src-na2DdkKI.js";
7
+ import { t as k } from "../tree-diagram-Dau9jeXS.js";
8
+ import { f as A } from "../time-series-CsngFxr1.js";
9
+ import { t as j } from "../src-DFW49IAs.js";
10
+ import { u as M } from "../src-Dxs3Buo_.js";
11
11
  import "@stylexjs/stylex";
12
- import { useEffect as A } from "react";
13
- import { Fragment as j, jsx as M, jsxs as N } from "react/jsx-runtime";
12
+ import { useEffect as N } from "react";
13
+ import { Fragment as P, jsx as F, jsxs as I } from "react/jsx-runtime";
14
14
  // packages/kits/src/research/collection-page.tsx
15
- var P = /* @__PURE__ */ new Set([
15
+ var L = /* @__PURE__ */ new Set([
16
16
  "INPUT",
17
17
  "TEXTAREA",
18
18
  "SELECT"
19
- ]);
20
- function F(e) {
21
- return e instanceof HTMLElement ? e.isContentEditable || P.has(e.tagName) : !1;
19
+ ]), R = 8;
20
+ function z(e) {
21
+ return e instanceof HTMLElement ? e.isContentEditable || L.has(e.tagName) : !1;
22
22
  }
23
- function I({ title: t, caption: i, rows: a, getRowId: f, columns: p, sort: m, onSortChange: h, search: g, filters: _, transformRows: v, navigation: y, actions: b, notice: x, rowAction: S, activeRowId: C, rowSizing: w, empty: T, filteredEmpty: E, inspector: D, inspectorInitialPercent: O = 40 }) {
24
- let k = n(a, {
23
+ function B({ title: n, caption: i, rows: a, getRowId: o, columns: c, sort: l, onSortChange: u, search: d, filters: f, transformRows: p, rowAction: m, activeRowId: h, rowSizing: g, empty: _, filteredEmpty: v, status: b = "ready", failure: x, placeholderRows: w = R, hasGlobalShortcuts: T }) {
24
+ let E = b === "loading", D = b === "failed", O = b === "ready", k = r(a, {
25
25
  mode: "local",
26
- search: g,
27
- filters: _
28
- }), { actions: P, chips: I, onKeyDown: L, openSearch: R } = e({
29
- label: `${t} controls`,
26
+ search: d,
27
+ filters: f
28
+ }), { actions: A, chips: j, onKeyDown: M, openSearch: P } = t({
29
+ label: `${n} controls`,
30
30
  ...k.search !== void 0 && { search: k.search },
31
31
  filters: k.filters,
32
- isReady: !0
33
- }), z = k.search !== void 0;
34
- A(() => {
35
- if (!z) return;
32
+ isPlaceholder: E,
33
+ isReady: O
34
+ }), L = T && O && k.search !== void 0;
35
+ N(() => {
36
+ if (!L) return;
36
37
  function e(e) {
37
- let t = e.key === "/" && !F(e.target), n = e.key.toLowerCase() === "f" && (e.metaKey || e.ctrlKey);
38
- (t || n) && (e.preventDefault(), R());
38
+ let t = e.key === "/" && !z(e.target), n = e.key.toLowerCase() === "f" && (e.metaKey || e.ctrlKey);
39
+ (t || n) && (e.preventDefault(), P());
39
40
  }
40
41
  return globalThis.addEventListener("keydown", e), () => globalThis.removeEventListener("keydown", e);
41
- }, [z, R]);
42
- let B = v === void 0 ? k.rows : v(k.rows), V = i ?? t, H = typeof g == "function", U = !("reason" in _), W = x != null, G = /* @__PURE__ */ N(j, { children: [y === void 0 && P, b] }), K = {
42
+ }, [L, P]);
43
+ let B = p === void 0 ? k.rows : p(k.rows), V = i ?? n, H = typeof d == "function", U = !("reason" in f), W = {
43
44
  caption: V,
44
45
  hideCaption: !0,
45
46
  rows: B,
46
- getRowId: f,
47
+ getRowId: o,
47
48
  query: { mode: "frame" },
48
- ...S !== void 0 && { rowAction: S },
49
- ...C !== void 0 && { activeRowId: C },
50
- ...w !== void 0 && { rowSizing: w },
51
- empty: T,
52
- ...E !== void 0 && { filteredEmpty: E }
53
- }, q = h === void 0 ? /* @__PURE__ */ M(o, {
54
- ...K,
55
- columns: p
56
- }) : /* @__PURE__ */ M(o, {
57
- ...K,
58
- columns: p,
59
- sort: m,
60
- onSortChange: h
61
- }), J = /* @__PURE__ */ M(d, {
62
- header: /* @__PURE__ */ N(j, { children: [W && /* @__PURE__ */ M(c, { children: x }), I !== !1 && /* @__PURE__ */ M(s, {
49
+ ...m !== void 0 && { rowAction: m },
50
+ ...h !== void 0 && { activeRowId: h },
51
+ ...g !== void 0 && { rowSizing: g },
52
+ empty: _,
53
+ ...v !== void 0 && { filteredEmpty: v }
54
+ }, G = u === void 0 ? /* @__PURE__ */ F(s, {
55
+ ...W,
56
+ columns: c
57
+ }) : /* @__PURE__ */ F(s, {
58
+ ...W,
59
+ columns: c,
60
+ sort: l,
61
+ onSortChange: u
62
+ }), K = /* @__PURE__ */ F(e, {
63
+ caption: V,
64
+ hideCaption: !0,
65
+ columns: c,
66
+ rows: w,
67
+ ...g !== void 0 && { rowSizing: g }
68
+ }), q = x ?? /* @__PURE__ */ F(C, { children: /* @__PURE__ */ I(y, {
69
+ hasError: !0,
70
+ children: [
71
+ "Could not load ",
72
+ n.toLowerCase(),
73
+ "."
74
+ ]
75
+ }) });
76
+ return {
77
+ controlActions: A,
78
+ chips: j,
79
+ onKeyDown: M,
80
+ content: E ? /* @__PURE__ */ F(S, {
81
+ state: "pending",
82
+ label: n,
83
+ placeholder: K
84
+ }) : /* @__PURE__ */ F(S, {
85
+ state: D ? "failed" : "ready",
86
+ label: n,
87
+ placeholder: K,
88
+ children: D ? q : G
89
+ }),
90
+ frameProps: {
91
+ search: H ? !0 : d,
92
+ filters: U ? !0 : f,
93
+ isFiltered: k.isFiltered
94
+ }
95
+ };
96
+ }
97
+ function V(e) {
98
+ let { title: t, navigation: n, actions: r, notice: a, inspector: o, inspectorInitialPercent: s = 40 } = e, { controlActions: l, chips: u, onKeyDown: d, content: f, frameProps: p } = B({
99
+ ...e,
100
+ hasGlobalShortcuts: !0
101
+ }), m = a != null, h = /* @__PURE__ */ I(P, { children: [n === void 0 && l, r] }), g = /* @__PURE__ */ F(E, {
102
+ header: /* @__PURE__ */ I(P, { children: [m && /* @__PURE__ */ F(C, { children: a }), u !== !1 && /* @__PURE__ */ F(c, {
63
103
  label: "Applied filters",
64
- children: I
104
+ children: u
65
105
  })] }),
66
- children: q
106
+ children: f
67
107
  });
68
- return /* @__PURE__ */ M(r, {
69
- search: H ? !0 : g,
70
- filters: U ? !0 : _,
71
- isFiltered: k.isFiltered,
72
- children: /* @__PURE__ */ M("section", {
108
+ return /* @__PURE__ */ F(i, {
109
+ ...p,
110
+ children: /* @__PURE__ */ F("section", {
73
111
  className: "x12lumcd xeuugli x2lwn1j x78zum5 xdt5ytf",
74
- onKeyDown: L,
75
- children: /* @__PURE__ */ M(l, {
112
+ onKeyDown: d,
113
+ children: /* @__PURE__ */ F(w, {
76
114
  title: t,
77
- actions: G,
78
- navigation: y,
79
- children: D === void 0 ? J : /* @__PURE__ */ M(u, {
115
+ actions: h,
116
+ navigation: n,
117
+ children: o === void 0 ? g : /* @__PURE__ */ F(T, {
80
118
  isResizable: !0,
81
- inspectorInitialPercent: O,
82
- inspector: D,
83
- children: J
119
+ inspectorInitialPercent: s,
120
+ inspector: o,
121
+ children: g
84
122
  })
85
123
  })
86
124
  })
87
125
  });
88
126
  }
127
+ function H(e) {
128
+ let { id: t, title: n, meta: r, actions: a, notice: o } = e, { controlActions: s, chips: l, onKeyDown: u, content: d, frameProps: p } = B({
129
+ ...e,
130
+ hasGlobalShortcuts: !1
131
+ }), m = o != null;
132
+ return /* @__PURE__ */ F(i, {
133
+ ...p,
134
+ children: /* @__PURE__ */ I("section", {
135
+ "aria-label": n,
136
+ className: "xeuugli x78zum5 xdt5ytf",
137
+ onKeyDown: u,
138
+ children: [
139
+ /* @__PURE__ */ F(f, {
140
+ ...t !== void 0 && { id: t },
141
+ title: n,
142
+ meta: r,
143
+ actions: /* @__PURE__ */ I(P, { children: [s, a] })
144
+ }),
145
+ m && /* @__PURE__ */ F(C, { children: o }),
146
+ l !== !1 && /* @__PURE__ */ F(c, {
147
+ label: "Applied filters",
148
+ children: l
149
+ }),
150
+ d
151
+ ]
152
+ })
153
+ });
154
+ }
89
155
  // packages/kits/src/research/finding-card.tsx
90
- var L = {
156
+ var U = {
91
157
  limitation: "Limitation",
92
158
  details: "Full notes & evidence",
93
159
  sources: "Sources",
@@ -97,100 +163,100 @@ var L = {
97
163
  falsified: "Falsified",
98
164
  open: "Open"
99
165
  }
100
- }, R = {
166
+ }, W = {
101
167
  supported: "positive",
102
168
  mixed: "warning",
103
169
  falsified: "negative",
104
170
  open: "neutral"
105
171
  };
106
- function z({ title: e, claim: t, locale: n, status: r, index: a, limitation: o, metrics: s = [], sources: c = [], author: l, recordedAt: u, recordedLabel: d, details: m, actions: _, labels: C }) {
107
- let w = {
108
- ...L,
109
- ...C,
172
+ function G({ title: e, claim: t, locale: n, status: r, index: i, limitation: o, metrics: s = [], sources: c = [], author: u, recordedAt: f, recordedLabel: m, details: y, actions: b, labels: x }) {
173
+ let S = {
174
+ ...U,
175
+ ...x,
110
176
  statusLabels: {
111
- ...L.statusLabels,
112
- ...C?.statusLabels
177
+ ...U.statusLabels,
178
+ ...x?.statusLabels
113
179
  }
114
180
  };
115
- return /* @__PURE__ */ M(v, {
181
+ return /* @__PURE__ */ F(h, {
116
182
  title: e,
117
- index: a,
118
- meta: /* @__PURE__ */ N(g, { children: [/* @__PURE__ */ M(b, {
119
- tone: R[r],
120
- children: w.statusLabels[r]
121
- }), _] }),
122
- footer: l !== void 0 || u !== void 0 || c.length > 0 ? /* @__PURE__ */ N(g, {
183
+ index: i,
184
+ meta: /* @__PURE__ */ I(p, { children: [/* @__PURE__ */ F(_, {
185
+ tone: W[r],
186
+ children: S.statusLabels[r]
187
+ }), b] }),
188
+ footer: u !== void 0 || f !== void 0 || c.length > 0 ? /* @__PURE__ */ I(p, {
123
189
  shouldSpaceBetween: !0,
124
- children: [/* @__PURE__ */ N(g, { children: [l !== void 0 && /* @__PURE__ */ M(p, {
190
+ children: [/* @__PURE__ */ I(p, { children: [u !== void 0 && /* @__PURE__ */ F(l, {
125
191
  variant: "caption",
126
192
  tone: "muted",
127
- children: l
128
- }), u !== void 0 && /* @__PURE__ */ M(i, {
129
- dateTime: u,
130
- label: d ?? u
131
- })] }), c.length > 0 && /* @__PURE__ */ N(g, { children: [/* @__PURE__ */ N(p, {
193
+ children: u
194
+ }), f !== void 0 && /* @__PURE__ */ F(a, {
195
+ dateTime: f,
196
+ label: m ?? f
197
+ })] }), c.length > 0 && /* @__PURE__ */ I(p, { children: [/* @__PURE__ */ I(l, {
132
198
  variant: "caption",
133
199
  tone: "muted",
134
- children: [w.sources, ":"]
135
- }), c.map((e) => e.summary !== void 0 && e.href !== void 0 ? /* @__PURE__ */ N(S.Root, { children: [/* @__PURE__ */ M(S.Trigger, {
200
+ children: [S.sources, ":"]
201
+ }), c.map((e) => e.summary !== void 0 && e.href !== void 0 ? /* @__PURE__ */ I(O.Root, { children: [/* @__PURE__ */ F(O.Trigger, {
136
202
  href: e.href,
137
- children: /* @__PURE__ */ M(y, { children: e.label })
138
- }), /* @__PURE__ */ M(S.Popup, { children: /* @__PURE__ */ N(h, {
203
+ children: /* @__PURE__ */ F(g, { children: e.label })
204
+ }), /* @__PURE__ */ F(O.Popup, { children: /* @__PURE__ */ I(d, {
139
205
  isCompact: !0,
140
- children: [/* @__PURE__ */ M(p, { children: e.label }), /* @__PURE__ */ M(p, {
206
+ children: [/* @__PURE__ */ F(l, { children: e.label }), /* @__PURE__ */ F(l, {
141
207
  variant: "caption",
142
208
  tone: "muted",
143
209
  children: e.summary
144
210
  })]
145
- }) })] }, e.id) : /* @__PURE__ */ M(y, { children: e.label }, e.id))] })]
211
+ }) })] }, e.id) : /* @__PURE__ */ F(g, { children: e.label }, e.id))] })]
146
212
  }) : void 0,
147
- children: /* @__PURE__ */ N(h, {
213
+ children: /* @__PURE__ */ I(d, {
148
214
  isCompact: !0,
149
215
  children: [
150
- /* @__PURE__ */ M(p, { children: t }),
151
- s.length > 0 && /* @__PURE__ */ M(g, { children: s.map((e) => /* @__PURE__ */ N(b, {
216
+ /* @__PURE__ */ F(l, { children: t }),
217
+ s.length > 0 && /* @__PURE__ */ F(p, { children: s.map((e) => /* @__PURE__ */ I(_, {
152
218
  tone: e.tone ?? "neutral",
153
219
  children: [
154
220
  e.label,
155
221
  ": ",
156
- f({
222
+ D({
157
223
  value: e.value,
158
224
  locale: n,
159
225
  format: e.format
160
226
  })
161
227
  ]
162
228
  }, e.label)) }),
163
- o !== void 0 && /* @__PURE__ */ N(p, {
229
+ o !== void 0 && /* @__PURE__ */ I(l, {
164
230
  variant: "caption",
165
231
  tone: "muted",
166
232
  children: [
167
- w.limitation,
233
+ S.limitation,
168
234
  ": ",
169
235
  o
170
236
  ]
171
237
  }),
172
- m !== void 0 && /* @__PURE__ */ N(x.Root, { children: [/* @__PURE__ */ M(x.Trigger, {
238
+ y !== void 0 && /* @__PURE__ */ I(v.Root, { children: [/* @__PURE__ */ F(v.Trigger, {
173
239
  variant: "inline",
174
- children: w.details
175
- }), /* @__PURE__ */ M(x.Panel, { children: m })] })
240
+ children: S.details
241
+ }), /* @__PURE__ */ F(v.Panel, { children: y })] })
176
242
  ]
177
243
  })
178
244
  });
179
245
  }
180
246
  // packages/kits/src/research/milestone-path.tsx
181
- var B = {
247
+ var K = {
182
248
  baseline: "series5",
183
249
  result: "series1",
184
250
  breakthrough: "positive",
185
251
  counterexample: "negative",
186
252
  decision: "series3"
187
- }, V = {
253
+ }, q = {
188
254
  baseline: "neutral",
189
255
  result: "neutral",
190
256
  breakthrough: "positive",
191
257
  counterexample: "negative",
192
258
  decision: "warning"
193
- }, H = {
259
+ }, J = {
194
260
  metric: "Score",
195
261
  delta: "Change",
196
262
  limitation: "Limitation",
@@ -204,98 +270,98 @@ var B = {
204
270
  decision: "Decision"
205
271
  }
206
272
  };
207
- function U({ milestones: e, valueLabel: t, valueFormat: n, deltaFormat: r, selected: i, onSelectedChange: o, labels: s, ...c }) {
208
- let l = {
209
- ...H,
273
+ function Y({ milestones: e, valueLabel: t, valueFormat: n, deltaFormat: r, selected: i, onSelectedChange: a, labels: s, ...c }) {
274
+ let f = {
275
+ ...J,
210
276
  ...s,
211
277
  kinds: {
212
- ...H.kinds,
278
+ ...J.kinds,
213
279
  ...s?.kinds
214
280
  }
215
281
  };
216
- if (e.length === 0) return /* @__PURE__ */ M(T, {
282
+ if (e.length === 0) return /* @__PURE__ */ F(b, {
217
283
  title: c.title,
218
- children: l.empty
284
+ children: f.empty
219
285
  });
220
- if (new Set(e.map((e) => e.id)).size !== e.length) return /* @__PURE__ */ M(w, {
286
+ if (new Set(e.map((e) => e.id)).size !== e.length) return /* @__PURE__ */ F(y, {
221
287
  hasError: !0,
222
288
  children: "Milestones must have unique identifiers."
223
289
  });
224
- if (e.filter((e) => e.parentId === null).length !== 1) return /* @__PURE__ */ M(w, {
290
+ if (e.filter((e) => e.parentId === null).length !== 1) return /* @__PURE__ */ F(y, {
225
291
  hasError: !0,
226
292
  children: "MilestonePath requires exactly one root milestone (parentId: null)."
227
293
  });
228
- let u = e.map((e) => ({
294
+ let m = e.map((e) => ({
229
295
  id: e.id,
230
296
  parentId: e.parentId,
231
297
  label: e.label,
232
- detail: e.wave === void 0 ? l.kinds[e.kind] : `${e.wave} · ${l.kinds[e.kind]}`,
298
+ detail: e.wave === void 0 ? f.kinds[e.kind] : `${e.wave} · ${f.kinds[e.kind]}`,
233
299
  value: e.metric ?? null,
234
- tone: B[e.kind]
235
- })), d = Array.from(new Set(e.map((e) => e.kind))).map((e) => ({
300
+ tone: K[e.kind]
301
+ })), h = Array.from(new Set(e.map((e) => e.kind))).map((e) => ({
236
302
  id: e,
237
- label: l.kinds[e],
238
- tone: B[e]
239
- })), _ = e.find((e) => e.id === i) ?? null;
240
- return /* @__PURE__ */ N(h, { children: [/* @__PURE__ */ M(C, {
303
+ label: f.kinds[e],
304
+ tone: K[e]
305
+ })), g = e.find((e) => e.id === i) ?? null;
306
+ return /* @__PURE__ */ I(d, { children: [/* @__PURE__ */ F(k, {
241
307
  ...c,
242
- nodes: u,
308
+ nodes: m,
243
309
  direction: "right",
244
310
  link: "elbow",
245
311
  valueLabel: t,
246
312
  valueFormat: n,
247
- toneLegend: d,
313
+ toneLegend: h,
248
314
  selected: i,
249
- onSelectedChange: o
250
- }), _ !== null && /* @__PURE__ */ N(h, {
315
+ onSelectedChange: a
316
+ }), g !== null && /* @__PURE__ */ I(d, {
251
317
  isCompact: !0,
252
318
  children: [
253
- /* @__PURE__ */ M(m, {}),
254
- /* @__PURE__ */ N(g, {
319
+ /* @__PURE__ */ F(u, {}),
320
+ /* @__PURE__ */ I(p, {
255
321
  shouldSpaceBetween: !0,
256
- children: [/* @__PURE__ */ N(g, { children: [_.wave !== void 0 && /* @__PURE__ */ M(b, {
322
+ children: [/* @__PURE__ */ I(p, { children: [g.wave !== void 0 && /* @__PURE__ */ F(_, {
257
323
  tone: "neutral",
258
- children: _.wave
259
- }), /* @__PURE__ */ M(p, { children: /* @__PURE__ */ M("strong", { children: _.label }) })] }), /* @__PURE__ */ M(b, {
260
- tone: V[_.kind],
261
- children: l.kinds[_.kind]
324
+ children: g.wave
325
+ }), /* @__PURE__ */ F(l, { children: /* @__PURE__ */ F("strong", { children: g.label }) })] }), /* @__PURE__ */ F(_, {
326
+ tone: q[g.kind],
327
+ children: f.kinds[g.kind]
262
328
  })]
263
329
  }),
264
- /* @__PURE__ */ M(p, {
330
+ /* @__PURE__ */ F(l, {
265
331
  tone: "muted",
266
- children: _.claim
332
+ children: g.claim
267
333
  }),
268
- /* @__PURE__ */ M(a, { items: [
269
- ..._.metric === void 0 ? [] : [{
270
- label: l.metric,
271
- value: f({
272
- value: _.metric,
334
+ /* @__PURE__ */ F(o, { items: [
335
+ ...g.metric === void 0 ? [] : [{
336
+ label: f.metric,
337
+ value: D({
338
+ value: g.metric,
273
339
  locale: c.locale,
274
340
  format: n
275
341
  })
276
342
  }],
277
- ..._.delta === void 0 ? [] : [{
278
- label: l.delta,
279
- value: f({
280
- value: _.delta,
343
+ ...g.delta === void 0 ? [] : [{
344
+ label: f.delta,
345
+ value: D({
346
+ value: g.delta,
281
347
  locale: c.locale,
282
348
  format: r ?? n
283
349
  })
284
350
  }],
285
- ..._.limitation === void 0 ? [] : [{
286
- label: l.limitation,
287
- value: _.limitation
351
+ ...g.limitation === void 0 ? [] : [{
352
+ label: f.limitation,
353
+ value: g.limitation
288
354
  }],
289
- ..._.source === void 0 ? [] : [{
290
- label: l.source,
291
- value: _.source
355
+ ...g.source === void 0 ? [] : [{
356
+ label: f.source,
357
+ value: g.source
292
358
  }]
293
359
  ] })
294
360
  ]
295
361
  })] });
296
362
  }
297
363
  // packages/kits/src/research/specimen-diff.tsx
298
- var W = {
364
+ var X = {
299
365
  breakdownTitle: "Paired outcome flips",
300
366
  all: "All",
301
367
  gained: "Gained",
@@ -308,65 +374,65 @@ var W = {
308
374
  candidate: "Candidate",
309
375
  outcome: "Outcome",
310
376
  empty: "No paired specimens available for these two runs."
311
- }, G = {
377
+ }, Z = {
312
378
  gained: "positive",
313
379
  regressed: "negative",
314
380
  both_pass: "neutral",
315
381
  both_fail: "neutral"
316
- }, K = /* @__PURE__ */ new Set([
382
+ }, Q = /* @__PURE__ */ new Set([
317
383
  "gained",
318
384
  "regressed",
319
385
  "both_pass",
320
386
  "both_fail"
321
387
  ]);
322
- function q(e) {
323
- return e !== null && K.has(e);
388
+ function ee(e) {
389
+ return e !== null && Q.has(e);
324
390
  }
325
- function J({ rows: e, baselineLabel: n, candidateLabel: r, filter: i, onFilterChange: a, onSelectRow: s, labels: c, ...l }) {
326
- let u = {
327
- ...W,
391
+ function te({ rows: e, baselineLabel: t, candidateLabel: r, filter: i, onFilterChange: a, onSelectRow: o, labels: c, ...u }) {
392
+ let f = {
393
+ ...X,
328
394
  ...c
329
395
  };
330
- if (e.length === 0) return /* @__PURE__ */ M(T, {
331
- title: l.title,
332
- children: u.empty
396
+ if (e.length === 0) return /* @__PURE__ */ F(b, {
397
+ title: u.title,
398
+ children: f.empty
333
399
  });
334
- let d = {
400
+ let p = {
335
401
  gained: 0,
336
402
  regressed: 0,
337
403
  both_pass: 0,
338
404
  both_fail: 0
339
405
  };
340
- for (let t of e) d[t.outcome] += 1;
341
- let f = i === "all" ? e : e.filter((e) => e.outcome === i), m = {
342
- gained: u.gained,
343
- regressed: u.regressed,
344
- both_pass: u.bothPass,
345
- both_fail: u.bothFail
346
- }, g = [
406
+ for (let t of e) p[t.outcome] += 1;
407
+ let m = i === "all" ? e : e.filter((e) => e.outcome === i), h = {
408
+ gained: f.gained,
409
+ regressed: f.regressed,
410
+ both_pass: f.bothPass,
411
+ both_fail: f.bothFail
412
+ }, v = [
347
413
  {
348
414
  id: "specimen",
349
- label: u.specimen,
415
+ label: f.specimen,
350
416
  role: "primary",
351
- cell: (e) => /* @__PURE__ */ M(t, {
417
+ cell: (e) => /* @__PURE__ */ F(n, {
352
418
  secondary: e.family,
353
419
  children: e.prompt
354
420
  })
355
421
  },
356
422
  {
357
423
  id: "expected",
358
- label: u.expected,
424
+ label: f.expected,
359
425
  role: "text",
360
- cell: (e) => /* @__PURE__ */ M(y, { children: e.expected })
426
+ cell: (e) => /* @__PURE__ */ F(g, { children: e.expected })
361
427
  },
362
428
  {
363
429
  id: "baseline",
364
- label: n.trim() === "" ? u.baseline : n,
430
+ label: t.trim() === "" ? f.baseline : t,
365
431
  role: "text",
366
432
  isSecondary: !0,
367
- cell: (e) => /* @__PURE__ */ M(p, {
433
+ cell: (e) => /* @__PURE__ */ F(l, {
368
434
  variant: "mono",
369
- children: /* @__PURE__ */ M(O, {
435
+ children: /* @__PURE__ */ F(j, {
370
436
  text: e.baselineOutput,
371
437
  query: e.expected,
372
438
  tone: "accent"
@@ -375,11 +441,11 @@ function J({ rows: e, baselineLabel: n, candidateLabel: r, filter: i, onFilterCh
375
441
  },
376
442
  {
377
443
  id: "candidate",
378
- label: r.trim() === "" ? u.candidate : r,
444
+ label: r.trim() === "" ? f.candidate : r,
379
445
  role: "text",
380
- cell: (e) => /* @__PURE__ */ M(p, {
446
+ cell: (e) => /* @__PURE__ */ F(l, {
381
447
  variant: "mono",
382
- children: /* @__PURE__ */ M(O, {
448
+ children: /* @__PURE__ */ F(j, {
383
449
  text: e.candidateOutput,
384
450
  query: e.expected,
385
451
  tone: "accent"
@@ -388,119 +454,119 @@ function J({ rows: e, baselineLabel: n, candidateLabel: r, filter: i, onFilterCh
388
454
  },
389
455
  {
390
456
  id: "outcome",
391
- label: u.outcome,
457
+ label: f.outcome,
392
458
  role: "status",
393
- cell: (e) => /* @__PURE__ */ M(b, {
394
- tone: G[e.outcome],
395
- children: m[e.outcome]
459
+ cell: (e) => /* @__PURE__ */ F(_, {
460
+ tone: Z[e.outcome],
461
+ children: h[e.outcome]
396
462
  })
397
463
  }
398
464
  ];
399
- return /* @__PURE__ */ N(h, {
465
+ return /* @__PURE__ */ I(d, {
400
466
  isCompact: !0,
401
467
  children: [
402
- /* @__PURE__ */ M(D, {
403
- title: u.breakdownTitle,
404
- description: l.description,
405
- locale: l.locale,
406
- status: l.status,
407
- source: l.source,
468
+ /* @__PURE__ */ F(A, {
469
+ title: f.breakdownTitle,
470
+ description: u.description,
471
+ locale: u.locale,
472
+ status: u.status,
473
+ source: u.source,
408
474
  total: e.length,
409
475
  valueFormat: { maximumFractionDigits: 0 },
410
476
  items: [
411
477
  {
412
478
  id: "gained",
413
- label: u.gained,
414
- value: d.gained,
479
+ label: f.gained,
480
+ value: p.gained,
415
481
  tone: "positive"
416
482
  },
417
483
  {
418
484
  id: "both_pass",
419
- label: u.bothPass,
420
- value: d.both_pass,
485
+ label: f.bothPass,
486
+ value: p.both_pass,
421
487
  tone: "series1"
422
488
  },
423
489
  {
424
490
  id: "regressed",
425
- label: u.regressed,
426
- value: d.regressed,
491
+ label: f.regressed,
492
+ value: p.regressed,
427
493
  tone: "negative"
428
494
  },
429
495
  {
430
496
  id: "both_fail",
431
- label: u.bothFail,
432
- value: d.both_fail,
497
+ label: f.bothFail,
498
+ value: p.both_fail,
433
499
  tone: "series5"
434
500
  }
435
501
  ],
436
502
  selected: i === "all" ? null : i,
437
503
  onSelectedChange: (e) => {
438
- q(e) ? a(e === i ? "all" : e) : a("all");
504
+ ee(e) ? a(e === i ? "all" : e) : a("all");
439
505
  }
440
506
  }),
441
- /* @__PURE__ */ N(k.Root, {
442
- "aria-label": u.outcome,
507
+ /* @__PURE__ */ I(M.Root, {
508
+ "aria-label": f.outcome,
443
509
  value: i,
444
510
  onValueChange: (e) => {
445
511
  a(e);
446
512
  },
447
513
  children: [
448
- /* @__PURE__ */ N(k.Item, {
514
+ /* @__PURE__ */ I(M.Item, {
449
515
  value: "all",
450
516
  children: [
451
- u.all,
517
+ f.all,
452
518
  " (",
453
519
  e.length,
454
520
  ")"
455
521
  ]
456
522
  }),
457
- /* @__PURE__ */ N(k.Item, {
523
+ /* @__PURE__ */ I(M.Item, {
458
524
  value: "gained",
459
525
  children: [
460
- u.gained,
526
+ f.gained,
461
527
  " (",
462
- d.gained,
528
+ p.gained,
463
529
  ")"
464
530
  ]
465
531
  }),
466
- /* @__PURE__ */ N(k.Item, {
532
+ /* @__PURE__ */ I(M.Item, {
467
533
  value: "regressed",
468
534
  children: [
469
- u.regressed,
535
+ f.regressed,
470
536
  " (",
471
- d.regressed,
537
+ p.regressed,
472
538
  ")"
473
539
  ]
474
540
  }),
475
- /* @__PURE__ */ N(k.Item, {
541
+ /* @__PURE__ */ I(M.Item, {
476
542
  value: "both_pass",
477
543
  children: [
478
- u.bothPass,
544
+ f.bothPass,
479
545
  " (",
480
- d.both_pass,
546
+ p.both_pass,
481
547
  ")"
482
548
  ]
483
549
  }),
484
- /* @__PURE__ */ N(k.Item, {
550
+ /* @__PURE__ */ I(M.Item, {
485
551
  value: "both_fail",
486
552
  children: [
487
- u.bothFail,
553
+ f.bothFail,
488
554
  " (",
489
- d.both_fail,
555
+ p.both_fail,
490
556
  ")"
491
557
  ]
492
558
  })
493
559
  ]
494
560
  }),
495
- /* @__PURE__ */ M(o, {
496
- caption: l.title,
561
+ /* @__PURE__ */ F(s, {
562
+ caption: u.title,
497
563
  hideCaption: !0,
498
- columns: g,
499
- rows: f,
564
+ columns: v,
565
+ rows: m,
500
566
  getRowId: (e) => e.id,
501
- ...s !== void 0 && { rowAction: {
567
+ ...o !== void 0 && { rowAction: {
502
568
  label: (e) => `Inspect ${e.id}`,
503
- onActivate: s
569
+ onActivate: o
504
570
  } },
505
571
  query: {
506
572
  mode: "local",
@@ -511,14 +577,14 @@ function J({ rows: e, baselineLabel: n, candidateLabel: r, filter: i, onFilterCh
511
577
  value: (e) => e.family
512
578
  }]
513
579
  },
514
- empty: u.empty,
580
+ empty: f.empty,
515
581
  filteredEmpty: "No specimens match the current filter."
516
582
  })
517
583
  ]
518
584
  });
519
585
  }
520
586
  // packages/kits/src/research/work-heartbeat.tsx
521
- var Y = {
587
+ var $ = {
522
588
  title: "Active work reports",
523
589
  empty: "No active or recent work reports.",
524
590
  nextCheckpoint: "Next checkpoint",
@@ -529,65 +595,65 @@ var Y = {
529
595
  overdue: "Update overdue",
530
596
  stopped: "Stopped"
531
597
  }
532
- }, X = {
598
+ }, ne = {
533
599
  running: "positive",
534
600
  completed: "neutral",
535
601
  blocked: "negative",
536
602
  overdue: "warning",
537
603
  stopped: "neutral"
538
604
  };
539
- function Z(e) {
605
+ function re(e) {
540
606
  return e === void 0 ? null : Number.isFinite(e.completed) && Number.isFinite(e.total) && e.total > 0 ? e : null;
541
607
  }
542
- function Q({ reports: e, locale: t, labels: n }) {
608
+ function ie({ reports: e, locale: t, labels: n }) {
543
609
  let r = {
544
- ...Y,
610
+ ...$,
545
611
  ...n,
546
612
  states: {
547
- ...Y.states,
613
+ ...$.states,
548
614
  ...n?.states
549
615
  }
550
616
  };
551
- return e.length === 0 ? /* @__PURE__ */ M("div", {
617
+ return e.length === 0 ? /* @__PURE__ */ F("div", {
552
618
  className: "x1qokhjc",
553
- children: /* @__PURE__ */ M(p, {
619
+ children: /* @__PURE__ */ F(l, {
554
620
  variant: "caption",
555
621
  tone: "muted",
556
622
  children: r.empty
557
623
  })
558
- }) : /* @__PURE__ */ M("ul", {
624
+ }) : /* @__PURE__ */ F("ul", {
559
625
  className: "xe8uvvx x1ghz6dp x1717udv x178xt8z x13fuv20 xhjagg4",
560
626
  children: e.map((e) => {
561
- let n = Z(e.progress), a = n === null ? null : Math.max(0, Math.min(100, n.completed / n.total * 100)), o = e.nextCheckpoint !== void 0 || e.executionRef !== void 0;
562
- return /* @__PURE__ */ N("li", {
627
+ let n = re(e.progress), i = n === null ? null : Math.max(0, Math.min(100, n.completed / n.total * 100)), o = e.nextCheckpoint !== void 0 || e.executionRef !== void 0;
628
+ return /* @__PURE__ */ I("li", {
563
629
  className: "x78zum5 xdt5ytf x1hnptsi x1qokhjc xso031l x1q0q8m5 x1qndepd",
564
630
  children: [
565
- /* @__PURE__ */ N(g, {
631
+ /* @__PURE__ */ I(p, {
566
632
  shouldSpaceBetween: !0,
567
- children: [/* @__PURE__ */ M(p, { children: /* @__PURE__ */ M("strong", { children: e.title }) }), /* @__PURE__ */ N(g, { children: [/* @__PURE__ */ M(_, {
568
- tone: X[e.state],
633
+ children: [/* @__PURE__ */ F(l, { children: /* @__PURE__ */ F("strong", { children: e.title }) }), /* @__PURE__ */ I(p, { children: [/* @__PURE__ */ F(m, {
634
+ tone: ne[e.state],
569
635
  children: r.states[e.state]
570
- }), /* @__PURE__ */ M(i, {
636
+ }), /* @__PURE__ */ F(a, {
571
637
  dateTime: e.observedAt,
572
638
  label: e.observedLabel
573
639
  })] })]
574
640
  }),
575
- n !== null && a !== null && /* @__PURE__ */ N(h, {
641
+ n !== null && i !== null && /* @__PURE__ */ I(d, {
576
642
  isCompact: !0,
577
- children: [/* @__PURE__ */ N(g, {
643
+ children: [/* @__PURE__ */ I(p, {
578
644
  shouldSpaceBetween: !0,
579
- children: [/* @__PURE__ */ N(p, {
645
+ children: [/* @__PURE__ */ I(l, {
580
646
  variant: "caption",
581
647
  tone: "muted",
582
648
  children: [
583
- f({
649
+ D({
584
650
  value: n.completed,
585
651
  locale: t,
586
652
  format: { maximumFractionDigits: 0 }
587
653
  }),
588
654
  " /",
589
655
  " ",
590
- f({
656
+ D({
591
657
  value: n.total,
592
658
  locale: t,
593
659
  format: { maximumFractionDigits: 0 }
@@ -595,10 +661,10 @@ function Q({ reports: e, locale: t, labels: n }) {
595
661
  " ",
596
662
  n.unit
597
663
  ]
598
- }), /* @__PURE__ */ M(b, {
664
+ }), /* @__PURE__ */ F(_, {
599
665
  tone: "neutral",
600
- children: f({
601
- value: a / 100,
666
+ children: D({
667
+ value: i / 100,
602
668
  locale: t,
603
669
  format: {
604
670
  style: "percent",
@@ -606,12 +672,12 @@ function Q({ reports: e, locale: t, labels: n }) {
606
672
  }
607
673
  })
608
674
  })]
609
- }), /* @__PURE__ */ M(E, {
675
+ }), /* @__PURE__ */ F(x, {
610
676
  label: e.title,
611
677
  value: n.completed,
612
678
  max: n.total,
613
- valueLabel: f({
614
- value: a / 100,
679
+ valueLabel: D({
680
+ value: i / 100,
615
681
  locale: t,
616
682
  format: {
617
683
  style: "percent",
@@ -620,9 +686,9 @@ function Q({ reports: e, locale: t, labels: n }) {
620
686
  })
621
687
  })]
622
688
  }),
623
- o && /* @__PURE__ */ N(g, {
689
+ o && /* @__PURE__ */ I(p, {
624
690
  shouldSpaceBetween: !0,
625
- children: [e.nextCheckpoint === void 0 ? /* @__PURE__ */ M("span", {}) : /* @__PURE__ */ N(p, {
691
+ children: [e.nextCheckpoint === void 0 ? /* @__PURE__ */ F("span", {}) : /* @__PURE__ */ I(l, {
626
692
  variant: "caption",
627
693
  tone: "muted",
628
694
  children: [
@@ -630,11 +696,11 @@ function Q({ reports: e, locale: t, labels: n }) {
630
696
  ": ",
631
697
  e.nextCheckpoint
632
698
  ]
633
- }), e.executionRef !== void 0 && /* @__PURE__ */ M(y, { children: e.executionRef })]
699
+ }), e.executionRef !== void 0 && /* @__PURE__ */ F(g, { children: e.executionRef })]
634
700
  })
635
701
  ]
636
702
  }, e.id);
637
703
  })
638
704
  });
639
705
  }
640
- export { I as CollectionPage, z as FindingCard, U as MilestonePath, J as SpecimenDiff, Q as WorkHeartbeat };
706
+ export { V as CollectionPage, H as CollectionSection, G as FindingCard, Y as MilestonePath, te as SpecimenDiff, ie as WorkHeartbeat };
@@ -1,6 +1,7 @@
1
1
  import type { ComponentProps, ReactNode } from 'react';
2
2
  import type { DataTableColumn, DataTableRowAction, DataTableSort, DataTableSortDetails, TableFilterDimension, TableQueryException } from '../../../collections/src/index.ts';
3
3
  import { PageLayout } from '../../../layout/src/index.ts';
4
+ export type CollectionStatus = 'loading' | 'ready' | 'failed';
4
5
  type SortableColumns<Row> = {
5
6
  readonly columns: ReadonlyArray<DataTableColumn<Row>>;
6
7
  readonly sort: DataTableSort | undefined;
@@ -12,7 +13,7 @@ type SortableColumns<Row> = {
12
13
  readonly sort?: never;
13
14
  readonly onSortChange?: never;
14
15
  };
15
- export type CollectionPageProps<Row extends object> = SortableColumns<Row> & {
16
+ type SharedCollectionProps<Row extends object> = SortableColumns<Row> & {
16
17
  readonly title: string;
17
18
  readonly caption?: string;
18
19
  readonly rows: ReadonlyArray<Row>;
@@ -23,7 +24,6 @@ export type CollectionPageProps<Row extends object> = SortableColumns<Row> & {
23
24
  readonly filters: ReadonlyArray<TableFilterDimension<Row>> | TableQueryException;
24
25
  /** Optional custom row transformer (e.g. sorting) applied after local search and filtering. */
25
26
  readonly transformRows?: (rows: ReadonlyArray<Row>) => ReadonlyArray<Row>;
26
- readonly navigation?: ComponentProps<typeof PageLayout>['navigation'];
27
27
  readonly actions?: ReactNode;
28
28
  readonly notice?: ReactNode;
29
29
  readonly rowAction?: DataTableRowAction<Row> | undefined;
@@ -31,6 +31,13 @@ export type CollectionPageProps<Row extends object> = SortableColumns<Row> & {
31
31
  readonly rowSizing?: 'fixed' | 'content' | undefined;
32
32
  readonly empty: ReactNode;
33
33
  readonly filteredEmpty?: ReactNode;
34
+ /** Read lifecycle state: `'loading'` reserves geometry with `DataTablePlaceholder` inside `AsyncRegion`. */
35
+ readonly status?: CollectionStatus;
36
+ readonly failure?: ReactNode;
37
+ readonly placeholderRows?: number;
38
+ };
39
+ export type CollectionPageProps<Row extends object> = SharedCollectionProps<Row> & {
40
+ readonly navigation?: ComponentProps<typeof PageLayout>['navigation'];
34
41
  /** Optional right-hand inspector pane rendered inside a resizable Workbench split when open. */
35
42
  readonly inspector?: {
36
43
  readonly label: string;
@@ -38,9 +45,19 @@ export type CollectionPageProps<Row extends object> = SortableColumns<Row> & {
38
45
  } | undefined;
39
46
  readonly inspectorInitialPercent?: number | undefined;
40
47
  };
48
+ export type CollectionSectionProps<Row extends object> = SharedCollectionProps<Row> & {
49
+ readonly id?: string;
50
+ readonly meta?: ReactNode;
51
+ };
41
52
  /**
42
53
  * Full-width collection page Lego block: wires `PageLayout`, top-bar search and filter controls (`/` and `⌘F`), active
43
- * filter chips, edge-to-edge `CollectionLayout` + `DataTable`, and an optional resizable `Workbench` inspector.
54
+ * filter chips, `AsyncRegion` + `DataTablePlaceholder` loading states, edge-to-edge `CollectionLayout`, and an optional
55
+ * resizable `Workbench` inspector.
56
+ */
57
+ export declare function CollectionPage<Row extends object>(props: CollectionPageProps<Row>): ReactNode;
58
+ /**
59
+ * Full-width collection section for tabbed or multi-section views. Wires `SectionHeading`, top-bar search and filters,
60
+ * active filter chips, `AsyncRegion` loading placeholders, and edge-to-edge `DataTable`.
44
61
  */
45
- export declare function CollectionPage<Row extends object>({ title, caption, rows, getRowId, columns, sort, onSortChange, search, filters, transformRows, navigation, actions, notice, rowAction, activeRowId, rowSizing, empty, filteredEmpty, inspector, inspectorInitialPercent, }: CollectionPageProps<Row>): ReactNode;
62
+ export declare function CollectionSection<Row extends object>(props: CollectionSectionProps<Row>): ReactNode;
46
63
  export {};
@@ -1,5 +1,5 @@
1
- export type { CollectionPageProps } from './collection-page.tsx';
2
- export { CollectionPage } from './collection-page.tsx';
1
+ export type { CollectionPageProps, CollectionSectionProps, CollectionStatus } from './collection-page.tsx';
2
+ export { CollectionPage, CollectionSection } from './collection-page.tsx';
3
3
  export type { FindingCardLabels, FindingCardProps, FindingMetric, FindingSource, FindingStatus, } from './finding-card.tsx';
4
4
  export { FindingCard } from './finding-card.tsx';
5
5
  export type { MilestoneKind, MilestonePathLabels, MilestonePathProps, ResearchMilestone } from './milestone-path.tsx';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mechane-ai/elements",
3
- "version": "0.50.0",
3
+ "version": "0.51.0",
4
4
  "description": "Elements by Mechane — React components for applications, AI interfaces, and analytical graphics",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {