@dataverse-kit/agent-kit 0.2.0 → 0.2.1
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 +106 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -5
- package/dist/index.d.ts +18 -5
- package/dist/index.mjs +113 -34
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1315,16 +1315,73 @@ var React11 = __toESM(require("react"), 1);
|
|
|
1315
1315
|
var import_react_components11 = require("@fluentui/react-components");
|
|
1316
1316
|
var import_react_icons4 = require("@fluentui/react-icons");
|
|
1317
1317
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1318
|
+
var MAX_ROWS = 6;
|
|
1318
1319
|
var useStyles10 = (0, import_react_components11.makeStyles)({
|
|
1319
|
-
|
|
1320
|
-
display: "flex",
|
|
1321
|
-
gap: import_react_components11.tokens.spacingHorizontalS,
|
|
1322
|
-
alignItems: "flex-end",
|
|
1320
|
+
wrapper: {
|
|
1323
1321
|
padding: import_react_components11.tokens.spacingVerticalS,
|
|
1324
1322
|
borderTop: `1px solid ${import_react_components11.tokens.colorNeutralStroke2}`
|
|
1325
1323
|
},
|
|
1326
|
-
|
|
1327
|
-
|
|
1324
|
+
// The Teams send box: ONE rounded container holding the field and the affordances.
|
|
1325
|
+
box: {
|
|
1326
|
+
display: "flex",
|
|
1327
|
+
alignItems: "flex-end",
|
|
1328
|
+
gap: import_react_components11.tokens.spacingHorizontalXXS,
|
|
1329
|
+
paddingLeft: import_react_components11.tokens.spacingHorizontalS,
|
|
1330
|
+
paddingRight: import_react_components11.tokens.spacingHorizontalXXS,
|
|
1331
|
+
paddingTop: import_react_components11.tokens.spacingVerticalXXS,
|
|
1332
|
+
paddingBottom: import_react_components11.tokens.spacingVerticalXXS,
|
|
1333
|
+
borderRadius: import_react_components11.tokens.borderRadiusXLarge,
|
|
1334
|
+
border: `1px solid ${import_react_components11.tokens.colorNeutralStroke1}`,
|
|
1335
|
+
backgroundColor: import_react_components11.tokens.colorNeutralBackground1,
|
|
1336
|
+
// ★ The ring moves to the CONTAINER because the field's own indicator is suppressed below.
|
|
1337
|
+
// It is an `outline`, not a box-shadow, so forced-colors still paints it (a11y rule 5).
|
|
1338
|
+
":focus-within": {
|
|
1339
|
+
border: `1px solid ${import_react_components11.tokens.colorCompoundBrandStroke}`,
|
|
1340
|
+
outline: `2px solid ${import_react_components11.tokens.colorCompoundBrandStroke}`,
|
|
1341
|
+
outlineOffset: "-1px"
|
|
1342
|
+
}
|
|
1343
|
+
},
|
|
1344
|
+
boxDisabled: {
|
|
1345
|
+
backgroundColor: import_react_components11.tokens.colorNeutralBackgroundDisabled,
|
|
1346
|
+
border: `1px solid ${import_react_components11.tokens.colorNeutralStrokeDisabled}`
|
|
1347
|
+
},
|
|
1348
|
+
// Fluent's Textarea has no transparent appearance, so its chrome is removed here and the
|
|
1349
|
+
// container above supplies it. `::after` is Fluent's focus underline.
|
|
1350
|
+
field: {
|
|
1351
|
+
flexGrow: 1,
|
|
1352
|
+
minWidth: 0,
|
|
1353
|
+
backgroundColor: "transparent",
|
|
1354
|
+
border: "none",
|
|
1355
|
+
borderRadius: 0,
|
|
1356
|
+
"::after": { display: "none" }
|
|
1357
|
+
},
|
|
1358
|
+
fieldInner: {
|
|
1359
|
+
backgroundColor: "transparent",
|
|
1360
|
+
// ★ Fluent's Textarea ships `min-height: 52px` (measured). The affordance buttons are 32px,
|
|
1361
|
+
// so the default left the placeholder on one line and the icons on another — the single
|
|
1362
|
+
// visible difference from the Teams reference. Matching the button height puts them on
|
|
1363
|
+
// one baseline; growth past one row is then driven by `rows`, up to maxHeight.
|
|
1364
|
+
minHeight: "32px",
|
|
1365
|
+
maxHeight: "160px",
|
|
1366
|
+
paddingLeft: 0,
|
|
1367
|
+
paddingRight: 0
|
|
1368
|
+
},
|
|
1369
|
+
actions: {
|
|
1370
|
+
display: "flex",
|
|
1371
|
+
alignItems: "center",
|
|
1372
|
+
gap: import_react_components11.tokens.spacingHorizontalXXS
|
|
1373
|
+
// ★ No extra bottom padding: `alignItems: flex-end` on the box already pins this row to the
|
|
1374
|
+
// field's last line, and padding on top of it pushed the send glyph visibly below the
|
|
1375
|
+
// baseline on a single-row box (measured against the Teams reference).
|
|
1376
|
+
},
|
|
1377
|
+
divider: {
|
|
1378
|
+
width: "1px",
|
|
1379
|
+
alignSelf: "center",
|
|
1380
|
+
height: "20px",
|
|
1381
|
+
marginLeft: import_react_components11.tokens.spacingHorizontalXXS,
|
|
1382
|
+
marginRight: import_react_components11.tokens.spacingHorizontalXXS,
|
|
1383
|
+
backgroundColor: import_react_components11.tokens.colorNeutralStroke2
|
|
1384
|
+
}
|
|
1328
1385
|
});
|
|
1329
1386
|
function Composer(props) {
|
|
1330
1387
|
const {
|
|
@@ -1340,6 +1397,7 @@ function Composer(props) {
|
|
|
1340
1397
|
toolbar
|
|
1341
1398
|
} = props;
|
|
1342
1399
|
const styles = useStyles10();
|
|
1400
|
+
const vh = useVisuallyHiddenStyles();
|
|
1343
1401
|
const hintId = React11.useId();
|
|
1344
1402
|
const submit = () => {
|
|
1345
1403
|
const text = value.trim();
|
|
@@ -1354,35 +1412,41 @@ function Composer(props) {
|
|
|
1354
1412
|
submit();
|
|
1355
1413
|
};
|
|
1356
1414
|
const hint = sendOn === "enter" ? "Press Enter to send, Shift plus Enter for a new line." : "Press Control or Command plus Enter to send.";
|
|
1357
|
-
|
|
1358
|
-
|
|
1415
|
+
const rows = Math.min(MAX_ROWS, Math.max(1, value.split("\n").length));
|
|
1416
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: styles.wrapper, children: [
|
|
1417
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: (0, import_react_components11.mergeClasses)(styles.box, disabled && styles.boxDisabled), children: [
|
|
1359
1418
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1360
1419
|
import_react_components11.Textarea,
|
|
1361
1420
|
{
|
|
1421
|
+
className: styles.field,
|
|
1362
1422
|
value,
|
|
1363
1423
|
onChange: (_, data) => onChange(data.value),
|
|
1364
1424
|
onKeyDown,
|
|
1365
1425
|
placeholder,
|
|
1366
1426
|
disabled,
|
|
1367
1427
|
maxLength,
|
|
1368
|
-
resize: "
|
|
1428
|
+
resize: "none",
|
|
1429
|
+
appearance: "outline",
|
|
1369
1430
|
"aria-label": placeholder,
|
|
1370
1431
|
"aria-describedby": hintId,
|
|
1371
|
-
textarea: { "aria-multiline": true }
|
|
1432
|
+
textarea: { "aria-multiline": true, rows, className: styles.fieldInner }
|
|
1372
1433
|
}
|
|
1373
1434
|
),
|
|
1374
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.
|
|
1435
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: styles.actions, children: [
|
|
1436
|
+
toolbar,
|
|
1437
|
+
toolbar ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: styles.divider, "aria-hidden": "true" }) : null,
|
|
1438
|
+
busy && onStop ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_components11.Tooltip, { content: "Stop generating", relationship: "label", withArrow: true, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_components11.Button, { appearance: "subtle", icon: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_icons4.StopRegular, {}), onClick: onStop }) }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_components11.Tooltip, { content: "Send", relationship: "label", withArrow: true, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1439
|
+
import_react_components11.Button,
|
|
1440
|
+
{
|
|
1441
|
+
appearance: "subtle",
|
|
1442
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_icons4.SendRegular, {}),
|
|
1443
|
+
onClick: submit,
|
|
1444
|
+
disabled: !value.trim() || busy || disabled
|
|
1445
|
+
}
|
|
1446
|
+
) })
|
|
1447
|
+
] })
|
|
1375
1448
|
] }),
|
|
1376
|
-
|
|
1377
|
-
busy && onStop ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_components11.Tooltip, { content: "Stop generating", relationship: "label", withArrow: true, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_components11.Button, { appearance: "secondary", icon: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_icons4.StopRegular, {}), onClick: onStop }) }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_components11.Tooltip, { content: "Send", relationship: "label", withArrow: true, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1378
|
-
import_react_components11.Button,
|
|
1379
|
-
{
|
|
1380
|
-
appearance: "primary",
|
|
1381
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_icons4.SendRegular, {}),
|
|
1382
|
-
onClick: submit,
|
|
1383
|
-
disabled: !value.trim() || busy || disabled
|
|
1384
|
-
}
|
|
1385
|
-
) })
|
|
1449
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { id: hintId, className: vh.root, children: hint })
|
|
1386
1450
|
] });
|
|
1387
1451
|
}
|
|
1388
1452
|
|
|
@@ -1391,19 +1455,34 @@ var import_react_components12 = require("@fluentui/react-components");
|
|
|
1391
1455
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1392
1456
|
var useStyles11 = (0, import_react_components12.makeStyles)({
|
|
1393
1457
|
root: { display: "flex", flexWrap: "wrap", gap: import_react_components12.tokens.spacingHorizontalXS, padding: import_react_components12.tokens.spacingVerticalXS },
|
|
1458
|
+
// ★ The heading is `width: 100%`, so it takes the PARENT's text-align while the chips take the
|
|
1459
|
+
// flex row's justification. That split is why the label could look centred while the chips
|
|
1460
|
+
// stayed left-packed — the two are aligned by different mechanisms and must both be set.
|
|
1461
|
+
center: { justifyContent: "center" },
|
|
1462
|
+
headingCenter: { textAlign: "center" },
|
|
1394
1463
|
heading: { width: "100%", fontSize: import_react_components12.tokens.fontSizeBase200, color: import_react_components12.tokens.colorNeutralForeground3 }
|
|
1395
1464
|
});
|
|
1396
1465
|
function SuggestedPrompts({
|
|
1397
1466
|
prompts,
|
|
1398
1467
|
onPick,
|
|
1399
|
-
heading = "Suggested follow-ups"
|
|
1468
|
+
heading = "Suggested follow-ups",
|
|
1469
|
+
align = "start"
|
|
1400
1470
|
}) {
|
|
1401
1471
|
const styles = useStyles11();
|
|
1402
1472
|
if (prompts.length === 0) return null;
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1473
|
+
const centered = align === "center";
|
|
1474
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1475
|
+
"div",
|
|
1476
|
+
{
|
|
1477
|
+
className: (0, import_react_components12.mergeClasses)(styles.root, centered && styles.center),
|
|
1478
|
+
role: "group",
|
|
1479
|
+
"aria-label": heading,
|
|
1480
|
+
children: [
|
|
1481
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: (0, import_react_components12.mergeClasses)(styles.heading, centered && styles.headingCenter), children: heading }),
|
|
1482
|
+
prompts.map((prompt) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_components12.Button, { size: "small", appearance: "outline", onClick: () => onPick(prompt), children: prompt }, prompt))
|
|
1483
|
+
]
|
|
1484
|
+
}
|
|
1485
|
+
);
|
|
1407
1486
|
}
|
|
1408
1487
|
|
|
1409
1488
|
// src/conversation/EmptyConversation.tsx
|
|
@@ -1432,7 +1511,7 @@ function EmptyConversation({
|
|
|
1432
1511
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: styles.root, children: [
|
|
1433
1512
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_components13.Text, { as: "h2", size: 500, weight: "semibold", children: title }),
|
|
1434
1513
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_components13.Text, { children: description }),
|
|
1435
|
-
onPick && prompts.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SuggestedPrompts, { prompts, onPick, heading: "Try one of these" }) : null
|
|
1514
|
+
onPick && prompts.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SuggestedPrompts, { prompts, onPick, heading: "Try one of these", align: "center" }) : null
|
|
1436
1515
|
] });
|
|
1437
1516
|
}
|
|
1438
1517
|
|