@pega/cosmos-react-social 3.0.0-dev.4.2 → 3.0.0-dev.7.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 (82) hide show
  1. package/lib/components/Chat/Chat.js +1 -1
  2. package/lib/components/Chat/Chat.js.map +1 -1
  3. package/lib/components/Chat/ChatBody.js +1 -1
  4. package/lib/components/Chat/ChatBody.js.map +1 -1
  5. package/lib/components/Chat/ChatComposer.js +6 -6
  6. package/lib/components/Chat/ChatComposer.js.map +1 -1
  7. package/lib/components/Chat/ChatHeader.js +1 -1
  8. package/lib/components/Chat/ChatHeader.js.map +1 -1
  9. package/lib/components/Chat/ChatTranscript.js +3 -3
  10. package/lib/components/Chat/ChatTranscript.js.map +1 -1
  11. package/lib/components/Chat/Message.js +9 -9
  12. package/lib/components/Chat/Message.js.map +1 -1
  13. package/lib/components/Chat/MessageList.js +3 -3
  14. package/lib/components/Chat/MessageList.js.map +1 -1
  15. package/lib/components/Chat/RepeatingView.js +1 -1
  16. package/lib/components/Chat/RepeatingView.js.map +1 -1
  17. package/lib/components/Chat/SuggestedReplyPicker.js +6 -6
  18. package/lib/components/Chat/SuggestedReplyPicker.js.map +1 -1
  19. package/lib/components/Chat/SystemMessage.js +1 -1
  20. package/lib/components/Chat/SystemMessage.js.map +1 -1
  21. package/lib/components/Chat/TranscriptMessage.js +2 -2
  22. package/lib/components/Chat/TranscriptMessage.js.map +1 -1
  23. package/lib/components/Chat/TypeIndicator.js +1 -1
  24. package/lib/components/Chat/TypeIndicator.js.map +1 -1
  25. package/lib/components/Email/ContextMenuPopover.js +2 -2
  26. package/lib/components/Email/ContextMenuPopover.js.map +1 -1
  27. package/lib/components/Email/Email.js +24 -24
  28. package/lib/components/Email/Email.js.map +1 -1
  29. package/lib/components/Email/Email.types.d.ts +1 -1
  30. package/lib/components/Email/Email.types.d.ts.map +1 -1
  31. package/lib/components/Email/Email.types.js.map +1 -1
  32. package/lib/components/Email/EmailComposer.d.ts.map +1 -1
  33. package/lib/components/Email/EmailComposer.js +40 -33
  34. package/lib/components/Email/EmailComposer.js.map +1 -1
  35. package/lib/components/Email/EmailConversation.js +4 -4
  36. package/lib/components/Email/EmailConversation.js.map +1 -1
  37. package/lib/components/Email/EmailEntity.js +2 -2
  38. package/lib/components/Email/EmailEntity.js.map +1 -1
  39. package/lib/components/Email/EmailSelector.d.ts +2 -2
  40. package/lib/components/Email/EmailSelector.d.ts.map +1 -1
  41. package/lib/components/Email/EmailSelector.js +36 -28
  42. package/lib/components/Email/EmailSelector.js.map +1 -1
  43. package/lib/components/Email/EmailShell.js +4 -4
  44. package/lib/components/Email/EmailShell.js.map +1 -1
  45. package/lib/components/Email/EmailSummaryItem.js +4 -4
  46. package/lib/components/Email/EmailSummaryItem.js.map +1 -1
  47. package/lib/components/Email/EmailSummaryList.js +5 -5
  48. package/lib/components/Email/EmailSummaryList.js.map +1 -1
  49. package/lib/components/Email/EntityList.js +2 -2
  50. package/lib/components/Email/EntityList.js.map +1 -1
  51. package/lib/components/Email/index.d.ts +1 -1
  52. package/lib/components/Email/index.d.ts.map +1 -1
  53. package/lib/components/Email/index.js.map +1 -1
  54. package/lib/components/Feed/Feed.js +4 -4
  55. package/lib/components/Feed/Feed.js.map +1 -1
  56. package/lib/components/Feed/FeedAnnouncer.js +1 -1
  57. package/lib/components/Feed/FeedAnnouncer.js.map +1 -1
  58. package/lib/components/Feed/FeedAttachments.js +3 -3
  59. package/lib/components/Feed/FeedAttachments.js.map +1 -1
  60. package/lib/components/Feed/FeedContent.js +1 -1
  61. package/lib/components/Feed/FeedContent.js.map +1 -1
  62. package/lib/components/Feed/FeedLikeButton.js +4 -4
  63. package/lib/components/Feed/FeedLikeButton.js.map +1 -1
  64. package/lib/components/Feed/FeedModalList.js +1 -1
  65. package/lib/components/Feed/FeedModalList.js.map +1 -1
  66. package/lib/components/Feed/FeedNewPost.js +4 -4
  67. package/lib/components/Feed/FeedNewPost.js.map +1 -1
  68. package/lib/components/Feed/FeedNewPostTypeMenu.js +8 -8
  69. package/lib/components/Feed/FeedNewPostTypeMenu.js.map +1 -1
  70. package/lib/components/Feed/FeedPost.js +9 -9
  71. package/lib/components/Feed/FeedPost.js.map +1 -1
  72. package/lib/components/Feed/FeedReply.js +6 -6
  73. package/lib/components/Feed/FeedReply.js.map +1 -1
  74. package/lib/components/Feed/FeedReplyInput.js +4 -4
  75. package/lib/components/Feed/FeedReplyInput.js.map +1 -1
  76. package/lib/components/Feed/FeedRichText.js +1 -1
  77. package/lib/components/Feed/FeedRichText.js.map +1 -1
  78. package/lib/components/HashtagButton/HashtagButton.js +2 -2
  79. package/lib/components/HashtagButton/HashtagButton.js.map +1 -1
  80. package/lib/components/MentionButton/MentionButton.js +2 -2
  81. package/lib/components/MentionButton/MentionButton.js.map +1 -1
  82. package/package.json +5 -5
