@pega/cosmos-react-social 2.0.0-dev.9.2 → 2.0.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/lib/components/Chat/Chat.d.ts +2 -2
  2. package/lib/components/Chat/Chat.d.ts.map +1 -1
  3. package/lib/components/Chat/Chat.js +6 -11
  4. package/lib/components/Chat/Chat.js.map +1 -1
  5. package/lib/components/Chat/ChatBody.js +2 -2
  6. package/lib/components/Chat/ChatBody.js.map +1 -1
  7. package/lib/components/Chat/ChatComposer.d.ts.map +1 -1
  8. package/lib/components/Chat/ChatComposer.js +20 -26
  9. package/lib/components/Chat/ChatComposer.js.map +1 -1
  10. package/lib/components/Chat/ChatHeader.d.ts +2 -2
  11. package/lib/components/Chat/ChatHeader.d.ts.map +1 -1
  12. package/lib/components/Chat/ChatHeader.js +4 -6
  13. package/lib/components/Chat/ChatHeader.js.map +1 -1
  14. package/lib/components/Chat/ChatTranscript.d.ts.map +1 -1
  15. package/lib/components/Chat/ChatTranscript.js +6 -7
  16. package/lib/components/Chat/ChatTranscript.js.map +1 -1
  17. package/lib/components/Chat/Message.d.ts.map +1 -1
  18. package/lib/components/Chat/Message.js +22 -30
  19. package/lib/components/Chat/Message.js.map +1 -1
  20. package/lib/components/Chat/Message.styles.js +2 -2
  21. package/lib/components/Chat/Message.styles.js.map +1 -1
  22. package/lib/components/Chat/MessageList.d.ts.map +1 -1
  23. package/lib/components/Chat/MessageList.js +11 -12
  24. package/lib/components/Chat/MessageList.js.map +1 -1
  25. package/lib/components/Chat/RepeatingView.js +6 -8
  26. package/lib/components/Chat/RepeatingView.js.map +1 -1
  27. package/lib/components/Chat/SuggestedReplyPicker.d.ts.map +1 -1
  28. package/lib/components/Chat/SuggestedReplyPicker.js +16 -16
  29. package/lib/components/Chat/SuggestedReplyPicker.js.map +1 -1
  30. package/lib/components/Chat/SystemMessage.js +2 -2
  31. package/lib/components/Chat/SystemMessage.js.map +1 -1
  32. package/lib/components/Chat/TranscriptMessage.js +3 -7
  33. package/lib/components/Chat/TranscriptMessage.js.map +1 -1
  34. package/lib/components/Chat/TypeIndicator.js +1 -1
  35. package/lib/components/Chat/TypeIndicator.js.map +1 -1
  36. package/lib/components/Email/Email.d.ts.map +1 -1
  37. package/lib/components/Email/Email.js +42 -80
  38. package/lib/components/Email/Email.js.map +1 -1
  39. package/lib/components/Email/Email.styles.d.ts +7 -2
  40. package/lib/components/Email/Email.styles.d.ts.map +1 -1
  41. package/lib/components/Email/Email.styles.js +75 -26
  42. package/lib/components/Email/Email.styles.js.map +1 -1
  43. package/lib/components/Email/Email.types.d.ts +144 -63
  44. package/lib/components/Email/Email.types.d.ts.map +1 -1
  45. package/lib/components/Email/Email.types.js.map +1 -1
  46. package/lib/components/Email/EmailComposer.d.ts +4 -6
  47. package/lib/components/Email/EmailComposer.d.ts.map +1 -1
  48. package/lib/components/Email/EmailComposer.js +174 -62
  49. package/lib/components/Email/EmailComposer.js.map +1 -1
  50. package/lib/components/Email/EmailConversation.d.ts +3 -1
  51. package/lib/components/Email/EmailConversation.d.ts.map +1 -1
  52. package/lib/components/Email/EmailConversation.js +88 -56
  53. package/lib/components/Email/EmailConversation.js.map +1 -1
  54. package/lib/components/Email/EmailEntity.d.ts +3 -7
  55. package/lib/components/Email/EmailEntity.d.ts.map +1 -1
  56. package/lib/components/Email/EmailEntity.js +11 -22
  57. package/lib/components/Email/EmailEntity.js.map +1 -1
  58. package/lib/components/Email/EmailSelector.d.ts +19 -0
  59. package/lib/components/Email/EmailSelector.d.ts.map +1 -0
  60. package/lib/components/Email/EmailSelector.js +103 -0
  61. package/lib/components/Email/EmailSelector.js.map +1 -0
  62. package/lib/components/Email/EmailShell.d.ts.map +1 -1
  63. package/lib/components/Email/EmailShell.js +18 -23
  64. package/lib/components/Email/EmailShell.js.map +1 -1
  65. package/lib/components/Email/EmailSummaryItem.d.ts +10 -0
  66. package/lib/components/Email/EmailSummaryItem.d.ts.map +1 -0
  67. package/lib/components/Email/EmailSummaryItem.js +93 -0
  68. package/lib/components/Email/EmailSummaryItem.js.map +1 -0
  69. package/lib/components/Email/EmailSummaryList.d.ts +6 -0
  70. package/lib/components/Email/EmailSummaryList.d.ts.map +1 -0
  71. package/lib/components/Email/EmailSummaryList.js +115 -0
  72. package/lib/components/Email/EmailSummaryList.js.map +1 -0
  73. package/lib/components/Email/ViewAnalysis.d.ts +6 -0
  74. package/lib/components/Email/ViewAnalysis.d.ts.map +1 -0
  75. package/lib/components/Email/ViewAnalysis.js +20 -0
  76. package/lib/components/Email/ViewAnalysis.js.map +1 -0
  77. package/lib/components/Feed/Feed.context.d.ts +12 -2
  78. package/lib/components/Feed/Feed.context.d.ts.map +1 -1
  79. package/lib/components/Feed/Feed.context.js +3 -1
  80. package/lib/components/Feed/Feed.context.js.map +1 -1
  81. package/lib/components/Feed/Feed.d.ts +12 -5
  82. package/lib/components/Feed/Feed.d.ts.map +1 -1
  83. package/lib/components/Feed/Feed.js +38 -17
  84. package/lib/components/Feed/Feed.js.map +1 -1
  85. package/lib/components/Feed/FeedAnnouncer.d.ts +7 -0
  86. package/lib/components/Feed/FeedAnnouncer.d.ts.map +1 -0
  87. package/lib/components/Feed/FeedAnnouncer.js +11 -0
  88. package/lib/components/Feed/FeedAnnouncer.js.map +1 -0
  89. package/lib/components/Feed/FeedAttachments.d.ts +3 -0
  90. package/lib/components/Feed/FeedAttachments.d.ts.map +1 -1
  91. package/lib/components/Feed/FeedAttachments.js +79 -14
  92. package/lib/components/Feed/FeedAttachments.js.map +1 -1
  93. package/lib/components/Feed/FeedButton.d.ts.map +1 -1
  94. package/lib/components/Feed/FeedButton.js.map +1 -1
  95. package/lib/components/Feed/FeedContent.d.ts.map +1 -1
  96. package/lib/components/Feed/FeedContent.js +10 -2
  97. package/lib/components/Feed/FeedContent.js.map +1 -1
  98. package/lib/components/Feed/FeedLikeButton.d.ts +19 -0
  99. package/lib/components/Feed/FeedLikeButton.d.ts.map +1 -0
  100. package/lib/components/Feed/FeedLikeButton.js +87 -0
  101. package/lib/components/Feed/FeedLikeButton.js.map +1 -0
  102. package/lib/components/Feed/FeedModalList.js +2 -4
  103. package/lib/components/Feed/FeedModalList.js.map +1 -1
  104. package/lib/components/Feed/FeedNewPost.d.ts.map +1 -1
  105. package/lib/components/Feed/FeedNewPost.js +33 -30
  106. package/lib/components/Feed/FeedNewPost.js.map +1 -1
  107. package/lib/components/Feed/FeedNewPostTypeMenu.d.ts +2 -1
  108. package/lib/components/Feed/FeedNewPostTypeMenu.d.ts.map +1 -1
  109. package/lib/components/Feed/FeedNewPostTypeMenu.js +27 -50
  110. package/lib/components/Feed/FeedNewPostTypeMenu.js.map +1 -1
  111. package/lib/components/Feed/FeedPost.d.ts +3 -100
  112. package/lib/components/Feed/FeedPost.d.ts.map +1 -1
  113. package/lib/components/Feed/FeedPost.js +56 -95
  114. package/lib/components/Feed/FeedPost.js.map +1 -1
  115. package/lib/components/Feed/FeedPost.types.d.ts +101 -0
  116. package/lib/components/Feed/FeedPost.types.d.ts.map +1 -0
  117. package/lib/components/Feed/FeedPost.types.js +2 -0
  118. package/lib/components/Feed/FeedPost.types.js.map +1 -0
  119. package/lib/components/Feed/FeedReply.d.ts +3 -67
  120. package/lib/components/Feed/FeedReply.d.ts.map +1 -1
  121. package/lib/components/Feed/FeedReply.js +24 -69
  122. package/lib/components/Feed/FeedReply.js.map +1 -1
  123. package/lib/components/Feed/FeedReply.types.d.ts +68 -0
  124. package/lib/components/Feed/FeedReply.types.d.ts.map +1 -0
  125. package/lib/components/Feed/FeedReply.types.js +2 -0
  126. package/lib/components/Feed/FeedReply.types.js.map +1 -0
  127. package/lib/components/Feed/FeedReplyInput.d.ts.map +1 -1
  128. package/lib/components/Feed/FeedReplyInput.js +24 -27
  129. package/lib/components/Feed/FeedReplyInput.js.map +1 -1
  130. package/lib/components/Feed/FeedRichText.d.ts.map +1 -1
  131. package/lib/components/Feed/FeedRichText.js +80 -19
  132. package/lib/components/Feed/FeedRichText.js.map +1 -1
  133. package/lib/components/HashtagButton/HashtagButton.d.ts +5 -3
  134. package/lib/components/HashtagButton/HashtagButton.d.ts.map +1 -1
  135. package/lib/components/HashtagButton/HashtagButton.js +22 -16
  136. package/lib/components/HashtagButton/HashtagButton.js.map +1 -1
  137. package/lib/components/MentionButton/MentionButton.d.ts +9 -3
  138. package/lib/components/MentionButton/MentionButton.d.ts.map +1 -1
  139. package/lib/components/MentionButton/MentionButton.js +33 -16
  140. package/lib/components/MentionButton/MentionButton.js.map +1 -1
  141. package/package.json +13 -14
