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