@pega/cosmos-react-social 7.8.0 → 7.9.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.
@@ -1 +1 @@
1
- {"version":3,"file":"FeedContentHeader.d.ts","sourceRoot":"","sources":["../../../src/components/Feed/FeedContentHeader.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAc,MAAM,OAAO,CAAC;AAgC5C,OAAO,KAAK,EAAE,sBAAsB,EAAsB,MAAM,cAAc,CAAC;AAsB/E,QAAA,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,CA+MjD,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"FeedContentHeader.d.ts","sourceRoot":"","sources":["../../../src/components/Feed/FeedContentHeader.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAc,MAAM,OAAO,CAAC;AA+B5C,OAAO,KAAK,EAAE,sBAAsB,EAAsB,MAAM,cAAc,CAAC;AAsB/E,QAAA,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,CAmMjD,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
@@ -2,7 +2,6 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
2
2
  import { useContext, useEffect, useRef } from 'react';
3
3
  import styled, { css } from 'styled-components';
4
4
  import { Avatar, Button, DateTimeDisplay, defaultThemeProp, Flex, Icon, MenuButton, MetaList, StyledSecondary, SummaryItem, Text, Tooltip, useConfiguration, useElement, useI18n, useModalManager } from '@pega/cosmos-react-core';
5
- import BareButton from '@pega/cosmos-react-core/lib/components/Button/BareButton';
6
5
  import { parseToDate } from '@pega/cosmos-react-core/lib/components/DateTime/Input/utils';
7
6
  import { formatDateTime } from '@pega/cosmos-react-core/lib/components/DateTime/utils';
8
7
  import { formatListToLocaleString } from '@pega/cosmos-react-core/lib/utils';
@@ -68,9 +67,7 @@ const FeedContentHeader = (props) => {
68
67
  });
69
68
  }
70
69
  }, [recipientsCount, recipients, onLoadMoreRecipients, recipientsLoading]);
