@azure/communication-react 1.17.0-alpha-202405150013 → 1.17.0-alpha-202405170014

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 (143) hide show
  1. package/dist/communication-react.d.ts +33 -5
  2. package/dist/dist-cjs/communication-react/{ChatMessageComponentAsRichTextEditBox-BkDaUOJU.js → ChatMessageComponentAsRichTextEditBox-BLFNaheX.js} +9 -3
  3. package/dist/dist-cjs/communication-react/ChatMessageComponentAsRichTextEditBox-BLFNaheX.js.map +1 -0
  4. package/dist/dist-cjs/communication-react/RichTextSendBoxWrapper-BhTpuspw.js +54 -0
  5. package/dist/dist-cjs/communication-react/RichTextSendBoxWrapper-BhTpuspw.js.map +1 -0
  6. package/dist/dist-cjs/communication-react/{index-DJswSfNy.js → index-C9I6Mcil.js} +291 -139
  7. package/dist/dist-cjs/communication-react/index-C9I6Mcil.js.map +1 -0
  8. package/dist/dist-cjs/communication-react/index.js +2 -2
  9. package/dist/dist-esm/acs-ui-common/src/common.d.ts +8 -1
  10. package/dist/dist-esm/acs-ui-common/src/common.js.map +1 -1
  11. package/dist/dist-esm/acs-ui-common/src/index.d.ts +1 -1
  12. package/dist/dist-esm/acs-ui-common/src/index.js.map +1 -1
  13. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
  14. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
  15. package/dist/dist-esm/calling-component-bindings/src/utils/videoGalleryUtils.js +1 -6
  16. package/dist/dist-esm/calling-component-bindings/src/utils/videoGalleryUtils.js.map +1 -1
  17. package/dist/dist-esm/calling-component-bindings/src/videoGallerySelector.js +1 -1
  18. package/dist/dist-esm/calling-component-bindings/src/videoGallerySelector.js.map +1 -1
  19. package/dist/dist-esm/calling-stateful-client/src/CallClientState.d.ts +1 -1
  20. package/dist/dist-esm/calling-stateful-client/src/CallClientState.js.map +1 -1
  21. package/dist/dist-esm/calling-stateful-client/src/CallContext.js +0 -4
  22. package/dist/dist-esm/calling-stateful-client/src/CallContext.js.map +1 -1
  23. package/dist/dist-esm/calling-stateful-client/src/CallSubscriber.js +0 -3
  24. package/dist/dist-esm/calling-stateful-client/src/CallSubscriber.js.map +1 -1
  25. package/dist/dist-esm/calling-stateful-client/src/Converter.js +0 -1
  26. package/dist/dist-esm/calling-stateful-client/src/Converter.js.map +1 -1
  27. package/dist/dist-esm/calling-stateful-client/src/PPTLiveSubscriber.js +0 -2
  28. package/dist/dist-esm/calling-stateful-client/src/PPTLiveSubscriber.js.map +1 -1
  29. package/dist/dist-esm/calling-stateful-client/src/index-public.js.map +1 -1
  30. package/dist/dist-esm/communication-react/src/index.d.ts +1 -1
  31. package/dist/dist-esm/communication-react/src/index.js.map +1 -1
  32. package/dist/dist-esm/react-components/src/components/Attachment/AttachmentCard.d.ts +4 -0
  33. package/dist/dist-esm/react-components/src/components/Attachment/AttachmentCard.js +27 -22
  34. package/dist/dist-esm/react-components/src/components/Attachment/AttachmentCard.js.map +1 -1
  35. package/dist/dist-esm/react-components/src/components/Attachment/AttachmentCardGroup.d.ts +15 -0
  36. package/dist/dist-esm/react-components/src/components/Attachment/AttachmentCardGroup.js +14 -16
  37. package/dist/dist-esm/react-components/src/components/Attachment/AttachmentCardGroup.js.map +1 -1
  38. package/dist/dist-esm/react-components/src/components/Attachment/AttachmentDownloadCards.js +16 -15
  39. package/dist/dist-esm/react-components/src/components/Attachment/AttachmentDownloadCards.js.map +1 -1
  40. package/dist/dist-esm/react-components/src/components/Attachment/AttachmentUploadCards.js +2 -2
  41. package/dist/dist-esm/react-components/src/components/Attachment/AttachmentUploadCards.js.map +1 -1
  42. package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/ChatMessageComponentAsMessageBubble.js +9 -1
  43. package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/ChatMessageComponentAsMessageBubble.js.map +1 -1
  44. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBox.js +8 -2
  45. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBox.js.map +1 -1
  46. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBoxPicker.js +2 -2
  47. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBoxPicker.js.map +1 -1
  48. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsRichTextEditBox.js +8 -2
  49. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsRichTextEditBox.js.map +1 -1
  50. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponentAsMessageBubble.js +9 -1
  51. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponentAsMessageBubble.js.map +1 -1
  52. package/dist/dist-esm/react-components/src/components/ErrorBoundary.d.ts +2 -2
  53. package/dist/dist-esm/react-components/src/components/ErrorBoundary.js +2 -2
  54. package/dist/dist-esm/react-components/src/components/ErrorBoundary.js.map +1 -1
  55. package/dist/dist-esm/react-components/src/components/MessageThread.d.ts +5 -3
  56. package/dist/dist-esm/react-components/src/components/MessageThread.js.map +1 -1
  57. package/dist/dist-esm/react-components/src/components/RemoteVideoTile.js +1 -1
  58. package/dist/dist-esm/react-components/src/components/RemoteVideoTile.js.map +1 -1
  59. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.d.ts +4 -0
  60. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.js +5 -2
  61. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.js.map +1 -1
  62. package/dist/dist-esm/react-components/src/components/SendBox.js +5 -2
  63. package/dist/dist-esm/react-components/src/components/SendBox.js.map +1 -1
  64. package/dist/dist-esm/react-components/src/components/VideoEffects/VideoEffectsItem.js +6 -4
  65. package/dist/dist-esm/react-components/src/components/VideoEffects/VideoEffectsItem.js.map +1 -1
  66. package/dist/dist-esm/react-components/src/components/VideoGallery/RemoteScreenShare.js +3 -6
  67. package/dist/dist-esm/react-components/src/components/VideoGallery/RemoteScreenShare.js.map +1 -1
  68. package/dist/dist-esm/react-components/src/components/VideoGallery.js +1 -3
  69. package/dist/dist-esm/react-components/src/components/VideoGallery.js.map +1 -1
  70. package/dist/dist-esm/react-components/src/components/VideoTile.js +0 -1
  71. package/dist/dist-esm/react-components/src/components/VideoTile.js.map +1 -1
  72. package/dist/dist-esm/react-components/src/components/index.d.ts +1 -0
  73. package/dist/dist-esm/react-components/src/components/index.js +1 -0
  74. package/dist/dist-esm/react-components/src/components/index.js.map +1 -1
  75. package/dist/dist-esm/react-components/src/components/styles/AttachmentCard.styles.d.ts +9 -1
  76. package/dist/dist-esm/react-components/src/components/styles/AttachmentCard.styles.js +27 -3
  77. package/dist/dist-esm/react-components/src/components/styles/AttachmentCard.styles.js.map +1 -1
  78. package/dist/dist-esm/react-components/src/components/styles/AttachmentCardGroup.styles.d.ts +17 -0
  79. package/dist/dist-esm/react-components/src/components/styles/AttachmentCardGroup.styles.js +47 -0
  80. package/dist/dist-esm/react-components/src/components/styles/AttachmentCardGroup.styles.js.map +1 -0
  81. package/dist/dist-esm/react-components/src/components/styles/MessageThread.styles.d.ts +2 -2
  82. package/dist/dist-esm/react-components/src/components/styles/MessageThread.styles.js +8 -0
  83. package/dist/dist-esm/react-components/src/components/styles/MessageThread.styles.js.map +1 -1
  84. package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentAsEditBoxUtils.d.ts +4 -0
  85. package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentAsEditBoxUtils.js +9 -0
  86. package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentAsEditBoxUtils.js.map +1 -1
  87. package/dist/dist-esm/react-components/src/localization/locales/ar-SA/strings.json +22 -1
  88. package/dist/dist-esm/react-components/src/localization/locales/cs-CZ/strings.json +22 -1
  89. package/dist/dist-esm/react-components/src/localization/locales/de-DE/strings.json +22 -1
  90. package/dist/dist-esm/react-components/src/localization/locales/en-GB/strings.json +22 -1
  91. package/dist/dist-esm/react-components/src/localization/locales/en-US/strings.json +3 -1
  92. package/dist/dist-esm/react-components/src/localization/locales/es-ES/strings.json +22 -1
  93. package/dist/dist-esm/react-components/src/localization/locales/fi-FI/strings.json +23 -2
  94. package/dist/dist-esm/react-components/src/localization/locales/fr-FR/strings.json +31 -10
  95. package/dist/dist-esm/react-components/src/localization/locales/he-IL/strings.json +22 -1
  96. package/dist/dist-esm/react-components/src/localization/locales/it-IT/strings.json +22 -1
  97. package/dist/dist-esm/react-components/src/localization/locales/ja-JP/strings.json +31 -10
  98. package/dist/dist-esm/react-components/src/localization/locales/ko-KR/strings.json +31 -10
  99. package/dist/dist-esm/react-components/src/localization/locales/nb-NO/strings.json +22 -1
  100. package/dist/dist-esm/react-components/src/localization/locales/nl-NL/strings.json +22 -1
  101. package/dist/dist-esm/react-components/src/localization/locales/pl-PL/strings.json +22 -1
  102. package/dist/dist-esm/react-components/src/localization/locales/pt-BR/strings.json +31 -10
  103. package/dist/dist-esm/react-components/src/localization/locales/ru-RU/strings.json +22 -1
  104. package/dist/dist-esm/react-components/src/localization/locales/sv-SE/strings.json +22 -1
  105. package/dist/dist-esm/react-components/src/localization/locales/tr-TR/strings.json +22 -1
  106. package/dist/dist-esm/react-components/src/localization/locales/zh-CN/strings.json +30 -9
  107. package/dist/dist-esm/react-components/src/localization/locales/zh-TW/strings.json +24 -3
  108. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.d.ts +7 -0
  109. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.js +6 -2
  110. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.js.map +1 -1
  111. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatComposite.d.ts +7 -0
  112. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatComposite.js.map +1 -1
  113. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js +28 -8
  114. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js.map +1 -1
  115. package/dist/dist-esm/react-composites/src/composites/common/RichTextSendBoxWrapper.d.ts +10 -0
  116. package/dist/dist-esm/react-composites/src/composites/common/RichTextSendBoxWrapper.js +20 -0
  117. package/dist/dist-esm/react-composites/src/composites/common/RichTextSendBoxWrapper.js.map +1 -0
  118. package/dist/dist-esm/react-composites/src/composites/common/SendBoxPicker.d.ts +30 -0
  119. package/dist/dist-esm/react-composites/src/composites/common/SendBoxPicker.js +44 -0
  120. package/dist/dist-esm/react-composites/src/composites/common/SendBoxPicker.js.map +1 -0
  121. package/dist/dist-esm/react-composites/src/composites/localization/locales/ar-SA/strings.json +4 -0
  122. package/dist/dist-esm/react-composites/src/composites/localization/locales/cs-CZ/strings.json +4 -0
  123. package/dist/dist-esm/react-composites/src/composites/localization/locales/de-DE/strings.json +4 -0
  124. package/dist/dist-esm/react-composites/src/composites/localization/locales/en-GB/strings.json +4 -0
  125. package/dist/dist-esm/react-composites/src/composites/localization/locales/es-ES/strings.json +4 -0
  126. package/dist/dist-esm/react-composites/src/composites/localization/locales/fi-FI/strings.json +4 -0
  127. package/dist/dist-esm/react-composites/src/composites/localization/locales/fr-FR/strings.json +4 -0
  128. package/dist/dist-esm/react-composites/src/composites/localization/locales/he-IL/strings.json +4 -0
  129. package/dist/dist-esm/react-composites/src/composites/localization/locales/it-IT/strings.json +4 -0
  130. package/dist/dist-esm/react-composites/src/composites/localization/locales/ja-JP/strings.json +4 -0
  131. package/dist/dist-esm/react-composites/src/composites/localization/locales/ko-KR/strings.json +4 -0
  132. package/dist/dist-esm/react-composites/src/composites/localization/locales/nb-NO/strings.json +4 -0
  133. package/dist/dist-esm/react-composites/src/composites/localization/locales/nl-NL/strings.json +4 -0
  134. package/dist/dist-esm/react-composites/src/composites/localization/locales/pl-PL/strings.json +4 -0
  135. package/dist/dist-esm/react-composites/src/composites/localization/locales/pt-BR/strings.json +4 -0
  136. package/dist/dist-esm/react-composites/src/composites/localization/locales/ru-RU/strings.json +4 -0
  137. package/dist/dist-esm/react-composites/src/composites/localization/locales/sv-SE/strings.json +4 -0
  138. package/dist/dist-esm/react-composites/src/composites/localization/locales/tr-TR/strings.json +4 -0
  139. package/dist/dist-esm/react-composites/src/composites/localization/locales/zh-CN/strings.json +4 -0
  140. package/dist/dist-esm/react-composites/src/composites/localization/locales/zh-TW/strings.json +4 -0
  141. package/package.json +2 -2
  142. package/dist/dist-cjs/communication-react/ChatMessageComponentAsRichTextEditBox-BkDaUOJU.js.map +0 -1
  143. package/dist/dist-cjs/communication-react/index-DJswSfNy.js.map +0 -1
@@ -3,7 +3,7 @@
3
3
  import { Icon, mergeStyles } from '@fluentui/react';
4
4
  import React, { useMemo } from 'react';
5
5
  import { _AttachmentCard } from './AttachmentCard';
6
- import { _AttachmentCardGroup } from './AttachmentCardGroup';
6
+ import { _AttachmentCardGroup, _AttachmentCardGroupLayout } from './AttachmentCardGroup';
7
7
  import { useLocaleAttachmentCardStringsTrampoline } from '../utils/common';
8
8
  const actionIconStyle = { height: '1rem' };
