@pega/cosmos-react-social 3.0.0-dev.26.0 → 3.0.0-dev.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/lib/components/Email/Email.d.ts.map +1 -1
  2. package/lib/components/Email/Email.js +40 -25
  3. package/lib/components/Email/Email.js.map +1 -1
  4. package/lib/components/Email/Email.styles.d.ts +19 -2
  5. package/lib/components/Email/Email.styles.d.ts.map +1 -1
  6. package/lib/components/Email/Email.styles.js +137 -8
  7. package/lib/components/Email/Email.styles.js.map +1 -1
  8. package/lib/components/Email/Email.types.d.ts +18 -10
  9. package/lib/components/Email/Email.types.d.ts.map +1 -1
  10. package/lib/components/Email/Email.types.js.map +1 -1
  11. package/lib/components/Email/EmailCaseView.d.ts +6 -0
  12. package/lib/components/Email/EmailCaseView.d.ts.map +1 -0
  13. package/lib/components/Email/EmailCaseView.js +36 -0
  14. package/lib/components/Email/EmailCaseView.js.map +1 -0
  15. package/lib/components/Email/EmailConversation.d.ts.map +1 -1
  16. package/lib/components/Email/EmailConversation.js +5 -5
  17. package/lib/components/Email/EmailConversation.js.map +1 -1
  18. package/lib/components/Email/EmailManager.d.ts.map +1 -1
  19. package/lib/components/Email/EmailManager.js +9 -21
  20. package/lib/components/Email/EmailManager.js.map +1 -1
  21. package/lib/components/Email/EmailShell.d.ts +0 -3
  22. package/lib/components/Email/EmailShell.d.ts.map +1 -1
  23. package/lib/components/Email/EmailShell.js +3 -28
  24. package/lib/components/Email/EmailShell.js.map +1 -1
  25. package/lib/components/Email/index.d.ts +2 -1
  26. package/lib/components/Email/index.d.ts.map +1 -1
  27. package/lib/components/Email/index.js +1 -0
  28. package/lib/components/Email/index.js.map +1 -1
  29. package/lib/components/HashtagButton/HashtagButton.js +1 -1
  30. package/lib/components/HashtagButton/HashtagButton.js.map +1 -1
  31. package/lib/components/MentionButton/MentionButton.js +1 -1
  32. package/lib/components/MentionButton/MentionButton.js.map +1 -1
  33. package/package.json +4 -4
@@ -1,5 +1,5 @@
1
1
  export { default } from './Email';
2
- export { EmailUser, EmailProps, EmailComposerProps, EmailConversationProps, EmailShellProps, EntityListProps, EmailManagerProps, EmailTemplate, EmailSummaryListProps, EmailSummaryItemProps } from './Email.types';
2
+ export { EmailUser, EmailProps, EmailComposerProps, EmailConversationProps, EmailShellProps, EntityListProps, EmailManagerProps, EmailTemplate, EmailSummaryListProps, EmailSummaryItemProps, EmailCaseViewProps } from './Email.types';
3
3
  export { default as EmailConversation } from './EmailConversation';
4
4
  export { default as EmailShell } from './EmailShell';
5
5
  export { default as EmailComposer } from './EmailComposer';
@@ -7,4 +7,5 @@ export { default as EmailSummaryItem } from './EmailSummaryItem';
7
7
  export { default as EmailSummaryList } from './EmailSummaryList';
8
8
  export { default as EntityList } from './EntityList';
9
9
  export { default as EmailManager } from './EmailManager';
10
+ export { default as EmailCaseView } from './EmailCaseView';
10
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Email/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EACL,SAAS,EACT,UAAU,EACV,kBAAkB,EAClB,sBAAsB,EACtB,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Email/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EACL,SAAS,EACT,UAAU,EACV,kBAAkB,EAClB,sBAAsB,EACtB,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
@@ -6,4 +6,5 @@ export { default as EmailSummaryItem } from './EmailSummaryItem';
6
6
  export { default as EmailSummaryList } from './EmailSummaryList';
