@crewlethq/ui 0.18.0 → 0.20.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 (155) hide show
  1. package/README.md +40 -4
  2. package/dist/AccessDeniedCard/index.js +2 -2
  3. package/dist/AppShell/index.js +2 -2
  4. package/dist/ArrangeBoard/ArrangeBoard.d.ts +32 -0
  5. package/dist/ArrangeBoard/index.d.ts +3 -0
  6. package/dist/ArrangeBoard/index.js +2 -0
  7. package/dist/ArrangeBoard-MQE35P6Z.css +80 -0
  8. package/dist/ArrangeFrame/ArrangeFrame.d.ts +82 -0
  9. package/dist/ArrangeFrame/index.d.ts +5 -0
  10. package/dist/ArrangeFrame/index.js +5 -0
  11. package/dist/ArrangeFrame/useGridResize.d.ts +66 -0
  12. package/dist/ArrangeFrame-3PLZAG22.css +329 -0
  13. package/dist/ArrangeGroup/ArrangeGroup.d.ts +42 -0
  14. package/dist/ArrangeGroup/index.d.ts +3 -0
  15. package/dist/ArrangeGroup/index.js +4 -0
  16. package/dist/ArrangeGroup-SHFHA7BE.css +170 -0
  17. package/dist/ArrangeList/ArrangeList.d.ts +64 -0
  18. package/dist/ArrangeList/index.d.ts +3 -0
  19. package/dist/ArrangeList/index.js +10 -0
  20. package/dist/ArrangeList-NNRTDFI5.css +94 -0
  21. package/dist/ArtifactCard/index.js +2 -2
  22. package/dist/AuthLayout/index.js +2 -2
  23. package/dist/AvatarPicker/index.js +4 -4
  24. package/dist/Canvas/index.js +2 -2
  25. package/dist/Card/index.js +1 -1
  26. package/dist/Checkbox/index.js +3 -3
  27. package/dist/Combobox/index.js +4 -4
  28. package/dist/CommandPalette/index.js +6 -6
  29. package/dist/CommentThread/CommentThread.d.ts +85 -0
  30. package/dist/CommentThread/index.d.ts +3 -0
  31. package/dist/CommentThread/index.js +16 -0
  32. package/dist/CommentThread-7VXOFTZO.css +90 -0
  33. package/dist/Composer/index.js +3 -3
  34. package/dist/ConfirmField/index.js +3 -3
  35. package/dist/ConflictNote/ConflictNote.d.ts +42 -0
  36. package/dist/ConflictNote/index.d.ts +3 -0
  37. package/dist/ConflictNote/index.js +4 -0
  38. package/dist/ConflictNote-DH77PYF7.css +27 -0
  39. package/dist/DataTable/index.js +8 -8
  40. package/dist/DataView/index.js +13 -13
  41. package/dist/DateTimePicker/index.js +3 -3
  42. package/dist/DiffView/DiffView.d.ts +59 -0
  43. package/dist/DiffView/diff.d.ts +97 -0
  44. package/dist/DiffView/index.d.ts +5 -0
  45. package/dist/DiffView/index.js +3 -0
  46. package/dist/DiffView-RVLIHTKG.css +91 -0
  47. package/dist/Divider/Divider.d.ts +15 -0
  48. package/dist/Divider/index.d.ts +3 -0
  49. package/dist/Divider/index.js +2 -0
  50. package/dist/Divider-3Z77ZAJH.css +37 -0
  51. package/dist/HuePicker/HuePicker.d.ts +16 -4
  52. package/dist/HuePicker/index.js +2 -2
  53. package/dist/{HuePicker-5QIUR6L7.css → HuePicker-PAIGH6LR.css} +6 -0
  54. package/dist/IconTile/IconTile.d.ts +23 -0
  55. package/dist/IconTile/index.d.ts +3 -0
  56. package/dist/IconTile/index.js +2 -0
  57. package/dist/IconTile-4GNWTLAW.css +30 -0
  58. package/dist/Input/index.js +2 -2
  59. package/dist/LinkInterstitial/index.js +4 -4
  60. package/dist/ListInput/index.js +5 -5
  61. package/dist/MarkdownEditor/index.js +2 -2
  62. package/dist/Menu/index.js +2 -2
  63. package/dist/Modal/Modal.d.ts +20 -0
  64. package/dist/Modal/index.js +3 -3
  65. package/dist/{Modal-RQAYGG4L.css → Modal-XOSV6FAH.css} +14 -0
  66. package/dist/Note/Note.d.ts +23 -0
  67. package/dist/Note/index.d.ts +3 -0
  68. package/dist/Note/index.js +2 -0
  69. package/dist/Note-RT4L6VUT.css +58 -0
  70. package/dist/OrgTable/index.js +5 -5
  71. package/dist/PeopleRail/PeopleRail.d.ts +52 -0
  72. package/dist/PeopleRail/index.d.ts +3 -0
  73. package/dist/PeopleRail/index.js +11 -0
  74. package/dist/PeopleRail-R64WVOSH.css +75 -0
  75. package/dist/PinTile/PinTile.d.ts +37 -0
  76. package/dist/PinTile/index.d.ts +3 -0
  77. package/dist/PinTile/index.js +4 -0
  78. package/dist/PinTile-IIA25MNZ.css +141 -0
  79. package/dist/PresenceStack/index.js +1 -1
  80. package/dist/PrincipalPicker/index.js +5 -5
  81. package/dist/Reorder/index.d.ts +2 -0
  82. package/dist/Reorder/index.js +4 -0
  83. package/dist/Reorder/useReorder.d.ts +138 -0
  84. package/dist/ShareDialog/index.js +7 -7
  85. package/dist/SheetGrid/index.js +5 -5
  86. package/dist/StatGroup/StatGroup.d.ts +7 -1
  87. package/dist/StatGroup/index.js +1 -1
  88. package/dist/{StatGroup-HVG6O62W.css → StatGroup-PADTJCUQ.css} +7 -0
  89. package/dist/Switcher/index.js +8 -8
  90. package/dist/TableCells/TableCells.d.ts +153 -0
  91. package/dist/TableCells/index.d.ts +3 -0
  92. package/dist/TableCells/index.js +10 -0
  93. package/dist/TableCells-3VN5N2M3.css +104 -0
  94. package/dist/TagsInput/index.js +3 -3
  95. package/dist/TimeWindowPicker/index.js +5 -5
  96. package/dist/TreeCanvas/index.js +3 -3
  97. package/dist/TreeGrid/index.js +2 -2
  98. package/dist/VersionCompare/VersionCompare.d.ts +70 -0
  99. package/dist/VersionCompare/index.d.ts +3 -0
  100. package/dist/VersionCompare/index.js +11 -0
  101. package/dist/VersionCompare-UUZOPTQO.css +68 -0
  102. package/dist/chunk-35XVR5JQ.js +81 -0
  103. package/dist/chunk-63WJLRB2.js +24 -0
  104. package/dist/{chunk-L4ZLXYPO.js → chunk-6A7P6II6.js} +1 -1
  105. package/dist/chunk-6KWNXIDE.js +18 -0
  106. package/dist/chunk-6MIXD6IW.js +49 -0
  107. package/dist/chunk-73QBUUYX.js +102 -0
  108. package/dist/{chunk-NZY77ZDU.js → chunk-7FQEUNHX.js} +4 -4
  109. package/dist/{chunk-2TZATTIU.js → chunk-7IJARUIF.js} +18 -5
  110. package/dist/{chunk-A7EBCHEG.js → chunk-A4VMJMXJ.js} +1 -1
  111. package/dist/chunk-AIVZVKYZ.js +126 -0
  112. package/dist/{chunk-76FXDZAZ.js → chunk-AJESMWJS.js} +4 -4
  113. package/dist/chunk-BVWSLXTY.js +187 -0
  114. package/dist/chunk-DEJHAOC5.js +279 -0
  115. package/dist/{chunk-ERV5BUS3.js → chunk-EIGEIT4O.js} +3 -3
  116. package/dist/chunk-EZBLOUWX.js +176 -0
  117. package/dist/chunk-FFMCMSJB.js +1 -0
  118. package/dist/{chunk-LFZ45HV2.js → chunk-G3EEUNZQ.js} +1 -1
  119. package/dist/{chunk-2YR5ZPQ3.js → chunk-HTCJSUIZ.js} +3 -3
  120. package/dist/{chunk-75CLJNDQ.js → chunk-I6NZKJGK.js} +1 -1
  121. package/dist/chunk-IXJHTFXG.js +17 -0
  122. package/dist/{chunk-3UAA4IWJ.js → chunk-JEDWC3GI.js} +1 -1
  123. package/dist/{chunk-QVAFL2LE.js → chunk-JXRI5YD2.js} +3 -3
  124. package/dist/{chunk-ZFH7H7GS.js → chunk-LOLELDBW.js} +1 -1
  125. package/dist/chunk-MUGM7SEG.js +88 -0
  126. package/dist/chunk-N4GFRW5C.js +96 -0
  127. package/dist/{chunk-KVT3TJVG.js → chunk-OIMAK5AE.js} +6 -6
  128. package/dist/chunk-QO7QEQKV.js +24 -0
  129. package/dist/{chunk-BOW2VUCH.js → chunk-T7ICFXEC.js} +1 -1
  130. package/dist/{chunk-2OLCUNG7.js → chunk-TBIZSQHB.js} +1 -1
  131. package/dist/{chunk-4U3GQ7D2.js → chunk-TODND5AD.js} +1 -1
  132. package/dist/chunk-UO7JZVCO.js +35 -0
  133. package/dist/{chunk-IFKBDRNJ.js → chunk-UXELEORU.js} +3 -3
  134. package/dist/{chunk-6NIMZ5XC.js → chunk-VJLYGPPE.js} +1 -1
  135. package/dist/{chunk-7QFAORCY.js → chunk-WHZFDS62.js} +1 -1
  136. package/dist/chunk-XJ2QEBMM.js +277 -0
  137. package/dist/{chunk-PA4CYTBY.js → chunk-XU4ZUGLE.js} +19 -4
  138. package/dist/{chunk-T3ZWBZ65.js → chunk-YSJYWQSP.js} +2 -2
  139. package/dist/{chunk-CXBAIVYZ.js → chunk-YSY6UJ4F.js} +1 -1
  140. package/dist/{chunk-EG6NYWVK.js → chunk-YZCJ63JF.js} +1 -1
  141. package/dist/generated/index.d.ts +15 -0
  142. package/dist/generated/index.js +89 -74
  143. package/dist/index.js +89 -74
  144. package/dist/styles.css +1533 -70
  145. package/package.json +3 -3
  146. package/dist/chunk-EXHQ2QVW.js +0 -1
  147. package/dist/{chunk-AQCV62K6.js → chunk-7ZNKEPLN.js} +1 -1
  148. package/dist/{chunk-OYOQU7O5.js → chunk-EDGCPVVD.js} +1 -1
  149. package/dist/{chunk-FYXRWBJJ.js → chunk-J2G4HGQM.js} +1 -1
  150. package/dist/{chunk-NS7BVLL3.js → chunk-JULMZNGT.js} +1 -1
  151. package/dist/{chunk-5NVKTB6E.js → chunk-L4H7SSWF.js} +1 -1
  152. package/dist/{chunk-ESKP3TXM.js → chunk-MSSZHDZI.js} +0 -0
  153. package/dist/{chunk-4GB57WIT.js → chunk-Q55TXPA3.js} +1 -1
  154. package/dist/{chunk-B2Z2CDM5.js → chunk-T5TFZ2JB.js} +1 -1
  155. package/dist/{chunk-AMH67MLM.js → chunk-TXAFKH2A.js} +1 -1
