@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/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # ui
2
2
 
3
+ ## 1.8.4-next.2
4
+
5
+ ### Patch Changes
6
+
7
+ - fc11455: - fix: focus on text area when clicking in input box
8
+ - @copilotkit/react-core@1.8.4-next.2
9
+ - @copilotkit/runtime-client-gql@1.8.4-next.2
10
+ - @copilotkit/shared@1.8.4-next.2
11
+
12
+ ## 1.8.4-next.1
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies [f363760]
17
+ - @copilotkit/shared@1.8.4-next.1
18
+ - @copilotkit/runtime-client-gql@1.8.4-next.1
19
+ - @copilotkit/react-core@1.8.4-next.1
20
+
3
21
  ## 1.8.4-next.0
4
22
 
5
23
  ### Patch Changes
@@ -6,22 +6,22 @@ import {
6
6
  } from "./chunk-YOEL33HG.mjs";
7
7
  import {
8
8
  CopilotChat
9
- } from "./chunk-V5N636GW.mjs";
9
+ } from "./chunk-XG356GYI.mjs";
10
10
  import {
11
11
  UserMessage
12
12
  } from "./chunk-HEIDCT7I.mjs";
13
13
  import {
14
14
  AssistantMessage
15
15
  } from "./chunk-5M7ODWKH.mjs";
16
- import {
17
- Input
18
- } from "./chunk-SNLHKLW3.mjs";
19
16
  import {
20
17
  Messages
21
18
  } from "./chunk-ZY25LVYR.mjs";
22
19
  import {
23
20
  Header
24
- } from "./chunk-W3L7GGIM.mjs";
21
+ } from "./chunk-W5HLRVAS.mjs";
22
+ import {
23
+ Input
24
+ } from "./chunk-QJKMOGWN.mjs";
25
25
  import {
26
26
  ChatContextProvider
27
27
  } from "./chunk-UN2E3HCK.mjs";