@@ -1 +1 @@
1
- {"version":3,"file":"EmailConversation.js","sourceRoot":"","sources":["../../../src/components/Email/EmailConversation.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAsC,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACzF,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EACL,MAAM,EACN,KAAK,EACL,cAAc,EACd,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,gBAAgB,EAEhB,qBAAqB,EACrB,eAAe,EACf,WAAW,EACX,aAAa,EACd,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,qDAAqD,CAAC;AAElF,OAAO,KAAK,MAAM,SAAS,CAAC;AAG5B,MAAM,uBAAuB,GAAG,GAAG,CAAA;;;;;CAKlC,CAAC;AAEF,MAAM,CAAC,MAAM,2BAA2B,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;IACnD,uBAAuB;CAC1B,CAAC;AAEF,MAAM,CAAC,MAAM,6BAA6B,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;IACrD,uBAAuB;qBACN,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO;CACrD,CAAC;AACF,6BAA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wBAClD,CAAC,CAAC,aACW,aACO,CAC3B,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,iBAAiB,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, PropsWithoutRef, useRef, useState } from 'react';\nimport styled, { css } from 'styled-components';\nimport { readableColor } from 'polished';\n\nimport {\n Button,\n Count,\n ExpandCollapse,\n Flex,\n Icon,\n Text,\n useI18n,\n defaultThemeProp,\n ForwardProps,\n useAfterInitialEffect,\n DateTimeDisplay,\n readableHue,\n useBreakpoint\n} from '@pega/cosmos-react-core';\nimport { StyledCount } from '@pega/cosmos-react-core/lib/components/Badges/Count';\n\nimport Email from './Email';\nimport { EmailConversationProps } from './Email.types';\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\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(({ theme }) => {\n return css`\n background-color: ${theme.base.palette['primary-background']};\n border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};\n position: sticky;\n top: 0;\n z-index: 1;\n\n ${StyledCount} {\n display: inline-flex;\n flex-shrink: 0;\n justify-content: center;\n align-items: center;\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['background-color']\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 width: fit-content;\n `;\n});\nStyledUnReadCount.defaultProps = defaultThemeProp;\n\nexport const StyledEmailConversation = styled.li``;\nStyledEmailConversation.defaultProps = defaultThemeProp;\n\nexport const StyledEmailInConversation = styled(Email)(({ unRead, theme: { base } }) => {\n const readableBackground = readableHue(\n base.palette['brand-primary'],\n base.palette['background-color']\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(({ theme }) => {\n const readableBackground = readableHue(\n theme.base.palette['brand-primary'],\n theme.base.palette['primary-background']\n );\n return css`\n width: 0.5em;\n height: 0.5em;\n border-radius: 50%;\n background: ${readableBackground};\n `;\n});\nStyledUnreadIndicator.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\n return (\n <StyledEmailConversation {...restProps} id={id} ref={ref}>\n <Flex\n as={StyledConversationHeader}\n container={{ gap: 1, alignItems: 'center', pad: 1 }}\n ref={headerRef}\n >\n <Flex\n container={{\n alignItems: 'center',\n gap: 1\n }}\n item={{\n shrink: 0,\n alignSelf: 'start'\n }}\n >\n <Button\n variant='simple'\n id={`conversation-heading${id}`}\n aria-controls={id}\n aria-expanded={!collapsedState}\n icon\n onClick={onExpandCollapse}\n >\n <Icon name={collapsedState ? 'caret-right' : 'caret-down'} />\n </Button>\n </Flex>\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 {`${t('from')}: ${from.fullName}`}\n </Text>\n <Text variant='secondary' as={StyledEmailParticipantsText}>\n {[\n `${t('to')}: `,\n (() => {\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 })()\n ]}\n </Text>\n {!isSmallOrAbove && (\n <Text variant='secondary' as={StyledCompactTimeStampDisplay}>\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 <DateTimeDisplay variant='datetime' format='short' value={timeStamp} />\n </Text>\n )}\n\n {isForwarded && (\n <Icon name='forward' aria-label={t('forwarded_email')} as={StyledForwardIcon} />\n )}\n {!!unReadEmailCount && (\n <>\n <StyledUnreadIndicator />\n <Count aria-labelledby={`unread-emailCount-${id}`}>{unReadEmailCount}</Count>\n </>\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('n_new_emails', unReadEmailCount)}\n </Text>\n )}\n {emails &&\n emails.map(email => {\n return <StyledEmailInConversation {...email} />;\n })}\n </ExpandCollapse>\n </StyledEmailConversation>\n );\n }\n);\n\nexport default EmailConversation;\n"]}
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,mBAAmB,CAAC;AAChD,OAAO,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,OAAO,KAAK,aAAa,MAAM,mEAAmE,CAAC;AACnG,OAAO,EACL,cAAc,EACd,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,IAAI,EACJ,OAAO,EACP,gBAAgB,EAEhB,qBAAqB,EACrB,eAAe,EACf,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,UAAU,EACV,QAAQ,EACR,YAAY,EACb,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,MAAM,SAAS,CAAC;AAG5B,YAAY,CAAC,aAAa,CAAC,CAAC;AAE5B,MAAM,uBAAuB,GAAG,GAAG,CAAA;;;;;CAKlC,CAAC;AAEF,MAAM,CAAC,MAAM,2BAA2B,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;IACnD,uBAAuB;WAChB,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC;CAC/D,CAAC;AAEF,2BAA2B,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE5D,MAAM,CAAC,MA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B,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 color: ${props => props.theme.base.palette['foreground-color']};\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,10 +1,6 @@
1
- import { FunctionComponent, Ref } from 'react';
2
- import { BaseProps, ForwardProps } from '@pega/cosmos-react-core';
3
- import { EntityHighlightMapping } from './Email.types';
4
- export interface EmailEntityProps extends BaseProps {
5
- entity: EntityHighlightMapping;
6
- ref?: Ref<HTMLElement>;
7
- }
1
+ import { FunctionComponent } from 'react';
2
+ import { ForwardProps } from '@pega/cosmos-react-core';
3
+ import { EmailEntityProps } from './Email.types';
8
4
  declare const EmailEntity: FunctionComponent<EmailEntityProps & ForwardProps>;
