@arbidocs/react 0.3.158 → 0.3.160
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/index.cjs +74 -37
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +75 -38
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1349,6 +1349,9 @@ var ChatBubble = React2.memo(function ChatBubble2({
|
|
|
1349
1349
|
deleted,
|
|
1350
1350
|
read,
|
|
1351
1351
|
onDelete,
|
|
1352
|
+
onCopyLink,
|
|
1353
|
+
id,
|
|
1354
|
+
highlighted,
|
|
1352
1355
|
isLastOfRun = true,
|
|
1353
1356
|
senderName,
|
|
1354
1357
|
classNames,
|
|
@@ -1358,11 +1361,12 @@ var ChatBubble = React2.memo(function ChatBubble2({
|
|
|
1358
1361
|
}) {
|
|
1359
1362
|
const [isHovered, setIsHovered] = React2.useState(false);
|
|
1360
1363
|
const [isFocused, setIsFocused] = React2.useState(false);
|
|
1361
|
-
const
|
|
1364
|
+
const showActions = isHovered || isFocused;
|
|
1362
1365
|
if (deleted) {
|
|
1363
1366
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1364
1367
|
"div",
|
|
1365
1368
|
{
|
|
1369
|
+
id,
|
|
1366
1370
|
"data-testid": testId,
|
|
1367
1371
|
className: `flex w-full ${isSent ? "justify-end" : "justify-start"} mb-2`,
|
|
1368
1372
|
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-muted-foreground italic px-3 py-1", children: "Message deleted" })
|
|
@@ -1375,9 +1379,25 @@ var ChatBubble = React2.memo(function ChatBubble2({
|
|
|
1375
1379
|
!isSent && isLastOfRun && "rounded-bl-sm"
|
|
1376
1380
|
);
|
|
1377
1381
|
const bubbleSurface = isSent ? chunkZBZKHBDS_cjs.cn("bg-ai-accent-soft text-foreground chat-bubble-sent", classNames?.ownBubble) : chunkZBZKHBDS_cjs.cn("border border-border bg-card text-card-foreground", classNames?.peerBubble);
|
|
1382
|
+
const highlightClass = highlighted && "ring-2 ring-blue-400 dark:ring-blue-600";
|
|
1383
|
+
const copyLinkButton = onCopyLink && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1384
|
+
"button",
|
|
1385
|
+
{
|
|
1386
|
+
onClick: onCopyLink,
|
|
1387
|
+
onFocus: () => setIsFocused(true),
|
|
1388
|
+
onBlur: () => setIsFocused(false),
|
|
1389
|
+
className: chunkZBZKHBDS_cjs.cn(
|
|
1390
|
+
"self-end p-1 transition-opacity focus:outline-none focus-visible:ring-1 focus-visible:ring-ring rounded",
|
|
1391
|
+
showActions ? "opacity-100 text-foreground" : "opacity-0 text-muted-foreground"
|
|
1392
|
+
),
|
|
1393
|
+
"aria-label": "Copy link to this message",
|
|
1394
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Link, { className: "w-3.5 h-3.5" })
|
|
1395
|
+
}
|
|
1396
|
+
);
|
|
1378
1397
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1379
1398
|
"div",
|
|
1380
1399
|
{
|
|
1400
|
+
id,
|
|
1381
1401
|
"data-testid": testId,
|
|
1382
1402
|
className: chunkZBZKHBDS_cjs.cn(
|
|
1383
1403
|
"flex w-full items-end",
|
|
@@ -1387,51 +1407,68 @@ var ChatBubble = React2.memo(function ChatBubble2({
|
|
|
1387
1407
|
onMouseEnter: () => setIsHovered(true),
|
|
1388
1408
|
onMouseLeave: () => setIsHovered(false),
|
|
1389
1409
|
children: [
|
|
1390
|
-
isSent && onDelete && /* @__PURE__ */ jsxRuntime.
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
onFocus: () => setIsFocused(true),
|
|
1395
|
-
onBlur: () => setIsFocused(false),
|
|
1396
|
-
className: chunkZBZKHBDS_cjs.cn(
|
|
1397
|
-
"self-end p-1 mr-1 transition-opacity focus:outline-none focus-visible:ring-1 focus-visible:ring-ring rounded",
|
|
1398
|
-
showDeleteButton ? "opacity-100 text-destructive" : "opacity-0 text-muted-foreground"
|
|
1399
|
-
),
|
|
1400
|
-
"aria-label": "Delete message",
|
|
1401
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Trash2, { className: "w-3.5 h-3.5" })
|
|
1402
|
-
}
|
|
1403
|
-
),
|
|
1404
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col max-w-[80%] md:max-w-[60%]", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkZBZKHBDS_cjs.cn("px-3.5 py-2 break-words shadow-sm", bubbleRadius, bubbleSurface), children: [
|
|
1405
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm [&_.markdown-content]:space-y-1.5 [&_pre]:max-w-full [&_pre]:overflow-x-auto", children: renderMessage(message) }),
|
|
1406
|
-
isLastOfRun && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1407
|
-
"div",
|
|
1410
|
+
isSent && (copyLinkButton || onDelete) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-0.5 mr-1", children: [
|
|
1411
|
+
copyLinkButton,
|
|
1412
|
+
onDelete && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1413
|
+
"button",
|
|
1408
1414
|
{
|
|
1415
|
+
onClick: onDelete,
|
|
1416
|
+
onFocus: () => setIsFocused(true),
|
|
1417
|
+
onBlur: () => setIsFocused(false),
|
|
1409
1418
|
className: chunkZBZKHBDS_cjs.cn(
|
|
1410
|
-
"
|
|
1411
|
-
|
|
1419
|
+
"self-end p-1 transition-opacity focus:outline-none focus-visible:ring-1 focus-visible:ring-ring rounded",
|
|
1420
|
+
showActions ? "opacity-100 text-destructive" : "opacity-0 text-muted-foreground"
|
|
1412
1421
|
),
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] leading-none opacity-70", children: formatTimestamp(timestamp) }),
|
|
1416
|
-
isSent && (read ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckCheck, { className: "w-3.5 h-3.5 flex-shrink-0 opacity-80" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "w-3.5 h-3.5 flex-shrink-0 opacity-60" }))
|
|
1417
|
-
]
|
|
1422
|
+
"aria-label": "Delete message",
|
|
1423
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Trash2, { className: "w-3.5 h-3.5" })
|
|
1418
1424
|
}
|
|
1419
1425
|
)
|
|
1420
|
-
] })
|
|
1421
|
-
|
|
1422
|
-
"
|
|
1426
|
+
] }),
|
|
1427
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col max-w-[80%] md:max-w-[60%]", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1428
|
+
"div",
|
|
1423
1429
|
{
|
|
1424
|
-
onClick: onDelete,
|
|
1425
|
-
onFocus: () => setIsFocused(true),
|
|
1426
|
-
onBlur: () => setIsFocused(false),
|
|
1427
1430
|
className: chunkZBZKHBDS_cjs.cn(
|
|
1428
|
-
"
|
|
1429
|
-
|
|
1431
|
+
"px-3.5 py-2 break-words shadow-sm transition-shadow",
|
|
1432
|
+
bubbleRadius,
|
|
1433
|
+
bubbleSurface,
|
|
1434
|
+
highlightClass
|
|
1430
1435
|
),
|
|
1431
|
-
|
|
1432
|
-
|
|
1436
|
+
children: [
|
|
1437
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm [&_.markdown-content]:space-y-1.5 [&_pre]:max-w-full [&_pre]:overflow-x-auto", children: renderMessage(message) }),
|
|
1438
|
+
isLastOfRun && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1439
|
+
"div",
|
|
1440
|
+
{
|
|
1441
|
+
className: chunkZBZKHBDS_cjs.cn(
|
|
1442
|
+
"flex items-center gap-1.5 mt-0.5",
|
|
1443
|
+
isSent ? "justify-end" : "justify-start"
|
|
1444
|
+
),
|
|
1445
|
+
children: [
|
|
1446
|
+
senderName && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] font-medium leading-none opacity-90", children: senderName }),
|
|
1447
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] leading-none opacity-70", children: formatTimestamp(timestamp) }),
|
|
1448
|
+
isSent && (read ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckCheck, { className: "w-3.5 h-3.5 flex-shrink-0 opacity-80" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "w-3.5 h-3.5 flex-shrink-0 opacity-60" }))
|
|
1449
|
+
]
|
|
1450
|
+
}
|
|
1451
|
+
)
|
|
1452
|
+
]
|
|
1433
1453
|
}
|
|
1434
|
-
)
|
|
1454
|
+
) }),
|
|
1455
|
+
!isSent && (onDelete || copyLinkButton) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-0.5 ml-1", children: [
|
|
1456
|
+
onDelete && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1457
|
+
"button",
|
|
1458
|
+
{
|
|
1459
|
+
onClick: onDelete,
|
|
1460
|
+
onFocus: () => setIsFocused(true),
|
|
1461
|
+
onBlur: () => setIsFocused(false),
|
|
1462
|
+
className: chunkZBZKHBDS_cjs.cn(
|
|
1463
|
+
"self-end p-1 transition-opacity focus:outline-none focus-visible:ring-1 focus-visible:ring-ring rounded",
|
|
1464
|
+
showActions ? "opacity-100 text-destructive" : "opacity-0 text-muted-foreground"
|
|
1465
|
+
),
|
|
1466
|
+
"aria-label": "Delete message",
|
|
1467
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Trash2, { className: "w-3.5 h-3.5" })
|
|
1468
|
+
}
|
|
1469
|
+
),
|
|
1470
|
+
copyLinkButton
|
|
1471
|
+
] })
|
|
1435
1472
|
]
|
|
1436
1473
|
}
|
|
1437
1474
|
);
|