9
9
  /**
@@ -20,7 +20,7 @@ export const _AttachmentUploadCards = (props) => {
20
20
  if (!attachments || attachments.length === 0) {
21
21
  return React.createElement(React.Fragment, null);
22
22
  }
23
- return (React.createElement(_AttachmentCardGroup, null, attachments &&
23
+ return (React.createElement(_AttachmentCardGroup, { attachmentGroupLayout: _AttachmentCardGroupLayout.Flex }, attachments &&
24
24
  attachments
25
25
  .filter((attachment) => !attachment.error)
26
26
  .map((attachment) => {
@@ -1 +1 @@
1
- {"version":3,"file":"AttachmentUploadCards.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/Attachment/AttachmentUploadCards.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACp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4B,EAAE,iBAAc,+BAA+B;4BAC1F,oBAAC,IAAI,IAAC,QAAQ,EAAC,wBAAwB,EAAC,SAAS,EAAE,WAAW,CAAC,eAAe,CAAC,GAAI,CAC/E,CACP;wBACD,OAAO,EAAE,CAAC,UAAU,EAAE,EAAE;4BACtB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;gCACrC,IAAI,CAAC;oCACH,KAAK,CAAC,wBAAwB,IAAI,KAAK,CAAC,wBAAwB,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;oCAChF,OAAO,EAAE,CAAC;gCACZ,CAAC;gCAAC,OAAO,CAAC,EAAE,CAAC;oCACX,MAAM,CAAE,CAAW,CAAC,OAAO,CAAC,CAAC;gCAC/B,CAAC;4BACH,CAAC,CAAC,CAAC;wBACL,CAAC;qBACF;iBACF,EACD,OAAO,EAAE,KAAK,CAAC,OAAO,GACtB,CACH,CAAA;SAAA,CAAC,CACe,CACxB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { Icon, mergeStyles } from '@fluentui/react';\nimport React, { useMemo } from 'react';\nimport { _AttachmentCard } from './AttachmentCard';\nimport { _AttachmentCardGroup } from './AttachmentCardGroup';\nimport { AttachmentMetadataInProgress } from '@internal/acs-ui-common';\nimport { useLocaleAttachmentCardStringsTrampoline } from '../utils/common';\n\n/**\n * Strings of _AttachmentUploadCards that can be overridden.\n *\n * @internal\n */\nexport interface _AttachmentUploadCardsStrings {\n /** Aria label to notify user when focus is on cancel attachment upload button. */\n removeAttachment: string;\n /** Aria label to notify user attachment uploading starts. */\n uploading: string;\n /** Aria label to notify user attachment is uploaded. */\n uploadCompleted: string;\n /** Aria label to notify user more attachment action menu. */\n attachmentMoreMenu: string;\n}\n\n/**\n * @internal\n */\nexport interface AttachmentUploadCardsProps {\n /**\n * Optional array of {@link AttachmentMetadataInProgress}\n */\n attachments?: AttachmentMetadataInProgress[];\n /**\n * Optional callback to remove the attachment upload before sending by clicking on\n * cancel icon.\n */\n onCancelAttachmentUpload?: (attachmentId: string) => void;\n /**\n * Optional arialabel strings for attachment upload cards\n */\n strings?: _AttachmentUploadCardsStrings;\n}\n\nconst actionIconStyle = { height: '1rem' };\n\n/**\n * @internal\n */\nexport const _AttachmentUploadCards = (props: AttachmentUploadCardsProps): JSX.Element => {\n const attachments = props.attachments;\n const localeStrings = useLocaleAttachmentCardStringsTrampoline();\n const removeAttachmentButtonString = useMemo(\n () => () => {\n return props.strings?.removeAttachment ?? localeStrings.removeAttachment;\n },\n [props.strings?.removeAttachment, localeStrings.removeAttachment]\n );\n\n if (!attachments || attachments.length === 0) {\n return <></>;\n }\n\n return (\n <_AttachmentCardGroup>\n {attachments &&\n attachments\n .filter((attachment) => !attachment.error)\n .map((attachment) => (\n <_AttachmentCard\n attachment={attachment}\n key={attachment.id}\n menuActions={[\n {\n name: props.strings?.removeAttachment ?? 'Remove',\n icon: (\n <div aria-label={removeAttachmentButtonString()} data-testid=\"attachment-upload-card-remove\">\n <Icon iconName=\"CancelAttachmentUpload\" className={mergeStyles(actionIconStyle)} />\n </div>\n ),\n onClick: (attachment) => {\n return new Promise((resolve, reject) => {\n try {\n props.onCancelAttachmentUpload && props.onCancelAttachmentUpload(attachment.id);\n resolve();\n } catch (e) {\n reject((e as Error).message);\n }\n });\n }\n }\n ]}\n strings={props.strings}\n />\n ))}\n </_AttachmentCardGroup>\n );\n};\n"]}
1
+ {"version":3,"file":"AttachmentUploadCards.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/Attachment/AttachmentUploadCards.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,O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,EAAC,wBAAwB,EAAC,SAAS,EAAE,WAAW,CAAC,eAAe,CAAC,GAAI,CAC/E,CACP;wBACD,OAAO,EAAE,CAAC,UAAU,EAAE,EAAE;4BACtB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;gCACrC,IAAI,CAAC;oCACH,KAAK,CAAC,wBAAwB,IAAI,KAAK,CAAC,wBAAwB,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;oCAChF,OAAO,EAAE,CAAC;gCACZ,CAAC;gCAAC,OAAO,CAAC,EAAE,CAAC;oCACX,MAAM,CAAE,CAAW,CAAC,OAAO,CAAC,CAAC;gCAC/B,CAAC;4BACH,CAAC,CAAC,CAAC;wBACL,CAAC;qBACF;iBACF,EACD,OAAO,EAAE,KAAK,CAAC,OAAO,GACtB,CACH,CAAA;SAAA,CAAC,CACe,CACxB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { Icon, mergeStyles } from '@fluentui/react';\nimport React, { useMemo } from 'react';\nimport { _AttachmentCard } from './AttachmentCard';\nimport { _AttachmentCardGroup, _AttachmentCardGroupLayout } from './AttachmentCardGroup';\nimport { AttachmentMetadataInProgress } from '@internal/acs-ui-common';\nimport { useLocaleAttachmentCardStringsTrampoline } from '../utils/common';\n\n/**\n * Strings of _AttachmentUploadCards that can be overridden.\n *\n * @internal\n */\nexport interface _AttachmentUploadCardsStrings {\n /** Aria label to notify user when focus is on cancel attachment upload button. */\n removeAttachment: string;\n /** Aria label to notify user attachment uploading starts. */\n uploading: string;\n /** Aria label to notify user attachment is uploaded. */\n uploadCompleted: string;\n /** Aria label to notify user more attachment action menu. */\n attachmentMoreMenu: string;\n}\n\n/**\n * @internal\n */\nexport interface AttachmentUploadCardsProps {\n /**\n * Optional array of {@link AttachmentMetadataInProgress}\n */\n attachments?: AttachmentMetadataInProgress[];\n /**\n * Optional callback to remove the attachment upload before sending by clicking on\n * cancel icon.\n */\n onCancelAttachmentUpload?: (attachmentId: string) => void;\n /**\n * Optional arialabel strings for attachment upload cards\n */\n strings?: _AttachmentUploadCardsStrings;\n}\n\nconst actionIconStyle = { height: '1rem' };\n\n/**\n * @internal\n */\nexport const _AttachmentUploadCards = (props: AttachmentUploadCardsProps): JSX.Element => {\n const attachments = props.attachments;\n const localeStrings = useLocaleAttachmentCardStringsTrampoline();\n const removeAttachmentButtonString = useMemo(\n () => () => {\n return props.strings?.removeAttachment ?? localeStrings.removeAttachment;\n },\n [props.strings?.removeAttachment, localeStrings.removeAttachment]\n );\n\n if (!attachments || attachments.length === 0) {\n return <></>;\n }\n\n return (\n <_AttachmentCardGroup attachmentGroupLayout={_AttachmentCardGroupLayout.Flex}>\n {attachments &&\n attachments\n .filter((attachment) => !attachment.error)\n .map((attachment) => (\n <_AttachmentCard\n attachment={attachment}\n key={attachment.id}\n menuActions={[\n {\n name: props.strings?.removeAttachment ?? 'Remove',\n icon: (\n <div aria-label={removeAttachmentButtonString()} data-testid=\"attachment-upload-card-remove\">\n <Icon iconName=\"CancelAttachmentUpload\" className={mergeStyles(actionIconStyle)} />\n </div>\n ),\n onClick: (attachment) => {\n return new Promise((resolve, reject) => {\n try {\n props.onCancelAttachmentUpload && props.onCancelAttachmentUpload(attachment.id);\n resolve();\n } catch (e) {\n reject((e as Error).message);\n }\n });\n }\n }\n ]}\n strings={props.strings}\n />\n ))}\n </_AttachmentCardGroup>\n );\n};\n"]}
@@ -11,6 +11,8 @@ import { createStyleFromV8Style } from '../../styles/v8StyleShim';
11
11
  import { mergeClasses } from '@fluentui/react-components';
12
12
  import { useChatMessageStyles, useChatMessageCommonStyles } from '../../styles/MessageThread.styles';
13
13
  import { generateCustomizedTimestamp, generateDefaultTimestamp, getMessageBubbleContent, getMessageEditedDetails } from '../../utils/ChatMessageComponentUtils';
14
+ /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
15
+ import { doesMessageContainMultipleAttachments } from '../../utils/ChatMessageComponentAsEditBoxUtils';
14
16
  /** @private */
15
17
  const MessageBubble = (props) => {
16
18
  const ids = useIdentifiers();
@@ -54,6 +56,10 @@ const MessageBubble = (props) => {
54
56
  ]);
55
57
  const isBlockedMessage = false || /* @conditional-compile-remove(data-loss-prevention) */ message.messageType === 'blocked';
56
58
  const chatMessageCommonStyles = useChatMessageCommonStyles();
59
+ /* @conditional-compile-remove(attachment-upload) */
60
+ const hasMultipleAttachments = useMemo(() => {
61
+ return doesMessageContainMultipleAttachments(message);
62
+ }, [message]);
57
63
  const chatMessageStyles = useChatMessageStyles();
58
64
  const chatItemMessageContainerClassName = mergeClasses(chatMessageCommonStyles.body, chatMessageStyles.body,
59
65
  // disable placeholder functionality for GA releases as it might confuse users
@@ -61,7 +67,9 @@ const MessageBubble = (props) => {
61
67
  ? chatMessageCommonStyles.blocked
62
68
  : props.message.status === 'failed'
63
69
  ? chatMessageCommonStyles.failed
64
- : undefined, shouldOverlapAvatarAndMessage ? chatMessageStyles.avatarOverlap : chatMessageStyles.avatarNoOverlap, message.attached === 'top' || message.attached === false
70
+ : undefined, shouldOverlapAvatarAndMessage ? chatMessageStyles.avatarOverlap : chatMessageStyles.avatarNoOverlap,
71
+ /* @conditional-compile-remove(attachment-upload) */
72
+ hasMultipleAttachments ? chatMessageStyles.multipleAttachments : undefined, message.attached === 'top' || message.attached === false
65
73
  ? chatMessageStyles.bodyWithAvatar
66
74
  : chatMessageStyles.bodyWithoutAvatar,
67
75
  // messageContainerStyle used in className and style prop as style prop can't handle CSS selectors
@@ -1 +1 @@
1
- {"version":3,"file":"ChatMessageComponentAsMessageBubble.js","sourceRoot":"","sources":["../../../../../../../../react-components/src/components/ChatMessage/MessageComponents/ChatMessageComponentAsMessageBubble.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,WAAW,IAAI,iBAAiB,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AC,SAAS,EAAE,oBAAoB,gBAAc,GAAG,CAAC,gBAAgB,IACpE,kBAAkB,CACd,EAET,OAAO,EAAE,iBAAiB,EAAE,IAE3B,UAAU,EAAE,CACK,CAChB,CACL,CACJ,CAAC;IACF,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC;AAEF,eAAe;AACf,MAAM,CAAC,MAAM,mCAAmC,GAAG,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { Text, mergeStyles } from '@fluentui/react';\nimport { ChatMessage as FluentChatMessage } from '@fluentui-contrib/react-chat';\nimport { _formatString } from '@internal/acs-ui-common';\nimport React, { useCallback, useMemo } from 'react';\nimport { chatMessageDateStyle, chatMessageAuthorStyle } from '../../styles/ChatMessageComponent.styles';\nimport { useIdentifiers } from '../../../identifiers/IdentifierProvider';\nimport { useTheme } from '../../../theming';\nimport { InlineImageOptions } from '../ChatMessageContent';\nimport { ChatMessage } from '../../../types/ChatMessage';\n/* @conditional-compile-remove(data-loss-prevention) */\nimport { BlockedMessage } from '../../../types/ChatMessage';\nimport { MessageThreadStrings } from '../../MessageThread';\nimport { ComponentSlotStyle } from '../../../types';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { AttachmentMenuAction } from '../../../types';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { AttachmentMetadata } from '@internal/acs-ui-common';\nimport { _AttachmentDownloadCards } from '../../Attachment/AttachmentDownloadCards';\nimport { useLocale } from '../../../localization';\n/* @conditional-compile-remove(mention) */\nimport { MentionDisplayOptions } from '../../MentionPopover';\nimport { createStyleFromV8Style } from '../../styles/v8StyleShim';\nimport { mergeClasses } from '@fluentui/react-components';\nimport { useChatMessageStyles, useChatMessageCommonStyles } from '../../styles/MessageThread.styles';\nimport {\n generateCustomizedTimestamp,\n generateDefaultTimestamp,\n getMessageBubbleContent,\n getMessageEditedDetails\n} from '../../utils/ChatMessageComponentUtils';\n\ntype ChatMessageComponentAsMessageBubbleProps = {\n message: ChatMessage | /* @conditional-compile-remove(data-loss-prevention) */ BlockedMessage;\n messageContainerStyle?: ComponentSlotStyle;\n showDate?: boolean;\n strings: MessageThreadStrings;\n userId: string;\n /**\n * Whether to overlap avatar and message when the view is width constrained.\n */\n shouldOverlapAvatarAndMessage: boolean;\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n /**\n * Optional callback to render message attachments in the message component.\n */\n onRenderAttachmentDownloads?: (message: ChatMessage) => JSX.Element;\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n /**\n * Optional callback to define custom actions for attachments.\n */\n actionsForAttachment?: (attachment: AttachmentMetadata, message?: ChatMessage) => AttachmentMenuAction[];\n /**\n * Optional function to provide customized date format.\n * @beta\n */\n onDisplayDateTimeString?: (messageDate: Date) => string;\n /* @conditional-compile-remove(mention) */\n /**\n * Optional props needed to display suggestions in the mention scenario.\n * @internal\n */\n mentionDisplayOptions?: MentionDisplayOptions;\n /**\n * Optional callback called when an inline image is clicked.\n * @beta\n */\n inlineImageOptions?: InlineImageOptions;\n};\n\n/** @private */\nconst MessageBubble = (props: ChatMessageComponentAsMessageBubbleProps): JSX.Element => {\n const ids = useIdentifiers();\n const theme = useTheme();\n const locale = useLocale();\n\n const {\n userId,\n message,\n showDate,\n messageContainerStyle,\n strings,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n onRenderAttachmentDownloads,\n inlineImageOptions,\n shouldOverlapAvatarAndMessage,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n actionsForAttachment,\n /* @conditional-compile-remove(mention) */\n mentionDisplayOptions,\n onDisplayDateTimeString\n } = props;\n\n const formattedTimestamp = useMemo(() => {\n const defaultTimeStamp = message.createdOn\n ? generateDefaultTimestamp(message.createdOn, showDate, strings)\n : undefined;\n\n const customTimestamp = message.createdOn\n ? generateCustomizedTimestamp(message.createdOn, locale, onDisplayDateTimeString)\n : '';\n\n return customTimestamp || defaultTimeStamp;\n }, [locale, message.createdOn, onDisplayDateTimeString, showDate, strings]);\n\n const getMessageDetails = useCallback(() => {\n return getMessageEditedDetails(message, theme, strings.editedTag);\n }, [strings.editedTag, theme, message]);\n\n const getContent = useCallback(() => {\n return getMessageBubbleContent(\n message,\n strings,\n userId,\n inlineImageOptions,\n /* @conditional-compile-remove(mention) */\n mentionDisplayOptions,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n onRenderAttachmentDownloads,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n actionsForAttachment\n );\n }, [\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */ actionsForAttachment,\n inlineImageOptions,\n /* @conditional-compile-remove(mention) */ mentionDisplayOptions,\n message,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */ onRenderAttachmentDownloads,\n strings,\n userId\n ]);\n\n const isBlockedMessage =\n false || /* @conditional-compile-remove(data-loss-prevention) */ message.messageType === 'blocked';\n const chatMessageCommonStyles = useChatMessageCommonStyles();\n\n const chatMessageStyles = useChatMessageStyles();\n const chatItemMessageContainerClassName = mergeClasses(\n chatMessageCommonStyles.body,\n chatMessageStyles.body,\n // disable placeholder functionality for GA releases as it might confuse users\n chatMessageStyles.bodyWithPlaceholderImage,\n isBlockedMessage\n ? chatMessageCommonStyles.blocked\n : props.message.status === 'failed'\n ? chatMessageCommonStyles.failed\n : undefined,\n shouldOverlapAvatarAndMessage ? chatMessageStyles.avatarOverlap : chatMessageStyles.avatarNoOverlap,\n message.attached === 'top' || message.attached === false\n ? chatMessageStyles.bodyWithAvatar\n : chatMessageStyles.bodyWithoutAvatar,\n // messageContainerStyle used in className and style prop as style prop can't handle CSS selectors\n mergeStyles(messageContainerStyle)\n );\n\n const attached = message.attached === true ? 'center' : message.attached === 'bottom' ? 'bottom' : 'top';\n const chatMessage = (\n <>\n <div key={props.message.messageId}>\n <FluentChatMessage\n attached={attached}\n key={props.message.messageId}\n root={{\n className: chatMessageStyles.root,\n // make body not focusable to remove repetitions from narrators.\n // inner components are already focusable\n tabIndex: -1,\n role: 'none'\n }}\n author={<Text className={chatMessageAuthorStyle}>{message.senderDisplayName}</Text>}\n body={{\n className: chatItemMessageContainerClassName,\n style: { ...createStyleFromV8Style(messageContainerStyle) }\n }}\n data-ui-id=\"chat-composite-message\"\n timestamp={\n <Text className={chatMessageDateStyle} data-ui-id={ids.messageTimestamp}>\n {formattedTimestamp}\n </Text>\n }\n details={getMessageDetails()}\n >\n {getContent()}\n </FluentChatMessage>\n </div>\n </>\n );\n return chatMessage;\n};\n\n/** @private */\nexport const ChatMessageComponentAsMessageBubble = React.memo(MessageBubble);\n"]}
1
+ {"version":3,"file":"ChatMessageComponentAsMessageBubble.js","sourceRoot":"","sources":["../../../../../../../../react-components/src/components/ChatMessage/MessageComponents/ChatMessageComponentAsMessageBubble.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,WAAW,IAAI,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEhF,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AACxG,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAY5C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAGlD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,oBAA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AChB,CACL,CACJ,CAAC;IACF,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC;AAEF,eAAe;AACf,MAAM,CAAC,MAAM,mCAAmC,GAAG,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { Text, mergeStyles } from '@fluentui/react';\nimport { ChatMessage as FluentChatMessage } from '@fluentui-contrib/react-chat';\nimport { _formatString } from '@internal/acs-ui-common';\nimport React, { useCallback, useMemo } from 'react';\nimport { chatMessageDateStyle, chatMessageAuthorStyle } from '../../styles/ChatMessageComponent.styles';\nimport { useIdentifiers } from '../../../identifiers/IdentifierProvider';\nimport { useTheme } from '../../../theming';\nimport { InlineImageOptions } from '../ChatMessageContent';\nimport { ChatMessage } from '../../../types/ChatMessage';\n/* @conditional-compile-remove(data-loss-prevention) */\nimport { BlockedMessage } from '../../../types/ChatMessage';\nimport { MessageThreadStrings } from '../../MessageThread';\nimport { ComponentSlotStyle } from '../../../types';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { AttachmentMenuAction } from '../../../types';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { AttachmentMetadata } from '@internal/acs-ui-common';\nimport { _AttachmentDownloadCards } from '../../Attachment/AttachmentDownloadCards';\nimport { useLocale } from '../../../localization';\n/* @conditional-compile-remove(mention) */\nimport { MentionDisplayOptions } from '../../MentionPopover';\nimport { createStyleFromV8Style } from '../../styles/v8StyleShim';\nimport { mergeClasses } from '@fluentui/react-components';\nimport { useChatMessageStyles, useChatMessageCommonStyles } from '../../styles/MessageThread.styles';\nimport {\n generateCustomizedTimestamp,\n generateDefaultTimestamp,\n getMessageBubbleContent,\n getMessageEditedDetails\n} from '../../utils/ChatMessageComponentUtils';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { doesMessageContainMultipleAttachments } from '../../utils/ChatMessageComponentAsEditBoxUtils';\n\ntype ChatMessageComponentAsMessageBubbleProps = {\n message: ChatMessage | /* @conditional-compile-remove(data-loss-prevention) */ BlockedMessage;\n messageContainerStyle?: ComponentSlotStyle;\n showDate?: boolean;\n strings: MessageThreadStrings;\n userId: string;\n /**\n * Whether to overlap avatar and message when the view is width constrained.\n */\n shouldOverlapAvatarAndMessage: boolean;\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n /**\n * Optional callback to render message attachments in the message component.\n */\n onRenderAttachmentDownloads?: (message: ChatMessage) => JSX.Element;\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n /**\n * Optional callback to define custom actions for attachments.\n */\n actionsForAttachment?: (attachment: AttachmentMetadata, message?: ChatMessage) => AttachmentMenuAction[];\n /**\n * Optional function to provide customized date format.\n * @beta\n */\n onDisplayDateTimeString?: (messageDate: Date) => string;\n /* @conditional-compile-remove(mention) */\n /**\n * Optional props needed to display suggestions in the mention scenario.\n * @internal\n */\n mentionDisplayOptions?: MentionDisplayOptions;\n /**\n * Optional callback called when an inline image is clicked.\n * @beta\n */\n inlineImageOptions?: InlineImageOptions;\n};\n\n/** @private */\nconst MessageBubble = (props: ChatMessageComponentAsMessageBubbleProps): JSX.Element => {\n const ids = useIdentifiers();\n const theme = useTheme();\n const locale = useLocale();\n\n const {\n userId,\n message,\n showDate,\n messageContainerStyle,\n strings,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n onRenderAttachmentDownloads,\n inlineImageOptions,\n shouldOverlapAvatarAndMessage,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n actionsForAttachment,\n /* @conditional-compile-remove(mention) */\n mentionDisplayOptions,\n onDisplayDateTimeString\n } = props;\n\n const formattedTimestamp = useMemo(() => {\n const defaultTimeStamp = message.createdOn\n ? generateDefaultTimestamp(message.createdOn, showDate, strings)\n : undefined;\n\n const customTimestamp = message.createdOn\n ? generateCustomizedTimestamp(message.createdOn, locale, onDisplayDateTimeString)\n : '';\n\n return customTimestamp || defaultTimeStamp;\n }, [locale, message.createdOn, onDisplayDateTimeString, showDate, strings]);\n\n const getMessageDetails = useCallback(() => {\n return getMessageEditedDetails(message, theme, strings.editedTag);\n }, [strings.editedTag, theme, message]);\n\n const getContent = useCallback(() => {\n return getMessageBubbleContent(\n message,\n strings,\n userId,\n inlineImageOptions,\n /* @conditional-compile-remove(mention) */\n mentionDisplayOptions,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n onRenderAttachmentDownloads,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n actionsForAttachment\n );\n }, [\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */ actionsForAttachment,\n inlineImageOptions,\n /* @conditional-compile-remove(mention) */ mentionDisplayOptions,\n message,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */ onRenderAttachmentDownloads,\n strings,\n userId\n ]);\n\n const isBlockedMessage =\n false || /* @conditional-compile-remove(data-loss-prevention) */ message.messageType === 'blocked';\n const chatMessageCommonStyles = useChatMessageCommonStyles();\n /* @conditional-compile-remove(attachment-upload) */\n const hasMultipleAttachments = useMemo(() => {\n return doesMessageContainMultipleAttachments(message as ChatMessage);\n }, [message]);\n const chatMessageStyles = useChatMessageStyles();\n const chatItemMessageContainerClassName = mergeClasses(\n chatMessageCommonStyles.body,\n chatMessageStyles.body,\n // disable placeholder functionality for GA releases as it might confuse users\n chatMessageStyles.bodyWithPlaceholderImage,\n isBlockedMessage\n ? chatMessageCommonStyles.blocked\n : props.message.status === 'failed'\n ? chatMessageCommonStyles.failed\n : undefined,\n shouldOverlapAvatarAndMessage ? chatMessageStyles.avatarOverlap : chatMessageStyles.avatarNoOverlap,\n /* @conditional-compile-remove(attachment-upload) */\n hasMultipleAttachments ? chatMessageStyles.multipleAttachments : undefined,\n message.attached === 'top' || message.attached === false\n ? chatMessageStyles.bodyWithAvatar\n : chatMessageStyles.bodyWithoutAvatar,\n // messageContainerStyle used in className and style prop as style prop can't handle CSS selectors\n mergeStyles(messageContainerStyle)\n );\n\n const attached = message.attached === true ? 'center' : message.attached === 'bottom' ? 'bottom' : 'top';\n const chatMessage = (\n <>\n <div key={props.message.messageId}>\n <FluentChatMessage\n attached={attached}\n key={props.message.messageId}\n root={{\n className: chatMessageStyles.root,\n // make body not focusable to remove repetitions from narrators.\n // inner components are already focusable\n tabIndex: -1,\n role: 'none'\n }}\n author={<Text className={chatMessageAuthorStyle}>{message.senderDisplayName}</Text>}\n body={{\n className: chatItemMessageContainerClassName,\n style: { ...createStyleFromV8Style(messageContainerStyle) }\n }}\n data-ui-id=\"chat-composite-message\"\n timestamp={\n <Text className={chatMessageDateStyle} data-ui-id={ids.messageTimestamp}>\n {formattedTimestamp}\n </Text>\n }\n details={getMessageDetails()}\n >\n {getContent()}\n </FluentChatMessage>\n </div>\n </>\n );\n return chatMessage;\n};\n\n/** @private */\nexport const ChatMessageComponentAsMessageBubble = React.memo(MessageBubble);\n"]}
@@ -17,7 +17,7 @@ import { _AttachmentUploadCards } from '../../Attachment/AttachmentUploadCards';
17
17
  import { chatMessageFailedTagStyle, editChatMessageFailedTagStyle, chatMessageFailedTagStackItemStyle, editChatMessageButtonsStackStyle, useChatMessageEditContainerStyles } from '../../styles/ChatMessageComponent.styles';
18
18
  import { MAXIMUM_LENGTH_OF_MESSAGE } from '../../utils/SendBoxUtils';
19
19
  /* @conditional-compile-remove(attachment-upload) */
20
- import { attachmentMetadataReducer } from '../../utils/ChatMessageComponentAsEditBoxUtils';
20
+ import { attachmentMetadataReducer, doesMessageContainMultipleAttachments } from '../../utils/ChatMessageComponentAsEditBoxUtils';
21
21
  import { getMessageState, onRenderCancelIcon, onRenderSubmitIcon } from '../../utils/ChatMessageComponentAsEditBoxUtils';
22
22
  /* @conditional-compile-remove(attachment-upload) */
23
23
  import { getMessageWithAttachmentMetadata } from '../../utils/ChatMessageComponentAsEditBoxUtils';
@@ -59,6 +59,10 @@ export const ChatMessageComponentAsEditBox = (props) => {
59
59
  const onRenderThemedSubmitIcon = useCallback((isHover) => {
60
60
  return onRenderSubmitIcon(iconClassName(isHover));
61
61
  }, [iconClassName]);
62
+ /* @conditional-compile-remove(attachment-upload) */
63
+ const hasMultipleAttachments = useMemo(() => {
64
+ return doesMessageContainMultipleAttachments(message);
65
+ }, [message]);
62
66
  const editBoxStyles = useMemo(() => {
63
67
  return concatStyleSets(editBoxStyleSet, { textField: { borderColor: theme.palette.themePrimary } });
64
68
  }, [theme.palette.themePrimary]);
@@ -108,7 +112,9 @@ export const ChatMessageComponentAsEditBox = (props) => {
108
112
  };
109
113
  const attached = message.attached === true ? 'center' : message.attached === 'bottom' ? 'bottom' : 'top';
110
114
  return (React.createElement(ChatMyMessage, { attached: attached, root: {
111
- className: chatMyMessageStyles.root
115
+ className: mergeClasses(chatMyMessageStyles.root,
116
+ /* @conditional-compile-remove(attachment-upload) */
117
+ hasMultipleAttachments ? chatMyMessageStyles.multipleAttachments : undefined)
112
118
  }, body: {
113
119
  className: mergeClasses(editContainerStyles.body, message.failureReason !== undefined ? editContainerStyles.bodyError : editContainerStyles.bodyDefault, attached !== 'top' ? editContainerStyles.bodyAttached : undefined)
114
120
  } }, getContent()));
@@ -1 +1 @@
1
- {"version":3,"file":"ChatMessageComponentAsEditBox.js","sourceRoot":"","sources":["../../../../../../../../react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBox.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,eAAe,EAAc,WAAW,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAClF,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,yCAAgC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,sCAAsC,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EACrG,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAClE;SACF,IAEA,UAAU,EAAE,CACC,CACjB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { concatStyleSets, ITextField, mergeStyles, Stack } from '@fluentui/react';\nimport { ChatMyMessage } from '@fluentui-contrib/react-chat';\nimport { mergeClasses } from '@fluentui/react-components';\nimport { _formatString } from '@internal/acs-ui-common';\nimport { useTheme } from '../../../theming/FluentThemeProvider';\nimport React, { useCallback, useEffect, useMemo, useState } from 'react';\n/* @conditional-compile-remove(attachment-upload) */\nimport { useReducer } from 'react';\nimport { editBoxStyle, editingButtonStyle, editBoxStyleSet, inputBoxIcon } from '../../styles/EditBox.styles';\nimport { InputBoxComponent } from '../../InputBoxComponent';\nimport { InputBoxButton } from '../../InputBoxButton';\nimport { MessageThreadStrings } from '../../MessageThread';\nimport { useChatMyMessageStyles } from '../../styles/MessageThread.styles';\nimport { ChatMessage } from '../../../types';\n/* @conditional-compile-remove(attachment-upload) */\nimport { _AttachmentUploadCards } from '../../Attachment/AttachmentUploadCards';\n/* @conditional-compile-remove(attachment-upload) */\nimport { AttachmentMetadata } from '@internal/acs-ui-common';\nimport {\n chatMessageFailedTagStyle,\n editChatMessageFailedTagStyle,\n chatMessageFailedTagStackItemStyle,\n editChatMessageButtonsStackStyle,\n useChatMessageEditContainerStyles\n} from '../../styles/ChatMessageComponent.styles';\n/* @conditional-compile-remove(mention) */\nimport { MentionLookupOptions } from '../../MentionPopover';\nimport { MAXIMUM_LENGTH_OF_MESSAGE } from '../../utils/SendBoxUtils';\n/* @conditional-compile-remove(attachment-upload) */\nimport { attachmentMetadataReducer } from '../../utils/ChatMessageComponentAsEditBoxUtils';\nimport {\n getMessageState,\n onRenderCancelIcon,\n onRenderSubmitIcon\n} from '../../utils/ChatMessageComponentAsEditBoxUtils';\n/* @conditional-compile-remove(attachment-upload) */\nimport { getMessageWithAttachmentMetadata } from '../../utils/ChatMessageComponentAsEditBoxUtils';\n\n/** @private */\nexport type ChatMessageComponentAsEditBoxProps = {\n onCancel?: (messageId: string) => void;\n onSubmit: (\n text: string,\n /* @conditional-compile-remove(attachment-upload) */\n attachmentMetadata?: AttachmentMetadata[]\n ) => void;\n message: ChatMessage;\n strings: MessageThreadStrings;\n /* @conditional-compile-remove(mention) */\n mentionLookupOptions?: MentionLookupOptions;\n};\n\n/**\n * @private\n */\nexport const ChatMessageComponentAsEditBox = (props: ChatMessageComponentAsEditBoxProps): JSX.Element => {\n const { onCancel, onSubmit, strings, message } = props;\n /* @conditional-compile-remove(mention) */\n const { mentionLookupOptions } = props;\n\n const [textValue, setTextValue] = useState<string>(message.content || '');\n /* @conditional-compile-remove(attachment-upload) */\n const [attachmentMetadata, handleAttachmentAction] = useReducer(\n attachmentMetadataReducer,\n getMessageWithAttachmentMetadata(message) ?? []\n );\n const editTextFieldRef = React.useRef<ITextField>(null);\n const theme = useTheme();\n const messageState = getMessageState(\n textValue,\n /* @conditional-compile-remove(attachment-upload) */ attachmentMetadata ?? []\n );\n const submitEnabled = messageState === 'OK';\n\n const editContainerStyles = useChatMessageEditContainerStyles();\n const chatMyMessageStyles = useChatMyMessageStyles();\n\n useEffect(() => {\n editTextFieldRef.current?.focus();\n }, []);\n\n const setText = (event?: React.FormEvent<HTMLInputElement | HTMLTextAreaElement>, newValue?: string): void => {\n setTextValue(newValue ?? '');\n };\n\n const textTooLongMessage =\n messageState === 'too long'\n ? _formatString(strings.editBoxTextLimit, { limitNumber: `${MAXIMUM_LENGTH_OF_MESSAGE}` })\n : undefined;\n\n const iconClassName = useCallback(\n (isHover: boolean) => {\n const color = isHover ? theme.palette.accent : theme.palette.neutralSecondary;\n return mergeStyles(inputBoxIcon, { color });\n },\n [theme.palette.accent, theme.palette.neutralSecondary]\n );\n\n const onRenderThemedCancelIcon = useCallback(\n (isHover: boolean) => {\n return onRenderCancelIcon(iconClassName(isHover));\n },\n [iconClassName]\n );\n\n const onRenderThemedSubmitIcon = useCallback(\n (isHover: boolean) => {\n return onRenderSubmitIcon(iconClassName(isHover));\n },\n [iconClassName]\n );\n\n const editBoxStyles = useMemo(() => {\n return concatStyleSets(editBoxStyleSet, { textField: { borderColor: theme.palette.themePrimary } });\n }, [theme.palette.themePrimary]);\n\n /* @conditional-compile-remove(attachment-upload) */\n const onRenderAttachmentUploads = useCallback(() => {\n return (\n !!attachmentMetadata &&\n attachmentMetadata.length > 0 && (\n <div style={{ margin: '0.25rem' }}>\n <_AttachmentUploadCards\n attachments={attachmentMetadata}\n onCancelAttachmentUpload={(id) => {\n // edit box only capable of removing attachments\n // we need to expand attachment actions\n // if we want to support more actions e.g. add\n handleAttachmentAction({ type: 'remove', id });\n }}\n />\n </div>\n )\n );\n }, [attachmentMetadata]);\n\n const getContent = (): JSX.Element => {\n return (\n <>\n <InputBoxComponent\n data-ui-id=\"edit-box\"\n textFieldRef={editTextFieldRef}\n inputClassName={editBoxStyle}\n placeholderText={strings.editBoxPlaceholderText}\n textValue={textValue}\n onChange={setText}\n onKeyDown={(ev) => {\n if (ev.key === 'ArrowUp' || ev.key === 'ArrowDown') {\n ev.stopPropagation();\n }\n }}\n onEnterKeyDown={() => {\n submitEnabled &&\n onSubmit(\n textValue,\n /* @conditional-compile-remove(attachment-upload) */\n attachmentMetadata\n );\n }}\n supportNewline={false}\n maxLength={MAXIMUM_LENGTH_OF_MESSAGE}\n errorMessage={textTooLongMessage}\n styles={editBoxStyles}\n /* @conditional-compile-remove(mention) */\n mentionLookupOptions={mentionLookupOptions}\n ></InputBoxComponent>\n <Stack\n horizontal\n horizontalAlign=\"end\"\n className={editChatMessageButtonsStackStyle}\n tokens={{ childrenGap: '0.25rem' }}\n >\n {message.failureReason && (\n <Stack.Item grow align=\"stretch\" className={chatMessageFailedTagStackItemStyle}>\n <div className={mergeStyles(chatMessageFailedTagStyle(theme), editChatMessageFailedTagStyle)}>\n {message.failureReason}\n </div>\n </Stack.Item>\n )}\n <Stack.Item align=\"end\">\n <InputBoxButton\n className={editingButtonStyle}\n ariaLabel={strings.editBoxCancelButton}\n tooltipContent={strings.editBoxCancelButton}\n onRenderIcon={onRenderThemedCancelIcon}\n onClick={() => {\n onCancel && onCancel(message.messageId);\n }}\n id={'dismissIconWrapper'}\n />\n </Stack.Item>\n <Stack.Item align=\"end\">\n <InputBoxButton\n className={editingButtonStyle}\n ariaLabel={strings.editBoxSubmitButton}\n tooltipContent={strings.editBoxSubmitButton}\n onRenderIcon={onRenderThemedSubmitIcon}\n onClick={(e) => {\n // it's very important to pass an empty attachment here\n // so when user remvoes all attachments, UI can reflect it instantly\n // if you set it to undefined, the attachments pre-edited would still be there\n // until edit message event is received\n submitEnabled &&\n onSubmit(textValue, /* @conditional-compile-remove(attachment-upload) */ attachmentMetadata);\n e.stopPropagation();\n }}\n id={'submitIconWrapper'}\n />\n </Stack.Item>\n </Stack>\n {/* @conditional-compile-remove(attachment-upload) */ onRenderAttachmentUploads()}\n </>\n );\n };\n\n const attached = message.attached === true ? 'center' : message.attached === 'bottom' ? 'bottom' : 'top';\n return (\n <ChatMyMessage\n attached={attached}\n root={{\n className: chatMyMessageStyles.root\n }}\n body={{\n className: mergeClasses(\n editContainerStyles.body,\n message.failureReason !== undefined ? editContainerStyles.bodyError : editContainerStyles.bodyDefault,\n attached !== 'top' ? editContainerStyles.bodyAttached : undefined\n )\n }}\n >\n {getContent()}\n </ChatMyMessage>\n );\n};\n"]}
1
+ {"version":3,"file":"ChatMessageComponentAsEditBox.js","sourceRoot":"","sources":["../../../../../../../../react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBox.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,eAAe,EAAc,WAAW,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAClF,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7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AC;IACzG,OAAO,CACL,oBAAC,aAAa,IACZ,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE;YACJ,SAAS,EAAE,YAAY,CACrB,mBAAmB,CAAC,IAAI;YACxB,oDAAoD;YACpD,sBAAsB,CAAC,CAAC,CAAC,mBAAmB,CAAC,mBAAmB,CAAC,CAAC,CAAC,SAAS,CAC7E;SACF,EACD,IAAI,EAAE;YACJ,SAAS,EAAE,YAAY,CACrB,mBAAmB,CAAC,IAAI,EACxB,OAAO,CAAC,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC,CAAC,mBAAmB,CAAC,WAAW,EACrG,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAClE;SACF,IAEA,UAAU,EAAE,CACC,CACjB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { concatStyleSets, ITextField, mergeStyles, Stack } from '@fluentui/react';\nimport { ChatMyMessage } from '@fluentui-contrib/react-chat';\nimport { mergeClasses } from '@fluentui/react-components';\nimport { _formatString } from '@internal/acs-ui-common';\nimport { useTheme } from '../../../theming/FluentThemeProvider';\nimport React, { useCallback, useEffect, useMemo, useState } from 'react';\n/* @conditional-compile-remove(attachment-upload) */\nimport { useReducer } from 'react';\nimport { editBoxStyle, editingButtonStyle, editBoxStyleSet, inputBoxIcon } from '../../styles/EditBox.styles';\nimport { InputBoxComponent } from '../../InputBoxComponent';\nimport { InputBoxButton } from '../../InputBoxButton';\nimport { MessageThreadStrings } from '../../MessageThread';\nimport { useChatMyMessageStyles } from '../../styles/MessageThread.styles';\nimport { ChatMessage } from '../../../types';\n/* @conditional-compile-remove(attachment-upload) */\nimport { _AttachmentUploadCards } from '../../Attachment/AttachmentUploadCards';\n/* @conditional-compile-remove(attachment-upload) */\nimport { AttachmentMetadata } from '@internal/acs-ui-common';\nimport {\n chatMessageFailedTagStyle,\n editChatMessageFailedTagStyle,\n chatMessageFailedTagStackItemStyle,\n editChatMessageButtonsStackStyle,\n useChatMessageEditContainerStyles\n} from '../../styles/ChatMessageComponent.styles';\n/* @conditional-compile-remove(mention) */\nimport { MentionLookupOptions } from '../../MentionPopover';\nimport { MAXIMUM_LENGTH_OF_MESSAGE } from '../../utils/SendBoxUtils';\n/* @conditional-compile-remove(attachment-upload) */\nimport {\n attachmentMetadataReducer,\n doesMessageContainMultipleAttachments\n} from '../../utils/ChatMessageComponentAsEditBoxUtils';\nimport {\n getMessageState,\n onRenderCancelIcon,\n onRenderSubmitIcon\n} from '../../utils/ChatMessageComponentAsEditBoxUtils';\n/* @conditional-compile-remove(attachment-upload) */\nimport { getMessageWithAttachmentMetadata } from '../../utils/ChatMessageComponentAsEditBoxUtils';\n\n/** @private */\nexport type ChatMessageComponentAsEditBoxProps = {\n onCancel?: (messageId: string) => void;\n onSubmit: (\n text: string,\n /* @conditional-compile-remove(attachment-upload) */\n attachmentMetadata?: AttachmentMetadata[]\n ) => void;\n message: ChatMessage;\n strings: MessageThreadStrings;\n /* @conditional-compile-remove(mention) */\n mentionLookupOptions?: MentionLookupOptions;\n};\n\n/**\n * @private\n */\nexport const ChatMessageComponentAsEditBox = (props: ChatMessageComponentAsEditBoxProps): JSX.Element => {\n const { onCancel, onSubmit, strings, message } = props;\n /* @conditional-compile-remove(mention) */\n const { mentionLookupOptions } = props;\n\n const [textValue, setTextValue] = useState<string>(message.content || '');\n /* @conditional-compile-remove(attachment-upload) */\n const [attachmentMetadata, handleAttachmentAction] = useReducer(\n attachmentMetadataReducer,\n getMessageWithAttachmentMetadata(message) ?? []\n );\n const editTextFieldRef = React.useRef<ITextField>(null);\n const theme = useTheme();\n const messageState = getMessageState(\n textValue,\n /* @conditional-compile-remove(attachment-upload) */ attachmentMetadata ?? []\n );\n const submitEnabled = messageState === 'OK';\n\n const editContainerStyles = useChatMessageEditContainerStyles();\n const chatMyMessageStyles = useChatMyMessageStyles();\n\n useEffect(() => {\n editTextFieldRef.current?.focus();\n }, []);\n\n const setText = (event?: React.FormEvent<HTMLInputElement | HTMLTextAreaElement>, newValue?: string): void => {\n setTextValue(newValue ?? '');\n };\n\n const textTooLongMessage =\n messageState === 'too long'\n ? _formatString(strings.editBoxTextLimit, { limitNumber: `${MAXIMUM_LENGTH_OF_MESSAGE}` })\n : undefined;\n\n const iconClassName = useCallback(\n (isHover: boolean) => {\n const color = isHover ? theme.palette.accent : theme.palette.neutralSecondary;\n return mergeStyles(inputBoxIcon, { color });\n },\n [theme.palette.accent, theme.palette.neutralSecondary]\n );\n\n const onRenderThemedCancelIcon = useCallback(\n (isHover: boolean) => {\n return onRenderCancelIcon(iconClassName(isHover));\n },\n [iconClassName]\n );\n\n const onRenderThemedSubmitIcon = useCallback(\n (isHover: boolean) => {\n return onRenderSubmitIcon(iconClassName(isHover));\n },\n [iconClassName]\n );\n\n /* @conditional-compile-remove(attachment-upload) */\n const hasMultipleAttachments = useMemo(() => {\n return doesMessageContainMultipleAttachments(message);\n }, [message]);\n\n const editBoxStyles = useMemo(() => {\n return concatStyleSets(editBoxStyleSet, { textField: { borderColor: theme.palette.themePrimary } });\n }, [theme.palette.themePrimary]);\n\n /* @conditional-compile-remove(attachment-upload) */\n const onRenderAttachmentUploads = useCallback(() => {\n return (\n !!attachmentMetadata &&\n attachmentMetadata.length > 0 && (\n <div style={{ margin: '0.25rem' }}>\n <_AttachmentUploadCards\n attachments={attachmentMetadata}\n onCancelAttachmentUpload={(id) => {\n // edit box only capable of removing attachments\n // we need to expand attachment actions\n // if we want to support more actions e.g. add\n handleAttachmentAction({ type: 'remove', id });\n }}\n />\n </div>\n )\n );\n }, [attachmentMetadata]);\n\n const getContent = (): JSX.Element => {\n return (\n <>\n <InputBoxComponent\n data-ui-id=\"edit-box\"\n textFieldRef={editTextFieldRef}\n inputClassName={editBoxStyle}\n placeholderText={strings.editBoxPlaceholderText}\n textValue={textValue}\n onChange={setText}\n onKeyDown={(ev) => {\n if (ev.key === 'ArrowUp' || ev.key === 'ArrowDown') {\n ev.stopPropagation();\n }\n }}\n onEnterKeyDown={() => {\n submitEnabled &&\n onSubmit(\n textValue,\n /* @conditional-compile-remove(attachment-upload) */\n attachmentMetadata\n );\n }}\n supportNewline={false}\n maxLength={MAXIMUM_LENGTH_OF_MESSAGE}\n errorMessage={textTooLongMessage}\n styles={editBoxStyles}\n /* @conditional-compile-remove(mention) */\n mentionLookupOptions={mentionLookupOptions}\n ></InputBoxComponent>\n <Stack\n horizontal\n horizontalAlign=\"end\"\n className={editChatMessageButtonsStackStyle}\n tokens={{ childrenGap: '0.25rem' }}\n >\n {message.failureReason && (\n <Stack.Item grow align=\"stretch\" className={chatMessageFailedTagStackItemStyle}>\n <div className={mergeStyles(chatMessageFailedTagStyle(theme), editChatMessageFailedTagStyle)}>\n {message.failureReason}\n </div>\n </Stack.Item>\n )}\n <Stack.Item align=\"end\">\n <InputBoxButton\n className={editingButtonStyle}\n ariaLabel={strings.editBoxCancelButton}\n tooltipContent={strings.editBoxCancelButton}\n onRenderIcon={onRenderThemedCancelIcon}\n onClick={() => {\n onCancel && onCancel(message.messageId);\n }}\n id={'dismissIconWrapper'}\n />\n </Stack.Item>\n <Stack.Item align=\"end\">\n <InputBoxButton\n className={editingButtonStyle}\n ariaLabel={strings.editBoxSubmitButton}\n tooltipContent={strings.editBoxSubmitButton}\n onRenderIcon={onRenderThemedSubmitIcon}\n onClick={(e) => {\n // it's very important to pass an empty attachment here\n // so when user remvoes all attachments, UI can reflect it instantly\n // if you set it to undefined, the attachments pre-edited would still be there\n // until edit message event is received\n submitEnabled &&\n onSubmit(textValue, /* @conditional-compile-remove(attachment-upload) */ attachmentMetadata);\n e.stopPropagation();\n }}\n id={'submitIconWrapper'}\n />\n </Stack.Item>\n </Stack>\n {/* @conditional-compile-remove(attachment-upload) */ onRenderAttachmentUploads()}\n </>\n );\n };\n\n const attached = message.attached === true ? 'center' : message.attached === 'bottom' ? 'bottom' : 'top';\n return (\n <ChatMyMessage\n attached={attached}\n root={{\n className: mergeClasses(\n chatMyMessageStyles.root,\n /* @conditional-compile-remove(attachment-upload) */\n hasMultipleAttachments ? chatMyMessageStyles.multipleAttachments : undefined\n )\n }}\n body={{\n className: mergeClasses(\n editContainerStyles.body,\n message.failureReason !== undefined ? editContainerStyles.bodyError : editContainerStyles.bodyDefault,\n attached !== 'top' ? editContainerStyles.bodyAttached : undefined\n )\n }}\n >\n {getContent()}\n </ChatMyMessage>\n );\n};\n"]}
@@ -5,7 +5,7 @@ import React, { useMemo } from 'react';
5
5
  import { Suspense } from 'react';
6
6
  import { ChatMessageComponentAsEditBox } from './ChatMessageComponentAsEditBox';
7
7
  /* @conditional-compile-remove(rich-text-editor) */
8
- import { ErrorBoundary } from '../../ErrorBoundary';
8
+ import { _ErrorBoundary } from '../../ErrorBoundary';
9
9
  /* @conditional-compile-remove(rich-text-editor) */
10
10
  const ChatMessageComponentAsRichTextEditBox = React.lazy(() => import('./ChatMessageComponentAsRichTextEditBox'));
11
11
  /**
@@ -27,7 +27,7 @@ export const ChatMessageComponentAsEditBoxPicker = (props) => {
27
27
  }, [props]);
28
28
  /* @conditional-compile-remove(rich-text-editor) */
29
29
  if (richTextEditor) {
30
- return (React.createElement(ErrorBoundary, { fallback: simpleEditBox },
30
+ return (React.createElement(_ErrorBoundary, { fallback: simpleEditBox },
31
31
  React.createElement(Suspense, { fallback: simpleEditBox },
32
32
  React.createElement(ChatMessageComponentAsRichTextEditBox, Object.assign({}, props)))));
33
33
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ChatMessageComponentAsEditBoxPicker.js","sourceRoot":"","sources":["../../../../../../../../react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBoxPicker.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,mDAAmD;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAKjC,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAKhF,mDAAmD;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,mDAAmD;AACnD,MAAM,qCAAqC,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,yCAAyC,CAAC,CAAC,CAAC;AAElH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,yCAAyC,GAAG,GAEtD,EAAE,CAAC,MAAM,CAAC,yCAAyC,CAAC,CAAC;AAmBxD;;GAEG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAAG,CAAC,KAA+C,EAAe,EAAE;IAClH,mDAAmD;IACnD,MAAM,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC;IAEjC,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,EAAE;QACjC,OAAO,oBAAC,6BAA6B,oBAAK,KAAK,EAAI,CAAC;IACtD,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,mDAAmD;IACnD,IAAI,cAAc,EAAE,CAAC;QACnB,OAAO,CACL,oBAAC,aAAa,IAAC,QAAQ,EAAE,aAAa;YACpC,oBAAC,QAAQ,IAAC,QAAQ,EAAE,aAAa;gBAC/B,oBAAC,qCAAqC,oBAAK,KAAK,EAAI,CAC3C,CACG,CACjB,CAAC;IACJ,CAAC;IAED,OAAO,aAAa,CAAC;AACvB,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport React, { useMemo } from 'react';\n/* @conditional-compile-remove(rich-text-editor) */\nimport { Suspense } from 'react';\nimport { ChatMessage } from '../../../types';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { AttachmentMetadata } from '@internal/acs-ui-common';\nimport { MessageThreadStrings } from '../../MessageThread';\nimport { ChatMessageComponentAsEditBox } from './ChatMessageComponentAsEditBox';\n/* @conditional-compile-remove(mention) */\nimport { MentionLookupOptions } from '../../MentionPopover';\n/* @conditional-compile-remove(rich-text-editor) */\nimport type { ChatMessageComponentAsRichTextEditBoxProps } from './ChatMessageComponentAsRichTextEditBox';\n/* @conditional-compile-remove(rich-text-editor) */\nimport { ErrorBoundary } from '../../ErrorBoundary';\n\n/* @conditional-compile-remove(rich-text-editor) */\nconst ChatMessageComponentAsRichTextEditBox = React.lazy(() => import('./ChatMessageComponentAsRichTextEditBox'));\n\n/**\n * @private\n * Use this function to load RoosterJS dependencies early in the lifecycle.\n * It should be the same import as used for lazy loading.\n *\n * @conditional-compile-remove(rich-text-editor)\n */\nexport const loadChatMessageComponentAsRichTextEditBox = (): Promise<{\n default: React.ComponentType<ChatMessageComponentAsRichTextEditBoxProps>;\n}> => import('./ChatMessageComponentAsRichTextEditBox');\n\n/**\n * @private\n */\nexport type ChatMessageComponentAsEditBoxPickerProps = {\n onCancel?: (messageId: string) => void;\n onSubmit: (\n text: string,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n attachmentMetadata?: AttachmentMetadata[]\n ) => void;\n message: ChatMessage;\n strings: MessageThreadStrings;\n /* @conditional-compile-remove(mention) */\n mentionLookupOptions?: MentionLookupOptions;\n richTextEditor?: boolean;\n};\n\n/**\n * @private\n */\nexport const ChatMessageComponentAsEditBoxPicker = (props: ChatMessageComponentAsEditBoxPickerProps): JSX.Element => {\n /* @conditional-compile-remove(rich-text-editor) */\n const { richTextEditor } = props;\n\n const simpleEditBox = useMemo(() => {\n return <ChatMessageComponentAsEditBox {...props} />;\n }, [props]);\n\n /* @conditional-compile-remove(rich-text-editor) */\n if (richTextEditor) {\n return (\n <ErrorBoundary fallback={simpleEditBox}>\n <Suspense fallback={simpleEditBox}>\n <ChatMessageComponentAsRichTextEditBox {...props} />\n </Suspense>\n </ErrorBoundary>\n );\n }\n\n return simpleEditBox;\n};\n"]}
1
+ {"version":3,"file":"ChatMessageComponentAsEditBoxPicker.js","sourceRoot":"","sources":["../../../../../../../../react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBoxPicker.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,mDAAmD;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAKjC,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAKhF,mDAAmD;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,mDAAmD;AACnD,MAAM,qCAAqC,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,yCAAyC,CAAC,CAAC,CAAC;AAElH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,yCAAyC,GAAG,GAEtD,EAAE,CAAC,MAAM,CAAC,yCAAyC,CAAC,CAAC;AAmBxD;;GAEG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAAG,CAAC,KAA+C,EAAe,EAAE;IAClH,mDAAmD;IACnD,MAAM,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC;IAEjC,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,EAAE;QACjC,OAAO,oBAAC,6BAA6B,oBAAK,KAAK,EAAI,CAAC;IACtD,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,mDAAmD;IACnD,IAAI,cAAc,EAAE,CAAC;QACnB,OAAO,CACL,oBAAC,cAAc,IAAC,QAAQ,EAAE,aAAa;YACrC,oBAAC,QAAQ,IAAC,QAAQ,EAAE,aAAa;gBAC/B,oBAAC,qCAAqC,oBAAK,KAAK,EAAI,CAC3C,CACI,CAClB,CAAC;IACJ,CAAC;IAED,OAAO,aAAa,CAAC;AACvB,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport React, { useMemo } from 'react';\n/* @conditional-compile-remove(rich-text-editor) */\nimport { Suspense } from 'react';\nimport { ChatMessage } from '../../../types';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { AttachmentMetadata } from '@internal/acs-ui-common';\nimport { MessageThreadStrings } from '../../MessageThread';\nimport { ChatMessageComponentAsEditBox } from './ChatMessageComponentAsEditBox';\n/* @conditional-compile-remove(mention) */\nimport { MentionLookupOptions } from '../../MentionPopover';\n/* @conditional-compile-remove(rich-text-editor) */\nimport type { ChatMessageComponentAsRichTextEditBoxProps } from './ChatMessageComponentAsRichTextEditBox';\n/* @conditional-compile-remove(rich-text-editor) */\nimport { _ErrorBoundary } from '../../ErrorBoundary';\n\n/* @conditional-compile-remove(rich-text-editor) */\nconst ChatMessageComponentAsRichTextEditBox = React.lazy(() => import('./ChatMessageComponentAsRichTextEditBox'));\n\n/**\n * @private\n * Use this function to load RoosterJS dependencies early in the lifecycle.\n * It should be the same import as used for lazy loading.\n *\n * @conditional-compile-remove(rich-text-editor)\n */\nexport const loadChatMessageComponentAsRichTextEditBox = (): Promise<{\n default: React.ComponentType<ChatMessageComponentAsRichTextEditBoxProps>;\n}> => import('./ChatMessageComponentAsRichTextEditBox');\n\n/**\n * @private\n */\nexport type ChatMessageComponentAsEditBoxPickerProps = {\n onCancel?: (messageId: string) => void;\n onSubmit: (\n text: string,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n attachmentMetadata?: AttachmentMetadata[]\n ) => void;\n message: ChatMessage;\n strings: MessageThreadStrings;\n /* @conditional-compile-remove(mention) */\n mentionLookupOptions?: MentionLookupOptions;\n richTextEditor?: boolean;\n};\n\n/**\n * @private\n */\nexport const ChatMessageComponentAsEditBoxPicker = (props: ChatMessageComponentAsEditBoxPickerProps): JSX.Element => {\n /* @conditional-compile-remove(rich-text-editor) */\n const { richTextEditor } = props;\n\n const simpleEditBox = useMemo(() => {\n return <ChatMessageComponentAsEditBox {...props} />;\n }, [props]);\n\n /* @conditional-compile-remove(rich-text-editor) */\n if (richTextEditor) {\n return (\n <_ErrorBoundary fallback={simpleEditBox}>\n <Suspense fallback={simpleEditBox}>\n <ChatMessageComponentAsRichTextEditBox {...props} />\n </Suspense>\n </_ErrorBoundary>\n );\n }\n\n return simpleEditBox;\n};\n"]}
@@ -16,7 +16,7 @@ import { useChatMessageRichTextEditContainerStyles } from '../../styles/ChatMess
16
16
  import { MAXIMUM_LENGTH_OF_MESSAGE } from '../../utils/SendBoxUtils';
17
17
  import { getMessageState, onRenderCancelIcon, onRenderSubmitIcon } from '../../utils/ChatMessageComponentAsEditBoxUtils';
18
18
  /* @conditional-compile-remove(attachment-upload) */
19
- import { attachmentMetadataReducer, getMessageWithAttachmentMetadata } from '../../utils/ChatMessageComponentAsEditBoxUtils';
19
+ import { attachmentMetadataReducer, getMessageWithAttachmentMetadata, doesMessageContainMultipleAttachments } from '../../utils/ChatMessageComponentAsEditBoxUtils';
20
20
  import { RichTextInputBoxComponent } from '../../RichTextEditor/RichTextInputBoxComponent';
21
21
  import { editBoxRichTextEditorStyle, richTextActionButtonsStyle } from '../../styles/RichTextEditor.styles';
22
22
  import { RichTextSendBoxErrors } from '../../RichTextEditor/RichTextSendBoxErrors';
@@ -58,6 +58,10 @@ export const ChatMessageComponentAsRichTextEditBox = (props) => {
58
58
  const onRenderThemedSubmitIcon = useCallback((isHover) => {
59
59
  return onRenderSubmitIcon(iconClassName(isHover));
60
60
  }, [iconClassName]);
61
+ /* @conditional-compile-remove(attachment-upload) */
62
+ const hasMultipleAttachments = useMemo(() => {
63
+ return doesMessageContainMultipleAttachments(message);
64
+ }, [message]);
61
65
  const actionButtons = useMemo(() => {
62
66
  return (React.createElement(Stack, { horizontal: true },
63
67
  React.createElement(InputBoxButton, { className: richTextActionButtonsStyle, ariaLabel: strings.editBoxCancelButton, tooltipContent: strings.editBoxCancelButton, onRenderIcon: onRenderThemedCancelIcon, onClick: () => {
@@ -116,7 +120,9 @@ export const ChatMessageComponentAsRichTextEditBox = (props) => {
116
120
  };
117
121
  const attached = message.attached === true ? 'center' : message.attached === 'bottom' ? 'bottom' : 'top';
118
122
  return (React.createElement(ChatMyMessage, { attached: attached, root: {
119
- className: chatMyMessageStyles.root
123
+ className: mergeClasses(chatMyMessageStyles.root,
124
+ /* @conditional-compile-remove(attachment-upload) */
125
+ hasMultipleAttachments ? chatMyMessageStyles.multipleAttachments : undefined)
120
126
  }, body: {
121
127
  className: mergeClasses(editContainerStyles.body, attached !== 'top' ? editContainerStyles.bodyAttached : undefined)
122
128
  } }, getContent()));
@@ -1 +1 @@
1
- {"version":3,"file":"ChatMessageComponentAsRichTextEditBox.js","sourceRoot":"","sources":["../../../../../../../../react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsRichTextEditBox.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,yCAAgC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9D,oDAAoD;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,kBAAkB,EAAE,+BAA+B,EAAE,MAAM,6BAA6B,CAAC;AAClG,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAE3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAGhF,OAAO,EAAE,yCAAyC,EAAE,MAAM,0CAA0C,CAAC;AAC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0B,EACpD,0BAA0B,EAAE,IAAI;gBAChC,oDAAoD;gBACpD,yBAAyB,EAAE,yBAAyB,GACpD,CACI,CACT,CAAC;IACJ,CAAC,CAAC;IAEF,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC;IACzG,OAAO,CACL,oBAAC,aAAa,IACZ,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE;YACJ,SAAS,EAAE,mBAAmB,CAAC,IAAI;SACpC,EACD,IAAI,EAAE;YACJ,SAAS,EAAE,YAAY,CACrB,mBAAmB,CAAC,IAAI,EACxB,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAClE;SACF,IAEA,UAAU,EAAE,CACC,CACjB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,qCAAqC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { mergeStyles, Stack } from '@fluentui/react';\nimport { ChatMyMessage } from '@fluentui-contrib/react-chat';\nimport { mergeClasses } from '@fluentui/react-components';\nimport { _formatString } from '@internal/acs-ui-common';\nimport { useTheme } from '../../../theming';\nimport React, { useCallback, useMemo, useState } from 'react';\n/* @conditional-compile-remove(attachment-upload) */\nimport { useReducer } from 'react';\nimport { editBoxWidthStyles, richTextEditBoxActionButtonIcon } from '../../styles/EditBox.styles';\nimport { InputBoxButton } from '../../InputBoxButton';\nimport { MessageThreadStrings } from '../../MessageThread';\nimport { useChatMyMessageStyles } from '../../styles/MessageThread.styles';\nimport { ChatMessage } from '../../../types';\nimport { _AttachmentUploadCards } from '../../Attachment/AttachmentUploadCards';\n/* @conditional-compile-remove(attachment-upload) */\nimport { AttachmentMetadata } from '@internal/acs-ui-common';\nimport { useChatMessageRichTextEditContainerStyles } from '../../styles/ChatMessageComponent.styles';\nimport { MAXIMUM_LENGTH_OF_MESSAGE } from '../../utils/SendBoxUtils';\nimport {\n getMessageState,\n onRenderCancelIcon,\n onRenderSubmitIcon\n} from '../../utils/ChatMessageComponentAsEditBoxUtils';\n/* @conditional-compile-remove(attachment-upload) */\nimport {\n attachmentMetadataReducer,\n getMessageWithAttachmentMetadata\n} from '../../utils/ChatMessageComponentAsEditBoxUtils';\nimport { RichTextEditorComponentRef } from '../../RichTextEditor/RichTextEditor';\nimport { RichTextInputBoxComponent } from '../../RichTextEditor/RichTextInputBoxComponent';\nimport { editBoxRichTextEditorStyle, richTextActionButtonsStyle } from '../../styles/RichTextEditor.styles';\nimport { RichTextSendBoxErrors } from '../../RichTextEditor/RichTextSendBoxErrors';\nimport { useLocale } from '../../../localization';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { FluentV9ThemeProvider } from '../../../theming/FluentV9ThemeProvider';\n/* @conditional-compile-remove(attachment-upload) */\nimport { attachmentUploadCardsStyles } from '../../styles/SendBox.styles';\n\n/** @private */\nexport type ChatMessageComponentAsRichTextEditBoxProps = {\n onCancel?: (messageId: string) => void;\n onSubmit: (\n text: string,\n /* @conditional-compile-remove(attachment-upload) */\n attachmentMetadata?: AttachmentMetadata[]\n ) => void;\n message: ChatMessage;\n strings: MessageThreadStrings;\n};\n\n/**\n * @private\n */\nexport const ChatMessageComponentAsRichTextEditBox = (\n props: ChatMessageComponentAsRichTextEditBoxProps\n): JSX.Element => {\n const { onCancel, onSubmit, strings, message } = props;\n\n const [textValue, setTextValue] = useState<string>(message.content || '');\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n const [attachmentMetadata, handleAttachmentAction] = useReducer(\n attachmentMetadataReducer,\n getMessageWithAttachmentMetadata(message) ?? []\n );\n const editTextFieldRef = React.useRef<RichTextEditorComponentRef>(null);\n const theme = useTheme();\n const messageState = getMessageState(\n textValue,\n /* @conditional-compile-remove(attachment-upload) */ attachmentMetadata ?? []\n );\n const submitEnabled = messageState === 'OK';\n\n const editContainerStyles = useChatMessageRichTextEditContainerStyles();\n const chatMyMessageStyles = useChatMyMessageStyles();\n const locale = useLocale().strings;\n\n const setText = (newValue?: string): void => {\n setTextValue(newValue ?? '');\n };\n\n const textTooLongMessage =\n messageState === 'too long'\n ? _formatString(strings.editBoxTextLimit, { limitNumber: `${MAXIMUM_LENGTH_OF_MESSAGE}` })\n : undefined;\n\n const iconClassName = useCallback(\n (isHover: boolean) => {\n const color = isHover ? theme.palette.accent : theme.palette.neutralSecondary;\n return mergeStyles(richTextEditBoxActionButtonIcon, { color });\n },\n [theme.palette.accent, theme.palette.neutralSecondary]\n );\n\n const onRenderThemedCancelIcon = useCallback(\n (isHover: boolean) => {\n return onRenderCancelIcon(iconClassName(isHover));\n },\n [iconClassName]\n );\n\n const onRenderThemedSubmitIcon = useCallback(\n (isHover: boolean) => {\n return onRenderSubmitIcon(iconClassName(isHover));\n },\n [iconClassName]\n );\n\n const actionButtons = useMemo(() => {\n return (\n <Stack horizontal>\n <InputBoxButton\n className={richTextActionButtonsStyle}\n ariaLabel={strings.editBoxCancelButton}\n tooltipContent={strings.editBoxCancelButton}\n onRenderIcon={onRenderThemedCancelIcon}\n onClick={() => {\n onCancel && onCancel(message.messageId);\n }}\n id={'dismissIconWrapper'}\n data-testId={strings.editBoxCancelButton}\n />\n <InputBoxButton\n className={richTextActionButtonsStyle}\n ariaLabel={strings.editBoxSubmitButton}\n tooltipContent={strings.editBoxSubmitButton}\n onRenderIcon={onRenderThemedSubmitIcon}\n onClick={(e) => {\n // it's very important to pass an empty attachment here\n // so when user remvoes all attachments, UI can reflect it instantly\n // if you set it to undefined, the attachments pre-edited would still be there\n // until edit message event is received\n submitEnabled &&\n onSubmit(textValue, /* @conditional-compile-remove(attachment-upload) */ attachmentMetadata);\n e.stopPropagation();\n }}\n id={'submitIconWrapper'}\n data-testId={strings.editBoxSubmitButton}\n />\n </Stack>\n );\n }, [\n /* @conditional-compile-remove(attachment-upload) */\n attachmentMetadata,\n message.messageId,\n onCancel,\n onRenderThemedCancelIcon,\n onRenderThemedSubmitIcon,\n onSubmit,\n strings.editBoxCancelButton,\n strings.editBoxSubmitButton,\n submitEnabled,\n textValue\n ]);\n const richTextLocaleStrings = useMemo(() => {\n /* @conditional-compile-remove(rich-text-editor) */\n return { ...locale.richTextSendBox, ...strings };\n return locale.sendBox;\n }, [\n /* @conditional-compile-remove(rich-text-editor) */ locale.richTextSendBox,\n /* @conditional-compile-remove(rich-text-editor) */ strings,\n locale.sendBox\n ]);\n\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n const onCancelAttachmentUpload = useCallback((attachmentId: string) => {\n // edit box only capable of removing attachments\n // we need to expand attachment actions\n // if we want to support more actions e.g. add\n handleAttachmentAction({ type: 'remove', id: attachmentId });\n }, []);\n\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n const onRenderAttachmentUploads = useCallback(() => {\n return (\n <Stack className={attachmentUploadCardsStyles}>\n <FluentV9ThemeProvider v8Theme={theme}>\n <_AttachmentUploadCards\n attachments={attachmentMetadata}\n onCancelAttachmentUpload={onCancelAttachmentUpload}\n />\n </FluentV9ThemeProvider>\n </Stack>\n );\n }, [attachmentMetadata, onCancelAttachmentUpload, theme]);\n\n const getContent = (): JSX.Element => {\n return (\n <Stack className={mergeStyles(editBoxWidthStyles)}>\n <RichTextSendBoxErrors textTooLongMessage={textTooLongMessage} systemMessage={message.failureReason} />\n <RichTextInputBoxComponent\n placeholderText={strings.editBoxPlaceholderText}\n onChange={setText}\n editorComponentRef={editTextFieldRef}\n initialContent={message.content}\n content={textValue}\n strings={richTextLocaleStrings}\n disabled={false}\n actionComponents={actionButtons}\n richTextEditorStyleProps={editBoxRichTextEditorStyle}\n isHorizontalLayoutDisabled={true}\n /* @conditional-compile-remove(attachment-upload) */\n onRenderAttachmentUploads={onRenderAttachmentUploads}\n />\n </Stack>\n );\n };\n\n const attached = message.attached === true ? 'center' : message.attached === 'bottom' ? 'bottom' : 'top';\n return (\n <ChatMyMessage\n attached={attached}\n root={{\n className: chatMyMessageStyles.root\n }}\n body={{\n className: mergeClasses(\n editContainerStyles.body,\n attached !== 'top' ? editContainerStyles.bodyAttached : undefined\n )\n }}\n >\n {getContent()}\n </ChatMyMessage>\n );\n};\n\nexport default ChatMessageComponentAsRichTextEditBox;\n"]}
1
+ {"version":3,"file":"ChatMessageComponentAsRichTextEditBox.js","sourceRoot":"","sources":["../../../../../../../../react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsRichTextEditBox.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,yCAAgC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9D,oDAAoD;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,kBAAkB,EAAE,+BAA+B,EAAE,MAAM,6BAA6B,CAAC;AAClG,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAE3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAGhF,OAAO,EAAE,yCAAyC,EAAE,MAAM,0CAA0C,CAAC;AACrG,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EACL,eAAe,EACf,k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,EAAE,qBAAqB,EAC9B,QAAQ,EAAE,KAAK,EACf,gBAAgB,EAAE,aAAa,EAC/B,wBAAwB,EAAE,0BAA0B,EACpD,0BAA0B,EAAE,IAAI;gBAChC,oDAAoD;gBACpD,yBAAyB,EAAE,yBAAyB,GACpD,CACI,CACT,CAAC;IACJ,CAAC,CAAC;IAEF,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC;IACzG,OAAO,CACL,oBAAC,aAAa,IACZ,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE;YACJ,SAAS,EAAE,YAAY,CACrB,mBAAmB,CAAC,IAAI;YACxB,oDAAoD;YACpD,sBAAsB,CAAC,CAAC,CAAC,mBAAmB,CAAC,mBAAmB,CAAC,CAAC,CAAC,SAAS,CAC7E;SACF,EACD,IAAI,EAAE;YACJ,SAAS,EAAE,YAAY,CACrB,mBAAmB,CAAC,IAAI,EACxB,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAClE;SACF,IAEA,UAAU,EAAE,CACC,CACjB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,qCAAqC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { mergeStyles, Stack } from '@fluentui/react';\nimport { ChatMyMessage } from '@fluentui-contrib/react-chat';\nimport { mergeClasses } from '@fluentui/react-components';\nimport { _formatString } from '@internal/acs-ui-common';\nimport { useTheme } from '../../../theming';\nimport React, { useCallback, useMemo, useState } from 'react';\n/* @conditional-compile-remove(attachment-upload) */\nimport { useReducer } from 'react';\nimport { editBoxWidthStyles, richTextEditBoxActionButtonIcon } from '../../styles/EditBox.styles';\nimport { InputBoxButton } from '../../InputBoxButton';\nimport { MessageThreadStrings } from '../../MessageThread';\nimport { useChatMyMessageStyles } from '../../styles/MessageThread.styles';\nimport { ChatMessage } from '../../../types';\nimport { _AttachmentUploadCards } from '../../Attachment/AttachmentUploadCards';\n/* @conditional-compile-remove(attachment-upload) */\nimport { AttachmentMetadata } from '@internal/acs-ui-common';\nimport { useChatMessageRichTextEditContainerStyles } from '../../styles/ChatMessageComponent.styles';\nimport { MAXIMUM_LENGTH_OF_MESSAGE } from '../../utils/SendBoxUtils';\nimport {\n getMessageState,\n onRenderCancelIcon,\n onRenderSubmitIcon\n} from '../../utils/ChatMessageComponentAsEditBoxUtils';\n/* @conditional-compile-remove(attachment-upload) */\nimport {\n attachmentMetadataReducer,\n getMessageWithAttachmentMetadata,\n doesMessageContainMultipleAttachments\n} from '../../utils/ChatMessageComponentAsEditBoxUtils';\nimport { RichTextEditorComponentRef } from '../../RichTextEditor/RichTextEditor';\nimport { RichTextInputBoxComponent } from '../../RichTextEditor/RichTextInputBoxComponent';\nimport { editBoxRichTextEditorStyle, richTextActionButtonsStyle } from '../../styles/RichTextEditor.styles';\nimport { RichTextSendBoxErrors } from '../../RichTextEditor/RichTextSendBoxErrors';\nimport { useLocale } from '../../../localization';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { FluentV9ThemeProvider } from '../../../theming/FluentV9ThemeProvider';\n/* @conditional-compile-remove(attachment-upload) */\nimport { attachmentUploadCardsStyles } from '../../styles/SendBox.styles';\n\n/** @private */\nexport type ChatMessageComponentAsRichTextEditBoxProps = {\n onCancel?: (messageId: string) => void;\n onSubmit: (\n text: string,\n /* @conditional-compile-remove(attachment-upload) */\n attachmentMetadata?: AttachmentMetadata[]\n ) => void;\n message: ChatMessage;\n strings: MessageThreadStrings;\n};\n\n/**\n * @private\n */\nexport const ChatMessageComponentAsRichTextEditBox = (\n props: ChatMessageComponentAsRichTextEditBoxProps\n): JSX.Element => {\n const { onCancel, onSubmit, strings, message } = props;\n\n const [textValue, setTextValue] = useState<string>(message.content || '');\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n const [attachmentMetadata, handleAttachmentAction] = useReducer(\n attachmentMetadataReducer,\n getMessageWithAttachmentMetadata(message) ?? []\n );\n const editTextFieldRef = React.useRef<RichTextEditorComponentRef>(null);\n const theme = useTheme();\n const messageState = getMessageState(\n textValue,\n /* @conditional-compile-remove(attachment-upload) */ attachmentMetadata ?? []\n );\n const submitEnabled = messageState === 'OK';\n\n const editContainerStyles = useChatMessageRichTextEditContainerStyles();\n const chatMyMessageStyles = useChatMyMessageStyles();\n const locale = useLocale().strings;\n\n const setText = (newValue?: string): void => {\n setTextValue(newValue ?? '');\n };\n\n const textTooLongMessage =\n messageState === 'too long'\n ? _formatString(strings.editBoxTextLimit, { limitNumber: `${MAXIMUM_LENGTH_OF_MESSAGE}` })\n : undefined;\n\n const iconClassName = useCallback(\n (isHover: boolean) => {\n const color = isHover ? theme.palette.accent : theme.palette.neutralSecondary;\n return mergeStyles(richTextEditBoxActionButtonIcon, { color });\n },\n [theme.palette.accent, theme.palette.neutralSecondary]\n );\n\n const onRenderThemedCancelIcon = useCallback(\n (isHover: boolean) => {\n return onRenderCancelIcon(iconClassName(isHover));\n },\n [iconClassName]\n );\n\n const onRenderThemedSubmitIcon = useCallback(\n (isHover: boolean) => {\n return onRenderSubmitIcon(iconClassName(isHover));\n },\n [iconClassName]\n );\n\n /* @conditional-compile-remove(attachment-upload) */\n const hasMultipleAttachments = useMemo(() => {\n return doesMessageContainMultipleAttachments(message);\n }, [message]);\n\n const actionButtons = useMemo(() => {\n return (\n <Stack horizontal>\n <InputBoxButton\n className={richTextActionButtonsStyle}\n ariaLabel={strings.editBoxCancelButton}\n tooltipContent={strings.editBoxCancelButton}\n onRenderIcon={onRenderThemedCancelIcon}\n onClick={() => {\n onCancel && onCancel(message.messageId);\n }}\n id={'dismissIconWrapper'}\n data-testId={strings.editBoxCancelButton}\n />\n <InputBoxButton\n className={richTextActionButtonsStyle}\n ariaLabel={strings.editBoxSubmitButton}\n tooltipContent={strings.editBoxSubmitButton}\n onRenderIcon={onRenderThemedSubmitIcon}\n onClick={(e) => {\n // it's very important to pass an empty attachment here\n // so when user remvoes all attachments, UI can reflect it instantly\n // if you set it to undefined, the attachments pre-edited would still be there\n // until edit message event is received\n submitEnabled &&\n onSubmit(textValue, /* @conditional-compile-remove(attachment-upload) */ attachmentMetadata);\n e.stopPropagation();\n }}\n id={'submitIconWrapper'}\n data-testId={strings.editBoxSubmitButton}\n />\n </Stack>\n );\n }, [\n /* @conditional-compile-remove(attachment-upload) */\n attachmentMetadata,\n message.messageId,\n onCancel,\n onRenderThemedCancelIcon,\n onRenderThemedSubmitIcon,\n onSubmit,\n strings.editBoxCancelButton,\n strings.editBoxSubmitButton,\n submitEnabled,\n textValue\n ]);\n const richTextLocaleStrings = useMemo(() => {\n /* @conditional-compile-remove(rich-text-editor) */\n return { ...locale.richTextSendBox, ...strings };\n return locale.sendBox;\n }, [\n /* @conditional-compile-remove(rich-text-editor) */ locale.richTextSendBox,\n /* @conditional-compile-remove(rich-text-editor) */ strings,\n locale.sendBox\n ]);\n\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n const onCancelAttachmentUpload = useCallback((attachmentId: string) => {\n // edit box only capable of removing attachments\n // we need to expand attachment actions\n // if we want to support more actions e.g. add\n handleAttachmentAction({ type: 'remove', id: attachmentId });\n }, []);\n\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n const onRenderAttachmentUploads = useCallback(() => {\n return (\n <Stack className={attachmentUploadCardsStyles}>\n <FluentV9ThemeProvider v8Theme={theme}>\n <_AttachmentUploadCards\n attachments={attachmentMetadata}\n onCancelAttachmentUpload={onCancelAttachmentUpload}\n />\n </FluentV9ThemeProvider>\n </Stack>\n );\n }, [attachmentMetadata, onCancelAttachmentUpload, theme]);\n\n const getContent = (): JSX.Element => {\n return (\n <Stack className={mergeStyles(editBoxWidthStyles)}>\n <RichTextSendBoxErrors textTooLongMessage={textTooLongMessage} systemMessage={message.failureReason} />\n <RichTextInputBoxComponent\n placeholderText={strings.editBoxPlaceholderText}\n onChange={setText}\n editorComponentRef={editTextFieldRef}\n initialContent={message.content}\n content={textValue}\n strings={richTextLocaleStrings}\n disabled={false}\n actionComponents={actionButtons}\n richTextEditorStyleProps={editBoxRichTextEditorStyle}\n isHorizontalLayoutDisabled={true}\n /* @conditional-compile-remove(attachment-upload) */\n onRenderAttachmentUploads={onRenderAttachmentUploads}\n />\n </Stack>\n );\n };\n\n const attached = message.attached === true ? 'center' : message.attached === 'bottom' ? 'bottom' : 'top';\n return (\n <ChatMyMessage\n attached={attached}\n root={{\n className: mergeClasses(\n chatMyMessageStyles.root,\n /* @conditional-compile-remove(attachment-upload) */\n hasMultipleAttachments ? chatMyMessageStyles.multipleAttachments : undefined\n )\n }}\n body={{\n className: mergeClasses(\n editContainerStyles.body,\n attached !== 'top' ? editContainerStyles.bodyAttached : undefined\n )\n }}\n >\n {getContent()}\n </ChatMyMessage>\n );\n};\n\nexport default ChatMessageComponentAsRichTextEditBox;\n"]}
@@ -13,6 +13,8 @@ import { createStyleFromV8Style } from '../../styles/v8StyleShim';
13
13
  import { mergeClasses } from '@fluentui/react-components';
14
14
  import { useChatMyMessageStyles, useChatMessageCommonStyles } from '../../styles/MessageThread.styles';
15
15
  import { generateCustomizedTimestamp, generateDefaultTimestamp, getMessageBubbleContent, getMessageEditedDetails } from '../../utils/ChatMessageComponentUtils';
16
+ /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
17
+ import { doesMessageContainMultipleAttachments } from '../../utils/ChatMessageComponentAsEditBoxUtils';
16
18
  /** @private */
17
19
  const MessageBubble = (props) => {
18
20
  var _a;
@@ -68,6 +70,10 @@ const MessageBubble = (props) => {
68
70
  // or not we need to set the target to undefined here to actually hide the action flyout
69
71
  setChatMessageActionFlyoutTarget(undefined);
70
72
  }, [setChatMessageActionFlyoutTarget]);
73
+ /* @conditional-compile-remove(attachment-upload) */
74
+ const hasMultipleAttachments = useMemo(() => {
75
+ return doesMessageContainMultipleAttachments(message);
76
+ }, [message]);
71
77
  const getMessageDetails = useCallback(() => {
72
78
  if (messageStatus === 'failed') {
73
79
  return React.createElement("div", { className: chatMessageFailedTagStyle(theme) }, strings.failToSendTag);
@@ -105,7 +111,9 @@ const MessageBubble = (props) => {
105
111
  ? chatMessageCommonStyles.blocked
106
112
  : props.message.status === 'failed'
107
113
  ? chatMessageCommonStyles.failed
108
- : undefined, attached !== 'top' ? chatMyMessageStyles.bodyAttached : undefined, mergeStyles(messageContainerStyle)),
114
+ : undefined, attached !== 'top' ? chatMyMessageStyles.bodyAttached : undefined,
115
+ /* @conditional-compile-remove(attachment-upload) */
116
+ hasMultipleAttachments ? chatMyMessageStyles.multipleAttachments : undefined, mergeStyles(messageContainerStyle)),
109
117
  style: Object.assign({}, createStyleFromV8Style(messageContainerStyle)),
110
118
  ref: messageRef
111
119
  }, root: {
@@ -1 +1 @@
1
- {"version":3,"file":"ChatMyMessageComponentAsMessageBubble.js","sourceRoot":"","sources":["../../../../../../../../react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponentAsMessageBubble.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,MAAM,0CAA0C,CAAC;AAC3G,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,C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OAAO;oBACT,CAAC;oBACD,oEAAoE;oBACpE,gEAAgE;oBAChE,uCAAuC;oBACvC,yEAAyE;oBACzE,8DAA8D;oBAC9D,gCAAgC,CAAC,UAAU,CAAC,CAAC;oBAC7C,IAAI,OAAO,CAAC,WAAW,KAAK,MAAM,EAAE,CAAC;wBACnC,KAAK,CAAC,mBAAmB,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;oBACvD,CAAC;gBACH,CAAC,IAEA,UAAU,EAAE,CACC,CACZ;QACL,kBAAkB,IAAI,CACrB,oBAAC,uBAAuB,IACtB,MAAM,EAAE,CAAC,6BAA6B,EACtC,MAAM,EAAE,6BAA6B,EACrC,sBAAsB,EAAE,qBAAqB,EAC7C,SAAS,EAAE,qBAAqB,EAChC,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,aAAa,EAC5B,aAAa,EAAE,aAAa,EAC5B,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,aAAa,EAC5B,aAAa,EAAE,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,QAAQ,EACxC,uBAAuB,EAAE,uBAAuB,EAChD,cAAc,EAAE,cAAc,EAC9B,iBAAiB,EAAE,iBAAiB,GACpC,CACH,CACA,CACJ,CAAC;IACF,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC;AAEF,eAAe;AACf,MAAM,CAAC,MAAM,qCAAqC,GAAG,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { Text, mergeStyles } from '@fluentui/react';\nimport { ChatMyMessage } from '@fluentui-contrib/react-chat';\nimport { _formatString } from '@internal/acs-ui-common';\nimport React, { useCallback, useMemo, useRef, useState } from 'react';\nimport { chatMessageDateStyle, chatMessageFailedTagStyle } from '../../styles/ChatMessageComponent.styles';\nimport { useIdentifiers } from '../../../identifiers/IdentifierProvider';\nimport { useTheme } from '../../../theming';\nimport { ChatMessageActionFlyout } from '../ChatMessageActionsFlyout';\nimport { InlineImageOptions } from '../ChatMessageContent';\nimport { ChatMessage } from '../../../types/ChatMessage';\n/* @conditional-compile-remove(data-loss-prevention) */\nimport { BlockedMessage } from '../../../types/ChatMessage';\nimport { MessageThreadStrings } from '../../MessageThread';\nimport { chatMessageActionMenuProps } from '../ChatMessageActionMenu';\nimport { ComponentSlotStyle, OnRenderAvatarCallback } from '../../../types';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { AttachmentMenuAction } from '../../../types/Attachment';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { AttachmentMetadata } from '@internal/acs-ui-common';\nimport { _AttachmentDownloadCards } from '../../Attachment/AttachmentDownloadCards';\nimport { useLocale } from '../../../localization';\n/* @conditional-compile-remove(mention) */\nimport { MentionDisplayOptions } from '../../MentionPopover';\nimport { createStyleFromV8Style } from '../../styles/v8StyleShim';\nimport { mergeClasses } from '@fluentui/react-components';\nimport { useChatMyMessageStyles, useChatMessageCommonStyles } from '../../styles/MessageThread.styles';\nimport {\n generateCustomizedTimestamp,\n generateDefaultTimestamp,\n getMessageBubbleContent,\n getMessageEditedDetails\n} from '../../utils/ChatMessageComponentUtils';\n\ntype ChatMyMessageComponentAsMessageBubbleProps = {\n message: ChatMessage | /* @conditional-compile-remove(data-loss-prevention) */ BlockedMessage;\n messageContainerStyle?: ComponentSlotStyle;\n showDate?: boolean;\n disableEditing?: boolean;\n onEditClick: () => void;\n onRemoveClick?: () => void;\n onResendClick?: () => void;\n strings: MessageThreadStrings;\n userId: string;\n messageStatus?: string;\n /**\n * Whether the status indicator for each message is displayed or not.\n */\n showMessageStatus?: boolean;\n remoteParticipantsCount?: number;\n onActionButtonClick: (\n message: ChatMessage,\n setMessageReadBy: (readBy: { id: string; displayName: string }[]) => void\n ) => void;\n /**\n * Optional callback to override render of the avatar.\n *\n * @param userId - user Id\n */\n onRenderAvatar?: OnRenderAvatarCallback;\n\n /**\n * Optional function to provide customized date format.\n * @beta\n */\n onDisplayDateTimeString?: (messageDate: Date) => string;\n /* @conditional-compile-remove(mention) */\n /**\n * Optional props needed to display suggestions in the mention scenario.\n * @internal\n */\n mentionDisplayOptions?: MentionDisplayOptions;\n /**\n * Optional callback called when an inline image is clicked.\n * @beta\n */\n inlineImageOptions?: InlineImageOptions;\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n /**\n * Optional callback to render message attachments in the message component.\n */\n onRenderAttachmentDownloads?: (message: ChatMessage) => JSX.Element;\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n /**\n * Optional callback to define custom actions for attachments.\n */\n actionsForAttachment?: (attachment: AttachmentMetadata, message?: ChatMessage) => AttachmentMenuAction[];\n};\n\n/** @private */\nconst MessageBubble = (props: ChatMyMessageComponentAsMessageBubbleProps): JSX.Element => {\n const ids = useIdentifiers();\n const theme = useTheme();\n const locale = useLocale();\n\n const {\n userId,\n message,\n onRemoveClick,\n onResendClick,\n disableEditing,\n showDate,\n messageContainerStyle,\n strings,\n onEditClick,\n remoteParticipantsCount = 0,\n onRenderAvatar,\n showMessageStatus,\n messageStatus,\n inlineImageOptions,\n /* @conditional-compile-remove(mention) */\n mentionDisplayOptions,\n onDisplayDateTimeString,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n onRenderAttachmentDownloads,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n actionsForAttachment\n } = props;\n\n const formattedTimestamp = useMemo(() => {\n const defaultTimeStamp = message.createdOn\n ? generateDefaultTimestamp(message.createdOn, showDate, strings)\n : undefined;\n\n const customTimestamp = message.createdOn\n ? generateCustomizedTimestamp(message.createdOn, locale, onDisplayDateTimeString)\n : '';\n\n return customTimestamp || defaultTimeStamp;\n }, [locale, message.createdOn, onDisplayDateTimeString, showDate, strings]);\n\n // Track if the action menu was opened by touch - if so we increase the touch targets for the items\n const [wasInteractionByTouch, setWasInteractionByTouch] = useState(false);\n // `focused` state is used for show/hide actionMenu\n const [focused, setFocused] = React.useState<boolean>(false);\n\n // The chat message action flyout should target the Chat.Message action menu if clicked,\n // or target the chat message if opened via touch press.\n // Undefined indicates the flyout menu should not be being shown.\n const messageRef = useRef<HTMLDivElement | null>(null);\n const messageActionButtonRef = useRef<HTMLDivElement | null>(null);\n const [chatMessageActionFlyoutTarget, setChatMessageActionFlyoutTarget] = useState<\n React.MutableRefObject<HTMLElement | null> | undefined\n >(undefined);\n\n const chatActionsEnabled =\n !disableEditing &&\n message.status !== 'sending' &&\n !!message.mine &&\n /* @conditional-compile-remove(data-loss-prevention) */ message.messageType !== 'blocked';\n const [messageReadBy, setMessageReadBy] = useState<{ id: string; displayName: string }[]>([]);\n\n const actionMenuProps = chatMessageActionMenuProps({\n ariaLabel: strings.actionMenuMoreOptions ?? '',\n enabled: chatActionsEnabled,\n menuButtonRef: messageActionButtonRef,\n menuExpanded: chatMessageActionFlyoutTarget === messageActionButtonRef,\n onActionButtonClick: () => {\n if (message.messageType === 'chat') {\n props.onActionButtonClick(message, setMessageReadBy);\n setChatMessageActionFlyoutTarget(messageActionButtonRef);\n }\n },\n theme\n });\n\n const onActionFlyoutDismiss = useCallback((): void => {\n // When the flyout dismiss is called, since we control if the action flyout is visible\n // or not we need to set the target to undefined here to actually hide the action flyout\n setChatMessageActionFlyoutTarget(undefined);\n }, [setChatMessageActionFlyoutTarget]);\n\n const getMessageDetails = useCallback(() => {\n if (messageStatus === 'failed') {\n return <div className={chatMessageFailedTagStyle(theme)}>{strings.failToSendTag}</div>;\n } else {\n return getMessageEditedDetails(message, theme, strings.editedTag);\n }\n }, [message, messageStatus, strings.editedTag, strings.failToSendTag, theme]);\n\n const getContent = useCallback(() => {\n return getMessageBubbleContent(\n message,\n strings,\n userId,\n inlineImageOptions,\n /* @conditional-compile-remove(mention) */\n mentionDisplayOptions,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n onRenderAttachmentDownloads,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n actionsForAttachment\n );\n }, [\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */ actionsForAttachment,\n inlineImageOptions,\n /* @conditional-compile-remove(mention) */ mentionDisplayOptions,\n message,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */ onRenderAttachmentDownloads,\n strings,\n userId\n ]);\n\n const isBlockedMessage =\n false || /* @conditional-compile-remove(data-loss-prevention) */ message.messageType === 'blocked';\n const chatMyMessageStyles = useChatMyMessageStyles();\n const chatMessageCommonStyles = useChatMessageCommonStyles();\n\n const attached = message.attached === true ? 'center' : message.attached === 'bottom' ? 'bottom' : 'top';\n const chatMessage = (\n <>\n <div key={props.message.messageId}>\n <ChatMyMessage\n attached={attached}\n key={props.message.messageId}\n body={{\n // messageContainerStyle used in className and style prop as style prop can't handle CSS selectors\n className: mergeClasses(\n chatMessageCommonStyles.body,\n chatMyMessageStyles.body,\n isBlockedMessage\n ? chatMessageCommonStyles.blocked\n : props.message.status === 'failed'\n ? chatMessageCommonStyles.failed\n : undefined,\n attached !== 'top' ? chatMyMessageStyles.bodyAttached : undefined,\n mergeStyles(messageContainerStyle)\n ),\n style: { ...createStyleFromV8Style(messageContainerStyle) },\n ref: messageRef\n }}\n root={{\n className: chatMyMessageStyles.root,\n onBlur: (e) => {\n // `focused` controls is focused the whole `ChatMessage` or any of its children. When we're navigating\n // with keyboard the focused element will be changed and there is no way to use `:focus` selector\n if (chatMessageActionFlyoutTarget?.current) {\n // doesn't dismiss action button if flyout is open, otherwise, narrator's focus will stay on the closed action menu\n return;\n }\n const shouldPreserveFocusState = e.currentTarget.contains(e.relatedTarget);\n setFocused(shouldPreserveFocusState);\n },\n onFocus: () => {\n // react onFocus is called even when nested component receives focus (i.e. it bubbles)\n // so when focus moves within actionMenu, the `focus` state in chatMessage remains true, and keeps actionMenu visible\n setFocused(true);\n },\n // make body not focusable to remove repetitions from narrators.\n // inner components are already focusable\n role: 'none',\n tabIndex: -1\n }}\n data-ui-id=\"chat-composite-message\"\n author={\n <Text className={chatMessageDateStyle} tabIndex={0}>\n {message.senderDisplayName}\n </Text>\n }\n timestamp={\n <Text className={chatMessageDateStyle} data-ui-id={ids.messageTimestamp} tabIndex={0}>\n {formattedTimestamp}\n </Text>\n }\n details={getMessageDetails()}\n actions={{\n children: actionMenuProps?.children,\n className: mergeClasses(\n chatMyMessageStyles.menu,\n // Make actions menu visible when the message is focused or the flyout is shown\n focused || chatMessageActionFlyoutTarget?.current\n ? chatMyMessageStyles.menuVisible\n : chatMyMessageStyles.menuHidden,\n attached !== 'top' ? chatMyMessageStyles.menuAttached : undefined\n )\n }}\n onTouchStart={() => setWasInteractionByTouch(true)}\n onPointerDown={() => setWasInteractionByTouch(false)}\n onKeyDown={() => setWasInteractionByTouch(false)}\n onClick={() => {\n if (!wasInteractionByTouch) {\n return;\n }\n // If the message was touched via touch we immediately open the menu\n // flyout (when using mouse the 3-dot menu that appears on hover\n // must be clicked to open the flyout).\n // In doing so here we set the target of the flyout to be the message and\n // not the 3-dot menu button to position the flyout correctly.\n setChatMessageActionFlyoutTarget(messageRef);\n if (message.messageType === 'chat') {\n props.onActionButtonClick(message, setMessageReadBy);\n }\n }}\n >\n {getContent()}\n </ChatMyMessage>\n </div>\n {chatActionsEnabled && (\n <ChatMessageActionFlyout\n hidden={!chatMessageActionFlyoutTarget}\n target={chatMessageActionFlyoutTarget}\n increaseFlyoutItemSize={wasInteractionByTouch}\n onDismiss={onActionFlyoutDismiss}\n onEditClick={onEditClick}\n onRemoveClick={onRemoveClick}\n onResendClick={onResendClick}\n strings={strings}\n messageReadBy={messageReadBy}\n messageStatus={messageStatus ?? 'failed'}\n remoteParticipantsCount={remoteParticipantsCount}\n onRenderAvatar={onRenderAvatar}\n showMessageStatus={showMessageStatus}\n />\n )}\n </>\n );\n return chatMessage;\n};\n\n/** @private */\nexport const ChatMyMessageComponentAsMessageBubble = React.memo(MessageBubble);\n"]}
1
+ {"version":3,"file":"ChatMyMessageComponentAsMessageBubble.js","sourceRoot":"","sources":["../../../../../../../../react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponentAsMessageBubble.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,MAAM,0CAA0C,CAAC;AAC3G,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAMtE,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAOtE,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAGlD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AACvG,OAAO,EACL,2BAA2B,EAC3B,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,uCAAuC,CAAC;AAC/C,qGAAqG;AACrG,OAAO,EAAE,qCAAqC,EAAE,MAAM,gDAAgD,CAAC;AAyDvG,eAAe;AACf,MAAM,aAAa,GAAG,CAAC,KAAiD,EAAe,EAAE;;IACvF,MAAM,GAAG,GAAG,cAAc,EAAE,CAAC;IAC7B,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,MAAM,MAAM,GAAG,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AAE,CACC,CACZ;QACL,kBAAkB,IAAI,CACrB,oBAAC,uBAAuB,IACtB,MAAM,EAAE,CAAC,6BAA6B,EACtC,MAAM,EAAE,6BAA6B,EACrC,sBAAsB,EAAE,qBAAqB,EAC7C,SAAS,EAAE,qBAAqB,EAChC,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,aAAa,EAC5B,aAAa,EAAE,aAAa,EAC5B,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,aAAa,EAC5B,aAAa,EAAE,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,QAAQ,EACxC,uBAAuB,EAAE,uBAAuB,EAChD,cAAc,EAAE,cAAc,EAC9B,iBAAiB,EAAE,iBAAiB,GACpC,CACH,CACA,CACJ,CAAC;IACF,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC;AAEF,eAAe;AACf,MAAM,CAAC,MAAM,qCAAqC,GAAG,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { Text, mergeStyles } from '@fluentui/react';\nimport { ChatMyMessage } from '@fluentui-contrib/react-chat';\nimport { _formatString } from '@internal/acs-ui-common';\nimport React, { useCallback, useMemo, useRef, useState } from 'react';\nimport { chatMessageDateStyle, chatMessageFailedTagStyle } from '../../styles/ChatMessageComponent.styles';\nimport { useIdentifiers } from '../../../identifiers/IdentifierProvider';\nimport { useTheme } from '../../../theming';\nimport { ChatMessageActionFlyout } from '../ChatMessageActionsFlyout';\nimport { InlineImageOptions } from '../ChatMessageContent';\nimport { ChatMessage } from '../../../types/ChatMessage';\n/* @conditional-compile-remove(data-loss-prevention) */\nimport { BlockedMessage } from '../../../types/ChatMessage';\nimport { MessageThreadStrings } from '../../MessageThread';\nimport { chatMessageActionMenuProps } from '../ChatMessageActionMenu';\nimport { ComponentSlotStyle, OnRenderAvatarCallback } from '../../../types';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { AttachmentMenuAction } from '../../../types/Attachment';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { AttachmentMetadata } from '@internal/acs-ui-common';\nimport { _AttachmentDownloadCards } from '../../Attachment/AttachmentDownloadCards';\nimport { useLocale } from '../../../localization';\n/* @conditional-compile-remove(mention) */\nimport { MentionDisplayOptions } from '../../MentionPopover';\nimport { createStyleFromV8Style } from '../../styles/v8StyleShim';\nimport { mergeClasses } from '@fluentui/react-components';\nimport { useChatMyMessageStyles, useChatMessageCommonStyles } from '../../styles/MessageThread.styles';\nimport {\n generateCustomizedTimestamp,\n generateDefaultTimestamp,\n getMessageBubbleContent,\n getMessageEditedDetails\n} from '../../utils/ChatMessageComponentUtils';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { doesMessageContainMultipleAttachments } from '../../utils/ChatMessageComponentAsEditBoxUtils';\n\ntype ChatMyMessageComponentAsMessageBubbleProps = {\n message: ChatMessage | /* @conditional-compile-remove(data-loss-prevention) */ BlockedMessage;\n messageContainerStyle?: ComponentSlotStyle;\n showDate?: boolean;\n disableEditing?: boolean;\n onEditClick: () => void;\n onRemoveClick?: () => void;\n onResendClick?: () => void;\n strings: MessageThreadStrings;\n userId: string;\n messageStatus?: string;\n /**\n * Whether the status indicator for each message is displayed or not.\n */\n showMessageStatus?: boolean;\n remoteParticipantsCount?: number;\n onActionButtonClick: (\n message: ChatMessage,\n setMessageReadBy: (readBy: { id: string; displayName: string }[]) => void\n ) => void;\n /**\n * Optional callback to override render of the avatar.\n *\n * @param userId - user Id\n */\n onRenderAvatar?: OnRenderAvatarCallback;\n\n /**\n * Optional function to provide customized date format.\n * @beta\n */\n onDisplayDateTimeString?: (messageDate: Date) => string;\n /* @conditional-compile-remove(mention) */\n /**\n * Optional props needed to display suggestions in the mention scenario.\n * @internal\n */\n mentionDisplayOptions?: MentionDisplayOptions;\n /**\n * Optional callback called when an inline image is clicked.\n * @beta\n */\n inlineImageOptions?: InlineImageOptions;\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n /**\n * Optional callback to render message attachments in the message component.\n */\n onRenderAttachmentDownloads?: (message: ChatMessage) => JSX.Element;\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n /**\n * Optional callback to define custom actions for attachments.\n */\n actionsForAttachment?: (attachment: AttachmentMetadata, message?: ChatMessage) => AttachmentMenuAction[];\n};\n\n/** @private */\nconst MessageBubble = (props: ChatMyMessageComponentAsMessageBubbleProps): JSX.Element => {\n const ids = useIdentifiers();\n const theme = useTheme();\n const locale = useLocale();\n\n const {\n userId,\n message,\n onRemoveClick,\n onResendClick,\n disableEditing,\n showDate,\n messageContainerStyle,\n strings,\n onEditClick,\n remoteParticipantsCount = 0,\n onRenderAvatar,\n showMessageStatus,\n messageStatus,\n inlineImageOptions,\n /* @conditional-compile-remove(mention) */\n mentionDisplayOptions,\n onDisplayDateTimeString,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n onRenderAttachmentDownloads,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n actionsForAttachment\n } = props;\n\n const formattedTimestamp = useMemo(() => {\n const defaultTimeStamp = message.createdOn\n ? generateDefaultTimestamp(message.createdOn, showDate, strings)\n : undefined;\n\n const customTimestamp = message.createdOn\n ? generateCustomizedTimestamp(message.createdOn, locale, onDisplayDateTimeString)\n : '';\n\n return customTimestamp || defaultTimeStamp;\n }, [locale, message.createdOn, onDisplayDateTimeString, showDate, strings]);\n\n // Track if the action menu was opened by touch - if so we increase the touch targets for the items\n const [wasInteractionByTouch, setWasInteractionByTouch] = useState(false);\n // `focused` state is used for show/hide actionMenu\n const [focused, setFocused] = React.useState<boolean>(false);\n\n // The chat message action flyout should target the Chat.Message action menu if clicked,\n // or target the chat message if opened via touch press.\n // Undefined indicates the flyout menu should not be being shown.\n const messageRef = useRef<HTMLDivElement | null>(null);\n const messageActionButtonRef = useRef<HTMLDivElement | null>(null);\n const [chatMessageActionFlyoutTarget, setChatMessageActionFlyoutTarget] = useState<\n React.MutableRefObject<HTMLElement | null> | undefined\n >(undefined);\n\n const chatActionsEnabled =\n !disableEditing &&\n message.status !== 'sending' &&\n !!message.mine &&\n /* @conditional-compile-remove(data-loss-prevention) */ message.messageType !== 'blocked';\n const [messageReadBy, setMessageReadBy] = useState<{ id: string; displayName: string }[]>([]);\n\n const actionMenuProps = chatMessageActionMenuProps({\n ariaLabel: strings.actionMenuMoreOptions ?? '',\n enabled: chatActionsEnabled,\n menuButtonRef: messageActionButtonRef,\n menuExpanded: chatMessageActionFlyoutTarget === messageActionButtonRef,\n onActionButtonClick: () => {\n if (message.messageType === 'chat') {\n props.onActionButtonClick(message, setMessageReadBy);\n setChatMessageActionFlyoutTarget(messageActionButtonRef);\n }\n },\n theme\n });\n\n const onActionFlyoutDismiss = useCallback((): void => {\n // When the flyout dismiss is called, since we control if the action flyout is visible\n // or not we need to set the target to undefined here to actually hide the action flyout\n setChatMessageActionFlyoutTarget(undefined);\n }, [setChatMessageActionFlyoutTarget]);\n\n /* @conditional-compile-remove(attachment-upload) */\n const hasMultipleAttachments = useMemo(() => {\n return doesMessageContainMultipleAttachments(message as ChatMessage);\n }, [message]);\n\n const getMessageDetails = useCallback(() => {\n if (messageStatus === 'failed') {\n return <div className={chatMessageFailedTagStyle(theme)}>{strings.failToSendTag}</div>;\n } else {\n return getMessageEditedDetails(message, theme, strings.editedTag);\n }\n }, [message, messageStatus, strings.editedTag, strings.failToSendTag, theme]);\n\n const getContent = useCallback(() => {\n return getMessageBubbleContent(\n message,\n strings,\n userId,\n inlineImageOptions,\n /* @conditional-compile-remove(mention) */\n mentionDisplayOptions,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n onRenderAttachmentDownloads,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n actionsForAttachment\n );\n }, [\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */ actionsForAttachment,\n inlineImageOptions,\n /* @conditional-compile-remove(mention) */ mentionDisplayOptions,\n message,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */ onRenderAttachmentDownloads,\n strings,\n userId\n ]);\n\n const isBlockedMessage =\n false || /* @conditional-compile-remove(data-loss-prevention) */ message.messageType === 'blocked';\n const chatMyMessageStyles = useChatMyMessageStyles();\n const chatMessageCommonStyles = useChatMessageCommonStyles();\n\n const attached = message.attached === true ? 'center' : message.attached === 'bottom' ? 'bottom' : 'top';\n const chatMessage = (\n <>\n <div key={props.message.messageId}>\n <ChatMyMessage\n attached={attached}\n key={props.message.messageId}\n body={{\n // messageContainerStyle used in className and style prop as style prop can't handle CSS selectors\n className: mergeClasses(\n chatMessageCommonStyles.body,\n chatMyMessageStyles.body,\n isBlockedMessage\n ? chatMessageCommonStyles.blocked\n : props.message.status === 'failed'\n ? chatMessageCommonStyles.failed\n : undefined,\n attached !== 'top' ? chatMyMessageStyles.bodyAttached : undefined,\n /* @conditional-compile-remove(attachment-upload) */\n hasMultipleAttachments ? chatMyMessageStyles.multipleAttachments : undefined,\n mergeStyles(messageContainerStyle)\n ),\n style: { ...createStyleFromV8Style(messageContainerStyle) },\n ref: messageRef\n }}\n root={{\n className: chatMyMessageStyles.root,\n onBlur: (e) => {\n // `focused` controls is focused the whole `ChatMessage` or any of its children. When we're navigating\n // with keyboard the focused element will be changed and there is no way to use `:focus` selector\n if (chatMessageActionFlyoutTarget?.current) {\n // doesn't dismiss action button if flyout is open, otherwise, narrator's focus will stay on the closed action menu\n return;\n }\n const shouldPreserveFocusState = e.currentTarget.contains(e.relatedTarget);\n setFocused(shouldPreserveFocusState);\n },\n onFocus: () => {\n // react onFocus is called even when nested component receives focus (i.e. it bubbles)\n // so when focus moves within actionMenu, the `focus` state in chatMessage remains true, and keeps actionMenu visible\n setFocused(true);\n },\n // make body not focusable to remove repetitions from narrators.\n // inner components are already focusable\n role: 'none',\n tabIndex: -1\n }}\n data-ui-id=\"chat-composite-message\"\n author={\n <Text className={chatMessageDateStyle} tabIndex={0}>\n {message.senderDisplayName}\n </Text>\n }\n timestamp={\n <Text className={chatMessageDateStyle} data-ui-id={ids.messageTimestamp} tabIndex={0}>\n {formattedTimestamp}\n </Text>\n }\n details={getMessageDetails()}\n actions={{\n children: actionMenuProps?.children,\n className: mergeClasses(\n chatMyMessageStyles.menu,\n // Make actions menu visible when the message is focused or the flyout is shown\n focused || chatMessageActionFlyoutTarget?.current\n ? chatMyMessageStyles.menuVisible\n : chatMyMessageStyles.menuHidden,\n attached !== 'top' ? chatMyMessageStyles.menuAttached : undefined\n )\n }}\n onTouchStart={() => setWasInteractionByTouch(true)}\n onPointerDown={() => setWasInteractionByTouch(false)}\n onKeyDown={() => setWasInteractionByTouch(false)}\n onClick={() => {\n if (!wasInteractionByTouch) {\n return;\n }\n // If the message was touched via touch we immediately open the menu\n // flyout (when using mouse the 3-dot menu that appears on hover\n // must be clicked to open the flyout).\n // In doing so here we set the target of the flyout to be the message and\n // not the 3-dot menu button to position the flyout correctly.\n setChatMessageActionFlyoutTarget(messageRef);\n if (message.messageType === 'chat') {\n props.onActionButtonClick(message, setMessageReadBy);\n }\n }}\n >\n {getContent()}\n </ChatMyMessage>\n </div>\n {chatActionsEnabled && (\n <ChatMessageActionFlyout\n hidden={!chatMessageActionFlyoutTarget}\n target={chatMessageActionFlyoutTarget}\n increaseFlyoutItemSize={wasInteractionByTouch}\n onDismiss={onActionFlyoutDismiss}\n onEditClick={onEditClick}\n onRemoveClick={onRemoveClick}\n onResendClick={onResendClick}\n strings={strings}\n messageReadBy={messageReadBy}\n messageStatus={messageStatus ?? 'failed'}\n remoteParticipantsCount={remoteParticipantsCount}\n onRenderAvatar={onRenderAvatar}\n showMessageStatus={showMessageStatus}\n />\n )}\n </>\n );\n return chatMessage;\n};\n\n/** @private */\nexport const ChatMyMessageComponentAsMessageBubble = React.memo(MessageBubble);\n"]}
@@ -7,10 +7,10 @@ interface ErrorBoundaryState {
7
7
  hasError: boolean;
8
8
  }
9
9
  /**
10
- * @private
10
+ * @internal
11
11
  * ErrorBoundary component to handle errors in React components.
12
12
  */
13
- export declare class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {
13
+ export declare class _ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {
14
14
  constructor(props: ErrorBoundaryProps);
15
15
  static getDerivedStateFromError(): ErrorBoundaryState;
16
16
  componentDidCatch(error: Error): void;
@@ -2,10 +2,10 @@
2
2
  // Licensed under the MIT License.
3
3
  import React from 'react';
4
4
  /**
5
- * @private
5
+ * @internal
6
6
  * ErrorBoundary component to handle errors in React components.
7
7
  */
8
- export class ErrorBoundary extends React.Component {
8
+ export class _ErrorBoundary extends React.Component {
9
9
  constructor(props) {
10
10
  super(props);
11
11
  this.state = { hasError: false };
@@ -1 +1 @@
1
- {"version":3,"file":"ErrorBoundary.js","sourceRoot":"","sources":["../../../../../../react-components/src/components/ErrorBoundary.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,KAAoB,MAAM,OAAO,CAAC;AAWzC;;;GAGG;AACH,MAAM,OAAO,aAAc,SAAQ,KAAK,CAAC,SAAiD;IACxF,YAAY,KAAyB;QACnC,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,KAAK,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IACnC,CAAC;IAED,MAAM,CAAC,wBAAwB;QAC7B,6DAA6D;QAC7D,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC5B,CAAC;IAED,iBAAiB,CAAC,KAAY;QAC5B,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;IAED,MAAM;QACJ,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;YACxB,eAAe;YACf,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;QAC7B,CAAC;QACD,4BAA4B;QAC5B,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;IAC7B,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport React, { ReactNode } from 'react';\n\ninterface ErrorBoundaryProps {\n fallback: ReactNode;\n children: ReactNode;\n}\n\ninterface ErrorBoundaryState {\n hasError: boolean;\n}\n\n/**\n * @private\n * ErrorBoundary component to handle errors in React components.\n */\nexport class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {\n constructor(props: ErrorBoundaryProps) {\n super(props);\n this.state = { hasError: false };\n }\n\n static getDerivedStateFromError(): ErrorBoundaryState {\n // Update state so the next render will show the fallback UI.\n return { hasError: true };\n }\n\n componentDidCatch(error: Error): void {\n console.error(error);\n }\n\n render(): ReactNode {\n if (this.state.hasError) {\n // handle error\n return this.props.fallback;\n }\n // otherwise render children\n return this.props.children;\n }\n}\n"]}
1
+ {"version":3,"file":"ErrorBoundary.js","sourceRoot":"","sources":["../../../../../../react-components/src/components/ErrorBoundary.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,KAAoB,MAAM,OAAO,CAAC;AAWzC;;;GAGG;AACH,MAAM,OAAO,cAAe,SAAQ,KAAK,CAAC,SAAiD;IACzF,YAAY,KAAyB;QACnC,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,KAAK,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IACnC,CAAC;IAED,MAAM,CAAC,wBAAwB;QAC7B,6DAA6D;QAC7D,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC5B,CAAC;IAED,iBAAiB,CAAC,KAAY;QAC5B,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;IAED,MAAM;QACJ,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;YACxB,eAAe;YACf,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;QAC7B,CAAC;QACD,4BAA4B;QAC5B,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;IAC7B,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport React, { ReactNode } from 'react';\n\ninterface ErrorBoundaryProps {\n fallback: ReactNode;\n children: ReactNode;\n}\n\ninterface ErrorBoundaryState {\n hasError: boolean;\n}\n\n/**\n * @internal\n * ErrorBoundary component to handle errors in React components.\n */\nexport class _ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {\n constructor(props: ErrorBoundaryProps) {\n super(props);\n this.state = { hasError: false };\n }\n\n static getDerivedStateFromError(): ErrorBoundaryState {\n // Update state so the next render will show the fallback UI.\n return { hasError: true };\n }\n\n componentDidCatch(error: Error): void {\n console.error(error);\n }\n\n render(): ReactNode {\n if (this.state.hasError) {\n // handle error\n return this.props.fallback;\n }\n // otherwise render children\n return this.props.children;\n }\n}\n"]}