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