@@ -0,0 +1,279 @@
1
+ import { announce } from './chunk-RSAQOKH3.js';
2
+ import { IconButton } from './chunk-4FQT6ZAY.js';
3
+ import { cx } from './chunk-ODEQTPFM.js';
4
+ import './ArrangeFrame-3PLZAG22.css';
5
+ import { forwardRef, useRef, useCallback, useState, useEffect } from 'react';
6
+ import { TrashGlyph } from '@crewlethq/icons/glyphs';
7
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
8
+
9
+ var clamp = (n, lo, hi) => Math.max(lo, Math.min(hi, n));
10
+ function gridOf(node) {
11
+ const grid = node.parentElement;
12
+ const own = node.getBoundingClientRect();
13
+ if (!grid) return { columns: 12, step: own.width, gap: 0, left: 0, width: own.width };
14
+ const style = getComputedStyle(grid);
15
+ const tracks = style.gridTemplateColumns.split(" ").map(parseFloat).filter((n) => !Number.isNaN(n));
16
+ const gap = parseFloat(style.columnGap) || 0;
17
+ const track = tracks[0] ?? grid.clientWidth / 12;
18
+ const box = grid.getBoundingClientRect();
19
+ const padLeft = parseFloat(style.paddingLeft) || 0;
20
+ const padRight = parseFloat(style.paddingRight) || 0;
21
+ return {
22
+ columns: tracks.length || 12,
23
+ step: track + gap,
24
+ gap,
25
+ left: box.left + padLeft - own.left,
26
+ width: box.width - padLeft - padRight
27
+ };
28
+ }
29
+ function useGridResize(frame, { name, size, rowHeight, minColumns = 1, maxColumns, minRows = 2, maxRows = 60, vertical = true, onResize }) {
30
+ const [live, setLive] = useState(null);
31
+ const [guides, setGuides] = useState(null);
32
+ const drag = useRef(null);
33
+ const say = useCallback(
34
+ (next, columns) => {
35
+ const height = next.rows === null ? "its height fits its content" : `${next.rows * rowHeight} pixels tall`;
36
+ announce(`${name}: ${next.columns} of ${columns} columns wide, ${height}.`);
37
+ },
38
+ [name, rowHeight]
39
+ );
40
+ const cancel = useCallback(() => {
41
+ drag.current = null;
42
+ setLive(null);
43
+ setGuides(null);
44
+ }, []);
45
+ useEffect(() => {
46
+ if (!live) return;
47
+ const onKey = (e) => {
48
+ if (e.key === "Escape") cancel();
49
+ };
50
+ window.addEventListener("keydown", onKey);
51
+ return () => window.removeEventListener("keydown", onKey);
52
+ }, [live, cancel]);
53
+ const sizeAt = (d, x, y) => {
54
+ const hi = Math.min(maxColumns ?? d.columns, d.columns);
55
+ const columns = clamp(Math.round((d.width + (x - d.x) + d.gap) / d.step), Math.min(minColumns, hi), hi);
56
+ const dy = y - d.y;
57
+ const rows = !vertical ? size.rows : size.rows === null && Math.abs(dy) < rowHeight / 2 ? null : clamp(Math.round((d.height + dy) / rowHeight), minRows, maxRows);
58
+ return { columns, rows };
59
+ };
60
+ const handleProps = {
61
+ "aria-label": `Resize ${name}`,
62
+ "aria-keyshortcuts": "ArrowLeft ArrowRight ArrowUp ArrowDown Enter",
63
+ onPointerDown: (event) => {
64
+ if (event.button !== 0 || !frame.current) return;
65
+ event.preventDefault();
66
+ event.stopPropagation();
67
+ try {
68
+ event.currentTarget.setPointerCapture?.(event.pointerId);
69
+ } catch {
70
+ }
71
+ const rect = frame.current.getBoundingClientRect();
72
+ const grid = gridOf(frame.current);
73
+ drag.current = {
74
+ pointer: event.pointerId,
75
+ x: event.clientX,
76
+ y: event.clientY,
77
+ width: rect.width,
78
+ height: rect.height,
79
+ step: grid.step,
80
+ gap: grid.gap,
81
+ columns: grid.columns
82
+ };
83
+ setGuides({ left: grid.left, width: grid.width, columns: grid.columns, gap: grid.gap });
84
+ setLive(size);
85
+ },
86
+ onPointerMove: (event) => {
87
+ const d = drag.current;
88
+ if (!d || d.pointer !== event.pointerId) return;
89
+ const next = sizeAt(d, event.clientX, event.clientY);
90
+ setLive((was) => was && was.columns === next.columns && was.rows === next.rows ? was : next);
91
+ },
92
+ onPointerUp: (event) => {
93
+ const d = drag.current;
94
+ if (!d || d.pointer !== event.pointerId) return;
95
+ const next = sizeAt(d, event.clientX, event.clientY);
96
+ drag.current = null;
97
+ setLive(null);
98
+ setGuides(null);
99
+ if (next.columns !== size.columns || next.rows !== size.rows) {
100
+ onResize(next);
101
+ say(next, d.columns);
102
+ }
103
+ },
104
+ onPointerCancel: cancel,
105
+ onKeyDown: (event) => {
106
+ if (!frame.current || event.altKey || event.ctrlKey || event.metaKey) return;
107
+ const grid = gridOf(frame.current);
108
+ const hi = Math.min(maxColumns ?? grid.columns, grid.columns);
109
+ const rowsNow = size.rows ?? Math.round(frame.current.getBoundingClientRect().height / rowHeight);
110
+ let next = null;
111
+ if (event.key === "ArrowLeft") next = { ...size, columns: clamp(size.columns - 1, Math.min(minColumns, hi), hi) };
112
+ if (event.key === "ArrowRight") next = { ...size, columns: clamp(size.columns + 1, Math.min(minColumns, hi), hi) };
113
+ if (vertical && event.key === "ArrowUp") next = { ...size, rows: clamp(rowsNow - 1, minRows, maxRows) };
114
+ if (vertical && event.key === "ArrowDown") next = { ...size, rows: clamp(rowsNow + 1, minRows, maxRows) };
115
+ if (vertical && event.key === "Enter") next = { ...size, rows: null };
116
+ if (!next) return;
117
+ event.preventDefault();
118
+ event.stopPropagation();
119
+ if (next.columns === size.columns && next.rows === size.rows) return;
120
+ onResize(next);
121
+ say(next, grid.columns);
122
+ },
123
+ onDoubleClick: () => {
124
+ if (!vertical || size.rows === null) return;
125
+ const next = { ...size, rows: null };
126
+ onResize(next);
127
+ say(next, frame.current ? gridOf(frame.current).columns : 12);
128
+ }
129
+ };
130
+ return { live, guides, handleProps };
131
+ }
132
+ var FIELDS = 'input, textarea, select, [contenteditable="true"]';
133
+ function assign(ref, value) {
134
+ if (typeof ref === "function") ref(value);
135
+ else if (ref) ref.current = value;
136
+ }
137
+ var ArrangeFrame = forwardRef(function ArrangeFrame2({
138
+ name,
139
+ editing,
140
+ columns,
141
+ rows = null,
142
+ rowHeight = 24,
143
+ handle,
144
+ resize,
145
+ actions,
146
+ onRemove,
147
+ fixed,
148
+ container = false,
149
+ bare = false,
150
+ selected = false,
151
+ fresh,
152
+ className,
153
+ style,
154
+ children,
155
+ ...rest
156
+ }, ref) {
157
+ const node = useRef(null);
158
+ const setNode = useCallback(
159
+ (el) => {
160
+ node.current = el;
161
+ assign(ref, el);
162
+ },
163
+ [ref]
164
+ );
165
+ const vertical = resize?.vertical !== false;
166
+ const { live, guides, handleProps: resizeProps } = useGridResize(node, {
167
+ name,
168
+ size: { columns, rows },
169
+ rowHeight,
170
+ minColumns: resize?.minColumns,
171
+ maxColumns: resize?.maxColumns,
172
+ minRows: resize?.minRows,
173
+ maxRows: resize?.maxRows,
174
+ vertical,
175
+ onResize: (next) => resize?.onResize(next)
176
+ });
177
+ const shown = live ?? { columns, rows };
178
+ const placed = {
179
+ ...style,
180
+ gridColumn: `span ${shown.columns}`,
181
+ ...shown.rows !== null ? { height: `${shown.rows * rowHeight}px` } : {}
182
+ };
183
+ const onField = useRef(false);
184
+ const surface = editing && handle ? {
185
+ draggable: true,
186
+ tabIndex: 0,
187
+ role: "group",
188
+ "aria-label": name,
189
+ "aria-describedby": handle["aria-describedby"],
190
+ onPointerDownCapture: (event) => {
191
+ onField.current = event.target.closest(FIELDS) !== null;
192
+ },
193
+ onDragStart: (event) => {
194
+ if (onField.current) event.preventDefault();
195
+ else handle.onDragStart(event);
196
+ },
197
+ onDragEnd: handle.onDragEnd,
198
+ // The block's own keys only: arrows typed in a group's name move the caret.
199
+ onKeyDown: (event) => {
200
+ if (event.target === event.currentTarget) handle.onKeyDown(event);
201
+ }
202
+ } : {};
203
+ const resizeName = vertical ? `Resize ${name}` : `Change the width of ${name}`;
204
+ return /* @__PURE__ */ jsxs(
205
+ "div",
206
+ {
207
+ ref: setNode,
208
+ className: cx(
209
+ "crewlet-arrange-frame",
210
+ editing && "is-editing",
211
+ container && "is-container",
212
+ bare && "is-bare",
213
+ editing && selected && "is-selected",
214
+ live && "is-resizing",
215
+ shown.rows !== null && "is-fixed-height",
216
+ fresh && "is-fresh",
217
+ className
218
+ ),
219
+ style: placed,
220
+ "data-columns": shown.columns,
221
+ ...surface,
222
+ ...rest,
223
+ children: [
224
+ /* @__PURE__ */ jsx("div", { className: "crewlet-arrange-frame__content", inert: editing && !container || void 0, children }),
225
+ editing ? /* @__PURE__ */ jsxs(Fragment, { children: [
226
+ /* @__PURE__ */ jsxs("div", { className: "crewlet-arrange-frame__bar", role: "group", "aria-label": `Tools for ${name}`, children: [
227
+ actions,
228
+ onRemove || fixed ? /* @__PURE__ */ jsxs(Fragment, { children: [
229
+ /* @__PURE__ */ jsx("span", { className: "crewlet-arrange-frame__sep", "aria-hidden": "true" }),
230
+ /* @__PURE__ */ jsx(
231
+ IconButton,
232
+ {
233
+ size: "sm",
234
+ variant: "ghost-danger",
235
+ label: `Remove ${name}`,
236
+ icon: /* @__PURE__ */ jsx(TrashGlyph, { size: "sm" }),
237
+ ...fixed ? { disabledReason: fixed } : {},
238
+ onClick: () => onRemove?.()
239
+ }
240
+ )
241
+ ] }) : null
242
+ ] }),
243
+ resize ? /* @__PURE__ */ jsx(
244
+ "button",
245
+ {
246
+ type: "button",
247
+ className: cx("crewlet-arrange-frame__resize", vertical ? "is-corner" : "is-edge"),
248
+ title: vertical ? `${resizeName}. Double click to fit the height to its content.` : resizeName,
249
+ draggable: false,
250
+ ...resizeProps,
251
+ "aria-label": resizeName,
252
+ children: /* @__PURE__ */ jsx("span", { className: "crewlet-arrange-frame__grip", "aria-hidden": "true" })
253
+ }
254
+ ) : null,
255
+ guides ? /* @__PURE__ */ jsx(
256
+ "span",
257
+ {
258
+ className: "crewlet-arrange-frame__guides",
259
+ "aria-hidden": "true",
260
+ style: {
261
+ left: `${guides.left}px`,
262
+ width: `${guides.width}px`,
263
+ gridTemplateColumns: `repeat(${guides.columns}, minmax(0, 1fr))`,
264
+ columnGap: `${guides.gap}px`
265
+ },
266
+ children: Array.from({ length: guides.columns }, (_, i) => /* @__PURE__ */ jsx("span", {}, i))
267
+ }
268
+ ) : null,
269
+ live ? /* @__PURE__ */ jsxs("span", { className: "crewlet-arrange-frame__size", "aria-hidden": "true", children: [
270
+ `${live.columns} ${live.columns === 1 ? "column" : "columns"}`,
271
+ vertical ? ` \xB7 ${live.rows === null ? "Height fits content" : `${live.rows * rowHeight} px tall`}` : ""
272
+ ] }) : null
273
+ ] }) : null
274
+ ]
275
+ }
276
+ );
277
+ });
278
+
279
+ export { ArrangeFrame, useGridResize };
@@ -1,10 +1,10 @@
1
1
  import { Select } from './chunk-FC4YTTFJ.js';
