@humain/ui 2.1.63 → 2.1.65
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/components/organisms/ai/AIToolCall/AIToolCall.d.ts +9 -3
- package/dist/components/organisms/ai/AIToolRun/index.d.ts +1 -1
- package/dist/components/organisms/ai/AIToolRun/validation.d.ts +24 -3
- package/dist/components/organisms/ai/_shared/format-ai-duration.d.ts +1 -0
- package/dist/components/organisms/ai/_shared/workflow-step-renderer.d.ts +1 -0
- package/dist/index.js +52 -52
- package/dist/index151.js +1 -1
- package/dist/index174.js +7 -339
- package/dist/index174.js.map +1 -1
- package/dist/index175.js +310 -137
- package/dist/index175.js.map +1 -1
- package/dist/index176.js +148 -174
- package/dist/index176.js.map +1 -1
- package/dist/index177.js +186 -78
- package/dist/index177.js.map +1 -1
- package/dist/index178.js +74 -124
- package/dist/index178.js.map +1 -1
- package/dist/index179.js +133 -1
- package/dist/index179.js.map +1 -0
- package/dist/index180.js +2 -201
- package/dist/index181.js +201 -0
- package/dist/{index180.js.map → index181.js.map} +1 -1
- package/dist/index183.js +130 -166
- package/dist/index183.js.map +1 -1
- package/dist/index184.js +195 -983
- package/dist/index184.js.map +1 -1
- package/dist/index185.js +1069 -369
- package/dist/index185.js.map +1 -1
- package/dist/index186.js +395 -197
- package/dist/index186.js.map +1 -1
- package/dist/index187.js +198 -243
- package/dist/index187.js.map +1 -1
- package/dist/index188.js +263 -3
- package/dist/index188.js.map +1 -1
- package/dist/index189.js +3 -209
- package/dist/index189.js.map +1 -1
- package/dist/index190.js +190 -777
- package/dist/index190.js.map +1 -1
- package/dist/index191.js +771 -252
- package/dist/index191.js.map +1 -1
- package/dist/index192.js +250 -65
- package/dist/index192.js.map +1 -1
- package/dist/index193.js +72 -523
- package/dist/index193.js.map +1 -1
- package/dist/index194.js +537 -144
- package/dist/index194.js.map +1 -1
- package/dist/index195.js +139 -720
- package/dist/index195.js.map +1 -1
- package/dist/index196.js +707 -167
- package/dist/index196.js.map +1 -1
- package/dist/index197.js +175 -151
- package/dist/index197.js.map +1 -1
- package/dist/index198.js +152 -487
- package/dist/index198.js.map +1 -1
- package/dist/index199.js +472 -225
- package/dist/index199.js.map +1 -1
- package/dist/index200.js +236 -260
- package/dist/index200.js.map +1 -1
- package/dist/index201.js +265 -215
- package/dist/index201.js.map +1 -1
- package/dist/index202.js +207 -307
- package/dist/index202.js.map +1 -1
- package/dist/index203.js +302 -135
- package/dist/index203.js.map +1 -1
- package/dist/index204.js +140 -271
- package/dist/index204.js.map +1 -1
- package/dist/index205.js +263 -253
- package/dist/index205.js.map +1 -1
- package/dist/index206.js +244 -137
- package/dist/index206.js.map +1 -1
- package/dist/index207.js +100 -238
- package/dist/index207.js.map +1 -1
- package/dist/index208.js +278 -74
- package/dist/index208.js.map +1 -1
- package/dist/index209.js +56 -97
- package/dist/index209.js.map +1 -1
- package/dist/index210.js +142 -47
- package/dist/index210.js.map +1 -1
- package/dist/index211.js +38 -84
- package/dist/index211.js.map +1 -1
- package/dist/index212.js +72 -252
- package/dist/index212.js.map +1 -1
- package/dist/index213.js +274 -26
- package/dist/index213.js.map +1 -1
- package/dist/index214.js +29 -94
- package/dist/index214.js.map +1 -1
- package/dist/index215.js +98 -25
- package/dist/index215.js.map +1 -1
- package/dist/index216.js +20 -565
- package/dist/index216.js.map +1 -1
- package/dist/index217.js +564 -17
- package/dist/index217.js.map +1 -1
- package/dist/index218.js +20 -23
- package/dist/index218.js.map +1 -1
- package/dist/index219.js +20 -95
- package/dist/index219.js.map +1 -1
- package/dist/index220.js +92 -88
- package/dist/index220.js.map +1 -1
- package/dist/index221.js +97 -29
- package/dist/index221.js.map +1 -1
- package/dist/index222.js +24 -470
- package/dist/index222.js.map +1 -1
- package/dist/index223.js +446 -196
- package/dist/index223.js.map +1 -1
- package/dist/index224.js +199 -729
- package/dist/index224.js.map +1 -1
- package/dist/index225.js +750 -61
- package/dist/index225.js.map +1 -1
- package/dist/index226.js +58 -181
- package/dist/index226.js.map +1 -1
- package/dist/index227.js +175 -259
- package/dist/index227.js.map +1 -1
- package/dist/index228.js +246 -172
- package/dist/index228.js.map +1 -1
- package/dist/index229.js +195 -32
- package/dist/index229.js.map +1 -1
- package/dist/index230.js +12 -40
- package/dist/index230.js.map +1 -1
- package/dist/index231.js +23 -26
- package/dist/index231.js.map +1 -1
- package/dist/index232.js +45 -22
- package/dist/index232.js.map +1 -1
- package/dist/index233.js +27 -48
- package/dist/index233.js.map +1 -1
- package/dist/index234.js +52 -26
- package/dist/index234.js.map +1 -1
- package/dist/index235.js +40 -225
- package/dist/index235.js.map +1 -1
- package/dist/index236.js +217 -39
- package/dist/index236.js.map +1 -1
- package/dist/index237.js +50 -0
- package/dist/index237.js.map +1 -0
- package/dist/styles.css +1 -1
- package/dist/wc/AIToolCall.js +218 -0
- package/dist/wc/AIToolCall.js.map +1 -0
- package/dist/wc/hf-ai-tool-call.js +34 -219
- package/dist/wc/hf-ai-tool-call.js.map +1 -1
- package/dist/wc/hf-ai-tool-run.js +673 -576
- package/dist/wc/hf-ai-tool-run.js.map +1 -1
- package/dist/wc/workflow-step-renderer.js +79 -78
- package/dist/wc/workflow-step-renderer.js.map +1 -1
- package/dist/wc-react/AIToolCall.js +218 -0
- package/dist/wc-react/AIToolCall.js.map +1 -0
- package/dist/wc-react/hf-ai-tool-call.js +32 -217
- package/dist/wc-react/hf-ai-tool-call.js.map +1 -1
- package/dist/wc-react/hf-ai-tool-run.js +698 -601
- package/dist/wc-react/hf-ai-tool-run.js.map +1 -1
- package/dist/wc-react/workflow-step-renderer.js +58 -57
- package/dist/wc-react/workflow-step-renderer.js.map +1 -1
- package/package.json +1 -1
- package/skills/humain-ui/SKILL.md +1 -1
- package/skills/humain-ui-wc/SKILL.md +1 -1
- package/skills/humain-ui-wc.skill +0 -0
- package/skills/humain-ui.skill +0 -0
- package/dist/index182.js +0 -143
- package/dist/index182.js.map +0 -1
- package/dist/wc/wrench.js +0 -10
- package/dist/wc/wrench.js.map +0 -1
- package/dist/wc-react/wrench.js +0 -10
- package/dist/wc-react/wrench.js.map +0 -1
package/dist/index196.js
CHANGED
|
@@ -1,194 +1,734 @@
|
|
|
1
|
-
import { cn } from "./index2.js";
|
|
1
|
+
import { assertNever, cn } from "./index2.js";
|
|
2
2
|
import { Button } from "./index5.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { Badge } from "./index14.js";
|
|
4
|
+
import { Avatar } from "./index70.js";
|
|
5
|
+
import { FileTypeIcon } from "./index115.js";
|
|
6
|
+
import { ArrowDown, ArrowUp, ChevronsUp, Filter, Maximize2, MessageSquare, Minus, Paperclip, Pencil, Plus, Tag, Trash2, UserRound, X } from "lucide-react";
|
|
6
7
|
import * as React from "react";
|
|
7
8
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
-
//#region src/components/organisms/content/
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
9
|
+
//#region src/components/organisms/content/History/History.tsx
|
|
10
|
+
var historyEventCategoryConfig = {
|
|
11
|
+
create: {
|
|
12
|
+
label: "Create",
|
|
13
|
+
Icon: Plus,
|
|
14
|
+
badgeClassName: "bg-success/10 text-success ring-background dark:ring-card",
|
|
15
|
+
actionClassName: "text-card-foreground"
|
|
16
|
+
},
|
|
17
|
+
"update-fields": {
|
|
18
|
+
label: "Update fields",
|
|
19
|
+
Icon: Pencil,
|
|
20
|
+
badgeClassName: "bg-info/10 text-info ring-background dark:ring-card",
|
|
21
|
+
actionClassName: "text-card-foreground"
|
|
22
|
+
},
|
|
23
|
+
reassign: {
|
|
24
|
+
label: "Reassign people",
|
|
25
|
+
Icon: UserRound,
|
|
26
|
+
badgeClassName: "bg-primary/10 text-primary ring-background dark:ring-card",
|
|
27
|
+
actionClassName: "text-card-foreground"
|
|
28
|
+
},
|
|
29
|
+
tags: {
|
|
30
|
+
label: "Tags",
|
|
31
|
+
Icon: Tag,
|
|
32
|
+
badgeClassName: "bg-info/10 text-info ring-background dark:ring-card",
|
|
33
|
+
actionClassName: "text-card-foreground"
|
|
34
|
+
},
|
|
35
|
+
attachment: {
|
|
36
|
+
label: "Attachment",
|
|
37
|
+
Icon: Paperclip,
|
|
38
|
+
badgeClassName: "bg-info/10 text-info ring-background dark:ring-card",
|
|
39
|
+
actionClassName: "text-card-foreground"
|
|
40
|
+
},
|
|
41
|
+
comment: {
|
|
42
|
+
label: "Comment",
|
|
43
|
+
Icon: MessageSquare,
|
|
44
|
+
badgeClassName: "bg-warning/10 text-warning ring-background dark:ring-card",
|
|
45
|
+
actionClassName: "text-card-foreground"
|
|
46
|
+
},
|
|
47
|
+
"delete-comment": {
|
|
48
|
+
label: "Delete comment",
|
|
49
|
+
Icon: Trash2,
|
|
50
|
+
badgeClassName: "bg-destructive/10 text-destructive ring-background dark:ring-card",
|
|
51
|
+
actionClassName: "text-card-foreground"
|
|
52
|
+
},
|
|
53
|
+
"delete-record": {
|
|
54
|
+
label: "Delete record",
|
|
55
|
+
Icon: Trash2,
|
|
56
|
+
badgeClassName: "bg-destructive/10 text-destructive ring-background dark:ring-card",
|
|
57
|
+
actionClassName: "text-card-foreground"
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
var historyHeaderActionConfig = {
|
|
61
|
+
filter: {
|
|
62
|
+
label: "Filter history",
|
|
63
|
+
Icon: Filter
|
|
64
|
+
},
|
|
65
|
+
expand: {
|
|
66
|
+
label: "Expand history panel",
|
|
67
|
+
Icon: Maximize2
|
|
68
|
+
},
|
|
69
|
+
close: {
|
|
70
|
+
label: "Close history panel",
|
|
71
|
+
Icon: X
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
var toneTextClass = {
|
|
75
|
+
primary: "text-card-foreground",
|
|
76
|
+
success: "text-card-foreground",
|
|
77
|
+
info: "text-card-foreground",
|
|
78
|
+
warning: "text-card-foreground",
|
|
79
|
+
destructive: "text-card-foreground",
|
|
80
|
+
muted: "text-card-foreground"
|
|
81
|
+
};
|
|
82
|
+
var toneDotClass = {
|
|
83
|
+
primary: "bg-primary",
|
|
84
|
+
success: "bg-success",
|
|
85
|
+
info: "bg-info",
|
|
86
|
+
warning: "bg-warning",
|
|
87
|
+
destructive: "bg-destructive",
|
|
88
|
+
muted: "bg-muted-foreground"
|
|
89
|
+
};
|
|
90
|
+
var priorityConfig = {
|
|
91
|
+
low: {
|
|
92
|
+
Icon: ArrowDown,
|
|
93
|
+
className: "text-card-foreground"
|
|
94
|
+
},
|
|
95
|
+
medium: {
|
|
96
|
+
Icon: Minus,
|
|
97
|
+
className: "text-card-foreground"
|
|
98
|
+
},
|
|
99
|
+
important: {
|
|
100
|
+
Icon: ChevronsUp,
|
|
101
|
+
className: "text-card-foreground"
|
|
102
|
+
},
|
|
103
|
+
urgent: {
|
|
104
|
+
Icon: ArrowUp,
|
|
105
|
+
className: "text-card-foreground"
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
var historyDisclosureRevealClassName = "motion-safe:animate-in motion-safe:fade-in-0 motion-safe:slide-in-from-top-1 motion-safe:duration-150";
|
|
109
|
+
function getActorFallback(actor) {
|
|
110
|
+
return actor.fallback ?? actor.name;
|
|
111
|
+
}
|
|
112
|
+
function getEventCount(groups) {
|
|
113
|
+
return groups.reduce((count, group) => count + group.events.length, 0);
|
|
114
|
+
}
|
|
115
|
+
function getEventPositions(groups) {
|
|
116
|
+
const positions = /* @__PURE__ */ new Map();
|
|
117
|
+
let position = 1;
|
|
118
|
+
for (const group of groups) for (const event of group.events) {
|
|
119
|
+
positions.set(event.id, position);
|
|
120
|
+
position += 1;
|
|
121
|
+
}
|
|
122
|
+
return positions;
|
|
123
|
+
}
|
|
124
|
+
function getCollectionEventValueCount(event) {
|
|
125
|
+
return (event.added?.length ?? 0) + (event.removed?.length ?? 0);
|
|
126
|
+
}
|
|
127
|
+
function getCollapsibleSummary(event, threshold) {
|
|
128
|
+
switch (event.type) {
|
|
129
|
+
case "update-fields": return event.changes.length >= threshold ? `${event.changes.length} Fields` : null;
|
|
130
|
+
case "tags": return getCollectionEventValueCount(event) >= threshold ? getDeltaSummary(event.added, event.removed) : null;
|
|
131
|
+
case "attachment": return getCollectionEventValueCount(event) >= threshold ? getDeltaSummary(event.added, event.removed) : null;
|
|
132
|
+
case "delete-comment": return event.originalText ? "deleted comment" : null;
|
|
133
|
+
case "create":
|
|
134
|
+
case "reassign":
|
|
135
|
+
case "comment":
|
|
136
|
+
case "delete-record": return null;
|
|
137
|
+
default: return assertNever(event);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
function isCollapsibleEvent(event, threshold) {
|
|
141
|
+
return getCollapsibleSummary(event, threshold) !== null;
|
|
142
|
+
}
|
|
143
|
+
function getDefaultExpandedEventIds(groups, threshold, autoExpandNewestLargeEdit) {
|
|
144
|
+
const ids = /* @__PURE__ */ new Set();
|
|
145
|
+
let didAutoExpandLargeEdit = false;
|
|
146
|
+
for (const group of groups) for (const event of group.events) {
|
|
147
|
+
if (event.defaultExpanded === true && isCollapsibleEvent(event, threshold)) ids.add(event.id);
|
|
148
|
+
if (autoExpandNewestLargeEdit && !didAutoExpandLargeEdit && event.defaultExpanded !== false && event.type === "update-fields" && event.changes.length >= threshold) {
|
|
149
|
+
ids.add(event.id);
|
|
150
|
+
didAutoExpandLargeEdit = true;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return Array.from(ids);
|
|
154
|
+
}
|
|
155
|
+
function getDeltaSummary(added, removed) {
|
|
156
|
+
const parts = [];
|
|
157
|
+
if (added?.length) parts.push(`+${added.length}`);
|
|
158
|
+
if (removed?.length) parts.push(`-${removed.length}`);
|
|
159
|
+
return parts.join(" ");
|
|
160
|
+
}
|
|
161
|
+
function useExpandedEventIds({ groups, threshold, autoExpandNewestLargeEdit, expandedEventIds, defaultExpandedEventIds, onExpandedEventIdsChange }) {
|
|
162
|
+
const computedDefaultIds = React.useMemo(() => defaultExpandedEventIds ?? getDefaultExpandedEventIds(groups, threshold, autoExpandNewestLargeEdit), [
|
|
163
|
+
autoExpandNewestLargeEdit,
|
|
164
|
+
defaultExpandedEventIds,
|
|
165
|
+
groups,
|
|
166
|
+
threshold
|
|
167
|
+
]);
|
|
168
|
+
const [internalIds, setInternalIds] = React.useState(computedDefaultIds);
|
|
169
|
+
const isControlled = expandedEventIds !== void 0;
|
|
170
|
+
const activeIds = isControlled ? expandedEventIds : internalIds;
|
|
171
|
+
const setExpanded = React.useCallback((eventId, nextExpanded) => {
|
|
172
|
+
const next = new Set(activeIds);
|
|
173
|
+
if (nextExpanded) next.add(eventId);
|
|
174
|
+
else next.delete(eventId);
|
|
175
|
+
const nextIds = Array.from(next);
|
|
176
|
+
if (!isControlled) setInternalIds(nextIds);
|
|
177
|
+
onExpandedEventIdsChange?.(nextIds);
|
|
178
|
+
}, [
|
|
179
|
+
activeIds,
|
|
180
|
+
isControlled,
|
|
181
|
+
onExpandedEventIdsChange
|
|
182
|
+
]);
|
|
183
|
+
return {
|
|
184
|
+
expandedIdSet: React.useMemo(() => new Set(activeIds), [activeIds]),
|
|
185
|
+
setExpanded
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
function HistoryMiniPerson({ person }) {
|
|
189
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
190
|
+
className: "inline-flex min-w-0 items-center gap-1",
|
|
191
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
192
|
+
"data-slot": "history-mini-person-avatar",
|
|
193
|
+
"aria-hidden": "true",
|
|
194
|
+
className: "shrink-0",
|
|
195
|
+
children: /* @__PURE__ */ jsx(Avatar, {
|
|
196
|
+
src: person.avatarSrc,
|
|
197
|
+
fallback: getActorFallback(person),
|
|
198
|
+
alt: "",
|
|
199
|
+
size: "xs",
|
|
200
|
+
shape: "circle",
|
|
201
|
+
className: "size-4"
|
|
202
|
+
})
|
|
203
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
204
|
+
className: "truncate",
|
|
205
|
+
children: person.name
|
|
60
206
|
})]
|
|
61
207
|
});
|
|
62
208
|
}
|
|
63
|
-
function
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
209
|
+
function HistoryValue({ value, state = "current", className }) {
|
|
210
|
+
const stateClassName = cn((state === "previous" || state === "removed") && "text-secondary-foreground line-through decoration-current/60", state === "added" && "text-card-foreground", state === "removed" && "text-secondary-foreground");
|
|
211
|
+
switch (value.type) {
|
|
212
|
+
case "status": {
|
|
213
|
+
const tone = value.tone ?? "info";
|
|
214
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
215
|
+
"data-slot": "history-value",
|
|
216
|
+
className: cn("inline-flex min-w-0 items-center gap-1 font-medium", toneTextClass[tone], stateClassName, className),
|
|
217
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
218
|
+
"aria-hidden": "true",
|
|
219
|
+
className: cn("size-1.5 rounded-full", toneDotClass[tone])
|
|
220
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
221
|
+
className: "truncate",
|
|
222
|
+
children: value.label
|
|
223
|
+
})]
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
case "priority": {
|
|
227
|
+
const { Icon, className: priorityClassName } = priorityConfig[value.priority ?? "medium"];
|
|
228
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
229
|
+
"data-slot": "history-value",
|
|
230
|
+
className: cn("inline-flex min-w-0 items-center gap-1 font-medium", priorityClassName, stateClassName, className),
|
|
231
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
232
|
+
"aria-hidden": "true",
|
|
233
|
+
className: "size-3.5 shrink-0"
|
|
234
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
235
|
+
className: "truncate",
|
|
236
|
+
children: value.label
|
|
237
|
+
})]
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
case "person": return /* @__PURE__ */ jsx("span", {
|
|
241
|
+
"data-slot": "history-value",
|
|
242
|
+
className: cn("inline-flex min-w-0 items-center font-medium text-card-foreground", stateClassName, className),
|
|
243
|
+
children: /* @__PURE__ */ jsx(HistoryMiniPerson, { person: value.person })
|
|
244
|
+
});
|
|
245
|
+
case "date": return /* @__PURE__ */ jsx("span", {
|
|
246
|
+
"data-slot": "history-value",
|
|
247
|
+
className: cn("inline-block min-w-0 truncate font-mono text-card-foreground", stateClassName, className),
|
|
248
|
+
children: value.value
|
|
249
|
+
});
|
|
250
|
+
case "number": return /* @__PURE__ */ jsxs("span", {
|
|
251
|
+
"data-slot": "history-value",
|
|
252
|
+
className: cn("inline-flex min-w-0 items-baseline gap-1 font-mono text-card-foreground", stateClassName, className),
|
|
253
|
+
children: [/* @__PURE__ */ jsx("span", { children: value.value }), value.unit && /* @__PURE__ */ jsx("span", {
|
|
254
|
+
className: "text-secondary-foreground",
|
|
255
|
+
children: value.unit
|
|
82
256
|
})]
|
|
83
|
-
})
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
257
|
+
});
|
|
258
|
+
case "tag": return /* @__PURE__ */ jsxs("span", {
|
|
259
|
+
"data-slot": "history-value",
|
|
260
|
+
className: cn("inline-flex min-w-0 items-center gap-0.5 font-medium", toneTextClass[value.tone ?? "primary"], stateClassName, className),
|
|
261
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
262
|
+
"aria-hidden": "true",
|
|
263
|
+
children: "#"
|
|
264
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
265
|
+
className: "truncate",
|
|
266
|
+
children: value.label
|
|
267
|
+
})]
|
|
268
|
+
});
|
|
269
|
+
case "boolean": {
|
|
270
|
+
const label = value.value ? value.trueLabel ?? "On" : value.falseLabel ?? "Off";
|
|
271
|
+
const tone = value.value ? "success" : "muted";
|
|
272
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
273
|
+
"data-slot": "history-value",
|
|
274
|
+
className: cn("inline-flex min-w-0 items-center gap-1 font-medium", toneTextClass[tone], stateClassName, className),
|
|
275
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
276
|
+
"aria-hidden": "true",
|
|
277
|
+
className: cn("size-1.5 rounded-full", toneDotClass[tone])
|
|
278
|
+
}), /* @__PURE__ */ jsx("span", { children: label })]
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
case "file": return /* @__PURE__ */ jsxs("span", {
|
|
282
|
+
"data-slot": "history-value",
|
|
283
|
+
className: cn("inline-flex min-w-0 items-center gap-1 font-medium text-card-foreground", stateClassName, className),
|
|
284
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
285
|
+
"aria-hidden": "true",
|
|
286
|
+
className: "shrink-0",
|
|
287
|
+
children: /* @__PURE__ */ jsx(FileTypeIcon, {
|
|
288
|
+
extension: value.extension,
|
|
289
|
+
fileType: value.extension ? void 0 : "document",
|
|
290
|
+
size: "xs"
|
|
96
291
|
})
|
|
97
|
-
}), /* @__PURE__ */ jsx(
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
variant: "primary",
|
|
101
|
-
size: "lg",
|
|
102
|
-
loading,
|
|
103
|
-
className: cn(stackedLayout && "w-full"),
|
|
104
|
-
children: submitLabel
|
|
292
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
293
|
+
className: "truncate",
|
|
294
|
+
children: value.name
|
|
105
295
|
})]
|
|
296
|
+
});
|
|
297
|
+
case "text": return /* @__PURE__ */ jsx("span", {
|
|
298
|
+
"data-slot": "history-value",
|
|
299
|
+
className: cn("inline-block min-w-0 truncate text-card-foreground", stateClassName, className),
|
|
300
|
+
children: value.value
|
|
301
|
+
});
|
|
302
|
+
case "empty": return /* @__PURE__ */ jsx("span", {
|
|
303
|
+
"data-slot": "history-value",
|
|
304
|
+
className: cn("inline-block min-w-0 truncate italic text-secondary-foreground", className),
|
|
305
|
+
children: value.label ?? "Empty"
|
|
306
|
+
});
|
|
307
|
+
default: return assertNever(value);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
function HistoryFieldChangeRow({ change }) {
|
|
311
|
+
const hasDelta = (change.added?.length ?? 0) + (change.removed?.length ?? 0) > 0;
|
|
312
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
313
|
+
"data-slot": "history-field-change",
|
|
314
|
+
className: "flex min-w-0 items-start gap-2 text-sm leading-5",
|
|
315
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
316
|
+
className: "min-w-[72px] shrink-0 font-semibold text-secondary-foreground",
|
|
317
|
+
children: change.label
|
|
318
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
319
|
+
className: "flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-1",
|
|
320
|
+
children: hasDelta ? /* @__PURE__ */ jsxs(Fragment, { children: [change.added?.map((value, index) => /* @__PURE__ */ jsxs("span", {
|
|
321
|
+
className: "inline-flex min-w-0 items-center gap-1",
|
|
322
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
323
|
+
className: "font-mono font-semibold text-secondary-foreground",
|
|
324
|
+
children: "+"
|
|
325
|
+
}), /* @__PURE__ */ jsx(HistoryValue, {
|
|
326
|
+
value,
|
|
327
|
+
state: "added"
|
|
328
|
+
})]
|
|
329
|
+
}, `added:${change.id}:${index}`)), change.removed?.map((value, index) => /* @__PURE__ */ jsxs("span", {
|
|
330
|
+
className: "inline-flex min-w-0 items-center gap-1",
|
|
331
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
332
|
+
className: "font-mono font-semibold text-secondary-foreground",
|
|
333
|
+
children: "-"
|
|
334
|
+
}), /* @__PURE__ */ jsx(HistoryValue, {
|
|
335
|
+
value,
|
|
336
|
+
state: "removed"
|
|
337
|
+
})]
|
|
338
|
+
}, `removed:${change.id}:${index}`))] }) : /* @__PURE__ */ jsxs(Fragment, { children: [change.from && /* @__PURE__ */ jsx(HistoryValue, {
|
|
339
|
+
value: change.from,
|
|
340
|
+
state: "previous"
|
|
341
|
+
}), change.to && /* @__PURE__ */ jsx(HistoryValue, { value: change.to })] })
|
|
106
342
|
})]
|
|
107
343
|
});
|
|
108
344
|
}
|
|
109
|
-
function
|
|
110
|
-
return /* @__PURE__ */
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
345
|
+
function HistoryCollectionChange({ label, added, removed }) {
|
|
346
|
+
return /* @__PURE__ */ jsx(HistoryFieldChangeRow, { change: {
|
|
347
|
+
id: label.toLowerCase().replace(/\s+/g, "-"),
|
|
348
|
+
label,
|
|
349
|
+
added,
|
|
350
|
+
removed
|
|
351
|
+
} });
|
|
352
|
+
}
|
|
353
|
+
function HistoryCollapsedSummaryButton({ event, expanded, summary, controlsId, onToggle }) {
|
|
354
|
+
const isDeleteComment = event.type === "delete-comment";
|
|
355
|
+
const buttonLabel = isDeleteComment ? expanded ? "Hide" : "View" : expanded ? "Show less" : "Show all";
|
|
356
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
357
|
+
type: "button",
|
|
358
|
+
"data-slot": "history-collapse-trigger",
|
|
359
|
+
"aria-expanded": expanded,
|
|
360
|
+
"aria-controls": controlsId,
|
|
361
|
+
onClick: onToggle,
|
|
362
|
+
className: cn("group/history-collapse flex min-h-11 w-full min-w-0 items-center gap-2 rounded-lg border border-border px-2.5 py-2 text-left text-sm leading-5 sm:min-h-0 sm:py-1", "transition-[background-color,border-color,box-shadow,transform] duration-150 ease-out motion-reduce:transition-none", "hover:bg-muted/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background active:scale-[0.99] motion-reduce:active:scale-100", isDeleteComment ? "hover:border-destructive/30" : "hover:border-primary/30", isDeleteComment && "border-dashed py-3"),
|
|
363
|
+
children: [
|
|
364
|
+
isDeleteComment ? /* @__PURE__ */ jsx(Trash2, {
|
|
365
|
+
"aria-hidden": "true",
|
|
366
|
+
className: "size-4 shrink-0 text-destructive motion-safe:transition-transform motion-safe:duration-150 motion-safe:group-hover/history-collapse:scale-105"
|
|
367
|
+
}) : /* @__PURE__ */ jsx(ChevronIndicator, { expanded }),
|
|
368
|
+
/* @__PURE__ */ jsx("span", {
|
|
369
|
+
className: "min-w-0 flex-1 text-secondary-foreground",
|
|
370
|
+
children: isDeleteComment ? summary : event.type === "tags" ? "Tags" : "Updated"
|
|
371
|
+
}),
|
|
372
|
+
!isDeleteComment && /* @__PURE__ */ jsx("span", {
|
|
373
|
+
className: "min-w-0 flex-1 truncate font-semibold text-foreground",
|
|
374
|
+
children: summary
|
|
375
|
+
}),
|
|
376
|
+
/* @__PURE__ */ jsx("span", {
|
|
377
|
+
className: "shrink-0 text-xs font-medium text-secondary-foreground motion-safe:transition-transform motion-safe:duration-150 motion-safe:group-hover/history-collapse:translate-x-0.5",
|
|
378
|
+
children: buttonLabel
|
|
379
|
+
})
|
|
380
|
+
]
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
function ChevronIndicator({ expanded }) {
|
|
384
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
385
|
+
"aria-hidden": "true",
|
|
386
|
+
viewBox: "0 0 16 16",
|
|
387
|
+
className: cn("size-4 shrink-0 text-muted-foreground transition-[color,transform] duration-150 ease-out motion-reduce:transition-none group-hover/history-collapse:text-primary", expanded && "rotate-180"),
|
|
388
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
389
|
+
d: "M4 6l4 4 4-4",
|
|
390
|
+
fill: "none",
|
|
391
|
+
stroke: "currentColor",
|
|
392
|
+
strokeLinecap: "round",
|
|
393
|
+
strokeLinejoin: "round",
|
|
394
|
+
strokeWidth: "1.5"
|
|
395
|
+
})
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
function HistoryEventBody({ event, threshold, expanded, contentId, onToggleExpanded }) {
|
|
399
|
+
const category = historyEventCategoryConfig[event.type];
|
|
400
|
+
const summary = getCollapsibleSummary(event, threshold);
|
|
401
|
+
switch (event.type) {
|
|
402
|
+
case "create": return /* @__PURE__ */ jsxs("p", {
|
|
403
|
+
className: "min-w-0 text-sm font-medium leading-5",
|
|
117
404
|
children: [
|
|
118
|
-
/* @__PURE__ */ jsx("
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
loading: "lazy",
|
|
122
|
-
className: "absolute inset-0 size-full object-cover"
|
|
405
|
+
/* @__PURE__ */ jsx("span", {
|
|
406
|
+
className: category.actionClassName,
|
|
407
|
+
children: event.actionLabel ?? "Created the project"
|
|
123
408
|
}),
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
fill: "currentColor",
|
|
133
|
-
viewBox: "0 0 16 16",
|
|
134
|
-
children: /* @__PURE__ */ jsx("path", { d: "M4 3.5v9l8-4.5-8-4.5z" })
|
|
135
|
-
})
|
|
409
|
+
" ",
|
|
410
|
+
/* @__PURE__ */ jsxs("span", {
|
|
411
|
+
className: "text-card-foreground",
|
|
412
|
+
children: [
|
|
413
|
+
"\"",
|
|
414
|
+
event.target,
|
|
415
|
+
"\""
|
|
416
|
+
]
|
|
136
417
|
})
|
|
137
418
|
]
|
|
419
|
+
});
|
|
420
|
+
case "delete-record": return /* @__PURE__ */ jsxs("p", {
|
|
421
|
+
className: "min-w-0 text-sm font-medium leading-5",
|
|
422
|
+
children: [
|
|
423
|
+
/* @__PURE__ */ jsx("span", {
|
|
424
|
+
className: category.actionClassName,
|
|
425
|
+
children: event.actionLabel ?? "Deleted the record"
|
|
426
|
+
}),
|
|
427
|
+
" ",
|
|
428
|
+
/* @__PURE__ */ jsxs("span", {
|
|
429
|
+
className: "text-card-foreground",
|
|
430
|
+
children: [
|
|
431
|
+
"\"",
|
|
432
|
+
event.target,
|
|
433
|
+
"\""
|
|
434
|
+
]
|
|
435
|
+
})
|
|
436
|
+
]
|
|
437
|
+
});
|
|
438
|
+
case "update-fields":
|
|
439
|
+
if (summary !== null) return /* @__PURE__ */ jsxs("div", {
|
|
440
|
+
className: "flex min-w-0 flex-col gap-2",
|
|
441
|
+
children: [/* @__PURE__ */ jsx(HistoryCollapsedSummaryButton, {
|
|
442
|
+
event,
|
|
443
|
+
expanded,
|
|
444
|
+
summary,
|
|
445
|
+
controlsId: contentId,
|
|
446
|
+
onToggle: onToggleExpanded
|
|
447
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
448
|
+
id: contentId,
|
|
449
|
+
hidden: !expanded,
|
|
450
|
+
className: cn("flex min-w-0 flex-col gap-2 ps-2", historyDisclosureRevealClassName),
|
|
451
|
+
children: expanded && event.changes.map((change) => /* @__PURE__ */ jsx(HistoryFieldChangeRow, { change }, change.id))
|
|
452
|
+
})]
|
|
453
|
+
});
|
|
454
|
+
return /* @__PURE__ */ jsx("div", {
|
|
455
|
+
className: "flex min-w-0 flex-col gap-2",
|
|
456
|
+
children: event.changes.map((change) => /* @__PURE__ */ jsx(HistoryFieldChangeRow, { change }, change.id))
|
|
457
|
+
});
|
|
458
|
+
case "reassign": return /* @__PURE__ */ jsx(HistoryFieldChangeRow, { change: {
|
|
459
|
+
id: `${event.id}:reassign`,
|
|
460
|
+
label: event.fieldLabel ?? "Assignee",
|
|
461
|
+
removed: event.from?.map((person) => ({
|
|
462
|
+
type: "person",
|
|
463
|
+
person
|
|
464
|
+
})),
|
|
465
|
+
added: event.to.map((person) => ({
|
|
466
|
+
type: "person",
|
|
467
|
+
person
|
|
468
|
+
}))
|
|
469
|
+
} });
|
|
470
|
+
case "tags":
|
|
471
|
+
if (summary !== null) return /* @__PURE__ */ jsxs("div", {
|
|
472
|
+
className: "flex min-w-0 flex-col gap-2",
|
|
473
|
+
children: [/* @__PURE__ */ jsx(HistoryCollapsedSummaryButton, {
|
|
474
|
+
event,
|
|
475
|
+
expanded,
|
|
476
|
+
summary,
|
|
477
|
+
controlsId: contentId,
|
|
478
|
+
onToggle: onToggleExpanded
|
|
479
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
480
|
+
id: contentId,
|
|
481
|
+
hidden: !expanded,
|
|
482
|
+
className: historyDisclosureRevealClassName,
|
|
483
|
+
children: expanded && /* @__PURE__ */ jsx(HistoryCollectionChange, {
|
|
484
|
+
label: event.fieldLabel ?? "Tags",
|
|
485
|
+
added: event.added,
|
|
486
|
+
removed: event.removed
|
|
487
|
+
})
|
|
488
|
+
})]
|
|
489
|
+
});
|
|
490
|
+
return /* @__PURE__ */ jsx(HistoryCollectionChange, {
|
|
491
|
+
label: event.fieldLabel ?? "Tags",
|
|
492
|
+
added: event.added,
|
|
493
|
+
removed: event.removed
|
|
494
|
+
});
|
|
495
|
+
case "attachment":
|
|
496
|
+
if (summary !== null) return /* @__PURE__ */ jsxs("div", {
|
|
497
|
+
className: "flex min-w-0 flex-col gap-2",
|
|
498
|
+
children: [/* @__PURE__ */ jsx(HistoryCollapsedSummaryButton, {
|
|
499
|
+
event,
|
|
500
|
+
expanded,
|
|
501
|
+
summary,
|
|
502
|
+
controlsId: contentId,
|
|
503
|
+
onToggle: onToggleExpanded
|
|
504
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
505
|
+
id: contentId,
|
|
506
|
+
hidden: !expanded,
|
|
507
|
+
className: historyDisclosureRevealClassName,
|
|
508
|
+
children: expanded && /* @__PURE__ */ jsx(HistoryCollectionChange, {
|
|
509
|
+
label: event.fieldLabel ?? "Attachment",
|
|
510
|
+
added: event.added,
|
|
511
|
+
removed: event.removed
|
|
512
|
+
})
|
|
513
|
+
})]
|
|
514
|
+
});
|
|
515
|
+
return /* @__PURE__ */ jsx(HistoryCollectionChange, {
|
|
516
|
+
label: event.fieldLabel ?? "Attachment",
|
|
517
|
+
added: event.added,
|
|
518
|
+
removed: event.removed
|
|
519
|
+
});
|
|
520
|
+
case "comment": return /* @__PURE__ */ jsx("blockquote", {
|
|
521
|
+
className: "rounded-xl border border-warning/20 bg-warning/10 px-3 py-2 text-sm leading-5 text-card-foreground",
|
|
522
|
+
children: event.comment
|
|
523
|
+
});
|
|
524
|
+
case "delete-comment": return /* @__PURE__ */ jsxs("div", {
|
|
525
|
+
className: "flex min-w-0 flex-col gap-2",
|
|
526
|
+
children: [/* @__PURE__ */ jsx(HistoryCollapsedSummaryButton, {
|
|
527
|
+
event,
|
|
528
|
+
expanded,
|
|
529
|
+
summary: event.actionLabel ?? `Comment by ${event.commentAuthor.name} was deleted`,
|
|
530
|
+
controlsId: contentId,
|
|
531
|
+
onToggle: onToggleExpanded
|
|
532
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
533
|
+
id: contentId,
|
|
534
|
+
hidden: !expanded,
|
|
535
|
+
className: historyDisclosureRevealClassName,
|
|
536
|
+
children: expanded && event.originalText && /* @__PURE__ */ jsx("blockquote", {
|
|
537
|
+
className: "rounded-lg border border-dashed border-border bg-muted/40 px-3 py-2 text-sm leading-5 text-secondary-foreground",
|
|
538
|
+
children: event.originalText
|
|
539
|
+
})
|
|
540
|
+
})]
|
|
541
|
+
});
|
|
542
|
+
default: return assertNever(event);
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
function HistoryActorNode({ actor, type, showConnector }) {
|
|
546
|
+
const category = historyEventCategoryConfig[type];
|
|
547
|
+
const Icon = category.Icon;
|
|
548
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
549
|
+
"data-slot": "history-event-node",
|
|
550
|
+
"aria-hidden": "true",
|
|
551
|
+
className: "relative flex w-8 shrink-0 self-stretch justify-center",
|
|
552
|
+
children: [
|
|
553
|
+
/* @__PURE__ */ jsx(Avatar, {
|
|
554
|
+
src: actor.avatarSrc,
|
|
555
|
+
fallback: getActorFallback(actor),
|
|
556
|
+
alt: "",
|
|
557
|
+
size: "sm",
|
|
558
|
+
shape: "circle",
|
|
559
|
+
className: "relative z-10"
|
|
560
|
+
}),
|
|
561
|
+
/* @__PURE__ */ jsx("span", {
|
|
562
|
+
"aria-hidden": "true",
|
|
563
|
+
className: cn("absolute left-[22px] top-[21px] z-20 flex size-4 items-center justify-center rounded-full ring-1 motion-safe:transition-[box-shadow,transform] motion-safe:duration-150 motion-safe:group-hover/history-event:scale-105 group-hover/history-event:shadow-sm", category.badgeClassName),
|
|
564
|
+
children: /* @__PURE__ */ jsx(Icon, { className: "size-3" })
|
|
565
|
+
}),
|
|
566
|
+
showConnector && /* @__PURE__ */ jsx("span", {
|
|
567
|
+
"aria-hidden": "true",
|
|
568
|
+
className: "absolute bottom-[-12px] top-9 w-px rounded-full bg-border"
|
|
569
|
+
})
|
|
570
|
+
]
|
|
571
|
+
});
|
|
572
|
+
}
|
|
573
|
+
function HistoryActorFlags({ flags }) {
|
|
574
|
+
if (!flags?.length) return null;
|
|
575
|
+
return /* @__PURE__ */ jsx("span", {
|
|
576
|
+
className: "inline-flex min-w-0 items-center gap-1",
|
|
577
|
+
children: flags.map((flag) => /* @__PURE__ */ jsx(Badge, {
|
|
578
|
+
variant: "soft",
|
|
579
|
+
color: "purple",
|
|
580
|
+
size: "xs",
|
|
581
|
+
children: flag
|
|
582
|
+
}, flag))
|
|
583
|
+
});
|
|
584
|
+
}
|
|
585
|
+
function HistoryItem({ event, threshold, isLastInGroup, position, total, expanded, onExpandedChange }) {
|
|
586
|
+
const category = historyEventCategoryConfig[event.type];
|
|
587
|
+
const headerId = React.useId();
|
|
588
|
+
const contentId = React.useId();
|
|
589
|
+
return /* @__PURE__ */ jsxs("article", {
|
|
590
|
+
"data-slot": "history-event",
|
|
591
|
+
"aria-labelledby": headerId,
|
|
592
|
+
"aria-setsize": total,
|
|
593
|
+
"aria-posinset": position,
|
|
594
|
+
className: "group/history-event flex min-w-0 gap-4 rounded-lg py-1 transition-colors duration-150 ease-out motion-reduce:transition-none hover:bg-muted/20",
|
|
595
|
+
children: [/* @__PURE__ */ jsx(HistoryActorNode, {
|
|
596
|
+
actor: event.actor,
|
|
597
|
+
type: event.type,
|
|
598
|
+
showConnector: !isLastInGroup
|
|
138
599
|
}), /* @__PURE__ */ jsxs("div", {
|
|
139
|
-
className: "flex
|
|
600
|
+
className: "flex min-w-0 flex-1 flex-col gap-1",
|
|
140
601
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
141
|
-
className: "flex
|
|
142
|
-
children: [/* @__PURE__ */
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
602
|
+
className: "flex min-w-0 items-center gap-2",
|
|
603
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
604
|
+
id: headerId,
|
|
605
|
+
className: "flex min-w-0 items-center gap-1.5 font-bold text-sm leading-5 text-card-foreground",
|
|
606
|
+
children: [
|
|
607
|
+
/* @__PURE__ */ jsx("span", {
|
|
608
|
+
className: "truncate",
|
|
609
|
+
children: event.actor.name
|
|
610
|
+
}),
|
|
611
|
+
/* @__PURE__ */ jsx(HistoryActorFlags, { flags: event.actorFlags }),
|
|
612
|
+
/* @__PURE__ */ jsx("span", {
|
|
613
|
+
className: "sr-only",
|
|
614
|
+
children: category.label
|
|
615
|
+
})
|
|
616
|
+
]
|
|
617
|
+
}), event.dateTime ? /* @__PURE__ */ jsx("time", {
|
|
618
|
+
dateTime: event.dateTime,
|
|
619
|
+
className: "ms-auto shrink-0 text-xs leading-4 text-secondary-foreground",
|
|
620
|
+
children: event.timestamp
|
|
621
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
622
|
+
className: "ms-auto shrink-0 text-xs leading-4 text-secondary-foreground",
|
|
623
|
+
children: event.timestamp
|
|
148
624
|
})]
|
|
149
|
-
}), /* @__PURE__ */ jsx(
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
onClick: onPrimaryClick,
|
|
156
|
-
className: "w-full",
|
|
157
|
-
children: primaryLabel
|
|
158
|
-
}), secondaryLabel && /* @__PURE__ */ jsx(Button, {
|
|
159
|
-
appearance: "outline",
|
|
160
|
-
variant: "secondary",
|
|
161
|
-
size: "md",
|
|
162
|
-
onClick: onSecondaryClick,
|
|
163
|
-
className: "w-full",
|
|
164
|
-
children: secondaryLabel
|
|
165
|
-
})] }) : /* @__PURE__ */ jsxs(Fragment, { children: [secondaryLabel && /* @__PURE__ */ jsx(Button, {
|
|
166
|
-
appearance: "outline",
|
|
167
|
-
variant: "secondary",
|
|
168
|
-
size: "md",
|
|
169
|
-
onClick: onSecondaryClick,
|
|
170
|
-
children: secondaryLabel
|
|
171
|
-
}), /* @__PURE__ */ jsx(Button, {
|
|
172
|
-
appearance: "gradient",
|
|
173
|
-
variant: "primary",
|
|
174
|
-
size: "md",
|
|
175
|
-
onClick: onPrimaryClick,
|
|
176
|
-
children: primaryLabel
|
|
177
|
-
})] })
|
|
625
|
+
}), /* @__PURE__ */ jsx(HistoryEventBody, {
|
|
626
|
+
event,
|
|
627
|
+
threshold,
|
|
628
|
+
expanded,
|
|
629
|
+
contentId,
|
|
630
|
+
onToggleExpanded: () => onExpandedChange(!expanded)
|
|
178
631
|
})]
|
|
179
632
|
})]
|
|
180
633
|
});
|
|
181
634
|
}
|
|
182
|
-
function
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
635
|
+
function HistoryGroupSeparator({ label }) {
|
|
636
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
637
|
+
"data-slot": "history-group-separator",
|
|
638
|
+
className: "flex w-full items-center gap-2 text-sm font-medium leading-5 text-secondary-foreground",
|
|
639
|
+
children: [/* @__PURE__ */ jsx("span", { children: label }), /* @__PURE__ */ jsx("span", {
|
|
640
|
+
"aria-hidden": "true",
|
|
641
|
+
className: "h-px min-w-0 flex-1 bg-border"
|
|
642
|
+
})]
|
|
643
|
+
});
|
|
189
644
|
}
|
|
190
|
-
|
|
645
|
+
function HistoryHeader({ title, actions }) {
|
|
646
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
647
|
+
"data-slot": "history-header",
|
|
648
|
+
className: "flex min-w-0 items-start gap-3 pb-2",
|
|
649
|
+
children: [/* @__PURE__ */ jsx("h2", {
|
|
650
|
+
className: "min-w-0 flex-1 text-lg font-semibold leading-7 text-foreground",
|
|
651
|
+
children: title
|
|
652
|
+
}), actions?.length ? /* @__PURE__ */ jsx("div", {
|
|
653
|
+
className: "flex shrink-0 items-center gap-1",
|
|
654
|
+
children: actions.map((action) => {
|
|
655
|
+
const config = historyHeaderActionConfig[action.id];
|
|
656
|
+
const Icon = config.Icon;
|
|
657
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
658
|
+
type: "button",
|
|
659
|
+
appearance: "ghost",
|
|
660
|
+
variant: "secondary",
|
|
661
|
+
size: "icon-xs",
|
|
662
|
+
shape: "rounded",
|
|
663
|
+
iconOnly: true,
|
|
664
|
+
disabled: action.disabled,
|
|
665
|
+
"aria-label": action.label ?? config.label,
|
|
666
|
+
onClick: action.onClick,
|
|
667
|
+
className: "size-11 text-secondary-foreground hover:text-foreground sm:size-6",
|
|
668
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
669
|
+
"aria-hidden": "true",
|
|
670
|
+
className: "size-4"
|
|
671
|
+
})
|
|
672
|
+
}, action.id);
|
|
673
|
+
})
|
|
674
|
+
}) : null]
|
|
675
|
+
});
|
|
676
|
+
}
|
|
677
|
+
var History = React.forwardRef(({ title = "History", groups, actions, loading, ariaLabel, emptyMessage = "No history events", collapsibleChangeThreshold = 5, autoExpandNewestLargeEdit = true, expandedEventIds, defaultExpandedEventIds, onExpandedEventIdsChange, className, ...props }, ref) => {
|
|
678
|
+
const totalEvents = React.useMemo(() => getEventCount(groups), [groups]);
|
|
679
|
+
const eventPositions = React.useMemo(() => getEventPositions(groups), [groups]);
|
|
680
|
+
const { expandedIdSet, setExpanded } = useExpandedEventIds({
|
|
681
|
+
groups,
|
|
682
|
+
threshold: collapsibleChangeThreshold,
|
|
683
|
+
autoExpandNewestLargeEdit,
|
|
684
|
+
expandedEventIds,
|
|
685
|
+
defaultExpandedEventIds,
|
|
686
|
+
onExpandedEventIdsChange
|
|
687
|
+
});
|
|
688
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
689
|
+
ref,
|
|
690
|
+
"data-slot": "history",
|
|
691
|
+
role: "feed",
|
|
692
|
+
"aria-label": ariaLabel ?? title,
|
|
693
|
+
"aria-busy": loading || void 0,
|
|
694
|
+
className: cn("flex w-full max-w-[400px] min-w-0 flex-col gap-4 overflow-hidden rounded-[var(--borderradius-rounded-box,12px)] border border-border bg-background p-6 shadow-lg", className),
|
|
695
|
+
...props,
|
|
696
|
+
children: [/* @__PURE__ */ jsx(HistoryHeader, {
|
|
697
|
+
title,
|
|
698
|
+
actions
|
|
699
|
+
}), loading && totalEvents === 0 ? /* @__PURE__ */ jsx("p", {
|
|
700
|
+
role: "status",
|
|
701
|
+
"aria-live": "polite",
|
|
702
|
+
className: "text-sm leading-5 text-secondary-foreground",
|
|
703
|
+
children: "Loading history"
|
|
704
|
+
}) : totalEvents === 0 ? /* @__PURE__ */ jsx("p", {
|
|
705
|
+
className: "text-sm leading-5 text-secondary-foreground",
|
|
706
|
+
children: emptyMessage
|
|
707
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
708
|
+
"data-slot": "history-groups",
|
|
709
|
+
className: "flex min-w-0 flex-col gap-4",
|
|
710
|
+
children: groups.map((group) => /* @__PURE__ */ jsxs("section", {
|
|
711
|
+
"data-slot": "history-group",
|
|
712
|
+
"aria-label": group.label,
|
|
713
|
+
className: "flex min-w-0 flex-col gap-2",
|
|
714
|
+
children: [/* @__PURE__ */ jsx(HistoryGroupSeparator, { label: group.label }), /* @__PURE__ */ jsx("div", {
|
|
715
|
+
className: "flex min-w-0 flex-col gap-4",
|
|
716
|
+
children: group.events.map((event, index) => /* @__PURE__ */ jsx(HistoryItem, {
|
|
717
|
+
event,
|
|
718
|
+
threshold: collapsibleChangeThreshold,
|
|
719
|
+
isLastInGroup: index === group.events.length - 1,
|
|
720
|
+
position: eventPositions.get(event.id) ?? 1,
|
|
721
|
+
total: totalEvents,
|
|
722
|
+
expanded: expandedIdSet.has(event.id),
|
|
723
|
+
onExpandedChange: (nextExpanded) => setExpanded(event.id, nextExpanded)
|
|
724
|
+
}, event.id))
|
|
725
|
+
})]
|
|
726
|
+
}, group.id))
|
|
727
|
+
})]
|
|
728
|
+
});
|
|
729
|
+
});
|
|
730
|
+
History.displayName = "History";
|
|
191
731
|
//#endregion
|
|
192
|
-
export {
|
|
732
|
+
export { History, HistoryValue, historyEventCategoryConfig, historyHeaderActionConfig };
|
|
193
733
|
|
|
194
734
|
//# sourceMappingURL=index196.js.map
|