@epam/ai-dial-conversation-messages 1.1.0-dev.12 → 1.1.0-dev.18

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 (2) hide show
  1. package/index.js +47 -27
  2. package/package.json +3 -3
package/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { AttachmentErrorReason as e, AttachmentType as t, DeploymentIcon as n, Highlight 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
2
  import { DIAL_ICON_SIZE as p, DialGhostIconButton as m, DialInput as h, DialLinkButton as g, DialNotification as _, DialPopup as v, DialPrimaryButton as y, DialRadioGroup as b, DialRoundedButton as x, DialSkeleton as S, DialSkeletonVariant as C, DialSlider as w, DialTag as T, DialTooltip as E, ElementSize as D, PopupSize as O, RadioGroupOrientation as k } from "@epam/ai-dial-ui-kit";
3
- import { IconCheck as A, IconChevronDown as j, IconChevronUp as M, IconClipboard as N, IconCopy as P, IconDownload as F, IconExternalLink as I, IconFile as L, IconFileTypeBmp as R, IconFileTypeCss as z, IconFileTypeCsv as B, IconFileTypeDoc as ee, IconFileTypeDocx as V, IconFileTypeHtml as te, IconFileTypeJpg as ne, IconFileTypeJs as re, IconFileTypeJsx as ie, IconFileTypePdf as ae, IconFileTypePhp as oe, IconFileTypePng as se, IconFileTypePpt as ce, IconFileTypeRs as le, IconFileTypeSql as ue, IconFileTypeSvg as de, IconFileTypeTs as fe, IconFileTypeTsx as pe, IconFileTypeTxt as me, IconFileTypeVue as he, IconFileTypeXls as ge, IconFileTypeXml as _e, IconFileTypeZip as ve, IconMarkdown as ye, IconMusic as be, IconPaperclip as xe, IconPencilMinus as Se, IconPhoto as H, IconRefresh as Ce, IconReload as we, IconTerminal2 as Te, IconThumbDown as Ee, IconThumbUp as De, IconTrashX as Oe, IconVideo as ke, IconX as Ae } from "@tabler/icons-react";
3
+ import { IconCheck as A, IconChevronDown as j, IconChevronUp as M, IconClipboard as N, IconCopy as P, IconDownload as F, IconExternalLink as I, IconFile as L, IconFileTypeBmp as R, IconFileTypeCss as z, IconFileTypeCsv as B, IconFileTypeDoc as V, IconFileTypeDocx as ee, IconFileTypeHtml as te, IconFileTypeJpg as ne, IconFileTypeJs as re, IconFileTypeJsx as ie, IconFileTypePdf as ae, IconFileTypePhp as oe, IconFileTypePng as se, IconFileTypePpt as ce, IconFileTypeRs as le, IconFileTypeSql as ue, IconFileTypeSvg as de, IconFileTypeTs as fe, IconFileTypeTsx as pe, IconFileTypeTxt as me, IconFileTypeVue as he, IconFileTypeXls as ge, IconFileTypeXml as _e, IconFileTypeZip as ve, IconMarkdown as ye, IconMusic as be, IconPaperclip as xe, IconPencilMinus as Se, IconPhoto as H, IconRefresh as Ce, IconReload as we, IconTerminal2 as Te, IconThumbDown as Ee, IconThumbUp as De, IconTrashX as Oe, IconVideo as ke, IconX as Ae } from "@tabler/icons-react";
4
4
  import "react-dom";
5
5
  import { memo as je, useCallback as U, useEffect as Me, useId as Ne, useMemo as W, useRef as Pe, useState as G } from "react";
6
6
  import { Fragment as K, jsx as q, jsxs as J } from "react/jsx-runtime";
@@ -25,8 +25,8 @@ var Fe = "flex size-[84px] items-center justify-center rounded-xl border", Y = /
25
25
  switch (e) {
26
26
  case "application/pdf": return ae;
27
27
  case "application/msword":
28
- case "application/vnd.ms-word": return ee;
29
- case "application/vnd.openxmlformats-officedocument.wordprocessingml.document": return V;
28
+ case "application/vnd.ms-word": return V;
29
+ case "application/vnd.openxmlformats-officedocument.wordprocessingml.document": return ee;
30
30
  case "application/vnd.ms-powerpoint": return ce;
31
31
  case "application/vnd.openxmlformats-officedocument.presentationml.presentation": return ce;
32
32
  case "application/vnd.ms-excel": return ge;
@@ -147,33 +147,51 @@ var Fe = "flex size-[84px] items-center justify-center rounded-xl border", Y = /
147
147
  }),