9
5
  export default EmailEntity;
10
6
  //# sourceMappingURL=EmailEntity.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EmailEntity.d.ts","sourceRoot":"","sources":["../../../src/components/Email/EmailEntity.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAmB,GAAG,EAAE,MAAM,OAAO,CAAC;AAI5E,OAAO,EACL,SAAS,EACT,YAAY,EAOb,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAGvD,MAAM,WAAW,gBAAiB,SAAQ,SAAS;IACjD,MAAM,EAAE,sBAAsB,CAAC;IAC/B,GAAG,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC;CACxB;AA4BD,QAAA,MAAM,WAAW,EAAE,iBAAiB,CAAC,gBAAgB,GAAG,YAAY,CAiBnE,CAAC;AAEF,eAAe,WAAW,CAAC"}
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,30 +1,19 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { forwardRef } from 'react';
3
- import styled, { css } from 'styled-components';
4
- import { readableColor } from 'polished';
5
- import { Tooltip, tryCatch, useConsolidatedRef, useElement, readableHue, defaultThemeProp } from '@pega/cosmos-react-core';
6
- import { EmailEntityBackgroundColors } from './Email.styles';
7
- const getBackgroundColor = (variant, backgroundColor) => {
8
- return readableHue(EmailEntityBackgroundColors[variant % EmailEntityBackgroundColors.length], backgroundColor);
9
- };
10
- const getTextColor = (variant, backgroundColor) => {
11
- const entityColor = getBackgroundColor(variant, backgroundColor);
12
- return tryCatch(() => readableColor(entityColor));
13
- };
14
- const StyledEmailEntity = styled.mark(({ entity, theme }) => {
15
- const backgroundColor = getBackgroundColor(entity.entityVariant, theme.base.palette['primary-background']);
16
- const textColor = getTextColor(entity.entityVariant, theme.base.palette['primary-background']);
17
- return css `
18
- background-color: ${backgroundColor};
19
- color: ${textColor};
20
- `;
21
- });
22
- StyledEmailEntity.defaultProps = defaultThemeProp;
3
+ import { Tooltip, useConsolidatedRef, useElement, useI18n, useConfiguration, formatListToLocaleString, Icon } from '@pega/cosmos-react-core';
4
+ import { StyledEmailEntity } from './Email.styles';
23
5
  const EmailEntity = forwardRef(({ entity, ...restProps }, ref) => {
24
6
  const [el, setEl] = useElement();
25
7
  const elementRef = useConsolidatedRef(setEl, ref);
26
- return (_jsxs(StyledEmailEntity, Object.assign({}, restProps, { entity: entity, ref: elementRef, "aria-label": `${entity.entityName}=${entity.entityValue}` }, { children: [entity.entityValue,
27
- _jsx(Tooltip, Object.assign({ target: el }, { children: `${entity.entityName}=${entity.entityValue}` }), void 0)] }), void 0));
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));
28
17
  });
