@epam/ai-dial-chat-shared 1.2.0-dev.99 → 1.3.0-dev.5
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/ConfirmationDialog/ConfirmationDialog.js +34 -0
- package/components/ConfirmationIdentityCard/ConfirmationIdentityCard.js +21 -0
- package/components/ConfirmationIdentityCard/ConfirmationIdentityCard.module.scss.js +6 -0
- package/components/ConfirmationIdentityRow/ConfirmationIdentityRow.js +24 -0
- package/components/ConfirmationIdentityRow/ConfirmationIdentityRow.module.scss.js +3 -0
- package/components/ConfirmationView/ConfirmationFooter.js +42 -0
- package/components/ConfirmationView/ConfirmationView.js +39 -0
- package/components/ConfirmationView/ConfirmationView.module.scss.js +7 -0
- package/components/CopyButton/CopyButton.js +5 -5
- package/components/EntityHeader/EntityHeader.js +14 -13
- package/components/EntityTypeLabel/EntityTypeLabel.js +2 -2
- package/components/FeaturedChip/FeaturedChip.js +9 -14
- package/components/InitialsAvatar/InitialsAvatar.js +10 -27
- package/components/MarkdownRenderer/CodeBlock/CodeBlock.js +65 -64
- package/components/MarkdownRenderer/MDMessageViewer.js +25 -17
- package/components/MarkdownRenderer/MarkdownRenderer.js +119 -118
- package/components/MarkdownRenderer/MarkdownRenderer.module.scss.js +7 -7
- package/components/MarkdownRenderer/Math/MarkdownMathBlock.module.scss.js +2 -2
- package/components/MarkdownRenderer/PlainTextRenderer.js +21 -0
- package/components/MarkdownRenderer/Table/MarkdownTable.js +62 -65
- package/components/MarkdownRenderer/Table/MarkdownTable.module.scss.js +11 -11
- package/components/MarkdownRenderer/Table/TableHeader.js +18 -21
- package/components/MarkdownRenderer/ThinkingShimmer.js +14 -0
- package/components/MarkdownWithPlaceholders/MarkdownWithPlaceholders.js +3 -2
- package/components/PanelEmptyState/PanelEmptyState.js +2 -1
- package/components/TextRefinementField/TextRefinementField.js +86 -0
- package/constants/dial.js +2 -2
- package/constants/resizable-fields.js +2 -2
- package/file-manager/DialFileManagerShell/DialFileManagerShell.js +248 -236
- package/file-manager/FileManagerAttachModal/FileManagerAttachModal.js +17 -14
- 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 +25 -14
- package/file-manager.js +4 -3
- package/hooks/useTextRefinement.js +66 -0
- package/hooks/useUnsavedChangesGuard.js +30 -0
- package/index.css +2 -2
- package/index.d.ts +510 -46
- package/index.js +73 -62
- package/markdown.d.ts +64 -8
- package/markdown.js +5 -4
- package/models/chat.js +4 -2
- package/package.json +5 -5
- package/utils/entity-field-limits.js +4 -0
- package/utils/entity-type.js +15 -0
- package/utils/format-price.js +13 -9
- package/utils/is-skill-selection-unsupported.js +4 -0
- package/utils/syntax-highlighting.js +13 -0
- package/components/InitialsAvatar/InitialsAvatar.module.scss.js +0 -6
- package/file-manager/UploadProgressModal/UploadProgressModal.js +0 -50
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ConfirmationView as e } from "../ConfirmationView/ConfirmationView.js";
|
|
2
|
+
import { ConfirmationFooter as t } from "../ConfirmationView/ConfirmationFooter.js";
|
|
3
|
+
import { ConfirmationPopupVariant as n, Popup as r, PopupSize as i } from "@epam/ai-dial-ui-kit";
|
|
4
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/ConfirmationDialog/ConfirmationDialog.tsx
|
|
6
|
+
var o = ({ open: o, title: s, confirmLabel: c, cancelLabel: l, isLoading: u = !1, isConfirmDisabled: d = !1, loadingStatusLabel: f, size: p = i.Sm, popupClassName: m, titleClassName: h, variant: g = n.Info, onConfirm: _, onClose: v, ...y }) => {
|
|
7
|
+
let b = () => {
|
|
8
|
+
u || v();
|
|
9
|
+
};
|
|
10
|
+
return /* @__PURE__ */ a(r, {
|
|
11
|
+
open: o,
|
|
12
|
+
header: s,
|
|
13
|
+
size: p,
|
|
14
|
+
className: m,
|
|
15
|
+
titleClassName: h,
|
|
16
|
+
onClose: b,
|
|
17
|
+
footer: /* @__PURE__ */ a(t, {
|
|
18
|
+
variant: g,
|
|
19
|
+
confirmLabel: c,
|
|
20
|
+
cancelLabel: l,
|
|
21
|
+
isLoading: u,
|
|
22
|
+
isConfirmDisabled: d,
|
|
23
|
+
loadingStatusLabel: f,
|
|
24
|
+
onConfirm: _,
|
|
25
|
+
onCancel: b
|
|
26
|
+
}),
|
|
27
|
+
children: /* @__PURE__ */ a(e, {
|
|
28
|
+
variant: g,
|
|
29
|
+
...y
|
|
30
|
+
})
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
//#endregion
|
|
34
|
+
export { o as ConfirmationDialog };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ResourceSummary as e } from "../ResourceSummary/ResourceSummary.js";
|
|
2
|
+
import t from "./ConfirmationIdentityCard.module.scss.js";
|
|
3
|
+
import { ConfirmationPopupVariant as n } from "@epam/ai-dial-ui-kit";
|
|
4
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/ConfirmationIdentityCard/ConfirmationIdentityCard.tsx
|
|
6
|
+
var i = ({ item: i, children: a, variant: o = n.Info, iconSize: s = 40, styles: c }) => {
|
|
7
|
+
let l = o === n.Danger, u = c?.colors, d = l ? {
|
|
8
|
+
background: u?.dangerBackground,
|
|
9
|
+
border: u?.dangerBorder
|
|
10
|
+
} : { background: u?.background };
|
|
11
|
+
return /* @__PURE__ */ r(e, {
|
|
12
|
+
item: i,
|
|
13
|
+
iconSize: s,
|
|
14
|
+
hasVersionTag: !1,
|
|
15
|
+
className: l ? t.danger : t.info,
|
|
16
|
+
styles: { colors: d },
|
|
17
|
+
children: a
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
//#endregion
|
|
21
|
+
export { i as ConfirmationIdentityCard };
|
|
@@ -0,0 +1,24 @@
|
|
|
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 "./ConfirmationIdentityRow.module.scss.js";
|
|
4
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/ConfirmationIdentityRow/ConfirmationIdentityRow.tsx
|
|
6
|
+
var a = ({ icon: a, typeLabel: o, name: s, styles: c }) => {
|
|
7
|
+
let { colors: l, typeLabelClassName: u = "dial-caption-lead-semi-text", nameClassName: d = "dial-small-semi-text" } = c ?? {};
|
|
8
|
+
return /* @__PURE__ */ i("div", {
|
|
9
|
+
style: t({ "--cir-type-label-text": l?.typeLabelText }),
|
|
10
|
+
className: "flex min-w-0 items-center gap-2",
|
|
11
|
+
children: [a, /* @__PURE__ */ i("div", {
|
|
12
|
+
className: "flex min-w-0 flex-col",
|
|
13
|
+
children: [o != null && /* @__PURE__ */ r("span", {
|
|
14
|
+
className: e(u, n.typeLabel),
|
|
15
|
+
children: o
|
|
16
|
+
}), /* @__PURE__ */ r("span", {
|
|
17
|
+
className: e(d, "truncate"),
|
|
18
|
+
children: s
|
|
19
|
+
})]
|
|
20
|
+
})]
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
//#endregion
|
|
24
|
+
export { a as ConfirmationIdentityRow };
|
|
@@ -0,0 +1,42 @@
|
|
|
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 "./ConfirmationView.module.scss.js";
|
|
4
|
+
import { ConfirmationPopupVariant as r, DIAL_ICON_SIZE as i, DIAL_KIT_ICON_STROKE as a, DangerButton as o, GhostButton as s, NeutralButton as c, Spinner as l } from "@epam/ai-dial-ui-kit";
|
|
5
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
6
|
+
import { IconTrashX as f } from "@tabler/icons-react";
|
|
7
|
+
//#region src/components/ConfirmationView/ConfirmationFooter.tsx
|
|
8
|
+
var p = ({ confirmLabel: p, cancelLabel: m, variant: h = r.Info, isLoading: g = !1, isConfirmDisabled: _ = !1, loadingStatusLabel: v, styles: y, onConfirm: b, onCancel: x }) => {
|
|
9
|
+
let S = h === r.Danger, C = t({ "--cfm-footer-border": y?.colors?.border }), w = (() => {
|
|
10
|
+
if (g) return /* @__PURE__ */ u(l, { size: i.SM });
|
|
11
|
+
if (S) return /* @__PURE__ */ u(f, {
|
|
12
|
+
size: i.MD,
|
|
13
|
+
"aria-hidden": !0,
|
|
14
|
+
stroke: a
|
|
15
|
+
});
|
|
16
|
+
})(), T = S ? o : c;
|
|
17
|
+
return /* @__PURE__ */ d("div", {
|
|
18
|
+
style: C,
|
|
19
|
+
className: e("flex items-center justify-end gap-2 px-6 py-4 rtl:flex-row-reverse rtl:justify-start", n.footer),
|
|
20
|
+
children: [
|
|
21
|
+
/* @__PURE__ */ u(s, {
|
|
22
|
+
label: m,
|
|
23
|
+
disabled: g,
|
|
24
|
+
onClick: x
|
|
25
|
+
}),
|
|
26
|
+
/* @__PURE__ */ u(T, {
|
|
27
|
+
label: p,
|
|
28
|
+
disabled: g || _,
|
|
29
|
+
iconBefore: w,
|
|
30
|
+
onClick: b
|
|
31
|
+
}),
|
|
32
|
+
g && v != null && /* @__PURE__ */ u("span", {
|
|
33
|
+
role: "status",
|
|
34
|
+
"aria-live": "polite",
|
|
35
|
+
className: "sr-only",
|
|
36
|
+
children: v
|
|
37
|
+
})
|
|
38
|
+
]
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
//#endregion
|
|
42
|
+
export { p as ConfirmationFooter };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { mergeClasses as e } from "../../utils/merge-class.js";
|
|
2
|
+
import { buildCssVars as t } from "../../utils/build-css-vars.js";
|
|
3
|
+
import { ConfirmationIdentityCard as n } from "../ConfirmationIdentityCard/ConfirmationIdentityCard.js";
|
|
4
|
+
import r from "./ConfirmationView.module.scss.js";
|
|
5
|
+
import { ConfirmationPopupVariant as i } from "@epam/ai-dial-ui-kit";
|
|
6
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/ConfirmationView/ConfirmationView.tsx
|
|
8
|
+
var s = ({ item: s, identity: c, message: l, consequences: u, variant: d = i.Info, messageClassName: f = "dial-small-text", styles: p, children: m }) => {
|
|
9
|
+
let h = p?.colors;
|
|
10
|
+
return /* @__PURE__ */ o("div", {
|
|
11
|
+
style: t({
|
|
12
|
+
"--cfm-message-text": h?.messageText,
|
|
13
|
+
"--cfm-consequence-text": h?.consequenceText
|
|
14
|
+
}),
|
|
15
|
+
className: "flex flex-col gap-4 px-6 py-4",
|
|
16
|
+
children: [
|
|
17
|
+
c ?? (s != null && /* @__PURE__ */ a(n, {
|
|
18
|
+
item: s,
|
|
19
|
+
variant: d,
|
|
20
|
+
styles: { colors: {
|
|
21
|
+
background: h?.cardBackground,
|
|
22
|
+
dangerBackground: h?.cardDangerBackground,
|
|
23
|
+
dangerBorder: h?.cardDangerBorder
|
|
24
|
+
} }
|
|
25
|
+
})),
|
|
26
|
+
/* @__PURE__ */ a("p", {
|
|
27
|
+
className: e(f, "break-words", r.message),
|
|
28
|
+
children: l
|
|
29
|
+
}),
|
|
30
|
+
u != null && u.length > 0 && /* @__PURE__ */ a("ul", {
|
|
31
|
+
className: e("flex list-disc flex-col gap-2 ps-5", f, r.consequences),
|
|
32
|
+
children: u.map((e) => /* @__PURE__ */ a("li", { children: e }, e))
|
|
33
|
+
}),
|
|
34
|
+
m
|
|
35
|
+
]
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
//#endregion
|
|
39
|
+
export { s as ConfirmationView };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { DIAL_ICON_SIZE as e, DIAL_KIT_ICON_STROKE as t, ElementSize as n,
|
|
1
|
+
import { DIAL_ICON_SIZE as e, DIAL_KIT_ICON_STROKE as t, ElementSize as n, GhostIconButton as r, NeutralButton as i } from "@epam/ai-dial-ui-kit";
|
|
2
2
|
import { jsx as a } from "react/jsx-runtime";
|
|
3
3
|
import { IconCheck as o, IconCopy as s } from "@tabler/icons-react";
|
|
4
4
|
//#region src/components/CopyButton/CopyButton.tsx
|
|
5
|
-
var c = ({ onClick:
|
|
5
|
+
var c = ({ onClick: i, isCopied: c, copyLabel: l, copiedLabel: u, size: d = n.Standard, ariaLabel: f, iconSize: p = e.LG, iconCopy: m, isDisabled: h = !1 }) => /* @__PURE__ */ a(r, {
|
|
6
6
|
size: d,
|
|
7
7
|
icon: c ? /* @__PURE__ */ a(o, {
|
|
8
8
|
size: p,
|
|
@@ -15,9 +15,9 @@ var c = ({ onClick: r, isCopied: c, copyLabel: l, copiedLabel: u, size: d = n.St
|
|
|
15
15
|
}),
|
|
16
16
|
"aria-label": c ? u : f ?? l,
|
|
17
17
|
tooltipProps: { tooltip: c ? u : l },
|
|
18
|
-
onClick:
|
|
18
|
+
onClick: i,
|
|
19
19
|
disabled: h
|
|
20
|
-
}), l = ({ onClick:
|
|
20
|
+
}), l = ({ onClick: r, isCopied: c, copyLabel: l, copiedLabel: u, size: d = n.Standard, isDisabled: f = !1 }) => /* @__PURE__ */ a(i, {
|
|
21
21
|
size: d,
|
|
22
22
|
label: c ? u : l,
|
|
23
23
|
iconBefore: a(c ? o : s, {
|
|
@@ -25,7 +25,7 @@ var c = ({ onClick: r, isCopied: c, copyLabel: l, copiedLabel: u, size: d = n.St
|
|
|
25
25
|
"aria-hidden": !0,
|
|
26
26
|
stroke: t
|
|
27
27
|
}),
|
|
28
|
-
onClick:
|
|
28
|
+
onClick: r,
|
|
29
29
|
disabled: f,
|
|
30
30
|
className: "shrink-0"
|
|
31
31
|
});
|
|
@@ -5,28 +5,29 @@ import { EntityTypeLabel as r } from "../EntityTypeLabel/EntityTypeLabel.js";
|
|
|
5
5
|
import { FeaturedChip as i } from "../FeaturedChip/FeaturedChip.js";
|
|
6
6
|
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
7
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",
|
|
8
|
+
var s = ({ item: s, nameClassName: c, versionClassName: l, showVersion: u = !0, typeClassName: d = "dial-caption-lead-semi-text", typeLabel: f, iconBadgeClassName: p = "rounded-[14px]", featuredChipClassName: m, featuredChipStyle: h, featuredLabel: g = "Featured", hasFeaturedTag: _ = !0, iconSize: v = 48, query: y, footer: b, statusBadge: x }) => /* @__PURE__ */ o("div", {
|
|
9
9
|
className: "flex items-start gap-2",
|
|
10
10
|
children: [/* @__PURE__ */ a(t, {
|
|
11
11
|
src: s.iconUrl,
|
|
12
|
-
size:
|
|
12
|
+
size: v,
|
|
13
13
|
initialsName: s.name,
|
|
14
|
-
styles: { badgeClassName:
|
|
14
|
+
styles: { badgeClassName: p }
|
|
15
15
|
}), /* @__PURE__ */ o("div", {
|
|
16
|
-
className: e("flex min-w-0 flex-1 flex-col gap-1",
|
|
16
|
+
className: e("flex min-w-0 flex-1 flex-col gap-1", b != null && "self-stretch"),
|
|
17
17
|
children: [
|
|
18
18
|
/* @__PURE__ */ o("div", {
|
|
19
19
|
className: "relative flex flex-row items-center justify-between",
|
|
20
20
|
children: [/* @__PURE__ */ a(r, {
|
|
21
21
|
type: s.type,
|
|
22
|
-
className: d
|
|
23
|
-
|
|
22
|
+
className: d,
|
|
23
|
+
label: f
|
|
24
|
+
}), (x != null || _ && s.isFeatured) && /* @__PURE__ */ o("div", {
|
|
24
25
|
className: "absolute end-0 top-[-6px] flex items-center gap-2",
|
|
25
|
-
children: [
|
|
26
|
+
children: [x, _ && s.isFeatured && /* @__PURE__ */ a(i, {
|
|
26
27
|
type: s.type,
|
|
27
|
-
label:
|
|
28
|
-
className:
|
|
29
|
-
style:
|
|
28
|
+
label: g,
|
|
29
|
+
className: m,
|
|
30
|
+
style: h
|
|
30
31
|
})]
|
|
31
32
|
})]
|
|
32
33
|
}),
|
|
@@ -35,11 +36,11 @@ var s = ({ item: s, nameClassName: c, versionClassName: l, showVersion: u = !0,
|
|
|
35
36
|
postfix: u ? s.version : void 0,
|
|
36
37
|
postfixClassName: l,
|
|
37
38
|
titleClassName: c,
|
|
38
|
-
query:
|
|
39
|
+
query: y
|
|
39
40
|
}),
|
|
40
|
-
|
|
41
|
+
b != null && /* @__PURE__ */ a("div", {
|
|
41
42
|
className: "mt-auto pt-1",
|
|
42
|
-
children:
|
|
43
|
+
children: b
|
|
43
44
|
})
|
|
44
45
|
]
|
|
45
46
|
})]
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ENTITY_TYPE_COLOR as e } from "../../constants/entity-colors.js";
|
|
2
2
|
import { jsx as t } from "react/jsx-runtime";
|
|
3
3
|
//#region src/components/EntityTypeLabel/EntityTypeLabel.tsx
|
|
4
|
-
var n = ({ type: n, className: r = "dial-caption-lead-semi-text" }) => /* @__PURE__ */ t("span", {
|
|
4
|
+
var n = ({ type: n, className: r = "dial-caption-lead-semi-text", label: i }) => /* @__PURE__ */ t("span", {
|
|
5
5
|
className: r,
|
|
6
6
|
style: { color: e[n] },
|
|
7
|
-
children: n
|
|
7
|
+
children: i ?? n
|
|
8
8
|
});
|
|
9
9
|
//#endregion
|
|
10
10
|
export { n as EntityTypeLabel };
|
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { getEntityTypeBadgeColor as e } from "../../utils/entity-type.js";
|
|
2
|
+
import { Badge as t, BadgeVariant as n } from "@epam/ai-dial-ui-kit";
|
|
3
3
|
import { jsx as r } from "react/jsx-runtime";
|
|
4
4
|
//#region src/components/FeaturedChip/FeaturedChip.tsx
|
|
5
|
-
var i = ({ label: i, className: a, type: o, style: s }) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
...s
|
|
13
|
-
},
|
|
14
|
-
children: i
|
|
15
|
-
});
|
|
16
|
-
};
|
|
5
|
+
var i = ({ label: i, className: a, type: o, style: s }) => /* @__PURE__ */ r(t, {
|
|
6
|
+
label: i,
|
|
7
|
+
variant: n.Filled,
|
|
8
|
+
color: e(o),
|
|
9
|
+
textClassName: a,
|
|
10
|
+
style: s
|
|
11
|
+
});
|
|
17
12
|
//#endregion
|
|
18
13
|
export { i as FeaturedChip };
|
|
@@ -1,29 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
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";
|
|
1
|
+
import { Avatar as e, AvatarShape as t } from "@epam/ai-dial-ui-kit";
|
|
2
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
7
3
|
//#region src/components/InitialsAvatar/InitialsAvatar.tsx
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
};
|
|
4
|
+
var r = ({ name: r, size: i, className: a, textClassName: o }) => /* @__PURE__ */ n(e, {
|
|
5
|
+
name: r,
|
|
6
|
+
size: i,
|
|
7
|
+
shape: t.Square,
|
|
8
|
+
className: a,
|
|
9
|
+
textClassName: o
|
|
10
|
+
});
|
|
28
11
|
//#endregion
|
|
29
|
-
export {
|
|
12
|
+
export { r as InitialsAvatar };
|
|
@@ -2,82 +2,83 @@ import { CodeBlockTheme as e } from "../../../types/code-editor.js";
|
|
|
2
2
|
import { mergeClasses as t } from "../../../utils/merge-class.js";
|
|
3
3
|
import { buildCssVars as n } from "../../../utils/build-css-vars.js";
|
|
4
4
|
import { downloadTextFile as r, getFileExtensionForLanguage as i } from "../../../utils/file-download.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import s from "
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
5
|
+
import { isSyntaxHighlightingAllowed as a } from "../../../utils/syntax-highlighting.js";
|
|
6
|
+
import { CHAT_SHARED_CLASS as o } from "../../../constants/public-class-names.js";
|
|
7
|
+
import { useCodeCopy as s } from "../../../hooks/useCodeCopy.js";
|
|
8
|
+
import c from "./CodeBlock.module.scss.js";
|
|
9
|
+
import { restrainedSyntaxTheme as l } from "./syntax-theme.js";
|
|
10
|
+
import { DIAL_ICON_SIZE as u, DIAL_KIT_ICON_STROKE as d, ElementSize as f, GhostIconButton as p } from "@epam/ai-dial-ui-kit";
|
|
11
|
+
import { Suspense as m, lazy as h, memo as g, useMemo as _ } from "react";
|
|
12
|
+
import { jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
13
|
+
import { IconCheck as b, IconCopy as x, IconDownload as S } from "@tabler/icons-react";
|
|
13
14
|
//#region src/components/MarkdownRenderer/CodeBlock/CodeBlock.tsx
|
|
14
|
-
var
|
|
15
|
-
dark:
|
|
16
|
-
light:
|
|
17
|
-
},
|
|
15
|
+
var C = {
|
|
16
|
+
dark: l,
|
|
17
|
+
light: l
|
|
18
|
+
}, w = h(async () => {
|
|
18
19
|
let { Prism: e } = await import("react-syntax-highlighter");
|
|
19
20
|
return { default: e };
|
|
20
|
-
}),
|
|
21
|
-
let { isCopied:
|
|
22
|
-
r(
|
|
23
|
-
},
|
|
21
|
+
}), T = g(({ language: h, value: g, isStreaming: T, theme: E = e.Dark, copyLabel: D = "Copy code", copiedLabel: O = "Copied!", downloadLabel: k = "Download code", hideDownload: A = !1, containerClassName: j, headerClassName: M, codeClassName: N = "dial-code-text", languageLabelClassName: P = "dial-tiny-lead-semi-text", title: F, titleSlot: I, colors: L }) => {
|
|
22
|
+
let { isCopied: R, copy: z } = s(g), B = _(() => a(g), [g]), V = E === e.Light, H = () => {
|
|
23
|
+
r(g, `code.${i(h)}`);
|
|
24
|
+
}, U = /* @__PURE__ */ v("pre", {
|
|
24
25
|
className: "p-4",
|
|
25
|
-
children: /* @__PURE__ */
|
|
26
|
-
className: t("whitespace-pre",
|
|
27
|
-
children:
|
|
26
|
+
children: /* @__PURE__ */ v("code", {
|
|
27
|
+
className: t("whitespace-pre", N),
|
|
28
|
+
children: g
|
|
28
29
|
})
|
|
29
30
|
});
|
|
30
|
-
return /* @__PURE__ */
|
|
31
|
+
return /* @__PURE__ */ y("div", {
|
|
31
32
|
style: n({
|
|
32
|
-
"--cm-code-block-bg":
|
|
33
|
-
"--cm-code-block-border":
|
|
34
|
-
"--cm-code-block-header-bg":
|
|
35
|
-
"--cm-code-block-language":
|
|
36
|
-
"--cm-code-block-copied":
|
|
37
|
-
"--cm-code-block-scrollbar":
|
|
33
|
+
"--cm-code-block-bg": L?.background,
|
|
34
|
+
"--cm-code-block-border": L?.border,
|
|
35
|
+
"--cm-code-block-header-bg": L?.headerBackground,
|
|
36
|
+
"--cm-code-block-language": L?.language,
|
|
37
|
+
"--cm-code-block-copied": L?.copied,
|
|
38
|
+
"--cm-code-block-scrollbar": L?.scrollbar
|
|
38
39
|
}),
|
|
39
|
-
className: t("my-4 max-w-full rounded-xl border [overflow:clip]",
|
|
40
|
+
className: t("my-4 max-w-full rounded-xl border [overflow:clip]", c.container, V && c.containerLight, j, o.codeBlock),
|
|
40
41
|
children: [
|
|
41
|
-
/* @__PURE__ */
|
|
42
|
-
className: t("sticky top-0 z-10 flex min-h-10 items-center justify-between px-4",
|
|
43
|
-
children: [
|
|
44
|
-
className: t(
|
|
45
|
-
children:
|
|
46
|
-
}), !
|
|
42
|
+
/* @__PURE__ */ y("div", {
|
|
43
|
+
className: t("sticky top-0 z-10 flex min-h-10 items-center justify-between px-4", I == null ? "py-2" : "py-0", c.header, M, o.codeBlockHeader),
|
|
44
|
+
children: [I ?? /* @__PURE__ */ v("span", {
|
|
45
|
+
className: t(c.languageLabel, P),
|
|
46
|
+
children: F ?? h
|
|
47
|
+
}), !T && /* @__PURE__ */ y("div", {
|
|
47
48
|
className: "flex items-center gap-1",
|
|
48
|
-
children: [!
|
|
49
|
-
icon: /* @__PURE__ */
|
|
50
|
-
size:
|
|
51
|
-
stroke:
|
|
49
|
+
children: [!A && /* @__PURE__ */ v(p, {
|
|
50
|
+
icon: /* @__PURE__ */ v(S, {
|
|
51
|
+
size: u.SM,
|
|
52
|
+
stroke: d
|
|
52
53
|
}),
|
|
53
|
-
"aria-label":
|
|
54
|
-
size:
|
|
55
|
-
onClick:
|
|
56
|
-
}), /* @__PURE__ */
|
|
57
|
-
icon:
|
|
58
|
-
size:
|
|
59
|
-
className:
|
|
54
|
+
"aria-label": k,
|
|
55
|
+
size: f.Small,
|
|
56
|
+
onClick: H
|
|
57
|
+
}), /* @__PURE__ */ v(p, {
|
|
58
|
+
icon: R ? /* @__PURE__ */ v(b, {
|
|
59
|
+
size: u.SM,
|
|
60
|
+
className: c.copiedIcon,
|
|
60
61
|
"aria-hidden": !0,
|
|
61
|
-
stroke:
|
|
62
|
-
}) : /* @__PURE__ */
|
|
63
|
-
size:
|
|
62
|
+
stroke: d
|
|
63
|
+
}) : /* @__PURE__ */ v(x, {
|
|
64
|
+
size: u.SM,
|
|
64
65
|
"aria-hidden": !0,
|
|
65
|
-
stroke:
|
|
66
|
+
stroke: d
|
|
66
67
|
}),
|
|
67
|
-
"aria-label":
|
|
68
|
-
size:
|
|
69
|
-
onClick:
|
|
68
|
+
"aria-label": D,
|
|
69
|
+
size: f.Small,
|
|
70
|
+
onClick: z
|
|
70
71
|
})]
|
|
71
72
|
})]
|
|
72
73
|
}),
|
|
73
|
-
/* @__PURE__ */
|
|
74
|
-
className: t(
|
|
74
|
+
/* @__PURE__ */ v("div", {
|
|
75
|
+
className: t(c.scrollContainer, "max-h-[60vh] overflow-auto"),
|
|
75
76
|
dir: "ltr",
|
|
76
|
-
children:
|
|
77
|
-
fallback:
|
|
78
|
-
children: /* @__PURE__ */
|
|
79
|
-
language:
|
|
80
|
-
style:
|
|
77
|
+
children: h && B ? /* @__PURE__ */ v(m, {
|
|
78
|
+
fallback: U,
|
|
79
|
+
children: /* @__PURE__ */ v(w, {
|
|
80
|
+
language: h,
|
|
81
|
+
style: C[E] ?? l,
|
|
81
82
|
customStyle: {
|
|
82
83
|
margin: 0,
|
|
83
84
|
borderRadius: 0,
|
|
@@ -87,19 +88,19 @@ var x = {
|
|
|
87
88
|
padding: "14px 16px",
|
|
88
89
|
letterSpacing: 0
|
|
89
90
|
},
|
|
90
|
-
codeTagProps: { className:
|
|
91
|
-
children:
|
|
91
|
+
codeTagProps: { className: N },
|
|
92
|
+
children: g
|
|
92
93
|
})
|
|
93
|
-
}) :
|
|
94
|
+
}) : U
|
|
94
95
|
}),
|
|
95
|
-
/* @__PURE__ */
|
|
96
|
+
/* @__PURE__ */ v("span", {
|
|
96
97
|
role: "status",
|
|
97
98
|
"aria-live": "polite",
|
|
98
99
|
className: "sr-only",
|
|
99
|
-
children:
|
|
100
|
+
children: R ? O : ""
|
|
100
101
|
})
|
|
101
102
|
]
|
|
102
103
|
});
|
|
103
104
|
});
|
|
104
105
|
//#endregion
|
|
105
|
-
export {
|
|
106
|
+
export { T as MarkdownCodeBlock };
|
|
@@ -1,22 +1,30 @@
|
|
|
1
1
|
import { MarkdownRenderer as e } from "./MarkdownRenderer.js";
|
|
2
2
|
import { DEFAULT_MARKDOWN_CLASS_NAMES as t } from "./markdown-class-names.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { PlainTextRenderer as n } from "./PlainTextRenderer.js";
|
|
4
|
+
import { memo as r } from "react";
|
|
5
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
5
6
|
//#region src/components/MarkdownRenderer/MDMessageViewer.tsx
|
|
6
|
-
var
|
|
7
|
-
content:
|
|
8
|
-
isStreaming:
|
|
9
|
-
thinkingLabel:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
7
|
+
var a = r(({ content: r, isPlainText: a, isStreaming: o, thinkingLabel: s, components: c, urlTransform: l, codeBlockCopyLabel: u, codeBlockCopiedLabel: d, codeBlockDownloadLabel: f, codeBlockTheme: p, tableActionLabels: m, tableDownloadFilename: h, tableOnOpenInCanvas: g, tableScrollRegionAriaLabel: _, mathScrollRegionAriaLabel: v, classNames: y = t }) => a ? /* @__PURE__ */ i(n, {
|
|
8
|
+
content: r,
|
|
9
|
+
isStreaming: o,
|
|
10
|
+
thinkingLabel: s,
|
|
11
|
+
classNames: y
|
|
12
|
+
}) : /* @__PURE__ */ i(e, {
|
|
13
|
+
content: r,
|
|
14
|
+
isStreaming: o,
|
|
15
|
+
thinkingLabel: s,
|
|
16
|
+
components: c,
|
|
17
|
+
urlTransform: l,
|
|
18
|
+
codeBlockCopyLabel: u,
|
|
19
|
+
codeBlockCopiedLabel: d,
|
|
20
|
+
codeBlockDownloadLabel: f,
|
|
21
|
+
codeBlockTheme: p,
|
|
22
|
+
tableActionLabels: m,
|
|
23
|
+
tableDownloadFilename: h,
|
|
24
|
+
tableOnOpenInCanvas: g,
|
|
25
|
+
tableScrollRegionAriaLabel: _,
|
|
26
|
+
mathScrollRegionAriaLabel: v,
|
|
27
|
+
classNames: y
|
|
20
28
|
}));
|
|
21
29
|
//#endregion
|
|
22
|
-
export {
|
|
30
|
+
export { a as MDMessageViewer };
|