@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.
Files changed (51) hide show
  1. package/components/ConfirmationDialog/ConfirmationDialog.js +34 -0
  2. package/components/ConfirmationIdentityCard/ConfirmationIdentityCard.js +21 -0
  3. package/components/ConfirmationIdentityCard/ConfirmationIdentityCard.module.scss.js +6 -0
  4. package/components/ConfirmationIdentityRow/ConfirmationIdentityRow.js +24 -0
  5. package/components/ConfirmationIdentityRow/ConfirmationIdentityRow.module.scss.js +3 -0
  6. package/components/ConfirmationView/ConfirmationFooter.js +42 -0
  7. package/components/ConfirmationView/ConfirmationView.js +39 -0
  8. package/components/ConfirmationView/ConfirmationView.module.scss.js +7 -0
  9. package/components/CopyButton/CopyButton.js +5 -5
  10. package/components/EntityHeader/EntityHeader.js +14 -13
  11. package/components/EntityTypeLabel/EntityTypeLabel.js +2 -2
  12. package/components/FeaturedChip/FeaturedChip.js +9 -14
  13. package/components/InitialsAvatar/InitialsAvatar.js +10 -27
  14. package/components/MarkdownRenderer/CodeBlock/CodeBlock.js +65 -64
  15. package/components/MarkdownRenderer/MDMessageViewer.js +25 -17
  16. package/components/MarkdownRenderer/MarkdownRenderer.js +119 -118
  17. package/components/MarkdownRenderer/MarkdownRenderer.module.scss.js +7 -7
  18. package/components/MarkdownRenderer/Math/MarkdownMathBlock.module.scss.js +2 -2
  19. package/components/MarkdownRenderer/PlainTextRenderer.js +21 -0
  20. package/components/MarkdownRenderer/Table/MarkdownTable.js +62 -65
  21. package/components/MarkdownRenderer/Table/MarkdownTable.module.scss.js +11 -11
  22. package/components/MarkdownRenderer/Table/TableHeader.js +18 -21
  23. package/components/MarkdownRenderer/ThinkingShimmer.js +14 -0
  24. package/components/MarkdownWithPlaceholders/MarkdownWithPlaceholders.js +3 -2
  25. package/components/PanelEmptyState/PanelEmptyState.js +2 -1
  26. package/components/TextRefinementField/TextRefinementField.js +86 -0
  27. package/constants/dial.js +2 -2
  28. package/constants/resizable-fields.js +2 -2
  29. package/file-manager/DialFileManagerShell/DialFileManagerShell.js +248 -236
  30. package/file-manager/FileManagerAttachModal/FileManagerAttachModal.js +17 -14
  31. package/file-manager/OperationLoaderModal/OperationLoaderModal.js +17 -20
  32. package/file-manager/upload-batch.js +2 -2
  33. package/file-manager/upload-queue.js +17 -0
  34. package/file-manager.d.ts +25 -14
  35. package/file-manager.js +4 -3
  36. package/hooks/useTextRefinement.js +66 -0
  37. package/hooks/useUnsavedChangesGuard.js +30 -0
  38. package/index.css +2 -2
  39. package/index.d.ts +510 -46
  40. package/index.js +73 -62
  41. package/markdown.d.ts +64 -8
  42. package/markdown.js +5 -4
  43. package/models/chat.js +4 -2
  44. package/package.json +5 -5
  45. package/utils/entity-field-limits.js +4 -0
  46. package/utils/entity-type.js +15 -0
  47. package/utils/format-price.js +13 -9
  48. package/utils/is-skill-selection-unsupported.js +4 -0
  49. package/utils/syntax-highlighting.js +13 -0
  50. package/components/InitialsAvatar/InitialsAvatar.module.scss.js +0 -6
  51. 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,6 @@
