@crewlethq/ui 0.127.0 → 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.
- package/dist/ActivityLine/index.js +3 -3
- package/dist/AgentHandoffPanel/index.js +5 -5
- package/dist/AppShell/index.js +3 -3
- package/dist/ArrangeList/index.js +2 -2
- package/dist/ArtifactBar/index.js +1 -1
- package/dist/ArtifactCard/index.js +4 -4
- package/dist/AuthLayout/index.js +1 -1
- package/dist/Avatar/index.js +1 -1
- package/dist/{Avatar-CRSLRUVT.css → Avatar-RHFI55UZ.css} +14 -0
- package/dist/{AvatarStack-GNEJHEU6.css → AvatarStack-UNBXFHTZ.css} +14 -1
- package/dist/BriefCard/index.js +1 -1
- package/dist/ChatThread/index.js +3 -3
- package/dist/Clamp/Clamp.d.ts +50 -0
- package/dist/Clamp/index.d.ts +3 -0
- package/dist/Clamp/index.js +12 -0
- package/dist/Clamp-Q5WKCGWY.css +60 -0
- package/dist/CommentThread/index.js +7 -7
- package/dist/Composer/index.js +4 -4
- package/dist/DataGrid/index.js +4 -4
- package/dist/DataTable/index.js +2 -2
- package/dist/DataView/index.js +3 -3
- package/dist/DatasetSource/index.js +1 -1
- package/dist/DeepWorkCard/index.js +1 -1
- package/dist/DeliveryReceipt/DeliveryReceipt.d.ts +37 -24
- package/dist/DeliveryReceipt/index.js +1 -2
- package/dist/{DeliveryReceipt-G55ILD6O.css → DeliveryReceipt-BILVVNTO.css} +11 -14
- package/dist/DocTabsEditor/index.js +4 -4
- package/dist/DockColumn/index.js +1 -1
- package/dist/EditingStatus/index.js +2 -2
- package/dist/EntityChip/index.js +1 -1
- package/dist/EntityList/index.js +1 -1
- package/dist/GraphCanvas/index.js +2 -2
- package/dist/ImageUpload/index.js +1 -1
- package/dist/InlineEditor/index.js +3 -3
- package/dist/ListInput/index.js +2 -2
- package/dist/OpenInAppCard/index.js +1 -1
- package/dist/OrgLabel/index.js +1 -1
- package/dist/OrgNode/index.js +1 -1
- package/dist/OrgTable/index.js +8 -8
- package/dist/PeopleRail/index.js +1 -1
- package/dist/PresenceStack/index.js +1 -1
- package/dist/Principal/index.js +1 -1
- package/dist/PrincipalPicker/index.js +1 -1
- package/dist/ProposalCard/index.js +1 -1
- package/dist/RailList/index.js +3 -3
- package/dist/RefusalCard/index.js +1 -1
- package/dist/ResultTableCard/index.js +1 -1
- package/dist/SectionFrame/index.js +3 -3
- package/dist/SendKeys/index.js +2 -2
- package/dist/SetupWizard/index.js +1 -1
- package/dist/ShareDialog/index.js +4 -4
- package/dist/SheetGrid/index.js +1 -1
- package/dist/SidebarNav/index.js +2 -2
- package/dist/SlideFilmstrip/index.js +4 -4
- package/dist/StatusCard/index.js +1 -1
- package/dist/Switcher/index.js +3 -3
- package/dist/TableCells/index.js +2 -2
- package/dist/ThreadSummary/ThreadSummary.d.ts +24 -16
- package/dist/ThreadSummary/index.js +2 -2
- package/dist/{ThreadSummary-2AFEU6NH.css → ThreadSummary-3AODTHAM.css} +44 -35
- package/dist/TreeCanvas/index.js +2 -2
- package/dist/TreeGrid/index.js +5 -5
- package/dist/VersionTimeline/index.js +1 -1
- package/dist/WorkingLine/index.js +2 -2
- package/dist/{chunk-XUFVRAEB.js → chunk-26TNM64L.js} +2 -2
- package/dist/{chunk-YNREHSBZ.js → chunk-66TVD3RU.js} +1 -1
- package/dist/{chunk-XWEHTYVM.js → chunk-7GGX7TDB.js} +1 -1
- package/dist/{chunk-5SMYKL3D.js → chunk-ARZGEHWE.js} +2 -2
- package/dist/{chunk-NZFYX5UF.js → chunk-AVH6XN2O.js} +1 -1
- package/dist/{chunk-U3VDJ7QJ.js → chunk-BZVQ7KTX.js} +1 -1
- package/dist/{chunk-BG4GI5W3.js → chunk-FNJCCVQX.js} +1 -1
- package/dist/chunk-GTNXDLYH.js +146 -0
- package/dist/chunk-IZGB6SQE.js +89 -0
- package/dist/{chunk-EFY7R766.js → chunk-LPP2PMKP.js} +1 -1
- package/dist/{chunk-E32PP25Z.js → chunk-NB2QYDYA.js} +1 -1
- package/dist/{chunk-SFO4KY65.js → chunk-OYKQVTJB.js} +1 -1
- package/dist/{chunk-UA7FQCD7.js → chunk-PAK2FUDN.js} +3 -3
- package/dist/{chunk-I5HJ6Y6E.js → chunk-U4HA6LRQ.js} +8 -14
- package/dist/{chunk-WGJRD3PY.js → chunk-WMZ2MROV.js} +1 -1
- package/dist/{chunk-G3WSU5J7.js → chunk-Y54H5NJO.js} +2 -2
- package/dist/generated/index.d.ts +1 -0
- package/dist/generated/index.js +78 -77
- package/dist/index.js +78 -77
- package/dist/styles.css +150 -54
- package/package.json +3 -3
- package/dist/chunk-WNPKXYDJ.js +0 -141
- package/dist/{chunk-QV3WVNRA.js → chunk-2KUAO2CX.js} +0 -0
- package/dist/{chunk-QCBITY5I.js → chunk-6LG6JJSW.js} +1 -1
- package/dist/{chunk-4OKNZZ5E.js → chunk-7AAM3PCB.js} +1 -1
- package/dist/{chunk-SM2MM4DQ.js → chunk-BS5DASEB.js} +1 -1
- package/dist/{chunk-D6I7HBZC.js → chunk-COPAHZHK.js} +2 -2
- package/dist/{chunk-KTKPC3CV.js → chunk-CRXNGDYG.js} +1 -1
- package/dist/{chunk-TLZ7NG6T.js → chunk-HGL7HMBZ.js} +1 -1
- package/dist/{chunk-6N53ZWRM.js → chunk-KRF3GQ63.js} +1 -1
- package/dist/{chunk-2FRELJBU.js → chunk-LLPDEZT5.js} +1 -1
- package/dist/{chunk-W7SOT7RS.js → chunk-NKYBXVYQ.js} +1 -1
- package/dist/{chunk-WJIBZ2UM.js → chunk-R4LHYCZN.js} +1 -1
- package/dist/{chunk-TU6IC2XD.js → chunk-RE6MXNIM.js} +1 -1
- package/dist/{chunk-UZMXC5T6.js → chunk-YUVQUJND.js} +1 -1
package/dist/TreeCanvas/index.js
CHANGED
|
@@ -2,11 +2,11 @@ export { TREE_ADD_MARK_MIN_ZOOM, TreeCanvas } from '../chunk-556M2A4S.js';
|
|
|
2
2
|
import '../chunk-MY374UUD.js';
|
|
3
3
|
import '../chunk-CVNJ6VHK.js';
|
|
4
4
|
import '../chunk-X4HBZSXA.js';
|
|
5
|
-
import '../chunk-SK4BIFTG.js';
|
|
6
|
-
import '../chunk-COS6LJ4K.js';
|
|
7
5
|
import '../chunk-VBBLHS2Y.js';
|
|
8
6
|
import '../chunk-M2M6ZD7P.js';
|
|
9
7
|
import '../chunk-XSPCITPN.js';
|
|
8
|
+
import '../chunk-SK4BIFTG.js';
|
|
9
|
+
import '../chunk-COS6LJ4K.js';
|
|
10
10
|
import '../chunk-X5YI6E5X.js';
|
|
11
11
|
import '../chunk-TDFLCUBE.js';
|
|
12
12
|
import '../chunk-HXVMXH6U.js';
|
package/dist/TreeGrid/index.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
export { TreeGrid } from '../chunk-
|
|
1
|
+
export { TreeGrid } from '../chunk-NB2QYDYA.js';
|
|
2
2
|
import '../chunk-MY374UUD.js';
|
|
3
|
-
import '../chunk-
|
|
3
|
+
import '../chunk-COPAHZHK.js';
|
|
4
4
|
import '../chunk-X4HBZSXA.js';
|
|
5
|
-
import '../chunk-JMBPMSNI.js';
|
|
6
5
|
import '../chunk-WFAJYBLX.js';
|
|
7
6
|
import '../chunk-WSIJDWUG.js';
|
|
7
|
+
import '../chunk-JMBPMSNI.js';
|
|
8
8
|
import '../chunk-KFTVPWG2.js';
|
|
9
9
|
import '../chunk-PPUR46MK.js';
|
|
10
|
-
import '../chunk-SK4BIFTG.js';
|
|
11
|
-
import '../chunk-COS6LJ4K.js';
|
|
12
10
|
import '../chunk-M2M6ZD7P.js';
|
|
13
11
|
import '../chunk-XSPCITPN.js';
|
|
14
12
|
import '../chunk-NN44J7BP.js';
|
|
@@ -16,6 +14,8 @@ import '../chunk-NICEDVZM.js';
|
|
|
16
14
|
import '../chunk-JLKO7PSK.js';
|
|
17
15
|
import '../chunk-PJV5HVZY.js';
|
|
18
16
|
import '../chunk-TEXK4RK6.js';
|
|
17
|
+
import '../chunk-SK4BIFTG.js';
|
|
18
|
+
import '../chunk-COS6LJ4K.js';
|
|
19
19
|
import '../chunk-X5YI6E5X.js';
|
|
20
20
|
import '../chunk-TDFLCUBE.js';
|
|
21
21
|
import '../chunk-HXVMXH6U.js';
|
|
@@ -2,7 +2,7 @@ export { VersionTimeline } from '../chunk-RM5RKPFV.js';
|
|
|
2
2
|
import '../chunk-HF5L56YQ.js';
|
|
3
3
|
import '../chunk-GBKBME7Q.js';
|
|
4
4
|
import '../chunk-WGLOH33S.js';
|
|
5
|
-
import '../chunk-
|
|
5
|
+
import '../chunk-ARZGEHWE.js';
|
|
6
6
|
import '../chunk-XZY6S3UC.js';
|
|
7
7
|
import '../chunk-XDUXAQIS.js';
|
|
8
8
|
import '../chunk-M2M6ZD7P.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { BouncingDots, WORKING_LINE_LABELS, WorkingLine, workingAnnouncement, workingSentence } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
1
|
+
export { BouncingDots, WORKING_LINE_LABELS, WorkingLine, workingAnnouncement, workingSentence } from '../chunk-OYKQVTJB.js';
|
|
2
|
+
import '../chunk-ARZGEHWE.js';
|
|
3
3
|
import '../chunk-XZY6S3UC.js';
|
|
4
4
|
import '../chunk-RRRK2KB6.js';
|
|
5
5
|
import '../chunk-ODEQTPFM.js';
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { PageHeader } from './chunk-FPDIHEM4.js';
|
|
2
2
|
import { FilterPill } from './chunk-E4QX4VET.js';
|
|
3
3
|
import { DateTimePicker } from './chunk-AQZPZYSY.js';
|
|
4
|
-
import { DataTable } from './chunk-
|
|
4
|
+
import { DataTable } from './chunk-LLPDEZT5.js';
|
|
5
5
|
import { useListbox, useOptionKeys } from './chunk-KW7T23RT.js';
|
|
6
6
|
import { Toolbar } from './chunk-NPEI2QAN.js';
|
|
7
7
|
import { Popover } from './chunk-KDRJZWE3.js';
|
|
8
|
-
import { Menu } from './chunk-FIQGLZ5Q.js';
|
|
9
8
|
import { RelativeTime } from './chunk-GBKBME7Q.js';
|
|
9
|
+
import { Menu } from './chunk-FIQGLZ5Q.js';
|
|
10
10
|
import { Kbd } from './chunk-VBBLHS2Y.js';
|
|
11
11
|
import { Button } from './chunk-M2M6ZD7P.js';
|
|
12
12
|
import { Input } from './chunk-NN44J7BP.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useSendOnEnter, SendKeysHint } from './chunk-
|
|
1
|
+
import { useSendOnEnter, SendKeysHint } from './chunk-YUVQUJND.js';
|
|
2
2
|
import { Textarea } from './chunk-NN44J7BP.js';
|
|
3
3
|
import { VisuallyHidden } from './chunk-RRRK2KB6.js';
|
|
4
4
|
import { cx } from './chunk-ODEQTPFM.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Select } from './chunk-YKCLV77Z.js';
|
|
2
|
-
import { SidebarNav, NavItem } from './chunk-
|
|
2
|
+
import { SidebarNav, NavItem } from './chunk-BS5DASEB.js';
|
|
3
3
|
import { Card } from './chunk-RABEMWTA.js';
|
|
4
4
|
import { Text } from './chunk-475DOAWF.js';
|
|
5
5
|
import './RailList-N2ZBPRM2.css';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AVATAR_SIZES, Avatar } from './chunk-XZY6S3UC.js';
|
|
2
2
|
import { cx } from './chunk-ODEQTPFM.js';
|
|
3
|
-
import './Avatar-
|
|
4
|
-
import './AvatarStack-
|
|
3
|
+
import './Avatar-RHFI55UZ.css';
|
|
4
|
+
import './AvatarStack-UNBXFHTZ.css';
|
|
5
5
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
6
6
|
|
|
7
7
|
function counted(count, one, many) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Timeline } from './chunk-XDUXAQIS.js';
|
|
2
2
|
import { Section } from './chunk-WFCWPXJN.js';
|
|
3
|
-
import { Composer } from './chunk-
|
|
3
|
+
import { Composer } from './chunk-66TVD3RU.js';
|
|
4
4
|
import { Disclosure } from './chunk-D5O64CVE.js';
|
|
5
5
|
import { ArtifactPanel } from './chunk-6IBFWV6U.js';
|
|
6
6
|
import { Button } from './chunk-M2M6ZD7P.js';
|
|
@@ -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 };
|
|
@@ -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,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-
|
|
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';
|
|
@@ -2,11 +2,11 @@ import { Skeleton } from './chunk-WFAJYBLX.js';
|
|
|
2
2
|
import { PrincipalAvatar } from './chunk-HF5L56YQ.js';
|
|
3
3
|
import { RelativeTime } from './chunk-GBKBME7Q.js';
|
|
4
4
|
import { Card } from './chunk-RABEMWTA.js';
|
|
5
|
-
import { ArtifactAccessGlyph } from './chunk-DOY3KC6I.js';
|
|
6
5
|
import { ArtifactKindGround } from './chunk-W3A6NBUM.js';
|
|
7
|
-
import {
|
|
6
|
+
import { ArtifactAccessGlyph } from './chunk-DOY3KC6I.js';
|
|
8
7
|
import { ArtifactKindGlyph } from './chunk-RSKW25Y5.js';
|
|
9
|
-
import {
|
|
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,18 +1,16 @@
|
|
|
1
1
|
import { Tag } from './chunk-SJ3EUCFD.js';
|
|
2
|
-
import { AvatarStack } from './chunk-
|
|
2
|
+
import { AvatarStack } from './chunk-ARZGEHWE.js';
|
|
3
3
|
import { cx } from './chunk-ODEQTPFM.js';
|
|
4
4
|
import './ChatScale-LGESYXCO.css';
|
|
5
|
-
import './ThreadSummary-
|
|
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 =
|
|
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) => `
|
|
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,
|
|
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,
|
|
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:
|
|
46
|
-
/* @__PURE__ */
|
|
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
|
-
import { Document } from './chunk-I4PBFJGX.js';
|
|
2
1
|
import { PrincipalAvatar } from './chunk-HF5L56YQ.js';
|
|
3
2
|
import { toInstant, RelativeTime, formatExact, toISO } from './chunk-GBKBME7Q.js';
|
|
4
|
-
import {
|
|
3
|
+
import { Document } from './chunk-I4PBFJGX.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';
|