@expcat/tigercat-react 2.0.0-rc.2 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/dist/{chunk-IZYFETUS.mjs → chunk-3RY6M4AK.mjs} +1 -1
  2. package/dist/chunk-C6QK5MJT.mjs +292 -0
  3. package/dist/{chunk-44CQTGAN.mjs → chunk-E7OTDBI6.mjs} +2 -2
  4. package/dist/{chunk-DJ4PSDQS.mjs → chunk-FYINJRYN.mjs} +2 -2
  5. package/dist/{chunk-KFPQ6DIH.mjs → chunk-GV4F6X3C.mjs} +29 -25
  6. package/dist/{chunk-K6GJMKJR.mjs → chunk-HELLYIX2.mjs} +1 -1
  7. package/dist/{chunk-POP3TS4Q.mjs → chunk-NBQ3Q6DD.mjs} +56 -28
  8. package/dist/{chunk-3O2WHF3U.mjs → chunk-NCHUEGUW.mjs} +2 -2
  9. package/dist/{chunk-VD55SSP7.mjs → chunk-PD6Q36OO.mjs} +14 -6
  10. package/dist/{chunk-HXD7KMRP.mjs → chunk-UCBW5RJN.mjs} +31 -2
  11. package/dist/{chunk-5IHOOP5A.mjs → chunk-UD4DTVJZ.mjs} +64 -79
  12. package/dist/{chunk-A6JNS35U.mjs → chunk-UT5BV2VO.mjs} +2 -2
  13. package/dist/{chunk-N6JNLJIN.mjs → chunk-YCKY72BW.mjs} +5 -1
  14. package/dist/components/ActivityFeed.mjs +1 -1
  15. package/dist/components/AreaChart.mjs +1 -1
  16. package/dist/components/BarChart.mjs +1 -1
  17. package/dist/components/CommentThread.mjs +1 -1
  18. package/dist/components/CropUpload.mjs +2 -2
  19. package/dist/components/DataTableWithToolbar.mjs +2 -2
  20. package/dist/components/ImageCropper.mjs +1 -1
  21. package/dist/components/LineChart.mjs +1 -1
  22. package/dist/components/NotificationCenter.mjs +1 -1
  23. package/dist/components/ScatterChart.mjs +1 -1
  24. package/dist/components/Table.mjs +1 -1
  25. package/dist/components/Upload.mjs +1 -1
  26. package/dist/components/VirtualTable.mjs +1 -1
  27. package/dist/index.d.mts +1 -1
  28. package/package.json +2 -2
  29. package/dist/chunk-XIVU7TWX.mjs +0 -305