@@ -1 +1 @@
1
- {"version":3,"file":"Email.types.js","sourceRoot":"","sources":["../../../src/components/Email/Email.types.ts"],"names":[],"mappings":"","sourcesContent":["import { MouseEventHandler, ReactNode, Ref } from 'react';\n\nimport {\n BaseProps,\n AvatarProps,\n SentimentProps,\n FileDisplayProps,\n FileUploadItemProps,\n OmitStrict,\n MenuProps,\n MenuItemProps,\n TooltipProps,\n NoChildrenProp,\n EmptyStateProps,\n ProgressProps\n} from '@pega/cosmos-react-core';\nimport { RichTextEditorProps } from '@pega/cosmos-react-rte';\n\nexport interface EmailTemplate {\n /** Template title */\n title: string;\n /** Template id */\n id: string;\n}\n\nexport interface EmailUser {\n /** Short name of the User */\n shortName: string;\n /** Full name of the User */\n fullName: string;\n /** Email of the User */\n emailAddress: string;\n /** Avatar props of the User */\n avatarProps?: Partial<AvatarProps>;\n}\n\nexport interface EntityHighlightMapping {\n value: string;\n type: string;\n name: string;\n variant: number;\n description?: TooltipProps['children'];\n icon?: string;\n}\n\nexport interface ContextMenuProps\n extends OmitStrict<MenuProps, 'onItemClick' | 'header' | 'items'> {\n onItemClick: (selectedValue: { fieldName: string; fieldValue: string }) => void;\n heading: string;\n items: MenuItemProps[];\n}\nexport interface EmailProps extends BaseProps, NoChildrenProp {\n /** Ref to the element */\n ref?: Ref<HTMLDivElement>;\n /** Unique ID for this email record */\n id: string;\n /** Timestamp of this email as ISO8601 string, timestamp or native Date object. */\n timeStamp: Date | number | string;\n /** From email */\n from: EmailUser;\n /** To email */\n to: EmailUser[];\n /** Carbon copy of email users list */\n cc?: EmailUser[];\n /** Blind carbon copy of email users list */\n bcc?: EmailUser[];\n /** Sentiment */\n sentiment?: SentimentProps;\n /** Subject of the email */\n subject?: string;\n /** Body */\n body?: string;\n /** Forwarded content */\n forwardedContent?: string;\n /**\n * Entity highlight mapping\n * This requires body to be passed as a string with html tags\n */\n entityHighlightMapping?: EntityHighlightMapping[];\n /** onReply callback */\n onReply: (id: EmailProps['id']) => void;\n /** onForward Callback */\n onForward: (id: EmailProps['id']) => void;\n /** onReply callback */\n onReplyAll?: (id: EmailProps['id']) => void;\n /** List of suggestions */\n suggestions?: EmailTemplate[];\n /** Callback that triggers on click of tag */\n onSuggestionClick?: (id: EmailProps['id'], suggestionId: EmailTemplate['id']) => void;\n /** Actions region */\n actions?: ReactNode;\n /** Flag that indicates if email is unread\n * @default false\n */\n unRead?: boolean;\n /** Attachments list */\n attachments?: FileDisplayProps[];\n /** Items list in Popover */\n contextMenu?: ContextMenuProps;\n}\n\nexport interface EmailConversationProps extends BaseProps {\n /** ref to the element */\n ref?: Ref<HTMLLIElement>;\n /** Unique ID for this email conversation record */\n id: string;\n /** List of mails */\n emails: EmailProps[];\n /** Sender(s) of this email conversation */\n from: EmailUser;\n /** Recipient(s) of this email conversation */\n to: EmailUser[];\n /** Count of unread emails */\n unReadEmailCount?: number;\n /** Timestamp of this conversation as ISO8601 string, timestamp or native Date object. */\n timeStamp: Date | string | number;\n /** Flag that indicates if email conversation is expanded */\n isCollapsed?: boolean;\n /** Flag to set if conversation is spun off from forwarded email */\n isForwarded?: boolean;\n /** Callback when email conversation is collapsed */\n onCollapse?: () => void;\n /** Callback when email conversation is expanded */\n onExpand?: () => void;\n}\n\nexport interface EmailComposerData\n extends Pick<\n EmailComposerProps,\n 'cc' | 'bcc' | 'subject' | 'bodyContent' | 'attachments' | 'responseType'\n > {\n /** Array to hold the initial participants that should be default initialized in To address. */\n to: EmailUser['emailAddress'][];\n}\n\nexport type EmailResponseType = 'reply' | 'replyAll' | 'forward';\n\nexport interface EmailDirectRecipients {\n /** To address/addresses in case of reply response type on email. */\n reply: EmailUser['emailAddress'][];\n /** To address/addresses in case of replyAll response type on email. */\n replyAll: EmailUser['emailAddress'][];\n /** To address/addresses in case of forward response type on email. */\n forward?: EmailUser['emailAddress'][];\n}\n\nexport interface EmailComposerProps\n extends Pick<EmailProps, 'attachments' | 'suggestions' | 'onSuggestionClick'>,\n BaseProps,\n NoChildrenProp {\n /** Show loader until the background process completes */\n progress?: boolean | Pick<ProgressProps, 'message'>;\n /** Object containing full list of email participants. */\n participants: EmailUser[];\n /** Object to hold initial to address/addresses based on different action types. */\n to?: EmailDirectRecipients;\n /** Array to hold the initial participants that should be default initialized in Cc address. */\n cc?: EmailUser['emailAddress'][];\n /** Array to hold the initial participants that should be default initialized in Bcc address. */\n bcc?: EmailUser['emailAddress'][];\n /** Object containing the props to render the subject input */\n subject: string;\n /** Body content of the email */\n bodyContent: string;\n /** Template id to select the initial template */\n defaultTemplateId?: EmailTemplate['id'];\n /** Callback when email needs to be sent */\n onSend: (data: EmailComposerData) => void;\n /** Callback when image is added */\n onImageAdded?: RichTextEditorProps['onImageAdded'];\n /** List of attachments */\n attachments?: FileUploadItemProps[];\n /** Region to show more actions in footer */\n footerMoreActions?: ReactNode;\n /** Templates for drafting email */\n templates?: Pick<EmailTemplate, 'id' | 'title'>[];\n /** Template change callback */\n onTemplateChange?: (id: EmailTemplate['id']) => string;\n /** Callback when cancel composing */\n onCancel: () => void;\n /**\n * Callback to handle external entry validation\n * If returned true considers the entry to be a valid entry\n */\n externalValidator?: (value: string) => boolean;\n /** Ref to the element */\n ref?: Ref<HTMLDivElement>;\n /** Email action types */\n responseType?: EmailResponseType;\n}\nexport interface EmailShellProps extends BaseProps {\n /** ref to the element */\n ref?: Ref<HTMLDivElement>;\n /** Region for header */\n headerProps?: {\n /** Region for actions */\n actions?: ReactNode;\n /** Subject of the email conversations list */\n subject?: string;\n };\n /** Email conversations */\n conversations?: EmailConversationProps[];\n /** Shows only one conversation at a time */\n autoCollapse?: boolean;\n}\n\nexport interface EmailSummaryItemProps extends BaseProps {\n /** Id of each summary item */\n id: string;\n /** List of from participant names of the conversations */\n activeParticipants: EmailUser[];\n /** Email body of last email in the email */\n message: string;\n /** Timestamp of the latest email */\n timeStamp: Date | string | number;\n /** Top topic of an email */\n topic?: string;\n /** Sentiment */\n sentiment?: SentimentProps;\n /** Urgency of an email */\n urgency?: number;\n /** Total number of unread emails in the email */\n unreadEmailCount?: number;\n /** Is the email currently active */\n active?: boolean;\n /** On click of email item */\n onClick: MouseEventHandler;\n /** ref to the element */\n ref?: Ref<HTMLButtonElement>;\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 EmailSummaryListProps extends BaseProps {\n /** List of email categories */\n categories: MenuProps['items'];\n /** Handles category change */\n onCategoryClick?: MenuItemProps['onClick'];\n /** List of EmailItems items */\n items: OmitStrict<EmailSummaryItemProps, 'onClick' | 'active'>[];\n /** Total number of unread email count */\n unreadEmailCount?: number;\n /** A set of filters to apply to the email inbox. */\n filters?: Filter[];\n /** A callback that runs when a filter is clicked. */\n onFilterChange?: (filterId: Filter['id'], on: boolean) => void;\n /** onClick of list item */\n onItemClick: (id: EmailSummaryItemProps['id']) => void;\n /** Indicates if the data is being currently loading */\n loading?: boolean;\n /** Callback to fetch more rows */\n onLoadMore?: () => void;\n /** ref to the element */\n ref?: Ref<HTMLDivElement>;\n /** Empty message when there are no email summary items */\n emptyMessage?: EmptyStateProps['message'];\n}\n\nexport interface EmailEntityProps extends BaseProps {\n entity: EntityHighlightMapping;\n ref?: Ref<HTMLElement>;\n}\n\nexport interface TargetProps {\n cursorPosition: { x: number; y: number };\n targetNode: Node | null;\n}\n\nexport interface ContextMenuPopoverProps extends BaseProps, TargetProps {\n contextMenu: ContextMenuProps;\n}\n\nexport interface EntityListProps extends BaseProps {\n content: {\n name: string;\n value?: {\n id: string;\n entity: EntityHighlightMapping;\n }[];\n }[];\n\n header: {\n icon: string;\n text: string;\n };\n ref?: Ref<HTMLDivElement>;\n}\n\nexport interface StyledContextMenuFieldSelectorProps extends BaseProps {\n selected?: boolean;\n}\n"]}
1
+ {"version":3,"file":"Email.types.js","sourceRoot":"","sources":["../../../src/components/Email/Email.types.ts"],"names":[],"mappings":"","sourcesContent":["import { MouseEventHandler, ReactNode, Ref } from 'react';\n\nimport {\n BaseProps,\n AvatarProps,\n SentimentProps,\n FileDisplayProps,\n FileUploadItemProps,\n OmitStrict,\n MenuProps,\n MenuItemProps,\n TooltipProps,\n NoChildrenProp,\n EmptyStateProps,\n ProgressProps\n} from '@pega/cosmos-react-core';\nimport { RichTextEditorProps } from '@pega/cosmos-react-rte';\n\nexport interface EmailTemplate {\n /** Template title */\n title: string;\n /** Template id */\n id: string;\n}\n\nexport interface EmailUser {\n /** Short name of the User */\n shortName: string;\n /** Full name of the User */\n fullName: string;\n /** Email of the User */\n emailAddress: string;\n /** Avatar props of the User */\n avatarProps?: Partial<AvatarProps>;\n}\n\nexport interface EntityHighlightMapping {\n value: string;\n type: string;\n name: string;\n variant: number;\n description?: TooltipProps['children'];\n icon?: string;\n}\n\nexport interface ContextMenuProps\n extends OmitStrict<MenuProps, 'onItemClick' | 'header' | 'items'> {\n onItemClick: (selectedValue: { fieldName: string; fieldValue: string }) => void;\n heading: string;\n items: MenuItemProps[];\n}\nexport interface EmailProps extends BaseProps, NoChildrenProp {\n /** Ref to the element */\n ref?: Ref<HTMLDivElement>;\n /** Unique ID for this email record */\n id: string;\n /** Timestamp of this email as ISO8601 string, timestamp or native Date object. */\n timeStamp: Date | number | string;\n /** From email */\n from: EmailUser;\n /** To email */\n to: EmailUser[];\n /** Carbon copy of email users list */\n cc?: EmailUser[];\n /** Blind carbon copy of email users list */\n bcc?: EmailUser[];\n /** Sentiment */\n sentiment?: SentimentProps;\n /** Subject of the email */\n subject?: string;\n /** Body */\n body?: string;\n /** Forwarded content */\n forwardedContent?: string;\n /**\n * Entity highlight mapping\n * This requires body to be passed as a string with html tags\n */\n entityHighlightMapping?: EntityHighlightMapping[];\n /** onReply callback */\n onReply: (id: EmailProps['id']) => void;\n /** onForward Callback */\n onForward: (id: EmailProps['id']) => void;\n /** onReply callback */\n onReplyAll?: (id: EmailProps['id']) => void;\n /** List of suggestions */\n suggestions?: EmailTemplate[];\n /** Callback that triggers on click of tag */\n onSuggestionClick?: (id: EmailProps['id'], suggestionId: EmailTemplate['id']) => void;\n /** Actions region */\n actions?: ReactNode;\n /** Flag that indicates if email is unread\n * @default false\n */\n unRead?: boolean;\n /** Attachments list */\n attachments?: FileDisplayProps[];\n /** Items list in Popover */\n contextMenu?: ContextMenuProps;\n}\n\nexport interface EmailConversationProps extends BaseProps {\n /** ref to the element */\n ref?: Ref<HTMLLIElement>;\n /** Unique ID for this email conversation record */\n id: string;\n /** List of mails */\n emails: EmailProps[];\n /** Sender(s) of this email conversation */\n from: EmailUser;\n /** Recipient(s) of this email conversation */\n to: EmailUser[];\n /** Count of unread emails */\n unReadEmailCount?: number;\n /** Timestamp of this conversation as ISO8601 string, timestamp or native Date object. */\n timeStamp: Date | string | number;\n /** Flag that indicates if email conversation is expanded */\n isCollapsed?: boolean;\n /** Flag to set if conversation is spun off from forwarded email */\n isForwarded?: boolean;\n /** Callback when email conversation is collapsed */\n onCollapse?: () => void;\n /** Callback when email conversation is expanded */\n onExpand?: () => void;\n}\n\nexport interface EmailComposerData\n extends Pick<\n EmailComposerProps,\n 'cc' | 'bcc' | 'subject' | 'bodyContent' | 'attachments' | 'responseType'\n > {\n /** Array to hold the initial participants that should be default initialized in To address. */\n to: EmailUser['emailAddress'][];\n}\n\nexport type EmailResponseType = 'reply' | 'replyAll' | 'forward';\n\nexport interface EmailDirectRecipients {\n /** To address/addresses in case of reply response type on email. */\n reply: EmailUser['emailAddress'][];\n /** To address/addresses in case of replyAll response type on email. */\n replyAll: EmailUser['emailAddress'][];\n /** To address/addresses in case of forward response type on email. */\n forward?: EmailUser['emailAddress'][];\n}\n\nexport interface EmailComposerProps\n extends Pick<EmailProps, 'attachments' | 'suggestions' | 'onSuggestionClick'>,\n BaseProps,\n NoChildrenProp {\n /** Show loader until the background process completes */\n progress?: boolean | Pick<ProgressProps, 'message'>;\n /** Object containing full list of email participants. */\n participants: EmailUser[];\n /** Object to hold initial to address/addresses based on different action types. */\n to?: EmailDirectRecipients;\n /** Array to hold the initial participants that should be default initialized in Cc address. */\n cc?: EmailUser['emailAddress'][];\n /** Array to hold the initial participants that should be default initialized in Bcc address. */\n bcc?: EmailUser['emailAddress'][];\n /** Object containing the props to render the subject input */\n subject: string;\n /** Body content of the email */\n bodyContent: string;\n /** Template id to select the initial template */\n defaultTemplateId?: EmailTemplate['id'];\n /** Callback when email needs to be sent */\n onSend: (data: EmailComposerData) => void;\n /** Callback when image is added */\n onImageAdded?: RichTextEditorProps['onImageAdded'];\n /** List of attachments */\n attachments?: FileUploadItemProps[];\n /** Region to show more actions in footer */\n footerMoreActions?: ReactNode;\n /** Templates for drafting email */\n templates?: Pick<EmailTemplate, 'id' | 'title'>[];\n /** Template change callback */\n onTemplateChange?: (id: EmailTemplate['id']) => string | Promise<string>;\n /** Callback when cancel composing */\n onCancel: () => void;\n /**\n * Callback to handle external entry validation\n * If returned true considers the entry to be a valid entry\n */\n externalValidator?: (value: string) => boolean;\n /** Ref to the element */\n ref?: Ref<HTMLDivElement>;\n /** Email action types */\n responseType?: EmailResponseType;\n}\nexport interface EmailShellProps extends BaseProps {\n /** ref to the element */\n ref?: Ref<HTMLDivElement>;\n /** Region for header */\n headerProps?: {\n /** Region for actions */\n actions?: ReactNode;\n /** Subject of the email conversations list */\n subject?: string;\n };\n /** Email conversations */\n conversations?: EmailConversationProps[];\n /** Shows only one conversation at a time */\n autoCollapse?: boolean;\n}\n\nexport interface EmailSummaryItemProps extends BaseProps {\n /** Id of each summary item */\n id: string;\n /** List of from participant names of the conversations */\n activeParticipants: EmailUser[];\n /** Email body of last email in the email */\n message: string;\n /** Timestamp of the latest email */\n timeStamp: Date | string | number;\n /** Top topic of an email */\n topic?: string;\n /** Sentiment */\n sentiment?: SentimentProps;\n /** Urgency of an email */\n urgency?: number;\n /** Total number of unread emails in the email */\n unreadEmailCount?: number;\n /** Is the email currently active */\n active?: boolean;\n /** On click of email item */\n onClick: MouseEventHandler;\n /** ref to the element */\n ref?: Ref<HTMLButtonElement>;\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 EmailSummaryListProps extends BaseProps {\n /** List of email categories */\n categories: MenuProps['items'];\n /** Handles category change */\n onCategoryClick?: MenuItemProps['onClick'];\n /** List of EmailItems items */\n items: OmitStrict<EmailSummaryItemProps, 'onClick' | 'active'>[];\n /** Total number of unread email count */\n unreadEmailCount?: number;\n /** A set of filters to apply to the email inbox. */\n filters?: Filter[];\n /** A callback that runs when a filter is clicked. */\n onFilterChange?: (filterId: Filter['id'], on: boolean) => void;\n /** onClick of list item */\n onItemClick: (id: EmailSummaryItemProps['id']) => void;\n /** Indicates if the data is being currently loading */\n loading?: boolean;\n /** Callback to fetch more rows */\n onLoadMore?: () => void;\n /** ref to the element */\n ref?: Ref<HTMLDivElement>;\n /** Empty message when there are no email summary items */\n emptyMessage?: EmptyStateProps['message'];\n}\n\nexport interface EmailEntityProps extends BaseProps {\n entity: EntityHighlightMapping;\n ref?: Ref<HTMLElement>;\n}\n\nexport interface TargetProps {\n cursorPosition: { x: number; y: number };\n targetNode: Node | null;\n}\n\nexport interface ContextMenuPopoverProps extends BaseProps, TargetProps {\n contextMenu: ContextMenuProps;\n}\n\nexport interface EntityListProps extends BaseProps {\n content: {\n name: string;\n value?: {\n id: string;\n entity: EntityHighlightMapping;\n }[];\n }[];\n\n header: {\n icon: string;\n text: string;\n };\n ref?: Ref<HTMLDivElement>;\n}\n\nexport interface StyledContextMenuFieldSelectorProps extends BaseProps {\n selected?: boolean;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"EmailComposer.d.ts","sourceRoot":"","sources":["../../../src/components/Email/EmailComposer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EASlB,MAAM,OAAO,CAAC;AAGf,OAAO,EAGL,IAAI,EAYL,MAAM,yBAAyB,CAAC;AAOjC,OAAO,EAAE,kBAAkB,EAAa,MAAM,eAAe,CAAC;AAK9D,eAAO,MAAM,mBAAmB,yHAW9B,CAAC;AAEH,eAAO,MAAM,sBAAsB,EAAE,OAAO,IAI1C,CAAC;AAIH,eAAO,MAAM,kBAAkB,qNAK7B,CAAC;AAmBH,QAAA,MAAM,aAAa,EAAE,iBAAiB,CAAC,kBAAkB,CAqVxD,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"EmailComposer.d.ts","sourceRoot":"","sources":["../../../src/components/Email/EmailComposer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EASlB,MAAM,OAAO,CAAC;AAGf,OAAO,EAGL,IAAI,EAYL,MAAM,yBAAyB,CAAC;AAOjC,OAAO,EAAE,kBAAkB,EAA4B,MAAM,eAAe,CAAC;AAK7E,eAAO,MAAM,mBAAmB,yHAW9B,CAAC;AAEH,eAAO,MAAM,sBAAsB,EAAE,OAAO,IAI1C,CAAC;AAIH,eAAO,MAAM,kBAAkB,qNAK7B,CAAC;AAkBH,QAAA,MAAM,aAAa,EAAE,iBAAiB,CAAC,kBAAkB,CA6VxD,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
3
3
  import { forwardRef, useState, useMemo, useRef, useCallback, useEffect } from 'react';
4
4
  import styled, { css } from 'styled-components';
5
5
  import { Button, Flex, Icon, registerIcon, useI18n, Option, defaultThemeProp, FileUploadItem, MenuButton, Select, Input, useUID, Progress } from '@pega/cosmos-react-core';
6
- import { RichTextEditor } from '@pega/cosmos-react-rte';
6
+ import { Editor } from '@pega/cosmos-react-rte';
7
7
  import * as paperClipIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/paper-clip.icon';
8
8
  import * as replyAllIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/reply-all.icon';
9
9
  import * as replyIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/reply.icon';
@@ -40,24 +40,21 @@ const responseTypeIcons = {
40
40
  replyAll: 'reply-all',
41
41
  forward: 'forward'
42
42
  };
43
- const rteToolbar = [
43
+ const editorToolbar = [
44
44
  'inline-styling',
45
- 'headers',
46
45
  'lists',
46
+ 'indentation',
47
47
  'images',
48
- 'cut-copy-paste',
49
- 'indentation'
48
+ 'links'
50
49
  ];
51
- const EmailComposer = forwardRef(({ participants, bodyContent, onCancel, onSend, onImageAdded, externalValidator, onTemplateChange, to, footerMoreActions, progress = false, templates, defaultTemplateId, ...restProps }, ref) => {
50
+ const EmailComposer = forwardRef(({ participants, bodyContent, onCancel, onSend, onImageAdded, externalValidator, onTemplateChange, to, footerMoreActions, progress = false, templates, defaultTemplateId, cc, bcc, responseType: responseTypeProp, subject: subjectProp, attachments: attachmentsProp, ...restProps }, ref) => {
52
51
  const t = useI18n();
53
- const [cc, setCC] = useState(restProps.cc);
54
- const [bcc, setBCC] = useState(restProps.bcc);
55
- const [responseType, setResponseType] = useState(restProps.responseType);
56
- const [showCC, setShowCC] = useState(restProps.responseType !== 'reply' && !!cc && cc.length > 0);
57
- const [showBCC, setShowBCC] = useState(restProps.responseType !== 'reply' && !!bcc && bcc.length > 0);
58
- const [subject, setSubject] = useState(restProps.subject);
52
+ const [responseType, setResponseType] = useState(responseTypeProp);
53
+ const [showCC, setShowCC] = useState(responseTypeProp !== 'reply' && !!cc && cc.length > 0);
54
+ const [showBCC, setShowBCC] = useState(responseTypeProp !== 'reply' && !!bcc && bcc.length > 0);
55
+ const [subject, setSubject] = useState(subjectProp);
59
56
  const [autoReplyTemplate, setAutoReplyTemplate] = useState(defaultTemplateId || '');
60
- const [attachments, setAttachments] = useState(restProps.attachments || []);
57
+ const [attachments, setAttachments] = useState(attachmentsProp || []);
61
58
  const [toAddresses, setToAddresses] = useState(() => {
62
59
  if (responseType && to?.[responseType])
63
60
  return to?.[responseType];
@@ -73,27 +70,37 @@ const EmailComposer = forwardRef(({ participants, bodyContent, onCancel, onSend,
73
70
  return bcc;
74
71
  return [];
75
72
  });
76
- const initialCC = cc;
77
- const initialBCC = bcc;
78
- const rteEditorRef = useRef(null);
73
+ const editorRef = useRef(null);
79
74
  const fileUploadInputRef = useRef(null);
80
75
  const uid = useUID();
76
+ const replaceBodyWithTemplate = async (templateId) => {
77
+ if (templateId && onTemplateChange) {
78
+ const templateContent = await onTemplateChange(templateId);
79
+ editorRef?.current?.insertHtml(templateContent, true);
80
+ }
81
+ };
81
82
  // inserts selected template in RTE
82
83
  useEffect(() => {
83
84
  const selectedTemplate = templates?.find(template => template.id === autoReplyTemplate);
84
85
  if (selectedTemplate) {
85
- rteEditorRef?.current?.insertHtml(onTemplateChange?.(selectedTemplate.id), true);
86
+ replaceBodyWithTemplate(selectedTemplate.id);
86
87
  }
87
88
  }, [autoReplyTemplate]);
88
89
  // resets To | CC | BCC combobox selection and toggles fields on responseType change reply | replyAll | forward
89
90
  useEffect(() => {
91
+ if (responseType && to?.[responseType]) {
92
+ setToAddresses(to?.[responseType]);
93
+ }
94
+ else {
95
+ setToAddresses([]);
96
+ }
90
97
  setShowCC(responseType === 'replyAll' ? !!cc && cc.length > 0 : false);
91
- setShowBCC(responseType === 'replyAll' && !!bcc && bcc?.length > 0 ? !!bcc : false);
98
+ setShowBCC(responseType === 'replyAll' ? !!bcc && bcc.length > 0 : false);
92
99
  if (responseType === 'replyAll') {
93
- setCC(initialCC);
94
- setBCC(initialBCC);
100
+ setCcAddresses(cc || []);
101
+ setBccAddresses(bcc || []);
95
102
  }
96
- if (responseType === 'reply') {
103
+ else if (responseType === 'reply') {
97
104
  setCcAddresses([]);
98
105
  setBccAddresses([]);
99
106
  }
@@ -110,7 +117,7 @@ const EmailComposer = forwardRef(({ participants, bodyContent, onCancel, onSend,
110
117
  {
111
118
  id: 'reply',
112
119
  primary: t('reply'),
113
- visual: _jsx(StyledResponseTypeIcon, { name: responseTypeIcons.reply }, void 0),
120
+ visual: _jsx(StyledResponseTypeIcon, { name: responseTypeIcons.reply }),
114
121
  selected: responseType === 'reply',
115
122
  onClick: () => {
116
123
  setResponseType('reply');
@@ -119,7 +126,7 @@ const EmailComposer = forwardRef(({ participants, bodyContent, onCancel, onSend,
119
126
  {
120
127
  id: 'replyAll',
121
128
  primary: t('reply_all'),
122
- visual: _jsx(StyledResponseTypeIcon, { name: responseTypeIcons.replyAll }, void 0),
129
+ visual: _jsx(StyledResponseTypeIcon, { name: responseTypeIcons.replyAll }),
123
130
  selected: responseType === 'replyAll',
124
131
  onClick: () => {
125
132
  setResponseType('replyAll');
@@ -152,15 +159,15 @@ const EmailComposer = forwardRef(({ participants, bodyContent, onCancel, onSend,
152
159
  ]);
153
160
  }
154
161
  }, []);
155
- const selectedItems = (selections, label) => {
162
+ const updateSelectedItems = (selectedItems, label) => {
156
163
  if (label === 'To') {
157
- setToAddresses(selections);
164
+ setToAddresses(selectedItems);
158
165
  }
159
166
  if (label === 'Cc') {
160
- setCcAddresses(selections);
167
+ setCcAddresses(selectedItems);
161
168
  }
162
169
  if (label === 'Bcc') {
163
- setBccAddresses(selections);
170
+ setBccAddresses(selectedItems);
164
171
  }
165
172
  };
166
173
  const handleSend = () => {
@@ -169,14 +176,14 @@ const EmailComposer = forwardRef(({ participants, bodyContent, onCancel, onSend,
169
176
  cc: showCC ? ccAddresses : undefined,
170
177
  bcc: showBCC ? bccAddresses : undefined,
171
178
  subject,
172
- bodyContent: rteEditorRef.current?.getHtml() || '',
179
+ bodyContent: editorRef.current?.getHtml() || '',
173
180
  attachments,
174
181
  responseType
175
182
  });
176
183
  };
177
184
  const handleImageAdded = (image, id) => {
178
185
  const src = URL.createObjectURL(image);
179
- rteEditorRef.current?.appendImage({ src, alt: image.name }, id);
186
+ editorRef.current?.appendImage({ src, alt: image.name }, id);
180
187
  if (onImageAdded)
181
188
  onImageAdded(image, id);
182
189
  };
@@ -186,7 +193,7 @@ const EmailComposer = forwardRef(({ participants, bodyContent, onCancel, onSend,
186
193
  }, progress: !!progress, children: [_jsx("div", { children: responseType !== 'forward' && (_jsx(MenuButton, { text: responseTypeMenuData.selectedResponseType, variant: 'link', icon: responseTypeMenuData.selectedResponseTypeIcon, menu: {
187
194
  mode: 'single-select',
188
195
  items: responseTypeMenuData.menuItems
189
- } }, void 0)) }, void 0), _jsxs(Flex, { container: {
196
+ } })) }), _jsxs(Flex, { container: {
190
197
  alignItems: 'start',
191
198
  gap: 0.5
192
199
  }, children: [_jsx(Flex, { container: {
@@ -194,14 +201,14 @@ const EmailComposer = forwardRef(({ participants, bodyContent, onCancel, onSend,
194
201
  direction: 'column'
195
202
  }, item: {
196
203
  grow: 1
197
- }, children: _jsx(EmailSelector, { participants: participants, defaultSelections: to?.[responseType], label: t('to'), mode: 'multi-select', required: true, selections: selectedItems, externalValidator: externalValidator }, void 0) }, void 0), !showCC && (_jsx(StyledToggleButton, { variant: 'simple', onClick: () => setShowCC(true), icon: true, children: t('cc') }, void 0)), !showBCC && (_jsx(StyledToggleButton, { variant: 'simple', onClick: () => setShowBCC(true), icon: true, children: t('bcc') }, void 0))] }, void 0), showCC && (_jsx(EmailSelector, { participants: participants, defaultSelections: responseType === 'replyAll' ? cc : undefined, label: t('cc'), mode: 'multi-select', selections: selectedItems, externalValidator: externalValidator }, void 0)), showBCC && (_jsx(EmailSelector, { selections: selectedItems, participants: participants, defaultSelections: responseType === 'replyAll' ? bcc : undefined, label: t('bcc'), mode: 'multi-select', externalValidator: externalValidator }, void 0)), _jsx(Input, { value: subject, onChange: onSubjectChange, label: t('subject') }, void 0), _jsxs(Select, { onChange: onTemplateSelectionChange, label: t('auto_reply'), value: autoReplyTemplate, children: [_jsx(Option, { value: uid, children: t('insert') }, uid), _jsx(_Fragment, { children: templateOptions }, void 0)] }, void 0), _jsx(RichTextEditor, { autoFocus: true, ref: rteEditorRef, toolbar: rteToolbar, onImageAdded: handleImageAdded, labelHidden: true, label: t('email_message'), defaultValue: bodyContent,
204
+ }, children: _jsx(EmailSelector, { participants: participants, selectedItems: toAddresses, label: t('to'), mode: 'multi-select', required: true, onSelectedItemChange: updateSelectedItems, externalValidator: externalValidator }) }), !showCC && (_jsx(StyledToggleButton, { variant: 'simple', onClick: () => setShowCC(true), icon: true, children: t('cc') })), !showBCC && (_jsx(StyledToggleButton, { variant: 'simple', onClick: () => setShowBCC(true), icon: true, children: t('bcc') }))] }), showCC && (_jsx(EmailSelector, { participants: participants, selectedItems: ccAddresses, label: t('cc'), mode: 'multi-select', onSelectedItemChange: updateSelectedItems, externalValidator: externalValidator })), showBCC && (_jsx(EmailSelector, { participants: participants, selectedItems: bccAddresses, label: t('bcc'), mode: 'multi-select', onSelectedItemChange: updateSelectedItems, externalValidator: externalValidator })), _jsx(Input, { value: subject, onChange: onSubjectChange, label: t('subject') }), _jsxs(Select, { onChange: onTemplateSelectionChange, label: t('auto_reply'), value: autoReplyTemplate, children: [_jsx(Option, { value: uid, children: t('insert') }, uid), _jsx(_Fragment, { children: templateOptions })] }), _jsx(Editor, { autoFocus: true, ref: editorRef, toolbar: editorToolbar, onImageAdded: handleImageAdded, labelHidden: true, label: t('email_message'), defaultValue: bodyContent,
198
205
  // Below rem values are derived from min 150px, max 300px minus the approx height of toolbar
199
206
  height: {
200
207
  min: '7rem',
201
208
  max: '16.5rem'
202
- } }, void 0), attachments.length > 0 && (_jsx(Flex, { container: { gap: 1, wrap: 'wrap' }, children: attachments.map(attachment => (_createElement(FileUploadItem, { ...attachment, key: attachment.name, onDelete: onAttachmentDelete }))) }, void 0)), _jsxs(Flex, { container: {
209
+ } }), attachments.length > 0 && (_jsx(Flex, { container: { gap: 1, wrap: 'wrap' }, children: attachments.map(attachment => (_createElement(FileUploadItem, { ...attachment, key: attachment.name, onDelete: onAttachmentDelete }))) })), _jsxs(Flex, { container: {
203
210
  gap: 1
204
- }, children: [_jsxs(Flex, { container: true, item: { grow: 1 }, children: [_jsx(Button, { variant: 'secondary', onClick: onCancel, children: t('cancel') }, void 0), footerMoreActions] }, void 0), _jsxs(Flex, { container: true, children: [_jsx(Button, { onClick: () => fileUploadInputRef.current?.click(), variant: 'link', label: t('file_upload_text_multiple'), children: _jsx(Icon, { name: 'paper-clip' }, void 0) }, void 0), _jsx(Button, { variant: 'primary', onClick: handleSend, children: t('send_label') }, void 0)] }, void 0)] }, void 0), _jsx("input", { type: 'file', style: { display: 'none' }, ref: fileUploadInputRef, onChange: onFileChange, multiple: true }, void 0)] }, void 0), !!progress && (_jsx(Progress, { visible: !!progress, placement: 'local', message: typeof progress === 'object' ? progress.message : t('loading') }, void 0))] }, void 0));
211
+ }, children: [_jsxs(Flex, { container: true, item: { grow: 1 }, children: [_jsx(Button, { variant: 'secondary', onClick: onCancel, children: t('cancel') }), footerMoreActions] }), _jsxs(Flex, { container: true, children: [_jsx(Button, { onClick: () => fileUploadInputRef.current?.click(), variant: 'link', label: t('file_upload_text_multiple'), children: _jsx(Icon, { name: 'paper-clip' }) }), _jsx(Button, { variant: 'primary', onClick: handleSend, children: t('send_label') })] })] }), _jsx("input", { type: 'file', style: { display: 'none' }, ref: fileUploadInputRef, onChange: onFileChange, multiple: true })] }), _jsx(Progress, { visible: !!progress, placement: 'local', message: typeof progress === 'object' ? progress.message : t('loading') })] }));
205
212
  });
206
213
  export default EmailComposer;
207
214
  //# sourceMappingURL=EmailComposer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"EmailComposer.js","sourceRoot":"","sources":["../../../src/components/Email/EmailComposer.tsx"],"names":[],"mappings":";;AAAA,OAAO,EACL,UAAU,EAGV,QAAQ,EAER,OAAO,EACP,MAAM,EACN,WAAW,EACX,SAAS,EAEV,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,OAAO,EACP,MAAM,EACN,gBAAgB,EAChB,cAAc,EACd,UAAU,EAEV,MAAM,EACN,KAAK,EACL,MAAM,EACN,QAAQ,EACT,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,cAAc,EAA4C,MAAM,wBAAwB,CAAC;AAClG,OAAO,KAAK,aAAa,MAAM,mEAAmE,CAAC;AACnG,OAAO,KAAK,YAAY,MAAM,kEAAkE,CAAC;AACjG,OAAO,KAAK,SAAS,MAAM,8DAA8D,CAAC;AAC1F,OAAO,KAAK,WAAW,MAAM,gEAAgE,CAAC;AAG9F,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAE5C,YAAY,CAAC,aAAa,EAAE,YAAY,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;AAElE,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAqB,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IACjF,OAAO,GAAG,CAAA;;MAEN,QAAQ;QACR,CAAC,CAAC,GAAG,CAAA;;SAEF;QACH,CAAC,CAAC,GAAG,CAAA;;SAEF;GACN,CAAC;AACJ,CAA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AAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import {\n forwardRef,\n FunctionComponent,\n PropsWithoutRef,\n useState,\n ChangeEvent,\n useMemo,\n useRef,\n useCallback,\n useEffect,\n ReactNode\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Button,\n Flex,\n Icon,\n registerIcon,\n useI18n,\n Option,\n defaultThemeProp,\n FileUploadItem,\n MenuButton,\n FileUploadItemProps,\n Select,\n Input,\n useUID,\n Progress\n} from '@pega/cosmos-react-core';\nimport { RichTextEditor, RichTextEditorProps, RichTextEditorState } from '@pega/cosmos-react-rte';\nimport * as paperClipIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/paper-clip.icon';\nimport * as replyAllIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/reply-all.icon';\nimport * as replyIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/reply.icon';\nimport * as forwardIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/forward.icon';\n\nimport { EmailComposerProps, EmailUser } from './Email.types';\nimport EmailSelector from './EmailSelector';\n\nregisterIcon(paperClipIcon, replyAllIcon, replyIcon, forwardIcon);\n\nexport const StyledEmailComposer = styled.div<EmailComposerProps>(({ progress }) => {\n return css`\n max-height: 70vh;\n ${progress\n ? css`\n visibility: hidden;\n `\n : css`\n visibility: visible;\n `}\n `;\n});\n\nexport const StyledResponseTypeIcon: typeof Icon = styled(Icon)(({ theme }) => {\n return css`\n color: ${theme.base.palette.interactive};\n `;\n});\n\nStyledResponseTypeIcon.defaultProps = defaultThemeProp;\n\nexport const StyledToggleButton = styled(Button)(({ theme }) => {\n return css`\n margin-block-start: calc(2 * ${theme.base.spacing});\n color: ${theme.base.palette.interactive};\n `;\n});\n\nStyledToggleButton.defaultProps = defaultThemeProp;\n\nconst responseTypeIcons = {\n reply: 'reply',\n replyAll: 'reply-all',\n forward: 'forward'\n};\n\nconst rteToolbar: RichTextEditorProps['toolbar'] = [\n 'inline-styling',\n 'headers',\n 'lists',\n 'images',\n 'cut-copy-paste',\n 'indentation'\n];\n\nconst EmailComposer: FunctionComponent<EmailComposerProps> = forwardRef(\n (\n {\n participants,\n bodyContent,\n onCancel,\n onSend,\n onImageAdded,\n externalValidator,\n onTemplateChange,\n to,\n footerMoreActions,\n progress = false,\n templates,\n defaultTemplateId,\n ...restProps\n }: PropsWithoutRef<EmailComposerProps>,\n ref: EmailComposerProps['ref']\n ) => {\n const t = useI18n();\n const [cc, setCC] = useState(restProps.cc);\n const [bcc, setBCC] = useState(restProps.bcc);\n const [responseType, setResponseType] = useState(restProps.responseType);\n const [showCC, setShowCC] = useState(\n restProps.responseType !== 'reply' && !!cc && cc.length > 0\n );\n const [showBCC, setShowBCC] = useState(\n restProps.responseType !== 'reply' && !!bcc && bcc.length > 0\n );\n const [subject, setSubject] = useState(restProps.subject);\n const [autoReplyTemplate, setAutoReplyTemplate] = useState(defaultTemplateId || '');\n const [attachments, setAttachments] = useState(restProps.attachments || []);\n const [toAddresses, setToAddresses] = useState<EmailUser['emailAddress'][]>(() => {\n if (responseType && to?.[responseType])\n return to?.[responseType] as EmailUser['emailAddress'][];\n return [];\n });\n const [ccAddresses, setCcAddresses] = useState<EmailUser['emailAddress'][]>(() => {\n if (responseType === 'replyAll') return cc as EmailUser['emailAddress'][];\n return [];\n });\n const [bccAddresses, setBccAddresses] = useState<EmailUser['emailAddress'][]>(() => {\n if (responseType === 'replyAll') return bcc as EmailUser['emailAddress'][];\n return [];\n });\n\n const initialCC = cc;\n const initialBCC = bcc;\n\n const rteEditorRef = useRef<RichTextEditorState>(null);\n const fileUploadInputRef = useRef<HTMLInputElement>(null);\n const uid = useUID();\n\n // inserts selected template in RTE\n useEffect(() => {\n const selectedTemplate = templates?.find(template => template.id === autoReplyTemplate);\n if (selectedTemplate) {\n rteEditorRef?.current?.insertHtml(onTemplateChange?.(selectedTemplate.id) as string, true);\n }\n }, [autoReplyTemplate]);\n\n // resets To | CC | BCC combobox selection and toggles fields on responseType change reply | replyAll | forward\n useEffect(() => {\n setShowCC(responseType === 'replyAll' ? !!cc && cc.length > 0 : false);\n setShowBCC(responseType === 'replyAll' && !!bcc && bcc?.length > 0 ? !!bcc : false);\n if (responseType === 'replyAll') {\n setCC(initialCC);\n setBCC(initialBCC);\n }\n if (responseType === 'reply') {\n setCcAddresses([] as EmailUser['emailAddress'][]);\n setBccAddresses([] as EmailUser['emailAddress'][]);\n }\n }, [responseType]);\n\n const templateOptions = useMemo(\n () =>\n templates &&\n templates.map(template => {\n if (template.id === defaultTemplateId) {\n <Option selected='selected' key={template.id} value={template.id}>\n {template.title}\n </Option>;\n }\n return (\n <Option key={template.id} value={template.id}>\n {template.title}\n </Option>\n );\n }),\n [templates]\n );\n\n const responseTypeMenuData = useMemo(() => {\n const menuItems = [\n {\n id: 'reply',\n primary: t('reply'),\n visual: <StyledResponseTypeIcon name={responseTypeIcons.reply} />,\n selected: responseType === 'reply',\n onClick: () => {\n setResponseType('reply');\n }\n },\n {\n id: 'replyAll',\n primary: t('reply_all'),\n visual: <StyledResponseTypeIcon name={responseTypeIcons.replyAll} />,\n selected: responseType === 'replyAll',\n onClick: () => {\n setResponseType('replyAll');\n }\n }\n ];\n return {\n menuItems,\n selectedResponseType:\n menuItems.find(item => item.selected)?.primary || menuItems[0].primary,\n selectedResponseTypeIcon:\n (responseType && responseTypeIcons[responseType]) || responseTypeIcons.reply\n };\n }, [responseType]);\n\n const onSubjectChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setSubject(e.target.value);\n }, []);\n\n const onTemplateSelectionChange = useCallback((e: ChangeEvent<HTMLSelectElement>) => {\n setAutoReplyTemplate(e.target.value);\n }, []);\n\n const onAttachmentDelete = useCallback((name: FileUploadItemProps['name']) => {\n setAttachments(prevAttachments => prevAttachments.filter(item => item.name !== name));\n }, []);\n\n const onFileChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n if (e.target.files) {\n setAttachments(prevAttachments => [\n ...prevAttachments,\n ...Array.from(e.target.files!).map(file => ({\n name: file.name,\n file\n }))\n ]);\n }\n }, []);\n\n const selectedItems = (selections: EmailUser['emailAddress'][], label: ReactNode) => {\n if (label === 'To') {\n setToAddresses(selections);\n }\n if (label === 'Cc') {\n setCcAddresses(selections);\n }\n if (label === 'Bcc') {\n setBccAddresses(selections);\n }\n };\n const handleSend = () => {\n onSend({\n to: toAddresses,\n cc: showCC ? ccAddresses : undefined,\n bcc: showBCC ? bccAddresses : undefined,\n subject,\n bodyContent: rteEditorRef.current?.getHtml() || '',\n attachments,\n responseType\n });\n };\n\n const handleImageAdded = (image: File, id: string) => {\n const src = URL.createObjectURL(image);\n rteEditorRef.current?.appendImage({ src, alt: image.name }, id);\n if (onImageAdded) onImageAdded(image, id);\n };\n\n return (\n <>\n <Flex\n as={StyledEmailComposer}\n ref={ref}\n {...restProps}\n container={{\n gap: 2,\n direction: 'column'\n }}\n progress={!!progress}\n >\n <div>\n {responseType !== 'forward' && (\n <MenuButton\n text={responseTypeMenuData.selectedResponseType}\n variant='link'\n icon={responseTypeMenuData.selectedResponseTypeIcon}\n menu={{\n mode: 'single-select',\n items: responseTypeMenuData.menuItems\n }}\n />\n )}\n </div>\n\n <Flex\n container={{\n alignItems: 'start',\n gap: 0.5\n }}\n >\n <Flex\n container={{\n gap: 1,\n direction: 'column'\n }}\n item={{\n grow: 1\n }}\n >\n <EmailSelector\n participants={participants}\n defaultSelections={to?.[responseType!]}\n label={t('to')}\n mode='multi-select'\n required\n selections={selectedItems}\n externalValidator={externalValidator}\n />\n </Flex>\n {!showCC && (\n <StyledToggleButton variant='simple' onClick={() => setShowCC(true)} icon>\n {t('cc')}\n </StyledToggleButton>\n )}\n {!showBCC && (\n <StyledToggleButton variant='simple' onClick={() => setShowBCC(true)} icon>\n {t('bcc')}\n </StyledToggleButton>\n )}\n </Flex>\n\n {showCC && (\n <EmailSelector\n participants={participants}\n defaultSelections={responseType === 'replyAll' ? cc : undefined}\n label={t('cc')}\n mode='multi-select'\n selections={selectedItems}\n externalValidator={externalValidator}\n />\n )}\n {showBCC && (\n <EmailSelector\n selections={selectedItems}\n participants={participants}\n defaultSelections={responseType === 'replyAll' ? bcc : undefined}\n label={t('bcc')}\n mode='multi-select'\n externalValidator={externalValidator}\n />\n )}\n\n <Input value={subject} onChange={onSubjectChange} label={t('subject')} />\n\n <Select\n onChange={onTemplateSelectionChange}\n label={t('auto_reply')}\n value={autoReplyTemplate}\n >\n <Option key={uid} value={uid}>\n {t('insert')}\n </Option>\n <>{templateOptions}</>\n </Select>\n\n <RichTextEditor\n autoFocus\n ref={rteEditorRef}\n toolbar={rteToolbar}\n onImageAdded={handleImageAdded}\n labelHidden\n label={t('email_message')}\n defaultValue={bodyContent}\n // Below rem values are derived from min 150px, max 300px minus the approx height of toolbar\n height={{\n min: '7rem',\n max: '16.5rem'\n }}\n />\n {attachments.length > 0 && (\n <Flex container={{ gap: 1, wrap: 'wrap' }}>\n {attachments.map(attachment => (\n <FileUploadItem\n {...attachment}\n key={attachment.name}\n onDelete={onAttachmentDelete}\n />\n ))}\n </Flex>\n )}\n <Flex\n container={{\n gap: 1\n }}\n >\n <Flex container item={{ grow: 1 }}>\n <Button variant='secondary' onClick={onCancel}>\n {t('cancel')}\n </Button>\n {footerMoreActions}\n </Flex>\n <Flex container>\n <Button\n onClick={() => fileUploadInputRef.current?.click()}\n variant='link'\n label={t('file_upload_text_multiple')}\n >\n <Icon name='paper-clip' />\n </Button>\n\n <Button variant='primary' onClick={handleSend}>\n {t('send_label')}\n </Button>\n </Flex>\n </Flex>\n <input\n type='file'\n style={{ display: 'none' }}\n ref={fileUploadInputRef}\n onChange={onFileChange}\n multiple\n />\n </Flex>\n {!!progress && (\n <Progress\n visible={!!progress}\n placement='local'\n message={typeof progress === 'object' ? progress.message : t('loading')}\n />\n )}\n </>\n );\n }\n);\n\nexport default EmailComposer;\n"]}
1
+ {"version":3,"file":"EmailComposer.js","sourceRoot":"","sources":["../../../src/components/Email/EmailComposer.tsx"],"names":[],"mappings":";;AAAA,OAAO,EACL,UAAU,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,CAAC,EAAE,aAC/B,KAAC,MAAM,IAAC,OAAO,EAAC,WAAW,EAAC,OAAO,EAAE,QAAQ,YAC1C,CAAC,CAAC,QAAQ,CAAC,GACL,EACR,iBAAiB,IACb,EACP,MAAC,IAAI,IAAC,SAAS,mBACb,KAAC,MAAM,IACL,OAAO,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,OAAO,EAAE,KAAK,EAAE,EAClD,OAAO,EAAC,MAAM,EACd,KAAK,EAAE,CAAC,CAAC,2BAA2B,CAAC,YAErC,KAAC,IAAI,IAAC,IAAI,EAAC,YAAY,GAAG,GACnB,EAET,KAAC,MAAM,IAAC,OAAO,EAAC,SAAS,EAAC,OAAO,EAAE,UAAU,YAC1C,CAAC,CAAC,YAAY,CAAC,GACT,IACJ,IACF,EACP,gBACE,IAAI,EAAC,MAAM,EACX,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAC1B,GAAG,EAAE,kBAAkB,EACvB,QAAQ,EAAE,YAAY,EACtB,QAAQ,SACR,IACG,EACP,KAAC,QAAQ,IACP,OAAO,EAAE,CAAC,CAAC,QAAQ,EACnB,SAAS,EAAC,OAAO,EACjB,OAAO,EAAE,OAAO,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GACvE,IACD,CACJ,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import {\n forwardRef,\n FunctionComponent,\n PropsWithoutRef,\n useState,\n ChangeEvent,\n useMemo,\n useRef,\n useCallback,\n useEffect,\n ReactNode\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Button,\n Flex,\n Icon,\n registerIcon,\n useI18n,\n Option,\n defaultThemeProp,\n FileUploadItem,\n MenuButton,\n FileUploadItemProps,\n Select,\n Input,\n useUID,\n Progress\n} from '@pega/cosmos-react-core';\nimport { Editor, EditorState, EditorProps } from '@pega/cosmos-react-rte';\nimport * as paperClipIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/paper-clip.icon';\nimport * as replyAllIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/reply-all.icon';\nimport * as replyIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/reply.icon';\nimport * as forwardIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/forward.icon';\n\nimport { EmailComposerProps, EmailTemplate, EmailUser } from './Email.types';\nimport EmailSelector from './EmailSelector';\n\nregisterIcon(paperClipIcon, replyAllIcon, replyIcon, forwardIcon);\n\nexport const StyledEmailComposer = styled.div<EmailComposerProps>(({ progress }) => {\n return css`\n max-height: 70vh;\n ${progress\n ? css`\n visibility: hidden;\n `\n : css`\n visibility: visible;\n `}\n `;\n});\n\nexport const StyledResponseTypeIcon: typeof Icon = styled(Icon)(({ theme }) => {\n return css`\n color: ${theme.base.palette.interactive};\n `;\n});\n\nStyledResponseTypeIcon.defaultProps = defaultThemeProp;\n\nexport const StyledToggleButton = styled(Button)(({ theme }) => {\n return css`\n margin-block-start: calc(2 * ${theme.base.spacing});\n color: ${theme.base.palette.interactive};\n `;\n});\n\nStyledToggleButton.defaultProps = defaultThemeProp;\n\nconst responseTypeIcons = {\n reply: 'reply',\n replyAll: 'reply-all',\n forward: 'forward'\n};\n\nconst editorToolbar: EditorProps['toolbar'] = [\n 'inline-styling',\n 'lists',\n 'indentation',\n 'images',\n 'links'\n];\n\nconst EmailComposer: FunctionComponent<EmailComposerProps> = forwardRef(\n (\n {\n participants,\n bodyContent,\n onCancel,\n onSend,\n onImageAdded,\n externalValidator,\n onTemplateChange,\n to,\n footerMoreActions,\n progress = false,\n templates,\n defaultTemplateId,\n cc,\n bcc,\n responseType: responseTypeProp,\n subject: subjectProp,\n attachments: attachmentsProp,\n ...restProps\n }: PropsWithoutRef<EmailComposerProps>,\n ref: EmailComposerProps['ref']\n ) => {\n const t = useI18n();\n\n const [responseType, setResponseType] = useState(responseTypeProp);\n const [showCC, setShowCC] = useState(responseTypeProp !== 'reply' && !!cc && cc.length > 0);\n const [showBCC, setShowBCC] = useState(responseTypeProp !== 'reply' && !!bcc && bcc.length > 0);\n const [subject, setSubject] = useState(subjectProp);\n const [autoReplyTemplate, setAutoReplyTemplate] = useState(defaultTemplateId || '');\n const [attachments, setAttachments] = useState(attachmentsProp || []);\n const [toAddresses, setToAddresses] = useState<EmailUser['emailAddress'][]>(() => {\n if (responseType && to?.[responseType])\n return to?.[responseType] as EmailUser['emailAddress'][];\n return [];\n });\n const [ccAddresses, setCcAddresses] = useState<EmailUser['emailAddress'][]>(() => {\n if (responseType === 'replyAll') return cc as EmailUser['emailAddress'][];\n return [];\n });\n const [bccAddresses, setBccAddresses] = useState<EmailUser['emailAddress'][]>(() => {\n if (responseType === 'replyAll') return bcc as EmailUser['emailAddress'][];\n return [];\n });\n\n const editorRef = useRef<EditorState>(null);\n const fileUploadInputRef = useRef<HTMLInputElement>(null);\n const uid = useUID();\n\n const replaceBodyWithTemplate = async (templateId: EmailTemplate['id']) => {\n if (templateId && onTemplateChange) {\n const templateContent = await onTemplateChange(templateId);\n editorRef?.current?.insertHtml(templateContent, true);\n }\n };\n\n // inserts selected template in RTE\n useEffect(() => {\n const selectedTemplate = templates?.find(template => template.id === autoReplyTemplate);\n if (selectedTemplate) {\n replaceBodyWithTemplate(selectedTemplate.id);\n }\n }, [autoReplyTemplate]);\n\n // resets To | CC | BCC combobox selection and toggles fields on responseType change reply | replyAll | forward\n useEffect(() => {\n if (responseType && to?.[responseType]) {\n setToAddresses(to?.[responseType] as EmailUser['emailAddress'][]);\n } else {\n setToAddresses([]);\n }\n\n setShowCC(responseType === 'replyAll' ? !!cc && cc.length > 0 : false);\n setShowBCC(responseType === 'replyAll' ? !!bcc && bcc.length > 0 : false);\n\n if (responseType === 'replyAll') {\n setCcAddresses(cc || []);\n setBccAddresses(bcc || []);\n } else if (responseType === 'reply') {\n setCcAddresses([] as EmailUser['emailAddress'][]);\n setBccAddresses([] as EmailUser['emailAddress'][]);\n }\n }, [responseType]);\n\n const templateOptions = useMemo(\n () =>\n templates &&\n templates.map(template => {\n if (template.id === defaultTemplateId) {\n <Option selected='selected' key={template.id} value={template.id}>\n {template.title}\n </Option>;\n }\n return (\n <Option key={template.id} value={template.id}>\n {template.title}\n </Option>\n );\n }),\n [templates]\n );\n\n const responseTypeMenuData = useMemo(() => {\n const menuItems = [\n {\n id: 'reply',\n primary: t('reply'),\n visual: <StyledResponseTypeIcon name={responseTypeIcons.reply} />,\n selected: responseType === 'reply',\n onClick: () => {\n setResponseType('reply');\n }\n },\n {\n id: 'replyAll',\n primary: t('reply_all'),\n visual: <StyledResponseTypeIcon name={responseTypeIcons.replyAll} />,\n selected: responseType === 'replyAll',\n onClick: () => {\n setResponseType('replyAll');\n }\n }\n ];\n return {\n menuItems,\n selectedResponseType:\n menuItems.find(item => item.selected)?.primary || menuItems[0].primary,\n selectedResponseTypeIcon:\n (responseType && responseTypeIcons[responseType]) || responseTypeIcons.reply\n };\n }, [responseType]);\n\n const onSubjectChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setSubject(e.target.value);\n }, []);\n\n const onTemplateSelectionChange = useCallback((e: ChangeEvent<HTMLSelectElement>) => {\n setAutoReplyTemplate(e.target.value);\n }, []);\n\n const onAttachmentDelete = useCallback((name: FileUploadItemProps['name']) => {\n setAttachments(prevAttachments => prevAttachments.filter(item => item.name !== name));\n }, []);\n\n const onFileChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n if (e.target.files) {\n setAttachments(prevAttachments => [\n ...prevAttachments,\n ...Array.from(e.target.files!).map(file => ({\n name: file.name,\n file\n }))\n ]);\n }\n }, []);\n\n const updateSelectedItems = (selectedItems: EmailUser['emailAddress'][], label: ReactNode) => {\n if (label === 'To') {\n setToAddresses(selectedItems);\n }\n if (label === 'Cc') {\n setCcAddresses(selectedItems);\n }\n if (label === 'Bcc') {\n setBccAddresses(selectedItems);\n }\n };\n\n const handleSend = () => {\n onSend({\n to: toAddresses,\n cc: showCC ? ccAddresses : undefined,\n bcc: showBCC ? bccAddresses : undefined,\n subject,\n bodyContent: editorRef.current?.getHtml() || '',\n attachments,\n responseType\n });\n };\n\n const handleImageAdded = (image: File, id: string) => {\n const src = URL.createObjectURL(image);\n editorRef.current?.appendImage({ src, alt: image.name }, id);\n if (onImageAdded) onImageAdded(image, id);\n };\n return (\n <>\n <Flex\n as={StyledEmailComposer}\n ref={ref}\n {...restProps}\n container={{\n gap: 2,\n direction: 'column'\n }}\n progress={!!progress}\n >\n <div>\n {responseType !== 'forward' && (\n <MenuButton\n text={responseTypeMenuData.selectedResponseType}\n variant='link'\n icon={responseTypeMenuData.selectedResponseTypeIcon}\n menu={{\n mode: 'single-select',\n items: responseTypeMenuData.menuItems\n }}\n />\n )}\n </div>\n\n <Flex\n container={{\n alignItems: 'start',\n gap: 0.5\n }}\n >\n <Flex\n container={{\n gap: 1,\n direction: 'column'\n }}\n item={{\n grow: 1\n }}\n >\n <EmailSelector\n participants={participants}\n selectedItems={toAddresses}\n label={t('to')}\n mode='multi-select'\n required\n onSelectedItemChange={updateSelectedItems}\n externalValidator={externalValidator}\n />\n </Flex>\n {!showCC && (\n <StyledToggleButton variant='simple' onClick={() => setShowCC(true)} icon>\n {t('cc')}\n </StyledToggleButton>\n )}\n {!showBCC && (\n <StyledToggleButton variant='simple' onClick={() => setShowBCC(true)} icon>\n {t('bcc')}\n </StyledToggleButton>\n )}\n </Flex>\n\n {showCC && (\n <EmailSelector\n participants={participants}\n selectedItems={ccAddresses}\n label={t('cc')}\n mode='multi-select'\n onSelectedItemChange={updateSelectedItems}\n externalValidator={externalValidator}\n />\n )}\n {showBCC && (\n <EmailSelector\n participants={participants}\n selectedItems={bccAddresses}\n label={t('bcc')}\n mode='multi-select'\n onSelectedItemChange={updateSelectedItems}\n externalValidator={externalValidator}\n />\n )}\n\n <Input value={subject} onChange={onSubjectChange} label={t('subject')} />\n\n <Select\n onChange={onTemplateSelectionChange}\n label={t('auto_reply')}\n value={autoReplyTemplate}\n >\n <Option key={uid} value={uid}>\n {t('insert')}\n </Option>\n <>{templateOptions}</>\n </Select>\n\n <Editor\n autoFocus\n ref={editorRef}\n toolbar={editorToolbar}\n onImageAdded={handleImageAdded}\n labelHidden\n label={t('email_message')}\n defaultValue={bodyContent}\n // Below rem values are derived from min 150px, max 300px minus the approx height of toolbar\n height={{\n min: '7rem',\n max: '16.5rem'\n }}\n />\n {attachments.length > 0 && (\n <Flex container={{ gap: 1, wrap: 'wrap' }}>\n {attachments.map(attachment => (\n <FileUploadItem\n {...attachment}\n key={attachment.name}\n onDelete={onAttachmentDelete}\n />\n ))}\n </Flex>\n )}\n <Flex\n container={{\n gap: 1\n }}\n >\n <Flex container item={{ grow: 1 }}>\n <Button variant='secondary' onClick={onCancel}>\n {t('cancel')}\n </Button>\n {footerMoreActions}\n </Flex>\n <Flex container>\n <Button\n onClick={() => fileUploadInputRef.current?.click()}\n variant='link'\n label={t('file_upload_text_multiple')}\n >\n <Icon name='paper-clip' />\n </Button>\n\n <Button variant='primary' onClick={handleSend}>\n {t('send_label')}\n </Button>\n </Flex>\n </Flex>\n <input\n type='file'\n style={{ display: 'none' }}\n ref={fileUploadInputRef}\n onChange={onFileChange}\n multiple\n />\n </Flex>\n <Progress\n visible={!!progress}\n placement='local'\n message={typeof progress === 'object' ? progress.message : t('loading')}\n />\n </>\n );\n }\n);\n\nexport default EmailComposer;\n"]}
@@ -158,22 +158,22 @@ const EmailConversation = forwardRef((props, ref) => {
158
158
  }
159
159
  return recipientElements;
160
160
  }, [to]);
161
- return (_jsxs(StyledEmailConversation, { ...restProps, id: id, ref: ref, children: [_jsxs(Flex, { as: StyledConversationButton, id: `conversation-heading${id}`, "aria-controls": id, "aria-expanded": !collapsedState, container: { gap: 1, alignItems: 'center', pad: 1 }, onClick: onExpandCollapse, ref: headerRef, children: [_jsx(Icon, { name: collapsedState ? caretDirection : 'caret-down' }, void 0), _jsx(StyledUnreadIndicator, { isVisible: !!unReadEmailCount }, void 0), _jsxs(Flex, { container: {
161
+ return (_jsxs(StyledEmailConversation, { ...restProps, id: id, ref: ref, children: [_jsxs(Flex, { as: StyledConversationButton, id: `conversation-heading${id}`, "aria-controls": id, "aria-expanded": !collapsedState, container: { gap: 1, alignItems: 'center', pad: 1 }, onClick: onExpandCollapse, ref: headerRef, children: [_jsx(Icon, { name: collapsedState ? caretDirection : 'caret-down' }), _jsx(StyledUnreadIndicator, { isVisible: !!unReadEmailCount }), _jsxs(Flex, { container: {
162
162
  wrap: 'nowrap',
163
163
  alignItems: 'start',
164
164
  direction: 'column'
165
165
  }, item: {
166
166
  grow: 1,
167
167
  shrink: 1
168
- }, children: [_jsx(Text, { variant: 'primary', as: StyledEmailParticipantsText, children: `${isForwarded ? 'FW' : t('from')}: ${from.fullName}` }, void 0), _jsxs(Text, { variant: 'secondary', as: StyledEmailParticipantsText, children: [`${t('to')}: `, generateRecipientList] }, void 0), !isSmallOrAbove && (_jsxs(Text, { variant: 'secondary', as: StyledCompactTimeStampDisplay, children: [`${new Intl.DateTimeFormat(locale, { weekday: 'short' }).format(new Date(timeStamp))}, `, _jsx(DateTimeDisplay, { variant: 'datetime', format: 'short', value: timeStamp }, void 0)] }, void 0))] }, void 0), _jsx(Flex, { container: {
168
+ }, children: [_jsx(Text, { variant: 'primary', as: StyledEmailParticipantsText, children: `${isForwarded ? 'FW' : t('from')}: ${from.fullName}` }), _jsxs(Text, { variant: 'secondary', as: StyledEmailParticipantsText, children: [`${t('to')}: `, generateRecipientList] }), !isSmallOrAbove && (_jsxs(Text, { variant: 'secondary', as: StyledCompactTimeStampDisplay, children: [`${new Intl.DateTimeFormat(locale, { weekday: 'short' }).format(new Date(timeStamp))}, `, _jsx(DateTimeDisplay, { variant: 'datetime', format: 'short', value: timeStamp })] }))] }), _jsx(Flex, { container: {
169
169
  gap: 1,
170
170
  alignItems: 'center'
171
171
  }, item: {
172
172
  shrink: 0
173
- }, children: isSmallOrAbove && (_jsxs(Text, { variant: 'secondary', as: StyledEmailParticipantsText, children: [`${new Intl.DateTimeFormat(locale, { weekday: 'short' }).format(new Date(timeStamp))}, `, _jsx(DateTimeDisplay, { variant: 'datetime', format: 'short', value: timeStamp }, void 0)] }, void 0)) }, void 0)] }, void 0), _jsxs(ExpandCollapse, { as: Flex, container: { direction: 'column' }, collapsed: collapsedState, onBeforeCollapse: onCollapse, onBeforeExpand: onExpand, role: 'region', "aria-labelledby": `conversation-heading${id}`, id: `conversation-content${id}`, children: [!!unReadEmailCount && (_jsx(Text, { as: StyledUnReadCount, id: `unread-emailCount-${id}`, variant: 'secondary', children: t('new_emails_count', [unReadEmailCount], { count: unReadEmailCount }) }, void 0)), emails &&
173
+ }, children: isSmallOrAbove && (_jsxs(Text, { variant: 'secondary', as: StyledEmailParticipantsText, children: [`${new Intl.DateTimeFormat(locale, { weekday: 'short' }).format(new Date(timeStamp))}, `, _jsx(DateTimeDisplay, { variant: 'datetime', format: 'short', value: timeStamp })] })) })] }), _jsxs(ExpandCollapse, { as: Flex, container: { direction: 'column' }, collapsed: collapsedState, onBeforeCollapse: onCollapse, onBeforeExpand: onExpand, role: 'region', "aria-labelledby": `conversation-heading${id}`, id: `conversation-content${id}`, children: [!!unReadEmailCount && (_jsx(Text, { as: StyledUnReadCount, id: `unread-emailCount-${id}`, variant: 'secondary', children: t('new_emails_count', [unReadEmailCount], { count: unReadEmailCount }) })), emails &&
174
174
  emails.map(email => {
175
175
  return _jsx(StyledEmailInConversation, { ...email }, email.id);
176
- })] }, void 0)] }, void 0));
176
+ })] })] }));
177
177
  });