2
- import { Input } from './chunk-4GB57WIT.js';
3
- import { Popover } from './chunk-BWRGFKJP.js';
4
2
  import { today, shiftMonth, CalendarGrid, compareDays } from './chunk-GXQ3B46I.js';
5
3
  import { Button } from './chunk-OG6CL3EB.js';
6
- import { IconButton } from './chunk-4FQT6ZAY.js';
4
+ import { Input } from './chunk-Q55TXPA3.js';
5
+ import { Popover } from './chunk-BWRGFKJP.js';
7
6
  import { isComposing } from './chunk-R25RGPUB.js';
7
+ import { IconButton } from './chunk-4FQT6ZAY.js';
8
8
  import { cx } from './chunk-ODEQTPFM.js';
9
9
  import './TimeWindowPicker-BZ5HHATU.css';
10
10
  import { useMemo, useState, useRef, useId, useEffect } from 'react';
@@ -0,0 +1,176 @@
1
+ import { Document } from './chunk-WI6K5M5X.js';
2
+ import { Composer } from './chunk-VJLYGPPE.js';
3
+ import { Button } from './chunk-OG6CL3EB.js';
4
+ import { PrincipalAvatar } from './chunk-4KP4RC3O.js';
5
+ import { toInstant, RelativeTime, formatExact, toISO } from './chunk-3CZ7XAVY.js';
6
+ import { useHeadingLevel, headingTag } from './chunk-PQADV6P6.js';
7
+ import { Count } from './chunk-BHHIIK3M.js';
8
+ import { IconButton } from './chunk-4FQT6ZAY.js';
9
+ import { cx } from './chunk-ODEQTPFM.js';
10
+ import './CommentThread-7VXOFTZO.css';
11
+ import { useState, useRef, useId, useMemo } from 'react';
12
+ import { MessageSquareGlyph, XGlyph } from '@crewlethq/icons/glyphs';
13
+ import { jsxs, jsx } from 'react/jsx-runtime';
14
+
15
+ var COMMENT_THREAD_LABELS = {
16
+ heading: "Comments",
17
+ empty: "Nobody has commented.",
18
+ system: "System",
19
+ edited: "(edited)",
20
+ inReplyTo: (name) => `in reply to ${name}`,
21
+ replyTo: (name) => `Reply to ${name}`,
22
+ reply: "Reply",
23
+ replying: (name) => `Replying to ${name}`,
24
+ stopReplying: "Stop replying",
25
+ field: (subject, replyingTo) => replyingTo !== void 0 ? `Reply to ${replyingTo}` : subject !== void 0 ? `Comment on \u201C${subject}\u201D` : "Write a comment",
26
+ placeholder: "Write a comment",
27
+ submit: "Comment",
28
+ submitReply: "Reply",
29
+ emptyDraft: "Write the comment first."
30
+ };
31
+ function CommentThread({
32
+ comments,
33
+ subject,
34
+ onSubmit,
35
+ disabledReason,
36
+ busy = false,
37
+ hint,
38
+ notice,
39
+ heading = true,
40
+ now,
41
+ labels: overrides,
42
+ className
43
+ }) {
44
+ const labels = overrides ? { ...COMMENT_THREAD_LABELS, ...overrides } : COMMENT_THREAD_LABELS;
45
+ const [draft, setDraft] = useState("");
46
+ const [replyTo, setReplyTo] = useState(null);
47
+ const [sending, setSending] = useState(false);
48
+ const field = useRef(null);
49
+ const headingID = useId();
50
+ const level = useHeadingLevel();
51
+ const Heading = headingTag(level);
52
+ const byID = useMemo(() => new Map(comments.map((comment) => [comment.id, comment])), [comments]);
53
+ const nameOf = (comment) => comment.author?.name ?? labels.system;
54
+ const body = draft.trim();
55
+ const pending = busy || sending;
56
+ const reason = disabledReason ?? (body === "" ? labels.emptyDraft : void 0);
57
+ const blocked = pending || reason !== void 0;
58
+ const send = async () => {
59
+ if (!onSubmit || blocked) return;
60
+ setSending(true);
61
+ try {
62
+ const result = await onSubmit(body, replyTo);
63
+ if (result !== false) {
64
+ setDraft("");
65
+ setReplyTo(null);
66
+ }
67
+ } finally {
68
+ setSending(false);
69
+ }
70
+ };
71
+ const startReply = (comment) => {
72
+ setReplyTo(comment);
73
+ field.current?.focus();
74
+ };
75
+ return /* @__PURE__ */ jsxs(
76
+ "section",
77
+ {
78
+ className: cx("crewlet-comment-thread", className),
79
+ "aria-labelledby": heading ? headingID : void 0,
80
+ "aria-label": heading ? void 0 : labels.heading,
81
+ children: [
82
+ heading && /* @__PURE__ */ jsxs(Heading, { className: "crewlet-comment-thread__heading", id: headingID, children: [
83
+ /* @__PURE__ */ jsx(MessageSquareGlyph, { size: "sm" }),
84
+ labels.heading,
85
+ /* @__PURE__ */ jsx(Count, { value: comments.length })
86
+ ] }),
87
+ comments.length === 0 ? /* @__PURE__ */ jsx("p", { className: "crewlet-comment-thread__empty", children: labels.empty }) : (
88
+ // The markers are off, and WebKit drops the list role with them, so
89
+ // the role is declared and the redundant-role rule silenced for that.
90
+ // eslint-disable-next-line jsx-a11y/no-redundant-roles
91
+ /* @__PURE__ */ jsx("ol", { role: "list", className: "crewlet-comment-thread__list", children: comments.map((comment) => {
92
+ const parent = comment.replyTo !== void 0 ? byID.get(comment.replyTo) : void 0;
93
+ const created = toInstant(comment.createdAt);
94
+ const edited = toInstant(comment.editedAt);
95
+ const name = nameOf(comment);
96
+ return /* @__PURE__ */ jsxs("li", { className: "crewlet-comment-thread__comment", children: [
97
+ /* @__PURE__ */ jsxs("div", { className: "crewlet-comment-thread__head", children: [
98
+ comment.author ? /* @__PURE__ */ jsxs("span", { className: "crewlet-comment-thread__author", children: [
99
+ /* @__PURE__ */ jsx(PrincipalAvatar, { principal: comment.author, size: "xs" }),
100
+ /* @__PURE__ */ jsx("span", { className: "crewlet-comment-thread__name", children: comment.author.name })
101
+ ] }) : /* @__PURE__ */ jsx("span", { className: "crewlet-comment-thread__name", children: labels.system }),
102
+ /* @__PURE__ */ jsx(RelativeTime, { value: comment.createdAt, now, className: "crewlet-comment-thread__meta" }),
103
+ edited !== null && edited !== created && /* @__PURE__ */ jsx(
104
+ "time",
105
+ {
106
+ className: "crewlet-comment-thread__meta",
107
+ dateTime: toISO(comment.editedAt) ?? void 0,
108
+ title: formatExact(comment.editedAt) ?? void 0,
109
+ children: labels.edited
110
+ }
111
+ ),
112
+ parent && /* @__PURE__ */ jsx("span", { className: "crewlet-comment-thread__meta", children: labels.inReplyTo(nameOf(parent)) }),
113
+ onSubmit && /* @__PURE__ */ jsx(
114
+ Button,
115
+ {
116
+ size: "small",
117
+ variant: "ghost",
118
+ className: "crewlet-comment-thread__reply",
119
+ "aria-label": labels.replyTo(name),
120
+ onClick: () => startReply(comment),
121
+ children: labels.reply
122
+ }
123
+ )
124
+ ] }),
125
+ /* @__PURE__ */ jsx(Document, { size: "sm", measure: "none", children: comment.body })
126
+ ] }, comment.id);
127
+ }) })
128
+ ),
129
+ onSubmit && /* @__PURE__ */ jsxs("div", { className: "crewlet-comment-thread__compose", children: [
130
+ replyTo && /* @__PURE__ */ jsxs("span", { className: "crewlet-comment-thread__replying", children: [
131
+ labels.replying(nameOf(replyTo)),
132
+ /* @__PURE__ */ jsx(
133
+ IconButton,
134
+ {
135
+ size: "sm",
136
+ variant: "ghost",
137
+ label: labels.stopReplying,
138
+ icon: /* @__PURE__ */ jsx(XGlyph, { size: "sm" }),
139
+ onClick: () => {
140
+ setReplyTo(null);
141
+ field.current?.focus();
142
+ }
143
+ }
144
+ )
145
+ ] }),
146
+ /* @__PURE__ */ jsx(
147
+ Composer,
148
+ {
149
+ ref: field,
150
+ value: draft,
151
+ onChange: setDraft,
152
+ onSubmit: () => void send(),
153
+ label: labels.field(subject, replyTo ? nameOf(replyTo) : void 0),
154
+ placeholder: labels.placeholder,
155
+ actions: /* @__PURE__ */ jsx(
156
+ Button,
157
+ {
158
+ size: "small",
159
+ variant: "secondary",
160
+ loading: pending,
161
+ disabledReason: pending ? void 0 : reason,
162
+ onClick: () => void send(),
163
+ children: replyTo ? labels.submitReply : labels.submit
164
+ }
165
+ )
166
+ }
167
+ ),
168
+ (disabledReason ?? hint) !== void 0 && /* @__PURE__ */ jsx("p", { className: "crewlet-comment-thread__hint", children: disabledReason ?? hint }),
169
+ notice
170
+ ] })
171
+ ]
172
+ }
173
+ );
174
+ }
175
+
176
+ export { COMMENT_THREAD_LABELS, CommentThread };
@@ -0,0 +1 @@
1
+ import './HuePicker-PAIGH6LR.css';
@@ -1,5 +1,5 @@
1
1
  import { EmptyState } from './chunk-RA2ULG6H.js';
