@pega/cosmos-react-social 3.0.0-dev.25.0 → 3.0.0-dev.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/Chat/Chat.types.d.ts +3 -3
- package/lib/components/Chat/Chat.types.d.ts.map +1 -1
- package/lib/components/Chat/Chat.types.js.map +1 -1
- package/lib/components/Chat/ChatComposer.d.ts.map +1 -1
- package/lib/components/Chat/ChatComposer.js +9 -15
- package/lib/components/Chat/ChatComposer.js.map +1 -1
- package/lib/components/Chat/ChatHeader.d.ts +3 -1
- package/lib/components/Chat/ChatHeader.d.ts.map +1 -1
- package/lib/components/Chat/ChatHeader.js +6 -5
- package/lib/components/Chat/ChatHeader.js.map +1 -1
- package/lib/components/Chat/Message.d.ts +1 -1
- package/lib/components/Chat/Message.d.ts.map +1 -1
- package/lib/components/Chat/Message.js +28 -30
- package/lib/components/Chat/Message.js.map +1 -1
- package/lib/components/Chat/Message.styles.d.ts +3 -1
- package/lib/components/Chat/Message.styles.d.ts.map +1 -1
- package/lib/components/Chat/Message.styles.js +37 -44
- 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 +23 -29
- package/lib/components/Email/Email.js.map +1 -1
- package/lib/components/Email/Email.styles.d.ts +3 -5
- package/lib/components/Email/Email.styles.d.ts.map +1 -1
- package/lib/components/Email/Email.styles.js +22 -11
- package/lib/components/Email/Email.styles.js.map +1 -1
- package/lib/components/Email/Email.types.d.ts +6 -2
- 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/EmailShell.d.ts.map +1 -1
- package/lib/components/Email/EmailShell.js +3 -0
- package/lib/components/Email/EmailShell.js.map +1 -1
- package/lib/components/Email/EntityList.d.ts.map +1 -1
- package/lib/components/Email/EntityList.js +11 -17
- package/lib/components/Email/EntityList.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,45 +1,47 @@
|
|
|
1
1
|
import styled, { css } from 'styled-components';
|
|
2
2
|
import { rgba } from 'polished';
|
|
3
|
-
import { defaultThemeProp, tryCatch } from '@pega/cosmos-react-core';
|
|
3
|
+
import { defaultThemeProp, tryCatch, Icon, StyledText, calculateFontSize } 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 ``;
|
|
6
6
|
export const StyledMediaList = styled.ul ``;
|
|
7
7
|
export const StyledMediaListItem = styled.li ``;
|
|
8
8
|
export const StyledSummaryItem = styled.div ``;
|
|
9
9
|
export const StyledMediaThumbNail = styled.img ``;
|
|
10
|
-
export const StyledMediaDownloadButton = styled.button ``;
|
|
11
10
|
export const StyledMediaLink = styled.a ``;
|
|
12
11
|
export const StyledMediaButton = styled(BareButton) ``;
|
|
13
12
|
export const StyledMessageMain = styled.div ``;
|
|
14
13
|
export const StyledMessageBubble = styled.div ``;
|
|
15
14
|
export const StyledMetaInfoContainer = styled.div ``;
|
|
16
15
|
export const StyledMetaInfo = styled.span ``;
|
|
16
|
+
export const StyledStatusInfo = styled.span ``;
|
|
17
17
|
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, hasMessage, typing, theme, theme: { base: { palette: { 'foreground-color': foregroundColor, 'secondary-background': secondaryBackground }, transparency: { 'transparent-2': foregroundAlpha } }
|
|
21
|
+
export const StyledMessageContainer = styled.div(({ messageDirection, variant, hasMessage, typing, status, theme, theme: { base: { 'font-size': fontSize, 'font-scale': fontScale, 'border-radius': borderRadius, spacing, palette: { 'foreground-color': foregroundColor, 'secondary-background': secondaryBackground, urgent }, transparency: { 'transparent-2': foregroundAlpha } } } }) => {
|
|
22
22
|
const messageHeaderTheme = theme.components.chat.messageBubble[variant].header;
|
|
23
23
|
const messageContentTheme = theme.components.chat.messageBubble[variant].content;
|
|
24
|
-
const padding = messageDirection === 'in' ? '0 2rem 0 0' : '0 0 0 2rem';
|
|
25
24
|
const metaForegroundColor = tryCatch(() => rgba(foregroundColor, foregroundAlpha));
|
|
25
|
+
const statusForegroundColor = status === 'undelivered' ? urgent : metaForegroundColor;
|
|
26
|
+
const fontSizes = calculateFontSize(fontSize, fontScale);
|
|
26
27
|
return css `
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
${messageDirection === 'out' &&
|
|
29
|
+
css `
|
|
30
|
+
padding-inline-start: calc(4 * ${spacing});
|
|
31
|
+
`}
|
|
32
|
+
margin-block-end: ${typing ? spacing : '0'};
|
|
29
33
|
${StyledMessageMain} {
|
|
30
34
|
max-width: 90%;
|
|
31
35
|
}
|
|
32
36
|
${StyledMessageBubble} {
|
|
33
|
-
max-width: 100%;
|
|
34
|
-
min-width: 100%;
|
|
35
37
|
background: ${messageContentTheme['background-color']};
|
|
36
|
-
border-radius: calc(3 * ${
|
|
37
|
-
calc(3 * ${
|
|
38
|
+
border-radius: calc(3 * ${borderRadius}) ${borderRadius} calc(3 * ${borderRadius})
|
|
39
|
+
calc(3 * ${borderRadius});
|
|
38
40
|
overflow: hidden;
|
|
39
41
|
color: ${messageContentTheme['foreground-color']};
|
|
40
42
|
display: inline-block;
|
|
41
43
|
width: auto;
|
|
42
|
-
margin-
|
|
44
|
+
margin-block-end: calc(0.5 * ${spacing});
|
|
43
45
|
|
|
44
46
|
label {
|
|
45
47
|
color: inherit;
|
|
@@ -47,12 +49,12 @@ export const StyledMessageContainer = styled.div(({ messageDirection, variant, h
|
|
|
47
49
|
|
|
48
50
|
${messageDirection === 'in' &&
|
|
49
51
|
css `
|
|
50
|
-
border-radius: ${
|
|
51
|
-
|
|
52
|
+
border-radius: ${borderRadius} calc(3 * ${borderRadius}) calc(3 * ${borderRadius});
|
|
53
|
+
padding-inline-end: calc(4 * ${spacing});
|
|
52
54
|
`}
|
|
53
55
|
|
|
54
56
|
> ${StyledMessageBubbleContent} {
|
|
55
|
-
padding:
|
|
57
|
+
padding: ${spacing} calc(2 * ${spacing});
|
|
56
58
|
word-break: break-word;
|
|
57
59
|
white-space: pre-wrap;
|
|
58
60
|
position: relative;
|
|
@@ -62,27 +64,6 @@ export const StyledMessageContainer = styled.div(({ messageDirection, variant, h
|
|
|
62
64
|
color: ${messageContentTheme['foreground-color']};
|
|
63
65
|
max-width: 100%;
|
|
64
66
|
|
|
65
|
-
${StyledMediaDownloadButton} {
|
|
66
|
-
display: inline-flex;
|
|
67
|
-
justify-content: center;
|
|
68
|
-
align-items: center;
|
|
69
|
-
color: ${messageContentTheme['foreground-color']};
|
|
70
|
-
width: ${button.height};
|
|
71
|
-
height: ${button.height};
|
|
72
|
-
border: 0.0625rem solid transparent;
|
|
73
|
-
&:enabled:hover,
|
|
74
|
-
&:enabled:focus {
|
|
75
|
-
background: ${messageContentTheme['background-color']};
|
|
76
|
-
color: ${messageContentTheme['foreground-color']};
|
|
77
|
-
border: 0.0625rem solid ${messageContentTheme['foreground-color']};
|
|
78
|
-
border-radius: 50%;
|
|
79
|
-
}
|
|
80
|
-
svg {
|
|
81
|
-
width: 50%;
|
|
82
|
-
height: 50%;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
67
|
> ${StyledMediaListItem} {
|
|
87
68
|
position: relative;
|
|
88
69
|
${StyledMediaThumbNail} {
|
|
@@ -92,13 +73,13 @@ export const StyledMessageContainer = styled.div(({ messageDirection, variant, h
|
|
|
92
73
|
background-color: ${secondaryBackground};
|
|
93
74
|
}
|
|
94
75
|
${StyledSummaryItem} {
|
|
95
|
-
padding:
|
|
96
|
-
font-size:
|
|
97
|
-
margin-
|
|
76
|
+
padding: ${spacing} calc(3 * ${spacing});
|
|
77
|
+
font-size: ${fontSizes.xxs};
|
|
78
|
+
margin-block-start: calc(0.5 * ${spacing});
|
|
98
79
|
}
|
|
99
80
|
${StyledSummaryItem}::before {
|
|
100
81
|
content: '';
|
|
101
|
-
padding:
|
|
82
|
+
padding: ${spacing} 0;
|
|
102
83
|
border-top: 0.0625rem solid ${messageContentTheme['foreground-color']};
|
|
103
84
|
position: absolute;
|
|
104
85
|
width: calc(100% - 2rem);
|
|
@@ -111,6 +92,9 @@ export const StyledMessageContainer = styled.div(({ messageDirection, variant, h
|
|
|
111
92
|
svg {
|
|
112
93
|
font-size: 1.6rem;
|
|
113
94
|
}
|
|
95
|
+
${StyledText} {
|
|
96
|
+
color: ${foregroundColor};
|
|
97
|
+
}
|
|
114
98
|
}
|
|
115
99
|
|
|
116
100
|
${!hasMessage &&
|
|
@@ -124,14 +108,14 @@ export const StyledMessageContainer = styled.div(({ messageDirection, variant, h
|
|
|
124
108
|
}
|
|
125
109
|
|
|
126
110
|
${StyledMessageHeader} {
|
|
127
|
-
padding:
|
|
111
|
+
padding: ${spacing} calc(2 * ${spacing});
|
|
128
112
|
color: ${messageHeaderTheme['foreground-color']};
|
|
129
113
|
background-color: ${messageHeaderTheme['background-color']};
|
|
130
114
|
}
|
|
131
115
|
|
|
132
116
|
${StyledMessageHeaderContent} {
|
|
133
117
|
color: ${messageHeaderTheme['foreground-color']};
|
|
134
|
-
margin-inline-end: ${
|
|
118
|
+
margin-inline-end: ${spacing};
|
|
135
119
|
}
|
|
136
120
|
${StyledMessageHeaderMeta} {
|
|
137
121
|
> a {
|
|
@@ -165,12 +149,15 @@ export const StyledMessageContainer = styled.div(({ messageDirection, variant, h
|
|
|
165
149
|
|
|
166
150
|
${StyledMetaInfoContainer} {
|
|
167
151
|
width: 100%;
|
|
168
|
-
padding: 0
|
|
169
|
-
${StyledMetaInfo} {
|
|
170
|
-
margin-
|
|
152
|
+
padding: 0 ${spacing};
|
|
153
|
+
${StyledMetaInfo}, ${StyledStatusInfo} {
|
|
154
|
+
margin-block-end: ${spacing};
|
|
171
155
|
font-size: 0.7rem;
|
|
172
156
|
color: ${metaForegroundColor};
|
|
173
157
|
}
|
|
158
|
+
${StyledStatusInfo} {
|
|
159
|
+
color: ${statusForegroundColor};
|
|
160
|
+
}
|
|
174
161
|
}
|
|
175
162
|
${StyledTypingIndicator} {
|
|
176
163
|
width: 4.5rem;
|
|
@@ -199,4 +186,10 @@ export const StyledBlinkingDot = styled.div(({ delay = 0, theme }) => {
|
|
|
199
186
|
`;
|
|
200
187
|
});
|
|
201
188
|
StyledBlinkingDot.defaultProps = defaultThemeProp;
|
|
189
|
+
export const StyledUndeliveredIcon = styled(Icon)(({ theme: { base: { palette: { urgent } } } }) => {
|
|
190
|
+
return css `
|
|
191
|
+
color: ${urgent};
|
|
192
|
+
`;
|
|
193
|
+
});
|
|
194
|
+
StyledUndeliveredIcon.defaultProps = defaultThemeProp;
|
|
202
195
|
//# sourceMappingURL=Message.styles.js.map
|
|
@@ -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,CAA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AI,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
|
+
{"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,EACL,gBAAgB,EAChB,QAAQ,EACR,IAAI,EACJ,UAAU,EACV,iBAAiB,EAClB,MAAM,yBAAyB,CAAC;AACjC,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,eAAe,GAAG,MAAM,CAAC,CAAC,CAAA,EAAE,CAAC;AAE1C,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,UAAU,CAAC,CAAA,EAAE,CAAC;AAEtD,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAA,EAAE,CAAC;AAE9C,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAA,EAAE,CAAC;AAEhD,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,GAAG,CAAA,EAAE,CAAC;AAEpD,MAAM,CAAC,MAAM,cAA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 'styled-components';\nimport { rgba } from 'polished';\n\nimport {\n defaultThemeProp,\n tryCatch,\n Icon,\n StyledText,\n calculateFontSize\n} 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 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 StyledStatusInfo = 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 status: string;\n}\n\nexport const StyledMessageContainer = styled.div<StyledMessageContainerProps>(\n ({\n messageDirection,\n variant,\n hasMessage,\n typing,\n status,\n theme,\n theme: {\n base: {\n 'font-size': fontSize,\n 'font-scale': fontScale,\n 'border-radius': borderRadius,\n spacing,\n palette: {\n 'foreground-color': foregroundColor,\n 'secondary-background': secondaryBackground,\n urgent\n },\n transparency: { 'transparent-2': foregroundAlpha }\n }\n }\n }) => {\n const messageHeaderTheme = theme.components.chat.messageBubble[variant].header;\n const messageContentTheme = theme.components.chat.messageBubble[variant].content;\n const metaForegroundColor = tryCatch(() => rgba(foregroundColor, foregroundAlpha));\n const statusForegroundColor = status === 'undelivered' ? urgent : metaForegroundColor;\n const fontSizes = calculateFontSize(fontSize, fontScale);\n return css`\n ${messageDirection === 'out' &&\n css`\n padding-inline-start: calc(4 * ${spacing});\n `}\n margin-block-end: ${typing ? spacing : '0'};\n ${StyledMessageMain} {\n max-width: 90%;\n }\n ${StyledMessageBubble} {\n background: ${messageContentTheme['background-color']};\n border-radius: calc(3 * ${borderRadius}) ${borderRadius} calc(3 * ${borderRadius})\n calc(3 * ${borderRadius});\n overflow: hidden;\n color: ${messageContentTheme['foreground-color']};\n display: inline-block;\n width: auto;\n margin-block-end: calc(0.5 * ${spacing});\n\n label {\n color: inherit;\n }\n\n ${messageDirection === 'in' &&\n css`\n border-radius: ${borderRadius} calc(3 * ${borderRadius}) calc(3 * ${borderRadius});\n padding-inline-end: calc(4 * ${spacing});\n `}\n\n > ${StyledMessageBubbleContent} {\n padding: ${spacing} calc(2 * ${spacing});\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 > ${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: ${spacing} calc(3 * ${spacing});\n font-size: ${fontSizes.xxs};\n margin-block-start: calc(0.5 * ${spacing});\n }\n ${StyledSummaryItem}::before {\n content: '';\n padding: ${spacing} 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 ${StyledText} {\n color: ${foregroundColor};\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: ${spacing} calc(2 * ${spacing});\n color: ${messageHeaderTheme['foreground-color']};\n background-color: ${messageHeaderTheme['background-color']};\n }\n\n ${StyledMessageHeaderContent} {\n color: ${messageHeaderTheme['foreground-color']};\n margin-inline-end: ${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 ${spacing};\n ${StyledMetaInfo}, ${StyledStatusInfo} {\n margin-block-end: ${spacing};\n font-size: 0.7rem;\n color: ${metaForegroundColor};\n }\n ${StyledStatusInfo} {\n color: ${statusForegroundColor};\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\nexport const StyledUndeliveredIcon = styled(Icon)(\n ({\n theme: {\n base: {\n palette: { urgent }\n }\n }\n }) => {\n return css`\n color: ${urgent};\n `;\n }\n);\n\nStyledUndeliveredIcon.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,CAkdvD,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, useScrollToggle, Status } 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, useScrollToggle, Status, Banner } 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, status, ...restProps } = props;
|
|
15
|
+
const { id, from, to = [], cc = [], bcc = [], actions = [], timeStamp, sentiment, subject, forwardedContent, attachments = [], suggestions = [], entityHighlightMapping = [], onReply, onForward, onReplyAll, onSuggestionClick, contextMenu, status, banner, ...restProps } = props;
|
|
16
16
|
let { body } = props;
|
|
17
17
|
const t = useI18n();
|
|
18
18
|
const [emailMoreInfoBtnRef, setEmailMoreInfoBtnRef] = useElement(null);
|
|
@@ -23,10 +23,18 @@ const Email = forwardRef((props, ref) => {
|
|
|
23
23
|
// Only way to set this is through imperative handle
|
|
24
24
|
const [contextMenuItems, setContextMenuItems] = useState([]);
|
|
25
25
|
const [contextMenuLoading, setContextMenuLoading] = useState(false);
|
|
26
|
+
const [contextMenuPopoverOpen, setContextMenuPopoverOpen] = useState(false);
|
|
27
|
+
const { disableScroll, enableScroll } = useScrollToggle();
|
|
28
|
+
const [contextMenuPopoverEl, setContextMenuPopoverEl] = useElement();
|
|
26
29
|
useImperativeHandle(contextMenu?.handle, () => ({
|
|
27
|
-
|
|
30
|
+
setItems: (ctxMenuItems) => {
|
|
28
31
|
setContextMenuItems(ctxMenuItems || []);
|
|
29
|
-
|
|
32
|
+
},
|
|
33
|
+
setLoading(loading) {
|
|
34
|
+
setContextMenuLoading(loading);
|
|
35
|
+
},
|
|
36
|
+
setOpen(visible) {
|
|
37
|
+
setContextMenuPopoverOpen(visible);
|
|
30
38
|
}
|
|
31
39
|
}));
|
|
32
40
|
const headerRef = useRef(null);
|
|
@@ -35,27 +43,14 @@ const Email = forwardRef((props, ref) => {
|
|
|
35
43
|
themeProp: 'content-width'
|
|
36
44
|
});
|
|
37
45
|
const { locale } = useConfiguration();
|
|
38
|
-
const [currentTarget, setCurrentTarget] = useState(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
y: 0
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
const [popoverOpen, setPopoverOpen] = useState(false);
|
|
46
|
-
const { disableScroll, enableScroll } = useScrollToggle();
|
|
47
|
-
const [popoverEl, setPopoverEl] = useElement();
|
|
48
|
-
useOuterEvent('mousedown', [popoverEl], () => {
|
|
49
|
-
if (popoverOpen)
|
|
50
|
-
setPopoverOpen(false);
|
|
46
|
+
const [currentTarget, setCurrentTarget] = useState();
|
|
47
|
+
useOuterEvent('mousedown', [contextMenuPopoverEl], () => {
|
|
48
|
+
if (contextMenuPopoverOpen)
|
|
49
|
+
setContextMenuPopoverOpen(false);
|
|
51
50
|
});
|
|
52
51
|
// Handler for right click on email body
|
|
53
52
|
const onContextMenu = (e) => {
|
|
54
|
-
e.preventDefault();
|
|
55
53
|
if (e.target instanceof HTMLElement && e.target.textContent?.trim()) {
|
|
56
|
-
setContextMenuItems([]);
|
|
57
|
-
setContextMenuLoading(true);
|
|
58
|
-
setPopoverOpen(true);
|
|
59
54
|
setCurrentTarget({
|
|
60
55
|
targetNode: e.target,
|
|
61
56
|
cursorPosition: {
|
|
@@ -63,11 +58,11 @@ const Email = forwardRef((props, ref) => {
|
|
|
63
58
|
y: e.pageY - window.scrollY
|
|
64
59
|
}
|
|
65
60
|
});
|
|
66
|
-
contextMenu?.onContextMenu(id, e);
|
|
67
61
|
}
|
|
62
|
+
contextMenu?.onContextMenu(id, e);
|
|
68
63
|
};
|
|
69
64
|
const onItemClick = (selectedValue) => {
|
|
70
|
-
|
|
65
|
+
setContextMenuPopoverOpen(false);
|
|
71
66
|
contextMenu?.onItemClick(selectedValue);
|
|
72
67
|
};
|
|
73
68
|
if (from) {
|
|
@@ -155,15 +150,14 @@ const Email = forwardRef((props, ref) => {
|
|
|
155
150
|
if (subject) {
|
|
156
151
|
body = `<div>${t('subject')}: ${subject}</div><br>${body}`;
|
|
157
152
|
}
|
|
158
|
-
const { cursorPosition, targetNode } = currentTarget;
|
|
159
153
|
renderedBody = (_jsxs(_Fragment, { children: [_jsx(RichTextViewer, { content: body, type: 'html', interactionRenderers: entityConfigs, "aria-label": t('unique_entities', [entityConfigs.length], {
|
|
160
154
|
count: entityConfigs.length
|
|
161
|
-
}), role: 'group' }), contextMenu && (_jsx(ContextMenuPopover, { cursorPosition: cursorPosition, contextMenu: {
|
|
155
|
+
}), role: 'group' }), contextMenu && currentTarget && (_jsx(ContextMenuPopover, { cursorPosition: currentTarget.cursorPosition, contextMenu: {
|
|
162
156
|
...contextMenu,
|
|
163
157
|
items: contextMenuItems,
|
|
164
158
|
loading: contextMenuLoading,
|
|
165
159
|
onItemClick
|
|
166
|
-
}, targetNode: targetNode, show:
|
|
160
|
+
}, targetNode: currentTarget.targetNode, show: contextMenuPopoverOpen, ref: setContextMenuPopoverEl }))] }));
|
|
167
161
|
}
|
|
168
162
|
const emailMetaListItems = [
|
|
169
163
|
_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 &&
|
|
@@ -171,11 +165,11 @@ const Email = forwardRef((props, ref) => {
|
|
|
171
165
|
_jsxs(Text, { variant: 'secondary', children: [`${new Intl.DateTimeFormat(locale, { weekday: 'short' }).format(new Date(timeStamp))}, `, _jsx(DateTimeDisplay, { variant: 'datetime', format: 'short', value: timeStamp })] })
|
|
172
166
|
];
|
|
173
167
|
useEffect(() => {
|
|
174
|
-
if (
|
|
168
|
+
if (contextMenuPopoverOpen)
|
|
175
169
|
disableScroll();
|
|
176
170
|
else
|
|
177
171
|
enableScroll();
|
|
178
|
-
}, [
|
|
172
|
+
}, [contextMenuPopoverOpen]);
|
|
179
173
|
return (_jsxs(Flex, { as: StyledEmail, container: {
|
|
180
174
|
direction: 'column',
|
|
181
175
|
gap: 1
|
|
@@ -195,7 +189,7 @@ const Email = forwardRef((props, ref) => {
|
|
|
195
189
|
gap: 1,
|
|
196
190
|
pad: 1,
|
|
197
191
|
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: {
|
|
192
|
+
}, children: [status && isSmallOrAbove && (_jsx(Status, { variant: status === 'draft' ? 'pending' : 'urgent', children: status === 'draft' ? t('draft', [], { count: 1 }) : t(status) })), actions] }) }), banner && _jsx(Banner, { variant: 'urgent', ...banner }), _jsxs(Flex, { container: {
|
|
199
193
|
direction: 'column',
|
|
200
194
|
gap: 2,
|
|
201
195
|
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,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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AAC;wCACN,UAAU,EAAE,QAAQ;qCACrB,aAED,KAAC,IAAI,IAAC,IAAI,EAAC,OAAO,GAAG,EACrB,yBAAO,CAAC,CAAC,OAAO,CAAC,GAAQ,IACpB,GACA,CACV,EACA,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 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 = new RegExp(`\\\\b${entity.value}\\\\b`, 'ig');\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 {onReply && (\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 )}\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,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,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 useScrollToggle,\n Status,\n Banner\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 banner,\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 const [contextMenuPopoverOpen, setContextMenuPopoverOpen] = useState(false);\n const { disableScroll, enableScroll } = useScrollToggle();\n const [contextMenuPopoverEl, setContextMenuPopoverEl] = useElement<HTMLElement>();\n\n useImperativeHandle(contextMenu?.handle, () => ({\n setItems: (ctxMenuItems: ContextMenuProps['items']) => {\n setContextMenuItems(ctxMenuItems || []);\n },\n setLoading(loading) {\n setContextMenuLoading(loading);\n },\n setOpen(visible) {\n setContextMenuPopoverOpen(visible);\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 | undefined>();\n\n useOuterEvent('mousedown', [contextMenuPopoverEl], () => {\n if (contextMenuPopoverOpen) setContextMenuPopoverOpen(false);\n });\n\n // Handler for right click on email body\n const onContextMenu = (e: MouseEvent<HTMLDivElement>) => {\n if (e.target instanceof HTMLElement && e.target.textContent?.trim()) {\n setCurrentTarget({\n targetNode: e.target,\n cursorPosition: {\n x: e.pageX - window.scrollX,\n y: e.pageY - window.scrollY\n }\n });\n }\n contextMenu?.onContextMenu(id, e);\n };\n\n const onItemClick: ContextMenuProps['onItemClick'] = (selectedValue: {\n fieldName: string;\n fieldValue: string;\n }) => {\n setContextMenuPopoverOpen(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 = new RegExp(`\\\\b${entity.value}\\\\b`, 'ig');\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\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 && currentTarget && (\n <ContextMenuPopover\n cursorPosition={currentTarget.cursorPosition}\n contextMenu={{\n ...contextMenu,\n items: contextMenuItems,\n loading: contextMenuLoading,\n onItemClick\n }}\n targetNode={currentTarget.targetNode}\n show={contextMenuPopoverOpen}\n ref={setContextMenuPopoverEl}\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 (contextMenuPopoverOpen) disableScroll();\n else enableScroll();\n }, [contextMenuPopoverOpen]);\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 {banner && <Banner variant='urgent' {...banner} />}\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 {onReply && (\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 )}\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"]}
|
|
@@ -16,10 +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
|
-
|
|
20
|
-
selected?: boolean;
|
|
21
|
-
}
|
|
22
|
-
export declare const StyledContextMenuFieldSelector: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, StyledContextMenuFieldSelectorProps, never>;
|
|
19
|
+
export declare const StyledContextMenuFieldSelector: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
|
|
20
|
+
selected?: boolean | undefined;
|
|
21
|
+
}, never>;
|
|
23
22
|
export declare const StyledContextMenu: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
24
23
|
export declare const StyledList: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
25
24
|
export declare const StyledHeader: import("styled-components").StyledComponent<"header", import("styled-components").DefaultTheme, {}, never>;
|
|
@@ -33,5 +32,4 @@ export declare const StyledExpandedUtilities: import("styled-components").Styled
|
|
|
33
32
|
export declare const StyledUtilities: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
|
|
34
33
|
showExpandedUtilities: boolean;
|
|
35
34
|
}, never>;
|
|
36
|
-
export {};
|
|
37
35
|
//# sourceMappingURL=Email.styles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Email.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Email/Email.styles.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"Email.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Email/Email.styles.ts"],"names":[],"mappings":";AAqBA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,eAAO,MAAM,yBAAyB,4GAIrC,CAAC;AAEF,eAAO,MAAM,iBAAiB,yGAW5B,CAAC;AAIH,eAAO,MAAM,4BAA4B,qOAUvC,CAAC;AAIH,eAAO,MAAM,gCAAgC,yOAU3C,CAAC;AAIH,eAAO,MAAM,eAAe,yGAAe,CAAC;AAE5C,eAAO,MAAM,sBAAsB,2OAMjC,CAAC;AAIH,eAAO,MAAM,kBAAkB,0GAE9B,CAAC;AAEF,eAAO,MAAM,gCAAgC,6OAE5C,CAAC;AAEF,eAAO,MAAM,kCAAkC,6OAY7C,CAAC;AAIH,eAAO,MAAM,0BAA0B,yGAEtC,CAAC;AAEF,eAAO,MAAM,wBAAwB,yGAInC,CAAC;AAIH,eAAO,MAAM,WAAW,yGAStB,CAAC;AAIH,eAAO,MAAM,iBAAiB,wHAc5B,CAAC;AAIH,eAAO,MAAM,gBAAgB,6OAU3B,CAAC;AAIH,eAAO,MAAM,4BAA4B,qOAExC,CAAC;AAEF,eAAO,MAAM,cAAc,yGAMzB,CAAC;AAIH,eAAO,MAAM,8BAA8B;;SAmBzC,CAAC;AAIH,eAAO,MAAM,iBAAiB,yGAM5B,CAAC;AAIH,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;SAUjF,CAAC;AAEF,eAAO,MAAM,eAAe;2BAAuC,OAAO;SAUzE,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import styled, { css } from 'styled-components';
|
|
2
2
|
import { readableColor } from 'polished';
|
|
3
3
|
import { Button, calculateFontSize, defaultThemeProp, EmailDisplay, FieldValueList, MenuButton, StyledFieldName, StyledFieldValue, StyledSecondary, StyledSummaryItemActions, StyledVisual, tryCatch, readableHue, nlpColors } from '@pega/cosmos-react-core';
|
|
4
|
+
import { StyledBanner } from '@pega/cosmos-react-core/lib/components/Banner/Banner';
|
|
4
5
|
export const StyledEmailMoreInfoButton = styled.button `
|
|
5
6
|
min-height: 0.5rem;
|
|
6
7
|
min-width: 0.5rem;
|
|
@@ -80,7 +81,16 @@ export const StyledSecondarySeparator = styled.div(({ theme }) => {
|
|
|
80
81
|
margin: 0 calc(${theme.base.spacing} / 2);
|
|
81
82
|
`;
|
|
82
83
|
});
|
|
83
|
-
|
|
84
|
+
StyledSecondarySeparator.defaultProps = defaultThemeProp;
|
|
85
|
+
export const StyledEmail = styled.div(({ theme }) => {
|
|
86
|
+
const { base: { spacing } } = theme;
|
|
87
|
+
return css `
|
|
88
|
+
${StyledBanner} {
|
|
89
|
+
padding: 0 calc(2 * ${spacing}) calc(2 * ${spacing});
|
|
90
|
+
}
|
|
91
|
+
`;
|
|
92
|
+
});
|
|
93
|
+
StyledEmail.defaultProps = defaultThemeProp;
|
|
84
94
|
export const StyledEmailEntity = styled.mark(({ entity, theme }) => {
|
|
85
95
|
const variant = entity.variant;
|
|
86
96
|
const backgroundColor = readableHue(nlpColors[variant % nlpColors.length], theme.base.palette['primary-background']);
|
|
@@ -105,10 +115,10 @@ export const StyledEntityList = styled(FieldValueList)(({ theme }) => {
|
|
|
105
115
|
}
|
|
106
116
|
`;
|
|
107
117
|
});
|
|
118
|
+
StyledEntityList.defaultProps = defaultThemeProp;
|
|
108
119
|
export const StyledForwardedContentToggle = styled(Button) `
|
|
109
120
|
align-self: flex-start;
|
|
110
121
|
`;
|
|
111
|
-
StyledEntityList.defaultProps = defaultThemeProp;
|
|
112
122
|
export const StyledLoadMore = styled.div(({ theme }) => {
|
|
113
123
|
return css `
|
|
114
124
|
margin: ${theme.base.spacing} 0;
|
|
@@ -125,15 +135,15 @@ export const StyledContextMenuFieldSelector = styled.div(({ theme, selected }) =
|
|
|
125
135
|
? theme.base.colors.green['extra-light']
|
|
126
136
|
: theme.base.palette['primary-background'];
|
|
127
137
|
return css `
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
138
|
+
background-color: ${background};
|
|
139
|
+
border: 0.0625rem solid ${borderColor};
|
|
140
|
+
border-radius: 100%;
|
|
141
|
+
display: inline-block;
|
|
142
|
+
height: 0.625rem;
|
|
143
|
+
width: 0.625rem;
|
|
144
|
+
background-clip: content-box;
|
|
145
|
+
padding: 0.0625rem;
|
|
146
|
+
`;
|
|
137
147
|
});
|
|
138
148
|
StyledContextMenuFieldSelector.defaultProps = defaultThemeProp;
|
|
139
149
|
export const StyledContextMenu = styled.div(({ theme }) => {
|
|
@@ -183,6 +193,7 @@ export const StyledUtilitiesToggle = styled.button(({ theme }) => {
|
|
|
183
193
|
StyledUtilitiesToggle.defaultProps = defaultThemeProp;
|
|
184
194
|
export const StyledExpandedUtilities = styled.div(({ showExpandedUtilities }) => {
|
|
185
195
|
return css `
|
|
196
|
+
width: inherit;
|
|
186
197
|
${!showExpandedUtilities &&
|
|
187
198
|
css `
|
|
188
199
|
display: none;
|