178
178
  export default EmailConversation;
179
179
  //# sourceMappingURL=EmailConversation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"EmailConversation.js","sourceRoot":"","sources":["../../../src/components/Email/EmailConversation.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAsC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAClG,OAAO,MAAM,EAAE,EAAE,GAAG,EAA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AAE,OAAO,EAAE,CAAC,CAAC,MAAM,CAC9D,IAAI,IAAI,CAAC,SAAS,CAAC,CACpB,IAAI,EACL,KAAC,eAAe,IAAC,OAAO,EAAC,UAAU,EAAC,MAAM,EAAC,OAAO,EAAC,KAAK,EAAE,SAAS,WAAI,YAClE,CACR,WACI,YACF,EAEP,MAAC,cAAc,IACb,EAAE,EAAE,IAAI,EACR,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,EAClC,SAAS,EAAE,cAAc,EACzB,gBAAgB,EAAE,UAAU,EAC5B,cAAc,EAAE,QAAQ,EACxB,IAAI,EAAC,QAAQ,qBACI,uBAAuB,EAAE,EAAE,EAC5C,EAAE,EAAE,uBAAuB,EAAE,EAAE,aAE9B,CAAC,CAAC,gBAAgB,IAAI,CACrB,KAAC,IAAI,IAAC,EAAE,EAAE,iBAAiB,EAAE,EAAE,EAAE,qBAAqB,EAAE,EAAE,EAAE,OAAO,EAAC,WAAW,YAC5E,CAAC,CAAC,kBAAkB,EAAE,CAAC,gBAAgB,CAAC,EAAE,EAAE,KAAK,EAAE,gBAAgB,EAAE,CAAC,WAClE,CACR,EACA,MAAM;wBACL,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;4BACjB,OAAO,KAAC,yBAAyB,OAAoB,KAAK,IAAnB,KAAK,CAAC,EAAE,CAAe,CAAC;wBACjE,CAAC,CAAC,YACW,YACO,CAC3B,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,iBAAiB,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, PropsWithoutRef, useRef, useState, useMemo } from 'react';\nimport styled, { css } from 'styled-components';\nimport { mix, readableColor } from 'polished';\n\nimport * as caretDownIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-down.icon';\nimport {\n ExpandCollapse,\n Flex,\n Icon,\n registerIcon,\n Text,\n useI18n,\n defaultThemeProp,\n ForwardProps,\n useAfterInitialEffect,\n DateTimeDisplay,\n readableHue,\n useBreakpoint,\n useConfiguration,\n StyledIcon,\n tryCatch,\n useDirection\n} from '@pega/cosmos-react-core';\n\nimport Email from './Email';\nimport { EmailConversationProps } from './Email.types';\n\nregisterIcon(caretDownIcon);\n\nconst EmailParticipantTextCss = css`\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n max-width: 100%;\n`;\n\nexport const StyledEmailParticipantsText = styled(Text)`\n ${EmailParticipantTextCss}\n`;\n\nStyledEmailParticipantsText.defaultProps = defaultThemeProp;\n\nexport const StyledCompactTimeStampDisplay = styled(Text)`\n ${EmailParticipantTextCss}\n margin-top: calc(${props => props.theme.base.spacing} / 2);\n`;\nStyledCompactTimeStampDisplay.defaultProps = defaultThemeProp;\n\nexport const StyledConversationHeader = styled.header<{ collapsed: boolean }>(\n ({ theme, collapsed }) => {\n return css`\n border-bottom: ${collapsed ? 0 : '0.0625rem'} solid ${theme.base.palette['border-line']};\n position: sticky;\n top: 0;\n z-index: 1;\n `;\n }\n);\nStyledConversationHeader.defaultProps = defaultThemeProp;\n\nexport const StyledUnReadCount = styled.div(({ theme: { base } }) => {\n const readableBackground = readableHue(\n base.palette['brand-primary'],\n base.palette['primary-background']\n );\n const readableTextColor = readableColor(readableBackground);\n\n return css`\n align-self: flex-start;\n background-color: ${readableBackground};\n color: ${readableTextColor};\n padding: 0 ${base.spacing};\n font-weight: ${base['font-weight']['semi-bold']};\n\n /* stylelint-disable declaration-block-no-duplicate-properties */\n width: fit-content;\n width: -moz-fit-content;\n\n /* stylelint-enable declaration-block-no-duplicate-properties */\n `;\n});\n\nStyledUnReadCount.defaultProps = defaultThemeProp;\n\nexport const StyledEmailConversation = styled.li(({ theme: { base } }) => {\n return css`\n margin-bottom: ${base.spacing};\n border-radius: ${base['border-radius']};\n overflow: hidden;\n background-color: ${base.palette['primary-background']};\n list-style-type: none;\n `;\n});\nStyledEmailConversation.defaultProps = defaultThemeProp;\n\nexport const StyledEmailInConversation = styled(Email)(({ unRead, theme: { base } }) => {\n const readableBackground = readableHue(\n base.palette['brand-primary'],\n base.palette['primary-background']\n );\n return css`\n padding: calc(2 * ${base.spacing}) 0;\n border-bottom: 0.0625rem solid ${base.palette['border-line']};\n position: relative;\n ${unRead &&\n css`\n &::before {\n content: '';\n background-color: ${readableBackground};\n position: absolute;\n inset: 0;\n height: calc(100% + 0.0625rem);\n top: -0.0625rem;\n width: 0.125rem;\n }\n `}\n `;\n});\nStyledEmailInConversation.defaultProps = defaultThemeProp;\n\nconst StyledForwardIcon = styled.svg(({ theme }) => {\n const readableStrokeColor = readableHue(\n theme.base.colors.purple.medium,\n theme.base.palette['primary-background']\n );\n return css`\n color: ${readableStrokeColor};\n `;\n});\nStyledForwardIcon.defaultProps = defaultThemeProp;\n\nconst StyledUnreadIndicator = styled.span<{ isVisible: boolean }>(({ theme, isVisible }) => {\n const readableBackground = readableHue(\n theme.base.palette['brand-primary'],\n theme.base.palette['primary-background']\n );\n\n const diameter = '0.375rem';\n\n return css`\n width: ${isVisible ? diameter : 0};\n margin: 0 ${isVisible ? 0 : '0.188rem'};\n height: ${diameter};\n display: inline-block;\n border-radius: 50%;\n background: ${readableBackground};\n position: relative;\n top: 0.375rem;\n align-self: flex-start;\n `;\n});\nStyledUnreadIndicator.defaultProps = defaultThemeProp;\n\nconst StyledConversationButton = styled.button(({ theme }) => {\n const hoverColor = tryCatch(() =>\n mix(0.85, theme.base.palette['primary-background'], theme.base.palette['brand-primary'])\n );\n return css`\n border-width: 0;\n width: 100%;\n padding: ${theme.base.spacing};\n background: ${theme.base.palette['primary-background']};\n position: sticky;\n top: 0;\n z-index: 1;\n\n &[aria-expanded='true'] {\n border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};\n }\n\n &:focus {\n background: ${theme.base.palette['secondary-background']};\n outline: none;\n }\n\n &:hover {\n background: ${hoverColor};\n outline: none;\n }\n\n & > ${StyledIcon} {\n align-self: flex-start;\n color: ${theme.base.palette['foreground-color']};\n }\n `;\n});\n\nStyledConversationButton.defaultProps = defaultThemeProp;\n\nconst EmailConversation: FunctionComponent<EmailConversationProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<EmailConversationProps>, ref: EmailConversationProps['ref']) => {\n const {\n id,\n emails,\n from,\n to,\n unReadEmailCount,\n timeStamp,\n isForwarded = false,\n isCollapsed = false,\n onCollapse,\n onExpand,\n ...restProps\n } = props;\n const t = useI18n();\n const [collapsedState, setCollapsedState] = useState(isCollapsed);\n useAfterInitialEffect(() => {\n setCollapsedState(isCollapsed);\n }, [isCollapsed]);\n const onExpandCollapse = () => {\n setCollapsedState(!collapsedState);\n };\n\n const headerRef = useRef<HTMLDivElement>(null);\n const isSmallOrAbove = useBreakpoint('sm', { breakpointRef: headerRef });\n const { locale } = useConfiguration();\n const { rtl } = useDirection();\n\n const caretDirection = rtl ? 'caret-left' : 'caret-right';\n const generateRecipientList = useMemo(() => {\n const recipientElements = to.slice(0, 2).map((recipient, i) => {\n return `${recipient.shortName}${i < to.length - 1 ? ';' : ''} `;\n });\n if (to.length > 2) {\n return [...recipientElements, `+${to.length - 2} more`];\n }\n return recipientElements;\n }, [to]);\n\n return (\n <StyledEmailConversation {...restProps} id={id} ref={ref}>\n <Flex\n as={StyledConversationButton}\n id={`conversation-heading${id}`}\n aria-controls={id}\n aria-expanded={!collapsedState}\n container={{ gap: 1, alignItems: 'center', pad: 1 }}\n onClick={onExpandCollapse}\n ref={headerRef}\n >\n <Icon name={collapsedState ? caretDirection : 'caret-down'} />\n <StyledUnreadIndicator isVisible={!!unReadEmailCount} />\n <Flex\n container={{\n wrap: 'nowrap',\n alignItems: 'start',\n direction: 'column'\n }}\n item={{\n grow: 1,\n shrink: 1\n }}\n >\n <Text variant='primary' as={StyledEmailParticipantsText}>\n {`${isForwarded ? 'FW' : t('from')}: ${from.fullName}`}\n </Text>\n <Text variant='secondary' as={StyledEmailParticipantsText}>\n {`${t('to')}: `}\n {generateRecipientList}\n </Text>\n {!isSmallOrAbove && (\n <Text variant='secondary' as={StyledCompactTimeStampDisplay}>\n {`${new Intl.DateTimeFormat(locale, { weekday: 'short' }).format(\n new Date(timeStamp)\n )}, `}\n <DateTimeDisplay variant='datetime' format='short' value={timeStamp} />\n </Text>\n )}\n </Flex>\n <Flex\n container={{\n gap: 1,\n alignItems: 'center'\n }}\n item={{\n shrink: 0\n }}\n >\n {isSmallOrAbove && (\n <Text variant='secondary' as={StyledEmailParticipantsText}>\n {`${new Intl.DateTimeFormat(locale, { weekday: 'short' }).format(\n new Date(timeStamp)\n )}, `}\n <DateTimeDisplay variant='datetime' format='short' value={timeStamp} />\n </Text>\n )}\n </Flex>\n </Flex>\n\n <ExpandCollapse\n as={Flex}\n container={{ direction: 'column' }}\n collapsed={collapsedState}\n onBeforeCollapse={onCollapse}\n onBeforeExpand={onExpand}\n role='region'\n aria-labelledby={`conversation-heading${id}`}\n id={`conversation-content${id}`}\n >\n {!!unReadEmailCount && (\n <Text as={StyledUnReadCount} id={`unread-emailCount-${id}`} variant='secondary'>\n {t('new_emails_count', [unReadEmailCount], { count: unReadEmailCount })}\n </Text>\n )}\n {emails &&\n emails.map(email => {\n return <StyledEmailInConversation key={email.id} {...email} />;\n })}\n </ExpandCollapse>\n </StyledEmailConversation>\n );\n }\n);\n\nexport default EmailConversation;\n"]}
