@copilotkit/react-ui 1.8.4-next.0 → 1.8.4-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 (45) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/{chunk-QFIOUP7T.mjs → chunk-2IJIJYVG.mjs} +6 -6
  3. package/dist/{chunk-YTCGHL5U.mjs → chunk-3HSGJHBC.mjs} +2 -2
  4. package/dist/{chunk-4YH7W2CQ.mjs → chunk-N5TIP3NE.mjs} +2 -2
  5. package/dist/{chunk-SNLHKLW3.mjs → chunk-QJKMOGWN.mjs} +5 -2
  6. package/dist/chunk-QJKMOGWN.mjs.map +1 -0
  7. package/dist/{chunk-RF27Y73K.mjs → chunk-QN2SMWML.mjs} +7 -7
  8. package/dist/{chunk-W3L7GGIM.mjs → chunk-W5HLRVAS.mjs} +4 -4
  9. package/dist/{chunk-V5N636GW.mjs → chunk-XG356GYI.mjs} +4 -4
  10. package/dist/components/chat/Chat.js +4 -1
  11. package/dist/components/chat/Chat.js.map +1 -1
  12. package/dist/components/chat/Chat.mjs +3 -3
  13. package/dist/components/chat/Header.mjs +4 -4
  14. package/dist/components/chat/Input.js +4 -1
  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 +4 -1
  18. package/dist/components/chat/Modal.js.map +1 -1
  19. package/dist/components/chat/Modal.mjs +8 -8
  20. package/dist/components/chat/Popup.js +4 -1
  21. package/dist/components/chat/Popup.js.map +1 -1
  22. package/dist/components/chat/Popup.mjs +9 -9
  23. package/dist/components/chat/Sidebar.js +4 -1
  24. package/dist/components/chat/Sidebar.js.map +1 -1
  25. package/dist/components/chat/Sidebar.mjs +9 -9
  26. package/dist/components/chat/index.js +4 -1
  27. package/dist/components/chat/index.js.map +1 -1
  28. package/dist/components/chat/index.mjs +12 -12
  29. package/dist/components/dev-console/console.mjs +2 -2
  30. package/dist/components/dev-console/index.mjs +2 -2
  31. package/dist/components/index.js +4 -1
  32. package/dist/components/index.js.map +1 -1
  33. package/dist/components/index.mjs +12 -12
  34. package/dist/index.js +4 -1
  35. package/dist/index.js.map +1 -1
  36. package/dist/index.mjs +12 -12
  37. package/package.json +4 -4
  38. package/src/components/chat/Input.tsx +8 -2
  39. package/dist/chunk-SNLHKLW3.mjs.map +0 -1
  40. /package/dist/{chunk-QFIOUP7T.mjs.map → chunk-2IJIJYVG.mjs.map} +0 -0
  41. /package/dist/{chunk-YTCGHL5U.mjs.map → chunk-3HSGJHBC.mjs.map} +0 -0
  42. /package/dist/{chunk-4YH7W2CQ.mjs.map → chunk-N5TIP3NE.mjs.map} +0 -0
  43. /package/dist/{chunk-RF27Y73K.mjs.map → chunk-QN2SMWML.mjs.map} +0 -0
  44. /package/dist/{chunk-W3L7GGIM.mjs.map → chunk-W5HLRVAS.mjs.map} +0 -0
  45. /package/dist/{chunk-V5N636GW.mjs.map → chunk-XG356GYI.mjs.map} +0 -0
package/dist/index.mjs CHANGED
@@ -5,16 +5,16 @@ import "./chunk-SQMEPWVT.mjs";
5
5
  import "./chunk-WB3YULQ4.mjs";
6
6
  import {
7
7
  CopilotPopup
8
- } from "./chunk-4YH7W2CQ.mjs";
8
+ } from "./chunk-N5TIP3NE.mjs";
9
9
  import {
10
10
  CopilotSidebar
11
- } from "./chunk-YTCGHL5U.mjs";
12
- import "./chunk-QFIOUP7T.mjs";
11
+ } from "./chunk-3HSGJHBC.mjs";
12
+ import "./chunk-2IJIJYVG.mjs";
13
13
  import "./chunk-P7S3E5UW.mjs";
14
14
  import "./chunk-YOEL33HG.mjs";
15
15
  import {
16
16
  CopilotChat
17
- } from "./chunk-V5N636GW.mjs";
17
+ } from "./chunk-XG356GYI.mjs";
18
18
  import "./chunk-WEYDZBT7.mjs";
