impact-ui 5.0.4-alpha.2 → 5.0.4-chatbot.1
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/_virtual/ArrowBack.js +4 -0
- package/dist/_virtual/AttachFileOutlined.js +4 -0
- package/dist/_virtual/ContentCopyOutlined.js +4 -0
- package/dist/_virtual/Menu.js +4 -0
- package/dist/_virtual/NorthRounded.js +4 -0
- package/dist/_virtual/RefreshOutlined.js +4 -0
- package/dist/_virtual/StopRounded.js +4 -0
- package/dist/_virtual/ThumbDownOutlined.js +4 -0
- package/dist/_virtual/ThumbUpOutlined.js +4 -0
- package/dist/_virtual/VolumeUpOutlined.js +4 -0
- package/dist/_virtual/index10.js +3 -3
- package/dist/_virtual/index11.js +3 -3
- package/dist/_virtual/index12.js +3 -3
- package/dist/_virtual/index5.js +1 -1
- package/dist/_virtual/index6.js +3 -3
- package/dist/_virtual/index7.js +3 -3
- package/dist/_virtual/index8.js +3 -3
- package/dist/_virtual/index9.js +3 -3
- package/dist/components/Button/index.js +1 -1
- package/dist/components/Chatbot/Chatbot.types.d.ts +191 -18
- package/dist/components/Chatbot/Chatbot.types.d.ts.map +1 -1
- package/dist/components/Chatbot/chatBotFooter.d.ts +1 -1
- package/dist/components/Chatbot/chatBotFooter.d.ts.map +1 -1
- package/dist/components/Chatbot/chatBotFooter.js +21 -4
- package/dist/components/Chatbot/chatbotComposer.d.ts +4 -0
- package/dist/components/Chatbot/chatbotComposer.d.ts.map +1 -0
- package/dist/components/Chatbot/chatbotComposer.js +226 -0
- package/dist/components/Chatbot/chatbotGreetingHeader.d.ts +4 -0
- package/dist/components/Chatbot/chatbotGreetingHeader.d.ts.map +1 -0
- package/dist/components/Chatbot/chatbotGreetingHeader.js +213 -0
- package/dist/components/Chatbot/conversationScreen.d.ts +1 -1
- package/dist/components/Chatbot/conversationScreen.d.ts.map +1 -1
- package/dist/components/Chatbot/conversationScreen.js +5 -3
- package/dist/components/Chatbot/index.d.ts +2 -2
- package/dist/components/Chatbot/index.d.ts.map +1 -1
- package/dist/components/Chatbot/index.js +100 -50
- package/dist/components/Chatbot/irisConversationThread.d.ts +24 -0
- package/dist/components/Chatbot/irisConversationThread.d.ts.map +1 -0
- package/dist/components/Chatbot/irisConversationThread.js +470 -0
- package/dist/components/Chatbot/irisGreetingBackdrop.d.ts +5 -0
- package/dist/components/Chatbot/irisGreetingBackdrop.d.ts.map +1 -0
- package/dist/components/Chatbot/irisGreetingBackdrop.js +62 -0
- package/dist/components/Chatbot/irisMenuListItem.d.ts +11 -0
- package/dist/components/Chatbot/irisMenuListItem.d.ts.map +1 -0
- package/dist/components/Chatbot/irisMenuListItem.js +126 -0
- package/dist/components/Chatbot/irisMenuScreen.d.ts +4 -0
- package/dist/components/Chatbot/irisMenuScreen.d.ts.map +1 -0
- package/dist/components/Chatbot/irisMenuScreen.js +311 -0
- package/dist/components/Chatbot/irisThinking.d.ts +7 -0
- package/dist/components/Chatbot/irisThinking.d.ts.map +1 -0
- package/dist/components/Chatbot/irisThinking.js +219 -0
- package/dist/components/Chatbot/newChatComponent.d.ts +1 -1
- package/dist/components/Chatbot/newChatComponent.d.ts.map +1 -1
- package/dist/components/Chatbot/newChatComponent.js +387 -70
- package/dist/components/Menu/IconMenuItem.js +1 -1
- package/dist/components/Menu/NestedMenuItem.js +1 -1
- package/dist/components/Menu/index.js +1 -1
- package/dist/components/Menu/nestedMenuItemsFromObject.js +1 -1
- package/dist/components/TableV36/Table.types.d.ts +8 -7
- package/dist/components/TableV36/Table.types.d.ts.map +1 -1
- package/dist/components/TableV36/index.d.ts.map +1 -1
- package/dist/components/TableV36/index.js +39 -110
- package/dist/components/TableV36/tableFunctions.d.ts.map +1 -1
- package/dist/components/TableV36/tableFunctions.js +15 -14
- package/dist/components/TableV36/tableUtils.d.ts +0 -14
- package/dist/components/TableV36/tableUtils.d.ts.map +1 -1
- package/dist/components/TableV36/tableUtils.js +0 -32
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/locales/de-DE.json.d.ts +51 -0
- package/dist/locales/de-DE.json.js +51 -0
- package/dist/locales/en-US.json.d.ts +51 -0
- package/dist/locales/en-US.json.js +51 -0
- package/dist/locales/es-ES.json.d.ts +51 -0
- package/dist/locales/es-ES.json.js +51 -0
- package/dist/mcp-component-registry.json +257 -188
- package/dist/node_modules/@impactsmartsuite/impact-icons/dist/index.js +280 -48
- package/dist/node_modules/@mui/icons-material/ArrowBack.js +17 -0
- package/dist/node_modules/@mui/icons-material/AttachFileOutlined.js +17 -0
- package/dist/node_modules/@mui/icons-material/ContentCopyOutlined.js +17 -0
- package/dist/node_modules/@mui/icons-material/Menu.js +17 -0
- package/dist/node_modules/@mui/icons-material/NorthRounded.js +17 -0
- package/dist/node_modules/@mui/icons-material/RefreshOutlined.js +17 -0
- package/dist/node_modules/@mui/icons-material/StopRounded.js +17 -0
- package/dist/node_modules/@mui/icons-material/ThumbDownOutlined.js +17 -0
- package/dist/node_modules/@mui/icons-material/ThumbUpOutlined.js +17 -0
- package/dist/node_modules/@mui/icons-material/VolumeUpOutlined.js +17 -0
- package/dist/node_modules/@mui/system/colorManipulator.js +2 -2
- package/dist/node_modules/@mui/system/createStyled.js +6 -6
- package/dist/node_modules/@mui/system/useThemeWithoutDefault.js +1 -1
- package/dist/stories/chatBotApiMock.d.ts +476 -0
- package/dist/stories/chatBotApiMock.d.ts.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { IrisMenuScreenProps } from './Chatbot.types';
|
|
2
|
+
|
|
3
|
+
export declare function IrisMenuScreen({ view, historyPanelData, artifacts, recentChatsPreviewCount, artifactsPreviewCount, footerText, onFooterLinkClick, onBackClick, onClose, onNewChatClick, onToggleCollapse, onMinimiseChatBot, isCollapsed, isFullWidth, dragHandleProps, onSelectConversation, onSelectArtifact, onViewMore, onFilterSelect, onChatMenuAction, onArtifactMenuAction, }: IrisMenuScreenProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
//# sourceMappingURL=irisMenuScreen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"irisMenuScreen.d.ts","sourceRoot":"","sources":["../../../src/components/Chatbot/irisMenuScreen.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAIV,mBAAmB,EAEpB,MAAM,iBAAiB,CAAC;AA6JzB,wBAAgB,cAAc,CAAC,EAC7B,IAAa,EACb,gBAAqB,EACrB,SAAc,EACd,uBAAuC,EACvC,qBAAqC,EACrC,UAAU,EACV,iBAAiB,EACjB,WAAW,EACX,OAAO,EACP,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,WAAmB,EACnB,WAAmB,EACnB,eAAe,EACf,oBAAoB,EACpB,gBAAgB,EAChB,UAAU,EACV,cAAc,EACd,gBAAgB,EAChB,oBAAoB,GACrB,EAAE,mBAAmB,2CAkKrB"}
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useMemo } from "react";
|
|
3
|
+
import default_1 from "../../node_modules/@mui/icons-material/KeyboardArrowRight.js";
|
|
4
|
+
import { FilterFunnel as FilterFunnel_default } from "../../node_modules/@impactsmartsuite/impact-icons/dist/index.js";
|
|
5
|
+
import { Button } from "../Button/index.js";
|
|
6
|
+
import { Menu } from "../Menu/index.js";
|
|
7
|
+
import { Tooltip } from "../Tooltip/index.js";
|
|
8
|
+
import { ChatBotFooter } from "./chatBotFooter.js";
|
|
9
|
+
import { ChatbotGreetingHeader } from "./chatbotGreetingHeader.js";
|
|
10
|
+
import { IrisMenuListItem } from "./irisMenuListItem.js";
|
|
11
|
+
import { useTranslation } from "../../i18n/useTranslation.js";
|
|
12
|
+
const PREVIEW_COUNT = 4;
|
|
13
|
+
const FILTER_ICON_SIZE = 16;
|
|
14
|
+
const FILTER_OPTIONS = [
|
|
15
|
+
{ value: "type", labelKey: "chatBot.irisMenu.filter.type" },
|
|
16
|
+
{ value: "status", labelKey: "chatBot.irisMenu.filter.status" },
|
|
17
|
+
{ value: "lastActivity", labelKey: "chatBot.irisMenu.filter.lastActivity" }
|
|
18
|
+
];
|
|
19
|
+
function flattenHistory(data = []) {
|
|
20
|
+
if (Array.isArray(data)) {
|
|
21
|
+
return data.flatMap((group) => group.conversation_list || []);
|
|
22
|
+
}
|
|
23
|
+
const pinned = data.pinned || [];
|
|
24
|
+
const fromGroups = (data.groups || []).flatMap((group) => group.conversation_list || []);
|
|
25
|
+
const seen = /* @__PURE__ */ new Set();
|
|
26
|
+
const result = [];
|
|
27
|
+
[...pinned, ...fromGroups].forEach((item) => {
|
|
28
|
+
const key = String(item.conversation_id ?? item.name ?? "");
|
|
29
|
+
if (!key || seen.has(key)) return;
|
|
30
|
+
seen.add(key);
|
|
31
|
+
result.push(item);
|
|
32
|
+
});
|
|
33
|
+
return result;
|
|
34
|
+
}
|
|
35
|
+
function SectionFilterButton({
|
|
36
|
+
section,
|
|
37
|
+
isCollapsed = false,
|
|
38
|
+
onFilterSelect
|
|
39
|
+
}) {
|
|
40
|
+
const { t } = useTranslation();
|
|
41
|
+
const [anchorEl, setAnchorEl] = useState(null);
|
|
42
|
+
const open = Boolean(anchorEl);
|
|
43
|
+
return /* @__PURE__ */ jsxs("div", { className: "iris-menu-filter", children: [
|
|
44
|
+
/* @__PURE__ */ jsx(Tooltip, { title: t("chatBot.irisMenu.filter"), variant: "tertiary", children: /* @__PURE__ */ jsx(
|
|
45
|
+
Button,
|
|
46
|
+
{
|
|
47
|
+
"aria-controls": open ? `iris-menu-filter-${section}` : void 0,
|
|
48
|
+
"aria-expanded": open,
|
|
49
|
+
"aria-haspopup": "true",
|
|
50
|
+
"aria-label": t("chatBot.irisMenu.filter"),
|
|
51
|
+
className: `iris-menu-filter-button${open ? " is-active" : ""}`,
|
|
52
|
+
icon: /* @__PURE__ */ jsx(FilterFunnel_default, { height: FILTER_ICON_SIZE, width: FILTER_ICON_SIZE }),
|
|
53
|
+
size: isCollapsed ? "small" : "large",
|
|
54
|
+
type: "default",
|
|
55
|
+
variant: "text",
|
|
56
|
+
onClick: (event) => {
|
|
57
|
+
setAnchorEl(open ? null : event.currentTarget);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
) }),
|
|
61
|
+
/* @__PURE__ */ jsx(
|
|
62
|
+
Menu,
|
|
63
|
+
{
|
|
64
|
+
MenuProps: {
|
|
65
|
+
anchorOrigin: { vertical: "bottom", horizontal: "right" },
|
|
66
|
+
transformOrigin: { vertical: "top", horizontal: "right" },
|
|
67
|
+
slotProps: {
|
|
68
|
+
root: { sx: { zIndex: 2e3 } },
|
|
69
|
+
paper: {
|
|
70
|
+
className: "iris-menu-filter-paper",
|
|
71
|
+
style: { width: 182, minWidth: 180, maxWidth: 240 }
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
anchorEl,
|
|
76
|
+
id: `iris-menu-filter-${section}`,
|
|
77
|
+
open,
|
|
78
|
+
options: FILTER_OPTIONS.map((option) => ({
|
|
79
|
+
label: t(option.labelKey),
|
|
80
|
+
value: option.value,
|
|
81
|
+
onClick: () => {
|
|
82
|
+
onFilterSelect == null ? void 0 : onFilterSelect(section, option.value);
|
|
83
|
+
setAnchorEl(null);
|
|
84
|
+
}
|
|
85
|
+
})),
|
|
86
|
+
onClose: () => setAnchorEl(null)
|
|
87
|
+
}
|
|
88
|
+
)
|
|
89
|
+
] });
|
|
90
|
+
}
|
|
91
|
+
function AccordionSection({
|
|
92
|
+
section,
|
|
93
|
+
title,
|
|
94
|
+
expanded,
|
|
95
|
+
onToggle,
|
|
96
|
+
children,
|
|
97
|
+
isCollapsed = false,
|
|
98
|
+
onFilterSelect
|
|
99
|
+
}) {
|
|
100
|
+
const { t } = useTranslation();
|
|
101
|
+
const panelId = `iris-menu-panel-${section}`;
|
|
102
|
+
const headerId = `iris-menu-header-${section}`;
|
|
103
|
+
return /* @__PURE__ */ jsxs("section", { className: `iris-menu-section${expanded ? " is-expanded" : ""}`, children: [
|
|
104
|
+
/* @__PURE__ */ jsxs("div", { className: "iris-menu-section-header", children: [
|
|
105
|
+
/* @__PURE__ */ jsxs("div", { className: "iris-menu-section-header-left", children: [
|
|
106
|
+
/* @__PURE__ */ jsx(
|
|
107
|
+
"div",
|
|
108
|
+
{
|
|
109
|
+
"aria-controls": panelId,
|
|
110
|
+
"aria-expanded": expanded,
|
|
111
|
+
"aria-label": expanded ? `${t("chatBot.irisMenu.collapse")} ${title}` : `${t("chatBot.irisMenu.expand")} ${title}`,
|
|
112
|
+
className: `iris-menu-section-expand-icon${expanded ? " is-expanded" : ""}`,
|
|
113
|
+
id: headerId,
|
|
114
|
+
role: "button",
|
|
115
|
+
tabIndex: 0,
|
|
116
|
+
onClick: onToggle,
|
|
117
|
+
onKeyDown: (event) => {
|
|
118
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
119
|
+
event.preventDefault();
|
|
120
|
+
onToggle();
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
children: /* @__PURE__ */ jsx(default_1, {})
|
|
124
|
+
}
|
|
125
|
+
),
|
|
126
|
+
/* @__PURE__ */ jsx("h2", { className: "iris-menu-section-title", children: title })
|
|
127
|
+
] }),
|
|
128
|
+
/* @__PURE__ */ jsx(
|
|
129
|
+
SectionFilterButton,
|
|
130
|
+
{
|
|
131
|
+
isCollapsed,
|
|
132
|
+
section,
|
|
133
|
+
onFilterSelect
|
|
134
|
+
}
|
|
135
|
+
)
|
|
136
|
+
] }),
|
|
137
|
+
expanded ? /* @__PURE__ */ jsx(
|
|
138
|
+
"div",
|
|
139
|
+
{
|
|
140
|
+
"aria-labelledby": headerId,
|
|
141
|
+
className: "iris-menu-section-body",
|
|
142
|
+
id: panelId,
|
|
143
|
+
role: "region",
|
|
144
|
+
children
|
|
145
|
+
}
|
|
146
|
+
) : null
|
|
147
|
+
] });
|
|
148
|
+
}
|
|
149
|
+
function IrisMenuScreen({
|
|
150
|
+
view = "menu",
|
|
151
|
+
historyPanelData = [],
|
|
152
|
+
artifacts = [],
|
|
153
|
+
recentChatsPreviewCount = PREVIEW_COUNT,
|
|
154
|
+
artifactsPreviewCount = PREVIEW_COUNT,
|
|
155
|
+
footerText,
|
|
156
|
+
onFooterLinkClick,
|
|
157
|
+
onBackClick,
|
|
158
|
+
onClose,
|
|
159
|
+
onNewChatClick,
|
|
160
|
+
onToggleCollapse,
|
|
161
|
+
onMinimiseChatBot,
|
|
162
|
+
isCollapsed = false,
|
|
163
|
+
isFullWidth = false,
|
|
164
|
+
dragHandleProps,
|
|
165
|
+
onSelectConversation,
|
|
166
|
+
onSelectArtifact,
|
|
167
|
+
onViewMore,
|
|
168
|
+
onFilterSelect,
|
|
169
|
+
onChatMenuAction,
|
|
170
|
+
onArtifactMenuAction
|
|
171
|
+
}) {
|
|
172
|
+
const { t } = useTranslation();
|
|
173
|
+
const [chatsExpanded, setChatsExpanded] = useState(true);
|
|
174
|
+
const [artifactsExpanded, setArtifactsExpanded] = useState(true);
|
|
175
|
+
const recentChats = useMemo(() => flattenHistory(historyPanelData), [historyPanelData]);
|
|
176
|
+
const isListView = view === "recent-chats" || view === "artifacts";
|
|
177
|
+
const headerTitle = view === "recent-chats" ? t("chatBot.irisMenu.recentChats") : view === "artifacts" ? t("chatBot.irisMenu.artifacts") : t("chatBot.irisMenu.title");
|
|
178
|
+
const previewChats = recentChats.slice(0, recentChatsPreviewCount);
|
|
179
|
+
const previewArtifacts = artifacts.slice(0, artifactsPreviewCount);
|
|
180
|
+
const showChatsViewMore = recentChats.length > recentChatsPreviewCount;
|
|
181
|
+
const showArtifactsViewMore = artifacts.length > artifactsPreviewCount;
|
|
182
|
+
return /* @__PURE__ */ jsxs("div", { className: `iris-menu-screen${isCollapsed ? " is-collapsed" : ""}`, children: [
|
|
183
|
+
/* @__PURE__ */ jsx(
|
|
184
|
+
ChatbotGreetingHeader,
|
|
185
|
+
{
|
|
186
|
+
dragHandleProps,
|
|
187
|
+
isCollapsed,
|
|
188
|
+
isFullWidth,
|
|
189
|
+
title: headerTitle,
|
|
190
|
+
variant: isListView ? "list" : "menu",
|
|
191
|
+
onBackClick,
|
|
192
|
+
onClose,
|
|
193
|
+
onMinimiseChatBot,
|
|
194
|
+
onNewChatClick,
|
|
195
|
+
onToggleCollapse
|
|
196
|
+
}
|
|
197
|
+
),
|
|
198
|
+
/* @__PURE__ */ jsx("main", { className: "iris-menu-main", children: view === "menu" ? /* @__PURE__ */ jsxs("div", { className: "iris-menu-content", children: [
|
|
199
|
+
/* @__PURE__ */ jsxs(
|
|
200
|
+
AccordionSection,
|
|
201
|
+
{
|
|
202
|
+
expanded: chatsExpanded,
|
|
203
|
+
isCollapsed,
|
|
204
|
+
section: "recentChats",
|
|
205
|
+
title: t("chatBot.irisMenu.recentChats"),
|
|
206
|
+
onFilterSelect,
|
|
207
|
+
onToggle: () => setChatsExpanded((open) => !open),
|
|
208
|
+
children: [
|
|
209
|
+
/* @__PURE__ */ jsx("ul", { className: "iris-menu-list", children: previewChats.map((item) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
|
|
210
|
+
IrisMenuListItem,
|
|
211
|
+
{
|
|
212
|
+
id: item.conversation_id ?? item.name ?? "chat",
|
|
213
|
+
isCollapsed,
|
|
214
|
+
label: item.name || String(item.conversation_id ?? ""),
|
|
215
|
+
onAction: (action) => onChatMenuAction == null ? void 0 : onChatMenuAction(action, item),
|
|
216
|
+
onSelect: () => onSelectConversation == null ? void 0 : onSelectConversation(item)
|
|
217
|
+
}
|
|
218
|
+
) }, String(item.conversation_id ?? item.name))) }),
|
|
219
|
+
previewChats.length === 0 ? /* @__PURE__ */ jsx("p", { className: "iris-menu-empty", children: t("chatBot.history.noConversations") }) : null,
|
|
220
|
+
showChatsViewMore ? /* @__PURE__ */ jsx(
|
|
221
|
+
Button,
|
|
222
|
+
{
|
|
223
|
+
className: "iris-menu-view-more",
|
|
224
|
+
size: "small",
|
|
225
|
+
variant: "url",
|
|
226
|
+
onClick: () => onViewMore == null ? void 0 : onViewMore("recentChats"),
|
|
227
|
+
children: t("chatBot.irisMenu.viewMore")
|
|
228
|
+
}
|
|
229
|
+
) : null
|
|
230
|
+
]
|
|
231
|
+
}
|
|
232
|
+
),
|
|
233
|
+
/* @__PURE__ */ jsxs(
|
|
234
|
+
AccordionSection,
|
|
235
|
+
{
|
|
236
|
+
expanded: artifactsExpanded,
|
|
237
|
+
isCollapsed,
|
|
238
|
+
section: "artifacts",
|
|
239
|
+
title: t("chatBot.irisMenu.artifacts"),
|
|
240
|
+
onFilterSelect,
|
|
241
|
+
onToggle: () => setArtifactsExpanded((open) => !open),
|
|
242
|
+
children: [
|
|
243
|
+
/* @__PURE__ */ jsx("ul", { className: "iris-menu-list", children: previewArtifacts.map((item) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
|
|
244
|
+
IrisMenuListItem,
|
|
245
|
+
{
|
|
246
|
+
id: item.id,
|
|
247
|
+
isCollapsed,
|
|
248
|
+
label: item.name,
|
|
249
|
+
onAction: (action) => onArtifactMenuAction == null ? void 0 : onArtifactMenuAction(action, item),
|
|
250
|
+
onSelect: () => onSelectArtifact == null ? void 0 : onSelectArtifact(item)
|
|
251
|
+
}
|
|
252
|
+
) }, String(item.id))) }),
|
|
253
|
+
previewArtifacts.length === 0 ? /* @__PURE__ */ jsx("p", { className: "iris-menu-empty", children: t("chatBot.irisMenu.noArtifacts") }) : null,
|
|
254
|
+
showArtifactsViewMore ? /* @__PURE__ */ jsx(
|
|
255
|
+
Button,
|
|
256
|
+
{
|
|
257
|
+
className: "iris-menu-view-more",
|
|
258
|
+
size: "small",
|
|
259
|
+
variant: "url",
|
|
260
|
+
onClick: () => onViewMore == null ? void 0 : onViewMore("artifacts"),
|
|
261
|
+
children: t("chatBot.irisMenu.viewMore")
|
|
262
|
+
}
|
|
263
|
+
) : null
|
|
264
|
+
]
|
|
265
|
+
}
|
|
266
|
+
)
|
|
267
|
+
] }) : /* @__PURE__ */ jsxs("div", { className: "iris-menu-content iris-menu-content-list", children: [
|
|
268
|
+
/* @__PURE__ */ jsxs("div", { className: "iris-menu-list-toolbar", children: [
|
|
269
|
+
/* @__PURE__ */ jsx("h2", { className: "iris-menu-list-toolbar-title", children: headerTitle }),
|
|
270
|
+
/* @__PURE__ */ jsx(
|
|
271
|
+
SectionFilterButton,
|
|
272
|
+
{
|
|
273
|
+
section: view === "artifacts" ? "artifacts" : "recentChats",
|
|
274
|
+
onFilterSelect
|
|
275
|
+
}
|
|
276
|
+
)
|
|
277
|
+
] }),
|
|
278
|
+
/* @__PURE__ */ jsx("ul", { className: "iris-menu-list iris-menu-list-full", children: view === "artifacts" ? artifacts.map((item) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
|
|
279
|
+
IrisMenuListItem,
|
|
280
|
+
{
|
|
281
|
+
id: item.id,
|
|
282
|
+
isCollapsed,
|
|
283
|
+
label: item.name,
|
|
284
|
+
onAction: (action) => onArtifactMenuAction == null ? void 0 : onArtifactMenuAction(action, item),
|
|
285
|
+
onSelect: () => onSelectArtifact == null ? void 0 : onSelectArtifact(item)
|
|
286
|
+
}
|
|
287
|
+
) }, String(item.id))) : recentChats.map((item) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
|
|
288
|
+
IrisMenuListItem,
|
|
289
|
+
{
|
|
290
|
+
id: item.conversation_id ?? item.name ?? "chat",
|
|
291
|
+
isCollapsed,
|
|
292
|
+
label: item.name || String(item.conversation_id ?? ""),
|
|
293
|
+
onAction: (action) => onChatMenuAction == null ? void 0 : onChatMenuAction(action, item),
|
|
294
|
+
onSelect: () => onSelectConversation == null ? void 0 : onSelectConversation(item)
|
|
295
|
+
}
|
|
296
|
+
) }, String(item.conversation_id ?? item.name))) }),
|
|
297
|
+
(view === "artifacts" ? artifacts : recentChats).length === 0 ? /* @__PURE__ */ jsx("p", { className: "iris-menu-empty", children: view === "artifacts" ? t("chatBot.irisMenu.noArtifacts") : t("chatBot.history.noConversations") }) : null
|
|
298
|
+
] }) }),
|
|
299
|
+
/* @__PURE__ */ jsx(
|
|
300
|
+
ChatBotFooter,
|
|
301
|
+
{
|
|
302
|
+
footerLinkLabel: onFooterLinkClick ? t("chatBot.footerLearnMore") : void 0,
|
|
303
|
+
footerText,
|
|
304
|
+
onFooterLinkClick
|
|
305
|
+
}
|
|
306
|
+
)
|
|
307
|
+
] });
|
|
308
|
+
}
|
|
309
|
+
export {
|
|
310
|
+
IrisMenuScreen
|
|
311
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IrisThinkingState } from './Chatbot.types';
|
|
2
|
+
|
|
3
|
+
export interface IrisThinkingProps {
|
|
4
|
+
thinking: IrisThinkingState;
|
|
5
|
+
}
|
|
6
|
+
export declare function IrisThinking({ thinking }: IrisThinkingProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=irisThinking.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"irisThinking.d.ts","sourceRoot":"","sources":["../../../src/components/Chatbot/irisThinking.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAoB,MAAM,iBAAiB,CAAC;AAiK3E,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,iBAAiB,CAAC;CAC7B;AAED,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,EAAE,iBAAiB,2CAoI3D"}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import default_1 from "../../node_modules/@mui/icons-material/KeyboardArrowDown.js";
|
|
4
|
+
import default_1$1 from "../../node_modules/@mui/icons-material/KeyboardArrowRight.js";
|
|
5
|
+
import { getAssetUrl } from "../../utils/assetBase.js";
|
|
6
|
+
import { Tag } from "../Tag/index.js";
|
|
7
|
+
import { useTranslation } from "../../i18n/useTranslation.js";
|
|
8
|
+
const SPARKLE_SIZE = 20;
|
|
9
|
+
const CHEVRON_SIZE = 16;
|
|
10
|
+
const IrisAiIcon = getAssetUrl("icons/smartBotAlan.svg");
|
|
11
|
+
function IrisAiSparkle({ size = SPARKLE_SIZE }) {
|
|
12
|
+
return /* @__PURE__ */ jsx(
|
|
13
|
+
"img",
|
|
14
|
+
{
|
|
15
|
+
alt: "",
|
|
16
|
+
"aria-hidden": "true",
|
|
17
|
+
className: "iris-thinking-sparkle",
|
|
18
|
+
height: size,
|
|
19
|
+
src: IrisAiIcon,
|
|
20
|
+
width: size
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
function ThinkingDots() {
|
|
25
|
+
return /* @__PURE__ */ jsxs("span", { "aria-hidden": "true", className: "iris-thinking-dots", children: [
|
|
26
|
+
/* @__PURE__ */ jsx("span", {}),
|
|
27
|
+
/* @__PURE__ */ jsx("span", {}),
|
|
28
|
+
/* @__PURE__ */ jsx("span", {})
|
|
29
|
+
] });
|
|
30
|
+
}
|
|
31
|
+
function CompleteStepMarker() {
|
|
32
|
+
return /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "iris-thinking-step-marker is-complete", children: /* @__PURE__ */ jsxs("svg", { fill: "none", height: "20", viewBox: "0 0 20 20", width: "20", children: [
|
|
33
|
+
/* @__PURE__ */ jsx("circle", { cx: "10", cy: "10", fill: "#EBF7F1", opacity: "0.8", r: "8" }),
|
|
34
|
+
/* @__PURE__ */ jsx(
|
|
35
|
+
"path",
|
|
36
|
+
{
|
|
37
|
+
d: "M9.3 10.9L8.225 9.825C8.13334 9.73333 8.01667 9.6875 7.875 9.6875C7.73334 9.6875 7.61667 9.73333 7.525 9.825C7.43334 9.91666 7.3875 10.0333 7.3875 10.175C7.3875 10.3167 7.43334 10.4333 7.525 10.525L8.95 11.95C9.05 12.05 9.16667 12.1 9.3 12.1C9.43334 12.1 9.55 12.05 9.65 11.95L12.475 9.125C12.5667 9.03333 12.6125 8.91666 12.6125 8.775C12.6125 8.63333 12.5667 8.51666 12.475 8.425C12.3833 8.33333 12.2667 8.2875 12.125 8.2875C11.9833 8.2875 11.8667 8.33333 11.775 8.425L9.3 10.9ZM10 15C9.30834 15 8.65834 14.8687 8.05 14.6062C7.44167 14.3437 6.9125 13.9875 6.4625 13.5375C6.0125 13.0875 5.65625 12.5583 5.39375 11.95C5.13125 11.3417 5 10.6917 5 10C5 9.30833 5.13125 8.65833 5.39375 8.05C5.65625 7.44166 6.0125 6.9125 6.4625 6.4625C6.9125 6.0125 7.44167 5.65625 8.05 5.39375C8.65834 5.13125 9.30834 5 10 5C10.6917 5 11.3417 5.13125 11.95 5.39375C12.5583 5.65625 13.0875 6.0125 13.5375 6.4625C13.9875 6.9125 14.3438 7.44166 14.6063 8.05C14.8688 8.65833 15 9.30833 15 10C15 10.6917 14.8688 11.3417 14.6063 11.95C14.3438 12.5583 13.9875 13.0875 13.5375 13.5375C13.0875 13.9875 12.5583 14.3437 11.95 14.6062C11.3417 14.8687 10.6917 15 10 15Z",
|
|
38
|
+
fill: "#3BB273"
|
|
39
|
+
}
|
|
40
|
+
)
|
|
41
|
+
] }) });
|
|
42
|
+
}
|
|
43
|
+
function StepMarker({ status }) {
|
|
44
|
+
if (status === "complete") return /* @__PURE__ */ jsx(CompleteStepMarker, {});
|
|
45
|
+
return /* @__PURE__ */ jsxs("span", { "aria-hidden": "true", className: "iris-thinking-step-marker is-active", children: [
|
|
46
|
+
/* @__PURE__ */ jsx("span", { className: "iris-thinking-pop-halo" }),
|
|
47
|
+
/* @__PURE__ */ jsx("span", { className: "iris-thinking-pop-dot" })
|
|
48
|
+
] });
|
|
49
|
+
}
|
|
50
|
+
function StepRow({
|
|
51
|
+
step,
|
|
52
|
+
isLast,
|
|
53
|
+
onToggle
|
|
54
|
+
}) {
|
|
55
|
+
const [uncontrolledExpanded, setUncontrolledExpanded] = useState(false);
|
|
56
|
+
const isControlled = typeof step.expanded === "boolean";
|
|
57
|
+
const expanded = isControlled ? Boolean(step.expanded) : uncontrolledExpanded;
|
|
58
|
+
const showChevron = Boolean(step.expandable);
|
|
59
|
+
const showChip = Boolean(step.chip) && (step.status === "active" || expanded);
|
|
60
|
+
const handleToggle = () => {
|
|
61
|
+
if (!showChevron) return;
|
|
62
|
+
const next = !expanded;
|
|
63
|
+
if (!isControlled) setUncontrolledExpanded(next);
|
|
64
|
+
onToggle == null ? void 0 : onToggle(step.id, next);
|
|
65
|
+
};
|
|
66
|
+
return /* @__PURE__ */ jsxs(
|
|
67
|
+
"div",
|
|
68
|
+
{
|
|
69
|
+
className: `iris-thinking-step${step.status === "complete" ? " is-complete" : " is-active"}${isLast ? " is-last" : ""}`,
|
|
70
|
+
children: [
|
|
71
|
+
/* @__PURE__ */ jsxs("div", { className: "iris-thinking-step-rail", "aria-hidden": "true", children: [
|
|
72
|
+
/* @__PURE__ */ jsx(StepMarker, { status: step.status }),
|
|
73
|
+
!isLast ? /* @__PURE__ */ jsx("span", { className: "iris-thinking-step-connector" }) : null
|
|
74
|
+
] }),
|
|
75
|
+
/* @__PURE__ */ jsxs("div", { className: "iris-thinking-step-body", children: [
|
|
76
|
+
/* @__PURE__ */ jsxs("div", { className: "iris-thinking-step-row", children: [
|
|
77
|
+
/* @__PURE__ */ jsx("p", { className: "iris-thinking-step-label", children: step.label }),
|
|
78
|
+
showChevron ? /* @__PURE__ */ jsx(
|
|
79
|
+
"button",
|
|
80
|
+
{
|
|
81
|
+
"aria-expanded": expanded,
|
|
82
|
+
"aria-label": step.label,
|
|
83
|
+
className: "iris-thinking-step-chevron",
|
|
84
|
+
type: "button",
|
|
85
|
+
onClick: handleToggle,
|
|
86
|
+
children: /* @__PURE__ */ jsx(default_1$1, { sx: { fontSize: CHEVRON_SIZE } })
|
|
87
|
+
}
|
|
88
|
+
) : null
|
|
89
|
+
] }),
|
|
90
|
+
showChip && step.chip ? /* @__PURE__ */ jsx("div", { className: "iris-thinking-step-chip", children: /* @__PURE__ */ jsx("span", { children: step.chip }) }) : null
|
|
91
|
+
] })
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
function StepsList({
|
|
97
|
+
steps,
|
|
98
|
+
onToggleStep
|
|
99
|
+
}) {
|
|
100
|
+
if (steps.length === 0) return null;
|
|
101
|
+
return /* @__PURE__ */ jsx("div", { className: "iris-thinking-steps", children: steps.map((step, index) => /* @__PURE__ */ jsx(
|
|
102
|
+
StepRow,
|
|
103
|
+
{
|
|
104
|
+
isLast: index === steps.length - 1,
|
|
105
|
+
step,
|
|
106
|
+
onToggle: onToggleStep
|
|
107
|
+
},
|
|
108
|
+
step.id
|
|
109
|
+
)) });
|
|
110
|
+
}
|
|
111
|
+
function SectionToggle({
|
|
112
|
+
label,
|
|
113
|
+
expanded,
|
|
114
|
+
onToggle
|
|
115
|
+
}) {
|
|
116
|
+
return /* @__PURE__ */ jsxs(
|
|
117
|
+
"button",
|
|
118
|
+
{
|
|
119
|
+
"aria-expanded": expanded,
|
|
120
|
+
className: "iris-thinking-section-toggle",
|
|
121
|
+
type: "button",
|
|
122
|
+
onClick: onToggle,
|
|
123
|
+
children: [
|
|
124
|
+
/* @__PURE__ */ jsx("span", { className: "iris-thinking-section-toggle-label", children: label }),
|
|
125
|
+
expanded ? /* @__PURE__ */ jsx(default_1, { sx: { fontSize: CHEVRON_SIZE } }) : /* @__PURE__ */ jsx(default_1$1, { sx: { fontSize: CHEVRON_SIZE } })
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
function IrisThinking({ thinking }) {
|
|
131
|
+
const { t } = useTranslation();
|
|
132
|
+
const phase = thinking.phase ?? "status";
|
|
133
|
+
const steps = thinking.steps ?? [];
|
|
134
|
+
const citations = thinking.citations ?? [];
|
|
135
|
+
const completeCount = steps.filter((step) => step.status === "complete").length;
|
|
136
|
+
const [localStepsExpanded, setLocalStepsExpanded] = useState(false);
|
|
137
|
+
const [localCitationsExpanded, setLocalCitationsExpanded] = useState(false);
|
|
138
|
+
const stepsExpanded = typeof thinking.stepsExpanded === "boolean" ? thinking.stepsExpanded : localStepsExpanded;
|
|
139
|
+
const citationsExpanded = typeof thinking.citationsExpanded === "boolean" ? thinking.citationsExpanded : localCitationsExpanded;
|
|
140
|
+
const liveTitle = thinking.title ?? (steps.length > 0 ? t("chatBot.irisThinking.progress", {
|
|
141
|
+
current: completeCount,
|
|
142
|
+
total: steps.length
|
|
143
|
+
}) : t("chatBot.irisThinking.default"));
|
|
144
|
+
const stepsLabel = thinking.stepsLabel ?? (steps.length > 0 ? t("chatBot.irisThinking.stepsLabel", {
|
|
145
|
+
current: completeCount || steps.length,
|
|
146
|
+
total: steps.length
|
|
147
|
+
}) : t("chatBot.irisThinking.steps"));
|
|
148
|
+
const citationsLabel = thinking.citationsLabel ?? (citations.length > 0 ? t("chatBot.irisThinking.citationsLabel", { count: citations.length }) : t("chatBot.irisThinking.citations"));
|
|
149
|
+
const handleToggleSteps = () => {
|
|
150
|
+
var _a;
|
|
151
|
+
const next = !stepsExpanded;
|
|
152
|
+
if (typeof thinking.stepsExpanded !== "boolean") setLocalStepsExpanded(next);
|
|
153
|
+
(_a = thinking.onToggleSteps) == null ? void 0 : _a.call(thinking, next);
|
|
154
|
+
};
|
|
155
|
+
const handleToggleCitations = () => {
|
|
156
|
+
var _a;
|
|
157
|
+
const next = !citationsExpanded;
|
|
158
|
+
if (typeof thinking.citationsExpanded !== "boolean") setLocalCitationsExpanded(next);
|
|
159
|
+
(_a = thinking.onToggleCitations) == null ? void 0 : _a.call(thinking, next);
|
|
160
|
+
};
|
|
161
|
+
let body = null;
|
|
162
|
+
if (phase === "status") {
|
|
163
|
+
body = /* @__PURE__ */ jsxs("div", { className: "iris-thinking-status", children: [
|
|
164
|
+
/* @__PURE__ */ jsx("span", { className: "iris-thinking-icon", children: /* @__PURE__ */ jsx(IrisAiSparkle, {}) }),
|
|
165
|
+
/* @__PURE__ */ jsxs("div", { className: "iris-thinking-status-content", children: [
|
|
166
|
+
thinking.statusLabel ? /* @__PURE__ */ jsx("span", { className: "iris-thinking-status-label", children: thinking.statusLabel }) : null,
|
|
167
|
+
/* @__PURE__ */ jsx(ThinkingDots, {})
|
|
168
|
+
] })
|
|
169
|
+
] });
|
|
170
|
+
} else if (phase === "steps") {
|
|
171
|
+
body = /* @__PURE__ */ jsxs("div", { className: "iris-thinking-live", children: [
|
|
172
|
+
/* @__PURE__ */ jsxs("div", { className: "iris-thinking-live-header", children: [
|
|
173
|
+
/* @__PURE__ */ jsx("span", { className: "iris-thinking-icon", children: /* @__PURE__ */ jsx(IrisAiSparkle, {}) }),
|
|
174
|
+
/* @__PURE__ */ jsx("p", { className: "iris-thinking-live-title", children: liveTitle })
|
|
175
|
+
] }),
|
|
176
|
+
/* @__PURE__ */ jsx(StepsList, { steps, onToggleStep: thinking.onToggleStep })
|
|
177
|
+
] });
|
|
178
|
+
} else {
|
|
179
|
+
body = /* @__PURE__ */ jsxs("div", { className: "iris-thinking-complete", children: [
|
|
180
|
+
steps.length > 0 || thinking.stepsLabel ? /* @__PURE__ */ jsxs("div", { className: "iris-thinking-complete-section", children: [
|
|
181
|
+
/* @__PURE__ */ jsx(
|
|
182
|
+
SectionToggle,
|
|
183
|
+
{
|
|
184
|
+
expanded: stepsExpanded,
|
|
185
|
+
label: stepsLabel,
|
|
186
|
+
onToggle: handleToggleSteps
|
|
187
|
+
}
|
|
188
|
+
),
|
|
189
|
+
stepsExpanded ? /* @__PURE__ */ jsx(StepsList, { steps, onToggleStep: thinking.onToggleStep }) : null
|
|
190
|
+
] }) : null,
|
|
191
|
+
citations.length > 0 || thinking.citationsLabel ? /* @__PURE__ */ jsxs("div", { className: "iris-thinking-complete-section", children: [
|
|
192
|
+
/* @__PURE__ */ jsx(
|
|
193
|
+
SectionToggle,
|
|
194
|
+
{
|
|
195
|
+
expanded: citationsExpanded,
|
|
196
|
+
label: citationsLabel,
|
|
197
|
+
onToggle: handleToggleCitations
|
|
198
|
+
}
|
|
199
|
+
),
|
|
200
|
+
citationsExpanded ? /* @__PURE__ */ jsx("div", { className: "iris-thinking-citations", children: citations.map((group) => /* @__PURE__ */ jsxs("div", { className: "iris-thinking-citation-card", children: [
|
|
201
|
+
/* @__PURE__ */ jsx("p", { className: "iris-thinking-citation-group", children: group.label }),
|
|
202
|
+
/* @__PURE__ */ jsx("div", { className: "iris-thinking-citation-tags", children: group.tags.map((tag) => /* @__PURE__ */ jsx(Tag, { label: tag, size: "small", variant: "solid" }, `${group.id}-${tag}`)) })
|
|
203
|
+
] }, group.id)) }) : null
|
|
204
|
+
] }) : null
|
|
205
|
+
] });
|
|
206
|
+
}
|
|
207
|
+
return /* @__PURE__ */ jsx(
|
|
208
|
+
"div",
|
|
209
|
+
{
|
|
210
|
+
"aria-label": t("chatBot.irisThinking"),
|
|
211
|
+
"aria-live": phase === "complete" ? "off" : "polite",
|
|
212
|
+
className: `iris-thinking iris-thinking--${phase}`,
|
|
213
|
+
children: body
|
|
214
|
+
}
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
export {
|
|
218
|
+
IrisThinking
|
|
219
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { NewChatComponentProps } from './Chatbot.types';
|
|
2
2
|
|
|
3
|
-
export declare function NewChatComponent({ onClose
|
|
3
|
+
export declare function NewChatComponent({ onClose, userName, inputValue, setInputValue, handleMicClick, customInputComponent, footerText, suggestedPrompts, onSuggestedPromptClick, modelOptions, selectedModel, onModelChange, onAddClick, onAttachClick, onMenuClick, onFooterLinkClick, onToggleCollapse, onMinimiseChatBot, onSendIconClick, onNewChatClick, isStopIcon, onStopIconClick, isAssistantThinking, thinking, activeList, isCollapsed, isFullWidth, dragHandleProps, conversation, historyPanelData, artifacts, onHistorySelectConversation, onSelectArtifact, onIrisMenuFilterSelect, onHistoryMenuAction, onArtifactMenuAction, onLikeClick, onDislikeClick, onRegenerateClick, onSpeakClick, onRevertClick, defaultAssistantActions, }: NewChatComponentProps): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
//# sourceMappingURL=newChatComponent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"newChatComponent.d.ts","sourceRoot":"","sources":["../../../src/components/Chatbot/newChatComponent.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"newChatComponent.d.ts","sourceRoot":"","sources":["../../../src/components/Chatbot/newChatComponent.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAIV,qBAAqB,EACtB,MAAM,iBAAiB,CAAC;AA4EzB,wBAAgB,gBAAgB,CAAC,EAC/B,OAAO,EACP,QAAQ,EACR,UAAU,EACV,aAAa,EACb,cAAc,EACd,oBAAoB,EACpB,UAAU,EACV,gBAAqB,EACrB,sBAAsB,EACtB,YAAY,EACZ,aAAa,EACb,aAAa,EACb,UAAU,EACV,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,UAAkB,EAClB,eAAe,EACf,mBAA2B,EAC3B,QAAQ,EACR,UAAU,EACV,WAAmB,EACnB,WAAmB,EACnB,eAAe,EACf,YAAY,EACZ,gBAAqB,EACrB,SAAc,EACd,2BAA2B,EAC3B,gBAAgB,EAChB,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EACpB,WAAW,EACX,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,uBAAuB,GACxB,EAAE,qBAAqB,2CAoVvB"}
|