@expcat/tigercat-react 0.2.10 → 0.3.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 (125) hide show
  1. package/dist/chunk-4IO2M3ZJ.js +110 -0
  2. package/dist/chunk-4MMT4EJJ.mjs +78 -0
  3. package/dist/chunk-67EK62HG.mjs +65 -0
  4. package/dist/chunk-6YKZAWNX.js +258 -0
  5. package/dist/chunk-73DMQ2SR.mjs +206 -0
  6. package/dist/chunk-FAZQT7YP.mjs +255 -0
  7. package/dist/{chunk-HRYBEBZC.js → chunk-GJKT2B56.js} +5 -1
  8. package/dist/{chunk-VXHBQTZS.js → chunk-GY6D4XS3.js} +13 -5
  9. package/dist/chunk-GZPMLPRW.js +107 -0
  10. package/dist/{chunk-7JQ7LURS.mjs → chunk-H36CWHUP.mjs} +9 -4
  11. package/dist/{chunk-5XKYWZZZ.mjs → chunk-HGTF6A46.mjs} +5 -1
  12. package/dist/chunk-HT2BXCEM.js +264 -0
  13. package/dist/chunk-HUZVBDHV.js +81 -0
  14. package/dist/{chunk-6ZC7H22S.mjs → chunk-IAF24RKI.mjs} +1 -1
  15. package/dist/chunk-IYFSM2GA.mjs +141 -0
  16. package/dist/chunk-JAVDNFJD.js +144 -0
  17. package/dist/chunk-JOHKSMJM.mjs +266 -0
  18. package/dist/{chunk-WEGU7O4J.mjs → chunk-KOLLAGRK.mjs} +1 -1
  19. package/dist/{chunk-P273E6XE.js → chunk-MQTHGPHF.js} +37 -21
  20. package/dist/{chunk-IS7YOBR7.mjs → chunk-NDOYQK2R.mjs} +13 -5
  21. package/dist/chunk-OVWCTDAL.js +209 -0
  22. package/dist/{chunk-2DOPHSZP.js → chunk-OWUGXP6K.js} +8 -3
  23. package/dist/{chunk-GIYBVWR4.mjs → chunk-OZLAGTZW.mjs} +38 -22
  24. package/dist/{chunk-OD2NNQD2.js → chunk-PBJ2J2B3.js} +2 -2
  25. package/dist/chunk-PVOQUXIB.mjs +189 -0
  26. package/dist/chunk-Q2GPRAF4.js +66 -0
  27. package/dist/chunk-R67R3TVA.mjs +261 -0
  28. package/dist/{chunk-6PUSRC6S.js → chunk-T3GSXTDU.js} +2 -2
  29. package/dist/chunk-WKGCUR7O.mjs +107 -0
  30. package/dist/chunk-X4F6NSI5.mjs +104 -0
  31. package/dist/chunk-Y6557RWE.mjs +62 -0
  32. package/dist/chunk-YIF5VX7K.mjs +158 -0
  33. package/dist/chunk-Z5DDULTA.js +72 -0
  34. package/dist/chunk-Z6G4HABF.js +272 -0
  35. package/dist/chunk-ZN2BZCTI.js +192 -0
  36. package/dist/chunk-ZPWDDAFE.js +162 -0
  37. package/dist/components/ActivityFeed.d.mts +10 -0
  38. package/dist/components/ActivityFeed.d.ts +10 -0
  39. package/dist/components/ActivityFeed.js +23 -0
  40. package/dist/components/ActivityFeed.mjs +8 -0
  41. package/dist/components/Anchor.d.mts +38 -0
  42. package/dist/components/Anchor.d.ts +38 -0
  43. package/dist/components/Anchor.js +20 -0
  44. package/dist/components/Anchor.mjs +1 -0
  45. package/dist/components/AnchorLink.d.mts +23 -0
  46. package/dist/components/AnchorLink.d.ts +23 -0
  47. package/dist/components/AnchorLink.js +17 -0
  48. package/dist/components/AnchorLink.mjs +2 -0
  49. package/dist/components/AreaChart.js +4 -4
  50. package/dist/components/AreaChart.mjs +2 -2
  51. package/dist/components/BackTop.d.mts +21 -0
  52. package/dist/components/BackTop.d.ts +21 -0
  53. package/dist/components/BackTop.js +16 -0
  54. package/dist/components/BackTop.mjs +1 -0
  55. package/dist/components/BarChart.js +4 -4
  56. package/dist/components/BarChart.mjs +2 -2
  57. package/dist/components/Breadcrumb.d.mts +4 -0
  58. package/dist/components/Breadcrumb.d.ts +4 -0
  59. package/dist/components/Breadcrumb.js +3 -3
  60. package/dist/components/Breadcrumb.mjs +1 -1
  61. package/dist/components/BreadcrumbItem.js +3 -3
  62. package/dist/components/BreadcrumbItem.mjs +2 -2
  63. package/dist/components/Carousel.d.mts +26 -0
  64. package/dist/components/Carousel.d.ts +26 -0
  65. package/dist/components/Carousel.js +10 -0
  66. package/dist/components/Carousel.mjs +1 -0
  67. package/dist/components/ChatWindow.d.mts +12 -0
  68. package/dist/components/ChatWindow.d.ts +12 -0
  69. package/dist/components/ChatWindow.js +20 -0
  70. package/dist/components/ChatWindow.mjs +5 -0
  71. package/dist/components/Collapse.d.mts +29 -0
  72. package/dist/components/Collapse.d.ts +29 -0
  73. package/dist/components/Collapse.js +20 -0
  74. package/dist/components/Collapse.mjs +1 -0
  75. package/dist/components/CollapsePanel.d.mts +24 -0
  76. package/dist/components/CollapsePanel.d.ts +24 -0
  77. package/dist/components/CollapsePanel.js +17 -0
  78. package/dist/components/CollapsePanel.mjs +2 -0
  79. package/dist/components/CommentThread.d.mts +8 -0
  80. package/dist/components/CommentThread.d.ts +8 -0
  81. package/dist/components/CommentThread.js +21 -0
  82. package/dist/components/CommentThread.mjs +6 -0
  83. package/dist/components/DataTableWithToolbar.d.mts +51 -0
  84. package/dist/components/DataTableWithToolbar.d.ts +51 -0
  85. package/dist/components/DataTableWithToolbar.js +24 -0
  86. package/dist/components/DataTableWithToolbar.mjs +9 -0
  87. package/dist/components/Dropdown.js +4 -4
  88. package/dist/components/Dropdown.mjs +2 -2
  89. package/dist/components/DropdownItem.js +4 -4
  90. package/dist/components/DropdownItem.mjs +3 -3
  91. package/dist/components/FormItem.js +2 -2
  92. package/dist/components/FormItem.mjs +1 -1
  93. package/dist/components/FormWizard.d.mts +10 -0
  94. package/dist/components/FormWizard.d.ts +10 -0
  95. package/dist/components/FormWizard.js +19 -0
  96. package/dist/components/FormWizard.mjs +4 -0
  97. package/dist/components/LineChart.js +4 -4
  98. package/dist/components/LineChart.mjs +2 -2
  99. package/dist/components/NotificationCenter.d.mts +8 -0
  100. package/dist/components/NotificationCenter.d.ts +8 -0
  101. package/dist/components/NotificationCenter.js +23 -0
  102. package/dist/components/NotificationCenter.mjs +8 -0
  103. package/dist/components/Pagination.js +3 -3
  104. package/dist/components/Pagination.mjs +1 -1
  105. package/dist/components/ScatterChart.js +4 -4
  106. package/dist/components/ScatterChart.mjs +2 -2
  107. package/dist/components/Table.d.mts +1 -1
  108. package/dist/components/Table.d.ts +1 -1
  109. package/dist/components/Table.js +2 -2
  110. package/dist/components/Table.mjs +1 -1
  111. package/dist/index.d.mts +12 -0
  112. package/dist/index.d.ts +12 -0
  113. package/dist/index.js +221 -153
  114. package/dist/index.mjs +51 -39
  115. package/package.json +2 -2
  116. package/dist/{chunk-42UKIFFQ.js → chunk-4PTI6ZUK.js} +1 -1
  117. package/dist/{chunk-LIJLFLYE.js → chunk-4TWHENPT.js} +1 -1
  118. package/dist/{chunk-OONM7FO7.js → chunk-6E5UKM6O.js} +1 -1
  119. package/dist/{chunk-KBGURVTD.mjs → chunk-AITVDDCE.mjs} +1 -1
  120. package/dist/{chunk-CBALIFPW.mjs → chunk-IL2Y5RCX.mjs} +1 -1
  121. package/dist/{chunk-QI6WAP6Y.js → chunk-L63N3LCG.js} +1 -1
  122. package/dist/{chunk-A2UW5OKX.mjs → chunk-PT4WLSTJ.mjs} +1 -1
  123. package/dist/{chunk-EJLJYOO7.js → chunk-SIB4EHB6.js} +1 -1
  124. package/dist/{chunk-VBSK4TGO.mjs → chunk-WYTHTJN3.mjs} +1 -1
  125. package/dist/{chunk-7IKJBQQV.mjs → chunk-YGOTPK2W.mjs} +1 -1
