@rodrigocoliveira/agno-react 1.3.1 → 1.4.0

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/ui.mjs CHANGED
@@ -749,12 +749,20 @@ import { useCallback } from "react";
749
749
  import { StickToBottom, useStickToBottomContext } from "use-stick-to-bottom";
750
750
  import { useStickToBottomContext as useStickToBottomContext2 } from "use-stick-to-bottom";
751
751
  import { jsx as jsx13, jsxs as jsxs7, Fragment } from "react/jsx-runtime";
752
- var Conversation = ({ className, ...props }) => /* @__PURE__ */ jsx13(StickToBottom, {
753
- className: cn("relative flex-1 overflow-y-auto", className),
754
- initial: "smooth",
755
- role: "log",
756
- ...props
757
- });
752
+ var Conversation = ({ className, scrollBehavior, ...props }) => {
753
+ const initial = scrollBehavior?.initial ?? "smooth";
754
+ const resize = scrollBehavior?.resize ?? "instant";
755
+ return /* @__PURE__ */ jsx13(StickToBottom, {
756
+ className: cn("relative flex-1 overflow-y-auto", className),
757
+ initial,
758
+ resize,
759
+ ...scrollBehavior?.damping !== undefined && { damping: scrollBehavior.damping },
760
+ ...scrollBehavior?.stiffness !== undefined && { stiffness: scrollBehavior.stiffness },
761
+ ...scrollBehavior?.mass !== undefined && { mass: scrollBehavior.mass },
762
+ role: "log",
763
+ ...props
764
+ });
765
+ };
758
766
  var ConversationContent = ({ className, ...props }) => /* @__PURE__ */ jsx13(StickToBottom.Content, {
759
767
  className: cn("p-4", className),
760
768
  ...props
@@ -3561,7 +3569,7 @@ function AgnoChatRoot({
3561
3569
  }
3562
3570
 
3563
3571
  // src/ui/composed/agno-chat/messages.tsx
3564
- import { useEffect as useEffect6, useRef as useRef7 } from "react";
3572
+ import { isValidElement as isValidElement2, useEffect as useEffect6, useRef as useRef7 } from "react";
3565
3573
 
3566
3574
  // src/ui/composed/agno-chat/suggested-prompts.tsx
3567
3575
  import { jsx as jsx38, jsxs as jsxs22 } from "react/jsx-runtime";
@@ -3628,12 +3636,29 @@ function AgnoChatMessages({
3628
3636
  children,
3629
3637
  showThinkingIndicator = true,
3630
3638
  renderThinkingIndicator,
3631
- toolResultRenderers: propToolResultRenderers
3639
+ toolResultRenderers: propToolResultRenderers,
3640
+ scrollBehavior,
3641
+ scrollToBottomButton
3632
3642
  }) {
3633
3643
  const { messages, isStreaming, toolResultRenderers: contextToolResultRenderers } = useAgnoChatContext();
3634
3644
  const toolResultRenderers = propToolResultRenderers ?? contextToolResultRenderers;
3635
3645
  const lastMessage = messages[messages.length - 1];
3636
3646
  const isThinking = showThinkingIndicator && isStreaming && (!lastMessage || lastMessage.role !== "user") && !lastMessage?.content;
3647
+ const resolvedScrollButton = (() => {
3648
+ if (scrollToBottomButton === false)
3649
+ return null;
3650
+ if (scrollToBottomButton === undefined || scrollToBottomButton === true) {
3651
+ return /* @__PURE__ */ jsx39(ConversationScrollButton, {});
3652
+ }
3653
+ if (isValidElement2(scrollToBottomButton))
3654
+ return scrollToBottomButton;
3655
+ if (typeof scrollToBottomButton === "object" && scrollToBottomButton !== null && "className" in scrollToBottomButton) {
3656
+ return /* @__PURE__ */ jsx39(ConversationScrollButton, {
3657
+ className: scrollToBottomButton.className
3658
+ });
3659
+ }
3660
+ return scrollToBottomButton;
3661
+ })();
3637
3662
  let lastAssistantIndex = -1;
3638
3663
  for (let i = messages.length - 1;i >= 0; i--) {
3639
3664
  if (messages[i].role !== "user") {
@@ -3696,6 +3721,7 @@ function AgnoChatMessages({
3696
3721
  });
3697
3722
  return /* @__PURE__ */ jsxs23(Conversation, {
3698
3723
  className: cn("relative flex-1 w-full", className),
3724
+ scrollBehavior,
3699
3725
  children: [
3700
3726
  /* @__PURE__ */ jsx39(ScrollOnNewUserMessage, {
3701
3727
  messageCount: messages.length
@@ -3724,7 +3750,7 @@ function AgnoChatMessages({
3724
3750
  })
3725
3751
  ]
3726
3752
  }),
3727
- /* @__PURE__ */ jsx39(ConversationScrollButton, {})
3753
+ resolvedScrollButton
3728
3754
  ]
3729
3755
  });
3730
3756
  }
@@ -4028,4 +4054,4 @@ export {
4028
4054
  Accordion
4029
4055
  };
4030
4056
 
4031
- //# debugId=B7CF327D3F6FBB7F64756E2164756E21
4057
+ //# debugId=42C13B1D6AF75F5E64756E2164756E21