@epam/ai-dial-chat-shared 1.1.0-dev.99 → 1.2.0-dev.1
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/CopyButton/CopyButton.js +33 -0
- package/components/DeploymentIcon/DeploymentIcon.js +62 -0
- package/components/DeploymentIcon/DeploymentIcon.module.scss.js +3 -0
- package/components/EntityHeader/EntityHeader.js +48 -0
- package/components/EntityTypeLabel/EntityTypeLabel.js +10 -0
- package/components/FeaturedChip/FeaturedChip.js +18 -0
- package/components/InitialsAvatar/InitialsAvatar.js +29 -0
- package/components/InitialsAvatar/InitialsAvatar.module.scss.js +6 -0
- package/components/ItemHeader/ItemHeader.js +35 -0
- package/components/ItemHeader/ItemHeader.module.scss.js +6 -0
- package/components/MarkdownRenderer/CodeBlock/CodeBlock.js +104 -0
- package/components/MarkdownRenderer/CodeBlock/CodeBlock.module.scss.js +10 -0
- package/components/MarkdownRenderer/CodeBlock/syntax-theme.js +69 -0
- package/components/MarkdownRenderer/MDMessageViewer.js +22 -0
- package/components/MarkdownRenderer/MarkdownRenderer.js +280 -0
- package/components/MarkdownRenderer/MarkdownRenderer.module.scss.js +11 -0
- package/components/MarkdownRenderer/Math/MarkdownMathBlock.js +24 -0
- package/components/MarkdownRenderer/Math/MarkdownMathBlock.module.scss.js +6 -0
- package/components/MarkdownRenderer/Table/MarkdownTable.js +77 -0
- package/components/MarkdownRenderer/Table/MarkdownTable.module.scss.js +15 -0
- package/components/MarkdownRenderer/Table/TableHeader.js +30 -0
- package/components/MarkdownRenderer/Table/TableHeader.module.scss.js +3 -0
- package/components/MarkdownRenderer/Table/table-serialization.js +6 -0
- package/components/MarkdownRenderer/Table/useMarkdownTableActions/useMarkdownTableActions.js +66 -0
- package/components/MarkdownRenderer/TaskCheckbox/MarkdownTaskCheckbox.js +12 -0
- package/components/MarkdownRenderer/markdown-class-names.js +23 -0
- package/components/MarkdownWithPlaceholders/MarkdownWithPlaceholders.js +18 -0
- package/components/PanelEmptyState/PanelEmptyState.js +17 -0
- package/components/PanelEmptyState/PanelEmptyState.module.scss.js +3 -0
- package/components/ResourceSummary/ResourceSummary.js +34 -0
- package/components/ResourceSummary/ResourceSummary.module.scss.js +6 -0
- package/constants/breakpoint.js +4 -0
- package/constants/dial.js +4 -0
- package/constants/entity-colors.js +17 -0
- package/constants/icon.js +13 -0
- package/constants/markdown-editor.js +4 -0
- package/constants/mime-types.js +99 -0
- package/constants/resizable-fields.js +4 -0
- package/constants/select-list.js +4 -0
- package/constants/tag-input.js +4 -0
- package/file-manager/DialFileManagerShell/DialFileManagerShell.js +299 -0
- package/file-manager/FileManagerAttachModal/FileManagerAttachModal.js +108 -0
- package/file-manager/OperationLoaderModal/OperationLoaderModal.js +36 -0
- package/file-manager/UploadProgressModal/UploadProgressModal.js +56 -0
- package/file-manager/file-manager-variant.js +8 -0
- package/file-manager/path.js +7 -0
- package/file-manager/upload-batch.js +6 -0
- package/file-manager/useGridEditingScroll/useGridEditingScroll.js +45 -0
- package/file-manager.d.ts +491 -0
- package/file-manager.js +3 -0
- package/hooks/useAvailableHeightCap.js +36 -0
- package/hooks/useCodeCopy.js +20 -0
- package/hooks/useCollapsedText.js +38 -0
- package/hooks/useHorizontalOverflow.js +25 -0
- package/hooks/useIsMobile.js +13 -0
- package/hooks/useStreamedMarkdownContent.js +32 -0
- package/index.css +1 -1
- package/index.d.ts +2505 -43
- package/index.js +64 -49151
- package/markdown.d.ts +401 -0
- package/markdown.js +11 -0
- package/models/chat.js +14 -0
- package/models/conversation-classification.js +6 -0
- package/models/conversation-transfer.js +14 -0
- package/models/deployment-features.js +6 -0
- package/package.json +43 -12
- package/types/attachment.js +8 -0
- package/types/code-editor.js +6 -0
- package/types/entity-type.js +6 -0
- package/types/mime-type.js +8 -0
- package/utils/annotation.js +120 -0
- package/utils/avatar-color.js +37 -0
- package/utils/build-css-vars.js +8 -0
- package/utils/copy-to-clipboard.js +69 -0
- package/utils/file-download.js +79 -0
- package/utils/format-file-size.js +4 -0
- package/utils/format-last-used.js +20 -0
- package/utils/format-price.js +18 -0
- package/utils/generate-uuid.js +7 -0
- package/utils/initials.js +7 -0
- package/utils/is-audio-transcription-supported.js +5 -0
- package/utils/latex.js +79 -0
- package/utils/merge-class.js +8 -0
- package/utils/message-attachment-to-display.js +31 -0
- package/utils/message.js +5 -0
- package/utils/mime-type.js +73 -0
- package/utils/prompt-variables.js +58 -0
- package/utils/string-utils.js +14 -0
- package/components/CopyButton/CopyButton.d.ts +0 -15
- package/components/CopyButton/CopyButton.d.ts.map +0 -1
- package/components/DeploymentIcon/DeploymentIcon.d.ts +0 -36
- package/components/DeploymentIcon/DeploymentIcon.d.ts.map +0 -1
- package/components/InitialsAvatar/InitialsAvatar.d.ts +0 -13
- package/components/InitialsAvatar/InitialsAvatar.d.ts.map +0 -1
- package/components/MarkdownRenderer/CodeBlock/CodeBlock.d.ts +0 -47
- package/components/MarkdownRenderer/CodeBlock/CodeBlock.d.ts.map +0 -1
- package/components/MarkdownRenderer/CodeBlock/syntax-theme.d.ts +0 -7
- package/components/MarkdownRenderer/CodeBlock/syntax-theme.d.ts.map +0 -1
- package/components/MarkdownRenderer/MDMessageViewer.d.ts +0 -31
- package/components/MarkdownRenderer/MDMessageViewer.d.ts.map +0 -1
- package/components/MarkdownRenderer/MarkdownRenderer.d.ts +0 -105
- package/components/MarkdownRenderer/MarkdownRenderer.d.ts.map +0 -1
- package/components/MarkdownRenderer/Table/MarkdownTable.d.ts +0 -31
- package/components/MarkdownRenderer/Table/MarkdownTable.d.ts.map +0 -1
- package/components/MarkdownRenderer/TaskCheckbox/MarkdownTaskCheckbox.d.ts +0 -9
- package/components/MarkdownRenderer/TaskCheckbox/MarkdownTaskCheckbox.d.ts.map +0 -1
- package/components/MarkdownRenderer/markdown-class-names.d.ts +0 -4
- package/components/MarkdownRenderer/markdown-class-names.d.ts.map +0 -1
- package/components/PanelEmptyState/PanelEmptyState.d.ts +0 -20
- package/components/PanelEmptyState/PanelEmptyState.d.ts.map +0 -1
- package/constants/dial.d.ts +0 -3
- package/constants/dial.d.ts.map +0 -1
- package/constants/icon.d.ts +0 -14
- package/constants/icon.d.ts.map +0 -1
- package/constants/mime-types.d.ts +0 -7
- package/constants/mime-types.d.ts.map +0 -1
- package/hooks/useCodeCopy.d.ts +0 -6
- package/hooks/useCodeCopy.d.ts.map +0 -1
- package/hooks/useCollapsedText.d.ts +0 -27
- package/hooks/useCollapsedText.d.ts.map +0 -1
- package/hooks/useIsMobile.d.ts +0 -3
- package/hooks/useIsMobile.d.ts.map +0 -1
- package/hooks/useStreamedMarkdownContent.d.ts +0 -3
- package/hooks/useStreamedMarkdownContent.d.ts.map +0 -1
- package/hooks/useTableScroll.d.ts +0 -17
- package/hooks/useTableScroll.d.ts.map +0 -1
- package/index.d.ts.map +0 -1
- package/models/annotation.d.ts +0 -78
- package/models/annotation.d.ts.map +0 -1
- package/models/auth.d.ts +0 -26
- package/models/auth.d.ts.map +0 -1
- package/models/chat.d.ts +0 -276
- package/models/chat.d.ts.map +0 -1
- package/models/custom-visualizer.d.ts +0 -61
- package/models/custom-visualizer.d.ts.map +0 -1
- package/models/deployment-configuration.d.ts +0 -55
- package/models/deployment-configuration.d.ts.map +0 -1
- package/models/deployment-features.d.ts +0 -17
- package/models/deployment-features.d.ts.map +0 -1
- package/models/deployment.d.ts +0 -31
- package/models/deployment.d.ts.map +0 -1
- package/models/dial-model.d.ts +0 -19
- package/models/dial-model.d.ts.map +0 -1
- package/models/import-export.d.ts +0 -23
- package/models/import-export.d.ts.map +0 -1
- package/models/theme.d.ts +0 -36
- package/models/theme.d.ts.map +0 -1
- package/models/tool-menu-item.d.ts +0 -13
- package/models/tool-menu-item.d.ts.map +0 -1
- package/types/attachment.d.ts +0 -23
- package/types/attachment.d.ts.map +0 -1
- package/types/code-editor.d.ts +0 -8
- package/types/code-editor.d.ts.map +0 -1
- package/types/mime-type.d.ts +0 -53
- package/types/mime-type.d.ts.map +0 -1
- package/utils/avatar-color.d.ts +0 -10
- package/utils/avatar-color.d.ts.map +0 -1
- package/utils/build-css-vars.d.ts +0 -4
- package/utils/build-css-vars.d.ts.map +0 -1
- package/utils/copy-to-clipboard.d.ts +0 -3
- package/utils/copy-to-clipboard.d.ts.map +0 -1
- package/utils/file-download.d.ts +0 -9
- package/utils/file-download.d.ts.map +0 -1
- package/utils/format-file-size.d.ts +0 -3
- package/utils/format-file-size.d.ts.map +0 -1
- package/utils/format-last-used.d.ts +0 -3
- package/utils/format-last-used.d.ts.map +0 -1
- package/utils/initials.d.ts +0 -3
- package/utils/initials.d.ts.map +0 -1
- package/utils/is-audio-transcription-supported.d.ts +0 -3
- package/utils/is-audio-transcription-supported.d.ts.map +0 -1
- package/utils/latex.d.ts +0 -11
- package/utils/latex.d.ts.map +0 -1
- package/utils/merge-class.d.ts +0 -4
- package/utils/merge-class.d.ts.map +0 -1
- package/utils/message-attachment-to-display.d.ts +0 -22
- package/utils/message-attachment-to-display.d.ts.map +0 -1
- package/utils/message.d.ts +0 -4
- package/utils/message.d.ts.map +0 -1
- package/utils/string-utils.d.ts +0 -5
- package/utils/string-utils.d.ts.map +0 -1
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { DIAL_ICON_SIZE as e, DIAL_KIT_ICON_STROKE as t, ElementSize as n, NeutralButton as r, ToggleIconButton as i } from "@epam/ai-dial-ui-kit";
|
|
2
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
3
|
+
import { IconCheck as o, IconCopy as s } from "@tabler/icons-react";
|
|
4
|
+
//#region src/components/CopyButton/CopyButton.tsx
|
|
5
|
+
var c = ({ onClick: r, isCopied: c, copyLabel: l, copiedLabel: u, size: d = n.Standard, ariaLabel: f, iconSize: p = e.LG, iconCopy: m, isDisabled: h = !1 }) => /* @__PURE__ */ a(i, {
|
|
6
|
+
size: d,
|
|
7
|
+
icon: c ? /* @__PURE__ */ a(o, {
|
|
8
|
+
size: p,
|
|
9
|
+
stroke: t,
|
|
10
|
+
"aria-hidden": !0
|
|
11
|
+
}) : m ?? /* @__PURE__ */ a(s, {
|
|
12
|
+
size: p,
|
|
13
|
+
stroke: t,
|
|
14
|
+
"aria-hidden": !0
|
|
15
|
+
}),
|
|
16
|
+
"aria-label": c ? u : f ?? l,
|
|
17
|
+
tooltipProps: { tooltip: c ? u : l },
|
|
18
|
+
onClick: r,
|
|
19
|
+
disabled: h
|
|
20
|
+
}), l = ({ onClick: i, isCopied: c, copyLabel: l, copiedLabel: u, size: d = n.Standard, isDisabled: f = !1 }) => /* @__PURE__ */ a(r, {
|
|
21
|
+
size: d,
|
|
22
|
+
label: c ? u : l,
|
|
23
|
+
iconBefore: a(c ? o : s, {
|
|
24
|
+
size: e.SM,
|
|
25
|
+
"aria-hidden": !0,
|
|
26
|
+
stroke: t
|
|
27
|
+
}),
|
|
28
|
+
onClick: i,
|
|
29
|
+
disabled: f,
|
|
30
|
+
className: "shrink-0"
|
|
31
|
+
});
|
|
32
|
+
//#endregion
|
|
33
|
+
export { l as CopyButton, c as CopyIconButton };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { mergeClasses as e } from "../../utils/merge-class.js";
|
|
2
|
+
import { buildCssVars as t } from "../../utils/build-css-vars.js";
|
|
3
|
+
import { InitialsAvatar as n } from "../InitialsAvatar/InitialsAvatar.js";
|
|
4
|
+
import r from "./DeploymentIcon.module.scss.js";
|
|
5
|
+
import { Tooltip as i } from "@epam/ai-dial-ui-kit";
|
|
6
|
+
import { useEffect as a, useRef as o, useState as s } from "react";
|
|
7
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/DeploymentIcon/DeploymentIcon.tsx
|
|
9
|
+
var l = ({ src: l, size: u, initialsName: d, fallback: f, labels: p, styles: m }) => {
|
|
10
|
+
let { tooltip: h } = p ?? {}, { badgeClassName: g, colors: _ } = m ?? {}, v = t({ "--di-icon-bg": _?.background }), [y, b] = s(l), [x, S] = s(), C = o(null);
|
|
11
|
+
a(() => {
|
|
12
|
+
if (l === y) return;
|
|
13
|
+
if (l == null) {
|
|
14
|
+
b(void 0);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
let e = !1, t = new Image();
|
|
18
|
+
return t.onload = () => {
|
|
19
|
+
e || b(l);
|
|
20
|
+
}, t.onerror = () => {
|
|
21
|
+
e || (S(l), b(l));
|
|
22
|
+
}, t.src = l, () => {
|
|
23
|
+
e = !0;
|
|
24
|
+
};
|
|
25
|
+
}, [l, y]), a(() => {
|
|
26
|
+
let e = C.current;
|
|
27
|
+
if (!e) return;
|
|
28
|
+
let t = () => S(y);
|
|
29
|
+
return e.addEventListener("error", t), () => e.removeEventListener("error", t);
|
|
30
|
+
}, [y]);
|
|
31
|
+
let w = y != null && x === y, T = /* @__PURE__ */ c(n, {
|
|
32
|
+
name: d,
|
|
33
|
+
size: u,
|
|
34
|
+
className: "shrink-0"
|
|
35
|
+
}), E = /* @__PURE__ */ c("div", {
|
|
36
|
+
style: {
|
|
37
|
+
width: u,
|
|
38
|
+
height: u,
|
|
39
|
+
...v
|
|
40
|
+
},
|
|
41
|
+
className: e(r.agentIconBadge, "shrink-0 overflow-hidden rounded-md", g),
|
|
42
|
+
children: !y || w ? /* @__PURE__ */ c("div", {
|
|
43
|
+
className: "flex size-full items-center justify-center",
|
|
44
|
+
children: f ?? T
|
|
45
|
+
}) : /* @__PURE__ */ c("div", {
|
|
46
|
+
className: "size-full",
|
|
47
|
+
children: /* @__PURE__ */ c("img", {
|
|
48
|
+
ref: C,
|
|
49
|
+
src: y,
|
|
50
|
+
alt: "",
|
|
51
|
+
className: "size-full object-contain"
|
|
52
|
+
})
|
|
53
|
+
})
|
|
54
|
+
});
|
|
55
|
+
return h ? /* @__PURE__ */ c(i, {
|
|
56
|
+
tooltip: h,
|
|
57
|
+
triggerClassName: "flex shrink-0",
|
|
58
|
+
children: E
|
|
59
|
+
}) : E;
|
|
60
|
+
};
|
|
61
|
+
//#endregion
|
|
62
|
+
export { l as DeploymentIcon };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { mergeClasses as e } from "../../utils/merge-class.js";
|
|
2
|
+
import { DeploymentIcon as t } from "../DeploymentIcon/DeploymentIcon.js";
|
|
3
|
+
import { ItemHeader as n } from "../ItemHeader/ItemHeader.js";
|
|
4
|
+
import { EntityTypeLabel as r } from "../EntityTypeLabel/EntityTypeLabel.js";
|
|
5
|
+
import { FeaturedChip as i } from "../FeaturedChip/FeaturedChip.js";
|
|
6
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/EntityHeader/EntityHeader.tsx
|
|
8
|
+
var s = ({ item: s, nameClassName: c, versionClassName: l, showVersion: u = !0, typeClassName: d = "dial-caption-lead-semi-text", iconBadgeClassName: f = "rounded-[14px]", featuredChipClassName: p, featuredChipStyle: m, featuredLabel: h = "Featured", hasFeaturedTag: g = !0, iconSize: _ = 48, query: v, footer: y, statusBadge: b }) => /* @__PURE__ */ o("div", {
|
|
9
|
+
className: "flex items-start gap-2",
|
|
10
|
+
children: [/* @__PURE__ */ a(t, {
|
|
11
|
+
src: s.iconUrl,
|
|
12
|
+
size: _,
|
|
13
|
+
initialsName: s.name,
|
|
14
|
+
styles: { badgeClassName: f }
|
|
15
|
+
}), /* @__PURE__ */ o("div", {
|
|
16
|
+
className: e("flex min-w-0 flex-1 flex-col gap-1", y != null && "self-stretch"),
|
|
17
|
+
children: [
|
|
18
|
+
/* @__PURE__ */ o("div", {
|
|
19
|
+
className: "relative flex flex-row items-center justify-between",
|
|
20
|
+
children: [/* @__PURE__ */ a(r, {
|
|
21
|
+
type: s.type,
|
|
22
|
+
className: d
|
|
23
|
+
}), (b != null || g && s.isFeatured) && /* @__PURE__ */ o("div", {
|
|
24
|
+
className: "absolute end-0 top-[-6px] flex items-center gap-2",
|
|
25
|
+
children: [b, g && s.isFeatured && /* @__PURE__ */ a(i, {
|
|
26
|
+
type: s.type,
|
|
27
|
+
label: h,
|
|
28
|
+
className: p,
|
|
29
|
+
style: m
|
|
30
|
+
})]
|
|
31
|
+
})]
|
|
32
|
+
}),
|
|
33
|
+
/* @__PURE__ */ a(n, {
|
|
34
|
+
title: s.name,
|
|
35
|
+
postfix: u ? s.version : void 0,
|
|
36
|
+
postfixClassName: l,
|
|
37
|
+
titleClassName: c,
|
|
38
|
+
query: v
|
|
39
|
+
}),
|
|
40
|
+
y != null && /* @__PURE__ */ a("div", {
|
|
41
|
+
className: "mt-auto pt-1",
|
|
42
|
+
children: y
|
|
43
|
+
})
|
|
44
|
+
]
|
|
45
|
+
})]
|
|
46
|
+
});
|
|
47
|
+
//#endregion
|
|
48
|
+
export { s as EntityHeader };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ENTITY_TYPE_COLOR as e } from "../../constants/entity-colors.js";
|
|
2
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/EntityTypeLabel/EntityTypeLabel.tsx
|
|
4
|
+
var n = ({ type: n, className: r = "dial-caption-lead-semi-text" }) => /* @__PURE__ */ t("span", {
|
|
5
|
+
className: r,
|
|
6
|
+
style: { color: e[n] },
|
|
7
|
+
children: n
|
|
8
|
+
});
|
|
9
|
+
//#endregion
|
|
10
|
+
export { n as EntityTypeLabel };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { mergeClasses as e } from "../../utils/merge-class.js";
|
|
2
|
+
import { ENTITY_TYPE_BG_COLOR as t, ENTITY_TYPE_COLOR as n } from "../../constants/entity-colors.js";
|
|
3
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/FeaturedChip/FeaturedChip.tsx
|
|
5
|
+
var i = ({ label: i, className: a, type: o, style: s }) => {
|
|
6
|
+
let c = t[o], l = n[o];
|
|
7
|
+
return /* @__PURE__ */ r("div", {
|
|
8
|
+
className: e("h-[24px] gap-1 rounded-2xl border-none px-2", "flex items-center justify-center", a ?? "dial-caption-lead-semi-text"),
|
|
9
|
+
style: {
|
|
10
|
+
backgroundColor: c,
|
|
11
|
+
color: l,
|
|
12
|
+
...s
|
|
13
|
+
},
|
|
14
|
+
children: i
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
//#endregion
|
|
18
|
+
export { i as FeaturedChip };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { mergeClasses as e } from "../../utils/merge-class.js";
|
|
2
|
+
import { buildCssVars as t } from "../../utils/build-css-vars.js";
|
|
3
|
+
import { pickAvatarColor as n } from "../../utils/avatar-color.js";
|
|
4
|
+
import { extractInitials as r } from "../../utils/initials.js";
|
|
5
|
+
import i from "./InitialsAvatar.module.scss.js";
|
|
6
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/InitialsAvatar/InitialsAvatar.tsx
|
|
8
|
+
var o = ({ name: o, size: s, className: c, textClassName: l = "dial-h3-text" }) => {
|
|
9
|
+
let { background: u, foreground: d } = n(o), f = r(o), p = Math.round(s * .4), m = t({
|
|
10
|
+
"--ia-bg": u,
|
|
11
|
+
"--ia-fg": d
|
|
12
|
+
});
|
|
13
|
+
return /* @__PURE__ */ a("div", {
|
|
14
|
+
"aria-hidden": "true",
|
|
15
|
+
className: e("flex select-none items-center justify-center rounded-md", i.badge, c),
|
|
16
|
+
style: {
|
|
17
|
+
...m,
|
|
18
|
+
width: s,
|
|
19
|
+
height: s
|
|
20
|
+
},
|
|
21
|
+
children: /* @__PURE__ */ a("h3", {
|
|
22
|
+
className: e(i.initials, l),
|
|
23
|
+
style: { fontSize: p },
|
|
24
|
+
children: f
|
|
25
|
+
})
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
//#endregion
|
|
29
|
+
export { o as InitialsAvatar };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { mergeClasses as e } from "../../utils/merge-class.js";
|
|
2
|
+
import { buildCssVars as t } from "../../utils/build-css-vars.js";
|
|
3
|
+
import n from "./ItemHeader.module.scss.js";
|
|
4
|
+
import { EllipsisTooltip as r, Highlight as i } from "@epam/ai-dial-ui-kit";
|
|
5
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/ItemHeader/ItemHeader.tsx
|
|
7
|
+
var s = ({ title: s, postfix: c, titleClassName: l = "dial-h3-text", postfixClassName: u = "dial-tiny-text", className: d, query: f, trailing: p, colors: m, shouldTruncateTitle: h = !0 }) => {
|
|
8
|
+
let g = t({
|
|
9
|
+
"--ih-title-color": m?.title,
|
|
10
|
+
"--ih-count-color": m?.count
|
|
11
|
+
});
|
|
12
|
+
return /* @__PURE__ */ o("div", {
|
|
13
|
+
className: e("flex items-center gap-2", d),
|
|
14
|
+
style: g,
|
|
15
|
+
children: [
|
|
16
|
+
/* @__PURE__ */ a("h3", {
|
|
17
|
+
className: e(h ? "min-w-0 shrink" : "shrink-0 whitespace-nowrap", l, n.title),
|
|
18
|
+
children: f ? /* @__PURE__ */ a(i, {
|
|
19
|
+
text: s,
|
|
20
|
+
query: f
|
|
21
|
+
}) : h ? /* @__PURE__ */ a(r, { text: s }) : s
|
|
22
|
+
}),
|
|
23
|
+
c != null && /* @__PURE__ */ a(r, {
|
|
24
|
+
className: e("max-w-[30%] shrink-0", u, n.count),
|
|
25
|
+
text: c
|
|
26
|
+
}),
|
|
27
|
+
p != null && /* @__PURE__ */ a("div", {
|
|
28
|
+
className: "ms-auto",
|
|
29
|
+
children: p
|
|
30
|
+
})
|
|
31
|
+
]
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
//#endregion
|
|
35
|
+
export { s as ItemHeader };
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { CodeBlockTheme as e } from "../../../types/code-editor.js";
|
|
2
|
+
import { mergeClasses as t } from "../../../utils/merge-class.js";
|
|
3
|
+
import { buildCssVars as n } from "../../../utils/build-css-vars.js";
|
|
4
|
+
import { downloadTextFile as r, getFileExtensionForLanguage as i } from "../../../utils/file-download.js";
|
|
5
|
+
import { useCodeCopy as a } from "../../../hooks/useCodeCopy.js";
|
|
6
|
+
import o from "./CodeBlock.module.scss.js";
|
|
7
|
+
import { restrainedSyntaxTheme as s } from "./syntax-theme.js";
|
|
8
|
+
import { DIAL_ICON_SIZE as c, DIAL_KIT_ICON_STROKE as l, ElementSize as u, GhostIconButton as d } from "@epam/ai-dial-ui-kit";
|
|
9
|
+
import { Suspense as f, lazy as p, memo as m } from "react";
|
|
10
|
+
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
11
|
+
import { IconCheck as _, IconCopy as v, IconDownload as y } from "@tabler/icons-react";
|
|
12
|
+
//#region src/components/MarkdownRenderer/CodeBlock/CodeBlock.tsx
|
|
13
|
+
var b = {
|
|
14
|
+
dark: s,
|
|
15
|
+
light: s
|
|
16
|
+
}, x = p(async () => {
|
|
17
|
+
let { Prism: e } = await import("react-syntax-highlighter");
|
|
18
|
+
return { default: e };
|
|
19
|
+
}), S = m(({ language: p, value: m, isStreaming: S, theme: C = e.Dark, copyLabel: w = "Copy code", copiedLabel: T = "Copied!", downloadLabel: E = "Download code", hideDownload: D = !1, containerClassName: O, headerClassName: k, codeClassName: A = "dial-code-text", languageLabelClassName: j = "dial-tiny-lead-semi-text", title: M, titleSlot: N, colors: P }) => {
|
|
20
|
+
let { isCopied: F, copy: I } = a(m), L = C === e.Light, R = () => {
|
|
21
|
+
r(m, `code.${i(p)}`);
|
|
22
|
+
}, z = /* @__PURE__ */ h("pre", {
|
|
23
|
+
className: "p-4",
|
|
24
|
+
children: /* @__PURE__ */ h("code", {
|
|
25
|
+
className: t("whitespace-pre", A),
|
|
26
|
+
children: m
|
|
27
|
+
})
|
|
28
|
+
});
|
|
29
|
+
return /* @__PURE__ */ g("div", {
|
|
30
|
+
style: n({
|
|
31
|
+
"--cm-code-block-bg": P?.background,
|
|
32
|
+
"--cm-code-block-border": P?.border,
|
|
33
|
+
"--cm-code-block-header-bg": P?.headerBackground,
|
|
34
|
+
"--cm-code-block-language": P?.language,
|
|
35
|
+
"--cm-code-block-copied": P?.copied,
|
|
36
|
+
"--cm-code-block-scrollbar": P?.scrollbar
|
|
37
|
+
}),
|
|
38
|
+
className: t("my-4 max-w-full overflow-hidden rounded-xl border", o.container, L && o.containerLight, O),
|
|
39
|
+
children: [
|
|
40
|
+
/* @__PURE__ */ g("div", {
|
|
41
|
+
className: t("flex min-h-10 items-center justify-between border-b px-4", N == null ? "py-2" : "py-0", o.header, k),
|
|
42
|
+
children: [N ?? /* @__PURE__ */ h("span", {
|
|
43
|
+
className: t(o.languageLabel, j),
|
|
44
|
+
children: M ?? p
|
|
45
|
+
}), !S && /* @__PURE__ */ g("div", {
|
|
46
|
+
className: "flex items-center gap-1",
|
|
47
|
+
children: [!D && /* @__PURE__ */ h(d, {
|
|
48
|
+
icon: /* @__PURE__ */ h(y, {
|
|
49
|
+
size: c.SM,
|
|
50
|
+
stroke: l
|
|
51
|
+
}),
|
|
52
|
+
"aria-label": E,
|
|
53
|
+
size: u.Small,
|
|
54
|
+
onClick: R
|
|
55
|
+
}), /* @__PURE__ */ h(d, {
|
|
56
|
+
icon: F ? /* @__PURE__ */ h(_, {
|
|
57
|
+
size: c.SM,
|
|
58
|
+
className: o.copiedIcon,
|
|
59
|
+
"aria-hidden": !0,
|
|
60
|
+
stroke: l
|
|
61
|
+
}) : /* @__PURE__ */ h(v, {
|
|
62
|
+
size: c.SM,
|
|
63
|
+
"aria-hidden": !0,
|
|
64
|
+
stroke: l
|
|
65
|
+
}),
|
|
66
|
+
"aria-label": w,
|
|
67
|
+
size: u.Small,
|
|
68
|
+
onClick: I
|
|
69
|
+
})]
|
|
70
|
+
})]
|
|
71
|
+
}),
|
|
72
|
+
/* @__PURE__ */ h("div", {
|
|
73
|
+
className: t(o.scrollContainer, "max-h-[60vh] overflow-auto"),
|
|
74
|
+
dir: "ltr",
|
|
75
|
+
children: p ? /* @__PURE__ */ h(f, {
|
|
76
|
+
fallback: z,
|
|
77
|
+
children: /* @__PURE__ */ h(x, {
|
|
78
|
+
language: p,
|
|
79
|
+
style: b[C] ?? s,
|
|
80
|
+
customStyle: {
|
|
81
|
+
margin: 0,
|
|
82
|
+
borderRadius: 0,
|
|
83
|
+
background: "transparent",
|
|
84
|
+
fontSize: 14,
|
|
85
|
+
lineHeight: 1.5,
|
|
86
|
+
padding: "14px 16px",
|
|
87
|
+
letterSpacing: 0
|
|
88
|
+
},
|
|
89
|
+
codeTagProps: { className: A },
|
|
90
|
+
children: m
|
|
91
|
+
})
|
|
92
|
+
}) : z
|
|
93
|
+
}),
|
|
94
|
+
/* @__PURE__ */ h("span", {
|
|
95
|
+
role: "status",
|
|
96
|
+
"aria-live": "polite",
|
|
97
|
+
className: "sr-only",
|
|
98
|
+
children: F ? T : ""
|
|
99
|
+
})
|
|
100
|
+
]
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
//#endregion
|
|
104
|
+
export { S as MarkdownCodeBlock };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
var e = {
|
|
2
|
+
container: "_container_spugt_1",
|
|
3
|
+
containerLight: "_containerLight_spugt_6",
|
|
4
|
+
header: "_header_spugt_10",
|
|
5
|
+
languageLabel: "_languageLabel_spugt_15",
|
|
6
|
+
copiedIcon: "_copiedIcon_spugt_19",
|
|
7
|
+
scrollContainer: "_scrollContainer_spugt_23"
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
10
|
+
export { e as default };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
//#region src/components/MarkdownRenderer/CodeBlock/syntax-theme.ts
|
|
2
|
+
var e = { color: "var(--text-secondary, #57647A)" }, t = { color: "var(--text-accent, #1d4ed8)" }, n = { color: "var(--text-accent-tertiary, #7e39ec)" }, r = { color: "var(--text-primary, #161b2d)" }, i = {
|
|
3
|
+
"code[class*=\"language-\"]": {
|
|
4
|
+
color: "var(--text-primary, #161b2d)",
|
|
5
|
+
background: "none",
|
|
6
|
+
textShadow: "none"
|
|
7
|
+
},
|
|
8
|
+
"pre[class*=\"language-\"]": {
|
|
9
|
+
color: "var(--text-primary, #161b2d)",
|
|
10
|
+
background: "none",
|
|
11
|
+
textShadow: "none"
|
|
12
|
+
},
|
|
13
|
+
comment: {
|
|
14
|
+
...e,
|
|
15
|
+
fontStyle: "italic"
|
|
16
|
+
},
|
|
17
|
+
prolog: e,
|
|
18
|
+
cdata: e,
|
|
19
|
+
doctype: e,
|
|
20
|
+
punctuation: e,
|
|
21
|
+
entity: e,
|
|
22
|
+
operator: e,
|
|
23
|
+
"attr-name": e,
|
|
24
|
+
variable: e,
|
|
25
|
+
boolean: e,
|
|
26
|
+
number: e,
|
|
27
|
+
constant: e,
|
|
28
|
+
symbol: e,
|
|
29
|
+
deleted: e,
|
|
30
|
+
tag: e,
|
|
31
|
+
selector: e,
|
|
32
|
+
property: e,
|
|
33
|
+
namespace: e,
|
|
34
|
+
builtin: e,
|
|
35
|
+
keyword: t,
|
|
36
|
+
atrule: t,
|
|
37
|
+
important: {
|
|
38
|
+
...t,
|
|
39
|
+
fontWeight: "bold"
|
|
40
|
+
},
|
|
41
|
+
url: t,
|
|
42
|
+
string: n,
|
|
43
|
+
char: n,
|
|
44
|
+
regex: n,
|
|
45
|
+
"attr-value": n,
|
|
46
|
+
inserted: n,
|
|
47
|
+
"class-name": r,
|
|
48
|
+
function: r,
|
|
49
|
+
bold: {
|
|
50
|
+
...r,
|
|
51
|
+
fontWeight: "bold"
|
|
52
|
+
},
|
|
53
|
+
italic: {
|
|
54
|
+
...r,
|
|
55
|
+
fontStyle: "italic"
|
|
56
|
+
},
|
|
57
|
+
"code.keyword": {
|
|
58
|
+
...n,
|
|
59
|
+
borderRadius: "5px",
|
|
60
|
+
padding: "1px 5px"
|
|
61
|
+
},
|
|
62
|
+
"keyword.code": {
|
|
63
|
+
...n,
|
|
64
|
+
borderRadius: "5px",
|
|
65
|
+
padding: "1px 5px"
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
//#endregion
|
|
69
|
+
export { i as restrainedSyntaxTheme };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { MarkdownRenderer as e } from "./MarkdownRenderer.js";
|
|
2
|
+
import { DEFAULT_MARKDOWN_CLASS_NAMES as t } from "./markdown-class-names.js";
|
|
3
|
+
import { memo as n } from "react";
|
|
4
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/MarkdownRenderer/MDMessageViewer.tsx
|
|
6
|
+
var i = n(({ content: n, isStreaming: i, thinkingLabel: a, components: o, urlTransform: s, codeBlockCopyLabel: c, codeBlockCopiedLabel: l, codeBlockTheme: u, tableActionLabels: d, tableDownloadFilename: f, tableOnOpenInCanvas: p, tableScrollRegionAriaLabel: m, classNames: h = t }) => /* @__PURE__ */ r(e, {
|
|
7
|
+
content: n,
|
|
8
|
+
isStreaming: i,
|
|
9
|
+
thinkingLabel: a,
|
|
10
|
+
components: o,
|
|
11
|
+
urlTransform: s,
|
|
12
|
+
codeBlockCopyLabel: c,
|
|
13
|
+
codeBlockCopiedLabel: l,
|
|
14
|
+
codeBlockTheme: u,
|
|
15
|
+
tableActionLabels: d,
|
|
16
|
+
tableDownloadFilename: f,
|
|
17
|
+
tableOnOpenInCanvas: p,
|
|
18
|
+
tableScrollRegionAriaLabel: m,
|
|
19
|
+
classNames: h
|
|
20
|
+
}));
|
|
21
|
+
//#endregion
|
|
22
|
+
export { i as MDMessageViewer };
|