@crewlethq/ui 0.100.2 → 0.102.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 (102) hide show
  1. package/dist/AgentHandoffPanel/index.js +6 -6
  2. package/dist/AppShell/index.js +3 -3
  3. package/dist/ArrangeList/index.js +1 -1
  4. package/dist/ArtifactBar/index.js +1 -1
  5. package/dist/ArtifactCard/index.js +2 -2
  6. package/dist/AuthLayout/index.js +1 -1
  7. package/dist/AvatarPicker/index.js +3 -3
  8. package/dist/BriefCard/index.js +1 -1
  9. package/dist/CharacterPicker/index.js +2 -2
  10. package/dist/Combobox/index.js +2 -2
  11. package/dist/CommandPalette/index.js +4 -4
  12. package/dist/CommentThread/index.js +6 -6
  13. package/dist/Composer/index.js +2 -2
  14. package/dist/DataGrid/DataGrid.d.ts +145 -41
  15. package/dist/DataGrid/index.d.ts +2 -2
  16. package/dist/DataGrid/index.js +7 -5
  17. package/dist/DataGrid/parts.d.ts +163 -0
  18. package/dist/{DataGrid-SAHEL4SN.css → DataGrid-YNLCEH3E.css} +228 -19
  19. package/dist/DataTable/index.js +4 -4
  20. package/dist/DataView/index.js +6 -6
  21. package/dist/DatasetSource/index.js +1 -1
  22. package/dist/DeepWorkCard/index.js +1 -1
  23. package/dist/DocTabsEditor/index.js +4 -4
  24. package/dist/EditingStatus/index.js +2 -2
  25. package/dist/EntityList/index.js +1 -1
  26. package/dist/InlineEditor/index.js +3 -3
  27. package/dist/KeyValueRows/index.js +3 -3
  28. package/dist/ListInput/index.js +4 -4
  29. package/dist/OpenInAppCard/index.js +1 -1
  30. package/dist/OrgTable/OrgTable.d.ts +5 -20
  31. package/dist/OrgTable/index.js +10 -3
  32. package/dist/{OrgTable-XYHEFI5X.css → OrgTable-5NXRECVP.css} +29 -9
  33. package/dist/PeekRail/index.js +2 -2
  34. package/dist/PrincipalPicker/index.js +3 -3
  35. package/dist/ProposalCard/index.js +3 -3
  36. package/dist/RailList/index.js +3 -2
  37. package/dist/RefusalCard/index.js +1 -1
  38. package/dist/RelatedRow/index.js +3 -2
  39. package/dist/ResultTableCard/index.js +1 -1
  40. package/dist/RichEditor/index.js +1 -1
  41. package/dist/SetupWizard/index.js +1 -1
  42. package/dist/ShareDialog/index.js +2 -2
  43. package/dist/SheetColumnEditor/index.js +5 -5
  44. package/dist/SheetGrid/index.js +3 -3
  45. package/dist/SlideFilmstrip/index.js +2 -2
  46. package/dist/StatusCard/index.js +1 -1
  47. package/dist/Switcher/index.js +4 -4
  48. package/dist/TableCells/TableCells.d.ts +10 -2
  49. package/dist/TableCells/index.js +4 -3
  50. package/dist/Text/index.js +2 -1
  51. package/dist/ThreadSummary/index.js +1 -1
  52. package/dist/TimeRangePicker/index.js +4 -4
  53. package/dist/TimeWindowPicker/index.js +4 -4
  54. package/dist/TreeGrid/TreeGrid.d.ts +143 -12
  55. package/dist/TreeGrid/index.d.ts +1 -1
  56. package/dist/TreeGrid/index.js +15 -2
  57. package/dist/{TreeGrid-H3GHMKZX.css → TreeGrid-XZCH5WCC.css} +232 -2
  58. package/dist/ValueField/index.js +3 -3
  59. package/dist/{chunk-G44KKOMB.js → chunk-2LLMUJFB.js} +1 -1
  60. package/dist/{chunk-BK4KUIAZ.js → chunk-AP6JSZGT.js} +12 -4
  61. package/dist/chunk-BZUBONYA.js +557 -0
  62. package/dist/{chunk-PCXMJZTE.js → chunk-DBH7ORCH.js} +1 -1
  63. package/dist/{chunk-MKTHLT4E.js → chunk-EMXUREKE.js} +1 -1
  64. package/dist/{chunk-CL3FWLDO.js → chunk-HI47TXSW.js} +1 -1
  65. package/dist/{chunk-PXYDEDNN.js → chunk-J3QFTG4B.js} +1 -1
  66. package/dist/{chunk-G6QKJGQQ.js → chunk-L72GPZ56.js} +1 -1
  67. package/dist/{chunk-HYVYYODN.js → chunk-M6EVTMTK.js} +1 -1
  68. package/dist/chunk-MO5YV3XV.js +899 -0
  69. package/dist/{chunk-XQWWA2LG.js → chunk-PAJAGGSE.js} +19 -51
  70. package/dist/{chunk-NHQ7O4DG.js → chunk-PF6X74C5.js} +3 -3
  71. package/dist/{chunk-SBVTOIFP.js → chunk-PMO6W5NE.js} +2 -2
  72. package/dist/chunk-WSIJDWUG.js +10 -0
  73. package/dist/{chunk-O5CEG7TQ.js → chunk-XLMURU75.js} +1 -6
  74. package/dist/{chunk-V3QWPHY4.js → chunk-XRKBPNX4.js} +1 -1
  75. package/dist/generated/index.js +77 -77
  76. package/dist/index.js +77 -77
  77. package/dist/styles.css +492 -33
  78. package/dist/utils/titleIfCut.d.ts +18 -0
  79. package/package.json +3 -3
  80. package/dist/chunk-CCNAGB3F.js +0 -591
  81. package/dist/chunk-CTQZK5J3.js +0 -8
  82. package/dist/chunk-ERESJG6C.js +0 -353
  83. package/dist/{Editor-XRI2NOO5.js → Editor-YHHCK5SJ.js} +2 -2
  84. package/dist/{chunk-NRMF2PKX.js → chunk-3Z2BSKS5.js} +1 -1
  85. package/dist/{chunk-6IAW2ZIE.js → chunk-5KJOG5YP.js} +2 -2
  86. package/dist/{chunk-HBHKMFAH.js → chunk-7L6JJ7VJ.js} +1 -1
  87. package/dist/{chunk-HEXH3HQJ.js → chunk-A5ISYHW7.js} +2 -2
  88. package/dist/{chunk-CRRW4UGJ.js → chunk-AC255TMQ.js} +1 -1
  89. package/dist/{chunk-YPXXDYTR.js → chunk-AP6SM6BL.js} +1 -1
  90. package/dist/{chunk-QCCWXOKK.js → chunk-DK7CXQFY.js} +1 -1
  91. package/dist/{chunk-GCKHZMWG.js → chunk-E23AXDKL.js} +1 -1
  92. package/dist/{chunk-V6CVW6PF.js → chunk-GA773IOZ.js} +1 -1
  93. package/dist/{chunk-TXQ6FZJL.js → chunk-HU5PAZMU.js} +1 -1
  94. package/dist/{chunk-CTHZHMVG.js → chunk-IA3NL54W.js} +1 -1
  95. package/dist/{chunk-3JE6YIG5.js → chunk-JZADK2FT.js} +2 -2
  96. package/dist/{chunk-S4JRQJEP.js → chunk-LNQSNXGJ.js} +1 -1
  97. package/dist/{chunk-HR5O6PSR.js → chunk-MTKHMGJH.js} +1 -1
  98. package/dist/{chunk-NIZRR2NN.js → chunk-OAKECTYH.js} +1 -1
  99. package/dist/{chunk-I2GJLUU3.js → chunk-OU6ZSWEJ.js} +1 -1
  100. package/dist/{chunk-LNXL22Y7.js → chunk-RSI6EJSH.js} +1 -1
  101. package/dist/{chunk-BGRYFVSK.js → chunk-XHQ2JJCB.js} +1 -1
  102. package/dist/{chunk-CQAR3F33.js → chunk-XLVWSNW3.js} +1 -1