29
18
  export default EmailEntity;
30
19
  //# sourceMappingURL=EmailEntity.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"EmailEntity.js","sourceRoot":"","sources":["../../../src/components/Email/EmailEntity.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAA2C,MAAM,OAAO,CAAC;AAC5E,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAGL,OAAO,EACP,QAAQ,EACR,kBAAkB,EAClB,UAAU,EACV,WAAW,EACX,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAO7D,MAAM,kBAAkB,GAAG,CAAC,OAAe,EAAE,eAAuB,EAAE,EAAE;IACtE,OAAO,WAAW,CAChB,2BAA2B,CAAC,OAAO,GAAG,2BAA2B,CAAC,MAAM,CAAC,EACzE,eAAe,CAChB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,OAAe,EAAE,eAAuB,EAAE,EAAE;IAChE,MAAM,WAAW,GAAG,kBAAkB,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IACjE,OAAO,QAAQ,CAAC,GAAG,EAAE,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC;AACpD,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAG,MAAM,CAAC,IAAI,CAAmB,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE;IAC5E,MAAM,eAAe,GAAG,kBAAkB,CACxC,MAAM,CAAC,aAAa,EACpB,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,CACzC,CAAC;IACF,MAAM,SAAS,GAAG,YAAY,CAAC,MAAM,CAAC,aAAa,EAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC;IAC/F,OAAO,GAAG,CAAA;wBACY,eAAe;aAC1B,SAAS;GACnB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,iBAAiB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAElD,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;IAE/D,OAAO,CACL,MAAC,iBAAiB,oBACZ,SAAS,IACb,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,UAAU,gBACH,GAAG,MAAM,CAAC,UAAU,IAAI,MAAM,CAAC,WAAW,EAAE,iBAEvD,MAAM,CAAC,WAAW;YACnB,KAAC,OAAO,kBAAC,MAAM,EAAE,EAAE,gBAAG,GAAG,MAAM,CAAC,UAAU,IAAI,MAAM,CAAC,WAAW,EAAE,YAAW,aAC3D,CACrB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, PropsWithoutRef, Ref } from 'react';\nimport styled, { css } from 'styled-components';\nimport { readableColor } from 'polished';\n\nimport {\n BaseProps,\n ForwardProps,\n Tooltip,\n tryCatch,\n useConsolidatedRef,\n useElement,\n readableHue,\n defaultThemeProp\n} from '@pega/cosmos-react-core';\n\nimport { EntityHighlightMapping } from './Email.types';\nimport { EmailEntityBackgroundColors } from './Email.styles';\n\nexport interface EmailEntityProps extends BaseProps {\n entity: EntityHighlightMapping;\n ref?: Ref<HTMLElement>;\n}\n\nconst getBackgroundColor = (variant: number, backgroundColor: string) => {\n return readableHue(\n EmailEntityBackgroundColors[variant % EmailEntityBackgroundColors.length],\n backgroundColor\n );\n};\n\nconst getTextColor = (variant: number, backgroundColor: string) => {\n const entityColor = getBackgroundColor(variant, backgroundColor);\n return tryCatch(() => readableColor(entityColor));\n};\n\nconst StyledEmailEntity = styled.mark<EmailEntityProps>(({ entity, theme }) => {\n const backgroundColor = getBackgroundColor(\n entity.entityVariant,\n theme.base.palette['primary-background']\n );\n const textColor = getTextColor(entity.entityVariant, theme.base.palette['primary-background']);\n return css`\n background-color: ${backgroundColor};\n color: ${textColor};\n `;\n});\n\nStyledEmailEntity.defaultProps = defaultThemeProp;\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\n return (\n <StyledEmailEntity\n {...restProps}\n entity={entity}\n ref={elementRef}\n aria-label={`${entity.entityName}=${entity.entityValue}`}\n >\n {entity.entityValue}\n <Tooltip target={el}>{`${entity.entityName}=${entity.entityValue}`}</Tooltip>\n </StyledEmailEntity>\n );\n }\n);\n\nexport default EmailEntity;\n"]}
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,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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"]}
@@ -0,0 +1,19 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,103 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EmailSelector.js","sourceRoot":"","sources":["../../../src/components/Email/EmailSelector.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAkC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAa,MAAM,OAAO,CAAC;AAEhG,OAAO,EACL,QAAQ,EAER,mBAAmB,EACnB,WAAW,EAEX,OAAO,EACR,MAAM,yBAAyB,CAAC;AAkBjC,MAAM,aAAa,GAEf,CAAC,EAAE,YAAY,EAAE,iBAAiB,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,iBAAiB,EAAE,EAAE,EAAE;IAChG,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IACnD,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAA8B,EAAE,CAAC,CAAC;IACpF,MAAM,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC;IACzE,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IAEpB,MAAM,WAAW,GAAG,mBAAmB,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;IAEjE,MAAM,cAAc,GAAG,OAAO,CAAC,GAAG,EAAE;QAClC,MAAM,aAAa,GAAG,CACpB,WAAW;YACT,CAAC,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC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EAAE,EAAE;YAC7C,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACjC,CAAC;QACD,MAAM,EAAE,GAAG,EAAE;YACX,cAAc,CAAC,EAAE,CAAC,CAAC;QACrB,CAAC;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,cAAc;YACrB,MAAM,EAAE,WAAW;YACnB,WAAW,EAAE,mBAAmB;SACjC;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,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 +1 @@
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;AAEjC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAOhD,eAAO,MAAM,iBAAiB,4GAAkB,CAAC;AACjD,eAAO,MAAM,2BAA2B,wGAAc,CAAC;AACvD,eAAO,MAAM,gBAAgB,sHAiB3B,CAAC;AAIH,QAAA,MAAM,UAAU,EAAE,iBAAiB,CAAC,eAAe,GAAG,YAAY,CAoEjE,CAAC;AAEF,eAAe,UAAU,CAAC"}
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,20 +1,18 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { forwardRef, useState } from 'react';
3
3
  import styled, { css } from 'styled-components';
