@crewlethq/ui 0.126.3 → 0.128.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 (117) hide show
  1. package/README.md +16 -0
  2. package/dist/ActivityLine/index.js +3 -3
  3. package/dist/AgentHandoffPanel/index.js +7 -7
  4. package/dist/AppShell/index.js +3 -3
  5. package/dist/ArtifactCard/index.js +3 -3
  6. package/dist/Avatar/index.js +1 -1
  7. package/dist/{Avatar-CRSLRUVT.css → Avatar-RHFI55UZ.css} +14 -0
  8. package/dist/{AvatarStack-GNEJHEU6.css → AvatarStack-UNBXFHTZ.css} +14 -1
  9. package/dist/Canvas/Canvas.d.ts +12 -1
  10. package/dist/Canvas/index.d.ts +1 -1
  11. package/dist/Canvas/index.js +1 -1
  12. package/dist/CanvasBoard/index.js +3 -3
  13. package/dist/CanvasToolbar/index.js +2 -2
  14. package/dist/ChatThread/index.js +3 -3
  15. package/dist/Clamp/Clamp.d.ts +50 -0
  16. package/dist/Clamp/index.d.ts +3 -0
  17. package/dist/Clamp/index.js +12 -0
  18. package/dist/Clamp-Q5WKCGWY.css +60 -0
  19. package/dist/Combobox/index.js +2 -2
  20. package/dist/CommandPalette/index.js +5 -5
  21. package/dist/CommentThread/index.js +7 -7
  22. package/dist/Composer/index.js +3 -3
  23. package/dist/DataGrid/index.js +3 -3
  24. package/dist/DataTable/index.js +4 -4
  25. package/dist/DataView/index.js +6 -6
  26. package/dist/DeliveryReceipt/DeliveryReceipt.d.ts +37 -24
  27. package/dist/DeliveryReceipt/index.js +1 -2
  28. package/dist/{DeliveryReceipt-G55ILD6O.css → DeliveryReceipt-BILVVNTO.css} +11 -14
  29. package/dist/DocTabsEditor/index.js +4 -4
  30. package/dist/DockColumn/index.js +1 -1
  31. package/dist/EntityChip/index.js +1 -1
  32. package/dist/GraphCanvas/GraphCanvas.d.ts +35 -6
  33. package/dist/GraphCanvas/index.d.ts +1 -1
  34. package/dist/GraphCanvas/index.js +3 -3
  35. package/dist/{GraphCanvas-V4VJADVF.css → GraphCanvas-R242DSDH.css} +17 -0
  36. package/dist/ImageUpload/index.js +1 -1
  37. package/dist/KeyValueRows/index.js +3 -3
  38. package/dist/ListInput/index.js +4 -4
  39. package/dist/OrgLabel/index.js +1 -1
  40. package/dist/OrgNode/index.js +1 -1
  41. package/dist/OrgTable/index.js +6 -6
  42. package/dist/PeopleRail/index.js +1 -1
  43. package/dist/PresenceStack/index.js +1 -1
  44. package/dist/Principal/index.js +1 -1
  45. package/dist/PrincipalPicker/index.js +4 -4
  46. package/dist/ProposalCard/index.js +3 -3
  47. package/dist/RailList/index.js +5 -5
  48. package/dist/RichEditor/index.js +1 -1
  49. package/dist/SectionFrame/index.js +3 -3
  50. package/dist/Select/index.js +2 -2
  51. package/dist/SendKeys/index.js +2 -2
  52. package/dist/SetupWizard/index.js +1 -1
  53. package/dist/ShareDialog/index.js +6 -6
  54. package/dist/SheetColumnEditor/index.js +7 -7
  55. package/dist/SheetGrid/index.js +1 -1
  56. package/dist/SidebarNav/index.js +2 -2
  57. package/dist/SlideFilmstrip/index.js +4 -4
  58. package/dist/Switcher/index.js +2 -2
  59. package/dist/TableCells/index.js +1 -1
  60. package/dist/ThreadSummary/ThreadSummary.d.ts +24 -16
  61. package/dist/ThreadSummary/index.js +2 -2
  62. package/dist/{ThreadSummary-2AFEU6NH.css → ThreadSummary-3AODTHAM.css} +44 -35
  63. package/dist/TimeRangePicker/index.js +4 -4
  64. package/dist/TimeWindowPicker/index.js +5 -5
  65. package/dist/TreeCanvas/index.js +4 -4
  66. package/dist/TreeGrid/index.js +4 -4
  67. package/dist/ValueField/index.js +4 -4
  68. package/dist/VersionTimeline/index.js +1 -1
  69. package/dist/WorkingLine/index.js +2 -2
  70. package/dist/{chunk-C7BHAZVR.js → chunk-26TNM64L.js} +2 -2
  71. package/dist/{chunk-ZJQNN7ZJ.js → chunk-556M2A4S.js} +1 -1
  72. package/dist/{chunk-4QDFH4AA.js → chunk-56WQTRIW.js} +1 -1
  73. package/dist/{chunk-YNREHSBZ.js → chunk-66TVD3RU.js} +1 -1
  74. package/dist/{chunk-P47YVFX6.js → chunk-6LG6JJSW.js} +2 -2
  75. package/dist/{chunk-DL6Y7SVB.js → chunk-7GGX7TDB.js} +2 -2
  76. package/dist/{chunk-5UNIA2VJ.js → chunk-7VBZDGOS.js} +2 -2
  77. package/dist/{chunk-5SMYKL3D.js → chunk-ARZGEHWE.js} +2 -2
  78. package/dist/{chunk-NZFYX5UF.js → chunk-AVH6XN2O.js} +1 -1
  79. package/dist/{chunk-VCFV7FTE.js → chunk-BZVQ7KTX.js} +1 -1
  80. package/dist/{chunk-GKHZSNIV.js → chunk-CVNJ6VHK.js} +7 -3
  81. package/dist/{chunk-GQPKDPMS.js → chunk-ELV2BL4R.js} +2 -2
  82. package/dist/{chunk-BG4GI5W3.js → chunk-FNJCCVQX.js} +1 -1
  83. package/dist/chunk-GTNXDLYH.js +146 -0
  84. package/dist/{chunk-T2FJN6C6.js → chunk-GVDV4X43.js} +1 -1
  85. package/dist/{chunk-2S3J5LEN.js → chunk-ICIJUGKK.js} +3 -3
  86. package/dist/chunk-IZGB6SQE.js +89 -0
  87. package/dist/{chunk-NSUMHNUS.js → chunk-LETSZEMX.js} +1 -1
  88. package/dist/{chunk-EFY7R766.js → chunk-LPP2PMKP.js} +1 -1
  89. package/dist/{chunk-VIS6DKGQ.js → chunk-NB2QYDYA.js} +1 -1
  90. package/dist/{chunk-SFO4KY65.js → chunk-OYKQVTJB.js} +1 -1
  91. package/dist/{chunk-5GIBHRCS.js → chunk-PAK2FUDN.js} +2 -2
  92. package/dist/{chunk-QDXSBVZR.js → chunk-PCSIMBUQ.js} +2 -2
  93. package/dist/{chunk-CWHFC7FS.js → chunk-R4LHYCZN.js} +36 -32
  94. package/dist/{chunk-I5HJ6Y6E.js → chunk-U4HA6LRQ.js} +8 -14
  95. package/dist/{chunk-BF3PFRBE.js → chunk-Y54H5NJO.js} +1 -1
  96. package/dist/generated/index.d.ts +1 -0
  97. package/dist/generated/index.js +79 -78
  98. package/dist/index.js +79 -78
  99. package/dist/styles.css +168 -55
  100. package/package.json +3 -3
  101. package/dist/chunk-WNPKXYDJ.js +0 -141
  102. package/dist/{Editor-CTZXT2FC.js → Editor-UIBCHECM.js} +2 -2
  103. package/dist/{chunk-QV3WVNRA.js → chunk-2KUAO2CX.js} +0 -0
  104. package/dist/{chunk-Z64KEJ3N.js → chunk-2ZO7WP3T.js} +2 -2
  105. package/dist/{chunk-PYF5DNOK.js → chunk-6RMR2YYQ.js} +1 -1
  106. package/dist/{chunk-4OKNZZ5E.js → chunk-7AAM3PCB.js} +1 -1
  107. package/dist/{chunk-SM2MM4DQ.js → chunk-BS5DASEB.js} +1 -1
  108. package/dist/{chunk-CPWSBK3F.js → chunk-COPAHZHK.js} +1 -1
  109. package/dist/{chunk-KTKPC3CV.js → chunk-CRXNGDYG.js} +1 -1
  110. package/dist/{chunk-WUJ54OTI.js → chunk-CWGZE3JW.js} +1 -1
  111. package/dist/{chunk-3R7AB45M.js → chunk-FXKRSBUM.js} +1 -1
  112. package/dist/{chunk-TLZ7NG6T.js → chunk-HGL7HMBZ.js} +1 -1
  113. package/dist/{chunk-EOMLCNC4.js → chunk-LLPDEZT5.js} +1 -1
  114. package/dist/{chunk-TU6IC2XD.js → chunk-RE6MXNIM.js} +1 -1
  115. package/dist/{chunk-Q7WKCU2U.js → chunk-U56B2BAX.js} +1 -1
  116. package/dist/{chunk-6ZFQ6TAM.js → chunk-YKCLV77Z.js} +1 -1
  117. package/dist/{chunk-UZMXC5T6.js → chunk-YUVQUJND.js} +1 -1