1
+ {"version":3,"file":"EmailConversation.js","sourceRoot":"","sources":["../../../src/components/Email/EmailConversation.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAsC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAClG,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,OAAO,KAAK,aAAa,MAAM,mEAAmE,CAAC;AACnG,OAAO,EACL,cAAc,EACd,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,IAAI,EACJ,OAAO,EACP,gBAAgB,EAEhB,qBAAqB,EACrB,eAAe,EACf,WA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AAE,SAAS,EAAE,QAAQ,EAAE,EAClC,SAAS,EAAE,cAAc,EACzB,gBAAgB,EAAE,UAAU,EAC5B,cAAc,EAAE,QAAQ,EACxB,IAAI,EAAC,QAAQ,qBACI,uBAAuB,EAAE,EAAE,EAC5C,EAAE,EAAE,uBAAuB,EAAE,EAAE,aAE9B,CAAC,CAAC,gBAAgB,IAAI,CACrB,KAAC,IAAI,IAAC,EAAE,EAAE,iBAAiB,EAAE,EAAE,EAAE,qBAAqB,EAAE,EAAE,EAAE,OAAO,EAAC,WAAW,YAC5E,CAAC,CAAC,kBAAkB,EAAE,CAAC,gBAAgB,CAAC,EAAE,EAAE,KAAK,EAAE,gBAAgB,EAAE,CAAC,GAClE,CACR,EACA,MAAM;wBACL,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;4BACjB,OAAO,KAAC,yBAAyB,OAAoB,KAAK,IAAnB,KAAK,CAAC,EAAE,CAAe,CAAC;wBACjE,CAAC,CAAC,IACW,IACO,CAC3B,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,iBAAiB,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, PropsWithoutRef, useRef, useState, useMemo } from 'react';\nimport styled, { css } from 'styled-components';\nimport { mix, readableColor } from 'polished';\n\nimport * as caretDownIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-down.icon';\nimport {\n ExpandCollapse,\n Flex,\n Icon,\n registerIcon,\n Text,\n useI18n,\n defaultThemeProp,\n ForwardProps,\n useAfterInitialEffect,\n DateTimeDisplay,\n readableHue,\n useBreakpoint,\n useConfiguration,\n StyledIcon,\n tryCatch,\n useDirection\n} from '@pega/cosmos-react-core';\n\nimport Email from './Email';\nimport { EmailConversationProps } from './Email.types';\n\nregisterIcon(caretDownIcon);\n\nconst EmailParticipantTextCss = css`\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n max-width: 100%;\n`;\n\nexport const StyledEmailParticipantsText = styled(Text)`\n ${EmailParticipantTextCss}\n`;\n\nStyledEmailParticipantsText.defaultProps = defaultThemeProp;\n\nexport const StyledCompactTimeStampDisplay = styled(Text)`\n ${EmailParticipantTextCss}\n margin-top: calc(${props => props.theme.base.spacing} / 2);\n`;\nStyledCompactTimeStampDisplay.defaultProps = defaultThemeProp;\n\nexport const StyledConversationHeader = styled.header<{ collapsed: boolean }>(\n ({ theme, collapsed }) => {\n return css`\n border-bottom: ${collapsed ? 0 : '0.0625rem'} solid ${theme.base.palette['border-line']};\n position: sticky;\n top: 0;\n z-index: 1;\n `;\n }\n);\nStyledConversationHeader.defaultProps = defaultThemeProp;\n\nexport const StyledUnReadCount = styled.div(({ theme: { base } }) => {\n const readableBackground = readableHue(\n base.palette['brand-primary'],\n base.palette['primary-background']\n );\n const readableTextColor = readableColor(readableBackground);\n\n return css`\n align-self: flex-start;\n background-color: ${readableBackground};\n color: ${readableTextColor};\n padding: 0 ${base.spacing};\n font-weight: ${base['font-weight']['semi-bold']};\n\n /* stylelint-disable declaration-block-no-duplicate-properties */\n width: fit-content;\n width: -moz-fit-content;\n\n /* stylelint-enable declaration-block-no-duplicate-properties */\n `;\n});\n\nStyledUnReadCount.defaultProps = defaultThemeProp;\n\nexport const StyledEmailConversation = styled.li(({ theme: { base } }) => {\n return css`\n margin-bottom: ${base.spacing};\n border-radius: ${base['border-radius']};\n overflow: hidden;\n background-color: ${base.palette['primary-background']};\n list-style-type: none;\n `;\n});\nStyledEmailConversation.defaultProps = defaultThemeProp;\n\nexport const StyledEmailInConversation = styled(Email)(({ unRead, theme: { base } }) => {\n const readableBackground = readableHue(\n base.palette['brand-primary'],\n base.palette['primary-background']\n );\n return css`\n padding: calc(2 * ${base.spacing}) 0;\n border-bottom: 0.0625rem solid ${base.palette['border-line']};\n position: relative;\n ${unRead &&\n css`\n &::before {\n content: '';\n background-color: ${readableBackground};\n position: absolute;\n inset: 0;\n height: calc(100% + 0.0625rem);\n top: -0.0625rem;\n width: 0.125rem;\n }\n `}\n `;\n});\nStyledEmailInConversation.defaultProps = defaultThemeProp;\n\nconst StyledForwardIcon = styled.svg(({ theme }) => {\n const readableStrokeColor = readableHue(\n theme.base.colors.purple.medium,\n theme.base.palette['primary-background']\n );\n return css`\n color: ${readableStrokeColor};\n `;\n});\nStyledForwardIcon.defaultProps = defaultThemeProp;\n\nconst StyledUnreadIndicator = styled.span<{ isVisible: boolean }>(({ theme, isVisible }) => {\n const readableBackground = readableHue(\n theme.base.palette['brand-primary'],\n theme.base.palette['primary-background']\n );\n\n const diameter = '0.375rem';\n\n return css`\n width: ${isVisible ? diameter : 0};\n margin: 0 ${isVisible ? 0 : '0.188rem'};\n height: ${diameter};\n display: inline-block;\n border-radius: 50%;\n background: ${readableBackground};\n position: relative;\n top: 0.375rem;\n align-self: flex-start;\n `;\n});\nStyledUnreadIndicator.defaultProps = defaultThemeProp;\n\nconst StyledConversationButton = styled.button(({ theme }) => {\n const hoverColor = tryCatch(() =>\n mix(0.85, theme.base.palette['primary-background'], theme.base.palette['brand-primary'])\n );\n return css`\n border-width: 0;\n width: 100%;\n padding: ${theme.base.spacing};\n background: ${theme.base.palette['primary-background']};\n position: sticky;\n top: 0;\n z-index: 1;\n\n &[aria-expanded='true'] {\n border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};\n }\n\n &:focus {\n background: ${theme.base.palette['secondary-background']};\n outline: none;\n }\n\n &:hover {\n background: ${hoverColor};\n outline: none;\n }\n\n & > ${StyledIcon} {\n align-self: flex-start;\n color: ${theme.base.palette['foreground-color']};\n }\n `;\n});\n\nStyledConversationButton.defaultProps = defaultThemeProp;\n\nconst EmailConversation: FunctionComponent<EmailConversationProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<EmailConversationProps>, ref: EmailConversationProps['ref']) => {\n const {\n id,\n emails,\n from,\n to,\n unReadEmailCount,\n timeStamp,\n isForwarded = false,\n isCollapsed = false,\n onCollapse,\n onExpand,\n ...restProps\n } = props;\n const t = useI18n();\n const [collapsedState, setCollapsedState] = useState(isCollapsed);\n useAfterInitialEffect(() => {\n setCollapsedState(isCollapsed);\n }, [isCollapsed]);\n const onExpandCollapse = () => {\n setCollapsedState(!collapsedState);\n };\n\n const headerRef = useRef<HTMLDivElement>(null);\n const isSmallOrAbove = useBreakpoint('sm', { breakpointRef: headerRef });\n const { locale } = useConfiguration();\n const { rtl } = useDirection();\n\n const caretDirection = rtl ? 'caret-left' : 'caret-right';\n const generateRecipientList = useMemo(() => {\n const recipientElements = to.slice(0, 2).map((recipient, i) => {\n return `${recipient.shortName}${i < to.length - 1 ? ';' : ''} `;\n });\n if (to.length > 2) {\n return [...recipientElements, `+${to.length - 2} more`];\n }\n return recipientElements;\n }, [to]);\n\n return (\n <StyledEmailConversation {...restProps} id={id} ref={ref}>\n <Flex\n as={StyledConversationButton}\n id={`conversation-heading${id}`}\n aria-controls={id}\n aria-expanded={!collapsedState}\n container={{ gap: 1, alignItems: 'center', pad: 1 }}\n onClick={onExpandCollapse}\n ref={headerRef}\n >\n <Icon name={collapsedState ? caretDirection : 'caret-down'} />\n <StyledUnreadIndicator isVisible={!!unReadEmailCount} />\n <Flex\n container={{\n wrap: 'nowrap',\n alignItems: 'start',\n direction: 'column'\n }}\n item={{\n grow: 1,\n shrink: 1\n }}\n >\n <Text variant='primary' as={StyledEmailParticipantsText}>\n {`${isForwarded ? 'FW' : t('from')}: ${from.fullName}`}\n </Text>\n <Text variant='secondary' as={StyledEmailParticipantsText}>\n {`${t('to')}: `}\n {generateRecipientList}\n </Text>\n {!isSmallOrAbove && (\n <Text variant='secondary' as={StyledCompactTimeStampDisplay}>\n {`${new Intl.DateTimeFormat(locale, { weekday: 'short' }).format(\n new Date(timeStamp)\n )}, `}\n <DateTimeDisplay variant='datetime' format='short' value={timeStamp} />\n </Text>\n )}\n </Flex>\n <Flex\n container={{\n gap: 1,\n alignItems: 'center'\n }}\n item={{\n shrink: 0\n }}\n >\n {isSmallOrAbove && (\n <Text variant='secondary' as={StyledEmailParticipantsText}>\n {`${new Intl.DateTimeFormat(locale, { weekday: 'short' }).format(\n new Date(timeStamp)\n )}, `}\n <DateTimeDisplay variant='datetime' format='short' value={timeStamp} />\n </Text>\n )}\n </Flex>\n </Flex>\n\n <ExpandCollapse\n as={Flex}\n container={{ direction: 'column' }}\n collapsed={collapsedState}\n onBeforeCollapse={onCollapse}\n onBeforeExpand={onExpand}\n role='region'\n aria-labelledby={`conversation-heading${id}`}\n id={`conversation-content${id}`}\n >\n {!!unReadEmailCount && (\n <Text as={StyledUnReadCount} id={`unread-emailCount-${id}`} variant='secondary'>\n {t('new_emails_count', [unReadEmailCount], { count: unReadEmailCount })}\n </Text>\n )}\n {emails &&\n emails.map(email => {\n return <StyledEmailInConversation key={email.id} {...email} />;\n })}\n </ExpandCollapse>\n </StyledEmailConversation>\n );\n }\n);\n\nexport default EmailConversation;\n"]}
@@ -13,11 +13,11 @@ const EmailEntity = forwardRef(({ entity, ...restProps }, ref) => {
13
13
  : entity.description, onContextMenu: () => {
14
14
  if (tooltipRef.current)
15
15
  tooltipRef.current.hidden = true;
16
- }, contentEditable: false, children: [entity.value, entity.icon && _jsx(Icon, { name: entity.icon }, void 0), entity.description && (_jsx(Tooltip, { target: el, ref: tooltipRef, children: Array.isArray(entity.description)
16
+ }, contentEditable: false, children: [entity.value, entity.icon && _jsx(Icon, { name: entity.icon }), entity.description && (_jsx(Tooltip, { target: el, ref: tooltipRef, children: Array.isArray(entity.description)
17
17
  ? formatListToLocaleString(entity.description, t, locale, {
18
18
  separator: '\n'
19
19
  })
20
- : entity.description }, void 0))] }, void 0));
20
+ : entity.description }))] }));
21
21
  });
