@epam/ai-dial-chat-shared 1.2.0-dev.15 → 1.2.0-dev.152

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 (34) hide show
  1. package/components/MarkdownRenderer/CodeBlock/CodeBlock.js +64 -63
  2. package/components/MarkdownRenderer/CodeBlock/CodeBlock.module.scss.js +6 -6
  3. package/components/MarkdownRenderer/MDMessageViewer.js +23 -17
  4. package/components/MarkdownRenderer/MarkdownRenderer.js +88 -90
  5. package/components/MarkdownRenderer/Math/MarkdownMathBlock.js +19 -18
  6. package/components/MarkdownRenderer/PlainTextRenderer.js +21 -0
  7. package/components/MarkdownRenderer/Table/MarkdownTable.js +71 -56
  8. package/components/MarkdownRenderer/Table/MarkdownTable.module.scss.js +11 -11
  9. package/components/MarkdownRenderer/Table/TableHeader.js +18 -21
  10. package/components/MarkdownRenderer/Table/table-serialization.js +23 -3
  11. package/components/MarkdownRenderer/Table/useMarkdownTableActions/useMarkdownTableActions.js +48 -62
  12. package/components/MarkdownRenderer/ThinkingShimmer.js +14 -0
  13. package/components/TextRefinementField/TextRefinementField.js +84 -0
  14. package/constants/mime-types.js +49 -2
  15. package/constants/public-class-names.js +10 -0
  16. package/constants/resizable-fields.js +1 -1
  17. package/file-manager/DialFileManagerShell/DialFileManagerShell.js +169 -159
  18. package/file-manager/FileManagerAttachModal/FileManagerAttachModal.js +29 -30
  19. package/file-manager/OperationLoaderModal/OperationLoaderModal.js +17 -20
  20. package/file-manager/UploadProgressModal/UploadProgressModal.js +26 -35
  21. package/file-manager.d.ts +10 -6
  22. package/hooks/useTextRefinement.js +66 -0
  23. package/index.css +2 -2
  24. package/index.d.ts +262 -10
  25. package/index.js +60 -56
  26. package/markdown.d.ts +61 -8
  27. package/markdown.js +13 -11
  28. package/package.json +3 -3
  29. package/types/attachment.js +1 -1
  30. package/utils/file-download.js +6 -6
  31. package/utils/is-skill-selection-unsupported.js +4 -0
  32. package/utils/latex.js +5 -3
  33. package/utils/merge-class.js +5 -4
  34. package/utils/mime-type.js +10 -6
package/markdown.d.ts CHANGED
@@ -4,6 +4,19 @@ import { FC } from 'react';
4
4
  import { Options } from 'react-markdown';
5
5
  import { ReactNode } from 'react';
6
6
 
7
+ export declare const CHAT_SHARED_CLASS: {
8
+ /** The bordered container of a fenced code block. */
9
+ readonly codeBlock: "dial-chat-shared-code-block";
10
+ /** The code block's sticky header, holding the language label and actions. */
11
+ readonly codeBlockHeader: "dial-chat-shared-code-block-header";
12
+ /** The bordered container of a Markdown table. */
13
+ readonly table: "dial-chat-shared-table";
14
+ /** The scrolling box around a Markdown table, which owns its overflow. */
15
+ readonly tableScroll: "dial-chat-shared-table-scroll";
16
+ /** The scrolling box around a display-math block. */
17
+ readonly mathBlock: "dial-chat-shared-math-block";
18
+ };
19
+
7
20
  /** Color theme for syntax highlighting. */
