@copilotkit/react-ui 1.8.10-next.0 → 1.8.10-next.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.
Files changed (41) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/{chunk-BDNHZ3GW.mjs → chunk-B4N2T3V3.mjs} +3 -2
  3. package/dist/chunk-B4N2T3V3.mjs.map +1 -0
  4. package/dist/{chunk-JOL7NS2W.mjs → chunk-DP6QC6LJ.mjs} +2 -2
  5. package/dist/{chunk-O34Z4XM2.mjs → chunk-FHVERB23.mjs} +2 -2
  6. package/dist/{chunk-Y7UO3RPW.mjs → chunk-IJDF7C64.mjs} +3 -3
  7. package/dist/{chunk-T7N77F5Y.mjs → chunk-T4ETOM63.mjs} +2 -2
  8. package/dist/components/chat/Chat.js +2 -1
  9. package/dist/components/chat/Chat.js.map +1 -1
  10. package/dist/components/chat/Chat.mjs +2 -2
  11. package/dist/components/chat/Input.js +2 -1
  12. package/dist/components/chat/Input.js.map +1 -1
  13. package/dist/components/chat/Input.mjs +1 -1
  14. package/dist/components/chat/Modal.js +2 -1
  15. package/dist/components/chat/Modal.js.map +1 -1
  16. package/dist/components/chat/Modal.mjs +3 -3
  17. package/dist/components/chat/Popup.js +2 -1
  18. package/dist/components/chat/Popup.js.map +1 -1
  19. package/dist/components/chat/Popup.mjs +4 -4
  20. package/dist/components/chat/Sidebar.js +2 -1
  21. package/dist/components/chat/Sidebar.js.map +1 -1
  22. package/dist/components/chat/Sidebar.mjs +4 -4
  23. package/dist/components/chat/index.js +2 -1
  24. package/dist/components/chat/index.js.map +1 -1
  25. package/dist/components/chat/index.mjs +5 -5
  26. package/dist/components/index.js +2 -1
  27. package/dist/components/index.js.map +1 -1
  28. package/dist/components/index.mjs +5 -5
  29. package/dist/index.css +18 -3
  30. package/dist/index.css.map +1 -1
  31. package/dist/index.js +2 -1
  32. package/dist/index.js.map +1 -1
  33. package/dist/index.mjs +5 -5
  34. package/package.json +4 -4
  35. package/src/components/chat/Input.tsx +3 -1
  36. package/src/css/input.css +23 -3
  37. package/dist/chunk-BDNHZ3GW.mjs.map +0 -1
  38. /package/dist/{chunk-JOL7NS2W.mjs.map → chunk-DP6QC6LJ.mjs.map} +0 -0
  39. /package/dist/{chunk-O34Z4XM2.mjs.map → chunk-FHVERB23.mjs.map} +0 -0
  40. /package/dist/{chunk-Y7UO3RPW.mjs.map → chunk-IJDF7C64.mjs.map} +0 -0
  41. /package/dist/{chunk-T7N77F5Y.mjs.map → chunk-T4ETOM63.mjs.map} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # ui
2
2
 
3
+ ## 1.8.10-next.2
4
+
5
+ ### Patch Changes
6
+
7
+ - @copilotkit/runtime-client-gql@1.8.10-next.2
8
+ - @copilotkit/react-core@1.8.10-next.2
9
+ - @copilotkit/shared@1.8.10-next.2
10
+
11
+ ## 1.8.10-next.1
12
+
13
+ ### Patch Changes
14
+
15
+ - 62b6db1: - fix: allow the chat input to expand on new lines
16
+ - @copilotkit/react-core@1.8.10-next.1
17
+ - @copilotkit/runtime-client-gql@1.8.10-next.1
18
+ - @copilotkit/shared@1.8.10-next.1
19
+
3
20
  ## 1.8.10-next.0
4
21
 
5
22
  ### Patch Changes
