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:
|
|
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
|
|
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{
|
|
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.
|
|
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
|
|