@copilotkit/react-ui 1.9.2-next.4 → 1.9.2-next.6

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.
Files changed (45) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/{chunk-KGKVOUC3.mjs → chunk-2TJK4TTF.mjs} +2 -2
  3. package/dist/{chunk-GBGU4ZR6.mjs → chunk-AHVYHPVQ.mjs} +2 -2
  4. package/dist/{chunk-RT4HE74K.mjs → chunk-KQEMBE47.mjs} +6 -4
  5. package/dist/chunk-KQEMBE47.mjs.map +1 -0
  6. package/dist/{chunk-XZI6DUGE.mjs → chunk-OMIVNOML.mjs} +3 -3
  7. package/dist/{chunk-EMIYIMQ6.mjs → chunk-X3LV7OXQ.mjs} +21 -11
  8. package/dist/chunk-X3LV7OXQ.mjs.map +1 -0
  9. package/dist/components/chat/Chat.d.ts +2 -1
  10. package/dist/components/chat/Chat.js +23 -11
  11. package/dist/components/chat/Chat.js.map +1 -1
  12. package/dist/components/chat/Chat.mjs +2 -2
  13. package/dist/components/chat/Input.d.ts +1 -1
  14. package/dist/components/chat/Input.js +19 -9
  15. package/dist/components/chat/Input.js.map +1 -1
  16. package/dist/components/chat/Input.mjs +1 -1
  17. package/dist/components/chat/Modal.js +23 -11
  18. package/dist/components/chat/Modal.js.map +1 -1
  19. package/dist/components/chat/Modal.mjs +3 -3
  20. package/dist/components/chat/Popup.js +23 -11
  21. package/dist/components/chat/Popup.js.map +1 -1
  22. package/dist/components/chat/Popup.mjs +4 -4
  23. package/dist/components/chat/Sidebar.js +23 -11
  24. package/dist/components/chat/Sidebar.js.map +1 -1
  25. package/dist/components/chat/Sidebar.mjs +4 -4
  26. package/dist/components/chat/index.js +23 -11
  27. package/dist/components/chat/index.js.map +1 -1
  28. package/dist/components/chat/index.mjs +5 -5
  29. package/dist/components/chat/props.d.ts +1 -0
  30. package/dist/components/chat/props.js.map +1 -1
  31. package/dist/components/index.js +23 -11
  32. package/dist/components/index.js.map +1 -1
  33. package/dist/components/index.mjs +5 -5
  34. package/dist/index.js +23 -11
  35. package/dist/index.js.map +1 -1
  36. package/dist/index.mjs +5 -5
  37. package/package.json +4 -4
  38. package/src/components/chat/Chat.tsx +4 -0
  39. package/src/components/chat/Input.tsx +21 -11
  40. package/src/components/chat/props.ts +1 -0
  41. package/dist/chunk-EMIYIMQ6.mjs.map +0 -1
  42. package/dist/chunk-RT4HE74K.mjs.map +0 -1
  43. /package/dist/{chunk-KGKVOUC3.mjs.map → chunk-2TJK4TTF.mjs.map} +0 -0
  44. /package/dist/{chunk-GBGU4ZR6.mjs.map → chunk-AHVYHPVQ.mjs.map} +0 -0
  45. /package/dist/{chunk-XZI6DUGE.mjs.map → chunk-OMIVNOML.mjs.map} +0 -0
@@ -3,11 +3,11 @@ import "../chunk-SC6JRFAJ.mjs";
3
3
  import "../chunk-WB3YULQ4.mjs";
4
4
  import {
5
5
  CopilotPopup
6
- } from "../chunk-GBGU4ZR6.mjs";
6
+ } from "../chunk-AHVYHPVQ.mjs";
7
7
  import {
8
8
  CopilotSidebar
9
- } from "../chunk-KGKVOUC3.mjs";
10
- import "../chunk-XZI6DUGE.mjs";
9
+ } from "../chunk-2TJK4TTF.mjs";
10
+ import "../chunk-OMIVNOML.mjs";
11
11
  import "../chunk-C3GSYRC3.mjs";
12
12
  import "../chunk-GVKA7RQQ.mjs";
13
13
  import "../chunk-V7W6IM2V.mjs";
@@ -24,7 +24,7 @@ import "../chunk-BH6PCAAL.mjs";
24
24
  import "../chunk-UFN2VWSR.mjs";
25
25
  import {
26
26
  CopilotChat
27
- } from "../chunk-RT4HE74K.mjs";
27
+ } from "../chunk-KQEMBE47.mjs";
28
28
  import "../chunk-UKCPOBQM.mjs";
29
29
  import "../chunk-2II3Q27P.mjs";