19
19
  import "./chunk-7RIBDD4K.mjs";
20
20
  import {
@@ -25,30 +25,30 @@ import {
25
25
  } from "./chunk-5M7ODWKH.mjs";
26
26
  import "./chunk-XB6QCUPB.mjs";
27
27
  import "./chunk-UWWMAJ7R.mjs";
28
- import "./chunk-SNLHKLW3.mjs";
29
28
  import {
30
29
  Markdown
31
30
  } from "./chunk-XNQO5AZZ.mjs";
32
31
  import "./chunk-ZY25LVYR.mjs";
33
32
  import "./chunk-TOQ7P4DO.mjs";
34
- import "./chunk-YQFVRDNC.mjs";
35
33
  import "./chunk-PCTCOQK2.mjs";
36
- import "./chunk-W3L7GGIM.mjs";
34
+ import "./chunk-W5HLRVAS.mjs";
35
+ import "./chunk-QJKMOGWN.mjs";
36
+ import "./chunk-YQFVRDNC.mjs";
37
+ import {
38
+ useChatContext
39
+ } from "./chunk-UN2E3HCK.mjs";
37
40
  import "./chunk-V7W6IM2V.mjs";
38
41
  import {
39
42
  CopilotDevConsole
40
- } from "./chunk-RF27Y73K.mjs";
43
+ } from "./chunk-QN2SMWML.mjs";
41
44
  import "./chunk-KXE2JCUH.mjs";
42
45
  import "./chunk-NRA3CFEE.mjs";
43
46
  import "./chunk-BH6PCAAL.mjs";
44
- import "./chunk-Q5V6S67N.mjs";
45
47
  import {
46
48
  shouldShowDevConsole
47
49
  } from "./chunk-6TCUJ3B7.mjs";
48
- import {
49
- useChatContext
50
- } from "./chunk-UN2E3HCK.mjs";
51
50
  import "./chunk-ORSMX3SE.mjs";
51
+ import "./chunk-Q5V6S67N.mjs";
52
52
  import "./chunk-IU3WTXLQ.mjs";
53
53
  import "./chunk-T26KLXLH.mjs";
54
54
  import {
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "publishConfig": {
10
10
  "access": "public"
11
11
  },
12
- "version": "1.8.4-next.0",
12
+ "version": "1.8.4-next.2",
13
13
  "sideEffects": [
14
14
  "**/*.css"
15
15
  ],
@@ -50,9 +50,9 @@
50
50
  "react-syntax-highlighter": "^15.5.0",
51
51
  "remark-gfm": "^3.0.1",
52
52
  "remark-math": "^5.1.1",
53
- "@copilotkit/react-core": "1.8.4-next.0",
54
- "@copilotkit/runtime-client-gql": "1.8.4-next.0",
55
- "@copilotkit/shared": "1.8.4-next.0"
53
+ "@copilotkit/react-core": "1.8.4-next.2",
54
+ "@copilotkit/runtime-client-gql": "1.8.4-next.2",
55
+ "@copilotkit/shared": "1.8.4-next.2"
56
56
  },
57
57
  "keywords": [
58
58
  "copilotkit",
@@ -16,9 +16,15 @@ export const Input = ({ inProgress, onSend, isVisible = false, onStop }: InputPr
16
16
  const textareaRef = useRef<HTMLTextAreaElement>(null);
17
17
 
18
18
  const handleDivClick = (event: React.MouseEvent<HTMLDivElement>) => {
19
- // Check if the clicked element is not the textarea itself
20
- if (event.target !== event.currentTarget) return;
19
+ const target = event.target as HTMLElement;
21
20
 
21
+ // If the user clicked a button or inside a button, don't focus the textarea
22
+ if (target.closest("button")) return;
23
+
24
+ // If the user clicked the textarea, do nothing (it's already focused)
25
+ if (target.tagName === "TEXTAREA") return;
26
+
27
+ // Otherwise, focus the textarea
22
28
  textareaRef.current?.focus();
23
29
  };
24
30
 
@@ -1 +0,0 @@
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\nexport const Input = ({ inProgress, onSend, isVisible = false, onStop }: 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 // Check if the clicked element is not the textarea itself\n if (event.target !== event.currentTarget) return;\n\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={5}\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 <div style={{ flexGrow: 1 }} />\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>\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