@@ -0,0 +1,557 @@
1
+ import { useTreeState, treeExpandable, treeLevel, treePosInSet, treeSetSize, treeItemAction, treePrevious, treeNext, treeStep } from './chunk-MY374UUD.js';
2
+ import { GRID_FOOT_LABELS, parseGridSort, overrunning, squeezedCells, fitGridColumns, tableTrack, GRID_ICON_TRACK, GridHeadCell, alignOf, rowLinkTitle, headerWord, GridFoot, droppedNames, nextGridSort, sortByValue } from './chunk-MO5YV3XV.js';
3
+ import { LayerNodeBridge } from './chunk-X4HBZSXA.js';
4
+ import { Checkbox } from './chunk-M6G7XLLP.js';
5
+ import { useMediaMatch } from './chunk-YJQXESOJ.js';
6
+ import { EmptyState } from './chunk-PPUR46MK.js';
7
+ import { IconButton } from './chunk-WDLAAZFZ.js';
8
+ import { LayerHost, LAYER_REPOSITION_EVENT } from './chunk-FIX72ZEC.js';
9
+ import { focusables } from './chunk-TUEM2XIW.js';
10
+ import { cx } from './chunk-ODEQTPFM.js';
11
+ import './TreeGrid-XZCH5WCC.css';
12
+ import { useRef, useState, useLayoutEffect, useEffect, useMemo, useCallback, useImperativeHandle } from 'react';
13
+ import { breakpoint } from '@crewlethq/tokens';
14
+ import { ChevronRightGlyph } from '@crewlethq/icons/glyphs';
15
+ import { jsx, jsxs } from 'react/jsx-runtime';
16
+
17
+ var LABELS = {
18
+ ...GRID_FOOT_LABELS,
19
+ expand: (label) => `Expand ${label}`,
20
+ collapse: (label) => `Collapse ${label}`
21
+ };
22
+ var NO_DROPS = [];
23
+ var NO_FIT = { set: "", width: 0, dropped: NO_DROPS };
24
+ function sortsBy(column) {
25
+ return !column.action && (column.sortable ?? column.sortValue !== void 0);
26
+ }
27
+ function sortTreeLevels(forest, get, desc, pinned = () => false) {
28
+ const level = (nodes) => {
29
+ const rows = nodes.filter((node) => !pinned(node.id));
30
+ const pins = nodes.filter((node) => pinned(node.id));
31
+ return [...sortByValue(rows, (node) => get(node.id), desc), ...pins].map(
32
+ (node) => node.children && node.children.length > 0 ? { ...node, children: level(node.children) } : node
33
+ );
34
+ };
35
+ return level(forest);
36
+ }
37
+ function orderOf(forest) {
38
+ const ids = [];
39
+ const walk = (node) => {
40
+ ids.push(node.id);
41
+ node.children?.forEach(walk);
42
+ };
43
+ forest.forEach(walk);
44
+ return ids.join("\0");
45
+ }
46
+ function controlIn(cell) {
47
+ return focusables(cell).find((el) => !el.closest('[aria-hidden="true"]')) ?? null;
48
+ }
49
+ var TEXT_INPUTS = /* @__PURE__ */ new Set(["text", "search", "url", "email", "tel", "password", "number"]);
50
+ function caretKey(target, key) {
51
+ const lines = target instanceof HTMLTextAreaElement || target.isContentEditable;
52
+ const field = lines || target instanceof HTMLInputElement && TEXT_INPUTS.has(target.type);
53
+ if (!field) return false;
54
+ if (key === "ArrowLeft" || key === "ArrowRight" || key === "Home" || key === "End") return true;
55
+ return lines && (key === "ArrowUp" || key === "ArrowDown");
56
+ }
57
+ function TreeGrid({
58
+ label,
59
+ columns,
60
+ rows: forest,
61
+ renderCell,
62
+ renderIndent,
63
+ cellHasControl,
64
+ onRowKey,
65
+ onRowKeyDown,
66
+ hasRowMenu,
67
+ addRow,
68
+ selectedId = null,
69
+ onSelect,
70
+ selection,
71
+ rowHref,
72
+ isFailed,
73
+ readOnly,
74
+ defaultExpanded,
75
+ expanded: held,
76
+ onExpandedChange,
77
+ sort: sortRaw = "",
78
+ defaultSort = "",
79
+ onSortChange,
80
+ serverSorted = false,
81
+ cols: colsRaw = "",
82
+ onColsChange,
83
+ empty,
84
+ footer,
85
+ loadedNote,
86
+ onLoadMore,
87
+ phoneRows,
88
+ flush = false,
89
+ headless = false,
90
+ layout = "scroll",
91
+ onWidthChange,
92
+ labels,
93
+ ref,
94
+ className
95
+ }) {
96
+ const text = { ...LABELS, ...labels };
97
+ const frame = useRef(null);
98
+ const gridEl = useRef(null);
99
+ const [width, setWidth] = useState(0);
100
+ const reportWidth = useRef(onWidthChange);
101
+ reportWidth.current = onWidthChange;
102
+ const measures = onWidthChange !== void 0 || phoneRows !== void 0 || columns.some((one) => one.hideBelow !== void 0 || one.drop !== void 0);
103
+ useLayoutEffect(() => {
104
+ const el = frame.current;
105
+ if (!measures || !el) return;
106
+ const read = (next) => setWidth(Math.round(next));
107
+ read(el.getBoundingClientRect().width);
108
+ if (typeof ResizeObserver !== "function") return;
109
+ const observer = new ResizeObserver(([entry]) => {
110
+ if (entry) read(entry.contentRect.width);
111
+ });
112
+ observer.observe(el);
113
+ return () => observer.disconnect();
114
+ }, [measures]);
115
+ useEffect(() => {
116
+ if (width > 0) reportWidth.current?.(width);
117
+ }, [width]);
118
+ const shownColumns = useMemo(() => {
119
+ const asked = colsRaw.split(",").map((c) => c.trim()).filter(Boolean);
120
+ const byKey = new Map(columns.map((c) => [c.key, c]));
121
+ const picked = asked.map((key) => byKey.get(key)).filter((c) => !!c);
122
+ const set = picked.length > 0 ? picked : columns.filter((c) => !c.optional);
123
+ return set.filter((one) => one.hideBelow === void 0 || width <= 0 || width >= one.hideBelow);
124
+ }, [columns, colsRaw, width]);
125
+ const phone = useMediaMatch(`(width < ${breakpoint.phone})`);
126
+ const shownKeys = `${shownColumns.map((c) => c.key).join(",")}${phone ? "|phone" : ""}`;
127
+ const [fit, setFit] = useState(NO_FIT);
128
+ const stacked = phoneRows !== void 0 && (phone || fit.set === shownKeys && Boolean(fit.stacked));
129
+ const dropped = !stacked && fit.set === shownKeys ? fit.dropped : NO_DROPS;
130
+ const drawn = useMemo(
131
+ () => dropped.length === 0 ? shownColumns : shownColumns.filter((c) => !dropped.includes(c.key)),
132
+ [shownColumns, dropped]
133
+ );
134
+ const sort = parseGridSort(sortRaw || defaultSort);
135
+ const sortValue = sort && !serverSorted ? columns.find((c) => c.key === sort.key)?.sortValue : void 0;
136
+ const pinned = (id) => addRow?.(id) != null;
137
+ const sortedNow = sortValue && sort ? sortTreeLevels(forest, sortValue, sort.desc, pinned) : forest;
138
+ const drawnOrder = sortValue ? orderOf(sortedNow) : "";
139
+ const sorted = useMemo(() => sortedNow, [forest, drawnOrder]);
140
+ const tree = useTreeState(sorted, selectedId, { defaultExpanded, expanded: held, onExpandedChange });
141
+ const { model, expanded, rows, active, setActive, toggle } = tree;
142
+ const [column, setColumn] = useState(null);
143
+ const [menuFor, setMenuFor] = useState(null);
144
+ const current = useRef({ addRow, onSelect });
145
+ current.current = { addRow, onSelect };
146
+ const isAddRow = (id) => current.current.addRow?.(id) ?? null;
147
+ useLayoutEffect(() => {
148
+ const el = gridEl.current;
149
+ if (!el || width <= 0 || phone && phoneRows !== void 0) return;
150
+ if (!drawn.some((one) => one.drop !== void 0) && phoneRows === void 0 && fit.set === shownKeys) return;
151
+ const current2 = fit.set === shownKeys ? fit : { ...NO_FIT, set: shownKeys };
152
+ const head = el.querySelector(':scope > .crewlet-tree-grid__head > [role="row"]');
153
+ const overrun = !current2.stacked && overrunning(el, head);
154
+ const squeeze = current2.stacked ? null : squeezedCells(
155
+ el.clientWidth,
156
+ head ? [...head.children] : [],
157
+ [
158
+ ...el.querySelectorAll(
159
+ ':scope > .crewlet-tree-grid__body > [role="row"]:not(.crewlet-tree-grid__row--add)'
160
+ )
161
+ ],
162
+ (row) => [...row.children],
163
+ drawn
164
+ );
165
+ const next = fitGridColumns({
166
+ fit: current2,
167
+ width: el.clientWidth,
168
+ overflows: overrun || squeeze !== null,
169
+ stack: phoneRows !== void 0 && (overrun || squeeze === "values"),
170
+ visible: drawn
171
+ });
172
+ if (next !== null) setFit(next);
173
+ }, [phone, fit, shownKeys, drawn, rows, width, phoneRows]);
174
+ const rowEls = useRef(/* @__PURE__ */ new Map());
175
+ const refs = useRef(/* @__PURE__ */ new Map());
176
+ const rowRef = (id) => {
177
+ let callback = refs.current.get(id);
178
+ if (!callback) {
179
+ callback = (el) => {
180
+ if (el) rowEls.current.set(id, el);
181
+ else rowEls.current.delete(id);
182
+ };
183
+ refs.current.set(id, callback);
184
+ }
185
+ return callback;
186
+ };
187
+ const [request, setRequest] = useState(null);
188
+ const focusAt = useCallback(
189
+ (id, col) => {
190
+ if (current.current.addRow?.(id) == null) current.current.onSelect?.(id);
191
+ setActive(id);
192
+ setColumn(col);
193
+ setRequest({ id, column: col });
194
+ },
195
+ [setActive]
196
+ );
197
+ useLayoutEffect(() => {
198
+ const row = request ? rowEls.current.get(request.id) : void 0;
199
+ if (!request || !row) return;
200
+ if (request.column === null) {
201
+ row.focus();
202
+ return;
203
+ }
204
+ const cell = row.querySelector(`[aria-colindex="${request.column}"]`);
205
+ const control = cell ? controlIn(cell) : null;
206
+ (control ?? cell ?? row).focus();
207
+ }, [request]);
208
+ const focusRef = useRef(() => {
209
+ });
210
+ focusRef.current = (id) => {
211
+ if (!model.parent.has(id)) return;
212
+ tree.open(id);
213
+ focusAt(id, null);
214
+ };
215
+ const { expandAll, collapseAll } = tree;
216
+ useImperativeHandle(ref, () => ({ focusNode: (id) => focusRef.current(id), expandAll, collapseAll }), [
217
+ expandAll,
218
+ collapseAll
219
+ ]);
220
+ function follow(row, event) {
221
+ const link = row.querySelector(':scope > [role="gridcell"] > a.crewlet-tree-grid__row-link');
222
+ if (!link) return false;
223
+ link.dispatchEvent(
224
+ new window.MouseEvent("click", {
225
+ bubbles: true,
226
+ cancelable: true,
227
+ metaKey: event.metaKey,
228
+ ctrlKey: event.ctrlKey,
229
+ shiftKey: event.shiftKey,
230
+ altKey: event.altKey
231
+ })
232
+ );
233
+ return true;
234
+ }
235
+ function onKeyDownCapture(event) {
236
+ const target = event.target;
237
+ const row = target.closest("[data-tree-id]");
238
+ if (!row) return;
239
+ const id = row.getAttribute("data-tree-id");
240
+ const onRow = target === row;
241
+ const cellIndex = target.closest("[role='gridcell']")?.getAttribute("aria-colindex");
242
+ const col = onRow || !cellIndex ? null : Number(cellIndex);
243
+ const add = isAddRow(id);
244
+ const cells = add ? add.cells : drawn.length;
245
+ const handled = () => {
246
+ event.preventDefault();
247
+ event.stopPropagation();
248
+ };
249
+ if (onRow && add === null) {
250
+ if (onRowKeyDown?.(id, event)) {
251
+ handled();
252
+ return;
253
+ }
254
+ const action = treeItemAction(event);
255
+ if (action === "menu") {
256
+ if (hasRowMenu?.(id)) {
257
+ handled();
258
+ setMenuFor(id);
259
+ }
260
+ return;
261
+ }
262
+ if (action !== null) {
263
+ if (onRowKey?.(id, action)) handled();
264
+ else if (action === "activate" && follow(row, event)) handled();
265
+ return;
266
+ }
267
+ if (event.key === "Enter" && (event.metaKey || event.ctrlKey) && !event.altKey && follow(row, event)) {
268
+ handled();
269
+ return;
270
+ }
271
+ }
272
+ if (event.ctrlKey || event.metaKey || event.altKey) return;
273
+ const sameColumn = (next) => {
274
+ if (next === null) return;
275
+ const other = isAddRow(next);
276
+ const count = other ? other.cells : drawn.length;
277
+ focusAt(next, col === null ? null : Math.min(col, count));
278
+ };
279
+ if (col !== null && caretKey(target, event.key)) return;
280
+ if (col !== null) {
281
+ switch (event.key) {
282
+ case "ArrowRight":
283
+ handled();
284
+ if (col < cells) focusAt(id, col + 1);
285
+ return;
286
+ case "ArrowLeft":
287
+ handled();
288
+ focusAt(id, col > 1 ? col - 1 : null);
289
+ return;
290
+ case "Home":
291
+ handled();
292
+ focusAt(id, 1);
293
+ return;
294
+ case "End":
295
+ handled();
296
+ focusAt(id, cells);
297
+ return;
298
+ case "ArrowDown":
299
+ handled();
300
+ sameColumn(treeNext(model, expanded, id));
301
+ return;
302
+ case "ArrowUp":
303
+ handled();
304
+ sameColumn(treePrevious(model, expanded, id));
305
+ return;
306
+ default:
307
+ return;
308
+ }
309
+ }
310
+ if (event.key === "ArrowRight" && !(treeExpandable(model, id) && !expanded.has(id))) {
311
+ handled();
312
+ focusAt(id, 1);
313
+ return;
314
+ }
315
+ if (add !== null && event.key === "Enter") {
316
+ handled();
317
+ focusAt(id, 1);
318
+ return;
319
+ }
320
+ const step = treeStep(tree, id, event);
321
+ if (step === void 0) return;
322
+ handled();
323
+ if (step === null) return;
324
+ if ("toggle" in step) toggle(step.toggle);
325
+ else focusAt(step.focus, null);
326
+ }
327
+ const [layer, setLayer] = useState(null);
328
+ const onScroll = () => layer?.dispatchEvent(new CustomEvent(LAYER_REPOSITION_EVENT));
329
+ const stop = (id, col) => id === active && column === col;
330
+ const grid = {
331
+ expanded: (id) => expanded.has(id),
332
+ expandable: (id) => treeExpandable(model, id),
333
+ toggle,
334
+ tabStop: stop,
335
+ opened: (id, col) => {
336
+ setActive(id);
337
+ setColumn(col);
338
+ },
339
+ press: (id) => ({
340
+ onMouseDown: (event) => {
341
+ event.preventDefault();
342
+ focusAt(id, null);
343
+ }
344
+ }),
345
+ menuOpen: (id) => menuFor === id,
346
+ setMenuOpen: (id, open) => setMenuFor((was) => open ? id : was === id ? null : was),
347
+ columnKey: (col) => drawn[col - 1]?.key,
348
+ shown: (key) => drawn.some((one) => one.key === key),
349
+ tree: model
350
+ };
351
+ const hasControl = (id, col, key) => col === 1 && selection !== void 0 && selection.checked(id) !== null || (cellHasControl?.(id, col, key) ?? false);
352
+ function headerClick(one) {
353
+ if (!sortsBy(one) || !onSortChange) return;
354
+ onSortChange(nextGridSort(one.key, sortRaw, defaultSort));
355
+ }
356
+ const template = drawn.map((one) => tableTrack({ ...one, width: one.width ?? (one.icon ? GRID_ICON_TRACK : void 0) })).join(" ");
357
+ const frameClass = cx(
358
+ "crewlet-tree-grid",
359
+ headless && "crewlet-tree-grid--headless",
360
+ layout === "container" && "crewlet-tree-grid--container",
361
+ className
362
+ );
363
+ if (forest.length === 0 && empty) {
364
+ return /* @__PURE__ */ jsx("div", { ref: frame, className: frameClass, "data-flush": flush || void 0, children: /* @__PURE__ */ jsx("div", { className: "crewlet-tree-grid__scroller", children: /* @__PURE__ */ jsx(
365
+ EmptyState,
366
+ {
367
+ size: "compact",
368
+ icon: empty.icon,
369
+ title: empty.title,
370
+ description: empty.hint,
371
+ action: empty.action
372
+ }
373
+ ) }) });
374
+ }
375
+ return /* @__PURE__ */ jsx(
376
+ "div",
377
+ {
378
+ ref: frame,
379
+ className: frameClass,
380
+ "data-flush": flush || void 0,
381
+ "data-stacked": stacked || void 0,
382
+ "data-phone-rows": stacked && phoneRows === "compact" ? "compact" : void 0,
383
+ children: /* @__PURE__ */ jsxs(LayerHost, { className: "crewlet-tree-grid__layer", children: [
384
+ /* @__PURE__ */ jsxs("div", { className: "crewlet-tree-grid__scroller", onScroll, children: [
385
+ /* @__PURE__ */ jsxs(
386
+ "div",
387
+ {
388
+ ref: gridEl,
389
+ role: "treegrid",
390
+ "aria-label": label,
391
+ "aria-colcount": drawn.length,
392
+ "aria-readonly": readOnly || void 0,
393
+ className: "crewlet-tree-grid__grid",
394
+ style: { "--crewlet-tree-grid-columns": template },
395
+ onKeyDownCapture,
396
+ children: [
397
+ /* @__PURE__ */ jsx("div", { role: "rowgroup", className: "crewlet-tree-grid__head", children: /* @__PURE__ */ jsx("div", { role: "row", className: "crewlet-tree-grid__row", children: drawn.map((one, index) => /* @__PURE__ */ jsx(
398
+ GridHeadCell,
399
+ {
400
+ column: one,
401
+ colIndex: index + 1,
402
+ sort,
403
+ sortable: sortsBy(one) && onSortChange !== void 0,
404
+ onSort: () => headerClick(one),
405
+ hidden: one.headerHidden || one.action
406
+ },
407
+ one.key
408
+ )) }) }),
409
+ /* @__PURE__ */ jsx("div", { role: "rowgroup", className: "crewlet-tree-grid__body", children: rows.map((id) => {
410
+ const add = isAddRow(id);
411
+ const cells = add ? add.cells : drawn.length;
412
+ const expandable = treeExpandable(model, id);
413
+ const open = expanded.has(id);
414
+ const name = model.label.get(id) ?? "";
415
+ const href = add ? void 0 : rowHref?.(id);
416
+ return (
417
+ /* The row's keys are the GRID's, captured at the treegrid so
418
+ one handler serves every row and reaches a cell's control
419
+ first. A listener on the row itself would be a second
420
+ place for them to live. */
421
+ /* eslint-disable-next-line jsx-a11y/click-events-have-key-events -- see above */
422
+ /* @__PURE__ */ jsx(
423
+ "div",
424
+ {
425
+ role: "row",
426
+ "data-tree-id": id,
427
+ ref: rowRef(id),
428
+ tabIndex: id === active && column === null ? 0 : -1,
429
+ "aria-level": treeLevel(model, id),
430
+ "aria-setsize": treeSetSize(model, id),
431
+ "aria-posinset": treePosInSet(model, id),
432
+ "aria-expanded": expandable ? open : void 0,
433
+ "aria-selected": add ? void 0 : id === selectedId,
434
+ "aria-label": add ? add.label : void 0,
435
+ className: cx("crewlet-tree-grid__row", add && "crewlet-tree-grid__row--add"),
436
+ "data-linked": href !== void 0 || void 0,
437
+ "data-failed": !add && isFailed?.(id) || void 0,
438
+ style: { "--crewlet-tree-grid-depth": treeLevel(model, id) - 1 },
439
+ onClick: (event) => {
440
+ if (!event.currentTarget.contains(event.target)) return;
441
+ if (event.target.closest("button, input, label, [role='menu']")) return;
442
+ focusAt(id, null);
443
+ },
444
+ children: Array.from({ length: cells }, (_, index) => {
445
+ const col = index + 1;
446
+ const one = add ? void 0 : drawn[index];
447
+ const align = one ? alignOf(one) : "left";
448
+ return /* @__PURE__ */ jsxs(
449
+ "div",
450
+ {
451
+ role: "gridcell",
452
+ "aria-colindex": col,
453
+ tabIndex: stop(id, col) && !hasControl(id, col, drawn[col - 1]?.key ?? "") ? 0 : -1,
454
+ "data-size": one?.size === "sm" ? "sm" : void 0,
455
+ "data-label": one && !one.action && col > 1 ? headerWord(one) || one.label || void 0 : void 0,
456
+ className: cx(
457
+ "crewlet-tree-grid__cell",
458
+ align !== "left" && `crewlet-tree-grid__cell--${align}`,
459
+ one?.icon && "crewlet-tree-grid__cell--icon",
460
+ one?.shrink && "crewlet-tree-grid__cell--shrink",
461
+ one?.action && "crewlet-tree-grid__cell--action"
462
+ ),
463
+ children: [
464
+ col === 1 && href !== void 0 && /* THE ROW'S LINK, STRETCHED OVER IT, for the pointer:
465
+ a real href, so a new tab and copying it work. The
466
+ row is the keyboard's and the reader's way in (Enter
467
+ follows this), so the link is hidden from both. */
468
+ // eslint-disable-next-line jsx-a11y/anchor-has-content
469
+ /* @__PURE__ */ jsx(
470
+ "a",
471
+ {
472
+ className: "crewlet-tree-grid__row-link",
473
+ href,
474
+ tabIndex: -1,
475
+ "aria-hidden": "true",
476
+ ...rowLinkTitle
477
+ }
478
+ ),
479
+ col === 1 && /* THE PRESS LANDS ON THE ROW. The chevron is a
480
+ pointer-only control hidden from assistive
481
+ technology (the keyboard opens and closes a row
482
+ with Right and Left), and focus inside a hidden
483
+ subtree is focus nowhere, so the press is stopped
484
+ from focusing it and the row takes the focus. */
485
+ /* @__PURE__ */ jsx(
486
+ "span",
487
+ {
488
+ className: "crewlet-tree-grid__toggle",
489
+ "data-open": open ? "" : void 0,
490
+ "aria-hidden": "true",
491
+ ...grid.press(id),
492
+ children: expandable && /* @__PURE__ */ jsx(
493
+ IconButton,
494
+ {
495
+ size: "sm",
496
+ label: open ? text.collapse(name) : text.expand(name),
497
+ icon: /* @__PURE__ */ jsx(ChevronRightGlyph, {}),
498
+ tabIndex: -1,
499
+ onClick: () => toggle(id)
500
+ }
501
+ )
502
+ }
503
+ ),
504
+ col === 1 && renderIndent?.(id, grid),
505
+ col === 1 && selection && add === null && /* @__PURE__ */ jsx(TreeGridSelect, { id, selection, context: grid }),
506
+ renderCell(id, col, grid)
507
+ ]
508
+ },
509
+ col
510
+ );
511
+ })
512
+ },
513
+ id
514
+ )
515
+ );
516
+ }) })
517
+ ]
518
+ }
519
+ ),
520
+ /* @__PURE__ */ jsx(
521
+ GridFoot,
522
+ {
523
+ footer,
524
+ dropped: droppedNames(shownColumns, dropped, text.and),
525
+ loadedNote,
526
+ onLoadMore,
527
+ onReset: colsRaw && onColsChange ? () => onColsChange("") : void 0,
528
+ labels: text
529
+ }
530
+ )
531
+ ] }),
532
+ /* @__PURE__ */ jsx(LayerNodeBridge, { onNode: setLayer })
533
+ ] })
534
+ }
535
+ );
536
+ }
537
+ function TreeGridSelect({
538
+ id,
539
+ selection,
540
+ context
541
+ }) {
542
+ const checked = selection.checked(id);
543
+ return /* @__PURE__ */ jsx("span", { className: "crewlet-tree-grid__select", children: checked !== null && /* @__PURE__ */ jsx(
544
+ Checkbox,
545
+ {
546
+ hideLabel: true,
547
+ label: selection.label(id),
548
+ checked: checked === true,
549
+ indeterminate: checked === "mixed",
550
+ tabIndex: context.tabStop(id, 1) ? 0 : -1,
551
+ onClick: () => context.opened(id, 1),
552
+ onCheckedChange: (next) => selection.onCheckedChange(id, next)
553
+ }
554
+ ) });
555
+ }
556
+
557
+ export { TreeGrid };
@@ -1,6 +1,6 @@
1
1
  import { HuePicker } from './chunk-PJMDZEWY.js';