22
22
  export default EmailEntity;
23
23
  //# sourceMappingURL=EmailEntity.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"EmailEntity.js","sourceRoot":"","sources":["../../../src/components/Email/EmailEntity.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAsC,MAAM,EAAE,MAAM,OAAO,CAAC;AAE/E,OAAO,EAEL,OAAO,EACP,kBAAkB,EAClB,UA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B,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,EAAE,MAAM,EAAE;wBACtD,SAAS,EAAE,IAAI;qBAChB,CAAC;oBACJ,CAAC,CAAC,MAAM,CAAC,WAAW,WACd,CACX,YACiB,CACrB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, PropsWithoutRef, useRef } from 'react';\n\nimport {\n ForwardProps,\n Tooltip,\n useConsolidatedRef,\n useElement,\n useI18n,\n useConfiguration,\n formatListToLocaleString,\n Icon\n} from '@pega/cosmos-react-core';\n\nimport { StyledEmailEntity } from './Email.styles';\nimport { EmailEntityProps } from './Email.types';\n\nconst EmailEntity: FunctionComponent<EmailEntityProps & ForwardProps> = forwardRef(\n ({ entity, ...restProps }: PropsWithoutRef<EmailEntityProps>, ref: EmailEntityProps['ref']) => {\n const [el, setEl] = useElement<HTMLElement>();\n const elementRef = useConsolidatedRef<HTMLElement>(setEl, ref);\n const t = useI18n();\n const { locale } = useConfiguration();\n const tooltipRef = useRef<HTMLDivElement>(null);\n return (\n <StyledEmailEntity\n {...restProps}\n entity={entity}\n ref={elementRef}\n aria-label={\n Array.isArray(entity.description)\n ? formatListToLocaleString(entity.description, t, locale)\n : entity.description\n }\n onContextMenu={() => {\n if (tooltipRef.current) tooltipRef.current.hidden = true;\n }}\n contentEditable={false}\n >\n {entity.value}\n {entity.icon && <Icon name={entity.icon} />}\n {entity.description && (\n <Tooltip target={el} ref={tooltipRef}>\n {Array.isArray(entity.description)\n ? formatListToLocaleString(entity.description, t, locale, {\n separator: '\\n'\n })\n : entity.description}\n </Tooltip>\n )}\n </StyledEmailEntity>\n );\n }\n);\n\nexport default EmailEntity;\n"]}