4
- import { defaultThemeProp, Flex, Icon, StyledIcon, Text, useI18n } from '@pega/cosmos-react-core';
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';
5
6
  import EmailConversation, { StyledEmailConversation, StyledEmailInConversation, StyledUnReadCount } from './EmailConversation';
7
+ registerIcon(mailIcon);
6
8
  export const StyledEmailHeader = styled.header ``;
7
9
  export const StyledEmailConversationList = styled.ul ``;
8
10
  export const StyledEmailShell = styled.div(props => {
9
11
  const { theme } = props;
10
12
  return css `
11
- background-color: ${theme.base.palette['primary-background']};
12
13
  height: 100%;
13
14
  > ${StyledEmailHeader} {
14
- border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};
15
- ${StyledIcon} {
16
- margin: ${theme.base.spacing};
17
- }
15
+ padding: ${theme.base.spacing} 0;
18
16
  }
19
17
  > ${StyledEmailConversationList} {
20
18
  height: 100%;
@@ -29,33 +27,30 @@ const EmailShell = forwardRef((props, ref) => {
29
27
  const t = useI18n();
30
28
  const [activeIndex, setActiveIndex] = useState(0);
31
29
  const multiConversation = autoCollapse
32
- ? conversations === null || conversations === void 0 ? void 0 : conversations.map((conversation, index) => {
30
+ ? conversations?.map((conversation, index) => {
33
31
  const { onExpand, isCollapsed, ...rest } = conversation;
34
- const collapsed = !(index === activeIndex);
35
- return (_jsx(EmailConversation, Object.assign({ onExpand: () => {
32
+ const collapsed = index !== activeIndex;
33
+ return (_jsx(EmailConversation, { onExpand: () => {
36
34
  setActiveIndex(index);
37
35
  if (onExpand)
38
36
  onExpand();
39
- }, isCollapsed: collapsed }, rest), void 0));
37
+ }, isCollapsed: collapsed, ...rest }, void 0));
40
38
  })
41
- : conversations === null || conversations === void 0 ? void 0 : conversations.map(conversation => {
42
- return _jsx(EmailConversation, Object.assign({}, conversation), void 0);
39
+ : conversations?.map(conversation => {
40
+ return _jsx(EmailConversation, { ...conversation }, void 0);
43
41
  });
44
- const singleConversation = conversations === null || conversations === void 0 ? void 0 : conversations.map(conversation => {
45
- var _a;
46
- return (_jsxs(StyledEmailConversation, { children: [!!conversation.unReadEmailCount && (_jsx(Text, Object.assign({ as: StyledUnReadCount, variant: 'secondary' }, { children: t('n_new_emails', conversation.unReadEmailCount) }), void 0)),
47
- (_a = conversation === null || conversation === void 0 ? void 0 : conversation.emails) === null || _a === void 0 ? void 0 : _a.map(email => {
48
- return _jsx(StyledEmailInConversation, Object.assign({}, email), void 0);
49
- })] }, void 0));
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));
50
48
  });
51
- return (_jsxs(Flex, Object.assign({ as: StyledEmailShell, container: { direction: 'column' }, ref: ref }, restProps, { children: [headerProps && (_jsxs(Flex, Object.assign({ container: {
49
+ return (_jsxs(Flex, { as: StyledEmailShell, container: { direction: 'column' }, ref: ref, ...restProps, children: [headerProps && (_jsxs(Flex, { container: {
52
50
  alignItems: 'center',
53
51
  justify: 'between',
54
52
  pad: 1
55
- }, as: StyledEmailHeader }, { children: [_jsxs(Flex, Object.assign({ container: { gap: 1, alignItems: 'center' } }, { children: [_jsx(Icon, { name: 'mail-solid' }, void 0),
56
- _jsx(Text, Object.assign({ variant: 'h3' }, { children: (headerProps === null || headerProps === void 0 ? void 0 : headerProps.subject) ? `${t('subject')}: ${headerProps === null || headerProps === void 0 ? void 0 : headerProps.subject} ` : t('email') }), void 0)] }), void 0),
57
- headerProps === null || headerProps === void 0 ? void 0 : headerProps.actions] }), void 0)),
58
- _jsx(StyledEmailConversationList, Object.assign({ "aria-multiselectable": !autoCollapse }, { children: conversations && (conversations === null || conversations === void 0 ? void 0 : conversations.length) === 1 ? singleConversation : multiConversation }), void 0)] }), void 0));
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));
59
54
  });
60
55
  export default EmailShell;
61
56
  //# sourceMappingURL=EmailShell.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"EmailShell.js","sourceRoot":"","sources":["../../../src/components/Email/EmailShell.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,UAAU,EAAmB,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjF,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,gBAAgB,EAChB,IAAI,EAEJ,IAAI,EACJ,UAAU,EACV,IAAI,EACJ,OAAO,EACR,MAAM,yBAAyB,CAAC;AAGjC,OAAO,iBAAiB,EAAE,EACxB,uBAAuB,EACvB,yBAAyB,EACzB,iBAAiB,EAClB,MAAM,qBAAqB,CAAC;AAE7B,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,CAAA,EAAE,CAAC;AACjD,MAAM,CAAC,MAAM,2BAA2B,GAAG,MAAM,CAAC,EAAE,CAAA,EAAE,CAAC;AACvD,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAkB,KAAK,CAAC,EAAE;IAClE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IACxB,OAAO,GAAG,CAAA;wBACY,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC;;QAExD,iBAAiB;uCACc,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;QAChE,U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AAa,IAAI,CAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,MAAM,MAAK,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,iBAAiB,YAC1D,aACzB,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 StyledIcon,\n Text,\n useI18n\n} from '@pega/cosmos-react-core';\n\nimport { EmailShellProps } from './Email.types';\nimport EmailConversation, {\n StyledEmailConversation,\n StyledEmailInConversation,\n StyledUnReadCount\n} from './EmailConversation';\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 background-color: ${theme.base.palette['primary-background']};\n height: 100%;\n > ${StyledEmailHeader} {\n border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};\n ${StyledIcon} {\n margin: ${theme.base.spacing};\n }\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>\n {!!conversation.unReadEmailCount && (\n <Text as={StyledUnReadCount} variant='secondary'>\n {t('n_new_emails', conversation.unReadEmailCount)}\n </Text>\n )}\n {conversation?.emails?.map(email => {\n return <StyledEmailInConversation {...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-solid' />\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
+ {"version":3,"file":"EmailShell.js","sourceRoot":"","sources":["../../../src/components/Email/EmailShell.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,UAAU,EAAmB,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjF,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,gBAAgB,EAChB,IAAI,EAEJ,IAAI,EACJ,YAAY,EACZ,IAAI,EACJ,OAAO,EACR,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,QAAQ,MAAM,6DAA6D,CAAC;AAGxF,OAAO,iBAAiB,EAAE,EACxB,uBAAuB,EACvB,yBAAyB,EACzB,iBAAiB,EAClB,MAAM,qBAAqB,CAAC;AAE7B,YAAY,CAAC,QAAQ,CAAC,CAAC;AAEvB,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,CAAA,EAAE,CAAC;AACjD,MA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AC,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"]}
@@ -0,0 +1,10 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,93 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EmailSummaryItem.js","sourceRoot":"","sources":["../../../src/components/Email/EmailSummaryItem.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAqB,OAAO,EAAE,MAAM,OAAO,CAAC;AAC/D,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,OAAO,EACL,gBAAgB,EAEhB,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,SAAS,EACT,QAAQ,EACR,eAAe,EACf,MAAM,EACN,QAAQ,EACR,OAAO,EACR,MAAM,yBAAyB,CAAC;AACjC,OAAO,UAAU,MAAM,0DAA0D,CAAC;AAClF,OAAO,EAAE,cAAc,EAAE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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"]}
@@ -0,0 +1,6 @@
1
+ import { FunctionComponent } from 'react';
2
+ import { ForwardProps } from '@pega/cosmos-react-core';
3
+ import { EmailSummaryListProps } from './Email.types';
4
+ declare const EmailSummaryList: FunctionComponent<EmailSummaryListProps & ForwardProps>;
5
+ export default EmailSummaryList;
6
+ //# sourceMappingURL=EmailSummaryList.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EmailSummaryList.d.ts","sourceRoot":"","sources":["../../../src/components/Email/EmailSummaryList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAOL,iBAAiB,EAElB,MAAM,OAAO,CAAC;AAGf,OAAO,EAKL,YAAY,EAUb,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAiDtD,QAAA,MAAM,gBAAgB,EAAE,iBAAiB,CAAC,qBAAqB,GAAG,YAAY,CAwI7E,CAAC;AAEF,eAAe,gBAAgB,CAAC"}