2
2
  import { Popover } from './chunk-LCAKSEMB.js';
3
- import { CharacterPicker } from './chunk-S4JRQJEP.js';
3
+ import { CharacterPicker } from './chunk-LNQSNXGJ.js';
4
4
  import { NODE_HUE_NAMES } from './chunk-AYKXMIOR.js';
5
5
  import { Avatar } from './chunk-XZY6S3UC.js';
6
6
  import { cx } from './chunk-ODEQTPFM.js';
@@ -1,6 +1,6 @@
1
1
  import { Timeline } from './chunk-ZDJQQ4LU.js';
2
2
  import { Section } from './chunk-WFCWPXJN.js';
3
- import { Composer } from './chunk-QCCWXOKK.js';
3
+ import { Composer } from './chunk-DK7CXQFY.js';
4
4
  import { Disclosure } from './chunk-NAHA62WD.js';
5
5
  import { ArtifactPanel } from './chunk-P667Y6NQ.js';
6
6
  import { Button } from './chunk-6KUOHUY5.js';
@@ -1,4 +1,4 @@
1
- import { Text } from './chunk-O5CEG7TQ.js';
1
+ import { Text } from './chunk-XLMURU75.js';
2
2
  import { Inline, Stack, Spacer } from './chunk-ZAC7SKUN.js';
