@pega/cosmos-react-social 8.0.0-build.9.0 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/Autopilot/Autopilot.d.ts.map +1 -1
- package/lib/components/Autopilot/Autopilot.js +2 -2
- package/lib/components/Autopilot/Autopilot.js.map +1 -1
- package/lib/components/Chat/Chat.d.ts +3 -3
- package/lib/components/Chat/Chat.d.ts.map +1 -1
- package/lib/components/Chat/Chat.js +1 -2
- package/lib/components/Chat/Chat.js.map +1 -1
- package/lib/components/Chat/Chat.types.d.ts +3 -1
- package/lib/components/Chat/Chat.types.d.ts.map +1 -1
- package/lib/components/Chat/Chat.types.js.map +1 -1
- package/lib/components/Chat/ChatBody.d.ts +2 -3
- package/lib/components/Chat/ChatBody.d.ts.map +1 -1
- package/lib/components/Chat/ChatBody.js +6 -8
- package/lib/components/Chat/ChatBody.js.map +1 -1
- package/lib/components/Chat/ChatComposer.d.ts +4 -4
- package/lib/components/Chat/ChatComposer.d.ts.map +1 -1
- package/lib/components/Chat/ChatComposer.js +15 -25
- package/lib/components/Chat/ChatComposer.js.map +1 -1
- package/lib/components/Chat/ChatHeader.d.ts +4 -3
- package/lib/components/Chat/ChatHeader.d.ts.map +1 -1
- package/lib/components/Chat/ChatHeader.js +3 -4
- package/lib/components/Chat/ChatHeader.js.map +1 -1
- package/lib/components/Chat/ChatSettingsPanel.styles.d.ts.map +1 -1
- package/lib/components/Chat/ChatSettingsPanel.styles.js +5 -2
- package/lib/components/Chat/ChatSettingsPanel.styles.js.map +1 -1
- package/lib/components/Chat/Message.d.ts +2 -3
- package/lib/components/Chat/Message.d.ts.map +1 -1
- package/lib/components/Chat/Message.js +6 -5
- package/lib/components/Chat/Message.js.map +1 -1
- package/lib/components/Chat/Message.styles.d.ts +2 -2
- package/lib/components/Chat/Message.styles.d.ts.map +1 -1
- package/lib/components/Chat/Message.styles.js +11 -3
- package/lib/components/Chat/Message.styles.js.map +1 -1
- package/lib/components/Chat/SuggestedReplyPicker.d.ts +3 -3
- package/lib/components/Chat/SuggestedReplyPicker.d.ts.map +1 -1
- package/lib/components/Chat/SuggestedReplyPicker.js +3 -3
- package/lib/components/Chat/SuggestedReplyPicker.js.map +1 -1
- package/lib/components/Chat/SystemMessage.d.ts +2 -3
- package/lib/components/Chat/SystemMessage.d.ts.map +1 -1
- package/lib/components/Chat/SystemMessage.js +1 -2
- package/lib/components/Chat/SystemMessage.js.map +1 -1
- package/lib/components/Chat/TypeIndicator.d.ts +2 -3
- package/lib/components/Chat/TypeIndicator.d.ts.map +1 -1
- package/lib/components/Chat/TypeIndicator.js +1 -2
- package/lib/components/Chat/TypeIndicator.js.map +1 -1
- package/lib/components/Email/ContextMenuPopover.d.ts +1 -2
- package/lib/components/Email/ContextMenuPopover.d.ts.map +1 -1
- package/lib/components/Email/ContextMenuPopover.js.map +1 -1
- package/lib/components/Email/Email.d.ts +2 -3
- package/lib/components/Email/Email.d.ts.map +1 -1
- package/lib/components/Email/Email.js +11 -4
- package/lib/components/Email/Email.js.map +1 -1
- package/lib/components/Email/Email.styles.d.ts +4 -4
- package/lib/components/Email/Email.styles.d.ts.map +1 -1
- package/lib/components/Email/Email.styles.js +6 -3
- package/lib/components/Email/Email.styles.js.map +1 -1
- package/lib/components/Email/Email.types.d.ts +16 -17
- package/lib/components/Email/Email.types.d.ts.map +1 -1
- package/lib/components/Email/Email.types.js.map +1 -1
- package/lib/components/Email/EmailCaseView.js +1 -1
- package/lib/components/Email/EmailCaseView.js.map +1 -1
- package/lib/components/Email/EmailComposer.d.ts +3 -4
- package/lib/components/Email/EmailComposer.d.ts.map +1 -1
- package/lib/components/Email/EmailComposer.js +29 -8
- package/lib/components/Email/EmailComposer.js.map +1 -1
- package/lib/components/Email/EmailConversation.d.ts +6 -7
- package/lib/components/Email/EmailConversation.d.ts.map +1 -1
- package/lib/components/Email/EmailConversation.js +2 -2
- package/lib/components/Email/EmailConversation.js.map +1 -1
- package/lib/components/Email/EmailEntity.d.ts +2 -3
- package/lib/components/Email/EmailEntity.d.ts.map +1 -1
- package/lib/components/Email/EmailEntity.js.map +1 -1
- package/lib/components/Email/EmailSelector.d.ts +6 -2
- package/lib/components/Email/EmailSelector.d.ts.map +1 -1
- package/lib/components/Email/EmailSelector.js +25 -29
- package/lib/components/Email/EmailSelector.js.map +1 -1
- package/lib/components/Email/EmailShell.d.ts +2 -3
- package/lib/components/Email/EmailShell.d.ts.map +1 -1
- package/lib/components/Email/EmailShell.js +1 -1
- package/lib/components/Email/EmailShell.js.map +1 -1
- package/lib/components/Email/EmailSummaryItem.d.ts +3 -7
- package/lib/components/Email/EmailSummaryItem.d.ts.map +1 -1
- package/lib/components/Email/EmailSummaryItem.js +26 -26
- package/lib/components/Email/EmailSummaryItem.js.map +1 -1
- package/lib/components/Email/EmailSummaryList.d.ts +2 -3
- package/lib/components/Email/EmailSummaryList.d.ts.map +1 -1
- package/lib/components/Email/EmailSummaryList.js +17 -9
- package/lib/components/Email/EmailSummaryList.js.map +1 -1
- package/lib/components/Email/EntityList.d.ts +1 -3
- package/lib/components/Email/EntityList.d.ts.map +1 -1
- package/lib/components/Email/EntityList.js.map +1 -1
- package/lib/components/Email/utils/EntityHighlighter.d.ts.map +1 -1
- package/lib/components/Email/utils/EntityHighlighter.js +3 -5
- package/lib/components/Email/utils/EntityHighlighter.js.map +1 -1
- package/lib/components/Feed/Feed.context.d.ts +4 -49
- package/lib/components/Feed/Feed.context.d.ts.map +1 -1
- package/lib/components/Feed/Feed.context.js +1 -5
- package/lib/components/Feed/Feed.context.js.map +1 -1
- package/lib/components/Feed/Feed.d.ts +1 -3
- package/lib/components/Feed/Feed.d.ts.map +1 -1
- package/lib/components/Feed/Feed.js +15 -23
- package/lib/components/Feed/Feed.js.map +1 -1
- package/lib/components/Feed/Feed.types.d.ts +190 -252
- package/lib/components/Feed/Feed.types.d.ts.map +1 -1
- package/lib/components/Feed/Feed.types.js.map +1 -1
- package/lib/components/Feed/FeedAttachments.d.ts +2 -3
- package/lib/components/Feed/FeedAttachments.d.ts.map +1 -1
- package/lib/components/Feed/FeedAttachments.js +12 -19
- package/lib/components/Feed/FeedAttachments.js.map +1 -1
- package/lib/components/Feed/FeedContent.d.ts +2 -3
- package/lib/components/Feed/FeedContent.d.ts.map +1 -1
- package/lib/components/Feed/FeedContent.js +5 -43
- package/lib/components/Feed/FeedContent.js.map +1 -1
- package/lib/components/Feed/FeedContentFooter.d.ts.map +1 -1
- package/lib/components/Feed/FeedContentFooter.js +2 -15
- package/lib/components/Feed/FeedContentFooter.js.map +1 -1
- package/lib/components/Feed/FeedContentHeader.d.ts.map +1 -1
- package/lib/components/Feed/FeedContentHeader.js +76 -44
- package/lib/components/Feed/FeedContentHeader.js.map +1 -1
- package/lib/components/Feed/FeedCustomEditRegion.d.ts +6 -0
- package/lib/components/Feed/FeedCustomEditRegion.d.ts.map +1 -0
- package/lib/components/Feed/FeedCustomEditRegion.js +20 -0
- package/lib/components/Feed/FeedCustomEditRegion.js.map +1 -0
- package/lib/components/Feed/FeedCustomInputRegion.d.ts +6 -0
- package/lib/components/Feed/FeedCustomInputRegion.d.ts.map +1 -0
- package/lib/components/Feed/FeedCustomInputRegion.js +38 -0
- package/lib/components/Feed/FeedCustomInputRegion.js.map +1 -0
- package/lib/components/Feed/FeedEditRegion.d.ts +1 -2
- package/lib/components/Feed/FeedEditRegion.d.ts.map +1 -1
- package/lib/components/Feed/FeedEditRegion.js +41 -14
- package/lib/components/Feed/FeedEditRegion.js.map +1 -1
- package/lib/components/Feed/FeedInputRegion.d.ts +0 -1
- package/lib/components/Feed/FeedInputRegion.d.ts.map +1 -1
- package/lib/components/Feed/FeedInputRegion.js +53 -40
- package/lib/components/Feed/FeedInputRegion.js.map +1 -1
- package/lib/components/Feed/FeedLikeButton.d.ts +2 -2
- package/lib/components/Feed/FeedLikeButton.d.ts.map +1 -1
- package/lib/components/Feed/FeedLikeButton.js +5 -5
- package/lib/components/Feed/FeedLikeButton.js.map +1 -1
- package/lib/components/Feed/FeedModalList.d.ts.map +1 -1
- package/lib/components/Feed/FeedModalList.js +6 -7
- package/lib/components/Feed/FeedModalList.js.map +1 -1
- package/lib/components/Feed/FeedNewPost.d.ts +1 -2
- package/lib/components/Feed/FeedNewPost.d.ts.map +1 -1
- package/lib/components/Feed/FeedNewPost.js +44 -14
- package/lib/components/Feed/FeedNewPost.js.map +1 -1
- package/lib/components/Feed/FeedPost.d.ts +2 -3
- package/lib/components/Feed/FeedPost.d.ts.map +1 -1
- package/lib/components/Feed/FeedPost.js +50 -28
- package/lib/components/Feed/FeedPost.js.map +1 -1
- package/lib/components/Feed/FeedReply.d.ts +1 -2
- package/lib/components/Feed/FeedReply.d.ts.map +1 -1
- package/lib/components/Feed/FeedReply.js +24 -5
- package/lib/components/Feed/FeedReply.js.map +1 -1
- package/lib/components/Feed/FeedReplyInput.d.ts +1 -2
- package/lib/components/Feed/FeedReplyInput.d.ts.map +1 -1
- package/lib/components/Feed/FeedReplyInput.js +4 -5
- package/lib/components/Feed/FeedReplyInput.js.map +1 -1
- package/lib/components/Feed/FeedRichText.d.ts +3 -3
- package/lib/components/Feed/FeedRichText.d.ts.map +1 -1
- package/lib/components/Feed/FeedRichText.js +16 -8
- package/lib/components/Feed/FeedRichText.js.map +1 -1
- package/lib/components/Feed/FeedRichTextViewer.d.ts +10 -0
- package/lib/components/Feed/FeedRichTextViewer.d.ts.map +1 -0
- package/lib/components/Feed/FeedRichTextViewer.js +38 -0
- package/lib/components/Feed/FeedRichTextViewer.js.map +1 -0
- package/lib/components/Feed/FeedVisibilityControls.d.ts +4 -0
- package/lib/components/Feed/FeedVisibilityControls.d.ts.map +1 -0
- package/lib/components/Feed/FeedVisibilityControls.js +62 -0
- package/lib/components/Feed/FeedVisibilityControls.js.map +1 -0
- package/lib/components/Feed/MarkdownSyntax.d.ts +3 -0
- package/lib/components/Feed/MarkdownSyntax.d.ts.map +1 -0
- package/lib/components/Feed/MarkdownSyntax.js +66 -0
- package/lib/components/Feed/MarkdownSyntax.js.map +1 -0
- package/lib/components/Feed/index.d.ts +3 -1
- package/lib/components/Feed/index.d.ts.map +1 -1
- package/lib/components/Feed/index.js +2 -0
- package/lib/components/Feed/index.js.map +1 -1
- package/lib/components/HashtagButton/HashtagButton.js +2 -2
- package/lib/components/HashtagButton/HashtagButton.js.map +1 -1
- package/lib/components/MentionButton/MentionButton.d.ts.map +1 -1
- package/lib/components/MentionButton/MentionButton.js +2 -2
- package/lib/components/MentionButton/MentionButton.js.map +1 -1
- package/lib/components/OpenGraphPreview/OpenGraphPreview.d.ts +27 -0
- package/lib/components/OpenGraphPreview/OpenGraphPreview.d.ts.map +1 -0
- package/lib/components/OpenGraphPreview/OpenGraphPreview.js +39 -0
- package/lib/components/OpenGraphPreview/OpenGraphPreview.js.map +1 -0
- package/lib/components/OpenGraphPreview/OpenGraphPreview.styles.d.ts +13 -0
- package/lib/components/OpenGraphPreview/OpenGraphPreview.styles.d.ts.map +1 -0
- package/lib/components/OpenGraphPreview/OpenGraphPreview.styles.js +79 -0
- package/lib/components/OpenGraphPreview/OpenGraphPreview.styles.js.map +1 -0
- package/lib/components/OpenGraphPreview/OpenGraphPreview.test-ids.d.ts +3 -0
- package/lib/components/OpenGraphPreview/OpenGraphPreview.test-ids.d.ts.map +1 -0
- package/lib/components/OpenGraphPreview/OpenGraphPreview.test-ids.js +4 -0
- package/lib/components/OpenGraphPreview/OpenGraphPreview.test-ids.js.map +1 -0
- package/lib/components/OpenGraphPreview/index.d.ts +3 -0
- package/lib/components/OpenGraphPreview/index.d.ts.map +1 -0
- package/lib/components/OpenGraphPreview/index.js +2 -0
- package/lib/components/OpenGraphPreview/index.js.map +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -1
- package/package.json +10 -10
- package/lib/components/Feed/FeedAnnouncer.d.ts +0 -6
- package/lib/components/Feed/FeedAnnouncer.d.ts.map +0 -1
- package/lib/components/Feed/FeedAnnouncer.js +0 -11
- package/lib/components/Feed/FeedAnnouncer.js.map +0 -1
- package/lib/components/Feed/FeedNewPostTypeMenu.d.ts +0 -5
- package/lib/components/Feed/FeedNewPostTypeMenu.d.ts.map +0 -1
- package/lib/components/Feed/FeedNewPostTypeMenu.js +0 -375
- package/lib/components/Feed/FeedNewPostTypeMenu.js.map +0 -1
|
@@ -1,22 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo, useState } from 'react';
|
|
3
|
-
import { ComboBox,
|
|
4
|
-
const EmailSelector = ({ participants, selectedItems, label, mode, required, onSelectedItemChange, externalValidator, status, info, compose }) => {
|
|
2
|
+
import { useMemo, useState, useEffect } from 'react';
|
|
3
|
+
import { ComboBox, menuHelpers, useI18n } from '@pega/cosmos-react-core';
|
|
4
|
+
const EmailSelector = ({ participants, selectedItems, label, mode, required, onSelectedItemChange, externalValidator, status, info, compose, onFilterChange, onLoadMore, loading, accent }) => {
|
|
5
5
|
const [filterValue, setFilterValue] = useState('');
|
|
6
|
-
const [
|
|
6
|
+
const [customEmailParticipants, setCustomEmailParticipants] = useState([]);
|
|
7
7
|
const t = useI18n();
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}, [
|
|
11
|
-
const filterRegex = createStringMatcher(filterValue, 'contains');
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
onFilterChange(filterValue);
|
|
10
|
+
}, [filterValue]);
|
|
12
11
|
const emailsToRender = useMemo(() => {
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
return (filterRegex.test(emailAddress) ||
|
|
16
|
-
filterRegex.test(fullName) ||
|
|
17
|
-
filterRegex.test(shortName));
|
|
18
|
-
})
|
|
19
|
-
: emailParticipants).map(({ emailAddress, fullName }) => {
|
|
12
|
+
const emailParticipants = participants.concat(customEmailParticipants);
|
|
13
|
+
const items = emailParticipants.map(({ emailAddress, fullName }) => {
|
|
20
14
|
return {
|
|
21
15
|
id: emailAddress,
|
|
22
16
|
primary: fullName,
|
|
@@ -33,10 +27,10 @@ const EmailSelector = ({ participants, selectedItems, label, mode, required, onS
|
|
|
33
27
|
primary: `${t('use')}: ${filterValue}`,
|
|
34
28
|
selected: selectedItems.includes(filterValue)
|
|
35
29
|
},
|
|
36
|
-
...
|
|
30
|
+
...items
|
|
37
31
|
]
|
|
38
|
-
:
|
|
39
|
-
}, [
|
|
32
|
+
: items;
|
|
33
|
+
}, [participants, customEmailParticipants, selectedItems]);
|
|
40
34
|
const toggleSelectedItems = (id) => {
|
|
41
35
|
let newSelectedItems = mode === 'single-select' ? [] : [...selectedItems];
|
|
42
36
|
if (selectedItems.includes(id)) {
|
|
@@ -49,8 +43,8 @@ const EmailSelector = ({ participants, selectedItems, label, mode, required, onS
|
|
|
49
43
|
if (!filteredItem?.secondary) {
|
|
50
44
|
// New value addition to the list
|
|
51
45
|
if (!externalValidator) {
|
|
52
|
-
|
|
53
|
-
...
|
|
46
|
+
setCustomEmailParticipants([
|
|
47
|
+
...customEmailParticipants,
|
|
54
48
|
{
|
|
55
49
|
shortName: '',
|
|
56
50
|
fullName: '',
|
|
@@ -62,8 +56,8 @@ const EmailSelector = ({ participants, selectedItems, label, mode, required, onS
|
|
|
62
56
|
else {
|
|
63
57
|
const isValid = externalValidator?.(filterValue);
|
|
64
58
|
if (isValid) {
|
|
65
|
-
|
|
66
|
-
...
|
|
59
|
+
setCustomEmailParticipants([
|
|
60
|
+
...customEmailParticipants,
|
|
67
61
|
{
|
|
68
62
|
shortName: '',
|
|
69
63
|
fullName: '',
|
|
@@ -87,14 +81,12 @@ const EmailSelector = ({ participants, selectedItems, label, mode, required, onS
|
|
|
87
81
|
}
|
|
88
82
|
return selectedItems.map(value => ({ id: value, text: value }));
|
|
89
83
|
};
|
|
90
|
-
const clearSelection = () => {
|
|
91
|
-
onSelectedItemChange([], label);
|
|
92
|
-
};
|
|
93
84
|
const comboBoxProps = {
|
|
94
85
|
value: filterValue,
|
|
95
86
|
onChange: (e) => {
|
|
96
|
-
if (!e.target.value)
|
|
97
|
-
|
|
87
|
+
if (mode === 'single-select' && !e.target.value) {
|
|
88
|
+
onSelectedItemChange([], label);
|
|
89
|
+
}
|
|
98
90
|
setFilterValue(e.target.value);
|
|
99
91
|
},
|
|
100
92
|
onBlur: () => {
|
|
@@ -102,8 +94,12 @@ const EmailSelector = ({ participants, selectedItems, label, mode, required, onS
|
|
|
102
94
|
},
|
|
103
95
|
menu: {
|
|
104
96
|
items: emailsToRender,
|
|
105
|
-
accent
|
|
106
|
-
onItemClick: toggleSelectedItems
|
|
97
|
+
accent,
|
|
98
|
+
onItemClick: toggleSelectedItems,
|
|
99
|
+
loadMore: () => {
|
|
100
|
+
onLoadMore?.(filterValue);
|
|
101
|
+
},
|
|
102
|
+
loading
|
|
107
103
|
},
|
|
108
104
|
selected: {
|
|
109
105
|
items: getSelectedItems(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmailSelector.js","sourceRoot":"","sources":["../../../src/components/Email/EmailSelector.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"EmailSelector.js","sourceRoot":"","sources":["../../../src/components/Email/EmailSelector.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGrD,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAgCzE,MAAM,aAAa,GAEf,CAAC,EACH,YAAY,EACZ,aAAa,EACb,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,oBAAoB,EACpB,iBAAiB,EACjB,MAAM,EACN,IAAI,EACJ,OAAO,EACP,cAAc,EACd,UAAU,EACV,OAAO,EACP,MAAM,EACP,EAAE,EAAE;IACH,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,C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,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import { useMemo, useState, useEffect } from 'react';\nimport type { FunctionComponent, ChangeEvent, ReactNode } from 'react';\n\nimport { ComboBox, menuHelpers, useI18n } from '@pega/cosmos-react-core';\nimport type {\n ComboBoxProps,\n NoChildrenProp,\n FormControlProps,\n MenuItemProps,\n MenuProps\n} from '@pega/cosmos-react-core';\n\nimport type { EmailComposerProps, EmailUser } from './Email.types';\n\nexport interface EmailSelectorProps extends NoChildrenProp, Pick<MenuProps, 'loading' | 'accent'> {\n /** participants */\n participants: EmailComposerProps['participants'];\n /** default selections */\n selectedItems: EmailUser['emailAddress'][];\n /** selectedItems */\n onSelectedItemChange: (selectedItems: EmailUser['emailAddress'][], label: ReactNode) => void;\n /** Callback fired when the Combobox input value changes. */\n onFilterChange: (filterValue: string) => void;\n /** Callback to fetch more rows */\n onLoadMore?: (filterValue: string) => 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 status?: FormControlProps['status'];\n info?: FormControlProps['info'];\n compose?: boolean;\n}\n\nconst EmailSelector: FunctionComponent<\n EmailSelectorProps & Pick<ComboBoxProps, 'label' | 'mode' | 'required'>\n> = ({\n participants,\n selectedItems,\n label,\n mode,\n required,\n onSelectedItemChange,\n externalValidator,\n status,\n info,\n compose,\n onFilterChange,\n onLoadMore,\n loading,\n accent\n}) => {\n const [filterValue, setFilterValue] = useState('');\n const [customEmailParticipants, setCustomEmailParticipants] = useState<\n EmailSelectorProps['participants']\n >([]);\n const t = useI18n();\n\n useEffect(() => {\n onFilterChange(filterValue);\n }, [filterValue]);\n\n const emailsToRender = useMemo(() => {\n const emailParticipants: EmailSelectorProps['participants'] =\n participants.concat(customEmailParticipants);\n\n const items = emailParticipants.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 !compose\n ? [\n {\n id: filterValue,\n primary: `${t('use')}: ${filterValue}`,\n selected: selectedItems.includes(filterValue)\n },\n ...items\n ]\n : items;\n }, [participants, customEmailParticipants, selectedItems]);\n\n const toggleSelectedItems = (id: string) => {\n let newSelectedItems = mode === 'single-select' ? [] : [...selectedItems];\n\n if (selectedItems.includes(id)) {\n // Unselect an already selected item\n newSelectedItems = newSelectedItems.filter(value => value !== id);\n } else {\n setFilterValue('');\n const filteredItem = menuHelpers.getItem<MenuItemProps>(emailsToRender, id);\n\n if (!filteredItem?.secondary) {\n // New value addition to the list\n if (!externalValidator) {\n setCustomEmailParticipants([\n ...customEmailParticipants,\n {\n shortName: '',\n fullName: '',\n emailAddress: filterValue\n }\n ]);\n newSelectedItems = [...newSelectedItems, id];\n } else {\n const isValid = externalValidator?.(filterValue);\n if (isValid) {\n setCustomEmailParticipants([\n ...customEmailParticipants,\n {\n shortName: '',\n fullName: '',\n emailAddress: filterValue\n }\n ]);\n newSelectedItems = [...newSelectedItems, id];\n }\n }\n } else {\n // Existing value to be selected\n newSelectedItems = [...newSelectedItems, id];\n }\n }\n\n onSelectedItemChange(newSelectedItems, label);\n };\n\n const getSelectedItems = () => {\n if (mode === 'single-select') {\n return { id: selectedItems[0], text: selectedItems[0] };\n }\n return selectedItems.map(value => ({ id: value, text: value }));\n };\n\n const comboBoxProps = {\n value: filterValue,\n onChange: (e: ChangeEvent<HTMLInputElement>) => {\n if (mode === 'single-select' && !e.target.value) {\n onSelectedItemChange([], label);\n }\n setFilterValue(e.target.value);\n },\n onBlur: () => {\n setFilterValue('');\n },\n menu: {\n items: emailsToRender,\n accent,\n onItemClick: toggleSelectedItems,\n loadMore: () => {\n onLoadMore?.(filterValue);\n },\n loading\n },\n selected: {\n items: getSelectedItems(),\n onRemove: toggleSelectedItems\n },\n label,\n mode,\n required,\n status,\n info\n };\n\n return <ComboBox {...comboBoxProps} />;\n};\n\nexport default EmailSelector;\n"]}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ForwardProps } from '@pega/cosmos-react-core';
|
|
1
|
+
import type { ForwardRefForwardPropsComponent } from '@pega/cosmos-react-core';
|
|
3
2
|
import type { EmailShellProps } from './Email.types';
|
|
4
|
-
declare const EmailShell:
|
|
3
|
+
declare const EmailShell: ForwardRefForwardPropsComponent<EmailShellProps>;
|
|
5
4
|
export default EmailShell;
|
|
6
5
|
//# sourceMappingURL=EmailShell.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmailShell.d.ts","sourceRoot":"","sources":["../../../src/components/Email/EmailShell.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EmailShell.d.ts","sourceRoot":"","sources":["../../../src/components/Email/EmailShell.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AAG/E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAcrD,QAAA,MAAM,UAAU,EAAE,+BAA+B,CAAC,eAAe,CAoF/D,CAAC;AAEH,eAAe,UAAU,CAAC"}
|
|
@@ -40,7 +40,7 @@ const EmailShell = forwardRef(function EmailShell(props, ref) {
|
|
|
40
40
|
alignItems: 'center',
|
|
41
41
|
justify: 'between',
|
|
42
42
|
pad: 1
|
|
43
|
-
}, as: StyledEmailShellHeader, children: [_jsxs(Flex, { container: { gap: 1, alignItems: 'center' }, children: [_jsx(Icon, { name: 'mail' }), _jsx(Text, { variant: 'h3', children: headerProps?.subject ? `${t('subject')}: ${headerProps?.subject} ` : t('email') })] }), headerProps?.actions] })), _jsx(StyledEmailConversationList, {
|
|
43
|
+
}, as: StyledEmailShellHeader, children: [_jsxs(Flex, { container: { gap: 1, alignItems: 'center' }, children: [_jsx(Icon, { name: 'mail' }), _jsx(Text, { variant: 'h3', children: headerProps?.subject ? `${t('subject')}: ${headerProps?.subject} ` : t('email') })] }), headerProps?.actions] })), _jsx(StyledEmailConversationList, { children: renderConversations() })] }));
|
|
44
44
|
});
|
|
45
45
|
export default EmailShell;
|
|
46
46
|
//# sourceMappingURL=EmailShell.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmailShell.js","sourceRoot":"","sources":["../../../src/components/Email/EmailShell.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAG7C,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAElF,OAAO,KAAK,QAAQ,MAAM,6DAA6D,CAAC;AAGxF,OAAO,iBAAiB,EAAE,EACxB,uBAAuB,EACvB,yBAAyB,EACzB,iBAAiB,EAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,2BAA2B,EAC3B,gBAAgB,EAChB,sBAAsB,EACvB,MAAM,gBAAgB,CAAC;AAExB,YAAY,CAAC,QAAQ,CAAC,CAAC;AAEvB,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"EmailShell.js","sourceRoot":"","sources":["../../../src/components/Email/EmailShell.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAG7C,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAElF,OAAO,KAAK,QAAQ,MAAM,6DAA6D,CAAC;AAGxF,OAAO,iBAAiB,EAAE,EACxB,uBAAuB,EACvB,yBAAyB,EACzB,iBAAiB,EAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,2BAA2B,EAC3B,gBAAgB,EAChB,sBAAsB,EACvB,MAAM,gBAAgB,CAAC;AAExB,YAAY,CAAC,QAAQ,CAAC,CAAC;AAEvB,MAAM,UAA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ACN,WAAW,EAAE,OAAO,IAChB,CACR,EACD,KAAC,2BAA2B,cAAE,mBAAmB,EAAE,GAA+B,IAC7E,CACR,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,UAAU,CAAC","sourcesContent":["import { forwardRef, useState } from 'react';\nimport type { PropsWithoutRef } from 'react';\n\nimport { Flex, Icon, registerIcon, Text, useI18n } from '@pega/cosmos-react-core';\nimport type { ForwardRefForwardPropsComponent } from '@pega/cosmos-react-core';\nimport * as mailIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/mail.icon';\n\nimport type { EmailShellProps } from './Email.types';\nimport EmailConversation, {\n StyledEmailConversation,\n StyledEmailInConversation,\n StyledUnReadCount\n} from './EmailConversation';\nimport {\n StyledEmailConversationList,\n StyledEmailShell,\n StyledEmailShellHeader\n} from './Email.styles';\n\nregisterIcon(mailIcon);\n\nconst EmailShell: ForwardRefForwardPropsComponent<EmailShellProps> = forwardRef(function EmailShell(\n props: PropsWithoutRef<EmailShellProps>,\n ref: EmailShellProps['ref']\n) {\n const { conversations, headerProps, autoCollapse = false, ...restProps } = props;\n\n const t = useI18n();\n\n const [activeIndex, setActiveIndex] = useState(0);\n\n const singleConversation = conversations?.length === 1;\n\n const renderConversations = () => {\n if (!conversations) return;\n\n if (singleConversation) {\n const conversation = conversations[0];\n return (\n <StyledEmailConversation singleConversation={singleConversation} showHeader={!!headerProps}>\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 // Multiple conversations\n return autoCollapse\n ? conversations?.map((conversation, index) => {\n const { onExpand, isCollapsed, ...rest } = conversation;\n const collapsed = index !== activeIndex;\n return (\n <EmailConversation\n key={conversation.id}\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 key={conversation.id} {...conversation} />;\n });\n };\n\n return (\n <Flex\n {...restProps}\n as={StyledEmailShell}\n container={{ direction: 'column', gap: singleConversation ? undefined : 1 }}\n ref={ref}\n singleConversation={singleConversation}\n >\n {headerProps && (\n <Flex\n container={{\n alignItems: 'center',\n justify: 'between',\n pad: 1\n }}\n as={StyledEmailShellHeader}\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>{renderConversations()}</StyledEmailConversationList>\n </Flex>\n );\n});\n\nexport default EmailShell;\n"]}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ForwardProps } from '@pega/cosmos-react-core';
|
|
1
|
+
import type { ForwardRefForwardPropsComponent } from '@pega/cosmos-react-core';
|
|
3
2
|
import type { EmailSummaryItemProps } from './Email.types';
|
|
4
3
|
export declare const StyledMessageAndDate: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
export declare const StyledEmailSummaryItem: import("styled-components").StyledComponent<"li", import("styled-components").DefaultTheme, StyledEmailSummaryItemProps & ForwardProps, never>;
|
|
9
|
-
declare const EmailSummaryItem: FunctionComponent<EmailSummaryItemProps & ForwardProps>;
|
|
4
|
+
export declare const StyledEmailSummaryItem: import("styled-components").StyledComponent<"li", import("styled-components").DefaultTheme, {}, never>;
|
|
5
|
+
declare const EmailSummaryItem: ForwardRefForwardPropsComponent<EmailSummaryItemProps>;
|
|
10
6
|
export default EmailSummaryItem;
|
|
11
7
|
//# sourceMappingURL=EmailSummaryItem.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmailSummaryItem.d.ts","sourceRoot":"","sources":["../../../src/components/Email/EmailSummaryItem.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EmailSummaryItem.d.ts","sourceRoot":"","sources":["../../../src/components/Email/EmailSummaryItem.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AAG/E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAkB3D,eAAO,MAAM,oBAAoB,yGAEhC,CAAC;AAwBF,eAAO,MAAM,sBAAsB,wGA+BjC,CAAC;AAMH,QAAA,MAAM,gBAAgB,EAAE,+BAA+B,CAAC,qBAAqB,CAqH5E,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -45,32 +45,32 @@ const StyledStatuses = styled.div ``;
|
|
|
45
45
|
export const StyledEmailSummaryItem = styled.li(({ theme }) => {
|
|
46
46
|
const hoverColor = tryCatch(() => mix(0.85, theme.base.palette['primary-background'], theme.base.palette.interactive));
|
|
47
47
|
return css `
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
48
|
+
width: 100%;
|
|
49
|
+
color: ${theme.base.palette['foreground-color']};
|
|
50
|
+
background-color: ${theme.base.palette['primary-background']};
|
|
51
|
+
padding: ${theme.base.spacing} calc(2 * ${theme.base.spacing});
|
|
52
|
+
outline: none;
|
|
53
|
+
cursor: pointer;
|
|
54
|
+
${StyledMetaList}, ${StyledMessageAndDate}, ${StyledStatuses} {
|
|
55
|
+
margin-block-start: ${theme.base.spacing};
|
|
56
|
+
}
|
|
57
|
+
& + & {
|
|
58
|
+
margin-inline-start: 0;
|
|
59
|
+
}
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
&[aria-selected='true'],
|
|
62
|
+
&[data-current='true'] {
|
|
63
|
+
background-color: ${theme.base.palette['secondary-background']};
|
|
64
|
+
}
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
66
|
+
&:hover,
|
|
67
|
+
&:focus-within {
|
|
68
|
+
background-color: ${hoverColor};
|
|
69
|
+
}
|
|
70
|
+
&:not(:last-child) {
|
|
71
|
+
border-block-end: 0.0625rem solid ${theme.base.palette['border-line']};
|
|
72
|
+
}
|
|
73
|
+
`;
|
|
74
74
|
});
|
|
75
75
|
StyledEmailSummaryItem.defaultProps = defaultThemeProp;
|
|
76
76
|
StyledParticipants.defaultProps = defaultThemeProp;
|
|
@@ -101,7 +101,7 @@ const EmailSummaryItem = forwardRef(function EmailSummaryItem({ id, activePartic
|
|
|
101
101
|
return participants;
|
|
102
102
|
}, [activeParticipants]);
|
|
103
103
|
const itemStatus = `${unreadEmailCount ? `${t('unread')}, ` : ''}${undelivered ? `${t('undelivered')}, ` : ''}${drafts ? `${t('drafts')}, ` : ''}`;
|
|
104
|
-
return (_jsxs(StyledEmailSummaryItem, { ref: ref, ...restProps, id: id, onClick: () => onSelect(id), onKeyDown:
|
|
104
|
+
return (_jsxs(StyledEmailSummaryItem, { ref: ref, ...restProps, id: id, onClick: () => onSelect(id), onKeyDown: e => {
|
|
105
105
|
if (e.key === 'Enter') {
|
|
106
106
|
onSelect(id);
|
|
107
107
|
}
|
|
@@ -109,7 +109,7 @@ const EmailSummaryItem = forwardRef(function EmailSummaryItem({ id, activePartic
|
|
|
109
109
|
? replaceMatchWithElement(emailParticipants, createStringMatcher(searchQuery, 'contains', 'ig'), match => _jsx(Mark, { children: match }))
|
|
110
110
|
: emailParticipants }), typeof unreadEmailCount === 'number' && unreadEmailCount > 0 && (_jsx(Count, { children: unreadEmailCount }))] }), _jsxs(Flex, { container: {
|
|
111
111
|
justify: 'between'
|
|
112
|
-
}, as: StyledMessageAndDate, children: [_jsx(StyledMessage, { unreadEmailCount: unreadEmailCount, children: message }), _jsx(DateTimeDisplay, { value: timeStamp, variant: 'date'
|
|
112
|
+
}, as: StyledMessageAndDate, children: [_jsx(StyledMessage, { unreadEmailCount: unreadEmailCount, children: message }), _jsx(DateTimeDisplay, { value: timeStamp, variant: 'date' })] }), _jsx(MetaList, { items: items }), (undelivered || drafts) && (_jsxs(Flex, { container: {
|
|
113
113
|
justify: 'start',
|
|
114
114
|
gap: 1
|
|
115
115
|
}, as: StyledStatuses, children: [undelivered && _jsx(Status, { variant: 'urgent', children: t('undelivered') }), drafts && _jsx(Status, { variant: 'pending', children: t('draft', [], { count: Infinity }) })] }))] }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmailSummaryItem.js","sourceRoot":"","sources":["../../../src/components/Email/EmailSummaryItem.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,OAAO,EACL,gBAAgB,EAChB,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,SAAS,EACT,QAAQ,EACR,eAAe,EACf,MAAM,EACN,QAAQ,EACR,OAAO,EACP,uBAAuB,EACvB,IAAI,EACJ,mBAAmB,EACpB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,cAAc,EAAE,MAAM,0DAA0D,CAAC;AAI1F,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,CAAwB,CAAC,EAAE,gBAAgB,EAAE,KAAK,EAAE,EAAE,EAAE;IACxF,OAAO,GAAG,CAAA;aACC,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,EAAE;;;;yBAIlB,KAAK,CAAC,IAAI,C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AAG,EAAE,CAAC;iBACP,EACD,EAAE,EAAE,cAAc,aAEjB,WAAW,IAAI,KAAC,MAAM,IAAC,OAAO,EAAC,QAAQ,YAAE,CAAC,CAAC,aAAa,CAAC,GAAU,EAGnE,MAAM,IAAI,KAAC,MAAM,IAAC,OAAO,EAAC,SAAS,YAAE,CAAC,CAAC,OAAO,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,GAAU,IAC9E,CACR,IACsB,CAC1B,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["import { forwardRef, useMemo } from 'react';\nimport type { FunctionComponent, ReactNode } from 'react';\nimport styled, { css } from 'styled-components';\nimport { mix } from 'polished';\n\nimport {\n defaultThemeProp,\n Text,\n Flex,\n Count,\n Sentiment,\n MetaList,\n DateTimeDisplay,\n Status,\n tryCatch,\n useI18n,\n replaceMatchWithElement,\n Mark,\n createStringMatcher\n} from '@pega/cosmos-react-core';\nimport type { ForwardProps } from '@pega/cosmos-react-core';\nimport { StyledMetaList } from '@pega/cosmos-react-core/lib/components/MetaList/MetaList';\n\nimport type { EmailSummaryItemProps } from './Email.types';\n\nconst StyledMessage = styled(Flex)<EmailSummaryItemProps>(({ unreadEmailCount, theme }) => {\n return css`\n width: ${theme.base['content-width'].md};\n text-align: start;\n text-overflow: ellipsis;\n overflow: hidden;\n margin-inline-end: ${theme.base.spacing};\n margin-block-end: ${theme.base.spacing};\n ${unreadEmailCount !== undefined &&\n unreadEmailCount > 0 &&\n css`\n color: ${theme.base.palette.interactive};\n `}\n `;\n});\n\nexport const 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}\n\nconst StyledStatuses = styled.div``;\n\nexport const StyledEmailSummaryItem = styled.li<StyledEmailSummaryItemProps & ForwardProps>(\n ({ 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 padding: ${theme.base.spacing} calc(2 * ${theme.base.spacing});\n outline: none;\n cursor: pointer;\n ${StyledMetaList}, ${StyledMessageAndDate}, ${StyledStatuses} {\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 &:not(:last-child) {\n border-block-end: 0.0625rem solid ${theme.base.palette['border-line']};\n }\n `;\n }\n);\n\nStyledEmailSummaryItem.defaultProps = defaultThemeProp;\nStyledParticipants.defaultProps = defaultThemeProp;\nStyledMessage.defaultProps = defaultThemeProp;\n\nconst EmailSummaryItem: FunctionComponent<EmailSummaryItemProps & ForwardProps> = forwardRef(\n function EmailSummaryItem(\n {\n id,\n activeParticipants,\n sentiment,\n message,\n timeStamp,\n topic,\n urgency,\n active = false,\n onSelect,\n unreadEmailCount,\n drafts,\n undelivered,\n searchQuery,\n ...restProps\n },\n ref: EmailSummaryItemProps['ref']\n ) {\n const t = useI18n();\n const items = useMemo(() => {\n const itemList: ReactNode[] = [];\n\n if (typeof topic === 'string' && topic.length > 0) {\n itemList.push(\n <Status variant='info' key='info'>\n {topic}\n </Status>\n );\n }\n\n if (sentiment) {\n itemList.push(<Sentiment variant={sentiment.variant} labelHidden />);\n }\n\n if (typeof urgency === 'number') {\n itemList.push(<Text variant='secondary'>{`${t('priority')} ${urgency}`}</Text>);\n }\n\n return itemList;\n }, [sentiment, topic, urgency]);\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 const itemStatus = `${unreadEmailCount ? `${t('unread')}, ` : ''}${\n undelivered ? `${t('undelivered')}, ` : ''\n }${drafts ? `${t('drafts')}, ` : ''}`;\n return (\n <StyledEmailSummaryItem\n ref={ref}\n {...restProps}\n id={id}\n onClick={() => onSelect(id)}\n onKeyDown={(e: KeyboardEvent) => {\n if (e.key === 'Enter') {\n onSelect(id);\n }\n }}\n aria-selected={active}\n aria-label={`${itemStatus}${emailParticipants}, ${message} ${timeStamp} ${topic} ${\n sentiment?.variant\n } ${t('priority')} ${urgency}`}\n tabIndex={active ? 0 : -1}\n >\n <StyledParticipants\n unreadEmailCount={unreadEmailCount}\n container={{ justify: 'between', alignItems: 'center' }}\n >\n <Text variant='h4'>\n {searchQuery\n ? replaceMatchWithElement(\n emailParticipants,\n createStringMatcher(searchQuery, 'contains', 'ig'),\n match => <Mark>{match}</Mark>\n )\n : emailParticipants}\n </Text>\n {typeof unreadEmailCount === 'number' && unreadEmailCount > 0 && (\n <Count>{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 {(undelivered || drafts) && (\n <Flex\n container={{\n justify: 'start',\n gap: 1\n }}\n as={StyledStatuses}\n >\n {undelivered && <Status variant='urgent'>{t('undelivered')}</Status>}\n {/* Passing count as infinity so that translation engine select correct form of draft,\n with [](second argument) as empty so that count is not shown */}\n {drafts && <Status variant='pending'>{t('draft', [], { count: Infinity })}</Status>}\n </Flex>\n )}\n </StyledEmailSummaryItem>\n );\n }\n);\n\nexport default EmailSummaryItem;\n"]}
|
|
1
|
+
{"version":3,"file":"EmailSummaryItem.js","sourceRoot":"","sources":["../../../src/components/Email/EmailSummaryItem.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,OAAO,EACL,gBAAgB,EAChB,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,SAAS,EACT,QAAQ,EACR,eAAe,EACf,MAAM,EACN,QAAQ,EACR,OAAO,EACP,uBAAuB,EACvB,IAAI,EACJ,mBAAmB,EACpB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,cAAc,EAAE,MAAM,0DAA0D,CAAC;AAI1F,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,CAAwB,CAAC,EAAE,gBAAgB,EAAE,KAAK,EAAE,EAAE,EAAE;IACxF,OAAO,GAAG,CAAA;aACC,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,EAAE;;;;yBAIlB,KAAK,CAAC,IAAI,CAAC,OAAO;wBACnB,KAAK,CAAC,IAAI,CAAC,OAAO;MACpC,gBAAgB,KAAK,SAAS;QAChC,gBAAgB,GAAG,CAAC;QACpB,GAAG,CAAA;eACQ,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW;KACxC;GACF,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC,GAAG,CAAA;;CAE7C,CAAC;AAEF,MAAM,kBAAkB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAwB,CAAC,EAAE,gBAAgB,EAAE,KAAK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utRef, ReactNode } from 'react';\nimport styled, { css } from 'styled-components';\nimport { mix } from 'polished';\n\nimport {\n defaultThemeProp,\n Text,\n Flex,\n Count,\n Sentiment,\n MetaList,\n DateTimeDisplay,\n Status,\n tryCatch,\n useI18n,\n replaceMatchWithElement,\n Mark,\n createStringMatcher\n} from '@pega/cosmos-react-core';\nimport type { ForwardRefForwardPropsComponent } from '@pega/cosmos-react-core';\nimport { StyledMetaList } from '@pega/cosmos-react-core/lib/components/MetaList/MetaList';\n\nimport type { EmailSummaryItemProps } from './Email.types';\n\nconst StyledMessage = styled(Flex)<EmailSummaryItemProps>(({ unreadEmailCount, theme }) => {\n return css`\n width: ${theme.base['content-width'].md};\n text-align: start;\n text-overflow: ellipsis;\n overflow: hidden;\n margin-inline-end: ${theme.base.spacing};\n margin-block-end: ${theme.base.spacing};\n ${unreadEmailCount !== undefined &&\n unreadEmailCount > 0 &&\n css`\n color: ${theme.base.palette.interactive};\n `}\n `;\n});\n\nexport const 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});\n\nconst StyledStatuses = styled.div``;\n\nexport const StyledEmailSummaryItem = styled.li(({ 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 padding: ${theme.base.spacing} calc(2 * ${theme.base.spacing});\n outline: none;\n cursor: pointer;\n ${StyledMetaList}, ${StyledMessageAndDate}, ${StyledStatuses} {\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 &:not(:last-child) {\n border-block-end: 0.0625rem solid ${theme.base.palette['border-line']};\n }\n `;\n});\n\nStyledEmailSummaryItem.defaultProps = defaultThemeProp;\nStyledParticipants.defaultProps = defaultThemeProp;\nStyledMessage.defaultProps = defaultThemeProp;\n\nconst EmailSummaryItem: ForwardRefForwardPropsComponent<EmailSummaryItemProps> = forwardRef(\n function EmailSummaryItem(\n {\n id,\n activeParticipants,\n sentiment,\n message,\n timeStamp,\n topic,\n urgency,\n active = false,\n onSelect,\n unreadEmailCount,\n drafts,\n undelivered,\n searchQuery,\n ...restProps\n }: PropsWithoutRef<EmailSummaryItemProps>,\n ref: EmailSummaryItemProps['ref']\n ) {\n const t = useI18n();\n const items = useMemo(() => {\n const itemList: ReactNode[] = [];\n\n if (typeof topic === 'string' && topic.length > 0) {\n itemList.push(\n <Status variant='info' key='info'>\n {topic}\n </Status>\n );\n }\n\n if (sentiment) {\n itemList.push(<Sentiment variant={sentiment.variant} labelHidden />);\n }\n\n if (typeof urgency === 'number') {\n itemList.push(<Text variant='secondary'>{`${t('priority')} ${urgency}`}</Text>);\n }\n\n return itemList;\n }, [sentiment, topic, urgency]);\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 const itemStatus = `${unreadEmailCount ? `${t('unread')}, ` : ''}${\n undelivered ? `${t('undelivered')}, ` : ''\n }${drafts ? `${t('drafts')}, ` : ''}`;\n return (\n <StyledEmailSummaryItem\n ref={ref}\n {...restProps}\n id={id}\n onClick={() => onSelect(id)}\n onKeyDown={e => {\n if (e.key === 'Enter') {\n onSelect(id);\n }\n }}\n aria-selected={active}\n aria-label={`${itemStatus}${emailParticipants}, ${message} ${timeStamp} ${topic} ${\n sentiment?.variant\n } ${t('priority')} ${urgency}`}\n tabIndex={active ? 0 : -1}\n >\n <StyledParticipants\n unreadEmailCount={unreadEmailCount}\n container={{ justify: 'between', alignItems: 'center' }}\n >\n <Text variant='h4'>\n {searchQuery\n ? replaceMatchWithElement(\n emailParticipants,\n createStringMatcher(searchQuery, 'contains', 'ig'),\n match => <Mark>{match}</Mark>\n )\n : emailParticipants}\n </Text>\n {typeof unreadEmailCount === 'number' && unreadEmailCount > 0 && (\n <Count>{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' />\n </Flex>\n <MetaList items={items} />\n {(undelivered || drafts) && (\n <Flex\n container={{\n justify: 'start',\n gap: 1\n }}\n as={StyledStatuses}\n >\n {undelivered && <Status variant='urgent'>{t('undelivered')}</Status>}\n {/* Passing count as infinity so that translation engine select correct form of draft,\n with [](second argument) as empty so that count is not shown */}\n {drafts && <Status variant='pending'>{t('draft', [], { count: Infinity })}</Status>}\n </Flex>\n )}\n </StyledEmailSummaryItem>\n );\n }\n);\n\nexport default EmailSummaryItem;\n"]}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ForwardProps } from '@pega/cosmos-react-core';
|
|
1
|
+
import type { ForwardRefForwardPropsComponent } from '@pega/cosmos-react-core';
|
|
3
2
|
import type { EmailSummaryListProps } from './Email.types';
|
|
4
|
-
declare const EmailSummaryList:
|
|
3
|
+
declare const EmailSummaryList: ForwardRefForwardPropsComponent<EmailSummaryListProps>;
|
|
5
4
|
export default EmailSummaryList;
|
|
6
5
|
//# sourceMappingURL=EmailSummaryList.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmailSummaryList.d.ts","sourceRoot":"","sources":["../../../src/components/Email/EmailSummaryList.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EmailSummaryList.d.ts","sourceRoot":"","sources":["../../../src/components/Email/EmailSummaryList.tsx"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AAG/E,OAAO,KAAK,EAAyB,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAuDlF,QAAA,MAAM,gBAAgB,EAAE,+BAA+B,CAAC,qBAAqB,CAiK5E,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { createRef, useMemo, useState, useEffect, forwardRef, useCallback } from 'react';
|
|
3
3
|
import styled, { css } from 'styled-components';
|
|
4
|
-
import { Button, defaultThemeProp, Flex, Icon, registerIcon, MenuButton, useConsolidatedRef, useI18n, menuHelpers, Progress, useItemIntersection, usePrevious,
|
|
4
|
+
import { Button, defaultThemeProp, Flex, Icon, registerIcon, MenuButton, useConsolidatedRef, useI18n, menuHelpers, Progress, useItemIntersection, usePrevious, EmptyState, calculateFontSize, StyledText, useArrows, debounce, useLiveLog } from '@pega/cosmos-react-core';
|
|
5
5
|
import * as filterIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/filter.icon';
|
|
6
6
|
import EmailSummaryItem from './EmailSummaryItem';
|
|
7
7
|
import { StyledEmailSummaryList, StyledLoadMore } from './Email.styles';
|
|
@@ -48,6 +48,7 @@ const EmailSummaryList = forwardRef(function EmailSummaryList({ loading = false,
|
|
|
48
48
|
const tablistRef = useConsolidatedRef(ref);
|
|
49
49
|
const tabRefs = items.map(() => createRef());
|
|
50
50
|
const prevEmail = usePrevious(items);
|
|
51
|
+
const { announcePolite } = useLiveLog();
|
|
51
52
|
const countMessage = useMemo(() => {
|
|
52
53
|
if (count) {
|
|
53
54
|
const { total, unread } = count;
|
|
@@ -61,7 +62,7 @@ const EmailSummaryList = forwardRef(function EmailSummaryList({ loading = false,
|
|
|
61
62
|
cycle: true,
|
|
62
63
|
selector: ':scope > li',
|
|
63
64
|
dir: 'up-down',
|
|
64
|
-
updateTabIndex:
|
|
65
|
+
updateTabIndex: !currentItemId
|
|
65
66
|
}, [items]);
|
|
66
67
|
const buttonText = useMemo(() => {
|
|
67
68
|
if (categories)
|
|
@@ -90,16 +91,23 @@ const EmailSummaryList = forwardRef(function EmailSummaryList({ loading = false,
|
|
|
90
91
|
tabRefs[items.findIndex(item => item.id === currentItemId)]?.current?.focus();
|
|
91
92
|
}
|
|
92
93
|
}, [currentItemId]);
|
|
94
|
+
useEffect(() => {
|
|
95
|
+
if (announcement) {
|
|
96
|
+
announcePolite({
|
|
97
|
+
message: announcement
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}, [announcement]);
|
|
93
101
|
return (_jsxs(StyledEmailSummaryListContainer, { container: { direction: 'column' }, ...restProps, children: [!!(categories?.length || searchQuery) && (_jsx(StyledEmailSummaryListHeader, { children: _jsxs(StyledActionWrapper, { container: { justify: 'space-between', alignItems: 'center', gap: 0.5 }, children: [_jsx(Flex, { item: { shrink: 1 }, children: searchQuery ? (_jsx(StyledText, { variant: 'h3', children: t('search_results') })) : (_jsx(StyledWorklist, { text: buttonText, variant: 'text', popover: { portal: true }, menu: {
|
|
94
102
|
mode: 'single-select',
|
|
95
103
|
items: categories,
|
|
96
104
|
onItemClick: onCategoryClick
|
|
97
|
-
} })) }), countMessage && _jsx(StyledText, { variant: 'secondary', children: countMessage }), filters && (_jsx(StyledFilterButton, { variant: 'simple', label: t('email_filters'), icon: true, children: _jsx(Icon, { name: 'filter' }) }))] }) })), items.length > 0 ? (_jsxs(Flex, { role: selectable ? 'tablist' : undefined, container: { direction: 'column' }, as: StyledEmailSummaryList, ref: tablistRef, children:
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
105
|
+
} })) }), countMessage && _jsx(StyledText, { variant: 'secondary', children: countMessage }), filters && (_jsx(StyledFilterButton, { variant: 'simple', label: t('email_filters'), icon: true, children: _jsx(Icon, { name: 'filter' }) }))] }) })), items.length > 0 ? (_jsxs(_Fragment, { children: [_jsx(Flex, { role: selectable ? 'tablist' : undefined, container: { direction: 'column' }, as: StyledEmailSummaryList, ref: tablistRef, children: items.map((emailItem, i) => {
|
|
106
|
+
const { id, ...emailItemProps } = emailItem;
|
|
107
|
+
return (_jsx(EmailSummaryItem, { searchQuery: searchQuery, ref: tabRefs[i], id: id, ...emailItemProps, onSelect: (selectedItemId) => {
|
|
108
|
+
onItemClick(selectedItemId);
|
|
109
|
+
}, role: selectable ? 'tab' : undefined, active: selectable ? currentItemId === id : undefined }, id));
|
|
110
|
+
}) }), loading && (_jsx(Flex, { container: { justify: 'center' }, as: StyledLoadMore, children: _jsx(Progress, { placement: 'inline', message: t('loading_email') }) }))] })) : (_jsx(EmptyState, { message: emptyMessage }))] }));
|
|
103
111
|
});
|
|
104
112
|
export default EmailSummaryList;
|
|
105
113
|
//# sourceMappingURL=EmailSummaryList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmailSummaryList.js","sourceRoot":"","sources":["../../../src/components/Email/EmailSummaryList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEzF,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,MAAM,EACN,gBAAgB,EAChB,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,UAAU,EACV,kBAAkB,EAClB,OAAO,EAC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KAAC,QAAQ,IAAC,SAAS,EAAC,QAAQ,GAAG,GAC1B,CACR,IACI,CACR,CAAC,CAAC,CAAC,CACF,KAAC,UAAU,IAAC,OAAO,EAAE,YAAY,GAAI,CACtC,IAC+B,CACnC,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["import { createRef, useMemo, useState, useEffect, forwardRef, useCallback } from 'react';\nimport type { FunctionComponent } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Button,\n defaultThemeProp,\n Flex,\n Icon,\n registerIcon,\n MenuButton,\n useConsolidatedRef,\n useI18n,\n menuHelpers,\n Progress,\n useItemIntersection,\n usePrevious,\n VisuallyHiddenText,\n EmptyState,\n calculateFontSize,\n StyledText,\n useArrows,\n debounce\n} from '@pega/cosmos-react-core';\nimport type { ForwardProps } from '@pega/cosmos-react-core';\nimport * as filterIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/filter.icon';\n\nimport type { EmailSummaryItemProps, EmailSummaryListProps } from './Email.types';\nimport EmailSummaryItem from './EmailSummaryItem';\nimport { StyledEmailSummaryList, StyledLoadMore } from './Email.styles';\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(\n ({\n theme: {\n base: { spacing }\n }\n }) => {\n return css`\n padding: ${spacing} calc(2 * ${spacing});\n `;\n }\n);\nStyledEmailSummaryListHeader.defaultProps = defaultThemeProp;\n\nconst StyledActionWrapper = styled(Flex)(({ theme }) => {\n return css`\n padding-block-start: ${theme.base.spacing};\n\n & > ${StyledText} {\n white-space: nowrap;\n }\n `;\n});\nStyledActionWrapper.defaultProps = defaultThemeProp;\n\nconst StyledFilterButton = styled(Button)`\n margin-inline-start: auto;\n`;\n\nconst StyledWorklist = styled(MenuButton)(({ theme }) => {\n const { 'font-size': fontSize, 'font-scale': fontScale } = theme.base;\n const fontSizes = calculateFontSize(fontSize, fontScale);\n return css`\n ${StyledText} {\n font-weight: ${theme.base['font-weight']['semi-bold']};\n font-size: ${fontSizes.m};\n }\n `;\n});\n\nStyledWorklist.defaultProps = defaultThemeProp;\n\nconst EmailSummaryList: FunctionComponent<EmailSummaryListProps & ForwardProps> = forwardRef(\n function EmailSummaryList(\n {\n loading = false,\n onLoadMore,\n categories,\n onCategoryClick,\n items,\n count,\n filters,\n onFilterChange,\n onItemClick,\n emptyMessage,\n currentItemId,\n selectable = true,\n searchQuery,\n ...restProps\n },\n ref: EmailSummaryListProps['ref']\n ) {\n const t = useI18n();\n const tablistRef = useConsolidatedRef(ref);\n const tabRefs = items.map(() => createRef<HTMLLIElement>());\n const prevEmail = usePrevious(items);\n\n const countMessage = useMemo(() => {\n if (count) {\n const { total, unread } = count;\n return unread\n ? `${t('unread_email_count', [unread, total])}`\n : `${t('results_count', [total], { count: total })}`;\n }\n }, [count]);\n const [announcement, setAnnouncement] = useState('');\n useArrows(\n tablistRef,\n {\n cycle: true,\n selector: ':scope > li',\n dir: 'up-down',\n updateTabIndex: false\n },\n [items]\n );\n\n const buttonText = useMemo(() => {\n if (categories)\n return (\n menuHelpers.getSelected(categories)[0]?.primary ??\n menuHelpers.flatten(categories)[0].primary\n );\n }, [categories]);\n\n const handleLoadMore = useCallback(\n debounce(() => {\n if (!loading) {\n onLoadMore?.();\n }\n }, 200),\n [loading]\n );\n\n useItemIntersection(tablistRef, items.length - 1, handleLoadMore, ':scope > li');\n\n useEffect(() => {\n if (loading) setAnnouncement(t('loading_email'));\n }, [loading]);\n\n useEffect(() => {\n if (prevEmail) {\n const difference = items.length - prevEmail.length;\n if (difference) setAnnouncement(t('new_emails_count', [difference], { count: difference }));\n }\n }, [items]);\n\n useEffect(() => {\n if (tabRefs.length > 0 && currentItemId) {\n tabRefs[items.findIndex(item => item.id === currentItemId)]?.current?.focus();\n }\n }, [currentItemId]);\n\n return (\n <StyledEmailSummaryListContainer container={{ direction: 'column' }} {...restProps}>\n {!!(categories?.length || searchQuery) && (\n <StyledEmailSummaryListHeader>\n <StyledActionWrapper\n container={{ justify: 'space-between', alignItems: 'center', gap: 0.5 }}\n >\n <Flex item={{ shrink: 1 }}>\n {searchQuery ? (\n <StyledText variant='h3'>{t('search_results')}</StyledText>\n ) : (\n <StyledWorklist\n text={buttonText}\n variant='text'\n popover={{ portal: true }}\n menu={{\n mode: 'single-select',\n items: categories,\n onItemClick: onCategoryClick\n }}\n />\n )}\n </Flex>\n {countMessage && <StyledText variant='secondary'>{countMessage}</StyledText>}\n {filters && (\n <StyledFilterButton variant='simple' label={t('email_filters')} icon>\n <Icon name='filter' />\n </StyledFilterButton>\n )}\n </StyledActionWrapper>\n </StyledEmailSummaryListHeader>\n )}\n\n {items.length > 0 ? (\n <Flex\n role={selectable ? 'tablist' : undefined}\n container={{ direction: 'column' }}\n as={StyledEmailSummaryList}\n ref={tablistRef}\n >\n <VisuallyHiddenText aria-live='polite'>{announcement}</VisuallyHiddenText>\n {items.map((emailItem, i) => {\n const { id, ...emailItemProps } = emailItem;\n return (\n <EmailSummaryItem\n searchQuery={searchQuery}\n ref={tabRefs[i]}\n id={id}\n key={id}\n {...emailItemProps}\n onSelect={(selectedItemId: EmailSummaryItemProps['id']) => {\n onItemClick(selectedItemId);\n }}\n role={selectable ? 'tab' : undefined}\n active={selectable ? currentItemId === id : undefined}\n />\n );\n })}\n {loading && (\n <Flex container={{ justify: 'center' }} as={StyledLoadMore}>\n <Progress placement='inline' />\n </Flex>\n )}\n </Flex>\n ) : (\n <EmptyState message={emptyMessage} />\n )}\n </StyledEmailSummaryListContainer>\n );\n }\n);\n\nexport default EmailSummaryList;\n"]}
|
|
1
|
+
{"version":3,"file":"EmailSummaryList.js","sourceRoot":"","sources":["../../../src/components/Email/EmailSummaryList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE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AAE,EAAE,KAEF,cAAc,EAClB,QAAQ,EAAE,CAAC,cAA2C,EAAE,EAAE;oCACxD,WAAW,CAAC,cAAc,CAAC,CAAC;gCAC9B,CAAC,EACD,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,EACpC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,aAAa,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,IANhD,EAAE,CAOP,CACH,CAAC;wBACJ,CAAC,CAAC,GACG,EACN,OAAO,IAAI,CACV,KAAC,IAAI,IAAC,SAAS,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,cAAc,YACxD,KAAC,QAAQ,IAAC,SAAS,EAAC,QAAQ,EAAC,OAAO,EAAE,CAAC,CAAC,eAAe,CAAC,GAAI,GACvD,CACR,IACA,CACJ,CAAC,CAAC,CAAC,CACF,KAAC,UAAU,IAAC,OAAO,EAAE,YAAY,GAAI,CACtC,IAC+B,CACnC,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["import { createRef, useMemo, useState, useEffect, forwardRef, useCallback } from 'react';\nimport type { PropsWithoutRef } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Button,\n defaultThemeProp,\n Flex,\n Icon,\n registerIcon,\n MenuButton,\n useConsolidatedRef,\n useI18n,\n menuHelpers,\n Progress,\n useItemIntersection,\n usePrevious,\n EmptyState,\n calculateFontSize,\n StyledText,\n useArrows,\n debounce,\n useLiveLog\n} from '@pega/cosmos-react-core';\nimport type { ForwardRefForwardPropsComponent } from '@pega/cosmos-react-core';\nimport * as filterIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/filter.icon';\n\nimport type { EmailSummaryItemProps, EmailSummaryListProps } from './Email.types';\nimport EmailSummaryItem from './EmailSummaryItem';\nimport { StyledEmailSummaryList, StyledLoadMore } from './Email.styles';\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(\n ({\n theme: {\n base: { spacing }\n }\n }) => {\n return css`\n padding: ${spacing} calc(2 * ${spacing});\n `;\n }\n);\nStyledEmailSummaryListHeader.defaultProps = defaultThemeProp;\n\nconst StyledActionWrapper = styled(Flex)(({ theme }) => {\n return css`\n padding-block-start: ${theme.base.spacing};\n\n & > ${StyledText} {\n white-space: nowrap;\n }\n `;\n});\nStyledActionWrapper.defaultProps = defaultThemeProp;\n\nconst StyledFilterButton = styled(Button)`\n margin-inline-start: auto;\n`;\n\nconst StyledWorklist = styled(MenuButton)(({ theme }) => {\n const { 'font-size': fontSize, 'font-scale': fontScale } = theme.base;\n const fontSizes = calculateFontSize(fontSize, fontScale);\n return css`\n ${StyledText} {\n font-weight: ${theme.base['font-weight']['semi-bold']};\n font-size: ${fontSizes.m};\n }\n `;\n});\n\nStyledWorklist.defaultProps = defaultThemeProp;\n\nconst EmailSummaryList: ForwardRefForwardPropsComponent<EmailSummaryListProps> = forwardRef(\n function EmailSummaryList(\n {\n loading = false,\n onLoadMore,\n categories,\n onCategoryClick,\n items,\n count,\n filters,\n onFilterChange,\n onItemClick,\n emptyMessage,\n currentItemId,\n selectable = true,\n searchQuery,\n ...restProps\n }: PropsWithoutRef<EmailSummaryListProps>,\n ref: EmailSummaryListProps['ref']\n ) {\n const t = useI18n();\n const tablistRef = useConsolidatedRef(ref);\n const tabRefs = items.map(() => createRef<HTMLLIElement>());\n const prevEmail = usePrevious(items);\n const { announcePolite } = useLiveLog();\n\n const countMessage = useMemo(() => {\n if (count) {\n const { total, unread } = count;\n return unread\n ? `${t('unread_email_count', [unread, total])}`\n : `${t('results_count', [total], { count: total })}`;\n }\n }, [count]);\n const [announcement, setAnnouncement] = useState('');\n useArrows(\n tablistRef,\n {\n cycle: true,\n selector: ':scope > li',\n dir: 'up-down',\n updateTabIndex: !currentItemId\n },\n [items]\n );\n\n const buttonText = useMemo(() => {\n if (categories)\n return (\n menuHelpers.getSelected(categories)[0]?.primary ??\n menuHelpers.flatten(categories)[0].primary\n );\n }, [categories]);\n\n const handleLoadMore = useCallback(\n debounce(() => {\n if (!loading) {\n onLoadMore?.();\n }\n }, 200),\n [loading]\n );\n\n useItemIntersection(tablistRef, items.length - 1, handleLoadMore, ':scope > li');\n\n useEffect(() => {\n if (loading) setAnnouncement(t('loading_email'));\n }, [loading]);\n\n useEffect(() => {\n if (prevEmail) {\n const difference = items.length - prevEmail.length;\n if (difference) setAnnouncement(t('new_emails_count', [difference], { count: difference }));\n }\n }, [items]);\n\n useEffect(() => {\n if (tabRefs.length > 0 && currentItemId) {\n tabRefs[items.findIndex(item => item.id === currentItemId)]?.current?.focus();\n }\n }, [currentItemId]);\n\n useEffect(() => {\n if (announcement) {\n announcePolite({\n message: announcement\n });\n }\n }, [announcement]);\n\n return (\n <StyledEmailSummaryListContainer container={{ direction: 'column' }} {...restProps}>\n {!!(categories?.length || searchQuery) && (\n <StyledEmailSummaryListHeader>\n <StyledActionWrapper\n container={{ justify: 'space-between', alignItems: 'center', gap: 0.5 }}\n >\n <Flex item={{ shrink: 1 }}>\n {searchQuery ? (\n <StyledText variant='h3'>{t('search_results')}</StyledText>\n ) : (\n <StyledWorklist\n text={buttonText}\n variant='text'\n popover={{ portal: true }}\n menu={{\n mode: 'single-select',\n items: categories,\n onItemClick: onCategoryClick\n }}\n />\n )}\n </Flex>\n {countMessage && <StyledText variant='secondary'>{countMessage}</StyledText>}\n {filters && (\n <StyledFilterButton variant='simple' label={t('email_filters')} icon>\n <Icon name='filter' />\n </StyledFilterButton>\n )}\n </StyledActionWrapper>\n </StyledEmailSummaryListHeader>\n )}\n\n {items.length > 0 ? (\n <>\n <Flex\n role={selectable ? 'tablist' : undefined}\n container={{ direction: 'column' }}\n as={StyledEmailSummaryList}\n ref={tablistRef}\n >\n {items.map((emailItem, i) => {\n const { id, ...emailItemProps } = emailItem;\n return (\n <EmailSummaryItem\n searchQuery={searchQuery}\n ref={tabRefs[i]}\n id={id}\n key={id}\n {...emailItemProps}\n onSelect={(selectedItemId: EmailSummaryItemProps['id']) => {\n onItemClick(selectedItemId);\n }}\n role={selectable ? 'tab' : undefined}\n active={selectable ? currentItemId === id : undefined}\n />\n );\n })}\n </Flex>\n {loading && (\n <Flex container={{ justify: 'center' }} as={StyledLoadMore}>\n <Progress placement='inline' message={t('loading_email')} />\n </Flex>\n )}\n </>\n ) : (\n <EmptyState message={emptyMessage} />\n )}\n </StyledEmailSummaryListContainer>\n );\n }\n);\n\nexport default EmailSummaryList;\n"]}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import type { FunctionComponent } from 'react';
|
|
2
|
-
import type { ForwardProps } from '@pega/cosmos-react-core';
|
|
3
1
|
import type { EntityListProps } from './Email.types';
|
|
4
|
-
declare const EntityList:
|
|
2
|
+
declare const EntityList: import("react").ForwardRefExoticComponent<Omit<EntityListProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
5
3
|
export default EntityList;
|
|
6
4
|
//# sourceMappingURL=EntityList.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityList.d.ts","sourceRoot":"","sources":["../../../src/components/Email/EntityList.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EntityList.d.ts","sourceRoot":"","sources":["../../../src/components/Email/EntityList.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAoB,eAAe,EAAe,MAAM,eAAe,CAAC;AAEpF,QAAA,MAAM,UAAU,yHAuGd,CAAC;AAEH,eAAe,UAAU,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityList.js","sourceRoot":"","sources":["../../../src/components/Email/EntityList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE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AE,cAAc,EAC7C,WAAW,EAAE;4BACX,GAAG,WAAW;4BACd,KAAK,EAAE,gBAAgB;4BACvB,OAAO,EAAE,kBAAkB;4BAC3B,WAAW;yBACZ,EACD,UAAU,EAAE,aAAa,CAAC,UAAU,EACpC,IAAI,EAAE,WAAW,GACjB,CACH,IACW,CACf,CAAC,CAAC,CAAC,CACF,KAAC,UAAU,KAAG,CACf,IACI,CACR,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,UAAU,CAAC","sourcesContent":["import { forwardRef, useState, useEffect, useImperativeHandle } from 'react';\nimport type { PropsWithoutRef, MouseEvent } from 'react';\n\nimport {\n Text,\n Flex,\n Icon,\n Card,\n CardHeader,\n CardContent,\n useScrollToggle,\n useElement,\n useOuterEvent,\n EmptyState,\n useConsolidatedRef\n} from '@pega/cosmos-react-core';\n\nimport ContextMenuPopover from './ContextMenuPopover';\nimport { StyledEntityList } from './Email.styles';\nimport EmailEntity from './EmailEntity';\nimport type { ContextMenuProps, EntityListProps, TargetProps } from './Email.types';\n\nconst EntityList = forwardRef(function EntityList(\n { content, header, contextMenu }: PropsWithoutRef<EntityListProps>,\n ref: EntityListProps['ref']\n) {\n const [popoverOpen, setPopoverOpen] = useState(false);\n const [currentTarget, setCurrentTarget] = useState<TargetProps | undefined>();\n const { disableScroll, enableScroll } = useScrollToggle();\n // Only way to set this is through imperative handle\n const [contextMenuItems, setContextMenuItems] = useState<ContextMenuProps['items']>([]);\n const [contextMenuLoading, setContextMenuLoading] = useState<boolean>(false);\n const [popoverEl, setPopoverEl] = useElement<HTMLDivElement>();\n const popoverRef = useConsolidatedRef(setPopoverEl, contextMenu?.popoverRef);\n\n useOuterEvent('mousedown', [popoverEl], () => {\n if (popoverOpen) setPopoverOpen(false);\n });\n\n useImperativeHandle(contextMenu?.handle, () => ({\n setItems: (ctxMenuItems: ContextMenuProps['items']) => {\n setContextMenuItems(ctxMenuItems || []);\n },\n setLoading(loading) {\n setContextMenuLoading(loading);\n },\n setOpen(visible) {\n setPopoverOpen(visible);\n }\n }));\n\n // Handler for right click\n const onContextMenu = (e: MouseEvent<HTMLDivElement>) => {\n if (e.target instanceof Element && e.target.textContent?.trim()) {\n setCurrentTarget({\n targetNode: e.target,\n cursorPosition: {\n x: e.pageX - window.scrollX,\n y: e.pageY - window.scrollY\n }\n });\n contextMenu?.onContextMenu(e);\n }\n };\n\n const onItemClick: ContextMenuProps['onItemClick'] = (selectedValue: {\n fieldName: string;\n fieldValue: string;\n }) => {\n setPopoverOpen(false);\n contextMenu?.onItemClick(selectedValue);\n };\n\n const fields = content.map(data => {\n return data.value\n ? {\n ...data,\n value: (\n // Attach the handler only when context menu is enabled\n <Flex container={{ gap: 0.5, wrap: 'wrap' }} onContextMenu={onContextMenu}>\n {data.value.map(entityObject => {\n return <EmailEntity key={entityObject.id} entity={entityObject.entity} />;\n })}\n </Flex>\n )\n }\n : data;\n });\n\n useEffect(() => {\n if (popoverOpen) disableScroll();\n else enableScroll();\n }, [popoverOpen]);\n\n return (\n <Card ref={ref}>\n {header && (\n <CardHeader container={{ alignItems: 'center', gap: 1 }}>\n <Icon name={header.icon} />\n <Text variant='h3'>{header.text}</Text>\n </CardHeader>\n )}\n {content.length > 0 ? (\n <CardContent>\n <StyledEntityList fields={fields} variant='stacked' />\n {contextMenu && currentTarget && (\n <ContextMenuPopover\n ref={popoverRef}\n cursorPosition={currentTarget?.cursorPosition}\n contextMenu={{\n ...contextMenu,\n items: contextMenuItems,\n loading: contextMenuLoading,\n onItemClick\n }}\n targetNode={currentTarget.targetNode}\n show={popoverOpen}\n />\n )}\n </CardContent>\n ) : (\n <EmptyState />\n )}\n </Card>\n );\n});\n\nexport default EntityList;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityHighlighter.d.ts","sourceRoot":"","sources":["../../../../src/components/Email/utils/EntityHighlighter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EntityHighlighter.d.ts","sourceRoot":"","sources":["../../../../src/components/Email/utils/EntityHighlighter.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAA2B,MAAM,gBAAgB,CAAC;AA+R1E;;;;;GAKG;AACH,QAAA,MAAM,iBAAiB,SACf,MAAM,iBACG,UAAU,CAAC,wBAAwB,CAAC,KAClD,MAMF,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|