2
- import { Card } from './chunk-EG6NYWVK.js';
2
+ import { Card } from './chunk-YZCJ63JF.js';
3
3
  import { cx } from './chunk-ODEQTPFM.js';
4
4
  import './AccessDeniedCard-WXM5DBDZ.css';
5
5
  import { ShieldGlyph, LockGlyph, EyeOffGlyph } from '@crewlethq/icons/glyphs';
@@ -1,12 +1,12 @@
1
1
  import { Select } from './chunk-FC4YTTFJ.js';
2
- import { Modal } from './chunk-2TZATTIU.js';
3
2
  import { CopyButton } from './chunk-W46LPU4R.js';
3
+ import { Modal } from './chunk-7IJARUIF.js';
4
4
  import { Callout } from './chunk-SVSCLHHI.js';
5
5
  import { Button } from './chunk-OG6CL3EB.js';
6
- import { useMediaMatch } from './chunk-IG75YMUN.js';
7
- import { IconButton } from './chunk-4FQT6ZAY.js';
8
6
  import { PrincipalAvatar } from './chunk-4KP4RC3O.js';
9
7
  import { useHeadingLevel, headingTag } from './chunk-PQADV6P6.js';
8
+ import { useMediaMatch } from './chunk-IG75YMUN.js';
9
+ import { IconButton } from './chunk-4FQT6ZAY.js';
10
10
  import { cx } from './chunk-ODEQTPFM.js';
