@epam/ai-dial-conversation-messages 1.2.0-dev.208 → 1.2.0-dev.209
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
|
-
{"version":3,"file":"AssistantMessageBubble.d.ts","sourceRoot":"","sources":["../../../src/components/MessageBubble/AssistantMessageBubble.tsx"],"names":[],"mappings":"AAYA,OAAO,EAAE,EAAE,EAAW,MAAM,OAAO,CAAC;AAGpC,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"AssistantMessageBubble.d.ts","sourceRoot":"","sources":["../../../src/components/MessageBubble/AssistantMessageBubble.tsx"],"names":[],"mappings":"AAYA,OAAO,EAAE,EAAE,EAAW,MAAM,OAAO,CAAC;AAGpC,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAa/E,gHAAgH;AAChH,eAAO,MAAM,sBAAsB,EAAE,EAAE,CAAC,2BAA2B,CAuNlE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserMessageBubble.d.ts","sourceRoot":"","sources":["../../../src/components/MessageBubble/UserMessageBubble.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,EAAE,EAAS,MAAM,OAAO,CAAC;AAElC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"UserMessageBubble.d.ts","sourceRoot":"","sources":["../../../src/components/MessageBubble/UserMessageBubble.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,EAAE,EAAS,MAAM,OAAO,CAAC;AAElC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAQ1E,kGAAkG;AAClG,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,CAgKxD,CAAC"}
|
package/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { AttachmentType as e, CopyIconButton as t, DeploymentIcon as n, MDMessageViewer as r, MessageRating as i, MessageRole as a, ResponseFormat as o, buildCssVars as s, mergeClasses as c, useCollapsedText as l } from "@epam/ai-dial-chat-shared";
|
|
2
2
|
import { AttachmentGroup as u } from "@epam/ai-dial-attachment-input";
|
|
3
3
|
import { Button as d, ButtonVariant as f, DIAL_ICON_SIZE as p, DIAL_KIT_ICON_STROKE as m, ElementSize as h, InfoMessageNotification as g, LinkButton as _, NeutralButton as v, ToggleIconButton as y } from "@epam/ai-dial-ui-kit";
|
|
4
|
-
import { useCallback as b, useEffect as x, useId as S, useLayoutEffect as C, useMemo as
|
|
5
|
-
import { IconArrowBackUp as
|
|
6
|
-
import { Fragment as
|
|
7
|
-
import { createPortal as
|
|
4
|
+
import { useCallback as b, useEffect as x, useId as S, useLayoutEffect as C, useMemo as ee, useRef as w, useState as T } from "react";
|
|
5
|
+
import { IconArrowBackUp as E, IconChevronDown as D, IconChevronUp as O, IconMarkdown as k, IconPencilMinus as te, IconRefresh as ne, IconThumbDown as A, IconThumbDownFilled as j, IconThumbUp as M, IconThumbUpFilled as N, IconTrashX as P } from "@tabler/icons-react";
|
|
6
|
+
import { Fragment as F, jsx as I, jsxs as L } from "react/jsx-runtime";
|
|
7
|
+
import { createPortal as R } from "react-dom";
|
|
8
8
|
//#region src/constants/public-class-names.ts
|
|
9
|
-
var
|
|
9
|
+
var z = {
|
|
10
10
|
userBubble: "dial-cm-user-bubble",
|
|
11
11
|
assistantContent: "dial-cm-assistant-content"
|
|
12
|
-
},
|
|
13
|
-
let t =
|
|
12
|
+
}, B = 4, V = (e) => {
|
|
13
|
+
let t = w(null), [n, r] = T(0);
|
|
14
14
|
return x(() => {
|
|
15
15
|
if (!e) return;
|
|
16
16
|
let n = t.current;
|
|
@@ -22,220 +22,276 @@ var B = {
|
|
|
22
22
|
return i.observe(n), () => i.disconnect();
|
|
23
23
|
}, [e]), {
|
|
24
24
|
slotRef: t,
|
|
25
|
-
firstLineIndent: e ? `calc(${n}px + ${
|
|
25
|
+
firstLineIndent: e ? `calc(${n}px + ${B}px)` : void 0
|
|
26
26
|
};
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
}, H = [
|
|
28
|
+
"href",
|
|
29
|
+
"src",
|
|
30
|
+
"alt",
|
|
31
|
+
"colspan",
|
|
32
|
+
"rowspan",
|
|
33
|
+
"start"
|
|
34
|
+
], U = new Set([
|
|
35
|
+
"pre",
|
|
36
|
+
"pre-wrap",
|
|
37
|
+
"pre-line",
|
|
38
|
+
"break-spaces"
|
|
39
|
+
]), W = (e) => {
|
|
40
|
+
let t = document.createElement(e.tagName.toLowerCase());
|
|
41
|
+
H.forEach((n) => {
|
|
42
|
+
let r = e.getAttribute(n);
|
|
43
|
+
r !== null && t.setAttribute(n, r);
|
|
44
|
+
});
|
|
45
|
+
let { whiteSpace: n } = window.getComputedStyle(e);
|
|
46
|
+
return U.has(n) && (t.style.whiteSpace = "pre-wrap"), t;
|
|
47
|
+
}, re = (e) => e instanceof SVGElement || window.getComputedStyle(e).display === "none", G = (e, t) => {
|
|
48
|
+
if (!t.intersectsNode(e)) return null;
|
|
49
|
+
if (e.nodeType === Node.TEXT_NODE) {
|
|
50
|
+
let n = e.data, r = e === t.startContainer ? t.startOffset : 0, i = e === t.endContainer ? t.endOffset : n.length;
|
|
51
|
+
return document.createTextNode(n.slice(r, i));
|
|
52
|
+
}
|
|
53
|
+
if (!(e instanceof Element) || re(e)) return null;
|
|
54
|
+
let n = W(e);
|
|
55
|
+
return e.childNodes.forEach((e) => {
|
|
56
|
+
let r = G(e, t);
|
|
57
|
+
r && n.appendChild(r);
|
|
58
|
+
}), n;
|
|
59
|
+
}, K = (e, t, n) => {
|
|
60
|
+
let r = e, i = t;
|
|
61
|
+
for (; i && i !== n && n.contains(i);) {
|
|
62
|
+
let e = W(i);
|
|
63
|
+
e.appendChild(r), r = e, i = i.parentElement;
|
|
64
|
+
}
|
|
65
|
+
return r;
|
|
66
|
+
}, q = (e, t) => {
|
|
67
|
+
let n = e.commonAncestorContainer, r = n instanceof Element ? n : n.parentElement;
|
|
68
|
+
if (!r) return null;
|
|
69
|
+
let i = G(r, e);
|
|
70
|
+
return i ? K(i, r.parentElement, t) : null;
|
|
71
|
+
}, ie = (e) => {
|
|
72
|
+
let t = window.getSelection();
|
|
73
|
+
if (!t || t.isCollapsed || t.rangeCount === 0 || !e.clipboardData) return;
|
|
74
|
+
let n = t.toString();
|
|
75
|
+
if (!n) return;
|
|
76
|
+
let r = document.createElement("div");
|
|
77
|
+
for (let n = 0; n < t.rangeCount; n++) {
|
|
78
|
+
let i = q(t.getRangeAt(n), e.currentTarget);
|
|
79
|
+
i && r.appendChild(i);
|
|
80
|
+
}
|
|
81
|
+
e.clipboardData.setData("text/html", r.innerHTML), e.clipboardData.setData("text/plain", n), e.preventDefault();
|
|
82
|
+
}, J = { activeRating: "_activeRating_ygoee_1" }, Y = 2e3, ae = ({ role: e = a.User, onEdit: n, onEditHover: r, onDelete: o, onRegenerate: l, onCopy: u, onCopyMarkdown: d, onLike: f, onDislike: g, activeRating: _, isAlwaysVisible: v, isDisabled: x = !1, className: S, labels: C, colors: ee }) => {
|
|
83
|
+
let { tooltips: w, ariaLabels: E } = C ?? {}, [D, O] = T(null), [R, z] = T(""), B = n != null || o != null || l != null || u != null || d != null || f != null || g != null, V = s({ "--ma-active-rating-text": ee?.activeRatingText }), H = b(() => {
|
|
84
|
+
u?.(), O("copy"), z(E?.copiedStatus ?? "Copied to clipboard"), setTimeout(() => O(null), Y);
|
|
85
|
+
}, [u, E?.copiedStatus]), U = b(() => {
|
|
86
|
+
d?.(), O("markdown"), z(E?.copiedMarkdownStatus ?? "Copied as Markdown to clipboard"), setTimeout(() => O(null), Y);
|
|
87
|
+
}, [d, E?.copiedMarkdownStatus]);
|
|
88
|
+
return B ? /* @__PURE__ */ L("div", {
|
|
34
89
|
role: "toolbar",
|
|
35
|
-
"aria-label":
|
|
36
|
-
style:
|
|
90
|
+
"aria-label": E?.actionsGroup ?? "Message actions",
|
|
91
|
+
style: V,
|
|
37
92
|
className: c("flex gap-1", !v && "opacity-0 group-hover:opacity-100", S),
|
|
38
|
-
children: [/* @__PURE__ */
|
|
93
|
+
children: [/* @__PURE__ */ I("span", {
|
|
39
94
|
role: "status",
|
|
40
95
|
"aria-live": "polite",
|
|
41
96
|
className: "sr-only",
|
|
42
|
-
children:
|
|
43
|
-
}), e === a.User ? /* @__PURE__ */
|
|
44
|
-
icon: /* @__PURE__ */
|
|
97
|
+
children: R
|
|
98
|
+
}), e === a.User ? /* @__PURE__ */ L(F, { children: [n && /* @__PURE__ */ I(y, {
|
|
99
|
+
icon: /* @__PURE__ */ I(te, {
|
|
45
100
|
size: p.SM,
|
|
46
101
|
"aria-hidden": !0,
|
|
47
102
|
stroke: m
|
|
48
103
|
}),
|
|
49
104
|
size: h.Small,
|
|
50
|
-
"aria-label":
|
|
51
|
-
tooltipProps: { tooltip:
|
|
105
|
+
"aria-label": E?.editMessage ?? "Edit message",
|
|
106
|
+
tooltipProps: { tooltip: w?.edit ?? "Edit" },
|
|
52
107
|
onClick: n,
|
|
53
108
|
onMouseEnter: r,
|
|
54
109
|
onFocus: r,
|
|
55
110
|
disabled: x
|
|
56
|
-
}), o && /* @__PURE__ */
|
|
57
|
-
icon: /* @__PURE__ */
|
|
111
|
+
}), o && /* @__PURE__ */ I(y, {
|
|
112
|
+
icon: /* @__PURE__ */ I(P, {
|
|
58
113
|
size: p.SM,
|
|
59
114
|
"aria-hidden": !0,
|
|
60
115
|
stroke: m
|
|
61
116
|
}),
|
|
62
117
|
size: h.Small,
|
|
63
|
-
"aria-label":
|
|
64
|
-
tooltipProps: { tooltip:
|
|
118
|
+
"aria-label": E?.deleteMessage ?? "Delete message",
|
|
119
|
+
tooltipProps: { tooltip: w?.delete ?? "Delete" },
|
|
65
120
|
onClick: o,
|
|
66
121
|
disabled: x
|
|
67
|
-
})] }) : /* @__PURE__ */
|
|
68
|
-
l && /* @__PURE__ */
|
|
69
|
-
icon: /* @__PURE__ */
|
|
122
|
+
})] }) : /* @__PURE__ */ L(F, { children: [
|
|
123
|
+
l && /* @__PURE__ */ I(y, {
|
|
124
|
+
icon: /* @__PURE__ */ I(ne, {
|
|
70
125
|
size: p.SM,
|
|
71
126
|
"aria-hidden": !0,
|
|
72
127
|
stroke: m
|
|
73
128
|
}),
|
|
74
129
|
size: h.Small,
|
|
75
|
-
"aria-label":
|
|
76
|
-
tooltipProps: { tooltip:
|
|
130
|
+
"aria-label": E?.regenerateResponse ?? "Regenerate response",
|
|
131
|
+
tooltipProps: { tooltip: w?.regenerate ?? "Regenerate" },
|
|
77
132
|
onClick: l,
|
|
78
133
|
disabled: x
|
|
79
134
|
}),
|
|
80
|
-
u && /* @__PURE__ */
|
|
135
|
+
u && /* @__PURE__ */ I(t, {
|
|
81
136
|
iconSize: p.SM,
|
|
82
|
-
onClick:
|
|
137
|
+
onClick: H,
|
|
83
138
|
size: h.Small,
|
|
84
|
-
isCopied:
|
|
85
|
-
copyLabel:
|
|
86
|
-
copiedLabel:
|
|
87
|
-
ariaLabel:
|
|
139
|
+
isCopied: D === "copy",
|
|
140
|
+
copyLabel: w?.copy ?? "Copy",
|
|
141
|
+
copiedLabel: w?.copied ?? "Copied!",
|
|
142
|
+
ariaLabel: E?.copyResponse ?? "Copy response",
|
|
88
143
|
isDisabled: x
|
|
89
144
|
}),
|
|
90
|
-
d && /* @__PURE__ */
|
|
145
|
+
d && /* @__PURE__ */ I(t, {
|
|
91
146
|
iconSize: p.SM,
|
|
92
|
-
onClick:
|
|
147
|
+
onClick: U,
|
|
93
148
|
size: h.Small,
|
|
94
|
-
isCopied:
|
|
95
|
-
iconCopy: /* @__PURE__ */
|
|
149
|
+
isCopied: D === "markdown",
|
|
150
|
+
iconCopy: /* @__PURE__ */ I(k, {
|
|
96
151
|
size: p.SM,
|
|
97
152
|
"aria-hidden": !0,
|
|
98
153
|
stroke: m
|
|
99
154
|
}),
|
|
100
|
-
copyLabel:
|
|
101
|
-
copiedLabel:
|
|
102
|
-
ariaLabel:
|
|
155
|
+
copyLabel: w?.copyMarkdown ?? "Copy as Markdown",
|
|
156
|
+
copiedLabel: w?.copiedMarkdown ?? "Copied!",
|
|
157
|
+
ariaLabel: E?.copyAsMarkdown ?? "Copy as markdown",
|
|
103
158
|
isDisabled: x
|
|
104
159
|
}),
|
|
105
|
-
f && /* @__PURE__ */
|
|
106
|
-
icon: _ === i.Like ? /* @__PURE__ */
|
|
107
|
-
className:
|
|
160
|
+
f && /* @__PURE__ */ I(y, {
|
|
161
|
+
icon: _ === i.Like ? /* @__PURE__ */ I(N, {
|
|
162
|
+
className: J.activeRating,
|
|
108
163
|
size: p.SM,
|
|
109
164
|
"aria-hidden": !0
|
|
110
|
-
}) : /* @__PURE__ */
|
|
165
|
+
}) : /* @__PURE__ */ I(M, {
|
|
111
166
|
size: p.SM,
|
|
112
167
|
"aria-hidden": !0,
|
|
113
168
|
stroke: m
|
|
114
169
|
}),
|
|
115
170
|
size: h.Small,
|
|
116
|
-
"aria-label":
|
|
171
|
+
"aria-label": E?.likeResponse ?? "Like response",
|
|
117
172
|
"aria-pressed": _ === i.Like,
|
|
118
|
-
tooltipProps: { tooltip:
|
|
173
|
+
tooltipProps: { tooltip: w?.like ?? "Like" },
|
|
119
174
|
onClick: f,
|
|
120
175
|
disabled: x
|
|
121
176
|
}),
|
|
122
|
-
g && /* @__PURE__ */
|
|
123
|
-
icon: _ === i.Dislike ? /* @__PURE__ */
|
|
124
|
-
className:
|
|
177
|
+
g && /* @__PURE__ */ I(y, {
|
|
178
|
+
icon: _ === i.Dislike ? /* @__PURE__ */ I(j, {
|
|
179
|
+
className: J.activeRating,
|
|
125
180
|
size: p.SM,
|
|
126
181
|
"aria-hidden": !0
|
|
127
|
-
}) : /* @__PURE__ */
|
|
182
|
+
}) : /* @__PURE__ */ I(A, {
|
|
128
183
|
size: p.SM,
|
|
129
184
|
"aria-hidden": !0,
|
|
130
185
|
stroke: m
|
|
131
186
|
}),
|
|
132
187
|
size: h.Small,
|
|
133
|
-
"aria-label":
|
|
188
|
+
"aria-label": E?.dislikeResponse ?? "Dislike response",
|
|
134
189
|
"aria-pressed": _ === i.Dislike,
|
|
135
|
-
tooltipProps: { tooltip:
|
|
190
|
+
tooltipProps: { tooltip: w?.dislike ?? "Dislike" },
|
|
136
191
|
onClick: g,
|
|
137
192
|
disabled: x
|
|
138
193
|
})
|
|
139
194
|
] })]
|
|
140
195
|
}) : null;
|
|
141
|
-
},
|
|
196
|
+
}, X = {
|
|
142
197
|
userBubble: "_userBubble_cq829_1",
|
|
143
198
|
collapsibleText: "_collapsibleText_cq829_6",
|
|
144
199
|
expandedText: "_expandedText_cq829_11",
|
|
145
200
|
collapsedText: "_collapsedText_cq829_15",
|
|
146
201
|
startersDivider: "_startersDivider_cq829_26",
|
|
147
202
|
text: "_text_cq829_30"
|
|
148
|
-
},
|
|
149
|
-
let { colors:
|
|
150
|
-
copyLabel:
|
|
151
|
-
copiedLabel:
|
|
152
|
-
downloadCsvLabel:
|
|
153
|
-
openInCanvasLabel:
|
|
203
|
+
}, oe = "[&>.cm-bubble-markdown>div>*:first-child]:indent-[var(--cm-bubble-first-line-indent,0px)]", Z = ({ text: t, contentRef: i, styles: l, actions: d, hasAlwaysVisibleActions: f, isStreaming: p, attachments: m, beforeContent: h, responseFormat: g, afterContent: _, starters: y, onSelectStarter: b, deploymentIconUrl: x, deploymentDisplayName: S, markdownComponents: C, markdownClassNames: w, markdownUrlTransform: T, onAttachmentClick: E, onDownloadAll: D, onAttachmentRetry: O, codeBlockTheme: k, tableOnOpenInCanvas: te, labels: ne, selectedAttachmentId: A }) => {
|
|
204
|
+
let { colors: j, typography: M, className: N, bubbleClassName: P } = l ?? {}, { attachmentClickLabel: F, attachmentRetryLabel: R, attachmentOpenInNewTabLabel: B, startersAriaLabel: H = "Quick reply buttons", thinkingLabel: U, codeBlockCopyLabel: W, codeBlockCopiedLabel: re, tableCopyLabel: G, tableCopiedLabel: K, tableDownloadCsvLabel: q, tableOpenInCanvasLabel: J, tableDownloadFilename: Y, tableScrollRegionAriaLabel: Z, assistantMessageAriaLabel: Q = "Assistant message", deploymentIconFallbackLabel: $ = "AI" } = ne ?? {}, se = ee(() => ({
|
|
205
|
+
copyLabel: G,
|
|
206
|
+
copiedLabel: K,
|
|
207
|
+
downloadCsvLabel: q,
|
|
208
|
+
openInCanvasLabel: J
|
|
154
209
|
}), [
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
]),
|
|
160
|
-
"--cm-bubble-text":
|
|
161
|
-
"--cm-starters-divider":
|
|
162
|
-
"--cm-bubble-first-line-indent":
|
|
163
|
-
}),
|
|
164
|
-
return /* @__PURE__ */
|
|
210
|
+
G,
|
|
211
|
+
K,
|
|
212
|
+
q,
|
|
213
|
+
J
|
|
214
|
+
]), ce = p ? (m ?? []).filter((t) => t.type !== e.Audio) : m ?? [], { slotRef: le, firstLineIndent: ue } = V(h != null && !!t), de = s({
|
|
215
|
+
"--cm-bubble-text": j?.text,
|
|
216
|
+
"--cm-starters-divider": j?.startersDivider,
|
|
217
|
+
"--cm-bubble-first-line-indent": ue
|
|
218
|
+
}), fe = c(X.text, M?.fontClassName), pe = !!(x || S);
|
|
219
|
+
return /* @__PURE__ */ L("div", {
|
|
165
220
|
role: "group",
|
|
166
|
-
"aria-label":
|
|
167
|
-
style:
|
|
168
|
-
|
|
169
|
-
|
|
221
|
+
"aria-label": Q,
|
|
222
|
+
style: de,
|
|
223
|
+
onCopy: ie,
|
|
224
|
+
className: c("flex w-full items-start gap-3", N),
|
|
225
|
+
children: [pe && /* @__PURE__ */ I(n, {
|
|
170
226
|
src: x,
|
|
171
227
|
size: 28,
|
|
172
|
-
initialsName: S ||
|
|
173
|
-
labels: { tooltip: S ??
|
|
174
|
-
}), /* @__PURE__ */
|
|
228
|
+
initialsName: S || $,
|
|
229
|
+
labels: { tooltip: S ?? $ }
|
|
230
|
+
}), /* @__PURE__ */ L("div", {
|
|
175
231
|
className: "flex w-full min-w-0 max-w-full flex-col items-start gap-5",
|
|
176
|
-
children: [/* @__PURE__ */
|
|
177
|
-
className: c("flex w-full min-w-0 max-w-full flex-col items-start gap-4",
|
|
232
|
+
children: [/* @__PURE__ */ L("div", {
|
|
233
|
+
className: c("flex w-full min-w-0 max-w-full flex-col items-start gap-4", P),
|
|
178
234
|
children: [
|
|
179
|
-
h != null && !t && /* @__PURE__ */
|
|
235
|
+
h != null && !t && /* @__PURE__ */ I("div", {
|
|
180
236
|
className: "min-w-0",
|
|
181
237
|
children: h
|
|
182
238
|
}),
|
|
183
|
-
(t || p) && /* @__PURE__ */
|
|
239
|
+
(t || p) && /* @__PURE__ */ L("div", {
|
|
184
240
|
"aria-live": "polite",
|
|
185
241
|
"aria-atomic": "false",
|
|
186
|
-
className: c(
|
|
187
|
-
children: [h != null && t && /* @__PURE__ */
|
|
188
|
-
ref:
|
|
242
|
+
className: c(fe, "relative min-w-0 max-w-full text-start", h != null && t && oe, z.assistantContent),
|
|
243
|
+
children: [h != null && t && /* @__PURE__ */ I("div", {
|
|
244
|
+
ref: le,
|
|
189
245
|
className: "absolute start-0 top-0",
|
|
190
246
|
children: h
|
|
191
|
-
}), /* @__PURE__ */
|
|
247
|
+
}), /* @__PURE__ */ I("div", {
|
|
192
248
|
ref: i,
|
|
193
249
|
className: "cm-bubble-markdown min-w-0 max-w-full",
|
|
194
|
-
children: /* @__PURE__ */
|
|
250
|
+
children: /* @__PURE__ */ I(r, {
|
|
195
251
|
content: t ?? "",
|
|
196
252
|
isPlainText: g === o.PlainText,
|
|
197
253
|
isStreaming: p,
|
|
198
|
-
thinkingLabel:
|
|
254
|
+
thinkingLabel: U,
|
|
199
255
|
components: C,
|
|
200
|
-
classNames:
|
|
201
|
-
urlTransform:
|
|
202
|
-
codeBlockCopyLabel:
|
|
203
|
-
codeBlockCopiedLabel:
|
|
204
|
-
codeBlockTheme:
|
|
205
|
-
tableActionLabels:
|
|
206
|
-
tableDownloadFilename:
|
|
207
|
-
tableOnOpenInCanvas:
|
|
208
|
-
tableScrollRegionAriaLabel:
|
|
256
|
+
classNames: w,
|
|
257
|
+
urlTransform: T,
|
|
258
|
+
codeBlockCopyLabel: W,
|
|
259
|
+
codeBlockCopiedLabel: re,
|
|
260
|
+
codeBlockTheme: k,
|
|
261
|
+
tableActionLabels: se,
|
|
262
|
+
tableDownloadFilename: Y,
|
|
263
|
+
tableOnOpenInCanvas: te,
|
|
264
|
+
tableScrollRegionAriaLabel: Z
|
|
209
265
|
})
|
|
210
266
|
})]
|
|
211
267
|
}),
|
|
212
|
-
/* @__PURE__ */
|
|
213
|
-
attachments:
|
|
214
|
-
onAttachmentClick: (e) =>
|
|
215
|
-
onDownloadAll:
|
|
216
|
-
onRetry:
|
|
268
|
+
/* @__PURE__ */ I(u, {
|
|
269
|
+
attachments: ce,
|
|
270
|
+
onAttachmentClick: (e) => E?.(m?.find((t) => t.id === e)),
|
|
271
|
+
onDownloadAll: D,
|
|
272
|
+
onRetry: O,
|
|
217
273
|
labels: {
|
|
218
|
-
clickLabel:
|
|
219
|
-
retryLabel:
|
|
220
|
-
openInNewTabLabel:
|
|
274
|
+
clickLabel: F,
|
|
275
|
+
retryLabel: R,
|
|
276
|
+
openInNewTabLabel: B
|
|
221
277
|
},
|
|
222
|
-
selectedAttachmentId:
|
|
278
|
+
selectedAttachmentId: A
|
|
223
279
|
}),
|
|
224
280
|
_,
|
|
225
|
-
/* @__PURE__ */
|
|
281
|
+
/* @__PURE__ */ I(ae, {
|
|
226
282
|
...d,
|
|
227
283
|
isAlwaysVisible: f,
|
|
228
284
|
role: a.Assistant
|
|
229
285
|
})
|
|
230
286
|
]
|
|
231
|
-
}), y && y.length > 0 && b && /* @__PURE__ */
|
|
287
|
+
}), y && y.length > 0 && b && /* @__PURE__ */ I("div", {
|
|
232
288
|
role: "list",
|
|
233
|
-
"aria-label":
|
|
234
|
-
className: c("flex w-full flex-wrap gap-2 border-t pt-5",
|
|
235
|
-
children: y.map((e, t) => /* @__PURE__ */
|
|
289
|
+
"aria-label": H,
|
|
290
|
+
className: c("flex w-full flex-wrap gap-2 border-t pt-5", X.startersDivider),
|
|
291
|
+
children: y.map((e, t) => /* @__PURE__ */ I("div", {
|
|
236
292
|
role: "listitem",
|
|
237
293
|
className: "min-w-[40px]",
|
|
238
|
-
children: /* @__PURE__ */
|
|
294
|
+
children: /* @__PURE__ */ I(v, {
|
|
239
295
|
label: e.title,
|
|
240
296
|
className: "min-w-[40px]",
|
|
241
297
|
onClick: () => b(e)
|
|
@@ -244,78 +300,79 @@ var B = {
|
|
|
244
300
|
})]
|
|
245
301
|
})]
|
|
246
302
|
});
|
|
247
|
-
},
|
|
303
|
+
}, Q = ({ labels: { titleText: e = "Model switched.", bodyText: t } }) => /* @__PURE__ */ I("div", {
|
|
248
304
|
role: "status",
|
|
249
305
|
"aria-live": "polite",
|
|
250
|
-
children: /* @__PURE__ */
|
|
306
|
+
children: /* @__PURE__ */ I(g, {
|
|
251
307
|
title: e,
|
|
252
308
|
message: t,
|
|
253
309
|
textClassName: "flex-row flex-wrap gap-1"
|
|
254
310
|
})
|
|
255
|
-
}),
|
|
311
|
+
}), $ = /* @__PURE__ */ function(e) {
|
|
256
312
|
return e.Bottom = "Bottom", e.Top = "Top", e;
|
|
257
|
-
}({}),
|
|
258
|
-
let { colors: C, typography:
|
|
313
|
+
}({}), se = 10, ce = ({ text: e, contentRef: t, position: n = $.Bottom, styles: r, actions: i, hasAlwaysVisibleActions: o, attachments: d, collapsedLineCount: f = se, labels: m, textSegments: g, onAttachmentClick: v, onDownloadAll: y, onAttachmentRetry: b, selectedAttachmentId: x }) => {
|
|
314
|
+
let { colors: C, typography: ee, className: w, bubbleClassName: T } = r ?? {}, { showMoreLabel: E = "Show more", showLessLabel: k = "Show less", showMoreAriaLabel: te, showLessAriaLabel: ne, attachmentClickLabel: A, attachmentRetryLabel: j, attachmentOpenInNewTabLabel: M, userMessageAriaLabel: N = "User message" } = m ?? {}, { textRef: P, isTextCollapsed: R, isOverflowing: B, collapsedMaxHeight: V, expandedMaxHeight: H, isCollapsed: U, toggleCollapsed: W } = l({
|
|
259
315
|
text: e ?? "",
|
|
260
316
|
collapsedLineCount: f
|
|
261
|
-
}),
|
|
317
|
+
}), re = s({
|
|
262
318
|
"--cm-bubble-user-bg": C?.userBackground,
|
|
263
319
|
"--cm-bubble-user-border": C?.userBorder,
|
|
264
320
|
"--cm-bubble-fade-start": C?.fadeStart,
|
|
265
321
|
"--cm-bubble-text": C?.text,
|
|
266
|
-
"--cm-bubble-collapsed-height":
|
|
267
|
-
"--cm-bubble-expanded-height":
|
|
268
|
-
}),
|
|
269
|
-
return /* @__PURE__ */
|
|
322
|
+
"--cm-bubble-collapsed-height": B ? `${V}px` : void 0,
|
|
323
|
+
"--cm-bubble-expanded-height": B ? `${H}px` : void 0
|
|
324
|
+
}), G = n === $.Top ? "rounded-ee-md rounded-se-2xl" : "rounded-se-md rounded-ee-2xl", K = c(X.text, ee?.fontClassName), q = te ?? E, J = ne ?? k, Y = U ? E : k, oe = U ? q : J, Z = U ? D : O, Q = S();
|
|
325
|
+
return /* @__PURE__ */ I("div", {
|
|
270
326
|
role: "group",
|
|
271
|
-
"aria-label":
|
|
272
|
-
style:
|
|
273
|
-
|
|
274
|
-
|
|
327
|
+
"aria-label": N,
|
|
328
|
+
style: re,
|
|
329
|
+
onCopy: ie,
|
|
330
|
+
className: c("flex w-full", w),
|
|
331
|
+
children: /* @__PURE__ */ L("div", {
|
|
275
332
|
className: "ms-auto flex w-fit min-w-0 max-w-full flex-col items-end gap-4",
|
|
276
333
|
children: [
|
|
277
|
-
/* @__PURE__ */
|
|
334
|
+
/* @__PURE__ */ I(u, {
|
|
278
335
|
attachments: d ?? [],
|
|
279
336
|
onAttachmentClick: (e) => v?.(d?.find((t) => t.id === e)),
|
|
280
337
|
onDownloadAll: y,
|
|
281
338
|
onRetry: b,
|
|
282
339
|
labels: {
|
|
283
|
-
clickLabel:
|
|
284
|
-
retryLabel:
|
|
285
|
-
openInNewTabLabel:
|
|
340
|
+
clickLabel: A,
|
|
341
|
+
retryLabel: j,
|
|
342
|
+
openInNewTabLabel: M
|
|
286
343
|
},
|
|
287
344
|
styles: { className: "max-w-[640px]" },
|
|
288
345
|
selectedAttachmentId: x
|
|
289
346
|
}),
|
|
290
|
-
e && /* @__PURE__ */
|
|
291
|
-
className: c(
|
|
292
|
-
children: /* @__PURE__ */
|
|
347
|
+
e && /* @__PURE__ */ I("div", {
|
|
348
|
+
className: c(X.userBubble, "flex w-fit items-center justify-end rounded-es-2xl rounded-ss-2xl border px-6 py-4", G, T, z.userBubble),
|
|
349
|
+
children: /* @__PURE__ */ L("div", {
|
|
293
350
|
className: "flex min-w-0 flex-col items-start",
|
|
294
|
-
children: [/* @__PURE__ */
|
|
295
|
-
id:
|
|
351
|
+
children: [/* @__PURE__ */ I("div", {
|
|
352
|
+
id: Q,
|
|
296
353
|
ref: t,
|
|
297
|
-
className: c("relative -me-1 -ms-1 w-[calc(100%+8px)] overflow-hidden pe-1 ps-1",
|
|
298
|
-
children: /* @__PURE__ */
|
|
299
|
-
ref:
|
|
300
|
-
className: c(
|
|
354
|
+
className: c("relative -me-1 -ms-1 w-[calc(100%+8px)] overflow-hidden pe-1 ps-1", B && X.collapsibleText, B && !U && X.expandedText, R && X.collapsedText),
|
|
355
|
+
children: /* @__PURE__ */ I("p", {
|
|
356
|
+
ref: P,
|
|
357
|
+
className: c(K, "whitespace-pre-wrap text-start [overflow-wrap:anywhere]"),
|
|
301
358
|
children: g ?? e
|
|
302
359
|
})
|
|
303
|
-
}),
|
|
304
|
-
label: /* @__PURE__ */
|
|
305
|
-
iconBefore: /* @__PURE__ */
|
|
360
|
+
}), B && /* @__PURE__ */ I(_, {
|
|
361
|
+
label: /* @__PURE__ */ I(F, { children: Y }),
|
|
362
|
+
iconBefore: /* @__PURE__ */ I(Z, {
|
|
306
363
|
size: p.SM,
|
|
307
364
|
"aria-hidden": "true"
|
|
308
365
|
}),
|
|
309
|
-
"aria-label":
|
|
310
|
-
"aria-expanded": !
|
|
311
|
-
"aria-controls":
|
|
366
|
+
"aria-label": oe,
|
|
367
|
+
"aria-expanded": !U,
|
|
368
|
+
"aria-controls": Q,
|
|
312
369
|
className: "mt-3",
|
|
313
|
-
onClick:
|
|
370
|
+
onClick: W,
|
|
314
371
|
size: h.Small
|
|
315
372
|
})]
|
|
316
373
|
})
|
|
317
374
|
}),
|
|
318
|
-
/* @__PURE__ */
|
|
375
|
+
/* @__PURE__ */ I(ae, {
|
|
319
376
|
...i,
|
|
320
377
|
isAlwaysVisible: o,
|
|
321
378
|
role: a.User
|
|
@@ -323,26 +380,26 @@ var B = {
|
|
|
323
380
|
]
|
|
324
381
|
})
|
|
325
382
|
});
|
|
326
|
-
},
|
|
383
|
+
}, le = ({ role: e, beforeContent: t, textSegments: n, onAttachmentClick: r, responseFormat: i, markdownComponents: o, markdownUrlTransform: s, ...c }) => e === a.Status ? /* @__PURE__ */ I(Q, { labels: {
|
|
327
384
|
titleText: c.labels?.statusTitleText,
|
|
328
385
|
bodyText: c.labels?.statusBodyText ?? ""
|
|
329
|
-
} }) : e === a.User ? /* @__PURE__ */
|
|
386
|
+
} }) : e === a.User ? /* @__PURE__ */ I(ce, {
|
|
330
387
|
...c,
|
|
331
388
|
textSegments: n,
|
|
332
389
|
onAttachmentClick: r
|
|
333
|
-
}) : /* @__PURE__ */
|
|
390
|
+
}) : /* @__PURE__ */ I(Z, {
|
|
334
391
|
...c,
|
|
335
392
|
beforeContent: t,
|
|
336
393
|
responseFormat: i,
|
|
337
394
|
markdownComponents: o,
|
|
338
395
|
markdownUrlTransform: s,
|
|
339
396
|
onAttachmentClick: r
|
|
340
|
-
}),
|
|
397
|
+
}), ue = { button: "_button_tqo4d_3" }, de = ({ rect: e, actionRef: t, onReply: n, addedRevision: r, labels: i, styles: a, portalContainer: o }) => {
|
|
341
398
|
let { colors: l, typography: u, className: p, buttonClassName: g } = a ?? {}, _ = u?.fontClassName ?? "dial-small-text", v = o === void 0 ? typeof document > "u" ? null : document.body : o, y = s({
|
|
342
399
|
"--cm-reply-background": l?.background,
|
|
343
400
|
"--cm-reply-hover-background": l?.hoverBackground,
|
|
344
401
|
"--cm-reply-text": l?.text
|
|
345
|
-
}), [b, x] =
|
|
402
|
+
}), [b, x] = T({
|
|
346
403
|
x: 0,
|
|
347
404
|
y: 0
|
|
348
405
|
});
|
|
@@ -361,33 +418,33 @@ var B = {
|
|
|
361
418
|
g,
|
|
362
419
|
_,
|
|
363
420
|
i.reply
|
|
364
|
-
]), v ?
|
|
421
|
+
]), v ? R(/* @__PURE__ */ L(F, { children: [e && /* @__PURE__ */ I("div", {
|
|
365
422
|
ref: t,
|
|
366
423
|
className: c("fixed left-0 top-0 z-50 max-w-[calc(100vw-16px)]", p),
|
|
367
424
|
style: {
|
|
368
425
|
...y,
|
|
369
426
|
transform: `translate(${b.x}px, ${b.y}px)`
|
|
370
427
|
},
|
|
371
|
-
children: /* @__PURE__ */
|
|
428
|
+
children: /* @__PURE__ */ I(d, {
|
|
372
429
|
variant: f.Neutral,
|
|
373
430
|
size: h.Small,
|
|
374
431
|
label: i.reply,
|
|
375
432
|
onClick: n,
|
|
376
433
|
textClassName: _,
|
|
377
|
-
className: c(
|
|
378
|
-
iconAfter: /* @__PURE__ */
|
|
434
|
+
className: c(ue.button, "h-8 min-h-8 min-w-11 px-2 shadow-lg mobile:h-11 mobile:min-h-11", g),
|
|
435
|
+
iconAfter: /* @__PURE__ */ I(E, {
|
|
379
436
|
size: 16,
|
|
380
437
|
stroke: m,
|
|
381
438
|
"aria-hidden": "true",
|
|
382
439
|
className: "rtl:scale-x-[-1]"
|
|
383
440
|
})
|
|
384
441
|
})
|
|
385
|
-
}), /* @__PURE__ */
|
|
442
|
+
}), /* @__PURE__ */ I("div", {
|
|
386
443
|
role: "status",
|
|
387
444
|
"aria-live": "polite",
|
|
388
445
|
className: "sr-only",
|
|
389
|
-
children: e ? i.selectionAvailable : r > 0 ? /* @__PURE__ */
|
|
446
|
+
children: e ? i.selectionAvailable : r > 0 ? /* @__PURE__ */ I("span", { children: i.attachmentAdded }, r) : null
|
|
390
447
|
})] }), v) : null;
|
|
391
448
|
};
|
|
392
449
|
//#endregion
|
|
393
|
-
export {
|
|
450
|
+
export { Z as AssistantMessageBubble, $ as BubblePosition, z as CONVERSATION_MESSAGES_CLASS, ae as MessageActions, le as MessageBubble, de as MessageSelectionReply, Q as StatusMessageBubble, ce as UserMessageBubble };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epam/ai-dial-conversation-messages",
|
|
3
3
|
"description": "Message bubble components for rendering conversation history with actions and source citations",
|
|
4
|
-
"version": "1.2.0-dev.
|
|
4
|
+
"version": "1.2.0-dev.209",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./index.js",
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@tabler/icons-react": "^3.44.0",
|
|
21
21
|
"react-markdown": "^10.1.0",
|
|
22
|
-
"@epam/ai-dial-attachment-input": "1.2.0-dev.
|
|
22
|
+
"@epam/ai-dial-attachment-input": "1.2.0-dev.209"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"react": "^19.2.8",
|
|
26
26
|
"react-dom": "^19.2.8",
|
|
27
|
-
"@epam/ai-dial-chat-shared": "1.2.0-dev.
|
|
28
|
-
"@epam/ai-dial-ui-kit": "^0.15.0-dev.
|
|
27
|
+
"@epam/ai-dial-chat-shared": "1.2.0-dev.209",
|
|
28
|
+
"@epam/ai-dial-ui-kit": "^0.15.0-dev.27"
|
|
29
29
|
},
|
|
30
30
|
"repository": {
|
|
31
31
|
"type": "git",
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ClipboardEvent } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* `onCopy` handler that writes the current selection to the clipboard without
|
|
4
|
+
* the app's colors and fonts. Left to itself, the browser inlines every
|
|
5
|
+
* computed style of the selected markup into `text/html`, so pasting into a
|
|
6
|
+
* rich-text target (Teams, Outlook, Word) brings along the message's
|
|
7
|
+
* background band. This keeps the structure (paragraphs, lists, tables, code,
|
|
8
|
+
* links, line breaks) and lets the target document style it.
|
|
9
|
+
*/
|
|
10
|
+
export declare const copySelectionWithoutStyles: (event: ClipboardEvent<HTMLElement>) => void;
|
|
11
|
+
//# sourceMappingURL=clipboard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clipboard.d.ts","sourceRoot":"","sources":["../../src/utils/clipboard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAwG5C;;;;;;;GAOG;AACH,eAAO,MAAM,0BAA0B,GACrC,OAAO,cAAc,CAAC,WAAW,CAAC,KACjC,IA0BF,CAAC"}
|