@pega/cosmos-react-social 3.0.0-dev.16.0 → 3.0.0-dev.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/Chat/Message.styles.js +2 -2
- package/lib/components/Chat/Message.styles.js.map +1 -1
- package/lib/components/Chat/SystemMessage.js +2 -2
- package/lib/components/Chat/SystemMessage.js.map +1 -1
- package/lib/components/Email/ContextMenuPopover.d.ts.map +1 -1
- package/lib/components/Email/ContextMenuPopover.js +8 -6
- package/lib/components/Email/ContextMenuPopover.js.map +1 -1
- package/lib/components/Email/Email.d.ts.map +1 -1
- package/lib/components/Email/Email.js +48 -30
- package/lib/components/Email/Email.js.map +1 -1
- package/lib/components/Email/Email.styles.d.ts.map +1 -1
- package/lib/components/Email/Email.styles.js +1 -2
- package/lib/components/Email/Email.styles.js.map +1 -1
- package/lib/components/Email/Email.types.d.ts +27 -7
- 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/EntityList.d.ts.map +1 -1
- package/lib/components/Email/EntityList.js +48 -30
- package/lib/components/Email/EntityList.js.map +1 -1
- package/lib/components/Feed/FeedNewPost.d.ts.map +1 -1
- package/lib/components/Feed/FeedNewPost.js +1 -1
- package/lib/components/Feed/FeedNewPost.js.map +1 -1
- package/lib/components/Feed/FeedPost.d.ts.map +1 -1
- package/lib/components/Feed/FeedPost.js +28 -8
- package/lib/components/Feed/FeedPost.js.map +1 -1
- package/lib/components/Feed/FeedPost.types.d.ts +4 -2
- package/lib/components/Feed/FeedPost.types.d.ts.map +1 -1
- package/lib/components/Feed/FeedPost.types.js.map +1 -1
- package/lib/components/Feed/FeedReply.d.ts.map +1 -1
- package/lib/components/Feed/FeedReply.js +27 -6
- package/lib/components/Feed/FeedReply.js.map +1 -1
- package/lib/components/Feed/FeedReply.types.d.ts +4 -2
- package/lib/components/Feed/FeedReply.types.d.ts.map +1 -1
- package/lib/components/Feed/FeedReply.types.js.map +1 -1
- package/lib/components/Feed/FeedReplyInput.d.ts.map +1 -1
- package/lib/components/Feed/FeedReplyInput.js +1 -1
- package/lib/components/Feed/FeedReplyInput.js.map +1 -1
- package/lib/components/Feed/FeedRichText.d.ts +1 -1
- package/lib/components/Feed/FeedRichText.d.ts.map +1 -1
- package/lib/components/Feed/FeedRichText.js +1 -1
- package/lib/components/Feed/FeedRichText.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import styled, { css } from 'styled-components';
|
|
2
|
-
import { rgba
|
|
2
|
+
import { rgba } from 'polished';
|
|
3
3
|
import { defaultThemeProp, tryCatch } from '@pega/cosmos-react-core';
|
|
4
4
|
import BareButton from '@pega/cosmos-react-core/lib/components/Button/BareButton';
|
|
5
5
|
export const StyledMessageBubbleContent = styled.div ``;
|
|
@@ -22,7 +22,7 @@ export const StyledMessageContainer = styled.div(({ messageDirection, variant, t
|
|
|
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';
|
|
25
|
-
const metaForegroundColor = tryCatch(() =>
|
|
25
|
+
const metaForegroundColor = tryCatch(() => rgba(foregroundColor, foregroundAlpha));
|
|
26
26
|
return css `
|
|
27
27
|
padding: ${padding};
|
|
28
28
|
margin-bottom: ${typing ? '0.5rem' : '0'};
|
|
@@ -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,IAAI,YAAY,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAC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AKvD,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 as polishedRgba } 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(() => polishedRgba(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,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,EAAE,CAAC;AAEtD,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AkB,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,12 +1,12 @@
|
|
|
1
1
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
import styled, { css } from 'styled-components';
|
|
4
|
-
import { rgba
|
|
4
|
+
import { rgba } from 'polished';
|
|
5
5
|
import { Flex, tryCatch, defaultThemeProp } from '@pega/cosmos-react-core';
|
|
6
6
|
export const StyledSystemMessage = styled.div(({ theme: { base: { palette: { 'foreground-color': foregroundColor }, transparency: { 'transparent-3': foregroundAlpha } }, components: { chat: { messageBubble: { sender: { content: { 'background-color': primarySystemMessageColor } } } } } }, variant }) => {
|
|
7
7
|
const systemMessageForeGroundColor = variant === 'primary'
|
|
8
8
|
? primarySystemMessageColor
|
|
9
|
-
: tryCatch(() =>
|
|
9
|
+
: tryCatch(() => rgba(foregroundColor, foregroundAlpha));
|
|
10
10
|
return css `
|
|
11
11
|
color: ${systemMessageForeGroundColor};
|
|
12
12
|
font-size: 0.75rem;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SystemMessage.js","sourceRoot":"","sources":["../../../src/components/Chat/SystemMessage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,UAAU,EAAmC,MAAM,OAAO,CAAC;AACvF,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,IAAI,
|
|
1
|
+
{"version":3,"file":"SystemMessage.js","sourceRoot":"","sources":["../../../src/components/Chat/SystemMessage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,UAAU,EAAmC,MAAM,OAAO,CAAC;AACvF,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,OAAO,EACL,IAAI,EACJ,QAAQ,EACR,gBAAgB,EAGjB,MAAM,yBAAyB,CAAC;AAiBjC,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAC3C,CAAC,EACC,KAAK,EAAE,EACL,IAAI,EAAE,EACJ,OAAO,EAAE,EAAE,kBAAkB,EAAE,eAAe,EAAE,EAChD,YAAY,EAAE,EAAE,eAAe,EAAE,eAAe,EAAE,EACnD,EACD,UAAU,EAAE,EACV,IAAI,EAAE,EACJ,aAAa,EAAE,EACb,MAAM,EAAE,EACN,OAAO,EAAE,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,EAC3D,EACF,EACF,EACF,EACF,EACD,OAAO,EACR,EAAE,EAAE;IACH,MAAM,4BAA4B,GAChC,OAAO,KAAK,SAAS;QACnB,CAAC,CAAC,yBAAyB;QAC3B,CAAC,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC,CAAC;IAC7D,OAAO,GAAG,CAAA;eACC,4BAA4B;;;;;;;sCAOL,4BAA4B;;;;;;;;;;KAU7D,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,mBAAmB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEpD,MAAM,aAAa,GAAyD,UAAU,CACpF,CAAC,KAA0C,EAAE,GAA8B,EAAE,EAAE;IAC7E,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,GAAG,WAAW,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC;IAC1E,OAAO,CACL,MAAC,IAAI,IACH,GAAG,EAAE,GAAG,EACR,EAAE,EAAE,mBAAmB,EACvB,SAAS,EAAE;YACT,UAAU,EAAE,QAAQ;SACrB,EACD,IAAI,EAAE;YACJ,MAAM,EAAE,CAAC;SACV,EACD,OAAO,EAAE,OAAO,KACZ,SAAS,aAEZ,SAAS,IAAI,GAAG,SAAS,IAAI,OAAG,OAAO,IACnC,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import { FunctionComponent, forwardRef, PropsWithoutRef, ReactNode, Ref } from 'react';\nimport styled, { css } from 'styled-components';\nimport { rgba } from 'polished';\n\nimport {\n Flex,\n tryCatch,\n defaultThemeProp,\n ForwardProps,\n PropsWithDefaults\n} from '@pega/cosmos-react-core';\n\nexport interface SystemMessageProps {\n /** Ref to the container element */\n ref?: Ref<HTMLDivElement>;\n /** System message to be displayed */\n message: ReactNode;\n /** timestamp of the message(Formatted) */\n timeStamp?: string;\n /** variant of this system message\n * @default \"secondary\"\n */\n variant?: 'primary' | 'secondary';\n}\n\ntype SystemMessagePropsWithDefaults = PropsWithDefaults<SystemMessageProps, 'variant'>;\n\nexport const StyledSystemMessage = styled.div<Pick<SystemMessagePropsWithDefaults, 'variant'>>(\n ({\n theme: {\n base: {\n palette: { 'foreground-color': foregroundColor },\n transparency: { 'transparent-3': foregroundAlpha }\n },\n components: {\n chat: {\n messageBubble: {\n sender: {\n content: { 'background-color': primarySystemMessageColor }\n }\n }\n }\n }\n },\n variant\n }) => {\n const systemMessageForeGroundColor =\n variant === 'primary'\n ? primarySystemMessageColor\n : tryCatch(() => rgba(foregroundColor, foregroundAlpha));\n return css`\n color: ${systemMessageForeGroundColor};\n font-size: 0.75rem;\n padding: 0 0 0.5rem;\n ::before,\n ::after {\n display: inline-flex;\n content: '';\n border-top: 0.0625rem solid ${systemMessageForeGroundColor};\n flex-grow: 1;\n min-width: 1.5rem;\n }\n ::before {\n margin: 0 0.5rem 0 0;\n }\n ::after {\n margin: 0 0 0 0.5rem;\n }\n `;\n }\n);\n\nStyledSystemMessage.defaultProps = defaultThemeProp;\n\nconst SystemMessage: FunctionComponent<SystemMessageProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<SystemMessageProps>, ref: SystemMessageProps['ref']) => {\n const { message, timeStamp, variant = 'secondary', ...restProps } = props;\n return (\n <Flex\n ref={ref}\n as={StyledSystemMessage}\n container={{\n alignItems: 'center'\n }}\n item={{\n shrink: 0\n }}\n variant={variant}\n {...restProps}\n >\n {timeStamp && `${timeStamp}: `} {message}\n </Flex>\n );\n }\n);\n\nexport default SystemMessage;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenuPopover.d.ts","sourceRoot":"","sources":["../../../src/components/Email/ContextMenuPopover.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"ContextMenuPopover.d.ts","sourceRoot":"","sources":["../../../src/components/Email/ContextMenuPopover.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAA2C,MAAM,OAAO,CAAC;AASnF,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAExD,QAAA,MAAM,kBAAkB,EAAE,iBAAiB,CAAC,uBAAuB,CAyElE,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { Popover, Menu, Text, useI18n } from '@pega/cosmos-react-core';
|
|
3
4
|
import { StyledEmailMoreInfoPopover, StyledContextMenuFieldSelector, StyledContextMenu } from './Email.styles';
|
|
4
|
-
const ContextMenuPopover = ({ cursorPosition, contextMenu, targetNode }) => {
|
|
5
|
-
const
|
|
5
|
+
const ContextMenuPopover = forwardRef(({ cursorPosition, contextMenu, targetNode, show }, ref) => {
|
|
6
|
+
const t = useI18n();
|
|
6
7
|
const selection = document.getSelection();
|
|
7
8
|
if (selection && !selection.toString() && targetNode) {
|
|
8
9
|
const range = document.createRange();
|
|
@@ -11,7 +12,8 @@ const ContextMenuPopover = ({ cursorPosition, contextMenu, targetNode }) => {
|
|
|
11
12
|
selection.addRange(range);
|
|
12
13
|
}
|
|
13
14
|
const { onItemClick, items } = contextMenu;
|
|
14
|
-
const onItemSelect = (contextMenuItemId) => {
|
|
15
|
+
const onItemSelect = (contextMenuItemId, e) => {
|
|
16
|
+
e.stopPropagation();
|
|
15
17
|
const selectedcontextMenuItem = items.find(({ id }) => id === contextMenuItemId);
|
|
16
18
|
if (selectedcontextMenuItem && selection) {
|
|
17
19
|
onItemClick({
|
|
@@ -42,7 +44,7 @@ const ContextMenuPopover = ({ cursorPosition, contextMenu, targetNode }) => {
|
|
|
42
44
|
toJSON: () => { }
|
|
43
45
|
};
|
|
44
46
|
}
|
|
45
|
-
}, placement: 'bottom', children: _jsx(StyledContextMenu, { children: _jsx(Menu, { ...contextMenu, header: _jsx(Text, { variant: 'h5', children:
|
|
46
|
-
};
|
|
47
|
+
}, show: show, placement: 'bottom', ref: ref, children: _jsx(StyledContextMenu, { children: _jsx(Menu, { ...contextMenu, header: _jsx(Text, { variant: 'h5', children: t('copy_to') }), items: itemsToRender, onItemClick: onItemSelect }) }) }));
|
|
48
|
+
});
|
|
47
49
|
export default ContextMenuPopover;
|
|
48
50
|
//# sourceMappingURL=ContextMenuPopover.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenuPopover.js","sourceRoot":"","sources":["../../../src/components/Email/ContextMenuPopover.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"ContextMenuPopover.js","sourceRoot":"","sources":["../../../src/components/Email/ContextMenuPopover.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAiC,UAAU,EAAmB,MAAM,OAAO,CAAC;AAEnF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAEvE,OAAO,EACL,0BAA0B,EAC1B,8BAA8B,EAC9B,iBAAiB,EAClB,MAAM,gBAAgB,CAAC;AAGxB,MAAM,kBAAkB,GAA+C,UAAU,CAC/E,CACE,EAAE,cAAc,EAAE,WAAW,EAAE,UAAU,EAAE,IAAI,EAA4C,EAC3F,GAAmC,EACnC,EAAE;IACF,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IACpB,MAAM,SAAS,GAAG,QAAQ,CAAC,YAAY,EAAE,CAAC;IAE1C,IAAI,SAAS,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,UAAU,EAAE;QACpD,MAAM,KAAK,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;QACrC,KAAK,CAAC,kBAAkB,CAAC,UAAkB,CAAC,CAAC;QAC7C,SAAS,EAAE,eAAe,EAAE,CAAC;QAC7B,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;KAC3B;IACD,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,WAAW,CAAC;IAC3C,MAAM,YAAY,GAAG,CAA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AW,EACf,MAAM,EAAE,KAAC,IAAI,IAAC,OAAO,EAAC,IAAI,YAAE,CAAC,CAAC,SAAS,CAAC,GAAQ,EAChD,KAAK,EAAE,aAAa,EACpB,WAAW,EAAE,YAAY,GACzB,GACgB,GACZ,CACX,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,kBAAkB,CAAC","sourcesContent":["import { FunctionComponent, MouseEvent, forwardRef, PropsWithoutRef } from 'react';\n\nimport { Popover, Menu, Text, useI18n } from '@pega/cosmos-react-core';\n\nimport {\n StyledEmailMoreInfoPopover,\n StyledContextMenuFieldSelector,\n StyledContextMenu\n} from './Email.styles';\nimport { ContextMenuPopoverProps } from './Email.types';\n\nconst ContextMenuPopover: FunctionComponent<ContextMenuPopoverProps> = forwardRef(\n (\n { cursorPosition, contextMenu, targetNode, show }: PropsWithoutRef<ContextMenuPopoverProps>,\n ref: ContextMenuPopoverProps['ref']\n ) => {\n const t = useI18n();\n const selection = document.getSelection();\n\n if (selection && !selection.toString() && targetNode) {\n const range = document.createRange();\n range.selectNodeContents(targetNode as Node);\n selection?.removeAllRanges();\n selection.addRange(range);\n }\n const { onItemClick, items } = contextMenu;\n const onItemSelect = (contextMenuItemId: string, e: MouseEvent) => {\n e.stopPropagation();\n const selectedcontextMenuItem = items.find(({ id }) => id === contextMenuItemId);\n\n if (selectedcontextMenuItem && selection) {\n onItemClick({\n fieldName: selectedcontextMenuItem.primary,\n fieldValue: selection.toString()\n });\n selection.removeAllRanges();\n }\n };\n\n const itemsToRender = items.map(item => {\n return {\n ...item,\n visual: item.selected ? (\n <StyledContextMenuFieldSelector selected />\n ) : (\n <StyledContextMenuFieldSelector />\n )\n };\n });\n\n return (\n <Popover\n as={StyledEmailMoreInfoPopover}\n target={{\n getBoundingClientRect: () => {\n const { x, y } = cursorPosition;\n return {\n width: 0,\n height: 0,\n top: y,\n right: x,\n bottom: y,\n left: x,\n x,\n y,\n toJSON: () => {}\n };\n }\n }}\n show={show}\n placement='bottom'\n ref={ref}\n >\n <StyledContextMenu>\n <Menu\n {...contextMenu}\n header={<Text variant='h5'>{t('copy_to')}</Text>}\n items={itemsToRender}\n onItemClick={onItemSelect}\n />\n </StyledContextMenu>\n </Popover>\n );\n }\n);\n\nexport default ContextMenuPopover;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Email.d.ts","sourceRoot":"","sources":["../../../src/components/Email/Email.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,
|
|
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,EAuBb,MAAM,yBAAyB,CAAC;AAKjC,OAAO,EAAa,UAAU,EAAiC,MAAM,eAAe,CAAC;AA+CrF,QAAA,MAAM,KAAK,EAAE,iBAAiB,CAAC,UAAU,GAAG,YAAY,CAicvD,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
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
|
-
import { forwardRef, Fragment, useRef, useState, useMemo, useEffect } from 'react';
|
|
3
|
+
import { forwardRef, Fragment, useRef, useState, useMemo, useEffect, useImperativeHandle } from 'react';
|
|
4
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';
|
|
5
5
|
import { RichTextViewer } from '@pega/cosmos-react-rte';
|
|
6
6
|
import EmailEntity from './EmailEntity';
|
|
@@ -19,18 +19,53 @@ const Email = forwardRef((props, ref) => {
|
|
|
19
19
|
const [showForwardedContent, setShowForwardedContent] = useState(false);
|
|
20
20
|
const [emailMoreInfoPopover, setEmailMoreInfoPopover] = useElement(null);
|
|
21
21
|
const emailMoreInfoFields = [];
|
|
22
|
+
// Only way to set this is through imperative handle
|
|
23
|
+
const [contextMenuItems, setContextMenuItems] = useState([]);
|
|
24
|
+
const [contextMenuLoading, setContextMenuLoading] = useState(false);
|
|
25
|
+
useImperativeHandle(contextMenu?.handle, () => ({
|
|
26
|
+
setContextMenuItems: (ctxMenuItems) => {
|
|
27
|
+
setContextMenuItems(ctxMenuItems || []);
|
|
28
|
+
setContextMenuLoading(false);
|
|
29
|
+
}
|
|
30
|
+
}));
|
|
22
31
|
const headerRef = useRef(null);
|
|
23
32
|
const isSmallOrAbove = useBreakpoint('sm', { breakpointRef: headerRef });
|
|
24
33
|
const { locale } = useConfiguration();
|
|
25
|
-
const [currentTarget,
|
|
34
|
+
const [currentTarget, setCurrentTarget] = useState({
|
|
26
35
|
targetNode: null,
|
|
27
36
|
cursorPosition: {
|
|
28
37
|
x: 0,
|
|
29
38
|
y: 0
|
|
30
39
|
}
|
|
31
40
|
});
|
|
32
|
-
const [
|
|
41
|
+
const [popoverOpen, setPopoverOpen] = useState(false);
|
|
33
42
|
const { disableScroll, enableScroll } = useScrollToggle();
|
|
43
|
+
const [popoverEl, setPopoverEl] = useElement();
|
|
44
|
+
useOuterEvent('mousedown', [popoverEl], () => {
|
|
45
|
+
if (popoverOpen)
|
|
46
|
+
setPopoverOpen(false);
|
|
47
|
+
});
|
|
48
|
+
// Handler for right click on email body
|
|
49
|
+
const onContextMenu = (e) => {
|
|
50
|
+
e.preventDefault();
|
|
51
|
+
if (e.target instanceof HTMLElement && e.target.textContent?.trim()) {
|
|
52
|
+
setContextMenuItems([]);
|
|
53
|
+
setContextMenuLoading(true);
|
|
54
|
+
setPopoverOpen(true);
|
|
55
|
+
setCurrentTarget({
|
|
56
|
+
targetNode: e.target,
|
|
57
|
+
cursorPosition: {
|
|
58
|
+
x: e.pageX - window.scrollX,
|
|
59
|
+
y: e.pageY - window.scrollY
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
contextMenu?.onContextMenu(id, e);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
const onItemClick = (selectedValue) => {
|
|
66
|
+
setPopoverOpen(false);
|
|
67
|
+
contextMenu?.onItemClick(selectedValue);
|
|
68
|
+
};
|
|
34
69
|
if (from) {
|
|
35
70
|
emailMoreInfoFields.push({
|
|
36
71
|
id: 'from',
|
|
@@ -116,7 +151,12 @@ const Email = forwardRef((props, ref) => {
|
|
|
116
151
|
const { cursorPosition, targetNode } = currentTarget;
|
|
117
152
|
renderedBody = (_jsxs(_Fragment, { children: [_jsx(RichTextViewer, { content: body, type: 'html', interactionRenderers: entityConfigs, "aria-label": t('unique_entities', [entityConfigs.length], {
|
|
118
153
|
count: entityConfigs.length
|
|
119
|
-
}), role: 'group' }), contextMenu &&
|
|
154
|
+
}), role: 'group' }), contextMenu && (_jsx(ContextMenuPopover, { cursorPosition: cursorPosition, contextMenu: {
|
|
155
|
+
...contextMenu,
|
|
156
|
+
items: contextMenuItems,
|
|
157
|
+
loading: contextMenuLoading,
|
|
158
|
+
onItemClick
|
|
159
|
+
}, targetNode: targetNode, show: popoverOpen, ref: setPopoverEl }))] }));
|
|
120
160
|
}
|
|
121
161
|
const emailMetaListItems = [
|
|
122
162
|
_jsxs(Text, { variant: 'secondary', children: [`${t('to')}: `, _jsx(EmailDisplayList, { emailUsers: to.slice(0, OVERFLOW_TO_EMAIL_COUNT), showShortName: true }), to.length > OVERFLOW_TO_EMAIL_COUNT &&
|
|
@@ -124,23 +164,15 @@ const Email = forwardRef((props, ref) => {
|
|
|
124
164
|
_jsxs(Text, { variant: 'secondary', children: [`${new Intl.DateTimeFormat(locale, { weekday: 'short' }).format(new Date(timeStamp))}, `, _jsx(DateTimeDisplay, { variant: 'datetime', format: 'short', value: timeStamp })] })
|
|
125
165
|
];
|
|
126
166
|
useEffect(() => {
|
|
127
|
-
if (
|
|
167
|
+
if (popoverOpen)
|
|
128
168
|
disableScroll();
|
|
129
169
|
else
|
|
130
170
|
enableScroll();
|
|
131
|
-
}, [
|
|
171
|
+
}, [popoverOpen]);
|
|
132
172
|
return (_jsxs(Flex, { as: StyledEmail, container: {
|
|
133
173
|
direction: 'column',
|
|
134
174
|
gap: 1
|
|
135
|
-
}, ref: ref, ...restProps,
|
|
136
|
-
? () => {
|
|
137
|
-
showPopover(false);
|
|
138
|
-
setcurrentTarget({
|
|
139
|
-
targetNode: null,
|
|
140
|
-
cursorPosition: { x: 0, y: 0 }
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
: undefined, children: [_jsx(SummaryItem, { as: StyledEmailHeader, visual: _jsx(Avatar, { ...from.avatarProps, name: from.fullName }), ref: headerRef, primary: _jsxs(Flex, { container: {
|
|
175
|
+
}, ref: ref, ...restProps, children: [_jsx(SummaryItem, { as: StyledEmailHeader, visual: _jsx(Avatar, { ...from.avatarProps, name: from.fullName }), ref: headerRef, primary: _jsxs(Flex, { container: {
|
|
144
176
|
gap: 1,
|
|
145
177
|
alignItems: 'center'
|
|
146
178
|
}, children: [_jsx(StyledFromEmailDisplay, { value: from.emailAddress, displayText: from.fullName, variant: 'text' }), sentiment && _jsx(Sentiment, { ...sentiment, labelHidden: true })] }), secondary: _jsxs(Flex, { container: {
|
|
@@ -158,21 +190,7 @@ const Email = forwardRef((props, ref) => {
|
|
|
158
190
|
direction: 'column',
|
|
159
191
|
gap: 2,
|
|
160
192
|
pad: [0, 2]
|
|
161
|
-
}, children: [subject && (_jsxs(Text, { variant: 'primary', children: [t('subject'), ": ", subject] })), _jsx(StyledEmailBody, { onContextMenu: contextMenu
|
|
162
|
-
? (e) => {
|
|
163
|
-
if (e.target instanceof HTMLElement && e.target.innerText.trim()) {
|
|
164
|
-
e.preventDefault();
|
|
165
|
-
showPopover(true);
|
|
166
|
-
setcurrentTarget({
|
|
167
|
-
targetNode: e.target,
|
|
168
|
-
cursorPosition: {
|
|
169
|
-
x: e.pageX - window.scrollX,
|
|
170
|
-
y: e.pageY - window.scrollY
|
|
171
|
-
}
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
: undefined, children: renderedBody }), forwardedContent && forwardedContent.length > 0 && (_jsxs(_Fragment, { children: [_jsx(StyledForwardedContentToggle, { variant: 'simple', icon: true, onClick: () => {
|
|
193
|
+
}, children: [subject && (_jsxs(Text, { variant: 'primary', children: [t('subject'), ": ", subject] })), _jsx(StyledEmailBody, { onContextMenu: contextMenu ? onContextMenu : undefined, children: renderedBody }), forwardedContent && forwardedContent.length > 0 && (_jsxs(_Fragment, { children: [_jsx(StyledForwardedContentToggle, { variant: 'simple', icon: true, onClick: () => {
|
|
176
194
|
setShowForwardedContent(prev => !prev);
|
|
177
195
|
}, label: showForwardedContent
|
|
178
196
|
? t('collapse_forwarded_message')
|
|
@@ -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,EAEV,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,0BAA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M,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} 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 } 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 body,\n forwardedContent,\n attachments = [],\n suggestions = [],\n entityHighlightMapping = [],\n onReply,\n onForward,\n onReplyAll,\n onSuggestionClick,\n contextMenu,\n ...restProps\n } = 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\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 [open, showPopover] = useState(false);\n const { disableScroll, enableScroll } = useScrollToggle();\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 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 {contextMenu && open && (\n <ContextMenuPopover\n cursorPosition={cursorPosition}\n contextMenu={contextMenu}\n targetNode={targetNode as Node}\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 (open) disableScroll();\n else enableScroll();\n }, [open]);\n\n return (\n <Flex\n as={StyledEmail}\n container={{\n direction: 'column',\n gap: 1\n }}\n ref={ref}\n {...restProps}\n onClick={\n open\n ? () => {\n showPopover(false);\n setcurrentTarget({\n targetNode: null,\n cursorPosition: { x: 0, y: 0 }\n });\n }\n : undefined\n }\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 >\n {subject && (\n <Text variant='primary'>\n {t('subject')}: {subject}\n </Text>\n )}\n <StyledEmailBody\n onContextMenu={\n contextMenu\n ? (e: MouseEvent<HTMLDivElement>) => {\n if (e.target instanceof HTMLElement && e.target.innerText.trim()) {\n e.preventDefault();\n showPopover(true);\n setcurrentTarget({\n targetNode: e.target,\n cursorPosition: {\n x: e.pageX - window.scrollX,\n y: e.pageY - window.scrollY\n }\n });\n }\n }\n : undefined\n }\n >\n {renderedBody}\n </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,EAChB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,OAAO,WAAW,MAAM,eAAe,CAAC;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C,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 body,\n forwardedContent,\n attachments = [],\n suggestions = [],\n entityHighlightMapping = [],\n onReply,\n onForward,\n onReplyAll,\n onSuggestionClick,\n contextMenu,\n ...restProps\n } = 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 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 >\n {subject && (\n <Text variant='primary'>\n {t('subject')}: {subject}\n </Text>\n )}\n {/* Attach the handler only when context menu enabled by providing the prop */}\n <StyledEmailBody onContextMenu={contextMenu ? onContextMenu : undefined}>\n {renderedBody}\n </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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Email.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Email/Email.styles.ts"],"names":[],"mappings":";AAoBA,OAAO,EAAE,gBAAgB,EAAE,mCAAmC,EAAE,MAAM,eAAe,CAAC;AAEtF,eAAO,MAAM,y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AM,0BAA0B,yGAEtC,CAAC;AAEF,eAAO,MAAM,wBAAwB,yGAInC,CAAC;AAEH,eAAO,MAAM,WAAW,yGAAe,CAAC;AAExC,eAAO,MAAM,iBAAiB,wHAc5B,CAAC;AAIH,eAAO,MAAM,gBAAgB,6OAU3B,CAAC;AAEH,eAAO,MAAM,4BAA4B,qOAExC,CAAC;AAIF,eAAO,MAAM,cAAc,yGAMzB,CAAC;AAIH,eAAO,MAAM,8BAA8B,0IAmB1C,CAAC;AAIF,eAAO,MAAM,iBAAiB,yGAM5B,CAAC;AAGH,eAAO,MAAM,UAAU,yGAKrB,CAAC;AAIH,eAAO,MAAM,YAAY,4GAMvB,CAAC;AAEH,eAAO,MAAM,mBAAmB;;SAgB9B,CAAC;AAIH,eAAO,MAAM,qBAAqB,4GAKhC,CAAC;AAIH,eAAO,MAAM,uBAAuB;2BAAuC,OAAO;SASjF,CAAC;AAEF,eAAO,MAAM,eAAe;2BAAuC,OAAO;SAUzE,CAAC"}
|
|
@@ -138,10 +138,9 @@ export const StyledContextMenuFieldSelector = styled.div(({ theme, selected }) =
|
|
|
138
138
|
});
|
|
139
139
|
StyledContextMenuFieldSelector.defaultProps = defaultThemeProp;
|
|
140
140
|
export const StyledContextMenu = styled.div(({ theme }) => {
|
|
141
|
-
const secondaryBackground = theme.base.palette['secondary-background'];
|
|
142
141
|
return css `
|
|
143
142
|
header {
|
|
144
|
-
background-color: ${
|
|
143
|
+
background-color: ${theme.base.palette['secondary-background']};
|
|
145
144
|
}
|
|
146
145
|
`;
|
|
147
146
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Email.styles.js","sourceRoot":"","sources":["../../../src/components/Email/Email.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EACL,MAAM,EACN,iBAAiB,EACjB,gBAAg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AE,KAAK,EAAE,EAAE,EAAE;IACnC,OAAO,GAAG,CAAA;QACN,qBAAqB;QACvB,GAAG,CAAA;;OAEF;oCAC6B,KAAK,CAAC,IAAI,CAAC,OAAO;KACjD,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\nimport { readableColor } from 'polished';\n\nimport {\n Button,\n calculateFontSize,\n defaultThemeProp,\n EmailDisplay,\n FieldValueList,\n MenuButton,\n StyledFieldName,\n StyledFieldValue,\n StyledSecondary,\n StyledSummaryItemActions,\n StyledVisual,\n tryCatch,\n readableHue,\n nlpColors\n} from '@pega/cosmos-react-core';\n\nimport { EmailEntityProps, StyledContextMenuFieldSelectorProps } from './Email.types';\n\nexport const StyledEmailMoreInfoButton = styled.button`\n min-height: 0.5rem;\n min-width: 0.5rem;\n flex-shrink: 0;\n`;\n\nexport const StyledEmailHeader = styled.div(({ theme }) => {\n return css`\n grid-column-gap: ${theme.base.spacing};\n border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};\n padding: 0 0 calc(2 * ${theme.base.spacing}) calc(2 * ${theme.base.spacing});\n ${StyledVisual},${StyledSummaryItemActions} {\n align-self: flex-start;\n }\n ${StyledSecondary} {\n margin-top: calc(0.5 * ${theme.base.spacing});\n }\n `;\n});\n\nStyledEmailHeader.defaultProps = defaultThemeProp;\n\nexport const StyledSuggestedRepliesButton = styled(Button)(({ theme }) => {\n return css`\n & + & {\n margin-inline-start: 0;\n }\n margin-block-start: ${theme.base.spacing};\n :not(:last-child) {\n margin-inline-end: ${theme.base.spacing};\n }\n `;\n});\n\nStyledSuggestedRepliesButton.defaultProps = defaultThemeProp;\n\nexport const StyledSuggestedRepliesMenuButton = styled(MenuButton)(({ theme }) => {\n return css`\n &&& {\n margin-inline-start: 0;\n }\n margin-block-start: ${theme.base.spacing};\n :not(:last-child) {\n margin-inline-end: ${theme.base.spacing};\n }\n `;\n});\n\nStyledSuggestedRepliesMenuButton.defaultProps = defaultThemeProp;\n\nexport const StyledEmailBody = styled.div``;\n\nexport const StyledFromEmailDisplay = styled(EmailDisplay)(({ theme }) => {\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n return css`\n font-weight: ${theme.base['font-weight']['semi-bold']};\n font-size: ${fontSize.m};\n `;\n});\n\nStyledFromEmailDisplay.defaultProps = defaultThemeProp;\n\nexport const StyledEmailDisplay = styled.span`\n font-size: inherit;\n`;\n\nexport const StyledEmailPrimaryFieldValueList = styled(FieldValueList)`\n grid-template-columns: auto 1fr;\n`;\n\nexport const StyledEmailSecondaryFieldValueList = styled(FieldValueList)(({ theme }) => {\n return css`\n grid-template-columns: 1fr;\n gap: 0;\n padding: ${theme.base.spacing} 0;\n ${StyledFieldValue}:not(:last-child) {\n margin-bottom: calc(2 * ${theme.base.spacing});\n }\n ${StyledFieldName} {\n margin-bottom: calc(0.25 * ${theme.base.spacing});\n }\n `;\n});\n\nStyledEmailSecondaryFieldValueList.defaultProps = defaultThemeProp;\n\nexport const StyledEmailMoreInfoPopover = styled.div`\n max-width: 30rem;\n`;\n\nexport const StyledSecondarySeparator = styled.div(({ theme }) => {\n return css`\n margin: 0 calc(${theme.base.spacing} / 2);\n `;\n});\n\nexport const StyledEmail = styled.div``;\n\nexport const StyledEmailEntity = styled.mark<EmailEntityProps>(({ entity, theme }) => {\n const variant = entity.variant;\n const backgroundColor = readableHue(\n nlpColors[variant % nlpColors.length],\n theme.base.palette['primary-background']\n );\n const textColor = tryCatch(() => readableColor(backgroundColor));\n return css`\n border-radius: calc(${theme.base['border-radius']} / 3);\n padding: 0 calc(0.5 * ${theme.base.spacing});\n background-color: ${backgroundColor};\n color: ${textColor};\n display: inline-block;\n `;\n});\n\nStyledEmailEntity.defaultProps = defaultThemeProp;\n\nexport const StyledEntityList = styled(FieldValueList)(({ theme }) => {\n const textColor = tryCatch(() => readableColor(theme.base.palette['primary-background']));\n return css`\n ${StyledFieldName} {\n color: ${textColor};\n }\n ${StyledEmailEntity} {\n padding: calc(0.5 * ${theme.base.spacing});\n }\n `;\n});\n\nexport const StyledForwardedContentToggle = styled(Button)`\n align-self: flex-start;\n`;\n\nStyledEntityList.defaultProps = defaultThemeProp;\n\nexport const StyledLoadMore = styled.div(({ theme }) => {\n return css`\n margin: ${theme.base.spacing} 0;\n min-height: 2rem;\n min-width: 2rem;\n `;\n});\n\nStyledLoadMore.defaultProps = defaultThemeProp;\n\nexport const StyledContextMenuFieldSelector = styled.div<StyledContextMenuFieldSelectorProps>(\n ({ theme, selected }) => {\n const background = selected\n ? theme.base.colors.green.medium\n : theme.base.palette['primary-background'];\n const borderColor = selected\n ? theme.base.colors.green['extra-light']\n : theme.base.palette['primary-background'];\n return css`\n background-color: ${background};\n border: 0.0625rem solid ${borderColor};\n border-radius: 100%;\n display: inline-block;\n height: 0.625rem;\n width: 0.625rem;\n background-clip: content-box;\n padding: 0.0625rem;\n `;\n }\n);\n\nStyledContextMenuFieldSelector.defaultProps = defaultThemeProp;\n\nexport const StyledContextMenu = styled.div(({ theme }) => {\n const secondaryBackground = theme.base.palette['secondary-background'];\n\n return css`\n header {\n background-color: ${secondaryBackground};\n }\n `;\n});\nStyledContextMenu.defaultProps = defaultThemeProp;\n\nexport const StyledList = styled.div(() => {\n return css`\n position: sticky;\n top: inherit;\n `;\n});\n\nStyledList.defaultProps = defaultThemeProp;\n\nexport const StyledHeader = styled.header(() => {\n return css`\n position: sticky;\n top: var(--appshell-offset);\n height: 4rem;\n `;\n});\n\nexport const StyledGridContainer = styled.div<{\n showExpandedUtilities?: boolean;\n}>(({ theme, showExpandedUtilities }) => {\n return css`\n min-height: calc(100vh - var(--appshell-offset, 0rem));\n background-color: ${theme.base.palette['app-background']};\n top: calc(var(--appshell-offset) + var(--headerOffsetHeight));\n ${!showExpandedUtilities &&\n css`\n width: auto;\n `}\n\n ${StyledList} {\n height: calc(100vh - var(--appshell-offset) - var(--headerOffsetHeight));\n }\n `;\n});\n\nStyledGridContainer.defaultProps = defaultThemeProp;\n\nexport const StyledUtilitiesToggle = styled.button(({ theme }) => {\n return css`\n color: ${theme.base.palette['foreground-color']};\n align-self: flex-end;\n `;\n});\n\nStyledUtilitiesToggle.defaultProps = defaultThemeProp;\n\nexport const StyledExpandedUtilities = styled.div<{ showExpandedUtilities: boolean }>(\n ({ showExpandedUtilities }) => {\n return css`\n ${!showExpandedUtilities &&\n css`\n display: none;\n `}\n `;\n }\n);\n\nexport const StyledUtilities = styled.div<{ showExpandedUtilities: boolean }>(\n ({ showExpandedUtilities, theme }) => {\n return css`\n ${showExpandedUtilities &&\n css`\n width: 25rem;\n `}\n margin-inline-end: calc(2 * ${theme.base.spacing});\n `;\n }\n);\n\nStyledUtilities.defaultProps = defaultThemeProp;\n"]}
|
|
1
|
+
{"version":3,"file":"Email.styles.js","sourceRoot":"","sources":["../../../src/components/Email/Email.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EACL,MAAM,EACN,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,wBAAwB,EACxB,YAAY,EACZ,QAAQ,EACR,WAAW,EACX,SAAS,EACV,MAAM,yBAAyB,CAAC;AAIjC,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC,MAAM,CAAA;;;;CAIrD,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACxD,OAAO,GAAG,CAAA;uBACW,KAAK,CAAC,IAAI,CAAC,OAAO;qCACJ,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;4BAC1C,KAAK,CAAC,IAAI,CAAC,OAAO,cAAc,KA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,qBAAqB;QACxB,GAAG,CAAA;;KAEF;;MAEC,UAAU;;;GAGb,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,mBAAmB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEpD,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IAC/D,OAAO,GAAG,CAAA;aACC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC;;GAEhD,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,qBAAqB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEtD,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,GAAG,CAC/C,CAAC,EAAE,qBAAqB,EAAE,EAAE,EAAE;IAC5B,OAAO,GAAG,CAAA;QACN,CAAC,qBAAqB;QACxB,GAAG,CAAA;;OAEF;KACF,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CACvC,CAAC,EAAE,qBAAqB,EAAE,KAAK,EAAE,EAAE,EAAE;IACnC,OAAO,GAAG,CAAA;QACN,qBAAqB;QACvB,GAAG,CAAA;;OAEF;oCAC6B,KAAK,CAAC,IAAI,CAAC,OAAO;KACjD,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\nimport { readableColor } from 'polished';\n\nimport {\n Button,\n calculateFontSize,\n defaultThemeProp,\n EmailDisplay,\n FieldValueList,\n MenuButton,\n StyledFieldName,\n StyledFieldValue,\n StyledSecondary,\n StyledSummaryItemActions,\n StyledVisual,\n tryCatch,\n readableHue,\n nlpColors\n} from '@pega/cosmos-react-core';\n\nimport { EmailEntityProps, StyledContextMenuFieldSelectorProps } from './Email.types';\n\nexport const StyledEmailMoreInfoButton = styled.button`\n min-height: 0.5rem;\n min-width: 0.5rem;\n flex-shrink: 0;\n`;\n\nexport const StyledEmailHeader = styled.div(({ theme }) => {\n return css`\n grid-column-gap: ${theme.base.spacing};\n border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};\n padding: 0 0 calc(2 * ${theme.base.spacing}) calc(2 * ${theme.base.spacing});\n ${StyledVisual},${StyledSummaryItemActions} {\n align-self: flex-start;\n }\n ${StyledSecondary} {\n margin-top: calc(0.5 * ${theme.base.spacing});\n }\n `;\n});\n\nStyledEmailHeader.defaultProps = defaultThemeProp;\n\nexport const StyledSuggestedRepliesButton = styled(Button)(({ theme }) => {\n return css`\n & + & {\n margin-inline-start: 0;\n }\n margin-block-start: ${theme.base.spacing};\n :not(:last-child) {\n margin-inline-end: ${theme.base.spacing};\n }\n `;\n});\n\nStyledSuggestedRepliesButton.defaultProps = defaultThemeProp;\n\nexport const StyledSuggestedRepliesMenuButton = styled(MenuButton)(({ theme }) => {\n return css`\n &&& {\n margin-inline-start: 0;\n }\n margin-block-start: ${theme.base.spacing};\n :not(:last-child) {\n margin-inline-end: ${theme.base.spacing};\n }\n `;\n});\n\nStyledSuggestedRepliesMenuButton.defaultProps = defaultThemeProp;\n\nexport const StyledEmailBody = styled.div``;\n\nexport const StyledFromEmailDisplay = styled(EmailDisplay)(({ theme }) => {\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n return css`\n font-weight: ${theme.base['font-weight']['semi-bold']};\n font-size: ${fontSize.m};\n `;\n});\n\nStyledFromEmailDisplay.defaultProps = defaultThemeProp;\n\nexport const StyledEmailDisplay = styled.span`\n font-size: inherit;\n`;\n\nexport const StyledEmailPrimaryFieldValueList = styled(FieldValueList)`\n grid-template-columns: auto 1fr;\n`;\n\nexport const StyledEmailSecondaryFieldValueList = styled(FieldValueList)(({ theme }) => {\n return css`\n grid-template-columns: 1fr;\n gap: 0;\n padding: ${theme.base.spacing} 0;\n ${StyledFieldValue}:not(:last-child) {\n margin-bottom: calc(2 * ${theme.base.spacing});\n }\n ${StyledFieldName} {\n margin-bottom: calc(0.25 * ${theme.base.spacing});\n }\n `;\n});\n\nStyledEmailSecondaryFieldValueList.defaultProps = defaultThemeProp;\n\nexport const StyledEmailMoreInfoPopover = styled.div`\n max-width: 30rem;\n`;\n\nexport const StyledSecondarySeparator = styled.div(({ theme }) => {\n return css`\n margin: 0 calc(${theme.base.spacing} / 2);\n `;\n});\n\nexport const StyledEmail = styled.div``;\n\nexport const StyledEmailEntity = styled.mark<EmailEntityProps>(({ entity, theme }) => {\n const variant = entity.variant;\n const backgroundColor = readableHue(\n nlpColors[variant % nlpColors.length],\n theme.base.palette['primary-background']\n );\n const textColor = tryCatch(() => readableColor(backgroundColor));\n return css`\n border-radius: calc(${theme.base['border-radius']} / 3);\n padding: 0 calc(0.5 * ${theme.base.spacing});\n background-color: ${backgroundColor};\n color: ${textColor};\n display: inline-block;\n `;\n});\n\nStyledEmailEntity.defaultProps = defaultThemeProp;\n\nexport const StyledEntityList = styled(FieldValueList)(({ theme }) => {\n const textColor = tryCatch(() => readableColor(theme.base.palette['primary-background']));\n return css`\n ${StyledFieldName} {\n color: ${textColor};\n }\n ${StyledEmailEntity} {\n padding: calc(0.5 * ${theme.base.spacing});\n }\n `;\n});\n\nexport const StyledForwardedContentToggle = styled(Button)`\n align-self: flex-start;\n`;\n\nStyledEntityList.defaultProps = defaultThemeProp;\n\nexport const StyledLoadMore = styled.div(({ theme }) => {\n return css`\n margin: ${theme.base.spacing} 0;\n min-height: 2rem;\n min-width: 2rem;\n `;\n});\n\nStyledLoadMore.defaultProps = defaultThemeProp;\n\nexport const StyledContextMenuFieldSelector = styled.div<StyledContextMenuFieldSelectorProps>(\n ({ theme, selected }) => {\n const background = selected\n ? theme.base.colors.green.medium\n : theme.base.palette['primary-background'];\n const borderColor = selected\n ? theme.base.colors.green['extra-light']\n : theme.base.palette['primary-background'];\n return css`\n background-color: ${background};\n border: 0.0625rem solid ${borderColor};\n border-radius: 100%;\n display: inline-block;\n height: 0.625rem;\n width: 0.625rem;\n background-clip: content-box;\n padding: 0.0625rem;\n `;\n }\n);\n\nStyledContextMenuFieldSelector.defaultProps = defaultThemeProp;\n\nexport const StyledContextMenu = styled.div(({ theme }) => {\n return css`\n header {\n background-color: ${theme.base.palette['secondary-background']};\n }\n `;\n});\nStyledContextMenu.defaultProps = defaultThemeProp;\n\nexport const StyledList = styled.div(() => {\n return css`\n position: sticky;\n top: inherit;\n `;\n});\n\nStyledList.defaultProps = defaultThemeProp;\n\nexport const StyledHeader = styled.header(() => {\n return css`\n position: sticky;\n top: var(--appshell-offset);\n height: 4rem;\n `;\n});\n\nexport const StyledGridContainer = styled.div<{\n showExpandedUtilities?: boolean;\n}>(({ theme, showExpandedUtilities }) => {\n return css`\n min-height: calc(100vh - var(--appshell-offset, 0rem));\n background-color: ${theme.base.palette['app-background']};\n top: calc(var(--appshell-offset) + var(--headerOffsetHeight));\n ${!showExpandedUtilities &&\n css`\n width: auto;\n `}\n\n ${StyledList} {\n height: calc(100vh - var(--appshell-offset) - var(--headerOffsetHeight));\n }\n `;\n});\n\nStyledGridContainer.defaultProps = defaultThemeProp;\n\nexport const StyledUtilitiesToggle = styled.button(({ theme }) => {\n return css`\n color: ${theme.base.palette['foreground-color']};\n align-self: flex-end;\n `;\n});\n\nStyledUtilitiesToggle.defaultProps = defaultThemeProp;\n\nexport const StyledExpandedUtilities = styled.div<{ showExpandedUtilities: boolean }>(\n ({ showExpandedUtilities }) => {\n return css`\n ${!showExpandedUtilities &&\n css`\n display: none;\n `}\n `;\n }\n);\n\nexport const StyledUtilities = styled.div<{ showExpandedUtilities: boolean }>(\n ({ showExpandedUtilities, theme }) => {\n return css`\n ${showExpandedUtilities &&\n css`\n width: 25rem;\n `}\n margin-inline-end: calc(2 * ${theme.base.spacing});\n `;\n }\n);\n\nStyledUtilities.defaultProps = defaultThemeProp;\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ReactNode, Ref } from 'react';
|
|
2
|
-
import { BaseProps, AvatarProps, SentimentProps, FileDisplayProps, FileUploadItemProps, OmitStrict, MenuProps, MenuItemProps, TooltipProps, NoChildrenProp, EmptyStateProps, ProgressProps, PageTemplateProps } from '@pega/cosmos-react-core';
|
|
1
|
+
import { ReactNode, Ref, MouseEvent } from 'react';
|
|
2
|
+
import { BaseProps, AvatarProps, SentimentProps, FileDisplayProps, FileUploadItemProps, OmitStrict, MenuProps, MenuItemProps, TooltipProps, NoChildrenProp, EmptyStateProps, ProgressProps, PageTemplateProps, PopoverProps } from '@pega/cosmos-react-core';
|
|
3
3
|
import { RichTextEditorProps } from '@pega/cosmos-react-rte';
|
|
4
4
|
import { UtilitiesSummaryProps } from '@pega/cosmos-react-work/lib/components/CaseView/UtilitiesSummary';
|
|
5
5
|
export interface EmailTemplate {
|
|
@@ -26,13 +26,19 @@ export interface EntityHighlightMapping {
|
|
|
26
26
|
description?: TooltipProps['children'];
|
|
27
27
|
icon?: string;
|
|
28
28
|
}
|
|
29
|
-
export interface ContextMenuProps extends
|
|
29
|
+
export interface ContextMenuProps extends Pick<MenuProps, 'loading'> {
|
|
30
|
+
/** Callback triggered when a menu item is clicked */
|
|
30
31
|
onItemClick: (selectedValue: {
|
|
31
32
|
fieldName: string;
|
|
32
33
|
fieldValue: string;
|
|
33
34
|
}) => void;
|
|
34
|
-
|
|
35
|
+
/** Menu items */
|
|
35
36
|
items: MenuItemProps[];
|
|
37
|
+
/** Imperative handle */
|
|
38
|
+
handle: Ref<ContextMenuHandleValue>;
|
|
39
|
+
}
|
|
40
|
+
export interface ContextMenuHandleValue {
|
|
41
|
+
setContextMenuItems: (contextMenuItems: ContextMenuProps['items']) => void;
|
|
36
42
|
}
|
|
37
43
|
export interface EmailProps extends BaseProps, NoChildrenProp {
|
|
38
44
|
/** Ref to the element */
|
|
@@ -80,8 +86,14 @@ export interface EmailProps extends BaseProps, NoChildrenProp {
|
|
|
80
86
|
unRead?: boolean;
|
|
81
87
|
/** Attachments list */
|
|
82
88
|
attachments?: FileDisplayProps[];
|
|
83
|
-
/**
|
|
84
|
-
|
|
89
|
+
/**
|
|
90
|
+
* Context menu props. Context menu is disabled if it is not provided.
|
|
91
|
+
* To set the context menu items, use the setContextMenuItems method provided on handle
|
|
92
|
+
*/
|
|
93
|
+
contextMenu?: OmitStrict<ContextMenuProps, 'items' | 'loading'> & {
|
|
94
|
+
/** Callback on right click of content */
|
|
95
|
+
onContextMenu: (id: EmailProps['id'], e: MouseEvent) => void;
|
|
96
|
+
};
|
|
85
97
|
}
|
|
86
98
|
export interface EmailConversationProps extends BaseProps {
|
|
87
99
|
/** ref to the element */
|
|
@@ -275,6 +287,8 @@ export interface TargetProps {
|
|
|
275
287
|
}
|
|
276
288
|
export interface ContextMenuPopoverProps extends BaseProps, TargetProps {
|
|
277
289
|
contextMenu: ContextMenuProps;
|
|
290
|
+
show: PopoverProps['show'];
|
|
291
|
+
ref?: PopoverProps['ref'];
|
|
278
292
|
}
|
|
279
293
|
export interface EntityListProps extends BaseProps {
|
|
280
294
|
content: {
|
|
@@ -289,7 +303,13 @@ export interface EntityListProps extends BaseProps {
|
|
|
289
303
|
text: string;
|
|
290
304
|
};
|
|
291
305
|
ref?: Ref<HTMLDivElement>;
|
|
292
|
-
|
|
306
|
+
/**
|
|
307
|
+
* Context menu props. Context menu is disabled if it is not provided.
|
|
308
|
+
* To set the context menu items, use the setContextMenuItems method provided on handle
|
|
309
|
+
*/
|
|
310
|
+
contextMenu?: OmitStrict<ContextMenuProps, 'items' | 'loading'> & {
|
|
311
|
+
onContextMenu: (e: MouseEvent) => void;
|
|
312
|
+
};
|
|
293
313
|
}
|
|
294
314
|
export interface EmailManagerProps extends BaseProps {
|
|
295
315
|
/** Ref placed on the root */
|