@pega/cosmos-react-social 2.0.0-dev.9.2 → 2.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/Chat/Chat.d.ts +2 -2
- package/lib/components/Chat/Chat.d.ts.map +1 -1
- package/lib/components/Chat/Chat.js +6 -11
- package/lib/components/Chat/Chat.js.map +1 -1
- package/lib/components/Chat/ChatBody.js +2 -2
- 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 +20 -26
- package/lib/components/Chat/ChatComposer.js.map +1 -1
- package/lib/components/Chat/ChatHeader.d.ts +2 -2
- package/lib/components/Chat/ChatHeader.d.ts.map +1 -1
- package/lib/components/Chat/ChatHeader.js +4 -6
- package/lib/components/Chat/ChatHeader.js.map +1 -1
- package/lib/components/Chat/ChatTranscript.d.ts.map +1 -1
- package/lib/components/Chat/ChatTranscript.js +6 -7
- 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 +22 -30
- package/lib/components/Chat/Message.js.map +1 -1
- package/lib/components/Chat/Message.styles.js +2 -2
- package/lib/components/Chat/Message.styles.js.map +1 -1
- package/lib/components/Chat/MessageList.d.ts.map +1 -1
- package/lib/components/Chat/MessageList.js +11 -12
- package/lib/components/Chat/MessageList.js.map +1 -1
- package/lib/components/Chat/RepeatingView.js +6 -8
- package/lib/components/Chat/RepeatingView.js.map +1 -1
- package/lib/components/Chat/SuggestedReplyPicker.d.ts.map +1 -1
- package/lib/components/Chat/SuggestedReplyPicker.js +16 -16
- package/lib/components/Chat/SuggestedReplyPicker.js.map +1 -1
- package/lib/components/Chat/SystemMessage.js +2 -2
- package/lib/components/Chat/SystemMessage.js.map +1 -1
- package/lib/components/Chat/TranscriptMessage.js +3 -7
- 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/Email.d.ts.map +1 -1
- package/lib/components/Email/Email.js +42 -80
- package/lib/components/Email/Email.js.map +1 -1
- package/lib/components/Email/Email.styles.d.ts +7 -2
- package/lib/components/Email/Email.styles.d.ts.map +1 -1
- package/lib/components/Email/Email.styles.js +75 -26
- package/lib/components/Email/Email.styles.js.map +1 -1
- package/lib/components/Email/Email.types.d.ts +144 -63
- 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 +4 -6
- package/lib/components/Email/EmailComposer.d.ts.map +1 -1
- package/lib/components/Email/EmailComposer.js +174 -62
- package/lib/components/Email/EmailComposer.js.map +1 -1
- package/lib/components/Email/EmailConversation.d.ts +3 -1
- package/lib/components/Email/EmailConversation.d.ts.map +1 -1
- package/lib/components/Email/EmailConversation.js +88 -56
- package/lib/components/Email/EmailConversation.js.map +1 -1
- package/lib/components/Email/EmailEntity.d.ts +3 -7
- package/lib/components/Email/EmailEntity.d.ts.map +1 -1
- package/lib/components/Email/EmailEntity.js +11 -22
- package/lib/components/Email/EmailEntity.js.map +1 -1
- package/lib/components/Email/EmailSelector.d.ts +19 -0
- package/lib/components/Email/EmailSelector.d.ts.map +1 -0
- package/lib/components/Email/EmailSelector.js +103 -0
- package/lib/components/Email/EmailSelector.js.map +1 -0
- package/lib/components/Email/EmailShell.d.ts.map +1 -1
- package/lib/components/Email/EmailShell.js +18 -23
- package/lib/components/Email/EmailShell.js.map +1 -1
- package/lib/components/Email/EmailSummaryItem.d.ts +10 -0
- package/lib/components/Email/EmailSummaryItem.d.ts.map +1 -0
- package/lib/components/Email/EmailSummaryItem.js +93 -0
- package/lib/components/Email/EmailSummaryItem.js.map +1 -0
- package/lib/components/Email/EmailSummaryList.d.ts +6 -0
- package/lib/components/Email/EmailSummaryList.d.ts.map +1 -0
- package/lib/components/Email/EmailSummaryList.js +115 -0
- package/lib/components/Email/EmailSummaryList.js.map +1 -0
- package/lib/components/Email/ViewAnalysis.d.ts +6 -0
- package/lib/components/Email/ViewAnalysis.d.ts.map +1 -0
- package/lib/components/Email/ViewAnalysis.js +20 -0
- package/lib/components/Email/ViewAnalysis.js.map +1 -0
- package/lib/components/Feed/Feed.context.d.ts +12 -2
- package/lib/components/Feed/Feed.context.d.ts.map +1 -1
- package/lib/components/Feed/Feed.context.js +3 -1
- package/lib/components/Feed/Feed.context.js.map +1 -1
- package/lib/components/Feed/Feed.d.ts +12 -5
- package/lib/components/Feed/Feed.d.ts.map +1 -1
- package/lib/components/Feed/Feed.js +38 -17
- package/lib/components/Feed/Feed.js.map +1 -1
- package/lib/components/Feed/FeedAnnouncer.d.ts +7 -0
- package/lib/components/Feed/FeedAnnouncer.d.ts.map +1 -0
- package/lib/components/Feed/FeedAnnouncer.js +11 -0
- package/lib/components/Feed/FeedAnnouncer.js.map +1 -0
- package/lib/components/Feed/FeedAttachments.d.ts +3 -0
- package/lib/components/Feed/FeedAttachments.d.ts.map +1 -1
- package/lib/components/Feed/FeedAttachments.js +79 -14
- package/lib/components/Feed/FeedAttachments.js.map +1 -1
- package/lib/components/Feed/FeedButton.d.ts.map +1 -1
- package/lib/components/Feed/FeedButton.js.map +1 -1
- package/lib/components/Feed/FeedContent.d.ts.map +1 -1
- package/lib/components/Feed/FeedContent.js +10 -2
- package/lib/components/Feed/FeedContent.js.map +1 -1
- package/lib/components/Feed/FeedLikeButton.d.ts +19 -0
- package/lib/components/Feed/FeedLikeButton.d.ts.map +1 -0
- package/lib/components/Feed/FeedLikeButton.js +87 -0
- package/lib/components/Feed/FeedLikeButton.js.map +1 -0
- package/lib/components/Feed/FeedModalList.js +2 -4
- 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 +33 -30
- package/lib/components/Feed/FeedNewPost.js.map +1 -1
- package/lib/components/Feed/FeedNewPostTypeMenu.d.ts +2 -1
- package/lib/components/Feed/FeedNewPostTypeMenu.d.ts.map +1 -1
- package/lib/components/Feed/FeedNewPostTypeMenu.js +27 -50
- package/lib/components/Feed/FeedNewPostTypeMenu.js.map +1 -1
- package/lib/components/Feed/FeedPost.d.ts +3 -100
- package/lib/components/Feed/FeedPost.d.ts.map +1 -1
- package/lib/components/Feed/FeedPost.js +56 -95
- package/lib/components/Feed/FeedPost.js.map +1 -1
- package/lib/components/Feed/FeedPost.types.d.ts +101 -0
- package/lib/components/Feed/FeedPost.types.d.ts.map +1 -0
- package/lib/components/Feed/FeedPost.types.js +2 -0
- package/lib/components/Feed/FeedPost.types.js.map +1 -0
- package/lib/components/Feed/FeedReply.d.ts +3 -67
- package/lib/components/Feed/FeedReply.d.ts.map +1 -1
- package/lib/components/Feed/FeedReply.js +24 -69
- package/lib/components/Feed/FeedReply.js.map +1 -1
- package/lib/components/Feed/FeedReply.types.d.ts +68 -0
- package/lib/components/Feed/FeedReply.types.d.ts.map +1 -0
- package/lib/components/Feed/FeedReply.types.js +2 -0
- package/lib/components/Feed/FeedReply.types.js.map +1 -0
- package/lib/components/Feed/FeedReplyInput.d.ts.map +1 -1
- package/lib/components/Feed/FeedReplyInput.js +24 -27
- package/lib/components/Feed/FeedReplyInput.js.map +1 -1
- package/lib/components/Feed/FeedRichText.d.ts.map +1 -1
- package/lib/components/Feed/FeedRichText.js +80 -19
- package/lib/components/Feed/FeedRichText.js.map +1 -1
- package/lib/components/HashtagButton/HashtagButton.d.ts +5 -3
- package/lib/components/HashtagButton/HashtagButton.d.ts.map +1 -1
- package/lib/components/HashtagButton/HashtagButton.js +22 -16
- package/lib/components/HashtagButton/HashtagButton.js.map +1 -1
- package/lib/components/MentionButton/MentionButton.d.ts +9 -3
- package/lib/components/MentionButton/MentionButton.d.ts.map +1 -1
- package/lib/components/MentionButton/MentionButton.js +33 -16
- package/lib/components/MentionButton/MentionButton.js.map +1 -1
- package/package.json +13 -14
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useEffect, useRef, useContext, useMemo } from 'react';
|
|
3
3
|
import styled, { css } from 'styled-components';
|
|
4
|
-
import { Avatar, Button, Count, Card, CardContent, CardHeader, Flex, Icon, MenuButton, SummaryItem, Text, defaultThemeProp,
|
|
4
|
+
import { Avatar, Button, Count, Card, CardContent, CardHeader, Flex, Icon, registerIcon, MenuButton, SummaryItem, Text, defaultThemeProp, useI18n, Progress, useOuterEvent, MetaList, ModalManagerContext, StyledVisual, useConfiguration, usePrevious } from '@pega/cosmos-react-core';
|
|
5
5
|
import { StyledRichTextEditor } from '@pega/cosmos-react-rte';
|
|
6
6
|
import BareButton from '@pega/cosmos-react-core/lib/components/Button/BareButton';
|
|
7
|
+
import * as arrowMicroDownIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/arrow-micro-down.icon';
|
|
8
|
+
import * as caretLeftIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-left.icon';
|
|
9
|
+
import { formatListToLocaleString } from '@pega/cosmos-react-core/lib/utils/utils';
|
|
7
10
|
import FeedButton from './FeedButton';
|
|
8
11
|
import FeedAttachments from './FeedAttachments';
|
|
9
12
|
import { StyledFeedReplyContainer } from './FeedReply';
|
|
@@ -12,6 +15,8 @@ import FeedReplyInput from './FeedReplyInput';
|
|
|
12
15
|
import { FeedContext, FeedReplyContext } from './Feed.context';
|
|
13
16
|
import FeedRichText from './FeedRichText';
|
|
14
17
|
import FeedModalList from './FeedModalList';
|
|
18
|
+
import { FeedLikeButton } from './FeedLikeButton';
|
|
19
|
+
registerIcon(arrowMicroDownIcon, caretLeftIcon);
|
|
15
20
|
const defaultProps = {
|
|
16
21
|
info: {
|
|
17
22
|
avatarSrc: '',
|
|
@@ -44,14 +49,18 @@ export const StyledPostFooter = styled.div(({ theme }) => css `
|
|
|
44
49
|
StyledPostFooter.defaultProps = defaultThemeProp;
|
|
45
50
|
const FullWidthSummaryItem = styled.div `
|
|
46
51
|
width: 100%;
|
|
52
|
+
|
|
53
|
+
${StyledVisual} {
|
|
54
|
+
align-self: start;
|
|
55
|
+
}
|
|
47
56
|
`;
|
|
48
57
|
const FeedPost = (props) => {
|
|
49
58
|
const { id, info, interactionInfo, maxContentHeight = Infinity, onMouseEnter, onMouseLeave, onCommentClick, onLikeClick, onLikeCountInteraction, onLoadMoreLikes, onRecipientInteraction, onLoadMoreRecipients, onUserClick, onShowMoreClick, newReplyField, menuItems, onEditSubmit, edited = false, replies = [], replyInput, replyInputShown, replyCount, repliesLoading, onShowLessReplies, onShowMoreReplies, ...restProps } = props;
|
|
50
59
|
const { avatarSrc, fullname, username, timeElapsed, content, postType = 'public', recipients = [], recipientsCount = 0, attachments, liked, icon, postContext, userStatus } = info;
|
|
51
|
-
const {
|
|
52
|
-
const loggedInUser = useContext(FeedContext)
|
|
60
|
+
const { commentLabel, interactionsEnabled = true } = interactionInfo;
|
|
61
|
+
const { announce, userInfo: loggedInUser } = useContext(FeedContext);
|
|
53
62
|
const t = useI18n();
|
|
54
|
-
const
|
|
63
|
+
const { locale } = useConfiguration();
|
|
55
64
|
const rteRef = useRef();
|
|
56
65
|
const [editMode, setEditMode] = useState(false);
|
|
57
66
|
const editTextAreaRef = useRef(null);
|
|
@@ -60,21 +69,12 @@ const FeedPost = (props) => {
|
|
|
60
69
|
const [replyInputOpen, setReplyInputOpen] = useState(false);
|
|
61
70
|
const [replyInputRef, setReplyInputRef] = useState(null);
|
|
62
71
|
const { create } = useContext(ModalManagerContext);
|
|
63
|
-
const likesModalRef = useRef();
|
|
64
72
|
const recipientsModalRef = useRef();
|
|
73
|
+
const prevReplies = usePrevious(replies);
|
|
74
|
+
const suppressNextAnnouncement = useRef(false);
|
|
65
75
|
useEffect(() => {
|
|
66
|
-
var _a;
|
|
67
|
-
(_a = likesModalRef.current) === null || _a === void 0 ? void 0 : _a.update({
|
|
68
|
-
count: likeCount,
|
|
69
|
-
heading: likeLabel,
|
|
70
|
-
listItems: likes,
|
|
71
|
-
onLoadMore: onLoadMoreLikes
|
|
72
|
-
});
|
|
73
|
-
}, [likeCount, likeLabel, likes, onLoadMoreLikes]);
|
|
74
|
-
useEffect(() => {
|
|
75
|
-
var _a;
|
|
76
76
|
if (recipients.length) {
|
|
77
|
-
|
|
77
|
+
recipientsModalRef.current?.update({
|
|
78
78
|
count: recipientsCount,
|
|
79
79
|
heading: t('feed_recipients'),
|
|
80
80
|
listItems: recipients,
|
|
@@ -87,27 +87,22 @@ const FeedPost = (props) => {
|
|
|
87
87
|
setEditMode(false);
|
|
88
88
|
});
|
|
89
89
|
useEffect(() => {
|
|
90
|
-
var _a;
|
|
91
90
|
if ((replyInputOpen || replyInputShown) && replyInputRef) {
|
|
92
|
-
|
|
91
|
+
replyInputRef.current?.focus();
|
|
93
92
|
}
|
|
94
93
|
}, [replyInputOpen, replyInputShown, replyInputRef]);
|
|
95
94
|
const userVisual = icon ? (_jsx(Icon, { name: icon }, void 0)) : (_jsx(Avatar, { name: fullname, size: 'l', imageSrc: avatarSrc, status: userStatus }, void 0));
|
|
96
|
-
const numReplies = replyCount ||
|
|
97
|
-
const generateFeedLabel = (list, count, separatorChar = '\n', prefix = '') => {
|
|
98
|
-
return list.length
|
|
99
|
-
? `${prefix}${list
|
|
100
|
-
.slice(0, 10)
|
|
101
|
-
.map(x => x.primary)
|
|
102
|
-
.join(separatorChar)}${count > 10 ? `${separatorChar}${t('feed_and_more_count', count - 10)}` : ''}`
|
|
103
|
-
: '';
|
|
104
|
-
};
|
|
95
|
+
const numReplies = replyCount || replies?.length;
|
|
105
96
|
const postTypeAttributes = useMemo(() => {
|
|
106
97
|
if (postType === 'private') {
|
|
98
|
+
const recipientsList = recipients.map(x => x.primary);
|
|
107
99
|
return {
|
|
108
100
|
icon: 'users-solid',
|
|
109
|
-
ariaLabel: `${t('feed_private_post')} ${
|
|
110
|
-
label:
|
|
101
|
+
ariaLabel: `${t('feed_private_post')} t('feed_recipients')} ${formatListToLocaleString(recipientsList, t, locale, { count: recipientsCount })}`,
|
|
102
|
+
label: formatListToLocaleString(recipientsList, t, locale, {
|
|
103
|
+
count: recipientsCount,
|
|
104
|
+
separator: '\n'
|
|
105
|
+
})
|
|
111
106
|
};
|
|
112
107
|
}
|
|
113
108
|
return {
|
|
@@ -116,32 +111,35 @@ const FeedPost = (props) => {
|
|
|
116
111
|
label: t('feed_public_post')
|
|
117
112
|
};
|
|
118
113
|
}, [postType, recipients, recipientsCount]);
|
|
119
|
-
const likesAttributes = useMemo(() => {
|
|
120
|
-
return {
|
|
121
|
-
ariaLabel: `${t('feed_liked_by')} ${generateFeedLabel(likes, likeCount, ', ')}`,
|
|
122
|
-
label: generateFeedLabel(likes, likeCount)
|
|
123
|
-
};
|
|
124
|
-
}, [likes, likeCount]);
|
|
125
114
|
const handleEdit = () => {
|
|
126
|
-
var _a;
|
|
127
115
|
if (!emptyEditText && postModified) {
|
|
128
|
-
onEditSubmit
|
|
116
|
+
onEditSubmit?.({
|
|
129
117
|
postId: id,
|
|
130
|
-
value:
|
|
118
|
+
value: rteRef.current?.getPlainText() || ''
|
|
131
119
|
});
|
|
132
120
|
setEditMode(false);
|
|
133
121
|
}
|
|
134
122
|
};
|
|
135
|
-
|
|
136
|
-
|
|
123
|
+
useEffect(() => {
|
|
124
|
+
if (prevReplies) {
|
|
125
|
+
const difference = prevReplies.length - replies.length;
|
|
126
|
+
if (difference > 0 && !suppressNextAnnouncement.current) {
|
|
127
|
+
announce(t('feed_reply_removed'));
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
suppressNextAnnouncement.current = false;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}, [replies]);
|
|
134
|
+
return (_jsx(FeedReplyContext.Provider, { value: { onShowReplyInput: () => setReplyInputOpen(true) }, children: _jsxs(Card, { ...restProps, as: StyledFeedPost, onMouseEnter: () => {
|
|
135
|
+
onMouseEnter?.({ postId: id });
|
|
137
136
|
}, onMouseLeave: () => {
|
|
138
|
-
onMouseLeave
|
|
139
|
-
}
|
|
140
|
-
onUserClick
|
|
141
|
-
}
|
|
142
|
-
onUserClick
|
|
143
|
-
}
|
|
144
|
-
postContext && _jsx(Text, Object.assign({ variant: 'primary' }, { children: t('feed_context', postContext) }), void 0)] }), void 0), secondary: _jsxs(Flex, Object.assign({ container: { gap: 1, alignItems: 'center' } }, { children: [_jsx(Button, Object.assign({ variant: 'text', icon: true, onClick: recipients.length
|
|
137
|
+
onMouseLeave?.({ postId: id });
|
|
138
|
+
}, children: [_jsx(CardHeader, { children: _jsx(SummaryItem, { as: FullWidthSummaryItem, visual: onUserClick ? (_jsx(BareButton, { onClick: (event) => {
|
|
139
|
+
onUserClick?.({ postId: id, username }, event);
|
|
140
|
+
}, children: userVisual }, void 0)) : (userVisual), primary: _jsxs("div", { children: [onUserClick ? (_jsx(Button, { variant: 'text', onClick: (event) => {
|
|
141
|
+
onUserClick?.({ postId: id, username }, event);
|
|
142
|
+
}, children: _jsx(Text, { variant: 'h3', children: fullname }, void 0) }, void 0)) : (_jsx(Text, { variant: 'h3', children: fullname }, void 0)), postContext && _jsxs(Text, { variant: 'primary', children: [" ", t('feed_context', [postContext])] }, void 0)] }, void 0), secondary: _jsxs(Flex, { container: { gap: 1, alignItems: 'center' }, children: [_jsx(Button, { variant: 'text', icon: true, onClick: recipients.length
|
|
145
143
|
? () => {
|
|
146
144
|
if (recipientsCount > 10) {
|
|
147
145
|
recipientsModalRef.current = create(FeedModalList, {
|
|
@@ -152,8 +150,7 @@ const FeedPost = (props) => {
|
|
|
152
150
|
});
|
|
153
151
|
}
|
|
154
152
|
}
|
|
155
|
-
: onRecipientInteraction, onFocus: onRecipientInteraction, onMouseOver: onRecipientInteraction, "aria-label": postTypeAttributes.ariaLabel, label: postTypeAttributes.label
|
|
156
|
-
_jsx(MetaList, { items: edited ? [timeElapsed, t('edited')] : [timeElapsed] }, void 0)] }), void 0), actions: menuItems ? (_jsx(MenuButton, { text: 'More', menu: {
|
|
153
|
+
: onRecipientInteraction, onFocus: onRecipientInteraction, onMouseOver: onRecipientInteraction, "aria-label": postTypeAttributes.ariaLabel, label: postTypeAttributes.label, children: _jsx(Icon, { name: postTypeAttributes.icon }, void 0) }, void 0), _jsx(MetaList, { items: edited ? [timeElapsed, t('edited')] : [timeElapsed] }, void 0)] }, void 0), actions: menuItems ? (_jsx(MenuButton, { text: 'More', menu: {
|
|
157
154
|
items: onEditSubmit &&
|
|
158
155
|
typeof content === 'string' &&
|
|
159
156
|
username === loggedInUser.username
|
|
@@ -165,59 +162,23 @@ const FeedPost = (props) => {
|
|
|
165
162
|
}
|
|
166
163
|
])
|
|
167
164
|
: menuItems
|
|
168
|
-
}, icon: 'more', iconOnly: true, variant: 'simple' }, void 0)) : undefined }, void 0) }, void 0),
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
}, autoFocus: true, onSubmit: handleEdit, defaultValue: content, ref: rteRef }, void 0) }), void 0),
|
|
174
|
-
_jsxs(Flex, Object.assign({ container: { justify: 'between', pad: [2, 0, 0] } }, { children: [_jsx(Button, Object.assign({ onClick: () => setEditMode(false), "aria-label": `${t('cancel')} ${t('edit')} ${id}` }, { children: t('cancel') }), void 0),
|
|
175
|
-
_jsx(Button, Object.assign({ variant: 'primary', disabled: emptyEditText || !postModified, onClick: handleEdit, "aria-label": `${t('update')} ${t('edit')} ${id}` }, { children: t('update') }), void 0)] }), void 0)] }, void 0)) : (_jsx(FeedContent, Object.assign({ maxContentHeight: maxContentHeight }, { children: content }), void 0)),
|
|
176
|
-
_jsx(FeedAttachments, { attachments: attachments }, void 0),
|
|
177
|
-
_jsxs(Flex, Object.assign({ as: StyledPostFooter, container: { justify: 'between' } }, { children: [interactionsEnabled ? (_jsxs(Flex, Object.assign({ container: { gap: 2 } }, { children: [_jsxs(Button, Object.assign({ variant: 'text', as: FeedButton, onClick: () => {
|
|
178
|
-
onCommentClick === null || onCommentClick === void 0 ? void 0 : onCommentClick({ postId: id });
|
|
165
|
+
}, icon: 'more', iconOnly: true, variant: 'simple' }, void 0)) : undefined }, void 0) }, void 0), _jsxs(CardContent, { children: [editMode ? (_jsxs(_Fragment, { children: [_jsx(StyledPostEdit, { ref: editTextAreaRef, children: _jsx(FeedRichText, { onChange: () => {
|
|
166
|
+
setEmptyEditText(rteRef.current?.getPlainText().trim() === '');
|
|
167
|
+
setPostModified(rteRef.current?.getPlainText() !== content);
|
|
168
|
+
}, autoFocus: true, label: t('feed_edit_post'), labelHidden: true, onSubmit: handleEdit, defaultValue: content, ref: rteRef }, void 0) }, void 0), _jsxs(Flex, { container: { justify: 'between', pad: [2, 0, 0] }, children: [_jsx(Button, { onClick: () => setEditMode(false), "aria-label": `${t('cancel')} ${t('edit')} ${id}`, children: t('cancel') }, void 0), _jsx(Button, { variant: 'primary', disabled: emptyEditText || !postModified, onClick: handleEdit, "aria-label": `${t('update')} ${t('edit')} ${id}`, children: t('update') }, void 0)] }, void 0)] }, void 0)) : (_jsx(FeedContent, { maxContentHeight: maxContentHeight, children: content }, void 0)), _jsx(FeedAttachments, { attachments: attachments, readOnly: true }, void 0), _jsxs(Flex, { as: StyledPostFooter, container: { justify: 'between', wrap: 'wrap', gap: 1 }, children: [interactionsEnabled ? (_jsxs(Flex, { container: { gap: 2 }, children: [_jsxs(Button, { variant: 'text', as: FeedButton, onClick: () => {
|
|
169
|
+
onCommentClick?.({ postId: id });
|
|
179
170
|
if (!replyInputOpen) {
|
|
180
171
|
setReplyInputOpen(true);
|
|
181
172
|
}
|
|
182
|
-
} }, { children: [_jsx(
|
|
183
|
-
_jsx(Text, { children: commentLabel }, void 0),
|
|
184
|
-
numReplies > 0 && _jsx(Count, { children: numReplies }, void 0)] }), void 0),
|
|
185
|
-
_jsxs(Flex, Object.assign({ container: { gap: 0.5 } }, { children: [_jsxs(Button, Object.assign({ variant: 'text', as: FeedButton, onClick: () => onLikeClick({
|
|
186
|
-
postId: id,
|
|
187
|
-
user: {
|
|
188
|
-
id: loggedInUser.username,
|
|
189
|
-
primary: loggedInUser.fullname,
|
|
190
|
-
secondary: loggedInUser.meta ? (_jsx(MetaList, { items: loggedInUser.meta }, void 0)) : undefined,
|
|
191
|
-
visual: (_jsx(Avatar, { size: 'l', imageSrc: loggedInUser.avatarSrc, name: loggedInUser.fullname }, void 0))
|
|
192
|
-
}
|
|
193
|
-
}), emphasized: liked }, { children: [_jsx(Icon, { name: liked ? 'thumbs-up-solid' : 'thumbs-up' }, void 0),
|
|
194
|
-
_jsx(Text, { children: likeLabel }, void 0)] }), void 0),
|
|
195
|
-
likeCount > 0 && (_jsxs(_Fragment, { children: [_jsx(Count, Object.assign({ as: BareButton, ref: setCountEl, onClick: likes.length
|
|
196
|
-
? () => {
|
|
197
|
-
if (likeCount > 10) {
|
|
198
|
-
likesModalRef.current = create(FeedModalList, {
|
|
199
|
-
count: likeCount,
|
|
200
|
-
heading: t('feed_likes'),
|
|
201
|
-
listItems: likes,
|
|
202
|
-
onLoadMore: onLoadMoreLikes
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
: onLikeCountInteraction, onFocus: onLikeCountInteraction, onMouseOver: onLikeCountInteraction, "aria-label": likesAttributes.ariaLabel }, { children: likeCount }), void 0),
|
|
207
|
-
_jsx(Tooltip, Object.assign({ target: countEl, showDelay: 'none', hideDelay: 'none' }, { children: likesAttributes.label }), void 0)] }, void 0))] }), void 0)] }), void 0)) : (_jsx("div", {}, void 0)),
|
|
208
|
-
(onShowLessReplies || onShowMoreReplies) && (_jsxs(Flex, Object.assign({ container: { gap: 0.5 } }, { children: [replies.length !== numReplies && (_jsxs(_Fragment, { children: [_jsx(Text, { children: t('showing_num_of_num', replies.length, numReplies) }, void 0),
|
|
209
|
-
_jsx("span", { children: "\u2022" }, void 0)] }, void 0)),
|
|
210
|
-
onShowMoreReplies && replies.length < numReplies && (_jsx(Button, Object.assign({ variant: 'link', onClick: () => onShowMoreReplies({ postId: id }) }, { children: t('show_more') }), void 0)),
|
|
211
|
-
repliesLoading && _jsx(Progress, { placement: 'inline' }, void 0)] }), void 0))] }), void 0)] }, void 0),
|
|
212
|
-
!!(replies === null || replies === void 0 ? void 0 : replies.length) && _jsx(StyledReplies, { children: replies }, void 0),
|
|
213
|
-
replyInputShown || replyInputOpen ? (_jsx(CardContent, { children: _jsx(FeedReplyInput, { onSetInputRef: ({ ref }) => {
|
|
173
|
+
}, children: [_jsx(Icon, { name: 'chat' }, void 0), _jsx(Text, { children: commentLabel }, void 0), numReplies > 0 && _jsx(Count, { children: numReplies }, void 0)] }, void 0), _jsx(FeedLikeButton, { id: id, variant: 'post', onLikeClick: onLikeClick, onLikeCountInteraction: onLikeCountInteraction, onLoadMoreLikes: onLoadMoreLikes, liked: liked, showText: true, ...interactionInfo }, void 0)] }, void 0)) : (_jsx("div", {}, void 0)), (onShowLessReplies || onShowMoreReplies) && (_jsxs(Flex, { container: { gap: 0.5 }, children: [replies.length !== numReplies && (_jsxs(_Fragment, { children: [_jsx(Text, { children: t('showing_num_of_num', [replies.length, numReplies]) }, void 0), _jsx("span", { children: "\u2022" }, void 0)] }, void 0)), onShowMoreReplies && replies.length < numReplies && (_jsx(Button, { variant: 'link', onClick: () => onShowMoreReplies({ postId: id }), children: t('show_more') }, void 0)), repliesLoading && _jsx(Progress, { placement: 'inline' }, void 0)] }, void 0))] }, void 0)] }, void 0), !!replies?.length && _jsx(StyledReplies, { children: replies }, void 0), replyInputShown || replyInputOpen ? (_jsx(CardContent, { children: _jsx(FeedReplyInput, { onSetInputRef: ({ ref }) => {
|
|
214
174
|
setReplyInputRef(ref);
|
|
215
175
|
}, id: id, commentLabel: replyInput.commentLabel, attachments: replyInput.attachments, placeholder: replyInput.placeholder, onFilesAdded: replyInput.onFilesAdded, onSubmit: e => {
|
|
216
176
|
setReplyInputOpen(false);
|
|
217
177
|
replyInput.onSubmit(e);
|
|
218
|
-
} }, void 0) }, void 0)) : null,
|
|
219
|
-
|
|
220
|
-
|
|
178
|
+
} }, void 0) }, void 0)) : null, onShowLessReplies && !!replies.length && (_jsxs(Flex, { container: { justify: 'center', pad: [0, 0, 1], gap: 1 }, children: [_jsx(Button, { variant: 'link', onClick: () => {
|
|
179
|
+
onShowLessReplies({ postId: id });
|
|
180
|
+
suppressNextAnnouncement.current = true;
|
|
181
|
+
}, children: t('show_less') }, void 0), repliesLoading && _jsx(Progress, { placement: 'inline' }, void 0)] }, void 0))] }, void 0) }, void 0));
|
|
221
182
|
};
|
|
222
183
|
FeedPost.defaultProps = defaultProps;
|
|
223
184
|
export default FeedPost;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeedPost.js","sourceRoot":"","sources":["../../../src/components/Feed/FeedPost.tsx"],"names":[],"mappings":";AAAA,OAAO,EAGL,QAAQ,EACR,SAAS,EAGT,MAAM,EACN,UAAU,EACV,OAAO,EACR,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,MAAM,EAEN,MAAM,EACN,KAAK,EACL,IAAI,EACJ,WAAW,EACX,UAAU,EACV,IAAI,EACJ,IAAI,EACJ,UAAU,EACV,WAAW,EACX,IAAI,EACJ,gBAAgB,EAEhB,UAAU,EACV,OAAO,EACP,QAAQ,EACR,aAAa,EAEb,QAAQ,EACR,OAAO,EACP,mBAAmB,EAGpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAuB,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACnF,OAAO,UAAU,MAAM,0DAA0D,CAAC;AAElF,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,eAAkC,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,WAAiC,MAAM,eAAe,CAAC;AAC9D,OAAO,cAAuC,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,g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AE,GAAG,EAAE,CAAC,EAAE,iBAC5D,KAAC,MAAM,kBAAC,OAAO,EAAC,MAAM,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,gBACpE,CAAC,CAAC,WAAW,CAAC,YACR;wBACR,cAAc,IAAI,KAAC,QAAQ,IAAC,SAAS,EAAC,QAAQ,WAAG,aAC7C,CACR,aACI,YACmB,CAC7B,CAAC;AACJ,CAAC,CAAC;AAEF,QAAQ,CAAC,YAAY,GAAG,YAAY,CAAC;AAErC,eAAe,QAAQ,CAAC","sourcesContent":["import {\n FC,\n ReactElement,\n useState,\n useEffect,\n MutableRefObject,\n MouseEvent,\n useRef,\n useContext,\n useMemo\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Avatar,\n AvatarProps,\n Button,\n Count,\n Card,\n CardContent,\n CardHeader,\n Flex,\n Icon,\n MenuButton,\n SummaryItem,\n Text,\n defaultThemeProp,\n ForwardProps,\n useElement,\n useI18n,\n Progress,\n useOuterEvent,\n MenuItemProps,\n MetaList,\n Tooltip,\n ModalManagerContext,\n SummaryListItem,\n ModalMethods\n} from '@pega/cosmos-react-core';\nimport { RichTextEditorState, StyledRichTextEditor } from '@pega/cosmos-react-rte';\nimport BareButton from '@pega/cosmos-react-core/lib/components/Button/BareButton';\n\nimport FeedButton from './FeedButton';\nimport FeedAttachments, { AttachedFiles } from './FeedAttachments';\nimport { StyledFeedReplyContainer } from './FeedReply';\nimport FeedContent, { FeedContentProps } from './FeedContent';\nimport FeedReplyInput, { FeedReplyInputProps } from './FeedReplyInput';\nimport { FeedContext, FeedReplyContext } from './Feed.context';\nimport FeedRichText from './FeedRichText';\nimport FeedModalList, { FeedModalListProps } from './FeedModalList';\n\nexport interface FeedPostProps {\n /** Unique ID for this activity */\n id: string;\n /** All of the information used to fill text portions, and avatar info */\n info: {\n avatarSrc?: string;\n fullname: string;\n username: string;\n timeElapsed: string;\n content: ReactElement | string;\n postType?: 'public' | 'private';\n recipients?: MenuItemProps[];\n recipientsCount?: number;\n attachments?: AttachedFiles[];\n liked?: boolean;\n icon?: string;\n postContext?: ReactElement | string;\n userStatus?: AvatarProps['status'];\n };\n maxContentHeight?: FeedContentProps['maxContentHeight'];\n /** Button labels for accessibility purposes. */\n interactionInfo: {\n likeLabel: string;\n likes?: SummaryListItem[];\n likeCount?: number;\n commentLabel: string;\n /**\n * @default true\n */\n interactionsEnabled?: boolean;\n };\n /** Callback that runs when the mouse pointer hovers over the Activity. */\n onMouseEnter?: (event: { postId: string }) => void;\n /** Callback that runs when the mouse pointer leaves the Activity. */\n onMouseLeave?: (event: { postId: string }) => void;\n /** Callback that runs when the comment button has been clicked */\n onCommentClick?: (event: { postId: string }) => void;\n /** Callback that runs when the like button has been clicked */\n onLikeClick: (event: { postId: string; user: SummaryListItem }) => void;\n /** Callback that runs when the like count on a post is hovered, focused, or clicked. */\n onLikeCountInteraction?: () => void;\n /** Callback that runs when the bottom of the extended like list Modal is reached, allowing for more likes to be loaded. */\n onLoadMoreLikes?: () => void;\n /** Callback that runs when the private recipient icon on a post is hovered, focused, or clicked. */\n onRecipientInteraction?: () => void;\n /** Callback that runs when the bottom of the extended private recipient list Modal is reached, allowing for more recipients to be loaded. */\n onLoadMoreRecipients?: () => void;\n /** Callback that runs when the user name or visual button has been clicked */\n onUserClick?: (event: { postId: string; username: string }, clickEvent?: MouseEvent) => void;\n /** MenuItems that will populate the three dot menu button */\n menuItems?: MenuItemProps[];\n /** Callback that updates the post after being edited. If undefined, the post will not be editable. */\n onEditSubmit?: (event: { postId: string; value: string }) => void;\n /**\n * Flag that indicates if a post has been previously edited.\n * @default false\n */\n edited?: boolean;\n /** Props that will be passed into the reply input, see FeedReplyInput for more information */\n replyInput: Pick<FeedReplyInputProps, 'onSubmit' | 'placeholder' | 'onFilesAdded'> & {\n commentLabel: FeedReplyInputProps['commentLabel'];\n attachments: FeedReplyInputProps['attachments'];\n };\n /** The default visibility for the reply input */\n replyInputShown?: boolean;\n /** An array to hold FeedReply's inside of this Activity */\n replies?: ReactElement[];\n /** A total count of all replies. */\n replyCount?: number;\n /** Callback that runs when the user clicks Show more button. */\n onShowMoreReplies?: (event: { postId: string }) => void;\n /** Callback that runs when the user clicks Show less button. */\n onShowLessReplies?: (event: { postId: string }) => void;\n /** A loading indicator for the replies. */\n repliesLoading?: boolean;\n}\n\nconst defaultProps: Partial<FeedPostProps> = {\n info: {\n avatarSrc: '',\n fullname: '',\n username: '',\n timeElapsed: '',\n content: ''\n }\n};\n\nexport const StyledFeedPost = styled.div(\n ({ theme }) => css`\n ${StyledFeedReplyContainer}:not(:last-child) {\n margin-block-end: calc(2 * ${theme.base.spacing});\n }\n `\n);\n\nStyledFeedPost.defaultProps = defaultThemeProp;\n\nexport const StyledPostEdit = styled.div(\n ({ theme }) => css`\n ${StyledRichTextEditor} {\n padding: calc(0.5 * ${theme.base.spacing});\n }\n `\n);\n\nStyledPostEdit.defaultProps = defaultThemeProp;\n\nexport const StyledReplies = styled.div(\n ({ theme }) => css`\n border-top: 0.0625rem solid ${theme.base.palette['border-line']};\n padding: calc(1.25 * ${theme.base.spacing}) calc(2 * ${theme.base.spacing});\n `\n);\n\nStyledReplies.defaultProps = defaultThemeProp;\n\nexport const StyledPostFooter = styled.div(\n ({ theme }) => css`\n margin-block-start: ${theme.base.spacing};\n `\n);\n\nStyledPostFooter.defaultProps = defaultThemeProp;\n\nconst FullWidthSummaryItem = styled.div`\n width: 100%;\n`;\n\nconst FeedPost: FC<ForwardProps & FeedPostProps> = (props: ForwardProps & FeedPostProps) => {\n const {\n id,\n info,\n interactionInfo,\n maxContentHeight = Infinity,\n onMouseEnter,\n onMouseLeave,\n onCommentClick,\n onLikeClick,\n onLikeCountInteraction,\n onLoadMoreLikes,\n onRecipientInteraction,\n onLoadMoreRecipients,\n onUserClick,\n onShowMoreClick,\n newReplyField,\n menuItems,\n onEditSubmit,\n edited = false,\n replies = [],\n replyInput,\n replyInputShown,\n replyCount,\n repliesLoading,\n onShowLessReplies,\n onShowMoreReplies,\n ...restProps\n } = props;\n const {\n avatarSrc,\n fullname,\n username,\n timeElapsed,\n content,\n postType = 'public',\n recipients = [],\n recipientsCount = 0,\n attachments,\n liked,\n icon,\n postContext,\n userStatus\n } = info;\n const {\n likeLabel,\n likes = [],\n likeCount = 0,\n commentLabel,\n interactionsEnabled = true\n } = interactionInfo;\n const loggedInUser = useContext(FeedContext).userInfo;\n\n const t = useI18n();\n const [countEl, setCountEl] = useElement<HTMLButtonElement>();\n const rteRef = useRef<RichTextEditorState>();\n const [editMode, setEditMode] = useState(false);\n const editTextAreaRef = useRef<HTMLDivElement>(null);\n const [emptyEditText, setEmptyEditText] = useState(false);\n const [postModified, setPostModified] = useState(false);\n const [replyInputOpen, setReplyInputOpen] = useState(false);\n const [replyInputRef, setReplyInputRef] = useState<MutableRefObject<\n RichTextEditorState | undefined\n > | null>(null);\n const { create } = useContext(ModalManagerContext);\n const likesModalRef = useRef<ModalMethods<FeedModalListProps>>();\n const recipientsModalRef = useRef<ModalMethods<FeedModalListProps>>();\n\n useEffect(() => {\n likesModalRef.current?.update({\n count: likeCount,\n heading: likeLabel,\n listItems: likes,\n onLoadMore: onLoadMoreLikes\n });\n }, [likeCount, likeLabel, likes, onLoadMoreLikes]);\n\n useEffect(() => {\n if (recipients.length) {\n recipientsModalRef.current?.update({\n count: recipientsCount,\n heading: t('feed_recipients'),\n listItems: recipients as SummaryListItem[],\n onLoadMore: onLoadMoreRecipients\n });\n }\n }, [recipientsCount, recipients, onLoadMoreRecipients]);\n\n useOuterEvent('mousedown', [editTextAreaRef], () => {\n if (emptyEditText) setEditMode(false);\n });\n\n useEffect(() => {\n if ((replyInputOpen || replyInputShown) && replyInputRef) {\n replyInputRef.current?.focus();\n }\n }, [replyInputOpen, replyInputShown, replyInputRef]);\n\n const userVisual = icon ? (\n <Icon name={icon} />\n ) : (\n <Avatar name={fullname} size='l' imageSrc={avatarSrc} status={userStatus} />\n );\n\n const numReplies = replyCount || replies?.length;\n\n const generateFeedLabel = (\n list: SummaryListItem[],\n count: number,\n separatorChar = '\\n',\n prefix = ''\n ) => {\n return list.length\n ? `${prefix}${list\n .slice(0, 10)\n .map(x => x.primary)\n .join(separatorChar)}${\n count > 10 ? `${separatorChar}${t('feed_and_more_count', count - 10)}` : ''\n }`\n : '';\n };\n\n const postTypeAttributes = useMemo(() => {\n if (postType === 'private') {\n return {\n icon: 'users-solid',\n ariaLabel: `${t('feed_private_post')} ${generateFeedLabel(\n recipients as SummaryListItem[],\n recipientsCount,\n ', ',\n `${t('feed_recipients')} `\n )}`,\n label: generateFeedLabel(recipients as SummaryListItem[], recipientsCount)\n };\n }\n\n return {\n icon: 'globe',\n ariaLabel: t('feed_public_post'),\n label: t('feed_public_post')\n };\n }, [postType, recipients, recipientsCount]);\n\n const likesAttributes = useMemo(() => {\n return {\n ariaLabel: `${t('feed_liked_by')} ${generateFeedLabel(likes, likeCount, ', ')}`,\n label: generateFeedLabel(likes, likeCount)\n };\n }, [likes, likeCount]);\n\n const handleEdit = () => {\n if (!emptyEditText && postModified) {\n onEditSubmit?.({\n postId: id,\n value: rteRef.current?.getPlainText() || ''\n });\n setEditMode(false);\n }\n };\n\n return (\n <FeedReplyContext.Provider value={{ onShowReplyInput: () => setReplyInputOpen(true) }}>\n <Card\n {...restProps}\n as={StyledFeedPost}\n onMouseEnter={() => {\n onMouseEnter?.({ postId: id });\n }}\n onMouseLeave={() => {\n onMouseLeave?.({ postId: id });\n }}\n >\n <CardHeader>\n <SummaryItem\n as={FullWidthSummaryItem}\n visual={\n onUserClick ? (\n <BareButton\n onClick={(event: MouseEvent) => {\n onUserClick?.({ postId: id, username }, event);\n }}\n >\n {userVisual}\n </BareButton>\n ) : (\n userVisual\n )\n }\n primary={\n <Flex container={{ gap: 0.5, alignItems: 'center' }}>\n {onUserClick ? (\n <Button\n variant='text'\n onClick={(event: MouseEvent) => {\n onUserClick?.({ postId: id, username }, event);\n }}\n >\n <Text variant='h3'>{fullname}</Text>\n </Button>\n ) : (\n <Text variant='h3'>{fullname}</Text>\n )}\n {postContext && <Text variant='primary'>{t('feed_context', postContext)}</Text>}\n </Flex>\n }\n secondary={\n <Flex container={{ gap: 1, alignItems: 'center' }}>\n <Button\n variant='text'\n icon\n onClick={\n recipients.length\n ? () => {\n if (recipientsCount > 10) {\n recipientsModalRef.current = create(FeedModalList, {\n count: recipientsCount,\n heading: t('feed_recipients'),\n listItems: recipients as SummaryListItem[],\n onLoadMore: onLoadMoreRecipients\n });\n }\n }\n : onRecipientInteraction\n }\n onFocus={onRecipientInteraction}\n onMouseOver={onRecipientInteraction}\n aria-label={postTypeAttributes.ariaLabel}\n label={postTypeAttributes.label}\n >\n <Icon name={postTypeAttributes.icon} />\n </Button>\n <MetaList items={edited ? [timeElapsed, t('edited')] : [timeElapsed]} />\n </Flex>\n }\n actions={\n menuItems ? (\n <MenuButton\n text='More'\n menu={{\n items:\n onEditSubmit &&\n typeof content === 'string' &&\n username === loggedInUser.username\n ? menuItems.concat([\n {\n primary: t('edit'),\n id: 'edit',\n onClick: () => setEditMode(true)\n }\n ])\n : menuItems\n }}\n icon='more'\n iconOnly\n variant='simple'\n />\n ) : undefined\n }\n />\n </CardHeader>\n <CardContent>\n {editMode ? (\n <>\n <StyledPostEdit ref={editTextAreaRef}>\n <FeedRichText\n onChange={() => {\n setEmptyEditText(rteRef.current?.getPlainText().trim() === '');\n setPostModified(rteRef.current?.getPlainText() !== content);\n }}\n autoFocus\n onSubmit={handleEdit}\n defaultValue={content}\n ref={rteRef}\n />\n </StyledPostEdit>\n <Flex container={{ justify: 'between', pad: [2, 0, 0] }}>\n <Button\n onClick={() => setEditMode(false)}\n aria-label={`${t('cancel')} ${t('edit')} ${id}`}\n >\n {t('cancel')}\n </Button>\n <Button\n variant='primary'\n disabled={emptyEditText || !postModified}\n onClick={handleEdit}\n aria-label={`${t('update')} ${t('edit')} ${id}`}\n >\n {t('update')}\n </Button>\n </Flex>\n </>\n ) : (\n <FeedContent maxContentHeight={maxContentHeight}>{content}</FeedContent>\n )}\n <FeedAttachments attachments={attachments} />\n <Flex as={StyledPostFooter} container={{ justify: 'between' }}>\n {interactionsEnabled ? (\n <Flex container={{ gap: 2 }}>\n <Button\n variant='text'\n as={FeedButton}\n onClick={() => {\n onCommentClick?.({ postId: id });\n if (!replyInputOpen) {\n setReplyInputOpen(true);\n }\n }}\n >\n <Icon name='chat' />\n <Text>{commentLabel}</Text>\n {numReplies > 0 && <Count>{numReplies}</Count>}\n </Button>\n <Flex container={{ gap: 0.5 }}>\n <Button\n variant='text'\n as={FeedButton}\n onClick={() =>\n onLikeClick({\n postId: id,\n user: {\n id: loggedInUser.username,\n primary: loggedInUser.fullname,\n secondary: loggedInUser.meta ? (\n <MetaList items={loggedInUser.meta} />\n ) : undefined,\n visual: (\n <Avatar\n size='l'\n imageSrc={loggedInUser.avatarSrc}\n name={loggedInUser.fullname}\n />\n )\n }\n })\n }\n emphasized={liked}\n >\n <Icon name={liked ? 'thumbs-up-solid' : 'thumbs-up'} />\n <Text>{likeLabel}</Text>\n </Button>\n {likeCount > 0 && (\n <>\n <Count\n as={BareButton}\n ref={setCountEl}\n onClick={\n likes.length\n ? () => {\n if (likeCount > 10) {\n likesModalRef.current = create(FeedModalList, {\n count: likeCount,\n heading: t('feed_likes'),\n listItems: likes,\n onLoadMore: onLoadMoreLikes\n });\n }\n }\n : onLikeCountInteraction\n }\n onFocus={onLikeCountInteraction}\n onMouseOver={onLikeCountInteraction}\n aria-label={likesAttributes.ariaLabel}\n >\n {likeCount}\n </Count>\n <Tooltip target={countEl} showDelay='none' hideDelay='none'>\n {likesAttributes.label}\n </Tooltip>\n </>\n )}\n </Flex>\n </Flex>\n ) : (\n <div />\n )}\n {(onShowLessReplies || onShowMoreReplies) && (\n <Flex container={{ gap: 0.5 }}>\n {replies.length !== numReplies && (\n <>\n <Text>{t('showing_num_of_num', replies.length, numReplies)}</Text>\n <span>•</span>\n </>\n )}\n {onShowMoreReplies && replies.length < numReplies && (\n <Button variant='link' onClick={() => onShowMoreReplies({ postId: id })}>\n {t('show_more')}\n </Button>\n )}\n {repliesLoading && <Progress placement='inline' />}\n </Flex>\n )}\n </Flex>\n </CardContent>\n {!!replies?.length && <StyledReplies>{replies}</StyledReplies>}\n {replyInputShown || replyInputOpen ? (\n <CardContent>\n <FeedReplyInput\n onSetInputRef={({ ref }) => {\n setReplyInputRef(ref);\n }}\n id={id}\n commentLabel={replyInput.commentLabel}\n attachments={replyInput.attachments}\n placeholder={replyInput.placeholder}\n onFilesAdded={replyInput.onFilesAdded}\n onSubmit={e => {\n setReplyInputOpen(false);\n replyInput.onSubmit(e);\n }}\n />\n </CardContent>\n ) : null}\n {onShowLessReplies && !!replies.length && (\n <Flex container={{ justify: 'center', pad: [0, 0, 1], gap: 1 }}>\n <Button variant='link' onClick={() => onShowLessReplies({ postId: id })}>\n {t('show_less')}\n </Button>\n {repliesLoading && <Progress placement='inline' />}\n </Flex>\n )}\n </Card>\n </FeedReplyContext.Provider>\n );\n};\n\nFeedPost.defaultProps = defaultProps;\n\nexport default FeedPost;\n"]}
|
|
1
|
+
{"version":3,"file":"FeedPost.js","sourceRoot":"","sources":["../../../src/components/Feed/FeedPost.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,QAAQ,EACR,SAAS,EAGT,MAAM,EACN,UAAU,EACV,OAAO,EACR,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,MAAM,EACN,MAAM,EACN,KAAK,EACL,IAAI,EACJ,WAAW,EACX,UAAU,EACV,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,UAAU,EACV,WAAW,EACX,IAAI,EACJ,gBAAgB,EAEhB,OAAO,EACP,QAAQ,EACR,aAAa,EACb,QAAQ,EACR,mBAAmB,EAGnB,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACZ,MAAM,yBAAyB,CAAC;AACjC,OAA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R,cAAc,IAAI,KAAC,QAAQ,IAAC,SAAS,EAAC,QAAQ,WAAG,YAC7C,CACR,YACI,WACmB,CAC7B,CAAC;AACJ,CAAC,CAAC;AAEF,QAAQ,CAAC,YAAY,GAAG,YAAY,CAAC;AAErC,eAAe,QAAQ,CAAC","sourcesContent":["import {\n FC,\n useState,\n useEffect,\n MutableRefObject,\n MouseEvent,\n useRef,\n useContext,\n useMemo\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Avatar,\n Button,\n Count,\n Card,\n CardContent,\n CardHeader,\n Flex,\n Icon,\n registerIcon,\n MenuButton,\n SummaryItem,\n Text,\n defaultThemeProp,\n ForwardProps,\n useI18n,\n Progress,\n useOuterEvent,\n MetaList,\n ModalManagerContext,\n SummaryListItem,\n ModalMethods,\n StyledVisual,\n useConfiguration,\n usePrevious\n} from '@pega/cosmos-react-core';\nimport { RichTextEditorState, StyledRichTextEditor } from '@pega/cosmos-react-rte';\nimport BareButton from '@pega/cosmos-react-core/lib/components/Button/BareButton';\nimport * as arrowMicroDownIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/arrow-micro-down.icon';\nimport * as caretLeftIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-left.icon';\nimport { formatListToLocaleString } from '@pega/cosmos-react-core/lib/utils/utils';\n\nimport FeedButton from './FeedButton';\nimport FeedAttachments from './FeedAttachments';\nimport { StyledFeedReplyContainer } from './FeedReply';\nimport FeedContent from './FeedContent';\nimport FeedReplyInput from './FeedReplyInput';\nimport { FeedContext, FeedReplyContext } from './Feed.context';\nimport FeedRichText from './FeedRichText';\nimport FeedModalList, { FeedModalListProps } from './FeedModalList';\nimport { FeedLikeButton } from './FeedLikeButton';\nimport { FeedPostProps } from './FeedPost.types';\n\nregisterIcon(arrowMicroDownIcon, caretLeftIcon);\n\nconst defaultProps: Partial<FeedPostProps> = {\n info: {\n avatarSrc: '',\n fullname: '',\n username: '',\n timeElapsed: '',\n content: ''\n }\n};\n\nexport const StyledFeedPost = styled.div(\n ({ theme }) => css`\n ${StyledFeedReplyContainer}:not(:last-child) {\n margin-block-end: calc(2 * ${theme.base.spacing});\n }\n `\n);\n\nStyledFeedPost.defaultProps = defaultThemeProp;\n\nexport const StyledPostEdit = styled.div(\n ({ theme }) => css`\n ${StyledRichTextEditor} {\n padding: calc(0.5 * ${theme.base.spacing});\n }\n `\n);\n\nStyledPostEdit.defaultProps = defaultThemeProp;\n\nexport const StyledReplies = styled.div(\n ({ theme }) => css`\n border-top: 0.0625rem solid ${theme.base.palette['border-line']};\n padding: calc(1.25 * ${theme.base.spacing}) calc(2 * ${theme.base.spacing});\n `\n);\n\nStyledReplies.defaultProps = defaultThemeProp;\n\nexport const StyledPostFooter = styled.div(\n ({ theme }) => css`\n margin-block-start: ${theme.base.spacing};\n `\n);\n\nStyledPostFooter.defaultProps = defaultThemeProp;\n\nconst FullWidthSummaryItem = styled.div`\n width: 100%;\n\n ${StyledVisual} {\n align-self: start;\n }\n`;\n\nconst FeedPost: FC<ForwardProps & FeedPostProps> = (props: ForwardProps & FeedPostProps) => {\n const {\n id,\n info,\n interactionInfo,\n maxContentHeight = Infinity,\n onMouseEnter,\n onMouseLeave,\n onCommentClick,\n onLikeClick,\n onLikeCountInteraction,\n onLoadMoreLikes,\n onRecipientInteraction,\n onLoadMoreRecipients,\n onUserClick,\n onShowMoreClick,\n newReplyField,\n menuItems,\n onEditSubmit,\n edited = false,\n replies = [],\n replyInput,\n replyInputShown,\n replyCount,\n repliesLoading,\n onShowLessReplies,\n onShowMoreReplies,\n ...restProps\n } = props;\n const {\n avatarSrc,\n fullname,\n username,\n timeElapsed,\n content,\n postType = 'public',\n recipients = [],\n recipientsCount = 0,\n attachments,\n liked,\n icon,\n postContext,\n userStatus\n } = info;\n const { commentLabel, interactionsEnabled = true } = interactionInfo;\n const { announce, userInfo: loggedInUser } = useContext(FeedContext);\n\n const t = useI18n();\n const { locale } = useConfiguration();\n const rteRef = useRef<RichTextEditorState>();\n const [editMode, setEditMode] = useState(false);\n const editTextAreaRef = useRef<HTMLDivElement>(null);\n const [emptyEditText, setEmptyEditText] = useState(false);\n const [postModified, setPostModified] = useState(false);\n const [replyInputOpen, setReplyInputOpen] = useState(false);\n const [replyInputRef, setReplyInputRef] = useState<MutableRefObject<\n RichTextEditorState | undefined\n > | null>(null);\n const { create } = useContext(ModalManagerContext);\n const recipientsModalRef = useRef<ModalMethods<FeedModalListProps>>();\n const prevReplies = usePrevious(replies);\n const suppressNextAnnouncement = useRef(false);\n\n useEffect(() => {\n if (recipients.length) {\n recipientsModalRef.current?.update({\n count: recipientsCount,\n heading: t('feed_recipients'),\n listItems: recipients as SummaryListItem[],\n onLoadMore: onLoadMoreRecipients\n });\n }\n }, [recipientsCount, recipients, onLoadMoreRecipients]);\n\n useOuterEvent('mousedown', [editTextAreaRef], () => {\n if (emptyEditText) setEditMode(false);\n });\n\n useEffect(() => {\n if ((replyInputOpen || replyInputShown) && replyInputRef) {\n replyInputRef.current?.focus();\n }\n }, [replyInputOpen, replyInputShown, replyInputRef]);\n\n const userVisual = icon ? (\n <Icon name={icon} />\n ) : (\n <Avatar name={fullname} size='l' imageSrc={avatarSrc} status={userStatus} />\n );\n\n const numReplies = replyCount || replies?.length;\n\n const postTypeAttributes = useMemo(() => {\n if (postType === 'private') {\n const recipientsList = recipients.map(x => x.primary);\n return {\n icon: 'users-solid',\n ariaLabel: `${t('feed_private_post')} t('feed_recipients')} ${formatListToLocaleString(\n recipientsList,\n t,\n locale,\n { count: recipientsCount }\n )}`,\n label: formatListToLocaleString(recipientsList, t, locale, {\n count: recipientsCount,\n separator: '\\n'\n })\n };\n }\n\n return {\n icon: 'globe',\n ariaLabel: t('feed_public_post'),\n label: t('feed_public_post')\n };\n }, [postType, recipients, recipientsCount]);\n\n const handleEdit = () => {\n if (!emptyEditText && postModified) {\n onEditSubmit?.({\n postId: id,\n value: rteRef.current?.getPlainText() || ''\n });\n setEditMode(false);\n }\n };\n\n useEffect(() => {\n if (prevReplies) {\n const difference = prevReplies.length - replies.length;\n if (difference > 0 && !suppressNextAnnouncement.current) {\n announce(t('feed_reply_removed'));\n } else {\n suppressNextAnnouncement.current = false;\n }\n }\n }, [replies]);\n\n return (\n <FeedReplyContext.Provider value={{ onShowReplyInput: () => setReplyInputOpen(true) }}>\n <Card\n {...restProps}\n as={StyledFeedPost}\n onMouseEnter={() => {\n onMouseEnter?.({ postId: id });\n }}\n onMouseLeave={() => {\n onMouseLeave?.({ postId: id });\n }}\n >\n <CardHeader>\n <SummaryItem\n as={FullWidthSummaryItem}\n visual={\n onUserClick ? (\n <BareButton\n onClick={(event: MouseEvent) => {\n onUserClick?.({ postId: id, username }, event);\n }}\n >\n {userVisual}\n </BareButton>\n ) : (\n userVisual\n )\n }\n primary={\n <div>\n {onUserClick ? (\n <Button\n variant='text'\n onClick={(event: MouseEvent) => {\n onUserClick?.({ postId: id, username }, event);\n }}\n >\n <Text variant='h3'>{fullname}</Text>\n </Button>\n ) : (\n <Text variant='h3'>{fullname}</Text>\n )}\n {postContext && <Text variant='primary'> {t('feed_context', [postContext])}</Text>}\n </div>\n }\n secondary={\n <Flex container={{ gap: 1, alignItems: 'center' }}>\n <Button\n variant='text'\n icon\n onClick={\n recipients.length\n ? () => {\n if (recipientsCount > 10) {\n recipientsModalRef.current = create(FeedModalList, {\n count: recipientsCount,\n heading: t('feed_recipients'),\n listItems: recipients as SummaryListItem[],\n onLoadMore: onLoadMoreRecipients\n });\n }\n }\n : onRecipientInteraction\n }\n onFocus={onRecipientInteraction}\n onMouseOver={onRecipientInteraction}\n aria-label={postTypeAttributes.ariaLabel}\n label={postTypeAttributes.label}\n >\n <Icon name={postTypeAttributes.icon} />\n </Button>\n <MetaList items={edited ? [timeElapsed, t('edited')] : [timeElapsed]} />\n </Flex>\n }\n actions={\n menuItems ? (\n <MenuButton\n text='More'\n menu={{\n items:\n onEditSubmit &&\n typeof content === 'string' &&\n username === loggedInUser.username\n ? menuItems.concat([\n {\n primary: t('edit'),\n id: 'edit',\n onClick: () => setEditMode(true)\n }\n ])\n : menuItems\n }}\n icon='more'\n iconOnly\n variant='simple'\n />\n ) : undefined\n }\n />\n </CardHeader>\n <CardContent>\n {editMode ? (\n <>\n <StyledPostEdit ref={editTextAreaRef}>\n <FeedRichText\n onChange={() => {\n setEmptyEditText(rteRef.current?.getPlainText().trim() === '');\n setPostModified(rteRef.current?.getPlainText() !== content);\n }}\n autoFocus\n label={t('feed_edit_post')}\n labelHidden\n onSubmit={handleEdit}\n defaultValue={content}\n ref={rteRef}\n />\n </StyledPostEdit>\n <Flex container={{ justify: 'between', pad: [2, 0, 0] }}>\n <Button\n onClick={() => setEditMode(false)}\n aria-label={`${t('cancel')} ${t('edit')} ${id}`}\n >\n {t('cancel')}\n </Button>\n <Button\n variant='primary'\n disabled={emptyEditText || !postModified}\n onClick={handleEdit}\n aria-label={`${t('update')} ${t('edit')} ${id}`}\n >\n {t('update')}\n </Button>\n </Flex>\n </>\n ) : (\n <FeedContent maxContentHeight={maxContentHeight}>{content}</FeedContent>\n )}\n <FeedAttachments attachments={attachments} readOnly />\n <Flex as={StyledPostFooter} container={{ justify: 'between', wrap: 'wrap', gap: 1 }}>\n {interactionsEnabled ? (\n <Flex container={{ gap: 2 }}>\n <Button\n variant='text'\n as={FeedButton}\n onClick={() => {\n onCommentClick?.({ postId: id });\n if (!replyInputOpen) {\n setReplyInputOpen(true);\n }\n }}\n >\n <Icon name='chat' />\n <Text>{commentLabel}</Text>\n {numReplies > 0 && <Count>{numReplies}</Count>}\n </Button>\n <FeedLikeButton\n id={id}\n variant='post'\n onLikeClick={onLikeClick}\n onLikeCountInteraction={onLikeCountInteraction}\n onLoadMoreLikes={onLoadMoreLikes}\n liked={liked}\n showText\n {...interactionInfo}\n />\n </Flex>\n ) : (\n <div />\n )}\n {(onShowLessReplies || onShowMoreReplies) && (\n <Flex container={{ gap: 0.5 }}>\n {replies.length !== numReplies && (\n <>\n <Text>{t('showing_num_of_num', [replies.length, numReplies])}</Text>\n <span>•</span>\n </>\n )}\n {onShowMoreReplies && replies.length < numReplies && (\n <Button variant='link' onClick={() => onShowMoreReplies({ postId: id })}>\n {t('show_more')}\n </Button>\n )}\n {repliesLoading && <Progress placement='inline' />}\n </Flex>\n )}\n </Flex>\n </CardContent>\n {!!replies?.length && <StyledReplies>{replies}</StyledReplies>}\n {replyInputShown || replyInputOpen ? (\n <CardContent>\n <FeedReplyInput\n onSetInputRef={({ ref }) => {\n setReplyInputRef(ref);\n }}\n id={id}\n commentLabel={replyInput.commentLabel}\n attachments={replyInput.attachments}\n placeholder={replyInput.placeholder}\n onFilesAdded={replyInput.onFilesAdded}\n onSubmit={e => {\n setReplyInputOpen(false);\n replyInput.onSubmit(e);\n }}\n />\n </CardContent>\n ) : null}\n {onShowLessReplies && !!replies.length && (\n <Flex container={{ justify: 'center', pad: [0, 0, 1], gap: 1 }}>\n <Button\n variant='link'\n onClick={() => {\n onShowLessReplies({ postId: id });\n suppressNextAnnouncement.current = true;\n }}\n >\n {t('show_less')}\n </Button>\n {repliesLoading && <Progress placement='inline' />}\n </Flex>\n )}\n </Card>\n </FeedReplyContext.Provider>\n );\n};\n\nFeedPost.defaultProps = defaultProps;\n\nexport default FeedPost;\n"]}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { ReactElement, MouseEvent } from 'react';
|
|
2
|
+
import { AvatarProps, MenuItemProps, SummaryListItem } from '@pega/cosmos-react-core';
|
|
3
|
+
import { AttachedFiles } from './FeedAttachments';
|
|
4
|
+
import { FeedContentProps } from './FeedContent';
|
|
5
|
+
import { FeedReplyInputProps } from './FeedReplyInput';
|
|
6
|
+
export interface FeedPostProps {
|
|
7
|
+
/** Unique ID for this activity */
|
|
8
|
+
id: string;
|
|
9
|
+
/** All of the information used to fill text portions, and avatar info */
|
|
10
|
+
info: {
|
|
11
|
+
avatarSrc?: string;
|
|
12
|
+
fullname: string;
|
|
13
|
+
username: string;
|
|
14
|
+
timeElapsed: string;
|
|
15
|
+
content: ReactElement | string;
|
|
16
|
+
postType?: 'public' | 'private';
|
|
17
|
+
recipients?: MenuItemProps[];
|
|
18
|
+
recipientsCount?: number;
|
|
19
|
+
attachments?: AttachedFiles[];
|
|
20
|
+
liked?: boolean;
|
|
21
|
+
icon?: string;
|
|
22
|
+
postContext?: ReactElement | string;
|
|
23
|
+
userStatus?: AvatarProps['status'];
|
|
24
|
+
};
|
|
25
|
+
maxContentHeight?: FeedContentProps['maxContentHeight'];
|
|
26
|
+
/** Button labels for accessibility purposes. */
|
|
27
|
+
interactionInfo: {
|
|
28
|
+
likeLabel: string;
|
|
29
|
+
likes?: SummaryListItem[];
|
|
30
|
+
likeCount?: number;
|
|
31
|
+
commentLabel: string;
|
|
32
|
+
/**
|
|
33
|
+
* @default true
|
|
34
|
+
*/
|
|
35
|
+
interactionsEnabled?: boolean;
|
|
36
|
+
};
|
|
37
|
+
/** Callback that runs when the mouse pointer hovers over the Activity. */
|
|
38
|
+
onMouseEnter?: (event: {
|
|
39
|
+
postId: string;
|
|
40
|
+
}) => void;
|
|
41
|
+
/** Callback that runs when the mouse pointer leaves the Activity. */
|
|
42
|
+
onMouseLeave?: (event: {
|
|
43
|
+
postId: string;
|
|
44
|
+
}) => void;
|
|
45
|
+
/** Callback that runs when the comment button has been clicked */
|
|
46
|
+
onCommentClick?: (event: {
|
|
47
|
+
postId: string;
|
|
48
|
+
}) => void;
|
|
49
|
+
/** Callback that runs when the like button has been clicked */
|
|
50
|
+
onLikeClick: (event: {
|
|
51
|
+
postId: string;
|
|
52
|
+
user: SummaryListItem;
|
|
53
|
+
}) => void;
|
|
54
|
+
/** Callback that runs when the like count on a post is hovered, focused, or clicked. */
|
|
55
|
+
onLikeCountInteraction?: () => void;
|
|
56
|
+
/** Callback that runs when the bottom of the extended like list Modal is reached, allowing for more likes to be loaded. */
|
|
57
|
+
onLoadMoreLikes?: () => void;
|
|
58
|
+
/** Callback that runs when the private recipient icon on a post is hovered, focused, or clicked. */
|
|
59
|
+
onRecipientInteraction?: () => void;
|
|
60
|
+
/** Callback that runs when the bottom of the extended private recipient list Modal is reached, allowing for more recipients to be loaded. */
|
|
61
|
+
onLoadMoreRecipients?: () => void;
|
|
62
|
+
/** Callback that runs when the user name or visual button has been clicked */
|
|
63
|
+
onUserClick?: (event: {
|
|
64
|
+
postId: string;
|
|
65
|
+
username: string;
|
|
66
|
+
}, clickEvent?: MouseEvent) => void;
|
|
67
|
+
/** MenuItems that will populate the three dot menu button */
|
|
68
|
+
menuItems?: MenuItemProps[];
|
|
69
|
+
/** Callback that updates the post after being edited. If undefined, the post will not be editable. */
|
|
70
|
+
onEditSubmit?: (event: {
|
|
71
|
+
postId: string;
|
|
72
|
+
value: string;
|
|
73
|
+
}) => void;
|
|
74
|
+
/**
|
|
75
|
+
* Flag that indicates if a post has been previously edited.
|
|
76
|
+
* @default false
|
|
77
|
+
*/
|
|
78
|
+
edited?: boolean;
|
|
79
|
+
/** Props that will be passed into the reply input, see FeedReplyInput for more information */
|
|
80
|
+
replyInput: Pick<FeedReplyInputProps, 'onSubmit' | 'placeholder' | 'onFilesAdded'> & {
|
|
81
|
+
commentLabel: FeedReplyInputProps['commentLabel'];
|
|
82
|
+
attachments: FeedReplyInputProps['attachments'];
|
|
83
|
+
};
|
|
84
|
+
/** The default visibility for the reply input */
|
|
85
|
+
replyInputShown?: boolean;
|
|
86
|
+
/** An array to hold FeedReply's inside of this Activity */
|
|
87
|
+
replies?: ReactElement[];
|
|
88
|
+
/** A total count of all replies. */
|
|
89
|
+
replyCount?: number;
|
|
90
|
+
/** Callback that runs when the user clicks Show more button. */
|
|
91
|
+
onShowMoreReplies?: (event: {
|
|
92
|
+
postId: string;
|
|
93
|
+
}) => void;
|
|
94
|
+
/** Callback that runs when the user clicks Show less button. */
|
|
95
|
+
onShowLessReplies?: (event: {
|
|
96
|
+
postId: string;
|
|
97
|
+
}) => void;
|
|
98
|
+
/** A loading indicator for the replies. */
|
|
99
|
+
repliesLoading?: boolean;
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=FeedPost.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FeedPost.types.d.ts","sourceRoot":"","sources":["../../../src/components/Feed/FeedPost.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAEtF,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD,MAAM,WAAW,aAAa;IAC5B,kCAAkC;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,yEAAyE;IACzE,IAAI,EAAE;QACJ,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,WAAW,EAAE,MAAM,CAAC;QACpB,OAAO,EAAE,YAAY,GAAG,MAAM,CAAC;QAC/B,QAAQ,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;QAChC,UAAU,CAAC,EAAE,aAAa,EAAE,CAAC;QAC7B,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,WAAW,CAAC,EAAE,aAAa,EAAE,CAAC;QAC9B,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,WAAW,CAAC,EAAE,YAAY,GAAG,MAAM,CAAC;QACpC,UAAU,CAAC,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;KACpC,CAAC;IACF,gBAAgB,CAAC,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;IACxD,gDAAgD;IAChD,eAAe,EAAE;QACf,SAAS,EAAE,MAAM,CAAC;QAClB,KAAK,CAAC,EAAE,eAAe,EAAE,C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H,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,8FAA8F;IAC9F,UAAU,EAAE,IAAI,CAAC,mBAAmB,EAAE,UAAU,GAAG,aAAa,GAAG,cAAc,CAAC,GAAG;QACnF,YAAY,EAAE,mBAAmB,CAAC,cAAc,CAAC,CAAC;QAClD,WAAW,EAAE,mBAAmB,CAAC,aAAa,CAAC,CAAC;KACjD,CAAC;IACF,iDAAiD;IACjD,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,2DAA2D;IAC3D,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;IACzB,oCAAoC;IACpC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gEAAgE;IAChE,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IACxD,gEAAgE;IAChE,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IACxD,2CAA2C;IAC3C,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FeedPost.types.js","sourceRoot":"","sources":["../../../src/components/Feed/FeedPost.types.ts"],"names":[],"mappings":"","sourcesContent":["import { ReactElement, MouseEvent } from 'react';\n\nimport { AvatarProps, MenuItemProps, SummaryListItem } from '@pega/cosmos-react-core';\n\nimport { AttachedFiles } from './FeedAttachments';\nimport { FeedContentProps } from './FeedContent';\nimport { FeedReplyInputProps } from './FeedReplyInput';\n\nexport interface FeedPostProps {\n /** Unique ID for this activity */\n id: string;\n /** All of the information used to fill text portions, and avatar info */\n info: {\n avatarSrc?: string;\n fullname: string;\n username: string;\n timeElapsed: string;\n content: ReactElement | string;\n postType?: 'public' | 'private';\n recipients?: MenuItemProps[];\n recipientsCount?: number;\n attachments?: AttachedFiles[];\n liked?: boolean;\n icon?: string;\n postContext?: ReactElement | string;\n userStatus?: AvatarProps['status'];\n };\n maxContentHeight?: FeedContentProps['maxContentHeight'];\n /** Button labels for accessibility purposes. */\n interactionInfo: {\n likeLabel: string;\n likes?: SummaryListItem[];\n likeCount?: number;\n commentLabel: string;\n /**\n * @default true\n */\n interactionsEnabled?: boolean;\n };\n /** Callback that runs when the mouse pointer hovers over the Activity. */\n onMouseEnter?: (event: { postId: string }) => void;\n /** Callback that runs when the mouse pointer leaves the Activity. */\n onMouseLeave?: (event: { postId: string }) => void;\n /** Callback that runs when the comment button has been clicked */\n onCommentClick?: (event: { postId: string }) => void;\n /** Callback that runs when the like button has been clicked */\n onLikeClick: (event: { postId: string; user: SummaryListItem }) => void;\n /** Callback that runs when the like count on a post is hovered, focused, or clicked. */\n onLikeCountInteraction?: () => void;\n /** Callback that runs when the bottom of the extended like list Modal is reached, allowing for more likes to be loaded. */\n onLoadMoreLikes?: () => void;\n /** Callback that runs when the private recipient icon on a post is hovered, focused, or clicked. */\n onRecipientInteraction?: () => void;\n /** Callback that runs when the bottom of the extended private recipient list Modal is reached, allowing for more recipients to be loaded. */\n onLoadMoreRecipients?: () => void;\n /** Callback that runs when the user name or visual button has been clicked */\n onUserClick?: (event: { postId: string; username: string }, clickEvent?: MouseEvent) => void;\n /** MenuItems that will populate the three dot menu button */\n menuItems?: MenuItemProps[];\n /** Callback that updates the post after being edited. If undefined, the post will not be editable. */\n onEditSubmit?: (event: { postId: string; value: string }) => void;\n /**\n * Flag that indicates if a post has been previously edited.\n * @default false\n */\n edited?: boolean;\n /** Props that will be passed into the reply input, see FeedReplyInput for more information */\n replyInput: Pick<FeedReplyInputProps, 'onSubmit' | 'placeholder' | 'onFilesAdded'> & {\n commentLabel: FeedReplyInputProps['commentLabel'];\n attachments: FeedReplyInputProps['attachments'];\n };\n /** The default visibility for the reply input */\n replyInputShown?: boolean;\n /** An array to hold FeedReply's inside of this Activity */\n replies?: ReactElement[];\n /** A total count of all replies. */\n replyCount?: number;\n /** Callback that runs when the user clicks Show more button. */\n onShowMoreReplies?: (event: { postId: string }) => void;\n /** Callback that runs when the user clicks Show less button. */\n onShowLessReplies?: (event: { postId: string }) => void;\n /** A loading indicator for the replies. */\n repliesLoading?: boolean;\n}\n"]}
|
|
@@ -1,70 +1,6 @@
|
|
|
1
|
-
import { FC
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
export interface FeedReplyProps {
|
|
5
|
-
id: string;
|
|
6
|
-
info: {
|
|
7
|
-
avatarSrc?: string;
|
|
8
|
-
timeElapsed: string;
|
|
9
|
-
content: ReactElement | string;
|
|
10
|
-
attachments?: AttachedFiles[];
|
|
11
|
-
username: string;
|
|
12
|
-
fullname: string;
|
|
13
|
-
fullnameLabel: string;
|
|
14
|
-
liked?: boolean;
|
|
15
|
-
icon?: string;
|
|
16
|
-
userStatus?: AvatarProps['status'];
|
|
17
|
-
};
|
|
18
|
-
interactionInfo: {
|
|
19
|
-
likes?: SummaryListItem[];
|
|
20
|
-
likeCount?: number;
|
|
21
|
-
likeLabel: string;
|
|
22
|
-
commentLabel: string;
|
|
23
|
-
/**
|
|
24
|
-
* @default true
|
|
25
|
-
*/
|
|
26
|
-
interactionsEnabled?: boolean;
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* A maximum height in pixels to display post content within before prompting to expand the post.
|
|
30
|
-
* @default Infinity
|
|
31
|
-
*/
|
|
32
|
-
maxContentHeight?: number;
|
|
33
|
-
/** A set of menu options for actions on the reply. */
|
|
34
|
-
menuItems?: MenuItemProps[];
|
|
35
|
-
/** Callback that updates the reply after being edited. If undefined, the reply will not be editable. */
|
|
36
|
-
onEditSubmit?: (event: {
|
|
37
|
-
replyId: string;
|
|
38
|
-
value: string;
|
|
39
|
-
}) => void;
|
|
40
|
-
/**
|
|
41
|
-
* Flag that indicates if a reply has been previously edited.
|
|
42
|
-
* @default false
|
|
43
|
-
*/
|
|
44
|
-
edited?: boolean;
|
|
45
|
-
onMouseEnter?: (event: {
|
|
46
|
-
replyId: string;
|
|
47
|
-
}) => void;
|
|
48
|
-
onMouseLeave?: (event: {
|
|
49
|
-
replyId: string;
|
|
50
|
-
}) => void;
|
|
51
|
-
onCommentClick: (event: {
|
|
52
|
-
replyId: string;
|
|
53
|
-
username: string;
|
|
54
|
-
}) => void;
|
|
55
|
-
onLikeClick: (event: {
|
|
56
|
-
replyId: string;
|
|
57
|
-
user: SummaryListItem;
|
|
58
|
-
}) => void;
|
|
59
|
-
/** Callback that runs when the like count on a post is hovered, focused, or clicked. */
|
|
60
|
-
onLikeCountInteraction?: () => void;
|
|
61
|
-
/** Callback that runs when the bottom of the extended like list Modal is reached, allowing for more likes to be loaded. */
|
|
62
|
-
onLoadMoreLikes?: () => void;
|
|
63
|
-
onUserClick?: (event: {
|
|
64
|
-
replyId: string;
|
|
65
|
-
username: string;
|
|
66
|
-
}, clickEvent?: MouseEvent) => void;
|
|
67
|
-
}
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { ForwardProps } from '@pega/cosmos-react-core';
|
|
3
|
+
import { FeedReplyProps } from './FeedReply.types';
|
|
68
4
|
export declare const StyledFeedReplyContent: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
69
5
|
export declare const StyledFeedReplyUser: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, {}, never>;
|
|
70
6
|
export declare const StyledVisualButton: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, {}, never>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeedReply.d.ts","sourceRoot":"","sources":["../../../src/components/Feed/FeedReply.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"FeedReply.d.ts","sourceRoot":"","sources":["../../../src/components/Feed/FeedReply.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAuD,MAAM,OAAO,CAAC;AAGhF,OAAO,EAQL,YAAY,EAKb,MAAM,yBAAyB,CAAC;AAQjC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAYnD,eAAO,MAAM,sBAAsB,yGAQjC,CAAC;AAIH,eAAO,MAAM,mBAAmB,4GAO9B,CAAC;AAIH,eAAO,MAAM,kBAAkB,4GAE9B,CAAC;AAEF,eAAO,MAAM,wBAAwB,yGA2BnC,CAAC;AAIH,QAAA,MAAM,SAAS,EAAE,EAAE,CAAC,YAAY,GAAG,cAAc,CAiNhD,CAAC;AAEF,eAAe,SAAS,CAAC"}
|