148
148
  className: X.hoverIcon,
149
149
  ...e
150
- }), qe = ({ attachment: e, searchQuery: t = "", onClick: n, labels: i, styles: a, cssVars: o }) => {
151
- let { clickLabel: s = "Open attachment" } = i ?? {}, { typography: c, className: l } = a ?? {};
150
+ }), qe = ({ attachment: e, searchQuery: t = "", onClick: n, onDownload: i, onRemove: a, labels: o, styles: s, cssVars: c }) => {
151
+ let { clickLabel: l = "Open attachment", downloadLabel: u = "Download attachment", removeLabel: f = "Remove attachment" } = o ?? {}, { typography: p, className: m } = s ?? {}, h = () => {
152
+ n?.(e.id);
153
+ };
152
154
  return /* @__PURE__ */ J("div", {
153
- style: o,
154
- className: d("group flex w-full min-w-[280px] max-w-[300px] flex-col gap-2 rounded-xl border p-3", l),
155
- children: [/* @__PURE__ */ J("div", {
156
- className: "flex items-center justify-between gap-2",
157
- children: [/* @__PURE__ */ q("span", {
155
+ style: c,
156
+ ...n == null ? {} : {
157
+ role: "button",
158
+ tabIndex: 0,
159
+ "aria-label": l,
160
+ onClick: h,
161
+ onKeyDown: (e) => {
162
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), h());
163
+ }
164
+ },
165
+ className: d("group relative flex w-full min-w-[280px] max-w-[300px] flex-col gap-2 rounded-xl border p-3", n && "cursor-pointer", (i || a) && "pe-8", m),
166
+ children: [
167
+ /* @__PURE__ */ q("span", {
158
168
  title: e.name,
159
- className: d(c?.fontClassName ?? "dial-tiny-text", "min-w-0 truncate", X.nameText),
169
+ className: d(p?.fontClassName ?? "dial-tiny-text", "min-w-0 truncate", X.nameText),
160
170
  children: t ? /* @__PURE__ */ q(r, {
161
171
  text: e.name,
162
172
  query: t,
163
173
  maxLines: 1
164
174
  }) : e.name
165
- }), n && /* @__PURE__ */ q(We, {
166
- ariaLabel: s,
167
- onClick: n,
175
+ }),
176
+ e.playUrl && /* @__PURE__ */ q("audio", {
177
+ controls: !0,
178
+ src: e.playUrl,
179
+ "aria-label": e.name,
180
+ className: "w-full",
181
+ preload: "metadata",
182
+ onClick: (e) => e.stopPropagation()
183
+ }),
184
+ i && /* @__PURE__ */ q(We, {
185
+ ariaLabel: u,
186
+ onClick: i,
168
187
  id: e.id
169
- })]
170
- }), e.playUrl && /* @__PURE__ */ q("audio", {
171
- controls: !0,
172
- src: e.playUrl,
173
- "aria-label": e.name,
174
- className: "w-full",
175
- preload: "metadata"
176
- })]
188
+ }),
189
+ a && /* @__PURE__ */ q(Ke, {
190
+ ariaLabel: f,
191
+ onClick: a,
192
+ id: e.id
193
+ })
194
+ ]
177
195
  });