30
30
  import {
@@ -45,7 +45,7 @@ import {
45
45
  Suggestion
46
46
  } from "../chunk-IMBPSLL4.mjs";
47
47
  import "../chunk-PLHTVHUW.mjs";
48
- import "../chunk-EMIYIMQ6.mjs";
48
+ import "../chunk-X3LV7OXQ.mjs";
49
49
  import "../chunk-CGEAG65D.mjs";
50
50
  import "../chunk-YQFVRDNC.mjs";
51
51
  import {
package/dist/index.js CHANGED
@@ -1429,8 +1429,15 @@ function PoweredByTag({ showPoweredBy = true }) {
1429
1429
  // src/components/chat/Input.tsx
1430
1430
  var import_jsx_runtime13 = require("react/jsx-runtime");
1431
1431
  var MAX_NEWLINES = 6;
1432
- var Input = ({ inProgress, onSend, isVisible = false, onStop, onUpload }) => {
1433
- var _a;
1432
+ var Input = ({
1433
+ inProgress,
1434
+ onSend,
1435
+ isVisible = false,
1436
+ onStop,
1437
+ onUpload,
1438
+ hideStopButton = false
1439
+ }) => {
1440
+ var _a, _b;
1434
1441
  const context = useChatContext();
1435
1442
  const copilotContext = (0, import_react_core6.useCopilotContext)();
1436
1443
  const showPoweredBy = !((_a = copilotContext.copilotApiConfig) == null ? void 0 : _a.publicApiKey);
@@ -1459,15 +1466,18 @@ var Input = ({ inProgress, onSend, isVisible = false, onStop, onUpload }) => {
1459
1466
  inProgress
1460
1467
  });
1461
1468
  const isInProgress = inProgress || pushToTalkState === "transcribing";
1462
- const buttonIcon = isInProgress ? context.icons.stopIcon : context.icons.sendIcon;
1469
+ const buttonIcon = isInProgress && !hideStopButton ? context.icons.stopIcon : context.icons.sendIcon;
1463
1470
  const showPushToTalk = pushToTalkConfigured && (pushToTalkState === "idle" || pushToTalkState === "recording") && !inProgress;
1464
- const canSend = () => {
1471
+ const canSend = (0, import_react9.useMemo)(() => {
1465
1472
  var _a2;
1466
1473
  const interruptEvent = (_a2 = copilotContext.langGraphInterruptAction) == null ? void 0 : _a2.event;
1467
1474
  const interruptInProgress = (interruptEvent == null ? void 0 : interruptEvent.name) === "LangGraphInterruptEvent" && !(interruptEvent == null ? void 0 : interruptEvent.response);
1468
- return (isInProgress || !isInProgress && text.trim().length > 0) && pushToTalkState === "idle" && !interruptInProgress;
1469
- };
1470
- const sendDisabled = !canSend();
1475
+ return !isInProgress && text.trim().length > 0 && pushToTalkState === "idle" && !interruptInProgress;
1476
+ }, [(_b = copilotContext.langGraphInterruptAction) == null ? void 0 : _b.event, isInProgress, text, pushToTalkState]);
1477
+ const canStop = (0, import_react9.useMemo)(() => {
1478
+ return isInProgress && !hideStopButton;
1479
+ }, [isInProgress, hideStopButton]);
1480
+ const sendDisabled = !canSend && !canStop;
1471
1481
  return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `copilotKitInputContainer ${showPoweredBy ? "poweredByContainer" : ""}`, children: [
1472
1482
  /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "copilotKitInput", onClick: handleDivClick, children: [
1473
1483
  /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
@@ -1482,7 +1492,7 @@ var Input = ({ inProgress, onSend, isVisible = false, onStop, onUpload }) => {
1482
1492
  onKeyDown: (event) => {
1483
1493
  if (event.key === "Enter" && !event.shiftKey) {
1484
1494
  event.preventDefault();
1485
- if (canSend()) {
1495
+ if (canSend) {
1486
1496
  send();
1487
1497
  }
1488
1498
  }
@@ -1504,7 +1514,7 @@ var Input = ({ inProgress, onSend, isVisible = false, onStop, onUpload }) => {
1504
1514
  "button",
1505
1515
  {
1506
1516
  disabled: sendDisabled,
1507
- onClick: isInProgress ? onStop : send,
1517
+ onClick: isInProgress && !hideStopButton ? onStop : send,
1508
1518
  "data-copilotkit-in-progress": inProgress,
1509
1519
  "data-test-id": inProgress ? "copilot-chat-request-in-progress" : "copilot-chat-ready",
1510
1520
  className: "copilotKitInputControlButton",
@@ -2710,7 +2720,8 @@ function CopilotChat({
2710
2720
  AssistantMessage: AssistantMessage2 = AssistantMessage,
2711
2721
  UserMessage: UserMessage2 = UserMessage,
2712
2722
  imageUploadsEnabled,
2713
- inputFileAccept = "image/*"
2723
+ inputFileAccept = "image/*",
2724
+ hideStopButton
2714
2725
  }) {
2715
2726
  const { additionalInstructions, setChatInstructions } = (0, import_react_core10.useCopilotContext)();
2716
2727
  const [selectedImages, setSelectedImages] = (0, import_react13.useState)([]);
@@ -2893,7 +2904,8 @@ function CopilotChat({
2893
2904
  onUpload: imageUploadsEnabled ? () => {
2894
2905
  var _a;
2895
2906
  return (_a = fileInputRef.current) == null ? void 0 : _a.click();
2896
- } : void 0
2907
+ } : void 0,
2908
+ hideStopButton
2897
2909
  }
2898
2910
  )
2899
2911
  ] });