@copilotkit/react-core 0.0.0-main-20260403195251 → 0.0.0-main-20260406172622

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.
@@ -578,7 +578,7 @@ function renderSlot(slot, DefaultComponent, props) {
578
578
  //#region src/v2/components/chat/CopilotChatInput.tsx
579
579
  const SLASH_MENU_MAX_VISIBLE_ITEMS = 5;
580
580
  const SLASH_MENU_ITEM_HEIGHT_PX = 40;
581
- function CopilotChatInput({ mode = "input", onSubmitMessage, onStop, isRunning = false, onStartTranscribe, onCancelTranscribe, onFinishTranscribe, onFinishTranscribeWithAudio, onAddFile, onChange, value, toolsMenu, autoFocus = true, positioning = "static", keyboardHeight = 0, containerRef, showDisclaimer, textArea, sendButton, startTranscribeButton, cancelTranscribeButton, finishTranscribeButton, addMenuButton, audioRecorder, disclaimer, children, className, ...props }) {
581
+ function CopilotChatInput({ mode = "input", onSubmitMessage, onStop, isRunning = false, onStartTranscribe, onCancelTranscribe, onFinishTranscribe, onFinishTranscribeWithAudio, onAddFile, onChange, value, toolsMenu, autoFocus = false, positioning = "static", keyboardHeight = 0, containerRef, showDisclaimer, textArea, sendButton, startTranscribeButton, cancelTranscribeButton, finishTranscribeButton, addMenuButton, audioRecorder, disclaimer, children, className, ...props }) {
582
582
  const isControlled = value !== void 0;
583
583
  const [internalValue, setInternalValue] = (0, react.useState)(() => value ?? "");
584
584
  (0, react.useEffect)(() => {
@@ -651,7 +651,7 @@ function CopilotChatInput({ mode = "input", onSubmitMessage, onStop, isRunning =
651
651
  previousModalStateRef.current = config?.isModalOpen;
652
652
  return;
653
653
  }
654
- if (config?.isModalOpen && !previousModalStateRef.current) inputRef.current?.focus();
654
+ if (config?.isModalOpen && !previousModalStateRef.current) inputRef.current?.focus({ preventScroll: true });
655
655
  previousModalStateRef.current = config?.isModalOpen;
656
656
  }, [config?.isModalOpen, autoFocus]);
657
657
  (0, react.useEffect)(() => {
@@ -1191,21 +1191,7 @@ function CopilotChatInput({ mode = "input", onSubmitMessage, onStop, isRunning =
1191
1191
  const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels;
1192
1192
  (0, react.useImperativeHandle)(ref, () => internalTextareaRef.current);
1193
1193
  (0, react.useEffect)(() => {
1194
- const textarea = internalTextareaRef.current;
1195
- if (!textarea) return;
1196
- const handleFocus = () => {
1197
- setTimeout(() => {
1198
- textarea.scrollIntoView({
1199
- behavior: "smooth",
1200
- block: "nearest"
1201
- });
1202
- }, 300);
1203
- };
1204
- textarea.addEventListener("focus", handleFocus);
1205
- return () => textarea.removeEventListener("focus", handleFocus);
1206
- }, []);
1207
- (0, react.useEffect)(() => {
1208
- if (autoFocus) internalTextareaRef.current?.focus();
1194
+ if (autoFocus) internalTextareaRef.current?.focus({ preventScroll: true });
1209
1195
  }, [autoFocus]);
1210
1196
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
1211
1197
  ref: internalTextareaRef,
@@ -8071,4 +8057,4 @@ Object.defineProperty(exports, 'useToast', {
8071
8057
  return useToast;
8072
8058
  }
8073
8059
  });
8074
- //# sourceMappingURL=copilotkit-CDZGGOIB.cjs.map
8060
+ //# sourceMappingURL=copilotkit-Cs3FSw_2.cjs.map