@epam/ai-dial-chat-shared 1.2.0-dev.20 → 1.2.0-dev.201
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.
- package/components/MarkdownRenderer/CodeBlock/CodeBlock.js +64 -63
- package/components/MarkdownRenderer/CodeBlock/CodeBlock.module.scss.js +6 -6
- package/components/MarkdownRenderer/MDMessageViewer.js +23 -17
- package/components/MarkdownRenderer/MarkdownRenderer.js +88 -90
- package/components/MarkdownRenderer/Math/MarkdownMathBlock.js +19 -18
- package/components/MarkdownRenderer/PlainTextRenderer.js +21 -0
- package/components/MarkdownRenderer/Table/MarkdownTable.js +71 -56
- package/components/MarkdownRenderer/Table/MarkdownTable.module.scss.js +11 -11
- package/components/MarkdownRenderer/Table/TableHeader.js +18 -21
- package/components/MarkdownRenderer/Table/table-serialization.js +23 -3
- package/components/MarkdownRenderer/Table/useMarkdownTableActions/useMarkdownTableActions.js +48 -62
- package/components/MarkdownRenderer/ThinkingShimmer.js +14 -0
- package/components/TextRefinementField/TextRefinementField.js +86 -0
- package/constants/dial.js +2 -2
- package/constants/mime-types.js +49 -2
- package/constants/public-class-names.js +10 -0
- package/constants/resizable-fields.js +2 -2
- package/file-manager/DialFileManagerShell/DialFileManagerShell.js +247 -236
- package/file-manager/FileManagerAttachModal/FileManagerAttachModal.js +34 -32
- package/file-manager/OperationLoaderModal/OperationLoaderModal.js +17 -20
- package/file-manager/upload-batch.js +2 -2
- package/file-manager/upload-queue.js +17 -0
- package/file-manager.d.ts +31 -18
- package/file-manager.js +4 -3
- package/hooks/useTextRefinement.js +66 -0
- package/index.css +2 -2
- package/index.d.ts +322 -39
- package/index.js +60 -56
- package/markdown.d.ts +61 -8
- package/markdown.js +13 -11
- package/package.json +3 -3
- package/types/attachment.js +1 -1
- package/utils/entity-field-limits.js +4 -0
- package/utils/file-download.js +6 -6
- package/utils/is-skill-selection-unsupported.js +4 -0
- package/utils/latex.js +5 -3
- package/utils/merge-class.js +5 -4
- package/utils/mime-type.js +10 -6
- package/file-manager/UploadProgressModal/UploadProgressModal.js +0 -56
|
@@ -1,77 +1,92 @@
|
|
|
1
1
|
import { mergeClasses as e } from "../../../utils/merge-class.js";
|
|
2
2
|
import { buildCssVars as t } from "../../../utils/build-css-vars.js";
|
|
3
|
-
import {
|
|
3
|
+
import { copyMarkdownAsRichText as n } from "../../../utils/copy-to-clipboard.js";
|
|
4
4
|
import { downloadTextFile as r } from "../../../utils/file-download.js";
|
|
5
|
-
import {
|
|
5
|
+
import { CHAT_SHARED_CLASS as i } from "../../../constants/public-class-names.js";
|
|
6
6
|
import { useHorizontalOverflow as a } from "../../../hooks/useHorizontalOverflow.js";
|
|
7
7
|
import o from "./MarkdownTable.module.scss.js";
|
|
8
8
|
import { MARKDOWN_TABLE_CSV_MIME_TYPE as s, MarkdownTableCopyFormat as c, serializeMarkdownTableRows as l } from "./table-serialization.js";
|
|
9
9
|
import { useMarkdownTableActions as u } from "./useMarkdownTableActions/useMarkdownTableActions.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import { ElementSize as d, GhostIconButton as f } from "@epam/ai-dial-ui-kit";
|
|
11
|
+
import { memo as p, useCallback as m, useEffect as h, useRef as g, useState as _ } from "react";
|
|
12
|
+
import { jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
12
13
|
//#region src/components/MarkdownRenderer/Table/MarkdownTable.tsx
|
|
13
|
-
var
|
|
14
|
-
let [
|
|
15
|
-
"--cm-markdown-border":
|
|
16
|
-
"--cm-table-scrollbar":
|
|
17
|
-
"--cm-table-fade":
|
|
18
|
-
"--cm-table-row-divider":
|
|
19
|
-
"--cm-table-row-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
O.current != null && clearTimeout(O.current);
|
|
14
|
+
var b = 2e3, x = p(({ children: p, classNames: x, colors: S, actionLabels: C, downloadFilename: w, isStreaming: T, onOpenInCanvas: E, scrollRegionAriaLabel: D = "Scrollable table" }) => {
|
|
15
|
+
let [O, k] = _(!1), A = g(null), { scrollContainerRef: j, contentRef: M, hasContentBeyondStart: N, hasContentBeyondEnd: P, handleScroll: F } = a(), I = t({
|
|
16
|
+
"--cm-markdown-border": S?.border,
|
|
17
|
+
"--cm-table-scrollbar": S?.scrollbar,
|
|
18
|
+
"--cm-table-fade": S?.fade,
|
|
19
|
+
"--cm-table-row-divider": S?.rowDivider,
|
|
20
|
+
"--cm-table-row-hover-bg": S?.rowHoverBackground
|
|
21
|
+
}), L = N || P;
|
|
22
|
+
h(() => () => {
|
|
23
|
+
A.current != null && clearTimeout(A.current);
|
|
24
24
|
}, []);
|
|
25
|
-
let
|
|
26
|
-
let
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
},
|
|
25
|
+
let R = m(() => {
|
|
26
|
+
let e = M.current;
|
|
27
|
+
e != null && n(l(Array.from(e.rows), c.Markdown)).then((e) => {
|
|
28
|
+
e && (A.current != null && clearTimeout(A.current), k(!0), A.current = setTimeout(() => {
|
|
29
|
+
k(!1);
|
|
30
|
+
}, b));
|
|
31
31
|
});
|
|
32
|
-
}, [
|
|
33
|
-
let e =
|
|
34
|
-
e != null && r(`\uFEFF${l(Array.from(e.rows), c.Csv)}`,
|
|
35
|
-
}, [
|
|
36
|
-
let e =
|
|
37
|
-
e == null ||
|
|
38
|
-
}, [
|
|
39
|
-
actionLabels:
|
|
40
|
-
|
|
41
|
-
onCopy:
|
|
42
|
-
onDownloadCsv:
|
|
43
|
-
onOpenInCanvas:
|
|
44
|
-
}),
|
|
45
|
-
return /* @__PURE__ */
|
|
46
|
-
style:
|
|
47
|
-
className: e("relative w-full min-w-0 max-w-full
|
|
32
|
+
}, [M]), z = m(() => {
|
|
33
|
+
let e = M.current;
|
|
34
|
+
e != null && r(`\uFEFF${l(Array.from(e.rows), c.Csv)}`, w ?? "table.csv", s);
|
|
35
|
+
}, [M, w]), B = m(() => {
|
|
36
|
+
let e = M.current;
|
|
37
|
+
e == null || E == null || E(l(Array.from(e.rows), c.Markdown));
|
|
38
|
+
}, [M, E]), V = u({
|
|
39
|
+
actionLabels: C,
|
|
40
|
+
isCopied: O,
|
|
41
|
+
onCopy: R,
|
|
42
|
+
onDownloadCsv: z,
|
|
43
|
+
onOpenInCanvas: E == null ? void 0 : B
|
|
44
|
+
}), H = V.length > 0 && !T;
|
|
45
|
+
return /* @__PURE__ */ y("div", {
|
|
46
|
+
style: I,
|
|
47
|
+
className: e("group/table relative w-full min-w-0 max-w-full rounded-xl border [overflow:clip]", o.tableContainer, x.tableWrapper, i.table),
|
|
48
48
|
children: [
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
className: e("w-max min-w-full border-collapse", y.tableFont ?? "dial-small-text"),
|
|
64
|
-
children: d
|
|
49
|
+
H && /* @__PURE__ */ v("div", {
|
|
50
|
+
className: "sticky top-0 z-10 h-0",
|
|
51
|
+
children: /* @__PURE__ */ v("div", {
|
|
52
|
+
className: "absolute end-2 top-2 flex items-center gap-1 rounded-lg border border-tertiary bg-layer-raised px-2 py-1 opacity-0 shadow-xs transition-opacity focus-within:opacity-100 group-hover/table:opacity-100",
|
|
53
|
+
children: V.map((e) => /* @__PURE__ */ v(f, {
|
|
54
|
+
tooltipProps: { tooltip: e.label },
|
|
55
|
+
"aria-label": e.label,
|
|
56
|
+
icon: /* @__PURE__ */ v("span", {
|
|
57
|
+
"aria-hidden": !0,
|
|
58
|
+
children: e.icon
|
|
59
|
+
}),
|
|
60
|
+
size: d.Small,
|
|
61
|
+
onClick: e.onClick
|
|
62
|
+
}, e.label))
|
|
65
63
|
})
|
|
66
64
|
}),
|
|
67
|
-
|
|
65
|
+
/* @__PURE__ */ v("div", {
|
|
66
|
+
ref: j,
|
|
67
|
+
className: e("w-full min-w-0 max-w-full overflow-x-auto", o.scrollContainer, x.tableScrollContainer, {
|
|
68
|
+
[o.tableScrollFadeBoth]: N && P,
|
|
69
|
+
[o.tableScrollFadeStart]: N && !P,
|
|
70
|
+
[o.tableScrollFadeEnd]: !N && P
|
|
71
|
+
}, i.tableScroll),
|
|
72
|
+
onScroll: F,
|
|
73
|
+
role: L ? "region" : void 0,
|
|
74
|
+
"aria-label": L ? D : void 0,
|
|
75
|
+
tabIndex: L ? 0 : void 0,
|
|
76
|
+
children: /* @__PURE__ */ v("table", {
|
|
77
|
+
ref: M,
|
|
78
|
+
className: e("w-max min-w-full border-collapse", x.tableFont ?? "dial-small-text"),
|
|
79
|
+
children: p
|
|
80
|
+
})
|
|
81
|
+
}),
|
|
82
|
+
C?.copyLabel && /* @__PURE__ */ v("span", {
|
|
68
83
|
"aria-live": "polite",
|
|
69
84
|
className: "sr-only",
|
|
70
85
|
role: "status",
|
|
71
|
-
children:
|
|
86
|
+
children: O ? C.copiedLabel ?? "" : ""
|
|
72
87
|
})
|
|
73
88
|
]
|
|
74
89
|
});
|
|
75
90
|
});
|
|
76
91
|
//#endregion
|
|
77
|
-
export {
|
|
92
|
+
export { x as MarkdownTable };
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
var e = {
|
|
2
|
-
tableContainer: "
|
|
3
|
-
tableContainerLight: "
|
|
4
|
-
copiedIcon: "
|
|
5
|
-
scrollContainer: "
|
|
6
|
-
tableHeaderCell: "
|
|
7
|
-
sectionRow: "
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
tableScrollFadeEnd: "
|
|
11
|
-
tableScrollFadeStart: "
|
|
12
|
-
tableScrollFadeBoth: "
|
|
2
|
+
tableContainer: "_tableContainer_1fwnj_1",
|
|
3
|
+
tableContainerLight: "_tableContainerLight_1fwnj_6",
|
|
4
|
+
copiedIcon: "_copiedIcon_1fwnj_10",
|
|
5
|
+
scrollContainer: "_scrollContainer_1fwnj_14",
|
|
6
|
+
tableHeaderCell: "_tableHeaderCell_1fwnj_30",
|
|
7
|
+
sectionRow: "_sectionRow_1fwnj_37",
|
|
8
|
+
rowDivider: "_rowDivider_1fwnj_41",
|
|
9
|
+
row: "_row_1fwnj_41",
|
|
10
|
+
tableScrollFadeEnd: "_tableScrollFadeEnd_1fwnj_51",
|
|
11
|
+
tableScrollFadeStart: "_tableScrollFadeStart_1fwnj_59",
|
|
12
|
+
tableScrollFadeBoth: "_tableScrollFadeBoth_1fwnj_67"
|
|
13
13
|
};
|
|
14
14
|
//#endregion
|
|
15
15
|
export { e as default };
|
|
@@ -1,30 +1,27 @@
|
|
|
1
1
|
import { mergeClasses as e } from "../../../utils/merge-class.js";
|
|
2
2
|
import t from "./TableHeader.module.scss.js";
|
|
3
|
-
import { ElementSize as n, GhostIconButton as r
|
|
4
|
-
import { jsx as
|
|
3
|
+
import { ElementSize as n, GhostIconButton as r } from "@epam/ai-dial-ui-kit";
|
|
4
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
5
5
|
//#region src/components/MarkdownRenderer/Table/TableHeader.tsx
|
|
6
|
-
var
|
|
7
|
-
className: e("flex min-h-10 items-center gap-2 border-b px-2 py-2", t.tableHeader,
|
|
8
|
-
children: [
|
|
6
|
+
var o = ({ children: o, actions: s, className: c }) => /* @__PURE__ */ a("div", {
|
|
7
|
+
className: e("flex min-h-10 items-center gap-2 border-b px-2 py-2", t.tableHeader, c),
|
|
8
|
+
children: [o != null && /* @__PURE__ */ i("div", {
|
|
9
9
|
className: "min-w-0 flex-1",
|
|
10
|
-
children:
|
|
11
|
-
}),
|
|
10
|
+
children: o
|
|
11
|
+
}), s != null && /* @__PURE__ */ i("div", {
|
|
12
12
|
className: "ms-auto flex items-center gap-1",
|
|
13
|
-
children:
|
|
14
|
-
tooltip: e.label,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"aria-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
size: n.Small,
|
|
24
|
-
onClick: e.onClick
|
|
25
|
-
})
|
|
13
|
+
children: s.map((e) => /* @__PURE__ */ i(r, {
|
|
14
|
+
tooltipProps: { tooltip: e.label },
|
|
15
|
+
"aria-label": e.label,
|
|
16
|
+
icon: /* @__PURE__ */ i("span", {
|
|
17
|
+
"aria-hidden": !0,
|
|
18
|
+
className: "flex items-center",
|
|
19
|
+
children: e.icon
|
|
20
|
+
}),
|
|
21
|
+
size: n.Small,
|
|
22
|
+
onClick: e.onClick
|
|
26
23
|
}, e.label))
|
|
27
24
|
})]
|
|
28
25
|
});
|
|
29
26
|
//#endregion
|
|
30
|
-
export {
|
|
27
|
+
export { o as TableHeader };
|
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
//#region src/components/MarkdownRenderer/Table/table-serialization.ts
|
|
2
2
|
var e = /* @__PURE__ */ function(e) {
|
|
3
|
-
return e.Csv = "csv", e.
|
|
4
|
-
}({}), t = "table.csv", n = "text/csv;charset=utf-8", r =
|
|
3
|
+
return e.Csv = "csv", e.Markdown = "markdown", e;
|
|
4
|
+
}({}), t = "table.csv", n = "text/csv;charset=utf-8", r = ".katex", i = "annotation[encoding=\"application/x-tex\"]", a = (e) => e.querySelector(i)?.textContent?.trim() || null, o = (e) => e.replace(/\\/g, String.raw`\\`).replace(/\|/g, String.raw`\|`), s = (e) => e.replace(/\\\||\|/g, (t, n) => `${t === "|" ? String.raw`\vert` : String.raw`\Vert`}${/^[a-zA-Z]/.test(e.slice(n + t.length)) ? " " : ""}`), c = {
|
|
5
|
+
formatFormula: (e) => `$$${s(e)}$$`,
|
|
6
|
+
escapeText: o
|
|
7
|
+
}, l = {
|
|
8
|
+
formatFormula: (e) => e,
|
|
9
|
+
escapeText: (e) => e
|
|
10
|
+
}, u = (e, t) => {
|
|
11
|
+
let n = document.createTreeWalker(e, NodeFilter.SHOW_TEXT), i = [];
|
|
12
|
+
for (; n.nextNode();) i.push(n.currentNode);
|
|
13
|
+
i.forEach((e) => {
|
|
14
|
+
e.parentElement?.closest(r) ?? (e.data = t(e.data));
|
|
15
|
+
});
|
|
16
|
+
}, d = (e, { formatFormula: t, escapeText: n }) => {
|
|
17
|
+
if (e.querySelector(r) == null) return n(e.textContent?.trim() ?? "");
|
|
18
|
+
let i = e.cloneNode(!0);
|
|
19
|
+
return u(i, n), i.querySelectorAll(r).forEach((e) => {
|
|
20
|
+
if (!i.contains(e)) return;
|
|
21
|
+
let r = a(e);
|
|
22
|
+
e.replaceWith(document.createTextNode(r ? t(r) : n(e.textContent ?? "")));
|
|
23
|
+
}), i.textContent?.trim() ?? "";
|
|
24
|
+
}, f = (e, t) => Array.from(e.cells).map((e) => d(e, t)), p = (e) => f(e, l).map((e) => e ? `"${e.replace(/"/g, "\"\"")}"` : "").join(","), m = (e) => `| ${f(e, c).join(" | ")} |`, h = (e, t) => t === "csv" ? e.map(p).join("\n") : e.map((e, t) => t === 0 ? [m(e), `| ${Array.from(e.cells).map(() => ":--").join(" | ")} |`].join("\n") : m(e)).join("\n");
|
|
5
25
|
//#endregion
|
|
6
|
-
export { t as DEFAULT_MARKDOWN_TABLE_DOWNLOAD_FILENAME, n as MARKDOWN_TABLE_CSV_MIME_TYPE, e as MarkdownTableCopyFormat,
|
|
26
|
+
export { t as DEFAULT_MARKDOWN_TABLE_DOWNLOAD_FILENAME, n as MARKDOWN_TABLE_CSV_MIME_TYPE, e as MarkdownTableCopyFormat, h as serializeMarkdownTableRows };
|
package/components/MarkdownRenderer/Table/useMarkdownTableActions/useMarkdownTableActions.js
CHANGED
|
@@ -1,66 +1,52 @@
|
|
|
1
1
|
import e from "../MarkdownTable.module.scss.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { IconCheck as o, IconCsv as s, IconDownload as c, IconMarkdown as l, IconMaximize as u, IconTxt as d } from "@tabler/icons-react";
|
|
2
|
+
import { DIAL_ICON_SIZE as t, DIAL_KIT_ICON_STROKE as n } from "@epam/ai-dial-ui-kit";
|
|
3
|
+
import { useMemo as r } from "react";
|
|
4
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
5
|
+
import { IconCheck as a, IconCopy as o, IconDownload as s, IconLayoutSidebarRight as c } from "@tabler/icons-react";
|
|
7
6
|
//#region src/components/MarkdownRenderer/Table/useMarkdownTableActions/useMarkdownTableActions.tsx
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
7
|
+
var l = ({ actionLabels: l, isCopied: u, onCopy: d, onDownloadCsv: f, onOpenInCanvas: p }) => {
|
|
8
|
+
let m = l?.copyLabel, h = l?.downloadCsvLabel, g = l?.openInCanvasLabel;
|
|
9
|
+
return r(() => {
|
|
10
|
+
let r = [];
|
|
11
|
+
if (m != null) {
|
|
12
|
+
let s = u ? /* @__PURE__ */ i(a, {
|
|
13
|
+
className: e.copiedIcon,
|
|
14
|
+
size: t.SM,
|
|
15
|
+
stroke: n
|
|
16
|
+
}) : /* @__PURE__ */ i(o, {
|
|
17
|
+
size: t.SM,
|
|
18
|
+
stroke: n
|
|
19
|
+
});
|
|
20
|
+
r.push({
|
|
21
|
+
label: m,
|
|
22
|
+
icon: s,
|
|
23
|
+
onClick: d
|
|
24
|
+
});
|
|
25
25
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
label: f.openInCanvasLabel,
|
|
52
|
-
icon: /* @__PURE__ */ a(u, {
|
|
53
|
-
size: n.SM,
|
|
54
|
-
stroke: r
|
|
55
|
-
}),
|
|
56
|
-
onClick: g
|
|
57
|
-
}), i;
|
|
58
|
-
}, [
|
|
59
|
-
f,
|
|
60
|
-
p,
|
|
61
|
-
m,
|
|
62
|
-
h,
|
|
63
|
-
g
|
|
64
|
-
]);
|
|
26
|
+
return h != null && r.push({
|
|
27
|
+
label: h,
|
|
28
|
+
icon: /* @__PURE__ */ i(s, {
|
|
29
|
+
size: t.SM,
|
|
30
|
+
stroke: n
|
|
31
|
+
}),
|
|
32
|
+
onClick: f
|
|
33
|
+
}), g != null && p != null && r.push({
|
|
34
|
+
label: g,
|
|
35
|
+
icon: /* @__PURE__ */ i(c, {
|
|
36
|
+
size: t.SM,
|
|
37
|
+
stroke: n
|
|
38
|
+
}),
|
|
39
|
+
onClick: p
|
|
40
|
+
}), r;
|
|
41
|
+
}, [
|
|
42
|
+
m,
|
|
43
|
+
h,
|
|
44
|
+
g,
|
|
45
|
+
u,
|
|
46
|
+
d,
|
|
47
|
+
f,
|
|
48
|
+
p
|
|
49
|
+
]);
|
|
50
|
+
};
|
|
65
51
|
//#endregion
|
|
66
|
-
export {
|
|
52
|
+
export { l as useMarkdownTableActions };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { buildCssVars as e } from "../../utils/build-css-vars.js";
|
|
2
|
+
import t from "./MarkdownRenderer.module.scss.js";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/MarkdownRenderer/ThinkingShimmer.tsx
|
|
5
|
+
var r = ({ label: r, colors: i }) => /* @__PURE__ */ n("span", {
|
|
6
|
+
className: t.thinking,
|
|
7
|
+
style: e({
|
|
8
|
+
"--cm-thinking-inverted": i?.thinkingPrimary,
|
|
9
|
+
"--cm-thinking-secondary": i?.thinkingSecondary
|
|
10
|
+
}),
|
|
11
|
+
children: r
|
|
12
|
+
});
|
|
13
|
+
//#endregion
|
|
14
|
+
export { r as ThinkingShimmer };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { mergeClasses as e } from "../../utils/merge-class.js";
|
|
2
|
+
import { TextRefinementState as t } from "../../hooks/useTextRefinement.js";
|
|
3
|
+
import { CaptionText as n, DIAL_ICON_SIZE as r, DIAL_KIT_ICON_STROKE as i, ElementSize as a, ErrorText as o, GhostButton as s, Label as c, Spinner as l } from "@epam/ai-dial-ui-kit";
|
|
4
|
+
import { useRef as u } from "react";
|
|
5
|
+
import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
6
|
+
import { IconSparkles as m } from "@tabler/icons-react";
|
|
7
|
+
//#region src/components/TextRefinementField/TextRefinementField.tsx
|
|
8
|
+
var h = ({ isEnabled: h, fieldId: g, label: _, labelClassName: v, required: y, labels: b, refinement: x, disabled: S, feedbackClassName: C, errorClassName: w, children: T }) => {
|
|
9
|
+
let E = u(null);
|
|
10
|
+
if (!h) return /* @__PURE__ */ f(d, { children: T });
|
|
11
|
+
let D = x.state === t.Error, O = {
|
|
12
|
+
[t.Idle]: "",
|
|
13
|
+
[t.Pending]: b?.refinePendingAriaLabel ?? "Refining text",
|
|
14
|
+
[t.Success]: b?.refineSuccessAriaLabel ?? "Text refined. Undo is available.",
|
|
15
|
+
[t.Restored]: b?.refineUndoAriaLabel ?? "Original text restored.",
|
|
16
|
+
[t.Unchanged]: b?.refineUnchangedAriaLabel ?? "No changes were needed.",
|
|
17
|
+
[t.Error]: ""
|
|
18
|
+
}[x.state];
|
|
19
|
+
return /* @__PURE__ */ p("div", {
|
|
20
|
+
className: "flex min-w-0 flex-col gap-1",
|
|
21
|
+
role: "group",
|
|
22
|
+
"aria-labelledby": g + "-label",
|
|
23
|
+
"aria-describedby": D ? g + "-refinement-error" : void 0,
|
|
24
|
+
children: [
|
|
25
|
+
/* @__PURE__ */ p("div", {
|
|
26
|
+
className: "flex min-w-0 flex-wrap items-center gap-x-3",
|
|
27
|
+
children: [/* @__PURE__ */ f(c, {
|
|
28
|
+
id: g + "-label",
|
|
29
|
+
htmlFor: g,
|
|
30
|
+
className: v,
|
|
31
|
+
label: _,
|
|
32
|
+
required: y
|
|
33
|
+
}), /* @__PURE__ */ p("div", {
|
|
34
|
+
ref: E,
|
|
35
|
+
className: "ms-auto flex min-w-0 flex-wrap items-center",
|
|
36
|
+
children: [/* @__PURE__ */ f(s, {
|
|
37
|
+
size: a.Small,
|
|
38
|
+
label: b?.refineWithAiLabel ?? "Refine with AI",
|
|
39
|
+
disabled: S || !x.canRefine,
|
|
40
|
+
onClick: () => {
|
|
41
|
+
x.refine();
|
|
42
|
+
},
|
|
43
|
+
iconBefore: x.isPending ? /* @__PURE__ */ f("span", {
|
|
44
|
+
"aria-hidden": !0,
|
|
45
|
+
children: /* @__PURE__ */ f(l, {
|
|
46
|
+
size: r.SM,
|
|
47
|
+
ariaLabel: ""
|
|
48
|
+
})
|
|
49
|
+
}) : /* @__PURE__ */ f(m, {
|
|
50
|
+
size: r.SM,
|
|
51
|
+
stroke: i,
|
|
52
|
+
"aria-hidden": !0
|
|
53
|
+
})
|
|
54
|
+
}), x.canUndo && /* @__PURE__ */ f(s, {
|
|
55
|
+
size: a.Small,
|
|
56
|
+
label: b?.refineUndoLabel ?? "Undo",
|
|
57
|
+
disabled: S,
|
|
58
|
+
onClick: () => {
|
|
59
|
+
x.undo(), E.current?.querySelector("button")?.focus();
|
|
60
|
+
}
|
|
61
|
+
})]
|
|
62
|
+
})]
|
|
63
|
+
}),
|
|
64
|
+
/* @__PURE__ */ f("div", {
|
|
65
|
+
"aria-busy": x.isPending,
|
|
66
|
+
children: T
|
|
67
|
+
}),
|
|
68
|
+
/* @__PURE__ */ f("div", {
|
|
69
|
+
role: "status",
|
|
70
|
+
"aria-live": "polite",
|
|
71
|
+
children: /* @__PURE__ */ f(n, {
|
|
72
|
+
text: O,
|
|
73
|
+
className: C
|
|
74
|
+
})
|
|
75
|
+
}),
|
|
76
|
+
D && /* @__PURE__ */ f(o, {
|
|
77
|
+
role: "alert",
|
|
78
|
+
id: g + "-refinement-error",
|
|
79
|
+
className: e(C, w),
|
|
80
|
+
text: b?.refineErrorLabel ?? "Could not refine this text. Please try again."
|
|
81
|
+
})
|
|
82
|
+
]
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
//#endregion
|
|
86
|
+
export { h as TextRefinementField };
|
package/constants/dial.js
CHANGED
package/constants/mime-types.js
CHANGED
|
@@ -31,6 +31,7 @@ var e = {
|
|
|
31
31
|
"application/typescript": "ts",
|
|
32
32
|
"application/xhtml+xml": "xhtml",
|
|
33
33
|
"application/xml": "xml",
|
|
34
|
+
"application/yaml": "yaml",
|
|
34
35
|
"application/vnd.amazon.ebook": "azw",
|
|
35
36
|
"application/vnd.apple.installer+xml": "mpkg",
|
|
36
37
|
"application/vnd.ms-excel": "xls",
|
|
@@ -94,6 +95,52 @@ var e = {
|
|
|
94
95
|
"video/ogg": "ogv",
|
|
95
96
|
"video/webm": "webm",
|
|
96
97
|
"video/x-msvideo": "avi"
|
|
97
|
-
}, t = "*/*", n = "audio/"
|
|
98
|
+
}, t = "*/*", n = "audio/", r = {
|
|
99
|
+
"text/json": "application/json",
|
|
100
|
+
"text/x-json": "application/json",
|
|
101
|
+
"application/x-json": "application/json",
|
|
102
|
+
"text/xml": "application/xml",
|
|
103
|
+
"application/javascript": "text/javascript",
|
|
104
|
+
"application/x-javascript": "text/javascript",
|
|
105
|
+
"application/typescript": "text/typescript",
|
|
106
|
+
"text/x-markdown": "text/markdown",
|
|
107
|
+
"application/markdown": "text/markdown",
|
|
108
|
+
"application/csv": "text/csv",
|
|
109
|
+
"text/x-csv": "text/csv",
|
|
110
|
+
"text/comma-separated-values": "text/csv",
|
|
111
|
+
"text/yaml": "application/yaml",
|
|
112
|
+
"text/x-yaml": "application/yaml",
|
|
113
|
+
"application/x-yaml": "application/yaml",
|
|
114
|
+
"text/sql": "application/sql",
|
|
115
|
+
"text/x-sql": "application/sql",
|
|
116
|
+
"application/php": "text/x-php",
|
|
117
|
+
"application/x-php": "text/x-php",
|
|
118
|
+
"application/x-httpd-php": "text/x-php",
|
|
119
|
+
"application/x-rust": "text/x-rustsrc",
|
|
120
|
+
"application/x-pdf": "application/pdf",
|
|
121
|
+
"application/vnd.ms-word": "application/msword",
|
|
122
|
+
"application/excel": "application/vnd.ms-excel",
|
|
123
|
+
"application/x-excel": "application/vnd.ms-excel",
|
|
124
|
+
"application/x-msexcel": "application/vnd.ms-excel",
|
|
125
|
+
"application/powerpoint": "application/vnd.ms-powerpoint",
|
|
126
|
+
"application/mspowerpoint": "application/vnd.ms-powerpoint",
|
|
127
|
+
"application/x-zip": "application/zip",
|
|
128
|
+
"application/x-zip-compressed": "application/zip",
|
|
129
|
+
"application/x-gzip": "application/gzip",
|
|
130
|
+
"application/x-rar-compressed": "application/vnd.rar",
|
|
131
|
+
"image/jpg": "image/jpeg",
|
|
132
|
+
"image/pjpeg": "image/jpeg",
|
|
133
|
+
"image/x-png": "image/png",
|
|
134
|
+
"image/svg": "image/svg+xml",
|
|
135
|
+
"image/icon": "image/vnd.microsoft.icon",
|
|
136
|
+
"image/x-icon": "image/vnd.microsoft.icon",
|
|
137
|
+
"audio/mp3": "audio/mpeg",
|
|
138
|
+
"audio/mpeg3": "audio/mpeg",
|
|
139
|
+
"audio/x-mpeg-3": "audio/mpeg",
|
|
140
|
+
"audio/wave": "audio/wav",
|
|
141
|
+
"audio/x-wav": "audio/wav",
|
|
142
|
+
"audio/vnd.wave": "audio/wav",
|
|
143
|
+
"audio/x-m4a": "audio/mp4"
|
|
144
|
+
};
|
|
98
145
|
//#endregion
|
|
99
|
-
export { n as MIME_TYPE_AUDIO_PREFIX, e as MIME_TYPE_EXT_MAP, t as MIME_TYPE_WILDCARD };
|
|
146
|
+
export { r as MIME_TYPE_ALIASES, n as MIME_TYPE_AUDIO_PREFIX, e as MIME_TYPE_EXT_MAP, t as MIME_TYPE_WILDCARD };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/constants/public-class-names.ts
|
|
2
|
+
var e = {
|
|
3
|
+
codeBlock: "dial-chat-shared-code-block",
|
|
4
|
+
codeBlockHeader: "dial-chat-shared-code-block-header",
|
|
5
|
+
table: "dial-chat-shared-table",
|
|
6
|
+
tableScroll: "dial-chat-shared-table-scroll",
|
|
7
|
+
mathBlock: "dial-chat-shared-math-block"
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
10
|
+
export { e as CHAT_SHARED_CLASS };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
//#region src/constants/resizable-fields.ts
|
|
2
|
-
var e = "max-h-[50vh]", t = "--resizable-field-max-height", n = "[&_.w-md-editor]:max-h-[var(--resizable-field-max-height,70vh)]";
|
|
2
|
+
var e = "max-h-[50vh]", t = "--resizable-field-max-height", n = "[&_.w-md-editor:not(.w-md-editor-fullscreen)]:max-h-[var(--resizable-field-max-height,70vh)]", r = "[&_.w-md-editor:not(.w-md-editor-fullscreen)]:!h-[var(--resizable-field-max-height,70vh)] [&_.w-md-editor-bar]:hidden";
|
|
3
3
|
//#endregion
|
|
4
|
-
export { n as MARKDOWN_EDITOR_MAX_HEIGHT_CLASS_NAME, t as RESIZABLE_FIELD_MAX_HEIGHT_CSS_VARIABLE, e as RESIZABLE_TEXTAREA_CLASS_NAME };
|
|
4
|
+
export { r as MARKDOWN_EDITOR_FILL_HEIGHT_CLASS_NAME, n as MARKDOWN_EDITOR_MAX_HEIGHT_CLASS_NAME, t as RESIZABLE_FIELD_MAX_HEIGHT_CSS_VARIABLE, e as RESIZABLE_TEXTAREA_CLASS_NAME };
|