@pega/cosmos-react-social 2.1.3 → 2.1.6

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.
Files changed (197) hide show
  1. package/package.json +4 -4
  2. package/lib/components/Chat/Chat.d.ts +0 -31
  3. package/lib/components/Chat/Chat.d.ts.map +0 -1
  4. package/lib/components/Chat/Chat.js +0 -67
  5. package/lib/components/Chat/Chat.js.map +0 -1
  6. package/lib/components/Chat/Chat.types.d.ts +0 -23
  7. package/lib/components/Chat/Chat.types.d.ts.map +0 -1
  8. package/lib/components/Chat/Chat.types.js +0 -2
  9. package/lib/components/Chat/Chat.types.js.map +0 -1
  10. package/lib/components/Chat/ChatBody.d.ts +0 -12
  11. package/lib/components/Chat/ChatBody.d.ts.map +0 -1
  12. package/lib/components/Chat/ChatBody.js +0 -18
  13. package/lib/components/Chat/ChatBody.js.map +0 -1
  14. package/lib/components/Chat/ChatComposer.d.ts +0 -51
  15. package/lib/components/Chat/ChatComposer.d.ts.map +0 -1
  16. package/lib/components/Chat/ChatComposer.js +0 -213
  17. package/lib/components/Chat/ChatComposer.js.map +0 -1
  18. package/lib/components/Chat/ChatHeader.d.ts +0 -15
  19. package/lib/components/Chat/ChatHeader.d.ts.map +0 -1
  20. package/lib/components/Chat/ChatHeader.js +0 -28
  21. package/lib/components/Chat/ChatHeader.js.map +0 -1
  22. package/lib/components/Chat/ChatTranscript.d.ts +0 -23
  23. package/lib/components/Chat/ChatTranscript.d.ts.map +0 -1
  24. package/lib/components/Chat/ChatTranscript.js +0 -45
  25. package/lib/components/Chat/ChatTranscript.js.map +0 -1
  26. package/lib/components/Chat/Message.d.ts +0 -46
  27. package/lib/components/Chat/Message.d.ts.map +0 -1
  28. package/lib/components/Chat/Message.js +0 -59
  29. package/lib/components/Chat/Message.js.map +0 -1
  30. package/lib/components/Chat/Message.styles.d.ts +0 -29
  31. package/lib/components/Chat/Message.styles.d.ts.map +0 -1
  32. package/lib/components/Chat/Message.styles.js +0 -193
  33. package/lib/components/Chat/Message.styles.js.map +0 -1
  34. package/lib/components/Chat/MessageList.d.ts +0 -35
  35. package/lib/components/Chat/MessageList.d.ts.map +0 -1
  36. package/lib/components/Chat/MessageList.js +0 -123
  37. package/lib/components/Chat/MessageList.js.map +0 -1
  38. package/lib/components/Chat/RepeatingView.d.ts +0 -31
  39. package/lib/components/Chat/RepeatingView.d.ts.map +0 -1
  40. package/lib/components/Chat/RepeatingView.js +0 -47
  41. package/lib/components/Chat/RepeatingView.js.map +0 -1
  42. package/lib/components/Chat/SuggestedReplyPicker.d.ts +0 -26
  43. package/lib/components/Chat/SuggestedReplyPicker.d.ts.map +0 -1
  44. package/lib/components/Chat/SuggestedReplyPicker.js +0 -78
  45. package/lib/components/Chat/SuggestedReplyPicker.js.map +0 -1
  46. package/lib/components/Chat/SystemMessage.d.ts +0 -19
  47. package/lib/components/Chat/SystemMessage.d.ts.map +0 -1
  48. package/lib/components/Chat/SystemMessage.js +0 -40
  49. package/lib/components/Chat/SystemMessage.js.map +0 -1
  50. package/lib/components/Chat/TranscriptMessage.d.ts +0 -25
  51. package/lib/components/Chat/TranscriptMessage.d.ts.map +0 -1
  52. package/lib/components/Chat/TranscriptMessage.js +0 -47
  53. package/lib/components/Chat/TranscriptMessage.js.map +0 -1
  54. package/lib/components/Chat/TypeIndicator.d.ts +0 -13
  55. package/lib/components/Chat/TypeIndicator.d.ts.map +0 -1
  56. package/lib/components/Chat/TypeIndicator.js +0 -9
  57. package/lib/components/Chat/TypeIndicator.js.map +0 -1
  58. package/lib/components/Chat/index.d.ts +0 -14
  59. package/lib/components/Chat/index.d.ts.map +0 -1
  60. package/lib/components/Chat/index.js +0 -13
  61. package/lib/components/Chat/index.js.map +0 -1
  62. package/lib/components/Email/Email.d.ts +0 -6
  63. package/lib/components/Email/Email.d.ts.map +0 -1
  64. package/lib/components/Email/Email.js +0 -153
  65. package/lib/components/Email/Email.js.map +0 -1
  66. package/lib/components/Email/Email.styles.d.ts +0 -18
  67. package/lib/components/Email/Email.styles.d.ts.map +0 -1
  68. package/lib/components/Email/Email.styles.js +0 -131
  69. package/lib/components/Email/Email.styles.js.map +0 -1
  70. package/lib/components/Email/Email.types.d.ts +0 -237
  71. package/lib/components/Email/Email.types.d.ts.map +0 -1
  72. package/lib/components/Email/Email.types.js +0 -2
  73. package/lib/components/Email/Email.types.js.map +0 -1
  74. package/lib/components/Email/EmailComposer.d.ts +0 -9
  75. package/lib/components/Email/EmailComposer.d.ts.map +0 -1
  76. package/lib/components/Email/EmailComposer.js +0 -185
  77. package/lib/components/Email/EmailComposer.js.map +0 -1
  78. package/lib/components/Email/EmailConversation.d.ts +0 -14
  79. package/lib/components/Email/EmailConversation.d.ts.map +0 -1
  80. package/lib/components/Email/EmailConversation.js +0 -179
  81. package/lib/components/Email/EmailConversation.js.map +0 -1
  82. package/lib/components/Email/EmailEntity.d.ts +0 -6
  83. package/lib/components/Email/EmailEntity.d.ts.map +0 -1
  84. package/lib/components/Email/EmailEntity.js +0 -19
  85. package/lib/components/Email/EmailEntity.js.map +0 -1
  86. package/lib/components/Email/EmailSelector.d.ts +0 -19
  87. package/lib/components/Email/EmailSelector.d.ts.map +0 -1
  88. package/lib/components/Email/EmailSelector.js +0 -103
  89. package/lib/components/Email/EmailSelector.js.map +0 -1
  90. package/lib/components/Email/EmailShell.d.ts +0 -9
  91. package/lib/components/Email/EmailShell.d.ts.map +0 -1
  92. package/lib/components/Email/EmailShell.js +0 -56
  93. package/lib/components/Email/EmailShell.js.map +0 -1
  94. package/lib/components/Email/EmailSummaryItem.d.ts +0 -10
  95. package/lib/components/Email/EmailSummaryItem.d.ts.map +0 -1
  96. package/lib/components/Email/EmailSummaryItem.js +0 -93
  97. package/lib/components/Email/EmailSummaryItem.js.map +0 -1
  98. package/lib/components/Email/EmailSummaryList.d.ts +0 -6
  99. package/lib/components/Email/EmailSummaryList.d.ts.map +0 -1
  100. package/lib/components/Email/EmailSummaryList.js +0 -115
  101. package/lib/components/Email/EmailSummaryList.js.map +0 -1
  102. package/lib/components/Email/ViewAnalysis.d.ts +0 -6
  103. package/lib/components/Email/ViewAnalysis.d.ts.map +0 -1
  104. package/lib/components/Email/ViewAnalysis.js +0 -20
  105. package/lib/components/Email/ViewAnalysis.js.map +0 -1
  106. package/lib/components/Email/index.d.ts +0 -9
  107. package/lib/components/Email/index.d.ts.map +0 -1
  108. package/lib/components/Email/index.js +0 -8
  109. package/lib/components/Email/index.js.map +0 -1
  110. package/lib/components/Feed/Feed.context.d.ts +0 -35
  111. package/lib/components/Feed/Feed.context.d.ts.map +0 -1
  112. package/lib/components/Feed/Feed.context.js +0 -8
  113. package/lib/components/Feed/Feed.context.js.map +0 -1
  114. package/lib/components/Feed/Feed.d.ts +0 -52
  115. package/lib/components/Feed/Feed.d.ts.map +0 -1
  116. package/lib/components/Feed/Feed.js +0 -143
  117. package/lib/components/Feed/Feed.js.map +0 -1
  118. package/lib/components/Feed/FeedAnnouncer.d.ts +0 -7
  119. package/lib/components/Feed/FeedAnnouncer.d.ts.map +0 -1
  120. package/lib/components/Feed/FeedAnnouncer.js +0 -11
  121. package/lib/components/Feed/FeedAnnouncer.js.map +0 -1
  122. package/lib/components/Feed/FeedAttachments.d.ts +0 -14
  123. package/lib/components/Feed/FeedAttachments.d.ts.map +0 -1
  124. package/lib/components/Feed/FeedAttachments.js +0 -94
  125. package/lib/components/Feed/FeedAttachments.js.map +0 -1
  126. package/lib/components/Feed/FeedButton.d.ts +0 -6
  127. package/lib/components/Feed/FeedButton.d.ts.map +0 -1
  128. package/lib/components/Feed/FeedButton.js +0 -23
  129. package/lib/components/Feed/FeedButton.js.map +0 -1
  130. package/lib/components/Feed/FeedContent.d.ts +0 -14
  131. package/lib/components/Feed/FeedContent.d.ts.map +0 -1
  132. package/lib/components/Feed/FeedContent.js +0 -39
  133. package/lib/components/Feed/FeedContent.js.map +0 -1
  134. package/lib/components/Feed/FeedLikeButton.d.ts +0 -19
  135. package/lib/components/Feed/FeedLikeButton.d.ts.map +0 -1
  136. package/lib/components/Feed/FeedLikeButton.js +0 -87
  137. package/lib/components/Feed/FeedLikeButton.js.map +0 -1
  138. package/lib/components/Feed/FeedModalList.d.ts +0 -15
  139. package/lib/components/Feed/FeedModalList.d.ts.map +0 -1
  140. package/lib/components/Feed/FeedModalList.js +0 -49
  141. package/lib/components/Feed/FeedModalList.js.map +0 -1
  142. package/lib/components/Feed/FeedNewPost.d.ts +0 -36
  143. package/lib/components/Feed/FeedNewPost.d.ts.map +0 -1
  144. package/lib/components/Feed/FeedNewPost.js +0 -108
  145. package/lib/components/Feed/FeedNewPost.js.map +0 -1
  146. package/lib/components/Feed/FeedNewPostTypeMenu.d.ts +0 -35
  147. package/lib/components/Feed/FeedNewPostTypeMenu.d.ts.map +0 -1
  148. package/lib/components/Feed/FeedNewPostTypeMenu.js +0 -387
  149. package/lib/components/Feed/FeedNewPostTypeMenu.js.map +0 -1
  150. package/lib/components/Feed/FeedPost.d.ts +0 -10
  151. package/lib/components/Feed/FeedPost.d.ts.map +0 -1
  152. package/lib/components/Feed/FeedPost.js +0 -185
  153. package/lib/components/Feed/FeedPost.js.map +0 -1
  154. package/lib/components/Feed/FeedPost.types.d.ts +0 -101
  155. package/lib/components/Feed/FeedPost.types.d.ts.map +0 -1
  156. package/lib/components/Feed/FeedPost.types.js +0 -2
  157. package/lib/components/Feed/FeedPost.types.js.map +0 -1
  158. package/lib/components/Feed/FeedReply.d.ts +0 -10
  159. package/lib/components/Feed/FeedReply.d.ts.map +0 -1
  160. package/lib/components/Feed/FeedReply.js +0 -131
  161. package/lib/components/Feed/FeedReply.js.map +0 -1
  162. package/lib/components/Feed/FeedReply.types.d.ts +0 -68
  163. package/lib/components/Feed/FeedReply.types.d.ts.map +0 -1
  164. package/lib/components/Feed/FeedReply.types.js +0 -2
  165. package/lib/components/Feed/FeedReply.types.js.map +0 -1
  166. package/lib/components/Feed/FeedReplyInput.d.ts +0 -32
  167. package/lib/components/Feed/FeedReplyInput.d.ts.map +0 -1
  168. package/lib/components/Feed/FeedReplyInput.js +0 -105
  169. package/lib/components/Feed/FeedReplyInput.js.map +0 -1
  170. package/lib/components/Feed/FeedRichText.d.ts +0 -9
  171. package/lib/components/Feed/FeedRichText.d.ts.map +0 -1
  172. package/lib/components/Feed/FeedRichText.js +0 -96
  173. package/lib/components/Feed/FeedRichText.js.map +0 -1
  174. package/lib/components/Feed/index.d.ts +0 -10
  175. package/lib/components/Feed/index.d.ts.map +0 -1
  176. package/lib/components/Feed/index.js +0 -6
  177. package/lib/components/Feed/index.js.map +0 -1
  178. package/lib/components/HashtagButton/HashtagButton.d.ts +0 -16
  179. package/lib/components/HashtagButton/HashtagButton.d.ts.map +0 -1
  180. package/lib/components/HashtagButton/HashtagButton.js +0 -31
  181. package/lib/components/HashtagButton/HashtagButton.js.map +0 -1
  182. package/lib/components/HashtagButton/index.d.ts +0 -3
  183. package/lib/components/HashtagButton/index.d.ts.map +0 -1
  184. package/lib/components/HashtagButton/index.js +0 -3
  185. package/lib/components/HashtagButton/index.js.map +0 -1
  186. package/lib/components/MentionButton/MentionButton.d.ts +0 -20
  187. package/lib/components/MentionButton/MentionButton.d.ts.map +0 -1
  188. package/lib/components/MentionButton/MentionButton.js +0 -58
  189. package/lib/components/MentionButton/MentionButton.js.map +0 -1
  190. package/lib/components/MentionButton/index.d.ts +0 -3
  191. package/lib/components/MentionButton/index.d.ts.map +0 -1
  192. package/lib/components/MentionButton/index.js +0 -3
  193. package/lib/components/MentionButton/index.js.map +0 -1
  194. package/lib/index.d.ts +0 -11
  195. package/lib/index.d.ts.map +0 -1
  196. package/lib/index.js +0 -12
  197. package/lib/index.js.map +0 -1
