@epam/ai-dial-conversation-stages 1.3.0-dev.59 → 1.3.0-dev.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +109 -98
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AttachmentErrorReason as e, AttachmentType as t, MIME_TYPE_EXT_MAP as n, MarkdownCodeBlock as r, MarkdownRenderer as i, RequestStatus as a, StageStatus as o, buildCssVars as s, mergeClasses as c, messageAttachmentsToDisplayAttachments as l, normalizeMimeType as u } from "@epam/ai-dial-chat-shared";
|
|
2
2
|
import { Accordion as d, DIAL_ICON_SIZE as f, DIAL_KIT_ICON_STROKE as p, DialItemType as m, ElementSize as h, EllipsisTooltip as g, FileIcon as _, Highlight as v, Skeleton as y, SkeletonVariant as b, Spinner as x, StaticIconButton as S } from "@epam/ai-dial-ui-kit";
|
|
3
|
-
import { IconAlertCircle as C, IconCheck as w, IconClipboard as T, IconDownload as E, IconExternalLink as D, IconFile as O, IconFileTypeBmp as k, IconFileTypeCss as A, IconFileTypeCsv as j, IconFileTypeDoc as M, IconFileTypeDocx as N, IconFileTypeHtml as P, IconFileTypeJpg as F, IconFileTypeJs as I, IconFileTypeJsx as L, IconFileTypePdf as R, IconFileTypePhp as z, IconFileTypePng as B, IconFileTypePpt as V, IconFileTypeRs as ee, IconFileTypeSql as te, IconFileTypeSvg as ne, IconFileTypeTs as re, IconFileTypeTsx as ie, IconFileTypeTxt as ae, IconFileTypeVue as
|
|
3
|
+
import { IconAlertCircle as C, IconCheck as w, IconClipboard as T, IconDownload as E, IconExternalLink as D, IconFile as O, IconFileTypeBmp as k, IconFileTypeCss as A, IconFileTypeCsv as j, IconFileTypeDoc as M, IconFileTypeDocx as N, IconFileTypeHtml as P, IconFileTypeJpg as F, IconFileTypeJs as I, IconFileTypeJsx as L, IconFileTypePdf as R, IconFileTypePhp as z, IconFileTypePng as B, IconFileTypePpt as V, IconFileTypeRs as ee, IconFileTypeSql as te, IconFileTypeSvg as ne, IconFileTypeTs as re, IconFileTypeTsx as ie, IconFileTypeTxt as ae, IconFileTypeVue as H, IconFileTypeXls as oe, IconFileTypeXml as se, IconFileTypeZip as ce, IconMusic as le, IconPhoto as U, IconReload as ue, IconTerminal2 as de, IconVideo as fe, IconX as pe } from "@tabler/icons-react";
|
|
4
4
|
import { memo as me, useCallback as W, useEffect as G, useId as he, useMemo as K, useRef as ge, useState as q } from "react";
|
|
5
5
|
import { Fragment as _e, jsx as J, jsxs as Y } from "react/jsx-runtime";
|
|
6
6
|
//#region src/constants/public-class-names.ts
|
|
@@ -136,8 +136,8 @@ var ve = {
|
|
|
136
136
|
case "application/vnd.openxmlformats-officedocument.wordprocessingml.document": return N;
|
|
137
137
|
case "application/vnd.ms-powerpoint": return V;
|
|
138
138
|
case "application/vnd.openxmlformats-officedocument.presentationml.presentation": return V;
|
|
139
|
-
case "application/vnd.ms-excel": return
|
|
140
|
-
case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": return
|
|
139
|
+
case "application/vnd.ms-excel": return oe;
|
|
140
|
+
case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": return oe;
|
|
141
141
|
case "application/zip":
|
|
142
142
|
case "application/vnd.rar":
|
|
143
143
|
case "application/x-7z-compressed":
|
|
@@ -156,7 +156,7 @@ var ve = {
|
|
|
156
156
|
case "text/css": return A;
|
|
157
157
|
case "text/x-php": return z;
|
|
158
158
|
case "text/x-rustsrc": return ee;
|
|
159
|
-
case "text/x-vue": return
|
|
159
|
+
case "text/x-vue": return H;
|
|
160
160
|
default: return O;
|
|
161
161
|
}
|
|
162
162
|
}, Le = (e) => {
|
|
@@ -193,7 +193,7 @@ var ve = {
|
|
|
193
193
|
BottomIcon: d ? null : Le(e),
|
|
194
194
|
typeLabel: d ? null : Ve(e, n)
|
|
195
195
|
};
|
|
196
|
-
}, Ue = "flex size-[100px] items-center justify-center rounded-xl border", Z = {
|
|
196
|
+
}, Ue = "flex size-[100px] items-center justify-center rounded-xl border", We = "outline-1 outline-offset-1 focus-visible:outline", Z = {
|
|
197
197
|
tray: "dial-ai-attachment-tray",
|
|
198
198
|
trayItem: "dial-ai-attachment-tray-item",
|
|
199
199
|
tile: "dial-ai-attachment-tile",
|
|
@@ -202,27 +202,29 @@ var ve = {
|
|
|
202
202
|
tileType: "dial-ai-attachment-tile-type",
|
|
203
203
|
tileAction: "dial-ai-attachment-tile-action"
|
|
204
204
|
}, Q = {
|
|
205
|
-
tile: "
|
|
206
|
-
hovered: "
|
|
207
|
-
selected: "
|
|
208
|
-
tileError: "
|
|
209
|
-
nameText: "
|
|
210
|
-
typeText: "
|
|
211
|
-
placeholderIcon: "
|
|
212
|
-
retryIcon: "
|
|
213
|
-
track: "
|
|
214
|
-
actionButton: "
|
|
215
|
-
|
|
216
|
-
|
|
205
|
+
tile: "_tile_1sjdm_12",
|
|
206
|
+
hovered: "_hovered_1sjdm_18",
|
|
207
|
+
selected: "_selected_1sjdm_28",
|
|
208
|
+
tileError: "_tileError_1sjdm_33",
|
|
209
|
+
nameText: "_nameText_1sjdm_38",
|
|
210
|
+
typeText: "_typeText_1sjdm_42",
|
|
211
|
+
placeholderIcon: "_placeholderIcon_1sjdm_46",
|
|
212
|
+
retryIcon: "_retryIcon_1sjdm_50",
|
|
213
|
+
track: "_track_1sjdm_54",
|
|
214
|
+
actionButton: "_actionButton_1sjdm_65",
|
|
215
|
+
loading: "_loading_1sjdm_86",
|
|
216
|
+
imageActionButton: "_imageActionButton_1sjdm_87",
|
|
217
|
+
proxyFocus: "_proxyFocus_1sjdm_96"
|
|
218
|
+
}, Ge = ({ ariaLabel: e, errorTitle: t, errorDescId: n, onClick: r, id: i, icon: a, className: o, isAlwaysVisible: s }) => /* @__PURE__ */ J(S, {
|
|
217
219
|
icon: a,
|
|
218
220
|
size: h.Small,
|
|
219
|
-
className: c("opacity-0
|
|
221
|
+
className: c(s ? "opacity-100" : "opacity-0 group-hover/attachment-tile:opacity-100 group-focus-visible/attachment-tile:opacity-100 group-has-[:focus-visible]/attachment-tile:opacity-100", Q.actionButton, o, Z.tileAction),
|
|
220
222
|
"aria-label": e,
|
|
221
223
|
"aria-describedby": t ? n : void 0,
|
|
222
224
|
onClick: (e) => {
|
|
223
225
|
e.stopPropagation(), r(i);
|
|
224
226
|
}
|
|
225
|
-
}),
|
|
227
|
+
}), Ke = ({ ...e }) => /* @__PURE__ */ J(Ge, {
|
|
226
228
|
icon: /* @__PURE__ */ J(ue, {
|
|
227
229
|
size: f.SM,
|
|
228
230
|
"aria-hidden": !0,
|
|
@@ -230,21 +232,21 @@ var ve = {
|
|
|
230
232
|
}),
|
|
231
233
|
className: Q.retryIcon,
|
|
232
234
|
...e
|
|
233
|
-
}),
|
|
235
|
+
}), qe = ({ ...e }) => /* @__PURE__ */ J(Ge, {
|
|
234
236
|
icon: /* @__PURE__ */ J(E, {
|
|
235
237
|
size: f.SM,
|
|
236
238
|
"aria-hidden": !0,
|
|
237
239
|
stroke: p
|
|
238
240
|
}),
|
|
239
241
|
...e
|
|
240
|
-
}),
|
|
242
|
+
}), Je = ({ ...e }) => /* @__PURE__ */ J(Ge, {
|
|
241
243
|
icon: /* @__PURE__ */ J(D, {
|
|
242
244
|
size: f.SM,
|
|
243
245
|
"aria-hidden": !0,
|
|
244
246
|
stroke: p
|
|
245
247
|
}),
|
|
246
248
|
...e
|
|
247
|
-
}),
|
|
249
|
+
}), Ye = ({ className: e, ...t }) => /* @__PURE__ */ J(Ge, {
|
|
248
250
|
icon: /* @__PURE__ */ J(pe, {
|
|
249
251
|
size: f.SM,
|
|
250
252
|
"aria-hidden": !0,
|
|
@@ -252,35 +254,35 @@ var ve = {
|
|
|
252
254
|
}),
|
|
253
255
|
className: c("mobile:opacity-100", e),
|
|
254
256
|
...t
|
|
255
|
-
}),
|
|
257
|
+
}), Xe = {
|
|
256
258
|
[e.Network]: "Upload failed · network error",
|
|
257
259
|
[e.UnsupportedType]: "Upload failed · unsupported file type",
|
|
258
260
|
[e.FileTooLarge]: "Upload failed · file too large"
|
|
259
|
-
},
|
|
260
|
-
let { clickLabel: S = "Download attachment", expandLabel: C = "Expand pasted text", downloadLabel: w = "Download attachment", retryLabel: T = "Retry upload", removeLabel: E = "Remove attachment", openInNewTabLabel: D = "Open in new tab", sizeLabel: O, uploadingLabel: k = "Uploading", errorReasonLabels: A, genericErrorLabel: j = "Upload failed" } = o ?? {}, { typography: M, className: N } = s ?? {}, { id: P, name: F, status: I, errorReason: L } = t, R = I === a.Loading, z = I === a.Error, B = he(), V = z ? L && (A?.[L] ??
|
|
261
|
-
|
|
261
|
+
}, Ze = ({ attachment: t, searchQuery: n = "", onClick: r, onRetry: i, labels: o, styles: s, onDownload: l, isLink: u, cssVars: d, onExpand: h, isExpandable: g, onRemove: y, isSelected: b }) => {
|
|
262
|
+
let { clickLabel: S = "Download attachment", expandLabel: C = "Expand pasted text", downloadLabel: w = "Download attachment", retryLabel: T = "Retry upload", removeLabel: E = "Remove attachment", openInNewTabLabel: D = "Open in new tab", sizeLabel: O, uploadingLabel: k = "Uploading", errorReasonLabels: A, genericErrorLabel: j = "Upload failed" } = o ?? {}, { typography: M, className: N } = s ?? {}, { id: P, name: F, status: I, errorReason: L } = t, R = I === a.Loading, z = I === a.Error, B = he(), V = z ? L && (A?.[L] ?? Xe[L]) || j : "", { BottomIcon: ee, typeLabel: te } = He(t), ne = Be(t), re = !z && !R && l && !u, ie = z && !!i && L !== e.UnsupportedType && L !== e.FileTooLarge, ae = !!g && h !== void 0, H = ae || r !== void 0, oe = Number(!!re) + Number(!!ie) + Number(!!u) + Number(!!y), se = !H && oe === 1, ce = () => {
|
|
263
|
+
ae ? h(P) : r?.(P);
|
|
262
264
|
}, le = (e) => {
|
|
263
265
|
e.target === e.currentTarget && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), ce());
|
|
264
266
|
}, U = K(() => Fe(F), [F]), ue = W(() => {
|
|
265
267
|
window.open(t.referenceUrl, "_blank", "noopener,noreferrer");
|
|
266
|
-
}, [t]), de = c(Ue, "group/attachment-tile relative flex-col justify-between items-start gap-
|
|
268
|
+
}, [t]), de = c(Ue, "group/attachment-tile relative flex-col justify-between items-start gap-2 overflow-hidden p-3", Q.tile, H && !z && !R && Q.hovered, R && Q.loading, b && Q.selected, z && Q.tileError, se && Q.proxyFocus, Z.tile, b && Z.tileSelected), fe = /* @__PURE__ */ J("div", {
|
|
267
269
|
title: U,
|
|
268
|
-
className: c(M?.nameClassName ?? "dial-tiny-text", "line-clamp-2 w-full min-w-0 break-words", Q.nameText,
|
|
270
|
+
className: c(M?.nameClassName ?? "dial-tiny-text", "line-clamp-2 w-full min-w-0 break-words", Q.nameText, Z.tileName),
|
|
269
271
|
children: n ? /* @__PURE__ */ J(v, {
|
|
270
272
|
text: U,
|
|
271
273
|
query: n,
|
|
272
274
|
maxLines: 2
|
|
273
275
|
}) : U
|
|
274
276
|
}), pe = ee && /* @__PURE__ */ Y("div", {
|
|
275
|
-
className: c("flex w-full items-
|
|
277
|
+
className: c("flex w-full items-end gap-1", Z.tileType),
|
|
276
278
|
children: [ne ? /* @__PURE__ */ J(_, {
|
|
277
279
|
type: m.File,
|
|
278
280
|
name: F ?? "",
|
|
279
281
|
fileExtension: ze(t),
|
|
280
|
-
size: f.
|
|
282
|
+
size: f.MD,
|
|
281
283
|
decorative: !0
|
|
282
284
|
}) : /* @__PURE__ */ J(ee, {
|
|
283
|
-
size: f.
|
|
285
|
+
size: f.MD,
|
|
284
286
|
className: Q.typeText,
|
|
285
287
|
stroke: p,
|
|
286
288
|
"aria-hidden": !0
|
|
@@ -288,10 +290,10 @@ var ve = {
|
|
|
288
290
|
className: c(M?.metaClassName ?? "dial-tiny-text", "min-w-0 flex-1 truncate", Q.typeText),
|
|
289
291
|
children: O ? `${te} · ${O}` : te
|
|
290
292
|
})]
|
|
291
|
-
}), me =
|
|
293
|
+
}), me = H ? {
|
|
292
294
|
role: "button",
|
|
293
295
|
tabIndex: 0,
|
|
294
|
-
"aria-label":
|
|
296
|
+
"aria-label": ae ? C : S,
|
|
295
297
|
onClick: ce,
|
|
296
298
|
onKeyDown: le
|
|
297
299
|
} : {}, G = /* @__PURE__ */ Y(_e, { children: [
|
|
@@ -300,38 +302,39 @@ var ve = {
|
|
|
300
302
|
R && /* @__PURE__ */ J("div", {
|
|
301
303
|
role: "progressbar",
|
|
302
304
|
"aria-label": k,
|
|
303
|
-
className: c("absolute
|
|
305
|
+
className: c("absolute inset-0 flex items-center justify-center rounded-[11px]", Q.track),
|
|
304
306
|
children: /* @__PURE__ */ J(x, { size: 32 })
|
|
305
307
|
}),
|
|
306
308
|
/* @__PURE__ */ Y("div", {
|
|
307
|
-
className: "absolute end-1 top-1 flex
|
|
309
|
+
className: "absolute end-1 top-1 flex",
|
|
308
310
|
children: [
|
|
309
|
-
re && /* @__PURE__ */ J(
|
|
311
|
+
re && /* @__PURE__ */ J(qe, {
|
|
310
312
|
ariaLabel: w,
|
|
311
313
|
errorTitle: V,
|
|
312
314
|
errorDescId: B,
|
|
313
315
|
onClick: l,
|
|
314
316
|
id: P
|
|
315
317
|
}),
|
|
316
|
-
ie && /* @__PURE__ */ J(
|
|
318
|
+
ie && /* @__PURE__ */ J(Ke, {
|
|
317
319
|
ariaLabel: T,
|
|
318
320
|
errorTitle: V,
|
|
319
321
|
errorDescId: B,
|
|
320
322
|
onClick: i,
|
|
321
323
|
id: P
|
|
322
324
|
}),
|
|
323
|
-
u && /* @__PURE__ */ J(
|
|
325
|
+
u && /* @__PURE__ */ J(Je, {
|
|
324
326
|
ariaLabel: D,
|
|
325
327
|
errorTitle: V,
|
|
326
328
|
errorDescId: B,
|
|
327
329
|
onClick: ue
|
|
328
330
|
}),
|
|
329
|
-
y && /* @__PURE__ */ J(
|
|
331
|
+
y && /* @__PURE__ */ J(Ye, {
|
|
330
332
|
ariaLabel: E,
|
|
331
333
|
errorTitle: V,
|
|
332
334
|
errorDescId: B,
|
|
333
335
|
onClick: y,
|
|
334
|
-
id: P
|
|
336
|
+
id: P,
|
|
337
|
+
isAlwaysVisible: R
|
|
335
338
|
})
|
|
336
339
|
]
|
|
337
340
|
}),
|
|
@@ -350,13 +353,13 @@ var ve = {
|
|
|
350
353
|
...me,
|
|
351
354
|
"aria-busy": R,
|
|
352
355
|
style: d,
|
|
353
|
-
className: c(de,
|
|
356
|
+
className: c(de, H && "cursor-pointer", We),
|
|
354
357
|
children: G
|
|
355
358
|
})
|
|
356
359
|
});
|
|
357
|
-
},
|
|
360
|
+
}, Qe = /* @__PURE__ */ function(e) {
|
|
358
361
|
return e.Idle = "idle", e.Loading = "loading", e.Loaded = "loaded", e.Error = "error", e;
|
|
359
|
-
}({}),
|
|
362
|
+
}({}), $e = ({ enabled: e, src: t }) => {
|
|
360
363
|
let n = ge(null), [r, i] = q("idle");
|
|
361
364
|
return G(() => {
|
|
362
365
|
i(e && t ? "loading" : "idle");
|
|
@@ -371,47 +374,49 @@ var ve = {
|
|
|
371
374
|
imageRef: n,
|
|
372
375
|
imageLoadStatus: r
|
|
373
376
|
};
|
|
374
|
-
},
|
|
375
|
-
let { clickLabel: d = "Open attachment", expandLabel: m = "Expand pasted text", removeLabel: h = "Remove attachment", downloadLabel: g = "Download attachment" } = i ?? {}, { className:
|
|
376
|
-
enabled:
|
|
377
|
-
src:
|
|
378
|
-
}),
|
|
379
|
-
|
|
380
|
-
},
|
|
377
|
+
}, et = ({ attachment: e, onExpand: n, onClick: r, labels: i, onRemove: a, cssVars: o, onDownload: s, styles: l, isSelected: u }) => {
|
|
378
|
+
let { clickLabel: d = "Open attachment", expandLabel: m = "Expand pasted text", removeLabel: h = "Remove attachment", downloadLabel: g = "Download attachment", uploadingLabel: _ = "Uploading" } = i ?? {}, { className: v } = l ?? {}, { id: S, name: C } = e, w = e.previewUrl ?? e.url, T = e.type === t.Pasted && n !== void 0, { isLoading: E, isError: D, isImage: O } = K(() => He(e), [e]), k = r !== void 0 && !T && !E && !D, A = T || k, j = !!s && !E, M = !A && Number(!!a) + Number(j) === 1, { imageRef: N, imageLoadStatus: P } = $e({
|
|
379
|
+
enabled: O,
|
|
380
|
+
src: w
|
|
381
|
+
}), F = () => {
|
|
382
|
+
T && n ? n(S) : k && r && r(S);
|
|
383
|
+
}, I = A ? {
|
|
381
384
|
role: "button",
|
|
382
385
|
tabIndex: 0,
|
|
383
|
-
"aria-label":
|
|
384
|
-
onClick:
|
|
386
|
+
"aria-label": T ? m : d,
|
|
387
|
+
onClick: F,
|
|
385
388
|
onKeyDown: (e) => {
|
|
386
|
-
e.target === e.currentTarget && (e.key === "Enter" || e.key === " ") && (e.preventDefault(),
|
|
389
|
+
e.target === e.currentTarget && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), F());
|
|
387
390
|
}
|
|
388
391
|
} : {};
|
|
389
392
|
return /* @__PURE__ */ J("div", {
|
|
390
|
-
className: c(Ue, "group/attachment-tile",
|
|
391
|
-
...
|
|
393
|
+
className: c(Ue, "group/attachment-tile", A && "cursor-pointer", Q.tile, u && Q.selected, E && Q.loading, M && Q.proxyFocus, We, v, Z.tile, u && Z.tileSelected),
|
|
394
|
+
...I,
|
|
395
|
+
"aria-busy": E,
|
|
392
396
|
style: o,
|
|
393
397
|
children: /* @__PURE__ */ Y("div", {
|
|
394
398
|
className: "relative h-full w-full overflow-hidden",
|
|
395
399
|
children: [
|
|
396
400
|
/* @__PURE__ */ Y("div", {
|
|
397
|
-
className: "absolute end-1 top-1 z-10 flex
|
|
398
|
-
children: [a && /* @__PURE__ */ J(
|
|
401
|
+
className: "absolute end-1 top-1 z-10 flex",
|
|
402
|
+
children: [a && /* @__PURE__ */ J(Ye, {
|
|
399
403
|
ariaLabel: h,
|
|
400
404
|
onClick: a,
|
|
401
|
-
id:
|
|
402
|
-
className: Q.imageActionButton
|
|
403
|
-
|
|
405
|
+
id: S,
|
|
406
|
+
className: Q.imageActionButton,
|
|
407
|
+
isAlwaysVisible: E
|
|
408
|
+
}), j && /* @__PURE__ */ J(qe, {
|
|
404
409
|
ariaLabel: g,
|
|
405
410
|
onClick: s,
|
|
406
|
-
id:
|
|
411
|
+
id: S,
|
|
407
412
|
className: Q.imageActionButton
|
|
408
413
|
})]
|
|
409
414
|
}),
|
|
410
|
-
|
|
415
|
+
P !== Qe.Loaded && /* @__PURE__ */ J(y, {
|
|
411
416
|
variant: b.Rectangular,
|
|
412
417
|
width: "100%",
|
|
413
418
|
height: "100%",
|
|
414
|
-
active:
|
|
419
|
+
active: P === Qe.Loading,
|
|
415
420
|
overlay: /* @__PURE__ */ J(U, {
|
|
416
421
|
size: f.LG,
|
|
417
422
|
className: Q.placeholderIcon,
|
|
@@ -421,17 +426,23 @@ var ve = {
|
|
|
421
426
|
className: "absolute inset-0 rounded-xl"
|
|
422
427
|
}),
|
|
423
428
|
/* @__PURE__ */ J("img", {
|
|
424
|
-
ref:
|
|
425
|
-
src:
|
|
426
|
-
alt:
|
|
429
|
+
ref: N,
|
|
430
|
+
src: w,
|
|
431
|
+
alt: C,
|
|
427
432
|
loading: "lazy",
|
|
428
433
|
decoding: "async",
|
|
429
|
-
className: c("h-full w-full rounded-xl object-cover transition-opacity duration-200",
|
|
434
|
+
className: c("h-full w-full rounded-xl object-cover transition-opacity duration-200", P === Qe.Loaded ? "opacity-100" : "opacity-0")
|
|
435
|
+
}),
|
|
436
|
+
E && /* @__PURE__ */ J("div", {
|
|
437
|
+
role: "progressbar",
|
|
438
|
+
"aria-label": _,
|
|
439
|
+
className: c("absolute inset-0 flex items-center justify-center rounded-xl", Q.track),
|
|
440
|
+
children: /* @__PURE__ */ J(x, { size: 32 })
|
|
430
441
|
})
|
|
431
442
|
]
|
|
432
443
|
})
|
|
433
444
|
});
|
|
434
|
-
},
|
|
445
|
+
}, tt = ({ attachment: e, searchQuery: n = "", onRemove: r, onRetry: i, onExpand: a, onClick: o, onDownload: c, labels: l, styles: u, isSelected: d }) => {
|
|
435
446
|
let { colors: f } = u ?? {}, p = e.type === t.Pasted && a !== void 0, m = s({
|
|
436
447
|
"--ai-tile-bg": f?.background,
|
|
437
448
|
"--ai-tile-border": f?.border,
|
|
@@ -450,7 +461,7 @@ var ve = {
|
|
|
450
461
|
"--ai-tile-hover-icon-color": f?.hoverIconColor,
|
|
451
462
|
"--ai-tile-progress-track": f?.trackBackground
|
|
452
463
|
}), { isImage: h, isLink: g } = K(() => He(e), [e]);
|
|
453
|
-
return h ? /* @__PURE__ */ J(
|
|
464
|
+
return h ? /* @__PURE__ */ J(et, {
|
|
454
465
|
attachment: e,
|
|
455
466
|
labels: l,
|
|
456
467
|
onClick: o,
|
|
@@ -460,7 +471,7 @@ var ve = {
|
|
|
460
471
|
cssVars: m,
|
|
461
472
|
onDownload: c,
|
|
462
473
|
isSelected: d
|
|
463
|
-
}) : /* @__PURE__ */ J(
|
|
474
|
+
}) : /* @__PURE__ */ J(Ze, {
|
|
464
475
|
attachment: e,
|
|
465
476
|
searchQuery: n,
|
|
466
477
|
onClick: o,
|
|
@@ -475,7 +486,7 @@ var ve = {
|
|
|
475
486
|
isExpandable: p,
|
|
476
487
|
isSelected: d
|
|
477
488
|
});
|
|
478
|
-
},
|
|
489
|
+
}, nt = (e) => {
|
|
479
490
|
let t = l(e);
|
|
480
491
|
if (!e?.length) return t;
|
|
481
492
|
let n = /* @__PURE__ */ new Map();
|
|
@@ -490,7 +501,7 @@ var ve = {
|
|
|
490
501
|
contentType: t
|
|
491
502
|
} : e;
|
|
492
503
|
});
|
|
493
|
-
},
|
|
504
|
+
}, rt = ({ children: e, codeClassName: t, blockClassName: n = "dial-code-text", copyAriaLabel: i, copiedLabel: a }) => /* @__PURE__ */ J(r, {
|
|
494
505
|
language: t?.replace(/^language-/, "") ?? "",
|
|
495
506
|
value: typeof e == "string" ? e : String(e ?? ""),
|
|
496
507
|
codeClassName: n,
|
|
@@ -498,7 +509,7 @@ var ve = {
|
|
|
498
509
|
copyLabel: i,
|
|
499
510
|
copiedLabel: a,
|
|
500
511
|
hideDownload: !0
|
|
501
|
-
}),
|
|
512
|
+
}), it = me(({ content: e, typography: t, copyAriaLabel: n = "Copy", copiedLabel: r, tableScrollRegionAriaLabel: a, mathScrollRegionAriaLabel: o }) => {
|
|
502
513
|
let s = "mb-1.5 last:mb-0", l = c(t?.headingClassName ?? "dial-small-semi-text", X.stageContent, s);
|
|
503
514
|
return /* @__PURE__ */ J(i, {
|
|
504
515
|
content: e,
|
|
@@ -520,7 +531,7 @@ var ve = {
|
|
|
520
531
|
link: c(t?.contentClassName ?? "dial-tiny-text", X.stageContent),
|
|
521
532
|
tableCell: c(t?.contentClassName ?? "dial-tiny-text", X.tableCell)
|
|
522
533
|
},
|
|
523
|
-
components: { code: ({ children: e, className: i }) => i?.includes("language-") ? /* @__PURE__ */ J(
|
|
534
|
+
components: { code: ({ children: e, className: i }) => i?.includes("language-") ? /* @__PURE__ */ J(rt, {
|
|
524
535
|
codeClassName: i,
|
|
525
536
|
blockClassName: t?.codeBlockClassName,
|
|
526
537
|
copyAriaLabel: n,
|
|
@@ -531,7 +542,7 @@ var ve = {
|
|
|
531
542
|
children: e
|
|
532
543
|
}) }
|
|
533
544
|
});
|
|
534
|
-
}),
|
|
545
|
+
}), at = ({ attachments: e, clickLabel: t, onAttachmentClick: n }) => {
|
|
535
546
|
let r = W((t) => {
|
|
536
547
|
let r = e.find((e) => e.id === t);
|
|
537
548
|
r && n?.(r);
|
|
@@ -541,17 +552,17 @@ var ve = {
|
|
|
541
552
|
className: "flex flex-wrap gap-2",
|
|
542
553
|
children: e.map((e) => /* @__PURE__ */ J("div", {
|
|
543
554
|
role: "listitem",
|
|
544
|
-
children: /* @__PURE__ */ J(
|
|
555
|
+
children: /* @__PURE__ */ J(tt, {
|
|
545
556
|
attachment: e,
|
|
546
557
|
onClick: n && r,
|
|
547
558
|
labels: { clickLabel: t }
|
|
548
559
|
})
|
|
549
560
|
}, e.id))
|
|
550
561
|
});
|
|
551
|
-
},
|
|
562
|
+
}, ot = ({ stage: e, isLive: t, typography: n, labels: r, nameOverride: i, onAttachmentClick: a, childList: s, isExpanded: l, onToggle: u }) => {
|
|
552
563
|
let [f, p] = q(!1), m = l ?? f, h = W((e) => {
|
|
553
564
|
l === void 0 && p(e), u?.(e);
|
|
554
|
-
}, [l, u]), { copyAriaLabel: _ = "Copy stage content", codeBlockCopiedLabel: v, tableScrollRegionAriaLabel: y, mathScrollRegionAriaLabel: b, runningAriaLabel: x, failedAriaLabel: S, attachmentClickLabel: C = "Preview search result" } = r ?? {}, w = K(() =>
|
|
565
|
+
}, [l, u]), { copyAriaLabel: _ = "Copy stage content", codeBlockCopiedLabel: v, tableScrollRegionAriaLabel: y, mathScrollRegionAriaLabel: b, runningAriaLabel: x, failedAriaLabel: S, attachmentClickLabel: C = "Preview search result" } = r ?? {}, w = K(() => nt(e.attachments), [e.attachments]), { name: T, durationLabel: E } = we(e.name), D = i ?? T, O = !i && Te(T), k = e.status === o.Failed, A = !!e.content || !!e.attachments?.length, j = A || s != null, M = /* @__PURE__ */ Y(_e, { children: [
|
|
555
566
|
/* @__PURE__ */ J("span", {
|
|
556
567
|
className: "flex flex-none items-center",
|
|
557
568
|
children: /* @__PURE__ */ J(Pe, {
|
|
@@ -588,7 +599,7 @@ var ve = {
|
|
|
588
599
|
className: "flex min-w-0 flex-col gap-3 ps-8",
|
|
589
600
|
children: [e.content && /* @__PURE__ */ J("div", {
|
|
590
601
|
className: "max-h-[300px] min-w-0 overflow-y-auto",
|
|
591
|
-
children: /* @__PURE__ */ J(
|
|
602
|
+
children: /* @__PURE__ */ J(it, {
|
|
592
603
|
content: e.content,
|
|
593
604
|
typography: n,
|
|
594
605
|
copyAriaLabel: _,
|
|
@@ -596,7 +607,7 @@ var ve = {
|
|
|
596
607
|
tableScrollRegionAriaLabel: y,
|
|
597
608
|
mathScrollRegionAriaLabel: b
|
|
598
609
|
})
|
|
599
|
-
}), w.length > 0 && /* @__PURE__ */ J(
|
|
610
|
+
}), w.length > 0 && /* @__PURE__ */ J(at, {
|
|
600
611
|
attachments: w,
|
|
601
612
|
clickLabel: C,
|
|
602
613
|
onAttachmentClick: a
|
|
@@ -606,9 +617,9 @@ var ve = {
|
|
|
606
617
|
className: c("flex w-full items-center gap-2 px-2 py-1.5", X.row),
|
|
607
618
|
children: M
|
|
608
619
|
});
|
|
609
|
-
},
|
|
620
|
+
}, st = (e) => e <= 3 ? "ps-4" : "ps-0", ct = (e) => e <= 3 ? "ps-6" : "ps-0", lt = ({ node: e, depth: t, nameOverride: n, isStreaming: r, expansion: i, typography: a, labels: o, onAttachmentClick: s }) => {
|
|
610
621
|
let c = ke(e.stage.index), l = t + 1;
|
|
611
|
-
return /* @__PURE__ */ J(
|
|
622
|
+
return /* @__PURE__ */ J(ot, {
|
|
612
623
|
stage: e.stage,
|
|
613
624
|
nameOverride: n,
|
|
614
625
|
isLive: r && e.stage.status == null,
|
|
@@ -617,10 +628,10 @@ var ve = {
|
|
|
617
628
|
onAttachmentClick: s,
|
|
618
629
|
isExpanded: i.isExpanded(c),
|
|
619
630
|
onToggle: (e) => i.onToggle(c, e),
|
|
620
|
-
childList: e.children.length > 0 ? /* @__PURE__ */ J(
|
|
631
|
+
childList: e.children.length > 0 ? /* @__PURE__ */ J(dt, {
|
|
621
632
|
nodes: e.children,
|
|
622
633
|
depth: l,
|
|
623
|
-
className:
|
|
634
|
+
className: st(l),
|
|
624
635
|
isStreaming: r,
|
|
625
636
|
expansion: i,
|
|
626
637
|
typography: a,
|
|
@@ -628,7 +639,7 @@ var ve = {
|
|
|
628
639
|
onAttachmentClick: s
|
|
629
640
|
}) : void 0
|
|
630
641
|
});
|
|
631
|
-
},
|
|
642
|
+
}, ut = ({ row: e, depth: t, isStreaming: n, expansion: r, typography: i, labels: a, onAttachmentClick: s }) => {
|
|
632
643
|
let { runningAriaLabel: l, failedAriaLabel: u, attemptLabel: f = (e) => `Attempt ${e}` } = a ?? {}, p = e.attempts ?? [], m = p.some((e) => e.stage.status == null), h = p.some((e) => e.stage.status === o.Failed), _ = o.Completed;
|
|
633
644
|
m ? _ = null : h && (_ = o.Failed);
|
|
634
645
|
let v = Ae(e.key), y = r.isExpanded(v), b = t + 1;
|
|
@@ -659,14 +670,14 @@ var ve = {
|
|
|
659
670
|
onToggle: (e) => r.onToggle(v, e),
|
|
660
671
|
className: je,
|
|
661
672
|
headerClassName: c(Me, X.collapseButton, X.row, X.stageHeader),
|
|
662
|
-
contentClassName: c("-mt-2 min-w-0 px-0",
|
|
673
|
+
contentClassName: c("-mt-2 min-w-0 px-0", ct(b), X.stageRegion),
|
|
663
674
|
children: /* @__PURE__ */ J("ul", {
|
|
664
675
|
role: "list",
|
|
665
676
|
className: "flex min-w-0 flex-col gap-0.5",
|
|
666
677
|
children: y && p.map((e, t) => /* @__PURE__ */ J("li", {
|
|
667
678
|
role: "listitem",
|
|
668
679
|
className: "min-w-0",
|
|
669
|
-
children: /* @__PURE__ */ J(
|
|
680
|
+
children: /* @__PURE__ */ J(lt, {
|
|
670
681
|
node: e,
|
|
671
682
|
depth: b,
|
|
672
683
|
nameOverride: f(t + 1),
|
|
@@ -679,23 +690,23 @@ var ve = {
|
|
|
679
690
|
}, e.stage.index))
|
|
680
691
|
})
|
|
681
692
|
});
|
|
682
|
-
},
|
|
693
|
+
}, dt = ({ nodes: e, depth: t, className: n, ...r }) => /* @__PURE__ */ J("ul", {
|
|
683
694
|
role: "list",
|
|
684
695
|
className: c("flex min-w-0 flex-col gap-0.5", n),
|
|
685
696
|
children: Ne(e).map((e) => /* @__PURE__ */ J("li", {
|
|
686
697
|
role: "listitem",
|
|
687
698
|
className: "min-w-0",
|
|
688
|
-
children: e.node ? /* @__PURE__ */ J(
|
|
699
|
+
children: e.node ? /* @__PURE__ */ J(lt, {
|
|
689
700
|
node: e.node,
|
|
690
701
|
depth: t,
|
|
691
702
|
...r
|
|
692
|
-
}) : /* @__PURE__ */ J(
|
|
703
|
+
}) : /* @__PURE__ */ J(ut, {
|
|
693
704
|
row: e,
|
|
694
705
|
depth: t,
|
|
695
706
|
...r
|
|
696
707
|
})
|
|
697
708
|
}, e.key))
|
|
698
|
-
}),
|
|
709
|
+
}), ft = ({ stages: e, isStreaming: t, className: n, styles: r, labels: i, onAttachmentClick: a, expansion: o }) => {
|
|
699
710
|
let { colors: l, typography: u } = r ?? {}, d = s({
|
|
700
711
|
"--cs-text": l?.text,
|
|
701
712
|
"--cs-row-hover": l?.rowHoverColor,
|
|
@@ -716,7 +727,7 @@ var ve = {
|
|
|
716
727
|
return /* @__PURE__ */ J("div", {
|
|
717
728
|
style: d,
|
|
718
729
|
className: c("w-full min-w-0", X.panel, n, ve.panel),
|
|
719
|
-
children: /* @__PURE__ */ J(
|
|
730
|
+
children: /* @__PURE__ */ J(dt, {
|
|
720
731
|
nodes: f,
|
|
721
732
|
depth: 0,
|
|
722
733
|
className: "w-full ps-5",
|
|
@@ -727,9 +738,9 @@ var ve = {
|
|
|
727
738
|
onAttachmentClick: a
|
|
728
739
|
})
|
|
729
740
|
});
|
|
730
|
-
},
|
|
741
|
+
}, pt = (e) => {
|
|
731
742
|
let t = ye();
|
|
732
|
-
return /* @__PURE__ */ J(
|
|
743
|
+
return /* @__PURE__ */ J(ft, {
|
|
733
744
|
...e,
|
|
734
745
|
expansion: t
|
|
735
746
|
});
|
|
@@ -740,7 +751,7 @@ var ve = {
|
|
|
740
751
|
doneIcon: "_doneIcon_16fae_36",
|
|
741
752
|
failedText: "_failedText_16fae_40",
|
|
742
753
|
liveName: "_liveName_16fae_44"
|
|
743
|
-
},
|
|
754
|
+
}, mt = ({ stages: e, isStreaming: t, labels: n, className: r, styles: i, onAttachmentClick: a }) => {
|
|
744
755
|
let { executedLabel: l = "Executed", stepsLabel: u = () => "steps", failedCountLabel: m = (e) => `${e} failed`, runningAriaLabel: h = "Running", copyAriaLabel: _, codeBlockCopiedLabel: v, tableScrollRegionAriaLabel: y, mathScrollRegionAriaLabel: b, failedAriaLabel: S, attemptLabel: C, attachmentClickLabel: T } = n ?? {}, [E, D] = q(t), O = ye(), { reset: k } = O, A = e.length > 1;
|
|
745
756
|
G(() => {
|
|
746
757
|
A && !E && k();
|
|
@@ -785,7 +796,7 @@ var ve = {
|
|
|
785
796
|
attemptLabel: C,
|
|
786
797
|
attachmentClickLabel: T
|
|
787
798
|
};
|
|
788
|
-
if (e.length === 1) return /* @__PURE__ */ J(
|
|
799
|
+
if (e.length === 1) return /* @__PURE__ */ J(ft, {
|
|
789
800
|
stages: e,
|
|
790
801
|
isStreaming: t,
|
|
791
802
|
expansion: O,
|
|
@@ -861,7 +872,7 @@ var ve = {
|
|
|
861
872
|
className: "overflow-visible py-0",
|
|
862
873
|
headerClassName: c("justify-start gap-1 rounded-none px-0", $.toggleButton, ve.groupToggle),
|
|
863
874
|
contentClassName: c("-mt-2 px-0", $.groupRegion),
|
|
864
|
-
children: E && /* @__PURE__ */ J(
|
|
875
|
+
children: E && /* @__PURE__ */ J(ft, {
|
|
865
876
|
stages: e,
|
|
866
877
|
isStreaming: t,
|
|
867
878
|
expansion: O,
|
|
@@ -877,4 +888,4 @@ var ve = {
|
|
|
877
888
|
});
|
|
878
889
|
};
|
|
879
890
|
//#endregion
|
|
880
|
-
export { ve as CONVERSATION_STAGES_CLASS,
|
|
891
|
+
export { ve as CONVERSATION_STAGES_CLASS, mt as CollapsedGroup, pt as StagesPanel };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epam/ai-dial-conversation-stages",
|
|
3
3
|
"description": "Panel for displaying agent processing stages during LLM response streaming",
|
|
4
|
-
"version": "1.3.0-dev.
|
|
4
|
+
"version": "1.3.0-dev.61",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./index.js",
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@tabler/icons-react": "^3.44.0",
|
|
21
|
-
"@epam/ai-dial-attachment-input": "1.3.0-dev.
|
|
21
|
+
"@epam/ai-dial-attachment-input": "1.3.0-dev.61"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"react": "^19.2.8",
|
|
25
|
-
"@epam/ai-dial-chat-shared": "1.3.0-dev.
|
|
25
|
+
"@epam/ai-dial-chat-shared": "1.3.0-dev.61",
|
|
26
26
|
"@epam/ai-dial-ui-kit": "^0.15.4"
|
|
27
27
|
},
|
|
28
28
|
"repository": {
|