11
11
  import './ShareDialog-YZ4F37MW.css';
12
12
  import { useState, useId } from 'react';
@@ -1,4 +1,4 @@
1
- import { FormField } from './chunk-4GB57WIT.js';
1
+ import { FormField } from './chunk-Q55TXPA3.js';
2
2
  import { cx } from './chunk-ODEQTPFM.js';
3
3
  import './Checkbox-KT7RS6QQ.css';
4
4
  import { forwardRef, useId, useRef, useCallback, useEffect } from 'react';
@@ -0,0 +1,17 @@
1
+ import { cx } from './chunk-ODEQTPFM.js';
2
+ import './IconTile-4GNWTLAW.css';
3
+ import { jsx } from 'react/jsx-runtime';
4
+
5
+ function IconTile({ children, hue, size = "md", className, ...rest }) {
6
+ return /* @__PURE__ */ jsx(
7
+ "span",
8
+ {
9
+ "aria-hidden": "true",
10
+ ...rest,
11
+ className: cx("crewlet-icon-tile", `crewlet-icon-tile--${size}`, hue && `crewlet-icon-tile--${hue}`, className),
12
+ children
13
+ }
14
+ );
15
+ }
16
+
17
+ export { IconTile };
@@ -1,4 +1,4 @@
1
- import { Combobox } from './chunk-ZFH7H7GS.js';
1
+ import { Combobox } from './chunk-LOLELDBW.js';
2
2
  import { PRINCIPAL_KINDS, PrincipalAvatar } from './chunk-4KP4RC3O.js';
