reachat 2.0.0 → 2.0.2
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/{CSVFileRenderer-C95MrG0M.js → CSVFileRenderer-fklKR5lg.js} +2 -2
- package/dist/{CSVFileRenderer-C95MrG0M.js.map → CSVFileRenderer-fklKR5lg.js.map} +1 -1
- package/dist/ChatBubble/ChatBubble.d.ts +7 -11
- package/dist/{DefaultFileRenderer-Chpp-Qiu.js → DefaultFileRenderer-BQ9xzbrH.js} +2 -2
- package/dist/{DefaultFileRenderer-Chpp-Qiu.js.map → DefaultFileRenderer-BQ9xzbrH.js.map} +1 -1
- package/dist/docs.json +7 -26
- package/dist/{index-B1krf7tH.js → index-D7d92jbn.js} +36 -136
- package/dist/index-D7d92jbn.js.map +1 -0
- package/dist/index.css +28 -21
- package/dist/index.js +1 -1
- package/dist/index.umd.cjs +33 -133
- package/dist/index.umd.cjs.map +1 -1
- package/dist/stories/Changelog.mdx +8 -0
- package/dist/stories/Chat.stories.tsx +265 -0
- package/dist/stories/ChatBubble.stories.tsx +267 -0
- package/dist/stories/Companion.stories.tsx +435 -0
- package/dist/stories/Console.stories.tsx +1154 -0
- package/dist/stories/Integration.stories.tsx +312 -0
- package/dist/stories/Intro.mdx +41 -0
- package/dist/stories/Support.mdx +9 -0
- package/dist/stories/assets/chat-voice-fill.svg +5 -0
- package/dist/stories/assets/close-fill.svg +5 -0
- package/dist/stories/assets/logo.svg +21 -0
- package/dist/stories/assets/menu.svg +1 -0
- package/dist/stories/assets/paperclip.svg +1 -0
- package/dist/stories/assets/placeholder-dark.svg +500 -0
- package/dist/stories/assets/placeholder.svg +258 -0
- package/dist/stories/assets/search.svg +1 -0
- package/dist/stories/examples.ts +267 -0
- package/package.json +8 -3
- package/dist/index-B1krf7tH.js.map +0 -1
package/dist/index.umd.cjs
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
}
|
|
12
12
|
})();
|
|
13
13
|
(function(global, factory) {
|
|
14
|
-
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react/jsx-runtime"), require("reablocks"), require("react"), require("motion/react"), require("@radix-ui/react-slot"), require("react-markdown"), require("react-syntax-highlighter"), require("rehype-katex"), require("mdast-util-find-and-replace"), require("reakeys"), require("remark-gfm"), require("remark-youtube"), require("remark-math"), require("date-fns"), require("react
|
|
15
|
-
})(this, function(exports2, jsxRuntime, reablocks, React, react, reactSlot, ReactMarkdown, reactSyntaxHighlighter, rehypeKatex, mdastUtilFindAndReplace, reakeys, remarkGfm, remarkYoutube, remarkMath, dateFns,
|
|
14
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react/jsx-runtime"), require("reablocks"), require("react"), require("motion/react"), require("@radix-ui/react-slot"), require("react-markdown"), require("react-syntax-highlighter"), require("rehype-katex"), require("mdast-util-find-and-replace"), require("reakeys"), require("remark-gfm"), require("remark-youtube"), require("remark-math"), require("date-fns"), require("@floating-ui/react")) : typeof define === "function" && define.amd ? define(["exports", "react/jsx-runtime", "reablocks", "react", "motion/react", "@radix-ui/react-slot", "react-markdown", "react-syntax-highlighter", "rehype-katex", "mdast-util-find-and-replace", "reakeys", "remark-gfm", "remark-youtube", "remark-math", "date-fns", "@floating-ui/react"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.reachat = {}, global.jsxRuntime, global.reablocks, global.React, global.react, global.reactSlot, global.ReactMarkdown, global.reactSyntaxHighlighter, global.rehypeKatex, global.mdastUtilFindAndReplace, global.reakeys, global.remarkGfm, global.remarkYoutube, global.remarkMath, global.dateFns, global.react$1));
|
|
15
|
+
})(this, function(exports2, jsxRuntime, reablocks, React, react, reactSlot, ReactMarkdown, reactSyntaxHighlighter, rehypeKatex, mdastUtilFindAndReplace, reakeys, remarkGfm, remarkYoutube, remarkMath, dateFns, react$1) {
|
|
16
16
|
"use strict";
|
|
17
17
|
function _interopNamespaceDefault(e) {
|
|
18
18
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
@@ -55,7 +55,12 @@
|
|
|
55
55
|
ref: fileInputRef,
|
|
56
56
|
className: "hidden",
|
|
57
57
|
accept: allowedFiles.join(","),
|
|
58
|
-
onChange:
|
|
58
|
+
onChange: (e) => {
|
|
59
|
+
onFileUpload(e);
|
|
60
|
+
if (fileInputRef.current) {
|
|
61
|
+
fileInputRef.current.value = "";
|
|
62
|
+
}
|
|
63
|
+
}
|
|
59
64
|
}
|
|
60
65
|
),
|
|
61
66
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2339,144 +2344,39 @@ ${response}`),
|
|
|
2339
2344
|
const theme = reablocks.useComponentTheme("chat", customTheme);
|
|
2340
2345
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: reablocks.cn(theme.appbar), children: content });
|
|
2341
2346
|
};
|
|
2342
|
-
const defaultPositions = {
|
|
2343
|
-
"bottom-left": "bottom-5 left-5",
|
|
2344
|
-
"bottom-right": "bottom-5 right-5",
|
|
2345
|
-
"top-left": "top-5 left-5",
|
|
2346
|
-
"top-right": "top-5 right-5"
|
|
2347
|
-
};
|
|
2348
2347
|
const ChatBubble = React.memo(
|
|
2349
2348
|
({
|
|
2350
2349
|
children,
|
|
2351
2350
|
bubbleContent,
|
|
2352
|
-
position = "
|
|
2353
|
-
|
|
2354
|
-
portalTarget = typeof document !== "undefined" ? document.body : null,
|
|
2351
|
+
position = "right-end",
|
|
2352
|
+
modifiers = [react$1.offset({ mainAxis: 0, crossAxis: -40 })],
|
|
2355
2353
|
className
|
|
2356
2354
|
}) => {
|
|
2357
2355
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
2358
|
-
const
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
setIsOpen((prev) => !prev);
|
|
2371
|
-
}, []);
|
|
2372
|
-
const getContentPosition = () => {
|
|
2373
|
-
if (!bubbleRect) return {};
|
|
2374
|
-
const positions = {
|
|
2375
|
-
"bottom-left": {
|
|
2376
|
-
bottom: `calc(100vh - ${bubbleRect.top}px)`,
|
|
2377
|
-
left: `${bubbleRect.right}px`
|
|
2378
|
-
},
|
|
2379
|
-
"bottom-right": {
|
|
2380
|
-
bottom: `calc(100vh - ${bubbleRect.top}px)`,
|
|
2381
|
-
right: `calc(100vw - ${bubbleRect.left}px)`
|
|
2382
|
-
},
|
|
2383
|
-
"top-left": {
|
|
2384
|
-
top: `${bubbleRect.bottom}px`,
|
|
2385
|
-
left: `${bubbleRect.right}px`
|
|
2386
|
-
},
|
|
2387
|
-
"top-right": {
|
|
2388
|
-
top: `${bubbleRect.bottom}px`,
|
|
2389
|
-
right: `calc(100vw - ${bubbleRect.left}px)`
|
|
2356
|
+
const ref = React.useRef(null);
|
|
2357
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2358
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2359
|
+
reablocks.ConnectedOverlay,
|
|
2360
|
+
{
|
|
2361
|
+
placement: position,
|
|
2362
|
+
modifiers,
|
|
2363
|
+
reference: ref.current,
|
|
2364
|
+
open: isOpen,
|
|
2365
|
+
onOpen: () => setIsOpen(true),
|
|
2366
|
+
onClose: () => setIsOpen(false),
|
|
2367
|
+
content: () => /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children })
|
|
2390
2368
|
}
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
...portalTarget ? { position: "absolute" } : {}
|
|
2403
|
-
},
|
|
2404
|
-
onClick: handleToggle,
|
|
2405
|
-
className: reablocks.cn(
|
|
2406
|
-
"z-[1000]",
|
|
2407
|
-
!portalTarget && "fixed",
|
|
2408
|
-
defaultPositions[position],
|
|
2409
|
-
"cursor-pointer",
|
|
2410
|
-
className
|
|
2411
|
-
),
|
|
2412
|
-
role: "button",
|
|
2413
|
-
tabIndex: 0,
|
|
2414
|
-
"aria-label": "Open chat",
|
|
2415
|
-
children: bubbleContent
|
|
2416
|
-
}
|
|
2417
|
-
),
|
|
2418
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { children: children && isOpen && bubbleRect && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2419
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2420
|
-
react.motion.div,
|
|
2421
|
-
{
|
|
2422
|
-
initial: { opacity: 0 },
|
|
2423
|
-
animate: { opacity: 0.5 },
|
|
2424
|
-
exit: { opacity: 0 },
|
|
2425
|
-
className: "fixed inset-0 z-[998]",
|
|
2426
|
-
onClick: handleClose
|
|
2427
|
-
}
|
|
2428
|
-
),
|
|
2429
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2430
|
-
react.motion.div,
|
|
2431
|
-
{
|
|
2432
|
-
ref: contentRef,
|
|
2433
|
-
initial: false,
|
|
2434
|
-
animate: {
|
|
2435
|
-
opacity: 1,
|
|
2436
|
-
scale: 1,
|
|
2437
|
-
x: 0,
|
|
2438
|
-
pointerEvents: "auto"
|
|
2439
|
-
},
|
|
2440
|
-
exit: {
|
|
2441
|
-
opacity: 0,
|
|
2442
|
-
scale: 0.8,
|
|
2443
|
-
x: position.includes("right") ? 20 : -20,
|
|
2444
|
-
pointerEvents: "none"
|
|
2445
|
-
},
|
|
2446
|
-
transition: { type: "spring", duration: 0.5 },
|
|
2447
|
-
className: reablocks.cn(
|
|
2448
|
-
"fixed z-[999]",
|
|
2449
|
-
position.includes("right") ? "origin-right" : "origin-left",
|
|
2450
|
-
position.includes("top") ? "origin-top" : "origin-bottom"
|
|
2451
|
-
),
|
|
2452
|
-
style: getContentPosition(),
|
|
2453
|
-
children
|
|
2454
|
-
}
|
|
2455
|
-
)
|
|
2456
|
-
] }) })
|
|
2457
|
-
] }),
|
|
2458
|
-
[
|
|
2459
|
-
children,
|
|
2460
|
-
customPosition,
|
|
2461
|
-
portalTarget,
|
|
2462
|
-
position,
|
|
2463
|
-
className,
|
|
2464
|
-
bubbleContent,
|
|
2465
|
-
isOpen,
|
|
2466
|
-
handleClose,
|
|
2467
|
-
handleToggle,
|
|
2468
|
-
bubbleRect
|
|
2469
|
-
]
|
|
2470
|
-
);
|
|
2471
|
-
if (!portalTarget) {
|
|
2472
|
-
return content;
|
|
2473
|
-
}
|
|
2474
|
-
try {
|
|
2475
|
-
return reactDom.createPortal(content, portalTarget);
|
|
2476
|
-
} catch (error) {
|
|
2477
|
-
console.error("Failed to create portal for ChatBubble:", error);
|
|
2478
|
-
return content;
|
|
2479
|
-
}
|
|
2369
|
+
),
|
|
2370
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2371
|
+
"div",
|
|
2372
|
+
{
|
|
2373
|
+
ref,
|
|
2374
|
+
className,
|
|
2375
|
+
onClick: () => setIsOpen((prev) => !prev),
|
|
2376
|
+
children: bubbleContent
|
|
2377
|
+
}
|
|
2378
|
+
)
|
|
2379
|
+
] });
|
|
2480
2380
|
}
|
|
2481
2381
|
);
|
|
2482
2382
|
exports2.AppBar = AppBar;
|