@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/index195.js
CHANGED
|
@@ -1,734 +1,153 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "./index2.js";
|
|
3
|
+
import { Popover, PopoverPopup, PopoverTrigger } from "./index102.js";
|
|
4
|
+
import { Tag as Tag$1 } from "./index109.js";
|
|
5
|
+
import { Command as CommandNamespace, CommandEmpty, CommandGroup, CommandItem, CommandList } from "./index120.js";
|
|
6
|
+
import { Check, ChevronDown, Plus } from "lucide-react";
|
|
7
7
|
import * as React from "react";
|
|
8
|
-
import {
|
|
9
|
-
//#region src/components/organisms/content/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
//#region src/components/organisms/content/GroupingControls/GroupingControls.tsx
|
|
10
|
+
function GroupingControls({ table, groupableColumns: groupableColumnsProp, placeholder = "Group by...", maxLevels, variant, size = "md", className }) {
|
|
11
|
+
const [open, setOpen] = React.useState(false);
|
|
12
|
+
const grouping = table.getState().grouping;
|
|
13
|
+
const allGroupableColumns = React.useMemo(() => {
|
|
14
|
+
return table.getAllColumns().filter((col) => {
|
|
15
|
+
if (groupableColumnsProp) return groupableColumnsProp.includes(col.id);
|
|
16
|
+
return col.getCanGroup();
|
|
17
|
+
}).map((col) => ({
|
|
18
|
+
id: col.id,
|
|
19
|
+
label: typeof col.columnDef.header === "string" ? col.columnDef.header : col.id.charAt(0).toUpperCase() + col.id.slice(1)
|
|
20
|
+
}));
|
|
21
|
+
}, [table, groupableColumnsProp]);
|
|
22
|
+
const isMaxLevelsReached = maxLevels !== void 0 && grouping.length >= maxLevels;
|
|
23
|
+
const displayLabel = React.useMemo(() => {
|
|
24
|
+
if (grouping.length === 0) return placeholder;
|
|
25
|
+
return grouping.map((id) => {
|
|
26
|
+
return allGroupableColumns.find((c) => c.id === id)?.label || id;
|
|
27
|
+
}).join(", ");
|
|
28
|
+
}, [
|
|
29
|
+
grouping,
|
|
30
|
+
allGroupableColumns,
|
|
31
|
+
placeholder
|
|
167
32
|
]);
|
|
168
|
-
const
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
onExpandedEventIdsChange?.(nextIds);
|
|
33
|
+
const handleSelect = React.useCallback((columnId) => {
|
|
34
|
+
if (grouping.indexOf(columnId) >= 0) {
|
|
35
|
+
const newGrouping = grouping.filter((id) => id !== columnId);
|
|
36
|
+
table.setGrouping(newGrouping);
|
|
37
|
+
} else {
|
|
38
|
+
if (maxLevels !== void 0 && grouping.length >= maxLevels) return;
|
|
39
|
+
const newGrouping = [...grouping, columnId];
|
|
40
|
+
table.setGrouping(newGrouping);
|
|
41
|
+
}
|
|
178
42
|
}, [
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
43
|
+
grouping,
|
|
44
|
+
table,
|
|
45
|
+
maxLevels
|
|
182
46
|
]);
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
47
|
+
const getSelectionOrder = (columnId) => {
|
|
48
|
+
const index = grouping.indexOf(columnId);
|
|
49
|
+
return index >= 0 ? index + 1 : null;
|
|
186
50
|
};
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
className:
|
|
220
|
-
|
|
221
|
-
|
|
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
|
|
256
|
-
})]
|
|
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"
|
|
291
|
-
})
|
|
292
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
293
|
-
className: "truncate",
|
|
294
|
-
children: value.name
|
|
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 })] })
|
|
342
|
-
})]
|
|
343
|
-
});
|
|
344
|
-
}
|
|
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",
|
|
404
|
-
children: [
|
|
405
|
-
/* @__PURE__ */ jsx("span", {
|
|
406
|
-
className: category.actionClassName,
|
|
407
|
-
children: event.actionLabel ?? "Created the project"
|
|
408
|
-
}),
|
|
409
|
-
" ",
|
|
410
|
-
/* @__PURE__ */ jsxs("span", {
|
|
411
|
-
className: "text-card-foreground",
|
|
412
|
-
children: [
|
|
413
|
-
"\"",
|
|
414
|
-
event.target,
|
|
415
|
-
"\""
|
|
416
|
-
]
|
|
417
|
-
})
|
|
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
|
-
})
|
|
51
|
+
const availableColumns = React.useMemo(() => {
|
|
52
|
+
return allGroupableColumns.filter((col) => !grouping.includes(col.id));
|
|
53
|
+
}, [allGroupableColumns, grouping]);
|
|
54
|
+
const handleRemove = React.useCallback((columnId) => {
|
|
55
|
+
const newGrouping = grouping.filter((id) => id !== columnId);
|
|
56
|
+
table.setGrouping(newGrouping);
|
|
57
|
+
}, [grouping, table]);
|
|
58
|
+
const handleAddColumn = React.useCallback((columnId) => {
|
|
59
|
+
if (maxLevels !== void 0 && grouping.length >= maxLevels) return;
|
|
60
|
+
const newGrouping = [...grouping, columnId];
|
|
61
|
+
table.setGrouping(newGrouping);
|
|
62
|
+
setOpen(false);
|
|
63
|
+
}, [
|
|
64
|
+
grouping,
|
|
65
|
+
table,
|
|
66
|
+
maxLevels
|
|
67
|
+
]);
|
|
68
|
+
if (variant === "chips") {
|
|
69
|
+
const addColumnPopover = availableColumns.length > 0 && !isMaxLevelsReached ? /* @__PURE__ */ jsxs(Popover, {
|
|
70
|
+
open,
|
|
71
|
+
onOpenChange: setOpen,
|
|
72
|
+
children: [/* @__PURE__ */ jsx(PopoverTrigger, {
|
|
73
|
+
className: cn("inline-flex items-center justify-center rounded-md", "border border-dashed border-input bg-background", "hover:bg-accent hover:border-solid", "transition-[background-color,border-color] duration-150 ease-out motion-reduce:transition-none", size === "sm" ? "h-6 px-2 text-xs" : "h-7 px-2 text-sm"),
|
|
74
|
+
"aria-label": "Add grouping",
|
|
75
|
+
children: /* @__PURE__ */ jsx(Plus, { className: cn("size-3.5 transition-transform duration-200 motion-reduce:transition-none", open && "rotate-45") })
|
|
76
|
+
}), /* @__PURE__ */ jsx(PopoverPopup, {
|
|
77
|
+
side: "bottom",
|
|
78
|
+
align: "start",
|
|
79
|
+
className: "min-w-[180px] w-max max-w-[280px] p-0",
|
|
80
|
+
children: /* @__PURE__ */ jsx(CommandNamespace, { children: /* @__PURE__ */ jsxs(CommandList, { children: [/* @__PURE__ */ jsx(CommandEmpty, { children: "No columns available" }), /* @__PURE__ */ jsx(CommandGroup, { children: availableColumns.map((column) => /* @__PURE__ */ jsx(CommandItem, {
|
|
81
|
+
value: column.id,
|
|
82
|
+
onSelect: () => handleAddColumn(column.id),
|
|
83
|
+
className: "cursor-pointer",
|
|
84
|
+
children: column.label
|
|
85
|
+
}, column.id)) })] }) })
|
|
540
86
|
})]
|
|
87
|
+
}) : null;
|
|
88
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
89
|
+
"data-slot": "grouping-controls",
|
|
90
|
+
role: "toolbar",
|
|
91
|
+
"aria-label": "Grouping controls",
|
|
92
|
+
className: cn("flex flex-wrap items-center gap-2", className),
|
|
93
|
+
children: [grouping.length === 0 ? /* @__PURE__ */ jsx("span", {
|
|
94
|
+
className: "text-sm text-muted-foreground",
|
|
95
|
+
children: placeholder
|
|
96
|
+
}) : grouping.map((columnId) => {
|
|
97
|
+
const column = allGroupableColumns.find((c) => c.id === columnId);
|
|
98
|
+
if (!column) return null;
|
|
99
|
+
return /* @__PURE__ */ jsx(Tag$1, {
|
|
100
|
+
size: size === "sm" ? "sm" : "md",
|
|
101
|
+
removable: true,
|
|
102
|
+
onRemove: () => handleRemove(columnId),
|
|
103
|
+
children: column.label
|
|
104
|
+
}, columnId);
|
|
105
|
+
}), addColumnPopover]
|
|
541
106
|
});
|
|
542
|
-
default: return assertNever(event);
|
|
543
107
|
}
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
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
|
|
599
|
-
}), /* @__PURE__ */ jsxs("div", {
|
|
600
|
-
className: "flex min-w-0 flex-1 flex-col gap-1",
|
|
601
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
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
|
|
624
|
-
})]
|
|
625
|
-
}), /* @__PURE__ */ jsx(HistoryEventBody, {
|
|
626
|
-
event,
|
|
627
|
-
threshold,
|
|
628
|
-
expanded,
|
|
629
|
-
contentId,
|
|
630
|
-
onToggleExpanded: () => onExpandedChange(!expanded)
|
|
631
|
-
})]
|
|
632
|
-
})]
|
|
633
|
-
});
|
|
634
|
-
}
|
|
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"
|
|
108
|
+
return /* @__PURE__ */ jsxs(Popover, {
|
|
109
|
+
open,
|
|
110
|
+
onOpenChange: setOpen,
|
|
111
|
+
children: [/* @__PURE__ */ jsxs(PopoverTrigger, {
|
|
112
|
+
"data-slot": "grouping-controls",
|
|
113
|
+
"aria-label": "Group by column",
|
|
114
|
+
className: cn("inline-flex items-center justify-between gap-2 whitespace-nowrap", "border border-input bg-background hover:bg-accent hover:text-accent-foreground", "rounded-md font-medium", "transition-[color,background-color,border-color,transform] duration-150 ease-out motion-reduce:transition-none", "active:translate-y-px", size === "sm" ? "h-8 px-3 text-sm" : "h-9 px-3.5 py-2.5 text-sm", className),
|
|
115
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
116
|
+
className: cn("truncate", grouping.length === 0 && "text-muted-foreground"),
|
|
117
|
+
children: displayLabel
|
|
118
|
+
}), /* @__PURE__ */ jsx(ChevronDown, { className: cn("size-4 shrink-0 opacity-50 transition-transform duration-200 motion-reduce:transition-none", open && "rotate-180") })]
|
|
119
|
+
}), /* @__PURE__ */ jsx(PopoverPopup, {
|
|
120
|
+
side: "bottom",
|
|
121
|
+
align: "start",
|
|
122
|
+
className: "min-w-[200px] w-max max-w-[300px] p-0",
|
|
123
|
+
children: /* @__PURE__ */ jsx(CommandNamespace, { children: /* @__PURE__ */ jsxs(CommandList, { children: [/* @__PURE__ */ jsx(CommandEmpty, { children: "No groupable columns" }), /* @__PURE__ */ jsx(CommandGroup, { children: allGroupableColumns.map((column) => {
|
|
124
|
+
const isSelected = grouping.includes(column.id);
|
|
125
|
+
const order = getSelectionOrder(column.id);
|
|
126
|
+
const isDisabled = !isSelected && isMaxLevelsReached;
|
|
127
|
+
return /* @__PURE__ */ jsxs(CommandItem, {
|
|
128
|
+
value: column.id,
|
|
129
|
+
onSelect: () => handleSelect(column.id),
|
|
130
|
+
disabled: isDisabled,
|
|
131
|
+
"data-disabled": isDisabled,
|
|
132
|
+
"data-slot": "combobox-item",
|
|
133
|
+
className: cn("flex items-center justify-between gap-2 px-2 py-1.5 cursor-pointer", isSelected && "bg-accent"),
|
|
134
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
135
|
+
className: "flex items-center gap-2",
|
|
136
|
+
children: [isSelected && /* @__PURE__ */ jsx(Check, {
|
|
137
|
+
className: "size-4 text-primary motion-safe:animate-in motion-safe:zoom-in-75 motion-safe:duration-150",
|
|
138
|
+
"aria-hidden": "true"
|
|
139
|
+
}), /* @__PURE__ */ jsx("span", { children: column.label })]
|
|
140
|
+
}), order !== null && /* @__PURE__ */ jsx("span", {
|
|
141
|
+
className: "inline-flex size-5 items-center justify-center rounded-full bg-primary/10 text-[11px] font-semibold text-primary motion-safe:animate-in motion-safe:zoom-in-75 motion-safe:duration-150",
|
|
142
|
+
children: order
|
|
143
|
+
})]
|
|
144
|
+
}, column.id);
|
|
145
|
+
}) })] }) })
|
|
642
146
|
})]
|
|
643
147
|
});
|
|
644
148
|
}
|
|
645
|
-
|
|
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";
|
|
149
|
+
GroupingControls.displayName = "GroupingControls";
|
|
731
150
|
//#endregion
|
|
732
|
-
export {
|
|
151
|
+
export { GroupingControls };
|
|
733
152
|
|
|
734
153
|
//# sourceMappingURL=index195.js.map
|