@@ -0,0 +1,146 @@
1
+ import { cx } from './chunk-ODEQTPFM.js';
2
+ import './ChatScale-LGESYXCO.css';
3
+ import './DeliveryReceipt-BILVVNTO.css';
4
+ import { useState } from 'react';
5
+ import { TriangleAlertGlyph, CheckGlyph } from '@crewlethq/icons/glyphs';
6
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
7
+
8
+ function andList(names) {
9
+ if (names.length <= 1) return names[0] ?? "";
10
+ return `${names.slice(0, -1).join(", ")} and ${names[names.length - 1]}`;
11
+ }
12
+ var DELIVERY_RECEIPT_LABELS = {
13
+ reached: (who) => /* @__PURE__ */ jsxs(Fragment, { children: [
14
+ "Reached ",
15
+ who
16
+ ] }),
17
+ reachedAnswered: (who, count) => /* @__PURE__ */ jsxs(Fragment, { children: [
18
+ "Reached ",
19
+ who,
20
+ ", who ",
21
+ count === 2 ? "both " : count > 2 ? "all " : "",
22
+ "answered"
23
+ ] }),
24
+ partlyAnswered: (answered, waiting) => /* @__PURE__ */ jsxs(Fragment, { children: [
25
+ answered,
26
+ " answered, waiting on ",
27
+ waiting
28
+ ] }),
29
+ reaches: (who) => /* @__PURE__ */ jsxs(Fragment, { children: [
30
+ "Will reach ",
31
+ who
32
+ ] }),
33
+ none: "Reached no agent",
34
+ noneDraft: "Will reach no agent",
35
+ list: andList,
36
+ reason: (words) => `(${words})`,
37
+ groups: (groups) => groups.join("; "),
38
+ truncated: "Some seats were not reached",
39
+ more: (count) => `and ${count} more`,
40
+ fewer: "Show fewer"
41
+ };
42
+ function DeliveryReceipt({
43
+ recipients,
44
+ tense = "sent",
45
+ truncated = false,
46
+ hint,
47
+ announce = false,
48
+ max = 1,
49
+ labels: overrides,
50
+ className,
51
+ ...rest
52
+ }) {
53
+ if (max !== Infinity && (!Number.isInteger(max) || max < 1)) {
54
+ throw new RangeError(
55
+ `DeliveryReceipt max must be a whole number of at least 1; it was ${max}`
56
+ );
57
+ }
58
+ const [expanded, setExpanded] = useState(false);
59
+ const labels = overrides ? { ...DELIVERY_RECEIPT_LABELS, ...overrides } : DELIVERY_RECEIPT_LABELS;
60
+ const cap = expanded ? Infinity : max;
61
+ const none = recipients.length === 0;
62
+ const answered = tense === "sent" ? recipients.filter((r) => r.answered) : [];
63
+ const waiting = tense === "sent" ? recipients.filter((r) => !r.answered) : recipients;
64
+ let capped = false;
65
+ const toggle = (count) => /* @__PURE__ */ jsx(
66
+ "button",
67
+ {
68
+ type: "button",
69
+ className: "crewlet-delivery-receipt__more",
70
+ "aria-expanded": expanded,
71
+ onClick: () => setExpanded((was) => !was),
72
+ children: expanded ? labels.fewer : labels.more(count)
73
+ }
74
+ );
75
+ const seats = (list, withReasons) => {
76
+ const shown = list.length > cap + 1 ? list.slice(0, cap) : list;
77
+ const hidden = list.length - shown.length;
78
+ if (hidden > 0) capped = true;
79
+ const order = [];
80
+ const byReason = /* @__PURE__ */ new Map();
81
+ for (const r of shown) {
82
+ const key = withReasons ? r.reason ?? "" : "";
83
+ const names = byReason.get(key);
84
+ if (names) names.push(r.name);
85
+ else {
86
+ order.push(key);
87
+ byReason.set(key, [r.name]);
88
+ }
89
+ }
90
+ const words = labels.groups(
91
+ order.map((key) => {
92
+ const names = byReason.get(key) ?? [];
93
+ const joined = hidden > 0 ? names.join(", ") : labels.list(names);
94
+ return key ? `${joined} ${labels.reason(key)}` : joined;
95
+ })
96
+ );
97
+ return hidden > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
98
+ words,
99
+ " ",
100
+ toggle(hidden)
101
+ ] }) : words;
102
+ };
103
+ let sentence;
104
+ if (none) sentence = tense === "draft" ? labels.noneDraft : labels.none;
105
+ else if (tense === "draft") sentence = labels.reaches(seats(recipients, true));
106
+ else if (answered.length === 0) sentence = labels.reached(seats(recipients, true));
107
+ else if (waiting.length === 0)
108
+ sentence = labels.reachedAnswered(seats(recipients, true), answered.length);
109
+ else sentence = labels.partlyAnswered(seats(answered, false), seats(waiting, true));
110
+ const fewer = expanded && !capped ? toggle(0) : null;
111
+ const after = [];
112
+ if (truncated && !none) after.push({ key: "truncated", words: labels.truncated });
113
+ if (none && hint)
114
+ after.push({ key: "hint", className: "crewlet-delivery-receipt__hint", words: hint });
115
+ const mark = none ? /* @__PURE__ */ jsx(TriangleAlertGlyph, { size: "xs" }) : answered.length > 0 ? /* @__PURE__ */ jsx(CheckGlyph, { size: "xs" }) : null;
116
+ return /* @__PURE__ */ jsxs(
117
+ "p",
118
+ {
119
+ ...rest,
120
+ role: announce ? "status" : void 0,
121
+ "data-tense": tense,
122
+ className: cx(
123
+ "crewlet-delivery-receipt",
124
+ none && "crewlet-delivery-receipt--none",
125
+ answered.length > 0 && "crewlet-delivery-receipt--answered",
126
+ className
127
+ ),
128
+ children: [
129
+ mark ? /* @__PURE__ */ jsx("span", { className: "crewlet-delivery-receipt__mark", "aria-hidden": "true", children: mark }) : null,
130
+ /* @__PURE__ */ jsxs("span", { className: "crewlet-delivery-receipt__words", children: [
131
+ sentence,
132
+ fewer ? /* @__PURE__ */ jsxs(Fragment, { children: [
133
+ " ",
134
+ fewer
135
+ ] }) : null,
136
+ after.map((part) => /* @__PURE__ */ jsxs("span", { className: part.className, children: [
137
+ ". ",
138
+ part.words
139
+ ] }, part.key))
140
+ ] })
141
+ ]
142
+ }
143
+ );
144
+ }
145
+
146
+ export { DELIVERY_RECEIPT_LABELS, DeliveryReceipt };
@@ -1,5 +1,5 @@
1
1
  import { Toolbar } from './chunk-NPEI2QAN.js';