@@ -1,179 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { forwardRef, useRef, useState, useMemo } from 'react';
3
- import styled, { css } from 'styled-components';
4
- import { mix, readableColor } from 'polished';
5
- import * as caretDownIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-down.icon';
6
- import { ExpandCollapse, Flex, Icon, registerIcon, Text, useI18n, defaultThemeProp, useAfterInitialEffect, DateTimeDisplay, readableHue, useBreakpoint, useConfiguration, StyledIcon, tryCatch, useDirection } from '@pega/cosmos-react-core';
7
- import Email from './Email';
8
- registerIcon(caretDownIcon);
9
- const EmailParticipantTextCss = css `
10
- white-space: nowrap;
11
- overflow: hidden;
12
- text-overflow: ellipsis;
13
- max-width: 100%;
14
- `;
15
- export const StyledEmailParticipantsText = styled(Text) `
16
- ${EmailParticipantTextCss}
17
- `;
18
- StyledEmailParticipantsText.defaultProps = defaultThemeProp;
19
- export const StyledCompactTimeStampDisplay = styled(Text) `
20
- ${EmailParticipantTextCss}
21
- margin-top: calc(${props => props.theme.base.spacing} / 2);
22
- `;
23
- StyledCompactTimeStampDisplay.defaultProps = defaultThemeProp;
24
- export const StyledConversationHeader = styled.header(({ theme, collapsed }) => {
25
- return css `
26
- border-bottom: ${collapsed ? 0 : '0.0625rem'} solid ${theme.base.palette['border-line']};
27
- position: sticky;
28
- top: 0;
29
- z-index: 1;
30
- `;
31
- });
32
- StyledConversationHeader.defaultProps = defaultThemeProp;
33
- export const StyledUnReadCount = styled.div(({ theme: { base } }) => {
34
- const readableBackground = readableHue(base.palette['brand-primary'], base.palette['primary-background']);
35
- const readableTextColor = readableColor(readableBackground);
36
- return css `
37
- align-self: flex-start;
38
- background-color: ${readableBackground};
39
- color: ${readableTextColor};
40
- padding: 0 ${base.spacing};
41
- font-weight: ${base['font-weight']['semi-bold']};
42
-
43
- /* stylelint-disable declaration-block-no-duplicate-properties */
44
- width: fit-content;
45
- width: -moz-fit-content;
46
-
47
- /* stylelint-enable declaration-block-no-duplicate-properties */
48
- `;
49
- });
50
- StyledUnReadCount.defaultProps = defaultThemeProp;
51
- export const StyledEmailConversation = styled.li(({ theme: { base } }) => {
52
- return css `
53
- margin-bottom: ${base.spacing};
54
- border-radius: ${base['border-radius']};
55
- overflow: hidden;
56
- background-color: ${base.palette['primary-background']};
57
- list-style-type: none;
58
- `;
59
- });
60
- StyledEmailConversation.defaultProps = defaultThemeProp;
61
- export const StyledEmailInConversation = styled(Email)(({ unRead, theme: { base } }) => {
62
- const readableBackground = readableHue(base.palette['brand-primary'], base.palette['primary-background']);
63
- return css `
64
- padding: calc(2 * ${base.spacing}) 0;
65
- border-bottom: 0.0625rem solid ${base.palette['border-line']};
66
- position: relative;
67
- ${unRead &&
68
- css `
69
- &::before {
70
- content: '';
71
- background-color: ${readableBackground};
72
- position: absolute;
73
- inset: 0;
74
- height: calc(100% + 0.0625rem);
75
- top: -0.0625rem;
76
- width: 0.125rem;
77
- }
78
- `}
79
- `;
80
- });
81
- StyledEmailInConversation.defaultProps = defaultThemeProp;
82
- const StyledForwardIcon = styled.svg(({ theme }) => {
83
- const readableStrokeColor = readableHue(theme.base.colors.purple.medium, theme.base.palette['primary-background']);
84
- return css `
85
- color: ${readableStrokeColor};
86
- `;
87
- });
88
- StyledForwardIcon.defaultProps = defaultThemeProp;
89
- const StyledUnreadIndicator = styled.span(({ theme, isVisible }) => {
90
- const readableBackground = readableHue(theme.base.palette['brand-primary'], theme.base.palette['primary-background']);
91
- const diameter = '0.375rem';
92
- return css `
93
- width: ${isVisible ? diameter : 0};
94
- margin: 0 ${isVisible ? 0 : '0.188rem'};
95
- height: ${diameter};
96
- display: inline-block;
97
- border-radius: 50%;
98
- background: ${readableBackground};
99
- position: relative;
100
- top: 0.375rem;
101
- align-self: flex-start;
102
- `;
103
- });
104
- StyledUnreadIndicator.defaultProps = defaultThemeProp;
105
- const StyledConversationButton = styled.button(({ theme }) => {
106
- const hoverColor = tryCatch(() => mix(0.85, theme.base.palette['primary-background'], theme.base.palette['brand-primary']));
107
- return css `
108
- border-width: 0;
109
- width: 100%;
110
- padding: ${theme.base.spacing};
111
- background: ${theme.base.palette['primary-background']};
112
- position: sticky;
113
- top: 0;
114
- z-index: 1;
115
-
116
- &[aria-expanded='true'] {
117
- border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};
118
- }
119
-
120
- &:focus {
121
- background: ${theme.base.palette['secondary-background']};
122
- outline: none;
123
- }
124
-
125
- &:hover {
126
- background: ${hoverColor};
127
- outline: none;
128
- }
129
-
130
- & > ${StyledIcon} {
131
- align-self: flex-start;
132
- color: ${theme.base.palette['foreground-color']};
133
- }
134
- `;
135
- });
136
- StyledConversationButton.defaultProps = defaultThemeProp;
137
- const EmailConversation = forwardRef((props, ref) => {
138
- const { id, emails, from, to, unReadEmailCount, timeStamp, isForwarded = false, isCollapsed = false, onCollapse, onExpand, ...restProps } = props;
139
- const t = useI18n();
140
- const [collapsedState, setCollapsedState] = useState(isCollapsed);
141
- useAfterInitialEffect(() => {
142
- setCollapsedState(isCollapsed);
143
- }, [isCollapsed]);
144
- const onExpandCollapse = () => {
145
- setCollapsedState(!collapsedState);
146
- };
147
- const headerRef = useRef(null);
148
- const isSmallOrAbove = useBreakpoint('sm', { breakpointRef: headerRef });
149
- const { locale } = useConfiguration();
150
- const { rtl } = useDirection();
151
- const caretDirection = rtl ? 'caret-left' : 'caret-right';
152
- const generateRecipientList = useMemo(() => {
153
- const recipientElements = to.slice(0, 2).map((recipient, i) => {
154
- return `${recipient.shortName}${i < to.length - 1 ? ';' : ''} `;
155
- });
156
- if (to.length > 2) {
157
- return [...recipientElements, `+${to.length - 2} more`];
158
- }
159
- return recipientElements;
160
- }, [to]);
161
- return (_jsxs(StyledEmailConversation, { ...restProps, id: id, ref: ref, children: [_jsxs(Flex, { as: StyledConversationButton, id: `conversation-heading${id}`, "aria-controls": id, "aria-expanded": !collapsedState, container: { gap: 1, alignItems: 'center', pad: 1 }, onClick: onExpandCollapse, ref: headerRef, children: [_jsx(Icon, { name: collapsedState ? caretDirection : 'caret-down' }, void 0), _jsx(StyledUnreadIndicator, { isVisible: !!unReadEmailCount }, void 0), _jsxs(Flex, { container: {
162
- wrap: 'nowrap',
163
- alignItems: 'start',
164
- direction: 'column'
165
- }, item: {
166
- grow: 1,
167
- shrink: 1
168
- }, children: [_jsx(Text, { variant: 'primary', as: StyledEmailParticipantsText, children: `${isForwarded ? 'FW' : t('from')}: ${from.fullName}` }, void 0), _jsxs(Text, { variant: 'secondary', as: StyledEmailParticipantsText, children: [`${t('to')}: `, generateRecipientList] }, void 0), !isSmallOrAbove && (_jsxs(Text, { variant: 'secondary', as: StyledCompactTimeStampDisplay, children: [`${new Intl.DateTimeFormat(locale, { weekday: 'short' }).format(new Date(timeStamp))}, `, _jsx(DateTimeDisplay, { variant: 'datetime', format: 'short', value: timeStamp }, void 0)] }, void 0))] }, void 0), _jsx(Flex, { container: {
169
- gap: 1,
170
- alignItems: 'center'
171
- }, item: {
172
- shrink: 0
173
- }, children: isSmallOrAbove && (_jsxs(Text, { variant: 'secondary', as: StyledEmailParticipantsText, children: [`${new Intl.DateTimeFormat(locale, { weekday: 'short' }).format(new Date(timeStamp))}, `, _jsx(DateTimeDisplay, { variant: 'datetime', format: 'short', value: timeStamp }, void 0)] }, void 0)) }, void 0)] }, void 0), _jsxs(ExpandCollapse, { as: Flex, container: { direction: 'column' }, collapsed: collapsedState, onBeforeCollapse: onCollapse, onBeforeExpand: onExpand, role: 'region', "aria-labelledby": `conversation-heading${id}`, id: `conversation-content${id}`, children: [!!unReadEmailCount && (_jsx(Text, { as: StyledUnReadCount, id: `unread-emailCount-${id}`, variant: 'secondary', children: t('new_emails_count', [unReadEmailCount], { count: unReadEmailCount }) }, void 0)), emails &&
174
- emails.map(email => {
175
- return _jsx(StyledEmailInConversation, { ...email }, email.id);
176
- })] }, void 0)] }, void 0));
177
- });
178
- export default EmailConversation;
179
- //# sourceMappingURL=EmailConversation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EmailConversation.js","sourceRoot":"","sources":["../../../src/components/Email/EmailConversation.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAsC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAClG,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAA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AE,CAAC,CAAC,MAAM,CAC9D,IAAI,IAAI,CAAC,SAAS,CAAC,CACpB,IAAI,EACL,KAAC,eAAe,IAAC,OAAO,EAAC,UAAU,EAAC,MAAM,EAAC,OAAO,EAAC,KAAK,EAAE,SAAS,WAAI,YAClE,CACR,WACI,YACF,EAEP,MAAC,cAAc,IACb,EAAE,EAAE,IAAI,EACR,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,EAClC,SAAS,EAAE,cAAc,EACzB,gBAAgB,EAAE,UAAU,EAC5B,cAAc,EAAE,QAAQ,EACxB,IAAI,EAAC,QAAQ,qBACI,uBAAuB,EAAE,EAAE,EAC5C,EAAE,EAAE,uBAAuB,EAAE,EAAE,aAE9B,CAAC,CAAC,gBAAgB,IAAI,CACrB,KAAC,IAAI,IAAC,EAAE,EAAE,iBAAiB,EAAE,EAAE,EAAE,qBAAqB,EAAE,EAAE,EAAE,OAAO,EAAC,WAAW,YAC5E,CAAC,CAAC,kBAAkB,EAAE,CAAC,gBAAgB,CAAC,EAAE,EAAE,KAAK,EAAE,gBAAgB,EAAE,CAAC,WAClE,CACR,EACA,MAAM;wBACL,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;4BACjB,OAAO,KAAC,yBAAyB,OAAoB,KAAK,IAAnB,KAAK,CAAC,EAAE,CAAe,CAAC;wBACjE,CAAC,CAAC,YACW,YACO,CAC3B,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,iBAAiB,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, PropsWithoutRef, useRef, useState, useMemo } from 'react';\nimport styled, { css } from 'styled-components';\nimport { mix, readableColor } from 'polished';\n\nimport * as caretDownIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-down.icon';\nimport {\n ExpandCollapse,\n Flex,\n Icon,\n registerIcon,\n Text,\n useI18n,\n defaultThemeProp,\n ForwardProps,\n useAfterInitialEffect,\n DateTimeDisplay,\n readableHue,\n useBreakpoint,\n useConfiguration,\n StyledIcon,\n tryCatch,\n useDirection\n} from '@pega/cosmos-react-core';\n\nimport Email from './Email';\nimport { EmailConversationProps } from './Email.types';\n\nregisterIcon(caretDownIcon);\n\nconst EmailParticipantTextCss = css`\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n max-width: 100%;\n`;\n\nexport const StyledEmailParticipantsText = styled(Text)`\n ${EmailParticipantTextCss}\n`;\n\nStyledEmailParticipantsText.defaultProps = defaultThemeProp;\n\nexport const StyledCompactTimeStampDisplay = styled(Text)`\n ${EmailParticipantTextCss}\n margin-top: calc(${props => props.theme.base.spacing} / 2);\n`;\nStyledCompactTimeStampDisplay.defaultProps = defaultThemeProp;\n\nexport const StyledConversationHeader = styled.header<{ collapsed: boolean }>(\n ({ theme, collapsed }) => {\n return css`\n border-bottom: ${collapsed ? 0 : '0.0625rem'} solid ${theme.base.palette['border-line']};\n position: sticky;\n top: 0;\n z-index: 1;\n `;\n }\n);\nStyledConversationHeader.defaultProps = defaultThemeProp;\n\nexport const StyledUnReadCount = styled.div(({ theme: { base } }) => {\n const readableBackground = readableHue(\n base.palette['brand-primary'],\n base.palette['primary-background']\n );\n const readableTextColor = readableColor(readableBackground);\n\n return css`\n align-self: flex-start;\n background-color: ${readableBackground};\n color: ${readableTextColor};\n padding: 0 ${base.spacing};\n font-weight: ${base['font-weight']['semi-bold']};\n\n /* stylelint-disable declaration-block-no-duplicate-properties */\n width: fit-content;\n width: -moz-fit-content;\n\n /* stylelint-enable declaration-block-no-duplicate-properties */\n `;\n});\n\nStyledUnReadCount.defaultProps = defaultThemeProp;\n\nexport const StyledEmailConversation = styled.li(({ theme: { base } }) => {\n return css`\n margin-bottom: ${base.spacing};\n border-radius: ${base['border-radius']};\n overflow: hidden;\n background-color: ${base.palette['primary-background']};\n list-style-type: none;\n `;\n});\nStyledEmailConversation.defaultProps = defaultThemeProp;\n\nexport const StyledEmailInConversation = styled(Email)(({ unRead, theme: { base } }) => {\n const readableBackground = readableHue(\n base.palette['brand-primary'],\n base.palette['primary-background']\n );\n return css`\n padding: calc(2 * ${base.spacing}) 0;\n border-bottom: 0.0625rem solid ${base.palette['border-line']};\n position: relative;\n ${unRead &&\n css`\n &::before {\n content: '';\n background-color: ${readableBackground};\n position: absolute;\n inset: 0;\n height: calc(100% + 0.0625rem);\n top: -0.0625rem;\n width: 0.125rem;\n }\n `}\n `;\n});\nStyledEmailInConversation.defaultProps = defaultThemeProp;\n\nconst StyledForwardIcon = styled.svg(({ theme }) => {\n const readableStrokeColor = readableHue(\n theme.base.colors.purple.medium,\n theme.base.palette['primary-background']\n );\n return css`\n color: ${readableStrokeColor};\n `;\n});\nStyledForwardIcon.defaultProps = defaultThemeProp;\n\nconst StyledUnreadIndicator = styled.span<{ isVisible: boolean }>(({ theme, isVisible }) => {\n const readableBackground = readableHue(\n theme.base.palette['brand-primary'],\n theme.base.palette['primary-background']\n );\n\n const diameter = '0.375rem';\n\n return css`\n width: ${isVisible ? diameter : 0};\n margin: 0 ${isVisible ? 0 : '0.188rem'};\n height: ${diameter};\n display: inline-block;\n border-radius: 50%;\n background: ${readableBackground};\n position: relative;\n top: 0.375rem;\n align-self: flex-start;\n `;\n});\nStyledUnreadIndicator.defaultProps = defaultThemeProp;\n\nconst StyledConversationButton = styled.button(({ theme }) => {\n const hoverColor = tryCatch(() =>\n mix(0.85, theme.base.palette['primary-background'], theme.base.palette['brand-primary'])\n );\n return css`\n border-width: 0;\n width: 100%;\n padding: ${theme.base.spacing};\n background: ${theme.base.palette['primary-background']};\n position: sticky;\n top: 0;\n z-index: 1;\n\n &[aria-expanded='true'] {\n border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};\n }\n\n &:focus {\n background: ${theme.base.palette['secondary-background']};\n outline: none;\n }\n\n &:hover {\n background: ${hoverColor};\n outline: none;\n }\n\n & > ${StyledIcon} {\n align-self: flex-start;\n color: ${theme.base.palette['foreground-color']};\n }\n `;\n});\n\nStyledConversationButton.defaultProps = defaultThemeProp;\n\nconst EmailConversation: FunctionComponent<EmailConversationProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<EmailConversationProps>, ref: EmailConversationProps['ref']) => {\n const {\n id,\n emails,\n from,\n to,\n unReadEmailCount,\n timeStamp,\n isForwarded = false,\n isCollapsed = false,\n onCollapse,\n onExpand,\n ...restProps\n } = props;\n const t = useI18n();\n const [collapsedState, setCollapsedState] = useState(isCollapsed);\n useAfterInitialEffect(() => {\n setCollapsedState(isCollapsed);\n }, [isCollapsed]);\n const onExpandCollapse = () => {\n setCollapsedState(!collapsedState);\n };\n\n const headerRef = useRef<HTMLDivElement>(null);\n const isSmallOrAbove = useBreakpoint('sm', { breakpointRef: headerRef });\n const { locale } = useConfiguration();\n const { rtl } = useDirection();\n\n const caretDirection = rtl ? 'caret-left' : 'caret-right';\n const generateRecipientList = useMemo(() => {\n const recipientElements = to.slice(0, 2).map((recipient, i) => {\n return `${recipient.shortName}${i < to.length - 1 ? ';' : ''} `;\n });\n if (to.length > 2) {\n return [...recipientElements, `+${to.length - 2} more`];\n }\n return recipientElements;\n }, [to]);\n\n return (\n <StyledEmailConversation {...restProps} id={id} ref={ref}>\n <Flex\n as={StyledConversationButton}\n id={`conversation-heading${id}`}\n aria-controls={id}\n aria-expanded={!collapsedState}\n container={{ gap: 1, alignItems: 'center', pad: 1 }}\n onClick={onExpandCollapse}\n ref={headerRef}\n >\n <Icon name={collapsedState ? caretDirection : 'caret-down'} />\n <StyledUnreadIndicator isVisible={!!unReadEmailCount} />\n <Flex\n container={{\n wrap: 'nowrap',\n alignItems: 'start',\n direction: 'column'\n }}\n item={{\n grow: 1,\n shrink: 1\n }}\n >\n <Text variant='primary' as={StyledEmailParticipantsText}>\n {`${isForwarded ? 'FW' : t('from')}: ${from.fullName}`}\n </Text>\n <Text variant='secondary' as={StyledEmailParticipantsText}>\n {`${t('to')}: `}\n {generateRecipientList}\n </Text>\n {!isSmallOrAbove && (\n <Text variant='secondary' as={StyledCompactTimeStampDisplay}>\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 </Flex>\n <Flex\n container={{\n gap: 1,\n alignItems: 'center'\n }}\n item={{\n shrink: 0\n }}\n >\n {isSmallOrAbove && (\n <Text variant='secondary' as={StyledEmailParticipantsText}>\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 </Flex>\n </Flex>\n\n <ExpandCollapse\n as={Flex}\n container={{ direction: 'column' }}\n collapsed={collapsedState}\n onBeforeCollapse={onCollapse}\n onBeforeExpand={onExpand}\n role='region'\n aria-labelledby={`conversation-heading${id}`}\n id={`conversation-content${id}`}\n >\n {!!unReadEmailCount && (\n <Text as={StyledUnReadCount} id={`unread-emailCount-${id}`} variant='secondary'>\n {t('new_emails_count', [unReadEmailCount], { count: unReadEmailCount })}\n </Text>\n )}\n {emails &&\n emails.map(email => {\n return <StyledEmailInConversation key={email.id} {...email} />;\n })}\n </ExpandCollapse>\n </StyledEmailConversation>\n );\n }\n);\n\nexport default EmailConversation;\n"]}
@@ -1,6 +0,0 @@
1
- import { FunctionComponent } from 'react';
2
- import { ForwardProps } from '@pega/cosmos-react-core';
3
- import { EmailEntityProps } from './Email.types';
4
- declare const EmailEntity: FunctionComponent<EmailEntityProps & ForwardProps>;
5
- export default EmailEntity;
6
- //# sourceMappingURL=EmailEntity.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EmailEntity.d.ts","sourceRoot":"","sources":["../../../src/components/Email/EmailEntity.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAmB,MAAM,OAAO,CAAC;AAEvE,OAAO,EACL,YAAY,EAQb,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,QAAA,MAAM,WAAW,EAAE,iBAAiB,CAAC,gBAAgB,GAAG,YAAY,CAgCnE,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -1,19 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { forwardRef } from 'react';
3
- import { Tooltip, useConsolidatedRef, useElement, useI18n, useConfiguration, formatListToLocaleString, Icon } from '@pega/cosmos-react-core';
4
- import { StyledEmailEntity } from './Email.styles';
5
- const EmailEntity = forwardRef(({ entity, ...restProps }, ref) => {
6
- const [el, setEl] = useElement();
7
- const elementRef = useConsolidatedRef(setEl, ref);
8
- const t = useI18n();
9
- const { locale } = useConfiguration();
10
- return (_jsxs(StyledEmailEntity, { ...restProps, entity: entity, ref: elementRef, "aria-label": Array.isArray(entity.description)
11
- ? formatListToLocaleString(entity.description, t, locale)
12
- : entity.description, children: [entity.value, entity.icon && _jsx(Icon, { name: entity.icon }, void 0), entity.description && (_jsx(Tooltip, { target: el, children: Array.isArray(entity.description)
13
- ? formatListToLocaleString(entity.description, t, locale, {
14
- separator: '\n'
15
- })
16
- : entity.description }, void 0))] }, void 0));
17
- });
18
- export default EmailEntity;
19
- //# sourceMappingURL=EmailEntity.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EmailEntity.js","sourceRoot":"","sources":["../../../src/components/Email/EmailEntity.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAsC,MAAM,OAAO,CAAC;AAEvE,OAAO,EAEL,OAAO,EACP,kBAAkB,EAClB,UAAU,EACV,OAAO,EACP,gBAAgB,EAChB,wBAAwB,EACxB,IAAI,EACL,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAGnD,MAAM,WAAW,GAAuD,UAAU,CAChF,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,EAAqC,EAAE,GAA4B,EAAE,EAAE;IAC5F,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,GAAG,UAAU,EAAe,CAAC;IAC9C,MAAM,UAAU,GAAG,kBAAkB,CAAc,KAAK,EAAE,GAAG,CAAC,CAAC;IAC/D,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IACpB,MAAM,EAAE,MAAM,EAAE,GAAG,gBAAgB,EAAE,CAAC;IAEtC,OAAO,CACL,MAAC,iBAAiB,OACZ,SAAS,EACb,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,UAAU,gBAEb,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC;YAC/B,CAAC,CAAC,wBAAwB,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,EAAE,MAAM,CAAC;YACzD,CAAC,CAAC,MAAM,CAAC,WAAW,aAGvB,MAAM,CAAC,KAAK,EACZ,MAAM,CAAC,IAAI,IAAI,KAAC,IAAI,IAAC,IAAI,EAAE,MAAM,CAAC,IAAI,WAAI,EAC1C,MAAM,CAAC,WAAW,IAAI,CACrB,KAAC,OAAO,IAAC,MAAM,EAAE,EAAE,YAChB,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC;oBAChC,CAAC,CAAC,wBAAwB,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,EAAE,MAAM,EAAE;wBACtD,SAAS,EAAE,IAAI;qBAChB,CAAC;oBACJ,CAAC,CAAC,MAAM,CAAC,WAAW,WACd,CACX,YACiB,CACrB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, PropsWithoutRef } from 'react';\n\nimport {\n ForwardProps,\n Tooltip,\n useConsolidatedRef,\n useElement,\n useI18n,\n useConfiguration,\n formatListToLocaleString,\n Icon\n} from '@pega/cosmos-react-core';\n\nimport { StyledEmailEntity } from './Email.styles';\nimport { EmailEntityProps } from './Email.types';\n\nconst EmailEntity: FunctionComponent<EmailEntityProps & ForwardProps> = forwardRef(\n ({ entity, ...restProps }: PropsWithoutRef<EmailEntityProps>, ref: EmailEntityProps['ref']) => {\n const [el, setEl] = useElement<HTMLElement>();\n const elementRef = useConsolidatedRef<HTMLElement>(setEl, ref);\n const t = useI18n();\n const { locale } = useConfiguration();\n\n return (\n <StyledEmailEntity\n {...restProps}\n entity={entity}\n ref={elementRef}\n aria-label={\n Array.isArray(entity.description)\n ? formatListToLocaleString(entity.description, t, locale)\n : entity.description\n }\n >\n {entity.value}\n {entity.icon && <Icon name={entity.icon} />}\n {entity.description && (\n <Tooltip target={el}>\n {Array.isArray(entity.description)\n ? formatListToLocaleString(entity.description, t, locale, {\n separator: '\\n'\n })\n : entity.description}\n </Tooltip>\n )}\n </StyledEmailEntity>\n );\n }\n);\n\nexport default EmailEntity;\n"]}
@@ -1,19 +0,0 @@
1
- import { FunctionComponent, ReactNode } from 'react';
2
- import { ComboBoxProps, NoChildrenProp } from '@pega/cosmos-react-core';
3
- import { EmailComposerProps, EmailUser } from './Email.types';
4
- export interface EmailSelectorProps extends NoChildrenProp {
5
- /** participants */
6
- participants: EmailComposerProps['participants'];
7
- /** default selections */
8
- defaultSelections?: EmailUser['emailAddress'][];
9
- /** selectedItems */
10
- selections: (selections: EmailUser['emailAddress'][], label: ReactNode) => void;
11
- /**
12
- * Callback to handle external entry validation
13
- * If returned true considers the entry to be a valid entry
14
- */
15
- externalValidator?: EmailComposerProps['externalValidator'];
16
- }
17
- declare const EmailSelector: FunctionComponent<EmailSelectorProps & Pick<ComboBoxProps, 'label' | 'mode' | 'required'>>;
18
- export default EmailSelector;
19
- //# sourceMappingURL=EmailSelector.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EmailSelector.d.ts","sourceRoot":"","sources":["../../../src/components/Email/EmailSelector.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAA6C,SAAS,EAAE,MAAM,OAAO,CAAC;AAEhG,OAAO,EAEL,aAAa,EAGb,cAAc,EAEf,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE9D,MAAM,WAAW,kBAAmB,SAAQ,cAAc;IACxD,mBAAmB;IACnB,YAAY,EAAE,kBAAkB,CAAC,cAAc,CAAC,CAAC;IACjD,yBAAyB;IACzB,iBAAiB,CAAC,EAAE,SAAS,CAAC,cAAc,CAAC,EAAE,CAAC;IAChD,oBAAoB;IACpB,UAAU,EAAE,CAAC,UAAU,EAAE,SAAS,CAAC,cAAc,CAAC,EAAE,EAAE,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;IAChF;;;OAGG;IACH,iBAAiB,CAAC,EAAE,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;CAC7D;AAED,QAAA,MAAM,aAAa,EAAE,iBAAiB,CACpC,kBAAkB,GAAG,IAAI,CAAC,aAAa,EAAE,OAAO,GAAG,MAAM,GAAG,UAAU,CAAC,CA8GxE,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -1,103 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useMemo, useState, useEffect } from 'react';
3
- import { ComboBox, createStringMatcher, menuHelpers, useI18n } from '@pega/cosmos-react-core';
4
- const EmailSelector = ({ participants, defaultSelections, label, mode, required, selections, externalValidator }) => {
5
- const [filterValue, setFilterValue] = useState('');
6
- const [selectedItems, setSelectedItems] = useState([]);
7
- const [emailParticipants, setEmailParticipants] = useState(participants);
8
- const t = useI18n();
9
- const filterRegex = createStringMatcher(filterValue, 'contains');
10
- const emailsToRender = useMemo(() => {
11
- const filteredItems = (filterValue
12
- ? emailParticipants.filter(({ emailAddress, fullName, shortName }) => {
13
- return (filterRegex.test(emailAddress) ||
14
- filterRegex.test(fullName) ||
15
- filterRegex.test(shortName));
16
- })
17
- : emailParticipants).map(({ emailAddress, fullName }) => {
18
- return {
19
- id: emailAddress,
20
- primary: fullName,
21
- secondary: [emailAddress],
22
- selected: selectedItems.includes(emailAddress)
23
- };
24
- });
25
- const isValid = externalValidator?.(filterValue);
26
- return (filterValue && externalValidator && isValid) || (filterValue && !externalValidator)
27
- ? [
28
- {
29
- id: filterValue,
30
- primary: `${t('use')}: ${filterValue}`,
31
- selected: selectedItems.includes(filterValue)
32
- },
33
- ...filteredItems
34
- ]
35
- : filteredItems;
36
- }, [emailParticipants, selectedItems, filterRegex]);
37
- const toggleSelectedItems = (id) => {
38
- setSelectedItems(prev => {
39
- if (prev.includes(id)) {
40
- return prev.filter(value => value !== id);
41
- }
42
- setFilterValue('');
43
- const filteredItem = menuHelpers.getItem(emailsToRender, id);
44
- if (!filteredItem?.secondary && !externalValidator) {
45
- setEmailParticipants([
46
- ...emailParticipants,
47
- {
48
- shortName: '',
49
- fullName: '',
50
- emailAddress: filterValue
51
- }
52
- ]);
53
- }
54
- if (!filteredItem?.secondary && externalValidator) {
55
- const isValid = externalValidator?.(filterValue);
56
- if (isValid) {
57
- setEmailParticipants([
58
- ...emailParticipants,
59
- {
60
- shortName: '',
61
- fullName: '',
62
- emailAddress: filterValue
63
- }
64
- ]);
65
- return [...prev, id];
66
- }
67
- return [...prev];
68
- }
69
- return [...prev, id];
70
- });
71
- };
72
- useEffect(() => {
73
- if (defaultSelections && defaultSelections.length > 0)
74
- setSelectedItems(defaultSelections);
75
- }, [defaultSelections]);
76
- useEffect(() => {
77
- selections(selectedItems, label);
78
- }, [selectedItems]);
79
- const comboBoxProps = {
80
- value: filterValue,
81
- onChange: (e) => {
82
- setFilterValue(e.target.value);
83
- },
84
- onBlur: () => {
85
- setFilterValue('');
86
- },
87
- menu: {
88
- items: emailsToRender,
89
- accent: filterRegex,
90
- onItemClick: toggleSelectedItems
91
- },
92
- selected: {
93
- items: selectedItems.map(value => ({ id: value, text: value })),
94
- onRemove: toggleSelectedItems
95
- },
96
- label,
97
- mode,
98
- required
99
- };
100
- return _jsx(ComboBox, { ...comboBoxProps }, void 0);
101
- };
102
- export default EmailSelector;
103
- //# sourceMappingURL=EmailSelector.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EmailSelector.js","sourceRoot":"","sources":["../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AE,CAAC,CAAC;YAC/D,QAAQ,EAAE,mBAAmB;SAC9B;QACD,KAAK;QACL,IAAI;QACJ,QAAQ;KACT,CAAC;IAEF,OAAO,KAAC,QAAQ,OAAK,aAAa,WAAI,CAAC;AACzC,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import { FunctionComponent, ChangeEvent, useMemo, useState, useEffect, ReactNode } from 'react';\n\nimport {\n ComboBox,\n ComboBoxProps,\n createStringMatcher,\n menuHelpers,\n NoChildrenProp,\n useI18n\n} from '@pega/cosmos-react-core';\n\nimport { EmailComposerProps, EmailUser } from './Email.types';\n\nexport interface EmailSelectorProps extends NoChildrenProp {\n /** participants */\n participants: EmailComposerProps['participants'];\n /** default selections */\n defaultSelections?: EmailUser['emailAddress'][];\n /** selectedItems */\n selections: (selections: EmailUser['emailAddress'][], label: ReactNode) => void;\n /**\n * Callback to handle external entry validation\n * If returned true considers the entry to be a valid entry\n */\n externalValidator?: EmailComposerProps['externalValidator'];\n}\n\nconst EmailSelector: FunctionComponent<\n EmailSelectorProps & Pick<ComboBoxProps, 'label' | 'mode' | 'required'>\n> = ({ participants, defaultSelections, label, mode, required, selections, externalValidator }) => {\n const [filterValue, setFilterValue] = useState('');\n const [selectedItems, setSelectedItems] = useState<EmailUser['emailAddress'][]>([]);\n const [emailParticipants, setEmailParticipants] = useState(participants);\n const t = useI18n();\n\n const filterRegex = createStringMatcher(filterValue, 'contains');\n\n const emailsToRender = useMemo(() => {\n const filteredItems = (\n filterValue\n ? emailParticipants.filter(({ emailAddress, fullName, shortName }) => {\n return (\n filterRegex.test(emailAddress) ||\n filterRegex.test(fullName) ||\n filterRegex.test(shortName)\n );\n })\n : emailParticipants\n ).map(({ emailAddress, fullName }) => {\n return {\n id: emailAddress,\n primary: fullName,\n secondary: [emailAddress],\n selected: selectedItems.includes(emailAddress)\n };\n });\n\n const isValid = externalValidator?.(filterValue);\n\n return (filterValue && externalValidator && isValid) || (filterValue && !externalValidator)\n ? [\n {\n id: filterValue,\n primary: `${t('use')}: ${filterValue}`,\n selected: selectedItems.includes(filterValue)\n },\n ...filteredItems\n ]\n : filteredItems;\n }, [emailParticipants, selectedItems, filterRegex]);\n\n const toggleSelectedItems = (id: string) => {\n setSelectedItems(prev => {\n if (prev.includes(id)) {\n return prev.filter(value => value !== id);\n }\n setFilterValue('');\n const filteredItem = menuHelpers.getItem(emailsToRender, id);\n if (!filteredItem?.secondary && !externalValidator) {\n setEmailParticipants([\n ...emailParticipants,\n {\n shortName: '',\n fullName: '',\n emailAddress: filterValue\n }\n ]);\n }\n if (!filteredItem?.secondary && externalValidator) {\n const isValid = externalValidator?.(filterValue);\n if (isValid) {\n setEmailParticipants([\n ...emailParticipants,\n {\n shortName: '',\n fullName: '',\n emailAddress: filterValue\n }\n ]);\n return [...prev, id];\n }\n return [...prev];\n }\n return [...prev, id];\n });\n };\n\n useEffect(() => {\n if (defaultSelections && defaultSelections.length > 0) setSelectedItems(defaultSelections);\n }, [defaultSelections]);\n\n useEffect(() => {\n selections(selectedItems, label);\n }, [selectedItems]);\n\n const comboBoxProps = {\n value: filterValue,\n onChange: (e: ChangeEvent<HTMLInputElement>) => {\n setFilterValue(e.target.value);\n },\n onBlur: () => {\n setFilterValue('');\n },\n menu: {\n items: emailsToRender,\n accent: filterRegex,\n onItemClick: toggleSelectedItems\n },\n selected: {\n items: selectedItems.map(value => ({ id: value, text: value })),\n onRemove: toggleSelectedItems\n },\n label,\n mode,\n required\n };\n\n return <ComboBox {...comboBoxProps} />;\n};\n\nexport default EmailSelector;\n"]}
@@ -1,9 +0,0 @@
1
- import { FunctionComponent } from 'react';
2
- import { ForwardProps } from '@pega/cosmos-react-core';
3
- import { EmailShellProps } from './Email.types';
4
- export declare const StyledEmailHeader: import("styled-components").StyledComponent<"header", import("styled-components").DefaultTheme, {}, never>;
5
- export declare const StyledEmailConversationList: import("styled-components").StyledComponent<"ul", import("styled-components").DefaultTheme, {}, never>;
6
- export declare const StyledEmailShell: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, EmailShellProps, never>;
7
- declare const EmailShell: FunctionComponent<EmailShellProps & ForwardProps>;
8
- export default EmailShell;
9
- //# sourceMappingURL=EmailShell.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EmailShell.d.ts","sourceRoot":"","sources":["../../../src/components/Email/EmailShell.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAyC,MAAM,OAAO,CAAC;AAGjF,OAAO,EAGL,YAAY,EAKb,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAShD,eAAO,MAAM,iBAAiB,4GAAkB,CAAC;AACjD,eAAO,MAAM,2BAA2B,wGAAc,CAAC;AACvD,eAAO,MAAM,gBAAgB,sHAa3B,CAAC;AAIH,QAAA,MAAM,UAAU,EAAE,iBAAiB,CAAC,eAAe,GAAG,YAAY,CAsEjE,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -1,56 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { forwardRef, useState } from 'react';
3
- import styled, { css } from 'styled-components';
4
- import { defaultThemeProp, Flex, Icon, registerIcon, Text, useI18n } from '@pega/cosmos-react-core';
5
- import * as mailIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/mail.icon';
6
- import EmailConversation, { StyledEmailConversation, StyledEmailInConversation, StyledUnReadCount } from './EmailConversation';
7
- registerIcon(mailIcon);
8
- export const StyledEmailHeader = styled.header ``;
9
- export const StyledEmailConversationList = styled.ul ``;
10
- export const StyledEmailShell = styled.div(props => {
11
- const { theme } = props;
12
- return css `
13
- height: 100%;
14
- > ${StyledEmailHeader} {
15
- padding: ${theme.base.spacing} 0;
16
- }
17
- > ${StyledEmailConversationList} {
18
- height: 100%;
19
- overflow-y: auto;
20
- list-style-type: none;
21
- }
22
- `;
23
- });
24
- StyledEmailShell.defaultProps = defaultThemeProp;
25
- const EmailShell = forwardRef((props, ref) => {
26
- const { conversations, headerProps, autoCollapse = false, ...restProps } = props;
27
- const t = useI18n();
28
- const [activeIndex, setActiveIndex] = useState(0);
29
- const multiConversation = autoCollapse
30
- ? conversations?.map((conversation, index) => {
31
- const { onExpand, isCollapsed, ...rest } = conversation;
32
- const collapsed = index !== activeIndex;
33
- return (_jsx(EmailConversation, { onExpand: () => {
34
- setActiveIndex(index);
35
- if (onExpand)
36
- onExpand();
37
- }, isCollapsed: collapsed, ...rest }, void 0));
38
- })
39
- : conversations?.map(conversation => {
40
- return _jsx(EmailConversation, { ...conversation }, void 0);
41
- });
42
- const singleConversation = conversations?.map(conversation => {
43
- return (_jsxs(StyledEmailConversation, { children: [!!conversation.unReadEmailCount && (_jsx(Text, { as: StyledUnReadCount, variant: 'secondary', children: t('new_emails_count', [conversation.unReadEmailCount], {
44
- count: conversation.unReadEmailCount
45
- }) }, void 0)), conversation.emails?.map(email => {
46
- return _jsx(StyledEmailInConversation, { ...email }, email.id);
47
- })] }, conversation.id));
48
- });
49
- return (_jsxs(Flex, { as: StyledEmailShell, container: { direction: 'column' }, ref: ref, ...restProps, children: [headerProps && (_jsxs(Flex, { container: {
50
- alignItems: 'center',
51
- justify: 'between',
52
- pad: 1
53
- }, as: StyledEmailHeader, children: [_jsxs(Flex, { container: { gap: 1, alignItems: 'center' }, children: [_jsx(Icon, { name: 'mail' }, void 0), _jsx(Text, { variant: 'h3', children: headerProps?.subject ? `${t('subject')}: ${headerProps?.subject} ` : t('email') }, void 0)] }, void 0), headerProps?.actions] }, void 0)), _jsx(StyledEmailConversationList, { "aria-multiselectable": !autoCollapse, children: conversations && conversations?.length === 1 ? singleConversation : multiConversation }, void 0)] }, void 0));
54
- });
55
- export default EmailShell;
56
- //# sourceMappingURL=EmailShell.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EmailShell.js","sourceRoot":"","sources":["../../../src/components/Email/EmailShell.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,UAAU,EAAmB,QAAQ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AAS,aACpF,WAAW,IAAI,CACd,MAAC,IAAI,IACH,SAAS,EAAE;oBACT,UAAU,EAAE,QAAQ;oBACpB,OAAO,EAAE,SAAS;oBAClB,GAAG,EAAE,CAAC;iBACP,EACD,EAAE,EAAE,iBAAiB,aAErB,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,aAC/C,KAAC,IAAI,IAAC,IAAI,EAAC,MAAM,WAAG,EACpB,KAAC,IAAI,IAAC,OAAO,EAAC,IAAI,YACf,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,KAAK,WAAW,EAAE,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,WAC3E,YACF,EACN,WAAW,EAAE,OAAO,YAChB,CACR,EACD,KAAC,2BAA2B,4BAAuB,CAAC,YAAY,YAC7D,aAAa,IAAI,aAAa,EAAE,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,iBAAiB,WAC1D,YACzB,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import { FunctionComponent, forwardRef, PropsWithoutRef, useState } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n defaultThemeProp,\n Flex,\n ForwardProps,\n Icon,\n registerIcon,\n Text,\n useI18n\n} from '@pega/cosmos-react-core';\nimport * as mailIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/mail.icon';\n\nimport { EmailShellProps } from './Email.types';\nimport EmailConversation, {\n StyledEmailConversation,\n StyledEmailInConversation,\n StyledUnReadCount\n} from './EmailConversation';\n\nregisterIcon(mailIcon);\n\nexport const StyledEmailHeader = styled.header``;\nexport const StyledEmailConversationList = styled.ul``;\nexport const StyledEmailShell = styled.div<EmailShellProps>(props => {\n const { theme } = props;\n return css`\n height: 100%;\n > ${StyledEmailHeader} {\n padding: ${theme.base.spacing} 0;\n }\n > ${StyledEmailConversationList} {\n height: 100%;\n overflow-y: auto;\n list-style-type: none;\n }\n `;\n});\n\nStyledEmailShell.defaultProps = defaultThemeProp;\n\nconst EmailShell: FunctionComponent<EmailShellProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<EmailShellProps>, ref: EmailShellProps['ref']) => {\n const { conversations, headerProps, autoCollapse = false, ...restProps } = props;\n\n const t = useI18n();\n\n const [activeIndex, setActiveIndex] = useState(0);\n\n const multiConversation = autoCollapse\n ? conversations?.map((conversation, index) => {\n const { onExpand, isCollapsed, ...rest } = conversation;\n const collapsed = index !== activeIndex;\n return (\n <EmailConversation\n onExpand={() => {\n setActiveIndex(index);\n if (onExpand) onExpand();\n }}\n isCollapsed={collapsed}\n {...rest}\n />\n );\n })\n : conversations?.map(conversation => {\n return <EmailConversation {...conversation} />;\n });\n\n const singleConversation = conversations?.map(conversation => {\n return (\n <StyledEmailConversation key={conversation.id}>\n {!!conversation.unReadEmailCount && (\n <Text as={StyledUnReadCount} variant='secondary'>\n {t('new_emails_count', [conversation.unReadEmailCount], {\n count: conversation.unReadEmailCount\n })}\n </Text>\n )}\n {conversation.emails?.map(email => {\n return <StyledEmailInConversation key={email.id} {...email} />;\n })}\n </StyledEmailConversation>\n );\n });\n\n return (\n <Flex as={StyledEmailShell} container={{ direction: 'column' }} ref={ref} {...restProps}>\n {headerProps && (\n <Flex\n container={{\n alignItems: 'center',\n justify: 'between',\n pad: 1\n }}\n as={StyledEmailHeader}\n >\n <Flex container={{ gap: 1, alignItems: 'center' }}>\n <Icon name='mail' />\n <Text variant='h3'>\n {headerProps?.subject ? `${t('subject')}: ${headerProps?.subject} ` : t('email')}\n </Text>\n </Flex>\n {headerProps?.actions}\n </Flex>\n )}\n <StyledEmailConversationList aria-multiselectable={!autoCollapse}>\n {conversations && conversations?.length === 1 ? singleConversation : multiConversation}\n </StyledEmailConversationList>\n </Flex>\n );\n }\n);\n\nexport default EmailShell;\n"]}
@@ -1,10 +0,0 @@
1
- import { FunctionComponent } from 'react';
2
- import { ForwardProps } from '@pega/cosmos-react-core';
3
- import { EmailSummaryItemProps } from './Email.types';
4
- interface StyledEmailSummaryItemProps extends EmailSummaryItemProps {
5
- isEmailItemActive: boolean;
6
- }
7
- export declare const StyledEmailSummaryItem: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, StyledEmailSummaryItemProps, never>;
8
- declare const EmailSummaryItem: FunctionComponent<EmailSummaryItemProps & ForwardProps>;
9
- export default EmailSummaryItem;
10
- //# sourceMappingURL=EmailSummaryItem.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EmailSummaryItem.d.ts","sourceRoot":"","sources":["../../../src/components/Email/EmailSummaryItem.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAW,MAAM,OAAO,CAAC;AAI/D,OAAO,EAEL,YAAY,EAUb,MAAM,yBAAyB,CAAC;AAIjC,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAsCtD,UAAU,2BAA4B,SAAQ,qBAAqB;IACjE,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AACD,eAAO,MAAM,sBAAsB,qIA2BjC,CAAC;AAMH,QAAA,MAAM,gBAAgB,EAAE,iBAAiB,CAAC,qBAAqB,GAAG,YAAY,CA+E7E,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -1,93 +0,0 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { forwardRef, useMemo } from 'react';
3
- import styled, { css } from 'styled-components';
4
- import { mix } from 'polished';
5
- import { defaultThemeProp, Text, Flex, Count, Sentiment, MetaList, DateTimeDisplay, Status, tryCatch, useI18n } from '@pega/cosmos-react-core';
6
- import BareButton from '@pega/cosmos-react-core/lib/components/Button/BareButton';
7
- import { StyledMetaList } from '@pega/cosmos-react-core/lib/components/MetaList/MetaList';
8
- const StyledMessage = styled(Flex)(({ unreadEmailCount, theme }) => {
9
- return css `
10
- text-overflow: ellipsis;
11
- overflow: hidden;
12
- margin-inline-end: ${theme.base.spacing};
13
- ${unreadEmailCount !== undefined &&
14
- unreadEmailCount > 0 &&
15
- css `
16
- color: ${theme.base.palette.interactive};
17
- `}
18
- `;
19
- });
20
- const StyledMessageAndDate = styled.div `
21
- white-space: nowrap;
22
- `;
23
- const StyledParticipants = styled(Flex)(({ unreadEmailCount, theme }) => {
24
- return css `
25
- ${unreadEmailCount !== undefined &&
26
- unreadEmailCount > 0 &&
27
- css `
28
- position: relative;
29
- &::before {
30
- content: '';
31
- position: absolute;
32
- inset-inline: calc(-1.5 * ${theme.base.spacing});
33
- inset-block-start: calc(0.8 * ${theme.base.spacing});
34
- width: 0.5rem;
35
- height: 0.5rem;
36
- border-radius: 50%;
37
- background-color: ${theme.base.palette.interactive};
38
- }
39
- `}
40
- `;
41
- });
42
- export const StyledEmailSummaryItem = styled.button(({ theme }) => {
43
- const hoverColor = tryCatch(() => mix(0.85, theme.base.palette['primary-background'], theme.base.palette.interactive));
44
- return css `
45
- width: 100%;
46
- color: ${theme.base.palette['foreground-color']};
47
- background-color: ${theme.base.palette['primary-background']};
48
- border-block-end: 0.0625rem solid ${theme.base.palette['border-line']};
49
- padding: ${theme.base.spacing} calc(2 * ${theme.base.spacing});
50
- ${StyledMetaList}, ${StyledMessageAndDate} {
51
- margin-block-start: ${theme.base.spacing};
52
- }
53
- & + & {
54
- margin-inline-start: 0;
55
- }
56
-
57
- &[aria-selected='true'],
58
- &[data-current='true'] {
59
- background-color: ${theme.base.palette['secondary-background']};
60
- }
61
-
62
- &:hover,
63
- &:focus-within {
64
- background-color: ${hoverColor};
65
- }
66
- `;
67
- });
68
- StyledEmailSummaryItem.defaultProps = defaultThemeProp;
69
- StyledParticipants.defaultProps = defaultThemeProp;
70
- StyledMessage.defaultProps = defaultThemeProp;
71
- const EmailSummaryItem = forwardRef(({ id, activeParticipants, sentiment, message, timeStamp, topic, urgency, active = false, onClick, unreadEmailCount, ...restProps }, ref) => {
72
- const t = useI18n();
73
- const items = useMemo(() => [
74
- _jsx(Status, { variant: 'info', children: topic }, 'info'),
75
- _jsx(_Fragment, { children: sentiment && _jsx(Sentiment, { variant: sentiment.variant, labelHidden: true }, void 0) }, void 0),
76
- _jsx(Text, { variant: 'secondary', children: `${t('priority')} ${urgency}` }, void 0)
77
- ], [sentiment, topic, urgency]);
78
- const emailParticipants = useMemo(() => {
79
- let participants = '';
80
- if (activeParticipants.length > 0) {
81
- participants =
82
- activeParticipants.length === 1
83
- ? activeParticipants[0].fullName
84
- : activeParticipants.map(participant => `${participant.shortName}`).join(', ');
85
- }
86
- return participants;
87
- }, [activeParticipants]);
88
- return (_jsxs(BareButton, { as: StyledEmailSummaryItem, ref: ref, ...restProps, id: id, onClick: onClick, active: active, "aria-selected": active, "aria-label": `${emailParticipants}, ${message} ${timeStamp} ${topic} ${sentiment?.variant} ${t('priority')} ${urgency}`, tabIndex: -1, children: [_jsxs(StyledParticipants, { unreadEmailCount: unreadEmailCount, container: { justify: 'between' }, children: [_jsx(Text, { variant: typeof unreadEmailCount === 'number' && unreadEmailCount > 0 ? 'h4' : 'primary', children: emailParticipants }, void 0), typeof unreadEmailCount === 'number' && unreadEmailCount > 0 && (_jsx(Count, { variant: 'default', children: unreadEmailCount }, void 0))] }, void 0), _jsxs(Flex, { container: {
89
- justify: 'between'
90
- }, as: StyledMessageAndDate, children: [_jsx(StyledMessage, { unreadEmailCount: unreadEmailCount, children: message }, void 0), _jsx(DateTimeDisplay, { value: timeStamp, variant: 'date', format: 'short' }, void 0)] }, void 0), _jsx(MetaList, { items: items }, void 0)] }, void 0));
91
- });
92
- export default EmailSummaryItem;
93
- //# sourceMappingURL=EmailSummaryItem.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EmailSummaryItem.js","sourceRoot":"","sources":["../../../src/components/Email/EmailSummaryItem.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAqB,OAAO,EAAE,MAAM,OAA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C,IAAI,CAAC,CAAC,CAAC,SAAS,YAGhF,iBAAiB,WACb,EACN,OAAO,gBAAgB,KAAK,QAAQ,IAAI,gBAAgB,GAAG,CAAC,IAAI,CAC/D,KAAC,KAAK,IAAC,OAAO,EAAC,SAAS,YAAE,gBAAgB,WAAS,CACpD,YACkB,EACrB,MAAC,IAAI,IACH,SAAS,EAAE;oBACT,OAAO,EAAE,SAAS;iBACnB,EACD,EAAE,EAAE,oBAAoB,aAExB,KAAC,aAAa,IAAC,gBAAgB,EAAE,gBAAgB,YAAG,OAAO,WAAiB,EAC5E,KAAC,eAAe,IAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAC,MAAM,EAAC,MAAM,EAAC,OAAO,WAAG,YAC9D,EACP,KAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,WAAI,YACf,CACd,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, useMemo } from 'react';\nimport styled, { css } from 'styled-components';\nimport { mix } from 'polished';\n\nimport {\n defaultThemeProp,\n ForwardProps,\n Text,\n Flex,\n Count,\n Sentiment,\n MetaList,\n DateTimeDisplay,\n Status,\n tryCatch,\n useI18n\n} from '@pega/cosmos-react-core';\nimport BareButton from '@pega/cosmos-react-core/lib/components/Button/BareButton';\nimport { StyledMetaList } from '@pega/cosmos-react-core/lib/components/MetaList/MetaList';\n\nimport { EmailSummaryItemProps } from './Email.types';\n\nconst StyledMessage = styled(Flex)<EmailSummaryItemProps>(({ unreadEmailCount, theme }) => {\n return css`\n text-overflow: ellipsis;\n overflow: hidden;\n margin-inline-end: ${theme.base.spacing};\n ${unreadEmailCount !== undefined &&\n unreadEmailCount > 0 &&\n css`\n color: ${theme.base.palette.interactive};\n `}\n `;\n});\n\nconst StyledMessageAndDate = styled.div`\n white-space: nowrap;\n`;\n\nconst StyledParticipants = styled(Flex)<EmailSummaryItemProps>(({ unreadEmailCount, theme }) => {\n return css`\n ${unreadEmailCount !== undefined &&\n unreadEmailCount > 0 &&\n css`\n position: relative;\n &::before {\n content: '';\n position: absolute;\n inset-inline: calc(-1.5 * ${theme.base.spacing});\n inset-block-start: calc(0.8 * ${theme.base.spacing});\n width: 0.5rem;\n height: 0.5rem;\n border-radius: 50%;\n background-color: ${theme.base.palette.interactive};\n }\n `}\n `;\n});\ninterface StyledEmailSummaryItemProps extends EmailSummaryItemProps {\n isEmailItemActive: boolean;\n}\nexport const StyledEmailSummaryItem = styled.button<StyledEmailSummaryItemProps>(({ theme }) => {\n const hoverColor = tryCatch(() =>\n mix(0.85, theme.base.palette['primary-background'], theme.base.palette.interactive)\n );\n return css`\n width: 100%;\n color: ${theme.base.palette['foreground-color']};\n background-color: ${theme.base.palette['primary-background']};\n border-block-end: 0.0625rem solid ${theme.base.palette['border-line']};\n padding: ${theme.base.spacing} calc(2 * ${theme.base.spacing});\n ${StyledMetaList}, ${StyledMessageAndDate} {\n margin-block-start: ${theme.base.spacing};\n }\n & + & {\n margin-inline-start: 0;\n }\n\n &[aria-selected='true'],\n &[data-current='true'] {\n background-color: ${theme.base.palette['secondary-background']};\n }\n\n &:hover,\n &:focus-within {\n background-color: ${hoverColor};\n }\n `;\n});\n\nStyledEmailSummaryItem.defaultProps = defaultThemeProp;\nStyledParticipants.defaultProps = defaultThemeProp;\nStyledMessage.defaultProps = defaultThemeProp;\n\nconst EmailSummaryItem: FunctionComponent<EmailSummaryItemProps & ForwardProps> = forwardRef(\n (\n {\n id,\n activeParticipants,\n sentiment,\n message,\n timeStamp,\n topic,\n urgency,\n active = false,\n onClick,\n unreadEmailCount,\n ...restProps\n },\n ref: EmailSummaryItemProps['ref']\n ) => {\n const t = useI18n();\n const items = useMemo(\n () => [\n <Status variant='info' key='info'>\n {topic}\n </Status>,\n <>{sentiment && <Sentiment variant={sentiment.variant} labelHidden />}</>,\n <Text variant='secondary'>{`${t('priority')} ${urgency}`}</Text>\n ],\n [sentiment, topic, urgency]\n );\n\n const emailParticipants = useMemo(() => {\n let participants = '';\n if (activeParticipants.length > 0) {\n participants =\n activeParticipants.length === 1\n ? activeParticipants[0].fullName\n : activeParticipants.map(participant => `${participant.shortName}`).join(', ');\n }\n return participants;\n }, [activeParticipants]);\n\n return (\n <BareButton\n as={StyledEmailSummaryItem}\n ref={ref}\n {...restProps}\n id={id}\n onClick={onClick}\n active={active}\n aria-selected={active}\n aria-label={`${emailParticipants}, ${message} ${timeStamp} ${topic} ${\n sentiment?.variant\n } ${t('priority')} ${urgency}`}\n tabIndex={-1}\n >\n <StyledParticipants unreadEmailCount={unreadEmailCount} container={{ justify: 'between' }}>\n <Text\n variant={\n typeof unreadEmailCount === 'number' && unreadEmailCount > 0 ? 'h4' : 'primary'\n }\n >\n {emailParticipants}\n </Text>\n {typeof unreadEmailCount === 'number' && unreadEmailCount > 0 && (\n <Count variant='default'>{unreadEmailCount}</Count>\n )}\n </StyledParticipants>\n <Flex\n container={{\n justify: 'between'\n }}\n as={StyledMessageAndDate}\n >\n <StyledMessage unreadEmailCount={unreadEmailCount}>{message}</StyledMessage>\n <DateTimeDisplay value={timeStamp} variant='date' format='short' />\n </Flex>\n <MetaList items={items} />\n </BareButton>\n );\n }\n);\n\nexport default EmailSummaryItem;\n"]}