@@ -0,0 +1,272 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+ var tigercatCore = require('@expcat/tigercat-core');
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+
7
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
8
+
9
+ var React__default = /*#__PURE__*/_interopDefault(React);
10
+
11
+ // src/components/Carousel.tsx
12
+ var Carousel = React.forwardRef(
13
+ ({
14
+ autoplay = false,
15
+ autoplaySpeed = 3e3,
16
+ dots = true,
17
+ dotPosition = "bottom",
18
+ effect = "scroll",
19
+ arrows = false,
20
+ infinite = true,
21
+ speed = 500,
22
+ initialSlide = 0,
23
+ pauseOnHover = true,
24
+ pauseOnFocus = true,
25
+ className,
26
+ style,
27
+ onChange,
28
+ onBeforeChange,
29
+ children
30
+ }, ref) => {
31
+ const [currentIndex, setCurrentIndex] = React.useState(initialSlide);
32
+ const [isPaused, setIsPaused] = React.useState(false);
33
+ const autoplayTimerRef = React.useRef(null);
34
+ const slides = React.useMemo(() => {
35
+ return React__default.default.Children.toArray(children).filter((child) => React__default.default.isValidElement(child));
36
+ }, [children]);
37
+ const slideCount = slides.length;
38
+ const containerClasses = React.useMemo(
39
+ () => tigercatCore.classNames(tigercatCore.getCarouselContainerClasses(className)),
40
+ [className]
41
+ );
42
+ const trackClasses = React.useMemo(() => {
43
+ if (effect === "fade") {
44
+ return tigercatCore.carouselTrackFadeClasses;
45
+ }
46
+ return tigercatCore.carouselTrackScrollClasses;
47
+ }, [effect]);
48
+ const trackStyle = React.useMemo(() => {
49
+ if (effect === "scroll") {
50
+ return {
51
+ transform: tigercatCore.getScrollTransform(currentIndex),
52
+ transitionDuration: `${speed}ms`
53
+ };
54
+ }
55
+ return {};
56
+ }, [effect, currentIndex, speed]);
57
+ const getSlideClasses = React.useCallback(
58
+ (index) => {
59
+ const isActive = index === currentIndex;
60
+ if (effect === "fade") {
61
+ const positionClass = index === 0 ? "relative" : "absolute inset-0";
62
+ return tigercatCore.classNames(
63
+ positionClass,
64
+ "w-full transition-opacity ease-in-out",
65
+ isActive ? "opacity-100 z-10" : "opacity-0 z-0"
66
+ );
67
+ }
68
+ return tigercatCore.carouselSlideBaseClasses;
69
+ },
70
+ [effect, currentIndex]
71
+ );
72
+ const getSlideStyle = React.useCallback(() => {
73
+ return {
74
+ transitionDuration: `${speed}ms`
75
+ };
76
+ }, [speed]);
77
+ const dotsClasses = React.useMemo(() => {
78
+ return tigercatCore.getCarouselDotsClasses(dotPosition);
79
+ }, [dotPosition]);
80
+ const goTo = React.useCallback(
81
+ (index) => {
82
+ const clampedIndex = tigercatCore.clampSlideIndex(index, slideCount);
83
+ if (clampedIndex === currentIndex) return;
84
+ onBeforeChange?.(currentIndex, clampedIndex);
85
+ const prevIndex = currentIndex;
86
+ setCurrentIndex(clampedIndex);
87
+ onChange?.(clampedIndex, prevIndex);
88
+ },
89
+ [currentIndex, slideCount, onBeforeChange, onChange]
90
+ );
91
+ const next = React.useCallback(() => {
92
+ const nextIdx = tigercatCore.getNextSlideIndex(currentIndex, slideCount, infinite);
93
+ if (nextIdx !== currentIndex) {
94
+ goTo(nextIdx);
95
+ }
96
+ }, [currentIndex, slideCount, infinite, goTo]);
97
+ const prev = React.useCallback(() => {
98
+ const prevIdx = tigercatCore.getPrevSlideIndex(currentIndex, slideCount, infinite);
99
+ if (prevIdx !== currentIndex) {
100
+ goTo(prevIdx);
101
+ }
102
+ }, [currentIndex, slideCount, infinite, goTo]);
103
+ React.useImperativeHandle(
104
+ ref,
105
+ () => ({
106
+ next,
107
+ prev,
108
+ goTo
109
+ }),
110
+ [next, prev, goTo]
111
+ );
112
+ React.useEffect(() => {
113
+ if (autoplay && !isPaused) {
114
+ if (autoplayTimerRef.current) {
115
+ clearInterval(autoplayTimerRef.current);
116
+ }
117
+ autoplayTimerRef.current = setInterval(() => {
118
+ setCurrentIndex((prevIndex) => {
119
+ const nextIdx = tigercatCore.getNextSlideIndex(prevIndex, slideCount, infinite);
120
+ if (nextIdx !== prevIndex) {
121
+ onBeforeChange?.(prevIndex, nextIdx);
122
+ onChange?.(nextIdx, prevIndex);
123
+ }
124
+ return nextIdx;
125
+ });
126
+ }, autoplaySpeed);
127
+ }
128
+ return () => {
129
+ if (autoplayTimerRef.current) {
130
+ clearInterval(autoplayTimerRef.current);
131
+ autoplayTimerRef.current = null;
132
+ }
133
+ };
134
+ }, [autoplay, autoplaySpeed, isPaused, slideCount, infinite, onChange, onBeforeChange]);
135
+ const handleMouseEnter = React.useCallback(() => {
136
+ if (pauseOnHover && autoplay) {
137
+ setIsPaused(true);
138
+ }
139
+ }, [pauseOnHover, autoplay]);
140
+ const handleMouseLeave = React.useCallback(() => {
141
+ if (pauseOnHover && autoplay) {
142
+ setIsPaused(false);
143
+ }
144
+ }, [pauseOnHover, autoplay]);
145
+ const handleFocus = React.useCallback(() => {
146
+ if (pauseOnFocus && autoplay) {
147
+ setIsPaused(true);
148
+ }
149
+ }, [pauseOnFocus, autoplay]);
150
+ const handleBlur = React.useCallback(() => {
151
+ if (pauseOnFocus && autoplay) {
152
+ setIsPaused(false);
153
+ }
154
+ }, [pauseOnFocus, autoplay]);
155
+ const isPrevArrowDisabled = React.useMemo(
156
+ () => tigercatCore.isPrevDisabled(currentIndex, slideCount, infinite),
157
+ [currentIndex, slideCount, infinite]
158
+ );
159
+ const isNextArrowDisabled = React.useMemo(
160
+ () => tigercatCore.isNextDisabled(currentIndex, slideCount, infinite),
161
+ [currentIndex, slideCount, infinite]
162
+ );
163
+ const renderArrows = () => {
164
+ if (!arrows) return null;
165
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
166
+ /* @__PURE__ */ jsxRuntime.jsx(
167
+ "button",
168
+ {
169
+ type: "button",
170
+ className: tigercatCore.getCarouselArrowClasses("prev", isPrevArrowDisabled),
171
+ onClick: prev,
172
+ disabled: isPrevArrowDisabled,
173
+ "aria-label": "Previous slide",
174
+ children: /* @__PURE__ */ jsxRuntime.jsx(
175
+ "svg",
176
+ {
177
+ xmlns: "http://www.w3.org/2000/svg",
178
+ viewBox: "0 0 24 24",
179
+ fill: "none",
180
+ stroke: "currentColor",
181
+ strokeWidth: "2",
182
+ strokeLinecap: "round",
183
+ strokeLinejoin: "round",
184
+ className: "w-6 h-6",
185
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: tigercatCore.carouselPrevArrowPath })
186
+ }
187
+ )
188
+ }
189
+ ),
190
+ /* @__PURE__ */ jsxRuntime.jsx(
191
+ "button",
192
+ {
193
+ type: "button",
194
+ className: tigercatCore.getCarouselArrowClasses("next", isNextArrowDisabled),
195
+ onClick: next,
196
+ disabled: isNextArrowDisabled,
197
+ "aria-label": "Next slide",
198
+ children: /* @__PURE__ */ jsxRuntime.jsx(
199
+ "svg",
200
+ {
201
+ xmlns: "http://www.w3.org/2000/svg",
202
+ viewBox: "0 0 24 24",
203
+ fill: "none",
204
+ stroke: "currentColor",
205
+ strokeWidth: "2",
206
+ strokeLinecap: "round",
207
+ strokeLinejoin: "round",
208
+ className: "w-6 h-6",
209
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: tigercatCore.carouselNextArrowPath })
210
+ }
211
+ )
212
+ }
213
+ )
214
+ ] });
215
+ };
216
+ const renderDots = () => {
217
+ if (!dots || slideCount <= 1) return null;
218
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: dotsClasses, role: "tablist", "aria-label": "Carousel navigation", children: slides.map((_, index) => /* @__PURE__ */ jsxRuntime.jsx(
219
+ "button",
220
+ {
221
+ type: "button",
222
+ className: tigercatCore.getCarouselDotClasses(index === currentIndex),
223
+ onClick: () => goTo(index),
224
+ "aria-label": `Go to slide ${index + 1}`,
225
+ "aria-current": index === currentIndex ? "true" : "false"
226
+ },
227
+ index
228
+ )) });
229
+ };
230
+ const renderSlides = () => {
231
+ const slideElements = slides.map((slide, index) => /* @__PURE__ */ jsxRuntime.jsx(
232
+ "div",
233
+ {
234
+ className: getSlideClasses(index),
235
+ style: effect === "fade" ? getSlideStyle() : void 0,
236
+ role: "group",
237
+ "aria-roledescription": "slide",
238
+ "aria-label": `Slide ${index + 1} of ${slideCount}`,
239
+ "aria-hidden": index !== currentIndex,
240
+ children: slide
241
+ },
242
+ index
243
+ ));
244
+ if (effect === "fade") {
245
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: tigercatCore.classNames(trackClasses, "h-full"), children: slideElements });
246
+ }
247
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: trackClasses, style: trackStyle, children: slideElements });
248
+ };
249
+ return /* @__PURE__ */ jsxRuntime.jsxs(
250
+ "div",
251
+ {
252
+ className: containerClasses,
253
+ style,
254
+ role: "region",
255
+ "aria-roledescription": "carousel",
256
+ "aria-label": "Image carousel",
257
+ onMouseEnter: handleMouseEnter,
258
+ onMouseLeave: handleMouseLeave,
259
+ onFocus: handleFocus,
260
+ onBlur: handleBlur,
261
+ children: [
262
+ renderSlides(),
263
+ renderArrows(),
264
+ renderDots()
265
+ ]
266
+ }
267
+ );
268
+ }
269
+ );
270
+ Carousel.displayName = "Carousel";
271
+
272
+ exports.Carousel = Carousel;
@@ -0,0 +1,192 @@
1
+ 'use strict';
2
+
3
+ var chunkCIL2AC3F_js = require('./chunk-CIL2AC3F.js');
4
+ var chunkR7MS42PL_js = require('./chunk-R7MS42PL.js');
5
+ var chunkA3DJSVTE_js = require('./chunk-A3DJSVTE.js');
6
+ var chunkTZ26HQAW_js = require('./chunk-TZ26HQAW.js');
7
+ var react = require('react');
8
+ var tigercatCore = require('@expcat/tigercat-core');
9
+ var jsxRuntime = require('react/jsx-runtime');
10
+
11
+ var ChatWindow = ({
12
+ messages = [],
13
+ value,
14
+ defaultValue = "",
15
+ placeholder = "\u8BF7\u8F93\u5165\u6D88\u606F",
16
+ disabled = false,
17
+ maxLength,
18
+ emptyText = "\u6682\u65E0\u6D88\u606F",
19
+ sendText = "\u53D1\u9001",
20
+ messageListAriaLabel,
21
+ inputAriaLabel,
22
+ sendAriaLabel,
23
+ statusText,
24
+ statusVariant = "info",
25
+ showAvatar = true,
26
+ showName = true,
27
+ showTime = false,
28
+ inputType = "textarea",
29
+ inputRows = 3,
30
+ sendOnEnter = true,
31
+ allowShiftEnter = true,
32
+ allowEmpty = false,
33
+ clearOnSend = true,
34
+ statusVariant: _sv,
35
+ onChange,
36
+ onSend,
37
+ renderMessage,
38
+ className,
39
+ ...props
40
+ }) => {
41
+ const [innerValue, setInnerValue] = react.useState(value ?? defaultValue);
42
+ react.useEffect(() => {
43
+ if (value !== void 0) {
44
+ setInnerValue(value);
45
+ }
46
+ }, [value]);
47
+ const inputValue = value !== void 0 ? value : innerValue;
48
+ const wrapperClasses = react.useMemo(
49
+ () => tigercatCore.classNames(
50
+ "tiger-chat-window flex flex-col w-full rounded-lg border border-[var(--tiger-border,#e5e7eb)] bg-[var(--tiger-surface,#ffffff)]",
51
+ className
52
+ ),
53
+ [className]
54
+ );
55
+ const canSend = react.useMemo(() => {
56
+ if (disabled) return false;
57
+ if (allowEmpty) return true;
58
+ const raw = String(inputValue ?? "");
59
+ return raw.trim().length > 0;
60
+ }, [allowEmpty, disabled, inputValue]);
61
+ const handleValueChange = react.useCallback(
62
+ (nextValue) => {
63
+ if (value === void 0) {
64
+ setInnerValue(nextValue);
65
+ }
66
+ onChange?.(nextValue);
67
+ },
68
+ [onChange, value]
69
+ );
70
+ const handleSend = react.useCallback(() => {
71
+ if (!canSend) return;
72
+ const payload = String(inputValue ?? "");
73
+ onSend?.(payload);
74
+ if (clearOnSend) {
75
+ if (value === void 0) {
76
+ setInnerValue("");
77
+ }
78
+ onChange?.("");
79
+ }
80
+ }, [canSend, clearOnSend, inputValue, onSend, onChange, value]);
81
+ const handleKeyDown = react.useCallback(
82
+ (event) => {
83
+ if (!sendOnEnter) return;
84
+ if (event.key !== "Enter") return;
85
+ if (inputType === "textarea" && allowShiftEnter && event.shiftKey) return;
86
+ event.preventDefault();
87
+ handleSend();
88
+ },
89
+ [allowShiftEnter, handleSend, inputType, sendOnEnter]
90
+ );
91
+ const renderMessageItem = react.useCallback(
92
+ (message, index) => {
93
+ const isSelf = message.direction === "self";
94
+ const statusInfo = message.status ? tigercatCore.getChatMessageStatusInfo(message.status) : void 0;
95
+ const timeText = showTime ? tigercatCore.formatChatTime(message.time) : "";
96
+ return /* @__PURE__ */ jsxRuntime.jsxs(
97
+ "div",
98
+ {
99
+ className: tigercatCore.classNames(
100
+ "flex gap-3 items-start",
101
+ isSelf ? "flex-row-reverse" : "justify-start"
102
+ ),
103
+ "data-tiger-chat-message": true,
104
+ role: "listitem",
105
+ children: [
106
+ showAvatar && message.user ? /* @__PURE__ */ jsxRuntime.jsx(
107
+ chunkTZ26HQAW_js.Avatar,
108
+ {
109
+ size: "sm",
110
+ src: message.user.avatar,
111
+ text: message.user.name,
112
+ className: "flex-shrink-0"
113
+ }
114
+ ) : null,
115
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: tigercatCore.classNames("flex flex-col max-w-[75%]", isSelf && "items-end"), children: [
116
+ showName && message.user?.name && /* @__PURE__ */ jsxRuntime.jsx(
117
+ "div",
118
+ {
119
+ className: tigercatCore.classNames(
120
+ "text-xs mb-1 text-[var(--tiger-text-muted,#6b7280)]",
121
+ isSelf && "text-right"
122
+ ),
123
+ children: message.user.name
124
+ }
125
+ ),
126
+ /* @__PURE__ */ jsxRuntime.jsx(
127
+ "div",
128
+ {
129
+ className: tigercatCore.classNames(
130
+ "rounded-lg px-3 py-2 text-sm break-words",
131
+ isSelf ? "bg-[var(--tiger-primary,#2563eb)] text-white rounded-tr-none" : "bg-[var(--tiger-surface-muted,#f3f4f6)] text-[var(--tiger-text,#111827)] rounded-tl-none"
132
+ ),
133
+ "data-tiger-chat-bubble": true,
134
+ children: renderMessage?.(message, index) ?? message.content
135
+ }
136
+ ),
137
+ statusInfo && /* @__PURE__ */ jsxRuntime.jsx("div", { className: tigercatCore.classNames("text-xs mt-1", statusInfo.className), children: message.statusText || statusInfo.text }),
138
+ timeText && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs mt-1 text-[var(--tiger-text-muted,#6b7280)]", children: timeText })
139
+ ] })
140
+ ]
141
+ },
142
+ message.id ?? index
143
+ );
144
+ },
145
+ [renderMessage, showAvatar, showName, showTime]
146
+ );
147
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: wrapperClasses, "data-tiger-chat-window": true, ...props, children: [
148
+ /* @__PURE__ */ jsxRuntime.jsx(
149
+ "div",
150
+ {
151
+ className: "flex-1 overflow-auto p-4 space-y-3",
152
+ role: "log",
153
+ "aria-live": "polite",
154
+ "aria-relevant": "additions text",
155
+ "aria-label": messageListAriaLabel ?? "\u6D88\u606F\u5217\u8868",
156
+ children: messages.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full flex items-center justify-center text-[var(--tiger-text-muted,#6b7280)]", children: emptyText }) : messages.map(renderMessageItem)
157
+ }
158
+ ),
159
+ statusText && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-4 py-1.5 border-t border-[var(--tiger-border,#e5e7eb)] text-xs italic text-[var(--tiger-text-muted,#6b7280)]", children: statusText }),
160
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-end gap-3 px-4 py-3 border-t border-[var(--tiger-border,#e5e7eb)] bg-[var(--tiger-surface,#ffffff)] rounded-b-lg", children: [
161
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1", children: inputType === "input" ? /* @__PURE__ */ jsxRuntime.jsx(
162
+ chunkCIL2AC3F_js.Input,
163
+ {
164
+ value: inputValue,
165
+ placeholder,
166
+ disabled,
167
+ maxLength,
168
+ "aria-label": inputAriaLabel ?? placeholder ?? "\u6D88\u606F\u8F93\u5165",
169
+ onChange: (event) => handleValueChange(event.currentTarget.value),
170
+ onKeyDown: handleKeyDown
171
+ }
172
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
173
+ chunkR7MS42PL_js.Textarea,
174
+ {
175
+ value: inputValue,
176
+ placeholder,
177
+ disabled,
178
+ maxLength,
179
+ rows: inputRows,
180
+ "aria-label": inputAriaLabel ?? placeholder ?? "\u6D88\u606F\u8F93\u5165",
181
+ onChange: (event) => handleValueChange(event.currentTarget.value),
182
+ onKeyDown: handleKeyDown
183
+ }
184
+ ) }),
185
+ /* @__PURE__ */ jsxRuntime.jsx(chunkA3DJSVTE_js.Button, { disabled: !canSend, onClick: handleSend, "aria-label": sendAriaLabel ?? sendText, children: sendText })
186
+ ] })
187
+ ] });
188
+ };
189
+ var ChatWindow_default = ChatWindow;
190
+
191
+ exports.ChatWindow = ChatWindow;
192
+ exports.ChatWindow_default = ChatWindow_default;
@@ -0,0 +1,162 @@
1
+ 'use strict';
2
+
3
+ var react = require('react');
4
+ var tigercatCore = require('@expcat/tigercat-core');
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+
7
+ // src/components/Anchor.tsx
8
+ var AnchorContext = react.createContext(null);
9
+ function useAnchorContext() {
10
+ return react.useContext(AnchorContext);
11
+ }
12
+ var Anchor = ({
13
+ affix = true,
14
+ bounds = 5,
15
+ offsetTop = 0,
16
+ showInkInFixed = false,
17
+ targetOffset,
18
+ getCurrentAnchor,
19
+ getContainer = () => window,
20
+ direction = "vertical",
21
+ className,
22
+ style,
23
+ onClick,
24
+ onChange,
25
+ children
26
+ }) => {
27
+ const [activeLink, setActiveLink] = react.useState("");
28
+ const [links, setLinks] = react.useState([]);
29
+ const anchorRef = react.useRef(null);
30
+ const inkRef = react.useRef(null);
31
+ const isScrollingRef = react.useRef(false);
32
+ const animationFrameRef = react.useRef(null);
33
+ const getContainerRef = react.useRef(getContainer);
34
+ getContainerRef.current = getContainer;
35
+ const scrollOffset = react.useMemo(() => targetOffset ?? offsetTop, [targetOffset, offsetTop]);
36
+ const registerLink = react.useCallback((href) => {
37
+ setLinks((prevLinks) => {
38
+ if (href && !prevLinks.includes(href)) {
39
+ return [...prevLinks, href];
40
+ }
41
+ return prevLinks;
42
+ });
43
+ }, []);
44
+ const unregisterLink = react.useCallback((href) => {
45
+ setLinks((prevLinks) => prevLinks.filter((l) => l !== href));
46
+ }, []);
47
+ const scrollTo = react.useCallback(
48
+ (href) => {
49
+ const container = getContainerRef.current();
50
+ tigercatCore.scrollToAnchor(href, container, scrollOffset);
51
+ },
52
+ [scrollOffset]
53
+ );
54
+ const handleLinkClick = react.useCallback(
55
+ (href, event) => {
56
+ onClick?.(event, href);
57
+ isScrollingRef.current = true;
58
+ setActiveLink(href);
59
+ scrollTo(href);
60
+ setTimeout(() => {
61
+ isScrollingRef.current = false;
62
+ }, 500);
63
+ },
64
+ [onClick, scrollTo]
65
+ );
66
+ const scrollHandlerRef = react.useRef(null);
67
+ const boundContainerRef = react.useRef(null);
68
+ react.useEffect(() => {
69
+ const timeoutId = setTimeout(() => {
70
+ const container = getContainerRef.current();
71
+ boundContainerRef.current = container;
72
+ const handleScroll = () => {
73
+ if (isScrollingRef.current) return;
74
+ if (animationFrameRef.current !== null) {
75
+ cancelAnimationFrame(animationFrameRef.current);
76
+ }
77
+ animationFrameRef.current = requestAnimationFrame(() => {
78
+ const currentContainer = getContainerRef.current();
79
+ const newActiveLink = tigercatCore.findActiveAnchor(links, currentContainer, bounds, scrollOffset);
80
+ const finalActiveLink = getCurrentAnchor ? getCurrentAnchor(newActiveLink) : newActiveLink;
81
+ setActiveLink((prevActiveLink) => {
82
+ if (finalActiveLink !== prevActiveLink) {
83
+ onChange?.(finalActiveLink);
84
+ return finalActiveLink;
85
+ }
86
+ return prevActiveLink;
87
+ });
88
+ });
89
+ };
90
+ scrollHandlerRef.current = handleScroll;
91
+ container.addEventListener("scroll", handleScroll, { passive: true });
92
+ handleScroll();
93
+ }, 0);
94
+ return () => {
95
+ clearTimeout(timeoutId);
96
+ if (boundContainerRef.current && scrollHandlerRef.current) {
97
+ boundContainerRef.current.removeEventListener("scroll", scrollHandlerRef.current);
98
+ }
99
+ if (animationFrameRef.current !== null) {
100
+ cancelAnimationFrame(animationFrameRef.current);
101
+ }
102
+ };
103
+ }, [links, bounds, scrollOffset, getCurrentAnchor, onChange]);
104
+ react.useEffect(() => {
105
+ if (!inkRef.current || !anchorRef.current || !activeLink) {
106
+ return;
107
+ }
108
+ const activeLinkElement = anchorRef.current.querySelector(
109
+ `[data-anchor-href="${activeLink}"]`
110
+ );
111
+ if (!activeLinkElement) {
112
+ return;
113
+ }
114
+ const anchorRect = anchorRef.current.getBoundingClientRect();
115
+ const linkRect = activeLinkElement.getBoundingClientRect();
116
+ if (direction === "vertical") {
117
+ inkRef.current.style.top = `${linkRect.top - anchorRect.top}px`;
118
+ inkRef.current.style.height = `${linkRect.height}px`;
119
+ } else {
120
+ inkRef.current.style.left = `${linkRect.left - anchorRect.left}px`;
121
+ inkRef.current.style.width = `${linkRect.width}px`;
122
+ }
123
+ }, [activeLink, direction]);
124
+ const wrapperClasses = react.useMemo(
125
+ () => tigercatCore.classNames(tigercatCore.getAnchorWrapperClasses(affix, className)),
126
+ [affix, className]
127
+ );
128
+ const inkContainerClasses = react.useMemo(() => tigercatCore.getAnchorInkContainerClasses(direction), [direction]);
129
+ const inkActiveClasses = react.useMemo(() => tigercatCore.getAnchorInkActiveClasses(direction), [direction]);
130
+ const linkListClasses = react.useMemo(() => tigercatCore.getAnchorLinkListClasses(direction), [direction]);
131
+ const showInk = react.useMemo(() => {
132
+ if (!affix) return true;
133
+ return showInkInFixed;
134
+ }, [affix, showInkInFixed]);
135
+ const wrapperStyle = react.useMemo(() => {
136
+ const baseStyle = {};
137
+ if (affix && offsetTop > 0) {
138
+ baseStyle.top = `${offsetTop}px`;
139
+ }
140
+ return { ...baseStyle, ...style };
141
+ }, [affix, offsetTop, style]);
142
+ const contextValue = react.useMemo(
143
+ () => ({
144
+ activeLink,
145
+ direction,
146
+ registerLink,
147
+ unregisterLink,
148
+ handleLinkClick,
149
+ scrollTo
150
+ }),
151
+ [activeLink, direction, registerLink, unregisterLink, handleLinkClick, scrollTo]
152
+ );
153
+ return /* @__PURE__ */ jsxRuntime.jsx(AnchorContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: anchorRef, className: wrapperClasses, style: wrapperStyle, children: [
154
+ showInk && /* @__PURE__ */ jsxRuntime.jsx("div", { className: inkContainerClasses, children: /* @__PURE__ */ jsxRuntime.jsx("div", { ref: inkRef, className: inkActiveClasses }) }),
155
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: linkListClasses, children })
156
+ ] }) });
157
+ };
158
+ var Anchor_default = Anchor;
159
+
160
+ exports.Anchor = Anchor;
161
+ exports.Anchor_default = Anchor_default;
162
+ exports.useAnchorContext = useAnchorContext;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { ActivityFeedProps as ActivityFeedProps$1, ActivityItem, ActivityGroup } from '@expcat/tigercat-core';
3
+
4
+ interface ActivityFeedProps extends Omit<ActivityFeedProps$1, 'renderItem' | 'renderGroupHeader'>, Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {
5
+ renderItem?: (item: ActivityItem, index: number, group?: ActivityGroup) => React.ReactNode;
6
+ renderGroupHeader?: (group: ActivityGroup) => React.ReactNode;
7
+ }
8
+ declare const ActivityFeed: React.FC<ActivityFeedProps>;
9
+
10
+ export { ActivityFeed, type ActivityFeedProps, ActivityFeed as default };
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { ActivityFeedProps as ActivityFeedProps$1, ActivityItem, ActivityGroup } from '@expcat/tigercat-core';
3
+
4
+ interface ActivityFeedProps extends Omit<ActivityFeedProps$1, 'renderItem' | 'renderGroupHeader'>, Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {
5
+ renderItem?: (item: ActivityItem, index: number, group?: ActivityGroup) => React.ReactNode;
6
+ renderGroupHeader?: (group: ActivityGroup) => React.ReactNode;
7
+ }
8
+ declare const ActivityFeed: React.FC<ActivityFeedProps>;
9
+
10
+ export { ActivityFeed, type ActivityFeedProps, ActivityFeed as default };
@@ -0,0 +1,23 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var chunk4IO2M3ZJ_js = require('../chunk-4IO2M3ZJ.js');
6
+ require('../chunk-IQINYCU6.js');
7
+ require('../chunk-MKWXJZ3T.js');
8
+ require('../chunk-6MGEGOYJ.js');
9
+ require('../chunk-2TS6X5RA.js');
10
+ require('../chunk-YYGTJKP5.js');
11
+ require('../chunk-VO4WDK4K.js');
12
+ require('../chunk-TZ26HQAW.js');
13
+
14
+
15
+
16
+ Object.defineProperty(exports, "ActivityFeed", {
17
+ enumerable: true,
18
+ get: function () { return chunk4IO2M3ZJ_js.ActivityFeed; }
19
+ });
20
+ Object.defineProperty(exports, "default", {
21
+ enumerable: true,
22
+ get: function () { return chunk4IO2M3ZJ_js.ActivityFeed_default; }
23
+ });
@@ -0,0 +1,8 @@
1
+ export { ActivityFeed, ActivityFeed_default as default } from '../chunk-WKGCUR7O.mjs';
2
+ import '../chunk-LADCWARG.mjs';
3
+ import '../chunk-WSJO2PIE.mjs';
4
+ import '../chunk-PUDU34R4.mjs';
5
+ import '../chunk-DIZNY6N4.mjs';
6
+ import '../chunk-6YDIBMCM.mjs';
7
+ import '../chunk-VD3IK5XT.mjs';
8
+ import '../chunk-V2HVHLBY.mjs';