chatbotlite 0.5.0 → 0.5.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/embed.global.js +26 -24
- package/dist/embed.global.js.map +1 -1
- package/dist/react/index.cjs +266 -167
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +15 -0
- package/dist/react/index.d.ts +15 -0
- package/dist/react/index.js +266 -167
- package/dist/react/index.js.map +1 -1
- package/package.json +1 -1
package/dist/react/index.d.cts
CHANGED
|
@@ -74,6 +74,21 @@ interface ChatWidgetCommonProps {
|
|
|
74
74
|
};
|
|
75
75
|
/** LLM-triggered tool registry. Bot emits `[SKILL:name args]` → widget renders matching card. */
|
|
76
76
|
tools?: ChatWidgetTools;
|
|
77
|
+
/**
|
|
78
|
+
* Header avatar. Defaults to NONE (no avatar, just title) — most website chatbots don't
|
|
79
|
+
* need one.
|
|
80
|
+
* - `true` → circular badge with first letter of `title` on brand color
|
|
81
|
+
* - `"https://..."` → image URL (rendered in 32px circle)
|
|
82
|
+
* - omit / `false` → no avatar (default)
|
|
83
|
+
*/
|
|
84
|
+
avatar?: boolean | string;
|
|
85
|
+
/**
|
|
86
|
+
* Launcher button icon. Customer override for the floating button glyph.
|
|
87
|
+
* - omit → default chat-bubble SVG
|
|
88
|
+
* - emoji string (e.g. "⚡", "💬", "🤖")
|
|
89
|
+
* - URL → rendered as image
|
|
90
|
+
*/
|
|
91
|
+
launcherIcon?: string;
|
|
77
92
|
}
|
|
78
93
|
interface ChatWidgetDirectProps extends ChatWidgetCommonProps {
|
|
79
94
|
/** Markdown knowledge for the bot. Client-side mode — API keys WILL be exposed. */
|
package/dist/react/index.d.ts
CHANGED
|
@@ -74,6 +74,21 @@ interface ChatWidgetCommonProps {
|
|
|
74
74
|
};
|
|
75
75
|
/** LLM-triggered tool registry. Bot emits `[SKILL:name args]` → widget renders matching card. */
|
|
76
76
|
tools?: ChatWidgetTools;
|
|
77
|
+
/**
|
|
78
|
+
* Header avatar. Defaults to NONE (no avatar, just title) — most website chatbots don't
|
|
79
|
+
* need one.
|
|
80
|
+
* - `true` → circular badge with first letter of `title` on brand color
|
|
81
|
+
* - `"https://..."` → image URL (rendered in 32px circle)
|
|
82
|
+
* - omit / `false` → no avatar (default)
|
|
83
|
+
*/
|
|
84
|
+
avatar?: boolean | string;
|
|
85
|
+
/**
|
|
86
|
+
* Launcher button icon. Customer override for the floating button glyph.
|
|
87
|
+
* - omit → default chat-bubble SVG
|
|
88
|
+
* - emoji string (e.g. "⚡", "💬", "🤖")
|
|
89
|
+
* - URL → rendered as image
|
|
90
|
+
*/
|
|
91
|
+
launcherIcon?: string;
|
|
77
92
|
}
|
|
78
93
|
interface ChatWidgetDirectProps extends ChatWidgetCommonProps {
|
|
79
94
|
/** Markdown knowledge for the bot. Client-side mode — API keys WILL be exposed. */
|
package/dist/react/index.js
CHANGED
|
@@ -1012,35 +1012,50 @@ function RequestPayment(props) {
|
|
|
1012
1012
|
var BOLT = "\u26A1";
|
|
1013
1013
|
var DEFAULT_PRIMARY = "#0f172a";
|
|
1014
1014
|
var DEFAULT_ON_PRIMARY = "#ffffff";
|
|
1015
|
+
function luminance(hex) {
|
|
1016
|
+
const m = hex.replace("#", "");
|
|
1017
|
+
const norm = m.length === 3 ? m.split("").map((c) => c + c).join("") : m;
|
|
1018
|
+
if (norm.length !== 6) return 0;
|
|
1019
|
+
const r = parseInt(norm.slice(0, 2), 16) / 255;
|
|
1020
|
+
const g = parseInt(norm.slice(2, 4), 16) / 255;
|
|
1021
|
+
const b = parseInt(norm.slice(4, 6), 16) / 255;
|
|
1022
|
+
const toLinear = (c) => c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
|
|
1023
|
+
return 0.2126 * toLinear(r) + 0.7152 * toLinear(g) + 0.0722 * toLinear(b);
|
|
1024
|
+
}
|
|
1015
1025
|
var SURFACE = "#ffffff";
|
|
1016
|
-
var
|
|
1026
|
+
var CHAT_BG = "#f5f1eb";
|
|
1027
|
+
var BUBBLE_BOT = "#ffffff";
|
|
1028
|
+
var INPUT_BG = "#f1f3f5";
|
|
1017
1029
|
var BORDER = "#e5e7eb";
|
|
1030
|
+
var BORDER_LIGHT = "rgba(15,23,42,0.06)";
|
|
1018
1031
|
var TEXT_BODY = "#0f172a";
|
|
1019
1032
|
var TEXT_MUTED = "#64748b";
|
|
1020
1033
|
var TEXT_FAINT = "#94a3b8";
|
|
1021
|
-
var FONT_STACK =
|
|
1034
|
+
var FONT_STACK = `-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif`;
|
|
1022
1035
|
var STYLE_TAG_ID = "chatbotlite-widget-styles";
|
|
1023
1036
|
var KEYFRAMES = `
|
|
1024
1037
|
@keyframes chatbotlite-pop { 0% { opacity: 0; transform: scale(0.6); } 100% { opacity: 1; transform: scale(1); } }
|
|
1025
1038
|
@keyframes chatbotlite-slide { 0% { opacity: 0; transform: translateY(16px) scale(0.98); } 100% { opacity: 1; transform: translateY(0) scale(1); } }
|
|
1026
1039
|
@keyframes chatbotlite-fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
|
|
1027
1040
|
@keyframes chatbotlite-dot { 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-4px); opacity: 1; } }
|
|
1028
|
-
@keyframes chatbotlite-cursor { 0%, 50% { opacity: 1; } 51%, 100% { opacity: 0; } }
|
|
1041
|
+
@keyframes chatbotlite-cursor { 0%, 50% { opacity: 1; } 51%, 100% { opacity: 0.2; } }
|
|
1029
1042
|
@keyframes chatbotlite-pulse { 0%, 100% { box-shadow: 0 12px 28px -8px rgba(15,23,42,0.32), 0 4px 8px -2px rgba(15,23,42,0.12); } 50% { box-shadow: 0 14px 32px -8px rgba(15,23,42,0.36), 0 6px 12px -2px rgba(15,23,42,0.16); } }
|
|
1030
1043
|
.chatbotlite-launcher { transition: transform 180ms cubic-bezier(0.4, 0, 0.2, 1), box-shadow 180ms cubic-bezier(0.4, 0, 0.2, 1); animation: chatbotlite-pop 320ms cubic-bezier(0.34, 1.56, 0.64, 1), chatbotlite-pulse 3.6s ease-in-out 1.2s 2; }
|
|
1031
1044
|
.chatbotlite-launcher:hover { transform: translateY(-2px) scale(1.04); }
|
|
1032
1045
|
.chatbotlite-launcher:active { transform: translateY(0) scale(0.98); }
|
|
1033
|
-
.chatbotlite-close { transition: background 120ms ease; }
|
|
1034
|
-
.chatbotlite-close:hover { background: rgba(
|
|
1046
|
+
.chatbotlite-close { transition: background 120ms ease, color 120ms ease; }
|
|
1047
|
+
.chatbotlite-close:hover { background: rgba(15,23,42,0.06); color: ${TEXT_BODY}; }
|
|
1035
1048
|
.chatbotlite-send { transition: transform 120ms ease, opacity 120ms ease, box-shadow 120ms ease; }
|
|
1036
1049
|
.chatbotlite-send:not(:disabled):hover { transform: translateY(-1px); }
|
|
1037
1050
|
.chatbotlite-send:not(:disabled):active { transform: translateY(0); }
|
|
1038
|
-
.chatbotlite-input:focus { box-shadow:
|
|
1051
|
+
.chatbotlite-input:focus { box-shadow: none; outline: none; }
|
|
1052
|
+
.chatbotlite-composer { transition: background 120ms ease, box-shadow 120ms ease; }
|
|
1053
|
+
.chatbotlite-composer:focus-within { background: ${SURFACE}; box-shadow: 0 0 0 1px ${BORDER}, 0 1px 2px rgba(15,23,42,0.04); }
|
|
1039
1054
|
.chatbotlite-msg { animation: chatbotlite-fade-in 220ms cubic-bezier(0.4, 0, 0.2, 1); }
|
|
1040
1055
|
.chatbotlite-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: ${TEXT_FAINT}; margin-right: 4px; animation: chatbotlite-dot 1.2s ease-in-out infinite; }
|
|
1041
|
-
.chatbotlite-cursor { display: inline-block; width:
|
|
1042
|
-
.chatbotlite-
|
|
1043
|
-
.chatbotlite-
|
|
1056
|
+
.chatbotlite-cursor { display: inline-block; width: 0.5ch; vertical-align: text-bottom; margin-left: 1px; font-size: inherit; line-height: inherit; animation: chatbotlite-cursor 1s ease-in-out infinite; }
|
|
1057
|
+
.chatbotlite-icon-btn:hover:not(:disabled) { background: rgba(15,23,42,0.06) !important; opacity: 1 !important; }
|
|
1058
|
+
.chatbotlite-icon-btn:active:not(:disabled) { transform: scale(0.92); }
|
|
1044
1059
|
.chatbotlite-dot:nth-child(2) { animation-delay: 0.15s; }
|
|
1045
1060
|
.chatbotlite-dot:nth-child(3) { animation-delay: 0.3s; margin-right: 0; }
|
|
1046
1061
|
.chatbotlite-brand:hover { color: ${TEXT_MUTED} !important; }
|
|
@@ -1066,7 +1081,8 @@ function ChatWidget(props) {
|
|
|
1066
1081
|
const resolvedTitle = title ?? "Chat";
|
|
1067
1082
|
const resolvedGreeting = greeting ?? "Hi! How can we help?";
|
|
1068
1083
|
const primary = themeOverrides?.primary ?? DEFAULT_PRIMARY;
|
|
1069
|
-
const
|
|
1084
|
+
const primaryIsLight = luminance(primary) > 0.65;
|
|
1085
|
+
const onPrimary = themeOverrides?.onPrimary ?? (primaryIsLight ? "#0f172a" : DEFAULT_ON_PRIMARY);
|
|
1070
1086
|
const attachCfg = props.attach;
|
|
1071
1087
|
const attachEnabled = attachCfg?.enabled === true;
|
|
1072
1088
|
const acceptAttr = attachCfg?.accept?.join(",");
|
|
@@ -1327,7 +1343,12 @@ function ChatWidget(props) {
|
|
|
1327
1343
|
alignItems: "center",
|
|
1328
1344
|
justifyContent: "center"
|
|
1329
1345
|
},
|
|
1330
|
-
children: /* @__PURE__ */ jsx("span", { style: { filter: "drop-shadow(0 1px 2px rgba(0,0,0,0.2))" }, children:
|
|
1346
|
+
children: props.launcherIcon ? props.launcherIcon.startsWith("http") || props.launcherIcon.startsWith("/") ? /* @__PURE__ */ jsx("img", { src: props.launcherIcon, alt: "", style: { width: 28, height: 28, objectFit: "contain" } }) : /* @__PURE__ */ jsx("span", { style: { filter: "drop-shadow(0 1px 2px rgba(0,0,0,0.2))" }, children: props.launcherIcon }) : /* @__PURE__ */ jsxs("svg", { width: "26", height: "26", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
1347
|
+
/* @__PURE__ */ jsx("path", { d: "M21 12a8 8 0 0 1-13.6 5.8L3 19l1.2-4.4A8 8 0 1 1 21 12z" }),
|
|
1348
|
+
/* @__PURE__ */ jsx("circle", { cx: "9", cy: "12", r: "1", fill: "currentColor", stroke: "none" }),
|
|
1349
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "1", fill: "currentColor", stroke: "none" }),
|
|
1350
|
+
/* @__PURE__ */ jsx("circle", { cx: "15", cy: "12", r: "1", fill: "currentColor", stroke: "none" })
|
|
1351
|
+
] })
|
|
1331
1352
|
}
|
|
1332
1353
|
),
|
|
1333
1354
|
open && /* @__PURE__ */ jsxs(
|
|
@@ -1356,17 +1377,49 @@ function ChatWidget(props) {
|
|
|
1356
1377
|
},
|
|
1357
1378
|
children: [
|
|
1358
1379
|
/* @__PURE__ */ jsxs("header", { style: {
|
|
1359
|
-
padding: "16px
|
|
1360
|
-
background:
|
|
1361
|
-
color:
|
|
1380
|
+
padding: "14px 16px",
|
|
1381
|
+
background: SURFACE,
|
|
1382
|
+
color: TEXT_BODY,
|
|
1362
1383
|
display: "flex",
|
|
1363
1384
|
justifyContent: "space-between",
|
|
1364
1385
|
alignItems: "center",
|
|
1365
|
-
gap: 12
|
|
1386
|
+
gap: 12,
|
|
1387
|
+
borderBottom: `1px solid ${BORDER_LIGHT}`
|
|
1366
1388
|
}, children: [
|
|
1367
|
-
/* @__PURE__ */ jsxs("div", { style: { display: "flex",
|
|
1368
|
-
/* @__PURE__ */ jsx("
|
|
1369
|
-
|
|
1389
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: props.avatar ? 10 : 0, minWidth: 0 }, children: [
|
|
1390
|
+
props.avatar === true && /* @__PURE__ */ jsx("div", { style: {
|
|
1391
|
+
width: 32,
|
|
1392
|
+
height: 32,
|
|
1393
|
+
borderRadius: "50%",
|
|
1394
|
+
background: primary,
|
|
1395
|
+
color: onPrimary,
|
|
1396
|
+
display: "flex",
|
|
1397
|
+
alignItems: "center",
|
|
1398
|
+
justifyContent: "center",
|
|
1399
|
+
fontSize: 14,
|
|
1400
|
+
fontWeight: 600,
|
|
1401
|
+
flexShrink: 0,
|
|
1402
|
+
letterSpacing: "-0.02em"
|
|
1403
|
+
}, children: resolvedTitle.charAt(0).toUpperCase() }),
|
|
1404
|
+
typeof props.avatar === "string" && /* @__PURE__ */ jsx(
|
|
1405
|
+
"img",
|
|
1406
|
+
{
|
|
1407
|
+
src: props.avatar,
|
|
1408
|
+
alt: "",
|
|
1409
|
+
style: {
|
|
1410
|
+
width: 32,
|
|
1411
|
+
height: 32,
|
|
1412
|
+
borderRadius: "50%",
|
|
1413
|
+
objectFit: "cover",
|
|
1414
|
+
flexShrink: 0,
|
|
1415
|
+
border: `1px solid ${BORDER}`
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
1418
|
+
),
|
|
1419
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", lineHeight: 1.2, minWidth: 0 }, children: [
|
|
1420
|
+
/* @__PURE__ */ jsx("span", { style: { fontWeight: 600, fontSize: 15, letterSpacing: "-0.01em", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", color: TEXT_BODY }, children: resolvedTitle }),
|
|
1421
|
+
(subtitle || sending) && /* @__PURE__ */ jsx("span", { style: { fontSize: 12, color: TEXT_MUTED, marginTop: 2, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: subtitle ?? (sending ? "typing\u2026" : "") })
|
|
1422
|
+
] })
|
|
1370
1423
|
] }),
|
|
1371
1424
|
/* @__PURE__ */ jsx(
|
|
1372
1425
|
"button",
|
|
@@ -1377,7 +1430,7 @@ function ChatWidget(props) {
|
|
|
1377
1430
|
style: {
|
|
1378
1431
|
background: "transparent",
|
|
1379
1432
|
border: "none",
|
|
1380
|
-
color:
|
|
1433
|
+
color: TEXT_MUTED,
|
|
1381
1434
|
width: 32,
|
|
1382
1435
|
height: 32,
|
|
1383
1436
|
borderRadius: 10,
|
|
@@ -1404,7 +1457,7 @@ function ChatWidget(props) {
|
|
|
1404
1457
|
display: "flex",
|
|
1405
1458
|
flexDirection: "column",
|
|
1406
1459
|
gap: 8,
|
|
1407
|
-
background:
|
|
1460
|
+
background: CHAT_BG
|
|
1408
1461
|
},
|
|
1409
1462
|
children: [
|
|
1410
1463
|
messages.map((m) => /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 6, alignItems: m.role === "user" ? "flex-end" : "stretch" }, children: [
|
|
@@ -1417,7 +1470,7 @@ function ChatWidget(props) {
|
|
|
1417
1470
|
maxWidth: "82%",
|
|
1418
1471
|
padding: "9px 13px",
|
|
1419
1472
|
borderRadius: m.role === "user" ? "18px 18px 4px 18px" : "18px 18px 18px 4px",
|
|
1420
|
-
background: m.role === "user" ? primary :
|
|
1473
|
+
background: m.role === "user" ? primary : BUBBLE_BOT,
|
|
1421
1474
|
color: m.role === "user" ? onPrimary : TEXT_BODY,
|
|
1422
1475
|
border: m.role === "user" ? "none" : `1px solid ${BORDER}`,
|
|
1423
1476
|
fontSize: 14,
|
|
@@ -1429,7 +1482,15 @@ function ChatWidget(props) {
|
|
|
1429
1482
|
},
|
|
1430
1483
|
children: [
|
|
1431
1484
|
m.content,
|
|
1432
|
-
sending && m.role === "assistant" && m === messages[messages.length - 1] && /* @__PURE__ */ jsx(
|
|
1485
|
+
sending && m.role === "assistant" && m === messages[messages.length - 1] && /* @__PURE__ */ jsx(
|
|
1486
|
+
"span",
|
|
1487
|
+
{
|
|
1488
|
+
className: "chatbotlite-cursor",
|
|
1489
|
+
style: { color: primary },
|
|
1490
|
+
"aria-hidden": "true",
|
|
1491
|
+
children: "\u258D"
|
|
1492
|
+
}
|
|
1493
|
+
)
|
|
1433
1494
|
]
|
|
1434
1495
|
}
|
|
1435
1496
|
),
|
|
@@ -1440,7 +1501,7 @@ function ChatWidget(props) {
|
|
|
1440
1501
|
onPrimary,
|
|
1441
1502
|
border: BORDER,
|
|
1442
1503
|
surface: SURFACE,
|
|
1443
|
-
surfaceMuted:
|
|
1504
|
+
surfaceMuted: CHAT_BG,
|
|
1444
1505
|
textBody: TEXT_BODY,
|
|
1445
1506
|
textMuted: TEXT_MUTED
|
|
1446
1507
|
};
|
|
@@ -1523,7 +1584,7 @@ function ChatWidget(props) {
|
|
|
1523
1584
|
return null;
|
|
1524
1585
|
})
|
|
1525
1586
|
] }, m.id)),
|
|
1526
|
-
sending && /* @__PURE__ */ jsxs(
|
|
1587
|
+
sending && messages[messages.length - 1]?.content === "" && /* @__PURE__ */ jsxs(
|
|
1527
1588
|
"div",
|
|
1528
1589
|
{
|
|
1529
1590
|
className: "chatbotlite-msg",
|
|
@@ -1531,7 +1592,7 @@ function ChatWidget(props) {
|
|
|
1531
1592
|
alignSelf: "flex-start",
|
|
1532
1593
|
padding: "12px 14px",
|
|
1533
1594
|
borderRadius: "18px 18px 18px 4px",
|
|
1534
|
-
background:
|
|
1595
|
+
background: BUBBLE_BOT,
|
|
1535
1596
|
border: `1px solid ${BORDER}`,
|
|
1536
1597
|
boxShadow: "0 1px 2px rgba(15,23,42,0.04)"
|
|
1537
1598
|
},
|
|
@@ -1545,172 +1606,210 @@ function ChatWidget(props) {
|
|
|
1545
1606
|
]
|
|
1546
1607
|
}
|
|
1547
1608
|
),
|
|
1548
|
-
/* @__PURE__ */
|
|
1549
|
-
|
|
1550
|
-
flexDirection: "column",
|
|
1551
|
-
padding: 12,
|
|
1552
|
-
gap: 8,
|
|
1609
|
+
files.length > 0 && /* @__PURE__ */ jsx("div", { style: {
|
|
1610
|
+
padding: "8px 12px 0",
|
|
1553
1611
|
background: SURFACE,
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1612
|
+
display: "flex",
|
|
1613
|
+
flexWrap: "wrap",
|
|
1614
|
+
gap: 6
|
|
1615
|
+
}, children: files.map((f, i) => /* @__PURE__ */ jsxs(
|
|
1616
|
+
"span",
|
|
1617
|
+
{
|
|
1618
|
+
style: {
|
|
1619
|
+
display: "inline-flex",
|
|
1620
|
+
alignItems: "center",
|
|
1621
|
+
gap: 6,
|
|
1622
|
+
padding: "4px 8px 4px 10px",
|
|
1623
|
+
borderRadius: 999,
|
|
1624
|
+
background: INPUT_BG,
|
|
1625
|
+
fontSize: 12,
|
|
1626
|
+
color: TEXT_BODY,
|
|
1627
|
+
maxWidth: 200
|
|
1628
|
+
},
|
|
1629
|
+
children: [
|
|
1630
|
+
/* @__PURE__ */ jsxs("span", { style: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: [
|
|
1631
|
+
"\u{1F4CE} ",
|
|
1632
|
+
f.name
|
|
1633
|
+
] }),
|
|
1634
|
+
/* @__PURE__ */ jsx(
|
|
1635
|
+
"button",
|
|
1636
|
+
{
|
|
1637
|
+
onClick: () => removeFile(i),
|
|
1638
|
+
"aria-label": `Remove ${f.name}`,
|
|
1639
|
+
style: { background: "transparent", border: "none", cursor: "pointer", color: TEXT_MUTED, fontSize: 14, lineHeight: 1, padding: 0 },
|
|
1640
|
+
children: "\xD7"
|
|
1641
|
+
}
|
|
1642
|
+
)
|
|
1643
|
+
]
|
|
1644
|
+
},
|
|
1645
|
+
`${f.name}-${i}`
|
|
1646
|
+
)) }),
|
|
1647
|
+
/* @__PURE__ */ jsx("div", { style: {
|
|
1648
|
+
padding: "10px 12px 12px",
|
|
1649
|
+
background: SURFACE
|
|
1650
|
+
}, children: /* @__PURE__ */ jsxs(
|
|
1651
|
+
"div",
|
|
1652
|
+
{
|
|
1653
|
+
className: "chatbotlite-composer",
|
|
1654
|
+
style: {
|
|
1655
|
+
display: "flex",
|
|
1656
|
+
alignItems: "center",
|
|
1657
|
+
gap: 4,
|
|
1658
|
+
padding: "4px 4px 4px 8px",
|
|
1659
|
+
background: INPUT_BG,
|
|
1660
|
+
borderRadius: 999
|
|
1661
|
+
},
|
|
1662
|
+
children: [
|
|
1663
|
+
attachEnabled && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1664
|
+
/* @__PURE__ */ jsx(
|
|
1665
|
+
"input",
|
|
1666
|
+
{
|
|
1667
|
+
ref: fileInputRef,
|
|
1668
|
+
type: "file",
|
|
1669
|
+
multiple: true,
|
|
1670
|
+
accept: acceptAttr,
|
|
1671
|
+
style: { display: "none" },
|
|
1672
|
+
onChange: (e) => {
|
|
1673
|
+
if (e.target.files) addFiles(e.target.files);
|
|
1674
|
+
e.target.value = "";
|
|
1675
|
+
}
|
|
1676
|
+
}
|
|
1677
|
+
),
|
|
1576
1678
|
/* @__PURE__ */ jsx(
|
|
1577
1679
|
"button",
|
|
1578
1680
|
{
|
|
1579
|
-
|
|
1580
|
-
|
|
1681
|
+
className: "chatbotlite-icon-btn",
|
|
1682
|
+
onClick: () => fileInputRef.current?.click(),
|
|
1683
|
+
disabled: sending || files.length >= maxFiles,
|
|
1684
|
+
"aria-label": "Attach file",
|
|
1581
1685
|
style: {
|
|
1686
|
+
width: 32,
|
|
1687
|
+
height: 32,
|
|
1688
|
+
borderRadius: "50%",
|
|
1582
1689
|
background: "transparent",
|
|
1583
1690
|
border: "none",
|
|
1584
|
-
cursor: "pointer",
|
|
1585
|
-
|
|
1586
|
-
fontSize:
|
|
1691
|
+
cursor: sending || files.length >= maxFiles ? "default" : "pointer",
|
|
1692
|
+
opacity: sending || files.length >= maxFiles ? 0.35 : 0.7,
|
|
1693
|
+
fontSize: 18,
|
|
1587
1694
|
lineHeight: 1,
|
|
1588
|
-
padding: 0
|
|
1695
|
+
padding: 0,
|
|
1696
|
+
display: "flex",
|
|
1697
|
+
alignItems: "center",
|
|
1698
|
+
justifyContent: "center",
|
|
1699
|
+
flexShrink: 0,
|
|
1700
|
+
alignSelf: "center",
|
|
1701
|
+
transition: "opacity 120ms ease, background 120ms ease"
|
|
1589
1702
|
},
|
|
1590
|
-
children: "\
|
|
1703
|
+
children: "\u{1F4CE}"
|
|
1591
1704
|
}
|
|
1592
1705
|
)
|
|
1593
|
-
]
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1706
|
+
] }),
|
|
1707
|
+
voiceEnabled && speechSupported && /* @__PURE__ */ jsx(
|
|
1708
|
+
"button",
|
|
1709
|
+
{
|
|
1710
|
+
className: "chatbotlite-icon-btn",
|
|
1711
|
+
onClick: toggleVoice,
|
|
1712
|
+
disabled: sending,
|
|
1713
|
+
"aria-label": voiceListening ? "Stop recording" : "Start voice input",
|
|
1714
|
+
style: {
|
|
1715
|
+
width: 32,
|
|
1716
|
+
height: 32,
|
|
1717
|
+
borderRadius: "50%",
|
|
1718
|
+
background: voiceListening ? primary : "transparent",
|
|
1719
|
+
color: voiceListening ? onPrimary : "inherit",
|
|
1720
|
+
border: "none",
|
|
1721
|
+
cursor: sending ? "default" : "pointer",
|
|
1722
|
+
opacity: sending ? 0.35 : voiceListening ? 1 : 0.7,
|
|
1723
|
+
fontSize: 16,
|
|
1724
|
+
lineHeight: 1,
|
|
1725
|
+
padding: 0,
|
|
1726
|
+
display: "flex",
|
|
1727
|
+
alignItems: "center",
|
|
1728
|
+
justifyContent: "center",
|
|
1729
|
+
flexShrink: 0,
|
|
1730
|
+
alignSelf: "center",
|
|
1731
|
+
transition: "opacity 120ms ease, background 120ms ease, color 120ms ease"
|
|
1732
|
+
},
|
|
1733
|
+
children: "\u{1F399}\uFE0F"
|
|
1734
|
+
}
|
|
1735
|
+
),
|
|
1599
1736
|
/* @__PURE__ */ jsx(
|
|
1600
|
-
"
|
|
1737
|
+
"textarea",
|
|
1601
1738
|
{
|
|
1602
|
-
ref:
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
style: { display: "none" },
|
|
1739
|
+
ref: inputRef,
|
|
1740
|
+
className: "chatbotlite-input",
|
|
1741
|
+
rows: 1,
|
|
1742
|
+
value: input,
|
|
1607
1743
|
onChange: (e) => {
|
|
1608
|
-
|
|
1609
|
-
|
|
1744
|
+
setInput(e.target.value);
|
|
1745
|
+
const el = e.currentTarget;
|
|
1746
|
+
el.style.height = "20px";
|
|
1747
|
+
if (el.scrollHeight > 28) {
|
|
1748
|
+
el.style.height = Math.min(el.scrollHeight, 100) + "px";
|
|
1749
|
+
}
|
|
1750
|
+
},
|
|
1751
|
+
onKeyDown: (e) => {
|
|
1752
|
+
if (e.key === "Enter" && !e.shiftKey) {
|
|
1753
|
+
e.preventDefault();
|
|
1754
|
+
void send();
|
|
1755
|
+
}
|
|
1756
|
+
},
|
|
1757
|
+
placeholder: "Message",
|
|
1758
|
+
disabled: sending,
|
|
1759
|
+
style: {
|
|
1760
|
+
flex: 1,
|
|
1761
|
+
padding: "4px 6px",
|
|
1762
|
+
margin: 0,
|
|
1763
|
+
border: "none",
|
|
1764
|
+
background: "transparent",
|
|
1765
|
+
fontSize: 14,
|
|
1766
|
+
fontFamily: FONT_STACK,
|
|
1767
|
+
color: TEXT_BODY,
|
|
1768
|
+
outline: "none",
|
|
1769
|
+
resize: "none",
|
|
1770
|
+
lineHeight: 1.4,
|
|
1771
|
+
height: 20,
|
|
1772
|
+
maxHeight: 100,
|
|
1773
|
+
boxSizing: "content-box",
|
|
1774
|
+
overflow: "hidden"
|
|
1610
1775
|
}
|
|
1611
1776
|
}
|
|
1612
1777
|
),
|
|
1613
1778
|
/* @__PURE__ */ jsx(
|
|
1614
1779
|
"button",
|
|
1615
1780
|
{
|
|
1616
|
-
className: "chatbotlite-
|
|
1617
|
-
onClick: () =>
|
|
1618
|
-
disabled: sending || files.length
|
|
1619
|
-
"aria-label": "
|
|
1781
|
+
className: "chatbotlite-send",
|
|
1782
|
+
onClick: () => void send(),
|
|
1783
|
+
disabled: sending || !input.trim() && files.length === 0,
|
|
1784
|
+
"aria-label": "Send message",
|
|
1620
1785
|
style: {
|
|
1621
|
-
width:
|
|
1622
|
-
height:
|
|
1623
|
-
borderRadius:
|
|
1624
|
-
background:
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1786
|
+
width: 34,
|
|
1787
|
+
height: 34,
|
|
1788
|
+
borderRadius: "50%",
|
|
1789
|
+
background: primary,
|
|
1790
|
+
color: onPrimary,
|
|
1791
|
+
border: "none",
|
|
1792
|
+
fontSize: 14,
|
|
1793
|
+
fontWeight: 600,
|
|
1794
|
+
fontFamily: FONT_STACK,
|
|
1795
|
+
cursor: sending || !input.trim() && files.length === 0 ? "default" : "pointer",
|
|
1796
|
+
opacity: sending || !input.trim() && files.length === 0 ? 0.35 : 1,
|
|
1797
|
+
display: "flex",
|
|
1798
|
+
alignItems: "center",
|
|
1799
|
+
justifyContent: "center",
|
|
1800
|
+
flexShrink: 0,
|
|
1801
|
+
padding: 0,
|
|
1802
|
+
transition: "opacity 120ms ease, transform 80ms ease"
|
|
1630
1803
|
},
|
|
1631
|
-
children: "
|
|
1804
|
+
children: /* @__PURE__ */ jsxs("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1805
|
+
/* @__PURE__ */ jsx("line", { x1: "12", y1: "19", x2: "12", y2: "5" }),
|
|
1806
|
+
/* @__PURE__ */ jsx("polyline", { points: "5 12 12 5 19 12" })
|
|
1807
|
+
] })
|
|
1632
1808
|
}
|
|
1633
1809
|
)
|
|
1634
|
-
]
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
{
|
|
1638
|
-
className: "chatbotlite-voice-btn",
|
|
1639
|
-
onClick: toggleVoice,
|
|
1640
|
-
disabled: sending,
|
|
1641
|
-
"aria-label": voiceListening ? "Stop recording" : "Start voice input",
|
|
1642
|
-
style: {
|
|
1643
|
-
width: 40,
|
|
1644
|
-
height: 40,
|
|
1645
|
-
borderRadius: 10,
|
|
1646
|
-
background: voiceListening ? primary : SURFACE_MUTED,
|
|
1647
|
-
color: voiceListening ? onPrimary : TEXT_BODY,
|
|
1648
|
-
border: `1px solid ${voiceListening ? primary : BORDER}`,
|
|
1649
|
-
cursor: sending ? "default" : "pointer",
|
|
1650
|
-
opacity: sending ? 0.4 : 1,
|
|
1651
|
-
fontSize: 16,
|
|
1652
|
-
transition: "background 120ms ease, color 120ms ease, border-color 120ms ease, transform 80ms ease"
|
|
1653
|
-
},
|
|
1654
|
-
children: "\u{1F399}\uFE0F"
|
|
1655
|
-
}
|
|
1656
|
-
),
|
|
1657
|
-
/* @__PURE__ */ jsx(
|
|
1658
|
-
"input",
|
|
1659
|
-
{
|
|
1660
|
-
ref: inputRef,
|
|
1661
|
-
className: "chatbotlite-input",
|
|
1662
|
-
type: "text",
|
|
1663
|
-
value: input,
|
|
1664
|
-
onChange: (e) => setInput(e.target.value),
|
|
1665
|
-
onKeyDown: (e) => {
|
|
1666
|
-
if (e.key === "Enter" && !e.shiftKey) {
|
|
1667
|
-
e.preventDefault();
|
|
1668
|
-
void send();
|
|
1669
|
-
}
|
|
1670
|
-
},
|
|
1671
|
-
placeholder: "Type a message\u2026",
|
|
1672
|
-
disabled: sending,
|
|
1673
|
-
style: {
|
|
1674
|
-
flex: 1,
|
|
1675
|
-
padding: "10px 14px",
|
|
1676
|
-
borderRadius: 12,
|
|
1677
|
-
border: `1px solid ${BORDER}`,
|
|
1678
|
-
background: SURFACE_MUTED,
|
|
1679
|
-
fontSize: 14,
|
|
1680
|
-
fontFamily: FONT_STACK,
|
|
1681
|
-
color: TEXT_BODY,
|
|
1682
|
-
outline: "none",
|
|
1683
|
-
transition: "box-shadow 120ms ease, border-color 120ms ease"
|
|
1684
|
-
}
|
|
1685
|
-
}
|
|
1686
|
-
),
|
|
1687
|
-
/* @__PURE__ */ jsx(
|
|
1688
|
-
"button",
|
|
1689
|
-
{
|
|
1690
|
-
className: "chatbotlite-send",
|
|
1691
|
-
onClick: () => void send(),
|
|
1692
|
-
disabled: sending || !input.trim() && files.length === 0,
|
|
1693
|
-
"aria-label": "Send message",
|
|
1694
|
-
style: {
|
|
1695
|
-
padding: "0 16px",
|
|
1696
|
-
height: 40,
|
|
1697
|
-
minWidth: 64,
|
|
1698
|
-
borderRadius: 12,
|
|
1699
|
-
background: primary,
|
|
1700
|
-
color: onPrimary,
|
|
1701
|
-
border: "none",
|
|
1702
|
-
fontSize: 14,
|
|
1703
|
-
fontWeight: 600,
|
|
1704
|
-
fontFamily: FONT_STACK,
|
|
1705
|
-
cursor: sending || !input.trim() && files.length === 0 ? "default" : "pointer",
|
|
1706
|
-
opacity: sending || !input.trim() && files.length === 0 ? 0.4 : 1,
|
|
1707
|
-
boxShadow: "0 2px 6px -1px rgba(15,23,42,0.18)"
|
|
1708
|
-
},
|
|
1709
|
-
children: "Send"
|
|
1710
|
-
}
|
|
1711
|
-
)
|
|
1712
|
-
] })
|
|
1713
|
-
] }),
|
|
1810
|
+
]
|
|
1811
|
+
}
|
|
1812
|
+
) }),
|
|
1714
1813
|
showBranding && /* @__PURE__ */ jsxs(
|
|
1715
1814
|
"a",
|
|
1716
1815
|
{
|