@epam/ai-dial-source-panel 1.1.0-dev.74 → 1.1.0-dev.78
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 +51 -51
- package/package.json +5 -5
package/index.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
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
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,
|
|
4
|
-
import { IconCopy as
|
|
5
|
-
import { memo as
|
|
6
|
-
import { AttachmentCard as
|
|
7
|
-
import { Fragment as
|
|
8
|
-
var
|
|
3
|
+
import { DIAL_ICON_SIZE as u, DialGhostIconButton as d, ElementSize as f, GhostIconButton as p, Highlight as m } from "@epam/ai-dial-ui-kit";
|
|
4
|
+
import { IconCopy as h, IconDownload as g } from "@tabler/icons-react";
|
|
5
|
+
import { memo as _, useLayoutEffect as v, useMemo as y, useState as b } from "react";
|
|
6
|
+
import { AttachmentCard as x } from "@epam/ai-dial-conversation-input";
|
|
7
|
+
import { Fragment as S, jsx as C, jsxs as w } from "react/jsx-runtime";
|
|
8
|
+
var T = _(({ attachments: t, title: n, searchQuery: r, titleClassName: a = "dial-body-semi-text", onAttachmentClick: o, attachmentClickLabel: s }) => t.length === 0 ? null : /* @__PURE__ */ w("section", {
|
|
9
9
|
className: "mb-6",
|
|
10
|
-
children: [/* @__PURE__ */
|
|
10
|
+
children: [/* @__PURE__ */ C("h2", {
|
|
11
11
|
className: i(a, "mb-3"),
|
|
12
12
|
children: n
|
|
13
|
-
}), /* @__PURE__ */
|
|
13
|
+
}), /* @__PURE__ */ C("div", {
|
|
14
14
|
role: "list",
|
|
15
15
|
className: "grid grid-cols-[repeat(auto-fill,minmax(84px,1fr))] gap-3",
|
|
16
|
-
children: t.map((t, n) => /* @__PURE__ */
|
|
16
|
+
children: t.map((t, n) => /* @__PURE__ */ C("div", {
|
|
17
17
|
role: "listitem",
|
|
18
18
|
className: t.type === e.Audio ? "col-span-full" : void 0,
|
|
19
|
-
children: /* @__PURE__ */
|
|
19
|
+
children: /* @__PURE__ */ C(x, {
|
|
20
20
|
attachment: t,
|
|
21
21
|
searchQuery: r,
|
|
22
22
|
onClick: o ? () => o(t) : void 0,
|
|
@@ -24,11 +24,11 @@ var w = g(({ attachments: t, title: n, searchQuery: r, titleClassName: a = "dial
|
|
|
24
24
|
})
|
|
25
25
|
}, `${t.id}-${n}`))
|
|
26
26
|
})]
|
|
27
|
-
})),
|
|
27
|
+
})), E = {
|
|
28
28
|
link: "_link_1f4sp_1",
|
|
29
29
|
quote: "_quote_1f4sp_5"
|
|
30
|
-
},
|
|
31
|
-
let [g, _] =
|
|
30
|
+
}, D = _(({ title: e, sources: t, copyLabel: a, copiedLabel: o = "Link copied to clipboard", searchQuery: s = "", typography: c, colors: l, onSourceClick: d }) => {
|
|
31
|
+
let [g, _] = b(""), v = c?.sectionTitleClassName ?? "dial-body-semi-text", x = c?.sourceLinkClassName ?? "dial-small-text", S = c?.sourceQuoteClassName ?? "dial-tiny-text", T = y(() => r({
|
|
32
32
|
"--sp-source-link": l?.sourceLink,
|
|
33
33
|
"--sp-source-quote": l?.sourceQuote
|
|
34
34
|
}), [l]);
|
|
@@ -36,36 +36,36 @@ var w = g(({ attachments: t, title: n, searchQuery: r, titleClassName: a = "dial
|
|
|
36
36
|
let D = async (e) => {
|
|
37
37
|
await navigator.clipboard.writeText(e), _(o);
|
|
38
38
|
};
|
|
39
|
-
return /* @__PURE__ */
|
|
39
|
+
return /* @__PURE__ */ w("section", {
|
|
40
40
|
className: "mb-6",
|
|
41
|
-
style:
|
|
41
|
+
style: T,
|
|
42
42
|
children: [
|
|
43
|
-
/* @__PURE__ */
|
|
44
|
-
className: i(
|
|
43
|
+
/* @__PURE__ */ C("h2", {
|
|
44
|
+
className: i(v, "mb-3"),
|
|
45
45
|
children: e
|
|
46
46
|
}),
|
|
47
|
-
/* @__PURE__ */
|
|
47
|
+
/* @__PURE__ */ C("ul", {
|
|
48
48
|
className: "flex flex-col gap-3",
|
|
49
|
-
children: t.map((e) => /* @__PURE__ */
|
|
49
|
+
children: t.map((e) => /* @__PURE__ */ w("li", {
|
|
50
50
|
className: "flex flex-col gap-1",
|
|
51
|
-
children: [/* @__PURE__ */
|
|
51
|
+
children: [/* @__PURE__ */ w("div", {
|
|
52
52
|
className: "flex min-w-0 items-center justify-between gap-2",
|
|
53
|
-
children: [/* @__PURE__ */
|
|
53
|
+
children: [/* @__PURE__ */ C("a", {
|
|
54
54
|
href: e.url,
|
|
55
55
|
target: "_blank",
|
|
56
56
|
rel: "noopener noreferrer",
|
|
57
|
-
className: i(x,
|
|
58
|
-
onClick:
|
|
59
|
-
t.preventDefault(),
|
|
57
|
+
className: i(x, E.link, "min-w-0 flex-1 truncate"),
|
|
58
|
+
onClick: d ? (t) => {
|
|
59
|
+
t.preventDefault(), d(e);
|
|
60
60
|
} : void 0,
|
|
61
|
-
children: s ? /* @__PURE__ */
|
|
61
|
+
children: s ? /* @__PURE__ */ C(m, {
|
|
62
62
|
text: e.title,
|
|
63
63
|
query: s,
|
|
64
64
|
maxLines: 1
|
|
65
65
|
}) : e.title
|
|
66
|
-
}), /* @__PURE__ */
|
|
66
|
+
}), /* @__PURE__ */ C(p, {
|
|
67
67
|
size: f.Small,
|
|
68
|
-
icon: /* @__PURE__ */
|
|
68
|
+
icon: /* @__PURE__ */ C(h, {
|
|
69
69
|
size: u.SM,
|
|
70
70
|
stroke: 1.5,
|
|
71
71
|
"aria-hidden": !0
|
|
@@ -73,13 +73,13 @@ var w = g(({ attachments: t, title: n, searchQuery: r, titleClassName: a = "dial
|
|
|
73
73
|
"aria-label": a,
|
|
74
74
|
onClick: () => void D(e.url)
|
|
75
75
|
})]
|
|
76
|
-
}), e.quote && /* @__PURE__ */
|
|
77
|
-
className: i(
|
|
78
|
-
children: /* @__PURE__ */
|
|
76
|
+
}), e.quote && /* @__PURE__ */ C("div", {
|
|
77
|
+
className: i(S, E.quote, "line-clamp-5 [&>div>*+*]:mt-1"),
|
|
78
|
+
children: /* @__PURE__ */ C(n, { content: e.quote })
|
|
79
79
|
})]
|
|
80
80
|
}, e.url))
|
|
81
81
|
}),
|
|
82
|
-
/* @__PURE__ */
|
|
82
|
+
/* @__PURE__ */ C("span", {
|
|
83
83
|
role: "status",
|
|
84
84
|
"aria-live": "polite",
|
|
85
85
|
className: "sr-only",
|
|
@@ -87,35 +87,35 @@ var w = g(({ attachments: t, title: n, searchQuery: r, titleClassName: a = "dial
|
|
|
87
87
|
})
|
|
88
88
|
]
|
|
89
89
|
});
|
|
90
|
-
}),
|
|
91
|
-
let [M, N] =
|
|
92
|
-
|
|
90
|
+
}), O = (e, t) => e.toLowerCase().includes(t.toLowerCase()), k = _(({ isOpen: e, onClose: n, uploaded: r, generated: i, sources: u, onAttachmentClick: f, onSourceClick: p, onDownloadAll: m, isMobile: h, defaultWidth: _, minWidth: x, maxWidth: E, onResizeStop: k, labels: A, styles: j }) => {
|
|
91
|
+
let [M, N] = b("");
|
|
92
|
+
v(() => {
|
|
93
93
|
e || N("");
|
|
94
94
|
}, [e]);
|
|
95
|
-
let P =
|
|
96
|
-
return /* @__PURE__ */
|
|
95
|
+
let P = y(() => M ? r.filter((e) => O(e.name, M)) : r, [r, M]), F = y(() => M ? i.filter((e) => O(e.name, M)) : i, [i, M]), I = y(() => M ? u.filter((e) => O(e.title, M) || O(e.url, M) || e.quote != null && O(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__ */ w(l, {
|
|
97
97
|
isOpen: e,
|
|
98
98
|
orientation: c.Right,
|
|
99
99
|
styles: {
|
|
100
|
-
className:
|
|
100
|
+
className: h && e ? "w-full" : void 0,
|
|
101
101
|
bodyClassName: "flex flex-col overflow-hidden p-0"
|
|
102
102
|
},
|
|
103
103
|
labels: A,
|
|
104
104
|
onClose: n,
|
|
105
|
-
resizable: !
|
|
106
|
-
defaultWidth:
|
|
107
|
-
minWidth:
|
|
108
|
-
maxWidth:
|
|
105
|
+
resizable: !h,
|
|
106
|
+
defaultWidth: _,
|
|
107
|
+
minWidth: x,
|
|
108
|
+
maxWidth: E,
|
|
109
109
|
onResizeStop: k,
|
|
110
|
-
rightActions: !L && /* @__PURE__ */
|
|
111
|
-
icon: /* @__PURE__ */
|
|
110
|
+
rightActions: !L && /* @__PURE__ */ C(d, {
|
|
111
|
+
icon: /* @__PURE__ */ C(g, { ...t }),
|
|
112
112
|
"aria-label": A.downloadAllLabel,
|
|
113
113
|
tooltipProps: { tooltip: A.downloadAllLabel },
|
|
114
114
|
onClick: m,
|
|
115
115
|
disabled: !m
|
|
116
116
|
}),
|
|
117
117
|
children: [
|
|
118
|
-
!L && /* @__PURE__ */
|
|
118
|
+
!L && /* @__PURE__ */ C(s, {
|
|
119
119
|
value: M,
|
|
120
120
|
onChange: N,
|
|
121
121
|
labels: {
|
|
@@ -123,16 +123,16 @@ var w = g(({ attachments: t, title: n, searchQuery: r, titleClassName: a = "dial
|
|
|
123
123
|
clearLabel: A.searchClearLabel
|
|
124
124
|
}
|
|
125
125
|
}),
|
|
126
|
-
/* @__PURE__ */
|
|
126
|
+
/* @__PURE__ */ C("span", {
|
|
127
127
|
role: "status",
|
|
128
128
|
"aria-live": "polite",
|
|
129
129
|
className: "sr-only",
|
|
130
130
|
children: R ? A.noResultsLabel : ""
|
|
131
131
|
}),
|
|
132
|
-
/* @__PURE__ */
|
|
132
|
+
/* @__PURE__ */ C("div", {
|
|
133
133
|
className: "flex-1 overflow-y-auto p-4",
|
|
134
|
-
children: L ? /* @__PURE__ */
|
|
135
|
-
/* @__PURE__ */
|
|
134
|
+
children: L ? /* @__PURE__ */ C(a, { label: A.emptyLabel }) : R ? /* @__PURE__ */ C(o, { label: A.noResultsLabel }) : /* @__PURE__ */ w(S, { children: [
|
|
135
|
+
/* @__PURE__ */ C(T, {
|
|
136
136
|
attachments: P,
|
|
137
137
|
title: A.uploadedSectionTitle,
|
|
138
138
|
searchQuery: M,
|
|
@@ -140,7 +140,7 @@ var w = g(({ attachments: t, title: n, searchQuery: r, titleClassName: a = "dial
|
|
|
140
140
|
onAttachmentClick: f,
|
|
141
141
|
attachmentClickLabel: A.attachmentClickLabel
|
|
142
142
|
}),
|
|
143
|
-
/* @__PURE__ */
|
|
143
|
+
/* @__PURE__ */ C(T, {
|
|
144
144
|
attachments: F,
|
|
145
145
|
title: A.generatedSectionTitle,
|
|
146
146
|
searchQuery: M,
|
|
@@ -148,7 +148,7 @@ var w = g(({ attachments: t, title: n, searchQuery: r, titleClassName: a = "dial
|
|
|
148
148
|
onAttachmentClick: f,
|
|
149
149
|
attachmentClickLabel: A.attachmentClickLabel
|
|
150
150
|
}),
|
|
151
|
-
/* @__PURE__ */
|
|
151
|
+
/* @__PURE__ */ C(D, {
|
|
152
152
|
sources: I,
|
|
153
153
|
title: A.sourcesSectionTitle,
|
|
154
154
|
searchQuery: M,
|
|
@@ -163,4 +163,4 @@ var w = g(({ attachments: t, title: n, searchQuery: r, titleClassName: a = "dial
|
|
|
163
163
|
});
|
|
164
164
|
});
|
|
165
165
|
//#endregion
|
|
166
|
-
export {
|
|
166
|
+
export { k as ConversationSourcesPanel };
|
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.78",
|
|
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.78",
|
|
23
|
+
"@epam/ai-dial-sidebar": "1.1.0-dev.78",
|
|
24
|
+
"@epam/ai-dial-conversation-input": "1.1.0-dev.78",
|
|
25
|
+
"@epam/ai-dial-ui-kit": "^0.13.0-dev.25"
|
|
26
26
|
},
|
|
27
27
|
"repository": {
|
|
28
28
|
"type": "git",
|