@epam/ai-dial-conversation-messages 1.2.0-dev.28 → 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.
- package/components/MessageActions/MessageActions.d.ts +1 -1
- package/components/MessageActions/MessageActions.d.ts.map +1 -1
- package/components/MessageBubble/AssistantMessageBubble.d.ts.map +1 -1
- package/components/MessageBubble/MessageBubble.d.ts.map +1 -1
- package/components/MessageBubble/UserMessageBubble.d.ts.map +1 -1
- package/components/MessageSelectionReply/MessageSelectionReply.d.ts +55 -0
- package/components/MessageSelectionReply/MessageSelectionReply.d.ts.map +1 -0
- package/constants/public-class-names.d.ts +7 -0
- package/constants/public-class-names.d.ts.map +1 -0
- package/index.css +2 -2
- package/index.d.ts +3 -0
- package/index.d.ts.map +1 -1
- package/index.js +358 -235
- package/models/message-actions.d.ts +10 -4
- package/models/message-actions.d.ts.map +1 -1
- package/models/message-bubble.d.ts +38 -20
- package/models/message-bubble.d.ts.map +1 -1
- package/package.json +5 -4
- package/utils/clipboard.d.ts +11 -0
- package/utils/clipboard.d.ts.map +1 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { MessageActionsProps } from '../../models/message-actions';
|
|
3
|
-
/** Context-sensitive action bar — shows edit/delete for user messages and regenerate/copy/like/dislike for assistant messages. */
|
|
3
|
+
/** Context-sensitive action bar — shows copy/edit/delete for user messages and regenerate/copy/like/dislike for assistant messages. */
|
|
4
4
|
export declare const MessageActions: FC<MessageActionsProps>;
|
|
5
5
|
//# sourceMappingURL=MessageActions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageActions.d.ts","sourceRoot":"","sources":["../../../src/components/MessageActions/MessageActions.tsx"],"names":[],"mappings":"AAuBA,OAAO,EAAE,EAAE,EAAyB,MAAM,OAAO,CAAC;AAClD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAKxE,
|
|
1
|
+
{"version":3,"file":"MessageActions.d.ts","sourceRoot":"","sources":["../../../src/components/MessageActions/MessageActions.tsx"],"names":[],"mappings":"AAuBA,OAAO,EAAE,EAAE,EAAyB,MAAM,OAAO,CAAC;AAClD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAKxE,uIAAuI;AACvI,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CAuOlD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssistantMessageBubble.d.ts","sourceRoot":"","sources":["../../../src/components/MessageBubble/AssistantMessageBubble.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AssistantMessageBubble.d.ts","sourceRoot":"","sources":["../../../src/components/MessageBubble/AssistantMessageBubble.tsx"],"names":[],"mappings":"AAYA,OAAO,EAAE,EAAE,EAAW,MAAM,OAAO,CAAC;AAGpC,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAa/E,gHAAgH;AAChH,eAAO,MAAM,sBAAsB,EAAE,EAAE,CAAC,2BAA2B,CAwNlE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageBubble.d.ts","sourceRoot":"","sources":["../../../src/components/MessageBubble/MessageBubble.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAC3B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAKtE,wGAAwG;AACxG,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,
|
|
1
|
+
{"version":3,"file":"MessageBubble.d.ts","sourceRoot":"","sources":["../../../src/components/MessageBubble/MessageBubble.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAC3B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAKtE,wGAAwG;AACxG,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CAyChD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserMessageBubble.d.ts","sourceRoot":"","sources":["../../../src/components/MessageBubble/UserMessageBubble.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,EAAE,EAAS,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"UserMessageBubble.d.ts","sourceRoot":"","sources":["../../../src/components/MessageBubble/UserMessageBubble.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,EAAE,EAAS,MAAM,OAAO,CAAC;AAElC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAQ1E,kGAAkG;AAClG,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,CAgKxD,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { FC, RefObject } from 'react';
|
|
2
|
+
/** Color overrides for the Reply action. */
|
|
3
|
+
export interface MessageSelectionReplyColors {
|
|
4
|
+
/** Button background. Falls back to `--bg-layer-raised`. */
|
|
5
|
+
background?: string;
|
|
6
|
+
/** Hover background. Falls back to `--bg-layer-base`. */
|
|
7
|
+
hoverBackground?: string;
|
|
8
|
+
/** Label and icon color. Falls back to `--text-primary`. */
|
|
9
|
+
text?: string;
|
|
10
|
+
}
|
|
11
|
+
/** Typography overrides for the Reply action. */
|
|
12
|
+
export interface MessageSelectionReplyTypography {
|
|
13
|
+
/** Button label class. Defaults to `'dial-small-text'`. */
|
|
14
|
+
fontClassName?: string;
|
|
15
|
+
}
|
|
16
|
+
/** Appearance overrides for the Reply action. */
|
|
17
|
+
export interface MessageSelectionReplyStyles {
|
|
18
|
+
/** Button colors, applied as CSS custom properties. */
|
|
19
|
+
colors?: MessageSelectionReplyColors;
|
|
20
|
+
/** Button label typography. */
|
|
21
|
+
typography?: MessageSelectionReplyTypography;
|
|
22
|
+
/** Extra classes on the floating root, for example a host stacking level. */
|
|
23
|
+
className?: string;
|
|
24
|
+
/** Extra classes on the button. */
|
|
25
|
+
buttonClassName?: string;
|
|
26
|
+
}
|
|
27
|
+
/** Localized strings rendered by {@link MessageSelectionReply}. */
|
|
28
|
+
export interface MessageSelectionReplyLabels {
|
|
29
|
+
/** Visible and accessible Reply action label. */
|
|
30
|
+
reply: string;
|
|
31
|
+
/** Polite announcement when a selection becomes actionable. */
|
|
32
|
+
selectionAvailable: string;
|
|
33
|
+
/** Polite announcement after the composer accepts a Reply attachment. */
|
|
34
|
+
attachmentAdded: string;
|
|
35
|
+
}
|
|
36
|
+
/** Props accepted by {@link MessageSelectionReply}. */
|
|
37
|
+
export interface MessageSelectionReplyProps {
|
|
38
|
+
/** Visible selection rectangle. Omit to unmount the action. */
|
|
39
|
+
rect: DOMRect | undefined;
|
|
40
|
+
/** Receives the floating action root. */
|
|
41
|
+
actionRef: RefObject<HTMLDivElement | null>;
|
|
42
|
+
/** Creates an attachment from the captured selection. */
|
|
43
|
+
onReply: () => void;
|
|
44
|
+
/** Increments after the composer accepts a Reply attachment. */
|
|
45
|
+
addedRevision: number;
|
|
46
|
+
/** Localized button and announcement strings. */
|
|
47
|
+
labels: MessageSelectionReplyLabels;
|
|
48
|
+
/** Appearance overrides for the floating action. */
|
|
49
|
+
styles?: MessageSelectionReplyStyles;
|
|
50
|
+
/** Same-document portal destination. Defaults to `document.body`; null defers rendering. */
|
|
51
|
+
portalContainer?: HTMLElement | null;
|
|
52
|
+
}
|
|
53
|
+
/** Offers Reply beside a native selection while leaving browser selection controls intact. */
|
|
54
|
+
export declare const MessageSelectionReply: FC<MessageSelectionReplyProps>;
|
|
55
|
+
//# sourceMappingURL=MessageSelectionReply.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MessageSelectionReply.d.ts","sourceRoot":"","sources":["../../../src/components/MessageSelectionReply/MessageSelectionReply.tsx"],"names":[],"mappings":"AAQA,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,IAAI,CAAC;CACtC;AAED,8FAA8F;AAC9F,eAAO,MAAM,qBAAqB,EAAE,EAAE,CAAC,0BAA0B,CAmGhE,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const CONVERSATION_MESSAGES_CLASS: {
|
|
2
|
+
/** The user message's bubble element. */
|
|
3
|
+
readonly userBubble: "dial-cm-user-bubble";
|
|
4
|
+
/** The assistant message's streamed content region. */
|
|
5
|
+
readonly assistantContent: "dial-cm-assistant-content";
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=public-class-names.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-class-names.d.ts","sourceRoot":"","sources":["../../src/constants/public-class-names.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,2BAA2B;IACtC,yCAAyC;;IAEzC,uDAAuD;;CAE/C,CAAC"}
|
package/index.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
._activeRating_ygoee_1{color:var(--ma-active-rating-text,var(--text-accent,#1d4ed8))}._userBubble_cq829_1{border-color:var(--cm-bubble-user-border,var(--stroke-secondary,#d1dbea));background:var(--cm-bubble-user-bg,var(--bg-layer-sunken,#eef1f7))}._collapsibleText_cq829_6{max-height:var(--cm-bubble-collapsed-height);transition:max-height .2s ease-out}._expandedText_cq829_11{max-height:var(--cm-bubble-expanded-height)}._collapsedText_cq829_15:after{content:"";pointer-events:none;background:linear-gradient(to bottom, var(--cm-bubble-fade-start,var(--shadow-xs-2,#161b2d08)), var(--cm-bubble-user-bg,var(--bg-layer-sunken,#eef1f7)));height:3rem;position:absolute;bottom:0;left:0;right:0}@media (prefers-reduced-motion:reduce){._collapsibleText_cq829_6{transition:none}}._startersDivider_cq829_26{border-color:var(--cm-starters-divider,var(--stroke-secondary,#d1dbea))}._text_cq829_30{color:var(--cm-bubble-text,var(--text-primary,#161b2d))}
|
|
2
|
-
/*$vite$:1*/.sr-only{height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;clip:rect(0,0,0,0);border-width:0;white-space:nowrap}.collapse{visibility:collapse}.static{position:static}.absolute{position:absolute}.relative{position:relative}.start-0{inset-inline-start:0}.top-0{top:0}.me-1{margin-inline-end
|
|
1
|
+
._activeRating_ygoee_1{color:var(--ma-active-rating-text,var(--text-accent,#1d4ed8))}._userBubble_cq829_1{border-color:var(--cm-bubble-user-border,var(--stroke-secondary,#d1dbea));background:var(--cm-bubble-user-bg,var(--bg-layer-sunken,#eef1f7))}._collapsibleText_cq829_6{max-height:var(--cm-bubble-collapsed-height);transition:max-height .2s ease-out}._expandedText_cq829_11{max-height:var(--cm-bubble-expanded-height)}._collapsedText_cq829_15:after{content:"";pointer-events:none;background:linear-gradient(to bottom, var(--cm-bubble-fade-start,var(--shadow-xs-2,#161b2d08)), var(--cm-bubble-user-bg,var(--bg-layer-sunken,#eef1f7)));height:3rem;position:absolute;bottom:0;left:0;right:0}@media (prefers-reduced-motion:reduce){._collapsibleText_cq829_6{transition:none}}._startersDivider_cq829_26{border-color:var(--cm-starters-divider,var(--stroke-secondary,#d1dbea))}._text_cq829_30{color:var(--cm-bubble-text,var(--text-primary,#161b2d))}._button_tqo4d_3._button_tqo4d_3{color:var(--cm-reply-text,var(--text-primary,#161b2d));background:var(--cm-reply-background,var(--bg-layer-raised,#fcfcfc))!important}._button_tqo4d_3._button_tqo4d_3:hover{color:var(--cm-reply-text,var(--text-primary,#161b2d));background:var(--cm-reply-hover-background,var(--bg-layer-base,#f5f7fa))!important}
|
|
2
|
+
/*$vite$:1*/.sr-only{height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;clip:rect(0,0,0,0);border-width:0;white-space:nowrap}.collapse{visibility:collapse}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.left-0{left:0}.start-0{inset-inline-start:0}.top-0{top:0}.z-50{z-index:50}.-me-1{margin-inline-end:-.25rem}.-ms-1{margin-inline-start:-.25rem}.ms-auto{margin-inline-start:auto}.mt-3{margin-top:.75rem}.block{display:block}.inline{display:inline}.flex{display:flex}.table{display:table}.h-8{height:2rem}.min-h-8{min-height:2rem}.w-\[calc\(100\%\+8px\)\]{width:calc(100% + 8px)}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.min-w-0{min-width:0}.min-w-11{min-width:2.75rem}.min-w-\[40px\]{min-width:40px}.max-w-\[640px\]{max-width:640px}.max-w-\[calc\(100vw-16px\)\]{max-width:calc(100vw - 16px)}.max-w-full{max-width:100%}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.resize{resize:both}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-end{justify-content:flex-end}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-5{gap:1.25rem}.overflow-hidden{overflow:hidden}.whitespace-pre-wrap{white-space:pre-wrap}.rounded-ee-2xl{border-end-end-radius:1rem}.rounded-ee-md{border-end-end-radius:.375rem}.rounded-es-2xl{border-end-start-radius:1rem}.rounded-se-2xl{border-start-end-radius:1rem}.rounded-se-md{border-start-end-radius:.375rem}.rounded-ss-2xl{border-start-start-radius:1rem}.border{border-width:1px}.border-t{border-top-width:1px}.px-2{padding-left:.5rem;padding-right:.5rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-4{padding-bottom:1rem;padding-top:1rem}.pe-1{padding-inline-end:.25rem}.ps-1{padding-inline-start:.25rem}.pt-5{padding-top:1.25rem}.text-start{text-align:start}.opacity-0{opacity:0}.shadow-lg{--tw-shadow:0 8px 44px 0 var(--shadow-lg,#2764d914);--tw-shadow-colored:0 8px 44px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.\[overflow-wrap\:anywhere\]{overflow-wrap:anywhere}.group:hover .group-hover\:opacity-100{opacity:1}@media (max-width:1279px){.mobile\:h-11{height:2.75rem}.mobile\:min-h-11{min-height:2.75rem}}.rtl\:scale-x-\[-1\]:where([dir=rtl],[dir=rtl] *){--tw-scale-x:-1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>\.cm-bubble-markdown\>div\>\*\:first-child\]\:indent-\[var\(--cm-bubble-first-line-indent\2c 0px\)\]>.cm-bubble-markdown>div>:first-child{text-indent:var(--cm-bubble-first-line-indent,0)}
|
package/index.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
export { CONVERSATION_MESSAGES_CLASS } from './constants/public-class-names';
|
|
1
2
|
export { MessageBubble } from './components/MessageBubble/MessageBubble';
|
|
2
3
|
export { UserMessageBubble } from './components/MessageBubble/UserMessageBubble';
|
|
3
4
|
export { AssistantMessageBubble } from './components/MessageBubble/AssistantMessageBubble';
|
|
4
5
|
export { StatusMessageBubble } from './components/MessageBubble/StatusMessageBubble';
|
|
5
6
|
export { MessageActions } from './components/MessageActions/MessageActions';
|
|
7
|
+
export { MessageSelectionReply } from './components/MessageSelectionReply/MessageSelectionReply';
|
|
6
8
|
export { BubblePosition } from './types/bubble-position';
|
|
7
9
|
export type { MessageBubbleProps, UserMessageBubbleProps, AssistantMessageBubbleProps, MessageBubbleStyles, MessageBubbleColors, MessageBubbleTypography, MessageBubbleLabels, AssistantMessageBubbleLabels, } from './models/message-bubble';
|
|
10
|
+
export type { MessageSelectionReplyColors, MessageSelectionReplyLabels, MessageSelectionReplyProps, MessageSelectionReplyStyles, MessageSelectionReplyTypography, } from './components/MessageSelectionReply/MessageSelectionReply';
|
|
8
11
|
export type { StatusMessageBubbleLabels, StatusMessageBubbleProps, } from './components/MessageBubble/StatusMessageBubble';
|
|
9
12
|
export type { MessageActionsProps, MessageActionColors, MessageActionLabels, MessageActionTooltips, MessageActionAriaLabels, } from './models/message-actions';
|
|
10
13
|
export type { MessageSourceProps, MessageSourceLabels, MessageSourceStyles, MessageSourceColors, MessageSourceTypography, } from './models/message-source';
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAC;AACjF,OAAO,EAAE,sBAAsB,EAAE,MAAM,mDAAmD,CAAC;AAC3F,OAAO,EAAE,mBAAmB,EAAE,MAAM,gDAAgD,CAAC;AACrF,OAAO,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,YAAY,EACV,kBAAkB,EAClB,sBAAsB,EACtB,2BAA2B,EAC3B,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACvB,mBAAmB,EACnB,4BAA4B,GAC7B,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACV,yBAAyB,EACzB,wBAAwB,GACzB,MAAM,gDAAgD,CAAC;AACxD,YAAY,EACV,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EACV,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,yBAAyB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAC;AACjF,OAAO,EAAE,sBAAsB,EAAE,MAAM,mDAAmD,CAAC;AAC3F,OAAO,EAAE,mBAAmB,EAAE,MAAM,gDAAgD,CAAC;AACrF,OAAO,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAC5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,0DAA0D,CAAC;AACjG,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,YAAY,EACV,kBAAkB,EAClB,sBAAsB,EACtB,2BAA2B,EAC3B,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACvB,mBAAmB,EACnB,4BAA4B,GAC7B,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACV,2BAA2B,EAC3B,2BAA2B,EAC3B,0BAA0B,EAC1B,2BAA2B,EAC3B,+BAA+B,GAChC,MAAM,0DAA0D,CAAC;AAClE,YAAY,EACV,yBAAyB,EACzB,wBAAwB,GACzB,MAAM,gDAAgD,CAAC;AACxD,YAAY,EACV,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EACV,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,yBAAyB,CAAC"}
|
package/index.js
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import { AttachmentType as e, CopyIconButton as t, DeploymentIcon as n, MDMessageViewer as r, MessageRating as i, MessageRole as a,
|
|
2
|
-
import { AttachmentGroup as
|
|
3
|
-
import { DIAL_ICON_SIZE as
|
|
4
|
-
import { useCallback as
|
|
5
|
-
import { IconChevronDown as
|
|
6
|
-
import { Fragment as
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { AttachmentType as e, CopyIconButton as t, DeploymentIcon as n, MDMessageViewer as r, MessageRating as i, MessageRole as a, ResponseFormat as o, buildCssVars as s, mergeClasses as c, useCollapsedText as l } from "@epam/ai-dial-chat-shared";
|
|
2
|
+
import { AttachmentGroup as u } from "@epam/ai-dial-attachment-input";
|
|
3
|
+
import { Button as d, ButtonVariant as f, DIAL_ICON_SIZE as p, DIAL_KIT_ICON_STROKE as m, ElementSize as h, GhostIconButton as g, InfoMessageNotification as _, LinkButton as v, NeutralButton as y } from "@epam/ai-dial-ui-kit";
|
|
4
|
+
import { useCallback as b, useEffect as x, useId as S, useLayoutEffect as C, useMemo as ee, useRef as w, useState as T } from "react";
|
|
5
|
+
import { IconArrowBackUp as E, IconChevronDown as D, IconChevronUp as O, IconMarkdown as k, IconPencilMinus as A, IconRefresh as j, IconThumbDown as M, IconThumbDownFilled as te, IconThumbUp as N, IconThumbUpFilled as ne, IconTrashX as re } from "@tabler/icons-react";
|
|
6
|
+
import { Fragment as P, jsx as F, jsxs as I } from "react/jsx-runtime";
|
|
7
|
+
import { createPortal as L } from "react-dom";
|
|
8
|
+
//#region src/constants/public-class-names.ts
|
|
9
|
+
var R = {
|
|
10
|
+
userBubble: "dial-cm-user-bubble",
|
|
11
|
+
assistantContent: "dial-cm-assistant-content"
|
|
12
|
+
}, z = 4, B = (e) => {
|
|
13
|
+
let t = w(null), [n, r] = T(0);
|
|
14
|
+
return x(() => {
|
|
11
15
|
if (!e) return;
|
|
12
16
|
let n = t.current;
|
|
13
17
|
if (n == null) return;
|
|
@@ -18,328 +22,447 @@ var I = 4, L = (e) => {
|
|
|
18
22
|
return i.observe(n), () => i.disconnect();
|
|
19
23
|
}, [e]), {
|
|
20
24
|
slotRef: t,
|
|
21
|
-
firstLineIndent: e ? `calc(${n}px + ${
|
|
25
|
+
firstLineIndent: e ? `calc(${n}px + ${z}px)` : void 0
|
|
22
26
|
};
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
}, V = [
|
|
28
|
+
"href",
|
|
29
|
+
"src",
|
|
30
|
+
"alt",
|
|
31
|
+
"colspan",
|
|
32
|
+
"rowspan",
|
|
33
|
+
"start"
|
|
34
|
+
], H = new Set([
|
|
35
|
+
"pre",
|
|
36
|
+
"pre-wrap",
|
|
37
|
+
"pre-line",
|
|
38
|
+
"break-spaces"
|
|
39
|
+
]), U = (e) => {
|
|
40
|
+
let t = document.createElement(e.tagName.toLowerCase());
|
|
41
|
+
V.forEach((n) => {
|
|
42
|
+
let r = e.getAttribute(n);
|
|
43
|
+
r !== null && t.setAttribute(n, r);
|
|
44
|
+
});
|
|
45
|
+
let { whiteSpace: n } = window.getComputedStyle(e);
|
|
46
|
+
return H.has(n) && (t.style.whiteSpace = "pre-wrap"), t;
|
|
47
|
+
}, W = (e) => e instanceof SVGElement || window.getComputedStyle(e).display === "none", G = (e, t) => {
|
|
48
|
+
if (!t.intersectsNode(e)) return null;
|
|
49
|
+
if (e.nodeType === Node.TEXT_NODE) {
|
|
50
|
+
let n = e.data, r = e === t.startContainer ? t.startOffset : 0, i = e === t.endContainer ? t.endOffset : n.length;
|
|
51
|
+
return document.createTextNode(n.slice(r, i));
|
|
52
|
+
}
|
|
53
|
+
if (!(e instanceof Element) || W(e)) return null;
|
|
54
|
+
let n = U(e);
|
|
55
|
+
return e.childNodes.forEach((e) => {
|
|
56
|
+
let r = G(e, t);
|
|
57
|
+
r && n.appendChild(r);
|
|
58
|
+
}), n;
|
|
59
|
+
}, K = (e, t, n) => {
|
|
60
|
+
let r = e, i = t;
|
|
61
|
+
for (; i && i !== n && n.contains(i);) {
|
|
62
|
+
let e = U(i);
|
|
63
|
+
e.appendChild(r), r = e, i = i.parentElement;
|
|
64
|
+
}
|
|
65
|
+
return r;
|
|
66
|
+
}, q = (e, t) => {
|
|
67
|
+
let n = e.commonAncestorContainer, r = n instanceof Element ? n : n.parentElement;
|
|
68
|
+
if (!r) return null;
|
|
69
|
+
let i = G(r, e);
|
|
70
|
+
return i ? K(i, r.parentElement, t) : null;
|
|
71
|
+
}, ie = (e) => {
|
|
72
|
+
let t = window.getSelection();
|
|
73
|
+
if (!t || t.isCollapsed || t.rangeCount === 0 || !e.clipboardData) return;
|
|
74
|
+
let n = t.toString();
|
|
75
|
+
if (!n) return;
|
|
76
|
+
let r = document.createElement("div");
|
|
77
|
+
for (let n = 0; n < t.rangeCount; n++) {
|
|
78
|
+
let i = q(t.getRangeAt(n), e.currentTarget);
|
|
79
|
+
i && r.appendChild(i);
|
|
80
|
+
}
|
|
81
|
+
e.clipboardData.setData("text/html", r.innerHTML), e.clipboardData.setData("text/plain", n), e.preventDefault();
|
|
82
|
+
}, J = { activeRating: "_activeRating_ygoee_1" }, Y = 2e3, ae = ({ role: e = a.User, onEdit: n, onEditHover: r, onDelete: o, onRegenerate: l, onCopy: u, onCopyMarkdown: d, onLike: f, onDislike: _, activeRating: v, isAlwaysVisible: y, isDisabled: x = !1, className: S, labels: C, colors: ee }) => {
|
|
83
|
+
let { tooltips: w, ariaLabels: E } = C ?? {}, [D, O] = T(null), [L, R] = T(""), z = n != null || o != null || l != null || u != null || d != null || f != null || _ != null, B = s({ "--ma-active-rating-text": ee?.activeRatingText }), V = b(() => {
|
|
84
|
+
u?.(), O("copy"), R(e === a.User ? E?.copiedMessageStatus ?? "Message copied to clipboard" : E?.copiedStatus ?? "Copied to clipboard"), setTimeout(() => O(null), Y);
|
|
85
|
+
}, [
|
|
86
|
+
u,
|
|
87
|
+
e,
|
|
88
|
+
E?.copiedStatus,
|
|
89
|
+
E?.copiedMessageStatus
|
|
90
|
+
]), H = b(() => {
|
|
91
|
+
d?.(), O("markdown"), R(E?.copiedMarkdownStatus ?? "Copied as Markdown to clipboard"), setTimeout(() => O(null), Y);
|
|
92
|
+
}, [d, E?.copiedMarkdownStatus]);
|
|
93
|
+
return z ? /* @__PURE__ */ I("div", {
|
|
30
94
|
role: "toolbar",
|
|
31
|
-
"aria-label":
|
|
32
|
-
style:
|
|
33
|
-
className:
|
|
34
|
-
children: [/* @__PURE__ */
|
|
95
|
+
"aria-label": E?.actionsGroup ?? "Message actions",
|
|
96
|
+
style: B,
|
|
97
|
+
className: c("flex gap-1", !y && "opacity-0 group-hover:opacity-100", S),
|
|
98
|
+
children: [/* @__PURE__ */ F("span", {
|
|
35
99
|
role: "status",
|
|
36
100
|
"aria-live": "polite",
|
|
37
101
|
className: "sr-only",
|
|
38
|
-
children:
|
|
39
|
-
}), e === a.User ? /* @__PURE__ */
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
102
|
+
children: L
|
|
103
|
+
}), e === a.User ? /* @__PURE__ */ I(P, { children: [
|
|
104
|
+
u && /* @__PURE__ */ F(t, {
|
|
105
|
+
iconSize: p.SM,
|
|
106
|
+
onClick: V,
|
|
107
|
+
size: h.Small,
|
|
108
|
+
isCopied: D === "copy",
|
|
109
|
+
copyLabel: w?.copyMessage ?? "Copy message",
|
|
110
|
+
copiedLabel: w?.copied ?? "Copied!",
|
|
111
|
+
ariaLabel: E?.copyMessage ?? "Copy message",
|
|
112
|
+
isDisabled: x
|
|
44
113
|
}),
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
114
|
+
n && /* @__PURE__ */ F(g, {
|
|
115
|
+
icon: /* @__PURE__ */ F(A, {
|
|
116
|
+
size: p.SM,
|
|
117
|
+
"aria-hidden": !0,
|
|
118
|
+
stroke: m
|
|
119
|
+
}),
|
|
120
|
+
size: h.Small,
|
|
121
|
+
"aria-label": E?.editMessage ?? "Edit message",
|
|
122
|
+
tooltipProps: { tooltip: w?.edit ?? "Edit" },
|
|
123
|
+
onClick: n,
|
|
124
|
+
onMouseEnter: r,
|
|
125
|
+
onFocus: r,
|
|
126
|
+
disabled: x
|
|
57
127
|
}),
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
onClick: c,
|
|
62
|
-
disabled: x
|
|
63
|
-
})] }) : /* @__PURE__ */ F(N, { children: [
|
|
64
|
-
l && /* @__PURE__ */ P(g, {
|
|
65
|
-
icon: /* @__PURE__ */ P(D, {
|
|
66
|
-
size: u.SM,
|
|
128
|
+
o && /* @__PURE__ */ F(g, {
|
|
129
|
+
icon: /* @__PURE__ */ F(re, {
|
|
130
|
+
size: p.SM,
|
|
67
131
|
"aria-hidden": !0,
|
|
68
|
-
stroke:
|
|
132
|
+
stroke: m
|
|
69
133
|
}),
|
|
70
|
-
size:
|
|
71
|
-
"aria-label":
|
|
72
|
-
tooltipProps: { tooltip:
|
|
134
|
+
size: h.Small,
|
|
135
|
+
"aria-label": E?.deleteMessage ?? "Delete message",
|
|
136
|
+
tooltipProps: { tooltip: w?.delete ?? "Delete" },
|
|
137
|
+
onClick: o,
|
|
138
|
+
disabled: x
|
|
139
|
+
})
|
|
140
|
+
] }) : /* @__PURE__ */ I(P, { children: [
|
|
141
|
+
l && /* @__PURE__ */ F(g, {
|
|
142
|
+
icon: /* @__PURE__ */ F(j, {
|
|
143
|
+
size: p.SM,
|
|
144
|
+
"aria-hidden": !0,
|
|
145
|
+
stroke: m
|
|
146
|
+
}),
|
|
147
|
+
size: h.Small,
|
|
148
|
+
"aria-label": E?.regenerateResponse ?? "Regenerate response",
|
|
149
|
+
tooltipProps: { tooltip: w?.regenerate ?? "Regenerate" },
|
|
73
150
|
onClick: l,
|
|
74
151
|
disabled: x
|
|
75
152
|
}),
|
|
76
|
-
|
|
77
|
-
iconSize:
|
|
78
|
-
onClick:
|
|
79
|
-
size:
|
|
80
|
-
isCopied:
|
|
81
|
-
copyLabel:
|
|
82
|
-
copiedLabel:
|
|
83
|
-
ariaLabel:
|
|
153
|
+
u && /* @__PURE__ */ F(t, {
|
|
154
|
+
iconSize: p.SM,
|
|
155
|
+
onClick: V,
|
|
156
|
+
size: h.Small,
|
|
157
|
+
isCopied: D === "copy",
|
|
158
|
+
copyLabel: w?.copy ?? "Copy",
|
|
159
|
+
copiedLabel: w?.copied ?? "Copied!",
|
|
160
|
+
ariaLabel: E?.copyResponse ?? "Copy response",
|
|
84
161
|
isDisabled: x
|
|
85
162
|
}),
|
|
86
|
-
|
|
87
|
-
iconSize:
|
|
88
|
-
onClick:
|
|
89
|
-
size:
|
|
90
|
-
isCopied:
|
|
91
|
-
iconCopy: /* @__PURE__ */
|
|
92
|
-
size:
|
|
163
|
+
d && /* @__PURE__ */ F(t, {
|
|
164
|
+
iconSize: p.SM,
|
|
165
|
+
onClick: H,
|
|
166
|
+
size: h.Small,
|
|
167
|
+
isCopied: D === "markdown",
|
|
168
|
+
iconCopy: /* @__PURE__ */ F(k, {
|
|
169
|
+
size: p.SM,
|
|
93
170
|
"aria-hidden": !0,
|
|
94
|
-
stroke:
|
|
171
|
+
stroke: m
|
|
95
172
|
}),
|
|
96
|
-
copyLabel:
|
|
97
|
-
copiedLabel:
|
|
98
|
-
ariaLabel:
|
|
173
|
+
copyLabel: w?.copyMarkdown ?? "Copy as Markdown",
|
|
174
|
+
copiedLabel: w?.copiedMarkdown ?? "Copied!",
|
|
175
|
+
ariaLabel: E?.copyAsMarkdown ?? "Copy as markdown",
|
|
99
176
|
isDisabled: x
|
|
100
177
|
}),
|
|
101
|
-
|
|
102
|
-
icon:
|
|
103
|
-
className:
|
|
104
|
-
size:
|
|
178
|
+
f && /* @__PURE__ */ F(g, {
|
|
179
|
+
icon: v === i.Like ? /* @__PURE__ */ F(ne, {
|
|
180
|
+
className: J.activeRating,
|
|
181
|
+
size: p.SM,
|
|
105
182
|
"aria-hidden": !0
|
|
106
|
-
}) : /* @__PURE__ */
|
|
107
|
-
size:
|
|
183
|
+
}) : /* @__PURE__ */ F(N, {
|
|
184
|
+
size: p.SM,
|
|
108
185
|
"aria-hidden": !0,
|
|
109
|
-
stroke:
|
|
186
|
+
stroke: m
|
|
110
187
|
}),
|
|
111
|
-
size:
|
|
112
|
-
"aria-label":
|
|
113
|
-
"aria-pressed":
|
|
114
|
-
tooltipProps: { tooltip:
|
|
115
|
-
onClick:
|
|
188
|
+
size: h.Small,
|
|
189
|
+
"aria-label": E?.likeResponse ?? "Like response",
|
|
190
|
+
"aria-pressed": v === i.Like,
|
|
191
|
+
tooltipProps: { tooltip: w?.like ?? "Like" },
|
|
192
|
+
onClick: f,
|
|
116
193
|
disabled: x
|
|
117
194
|
}),
|
|
118
|
-
|
|
119
|
-
icon:
|
|
120
|
-
className:
|
|
121
|
-
size:
|
|
195
|
+
_ && /* @__PURE__ */ F(g, {
|
|
196
|
+
icon: v === i.Dislike ? /* @__PURE__ */ F(te, {
|
|
197
|
+
className: J.activeRating,
|
|
198
|
+
size: p.SM,
|
|
122
199
|
"aria-hidden": !0
|
|
123
|
-
}) : /* @__PURE__ */
|
|
124
|
-
size:
|
|
200
|
+
}) : /* @__PURE__ */ F(M, {
|
|
201
|
+
size: p.SM,
|
|
125
202
|
"aria-hidden": !0,
|
|
126
|
-
stroke:
|
|
203
|
+
stroke: m
|
|
127
204
|
}),
|
|
128
|
-
size:
|
|
129
|
-
"aria-label":
|
|
130
|
-
"aria-pressed":
|
|
131
|
-
tooltipProps: { tooltip:
|
|
132
|
-
onClick:
|
|
205
|
+
size: h.Small,
|
|
206
|
+
"aria-label": E?.dislikeResponse ?? "Dislike response",
|
|
207
|
+
"aria-pressed": v === i.Dislike,
|
|
208
|
+
tooltipProps: { tooltip: w?.dislike ?? "Dislike" },
|
|
209
|
+
onClick: _,
|
|
133
210
|
disabled: x
|
|
134
211
|
})
|
|
135
212
|
] })]
|
|
136
213
|
}) : null;
|
|
137
|
-
},
|
|
214
|
+
}, X = {
|
|
138
215
|
userBubble: "_userBubble_cq829_1",
|
|
139
216
|
collapsibleText: "_collapsibleText_cq829_6",
|
|
140
217
|
expandedText: "_expandedText_cq829_11",
|
|
141
218
|
collapsedText: "_collapsedText_cq829_15",
|
|
142
219
|
startersDivider: "_startersDivider_cq829_26",
|
|
143
220
|
text: "_text_cq829_30"
|
|
144
|
-
},
|
|
145
|
-
let { colors:
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
downloadCsvLabel: Q,
|
|
151
|
-
openInCanvasLabel: $
|
|
221
|
+
}, oe = "[&>.cm-bubble-markdown>div>*:first-child]:indent-[var(--cm-bubble-first-line-indent,0px)]", Z = ({ text: t, contentRef: i, styles: l, actions: d, hasAlwaysVisibleActions: f, isStreaming: p, attachments: m, beforeContent: h, responseFormat: g, afterContent: _, hasThinkingPlaceholder: v = !0, starters: b, onSelectStarter: x, deploymentIconUrl: S, deploymentDisplayName: C, markdownComponents: w, markdownClassNames: T, markdownUrlTransform: E, onAttachmentClick: D, onDownloadAll: O, onAttachmentRetry: k, codeBlockTheme: A, tableOnOpenInCanvas: j, labels: M, selectedAttachmentId: te }) => {
|
|
222
|
+
let { colors: N, typography: ne, className: re, bubbleClassName: P } = l ?? {}, { attachmentClickLabel: L, attachmentRetryLabel: z, attachmentOpenInNewTabLabel: V, startersAriaLabel: H = "Quick reply buttons", thinkingLabel: U, codeBlockCopyLabel: W, codeBlockCopiedLabel: G, tableCopyLabel: K, tableCopiedLabel: q, tableDownloadCsvLabel: J, tableOpenInCanvasLabel: Y, tableDownloadFilename: Z, tableScrollRegionAriaLabel: Q, assistantMessageAriaLabel: $ = "Assistant message", deploymentIconFallbackLabel: se = "AI" } = M ?? {}, ce = ee(() => ({
|
|
223
|
+
copyLabel: K,
|
|
224
|
+
copiedLabel: q,
|
|
225
|
+
downloadCsvLabel: J,
|
|
226
|
+
openInCanvasLabel: Y
|
|
152
227
|
}), [
|
|
228
|
+
K,
|
|
229
|
+
q,
|
|
153
230
|
J,
|
|
154
|
-
Y
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
"--cm-starters-divider": j?.startersDivider,
|
|
162
|
-
"--cm-bubble-first-line-indent": se
|
|
163
|
-
}), le = s(V.text, M?.fontClassName), ue = !!(v || y);
|
|
164
|
-
return /* @__PURE__ */ F("div", {
|
|
231
|
+
Y
|
|
232
|
+
]), le = p ? (m ?? []).filter((t) => t.type !== e.Audio) : m ?? [], { slotRef: ue, firstLineIndent: de } = B(h != null && !!t), fe = s({
|
|
233
|
+
"--cm-bubble-text": N?.text,
|
|
234
|
+
"--cm-starters-divider": N?.startersDivider,
|
|
235
|
+
"--cm-bubble-first-line-indent": de
|
|
236
|
+
}), pe = c(X.text, ne?.fontClassName), me = !!(S || C);
|
|
237
|
+
return /* @__PURE__ */ I("div", {
|
|
165
238
|
role: "group",
|
|
166
|
-
"aria-label":
|
|
167
|
-
style:
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
239
|
+
"aria-label": $,
|
|
240
|
+
style: fe,
|
|
241
|
+
onCopy: ie,
|
|
242
|
+
className: c("flex w-full items-start gap-3", re),
|
|
243
|
+
children: [me && /* @__PURE__ */ F(n, {
|
|
244
|
+
src: S,
|
|
171
245
|
size: 28,
|
|
172
|
-
initialsName:
|
|
173
|
-
labels: { tooltip:
|
|
174
|
-
}), /* @__PURE__ */
|
|
246
|
+
initialsName: C || se,
|
|
247
|
+
labels: { tooltip: C ?? se }
|
|
248
|
+
}), /* @__PURE__ */ I("div", {
|
|
175
249
|
className: "flex w-full min-w-0 max-w-full flex-col items-start gap-5",
|
|
176
|
-
children: [/* @__PURE__ */
|
|
177
|
-
className:
|
|
250
|
+
children: [/* @__PURE__ */ I("div", {
|
|
251
|
+
className: c("flex w-full min-w-0 max-w-full flex-col items-start gap-4", P),
|
|
178
252
|
children: [
|
|
179
|
-
|
|
253
|
+
h != null && !t && /* @__PURE__ */ F("div", {
|
|
180
254
|
className: "min-w-0",
|
|
181
|
-
children:
|
|
255
|
+
children: h
|
|
182
256
|
}),
|
|
183
|
-
(t ||
|
|
257
|
+
(t || p && v) && /* @__PURE__ */ I("div", {
|
|
184
258
|
"aria-live": "polite",
|
|
185
259
|
"aria-atomic": "false",
|
|
186
|
-
className:
|
|
187
|
-
children: [
|
|
188
|
-
ref:
|
|
260
|
+
className: c(pe, "relative min-w-0 max-w-full text-start", h != null && t && oe, R.assistantContent),
|
|
261
|
+
children: [h != null && t && /* @__PURE__ */ F("div", {
|
|
262
|
+
ref: ue,
|
|
189
263
|
className: "absolute start-0 top-0",
|
|
190
|
-
children:
|
|
191
|
-
}), /* @__PURE__ */
|
|
264
|
+
children: h
|
|
265
|
+
}), /* @__PURE__ */ F("div", {
|
|
266
|
+
ref: i,
|
|
192
267
|
className: "cm-bubble-markdown min-w-0 max-w-full",
|
|
193
|
-
children: /* @__PURE__ */
|
|
268
|
+
children: /* @__PURE__ */ F(r, {
|
|
194
269
|
content: t ?? "",
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
270
|
+
isPlainText: g === o.PlainText,
|
|
271
|
+
isStreaming: p,
|
|
272
|
+
thinkingLabel: U,
|
|
273
|
+
components: w,
|
|
274
|
+
classNames: T,
|
|
275
|
+
urlTransform: E,
|
|
276
|
+
codeBlockCopyLabel: W,
|
|
277
|
+
codeBlockCopiedLabel: G,
|
|
278
|
+
codeBlockTheme: A,
|
|
279
|
+
tableActionLabels: ce,
|
|
280
|
+
tableDownloadFilename: Z,
|
|
281
|
+
tableOnOpenInCanvas: j,
|
|
282
|
+
tableScrollRegionAriaLabel: Q
|
|
207
283
|
})
|
|
208
284
|
})]
|
|
209
285
|
}),
|
|
210
|
-
/* @__PURE__ */
|
|
211
|
-
attachments:
|
|
212
|
-
onAttachmentClick: (e) =>
|
|
213
|
-
onDownloadAll:
|
|
214
|
-
onRetry:
|
|
286
|
+
/* @__PURE__ */ F(u, {
|
|
287
|
+
attachments: le,
|
|
288
|
+
onAttachmentClick: (e) => D?.(m?.find((t) => t.id === e)),
|
|
289
|
+
onDownloadAll: O,
|
|
290
|
+
onRetry: k,
|
|
215
291
|
labels: {
|
|
216
|
-
clickLabel:
|
|
292
|
+
clickLabel: L,
|
|
217
293
|
retryLabel: z,
|
|
218
|
-
openInNewTabLabel:
|
|
294
|
+
openInNewTabLabel: V
|
|
219
295
|
},
|
|
220
|
-
selectedAttachmentId:
|
|
296
|
+
selectedAttachmentId: te
|
|
221
297
|
}),
|
|
222
|
-
|
|
223
|
-
/* @__PURE__ */
|
|
224
|
-
...
|
|
225
|
-
isAlwaysVisible:
|
|
298
|
+
_,
|
|
299
|
+
/* @__PURE__ */ F(ae, {
|
|
300
|
+
...d,
|
|
301
|
+
isAlwaysVisible: f,
|
|
226
302
|
role: a.Assistant
|
|
227
303
|
})
|
|
228
304
|
]
|
|
229
|
-
}),
|
|
305
|
+
}), b && b.length > 0 && x && /* @__PURE__ */ F("div", {
|
|
230
306
|
role: "list",
|
|
231
|
-
"aria-label":
|
|
232
|
-
className:
|
|
233
|
-
children:
|
|
307
|
+
"aria-label": H,
|
|
308
|
+
className: c("flex w-full flex-wrap gap-2 border-t pt-5", X.startersDivider),
|
|
309
|
+
children: b.map((e, t) => /* @__PURE__ */ F("div", {
|
|
234
310
|
role: "listitem",
|
|
235
311
|
className: "min-w-[40px]",
|
|
236
|
-
children: /* @__PURE__ */
|
|
312
|
+
children: /* @__PURE__ */ F(y, {
|
|
237
313
|
label: e.title,
|
|
238
314
|
className: "min-w-[40px]",
|
|
239
|
-
onClick: () =>
|
|
315
|
+
onClick: () => x(e)
|
|
240
316
|
})
|
|
241
317
|
}, t))
|
|
242
318
|
})]
|
|
243
319
|
})]
|
|
244
320
|
});
|
|
245
|
-
},
|
|
321
|
+
}, Q = ({ labels: { titleText: e = "Model switched.", bodyText: t } }) => /* @__PURE__ */ F("div", {
|
|
246
322
|
role: "status",
|
|
247
323
|
"aria-live": "polite",
|
|
248
|
-
children: /* @__PURE__ */
|
|
324
|
+
children: /* @__PURE__ */ F(_, {
|
|
249
325
|
title: e,
|
|
250
326
|
message: t,
|
|
251
327
|
textClassName: "flex-row flex-wrap gap-1"
|
|
252
328
|
})
|
|
253
|
-
}),
|
|
329
|
+
}), $ = /* @__PURE__ */ function(e) {
|
|
254
330
|
return e.Bottom = "Bottom", e.Top = "Top", e;
|
|
255
|
-
}({}),
|
|
256
|
-
let { colors:
|
|
331
|
+
}({}), se = 10, ce = ({ text: e, contentRef: t, position: n = $.Bottom, styles: r, actions: i, hasAlwaysVisibleActions: o, attachments: d, collapsedLineCount: f = se, labels: m, textSegments: g, onAttachmentClick: _, onDownloadAll: y, onAttachmentRetry: b, selectedAttachmentId: x }) => {
|
|
332
|
+
let { colors: C, typography: ee, className: w, bubbleClassName: T } = r ?? {}, { showMoreLabel: E = "Show more", showLessLabel: k = "Show less", showMoreAriaLabel: A, showLessAriaLabel: j, attachmentClickLabel: M, attachmentRetryLabel: te, attachmentOpenInNewTabLabel: N, userMessageAriaLabel: ne = "User message" } = m ?? {}, { textRef: re, isTextCollapsed: L, isOverflowing: z, collapsedMaxHeight: B, expandedMaxHeight: V, isCollapsed: H, toggleCollapsed: U } = l({
|
|
257
333
|
text: e ?? "",
|
|
258
|
-
collapsedLineCount:
|
|
259
|
-
}),
|
|
260
|
-
"--cm-bubble-user-bg":
|
|
261
|
-
"--cm-bubble-user-border":
|
|
262
|
-
"--cm-bubble-fade-start":
|
|
263
|
-
"--cm-bubble-text":
|
|
264
|
-
"--cm-bubble-collapsed-height":
|
|
265
|
-
"--cm-bubble-expanded-height":
|
|
266
|
-
}),
|
|
267
|
-
return /* @__PURE__ */
|
|
334
|
+
collapsedLineCount: f
|
|
335
|
+
}), W = s({
|
|
336
|
+
"--cm-bubble-user-bg": C?.userBackground,
|
|
337
|
+
"--cm-bubble-user-border": C?.userBorder,
|
|
338
|
+
"--cm-bubble-fade-start": C?.fadeStart,
|
|
339
|
+
"--cm-bubble-text": C?.text,
|
|
340
|
+
"--cm-bubble-collapsed-height": z ? `${B}px` : void 0,
|
|
341
|
+
"--cm-bubble-expanded-height": z ? `${V}px` : void 0
|
|
342
|
+
}), G = n === $.Top ? "rounded-ee-md rounded-se-2xl" : "rounded-se-md rounded-ee-2xl", K = c(X.text, ee?.fontClassName), q = A ?? E, J = j ?? k, Y = H ? E : k, oe = H ? q : J, Z = H ? D : O, Q = S();
|
|
343
|
+
return /* @__PURE__ */ F("div", {
|
|
268
344
|
role: "group",
|
|
269
|
-
"aria-label":
|
|
270
|
-
style:
|
|
271
|
-
|
|
272
|
-
|
|
345
|
+
"aria-label": ne,
|
|
346
|
+
style: W,
|
|
347
|
+
onCopy: ie,
|
|
348
|
+
className: c("flex w-full", w),
|
|
349
|
+
children: /* @__PURE__ */ I("div", {
|
|
273
350
|
className: "ms-auto flex w-fit min-w-0 max-w-full flex-col items-end gap-4",
|
|
274
351
|
children: [
|
|
275
|
-
/* @__PURE__ */
|
|
352
|
+
/* @__PURE__ */ F(u, {
|
|
276
353
|
attachments: d ?? [],
|
|
277
354
|
onAttachmentClick: (e) => _?.(d?.find((t) => t.id === e)),
|
|
278
|
-
onDownloadAll:
|
|
355
|
+
onDownloadAll: y,
|
|
279
356
|
onRetry: b,
|
|
280
357
|
labels: {
|
|
281
358
|
clickLabel: M,
|
|
282
|
-
retryLabel:
|
|
283
|
-
openInNewTabLabel:
|
|
359
|
+
retryLabel: te,
|
|
360
|
+
openInNewTabLabel: N
|
|
284
361
|
},
|
|
285
362
|
styles: { className: "max-w-[640px]" },
|
|
286
363
|
selectedAttachmentId: x
|
|
287
364
|
}),
|
|
288
|
-
|
|
289
|
-
className:
|
|
290
|
-
children: /* @__PURE__ */
|
|
365
|
+
e && /* @__PURE__ */ F("div", {
|
|
366
|
+
className: c(X.userBubble, "flex w-fit items-center justify-end rounded-es-2xl rounded-ss-2xl border px-6 py-4", G, T, R.userBubble),
|
|
367
|
+
children: /* @__PURE__ */ I("div", {
|
|
291
368
|
className: "flex min-w-0 flex-col items-start",
|
|
292
|
-
children: [
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
className: "me-1",
|
|
301
|
-
children: g
|
|
302
|
-
}), e]
|
|
303
|
-
})
|
|
304
|
-
}),
|
|
305
|
-
g != null && !e && /* @__PURE__ */ P("div", { children: g }),
|
|
306
|
-
U && /* @__PURE__ */ P(m, {
|
|
307
|
-
label: /* @__PURE__ */ P(N, { children: te }),
|
|
308
|
-
iconBefore: /* @__PURE__ */ P(re, {
|
|
309
|
-
size: u.SM,
|
|
310
|
-
"aria-hidden": "true"
|
|
311
|
-
}),
|
|
312
|
-
"aria-label": ne,
|
|
313
|
-
"aria-expanded": !J,
|
|
314
|
-
"aria-controls": ie,
|
|
315
|
-
className: "mt-3",
|
|
316
|
-
onClick: Y,
|
|
317
|
-
size: f.Small
|
|
369
|
+
children: [/* @__PURE__ */ F("div", {
|
|
370
|
+
id: Q,
|
|
371
|
+
ref: t,
|
|
372
|
+
className: c("relative -me-1 -ms-1 w-[calc(100%+8px)] overflow-hidden pe-1 ps-1", z && X.collapsibleText, z && !H && X.expandedText, L && X.collapsedText),
|
|
373
|
+
children: /* @__PURE__ */ F("p", {
|
|
374
|
+
ref: re,
|
|
375
|
+
className: c(K, "whitespace-pre-wrap text-start [overflow-wrap:anywhere]"),
|
|
376
|
+
children: g ?? e
|
|
318
377
|
})
|
|
319
|
-
|
|
378
|
+
}), z && /* @__PURE__ */ F(v, {
|
|
379
|
+
label: /* @__PURE__ */ F(P, { children: Y }),
|
|
380
|
+
iconBefore: /* @__PURE__ */ F(Z, {
|
|
381
|
+
size: p.SM,
|
|
382
|
+
"aria-hidden": "true"
|
|
383
|
+
}),
|
|
384
|
+
"aria-label": oe,
|
|
385
|
+
"aria-expanded": !H,
|
|
386
|
+
"aria-controls": Q,
|
|
387
|
+
className: "mt-3",
|
|
388
|
+
onClick: U,
|
|
389
|
+
size: h.Small
|
|
390
|
+
})]
|
|
320
391
|
})
|
|
321
392
|
}),
|
|
322
|
-
/* @__PURE__ */
|
|
323
|
-
...
|
|
324
|
-
isAlwaysVisible:
|
|
393
|
+
/* @__PURE__ */ F(ae, {
|
|
394
|
+
...i,
|
|
395
|
+
isAlwaysVisible: o,
|
|
325
396
|
role: a.User
|
|
326
397
|
})
|
|
327
398
|
]
|
|
328
399
|
})
|
|
329
400
|
});
|
|
330
|
-
},
|
|
331
|
-
titleText:
|
|
332
|
-
bodyText:
|
|
333
|
-
} }) : e === a.User ? /* @__PURE__ */
|
|
334
|
-
...
|
|
335
|
-
|
|
336
|
-
onAttachmentClick:
|
|
337
|
-
}) : /* @__PURE__ */
|
|
338
|
-
...
|
|
401
|
+
}, le = ({ role: e, beforeContent: t, textSegments: n, onAttachmentClick: r, responseFormat: i, markdownComponents: o, markdownUrlTransform: s, ...c }) => e === a.Status ? /* @__PURE__ */ F(Q, { labels: {
|
|
402
|
+
titleText: c.labels?.statusTitleText,
|
|
403
|
+
bodyText: c.labels?.statusBodyText ?? ""
|
|
404
|
+
} }) : e === a.User ? /* @__PURE__ */ F(ce, {
|
|
405
|
+
...c,
|
|
406
|
+
textSegments: n,
|
|
407
|
+
onAttachmentClick: r
|
|
408
|
+
}) : /* @__PURE__ */ F(Z, {
|
|
409
|
+
...c,
|
|
339
410
|
beforeContent: t,
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
411
|
+
responseFormat: i,
|
|
412
|
+
markdownComponents: o,
|
|
413
|
+
markdownUrlTransform: s,
|
|
414
|
+
onAttachmentClick: r
|
|
415
|
+
}), ue = { button: "_button_tqo4d_3" }, de = ({ rect: e, actionRef: t, onReply: n, addedRevision: r, labels: i, styles: a, portalContainer: o }) => {
|
|
416
|
+
let { colors: l, typography: u, className: p, buttonClassName: g } = a ?? {}, _ = u?.fontClassName ?? "dial-small-text", v = o === void 0 ? typeof document > "u" ? null : document.body : o, y = s({
|
|
417
|
+
"--cm-reply-background": l?.background,
|
|
418
|
+
"--cm-reply-hover-background": l?.hoverBackground,
|
|
419
|
+
"--cm-reply-text": l?.text
|
|
420
|
+
}), [b, x] = T({
|
|
421
|
+
x: 0,
|
|
422
|
+
y: 0
|
|
423
|
+
});
|
|
424
|
+
return C(() => {
|
|
425
|
+
if (!e || !t.current) return;
|
|
426
|
+
let n = t.current.getBoundingClientRect(), r = window.visualViewport, i = r?.offsetLeft ?? 0, a = r?.offsetTop ?? 0, o = r?.width ?? document.documentElement.clientWidth, s = r?.height ?? document.documentElement.clientHeight, c = e.top - n.height - 8 >= a + 8 ? e.top - n.height - 8 : e.bottom + 8;
|
|
427
|
+
x({
|
|
428
|
+
x: Math.max(i + 8, Math.min(e.left, i + o - n.width - 8)),
|
|
429
|
+
y: Math.max(a + 8, Math.min(c, a + s - n.height - 8))
|
|
430
|
+
});
|
|
431
|
+
}, [
|
|
432
|
+
e,
|
|
433
|
+
t,
|
|
434
|
+
v,
|
|
435
|
+
p,
|
|
436
|
+
g,
|
|
437
|
+
_,
|
|
438
|
+
i.reply
|
|
439
|
+
]), v ? L(/* @__PURE__ */ I(P, { children: [e && /* @__PURE__ */ F("div", {
|
|
440
|
+
ref: t,
|
|
441
|
+
className: c("fixed left-0 top-0 z-50 max-w-[calc(100vw-16px)]", p),
|
|
442
|
+
style: {
|
|
443
|
+
...y,
|
|
444
|
+
transform: `translate(${b.x}px, ${b.y}px)`
|
|
445
|
+
},
|
|
446
|
+
children: /* @__PURE__ */ F(d, {
|
|
447
|
+
variant: f.Neutral,
|
|
448
|
+
size: h.Small,
|
|
449
|
+
label: i.reply,
|
|
450
|
+
onClick: n,
|
|
451
|
+
textClassName: _,
|
|
452
|
+
className: c(ue.button, "h-8 min-h-8 min-w-11 px-2 shadow-lg mobile:h-11 mobile:min-h-11", g),
|
|
453
|
+
iconAfter: /* @__PURE__ */ F(E, {
|
|
454
|
+
size: 16,
|
|
455
|
+
stroke: m,
|
|
456
|
+
"aria-hidden": "true",
|
|
457
|
+
className: "rtl:scale-x-[-1]"
|
|
458
|
+
})
|
|
459
|
+
})
|
|
460
|
+
}), /* @__PURE__ */ F("div", {
|
|
461
|
+
role: "status",
|
|
462
|
+
"aria-live": "polite",
|
|
463
|
+
className: "sr-only",
|
|
464
|
+
children: e ? i.selectionAvailable : r > 0 ? /* @__PURE__ */ F("span", { children: i.attachmentAdded }, r) : null
|
|
465
|
+
})] }), v) : null;
|
|
466
|
+
};
|
|
344
467
|
//#endregion
|
|
345
|
-
export {
|
|
468
|
+
export { Z as AssistantMessageBubble, $ as BubblePosition, R as CONVERSATION_MESSAGES_CLASS, ae as MessageActions, le as MessageBubble, de as MessageSelectionReply, Q as StatusMessageBubble, ce as UserMessageBubble };
|
|
@@ -7,8 +7,10 @@ export interface MessageActionTooltips {
|
|
|
7
7
|
delete?: string;
|
|
8
8
|
/** Tooltip for the Regenerate button. */
|
|
9
9
|
regenerate?: string;
|
|
10
|
-
/** Tooltip for the Copy button in its default state. */
|
|
10
|
+
/** Tooltip for the assistant Copy button in its default state. */
|
|
11
11
|
copy?: string;
|
|
12
|
+
/** Tooltip for the user-message Copy button in its default state. */
|
|
13
|
+
copyMessage?: string;
|
|
12
14
|
/** Tooltip shown on the Copy button immediately after copying. */
|
|
13
15
|
copied?: string;
|
|
14
16
|
/** Tooltip for the Copy as Markdown button in its default state. */
|
|
@@ -28,8 +30,10 @@ export interface MessageActionAriaLabels {
|
|
|
28
30
|
deleteMessage?: string;
|
|
29
31
|
/** aria-label for the Regenerate button. */
|
|
30
32
|
regenerateResponse?: string;
|
|
31
|
-
/** aria-label for the Copy button. */
|
|
33
|
+
/** aria-label for the assistant Copy button. */
|
|
32
34
|
copyResponse?: string;
|
|
35
|
+
/** aria-label for the user-message Copy button. */
|
|
36
|
+
copyMessage?: string;
|
|
33
37
|
/** aria-label for the Copy as Markdown button. */
|
|
34
38
|
copyAsMarkdown?: string;
|
|
35
39
|
/** aria-label for the Like button. */
|
|
@@ -40,6 +44,8 @@ export interface MessageActionAriaLabels {
|
|
|
40
44
|
actionsGroup?: string;
|
|
41
45
|
/** Announced after copying the response text. */
|
|
42
46
|
copiedStatus?: string;
|
|
47
|
+
/** Announced after copying a user message. */
|
|
48
|
+
copiedMessageStatus?: string;
|
|
43
49
|
/** Announced after copying the response as Markdown. */
|
|
44
50
|
copiedMarkdownStatus?: string;
|
|
45
51
|
}
|
|
@@ -57,7 +63,7 @@ export interface MessageActionColors {
|
|
|
57
63
|
}
|
|
58
64
|
/** Props for the `MessageActions` component. */
|
|
59
65
|
export interface MessageActionsProps {
|
|
60
|
-
/** Which actions are shown. `'User'` = Edit/Delete; `'Agent'` = Regenerate/Copy/Like/Dislike. Defaults to `'User'`. */
|
|
66
|
+
/** Which actions are shown. `'User'` = Copy/Edit/Delete; `'Agent'` = Regenerate/Copy/Like/Dislike. Defaults to `'User'`. */
|
|
61
67
|
role?: MessageRole;
|
|
62
68
|
/** Extra class(es) on the root element. */
|
|
63
69
|
className?: string;
|
|
@@ -75,7 +81,7 @@ export interface MessageActionsProps {
|
|
|
75
81
|
onDelete?: () => void;
|
|
76
82
|
/** Fires on Regenerate click. Agent role only. */
|
|
77
83
|
onRegenerate?: () => void;
|
|
78
|
-
/** Fires on Copy click.
|
|
84
|
+
/** Fires on Copy click. Both roles; the label set depends on `role`. */
|
|
79
85
|
onCopy?: () => void;
|
|
80
86
|
/** Fires on Copy Markdown click. Agent role only. */
|
|
81
87
|
onCopyMarkdown?: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message-actions.d.ts","sourceRoot":"","sources":["../../src/models/message-actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAEvE,+FAA+F;AAC/F,MAAM,WAAW,qBAAqB;IACpC,mCAAmC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qCAAqC;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yCAAyC;IACzC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,
|
|
1
|
+
{"version":3,"file":"message-actions.d.ts","sourceRoot":"","sources":["../../src/models/message-actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAEvE,+FAA+F;AAC/F,MAAM,WAAW,qBAAqB;IACpC,mCAAmC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qCAAqC;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yCAAyC;IACzC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kEAAkE;IAClE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qEAAqE;IACrE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kEAAkE;IAClE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oEAAoE;IACpE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,8EAA8E;IAC9E,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mCAAmC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,0GAA0G;AAC1G,MAAM,WAAW,uBAAuB;IACtC,sCAAsC;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wCAAwC;IACxC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,4CAA4C;IAC5C,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,gDAAgD;IAChD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mDAAmD;IACnD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kDAAkD;IAClD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,sCAAsC;IACtC,YAAY,CAAC,EAAE,MA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AAC;IACpB,+CAA+C;IAC/C,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,2EAA2E;IAC3E,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B,uBAAuB;IACvB,MAAM,CAAC,EAAE,mBAAmB,CAAC;CAC9B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CodeBlockTheme, DisplayAttachment, MarkdownRendererClassNames, MessageRole, StarterOption } from '@epam/ai-dial-chat-shared';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import { CodeBlockTheme, DisplayAttachment, MarkdownRendererClassNames, MessageRole, ResponseFormat, StarterOption } from '@epam/ai-dial-chat-shared';
|
|
2
|
+
import { ReactNode, Ref } from 'react';
|
|
3
3
|
import { Components } from 'react-markdown';
|
|
4
4
|
import { BubblePosition } from '../types/bubble-position';
|
|
5
5
|
import { MessageActionsProps } from './message-actions';
|
|
@@ -67,12 +67,8 @@ export interface AssistantMessageBubbleLabels extends MessageBubbleLabels {
|
|
|
67
67
|
codeBlockCopyLabel?: string;
|
|
68
68
|
/** aria-label for the code block copy button after copying. */
|
|
69
69
|
codeBlockCopiedLabel?: string;
|
|
70
|
-
/** Label for
|
|
71
|
-
|
|
72
|
-
/** Label for copying a Markdown table as text. */
|
|
73
|
-
tableCopyTxtLabel?: string;
|
|
74
|
-
/** Label for copying a Markdown table as Markdown. */
|
|
75
|
-
tableCopyMarkdownLabel?: string;
|
|
70
|
+
/** Label for the copy action on a Markdown table (copies as Markdown format). */
|
|
71
|
+
tableCopyLabel?: string;
|
|
76
72
|
/** Status announced after a Markdown table has been copied. */
|
|
77
73
|
tableCopiedLabel?: string;
|
|
78
74
|
/** Label for downloading a Markdown table as CSV. */
|
|
@@ -88,6 +84,8 @@ export interface AssistantMessageBubbleLabels extends MessageBubbleLabels {
|
|
|
88
84
|
}
|
|
89
85
|
/** Shared props for user and assistant message bubble components. */
|
|
90
86
|
interface BaseMessageBubbleProps {
|
|
87
|
+
/** Ref to the text body, excluding attachment trays, actions and host slots. */
|
|
88
|
+
contentRef?: Ref<HTMLDivElement>;
|
|
91
89
|
/** Plain-text (or Markdown) content of the message. When absent, the bubble renders for `beforeContent` alone. */
|
|
92
90
|
text?: string;
|
|
93
91
|
/** Color and typography overrides applied as CSS custom properties. */
|
|
@@ -110,17 +108,6 @@ interface BaseMessageBubbleProps {
|
|
|
110
108
|
onAttachmentRetry?: (id: string) => void;
|
|
111
109
|
/** ID of the attachment currently open in the canvas panel, if any. Renders that tile's selected visual state. */
|
|
112
110
|
selectedAttachmentId?: string;
|
|
113
|
-
/**
|
|
114
|
-
* Content rendered at the inline-start of the message's first text line,
|
|
115
|
-
* which word-flows after it (e.g. a used-skill chip — inline-level content
|
|
116
|
-
* no taller than a text line). The user bubble renders it inline within
|
|
117
|
-
* the text; the assistant bubble overlays it on the first markdown block's
|
|
118
|
-
* first line, which indents past it. The user bubble renders for the slot
|
|
119
|
-
* alone even when `text` is empty; an assistant message with no text
|
|
120
|
-
* renders the slot on its own line — above the streaming placeholder while
|
|
121
|
-
* the first token has not arrived yet.
|
|
122
|
-
*/
|
|
123
|
-
beforeContent?: ReactNode;
|
|
124
111
|
}
|
|
125
112
|
/** Props for `UserMessageBubble`. */
|
|
126
113
|
export interface UserMessageBubbleProps extends BaseMessageBubbleProps {
|
|
@@ -128,9 +115,38 @@ export interface UserMessageBubbleProps extends BaseMessageBubbleProps {
|
|
|
128
115
|
position?: BubblePosition;
|
|
129
116
|
/** Maximum number of text lines shown while a long user message is collapsed. Defaults to `10`. */
|
|
130
117
|
collapsedLineCount?: number;
|
|
118
|
+
/**
|
|
119
|
+
* Ordered content replacing the plain-text render when present —
|
|
120
|
+
* interleaved plain-text runs and inline elements (e.g. skill-mention
|
|
121
|
+
* chips at their text position), rendered in place of `text` inside the
|
|
122
|
+
* same paragraph. `text` is still required alongside this: it remains the
|
|
123
|
+
* identity/measurement input for the collapse-height calculation
|
|
124
|
+
* (`useCollapsedText`), even though `textSegments` is what's visually
|
|
125
|
+
* rendered. Absent renders `text` directly, byte-identical to today.
|
|
126
|
+
*/
|
|
127
|
+
textSegments?: ReactNode[];
|
|
131
128
|
}
|
|
132
129
|
/** Props for `AssistantMessageBubble`. */
|
|
133
130
|
export interface AssistantMessageBubbleProps extends BaseMessageBubbleProps {
|
|
131
|
+
/**
|
|
132
|
+
* Conversation response format. `ResponseFormat.PlainText` renders the
|
|
133
|
+
* message body verbatim — no Markdown pipeline, so a table, a heading, or
|
|
134
|
+
* `**bold**` reaches the reader exactly as the model wrote it — and the
|
|
135
|
+
* markdown-only props below stop applying. Defaults to
|
|
136
|
+
* `ResponseFormat.Markdown`.
|
|
137
|
+
*/
|
|
138
|
+
responseFormat?: ResponseFormat;
|
|
139
|
+
/**
|
|
140
|
+
* Content rendered at the inline-start of the message's first markdown
|
|
141
|
+
* block's first line, which word-flows after it (e.g. used-skill chips —
|
|
142
|
+
* inline-level content no taller than a text line). Overlaid on the first
|
|
143
|
+
* line, which indents past it; an assistant message with no text renders
|
|
144
|
+
* the slot on its own line — above the streaming placeholder while the
|
|
145
|
+
* first token has not arrived yet. May itself be an array of elements
|
|
146
|
+
* (e.g. one `ChatSkill` per mention) — React renders `ReactNode[]` as a
|
|
147
|
+
* sibling sequence with no extra wrapper needed.
|
|
148
|
+
*/
|
|
149
|
+
beforeContent?: ReactNode;
|
|
134
150
|
/** react-markdown component overrides. Use to inject custom renderers (e.g. citation markers) into markdown elements. */
|
|
135
151
|
markdownComponents?: Components;
|
|
136
152
|
/** Per-element markdown typography classes. Defaults to the renderer's full-size scale; pass `COMPACT_MARKDOWN_CLASS_NAMES` for the smaller body scale. */
|
|
@@ -147,6 +163,8 @@ export interface AssistantMessageBubbleProps extends BaseMessageBubbleProps {
|
|
|
147
163
|
onSelectStarter?: (starter: StarterOption) => void;
|
|
148
164
|
/** Content rendered between the message body and the actions bar (e.g. a stages panel). */
|
|
149
165
|
afterContent?: ReactNode;
|
|
166
|
+
/** When `false`, no thinking placeholder renders while streaming before the first token, so `afterContent` starts level with the avatar. Defaults to `true`. */
|
|
167
|
+
hasThinkingPlaceholder?: boolean;
|
|
150
168
|
/** Deployment icon URL. When absent, no icon is rendered. */
|
|
151
169
|
deploymentIconUrl?: string;
|
|
152
170
|
/** Deployment name used as the icon's accessible label. */
|
|
@@ -159,7 +177,7 @@ export interface AssistantMessageBubbleProps extends BaseMessageBubbleProps {
|
|
|
159
177
|
labels?: AssistantMessageBubbleLabels;
|
|
160
178
|
}
|
|
161
179
|
/** Props for `MessageBubble` — `AssistantMessageBubbleProps` plus user-only fields and `role`. */
|
|
162
|
-
export type MessageBubbleProps = AssistantMessageBubbleProps & Pick<UserMessageBubbleProps, 'position' | 'collapsedLineCount'> & {
|
|
180
|
+
export type MessageBubbleProps = AssistantMessageBubbleProps & Pick<UserMessageBubbleProps, 'position' | 'collapsedLineCount' | 'textSegments'> & {
|
|
163
181
|
/** Message author/type: user, assistant, or status banner. */
|
|
164
182
|
role: MessageRole;
|
|
165
183
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message-bubble.d.ts","sourceRoot":"","sources":["../../src/models/message-bubble.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,iBAAiB,EACjB,0BAA0B,EAC1B,WAAW,EACX,aAAa,EACd,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"message-bubble.d.ts","sourceRoot":"","sources":["../../src/models/message-bubble.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,iBAAiB,EACjB,0BAA0B,EAC1B,WAAW,EACX,cAAc,EACd,aAAa,EACd,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAE,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iB,CAAC,EAAE,MAAM,CAAC;IAC3B,2DAA2D;IAC3D,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,oEAAoE;IACpE,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,kEAAkE;IAClE,mBAAmB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACjD,+FAA+F;IAC/F,MAAM,CAAC,EAAE,4BAA4B,CAAC;CACvC;AAED,kGAAkG;AAClG,MAAM,MAAM,kBAAkB,GAAG,2BAA2B,GAC1D,IAAI,CACF,sBAAsB,EACtB,UAAU,GAAG,oBAAoB,GAAG,cAAc,CACnD,GAAG;IACF,8DAA8D;IAC9D,IAAI,EAAE,WAAW,CAAC;CACnB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epam/ai-dial-conversation-messages",
|
|
3
3
|
"description": "Message bubble components for rendering conversation history with actions and source citations",
|
|
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
|
"main": "./index.js",
|
|
@@ -19,12 +19,13 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@tabler/icons-react": "^3.44.0",
|
|
21
21
|
"react-markdown": "^10.1.0",
|
|
22
|
-
"@epam/ai-dial-attachment-input": "1.2.0-dev.
|
|
22
|
+
"@epam/ai-dial-attachment-input": "1.2.0-dev.284"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"react": "^19.2.8",
|
|
26
|
-
"
|
|
27
|
-
"@epam/ai-dial-
|
|
26
|
+
"react-dom": "^19.2.8",
|
|
27
|
+
"@epam/ai-dial-chat-shared": "1.2.0-dev.284",
|
|
28
|
+
"@epam/ai-dial-ui-kit": "^0.15.0-dev.36"
|
|
28
29
|
},
|
|
29
30
|
"repository": {
|
|
30
31
|
"type": "git",
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ClipboardEvent } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* `onCopy` handler that writes the current selection to the clipboard without
|
|
4
|
+
* the app's colors and fonts. Left to itself, the browser inlines every
|
|
5
|
+
* computed style of the selected markup into `text/html`, so pasting into a
|
|
6
|
+
* rich-text target (Teams, Outlook, Word) brings along the message's
|
|
7
|
+
* background band. This keeps the structure (paragraphs, lists, tables, code,
|
|
8
|
+
* links, line breaks) and lets the target document style it.
|
|
9
|
+
*/
|
|
10
|
+
export declare const copySelectionWithoutStyles: (event: ClipboardEvent<HTMLElement>) => void;
|
|
11
|
+
//# sourceMappingURL=clipboard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clipboard.d.ts","sourceRoot":"","sources":["../../src/utils/clipboard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAwG5C;;;;;;;GAOG;AACH,eAAO,MAAM,0BAA0B,GACrC,OAAO,cAAc,CAAC,WAAW,CAAC,KACjC,IA0BF,CAAC"}
|