@@ -12,6 +12,7 @@ import {
12
12
  import { useEffect, useRef, useState } from "react";
13
13
  import { useCopilotContext } from "@copilotkit/react-core";
14
14
  import { jsx, jsxs } from "react/jsx-runtime";
15
+ var MAX_NEWLINES = 6;
15
16
  var Input = ({ inProgress, onSend, isVisible = false, onStop, onUpload }) => {
16
17
  const context = useChatContext();
17
18
  const copilotContext = useCopilotContext();
@@ -62,7 +63,7 @@ var Input = ({ inProgress, onSend, isVisible = false, onStop, onUpload }) => {
62
63
  ref: textareaRef,
63
64
  placeholder: context.labels.placeholder,
64
65
  autoFocus: true,
65
- maxRows: 5,
66
+ maxRows: MAX_NEWLINES,
66
67
  value: text,
67
68
  onChange: (event) => setText(event.target.value),
68
69
  onKeyDown: (event) => {
@@ -104,4 +105,4 @@ var Input = ({ inProgress, onSend, isVisible = false, onStop, onUpload }) => {
104
105
  export {
105
106
  Input
106
107
  };
107
- //# sourceMappingURL=chunk-BDNHZ3GW.mjs.map
108
+ //# sourceMappingURL=chunk-B4N2T3V3.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/chat/Input.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from \"react\";\nimport { InputProps } from \"./props\";\nimport { useChatContext } from \"./ChatContext\";\nimport AutoResizingTextarea from \"./Textarea\";\nimport { usePushToTalk } from \"../../hooks/use-push-to-talk\";\nimport { useCopilotContext } from \"@copilotkit/react-core\";\n\nconst MAX_NEWLINES = 6;\n\nexport const Input = ({ inProgress, onSend, isVisible = false, onStop, onUpload }: InputProps) => {\n const context = useChatContext();\n const copilotContext = useCopilotContext();\n\n const pushToTalkConfigured =\n copilotContext.copilotApiConfig.textToSpeechUrl !== undefined &&\n copilotContext.copilotApiConfig.transcribeAudioUrl !== undefined;\n\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n\n const handleDivClick = (event: React.MouseEvent<HTMLDivElement>) => {\n const target = event.target as HTMLElement;\n\n // If the user clicked a button or inside a button, don't focus the textarea\n if (target.closest(\"button\")) return;\n\n // If the user clicked the textarea, do nothing (it's already focused)\n if (target.tagName === \"TEXTAREA\") return;\n\n // Otherwise, focus the textarea\n textareaRef.current?.focus();\n };\n\n const [text, setText] = useState(\"\");\n const send = () => {\n if (inProgress) return;\n onSend(text);\n setText(\"\");\n\n textareaRef.current?.focus();\n };\n\n useEffect(() => {\n if (isVisible) {\n textareaRef.current?.focus();\n }\n }, [isVisible]);\n\n const { pushToTalkState, setPushToTalkState } = usePushToTalk({\n sendFunction: onSend,\n inProgress,\n });\n\n const isInProgress = inProgress || pushToTalkState === \"transcribing\";\n const buttonIcon = isInProgress ? context.icons.stopIcon : context.icons.sendIcon;\n const showPushToTalk =\n pushToTalkConfigured &&\n (pushToTalkState === \"idle\" || pushToTalkState === \"recording\") &&\n !inProgress;\n\n const canSend = () => {\n const interruptEvent = copilotContext.langGraphInterruptAction?.event;\n const interruptInProgress =\n interruptEvent?.name === \"LangGraphInterruptEvent\" && !interruptEvent?.response;\n\n return (\n (isInProgress || (!isInProgress && text.trim().length > 0)) &&\n pushToTalkState === \"idle\" &&\n !interruptInProgress\n );\n };\n\n const sendDisabled = !canSend();\n\n return (\n <div className=\"copilotKitInputContainer\">\n <div className=\"copilotKitInput\" onClick={handleDivClick}>\n <AutoResizingTextarea\n ref={textareaRef}\n placeholder={context.labels.placeholder}\n autoFocus={true}\n maxRows={MAX_NEWLINES}\n value={text}\n onChange={(event) => setText(event.target.value)}\n onKeyDown={(event) => {\n if (event.key === \"Enter\" && !event.shiftKey) {\n event.preventDefault();\n if (canSend()) {\n send();\n }\n }\n }}\n />\n <div className=\"copilotKitInputControls\">\n {onUpload && (\n <button onClick={onUpload} className=\"copilotKitInputControlButton\">\n {context.icons.uploadIcon}\n </button>\n )}\n\n <div style={{ flexGrow: 1 }} />\n\n {showPushToTalk && (\n <button\n onClick={() =>\n setPushToTalkState(pushToTalkState === \"idle\" ? \"recording\" : \"transcribing\")\n }\n className={\n pushToTalkState === \"recording\"\n ? \"copilotKitInputControlButton copilotKitPushToTalkRecording\"\n : \"copilotKitInputControlButton\"\n }\n >\n {context.icons.pushToTalkIcon}\n </button>\n )}\n <button\n disabled={sendDisabled}\n onClick={isInProgress ? onStop : send}\n data-copilotkit-in-progress={inProgress}\n data-test-id={inProgress ? \"copilot-chat-request-in-progress\" : \"copilot-chat-ready\"}\n className=\"copilotKitInputControlButton\"\n >\n {buttonIcon}\n </button>\n </div>\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;AAAA,SAAgB,WAAW,QAAQ,gBAAgB;AAKnD,SAAS,yBAAyB;AAuE1B,cAgBA,YAhBA;AArER,IAAM,eAAe;AAEd,IAAM,QAAQ,CAAC,EAAE,YAAY,QAAQ,YA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AkB,SAAS,gBACxC;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,KAAK;AAAA,QACL,aAAa,QAAQ,OAAO;AAAA,QAC5B,WAAW;AAAA,QACX,SAAS;AAAA,QACT,OAAO;AAAA,QACP,UAAU,CAAC,UAAU,QAAQ,MAAM,OAAO,KAAK;AAAA,QAC/C,WAAW,CAAC,UAAU;AACpB,cAAI,MAAM,QAAQ,WAAW,CAAC,MAAM,UAAU;AAC5C,kBAAM,eAAe;AACrB,gBAAI,QAAQ,GAAG;AACb,mBAAK;AAAA,YACP;AAAA,UACF;AAAA,QACF;AAAA;AAAA,IACF;AAAA,IACA,qBAAC,SAAI,WAAU,2BACZ;AAAA,kBACC,oBAAC,YAAO,SAAS,UAAU,WAAU,gCAClC,kBAAQ,MAAM,YACjB;AAAA,MAGF,oBAAC,SAAI,OAAO,EAAE,UAAU,EAAE,GAAG;AAAA,MAE5B,kBACC;AAAA,QAAC;AAAA;AAAA,UACC,SAAS,MACP,mBAAmB,oBAAoB,SAAS,cAAc,cAAc;AAAA,UAE9E,WACE,oBAAoB,cAChB,+DACA;AAAA,UAGL,kBAAQ,MAAM;AAAA;AAAA,MACjB;AAAA,MAEF;AAAA,QAAC;AAAA;AAAA,UACC,UAAU;AAAA,UACV,SAAS,eAAe,SAAS;AAAA,UACjC,+BAA6B;AAAA,UAC7B,gBAAc,aAAa,qCAAqC;AAAA,UAChE,WAAU;AAAA,UAET;AAAA;AAAA,MACH;AAAA,OACF;AAAA,KACF,GACF;AAEJ;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  CopilotModal
3
- } from "./chunk-Y7UO3RPW.mjs";
3
+ } from "./chunk-IJDF7C64.mjs";
4
4
  import {
5
5
  __spreadProps,
6
6
  __spreadValues
@@ -27,4 +27,4 @@ function CopilotSidebar(props) {
27
27
  export {
28
28
  CopilotSidebar
29
29
  };
30
- //# sourceMappingURL=chunk-JOL7NS2W.mjs.map
30
+ //# sourceMappingURL=chunk-DP6QC6LJ.mjs.map
@@ -28,7 +28,7 @@ import {
28
28
  } from "./chunk-PLHTVHUW.mjs";
29
29
  import {
30
30
  Input
31
- } from "./chunk-BDNHZ3GW.mjs";
31
+ } from "./chunk-B4N2T3V3.mjs";
32
32
  import {
33
33
  Messages
34
34
  } from "./chunk-IJADIQAR.mjs";
@@ -468,4 +468,4 @@ export {
468
468
  WrappedCopilotChat,
469
469
  useCopilotChatLogic
470
470
  };
471
- //# sourceMappingURL=chunk-O34Z4XM2.mjs.map
471
+ //# sourceMappingURL=chunk-FHVERB23.mjs.map
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-UFN2VWSR.mjs";
10
10
  import {
11
11
  CopilotChat
12
- } from "./chunk-O34Z4XM2.mjs";
12
+ } from "./chunk-FHVERB23.mjs";
13
13
  import {
14
14
  UserMessage
15
15
  } from "./chunk-HWMFMBJC.mjs";
@@ -18,7 +18,7 @@ import {
18
18
  } from "./chunk-OZXUB3V7.mjs";
19
19
  import {
20
20
  Input
21
- } from "./chunk-BDNHZ3GW.mjs";
21
+ } from "./chunk-B4N2T3V3.mjs";
22
22
  import {
23
23
  Messages
24
24
  } from "./chunk-IJADIQAR.mjs";
@@ -103,4 +103,4 @@ var CopilotModal = ({
103
103
  export {
104
104
  CopilotModal
105
105
  };
106
- //# sourceMappingURL=chunk-Y7UO3RPW.mjs.map
106
+ //# sourceMappingURL=chunk-IJDF7C64.mjs.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  CopilotModal
3
- } from "./chunk-Y7UO3RPW.mjs";
3
+ } from "./chunk-IJDF7C64.mjs";
4
4
  import {
5
5
  __spreadProps,
6
6
  __spreadValues
@@ -18,4 +18,4 @@ function CopilotPopup(props) {
18
18
  export {
19
19
  CopilotPopup
20
20
  };
21
- //# sourceMappingURL=chunk-T7N77F5Y.mjs.map
21
+ //# sourceMappingURL=chunk-T4ETOM63.mjs.map
@@ -755,6 +755,7 @@ var usePushToTalk = ({
755
755
  // src/components/chat/Input.tsx
756
756
  var import_react_core3 = require("@copilotkit/react-core");
757
757
  var import_jsx_runtime5 = require("react/jsx-runtime");
758
+ var MAX_NEWLINES = 6;
758
759
  var Input = ({ inProgress, onSend, isVisible = false, onStop, onUpload }) => {
759
760
  const context = useChatContext();
760
761
  const copilotContext = (0, import_react_core3.useCopilotContext)();
@@ -805,7 +806,7 @@ var Input = ({ inProgress, onSend, isVisible = false, onStop, onUpload }) => {
805
806
  ref: textareaRef,
806
807
  placeholder: context.labels.placeholder,
807
808
  autoFocus: true,
808
- maxRows: 5,
809
+ maxRows: MAX_NEWLINES,
809
810
  value: text,
810
811
  onChange: (event) => setText(event.target.value),
811
812
  onKeyDown: (event) => {