@epam/ai-dial-source-panel 0.0.0-dev.0

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.
@@ -0,0 +1,5 @@
1
+ import { ConversationSourcesPanelProps } from '../../models/conversation-sources-panel-props';
2
+ export type { ConversationSourcesPanelLabels, ConversationSourcesPanelProps, ConversationSourcesPanelStyles, } from '../../models/conversation-sources-panel-props';
3
+ declare const _default: import('react').NamedExoticComponent<ConversationSourcesPanelProps>;
4
+ export default _default;
5
+ //# sourceMappingURL=ConversationSourcesPanel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConversationSourcesPanel.d.ts","sourceRoot":"","sources":["../../../src/components/ConversationSourcesPanel/ConversationSourcesPanel.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,+CAA+C,CAAC;AAGnG,YAAY,EACV,8BAA8B,EAC9B,6BAA6B,EAC7B,8BAA8B,GAC/B,MAAM,+CAA+C,CAAC;;AAyIvD,wBAA8C"}
@@ -0,0 +1,17 @@
1
+ import { DisplayAttachment } from '@epam/ai-dial-chat-shared';
2
+ /** Props for the FilesSection component. */
3
+ interface FilesSectionProps {
4
+ /** List of attachments to display. Renders nothing when empty. */
5
+ attachments: DisplayAttachment[];
6
+ /** Heading text rendered above the attachment grid. */
7
+ title: string;
8
+ /** CSS class applied to the section heading. Defaults to `'dial-body-semi-text'`. */
9
+ titleClassName?: string;
10
+ /** Called when the user clicks an attachment card. */
11
+ onAttachmentClick?: (attachment: DisplayAttachment) => void;
12
+ /** Accessible label for the attachment click action, forwarded to `AttachmentCard`. */
13
+ attachmentClickLabel?: string;
14
+ }
15
+ declare const _default: import('react').NamedExoticComponent<FilesSectionProps>;
16
+ export default _default;
17
+ //# sourceMappingURL=FilesSection.d.ts.map
@@ -0,0 +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,UAAU,iBAAiB;IACzB,kEAAkE;IAClE,WAAW,EAAE,iBAAiB,EAAE,CAAC;IACjC,uDAAuD;IACvD,KAAK,EAAE,MAAM,CAAC;IACd,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;;AA2CD,wBAAkC"}
@@ -0,0 +1,20 @@
1
+ import { QuotationSource } from '../../models/quotation-source';
2
+ interface SourcesSectionProps {
3
+ /** Heading text for the sources section. */
4
+ title: string;
5
+ /** List of sources to display. */
6
+ sources: QuotationSource[];
7
+ /** Accessible label for each source's copy-URL button. */
8
+ copyLabel: string;
9
+ /** CSS class applied to the section heading. Defaults to `'dial-body-semi-text'`. */
10
+ titleClassName?: string;
11
+ /** CSS class applied to each source link. Defaults to `'dial-small-text !text-accent-primary'`. */
12
+ linkClassName?: string;
13
+ /** CSS class applied to the quote text. Defaults to `'dial-tiny-text text-secondary'`. */
14
+ quoteClassName?: string;
15
+ /** When provided, called on source link click instead of following the href. */
16
+ onSourceClick?: (source: QuotationSource) => void;
17
+ }
18
+ declare const _default: import('react').NamedExoticComponent<SourcesSectionProps>;
19
+ export default _default;
20
+ //# sourceMappingURL=SourcesSection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SourcesSection.d.ts","sourceRoot":"","sources":["../../../src/components/SourcesSection/SourcesSection.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAErE,UAAU,mBAAmB;IAC3B,4CAA4C;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,kCAAkC;IAClC,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,0DAA0D;IAC1D,SAAS,EAAE,MAAM,CAAC;IAClB,qFAAqF;IACrF,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mGAAmG;IACnG,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,0FAA0F;IAC1F,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gFAAgF;IAChF,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC;CACnD;;AAiED,wBAAoC"}
package/index.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ export { default as ConversationSourcesPanel } from './components/ConversationSourcesPanel/ConversationSourcesPanel';
2
+ export type { ConversationSourcesPanelLabels, ConversationSourcesPanelProps, ConversationSourcesPanelStyles, } from './components/ConversationSourcesPanel/ConversationSourcesPanel';
3
+ export type { QuotationSource } from './models/quotation-source';
4
+ //# sourceMappingURL=index.d.ts.map
package/index.d.ts.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,gEAAgE,CAAC;AACrH,YAAY,EACV,8BAA8B,EAC9B,6BAA6B,EAC7B,8BAA8B,GAC/B,MAAM,gEAAgE,CAAC;AACxE,YAAY,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC"}
package/index.js ADDED
@@ -0,0 +1,125 @@
1
+ import { PanelEmpty as e, PanelNoResults as t, SearchInput as n, SidebarOrientation as r, SidebarPanel as i } from "@epam/ai-dial-sidebar";
2
+ import { DIAL_ICON_SIZE as a, DialGhostIconButton as o, ElementSize as s } from "@epam/ai-dial-ui-kit";
3
+ import { IconCopy as c, IconDownload as l } from "@tabler/icons-react";
4
+ import { memo as u, useLayoutEffect as d, useMemo as f, useState as p } from "react";
5
+ import { AttachmentType as m, mergeClasses as h } from "@epam/ai-dial-chat-shared";
6
+ import { AttachmentCard as g } from "@epam/ai-dial-conversation-input";
7
+ import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
8
+ var b = u(({ attachments: e, title: t, titleClassName: n = "dial-body-semi-text", onAttachmentClick: r, attachmentClickLabel: i }) => e.length === 0 ? null : /* @__PURE__ */ y("section", {
9
+ className: "mb-6",
10
+ children: [/* @__PURE__ */ v("h2", {
11
+ className: h(n, "mb-3"),
12
+ children: t
13
+ }), /* @__PURE__ */ v("div", {
14
+ role: "list",
15
+ className: "grid grid-cols-[repeat(auto-fill,minmax(100px,1fr))] gap-3",
16
+ children: e.map((e) => /* @__PURE__ */ v("div", {
17
+ role: "listitem",
18
+ className: e.type === m.Audio ? "col-span-full" : void 0,
19
+ children: /* @__PURE__ */ v(g, {
20
+ attachment: e,
21
+ className: "w-full",
22
+ onClick: r ? () => r(e) : void 0,
23
+ clickLabel: i
24
+ })
25
+ }, e.id))
26
+ })]
27
+ })), x = u(({ title: e, sources: t, copyLabel: n, titleClassName: r = "dial-body-semi-text", linkClassName: i = "dial-small-text !text-accent-primary", quoteClassName: l = "dial-tiny-text text-secondary", onSourceClick: u }) => t.length === 0 ? null : /* @__PURE__ */ y("section", {
28
+ className: "mb-6",
29
+ children: [/* @__PURE__ */ v("h2", {
30
+ className: h(r, "mb-3"),
31
+ children: e
32
+ }), /* @__PURE__ */ v("ul", {
33
+ className: "flex flex-col gap-3",
34
+ children: t.map((e) => /* @__PURE__ */ y("li", {
35
+ className: "flex flex-col gap-1",
36
+ children: [/* @__PURE__ */ y("div", {
37
+ className: "flex min-w-0 items-center justify-between gap-2",
38
+ children: [/* @__PURE__ */ v("a", {
39
+ href: e.url,
40
+ target: "_blank",
41
+ rel: "noopener noreferrer",
42
+ className: h(i, "min-w-0 flex-1 truncate"),
43
+ onClick: u ? (t) => {
44
+ t.preventDefault(), u(e);
45
+ } : void 0,
46
+ children: e.title
47
+ }), /* @__PURE__ */ v(o, {
48
+ size: s.Small,
49
+ icon: /* @__PURE__ */ v(c, {
50
+ size: a.SM,
51
+ stroke: 1.5
52
+ }),
53
+ "aria-label": n,
54
+ onClick: () => navigator.clipboard.writeText(e.url)
55
+ })]
56
+ }), e.quote && /* @__PURE__ */ v("p", {
57
+ className: h(l, "line-clamp-5 max-h-[80px] overflow-hidden"),
58
+ children: e.quote
59
+ })]
60
+ }, e.url))
61
+ })]
62
+ })), S = (e, t) => e.toLowerCase().includes(t.toLowerCase()), C = u(({ isOpen: s, onClose: c, uploaded: u, generated: m, sources: h, onAttachmentClick: g, onSourceClick: C, isMobile: w, defaultWidth: T, minWidth: E, maxWidth: D, onResizeStop: O, labels: k, styles: A }) => {
63
+ let [j, M] = p("");
64
+ d(() => {
65
+ s || M("");
66
+ }, [s]);
67
+ let N = f(() => j ? u.filter((e) => S(e.name, j)) : u, [u, j]), P = f(() => j ? m.filter((e) => S(e.name, j)) : m, [m, j]), F = f(() => j ? h.filter((e) => S(e.title, j) || S(e.url, j) || e.quote != null && S(e.quote, j)) : h, [h, j]), I = u.length === 0 && m.length === 0 && h.length === 0, L = j !== "" && N.length === 0 && P.length === 0 && F.length === 0;
68
+ return /* @__PURE__ */ y(i, {
69
+ isOpen: s,
70
+ orientation: r.Right,
71
+ className: s ? "mobile:w-full" : "w-0",
72
+ styles: { bodyClassName: "flex flex-col overflow-hidden p-0" },
73
+ ariaLabel: k.ariaLabel,
74
+ closeLabel: k.closeLabel,
75
+ onClose: c,
76
+ resizable: !w,
77
+ defaultWidth: T,
78
+ minWidth: E,
79
+ maxWidth: D,
80
+ onResizeStop: O,
81
+ rightActions: !I && /* @__PURE__ */ v(o, {
82
+ icon: /* @__PURE__ */ v(l, {
83
+ size: a.LG,
84
+ stroke: 1.5
85
+ }),
86
+ "aria-label": k.downloadAllLabel,
87
+ disabled: !0
88
+ }),
89
+ children: [!I && /* @__PURE__ */ v(n, {
90
+ placeholder: k.searchPlaceholder,
91
+ value: j,
92
+ onChange: M,
93
+ clearLabel: k.searchClearLabel
94
+ }), /* @__PURE__ */ v("div", {
95
+ className: "flex-1 overflow-y-auto p-4",
96
+ children: I ? /* @__PURE__ */ v(e, { label: k.emptyLabel }) : L ? /* @__PURE__ */ v(t, { label: k.noResultsLabel }) : /* @__PURE__ */ y(_, { children: [
97
+ /* @__PURE__ */ v(b, {
98
+ attachments: N,
99
+ title: k.uploadedSectionTitle,
100
+ titleClassName: A?.sectionTitleClassName,
101
+ onAttachmentClick: g,
102
+ attachmentClickLabel: k.attachmentClickLabel
103
+ }),
104
+ /* @__PURE__ */ v(b, {
105
+ attachments: P,
106
+ title: k.generatedSectionTitle,
107
+ titleClassName: A?.sectionTitleClassName,
108
+ onAttachmentClick: g,
109
+ attachmentClickLabel: k.attachmentClickLabel
110
+ }),
111
+ /* @__PURE__ */ v(x, {
112
+ sources: F,
113
+ title: k.sourcesSectionTitle,
114
+ titleClassName: A?.sectionTitleClassName,
115
+ linkClassName: A?.sourceLinkClassName,
116
+ quoteClassName: A?.sourceQuoteClassName,
117
+ copyLabel: k.copySourceLabel,
118
+ onSourceClick: C
119
+ })
120
+ ] })
121
+ })]
122
+ });
123
+ });
124
+ //#endregion
125
+ export { C as ConversationSourcesPanel };
@@ -0,0 +1,70 @@
1
+ import { DisplayAttachment } from '@epam/ai-dial-chat-shared';
2
+ import { QuotationSource } from './quotation-source';
3
+ /** User-visible strings passed by the consuming app (via i18n or plain strings). */
4
+ export interface ConversationSourcesPanelLabels {
5
+ /** Accessible name for the sidebar panel element. */
6
+ ariaLabel: string;
7
+ /** Label for the close button. */
8
+ closeLabel: string;
9
+ /** Placeholder text shown inside the search input. */
10
+ searchPlaceholder: string;
11
+ /** Accessible label for the search input clear button. */
12
+ searchClearLabel: string;
13
+ /** Text shown when the panel has no files or sources. */
14
+ emptyLabel: string;
15
+ /** Text shown when a search query matches nothing. */
16
+ noResultsLabel: string;
17
+ /** Accessible label for the download-all icon button. */
18
+ downloadAllLabel: string;
19
+ /** Heading text for the uploaded-files section. */
20
+ uploadedSectionTitle: string;
21
+ /** Heading text for the generated-files section. */
22
+ generatedSectionTitle: string;
23
+ /** Heading text for the sources section. */
24
+ sourcesSectionTitle: string;
25
+ /** Accessible label for each source's copy-URL button. */
26
+ copySourceLabel: string;
27
+ /** Label passed to each attachment card's action button. */
28
+ attachmentClickLabel: string;
29
+ }
30
+ /** Optional typography and color class overrides for inner elements. */
31
+ export interface ConversationSourcesPanelStyles {
32
+ /** CSS class applied to each section heading (`<h2>`). Defaults to `'dial-body-semi-text'`. */
33
+ sectionTitleClassName?: string;
34
+ /** CSS class applied to each source link. Defaults to `'dial-small-text !text-accent-primary'`. */
35
+ sourceLinkClassName?: string;
36
+ /** CSS class applied to each source quote paragraph. Defaults to `'dial-tiny-text text-secondary'`. */
37
+ sourceQuoteClassName?: string;
38
+ }
39
+ /** Props for the ConversationSourcesPanel component. */
40
+ export interface ConversationSourcesPanelProps {
41
+ /** Whether the panel is currently visible. */
42
+ isOpen: boolean;
43
+ /** Called when the user requests to close the panel. */
44
+ onClose: () => void;
45
+ /** Attachments uploaded by the user in this conversation. */
46
+ uploaded: DisplayAttachment[];
47
+ /** Attachments generated by the assistant in this conversation. */
48
+ generated: DisplayAttachment[];
49
+ /** Quotation sources cited by the assistant. */
50
+ sources: QuotationSource[];
51
+ /** Called when the user activates an attachment card. */
52
+ onAttachmentClick?: (attachment: DisplayAttachment) => void;
53
+ /** Called when the user clicks a source link. When omitted, the link navigates normally. */
54
+ onSourceClick?: (source: QuotationSource) => void;
55
+ /** Whether the viewport is in mobile breakpoint (disables resizing). */
56
+ isMobile: boolean;
57
+ /** Initial panel width in pixels. */
58
+ defaultWidth?: number;
59
+ /** Minimum panel width in pixels. */
60
+ minWidth?: number;
61
+ /** Maximum panel width in pixels. */
62
+ maxWidth?: number;
63
+ /** Called with the new width after the user finishes a resize drag. */
64
+ onResizeStop?: (width: number) => void;
65
+ /** User-visible strings (titles, placeholders, aria labels). */
66
+ labels: ConversationSourcesPanelLabels;
67
+ /** Optional typography and color class overrides for inner elements. */
68
+ styles?: ConversationSourcesPanelStyles;
69
+ }
70
+ //# sourceMappingURL=conversation-sources-panel-props.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation-sources-panel-props.d.ts","sourceRoot":"","sources":["../../src/models/conversation-sources-panel-props.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE1D,oFAAoF;AACpF,MAAM,WAAW,8BAA8B;IAC7C,qDAAqD;IACrD,SAAS,EAAE,MAAM,CAAC;IAClB,kCAAkC;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,sDAAsD;IACtD,iBAAiB,EAAE,MAAM,CAAC;IAC1B,0DAA0D;IAC1D,gBAAgB,EAAE,MAAM,CAAC;IACzB,yDAAyD;IACzD,UAAU,EAAE,MAAM,CAAC;IACnB,sDAAsD;IACtD,cAAc,EAAE,MAAM,CAAC;IACvB,yDAAyD;IACzD,gBAAgB,EAAE,MAAM,CAAC;IACzB,mDAAmD;IACnD,oBAAoB,EAAE,MAAM,CAAC;IAC7B,oDAAoD;IACpD,qBAAqB,EAAE,MAAM,CAAC;IAC9B,4CAA4C;IAC5C,mBAAmB,EAAE,MAAM,CAAC;IAC5B,0DAA0D;IAC1D,eAAe,EAAE,MAAM,CAAC;IACxB,4DAA4D;IAC5D,oBAAoB,EAAE,MAAM,CAAC;CAC9B;AAED,wEAAwE;AACxE,MAAM,WAAW,8BAA8B;IAC7C,+FAA+F;IAC/F,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,mGAAmG;IACnG,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,uGAAuG;IACvG,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,wDAAwD;AACxD,MAAM,WAAW,6BAA6B;IAC5C,8CAA8C;IAC9C,MAAM,EAAE,OAAO,CAAC;IAChB,wDAAwD;IACxD,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,6DAA6D;IAC7D,QAAQ,EAAE,iBAAiB,EAAE,CAAC;IAC9B,mEAAmE;IACnE,SAAS,EAAE,iBAAiB,EAAE,CAAC;IAC/B,gDAAgD;IAChD,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,yDAAyD;IACzD,iBAAiB,CAAC,EAAE,CAAC,UAAU,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC5D,4FAA4F;IAC5F,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC;IAClD,wEAAwE;IACxE,QAAQ,EAAE,OAAO,CAAC;IAClB,qCAAqC;IACrC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qCAAqC;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qCAAqC;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uEAAuE;IACvE,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,gEAAgE;IAChE,MAAM,EAAE,8BAA8B,CAAC;IACvC,wEAAwE;IACxE,MAAM,CAAC,EAAE,8BAA8B,CAAC;CACzC"}
@@ -0,0 +1,8 @@
1
+ export interface QuotationSource {
2
+ url: string;
3
+ title: string;
4
+ /** MIME type of the source attachment (e.g. `'application/pdf'`). */
5
+ contentType: string;
6
+ quote?: string;
7
+ }
8
+ //# sourceMappingURL=quotation-source.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quotation-source.d.ts","sourceRoot":"","sources":["../../src/models/quotation-source.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,qEAAqE;IACrE,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
package/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "@epam/ai-dial-source-panel",
3
+ "version": "0.0.0-dev.0",
4
+ "license": "Apache-2.0",
5
+ "type": "module",
6
+ "main": "./index.js",
7
+ "module": "./index.js",
8
+ "types": "./index.d.ts",
9
+ "exports": {
10
+ "./package.json": "./package.json",
11
+ "./styles.css": "./style.css",
12
+ ".": {
13
+ "types": "./index.d.ts",
14
+ "import": "./index.js",
15
+ "default": "./index.js"
16
+ }
17
+ },
18
+ "peerDependencies": {
19
+ "react": "^19.0.0",
20
+ "@tabler/icons-react": "^3.0.0",
21
+ "@epam/ai-dial-chat-shared": "0.0.0-dev.0",
22
+ "@epam/ai-dial-ui-kit": "0.12.0-dev.21",
23
+ "@epam/ai-dial-sidebar": "0.0.0-dev.0",
24
+ "@epam/ai-dial-conversation-input": "0.0.0-dev.0"
25
+ }
26
+ }
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=test-setup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-setup.d.ts","sourceRoot":"","sources":["../src/test-setup.ts"],"names":[],"mappings":""}