impact-ui 5.0.4-alpha.1 → 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.
Files changed (92) hide show
  1. package/dist/_virtual/ArrowBack.js +4 -0
  2. package/dist/_virtual/AttachFileOutlined.js +4 -0
  3. package/dist/_virtual/ContentCopyOutlined.js +4 -0
  4. package/dist/_virtual/Menu.js +4 -0
  5. package/dist/_virtual/NorthRounded.js +4 -0
  6. package/dist/_virtual/RefreshOutlined.js +4 -0
  7. package/dist/_virtual/StopRounded.js +4 -0
  8. package/dist/_virtual/ThumbDownOutlined.js +4 -0
  9. package/dist/_virtual/ThumbUpOutlined.js +4 -0
  10. package/dist/_virtual/VolumeUpOutlined.js +4 -0
  11. package/dist/_virtual/index2.js +2 -2
  12. package/dist/_virtual/index3.js +2 -2
  13. package/dist/_virtual/index4.js +2 -4
  14. package/dist/_virtual/index5.js +3 -3
  15. package/dist/_virtual/index6.js +4 -2
  16. package/dist/components/Button/index.js +1 -1
  17. package/dist/components/Chatbot/Chatbot.types.d.ts +191 -18
  18. package/dist/components/Chatbot/Chatbot.types.d.ts.map +1 -1
  19. package/dist/components/Chatbot/chatBotFooter.d.ts +1 -1
  20. package/dist/components/Chatbot/chatBotFooter.d.ts.map +1 -1
  21. package/dist/components/Chatbot/chatBotFooter.js +21 -4
  22. package/dist/components/Chatbot/chatbotComposer.d.ts +4 -0
  23. package/dist/components/Chatbot/chatbotComposer.d.ts.map +1 -0
  24. package/dist/components/Chatbot/chatbotComposer.js +226 -0
  25. package/dist/components/Chatbot/chatbotGreetingHeader.d.ts +4 -0
  26. package/dist/components/Chatbot/chatbotGreetingHeader.d.ts.map +1 -0
  27. package/dist/components/Chatbot/chatbotGreetingHeader.js +213 -0
  28. package/dist/components/Chatbot/conversationScreen.d.ts +1 -1
  29. package/dist/components/Chatbot/conversationScreen.d.ts.map +1 -1
  30. package/dist/components/Chatbot/conversationScreen.js +5 -3
  31. package/dist/components/Chatbot/index.d.ts +2 -2
  32. package/dist/components/Chatbot/index.d.ts.map +1 -1
  33. package/dist/components/Chatbot/index.js +100 -50
  34. package/dist/components/Chatbot/irisConversationThread.d.ts +24 -0
  35. package/dist/components/Chatbot/irisConversationThread.d.ts.map +1 -0
  36. package/dist/components/Chatbot/irisConversationThread.js +470 -0
  37. package/dist/components/Chatbot/irisGreetingBackdrop.d.ts +5 -0
  38. package/dist/components/Chatbot/irisGreetingBackdrop.d.ts.map +1 -0
  39. package/dist/components/Chatbot/irisGreetingBackdrop.js +62 -0
  40. package/dist/components/Chatbot/irisMenuListItem.d.ts +11 -0
  41. package/dist/components/Chatbot/irisMenuListItem.d.ts.map +1 -0
  42. package/dist/components/Chatbot/irisMenuListItem.js +126 -0
  43. package/dist/components/Chatbot/irisMenuScreen.d.ts +4 -0
  44. package/dist/components/Chatbot/irisMenuScreen.d.ts.map +1 -0
  45. package/dist/components/Chatbot/irisMenuScreen.js +311 -0
  46. package/dist/components/Chatbot/irisThinking.d.ts +7 -0
  47. package/dist/components/Chatbot/irisThinking.d.ts.map +1 -0
  48. package/dist/components/Chatbot/irisThinking.js +219 -0
  49. package/dist/components/Chatbot/newChatComponent.d.ts +1 -1
  50. package/dist/components/Chatbot/newChatComponent.d.ts.map +1 -1
  51. package/dist/components/Chatbot/newChatComponent.js +387 -70
  52. package/dist/components/Menu/IconMenuItem.js +1 -1
  53. package/dist/components/Menu/NestedMenuItem.js +1 -1
  54. package/dist/components/Menu/index.js +1 -1
  55. package/dist/components/Menu/nestedMenuItemsFromObject.js +1 -1
  56. package/dist/components/TableChat/components/TableChatRightSection/ChatHeader/ChatHeader.d.ts.map +1 -1
  57. package/dist/components/TableChat/components/TableChatRightSection/ChatHeader/ChatHeader.js +1 -20
  58. package/dist/components/TableChat/components/TableChatRightSection/ChatHeader/ChatHeaderAction.d.ts.map +1 -1
  59. package/dist/components/TableChat/components/TableChatRightSection/ChatHeader/ChatHeaderAction.js +6 -8
  60. package/dist/components/TableV36/index.d.ts.map +1 -1
  61. package/dist/components/TableV36/index.js +26 -4
  62. package/dist/components/TableV36/tableFunctions.d.ts.map +1 -1
  63. package/dist/components/TableV36/tableFunctions.js +15 -14
  64. package/dist/components/index.d.ts +1 -1
  65. package/dist/components/index.d.ts.map +1 -1
  66. package/dist/locales/de-DE.json.d.ts +51 -0
  67. package/dist/locales/de-DE.json.js +51 -0
  68. package/dist/locales/en-US.json.d.ts +51 -0
  69. package/dist/locales/en-US.json.js +51 -0
  70. package/dist/locales/es-ES.json.d.ts +51 -0
  71. package/dist/locales/es-ES.json.js +51 -0
  72. package/dist/mcp-component-registry.json +256 -182
  73. package/dist/node_modules/@impactsmartsuite/impact-icons/dist/index.js +280 -48
  74. package/dist/node_modules/@mui/icons-material/ArrowBack.js +17 -0
  75. package/dist/node_modules/@mui/icons-material/AttachFileOutlined.js +17 -0
  76. package/dist/node_modules/@mui/icons-material/ContentCopyOutlined.js +17 -0
  77. package/dist/node_modules/@mui/icons-material/Menu.js +17 -0
  78. package/dist/node_modules/@mui/icons-material/NorthRounded.js +17 -0
  79. package/dist/node_modules/@mui/icons-material/RefreshOutlined.js +17 -0
  80. package/dist/node_modules/@mui/icons-material/StopRounded.js +17 -0
  81. package/dist/node_modules/@mui/icons-material/ThumbDownOutlined.js +17 -0
  82. package/dist/node_modules/@mui/icons-material/ThumbUpOutlined.js +17 -0
  83. package/dist/node_modules/@mui/icons-material/VolumeUpOutlined.js +17 -0
  84. package/dist/node_modules/@mui/system/colorManipulator.js +2 -2
  85. package/dist/node_modules/prop-types/index.js +1 -1
  86. package/dist/node_modules/prop-types/node_modules/react-is/index.js +1 -1
  87. package/dist/node_modules/react-is/index.js +1 -1
  88. package/dist/stories/chatBotApiMock.d.ts +476 -0
  89. package/dist/stories/chatBotApiMock.d.ts.map +1 -0
  90. package/dist/stories/tableV36ChatApiMock.d.ts +25 -40
  91. package/dist/stories/tableV36ChatApiMock.d.ts.map +1 -1
  92. package/package.json +2 -2