2
- import { ShortcutTip } from './chunk-GKHZSNIV.js';
2
+ import { ShortcutTip } from './chunk-CVNJ6VHK.js';
3
3
  import { IconButton } from './chunk-X5YI6E5X.js';
4
4
  import { cx } from './chunk-ODEQTPFM.js';
5
5
  import './CanvasToolbar-EM5EVZED.css';
@@ -1,12 +1,12 @@
1
- import { Select } from './chunk-6ZFQ6TAM.js';
1
+ import { Select } from './chunk-YKCLV77Z.js';
2
2
  import { SHEET_LABELS, SHEET_COLUMN_TYPES, optionHue, retypeColumn } from './chunk-LFSIKGRQ.js';
3
3
  import { HueSwatch } from './chunk-GHRCG45F.js';
4
4
  import { NODE_HUES, NODE_HUE_NAMES } from './chunk-AYKXMIOR.js';
5
- import { Checkbox } from './chunk-KFTVPWG2.js';
6
5
  import { Menu } from './chunk-FIQGLZ5Q.js';
7
- import { FormField, Input } from './chunk-NN44J7BP.js';
6
+ import { Checkbox } from './chunk-KFTVPWG2.js';
8
7
  import { Kbd } from './chunk-VBBLHS2Y.js';
9
8
  import { Button } from './chunk-M2M6ZD7P.js';
