sage-nexus-ui 1.13.5 → 1.13.6

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
- import{jsx as e,jsxs as n}from"react/jsx-runtime";import{useTheme as t,useMediaQuery as i,AppBar as r,Toolbar as l,Box as s}from"@mui/material";import{NexusHome as o}from"./NexusHome.mjs";import{ThemeToggle as d}from"./ThemeToggle.mjs";import c from"./NexusLogo.mjs";import{ActionBarTitle as a}from"./Typography.mjs";import{useState as x,useRef as m,useEffect as u}from"react";const f=({title:f,extraLeft:h,extraRight:p,homeHref:g})=>{const[w,y]=x(!0),v=m(0),b=t(),C=i(b.breakpoints.up("md")),j=m(null),E=m(null),R=m(null),k=m(null),I=m(null),B=m(null),[L,A]=x(null),[M,z]=x(null);return u(()=>{const e=()=>{const e=window.scrollY;e>v.current?y(!1):y(!0),v.current=e};return window.addEventListener("scroll",e,{passive:!0}),()=>window.removeEventListener("scroll",e)},[]),u(()=>{if(!C)return A(null),void z(null);function e(){const e=E.current,n=R.current,t=j.current,i=k.current,r=I.current,l=B.current;if(!e||!n||!t)return;const s=e.getBoundingClientRect(),o=n.getBoundingClientRect(),d=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-d.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,c=Math.min(Math.max(t,i),s);z(c-d.left)}else z(null)}e(),window.addEventListener("resize",e);let n=null;const t=window.ResizeObserver;return t&&(n=new t(e),j.current&&n.observe(j.current)),()=>{window.removeEventListener("resize",e),n&&n.disconnect()}},[C,h,p]),e(r,{position:"sticky",component:"header",children:n(l,{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(s,{sx:{width:{xs:"100%",md:"auto"},textAlign:"center",display:{xs:"block",md:"none"}},children:e(a,{children:f})}),(h||p)&&n(s,{sx:{display:{xs:"flex",md:"none"},justifyContent:"center",alignItems:"center",gap:1,width:"100%"},children:[h&&e(s,{children:h}),p&&e(s,{children:p})]}),e(s,{sx:{display:"block",width:"100%",maxHeight:{xs:C||w?"300px":"0px",md:"none"},overflow:{xs:"hidden",md:"visible"},transition:{xs:"max-height 0.2s ease-in-out",md:"none"}},children:n(s,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},alignItems:"center",width:"100%",gap:{xs:1,md:0},position:"relative"},ref:j,children:[e(s,{sx:{display:"flex",alignItems:"center",width:{xs:"100%",md:"auto"},flex:{xs:"none",md:1},justifyContent:{xs:"center",md:"flex-start"}},children:e(s,{sx:{height:"38px",pt:.5,display:{xs:"none",md:"block"}},ref:E,children:e(c,{})})}),e(s,{sx:{display:{xs:"none",md:"flex"},justifyContent:"center",alignItems:"center",position:"absolute",left:0,right:0,pointerEvents:"none"},children:e(s,{sx:{pointerEvents:"auto",textAlign:"center"},children:e(s,{ref:R,children:e(a,{children:f})})})}),e(s,{sx:{display:{xs:"none",md:h?"block":"none"},position:"absolute",left:null!=L?`${L}px`:void 0,transform:"translateX(-50%)",pointerEvents:"auto",textAlign:"center"},children:e(s,{ref:k,children:h})}),e(s,{sx:{display:{xs:"none",md:p?"block":"none"},position:"absolute",left:null!=M?`${M}px`:void 0,transform:"translateX(-50%)",pointerEvents:"auto",textAlign:"center"},children:e(s,{ref:I,children:p})}),e(s,{sx:{display:"flex",alignItems:"center",gap:1,width:{xs:"100%",md:"auto"},flex:{xs:"none",md:1},justifyContent:{xs:"center",md:"flex-end"}},children:n(s,{sx:{flex:"0 0 auto",display:"flex",alignItems:"center",gap:1},ref:B,children:[e(o,{href:g}),e(d,{})]})})]})})]})})};export{f as ActionBar};
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 d}from"./NexusHome.mjs";import{ThemeToggle as c}from"./ThemeToggle.mjs";import x from"./NexusLogo.mjs";import{ActionBarTitle as a}from"./Typography.mjs";import{useState as m,useRef as u,useEffect as f}from"react";const h=({title:h,extraLeft:p,extraRight:g,homeHref:w})=>{const[y,v]=m(!0),b=u(0),C=i(),j=r(C.breakpoints.up("md")),k=u(null),E=u(null),R=u(null),I=u(null),B=u(null),L=u(null),[A,M]=m(null),[z,H]=m(null);return f(()=>{const e=()=>{const e=window.scrollY;e>b.current?v(!1):v(!0),b.current=e};return window.addEventListener("scroll",e,{passive:!0}),()=>window.removeEventListener("scroll",e)},[]),f(()=>{if(!j)return M(null),void H(null);function e(){const e=E.current,n=R.current,t=k.current,i=I.current,r=B.current,l=L.current;if(!e||!n||!t)return;const s=e.getBoundingClientRect(),o=n.getBoundingClientRect(),d=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);M(l-d.left)}else M(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,c=Math.min(Math.max(t,i),s);H(c-d.left)}else H(null)}e(),window.addEventListener("resize",e);let n=null;const t=window.ResizeObserver;return t&&(n=new t(e),k.current&&n.observe(k.current)),()=>{window.removeEventListener("resize",e),n&&n.disconnect()}},[j,p,g]),e(n,{children:[t(l,{position:"sticky",component:"header",sx:{[C.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:[t(o,{sx:{width:{xs:"100%",md:"auto"},textAlign:"center",display:{xs:"block",md:"none"}},children:t(a,{children:h})}),(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:"block",width:"100%",maxHeight:{xs:j||y?"300px":"0px",md:"none"},overflow:{xs:"hidden",md:"visible"},transition:{xs:"max-height 0.2s ease-in-out",md:"none"}},children:e(o,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},alignItems:"center",width:"100%",gap:{xs:1,md:0},position:"relative"},ref:k,children:[t(o,{sx:{display:"flex",alignItems:"center",width:{xs:"100%",md:"auto"},flex:{xs:"none",md:1},justifyContent:{xs:"center",md:"flex-start"}},children:t(o,{sx:{height:"38px",pt:.5,display:{xs:"none",md:"block"}},ref:E,children:t(x,{})})}),t(o,{sx:{display:{xs:"none",md:"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:R,children:t(a,{children:h})})})}),t(o,{sx:{display:{xs:"none",md:p?"block":"none"},position:"absolute",left:null!=A?`${A}px`:void 0,transform:"translateX(-50%)",pointerEvents:"auto",textAlign:"center"},children:t(o,{ref:I,children:p})}),t(o,{sx:{display:{xs:"none",md:g?"block":"none"},position:"absolute",left:null!=z?`${z}px`:void 0,transform:"translateX(-50%)",pointerEvents:"auto",textAlign:"center"},children:t(o,{ref:B,children:g})}),t(o,{sx:{display:"flex",alignItems:"center",gap:1,width:{xs:"100%",md:"auto"},flex:{xs:"none",md:1},justifyContent:{xs:"center",md:"flex-end"}},children:e(o,{sx:{flex:"0 0 auto",display:"flex",alignItems:"center",gap:1},ref:L,children:[t(d,{href:w}),t(c,{})]})})]})})]})}),t(o,{sx:{display:{xs:"none",md:"block"},height:"48px",flexShrink:0}})]})};export{h as ActionBar};
@@ -1 +1 @@
1
- import{jsxs as e,jsx as i}from"react/jsx-runtime";import{Box as o}from"../Box.mjs";import{Stack as t}from"../Stack.mjs";import{Caption as r}from"../Typography.mjs";import{GlassPaper as m}from"../GlassPaper.mjs";import{Paper as s}from"../Paper.mjs";import{ChatInput as n}from"./ChatInput.mjs";import"./ChatComponents/ChatAvatar.mjs";import"react";import"../Code.mjs";import"@mui/material";import"../../theme/tokens.mjs";import"@mui/icons-material/CheckCircle";import"@mui/icons-material/ExpandMore";import"@mui/icons-material/ExpandLess";import"@mui/icons-material/OpenInNew";import"@mui/material/styles";import"@mui/icons-material/StopCircle";import l from"./ChatComponents/SuggestedPrompts.mjs";import{AgentChatWindowHeader as p}from"./AgentChatWindowHeader.mjs";const a=({title:a="Spike AI Chat",subtitle:c="Your intelligent marketing assistant",showAiChip:d=!0,headerActions:h,body:u,followUpLabel:x="Suggested follow-ups:",followUpPrompts:f,onSelectFollowUp:C,onSend:g,inputDisabled:j=!1,inputPlaceholder:b="Ask Spike anything...",sx:y})=>{const S=Boolean(f&&f.length>0&&C);return e(o,{sx:[{display:"flex",flex:1,flexDirection:"column",minWidth:0,minHeight:0,height:"100%"},...Array.isArray(y)?y:y?[y]:[]],children:[i(p,{title:a,subtitle:c,showAiChip:d,actions:h}),i(m,{sx:{borderRadius:0,border:"none",flex:1,display:"flex",flexDirection:"column",overflowY:"scroll"},children:u}),S&&e(t,{direction:{xs:"column",md:"row"},spacing:1,sx:{px:2,py:1,justifyContent:{xs:"center",sm:"flex-end"},alignItems:"center"},children:[i(r,{sx:{display:"block",mb:1},children:x}),i(l,{prompts:f??[],onSelect:C})]}),i(s,{sx:{borderRadius:0,border:"none"},children:i(o,{sx:{p:2,flexShrink:0},children:i(n,{onSend:g,disabled:j,placeholder:b})})})]})};export{a as AgentChatWindow};
1
+ import{jsxs as e,jsx as o}from"react/jsx-runtime";import{Box as i}from"../Box.mjs";import{Stack as t}from"../Stack.mjs";import{Caption as r}from"../Typography.mjs";import{GlassPaper as m}from"../GlassPaper.mjs";import{Paper as s}from"../Paper.mjs";import{ChatInput as n}from"./ChatInput.mjs";import"./ChatComponents/ChatAvatar.mjs";import"react";import"../Code.mjs";import"@mui/material";import"../../theme/tokens.mjs";import"@mui/icons-material/CheckCircle";import"@mui/icons-material/ExpandMore";import"@mui/icons-material/ExpandLess";import"@mui/icons-material/OpenInNew";import"@mui/material/styles";import"@mui/icons-material/StopCircle";import l from"./ChatComponents/SuggestedPrompts.mjs";import{AgentChatWindowHeader as a}from"./AgentChatWindowHeader.mjs";const p=({title:p="Nexus AI Chat",subtitle:c="Your intelligent assistant",showAiChip:d=!0,headerActions:h,body:u,followUpLabel:x="Suggested follow-ups:",followUpPrompts:f,onSelectFollowUp:C,onSend:g,inputDisabled:j=!1,inputPlaceholder:b="Ask me anything...",sx:y})=>{const w=Boolean(f&&f.length>0&&C);return e(i,{sx:[{display:"flex",flex:1,flexDirection:"column",minWidth:0,minHeight:0,height:"100%"},...Array.isArray(y)?y:y?[y]:[]],children:[o(a,{title:p,subtitle:c,showAiChip:d,actions:h}),o(m,{sx:{borderRadius:0,border:"none",flex:1,display:"flex",flexDirection:"column",overflowY:"scroll"},children:u}),w&&e(t,{direction:{xs:"column",md:"row"},spacing:1,sx:{px:2,py:1,justifyContent:{xs:"center",sm:"flex-end"},alignItems:"center"},children:[o(r,{sx:{display:"block",mb:1},children:x}),o(l,{prompts:f??[],onSelect:C})]}),o(s,{sx:{borderRadius:0,border:"none"},children:o(i,{sx:{p:2,flexShrink:0},children:o(n,{onSend:g,disabled:j,placeholder:b})})})]})};export{p as AgentChatWindow};
@@ -1 +1 @@
1
- import{jsx as i,jsxs as r}from"react/jsx-runtime";import{Box as t}from"../Box.mjs";import{Stack as e}from"../Stack.mjs";import{AiChip as n}from"../AiChip.mjs";import{H2 as s,Caption as o}from"../Typography.mjs";const m=({title:m="Spike AI Chat",subtitle:c="Your intelligent marketing assistant",showAiChip:a=!0,actions:p,sx:l})=>{const h=i(e,{direction:"row",spacing:1,sx:{alignItems:"center"},children:a&&i(n,{})});return r(e,{direction:{xs:"column",sm:"row"},spacing:2,sx:[{alignItems:"center",justifyContent:"space-between",p:1,flexShrink:0},...Array.isArray(l)?l:l?[l]:[]],children:[r(t,{children:[i(s,{children:m}),i(o,{children:c})]}),p??h]})};export{m as AgentChatWindowHeader};
1
+ import{jsx as t,jsxs as e}from"react/jsx-runtime";import{Stack as r}from"../Stack.mjs";import{AiChip as i}from"../AiChip.mjs";import{H2 as s,Caption as n}from"../Typography.mjs";const o=({title:o="Nexus AI Chat",subtitle:c="Your intelligent assistant",showAiChip:m=!0,actions:l,sx:a})=>{const p=t(r,{direction:"row",spacing:1,sx:{alignItems:"center"},children:m&&t(i,{})});return e(r,{direction:{xs:"column",sm:"row"},spacing:2,sx:[{alignItems:"center",justifyContent:"space-between",p:1,flexShrink:0},...Array.isArray(a)?a:a?[a]:[]],children:[e(r,{sx:{alignItems:{xs:"center",sm:"flex-start"},textAlign:{xs:"center",sm:"left"}},children:[t(s,{children:o}),t(n,{children:c})]}),l??p]})};export{o as AgentChatWindowHeader};
@@ -1 +1 @@
1
- import{jsxs as e,jsx as o}from"react/jsx-runtime";import{useState as t,useCallback as r}from"react";import{Caption as n}from"../Typography.mjs";import{Box as i}from"../Box.mjs";import{Stack as a}from"../Stack.mjs";import{ChatHistoryHeader as s}from"./ChatHistoryHeader.mjs";import{ChatHistoryButtonBase as c}from"./ChatHistoryButtonBase.mjs";const h=({conversations:h,activeConversationId:l,onSelectConversation:m,onDeleteConversation:d,onNewConversation:C,onSearchChange:v,title:p="Chat history",emptyText:y="No conversations yet",newChatTitle:f="New chat",deleteConversationTitle:g="Delete conversation",searchPlaceholder:u="Search chat histories",searchDebounceMs:x=300,width:w=288,sx:b,formatMessageCount:j=e=>`${e} messages`})=>{const[S,T]=t(""),D=r(e=>{T(e),v?.(e)},[v]);return e(a,{direction:"column",sx:[{width:w,borderRight:1,borderColor:"divider",minWidth:0},...Array.isArray(b)?b:b?[b]:[]],children:[o(s,{title:p,newChatTitle:f,onNewConversation:C,onSearchChange:D,searchPlaceholder:u,searchDebounceMs:x}),o(i,{component:"nav","aria-label":p,sx:{flex:1,overflowY:"auto",p:1},children:0===h.length?o(n,{sx:{display:"block",textAlign:"center",py:4},children:y}):h.map(e=>{const t=e.id===l;return o(c,{conversation:e,isActive:t,highlightQuery:S,onSelectConversation:m,onDeleteConversation:d,deleteConversationTitle:g,formatMessageCount:j},e.id)})})]})};export{h as ChatHistory};
1
+ import{jsxs as e,jsx as o}from"react/jsx-runtime";import{useState as t,useCallback as r}from"react";import{Caption as n}from"../Typography.mjs";import{Box as i}from"../Box.mjs";import{Stack as a}from"../Stack.mjs";import{ChatHistoryHeader as s}from"./ChatHistoryHeader.mjs";import{ChatHistoryButtonBase as c}from"./ChatHistoryButtonBase.mjs";const l=({conversations:l,activeConversationId:h,onSelectConversation:m,onDeleteConversation:C,onNewConversation:d,onClose:v,onSearchChange:p,title:y="Chat history",emptyText:f="No conversations yet",newChatTitle:g="New chat",deleteConversationTitle:u="Delete conversation",searchPlaceholder:x="Search chat histories",searchDebounceMs:w=300,width:b=288,sx:j,formatMessageCount:S=e=>`${e} messages`})=>{const[T,D]=t(""),A=r(e=>{D(e),p?.(e)},[p]);return e(a,{direction:"column",sx:[{width:b,borderRight:1,borderColor:"divider",minWidth:0},...Array.isArray(j)?j:j?[j]:[]],children:[o(s,{title:y,newChatTitle:g,onNewConversation:d,onClose:v,onSearchChange:A,searchPlaceholder:x,searchDebounceMs:w}),o(i,{component:"nav","aria-label":y,sx:{flex:1,overflowY:"auto",p:1},children:0===l.length?o(n,{sx:{display:"block",textAlign:"center",py:4},children:f}):l.map(e=>{const t=e.id===h;return o(c,{conversation:e,isActive:t,highlightQuery:T,onSelectConversation:m,onDeleteConversation:C,deleteConversationTitle:u,formatMessageCount:S},e.id)})})]})};export{l as ChatHistory};
@@ -1 +1 @@
1
- import{jsxs as e,jsx as r}from"react/jsx-runtime";import t from"@mui/icons-material/Add";import i from"@mui/icons-material/Clear";import o from"@mui/icons-material/Search";import{InputAdornment as a}from"@mui/material";import{useState as n,useEffect as l}from"react";import{Box as s}from"../Box.mjs";import{H3 as m}from"../Typography.mjs";import{IconButton as c}from"../IconButton.mjs";import{Stack as d}from"../Stack.mjs";import{TextField as h}from"../TextField.mjs";const p=({title:p,newChatTitle:u,onNewConversation:f,onSearchChange:x,searchPlaceholder:b="Search chat histories",searchDebounceMs:C=300})=>{const[g,w]=n("");return l(()=>{if(!x)return;const e=window.setTimeout(()=>{x(g)},C);return()=>window.clearTimeout(e)},[x,C,g]),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:p}),r(c,{onClick:f,title:u,ariaLabel:u,disabled:!f,children:r(t,{sx:{fontSize:16}})})]}),e(s,{sx:{display:"flex",alignItems:"center",gap:.75},children:[r(h,{fullWidth:!0,size:"small",value:g,onChange:e=>w(e.target.value),placeholder:b,slotProps:{htmlInput:{"aria-label":"Search chat histories"},input:{startAdornment:r(a,{position:"start",children:r(o,{sx:{fontSize:16,color:"text.disabled"}})})}}}),r(c,{title:"Clear search",ariaLabel:"clear-search",onClick:()=>w(""),disabled:!g,children:r(i,{sx:{fontSize:14}})})]})]})};export{p as ChatHistoryHeader};
1
+ import{jsxs as e,jsx as r}from"react/jsx-runtime";import i from"@mui/icons-material/Add";import t from"@mui/icons-material/ChevronLeft";import o from"@mui/icons-material/Clear";import a from"@mui/icons-material/Search";import{InputAdornment as n}from"@mui/material";import{useState as l,useEffect as s}from"react";import{Box as c}from"../Box.mjs";import{H3 as m}from"../Typography.mjs";import{IconButton as d}from"../IconButton.mjs";import{Stack as h}from"../Stack.mjs";import{TextField as p}from"../TextField.mjs";const f=({title:f,newChatTitle:u,onNewConversation:x,onClose:C,onSearchChange:b,searchPlaceholder:g="Search chat histories",searchDebounceMs:w=300})=>{const[S,j]=l("");return s(()=>{if(!b)return;const e=window.setTimeout(()=>{b(S)},w);return()=>window.clearTimeout(e)},[b,w,S]),e(h,{direction:"column",spacing:1,sx:{px:2,py:2,borderBottom:1,borderColor:"divider"},children:[e(h,{direction:"row",spacing:2,sx:{alignItems:"center",justifyContent:"space-between"},children:[r(m,{children:f}),e(h,{direction:"row",sx:{alignItems:"center"},children:[r(d,{onClick:x,title:u,ariaLabel:u,disabled:!x,children:r(i,{sx:{fontSize:16}})}),C&&r(d,{onClick:C,title:"Close history",ariaLabel:"close-history",children:r(t,{sx:{fontSize:16}})})]})]}),e(c,{sx:{display:"flex",alignItems:"center",gap:.75},children:[r(p,{fullWidth:!0,size:"small",value:S,onChange:e=>j(e.target.value),placeholder:g,slotProps:{htmlInput:{"aria-label":"Search chat histories"},input:{startAdornment:r(n,{position:"start",children:r(a,{sx:{fontSize:16,color:"text.disabled"}})})}}}),r(d,{title:"Clear search",ariaLabel:"clear-search",onClick:()=>j(""),disabled:!S,children:r(o,{sx:{fontSize:14}})})]})]})};export{f as ChatHistoryHeader};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as o}from"react/jsx-runtime";import t from"@mui/icons-material/CloseFullscreen";import{Dialog as i}from"../Dialog.mjs";import{Box as r}from"../Box.mjs";import{Stack as s}from"../Stack.mjs";import{IconButton as n}from"../IconButton.mjs";import{AiChip as m}from"../AiChip.mjs";import{Caption as l}from"../Typography.mjs";import{AgentChatWindowHeader as p}from"./AgentChatWindowHeader.mjs";import"./ChatComponents/ChatAvatar.mjs";import"react";import"@mui/material";import"../Code.mjs";import"../../theme/tokens.mjs";import"@mui/icons-material/CheckCircle";import"@mui/icons-material/ExpandMore";import"@mui/icons-material/ExpandLess";import"@mui/icons-material/OpenInNew";import"@mui/material/styles";import"@mui/icons-material/StopCircle";import a from"./ChatComponents/SuggestedPrompts.mjs";import c from"./ChatComponents/MessageList.mjs";import d from"./ChatComponents/EmptyState.mjs";import h from"./WidgetParts/WidgetInput.mjs";function u({open:u,onClose:f,title:x="Ask Nexus",subtitle:g="Ready to help",avatarIcon:C,placeholder:v,emptyTitle:b="Ask Nexus",emptyDescription:y="Ask me anything about your data and I'll help you find answers.",dataSources:w,suggestedPrompts:j=[],showAiChip:k=!0,isTyping:S,messages:A,streamingText:I,liveTraceEvents:T,showActivity:E=!1,onSend:z,onAbort:D,background:P,followUpPrompts:W,followUpLabel:B="Suggested follow-ups:",topOffset:F}){const H=A.length>0||S,L=H&&W&&W.length>0;return e(i,{open:u,fullScreen:!0,onClose:f,sx:F?{top:`${F}px`}:void 0,children:o(r,{sx:{display:"flex",flexDirection:"column",height:F?`calc(100vh - ${F}px)`:"100vh",overflow:"hidden"},children:[e(p,{title:x,subtitle:g,showAiChip:!1,actions:o(s,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[k&&e(m,{}),e(n,{title:"Close full view",size:"small",onClick:f,children:e(t,{sx:{fontSize:16}})})]})}),o(r,{sx:{flex:1,minHeight:0,position:"relative",display:"flex",flexDirection:"column",overflow:"hidden"},children:[P&&e(r,{sx:{position:"absolute",inset:0,zIndex:0,overflow:"hidden",pointerEvents:"none"},children:P}),e(r,{sx:{position:"relative",zIndex:1,flex:1,minHeight:0,overflowY:"auto",background:"rgba(211, 211, 211, 0.2)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:H?e(c,{messages:A,isTyping:S,streamingText:I,liveTraceEvents:T,onAbort:D,avatarIcon:C,showActivity:E}):e(d,{title:b,description:y,dataSources:w,prompts:j.slice(0,4),avatarIcon:C,onSelect:z})})]}),L&&o(r,{sx:{bgcolor:"background.paper",borderTop:"1px solid",borderColor:"divider",px:2,pt:1,pb:.5,flexShrink:0},children:[e(l,{sx:{display:"block",mb:.75},children:B}),e(a,{prompts:W,onSelect:z})]}),e(h,{placeholder:v,isTyping:S,onSend:z})]})})}export{u as NexusChatDialog};
1
+ import{jsx as e,jsxs as o,Fragment as i}from"react/jsx-runtime";import{useState as t}from"react";import{useTheme as n,useMediaQuery as r}from"@mui/material";import s from"@mui/icons-material/CloseFullscreen";import l from"@mui/icons-material/ExpandLess";import a from"@mui/icons-material/ExpandMore";import m from"@mui/icons-material/History";import{ChatHistory as p}from"./ChatHistory.mjs";import{Dialog as c}from"../Dialog.mjs";import{Box as d}from"../Box.mjs";import{Stack as h}from"../Stack.mjs";import{IconButton as f}from"../IconButton.mjs";import{AiChip as x}from"../AiChip.mjs";import{Caption as u}from"../Typography.mjs";import{AgentChatWindowHeader as v}from"./AgentChatWindowHeader.mjs";import"./ChatComponents/ChatAvatar.mjs";import"../Code.mjs";import"../../theme/tokens.mjs";import"@mui/icons-material/CheckCircle";import"@mui/icons-material/OpenInNew";import"@mui/material/styles";import"@mui/icons-material/StopCircle";import g from"./ChatComponents/SuggestedPrompts.mjs";import C from"./ChatComponents/MessageList.mjs";import b from"./ChatComponents/EmptyState.mjs";import w from"./WidgetParts/WidgetInput.mjs";function y({open:y,onClose:S,title:k="Ask Nexus",subtitle:j="Ready to help",avatarIcon:I,placeholder:z,emptyTitle:A="Ask Nexus",emptyDescription:D="Ask me anything about your data and I'll help you find answers.",dataSources:T,suggestedPrompts:H=[],showAiChip:E=!0,isTyping:N,messages:P,streamingText:W,liveTraceEvents:B,showActivity:F=!1,onSend:L,onAbort:M,background:O,followUpPrompts:U,followUpLabel:X="Suggested follow-ups:",topOffset:$,conversations:R,activeConversationId:Y,onSelectConversation:q,onDeleteConversation:G,onNewConversation:J}){const K=n(),Q=r(K.breakpoints.down("md")),[V,Z]=t(!0),[_,ee]=t(!1),oe=P.length>0||N,ie=oe&&U&&U.length>0,te=!Q||V,ne=void 0!==R;return e(c,{open:y,fullScreen:!0,onClose:S,sx:$?{top:`${$}px`}:void 0,children:o(d,{sx:{display:"flex",flexDirection:"column",height:$?`calc(100vh - ${$}px)`:"100vh",overflow:"hidden"},children:[o(d,{sx:{display:"flex",flex:1,minHeight:0,overflow:"hidden"},children:[ne&&e(d,{sx:{display:{xs:"none",md:"flex"},flexDirection:"column",minHeight:0,flexShrink:0},children:e(p,{conversations:R,activeConversationId:Y??null,onSelectConversation:q??(()=>{}),onDeleteConversation:G,onNewConversation:J})}),o(d,{sx:{display:"flex",flexDirection:"column",flex:1,minHeight:0,overflow:"hidden"},children:[o(d,{sx:{position:"relative",flexShrink:0},children:[e(v,{title:k,subtitle:j,showAiChip:!1,actions:Q?e(h,{}):o(h,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[E&&e(x,{}),e(f,{title:"Close full view",size:"small",onClick:S,children:e(s,{sx:{fontSize:16}})})]})}),Q&&o(h,{direction:"row",sx:{position:"absolute",top:6,right:4,alignItems:"center"},children:[ne&&e(f,{title:"Chat history",size:"small",onClick:()=>ee(e=>!e),children:e(m,{sx:{fontSize:18}})}),e(f,{title:"Close full view",size:"small",onClick:S,children:e(s,{sx:{fontSize:16}})})]})]}),o(d,{sx:{flex:1,minHeight:0,position:"relative",display:"flex",flexDirection:"column",overflow:"hidden"},children:[O&&e(d,{sx:{position:"absolute",inset:0,zIndex:0,overflow:"hidden",pointerEvents:"none"},children:O}),e(d,{sx:{position:"relative",zIndex:1,flex:1,minHeight:0,overflowY:"auto",background:"rgba(211, 211, 211, 0.2)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:oe?e(C,{messages:P,isTyping:N,streamingText:W,liveTraceEvents:B,onAbort:M,avatarIcon:I,showActivity:F}):e(b,{title:A,description:D,dataSources:T,prompts:H.slice(0,4),avatarIcon:I,onSelect:L})})]}),ie&&o(d,{sx:{bgcolor:"background.paper",borderTop:"1px solid",borderColor:"divider",px:2,pt:1,pb:te?.5:1,flexShrink:0},children:[o(h,{direction:"row",sx:{alignItems:"center",justifyContent:"space-between",mb:te?.75:0},children:[e(u,{children:X}),Q&&e(f,{size:"small",onClick:()=>Z(e=>!e),title:V?"Collapse suggestions":"Expand suggestions",children:e(V?a:l,{sx:{fontSize:16}})})]}),te&&e(g,{prompts:U,onSelect:L})]}),e(w,{placeholder:z,isTyping:N,onSend:L})]})]}),ne&&Q&&o(i,{children:[_&&e(d,{onClick:()=>ee(!1),sx:{position:"absolute",inset:0,zIndex:9,bgcolor:"rgba(0,0,0,0.45)"}}),e(d,{sx:{position:"absolute",top:0,left:0,bottom:0,width:288,zIndex:10,bgcolor:"background.paper",boxShadow:4,display:"flex",flexDirection:"column",overflow:"hidden",transform:_?"translateX(0)":"translateX(-100%)",transition:"transform 0.25s ease"},children:e(p,{conversations:R,activeConversationId:Y??null,onSelectConversation:e=>{q?.(e),ee(!1)},onDeleteConversation:G,onNewConversation:J?()=>{J(),ee(!1)}:void 0,onClose:()=>ee(!1)})})]})]})})}export{y as NexusChatDialog};
@@ -1 +1 @@
1
- const o="1.13.5";export{o as SAGE_NEXUS_UI_VERSION};
1
+ const o="1.13.6";export{o as SAGE_NEXUS_UI_VERSION};
package/dist/index.d.ts CHANGED
@@ -147,6 +147,33 @@ interface NexusChatWidgetProps {
147
147
  }
148
148
  declare function NexusChatWidget({ title, subtitle, fabLabel, avatarIcon, placeholder, emptyTitle, emptyDescription, dataSources, suggestedPrompts, isOpen, isTyping, messages, streamingText, liveTraceEvents, showActivity, onOpen, onClose, onSend, onAbort, onExpandToFullPage, hideFab, placement, }: NexusChatWidgetProps): react_jsx_runtime.JSX.Element | null;
149
149
 
150
+ declare const Box: ({ children, ...rest }: BoxProps) => react_jsx_runtime.JSX.Element;
151
+
152
+ interface ChatHistoryConversation {
153
+ id: string;
154
+ title: string;
155
+ messages?: unknown[];
156
+ messageCount?: number;
157
+ }
158
+ interface ChatHistoryProps {
159
+ conversations: ChatHistoryConversation[];
160
+ activeConversationId: string | null;
161
+ onSelectConversation: (id: string) => void;
162
+ onDeleteConversation?: (id: string) => void | Promise<boolean>;
163
+ onNewConversation?: () => void;
164
+ onClose?: () => void;
165
+ onSearchChange?: (query: string) => void;
166
+ title?: string;
167
+ emptyText?: string;
168
+ newChatTitle?: string;
169
+ deleteConversationTitle?: string;
170
+ searchPlaceholder?: string;
171
+ searchDebounceMs?: number;
172
+ width?: number | string;
173
+ sx?: BoxProps["sx"];
174
+ formatMessageCount?: (count: number) => string;
175
+ }
176
+
150
177
  interface NexusChatDialogProps {
151
178
  open: boolean;
152
179
  onClose: () => void;
@@ -175,8 +202,14 @@ interface NexusChatDialogProps {
175
202
  /** Height in px of a sticky/fixed bar above the dialog (e.g. AppBar). The dialog root shifts
176
203
  * down by this amount so the bar remains visible above the overlay. */
177
204
  topOffset?: number;
205
+ /** When provided, renders a ChatHistory sidebar on desktop. Pass an empty array to show the sidebar with no conversations. */
206
+ conversations?: ChatHistoryConversation[];
207
+ activeConversationId?: string | null;
208
+ onSelectConversation?: (id: string) => void;
209
+ onDeleteConversation?: (id: string) => void | Promise<boolean>;
210
+ onNewConversation?: () => void;
178
211
  }
179
- declare function NexusChatDialog({ open, onClose, title, subtitle, avatarIcon, placeholder, emptyTitle, emptyDescription, dataSources, suggestedPrompts, showAiChip, isTyping, messages, streamingText, liveTraceEvents, showActivity, onSend, onAbort, background, followUpPrompts, followUpLabel, topOffset, }: NexusChatDialogProps): react_jsx_runtime.JSX.Element;
212
+ declare function NexusChatDialog({ open, onClose, title, subtitle, avatarIcon, placeholder, emptyTitle, emptyDescription, dataSources, suggestedPrompts, showAiChip, isTyping, messages, streamingText, liveTraceEvents, showActivity, onSend, onAbort, background, followUpPrompts, followUpLabel, topOffset, conversations, activeConversationId, onSelectConversation, onDeleteConversation, onNewConversation, }: NexusChatDialogProps): react_jsx_runtime.JSX.Element;
180
213
 
181
214
  interface FABButtonProps {
182
215
  onOpen: () => void;
@@ -219,43 +252,18 @@ interface ChatInputProps {
219
252
  }
220
253
  declare const ChatInput: ({ onSend, disabled, placeholder, maxRows, sendButtonTitle, }: ChatInputProps) => react_jsx_runtime.JSX.Element;
221
254
 
222
- declare const Box: ({ children, ...rest }: BoxProps) => react_jsx_runtime.JSX.Element;
223
-
224
- interface ChatHistoryConversation {
225
- id: string;
226
- title: string;
227
- messages?: unknown[];
228
- messageCount?: number;
229
- }
230
- interface ChatHistoryProps {
231
- conversations: ChatHistoryConversation[];
232
- activeConversationId: string | null;
233
- onSelectConversation: (id: string) => void;
234
- onDeleteConversation?: (id: string) => void | Promise<boolean>;
235
- onNewConversation?: () => void;
236
- onSearchChange?: (query: string) => void;
237
- title?: string;
238
- emptyText?: string;
239
- newChatTitle?: string;
240
- deleteConversationTitle?: string;
241
- searchPlaceholder?: string;
242
- searchDebounceMs?: number;
243
- width?: number | string;
244
- sx?: BoxProps["sx"];
245
- formatMessageCount?: (count: number) => string;
246
- }
247
-
248
- declare const ChatHistory: ({ conversations, activeConversationId, onSelectConversation, onDeleteConversation, onNewConversation, onSearchChange, title, emptyText, newChatTitle, deleteConversationTitle, searchPlaceholder, searchDebounceMs, width, sx, formatMessageCount, }: ChatHistoryProps) => react_jsx_runtime.JSX.Element;
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;
249
256
 
250
257
  interface ChatHistoryHeaderProps {
251
258
  title: string;
252
259
  newChatTitle: string;
253
260
  onNewConversation?: () => void;
261
+ onClose?: () => void;
254
262
  onSearchChange?: (query: string) => void;
255
263
  searchPlaceholder?: string;
256
264
  searchDebounceMs?: number;
257
265
  }
258
- declare const ChatHistoryHeader: ({ title, newChatTitle, onNewConversation, onSearchChange, searchPlaceholder, searchDebounceMs, }: ChatHistoryHeaderProps) => react_jsx_runtime.JSX.Element;
266
+ declare const ChatHistoryHeader: ({ title, newChatTitle, onNewConversation, onClose, onSearchChange, searchPlaceholder, searchDebounceMs, }: ChatHistoryHeaderProps) => react_jsx_runtime.JSX.Element;
259
267
 
260
268
  interface ChatHistoryButtonBaseProps {
261
269
  conversation: ChatHistoryConversation;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sage-nexus-ui",
3
- "version": "1.13.5",
3
+ "version": "1.13.6",
4
4
  "description": "Nexus core components",
5
5
  "license": "ISC",
6
6
  "author": "emsmart-sage",