@pega/cosmos-react-social 3.0.0-dev.20.0 → 3.0.0-dev.21.2
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/ChatComposer.d.ts.map +1 -1
- package/lib/components/Chat/ChatComposer.js +1 -1
- package/lib/components/Chat/ChatComposer.js.map +1 -1
- package/lib/components/Chat/Message.d.ts.map +1 -1
- package/lib/components/Chat/Message.js +1 -1
- package/lib/components/Chat/Message.js.map +1 -1
- package/lib/components/Chat/Message.styles.d.ts +1 -0
- package/lib/components/Chat/Message.styles.d.ts.map +1 -1
- package/lib/components/Chat/Message.styles.js +10 -1
- package/lib/components/Chat/Message.styles.js.map +1 -1
- package/lib/components/Email/Email.d.ts.map +1 -1
- package/lib/components/Email/Email.js +11 -6
- package/lib/components/Email/Email.js.map +1 -1
- package/lib/components/Email/Email.styles.d.ts +5 -1
- package/lib/components/Email/Email.styles.d.ts.map +1 -1
- package/lib/components/Email/Email.styles.js +0 -1
- package/lib/components/Email/Email.styles.js.map +1 -1
- package/lib/components/Email/Email.types.d.ts +14 -4
- 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/EmailComposer.d.ts.map +1 -1
- package/lib/components/Email/EmailComposer.js +8 -9
- 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 +9 -4
- package/lib/components/Email/EmailConversation.js.map +1 -1
- package/lib/components/Email/EmailShell.js +1 -1
- package/lib/components/Email/EmailShell.js.map +1 -1
- package/lib/components/Email/EmailSummaryItem.d.ts.map +1 -1
- package/lib/components/Email/EmailSummaryItem.js +7 -3
- package/lib/components/Email/EmailSummaryItem.js.map +1 -1
- package/lib/components/Feed/FeedPost.d.ts.map +1 -1
- package/lib/components/Feed/FeedPost.js +4 -3
- package/lib/components/Feed/FeedPost.js.map +1 -1
- package/lib/components/Feed/FeedReply.d.ts.map +1 -1
- package/lib/components/Feed/FeedReply.js +4 -3
- package/lib/components/Feed/FeedReply.js.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatComposer.d.ts","sourceRoot":"","sources":["../../../src/components/Chat/ChatComposer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EACjB,GAAG,EAEH,SAAS,EAOT,SAAS,EACT,aAAa,EACd,MAAM,OAAO,CAAC;AAGf,OAAO,EAeL,YAAY,EAIb,MAAM,yBAAyB,CAAC;AAMjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAInD,oBAAY,iBAAiB,GAAG;IAC9B,gCAAgC;IAChC,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,oEAAoE;IACpE,YAAY,EAAE,CAAC,CAAC,EAAE,aAAa,CAAC,mBAAmB,CAAC,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5E,CAAC;AAEF,MAAM,WAAW,iBAAiB;IAChC,mBAAmB;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,0CAA0C;IAC1C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,0BAA0B;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2CAA2C;IAC3C,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,uCAAuC;IACvC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,sBAAsB;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,uBAAuB;IACvB,WAAW,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACpC,+CAA+C;IAC/C,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7B,iCAAiC;IACjC,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,iCAAiC;IAC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B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2CAA2C;IAC3C,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,uCAAuC;IACvC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,sBAAsB;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,uBAAuB;IACvB,WAAW,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACpC,+CAA+C;IAC/C,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7B,iCAAiC;IACjC,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,iCAAiC;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe;IACf,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,mCAAmC;IACnC,GAAG,CAAC,EAAE,GAAG,CAAC,iCAAiC,CAAC,CAAC;CAC9C;AAkFD,eAAO,MAAM,8BAA8B,yGAG1C,CAAC;AAEF,MAAM,WAAW,iCAAiC;IAChD,mCAAmC;IACnC,eAAe,EAAE,CACf,aAAa,EAAE,MAAM,EACrB,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,KAAK,GAAG,YAAY,KACjD,IAAI,CAAC;IACV,4CAA4C;IAC5C,eAAe,EAAE,SAAS,CAAC,cAAc,GAAG,SAAS,CAAC,CAAC;IACvD,WAAW,EAAE,SAAS,CAAC,mBAAmB,GAAG,SAAS,CAAC,CAAC;CACzD;AAED,QAAA,MAAM,YAAY,EAAE,iBAAiB,CAAC,iBAAiB,GAAG,YAAY,CA0TrE,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -200,7 +200,7 @@ const ChatComposer = forwardRef((props, ref) => {
|
|
|
200
200
|
}, children: _jsx(Icon, { name: 'times' }) })] }, attachment.name));
|
|
201
201
|
}) }), _jsx(TextArea, { ref: textAreaRef, maxLength: maxLength, displayCharCount: maxLength !== undefined, hardStop: false, placeholder: defaultPlaceHolder, value: message, disabled: disabled, onKeyUp: handleSpecialKey, onKeyDown: handleEnterKeyDown, onChange: handleTextAreaChange, onFocus: handleTextAreaChange, "aria-label": t('enter_message') })] }), _jsxs(Flex, { container: { gap: 0.5 }, children: [showEmoji && (_jsx(Button, { ref: setEmojiBtnEl, onClick: toggleEmoji, variant: 'simple', disabled: disabled, icon: true, "aria-label": t('add_emoji'), children: _jsx(Icon, { name: 'face-happy' }) })), maxAttachments > 0 && (_jsxs(StyledAttachmentElementContainer, { disabled: attachments.length >= maxAttachments, ref: setAttachmentsBtnEl, tabIndex: attachments.length >= maxAttachments ? 0 : undefined, role: 'button', children: [_jsx(Button, { onClick: onAddAttachment, variant: 'simple', disabled: !!(disabled || attachments.length >= maxAttachments), icon: true, "aria-label": attachments.length >= maxAttachments
|
|
202
202
|
? t('email_disable_attachment', [maxAttachments])
|
|
203
|
-
: t('email_add_attachment', [maxAttachments]), children: _jsx(Icon, { name: 'paper-clip' }) }), attachments.length >= maxAttachments && (_jsx(Tooltip, { target: attachmentsBtnEl, showDelay: 'none', hideDelay: 'none', ...restProps, children: t('email_disable_attachment', [maxAttachments]) }))] })), _jsx(Flex, { item: { grow: 1 }, children: children }), _jsx(Button, { variant: 'primary', disabled: disabled || (!!maxLength && message.length > maxLength), onClick: () => {
|
|
203
|
+
: t('email_add_attachment', [maxAttachments]), children: _jsx(Icon, { name: 'paper-clip' }) }), attachments.length >= maxAttachments && (_jsx(Tooltip, { target: attachmentsBtnEl, showDelay: 'none', hideDelay: 'none', ...restProps, children: t('email_disable_attachment', [maxAttachments]) }))] })), _jsx(Flex, { item: { grow: 1 }, children: children }), _jsx(Button, { variant: 'primary', disabled: disabled || (!!maxLength && message.length > maxLength) || message.length === 0, onClick: () => {
|
|
204
204
|
sendMessage(message);
|
|
205
205
|
}, children: t('send_label') })] })] }), _jsx(Popover, { show: showEmojiPicker, target: emojiBtnEl, placement: 'bottom-start', modifiers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EAAE,UAAU,EAClB,SAAS,EAAC,cAAc,EACxB,SAAS,EAAE;oBACT;wBACE,IAAI,EAAE,MAAM;wBACZ,OAAO,EAAE,IAAI;qBACd;iBACF,YAED,KAAC,WAAW,IAAC,GAAG,EAAE,cAAc,EAAE,QAAQ,EAAE,aAAa,GAAI,GACrD,IACT,CACJ,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import {\n forwardRef,\n FunctionComponent,\n Ref,\n PropsWithoutRef,\n ReactNode,\n useState,\n useEffect,\n useCallback,\n ChangeEvent,\n useImperativeHandle,\n useRef,\n RefObject,\n KeyboardEvent\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Flex,\n TextArea,\n Button,\n Icon,\n registerIcon,\n Popover,\n EmojiPicker,\n EmojiPickerProps,\n hasProp,\n useI18n,\n useAutoResize,\n useElement,\n defaultThemeProp,\n PropsWithDefaults,\n ForwardProps,\n Tooltip,\n useOuterEvent,\n calculateFontSize\n} from '@pega/cosmos-react-core';\nimport BareButton from '@pega/cosmos-react-core/lib/components/Button/BareButton';\nimport * as timesIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/times.icon';\nimport * as faceHappyIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/face-happy.icon';\nimport * as paperClipIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/paper-clip.icon';\n\nimport { AttachmentItemProps } from './Chat.types';\n\nregisterIcon(timesIcon, faceHappyIcon, paperClipIcon);\n\nexport type SpecialKeysConfig = {\n /** Collection of specialKeys */\n keys: string[];\n /** onSpecialKey is fired when a special key is typed in Textarea */\n onSpecialKey: (e: KeyboardEvent<HTMLTextAreaElement>, key: string) => void;\n};\n\nexport interface ChatComposerProps {\n /** Place holder */\n placeholder?: string;\n /** Default message to populate on load */\n defaultMessage?: string;\n /** Max character limit */\n maxLength?: number;\n /** Callback when send button is clicked */\n onSend: (message: string) => void;\n /** Enter / Return key sends message */\n enterKeySendsMessage?: boolean;\n /** Max number of attachments to be allowed in chat composer.\n * If zero is passed, add attachments icon will be hidden. same rule applies if prop is not passed.\n * If attachments added are >= maxAttachments, add attachments icon will be disabled.\n */\n maxAttachments?: number;\n /** show/hide emoji */\n showEmoji?: boolean;\n /** Attachments list */\n attachments?: AttachmentItemProps[];\n /** Callback when attachment icon is clicked */\n onAddAttachment?: () => void;\n /** Special Keys configuration */\n specialKeysConfig?: SpecialKeysConfig;\n /** Disables the composer area */\n disabled?: boolean;\n /** Children */\n children?: ReactNode;\n /** Ref to the Imperative handle */\n ref?: Ref<ChatComposerImperativeHandleProps>;\n}\n\nconst StyledAttachmentItem = styled.div``;\n\ninterface DisableAttachmentProps {\n disabled?: boolean;\n}\nconst StyledAttachmentElementContainer = styled.div<DisableAttachmentProps>(\n ({ disabled, theme }) => {\n return (\n disabled &&\n css`\n &:focus {\n box-shadow: ${theme.base.shadow.focus};\n border-radius: 50%;\n outline: none;\n }\n `\n );\n }\n);\nconst StyledPreviewButton = styled(BareButton)``;\nconst StyledDeleteButton = styled(BareButton)``;\n\nconst StyledChatComposer = styled.footer<PropsWithDefaults<ChatComposerProps, 'disabled'>>(\n ({\n theme,\n disabled,\n theme: {\n base: { 'font-size': fontSize, 'font-scale': fontScale, 'disabled-opacity': transparentBg },\n components: {\n link: { color: linkColor }\n }\n }\n }) => {\n const { xxs: fontSizeXXS } = calculateFontSize(fontSize, fontScale);\n return css`\n padding: calc(2 * ${theme.base.spacing});\n background-color: ${theme.base.palette['secondary-background']};\n textarea {\n border-radius: ${theme.base['border-radius']};\n height: 2.4rem;\n min-height: 2.4rem;\n border: 0.0625rem solid ${theme.base.colors.gray['extra-light']};\n max-width: 100%;\n }\n ${StyledAttachmentItem} {\n color: ${linkColor};\n background-color: ${theme.base.palette['primary-background']};\n padding: calc(0.5 * ${theme.base.spacing});\n border-radius: calc(0.25 * ${theme.base['border-radius']});\n font-size: ${fontSizeXXS};\n font-weight: bold;\n margin-bottom: calc(0.5 * ${theme.base.spacing});\n opacity: ${disabled ? transparentBg : 1};\n }\n\n ${StyledAttachmentElementContainer} {\n ${disabled &&\n css`\n pointer-events: none;\n `}\n }\n\n ${StyledPreviewButton} {\n color: ${theme.base.palette.interactive};\n font-weight: bold;\n &:hover {\n text-decoration: underline;\n }\n }\n\n ${StyledDeleteButton} {\n color: ${theme.base.palette.interactive};\n }\n `;\n }\n);\n\nStyledChatComposer.defaultProps = defaultThemeProp;\nStyledAttachmentElementContainer.defaultProps = defaultThemeProp;\n\nexport const StyledAttachmentsListContainer = styled.div`\n max-height: 4rem;\n overflow-y: auto;\n`;\n\nexport interface ChatComposerImperativeHandleProps {\n /** Function to append a message */\n appendToMessage: (\n appendMessage: string,\n position?: 'cursor' | 'start' | 'end' | 'specialKey'\n ) => void;\n /** Actual ref to Chat composer component */\n chatComposerRef: RefObject<HTMLDivElement | undefined>;\n textAreaRef: RefObject<HTMLTextAreaElement | undefined>;\n}\n\nconst ChatComposer: FunctionComponent<ChatComposerProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<ChatComposerProps>, ref: ChatComposerProps['ref']) => {\n const {\n children,\n attachments = [],\n maxAttachments = 0,\n onAddAttachment,\n maxLength,\n placeholder: defaultPlaceHolder,\n defaultMessage = '',\n onSend,\n specialKeysConfig,\n disabled = false,\n enterKeySendsMessage = true,\n showEmoji,\n ...restProps\n } = props;\n const [message, setMessage] = useState(defaultMessage);\n useEffect(() => {\n setMessage(defaultMessage);\n }, [defaultMessage]);\n\n const t = useI18n();\n\n const [textAreaRef, resizeTextArea] = useAutoResize<HTMLTextAreaElement>(75.1);\n const [showEmojiPicker, setShowEmojiPicker] = useState(false);\n const [emojiBtnEl, setEmojiBtnEl] = useElement();\n const [attachmentsBtnEl, setAttachmentsBtnEl] = useElement();\n\n const lastEnteredSpecialKey = useRef<string | null>(null);\n\n const appendToMessage = useCallback(\n (\n appendMessage: string,\n position?: 'cursor' | 'start' | 'end' | 'specialKey',\n selectText: boolean = true\n ) => {\n let selectionStart;\n let selectionEnd;\n if (textAreaRef.current) {\n if (position === 'start') {\n textAreaRef.current.value = appendMessage + textAreaRef.current.value;\n selectionStart = 0;\n selectionEnd = appendMessage.length;\n } else if (position === 'end') {\n const initialEnd = textAreaRef.current.value.length;\n textAreaRef.current.value += appendMessage;\n selectionStart = initialEnd;\n selectionEnd = initialEnd + appendMessage.length;\n } else if (position === 'specialKey' && lastEnteredSpecialKey.current) {\n const replaceChars = lastEnteredSpecialKey.current.length;\n const currentSelectionStart = textAreaRef.current.selectionStart;\n textAreaRef.current.value =\n textAreaRef.current.value.substring(\n 0,\n textAreaRef.current.selectionStart - replaceChars\n ) +\n appendMessage +\n textAreaRef.current.value.substring(\n textAreaRef.current.selectionStart,\n textAreaRef.current.value.length\n );\n selectionStart = currentSelectionStart - replaceChars;\n selectionEnd = currentSelectionStart + appendMessage.length - replaceChars;\n lastEnteredSpecialKey.current = null;\n } else {\n const currentSelectionStart = textAreaRef.current.selectionStart;\n textAreaRef.current.value =\n textAreaRef.current.value.substring(0, textAreaRef.current.selectionStart) +\n appendMessage +\n textAreaRef.current.value.substring(\n textAreaRef.current.selectionStart,\n textAreaRef.current.value.length\n );\n selectionStart = currentSelectionStart;\n selectionEnd = currentSelectionStart + appendMessage.length;\n }\n textAreaRef.current.selectionStart = selectText ? selectionStart : selectionEnd;\n textAreaRef.current.selectionEnd = selectionEnd;\n textAreaRef.current.focus();\n setMessage(textAreaRef.current.value);\n }\n },\n [setMessage, textAreaRef.current]\n );\n\n const chatComposerRef = useRef<HTMLDivElement>(null);\n\n useImperativeHandle(ref, () => ({ appendToMessage, chatComposerRef, textAreaRef }), [\n appendToMessage,\n chatComposerRef.current,\n textAreaRef.current\n ]);\n\n const sendMessage = useCallback(\n (newMessage: string) => {\n if (onSend) {\n onSend(newMessage);\n setMessage('');\n resizeTextArea();\n }\n },\n [onSend, resizeTextArea]\n );\n\n const handleEnterKeyDown = useCallback(\n (e: KeyboardEvent) => {\n if (enterKeySendsMessage && e.keyCode === 13 && !e.shiftKey) {\n if (!maxLength || message.length <= maxLength) {\n sendMessage(message);\n }\n e.preventDefault();\n e.stopPropagation();\n }\n },\n [onSend, message, maxLength]\n );\n\n const handleTextAreaChange = useCallback(\n (e: ChangeEvent<HTMLTextAreaElement>) => {\n setMessage(e.currentTarget.value);\n resizeTextArea();\n },\n [setMessage, resizeTextArea]\n );\n\n const handleSpecialKey = useCallback(\n (e: KeyboardEvent<HTMLTextAreaElement>) => {\n if (!specialKeysConfig) return;\n const { keys, onSpecialKey } = specialKeysConfig;\n if (specialKeysConfig && keys.length > 0) {\n const composerValue = e.currentTarget.value.substring(0, e.currentTarget.selectionStart);\n const specialKey = keys.find(key => composerValue.endsWith(key));\n if (specialKey) {\n lastEnteredSpecialKey.current = specialKey;\n onSpecialKey(e, specialKey);\n }\n }\n },\n [specialKeysConfig]\n );\n\n const toggleEmoji = () => {\n setShowEmojiPicker(!showEmojiPicker);\n };\n const onEmojiSelect: EmojiPickerProps['onSelect'] = emojiElem => {\n // Check that it is not a custom emoji\n if (hasProp(emojiElem, 'native')) {\n appendToMessage(emojiElem.native, 'cursor', false);\n }\n setShowEmojiPicker(false);\n };\n\n const EmojiPickerRef = useRef<HTMLDivElement>(null);\n\n useOuterEvent('mousedown', [emojiBtnEl, EmojiPickerRef], () => {\n setShowEmojiPicker(false);\n });\n\n useEffect(() => {\n resizeTextArea();\n }, []);\n\n return (\n <>\n <Flex\n as={StyledChatComposer}\n disabled={disabled}\n container={{\n direction: 'column',\n gap: 2\n }}\n item={{\n shrink: 0\n }}\n {...restProps}\n ref={chatComposerRef}\n >\n <Flex\n container={{\n direction: 'column',\n gap: 0.5\n }}\n >\n <Flex\n container={{\n wrap: 'wrap',\n gap: 0.5\n }}\n as={StyledAttachmentsListContainer}\n >\n {attachments.map(attachment => {\n return (\n <Flex\n key={attachment.name}\n container={{\n gap: 1,\n alignItems: 'center'\n }}\n as={StyledAttachmentItem}\n >\n <BareButton\n as={StyledPreviewButton}\n disabled={disabled}\n onClick={() => {\n attachment.onPreview?.(attachment.name);\n }}\n >\n {attachment.name}\n </BareButton>\n <BareButton\n as={StyledDeleteButton}\n disabled={disabled}\n aria-label={t('email_remove_attachment')}\n onClick={() => {\n attachment.onDelete?.(attachment.name);\n }}\n >\n <Icon name='times' />\n </BareButton>\n </Flex>\n );\n })}\n </Flex>\n <TextArea\n ref={textAreaRef}\n maxLength={maxLength}\n displayCharCount={maxLength !== undefined}\n hardStop={false}\n placeholder={defaultPlaceHolder}\n value={message}\n disabled={disabled}\n onKeyUp={handleSpecialKey}\n onKeyDown={handleEnterKeyDown}\n onChange={handleTextAreaChange}\n onFocus={handleTextAreaChange}\n aria-label={t('enter_message')}\n />\n </Flex>\n <Flex container={{ gap: 0.5 }}>\n {showEmoji && (\n <Button\n ref={setEmojiBtnEl}\n onClick={toggleEmoji}\n variant='simple'\n disabled={disabled}\n icon\n aria-label={t('add_emoji')}\n >\n <Icon name='face-happy' />\n </Button>\n )}\n {maxAttachments > 0 && (\n <StyledAttachmentElementContainer\n disabled={attachments.length >= maxAttachments}\n ref={setAttachmentsBtnEl}\n tabIndex={attachments.length >= maxAttachments ? 0 : undefined}\n role='button'\n >\n <Button\n onClick={onAddAttachment}\n variant='simple'\n disabled={!!(disabled || attachments.length >= maxAttachments)}\n icon\n aria-label={\n attachments.length >= maxAttachments\n ? t('email_disable_attachment', [maxAttachments])\n : t('email_add_attachment', [maxAttachments])\n }\n >\n <Icon name='paper-clip' />\n </Button>\n {attachments.length >= maxAttachments && (\n <Tooltip\n target={attachmentsBtnEl}\n showDelay='none'\n hideDelay='none'\n {...restProps}\n >\n {t('email_disable_attachment', [maxAttachments])}\n </Tooltip>\n )}\n </StyledAttachmentElementContainer>\n )}\n <Flex item={{ grow: 1 }}>{children}</Flex>\n <Button\n variant='primary'\n disabled={disabled || (!!maxLength && message.length > maxLength)}\n onClick={() => {\n sendMessage(message);\n }}\n >\n {t('send_label')}\n </Button>\n </Flex>\n </Flex>\n <Popover\n show={showEmojiPicker}\n target={emojiBtnEl}\n placement='bottom-start'\n modifiers={[\n {\n name: 'flip',\n enabled: true\n }\n ]}\n >\n <EmojiPicker ref={EmojiPickerRef} onSelect={onEmojiSelect} />\n </Popover>\n </>\n );\n }\n);\n\nexport default ChatComposer;\n"]}
|
|
1
|
+
{"version":3,"file":"ChatComposer.js","sourceRoot":"","sources":["../../../src/components/Chat/ChatComposer.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EAKV,QAAQ,EACR,SAAS,EACT,WAAW,EAEX,mBAAmB,EACnB,MAAM,EAGP,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,YAAY,EACZ,OAAO,EACP,WAAW,EAEX,OAAO,EACP,OAAO,EACP,aAAa,EACb,UAAU,EACV,gBAAgB,EAGhB,OAAO,EACP,aAAa,EACb,iBAAiB,EAClB,MAAM,yBAAyB,CAAC;AACjC,OAAO,UAAU,MAAM,0DAA0D,CAAC;AAClF,OAAO,KAAK,SAAS,MAAM,8DAA8D,CAAC;AAC1F,OAAO,KAAK,aAAa,MAAM,mEAAmE,CAAC;AACnG,OAAO,KAAK,aAAa,MAAM,mEAAmE,CAAC;AAInG,YAAY,CAAC,SAAS,EAAE,aAAa,EAAE,aAAa,CAAC,CAAC;AAyCtD,MAAM,oBAAoB,GAAG,MAAM,CAAC,GAAG,CAAA,EAAE,CAAC;AAK1C,MAAM,gCAAgC,GAAG,MAAM,CAAC,GAAG,CACjD,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAE;IACtB,OAAO,CACL,QAAQ;QACR,GAAG,CAAA;;wBAEe,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK;;;;OAIxC,CACF,CAAC;AACJ,CAAC,CACF,CAAC;AACF,MAAM,mBAAmB,GAAG,MAAM,CAAC,UAAU,CAAC,CAAA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E,GAAG,EAAE;oCACZ,WAAW,CAAC,OAAO,CAAC,CAAC;gCACvB,CAAC,YAEA,CAAC,CAAC,YAAY,CAAC,GACT,IACJ,IACF,EACP,KAAC,OAAO,IACN,IAAI,EAAE,eAAe,EACrB,MAAM,EAAE,UAAU,EAClB,SAAS,EAAC,cAAc,EACxB,SAAS,EAAE;oBACT;wBACE,IAAI,EAAE,MAAM;wBACZ,OAAO,EAAE,IAAI;qBACd;iBACF,YAED,KAAC,WAAW,IAAC,GAAG,EAAE,cAAc,EAAE,QAAQ,EAAE,aAAa,GAAI,GACrD,IACT,CACJ,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import {\n forwardRef,\n FunctionComponent,\n Ref,\n PropsWithoutRef,\n ReactNode,\n useState,\n useEffect,\n useCallback,\n ChangeEvent,\n useImperativeHandle,\n useRef,\n RefObject,\n KeyboardEvent\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Flex,\n TextArea,\n Button,\n Icon,\n registerIcon,\n Popover,\n EmojiPicker,\n EmojiPickerProps,\n hasProp,\n useI18n,\n useAutoResize,\n useElement,\n defaultThemeProp,\n PropsWithDefaults,\n ForwardProps,\n Tooltip,\n useOuterEvent,\n calculateFontSize\n} from '@pega/cosmos-react-core';\nimport BareButton from '@pega/cosmos-react-core/lib/components/Button/BareButton';\nimport * as timesIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/times.icon';\nimport * as faceHappyIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/face-happy.icon';\nimport * as paperClipIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/paper-clip.icon';\n\nimport { AttachmentItemProps } from './Chat.types';\n\nregisterIcon(timesIcon, faceHappyIcon, paperClipIcon);\n\nexport type SpecialKeysConfig = {\n /** Collection of specialKeys */\n keys: string[];\n /** onSpecialKey is fired when a special key is typed in Textarea */\n onSpecialKey: (e: KeyboardEvent<HTMLTextAreaElement>, key: string) => void;\n};\n\nexport interface ChatComposerProps {\n /** Place holder */\n placeholder?: string;\n /** Default message to populate on load */\n defaultMessage?: string;\n /** Max character limit */\n maxLength?: number;\n /** Callback when send button is clicked */\n onSend: (message: string) => void;\n /** Enter / Return key sends message */\n enterKeySendsMessage?: boolean;\n /** Max number of attachments to be allowed in chat composer.\n * If zero is passed, add attachments icon will be hidden. same rule applies if prop is not passed.\n * If attachments added are >= maxAttachments, add attachments icon will be disabled.\n */\n maxAttachments?: number;\n /** show/hide emoji */\n showEmoji?: boolean;\n /** Attachments list */\n attachments?: AttachmentItemProps[];\n /** Callback when attachment icon is clicked */\n onAddAttachment?: () => void;\n /** Special Keys configuration */\n specialKeysConfig?: SpecialKeysConfig;\n /** Disables the composer area */\n disabled?: boolean;\n /** Children */\n children?: ReactNode;\n /** Ref to the Imperative handle */\n ref?: Ref<ChatComposerImperativeHandleProps>;\n}\n\nconst StyledAttachmentItem = styled.div``;\n\ninterface DisableAttachmentProps {\n disabled?: boolean;\n}\nconst StyledAttachmentElementContainer = styled.div<DisableAttachmentProps>(\n ({ disabled, theme }) => {\n return (\n disabled &&\n css`\n &:focus {\n box-shadow: ${theme.base.shadow.focus};\n border-radius: 50%;\n outline: none;\n }\n `\n );\n }\n);\nconst StyledPreviewButton = styled(BareButton)``;\nconst StyledDeleteButton = styled(BareButton)``;\n\nconst StyledChatComposer = styled.footer<PropsWithDefaults<ChatComposerProps, 'disabled'>>(\n ({\n theme,\n disabled,\n theme: {\n base: { 'font-size': fontSize, 'font-scale': fontScale, 'disabled-opacity': transparentBg },\n components: {\n link: { color: linkColor }\n }\n }\n }) => {\n const { xxs: fontSizeXXS } = calculateFontSize(fontSize, fontScale);\n return css`\n padding: calc(2 * ${theme.base.spacing});\n background-color: ${theme.base.palette['secondary-background']};\n textarea {\n border-radius: ${theme.base['border-radius']};\n height: 2.4rem;\n min-height: 2.4rem;\n border: 0.0625rem solid ${theme.base.colors.gray['extra-light']};\n max-width: 100%;\n }\n ${StyledAttachmentItem} {\n color: ${linkColor};\n background-color: ${theme.base.palette['primary-background']};\n padding: calc(0.5 * ${theme.base.spacing});\n border-radius: calc(0.25 * ${theme.base['border-radius']});\n font-size: ${fontSizeXXS};\n font-weight: bold;\n margin-bottom: calc(0.5 * ${theme.base.spacing});\n opacity: ${disabled ? transparentBg : 1};\n }\n\n ${StyledAttachmentElementContainer} {\n ${disabled &&\n css`\n pointer-events: none;\n `}\n }\n\n ${StyledPreviewButton} {\n color: ${theme.base.palette.interactive};\n font-weight: bold;\n &:hover {\n text-decoration: underline;\n }\n }\n\n ${StyledDeleteButton} {\n color: ${theme.base.palette.interactive};\n }\n `;\n }\n);\n\nStyledChatComposer.defaultProps = defaultThemeProp;\nStyledAttachmentElementContainer.defaultProps = defaultThemeProp;\n\nexport const StyledAttachmentsListContainer = styled.div`\n max-height: 4rem;\n overflow-y: auto;\n`;\n\nexport interface ChatComposerImperativeHandleProps {\n /** Function to append a message */\n appendToMessage: (\n appendMessage: string,\n position?: 'cursor' | 'start' | 'end' | 'specialKey'\n ) => void;\n /** Actual ref to Chat composer component */\n chatComposerRef: RefObject<HTMLDivElement | undefined>;\n textAreaRef: RefObject<HTMLTextAreaElement | undefined>;\n}\n\nconst ChatComposer: FunctionComponent<ChatComposerProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<ChatComposerProps>, ref: ChatComposerProps['ref']) => {\n const {\n children,\n attachments = [],\n maxAttachments = 0,\n onAddAttachment,\n maxLength,\n placeholder: defaultPlaceHolder,\n defaultMessage = '',\n onSend,\n specialKeysConfig,\n disabled = false,\n enterKeySendsMessage = true,\n showEmoji,\n ...restProps\n } = props;\n const [message, setMessage] = useState(defaultMessage);\n useEffect(() => {\n setMessage(defaultMessage);\n }, [defaultMessage]);\n\n const t = useI18n();\n\n const [textAreaRef, resizeTextArea] = useAutoResize<HTMLTextAreaElement>(75.1);\n const [showEmojiPicker, setShowEmojiPicker] = useState(false);\n const [emojiBtnEl, setEmojiBtnEl] = useElement();\n const [attachmentsBtnEl, setAttachmentsBtnEl] = useElement();\n\n const lastEnteredSpecialKey = useRef<string | null>(null);\n\n const appendToMessage = useCallback(\n (\n appendMessage: string,\n position?: 'cursor' | 'start' | 'end' | 'specialKey',\n selectText: boolean = true\n ) => {\n let selectionStart;\n let selectionEnd;\n if (textAreaRef.current) {\n if (position === 'start') {\n textAreaRef.current.value = appendMessage + textAreaRef.current.value;\n selectionStart = 0;\n selectionEnd = appendMessage.length;\n } else if (position === 'end') {\n const initialEnd = textAreaRef.current.value.length;\n textAreaRef.current.value += appendMessage;\n selectionStart = initialEnd;\n selectionEnd = initialEnd + appendMessage.length;\n } else if (position === 'specialKey' && lastEnteredSpecialKey.current) {\n const replaceChars = lastEnteredSpecialKey.current.length;\n const currentSelectionStart = textAreaRef.current.selectionStart;\n textAreaRef.current.value =\n textAreaRef.current.value.substring(\n 0,\n textAreaRef.current.selectionStart - replaceChars\n ) +\n appendMessage +\n textAreaRef.current.value.substring(\n textAreaRef.current.selectionStart,\n textAreaRef.current.value.length\n );\n selectionStart = currentSelectionStart - replaceChars;\n selectionEnd = currentSelectionStart + appendMessage.length - replaceChars;\n lastEnteredSpecialKey.current = null;\n } else {\n const currentSelectionStart = textAreaRef.current.selectionStart;\n textAreaRef.current.value =\n textAreaRef.current.value.substring(0, textAreaRef.current.selectionStart) +\n appendMessage +\n textAreaRef.current.value.substring(\n textAreaRef.current.selectionStart,\n textAreaRef.current.value.length\n );\n selectionStart = currentSelectionStart;\n selectionEnd = currentSelectionStart + appendMessage.length;\n }\n textAreaRef.current.selectionStart = selectText ? selectionStart : selectionEnd;\n textAreaRef.current.selectionEnd = selectionEnd;\n textAreaRef.current.focus();\n setMessage(textAreaRef.current.value);\n }\n },\n [setMessage, textAreaRef.current]\n );\n\n const chatComposerRef = useRef<HTMLDivElement>(null);\n\n useImperativeHandle(ref, () => ({ appendToMessage, chatComposerRef, textAreaRef }), [\n appendToMessage,\n chatComposerRef.current,\n textAreaRef.current\n ]);\n\n const sendMessage = useCallback(\n (newMessage: string) => {\n if (onSend) {\n onSend(newMessage);\n setMessage('');\n resizeTextArea();\n }\n },\n [onSend, resizeTextArea]\n );\n\n const handleEnterKeyDown = useCallback(\n (e: KeyboardEvent) => {\n if (enterKeySendsMessage && e.keyCode === 13 && !e.shiftKey) {\n if (!maxLength || message.length <= maxLength) {\n sendMessage(message);\n }\n e.preventDefault();\n e.stopPropagation();\n }\n },\n [onSend, message, maxLength]\n );\n\n const handleTextAreaChange = useCallback(\n (e: ChangeEvent<HTMLTextAreaElement>) => {\n setMessage(e.currentTarget.value);\n resizeTextArea();\n },\n [setMessage, resizeTextArea]\n );\n\n const handleSpecialKey = useCallback(\n (e: KeyboardEvent<HTMLTextAreaElement>) => {\n if (!specialKeysConfig) return;\n const { keys, onSpecialKey } = specialKeysConfig;\n if (specialKeysConfig && keys.length > 0) {\n const composerValue = e.currentTarget.value.substring(0, e.currentTarget.selectionStart);\n const specialKey = keys.find(key => composerValue.endsWith(key));\n if (specialKey) {\n lastEnteredSpecialKey.current = specialKey;\n onSpecialKey(e, specialKey);\n }\n }\n },\n [specialKeysConfig]\n );\n\n const toggleEmoji = () => {\n setShowEmojiPicker(!showEmojiPicker);\n };\n const onEmojiSelect: EmojiPickerProps['onSelect'] = emojiElem => {\n // Check that it is not a custom emoji\n if (hasProp(emojiElem, 'native')) {\n appendToMessage(emojiElem.native, 'cursor', false);\n }\n setShowEmojiPicker(false);\n };\n\n const EmojiPickerRef = useRef<HTMLDivElement>(null);\n\n useOuterEvent('mousedown', [emojiBtnEl, EmojiPickerRef], () => {\n setShowEmojiPicker(false);\n });\n\n useEffect(() => {\n resizeTextArea();\n }, []);\n\n return (\n <>\n <Flex\n as={StyledChatComposer}\n disabled={disabled}\n container={{\n direction: 'column',\n gap: 2\n }}\n item={{\n shrink: 0\n }}\n {...restProps}\n ref={chatComposerRef}\n >\n <Flex\n container={{\n direction: 'column',\n gap: 0.5\n }}\n >\n <Flex\n container={{\n wrap: 'wrap',\n gap: 0.5\n }}\n as={StyledAttachmentsListContainer}\n >\n {attachments.map(attachment => {\n return (\n <Flex\n key={attachment.name}\n container={{\n gap: 1,\n alignItems: 'center'\n }}\n as={StyledAttachmentItem}\n >\n <BareButton\n as={StyledPreviewButton}\n disabled={disabled}\n onClick={() => {\n attachment.onPreview?.(attachment.name);\n }}\n >\n {attachment.name}\n </BareButton>\n <BareButton\n as={StyledDeleteButton}\n disabled={disabled}\n aria-label={t('email_remove_attachment')}\n onClick={() => {\n attachment.onDelete?.(attachment.name);\n }}\n >\n <Icon name='times' />\n </BareButton>\n </Flex>\n );\n })}\n </Flex>\n <TextArea\n ref={textAreaRef}\n maxLength={maxLength}\n displayCharCount={maxLength !== undefined}\n hardStop={false}\n placeholder={defaultPlaceHolder}\n value={message}\n disabled={disabled}\n onKeyUp={handleSpecialKey}\n onKeyDown={handleEnterKeyDown}\n onChange={handleTextAreaChange}\n onFocus={handleTextAreaChange}\n aria-label={t('enter_message')}\n />\n </Flex>\n <Flex container={{ gap: 0.5 }}>\n {showEmoji && (\n <Button\n ref={setEmojiBtnEl}\n onClick={toggleEmoji}\n variant='simple'\n disabled={disabled}\n icon\n aria-label={t('add_emoji')}\n >\n <Icon name='face-happy' />\n </Button>\n )}\n {maxAttachments > 0 && (\n <StyledAttachmentElementContainer\n disabled={attachments.length >= maxAttachments}\n ref={setAttachmentsBtnEl}\n tabIndex={attachments.length >= maxAttachments ? 0 : undefined}\n role='button'\n >\n <Button\n onClick={onAddAttachment}\n variant='simple'\n disabled={!!(disabled || attachments.length >= maxAttachments)}\n icon\n aria-label={\n attachments.length >= maxAttachments\n ? t('email_disable_attachment', [maxAttachments])\n : t('email_add_attachment', [maxAttachments])\n }\n >\n <Icon name='paper-clip' />\n </Button>\n {attachments.length >= maxAttachments && (\n <Tooltip\n target={attachmentsBtnEl}\n showDelay='none'\n hideDelay='none'\n {...restProps}\n >\n {t('email_disable_attachment', [maxAttachments])}\n </Tooltip>\n )}\n </StyledAttachmentElementContainer>\n )}\n <Flex item={{ grow: 1 }}>{children}</Flex>\n <Button\n variant='primary'\n disabled={\n disabled || (!!maxLength && message.length > maxLength) || message.length === 0\n }\n onClick={() => {\n sendMessage(message);\n }}\n >\n {t('send_label')}\n </Button>\n </Flex>\n </Flex>\n <Popover\n show={showEmojiPicker}\n target={emojiBtnEl}\n placement='bottom-start'\n modifiers={[\n {\n name: 'flip',\n enabled: true\n }\n ]}\n >\n <EmojiPicker ref={EmojiPickerRef} onSelect={onEmojiSelect} />\n </Popover>\n </>\n );\n }\n);\n\nexport default ChatComposer;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Message.d.ts","sourceRoot":"","sources":["../../../src/components/Chat/Message.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAc,SAAS,EAAmB,GAAG,EAAc,MAAM,OAAO,CAAC;AAEnG,OAAO,EACL,WAAW,EAKX,SAAS,EAMT,YAAY,EACb,MAAM,yBAAyB,CAAC;AAMjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAuBnD,MAAM,WAAW,cAAe,SAAQ,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC;IAC7D,mCAAmC;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,2DAA2D;IAC3D,SAAS,CAAC,EAAE,mBAAmB,CAAC,WAAW,CAAC,CAAC;IAC7C,wDAAwD;IACxD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,oBAAY,kBAAkB,GAAG;IAC/B,6BAA6B;IAC7B,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,gBAAgB;IAChB,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB,CAAC;AAEF,MAAM,WAAW,YAAY;IAC3B,iCAAiC;IACjC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IAC1B,8BAA8B;IAC9B,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,sBAAsB;IACtB,WAAW,CAAC,EAAE,mBAAmB,EA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IACpB,gBAAgB;IAChB,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB,CAAC;AAEF,MAAM,WAAW,YAAY;IAC3B,iCAAiC;IACjC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IAC1B,8BAA8B;IAC9B,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,sBAAsB;IACtB,WAAW,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACpC,mCAAmC;IACnC,aAAa,CAAC,EAAE,cAAc,EAAE,CAAC;IACjC,wFAAwF;IACxF,OAAO,EAAE,QAAQ,GAAG,UAAU,GAAG,OAAO,CAAC;IACzC,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yCAAyC;IACzC,SAAS,EAAE,IAAI,GAAG,KAAK,CAAC;IACxB,gDAAgD;IAChD,UAAU,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,UAAU,CAAC,CAAC;IACpD,mBAAmB;IACnB,WAAW,CAAC,EAAE,WAAW,GAAG,YAAY,CAAC;IACzC,qBAAqB;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yDAAyD;IACzD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,qBAAqB;IACrB,aAAa,CAAC,EAAE,kBAAkB,CAAC;CACpC;AAED,QAAA,MAAM,OAAO,EAAE,iBAAiB,CAAC,YAAY,GAAG,YAAY,CAsL3D,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -22,7 +22,7 @@ const Message = forwardRef((props, ref) => {
|
|
|
22
22
|
direction: direction === 'in' ? 'row' : 'row-reverse'
|
|
23
23
|
}, item: {
|
|
24
24
|
shrink: 0
|
|
25
|
-
}, messageDirection: direction, variant: variant, typing: typing, messageHeader: messageHeader, ...restProps, children: [avatarInfo && (_jsx(Avatar, { name: avatarInfo.name, size: 'm', shape: 'circle', imageSrc: avatarInfo.imageSrc })), _jsxs(Flex, { container: {
|
|
25
|
+
}, hasMessage: !!message, messageDirection: direction, variant: variant, typing: typing, messageHeader: messageHeader, ...restProps, children: [avatarInfo && (_jsx(Avatar, { name: avatarInfo.name, size: 'm', shape: 'circle', imageSrc: avatarInfo.imageSrc })), _jsxs(Flex, { container: {
|
|
26
26
|
direction: 'column',
|
|
27
27
|
alignItems: direction === 'in' ? 'start' : 'end',
|
|
28
28
|
justify: 'center'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Message.js","sourceRoot":"","sources":["../../../src/components/Chat/Message.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,UAAU,EAA+C,MAAM,OAAO,CAAC;AAEnG,OAAO,EAEL,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,YAAY,EAEZ,WAAW,EACX,KAAK,EAEL,YAAY,EACZ,OAAO,EAER,MAAM,yBAAyB,CAAC;AACjC,OAAO,UAAU,MAAM,0DAA0D,CAAC;AAClF,OAAO,KAAK,YAAY,MAAM,iEAAiE,CAAC;AAChG,OAAO,KAAK,eAAe,MAAM,qEAAqE,CAAC;AACvG,OAAO,KAAK,WAAW,MAAM,iEAAiE,CAAC;AAG/F,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACnB,0BAA0B,EAC1B,eAAe,EACf,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,EACf,yBAAyB,EACzB,uBAAuB,EACvB,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,0BAA0B,EAC1B,uBAAuB,EACxB,MAAM,kBAAkB,CAAC;AAE1B,YAAY,CAAC,YAAY,EAAE,eAAe,EAAE,WAAW,CAAC,CAAC;AA6CzD,MAAM,OAAO,GAAmD,UAAU,CACxE,CAAC,KAAoC,EAAE,GAAwB,EAAE,EAAE;IACjE,MAAM,EACJ,OAAO,EACP,SAAS,EACT,OAAO,EACP,UAAU,EACV,SAAS,EACT,WAAW,GAAG,EAAE,EAChB,aAAa,GAAG,EAAE,EAClB,M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AAc,cAAE,SAAS,GAAkB,EACzD,MAAM,IAAI,KAAC,cAAc,cAAE,MAAM,GAAkB,IAC/C,CACR,EACA,MAAM,IAAI,CACT,MAAC,IAAI,IACH,SAAS,EAAE;4BACT,GAAG,EAAE,IAAI;yBACV,aAED,KAAC,iBAAiB,IAAC,KAAK,EAAE,CAAC,GAAI,EAC/B,KAAC,iBAAiB,IAAC,KAAK,EAAE,IAAI,GAAI,EAClC,KAAC,iBAAiB,IAAC,KAAK,EAAE,GAAG,GAAI,IAC5B,CACR,IACI,IACF,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,OAAO,CAAC","sourcesContent":["import { FunctionComponent, forwardRef, ReactNode, PropsWithoutRef, Ref, MouseEvent } from 'react';\n\nimport {\n AvatarProps,\n Avatar,\n Flex,\n Icon,\n registerIcon,\n LinkProps,\n SummaryItem,\n Image,\n FlexContainerProps,\n EmojiDisplay,\n useI18n,\n ForwardProps\n} from '@pega/cosmos-react-core';\nimport BareButton from '@pega/cosmos-react-core/lib/components/Button/BareButton';\nimport * as downloadIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/download.icon';\nimport * as documentDocIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/document-doc.icon';\nimport * as chainUpIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/chain-up.icon';\n\nimport { AttachmentItemProps } from './Chat.types';\nimport {\n StyledMessageContainer,\n StyledMessageMain,\n StyledMessageBubble,\n StyledMessageBubbleContent,\n StyledMediaList,\n StyledMediaListItem,\n StyledMediaThumbNail,\n StyledSummaryItem,\n StyledMediaLink,\n StyledMediaDownloadButton,\n StyledMetaInfoContainer,\n StyledMetaInfo,\n StyledBlinkingDot,\n StyledMediaButton,\n StyledMessageHeader,\n StyledMessageHeaderContent,\n StyledMessageHeaderMeta\n} from './Message.styles';\n\nregisterIcon(downloadIcon, documentDocIcon, chainUpIcon);\n\nexport interface MediaPageLinks extends Pick<LinkProps, 'href'> {\n /** Unique id for this push link */\n id: string;\n /** A string to be used as an image src for a thumbnail. */\n thumbnail?: AttachmentItemProps['thumbnail'];\n /** Additional information about the linked resource. */\n title?: string;\n}\n\nexport type MessageHeaderProps = {\n /** message header content */\n content?: ReactNode;\n /** meta data */\n meta?: ReactNode;\n};\n\nexport interface MessageProps {\n /** ref to the message wrapper */\n ref?: Ref<HTMLDivElement>;\n /** Message to be displayed */\n message?: ReactNode;\n /** Attachment list */\n attachments?: AttachmentItemProps[];\n /** Message page push links list */\n pagePushLinks?: MediaPageLinks[];\n /** 3 themes supported by default to differentiate between sender, receiver and other */\n variant: 'sender' | 'receiver' | 'other';\n /** timestamp of the message(Formatted) */\n timeStamp?: string;\n /** Incoming message/ outgoing message */\n direction: 'in' | 'out';\n /** Avatar information, can be image and name */\n avatarInfo?: Pick<AvatarProps, 'name' | 'imageSrc'>;\n /** Content type */\n contentType?: 'rich-text' | 'plain-text';\n /** Message status */\n status?: string;\n /** Indicates if this message is being currently typed */\n typing?: boolean;\n /** Message header */\n messageHeader?: MessageHeaderProps;\n}\n\nconst Message: FunctionComponent<MessageProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<MessageProps>, ref: MessageProps['ref']) => {\n const {\n message,\n direction,\n variant,\n avatarInfo,\n timeStamp,\n attachments = [],\n pagePushLinks = [],\n status,\n typing,\n messageHeader,\n ...restProps\n } = props;\n\n const t = useI18n();\n\n let messageMetaJustify: FlexContainerProps['justify'] = 'between';\n if (timeStamp && !status) {\n messageMetaJustify = 'start';\n } else if (!timeStamp && status) {\n messageMetaJustify = 'end';\n }\n\n return (\n <Flex\n as={StyledMessageContainer}\n ref={ref}\n container={{\n gap: 0.5,\n direction: direction === 'in' ? 'row' : 'row-reverse'\n }}\n item={{\n shrink: 0\n }}\n messageDirection={direction}\n variant={variant}\n typing={typing}\n messageHeader={messageHeader}\n {...restProps}\n >\n {avatarInfo && (\n <Avatar name={avatarInfo.name} size='m' shape='circle' imageSrc={avatarInfo.imageSrc} />\n )}\n <Flex\n container={{\n direction: 'column',\n alignItems: direction === 'in' ? 'start' : 'end',\n justify: 'center'\n }}\n as={StyledMessageMain}\n >\n <StyledMessageBubble>\n {messageHeader && (\n <Flex container={{ gap: 0.5, justify: 'between' }} as={StyledMessageHeader}>\n <StyledMessageHeaderContent>{messageHeader.content}</StyledMessageHeaderContent>\n <StyledMessageHeaderMeta>{messageHeader.meta}</StyledMessageHeaderMeta>\n </Flex>\n )}\n {message && (\n <StyledMessageBubbleContent>\n <EmojiDisplay content={message} size={20} />\n </StyledMessageBubbleContent>\n )}\n {(attachments.length > 0 || pagePushLinks.length > 0) && (\n <StyledMediaList>\n {attachments.map(attachment => {\n const { id, icon, name, meta, onDownload, onPreview, thumbnail } = attachment;\n return (\n <Flex\n key={id}\n as={StyledMediaListItem}\n container={{\n direction: 'column'\n }}\n >\n {thumbnail && (\n <Image\n as={StyledMediaThumbNail}\n src={thumbnail}\n onClick={(e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n onPreview?.(id);\n }}\n alt={name}\n />\n )}\n <SummaryItem\n as={StyledSummaryItem}\n primary={\n <StyledMediaButton\n onClick={(e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n onPreview?.(id);\n }}\n >\n {name}\n </StyledMediaButton>\n }\n secondary={meta}\n visual={<Icon name={icon || 'document-doc'} />}\n actions={\n <BareButton\n aria-label={t('download')}\n as={StyledMediaDownloadButton}\n onClick={(e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n onDownload?.(id);\n }}\n >\n <Icon name='download' />\n </BareButton>\n }\n />\n </Flex>\n );\n })}\n {pagePushLinks.map(pagePushLink => {\n const { id, href, title, thumbnail } = pagePushLink;\n return (\n <Flex\n as={StyledMediaListItem}\n key={id}\n container={{\n direction: 'column'\n }}\n >\n {thumbnail && (\n <Image as={StyledMediaThumbNail} src={thumbnail} alt={title || href} />\n )}\n <SummaryItem\n as={StyledSummaryItem}\n primary={\n <StyledMediaLink\n aria-label={title}\n href={href}\n target='_blank'\n rel='noreferrer'\n >\n {href}\n </StyledMediaLink>\n }\n visual={<Icon name='chain-up' />}\n />\n </Flex>\n );\n })}\n </StyledMediaList>\n )}\n </StyledMessageBubble>\n {!typing && (\n <Flex\n as={StyledMetaInfoContainer}\n container={{\n justify: messageMetaJustify,\n gap: 1.5\n }}\n >\n {timeStamp && <StyledMetaInfo>{timeStamp}</StyledMetaInfo>}\n {status && <StyledMetaInfo>{status}</StyledMetaInfo>}\n </Flex>\n )}\n {typing && (\n <Flex\n container={{\n gap: 0.25\n }}\n >\n <StyledBlinkingDot delay={0} />\n <StyledBlinkingDot delay={0.25} />\n <StyledBlinkingDot delay={0.5} />\n </Flex>\n )}\n </Flex>\n </Flex>\n );\n }\n);\n\nexport default Message;\n"]}
|
|
1
|
+
{"version":3,"file":"Message.js","sourceRoot":"","sources":["../../../src/components/Chat/Message.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,UAAU,EAA+C,MAAM,OAAO,CAAC;AAEnG,OAAO,EAEL,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,YAAY,EAEZ,WAAW,EACX,KAAK,EAEL,YAAY,EACZ,OAAO,EAER,MAAM,yBAAyB,CAAC;AACjC,OAAO,UAAU,MAAM,0DAA0D,CAAC;AAClF,OAAO,KAAK,YAAY,MAAM,iEAAiE,CAAC;AAChG,OAAO,KAAK,eAAe,MAAM,qEAAqE,CAAC;AACvG,OAAO,KAAK,WAAW,MAAM,iEAAiE,CAAC;AAG/F,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACnB,0BAA0B,EAC1B,eAAe,EACf,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,EACf,yBAAyB,EACzB,uBAAuB,EACvB,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,0BAA0B,EAC1B,uBAAuB,EACxB,MAAM,kBAAkB,CAAC;AAE1B,YAAY,CAAC,YAAY,EAAE,eAAe,EAAE,WAAW,CAAC,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GAChC,KArBG,EAAE,CAsBF,CACR,CAAC;oCACJ,CAAC,CAAC,IACc,CACnB,IACmB,EACrB,CAAC,MAAM,IAAI,CACV,MAAC,IAAI,IACH,EAAE,EAAE,uBAAuB,EAC3B,SAAS,EAAE;4BACT,OAAO,EAAE,kBAAkB;4BAC3B,GAAG,EAAE,GAAG;yBACT,aAEA,SAAS,IAAI,KAAC,cAAc,cAAE,SAAS,GAAkB,EACzD,MAAM,IAAI,KAAC,cAAc,cAAE,MAAM,GAAkB,IAC/C,CACR,EACA,MAAM,IAAI,CACT,MAAC,IAAI,IACH,SAAS,EAAE;4BACT,GAAG,EAAE,IAAI;yBACV,aAED,KAAC,iBAAiB,IAAC,KAAK,EAAE,CAAC,GAAI,EAC/B,KAAC,iBAAiB,IAAC,KAAK,EAAE,IAAI,GAAI,EAClC,KAAC,iBAAiB,IAAC,KAAK,EAAE,GAAG,GAAI,IAC5B,CACR,IACI,IACF,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,OAAO,CAAC","sourcesContent":["import { FunctionComponent, forwardRef, ReactNode, PropsWithoutRef, Ref, MouseEvent } from 'react';\n\nimport {\n AvatarProps,\n Avatar,\n Flex,\n Icon,\n registerIcon,\n LinkProps,\n SummaryItem,\n Image,\n FlexContainerProps,\n EmojiDisplay,\n useI18n,\n ForwardProps\n} from '@pega/cosmos-react-core';\nimport BareButton from '@pega/cosmos-react-core/lib/components/Button/BareButton';\nimport * as downloadIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/download.icon';\nimport * as documentDocIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/document-doc.icon';\nimport * as chainUpIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/chain-up.icon';\n\nimport { AttachmentItemProps } from './Chat.types';\nimport {\n StyledMessageContainer,\n StyledMessageMain,\n StyledMessageBubble,\n StyledMessageBubbleContent,\n StyledMediaList,\n StyledMediaListItem,\n StyledMediaThumbNail,\n StyledSummaryItem,\n StyledMediaLink,\n StyledMediaDownloadButton,\n StyledMetaInfoContainer,\n StyledMetaInfo,\n StyledBlinkingDot,\n StyledMediaButton,\n StyledMessageHeader,\n StyledMessageHeaderContent,\n StyledMessageHeaderMeta\n} from './Message.styles';\n\nregisterIcon(downloadIcon, documentDocIcon, chainUpIcon);\n\nexport interface MediaPageLinks extends Pick<LinkProps, 'href'> {\n /** Unique id for this push link */\n id: string;\n /** A string to be used as an image src for a thumbnail. */\n thumbnail?: AttachmentItemProps['thumbnail'];\n /** Additional information about the linked resource. */\n title?: string;\n}\n\nexport type MessageHeaderProps = {\n /** message header content */\n content?: ReactNode;\n /** meta data */\n meta?: ReactNode;\n};\n\nexport interface MessageProps {\n /** ref to the message wrapper */\n ref?: Ref<HTMLDivElement>;\n /** Message to be displayed */\n message?: ReactNode;\n /** Attachment list */\n attachments?: AttachmentItemProps[];\n /** Message page push links list */\n pagePushLinks?: MediaPageLinks[];\n /** 3 themes supported by default to differentiate between sender, receiver and other */\n variant: 'sender' | 'receiver' | 'other';\n /** timestamp of the message(Formatted) */\n timeStamp?: string;\n /** Incoming message/ outgoing message */\n direction: 'in' | 'out';\n /** Avatar information, can be image and name */\n avatarInfo?: Pick<AvatarProps, 'name' | 'imageSrc'>;\n /** Content type */\n contentType?: 'rich-text' | 'plain-text';\n /** Message status */\n status?: string;\n /** Indicates if this message is being currently typed */\n typing?: boolean;\n /** Message header */\n messageHeader?: MessageHeaderProps;\n}\n\nconst Message: FunctionComponent<MessageProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<MessageProps>, ref: MessageProps['ref']) => {\n const {\n message,\n direction,\n variant,\n avatarInfo,\n timeStamp,\n attachments = [],\n pagePushLinks = [],\n status,\n typing,\n messageHeader,\n ...restProps\n } = props;\n\n const t = useI18n();\n\n let messageMetaJustify: FlexContainerProps['justify'] = 'between';\n if (timeStamp && !status) {\n messageMetaJustify = 'start';\n } else if (!timeStamp && status) {\n messageMetaJustify = 'end';\n }\n\n return (\n <Flex\n as={StyledMessageContainer}\n ref={ref}\n container={{\n gap: 0.5,\n direction: direction === 'in' ? 'row' : 'row-reverse'\n }}\n item={{\n shrink: 0\n }}\n hasMessage={!!message}\n messageDirection={direction}\n variant={variant}\n typing={typing}\n messageHeader={messageHeader}\n {...restProps}\n >\n {avatarInfo && (\n <Avatar name={avatarInfo.name} size='m' shape='circle' imageSrc={avatarInfo.imageSrc} />\n )}\n <Flex\n container={{\n direction: 'column',\n alignItems: direction === 'in' ? 'start' : 'end',\n justify: 'center'\n }}\n as={StyledMessageMain}\n >\n <StyledMessageBubble>\n {messageHeader && (\n <Flex container={{ gap: 0.5, justify: 'between' }} as={StyledMessageHeader}>\n <StyledMessageHeaderContent>{messageHeader.content}</StyledMessageHeaderContent>\n <StyledMessageHeaderMeta>{messageHeader.meta}</StyledMessageHeaderMeta>\n </Flex>\n )}\n {message && (\n <StyledMessageBubbleContent>\n <EmojiDisplay content={message} size={20} />\n </StyledMessageBubbleContent>\n )}\n {(attachments.length > 0 || pagePushLinks.length > 0) && (\n <StyledMediaList>\n {attachments.map(attachment => {\n const { id, icon, name, meta, onDownload, onPreview, thumbnail } = attachment;\n return (\n <Flex\n key={id}\n as={StyledMediaListItem}\n container={{\n direction: 'column'\n }}\n >\n {thumbnail && (\n <Image\n as={StyledMediaThumbNail}\n src={thumbnail}\n onClick={(e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n onPreview?.(id);\n }}\n alt={name}\n />\n )}\n <SummaryItem\n as={StyledSummaryItem}\n primary={\n <StyledMediaButton\n onClick={(e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n onPreview?.(id);\n }}\n >\n {name}\n </StyledMediaButton>\n }\n secondary={meta}\n visual={<Icon name={icon || 'document-doc'} />}\n actions={\n <BareButton\n aria-label={t('download')}\n as={StyledMediaDownloadButton}\n onClick={(e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n onDownload?.(id);\n }}\n >\n <Icon name='download' />\n </BareButton>\n }\n />\n </Flex>\n );\n })}\n {pagePushLinks.map(pagePushLink => {\n const { id, href, title, thumbnail } = pagePushLink;\n return (\n <Flex\n as={StyledMediaListItem}\n key={id}\n container={{\n direction: 'column'\n }}\n >\n {thumbnail && (\n <Image as={StyledMediaThumbNail} src={thumbnail} alt={title || href} />\n )}\n <SummaryItem\n as={StyledSummaryItem}\n primary={\n <StyledMediaLink\n aria-label={title}\n href={href}\n target='_blank'\n rel='noreferrer'\n >\n {href}\n </StyledMediaLink>\n }\n visual={<Icon name='chain-up' />}\n />\n </Flex>\n );\n })}\n </StyledMediaList>\n )}\n </StyledMessageBubble>\n {!typing && (\n <Flex\n as={StyledMetaInfoContainer}\n container={{\n justify: messageMetaJustify,\n gap: 1.5\n }}\n >\n {timeStamp && <StyledMetaInfo>{timeStamp}</StyledMetaInfo>}\n {status && <StyledMetaInfo>{status}</StyledMetaInfo>}\n </Flex>\n )}\n {typing && (\n <Flex\n container={{\n gap: 0.25\n }}\n >\n <StyledBlinkingDot delay={0} />\n <StyledBlinkingDot delay={0.25} />\n <StyledBlinkingDot delay={0.5} />\n </Flex>\n )}\n </Flex>\n </Flex>\n );\n }\n);\n\nexport default Message;\n"]}
|
|
@@ -19,6 +19,7 @@ interface StyledMessageContainerProps {
|
|
|
19
19
|
variant: 'sender' | 'receiver' | 'other';
|
|
20
20
|
messageDirection: 'in' | 'out' | string;
|
|
21
21
|
typing: boolean;
|
|
22
|
+
hasMessage: boolean;
|
|
22
23
|
}
|
|
23
24
|
export declare const StyledMessageContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, StyledMessageContainerProps, never>;
|
|
24
25
|
interface StyledBlinkingDotProps {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Message.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Chat/Message.styles.ts"],"names":[],"mappings":";AAMA,eAAO,MAAM,0BAA0B,yGAAe,CAAC;AAEvD,eAAO,MAAM,eAAe,wGAAc,CAAC;AAE3C,eAAO,MAAM,mBAAm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,yGAAe,CAAC;AAEpD,eAAO,MAAM,cAAc,0GAAgB,CAAC;AAE5C,eAAO,MAAM,qBAAqB,yGAAe,CAAC;AAElD,eAAO,MAAM,mBAAmB,4GAAkB,CAAC;AACnD,eAAO,MAAM,0BAA0B,yGAAe,CAAC;AACvD,eAAO,MAAM,uBAAuB,yGAAe,CAAC;AAEpD,UAAU,2BAA2B;IACnC,OAAO,EAAE,QAAQ,GAAG,UAAU,GAAG,OAAO,CAAC;IACzC,gBAAgB,EAAE,IAAI,GAAG,KAAK,GAAG,MAAM,CAAC;IACxC,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,eAAO,MAAM,sBAAsB,kIAmLlC,CAAC;AAEF,UAAU,sBAAsB;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,iBAAiB,6HAiB5B,CAAC"}
|
|
@@ -18,7 +18,7 @@ export const StyledTypingIndicator = styled.div ``;
|
|
|
18
18
|
export const StyledMessageHeader = styled.header ``;
|
|
19
19
|
export const StyledMessageHeaderContent = styled.div ``;
|
|
20
20
|
export const StyledMessageHeaderMeta = styled.div ``;
|
|
21
|
-
export const StyledMessageContainer = styled.div(({ messageDirection, variant, typing, theme, theme: { base: { palette: { 'foreground-color': foregroundColor, 'secondary-background': secondaryBackground }, transparency: { 'transparent-2': foregroundAlpha } }, components: { button } } }) => {
|
|
21
|
+
export const StyledMessageContainer = styled.div(({ messageDirection, variant, hasMessage, typing, theme, theme: { base: { palette: { 'foreground-color': foregroundColor, 'secondary-background': secondaryBackground }, transparency: { 'transparent-2': foregroundAlpha } }, components: { button } } }) => {
|
|
22
22
|
const messageHeaderTheme = theme.components.chat.messageBubble[variant].header;
|
|
23
23
|
const messageContentTheme = theme.components.chat.messageBubble[variant].content;
|
|
24
24
|
const padding = messageDirection === 'in' ? '0 2rem 0 0' : '0 0 0 2rem';
|
|
@@ -112,6 +112,15 @@ export const StyledMessageContainer = styled.div(({ messageDirection, variant, t
|
|
|
112
112
|
font-size: 1.6rem;
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
+
|
|
116
|
+
${!hasMessage &&
|
|
117
|
+
css `
|
|
118
|
+
> ${StyledMediaListItem}:first-child {
|
|
119
|
+
> ${StyledSummaryItem}::before {
|
|
120
|
+
border-top: none;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
`}
|
|
115
124
|
}
|
|
116
125
|
|
|
117
126
|
${StyledMessageHeader} {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Message.styles.js","sourceRoot":"","sources":["../../../src/components/Chat/Message.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,UAAU,MAAM,0DAA0D,CAAC;AAElF,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC,GAAG,CAAA,EAAE,CAAC;AAEvD,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,EAAE,CAAA,EAAE,CAAC;AAE3C,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,EAAE,CAAA,EAAE,CAAC;AAE/C,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAA,EAAE,CAAC;AAE9C,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC,GAAG,CAAA,EAAE,CAAC;AAEjD,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC,MAAM,CAAA,EAAE,CAAC;AAEzD,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,CAAC,CAAA,EAAE,CAAC;AAE1C,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,UAAU,CAAC,CAAA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mBAAmB;;mBAEV,kBAAkB,CAAC,kBAAkB,CAAC;8BAC3B,kBAAkB,CAAC,kBAAkB,CAAC;;;UAG1D,0BAA0B;mBACjB,kBAAkB,CAAC,kBAAkB,CAAC;+BAC1B,KAAK,CAAC,IAAI,CAAC,OAAO;;UAEvC,uBAAuB;;qBAEZ,kBAAkB,CAAC,kBAAkB,CAAC;;;;UAIjD,eAAe,KAAK,iBAAiB;mBAC5B,mBAAmB,CAAC,kBAAkB,CAAC;;;;;;;;;;;qBAWrC,mBAAmB,CAAC,kBAAkB,CAAC;;;;qBAIvC,mBAAmB,CAAC,kBAAkB,CAAC;;;0BAGlC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK;;;;;QAKzC,uBAAuB;;;UAGrB,cAAc;;;mBAGL,mBAAmB;;;QAG9B,qBAAqB;;;;;KAKxB,CAAC;AACJ,CAAC,CACF,CAAC;AACF,sBAAsB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAKvD,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAyB,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IAC3F,OAAO,GAAG,CAAA;;;sBAGU,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM;;;sBAG7B,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC;;;mCAGxB,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK;kBAC3C,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC;;uBAEhC,KAAK;;;GAGzB,CAAC;AACJ,CAAC,CAAC,CAAC;AACH,iBAAiB,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\nimport { rgba } from 'polished';\n\nimport { defaultThemeProp, tryCatch } from '@pega/cosmos-react-core';\nimport BareButton from '@pega/cosmos-react-core/lib/components/Button/BareButton';\n\nexport const StyledMessageBubbleContent = styled.div``;\n\nexport const StyledMediaList = styled.ul``;\n\nexport const StyledMediaListItem = styled.li``;\n\nexport const StyledSummaryItem = styled.div``;\n\nexport const StyledMediaThumbNail = styled.img``;\n\nexport const StyledMediaDownloadButton = styled.button``;\n\nexport const StyledMediaLink = styled.a``;\n\nexport const StyledMediaButton = styled(BareButton)``;\n\nexport const StyledMessageMain = styled.div``;\n\nexport const StyledMessageBubble = styled.div``;\n\nexport const StyledMetaInfoContainer = styled.div``;\n\nexport const StyledMetaInfo = styled.span``;\n\nexport const StyledTypingIndicator = styled.div``;\n\nexport const StyledMessageHeader = styled.header``;\nexport const StyledMessageHeaderContent = styled.div``;\nexport const StyledMessageHeaderMeta = styled.div``;\n\ninterface StyledMessageContainerProps {\n variant: 'sender' | 'receiver' | 'other';\n messageDirection: 'in' | 'out' | string;\n typing: boolean;\n}\n\nexport const StyledMessageContainer = styled.div<StyledMessageContainerProps>(\n ({\n messageDirection,\n variant,\n typing,\n theme,\n theme: {\n base: {\n palette: {\n 'foreground-color': foregroundColor,\n 'secondary-background': secondaryBackground\n },\n transparency: { 'transparent-2': foregroundAlpha }\n },\n components: { button }\n }\n }) => {\n const messageHeaderTheme = theme.components.chat.messageBubble[variant].header;\n const messageContentTheme = theme.components.chat.messageBubble[variant].content;\n const padding = messageDirection === 'in' ? '0 2rem 0 0' : '0 0 0 2rem';\n const metaForegroundColor = tryCatch(() => rgba(foregroundColor, foregroundAlpha));\n\n return css`\n padding: ${padding};\n margin-bottom: ${typing ? '0.5rem' : '0'};\n ${StyledMessageMain} {\n max-width: 90%;\n }\n ${StyledMessageBubble} {\n max-width: 100%;\n min-width: 100%;\n background: ${messageContentTheme['background-color']};\n border-radius: calc(3 * ${theme.base['border-radius']}) ${theme.base['border-radius']}\n calc(3 * ${theme.base['border-radius']}) calc(3 * ${theme.base['border-radius']});\n overflow: hidden;\n color: ${messageContentTheme['foreground-color']};\n display: inline-block;\n width: auto;\n margin-bottom: 0.25rem;\n\n label {\n color: inherit;\n }\n\n ${messageDirection === 'in' &&\n css`\n border-radius: ${theme.base['border-radius']} calc(3 * ${theme.base['border-radius']})\n calc(3 * ${theme.base['border-radius']}) calc(3 * ${theme.base['border-radius']});\n `}\n\n > ${StyledMessageBubbleContent} {\n padding: 0.5rem 1rem;\n word-break: break-word;\n white-space: pre-wrap;\n position: relative;\n }\n\n > ${StyledMediaList} {\n color: ${messageContentTheme['foreground-color']};\n max-width: 100%;\n\n ${StyledMediaDownloadButton} {\n display: inline-flex;\n justify-content: center;\n align-items: center;\n color: ${messageContentTheme['foreground-color']};\n width: ${button.height};\n height: ${button.height};\n border: 0.0625rem solid transparent;\n &:enabled:hover,\n &:enabled:focus {\n background: ${messageContentTheme['background-color']};\n color: ${messageContentTheme['foreground-color']};\n border: 0.0625rem solid ${messageContentTheme['foreground-color']};\n border-radius: 50%;\n }\n svg {\n width: 50%;\n height: 50%;\n }\n }\n\n > ${StyledMediaListItem} {\n position: relative;\n ${StyledMediaThumbNail} {\n max-height: 12rem;\n width: 100%;\n object-fit: contain;\n background-color: ${secondaryBackground};\n }\n ${StyledSummaryItem} {\n padding: 0.5rem 1.5rem;\n font-size: 0.75rem;\n margin-top: 0.25rem;\n }\n ${StyledSummaryItem}::before {\n content: '';\n padding: 0.5rem 0;\n border-top: 0.0625rem solid ${messageContentTheme['foreground-color']};\n position: absolute;\n width: calc(100% - 2rem);\n left: 1rem;\n top: 0;\n }\n ${StyledMediaThumbNail} + ${StyledSummaryItem}::before {\n content: none;\n }\n svg {\n font-size: 1.6rem;\n }\n }\n }\n\n ${StyledMessageHeader} {\n padding: 0.5rem 1rem;\n color: ${messageHeaderTheme['foreground-color']};\n background-color: ${messageHeaderTheme['background-color']};\n }\n\n ${StyledMessageHeaderContent} {\n color: ${messageHeaderTheme['foreground-color']};\n margin-inline-end: ${theme.base.spacing};\n }\n ${StyledMessageHeaderMeta} {\n > a {\n color: ${messageHeaderTheme['foreground-color']};\n }\n }\n\n ${StyledMediaLink}, ${StyledMediaButton} {\n color: ${messageContentTheme['foreground-color']};\n font-size: inherit;\n text-decoration: none;\n font-weight: 700;\n overflow-x: hidden;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n display: inline-block;\n max-width: 100%;\n &:hover {\n color: ${messageContentTheme['foreground-color']};\n text-decoration: underline;\n }\n &:visited {\n color: ${messageContentTheme['foreground-color']};\n }\n &:focus {\n box-shadow: ${theme.base.shadow.focus};\n }\n }\n }\n\n ${StyledMetaInfoContainer} {\n width: 100%;\n padding: 0 0.5rem;\n ${StyledMetaInfo} {\n margin-bottom: 0.5rem;\n font-size: 0.7rem;\n color: ${metaForegroundColor};\n }\n }\n ${StyledTypingIndicator} {\n width: 4.5rem;\n position: relative;\n height: 2rem;\n }\n `;\n }\n);\nStyledMessageContainer.defaultProps = defaultThemeProp;\ninterface StyledBlinkingDotProps {\n delay?: number;\n}\n\nexport const StyledBlinkingDot = styled.div<StyledBlinkingDotProps>(({ delay = 0, theme }) => {\n return css`\n @keyframes Blinking {\n 0% {\n background: ${theme.base.colors.gray.medium};\n }\n 100% {\n background: ${theme.base.colors.gray['extra-light']};\n }\n }\n animation: Blinking calc(4 * ${theme.base.animation.speed}) infinite;\n background: ${theme.base.colors.gray['extra-light']};\n border-radius: 50%;\n animation-delay: ${delay}s;\n height: 0.4rem;\n width: 0.4rem;\n `;\n});\nStyledBlinkingDot.defaultProps = defaultThemeProp;\n"]}
|
|
1
|
+
{"version":3,"file":"Message.styles.js","sourceRoot":"","sources":["../../../src/components/Chat/Message.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,UAAU,MAAM,0DAA0D,CAAC;AAElF,MAAM,CAAC,MAAM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,YAAY,GAAG,gBAAgB,CAAC;AAKvD,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAyB,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IAC3F,OAAO,GAAG,CAAA;;;sBAGU,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM;;;sBAG7B,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC;;;mCAGxB,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK;kBAC3C,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC;;uBAEhC,KAAK;;;GAGzB,CAAC;AACJ,CAAC,CAAC,CAAC;AACH,iBAAiB,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\nimport { rgba } from 'polished';\n\nimport { defaultThemeProp, tryCatch } from '@pega/cosmos-react-core';\nimport BareButton from '@pega/cosmos-react-core/lib/components/Button/BareButton';\n\nexport const StyledMessageBubbleContent = styled.div``;\n\nexport const StyledMediaList = styled.ul``;\n\nexport const StyledMediaListItem = styled.li``;\n\nexport const StyledSummaryItem = styled.div``;\n\nexport const StyledMediaThumbNail = styled.img``;\n\nexport const StyledMediaDownloadButton = styled.button``;\n\nexport const StyledMediaLink = styled.a``;\n\nexport const StyledMediaButton = styled(BareButton)``;\n\nexport const StyledMessageMain = styled.div``;\n\nexport const StyledMessageBubble = styled.div``;\n\nexport const StyledMetaInfoContainer = styled.div``;\n\nexport const StyledMetaInfo = styled.span``;\n\nexport const StyledTypingIndicator = styled.div``;\n\nexport const StyledMessageHeader = styled.header``;\nexport const StyledMessageHeaderContent = styled.div``;\nexport const StyledMessageHeaderMeta = styled.div``;\n\ninterface StyledMessageContainerProps {\n variant: 'sender' | 'receiver' | 'other';\n messageDirection: 'in' | 'out' | string;\n typing: boolean;\n hasMessage: boolean;\n}\n\nexport const StyledMessageContainer = styled.div<StyledMessageContainerProps>(\n ({\n messageDirection,\n variant,\n hasMessage,\n typing,\n theme,\n theme: {\n base: {\n palette: {\n 'foreground-color': foregroundColor,\n 'secondary-background': secondaryBackground\n },\n transparency: { 'transparent-2': foregroundAlpha }\n },\n components: { button }\n }\n }) => {\n const messageHeaderTheme = theme.components.chat.messageBubble[variant].header;\n const messageContentTheme = theme.components.chat.messageBubble[variant].content;\n const padding = messageDirection === 'in' ? '0 2rem 0 0' : '0 0 0 2rem';\n const metaForegroundColor = tryCatch(() => rgba(foregroundColor, foregroundAlpha));\n\n return css`\n padding: ${padding};\n margin-bottom: ${typing ? '0.5rem' : '0'};\n ${StyledMessageMain} {\n max-width: 90%;\n }\n ${StyledMessageBubble} {\n max-width: 100%;\n min-width: 100%;\n background: ${messageContentTheme['background-color']};\n border-radius: calc(3 * ${theme.base['border-radius']}) ${theme.base['border-radius']}\n calc(3 * ${theme.base['border-radius']}) calc(3 * ${theme.base['border-radius']});\n overflow: hidden;\n color: ${messageContentTheme['foreground-color']};\n display: inline-block;\n width: auto;\n margin-bottom: 0.25rem;\n\n label {\n color: inherit;\n }\n\n ${messageDirection === 'in' &&\n css`\n border-radius: ${theme.base['border-radius']} calc(3 * ${theme.base['border-radius']})\n calc(3 * ${theme.base['border-radius']}) calc(3 * ${theme.base['border-radius']});\n `}\n\n > ${StyledMessageBubbleContent} {\n padding: 0.5rem 1rem;\n word-break: break-word;\n white-space: pre-wrap;\n position: relative;\n }\n\n > ${StyledMediaList} {\n color: ${messageContentTheme['foreground-color']};\n max-width: 100%;\n\n ${StyledMediaDownloadButton} {\n display: inline-flex;\n justify-content: center;\n align-items: center;\n color: ${messageContentTheme['foreground-color']};\n width: ${button.height};\n height: ${button.height};\n border: 0.0625rem solid transparent;\n &:enabled:hover,\n &:enabled:focus {\n background: ${messageContentTheme['background-color']};\n color: ${messageContentTheme['foreground-color']};\n border: 0.0625rem solid ${messageContentTheme['foreground-color']};\n border-radius: 50%;\n }\n svg {\n width: 50%;\n height: 50%;\n }\n }\n\n > ${StyledMediaListItem} {\n position: relative;\n ${StyledMediaThumbNail} {\n max-height: 12rem;\n width: 100%;\n object-fit: contain;\n background-color: ${secondaryBackground};\n }\n ${StyledSummaryItem} {\n padding: 0.5rem 1.5rem;\n font-size: 0.75rem;\n margin-top: 0.25rem;\n }\n ${StyledSummaryItem}::before {\n content: '';\n padding: 0.5rem 0;\n border-top: 0.0625rem solid ${messageContentTheme['foreground-color']};\n position: absolute;\n width: calc(100% - 2rem);\n left: 1rem;\n top: 0;\n }\n ${StyledMediaThumbNail} + ${StyledSummaryItem}::before {\n content: none;\n }\n svg {\n font-size: 1.6rem;\n }\n }\n\n ${!hasMessage &&\n css`\n > ${StyledMediaListItem}:first-child {\n > ${StyledSummaryItem}::before {\n border-top: none;\n }\n }\n `}\n }\n\n ${StyledMessageHeader} {\n padding: 0.5rem 1rem;\n color: ${messageHeaderTheme['foreground-color']};\n background-color: ${messageHeaderTheme['background-color']};\n }\n\n ${StyledMessageHeaderContent} {\n color: ${messageHeaderTheme['foreground-color']};\n margin-inline-end: ${theme.base.spacing};\n }\n ${StyledMessageHeaderMeta} {\n > a {\n color: ${messageHeaderTheme['foreground-color']};\n }\n }\n\n ${StyledMediaLink}, ${StyledMediaButton} {\n color: ${messageContentTheme['foreground-color']};\n font-size: inherit;\n text-decoration: none;\n font-weight: 700;\n overflow-x: hidden;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n display: inline-block;\n max-width: 100%;\n &:hover {\n color: ${messageContentTheme['foreground-color']};\n text-decoration: underline;\n }\n &:visited {\n color: ${messageContentTheme['foreground-color']};\n }\n &:focus {\n box-shadow: ${theme.base.shadow.focus};\n }\n }\n }\n\n ${StyledMetaInfoContainer} {\n width: 100%;\n padding: 0 0.5rem;\n ${StyledMetaInfo} {\n margin-bottom: 0.5rem;\n font-size: 0.7rem;\n color: ${metaForegroundColor};\n }\n }\n ${StyledTypingIndicator} {\n width: 4.5rem;\n position: relative;\n height: 2rem;\n }\n `;\n }\n);\nStyledMessageContainer.defaultProps = defaultThemeProp;\ninterface StyledBlinkingDotProps {\n delay?: number;\n}\n\nexport const StyledBlinkingDot = styled.div<StyledBlinkingDotProps>(({ delay = 0, theme }) => {\n return css`\n @keyframes Blinking {\n 0% {\n background: ${theme.base.colors.gray.medium};\n }\n 100% {\n background: ${theme.base.colors.gray['extra-light']};\n }\n }\n animation: Blinking calc(4 * ${theme.base.animation.speed}) infinite;\n background: ${theme.base.colors.gray['extra-light']};\n border-radius: 50%;\n animation-delay: ${delay}s;\n height: 0.4rem;\n width: 0.4rem;\n `;\n});\nStyledBlinkingDot.defaultProps = defaultThemeProp;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Email.d.ts","sourceRoot":"","sources":["../../../src/components/Email/Email.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EASlB,MAAM,OAAO,CAAC;AAEf,OAAO,EACL,YAAY,
|
|
1
|
+
{"version":3,"file":"Email.d.ts","sourceRoot":"","sources":["../../../src/components/Email/Email.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EASlB,MAAM,OAAO,CAAC;AAEf,OAAO,EACL,YAAY,EAwBb,MAAM,yBAAyB,CAAC;AAKjC,OAAO,EAAa,UAAU,EAAiC,MAAM,eAAe,CAAC;AA+CrF,QAAA,MAAM,KAAK,EAAE,iBAAiB,CAAC,UAAU,GAAG,YAAY,CAodvD,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createElement as _createElement } from "react";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { forwardRef, Fragment, useRef, useState, useMemo, useEffect, useImperativeHandle } from 'react';
|
|
4
|
-
import { Text, SummaryItem, Avatar, Flex, EmailDisplay, Button, Icon, Sentiment, useOuterEvent, Popover, useElement, CardContent, useI18n, FileDisplay, useBreakpoint, DateTimeDisplay, useConfiguration, MetaList, createStringMatcher, useScrollToggle } from '@pega/cosmos-react-core';
|
|
4
|
+
import { Text, SummaryItem, Avatar, Flex, EmailDisplay, Button, Icon, Sentiment, useOuterEvent, Popover, useElement, CardContent, useI18n, FileDisplay, useBreakpoint, DateTimeDisplay, useConfiguration, MetaList, createStringMatcher, useScrollToggle, Status } from '@pega/cosmos-react-core';
|
|
5
5
|
import { RichTextViewer } from '@pega/cosmos-react-rte';
|
|
6
6
|
import EmailEntity from './EmailEntity';
|
|
7
7
|
import ContextMenuPopover from './ContextMenuPopover';
|
|
@@ -12,7 +12,7 @@ const EmailDisplayList = ({ emailUsers, showEmailAddress, showShortName }) => {
|
|
|
12
12
|
const OVERFLOW_TO_EMAIL_COUNT = 2;
|
|
13
13
|
const OVERFLOW_EMAIL_SUGGESTION_COUNT = 2;
|
|
14
14
|
const Email = forwardRef((props, ref) => {
|
|
15
|
-
const { id, from, to = [], cc = [], bcc = [], actions = [], timeStamp, sentiment, subject, forwardedContent, attachments = [], suggestions = [], entityHighlightMapping = [], onReply, onForward, onReplyAll, onSuggestionClick, contextMenu, ...restProps } = props;
|
|
15
|
+
const { id, from, to = [], cc = [], bcc = [], actions = [], timeStamp, sentiment, subject, forwardedContent, attachments = [], suggestions = [], entityHighlightMapping = [], onReply, onForward, onReplyAll, onSuggestionClick, contextMenu, status, ...restProps } = props;
|
|
16
16
|
let { body } = props;
|
|
17
17
|
const t = useI18n();
|
|
18
18
|
const [emailMoreInfoBtnRef, setEmailMoreInfoBtnRef] = useElement(null);
|
|
@@ -30,7 +30,10 @@ const Email = forwardRef((props, ref) => {
|
|
|
30
30
|
}
|
|
31
31
|
}));
|
|
32
32
|
const headerRef = useRef(null);
|
|
33
|
-
const isSmallOrAbove = useBreakpoint('sm', {
|
|
33
|
+
const isSmallOrAbove = useBreakpoint('sm', {
|
|
34
|
+
breakpointRef: headerRef,
|
|
35
|
+
themeProp: 'content-width'
|
|
36
|
+
});
|
|
34
37
|
const { locale } = useConfiguration();
|
|
35
38
|
const [currentTarget, setCurrentTarget] = useState({
|
|
36
39
|
targetNode: null,
|
|
@@ -188,9 +191,11 @@ const Email = forwardRef((props, ref) => {
|
|
|
188
191
|
alignItems: 'start'
|
|
189
192
|
}, children: [_jsx(MetaList, { items: isSmallOrAbove ? emailMetaListItems : [emailMetaListItems[0]] }), _jsx(Button, { icon: true, variant: 'simple', as: StyledEmailMoreInfoButton, ref: setEmailMoreInfoBtnRef, onClick: () => {
|
|
190
193
|
setShowEmailMoreInfo(true);
|
|
191
|
-
}, label: t('show_more'), children: _jsx(Icon, { name: 'arrow-micro-down' }) }), _jsx(Popover, { as: StyledEmailMoreInfoPopover, show: showEmailMoreInfo, ref: setEmailMoreInfoPopover, target: emailMoreInfoBtnRef, placement: 'bottom', children: _jsx(CardContent, { children: _jsx(StyledEmailPrimaryFieldValueList, { fields: emailMoreInfoFields }) }) })] }), !isSmallOrAbove && timeStamp && emailMetaListItems[1]] }), actions:
|
|
192
|
-
gap: 1
|
|
193
|
-
|
|
194
|
+
}, label: t('show_more'), children: _jsx(Icon, { name: 'arrow-micro-down' }) }), _jsx(Popover, { as: StyledEmailMoreInfoPopover, show: showEmailMoreInfo, ref: setEmailMoreInfoPopover, target: emailMoreInfoBtnRef, placement: 'bottom', children: _jsx(CardContent, { children: _jsx(StyledEmailPrimaryFieldValueList, { fields: emailMoreInfoFields }) }) })] }), !isSmallOrAbove && timeStamp && emailMetaListItems[1], status && !isSmallOrAbove && (_jsx(Flex, { container: { pad: [0.5, 0, 0] }, children: _jsx(Status, { variant: status === 'draft' ? 'pending' : 'urgent', children: status === 'draft' ? t('draft', [], { count: 1 }) : t(status) }) }))] }), actions: _jsxs(Flex, { container: {
|
|
195
|
+
gap: 1,
|
|
196
|
+
pad: 1,
|
|
197
|
+
alignItems: 'center'
|
|
198
|
+
}, children: [status && isSmallOrAbove && (_jsx(Status, { variant: status === 'draft' ? 'pending' : 'urgent', children: status === 'draft' ? t('draft', [], { count: 1 }) : t(status) })), actions] }) }), _jsxs(Flex, { container: {
|
|
194
199
|
direction: 'column',
|
|
195
200
|
gap: 2,
|
|
196
201
|
pad: [0, 2]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Email.js","sourceRoot":"","sources":["../../../src/components/Email/Email.tsx"],"names":[],"mappings":";;AAAA,OAAO,EACL,UAAU,EACV,QAAQ,EAIR,MAAM,EACN,QAAQ,EACR,OAAO,EACP,SAAS,EAET,mBAAmB,EACpB,MAAM,OAAO,CAAC;AAEf,OAAO,EAEL,IAAI,EACJ,WAAW,EACX,MAAM,EACN,IAAI,EACJ,YAAY,EACZ,MAAM,EACN,IAAI,EAEJ,SAAS,EACT,aAAa,EACb,OAAO,EACP,UAAU,EACV,WAAW,EACX,OAAO,EACP,WAAW,EACX,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,QAAQ,EAER,mBAAmB,EACnB,eAAe,EAChB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,EACtB,yBAAyB,EACzB,0BAA0B,EAC1B,gCAAgC,EAChC,eAAe,EACf,kCAAkC,EAClC,4BAA4B,EAC5B,gCAAgC,EAChC,4BAA4B,EAC7B,MAAM,gBAAgB,CAAC;AAExB,MAAM,gBAAgB,GAAG,CAAC,EACxB,UAAU,EACV,gBAAgB,EAChB,aAAa,EAKd,EAAE,EAAE;IACH,OAAO,CACL,4BACG,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAC5D,MAAC,QAAQ,eACN,CAAC,KAAK,CAAC,CAAC,C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ACN,UAAU,EAAE,QAAQ;qCACrB,aAED,KAAC,IAAI,IAAC,IAAI,EAAC,OAAO,GAAG,EACrB,yBAAO,CAAC,CAAC,OAAO,CAAC,GAAQ,IACpB,GACA,EACR,UAAU,IAAI,CACb,KAAC,MAAM,IACL,OAAO,EAAC,QAAQ,EAChB,OAAO,EAAE,GAAG,EAAE;oCACZ,UAAU,CAAC,EAAE,CAAC,CAAC;gCACjB,CAAC,YAED,MAAC,IAAI,IACH,SAAS,EAAE;wCACT,GAAG,EAAE,CAAC;wCACN,UAAU,EAAE,QAAQ;qCACrB,aAED,KAAC,IAAI,IAAC,IAAI,EAAC,WAAW,GAAG,EACzB,yBAAO,CAAC,CAAC,WAAW,CAAC,GAAQ,IACxB,GACA,CACV,EACA,SAAS,IAAI,CACZ,KAAC,MAAM,IACL,OAAO,EAAC,QAAQ,EAChB,OAAO,EAAE,GAAG,EAAE;oCACZ,SAAS,CAAC,EAAE,CAAC,CAAC;gCAChB,CAAC,YAED,MAAC,IAAI,IACH,SAAS,EAAE;wCACT,GAAG,EAAE,CAAC;wCACN,UAAU,EAAE,QAAQ;qCACrB,aAED,KAAC,IAAI,IAAC,IAAI,EAAC,SAAS,GAAG,EACvB,yBAAO,CAAC,CAAC,SAAS,CAAC,GAAQ,IACtB,GACA,CACV,IACG,IACD,IACF,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,KAAK,CAAC","sourcesContent":["import {\n forwardRef,\n Fragment,\n FunctionComponent,\n PropsWithoutRef,\n ReactNode,\n useRef,\n useState,\n useMemo,\n useEffect,\n MouseEvent,\n useImperativeHandle\n} from 'react';\n\nimport {\n ForwardProps,\n Text,\n SummaryItem,\n Avatar,\n Flex,\n EmailDisplay,\n Button,\n Icon,\n FieldValueListProps,\n Sentiment,\n useOuterEvent,\n Popover,\n useElement,\n CardContent,\n useI18n,\n FileDisplay,\n useBreakpoint,\n DateTimeDisplay,\n useConfiguration,\n MetaList,\n MetaListProps,\n createStringMatcher,\n useScrollToggle\n} from '@pega/cosmos-react-core';\nimport { RichTextViewer } from '@pega/cosmos-react-rte';\n\nimport EmailEntity from './EmailEntity';\nimport ContextMenuPopover from './ContextMenuPopover';\nimport { EmailUser, EmailProps, TargetProps, ContextMenuProps } from './Email.types';\nimport {\n StyledEmail,\n StyledEmailDisplay,\n StyledEmailHeader,\n StyledFromEmailDisplay,\n StyledEmailMoreInfoButton,\n StyledEmailMoreInfoPopover,\n StyledEmailPrimaryFieldValueList,\n StyledEmailBody,\n StyledEmailSecondaryFieldValueList,\n StyledSuggestedRepliesButton,\n StyledSuggestedRepliesMenuButton,\n StyledForwardedContentToggle\n} from './Email.styles';\n\nconst EmailDisplayList = ({\n emailUsers,\n showEmailAddress,\n showShortName\n}: {\n emailUsers: EmailUser[];\n showEmailAddress?: boolean;\n showShortName?: boolean;\n}) => {\n return (\n <>\n {emailUsers.map(({ emailAddress, fullName, shortName }, i) => (\n <Fragment key={emailAddress}>\n {i === 0 ? '' : '; '}\n <EmailDisplay\n value={emailAddress}\n displayText={`${showShortName ? shortName : fullName}${\n showEmailAddress ? ` <${emailAddress}>` : ''\n }`}\n variant='text'\n as={StyledEmailDisplay}\n />\n </Fragment>\n ))}\n </>\n );\n};\n\nconst OVERFLOW_TO_EMAIL_COUNT = 2;\nconst OVERFLOW_EMAIL_SUGGESTION_COUNT = 2;\n\nconst Email: FunctionComponent<EmailProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<EmailProps>, ref: EmailProps['ref']) => {\n const {\n id,\n from,\n to = [],\n cc = [],\n bcc = [],\n actions = [],\n timeStamp,\n sentiment,\n subject,\n forwardedContent,\n attachments = [],\n suggestions = [],\n entityHighlightMapping = [],\n onReply,\n onForward,\n onReplyAll,\n onSuggestionClick,\n contextMenu,\n ...restProps\n } = props;\n let { body } = props;\n const t = useI18n();\n\n const [emailMoreInfoBtnRef, setEmailMoreInfoBtnRef] = useElement<HTMLButtonElement>(null);\n const [showEmailMoreInfo, setShowEmailMoreInfo] = useState(false);\n const [showForwardedContent, setShowForwardedContent] = useState(false);\n const [emailMoreInfoPopover, setEmailMoreInfoPopover] = useElement<HTMLDivElement>(null);\n const emailMoreInfoFields: FieldValueListProps['fields'] = [];\n // Only way to set this is through imperative handle\n const [contextMenuItems, setContextMenuItems] = useState<ContextMenuProps['items']>([]);\n const [contextMenuLoading, setContextMenuLoading] = useState<boolean>(false);\n\n useImperativeHandle(contextMenu?.handle, () => ({\n setContextMenuItems: (ctxMenuItems: ContextMenuProps['items']) => {\n setContextMenuItems(ctxMenuItems || []);\n setContextMenuLoading(false);\n }\n }));\n\n const headerRef = useRef<HTMLDivElement>(null);\n const isSmallOrAbove = useBreakpoint('sm', { breakpointRef: headerRef });\n const { locale } = useConfiguration();\n const [currentTarget, setCurrentTarget] = useState<TargetProps>({\n targetNode: null,\n cursorPosition: {\n x: 0,\n y: 0\n }\n });\n const [popoverOpen, setPopoverOpen] = useState(false);\n const { disableScroll, enableScroll } = useScrollToggle();\n const [popoverEl, setPopoverEl] = useElement<HTMLElement>();\n\n useOuterEvent('mousedown', [popoverEl], () => {\n if (popoverOpen) setPopoverOpen(false);\n });\n\n // Handler for right click on email body\n const onContextMenu = (e: MouseEvent<HTMLDivElement>) => {\n e.preventDefault();\n if (e.target instanceof HTMLElement && e.target.textContent?.trim()) {\n setContextMenuItems([]);\n setContextMenuLoading(true);\n setPopoverOpen(true);\n setCurrentTarget({\n targetNode: e.target,\n cursorPosition: {\n x: e.pageX - window.scrollX,\n y: e.pageY - window.scrollY\n }\n });\n contextMenu?.onContextMenu(id, e);\n }\n };\n\n const onItemClick: ContextMenuProps['onItemClick'] = (selectedValue: {\n fieldName: string;\n fieldValue: string;\n }) => {\n setPopoverOpen(false);\n contextMenu?.onItemClick(selectedValue);\n };\n\n if (from) {\n emailMoreInfoFields.push({\n id: 'from',\n name: t('from'),\n value: from.emailAddress\n });\n }\n\n if (to.length > 0) {\n emailMoreInfoFields.push({\n id: 'to',\n name: t('to'),\n value: <EmailDisplayList emailUsers={to} showEmailAddress />\n });\n }\n\n if (cc.length > 0) {\n emailMoreInfoFields.push({\n id: 'cc',\n name: 'CC',\n value: <EmailDisplayList emailUsers={cc} showEmailAddress />\n });\n }\n\n if (bcc.length > 0) {\n emailMoreInfoFields.push({\n id: 'BCC',\n name: 'BCC',\n value: <EmailDisplayList emailUsers={bcc} showEmailAddress />\n });\n }\n\n if (timeStamp) {\n emailMoreInfoFields.push({\n id: 'date',\n name: t('date'),\n value: (\n <Text>\n {`${new Intl.DateTimeFormat(locale, { weekday: 'short' }).format(\n new Date(timeStamp)\n )}, `}\n <DateTimeDisplay variant='datetime' format='short' value={timeStamp} />\n </Text>\n )\n });\n }\n\n useOuterEvent('mousedown', [emailMoreInfoPopover], () => {\n setShowEmailMoreInfo(false);\n });\n\n const secondaryFields: FieldValueListProps['fields'] = [];\n\n if (attachments.length > 0) {\n secondaryFields.push({\n id: 'attachments',\n name: '',\n value: (\n <Flex container={{ gap: 1, wrap: 'wrap' }}>\n {attachments.map(attachmentProps => (\n <FileDisplay {...attachmentProps} key={attachmentProps.value} />\n ))}\n </Flex>\n )\n });\n }\n\n if (suggestions.length > 0) {\n secondaryFields.push({\n id: 'suggested_replies',\n name: '',\n value: (\n <Flex container={{ wrap: 'wrap' }}>\n {suggestions\n .slice(0, OVERFLOW_EMAIL_SUGGESTION_COUNT)\n .map(({ id: suggestionId, title }) => (\n <StyledSuggestedRepliesButton\n variant='secondary'\n key={suggestionId}\n onClick={() => {\n onSuggestionClick?.(id, suggestionId);\n }}\n >\n {title}\n </StyledSuggestedRepliesButton>\n ))}\n {suggestions.length > OVERFLOW_EMAIL_SUGGESTION_COUNT && (\n <StyledSuggestedRepliesMenuButton\n text='Other responses'\n key='other_responses'\n variant='secondary'\n menu={{\n items: suggestions\n .slice(OVERFLOW_EMAIL_SUGGESTION_COUNT)\n .map(({ id: suggestionId, title }) => {\n return {\n primary: title,\n id: suggestionId,\n onClick: () => {\n onSuggestionClick?.(id, suggestionId);\n }\n };\n })\n }}\n />\n )}\n </Flex>\n )\n });\n }\n\n let renderedBody: ReactNode = body;\n\n const entityConfigs = useMemo(() => {\n return entityHighlightMapping.map(entity => {\n const regExp = createStringMatcher(entity.value, 'contains', 'gi');\n\n return {\n type: 'entity',\n regexPattern: regExp,\n component: () => <EmailEntity entity={entity} />\n };\n });\n }, [entityHighlightMapping]);\n\n // Apply entity highlighting only on string body\n if (typeof body === 'string') {\n if (subject) {\n body = `<div>${t('subject')}: ${subject}</div><br>${body}`;\n }\n const { cursorPosition, targetNode } = currentTarget;\n\n renderedBody = (\n <>\n <RichTextViewer\n content={body}\n type='html'\n interactionRenderers={entityConfigs}\n aria-label={t('unique_entities', [entityConfigs.length], {\n count: entityConfigs.length\n })}\n role='group'\n />\n\n {/* Don't render it if context menu is disabled */}\n {contextMenu && (\n <ContextMenuPopover\n cursorPosition={cursorPosition}\n contextMenu={{\n ...contextMenu,\n items: contextMenuItems,\n loading: contextMenuLoading,\n onItemClick\n }}\n targetNode={targetNode as Node}\n show={popoverOpen}\n ref={setPopoverEl}\n />\n )}\n </>\n );\n }\n\n const emailMetaListItems: MetaListProps['items'] = [\n <Text variant='secondary'>\n {`${t('to')}: `}\n <EmailDisplayList emailUsers={to.slice(0, OVERFLOW_TO_EMAIL_COUNT)} showShortName />\n {to.length > OVERFLOW_TO_EMAIL_COUNT &&\n `; +${t('more_count', [to.length - OVERFLOW_TO_EMAIL_COUNT])}`}\n </Text>,\n <Text variant='secondary'>\n {`${new Intl.DateTimeFormat(locale, { weekday: 'short' }).format(new Date(timeStamp))}, `}\n <DateTimeDisplay variant='datetime' format='short' value={timeStamp} />\n </Text>\n ];\n\n useEffect(() => {\n if (popoverOpen) disableScroll();\n else enableScroll();\n }, [popoverOpen]);\n\n return (\n <Flex\n as={StyledEmail}\n container={{\n direction: 'column',\n gap: 1\n }}\n ref={ref}\n {...restProps}\n >\n <SummaryItem\n as={StyledEmailHeader}\n visual={<Avatar {...from.avatarProps} name={from.fullName} />}\n ref={headerRef}\n primary={\n <Flex\n container={{\n gap: 1,\n alignItems: 'center'\n }}\n >\n <StyledFromEmailDisplay\n value={from.emailAddress}\n displayText={from.fullName}\n variant='text'\n />\n {sentiment && <Sentiment {...sentiment} labelHidden />}\n </Flex>\n }\n secondary={\n <Flex\n container={{\n gap: 0,\n alignItems: 'start',\n direction: 'column'\n }}\n >\n <Flex\n container={{\n gap: 0,\n alignItems: 'start'\n }}\n >\n <MetaList items={isSmallOrAbove ? emailMetaListItems : [emailMetaListItems[0]]} />\n\n <Button\n icon\n variant='simple'\n as={StyledEmailMoreInfoButton}\n ref={setEmailMoreInfoBtnRef}\n onClick={() => {\n setShowEmailMoreInfo(true);\n }}\n label={t('show_more')}\n >\n <Icon name='arrow-micro-down' />\n </Button>\n <Popover\n as={StyledEmailMoreInfoPopover}\n show={showEmailMoreInfo}\n ref={setEmailMoreInfoPopover}\n target={emailMoreInfoBtnRef}\n placement='bottom'\n >\n <CardContent>\n <StyledEmailPrimaryFieldValueList fields={emailMoreInfoFields} />\n </CardContent>\n </Popover>\n </Flex>\n {!isSmallOrAbove && timeStamp && emailMetaListItems[1]}\n </Flex>\n }\n actions={\n <Flex\n container={{\n gap: 1\n }}\n >\n {actions}\n </Flex>\n }\n />\n <Flex\n container={{\n direction: 'column',\n gap: 2,\n pad: [0, 2]\n }}\n onContextMenu={contextMenu ? onContextMenu : undefined}\n >\n {/* Attach the handler only when context menu enabled by providing the prop */}\n <StyledEmailBody>{renderedBody}</StyledEmailBody>\n {forwardedContent && forwardedContent.length > 0 && (\n <>\n <StyledForwardedContentToggle\n variant='simple'\n icon\n onClick={() => {\n setShowForwardedContent(prev => !prev);\n }}\n label={\n showForwardedContent\n ? t('collapse_forwarded_message')\n : t('expand_forwarded_message')\n }\n compact\n >\n <Icon name='more-alt' />\n </StyledForwardedContentToggle>\n {showForwardedContent && <RichTextViewer content={forwardedContent} type='html' />}\n </>\n )}\n </Flex>\n <Flex\n container={{\n direction: 'column',\n gap: 1,\n pad: [0, 2]\n }}\n >\n <StyledEmailSecondaryFieldValueList fields={secondaryFields} />\n <div>\n <Button\n variant='simple'\n onClick={() => {\n onReply?.(id);\n }}\n >\n <Flex\n container={{\n gap: 1,\n alignItems: 'center'\n }}\n >\n <Icon name='reply' />\n <span>{t('reply')}</span>\n </Flex>\n </Button>\n {onReplyAll && (\n <Button\n variant='simple'\n onClick={() => {\n onReplyAll(id);\n }}\n >\n <Flex\n container={{\n gap: 1,\n alignItems: 'center'\n }}\n >\n <Icon name='reply-all' />\n <span>{t('reply_all')}</span>\n </Flex>\n </Button>\n )}\n {onForward && (\n <Button\n variant='simple'\n onClick={() => {\n onForward(id);\n }}\n >\n <Flex\n container={{\n gap: 1,\n alignItems: 'center'\n }}\n >\n <Icon name='forward' />\n <span>{t('forward')}</span>\n </Flex>\n </Button>\n )}\n </div>\n </Flex>\n </Flex>\n );\n }\n);\n\nexport default Email;\n"]}
|
|
1
|
+
{"version":3,"file":"Email.js","sourceRoot":"","sources":["../../../src/components/Email/Email.tsx"],"names":[],"mappings":";;AAAA,OAAO,EACL,UAAU,EACV,QAAQ,EAIR,MAAM,EACN,QAAQ,EACR,OAAO,EACP,SAAS,EAET,mBAAmB,EACpB,MAAM,OAAO,CAAC;AAEf,OAAO,EAEL,IAAI,EACJ,WAAW,EACX,MAAM,EACN,IAAI,EACJ,YAAY,EACZ,MAAM,EACN,IAAI,EAEJ,SAAS,EACT,aAAa,EACb,OAAO,EACP,UAAU,EACV,WAAW,EACX,OAAO,EACP,WAAW,EACX,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,QAAQ,EAER,mBAAmB,EACnB,eAAe,EACf,MAAM,EACP,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,iBAAiB,EACjB,s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QAAQ;qCACrB,aAED,KAAC,IAAI,IAAC,IAAI,EAAC,OAAO,GAAG,EACrB,yBAAO,CAAC,CAAC,OAAO,CAAC,GAAQ,IACpB,GACA,EACR,UAAU,IAAI,CACb,KAAC,MAAM,IACL,OAAO,EAAC,QAAQ,EAChB,OAAO,EAAE,GAAG,EAAE;oCACZ,UAAU,CAAC,EAAE,CAAC,CAAC;gCACjB,CAAC,YAED,MAAC,IAAI,IACH,SAAS,EAAE;wCACT,GAAG,EAAE,CAAC;wCACN,UAAU,EAAE,QAAQ;qCACrB,aAED,KAAC,IAAI,IAAC,IAAI,EAAC,WAAW,GAAG,EACzB,yBAAO,CAAC,CAAC,WAAW,CAAC,GAAQ,IACxB,GACA,CACV,EACA,SAAS,IAAI,CACZ,KAAC,MAAM,IACL,OAAO,EAAC,QAAQ,EAChB,OAAO,EAAE,GAAG,EAAE;oCACZ,SAAS,CAAC,EAAE,CAAC,CAAC;gCAChB,CAAC,YAED,MAAC,IAAI,IACH,SAAS,EAAE;wCACT,GAAG,EAAE,CAAC;wCACN,UAAU,EAAE,QAAQ;qCACrB,aAED,KAAC,IAAI,IAAC,IAAI,EAAC,SAAS,GAAG,EACvB,yBAAO,CAAC,CAAC,SAAS,CAAC,GAAQ,IACtB,GACA,CACV,IACG,IACD,IACF,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,KAAK,CAAC","sourcesContent":["import {\n forwardRef,\n Fragment,\n FunctionComponent,\n PropsWithoutRef,\n ReactNode,\n useRef,\n useState,\n useMemo,\n useEffect,\n MouseEvent,\n useImperativeHandle\n} from 'react';\n\nimport {\n ForwardProps,\n Text,\n SummaryItem,\n Avatar,\n Flex,\n EmailDisplay,\n Button,\n Icon,\n FieldValueListProps,\n Sentiment,\n useOuterEvent,\n Popover,\n useElement,\n CardContent,\n useI18n,\n FileDisplay,\n useBreakpoint,\n DateTimeDisplay,\n useConfiguration,\n MetaList,\n MetaListProps,\n createStringMatcher,\n useScrollToggle,\n Status\n} from '@pega/cosmos-react-core';\nimport { RichTextViewer } from '@pega/cosmos-react-rte';\n\nimport EmailEntity from './EmailEntity';\nimport ContextMenuPopover from './ContextMenuPopover';\nimport { EmailUser, EmailProps, TargetProps, ContextMenuProps } from './Email.types';\nimport {\n StyledEmail,\n StyledEmailDisplay,\n StyledEmailHeader,\n StyledFromEmailDisplay,\n StyledEmailMoreInfoButton,\n StyledEmailMoreInfoPopover,\n StyledEmailPrimaryFieldValueList,\n StyledEmailBody,\n StyledEmailSecondaryFieldValueList,\n StyledSuggestedRepliesButton,\n StyledSuggestedRepliesMenuButton,\n StyledForwardedContentToggle\n} from './Email.styles';\n\nconst EmailDisplayList = ({\n emailUsers,\n showEmailAddress,\n showShortName\n}: {\n emailUsers: EmailUser[];\n showEmailAddress?: boolean;\n showShortName?: boolean;\n}) => {\n return (\n <>\n {emailUsers.map(({ emailAddress, fullName, shortName }, i) => (\n <Fragment key={emailAddress}>\n {i === 0 ? '' : '; '}\n <EmailDisplay\n value={emailAddress}\n displayText={`${showShortName ? shortName : fullName}${\n showEmailAddress ? ` <${emailAddress}>` : ''\n }`}\n variant='text'\n as={StyledEmailDisplay}\n />\n </Fragment>\n ))}\n </>\n );\n};\n\nconst OVERFLOW_TO_EMAIL_COUNT = 2;\nconst OVERFLOW_EMAIL_SUGGESTION_COUNT = 2;\n\nconst Email: FunctionComponent<EmailProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<EmailProps>, ref: EmailProps['ref']) => {\n const {\n id,\n from,\n to = [],\n cc = [],\n bcc = [],\n actions = [],\n timeStamp,\n sentiment,\n subject,\n forwardedContent,\n attachments = [],\n suggestions = [],\n entityHighlightMapping = [],\n onReply,\n onForward,\n onReplyAll,\n onSuggestionClick,\n contextMenu,\n status,\n ...restProps\n } = props;\n let { body } = props;\n const t = useI18n();\n\n const [emailMoreInfoBtnRef, setEmailMoreInfoBtnRef] = useElement<HTMLButtonElement>(null);\n const [showEmailMoreInfo, setShowEmailMoreInfo] = useState(false);\n const [showForwardedContent, setShowForwardedContent] = useState(false);\n const [emailMoreInfoPopover, setEmailMoreInfoPopover] = useElement<HTMLDivElement>(null);\n const emailMoreInfoFields: FieldValueListProps['fields'] = [];\n // Only way to set this is through imperative handle\n const [contextMenuItems, setContextMenuItems] = useState<ContextMenuProps['items']>([]);\n const [contextMenuLoading, setContextMenuLoading] = useState<boolean>(false);\n\n useImperativeHandle(contextMenu?.handle, () => ({\n setContextMenuItems: (ctxMenuItems: ContextMenuProps['items']) => {\n setContextMenuItems(ctxMenuItems || []);\n setContextMenuLoading(false);\n }\n }));\n\n const headerRef = useRef<HTMLDivElement>(null);\n const isSmallOrAbove = useBreakpoint('sm', {\n breakpointRef: headerRef,\n themeProp: 'content-width'\n });\n const { locale } = useConfiguration();\n const [currentTarget, setCurrentTarget] = useState<TargetProps>({\n targetNode: null,\n cursorPosition: {\n x: 0,\n y: 0\n }\n });\n const [popoverOpen, setPopoverOpen] = useState(false);\n const { disableScroll, enableScroll } = useScrollToggle();\n const [popoverEl, setPopoverEl] = useElement<HTMLElement>();\n\n useOuterEvent('mousedown', [popoverEl], () => {\n if (popoverOpen) setPopoverOpen(false);\n });\n\n // Handler for right click on email body\n const onContextMenu = (e: MouseEvent<HTMLDivElement>) => {\n e.preventDefault();\n if (e.target instanceof HTMLElement && e.target.textContent?.trim()) {\n setContextMenuItems([]);\n setContextMenuLoading(true);\n setPopoverOpen(true);\n setCurrentTarget({\n targetNode: e.target,\n cursorPosition: {\n x: e.pageX - window.scrollX,\n y: e.pageY - window.scrollY\n }\n });\n contextMenu?.onContextMenu(id, e);\n }\n };\n\n const onItemClick: ContextMenuProps['onItemClick'] = (selectedValue: {\n fieldName: string;\n fieldValue: string;\n }) => {\n setPopoverOpen(false);\n contextMenu?.onItemClick(selectedValue);\n };\n\n if (from) {\n emailMoreInfoFields.push({\n id: 'from',\n name: t('from'),\n value: from.emailAddress\n });\n }\n\n if (to.length > 0) {\n emailMoreInfoFields.push({\n id: 'to',\n name: t('to'),\n value: <EmailDisplayList emailUsers={to} showEmailAddress />\n });\n }\n\n if (cc.length > 0) {\n emailMoreInfoFields.push({\n id: 'cc',\n name: 'CC',\n value: <EmailDisplayList emailUsers={cc} showEmailAddress />\n });\n }\n\n if (bcc.length > 0) {\n emailMoreInfoFields.push({\n id: 'BCC',\n name: 'BCC',\n value: <EmailDisplayList emailUsers={bcc} showEmailAddress />\n });\n }\n\n if (timeStamp) {\n emailMoreInfoFields.push({\n id: 'date',\n name: t('date'),\n value: (\n <Text>\n {`${new Intl.DateTimeFormat(locale, { weekday: 'short' }).format(\n new Date(timeStamp)\n )}, `}\n <DateTimeDisplay variant='datetime' format='short' value={timeStamp} />\n </Text>\n )\n });\n }\n\n useOuterEvent('mousedown', [emailMoreInfoPopover], () => {\n setShowEmailMoreInfo(false);\n });\n\n const secondaryFields: FieldValueListProps['fields'] = [];\n\n if (attachments.length > 0) {\n secondaryFields.push({\n id: 'attachments',\n name: '',\n value: (\n <Flex container={{ gap: 1, wrap: 'wrap' }}>\n {attachments.map(attachmentProps => (\n <FileDisplay {...attachmentProps} key={attachmentProps.value} />\n ))}\n </Flex>\n )\n });\n }\n\n if (suggestions.length > 0) {\n secondaryFields.push({\n id: 'suggested_replies',\n name: '',\n value: (\n <Flex container={{ wrap: 'wrap' }}>\n {suggestions\n .slice(0, OVERFLOW_EMAIL_SUGGESTION_COUNT)\n .map(({ id: suggestionId, title }) => (\n <StyledSuggestedRepliesButton\n variant='secondary'\n key={suggestionId}\n onClick={() => {\n onSuggestionClick?.(id, suggestionId);\n }}\n >\n {title}\n </StyledSuggestedRepliesButton>\n ))}\n {suggestions.length > OVERFLOW_EMAIL_SUGGESTION_COUNT && (\n <StyledSuggestedRepliesMenuButton\n text='Other responses'\n key='other_responses'\n variant='secondary'\n menu={{\n items: suggestions\n .slice(OVERFLOW_EMAIL_SUGGESTION_COUNT)\n .map(({ id: suggestionId, title }) => {\n return {\n primary: title,\n id: suggestionId,\n onClick: () => {\n onSuggestionClick?.(id, suggestionId);\n }\n };\n })\n }}\n />\n )}\n </Flex>\n )\n });\n }\n\n let renderedBody: ReactNode = body;\n\n const entityConfigs = useMemo(() => {\n return entityHighlightMapping.map(entity => {\n const regExp = createStringMatcher(entity.value, 'contains', 'gi');\n\n return {\n type: 'entity',\n regexPattern: regExp,\n component: () => <EmailEntity entity={entity} />\n };\n });\n }, [entityHighlightMapping]);\n\n // Apply entity highlighting only on string body\n if (typeof body === 'string') {\n if (subject) {\n body = `<div>${t('subject')}: ${subject}</div><br>${body}`;\n }\n const { cursorPosition, targetNode } = currentTarget;\n\n renderedBody = (\n <>\n <RichTextViewer\n content={body}\n type='html'\n interactionRenderers={entityConfigs}\n aria-label={t('unique_entities', [entityConfigs.length], {\n count: entityConfigs.length\n })}\n role='group'\n />\n\n {/* Don't render it if context menu is disabled */}\n {contextMenu && (\n <ContextMenuPopover\n cursorPosition={cursorPosition}\n contextMenu={{\n ...contextMenu,\n items: contextMenuItems,\n loading: contextMenuLoading,\n onItemClick\n }}\n targetNode={targetNode as Node}\n show={popoverOpen}\n ref={setPopoverEl}\n />\n )}\n </>\n );\n }\n\n const emailMetaListItems: MetaListProps['items'] = [\n <Text variant='secondary'>\n {`${t('to')}: `}\n <EmailDisplayList emailUsers={to.slice(0, OVERFLOW_TO_EMAIL_COUNT)} showShortName />\n {to.length > OVERFLOW_TO_EMAIL_COUNT &&\n `; +${t('more_count', [to.length - OVERFLOW_TO_EMAIL_COUNT])}`}\n </Text>,\n <Text variant='secondary'>\n {`${new Intl.DateTimeFormat(locale, { weekday: 'short' }).format(new Date(timeStamp))}, `}\n <DateTimeDisplay variant='datetime' format='short' value={timeStamp} />\n </Text>\n ];\n\n useEffect(() => {\n if (popoverOpen) disableScroll();\n else enableScroll();\n }, [popoverOpen]);\n\n return (\n <Flex\n as={StyledEmail}\n container={{\n direction: 'column',\n gap: 1\n }}\n ref={ref}\n {...restProps}\n >\n <SummaryItem\n as={StyledEmailHeader}\n visual={<Avatar {...from.avatarProps} name={from.fullName} />}\n ref={headerRef}\n primary={\n <Flex\n container={{\n gap: 1,\n alignItems: 'center'\n }}\n >\n <StyledFromEmailDisplay\n value={from.emailAddress}\n displayText={from.fullName}\n variant='text'\n />\n {sentiment && <Sentiment {...sentiment} labelHidden />}\n </Flex>\n }\n secondary={\n <Flex\n container={{\n gap: 0,\n alignItems: 'start',\n direction: 'column'\n }}\n >\n <Flex\n container={{\n gap: 0,\n alignItems: 'start'\n }}\n >\n <MetaList items={isSmallOrAbove ? emailMetaListItems : [emailMetaListItems[0]]} />\n\n <Button\n icon\n variant='simple'\n as={StyledEmailMoreInfoButton}\n ref={setEmailMoreInfoBtnRef}\n onClick={() => {\n setShowEmailMoreInfo(true);\n }}\n label={t('show_more')}\n >\n <Icon name='arrow-micro-down' />\n </Button>\n <Popover\n as={StyledEmailMoreInfoPopover}\n show={showEmailMoreInfo}\n ref={setEmailMoreInfoPopover}\n target={emailMoreInfoBtnRef}\n placement='bottom'\n >\n <CardContent>\n <StyledEmailPrimaryFieldValueList fields={emailMoreInfoFields} />\n </CardContent>\n </Popover>\n </Flex>\n {!isSmallOrAbove && timeStamp && emailMetaListItems[1]}\n {status && !isSmallOrAbove && (\n <Flex container={{ pad: [0.5, 0, 0] }}>\n <Status variant={status === 'draft' ? 'pending' : 'urgent'}>\n {/* Passing mock count so that translation engine select correct form of draft,\n with [](second argument) as empty so that count is not shown */}\n {status === 'draft' ? t('draft', [], { count: 1 }) : t(status)}\n </Status>\n </Flex>\n )}\n </Flex>\n }\n actions={\n <Flex\n container={{\n gap: 1,\n pad: 1,\n alignItems: 'center'\n }}\n >\n {status && isSmallOrAbove && (\n <Status variant={status === 'draft' ? 'pending' : 'urgent'}>\n {/* Passing mock count so that translation engine select correct form of draft,\n with [](second argument) as empty so that count is not shown */}\n {status === 'draft' ? t('draft', [], { count: 1 }) : t(status)}\n </Status>\n )}\n {actions}\n </Flex>\n }\n />\n <Flex\n container={{\n direction: 'column',\n gap: 2,\n pad: [0, 2]\n }}\n onContextMenu={contextMenu ? onContextMenu : undefined}\n >\n {/* Attach the handler only when context menu enabled by providing the prop */}\n <StyledEmailBody>{renderedBody}</StyledEmailBody>\n {forwardedContent && forwardedContent.length > 0 && (\n <>\n <StyledForwardedContentToggle\n variant='simple'\n icon\n onClick={() => {\n setShowForwardedContent(prev => !prev);\n }}\n label={\n showForwardedContent\n ? t('collapse_forwarded_message')\n : t('expand_forwarded_message')\n }\n compact\n >\n <Icon name='more-alt' />\n </StyledForwardedContentToggle>\n {showForwardedContent && <RichTextViewer content={forwardedContent} type='html' />}\n </>\n )}\n </Flex>\n <Flex\n container={{\n direction: 'column',\n gap: 1,\n pad: [0, 2]\n }}\n >\n <StyledEmailSecondaryFieldValueList fields={secondaryFields} />\n <div>\n <Button\n variant='simple'\n onClick={() => {\n onReply?.(id);\n }}\n >\n <Flex\n container={{\n gap: 1,\n alignItems: 'center'\n }}\n >\n <Icon name='reply' />\n <span>{t('reply')}</span>\n </Flex>\n </Button>\n {onReplyAll && (\n <Button\n variant='simple'\n onClick={() => {\n onReplyAll(id);\n }}\n >\n <Flex\n container={{\n gap: 1,\n alignItems: 'center'\n }}\n >\n <Icon name='reply-all' />\n <span>{t('reply_all')}</span>\n </Flex>\n </Button>\n )}\n {onForward && (\n <Button\n variant='simple'\n onClick={() => {\n onForward(id);\n }}\n >\n <Flex\n container={{\n gap: 1,\n alignItems: 'center'\n }}\n >\n <Icon name='forward' />\n <span>{t('forward')}</span>\n </Flex>\n </Button>\n )}\n </div>\n </Flex>\n </Flex>\n );\n }\n);\n\nexport default Email;\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { EmailEntityProps
|
|
2
|
+
import { EmailEntityProps } from './Email.types';
|
|
3
3
|
export declare const StyledEmailMoreInfoButton: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, {}, never>;
|
|
4
4
|
export declare const StyledEmailHeader: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
5
5
|
export declare const StyledSuggestedRepliesButton: import("styled-components").StyledComponent<import("react").FunctionComponent<import("@pega/cosmos-react-core").ButtonProps & import("@pega/cosmos-react-core").ForwardProps>, import("styled-components").DefaultTheme, {}, never>;
|
|
@@ -16,6 +16,9 @@ export declare const StyledEmailEntity: import("styled-components").StyledCompon
|
|
|
16
16
|
export declare const StyledEntityList: import("styled-components").StyledComponent<import("react").FunctionComponent<import("@pega/cosmos-react-core").FieldValueListProps & import("@pega/cosmos-react-core").ForwardProps>, import("styled-components").DefaultTheme, {}, never>;
|
|
17
17
|
export declare const StyledForwardedContentToggle: import("styled-components").StyledComponent<import("react").FunctionComponent<import("@pega/cosmos-react-core").ButtonProps & import("@pega/cosmos-react-core").ForwardProps>, import("styled-components").DefaultTheme, {}, never>;
|
|
18
18
|
export declare const StyledLoadMore: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
19
|
+
interface StyledContextMenuFieldSelectorProps {
|
|
20
|
+
selected?: boolean;
|
|
21
|
+
}
|
|
19
22
|
export declare const StyledContextMenuFieldSelector: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, StyledContextMenuFieldSelectorProps, never>;
|
|
20
23
|
export declare const StyledContextMenu: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
21
24
|
export declare const StyledList: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
@@ -30,4 +33,5 @@ export declare const StyledExpandedUtilities: import("styled-components").Styled
|
|
|
30
33
|
export declare const StyledUtilities: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
|
|
31
34
|
showExpandedUtilities: boolean;
|
|
32
35
|
}, never>;
|
|
36
|
+
export {};
|
|
33
37
|
//# sourceMappingURL=Email.styles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Email.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Email/Email.styles.ts"],"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SAUzE,CAAC"}
|
|
@@ -9,7 +9,6 @@ export const StyledEmailMoreInfoButton = styled.button `
|
|
|
9
9
|
export const StyledEmailHeader = styled.div(({ theme }) => {
|
|
10
10
|
return css `
|
|
11
11
|
grid-column-gap: ${theme.base.spacing};
|
|
12
|
-
border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};
|
|
13
12
|
padding: 0 0 calc(2 * ${theme.base.spacing}) calc(2 * ${theme.base.spacing});
|
|
14
13
|
${StyledVisual},${StyledSummaryItemActions} {
|
|
15
14
|
align-self: flex-start;
|