@epam/ai-dial-source-panel 1.1.0-dev.297 → 1.1.0-dev.299
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":"AAcA,OAAO,EAAoC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACzE,OAAO,KAAK,EACV,8BAA8B,EAC9B,kCAAkC,EACnC,MAAM,+CAA+C,CAAC;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAGrE,gDAAgD;AAChD,MAAM,WAAW,mBAAmB;IAClC,4CAA4C;IAC5C,KAAK,EAAE,SAAS,CAAC;IACjB,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;;AA6GD,wBAAoC"}
|
package/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { BASE_LG_ICON_PROPS as e, MarkdownRenderer as t, buildCssVars as n, mergeClasses as r } from "@epam/ai-dial-chat-shared";
|
|
2
2
|
import { PanelNoResults as i, SidebarOrientation as a, SidebarPanel as o } from "@epam/ai-dial-sidebar";
|
|
3
|
-
import { DIAL_ICON_SIZE as s,
|
|
4
|
-
import { IconCopy as
|
|
5
|
-
import { memo as
|
|
6
|
-
import { AttachmentCard as
|
|
7
|
-
import { Fragment as
|
|
8
|
-
var
|
|
3
|
+
import { DIAL_ICON_SIZE as s, DIAL_KIT_ICON_STROKE as c, DialNoDataContent as l, ElementSize as u, GhostIconButton as d, Highlight as f, LinkButton as p, Search 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-attachment-input";
|
|
7
|
+
import { Fragment as S, jsx as C, jsxs as w } from "react/jsx-runtime";
|
|
8
|
+
var T = _(({ attachments: e, title: t, searchQuery: n, titleClassName: i = "dial-body-semi-text", onAttachmentClick: a, attachmentClickLabel: o }) => e.length === 0 ? null : /* @__PURE__ */ w("section", {
|
|
9
9
|
className: "mb-6",
|
|
10
|
-
children: [/* @__PURE__ */
|
|
10
|
+
children: [/* @__PURE__ */ C("h2", {
|
|
11
11
|
className: r(i, "mb-3"),
|
|
12
12
|
children: t
|
|
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: e.map((e, t) => /* @__PURE__ */
|
|
16
|
+
children: e.map((e, t) => /* @__PURE__ */ C("div", {
|
|
17
17
|
role: "listitem",
|
|
18
|
-
children: /* @__PURE__ */
|
|
18
|
+
children: /* @__PURE__ */ C(x, {
|
|
19
19
|
attachment: e,
|
|
20
20
|
searchQuery: n,
|
|
21
21
|
onClick: a ? () => a(e) : void 0,
|
|
@@ -23,100 +23,100 @@ var w = g(({ attachments: e, title: t, searchQuery: n, titleClassName: i = "dial
|
|
|
23
23
|
})
|
|
24
24
|
}, `${e.id}-${t}`))
|
|
25
25
|
})]
|
|
26
|
-
})),
|
|
26
|
+
})), E = {
|
|
27
27
|
link: "_link_viope_1",
|
|
28
28
|
quote: "_quote_viope_5"
|
|
29
|
-
},
|
|
30
|
-
let [
|
|
31
|
-
"--sp-source-link":
|
|
32
|
-
"--sp-source-quote":
|
|
33
|
-
}), [
|
|
29
|
+
}, D = _(({ title: e, sources: i, copyLabel: a, copiedLabel: o = "Link copied to clipboard", searchQuery: l = "", typography: m, colors: g, onSourceClick: _ }) => {
|
|
30
|
+
let [v, x] = b(""), S = m?.sectionTitleClassName ?? "dial-body-semi-text", T = m?.sourceLinkClassName ?? "dial-small-text", D = m?.sourceQuoteClassName ?? "dial-tiny-text", O = y(() => n({
|
|
31
|
+
"--sp-source-link": g?.sourceLink,
|
|
32
|
+
"--sp-source-quote": g?.sourceQuote
|
|
33
|
+
}), [g]);
|
|
34
34
|
if (i.length === 0) return null;
|
|
35
|
-
let
|
|
36
|
-
await navigator.clipboard.writeText(e),
|
|
35
|
+
let k = async (e) => {
|
|
36
|
+
await navigator.clipboard.writeText(e), x(o);
|
|
37
37
|
};
|
|
38
|
-
return /* @__PURE__ */
|
|
38
|
+
return /* @__PURE__ */ w("section", {
|
|
39
39
|
className: "mb-6",
|
|
40
|
-
style:
|
|
40
|
+
style: O,
|
|
41
41
|
children: [
|
|
42
|
-
/* @__PURE__ */
|
|
43
|
-
className: r(
|
|
42
|
+
/* @__PURE__ */ C("h2", {
|
|
43
|
+
className: r(S, "mb-3"),
|
|
44
44
|
children: e
|
|
45
45
|
}),
|
|
46
|
-
/* @__PURE__ */
|
|
46
|
+
/* @__PURE__ */ C("ul", {
|
|
47
47
|
className: "flex flex-col gap-3",
|
|
48
|
-
children: i.map((e) => /* @__PURE__ */
|
|
48
|
+
children: i.map((e) => /* @__PURE__ */ w("li", {
|
|
49
49
|
className: "flex flex-col gap-1",
|
|
50
|
-
children: [/* @__PURE__ */
|
|
50
|
+
children: [/* @__PURE__ */ w("div", {
|
|
51
51
|
className: "flex min-w-0 items-center justify-between gap-2",
|
|
52
|
-
children: [/* @__PURE__ */
|
|
52
|
+
children: [/* @__PURE__ */ C(p, {
|
|
53
53
|
href: e.url,
|
|
54
54
|
target: "_blank",
|
|
55
|
-
size:
|
|
56
|
-
className: r(
|
|
57
|
-
textClassName: r(
|
|
58
|
-
label:
|
|
55
|
+
size: u.Small,
|
|
56
|
+
className: r(E.link, "min-w-0 flex-1 justify-start"),
|
|
57
|
+
textClassName: r(T, "min-w-0 truncate"),
|
|
58
|
+
label: l ? /* @__PURE__ */ C(f, {
|
|
59
59
|
text: e.title,
|
|
60
|
-
query:
|
|
60
|
+
query: l,
|
|
61
61
|
maxLines: 1
|
|
62
62
|
}) : e.title,
|
|
63
63
|
"aria-label": e.title,
|
|
64
|
-
onClick:
|
|
65
|
-
t.preventDefault(),
|
|
64
|
+
onClick: _ ? (t) => {
|
|
65
|
+
t.preventDefault(), _(e);
|
|
66
66
|
} : void 0
|
|
67
|
-
}), /* @__PURE__ */
|
|
68
|
-
size:
|
|
69
|
-
icon: /* @__PURE__ */
|
|
67
|
+
}), /* @__PURE__ */ C(d, {
|
|
68
|
+
size: u.Small,
|
|
69
|
+
icon: /* @__PURE__ */ C(h, {
|
|
70
70
|
size: s.SM,
|
|
71
|
-
stroke:
|
|
71
|
+
stroke: c,
|
|
72
72
|
"aria-hidden": !0
|
|
73
73
|
}),
|
|
74
74
|
"aria-label": a,
|
|
75
|
-
onClick: () => void
|
|
75
|
+
onClick: () => void k(e.url)
|
|
76
76
|
})]
|
|
77
|
-
}), e.quote && /* @__PURE__ */
|
|
78
|
-
className: r(
|
|
79
|
-
children: /* @__PURE__ */
|
|
77
|
+
}), e.quote && /* @__PURE__ */ C("div", {
|
|
78
|
+
className: r(D, E.quote, "line-clamp-5 [&>div>*+*]:mt-1"),
|
|
79
|
+
children: /* @__PURE__ */ C(t, { content: e.quote })
|
|
80
80
|
})]
|
|
81
81
|
}, e.url))
|
|
82
82
|
}),
|
|
83
|
-
/* @__PURE__ */
|
|
83
|
+
/* @__PURE__ */ C("span", {
|
|
84
84
|
role: "status",
|
|
85
85
|
"aria-live": "polite",
|
|
86
86
|
className: "sr-only",
|
|
87
|
-
children:
|
|
87
|
+
children: v
|
|
88
88
|
})
|
|
89
89
|
]
|
|
90
90
|
});
|
|
91
|
-
}),
|
|
92
|
-
let [P, F] =
|
|
91
|
+
}), O = (e, t) => e.toLowerCase().includes(t.toLowerCase()), k = _(({ isOpen: t, onClose: n, uploaded: r, generated: s, sources: c, onAttachmentClick: u, onSourceClick: f, onDownloadAll: p, isMobile: h, defaultWidth: _, minWidth: x, maxWidth: E, onResizeStop: k, labels: A, styles: j, title: M, additionalSections: N }) => {
|
|
92
|
+
let [P, F] = b(""), I = (e) => {
|
|
93
93
|
F(e ?? "");
|
|
94
94
|
};
|
|
95
|
-
|
|
95
|
+
v(() => {
|
|
96
96
|
t || F("");
|
|
97
97
|
}, [t]);
|
|
98
|
-
let L =
|
|
99
|
-
return U = V ? /* @__PURE__ */
|
|
98
|
+
let L = y(() => P ? r.filter((e) => O(e.name, P)) : r, [r, P]), R = y(() => P ? s.filter((e) => O(e.name, P)) : s, [s, P]), z = y(() => P ? c.filter((e) => O(e.title, P) || O(e.url, P) || e.quote != null && O(e.quote, P)) : c, [c, P]), B = r.length > 0 || s.length > 0 || c.length > 0, V = !B && !N, H = P !== "" && L.length === 0 && R.length === 0 && z.length === 0, U;
|
|
99
|
+
return U = V ? /* @__PURE__ */ C("div", {
|
|
100
100
|
className: "flex h-full items-center justify-center",
|
|
101
|
-
children: /* @__PURE__ */
|
|
102
|
-
}) : /* @__PURE__ */
|
|
103
|
-
/* @__PURE__ */
|
|
101
|
+
children: /* @__PURE__ */ C(l, { title: A.noDataLabel })
|
|
102
|
+
}) : /* @__PURE__ */ w(S, { children: [N, H ? /* @__PURE__ */ C(i, { label: A.noResultsLabel }) : /* @__PURE__ */ w(S, { children: [
|
|
103
|
+
/* @__PURE__ */ C(T, {
|
|
104
104
|
attachments: L,
|
|
105
105
|
title: A.uploadedSectionTitle,
|
|
106
106
|
searchQuery: P,
|
|
107
107
|
titleClassName: j?.typography?.sectionTitleClassName,
|
|
108
|
-
onAttachmentClick:
|
|
108
|
+
onAttachmentClick: u,
|
|
109
109
|
attachmentClickLabel: A.attachmentClickLabel
|
|
110
110
|
}),
|
|
111
|
-
/* @__PURE__ */
|
|
111
|
+
/* @__PURE__ */ C(T, {
|
|
112
112
|
attachments: R,
|
|
113
113
|
title: A.generatedSectionTitle,
|
|
114
114
|
searchQuery: P,
|
|
115
115
|
titleClassName: j?.typography?.sectionTitleClassName,
|
|
116
|
-
onAttachmentClick:
|
|
116
|
+
onAttachmentClick: u,
|
|
117
117
|
attachmentClickLabel: A.attachmentClickLabel
|
|
118
118
|
}),
|
|
119
|
-
/* @__PURE__ */
|
|
119
|
+
/* @__PURE__ */ C(D, {
|
|
120
120
|
sources: z,
|
|
121
121
|
title: A.sourcesSectionTitle,
|
|
122
122
|
searchQuery: P,
|
|
@@ -126,33 +126,33 @@ var w = g(({ attachments: e, title: t, searchQuery: n, titleClassName: i = "dial
|
|
|
126
126
|
copiedLabel: A.sourceCopiedLabel,
|
|
127
127
|
onSourceClick: f
|
|
128
128
|
})
|
|
129
|
-
] })] }), /* @__PURE__ */
|
|
129
|
+
] })] }), /* @__PURE__ */ w(o, {
|
|
130
130
|
isOpen: t,
|
|
131
131
|
orientation: a.Right,
|
|
132
132
|
styles: {
|
|
133
|
-
className:
|
|
133
|
+
className: h && t ? "w-full" : void 0,
|
|
134
134
|
bodyClassName: "flex flex-col overflow-hidden p-0"
|
|
135
135
|
},
|
|
136
136
|
labels: A,
|
|
137
137
|
title: M,
|
|
138
138
|
onClose: n,
|
|
139
|
-
resizable: !
|
|
140
|
-
defaultWidth:
|
|
141
|
-
minWidth:
|
|
142
|
-
maxWidth:
|
|
139
|
+
resizable: !h,
|
|
140
|
+
defaultWidth: _,
|
|
141
|
+
minWidth: x,
|
|
142
|
+
maxWidth: E,
|
|
143
143
|
onResizeStop: k,
|
|
144
|
-
rightActions: B && /* @__PURE__ */
|
|
145
|
-
icon: /* @__PURE__ */
|
|
144
|
+
rightActions: B && /* @__PURE__ */ C(d, {
|
|
145
|
+
icon: /* @__PURE__ */ C(g, { ...e }),
|
|
146
146
|
"aria-label": A.downloadAllLabel,
|
|
147
147
|
tooltipProps: { tooltip: A.downloadAllLabel },
|
|
148
|
-
onClick:
|
|
149
|
-
disabled: !
|
|
148
|
+
onClick: p,
|
|
149
|
+
disabled: !p
|
|
150
150
|
}),
|
|
151
151
|
children: [
|
|
152
|
-
B && /* @__PURE__ */
|
|
152
|
+
B && /* @__PURE__ */ C("div", {
|
|
153
153
|
role: "search",
|
|
154
154
|
className: "px-3 py-2",
|
|
155
|
-
children: /* @__PURE__ */
|
|
155
|
+
children: /* @__PURE__ */ C(m, {
|
|
156
156
|
value: P,
|
|
157
157
|
onChange: I,
|
|
158
158
|
placeholder: A.searchPlaceholder,
|
|
@@ -160,13 +160,13 @@ var w = g(({ attachments: e, title: t, searchQuery: n, titleClassName: i = "dial
|
|
|
160
160
|
"aria-label": A.searchPlaceholder
|
|
161
161
|
})
|
|
162
162
|
}),
|
|
163
|
-
/* @__PURE__ */
|
|
163
|
+
/* @__PURE__ */ C("span", {
|
|
164
164
|
role: "status",
|
|
165
165
|
"aria-live": "polite",
|
|
166
166
|
className: "sr-only",
|
|
167
167
|
children: H ? A.noResultsLabel : ""
|
|
168
168
|
}),
|
|
169
|
-
/* @__PURE__ */
|
|
169
|
+
/* @__PURE__ */ C("div", {
|
|
170
170
|
className: "flex-1 overflow-y-auto p-4 pt-0",
|
|
171
171
|
children: U
|
|
172
172
|
})
|
|
@@ -174,4 +174,4 @@ var w = g(({ attachments: e, title: t, searchQuery: n, titleClassName: i = "dial
|
|
|
174
174
|
});
|
|
175
175
|
});
|
|
176
176
|
//#endregion
|
|
177
|
-
export {
|
|
177
|
+
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.299",
|
|
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-attachment-input": "1.1.0-dev.
|
|
23
|
-
"@epam/ai-dial-chat-shared": "1.1.0-dev.
|
|
24
|
-
"@epam/ai-dial-sidebar": "1.1.0-dev.
|
|
22
|
+
"@epam/ai-dial-attachment-input": "1.1.0-dev.299",
|
|
23
|
+
"@epam/ai-dial-chat-shared": "1.1.0-dev.299",
|
|
24
|
+
"@epam/ai-dial-sidebar": "1.1.0-dev.299",
|
|
25
25
|
"@epam/ai-dial-ui-kit": "*"
|
|
26
26
|
},
|
|
27
27
|
"repository": {
|