@epam/ai-dial-chat-shared 1.2.0-dev.282 → 1.2.0-dev.284
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.
|
@@ -14,7 +14,7 @@ var s = ({ item: s, identity: c, message: l, consequences: u, variant: d = i.Inf
|
|
|
14
14
|
}),
|
|
15
15
|
className: "flex flex-col gap-4 px-6 py-4",
|
|
16
16
|
children: [
|
|
17
|
-
c ?? /* @__PURE__ */ a(n, {
|
|
17
|
+
c ?? (s != null && /* @__PURE__ */ a(n, {
|
|
18
18
|
item: s,
|
|
19
19
|
variant: d,
|
|
20
20
|
styles: { colors: {
|
|
@@ -22,7 +22,7 @@ var s = ({ item: s, identity: c, message: l, consequences: u, variant: d = i.Inf
|
|
|
22
22
|
dangerBackground: h?.cardDangerBackground,
|
|
23
23
|
dangerBorder: h?.cardDangerBorder
|
|
24
24
|
} }
|
|
25
|
-
}),
|
|
25
|
+
})),
|
|
26
26
|
/* @__PURE__ */ a("p", {
|
|
27
27
|
className: e(f, "break-words", r.message),
|
|
28
28
|
children: l
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useCallback as e, useEffect as t, useRef as n, useState as r } from "react";
|
|
2
|
+
//#region src/hooks/useUnsavedChangesGuard.ts
|
|
3
|
+
var i = (i) => {
|
|
4
|
+
let [a, o] = r(!1), s = n(null);
|
|
5
|
+
return t(() => {
|
|
6
|
+
if (!i) return;
|
|
7
|
+
let e = (e) => {
|
|
8
|
+
e.preventDefault();
|
|
9
|
+
};
|
|
10
|
+
return window.addEventListener("beforeunload", e), () => window.removeEventListener("beforeunload", e);
|
|
11
|
+
}, [i]), {
|
|
12
|
+
guard: e((e) => {
|
|
13
|
+
if (!i) {
|
|
14
|
+
e();
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
s.current = e, o(!0);
|
|
18
|
+
}, [i]),
|
|
19
|
+
isConfirmOpen: a,
|
|
20
|
+
confirm: e(() => {
|
|
21
|
+
let e = s.current;
|
|
22
|
+
s.current = null, o(!1), e?.();
|
|
23
|
+
}, []),
|
|
24
|
+
dismiss: e(() => {
|
|
25
|
+
s.current = null, o(!1);
|
|
26
|
+
}, [])
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
//#endregion
|
|
30
|
+
export { i as useUnsavedChangesGuard };
|
package/index.d.ts
CHANGED
|
@@ -452,7 +452,7 @@ export declare interface ConfirmationViewColors {
|
|
|
452
452
|
|
|
453
453
|
/** Props for `ConfirmationView`. */
|
|
454
454
|
export declare interface ConfirmationViewProps {
|
|
455
|
-
/** Entity the confirmation is about, rendered as an identity card above the copy. Ignored when `identity` is set. */
|
|
455
|
+
/** Entity the confirmation is about, rendered as an identity card above the copy. Ignored when `identity` is set; with neither, no card is rendered. */
|
|
456
456
|
item?: EntityHeaderItem;
|
|
457
457
|
/**
|
|
458
458
|
* Identity card rendered in place of the default one, for a resource that is
|
|
@@ -2900,6 +2900,18 @@ export declare const truncateToUtf8Bytes: (str: string, maxBytes: number) => str
|
|
|
2900
2900
|
/** Decodes a base64 string into raw bytes, or `undefined` if the string is not valid base64. */
|
|
2901
2901
|
export declare const tryBase64ToBytes: (base64: string) => Uint8Array | undefined;
|
|
2902
2902
|
|
|
2903
|
+
/** Result of {@link useUnsavedChangesGuard}. */
|
|
2904
|
+
export declare interface UnsavedChangesGuardResult {
|
|
2905
|
+
/** Runs `action` immediately when nothing is dirty; otherwise defers it and opens the confirmation. */
|
|
2906
|
+
guard: (action: () => void) => void;
|
|
2907
|
+
/** Whether the discard confirmation should be shown. */
|
|
2908
|
+
isConfirmOpen: boolean;
|
|
2909
|
+
/** Closes the confirmation and runs the deferred action. */
|
|
2910
|
+
confirm: () => void;
|
|
2911
|
+
/** Closes the confirmation and drops the deferred action. */
|
|
2912
|
+
dismiss: () => void;
|
|
2913
|
+
}
|
|
2914
|
+
|
|
2903
2915
|
/** Result of successfully uploading an {@link Attachment}. */
|
|
2904
2916
|
export declare interface UploadedAttachmentResult {
|
|
2905
2917
|
/** The DIAL Core file URL the attachment was uploaded to. */
|
|
@@ -3039,4 +3051,7 @@ export declare interface UseTextRefinementOptions {
|
|
|
3039
3051
|
resetKey?: unknown;
|
|
3040
3052
|
}
|
|
3041
3053
|
|
|
3054
|
+
/** Defers leaving a form with unsaved changes until the user confirms, and asks the browser to warn before the page unloads. */
|
|
3055
|
+
export declare const useUnsavedChangesGuard: (isDirty: boolean) => UnsavedChangesGuardResult;
|
|
3056
|
+
|
|
3042
3057
|
export { }
|
package/index.js
CHANGED
|
@@ -65,10 +65,11 @@ import { MarkdownWithPlaceholders as _t } from "./components/MarkdownWithPlaceho
|
|
|
65
65
|
import { useCollapsedText as vt } from "./hooks/useCollapsedText.js";
|
|
66
66
|
import { useAvailableHeightCap as yt } from "./hooks/useAvailableHeightCap.js";
|
|
67
67
|
import { useIsMobile as bt } from "./hooks/useIsMobile.js";
|
|
68
|
-
import {
|
|
69
|
-
import {
|
|
70
|
-
import {
|
|
71
|
-
import {
|
|
72
|
-
import {
|
|
73
|
-
import {
|
|
74
|
-
|
|
68
|
+
import { useUnsavedChangesGuard as xt } from "./hooks/useUnsavedChangesGuard.js";
|
|
69
|
+
import { DialFileManagerActionProfile as St, DialFileManagerVariant as Ct } from "./file-manager/file-manager-variant.js";
|
|
70
|
+
import { getParentFolderPath as wt, isHiddenPath as Tt } from "./file-manager/path.js";
|
|
71
|
+
import { FileUploadStatus as Et, isUploadInProgress as Dt } from "./file-manager/upload-batch.js";
|
|
72
|
+
import { useGridEditingScroll as Ot } from "./file-manager/useGridEditingScroll/useGridEditingScroll.js";
|
|
73
|
+
import { OperationLoaderModal as kt } from "./file-manager/OperationLoaderModal/OperationLoaderModal.js";
|
|
74
|
+
import { isSkillSelectionUnsupported as At } from "./utils/is-skill-selection-unsupported.js";
|
|
75
|
+
export { p as AttachmentErrorReason, m as AttachmentType, ye as BASE_LG_ICON_PROPS, be as BASE_MD_ICON_PROPS, o as BackgroundGenerationStatus, nt as CHAT_SHARED_CLASS, pt as COMPACT_MARKDOWN_CLASS_NAMES, h as CatalogEntityType, v as CodeBlockTheme, Ze as ConfirmationDialog, Xe as ConfirmationFooter, qe as ConfirmationIdentityCard, Je as ConfirmationIdentityRow, Ye as ConfirmationView, e as ConversationTransferErrorCode, t as ConversationTransferJobStatus, n as ConversationTransferSubjectKind, r as ConversationTransferUnitKind, i as ConversationTransferWarningCode, Le as CopyButton, Re as CopyIconButton, mt as DEFAULT_MARKDOWN_CLASS_NAMES, ot as DEFAULT_MARKDOWN_TABLE_DOWNLOAD_FILENAME, je as DESKTOP_BREAKPOINT_PX, Me as DESKTOP_MEDIA_QUERY, Ie as DeploymentIcon, St as DialFileManagerActionProfile, Ct as DialFileManagerVariant, I as ENTITY_DESCRIPTION_MAX_LENGTH, L as ENTITY_INSTRUCTIONS_MAX_LENGTH, R as ENTITY_NAME_MAX_LENGTH, le as ENTITY_TYPE_BG_COLOR, ue as ENTITY_TYPE_COLOR, Ge as EntityHeader, Ue as EntityTypeLabel, We as FeaturedChip, g as FileExtension, Et as FileUploadStatus, a as FilterTab, xe as HIDDEN_FILE, Fe as InitialsAvatar, He as ItemHeader, we as MARKDOWN_EDITOR_FILL_HEIGHT_CLASS_NAME, Te as MARKDOWN_EDITOR_MAX_HEIGHT_CLASS_NAME, Oe as MARKDOWN_EDITOR_PREVIEW_LIST_CLASS_NAME, st as MARKDOWN_TABLE_CSV_MIME_TYPE, gt as MDMessageViewer, _ as MIMEType, y as MIME_TYPE_ALIASES, b as MIME_TYPE_AUDIO_PREFIX, x as MIME_TYPE_EXT_MAP, S as MIME_TYPE_WILDCARD, Ne as MOBILE_MAX_WIDTH_PX, Pe as MOBILE_MEDIA_QUERY, at as MarkdownCodeBlock, dt as MarkdownRenderer, ut as MarkdownTable, ct as MarkdownTableCopyFormat, _t as MarkdownWithPlaceholders, s as MessageRating, c as MessageRole, kt as OperationLoaderModal, j as PROHIBITED_CONVERSATION_NAME_CHARS_RE, de as PROMPT_PARAM_DEFAULT_SEPARATOR, fe as PROMPT_PARAM_PATTERN, pe as PROMPT_VARIABLE_CLASS_NAME, Se as PUBLIC_BUCKET, Ve as PanelEmptyState, ht as PlainTextRenderer, Ee as RESIZABLE_FIELD_MAX_HEIGHT_CSS_VARIABLE, De as RESIZABLE_TEXTAREA_CLASS_NAME, l as RequestStatus, Ke as ResourceSummary, f as ResponseFormat, ke as SELECT_LIST_MAX_HEIGHT_CLASS_NAME, Ae as SELECT_LIST_MAX_HEIGHT_PX, u as StageStatus, d as StatusEvent, Ce as TAG_INPUT_TAG_CLASS_NAME, Qe as TableHeader, tt as TextRefinementField, $e as TextRefinementState, te as base64ToBlob, H as buildCssVars, me as buildPromptParamDefaults, q as copyMarkdownAsRichText, J as copyToClipboard, ft as defaultMarkdownComponents, ne as downloadTextFile, re as ensureDownloadFilename, z as exceedsMaxLength, ze as extractInitials, he as extractPromptParams, Q as formatCost, Z as formatFileSize, X as formatLastUsed, $ as formatPrice, ee as formatUnitPrice, ve as generateUUID, C as getAttachmentTypeFromMime, w as getBaseMimeType, ie as getFileExtensionForLanguage, wt as getParentFolderPath, M as getUtf8ByteLength, B as hasControlCharacters, T as inferMimeTypeFromPath, O as isAnnotationSelector, K as isAudioTranscriptionSupported, Tt as isHiddenPath, At as isSkillSelectionUnsupported, U as isStatusMessage, ce as isSyntaxHighlightingAllowed, Dt as isUploadInProgress, Y as markdownToRichTextHtml, V as mergeClasses, W as messageAttachmentToDisplayAttachment, G as messageAttachmentsToDisplayAttachments, E as normalizeMimeType, k as normalizePersistedHtmlTagAttachmentType, A as normalizeRawAnnotations, Be as pickAvatarColor, ge as rehypePromptVariables, _e as resolvePromptParams, it as restrainedSyntaxTheme, N as sanitizeConversationName, lt as serializeMarkdownTableRows, P as stripTrailingDots, D as stripUrlQueryAndFragment, ae as triggerAnchorDownload, oe as triggerBlobDownload, F as truncateToUtf8Bytes, se as tryBase64ToBytes, yt as useAvailableHeightCap, rt as useCodeCopy, vt as useCollapsedText, Ot as useGridEditingScroll, bt as useIsMobile, et as useTextRefinement, xt as useUnsavedChangesGuard };
|
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.
|
|
4
|
+
"version": "1.2.0-dev.284",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"sideEffects": [
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@tabler/icons-react": "^3.44.0",
|
|
49
49
|
"classnames": "2.5.1",
|
|
50
50
|
"dompurify": "3.4.16",
|
|
51
|
-
"katex": "^0.
|
|
51
|
+
"katex": "^0.19.0",
|
|
52
52
|
"react-markdown": "^10.1.0",
|
|
53
53
|
"react-syntax-highlighter": "^16.1.1",
|
|
54
54
|
"rehype-katex": "^7.0.1",
|