3
3
  import { cx } from './chunk-ODEQTPFM.js';
4
4
  import './PrincipalPicker-7NNZTGUP.css';
@@ -1,13 +1,13 @@
1
1
  import { cx } from './chunk-ODEQTPFM.js';
2
- import './StatGroup-HVG6O62W.css';
2
+ import './StatGroup-PADTJCUQ.css';
3
3
  import { jsx } from 'react/jsx-runtime';
4
4
 
5
- function StatGroup({ columns = 4, className, children, ...rest }) {
5
+ function StatGroup({ columns = 4, flush = false, className, children, ...rest }) {
6
6
  return /* @__PURE__ */ jsx(
7
7
  "div",
8
8
  {
9
9
  ...rest,
10
- className: cx("crewlet-stat-group", className),
10
+ className: cx("crewlet-stat-group", flush && "crewlet-stat-group--flush", className),
11
11
  style: { "--crewlet-stat-group-cols": columns, ...rest.style },
12
12
  children
13
13
  }
@@ -1,5 +1,5 @@
1
1
  import { useListbox } from './chunk-F73MC7EZ.js';
2
- import { Input } from './chunk-4GB57WIT.js';
2
+ import { Input } from './chunk-Q55TXPA3.js';
3
3
  import { cx } from './chunk-ODEQTPFM.js';
4
4
  import './Combobox-4FUVYIE7.css';
5
5
  import { forwardRef, useId, useMemo, useRef, useCallback } from 'react';
@@ -0,0 +1,88 @@
1
+ import { Tag } from './chunk-GFV4LJHH.js';
2
+ import { Link } from './chunk-FBSEJO2C.js';
3
+ import { RelativeTime } from './chunk-3CZ7XAVY.js';
4
+ import { EmptyValue } from './chunk-EUCC37WY.js';
5
+ import { Avatar } from './chunk-5OM447RW.js';
6
+ import { VisuallyHidden } from './chunk-BZFWDIV6.js';
7
+ import { cx } from './chunk-ODEQTPFM.js';
8
+ import './TableCells-3VN5N2M3.css';
9
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
10
+
11
+ function TableKeyCell({ value, text, href, emptyLabel = "Not set" }) {
12
+ if (!value) return /* @__PURE__ */ jsx(EmptyValue, { label: emptyLabel });
13
+ if (href !== void 0) {
14
+ return /* @__PURE__ */ jsx(Link, { href, size: "inherit", className: "crewlet-table-cell__key", title: value, children: text ?? value });
15
+ }
16
+ return /* @__PURE__ */ jsx("span", { className: "crewlet-table-cell__key", title: value, children: text ?? value });
17
+ }
18
+ var groupFigure = (value) => value.toLocaleString();
19
+ function TableNumberCell({
20
+ value,
21
+ format = groupFigure,
22
+ suffix,
23
+ title,
24
+ emptyLabel = "Nothing recorded"
25
+ }) {
26
+ if (value === null || value === void 0 || !Number.isFinite(value)) return /* @__PURE__ */ jsx(EmptyValue, { label: emptyLabel });
27
+ return /* @__PURE__ */ jsxs("span", { className: "crewlet-table-cell__number", title, children: [
28
+ format(value),
29
+ suffix
30
+ ] });
31
+ }
32
+ function TableDateCell({ value, now, emptyLabel = "Never" }) {
33
+ if (value === null || value === void 0 || value === "") return /* @__PURE__ */ jsx(EmptyValue, { label: emptyLabel });
34
+ return /* @__PURE__ */ jsx(RelativeTime, { value, now, emptyLabel, className: "crewlet-table-cell__date" });
35
+ }
36
+ function TableEntityCell({
37
+ name,
38
+ kind = "agent",
39
+ badge,
40
+ href,
41
+ title,
42
+ size = "xs",
43
+ emptyLabel = "Nobody"
44
+ }) {
45
+ if (!name) return /* @__PURE__ */ jsx(EmptyValue, { label: emptyLabel });
46
+ const inner = /* @__PURE__ */ jsxs(Fragment, { children: [
47
+ /* @__PURE__ */ jsx("span", { className: "crewlet-table-cell__badge", "aria-hidden": "true", children: badge ?? /* @__PURE__ */ jsx(Avatar, { name, size, kind, decorative: true }) }),
48
+ /* @__PURE__ */ jsx("span", { className: "crewlet-table-cell__truncate", children: name })
49
+ ] });
50
+ if (href !== void 0) {
51
+ return /* @__PURE__ */ jsx(Link, { href, variant: "subtle", size: "inherit", className: "crewlet-table-cell__entity", title: title ?? name, children: inner });
52
+ }
53
+ return /* @__PURE__ */ jsx("span", { className: "crewlet-table-cell__entity", title: title ?? name, children: inner });
54
+ }
55
+ function TableStatusCell({ label, glyph, tone = "neutral", title }) {
56
+ return /* @__PURE__ */ jsxs("span", { className: cx("crewlet-table-cell__status", `crewlet-table-cell__status--${tone}`), title: title ?? label, children: [
57
+ /* @__PURE__ */ jsx("span", { className: "crewlet-table-cell__glyph", "aria-hidden": "true", children: glyph }),
58
+ /* @__PURE__ */ jsx("span", { className: "crewlet-table-cell__truncate", children: label })
59
+ ] });
60
+ }
61
+ var TABLE_TAGS_CELL_LABELS = {
62
+ more: (count) => count === 1 ? "1 more tag" : `${count.toLocaleString()} more tags`
63
+ };
64
+ function TableTagsCell({ tags, max = 3, emptyLabel = "No tags", labels: overrides }) {
65
+ const list = tags ?? [];
66
+ if (list.length === 0) return /* @__PURE__ */ jsx(EmptyValue, { label: emptyLabel });
67
+ const labels = overrides ? { ...TABLE_TAGS_CELL_LABELS, ...overrides } : TABLE_TAGS_CELL_LABELS;
68
+ const shown = list.slice(0, max);
69
+ const rest = list.length - shown.length;
70
+ return /* @__PURE__ */ jsxs("span", { className: "crewlet-table-cell__tags", children: [
71
+ shown.map((tag) => /* @__PURE__ */ jsx(Tag, { appearance: "outline", size: "xs", children: tag }, tag)),
72
+ rest > 0 && /* @__PURE__ */ jsxs("span", { className: "crewlet-table-cell__more", title: list.slice(max).join(", "), children: [
73
+ /* @__PURE__ */ jsxs("span", { "aria-hidden": "true", children: [
74
+ "+",
75
+ rest
76
+ ] }),
77
+ /* @__PURE__ */ jsx(VisuallyHidden, { children: labels.more(rest) })
78
+ ] })
79
+ ] });
80
+ }
81
+ function TableTextCell({ children, icon, mark }) {
82
+ return /* @__PURE__ */ jsxs("span", { className: "crewlet-table-cell__text", children: [
83
+ mark ?? (icon !== void 0 && icon !== null ? /* @__PURE__ */ jsx("span", { className: "crewlet-table-cell__icon", "aria-hidden": "true", children: icon }) : null),
84
+ /* @__PURE__ */ jsx("span", { className: "crewlet-table-cell__truncate", children })
85
+ ] });
86
+ }
87
+
88
+ export { TABLE_TAGS_CELL_LABELS, TableDateCell, TableEntityCell, TableKeyCell, TableNumberCell, TableStatusCell, TableTagsCell, TableTextCell };