178
196
  }, Je = {
179
197
  [e.Network]: "Upload failed · network error",
@@ -183,11 +201,11 @@ var Fe = "flex size-[84px] items-center justify-center rounded-xl border", Y = /
183
201
  (e.key === "Enter" || e.key === " ") && (e.preventDefault(), n?.(t.id));
184
202
  }, R = W(() => s ? T : Ie(T), [s, T]), z = U(() => {
185
203
  window.open(t.referenceUrl, "_blank", "noopener,noreferrer");
186
- }, [t]), B = d(Fe, "group relative flex-col justify-between items-start gap-1 overflow-hidden p-1.5", X.tile, !k && X.tileLight, k && X.tileError), ee = /* @__PURE__ */ q("div", {
204
+ }, [t]), B = d(Fe, "group relative flex-col justify-between items-start gap-1 overflow-hidden p-1.5", X.tile, !k && X.tileLight, k && X.tileError), V = /* @__PURE__ */ q("div", {
187
205
  title: R,
188
206
  className: d(x, "line-clamp-2 min-w-0 break-all", X.nameText, !k && I),
189
207
  children: R
190
- }), V = M && /* @__PURE__ */ J("div", {
208
+ }), ee = M && /* @__PURE__ */ J("div", {
191
209
  className: d("flex w-full items-center gap-1", k && I),
192
210
  children: [/* @__PURE__ */ q(M, {
193
211
  size: 16,
@@ -200,7 +218,7 @@ var Fe = "flex size-[84px] items-center justify-center rounded-xl border", Y = /
200
218
  }), te = () => {
201
219
  p && f ? f(w) : n && n(w);
202
220
  }, ne = /* @__PURE__ */ J(K, { children: [
203
- k ? /* @__PURE__ */ J(K, { children: [V, ee] }) : /* @__PURE__ */ J(K, { children: [ee, V] }),
221
+ k ? /* @__PURE__ */ J(K, { children: [ee, V] }) : /* @__PURE__ */ J(K, { children: [V, ee] }),
204
222
  O && /* @__PURE__ */ q("div", {
205
223
  role: "progressbar",
206
224
  "aria-label": v,
@@ -344,6 +362,8 @@ var Fe = "flex size-[84px] items-center justify-center rounded-xl border", Y = /
344
362
  attachment: e,
345
363
  labels: c,
346
364
  onClick: o,
365
+ onDownload: s,
366
+ onRemove: r,
347
367
  searchQuery: n,
348
368
  styles: l,
349
369
  cssVars: m
@@ -820,7 +840,7 @@ var lt = 2e3, ut = ({ role: e = s.User, onEdit: t, onEditHover: n, onDelete: r,
820
840
  "--cm-bubble-text": _?.text,
821
841
  "--cm-bubble-collapsed-height": P ? `${F}px` : void 0,
822
842
  "--cm-bubble-expanded-height": P ? `${I}px` : void 0
823
- }), B = t === pt.Top ? "rounded-ee-[6px] rounded-se-[16px]" : "rounded-se-[6px] rounded-ee-[16px]", ee = d($.text, v?.fontClassName), V = C ?? x, te = w ?? S, ne = L ? x : S, re = L ? V : te, ie = L ? j : M, ae = Ne();
843
+ }), B = t === pt.Top ? "rounded-ee-[6px] rounded-se-[16px]" : "rounded-se-[6px] rounded-ee-[16px]", V = d($.text, v?.fontClassName), ee = C ?? x, te = w ?? S, ne = L ? x : S, re = L ? ee : te, ie = L ? j : M, ae = Ne();
824
844
  return /* @__PURE__ */ q("div", {
825
845
  role: "group",
826
846
  "aria-label": k,
@@ -850,7 +870,7 @@ var lt = 2e3, ut = ({ role: e = s.User, onEdit: t, onEditHover: n, onDelete: r,
850
870
  className: d("relative overflow-hidden", P && $.collapsibleText, P && !L && $.expandedText, N && $.collapsedText),
851
871
  children: /* @__PURE__ */ q("p", {
852
872
  ref: A,
853
- className: d(ee, "whitespace-pre-wrap text-start [overflow-wrap:anywhere]"),
873
+ className: d(V, "whitespace-pre-wrap text-start [overflow-wrap:anywhere]"),
854
874
  children: e
855
875
  })
856
876
  }), P && /* @__PURE__ */ q(g, {
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.1.0-dev.12",
4
+ "version": "1.1.0-dev.18",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "main": "./index.js",
@@ -20,8 +20,8 @@
20
20
  "react": "^19.0.0",
21
21
  "@tabler/icons-react": "^3.0.0",
22
22
  "@epam/ai-dial-ui-kit": "0.12.0-dev.36",
23
- "@epam/ai-dial-chat-shared": "1.1.0-dev.12",
24
- "@epam/ai-dial-conversation-input": "1.1.0-dev.12",
23
+ "@epam/ai-dial-chat-shared": "1.1.0-dev.18",
24
+ "@epam/ai-dial-conversation-input": "1.1.0-dev.18",
25
25
  "react-markdown": "^10.1.0"
26
26
  },
27
27
  "repository": {