@epam/ai-dial-source-panel 1.0.0-rc.4 → 1.0.0-rc.6

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":"AAiBA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,+CAA+C,CAAC;;AA6KnG,wBAA8C"}
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;;AAiLnG,wBAA8C"}
@@ -1 +1 @@
1
- {"version":3,"file":"SourcesSection.d.ts","sourceRoot":"","sources":["../../../src/components/SourcesSection/SourcesSection.tsx"],"names":[],"mappings":"AAYA,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;;AAuGD,wBAAoC"}
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, 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", {
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__ */ x("h2", {
10
+ children: [/* @__PURE__ */ S("h2", {
11
11
  className: r(i, "mb-3"),
12
12
  children: t
13
- }), /* @__PURE__ */ x("div", {
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__ */ x("div", {
16
+ children: e.map((e, t) => /* @__PURE__ */ S("div", {
17
17
  role: "listitem",
18
- children: /* @__PURE__ */ x(y, {
18
+ children: /* @__PURE__ */ S(b, {
19
19
  attachment: e,
20
20
  searchQuery: n,
21
21
  onClick: a ? () => a(e) : void 0,
@@ -23,149 +23,155 @@ var C = h(({ attachments: e, title: t, searchQuery: n, titleClassName: i = "dial
23
23
  })
24
24
  }, `${e.id}-${t}`))
25
25
  })]
26
- })), w = {
26
+ })), T = {
27
27
  link: "_link_viope_1",
28
28
  quote: "_quote_viope_5"
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]);
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 D = async (e) => {
36
- await navigator.clipboard.writeText(e), y(o);
35
+ let O = async (e) => {
36
+ await navigator.clipboard.writeText(e), b(o);
37
37
  };
38
- return /* @__PURE__ */ S("section", {
38
+ return /* @__PURE__ */ C("section", {
39
39
  className: "mb-6",
40
- style: E,
40
+ style: D,
41
41
  children: [
42
- /* @__PURE__ */ x("h2", {
43
- className: r(b, "mb-3"),
42
+ /* @__PURE__ */ S("h2", {
43
+ className: r(x, "mb-3"),
44
44
  children: e
45
45
  }),
46
- /* @__PURE__ */ x("ul", {
46
+ /* @__PURE__ */ S("ul", {
47
47
  className: "flex flex-col gap-3",
48
- children: i.map((e) => /* @__PURE__ */ S("li", {
48
+ children: i.map((e) => /* @__PURE__ */ C("li", {
49
49
  className: "flex flex-col gap-1",
50
- children: [/* @__PURE__ */ S("div", {
50
+ children: [/* @__PURE__ */ C("div", {
51
51
  className: "flex min-w-0 items-center justify-between gap-2",
52
- children: [/* @__PURE__ */ x("a", {
52
+ children: [/* @__PURE__ */ S(f, {
53
53
  href: e.url,
54
54
  target: "_blank",
55
- rel: "noopener noreferrer",
56
- className: r(C, w.link, "min-w-0 flex-1 truncate"),
57
- onClick: h ? (t) => {
58
- t.preventDefault(), h(e);
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: s,
60
+ query: c,
63
61
  maxLines: 1
64
- }) : e.title
65
- }), /* @__PURE__ */ x(d, {
66
- size: u.Small,
67
- icon: /* @__PURE__ */ x(p, {
68
- size: c.SM,
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 D(e.url)
75
+ onClick: () => void O(e.url)
74
76
  })]
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 })
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__ */ x("span", {
83
+ /* @__PURE__ */ S("span", {
82
84
  role: "status",
83
85
  "aria-live": "polite",
84
86
  className: "sr-only",
85
- children: g
87
+ children: _
86
88
  })
87
89
  ]
88
90
  });
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, title: M, additionalSections: N }) => {
90
- let [P, F] = v("");
91
- g(() => {
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 I = _(() => P ? r.filter((e) => E(e.name, P)) : r, [r, P]), L = _(() => P ? c.filter((e) => E(e.name, P)) : c, [c, P]), R = _(() => P ? u.filter((e) => E(e.title, P) || E(e.url, P) || e.quote != null && E(e.quote, P)) : u, [u, P]), z = r.length > 0 || c.length > 0 || u.length > 0, B = !z && !N, V = P !== "" && I.length === 0 && L.length === 0 && R.length === 0, H;
95
- return H = B ? /* @__PURE__ */ x("div", {
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__ */ x(l, { title: A.noDataLabel })
98
- }) : /* @__PURE__ */ S(b, { children: [N, V ? /* @__PURE__ */ x(i, { label: A.noResultsLabel }) : /* @__PURE__ */ S(b, { children: [
99
- /* @__PURE__ */ x(C, {
100
- attachments: I,
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: f,
108
+ onAttachmentClick: d,
105
109
  attachmentClickLabel: A.attachmentClickLabel
106
110
  }),
107
- /* @__PURE__ */ x(C, {
108
- attachments: L,
111
+ /* @__PURE__ */ S(w, {
112
+ attachments: R,
109
113
  title: A.generatedSectionTitle,
110
114
  searchQuery: P,
111
115
  titleClassName: j?.typography?.sectionTitleClassName,
112
- onAttachmentClick: f,
116
+ onAttachmentClick: d,
113
117
  attachmentClickLabel: A.attachmentClickLabel
114
118
  }),
115
- /* @__PURE__ */ x(T, {
116
- sources: R,
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: p
127
+ onSourceClick: f
124
128
  })
125
- ] })] }), /* @__PURE__ */ S(s, {
129
+ ] })] }), /* @__PURE__ */ C(o, {
126
130
  isOpen: t,
127
- orientation: o.Right,
131
+ orientation: a.Right,
128
132
  styles: {
129
- className: y && t ? "w-full" : void 0,
130
- bodyClassName: "flex flex-col overflow-hidden p-0",
131
- headerClassName: "border-b border-tertiary"
133
+ className: g && t ? "w-full" : void 0,
134
+ bodyClassName: "flex flex-col overflow-hidden p-0"
132
135
  },
133
136
  labels: A,
134
137
  title: M,
135
138
  onClose: n,
136
- resizable: !y,
137
- defaultWidth: w,
138
- minWidth: D,
139
+ resizable: !g,
140
+ defaultWidth: b,
141
+ minWidth: T,
139
142
  maxWidth: O,
140
143
  onResizeStop: k,
141
- rightActions: z && /* @__PURE__ */ x(d, {
142
- icon: /* @__PURE__ */ x(m, { ...e }),
144
+ rightActions: B && /* @__PURE__ */ S(u, {
145
+ icon: /* @__PURE__ */ S(h, { ...e }),
143
146
  "aria-label": A.downloadAllLabel,
144
147
  tooltipProps: { tooltip: A.downloadAllLabel },
145
- onClick: h,
146
- disabled: !h
148
+ onClick: m,
149
+ disabled: !m
147
150
  }),
148
151
  children: [
149
- z && /* @__PURE__ */ x(a, {
150
- value: P,
151
- onChange: F,
152
- labels: {
152
+ B && /* @__PURE__ */ S("div", {
153
+ role: "search",
154
+ className: "px-3 py-2",
155
+ children: /* @__PURE__ */ S(p, {
156
+ value: P,
157
+ onChange: I,
153
158
  placeholder: A.searchPlaceholder,
154
- clearLabel: A.searchClearLabel
155
- }
159
+ clearLabel: A.searchClearLabel,
160
+ "aria-label": A.searchPlaceholder
161
+ })
156
162
  }),
157
- /* @__PURE__ */ x("span", {
163
+ /* @__PURE__ */ S("span", {
158
164
  role: "status",
159
165
  "aria-live": "polite",
160
166
  className: "sr-only",
161
- children: V ? A.noResultsLabel : ""
167
+ children: H ? A.noResultsLabel : ""
162
168
  }),
163
- /* @__PURE__ */ x("div", {
169
+ /* @__PURE__ */ S("div", {
164
170
  className: "flex-1 overflow-y-auto p-4",
165
- children: H
171
+ children: U
166
172
  })
167
173
  ]
168
174
  });
169
175
  });
170
176
  //#endregion
171
- export { D as ConversationSourcesPanel };
177
+ 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",
4
+ "version": "1.0.0-rc.6",
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.0.0-rc.4",
23
- "@epam/ai-dial-sidebar": "1.0.0-rc.4",
24
- "@epam/ai-dial-conversation-input": "1.0.0-rc.4",
22
+ "@epam/ai-dial-chat-shared": "1.0.0-rc.6",
23
+ "@epam/ai-dial-sidebar": "1.0.0-rc.6",
24
+ "@epam/ai-dial-conversation-input": "1.0.0-rc.6",
25
25
  "@epam/ai-dial-ui-kit": "^0.13.0-dev.26"
26
26
  },
27
27
  "repository": {