9
+ import { FormField, Input } from './chunk-NN44J7BP.js';
10
10
  import { IconButton } from './chunk-X5YI6E5X.js';
11
11
  import { VisuallyHidden } from './chunk-RRRK2KB6.js';
12
12
  import { cx } from './chunk-ODEQTPFM.js';
@@ -0,0 +1,89 @@
1
+ import { Button } from './chunk-M2M6ZD7P.js';
2
+ import { cx } from './chunk-ODEQTPFM.js';
3
+ import './Clamp-Q5WKCGWY.css';
4
+ import { useState, useCallback, useRef, useId, useLayoutEffect } from 'react';
5
+ import { ChevronUpGlyph, ChevronDownGlyph } from '@crewlethq/icons/glyphs';
6
+ import { jsxs, jsx } from 'react/jsx-runtime';
7
+
8
+ var CLAMP_LABELS = {
9
+ more: "Show more",
10
+ less: "Show less"
11
+ };
12
+ var CLAMP_SLACK = 1.25;
13
+ function Clamp({
14
+ height = "20rem",
15
+ open: controlled,
16
+ defaultOpen = false,
17
+ onOpenChange,
18
+ labels: overrides,
19
+ className,
20
+ style,
21
+ onFocusCapture,
22
+ children,
23
+ ...rest
24
+ }) {
25
+ const labels = overrides ? { ...CLAMP_LABELS, ...overrides } : CLAMP_LABELS;
26
+ const [uncontrolled, setUncontrolled] = useState(defaultOpen);
27
+ const open = controlled ?? uncontrolled;
28
+ const setOpen = useCallback(
29
+ (next) => {
30
+ if (controlled === void 0) setUncontrolled(next);
31
+ onOpenChange?.(next);
32
+ },
33
+ [controlled, onOpenChange]
34
+ );
35
+ const body = useRef(null);
36
+ const content = useRef(null);
37
+ const fold = useRef(null);
38
+ const id = useId();
39
+ const [long, setLong] = useState(false);
40
+ useLayoutEffect(() => {
41
+ const inner = content.current;
42
+ const mark = fold.current;
43
+ if (!inner || !mark) return;
44
+ const measure = () => {
45
+ const limit = mark.offsetHeight;
46
+ setLong(limit > 0 && inner.offsetHeight > limit * CLAMP_SLACK);
47
+ };
48
+ measure();
49
+ if (typeof ResizeObserver !== "function") return;
50
+ const observer = new ResizeObserver(measure);
51
+ observer.observe(inner);
52
+ observer.observe(mark);
53
+ return () => observer.disconnect();
54
+ }, [height]);
55
+ const state = !long ? "whole" : open ? "open" : "folded";
56
+ return /* @__PURE__ */ jsxs(
57
+ "div",
58
+ {
59
+ ...rest,
60
+ className: cx("crewlet-clamp", className),
61
+ "data-state": state,
62
+ style: { "--crewlet-clamp-height": height, ...style },
63
+ onFocusCapture: (event) => {
64
+ onFocusCapture?.(event);
65
+ if (state === "folded" && body.current?.contains(event.target)) setOpen(true);
66
+ },
67
+ children: [
68
+ /* @__PURE__ */ jsx("span", { ref: fold, className: "crewlet-clamp__fold", "aria-hidden": "true" }),
69
+ /* @__PURE__ */ jsx("div", { ref: body, id, className: "crewlet-clamp__body", children: /* @__PURE__ */ jsx("div", { ref: content, className: "crewlet-clamp__content", children }) }),
70
+ long ? /* @__PURE__ */ jsx(
71
+ Button,
72
+ {
73
+ className: "crewlet-clamp__toggle",
74
+ variant: "ghost",
75
+ size: "small",
76
+ flush: true,
77
+ "aria-expanded": open,
78
+ "aria-controls": id,
79
+ leadingIcon: open ? /* @__PURE__ */ jsx(ChevronUpGlyph, { size: "sm" }) : /* @__PURE__ */ jsx(ChevronDownGlyph, { size: "sm" }),
80
+ onClick: () => setOpen(!open),
81
+ children: open ? labels.less : labels.more
82
+ }
83
+ ) : null
84
+ ]
85
+ }
86
+ );
87
+ }
88
+
89
+ export { CLAMP_LABELS, Clamp };
@@ -1,4 +1,4 @@
1
- import { Combobox } from './chunk-WUJ54OTI.js';
1
+ import { Combobox } from './chunk-CWGZE3JW.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 { SidebarNav } from './chunk-SM2MM4DQ.js';
1
+ import { SidebarNav } from './chunk-BS5DASEB.js';
2
2
  import { VisuallyHidden } from './chunk-RRRK2KB6.js';