1
+ {"version":3,"file":"EmailEntity.js","sourceRoot":"","sources":["../../../src/components/Email/EmailEntity.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAsC,MAAM,EAAE,MAAM,OAAO,CAAC;AAE/E,OAAO,EA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CAAC;oBAChC,CAAC,CAAC,wBAAwB,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,EAAE,MAAM,EAAE;wBACtD,SAAS,EAAE,IAAI;qBAChB,CAAC;oBACJ,CAAC,CAAC,MAAM,CAAC,WAAW,GACd,CACX,IACiB,CACrB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, PropsWithoutRef, useRef } from 'react';\n\nimport {\n ForwardProps,\n Tooltip,\n useConsolidatedRef,\n useElement,\n useI18n,\n useConfiguration,\n formatListToLocaleString,\n Icon\n} from '@pega/cosmos-react-core';\n\nimport { StyledEmailEntity } from './Email.styles';\nimport { EmailEntityProps } from './Email.types';\n\nconst EmailEntity: FunctionComponent<EmailEntityProps & ForwardProps> = forwardRef(\n ({ entity, ...restProps }: PropsWithoutRef<EmailEntityProps>, ref: EmailEntityProps['ref']) => {\n const [el, setEl] = useElement<HTMLElement>();\n const elementRef = useConsolidatedRef<HTMLElement>(setEl, ref);\n const t = useI18n();\n const { locale } = useConfiguration();\n const tooltipRef = useRef<HTMLDivElement>(null);\n return (\n <StyledEmailEntity\n {...restProps}\n entity={entity}\n ref={elementRef}\n aria-label={\n Array.isArray(entity.description)\n ? formatListToLocaleString(entity.description, t, locale)\n : entity.description\n }\n onContextMenu={() => {\n if (tooltipRef.current) tooltipRef.current.hidden = true;\n }}\n contentEditable={false}\n >\n {entity.value}\n {entity.icon && <Icon name={entity.icon} />}\n {entity.description && (\n <Tooltip target={el} ref={tooltipRef}>\n {Array.isArray(entity.description)\n ? formatListToLocaleString(entity.description, t, locale, {\n separator: '\\n'\n })\n : entity.description}\n </Tooltip>\n )}\n </StyledEmailEntity>\n );\n }\n);\n\nexport default EmailEntity;\n"]}
@@ -5,9 +5,9 @@ export interface EmailSelectorProps extends NoChildrenProp {
5
5
  /** participants */
6
6
  participants: EmailComposerProps['participants'];
7
7
  /** default selections */
8
- defaultSelections?: EmailUser['emailAddress'][];
8
+ selectedItems: EmailUser['emailAddress'][];
9
9
  /** selectedItems */
10
- selections: (selections: EmailUser['emailAddress'][], label: ReactNode) => void;
10
+ onSelectedItemChange: (selectedItems: EmailUser['emailAddress'][], label: ReactNode) => void;
11
11
  /**
12
12
  * Callback to handle external entry validation
13
13
  * If returned true considers the entry to be a valid entry
@@ -1 +1 @@
1
- {"version":3,"file":"EmailSelector.d.ts","sourceRoot":"","sources":["../../../src/components/Email/EmailSelector.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAA6C,SAAS,EAAE,MAAM,OAAO,CAAC;AAEhG,OAAO,EAEL,aAAa,EAGb,cAAc,EAEf,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE9D,MAAM,WAAW,kBAAmB,SAAQ,cAAc;IACxD,mBAAmB;IACnB,YAAY,EAAE,kBAAkB,CAAC,cAAc,CAAC,CAAC;IACjD,yBAAyB;IACzB,iBAAiB,CAAC,EAAE,SAAS,CAAC,cAAc,CAAC,EAAE,CAAC;IAChD,oBAAoB;IACpB,UAAU,EAAE,CAAC,UAAU,EAAE,SAAS,CAAC,cAAc,CAAC,EAAE,EAAE,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;IAChF;;;OAGG;IACH,iBAAiB,CAAC,EAAE,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;CAC7D;AAED,QAAA,MAAM,aAAa,EAAE,iBAAiB,CACpC,kBAAkB,GAAG,IAAI,CAAC,aAAa,EAAE,OAAO,GAAG,MAAM,GAAG,UAAU,CAAC,CA8GxE,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"EmailSelector.d.ts","sourceRoot":"","sources":["../../../src/components/Email/EmailSelector.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAA6C,SAAS,EAAE,MAAM,OAAO,CAAC;AAEhG,OAAO,EAEL,aAAa,EAGb,cA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