@pega/cosmos-react-social 4.0.0-dev.21.0 → 4.0.0-dev.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/Feed/Feed.context.d.ts +2 -1
- 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 +3 -53
- package/lib/components/Feed/Feed.d.ts.map +1 -1
- package/lib/components/Feed/Feed.js +27 -29
- package/lib/components/Feed/Feed.js.map +1 -1
- package/lib/components/Feed/Feed.types.d.ts +330 -0
- package/lib/components/Feed/Feed.types.d.ts.map +1 -0
- package/lib/components/Feed/Feed.types.js +2 -0
- package/lib/components/Feed/Feed.types.js.map +1 -0
- package/lib/components/Feed/FeedAnnouncer.d.ts +2 -3
- package/lib/components/Feed/FeedAnnouncer.d.ts.map +1 -1
- package/lib/components/Feed/FeedAnnouncer.js.map +1 -1
- package/lib/components/Feed/FeedAttachments.d.ts +3 -9
- package/lib/components/Feed/FeedAttachments.d.ts.map +1 -1
- package/lib/components/Feed/FeedAttachments.js +17 -10
- package/lib/components/Feed/FeedAttachments.js.map +1 -1
- package/lib/components/Feed/FeedButton.d.ts +0 -1
- package/lib/components/Feed/FeedButton.d.ts.map +1 -1
- package/lib/components/Feed/FeedButton.js +2 -10
- package/lib/components/Feed/FeedButton.js.map +1 -1
- package/lib/components/Feed/FeedContent.d.ts +2 -10
- package/lib/components/Feed/FeedContent.d.ts.map +1 -1
- package/lib/components/Feed/FeedContent.js +8 -1
- package/lib/components/Feed/FeedContent.js.map +1 -1
- package/lib/components/Feed/FeedContentFooter.d.ts +5 -0
- package/lib/components/Feed/FeedContentFooter.d.ts.map +1 -0
- package/lib/components/Feed/FeedContentFooter.js +34 -0
- package/lib/components/Feed/FeedContentFooter.js.map +1 -0
- package/lib/components/Feed/FeedContentHeader.d.ts +5 -0
- package/lib/components/Feed/FeedContentHeader.d.ts.map +1 -0
- package/lib/components/Feed/FeedContentHeader.js +101 -0
- package/lib/components/Feed/FeedContentHeader.js.map +1 -0
- package/lib/components/Feed/FeedEditRegion.d.ts +6 -0
- package/lib/components/Feed/FeedEditRegion.d.ts.map +1 -0
- package/lib/components/Feed/FeedEditRegion.js +46 -0
- package/lib/components/Feed/FeedEditRegion.js.map +1 -0
- package/lib/components/Feed/FeedInputRegion.d.ts +8 -0
- package/lib/components/Feed/FeedInputRegion.d.ts.map +1 -0
- package/lib/components/Feed/FeedInputRegion.js +86 -0
- package/lib/components/Feed/FeedInputRegion.js.map +1 -0
- package/lib/components/Feed/FeedLikeButton.d.ts +5 -17
- package/lib/components/Feed/FeedLikeButton.d.ts.map +1 -1
- package/lib/components/Feed/FeedLikeButton.js +44 -30
- package/lib/components/Feed/FeedLikeButton.js.map +1 -1
- package/lib/components/Feed/FeedModalList.d.ts +1 -13
- package/lib/components/Feed/FeedModalList.d.ts.map +1 -1
- package/lib/components/Feed/FeedModalList.js +5 -2
- package/lib/components/Feed/FeedModalList.js.map +1 -1
- package/lib/components/Feed/FeedNewPost.d.ts +1 -30
- package/lib/components/Feed/FeedNewPost.d.ts.map +1 -1
- package/lib/components/Feed/FeedNewPost.js +7 -85
- package/lib/components/Feed/FeedNewPost.js.map +1 -1
- package/lib/components/Feed/FeedNewPostTypeMenu.d.ts +2 -28
- package/lib/components/Feed/FeedNewPostTypeMenu.d.ts.map +1 -1
- package/lib/components/Feed/FeedNewPostTypeMenu.js +2 -2
- package/lib/components/Feed/FeedNewPostTypeMenu.js.map +1 -1
- package/lib/components/Feed/FeedPost.d.ts +2 -4
- package/lib/components/Feed/FeedPost.d.ts.map +1 -1
- package/lib/components/Feed/FeedPost.js +96 -159
- package/lib/components/Feed/FeedPost.js.map +1 -1
- package/lib/components/Feed/FeedReply.d.ts +1 -4
- package/lib/components/Feed/FeedReply.d.ts.map +1 -1
- package/lib/components/Feed/FeedReply.js +56 -138
- package/lib/components/Feed/FeedReply.js.map +1 -1
- package/lib/components/Feed/FeedReplyInput.d.ts +2 -27
- package/lib/components/Feed/FeedReplyInput.d.ts.map +1 -1
- package/lib/components/Feed/FeedReplyInput.js +9 -96
- package/lib/components/Feed/FeedReplyInput.js.map +1 -1
- package/lib/components/Feed/FeedRichText.d.ts +1 -4
- package/lib/components/Feed/FeedRichText.d.ts.map +1 -1
- package/lib/components/Feed/FeedRichText.js +3 -8
- package/lib/components/Feed/FeedRichText.js.map +1 -1
- package/lib/components/Feed/index.d.ts +1 -7
- package/lib/components/Feed/index.d.ts.map +1 -1
- package/lib/components/Feed/index.js.map +1 -1
- package/package.json +4 -4
- package/lib/components/Feed/FeedPost.types.d.ts +0 -105
- package/lib/components/Feed/FeedPost.types.d.ts.map +0 -1
- package/lib/components/Feed/FeedPost.types.js +0 -2
- package/lib/components/Feed/FeedPost.types.js.map +0 -1
- package/lib/components/Feed/FeedReply.types.d.ts +0 -70
- package/lib/components/Feed/FeedReply.types.d.ts.map +0 -1
- package/lib/components/Feed/FeedReply.types.js +0 -2
- package/lib/components/Feed/FeedReply.types.js.map +0 -1
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { Button, Flex, Icon, useI18n, useOuterEvent } from '@pega/cosmos-react-core';
|
|
5
|
+
import FeedRichText from './FeedRichText';
|
|
6
|
+
import { minInputHeight, StyledActions } from './FeedInputRegion';
|
|
7
|
+
import FeedButton from './FeedButton';
|
|
8
|
+
const StyledInputContainer = styled.div `
|
|
9
|
+
width: 100%;
|
|
10
|
+
`;
|
|
11
|
+
const FeedEditRegion = (props) => {
|
|
12
|
+
const { variant, id, content, setEditMode, onEditSubmit, emptyEditText, setEmptyEditText } = props;
|
|
13
|
+
const t = useI18n();
|
|
14
|
+
const rteRef = useRef();
|
|
15
|
+
const editTextAreaRef = useRef(null);
|
|
16
|
+
const [contentModified, setContentModified] = useState(false);
|
|
17
|
+
useOuterEvent('mousedown', [editTextAreaRef], () => {
|
|
18
|
+
if (emptyEditText)
|
|
19
|
+
setEditMode(false);
|
|
20
|
+
});
|
|
21
|
+
const handleEdit = () => {
|
|
22
|
+
if (!emptyEditText && contentModified) {
|
|
23
|
+
onEditSubmit?.({
|
|
24
|
+
id,
|
|
25
|
+
value: rteRef.current?.getPlainText() || ''
|
|
26
|
+
});
|
|
27
|
+
setEditMode(false);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
const onKeyDown = (event) => {
|
|
31
|
+
if ((event.metaKey || event.ctrlKey) && event.key === 'Enter')
|
|
32
|
+
handleEdit();
|
|
33
|
+
};
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
if (rteRef.current) {
|
|
36
|
+
rteRef.current?.focus();
|
|
37
|
+
}
|
|
38
|
+
}, [rteRef]);
|
|
39
|
+
const label = t(variant === 'post' ? 'feed_edit_post' : 'feed_edit_comment');
|
|
40
|
+
return (_jsxs(Flex, { container: { gap: 1, alignItems: 'start' }, children: [_jsx(StyledInputContainer, { ref: editTextAreaRef, children: _jsx(FeedRichText, { label: label, onChange: () => {
|
|
41
|
+
setEmptyEditText(rteRef.current?.getPlainText().trim() === '');
|
|
42
|
+
setContentModified(rteRef.current?.getPlainText() !== content);
|
|
43
|
+
}, onKeyDown: onKeyDown, height: { min: minInputHeight }, defaultValue: content, ref: rteRef }) }), _jsxs(Flex, { as: StyledActions, container: { direction: 'column', gap: 0.5 }, children: [_jsx(Button, { variant: 'simple', as: FeedButton, onClick: () => setEditMode(false), icon: true, label: t('cancel'), children: _jsx(Icon, { name: 'times' }) }), _jsx(Button, { as: FeedButton, disabled: emptyEditText || !contentModified, variant: 'simple', onClick: handleEdit, icon: true, label: t('update'), children: _jsx(Icon, { name: 'send' }) })] })] }));
|
|
44
|
+
};
|
|
45
|
+
export default FeedEditRegion;
|
|
46
|
+
//# sourceMappingURL=FeedEditRegion.js.map
|
|
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AAG,EAAE,aACnE,KAAC,MAAM,IACL,OAAO,EAAC,QAAQ,EAChB,EAAE,EAAE,UAAU,EACd,OAAO,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,EACjC,IAAI,QACJ,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAC,YAElB,KAAC,IAAI,IAAC,IAAI,EAAC,OAAO,GAAG,GACd,EAET,KAAC,MAAM,IACL,EAAE,EAAE,UAAU,EACd,QAAQ,EAAE,aAAa,IAAI,CAAC,eAAe,EAC3C,OAAO,EAAC,QAAQ,EAChB,OAAO,EAAE,UAAU,EACnB,IAAI,QACJ,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAC,YAElB,KAAC,IAAI,IAAC,IAAI,EAAC,MAAM,GAAG,GACb,IACJ,IACF,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import { FC, useEffect, useRef, useState } from 'react';\nimport styled from 'styled-components';\n\nimport { Button, Flex, ForwardProps, Icon, useI18n, useOuterEvent } from '@pega/cosmos-react-core';\nimport { RichTextEditorState } from '@pega/cosmos-react-rte';\n\nimport FeedRichText from './FeedRichText';\nimport { FeedEditRegionProps } from './Feed.types';\nimport { minInputHeight, StyledActions } from './FeedInputRegion';\nimport FeedButton from './FeedButton';\n\nconst StyledInputContainer = styled.div`\n width: 100%;\n`;\n\nconst FeedEditRegion: FC<ForwardProps & FeedEditRegionProps> = (\n props: ForwardProps & FeedEditRegionProps\n) => {\n const { variant, id, content, setEditMode, onEditSubmit, emptyEditText, setEmptyEditText } =\n props;\n\n const t = useI18n();\n const rteRef = useRef<RichTextEditorState>();\n const editTextAreaRef = useRef<HTMLDivElement>(null);\n\n const [contentModified, setContentModified] = useState(false);\n\n useOuterEvent('mousedown', [editTextAreaRef], () => {\n if (emptyEditText) setEditMode(false);\n });\n\n const handleEdit = () => {\n if (!emptyEditText && contentModified) {\n onEditSubmit?.({\n id,\n value: rteRef.current?.getPlainText() || ''\n });\n setEditMode(false);\n }\n };\n\n const onKeyDown = (event: KeyboardEvent) => {\n if ((event.metaKey || event.ctrlKey) && event.key === 'Enter') handleEdit();\n };\n\n useEffect(() => {\n if (rteRef.current) {\n rteRef.current?.focus();\n }\n }, [rteRef]);\n\n const label = t(variant === 'post' ? 'feed_edit_post' : 'feed_edit_comment');\n\n return (\n <Flex container={{ gap: 1, alignItems: 'start' }}>\n <StyledInputContainer ref={editTextAreaRef}>\n <FeedRichText\n label={label}\n onChange={() => {\n setEmptyEditText(rteRef.current?.getPlainText().trim() === '');\n setContentModified(rteRef.current?.getPlainText() !== content);\n }}\n onKeyDown={onKeyDown}\n height={{ min: minInputHeight }}\n defaultValue={content}\n ref={rteRef}\n />\n </StyledInputContainer>\n <Flex as={StyledActions} container={{ direction: 'column', gap: 0.5 }}>\n <Button\n variant='simple'\n as={FeedButton}\n onClick={() => setEditMode(false)}\n icon\n label={t('cancel')}\n >\n <Icon name='times' />\n </Button>\n\n <Button\n as={FeedButton}\n disabled={emptyEditText || !contentModified}\n variant='simple'\n onClick={handleEdit}\n icon\n label={t('update')}\n >\n <Icon name='send' />\n </Button>\n </Flex>\n </Flex>\n );\n};\n\nexport default FeedEditRegion;\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { ForwardProps } from '@pega/cosmos-react-core';
|
|
3
|
+
import { FeedInputRegionProps } from './Feed.types';
|
|
4
|
+
export declare const minInputHeight = "4rem";
|
|
5
|
+
export declare const StyledActions: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
6
|
+
declare const FeedInputRegion: FC<ForwardProps & FeedInputRegionProps>;
|
|
7
|
+
export default FeedInputRegion;
|
|
8
|
+
//# sourceMappingURL=FeedInputRegion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FeedInputRegion.d.ts","sourceRoot":"","sources":["../../../src/components/Feed/FeedInputRegion.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAoC,MAAM,OAAO,CAAC;AAG7D,OAAO,EAKL,YAAY,EAKb,MAAM,yBAAyB,CAAC;AAMjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEpD,eAAO,MAAM,cAAc,SAAS,CAAC;AAoBrC,eAAO,MAAM,aAAa,yGAQxB,CAAC;AAQH,QAAA,MAAM,eAAe,EAAE,EAAE,CAAC,YAAY,GAAG,oBAAoB,CAsH5D,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useContext, useState } from 'react';
|
|
3
|
+
import styled, { css } from 'styled-components';
|
|
4
|
+
import { Avatar, Button, defaultThemeProp, Flex, Icon, useElement, useI18n, useOuterEvent } from '@pega/cosmos-react-core';
|
|
5
|
+
import { FeedContext } from './Feed.context';
|
|
6
|
+
import FeedAttachments from './FeedAttachments';
|
|
7
|
+
import FeedButton from './FeedButton';
|
|
8
|
+
import FeedRichText from './FeedRichText';
|
|
9
|
+
export const minInputHeight = '4rem';
|
|
10
|
+
const StyledAvatar = styled(Avatar)(({ theme }) => {
|
|
11
|
+
return css `
|
|
12
|
+
margin-block-start: calc(0.5 * ${theme.base.spacing});
|
|
13
|
+
`;
|
|
14
|
+
});
|
|
15
|
+
StyledAvatar.defaultProps = defaultThemeProp;
|
|
16
|
+
const StyledTextAreaContainer = styled.div(({ theme }) => {
|
|
17
|
+
return css `
|
|
18
|
+
width: 100%;
|
|
19
|
+
overflow-y: hidden;
|
|
20
|
+
padding: 0 ${theme.base.spacing} calc(0.5 * ${theme.base.spacing}) ${theme.base.spacing};
|
|
21
|
+
`;
|
|
22
|
+
});
|
|
23
|
+
StyledTextAreaContainer.defaultProps = defaultThemeProp;
|
|
24
|
+
export const StyledActions = styled.div(({ theme }) => {
|
|
25
|
+
return css `
|
|
26
|
+
margin-block-start: calc(2.5 * ${theme.base.spacing});
|
|
27
|
+
|
|
28
|
+
${FeedButton} + ${FeedButton} {
|
|
29
|
+
margin-inline-start: 0;
|
|
30
|
+
}
|
|
31
|
+
`;
|
|
32
|
+
});
|
|
33
|
+
StyledActions.defaultProps = defaultThemeProp;
|
|
34
|
+
const HiddenFileInput = styled.input `
|
|
35
|
+
display: none;
|
|
36
|
+
`;
|
|
37
|
+
const FeedInputRegion = (props) => {
|
|
38
|
+
const { variant, id, attachments = [], onFilesAdded, onSubmit, inputRegionEl, rteRef, selectedRecipients } = props;
|
|
39
|
+
const t = useI18n();
|
|
40
|
+
const { setShowSearchResults } = useContext(FeedContext);
|
|
41
|
+
const { avatarSrc, fullname, username, userStatus } = useContext(FeedContext).userInfo;
|
|
42
|
+
const [emptyText, setEmptyText] = useState(true);
|
|
43
|
+
const [attachmentEl, setAttachmentEl] = useElement();
|
|
44
|
+
useOuterEvent('mousedown', [inputRegionEl], () => {
|
|
45
|
+
if (emptyText)
|
|
46
|
+
rteRef.current?.clear();
|
|
47
|
+
});
|
|
48
|
+
const handleSubmit = () => {
|
|
49
|
+
setShowSearchResults?.(false);
|
|
50
|
+
if ((!emptyText || attachments.length > 0) && attachments.every(x => !x.error)) {
|
|
51
|
+
onSubmit({
|
|
52
|
+
id,
|
|
53
|
+
value: rteRef.current?.getPlainText() || '',
|
|
54
|
+
attachments: attachments || [],
|
|
55
|
+
username,
|
|
56
|
+
recipients: variant === 'post' ? selectedRecipients : undefined,
|
|
57
|
+
clear: () => {
|
|
58
|
+
rteRef.current?.clear();
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
const onKeyDown = (event) => {
|
|
64
|
+
setShowSearchResults?.(true);
|
|
65
|
+
if ((event.metaKey || event.ctrlKey) && event.key === 'Enter')
|
|
66
|
+
handleSubmit();
|
|
67
|
+
};
|
|
68
|
+
const inputLabel = t(variant === 'post' ? 'feed_new_post' : 'feed_new_comment');
|
|
69
|
+
const submitLabel = t(variant === 'post' ? 'feed_new_post_submit' : 'feed_new_comment_submit');
|
|
70
|
+
return (_jsxs(_Fragment, { children: [_jsxs(Flex, { container: { alignItems: 'start' }, children: [_jsx(StyledAvatar, { name: fullname, size: variant === 'post' ? 'l' : 'm', imageSrc: avatarSrc, status: userStatus }), _jsx(StyledTextAreaContainer, { children: _jsx(FeedRichText, { label: inputLabel, onChange: () => {
|
|
71
|
+
setEmptyText(rteRef.current?.getPlainText().trim() === '');
|
|
72
|
+
}, onKeyDown: onKeyDown, height: { min: minInputHeight }, ref: rteRef }) }), _jsxs(Flex, { as: StyledActions, container: { direction: 'column', gap: 0.5 }, children: [onFilesAdded && (_jsx(Button, { variant: 'simple', as: FeedButton, onClick: () => {
|
|
73
|
+
setShowSearchResults?.(false);
|
|
74
|
+
attachmentEl?.click();
|
|
75
|
+
}, icon: true, label: t('file_upload_text_multiple'), children: _jsx(Icon, { name: 'paper-clip' }) })), _jsx(Button, { as: FeedButton, disabled: (emptyText && attachments.length === 0) || attachments.some(x => x.error), variant: 'simple', onClick: handleSubmit, icon: true, label: submitLabel, children: _jsx(Icon, { name: 'send' }) })] })] }), _jsx(HiddenFileInput, { ref: setAttachmentEl, type: 'file', multiple: true, onChange: () => {
|
|
76
|
+
if (attachmentEl?.files) {
|
|
77
|
+
onFilesAdded?.(Array.from(attachmentEl?.files));
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
// Must trick input to believe there is no value when activated so that the same file may be added consecutively.
|
|
81
|
+
onClick: (event) => {
|
|
82
|
+
event.target.value = '';
|
|
83
|
+
} }), _jsx(FeedAttachments, { variant: variant, attachments: attachments })] }));
|
|
84
|
+
};
|
|
85
|
+
export default FeedInputRegion;
|
|
86
|
+
//# sourceMappingURL=FeedInputRegion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FeedInputRegion.js","sourceRoot":"","sources":["../../../src/components/Feed/FeedInputRegion.tsx"],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C,eAAe,IAAC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,GAAI,IAC9D,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC","sourcesContent":["import { FC, MouseEvent, useContext, useState } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Avatar,\n Button,\n defaultThemeProp,\n Flex,\n ForwardProps,\n Icon,\n useElement,\n useI18n,\n useOuterEvent\n} from '@pega/cosmos-react-core';\n\nimport { FeedContext } from './Feed.context';\nimport FeedAttachments from './FeedAttachments';\nimport FeedButton from './FeedButton';\nimport FeedRichText from './FeedRichText';\nimport { FeedInputRegionProps } from './Feed.types';\n\nexport const minInputHeight = '4rem';\n\nconst StyledAvatar = styled(Avatar)(({ theme }) => {\n return css`\n margin-block-start: calc(0.5 * ${theme.base.spacing});\n `;\n});\n\nStyledAvatar.defaultProps = defaultThemeProp;\n\nconst StyledTextAreaContainer = styled.div(({ theme }) => {\n return css`\n width: 100%;\n overflow-y: hidden;\n padding: 0 ${theme.base.spacing} calc(0.5 * ${theme.base.spacing}) ${theme.base.spacing};\n `;\n});\n\nStyledTextAreaContainer.defaultProps = defaultThemeProp;\n\nexport const StyledActions = styled.div(({ theme }) => {\n return css`\n margin-block-start: calc(2.5 * ${theme.base.spacing});\n\n ${FeedButton} + ${FeedButton} {\n margin-inline-start: 0;\n }\n `;\n});\n\nStyledActions.defaultProps = defaultThemeProp;\n\nconst HiddenFileInput = styled.input`\n display: none;\n`;\n\nconst FeedInputRegion: FC<ForwardProps & FeedInputRegionProps> = (\n props: ForwardProps & FeedInputRegionProps\n) => {\n const {\n variant,\n id,\n attachments = [],\n onFilesAdded,\n onSubmit,\n inputRegionEl,\n rteRef,\n selectedRecipients\n } = props;\n\n const t = useI18n();\n const { setShowSearchResults } = useContext(FeedContext);\n const { avatarSrc, fullname, username, userStatus } = useContext(FeedContext).userInfo;\n\n const [emptyText, setEmptyText] = useState(true);\n const [attachmentEl, setAttachmentEl] = useElement<HTMLInputElement>();\n\n useOuterEvent('mousedown', [inputRegionEl], () => {\n if (emptyText) rteRef.current?.clear();\n });\n\n const handleSubmit = () => {\n setShowSearchResults?.(false);\n if ((!emptyText || attachments.length > 0) && attachments.every(x => !x.error)) {\n onSubmit({\n id,\n value: rteRef.current?.getPlainText() || '',\n attachments: attachments || [],\n username,\n recipients: variant === 'post' ? selectedRecipients : undefined,\n clear: () => {\n rteRef.current?.clear();\n }\n });\n }\n };\n\n const onKeyDown = (event: KeyboardEvent) => {\n setShowSearchResults?.(true);\n if ((event.metaKey || event.ctrlKey) && event.key === 'Enter') handleSubmit();\n };\n\n const inputLabel = t(variant === 'post' ? 'feed_new_post' : 'feed_new_comment');\n const submitLabel = t(variant === 'post' ? 'feed_new_post_submit' : 'feed_new_comment_submit');\n\n return (\n <>\n <Flex container={{ alignItems: 'start' }}>\n <StyledAvatar\n name={fullname}\n size={variant === 'post' ? 'l' : 'm'}\n imageSrc={avatarSrc}\n status={userStatus}\n />\n\n <StyledTextAreaContainer>\n <FeedRichText\n label={inputLabel}\n onChange={() => {\n setEmptyText(rteRef.current?.getPlainText().trim() === '');\n }}\n onKeyDown={onKeyDown}\n height={{ min: minInputHeight }}\n ref={rteRef}\n />\n </StyledTextAreaContainer>\n\n <Flex as={StyledActions} container={{ direction: 'column', gap: 0.5 }}>\n {onFilesAdded && (\n <Button\n variant='simple'\n as={FeedButton}\n onClick={() => {\n setShowSearchResults?.(false);\n attachmentEl?.click();\n }}\n icon\n label={t('file_upload_text_multiple')}\n >\n <Icon name='paper-clip' />\n </Button>\n )}\n\n <Button\n as={FeedButton}\n disabled={(emptyText && attachments.length === 0) || attachments.some(x => x.error)}\n variant='simple'\n onClick={handleSubmit}\n icon\n label={submitLabel}\n >\n <Icon name='send' />\n </Button>\n </Flex>\n </Flex>\n\n <HiddenFileInput\n ref={setAttachmentEl}\n type='file'\n multiple\n onChange={() => {\n if (attachmentEl?.files) {\n onFilesAdded?.(Array.from(attachmentEl?.files));\n }\n }}\n // Must trick input to believe there is no value when activated so that the same file may be added consecutively.\n onClick={(event: MouseEvent) => {\n (event.target as HTMLInputElement).value = '';\n }}\n />\n\n <FeedAttachments variant={variant} attachments={attachments} />\n </>\n );\n};\n\nexport default FeedInputRegion;\n"]}
|
|
@@ -1,19 +1,7 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
import { ForwardProps
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
interface PostFeedLikeButtonProps extends BaseFeedLikeButtonProps {
|
|
9
|
-
variant: 'post';
|
|
10
|
-
onLikeClick: FeedPostProps['onLikeClick'];
|
|
11
|
-
}
|
|
12
|
-
interface ReplyFeedLikeButtonProps extends BaseFeedLikeButtonProps {
|
|
13
|
-
variant: 'reply';
|
|
14
|
-
onLikeClick: FeedReplyProps['onLikeClick'];
|
|
15
|
-
}
|
|
16
|
-
export type FeedLikeButtonProps = PostFeedLikeButtonProps | ReplyFeedLikeButtonProps;
|
|
17
|
-
export declare const FeedLikeButton: FC<FeedLikeButtonProps & ForwardProps>;
|
|
18
|
-
export {};
|
|
2
|
+
import { ForwardProps } from '@pega/cosmos-react-core';
|
|
3
|
+
import { FeedMessageBaseProps } from './Feed.types';
|
|
4
|
+
type FeedLikeButtonProps = Pick<FeedMessageBaseProps, 'id' | 'liked' | 'likeCount' | 'likes' | 'onLikeClick' | 'onLikeCountInteraction' | 'onLoadMoreLikes' | 'likesLoading'>;
|
|
5
|
+
declare const FeedLikeButton: FC<FeedLikeButtonProps & ForwardProps>;
|
|
6
|
+
export default FeedLikeButton;
|
|
19
7
|
//# sourceMappingURL=FeedLikeButton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeedLikeButton.d.ts","sourceRoot":"","sources":["../../../src/components/Feed/FeedLikeButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAA0E,MAAM,OAAO,CAAC;AAGnG,OAAO,EACL,YAAY,
|
|
1
|
+
{"version":3,"file":"FeedLikeButton.d.ts","sourceRoot":"","sources":["../../../src/components/Feed/FeedLikeButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAA0E,MAAM,OAAO,CAAC;AAGnG,OAAO,EACL,YAAY,EAeb,MAAM,yBAAyB,CAAC;AAMjC,OAAO,EAAE,oBAAoB,EAAsB,MAAM,cAAc,CAAC;AAgCxE,KAAK,mBAAmB,GAAG,IAAI,CAC7B,oBAAoB,EAClB,IAAI,GACJ,OAAO,GACP,WAAW,GACX,OAAO,GACP,aAAa,GACb,wBAAwB,GACxB,iBAAiB,GACjB,cAAc,CACjB,CAAC;AAEF,QAAA,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,GAAG,YAAY,CA6H1D,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -1,17 +1,41 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useContext, useMemo, useRef, useEffect } from 'react';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
|
-
import { Button, Icon,
|
|
3
|
+
import styled, { css } from 'styled-components';
|
|
4
|
+
import { Button, Icon, Avatar, Count, Tooltip, useModalManager, useI18n, useConfiguration, useElement, formatListToLocaleString, Flex, defaultThemeProp, useUID } from '@pega/cosmos-react-core';
|
|
5
5
|
import BareRoleButton from '@pega/cosmos-react-core/lib/components/Button/BareRoleButton';
|
|
6
6
|
import { FeedContext } from './Feed.context';
|
|
7
7
|
import FeedButton from './FeedButton';
|
|
8
8
|
import FeedModalList from './FeedModalList';
|
|
9
|
-
const InlineBareButton = styled(BareRoleButton)
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
const InlineBareButton = styled(BareRoleButton)(({ theme }) => {
|
|
10
|
+
return css `
|
|
11
|
+
position: relative;
|
|
12
|
+
display: inline-block;
|
|
13
|
+
line-height: 1;
|
|
14
|
+
outline: none;
|
|
15
|
+
border-radius: calc(${theme.base['border-radius']} * 9999);
|
|
16
|
+
|
|
17
|
+
&:hover {
|
|
18
|
+
::before {
|
|
19
|
+
content: '';
|
|
20
|
+
position: absolute;
|
|
21
|
+
top: calc(${theme.components.button['border-width']} * -1);
|
|
22
|
+
bottom: calc(${theme.components.button['border-width']} * -1);
|
|
23
|
+
left: calc(${theme.components.button['border-width']} * -1);
|
|
24
|
+
right: calc(${theme.components.button['border-width']} * -1);
|
|
25
|
+
border-radius: inherit;
|
|
26
|
+
background-color: currentColor;
|
|
27
|
+
opacity: 0.15;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&:focus {
|
|
32
|
+
box-shadow: ${theme.components.button['focus-shadow']};
|
|
33
|
+
}
|
|
34
|
+
`;
|
|
35
|
+
});
|
|
12
36
|
InlineBareButton.defaultProps = defaultThemeProp;
|
|
13
|
-
|
|
14
|
-
const { id,
|
|
37
|
+
const FeedLikeButton = forwardRef((props, ref) => {
|
|
38
|
+
const { id, liked, likeCount = 0, likes = [], onLikeClick, onLikeCountInteraction, onLoadMoreLikes, likesLoading } = props;
|
|
15
39
|
const t = useI18n();
|
|
16
40
|
const { locale } = useConfiguration();
|
|
17
41
|
const { create } = useModalManager();
|
|
@@ -22,12 +46,12 @@ export const FeedLikeButton = forwardRef((props, ref) => {
|
|
|
22
46
|
useEffect(() => {
|
|
23
47
|
likesModalRef.current?.update({
|
|
24
48
|
count: likeCount,
|
|
25
|
-
heading:
|
|
49
|
+
heading: t('feed_likes'),
|
|
26
50
|
listItems: likes,
|
|
27
51
|
onLoadMore: onLoadMoreLikes,
|
|
28
52
|
loading: likesLoading
|
|
29
53
|
});
|
|
30
|
-
}, [likeCount,
|
|
54
|
+
}, [likeCount, likes, onLoadMoreLikes, likesLoading]);
|
|
31
55
|
const likesAttributes = useMemo(() => {
|
|
32
56
|
const likesList = likes.map(x => x.primary.toString());
|
|
33
57
|
return {
|
|
@@ -36,10 +60,10 @@ export const FeedLikeButton = forwardRef((props, ref) => {
|
|
|
36
60
|
count: likeCount
|
|
37
61
|
})}`
|
|
38
62
|
: t('feed_post_likes', [likeCount], { count: likeCount }),
|
|
39
|
-
label: formatListToLocaleString(likesList.slice(0, 2), t, locale, {
|
|
63
|
+
label: `${t('feed_liked_by')}:\n${formatListToLocaleString(likesList.slice(0, 2), t, locale, {
|
|
40
64
|
count: likeCount,
|
|
41
65
|
separator: '\n'
|
|
42
|
-
})
|
|
66
|
+
})}`
|
|
43
67
|
};
|
|
44
68
|
}, [likes, likeCount]);
|
|
45
69
|
const onLikeCountClick = () => {
|
|
@@ -56,33 +80,23 @@ export const FeedLikeButton = forwardRef((props, ref) => {
|
|
|
56
80
|
onLikeCountInteraction?.();
|
|
57
81
|
}
|
|
58
82
|
};
|
|
59
|
-
return (_jsxs(Flex, { container: { gap: 0.5, alignItems: 'center' }, children: [
|
|
83
|
+
return (_jsxs(Flex, { container: { gap: 0.5, alignItems: 'center' }, children: [_jsx(Button, { variant: 'simple', icon: true, compact: true, as: FeedButton, onClick: () => {
|
|
60
84
|
const user = {
|
|
61
85
|
id: loggedInUser.username,
|
|
62
86
|
primary: loggedInUser.fullname,
|
|
63
|
-
secondary: loggedInUser.meta
|
|
87
|
+
secondary: loggedInUser.meta,
|
|
64
88
|
visual: (_jsx(Avatar, { size: 'l', imageSrc: loggedInUser.avatarSrc, name: loggedInUser.fullname }))
|
|
65
89
|
};
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
};
|
|
72
|
-
props.onLikeClick(eventObj);
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
eventObj = {
|
|
76
|
-
replyId: id,
|
|
77
|
-
user
|
|
78
|
-
};
|
|
79
|
-
props.onLikeClick(eventObj);
|
|
80
|
-
}
|
|
81
|
-
}, emphasized: liked, "aria-pressed": liked, label: showText ? undefined : likeLabel, "aria-label": showText ? likeLabel : undefined, "aria-describedby": likeCount > 0 ? likeCountId : undefined, ref: ref, children: [_jsx(Icon, { name: liked ? 'thumbs-up-solid' : 'thumbs-up' }), showText && _jsx(Text, { children: likeLabel })] }), likeCount > 0 && (_jsxs(_Fragment, { children: [_jsx(InlineBareButton, { ref: setCountEl, role: likes.length ? 'button' : undefined, onClick: onLikeCountClick, onFocus: onLikeCountInteraction, onMouseOver: onLikeCountInteraction, "aria-label": likesAttributes.ariaLabel, tabIndex: 0, onKeyDown: (e) => {
|
|
90
|
+
onLikeClick({
|
|
91
|
+
id,
|
|
92
|
+
user
|
|
93
|
+
});
|
|
94
|
+
}, emphasized: liked, "aria-pressed": liked, label: t('feed_like_label'), "aria-describedby": likeCount > 0 ? likeCountId : undefined, ref: ref, children: _jsx(Icon, { name: liked ? 'thumbs-up-solid' : 'thumbs-up' }) }), likeCount > 0 && (_jsxs(_Fragment, { children: [_jsx(InlineBareButton, { ref: setCountEl, role: likes.length ? 'button' : undefined, onClick: onLikeCountClick, onFocus: onLikeCountInteraction, onMouseOver: onLikeCountInteraction, "aria-label": likesAttributes.ariaLabel, tabIndex: 0, onKeyDown: (e) => {
|
|
82
95
|
if (e.key === 'Enter') {
|
|
83
96
|
e.preventDefault();
|
|
84
97
|
onLikeCountClick();
|
|
85
98
|
}
|
|
86
99
|
}, children: _jsx(Count, { id: likeCountId, "aria-label": t('feed_post_likes', [likeCount], { count: likeCount }), children: likeCount }) }), _jsx(Tooltip, { target: countEl, showDelay: 'none', hideDelay: 'none', describeTarget: false, children: likesAttributes.label || t('feed_post_likes', [likeCount], { count: likeCount }) })] }))] }));
|
|
87
100
|
});
|
|
101
|
+
export default FeedLikeButton;
|
|
88
102
|
//# sourceMappingURL=FeedLikeButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeedLikeButton.js","sourceRoot":"","sources":["../../../src/components/Feed/FeedLikeButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAM,UAAU,EA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CACR,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["import { FC, forwardRef, Ref, useContext, useMemo, useRef, useEffect, KeyboardEvent } from 'react';\nimport styled from 'styled-components';\n\nimport {\n ForwardProps,\n OmitStrict,\n Button,\n Icon,\n Text,\n Avatar,\n MetaList,\n Count,\n Tooltip,\n ModalMethods,\n useModalManager,\n useI18n,\n useConfiguration,\n useElement,\n formatListToLocaleString,\n Flex,\n defaultThemeProp,\n useUID\n} from '@pega/cosmos-react-core';\nimport BareRoleButton from '@pega/cosmos-react-core/lib/components/Button/BareRoleButton';\n\nimport { FeedPostProps } from './FeedPost.types';\nimport { FeedContext } from './Feed.context';\nimport FeedButton from './FeedButton';\nimport FeedModalList, { FeedModalListProps } from './FeedModalList';\nimport { FeedReplyProps } from './FeedReply.types';\n\nconst InlineBareButton = styled(BareRoleButton)`\n display: inline-block;\n`;\n\nInlineBareButton.defaultProps = defaultThemeProp;\n\ninterface BaseFeedLikeButtonProps\n extends OmitStrict<FeedPostProps['interactionInfo'], 'commentLabel' | 'interactionsEnabled'>,\n Pick<FeedPostProps, 'onLoadMoreLikes' | 'onLikeCountInteraction' | 'id' | 'likesLoading'>,\n Pick<FeedPostProps['info'], 'liked'> {\n showText?: boolean;\n}\n\ninterface PostFeedLikeButtonProps extends BaseFeedLikeButtonProps {\n variant: 'post';\n onLikeClick: FeedPostProps['onLikeClick'];\n}\n\ninterface ReplyFeedLikeButtonProps extends BaseFeedLikeButtonProps {\n variant: 'reply';\n onLikeClick: FeedReplyProps['onLikeClick'];\n}\n\nexport type FeedLikeButtonProps = PostFeedLikeButtonProps | ReplyFeedLikeButtonProps;\n\nexport const FeedLikeButton: FC<FeedLikeButtonProps & ForwardProps> = forwardRef(\n (props, ref: Ref<HTMLButtonElement>) => {\n const {\n id,\n showText,\n onLikeCountInteraction,\n likesLoading,\n onLoadMoreLikes,\n liked,\n likeLabel,\n likeCount = 0,\n likes = []\n } = props;\n const t = useI18n();\n const { locale } = useConfiguration();\n const { create } = useModalManager();\n const { userInfo: loggedInUser } = useContext(FeedContext);\n const [countEl, setCountEl] = useElement(null);\n const likesModalRef = useRef<ModalMethods<FeedModalListProps>>();\n const likeCountId = useUID();\n\n useEffect(() => {\n likesModalRef.current?.update({\n count: likeCount,\n heading: likeLabel,\n listItems: likes,\n onLoadMore: onLoadMoreLikes,\n loading: likesLoading\n });\n }, [likeCount, likeLabel, likes, onLoadMoreLikes, likesLoading]);\n\n const likesAttributes = useMemo(() => {\n const likesList = likes.map(x => x.primary.toString());\n return {\n ariaLabel: likeCount\n ? `${t('feed_liked_by')} ${formatListToLocaleString(likesList.slice(0, 2), t, locale, {\n count: likeCount\n })}`\n : t('feed_post_likes', [likeCount], { count: likeCount }),\n label: formatListToLocaleString(likesList.slice(0, 2), t, locale, {\n count: likeCount,\n separator: '\\n'\n })\n };\n }, [likes, likeCount]);\n\n const onLikeCountClick = () => {\n if (likes.length) {\n likesModalRef.current = create(FeedModalList, {\n count: likeCount,\n heading: t('feed_likes'),\n listItems: likes,\n onLoadMore: onLoadMoreLikes,\n loading: likesLoading\n });\n } else {\n onLikeCountInteraction?.();\n }\n };\n\n return (\n <Flex container={{ gap: 0.5, alignItems: 'center' }}>\n <Button\n variant='text'\n as={FeedButton}\n onClick={() => {\n const user = {\n id: loggedInUser.username,\n primary: loggedInUser.fullname,\n secondary: loggedInUser.meta ? <MetaList items={loggedInUser.meta} /> : undefined,\n visual: (\n <Avatar size='l' imageSrc={loggedInUser.avatarSrc} name={loggedInUser.fullname} />\n )\n };\n let eventObj;\n if (props.variant === 'post') {\n eventObj = {\n postId: id,\n user\n } as const;\n props.onLikeClick(eventObj);\n } else {\n eventObj = {\n replyId: id,\n user\n } as const;\n props.onLikeClick(eventObj);\n }\n }}\n emphasized={liked}\n aria-pressed={liked}\n label={showText ? undefined : likeLabel}\n aria-label={showText ? likeLabel : undefined}\n aria-describedby={likeCount > 0 ? likeCountId : undefined}\n ref={ref}\n >\n <Icon name={liked ? 'thumbs-up-solid' : 'thumbs-up'} />\n {showText && <Text>{likeLabel}</Text>}\n </Button>\n {likeCount > 0 && (\n <>\n <InlineBareButton\n ref={setCountEl}\n role={likes.length ? 'button' : undefined}\n onClick={onLikeCountClick}\n onFocus={onLikeCountInteraction}\n onMouseOver={onLikeCountInteraction}\n aria-label={likesAttributes.ariaLabel}\n tabIndex={0}\n onKeyDown={(e: KeyboardEvent) => {\n if (e.key === 'Enter') {\n e.preventDefault();\n onLikeCountClick();\n }\n }}\n >\n <Count\n id={likeCountId}\n aria-label={t('feed_post_likes', [likeCount], { count: likeCount })}\n >\n {likeCount}\n </Count>\n </InlineBareButton>\n <Tooltip target={countEl} showDelay='none' hideDelay='none' describeTarget={false}>\n {likesAttributes.label || t('feed_post_likes', [likeCount], { count: likeCount })}\n </Tooltip>\n </>\n )}\n </Flex>\n );\n }\n);\n"]}
|
|
1
|
+
{"version":3,"file":"FeedLikeButton.js","sourceRoot":"","sources":["../../../src/components/Feed/FeedLikeButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAM,UAAU,EAAO,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAiB,MAAM,OAAO,CAAC;AACnG,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAEL,MAAM,EACN,IAAI,EACJ,MAAM,EACN,KAAK,EACL,OAAO,EAEP,eAAe,EACf,OAAO,EACP,gBAAgB,EAChB,UAAU,EACV,wBAAwB,EACxB,IAAI,EACJ,gBAAgB,EAChB,MAAM,EACP,MAAM,yBAAyB,CAAC;AACjC,OAAO,cAAc,MAAM,8DAA8D,CAAC;AAE1F,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAG5C,MAAM,gBAAgB,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAA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Q,EAAE,CAAC,EACX,SAAS,EAAE,CAAC,CAAgB,EAAE,EAAE;4BAC9B,IAAI,CAAC,CAAC,GAAG,KAAK,OAAO,EAAE;gCACrB,CAAC,CAAC,cAAc,EAAE,CAAC;gCACnB,gBAAgB,EAAE,CAAC;6BACpB;wBACH,CAAC,YAED,KAAC,KAAK,IACJ,EAAE,EAAE,WAAW,gBACH,CAAC,CAAC,iBAAiB,EAAE,CAAC,SAAS,CAAC,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,YAElE,SAAS,GACJ,GACS,EACnB,KAAC,OAAO,IAAC,MAAM,EAAE,OAAO,EAAE,SAAS,EAAC,MAAM,EAAC,SAAS,EAAC,MAAM,EAAC,cAAc,EAAE,KAAK,YAC9E,eAAe,CAAC,KAAK,IAAI,CAAC,CAAC,iBAAiB,EAAE,CAAC,SAAS,CAAC,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,GACzE,IACT,CACJ,IACI,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import { FC, forwardRef, Ref, useContext, useMemo, useRef, useEffect, KeyboardEvent } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n ForwardProps,\n Button,\n Icon,\n Avatar,\n Count,\n Tooltip,\n ModalMethods,\n useModalManager,\n useI18n,\n useConfiguration,\n useElement,\n formatListToLocaleString,\n Flex,\n defaultThemeProp,\n useUID\n} from '@pega/cosmos-react-core';\nimport BareRoleButton from '@pega/cosmos-react-core/lib/components/Button/BareRoleButton';\n\nimport { FeedContext } from './Feed.context';\nimport FeedButton from './FeedButton';\nimport FeedModalList from './FeedModalList';\nimport { FeedMessageBaseProps, FeedModalListProps } from './Feed.types';\n\nconst InlineBareButton = styled(BareRoleButton)(({ theme }) => {\n return css`\n position: relative;\n display: inline-block;\n line-height: 1;\n outline: none;\n border-radius: calc(${theme.base['border-radius']} * 9999);\n\n &:hover {\n ::before {\n content: '';\n position: absolute;\n top: calc(${theme.components.button['border-width']} * -1);\n bottom: calc(${theme.components.button['border-width']} * -1);\n left: calc(${theme.components.button['border-width']} * -1);\n right: calc(${theme.components.button['border-width']} * -1);\n border-radius: inherit;\n background-color: currentColor;\n opacity: 0.15;\n }\n }\n\n &:focus {\n box-shadow: ${theme.components.button['focus-shadow']};\n }\n `;\n});\n\nInlineBareButton.defaultProps = defaultThemeProp;\n\ntype FeedLikeButtonProps = Pick<\n FeedMessageBaseProps,\n | 'id'\n | 'liked'\n | 'likeCount'\n | 'likes'\n | 'onLikeClick'\n | 'onLikeCountInteraction'\n | 'onLoadMoreLikes'\n | 'likesLoading'\n>;\n\nconst FeedLikeButton: FC<FeedLikeButtonProps & ForwardProps> = forwardRef(\n (props, ref: Ref<HTMLButtonElement>) => {\n const {\n id,\n liked,\n likeCount = 0,\n likes = [],\n onLikeClick,\n onLikeCountInteraction,\n onLoadMoreLikes,\n likesLoading\n } = props;\n const t = useI18n();\n const { locale } = useConfiguration();\n const { create } = useModalManager();\n const { userInfo: loggedInUser } = useContext(FeedContext);\n const [countEl, setCountEl] = useElement(null);\n const likesModalRef = useRef<ModalMethods<FeedModalListProps>>();\n const likeCountId = useUID();\n\n useEffect(() => {\n likesModalRef.current?.update({\n count: likeCount,\n heading: t('feed_likes'),\n listItems: likes,\n onLoadMore: onLoadMoreLikes,\n loading: likesLoading\n });\n }, [likeCount, likes, onLoadMoreLikes, likesLoading]);\n\n const likesAttributes = useMemo(() => {\n const likesList = likes.map(x => x.primary.toString());\n return {\n ariaLabel: likeCount\n ? `${t('feed_liked_by')} ${formatListToLocaleString(likesList.slice(0, 2), t, locale, {\n count: likeCount\n })}`\n : t('feed_post_likes', [likeCount], { count: likeCount }),\n label: `${t('feed_liked_by')}:\\n${formatListToLocaleString(\n likesList.slice(0, 2),\n t,\n locale,\n {\n count: likeCount,\n separator: '\\n'\n }\n )}`\n };\n }, [likes, likeCount]);\n\n const onLikeCountClick = () => {\n if (likes.length) {\n likesModalRef.current = create(FeedModalList, {\n count: likeCount,\n heading: t('feed_likes'),\n listItems: likes,\n onLoadMore: onLoadMoreLikes,\n loading: likesLoading\n });\n } else {\n onLikeCountInteraction?.();\n }\n };\n\n return (\n <Flex container={{ gap: 0.5, alignItems: 'center' }}>\n <Button\n variant='simple'\n icon\n compact\n as={FeedButton}\n onClick={() => {\n const user = {\n id: loggedInUser.username,\n primary: loggedInUser.fullname,\n secondary: loggedInUser.meta,\n visual: (\n <Avatar size='l' imageSrc={loggedInUser.avatarSrc} name={loggedInUser.fullname} />\n )\n };\n onLikeClick({\n id,\n user\n });\n }}\n emphasized={liked}\n aria-pressed={liked}\n label={t('feed_like_label')}\n aria-describedby={likeCount > 0 ? likeCountId : undefined}\n ref={ref}\n >\n <Icon name={liked ? 'thumbs-up-solid' : 'thumbs-up'} />\n </Button>\n {likeCount > 0 && (\n <>\n <InlineBareButton\n ref={setCountEl}\n role={likes.length ? 'button' : undefined}\n onClick={onLikeCountClick}\n onFocus={onLikeCountInteraction}\n onMouseOver={onLikeCountInteraction}\n aria-label={likesAttributes.ariaLabel}\n tabIndex={0}\n onKeyDown={(e: KeyboardEvent) => {\n if (e.key === 'Enter') {\n e.preventDefault();\n onLikeCountClick();\n }\n }}\n >\n <Count\n id={likeCountId}\n aria-label={t('feed_post_likes', [likeCount], { count: likeCount })}\n >\n {likeCount}\n </Count>\n </InlineBareButton>\n <Tooltip target={countEl} showDelay='none' hideDelay='none' describeTarget={false}>\n {likesAttributes.label || t('feed_post_likes', [likeCount], { count: likeCount })}\n </Tooltip>\n </>\n )}\n </Flex>\n );\n }\n);\n\nexport default FeedLikeButton;\n"]}
|
|
@@ -1,17 +1,5 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
export interface FeedModalListProps {
|
|
4
|
-
/** The count for the list of items. */
|
|
5
|
-
count: number;
|
|
6
|
-
/** The heading for the Modal. */
|
|
7
|
-
heading: string;
|
|
8
|
-
/** The list of MenuItems to render in the Modal. */
|
|
9
|
-
listItems: SummaryListItem[];
|
|
10
|
-
/** A callback that is triggered when the bottom of the Modal list is scrolled into view so that additional data may be displayed. */
|
|
11
|
-
onLoadMore?: () => void;
|
|
12
|
-
/** Indicates if the data is being currently loading */
|
|
13
|
-
loading?: boolean;
|
|
14
|
-
}
|
|
2
|
+
import { FeedModalListProps } from './Feed.types';
|
|
15
3
|
declare const FeedModalList: FC<FeedModalListProps>;
|
|
16
4
|
export default FeedModalList;
|
|
17
5
|
//# sourceMappingURL=FeedModalList.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeedModalList.d.ts","sourceRoot":"","sources":["../../../src/components/Feed/FeedModalList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAA+B,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"FeedModalList.d.ts","sourceRoot":"","sources":["../../../src/components/Feed/FeedModalList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAA+B,MAAM,OAAO,CAAC;AAiBxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAYlD,QAAA,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CA2DzC,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useRef, useEffect, useState } from 'react';
|
|
3
3
|
import styled, { css } from 'styled-components';
|
|
4
|
-
import { defaultThemeProp, Flex, Progress, Count, Modal, SummaryListItems, useItemIntersection, usePrevious, useI18n } from '@pega/cosmos-react-core';
|
|
4
|
+
import { defaultThemeProp, Flex, Progress, Count, Modal, SummaryListItems, useItemIntersection, usePrevious, useI18n, MetaList } from '@pega/cosmos-react-core';
|
|
5
5
|
import FeedAnnouncer from './FeedAnnouncer';
|
|
6
6
|
const StyledLoadMore = styled.div(({ theme }) => {
|
|
7
7
|
return css `
|
|
@@ -30,7 +30,10 @@ const FeedModalList = ({ loading, count, heading, listItems, onLoadMore }) => {
|
|
|
30
30
|
useItemIntersection(listRef, listItems.length - 1, () => {
|
|
31
31
|
onLoadMore?.();
|
|
32
32
|
}, ':scope li');
|
|
33
|
-
return (_jsxs(Modal, { heading: _jsxs(Flex, { container: { gap: 1 }, children: [heading, _jsx(Flex, { item: { alignSelf: 'center' }, as: Count, children: count })] }), ref: listRef, children: [_jsx(FeedAnnouncer, { children: announcementText }), _jsx(SummaryListItems, { items: listItems
|
|
33
|
+
return (_jsxs(Modal, { heading: _jsxs(Flex, { container: { gap: 1 }, children: [heading, _jsx(Flex, { item: { alignSelf: 'center' }, as: Count, children: count })] }), ref: listRef, children: [_jsx(FeedAnnouncer, { children: announcementText }), _jsx(SummaryListItems, { items: listItems.map(item => ({
|
|
34
|
+
...item,
|
|
35
|
+
secondary: item.secondary && _jsx(MetaList, { items: item.secondary })
|
|
36
|
+
})) }), loading && (_jsx(Flex, { container: { justify: 'center' }, as: StyledLoadMore, children: _jsx(Progress, { placement: 'inline' }) }))] }));
|
|
34
37
|
};
|
|
35
38
|
export default FeedModalList;
|
|
36
39
|
//# sourceMappingURL=FeedModalList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeedModalList.js","sourceRoot":"","sources":["../../../src/components/Feed/FeedModalList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAM,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxD,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,
|
|
1
|
+
{"version":3,"file":"FeedModalList.js","sourceRoot":"","sources":["../../../src/components/Feed/FeedModalList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAM,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxD,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CA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,SAAS,CAAC,CAAC,CAAC;IAEhB,mBAAmB,CACjB,OAAO,EACP,SAAS,CAAC,MAAM,GAAG,CAAC,EACpB,GAAG,EAAE;QACH,UAAU,EAAE,EAAE,CAAC;IACjB,CAAC,EACD,WAAW,CACZ,CAAC;IAEF,OAAO,CACL,MAAC,KAAK,IACJ,OAAO,EACL,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,aACxB,OAAO,EACR,KAAC,IAAI,IAAC,IAAI,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,KAAK,YAC3C,KAAK,GACD,IACF,EAET,GAAG,EAAE,OAAO,aAEZ,KAAC,aAAa,cAAE,gBAAgB,GAAiB,EACjD,KAAC,gBAAgB,IACf,KAAK,EAAE,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;oBAC5B,GAAG,IAAI;oBACP,SAAS,EAAE,IAAI,CAAC,SAAS,IAAI,KAAC,QAAQ,IAAC,KAAK,EAAE,IAAI,CAAC,SAAS,GAAI;iBACjE,CAAC,CAAC,GACH,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,IACK,CACT,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import { FC, useRef, useEffect, useState } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n defaultThemeProp,\n Flex,\n Progress,\n Count,\n Modal,\n SummaryListItems,\n useItemIntersection,\n usePrevious,\n useI18n,\n MetaList\n} from '@pega/cosmos-react-core';\n\nimport FeedAnnouncer from './FeedAnnouncer';\nimport { FeedModalListProps } from './Feed.types';\n\nconst StyledLoadMore = styled.div(({ theme }) => {\n return css`\n margin-top: ${theme.base.spacing};\n min-height: 2rem;\n min-width: 2rem;\n `;\n});\n\nStyledLoadMore.defaultProps = defaultThemeProp;\n\nconst FeedModalList: FC<FeedModalListProps> = ({\n loading,\n count,\n heading,\n listItems,\n onLoadMore\n}: FeedModalListProps) => {\n const t = useI18n();\n const listRef = useRef(null);\n const prevItems = usePrevious(listItems);\n const [announcementText, setAnnouncementText] = useState('');\n\n useEffect(() => {\n if (loading) setAnnouncementText(t('loading'));\n }, [loading]);\n\n useEffect(() => {\n if (prevItems) {\n const difference = listItems.length - prevItems.length;\n if (difference > 0)\n setAnnouncementText(t('new_item_added', [difference], { count: difference }));\n }\n }, [listItems]);\n\n useItemIntersection(\n listRef,\n listItems.length - 1,\n () => {\n onLoadMore?.();\n },\n ':scope li'\n );\n\n return (\n <Modal\n heading={\n <Flex container={{ gap: 1 }}>\n {heading}\n <Flex item={{ alignSelf: 'center' }} as={Count}>\n {count}\n </Flex>\n </Flex>\n }\n ref={listRef}\n >\n <FeedAnnouncer>{announcementText}</FeedAnnouncer>\n <SummaryListItems\n items={listItems.map(item => ({\n ...item,\n secondary: item.secondary && <MetaList items={item.secondary} />\n }))}\n />\n {loading && (\n <Flex container={{ justify: 'center' }} as={StyledLoadMore}>\n <Progress placement='inline' />\n </Flex>\n )}\n </Modal>\n );\n};\n\nexport default FeedModalList;\n"]}
|
|
@@ -1,35 +1,6 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { ForwardProps } from '@pega/cosmos-react-core';
|
|
3
|
-
import {
|
|
4
|
-
import { AttachedFiles } from './FeedAttachments';
|
|
5
|
-
export interface FeedNewPostProps {
|
|
6
|
-
/** A unique ID for the NewPost */
|
|
7
|
-
id: string;
|
|
8
|
-
/** A set of attachment files. */
|
|
9
|
-
attachments?: AttachedFiles[];
|
|
10
|
-
/** Information that is used to label buttons and inputs for accessibility purposes */
|
|
11
|
-
interactionInfo: {
|
|
12
|
-
textAreaPlaceholder: string;
|
|
13
|
-
postLabel: string;
|
|
14
|
-
};
|
|
15
|
-
/** A callback containing a list of added files that will run whenever files are added to the post. */
|
|
16
|
-
onFilesAdded?: (files: AttachedFiles[]) => void;
|
|
17
|
-
/** A callback that will run when the new post button has been clicked */
|
|
18
|
-
onPost: (event: {
|
|
19
|
-
newPostId: string;
|
|
20
|
-
value: string;
|
|
21
|
-
attachments: AttachedFiles[];
|
|
22
|
-
recipients: RecipientMenuItem[];
|
|
23
|
-
username: string;
|
|
24
|
-
clear: () => void;
|
|
25
|
-
}) => void;
|
|
26
|
-
autoFocus?: boolean;
|
|
27
|
-
/** Array of private recipient options */
|
|
28
|
-
recipients?: PostTypeMenuProps['recipients'];
|
|
29
|
-
/** Handler for new search on private recipient options */
|
|
30
|
-
onRecipientSearch?: (newSearch: string) => void;
|
|
31
|
-
}
|
|
32
|
-
export declare const StyledTextAreaContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
3
|
+
import { FeedNewPostProps } from './Feed.types';
|
|
33
4
|
export declare const StyledFeedNewPost: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
34
5
|
declare const FeedNewPost: FC<ForwardProps & FeedNewPostProps>;
|
|
35
6
|
export default FeedNewPost;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeedNewPost.d.ts","sourceRoot":"","sources":["../../../src/components/Feed/FeedNewPost.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"FeedNewPost.d.ts","sourceRoot":"","sources":["../../../src/components/Feed/FeedNewPost.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAoB,MAAM,OAAO,CAAC;AAG7C,OAAO,EAIL,YAAY,EAEb,MAAM,yBAAyB,CAAC;AAMjC,OAAO,EAAE,gBAAgB,EAAkD,MAAM,cAAc,CAAC;AAKhG,eAAO,MAAM,iBAAiB,yGAAe,CAAC;AAI9C,QAAA,MAAM,WAAW,EAAE,EAAE,CAAC,YAAY,GAAG,gBAAgB,CAgDpD,CAAC;AAEF,eAAe,WAAW,CAAC"}
|