8
21
  declare enum CodeBlockTheme {
9
22
  /** Dark syntax-highlighting theme. */
@@ -225,9 +238,7 @@ export declare interface MarkdownRendererProps {
225
238
  export declare const MarkdownTable: FC<MarkdownTableProps>;
226
239
 
227
240
  export declare interface MarkdownTableActionLabels {
228
- copyCsvLabel?: string;
229
- copyTxtLabel?: string;
230
- copyMarkdownLabel?: string;
241
+ copyLabel?: string;
231
242
  copiedLabel?: string;
232
243
  downloadCsvLabel?: string;
233
244
  openInCanvasLabel?: string;
@@ -253,19 +264,16 @@ export declare interface MarkdownTableColors {
253
264
  fade?: string;
254
265
  /** Divider color between rows. Defaults to `--stroke-tertiary`. */
255
266
  rowDivider?: string;
256
- /** Background of even-indexed body rows. Defaults to `--bg-layer-base`. */
257
- rowZebraBackground?: string;
258
267
  /** Background of a body row on hover. Defaults to `--bg-control-accent-alpha-hover`. */
259
268
  rowHoverBackground?: string;
260
269
  }
261
270
 
262
271
  export declare enum MarkdownTableCopyFormat {
263
272
  Csv = "csv",
264
- Txt = "txt",
265
273
  Markdown = "markdown"
266
274
  }
267
275
 
268
- /** A table header action rendered as an icon button. */
276
+ /** A table action rendered as an icon button. */
269
277
  export declare interface MarkdownTableHeaderAction {
270
278
  /** Stable accessible name and tooltip text. */
271
279
  label: string;
@@ -309,13 +317,20 @@ export declare interface MarkdownWithPlaceholdersProps {
309
317
  headingClassName?: string;
310
318
  }
311
319
 
312
- /** Renders assistant message content as formatted markdown. */
320
+ /** Renders assistant message content as formatted markdown, or as escaped plain text when `isPlainText` is set. */
313
321
  export declare const MDMessageViewer: FC<MDMessageViewerProps>;
314
322
 
315
323
  /** Props for the {@link MDMessageViewer} markdown renderer. */
316
324
  declare interface MDMessageViewerProps {
317
325
  /** Raw markdown string to render. */
318
326
  content: string;
327
+ /**
328
+ * Renders `content` verbatim as escaped plain text instead of running the
329
+ * Markdown pipeline — the conversation's `plain_text` response format.
330
+ * Markdown-only props (`components`, `urlTransform`, the code-block and
331
+ * table labels) do not apply while it is set. Defaults to `false`.
332
+ */
333
+ isPlainText?: boolean;
319
334
  /** Enables gradual reveal for appended streaming content. */
320
335
  isStreaming?: boolean;
321
336
  /**
@@ -355,6 +370,44 @@ declare interface MDMessageViewerProps {
355
370
  classNames?: MarkdownRendererClassNames;
356
371
  }
357
372
 
373
+ /**
374
+ * Renders message text as plain text: no Markdown pipeline, no raw HTML, no
375
+ * syntax highlighting. The text is a React text child, so it is escaped by
376
+ * construction — a table, a heading, or `**bold**` reaches the reader exactly
377
+ * as the model emitted it, which is what a conversation's `plain_text`
378
+ * response format promises.
379
+ *
380
+ * Lives beside {@link MarkdownRenderer} because it is the other half of the
381
+ * same choice: both render an assistant message body, and both are selected
382
+ * by `MDMessageViewer` from the conversation's response format.
383
+ */
384
+ export declare const PlainTextRenderer: FC<PlainTextRendererProps>;
385
+
386
+ /** Props for {@link PlainTextRenderer}. */
387
+ export declare interface PlainTextRendererProps {
388
+ /** Message text. Rendered verbatim — never parsed as Markdown or HTML. */
389
+ content: string;
390
+ /** Classes applied to the renderer root. */
391
+ containerClassName?: string;
392
+ /** When true, appended content is revealed gradually for smoother streaming updates. */
393
+ isStreaming?: boolean;
394
+ /** Reveal speed used while `isStreaming` is true. Defaults to 120 characters per second. */
395
+ streamCharactersPerSecond?: number;
396
+ /**
397
+ * Typography classes. Only `p` is read — the single paragraph the renderer
398
+ * emits — so the same object a Markdown message is styled with keeps both
399
+ * formats on one type scale.
400
+ */
401
+ classNames?: Pick<MarkdownRendererClassNames, 'p'>;
402
+ /**
403
+ * Label shown with a shimmer animation while `isStreaming` is true and no
404
+ * content has arrived yet. Defaults to `'Thinking'`.
405
+ */
406
+ thinkingLabel?: string;
407
+ /** Color overrides applied as CSS custom properties. */
408
+ colors?: Pick<MarkdownRendererColors, 'thinkingPrimary' | 'thinkingSecondary'>;
409
+ }
410
+
358
411
  /** Style map consumed by `react-syntax-highlighter`'s `Prism` renderer. */
359
412
  declare type PrismStyleMap = Record<string, CSSProperties>;
360
413
 
package/markdown.js CHANGED
@@ -1,11 +1,13 @@
1
- import { useCodeCopy as e } from "./hooks/useCodeCopy.js";
2
- import { restrainedSyntaxTheme as t } from "./components/MarkdownRenderer/CodeBlock/syntax-theme.js";
3
- import { MarkdownCodeBlock as n } from "./components/MarkdownRenderer/CodeBlock/CodeBlock.js";
4
- import { DEFAULT_MARKDOWN_TABLE_DOWNLOAD_FILENAME as r, MARKDOWN_TABLE_CSV_MIME_TYPE as i, MarkdownTableCopyFormat as a, serializeMarkdownTableRows as o } from "./components/MarkdownRenderer/Table/table-serialization.js";
5
- import { MarkdownTable as s } from "./components/MarkdownRenderer/Table/MarkdownTable.js";
6
- import { MarkdownRenderer as c, defaultMarkdownComponents as l } from "./components/MarkdownRenderer/MarkdownRenderer.js";
7
- import { COMPACT_MARKDOWN_CLASS_NAMES as u, DEFAULT_MARKDOWN_CLASS_NAMES as d } from "./components/MarkdownRenderer/markdown-class-names.js";
8
- import { MDMessageViewer as f } from "./components/MarkdownRenderer/MDMessageViewer.js";
9
- import { MarkdownWithPlaceholders as p } from "./components/MarkdownWithPlaceholders/MarkdownWithPlaceholders.js";
10
- import { useCollapsedText as m } from "./hooks/useCollapsedText.js";
11
- export { u as COMPACT_MARKDOWN_CLASS_NAMES, d as DEFAULT_MARKDOWN_CLASS_NAMES, r as DEFAULT_MARKDOWN_TABLE_DOWNLOAD_FILENAME, i as MARKDOWN_TABLE_CSV_MIME_TYPE, f as MDMessageViewer, n as MarkdownCodeBlock, c as MarkdownRenderer, s as MarkdownTable, a as MarkdownTableCopyFormat, p as MarkdownWithPlaceholders, l as defaultMarkdownComponents, t as restrainedSyntaxTheme, o as serializeMarkdownTableRows, e as useCodeCopy, m as useCollapsedText };
1
+ import { CHAT_SHARED_CLASS as e } from "./constants/public-class-names.js";
2
+ import { useCodeCopy as t } from "./hooks/useCodeCopy.js";
3
+ import { restrainedSyntaxTheme as n } from "./components/MarkdownRenderer/CodeBlock/syntax-theme.js";
4
+ import { MarkdownCodeBlock as r } from "./components/MarkdownRenderer/CodeBlock/CodeBlock.js";
5
+ import { DEFAULT_MARKDOWN_TABLE_DOWNLOAD_FILENAME as i, MARKDOWN_TABLE_CSV_MIME_TYPE as a, MarkdownTableCopyFormat as o, serializeMarkdownTableRows as s } from "./components/MarkdownRenderer/Table/table-serialization.js";
6
+ import { MarkdownTable as c } from "./components/MarkdownRenderer/Table/MarkdownTable.js";
7
+ import { MarkdownRenderer as l, defaultMarkdownComponents as u } from "./components/MarkdownRenderer/MarkdownRenderer.js";
8
+ import { COMPACT_MARKDOWN_CLASS_NAMES as d, DEFAULT_MARKDOWN_CLASS_NAMES as f } from "./components/MarkdownRenderer/markdown-class-names.js";
9
+ import { PlainTextRenderer as p } from "./components/MarkdownRenderer/PlainTextRenderer.js";
10
+ import { MDMessageViewer as m } from "./components/MarkdownRenderer/MDMessageViewer.js";
11
+ import { MarkdownWithPlaceholders as h } from "./components/MarkdownWithPlaceholders/MarkdownWithPlaceholders.js";
12
+ import { useCollapsedText as g } from "./hooks/useCollapsedText.js";
13
+ export { e as CHAT_SHARED_CLASS, d as COMPACT_MARKDOWN_CLASS_NAMES, f as DEFAULT_MARKDOWN_CLASS_NAMES, i as DEFAULT_MARKDOWN_TABLE_DOWNLOAD_FILENAME, a as MARKDOWN_TABLE_CSV_MIME_TYPE, m as MDMessageViewer, r as MarkdownCodeBlock, l as MarkdownRenderer, c as MarkdownTable, o as MarkdownTableCopyFormat, h as MarkdownWithPlaceholders, p as PlainTextRenderer, u as defaultMarkdownComponents, n as restrainedSyntaxTheme, s as serializeMarkdownTableRows, t as useCodeCopy, g as useCollapsedText };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@epam/ai-dial-chat-shared",
3
3
  "description": "Shared domain models, utilities, and UI components for AI DIAL Chat libraries",
4
- "version": "1.2.0-dev.15",
4
+ "version": "1.2.0-dev.152",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "sideEffects": [
@@ -32,8 +32,8 @@
32
32
  },
33
33
  "peerDependencies": {
34
34
  "react": "^19.2.8",
35
- "@epam/ai-dial-ui-kit": "^0.14.2",
36
- "@epam/ai-dial-react-file-manager": "^0.2.0",
35
+ "@epam/ai-dial-ui-kit": "^0.15.0-dev.19",
36
+ "@epam/ai-dial-react-file-manager": "^0.3.0-dev.7",
37
37
  "ag-grid-community": "^35.3.0"
38
38
  },
39
39
  "peerDependenciesMeta": {
@@ -1,6 +1,6 @@
1
1
  //#region src/types/attachment.ts
2
2
  var e = /* @__PURE__ */ function(e) {
3
- return e.Network = "network", e.UnsupportedType = "unsupported-type", e;
3
+ return e.Network = "network", e.UnsupportedType = "unsupported-type", e.FileTooLarge = "file-too-large", e;
4
4
  }({}), t = /* @__PURE__ */ function(e) {
5
5
  return e.File = "file", e.Image = "image", e.Audio = "audio", e.Prompt = "prompt", e.Pasted = "pasted", e.Link = "link", e;
6
6
  }({});
@@ -1,5 +1,5 @@
1
- import { stripUrlQueryAndFragment as e } from "./mime-type.js";
2
- import { MIME_TYPE_EXT_MAP as t } from "../constants/mime-types.js";
1
+ import { MIME_TYPE_EXT_MAP as e } from "../constants/mime-types.js";
2
+ import { stripUrlQueryAndFragment as t } from "./mime-type.js";
3
3
  //#region src/utils/file-download.ts
4
4
  var n = /^[a-zA-Z0-9]{1,10}$/, r = (e) => {
5
5
  let t = e.lastIndexOf(".");
@@ -9,12 +9,12 @@ var n = /^[a-zA-Z0-9]{1,10}$/, r = (e) => {
9
9
  }, i = (n, i, a) => {
10
10
  if (r(n) != null) return n;
11
11
  if (a != null) {
12
- let e = t[a];
13
- if (e != null) return `${n}.${e}`;
12
+ let t = e[a];
13
+ if (t != null) return `${n}.${t}`;
14
14
  }
15
15
  if (i != null) {
16
- let t = r(e(i).split("/").pop() ?? "");
17
- if (t != null) return `${n}.${t}`;
16
+ let e = r(t(i).split("/").pop() ?? "");
17
+ if (e != null) return `${n}.${e}`;
18
18
  }
19
19
  return n;
20
20
  }, a = {
@@ -0,0 +1,4 @@
1
+ //#region src/utils/is-skill-selection-unsupported.ts
2
+ var e = (e, t) => !!e?.trim() && t !== !0;
3
+ //#endregion
4
+ export { e as isSkillSelectionUnsupported };
package/utils/latex.js CHANGED
@@ -26,11 +26,13 @@ var e = /\$\\ce\{/g, t = /\$\\pu\{/g, n = /\$\\\\ce\{[^}]*\}\$/g, r = /\$\\\\pu\
26
26
  let t = p(e), n = [], r = 0, s;
27
27
  for (i.lastIndex = 0; (s = i.exec(e)) !== null;) {
28
28
  let i = s.index, c = i + s[0].length, l = s[1];
29
- if (!l.includes("\n") || m(i, t)) continue;
29
+ if (m(i, t)) continue;
30
30
  let u = e.lastIndexOf("\n", i - 1) + 1;
31
31
  if (e.slice(u, i).trim() !== "") continue;
32
- let d = l.replace(a, "").replace(o, ""), f = e.indexOf("\n", c), p = e.slice(c, f === -1 ? e.length : f);
33
- n.push(e.slice(r, i)), n.push(`$$\n${d}\n$$${p.trim() === "" ? "" : "\n"}`), r = c;
32
+ let d = e.indexOf("\n", c), f = e.slice(c, d === -1 ? e.length : d);
33
+ if (!l.includes("\n") && (f.trim() !== "" || l.trim() === "")) continue;
34
+ let p = l.replace(a, "").replace(o, "");
35
+ n.push(e.slice(r, i)), n.push(`$$\n${p}\n$$${f.trim() === "" ? "" : "\n"}`), r = c;
34
36
  }
35
37
  return n.push(e.substring(r)), n.join("");
36
38
  }, y = (e, t) => {
@@ -1,8 +1,9 @@
1
1
  import e from "classnames";
2
- import { twMerge as t } from "tailwind-merge";
2
+ import { extendTailwindMerge as t } from "tailwind-merge";
3
3
  //#region src/utils/merge-class.ts
4
- function n(...n) {
5
- return t(e(...n));
4
+ var n = t({ extend: { classGroups: { shadow: [{ shadow: ["chat-button"] }] } } });
5
+ function r(...t) {
6
+ return n(e(...t));
6
7
  }
7
8
  //#endregion
8
- export { n as mergeClasses };
9
+ export { r as mergeClasses };
@@ -1,7 +1,8 @@
1
1
  import { AttachmentType as e } from "../types/attachment.js";
2
2
  import { MIMEType as t } from "../types/mime-type.js";
3
+ import { MIME_TYPE_ALIASES as n } from "../constants/mime-types.js";
3
4
  //#region src/utils/mime-type.ts
4
- var n = {
5
+ var r = {
5
6
  md: t.Markdown,
6
7
  markdown: t.Markdown,
7
8
  txt: t.Plain,
@@ -65,9 +66,12 @@ var n = {
65
66
  mp3: t.MP3,
66
67
  wav: t.WAV,
67
68
  ogg: t.OGG
68
- }, r = (e) => e.split(/[?#]/)[0], i = (e) => {
69
- let t = r(e), i = t.lastIndexOf(".");
70
- if (i !== -1) return n[t.slice(i + 1).toLowerCase()];
71
- }, a = (t) => t?.startsWith("image/") ? e.Image : t?.startsWith("audio/") ? e.Audio : e.File;
69
+ }, i = (e) => e.toLowerCase().split(";")[0].trim(), a = (e) => {
70
+ let t = i(e);
71
+ return n[t] ?? t;
72
+ }, o = (e) => e.split(/[?#]/)[0], s = (e) => {
73
+ let t = o(e), n = t.lastIndexOf(".");
74
+ if (n !== -1) return r[t.slice(n + 1).toLowerCase()];
75
+ }, c = (t) => t?.startsWith("image/") ? e.Image : t?.startsWith("audio/") ? e.Audio : e.File;
72
76
  //#endregion
73
- export { a as getAttachmentTypeFromMime, i as inferMimeTypeFromPath, r as stripUrlQueryAndFragment };
77
+ export { c as getAttachmentTypeFromMime, i as getBaseMimeType, s as inferMimeTypeFromPath, a as normalizeMimeType, o as stripUrlQueryAndFragment };