3
3
  import { Card } from './chunk-U2IQNDDR.js';
4
4
  import { cx } from './chunk-ODEQTPFM.js';
@@ -1,5 +1,5 @@
1
1
  import { Select } from './chunk-IAR2ULSK.js';
2
- import { Combobox } from './chunk-CRRW4UGJ.js';
2
+ import { Combobox } from './chunk-AC255TMQ.js';
3
3
  import { FormField, Textarea, InputAffix } from './chunk-56ES76ST.js';
4
4
  import './Input-WSMB7JG2.css';
5
5
  import './VisuallyHidden-AOEXU5EB.css';
@@ -1,4 +1,4 @@
1
- import { Combobox } from './chunk-CRRW4UGJ.js';
1
+ import { Combobox } from './chunk-AC255TMQ.js';
2
2
  import { PRINCIPAL_KINDS, PrincipalAvatar } from './chunk-HF5L56YQ.js';
3
3
  import { cx } from './chunk-ODEQTPFM.js';
4
4
  import './PrincipalPicker-P6UYHDJR.css';
@@ -1,4 +1,4 @@
1
- import { EditingStatus } from './chunk-I2GJLUU3.js';
1
+ import { EditingStatus } from './chunk-OU6ZSWEJ.js';
2
2
  import { Kbd } from './chunk-CMAZZY2I.js';
3
3
  import { Button } from './chunk-6KUOHUY5.js';
4
4
  import { isComposing } from './chunk-TUEM2XIW.js';