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