@pega/cosmos-react-social 2.1.6 → 2.1.7

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/lib/components/Chat/Chat.d.ts +31 -0
  2. package/lib/components/Chat/Chat.d.ts.map +1 -0
  3. package/lib/components/Chat/Chat.js +67 -0
  4. package/lib/components/Chat/Chat.js.map +1 -0
  5. package/lib/components/Chat/Chat.types.d.ts +23 -0
  6. package/lib/components/Chat/Chat.types.d.ts.map +1 -0
  7. package/lib/components/Chat/Chat.types.js +2 -0
  8. package/lib/components/Chat/Chat.types.js.map +1 -0
  9. package/lib/components/Chat/ChatBody.d.ts +12 -0
  10. package/lib/components/Chat/ChatBody.d.ts.map +1 -0
  11. package/lib/components/Chat/ChatBody.js +18 -0
  12. package/lib/components/Chat/ChatBody.js.map +1 -0
  13. package/lib/components/Chat/ChatComposer.d.ts +51 -0
  14. package/lib/components/Chat/ChatComposer.d.ts.map +1 -0
  15. package/lib/components/Chat/ChatComposer.js +213 -0
  16. package/lib/components/Chat/ChatComposer.js.map +1 -0
  17. package/lib/components/Chat/ChatHeader.d.ts +15 -0
  18. package/lib/components/Chat/ChatHeader.d.ts.map +1 -0
  19. package/lib/components/Chat/ChatHeader.js +28 -0
  20. package/lib/components/Chat/ChatHeader.js.map +1 -0
  21. package/lib/components/Chat/ChatTranscript.d.ts +23 -0
  22. package/lib/components/Chat/ChatTranscript.d.ts.map +1 -0
  23. package/lib/components/Chat/ChatTranscript.js +45 -0
  24. package/lib/components/Chat/ChatTranscript.js.map +1 -0
  25. package/lib/components/Chat/Message.d.ts +46 -0
  26. package/lib/components/Chat/Message.d.ts.map +1 -0
  27. package/lib/components/Chat/Message.js +59 -0
  28. package/lib/components/Chat/Message.js.map +1 -0
  29. package/lib/components/Chat/Message.styles.d.ts +29 -0
  30. package/lib/components/Chat/Message.styles.d.ts.map +1 -0
  31. package/lib/components/Chat/Message.styles.js +193 -0
  32. package/lib/components/Chat/Message.styles.js.map +1 -0
  33. package/lib/components/Chat/MessageList.d.ts +35 -0
  34. package/lib/components/Chat/MessageList.d.ts.map +1 -0
  35. package/lib/components/Chat/MessageList.js +123 -0
  36. package/lib/components/Chat/MessageList.js.map +1 -0
  37. package/lib/components/Chat/RepeatingView.d.ts +31 -0
  38. package/lib/components/Chat/RepeatingView.d.ts.map +1 -0
  39. package/lib/components/Chat/RepeatingView.js +47 -0
  40. package/lib/components/Chat/RepeatingView.js.map +1 -0
  41. package/lib/components/Chat/SuggestedReplyPicker.d.ts +26 -0
  42. package/lib/components/Chat/SuggestedReplyPicker.d.ts.map +1 -0
  43. package/lib/components/Chat/SuggestedReplyPicker.js +78 -0
  44. package/lib/components/Chat/SuggestedReplyPicker.js.map +1 -0
  45. package/lib/components/Chat/SystemMessage.d.ts +19 -0
  46. package/lib/components/Chat/SystemMessage.d.ts.map +1 -0
  47. package/lib/components/Chat/SystemMessage.js +40 -0
  48. package/lib/components/Chat/SystemMessage.js.map +1 -0
  49. package/lib/components/Chat/TranscriptMessage.d.ts +25 -0
  50. package/lib/components/Chat/TranscriptMessage.d.ts.map +1 -0
  51. package/lib/components/Chat/TranscriptMessage.js +47 -0
  52. package/lib/components/Chat/TranscriptMessage.js.map +1 -0
  53. package/lib/components/Chat/TypeIndicator.d.ts +13 -0
  54. package/lib/components/Chat/TypeIndicator.d.ts.map +1 -0
  55. package/lib/components/Chat/TypeIndicator.js +9 -0
  56. package/lib/components/Chat/TypeIndicator.js.map +1 -0
  57. package/lib/components/Chat/index.d.ts +14 -0
  58. package/lib/components/Chat/index.d.ts.map +1 -0
  59. package/lib/components/Chat/index.js +13 -0
  60. package/lib/components/Chat/index.js.map +1 -0
  61. package/lib/components/Email/Email.d.ts +6 -0
  62. package/lib/components/Email/Email.d.ts.map +1 -0
  63. package/lib/components/Email/Email.js +153 -0
  64. package/lib/components/Email/Email.js.map +1 -0
  65. package/lib/components/Email/Email.styles.d.ts +18 -0
  66. package/lib/components/Email/Email.styles.d.ts.map +1 -0
  67. package/lib/components/Email/Email.styles.js +131 -0
  68. package/lib/components/Email/Email.styles.js.map +1 -0
  69. package/lib/components/Email/Email.types.d.ts +237 -0
  70. package/lib/components/Email/Email.types.d.ts.map +1 -0
  71. package/lib/components/Email/Email.types.js +2 -0
  72. package/lib/components/Email/Email.types.js.map +1 -0
  73. package/lib/components/Email/EmailComposer.d.ts +9 -0
  74. package/lib/components/Email/EmailComposer.d.ts.map +1 -0
  75. package/lib/components/Email/EmailComposer.js +185 -0
  76. package/lib/components/Email/EmailComposer.js.map +1 -0
  77. package/lib/components/Email/EmailConversation.d.ts +14 -0
  78. package/lib/components/Email/EmailConversation.d.ts.map +1 -0
  79. package/lib/components/Email/EmailConversation.js +179 -0
  80. package/lib/components/Email/EmailConversation.js.map +1 -0
  81. package/lib/components/Email/EmailEntity.d.ts +6 -0
  82. package/lib/components/Email/EmailEntity.d.ts.map +1 -0
  83. package/lib/components/Email/EmailEntity.js +19 -0
  84. package/lib/components/Email/EmailEntity.js.map +1 -0
  85. package/lib/components/Email/EmailSelector.d.ts +19 -0
  86. package/lib/components/Email/EmailSelector.d.ts.map +1 -0
  87. package/lib/components/Email/EmailSelector.js +103 -0
  88. package/lib/components/Email/EmailSelector.js.map +1 -0
  89. package/lib/components/Email/EmailShell.d.ts +9 -0
  90. package/lib/components/Email/EmailShell.d.ts.map +1 -0
  91. package/lib/components/Email/EmailShell.js +56 -0
  92. package/lib/components/Email/EmailShell.js.map +1 -0
  93. package/lib/components/Email/EmailSummaryItem.d.ts +10 -0
  94. package/lib/components/Email/EmailSummaryItem.d.ts.map +1 -0
  95. package/lib/components/Email/EmailSummaryItem.js +93 -0
  96. package/lib/components/Email/EmailSummaryItem.js.map +1 -0
  97. package/lib/components/Email/EmailSummaryList.d.ts +6 -0
  98. package/lib/components/Email/EmailSummaryList.d.ts.map +1 -0
  99. package/lib/components/Email/EmailSummaryList.js +115 -0
  100. package/lib/components/Email/EmailSummaryList.js.map +1 -0
  101. package/lib/components/Email/ViewAnalysis.d.ts +6 -0
  102. package/lib/components/Email/ViewAnalysis.d.ts.map +1 -0
  103. package/lib/components/Email/ViewAnalysis.js +20 -0
  104. package/lib/components/Email/ViewAnalysis.js.map +1 -0
  105. package/lib/components/Email/index.d.ts +9 -0
  106. package/lib/components/Email/index.d.ts.map +1 -0
  107. package/lib/components/Email/index.js +8 -0
  108. package/lib/components/Email/index.js.map +1 -0
  109. package/lib/components/Feed/Feed.context.d.ts +35 -0
  110. package/lib/components/Feed/Feed.context.d.ts.map +1 -0
  111. package/lib/components/Feed/Feed.context.js +8 -0
  112. package/lib/components/Feed/Feed.context.js.map +1 -0
  113. package/lib/components/Feed/Feed.d.ts +52 -0
  114. package/lib/components/Feed/Feed.d.ts.map +1 -0
  115. package/lib/components/Feed/Feed.js +143 -0
  116. package/lib/components/Feed/Feed.js.map +1 -0
  117. package/lib/components/Feed/FeedAnnouncer.d.ts +7 -0
  118. package/lib/components/Feed/FeedAnnouncer.d.ts.map +1 -0
  119. package/lib/components/Feed/FeedAnnouncer.js +11 -0
  120. package/lib/components/Feed/FeedAnnouncer.js.map +1 -0
  121. package/lib/components/Feed/FeedAttachments.d.ts +14 -0
  122. package/lib/components/Feed/FeedAttachments.d.ts.map +1 -0
  123. package/lib/components/Feed/FeedAttachments.js +94 -0
  124. package/lib/components/Feed/FeedAttachments.js.map +1 -0
  125. package/lib/components/Feed/FeedButton.d.ts +6 -0
  126. package/lib/components/Feed/FeedButton.d.ts.map +1 -0
  127. package/lib/components/Feed/FeedButton.js +23 -0
  128. package/lib/components/Feed/FeedButton.js.map +1 -0
  129. package/lib/components/Feed/FeedContent.d.ts +14 -0
  130. package/lib/components/Feed/FeedContent.d.ts.map +1 -0
  131. package/lib/components/Feed/FeedContent.js +39 -0
  132. package/lib/components/Feed/FeedContent.js.map +1 -0
  133. package/lib/components/Feed/FeedLikeButton.d.ts +19 -0
  134. package/lib/components/Feed/FeedLikeButton.d.ts.map +1 -0
  135. package/lib/components/Feed/FeedLikeButton.js +87 -0
  136. package/lib/components/Feed/FeedLikeButton.js.map +1 -0
  137. package/lib/components/Feed/FeedModalList.d.ts +15 -0
  138. package/lib/components/Feed/FeedModalList.d.ts.map +1 -0
  139. package/lib/components/Feed/FeedModalList.js +49 -0
  140. package/lib/components/Feed/FeedModalList.js.map +1 -0
  141. package/lib/components/Feed/FeedNewPost.d.ts +36 -0
  142. package/lib/components/Feed/FeedNewPost.d.ts.map +1 -0
  143. package/lib/components/Feed/FeedNewPost.js +108 -0
  144. package/lib/components/Feed/FeedNewPost.js.map +1 -0
  145. package/lib/components/Feed/FeedNewPostTypeMenu.d.ts +35 -0
  146. package/lib/components/Feed/FeedNewPostTypeMenu.d.ts.map +1 -0
  147. package/lib/components/Feed/FeedNewPostTypeMenu.js +387 -0
  148. package/lib/components/Feed/FeedNewPostTypeMenu.js.map +1 -0
  149. package/lib/components/Feed/FeedPost.d.ts +10 -0
  150. package/lib/components/Feed/FeedPost.d.ts.map +1 -0
  151. package/lib/components/Feed/FeedPost.js +185 -0
  152. package/lib/components/Feed/FeedPost.js.map +1 -0
  153. package/lib/components/Feed/FeedPost.types.d.ts +101 -0
  154. package/lib/components/Feed/FeedPost.types.d.ts.map +1 -0
  155. package/lib/components/Feed/FeedPost.types.js +2 -0
  156. package/lib/components/Feed/FeedPost.types.js.map +1 -0
  157. package/lib/components/Feed/FeedReply.d.ts +10 -0
  158. package/lib/components/Feed/FeedReply.d.ts.map +1 -0
  159. package/lib/components/Feed/FeedReply.js +131 -0
  160. package/lib/components/Feed/FeedReply.js.map +1 -0
  161. package/lib/components/Feed/FeedReply.types.d.ts +68 -0
  162. package/lib/components/Feed/FeedReply.types.d.ts.map +1 -0
  163. package/lib/components/Feed/FeedReply.types.js +2 -0
  164. package/lib/components/Feed/FeedReply.types.js.map +1 -0
  165. package/lib/components/Feed/FeedReplyInput.d.ts +32 -0
  166. package/lib/components/Feed/FeedReplyInput.d.ts.map +1 -0
  167. package/lib/components/Feed/FeedReplyInput.js +105 -0
  168. package/lib/components/Feed/FeedReplyInput.js.map +1 -0
  169. package/lib/components/Feed/FeedRichText.d.ts +9 -0
  170. package/lib/components/Feed/FeedRichText.d.ts.map +1 -0
  171. package/lib/components/Feed/FeedRichText.js +96 -0
  172. package/lib/components/Feed/FeedRichText.js.map +1 -0
  173. package/lib/components/Feed/index.d.ts +10 -0
  174. package/lib/components/Feed/index.d.ts.map +1 -0
  175. package/lib/components/Feed/index.js +6 -0
  176. package/lib/components/Feed/index.js.map +1 -0
  177. package/lib/components/HashtagButton/HashtagButton.d.ts +16 -0
  178. package/lib/components/HashtagButton/HashtagButton.d.ts.map +1 -0
  179. package/lib/components/HashtagButton/HashtagButton.js +31 -0
  180. package/lib/components/HashtagButton/HashtagButton.js.map +1 -0
  181. package/lib/components/HashtagButton/index.d.ts +3 -0
  182. package/lib/components/HashtagButton/index.d.ts.map +1 -0
  183. package/lib/components/HashtagButton/index.js +3 -0
  184. package/lib/components/HashtagButton/index.js.map +1 -0
  185. package/lib/components/MentionButton/MentionButton.d.ts +20 -0
  186. package/lib/components/MentionButton/MentionButton.d.ts.map +1 -0
  187. package/lib/components/MentionButton/MentionButton.js +58 -0
  188. package/lib/components/MentionButton/MentionButton.js.map +1 -0
  189. package/lib/components/MentionButton/index.d.ts +3 -0
  190. package/lib/components/MentionButton/index.d.ts.map +1 -0
  191. package/lib/components/MentionButton/index.js +3 -0
  192. package/lib/components/MentionButton/index.js.map +1 -0
  193. package/lib/index.d.ts +11 -0
  194. package/lib/index.d.ts.map +1 -0
  195. package/lib/index.js +12 -0
  196. package/lib/index.js.map +1 -0
  197. package/package.json +4 -4
