@duskmoon-dev/components 0.5.2 → 0.5.3
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/README.md +37 -8
- package/dist/classes/chat.d.ts +12 -0
- package/dist/classes/index.js +24 -0
- package/dist/components/chat/Chat.types.d.ts +52 -0
- package/dist/components/chat/ChatPrimitives.d.ts +14 -0
- package/dist/components/chat/index.d.ts +1 -0
- package/dist/components/chat/index.js +358 -42
- package/dist/components/dm-truncate/index.js +37 -3
- package/dist/components/popconfirm/index.js +49 -5
- package/dist/components/popover/index.js +0 -4
- package/dist/components/tooltip/Tooltip.types.d.ts +1 -1
- package/dist/components/tooltip/index.js +37 -3
- package/dist/generated/version.d.ts +1 -1
- package/dist/index.js +1882 -1492
- package/dist/infrastructure.js +1 -1
- package/dist/styles.css +332 -42
- package/package.json +3 -3
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
// src/components/chat/Chat.tsx
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
forwardRef as forwardRef4,
|
|
6
|
+
useId as useId3,
|
|
7
|
+
useLayoutEffect as useLayoutEffect2,
|
|
8
|
+
useRef as useRef3,
|
|
9
|
+
useState as useState3
|
|
10
|
+
} from "react";
|
|
5
11
|
|
|
6
12
|
// src/components/chat/ChatComposer.tsx
|
|
7
13
|
import {
|
|
@@ -1099,6 +1105,9 @@ var ChatComposer = forwardRef2(({
|
|
|
1099
1105
|
});
|
|
1100
1106
|
ChatComposer.displayName = "Chat.Composer";
|
|
1101
1107
|
|
|
1108
|
+
// src/components/chat/ChatPrimitives.tsx
|
|
1109
|
+
import { forwardRef as forwardRef3, useId as useId2 } from "react";
|
|
1110
|
+
|
|
1102
1111
|
// src/classes/chat.ts
|
|
1103
1112
|
var chatBaseClass = "chat";
|
|
1104
1113
|
var chatAvatarClass = "chat-avatar";
|
|
@@ -1173,88 +1182,373 @@ function getChatToolClasses({
|
|
|
1173
1182
|
return cn(chatToolBaseClass, status && chatToolStateClasses[status], className);
|
|
1174
1183
|
}
|
|
1175
1184
|
|
|
1176
|
-
// src/components/chat/
|
|
1185
|
+
// src/components/chat/ChatPrimitives.tsx
|
|
1177
1186
|
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1178
|
-
var
|
|
1187
|
+
var ChatAgent = forwardRef3(({ timeline, className, ...props }, ref) => /* @__PURE__ */ jsx4("div", {
|
|
1188
|
+
...props,
|
|
1189
|
+
ref,
|
|
1190
|
+
"data-chat-tl": timeline ?? props["data-chat-tl"],
|
|
1191
|
+
className: getChatClasses({ className: cn("chat-agent", className) })
|
|
1192
|
+
}));
|
|
1193
|
+
ChatAgent.displayName = "Chat.Agent";
|
|
1194
|
+
var ChatContent = forwardRef3(({ streaming, className, ...props }, ref) => /* @__PURE__ */ jsx4("div", {
|
|
1195
|
+
...props,
|
|
1196
|
+
ref,
|
|
1197
|
+
className: cn("chat-content", streaming && "chat-streaming", className)
|
|
1198
|
+
}));
|
|
1199
|
+
ChatContent.displayName = "Chat.Content";
|
|
1200
|
+
var ChatWork = forwardRef3(({ className, ...props }, ref) => /* @__PURE__ */ jsx4("details", {
|
|
1201
|
+
...props,
|
|
1202
|
+
ref,
|
|
1203
|
+
className: cn("chat-work", className)
|
|
1204
|
+
}));
|
|
1205
|
+
ChatWork.displayName = "Chat.Work";
|
|
1206
|
+
var ChatWorkSummary = forwardRef3(({ className, ...props }, ref) => /* @__PURE__ */ jsx4("summary", {
|
|
1207
|
+
...props,
|
|
1208
|
+
ref,
|
|
1209
|
+
className: cn("chat-work-summary", className)
|
|
1210
|
+
}));
|
|
1211
|
+
ChatWorkSummary.displayName = "Chat.WorkSummary";
|
|
1212
|
+
var ChatWorkBody = forwardRef3(({ className, ...props }, ref) => /* @__PURE__ */ jsx4("div", {
|
|
1213
|
+
...props,
|
|
1214
|
+
ref,
|
|
1215
|
+
className: cn("chat-work-body", className)
|
|
1216
|
+
}));
|
|
1217
|
+
ChatWorkBody.displayName = "Chat.WorkBody";
|
|
1218
|
+
var ChatInputArea = forwardRef3(({ className, ...props }, ref) => /* @__PURE__ */ jsx4("div", {
|
|
1219
|
+
...props,
|
|
1220
|
+
ref,
|
|
1221
|
+
className: cn("chat-input-area", className)
|
|
1222
|
+
}));
|
|
1223
|
+
ChatInputArea.displayName = "Chat.InputArea";
|
|
1224
|
+
var ChatComposerForm = forwardRef3(({ color, ghost, className, ...props }, ref) => /* @__PURE__ */ jsx4("form", {
|
|
1225
|
+
...props,
|
|
1226
|
+
ref,
|
|
1227
|
+
className: cn("chat-composer", color && `chat-composer-${color}`, ghost && "chat-composer-ghost", className)
|
|
1228
|
+
}));
|
|
1229
|
+
ChatComposerForm.displayName = "Chat.ComposerForm";
|
|
1230
|
+
var ChatComposerInput = forwardRef3(({ className, ...props }, ref) => /* @__PURE__ */ jsx4("textarea", {
|
|
1231
|
+
...props,
|
|
1232
|
+
ref,
|
|
1233
|
+
className: cn("chat-composer-input", className)
|
|
1234
|
+
}));
|
|
1235
|
+
ChatComposerInput.displayName = "Chat.ComposerInput";
|
|
1236
|
+
var ChatComposerActions = forwardRef3(({ className, ...props }, ref) => /* @__PURE__ */ jsx4("div", {
|
|
1237
|
+
...props,
|
|
1238
|
+
ref,
|
|
1239
|
+
className: cn("chat-composer-actions", className)
|
|
1240
|
+
}));
|
|
1241
|
+
ChatComposerActions.displayName = "Chat.ComposerActions";
|
|
1242
|
+
var ChatComposerHint = forwardRef3(({ className, ...props }, ref) => /* @__PURE__ */ jsx4("kbd", {
|
|
1243
|
+
...props,
|
|
1244
|
+
ref,
|
|
1245
|
+
className: cn("chat-composer-hint", className)
|
|
1246
|
+
}));
|
|
1247
|
+
ChatComposerHint.displayName = "Chat.ComposerHint";
|
|
1248
|
+
var ChatQueue = forwardRef3(({
|
|
1249
|
+
items,
|
|
1250
|
+
activeId = items[0]?.id,
|
|
1251
|
+
pendingIds = [],
|
|
1252
|
+
steerDisabled,
|
|
1253
|
+
onSteer,
|
|
1254
|
+
onRemove,
|
|
1255
|
+
label = "Waiting messages",
|
|
1256
|
+
hidden,
|
|
1257
|
+
className,
|
|
1258
|
+
...props
|
|
1259
|
+
}, ref) => {
|
|
1260
|
+
const titleId = `${useId2()}-queue-title`;
|
|
1261
|
+
return /* @__PURE__ */ jsxs4("section", {
|
|
1262
|
+
...props,
|
|
1263
|
+
ref,
|
|
1264
|
+
hidden: hidden || items.length === 0,
|
|
1265
|
+
"aria-labelledby": props["aria-labelledby"] ?? (props["aria-label"] ? undefined : titleId),
|
|
1266
|
+
className: cn("chat-queue", className),
|
|
1267
|
+
children: [
|
|
1268
|
+
/* @__PURE__ */ jsxs4("div", {
|
|
1269
|
+
className: "chat-queue-header sr-only",
|
|
1270
|
+
children: [
|
|
1271
|
+
/* @__PURE__ */ jsx4("h3", {
|
|
1272
|
+
className: "chat-queue-title",
|
|
1273
|
+
id: titleId,
|
|
1274
|
+
children: label
|
|
1275
|
+
}),
|
|
1276
|
+
/* @__PURE__ */ jsxs4("span", {
|
|
1277
|
+
className: "chat-queue-count",
|
|
1278
|
+
children: [
|
|
1279
|
+
items.length,
|
|
1280
|
+
" queued"
|
|
1281
|
+
]
|
|
1282
|
+
})
|
|
1283
|
+
]
|
|
1284
|
+
}),
|
|
1285
|
+
/* @__PURE__ */ jsx4("ol", {
|
|
1286
|
+
className: "chat-queue-list",
|
|
1287
|
+
role: "list",
|
|
1288
|
+
tabIndex: 0,
|
|
1289
|
+
"aria-label": label,
|
|
1290
|
+
children: items.map((item, index) => {
|
|
1291
|
+
const pending = pendingIds.includes(item.id);
|
|
1292
|
+
return /* @__PURE__ */ jsxs4("li", {
|
|
1293
|
+
className: cn("chat-queue-item", item.id === activeId && "chat-queue-item-active"),
|
|
1294
|
+
"aria-busy": pending || undefined,
|
|
1295
|
+
children: [
|
|
1296
|
+
/* @__PURE__ */ jsx4("svg", {
|
|
1297
|
+
className: "chat-queue-icon",
|
|
1298
|
+
viewBox: "0 0 24 24",
|
|
1299
|
+
fill: "none",
|
|
1300
|
+
stroke: "currentColor",
|
|
1301
|
+
"aria-hidden": "true",
|
|
1302
|
+
focusable: "false",
|
|
1303
|
+
children: /* @__PURE__ */ jsx4("path", {
|
|
1304
|
+
d: "m8 6 4 4-4 4M12 10H5m10-4h4m-4 6h4m-4 6h4"
|
|
1305
|
+
})
|
|
1306
|
+
}),
|
|
1307
|
+
/* @__PURE__ */ jsxs4("span", {
|
|
1308
|
+
className: "chat-queue-number sr-only",
|
|
1309
|
+
children: [
|
|
1310
|
+
"#",
|
|
1311
|
+
index + 1
|
|
1312
|
+
]
|
|
1313
|
+
}),
|
|
1314
|
+
item.attachment ? /* @__PURE__ */ jsx4("img", {
|
|
1315
|
+
className: "chat-queue-attachment",
|
|
1316
|
+
src: item.attachment.src,
|
|
1317
|
+
alt: item.attachment.alt
|
|
1318
|
+
}) : null,
|
|
1319
|
+
/* @__PURE__ */ jsx4("div", {
|
|
1320
|
+
className: "chat-queue-content",
|
|
1321
|
+
title: item.text,
|
|
1322
|
+
children: item.text
|
|
1323
|
+
}),
|
|
1324
|
+
/* @__PURE__ */ jsxs4("div", {
|
|
1325
|
+
className: "chat-actions chat-queue-actions",
|
|
1326
|
+
children: [
|
|
1327
|
+
/* @__PURE__ */ jsxs4("button", {
|
|
1328
|
+
className: "btn btn-ghost btn-sm chat-queue-steer",
|
|
1329
|
+
type: "button",
|
|
1330
|
+
disabled: pending || steerDisabled,
|
|
1331
|
+
"aria-label": `Steer waiting message ${index + 1}`,
|
|
1332
|
+
onClick: () => onSteer(item.id),
|
|
1333
|
+
children: [
|
|
1334
|
+
/* @__PURE__ */ jsx4("svg", {
|
|
1335
|
+
width: "16",
|
|
1336
|
+
height: "16",
|
|
1337
|
+
viewBox: "0 0 24 24",
|
|
1338
|
+
fill: "none",
|
|
1339
|
+
stroke: "currentColor",
|
|
1340
|
+
"aria-hidden": "true",
|
|
1341
|
+
focusable: "false",
|
|
1342
|
+
children: /* @__PURE__ */ jsx4("path", {
|
|
1343
|
+
d: "m15 4 5 5-5 5M20 9h-9a6 6 0 0 0-6 6v4"
|
|
1344
|
+
})
|
|
1345
|
+
}),
|
|
1346
|
+
"Steer"
|
|
1347
|
+
]
|
|
1348
|
+
}),
|
|
1349
|
+
/* @__PURE__ */ jsx4("button", {
|
|
1350
|
+
className: "btn btn-ghost btn-sm btn-square chat-queue-remove",
|
|
1351
|
+
type: "button",
|
|
1352
|
+
disabled: pending,
|
|
1353
|
+
"aria-label": `Remove waiting message ${index + 1}`,
|
|
1354
|
+
onClick: () => onRemove(item.id),
|
|
1355
|
+
children: /* @__PURE__ */ jsx4("svg", {
|
|
1356
|
+
width: "16",
|
|
1357
|
+
height: "16",
|
|
1358
|
+
viewBox: "0 0 24 24",
|
|
1359
|
+
fill: "none",
|
|
1360
|
+
stroke: "currentColor",
|
|
1361
|
+
"aria-hidden": "true",
|
|
1362
|
+
focusable: "false",
|
|
1363
|
+
children: /* @__PURE__ */ jsx4("path", {
|
|
1364
|
+
d: "M3 6h18M9 6V3h6v3M5 6l1 15h12l1-15M10 10v7m4-7v7"
|
|
1365
|
+
})
|
|
1366
|
+
})
|
|
1367
|
+
})
|
|
1368
|
+
]
|
|
1369
|
+
})
|
|
1370
|
+
]
|
|
1371
|
+
}, item.id);
|
|
1372
|
+
})
|
|
1373
|
+
})
|
|
1374
|
+
]
|
|
1375
|
+
});
|
|
1376
|
+
});
|
|
1377
|
+
ChatQueue.displayName = "Chat.Queue";
|
|
1378
|
+
|
|
1379
|
+
// src/components/chat/Chat.tsx
|
|
1380
|
+
import { jsx as jsx5, jsxs as jsxs5, Fragment as Fragment3 } from "react/jsx-runtime";
|
|
1381
|
+
var ChatAvatar = forwardRef4(({ className, ...props }, ref) => /* @__PURE__ */ jsx5("div", {
|
|
1179
1382
|
...props,
|
|
1180
1383
|
ref,
|
|
1181
1384
|
className: cn(chatAvatarClass, className)
|
|
1182
1385
|
}));
|
|
1183
1386
|
ChatAvatar.displayName = "Chat.Avatar";
|
|
1184
|
-
var ChatHeader =
|
|
1387
|
+
var ChatHeader = forwardRef4(({ className, ...props }, ref) => /* @__PURE__ */ jsx5("div", {
|
|
1185
1388
|
...props,
|
|
1186
1389
|
ref,
|
|
1187
1390
|
className: cn(chatHeaderClass, className)
|
|
1188
1391
|
}));
|
|
1189
1392
|
ChatHeader.displayName = "Chat.Header";
|
|
1190
|
-
var ChatBubble =
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
children
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1393
|
+
var ChatBubble = forwardRef4(({
|
|
1394
|
+
color,
|
|
1395
|
+
size = "md",
|
|
1396
|
+
filled,
|
|
1397
|
+
streaming,
|
|
1398
|
+
collapsible,
|
|
1399
|
+
expanded,
|
|
1400
|
+
defaultExpanded = false,
|
|
1401
|
+
onExpandedChange,
|
|
1402
|
+
className,
|
|
1403
|
+
children,
|
|
1404
|
+
...props
|
|
1405
|
+
}, ref) => {
|
|
1406
|
+
const contentId = `${useId3()}-content`;
|
|
1407
|
+
const contentRef = useRef3(null);
|
|
1408
|
+
const toggleRef = useRef3(null);
|
|
1409
|
+
const collapseRequestedRef = useRef3(false);
|
|
1410
|
+
const [overflows, setOverflows] = useState3(false);
|
|
1411
|
+
const [internalExpanded, setInternalExpanded] = useState3(defaultExpanded);
|
|
1412
|
+
const requestedExpanded = expanded ?? internalExpanded;
|
|
1413
|
+
const isExpanded = overflows && requestedExpanded;
|
|
1414
|
+
useLayoutEffect2(() => {
|
|
1415
|
+
const content = contentRef.current;
|
|
1416
|
+
if (!collapsible || !content) {
|
|
1417
|
+
collapseRequestedRef.current = false;
|
|
1418
|
+
return;
|
|
1419
|
+
}
|
|
1420
|
+
const view = content.ownerDocument.defaultView;
|
|
1421
|
+
function measure() {
|
|
1422
|
+
if (!content || !view)
|
|
1423
|
+
return;
|
|
1424
|
+
const lineHeight = parseFloat(view.getComputedStyle(content).lineHeight);
|
|
1425
|
+
if (!Number.isFinite(lineHeight))
|
|
1426
|
+
return;
|
|
1427
|
+
const next = content.scrollHeight > 6 * lineHeight + 1;
|
|
1428
|
+
if (next || !requestedExpanded)
|
|
1429
|
+
collapseRequestedRef.current = false;
|
|
1430
|
+
if (!next) {
|
|
1431
|
+
if (content.ownerDocument.activeElement === toggleRef.current)
|
|
1432
|
+
content.focus();
|
|
1433
|
+
if (requestedExpanded && !collapseRequestedRef.current) {
|
|
1434
|
+
collapseRequestedRef.current = true;
|
|
1435
|
+
if (expanded === undefined)
|
|
1436
|
+
setInternalExpanded(false);
|
|
1437
|
+
onExpandedChange?.(false);
|
|
1438
|
+
}
|
|
1439
|
+
}
|
|
1440
|
+
setOverflows(next);
|
|
1441
|
+
}
|
|
1442
|
+
measure();
|
|
1443
|
+
const resize = view?.ResizeObserver ? new view.ResizeObserver(measure) : undefined;
|
|
1444
|
+
const mutation = view?.MutationObserver ? new view.MutationObserver(measure) : undefined;
|
|
1445
|
+
resize?.observe(content);
|
|
1446
|
+
mutation?.observe(content, {
|
|
1447
|
+
childList: true,
|
|
1448
|
+
characterData: true,
|
|
1449
|
+
subtree: true
|
|
1450
|
+
});
|
|
1451
|
+
return () => {
|
|
1452
|
+
resize?.disconnect();
|
|
1453
|
+
mutation?.disconnect();
|
|
1454
|
+
};
|
|
1455
|
+
}, [collapsible, children, requestedExpanded, expanded, onExpandedChange]);
|
|
1456
|
+
const body = /* @__PURE__ */ jsxs5(Fragment3, {
|
|
1457
|
+
children: [
|
|
1458
|
+
children,
|
|
1459
|
+
streaming ? /* @__PURE__ */ jsx5("span", {
|
|
1460
|
+
className: "chat-bubble-content chat-bubble-streaming",
|
|
1461
|
+
"aria-hidden": "true"
|
|
1462
|
+
}) : null
|
|
1463
|
+
]
|
|
1464
|
+
});
|
|
1465
|
+
return /* @__PURE__ */ jsx5("div", {
|
|
1466
|
+
...props,
|
|
1467
|
+
ref,
|
|
1468
|
+
className: getChatBubbleClasses({
|
|
1469
|
+
color,
|
|
1470
|
+
size,
|
|
1471
|
+
filled,
|
|
1472
|
+
streaming,
|
|
1473
|
+
className: cn(collapsible && "chat-bubble-collapsible", className)
|
|
1474
|
+
}),
|
|
1475
|
+
children: collapsible ? /* @__PURE__ */ jsxs5(Fragment3, {
|
|
1476
|
+
children: [
|
|
1477
|
+
/* @__PURE__ */ jsx5("div", {
|
|
1478
|
+
ref: contentRef,
|
|
1479
|
+
className: "chat-bubble-content",
|
|
1480
|
+
id: contentId,
|
|
1481
|
+
tabIndex: -1,
|
|
1482
|
+
children: body
|
|
1483
|
+
}),
|
|
1484
|
+
/* @__PURE__ */ jsx5("button", {
|
|
1485
|
+
ref: toggleRef,
|
|
1486
|
+
type: "button",
|
|
1487
|
+
className: "btn btn-ghost btn-xs chat-bubble-toggle",
|
|
1488
|
+
"aria-controls": contentId,
|
|
1489
|
+
"aria-expanded": isExpanded,
|
|
1490
|
+
hidden: !overflows,
|
|
1491
|
+
onClick: () => {
|
|
1492
|
+
if (expanded === undefined)
|
|
1493
|
+
setInternalExpanded(!isExpanded);
|
|
1494
|
+
onExpandedChange?.(!isExpanded);
|
|
1495
|
+
},
|
|
1496
|
+
children: isExpanded ? "Show less" : "Show more"
|
|
1497
|
+
})
|
|
1498
|
+
]
|
|
1499
|
+
}) : body
|
|
1500
|
+
});
|
|
1501
|
+
});
|
|
1208
1502
|
ChatBubble.displayName = "Chat.Bubble";
|
|
1209
|
-
var ChatFooter =
|
|
1503
|
+
var ChatFooter = forwardRef4(({ className, ...props }, ref) => /* @__PURE__ */ jsx5("div", {
|
|
1210
1504
|
...props,
|
|
1211
1505
|
ref,
|
|
1212
1506
|
className: cn(chatFooterClass, className)
|
|
1213
1507
|
}));
|
|
1214
1508
|
ChatFooter.displayName = "Chat.Footer";
|
|
1215
|
-
var ChatStatus =
|
|
1509
|
+
var ChatStatus = forwardRef4(({ className, ...props }, ref) => /* @__PURE__ */ jsx5("div", {
|
|
1216
1510
|
...props,
|
|
1217
1511
|
ref,
|
|
1218
1512
|
className: cn(chatStatusClass, className)
|
|
1219
1513
|
}));
|
|
1220
1514
|
ChatStatus.displayName = "Chat.Status";
|
|
1221
|
-
var ChatStatusItem =
|
|
1515
|
+
var ChatStatusItem = forwardRef4(({ className, ...props }, ref) => /* @__PURE__ */ jsx5("span", {
|
|
1222
1516
|
...props,
|
|
1223
1517
|
ref,
|
|
1224
1518
|
className: cn(chatStatusItemClass, className)
|
|
1225
1519
|
}));
|
|
1226
1520
|
ChatStatusItem.displayName = "Chat.StatusItem";
|
|
1227
|
-
var ChatStatusValue =
|
|
1521
|
+
var ChatStatusValue = forwardRef4(({ className, ...props }, ref) => /* @__PURE__ */ jsx5("span", {
|
|
1228
1522
|
...props,
|
|
1229
1523
|
ref,
|
|
1230
1524
|
className: cn(chatStatusValueClass, className)
|
|
1231
1525
|
}));
|
|
1232
1526
|
ChatStatusValue.displayName = "Chat.StatusValue";
|
|
1233
|
-
var ChatActions =
|
|
1527
|
+
var ChatActions = forwardRef4(({ hover, className, ...props }, ref) => /* @__PURE__ */ jsx5("div", {
|
|
1234
1528
|
...props,
|
|
1235
1529
|
ref,
|
|
1236
1530
|
className: cn(chatActionsClass, hover && chatActionsHoverClass, className)
|
|
1237
1531
|
}));
|
|
1238
1532
|
ChatActions.displayName = "Chat.Actions";
|
|
1239
|
-
var ChatScroll =
|
|
1533
|
+
var ChatScroll = forwardRef4(({ className, ...props }, ref) => /* @__PURE__ */ jsx5("div", {
|
|
1240
1534
|
...props,
|
|
1241
1535
|
ref,
|
|
1242
1536
|
className: cn(chatScrollClass, className)
|
|
1243
1537
|
}));
|
|
1244
1538
|
ChatScroll.displayName = "Chat.Scroll";
|
|
1245
|
-
var ChatScrollBody =
|
|
1539
|
+
var ChatScrollBody = forwardRef4(({ className, ...props }, ref) => /* @__PURE__ */ jsx5("div", {
|
|
1246
1540
|
...props,
|
|
1247
1541
|
ref,
|
|
1248
1542
|
className: cn(chatScrollBodyClass, className)
|
|
1249
1543
|
}));
|
|
1250
1544
|
ChatScrollBody.displayName = "Chat.ScrollBody";
|
|
1251
|
-
var ChatScrollTrack =
|
|
1545
|
+
var ChatScrollTrack = forwardRef4(({ className, ...props }, ref) => /* @__PURE__ */ jsx5("div", {
|
|
1252
1546
|
...props,
|
|
1253
1547
|
ref,
|
|
1254
1548
|
className: cn(chatScrollTrackClass, className)
|
|
1255
1549
|
}));
|
|
1256
1550
|
ChatScrollTrack.displayName = "Chat.ScrollTrack";
|
|
1257
|
-
var ChatScrollIndicator =
|
|
1551
|
+
var ChatScrollIndicator = forwardRef4(({ targetId, timeline, type = "button", className, onClick, ...props }, ref) => /* @__PURE__ */ jsx5("button", {
|
|
1258
1552
|
...props,
|
|
1259
1553
|
ref,
|
|
1260
1554
|
type,
|
|
@@ -1276,59 +1570,59 @@ var ChatScrollIndicator = forwardRef3(({ targetId, timeline, type = "button", cl
|
|
|
1276
1570
|
}
|
|
1277
1571
|
}));
|
|
1278
1572
|
ChatScrollIndicator.displayName = "Chat.ScrollIndicator";
|
|
1279
|
-
var ChatReasoning =
|
|
1573
|
+
var ChatReasoning = forwardRef4(({ className, ...props }, ref) => /* @__PURE__ */ jsx5("details", {
|
|
1280
1574
|
...props,
|
|
1281
1575
|
ref,
|
|
1282
1576
|
className: cn(chatReasoningClass, className)
|
|
1283
1577
|
}));
|
|
1284
1578
|
ChatReasoning.displayName = "Chat.Reasoning";
|
|
1285
|
-
var ChatTool =
|
|
1579
|
+
var ChatTool = forwardRef4(({ status, className, ...props }, ref) => /* @__PURE__ */ jsx5("details", {
|
|
1286
1580
|
...props,
|
|
1287
1581
|
ref,
|
|
1288
1582
|
className: getChatToolClasses({ status, className })
|
|
1289
1583
|
}));
|
|
1290
1584
|
ChatTool.displayName = "Chat.Tool";
|
|
1291
|
-
var ChatToolHeader =
|
|
1585
|
+
var ChatToolHeader = forwardRef4(({ className, ...props }, ref) => /* @__PURE__ */ jsx5("summary", {
|
|
1292
1586
|
...props,
|
|
1293
1587
|
ref,
|
|
1294
1588
|
className: cn(chatToolHeaderClass, className)
|
|
1295
1589
|
}));
|
|
1296
1590
|
ChatToolHeader.displayName = "Chat.ToolHeader";
|
|
1297
|
-
var ChatToolStatus =
|
|
1591
|
+
var ChatToolStatus = forwardRef4(({ className, ...props }, ref) => /* @__PURE__ */ jsx5("span", {
|
|
1298
1592
|
...props,
|
|
1299
1593
|
ref,
|
|
1300
1594
|
className: cn(chatToolStatusClass, className)
|
|
1301
1595
|
}));
|
|
1302
1596
|
ChatToolStatus.displayName = "Chat.ToolStatus";
|
|
1303
|
-
var ChatToolCall =
|
|
1597
|
+
var ChatToolCall = forwardRef4(({ className, ...props }, ref) => /* @__PURE__ */ jsx5("div", {
|
|
1304
1598
|
...props,
|
|
1305
1599
|
ref,
|
|
1306
1600
|
className: cn(chatToolCallClass, className)
|
|
1307
1601
|
}));
|
|
1308
1602
|
ChatToolCall.displayName = "Chat.ToolCall";
|
|
1309
|
-
var ChatToolResult =
|
|
1603
|
+
var ChatToolResult = forwardRef4(({ className, ...props }, ref) => /* @__PURE__ */ jsx5("div", {
|
|
1310
1604
|
...props,
|
|
1311
1605
|
ref,
|
|
1312
1606
|
className: cn(chatToolResultClass, className)
|
|
1313
1607
|
}));
|
|
1314
1608
|
ChatToolResult.displayName = "Chat.ToolResult";
|
|
1315
|
-
var ChatTyping =
|
|
1609
|
+
var ChatTyping = forwardRef4(({
|
|
1316
1610
|
className,
|
|
1317
1611
|
role = "status",
|
|
1318
1612
|
"aria-label": ariaLabel = "Assistant is typing",
|
|
1319
1613
|
...props
|
|
1320
|
-
}, ref) => /* @__PURE__ */
|
|
1614
|
+
}, ref) => /* @__PURE__ */ jsx5("span", {
|
|
1321
1615
|
...props,
|
|
1322
1616
|
ref,
|
|
1323
1617
|
role,
|
|
1324
1618
|
"aria-label": ariaLabel,
|
|
1325
1619
|
className: cn(chatTypingClass, className),
|
|
1326
|
-
children: /* @__PURE__ */
|
|
1620
|
+
children: /* @__PURE__ */ jsx5("span", {
|
|
1327
1621
|
"aria-hidden": "true"
|
|
1328
1622
|
})
|
|
1329
1623
|
}));
|
|
1330
1624
|
ChatTyping.displayName = "Chat.Typing";
|
|
1331
|
-
var ChatRoot =
|
|
1625
|
+
var ChatRoot = forwardRef4(({ placement = "start", timeline, className, ...props }, ref) => /* @__PURE__ */ jsx5("div", {
|
|
1332
1626
|
...props,
|
|
1333
1627
|
ref,
|
|
1334
1628
|
"data-chat-tl": timeline ?? props["data-chat-tl"],
|
|
@@ -1337,6 +1631,17 @@ var ChatRoot = forwardRef3(({ placement = "start", timeline, className, ...props
|
|
|
1337
1631
|
ChatRoot.displayName = "Chat";
|
|
1338
1632
|
var Chat = Object.assign(ChatRoot, {
|
|
1339
1633
|
Composer: ChatComposer,
|
|
1634
|
+
Agent: ChatAgent,
|
|
1635
|
+
Content: ChatContent,
|
|
1636
|
+
Work: ChatWork,
|
|
1637
|
+
WorkSummary: ChatWorkSummary,
|
|
1638
|
+
WorkBody: ChatWorkBody,
|
|
1639
|
+
InputArea: ChatInputArea,
|
|
1640
|
+
Queue: ChatQueue,
|
|
1641
|
+
ComposerForm: ChatComposerForm,
|
|
1642
|
+
ComposerInput: ChatComposerInput,
|
|
1643
|
+
ComposerActions: ChatComposerActions,
|
|
1644
|
+
ComposerHint: ChatComposerHint,
|
|
1340
1645
|
Avatar: ChatAvatar,
|
|
1341
1646
|
Header: ChatHeader,
|
|
1342
1647
|
Bubble: ChatBubble,
|
|
@@ -1360,11 +1665,19 @@ var Chat = Object.assign(ChatRoot, {
|
|
|
1360
1665
|
export {
|
|
1361
1666
|
Chat,
|
|
1362
1667
|
ChatActions,
|
|
1668
|
+
ChatAgent,
|
|
1363
1669
|
ChatAvatar,
|
|
1364
1670
|
ChatBubble,
|
|
1365
1671
|
ChatComposer,
|
|
1672
|
+
ChatComposerActions,
|
|
1673
|
+
ChatComposerForm,
|
|
1674
|
+
ChatComposerHint,
|
|
1675
|
+
ChatComposerInput,
|
|
1676
|
+
ChatContent,
|
|
1366
1677
|
ChatFooter,
|
|
1367
1678
|
ChatHeader,
|
|
1679
|
+
ChatInputArea,
|
|
1680
|
+
ChatQueue,
|
|
1368
1681
|
ChatReasoning,
|
|
1369
1682
|
ChatScroll,
|
|
1370
1683
|
ChatScrollBody,
|
|
@@ -1378,5 +1691,8 @@ export {
|
|
|
1378
1691
|
ChatToolHeader,
|
|
1379
1692
|
ChatToolResult,
|
|
1380
1693
|
ChatToolStatus,
|
|
1381
|
-
ChatTyping
|
|
1694
|
+
ChatTyping,
|
|
1695
|
+
ChatWork,
|
|
1696
|
+
ChatWorkBody,
|
|
1697
|
+
ChatWorkSummary
|
|
1382
1698
|
};
|
|
@@ -93,7 +93,7 @@ var Tooltip = forwardRef(({
|
|
|
93
93
|
open,
|
|
94
94
|
defaultOpen,
|
|
95
95
|
onOpenChange,
|
|
96
|
-
arrow =
|
|
96
|
+
arrow = false,
|
|
97
97
|
size = "md",
|
|
98
98
|
className,
|
|
99
99
|
children,
|
|
@@ -121,12 +121,21 @@ var Tooltip = forwardRef(({
|
|
|
121
121
|
controlledRef.current = isControlled;
|
|
122
122
|
onOpenChangeRef.current = onOpenChange;
|
|
123
123
|
const hasTitle = Boolean(title);
|
|
124
|
+
const nativeInterest = !isControlled && React.isValidElement(children) && (typeof children.type !== "string" || children.type === "button" || children.type === "a") && children.type !== React.Fragment;
|
|
124
125
|
useEffect(() => {
|
|
125
126
|
const surface = surfaceRef.current;
|
|
126
127
|
if (!surface)
|
|
127
128
|
return;
|
|
128
129
|
const tooltipSurface = surface;
|
|
129
130
|
function handleToggle(event) {
|
|
131
|
+
if (nativeInterest) {
|
|
132
|
+
const next = event.newState === "open";
|
|
133
|
+
if (next !== tooltipSurface.matches(":popover-open") || next === visibleRef.current)
|
|
134
|
+
return;
|
|
135
|
+
onOpenChangeRef.current?.(next);
|
|
136
|
+
setInternalOpen(next);
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
130
139
|
if (event.newState !== "closed" || !visibleRef.current || isControlled || isControlled !== controlledRef.current || tooltipSurface.matches(":popover-open")) {
|
|
131
140
|
return;
|
|
132
141
|
}
|
|
@@ -138,7 +147,14 @@ var Tooltip = forwardRef(({
|
|
|
138
147
|
}
|
|
139
148
|
surface.addEventListener("toggle", handleToggle);
|
|
140
149
|
return () => surface.removeEventListener("toggle", handleToggle);
|
|
141
|
-
}, [hasTitle, isControlled]);
|
|
150
|
+
}, [hasTitle, isControlled, nativeInterest]);
|
|
151
|
+
useEffect(() => {
|
|
152
|
+
const surface = surfaceRef.current;
|
|
153
|
+
return () => {
|
|
154
|
+
if (surface?.matches(":popover-open"))
|
|
155
|
+
surface.hidePopover();
|
|
156
|
+
};
|
|
157
|
+
}, [hasTitle, isControlled, nativeInterest]);
|
|
142
158
|
useEffect(() => {
|
|
143
159
|
const surface = surfaceRef.current;
|
|
144
160
|
if (!surface)
|
|
@@ -188,21 +204,29 @@ var Tooltip = forwardRef(({
|
|
|
188
204
|
}
|
|
189
205
|
function showTooltip(event) {
|
|
190
206
|
onMouseEnter?.(event);
|
|
207
|
+
if (nativeInterest)
|
|
208
|
+
return;
|
|
191
209
|
hoveredRef.current = true;
|
|
192
210
|
updateInteraction();
|
|
193
211
|
}
|
|
194
212
|
function hideTooltip(event) {
|
|
195
213
|
onMouseLeave?.(event);
|
|
214
|
+
if (nativeInterest)
|
|
215
|
+
return;
|
|
196
216
|
hoveredRef.current = false;
|
|
197
217
|
updateInteraction();
|
|
198
218
|
}
|
|
199
219
|
function focusTooltip(event) {
|
|
200
220
|
onFocus?.(event);
|
|
221
|
+
if (nativeInterest)
|
|
222
|
+
return;
|
|
201
223
|
focusedRef.current = true;
|
|
202
224
|
updateInteraction();
|
|
203
225
|
}
|
|
204
226
|
function blurTooltip(event) {
|
|
205
227
|
onBlur?.(event);
|
|
228
|
+
if (nativeInterest)
|
|
229
|
+
return;
|
|
206
230
|
if (event.currentTarget.contains(event.relatedTarget))
|
|
207
231
|
return;
|
|
208
232
|
focusedRef.current = false;
|
|
@@ -211,6 +235,13 @@ var Tooltip = forwardRef(({
|
|
|
211
235
|
let trigger = children;
|
|
212
236
|
if (hasTitle && React.isValidElement(children) && children.type !== React.Fragment) {
|
|
213
237
|
trigger = React.cloneElement(children, {
|
|
238
|
+
...nativeInterest ? {
|
|
239
|
+
interestfor: tooltipId,
|
|
240
|
+
style: {
|
|
241
|
+
...children.props.style,
|
|
242
|
+
anchorName: anchor
|
|
243
|
+
}
|
|
244
|
+
} : {},
|
|
214
245
|
"aria-describedby": [children.props["aria-describedby"], tooltipId].filter(Boolean).join(" ")
|
|
215
246
|
});
|
|
216
247
|
}
|
|
@@ -218,7 +249,10 @@ var Tooltip = forwardRef(({
|
|
|
218
249
|
...props,
|
|
219
250
|
ref,
|
|
220
251
|
className: tooltipWrapperClass,
|
|
221
|
-
style: {
|
|
252
|
+
style: {
|
|
253
|
+
...style,
|
|
254
|
+
...nativeInterest ? {} : { anchorName: anchor }
|
|
255
|
+
},
|
|
222
256
|
"aria-describedby": hasTitle && trigger === children ? [props["aria-describedby"], tooltipId].filter(Boolean).join(" ") : props["aria-describedby"],
|
|
223
257
|
onMouseEnter: showTooltip,
|
|
224
258
|
onMouseLeave: hideTooltip,
|