3
3
  import { cx } from './chunk-ODEQTPFM.js';
4
4
  import './SectionFrame-M62UUVFQ.css';
@@ -1,5 +1,5 @@
1
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-CPWSBK3F.js';
2
+ import { GRID_FOOT_LABELS, parseGridSort, overrunning, squeezedCells, fitGridColumns, tableTrack, GRID_ICON_TRACK, GridHeadCell, alignOf, rowLinkTitle, headerWord, GridFoot, droppedNames, nextGridSort, sortByValue } from './chunk-COPAHZHK.js';
3
3
  import { LayerNodeBridge } from './chunk-X4HBZSXA.js';
4
4
  import { Checkbox } from './chunk-KFTVPWG2.js';
5
5
  import { EmptyState } from './chunk-PPUR46MK.js';
@@ -1,4 +1,4 @@
1
- import { AvatarStack } from './chunk-5SMYKL3D.js';
1
+ import { AvatarStack } from './chunk-ARZGEHWE.js';
2
2
  import { Avatar } from './chunk-XZY6S3UC.js';
3
3
  import { VisuallyHidden } from './chunk-RRRK2KB6.js';
4
4
  import { cx } from './chunk-ODEQTPFM.js';
@@ -3,10 +3,10 @@ import { PrincipalAvatar } from './chunk-HF5L56YQ.js';
3
3
  import { RelativeTime } from './chunk-GBKBME7Q.js';
4
4
  import { Card } from './chunk-RABEMWTA.js';
5
5
  import { ArtifactKindGround } from './chunk-W3A6NBUM.js';
6
- import { Checkbox } from './chunk-KFTVPWG2.js';
7
6
  import { ArtifactAccessGlyph } from './chunk-DOY3KC6I.js';
8
7
  import { ArtifactKindGlyph } from './chunk-RSKW25Y5.js';
9
- import { AvatarStack } from './chunk-5SMYKL3D.js';
8
+ import { Checkbox } from './chunk-KFTVPWG2.js';
9
+ import { AvatarStack } from './chunk-ARZGEHWE.js';
10
10
  import { VisuallyHidden } from './chunk-RRRK2KB6.js';
11
11
  import { cx } from './chunk-ODEQTPFM.js';
12
12
  import './ArtifactKinds-27TE3KJL.css';
@@ -1,5 +1,5 @@
1
- import { Select } from './chunk-6ZFQ6TAM.js';
2
- import { Combobox } from './chunk-WUJ54OTI.js';
1
+ import { Select } from './chunk-YKCLV77Z.js';
2
+ import { Combobox } from './chunk-CWGZE3JW.js';
3
3
  import { FormField, Textarea, InputAffix } from './chunk-NN44J7BP.js';
4
4
  import './Input-YVCNNTYT.css';
5
5
  import './VisuallyHidden-OUYVMKEH.css';
@@ -1,12 +1,12 @@
1
1
  import { useMeasuredSizes, isTypeAheadKey, typeAheadBuffer } from './chunk-MY374UUD.js';
2
- import { FilterChip } from './chunk-L6HUVA33.js';
3
2
  import { FullscreenToggle } from './chunk-3JLG6KRU.js';
4
- import { fitView, CANVAS_FIT_PADDING, Canvas } from './chunk-GKHZSNIV.js';
3
+ import { FilterChip } from './chunk-L6HUVA33.js';
4
+ import { CANVAS_FIT_PADDING, Canvas } from './chunk-CVNJ6VHK.js';
5
5
  import { Text } from './chunk-475DOAWF.js';