@@ -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,G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EAAE;QACb,UAAU,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;IACnC,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;IAEpB,MAAM,aAAa,GAAG;QACpB,KAAK,EAAE,WAAW;QAClB,QAAQ,EAAE,CAAC,CAAgC,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"]}
@@ -0,0 +1,9 @@
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
@@ -0,0 +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;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"}
@@ -0,0 +1,56 @@
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
@@ -0,0 +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,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,MAAM,CAAC,MAAM,2BAA2B,GAAG,MAAM,CAAC,EAAE,CAAA,EAAE,CAAC;AACvD,MAAM,CAAC,MAAM,gBAAgB,GAA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AAY,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,MAAM,0DAA0D,CAAC;AAI1F,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,CAAwB,CAAC,EAAE,gBAAgB,EAA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G,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"}
@@ -0,0 +1,115 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { createRef, useMemo, useState, useEffect, forwardRef, useRef } from 'react';
3
+ import styled, { css } from 'styled-components';
4
+ import { Button, Count, defaultThemeProp, Flex, Icon, registerIcon, MenuButton, Text, useActiveDescendant, useConsolidatedRef, useI18n, menuHelpers } from '@pega/cosmos-react-core';
5
+ import * as filterIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/filter.icon';
6
+ import EmailSummaryItem, { StyledEmailSummaryItem } from './EmailSummaryItem';
7
+ registerIcon(filterIcon);
8
+ const StyledEmailSummaryListContainer = styled(Flex)(({ theme }) => {
9
+ return css `
10
+ height: 100%;
11
+ background-color: ${theme.base.palette['primary-background']};
12
+ `;
13
+ });
14
+ StyledEmailSummaryListContainer.defaultProps = defaultThemeProp;
15
+ const StyledEmailSummaryListHeader = styled.div(({ theme }) => {
16
+ return css `
17
+ padding: calc(2 * ${theme.base.spacing}) calc(2 * ${theme.base.spacing}) ${theme.base.spacing};
18
+ `;
19
+ });
20
+ StyledEmailSummaryListHeader.defaultProps = defaultThemeProp;
21
+ const StyledActionWrapper = styled(Flex)(({ theme }) => {
22
+ return css `
23
+ padding-block-start: ${theme.base.spacing};
24
+ `;
25
+ });
26
+ StyledActionWrapper.defaultProps = defaultThemeProp;
27
+ const StyledFilterButton = styled(Button) `
28
+ margin-inline-start: auto;
29
+ `;
30
+ const StyledEmailSummaryList = styled.div(({ theme }) => {
31
+ return css `
32
+ height: 100%;
33
+ overflow-y: auto;
34
+
35
+ &:focus-visible {
36
+ outline: none;
37
+ }
38
+
39
+ &:focus {
40
+ ${StyledEmailSummaryItem}[data-current='true'] {
41
+ box-shadow: inset ${theme.base.shadow.focus};
42
+ }
43
+ }
44
+ `;
45
+ });
46
+ StyledEmailSummaryList.defaultProps = defaultThemeProp;
47
+ const EmailSummaryList = forwardRef(({ categories, onCategoryClick, items, unreadEmailCount, filters, onFilterChange, onItemClick, ...restProps }, ref) => {
48
+ const t = useI18n();
49
+ const tablistRef = useConsolidatedRef(ref);
50
+ const tabRefs = items.map(() => createRef());
51
+ const [focusDescendant, setFocusDescendant] = useState(null);
52
+ const previousActiveDescendant = useRef();
53
+ const [listHasBeenViewed, setListHasBeenViewed] = useState(false);
54
+ const [clickOnInitialView, setClickOnInitialView] = useState(false);
55
+ const uadConfig = useMemo(() => ({
56
+ focusEl: tablistRef.current,
57
+ scope: tablistRef.current,
58
+ selector: 'button[role="tab"]',
59
+ focusDescendantEl: focusDescendant,
60
+ clearFocusDescendant: () => {
61
+ setFocusDescendant(null);
62
+ tablistRef.current?.focus();
63
+ },
64
+ pauseDescendantEvaluation: !listHasBeenViewed
65
+ }), [tablistRef.current, focusDescendant, listHasBeenViewed]);
66
+ const { activeDescendant } = useActiveDescendant(uadConfig);
67
+ // Trigger click of new active descendant
68
+ useEffect(() => {
69
+ const hasPreviousOrClickInitial = previousActiveDescendant.current || clickOnInitialView;
70
+ if (hasPreviousOrClickInitial && activeDescendant) {
71
+ activeDescendant.click();
72
+ }
73
+ previousActiveDescendant.current = activeDescendant;
74
+ }, [activeDescendant]);
75
+ const buttonText = useMemo(() => {
76
+ return (menuHelpers.getSelected(categories)[0]?.primary ??
77
+ menuHelpers.flatten(categories)[0].primary);
78
+ }, [categories]);
79
+ return (_jsxs(StyledEmailSummaryListContainer, { container: { direction: 'column' }, ...restProps, children: [_jsxs(StyledEmailSummaryListHeader, { children: [_jsx(Text, { variant: 'h2', children: t('inbox') }, void 0), _jsxs(StyledActionWrapper, { container: { alignItems: 'center', gap: 0.5 }, children: [_jsx(MenuButton, { text: buttonText, variant: 'text', menu: {
80
+ mode: 'single-select',
81
+ items: categories,
82
+ onItemClick: onCategoryClick
83
+ } }, void 0), unreadEmailCount && (_jsx(Count, { "aria-label": t('unread_email_count', [unreadEmailCount], {
84
+ count: unreadEmailCount
85
+ }), variant: 'default', children: unreadEmailCount }, void 0)), _jsx(StyledFilterButton, { variant: 'simple', label: t('email_filters'), icon: true, children: _jsx(Icon, { name: 'filter' }, void 0) }, void 0)] }, void 0)] }, void 0), _jsx(StyledEmailSummaryList, { role: 'tablist', tabIndex: 0, ref: tablistRef, onFocus: e => {
86
+ if (!listHasBeenViewed && e.target.getAttribute('role') === 'tablist') {
87
+ setClickOnInitialView(true);
88
+ setListHasBeenViewed(true);
89
+ }
90
+ }, children: items.map((emailItem, i) => {
91
+ const { id, ...emailItemProps } = emailItem;
92
+ return (_jsx(EmailSummaryItem, { ref: tabRefs[i], id: id, role: 'tab', ...emailItemProps, onClick: (e) => {
93
+ const mouseClick = e.detail !== 0;
94
+ if (mouseClick) {
95
+ const target = e.target;
96
+ const focusAtEl = target.getAttribute('role') === 'tab'
97
+ ? target
98
+ : target.closest('button[role="tab"]');
99
+ if (focusAtEl)
100
+ setFocusDescendant(focusAtEl);
101
+ if (!listHasBeenViewed) {
102
+ if (i === 0)
103
+ setClickOnInitialView(true);
104
+ setListHasBeenViewed(true);
105
+ }
106
+ }
107
+ // Click is triggered by active descendant change, 'enter', & duplicate click
108
+ if (!mouseClick || activeDescendant?.id === id) {
109
+ onItemClick(id);
110
+ }
111
+ }, active: activeDescendant && activeDescendant.id === id }, id));
112
+ }) }, void 0)] }, void 0));
113
+ });
114
+ export default EmailSummaryList;
115
+ //# sourceMappingURL=EmailSummaryList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EmailSummaryList.js","sourceRoot":"","sources":["../../../src/components/Email/EmailSummaryList.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,SAAS,EACT,OAAO,EACP,QAAQ,EACR,SAAS,EACT,UAAU,EACV,MAAM,EAGP,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,MAAM,EACN,KAAK,EACL,gBAAgB,EAChB,IAAI,EAEJ,IAAI,EACJ,YAAY,EACZ,UAAU,EACV,IAAI,EACJ,mBAAmB,EAEnB,kBAAkB,EAClB,OAAO,EACP,WAAW,EACZ,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,UAAU,MAAM,+DAA+D,CAAC;AAG5F,OAAO,gBAAgB,EAAE,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAE9E,YAAY,CAAC,UAAU,CAAC,CAAC;AAEzB,MAAM,+BAA+B,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACjE,OAAO,GAAG,CAAA;;wB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xBjD,EAAE,CAyBP,CACH,CAAC;gBACJ,CAAC,CAAC,WACqB,YACO,CACnC,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["import {\n createRef,\n useMemo,\n useState,\n useEffect,\n forwardRef,\n useRef,\n FunctionComponent,\n MouseEvent\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Button,\n Count,\n defaultThemeProp,\n Flex,\n ForwardProps,\n Icon,\n registerIcon,\n MenuButton,\n Text,\n useActiveDescendant,\n UseActiveDescendantConfig,\n useConsolidatedRef,\n useI18n,\n menuHelpers\n} from '@pega/cosmos-react-core';\nimport * as filterIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/filter.icon';\n\nimport { EmailSummaryListProps } from './Email.types';\nimport EmailSummaryItem, { StyledEmailSummaryItem } from './EmailSummaryItem';\n\nregisterIcon(filterIcon);\n\nconst StyledEmailSummaryListContainer = styled(Flex)(({ theme }) => {\n return css`\n height: 100%;\n background-color: ${theme.base.palette['primary-background']};\n `;\n});\nStyledEmailSummaryListContainer.defaultProps = defaultThemeProp;\n\nconst StyledEmailSummaryListHeader = styled.div(({ theme }) => {\n return css`\n padding: calc(2 * ${theme.base.spacing}) calc(2 * ${theme.base.spacing}) ${theme.base.spacing};\n `;\n});\nStyledEmailSummaryListHeader.defaultProps = defaultThemeProp;\n\nconst StyledActionWrapper = styled(Flex)(({ theme }) => {\n return css`\n padding-block-start: ${theme.base.spacing};\n `;\n});\nStyledActionWrapper.defaultProps = defaultThemeProp;\n\nconst StyledFilterButton = styled(Button)`\n margin-inline-start: auto;\n`;\n\nconst StyledEmailSummaryList = styled.div(({ theme }) => {\n return css`\n height: 100%;\n overflow-y: auto;\n\n &:focus-visible {\n outline: none;\n }\n\n &:focus {\n ${StyledEmailSummaryItem}[data-current='true'] {\n box-shadow: inset ${theme.base.shadow.focus};\n }\n }\n `;\n});\nStyledEmailSummaryList.defaultProps = defaultThemeProp;\n\nconst EmailSummaryList: FunctionComponent<EmailSummaryListProps & ForwardProps> = forwardRef(\n (\n {\n categories,\n onCategoryClick,\n items,\n unreadEmailCount,\n filters,\n onFilterChange,\n onItemClick,\n ...restProps\n },\n ref: EmailSummaryListProps['ref']\n ) => {\n const t = useI18n();\n const tablistRef = useConsolidatedRef(ref);\n const tabRefs = items.map(() => createRef<HTMLButtonElement>());\n const [focusDescendant, setFocusDescendant] = useState<HTMLElement | null>(null);\n const previousActiveDescendant = useRef<HTMLElement | undefined>();\n const [listHasBeenViewed, setListHasBeenViewed] = useState(false);\n const [clickOnInitialView, setClickOnInitialView] = useState(false);\n\n const uadConfig = useMemo<UseActiveDescendantConfig>(\n () => ({\n focusEl: tablistRef.current,\n scope: tablistRef.current,\n selector: 'button[role=\"tab\"]',\n focusDescendantEl: focusDescendant,\n clearFocusDescendant: () => {\n setFocusDescendant(null);\n tablistRef.current?.focus();\n },\n pauseDescendantEvaluation: !listHasBeenViewed\n }),\n [tablistRef.current, focusDescendant, listHasBeenViewed]\n );\n\n const { activeDescendant } = useActiveDescendant(uadConfig);\n\n // Trigger click of new active descendant\n useEffect(() => {\n const hasPreviousOrClickInitial = previousActiveDescendant.current || clickOnInitialView;\n\n if (hasPreviousOrClickInitial && activeDescendant) {\n activeDescendant.click();\n }\n\n previousActiveDescendant.current = activeDescendant;\n }, [activeDescendant]);\n\n const buttonText = useMemo(() => {\n return (\n menuHelpers.getSelected(categories)[0]?.primary ??\n menuHelpers.flatten(categories)[0].primary\n );\n }, [categories]);\n\n return (\n <StyledEmailSummaryListContainer container={{ direction: 'column' }} {...restProps}>\n <StyledEmailSummaryListHeader>\n <Text variant='h2'>{t('inbox')}</Text>\n <StyledActionWrapper container={{ alignItems: 'center', gap: 0.5 }}>\n <MenuButton\n text={buttonText}\n variant='text'\n menu={{\n mode: 'single-select',\n items: categories,\n onItemClick: onCategoryClick\n }}\n />\n {unreadEmailCount && (\n <Count\n aria-label={t('unread_email_count', [unreadEmailCount], {\n count: unreadEmailCount\n })}\n variant='default'\n >\n {unreadEmailCount}\n </Count>\n )}\n <StyledFilterButton variant='simple' label={t('email_filters')} icon>\n <Icon name='filter' />\n </StyledFilterButton>\n </StyledActionWrapper>\n </StyledEmailSummaryListHeader>\n\n <StyledEmailSummaryList\n role='tablist'\n tabIndex={0}\n ref={tablistRef}\n onFocus={e => {\n if (!listHasBeenViewed && e.target.getAttribute('role') === 'tablist') {\n setClickOnInitialView(true);\n setListHasBeenViewed(true);\n }\n }}\n >\n {items.map((emailItem, i) => {\n const { id, ...emailItemProps } = emailItem;\n return (\n <EmailSummaryItem\n ref={tabRefs[i]}\n id={id}\n key={id}\n role='tab'\n {...emailItemProps}\n onClick={(e: MouseEvent) => {\n const mouseClick = e.detail !== 0;\n\n if (mouseClick) {\n const target = e.target as HTMLElement;\n const focusAtEl =\n target.getAttribute('role') === 'tab'\n ? target\n : target.closest('button[role=\"tab\"]');\n if (focusAtEl) setFocusDescendant(focusAtEl as HTMLElement);\n\n if (!listHasBeenViewed) {\n if (i === 0) setClickOnInitialView(true);\n setListHasBeenViewed(true);\n }\n }\n // Click is triggered by active descendant change, 'enter', & duplicate click\n if (!mouseClick || activeDescendant?.id === id) {\n onItemClick(id);\n }\n }}\n active={activeDescendant && activeDescendant.id === id}\n />\n );\n })}\n </StyledEmailSummaryList>\n </StyledEmailSummaryListContainer>\n );\n }\n);\n\nexport default EmailSummaryList;\n"]}
@@ -0,0 +1,6 @@
1
+ import { FunctionComponent } from 'react';
2
+ import { ForwardProps } from '@pega/cosmos-react-core';
3
+ import { ViewAnalysisProps } from './Email.types';
4
+ declare const ViewAnalysis: FunctionComponent<ViewAnalysisProps & ForwardProps>;
5
+ export default ViewAnalysis;
6
+ //# sourceMappingURL=ViewAnalysis.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ViewAnalysis.d.ts","sourceRoot":"","sources":["../../../src/components/Email/ViewAnalysis.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAmB,MAAM,OAAO,CAAC;AAEvE,OAAO,EACL,YAAY,EAOb,MAAM,yBAAyB,CAAC;AAIjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,QAAA,MAAM,YAAY,EAAE,iBAAiB,CAAC,iBAAiB,GAAG,YAAY,CA6BrE,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { forwardRef } from 'react';
3
+ import { Text, Flex, Icon, Card, CardHeader, CardContent } from '@pega/cosmos-react-core';
4
+ import { StyledViewAnalysisFieldValueList } from './Email.styles';
5
+ import EmailEntity from './EmailEntity';
6
+ const ViewAnalysis = forwardRef(({ content, header }, ref) => {
7
+ const fields = content.map(data => {
8
+ return data.value
9
+ ? {
10
+ ...data,
11
+ value: (_jsx(Flex, { container: { gap: 0.5, wrap: 'wrap' }, children: data.value.map(entityObject => {
12
+ return _jsx(EmailEntity, { entity: entityObject.entity }, entityObject.id);
13
+ }) }, void 0))
14
+ }
15
+ : data;
16
+ });
17
+ return (_jsxs(Card, { ref: ref, children: [_jsxs(CardHeader, { container: { alignItems: 'center', gap: 1 }, children: [_jsx(Icon, { name: header.icon }, void 0), _jsx(Text, { variant: 'h3', children: header.text }, void 0)] }, void 0), _jsx(CardContent, { children: _jsx(StyledViewAnalysisFieldValueList, { fields: fields, variant: 'stacked' }, void 0) }, void 0)] }, void 0));
18
+ });
19
+ export default ViewAnalysis;
20
+ //# sourceMappingURL=ViewAnalysis.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ViewAnalysis.js","sourceRoot":"","sources":["../../../src/components/Email/ViewAnalysis.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAsC,MAAM,OAAO,CAAC;AAEvE,OAAO,EAEL,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,UAAU,EACV,WAAW,EACZ,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,gCAAgC,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,WAAW,MAAM,eAAe,CAAC;AAGxC,MAAM,YAAY,GAAwD,UAAU,CAClF,CAAC,EAAE,OAAO,EAAE,MAAM,EAAsC,EAAE,GAA6B,EAAE,EAAE;IACzF,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;QAChC,OAAO,IAAI,CAAC,KAAK;YACf,CAAC,CAAC;gBACE,GAAG,IAAI;gBACP,KAAK,EAAE,CACL,KAAC,IAAI,IAAC,SAAS,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,YACxC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE;wBAC7B,OAAO,KAAC,WAAW,IAAuB,MAAM,EAAE,YAAY,CAAC,MAAM,IAA5C,YAAY,CAAC,EAAE,CAAiC,CAAC;oBAC5E,CAAC,CAAC,WACG,CACR;aACF;YACH,CAAC,CAAC,IAAI,CAAC;IACX,CAAC,CAAC,CAAC;IAEH,OAAO,CACL,MAAC,IAAI,IAAC,GAAG,EAAE,GAAG,aACZ,MAAC,UAAU,IAAC,SAAS,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,aACrD,KAAC,IAAI,IAAC,IAAI,EAAE,MAAM,CAAC,IAAI,WAAI,EAC3B,KAAC,IAAI,IAAC,OAAO,EAAC,IAAI,YAAE,MAAM,CAAC,IAAI,WAAQ,YAC5B,EACb,KAAC,WAAW,cACV,KAAC,gCAAgC,IAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAC,SAAS,WAAG,WAC1D,YACT,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, PropsWithoutRef } from 'react';\n\nimport {\n ForwardProps,\n Text,\n Flex,\n Icon,\n Card,\n CardHeader,\n CardContent\n} from '@pega/cosmos-react-core';\n\nimport { StyledViewAnalysisFieldValueList } from './Email.styles';\nimport EmailEntity from './EmailEntity';\nimport { ViewAnalysisProps } from './Email.types';\n\nconst ViewAnalysis: FunctionComponent<ViewAnalysisProps & ForwardProps> = forwardRef(\n ({ content, header }: PropsWithoutRef<ViewAnalysisProps>, ref: ViewAnalysisProps['ref']) => {\n const fields = content.map(data => {\n return data.value\n ? {\n ...data,\n value: (\n <Flex container={{ gap: 0.5, wrap: 'wrap' }}>\n {data.value.map(entityObject => {\n return <EmailEntity key={entityObject.id} entity={entityObject.entity} />;\n })}\n </Flex>\n )\n }\n : data;\n });\n\n return (\n <Card ref={ref}>\n <CardHeader container={{ alignItems: 'center', gap: 1 }}>\n <Icon name={header.icon} />\n <Text variant='h3'>{header.text}</Text>\n </CardHeader>\n <CardContent>\n <StyledViewAnalysisFieldValueList fields={fields} variant='stacked' />\n </CardContent>\n </Card>\n );\n }\n);\n\nexport default ViewAnalysis;\n"]}
@@ -0,0 +1,9 @@
1
+ export { default } from './Email';
2
+ export { EmailUser, EmailProps, EmailComposerProps, EmailConversationProps, EmailShellProps, ViewAnalysisProps } from './Email.types';
3
+ export { default as EmailConversation } from './EmailConversation';
4
+ export { default as EmailShell } from './EmailShell';
5
+ export { default as EmailComposer } from './EmailComposer';
6
+ export { default as EmailSummaryItem } from './EmailSummaryItem';
7
+ export { default as EmailSummaryList } from './EmailSummaryList';
8
+ export { default as ViewAnalysis } from './ViewAnalysis';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Email/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EACL,SAAS,EACT,UAAU,EACV,kBAAkB,EAClB,sBAAsB,EACtB,eAAe,EACf,iBAAiB,EAClB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,8 @@
1
+ export { default } from './Email';
2
+ export { default as EmailConversation } from './EmailConversation';
3
+ export { default as EmailShell } from './EmailShell';
4
+ export { default as EmailComposer } from './EmailComposer';
5
+ export { default as EmailSummaryItem } from './EmailSummaryItem';
6
+ export { default as EmailSummaryList } from './EmailSummaryList';
7
+ export { default as ViewAnalysis } from './ViewAnalysis';
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Email/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AASlC,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC","sourcesContent":["export { default } from './Email';\nexport {\n EmailUser,\n EmailProps,\n EmailComposerProps,\n EmailConversationProps,\n EmailShellProps,\n ViewAnalysisProps\n} from './Email.types';\nexport { default as EmailConversation } from './EmailConversation';\nexport { default as EmailShell } from './EmailShell';\nexport { default as EmailComposer } from './EmailComposer';\nexport { default as EmailSummaryItem } from './EmailSummaryItem';\nexport { default as EmailSummaryList } from './EmailSummaryList';\nexport { default as ViewAnalysis } from './ViewAnalysis';\n"]}
@@ -0,0 +1,35 @@
1
+ import { Dispatch, SetStateAction } from 'react';
2
+ import { InteractionRenderers, MDMap } from '@pega/cosmos-react-rte';
3
+ import { MenuItemProps } from '@pega/cosmos-react-core';
4
+ export interface FeedContextValue {
5
+ searchTypes?: string[];
6
+ onSearch?: (e: {
7
+ type: 'mention' | 'tag';
8
+ search: string;
9
+ mentionType: string;
10
+ }) => void;
11
+ searchResults?: MenuItemProps[];
12
+ showSearchResults?: boolean;
13
+ setShowSearchResults?: Dispatch<SetStateAction<boolean>>;
14
+ onMentionClick?: (e: {
15
+ id: string;
16
+ text: string;
17
+ type: string;
18
+ }) => JSX.Element | undefined;
19
+ onTagClick?: (tag: string) => void;
20
+ interactionRenderers?: InteractionRenderers[];
21
+ markdownMap?: MDMap;
22
+ userInfo: {
23
+ username: string;
24
+ fullname: string;
25
+ avatarSrc?: string;
26
+ meta?: string[];
27
+ };
28
+ announce: (announcement: string) => void;
29
+ }
30
+ export declare const FeedContext: import("react").Context<FeedContextValue>;
31
+ export interface FeedReplyContextValue {
32
+ onShowReplyInput?: () => void;
33
+ }
34
+ export declare const FeedReplyContext: import("react").Context<FeedReplyContextValue>;
35
+ //# sourceMappingURL=Feed.context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Feed.context.d.ts","sourceRoot":"","sources":["../../../src/components/Feed/Feed.context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,QAAQ,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEhE,OAAO,EAAE,oBAAoB,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,MAAM,WAAW,gBAAgB;IAC/B,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE;QAAE,IAAI,EAAE,SAAS,GAAG,KAAK,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IACzF,aAAa,CAAC,EAAE,aAAa,EAAE,CAAC;IAChC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,oBAAoB,CAAC,EAAE,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IACzD,cAAc,CAAC,EAAE,CAAC,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,GAAG,CAAC,OAAO,GAAG,SAAS,CAAC;IAC5F,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,oBAAoB,CAAC,EAAE,oBAAoB,EAAE,CAAC;IAC9C,WAAW,CAAC,EAAE,KAAK,CAAC;IACpB,QAAQ,EAAE;QACR,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;KACjB,CAAC;IACF,QAAQ,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;CAC1C;AAED,eAAO,MAAM,WAAW,2CAItB,CAAC;AAEH,MAAM,WAAW,qBAAqB;IACpC,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;CAC/B;AAED,eAAO,MAAM,gBAAgB,gDAA2C,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { createContext } from 'react';
2
+ export const FeedContext = createContext({
3
+ searchTypes: [],
4
+ userInfo: { username: '', fullname: '' },
5
+ announce: () => { }
6
+ });
7
+ export const FeedReplyContext = createContext({});
8
+ //# sourceMappingURL=Feed.context.js.map