71
- return (_jsx(SummaryItem, { as: StyledFeedContentHeader, visual: onUserClick ? (_jsx(BareButton, { onClick: (event) => {
72
- onUserClick?.({ id, username }, event);
73
- }, children: userVisual })) : (userVisual), primary: _jsxs("div", { children: [onUserClick ? (_jsx(Button, { variant: 'text', onClick: (event) => {
70
+ return (_jsx(SummaryItem, { as: StyledFeedContentHeader, visual: userVisual, primary: _jsxs("div", { children: [onUserClick ? (_jsx(Button, { variant: 'text', onClick: (event) => {
74
71
  onUserClick?.({ id, username }, event);
75
72
  }, children: _jsx(Text, { variant: 'h3', children: autopilotAuthor ? autopilotLabel : fullname }) })) : (_jsx(StyledName, { variant: 'h3', children: autopilotAuthor ? autopilotLabel : fullname })), postContext && _jsxs(Text, { variant: 'primary', children: [" ", t('feed_context', [postContext])] })] }), secondary: _jsxs(Flex, { container: { gap: 0.5, alignItems: 'center' }, children: [postType === 'private' && (_jsx(Button, { variant: 'simple', as: FeedButton, icon: true, compact: true, onClick: recipients.length
76
73
  ? () => {
@@ -1 +1 @@
1
- {"version":3,"file":"FeedContentHeader.js","sourceRoot":"","sources":["../../../src/components/Feed/FeedContentHeader.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEtD,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,MAAM,EACN,MAAM,EACN,eAAe,EACf,gBAAgB,EAChB,IAAI,EACJ,IAAI,EACJ,UAAU,EACV,QAAQ,EACR,eAAe,EACf,WAAW,EACX,IAAI,EACJ,OAAO,EACP,gBAAgB,EAChB,UAAU,EACV,OAAO,EACP,eAAe,EAChB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,UAAU,MAAM,0DAA0D,CAAC;AAClF,OAAO,EAAE,WAAW,EAAE,MAAM,6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AClB,IAAI,wBAAwB,CAAC,cAAc,EAAE,CAAC,EAAE,MAAM,EAAE;wBACvD,KAAK,EAAE,eAAe;qBACvB,CAAC,EAAE,EACJ,KAAK,EAAE,GAAG,CAAC,CAAC,mBAAmB,CAAC,MAC9B,wBAAwB,CAAC,cAAc,EAAE,CAAC,EAAE,MAAM,EAAE;wBAClD,KAAK,EAAE,eAAe;wBACtB,SAAS,EAAE,IAAI;qBAChB,CAAC,IAAI,CAAC,CAAC,mBAAmB,CAC7B,EAAE,YAEF,KAAC,IAAI,IAAC,IAAI,EAAC,mBAAmB,GAAG,GAC1B,CACV,EACD,KAAC,QAAQ,IAAC,KAAK,EAAE,UAAU,GAAI,IAC1B,EAET,OAAO,EACL,SAAS,CAAC,CAAC,CAAC,CACV,KAAC,UAAU,IACT,IAAI,EAAE,CAAC,CAAC,SAAS,CAAC,gBACN,CAAC,CAAC,aAAa,EAAE,CAAC,QAAQ,CAAC,CAAC,EACxC,IAAI,EAAE;gBACJ,KAAK,EACH,YAAY,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,QAAQ,KAAK,YAAY,CAAC,QAAQ;oBAC/E,CAAC,CAAC;wBACE;4BACE,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC;4BAClB,EAAE,EAAE,MAAM;4BACV,OAAO,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC;4BAChC,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAC;yBAChD;wBACD,GAAG,SAAS;qBACb;oBACH,CAAC,CAAC,SAAS;aAChB,EACD,IAAI,EAAC,MAAM,EACX,QAAQ,QACR,OAAO,EAAC,QAAQ,GAChB,CACH,CAAC,CAAC,CAAC,SAAS,GAEf,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,iBAAiB,CAAC","sourcesContent":["import { useContext, useEffect, useRef } from 'react';\nimport type { FC, MouseEvent } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Avatar,\n Button,\n DateTimeDisplay,\n defaultThemeProp,\n Flex,\n Icon,\n MenuButton,\n MetaList,\n StyledSecondary,\n SummaryItem,\n Text,\n Tooltip,\n useConfiguration,\n useElement,\n useI18n,\n useModalManager\n} from '@pega/cosmos-react-core';\nimport type { ModalMethods } from '@pega/cosmos-react-core';\nimport BareButton from '@pega/cosmos-react-core/lib/components/Button/BareButton';\nimport { parseToDate } from '@pega/cosmos-react-core/lib/components/DateTime/Input/utils';\nimport { formatDateTime } from '@pega/cosmos-react-core/lib/components/DateTime/utils';\nimport { formatListToLocaleString } from '@pega/cosmos-react-core/lib/utils';\n\nimport AutopilotAvatar from '../Autopilot/AutopilotAvatar';\n\nimport { FeedContext } from './Feed.context';\nimport FeedModalList from './FeedModalList';\nimport FeedButton from './FeedButton';\nimport type { FeedContentHeaderProps, FeedModalListProps } from './Feed.types';\n\nconst StyledFeedContentHeader = styled.div(({ theme }) => {\n return css`\n margin-block-end: ${theme.base.spacing};\n column-gap: ${theme.base.spacing};\n\n ${StyledSecondary} {\n ${FeedButton} {\n /* Negative margin needed to align the icon with the author name on the line above. */\n margin-inline-start: calc(-0.75 * ${theme.base.spacing});\n }\n }\n `;\n});\n\nStyledFeedContentHeader.defaultProps = defaultThemeProp;\n\nconst StyledName = styled(Text)`\n display: inline-block;\n`;\n\nconst FeedContentHeader: FC<FeedContentHeaderProps> = (props: FeedContentHeaderProps) => {\n const {\n variant,\n id,\n fullname,\n username,\n postTimestamp,\n content,\n avatarSrc,\n icon,\n userStatus,\n postType,\n postContext,\n recipients = [],\n recipientsCount = 0,\n menuItems,\n edited,\n editTimestamp,\n recipientsLoading,\n onEditSubmit,\n onLoadMoreRecipients,\n onRecipientInteraction,\n onUserClick,\n setEditMode\n } = props;\n\n const {\n autopilotInfo: { id: autopilotId, label: autopilotLabel },\n userInfo: loggedInUser\n } = useContext(FeedContext);\n const t = useI18n();\n const { locale } = useConfiguration();\n const { create } = useModalManager();\n\n const recipientsModalRef = useRef<ModalMethods<FeedModalListProps>>();\n const [postTimestampEl, setPostTimestampEl] = useElement<HTMLSpanElement>();\n const [editTimestampEl, setEditTimestampEl] = useElement<HTMLSpanElement>();\n\n const autopilotAuthor = username === autopilotId;\n\n const timestamps = [\n <>\n <DateTimeDisplay ref={setPostTimestampEl} value={postTimestamp} variant='relative' />\n {postTimestamp && (\n <Tooltip target={postTimestampEl}>\n {formatDateTime(parseToDate(postTimestamp), {\n t,\n locale,\n format: 'medium',\n variant: 'datetime',\n timeZone: loggedInUser.timeZone\n })}\n </Tooltip>\n )}\n </>\n ];\n\n if (edited) {\n timestamps.push(\n <>\n <Text ref={setEditTimestampEl} variant='secondary'>\n {t('edited', [<DateTimeDisplay value={editTimestamp} variant='relative' />])}\n </Text>\n {editTimestamp && (\n <Tooltip target={editTimestampEl}>\n {formatDateTime(parseToDate(editTimestamp), {\n t,\n locale,\n format: 'medium',\n variant: 'datetime',\n timeZone: loggedInUser.timeZone\n })}\n </Tooltip>\n )}\n </>\n );\n }\n\n const userVisual = autopilotAuthor ? (\n <AutopilotAvatar />\n ) : (\n <Avatar\n name={fullname}\n size={variant === 'post' ? 'l' : 'm'}\n imageSrc={avatarSrc}\n icon={icon}\n status={userStatus}\n />\n );\n\n const recipientsList = recipients.map(x => x.primary);\n\n useEffect(() => {\n if (recipients.length) {\n recipientsModalRef.current?.update({\n count: recipientsCount,\n heading: t('feed_recipients'),\n listItems: recipients,\n onLoadMore: onLoadMoreRecipients,\n loading: recipientsLoading\n });\n }\n }, [recipientsCount, recipients, onLoadMoreRecipients, recipientsLoading]);\n\n return (\n <SummaryItem\n as={StyledFeedContentHeader}\n visual={\n onUserClick ? (\n <BareButton\n onClick={(event: MouseEvent) => {\n onUserClick?.({ 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?.({ id, username }, event);\n }}\n >\n <Text variant='h3'>{autopilotAuthor ? autopilotLabel : fullname}</Text>\n </Button>\n ) : (\n <StyledName variant='h3'>{autopilotAuthor ? autopilotLabel : fullname}</StyledName>\n )}\n {postContext && <Text variant='primary'> {t('feed_context', [postContext])}</Text>}\n </div>\n }\n secondary={\n <Flex container={{ gap: 0.5, alignItems: 'center' }}>\n {postType === 'private' && (\n <Button\n variant='simple'\n as={FeedButton}\n icon\n compact\n onClick={\n recipients.length\n ? () => {\n if (recipientsCount > 3) {\n recipientsModalRef.current = create(FeedModalList, {\n count: recipientsCount,\n heading: t('feed_recipients'),\n listItems: recipients,\n onLoadMore: onLoadMoreRecipients,\n loading: recipientsLoading\n });\n }\n }\n : onRecipientInteraction\n }\n onFocus={onRecipientInteraction}\n onMouseOver={onRecipientInteraction}\n aria-label={`${t('feed_private_post')} ${t(\n 'feed_recipients'\n )} ${formatListToLocaleString(recipientsList, t, locale, {\n count: recipientsCount\n })}`}\n label={`${t('feed_private_post')}:\\n${\n formatListToLocaleString(recipientsList, t, locale, {\n count: recipientsCount,\n separator: '\\n'\n }) || t('feed_private_post')\n }`}\n >\n <Icon name='lock-closed-solid' />\n </Button>\n )}\n <MetaList items={timestamps} />\n </Flex>\n }\n actions={\n menuItems ? (\n <MenuButton\n text={t('actions')}\n aria-label={t('actions_for', [fullname])}\n menu={{\n items:\n onEditSubmit && typeof content === 'string' && username === loggedInUser.username\n ? [\n {\n primary: t('edit'),\n id: 'edit',\n onClick: () => setEditMode(true),\n disabled: content.includes('<pega-autopilot/>')\n },\n ...menuItems\n ]\n : menuItems\n }}\n icon='more'\n iconOnly\n variant='simple'\n />\n ) : undefined\n }\n />\n );\n};\n\nexport default FeedContentHeader;\n"]}
1
+ {"version":3,"file":"FeedContentHeader.js","sourceRoot":"","sources":["../../../src/components/Feed/FeedContentHeader.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEtD,OAAO,MAAM,EAAE,EAAE,GAAG,EA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FC, MouseEvent } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Avatar,\n Button,\n DateTimeDisplay,\n defaultThemeProp,\n Flex,\n Icon,\n MenuButton,\n MetaList,\n StyledSecondary,\n SummaryItem,\n Text,\n Tooltip,\n useConfiguration,\n useElement,\n useI18n,\n useModalManager\n} from '@pega/cosmos-react-core';\nimport type { ModalMethods } from '@pega/cosmos-react-core';\nimport { parseToDate } from '@pega/cosmos-react-core/lib/components/DateTime/Input/utils';\nimport { formatDateTime } from '@pega/cosmos-react-core/lib/components/DateTime/utils';\nimport { formatListToLocaleString } from '@pega/cosmos-react-core/lib/utils';\n\nimport AutopilotAvatar from '../Autopilot/AutopilotAvatar';\n\nimport { FeedContext } from './Feed.context';\nimport FeedModalList from './FeedModalList';\nimport FeedButton from './FeedButton';\nimport type { FeedContentHeaderProps, FeedModalListProps } from './Feed.types';\n\nconst StyledFeedContentHeader = styled.div(({ theme }) => {\n return css`\n margin-block-end: ${theme.base.spacing};\n column-gap: ${theme.base.spacing};\n\n ${StyledSecondary} {\n ${FeedButton} {\n /* Negative margin needed to align the icon with the author name on the line above. */\n margin-inline-start: calc(-0.75 * ${theme.base.spacing});\n }\n }\n `;\n});\n\nStyledFeedContentHeader.defaultProps = defaultThemeProp;\n\nconst StyledName = styled(Text)`\n display: inline-block;\n`;\n\nconst FeedContentHeader: FC<FeedContentHeaderProps> = (props: FeedContentHeaderProps) => {\n const {\n variant,\n id,\n fullname,\n username,\n postTimestamp,\n content,\n avatarSrc,\n icon,\n userStatus,\n postType,\n postContext,\n recipients = [],\n recipientsCount = 0,\n menuItems,\n edited,\n editTimestamp,\n recipientsLoading,\n onEditSubmit,\n onLoadMoreRecipients,\n onRecipientInteraction,\n onUserClick,\n setEditMode\n } = props;\n\n const {\n autopilotInfo: { id: autopilotId, label: autopilotLabel },\n userInfo: loggedInUser\n } = useContext(FeedContext);\n const t = useI18n();\n const { locale } = useConfiguration();\n const { create } = useModalManager();\n\n const recipientsModalRef = useRef<ModalMethods<FeedModalListProps>>();\n const [postTimestampEl, setPostTimestampEl] = useElement<HTMLSpanElement>();\n const [editTimestampEl, setEditTimestampEl] = useElement<HTMLSpanElement>();\n\n const autopilotAuthor = username === autopilotId;\n\n const timestamps = [\n <>\n <DateTimeDisplay ref={setPostTimestampEl} value={postTimestamp} variant='relative' />\n {postTimestamp && (\n <Tooltip target={postTimestampEl}>\n {formatDateTime(parseToDate(postTimestamp), {\n t,\n locale,\n format: 'medium',\n variant: 'datetime',\n timeZone: loggedInUser.timeZone\n })}\n </Tooltip>\n )}\n </>\n ];\n\n if (edited) {\n timestamps.push(\n <>\n <Text ref={setEditTimestampEl} variant='secondary'>\n {t('edited', [<DateTimeDisplay value={editTimestamp} variant='relative' />])}\n </Text>\n {editTimestamp && (\n <Tooltip target={editTimestampEl}>\n {formatDateTime(parseToDate(editTimestamp), {\n t,\n locale,\n format: 'medium',\n variant: 'datetime',\n timeZone: loggedInUser.timeZone\n })}\n </Tooltip>\n )}\n </>\n );\n }\n\n const userVisual = autopilotAuthor ? (\n <AutopilotAvatar />\n ) : (\n <Avatar\n name={fullname}\n size={variant === 'post' ? 'l' : 'm'}\n imageSrc={avatarSrc}\n icon={icon}\n status={userStatus}\n />\n );\n\n const recipientsList = recipients.map(x => x.primary);\n\n useEffect(() => {\n if (recipients.length) {\n recipientsModalRef.current?.update({\n count: recipientsCount,\n heading: t('feed_recipients'),\n listItems: recipients,\n onLoadMore: onLoadMoreRecipients,\n loading: recipientsLoading\n });\n }\n }, [recipientsCount, recipients, onLoadMoreRecipients, recipientsLoading]);\n\n return (\n <SummaryItem\n as={StyledFeedContentHeader}\n visual={userVisual}\n primary={\n <div>\n {onUserClick ? (\n <Button\n variant='text'\n onClick={(event: MouseEvent) => {\n onUserClick?.({ id, username }, event);\n }}\n >\n <Text variant='h3'>{autopilotAuthor ? autopilotLabel : fullname}</Text>\n </Button>\n ) : (\n <StyledName variant='h3'>{autopilotAuthor ? autopilotLabel : fullname}</StyledName>\n )}\n {postContext && <Text variant='primary'> {t('feed_context', [postContext])}</Text>}\n </div>\n }\n secondary={\n <Flex container={{ gap: 0.5, alignItems: 'center' }}>\n {postType === 'private' && (\n <Button\n variant='simple'\n as={FeedButton}\n icon\n compact\n onClick={\n recipients.length\n ? () => {\n if (recipientsCount > 3) {\n recipientsModalRef.current = create(FeedModalList, {\n count: recipientsCount,\n heading: t('feed_recipients'),\n listItems: recipients,\n onLoadMore: onLoadMoreRecipients,\n loading: recipientsLoading\n });\n }\n }\n : onRecipientInteraction\n }\n onFocus={onRecipientInteraction}\n onMouseOver={onRecipientInteraction}\n aria-label={`${t('feed_private_post')} ${t(\n 'feed_recipients'\n )} ${formatListToLocaleString(recipientsList, t, locale, {\n count: recipientsCount\n })}`}\n label={`${t('feed_private_post')}:\\n${\n formatListToLocaleString(recipientsList, t, locale, {\n count: recipientsCount,\n separator: '\\n'\n }) || t('feed_private_post')\n }`}\n >\n <Icon name='lock-closed-solid' />\n </Button>\n )}\n <MetaList items={timestamps} />\n </Flex>\n }\n actions={\n menuItems ? (\n <MenuButton\n text={t('actions')}\n aria-label={t('actions_for', [fullname])}\n menu={{\n items:\n onEditSubmit && typeof content === 'string' && username === loggedInUser.username\n ? [\n {\n primary: t('edit'),\n id: 'edit',\n onClick: () => setEditMode(true),\n disabled: content.includes('<pega-autopilot/>')\n },\n ...menuItems\n ]\n : menuItems\n }}\n icon='more'\n iconOnly\n variant='simple'\n />\n ) : undefined\n }\n />\n );\n};\n\nexport default FeedContentHeader;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/cosmos-react-social",
3
- "version": "7.8.0",
3
+ "version": "7.9.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/pegasystems/cosmos-react.git",
@@ -22,9 +22,9 @@
22
22
  "build": "tsc -b tsconfig.build.json"
23
23
  },
24
24
  "dependencies": {
25
- "@pega/cosmos-react-core": "7.8.0",
26
- "@pega/cosmos-react-rte": "7.8.0",
27
- "@pega/cosmos-react-work": "7.8.0",
25
+ "@pega/cosmos-react-core": "7.9.0",
26
+ "@pega/cosmos-react-rte": "7.9.0",
27
+ "@pega/cosmos-react-work": "7.9.0",
28
28
  "@types/parse5": "^6.0.0",
29
29
  "@types/react": "^17.0.62",
30
30
  "@types/react-dom": "^17.0.20",