reachat 1.4.0 → 1.4.1

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.
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
- import { createContext, useContext, useRef, forwardRef, useState, useImperativeHandle, useEffect, useMemo, useCallback } from "react";
3
+ import { createContext, useContext, useRef, forwardRef, useState, useEffect, useImperativeHandle, useMemo, useCallback } from "react";
4
4
  import { Button, cn, Textarea, Ellipsis, DateFormat, IconButton, Card, Divider, useInfinityList, useComponentTheme, List, ListItem } from "reablocks";
5
5
  import { Slot } from "@radix-ui/react-slot";
6
6
  import { motion, AnimatePresence } from "framer-motion";
@@ -65,9 +65,14 @@ const ChatInput = forwardRef(({
65
65
  stopIcon = /* @__PURE__ */ jsx(SvgStop, {}),
66
66
  attachIcon
67
67
  }, ref) => {
68
- const { theme, isLoading, disabled, sendMessage, stopMessage, fileUpload } = useContext(ChatContext);
68
+ const { theme, isLoading, disabled, sendMessage, stopMessage, fileUpload, activeSessionId } = useContext(ChatContext);
69
69
  const [message, setMessage] = useState("");
70
70
  const inputRef = useRef(null);
71
+ useEffect(() => {
72
+ if (inputRef.current) {
73
+ inputRef.current.focus();
74
+ }
75
+ }, [activeSessionId, inputRef]);
71
76
  useImperativeHandle(ref, () => ({
72
77
  focus: () => {
73
78
  var _a;
@@ -97,7 +102,7 @@ const ChatInput = forwardRef(({
97
102
  /* @__PURE__ */ jsx(
98
103
  Textarea,
99
104
  {
100
- inputRef,
105
+ ref: inputRef,
101
106
  containerClassName: cn(theme.input.input),
102
107
  minRows: 1,
103
108
  autoFocus: true,