@pickaxeproject/react 6.10.4 → 6.11.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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("./useScrollContext.js");exports.useScroll=({auto:t,debug:o,smooth:n=!0})=>{const{scrollContainerRef:l,scrollTargetRef:s,isLocked:c,isScrollSession:u,isScrollIncreasing:i,setIsLocked:d,setIsScrollSession:a,setIsScrolling:f,setIsScrollIncreasing:g}=r.useScrollContext(),[v,S]=e.useState(0),h=e.useRef(!1),m=e.useMemo((()=>null!=t&&t&&u),[t,u]),w=e.useMemo((()=>l&&l.current?l.current:"undefined"==typeof window?null:window),[l]);e.useEffect((()=>{if(!w)return;const e=e=>{!c||"mousedown"!==e.type&&"touchmove"!==e.type&&"wheel"!==e.type&&"DOMMouseScroll"!==e.type&&"mousewheel"!==e.type||d(!1)};return null==w||w.addEventListener("mousedown",e),null==w||w.addEventListener("touchmove",e),null==w||w.addEventListener("wheel",e),null==w||w.addEventListener("DOMMouseScroll",e),null==w||w.addEventListener("mousewheel",e),()=>{null==w||w.removeEventListener("mousedown",e),null==w||w.removeEventListener("touchmove",e),null==w||w.removeEventListener("wheel",e),null==w||w.removeEventListener("DOMMouseScroll",e),null==w||w.removeEventListener("mousewheel",e)}}),[w,c]),e.useEffect((()=>{h.current=!c}),[c]),e.useEffect((()=>{const e=setInterval((()=>{if(!l.current)return;const e=l.current.scrollHeight;if(e===v)return;const r=e>v;o&&console.log("[useScroll] isIncreasing:",r,e,v),g(r),S(e),r&&t&&E()}),100);return()=>clearInterval(e)}),[l,v,t]),e.useEffect((()=>{const e=setInterval((()=>{if(l.current)return;if(!s.current)return;const e=s.current.getBoundingClientRect().top+s.current.getBoundingClientRect().height+window.scrollY;if(e===v)return;const r=e>v;g(r),S(e),r&&m&&p()}),100);return()=>clearInterval(e)}),[s,v,m]);const E=()=>{try{if(f(!0),!l.current)return void(o&&console.log("[useScroll] scrollContainerRef not detected"));if(h.current)return;const e=l.current.scrollHeight;l.current.scrollTo({top:e,behavior:n?"smooth":"auto"}),o&&console.log("[useScroll] scrolled scrollContainerRef")}finally{f(!1)}},p=()=>{try{if(f(!0),!s.current)return void(o&&console.log("[useScroll] scrollTargetRef not detected"));if(h.current)return;const e=s.current.getBoundingClientRect().top+s.current.getBoundingClientRect().height+window.scrollY;window.scrollTo({top:e-500,behavior:"smooth"}),o&&console.log("[useScroll] scrolled scrollTargetRef")}finally{f(!1)}};return{scrollContainerRef:l,scrollTargetRef:s,isScrollIncreasing:i,scrollStartSession:()=>{a(!0),d(!0),h.current=!1},scrollEndSession:()=>{a(!1)},scrollToBottom:E,scrollToTarget:p}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("./useScrollContext.js");exports.useScroll=({auto:t=!1,debug:o,smooth:n=!0})=>{const{scrollContainerRef:l,scrollTargetRef:c,hasScrolledRef:s,isLocked:u,isScrollSession:i,isScrollIncreasing:a,setIsLocked:d,setIsScrollSession:v,setIsScrolling:h,setIsScrollIncreasing:b}=r.useScrollContext(),f=e.useRef(null),g=e.useRef(null),m=e.useRef(!1),w=e.useRef(0),C=e.useCallback((()=>{null!==f.current&&(cancelAnimationFrame(f.current),f.current=null)}),[]),S=e.useCallback((e=>{g.current&&clearTimeout(g.current),g.current=setTimeout((()=>{m.current=!1,h(!1)}),"smooth"===e?400:0)}),[h]),T=e.useCallback(((e={})=>{var r;if(!e.force&&s.current)return;const t=null!==(r=e.behavior)&&void 0!==r?r:n?"smooth":"auto",u=l.current,i=c.current;if(u||i){if(m.current=!0,h(!0),u){const e=Math.max(0,u.scrollHeight-u.clientHeight);u.scrollTo({top:e,behavior:t})}else if(i){const e=i.getBoundingClientRect().bottom+window.scrollY,r=Math.max(0,e-window.innerHeight);window.scrollTo({top:r,behavior:t})}o&&console.log("[useScroll] scrolled to the active bottom"),S(t)}else o&&console.log("[useScroll] no scroll element detected")}),[o,S,s,l,c,h,n]),R=e.useCallback(((e={})=>{C(),f.current=requestAnimationFrame((()=>{f.current=null,T(e)}))}),[C,T]),p=e.useCallback(((e={})=>{var r;if(!e.force&&s.current)return;const t=c.current;if(!t)return void(o&&console.log("[useScroll] scroll target not detected"));const l=null!==(r=e.behavior)&&void 0!==r?r:n?"smooth":"auto",u=t.getBoundingClientRect().bottom+window.scrollY,i=Math.max(0,u-500);m.current=!0,h(!0),window.scrollTo({top:i,behavior:l}),o&&console.log("[useScroll] scrolled to the form response"),S(l)}),[o,S,s,c,h,n]),E=e.useCallback(((e={})=>{C(),f.current=requestAnimationFrame((()=>{f.current=null,p(e)}))}),[C,p]),k=e.useCallback((()=>{s.current=!1,d(!0),v(!0)}),[s,d,v]),L=e.useCallback((()=>{v(!1)}),[v]),H=e.useCallback(((e={})=>R(e)),[R]),x=e.useCallback(((e={})=>E(e)),[E]);return e.useEffect((()=>{if(!t||!i||!u)return;let e=l.current,r=c.current,o=null,n=[];const s=()=>{var t;if(!o)return;const n=e?e.scrollHeight:null!==(t=null==r?void 0:r.getBoundingClientRect().height)&&void 0!==t?t:0,l=n>w.current;w.current=n,b(l),l&&(e?R({behavior:"auto"}):E({behavior:"auto"}))},a=new ResizeObserver(s);function d(){o&&(n.forEach((e=>a.unobserve(e))),n=[o,...Array.from(o.children)],n.forEach((e=>a.observe(e))))}const v=new MutationObserver((()=>{d(),s()}));let h=null;const f=()=>{var t;e=l.current,r=c.current;const n=null!=e?e:r;return!(!n||n===o)&&(v.disconnect(),a.disconnect(),o=n,w.current=e?e.scrollHeight:null!==(t=null==r?void 0:r.getBoundingClientRect().height)&&void 0!==t?t:0,d(),v.observe(o,{childList:!0,subtree:!0}),e?R({behavior:"auto"}):E({behavior:"auto"}),!0)};return f()||(h=new MutationObserver((()=>{f()&&(null==h||h.disconnect())})),h.observe(document.body,{childList:!0,subtree:!0})),()=>{null==h||h.disconnect(),v.disconnect(),a.disconnect()}}),[t,u,i,R,E,l,c,b]),e.useEffect((()=>{u&&(s.current=!1)}),[s,u]),e.useEffect((()=>{const e=l.current,r=null!=e?e:window,t=()=>{if(m.current)return;const r=(()=>{if(e)return e.scrollHeight-e.scrollTop-e.clientHeight<=32;const r=c.current;return!r||r.getBoundingClientRect().bottom-window.innerHeight<=32})();s.current=!r,d(r)},o=()=>{m.current&&(m.current=!1,h(!1),g.current&&(clearTimeout(g.current),g.current=null),e?e.scrollTo({top:e.scrollTop,behavior:"auto"}):window.scrollTo({top:window.scrollY,behavior:"auto"}))};return r.addEventListener("scroll",t,{passive:!0}),r.addEventListener("wheel",o,{passive:!0}),r.addEventListener("touchmove",o,{passive:!0}),()=>{r.removeEventListener("scroll",t),r.removeEventListener("wheel",o),r.removeEventListener("touchmove",o)}}),[s,l,c,d,h]),e.useEffect((()=>()=>{C(),g.current&&clearTimeout(g.current)}),[C]),{scrollContainerRef:l,scrollTargetRef:c,isScrollIncreasing:a,scrollStartSession:k,scrollEndSession:L,scrollToBottom:H,scrollToTarget:x}};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),o=require("react"),s=require("../../../hooks/pickaxe/usePickaxeContext.js"),i=require("../Addons/Auth/hooks/useAuthContext.js"),r=require("../../../hooks/pickaxe/useDimensionContext.js"),n=require("../Addons/Document/hooks/useDocument.js"),a=require("../Addons/Scroll/hooks/useScrollContext.js"),l=require("../../../hooks/studio/useStyleFontSize.js"),u=require("../../../hooks/core/useScrollToBottomVisibility.js"),c=require("./History/index.js"),d=require("./Input.js"),f=require("../../Icons/attach-vertical.svg.js"),h=require("../../../common/cn.js"),m=require("../../../common/api/pickaxe.js"),p=require("uuid"),v=require("../../Core/StudioTip.js"),x=require("../common/ScrollToBottomButton.js"),j=require("../../../hooks/pickaxe/useResponseContext.js"),g=require("../Addons/Navbar/NavPill.js"),b=require("../../Icons/history.svg.js");exports.default=()=>{var k,y;const{deploymentType:S,isNewChat:w,setIsNewChat:C,sessionId:q,setSessionId:I,setLastSessionId:D,pickaxeId:N,sender:A,pickaxe:P,styles:T,isEmbed:_,translations:F}=s.usePickaxeContext(),{isSent:E}=i.useAuthContext(),{width:O,height:R,setDimension:H}=r.useDimensionContext(),{setDocuments:z,onFileUpload:B}=n.useDocument(),{scrollContainerRef:L,isLocked:G,setIsLocked:V}=a.useScrollContext(),{isGenerating:M,messages:U}=j.useResponseContext(),W=l.useStyleFontSize(),[J,K]=o.useState(0),[Q,X]=o.useState(!1),[Y,Z]=o.useState(!1),$=o.useRef(null),ee=o.useRef(null),te=o.useRef(0),[oe,se]=o.useState(null),[ie,re]=o.useState(!1),ne=(null==F?void 0:F["new-chat"])||"New chat",ae="chat-input"===S&&w&&!E,le=null!==(y=null===(k=null==P?void 0:P.documentuploadtype)||void 0===k?void 0:k.startsWith("enduserupload"))&&void 0!==y&&y,{hasScrollableContent:ue,isNearBottom:ce}=u.default(L);o.useEffect((()=>()=>{z([])}),[]);const de=o.useCallback((()=>{if(!N||!A)return;const t=(o=0)=>e.__awaiter(void 0,void 0,void 0,(function*(){var e;try{const t=yield m.pickaxeApi2.post("/conversation/title",{sessionId:q,userId:A});if(t.data&&t.data.success){const e=t.data.title;if(e&&"Conversation Title"!==e)return void he(e)}else console.error("Failed to load conversation:",null===(e=t.data)||void 0===e?void 0:e.error)}catch(e){console.error("Error fetching conversation:",e)}o<20&&setTimeout((()=>t(o+1)),3e3)}));t()}),[N,A,q]);o.useEffect((()=>{M||w||!q||de()}),[M,w,q,de]),o.useEffect((()=>{if(!$.current)return;const e=new ResizeObserver((e=>{for(const t of e){const{width:e,height:o}=t.contentRect;H(parseInt(e.toFixed(0)),parseInt(o.toFixed(0)))}}));return e.observe($.current),()=>{e.disconnect()}}),[H]);const[fe,he]=o.useState(ne),me=(null==P?void 0:P.formtitle)||"Pickaxe",pe=(null==P?void 0:P.coverphoto)||void 0,[ve,xe]=o.useState(!1);o.useEffect((()=>{const e=!ae&&!_&&T.portalTheme&&(U.filter((e=>"user"===e.role)).length>0||Q||!w);xe(null!=e&&e)}),[ae,_,Q,w,U,T.portalTheme]);const je=o.useCallback((()=>{L.current&&(V(!0),L.current.scrollTo({top:L.current.scrollHeight,behavior:"smooth"}))}),[L,V]);return t.jsxs("div",Object.assign({ref:$,className:"relative flex h-full w-full flex-col items-center overflow-hidden",onDragEnter:e=>{e.preventDefault(),e.stopPropagation(),le&&(te.current+=1,e.dataTransfer.items&&e.dataTransfer.items.length>0&&Z(!0))},onDragLeave:e=>{e.preventDefault(),e.stopPropagation(),le&&(te.current-=1,0===te.current&&Z(!1))},onDragOver:e=>{e.preventDefault(),e.stopPropagation()},onDrop:t=>e.__awaiter(void 0,void 0,void 0,(function*(){if(t.preventDefault(),t.stopPropagation(),Z(!1),te.current=0,!le)return;const e=Array.from(t.dataTransfer.files||[]);e.length>0&&(C(!1),yield B(e))}))},{children:[Y&&t.jsxs("div",Object.assign({className:"absolute inset-0 z-50 flex flex-col items-center justify-center rounded-lg bg-white/80 backdrop-blur-sm transition-all duration-300"},{children:[t.jsx("div",Object.assign({className:"flex h-24 w-24 items-center justify-center rounded-full bg-white shadow-lg animate-bounce text-black"},{children:t.jsx(f.default,{className:"h-10 w-10"})})),t.jsx("h3",Object.assign({className:h.default(W.h3,"mt-6 font-semibold text-c-primary text-black")},{children:(null==F?void 0:F["drop-files-to-upload"])||"Drop files to upload"})),t.jsx("p",Object.assign({className:h.default(W.b2,"mt-2 opacity-60 text-black")},{children:(null==F?void 0:F["add-anything-to-the-conversation"])||"Add anything to the conversation"}))]})),ae?t.jsx(d.default,{}):t.jsxs(t.Fragment,{children:[ve&&t.jsxs("div",Object.assign({className:h.default("direct-link"===S?"absolute top-4 left-4 md:top-6 md:left-6 z-40 flex items-center gap-2 animate-in fade-in slide-in-from-top-4 duration-500":"w-full max-w-3xl mt-6 px-4 md:px-0 flex justify-start z-30 mb-4 animate-in fade-in slide-in-from-top-4 duration-500 gap-2","dark"===T.portalTheme?"glass-dark ":"")},{children:[t.jsx(g.NavPill,{text:me,icon:pe}),w||fe===ne?t.jsx(g.NavPill,{text:fe}):t.jsx(g.EditableNavPill,{text:fe,sessionId:q,onRename:t=>e.__awaiter(void 0,void 0,void 0,(function*(){if(q)try{yield m.pickaxeApi2.patch("/conversation/title",{sessionId:q,name:t,userId:A}),he(t)}catch(e){console.error("Error renaming chat:",e),alert((null==F?void 0:F["failed-rename-chat"])||"Failed to rename chat.")}})),onDelete:()=>e.__awaiter(void 0,void 0,void 0,(function*(){if(q&&window.confirm((null==F?void 0:F["delete-confirm"])||"Are you sure you want to delete this conversation?"))try{yield m.pickaxeApi2.delete("/conversation",{data:{sessionId:q,userId:A}}),C(!0),I(p.v4()),he(ne)}catch(e){console.error("Error deleting chat:",e),alert((null==F?void 0:F["failed-delete-chat"])||"Failed to delete chat.")}})),isDarkGlass:"dark"===T.portalTheme}),t.jsx(v.StudioTip,Object.assign({content:F["chat-history"]||"Chat History",align:"bottom",containerClassName:"inline-flex shrink-0"},{children:t.jsx(g.HistoryPill,{icon:t.jsx(b.default,{}),onClick:()=>{I(""),D(q)}})}))]})),t.jsx(c.default,{additionalScrollHeight:J,isForceHideInfo:R<=545||O<=350||Q,isInputFocused:Q,onSubmit:t=>e.__awaiter(void 0,void 0,void 0,(function*(){ee.current&&ee.current.onSubmit(t)})),smitheryAuthData:oe,resubmitPrompt:()=>{se(null),re(!0)}}),t.jsx(x.default,{isVisible:ue&&!G&&!ce,bottom:J+65,onClick:je}),t.jsx(d.default,{ref:ee,onFocus:()=>X(!0),onBlur:()=>X(!1),onInputHeightChange:K,initSmitheryAuthData:e=>se(e),resubmitPrompt:ie})]})]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),o=require("react"),s=require("../../../hooks/pickaxe/usePickaxeContext.js"),i=require("../Addons/Auth/hooks/useAuthContext.js"),r=require("../../../hooks/pickaxe/useDimensionContext.js"),n=require("../Addons/Document/hooks/useDocument.js"),a=require("../Addons/Scroll/hooks/useScrollContext.js"),l=require("../../../hooks/studio/useStyleFontSize.js"),u=require("../../../hooks/core/useScrollToBottomVisibility.js"),c=require("./History/index.js"),d=require("./Input.js"),h=require("../../Icons/attach-vertical.svg.js"),f=require("../../../common/cn.js"),m=require("../../../common/api/pickaxe.js"),p=require("uuid"),v=require("../../Core/StudioTip.js"),x=require("../common/ScrollToBottomButton.js"),j=require("../../../hooks/pickaxe/useResponseContext.js"),g=require("../Addons/Navbar/NavPill.js"),b=require("../../Icons/history.svg.js");exports.default=()=>{var k,y;const{deploymentType:S,isNewChat:w,setIsNewChat:C,sessionId:q,setSessionId:I,setLastSessionId:D,pickaxeId:N,sender:A,pickaxe:P,styles:T,isEmbed:_,translations:F}=s.usePickaxeContext(),{isSent:E}=i.useAuthContext(),{width:O,height:R,setDimension:H}=r.useDimensionContext(),{setDocuments:z,onFileUpload:B}=n.useDocument(),{scrollContainerRef:L,hasScrolledRef:G,isLocked:M,setIsLocked:V}=a.useScrollContext(),{isGenerating:U,messages:W}=j.useResponseContext(),J=l.useStyleFontSize(),[K,Q]=o.useState(0),[X,Y]=o.useState(!1),[Z,$]=o.useState(!1),ee=o.useRef(null),te=o.useRef(null),oe=o.useRef(0),[se,ie]=o.useState(null),[re,ne]=o.useState(!1),ae=(null==F?void 0:F["new-chat"])||"New chat",le="chat-input"===S&&w&&!E,ue=null!==(y=null===(k=null==P?void 0:P.documentuploadtype)||void 0===k?void 0:k.startsWith("enduserupload"))&&void 0!==y&&y,{hasScrollableContent:ce,isNearBottom:de}=u.default(L);o.useEffect((()=>()=>{z([])}),[]);const he=o.useCallback((()=>{if(!N||!A)return;const t=(o=0)=>e.__awaiter(void 0,void 0,void 0,(function*(){var e;try{const t=yield m.pickaxeApi2.post("/conversation/title",{sessionId:q,userId:A});if(t.data&&t.data.success){const e=t.data.title;if(e&&"Conversation Title"!==e)return void me(e)}else console.error("Failed to load conversation:",null===(e=t.data)||void 0===e?void 0:e.error)}catch(e){console.error("Error fetching conversation:",e)}o<20&&setTimeout((()=>t(o+1)),3e3)}));t()}),[N,A,q]);o.useEffect((()=>{U||w||!q||he()}),[U,w,q,he]),o.useEffect((()=>{if(!ee.current)return;const e=new ResizeObserver((e=>{for(const t of e){const{width:e,height:o}=t.contentRect;H(parseInt(e.toFixed(0)),parseInt(o.toFixed(0)))}}));return e.observe(ee.current),()=>{e.disconnect()}}),[H]);const[fe,me]=o.useState(ae),pe=(null==P?void 0:P.formtitle)||"Pickaxe",ve=(null==P?void 0:P.coverphoto)||void 0,[xe,je]=o.useState(!1);o.useEffect((()=>{const e=!le&&!_&&T.portalTheme&&(W.filter((e=>"user"===e.role)).length>0||X||!w);je(null!=e&&e)}),[le,_,X,w,W,T.portalTheme]);const ge=o.useCallback((()=>{G.current=!1,V(!0),requestAnimationFrame((()=>{const e=L.current;e&&e.scrollTo({top:Math.max(0,e.scrollHeight-e.clientHeight),behavior:"smooth"})}))}),[G,L,V]);return t.jsxs("div",Object.assign({ref:ee,className:"relative flex h-full w-full flex-col items-center overflow-hidden",onDragEnter:e=>{e.preventDefault(),e.stopPropagation(),ue&&(oe.current+=1,e.dataTransfer.items&&e.dataTransfer.items.length>0&&$(!0))},onDragLeave:e=>{e.preventDefault(),e.stopPropagation(),ue&&(oe.current-=1,0===oe.current&&$(!1))},onDragOver:e=>{e.preventDefault(),e.stopPropagation()},onDrop:t=>e.__awaiter(void 0,void 0,void 0,(function*(){if(t.preventDefault(),t.stopPropagation(),$(!1),oe.current=0,!ue)return;const e=Array.from(t.dataTransfer.files||[]);e.length>0&&(C(!1),yield B(e))}))},{children:[Z&&t.jsxs("div",Object.assign({className:"absolute inset-0 z-50 flex flex-col items-center justify-center rounded-lg bg-white/80 backdrop-blur-sm transition-all duration-300"},{children:[t.jsx("div",Object.assign({className:"flex h-24 w-24 items-center justify-center rounded-full bg-white shadow-lg animate-bounce text-black"},{children:t.jsx(h.default,{className:"h-10 w-10"})})),t.jsx("h3",Object.assign({className:f.default(J.h3,"mt-6 font-semibold text-c-primary text-black")},{children:(null==F?void 0:F["drop-files-to-upload"])||"Drop files to upload"})),t.jsx("p",Object.assign({className:f.default(J.b2,"mt-2 opacity-60 text-black")},{children:(null==F?void 0:F["add-anything-to-the-conversation"])||"Add anything to the conversation"}))]})),le?t.jsx(d.default,{}):t.jsxs(t.Fragment,{children:[xe&&t.jsxs("div",Object.assign({className:f.default("direct-link"===S?"absolute top-4 left-4 md:top-6 md:left-6 z-40 flex items-center gap-2 animate-in fade-in slide-in-from-top-4 duration-500":"w-full max-w-3xl mt-6 px-4 md:px-0 flex justify-start z-30 mb-4 animate-in fade-in slide-in-from-top-4 duration-500 gap-2","dark"===T.portalTheme?"glass-dark ":"")},{children:[t.jsx(g.NavPill,{text:pe,icon:ve}),w||fe===ae?t.jsx(g.NavPill,{text:fe}):t.jsx(g.EditableNavPill,{text:fe,sessionId:q,onRename:t=>e.__awaiter(void 0,void 0,void 0,(function*(){if(q)try{yield m.pickaxeApi2.patch("/conversation/title",{sessionId:q,name:t,userId:A}),me(t)}catch(e){console.error("Error renaming chat:",e),alert((null==F?void 0:F["failed-rename-chat"])||"Failed to rename chat.")}})),onDelete:()=>e.__awaiter(void 0,void 0,void 0,(function*(){if(q&&window.confirm((null==F?void 0:F["delete-confirm"])||"Are you sure you want to delete this conversation?"))try{yield m.pickaxeApi2.delete("/conversation",{data:{sessionId:q,userId:A}}),C(!0),I(p.v4()),me(ae)}catch(e){console.error("Error deleting chat:",e),alert((null==F?void 0:F["failed-delete-chat"])||"Failed to delete chat.")}})),isDarkGlass:"dark"===T.portalTheme}),t.jsx(v.StudioTip,Object.assign({content:F["chat-history"]||"Chat History",align:"bottom",containerClassName:"inline-flex shrink-0"},{children:t.jsx(g.HistoryPill,{icon:t.jsx(b.default,{}),onClick:()=>{I(""),D(q)}})}))]})),t.jsx(c.default,{additionalScrollHeight:K,isForceHideInfo:R<=545||O<=350||X,isInputFocused:X,onSubmit:t=>e.__awaiter(void 0,void 0,void 0,(function*(){te.current&&te.current.onSubmit(t)})),smitheryAuthData:se,resubmitPrompt:()=>{ie(null),ne(!0)}}),t.jsx(x.default,{isVisible:ce&&!M&&!de,bottom:K+65,onClick:ge}),t.jsx(d.default,{ref:te,onFocus:()=>Y(!0),onBlur:()=>Y(!1),onInputHeightChange:Q,initSmitheryAuthData:e=>ie(e),resubmitPrompt:re})]})]}))};
@@ -4,13 +4,17 @@ interface UseScrollProps {
4
4
  debug?: boolean;
5
5
  smooth?: boolean;
6
6
  }
7
- export declare const useScroll: ({ auto, debug, smooth }: UseScrollProps) => {
7
+ interface ScrollOptions {
8
+ behavior?: ScrollBehavior;
9
+ force?: boolean;
10
+ }
11
+ export declare const useScroll: ({ auto, debug, smooth, }: UseScrollProps) => {
8
12
  scrollContainerRef: import("react").MutableRefObject<HTMLDivElement>;
9
13
  scrollTargetRef: import("react").MutableRefObject<HTMLDivElement>;
10
14
  isScrollIncreasing: boolean;
11
15
  scrollStartSession: () => void;
12
16
  scrollEndSession: () => void;
13
- scrollToBottom: () => void;
14
- scrollToTarget: () => void;
17
+ scrollToBottom: (options?: ScrollOptions) => void;
18
+ scrollToTarget: (options?: ScrollOptions) => void;
15
19
  };
16
20
  export {};
@@ -1 +1 @@
1
- import{useState as e,useRef as r,useMemo as o,useEffect as t}from"react";import{useScrollContext as n}from"./useScrollContext.js";const l=({auto:l,debug:s,smooth:c=!0})=>{const{scrollContainerRef:u,scrollTargetRef:i,isLocked:d,isScrollSession:a,isScrollIncreasing:g,setIsLocked:v,setIsScrollSession:f,setIsScrolling:m,setIsScrollIncreasing:h}=n(),[S,w]=e(0),p=r(!1),I=o((()=>null!=l&&l&&a),[l,a]),L=o((()=>u&&u.current?u.current:"undefined"==typeof window?null:window),[u]);t((()=>{if(!L)return;const e=e=>{!d||"mousedown"!==e.type&&"touchmove"!==e.type&&"wheel"!==e.type&&"DOMMouseScroll"!==e.type&&"mousewheel"!==e.type||v(!1)};return null==L||L.addEventListener("mousedown",e),null==L||L.addEventListener("touchmove",e),null==L||L.addEventListener("wheel",e),null==L||L.addEventListener("DOMMouseScroll",e),null==L||L.addEventListener("mousewheel",e),()=>{null==L||L.removeEventListener("mousedown",e),null==L||L.removeEventListener("touchmove",e),null==L||L.removeEventListener("wheel",e),null==L||L.removeEventListener("DOMMouseScroll",e),null==L||L.removeEventListener("mousewheel",e)}}),[L,d]),t((()=>{p.current=!d}),[d]),t((()=>{const e=setInterval((()=>{if(!u.current)return;const e=u.current.scrollHeight;if(e===S)return;const r=e>S;s&&console.log("[useScroll] isIncreasing:",r,e,S),h(r),w(e),r&&l&&R()}),100);return()=>clearInterval(e)}),[u,S,l]),t((()=>{const e=setInterval((()=>{if(u.current)return;if(!i.current)return;const e=i.current.getBoundingClientRect().top+i.current.getBoundingClientRect().height+window.scrollY;if(e===S)return;const r=e>S;h(r),w(e),r&&I&&E()}),100);return()=>clearInterval(e)}),[i,S,I]);const R=()=>{try{if(m(!0),!u.current)return void(s&&console.log("[useScroll] scrollContainerRef not detected"));if(p.current)return;const e=u.current.scrollHeight;u.current.scrollTo({top:e,behavior:c?"smooth":"auto"}),s&&console.log("[useScroll] scrolled scrollContainerRef")}finally{m(!1)}},E=()=>{try{if(m(!0),!i.current)return void(s&&console.log("[useScroll] scrollTargetRef not detected"));if(p.current)return;const e=i.current.getBoundingClientRect().top+i.current.getBoundingClientRect().height+window.scrollY;window.scrollTo({top:e-500,behavior:"smooth"}),s&&console.log("[useScroll] scrolled scrollTargetRef")}finally{m(!1)}};return{scrollContainerRef:u,scrollTargetRef:i,isScrollIncreasing:g,scrollStartSession:()=>{f(!0),v(!0),p.current=!1},scrollEndSession:()=>{f(!1)},scrollToBottom:R,scrollToTarget:E}};export{l as useScroll};
1
+ import{useRef as e,useCallback as r,useEffect as t}from"react";import{useScrollContext as o}from"./useScrollContext.js";const n=({auto:n=!1,debug:l,smooth:c=!0})=>{const{scrollContainerRef:s,scrollTargetRef:i,hasScrolledRef:u,isLocked:a,isScrollSession:d,isScrollIncreasing:v,setIsLocked:h,setIsScrollSession:m,setIsScrolling:g,setIsScrollIncreasing:b}=o(),f=e(null),w=e(null),S=e(!1),T=e(0),p=r((()=>{null!==f.current&&(cancelAnimationFrame(f.current),f.current=null)}),[]),R=r((e=>{w.current&&clearTimeout(w.current),w.current=setTimeout((()=>{S.current=!1,g(!1)}),"smooth"===e?400:0)}),[g]),L=r(((e={})=>{var r;if(!e.force&&u.current)return;const t=null!==(r=e.behavior)&&void 0!==r?r:c?"smooth":"auto",o=s.current,n=i.current;if(o||n){if(S.current=!0,g(!0),o){const e=Math.max(0,o.scrollHeight-o.clientHeight);o.scrollTo({top:e,behavior:t})}else if(n){const e=n.getBoundingClientRect().bottom+window.scrollY,r=Math.max(0,e-window.innerHeight);window.scrollTo({top:r,behavior:t})}l&&console.log("[useScroll] scrolled to the active bottom"),R(t)}else l&&console.log("[useScroll] no scroll element detected")}),[l,R,u,s,i,g,c]),E=r(((e={})=>{p(),f.current=requestAnimationFrame((()=>{f.current=null,L(e)}))}),[p,L]),C=r(((e={})=>{var r;if(!e.force&&u.current)return;const t=i.current;if(!t)return void(l&&console.log("[useScroll] scroll target not detected"));const o=null!==(r=e.behavior)&&void 0!==r?r:c?"smooth":"auto",n=t.getBoundingClientRect().bottom+window.scrollY,s=Math.max(0,n-500);S.current=!0,g(!0),window.scrollTo({top:s,behavior:o}),l&&console.log("[useScroll] scrolled to the form response"),R(o)}),[l,R,u,i,g,c]),H=r(((e={})=>{p(),f.current=requestAnimationFrame((()=>{f.current=null,C(e)}))}),[p,C]),I=r((()=>{u.current=!1,h(!0),m(!0)}),[u,h,m]),B=r((()=>{m(!1)}),[m]),x=r(((e={})=>E(e)),[E]),M=r(((e={})=>H(e)),[H]);return t((()=>{if(!n||!d||!a)return;let e=s.current,r=i.current,t=null,o=[];const l=()=>{var o;if(!t)return;const n=e?e.scrollHeight:null!==(o=null==r?void 0:r.getBoundingClientRect().height)&&void 0!==o?o:0,l=n>T.current;T.current=n,b(l),l&&(e?E({behavior:"auto"}):H({behavior:"auto"}))},c=new ResizeObserver(l);function u(){t&&(o.forEach((e=>c.unobserve(e))),o=[t,...Array.from(t.children)],o.forEach((e=>c.observe(e))))}const v=new MutationObserver((()=>{u(),l()}));let h=null;const m=()=>{var o;e=s.current,r=i.current;const n=null!=e?e:r;return!(!n||n===t)&&(v.disconnect(),c.disconnect(),t=n,T.current=e?e.scrollHeight:null!==(o=null==r?void 0:r.getBoundingClientRect().height)&&void 0!==o?o:0,u(),v.observe(t,{childList:!0,subtree:!0}),e?E({behavior:"auto"}):H({behavior:"auto"}),!0)};return m()||(h=new MutationObserver((()=>{m()&&(null==h||h.disconnect())})),h.observe(document.body,{childList:!0,subtree:!0})),()=>{null==h||h.disconnect(),v.disconnect(),c.disconnect()}}),[n,a,d,E,H,s,i,b]),t((()=>{a&&(u.current=!1)}),[u,a]),t((()=>{const e=s.current,r=null!=e?e:window,t=()=>{if(S.current)return;const r=(()=>{if(e)return e.scrollHeight-e.scrollTop-e.clientHeight<=32;const r=i.current;return!r||r.getBoundingClientRect().bottom-window.innerHeight<=32})();u.current=!r,h(r)},o=()=>{S.current&&(S.current=!1,g(!1),w.current&&(clearTimeout(w.current),w.current=null),e?e.scrollTo({top:e.scrollTop,behavior:"auto"}):window.scrollTo({top:window.scrollY,behavior:"auto"}))};return r.addEventListener("scroll",t,{passive:!0}),r.addEventListener("wheel",o,{passive:!0}),r.addEventListener("touchmove",o,{passive:!0}),()=>{r.removeEventListener("scroll",t),r.removeEventListener("wheel",o),r.removeEventListener("touchmove",o)}}),[u,s,i,h,g]),t((()=>()=>{p(),w.current&&clearTimeout(w.current)}),[p]),{scrollContainerRef:s,scrollTargetRef:i,isScrollIncreasing:v,scrollStartSession:I,scrollEndSession:B,scrollToBottom:x,scrollToTarget:M}};export{n as useScroll};
@@ -1 +1 @@
1
- import{__awaiter as t}from"../../../_virtual/_tslib.js";import{jsxs as e,jsx as o,Fragment as i}from"react/jsx-runtime";import{useState as r,useRef as n,useEffect as s,useCallback as a}from"react";import{usePickaxeContext as l}from"../../../hooks/pickaxe/usePickaxeContext.js";import{useAuthContext as c}from"../Addons/Auth/hooks/useAuthContext.js";import{useDimensionContext as d}from"../../../hooks/pickaxe/useDimensionContext.js";import{useDocument as m}from"../Addons/Document/hooks/useDocument.js";import{useScrollContext as u}from"../Addons/Scroll/hooks/useScrollContext.js";import{useStyleFontSize as p}from"../../../hooks/studio/useStyleFontSize.js";import f from"../../../hooks/core/useScrollToBottomVisibility.js";import h from"./History/index.js";import v from"./Input.js";import g from"../../Icons/attach-vertical.svg.js";import x from"../../../common/cn.js";import{pickaxeApi2 as b}from"../../../common/api/pickaxe.js";import{v4 as k}from"uuid";import{StudioTip as j}from"../../Core/StudioTip.js";import y from"../common/ScrollToBottomButton.js";import{useResponseContext as I}from"../../../hooks/pickaxe/useResponseContext.js";import{NavPill as w,EditableNavPill as D,HistoryPill as C}from"../Addons/Navbar/NavPill.js";import S from"../../Icons/history.svg.js";const N=()=>{var N,T;const{deploymentType:A,isNewChat:F,setIsNewChat:O,sessionId:P,setSessionId:H,setLastSessionId:z,pickaxeId:B,sender:E,pickaxe:R,styles:L,isEmbed:G,translations:V}=l(),{isSent:_}=c(),{width:U,height:W,setDimension:q}=d(),{setDocuments:J,onFileUpload:K}=m(),{scrollContainerRef:M,isLocked:Q,setIsLocked:X}=u(),{isGenerating:Y,messages:Z}=I(),$=p(),[tt,et]=r(0),[ot,it]=r(!1),[rt,nt]=r(!1),st=n(null),at=n(null),lt=n(0),[ct,dt]=r(null),[mt,ut]=r(!1),pt=(null==V?void 0:V["new-chat"])||"New chat",ft="chat-input"===A&&F&&!_,ht=null!==(T=null===(N=null==R?void 0:R.documentuploadtype)||void 0===N?void 0:N.startsWith("enduserupload"))&&void 0!==T&&T,{hasScrollableContent:vt,isNearBottom:gt}=f(M);s((()=>()=>{J([])}),[]);const xt=a((()=>{if(!B||!E)return;const e=(o=0)=>t(void 0,void 0,void 0,(function*(){var t;try{const e=yield b.post("/conversation/title",{sessionId:P,userId:E});if(e.data&&e.data.success){const t=e.data.title;if(t&&"Conversation Title"!==t)return void kt(t)}else console.error("Failed to load conversation:",null===(t=e.data)||void 0===t?void 0:t.error)}catch(t){console.error("Error fetching conversation:",t)}o<20&&setTimeout((()=>e(o+1)),3e3)}));e()}),[B,E,P]);s((()=>{Y||F||!P||xt()}),[Y,F,P,xt]),s((()=>{if(!st.current)return;const t=new ResizeObserver((t=>{for(const e of t){const{width:t,height:o}=e.contentRect;q(parseInt(t.toFixed(0)),parseInt(o.toFixed(0)))}}));return t.observe(st.current),()=>{t.disconnect()}}),[q]);const[bt,kt]=r(pt),jt=(null==R?void 0:R.formtitle)||"Pickaxe",yt=(null==R?void 0:R.coverphoto)||void 0,[It,wt]=r(!1);s((()=>{const t=!ft&&!G&&L.portalTheme&&(Z.filter((t=>"user"===t.role)).length>0||ot||!F);wt(null!=t&&t)}),[ft,G,ot,F,Z,L.portalTheme]);const Dt=a((()=>{M.current&&(X(!0),M.current.scrollTo({top:M.current.scrollHeight,behavior:"smooth"}))}),[M,X]);return e("div",Object.assign({ref:st,className:"relative flex h-full w-full flex-col items-center overflow-hidden",onDragEnter:t=>{t.preventDefault(),t.stopPropagation(),ht&&(lt.current+=1,t.dataTransfer.items&&t.dataTransfer.items.length>0&&nt(!0))},onDragLeave:t=>{t.preventDefault(),t.stopPropagation(),ht&&(lt.current-=1,0===lt.current&&nt(!1))},onDragOver:t=>{t.preventDefault(),t.stopPropagation()},onDrop:e=>t(void 0,void 0,void 0,(function*(){if(e.preventDefault(),e.stopPropagation(),nt(!1),lt.current=0,!ht)return;const t=Array.from(e.dataTransfer.files||[]);t.length>0&&(O(!1),yield K(t))}))},{children:[rt&&e("div",Object.assign({className:"absolute inset-0 z-50 flex flex-col items-center justify-center rounded-lg bg-white/80 backdrop-blur-sm transition-all duration-300"},{children:[o("div",Object.assign({className:"flex h-24 w-24 items-center justify-center rounded-full bg-white shadow-lg animate-bounce text-black"},{children:o(g,{className:"h-10 w-10"})})),o("h3",Object.assign({className:x($.h3,"mt-6 font-semibold text-c-primary text-black")},{children:(null==V?void 0:V["drop-files-to-upload"])||"Drop files to upload"})),o("p",Object.assign({className:x($.b2,"mt-2 opacity-60 text-black")},{children:(null==V?void 0:V["add-anything-to-the-conversation"])||"Add anything to the conversation"}))]})),ft?o(v,{}):e(i,{children:[It&&e("div",Object.assign({className:x("direct-link"===A?"absolute top-4 left-4 md:top-6 md:left-6 z-40 flex items-center gap-2 animate-in fade-in slide-in-from-top-4 duration-500":"w-full max-w-3xl mt-6 px-4 md:px-0 flex justify-start z-30 mb-4 animate-in fade-in slide-in-from-top-4 duration-500 gap-2","dark"===L.portalTheme?"glass-dark ":"")},{children:[o(w,{text:jt,icon:yt}),F||bt===pt?o(w,{text:bt}):o(D,{text:bt,sessionId:P,onRename:e=>t(void 0,void 0,void 0,(function*(){if(P)try{yield b.patch("/conversation/title",{sessionId:P,name:e,userId:E}),kt(e)}catch(t){console.error("Error renaming chat:",t),alert((null==V?void 0:V["failed-rename-chat"])||"Failed to rename chat.")}})),onDelete:()=>t(void 0,void 0,void 0,(function*(){if(P&&window.confirm((null==V?void 0:V["delete-confirm"])||"Are you sure you want to delete this conversation?"))try{yield b.delete("/conversation",{data:{sessionId:P,userId:E}}),O(!0),H(k()),kt(pt)}catch(t){console.error("Error deleting chat:",t),alert((null==V?void 0:V["failed-delete-chat"])||"Failed to delete chat.")}})),isDarkGlass:"dark"===L.portalTheme}),o(j,Object.assign({content:V["chat-history"]||"Chat History",align:"bottom",containerClassName:"inline-flex shrink-0"},{children:o(C,{icon:o(S,{}),onClick:()=>{H(""),z(P)}})}))]})),o(h,{additionalScrollHeight:tt,isForceHideInfo:W<=545||U<=350||ot,isInputFocused:ot,onSubmit:e=>t(void 0,void 0,void 0,(function*(){at.current&&at.current.onSubmit(e)})),smitheryAuthData:ct,resubmitPrompt:()=>{dt(null),ut(!0)}}),o(y,{isVisible:vt&&!Q&&!gt,bottom:tt+65,onClick:Dt}),o(v,{ref:at,onFocus:()=>it(!0),onBlur:()=>it(!1),onInputHeightChange:et,initSmitheryAuthData:t=>dt(t),resubmitPrompt:mt})]})]}))};export{N as default};
1
+ import{__awaiter as e}from"../../../_virtual/_tslib.js";import{jsxs as t,jsx as o,Fragment as i}from"react/jsx-runtime";import{useState as r,useRef as n,useEffect as s,useCallback as a}from"react";import{usePickaxeContext as l}from"../../../hooks/pickaxe/usePickaxeContext.js";import{useAuthContext as c}from"../Addons/Auth/hooks/useAuthContext.js";import{useDimensionContext as d}from"../../../hooks/pickaxe/useDimensionContext.js";import{useDocument as m}from"../Addons/Document/hooks/useDocument.js";import{useScrollContext as u}from"../Addons/Scroll/hooks/useScrollContext.js";import{useStyleFontSize as h}from"../../../hooks/studio/useStyleFontSize.js";import f from"../../../hooks/core/useScrollToBottomVisibility.js";import p from"./History/index.js";import v from"./Input.js";import g from"../../Icons/attach-vertical.svg.js";import x from"../../../common/cn.js";import{pickaxeApi2 as b}from"../../../common/api/pickaxe.js";import{v4 as k}from"uuid";import{StudioTip as j}from"../../Core/StudioTip.js";import y from"../common/ScrollToBottomButton.js";import{useResponseContext as I}from"../../../hooks/pickaxe/useResponseContext.js";import{NavPill as w,EditableNavPill as D,HistoryPill as C}from"../Addons/Navbar/NavPill.js";import S from"../../Icons/history.svg.js";const N=()=>{var N,T;const{deploymentType:A,isNewChat:F,setIsNewChat:O,sessionId:P,setSessionId:H,setLastSessionId:R,pickaxeId:z,sender:B,pickaxe:E,styles:L,isEmbed:G,translations:V}=l(),{isSent:_}=c(),{width:q,height:M,setDimension:U}=d(),{setDocuments:W,onFileUpload:J}=m(),{scrollContainerRef:K,hasScrolledRef:Q,isLocked:X,setIsLocked:Y}=u(),{isGenerating:Z,messages:$}=I(),ee=h(),[te,oe]=r(0),[ie,re]=r(!1),[ne,se]=r(!1),ae=n(null),le=n(null),ce=n(0),[de,me]=r(null),[ue,he]=r(!1),fe=(null==V?void 0:V["new-chat"])||"New chat",pe="chat-input"===A&&F&&!_,ve=null!==(T=null===(N=null==E?void 0:E.documentuploadtype)||void 0===N?void 0:N.startsWith("enduserupload"))&&void 0!==T&&T,{hasScrollableContent:ge,isNearBottom:xe}=f(K);s((()=>()=>{W([])}),[]);const be=a((()=>{if(!z||!B)return;const t=(o=0)=>e(void 0,void 0,void 0,(function*(){var e;try{const t=yield b.post("/conversation/title",{sessionId:P,userId:B});if(t.data&&t.data.success){const e=t.data.title;if(e&&"Conversation Title"!==e)return void je(e)}else console.error("Failed to load conversation:",null===(e=t.data)||void 0===e?void 0:e.error)}catch(e){console.error("Error fetching conversation:",e)}o<20&&setTimeout((()=>t(o+1)),3e3)}));t()}),[z,B,P]);s((()=>{Z||F||!P||be()}),[Z,F,P,be]),s((()=>{if(!ae.current)return;const e=new ResizeObserver((e=>{for(const t of e){const{width:e,height:o}=t.contentRect;U(parseInt(e.toFixed(0)),parseInt(o.toFixed(0)))}}));return e.observe(ae.current),()=>{e.disconnect()}}),[U]);const[ke,je]=r(fe),ye=(null==E?void 0:E.formtitle)||"Pickaxe",Ie=(null==E?void 0:E.coverphoto)||void 0,[we,De]=r(!1);s((()=>{const e=!pe&&!G&&L.portalTheme&&($.filter((e=>"user"===e.role)).length>0||ie||!F);De(null!=e&&e)}),[pe,G,ie,F,$,L.portalTheme]);const Ce=a((()=>{Q.current=!1,Y(!0),requestAnimationFrame((()=>{const e=K.current;e&&e.scrollTo({top:Math.max(0,e.scrollHeight-e.clientHeight),behavior:"smooth"})}))}),[Q,K,Y]);return t("div",Object.assign({ref:ae,className:"relative flex h-full w-full flex-col items-center overflow-hidden",onDragEnter:e=>{e.preventDefault(),e.stopPropagation(),ve&&(ce.current+=1,e.dataTransfer.items&&e.dataTransfer.items.length>0&&se(!0))},onDragLeave:e=>{e.preventDefault(),e.stopPropagation(),ve&&(ce.current-=1,0===ce.current&&se(!1))},onDragOver:e=>{e.preventDefault(),e.stopPropagation()},onDrop:t=>e(void 0,void 0,void 0,(function*(){if(t.preventDefault(),t.stopPropagation(),se(!1),ce.current=0,!ve)return;const e=Array.from(t.dataTransfer.files||[]);e.length>0&&(O(!1),yield J(e))}))},{children:[ne&&t("div",Object.assign({className:"absolute inset-0 z-50 flex flex-col items-center justify-center rounded-lg bg-white/80 backdrop-blur-sm transition-all duration-300"},{children:[o("div",Object.assign({className:"flex h-24 w-24 items-center justify-center rounded-full bg-white shadow-lg animate-bounce text-black"},{children:o(g,{className:"h-10 w-10"})})),o("h3",Object.assign({className:x(ee.h3,"mt-6 font-semibold text-c-primary text-black")},{children:(null==V?void 0:V["drop-files-to-upload"])||"Drop files to upload"})),o("p",Object.assign({className:x(ee.b2,"mt-2 opacity-60 text-black")},{children:(null==V?void 0:V["add-anything-to-the-conversation"])||"Add anything to the conversation"}))]})),pe?o(v,{}):t(i,{children:[we&&t("div",Object.assign({className:x("direct-link"===A?"absolute top-4 left-4 md:top-6 md:left-6 z-40 flex items-center gap-2 animate-in fade-in slide-in-from-top-4 duration-500":"w-full max-w-3xl mt-6 px-4 md:px-0 flex justify-start z-30 mb-4 animate-in fade-in slide-in-from-top-4 duration-500 gap-2","dark"===L.portalTheme?"glass-dark ":"")},{children:[o(w,{text:ye,icon:Ie}),F||ke===fe?o(w,{text:ke}):o(D,{text:ke,sessionId:P,onRename:t=>e(void 0,void 0,void 0,(function*(){if(P)try{yield b.patch("/conversation/title",{sessionId:P,name:t,userId:B}),je(t)}catch(e){console.error("Error renaming chat:",e),alert((null==V?void 0:V["failed-rename-chat"])||"Failed to rename chat.")}})),onDelete:()=>e(void 0,void 0,void 0,(function*(){if(P&&window.confirm((null==V?void 0:V["delete-confirm"])||"Are you sure you want to delete this conversation?"))try{yield b.delete("/conversation",{data:{sessionId:P,userId:B}}),O(!0),H(k()),je(fe)}catch(e){console.error("Error deleting chat:",e),alert((null==V?void 0:V["failed-delete-chat"])||"Failed to delete chat.")}})),isDarkGlass:"dark"===L.portalTheme}),o(j,Object.assign({content:V["chat-history"]||"Chat History",align:"bottom",containerClassName:"inline-flex shrink-0"},{children:o(C,{icon:o(S,{}),onClick:()=>{H(""),R(P)}})}))]})),o(p,{additionalScrollHeight:te,isForceHideInfo:M<=545||q<=350||ie,isInputFocused:ie,onSubmit:t=>e(void 0,void 0,void 0,(function*(){le.current&&le.current.onSubmit(t)})),smitheryAuthData:de,resubmitPrompt:()=>{me(null),he(!0)}}),o(y,{isVisible:ge&&!X&&!xe,bottom:te+65,onClick:Ce}),o(v,{ref:le,onFocus:()=>re(!0),onBlur:()=>re(!1),onInputHeightChange:oe,initSmitheryAuthData:e=>me(e),resubmitPrompt:ue})]})]}))};export{N as default};
@@ -4,13 +4,17 @@ interface UseScrollProps {
4
4
  debug?: boolean;
5
5
  smooth?: boolean;
6
6
  }
7
- export declare const useScroll: ({ auto, debug, smooth }: UseScrollProps) => {
7
+ interface ScrollOptions {
8
+ behavior?: ScrollBehavior;
9
+ force?: boolean;
10
+ }
11
+ export declare const useScroll: ({ auto, debug, smooth, }: UseScrollProps) => {
8
12
  scrollContainerRef: import("react").MutableRefObject<HTMLDivElement>;
9
13
  scrollTargetRef: import("react").MutableRefObject<HTMLDivElement>;
10
14
  isScrollIncreasing: boolean;
11
15
  scrollStartSession: () => void;
12
16
  scrollEndSession: () => void;
13
- scrollToBottom: () => void;
14
- scrollToTarget: () => void;
17
+ scrollToBottom: (options?: ScrollOptions) => void;
18
+ scrollToTarget: (options?: ScrollOptions) => void;
15
19
  };
16
20
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pickaxeproject/react",
3
- "version": "6.10.4",
3
+ "version": "6.11.0",
4
4
  "description": "Client utility library for Pickaxe",
5
5
  "repository": {
6
6
  "type": "git",