@pega/cosmos-react-social 5.0.0-dev.4.6 → 5.0.0-dev.4.8
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/package.json +4 -4
- package/lib/components/Autopilot/Autopilot.d.ts +0 -15
- package/lib/components/Autopilot/Autopilot.d.ts.map +0 -1
- package/lib/components/Autopilot/Autopilot.js +0 -50
- package/lib/components/Autopilot/Autopilot.js.map +0 -1
- package/lib/components/Autopilot/AutopilotAvatar.d.ts +0 -8
- package/lib/components/Autopilot/AutopilotAvatar.d.ts.map +0 -1
- package/lib/components/Autopilot/AutopilotAvatar.js +0 -11
- package/lib/components/Autopilot/AutopilotAvatar.js.map +0 -1
- package/lib/components/Autopilot/AutopilotGlimpse.d.ts +0 -9
- package/lib/components/Autopilot/AutopilotGlimpse.d.ts.map +0 -1
- package/lib/components/Autopilot/AutopilotGlimpse.js +0 -24
- package/lib/components/Autopilot/AutopilotGlimpse.js.map +0 -1
- package/lib/components/Autopilot/index.d.ts +0 -4
- package/lib/components/Autopilot/index.d.ts.map +0 -1
- package/lib/components/Autopilot/index.js +0 -3
- package/lib/components/Autopilot/index.js.map +0 -1
- package/lib/components/Chat/Chat.d.ts +0 -29
- package/lib/components/Chat/Chat.d.ts.map +0 -1
- package/lib/components/Chat/Chat.js +0 -64
- package/lib/components/Chat/Chat.js.map +0 -1
- package/lib/components/Chat/Chat.types.d.ts +0 -136
- package/lib/components/Chat/Chat.types.d.ts.map +0 -1
- package/lib/components/Chat/Chat.types.js +0 -10
- package/lib/components/Chat/Chat.types.js.map +0 -1
- package/lib/components/Chat/ChatBody.d.ts +0 -7
- package/lib/components/Chat/ChatBody.d.ts.map +0 -1
- package/lib/components/Chat/ChatBody.js +0 -292
- package/lib/components/Chat/ChatBody.js.map +0 -1
- package/lib/components/Chat/ChatComposer.d.ts +0 -50
- package/lib/components/Chat/ChatComposer.d.ts.map +0 -1
- package/lib/components/Chat/ChatComposer.js +0 -221
- package/lib/components/Chat/ChatComposer.js.map +0 -1
- package/lib/components/Chat/ChatHeader.d.ts +0 -29
- package/lib/components/Chat/ChatHeader.d.ts.map +0 -1
- package/lib/components/Chat/ChatHeader.js +0 -44
- package/lib/components/Chat/ChatHeader.js.map +0 -1
- package/lib/components/Chat/ChatSettingsPanel.d.ts +0 -7
- package/lib/components/Chat/ChatSettingsPanel.d.ts.map +0 -1
- package/lib/components/Chat/ChatSettingsPanel.js +0 -15
- package/lib/components/Chat/ChatSettingsPanel.js.map +0 -1
- package/lib/components/Chat/ChatSettingsPanel.styles.d.ts +0 -16
- package/lib/components/Chat/ChatSettingsPanel.styles.d.ts.map +0 -1
- package/lib/components/Chat/ChatSettingsPanel.styles.js +0 -47
- package/lib/components/Chat/ChatSettingsPanel.styles.js.map +0 -1
- package/lib/components/Chat/Message.d.ts +0 -6
- package/lib/components/Chat/Message.d.ts.map +0 -1
- package/lib/components/Chat/Message.js +0 -98
- package/lib/components/Chat/Message.js.map +0 -1
- package/lib/components/Chat/Message.styles.d.ts +0 -43
- package/lib/components/Chat/Message.styles.d.ts.map +0 -1
- package/lib/components/Chat/Message.styles.js +0 -270
- package/lib/components/Chat/Message.styles.js.map +0 -1
- package/lib/components/Chat/SuggestedReplyPicker.d.ts +0 -42
- package/lib/components/Chat/SuggestedReplyPicker.d.ts.map +0 -1
- package/lib/components/Chat/SuggestedReplyPicker.js +0 -143
- package/lib/components/Chat/SuggestedReplyPicker.js.map +0 -1
- package/lib/components/Chat/SystemMessage.d.ts +0 -8
- package/lib/components/Chat/SystemMessage.d.ts.map +0 -1
- package/lib/components/Chat/SystemMessage.js +0 -50
- package/lib/components/Chat/SystemMessage.js.map +0 -1
- package/lib/components/Chat/TypeIndicator.d.ts +0 -6
- package/lib/components/Chat/TypeIndicator.d.ts.map +0 -1
- package/lib/components/Chat/TypeIndicator.js +0 -12
- package/lib/components/Chat/TypeIndicator.js.map +0 -1
- package/lib/components/Chat/index.d.ts +0 -15
- package/lib/components/Chat/index.d.ts.map +0 -1
- package/lib/components/Chat/index.js +0 -10
- package/lib/components/Chat/index.js.map +0 -1
- package/lib/components/Email/ContextMenuPopover.d.ts +0 -5
- package/lib/components/Email/ContextMenuPopover.d.ts.map +0 -1
- package/lib/components/Email/ContextMenuPopover.js +0 -53
- package/lib/components/Email/ContextMenuPopover.js.map +0 -1
- package/lib/components/Email/Email.d.ts +0 -7
- package/lib/components/Email/Email.d.ts.map +0 -1
- package/lib/components/Email/Email.js +0 -244
- package/lib/components/Email/Email.js.map +0 -1
- package/lib/components/Email/Email.styles.d.ts +0 -67
- package/lib/components/Email/Email.styles.d.ts.map +0 -1
- package/lib/components/Email/Email.styles.js +0 -392
- package/lib/components/Email/Email.styles.js.map +0 -1
- package/lib/components/Email/Email.types.d.ts +0 -394
- package/lib/components/Email/Email.types.d.ts.map +0 -1
- package/lib/components/Email/Email.types.js +0 -2
- package/lib/components/Email/Email.types.js.map +0 -1
- package/lib/components/Email/EmailCaseView.d.ts +0 -6
- package/lib/components/Email/EmailCaseView.d.ts.map +0 -1
- package/lib/components/Email/EmailCaseView.js +0 -36
- package/lib/components/Email/EmailCaseView.js.map +0 -1
- package/lib/components/Email/EmailComposer.d.ts +0 -10
- package/lib/components/Email/EmailComposer.d.ts.map +0 -1
- package/lib/components/Email/EmailComposer.js +0 -255
- package/lib/components/Email/EmailComposer.js.map +0 -1
- package/lib/components/Email/EmailConversation.d.ts +0 -17
- package/lib/components/Email/EmailConversation.d.ts.map +0 -1
- package/lib/components/Email/EmailConversation.js +0 -174
- package/lib/components/Email/EmailConversation.js.map +0 -1
- package/lib/components/Email/EmailEntity.d.ts +0 -11
- package/lib/components/Email/EmailEntity.d.ts.map +0 -1
- package/lib/components/Email/EmailEntity.js +0 -51
- package/lib/components/Email/EmailEntity.js.map +0 -1
- package/lib/components/Email/EmailManager.d.ts +0 -6
- package/lib/components/Email/EmailManager.d.ts.map +0 -1
- package/lib/components/Email/EmailManager.js +0 -21
- package/lib/components/Email/EmailManager.js.map +0 -1
- package/lib/components/Email/EmailNotificationPanel.d.ts +0 -7
- package/lib/components/Email/EmailNotificationPanel.d.ts.map +0 -1
- package/lib/components/Email/EmailNotificationPanel.js +0 -15
- package/lib/components/Email/EmailNotificationPanel.js.map +0 -1
- package/lib/components/Email/EmailSelector.d.ts +0 -22
- package/lib/components/Email/EmailSelector.d.ts.map +0 -1
- package/lib/components/Email/EmailSelector.js +0 -121
- package/lib/components/Email/EmailSelector.js.map +0 -1
- package/lib/components/Email/EmailShell.d.ts +0 -6
- package/lib/components/Email/EmailShell.d.ts.map +0 -1
- package/lib/components/Email/EmailShell.js +0 -46
- package/lib/components/Email/EmailShell.js.map +0 -1
- package/lib/components/Email/EmailSummaryItem.d.ts +0 -11
- package/lib/components/Email/EmailSummaryItem.d.ts.map +0 -1
- package/lib/components/Email/EmailSummaryItem.js +0 -118
- package/lib/components/Email/EmailSummaryItem.js.map +0 -1
- package/lib/components/Email/EmailSummaryList.d.ts +0 -6
- package/lib/components/Email/EmailSummaryList.d.ts.map +0 -1
- package/lib/components/Email/EmailSummaryList.js +0 -95
- package/lib/components/Email/EmailSummaryList.js.map +0 -1
- package/lib/components/Email/EntityList.d.ts +0 -6
- package/lib/components/Email/EntityList.d.ts.map +0 -1
- package/lib/components/Email/EntityList.js +0 -74
- package/lib/components/Email/EntityList.js.map +0 -1
- package/lib/components/Email/index.d.ts +0 -13
- package/lib/components/Email/index.d.ts.map +0 -1
- package/lib/components/Email/index.js +0 -12
- package/lib/components/Email/index.js.map +0 -1
- package/lib/components/Email/utils/EntityHighlighter.d.ts +0 -10
- package/lib/components/Email/utils/EntityHighlighter.d.ts.map +0 -1
- package/lib/components/Email/utils/EntityHighlighter.js +0 -260
- package/lib/components/Email/utils/EntityHighlighter.js.map +0 -1
- package/lib/components/Feed/Feed.context.d.ts +0 -51
- package/lib/components/Feed/Feed.context.d.ts.map +0 -1
- package/lib/components/Feed/Feed.context.js +0 -10
- package/lib/components/Feed/Feed.context.js.map +0 -1
- package/lib/components/Feed/Feed.d.ts +0 -6
- package/lib/components/Feed/Feed.d.ts.map +0 -1
- package/lib/components/Feed/Feed.js +0 -149
- package/lib/components/Feed/Feed.js.map +0 -1
- package/lib/components/Feed/Feed.types.d.ts +0 -334
- package/lib/components/Feed/Feed.types.d.ts.map +0 -1
- package/lib/components/Feed/Feed.types.js +0 -2
- package/lib/components/Feed/Feed.types.js.map +0 -1
- package/lib/components/Feed/FeedAnnouncer.d.ts +0 -6
- package/lib/components/Feed/FeedAnnouncer.d.ts.map +0 -1
- package/lib/components/Feed/FeedAnnouncer.js +0 -11
- package/lib/components/Feed/FeedAnnouncer.js.map +0 -1
- package/lib/components/Feed/FeedAttachments.d.ts +0 -8
- package/lib/components/Feed/FeedAttachments.d.ts.map +0 -1
- package/lib/components/Feed/FeedAttachments.js +0 -97
- package/lib/components/Feed/FeedAttachments.js.map +0 -1
- package/lib/components/Feed/FeedButton.d.ts +0 -5
- package/lib/components/Feed/FeedButton.d.ts.map +0 -1
- package/lib/components/Feed/FeedButton.js +0 -15
- package/lib/components/Feed/FeedButton.js.map +0 -1
- package/lib/components/Feed/FeedContent.d.ts +0 -6
- package/lib/components/Feed/FeedContent.d.ts.map +0 -1
- package/lib/components/Feed/FeedContent.js +0 -46
- package/lib/components/Feed/FeedContent.js.map +0 -1
- package/lib/components/Feed/FeedContentFooter.d.ts +0 -5
- package/lib/components/Feed/FeedContentFooter.d.ts.map +0 -1
- package/lib/components/Feed/FeedContentFooter.js +0 -34
- package/lib/components/Feed/FeedContentFooter.js.map +0 -1
- package/lib/components/Feed/FeedContentHeader.d.ts +0 -5
- package/lib/components/Feed/FeedContentHeader.d.ts.map +0 -1
- package/lib/components/Feed/FeedContentHeader.js +0 -107
- package/lib/components/Feed/FeedContentHeader.js.map +0 -1
- package/lib/components/Feed/FeedEditRegion.d.ts +0 -6
- package/lib/components/Feed/FeedEditRegion.d.ts.map +0 -1
- package/lib/components/Feed/FeedEditRegion.js +0 -57
- package/lib/components/Feed/FeedEditRegion.js.map +0 -1
- package/lib/components/Feed/FeedInputRegion.d.ts +0 -8
- package/lib/components/Feed/FeedInputRegion.d.ts.map +0 -1
- package/lib/components/Feed/FeedInputRegion.js +0 -86
- package/lib/components/Feed/FeedInputRegion.js.map +0 -1
- package/lib/components/Feed/FeedLikeButton.d.ts +0 -7
- package/lib/components/Feed/FeedLikeButton.d.ts.map +0 -1
- package/lib/components/Feed/FeedLikeButton.js +0 -102
- package/lib/components/Feed/FeedLikeButton.js.map +0 -1
- package/lib/components/Feed/FeedModalList.d.ts +0 -5
- package/lib/components/Feed/FeedModalList.d.ts.map +0 -1
- package/lib/components/Feed/FeedModalList.js +0 -39
- package/lib/components/Feed/FeedModalList.js.map +0 -1
- package/lib/components/Feed/FeedNewPost.d.ts +0 -7
- package/lib/components/Feed/FeedNewPost.d.ts.map +0 -1
- package/lib/components/Feed/FeedNewPost.js +0 -30
- package/lib/components/Feed/FeedNewPost.js.map +0 -1
- package/lib/components/Feed/FeedNewPostTypeMenu.d.ts +0 -6
- package/lib/components/Feed/FeedNewPostTypeMenu.d.ts.map +0 -1
- package/lib/components/Feed/FeedNewPostTypeMenu.js +0 -375
- package/lib/components/Feed/FeedNewPostTypeMenu.js.map +0 -1
- package/lib/components/Feed/FeedPost.d.ts +0 -8
- package/lib/components/Feed/FeedPost.d.ts.map +0 -1
- package/lib/components/Feed/FeedPost.js +0 -85
- package/lib/components/Feed/FeedPost.js.map +0 -1
- package/lib/components/Feed/FeedReply.d.ts +0 -7
- package/lib/components/Feed/FeedReply.d.ts.map +0 -1
- package/lib/components/Feed/FeedReply.js +0 -36
- package/lib/components/Feed/FeedReply.js.map +0 -1
- package/lib/components/Feed/FeedReplyInput.d.ts +0 -7
- package/lib/components/Feed/FeedReplyInput.d.ts.map +0 -1
- package/lib/components/Feed/FeedReplyInput.js +0 -21
- package/lib/components/Feed/FeedReplyInput.js.map +0 -1
- package/lib/components/Feed/FeedRichText.d.ts +0 -6
- package/lib/components/Feed/FeedRichText.d.ts.map +0 -1
- package/lib/components/Feed/FeedRichText.js +0 -163
- package/lib/components/Feed/FeedRichText.js.map +0 -1
- package/lib/components/Feed/index.d.ts +0 -7
- package/lib/components/Feed/index.d.ts.map +0 -1
- package/lib/components/Feed/index.js +0 -6
- package/lib/components/Feed/index.js.map +0 -1
- package/lib/components/HashtagButton/HashtagButton.d.ts +0 -23
- package/lib/components/HashtagButton/HashtagButton.d.ts.map +0 -1
- package/lib/components/HashtagButton/HashtagButton.js +0 -44
- package/lib/components/HashtagButton/HashtagButton.js.map +0 -1
- package/lib/components/HashtagButton/index.d.ts +0 -3
- package/lib/components/HashtagButton/index.d.ts.map +0 -1
- package/lib/components/HashtagButton/index.js +0 -3
- package/lib/components/HashtagButton/index.js.map +0 -1
- package/lib/components/MentionButton/MentionButton.d.ts +0 -35
- package/lib/components/MentionButton/MentionButton.d.ts.map +0 -1
- package/lib/components/MentionButton/MentionButton.js +0 -94
- package/lib/components/MentionButton/MentionButton.js.map +0 -1
- package/lib/components/MentionButton/index.d.ts +0 -3
- package/lib/components/MentionButton/index.d.ts.map +0 -1
- package/lib/components/MentionButton/index.js +0 -3
- package/lib/components/MentionButton/index.js.map +0 -1
- package/lib/index.d.ts +0 -12
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -13
- package/lib/index.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FeedReply.js","sourceRoot":"","sources":["../../../src/components/Feed/FeedReply.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAM,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,gBAAgB,EAAgB,MAAM,yBAAyB,CAAC;AAC7F,OAAO,KAAK,QAAQ,MAAM,6DAA6D,CAAC;AACxF,OAAO,KAAK,iBAAiB,MAAM,wEAAwE,CAAC;AAC5G,OAAO,KAAK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AgB,GAClC,CACH,CAAC,CAAC,CAAC,CACF,KAAC,WAAW,IAAC,gBAAgB,EAAE,gBAAgB,YAAG,OAAO,GAAe,CACzE,EACD,KAAC,eAAe,IAAC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,SAAG,IACnE,EAEP,KAAC,iBAAiB,IAChB,OAAO,EAAE,OAAO,EAChB,EAAE,EAAE,EAAE,EACN,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,SAAS,EACpB,mBAAmB,EAAE,mBAAmB,EACxC,YAAY,EAAE,YAAY,EAC1B,cAAc,EAAE,cAAc,EAC9B,WAAW,EAAE,WAAW,EACxB,sBAAsB,EAAE,sBAAsB,EAC9C,eAAe,EAAE,eAAe,GAChC,IACiB,IACI,CAC5B,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import { FC, useState } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { Flex, registerIcon, defaultThemeProp, ForwardProps } from '@pega/cosmos-react-core';\nimport * as chatIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/chat.icon';\nimport * as thumbsUpSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/thumbs-up-solid.icon';\nimport * as thumbsUpIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/thumbs-up.icon';\n\nimport { FeedReplyProps } from './Feed.types';\nimport FeedAttachments from './FeedAttachments';\nimport FeedContent from './FeedContent';\nimport FeedContentHeader from './FeedContentHeader';\nimport FeedContentFooter from './FeedContentFooter';\nimport FeedEditRegion from './FeedEditRegion';\n\nregisterIcon(chatIcon, thumbsUpSolidIcon, thumbsUpIcon);\n\nexport const StyledFeedReplyContainer = styled.div``;\n\nStyledFeedReplyContainer.defaultProps = defaultThemeProp;\n\nconst StyledReplyContent = styled.div(({ theme }) => {\n return css`\n margin-inline-start: calc(2 * ${theme.base.spacing});\n border-inline-start: solid 0.0625rem ${theme.base.palette['border-line']};\n padding-inline-start: calc(3 * ${theme.base.spacing});\n `;\n});\n\nStyledReplyContent.defaultProps = defaultThemeProp;\n\nconst FeedReply: FC<ForwardProps & FeedReplyProps> = (props: ForwardProps & FeedReplyProps) => {\n const {\n id,\n avatarSrc,\n postTimestamp,\n content,\n attachments,\n username,\n fullname,\n liked,\n likes,\n likeCount,\n interactionsEnabled,\n icon,\n userStatus,\n maxContentHeight = Infinity,\n menuItems,\n onEditSubmit,\n edited = false,\n editTimestamp,\n onMouseEnter,\n onMouseLeave,\n onCommentClick,\n onLikeClick,\n onLikeCountInteraction,\n onLoadMoreLikes,\n likesLoading,\n onUserClick,\n ...restProps\n } = props;\n const variant = 'reply';\n\n const [editMode, setEditMode] = useState(false);\n const [emptyEditText, setEmptyEditText] = useState(false);\n\n return (\n <StyledFeedReplyContainer\n onMouseEnter={() => {\n onMouseEnter?.({ id });\n }}\n onMouseLeave={() => {\n onMouseLeave?.({ id });\n }}\n {...restProps}\n >\n <FeedContentHeader\n variant={variant}\n id={id}\n fullname={fullname}\n username={username}\n postTimestamp={postTimestamp}\n content={content}\n avatarSrc={avatarSrc}\n icon={icon}\n userStatus={userStatus}\n menuItems={menuItems}\n edited={edited}\n editTimestamp={editTimestamp}\n onEditSubmit={onEditSubmit}\n onUserClick={onUserClick}\n setEditMode={setEditMode}\n />\n <StyledReplyContent>\n <Flex\n container={{ direction: 'column', pad: [0, editMode ? 0 : 2, 0, 0] }}\n item={{ grow: 1 }}\n >\n {editMode ? (\n <FeedEditRegion\n variant={variant}\n id={id}\n content={content}\n setEditMode={setEditMode}\n onEditSubmit={onEditSubmit}\n emptyEditText={emptyEditText}\n setEmptyEditText={setEmptyEditText}\n />\n ) : (\n <FeedContent maxContentHeight={maxContentHeight}>{content}</FeedContent>\n )}\n <FeedAttachments variant={variant} attachments={attachments} readOnly />\n </Flex>\n\n <FeedContentFooter\n variant={variant}\n id={id}\n username={username}\n liked={liked}\n likes={likes}\n likeCount={likeCount}\n interactionsEnabled={interactionsEnabled}\n likesLoading={likesLoading}\n onCommentClick={onCommentClick}\n onLikeClick={onLikeClick}\n onLikeCountInteraction={onLikeCountInteraction}\n onLoadMoreLikes={onLoadMoreLikes}\n />\n </StyledReplyContent>\n </StyledFeedReplyContainer>\n );\n};\n\nexport default FeedReply;\n"]}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
2
|
-
import { ForwardProps } from '@pega/cosmos-react-core';
|
|
3
|
-
import { FeedReplyInputProps } from './Feed.types';
|
|
4
|
-
export declare const StyledReplyInputContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
5
|
-
declare const FeedReplyInput: FC<ForwardProps & FeedReplyInputProps>;
|
|
6
|
-
export default FeedReplyInput;
|
|
7
|
-
//# sourceMappingURL=FeedReplyInput.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FeedReplyInput.d.ts","sourceRoot":"","sources":["../../../src/components/Feed/FeedReplyInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAqB,MAAM,OAAO,CAAC;AAG9C,OAAO,EAAkC,YAAY,EAAc,MAAM,yBAAyB,CAAC;AAKnG,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAKnD,eAAO,MAAM,yBAAyB,yGAAe,CAAC;AAItD,QAAA,MAAM,cAAc,EAAE,EAAE,CAAC,YAAY,GAAG,mBAAmB,CAwB1D,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useRef, useEffect } from 'react';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
|
-
import { registerIcon, defaultThemeProp, useElement } from '@pega/cosmos-react-core';
|
|
5
|
-
import * as sendIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/send.icon';
|
|
6
|
-
import * as paperClipIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/paper-clip.icon';
|
|
7
|
-
import FeedInputRegion from './FeedInputRegion';
|
|
8
|
-
registerIcon(sendIcon, paperClipIcon);
|
|
9
|
-
export const StyledReplyInputContainer = styled.div ``;
|
|
10
|
-
StyledReplyInputContainer.defaultProps = defaultThemeProp;
|
|
11
|
-
const FeedReplyInput = (props) => {
|
|
12
|
-
const { id, attachments, onFilesAdded, onSubmit, onSetInputRef, ...restProps } = props;
|
|
13
|
-
const rteRef = useRef();
|
|
14
|
-
const [newReplyEl, setNewReplyEl] = useElement();
|
|
15
|
-
useEffect(() => {
|
|
16
|
-
onSetInputRef?.({ ref: rteRef });
|
|
17
|
-
}, [rteRef]);
|
|
18
|
-
return (_jsx(StyledReplyInputContainer, { ref: setNewReplyEl, ...restProps, children: _jsx(FeedInputRegion, { variant: 'reply', id: id, attachments: attachments, onFilesAdded: onFilesAdded, onSubmit: onSubmit, inputRegionEl: newReplyEl, rteRef: rteRef }) }));
|
|
19
|
-
};
|
|
20
|
-
export default FeedReplyInput;
|
|
21
|
-
//# sourceMappingURL=FeedReplyInput.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FeedReplyInput.js","sourceRoot":"","sources":["../../../src/components/Feed/FeedReplyInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAM,MAAM,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAgB,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAEnG,OAAO,KAAK,QAAQ,MAAM,6DAA6D,CAAC;AACxF,OAAO,KAAK,aAAa,MAAM,mEAAmE,CAAC;AAGnG,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAEhD,YAAY,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;AAEtC,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC,GAAG,CAAA,EAAE,CAAC;AAEtD,yBAAyB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE1D,MAAM,cAAc,GAA2C,CAC7D,KAAyC,EACzC,EAAE;IACF,MAAM,EAAE,EAAE,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC;IACvF,MAAM,MAAM,GAAG,MAAM,EAAuB,CAAC;IAC7C,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,UAAU,EAAkB,CAAC;IAEjE,SAAS,CAAC,GAAG,EAAE;QACb,aAAa,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAC;IACnC,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAEb,OAAO,CACL,KAAC,yBAAyB,IAAC,GAAG,EAAE,aAAa,KAAM,SAAS,YAC1D,KAAC,eAAe,IACd,OAAO,EAAC,OAAO,EACf,EAAE,EAAE,EAAE,EACN,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,YAAY,EAC1B,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,UAAU,EACzB,MAAM,EAAE,MAAM,GACd,GACwB,CAC7B,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import { FC, useRef, useEffect } from 'react';\nimport styled from 'styled-components';\n\nimport { registerIcon, defaultThemeProp, ForwardProps, useElement } from '@pega/cosmos-react-core';\nimport { RichTextEditorState } from '@pega/cosmos-react-rte';\nimport * as sendIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/send.icon';\nimport * as paperClipIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/paper-clip.icon';\n\nimport { FeedReplyInputProps } from './Feed.types';\nimport FeedInputRegion from './FeedInputRegion';\n\nregisterIcon(sendIcon, paperClipIcon);\n\nexport const StyledReplyInputContainer = styled.div``;\n\nStyledReplyInputContainer.defaultProps = defaultThemeProp;\n\nconst FeedReplyInput: FC<ForwardProps & FeedReplyInputProps> = (\n props: ForwardProps & FeedReplyInputProps\n) => {\n const { id, attachments, onFilesAdded, onSubmit, onSetInputRef, ...restProps } = props;\n const rteRef = useRef<RichTextEditorState>();\n const [newReplyEl, setNewReplyEl] = useElement<HTMLDivElement>();\n\n useEffect(() => {\n onSetInputRef?.({ ref: rteRef });\n }, [rteRef]);\n\n return (\n <StyledReplyInputContainer ref={setNewReplyEl} {...restProps}>\n <FeedInputRegion\n variant='reply'\n id={id}\n attachments={attachments}\n onFilesAdded={onFilesAdded}\n onSubmit={onSubmit}\n inputRegionEl={newReplyEl}\n rteRef={rteRef}\n />\n </StyledReplyInputContainer>\n );\n};\n\nexport default FeedReplyInput;\n"]}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
2
|
-
import { ForwardProps } from '@pega/cosmos-react-core';
|
|
3
|
-
import { FeedRichTextProps } from './Feed.types';
|
|
4
|
-
declare const FeedRichText: FC<FeedRichTextProps & ForwardProps>;
|
|
5
|
-
export default FeedRichText;
|
|
6
|
-
//# sourceMappingURL=FeedRichText.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,163 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useContext, forwardRef, useState, useRef } from 'react';
|
|
3
|
-
import { cap, Icon, useI18n } from '@pega/cosmos-react-core';
|
|
4
|
-
import { getXMLAttributes, RichTextEditor } from '@pega/cosmos-react-rte';
|
|
5
|
-
import { MentionButtonConfig } from '../MentionButton';
|
|
6
|
-
import { HashtagButtonConfig } from '../HashtagButton';
|
|
7
|
-
import { AutopilotConfig } from '../Autopilot';
|
|
8
|
-
import { FeedContext } from './Feed.context';
|
|
9
|
-
const FeedRichText = forwardRef(function FeedRichText(props, ref) {
|
|
10
|
-
const { height = { min: 'auto' }, ...restProps } = props;
|
|
11
|
-
const { enableAutopilot, searchTypes = [], onSearch, searchResults = [], showSearchResults } = useContext(FeedContext);
|
|
12
|
-
const [triggerType, setTriggerType] = useState('mention');
|
|
13
|
-
const [showMentionType, setShowMentionType] = useState(false);
|
|
14
|
-
const searchType = useRef('');
|
|
15
|
-
const t = useI18n();
|
|
16
|
-
const onDecoSearch = (event) => {
|
|
17
|
-
const trigger = event.trigger === '@' ? 'mention' : 'tag';
|
|
18
|
-
setTriggerType(trigger);
|
|
19
|
-
if (trigger === 'mention' &&
|
|
20
|
-
(event.search === '' ||
|
|
21
|
-
(enableAutopilot && 'autopilot'.startsWith(event.search.toLowerCase())))) {
|
|
22
|
-
setShowMentionType(true);
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
setShowMentionType(false);
|
|
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
|
-
});
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
if (enableAutopilot && !searchTypes.some(type => type === 'Autopilot')) {
|
|
37
|
-
searchTypes.unshift('Autopilot');
|
|
38
|
-
}
|
|
39
|
-
const typesMenu = {
|
|
40
|
-
onItemActive: (id) => {
|
|
41
|
-
searchType.current = id;
|
|
42
|
-
},
|
|
43
|
-
onItemClick: (id) => {
|
|
44
|
-
searchType.current = id;
|
|
45
|
-
setShowMentionType(false);
|
|
46
|
-
if (id !== 'Autopilot') {
|
|
47
|
-
onSearch?.({ type: 'mention', search: '', mentionType: id });
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
items: searchTypes.map(type => {
|
|
51
|
-
return {
|
|
52
|
-
id: type,
|
|
53
|
-
primary: cap(type),
|
|
54
|
-
visual: _jsx(Icon, { name: type === 'Autopilot' ? 'polaris' : type })
|
|
55
|
-
};
|
|
56
|
-
})
|
|
57
|
-
};
|
|
58
|
-
const searchMenu = searchResults.length && showSearchResults
|
|
59
|
-
? {
|
|
60
|
-
header: triggerType === 'mention' ? t('mention_type', [searchType.current]) : '',
|
|
61
|
-
items: searchResults.map(res => {
|
|
62
|
-
return { ...res, href: undefined };
|
|
63
|
-
})
|
|
64
|
-
}
|
|
65
|
-
: undefined;
|
|
66
|
-
const getSearchAttributes = (xmlElement, searchResult) => {
|
|
67
|
-
switch (xmlElement) {
|
|
68
|
-
case 'pega-mention': {
|
|
69
|
-
const attributes = getXMLAttributes(searchResult);
|
|
70
|
-
if (!attributes)
|
|
71
|
-
return;
|
|
72
|
-
return {
|
|
73
|
-
markdown: searchResult,
|
|
74
|
-
component: MentionButtonConfig.component,
|
|
75
|
-
props: attributes,
|
|
76
|
-
text: attributes.text
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
case 'pega-tag': {
|
|
80
|
-
const attributes = getXMLAttributes(searchResult);
|
|
81
|
-
if (!attributes)
|
|
82
|
-
return;
|
|
83
|
-
return {
|
|
84
|
-
markdown: searchResult,
|
|
85
|
-
component: HashtagButtonConfig.component,
|
|
86
|
-
props: attributes,
|
|
87
|
-
text: attributes.tag
|
|
88
|
-
};
|
|
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
|
-
}
|
|
101
|
-
default:
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
return (_jsx(RichTextEditor, { ...restProps, markdownOnly: true, ref: ref, height: height, searchTriggers: [
|
|
105
|
-
{ trigger: '@', regex: String.raw `(?:\S+(?:[^\n\S][^@#\s]\S*)*[^\n\S]?|)` },
|
|
106
|
-
{ trigger: '#', regex: String.raw `[^\s,]*` }
|
|
107
|
-
], getSearchItemReplacement: (id) => {
|
|
108
|
-
if (id === 'Autopilot') {
|
|
109
|
-
return {
|
|
110
|
-
markdown: AutopilotConfig.inject(),
|
|
111
|
-
component: AutopilotConfig.component,
|
|
112
|
-
props: {},
|
|
113
|
-
text: 'Autopilot'
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
const item = searchResults?.find(({ id: itemId }) => itemId === id);
|
|
117
|
-
if (!item)
|
|
118
|
-
return undefined;
|
|
119
|
-
return {
|
|
120
|
-
markdown: triggerType === 'mention'
|
|
121
|
-
? MentionButtonConfig.inject({
|
|
122
|
-
id: item.id,
|
|
123
|
-
type: searchType.current,
|
|
124
|
-
text: item.primary,
|
|
125
|
-
href: item.href
|
|
126
|
-
})
|
|
127
|
-
: HashtagButtonConfig.inject({ tag: item.id }),
|
|
128
|
-
component: triggerType === 'mention'
|
|
129
|
-
? MentionButtonConfig.component
|
|
130
|
-
: HashtagButtonConfig.component,
|
|
131
|
-
props: triggerType === 'mention'
|
|
132
|
-
? {
|
|
133
|
-
id: item.id,
|
|
134
|
-
text: item.primary,
|
|
135
|
-
type: searchType.current,
|
|
136
|
-
tabIndex: -1
|
|
137
|
-
}
|
|
138
|
-
: { tag: item.primary, tabIndex: -1 },
|
|
139
|
-
text: item.primary
|
|
140
|
-
};
|
|
141
|
-
}, searchRenderers: [
|
|
142
|
-
{
|
|
143
|
-
type: MentionButtonConfig.type,
|
|
144
|
-
xmlElement: MentionButtonConfig.xmlElement,
|
|
145
|
-
regexPattern: MentionButtonConfig.regexPattern,
|
|
146
|
-
getSearchAttributes
|
|
147
|
-
},
|
|
148
|
-
{
|
|
149
|
-
type: HashtagButtonConfig.type,
|
|
150
|
-
xmlElement: HashtagButtonConfig.xmlElement,
|
|
151
|
-
regexPattern: HashtagButtonConfig.regexPattern,
|
|
152
|
-
getSearchAttributes
|
|
153
|
-
},
|
|
154
|
-
{
|
|
155
|
-
type: AutopilotConfig.type,
|
|
156
|
-
xmlElement: AutopilotConfig.xmlElement,
|
|
157
|
-
regexPattern: AutopilotConfig.regexPattern,
|
|
158
|
-
getSearchAttributes
|
|
159
|
-
}
|
|
160
|
-
], onSearch: onDecoSearch, menu: showMentionType ? typesMenu : searchMenu }));
|
|
161
|
-
});
|
|
162
|
-
export default FeedRichText;
|
|
163
|
-
//# sourceMappingURL=FeedRichText.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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,EAA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AAC,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE;gBACzC,IAAI,EAAE,IAAI,CAAC,OAAO;aACnB,CAAC;QACJ,CAAC,EACD,eAAe,EAAE;YACf;gBACE,IAAI,EAAE,mBAAmB,CAAC,IAAI;gBAC9B,UAAU,EAAE,mBAAmB,CAAC,UAAU;gBAC1C,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;YACD;gBACE,IAAI,EAAE,eAAe,CAAC,IAAI;gBAC1B,UAAU,EAAE,eAAe,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"]}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { default } from './Feed';
|
|
2
|
-
export { default as FeedPost } from './FeedPost';
|
|
3
|
-
export { default as FeedReplyInput } from './FeedReplyInput';
|
|
4
|
-
export { default as FeedReply } from './FeedReply';
|
|
5
|
-
export { default as FeedNewPost } from './FeedNewPost';
|
|
6
|
-
export type { AttachedFiles, Filter, FeedProps, FeedNewPostProps, FeedPostProps, FeedReplyInputProps, FeedReplyProps, RecipientOption } from './Feed.types';
|
|
7
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Feed/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,YAAY,EACV,aAAa,EACb,MAAM,EACN,SAAS,EACT,gBAAgB,EAChB,aAAa,EACb,mBAAmB,EACnB,cAAc,EACd,eAAe,EAChB,MAAM,cAAc,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { default } from './Feed';
|
|
2
|
-
export { default as FeedPost } from './FeedPost';
|
|
3
|
-
export { default as FeedReplyInput } from './FeedReplyInput';
|
|
4
|
-
export { default as FeedReply } from './FeedReply';
|
|
5
|
-
export { default as FeedNewPost } from './FeedNewPost';
|
|
6
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Feed/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC","sourcesContent":["export { default } from './Feed';\nexport { default as FeedPost } from './FeedPost';\nexport { default as FeedReplyInput } from './FeedReplyInput';\nexport { default as FeedReply } from './FeedReply';\nexport { default as FeedNewPost } from './FeedNewPost';\nexport type {\n AttachedFiles,\n Filter,\n FeedProps,\n FeedNewPostProps,\n FeedPostProps,\n FeedReplyInputProps,\n FeedReplyProps,\n RecipientOption\n} from './Feed.types';\n"]}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { FunctionComponent, ReactElement } from 'react';
|
|
2
|
-
import { ForwardProps } from '@pega/cosmos-react-core';
|
|
3
|
-
interface HashtagButtonProps {
|
|
4
|
-
/** Text for the button, or an object containing all necessary props. */
|
|
5
|
-
children: Record<string, string> | ReactElement;
|
|
6
|
-
/** The tag value. */
|
|
7
|
-
tag?: string;
|
|
8
|
-
}
|
|
9
|
-
declare const HashtagButton: FunctionComponent<HashtagButtonProps & ForwardProps>;
|
|
10
|
-
export declare const HashtagButtonConfig: {
|
|
11
|
-
type: string;
|
|
12
|
-
xmlElement: string;
|
|
13
|
-
regexPattern: RegExp;
|
|
14
|
-
component: FunctionComponent<HashtagButtonProps & ForwardProps>;
|
|
15
|
-
inject: ({ tag }: {
|
|
16
|
-
tag: string;
|
|
17
|
-
}) => string | undefined;
|
|
18
|
-
extract: (element: string) => {
|
|
19
|
-
tag: string;
|
|
20
|
-
} | undefined;
|
|
21
|
-
};
|
|
22
|
-
export default HashtagButton;
|
|
23
|
-
//# sourceMappingURL=HashtagButton.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HashtagButton.d.ts","sourceRoot":"","sources":["../../../src/components/HashtagButton/HashtagButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAGjB,YAAY,EAGb,MAAM,OAAO,CAAC;AAGf,OAAO,EAAO,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAK5D,UAAU,kBAAkB;IAC1B,wEAAwE;IACxE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,YAAY,CAAC;IAChD,qBAAqB;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAQD,QAAA,MAAM,aAAa,EAAE,iBAAiB,CAAC,kBAAkB,GAAG,YAAY,CAsBvE,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;;;aAKL,MAAM;;uBAQZ,MAAM;;;CAM1B,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef, isValidElement, useContext } from 'react';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
|
-
import { Tag } from '@pega/cosmos-react-core';
|
|
5
|
-
import { getXMLAttributes } from '@pega/cosmos-react-rte';
|
|
6
|
-
import { FeedContext } from '../Feed/Feed.context';
|
|
7
|
-
const StyledTag = styled(Tag) `
|
|
8
|
-
cursor: pointer;
|
|
9
|
-
`;
|
|
10
|
-
const serializer = new XMLSerializer();
|
|
11
|
-
const HashtagButton = forwardRef(function HashtagButton({ children, tag: tagProp = '', ...restProps }, ref) {
|
|
12
|
-
const { onTagClick } = useContext(FeedContext);
|
|
13
|
-
let tag = '';
|
|
14
|
-
if (!isValidElement(children)) {
|
|
15
|
-
if (!children.tag)
|
|
16
|
-
return _jsx("span", { children: children.rawText });
|
|
17
|
-
tag = children.tag;
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
tag = tagProp;
|
|
21
|
-
}
|
|
22
|
-
return (_jsx(StyledTag, { ...restProps, ref: ref, onClick: () => onTagClick?.(tag), spellCheck: false, children: isValidElement(children) ? children : tag }));
|
|
23
|
-
});
|
|
24
|
-
export const HashtagButtonConfig = {
|
|
25
|
-
type: 'tag',
|
|
26
|
-
xmlElement: 'pega-tag',
|
|
27
|
-
regexPattern: /(?:^|)<pega-tag (?:[^\n/]|\/(?!>))+\/>/gm,
|
|
28
|
-
component: HashtagButton,
|
|
29
|
-
inject: ({ tag }) => {
|
|
30
|
-
if (!tag)
|
|
31
|
-
return;
|
|
32
|
-
const element = document.createElementNS(null, 'pega-tag');
|
|
33
|
-
element.setAttribute('tag', tag);
|
|
34
|
-
return serializer.serializeToString(element);
|
|
35
|
-
},
|
|
36
|
-
extract: (element) => {
|
|
37
|
-
const attributes = getXMLAttributes(element);
|
|
38
|
-
if (!attributes || !attributes.tag)
|
|
39
|
-
return undefined;
|
|
40
|
-
return { tag: attributes.tag };
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
export default HashtagButton;
|
|
44
|
-
//# sourceMappingURL=HashtagButton.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HashtagButton.js","sourceRoot":"","sources":["../../../src/components/HashtagButton/HashtagButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EAEV,cAAc,EAId,UAAU,EACX,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAE,GAAG,EAAgB,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AASnD,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;;CAE5B,CAAC;AAEF,MAAM,UAAU,GAAG,IAAI,aAAa,EAAE,CAAC;AAEvC,MAAM,aAAa,GAAyD,UAAU,CACpF,SAAS,aAAa,CACpB,EAAE,QAAQ,EAAE,GAAG,EAAE,OAAO,GAAG,EAAE,EAAE,GAAG,SAAS,EAAuC,EAClF,GAA2B;IAE3B,MAAM,EAAE,UAAU,EAAE,GAAG,U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AG,EAAE,CAAC;IACjC,CAAC;CACF,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import {\n forwardRef,\n FunctionComponent,\n isValidElement,\n PropsWithoutRef,\n ReactElement,\n Ref,\n useContext\n} from 'react';\nimport styled from 'styled-components';\n\nimport { Tag, ForwardProps } from '@pega/cosmos-react-core';\nimport { getXMLAttributes } from '@pega/cosmos-react-rte';\n\nimport { FeedContext } from '../Feed/Feed.context';\n\ninterface HashtagButtonProps {\n /** Text for the button, or an object containing all necessary props. */\n children: Record<string, string> | ReactElement;\n /** The tag value. */\n tag?: string;\n}\n\nconst StyledTag = styled(Tag)`\n cursor: pointer;\n`;\n\nconst serializer = new XMLSerializer();\n\nconst HashtagButton: FunctionComponent<HashtagButtonProps & ForwardProps> = forwardRef(\n function HashtagButton(\n { children, tag: tagProp = '', ...restProps }: PropsWithoutRef<HashtagButtonProps>,\n ref: Ref<HTMLButtonElement>\n ) {\n const { onTagClick } = useContext(FeedContext);\n\n let tag = '';\n\n if (!isValidElement<any>(children)) {\n if (!children.tag) return <span>{children.rawText}</span>;\n tag = children.tag;\n } else {\n tag = tagProp;\n }\n\n return (\n <StyledTag {...restProps} ref={ref} onClick={() => onTagClick?.(tag)} spellCheck={false}>\n {isValidElement(children) ? children : tag}\n </StyledTag>\n );\n }\n);\n\nexport const HashtagButtonConfig = {\n type: 'tag',\n xmlElement: 'pega-tag',\n regexPattern: /(?:^|)<pega-tag (?:[^\\n/]|\\/(?!>))+\\/>/gm,\n component: HashtagButton,\n inject: ({ tag }: { tag: string }) => {\n if (!tag) return;\n\n const element = document.createElementNS(null, 'pega-tag');\n element.setAttribute('tag', tag);\n\n return serializer.serializeToString(element);\n },\n extract: (element: string) => {\n const attributes = getXMLAttributes(element);\n\n if (!attributes || !attributes.tag) return undefined;\n return { tag: attributes.tag };\n }\n};\n\nexport default HashtagButton;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/HashtagButton/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/HashtagButton/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC","sourcesContent":["export { default } from './HashtagButton';\nexport { HashtagButtonConfig } from './HashtagButton';\n"]}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { FunctionComponent, ReactElement } from 'react';
|
|
2
|
-
import { ForwardProps } from '@pega/cosmos-react-core';
|
|
3
|
-
interface MentionButtonProps {
|
|
4
|
-
/** Text for the button, or an object containing all necessary props. */
|
|
5
|
-
children: Record<string, string> | ReactElement;
|
|
6
|
-
/** The id of the mention. */
|
|
7
|
-
id?: string;
|
|
8
|
-
/** The text of the mention button. */
|
|
9
|
-
text?: string;
|
|
10
|
-
/** Designates the type of the mention for proper handling on click. */
|
|
11
|
-
type?: string;
|
|
12
|
-
/** If an href is provided, render a link. Otherwise, render a button. */
|
|
13
|
-
href?: string;
|
|
14
|
-
}
|
|
15
|
-
declare const MentionButton: FunctionComponent<MentionButtonProps & ForwardProps>;
|
|
16
|
-
export declare const MentionButtonConfig: {
|
|
17
|
-
type: string;
|
|
18
|
-
xmlElement: string;
|
|
19
|
-
regexPattern: RegExp;
|
|
20
|
-
component: FunctionComponent<MentionButtonProps & ForwardProps>;
|
|
21
|
-
inject: ({ id, type, text, href }: {
|
|
22
|
-
id: string;
|
|
23
|
-
type: string;
|
|
24
|
-
text: string;
|
|
25
|
-
href?: string | undefined;
|
|
26
|
-
}) => string | undefined;
|
|
27
|
-
extract: (element: string) => {
|
|
28
|
-
id: string;
|
|
29
|
-
text: string;
|
|
30
|
-
type: string;
|
|
31
|
-
href: string;
|
|
32
|
-
} | undefined;
|
|
33
|
-
};
|
|
34
|
-
export default MentionButton;
|
|
35
|
-
//# sourceMappingURL=MentionButton.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MentionButton.d.ts","sourceRoot":"","sources":["../../../src/components/MentionButton/MentionButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAGjB,YAAY,EAKb,MAAM,OAAO,CAAC;AAGf,OAAO,EAEL,YAAY,EAIb,MAAM,yBAAyB,CAAC;AAKjC,UAAU,kBAAkB;IAC1B,wEAAwE;IACxE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,YAAY,CAAC;IAChD,6BAA6B;IAC7B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,sCAAsC;IACtC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uEAAuE;IACvE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yEAAyE;IACzE,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAoBD,QAAA,MAAM,aAAa,EAAE,iBAAiB,CAAC,kBAAkB,GAAG,YAAY,CAoFvE,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;;;YAKW,MAAM;cAAQ,MAAM;cAAQ,MAAM;;;uBAWxD,MAAM;;;;;;CAW1B,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef, isValidElement, useContext, useState } from 'react';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
|
-
import { Button, Link, useConsolidatedRef, useElement } from '@pega/cosmos-react-core';
|
|
5
|
-
import { getXMLAttributes } from '@pega/cosmos-react-rte';
|
|
6
|
-
import { FeedContext } from '../Feed/Feed.context';
|
|
7
|
-
const StyledButton = styled(Button) `
|
|
8
|
-
&:enabled:focus,
|
|
9
|
-
&:not([disabled]):focus {
|
|
10
|
-
box-shadow: none;
|
|
11
|
-
text-decoration: underline;
|
|
12
|
-
}
|
|
13
|
-
`;
|
|
14
|
-
const StyledLink = styled(Link) `
|
|
15
|
-
&:enabled:focus,
|
|
16
|
-
&:not([disabled]):focus {
|
|
17
|
-
box-shadow: none;
|
|
18
|
-
text-decoration: underline;
|
|
19
|
-
}
|
|
20
|
-
`;
|
|
21
|
-
const serializer = new XMLSerializer();
|
|
22
|
-
const MentionButton = forwardRef(function MentionButton({ children, id: idProp = '', text: textProp = '', type: typeProp = '', href: hrefProp = '', ...restProps }, ref) {
|
|
23
|
-
const { onMentionClick, onMentionPreview } = useContext(FeedContext);
|
|
24
|
-
const [mentionContent, setMentionContent] = useState();
|
|
25
|
-
const [target, setTarget] = useElement(null);
|
|
26
|
-
const mentionRef = useConsolidatedRef(ref);
|
|
27
|
-
let id = '';
|
|
28
|
-
let text = '';
|
|
29
|
-
let type = '';
|
|
30
|
-
let href = '';
|
|
31
|
-
if (!isValidElement(children)) {
|
|
32
|
-
if (!children.id || !children.text || !children.type)
|
|
33
|
-
return _jsx("span", { children: children.rawText });
|
|
34
|
-
id = children.id;
|
|
35
|
-
text = children.text;
|
|
36
|
-
type = children.type;
|
|
37
|
-
href = children.href || '';
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
id = idProp;
|
|
41
|
-
text = textProp;
|
|
42
|
-
type = typeProp;
|
|
43
|
-
href = hrefProp;
|
|
44
|
-
}
|
|
45
|
-
const handleClick = (e) => {
|
|
46
|
-
setTarget(e.currentTarget);
|
|
47
|
-
const comp = onMentionClick?.({
|
|
48
|
-
id,
|
|
49
|
-
text,
|
|
50
|
-
type,
|
|
51
|
-
target: e.currentTarget,
|
|
52
|
-
closeGlimpse: () => setTarget(null)
|
|
53
|
-
});
|
|
54
|
-
if (comp)
|
|
55
|
-
setMentionContent(comp);
|
|
56
|
-
};
|
|
57
|
-
return (_jsxs(_Fragment, { children: [href ? (_jsx(StyledLink, { ...restProps, ref: mentionRef, href: href, previewable: !!onMentionPreview, onPreview: onMentionPreview
|
|
58
|
-
? () => onMentionPreview({
|
|
59
|
-
id,
|
|
60
|
-
text,
|
|
61
|
-
type
|
|
62
|
-
})
|
|
63
|
-
: undefined, spellCheck: false, children: isValidElement(children) ? children : text })) : (_jsx(StyledButton, { ...restProps, ref: mentionRef, variant: 'link', onClick: handleClick, spellCheck: false, children: isValidElement(children) ? children : text })), target && mentionContent] }));
|
|
64
|
-
});
|
|
65
|
-
export const MentionButtonConfig = {
|
|
66
|
-
type: 'mention',
|
|
67
|
-
xmlElement: 'pega-mention',
|
|
68
|
-
regexPattern: /(?:^|)<pega-mention (?:[^\n/]|\/(?!>))+\/>/g,
|
|
69
|
-
component: MentionButton,
|
|
70
|
-
inject: ({ id, type, text, href }) => {
|
|
71
|
-
if (!id || !type || !text)
|
|
72
|
-
return;
|
|
73
|
-
const element = document.createElementNS(null, 'pega-mention');
|
|
74
|
-
element.setAttribute('id', id);
|
|
75
|
-
element.setAttribute('text', text);
|
|
76
|
-
element.setAttribute('type', type);
|
|
77
|
-
if (href)
|
|
78
|
-
element.setAttribute('href', href);
|
|
79
|
-
return serializer.serializeToString(element);
|
|
80
|
-
},
|
|
81
|
-
extract: (element) => {
|
|
82
|
-
const attributes = getXMLAttributes(element);
|
|
83
|
-
if (!attributes || !attributes.id || !attributes.text || !attributes.type)
|
|
84
|
-
return undefined;
|
|
85
|
-
return {
|
|
86
|
-
id: attributes.id,
|
|
87
|
-
text: attributes.text,
|
|
88
|
-
type: attributes.type,
|
|
89
|
-
href: attributes.href
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
export default MentionButton;
|
|
94
|
-
//# sourceMappingURL=MentionButton.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MentionButton.js","sourceRoot":"","sources":["../../../src/components/MentionButton/MentionBut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I,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI;YAAE,OAAO,SAAS,CAAC;QAC5F,OAAO;YACL,EAAE,EAAE,UAAU,CAAC,EAAE;YACjB,IAAI,EAAE,UAAU,CAAC,IAAI;YACrB,IAAI,EAAE,UAAU,CAAC,IAAI;YACrB,IAAI,EAAE,UAAU,CAAC,IAAI;SACtB,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import {\n forwardRef,\n FunctionComponent,\n isValidElement,\n PropsWithoutRef,\n ReactElement,\n Ref,\n useContext,\n useState,\n MouseEvent\n} from 'react';\nimport styled from 'styled-components';\n\nimport {\n Button,\n ForwardProps,\n Link,\n useConsolidatedRef,\n useElement\n} from '@pega/cosmos-react-core';\nimport { getXMLAttributes } from '@pega/cosmos-react-rte';\n\nimport { FeedContext } from '../Feed/Feed.context';\n\ninterface MentionButtonProps {\n /** Text for the button, or an object containing all necessary props. */\n children: Record<string, string> | ReactElement;\n /** The id of the mention. */\n id?: string;\n /** The text of the mention button. */\n text?: string;\n /** Designates the type of the mention for proper handling on click. */\n type?: string;\n /** If an href is provided, render a link. Otherwise, render a button. */\n href?: string;\n}\n\nconst StyledButton = styled(Button)`\n &:enabled:focus,\n &:not([disabled]):focus {\n box-shadow: none;\n text-decoration: underline;\n }\n`;\n\nconst StyledLink = styled(Link)`\n &:enabled:focus,\n &:not([disabled]):focus {\n box-shadow: none;\n text-decoration: underline;\n }\n`;\n\nconst serializer = new XMLSerializer();\n\nconst MentionButton: FunctionComponent<MentionButtonProps & ForwardProps> = forwardRef(\n function MentionButton(\n {\n children,\n id: idProp = '',\n text: textProp = '',\n type: typeProp = '',\n href: hrefProp = '',\n ...restProps\n }: PropsWithoutRef<MentionButtonProps>,\n ref: Ref<HTMLButtonElement>\n ) {\n const { onMentionClick, onMentionPreview } = useContext(FeedContext);\n const [mentionContent, setMentionContent] = useState<JSX.Element | undefined>();\n const [target, setTarget] = useElement<HTMLButtonElement>(null);\n const mentionRef = useConsolidatedRef(ref);\n\n let id = '';\n let text = '';\n let type = '';\n let href = '';\n\n if (!isValidElement<any>(children)) {\n if (!children.id || !children.text || !children.type) return <span>{children.rawText}</span>;\n id = children.id;\n text = children.text;\n type = children.type;\n href = children.href || '';\n } else {\n id = idProp;\n text = textProp;\n type = typeProp;\n href = hrefProp;\n }\n\n const handleClick = (e: MouseEvent<HTMLButtonElement>) => {\n setTarget(e.currentTarget);\n const comp = onMentionClick?.({\n id,\n text,\n type,\n target: e.currentTarget,\n closeGlimpse: () => setTarget(null)\n });\n if (comp) setMentionContent(comp);\n };\n\n return (\n <>\n {href ? (\n <StyledLink\n {...restProps}\n ref={mentionRef}\n href={href}\n previewable={!!onMentionPreview}\n onPreview={\n onMentionPreview\n ? () =>\n onMentionPreview({\n id,\n text,\n type\n })\n : undefined\n }\n spellCheck={false}\n >\n {isValidElement(children) ? children : text}\n </StyledLink>\n ) : (\n <StyledButton\n {...restProps}\n ref={mentionRef}\n variant='link'\n onClick={handleClick}\n spellCheck={false}\n >\n {isValidElement(children) ? children : text}\n </StyledButton>\n )}\n {target && mentionContent}\n </>\n );\n }\n);\n\nexport const MentionButtonConfig = {\n type: 'mention',\n xmlElement: 'pega-mention',\n regexPattern: /(?:^|)<pega-mention (?:[^\\n/]|\\/(?!>))+\\/>/g,\n component: MentionButton,\n inject: ({ id, type, text, href }: { id: string; type: string; text: string; href?: string }) => {\n if (!id || !type || !text) return;\n\n const element = document.createElementNS(null, 'pega-mention');\n element.setAttribute('id', id);\n element.setAttribute('text', text);\n element.setAttribute('type', type);\n if (href) element.setAttribute('href', href);\n\n return serializer.serializeToString(element);\n },\n extract: (element: string) => {\n const attributes = getXMLAttributes(element);\n\n if (!attributes || !attributes.id || !attributes.text || !attributes.type) return undefined;\n return {\n id: attributes.id,\n text: attributes.text,\n type: attributes.type,\n href: attributes.href\n };\n }\n};\n\nexport default MentionButton;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/MentionButton/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/MentionButton/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC","sourcesContent":["export { default } from './MentionButton';\nexport { MentionButtonConfig } from './MentionButton';\n"]}
|
package/lib/index.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export * from './components/Autopilot';
|
|
2
|
-
export { default as Chat } from './components/Chat';
|
|
3
|
-
export * from './components/Chat';
|
|
4
|
-
export { default as Email } from './components/Email';
|
|
5
|
-
export * from './components/Email';
|
|
6
|
-
export { default as Feed } from './components/Feed';
|
|
7
|
-
export * from './components/Feed';
|
|
8
|
-
export { default as HashtagButton } from './components/HashtagButton';
|
|
9
|
-
export * from './components/HashtagButton';
|
|
10
|
-
export { default as MentionButton } from './components/MentionButton';
|
|
11
|
-
export * from './components/MentionButton';
|
|
12
|
-
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
// This file is autogenerated. Any changes will be overwritten.
|
|
2
|
-
export * from './components/Autopilot';
|
|
3
|
-
export { default as Chat } from './components/Chat';
|
|
4
|
-
export * from './components/Chat';
|
|
5
|
-
export { default as Email } from './components/Email';
|
|
6
|
-
export * from './components/Email';
|
|
7
|
-
export { default as Feed } from './components/Feed';
|
|
8
|
-
export * from './components/Feed';
|
|
9
|
-
export { default as HashtagButton } from './components/HashtagButton';
|
|
10
|
-
export * from './components/HashtagButton';
|
|
11
|
-
export { default as MentionButton } from './components/MentionButton';
|
|
12
|
-
export * from './components/MentionButton';
|
|
13
|
-
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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"]}
|