@pega/cosmos-react-social 3.0.0-dev.2.1 → 3.0.0-dev.21.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/Chat/Chat.js +1 -1
- package/lib/components/Chat/Chat.js.map +1 -1
- package/lib/components/Chat/ChatBody.js +1 -1
- package/lib/components/Chat/ChatBody.js.map +1 -1
- package/lib/components/Chat/ChatComposer.d.ts.map +1 -1
- package/lib/components/Chat/ChatComposer.js +6 -6
- package/lib/components/Chat/ChatComposer.js.map +1 -1
- package/lib/components/Chat/ChatHeader.d.ts.map +1 -1
- package/lib/components/Chat/ChatHeader.js +2 -3
- package/lib/components/Chat/ChatHeader.js.map +1 -1
- package/lib/components/Chat/ChatTranscript.js +3 -3
- package/lib/components/Chat/ChatTranscript.js.map +1 -1
- package/lib/components/Chat/Message.d.ts.map +1 -1
- package/lib/components/Chat/Message.js +9 -9
- package/lib/components/Chat/Message.js.map +1 -1
- package/lib/components/Chat/Message.styles.d.ts +1 -0
- package/lib/components/Chat/Message.styles.d.ts.map +1 -1
- package/lib/components/Chat/Message.styles.js +12 -3
- package/lib/components/Chat/Message.styles.js.map +1 -1
- package/lib/components/Chat/MessageList.js +3 -3
- package/lib/components/Chat/MessageList.js.map +1 -1
- package/lib/components/Chat/RepeatingView.js +1 -1
- package/lib/components/Chat/RepeatingView.js.map +1 -1
- package/lib/components/Chat/SuggestedReplyPicker.js +6 -6
- package/lib/components/Chat/SuggestedReplyPicker.js.map +1 -1
- package/lib/components/Chat/SystemMessage.js +3 -3
- package/lib/components/Chat/SystemMessage.js.map +1 -1
- package/lib/components/Chat/TranscriptMessage.js +2 -2
- package/lib/components/Chat/TranscriptMessage.js.map +1 -1
- package/lib/components/Chat/TypeIndicator.js +1 -1
- package/lib/components/Chat/TypeIndicator.js.map +1 -1
- package/lib/components/Email/ContextMenuPopover.d.ts +5 -0
- package/lib/components/Email/ContextMenuPopover.d.ts.map +1 -0
- package/lib/components/Email/ContextMenuPopover.js +50 -0
- package/lib/components/Email/ContextMenuPopover.js.map +1 -0
- package/lib/components/Email/Email.d.ts.map +1 -1
- package/lib/components/Email/Email.js +107 -32
- package/lib/components/Email/Email.js.map +1 -1
- package/lib/components/Email/Email.styles.d.ts +21 -2
- package/lib/components/Email/Email.styles.d.ts.map +1 -1
- package/lib/components/Email/Email.styles.js +97 -27
- package/lib/components/Email/Email.styles.js.map +1 -1
- package/lib/components/Email/Email.types.d.ts +142 -36
- 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/EmailComposer.d.ts +1 -1
- package/lib/components/Email/EmailComposer.d.ts.map +1 -1
- package/lib/components/Email/EmailComposer.js +103 -124
- package/lib/components/Email/EmailComposer.js.map +1 -1
- package/lib/components/Email/EmailConversation.d.ts.map +1 -1
- package/lib/components/Email/EmailConversation.js +12 -7
- package/lib/components/Email/EmailConversation.js.map +1 -1
- package/lib/components/Email/EmailEntity.d.ts.map +1 -1
- package/lib/components/Email/EmailEntity.js +7 -3
- package/lib/components/Email/EmailEntity.js.map +1 -1
- package/lib/components/Email/EmailManager.d.ts +6 -0
- package/lib/components/Email/EmailManager.d.ts.map +1 -0
- package/lib/components/Email/EmailManager.js +36 -0
- package/lib/components/Email/EmailManager.js.map +1 -0
- package/lib/components/Email/EmailSelector.d.ts +5 -3
- package/lib/components/Email/EmailSelector.d.ts.map +1 -1
- package/lib/components/Email/EmailSelector.js +36 -33
- package/lib/components/Email/EmailSelector.js.map +1 -1
- package/lib/components/Email/EmailShell.d.ts.map +1 -1
- package/lib/components/Email/EmailShell.js +9 -5
- package/lib/components/Email/EmailShell.js.map +1 -1
- package/lib/components/Email/EmailSummaryItem.d.ts.map +1 -1
- package/lib/components/Email/EmailSummaryItem.js +25 -11
- package/lib/components/Email/EmailSummaryItem.js.map +1 -1
- package/lib/components/Email/EmailSummaryList.d.ts.map +1 -1
- package/lib/components/Email/EmailSummaryList.js +53 -60
- package/lib/components/Email/EmailSummaryList.js.map +1 -1
- package/lib/components/Email/EntityList.d.ts +6 -0
- package/lib/components/Email/EntityList.d.ts.map +1 -0
- package/lib/components/Email/EntityList.js +79 -0
- package/lib/components/Email/EntityList.js.map +1 -0
- package/lib/components/Email/index.d.ts +3 -2
- package/lib/components/Email/index.d.ts.map +1 -1
- package/lib/components/Email/index.js +2 -1
- package/lib/components/Email/index.js.map +1 -1
- package/lib/components/Feed/Feed.context.d.ts +5 -0
- package/lib/components/Feed/Feed.context.d.ts.map +1 -1
- package/lib/components/Feed/Feed.context.js.map +1 -1
- package/lib/components/Feed/Feed.d.ts +5 -1
- package/lib/components/Feed/Feed.d.ts.map +1 -1
- package/lib/components/Feed/Feed.js +23 -45
- package/lib/components/Feed/Feed.js.map +1 -1
- package/lib/components/Feed/FeedAnnouncer.js +1 -1
- package/lib/components/Feed/FeedAnnouncer.js.map +1 -1
- package/lib/components/Feed/FeedAttachments.js +3 -3
- package/lib/components/Feed/FeedAttachments.js.map +1 -1
- package/lib/components/Feed/FeedContent.js +1 -1
- package/lib/components/Feed/FeedContent.js.map +1 -1
- package/lib/components/Feed/FeedLikeButton.d.ts +1 -1
- package/lib/components/Feed/FeedLikeButton.d.ts.map +1 -1
- package/lib/components/Feed/FeedLikeButton.js +10 -8
- package/lib/components/Feed/FeedLikeButton.js.map +1 -1
- package/lib/components/Feed/FeedModalList.d.ts +2 -0
- package/lib/components/Feed/FeedModalList.d.ts.map +1 -1
- package/lib/components/Feed/FeedModalList.js +25 -38
- package/lib/components/Feed/FeedModalList.js.map +1 -1
- package/lib/components/Feed/FeedNewPost.d.ts.map +1 -1
- package/lib/components/Feed/FeedNewPost.js +4 -4
- package/lib/components/Feed/FeedNewPost.js.map +1 -1
- package/lib/components/Feed/FeedNewPostTypeMenu.js +8 -8
- package/lib/components/Feed/FeedNewPostTypeMenu.js.map +1 -1
- package/lib/components/Feed/FeedPost.d.ts.map +1 -1
- package/lib/components/Feed/FeedPost.js +43 -20
- package/lib/components/Feed/FeedPost.js.map +1 -1
- package/lib/components/Feed/FeedPost.types.d.ts +8 -2
- package/lib/components/Feed/FeedPost.types.d.ts.map +1 -1
- package/lib/components/Feed/FeedPost.types.js.map +1 -1
- package/lib/components/Feed/FeedReply.d.ts.map +1 -1
- package/lib/components/Feed/FeedReply.js +35 -13
- package/lib/components/Feed/FeedReply.js.map +1 -1
- package/lib/components/Feed/FeedReply.types.d.ts +6 -2
- package/lib/components/Feed/FeedReply.types.d.ts.map +1 -1
- package/lib/components/Feed/FeedReply.types.js.map +1 -1
- package/lib/components/Feed/FeedReplyInput.d.ts.map +1 -1
- package/lib/components/Feed/FeedReplyInput.js +5 -5
- package/lib/components/Feed/FeedReplyInput.js.map +1 -1
- package/lib/components/Feed/FeedRichText.d.ts +1 -1
- package/lib/components/Feed/FeedRichText.d.ts.map +1 -1
- package/lib/components/Feed/FeedRichText.js +18 -8
- package/lib/components/Feed/FeedRichText.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 +2 -0
- package/lib/components/MentionButton/MentionButton.d.ts.map +1 -1
- package/lib/components/MentionButton/MentionButton.js +22 -6
- package/lib/components/MentionButton/MentionButton.js.map +1 -1
- package/package.json +16 -13
- package/lib/components/Email/ViewAnalysis.d.ts +0 -6
- package/lib/components/Email/ViewAnalysis.d.ts.map +0 -1
- package/lib/components/Email/ViewAnalysis.js +0 -20
- package/lib/components/Email/ViewAnalysis.js.map +0 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { createRef, useMemo, useState, useEffect, forwardRef,
|
|
2
|
+
import { createRef, useMemo, useState, useEffect, forwardRef, useCallback } from 'react';
|
|
3
3
|
import styled, { css } from 'styled-components';
|
|
4
|
-
import { Button, Count, defaultThemeProp, Flex, Icon, registerIcon, MenuButton,
|
|
4
|
+
import { Button, Count, defaultThemeProp, Flex, Icon, registerIcon, MenuButton, useConsolidatedRef, useI18n, menuHelpers, Progress, useItemIntersection, usePrevious, VisuallyHiddenText, EmptyState, calculateFontSize, StyledText, useArrows, debounce } 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, { StyledEmailSummaryItem } from './EmailSummaryItem';
|
|
7
|
+
import { StyledLoadMore } from './Email.styles';
|
|
7
8
|
registerIcon(filterIcon);
|
|
8
9
|
const StyledEmailSummaryListContainer = styled(Flex)(({ theme }) => {
|
|
9
10
|
return css `
|
|
@@ -44,72 +45,64 @@ const StyledEmailSummaryList = styled.div(({ theme }) => {
|
|
|
44
45
|
`;
|
|
45
46
|
});
|
|
46
47
|
StyledEmailSummaryList.defaultProps = defaultThemeProp;
|
|
47
|
-
const
|
|
48
|
+
const StyledWorklist = styled(MenuButton)(({ theme }) => {
|
|
49
|
+
const { 'font-size': fontSize, 'font-scale': fontScale } = theme.base;
|
|
50
|
+
const fontSizes = calculateFontSize(fontSize, fontScale);
|
|
51
|
+
return css `
|
|
52
|
+
${StyledText} {
|
|
53
|
+
font-weight: ${theme.base['font-weight']['semi-bold']};
|
|
54
|
+
font-size: ${fontSizes.m};
|
|
55
|
+
}
|
|
56
|
+
`;
|
|
57
|
+
});
|
|
58
|
+
StyledWorklist.defaultProps = defaultThemeProp;
|
|
59
|
+
const EmailSummaryList = forwardRef(({ loading = false, onLoadMore, categories, onCategoryClick, items, unreadEmailCount, filters, onFilterChange, onItemClick, emptyMessage, ...restProps }, ref) => {
|
|
48
60
|
const t = useI18n();
|
|
49
61
|
const tablistRef = useConsolidatedRef(ref);
|
|
50
62
|
const tabRefs = items.map(() => createRef());
|
|
51
|
-
const
|
|
52
|
-
const
|
|
53
|
-
const [
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
focusEl: tablistRef.current,
|
|
57
|
-
scope: tablistRef.current,
|
|
63
|
+
const prevEmail = usePrevious(items);
|
|
64
|
+
const [announcement, setAnnouncement] = useState('');
|
|
65
|
+
const [activeItemId, setActiveItemId] = useState(null);
|
|
66
|
+
useArrows(tablistRef, {
|
|
67
|
+
cycle: true,
|
|
58
68
|
selector: 'button[role="tab"]',
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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]);
|
|
69
|
+
dir: 'up-down',
|
|
70
|
+
allowTabFocus: true
|
|
71
|
+
}, [items]);
|
|
75
72
|
const buttonText = useMemo(() => {
|
|
76
73
|
return (menuHelpers.getSelected(categories)[0]?.primary ??
|
|
77
74
|
menuHelpers.flatten(categories)[0].primary);
|
|
78
75
|
}, [categories]);
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
onItemClick(id);
|
|
110
|
-
}
|
|
111
|
-
}, active: activeDescendant && activeDescendant.id === id }, id));
|
|
112
|
-
}) }, void 0)] }, void 0));
|
|
76
|
+
const handleLoadMore = useCallback(debounce(() => {
|
|
77
|
+
if (!loading) {
|
|
78
|
+
onLoadMore?.();
|
|
79
|
+
}
|
|
80
|
+
}, 200), [loading]);
|
|
81
|
+
useItemIntersection(tablistRef, items.length - 1, handleLoadMore, ':scope > button[role="tab"]');
|
|
82
|
+
useEffect(() => {
|
|
83
|
+
if (loading)
|
|
84
|
+
setAnnouncement(t('loading_email'));
|
|
85
|
+
}, [loading]);
|
|
86
|
+
useEffect(() => {
|
|
87
|
+
if (prevEmail) {
|
|
88
|
+
const difference = items.length - prevEmail.length;
|
|
89
|
+
if (difference)
|
|
90
|
+
setAnnouncement(t('new_emails_count', [difference], { count: difference }));
|
|
91
|
+
}
|
|
92
|
+
}, [items]);
|
|
93
|
+
return (_jsxs(StyledEmailSummaryListContainer, { container: { direction: 'column' }, ...restProps, children: [_jsx(StyledEmailSummaryListHeader, { children: _jsxs(StyledActionWrapper, { container: { alignItems: 'center', gap: 0.5 }, children: [_jsx(StyledWorklist, { text: buttonText, variant: 'text', menu: {
|
|
94
|
+
mode: 'single-select',
|
|
95
|
+
items: categories,
|
|
96
|
+
onItemClick: onCategoryClick
|
|
97
|
+
} }), typeof unreadEmailCount === 'number' && (_jsx(Count, { "aria-label": t('unread_email_count', [unreadEmailCount], {
|
|
98
|
+
count: unreadEmailCount
|
|
99
|
+
}), variant: 'default', children: unreadEmailCount })), _jsx(StyledFilterButton, { variant: 'simple', label: t('email_filters'), icon: true, children: _jsx(Icon, { name: 'filter' }) })] }) }), items.length > 0 ? (_jsxs(StyledEmailSummaryList, { role: 'tablist', tabIndex: -1, ref: tablistRef, children: [_jsx(VisuallyHiddenText, { "aria-live": 'polite', children: announcement }), items.map((emailItem, i) => {
|
|
100
|
+
const { id, ...emailItemProps } = emailItem;
|
|
101
|
+
return (_jsx(EmailSummaryItem, { ref: tabRefs[i], id: id, role: 'tab', ...emailItemProps, onSelect: (selectedItemId) => {
|
|
102
|
+
setActiveItemId(selectedItemId);
|
|
103
|
+
onItemClick(selectedItemId);
|
|
104
|
+
}, active: activeItemId === id }, id));
|
|
105
|
+
}), loading && (_jsx(Flex, { container: { justify: 'center' }, as: StyledLoadMore, children: _jsx(Progress, { placement: 'inline' }) }))] })) : (_jsx(EmptyState, { message: emptyMessage }))] }));
|
|
113
106
|
});
|
|
114
107
|
export default EmailSummaryList;
|
|
115
108
|
//# sourceMappingURL=EmailSummaryList.js.map
|
|
@@ -1 +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;;wBAEY,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC;GAC7D,CAAC;AACJ,CAAC,CAAC,CAAC;AACH,+BAA+B,CAAC,YAAY,GAA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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"]}
|
|
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,EAEV,WAAW,EACZ,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,kBAAkB,EAClB,OAAO,EACP,WAAW,EACX,QAAQ,EACR,mBAAmB,EACnB,WAAW,EACX,kBAAkB,EAClB,UAAU,EACV,iBAAiB,EACjB,UAAU,EACV,SA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ACxD,eAAe,CAAC,cAAc,CAAC,CAAC;gCAChC,WAAW,CAAC,cAAc,CAAC,CAAC;4BAC9B,CAAC,EACD,MAAM,EAAE,YAAY,KAAK,EAAE,IAPtB,EAAE,CAQP,CACH,CAAC;oBACJ,CAAC,CAAC,EACD,OAAO,IAAI,CACV,KAAC,IAAI,IAAC,SAAS,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,cAAc,YACxD,KAAC,QAAQ,IAAC,SAAS,EAAC,QAAQ,GAAG,GAC1B,CACR,IACsB,CAC1B,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 {\n createRef,\n useMemo,\n useState,\n useEffect,\n forwardRef,\n FunctionComponent,\n useCallback\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 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 * as filterIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/filter.icon';\n\nimport { EmailSummaryItemProps, EmailSummaryListProps } from './Email.types';\nimport EmailSummaryItem, { StyledEmailSummaryItem } from './EmailSummaryItem';\nimport { 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(({ 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 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 (\n {\n loading = false,\n onLoadMore,\n categories,\n onCategoryClick,\n items,\n unreadEmailCount,\n filters,\n onFilterChange,\n onItemClick,\n emptyMessage,\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 prevEmail = usePrevious(items);\n const [announcement, setAnnouncement] = useState('');\n const [activeItemId, setActiveItemId] = useState<string | null>(null);\n\n useArrows(\n tablistRef,\n {\n cycle: true,\n selector: 'button[role=\"tab\"]',\n dir: 'up-down',\n allowTabFocus: true\n },\n [items]\n );\n\n const buttonText = useMemo(() => {\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(\n tablistRef,\n items.length - 1,\n handleLoadMore,\n ':scope > button[role=\"tab\"]'\n );\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 return (\n <StyledEmailSummaryListContainer container={{ direction: 'column' }} {...restProps}>\n <StyledEmailSummaryListHeader>\n <StyledActionWrapper container={{ alignItems: 'center', gap: 0.5 }}>\n <StyledWorklist\n text={buttonText}\n variant='text'\n menu={{\n mode: 'single-select',\n items: categories,\n onItemClick: onCategoryClick\n }}\n />\n {typeof unreadEmailCount === 'number' && (\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 {items.length > 0 ? (\n <StyledEmailSummaryList role='tablist' tabIndex={-1} ref={tablistRef}>\n <VisuallyHiddenText aria-live='polite'>{announcement}</VisuallyHiddenText>\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 onSelect={(selectedItemId: EmailSummaryItemProps['id']) => {\n setActiveItemId(selectedItemId);\n onItemClick(selectedItemId);\n }}\n active={activeItemId === id}\n />\n );\n })}\n {loading && (\n <Flex container={{ justify: 'center' }} as={StyledLoadMore}>\n <Progress placement='inline' />\n </Flex>\n )}\n </StyledEmailSummaryList>\n ) : (\n <EmptyState message={emptyMessage} />\n )}\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 { EntityListProps } from './Email.types';
|
|
4
|
+
declare const EntityList: FunctionComponent<EntityListProps & ForwardProps>;
|
|
5
|
+
export default EntityList;
|
|
6
|
+
//# sourceMappingURL=EntityList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EntityList.d.ts","sourceRoot":"","sources":["../../../src/components/Email/EntityList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAMlB,MAAM,OAAO,CAAC;AAEf,OAAO,EACL,YAAY,EAUb,MAAM,yBAAyB,CAAC;AAKjC,OAAO,EAAoB,eAAe,EAAe,MAAM,eAAe,CAAC;AAE/E,QAAA,MAAM,UAAU,EAAE,iBAAiB,CAAC,eAAe,GAAG,YAAY,CA8GjE,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useState, useEffect, useImperativeHandle } from 'react';
|
|
3
|
+
import { Text, Flex, Icon, Card, CardHeader, CardContent, useScrollToggle, useElement, useOuterEvent } from '@pega/cosmos-react-core';
|
|
4
|
+
import ContextMenuPopover from './ContextMenuPopover';
|
|
5
|
+
import { StyledEntityList } from './Email.styles';
|
|
6
|
+
import EmailEntity from './EmailEntity';
|
|
7
|
+
const EntityList = forwardRef(({ content, header, contextMenu }, ref) => {
|
|
8
|
+
const [popoverOpen, setPopoverOpen] = useState(false);
|
|
9
|
+
const [currentTarget, setCurrentTarget] = useState({
|
|
10
|
+
targetNode: null,
|
|
11
|
+
cursorPosition: {
|
|
12
|
+
x: 0,
|
|
13
|
+
y: 0
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
const { disableScroll, enableScroll } = useScrollToggle();
|
|
17
|
+
// Only way to set this is through imperative handle
|
|
18
|
+
const [contextMenuItems, setContextMenuItems] = useState([]);
|
|
19
|
+
const [contextMenuLoading, setContextMenuLoading] = useState(false);
|
|
20
|
+
const [popoverEl, setPopoverEl] = useElement();
|
|
21
|
+
useOuterEvent('mousedown', [popoverEl], () => {
|
|
22
|
+
if (popoverOpen)
|
|
23
|
+
setPopoverOpen(false);
|
|
24
|
+
});
|
|
25
|
+
useImperativeHandle(contextMenu?.handle, () => ({
|
|
26
|
+
setContextMenuItems: (ctxMenuItems) => {
|
|
27
|
+
setContextMenuItems(ctxMenuItems || []);
|
|
28
|
+
setContextMenuLoading(false);
|
|
29
|
+
}
|
|
30
|
+
}));
|
|
31
|
+
// Handler for right click
|
|
32
|
+
const onContextMenu = (e) => {
|
|
33
|
+
e.preventDefault();
|
|
34
|
+
if (e.target instanceof HTMLElement && e.target.textContent?.trim()) {
|
|
35
|
+
setContextMenuItems([]);
|
|
36
|
+
setContextMenuLoading(true);
|
|
37
|
+
setPopoverOpen(true);
|
|
38
|
+
setCurrentTarget({
|
|
39
|
+
targetNode: e.target,
|
|
40
|
+
cursorPosition: {
|
|
41
|
+
x: e.pageX - window.scrollX,
|
|
42
|
+
y: e.pageY - window.scrollY
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
contextMenu?.onContextMenu(e);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
const onItemClick = (selectedValue) => {
|
|
49
|
+
setPopoverOpen(false);
|
|
50
|
+
contextMenu?.onItemClick(selectedValue);
|
|
51
|
+
};
|
|
52
|
+
const fields = content.map(data => {
|
|
53
|
+
return data.value
|
|
54
|
+
? {
|
|
55
|
+
...data,
|
|
56
|
+
value: (
|
|
57
|
+
/* Attach the handler only when context menu is enabled */
|
|
58
|
+
_jsx(Flex, { container: { gap: 0.5, wrap: 'wrap' }, onContextMenu: contextMenu?.onContextMenu ? onContextMenu : undefined, children: data.value.map(entityObject => {
|
|
59
|
+
return _jsx(EmailEntity, { entity: entityObject.entity }, entityObject.id);
|
|
60
|
+
}) }))
|
|
61
|
+
}
|
|
62
|
+
: data;
|
|
63
|
+
});
|
|
64
|
+
const { cursorPosition, targetNode } = currentTarget;
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
if (popoverOpen)
|
|
67
|
+
disableScroll();
|
|
68
|
+
else
|
|
69
|
+
enableScroll();
|
|
70
|
+
}, [popoverOpen]);
|
|
71
|
+
return (_jsxs(Card, { ref: ref, children: [header && (_jsxs(CardHeader, { container: { alignItems: 'center', gap: 1 }, children: [_jsx(Icon, { name: header.icon }), _jsx(Text, { variant: 'h3', children: header.text })] })), _jsxs(CardContent, { children: [_jsx(StyledEntityList, { fields: fields, variant: 'stacked' }), contextMenu && (_jsx(ContextMenuPopover, { ref: setPopoverEl, cursorPosition: cursorPosition, contextMenu: {
|
|
72
|
+
...contextMenu,
|
|
73
|
+
items: contextMenuItems,
|
|
74
|
+
loading: contextMenuLoading,
|
|
75
|
+
onItemClick
|
|
76
|
+
}, targetNode: targetNode, show: popoverOpen }))] })] }));
|
|
77
|
+
});
|
|
78
|
+
export default EntityList;
|
|
79
|
+
//# sourceMappingURL=EntityList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EntityList.js","sourceRoot":"","sources":["../../../src/components/Email/EntityList.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EAGV,QAAQ,EAER,SAAS,EACT,mBAAmB,EACpB,MAAM,OAAO,CAAC;AAEf,OAAO,EAEL,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,UAAU,EACV,WAAW,EACX,eAAe,EACf,UAAU,EACV,aAAa,EACd,MAAM,yBAAyB,CAAC;AAEjC,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,WAAW,MAAM,eAAe,CAAC;AAGxC,MAAM,UAAU,GAAsD,UAAU,CA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S,CAAC,GAAG,EAAE;QACb,IAAI,WAAW;YAAE,aAAa,EAAE,CAAC;;YAC5B,YAAY,EAAE,CAAC;IACtB,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAElB,OAAO,CACL,MAAC,IAAI,IAAC,GAAG,EAAE,GAAG,aACX,MAAM,IAAI,CACT,MAAC,UAAU,IAAC,SAAS,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,aACrD,KAAC,IAAI,IAAC,IAAI,EAAE,MAAM,CAAC,IAAI,GAAI,EAC3B,KAAC,IAAI,IAAC,OAAO,EAAC,IAAI,YAAE,MAAM,CAAC,IAAI,GAAQ,IAC5B,CACd,EACD,MAAC,WAAW,eACV,KAAC,gBAAgB,IAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAC,SAAS,GAAG,EAErD,WAAW,IAAI,CACd,KAAC,kBAAkB,IACjB,GAAG,EAAE,YAAY,EACjB,cAAc,EAAE,cAAc,EAC9B,WAAW,EAAE;4BACX,GAAG,WAAW;4BACd,KAAK,EAAE,gBAAgB;4BACvB,OAAO,EAAE,kBAAkB;4BAC3B,WAAW;yBACZ,EACD,UAAU,EAAE,UAAkB,EAC9B,IAAI,EAAE,WAAW,GACjB,CACH,IACW,IACT,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import {\n forwardRef,\n FunctionComponent,\n PropsWithoutRef,\n useState,\n MouseEvent,\n useEffect,\n useImperativeHandle\n} from 'react';\n\nimport {\n ForwardProps,\n Text,\n Flex,\n Icon,\n Card,\n CardHeader,\n CardContent,\n useScrollToggle,\n useElement,\n useOuterEvent\n} from '@pega/cosmos-react-core';\n\nimport ContextMenuPopover from './ContextMenuPopover';\nimport { StyledEntityList } from './Email.styles';\nimport EmailEntity from './EmailEntity';\nimport { ContextMenuProps, EntityListProps, TargetProps } from './Email.types';\n\nconst EntityList: FunctionComponent<EntityListProps & ForwardProps> = forwardRef(\n (\n { content, header, contextMenu }: PropsWithoutRef<EntityListProps>,\n ref: EntityListProps['ref']\n ) => {\n const [popoverOpen, setPopoverOpen] = useState(false);\n const [currentTarget, setCurrentTarget] = useState<TargetProps>({\n targetNode: null,\n cursorPosition: {\n x: 0,\n y: 0\n }\n });\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<HTMLElement>();\n\n useOuterEvent('mousedown', [popoverEl], () => {\n if (popoverOpen) setPopoverOpen(false);\n });\n\n useImperativeHandle(contextMenu?.handle, () => ({\n setContextMenuItems: (ctxMenuItems: ContextMenuProps['items']) => {\n setContextMenuItems(ctxMenuItems || []);\n setContextMenuLoading(false);\n }\n }));\n\n // Handler for right click\n const onContextMenu = (e: MouseEvent<HTMLDivElement>) => {\n e.preventDefault();\n if (e.target instanceof HTMLElement && e.target.textContent?.trim()) {\n setContextMenuItems([]);\n setContextMenuLoading(true);\n setPopoverOpen(true);\n setCurrentTarget({\n targetNode: e.target,\n cursorPosition: {\n x: e.pageX - window.scrollX,\n y: e.pageY - window.scrollY\n }\n });\n contextMenu?.onContextMenu(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\n container={{ gap: 0.5, wrap: 'wrap' }}\n onContextMenu={contextMenu?.onContextMenu ? onContextMenu : undefined}\n >\n {data.value.map(entityObject => {\n return <EmailEntity key={entityObject.id} entity={entityObject.entity} />;\n })}\n </Flex>\n )\n }\n : data;\n });\n const { cursorPosition, targetNode } = currentTarget;\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 <CardContent>\n <StyledEntityList fields={fields} variant='stacked' />\n\n {contextMenu && (\n <ContextMenuPopover\n ref={setPopoverEl}\n cursorPosition={cursorPosition}\n contextMenu={{\n ...contextMenu,\n items: contextMenuItems,\n loading: contextMenuLoading,\n onItemClick\n }}\n targetNode={targetNode as Node}\n show={popoverOpen}\n />\n )}\n </CardContent>\n </Card>\n );\n }\n);\n\nexport default EntityList;\n"]}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
export { default } from './Email';
|
|
2
|
-
export { EmailUser, EmailProps, EmailComposerProps, EmailConversationProps, EmailShellProps,
|
|
2
|
+
export { EmailUser, EmailProps, EmailComposerProps, EmailConversationProps, EmailShellProps, EntityListProps, EmailManagerProps, EmailTemplate, EmailSummaryListProps, EmailSummaryItemProps } from './Email.types';
|
|
3
3
|
export { default as EmailConversation } from './EmailConversation';
|
|
4
4
|
export { default as EmailShell } from './EmailShell';
|
|
5
5
|
export { default as EmailComposer } from './EmailComposer';
|
|
6
6
|
export { default as EmailSummaryItem } from './EmailSummaryItem';
|
|
7
7
|
export { default as EmailSummaryList } from './EmailSummaryList';
|
|
8
|
-
export { default as
|
|
8
|
+
export { default as EntityList } from './EntityList';
|
|
9
|
+
export { default as EmailManager } from './EmailManager';
|
|
9
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +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,
|
|
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,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,qBAAqB,EACrB,qBAAqB,EACtB,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,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -4,5 +4,6 @@ export { default as EmailShell } from './EmailShell';
|
|
|
4
4
|
export { default as EmailComposer } from './EmailComposer';
|
|
5
5
|
export { default as EmailSummaryItem } from './EmailSummaryItem';
|
|
6
6
|
export { default as EmailSummaryList } from './EmailSummaryList';
|
|
7
|
-
export { default as
|
|
7
|
+
export { default as EntityList } from './EntityList';
|
|
8
|
+
export { default as EmailManager } from './EmailManager';
|
|
8
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Email/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Email/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAalC,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,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,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 EntityListProps,\n EmailManagerProps,\n EmailTemplate,\n EmailSummaryListProps,\n EmailSummaryItemProps\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 EntityList } from './EntityList';\nexport { default as EmailManager } from './EmailManager';\n"]}
|
|
@@ -16,6 +16,11 @@ export interface FeedContextValue {
|
|
|
16
16
|
text: string;
|
|
17
17
|
type: string;
|
|
18
18
|
}) => JSX.Element | undefined;
|
|
19
|
+
onMentionPreview?: (e: {
|
|
20
|
+
id: string;
|
|
21
|
+
text: string;
|
|
22
|
+
type: string;
|
|
23
|
+
}) => void;
|
|
19
24
|
onTagClick?: (tag: string) => void;
|
|
20
25
|
interactionRenderers?: InteractionRenderers[];
|
|
21
26
|
markdownMap?: MDMap;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Feed.context.d.ts","sourceRoot":"","sources":["../../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C9C,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Feed.context.js","sourceRoot":"","sources":["../../../src/components/Feed/Feed.context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAA4B,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Feed.context.js","sourceRoot":"","sources":["../../../src/components/Feed/Feed.context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAA4B,MAAM,OAAO,CAAC;AAyBhE,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAmB;IACzD,WAAW,EAAE,EAAE;IACf,QAAQ,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;IACxC,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;CACnB,CAAC,CAAC;AAMH,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAAwB,EAAE,CAAC,CAAC","sourcesContent":["import { createContext, Dispatch, SetStateAction } from 'react';\n\nimport { InteractionRenderers, MDMap } from '@pega/cosmos-react-rte';\nimport { MenuItemProps } from '@pega/cosmos-react-core';\n\nexport interface FeedContextValue {\n searchTypes?: string[];\n onSearch?: (e: { type: 'mention' | 'tag'; search: string; mentionType: string }) => void;\n searchResults?: MenuItemProps[];\n showSearchResults?: boolean;\n setShowSearchResults?: Dispatch<SetStateAction<boolean>>;\n onMentionClick?: (e: { id: string; text: string; type: string }) => JSX.Element | undefined;\n onMentionPreview?: (e: { id: string; text: string; type: string }) => void;\n onTagClick?: (tag: string) => void;\n interactionRenderers?: InteractionRenderers[];\n markdownMap?: MDMap;\n userInfo: {\n username: string;\n fullname: string;\n avatarSrc?: string;\n meta?: string[];\n };\n announce: (announcement: string) => void;\n}\n\nexport const FeedContext = createContext<FeedContextValue>({\n searchTypes: [],\n userInfo: { username: '', fullname: '' },\n announce: () => {}\n});\n\nexport interface FeedReplyContextValue {\n onShowReplyInput?: () => void;\n}\n\nexport const FeedReplyContext = createContext<FeedReplyContextValue>({});\n"]}
|
|
@@ -28,8 +28,10 @@ export interface FeedProps extends NoChildrenProp {
|
|
|
28
28
|
onDecoratorSearch?: FeedContextValue['onSearch'];
|
|
29
29
|
/** Results that will be shown in a Popover for a mention or tag search. */
|
|
30
30
|
searchResults?: FeedContextValue['searchResults'];
|
|
31
|
-
/** A callback that is triggered when a mention is clicked. The callback sends back the id, text, and type of the mention. The callback should return a function component. */
|
|
31
|
+
/** A callback that is triggered when a mention button is clicked. The callback sends back the id, text, and type of the mention. The callback should return a function component. */
|
|
32
32
|
onMentionClick?: FeedContextValue['onMentionClick'];
|
|
33
|
+
/** A callback that is triggered when a mention link is previewed. The callback sends back the id, text, and type of the mention. */
|
|
34
|
+
onMentionPreview?: FeedContextValue['onMentionPreview'];
|
|
33
35
|
/** A callback that is triggered when a hashtag is clicked. The callback sends back the test of the tag. */
|
|
34
36
|
onTagClick?: FeedContextValue['onTagClick'];
|
|
35
37
|
/** A list of configuration objects used to render custom components within Feed posts and replies based off of a given regex pattern. */
|
|
@@ -42,6 +44,8 @@ export interface FeedProps extends NoChildrenProp {
|
|
|
42
44
|
onFilterChange?: (filterId: string, on: boolean) => void;
|
|
43
45
|
/** A callback that is triggered when the bottom of the Feed is scrolled into view so that additional posts may be displayed. */
|
|
44
46
|
onLoadMore?: () => void;
|
|
47
|
+
/** Indicates if the posts are being currently loading */
|
|
48
|
+
loadingPosts?: boolean;
|
|
45
49
|
/** A region to hold the new post component */
|
|
46
50
|
newPostRegion?: ReactNode;
|
|
47
51
|
/** A list of FeedPost components */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Feed.d.ts","sourceRoot":"","sources":["../../../src/components/Feed/Feed.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,SAAS,EAAE,EAAE,EAA4C,MAAM,OAAO,CAAC;AAG7F,OAAO,EAIL,YAAY,
|
|
1
|
+
{"version":3,"file":"Feed.d.ts","sourceRoot":"","sources":["../../../src/components/Feed/Feed.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,SAAS,EAAE,EAAE,EAA4C,MAAM,OAAO,CAAC;AAG7F,OAAO,EAIL,YAAY,EASZ,cAAc,EAGf,MAAM,yBAAyB,CAAC;AAKjC,OAAO,EAAe,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAQ/D,MAAM,WAAW,MAAM;IACrB,oFAAoF;IACpF,EAAE,EAAE,MAAM,CAAC;IACX,gFAAgF;IAChF,KAAK,EAAE,SAAS,CAAC;IACjB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,EAAE,CAAC,EAAE,OAAO,CAAC;CACd;AAED,MAAM,WAAW,SAAU,SAAQ,cAAc;IAC/C,0BAA0B;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mDAAmD;IACnD,QAAQ,EAAE,gBAAgB,CAAC,UAAU,CAAC,CAAC;IACvC,yGAAyG;IACzG,WAAW,CAAC,EAAE,gBAAgB,CAAC,aAAa,CAAC,CAAC;IAC9C,oFAAoF;IACpF,iBAAiB,CAAC,EAAE,gBAAgB,CAAC,UAAU,CAAC,CAAC;IACjD,2EAA2E;IAC3E,aAAa,CAAC,EAAE,gBAAgB,CAAC,eAAe,CAAC,CAAC;IAClD,qLAAqL;IACrL,cAAc,CAAC,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;IACpD,oIAAoI;IACpI,gBAAgB,CAAC,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;IACxD,2GAA2G;IAC3G,UAAU,CAAC,EAAE,gBAAgB,CAAC,YAAY,CAAC,CAAC;IAC5C,yIAAyI;IACzI,oBAAoB,CAAC,EAAE,gBAAgB,CAAC,sBAAsB,CAAC,CAAC;IAChE,wFAAwF;IACxF,WAAW,CAAC,EAAE,gBAAgB,CAAC,aAAa,CAAC,CAAC;IAC9C,6CAA6C;IAC7C,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,uDAAuD;IACvD,cAAc,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,KAAK,IAAI,CAAC;IACzD,gIAAgI;IAChI,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,yDAAyD;IACzD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,8CAA8C;IAC9C,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B,oCAAoC;IACpC,KAAK,CAAC,EAAE,SAAS,EAAE,CAAC;CACrB;AAiDD,QAAA,MAAM,IAAI,EAAE,EAAE,CAAC,YAAY,GAAG,SAAS,CAqKtC,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useRef, useEffect, useCallback } from 'react';
|
|
3
3
|
import styled, { css } from 'styled-components';
|
|
4
|
-
import { Button, defaultThemeProp, Flex, Grid, Icon, registerIcon, Popover, Switch, Text, Progress,
|
|
4
|
+
import { Button, defaultThemeProp, Flex, Grid, Icon, registerIcon, Popover, Switch, Text, Progress, usePrevious, useItemIntersection, useUID } from '@pega/cosmos-react-core';
|
|
5
5
|
import { useArrows, useElement, useI18n, useOuterEvent } from '@pega/cosmos-react-core/lib/hooks';
|
|
6
6
|
import * as filterIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/filter.icon';
|
|
7
7
|
import * as filterOnIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/filter-on.icon';
|
|
@@ -40,36 +40,21 @@ const StyledFilterList = styled.ul `
|
|
|
40
40
|
min-width: 10rem;
|
|
41
41
|
`;
|
|
42
42
|
StyledFilterList.defaultProps = defaultThemeProp;
|
|
43
|
-
const StyledLoadMore = styled.div(({ theme
|
|
43
|
+
const StyledLoadMore = styled.div(({ theme }) => {
|
|
44
44
|
return css `
|
|
45
|
-
${
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
`}
|
|
49
|
-
|
|
50
|
-
${StyledProgressRing} {
|
|
51
|
-
min-height: 0;
|
|
52
|
-
min-width: 0;
|
|
53
|
-
|
|
54
|
-
${visible &&
|
|
55
|
-
css `
|
|
56
|
-
min-height: 2rem;
|
|
57
|
-
min-width: 2rem;
|
|
58
|
-
`}
|
|
59
|
-
}
|
|
45
|
+
margin-top: ${theme.base.spacing};
|
|
46
|
+
min-height: 2rem;
|
|
47
|
+
min-width: 2rem;
|
|
60
48
|
`;
|
|
61
49
|
});
|
|
62
50
|
StyledLoadMore.defaultProps = defaultThemeProp;
|
|
63
51
|
const Feed = (props) => {
|
|
64
|
-
const { variant, children, userInfo, className, title, searchTypes, onDecoratorSearch, searchResults = [], onMentionClick, onTagClick, mentionContent, interactionRenderers = [], markdownMap, filters, onFilterChange, onLoadMore, newPostRegion, posts = [], ...restProps } = props;
|
|
52
|
+
const { loadingPosts = false, variant, children, userInfo, className, title, searchTypes, onDecoratorSearch, searchResults = [], onMentionClick, onMentionPreview, onTagClick, mentionContent, interactionRenderers = [], markdownMap, filters, onFilterChange, onLoadMore, newPostRegion, posts = [], ...restProps } = props;
|
|
65
53
|
const t = useI18n();
|
|
66
54
|
const [popoverEl, setPopoverEl] = useElement();
|
|
67
55
|
const [buttonEl, setButtonEl] = useElement();
|
|
68
|
-
const [loadMoreEl, setLoadMoreEl] = useElement();
|
|
69
56
|
const [mountPopover, setMountPopover] = useState(false);
|
|
70
|
-
const [feedOverflows, setFeedOverflows] = useState(false);
|
|
71
57
|
const [showSearchResults, setShowSearchResults] = useState(false);
|
|
72
|
-
const feedOverflowsRef = useRef(false);
|
|
73
58
|
const prevPosts = usePrevious(posts);
|
|
74
59
|
const [announcementText, setAnnouncementText] = useState('');
|
|
75
60
|
const filterRef = useRef(null);
|
|
@@ -87,35 +72,27 @@ const Feed = (props) => {
|
|
|
87
72
|
document.removeEventListener('keydown', onKeydown);
|
|
88
73
|
};
|
|
89
74
|
}, []);
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
setFeedOverflows(true);
|
|
95
|
-
feedOverflowsRef.current = true;
|
|
96
|
-
}
|
|
97
|
-
else if (entries[0].isIntersecting && feedOverflowsRef.current) {
|
|
98
|
-
onLoadMore?.();
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
intersectionObserver.observe(loadMoreEl);
|
|
102
|
-
return () => {
|
|
103
|
-
intersectionObserver.disconnect();
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
}, [loadMoreEl, feedOverflowsRef.current]);
|
|
75
|
+
const id = useUID();
|
|
76
|
+
useItemIntersection({ current: null }, posts.length - 1, () => {
|
|
77
|
+
onLoadMore?.();
|
|
78
|
+
}, `#${id} > div[role='region']`);
|
|
107
79
|
const announce = useCallback((announcement) => {
|
|
108
80
|
setAnnouncementText('');
|
|
109
81
|
setTimeout(() => {
|
|
110
82
|
setAnnouncementText(announcement);
|
|
111
83
|
}, 0);
|
|
112
84
|
}, []);
|
|
85
|
+
useEffect(() => {
|
|
86
|
+
if (loadingPosts)
|
|
87
|
+
announce(t('loading_post'));
|
|
88
|
+
}, [loadingPosts]);
|
|
113
89
|
useEffect(() => {
|
|
114
90
|
if (prevPosts) {
|
|
115
|
-
const difference =
|
|
116
|
-
if (difference
|
|
91
|
+
const difference = posts.length - prevPosts?.length;
|
|
92
|
+
if (difference < 0)
|
|
117
93
|
announce(t('feed_post_removed'));
|
|
118
|
-
|
|
94
|
+
else if (difference > 0)
|
|
95
|
+
announce(t('feed_new_post_added', [difference], { count: difference }));
|
|
119
96
|
}
|
|
120
97
|
}, [posts]);
|
|
121
98
|
return (_jsx(FeedContext.Provider, { value: {
|
|
@@ -128,16 +105,17 @@ const Feed = (props) => {
|
|
|
128
105
|
showSearchResults,
|
|
129
106
|
setShowSearchResults,
|
|
130
107
|
onMentionClick,
|
|
108
|
+
onMentionPreview,
|
|
131
109
|
onTagClick,
|
|
132
110
|
interactionRenderers,
|
|
133
111
|
markdownMap,
|
|
134
112
|
userInfo,
|
|
135
113
|
announce
|
|
136
|
-
}, children: _jsxs(StyledFeed, { ...restProps, children: [_jsx(FeedAnnouncer, { children: announcementText }
|
|
114
|
+
}, children: _jsxs(StyledFeed, { ...restProps, children: [_jsx(FeedAnnouncer, { children: announcementText }), (title || (filters && !!filters.length)) && (_jsxs(Flex, { container: { justify: 'between', alignItems: 'center' }, as: StyledHeading, children: [title ? _jsx(Text, { variant: 'h2', children: title }) : _jsx("div", {}), filters && (_jsx(Button, { as: FeedButton, ref: setButtonEl, variant: 'simple', icon: true, onClick: () => setMountPopover(curr => !curr), label: `${title || ''} ${t('filters')}`, emphasized: true, children: _jsx(Icon, { name: filters?.map(filter => !!filter.on).reduce((acc, curr) => acc || curr)
|
|
137
115
|
? 'filter-on'
|
|
138
|
-
: 'filter' }
|
|
139
|
-
return (_jsx("li", { children: _jsx(Switch, { ...filter, onChange: (event) => onFilterChange?.(event.target.id, event.target.checked) }
|
|
140
|
-
}) }
|
|
116
|
+
: 'filter' }) }))] })), _jsx(Popover, { show: !!filters && mountPopover, ref: setPopoverEl, target: buttonEl, as: StyledFilterMenu, children: _jsxs(Flex, { container: { direction: 'column', gap: 2 }, as: 'fieldset', children: [_jsx(Text, { variant: 'h3', as: 'legend', children: t('filters') }), _jsx(Grid, { container: { gap: 1 }, as: StyledFilterList, ref: filterRef, children: filters?.map(filter => {
|
|
117
|
+
return (_jsx("li", { children: _jsx(Switch, { ...filter, onChange: (event) => onFilterChange?.(event.target.id, event.target.checked) }) }, filter.id));
|
|
118
|
+
}) })] }) }), _jsxs("div", { id: id, children: [newPostRegion, posts] }), loadingPosts && (_jsx(Flex, { container: { justify: 'center' }, as: StyledLoadMore, children: _jsx(Progress, { placement: 'inline' }) }))] }) }));
|
|
141
119
|
};
|
|
142
120
|
export default Feed;
|
|
143
121
|
//# sourceMappingURL=Feed.js.map
|