@epam/ai-dial-source-panel 1.0.0-dev.550 → 1.1.0-dev.11

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