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