sage-nexus-ui 1.13.9 → 1.13.10
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/components/ActionBar.mjs +1 -1
- package/dist/components/NexusChat/ChatComponents/MessageList.mjs +1 -1
- package/dist/components/NexusChat/ChatHistory.mjs +1 -1
- package/dist/components/NexusChat/ChatHistoryHeader.mjs +1 -1
- package/dist/components/NexusChat/FABButton.mjs +1 -1
- package/dist/components/NexusChat/NexusChatWidget.mjs +1 -1
- package/dist/generated/version.mjs +1 -1
- package/dist/index.d.ts +6 -2
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,Fragment as n,jsx as t}from"react/jsx-runtime";import{useTheme as i,useMediaQuery as r,AppBar as l,Toolbar as
|
|
1
|
+
import{jsxs as e,Fragment as n,jsx as t}from"react/jsx-runtime";import{useTheme as i,useMediaQuery as r,AppBar as l,Toolbar as s,Box as o}from"@mui/material";import{NexusHome as c}from"./NexusHome.mjs";import{ThemeToggle as d}from"./ThemeToggle.mjs";import a from"./NexusLogo.mjs";import{ActionBarTitle as x}from"./Typography.mjs";import{useRef as f,useState as u,useEffect as h}from"react";const m=({title:m,extraLeft:p,extraRight:g,homeHref:y,showHome:w=!0})=>{const v=i(),b=r(v.breakpoints.up("md")),C=f(null),[I,j]=u(49),R=f(null),k=f(null),B=f(null),z=f(null),E=f(null),L=f(null),[M,A]=u(null),[H,T]=u(null);return h(()=>{const e=C.current;if(!e)return;const n=()=>j(e.getBoundingClientRect().height);n();const t=window.ResizeObserver;if(!t)return;const i=new t(n);return i.observe(e),()=>i.disconnect()},[]),h(()=>{if(!b)return A(null),void T(null);function e(){const e=k.current,n=B.current,t=R.current,i=z.current,r=E.current,l=L.current;if(!e||!n||!t)return;const s=e.getBoundingClientRect(),o=n.getBoundingClientRect(),c=t.getBoundingClientRect();if(i){const e=i.getBoundingClientRect().width||0,n=(s.right+o.left)/2,t=s.right+e/2+8,r=o.left-e/2-8,l=Math.min(Math.max(n,t),r);A(l-c.left)}else A(null);if(r&&l){const e=r.getBoundingClientRect().width||0,n=l.getBoundingClientRect(),t=(o.right+n.left)/2,i=o.right+e/2+8,s=n.left-e/2-8,d=Math.min(Math.max(t,i),s);T(d-c.left)}else T(null)}e(),window.addEventListener("resize",e);let n=null;const t=window.ResizeObserver;return t&&(n=new t(e),R.current&&n.observe(R.current)),()=>{window.removeEventListener("resize",e),n&&n.disconnect()}},[b,p,g]),e(n,{children:[t(l,{position:"sticky",component:"header",color:"inherit",elevation:0,ref:C,sx:{zIndex:{xs:v.zIndex.appBar,md:v.zIndex.drawer+1},[v.breakpoints.up("md")]:{position:"fixed"}},children:e(s,{variant:"dense",sx:{display:"flex",flexDirection:{xs:"column",md:"row"},flexWrap:"wrap",alignItems:"center",justifyContent:{xs:"center",md:"space-between"},py:{xs:1,md:0}},children:[e(o,{sx:{display:{xs:"flex",md:"none"},width:"100%",alignItems:"center"},children:[t(o,{sx:{flex:1}}),t(x,{children:m}),e(o,{sx:{flex:1,display:"flex",justifyContent:"flex-end",alignItems:"center",gap:.5},children:[w&&t(c,{href:y}),t(d,{})]})]}),(p||g)&&e(o,{sx:{display:{xs:"flex",md:"none"},justifyContent:"center",alignItems:"center",gap:1,width:"100%"},children:[p&&t(o,{children:p}),g&&t(o,{children:g})]}),t(o,{sx:{display:{xs:"none",md:"block"},width:"100%"},children:e(o,{sx:{display:"flex",flexDirection:"row",alignItems:"center",width:"100%",position:"relative"},ref:R,children:[t(o,{sx:{display:"flex",alignItems:"center",flex:1,justifyContent:"flex-start"},children:t(o,{sx:{height:"38px",pt:.5},ref:k,children:t(a,{})})}),t(o,{sx:{display:"flex",justifyContent:"center",alignItems:"center",position:"absolute",left:0,right:0,pointerEvents:"none"},children:t(o,{sx:{pointerEvents:"auto",textAlign:"center"},children:t(o,{ref:B,children:t(x,{children:m})})})}),t(o,{sx:{display:p?"block":"none",position:"absolute",left:null!=M?`${M}px`:void 0,transform:"translateX(-50%)",pointerEvents:"auto",textAlign:"center"},children:t(o,{ref:z,children:p})}),t(o,{sx:{display:g?"block":"none",position:"absolute",left:null!=H?`${H}px`:void 0,transform:"translateX(-50%)",pointerEvents:"auto",textAlign:"center"},children:t(o,{ref:E,children:g})}),t(o,{sx:{display:"flex",alignItems:"center",flex:1,justifyContent:"flex-end"},children:e(o,{sx:{flex:"0 0 auto",display:"flex",alignItems:"center",gap:1},ref:L,children:[w&&t(c,{href:y}),t(d,{})]})})]})})]})}),t(o,{sx:{display:{xs:"none",md:"block"},height:`${I}px`,flexShrink:0}})]})};export{m as ActionBar};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as t,jsx as
|
|
1
|
+
import{jsxs as t,jsx as r}from"react/jsx-runtime";import{useRef as e,useEffect as o}from"react";import{Box as n}from"../../Box.mjs";import i from"./MessageBubble.mjs";import l from"./StreamingBubble.mjs";import c from"./TypingIndicator.mjs";import{latestTraceLabel as s}from"./latestTraceLabel.mjs";const a=({messages:a,isTyping:m,streamingText:h,liveTraceEvents:g,highlightQuery:u,onAbort:p,avatarIcon:f,showActivity:v=!1})=>{const b=e(null),x=e(null),y=e(!1),I=e(a.length);o(()=>{const t=a[a.length-1];a.length>I.current&&"user"===t?.role&&(y.current=!1,b.current?.scrollIntoView({behavior:"smooth"})),I.current=a.length},[a]),o(()=>{y.current||b.current?.scrollIntoView({behavior:"smooth"})},[m,h]);const d=(h||"").trim().length>0,j=m&&d,w=m&&!j;return t(n,{ref:x,onScroll:()=>{y.current=!(()=>{const t=x.current;return!t||t.scrollHeight-t.scrollTop-t.clientHeight<80})()},sx:{flex:1,minHeight:0,overflowY:"auto",display:"flex",flexDirection:"column",gap:1.5,px:2,py:1.5},children:[a.filter(t=>"user"===t.role||t.content).map(t=>r(i,{message:t,highlightQuery:u,avatarIcon:f,showActivity:v},t.id)),j&&r(l,{text:h||"",traceEvents:g||[],highlightQuery:u,avatarIcon:f,onAbort:p,showActivity:v}),w&&r(c,{avatarIcon:f,traceLabel:g&&g.length>0?s(g):void 0}),r(n,{ref:b})]})};export{a as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{jsx as e,jsxs as o}from"react/jsx-runtime";import{useState as t,useCallback as n}from"react";import r from"@mui/icons-material/ChevronRight";import{Caption as i}from"../Typography.mjs";import{Box as s}from"../Box.mjs";import{Stack as a}from"../Stack.mjs";import{IconButton as l}from"../IconButton.mjs";import{ChatHistoryHeader as c}from"./ChatHistoryHeader.mjs";import{ChatHistoryButtonBase as h}from"./ChatHistoryButtonBase.mjs";const m=({conversations:m,activeConversationId:d,onSelectConversation:p,onDeleteConversation:C,onNewConversation:f,onClose:x,onSearchChange:v,title:g="Chat history",emptyText:y="No conversations yet",newChatTitle:u="New chat",deleteConversationTitle:w="Delete conversation",searchPlaceholder:j="Search chat histories",searchDebounceMs:S=300,width:T=288,sx:b,formatMessageCount:D=e=>`${e} messages`,isCollapsed:k=!1,onToggleCollapse:A,collapsedWidth:B=40})=>{const[H,M]=t(""),N=n(e=>{M(e),v?.(e)},[v]);return e(s,{sx:{width:k?B:T,minWidth:k?B:0,flexShrink:0,borderRight:1,borderColor:"divider",overflow:"hidden",transition:"width 0.2s ease, min-width 0.2s ease",display:"flex",flexDirection:"column"},children:k?e(s,{sx:{display:"flex",justifyContent:"center",alignItems:"flex-start",pt:1},children:e(l,{onClick:A,title:"Expand history",ariaLabel:"expand-history",children:e(r,{sx:{fontSize:16}})})}):o(a,{direction:"column",sx:[{flex:1,minHeight:0},...Array.isArray(b)?b:b?[b]:[]],children:[e(c,{title:g,newChatTitle:u,onNewConversation:f,onClose:x,onToggleCollapse:A,onSearchChange:N,searchPlaceholder:j,searchDebounceMs:S}),e(s,{component:"nav","aria-label":g,sx:{flex:1,overflowY:"auto",p:1},children:0===m.length?e(i,{sx:{display:"block",textAlign:"center",py:4},children:y}):m.map(o=>{const t=o.id===d;return e(h,{conversation:o,isActive:t,highlightQuery:H,onSelectConversation:p,onDeleteConversation:C,deleteConversationTitle:w,formatMessageCount:D},o.id)})})]})})};export{m as ChatHistory};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as r}from"react/jsx-runtime";import i from"@mui/icons-material/Add";import
|
|
1
|
+
import{jsxs as e,jsx as r}from"react/jsx-runtime";import i from"@mui/icons-material/Add";import o from"@mui/icons-material/ChevronLeft";import t from"@mui/icons-material/Clear";import a from"@mui/icons-material/Search";import{InputAdornment as l}from"@mui/material";import{useState as n,useEffect as s}from"react";import{Box as c}from"../Box.mjs";import{H3 as m}from"../Typography.mjs";import{IconButton as h}from"../IconButton.mjs";import{Stack as d}from"../Stack.mjs";import{TextField as p}from"../TextField.mjs";const f=({title:f,newChatTitle:u,onNewConversation:C,onClose:x,onToggleCollapse:b,onSearchChange:g,searchPlaceholder:S="Search chat histories",searchDebounceMs:w=300})=>{const[y,j]=n("");return s(()=>{if(!g)return;const e=window.setTimeout(()=>{g(y)},w);return()=>window.clearTimeout(e)},[g,w,y]),e(d,{direction:"column",spacing:1,sx:{px:2,py:2,borderBottom:1,borderColor:"divider"},children:[e(d,{direction:"row",spacing:2,sx:{alignItems:"center",justifyContent:"space-between"},children:[r(m,{children:f}),e(d,{direction:"row",sx:{alignItems:"center"},children:[r(h,{onClick:C,title:u,ariaLabel:u,disabled:!C,children:r(i,{sx:{fontSize:16}})}),b&&r(h,{onClick:b,title:"Collapse history",ariaLabel:"collapse-history",children:r(o,{sx:{fontSize:16}})}),x&&r(h,{onClick:x,title:"Close history",ariaLabel:"close-history",children:r(o,{sx:{fontSize:16}})})]})]}),e(c,{sx:{display:"flex",alignItems:"center",gap:.75},children:[r(p,{fullWidth:!0,size:"small",value:y,onChange:e=>j(e.target.value),placeholder:S,slotProps:{htmlInput:{"aria-label":"Search chat histories"},input:{startAdornment:r(l,{position:"start",children:r(a,{sx:{fontSize:16,color:"text.disabled"}})})}}}),r(h,{title:"Clear search",ariaLabel:"clear-search",onClick:()=>j(""),disabled:!y,children:r(t,{sx:{fontSize:14}})})]})]})};export{f as ChatHistoryHeader};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as t}from"react/jsx-runtime";import{Box as o}from"../Box.mjs";import{AiButton as
|
|
1
|
+
import{jsx as t}from"react/jsx-runtime";import{Box as o}from"../Box.mjs";import{AiButton as m}from"../AiButton.mjs";const e=({onOpen:e,fabLabel:r,placement:i="bottom-right"})=>t(o,{sx:{position:"fixed",bottom:{xs:16,sm:24},..."bottom-left"===i?{left:{xs:16,sm:24}}:{right:{xs:16,sm:24}},zIndex:t=>t.zIndex.appBar+50},children:t(m,{onClick:e,label:r,"aria-label":r})});export{e as FABButton};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,Fragment as t,jsx as
|
|
1
|
+
import{jsxs as e,Fragment as t,jsx as s}from"react/jsx-runtime";import{FABButton as o}from"./FABButton.mjs";import{GlassPaper as i}from"../GlassPaper.mjs";import a from"./WidgetParts/WidgetBody.mjs";import n from"./WidgetParts/WidgetHeader.mjs";import r from"./WidgetParts/WidgetInput.mjs";const m=["Summarise my latest data","What changed this week?","Show me the key trends","Help me understand my metrics"];function l({title:l="Ask Nexus",subtitle:d="Ready to help",fabLabel:p="Ask Nexus",avatarIcon:c,placeholder:x,emptyTitle:u="Ask Nexus",emptyDescription:g="Ask me anything about your data and I'll help you find answers.",dataSources:h,suggestedPrompts:f=m,isOpen:y,isTyping:b,messages:v,streamingText:T,liveTraceEvents:w,showActivity:A=!1,onOpen:P,onClose:S,onSend:I,onAbort:W,onExpandToFullPage:j,hideFab:k=!1,placement:B="bottom-right"}){if(k)return null;return e(t,{children:[y&&e(i,{elevation:8,sx:{boxShadow:e=>e.shadows[2],borderRadius:3,position:"fixed",bottom:{xs:16,sm:24},..."bottom-left"===B?{left:{xs:16,sm:24}}:{right:{xs:16,sm:24}},zIndex:e=>e.zIndex.appBar+50,display:"flex",flexDirection:"column",width:{xs:"calc(100vw - 32px)",sm:380},maxHeight:{xs:"min(560px, calc(100dvh - 88px))",sm:"min(520px, calc(100dvh - 104px))"},overflow:"hidden",p:0,"& > div":{display:"flex",flexDirection:"column",flex:1,minHeight:0}},children:[s(n,{title:l,subtitle:d,onExpandToFullPage:j,onClose:S,avatarIcon:c}),s(a,{avatarIcon:c,isTyping:b,liveTraceEvents:w,messages:v,onAbort:W,showActivity:A,streamingText:T,emptyTitle:u,emptyDescription:g,dataSources:h,suggestedPrompts:f,onSend:I}),s(r,{placeholder:x,isTyping:b,onSend:I})]}),!y&&s(o,{onOpen:P,fabLabel:p,placement:B})]})}export{l as NexusChatWidget};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const o="1.13.
|
|
1
|
+
const o="1.13.10";export{o as SAGE_NEXUS_UI_VERSION};
|
package/dist/index.d.ts
CHANGED
|
@@ -172,6 +172,9 @@ interface ChatHistoryProps {
|
|
|
172
172
|
width?: number | string;
|
|
173
173
|
sx?: BoxProps["sx"];
|
|
174
174
|
formatMessageCount?: (count: number) => string;
|
|
175
|
+
isCollapsed?: boolean;
|
|
176
|
+
onToggleCollapse?: () => void;
|
|
177
|
+
collapsedWidth?: number;
|
|
175
178
|
}
|
|
176
179
|
|
|
177
180
|
interface NexusChatDialogProps {
|
|
@@ -252,18 +255,19 @@ interface ChatInputProps {
|
|
|
252
255
|
}
|
|
253
256
|
declare const ChatInput: ({ onSend, disabled, placeholder, maxRows, sendButtonTitle, }: ChatInputProps) => react_jsx_runtime.JSX.Element;
|
|
254
257
|
|
|
255
|
-
declare const ChatHistory: ({ conversations, activeConversationId, onSelectConversation, onDeleteConversation, onNewConversation, onClose, onSearchChange, title, emptyText, newChatTitle, deleteConversationTitle, searchPlaceholder, searchDebounceMs, width, sx, formatMessageCount, }: ChatHistoryProps) => react_jsx_runtime.JSX.Element;
|
|
258
|
+
declare const ChatHistory: ({ conversations, activeConversationId, onSelectConversation, onDeleteConversation, onNewConversation, onClose, onSearchChange, title, emptyText, newChatTitle, deleteConversationTitle, searchPlaceholder, searchDebounceMs, width, sx, formatMessageCount, isCollapsed, onToggleCollapse, collapsedWidth, }: ChatHistoryProps) => react_jsx_runtime.JSX.Element;
|
|
256
259
|
|
|
257
260
|
interface ChatHistoryHeaderProps {
|
|
258
261
|
title: string;
|
|
259
262
|
newChatTitle: string;
|
|
260
263
|
onNewConversation?: () => void;
|
|
261
264
|
onClose?: () => void;
|
|
265
|
+
onToggleCollapse?: () => void;
|
|
262
266
|
onSearchChange?: (query: string) => void;
|
|
263
267
|
searchPlaceholder?: string;
|
|
264
268
|
searchDebounceMs?: number;
|
|
265
269
|
}
|
|
266
|
-
declare const ChatHistoryHeader: ({ title, newChatTitle, onNewConversation, onClose, onSearchChange, searchPlaceholder, searchDebounceMs, }: ChatHistoryHeaderProps) => react_jsx_runtime.JSX.Element;
|
|
270
|
+
declare const ChatHistoryHeader: ({ title, newChatTitle, onNewConversation, onClose, onToggleCollapse, onSearchChange, searchPlaceholder, searchDebounceMs, }: ChatHistoryHeaderProps) => react_jsx_runtime.JSX.Element;
|
|
267
271
|
|
|
268
272
|
interface ChatHistoryButtonBaseProps {
|
|
269
273
|
conversation: ChatHistoryConversation;
|