@epam/ai-dial-conversation-messages 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"MessageActions.d.ts","sourceRoot":"","sources":["../../../src/components/MessageActions/MessageActions.tsx"],"names":[],"mappings":"AAsBA,OAAO,EAAE,EAAE,EAAyB,MAAM,OAAO,CAAC;AAClD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAKxE,kIAAkI;AAClI,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CA4LlD,CAAC"}
1
+ {"version":3,"file":"MessageActions.d.ts","sourceRoot":"","sources":["../../../src/components/MessageActions/MessageActions.tsx"],"names":[],"mappings":"AAuBA,OAAO,EAAE,EAAE,EAAyB,MAAM,OAAO,CAAC;AAClD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAKxE,kIAAkI;AAClI,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CA8LlD,CAAC"}
package/index.css CHANGED
@@ -1,2 +1,2 @@
1
- ._activeRating_ygoee_1{color:var(--ma-active-rating-text,var(--text-accent,#1d4ed8))}._userBubble_qoxdz_1{border-color:var(--cm-bubble-user-border,var(--stroke-secondary,#d1dbea));background:var(--cm-bubble-user-bg,var(--bg-layer-sunken,#eef1f7))}._collapsibleText_qoxdz_6{max-height:var(--cm-bubble-collapsed-height);transition:max-height .2s ease-out}._expandedText_qoxdz_11{max-height:var(--cm-bubble-expanded-height)}._collapsedText_qoxdz_15:after{content:"";pointer-events:none;background:linear-gradient(to bottom, var(--cm-bubble-fade-start,var(--shadow-xs-sm-2,#161b2d08)), var(--cm-bubble-user-bg,var(--bg-layer-sunken,#eef1f7)));height:3rem;position:absolute;bottom:0;left:0;right:0}@media (prefers-reduced-motion:reduce){._collapsibleText_qoxdz_6{transition:none}}._startersDivider_qoxdz_26{border-color:var(--cm-starters-divider,var(--stroke-secondary,#d1dbea))}._text_qoxdz_30{color:var(--cm-bubble-text,var(--text-primary,#161b2d))}
1
+ ._activeRating_ygoee_1{color:var(--ma-active-rating-text,var(--text-accent,#1d4ed8))}._userBubble_cq829_1{border-color:var(--cm-bubble-user-border,var(--stroke-secondary,#d1dbea));background:var(--cm-bubble-user-bg,var(--bg-layer-sunken,#eef1f7))}._collapsibleText_cq829_6{max-height:var(--cm-bubble-collapsed-height);transition:max-height .2s ease-out}._expandedText_cq829_11{max-height:var(--cm-bubble-expanded-height)}._collapsedText_cq829_15:after{content:"";pointer-events:none;background:linear-gradient(to bottom, var(--cm-bubble-fade-start,var(--shadow-xs-2,#161b2d08)), var(--cm-bubble-user-bg,var(--bg-layer-sunken,#eef1f7)));height:3rem;position:absolute;bottom:0;left:0;right:0}@media (prefers-reduced-motion:reduce){._collapsibleText_cq829_6{transition:none}}._startersDivider_cq829_26{border-color:var(--cm-starters-divider,var(--stroke-secondary,#d1dbea))}._text_cq829_30{color:var(--cm-bubble-text,var(--text-primary,#161b2d))}
2
2
  /*$vite$:1*/
package/index.js CHANGED
@@ -1,815 +1,281 @@
1
- import { AttachmentErrorReason as e, AttachmentType as t, CopyIconButton as n, DeploymentIcon as r, MDMessageViewer as i, MIME_TYPE_EXT_MAP as a, MessageRating as o, MessageRole as s, RequestStatus as c, ResponseFormat as l, buildCssVars as u, mergeClasses as d, useCollapsedText as f } from "@epam/ai-dial-chat-shared";
2
- import { DIAL_ICON_SIZE as p, DialSlider as m, ElementSize as h, GhostIconButton as g, Highlight as _, InfoMessageNotification as v, LinkButton as y, NeutralButton as b, Popup as x, PopupSize as S, PrimaryButton as C, RadioGroup as w, RadioGroupOrientation as T, Skeleton as E, SkeletonVariant as D, Spinner as O, StaticIconButton as k, Textarea as A, ToggleIconButton as j, Tooltip as M } from "@epam/ai-dial-ui-kit";
3
- import { IconChevronDown as N, IconChevronUp as P, IconClipboard as F, IconDownload as I, IconExternalLink as L, IconFile as R, IconFileTypeBmp as z, IconFileTypeCss as B, IconFileTypeCsv as V, IconFileTypeDoc as H, IconFileTypeDocx as ee, IconFileTypeHtml as te, IconFileTypeJpg as ne, IconFileTypeJs as U, IconFileTypeJsx as W, IconFileTypePdf as re, IconFileTypePhp as ie, IconFileTypePng as ae, IconFileTypePpt as oe, IconFileTypeRs as se, IconFileTypeSql as ce, IconFileTypeSvg as le, IconFileTypeTs as ue, IconFileTypeTsx as de, IconFileTypeTxt as fe, IconFileTypeVue as pe, IconFileTypeXls as me, IconFileTypeXml as he, IconFileTypeZip as ge, IconMarkdown as _e, IconMusic as ve, IconPaperclip as ye, IconPencilMinus as be, IconPhoto as G, IconRefresh as xe, IconReload as Se, IconTerminal2 as Ce, IconThumbDown as we, IconThumbDownFilled as Te, IconThumbUp as Ee, IconThumbUpFilled as De, IconTrashX as Oe, IconVideo as ke, IconX as Ae } from "@tabler/icons-react";
4
- import "react-dom";
5
- import { memo as je, useCallback as K, useEffect as Me, useId as Ne, useMemo as Pe, useRef as Fe, useState as q } from "react";
6
- import { Fragment as J, jsx as Y, jsxs as X } from "react/jsx-runtime";
7
- //#region ../attachment-input/dist/index.js
8
- var Ie = (e) => {
9
- if (e == null) return "";
10
- let t = e.lastIndexOf(".");
11
- return t > 0 ? e.slice(0, t) : e;
12
- }, Le = (e) => {
13
- if (!e) return R;
14
- if (e.startsWith("image/")) switch (e) {
15
- case "image/jpeg":
16
- case "image/jpg": return ne;
17
- case "image/png": return ae;
18
- case "image/svg+xml": return le;
19
- case "image/bmp": return z;
20
- default: return G;
21
- }
22
- if (e.startsWith("video/")) return ke;
23
- if (e.startsWith("audio/")) return ve;
24
- switch (e) {
25
- case "application/pdf": return re;
26
- case "application/msword":
27
- case "application/vnd.ms-word": return H;
28
- case "application/vnd.openxmlformats-officedocument.wordprocessingml.document": return ee;
29
- case "application/vnd.ms-powerpoint": return oe;
30
- case "application/vnd.openxmlformats-officedocument.presentationml.presentation": return oe;
31
- case "application/vnd.ms-excel": return me;
32
- case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": return me;
33
- case "application/zip":
34
- case "application/x-zip-compressed":
35
- case "application/x-rar-compressed":
36
- case "application/x-7z-compressed":
37
- case "application/gzip":
38
- case "application/x-tar": return ge;
39
- case "text/csv": return V;
40
- case "text/plain": return fe;
41
- case "text/html":
42
- case "application/xhtml+xml": return te;
43
- case "text/xml":
44
- case "application/xml": return he;
45
- case "application/sql":
46
- case "text/x-sql": return ce;
47
- case "text/javascript":
48
- case "application/javascript": return U;
49
- case "text/jsx": return W;
50
- case "application/typescript":
51
- case "text/typescript": return ue;
52
- case "text/tsx": return de;
53
- case "text/css": return B;
54
- case "text/x-php":
55
- case "application/x-php": return ie;
56
- case "text/x-rustsrc":
57
- case "application/x-rust": return se;
58
- case "text/x-vue": return pe;
59
- default: return R;
60
- }
61
- }, Re = (e) => {
62
- let { type: n, contentType: r } = e;
63
- return n === t.Prompt ? Ce : n === t.Pasted ? F : n === t.Image ? G : Le(r ?? "");
64
- }, ze = (e) => {
65
- let t = e.toLowerCase().split(";")[0].trim(), n = a[t];
66
- if (n) return n;
67
- let r = t.split("/")[1];
68
- if (r && !r.startsWith("vnd.") && !r.includes("+")) return r;
69
- }, Be = (e, n) => {
70
- let { type: r, name: i, contentType: a } = e;
71
- if (r === t.Prompt) return n.promptLabel ?? "Prompt";
72
- if (r === t.Pasted) return n.pastedLabel ?? "Pasted";
73
- if (r === t.Image) return n.imageLabel ?? "Image";
74
- if (a) {
75
- let e = ze(a);
76
- if (e) return `.${e}`;
77
- }
78
- if (i == null) return "";
79
- let o = i.lastIndexOf(".");
80
- return o > 0 && o < i.length - 1 ? `.${i.slice(o + 1).toLowerCase()}` : i;
81
- }, Ve = (e, n = {}) => {
82
- let { type: r, status: i, previewUrl: a, url: o } = e, s = i === c.Loading, l = i === c.Error, u = r === t.Image && !!(a ?? o) && !l, d = r === t.Link && !l;
83
- return {
84
- isLoading: s,
85
- isError: l,
86
- isImage: u,
87
- isLink: d,
88
- BottomIcon: d ? null : Re(e),
89
- typeLabel: d ? null : Be(e, n)
90
- };
91
- }, He = "flex size-[84px] items-center justify-center rounded-xl border", Z = {
92
- tile: "_tile_1whwz_1",
93
- hovered: "_hovered_1whwz_5",
94
- selected: "_selected_1whwz_15",
95
- tileError: "_tileError_1whwz_20",
96
- nameText: "_nameText_1whwz_25",
97
- typeText: "_typeText_1whwz_29",
98
- retryIcon: "_retryIcon_1whwz_33",
99
- track: "_track_1whwz_37",
100
- actionButton: "_actionButton_1whwz_43",
101
- imageActionButton: "_imageActionButton_1whwz_47"
102
- }, Q = ({ ariaLabel: e, errorTitle: t, errorDescId: n, onClick: r, id: i, icon: a, className: o }) => /* @__PURE__ */ Y(k, {
103
- icon: a,
104
- size: h.Small,
105
- className: d("absolute end-1 top-1 opacity-0 focus-visible:opacity-100 group-focus-within/attachment-tile:opacity-100 group-hover/attachment-tile:opacity-100", Z.actionButton, o),
106
- "aria-label": e,
107
- "aria-describedby": t ? n : void 0,
108
- onClick: (e) => {
109
- e.stopPropagation(), r(i);
110
- }
111
- }), Ue = ({ ...e }) => /* @__PURE__ */ Y(Q, {
112
- icon: /* @__PURE__ */ Y(Se, {
113
- size: p.SM,
114
- "aria-hidden": !0
115
- }),
116
- className: Z.retryIcon,
117
- ...e
118
- }), We = ({ ...e }) => /* @__PURE__ */ Y(Q, {
119
- icon: /* @__PURE__ */ Y(I, {
120
- size: p.SM,
121
- "aria-hidden": !0
122
- }),
123
- ...e
124
- }), Ge = ({ ...e }) => /* @__PURE__ */ Y(Q, {
125
- icon: /* @__PURE__ */ Y(L, {
126
- size: p.SM,
127
- "aria-hidden": !0
128
- }),
129
- ...e
130
- }), Ke = ({ ...e }) => /* @__PURE__ */ Y(Q, {
131
- icon: /* @__PURE__ */ Y(Ae, {
132
- size: p.SM,
133
- "aria-hidden": !0
134
- }),
135
- ...e
136
- }), qe = {
137
- [e.Network]: "Upload failed · network error",
138
- [e.UnsupportedType]: "Upload failed · unsupported file type"
139
- }, Je = ({ attachment: t, searchQuery: n = "", onClick: r, onRetry: i, labels: a, styles: o, onDownload: s, isPasted: l, isLink: u, cssVars: f, onExpand: p, isExpandable: m, onRemove: h, isSelected: g }) => {
140
- let { clickLabel: v = "Download attachment", retryLabel: y = "Retry upload", sizeLabel: b, uploadingLabel: x = "Uploading", errorReasonLabels: S, genericErrorLabel: C = "Upload failed" } = a ?? {}, { typography: w, className: T } = o ?? {}, { id: E, name: D, status: k, errorReason: A } = t, j = k === c.Loading, M = k === c.Error, N = Ne(), P = M ? A && (S?.[A] ?? qe[A]) || C : "", { BottomIcon: F, typeLabel: I } = Ve(t), L = !M && !j && s && !u, R = M && !!i && A !== e.UnsupportedType, z = L || R ? "pe-5" : void 0, B = (e) => {
141
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), r?.(t.id));
142
- }, V = Pe(() => l ? D : Ie(D), [l, D]), H = K(() => {
143
- window.open(t.referenceUrl, "_blank", "noopener,noreferrer");
144
- }, [t]), ee = d(He, "group/attachment-tile relative flex-col justify-between items-start gap-1 overflow-hidden p-1.5", Z.tile, !M && Z.hovered, g && Z.selected, M && Z.tileError), te = /* @__PURE__ */ Y("div", {
145
- title: V,
146
- className: d(w?.nameClassName ?? "dial-caption-text", "line-clamp-2 min-w-0 break-all", Z.nameText, !M && z),
147
- children: n ? /* @__PURE__ */ Y(_, {
148
- text: V,
149
- query: n,
150
- maxLines: 2
151
- }) : V
152
- }), ne = F && /* @__PURE__ */ X("div", {
153
- className: d("flex w-full items-center gap-1", M && z),
154
- children: [/* @__PURE__ */ Y(F, {
155
- size: 16,
156
- className: Z.typeText,
157
- "aria-hidden": !0
158
- }), /* @__PURE__ */ Y("span", {
159
- className: d(w?.metaClassName ?? "dial-caption-text", "min-w-0 flex-1 truncate", Z.typeText),
160
- children: b ? `${I} · ${b}` : I
161
- })]
162
- }), U = () => {
163
- m && p ? p(E) : r && r(E);
164
- }, W = /* @__PURE__ */ X(J, { children: [
165
- te,
166
- ne,
167
- j && /* @__PURE__ */ Y("div", {
168
- "aria-label": x,
169
- className: d("absolute left-[-1px] top-[-1px] flex size-full items-center justify-center rounded", Z.track),
170
- children: /* @__PURE__ */ Y(O, { size: 32 })
171
- }),
172
- /* @__PURE__ */ X("div", {
173
- className: d("absolute right-0 top-0 flex gap-1"),
174
- children: [
175
- L && /* @__PURE__ */ Y(We, {
176
- ariaLabel: v,
177
- errorTitle: P,
178
- errorDescId: N,
179
- onClick: s,
180
- id: E
181
- }),
182
- R && /* @__PURE__ */ Y(Ue, {
183
- ariaLabel: y,
184
- errorTitle: P,
185
- errorDescId: N,
186
- onClick: i,
187
- id: E
188
- }),
189
- u && /* @__PURE__ */ Y(Ge, {
190
- ariaLabel: y,
191
- errorTitle: P,
192
- errorDescId: N,
193
- onClick: H
194
- }),
195
- h && /* @__PURE__ */ Y(Ke, {
196
- ariaLabel: y,
197
- errorTitle: P,
198
- errorDescId: N,
199
- onClick: h,
200
- id: E
201
- })
202
- ]
203
- }),
204
- M && /* @__PURE__ */ Y("span", {
205
- id: N,
206
- role: "status",
207
- "aria-live": "polite",
208
- className: "sr-only",
209
- children: P
210
- })
211
- ] });
212
- return /* @__PURE__ */ Y("div", {
213
- style: f,
214
- className: d("inline-flex", T),
215
- children: /* @__PURE__ */ Y("div", {
216
- role: "button",
217
- tabIndex: 0,
218
- "aria-label": v,
219
- onClick: U,
220
- onKeyDown: B,
221
- style: f,
222
- className: d(ee, "cursor-pointer focus-within:outline focus-within:outline-1 focus-within:outline-offset-1"),
223
- children: W
224
- })
225
- });
226
- }, Ye = /* @__PURE__ */ function(e) {
227
- return e.Idle = "idle", e.Loading = "loading", e.Loaded = "loaded", e.Error = "error", e;
228
- }({}), Xe = ({ enabled: e, src: t }) => {
229
- let n = Fe(null), [r, i] = q("idle");
230
- return Me(() => {
231
- i(e && t ? "loading" : "idle");
232
- }, [e, t]), Me(() => {
233
- let r = n.current;
234
- if (!r || !e || !t) return;
235
- let a = () => i("loaded"), o = () => i("error");
236
- return r.addEventListener("load", a), r.addEventListener("error", o), r.complete && i(r.naturalWidth > 0 ? "loaded" : "error"), () => {
237
- r.removeEventListener("load", a), r.removeEventListener("error", o);
238
- };
239
- }, [e, t]), {
240
- imageRef: n,
241
- imageLoadStatus: r
242
- };
243
- }, Ze = ({ attachment: e, onExpand: n, onClick: r, labels: i, onRemove: a, cssVars: o, onDownload: s, styles: c, isSelected: l }) => {
244
- let { clickLabel: u = "Open attachment", expandLabel: f = "Expand pasted text" } = i ?? {}, { className: m } = c ?? {}, { id: h, name: g } = e, _ = e.previewUrl ?? e.url, v = e.type === t.Pasted && n !== void 0, { isLoading: y, isError: b, isImage: x } = Pe(() => Ve(e), [e]), S = r !== void 0 && !v && !y && !b, { imageRef: C, imageLoadStatus: w } = Xe({
245
- enabled: x,
246
- src: _
247
- }), T = () => {
248
- v && n ? n(h) : S && r && r(h);
249
- };
250
- return /* @__PURE__ */ Y("div", {
251
- className: d(He, "group/attachment-tile", S && "cursor-pointer", Z.tile, l && Z.selected, m),
252
- onClick: T,
253
- onKeyDown: (e) => {
254
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), T());
255
- },
256
- tabIndex: 0,
257
- role: "button",
258
- style: o,
259
- "aria-label": S ? u : v ? f : void 0,
260
- children: /* @__PURE__ */ X("div", {
261
- className: "relative h-full w-full overflow-hidden",
262
- children: [
263
- a && /* @__PURE__ */ Y(Ke, {
264
- onClick: a,
265
- id: h,
266
- className: Z.imageActionButton
267
- }),
268
- s && /* @__PURE__ */ Y(We, {
269
- onClick: s,
270
- id: h,
271
- className: Z.imageActionButton
272
- }),
273
- w !== Ye.Loaded && /* @__PURE__ */ Y(E, {
274
- variant: D.Rectangular,
275
- width: "100%",
276
- height: "100%",
277
- active: w === Ye.Loading,
278
- overlay: /* @__PURE__ */ Y(G, {
279
- size: p.LG,
280
- className: Z.typeText,
281
- "aria-hidden": !0
282
- }),
283
- className: "absolute inset-0 rounded-xl"
284
- }),
285
- /* @__PURE__ */ Y("img", {
286
- ref: C,
287
- src: _,
288
- alt: g,
289
- loading: "lazy",
290
- decoding: "async",
291
- className: d("h-full w-full rounded-xl object-cover transition-opacity duration-200", w === Ye.Loaded ? "opacity-100" : "opacity-0")
292
- })
293
- ]
294
- })
295
- });
296
- }, Qe = ({ attachment: e, searchQuery: n = "", onRemove: r, onRetry: i, onExpand: a, onClick: o, onDownload: s, labels: c, styles: l, isSelected: d }) => {
297
- let { colors: f } = l ?? {}, p = e.type === t.Pasted, m = p && a !== void 0, h = u({
298
- "--ai-tile-bg": f?.background,
299
- "--ai-tile-border": f?.border,
300
- "--ai-tile-bg-hover": f?.backgroundHover,
301
- "--ai-tile-border-hover": f?.borderHover,
302
- "--ai-tile-bg-selected": f?.backgroundSelected,
303
- "--ai-tile-border-selected": f?.borderSelected,
304
- "--ai-tile-focus-outline": f?.focusOutline,
305
- "--ai-tile-bg-error": f?.backgroundError,
306
- "--ai-tile-border-error": f?.borderError,
307
- "--ai-tile-error-text": f?.errorText,
308
- "--ai-tile-name-text": f?.nameText,
309
- "--ai-tile-type-text": f?.typeText,
310
- "--ai-tile-hover-icon-bg": f?.hoverIconBackground,
311
- "--ai-tile-hover-icon-color": f?.hoverIconColor,
312
- "--ai-tile-progress-track": f?.trackBackground
313
- }), { isImage: g, isLink: _ } = Pe(() => Ve(e), [e]);
314
- return g ? /* @__PURE__ */ Y(Ze, {
315
- attachment: e,
316
- labels: c,
317
- onClick: o,
318
- onExpand: a,
319
- styles: l,
320
- onRemove: r,
321
- cssVars: h,
322
- onDownload: s,
323
- isSelected: d
324
- }) : /* @__PURE__ */ Y(Je, {
325
- attachment: e,
326
- searchQuery: n,
327
- onClick: o,
328
- onRetry: i,
329
- onRemove: r,
330
- onDownload: s,
331
- isLink: _,
332
- isPasted: p,
333
- styles: l,
334
- labels: c,
335
- onExpand: a,
336
- cssVars: h,
337
- isExpandable: m,
338
- isSelected: d
339
- });
340
- }, $e = {
341
- headerIcon: "_headerIcon_1dmgi_1",
342
- headerLabel: "_headerLabel_1dmgi_2"
343
- }, et = (e, t) => `${e} ${t}${e === 1 ? "" : "s"}`, tt = ({ attachments: e, onAttachmentClick: n, onDownloadAll: r, onRetry: i, labels: a, styles: o, selectedAttachmentId: s }) => {
344
- let { ariaLabel: l = "Attachments", clickLabel: f = "Download attachment", retryLabel: m = "Retry upload", downloadAllLabel: _ = "Download all", openInNewTabLabel: v, getHeaderLabel: y = (e) => et(e, "attachment"), promptLabel: b, pastedLabel: x, imageLabel: S } = a ?? {}, { typography: C, colors: w, className: T } = o ?? {}, E = u({ "--ai-group-text": w?.text });
345
- if (e.length === 0) return null;
346
- let D = e.some((e) => e.type === t.Image), O = e.some((e) => e.type !== t.Image), k = D && O, A = e.length >= 5, j = k ? ye : D ? G : R, M = y(e.length), N = () => {
347
- let t = e.filter((e) => e.status === c.Idle);
348
- r ? r(t) : t.forEach((e) => n?.(e.id));
349
- }, P = (t) => {
350
- let n = e.find((e) => e.id === t);
351
- n && r?.([n]);
352
- };
353
- return /* @__PURE__ */ X("div", {
354
- role: "group",
355
- "aria-label": l,
356
- style: E,
357
- className: d("flex flex-col gap-1", A ? "w-full min-w-0 max-w-[492px]" : "max-w-[420px]", $e.container, T),
358
- children: [/* @__PURE__ */ X("div", {
359
- className: "flex items-center justify-between",
360
- children: [/* @__PURE__ */ X("div", {
361
- className: "flex items-center gap-1",
362
- children: [/* @__PURE__ */ Y(j, {
363
- size: p.SM,
364
- className: d("shrink-0", $e.headerIcon),
365
- "aria-hidden": !0
366
- }), /* @__PURE__ */ Y("span", {
367
- className: d(C?.headerLabelClassName ?? "dial-tiny-semi-text", $e.headerLabel),
368
- children: M
369
- })]
370
- }), e.length >= 2 && (r || n) && /* @__PURE__ */ Y(g, {
371
- icon: /* @__PURE__ */ Y(I, {
372
- size: p.SM,
373
- "aria-hidden": !0
374
- }),
375
- size: h.Small,
376
- "aria-label": _,
377
- onClick: N
378
- })]
379
- }), /* @__PURE__ */ Y("div", {
380
- role: "list",
381
- "aria-label": M,
382
- className: d("gap-3", A ? "grid grid-cols-[repeat(5,83px)]" : "flex flex-wrap"),
383
- children: e.map((e, t) => /* @__PURE__ */ Y("div", {
384
- role: "listitem",
385
- children: /* @__PURE__ */ Y(Qe, {
386
- attachment: e,
387
- onClick: n,
388
- onDownload: P,
389
- onRetry: i,
390
- labels: {
391
- clickLabel: f,
392
- retryLabel: m,
393
- promptLabel: b,
394
- pastedLabel: x,
395
- imageLabel: S,
396
- openInNewTabLabel: v
397
- },
398
- isSelected: e.id === s
399
- })
400
- }, `${e.id}-${t}`))
401
- })]
402
- });
403
- }, nt = ({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemperature: r, onSave: i, onClose: a, isOpen: o }) => {
404
- let [s, c] = q(t), [l, u] = q(n), [d, f] = q(r), p = Fe(o);
405
- Me(() => {
406
- o && !p.current && (c(t), u(n), f(r)), p.current = o;
407
- }, [
408
- o,
409
- t,
410
- n,
411
- r
412
- ]);
413
- let m = !e.responseFormat || s != null;
414
- return {
415
- responseFormat: s,
416
- systemPrompt: l,
417
- temperature: d,
418
- canSubmit: m,
419
- setResponseFormat: c,
420
- setSystemPrompt: u,
421
- setTemperature: f,
422
- handleSubmit: K(() => {
423
- if (!m) return;
424
- let t = {};
425
- e.responseFormat && s != null && (t.responseFormat = s), e.systemPrompt && (t.systemPrompt = l), e.temperature && (t.temperature = d), i(t), a();
426
- }, [
427
- m,
428
- e,
429
- s,
430
- l,
431
- d,
432
- i,
433
- a
434
- ])
435
- };
436
- }, rt = { label: "_label_14i7c_1" }, it = ({ features: e, responseFormat: t, systemPrompt: n, temperature: r, onResponseFormatChange: i, onSystemPromptChange: a, onTemperatureChange: o, responseFormatLabel: s = "Response format", responseFormatHint: c = "Applies to new and existing messages", responseFormatMarkdownLabel: f = "Markdown", responseFormatPlainTextLabel: p = "Plain text", systemPromptLabel: h = "System prompt", systemPromptTooltip: g = "Enter a prompt", temperatureLabel: _ = "Temperature", temperatureLabels: v = [
437
- "Precise",
438
- "Neutral",
439
- "Creative"
440
- ], temperatureHint: y, labelClassName: b = "!dial-small-semi-text", colors: x }) => {
441
- let S = u({ "--csf-label-text": x?.labelText }), C = d(b, rt.label, "gap-1");
442
- return /* @__PURE__ */ X("div", {
443
- className: "flex flex-col gap-4 px-6 pb-3",
444
- style: S,
445
- children: [
446
- e.responseFormat && /* @__PURE__ */ Y(w, {
447
- id: "response-format",
448
- labelProps: {
449
- label: s,
450
- className: C,
451
- caption: c
452
- },
453
- optionsClassName: "mb-2",
454
- orientation: T.Column,
455
- value: t ?? l.Markdown,
456
- items: [{
457
- value: l.Markdown,
458
- label: f
459
- }, {
460
- value: l.PlainText,
461
- label: p
462
- }],
463
- onChange: (e) => i(e)
464
- }),
465
- e.systemPrompt && /* @__PURE__ */ Y(A, {
466
- value: n,
467
- placeholder: g,
468
- resize: !0,
469
- labelProps: {
470
- className: C,
471
- label: h
472
- },
473
- onChange: (e) => a(e ?? "")
474
- }),
475
- e.temperature && /* @__PURE__ */ Y(m, {
476
- labelProps: {
477
- label: _,
478
- className: C,
479
- caption: y
480
- },
481
- value: r,
482
- min: 0,
483
- max: 1,
484
- step: .1,
485
- labels: v,
486
- onChange: o
487
- })
488
- ]
489
- });
490
- }, at = { modal: "_modal_kl0h0_1" };
491
- je(({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemperature: r, onSave: i, onClose: a, title: o = "Chat settings", titleClassName: s = "dial-h1-text", responseFormatLabel: c, responseFormatHint: l, responseFormatMarkdownLabel: u, responseFormatPlainTextLabel: d, systemPromptLabel: f, systemPromptTooltip: p, temperatureLabel: m, temperatureLabels: h, temperatureHint: g, saveLabel: _ = "Apply changes", saveDisabledTooltip: v, backgroundClassName: y = at.modal }) => {
492
- let { responseFormat: b, systemPrompt: w, temperature: T, canSubmit: E, setResponseFormat: D, setSystemPrompt: O, setTemperature: k, handleSubmit: A } = nt({
493
- features: e,
494
- initialResponseFormat: t,
495
- initialSystemPrompt: n,
496
- initialTemperature: r,
497
- onSave: i,
498
- onClose: a
499
- });
500
- return /* @__PURE__ */ Y(x, {
501
- open: !0,
502
- header: o,
503
- titleClassName: s,
504
- size: S.Sm,
505
- onClose: a,
506
- className: y,
507
- footer: /* @__PURE__ */ Y("div", {
508
- className: "flex justify-end px-6 py-4",
509
- children: /* @__PURE__ */ Y(M, {
510
- tooltip: v,
511
- hideTooltip: E || !v,
512
- children: /* @__PURE__ */ Y(C, {
513
- label: _,
514
- onClick: A,
515
- disabled: !E
516
- })
517
- })
518
- }),
519
- children: /* @__PURE__ */ Y(it, {
520
- features: e,
521
- responseFormat: b,
522
- systemPrompt: w,
523
- temperature: T,
524
- onResponseFormatChange: D,
525
- onSystemPromptChange: O,
526
- onTemperatureChange: k,
527
- responseFormatLabel: c,
528
- responseFormatHint: l,
529
- responseFormatMarkdownLabel: u,
530
- responseFormatPlainTextLabel: d,
531
- systemPromptLabel: f,
532
- systemPromptTooltip: p,
533
- temperatureLabel: m,
534
- temperatureLabels: h,
535
- temperatureHint: g
536
- })
537
- });
538
- });
539
- var ot = { activeRating: "_activeRating_ygoee_1" }, st = 2e3, ct = ({ role: e = s.User, onEdit: t, onEditHover: r, onDelete: i, onRegenerate: a, onCopy: c, onCopyMarkdown: l, onLike: f, onDislike: m, activeRating: g, isAlwaysVisible: _, className: v, labels: y, colors: b }) => {
540
- let { tooltips: x, ariaLabels: S } = y ?? {}, [C, w] = q(null), [T, E] = q(""), D = u({ "--ma-active-rating-text": b?.activeRatingText }), O = K(() => {
541
- c?.(), w("copy"), E(S?.copiedStatus ?? "Copied to clipboard"), setTimeout(() => w(null), st);
542
- }, [c, S?.copiedStatus]), k = K(() => {
543
- l?.(), w("markdown"), E(S?.copiedMarkdownStatus ?? "Copied as Markdown to clipboard"), setTimeout(() => w(null), st);
544
- }, [l, S?.copiedMarkdownStatus]);
545
- return /* @__PURE__ */ X("div", {
1
+ import { AttachmentType as e, CopyIconButton as t, DeploymentIcon as n, MDMessageViewer as r, MessageRating as i, MessageRole as a, buildCssVars as o, mergeClasses as s, useCollapsedText as c } from "@epam/ai-dial-chat-shared";
2
+ import { AttachmentGroup as l } from "@epam/ai-dial-attachment-input";
3
+ import { DIAL_ICON_SIZE as u, DIAL_KIT_ICON_STROKE as d, ElementSize as f, InfoMessageNotification as p, LinkButton as m, NeutralButton as h, ToggleIconButton as g } from "@epam/ai-dial-ui-kit";
4
+ import { IconChevronDown as _, IconChevronUp as v, IconMarkdown as y, IconPencilMinus as b, IconRefresh as x, IconThumbDown as S, IconThumbDownFilled as C, IconThumbUp as w, IconThumbUpFilled as T, IconTrashX as E } from "@tabler/icons-react";
5
+ import { useCallback as D, useId as O, useState as k } from "react";
6
+ import { Fragment as A, jsx as j, jsxs as M } from "react/jsx-runtime";
7
+ var N = { activeRating: "_activeRating_ygoee_1" }, P = 2e3, F = ({ role: e = a.User, onEdit: n, onEditHover: r, onDelete: c, onRegenerate: l, onCopy: p, onCopyMarkdown: m, onLike: h, onDislike: _, activeRating: v, isAlwaysVisible: O, className: F, labels: I, colors: L }) => {
8
+ let { tooltips: R, ariaLabels: z } = I ?? {}, [B, V] = k(null), [H, U] = k(""), W = o({ "--ma-active-rating-text": L?.activeRatingText }), G = D(() => {
9
+ p?.(), V("copy"), U(z?.copiedStatus ?? "Copied to clipboard"), setTimeout(() => V(null), P);
10
+ }, [p, z?.copiedStatus]), K = D(() => {
11
+ m?.(), V("markdown"), U(z?.copiedMarkdownStatus ?? "Copied as Markdown to clipboard"), setTimeout(() => V(null), P);
12
+ }, [m, z?.copiedMarkdownStatus]);
13
+ return /* @__PURE__ */ M("div", {
546
14
  role: "toolbar",
547
- "aria-label": S?.actionsGroup ?? "Message actions",
548
- style: D,
549
- className: d("flex gap-1", !_ && "opacity-0 group-hover:opacity-100", v),
550
- children: [/* @__PURE__ */ Y("span", {
15
+ "aria-label": z?.actionsGroup ?? "Message actions",
16
+ style: W,
17
+ className: s("flex gap-1", !O && "opacity-0 group-hover:opacity-100", F),
18
+ children: [/* @__PURE__ */ j("span", {
551
19
  role: "status",
552
20
  "aria-live": "polite",
553
21
  className: "sr-only",
554
- children: T
555
- }), e === s.User ? /* @__PURE__ */ X(J, { children: [t && /* @__PURE__ */ Y(j, {
556
- icon: /* @__PURE__ */ Y(be, {
557
- size: p.SM,
22
+ children: H
23
+ }), e === a.User ? /* @__PURE__ */ M(A, { children: [n && /* @__PURE__ */ j(g, {
24
+ icon: /* @__PURE__ */ j(b, {
25
+ size: u.SM,
558
26
  "aria-hidden": !0,
559
- stroke: 1.5
27
+ stroke: d
560
28
  }),
561
- size: h.Small,
562
- "aria-label": S?.editMessage ?? "Edit message",
563
- tooltipProps: { tooltip: x?.edit ?? "Edit" },
564
- onClick: t,
29
+ size: f.Small,
30
+ "aria-label": z?.editMessage ?? "Edit message",
31
+ tooltipProps: { tooltip: R?.edit ?? "Edit" },
32
+ onClick: n,
565
33
  onMouseEnter: r,
566
34
  onFocus: r
567
- }), i && /* @__PURE__ */ Y(j, {
568
- icon: /* @__PURE__ */ Y(Oe, {
569
- size: p.SM,
35
+ }), c && /* @__PURE__ */ j(g, {
36
+ icon: /* @__PURE__ */ j(E, {
37
+ size: u.SM,
570
38
  "aria-hidden": !0,
571
- stroke: 1.5
39
+ stroke: d
572
40
  }),
573
- size: h.Small,
574
- "aria-label": S?.deleteMessage ?? "Delete message",
575
- tooltipProps: { tooltip: x?.delete ?? "Delete" },
576
- onClick: i
577
- })] }) : /* @__PURE__ */ X(J, { children: [
578
- a && /* @__PURE__ */ Y(j, {
579
- icon: /* @__PURE__ */ Y(xe, {
580
- size: p.SM,
41
+ size: f.Small,
42
+ "aria-label": z?.deleteMessage ?? "Delete message",
43
+ tooltipProps: { tooltip: R?.delete ?? "Delete" },
44
+ onClick: c
45
+ })] }) : /* @__PURE__ */ M(A, { children: [
46
+ l && /* @__PURE__ */ j(g, {
47
+ icon: /* @__PURE__ */ j(x, {
48
+ size: u.SM,
581
49
  "aria-hidden": !0,
582
- stroke: 1.5
50
+ stroke: d
583
51
  }),
584
- size: h.Small,
585
- "aria-label": S?.regenerateResponse ?? "Regenerate response",
586
- tooltipProps: { tooltip: x?.regenerate ?? "Regenerate" },
587
- onClick: a
52
+ size: f.Small,
53
+ "aria-label": z?.regenerateResponse ?? "Regenerate response",
54
+ tooltipProps: { tooltip: R?.regenerate ?? "Regenerate" },
55
+ onClick: l
588
56
  }),
589
- c && /* @__PURE__ */ Y(n, {
590
- iconSize: p.SM,
591
- onClick: O,
592
- size: h.Small,
593
- isCopied: C === "copy",
594
- copyLabel: x?.copy ?? "Copy",
595
- copiedLabel: x?.copied ?? "Copied!",
596
- ariaLabel: S?.copyResponse ?? "Copy response"
57
+ p && /* @__PURE__ */ j(t, {
58
+ iconSize: u.SM,
59
+ onClick: G,
60
+ size: f.Small,
61
+ isCopied: B === "copy",
62
+ copyLabel: R?.copy ?? "Copy",
63
+ copiedLabel: R?.copied ?? "Copied!",
64
+ ariaLabel: z?.copyResponse ?? "Copy response"
597
65
  }),
598
- l && /* @__PURE__ */ Y(n, {
599
- iconSize: p.SM,
600
- onClick: k,
601
- size: h.Small,
602
- isCopied: C === "markdown",
603
- iconCopy: /* @__PURE__ */ Y(_e, {
604
- size: p.SM,
66
+ m && /* @__PURE__ */ j(t, {
67
+ iconSize: u.SM,
68
+ onClick: K,
69
+ size: f.Small,
70
+ isCopied: B === "markdown",
71
+ iconCopy: /* @__PURE__ */ j(y, {
72
+ size: u.SM,
605
73
  "aria-hidden": !0,
606
- stroke: 1.5
74
+ stroke: d
607
75
  }),
608
- copyLabel: x?.copyMarkdown ?? "Copy as Markdown",
609
- copiedLabel: x?.copiedMarkdown ?? "Copied!",
610
- ariaLabel: S?.copyAsMarkdown ?? "Copy as markdown"
76
+ copyLabel: R?.copyMarkdown ?? "Copy as Markdown",
77
+ copiedLabel: R?.copiedMarkdown ?? "Copied!",
78
+ ariaLabel: z?.copyAsMarkdown ?? "Copy as markdown"
611
79
  }),
612
- f && /* @__PURE__ */ Y(j, {
613
- icon: g === o.Like ? /* @__PURE__ */ Y(De, {
614
- className: ot.activeRating,
615
- size: p.SM,
616
- stroke: 1.5,
80
+ h && /* @__PURE__ */ j(g, {
81
+ icon: v === i.Like ? /* @__PURE__ */ j(T, {
82
+ className: N.activeRating,
83
+ size: u.SM,
617
84
  "aria-hidden": !0
618
- }) : /* @__PURE__ */ Y(Ee, {
619
- size: p.SM,
85
+ }) : /* @__PURE__ */ j(w, {
86
+ size: u.SM,
620
87
  "aria-hidden": !0,
621
- stroke: 1.5
88
+ stroke: d
622
89
  }),
623
- size: h.Small,
624
- "aria-label": S?.likeResponse ?? "Like response",
625
- "aria-pressed": g === o.Like,
626
- tooltipProps: { tooltip: x?.like ?? "Like" },
627
- onClick: f
90
+ size: f.Small,
91
+ "aria-label": z?.likeResponse ?? "Like response",
92
+ "aria-pressed": v === i.Like,
93
+ tooltipProps: { tooltip: R?.like ?? "Like" },
94
+ onClick: h
628
95
  }),
629
- m && /* @__PURE__ */ Y(j, {
630
- icon: g === o.Dislike ? /* @__PURE__ */ Y(Te, {
631
- className: ot.activeRating,
632
- size: p.SM,
633
- "aria-hidden": !0,
634
- stroke: 1.5
635
- }) : /* @__PURE__ */ Y(we, {
636
- size: p.SM,
96
+ _ && /* @__PURE__ */ j(g, {
97
+ icon: v === i.Dislike ? /* @__PURE__ */ j(C, {
98
+ className: N.activeRating,
99
+ size: u.SM,
100
+ "aria-hidden": !0
101
+ }) : /* @__PURE__ */ j(S, {
102
+ size: u.SM,
637
103
  "aria-hidden": !0,
638
- stroke: 1.5
104
+ stroke: d
639
105
  }),
640
- size: h.Small,
641
- "aria-label": S?.dislikeResponse ?? "Dislike response",
642
- "aria-pressed": g === o.Dislike,
643
- tooltipProps: { tooltip: x?.dislike ?? "Dislike" },
644
- onClick: m
106
+ size: f.Small,
107
+ "aria-label": z?.dislikeResponse ?? "Dislike response",
108
+ "aria-pressed": v === i.Dislike,
109
+ tooltipProps: { tooltip: R?.dislike ?? "Dislike" },
110
+ onClick: _
645
111
  })
646
112
  ] })]
647
113
  });
648
- }, $ = {
649
- userBubble: "_userBubble_qoxdz_1",
650
- collapsibleText: "_collapsibleText_qoxdz_6",
651
- expandedText: "_expandedText_qoxdz_11",
652
- collapsedText: "_collapsedText_qoxdz_15",
653
- startersDivider: "_startersDivider_qoxdz_26",
654
- text: "_text_qoxdz_30"
655
- }, lt = ({ text: e, styles: n, actions: a, hasAlwaysVisibleActions: o, isStreaming: c, attachments: l, afterContent: f, starters: p, onSelectStarter: m, deploymentIconUrl: h, deploymentDisplayName: g, markdownComponents: _, markdownClassNames: v, onAttachmentClick: y, onDownloadAll: x, onAttachmentRetry: S, codeBlockTheme: C, labels: w, selectedAttachmentId: T }) => {
656
- let { colors: E, typography: D, className: O, bubbleClassName: k } = n ?? {}, { attachmentClickLabel: A, attachmentRetryLabel: j, attachmentOpenInNewTabLabel: M, startersAriaLabel: N = "Quick reply buttons", thinkingLabel: P, codeBlockCopyLabel: F, codeBlockCopiedLabel: I, assistantMessageAriaLabel: L = "Assistant message", deploymentIconFallbackLabel: R = "AI" } = w ?? {}, z = c ? (l ?? []).filter((e) => e.type !== t.Audio) : l ?? [], B = u({
657
- "--cm-bubble-text": E?.text,
658
- "--cm-starters-divider": E?.startersDivider
659
- }), V = d($.text, D?.fontClassName), H = !!(h || g);
660
- return /* @__PURE__ */ X("div", {
114
+ }, I = {
115
+ userBubble: "_userBubble_cq829_1",
116
+ collapsibleText: "_collapsibleText_cq829_6",
117
+ expandedText: "_expandedText_cq829_11",
118
+ collapsedText: "_collapsedText_cq829_15",
119
+ startersDivider: "_startersDivider_cq829_26",
120
+ text: "_text_cq829_30"
121
+ }, L = ({ text: t, styles: i, actions: c, hasAlwaysVisibleActions: u, isStreaming: d, attachments: f, afterContent: p, starters: m, onSelectStarter: g, deploymentIconUrl: _, deploymentDisplayName: v, markdownComponents: y, markdownClassNames: b, onAttachmentClick: x, onDownloadAll: S, onAttachmentRetry: C, codeBlockTheme: w, labels: T, selectedAttachmentId: E }) => {
122
+ let { colors: D, typography: O, className: k, bubbleClassName: A } = i ?? {}, { attachmentClickLabel: N, attachmentRetryLabel: P, attachmentOpenInNewTabLabel: L, startersAriaLabel: R = "Quick reply buttons", thinkingLabel: z, codeBlockCopyLabel: B, codeBlockCopiedLabel: V, assistantMessageAriaLabel: H = "Assistant message", deploymentIconFallbackLabel: U = "AI" } = T ?? {}, W = d ? (f ?? []).filter((t) => t.type !== e.Audio) : f ?? [], G = o({
123
+ "--cm-bubble-text": D?.text,
124
+ "--cm-starters-divider": D?.startersDivider
125
+ }), K = s(I.text, O?.fontClassName), q = !!(_ || v);
126
+ return /* @__PURE__ */ M("div", {
661
127
  role: "group",
662
- "aria-label": L,
663
- style: B,
664
- className: d("flex w-full items-start gap-3", O),
665
- children: [H && /* @__PURE__ */ Y(r, {
666
- src: h,
128
+ "aria-label": H,
129
+ style: G,
130
+ className: s("flex w-full items-start gap-3", k),
131
+ children: [q && /* @__PURE__ */ j(n, {
132
+ src: _,
667
133
  size: 28,
668
- initialsName: g || R,
669
- labels: { tooltip: g ?? R }
670
- }), /* @__PURE__ */ X("div", {
134
+ initialsName: v || U,
135
+ labels: { tooltip: v ?? U }
136
+ }), /* @__PURE__ */ M("div", {
671
137
  className: "flex w-full min-w-0 max-w-full flex-col items-start gap-5",
672
- children: [/* @__PURE__ */ X("div", {
673
- className: d("flex w-full min-w-0 max-w-full flex-col items-start gap-4", k),
138
+ children: [/* @__PURE__ */ M("div", {
139
+ className: s("flex w-full min-w-0 max-w-full flex-col items-start gap-4", A),
674
140
  children: [
675
- (e || c) && /* @__PURE__ */ Y("div", {
141
+ (t || d) && /* @__PURE__ */ j("div", {
676
142
  "aria-live": "polite",
677
143
  "aria-atomic": "false",
678
- className: d(V, "min-w-0 max-w-full text-start"),
679
- children: /* @__PURE__ */ Y(i, {
680
- content: e,
681
- isStreaming: c,
682
- thinkingLabel: P,
683
- components: _,
684
- classNames: v,
685
- codeBlockCopyLabel: F,
686
- codeBlockCopiedLabel: I,
687
- codeBlockTheme: C
144
+ className: s(K, "min-w-0 max-w-full text-start"),
145
+ children: /* @__PURE__ */ j(r, {
146
+ content: t,
147
+ isStreaming: d,
148
+ thinkingLabel: z,
149
+ components: y,
150
+ classNames: b,
151
+ codeBlockCopyLabel: B,
152
+ codeBlockCopiedLabel: V,
153
+ codeBlockTheme: w
688
154
  })
689
155
  }),
690
- /* @__PURE__ */ Y(tt, {
691
- attachments: z,
692
- onAttachmentClick: (e) => y?.(l?.find((t) => t.id === e)),
693
- onDownloadAll: x,
694
- onRetry: S,
156
+ /* @__PURE__ */ j(l, {
157
+ attachments: W,
158
+ onAttachmentClick: (e) => x?.(f?.find((t) => t.id === e)),
159
+ onDownloadAll: S,
160
+ onRetry: C,
695
161
  labels: {
696
- clickLabel: A,
697
- retryLabel: j,
698
- openInNewTabLabel: M
162
+ clickLabel: N,
163
+ retryLabel: P,
164
+ openInNewTabLabel: L
699
165
  },
700
- selectedAttachmentId: T
166
+ selectedAttachmentId: E
701
167
  }),
702
- f,
703
- /* @__PURE__ */ Y(ct, {
704
- ...a,
705
- isAlwaysVisible: o,
706
- role: s.Assistant
168
+ p,
169
+ /* @__PURE__ */ j(F, {
170
+ ...c,
171
+ isAlwaysVisible: u,
172
+ role: a.Assistant
707
173
  })
708
174
  ]
709
- }), p && p.length > 0 && m && /* @__PURE__ */ Y("div", {
175
+ }), m && m.length > 0 && g && /* @__PURE__ */ j("div", {
710
176
  role: "list",
711
- "aria-label": N,
712
- className: d("flex w-full flex-wrap gap-2 border-t pt-5", $.startersDivider),
713
- children: p.map((e, t) => /* @__PURE__ */ Y("div", {
177
+ "aria-label": R,
178
+ className: s("flex w-full flex-wrap gap-2 border-t pt-5", I.startersDivider),
179
+ children: m.map((e, t) => /* @__PURE__ */ j("div", {
714
180
  role: "listitem",
715
181
  className: "min-w-[40px]",
716
- children: /* @__PURE__ */ Y(b, {
182
+ children: /* @__PURE__ */ j(h, {
717
183
  label: e.title,
718
184
  className: "min-w-[40px]",
719
- onClick: () => m(e)
185
+ onClick: () => g(e)
720
186
  })
721
187
  }, t))
722
188
  })]
723
189
  })]
724
190
  });
725
- }, ut = ({ labels: { titleText: e = "Model switched.", bodyText: t } }) => /* @__PURE__ */ Y("div", {
191
+ }, R = ({ labels: { titleText: e = "Model switched.", bodyText: t } }) => /* @__PURE__ */ j("div", {
726
192
  role: "status",
727
193
  "aria-live": "polite",
728
- children: /* @__PURE__ */ Y(v, {
194
+ children: /* @__PURE__ */ j(p, {
729
195
  title: e,
730
196
  message: t,
731
197
  textClassName: "flex-row flex-wrap gap-1"
732
198
  })
733
- }), dt = /* @__PURE__ */ function(e) {
199
+ }), z = /* @__PURE__ */ function(e) {
734
200
  return e.Bottom = "Bottom", e.Top = "Top", e;
735
- }({}), ft = 10, pt = ({ text: e, position: t = dt.Bottom, styles: n, actions: r, hasAlwaysVisibleActions: i, attachments: a, collapsedLineCount: o = ft, labels: c, onAttachmentClick: l, onDownloadAll: m, onAttachmentRetry: g, selectedAttachmentId: _ }) => {
736
- let { colors: v, typography: b, className: x, bubbleClassName: S } = n ?? {}, { showMoreLabel: C = "Show more", showLessLabel: w = "Show less", showMoreAriaLabel: T, showLessAriaLabel: E, attachmentClickLabel: D, attachmentRetryLabel: O, attachmentOpenInNewTabLabel: k, userMessageAriaLabel: A = "User message" } = c ?? {}, { textRef: j, isTextCollapsed: M, isOverflowing: F, collapsedMaxHeight: I, expandedMaxHeight: L, isCollapsed: R, toggleCollapsed: z } = f({
201
+ }({}), B = 10, V = ({ text: e, position: t = z.Bottom, styles: n, actions: r, hasAlwaysVisibleActions: i, attachments: d, collapsedLineCount: p = B, labels: h, onAttachmentClick: g, onDownloadAll: y, onAttachmentRetry: b, selectedAttachmentId: x }) => {
202
+ let { colors: S, typography: C, className: w, bubbleClassName: T } = n ?? {}, { showMoreLabel: E = "Show more", showLessLabel: D = "Show less", showMoreAriaLabel: k, showLessAriaLabel: N, attachmentClickLabel: P, attachmentRetryLabel: L, attachmentOpenInNewTabLabel: R, userMessageAriaLabel: V = "User message" } = h ?? {}, { textRef: H, isTextCollapsed: U, isOverflowing: W, collapsedMaxHeight: G, expandedMaxHeight: K, isCollapsed: q, toggleCollapsed: J } = c({
737
203
  text: e,
738
- collapsedLineCount: o
739
- }), B = u({
740
- "--cm-bubble-user-bg": v?.userBackground,
741
- "--cm-bubble-user-border": v?.userBorder,
742
- "--cm-bubble-fade-start": v?.fadeStart,
743
- "--cm-bubble-text": v?.text,
744
- "--cm-bubble-collapsed-height": F ? `${I}px` : void 0,
745
- "--cm-bubble-expanded-height": F ? `${L}px` : void 0
746
- }), V = t === dt.Top ? "rounded-ee-md rounded-se-2xl" : "rounded-se-md rounded-ee-2xl", H = d($.text, b?.fontClassName), ee = T ?? C, te = E ?? w, ne = R ? C : w, U = R ? ee : te, W = R ? N : P, re = Ne();
747
- return /* @__PURE__ */ Y("div", {
204
+ collapsedLineCount: p
205
+ }), Y = o({
206
+ "--cm-bubble-user-bg": S?.userBackground,
207
+ "--cm-bubble-user-border": S?.userBorder,
208
+ "--cm-bubble-fade-start": S?.fadeStart,
209
+ "--cm-bubble-text": S?.text,
210
+ "--cm-bubble-collapsed-height": W ? `${G}px` : void 0,
211
+ "--cm-bubble-expanded-height": W ? `${K}px` : void 0
212
+ }), X = t === z.Top ? "rounded-ee-md rounded-se-2xl" : "rounded-se-md rounded-ee-2xl", Z = s(I.text, C?.fontClassName), Q = k ?? E, ee = N ?? D, te = q ? E : D, ne = q ? Q : ee, re = q ? _ : v, $ = O();
213
+ return /* @__PURE__ */ j("div", {
748
214
  role: "group",
749
- "aria-label": A,
750
- style: B,
751
- className: d("flex w-full", x),
752
- children: /* @__PURE__ */ X("div", {
215
+ "aria-label": V,
216
+ style: Y,
217
+ className: s("flex w-full", w),
218
+ children: /* @__PURE__ */ M("div", {
753
219
  className: "ms-auto flex w-fit min-w-0 max-w-full flex-col items-end gap-4",
754
220
  children: [
755
- /* @__PURE__ */ Y(tt, {
756
- attachments: a ?? [],
757
- onAttachmentClick: (e) => l?.(a?.find((t) => t.id === e)),
758
- onDownloadAll: m,
759
- onRetry: g,
221
+ /* @__PURE__ */ j(l, {
222
+ attachments: d ?? [],
223
+ onAttachmentClick: (e) => g?.(d?.find((t) => t.id === e)),
224
+ onDownloadAll: y,
225
+ onRetry: b,
760
226
  labels: {
761
- clickLabel: D,
762
- retryLabel: O,
763
- openInNewTabLabel: k
227
+ clickLabel: P,
228
+ retryLabel: L,
229
+ openInNewTabLabel: R
764
230
  },
765
231
  styles: { className: "max-w-[640px]" },
766
- selectedAttachmentId: _
232
+ selectedAttachmentId: x
767
233
  }),
768
- e && /* @__PURE__ */ Y("div", {
769
- className: d($.userBubble, "flex w-fit items-center justify-end rounded-es-2xl rounded-ss-2xl border px-6 py-4", V, S),
770
- children: /* @__PURE__ */ X("div", {
234
+ e && /* @__PURE__ */ j("div", {
235
+ className: s(I.userBubble, "flex w-fit items-center justify-end rounded-es-2xl rounded-ss-2xl border px-6 py-4", X, T),
236
+ children: /* @__PURE__ */ M("div", {
771
237
  className: "flex min-w-0 flex-col items-start",
772
- children: [/* @__PURE__ */ Y("div", {
773
- id: re,
774
- className: d("relative overflow-hidden", F && $.collapsibleText, F && !R && $.expandedText, M && $.collapsedText),
775
- children: /* @__PURE__ */ Y("p", {
776
- ref: j,
777
- className: d(H, "whitespace-pre-wrap text-start [overflow-wrap:anywhere]"),
238
+ children: [/* @__PURE__ */ j("div", {
239
+ id: $,
240
+ className: s("relative overflow-hidden", W && I.collapsibleText, W && !q && I.expandedText, U && I.collapsedText),
241
+ children: /* @__PURE__ */ j("p", {
242
+ ref: H,
243
+ className: s(Z, "whitespace-pre-wrap text-start [overflow-wrap:anywhere]"),
778
244
  children: e
779
245
  })
780
- }), F && /* @__PURE__ */ Y(y, {
781
- label: /* @__PURE__ */ Y(J, { children: ne }),
782
- iconBefore: /* @__PURE__ */ Y(W, {
783
- size: p.SM,
246
+ }), W && /* @__PURE__ */ j(m, {
247
+ label: /* @__PURE__ */ j(A, { children: te }),
248
+ iconBefore: /* @__PURE__ */ j(re, {
249
+ size: u.SM,
784
250
  "aria-hidden": "true"
785
251
  }),
786
- "aria-label": U,
787
- "aria-expanded": !R,
788
- "aria-controls": re,
252
+ "aria-label": ne,
253
+ "aria-expanded": !q,
254
+ "aria-controls": $,
789
255
  className: "mt-3",
790
- onClick: z,
791
- size: h.Small
256
+ onClick: J,
257
+ size: f.Small
792
258
  })]
793
259
  })
794
260
  }),
795
- /* @__PURE__ */ Y(ct, {
261
+ /* @__PURE__ */ j(F, {
796
262
  ...r,
797
263
  isAlwaysVisible: i,
798
- role: s.User
264
+ role: a.User
799
265
  })
800
266
  ]
801
267
  })
802
268
  });
803
- }, mt = ({ role: e, onAttachmentClick: t, markdownComponents: n, ...r }) => e === s.Status ? /* @__PURE__ */ Y(ut, { labels: {
269
+ }, H = ({ role: e, onAttachmentClick: t, markdownComponents: n, ...r }) => e === a.Status ? /* @__PURE__ */ j(R, { labels: {
804
270
  titleText: r.labels?.statusTitleText,
805
271
  bodyText: r.labels?.statusBodyText ?? ""
806
- } }) : e === s.User ? /* @__PURE__ */ Y(pt, {
272
+ } }) : e === a.User ? /* @__PURE__ */ j(V, {
807
273
  ...r,
808
274
  onAttachmentClick: t
809
- }) : /* @__PURE__ */ Y(lt, {
275
+ }) : /* @__PURE__ */ j(L, {
810
276
  ...r,
811
277
  markdownComponents: n,
812
278
  onAttachmentClick: t
813
279
  });
814
280
  //#endregion
815
- export { lt as AssistantMessageBubble, dt as BubblePosition, ct as MessageActions, mt as MessageBubble, ut as StatusMessageBubble, pt as UserMessageBubble };
281
+ export { L as AssistantMessageBubble, z as BubblePosition, F as MessageActions, H as MessageBubble, R as StatusMessageBubble, V 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.0.0",
4
+ "version": "1.0.2",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "main": "./index.js",
@@ -19,10 +19,10 @@
19
19
  "peerDependencies": {
20
20
  "react": "^19.0.0",
21
21
  "@tabler/icons-react": "^3.0.0",
22
- "@epam/ai-dial-chat-shared": "1.0.0",
23
- "@epam/ai-dial-conversation-input": "1.0.0",
24
22
  "react-markdown": "^10.1.0",
25
- "@epam/ai-dial-ui-kit": "^0.14.0-dev.6"
23
+ "@epam/ai-dial-attachment-input": "1.0.2",
24
+ "@epam/ai-dial-chat-shared": "1.0.2",
25
+ "@epam/ai-dial-ui-kit": "^0.14.0-dev.15"
26
26
  },
27
27
  "repository": {
28
28
  "type": "git",