1
+ var e = {
2
+ info: "_info_pkxew_1",
3
+ danger: "_danger_pkxew_5"
4
+ };
5
+ //#endregion
6
+ export { e as default };
@@ -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,3 @@
1
+ var e = { typeLabel: "_typeLabel_17nhs_1" };
2
+ //#endregion
3
+ export { e as default };
@@ -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 };
@@ -0,0 +1,7 @@
1
+ var e = {
2
+ message: "_message_1iqfi_1",
3
+ consequences: "_consequences_1iqfi_5",
4
+ footer: "_footer_1iqfi_9"
5
+ };
6
+ //#endregion
7
+ export { e as default };
@@ -1,8 +1,8 @@
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";
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: 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, {
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: r,
18
+ onClick: i,
19
19
  disabled: h
20
- }), l = ({ onClick: i, isCopied: c, copyLabel: l, copiedLabel: u, size: d = n.Standard, isDisabled: f = !1 }) => /* @__PURE__ */ a(r, {
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: i,
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", 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", {
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: f }
14
+ styles: { badgeClassName: p }
15
15
  }), /* @__PURE__ */ o("div", {
16
- className: e("flex min-w-0 flex-1 flex-col gap-1", y != null && "self-stretch"),
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
- }), (b != null || g && s.isFeatured) && /* @__PURE__ */ o("div", {
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: [b, g && s.isFeatured && /* @__PURE__ */ a(i, {
26
+ children: [x, _ && s.isFeatured && /* @__PURE__ */ a(i, {
26
27
  type: s.type,
27
- label: h,
28
- className: p,
29
- style: m
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: v
39
+ query: y
39
40
  }),
40
- y != null && /* @__PURE__ */ a("div", {
41
+ b != null && /* @__PURE__ */ a("div", {
41
42
  className: "mt-auto pt-1",
42
- children: y
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 { 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";
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
- 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
- };
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 { 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";
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 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
- };
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 { o as InitialsAvatar };
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 { CHAT_SHARED_CLASS as a } from "../../../constants/public-class-names.js";
6
- import { useCodeCopy as o } from "../../../hooks/useCodeCopy.js";
7
- import s from "./CodeBlock.module.scss.js";
8
- import { restrainedSyntaxTheme as c } from "./syntax-theme.js";
9
- import { DIAL_ICON_SIZE as l, DIAL_KIT_ICON_STROKE as u, ElementSize as d, GhostIconButton as f } from "@epam/ai-dial-ui-kit";
10
- import { Suspense as p, lazy as m, memo as h } from "react";
11
- import { jsx as g, jsxs as _ } from "react/jsx-runtime";
12
- import { IconCheck as v, IconCopy as y, IconDownload as b } from "@tabler/icons-react";
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 x = {
15
- dark: c,
16
- light: c
17
- }, S = m(async () => {
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
- }), C = h(({ language: m, value: h, isStreaming: C, theme: w = e.Dark, copyLabel: T = "Copy code", copiedLabel: E = "Copied!", downloadLabel: D = "Download code", hideDownload: O = !1, containerClassName: k, headerClassName: A, codeClassName: j = "dial-code-text", languageLabelClassName: M = "dial-tiny-lead-semi-text", title: N, titleSlot: P, colors: F }) => {
21
- let { isCopied: I, copy: L } = o(h), R = w === e.Light, z = () => {
22
- r(h, `code.${i(m)}`);
23
- }, B = /* @__PURE__ */ g("pre", {
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__ */ g("code", {
26
- className: t("whitespace-pre", j),
27
- children: h
26
+ children: /* @__PURE__ */ v("code", {
27
+ className: t("whitespace-pre", N),
28
+ children: g
28
29
  })
29
30
  });
30
- return /* @__PURE__ */ _("div", {
31
+ return /* @__PURE__ */ y("div", {
31
32
  style: n({
32
- "--cm-code-block-bg": F?.background,
33
- "--cm-code-block-border": F?.border,
34
- "--cm-code-block-header-bg": F?.headerBackground,
35
- "--cm-code-block-language": F?.language,
36
- "--cm-code-block-copied": F?.copied,
37
- "--cm-code-block-scrollbar": F?.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]", s.container, R && s.containerLight, k, a.codeBlock),
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__ */ _("div", {
42
- className: t("sticky top-0 z-10 flex min-h-10 items-center justify-between px-4", P == null ? "py-2" : "py-0", s.header, A, a.codeBlockHeader),
43
- children: [P ?? /* @__PURE__ */ g("span", {
44
- className: t(s.languageLabel, M),
45
- children: N ?? m
46
- }), !C && /* @__PURE__ */ _("div", {
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: [!O && /* @__PURE__ */ g(f, {
49
- icon: /* @__PURE__ */ g(b, {
50
- size: l.SM,
51
- stroke: u
49
+ children: [!A && /* @__PURE__ */ v(p, {
50
+ icon: /* @__PURE__ */ v(S, {
51
+ size: u.SM,
52
+ stroke: d
52
53
  }),
53
- "aria-label": D,
54
- size: d.Small,
55
- onClick: z
56
- }), /* @__PURE__ */ g(f, {
57
- icon: I ? /* @__PURE__ */ g(v, {
58
- size: l.SM,
59
- className: s.copiedIcon,
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: u
62
- }) : /* @__PURE__ */ g(y, {
63
- size: l.SM,
62
+ stroke: d
63
+ }) : /* @__PURE__ */ v(x, {
64
+ size: u.SM,
64
65
  "aria-hidden": !0,
65
- stroke: u
66
+ stroke: d
66
67
  }),
67
- "aria-label": T,
68
- size: d.Small,
69
- onClick: L
68
+ "aria-label": D,
69
+ size: f.Small,
70
+ onClick: z
70
71
  })]
71
72
  })]
72
73
  }),
73
- /* @__PURE__ */ g("div", {
74
- className: t(s.scrollContainer, "max-h-[60vh] overflow-auto"),
74
+ /* @__PURE__ */ v("div", {
75
+ className: t(c.scrollContainer, "max-h-[60vh] overflow-auto"),
75
76
  dir: "ltr",
76
- children: m ? /* @__PURE__ */ g(p, {
77
- fallback: B,
78
- children: /* @__PURE__ */ g(S, {
79
- language: m,
80
- style: x[w] ?? c,
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: j },
91
- children: h
91
+ codeTagProps: { className: N },
92
+ children: g
92
93
  })
93
- }) : B
94
+ }) : U
94
95
  }),
95
- /* @__PURE__ */ g("span", {
96
+ /* @__PURE__ */ v("span", {
96
97
  role: "status",
97
98
  "aria-live": "polite",
98
99
  className: "sr-only",
99
- children: I ? E : ""
100
+ children: R ? O : ""
100
101
  })
101
102
  ]
102
103
  });
103
104
  });
104
105
  //#endregion
105
- export { C as MarkdownCodeBlock };
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 { memo as n } from "react";
4
- import { jsx as r } from "react/jsx-runtime";
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 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
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 { i as MDMessageViewer };
30
+ export { a as MDMessageViewer };