@@ -1,305 +0,0 @@
1
- import {
2
- Timeline
3
- } from "./chunk-QB5472NM.mjs";
4
- import {
5
- Link
6
- } from "./chunk-XZVQ3PJS.mjs";
7
- import {
8
- Loading
9
- } from "./chunk-AJJJ6HWC.mjs";
10
- import {
11
- Tag
12
- } from "./chunk-7EXOY7GD.mjs";
13
- import {
14
- Text
15
- } from "./chunk-HLS4CHWX.mjs";
16
- import {
17
- Card
18
- } from "./chunk-IXV5YBCZ.mjs";
19
- import {
20
- Avatar
21
- } from "./chunk-OO562MFD.mjs";
22
-
23
- // src/components/ActivityFeed.tsx
24
- import { useMemo } from "react";
25
- import {
26
- classNames,
27
- buildActivityGroups,
28
- formatActivityTime,
29
- toActivityTimelineItems,
30
- activityItemClasses,
31
- activityItemLayoutClasses,
32
- activityItemBodyClasses,
33
- activityItemHeaderClasses,
34
- activityItemTitleGroupClasses,
35
- activityItemDescriptionClasses,
36
- activityItemActionsClasses
37
- } from "@expcat/tigercat-core";
38
- import { jsx, jsxs } from "react/jsx-runtime";
39
- var renderAction = (item, action, index) => {
40
- const key = action.key ?? `${item.id}-action-${index}`;
41
- return /* @__PURE__ */ jsx(
42
- Link,
43
- {
44
- size: "sm",
45
- variant: "primary",
46
- underline: false,
47
- href: action.href,
48
- target: action.target,
49
- disabled: action.disabled,
50
- className: "inline-flex items-center px-2.5 py-1 rounded-lg hover:bg-blue-50/50 dark:hover:bg-blue-950/20 text-xs font-semibold transition-all duration-200",
51
- onClick: () => action.onClick?.(item, action),
52
- children: action.label
53
- },
54
- key
55
- );
56
- };
57
- var ActivityFeed = ({
58
- items = [],
59
- groups,
60
- groupBy,
61
- groupOrder,
62
- loading = false,
63
- loadingText = "\u52A0\u8F7D\u4E2D...",
64
- emptyText = "\u6682\u65E0\u52A8\u6001",
65
- showAvatar = true,
66
- showTime = true,
67
- showGroupTitle = true,
68
- renderItem,
69
- renderGroupHeader,
70
- className,
71
- ...props
72
- }) => {
73
- const resolvedGroups = useMemo(
74
- () => buildActivityGroups(items, groups, groupBy, groupOrder),
75
- [items, groups, groupBy, groupOrder]
76
- );
77
- const wrapperClasses = classNames(
78
- "tiger-activity-feed",
79
- "flex",
80
- "flex-col",
81
- "gap-6",
82
- "w-full",
83
- className
84
- );
85
- const renderDefaultItem = (item, index, group) => {
86
- if (renderItem) return renderItem(item, index, group);
87
- const titleText = item.title ?? (typeof item.content === "string" || typeof item.content === "number" ? String(item.content) : "");
88
- const descriptionText = item.description;
89
- const timeText = showTime ? formatActivityTime(item.time) : "";
90
- const actionNodes = item.actions?.map(
91
- (action, actionIndex) => renderAction(item, action, actionIndex)
92
- );
93
- return /* @__PURE__ */ jsx(
94
- "div",
95
- {
96
- className: classNames(
97
- activityItemClasses,
98
- "p-4 rounded-2xl border border-gray-100/70 dark:border-gray-800/40 bg-white/40 dark:bg-gray-900/15 backdrop-blur-sm shadow-sm transition-all duration-300 hover:shadow-md hover:shadow-gray-100/30 dark:hover:shadow-none hover:bg-white dark:hover:bg-gray-900/30 hover:-translate-y-0.5 w-full"
99
- ),
100
- children: /* @__PURE__ */ jsxs("div", { className: activityItemLayoutClasses, children: [
101
- showAvatar && item.user ? /* @__PURE__ */ jsx(
102
- Avatar,
103
- {
104
- size: "sm",
105
- src: item.user.avatar,
106
- text: item.user.name,
107
- className: "shrink-0 ring-2 ring-white dark:ring-gray-900 shadow-sm transition-transform hover:scale-105 duration-200"
108
- }
109
- ) : null,
110
- /* @__PURE__ */ jsxs("div", { className: activityItemBodyClasses, children: [
111
- /* @__PURE__ */ jsxs("div", { className: activityItemHeaderClasses, children: [
112
- /* @__PURE__ */ jsxs("div", { className: activityItemTitleGroupClasses, children: [
113
- titleText ? /* @__PURE__ */ jsx(
114
- Text,
115
- {
116
- tag: "div",
117
- size: "sm",
118
- weight: "semibold",
119
- className: "text-gray-900 dark:text-gray-100 hover:text-blue-600 dark:hover:text-blue-400 transition-colors cursor-pointer truncate",
120
- children: titleText
121
- }
122
- ) : null,
123
- item.status ? /* @__PURE__ */ jsx(
124
- Tag,
125
- {
126
- variant: item.status.variant ?? "default",
127
- size: "sm",
128
- className: "shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold tracking-wide uppercase border border-current bg-current/10 shadow-sm",
129
- children: item.status.label
130
- }
131
- ) : null
132
- ] }),
133
- timeText ? /* @__PURE__ */ jsx(
134
- Text,
135
- {
136
- tag: "div",
137
- size: "xs",
138
- color: "muted",
139
- className: "shrink-0 whitespace-nowrap font-medium text-gray-400 dark:text-gray-500",
140
- children: timeText
141
- }
142
- ) : null
143
- ] }),
144
- descriptionText ? /* @__PURE__ */ jsx(
145
- Text,
146
- {
147
- tag: "div",
148
- size: "sm",
149
- color: "muted",
150
- className: classNames(
151
- activityItemDescriptionClasses,
152
- "text-gray-600 dark:text-gray-300 leading-relaxed pl-0.5 mt-1"
153
- ),
154
- children: descriptionText
155
- }
156
- ) : null,
157
- actionNodes?.length ? /* @__PURE__ */ jsx("div", { className: classNames(activityItemActionsClasses, "mt-2.5"), children: actionNodes }) : null
158
- ] })
159
- ] })
160
- }
161
- );
162
- };
163
- if (loading) {
164
- return /* @__PURE__ */ jsx(
165
- "div",
166
- {
167
- className: wrapperClasses,
168
- role: "feed",
169
- "aria-label": "\u52A8\u6001",
170
- "aria-busy": true,
171
- ...props,
172
- "data-tiger-activity-feed": true,
173
- children: /* @__PURE__ */ jsx(
174
- Card,
175
- {
176
- variant: "bordered",
177
- size: "sm",
178
- className: "tiger-activity-feed-loading bg-white/40 dark:bg-gray-900/20 border-gray-100 dark:border-gray-800/80 backdrop-blur-sm rounded-2xl shadow-sm overflow-hidden",
179
- children: /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center py-8", children: /* @__PURE__ */ jsx(Loading, { text: loadingText, className: "text-blue-500 dark:text-blue-400 font-medium" }) })
180
- }
181
- )
182
- }
183
- );
184
- }
185
- if (resolvedGroups.length === 0) {
186
- return /* @__PURE__ */ jsx(
187
- "div",
188
- {
189
- className: wrapperClasses,
190
- role: "feed",
191
- "aria-label": "\u52A8\u6001",
192
- ...props,
193
- "data-tiger-activity-feed": true,
194
- children: /* @__PURE__ */ jsx(
195
- Card,
196
- {
197
- variant: "bordered",
198
- size: "sm",
199
- className: "tiger-activity-feed-empty bg-white/40 dark:bg-gray-900/20 border-gray-100 dark:border-gray-800/80 backdrop-blur-sm rounded-2xl shadow-sm overflow-hidden",
200
- children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center py-12 px-4", children: [
201
- /* @__PURE__ */ jsx(
202
- "svg",
203
- {
204
- className: "w-12 h-12 text-gray-300 dark:text-gray-600 mb-3 animate-pulse",
205
- fill: "none",
206
- viewBox: "0 0 24 24",
207
- stroke: "currentColor",
208
- strokeWidth: "1.5",
209
- children: /* @__PURE__ */ jsx(
210
- "path",
211
- {
212
- strokeLinecap: "round",
213
- strokeLinejoin: "round",
214
- d: "M12 7.5h1.5m-1.5 3h1.5m-7.5 3h10.5m-10.5 3h10.5m-13.5-9h16.5M3 5.25h18M3 18.75h18"
215
- }
216
- )
217
- }
218
- ),
219
- /* @__PURE__ */ jsx(Text, { tag: "div", size: "sm", color: "muted", className: "font-medium", children: emptyText })
220
- ] })
221
- }
222
- )
223
- }
224
- );
225
- }
226
- return /* @__PURE__ */ jsx(
227
- "div",
228
- {
229
- className: wrapperClasses,
230
- role: "feed",
231
- "aria-label": "\u52A8\u6001",
232
- ...props,
233
- "data-tiger-activity-feed": true,
234
- children: resolvedGroups.map((group, groupIndex) => {
235
- const headerNode = renderGroupHeader?.(group);
236
- const groupTitle = group.title;
237
- const timelineItems = toActivityTimelineItems(group.items);
238
- return /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
239
- showGroupTitle && groupTitle ? headerNode ?? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mb-2", children: [
240
- /* @__PURE__ */ jsx("span", { className: "w-1.5 h-3.5 bg-blue-500 rounded-full dark:bg-blue-400 shadow-sm shadow-blue-500/20" }),
241
- /* @__PURE__ */ jsx(
242
- Text,
243
- {
244
- tag: "span",
245
- size: "sm",
246
- weight: "bold",
247
- className: "text-gray-900 dark:text-gray-100 uppercase tracking-wider",
248
- children: groupTitle
249
- }
250
- )
251
- ] }) : null,
252
- /* @__PURE__ */ jsx(
253
- Timeline,
254
- {
255
- items: timelineItems,
256
- style: {
257
- "--tiger-border": "rgba(156, 163, 175, 0.18)"
258
- },
259
- renderDot: (timelineItem) => {
260
- const activity = timelineItem.activity;
261
- const statusVariant = activity?.status?.variant ?? "default";
262
- const baseDotClass = "w-3 h-3 rounded-full border-2 border-white dark:border-gray-950 shadow-sm";
263
- let colorClass = "bg-gray-300 dark:bg-gray-700";
264
- let pulseClass = "";
265
- if (statusVariant === "success") {
266
- colorClass = "bg-emerald-500";
267
- pulseClass = "bg-emerald-500/30";
268
- } else if (statusVariant === "warning") {
269
- colorClass = "bg-amber-500";
270
- pulseClass = "bg-amber-500/30";
271
- } else if (statusVariant === "error" || statusVariant === "danger") {
272
- colorClass = "bg-rose-500";
273
- pulseClass = "bg-rose-500/30";
274
- } else if (statusVariant === "primary" || statusVariant === "info") {
275
- colorClass = "bg-blue-500";
276
- pulseClass = "bg-blue-500/30";
277
- }
278
- return /* @__PURE__ */ jsxs("div", { className: "relative flex items-center justify-center w-4 h-4", children: [
279
- pulseClass ? /* @__PURE__ */ jsx(
280
- "span",
281
- {
282
- className: `absolute inline-flex h-full w-full rounded-full animate-ping opacity-75 ${pulseClass}`
283
- }
284
- ) : null,
285
- /* @__PURE__ */ jsx("span", { className: `${baseDotClass} ${colorClass} relative z-10` })
286
- ] });
287
- },
288
- renderItem: (timelineItem, index) => {
289
- const activity = timelineItem.activity;
290
- if (!activity) return null;
291
- return renderDefaultItem(activity, index, group);
292
- }
293
- }
294
- )
295
- ] }, group.key ?? groupIndex);
296
- })
297
- }
298
- );
299
- };
300
- var ActivityFeed_default = ActivityFeed;
301
-
302
- export {
303
- ActivityFeed,
304
- ActivityFeed_default
305
- };