7
7
  export { default as EntityList } from './EntityList';
8
8
  export { default as EmailManager } from './EmailManager';
9
+ export { default as EmailCaseView } from './EmailCaseView';
9
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Email/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAalC,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC","sourcesContent":["export { default } from './Email';\nexport {\n EmailUser,\n EmailProps,\n EmailComposerProps,\n EmailConversationProps,\n EmailShellProps,\n EntityListProps,\n EmailManagerProps,\n EmailTemplate,\n EmailSummaryListProps,\n EmailSummaryItemProps\n} from './Email.types';\nexport { default as EmailConversation } from './EmailConversation';\nexport { default as EmailShell } from './EmailShell';\nexport { default as EmailComposer } from './EmailComposer';\nexport { default as EmailSummaryItem } from './EmailSummaryItem';\nexport { default as EmailSummaryList } from './EmailSummaryList';\nexport { default as EntityList } from './EntityList';\nexport { default as EmailManager } from './EmailManager';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Email/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAclC,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC","sourcesContent":["export { default } from './Email';\nexport {\n EmailUser,\n EmailProps,\n EmailComposerProps,\n EmailConversationProps,\n EmailShellProps,\n EntityListProps,\n EmailManagerProps,\n EmailTemplate,\n EmailSummaryListProps,\n EmailSummaryItemProps,\n EmailCaseViewProps\n} from './Email.types';\nexport { default as EmailConversation } from './EmailConversation';\nexport { default as EmailShell } from './EmailShell';\nexport { default as EmailComposer } from './EmailComposer';\nexport { default as EmailSummaryItem } from './EmailSummaryItem';\nexport { default as EmailSummaryList } from './EmailSummaryList';\nexport { default as EntityList } from './EntityList';\nexport { default as EmailManager } from './EmailManager';\nexport { default as EmailCaseView } from './EmailCaseView';\n"]}
@@ -24,7 +24,7 @@ const HashtagButton = forwardRef(({ children, tag: tagProp = '', ...restProps },
24
24
  });
