@pega/cosmos-react-social 4.0.0-dev.2.0 → 4.0.0-dev.20.0
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/lib/components/Chat/Chat.d.ts +11 -13
- package/lib/components/Chat/Chat.d.ts.map +1 -1
- package/lib/components/Chat/Chat.js +9 -12
- package/lib/components/Chat/Chat.js.map +1 -1
- package/lib/components/Chat/Chat.types.d.ts +115 -2
- package/lib/components/Chat/Chat.types.d.ts.map +1 -1
- package/lib/components/Chat/Chat.types.js +9 -1
- package/lib/components/Chat/Chat.types.js.map +1 -1
- package/lib/components/Chat/ChatBody.d.ts +3 -8
- package/lib/components/Chat/ChatBody.d.ts.map +1 -1
- package/lib/components/Chat/ChatBody.js +288 -14
- package/lib/components/Chat/ChatBody.js.map +1 -1
- package/lib/components/Chat/ChatComposer.d.ts +3 -4
- package/lib/components/Chat/ChatComposer.d.ts.map +1 -1
- package/lib/components/Chat/ChatComposer.js +39 -29
- package/lib/components/Chat/ChatComposer.js.map +1 -1
- package/lib/components/Chat/ChatHeader.d.ts +17 -5
- package/lib/components/Chat/ChatHeader.d.ts.map +1 -1
- package/lib/components/Chat/ChatHeader.js +30 -14
- package/lib/components/Chat/ChatHeader.js.map +1 -1
- package/lib/components/Chat/ChatSettingsPanel.d.ts +7 -0
- package/lib/components/Chat/ChatSettingsPanel.d.ts.map +1 -0
- package/lib/components/Chat/ChatSettingsPanel.js +15 -0
- package/lib/components/Chat/ChatSettingsPanel.js.map +1 -0
- package/lib/components/Chat/ChatSettingsPanel.styles.d.ts +16 -0
- package/lib/components/Chat/ChatSettingsPanel.styles.d.ts.map +1 -0
- package/lib/components/Chat/ChatSettingsPanel.styles.js +47 -0
- package/lib/components/Chat/ChatSettingsPanel.styles.js.map +1 -0
- package/lib/components/Chat/Message.d.ts +3 -43
- package/lib/components/Chat/Message.d.ts.map +1 -1
- package/lib/components/Chat/Message.js +67 -27
- package/lib/components/Chat/Message.js.map +1 -1
- package/lib/components/Chat/Message.styles.d.ts +32 -21
- package/lib/components/Chat/Message.styles.d.ts.map +1 -1
- package/lib/components/Chat/Message.styles.js +92 -20
- package/lib/components/Chat/Message.styles.js.map +1 -1
- package/lib/components/Chat/SuggestedReplyPicker.d.ts +12 -3
- package/lib/components/Chat/SuggestedReplyPicker.d.ts.map +1 -1
- package/lib/components/Chat/SuggestedReplyPicker.js +92 -51
- package/lib/components/Chat/SuggestedReplyPicker.js.map +1 -1
- package/lib/components/Chat/SystemMessage.d.ts +4 -15
- package/lib/components/Chat/SystemMessage.d.ts.map +1 -1
- package/lib/components/Chat/SystemMessage.js +32 -22
- package/lib/components/Chat/SystemMessage.js.map +1 -1
- package/lib/components/Chat/TypeIndicator.d.ts +3 -10
- package/lib/components/Chat/TypeIndicator.d.ts.map +1 -1
- package/lib/components/Chat/TypeIndicator.js +5 -2
- package/lib/components/Chat/TypeIndicator.js.map +1 -1
- package/lib/components/Chat/index.d.ts +6 -9
- package/lib/components/Chat/index.d.ts.map +1 -1
- package/lib/components/Chat/index.js +2 -5
- package/lib/components/Chat/index.js.map +1 -1
- package/lib/components/Email/Email.styles.d.ts +15 -4
- package/lib/components/Email/Email.styles.d.ts.map +1 -1
- package/lib/components/Email/Email.styles.js +51 -4
- package/lib/components/Email/Email.styles.js.map +1 -1
- package/lib/components/Email/Email.types.d.ts +32 -14
- package/lib/components/Email/Email.types.d.ts.map +1 -1
- package/lib/components/Email/Email.types.js.map +1 -1
- package/lib/components/Email/EmailCaseView.d.ts.map +1 -1
- package/lib/components/Email/EmailCaseView.js +2 -2
- package/lib/components/Email/EmailCaseView.js.map +1 -1
- package/lib/components/Email/EmailComposer.d.ts.map +1 -1
- package/lib/components/Email/EmailComposer.js +91 -44
- package/lib/components/Email/EmailComposer.js.map +1 -1
- package/lib/components/Email/EmailConversation.d.ts.map +1 -1
- package/lib/components/Email/EmailConversation.js +76 -81
- package/lib/components/Email/EmailConversation.js.map +1 -1
- package/lib/components/Email/EmailManager.js +2 -2
- package/lib/components/Email/EmailManager.js.map +1 -1
- package/lib/components/Email/EmailNotificationPanel.d.ts +7 -0
- package/lib/components/Email/EmailNotificationPanel.d.ts.map +1 -0
- package/lib/components/Email/EmailNotificationPanel.js +15 -0
- package/lib/components/Email/EmailNotificationPanel.js.map +1 -0
- package/lib/components/Email/EmailSelector.d.ts +1 -0
- package/lib/components/Email/EmailSelector.d.ts.map +1 -1
- package/lib/components/Email/EmailSelector.js +16 -4
- package/lib/components/Email/EmailSelector.js.map +1 -1
- package/lib/components/Email/EmailSummaryItem.d.ts +2 -1
- package/lib/components/Email/EmailSummaryItem.d.ts.map +1 -1
- package/lib/components/Email/EmailSummaryItem.js +35 -26
- package/lib/components/Email/EmailSummaryItem.js.map +1 -1
- package/lib/components/Email/EmailSummaryList.d.ts.map +1 -1
- package/lib/components/Email/EmailSummaryList.js +17 -33
- package/lib/components/Email/EmailSummaryList.js.map +1 -1
- package/lib/components/Email/EntityList.js +1 -1
- package/lib/components/Email/EntityList.js.map +1 -1
- package/lib/components/Email/index.d.ts +3 -1
- package/lib/components/Email/index.d.ts.map +1 -1
- package/lib/components/Email/index.js +2 -0
- package/lib/components/Email/index.js.map +1 -1
- package/lib/components/Email/utils/EntityHighlighter.d.ts.map +1 -1
- package/lib/components/Email/utils/EntityHighlighter.js +4 -10
- package/lib/components/Email/utils/EntityHighlighter.js.map +1 -1
- package/lib/components/Feed/Feed.context.d.ts +3 -0
- package/lib/components/Feed/Feed.context.d.ts.map +1 -1
- package/lib/components/Feed/Feed.context.js.map +1 -1
- package/lib/components/Feed/Feed.d.ts.map +1 -1
- package/lib/components/Feed/Feed.js +18 -5
- package/lib/components/Feed/Feed.js.map +1 -1
- package/lib/components/Feed/FeedAttachments.d.ts +1 -1
- package/lib/components/Feed/FeedAttachments.d.ts.map +1 -1
- package/lib/components/Feed/FeedAttachments.js +5 -10
- package/lib/components/Feed/FeedAttachments.js.map +1 -1
- package/lib/components/Feed/FeedLikeButton.d.ts +1 -1
- package/lib/components/Feed/FeedLikeButton.d.ts.map +1 -1
- package/lib/components/Feed/FeedLikeButton.js +32 -34
- package/lib/components/Feed/FeedLikeButton.js.map +1 -1
- package/lib/components/Feed/FeedModalList.js +1 -1
- package/lib/components/Feed/FeedModalList.js.map +1 -1
- package/lib/components/Feed/FeedNewPost.d.ts.map +1 -1
- package/lib/components/Feed/FeedNewPost.js +3 -3
- package/lib/components/Feed/FeedNewPost.js.map +1 -1
- package/lib/components/Feed/FeedNewPostTypeMenu.d.ts +4 -7
- package/lib/components/Feed/FeedNewPostTypeMenu.d.ts.map +1 -1
- package/lib/components/Feed/FeedNewPostTypeMenu.js +37 -49
- package/lib/components/Feed/FeedNewPostTypeMenu.js.map +1 -1
- package/lib/components/Feed/FeedPost.d.ts.map +1 -1
- package/lib/components/Feed/FeedPost.js +16 -26
- package/lib/components/Feed/FeedPost.js.map +1 -1
- package/lib/components/Feed/FeedPost.types.d.ts +1 -3
- package/lib/components/Feed/FeedPost.types.d.ts.map +1 -1
- package/lib/components/Feed/FeedPost.types.js.map +1 -1
- package/lib/components/Feed/FeedReply.types.d.ts +1 -3
- package/lib/components/Feed/FeedReply.types.d.ts.map +1 -1
- package/lib/components/Feed/FeedReply.types.js.map +1 -1
- package/lib/components/Feed/FeedReplyInput.d.ts +1 -1
- package/lib/components/Feed/FeedReplyInput.d.ts.map +1 -1
- package/lib/components/Feed/FeedReplyInput.js +4 -0
- package/lib/components/Feed/FeedReplyInput.js.map +1 -1
- package/lib/components/HashtagButton/HashtagButton.d.ts.map +1 -1
- package/lib/components/HashtagButton/HashtagButton.js +2 -2
- package/lib/components/HashtagButton/HashtagButton.js.map +1 -1
- package/lib/components/MentionButton/MentionButton.d.ts +1 -1
- package/lib/components/MentionButton/MentionButton.d.ts.map +1 -1
- package/lib/components/MentionButton/MentionButton.js +11 -13
- package/lib/components/MentionButton/MentionButton.js.map +1 -1
- package/package.json +11 -11
- package/lib/components/Chat/ChatTranscript.d.ts +0 -23
- package/lib/components/Chat/ChatTranscript.d.ts.map +0 -1
- package/lib/components/Chat/ChatTranscript.js +0 -45
- package/lib/components/Chat/ChatTranscript.js.map +0 -1
- package/lib/components/Chat/MessageList.d.ts +0 -35
- package/lib/components/Chat/MessageList.d.ts.map +0 -1
- package/lib/components/Chat/MessageList.js +0 -134
- package/lib/components/Chat/MessageList.js.map +0 -1
- package/lib/components/Chat/RepeatingView.d.ts +0 -31
- package/lib/components/Chat/RepeatingView.d.ts.map +0 -1
- package/lib/components/Chat/RepeatingView.js +0 -47
- package/lib/components/Chat/RepeatingView.js.map +0 -1
- package/lib/components/Chat/TranscriptMessage.d.ts +0 -25
- package/lib/components/Chat/TranscriptMessage.d.ts.map +0 -1
- package/lib/components/Chat/TranscriptMessage.js +0 -48
- package/lib/components/Chat/TranscriptMessage.js.map +0 -1
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from 'react';
|
|
3
|
-
import styled, { css } from 'styled-components';
|
|
4
|
-
import { Flex, Progress, useItemIntersection, useConsolidatedRef, defaultThemeProp } from '@pega/cosmos-react-core';
|
|
5
|
-
export const StyledRepeatingViewItem = styled.li(({ theme }) => {
|
|
6
|
-
return css `
|
|
7
|
-
outline: none;
|
|
8
|
-
&:focus {
|
|
9
|
-
box-shadow: ${theme.base.shadow.focus};
|
|
10
|
-
}
|
|
11
|
-
`;
|
|
12
|
-
});
|
|
13
|
-
StyledRepeatingViewItem.defaultProps = defaultThemeProp;
|
|
14
|
-
export const StyledRepeatingViewUL = styled.ul `
|
|
15
|
-
list-style-type: none;
|
|
16
|
-
overflow-y: auto;
|
|
17
|
-
height: 100%;
|
|
18
|
-
width: 100%;
|
|
19
|
-
`;
|
|
20
|
-
export const StyledRepeatingView = styled.div `
|
|
21
|
-
position: relative;
|
|
22
|
-
`;
|
|
23
|
-
export const StyledEmptyView = styled.div `
|
|
24
|
-
position: absolute;
|
|
25
|
-
bottom: 50%;
|
|
26
|
-
left: 50%;
|
|
27
|
-
transform: translate(-50%, -50%);
|
|
28
|
-
z-index: 1;
|
|
29
|
-
`;
|
|
30
|
-
const RepeatingView = forwardRef((props, ref) => {
|
|
31
|
-
const { children: renderer, offset = -1, loadMore, loading: isLoading = false, rows = [], emptyView, scrollDirection = 'top-to-bottom', ...restProps } = props;
|
|
32
|
-
const listRef = useConsolidatedRef(ref);
|
|
33
|
-
useItemIntersection(listRef, offset, () => {
|
|
34
|
-
loadMore?.();
|
|
35
|
-
}, ':scope > li');
|
|
36
|
-
return (_jsxs(Flex, { container: {
|
|
37
|
-
alignItems: 'center',
|
|
38
|
-
justify: 'center'
|
|
39
|
-
}, as: StyledRepeatingView, ...restProps, children: [_jsxs(Flex, { ...restProps, container: {
|
|
40
|
-
direction: scrollDirection === 'top-to-bottom' ? 'column' : 'column-reverse'
|
|
41
|
-
}, as: StyledRepeatingViewUL, ref: listRef, children: [rows.map(row => {
|
|
42
|
-
const { ariaLabel, ...rowRestProps } = row;
|
|
43
|
-
return (_jsx(StyledRepeatingViewItem, { "aria-label": ariaLabel, children: renderer(rowRestProps) }, row.id));
|
|
44
|
-
}), isLoading && (_jsx(StyledRepeatingViewItem, { children: _jsx(Progress, { placement: 'inline' }) }, 'loader'))] }), !isLoading && rows.length === 0 && emptyView && (_jsx(StyledEmptyView, { children: emptyView }))] }));
|
|
45
|
-
});
|
|
46
|
-
export default RepeatingView;
|
|
47
|
-
//# sourceMappingURL=RepeatingView.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RepeatingView.js","sourceRoot":"","sources":["../../../src/components/Chat/RepeatingView.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAsC,UAAU,EAAkB,MAAM,OAAO,CAAC;AACvF,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,IAAI,EACJ,QAAQ,EACR,mBAAmB,EACnB,kBAAkB,EAClB,g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CAAC,QAAQ,CAAC,CAAC,CAAC,gBAAgB;iBAC7E,EACD,EAAE,EAAE,qBAAqB,EACzB,GAAG,EAAE,OAAO,aAEX,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;wBACd,MAAM,EAAE,SAAS,EAAE,GAAG,YAAY,EAAE,GAAG,GAAG,CAAC;wBAC3C,OAAO,CACL,KAAC,uBAAuB,kBAAa,SAAS,YAC3C,QAAQ,CAAC,YAAY,CAAC,IAD4B,GAAG,CAAC,EAAE,CAEjC,CAC3B,CAAC;oBACJ,CAAC,CAAC,EACD,SAAS,IAAI,CACZ,KAAC,uBAAuB,cACtB,KAAC,QAAQ,IAAC,SAAS,EAAC,QAAQ,GAAG,IADJ,QAAQ,CAEX,CAC3B,IACI,EACN,CAAC,SAAS,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,SAAS,IAAI,CAC/C,KAAC,eAAe,cAAE,SAAS,GAAmB,CAC/C,IACI,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import { FunctionComponent, PropsWithoutRef, forwardRef, Ref, ReactNode } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Flex,\n Progress,\n useItemIntersection,\n useConsolidatedRef,\n defaultThemeProp,\n ForwardProps\n} from '@pega/cosmos-react-core';\n\nexport interface RepeatingViewRow {\n id: string | number;\n ariaLabel?: string;\n}\n\nexport interface RepeatingViewProps {\n /** ref to the list element */\n ref?: Ref<HTMLUListElement>;\n /** Callback to render the view */\n children: (row: RepeatingViewRow) => ReactNode;\n /** Data rows */\n rows?: RepeatingViewRow[];\n /** Indicates if the data is being currently loading */\n loading?: boolean;\n /** Offset of the row item that need to trigger the load more callback */\n offset?: number;\n /** Callback to fetch more rows */\n loadMore?: () => void;\n /** UI that needs to be shown when list is empty */\n emptyView?: ReactNode;\n /** Scroll direction */\n scrollDirection?: 'top-to-bottom' | 'bottom-to-top';\n}\nexport const StyledRepeatingViewItem = styled.li(({ theme }) => {\n return css`\n outline: none;\n &:focus {\n box-shadow: ${theme.base.shadow.focus};\n }\n `;\n});\nStyledRepeatingViewItem.defaultProps = defaultThemeProp;\n\nexport const StyledRepeatingViewUL = styled.ul`\n list-style-type: none;\n overflow-y: auto;\n height: 100%;\n width: 100%;\n`;\n\nexport const StyledRepeatingView = styled.div`\n position: relative;\n`;\n\nexport const StyledEmptyView = styled.div`\n position: absolute;\n bottom: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 1;\n`;\n\nconst RepeatingView: FunctionComponent<RepeatingViewProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<RepeatingViewProps>, ref: RepeatingViewProps['ref']) => {\n const {\n children: renderer,\n offset = -1,\n loadMore,\n loading: isLoading = false,\n rows = [],\n emptyView,\n scrollDirection = 'top-to-bottom',\n ...restProps\n } = props;\n\n const listRef = useConsolidatedRef(ref);\n useItemIntersection(\n listRef,\n offset,\n () => {\n loadMore?.();\n },\n ':scope > li'\n );\n\n return (\n <Flex\n container={{\n alignItems: 'center',\n justify: 'center'\n }}\n as={StyledRepeatingView}\n {...restProps}\n >\n <Flex\n {...restProps}\n container={{\n direction: scrollDirection === 'top-to-bottom' ? 'column' : 'column-reverse'\n }}\n as={StyledRepeatingViewUL}\n ref={listRef}\n >\n {rows.map(row => {\n const { ariaLabel, ...rowRestProps } = row;\n return (\n <StyledRepeatingViewItem aria-label={ariaLabel} key={row.id}>\n {renderer(rowRestProps)}\n </StyledRepeatingViewItem>\n );\n })}\n {isLoading && (\n <StyledRepeatingViewItem key='loader'>\n <Progress placement='inline' />\n </StyledRepeatingViewItem>\n )}\n </Flex>\n {!isLoading && rows.length === 0 && emptyView && (\n <StyledEmptyView>{emptyView}</StyledEmptyView>\n )}\n </Flex>\n );\n }\n);\n\nexport default RepeatingView;\n"]}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { FunctionComponent, Ref, ReactNode } from 'react';
|
|
2
|
-
import { AvatarProps, ForwardProps } from '@pega/cosmos-react-core';
|
|
3
|
-
export declare type TranscriptHeaderProps = {
|
|
4
|
-
/** transcript header content */
|
|
5
|
-
content?: ReactNode;
|
|
6
|
-
/** meta data */
|
|
7
|
-
meta?: ReactNode;
|
|
8
|
-
};
|
|
9
|
-
export interface TranscriptMessageProps {
|
|
10
|
-
/** ref to the element */
|
|
11
|
-
ref?: Ref<HTMLDivElement>;
|
|
12
|
-
/** Timestamp */
|
|
13
|
-
timeStamp: string;
|
|
14
|
-
/** Transcript content */
|
|
15
|
-
message: ReactNode;
|
|
16
|
-
/** Variant of transcript item */
|
|
17
|
-
variant: 'user' | 'bot' | 'question';
|
|
18
|
-
/** Avatar information, can be image and name */
|
|
19
|
-
avatarInfo?: Pick<AvatarProps, 'name' | 'imageSrc'>;
|
|
20
|
-
/** Transcript header */
|
|
21
|
-
transcriptHeader?: TranscriptHeaderProps;
|
|
22
|
-
}
|
|
23
|
-
declare const TranscriptMessage: FunctionComponent<TranscriptMessageProps & ForwardProps>;
|
|
24
|
-
export default TranscriptMessage;
|
|
25
|
-
//# sourceMappingURL=TranscriptMessage.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TranscriptMessage.d.ts","sourceRoot":"","sources":["../../../src/components/Chat/TranscriptMessage.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAmB,GAAG,EAAE,SAAS,EAAU,MAAM,OAAO,CAAC;AAG/F,OAAO,EAIL,WAAW,EAIX,YAAY,EAEb,MAAM,yBAAyB,CAAC;AAEjC,oBAAY,qBAAqB,GAAG;IAClC,gCAAgC;IAChC,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,gBAAgB;IAChB,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB,CAAC;AAEF,MAAM,WAAW,sBAAsB;IACrC,yBAAyB;IACzB,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IAC1B,gBAAgB;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,yBAAyB;IACzB,OAAO,EAAE,SAAS,CAAC;IACnB,iCAAiC;IACjC,OAAO,EAAE,MAAM,GAAG,KAAK,GAAG,UAAU,CAAC;IACrC,gDAAgD;IAChD,UAAU,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,UAAU,CAAC,CAAC;IACpD,wBAAwB;IACxB,gBAAgB,CAAC,EAAE,qBAAqB,CAAC;CAC1C;AAkDD,QAAA,MAAM,iBAAiB,EAAE,iBAAiB,CAAC,sBAAsB,GAAG,YAAY,CAwD/E,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef, useRef } from 'react';
|
|
3
|
-
import styled, { css } from 'styled-components';
|
|
4
|
-
import { Flex, Text, Icon, Avatar, EmojiDisplay, defaultThemeProp, Tooltip } from '@pega/cosmos-react-core';
|
|
5
|
-
const iconMapping = {
|
|
6
|
-
user: 'user-solid',
|
|
7
|
-
bot: 'robot-solid',
|
|
8
|
-
question: 'help'
|
|
9
|
-
};
|
|
10
|
-
const StyledTranscriptIcon = styled.svg ``;
|
|
11
|
-
const StyledTranscriptTimeStamp = styled.span ``;
|
|
12
|
-
const StyledTranscriptHeader = styled.header ``;
|
|
13
|
-
const StyledTranscriptHeaderContent = styled.span ``;
|
|
14
|
-
const StyledTranscriptMessage = styled.div(({ theme: { components: { chat: { transcript: { message: { 'icon-foreground-color': iconForegroundColor } } } } } }) => {
|
|
15
|
-
return css `
|
|
16
|
-
width: 100%;
|
|
17
|
-
line-height: 1rem;
|
|
18
|
-
padding: 0 0 0.25rem;
|
|
19
|
-
${StyledTranscriptIcon} {
|
|
20
|
-
color: ${iconForegroundColor};
|
|
21
|
-
flex-shrink: 0;
|
|
22
|
-
}
|
|
23
|
-
${StyledTranscriptTimeStamp} {
|
|
24
|
-
flex-shrink: 0;
|
|
25
|
-
}
|
|
26
|
-
${StyledTranscriptHeader} {
|
|
27
|
-
margin-bottom: 0.25rem;
|
|
28
|
-
}
|
|
29
|
-
${StyledTranscriptHeaderContent} {
|
|
30
|
-
margin-right: 0.5rem;
|
|
31
|
-
}
|
|
32
|
-
`;
|
|
33
|
-
});
|
|
34
|
-
StyledTranscriptMessage.defaultProps = defaultThemeProp;
|
|
35
|
-
const TranscriptMessage = forwardRef((props, ref) => {
|
|
36
|
-
const { variant, transcriptHeader, message, timeStamp, avatarInfo, ...restProps } = props;
|
|
37
|
-
const avatarRef = useRef(null);
|
|
38
|
-
return (_jsxs(Flex, { container: {
|
|
39
|
-
gap: 2,
|
|
40
|
-
alignItems: 'start'
|
|
41
|
-
}, item: {
|
|
42
|
-
shrink: 0
|
|
43
|
-
}, ref: ref, as: StyledTranscriptMessage, ...restProps, children: [_jsx(Text, { as: StyledTranscriptTimeStamp, variant: 'secondary', children: timeStamp }), avatarInfo ? (_jsxs(_Fragment, { children: [_jsx(Avatar, { name: avatarInfo.name, size: 's', shape: 'circle', imageSrc: avatarInfo.imageSrc, ref: avatarRef }), _jsx(Tooltip, { target: avatarRef.current, showDelay: 'none', hideDelay: 'none', children: avatarInfo.name })] })) : (_jsx(Icon, { as: StyledTranscriptIcon, name: iconMapping[variant] })), _jsxs(Flex, { item: {
|
|
44
|
-
grow: 1
|
|
45
|
-
}, children: [transcriptHeader && transcriptHeader.content && (_jsxs(StyledTranscriptHeader, { children: [_jsx(StyledTranscriptHeaderContent, { children: transcriptHeader.content }), transcriptHeader.meta] })), _jsx(EmojiDisplay, { content: message, size: 20 })] })] }));
|
|
46
|
-
});
|
|
47
|
-
export default TranscriptMessage;
|
|
48
|
-
//# sourceMappingURL=TranscriptMessage.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TranscriptMessage.js","sourceRoot":"","sources":["../../../src/components/Chat/TranscriptMessage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE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AAM,CAAoC,IAAI,CAAC,CAAC;IAElE,OAAO,CACL,MAAC,IAAI,IACH,SAAS,EAAE;YACT,GAAG,EAAE,CAAC;YACN,UAAU,EAAE,OAAO;SACpB,EACD,IAAI,EAAE;YACJ,MAAM,EAAE,CAAC;SACV,EACD,GAAG,EAAE,GAAG,EACR,EAAE,EAAE,uBAAuB,KACvB,SAAS,aAEb,KAAC,IAAI,IAAC,EAAE,EAAE,yBAAyB,EAAE,OAAO,EAAC,WAAW,YACrD,SAAS,GACL,EACN,UAAU,CAAC,CAAC,CAAC,CACZ,8BACE,KAAC,MAAM,IACL,IAAI,EAAE,UAAU,CAAC,IAAI,EACrB,IAAI,EAAC,GAAG,EACR,KAAK,EAAC,QAAQ,EACd,QAAQ,EAAE,UAAU,CAAC,QAAQ,EAC7B,GAAG,EAAE,SAAS,GACd,EACF,KAAC,OAAO,IAAC,MAAM,EAAE,SAAS,CAAC,OAAO,EAAE,SAAS,EAAC,MAAM,EAAC,SAAS,EAAC,MAAM,YAClE,UAAU,CAAC,IAAI,GACR,IACT,CACJ,CAAC,CAAC,CAAC,CACF,KAAC,IAAI,IAAC,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,WAAW,CAAC,OAAO,CAAC,GAAI,CAC/D,EACD,MAAC,IAAI,IACH,IAAI,EAAE;oBACJ,IAAI,EAAE,CAAC;iBACR,aAEA,gBAAgB,IAAI,gBAAgB,CAAC,OAAO,IAAI,CAC/C,MAAC,sBAAsB,eACrB,KAAC,6BAA6B,cAC3B,gBAAgB,CAAC,OAAO,GACK,EAC/B,gBAAgB,CAAC,IAAI,IACC,CAC1B,EACD,KAAC,YAAY,IAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,GAAI,IACvC,IACF,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,iBAAiB,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, PropsWithoutRef, Ref, ReactNode, useRef } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Flex,\n Text,\n Icon,\n AvatarProps,\n Avatar,\n EmojiDisplay,\n defaultThemeProp,\n ForwardProps,\n Tooltip\n} from '@pega/cosmos-react-core';\n\nexport type TranscriptHeaderProps = {\n /** transcript header content */\n content?: ReactNode;\n /** meta data */\n meta?: ReactNode;\n};\n\nexport interface TranscriptMessageProps {\n /** ref to the element */\n ref?: Ref<HTMLDivElement>;\n /** Timestamp */\n timeStamp: string;\n /** Transcript content */\n message: ReactNode;\n /** Variant of transcript item */\n variant: 'user' | 'bot' | 'question';\n /** Avatar information, can be image and name */\n avatarInfo?: Pick<AvatarProps, 'name' | 'imageSrc'>;\n /** Transcript header */\n transcriptHeader?: TranscriptHeaderProps;\n}\n\nconst iconMapping = {\n user: 'user-solid',\n bot: 'robot-solid',\n question: 'help'\n};\n\nconst StyledTranscriptIcon = styled.svg``;\n\nconst StyledTranscriptTimeStamp = styled.span``;\n\nconst StyledTranscriptHeader = styled.header``;\n\nconst StyledTranscriptHeaderContent = styled.span``;\n\nconst StyledTranscriptMessage = styled.div(\n ({\n theme: {\n components: {\n chat: {\n transcript: {\n message: { 'icon-foreground-color': iconForegroundColor }\n }\n }\n }\n }\n }) => {\n return css`\n width: 100%;\n line-height: 1rem;\n padding: 0 0 0.25rem;\n ${StyledTranscriptIcon} {\n color: ${iconForegroundColor};\n flex-shrink: 0;\n }\n ${StyledTranscriptTimeStamp} {\n flex-shrink: 0;\n }\n ${StyledTranscriptHeader} {\n margin-bottom: 0.25rem;\n }\n ${StyledTranscriptHeaderContent} {\n margin-right: 0.5rem;\n }\n `;\n }\n);\nStyledTranscriptMessage.defaultProps = defaultThemeProp;\n\nconst TranscriptMessage: FunctionComponent<TranscriptMessageProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<TranscriptMessageProps>, ref: TranscriptMessageProps['ref']) => {\n const { variant, transcriptHeader, message, timeStamp, avatarInfo, ...restProps } = props;\n\n const avatarRef = useRef<HTMLDivElement | HTMLImageElement>(null);\n\n return (\n <Flex\n container={{\n gap: 2,\n alignItems: 'start'\n }}\n item={{\n shrink: 0\n }}\n ref={ref}\n as={StyledTranscriptMessage}\n {...restProps}\n >\n <Text as={StyledTranscriptTimeStamp} variant='secondary'>\n {timeStamp}\n </Text>\n {avatarInfo ? (\n <>\n <Avatar\n name={avatarInfo.name}\n size='s'\n shape='circle'\n imageSrc={avatarInfo.imageSrc}\n ref={avatarRef}\n />\n <Tooltip target={avatarRef.current} showDelay='none' hideDelay='none'>\n {avatarInfo.name}\n </Tooltip>\n </>\n ) : (\n <Icon as={StyledTranscriptIcon} name={iconMapping[variant]} />\n )}\n <Flex\n item={{\n grow: 1\n }}\n >\n {transcriptHeader && transcriptHeader.content && (\n <StyledTranscriptHeader>\n <StyledTranscriptHeaderContent>\n {transcriptHeader.content}\n </StyledTranscriptHeaderContent>\n {transcriptHeader.meta}\n </StyledTranscriptHeader>\n )}\n <EmojiDisplay content={message} size={20} />\n </Flex>\n </Flex>\n );\n }\n);\n\nexport default TranscriptMessage;\n"]}
|