@@ -0,0 +1,470 @@
1
+ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
+ import { useRef, useState, useEffect } from "react";
3
+ import default_1$2 from "../../node_modules/@mui/icons-material/ContentCopyOutlined.js";
4
+ import default_1$1 from "../../node_modules/@mui/icons-material/NorthRounded.js";
5
+ import default_1 from "../../node_modules/@mui/icons-material/Close.js";
6
+ import default_1$5 from "../../node_modules/@mui/icons-material/RefreshOutlined.js";
7
+ import default_1$4 from "../../node_modules/@mui/icons-material/ThumbDownOutlined.js";
8
+ import default_1$3 from "../../node_modules/@mui/icons-material/ThumbUpOutlined.js";
9
+ import default_1$6 from "../../node_modules/@mui/icons-material/VolumeUpOutlined.js";
10
+ import { EditBlack as EditBlack_default } from "../../node_modules/@impactsmartsuite/impact-icons/dist/index.js";
11
+ import TextareaAutosize from "react-textarea-autosize";
12
+ import { getAssetUrl } from "../../utils/assetBase.js";
13
+ import { Button } from "../Button/index.js";
14
+ import { Tooltip } from "../Tooltip/index.js";
15
+ import { IrisThinking } from "./irisThinking.js";
16
+ import { useTranslation } from "../../i18n/useTranslation.js";
17
+ const SmartBotIcon = getAssetUrl("icons/smartBotAlan.svg");
18
+ const ACTION_ICON_SIZE = 16;
19
+ const EDIT_ACTION_SELECTOR = 'button, a, input, textarea, select, label, [role="button"], [role="menuitem"]';
20
+ function formatMessageTime(timestamp) {
21
+ if (!timestamp) return "";
22
+ const date = new Date(timestamp);
23
+ if (Number.isNaN(date.getTime())) {
24
+ if (/[ap]\.?m\.?$/i.test(timestamp)) return timestamp;
25
+ return "";
26
+ }
27
+ return date.toLocaleTimeString(void 0, {
28
+ hour: "2-digit",
29
+ minute: "2-digit",
30
+ hour12: true
31
+ });
32
+ }
33
+ function getMessageContent(message) {
34
+ if (message.text != null && message.text !== "") return message.text;
35
+ if (message.bodyText != null && message.bodyText !== "") return message.bodyText;
36
+ return null;
37
+ }
38
+ function getPlainText(message) {
39
+ const content = message.text ?? message.bodyText;
40
+ return typeof content === "string" ? content : "";
41
+ }
42
+ function resolveIrisAssistantActions(message, defaults = []) {
43
+ if (Array.isArray(message.actions)) {
44
+ return message.actions;
45
+ }
46
+ const fromFlags = [];
47
+ if (message.enableCopy) fromFlags.push("copy");
48
+ if (message.enableLikes) {
49
+ fromFlags.push("like", "dislike");
50
+ }
51
+ if (message.enableRegenerate) fromFlags.push("regenerate");
52
+ if (message.enableSpeaker) fromFlags.push("speak");
53
+ if (message.enableRevert) fromFlags.push("revert");
54
+ return fromFlags.length > 0 ? fromFlags : defaults;
55
+ }
56
+ function UserMessageActions({
57
+ text,
58
+ onCopy,
59
+ onEdit
60
+ }) {
61
+ const { t } = useTranslation();
62
+ const [copied, setCopied] = useState(false);
63
+ const handleCopy = async () => {
64
+ try {
65
+ await navigator.clipboard.writeText(text);
66
+ setCopied(true);
67
+ window.setTimeout(() => setCopied(false), 1500);
68
+ } catch {
69
+ }
70
+ onCopy();
71
+ };
72
+ return /* @__PURE__ */ jsxs("div", { className: "iris-conversation-user-actions", children: [
73
+ /* @__PURE__ */ jsx(
74
+ Tooltip,
75
+ {
76
+ title: copied ? t("chatBot.message.copied") : t("chatBot.message.copy"),
77
+ variant: "tertiary",
78
+ children: /* @__PURE__ */ jsx(
79
+ Button,
80
+ {
81
+ "aria-label": copied ? t("chatBot.message.copied") : t("chatBot.message.copy"),
82
+ className: "chatbot-composer-icon-button",
83
+ icon: /* @__PURE__ */ jsx(default_1$2, { sx: { fontSize: ACTION_ICON_SIZE } }),
84
+ size: "small",
85
+ type: "default",
86
+ variant: "text",
87
+ onClick: handleCopy
88
+ }
89
+ )
90
+ }
91
+ ),
92
+ /* @__PURE__ */ jsx(Tooltip, { title: t("chatBot.message.edit"), variant: "tertiary", children: /* @__PURE__ */ jsx(
93
+ Button,
94
+ {
95
+ "aria-label": t("chatBot.message.edit"),
96
+ className: "chatbot-composer-icon-button",
97
+ icon: /* @__PURE__ */ jsx(EditBlack_default, { height: ACTION_ICON_SIZE, width: ACTION_ICON_SIZE }),
98
+ size: "small",
99
+ type: "default",
100
+ variant: "text",
101
+ onClick: onEdit
102
+ }
103
+ ) })
104
+ ] });
105
+ }
106
+ function AssistantMessageActions({
107
+ actions,
108
+ plainText,
109
+ liked,
110
+ disliked,
111
+ onCopy,
112
+ onLike,
113
+ onDislike,
114
+ onRegenerate,
115
+ onSpeak,
116
+ onRevert
117
+ }) {
118
+ const { t } = useTranslation();
119
+ const [copied, setCopied] = useState(false);
120
+ const enabled = new Set(actions);
121
+ const showLeft = enabled.has("copy") || enabled.has("like") || enabled.has("dislike") || enabled.has("regenerate") || enabled.has("speak");
122
+ const showRevert = enabled.has("revert");
123
+ if (!showLeft && !showRevert) return null;
124
+ const handleCopy = async () => {
125
+ if (plainText) {
126
+ try {
127
+ await navigator.clipboard.writeText(plainText);
128
+ setCopied(true);
129
+ window.setTimeout(() => setCopied(false), 1500);
130
+ } catch {
131
+ }
132
+ }
133
+ onCopy();
134
+ };
135
+ return /* @__PURE__ */ jsxs("div", { className: "iris-conversation-assistant-actions", children: [
136
+ showLeft ? /* @__PURE__ */ jsxs("div", { className: "iris-conversation-assistant-actions-left", children: [
137
+ enabled.has("copy") ? /* @__PURE__ */ jsx(
138
+ Tooltip,
139
+ {
140
+ title: copied ? t("chatBot.message.copied") : t("chatBot.message.copy"),
141
+ variant: "tertiary",
142
+ children: /* @__PURE__ */ jsx(
143
+ Button,
144
+ {
145
+ "aria-label": copied ? t("chatBot.message.copied") : t("chatBot.message.copy"),
146
+ className: "iris-conversation-assistant-action",
147
+ icon: /* @__PURE__ */ jsx(default_1$2, { sx: { fontSize: ACTION_ICON_SIZE } }),
148
+ size: "small",
149
+ type: "default",
150
+ variant: "text",
151
+ onClick: handleCopy
152
+ }
153
+ )
154
+ }
155
+ ) : null,
156
+ enabled.has("like") ? /* @__PURE__ */ jsx(Tooltip, { title: t("chatBot.message.like"), variant: "tertiary", children: /* @__PURE__ */ jsx(
157
+ Button,
158
+ {
159
+ "aria-label": t("chatBot.message.like"),
160
+ "aria-pressed": liked,
161
+ className: `iris-conversation-assistant-action${liked ? " is-active" : ""}`,
162
+ icon: /* @__PURE__ */ jsx(default_1$3, { sx: { fontSize: ACTION_ICON_SIZE } }),
163
+ size: "small",
164
+ type: "default",
165
+ variant: "text",
166
+ onClick: onLike
167
+ }
168
+ ) }) : null,
169
+ enabled.has("dislike") ? /* @__PURE__ */ jsx(Tooltip, { title: t("chatBot.message.dislike"), variant: "tertiary", children: /* @__PURE__ */ jsx(
170
+ Button,
171
+ {
172
+ "aria-label": t("chatBot.message.dislike"),
173
+ "aria-pressed": disliked,
174
+ className: `iris-conversation-assistant-action${disliked ? " is-active" : ""}`,
175
+ icon: /* @__PURE__ */ jsx(default_1$4, { sx: { fontSize: ACTION_ICON_SIZE } }),
176
+ size: "small",
177
+ type: "default",
178
+ variant: "text",
179
+ onClick: onDislike
180
+ }
181
+ ) }) : null,
182
+ enabled.has("regenerate") ? /* @__PURE__ */ jsx(Tooltip, { title: t("chatBot.message.regenerate"), variant: "tertiary", children: /* @__PURE__ */ jsx(
183
+ Button,
184
+ {
185
+ "aria-label": t("chatBot.message.regenerate"),
186
+ className: "iris-conversation-assistant-action",
187
+ icon: /* @__PURE__ */ jsx(default_1$5, { sx: { fontSize: ACTION_ICON_SIZE } }),
188
+ size: "small",
189
+ type: "default",
190
+ variant: "text",
191
+ onClick: onRegenerate
192
+ }
193
+ ) }) : null,
194
+ enabled.has("speak") ? /* @__PURE__ */ jsx(Tooltip, { title: t("chatBot.message.speak"), variant: "tertiary", children: /* @__PURE__ */ jsx(
195
+ Button,
196
+ {
197
+ "aria-label": t("chatBot.message.speak"),
198
+ className: "iris-conversation-assistant-action",
199
+ icon: /* @__PURE__ */ jsx(default_1$6, { sx: { fontSize: ACTION_ICON_SIZE } }),
200
+ size: "small",
201
+ type: "default",
202
+ variant: "text",
203
+ onClick: onSpeak
204
+ }
205
+ ) }) : null
206
+ ] }) : /* @__PURE__ */ jsx("div", {}),
207
+ showRevert ? /* @__PURE__ */ jsx(
208
+ "button",
209
+ {
210
+ className: "iris-conversation-assistant-revert",
211
+ type: "button",
212
+ onClick: onRevert,
213
+ children: t("chatBot.message.revert")
214
+ }
215
+ ) : null
216
+ ] });
217
+ }
218
+ function UserMessageEditor({
219
+ initialText,
220
+ onCancel,
221
+ onSubmit
222
+ }) {
223
+ const { t } = useTranslation();
224
+ const textareaRef = useRef(null);
225
+ const [value, setValue] = useState(initialText);
226
+ const [isFocused, setIsFocused] = useState(true);
227
+ const hasContent = value.trim().length > 0;
228
+ const isActive = isFocused || hasContent;
229
+ useEffect(() => {
230
+ const el = textareaRef.current;
231
+ if (!el) return;
232
+ el.focus();
233
+ const len = el.value.length;
234
+ el.setSelectionRange(len, len);
235
+ }, []);
236
+ const handleSubmit = () => {
237
+ if (!hasContent) return;
238
+ onSubmit(value.trim());
239
+ };
240
+ const handleBoxMouseDown = (event) => {
241
+ var _a;
242
+ const target = event.target;
243
+ if (target == null ? void 0 : target.closest(EDIT_ACTION_SELECTOR)) return;
244
+ event.preventDefault();
245
+ (_a = textareaRef.current) == null ? void 0 : _a.focus();
246
+ };
247
+ return /* @__PURE__ */ jsxs(
248
+ "form",
249
+ {
250
+ className: "chatbot-composer iris-conversation-user-editor",
251
+ onSubmit: (event) => {
252
+ event.preventDefault();
253
+ handleSubmit();
254
+ },
255
+ children: [
256
+ /* @__PURE__ */ jsx(
257
+ "div",
258
+ {
259
+ className: [
260
+ "chatbot-composer-box",
261
+ isActive ? "is-active" : "",
262
+ hasContent ? "has-content" : ""
263
+ ].filter(Boolean).join(" "),
264
+ onMouseDown: handleBoxMouseDown,
265
+ children: /* @__PURE__ */ jsx(
266
+ TextareaAutosize,
267
+ {
268
+ ref: textareaRef,
269
+ "aria-label": t("chatBot.message.edit"),
270
+ className: "chatbot-composer-textarea",
271
+ maxRows: 6,
272
+ minRows: 1,
273
+ value,
274
+ onBlur: () => setIsFocused(false),
275
+ onChange: (event) => setValue(event.target.value),
276
+ onFocus: () => setIsFocused(true),
277
+ onKeyDown: (event) => {
278
+ if (event.key === "Escape") {
279
+ event.preventDefault();
280
+ onCancel();
281
+ return;
282
+ }
283
+ if (event.key === "Enter" && !event.shiftKey) {
284
+ event.preventDefault();
285
+ handleSubmit();
286
+ }
287
+ }
288
+ }
289
+ )
290
+ }
291
+ ),
292
+ /* @__PURE__ */ jsx("div", { className: "chatbot-composer-toolbar", children: /* @__PURE__ */ jsxs("div", { className: "chatbot-composer-toolbar-right", children: [
293
+ /* @__PURE__ */ jsx(
294
+ Button,
295
+ {
296
+ "aria-label": t("chatBot.message.editCancel", { defaultValue: "Cancel" }),
297
+ icon: /* @__PURE__ */ jsx(default_1, { fontSize: "small" }),
298
+ size: "small",
299
+ type: "default",
300
+ variant: "tertiary",
301
+ onClick: onCancel
302
+ }
303
+ ),
304
+ hasContent && /* @__PURE__ */ jsx(Tooltip, { title: t("chatBot.composer.send"), variant: "tertiary", children: /* @__PURE__ */ jsx(
305
+ Button,
306
+ {
307
+ "aria-label": t("chatBot.composer.send"),
308
+ htmlType: "submit",
309
+ icon: /* @__PURE__ */ jsx(default_1$1, { fontSize: "small" }),
310
+ type: "default",
311
+ variant: "primary",
312
+ size: "small"
313
+ }
314
+ ) })
315
+ ] }) })
316
+ ]
317
+ }
318
+ );
319
+ }
320
+ function IrisConversationThread({
321
+ messages,
322
+ isThinking = false,
323
+ thinking,
324
+ defaultAssistantActions = [],
325
+ onCopyUserMessage,
326
+ onEditUserMessage,
327
+ onCopyAssistantMessage,
328
+ onLikeAssistantMessage,
329
+ onDislikeAssistantMessage,
330
+ onRegenerateAssistantMessage,
331
+ onSpeakAssistantMessage,
332
+ onRevertAssistantMessage
333
+ }) {
334
+ const { t } = useTranslation();
335
+ const messagesRef = useRef(null);
336
+ const [editingIndex, setEditingIndex] = useState(null);
337
+ const scrollToBottom = (behavior = "smooth") => {
338
+ const el = messagesRef.current;
339
+ if (!el) return;
340
+ if (typeof el.scrollTo === "function") {
341
+ el.scrollTo({ top: el.scrollHeight, behavior });
342
+ } else {
343
+ el.scrollTop = el.scrollHeight;
344
+ }
345
+ };
346
+ useEffect(() => {
347
+ if (editingIndex == null) return;
348
+ if (editingIndex >= messages.length) setEditingIndex(null);
349
+ }, [editingIndex, messages.length]);
350
+ useEffect(() => {
351
+ scrollToBottom();
352
+ }, [messages, isThinking, thinking]);
353
+ return /* @__PURE__ */ jsxs("div", { className: "iris-conversation-thread", children: [
354
+ /* @__PURE__ */ jsx("div", { className: "iris-conversation-date", children: /* @__PURE__ */ jsx("span", { className: "iris-conversation-date-pill", children: t("chatBot.dateSeparator.today") }) }),
355
+ /* @__PURE__ */ jsxs("div", { ref: messagesRef, className: "iris-conversation-messages", children: [
356
+ messages.map((message, index) => {
357
+ var _a, _b;
358
+ const isUser = message.role === "user" || message.userType === "user";
359
+ const content = getMessageContent(message);
360
+ const plainText = getPlainText(message);
361
+ if (content == null && !message.thinking) return null;
362
+ if (isUser) {
363
+ if (typeof content !== "string" || !content) return null;
364
+ const isEditing = editingIndex === index;
365
+ return /* @__PURE__ */ jsx(
366
+ "div",
367
+ {
368
+ className: "iris-conversation-user-row",
369
+ children: /* @__PURE__ */ jsx("div", { className: "iris-conversation-user-block", children: isEditing ? /* @__PURE__ */ jsx(
370
+ UserMessageEditor,
371
+ {
372
+ initialText: content,
373
+ onCancel: () => setEditingIndex(null),
374
+ onSubmit: (nextText) => {
375
+ setEditingIndex(null);
376
+ onEditUserMessage == null ? void 0 : onEditUserMessage(message, index, nextText);
377
+ requestAnimationFrame(() => scrollToBottom());
378
+ }
379
+ }
380
+ ) : /* @__PURE__ */ jsxs(Fragment, { children: [
381
+ /* @__PURE__ */ jsxs("div", { className: "iris-conversation-user-bubble", children: [
382
+ /* @__PURE__ */ jsx("p", { className: "iris-conversation-user-text", children: content }),
383
+ /* @__PURE__ */ jsx(
384
+ "time",
385
+ {
386
+ className: "iris-conversation-user-time",
387
+ dateTime: message.timestamp ?? message.timeStamp,
388
+ children: formatMessageTime(message.timestamp ?? message.timeStamp)
389
+ }
390
+ )
391
+ ] }),
392
+ /* @__PURE__ */ jsx(
393
+ UserMessageActions,
394
+ {
395
+ text: content,
396
+ onCopy: () => onCopyUserMessage == null ? void 0 : onCopyUserMessage(message, index),
397
+ onEdit: () => setEditingIndex(index)
398
+ }
399
+ )
400
+ ] }) })
401
+ },
402
+ `${message.id ?? "user"}-${index}`
403
+ );
404
+ }
405
+ const timeLabel = formatMessageTime(message.timestamp ?? message.timeStamp);
406
+ return /* @__PURE__ */ jsxs(
407
+ "div",
408
+ {
409
+ className: "iris-conversation-assistant-row",
410
+ children: [
411
+ /* @__PURE__ */ jsx("img", { alt: "", className: "iris-conversation-assistant-avatar", src: SmartBotIcon }),
412
+ /* @__PURE__ */ jsxs("div", { className: "iris-conversation-assistant-content", children: [
413
+ message.thinking ? /* @__PURE__ */ jsx("div", { className: "iris-conversation-assistant-thinking", children: /* @__PURE__ */ jsx(IrisThinking, { thinking: { ...message.thinking, phase: "complete" } }) }) : null,
414
+ content != null ? /* @__PURE__ */ jsxs(Fragment, { children: [
415
+ /* @__PURE__ */ jsxs("div", { className: "iris-conversation-assistant-bubble", children: [
416
+ /* @__PURE__ */ jsx("div", { className: "iris-conversation-assistant-text", children: content }),
417
+ timeLabel ? /* @__PURE__ */ jsx(
418
+ "time",
419
+ {
420
+ className: "iris-conversation-assistant-time",
421
+ dateTime: message.timestamp ?? message.timeStamp,
422
+ children: timeLabel
423
+ }
424
+ ) : null
425
+ ] }),
426
+ /* @__PURE__ */ jsx(
427
+ AssistantMessageActions,
428
+ {
429
+ actions: resolveIrisAssistantActions(message, defaultAssistantActions),
430
+ disliked: ((_a = message.extra) == null ? void 0 : _a.status) === "disliked",
431
+ liked: ((_b = message.extra) == null ? void 0 : _b.status) === "liked",
432
+ plainText,
433
+ onCopy: () => onCopyAssistantMessage == null ? void 0 : onCopyAssistantMessage(message, index),
434
+ onDislike: () => onDislikeAssistantMessage == null ? void 0 : onDislikeAssistantMessage(message, index),
435
+ onLike: () => onLikeAssistantMessage == null ? void 0 : onLikeAssistantMessage(message, index),
436
+ onRegenerate: () => onRegenerateAssistantMessage == null ? void 0 : onRegenerateAssistantMessage(message, index),
437
+ onRevert: () => onRevertAssistantMessage == null ? void 0 : onRevertAssistantMessage(message, index),
438
+ onSpeak: () => onSpeakAssistantMessage == null ? void 0 : onSpeakAssistantMessage(message, index)
439
+ }
440
+ )
441
+ ] }) : null
442
+ ] })
443
+ ]
444
+ },
445
+ `${message.id ?? "assistant"}-${index}`
446
+ );
447
+ }),
448
+ isThinking ? thinking ? /* @__PURE__ */ jsx("div", { className: "iris-conversation-thinking", children: /* @__PURE__ */ jsx(IrisThinking, { thinking }) }) : /* @__PURE__ */ jsxs(
449
+ "div",
450
+ {
451
+ "aria-label": t("chatBot.irisThinking"),
452
+ "aria-live": "polite",
453
+ className: "iris-conversation-thinking",
454
+ children: [
455
+ /* @__PURE__ */ jsx("img", { alt: "", className: "iris-conversation-assistant-avatar", src: SmartBotIcon }),
456
+ /* @__PURE__ */ jsxs("span", { "aria-hidden": "true", className: "iris-conversation-thinking-dots", children: [
457
+ /* @__PURE__ */ jsx("span", {}),
458
+ /* @__PURE__ */ jsx("span", {}),
459
+ /* @__PURE__ */ jsx("span", {})
460
+ ] })
461
+ ]
462
+ }
463
+ ) : null
464
+ ] })
465
+ ] });
466
+ }
467
+ export {
468
+ IrisConversationThread,
469
+ resolveIrisAssistantActions
470
+ };
@@ -0,0 +1,5 @@
1
+ /** Figma animation backdrop (node 2100:98856) — magenta glow + cyan glow. */
2
+ export declare function IrisGreetingBackdrop({ className }: {
3
+ className?: string;
4
+ }): import("react/jsx-runtime").JSX.Element;
5
+ //# sourceMappingURL=irisGreetingBackdrop.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"irisGreetingBackdrop.d.ts","sourceRoot":"","sources":["../../../src/components/Chatbot/irisGreetingBackdrop.tsx"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,wBAAgB,oBAAoB,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,2CAmDzE"}
@@ -0,0 +1,62 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ function IrisGreetingBackdrop({ className }) {
3
+ return /* @__PURE__ */ jsxs(
4
+ "svg",
5
+ {
6
+ "aria-hidden": "true",
7
+ className,
8
+ fill: "none",
9
+ height: "779",
10
+ overflow: "visible",
11
+ preserveAspectRatio: "none",
12
+ viewBox: "0 0 542 779",
13
+ width: "542",
14
+ xmlns: "http://www.w3.org/2000/svg",
15
+ children: [
16
+ /* @__PURE__ */ jsxs("g", { className: "chatbot-greeting-glow-group", opacity: "0.64", children: [
17
+ /* @__PURE__ */ jsx("g", { filter: "url(#chatbot-greeting-glow-pink)", children: /* @__PURE__ */ jsx("circle", { cx: "244", cy: "264", fill: "#FF00BF", fillOpacity: "0.06", r: "108" }) }),
18
+ /* @__PURE__ */ jsx("g", { filter: "url(#chatbot-greeting-glow-cyan)", children: /* @__PURE__ */ jsx("circle", { cx: "309", cy: "600", fill: "#00FFD9", fillOpacity: "0.16", r: "65" }) })
19
+ ] }),
20
+ /* @__PURE__ */ jsxs("defs", { children: [
21
+ /* @__PURE__ */ jsxs(
22
+ "filter",
23
+ {
24
+ colorInterpolationFilters: "sRGB",
25
+ filterUnits: "userSpaceOnUse",
26
+ height: "336",
27
+ id: "chatbot-greeting-glow-pink",
28
+ width: "336",
29
+ x: "76",
30
+ y: "96",
31
+ children: [
32
+ /* @__PURE__ */ jsx("feFlood", { floodOpacity: "0", result: "BackgroundImageFix" }),
33
+ /* @__PURE__ */ jsx("feBlend", { in: "SourceGraphic", in2: "BackgroundImageFix", mode: "normal", result: "shape" }),
34
+ /* @__PURE__ */ jsx("feGaussianBlur", { result: "effect1_foregroundBlur", stdDeviation: "30" })
35
+ ]
36
+ }
37
+ ),
38
+ /* @__PURE__ */ jsxs(
39
+ "filter",
40
+ {
41
+ colorInterpolationFilters: "sRGB",
42
+ filterUnits: "userSpaceOnUse",
43
+ height: "250",
44
+ id: "chatbot-greeting-glow-cyan",
45
+ width: "250",
46
+ x: "184",
47
+ y: "475",
48
+ children: [
49
+ /* @__PURE__ */ jsx("feFlood", { floodOpacity: "0", result: "BackgroundImageFix" }),
50
+ /* @__PURE__ */ jsx("feBlend", { in: "SourceGraphic", in2: "BackgroundImageFix", mode: "normal", result: "shape" }),
51
+ /* @__PURE__ */ jsx("feGaussianBlur", { result: "effect1_foregroundBlur", stdDeviation: "30" })
52
+ ]
53
+ }
54
+ )
55
+ ] })
56
+ ]
57
+ }
58
+ );
59
+ }
60
+ export {
61
+ IrisGreetingBackdrop
62
+ };
@@ -0,0 +1,11 @@
1
+ import { IrisMenuItemAction } from './Chatbot.types';
2
+
3
+ export interface IrisMenuListItemProps {
4
+ id: string | number;
5
+ label: string;
6
+ isCollapsed?: boolean;
7
+ onSelect?: () => void;
8
+ onAction?: (action: IrisMenuItemAction) => void;
9
+ }
10
+ export declare function IrisMenuListItem({ id, label, isCollapsed, onSelect, onAction, }: IrisMenuListItemProps): import("react/jsx-runtime").JSX.Element;
11
+ //# sourceMappingURL=irisMenuListItem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"irisMenuListItem.d.ts","sourceRoot":"","sources":["../../../src/components/Chatbot/irisMenuListItem.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAK1D,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;CACjD;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,EAAE,EACF,KAAK,EACL,WAAmB,EACnB,QAAQ,EACR,QAAQ,GACT,EAAE,qBAAqB,2CAuGvB"}
@@ -0,0 +1,126 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import default_1 from "../../node_modules/@mui/icons-material/AttachFileOutlined.js";
4
+ import { MoreHorizontal as MoreHorizontal_default, PinedIcon as PinedIcon_default, EditBlack as EditBlack_default, DeleteRedIcon as DeleteRedIcon_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 { useTranslation } from "../../i18n/useTranslation.js";
9
+ const ACTION_ICON_SIZE = 14;
10
+ const MORE_ICON_SIZE = 16;
11
+ function IrisMenuListItem({
12
+ id,
13
+ label,
14
+ isCollapsed = false,
15
+ onSelect,
16
+ onAction
17
+ }) {
18
+ const { t } = useTranslation();
19
+ const [menuAnchorEl, setMenuAnchorEl] = useState(null);
20
+ const isMenuOpen = Boolean(menuAnchorEl);
21
+ const menuId = `iris-menu-item-actions-${id}`;
22
+ const handleMoreClick = (event) => {
23
+ event.preventDefault();
24
+ event.stopPropagation();
25
+ setMenuAnchorEl(isMenuOpen ? null : event.currentTarget);
26
+ };
27
+ const handleCloseMenu = () => {
28
+ setMenuAnchorEl(null);
29
+ };
30
+ return /* @__PURE__ */ jsxs(
31
+ "div",
32
+ {
33
+ className: `iris-menu-list-item${isCollapsed ? " is-compact" : ""}${isMenuOpen ? " is-menu-open" : ""}`,
34
+ children: [
35
+ /* @__PURE__ */ jsx(
36
+ "button",
37
+ {
38
+ className: "iris-menu-list-item-main",
39
+ type: "button",
40
+ onClick: () => {
41
+ if (isMenuOpen) return;
42
+ onSelect == null ? void 0 : onSelect();
43
+ },
44
+ children: /* @__PURE__ */ jsx("span", { className: "iris-menu-list-item-label", children: label })
45
+ }
46
+ ),
47
+ /* @__PURE__ */ jsx(Tooltip, { title: t("chatBot.irisMenu.item.more"), variant: "tertiary", children: /* @__PURE__ */ jsx(
48
+ Button,
49
+ {
50
+ "aria-controls": isMenuOpen ? menuId : void 0,
51
+ "aria-expanded": isMenuOpen,
52
+ "aria-haspopup": "true",
53
+ "aria-label": t("chatBot.irisMenu.item.more"),
54
+ className: "iris-menu-list-item-more",
55
+ icon: /* @__PURE__ */ jsx(MoreHorizontal_default, { height: MORE_ICON_SIZE, width: MORE_ICON_SIZE }),
56
+ size: isCollapsed ? "small" : "large",
57
+ type: "default",
58
+ variant: "text",
59
+ onClick: handleMoreClick
60
+ }
61
+ ) }),
62
+ /* @__PURE__ */ jsx(
63
+ Menu,
64
+ {
65
+ MenuProps: {
66
+ anchorOrigin: { vertical: "bottom", horizontal: "right" },
67
+ transformOrigin: { vertical: "top", horizontal: "right" },
68
+ slotProps: {
69
+ root: { sx: { zIndex: 2e3 } },
70
+ paper: {
71
+ className: "iris-menu-item-actions-paper",
72
+ style: { width: 182, minWidth: 180, maxWidth: 240 }
73
+ }
74
+ }
75
+ },
76
+ anchorEl: menuAnchorEl,
77
+ id: menuId,
78
+ open: isMenuOpen,
79
+ options: [
80
+ {
81
+ label: t("chatBot.irisMenu.item.pin"),
82
+ value: "pin",
83
+ icon: /* @__PURE__ */ jsx(PinedIcon_default, { height: ACTION_ICON_SIZE, width: ACTION_ICON_SIZE }),
84
+ onClick: () => {
85
+ onAction == null ? void 0 : onAction("pin");
86
+ handleCloseMenu();
87
+ }
88
+ },
89
+ {
90
+ label: t("chatBot.irisMenu.item.rename"),
91
+ value: "rename",
92
+ icon: /* @__PURE__ */ jsx(EditBlack_default, { height: ACTION_ICON_SIZE, width: ACTION_ICON_SIZE }),
93
+ onClick: () => {
94
+ onAction == null ? void 0 : onAction("rename");
95
+ handleCloseMenu();
96
+ }
97
+ },
98
+ {
99
+ label: t("chatBot.irisMenu.item.archive"),
100
+ value: "archive",
101
+ icon: /* @__PURE__ */ jsx(default_1, { sx: { fontSize: ACTION_ICON_SIZE } }),
102
+ onClick: () => {
103
+ onAction == null ? void 0 : onAction("archive");
104
+ handleCloseMenu();
105
+ }
106
+ },
107
+ {
108
+ label: t("chatBot.irisMenu.item.delete"),
109
+ value: "delete",
110
+ icon: /* @__PURE__ */ jsx(DeleteRedIcon_default, { height: ACTION_ICON_SIZE, width: ACTION_ICON_SIZE }),
111
+ onClick: () => {
112
+ onAction == null ? void 0 : onAction("delete");
113
+ handleCloseMenu();
114
+ }
115
+ }
116
+ ],
117
+ onClose: handleCloseMenu
118
+ }
119
+ )
120
+ ]
121
+ }
122
+ );
123
+ }
124
+ export {
125
+ IrisMenuListItem
126
+ };