25
25
  export const HashtagButtonConfig = {
26
26
  type: 'tag',
27
- regexPattern: /(?:^|)(?<match>#(?<tag>[^ :]+\w):)/g,
27
+ regexPattern: /(?:^| )(?<match>#(?<tag>[^ :]+[^ :\]]):)/gm,
28
28
  component: HashtagButton
29
29
  };
30
30
  export default HashtagButton;
@@ -1 +1 @@
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;AAE5D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AASnD,MAAM,SAAS,GAAG,MAAM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Ae,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';\n\nimport { FeedContext } from '../Feed/Feed.context';\n\ninterface HashtagButtonProps {\n /** Text for the button, or a regex match containing all necessary props. */\n children: RegExpExecArray | ReactElement;\n /** The tag value. */\n tag?: string;\n}\n\nconst StyledTag = styled(Tag)`\n cursor: pointer;\n`;\n\nconst HashtagButton: FunctionComponent<HashtagButtonProps & ForwardProps> = forwardRef(\n (\n { children, tag: tagProp = '', ...restProps }: PropsWithoutRef<HashtagButtonProps>,\n ref: Ref<HTMLButtonElement>\n ) => {\n const { onTagClick } = useContext(FeedContext);\n\n let leadingChar = '';\n let trailingChar = '';\n let tag = '';\n\n if (!isValidElement(children)) {\n if (!children.groups) return <span>{children[0]}</span>;\n\n [leadingChar, trailingChar] = children[0].split(children.groups.match);\n tag = children.groups.tag;\n } else {\n tag = tagProp;\n }\n\n return (\n <>\n {leadingChar && <span>{leadingChar}</span>}\n <StyledTag {...restProps} ref={ref} onClick={() => onTagClick?.(tag)} spellCheck={false}>\n {isValidElement(children) ? children : tag}\n </StyledTag>\n {trailingChar && <span>{trailingChar}</span>}\n </>\n );\n }\n);\n\nexport const HashtagButtonConfig = {\n type: 'tag',\n regexPattern: /(?:^|)(?<match>#(?<tag>[^ :]+\\w):)/g,\n component: HashtagButton\n};\n\nexport default HashtagButton;\n"]}
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;AAE5D,OAAO,EAAE,WAAW,EAAE,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A4C;IAC1D,SAAS,EAAE,aAAa;CACzB,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';\n\nimport { FeedContext } from '../Feed/Feed.context';\n\ninterface HashtagButtonProps {\n /** Text for the button, or a regex match containing all necessary props. */\n children: RegExpExecArray | ReactElement;\n /** The tag value. */\n tag?: string;\n}\n\nconst StyledTag = styled(Tag)`\n cursor: pointer;\n`;\n\nconst HashtagButton: FunctionComponent<HashtagButtonProps & ForwardProps> = forwardRef(\n (\n { children, tag: tagProp = '', ...restProps }: PropsWithoutRef<HashtagButtonProps>,\n ref: Ref<HTMLButtonElement>\n ) => {\n const { onTagClick } = useContext(FeedContext);\n\n let leadingChar = '';\n let trailingChar = '';\n let tag = '';\n\n if (!isValidElement(children)) {\n if (!children.groups) return <span>{children[0]}</span>;\n\n [leadingChar, trailingChar] = children[0].split(children.groups.match);\n tag = children.groups.tag;\n } else {\n tag = tagProp;\n }\n\n return (\n <>\n {leadingChar && <span>{leadingChar}</span>}\n <StyledTag {...restProps} ref={ref} onClick={() => onTagClick?.(tag)} spellCheck={false}>\n {isValidElement(children) ? children : tag}\n </StyledTag>\n {trailingChar && <span>{trailingChar}</span>}\n </>\n );\n }\n);\n\nexport const HashtagButtonConfig = {\n type: 'tag',\n regexPattern: /(?:^| )(?<match>#(?<tag>[^ :]+[^ :\\]]):)/gm,\n component: HashtagButton\n};\n\nexport default HashtagButton;\n"]}
@@ -67,7 +67,7 @@ const MentionButton = forwardRef(({ children, id: idProp = '', text: textProp =
67
67
  });
68
68
  export const MentionButtonConfig = {
69
69
  type: 'mention',
70
- regexPattern: /(?:^|)(?<match>@\[(?<id>[^ [\]]+)\]:\[(?<text>[^[\]]+)\]:\[(?<type>[^[\]]+)\]:(?:\[(?<href>[^ [\]]+)\]:)?)/g,
70
+ regexPattern: /(?:^|)(?<match>@\[(?<id>(?:[^\s:]|:[^[])+)\]:\[(?<text>(?:[^\n:]|:[^[])+)\]:\[(?<type>(?:[^\n:]|:[^[])+)\]:(?:\[(?<href>(?:[^\s:]|:[^[])+)\]:)?)/g,
71
71
  component: MentionButton
72
72
  };
73
73
  export default MentionButton;
@@ -1 +1 @@
1
- {"version":3,"file":"MentionButton.js","sourceRoot":"","sources":["../../../src/components/MentionButton/MentionButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EAEV,cAAc,EAId,UAAU,EACV,MAAM,EACN,QAAQ,EACT,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EACL,MAAM,EAEN,IAAI,EACJ,OAAO,EACP,kBAAkB,EAClB,aAAa,EACd,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAenD,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,CAAA;;;;;;CAMlC,CAAC;AAEF,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;;;;;;CAM9B,CAAC;AAEF,MAAM,aAAa,GAAyD,UAAU,CACpF,CACE,EACE,QAAQ,EACR,EAAE,EAAE,MAAM,GAAG,EAAE,EACf,IAAI,EAAE,QAAQ,GAAG,EAAE,EACnB,IAAI,EAAE,QAAQ,GAAG,EAAE,EACnB,IAAI,EAAE,QAAQ,GAAG,EAAE,EACnB,GAAG,SAAS,EACwB,EACtC,GAA2B,EAC3B,EAAE;IACF,MAAM,EAAE,cAAc,EAAE,gBAAgB,EAAE,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;IACrE,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACtD,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,EAA2B,CAAC;IAChF,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import {\n forwardRef,\n FunctionComponent,\n isValidElement,\n PropsWithoutRef,\n ReactElement,\n Ref,\n useContext,\n useRef,\n useState\n} from 'react';\nimport styled from 'styled-components';\n\nimport {\n Button,\n ForwardProps,\n Link,\n Popover,\n useConsolidatedRef,\n useOuterEvent\n} from '@pega/cosmos-react-core';\n\nimport { FeedContext } from '../Feed/Feed.context';\n\ninterface MentionButtonProps {\n /** Text for the button, or a regex match containing all necessary props. */\n children: RegExpExecArray | 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 MentionButton: FunctionComponent<MentionButtonProps & ForwardProps> = forwardRef(\n (\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 [showPopover, setShowPopover] = useState(false);\n const [mentionContent, setMentionContent] = useState<JSX.Element | undefined>();\n const mentionRef = useConsolidatedRef(ref);\n const popoverRef = useRef(null);\n\n useOuterEvent(['click', 'focusin'], [mentionRef, popoverRef], () => {\n setShowPopover(false);\n });\n\n let leadingChar = '';\n let trailingChar = '';\n let id = '';\n let text = '';\n let type = '';\n let href = '';\n\n if (!isValidElement(children)) {\n if (!children.groups) return <span>{children[0]}</span>;\n\n [leadingChar, trailingChar] = children[0].split(children.groups.match);\n id = children.groups.id;\n text = children.groups.text;\n type = children.groups.type;\n href = children.groups.href || '';\n } else {\n id = idProp;\n text = textProp;\n type = typeProp;\n href = hrefProp;\n }\n\n const handleClick = () => {\n const comp = onMentionClick?.({\n id,\n text,\n type\n });\n if (comp) setShowPopover(true);\n setMentionContent(comp);\n };\n\n return (\n <>\n {leadingChar && <span>{leadingChar}</span>}\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 {trailingChar && <span>{trailingChar}</span>}\n <Popover\n ref={popoverRef}\n show={showPopover}\n target={mentionRef.current}\n placement='bottom-start'\n arrow\n >\n {mentionContent}\n </Popover>\n </>\n );\n }\n);\n\nexport const MentionButtonConfig = {\n type: 'mention',\n regexPattern:\n /(?:^|)(?<match>@\\[(?<id>[^ [\\]]+)\\]:\\[(?<text>[^[\\]]+)\\]:\\[(?<type>[^[\\]]+)\\]:(?:\\[(?<href>[^ [\\]]+)\\]:)?)/g,\n component: MentionButton\n};\n\nexport default MentionButton;\n"]}
1
+ {"version":3,"file":"MentionButton.js","sourceRoot":"","sources":["../../../src/components/MentionButton/MentionButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EAEV,cAAc,EAId,UAAU,EACV,MAAM,EACN,QAAQ,EACT,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EACL,MAAM,EAEN,IAAI,EACJ,OAAO,EACP,kBAAkB,EAClB,aAAa,EACd,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAenD,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,CAAA;;;;;;CAMlC,CAAC;AAEF,MAAM,UAAU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C,MAAM,EACd,OAAO,EAAE,WAAW,EACpB,UAAU,EAAE,KAAK,YAEhB,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,GAC9B,CAChB,EACA,YAAY,IAAI,yBAAO,YAAY,GAAQ,EAC5C,KAAC,OAAO,IACN,GAAG,EAAE,UAAU,EACf,IAAI,EAAE,WAAW,EACjB,MAAM,EAAE,UAAU,CAAC,OAAO,EAC1B,SAAS,EAAC,cAAc,EACxB,KAAK,kBAEJ,cAAc,GACP,IACT,CACJ,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,IAAI,EAAE,SAAS;IACf,YAAY,EACV,mJAAmJ;IACrJ,SAAS,EAAE,aAAa;CACzB,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import {\n forwardRef,\n FunctionComponent,\n isValidElement,\n PropsWithoutRef,\n ReactElement,\n Ref,\n useContext,\n useRef,\n useState\n} from 'react';\nimport styled from 'styled-components';\n\nimport {\n Button,\n ForwardProps,\n Link,\n Popover,\n useConsolidatedRef,\n useOuterEvent\n} from '@pega/cosmos-react-core';\n\nimport { FeedContext } from '../Feed/Feed.context';\n\ninterface MentionButtonProps {\n /** Text for the button, or a regex match containing all necessary props. */\n children: RegExpExecArray | 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 MentionButton: FunctionComponent<MentionButtonProps & ForwardProps> = forwardRef(\n (\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 [showPopover, setShowPopover] = useState(false);\n const [mentionContent, setMentionContent] = useState<JSX.Element | undefined>();\n const mentionRef = useConsolidatedRef(ref);\n const popoverRef = useRef(null);\n\n useOuterEvent(['click', 'focusin'], [mentionRef, popoverRef], () => {\n setShowPopover(false);\n });\n\n let leadingChar = '';\n let trailingChar = '';\n let id = '';\n let text = '';\n let type = '';\n let href = '';\n\n if (!isValidElement(children)) {\n if (!children.groups) return <span>{children[0]}</span>;\n\n [leadingChar, trailingChar] = children[0].split(children.groups.match);\n id = children.groups.id;\n text = children.groups.text;\n type = children.groups.type;\n href = children.groups.href || '';\n } else {\n id = idProp;\n text = textProp;\n type = typeProp;\n href = hrefProp;\n }\n\n const handleClick = () => {\n const comp = onMentionClick?.({\n id,\n text,\n type\n });\n if (comp) setShowPopover(true);\n setMentionContent(comp);\n };\n\n return (\n <>\n {leadingChar && <span>{leadingChar}</span>}\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 {trailingChar && <span>{trailingChar}</span>}\n <Popover\n ref={popoverRef}\n show={showPopover}\n target={mentionRef.current}\n placement='bottom-start'\n arrow\n >\n {mentionContent}\n </Popover>\n </>\n );\n }\n);\n\nexport const MentionButtonConfig = {\n type: 'mention',\n regexPattern:\n /(?:^|)(?<match>@\\[(?<id>(?:[^\\s:]|:[^[])+)\\]:\\[(?<text>(?:[^\\n:]|:[^[])+)\\]:\\[(?<type>(?:[^\\n:]|:[^[])+)\\]:(?:\\[(?<href>(?:[^\\s:]|:[^[])+)\\]:)?)/g,\n component: MentionButton\n};\n\nexport default MentionButton;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/cosmos-react-social",
3
- "version": "3.0.0-dev.26.0",
3
+ "version": "3.0.0-dev.27.0",
4
4
  "author": "Pegasystems",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "repository": {
@@ -20,9 +20,9 @@
20
20
  "build": "tsc -b"
21
21
  },
22
22
  "dependencies": {
23
- "@pega/cosmos-react-core": "3.0.0-dev.26.0",
24
- "@pega/cosmos-react-rte": "3.0.0-dev.26.0",
25
- "@pega/cosmos-react-work": "3.0.0-dev.26.0",
23
+ "@pega/cosmos-react-core": "3.0.0-dev.27.0",
24
+ "@pega/cosmos-react-rte": "3.0.0-dev.27.0",
25
+ "@pega/cosmos-react-work": "3.0.0-dev.27.0",
26
26
  "@types/react": "^16.14.24 || ^17.0.38",
27
27
  "@types/react-dom": "^16.9.14 || ^17.0.11",
28
28
  "@types/styled-components": "^5.1.7",