@epam/ai-dial-source-panel 1.1.0-dev.52 → 1.1.0-dev.55
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 +30 -30
- package/package.json +5 -5
package/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { AttachmentType as e, BASE_LG_ICON_PROPS as t,
|
|
2
|
-
import { PanelEmpty as
|
|
3
|
-
import { DIAL_ICON_SIZE as
|
|
1
|
+
import { AttachmentType as e, BASE_LG_ICON_PROPS as t, MarkdownRenderer as n, buildCssVars as r, mergeClasses as i } from "@epam/ai-dial-chat-shared";
|
|
2
|
+
import { PanelEmpty as a, PanelNoResults as o, SearchInput as s, SidebarOrientation as c, SidebarPanel as l } from "@epam/ai-dial-sidebar";
|
|
3
|
+
import { DIAL_ICON_SIZE as u, DialGhostIconButton as d, ElementSize as f, Highlight as p } from "@epam/ai-dial-ui-kit";
|
|
4
4
|
import { IconCopy as m, IconDownload as h } from "@tabler/icons-react";
|
|
5
5
|
import { memo as g, useLayoutEffect as _, useMemo as v, useState as y } from "react";
|
|
6
6
|
import { AttachmentCard as b } from "@epam/ai-dial-conversation-input";
|
|
7
7
|
import { Fragment as x, jsx as S, jsxs as C } from "react/jsx-runtime";
|
|
8
|
-
var w = g(({ attachments: t, title: n, searchQuery: r, titleClassName:
|
|
8
|
+
var w = g(({ attachments: t, title: n, searchQuery: r, titleClassName: a = "dial-body-semi-text", onAttachmentClick: o, attachmentClickLabel: s }) => t.length === 0 ? null : /* @__PURE__ */ C("section", {
|
|
9
9
|
className: "mb-6",
|
|
10
10
|
children: [/* @__PURE__ */ S("h2", {
|
|
11
|
-
className: a
|
|
11
|
+
className: i(a, "mb-3"),
|
|
12
12
|
children: n
|
|
13
13
|
}), /* @__PURE__ */ S("div", {
|
|
14
14
|
role: "list",
|
|
@@ -27,21 +27,21 @@ var w = g(({ attachments: t, title: n, searchQuery: r, titleClassName: i = "dial
|
|
|
27
27
|
})), T = {
|
|
28
28
|
link: "_link_1f4sp_1",
|
|
29
29
|
quote: "_quote_1f4sp_5"
|
|
30
|
-
}, E = g(({ title: e, sources: t, copyLabel:
|
|
31
|
-
let [g, _] = y(""), b =
|
|
32
|
-
"--sp-source-link":
|
|
33
|
-
"--sp-source-quote":
|
|
34
|
-
}), [
|
|
30
|
+
}, E = g(({ title: e, sources: t, copyLabel: a, copiedLabel: o = "Link copied to clipboard", searchQuery: s = "", typography: c, colors: l, onSourceClick: h }) => {
|
|
31
|
+
let [g, _] = y(""), b = c?.sectionTitleClassName ?? "dial-body-semi-text", x = c?.sourceLinkClassName ?? "dial-small-text", w = c?.sourceQuoteClassName ?? "dial-tiny-text", E = v(() => r({
|
|
32
|
+
"--sp-source-link": l?.sourceLink,
|
|
33
|
+
"--sp-source-quote": l?.sourceQuote
|
|
34
|
+
}), [l]);
|
|
35
35
|
if (t.length === 0) return null;
|
|
36
36
|
let D = async (e) => {
|
|
37
|
-
await navigator.clipboard.writeText(e), _(
|
|
37
|
+
await navigator.clipboard.writeText(e), _(o);
|
|
38
38
|
};
|
|
39
39
|
return /* @__PURE__ */ C("section", {
|
|
40
40
|
className: "mb-6",
|
|
41
41
|
style: E,
|
|
42
42
|
children: [
|
|
43
43
|
/* @__PURE__ */ S("h2", {
|
|
44
|
-
className:
|
|
44
|
+
className: i(b, "mb-3"),
|
|
45
45
|
children: e
|
|
46
46
|
}),
|
|
47
47
|
/* @__PURE__ */ S("ul", {
|
|
@@ -54,28 +54,28 @@ var w = g(({ attachments: t, title: n, searchQuery: r, titleClassName: i = "dial
|
|
|
54
54
|
href: e.url,
|
|
55
55
|
target: "_blank",
|
|
56
56
|
rel: "noopener noreferrer",
|
|
57
|
-
className:
|
|
57
|
+
className: i(x, T.link, "min-w-0 flex-1 truncate"),
|
|
58
58
|
onClick: h ? (t) => {
|
|
59
59
|
t.preventDefault(), h(e);
|
|
60
60
|
} : void 0,
|
|
61
|
-
children:
|
|
61
|
+
children: s ? /* @__PURE__ */ S(p, {
|
|
62
62
|
text: e.title,
|
|
63
|
-
query:
|
|
63
|
+
query: s,
|
|
64
64
|
maxLines: 1
|
|
65
65
|
}) : e.title
|
|
66
|
-
}), /* @__PURE__ */ S(
|
|
67
|
-
size:
|
|
66
|
+
}), /* @__PURE__ */ S(d, {
|
|
67
|
+
size: f.Small,
|
|
68
68
|
icon: /* @__PURE__ */ S(m, {
|
|
69
|
-
size:
|
|
69
|
+
size: u.SM,
|
|
70
70
|
stroke: 1.5,
|
|
71
71
|
"aria-hidden": !0
|
|
72
72
|
}),
|
|
73
|
-
"aria-label":
|
|
73
|
+
"aria-label": a,
|
|
74
74
|
onClick: () => void D(e.url)
|
|
75
75
|
})]
|
|
76
76
|
}), e.quote && /* @__PURE__ */ S("div", {
|
|
77
|
-
className:
|
|
78
|
-
children: /* @__PURE__ */ S(
|
|
77
|
+
className: i(w, T.quote, "line-clamp-5 [&>div>*+*]:mt-1"),
|
|
78
|
+
children: /* @__PURE__ */ S(n, { content: e.quote })
|
|
79
79
|
})]
|
|
80
80
|
}, e.url))
|
|
81
81
|
}),
|
|
@@ -87,15 +87,15 @@ var w = g(({ attachments: t, title: n, searchQuery: r, titleClassName: i = "dial
|
|
|
87
87
|
})
|
|
88
88
|
]
|
|
89
89
|
});
|
|
90
|
-
}), D = (e, t) => e.toLowerCase().includes(t.toLowerCase()), O = g(({ isOpen: e, onClose: n, uploaded: r, generated: i, sources:
|
|
90
|
+
}), D = (e, t) => e.toLowerCase().includes(t.toLowerCase()), O = g(({ isOpen: e, onClose: n, uploaded: r, generated: i, sources: u, onAttachmentClick: f, onSourceClick: p, onDownloadAll: m, isMobile: g, defaultWidth: b, minWidth: T, maxWidth: O, onResizeStop: k, labels: A, styles: j }) => {
|
|
91
91
|
let [M, N] = y("");
|
|
92
92
|
_(() => {
|
|
93
93
|
e || N("");
|
|
94
94
|
}, [e]);
|
|
95
|
-
let P = v(() => M ? r.filter((e) => D(e.name, M)) : r, [r, M]), F = v(() => M ? i.filter((e) => D(e.name, M)) : i, [i, M]), I = v(() => M ?
|
|
96
|
-
return /* @__PURE__ */ C(
|
|
95
|
+
let P = v(() => M ? r.filter((e) => D(e.name, M)) : r, [r, M]), F = v(() => M ? i.filter((e) => D(e.name, M)) : i, [i, M]), I = v(() => M ? u.filter((e) => D(e.title, M) || D(e.url, M) || e.quote != null && D(e.quote, M)) : u, [u, M]), L = r.length === 0 && i.length === 0 && u.length === 0, R = M !== "" && P.length === 0 && F.length === 0 && I.length === 0;
|
|
96
|
+
return /* @__PURE__ */ C(l, {
|
|
97
97
|
isOpen: e,
|
|
98
|
-
orientation:
|
|
98
|
+
orientation: c.Right,
|
|
99
99
|
styles: {
|
|
100
100
|
className: e ? "mobile:w-full" : "w-0",
|
|
101
101
|
bodyClassName: "flex flex-col overflow-hidden p-0"
|
|
@@ -107,7 +107,7 @@ var w = g(({ attachments: t, title: n, searchQuery: r, titleClassName: i = "dial
|
|
|
107
107
|
minWidth: T,
|
|
108
108
|
maxWidth: O,
|
|
109
109
|
onResizeStop: k,
|
|
110
|
-
rightActions: !L && /* @__PURE__ */ S(
|
|
110
|
+
rightActions: !L && /* @__PURE__ */ S(d, {
|
|
111
111
|
icon: /* @__PURE__ */ S(h, { ...t }),
|
|
112
112
|
"aria-label": A.downloadAllLabel,
|
|
113
113
|
tooltipProps: { tooltip: A.downloadAllLabel },
|
|
@@ -115,7 +115,7 @@ var w = g(({ attachments: t, title: n, searchQuery: r, titleClassName: i = "dial
|
|
|
115
115
|
disabled: !m
|
|
116
116
|
}),
|
|
117
117
|
children: [
|
|
118
|
-
!L && /* @__PURE__ */ S(
|
|
118
|
+
!L && /* @__PURE__ */ S(s, {
|
|
119
119
|
value: M,
|
|
120
120
|
onChange: N,
|
|
121
121
|
labels: {
|
|
@@ -131,13 +131,13 @@ var w = g(({ attachments: t, title: n, searchQuery: r, titleClassName: i = "dial
|
|
|
131
131
|
}),
|
|
132
132
|
/* @__PURE__ */ S("div", {
|
|
133
133
|
className: "flex-1 overflow-y-auto p-4",
|
|
134
|
-
children: L ? /* @__PURE__ */ S(
|
|
134
|
+
children: L ? /* @__PURE__ */ S(a, { label: A.emptyLabel }) : R ? /* @__PURE__ */ S(o, { label: A.noResultsLabel }) : /* @__PURE__ */ C(x, { children: [
|
|
135
135
|
/* @__PURE__ */ S(w, {
|
|
136
136
|
attachments: P,
|
|
137
137
|
title: A.uploadedSectionTitle,
|
|
138
138
|
searchQuery: M,
|
|
139
139
|
titleClassName: j?.typography?.sectionTitleClassName,
|
|
140
|
-
onAttachmentClick:
|
|
140
|
+
onAttachmentClick: f,
|
|
141
141
|
attachmentClickLabel: A.attachmentClickLabel
|
|
142
142
|
}),
|
|
143
143
|
/* @__PURE__ */ S(w, {
|
|
@@ -145,7 +145,7 @@ var w = g(({ attachments: t, title: n, searchQuery: r, titleClassName: i = "dial
|
|
|
145
145
|
title: A.generatedSectionTitle,
|
|
146
146
|
searchQuery: M,
|
|
147
147
|
titleClassName: j?.typography?.sectionTitleClassName,
|
|
148
|
-
onAttachmentClick:
|
|
148
|
+
onAttachmentClick: f,
|
|
149
149
|
attachmentClickLabel: A.attachmentClickLabel
|
|
150
150
|
}),
|
|
151
151
|
/* @__PURE__ */ S(E, {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epam/ai-dial-source-panel",
|
|
3
3
|
"description": "Panel for displaying conversation sources — uploaded files and generated citations",
|
|
4
|
-
"version": "1.1.0-dev.
|
|
4
|
+
"version": "1.1.0-dev.55",
|
|
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.1.0-dev.
|
|
23
|
-
"@epam/ai-dial-sidebar": "1.1.0-dev.
|
|
24
|
-
"@epam/ai-dial-conversation-input": "1.1.0-dev.
|
|
25
|
-
"@epam/ai-dial-ui-kit": "^0.13.0-dev.
|
|
22
|
+
"@epam/ai-dial-chat-shared": "1.1.0-dev.55",
|
|
23
|
+
"@epam/ai-dial-sidebar": "1.1.0-dev.55",
|
|
24
|
+
"@epam/ai-dial-conversation-input": "1.1.0-dev.55",
|
|
25
|
+
"@epam/ai-dial-ui-kit": "^0.13.0-dev.17"
|
|
26
26
|
},
|
|
27
27
|
"repository": {
|
|
28
28
|
"type": "git",
|