6
6
  import { LayerHost } from './chunk-FIX72ZEC.js';
7
7
  import { VisuallyHidden } from './chunk-RRRK2KB6.js';
8
8
  import { cx } from './chunk-ODEQTPFM.js';
9
- import './GraphCanvas-V4VJADVF.css';
9
+ import './GraphCanvas-R242DSDH.css';
10
10
  import { memo, useMemo, useId, useState, useCallback, useRef, useEffect, useLayoutEffect, useImperativeHandle } from 'react';
11
11
  import { ChevronDownGlyph, ChevronRightGlyph, TriangleAlertGlyph, CircleAlertGlyph, InfoGlyph } from '@crewlethq/icons/glyphs';
12
12
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
@@ -1008,7 +1008,18 @@ function graphDetail(zoom) {
1008
1008
  if (zoom >= GRAPH_CANVAS_DETAIL_ZOOM) return "cards";
1009
1009
  return zoom >= GRAPH_CANVAS_TILE_ZOOM ? "tiles" : "marks";
1010
1010
  }
1011
- var GRAPH_CANVAS_OPEN_ZOOM = 0.75;
1011
+ var GRAPH_CANVAS_FOCUS_ZOOM = 0.75;
1012
+ function graphFocusView(item, room, fit) {
1013
+ const across = (room.width - 2 * CANVAS_FIT_PADDING) / item.width;
1014
+ const down = (room.height - 2 * CANVAS_FIT_PADDING) / item.height;
1015
+ const k = Math.min(GRAPH_CANVAS_FOCUS_ZOOM, across, down);
1016
+ if (!(k > fit.k)) return null;
1017
+ return {
1018
+ k,
1019
+ x: room.x + room.width / 2 - (item.x + item.width / 2) * k,
1020
+ y: room.y + room.height / 2 - (item.y + item.height / 2) * k
1021
+ };
1022
+ }
1012
1023
  var GRAPH_CANVAS_FIT_FLOOR = 0.02;
1013
1024
  var GRAPH_CANVAS_FLOW_LIMIT = 160;
1014
1025
  var ZOOM_PROPERTY = "--crewlet-graph-canvas-zoom";