@@ -95,4 +95,4 @@ var CopilotModal = ({
95
95
  export {
96
96
  CopilotModal
97
97
  };
98
- //# sourceMappingURL=chunk-QFIOUP7T.mjs.map
98
+ //# sourceMappingURL=chunk-2IJIJYVG.mjs.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  CopilotModal
3
- } from "./chunk-QFIOUP7T.mjs";
3
+ } from "./chunk-2IJIJYVG.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-YTCGHL5U.mjs.map
30
+ //# sourceMappingURL=chunk-3HSGJHBC.mjs.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  CopilotModal
3
- } from "./chunk-QFIOUP7T.mjs";
3
+ } from "./chunk-2IJIJYVG.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-4YH7W2CQ.mjs.map
21
+ //# sourceMappingURL=chunk-N5TIP3NE.mjs.map
@@ -19,7 +19,10 @@ var Input = ({ inProgress, onSend, isVisible = false, onStop }) => {
19
19
  const textareaRef = useRef(null);
20
20
  const handleDivClick = (event) => {
21
21
  var _a;
22
- if (event.target !== event.currentTarget)
22
+ const target = event.target;
23
+ if (target.closest("button"))
24
+ return;
25
+ if (target.tagName === "TEXTAREA")
23
26
  return;
24
27
  (_a = textareaRef.current) == null ? void 0 : _a.focus();
25
28
  };
@@ -100,4 +103,4 @@ var Input = ({ inProgress, onSend, isVisible = false, onStop }) => {
100
103
  export {
101
104
  Input
102
105
  };
103
- //# sourceMappingURL=chunk-SNLHKLW3.mjs.map
106
+ //# sourceMappingURL=chunk-QJKMOGWN.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\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 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={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>\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;AAAA,SAAgB,WAAW,QAAQ,gBAAgB;AAKnD,SAAS,yBAAyB;AAqE1B,cAgBA,YAhBA;AAnED,IAAM,QAAQ,CAAC,EAAE,YAAY,QAAQ,YAAY,OAAO,OAAO,MAAkB;A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AAC;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,2BACb;AAAA,0BAAC,SAAI,OAAO,EAAE,UAAU,EAAE,GAAG;AAAA,MAC5B,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,12 +1,6 @@
1
1
  import {
2
2
  CopilotKitHelpModal
3
3
  } from "./chunk-NRA3CFEE.mjs";
4
- import {
5
- CheckIcon,
6
- ChevronDownIcon,
7
- ExclamationMarkIcon,
8
- ExclamationMarkTriangleIcon
9
- } from "./chunk-Q5V6S67N.mjs";
10
4
  import {
11
5
  getPublishedCopilotKitVersion,
12
6
  logActions,
@@ -17,6 +11,12 @@ import {
17
11
  import {
18
12
  SmallSpinnerIcon
19
13
  } from "./chunk-ORSMX3SE.mjs";
14
+ import {
15
+ CheckIcon,
16
+ ChevronDownIcon,
17
+ ExclamationMarkIcon,
18
+ ExclamationMarkTriangleIcon
19
+ } from "./chunk-Q5V6S67N.mjs";
20
20
 
21
21
  // src/components/dev-console/console.tsx
22
22
  import { useCopilotContext, useCopilotMessagesContext } from "@copilotkit/react-core";
@@ -201,4 +201,4 @@ export {
201
201
  CopilotDevConsole,
202
202
  DebugMenuButton
203
203
  };
204
- //# sourceMappingURL=chunk-RF27Y73K.mjs.map
204
+ //# sourceMappingURL=chunk-QN2SMWML.mjs.map
@@ -1,9 +1,9 @@
1
- import {
2
- CopilotDevConsole
3
- } from "./chunk-RF27Y73K.mjs";
4
1
  import {
5
2
  useChatContext
6
3
  } from "./chunk-UN2E3HCK.mjs";
4
+ import {
5
+ CopilotDevConsole
6
+ } from "./chunk-QN2SMWML.mjs";
7
7
 
8
8
  // src/components/chat/Header.tsx
9
9
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -29,4 +29,4 @@ var Header = ({}) => {
29
29
  export {
30
30
  Header
31
31
  };
32
- //# sourceMappingURL=chunk-W3L7GGIM.mjs.map
32
+ //# sourceMappingURL=chunk-W5HLRVAS.mjs.map
@@ -16,9 +16,6 @@ import {
16
16
  import {
17
17
  RenderAgentStateMessage
18
18
  } from "./chunk-UWWMAJ7R.mjs";
19
- import {
20
- Input
21
- } from "./chunk-SNLHKLW3.mjs";
22
19
  import {
23
20
  Messages
24
21
  } from "./chunk-ZY25LVYR.mjs";
@@ -26,6 +23,9 @@ import {
26
23
  Suggestion,
27
24
  reloadSuggestions
28
25
  } from "./chunk-TOQ7P4DO.mjs";
26
+ import {
27
+ Input
28
+ } from "./chunk-QJKMOGWN.mjs";
29
29
  import {
30
30
  ChatContext,
31
31
  ChatContextProvider
@@ -327,4 +327,4 @@ export {
327
327
  WrappedCopilotChat,
328
328
  useCopilotChatLogic
329
329
  };
330
- //# sourceMappingURL=chunk-V5N636GW.mjs.map
330
+ //# sourceMappingURL=chunk-XG356GYI.mjs.map
@@ -730,7 +730,10 @@ var Input = ({ inProgress, onSend, isVisible = false, onStop }) => {
730
730
  const textareaRef = (0, import_react5.useRef)(null);
731
731
  const handleDivClick = (event) => {
732
732
  var _a;
733
- if (event.target !== event.currentTarget)
733
+ const target = event.target;
734
+ if (target.closest("button"))
735
+ return;
736
+ if (target.tagName === "TEXTAREA")
734
737
  return;
735
738
  (_a = textareaRef.current) == null ? void 0 : _a.focus();
736
739
  };