it-data-nexus-ui-library 2.1.0 → 2.1.2

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 i,jsxs as e,Fragment as t}from"react/jsx-runtime";import{Box as r}from"../_Primitives/Box.mjs";import{Stack as o}from"../_Primitives/Stack.mjs";import{Caption as m}from"../Typography.mjs";import{Paper as n}from"../_Primitives/Paper.mjs";import{ChatInput as s}from"./ChatInput.mjs";import"react";import"@mui/icons-material/Check";import"@mui/icons-material/ContentCopy";import"@mui/icons-material/Download";import"@mui/material";import"@mui/material/styles";import"../../theme/tokens.mjs";import"./ChatComponents/ChatAvatar.mjs";import"react-markdown";import"remark-gfm";import"../Code.mjs";import"@mui/icons-material/ExpandMore";import"@mui/icons-material/ExpandLess";import"@mui/icons-material/CheckCircle";import"@mui/icons-material/OpenInNew";import"@mui/icons-material/ThumbUp";import"@mui/icons-material/ThumbDown";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:u,body:h,followUpLabel:x="Suggested follow-ups:",followUpPrompts:f,onSelectFollowUp:y,onSend:C,inputDisabled:b=!1,inputPlaceholder:g="Ask me anything...",isStreaming:w=!1,onStop:A,inputActions:j,inputRef:S,isEmpty:k=!1,inputSx:P,sx:D})=>{const v=Boolean(f&&f.length>0&&y),I=i(s,{onSend:C,disabled:b,placeholder:g,isStreaming:w,onStop:A,actions:j,inputRef:S});return e(r,{sx:[{display:"flex",flex:1,flexDirection:"column",minWidth:0,minHeight:0,height:"100%"},...Array.isArray(D)?D:D?[D]:[]],children:[i(a,{title:p,subtitle:c,showAiChip:d,actions:u}),k?e(n,{sx:{borderRadius:0,border:"none",flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",px:2,pb:4},children:[h,i(r,{sx:[{mt:3,width:"100%"},...Array.isArray(P)?P:P?[P]:[]],children:I})]}):e(t,{children:[i(n,{sx:{borderRadius:0,border:"none",flex:1,display:"flex",flexDirection:"column",overflowY:"scroll"},children:h}),v&&e(o,{direction:{xs:"column",md:"row"},spacing:1,sx:{px:2,py:1,justifyContent:{xs:"center",sm:"flex-end"},alignItems:"center"},children:[i(m,{sx:{display:"block",mb:1},children:x}),i(l,{prompts:f??[],onSelect:y})]}),i(n,{sx:{borderRadius:0,border:"none"},children:i(r,{sx:[{p:2,flexShrink:0},...Array.isArray(P)?P:P?[P]:[]],children:I})})]})]})};export{p as AgentChatWindow};
1
+ import{jsx as i,jsxs as e,Fragment as t}from"react/jsx-runtime";import{Box as r}from"../_Primitives/Box.mjs";import{Stack as o}from"../_Primitives/Stack.mjs";import{Caption as m}from"../Typography.mjs";import{Paper as n}from"../_Primitives/Paper.mjs";import{ChatInput as s}from"./ChatInput.mjs";import"react";import"@mui/icons-material/Check";import"@mui/icons-material/ContentCopy";import"@mui/icons-material/Download";import"@mui/material";import"@mui/material/styles";import"../../theme/tokens.mjs";import"./ChatComponents/ChatAvatar.mjs";import"react-markdown";import"remark-gfm";import"../Code.mjs";import"@mui/icons-material/ExpandMore";import"@mui/icons-material/ExpandLess";import"@mui/icons-material/CheckCircle";import"@mui/icons-material/OpenInNew";import"@mui/icons-material/ThumbUp";import"@mui/icons-material/ThumbDown";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:u,body:h,followUpLabel:x="Suggested follow-ups:",followUpPrompts:f,onSelectFollowUp:y,onSend:b,inputDisabled:g=!1,inputPlaceholder:C="Ask me anything...",isStreaming:w=!1,onStop:A,inputActions:j,inputRef:S,inputLabel:k="Message",isEmpty:P=!1,inputSx:D,sx:v})=>{const I=Boolean(f&&f.length>0&&y),R=i(s,{onSend:b,disabled:g,placeholder:C,isStreaming:w,onStop:A,actions:j,inputRef:S,label:k});return e(r,{sx:[{display:"flex",flex:1,flexDirection:"column",minWidth:0,minHeight:0,height:"100%"},...Array.isArray(v)?v:v?[v]:[]],children:[i(a,{title:p,subtitle:c,showAiChip:d,actions:u}),P?e(n,{sx:{borderRadius:0,border:"none",flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",px:2,pb:4},children:[h,i(r,{sx:[{mt:3,width:"100%"},...Array.isArray(D)?D:D?[D]:[]],children:R})]}):e(t,{children:[i(n,{sx:{borderRadius:0,border:"none",flex:1,display:"flex",flexDirection:"column",overflowY:"scroll"},children:h}),I&&e(o,{direction:{xs:"column",md:"row"},spacing:1,sx:{px:2,py:1,justifyContent:{xs:"center",sm:"flex-end"},alignItems:"center"},children:[i(m,{sx:{display:"block",mb:1},children:x}),i(l,{prompts:f??[],onSelect:y})]}),i(n,{sx:{borderRadius:0,border:"none"},children:i(r,{sx:[{p:2,flexShrink:0},...Array.isArray(D)?D:D?[D]:[]],children:R})})]})]})};export{p as AgentChatWindow};
@@ -1 +1 @@
1
- import{jsxs as e,jsx as o}from"react/jsx-runtime";import r from"@mui/icons-material/ChatBubbleOutlined";import t from"@mui/icons-material/DeleteForeverOutlined";import{Body1 as i,Caption as n}from"../Typography.mjs";import{GhostButton as a}from"../Buttons/GhostButton.mjs";import{Box as s}from"../_Primitives/Box.mjs";import{IconButton as l}from"../Buttons/IconButton.mjs";import{colours as m}from"../../theme/tokens.mjs";const d=(e,r)=>{const t=r?.trim();if(!t)return e;const i=new RegExp(`(${(e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))(t)})`,"ig");return e.split(i).map((e,r)=>{if(!e)return null;return e.toLowerCase()===t.toLowerCase()?o(s,{component:"mark",sx:{backgroundColor:e=>"dark"===e.palette.mode?"rgba(255, 214, 10, 0.35)":"rgba(255, 214, 10, 0.45)",color:"inherit",borderRadius:.5,px:.25,py:0},children:e},`${e}-${r}`):e})},p=({conversation:p,isActive:c,highlightQuery:u,onSelectConversation:b,onDeleteConversation:h,deleteConversationTitle:g,formatMessageCount:x,showMessageCount:y=!1,sx:f})=>{const v=(e=>"number"==typeof e.messageCount?e.messageCount:Array.isArray(e.messages)?e.messages.length:0)(p);return e(a,{onClick:()=>b(p.id),sx:[{width:"100%",display:"flex",alignItems:"center",gap:1.25,borderRadius:1,px:1.5,py:1.25,backgroundColor:c?e=>"dark"===e.palette.mode?m.black:m.white:"transparent",backgroundImage:"none",opacity:1,position:"relative",zIndex:1,border:"1px solid",borderColor:c?m.primaryGreenActive:"transparent","&:hover":{backgroundColor:c?e=>"dark"===e.palette.mode?m.black:m.white:"action.hover",backgroundImage:"none","& .delete-button":{visibility:"visible"}},"&:focus-visible":{boxShadow:e=>`0 0 0 2px ${e.palette.primary.main}`},mb:.25},...Array.isArray(f)?f:f?[f]:[]],children:[o(r,{sx:{fontSize:14,color:c?m.primaryGreenActive:"text.disabled"}}),e(s,{sx:{flex:1,minWidth:0},children:[o(i,{component:"span",sx:{display:"block",fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:c?"text.primary":"text.secondary"},children:d(p.title,u)}),y&&o(n,{noWrap:!0,sx:{display:"block"},children:x(v)})]}),o(l,{className:"delete-button",title:g,ariaLabel:g,onClick:e=>{e.stopPropagation(),h&&Promise.resolve(h(p.id))},disabled:!h,sx:{visibility:"hidden"},children:o(t,{sx:{fontSize:14,color:c?"error.main":"text.disabled"}})})]})};export{p as ChatHistoryButtonBase};
1
+ import{jsxs as e,jsx as r}from"react/jsx-runtime";import o from"@mui/icons-material/ChatBubbleOutlined";import t from"@mui/icons-material/DeleteForeverOutlined";import{Body1 as i,Caption as n}from"../Typography.mjs";import{GhostButton as a}from"../Buttons/GhostButton.mjs";import{Box as s}from"../_Primitives/Box.mjs";import{IconButton as l}from"../Buttons/IconButton.mjs";import{colours as m}from"../../theme/tokens.mjs";const d=(e,o)=>{const t=o?.trim();if(!t)return e;const i=new RegExp(`(${(e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))(t)})`,"ig");return e.split(i).map((e,o)=>{if(!e)return null;return e.toLowerCase()===t.toLowerCase()?r(s,{component:"mark",sx:{backgroundColor:e=>"dark"===e.palette.mode?"rgba(255, 214, 10, 0.35)":"rgba(255, 214, 10, 0.45)",color:"inherit",borderRadius:.5,px:.25,py:0},children:e},`${e}-${o}`):e})},p=({conversation:p,isActive:c,highlightQuery:u,onSelectConversation:b,onDeleteConversation:h,deleteConversationTitle:g,formatMessageCount:x,showMessageCount:f=!1,sx:y})=>{const v=(e=>"number"==typeof e.messageCount?e.messageCount:Array.isArray(e.messages)?e.messages.length:0)(p);return e(s,{sx:[{position:"relative",mb:.25,"&:hover .delete-button":{visibility:"visible"}},...Array.isArray(y)?y:y?[y]:[]],children:[e(a,{onClick:()=>b(p.id),sx:{width:"100%",display:"flex",alignItems:"center",gap:1.25,borderRadius:1,px:1.5,py:1.25,pr:4.5,backgroundColor:c?e=>"dark"===e.palette.mode?m.black:m.white:"transparent",backgroundImage:"none",opacity:1,border:"1px solid",borderColor:c?m.primaryGreenActive:"transparent","&:hover":{backgroundColor:c?e=>"dark"===e.palette.mode?m.black:m.white:"action.hover",backgroundImage:"none"},"&:focus-visible":{boxShadow:e=>`0 0 0 2px ${e.palette.primary.main}`}},children:[r(o,{sx:{fontSize:14,color:c?m.primaryGreenActive:"text.disabled"}}),e(s,{sx:{flex:1,minWidth:0},children:[r(i,{component:"span",sx:{display:"block",fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:c?"text.primary":"text.secondary"},children:d(p.title,u)}),f&&r(n,{noWrap:!0,sx:{display:"block"},children:x(v)})]})]}),r(s,{sx:{position:"absolute",right:8,top:"50%",transform:"translateY(-50%)"},children:r(l,{className:"delete-button",title:g,ariaLabel:g,onClick:e=>{e.stopPropagation(),h&&Promise.resolve(h(p.id))},disabled:!h,sx:{visibility:"hidden"},children:r(t,{sx:{fontSize:14,color:c?"error.main":"text.disabled"}})})})]})};export{p as ChatHistoryButtonBase};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as t}from"react/jsx-runtime";import{useState as o}from"react";import r from"@mui/icons-material/Send";import i from"@mui/icons-material/Stop";import{Box as n}from"../_Primitives/Box.mjs";import{IconButton as l}from"../Buttons/IconButton.mjs";import{Paper as a}from"../_Primitives/Paper.mjs";import{TextField as s}from"../_Primitives/TextField.mjs";import{colours as m}from"../../theme/tokens.mjs";const p=({onSend:p,disabled:d=!1,placeholder:c="Ask about campaigns, competitors, performance…",maxRows:u=5,sendButtonTitle:f="Send message",isStreaming:x=!1,onStop:b,stopButtonTitle:g="Stop generating",actions:h,value:v,onChange:S,inputRef:y})=>{const[j,k]=o(""),z=void 0!==v,B=z?v:j,R=e=>{z?S?.(e):k(e)},I=m.jadeLight,P=m.black,w=()=>{const e=B.trim();e&&!d&&(p(e),R(""))};return e(n,{component:"form",onSubmit:e=>{e.preventDefault(),x||w()},sx:{display:"flex",alignItems:"center",gap:1},children:t(a,{variant:"outlined",sx:{display:"flex",flex:1,alignItems:"center",gap:1,px:1.5,py:.75,borderRadius:2,borderColor:"text.jades"},children:[e(s,{variant:"standard",fullWidth:!0,multiline:!0,minRows:1,maxRows:u,value:B,onChange:e=>R(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),x||w())},placeholder:c,disabled:d,inputRef:y,slotProps:{htmlInput:{"aria-label":c},input:{disableUnderline:!0}},sx:{"& .MuiInputBase-input":{p:.5,fontSize:"0.875rem",color:"text.primary",resize:"none","&::placeholder":{color:"text.disabled",opacity:1}}}}),h,e(l,x&&b?{type:"button",title:g,onClick:b,variant:"filled",size:"small",sx:{flexShrink:0,bgcolor:"error.main",color:"error.contrastText","&:hover":{bgcolor:"error.dark"}},children:e(i,{sx:{fontSize:13}})}:{type:"submit",title:f,disabled:!B.trim()||d,variant:"filled",size:"small",sx:{flexShrink:0,bgcolor:I,color:P,"&:hover":{bgcolor:m.jade},"&.Mui-disabled":{bgcolor:I,color:P,opacity:.4}},children:e(r,{sx:{fontSize:13}})})]})})};export{p as ChatInput};
1
+ import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useId as o,useState as i}from"react";import r from"@mui/icons-material/Send";import l from"@mui/icons-material/Stop";import{Box as n}from"../_Primitives/Box.mjs";import{IconButton as a}from"../Buttons/IconButton.mjs";import{Paper as s}from"../_Primitives/Paper.mjs";import{TextField as m}from"../_Primitives/TextField.mjs";import{colours as d}from"../../theme/tokens.mjs";const p=({onSend:p,disabled:c=!1,placeholder:u="Ask about campaigns, competitors, performance…",maxRows:f=5,sendButtonTitle:h="Send message",isStreaming:b=!1,onStop:x,stopButtonTitle:g="Stop generating",actions:v,value:S,onChange:y,inputRef:j,label:k="Message"})=>{const w=o(),[z,B]=i(""),R=void 0!==S,I=R?S:z,P=e=>{R?y?.(e):B(e)},C=d.jadeLight,T=d.black,D=()=>{const e=I.trim();e&&!c&&(p(e),P(""))};return e(n,{component:"form",onSubmit:e=>{e.preventDefault(),b||D()},sx:{display:"flex",alignItems:"center",gap:1},children:[t("label",{htmlFor:w,style:{position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0},children:k}),e(s,{variant:"outlined",sx:{display:"flex",flex:1,alignItems:"center",gap:1,px:1.5,py:.75,borderRadius:2,borderColor:"text.jades"},children:[t(m,{variant:"standard",fullWidth:!0,multiline:!0,minRows:1,maxRows:f,value:I,onChange:e=>P(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),b||D())},placeholder:u,disabled:c,inputRef:j,slotProps:{htmlInput:{id:w,"aria-label":u},input:{disableUnderline:!0}},sx:{"& .MuiInputBase-input":{p:.5,fontSize:"0.875rem",color:"text.primary",resize:"none","&::placeholder":{color:"text.disabled",opacity:1}}}}),v,t(a,b&&x?{type:"button",title:g,onClick:x,variant:"filled",size:"small",sx:{flexShrink:0,bgcolor:"error.main",color:"error.contrastText","&:hover":{bgcolor:"error.dark"}},children:t(l,{sx:{fontSize:13}})}:{type:"submit",title:h,disabled:!I.trim()||c,variant:"filled",size:"small",sx:{flexShrink:0,bgcolor:C,color:T,"&:hover":{bgcolor:d.jade},"&.Mui-disabled":{bgcolor:C,color:T,opacity:.4}},children:t(r,{sx:{fontSize:13}})})]})]})};export{p as ChatInput};
@@ -1 +1 @@
1
- const o="2.1.0";export{o as SAGE_NEXUS_UI_VERSION};
1
+ const o="2.1.2";export{o as SAGE_NEXUS_UI_VERSION};
package/dist/index.d.ts CHANGED
@@ -242,11 +242,12 @@ interface AgentChatWindowProps {
242
242
  onStop?: () => void;
243
243
  inputActions?: React.ReactNode;
244
244
  inputRef?: React.Ref<HTMLTextAreaElement>;
245
+ inputLabel?: string;
245
246
  isEmpty?: boolean;
246
247
  inputSx?: SxProps<Theme>;
247
248
  sx?: SxProps<Theme>;
248
249
  }
249
- declare const AgentChatWindow: ({ title, subtitle, showAiChip, headerActions, body, followUpLabel, followUpPrompts, onSelectFollowUp, onSend, inputDisabled, inputPlaceholder, isStreaming, onStop, inputActions, inputRef, isEmpty, inputSx, sx, }: AgentChatWindowProps) => react.JSX.Element;
250
+ declare const AgentChatWindow: ({ title, subtitle, showAiChip, headerActions, body, followUpLabel, followUpPrompts, onSelectFollowUp, onSend, inputDisabled, inputPlaceholder, isStreaming, onStop, inputActions, inputRef, inputLabel, isEmpty, inputSx, sx, }: AgentChatWindowProps) => react.JSX.Element;
250
251
 
251
252
  interface AgentChatWindowHeaderProps {
252
253
  title?: string;
@@ -270,8 +271,9 @@ interface ChatInputProps {
270
271
  value?: string;
271
272
  onChange?: (value: string) => void;
272
273
  inputRef?: React.Ref<HTMLTextAreaElement>;
274
+ label?: string;
273
275
  }
274
- declare const ChatInput: ({ onSend, disabled, placeholder, maxRows, sendButtonTitle, isStreaming, onStop, stopButtonTitle, actions, value: controlledValue, onChange, inputRef, }: ChatInputProps) => react.JSX.Element;
276
+ declare const ChatInput: ({ onSend, disabled, placeholder, maxRows, sendButtonTitle, isStreaming, onStop, stopButtonTitle, actions, value: controlledValue, onChange, inputRef, label, }: ChatInputProps) => react.JSX.Element;
275
277
 
276
278
  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.Element;
277
279
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "it-data-nexus-ui-library",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "description": "Nexus core components",
5
5
  "license": "ISC",
6
6
  "author": "emsmart-sage",