@@ -1066,6 +1077,7 @@ function GraphCanvas({
1066
1077
  minZoom = GRAPH_CANVAS_FIT_FLOOR,
1067
1078
  fitKey,
1068
1079
  initialView,
1080
+ initialNode = null,
1069
1081
  onViewChange,
1070
1082
  ref,
1071
1083
  className
@@ -1128,8 +1140,8 @@ function GraphCanvas({
1128
1140
  };
1129
1141
  }, [measured, sizes]);
1130
1142
  const emptyLanes = useMemo(() => {
1131
- const filled = new Set(nodes.map((node) => node.lane));
1132
- return bands.flatMap((band) => band.lanes.filter((lane) => !filled.has(lane.id)));
1143
+ const filled2 = new Set(nodes.map((node) => node.lane));
1144
+ return bands.flatMap((band) => band.lanes.filter((lane) => !filled2.has(lane.id)));
1133
1145
  }, [bands, nodes]);
1134
1146
  const emptyHeights = useMemo(() => {
1135
1147
  const out = /* @__PURE__ */ new Map();
@@ -1342,7 +1354,7 @@ function GraphCanvas({
1342
1354
  };
1343
1355
  useLayoutEffect(() => placeCardNow.current());
1344
1356
  const root = useRef(null);
1345
- const [frame, setFrame] = useState(null);
1357
+ const [sized, setSized] = useState(false);
1346
1358
  const [narrow, setNarrow] = useState(false);
1347
1359
  useLayoutEffect(() => {
1348
1360
  const el = root.current;
@@ -1350,33 +1362,19 @@ function GraphCanvas({
1350
1362
  const observer = new ResizeObserver((entries) => {
1351
1363
  const box = entries[entries.length - 1]?.contentRect;
1352
1364
  if (!box || box.width <= 0 || box.height <= 0) return;
1353
- setFrame((was) => was ?? { width: box.width, height: box.height });
1365
+ setSized(true);
1354
1366
  setNarrow(box.width < GRAPH_CANVAS_NARROW_WIDTH);
1355
1367
  });
1356
1368
  observer.observe(el);
1357
1369
  return () => observer.disconnect();
1358
1370
  }, []);
1359
- const [barsBottom, setBarsBottom] = useState(0);
1360
- useLayoutEffect(() => {
1361
- const el = root.current;
1362
- if (!el || !frame) return;
1363
- const top = el.getBoundingClientRect().top;
1364
- let bottom = 0;
1365
- for (const bar2 of el.querySelectorAll(".crewlet-canvas__controls")) {
1366
- const rect = bar2.getBoundingClientRect();
1367
- if (rect.height > 0 && rect.top - top < frame.height / 2) bottom = Math.max(bottom, rect.bottom - top);
1368
- }
1369
- setBarsBottom(bottom);
1370
- }, [frame, controlsStart, controlsPlacement]);
1371
+ const openKey = initialNode === null || !layout ? void 0 : layout.itemOfNode.get(initialNode);
1372
+ const openOn = openKey === void 0 ? void 0 : layout?.itemByKey.get(openKey);
1371
1373
  const opening = useMemo(() => {
1372
1374
  if (initialView) return initialView;
1373
- if (!layout || !frame) return void 0;
1374
- const fit = fitView(layout.bounds, frame, CANVAS_FIT_PADDING, minZoom);
1375
- if (fit.k >= GRAPH_CANVAS_DETAIL_ZOOM) return void 0;
1376
- const k = GRAPH_CANVAS_OPEN_ZOOM;
1377
- const y = Math.max(CANVAS_FIT_PADDING, barsBottom + CANVAS_FIT_PADDING / 2);
1378
- return { k, x: CANVAS_FIT_PADDING - layout.bounds.x * k, y: y - layout.bounds.y * k };
1379
- }, [initialView, layout, frame, minZoom, barsBottom]);
1375
+ if (!openOn) return void 0;
1376
+ return (room, fit) => graphFocusView(openOn, room, fit);
1377
+ }, [initialView, openOn]);
1380
1378
  const [active, setActive] = useState(null);
1381
1379
  const selectedKey = selectedId === null || !layout ? null : layout.itemOfNode.get(selectedId) ?? null;
1382
1380
  const activeKey = active !== null && layout?.itemByKey.has(active) ? active : selectedKey ?? layout?.lanes.find((lane) => lane.items.length > 0)?.items[0] ?? null;
@@ -1451,19 +1449,24 @@ function GraphCanvas({
1451
1449
  }),
1452
1450
  [focusItem]
1453
1451
  );
1452
+ const filled = nodes.length > 0;
1454
1453
  const fittedFor = useRef(fitKey);
1454
+ const fittedFilled = useRef(false);
1455
1455
  const placedOnce = useRef(false);
1456
1456
  useLayoutEffect(() => {
1457
1457
  if (!placed) return;
1458
1458
  if (!placedOnce.current) {
1459
1459
  placedOnce.current = true;
1460
1460
  fittedFor.current = fitKey;
1461
+ fittedFilled.current = filled;
1461
1462
  return;
1462
1463
  }
1463
- if (fitKey === fittedFor.current) return;
1464
+ const firstEntries = filled && !fittedFilled.current;
1465
+ if (fitKey === fittedFor.current && !firstEntries) return;
1464
1466
  fittedFor.current = fitKey;
1467
+ if (filled) fittedFilled.current = true;
1465
1468
  canvas.current?.fit();
1466
- }, [fitKey, placed]);
1469
+ }, [fitKey, placed, filled]);
1467
1470
  const typed = useRef({ text: "", at: 0 });
1468
1471
  const activate = useCallback(
1469
1472
  (item, focus) => {
@@ -1685,7 +1688,7 @@ function GraphCanvas({
1685
1688
  dock ? /* @__PURE__ */ jsx("div", { className: "crewlet-graph-canvas__dock", children: dock }) : null,
1686
1689
  legend
1687
1690
  ] }) : null;
1688
- const body = frame ? /* @__PURE__ */ jsxs(
1691
+ const body = sized ? /* @__PURE__ */ jsxs(
1689
1692
  Canvas,
1690
1693
  {
1691
1694
  label,
@@ -1703,6 +1706,7 @@ function GraphCanvas({
1703
1706
  largestItemWidth: metrics?.cardWidth,
1704
1707
  labels: text,
1705
1708
  minZoom,
1709
+ refitOnResize: true,
1706
1710
  initialView: opening,
1707
1711
  onViewChange: viewChanged,
1708
1712
  children: [
@@ -2066,7 +2070,7 @@ function GraphEmptyLane({
2066
2070
  if (event.target === event.currentTarget) onFocusItem(itemKey);
2067
2071
  },
2068
2072
  onKeyDown: onItemKey,
2069
- children
2073
+ children: /* @__PURE__ */ jsx("span", { className: "crewlet-graph-canvas__empty-words", children })
2070
2074
  }
2071
2075
  )
2072
2076
  );
@@ -2159,4 +2163,4 @@ function typeAhead(layout, from, text, nameOf) {
2159
2163
  return null;
2160
2164
  }
2161
2165
 
2162
- export { GRAPH_CANVAS_DETAIL_ZOOM, GRAPH_CANVAS_FIT_FLOOR, GRAPH_CANVAS_FLOW_LIMIT, GRAPH_CANVAS_LABELS, GRAPH_CANVAS_NARROW_WIDTH, GRAPH_CANVAS_OPEN_ZOOM, GRAPH_CANVAS_TILE_ZOOM, GRAPH_EDGE_FAMILIES, GRAPH_ORDER_SWEEPS, GraphCanvas, graphDetail, graphItemKey, graphNeighbourhood, graphReach, graphStep, graphTrunks, graphWindow, layoutGraph, routeGraphEdges };
2166
+ export { GRAPH_CANVAS_DETAIL_ZOOM, GRAPH_CANVAS_FIT_FLOOR, GRAPH_CANVAS_FLOW_LIMIT, GRAPH_CANVAS_FOCUS_ZOOM, GRAPH_CANVAS_LABELS, GRAPH_CANVAS_NARROW_WIDTH, GRAPH_CANVAS_TILE_ZOOM, GRAPH_EDGE_FAMILIES, GRAPH_ORDER_SWEEPS, GraphCanvas, graphDetail, graphFocusView, graphItemKey, graphNeighbourhood, graphReach, graphStep, graphTrunks, graphWindow, layoutGraph, routeGraphEdges };
@@ -1,18 +1,16 @@
1
1
  import { Tag } from './chunk-SJ3EUCFD.js';
2
- import { AvatarStack } from './chunk-5SMYKL3D.js';
2
+ import { AvatarStack } from './chunk-ARZGEHWE.js';
3
3
  import { cx } from './chunk-ODEQTPFM.js';
4
4
  import './ChatScale-LGESYXCO.css';
5
- import './ThreadSummary-2AFEU6NH.css';
5
+ import './ThreadSummary-3AODTHAM.css';
6
6
  import { ChevronRightGlyph } from '@crewlethq/icons/glyphs';
7
7
  import { jsxs, jsx } from 'react/jsx-runtime';
8
8
 
9
- var THREAD_SUMMARY_FACE = 24;
9
+ var THREAD_SUMMARY_FACE = "xs";
10
10
  var THREAD_SUMMARY_LABELS = {
11
11
  replies: (count) => count === 1 ? "1 reply" : `${count.toLocaleString()} replies`,
12
12
  fresh: (count) => `${count.toLocaleString()} new`,
13
- last: (when) => `Last reply ${when}`,
14
- view: "View thread",
15
- open: "Thread open"
13
+ last: (when) => `last reply ${when}`
16
14
  };
17
15
  function ThreadSummary({
18
16
  replies,
@@ -28,25 +26,21 @@ function ThreadSummary({
28
26
  const labels = overrides ? { ...THREAD_SUMMARY_LABELS, ...overrides } : THREAD_SUMMARY_LABELS;
29
27
  const count = labels.replies(replies);
30
28
  const fresh = unread > 0 ? labels.fresh(unread) : null;
31
- const when = labels.last(last);
32
29
  return /* @__PURE__ */ jsxs("div", { className: cx("crewlet-thread-summary-wrap", className), children: [
33
30
  /* @__PURE__ */ jsxs(
34
31
  "button",
35
32
  {
36
33
  type: "button",
37
34
  className: cx("crewlet-thread-summary", open && "is-open"),
38
- "aria-label": [count, fresh, when].filter(Boolean).join(", "),
35
+ "aria-label": [count, fresh, last ? labels.last(last) : null].filter(Boolean).join(", "),
39
36
  "aria-expanded": open,
40
37
  onClick: onOpen,
41
38
  children: [
42
- /* @__PURE__ */ jsx(AvatarStack, { members: participants, size: THREAD_SUMMARY_FACE, max: 3, spread: true, decorative: true }),
39
+ /* @__PURE__ */ jsx(AvatarStack, { members: participants, size: THREAD_SUMMARY_FACE, max: 3, decorative: true }),
43
40
  /* @__PURE__ */ jsx("span", { className: "crewlet-thread-summary__count", children: count }),
44
41
  fresh ? /* @__PURE__ */ jsx(Tag, { size: "xs", variant: "brand", children: fresh }) : null,
45
- /* @__PURE__ */ jsx("span", { className: "crewlet-thread-summary__last", "aria-hidden": "true", children: when }),
46
- /* @__PURE__ */ jsxs("span", { className: "crewlet-thread-summary__end", "aria-hidden": "true", children: [
47
- /* @__PURE__ */ jsx("span", { className: "crewlet-thread-summary__view", children: open ? labels.open : labels.view }),
48
- /* @__PURE__ */ jsx(ChevronRightGlyph, { size: "sm", className: "crewlet-thread-summary__chevron" })
49
- ] })
42
+ last ? /* @__PURE__ */ jsx("span", { className: "crewlet-thread-summary__last", "aria-hidden": "true", children: last }) : null,
43
+ /* @__PURE__ */ jsx(ChevronRightGlyph, { size: "sm", className: "crewlet-thread-summary__chevron" })
50
44
  ]
51
45
  }
52
46
  ),
@@ -1,7 +1,7 @@
1
1
  import { PrincipalAvatar } from './chunk-HF5L56YQ.js';
2
2
  import { toInstant, RelativeTime, formatExact, toISO } from './chunk-GBKBME7Q.js';
3
3
  import { Document } from './chunk-I4PBFJGX.js';
4
- import { Composer } from './chunk-YNREHSBZ.js';
4
+ import { Composer } from './chunk-66TVD3RU.js';
5
5
  import { Button } from './chunk-M2M6ZD7P.js';
6
6
  import { IconButton } from './chunk-X5YI6E5X.js';
7
7
  import { Count } from './chunk-Y5CMDLQM.js';
@@ -57,6 +57,7 @@ export * from '../ChipField/index.js';
57
57
  export * from '../ChoiceButtons/index.js';
58
58
  export * from '../ChoiceCards/index.js';
59
59
  export * from '../ChoiceList/index.js';
60
+ export * from '../Clamp/index.js';
60
61
  export * from '../CodeBlock/index.js';
61
62
  export * from '../ColorChip/index.js';
62
63
  export * from '../ColorField/index.js';