@pega/cosmos-react-social 5.0.0-dev.4.5 → 5.0.0-dev.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/Autopilot/Autopilot.d.ts +15 -0
- package/lib/components/Autopilot/Autopilot.d.ts.map +1 -0
- package/lib/components/Autopilot/Autopilot.js +50 -0
- package/lib/components/Autopilot/Autopilot.js.map +1 -0
- package/lib/components/Autopilot/AutopilotAvatar.d.ts +8 -0
- package/lib/components/Autopilot/AutopilotAvatar.d.ts.map +1 -0
- package/lib/components/Autopilot/AutopilotAvatar.js +11 -0
- package/lib/components/Autopilot/AutopilotAvatar.js.map +1 -0
- package/lib/components/Autopilot/AutopilotGlimpse.d.ts +9 -0
- package/lib/components/Autopilot/AutopilotGlimpse.d.ts.map +1 -0
- package/lib/components/Autopilot/AutopilotGlimpse.js +24 -0
- package/lib/components/Autopilot/AutopilotGlimpse.js.map +1 -0
- package/lib/components/Autopilot/index.d.ts +4 -0
- package/lib/components/Autopilot/index.d.ts.map +1 -0
- package/lib/components/Autopilot/index.js +3 -0
- package/lib/components/Autopilot/index.js.map +1 -0
- package/lib/components/Email/Email.types.d.ts +5 -0
- 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/EmailSummaryItem.d.ts.map +1 -1
- package/lib/components/Email/EmailSummaryItem.js +5 -3
- package/lib/components/Email/EmailSummaryItem.js.map +1 -1
- package/lib/components/Email/EmailSummaryList.d.ts.map +1 -1
- package/lib/components/Email/EmailSummaryList.js +4 -4
- package/lib/components/Email/EmailSummaryList.js.map +1 -1
- package/lib/components/Feed/Feed.context.d.ts +5 -0
- package/lib/components/Feed/Feed.context.d.ts.map +1 -1
- package/lib/components/Feed/Feed.context.js.map +1 -1
- package/lib/components/Feed/Feed.d.ts.map +1 -1
- package/lib/components/Feed/Feed.js +4 -2
- package/lib/components/Feed/Feed.js.map +1 -1
- package/lib/components/Feed/Feed.types.d.ts +4 -0
- package/lib/components/Feed/Feed.types.d.ts.map +1 -1
- package/lib/components/Feed/Feed.types.js.map +1 -1
- package/lib/components/Feed/FeedContentHeader.d.ts.map +1 -1
- package/lib/components/Feed/FeedContentHeader.js +7 -4
- package/lib/components/Feed/FeedContentHeader.js.map +1 -1
- package/lib/components/Feed/FeedRichText.d.ts.map +1 -1
- package/lib/components/Feed/FeedRichText.js +50 -6
- package/lib/components/Feed/FeedRichText.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -49,7 +49,7 @@ const StyledLoadMore = styled.div(({ theme }) => {
|
|
|
49
49
|
});
|
|
50
50
|
StyledLoadMore.defaultProps = defaultThemeProp;
|
|
51
51
|
const Feed = forwardRef(function Feed(props, ref) {
|
|
52
|
-
const { loadingPosts = false, variant, children, userInfo, className, title, searchTypes, onDecoratorSearch, searchResults = [], onMentionClick, onMentionPreview, onTagClick, mentionContent, interactionRenderers = [], markdownMap, filters, onFilterChange, onLoadMore, newPostRegion, posts = [], ...restProps } = props;
|
|
52
|
+
const { loadingPosts = false, variant, children, userInfo, className, title, searchTypes, onDecoratorSearch, searchResults = [], onAutopilotClick, onMentionClick, onMentionPreview, onTagClick, mentionContent, interactionRenderers = [], markdownMap, filters, onFilterChange, onLoadMore, newPostRegion, posts = [], enableAutopilot, ...restProps } = props;
|
|
53
53
|
const t = useI18n();
|
|
54
54
|
const [popoverEl, setPopoverEl] = useElement();
|
|
55
55
|
const [buttonEl, setButtonEl] = useElement();
|
|
@@ -124,6 +124,7 @@ const Feed = forwardRef(function Feed(props, ref) {
|
|
|
124
124
|
searchResults,
|
|
125
125
|
showSearchResults,
|
|
126
126
|
setShowSearchResults,
|
|
127
|
+
onAutopilotClick,
|
|
127
128
|
onMentionClick,
|
|
128
129
|
onMentionPreview,
|
|
129
130
|
onTagClick,
|
|
@@ -131,7 +132,8 @@ const Feed = forwardRef(function Feed(props, ref) {
|
|
|
131
132
|
markdownMap,
|
|
132
133
|
userInfo,
|
|
133
134
|
announce,
|
|
134
|
-
feedRef
|
|
135
|
+
feedRef,
|
|
136
|
+
enableAutopilot
|
|
135
137
|
}, children: _jsxs(StyledFeed, { ref: feedRef, ...restProps, children: [_jsx(FeedAnnouncer, { children: announcementText }), _jsxs(Card, { children: [_jsxs(CardHeader, { children: [_jsx(Text, { variant: 'h2', children: title }), filters && filters.length > 0 && (_jsx(Button, { as: FeedButton, ref: setButtonEl, variant: 'simple', icon: true, onClick: () => setMountPopover(curr => !curr), label: t('filters'), emphasized: true, children: _jsx(Icon, { name: filters?.map(filter => !!filter.on).reduce((acc, curr) => acc || curr)
|
|
136
138
|
? 'filter-on'
|
|
137
139
|
: 'filter' }) })), _jsx(Popover, { show: !!filters && mountPopover, ref: setPopoverEl, target: buttonEl, as: StyledFilterMenu, hideOnTargetHidden: true, onKeyDown: (event) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Feed.js","sourceRoot":"","sources":["../../../src/components/Feed/Feed.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAmB,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAO,MAAM,OAAO,CAAC;AACnG,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,MAAM,EACN,IAAI,EACJ,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,IAAI,EAEJ,aAAa,EACb,IAAI,EACJ,YAAY,EACZ,OAAO,EACP,UAAU,EACV,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,WAAW,EACX,mBAAmB,EACnB,MAAM,EACN,kBAAkB,EACnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClG,OAAO,KA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S,CAAC,GACR,EACP,KAAC,gBAAgB,IAAC,GAAG,EAAE,SAAS,YAC7B,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE;oDACrB,OAAO,CACL,uBACE,KAAC,MAAM,OACD,MAAM,EACV,QAAQ,EAAE,CAAC,KAAoC,EAAE,EAAE,CACjD,cAAc,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,GAEzD,IANK,MAAM,CAAC,EAAE,CAOb,CACN,CAAC;gDACJ,CAAC,CAAC,GACe,IACd,GACC,IACC,EAEb,KAAC,WAAW,cAAE,aAAa,GAAe,IACrC,EAEP,cAAK,EAAE,EAAE,EAAE,YAAG,KAAK,GAAO,EAEzB,YAAY,IAAI,CACf,KAAC,IAAI,IAAC,SAAS,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,cAAc,YACxD,KAAC,QAAQ,IAAC,SAAS,EAAC,QAAQ,GAAG,GAC1B,CACR,IACU,GACQ,CACxB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,IAAI,CAAC","sourcesContent":["import { ChangeEvent, FC, useState, useRef, useEffect, useCallback, forwardRef, Ref } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Button,\n Card,\n CardContent,\n CardHeader,\n defaultThemeProp,\n Flex,\n ForwardProps,\n getFocusables,\n Icon,\n registerIcon,\n Popover,\n StyledCard,\n Switch,\n Text,\n Progress,\n usePrevious,\n useItemIntersection,\n useUID,\n useConsolidatedRef\n} from '@pega/cosmos-react-core';\nimport { useArrows, useElement, useI18n, useOuterEvent } from '@pega/cosmos-react-core/lib/hooks';\nimport * as filterIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/filter.icon';\nimport * as filterOnIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/filter-on.icon';\nimport { StyledCardHeader } from '@pega/cosmos-react-core/lib/components/Card/CardHeader';\n\nimport { FeedContext } from './Feed.context';\nimport FeedButton from './FeedButton';\nimport FeedAnnouncer from './FeedAnnouncer';\nimport { FeedProps } from './Feed.types';\n\nregisterIcon(filterIcon, filterOnIcon);\n\nconst StyledFeed = styled.div`\n ${StyledCardHeader}:not(${StyledCard} ${StyledCard} > ${StyledCardHeader}) {\n padding-bottom: 0.25rem;\n }\n`;\n\nStyledFeed.defaultProps = defaultThemeProp;\n\nconst StyledFilterMenu = styled.div(({ theme }) => {\n return css`\n fieldset {\n padding-block-end: calc(2 * ${theme.base.spacing});\n border: none;\n max-height: inherit;\n\n legend {\n padding-block-start: calc(2 * ${theme.base.spacing});\n padding-inline: calc(2 * ${theme.base.spacing});\n }\n }\n `;\n});\n\nStyledFilterMenu.defaultProps = defaultThemeProp;\n\nconst StyledFilterList = styled.ul(({ theme }) => {\n return css`\n list-style-type: none;\n min-width: ${theme.base['content-width'].xs};\n padding-inline: calc(2 * ${theme.base.spacing});\n overflow: auto;\n `;\n});\n\nStyledFilterList.defaultProps = defaultThemeProp;\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 Feed: FC<ForwardProps & FeedProps> = forwardRef(function Feed(\n props: ForwardProps & FeedProps,\n ref: Ref<HTMLDivElement>\n) {\n const {\n loadingPosts = false,\n variant,\n children,\n userInfo,\n className,\n title,\n searchTypes,\n onDecoratorSearch,\n searchResults = [],\n onMentionClick,\n onMentionPreview,\n onTagClick,\n mentionContent,\n interactionRenderers = [],\n markdownMap,\n filters,\n onFilterChange,\n onLoadMore,\n newPostRegion,\n posts = [],\n ...restProps\n } = props;\n const t = useI18n();\n const [popoverEl, setPopoverEl] = useElement<HTMLElement>();\n const [buttonEl, setButtonEl] = useElement<HTMLElement>();\n const [mountPopover, setMountPopover] = useState(false);\n const [showSearchResults, setShowSearchResults] = useState(false);\n const prevPosts = usePrevious(posts);\n const [announcementText, setAnnouncementText] = useState('');\n\n const feedRef = useConsolidatedRef(ref);\n\n const filterRef = useRef(null);\n useArrows(filterRef);\n\n useOuterEvent('mousedown', [popoverEl, buttonEl], () => {\n setMountPopover(false);\n });\n\n useOuterEvent('focusin', [popoverEl], () => {\n setMountPopover(false);\n });\n\n const onKeydown = ({ key }: KeyboardEvent) => {\n if (key === 'Escape') setMountPopover(false);\n };\n\n useEffect(() => {\n document.addEventListener('keydown', onKeydown);\n return () => {\n document.removeEventListener('keydown', onKeydown);\n };\n }, []);\n\n const id = useUID();\n useItemIntersection(\n { current: null },\n posts.length - 1,\n () => {\n onLoadMore?.();\n },\n `#${id} > article[role='none']`\n );\n\n const announce = useCallback((announcement: string) => {\n setAnnouncementText('');\n return setTimeout(() => {\n setAnnouncementText(announcement);\n }, 0);\n }, []);\n\n useEffect(() => {\n if (loadingPosts) {\n const timeoutId = announce(t('loading_post'));\n return () => clearTimeout(timeoutId);\n }\n }, [loadingPosts]);\n\n useEffect(() => {\n if (prevPosts) {\n let timeoutId: ReturnType<typeof setTimeout>;\n const difference = posts.length - prevPosts.length;\n if (difference < 0) announce(t('feed_post_removed'));\n else if (difference > 0)\n announce(t('feed_new_post_added', [difference], { count: difference }));\n\n return () => clearTimeout(timeoutId);\n }\n }, [posts]);\n\n useEffect(() => {\n if (mountPopover) {\n setTimeout(() => {\n const focusables = getFocusables(filterRef);\n focusables[0]?.focus();\n }, 0);\n }\n }, [mountPopover]);\n\n return (\n <FeedContext.Provider\n // eslint-disable-next-line react/jsx-no-constructed-context-values\n value={{\n searchTypes,\n onSearch: e => {\n if (onDecoratorSearch) onDecoratorSearch(e);\n },\n searchResults,\n showSearchResults,\n setShowSearchResults,\n onMentionClick,\n onMentionPreview,\n onTagClick,\n interactionRenderers,\n markdownMap,\n userInfo,\n announce,\n feedRef\n }}\n >\n <StyledFeed ref={feedRef} {...restProps}>\n <FeedAnnouncer>{announcementText}</FeedAnnouncer>\n <Card>\n <CardHeader>\n <Text variant='h2'>{title}</Text>\n {filters && filters.length > 0 && (\n <Button\n as={FeedButton}\n ref={setButtonEl}\n variant='simple'\n icon\n onClick={() => setMountPopover(curr => !curr)}\n label={t('filters')}\n emphasized\n >\n <Icon\n name={\n filters?.map(filter => !!filter.on).reduce((acc, curr) => acc || curr)\n ? 'filter-on'\n : 'filter'\n }\n />\n </Button>\n )}\n\n <Popover\n show={!!filters && mountPopover}\n ref={setPopoverEl}\n target={buttonEl}\n as={StyledFilterMenu}\n hideOnTargetHidden\n onKeyDown={(event: KeyboardEvent) => {\n if (event.key === 'Tab') {\n event.preventDefault();\n buttonEl?.focus();\n }\n }}\n >\n <Flex container={{ direction: 'column', gap: 2 }} as='fieldset'>\n <Text variant='h3' as='legend'>\n {t('filters')}\n </Text>\n <StyledFilterList ref={filterRef}>\n {filters?.map(filter => {\n return (\n <li key={filter.id}>\n <Switch\n {...filter}\n onChange={(event: ChangeEvent<HTMLInputElement>) =>\n onFilterChange?.(event.target.id, event.target.checked)\n }\n />\n </li>\n );\n })}\n </StyledFilterList>\n </Flex>\n </Popover>\n </CardHeader>\n\n <CardContent>{newPostRegion}</CardContent>\n </Card>\n\n <div id={id}>{posts}</div>\n\n {loadingPosts && (\n <Flex container={{ justify: 'center' }} as={StyledLoadMore}>\n <Progress placement='inline' />\n </Flex>\n )}\n </StyledFeed>\n </FeedContext.Provider>\n );\n});\n\nexport default Feed;\n"]}
|
|
1
|
+
{"version":3,"file":"Feed.js","sourceRoot":"","sources":["../../../src/components/Feed/Feed.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAmB,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAO,MAAM,OAAO,CAAC;AACnG,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,MAAM,EACN,IAAI,EACJ,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,IAAI,EAEJ,aAAa,EACb,IAAI,EACJ,YAAY,E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AC,cAAc,EAAE,CAAC;4CACvB,QAAQ,EAAE,KAAK,EAAE,CAAC;yCACnB;oCACH,CAAC,YAED,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,EAAC,UAAU,aAC7D,KAAC,IAAI,IAAC,OAAO,EAAC,IAAI,EAAC,EAAE,EAAC,QAAQ,YAC3B,CAAC,CAAC,SAAS,CAAC,GACR,EACP,KAAC,gBAAgB,IAAC,GAAG,EAAE,SAAS,YAC7B,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE;oDACrB,OAAO,CACL,uBACE,KAAC,MAAM,OACD,MAAM,EACV,QAAQ,EAAE,CAAC,KAAoC,EAAE,EAAE,CACjD,cAAc,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,GAEzD,IANK,MAAM,CAAC,EAAE,CAOb,CACN,CAAC;gDACJ,CAAC,CAAC,GACe,IACd,GACC,IACC,EAEb,KAAC,WAAW,cAAE,aAAa,GAAe,IACrC,EAEP,cAAK,EAAE,EAAE,EAAE,YAAG,KAAK,GAAO,EAEzB,YAAY,IAAI,CACf,KAAC,IAAI,IAAC,SAAS,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,cAAc,YACxD,KAAC,QAAQ,IAAC,SAAS,EAAC,QAAQ,GAAG,GAC1B,CACR,IACU,GACQ,CACxB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,IAAI,CAAC","sourcesContent":["import { ChangeEvent, FC, useState, useRef, useEffect, useCallback, forwardRef, Ref } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Button,\n Card,\n CardContent,\n CardHeader,\n defaultThemeProp,\n Flex,\n ForwardProps,\n getFocusables,\n Icon,\n registerIcon,\n Popover,\n StyledCard,\n Switch,\n Text,\n Progress,\n usePrevious,\n useItemIntersection,\n useUID,\n useConsolidatedRef\n} from '@pega/cosmos-react-core';\nimport { useArrows, useElement, useI18n, useOuterEvent } from '@pega/cosmos-react-core/lib/hooks';\nimport * as filterIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/filter.icon';\nimport * as filterOnIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/filter-on.icon';\nimport { StyledCardHeader } from '@pega/cosmos-react-core/lib/components/Card/CardHeader';\n\nimport { FeedContext } from './Feed.context';\nimport FeedButton from './FeedButton';\nimport FeedAnnouncer from './FeedAnnouncer';\nimport { FeedProps } from './Feed.types';\n\nregisterIcon(filterIcon, filterOnIcon);\n\nconst StyledFeed = styled.div`\n ${StyledCardHeader}:not(${StyledCard} ${StyledCard} > ${StyledCardHeader}) {\n padding-bottom: 0.25rem;\n }\n`;\n\nStyledFeed.defaultProps = defaultThemeProp;\n\nconst StyledFilterMenu = styled.div(({ theme }) => {\n return css`\n fieldset {\n padding-block-end: calc(2 * ${theme.base.spacing});\n border: none;\n max-height: inherit;\n\n legend {\n padding-block-start: calc(2 * ${theme.base.spacing});\n padding-inline: calc(2 * ${theme.base.spacing});\n }\n }\n `;\n});\n\nStyledFilterMenu.defaultProps = defaultThemeProp;\n\nconst StyledFilterList = styled.ul(({ theme }) => {\n return css`\n list-style-type: none;\n min-width: ${theme.base['content-width'].xs};\n padding-inline: calc(2 * ${theme.base.spacing});\n overflow: auto;\n `;\n});\n\nStyledFilterList.defaultProps = defaultThemeProp;\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 Feed: FC<ForwardProps & FeedProps> = forwardRef(function Feed(\n props: ForwardProps & FeedProps,\n ref: Ref<HTMLDivElement>\n) {\n const {\n loadingPosts = false,\n variant,\n children,\n userInfo,\n className,\n title,\n searchTypes,\n onDecoratorSearch,\n searchResults = [],\n onAutopilotClick,\n onMentionClick,\n onMentionPreview,\n onTagClick,\n mentionContent,\n interactionRenderers = [],\n markdownMap,\n filters,\n onFilterChange,\n onLoadMore,\n newPostRegion,\n posts = [],\n enableAutopilot,\n ...restProps\n } = props;\n const t = useI18n();\n const [popoverEl, setPopoverEl] = useElement<HTMLElement>();\n const [buttonEl, setButtonEl] = useElement<HTMLElement>();\n const [mountPopover, setMountPopover] = useState(false);\n const [showSearchResults, setShowSearchResults] = useState(false);\n const prevPosts = usePrevious(posts);\n const [announcementText, setAnnouncementText] = useState('');\n\n const feedRef = useConsolidatedRef(ref);\n\n const filterRef = useRef(null);\n useArrows(filterRef);\n\n useOuterEvent('mousedown', [popoverEl, buttonEl], () => {\n setMountPopover(false);\n });\n\n useOuterEvent('focusin', [popoverEl], () => {\n setMountPopover(false);\n });\n\n const onKeydown = ({ key }: KeyboardEvent) => {\n if (key === 'Escape') setMountPopover(false);\n };\n\n useEffect(() => {\n document.addEventListener('keydown', onKeydown);\n return () => {\n document.removeEventListener('keydown', onKeydown);\n };\n }, []);\n\n const id = useUID();\n useItemIntersection(\n { current: null },\n posts.length - 1,\n () => {\n onLoadMore?.();\n },\n `#${id} > article[role='none']`\n );\n\n const announce = useCallback((announcement: string) => {\n setAnnouncementText('');\n return setTimeout(() => {\n setAnnouncementText(announcement);\n }, 0);\n }, []);\n\n useEffect(() => {\n if (loadingPosts) {\n const timeoutId = announce(t('loading_post'));\n return () => clearTimeout(timeoutId);\n }\n }, [loadingPosts]);\n\n useEffect(() => {\n if (prevPosts) {\n let timeoutId: ReturnType<typeof setTimeout>;\n const difference = posts.length - prevPosts.length;\n if (difference < 0) announce(t('feed_post_removed'));\n else if (difference > 0)\n announce(t('feed_new_post_added', [difference], { count: difference }));\n\n return () => clearTimeout(timeoutId);\n }\n }, [posts]);\n\n useEffect(() => {\n if (mountPopover) {\n setTimeout(() => {\n const focusables = getFocusables(filterRef);\n focusables[0]?.focus();\n }, 0);\n }\n }, [mountPopover]);\n\n return (\n <FeedContext.Provider\n // eslint-disable-next-line react/jsx-no-constructed-context-values\n value={{\n searchTypes,\n onSearch: e => {\n if (onDecoratorSearch) onDecoratorSearch(e);\n },\n searchResults,\n showSearchResults,\n setShowSearchResults,\n onAutopilotClick,\n onMentionClick,\n onMentionPreview,\n onTagClick,\n interactionRenderers,\n markdownMap,\n userInfo,\n announce,\n feedRef,\n enableAutopilot\n }}\n >\n <StyledFeed ref={feedRef} {...restProps}>\n <FeedAnnouncer>{announcementText}</FeedAnnouncer>\n <Card>\n <CardHeader>\n <Text variant='h2'>{title}</Text>\n {filters && filters.length > 0 && (\n <Button\n as={FeedButton}\n ref={setButtonEl}\n variant='simple'\n icon\n onClick={() => setMountPopover(curr => !curr)}\n label={t('filters')}\n emphasized\n >\n <Icon\n name={\n filters?.map(filter => !!filter.on).reduce((acc, curr) => acc || curr)\n ? 'filter-on'\n : 'filter'\n }\n />\n </Button>\n )}\n\n <Popover\n show={!!filters && mountPopover}\n ref={setPopoverEl}\n target={buttonEl}\n as={StyledFilterMenu}\n hideOnTargetHidden\n onKeyDown={(event: KeyboardEvent) => {\n if (event.key === 'Tab') {\n event.preventDefault();\n buttonEl?.focus();\n }\n }}\n >\n <Flex container={{ direction: 'column', gap: 2 }} as='fieldset'>\n <Text variant='h3' as='legend'>\n {t('filters')}\n </Text>\n <StyledFilterList ref={filterRef}>\n {filters?.map(filter => {\n return (\n <li key={filter.id}>\n <Switch\n {...filter}\n onChange={(event: ChangeEvent<HTMLInputElement>) =>\n onFilterChange?.(event.target.id, event.target.checked)\n }\n />\n </li>\n );\n })}\n </StyledFilterList>\n </Flex>\n </Popover>\n </CardHeader>\n\n <CardContent>{newPostRegion}</CardContent>\n </Card>\n\n <div id={id}>{posts}</div>\n\n {loadingPosts && (\n <Flex container={{ justify: 'center' }} as={StyledLoadMore}>\n <Progress placement='inline' />\n </Flex>\n )}\n </StyledFeed>\n </FeedContext.Provider>\n );\n});\n\nexport default Feed;\n"]}
|
|
@@ -32,6 +32,10 @@ export interface FeedProps extends NoChildrenProp {
|
|
|
32
32
|
onDecoratorSearch?: FeedContextValue['onSearch'];
|
|
33
33
|
/** Results that will be shown in a Popover for a mention or tag search. */
|
|
34
34
|
searchResults?: FeedContextValue['searchResults'];
|
|
35
|
+
/** If true, the Autopilot feature will be enabled for all posts and replies. */
|
|
36
|
+
enableAutopilot?: boolean;
|
|
37
|
+
/** A callback that is triggered when an Autopilot mention is clicked. The callback sends back the target of the element. The callback should return a function component. */
|
|
38
|
+
onAutopilotClick?: FeedContextValue['onAutopilotClick'];
|
|
35
39
|
/** A callback that is triggered when a mention button is clicked. The callback sends back the id, text, and type of the mention. The callback should return a function component. */
|
|
36
40
|
onMentionClick?: FeedContextValue['onMentionClick'];
|
|
37
41
|
/** A callback that is triggered when a mention link is previewed. The callback sends back the id, text, and type of the mention. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Feed.types.d.ts","sourceRoot":"","sources":["../../../src/components/Feed/Feed.types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,YAAY,EACZ,SAAS,EACT,GAAG,EACH,cAAc,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,EACL,WAAW,EACX,oBAAoB,EACpB,mBAAmB,EACnB,aAAa,EACb,cAAc,EACf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAElF,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,MAAM;IACrB,oFAAoF;IACpF,EAAE,EAAE,MAAM,CAAC;IACX,gFAAgF;IAChF,KAAK,EAAE,SAAS,CAAC;IACjB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,EAAE,CAAC,EAAE,OA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 -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Feed.types.js","sourceRoot":"","sources":["../../../src/components/Feed/Feed.types.ts"],"names":[],"mappings":"","sourcesContent":["import {\n Dispatch,\n MouseEvent,\n MutableRefObject,\n ReactElement,\n ReactNode,\n Ref,\n SetStateAction\n} from 'react';\n\nimport {\n AvatarProps,\n DateTimeDisplayProps,\n FileUploadItemProps,\n MenuItemProps,\n NoChildrenProp\n} from '@pega/cosmos-react-core';\nimport { RichTextEditorProps, RichTextEditorState } from '@pega/cosmos-react-rte';\n\nimport { FeedContextValue } from './Feed.context';\n\nexport interface SubComponentVariant {\n variant: 'post' | 'reply';\n}\n\nexport interface Filter {\n /** Sets DOM id for the control and associates label element via 'for' attribute. */\n id: string;\n /** Pass a string or a fragment with an Icon and string for the filter label. */\n label: ReactNode;\n /**\n * Disables the filter.\n * @default false\n */\n disabled?: boolean;\n /**\n * Sets on prop via onFilterChange.\n * @default false\n */\n on?: boolean;\n}\n\nexport interface FeedProps extends NoChildrenProp {\n /** Title for the feed. */\n title: string;\n /** Information related to the user of the Feed. */\n userInfo: FeedContextValue['userInfo'];\n /** A set of search types that can be used to determine which data set to conduct a mention search on. */\n searchTypes?: FeedContextValue['searchTypes'];\n /** A callback that runs when a decorator search has been run inside of the feed. */\n onDecoratorSearch?: FeedContextValue['onSearch'];\n /** Results that will be shown in a Popover for a mention or tag search. */\n searchResults?: FeedContextValue['searchResults'];\n /** A callback that is triggered when a mention button is clicked. The callback sends back the id, text, and type of the mention. The callback should return a function component. */\n onMentionClick?: FeedContextValue['onMentionClick'];\n /** A callback that is triggered when a mention link is previewed. The callback sends back the id, text, and type of the mention. */\n onMentionPreview?: FeedContextValue['onMentionPreview'];\n /** A callback that is triggered when a hashtag is clicked. The callback sends back the test of the tag. */\n onTagClick?: FeedContextValue['onTagClick'];\n /** A list of configuration objects used to render custom components within Feed posts and replies based off of a given regex pattern. */\n interactionRenderers?: FeedContextValue['interactionRenderers'];\n /** A mapping for various element types to render custom components for within posts. */\n markdownMap?: FeedContextValue['markdownMap'];\n /** A set of filters to apply to the Feed. */\n filters?: Filter[];\n /** A callback that runs when the filter is toggled. */\n onFilterChange?: (filterId: string, on: boolean) => void;\n /** A callback that is triggered when the bottom of the Feed is scrolled into view so that additional posts may be displayed. */\n onLoadMore?: () => void;\n /** Indicates if the posts are being currently loading */\n loadingPosts?: boolean;\n /** A region to hold the new post component */\n newPostRegion?: ReactNode;\n /** A list of FeedPost components */\n posts?: ReactNode[];\n}\n\nexport type FeedRichTextProps = Pick<\n RichTextEditorProps,\n 'label' | 'onChange' | 'onFocus' | 'onBlur' | 'height'\n>;\n\nexport type AttachedFiles = FileUploadItemProps & File;\n\nexport interface FeedAttachmentsProps extends SubComponentVariant {\n attachments?: AttachedFiles[];\n readOnly?: boolean;\n ref?: Ref<HTMLUListElement>;\n}\nexport interface FeedCompositionBaseProps {\n /** A unique ID for the new message. */\n id: string;\n /** A set of attachment files. */\n attachments?: AttachedFiles[];\n /** A callback containing a list of added files that will run whenever files are added to the message. */\n onFilesAdded?: (files: AttachedFiles[]) => void;\n /** Callback that runs when the submit button has been clicked. */\n onSubmit: (event: {\n id: string;\n value: string;\n attachments: AttachedFiles[];\n recipients?: RecipientMenuItem[];\n username: string;\n clear: () => void;\n }) => void;\n}\n\nexport interface FeedInputRegionProps extends SubComponentVariant, FeedCompositionBaseProps {\n inputRegionEl: HTMLDivElement | null;\n rteRef: MutableRefObject<RichTextEditorState | undefined>;\n selectedRecipients?: RecipientMenuItem[];\n}\n\nexport interface FeedEditRegionProps\n extends SubComponentVariant,\n Pick<FeedMessageBaseProps, 'id' | 'content' | 'onEditSubmit'> {\n setEditMode: Dispatch<SetStateAction<boolean>>;\n emptyEditText: boolean;\n setEmptyEditText: Dispatch<SetStateAction<boolean>>;\n}\n\nexport interface FeedNewPostProps extends FeedCompositionBaseProps {\n /** If true, the new post input will focus on page load. */\n autoFocus?: boolean;\n /** Array of private recipient options. */\n recipients?: PostTypeMenuProps['recipients'];\n /** Handler for new search on private recipient options. */\n onRecipientSearch?: (newSearch: string) => void;\n}\n\nexport interface FeedReplyInputProps extends FeedCompositionBaseProps {\n /** Callback that sets returns a shared ref to the RTE component */\n onSetInputRef?: (event: { ref: MutableRefObject<RichTextEditorState | undefined> }) => void;\n}\n\nexport interface FeedModalListProps {\n /** The count for the list of items. */\n count: number;\n /** The heading for the Modal. */\n heading: string;\n /** The list of MenuItems to render in the Modal. */\n listItems: MenuItemProps[];\n /** A callback that is triggered when the bottom of the Modal list is scrolled into view so that additional data may be displayed. */\n onLoadMore?: () => void;\n /** Indicates if the data is being currently loading */\n loading?: boolean;\n}\n\nexport type PostType = 'post' | 'private';\n\nexport interface RecipientOption {\n /** Pretty printed recipient name */\n primary: string;\n /** Functional identifier of unique recipient */\n value: string;\n}\n\nexport interface RecipientMenuItem {\n id: string;\n selected?: boolean;\n primary: RecipientOption['primary'];\n value: RecipientOption['value'];\n secondary?: MenuItemProps['secondary'];\n visual?: MenuItemProps['visual'];\n}\nexport interface PostTypeMenuProps {\n /** Array of private recipient options */\n recipients: RecipientOption[];\n /** Post type update handler */\n onSetPostType: (postType: PostType) => void;\n /** Private post recipient list update handler */\n onSelectedRecipientsUpdate: (recipients: RecipientMenuItem[]) => void;\n /** Handler for new search on private recipient options */\n onRecipientSearch: (newSearch: string) => void;\n reset: boolean;\n onReset: () => void;\n}\n\nexport interface PostTypeMenuState {\n postType: PostType;\n itemsLoading: boolean;\n showTypeMenu: boolean;\n showRecipientMenu: boolean;\n viewingRecipients: boolean;\n searchValue: string;\n typeMenuItems: {\n id: string;\n primary: string;\n selected: boolean;\n value: PostType;\n }[];\n recipientMenuItems: RecipientMenuItem[];\n multiSelectItems: RecipientMenuItem[];\n}\n\nexport interface FeedContentProps {\n children: ReactElement | string;\n /**\n * A maximum height in pixels to display post content within before prompting to expand the post.\n * @default Infinity\n */\n maxContentHeight?: number;\n ref?: Ref<HTMLDivElement>;\n}\n\nexport interface FeedMessageBaseProps {\n /** Unique ID for the message. */\n id: string;\n /** Display name for the message author. */\n fullname: string;\n /** Username for the message author. */\n username: string;\n /** A timestamp of when the message was initially submitted. */\n postTimestamp: DateTimeDisplayProps['value'];\n /** The message content. */\n content: ReactElement | string;\n /** Attachments on the message. */\n attachments?: AttachedFiles[];\n /** An image source for the message author's Avatar. */\n avatarSrc?: string;\n /** The name of an icon to render within the Avatar. */\n icon?: string;\n /** The status of the message author. */\n userStatus?: AvatarProps['status'];\n /** Set true if the user has liked the message. */\n liked?: boolean;\n /** A set of users that have liked the message. */\n likes?: MenuItemProps[];\n /** The total count of likes on the message. */\n likeCount?: number;\n /**\n * If true, the like and comment buttons will be enabled.\n * @default true\n */\n interactionsEnabled?: boolean;\n /**\n * A maximum height in pixels to display message content within before prompting to expand the message.\n * @default Infinity\n */\n maxContentHeight?: FeedContentProps['maxContentHeight'];\n /** A set of menu options for actions on the message. */\n menuItems?: MenuItemProps[];\n /** Callback that updates the message after being edited. If undefined, the message will not be editable. */\n onEditSubmit?: (event: { id: string; value: string }) => void;\n /**\n * Flag that indicates if a message has been previously edited.\n * @default false\n */\n edited?: boolean;\n /** A timestamp of when the message was last edited. This will only display if edited prop is true. */\n editTimestamp?: DateTimeDisplayProps['value'];\n /** Callback that runs when the mouse pointer hovers over the message. */\n onMouseEnter?: (event: { id: string }) => void;\n /** Callback that runs when the mouse pointer leaves the message. */\n onMouseLeave?: (event: { id: string }) => void;\n /** Callback that runs when the author's name or Avatar has been clicked. */\n onUserClick?: (event: { id: string; username: string }, clickEvent?: MouseEvent) => void;\n /** Callback that runs when the comment button has been clicked. */\n onCommentClick: (event: { id: string; username: string }) => void;\n /** Callback that runs when the like button has been clicked. */\n onLikeClick: (event: { id: string; user: MenuItemProps }) => void;\n /** Callback that runs when the like count on a message 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 /** A loading indicator for the likes Modal. */\n likesLoading?: boolean;\n}\n\nexport interface FeedPostProps extends FeedMessageBaseProps {\n /**\n * The type of message. If private, then only the designated recipients will be able to view the message.\n * @default 'public'\n */\n postType?: 'public' | 'private';\n /** The set of recipients assigned to a private message. */\n recipients?: MenuItemProps[];\n /** The total number of private recipients. */\n recipientsCount?: number;\n /** The context of the message. */\n postContext?: ReactElement | string;\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 /** A loading indicator for the recipients Modal. */\n recipientsLoading?: boolean;\n /** Props that will be passed into the reply input, see FeedReplyInput for more information. */\n replyInput: Pick<FeedReplyInputProps, 'onSubmit' | 'onFilesAdded' | 'attachments'>;\n /** The default visibility for the reply input. */\n replyInputShown?: boolean;\n /** An array to of replies for this message. */\n replies?: ReactElement[];\n /** A total count of all replies. */\n replyCount?: number;\n /** Callback that runs when the user clicks Show more button for the replies. */\n onShowMoreReplies?: (event: { id: string }) => void;\n /** Callback that runs when the user clicks Show less button for the replies. */\n onShowLessReplies?: (event: { id: string }) => void;\n /** A loading indicator for the replies. */\n repliesLoading?: boolean;\n}\n\nexport type FeedReplyProps = FeedMessageBaseProps;\n\nexport interface FeedContentHeaderProps extends SubComponentVariant {\n id: FeedMessageBaseProps['id'];\n fullname: FeedMessageBaseProps['fullname'];\n username: FeedMessageBaseProps['username'];\n postTimestamp: FeedMessageBaseProps['postTimestamp'];\n content: FeedMessageBaseProps['content'];\n avatarSrc?: FeedMessageBaseProps['avatarSrc'];\n icon?: FeedMessageBaseProps['icon'];\n userStatus?: FeedMessageBaseProps['userStatus'];\n postType?: FeedPostProps['postType'];\n postContext?: FeedPostProps['postContext'];\n recipients?: FeedPostProps['recipients'];\n recipientsCount?: FeedPostProps['recipientsCount'];\n menuItems?: FeedMessageBaseProps['menuItems'];\n edited?: FeedMessageBaseProps['edited'];\n editTimestamp?: FeedMessageBaseProps['editTimestamp'];\n recipientsLoading?: FeedPostProps['recipientsLoading'];\n onEditSubmit?: FeedMessageBaseProps['onEditSubmit'];\n onLoadMoreRecipients?: FeedPostProps['onLoadMoreRecipients'];\n onRecipientInteraction?: FeedPostProps['onRecipientInteraction'];\n onUserClick?: FeedMessageBaseProps['onUserClick'];\n setEditMode: Dispatch<SetStateAction<boolean>>;\n}\n\nexport interface FeedContentFooterProps extends SubComponentVariant {\n id: FeedMessageBaseProps['id'];\n username: FeedMessageBaseProps['username'];\n liked?: FeedMessageBaseProps['liked'];\n likes?: FeedMessageBaseProps['likes'];\n likeCount?: FeedMessageBaseProps['likeCount'];\n interactionsEnabled?: FeedMessageBaseProps['interactionsEnabled'];\n onCommentClick: FeedMessageBaseProps['onCommentClick'];\n onLikeClick: FeedMessageBaseProps['onLikeClick'];\n onLikeCountInteraction?: FeedMessageBaseProps['onLikeCountInteraction'];\n onLoadMoreLikes?: FeedMessageBaseProps['onLoadMoreLikes'];\n likesLoading?: FeedMessageBaseProps['likesLoading'];\n replies?: FeedPostProps['replies'];\n replyCount?: FeedPostProps['replyCount'];\n onShowMoreReplies?: FeedPostProps['onShowMoreReplies'];\n onShowLessReplies?: FeedPostProps['onShowMoreReplies'];\n repliesLoading?: FeedPostProps['repliesLoading'];\n replyInputOpen?: boolean;\n setReplyInputOpen?: Dispatch<SetStateAction<boolean>>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Feed.types.js","sourceRoot":"","sources":["../../../src/components/Feed/Feed.types.ts"],"names":[],"mappings":"","sourcesContent":["import {\n Dispatch,\n MouseEvent,\n MutableRefObject,\n ReactElement,\n ReactNode,\n Ref,\n SetStateAction\n} from 'react';\n\nimport {\n AvatarProps,\n DateTimeDisplayProps,\n FileUploadItemProps,\n MenuItemProps,\n NoChildrenProp\n} from '@pega/cosmos-react-core';\nimport { RichTextEditorProps, RichTextEditorState } from '@pega/cosmos-react-rte';\n\nimport { FeedContextValue } from './Feed.context';\n\nexport interface SubComponentVariant {\n variant: 'post' | 'reply';\n}\n\nexport interface Filter {\n /** Sets DOM id for the control and associates label element via 'for' attribute. */\n id: string;\n /** Pass a string or a fragment with an Icon and string for the filter label. */\n label: ReactNode;\n /**\n * Disables the filter.\n * @default false\n */\n disabled?: boolean;\n /**\n * Sets on prop via onFilterChange.\n * @default false\n */\n on?: boolean;\n}\n\nexport interface FeedProps extends NoChildrenProp {\n /** Title for the feed. */\n title: string;\n /** Information related to the user of the Feed. */\n userInfo: FeedContextValue['userInfo'];\n /** A set of search types that can be used to determine which data set to conduct a mention search on. */\n searchTypes?: FeedContextValue['searchTypes'];\n /** A callback that runs when a decorator search has been run inside of the feed. */\n onDecoratorSearch?: FeedContextValue['onSearch'];\n /** Results that will be shown in a Popover for a mention or tag search. */\n searchResults?: FeedContextValue['searchResults'];\n /** If true, the Autopilot feature will be enabled for all posts and replies. */\n enableAutopilot?: boolean;\n /** A callback that is triggered when an Autopilot mention is clicked. The callback sends back the target of the element. The callback should return a function component. */\n onAutopilotClick?: FeedContextValue['onAutopilotClick'];\n /** A callback that is triggered when a mention button is clicked. The callback sends back the id, text, and type of the mention. The callback should return a function component. */\n onMentionClick?: FeedContextValue['onMentionClick'];\n /** A callback that is triggered when a mention link is previewed. The callback sends back the id, text, and type of the mention. */\n onMentionPreview?: FeedContextValue['onMentionPreview'];\n /** A callback that is triggered when a hashtag is clicked. The callback sends back the test of the tag. */\n onTagClick?: FeedContextValue['onTagClick'];\n /** A list of configuration objects used to render custom components within Feed posts and replies based off of a given regex pattern. */\n interactionRenderers?: FeedContextValue['interactionRenderers'];\n /** A mapping for various element types to render custom components for within posts. */\n markdownMap?: FeedContextValue['markdownMap'];\n /** A set of filters to apply to the Feed. */\n filters?: Filter[];\n /** A callback that runs when the filter is toggled. */\n onFilterChange?: (filterId: string, on: boolean) => void;\n /** A callback that is triggered when the bottom of the Feed is scrolled into view so that additional posts may be displayed. */\n onLoadMore?: () => void;\n /** Indicates if the posts are being currently loading */\n loadingPosts?: boolean;\n /** A region to hold the new post component */\n newPostRegion?: ReactNode;\n /** A list of FeedPost components */\n posts?: ReactNode[];\n}\n\nexport type FeedRichTextProps = Pick<\n RichTextEditorProps,\n 'label' | 'onChange' | 'onFocus' | 'onBlur' | 'height'\n>;\n\nexport type AttachedFiles = FileUploadItemProps & File;\n\nexport interface FeedAttachmentsProps extends SubComponentVariant {\n attachments?: AttachedFiles[];\n readOnly?: boolean;\n ref?: Ref<HTMLUListElement>;\n}\nexport interface FeedCompositionBaseProps {\n /** A unique ID for the new message. */\n id: string;\n /** A set of attachment files. */\n attachments?: AttachedFiles[];\n /** A callback containing a list of added files that will run whenever files are added to the message. */\n onFilesAdded?: (files: AttachedFiles[]) => void;\n /** Callback that runs when the submit button has been clicked. */\n onSubmit: (event: {\n id: string;\n value: string;\n attachments: AttachedFiles[];\n recipients?: RecipientMenuItem[];\n username: string;\n clear: () => void;\n }) => void;\n}\n\nexport interface FeedInputRegionProps extends SubComponentVariant, FeedCompositionBaseProps {\n inputRegionEl: HTMLDivElement | null;\n rteRef: MutableRefObject<RichTextEditorState | undefined>;\n selectedRecipients?: RecipientMenuItem[];\n}\n\nexport interface FeedEditRegionProps\n extends SubComponentVariant,\n Pick<FeedMessageBaseProps, 'id' | 'content' | 'onEditSubmit'> {\n setEditMode: Dispatch<SetStateAction<boolean>>;\n emptyEditText: boolean;\n setEmptyEditText: Dispatch<SetStateAction<boolean>>;\n}\n\nexport interface FeedNewPostProps extends FeedCompositionBaseProps {\n /** If true, the new post input will focus on page load. */\n autoFocus?: boolean;\n /** Array of private recipient options. */\n recipients?: PostTypeMenuProps['recipients'];\n /** Handler for new search on private recipient options. */\n onRecipientSearch?: (newSearch: string) => void;\n}\n\nexport interface FeedReplyInputProps extends FeedCompositionBaseProps {\n /** Callback that sets returns a shared ref to the RTE component */\n onSetInputRef?: (event: { ref: MutableRefObject<RichTextEditorState | undefined> }) => void;\n}\n\nexport interface FeedModalListProps {\n /** The count for the list of items. */\n count: number;\n /** The heading for the Modal. */\n heading: string;\n /** The list of MenuItems to render in the Modal. */\n listItems: MenuItemProps[];\n /** A callback that is triggered when the bottom of the Modal list is scrolled into view so that additional data may be displayed. */\n onLoadMore?: () => void;\n /** Indicates if the data is being currently loading */\n loading?: boolean;\n}\n\nexport type PostType = 'post' | 'private';\n\nexport interface RecipientOption {\n /** Pretty printed recipient name */\n primary: string;\n /** Functional identifier of unique recipient */\n value: string;\n}\n\nexport interface RecipientMenuItem {\n id: string;\n selected?: boolean;\n primary: RecipientOption['primary'];\n value: RecipientOption['value'];\n secondary?: MenuItemProps['secondary'];\n visual?: MenuItemProps['visual'];\n}\nexport interface PostTypeMenuProps {\n /** Array of private recipient options */\n recipients: RecipientOption[];\n /** Post type update handler */\n onSetPostType: (postType: PostType) => void;\n /** Private post recipient list update handler */\n onSelectedRecipientsUpdate: (recipients: RecipientMenuItem[]) => void;\n /** Handler for new search on private recipient options */\n onRecipientSearch: (newSearch: string) => void;\n reset: boolean;\n onReset: () => void;\n}\n\nexport interface PostTypeMenuState {\n postType: PostType;\n itemsLoading: boolean;\n showTypeMenu: boolean;\n showRecipientMenu: boolean;\n viewingRecipients: boolean;\n searchValue: string;\n typeMenuItems: {\n id: string;\n primary: string;\n selected: boolean;\n value: PostType;\n }[];\n recipientMenuItems: RecipientMenuItem[];\n multiSelectItems: RecipientMenuItem[];\n}\n\nexport interface FeedContentProps {\n children: ReactElement | string;\n /**\n * A maximum height in pixels to display post content within before prompting to expand the post.\n * @default Infinity\n */\n maxContentHeight?: number;\n ref?: Ref<HTMLDivElement>;\n}\n\nexport interface FeedMessageBaseProps {\n /** Unique ID for the message. */\n id: string;\n /** Display name for the message author. */\n fullname: string;\n /** Username for the message author. */\n username: string;\n /** A timestamp of when the message was initially submitted. */\n postTimestamp: DateTimeDisplayProps['value'];\n /** The message content. */\n content: ReactElement | string;\n /** Attachments on the message. */\n attachments?: AttachedFiles[];\n /** An image source for the message author's Avatar. */\n avatarSrc?: string;\n /** The name of an icon to render within the Avatar. */\n icon?: string;\n /** The status of the message author. */\n userStatus?: AvatarProps['status'];\n /** Set true if the user has liked the message. */\n liked?: boolean;\n /** A set of users that have liked the message. */\n likes?: MenuItemProps[];\n /** The total count of likes on the message. */\n likeCount?: number;\n /**\n * If true, the like and comment buttons will be enabled.\n * @default true\n */\n interactionsEnabled?: boolean;\n /**\n * A maximum height in pixels to display message content within before prompting to expand the message.\n * @default Infinity\n */\n maxContentHeight?: FeedContentProps['maxContentHeight'];\n /** A set of menu options for actions on the message. */\n menuItems?: MenuItemProps[];\n /** Callback that updates the message after being edited. If undefined, the message will not be editable. */\n onEditSubmit?: (event: { id: string; value: string }) => void;\n /**\n * Flag that indicates if a message has been previously edited.\n * @default false\n */\n edited?: boolean;\n /** A timestamp of when the message was last edited. This will only display if edited prop is true. */\n editTimestamp?: DateTimeDisplayProps['value'];\n /** Callback that runs when the mouse pointer hovers over the message. */\n onMouseEnter?: (event: { id: string }) => void;\n /** Callback that runs when the mouse pointer leaves the message. */\n onMouseLeave?: (event: { id: string }) => void;\n /** Callback that runs when the author's name or Avatar has been clicked. */\n onUserClick?: (event: { id: string; username: string }, clickEvent?: MouseEvent) => void;\n /** Callback that runs when the comment button has been clicked. */\n onCommentClick: (event: { id: string; username: string }) => void;\n /** Callback that runs when the like button has been clicked. */\n onLikeClick: (event: { id: string; user: MenuItemProps }) => void;\n /** Callback that runs when the like count on a message 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 /** A loading indicator for the likes Modal. */\n likesLoading?: boolean;\n}\n\nexport interface FeedPostProps extends FeedMessageBaseProps {\n /**\n * The type of message. If private, then only the designated recipients will be able to view the message.\n * @default 'public'\n */\n postType?: 'public' | 'private';\n /** The set of recipients assigned to a private message. */\n recipients?: MenuItemProps[];\n /** The total number of private recipients. */\n recipientsCount?: number;\n /** The context of the message. */\n postContext?: ReactElement | string;\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 /** A loading indicator for the recipients Modal. */\n recipientsLoading?: boolean;\n /** Props that will be passed into the reply input, see FeedReplyInput for more information. */\n replyInput: Pick<FeedReplyInputProps, 'onSubmit' | 'onFilesAdded' | 'attachments'>;\n /** The default visibility for the reply input. */\n replyInputShown?: boolean;\n /** An array to of replies for this message. */\n replies?: ReactElement[];\n /** A total count of all replies. */\n replyCount?: number;\n /** Callback that runs when the user clicks Show more button for the replies. */\n onShowMoreReplies?: (event: { id: string }) => void;\n /** Callback that runs when the user clicks Show less button for the replies. */\n onShowLessReplies?: (event: { id: string }) => void;\n /** A loading indicator for the replies. */\n repliesLoading?: boolean;\n}\n\nexport type FeedReplyProps = FeedMessageBaseProps;\n\nexport interface FeedContentHeaderProps extends SubComponentVariant {\n id: FeedMessageBaseProps['id'];\n fullname: FeedMessageBaseProps['fullname'];\n username: FeedMessageBaseProps['username'];\n postTimestamp: FeedMessageBaseProps['postTimestamp'];\n content: FeedMessageBaseProps['content'];\n avatarSrc?: FeedMessageBaseProps['avatarSrc'];\n icon?: FeedMessageBaseProps['icon'];\n userStatus?: FeedMessageBaseProps['userStatus'];\n postType?: FeedPostProps['postType'];\n postContext?: FeedPostProps['postContext'];\n recipients?: FeedPostProps['recipients'];\n recipientsCount?: FeedPostProps['recipientsCount'];\n menuItems?: FeedMessageBaseProps['menuItems'];\n edited?: FeedMessageBaseProps['edited'];\n editTimestamp?: FeedMessageBaseProps['editTimestamp'];\n recipientsLoading?: FeedPostProps['recipientsLoading'];\n onEditSubmit?: FeedMessageBaseProps['onEditSubmit'];\n onLoadMoreRecipients?: FeedPostProps['onLoadMoreRecipients'];\n onRecipientInteraction?: FeedPostProps['onRecipientInteraction'];\n onUserClick?: FeedMessageBaseProps['onUserClick'];\n setEditMode: Dispatch<SetStateAction<boolean>>;\n}\n\nexport interface FeedContentFooterProps extends SubComponentVariant {\n id: FeedMessageBaseProps['id'];\n username: FeedMessageBaseProps['username'];\n liked?: FeedMessageBaseProps['liked'];\n likes?: FeedMessageBaseProps['likes'];\n likeCount?: FeedMessageBaseProps['likeCount'];\n interactionsEnabled?: FeedMessageBaseProps['interactionsEnabled'];\n onCommentClick: FeedMessageBaseProps['onCommentClick'];\n onLikeClick: FeedMessageBaseProps['onLikeClick'];\n onLikeCountInteraction?: FeedMessageBaseProps['onLikeCountInteraction'];\n onLoadMoreLikes?: FeedMessageBaseProps['onLoadMoreLikes'];\n likesLoading?: FeedMessageBaseProps['likesLoading'];\n replies?: FeedPostProps['replies'];\n replyCount?: FeedPostProps['replyCount'];\n onShowMoreReplies?: FeedPostProps['onShowMoreReplies'];\n onShowLessReplies?: FeedPostProps['onShowMoreReplies'];\n repliesLoading?: FeedPostProps['repliesLoading'];\n replyInputOpen?: boolean;\n setReplyInputOpen?: Dispatch<SetStateAction<boolean>>;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeedContentHeader.d.ts","sourceRoot":"","sources":["../../../src/components/Feed/FeedContentHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAA6C,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"FeedContentHeader.d.ts","sourceRoot":"","sources":["../../../src/components/Feed/FeedContentHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAA6C,MAAM,OAAO,CAAC;AAgCtE,OAAO,EAAE,sBAAsB,EAAsB,MAAM,cAAc,CAAC;AAsB1E,QAAA,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,CA2MjD,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -6,6 +6,7 @@ import BareButton from '@pega/cosmos-react-core/lib/components/Button/BareButton
|
|
|
6
6
|
import { parseToDate } from '@pega/cosmos-react-core/lib/components/DateTime/Input/utils';
|
|
7
7
|
import { formatDateTime } from '@pega/cosmos-react-core/lib/components/DateTime/utils';
|
|
8
8
|
import { formatListToLocaleString } from '@pega/cosmos-react-core/lib/utils';
|
|
9
|
+
import AutopilotAvatar from '../Autopilot/AutopilotAvatar';
|
|
9
10
|
import { FeedContext } from './Feed.context';
|
|
10
11
|
import FeedModalList from './FeedModalList';
|
|
11
12
|
import FeedButton from './FeedButton';
|
|
@@ -28,13 +29,14 @@ const StyledName = styled(Text) `
|
|
|
28
29
|
`;
|
|
29
30
|
const FeedContentHeader = (props) => {
|
|
30
31
|
const { variant, id, fullname, username, postTimestamp, content, avatarSrc, icon, userStatus, postType, postContext, recipients = [], recipientsCount = 0, menuItems, edited, editTimestamp, recipientsLoading, onEditSubmit, onLoadMoreRecipients, onRecipientInteraction, onUserClick, setEditMode } = props;
|
|
31
|
-
const { userInfo: loggedInUser } = useContext(FeedContext);
|
|
32
|
+
const { enableAutopilot, userInfo: loggedInUser } = useContext(FeedContext);
|
|
32
33
|
const t = useI18n();
|
|
33
34
|
const { locale } = useConfiguration();
|
|
34
35
|
const { create } = useModalManager();
|
|
35
36
|
const recipientsModalRef = useRef();
|
|
36
37
|
const [postTimestampEl, setPostTimestampEl] = useElement();
|
|
37
38
|
const [editTimestampEl, setEditTimestampEl] = useElement();
|
|
39
|
+
const autopilotAuthor = enableAutopilot && username === 'Autopilot';
|
|
38
40
|
const timestamps = [
|
|
39
41
|
_jsxs(_Fragment, { children: [_jsx(DateTimeDisplay, { ref: setPostTimestampEl, value: postTimestamp, variant: 'relative' }), postTimestamp && (_jsx(Tooltip, { target: postTimestampEl, children: formatDateTime(parseToDate(postTimestamp), {
|
|
40
42
|
t,
|
|
@@ -53,7 +55,7 @@ const FeedContentHeader = (props) => {
|
|
|
53
55
|
timeZone: loggedInUser.timeZone
|
|
54
56
|
}) }))] }));
|
|
55
57
|
}
|
|
56
|
-
const userVisual = (_jsx(Avatar, { name: fullname, size: variant === 'post' ? 'l' : 'm', imageSrc: avatarSrc, icon: icon, status: userStatus }));
|
|
58
|
+
const userVisual = autopilotAuthor ? (_jsx(AutopilotAvatar, {})) : (_jsx(Avatar, { name: fullname, size: variant === 'post' ? 'l' : 'm', imageSrc: avatarSrc, icon: icon, status: userStatus }));
|
|
57
59
|
const recipientsList = recipients.map(x => x.primary);
|
|
58
60
|
useEffect(() => {
|
|
59
61
|
if (recipients.length) {
|
|
@@ -70,7 +72,7 @@ const FeedContentHeader = (props) => {
|
|
|
70
72
|
onUserClick?.({ id, username }, event);
|
|
71
73
|
}, children: userVisual })) : (userVisual), primary: _jsxs("div", { children: [onUserClick ? (_jsx(Button, { variant: 'text', onClick: (event) => {
|
|
72
74
|
onUserClick?.({ id, username }, event);
|
|
73
|
-
}, children: _jsx(Text, { variant: 'h3', children: fullname }) })) : (_jsx(StyledName, { variant: 'h3', children: 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
|
|
75
|
+
}, children: _jsx(Text, { variant: 'h3', children: autopilotAuthor ? 'Autopilot' : fullname }) })) : (_jsx(StyledName, { variant: 'h3', children: autopilotAuthor ? 'Autopilot' : 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
|
|
74
76
|
? () => {
|
|
75
77
|
if (recipientsCount > 2) {
|
|
76
78
|
recipientsModalRef.current = create(FeedModalList, {
|
|
@@ -93,7 +95,8 @@ const FeedContentHeader = (props) => {
|
|
|
93
95
|
{
|
|
94
96
|
primary: t('edit'),
|
|
95
97
|
id: 'edit',
|
|
96
|
-
onClick: () => setEditMode(true)
|
|
98
|
+
onClick: () => setEditMode(true),
|
|
99
|
+
disabled: content.includes('<pega-autopilot/>')
|
|
97
100
|
},
|
|
98
101
|
...menuItems
|
|
99
102
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeedContentHeader.js","sourceRoot":"","sources":["../../../src/components/Feed/FeedContentHeader.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAkB,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtE,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,EAER,eAAe,EACf,WAAW,EACX,IAAI,EACJ,OAAO,EACP,gBAAgB,EAChB,UAAU,EACV,OAAO,EACP,eAAe,EAChB,MAAM,yBAAyB,CAAC;AACjC,OAAO,UAAU,MAAM,0DAA0D,CAAC;AAClF,OAAO,EAAE,WAAW,EAAE,MAAM,6DAA6D,CAAC;AAC1F,OAAO,EAAE,cAAc,EAAE,MAAM,uDAAuD,CAAC;AACvF,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAE7E,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,UAAU,MAAM,cAAc,CAAC;AAGtC,MAAM,uBAAuB,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACvD,OAAO,GAAG,CAAA;wBACY,KAAK,CAAC,IAAI,CAAC,OAAO;kBACxB,KAAK,CAAC,IAAI,CAAC,OAAO;;MAE9B,eAAe;QACb,UAAU;;4CAE0B,KAAK,CAAC,IAAI,CAAC,OAAO;;;GAG3D,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,uBAAuB,CAAC,YAAY,GAAG,gBAAgB,CAAC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b;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 { FC, MouseEvent, useContext, useEffect, useRef } 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 ModalMethods,\n StyledSecondary,\n SummaryItem,\n Text,\n Tooltip,\n useConfiguration,\n useElement,\n useI18n,\n useModalManager\n} 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 { FeedContext } from './Feed.context';\nimport FeedModalList from './FeedModalList';\nimport FeedButton from './FeedButton';\nimport { 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 { userInfo: loggedInUser } = 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 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: 'short',\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: 'short',\n variant: 'datetime',\n timeZone: loggedInUser.timeZone\n })}\n </Tooltip>\n )}\n </>\n );\n }\n\n const userVisual = (\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'>{fullname}</Text>\n </Button>\n ) : (\n <StyledName variant='h3'>{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 > 2) {\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.slice(0, 2), t, locale, {\n count: recipientsCount\n })}`}\n label={`${t('feed_private_post')}:\\n${\n formatListToLocaleString(recipientsList.slice(0, 2), 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('feed_post_actions_menu')}\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 },\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,EAAkB,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,O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AO,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 { FC, MouseEvent, useContext, useEffect, useRef } 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 ModalMethods,\n StyledSecondary,\n SummaryItem,\n Text,\n Tooltip,\n useConfiguration,\n useElement,\n useI18n,\n useModalManager\n} 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 { 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 { enableAutopilot, userInfo: loggedInUser } = 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 = enableAutopilot && username === 'Autopilot';\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: 'short',\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: 'short',\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 ? 'Autopilot' : fullname}</Text>\n </Button>\n ) : (\n <StyledName variant='h3'>{autopilotAuthor ? 'Autopilot' : 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 > 2) {\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.slice(0, 2), t, locale, {\n count: recipientsCount\n })}`}\n label={`${t('feed_private_post')}:\\n${\n formatListToLocaleString(recipientsList.slice(0, 2), 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('feed_post_actions_menu')}\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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeedRichText.d.ts","sourceRoot":"","sources":["../../../src/components/Feed/FeedRichText.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAiD,MAAM,OAAO,CAAC;AAE1E,OAAO,EAAO,YAAY,
|
|
1
|
+
{"version":3,"file":"FeedRichText.d.ts","sourceRoot":"","sources":["../../../src/components/Feed/FeedRichText.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAiD,MAAM,OAAO,CAAC;AAE1E,OAAO,EAAO,YAAY,EAAiB,MAAM,yBAAyB,CAAC;AAQ3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,QAAA,MAAM,YAAY,EAAE,EAAE,CAAC,iBAAiB,GAAG,YAAY,CA4LrD,CAAC;AAEH,eAAe,YAAY,CAAC"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useContext, forwardRef, useState, useRef } from 'react';
|
|
3
|
-
import { cap, useI18n } from '@pega/cosmos-react-core';
|
|
3
|
+
import { cap, Icon, useI18n } from '@pega/cosmos-react-core';
|
|
4
4
|
import { getXMLAttributes, RichTextEditor } from '@pega/cosmos-react-rte';
|
|
5
5
|
import { MentionButtonConfig } from '../MentionButton';
|
|
6
6
|
import { HashtagButtonConfig } from '../HashtagButton';
|
|
7
|
+
import { AutopilotConfig } from '../Autopilot';
|
|
7
8
|
import { FeedContext } from './Feed.context';
|
|
8
9
|
const FeedRichText = forwardRef(function FeedRichText(props, ref) {
|
|
9
10
|
const { height = { min: 'auto' }, ...restProps } = props;
|
|
10
|
-
const { searchTypes = [], onSearch, searchResults = [], showSearchResults } = useContext(FeedContext);
|
|
11
|
+
const { enableAutopilot, searchTypes = [], onSearch, searchResults = [], showSearchResults } = useContext(FeedContext);
|
|
11
12
|
const [triggerType, setTriggerType] = useState('mention');
|
|
12
13
|
const [showMentionType, setShowMentionType] = useState(false);
|
|
13
14
|
const searchType = useRef('');
|
|
@@ -15,14 +16,26 @@ const FeedRichText = forwardRef(function FeedRichText(props, ref) {
|
|
|
15
16
|
const onDecoSearch = (event) => {
|
|
16
17
|
const trigger = event.trigger === '@' ? 'mention' : 'tag';
|
|
17
18
|
setTriggerType(trigger);
|
|
18
|
-
if (trigger === 'mention' &&
|
|
19
|
+
if (trigger === 'mention' &&
|
|
20
|
+
(event.search === '' ||
|
|
21
|
+
(enableAutopilot && 'autopilot'.startsWith(event.search.toLowerCase())))) {
|
|
19
22
|
setShowMentionType(true);
|
|
20
23
|
}
|
|
21
24
|
else {
|
|
22
25
|
setShowMentionType(false);
|
|
23
|
-
|
|
26
|
+
if (searchType.current === 'Autopilot' && searchTypes[1]) {
|
|
27
|
+
searchType.current = searchTypes[1];
|
|
28
|
+
}
|
|
29
|
+
onSearch?.({
|
|
30
|
+
type: trigger,
|
|
31
|
+
search: event.search,
|
|
32
|
+
mentionType: searchType.current
|
|
33
|
+
});
|
|
24
34
|
}
|
|
25
35
|
};
|
|
36
|
+
if (enableAutopilot && !searchTypes.some(type => type === 'Autopilot')) {
|
|
37
|
+
searchTypes.unshift('Autopilot');
|
|
38
|
+
}
|
|
26
39
|
const typesMenu = {
|
|
27
40
|
onItemActive: (id) => {
|
|
28
41
|
searchType.current = id;
|
|
@@ -30,10 +43,16 @@ const FeedRichText = forwardRef(function FeedRichText(props, ref) {
|
|
|
30
43
|
onItemClick: (id) => {
|
|
31
44
|
searchType.current = id;
|
|
32
45
|
setShowMentionType(false);
|
|
33
|
-
|
|
46
|
+
if (id !== 'Autopilot') {
|
|
47
|
+
onSearch?.({ type: 'mention', search: '', mentionType: id });
|
|
48
|
+
}
|
|
34
49
|
},
|
|
35
50
|
items: searchTypes.map(type => {
|
|
36
|
-
return {
|
|
51
|
+
return {
|
|
52
|
+
id: type,
|
|
53
|
+
primary: cap(type),
|
|
54
|
+
visual: _jsx(Icon, { name: type === 'Autopilot' ? 'polaris' : type })
|
|
55
|
+
};
|
|
37
56
|
})
|
|
38
57
|
};
|
|
39
58
|
const searchMenu = searchResults.length && showSearchResults
|
|
@@ -68,6 +87,17 @@ const FeedRichText = forwardRef(function FeedRichText(props, ref) {
|
|
|
68
87
|
text: attributes.tag
|
|
69
88
|
};
|
|
70
89
|
}
|
|
90
|
+
case 'pega-autopilot': {
|
|
91
|
+
const attributes = getXMLAttributes(searchResult);
|
|
92
|
+
if (!attributes)
|
|
93
|
+
return;
|
|
94
|
+
return {
|
|
95
|
+
markdown: searchResult,
|
|
96
|
+
component: AutopilotConfig.component,
|
|
97
|
+
props: attributes,
|
|
98
|
+
text: 'Autopilot'
|
|
99
|
+
};
|
|
100
|
+
}
|
|
71
101
|
default:
|
|
72
102
|
}
|
|
73
103
|
};
|
|
@@ -75,6 +105,14 @@ const FeedRichText = forwardRef(function FeedRichText(props, ref) {
|
|
|
75
105
|
{ trigger: '@', regex: String.raw `(?:\S+(?:[^\n\S][^@#\s]\S*)*[^\n\S]?|)` },
|
|
76
106
|
{ trigger: '#', regex: String.raw `[^\s,]*` }
|
|
77
107
|
], getSearchItemReplacement: (id) => {
|
|
108
|
+
if (id === 'Autopilot') {
|
|
109
|
+
return {
|
|
110
|
+
markdown: AutopilotConfig.inject(),
|
|
111
|
+
component: AutopilotConfig.component,
|
|
112
|
+
props: {},
|
|
113
|
+
text: 'Autopilot'
|
|
114
|
+
};
|
|
115
|
+
}
|
|
78
116
|
const item = searchResults?.find(({ id: itemId }) => itemId === id);
|
|
79
117
|
if (!item)
|
|
80
118
|
return undefined;
|
|
@@ -112,6 +150,12 @@ const FeedRichText = forwardRef(function FeedRichText(props, ref) {
|
|
|
112
150
|
xmlElement: HashtagButtonConfig.xmlElement,
|
|
113
151
|
regexPattern: HashtagButtonConfig.regexPattern,
|
|
114
152
|
getSearchAttributes
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
type: AutopilotConfig.type,
|
|
156
|
+
xmlElement: AutopilotConfig.xmlElement,
|
|
157
|
+
regexPattern: AutopilotConfig.regexPattern,
|
|
158
|
+
getSearchAttributes
|
|
115
159
|
}
|
|
116
160
|
], onSearch: onDecoSearch, menu: showMentionType ? typesMenu : searchMenu }));
|
|
117
161
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeedRichText.js","sourceRoot":"","sources":["../../../src/components/Feed/FeedRichText.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAM,UAAU,EAAE,UAAU,EAAO,QAAQ,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE1E,OAAO,EAAE,GAAG,EAAgB,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAuB,MAAM,wBAAwB,CAAC;AAE/F,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG7C,MAAM,YAAY,GAAyC,UAAU,CAAC,SAAS,YAAY,CACzF,KAAwB,EACxB,GAA6B;IAE7B,MAAM,EAAE,MAAM,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC;IACzD,MAAM,EACJ,WAAW,GAAG,EAAE,EAChB,QAAQ,EACR,aAAa,GAAG,EAAE,EAClB,iBAAiB,EAClB,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;IAC5B,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAoB,SAAS,CAAC,CAAC;IAC7E,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9D,MAAM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C,YAAY,EAAE,mBAAmB,CAAC,YAAY;gBAC9C,mBAAmB;aACpB;YACD;gBACE,IAAI,EAAE,mBAAmB,CAAC,IAAI;gBAC9B,UAAU,EAAE,mBAAmB,CAAC,UAAU;gBAC1C,YAAY,EAAE,mBAAmB,CAAC,YAAY;gBAC9C,mBAAmB;aACpB;SACF,EACD,QAAQ,EAAE,YAAY,EACtB,IAAI,EAAE,eAAe,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,GAC9C,CACH,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,YAAY,CAAC","sourcesContent":["import { FC, useContext, forwardRef, Ref, useState, useRef } from 'react';\n\nimport { cap, ForwardProps, useI18n } from '@pega/cosmos-react-core';\nimport { getXMLAttributes, RichTextEditor, RichTextEditorState } from '@pega/cosmos-react-rte';\n\nimport { MentionButtonConfig } from '../MentionButton';\nimport { HashtagButtonConfig } from '../HashtagButton';\n\nimport { FeedContext } from './Feed.context';\nimport { FeedRichTextProps } from './Feed.types';\n\nconst FeedRichText: FC<FeedRichTextProps & ForwardProps> = forwardRef(function FeedRichText(\n props: FeedRichTextProps,\n ref: Ref<RichTextEditorState>\n) {\n const { height = { min: 'auto' }, ...restProps } = props;\n const {\n searchTypes = [],\n onSearch,\n searchResults = [],\n showSearchResults\n } = useContext(FeedContext);\n const [triggerType, setTriggerType] = useState<'mention' | 'tag'>('mention');\n const [showMentionType, setShowMentionType] = useState(false);\n const searchType = useRef('');\n const t = useI18n();\n\n const onDecoSearch = (event: { search: string; trigger: string }) => {\n const trigger = event.trigger === '@' ? 'mention' : 'tag';\n setTriggerType(trigger);\n if (trigger === 'mention' && event.search === '') {\n setShowMentionType(true);\n } else {\n setShowMentionType(false);\n onSearch?.({ type: trigger, search: event.search, mentionType: searchType.current });\n }\n };\n\n const typesMenu = {\n onItemActive: (id: string) => {\n searchType.current = id;\n },\n onItemClick: (id: string) => {\n searchType.current = id;\n setShowMentionType(false);\n onSearch?.({ type: 'mention', search: '', mentionType: id });\n },\n items: searchTypes.map(type => {\n return { id: type, primary: cap(type) };\n })\n };\n\n const searchMenu =\n searchResults.length && showSearchResults\n ? {\n header: triggerType === 'mention' ? t('mention_type', [searchType.current]) : '',\n items: searchResults.map(res => {\n return { ...res, href: undefined };\n })\n }\n : undefined;\n\n const getSearchAttributes = (xmlElement: string, searchResult: string) => {\n switch (xmlElement) {\n case 'pega-mention': {\n const attributes = getXMLAttributes(searchResult);\n\n if (!attributes) return;\n return {\n markdown: searchResult,\n component: MentionButtonConfig.component,\n props: attributes,\n text: attributes.text\n };\n }\n case 'pega-tag': {\n const attributes = getXMLAttributes(searchResult);\n\n if (!attributes) return;\n return {\n markdown: searchResult,\n component: HashtagButtonConfig.component,\n props: attributes,\n text: attributes.tag\n };\n }\n default:\n }\n };\n\n return (\n <RichTextEditor\n {...restProps}\n markdownOnly\n ref={ref}\n height={height}\n searchTriggers={[\n { trigger: '@', regex: String.raw`(?:\\S+(?:[^\\n\\S][^@#\\s]\\S*)*[^\\n\\S]?|)` },\n { trigger: '#', regex: String.raw`[^\\s,]*` }\n ]}\n getSearchItemReplacement={(id: string) => {\n const item = searchResults?.find(({ id: itemId }) => itemId === id);\n\n if (!item) return undefined;\n\n return {\n markdown:\n triggerType === 'mention'\n ? MentionButtonConfig.inject({\n id: item.id,\n type: searchType.current,\n text: item.primary,\n href: item.href\n })\n : HashtagButtonConfig.inject({ tag: item.id }),\n component:\n triggerType === 'mention'\n ? MentionButtonConfig.component\n : HashtagButtonConfig.component,\n props:\n triggerType === 'mention'\n ? {\n id: item.id,\n text: item.primary,\n type: searchType.current,\n tabIndex: -1\n }\n : { tag: item.primary, tabIndex: -1 },\n text: item.primary\n };\n }}\n searchRenderers={[\n {\n type: MentionButtonConfig.type,\n xmlElement: MentionButtonConfig.xmlElement,\n regexPattern: MentionButtonConfig.regexPattern,\n getSearchAttributes\n },\n {\n type: HashtagButtonConfig.type,\n xmlElement: HashtagButtonConfig.xmlElement,\n regexPattern: HashtagButtonConfig.regexPattern,\n getSearchAttributes\n }\n ]}\n onSearch={onDecoSearch}\n menu={showMentionType ? typesMenu : searchMenu}\n />\n );\n});\n\nexport default FeedRichText;\n"]}
|
|
1
|
+
{"version":3,"file":"FeedRichText.js","sourceRoot":"","sources":["../../../src/components/Feed/FeedRichText.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAM,UAAU,EAAE,UAAU,EAAO,QAAQ,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE1E,OAAO,EAAE,GAAG,EAAgB,IAAI,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAuB,MAAM,wBAAwB,CAAC;AAE/F,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG7C,MAAM,YAAY,GAAyC,UAAU,CAAC,SAAS,YAAY,CACzF,KAAwB,EACxB,GAA6B;IAE7B,MAAM,EAAE,MAAM,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC;IACzD,MAAM,EACJ,eAAe,EACf,WAAW,GAAG,EAAE,EAChB,QAAQ,EACR,aAAa,GAAG,EAAE,EAClB,iBAAiB,EAClB,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;IAC5B,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAoB,SAAS,CAAC,CAAC;IAC7E,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9D,MAAM,UAAU,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;IAC9B,MAAM,CAAC,GAAG,OAAO,EAAE,CA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Ae,CAAC,UAAU;gBACtC,YAAY,EAAE,eAAe,CAAC,YAAY;gBAC1C,mBAAmB;aACpB;SACF,EACD,QAAQ,EAAE,YAAY,EACtB,IAAI,EAAE,eAAe,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,GAC9C,CACH,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,YAAY,CAAC","sourcesContent":["import { FC, useContext, forwardRef, Ref, useState, useRef } from 'react';\n\nimport { cap, ForwardProps, Icon, useI18n } from '@pega/cosmos-react-core';\nimport { getXMLAttributes, RichTextEditor, RichTextEditorState } from '@pega/cosmos-react-rte';\n\nimport { MentionButtonConfig } from '../MentionButton';\nimport { HashtagButtonConfig } from '../HashtagButton';\nimport { AutopilotConfig } from '../Autopilot';\n\nimport { FeedContext } from './Feed.context';\nimport { FeedRichTextProps } from './Feed.types';\n\nconst FeedRichText: FC<FeedRichTextProps & ForwardProps> = forwardRef(function FeedRichText(\n props: FeedRichTextProps,\n ref: Ref<RichTextEditorState>\n) {\n const { height = { min: 'auto' }, ...restProps } = props;\n const {\n enableAutopilot,\n searchTypes = [],\n onSearch,\n searchResults = [],\n showSearchResults\n } = useContext(FeedContext);\n const [triggerType, setTriggerType] = useState<'mention' | 'tag'>('mention');\n const [showMentionType, setShowMentionType] = useState(false);\n const searchType = useRef('');\n const t = useI18n();\n\n const onDecoSearch = (event: { search: string; trigger: string }) => {\n const trigger = event.trigger === '@' ? 'mention' : 'tag';\n setTriggerType(trigger);\n if (\n trigger === 'mention' &&\n (event.search === '' ||\n (enableAutopilot && 'autopilot'.startsWith(event.search.toLowerCase())))\n ) {\n setShowMentionType(true);\n } else {\n setShowMentionType(false);\n if (searchType.current === 'Autopilot' && searchTypes[1]) {\n searchType.current = searchTypes[1];\n }\n\n onSearch?.({\n type: trigger,\n search: event.search,\n mentionType: searchType.current\n });\n }\n };\n\n if (enableAutopilot && !searchTypes.some(type => type === 'Autopilot')) {\n searchTypes.unshift('Autopilot');\n }\n\n const typesMenu = {\n onItemActive: (id: string) => {\n searchType.current = id;\n },\n onItemClick: (id: string) => {\n searchType.current = id;\n setShowMentionType(false);\n\n if (id !== 'Autopilot') {\n onSearch?.({ type: 'mention', search: '', mentionType: id });\n }\n },\n items: searchTypes.map(type => {\n return {\n id: type,\n primary: cap(type),\n visual: <Icon name={type === 'Autopilot' ? 'polaris' : type} />\n };\n })\n };\n\n const searchMenu =\n searchResults.length && showSearchResults\n ? {\n header: triggerType === 'mention' ? t('mention_type', [searchType.current]) : '',\n items: searchResults.map(res => {\n return { ...res, href: undefined };\n })\n }\n : undefined;\n\n const getSearchAttributes = (xmlElement: string, searchResult: string) => {\n switch (xmlElement) {\n case 'pega-mention': {\n const attributes = getXMLAttributes(searchResult);\n\n if (!attributes) return;\n return {\n markdown: searchResult,\n component: MentionButtonConfig.component,\n props: attributes,\n text: attributes.text\n };\n }\n case 'pega-tag': {\n const attributes = getXMLAttributes(searchResult);\n\n if (!attributes) return;\n return {\n markdown: searchResult,\n component: HashtagButtonConfig.component,\n props: attributes,\n text: attributes.tag\n };\n }\n case 'pega-autopilot': {\n const attributes = getXMLAttributes(searchResult);\n\n if (!attributes) return;\n return {\n markdown: searchResult,\n component: AutopilotConfig.component,\n props: attributes,\n text: 'Autopilot'\n };\n }\n default:\n }\n };\n\n return (\n <RichTextEditor\n {...restProps}\n markdownOnly\n ref={ref}\n height={height}\n searchTriggers={[\n { trigger: '@', regex: String.raw`(?:\\S+(?:[^\\n\\S][^@#\\s]\\S*)*[^\\n\\S]?|)` },\n { trigger: '#', regex: String.raw`[^\\s,]*` }\n ]}\n getSearchItemReplacement={(id: string) => {\n if (id === 'Autopilot') {\n return {\n markdown: AutopilotConfig.inject(),\n component: AutopilotConfig.component,\n props: {},\n text: 'Autopilot'\n };\n }\n\n const item = searchResults?.find(({ id: itemId }) => itemId === id);\n\n if (!item) return undefined;\n\n return {\n markdown:\n triggerType === 'mention'\n ? MentionButtonConfig.inject({\n id: item.id,\n type: searchType.current,\n text: item.primary,\n href: item.href\n })\n : HashtagButtonConfig.inject({ tag: item.id }),\n component:\n triggerType === 'mention'\n ? MentionButtonConfig.component\n : HashtagButtonConfig.component,\n props:\n triggerType === 'mention'\n ? {\n id: item.id,\n text: item.primary,\n type: searchType.current,\n tabIndex: -1\n }\n : { tag: item.primary, tabIndex: -1 },\n text: item.primary\n };\n }}\n searchRenderers={[\n {\n type: MentionButtonConfig.type,\n xmlElement: MentionButtonConfig.xmlElement,\n regexPattern: MentionButtonConfig.regexPattern,\n getSearchAttributes\n },\n {\n type: HashtagButtonConfig.type,\n xmlElement: HashtagButtonConfig.xmlElement,\n regexPattern: HashtagButtonConfig.regexPattern,\n getSearchAttributes\n },\n {\n type: AutopilotConfig.type,\n xmlElement: AutopilotConfig.xmlElement,\n regexPattern: AutopilotConfig.regexPattern,\n getSearchAttributes\n }\n ]}\n onSearch={onDecoSearch}\n menu={showMentionType ? typesMenu : searchMenu}\n />\n );\n});\n\nexport default FeedRichText;\n"]}
|
package/lib/index.d.ts
CHANGED
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACpD,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACtD,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACpD,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACtE,cAAc,4BAA4B,CAAC;AAC3C,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACtE,cAAc,4BAA4B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACpD,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACtD,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACpD,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACtE,cAAc,4BAA4B,CAAC;AAC3C,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACtE,cAAc,4BAA4B,CAAC"}
|
package/lib/index.js
CHANGED
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACpD,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACtD,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACpD,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACtE,cAAc,4BAA4B,CAAC;AAC3C,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACtE,cAAc,4BAA4B,CAAC","sourcesContent":["// This file is autogenerated. Any changes will be overwritten.\nexport { default as Chat } from './components/Chat';\nexport * from './components/Chat';\nexport { default as Email } from './components/Email';\nexport * from './components/Email';\nexport { default as Feed } from './components/Feed';\nexport * from './components/Feed';\nexport { default as HashtagButton } from './components/HashtagButton';\nexport * from './components/HashtagButton';\nexport { default as MentionButton } from './components/MentionButton';\nexport * from './components/MentionButton';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACpD,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACtD,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACpD,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACtE,cAAc,4BAA4B,CAAC;AAC3C,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACtE,cAAc,4BAA4B,CAAC","sourcesContent":["// This file is autogenerated. Any changes will be overwritten.\nexport * from './components/Autopilot';\nexport { default as Chat } from './components/Chat';\nexport * from './components/Chat';\nexport { default as Email } from './components/Email';\nexport * from './components/Email';\nexport { default as Feed } from './components/Feed';\nexport * from './components/Feed';\nexport { default as HashtagButton } from './components/HashtagButton';\nexport * from './components/HashtagButton';\nexport { default as MentionButton } from './components/MentionButton';\nexport * from './components/MentionButton';\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pega/cosmos-react-social",
|
|
3
|
-
"version": "5.0.0-dev.4.
|
|
3
|
+
"version": "5.0.0-dev.4.7",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/pegasystems/cosmos-react.git",
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"build": "tsc -b"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@pega/cosmos-react-core": "5.0.0-dev.4.
|
|
27
|
-
"@pega/cosmos-react-rte": "5.0.0-dev.4.
|
|
28
|
-
"@pega/cosmos-react-work": "5.0.0-dev.4.
|
|
26
|
+
"@pega/cosmos-react-core": "5.0.0-dev.4.7",
|
|
27
|
+
"@pega/cosmos-react-rte": "5.0.0-dev.4.7",
|
|
28
|
+
"@pega/cosmos-react-work": "5.0.0-dev.4.7",
|
|
29
29
|
"@types/parse5": "^6.0.0",
|
|
30
30
|
"@types/react": "^17.0.62",
|
|
31
31
|
"@types/react-dom": "^17.0.20",
|