@azure/communication-react 1.14.1-alpha-202403290012 → 1.15.0-alpha-202404030013
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/communication-react.d.ts +125 -218
- package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-CH6WvEGZ.js → RichTextSendBoxWrapper-B8qxZi1I.js} +2 -2
- package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-CH6WvEGZ.js.map → RichTextSendBoxWrapper-B8qxZi1I.js.map} +1 -1
- package/dist/dist-cjs/communication-react/{index-qxnuqL7s.js → index-aOBAWcNI.js} +1018 -874
- package/dist/dist-cjs/communication-react/index-aOBAWcNI.js.map +1 -0
- package/dist/dist-cjs/communication-react/index.js +2 -1
- package/dist/dist-cjs/communication-react/index.js.map +1 -1
- package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
- package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/CallClientState.d.ts +4 -4
- package/dist/dist-esm/calling-stateful-client/src/CallClientState.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/CallContext.d.ts +4 -0
- package/dist/dist-esm/calling-stateful-client/src/CallContext.js +6 -1
- package/dist/dist-esm/calling-stateful-client/src/CallContext.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/ReactionSubscriber.d.ts +1 -1
- package/dist/dist-esm/calling-stateful-client/src/ReactionSubscriber.js +2 -2
- package/dist/dist-esm/calling-stateful-client/src/ReactionSubscriber.js.map +1 -1
- package/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.js +20 -20
- package/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.js.map +1 -1
- package/dist/dist-esm/communication-react/src/index.d.ts +2 -2
- package/dist/dist-esm/communication-react/src/index.js +2 -0
- package/dist/dist-esm/communication-react/src/index.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/AttachmentCard.d.ts +0 -4
- package/dist/dist-esm/react-components/src/components/AttachmentCard.js +4 -1
- package/dist/dist-esm/react-components/src/components/AttachmentCard.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/AttachmentUploadCards.d.ts +5 -36
- package/dist/dist-esm/react-components/src/components/AttachmentUploadCards.js +17 -26
- package/dist/dist-esm/react-components/src/components/AttachmentUploadCards.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsEditBox.js +6 -10
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsEditBox.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsRichTextEditBox.js +2 -2
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsRichTextEditBox.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/EndCallButton.d.ts +10 -1
- package/dist/dist-esm/react-components/src/components/EndCallButton.js +93 -51
- package/dist/dist-esm/react-components/src/components/EndCallButton.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ReactionButton.d.ts +2 -2
- package/dist/dist-esm/react-components/src/components/ReactionButton.js +12 -15
- package/dist/dist-esm/react-components/src/components/ReactionButton.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextInputBoxComponent.d.ts +2 -2
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextInputBoxComponent.js +6 -6
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextInputBoxComponent.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.d.ts +6 -6
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.js +25 -25
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/SendBox.d.ts +6 -6
- package/dist/dist-esm/react-components/src/components/SendBox.js +18 -18
- package/dist/dist-esm/react-components/src/components/SendBox.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoEffects/VideoBackgroundEffectsPicker.d.ts +8 -0
- package/dist/dist-esm/react-components/src/components/VideoEffects/VideoBackgroundEffectsPicker.js +1 -1
- package/dist/dist-esm/react-components/src/components/VideoEffects/VideoBackgroundEffectsPicker.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery/ParticipantVideoTileOverlay.js +8 -4
- package/dist/dist-esm/react-components/src/components/VideoGallery/ParticipantVideoTileOverlay.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery/RemoteContentShareReactionOverlay.js +4 -4
- package/dist/dist-esm/react-components/src/components/VideoGallery/RemoteContentShareReactionOverlay.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery/utils/videoGalleryLayoutUtils.d.ts +4 -0
- package/dist/dist-esm/react-components/src/components/VideoGallery/utils/videoGalleryLayoutUtils.js +22 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery/utils/videoGalleryLayoutUtils.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/index.d.ts +1 -2
- package/dist/dist-esm/react-components/src/components/index.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/styles/ReactionButton.styles.d.ts +3 -3
- package/dist/dist-esm/react-components/src/components/styles/ReactionButton.styles.js +16 -9
- package/dist/dist-esm/react-components/src/components/styles/ReactionButton.styles.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/styles/ReactionOverlay.style.d.ts +2 -1
- package/dist/dist-esm/react-components/src/components/styles/ReactionOverlay.style.js +10 -12
- package/dist/dist-esm/react-components/src/components/styles/ReactionOverlay.style.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/styles/SendBox.styles.d.ts +1 -1
- package/dist/dist-esm/react-components/src/components/styles/SendBox.styles.js +2 -2
- package/dist/dist-esm/react-components/src/components/styles/SendBox.styles.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/styles/VideoTile.styles.d.ts +1 -0
- package/dist/dist-esm/react-components/src/components/styles/VideoTile.styles.js +3 -1
- package/dist/dist-esm/react-components/src/components/styles/VideoTile.styles.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentAsEditBoxUtils.d.ts +1 -1
- package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentAsEditBoxUtils.js +2 -2
- package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentAsEditBoxUtils.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentUtils.js +4 -3
- package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentUtils.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.d.ts +3 -3
- package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.js +7 -7
- package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/utils/common.d.ts +1 -1
- package/dist/dist-esm/react-components/src/components/utils/common.js +1 -1
- package/dist/dist-esm/react-components/src/components/utils/common.js.map +1 -1
- package/dist/dist-esm/react-components/src/localization/LocalizationProvider.js.map +1 -1
- package/dist/dist-esm/react-components/src/localization/locales/en-US/strings.json +3 -1
- package/dist/dist-esm/react-components/src/types/Attachment.d.ts +22 -95
- package/dist/dist-esm/react-components/src/types/Attachment.js.map +1 -1
- package/dist/dist-esm/react-components/src/types/ChatMessage.d.ts +2 -2
- package/dist/dist-esm/react-components/src/types/ChatMessage.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/Strings.d.ts +24 -0
- package/dist/dist-esm/react-composites/src/composites/CallComposite/Strings.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallArrangement.js +3 -4
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallArrangement.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/Prompt.js +0 -7
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/Prompt.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/EndCall.d.ts +2 -0
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/EndCall.js +66 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/EndCall.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/CallPage.js +1 -3
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/CallPage.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.d.ts +2 -2
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.js +3 -3
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.d.ts +8 -8
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js +21 -21
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatAdapter.d.ts +8 -8
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.d.ts +8 -8
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.js +15 -15
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/state/CallWithChatAdapterState.d.ts +3 -3
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/state/CallWithChatAdapterState.js +2 -2
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/state/CallWithChatAdapterState.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatComposite.d.ts +2 -2
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatComposite.js +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatComposite.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.d.ts +2 -33
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js +26 -18
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/Strings.d.ts +2 -2
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/Strings.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationAttachmentUploadAdapter.d.ts +47 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationAttachmentUploadAdapter.js +179 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationAttachmentUploadAdapter.js.map +1 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.d.ts +9 -9
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js +30 -30
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapter.d.ts +5 -5
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapterProvider.d.ts +2 -2
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapterProvider.js +8 -8
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapterProvider.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/{FileUpload.d.ts → AttachmentUpload.d.ts} +11 -11
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/{FileUpload.js → AttachmentUpload.js} +13 -13
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUpload.js.map +1 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUploadButton.d.ts +38 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/{FileUploadButton.js → AttachmentUploadButton.js} +14 -12
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUploadButton.js.map +1 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/index.d.ts +4 -4
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/index.js +2 -2
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/index.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/index.d.ts +2 -3
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/index.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/attachmentUploadsSelector.d.ts +29 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/attachmentUploadsSelector.js +12 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/attachmentUploadsSelector.js.map +1 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/baseSelectors.d.ts +2 -2
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/baseSelectors.js +2 -2
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/baseSelectors.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/ControlBar/CommonCallControlBar.js +26 -9
- package/dist/dist-esm/react-composites/src/composites/common/ControlBar/CommonCallControlBar.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/Drawer/MoreDrawer.js +6 -2
- package/dist/dist-esm/react-composites/src/composites/common/Drawer/MoreDrawer.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/SendBox.js +5 -5
- package/dist/dist-esm/react-composites/src/composites/common/SendBox.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/types/CommonCallControlOptions.d.ts +8 -2
- package/dist/dist-esm/react-composites/src/composites/common/types/CommonCallControlOptions.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/utils.d.ts +4 -0
- package/dist/dist-esm/react-composites/src/composites/common/utils.js +6 -0
- package/dist/dist-esm/react-composites/src/composites/common/utils.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/ar-SA/strings.json +1 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/cs-CZ/strings.json +1 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/de-DE/strings.json +1 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/en-GB/strings.json +1 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/en-US/strings.json +7 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/es-ES/strings.json +1 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/fi-FI/strings.json +1 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/fr-FR/strings.json +1 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/he-IL/strings.json +1 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/it-IT/strings.json +1 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/ja-JP/strings.json +1 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/ko-KR/strings.json +1 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/nb-NO/strings.json +1 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/nl-NL/strings.json +1 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/pl-PL/strings.json +1 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/pt-BR/strings.json +1 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/ru-RU/strings.json +1 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/sv-SE/strings.json +1 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/tr-TR/strings.json +1 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/zh-CN/strings.json +1 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/zh-TW/strings.json +1 -1
- package/package.json +7 -7
- package/dist/dist-cjs/communication-react/index-qxnuqL7s.js.map +0 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationFileUploadAdapter.d.ts +0 -48
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationFileUploadAdapter.js +0 -160
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationFileUploadAdapter.js.map +0 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/FileUpload.js.map +0 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/FileUploadButton.d.ts +0 -36
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/FileUploadButton.js.map +0 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/fileUploadsSelector.d.ts +0 -27
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/fileUploadsSelector.js +0 -12
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/fileUploadsSelector.js.map +0 -1
@@ -13,7 +13,7 @@ import { richTextActionButtonsStyle, sendBoxRichTextEditorStyle } from '../style
|
|
13
13
|
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
|
14
14
|
import { _AttachmentUploadCards } from '../AttachmentUploadCards';
|
15
15
|
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
|
16
|
-
import {
|
16
|
+
import { hasCompletedAttachmentUploads, hasIncompleteAttachmentUploads } from '../utils/SendBoxUtils';
|
17
17
|
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
|
18
18
|
import { attachmentUploadCardsStyles } from '../styles/SendBox.styles';
|
19
19
|
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
|
@@ -26,9 +26,9 @@ import { FluentV9ThemeProvider } from '../../theming/FluentV9ThemeProvider';
|
|
26
26
|
export const RichTextSendBox = (props) => {
|
27
27
|
const { disabled = false, systemMessage, onSendMessage,
|
28
28
|
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
|
29
|
-
|
29
|
+
activeAttachmentUploads,
|
30
30
|
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
|
31
|
-
|
31
|
+
onCancelAttachmentUpload } = props;
|
32
32
|
const theme = useTheme();
|
33
33
|
const locale = useLocale();
|
34
34
|
const localeStrings = useMemo(() => {
|
@@ -42,7 +42,7 @@ export const RichTextSendBox = (props) => {
|
|
42
42
|
const [contentValue, setContentValue] = useState('');
|
43
43
|
const [contentValueOverflow, setContentValueOverflow] = useState(false);
|
44
44
|
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
|
45
|
-
const [attachmentUploadsPendingError,
|
45
|
+
const [attachmentUploadsPendingError, setAttachmentUploadsPendingError] = useState(undefined);
|
46
46
|
const editorComponentRef = useRef(null);
|
47
47
|
const contentTooLongMessage = useMemo(() => (contentValueOverflow ? strings.textTooLong : undefined), [contentValueOverflow, strings.textTooLong]);
|
48
48
|
const setContent = useCallback((newValue) => {
|
@@ -57,19 +57,19 @@ export const RichTextSendBox = (props) => {
|
|
57
57
|
if (disabled || contentValueOverflow) {
|
58
58
|
return;
|
59
59
|
}
|
60
|
-
// Don't send message until all
|
60
|
+
// Don't send message until all attachments have been uploaded successfully
|
61
61
|
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
|
62
|
-
|
62
|
+
setAttachmentUploadsPendingError(undefined);
|
63
63
|
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
|
64
|
-
if (
|
65
|
-
|
64
|
+
if (hasIncompleteAttachmentUploads(activeAttachmentUploads)) {
|
65
|
+
setAttachmentUploadsPendingError({ message: strings.attachmentUploadsPendingError, timestamp: Date.now() });
|
66
66
|
return;
|
67
67
|
}
|
68
68
|
const message = contentValue;
|
69
69
|
// we don't want to send empty messages including spaces, newlines, tabs
|
70
|
-
// Message can be empty if there is a valid
|
70
|
+
// Message can be empty if there is a valid attachment upload
|
71
71
|
if (sanitizeText(message).length > 0 ||
|
72
|
-
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
|
72
|
+
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */ hasCompletedAttachmentUploads(activeAttachmentUploads)) {
|
73
73
|
onSendMessage(message);
|
74
74
|
setContentValue('');
|
75
75
|
(_a = editorComponentRef.current) === null || _a === void 0 ? void 0 : _a.setEmptyContent();
|
@@ -80,7 +80,7 @@ export const RichTextSendBox = (props) => {
|
|
80
80
|
contentValueOverflow,
|
81
81
|
disabled,
|
82
82
|
onSendMessage,
|
83
|
-
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
|
83
|
+
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */ activeAttachmentUploads,
|
84
84
|
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */ strings.attachmentUploadsPendingError
|
85
85
|
]);
|
86
86
|
const hasErrorMessage = useMemo(() => {
|
@@ -90,10 +90,10 @@ export const RichTextSendBox = (props) => {
|
|
90
90
|
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
|
91
91
|
!!attachmentUploadsPendingError ||
|
92
92
|
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
|
93
|
-
!!((_a =
|
93
|
+
!!((_a = activeAttachmentUploads === null || activeAttachmentUploads === void 0 ? void 0 : activeAttachmentUploads.filter((attachmentUpload) => attachmentUpload.uploadError).pop()) === null || _a === void 0 ? void 0 : _a.uploadError));
|
94
94
|
}, [
|
95
95
|
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
|
96
|
-
|
96
|
+
activeAttachmentUploads,
|
97
97
|
contentTooLongMessage,
|
98
98
|
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
|
99
99
|
attachmentUploadsPendingError,
|
@@ -103,7 +103,7 @@ export const RichTextSendBox = (props) => {
|
|
103
103
|
theme,
|
104
104
|
hasText: !!contentValue,
|
105
105
|
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
|
106
|
-
|
106
|
+
hasAttachment: false,
|
107
107
|
hasErrorMessage: hasErrorMessage,
|
108
108
|
defaultTextColor: theme.palette.neutralSecondary,
|
109
109
|
disabled: disabled
|
@@ -114,30 +114,30 @@ export const RichTextSendBox = (props) => {
|
|
114
114
|
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
|
115
115
|
attachmentUploadsPendingError: attachmentUploadsPendingError,
|
116
116
|
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
|
117
|
-
attachmentUploadError: (_a =
|
117
|
+
attachmentUploadError: (_a = activeAttachmentUploads === null || activeAttachmentUploads === void 0 ? void 0 : activeAttachmentUploads.filter((attachmentUpload) => attachmentUpload.uploadError).pop()) === null || _a === void 0 ? void 0 : _a.uploadError,
|
118
118
|
systemMessage: systemMessage,
|
119
119
|
textTooLongMessage: contentTooLongMessage
|
120
120
|
};
|
121
121
|
}, [
|
122
122
|
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
|
123
|
-
|
123
|
+
activeAttachmentUploads,
|
124
124
|
contentTooLongMessage,
|
125
125
|
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
|
126
126
|
attachmentUploadsPendingError,
|
127
127
|
systemMessage
|
128
128
|
]);
|
129
129
|
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
|
130
|
-
const
|
130
|
+
const onRenderAttachmentUploads = useCallback(() => {
|
131
131
|
return (React.createElement(Stack, { className: attachmentUploadCardsStyles },
|
132
132
|
React.createElement(FluentV9ThemeProvider, { v8Theme: theme },
|
133
|
-
React.createElement(_AttachmentUploadCards, {
|
133
|
+
React.createElement(_AttachmentUploadCards, { activeAttachmentUploads: activeAttachmentUploads, onCancelAttachmentUpload: onCancelAttachmentUpload, strings: {
|
134
134
|
removeAttachment: strings.removeAttachment,
|
135
135
|
uploading: strings.uploading,
|
136
136
|
uploadCompleted: strings.uploadCompleted
|
137
137
|
} }))));
|
138
138
|
}, [
|
139
|
-
|
140
|
-
|
139
|
+
activeAttachmentUploads,
|
140
|
+
onCancelAttachmentUpload,
|
141
141
|
strings.removeAttachment,
|
142
142
|
strings.uploadCompleted,
|
143
143
|
strings.uploading,
|
@@ -150,15 +150,15 @@ export const RichTextSendBox = (props) => {
|
|
150
150
|
}, className: richTextActionButtonsStyle, ariaLabel: localeStrings.sendButtonAriaLabel, tooltipContent: localeStrings.sendButtonAriaLabel }));
|
151
151
|
}, [localeStrings.sendButtonAriaLabel, onRenderSendIcon, sendMessageOnClick]);
|
152
152
|
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
|
153
|
-
const
|
154
|
-
return
|
155
|
-
}, [
|
153
|
+
const hasAttachmentUploads = useMemo(() => {
|
154
|
+
return (hasCompletedAttachmentUploads(activeAttachmentUploads) || hasIncompleteAttachmentUploads(activeAttachmentUploads));
|
155
|
+
}, [activeAttachmentUploads]);
|
156
156
|
return (React.createElement(Stack, null,
|
157
157
|
React.createElement(RichTextSendBoxErrors, Object.assign({}, sendBoxErrorsProps)),
|
158
158
|
React.createElement(RichTextInputBoxComponent, { placeholderText: strings.placeholderText, onChange: setContent, onEnterKeyDown: sendMessageOnClick, editorComponentRef: editorComponentRef, strings: strings, disabled: disabled, actionComponents: sendButton, richTextEditorStyleProps: sendBoxRichTextEditorStyle,
|
159
159
|
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
|
160
|
-
|
160
|
+
onRenderAttachmentUploads: onRenderAttachmentUploads,
|
161
161
|
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
|
162
|
-
|
162
|
+
hasAttachments: hasAttachmentUploads })));
|
163
163
|
};
|
164
164
|
//# sourceMappingURL=RichTextSendBox.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"RichTextSendBox.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/RichTextEditor/RichTextSendBox.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACtE,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAA8B,MAAM,yBAAyB,CAAC;AAC5F,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAEvE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,0BAA0B,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AACzG,qGAAqG;AACrG,OAAO,EAAoB,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AACpF,qGAAqG;AACrG,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAG1F,qGAAqG;AACrG,OAAO,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AACvE,qGAAqG;AACrG,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AA6H5E;;;;GAIG;AACH,MAAM,CAAC,M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E,qGAAqG;IACrG,MAAM,cAAc,GAAG,OAAO,CAAC,GAAG,EAAE;QAClC,OAAO,uBAAuB,CAAC,iBAAiB,CAAC,IAAI,wBAAwB,CAAC,iBAAiB,CAAC,CAAC;IACnG,CAAC,EAAE,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAExB,OAAO,CACL,oBAAC,KAAK;QACJ,oBAAC,qBAAqB,oBAAK,kBAAkB,EAAI;QACjD,oBAAC,yBAAyB,IACxB,eAAe,EAAE,OAAO,CAAC,eAAe,EACxC,QAAQ,EAAE,UAAU,EACpB,cAAc,EAAE,kBAAkB,EAClC,kBAAkB,EAAE,kBAAkB,EACtC,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,gBAAgB,EAAE,UAAU,EAC5B,wBAAwB,EAAE,0BAA0B;YACpD,qGAAqG;YACrG,mBAAmB,EAAE,mBAAmB;YACxC,qGAAqG;YACrG,QAAQ,EAAE,cAAc,GACxB,CACI,CACT,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport React, { useCallback, useMemo, useRef, useState } from 'react';\nimport { RichTextInputBoxComponent } from './RichTextInputBoxComponent';\nimport { Icon, Stack } from '@fluentui/react';\nimport { useLocale } from '../../localization';\nimport { SendBoxStrings } from '../SendBox';\nimport { sendIconStyle } from '../styles/SendBox.styles';\nimport { InputBoxButton } from '../InputBoxButton';\nimport { RichTextSendBoxErrors, RichTextSendBoxErrorsProps } from './RichTextSendBoxErrors';\nimport { isMessageTooLong, sanitizeText } from '../utils/SendBoxUtils';\nimport { RichTextEditorComponentRef } from './RichTextEditor';\nimport { useTheme } from '../../theming';\nimport { richTextActionButtonsStyle, sendBoxRichTextEditorStyle } from '../styles/RichTextEditor.styles';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { ActiveFileUpload, _AttachmentUploadCards } from '../AttachmentUploadCards';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { hasCompletedFileUploads, hasIncompleteFileUploads } from '../utils/SendBoxUtils';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { SendBoxErrorBarError } from '../SendBoxErrorBar';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { attachmentUploadCardsStyles } from '../styles/SendBox.styles';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { FluentV9ThemeProvider } from '../../theming/FluentV9ThemeProvider';\n\n/**\n * Strings of {@link RichTextSendBox} that can be overridden.\n *\n * @beta\n */\nexport interface RichTextSendBoxStrings extends SendBoxStrings {\n /**\n * Tooltip text for the bold button.\n */\n boldTooltip: string;\n /**\n * Tooltip text for the italic button.\n */\n italicTooltip: string;\n /**\n * Tooltip text for the underline button.\n */\n underlineTooltip: string;\n /**\n * Tooltip text for the bullet list button.\n */\n bulletListTooltip: string;\n /**\n * Tooltip text for the number list button.\n */\n numberListTooltip: string;\n /**\n * Tooltip text for the increase indent button.\n */\n increaseIndentTooltip: string;\n /**\n * Tooltip text for the decrease indent button.\n */\n decreaseIndentTooltip: string;\n /**\n * Tooltip text insert table button.\n */\n insertTableTooltip: string;\n /**\n * Tooltip text for the rich text format button button.\n */\n richTextFormatButtonTooltip: string;\n /**\n * Text for the insert menu item.\n */\n insertRowOrColumnMenu: string;\n /**\n * Title for the insert table menu.\n */\n insertTableMenuTitle: string;\n /**\n * Text for the insert menu item to insert row above the current selection.\n */\n insertRowAboveMenu: string;\n /**\n * Text for the insert menu item to insert row below the current selection.\n */\n insertRowBelowMenu: string;\n /**\n * Text for the insert menu item to insert column to the left from the current selection.\n */\n insertColumnLeftMenu: string;\n /**\n * Text for the insert menu item to insert column to the right from the current selection.\n */\n insertColumnRightMenu: string;\n /**\n * Text for the delete row or column menu.\n */\n deleteRowOrColumnMenu: string;\n /**\n * Text for the delete column menu.\n */\n deleteColumnMenu: string;\n /**\n * Text for the delete row menu.\n */\n deleteRowMenu: string;\n /**\n * Text for the delete table menu.\n */\n deleteTableMenu: string;\n}\n\n/**\n * Props for {@link RichTextSendBox}.\n *\n * @beta\n */\nexport interface RichTextSendBoxProps {\n /**\n * Optional boolean to disable text box\n * @defaultValue false\n */\n disabled?: boolean;\n /**\n * Optional strings to override in component\n */\n strings?: Partial<RichTextSendBoxStrings>;\n /**\n * Optional text for system message above the text box\n */\n systemMessage?: string;\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n /**\n * Optional array of active file uploads where each object has attributes\n * of a file upload like name, progress, errorMessage etc.\n * @beta\n */\n activeFileUploads?: ActiveFileUpload[];\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n /**\n * Optional callback to remove the file upload before sending by clicking on\n * cancel icon.\n * @beta\n */\n onCancelFileUpload?: (fileId: string) => void;\n /**\n * Callback function used when the send button is clicked.\n */\n onSendMessage: (content: string) => Promise<void>;\n}\n\n/**\n * A component to render SendBox with Rich Text Editor support.\n *\n * @beta\n */\nexport const RichTextSendBox = (props: RichTextSendBoxProps): JSX.Element => {\n const {\n disabled = false,\n systemMessage,\n onSendMessage,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n activeFileUploads,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n onCancelFileUpload\n } = props;\n\n const theme = useTheme();\n const locale = useLocale();\n\n const localeStrings = useMemo(() => {\n /* @conditional-compile-remove(rich-text-editor) */\n return locale.strings.richTextSendBox;\n return locale.strings.sendBox;\n }, [/* @conditional-compile-remove(rich-text-editor) */ locale.strings.richTextSendBox, locale.strings.sendBox]);\n\n const strings = useMemo(() => {\n return { ...localeStrings, ...props.strings };\n }, [localeStrings, props.strings]);\n\n const [contentValue, setContentValue] = useState('');\n const [contentValueOverflow, setContentValueOverflow] = useState(false);\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n const [attachmentUploadsPendingError, setFileUploadsPendingError] = useState<SendBoxErrorBarError | undefined>(\n undefined\n );\n const editorComponentRef = useRef<RichTextEditorComponentRef>(null);\n\n const contentTooLongMessage = useMemo(\n () => (contentValueOverflow ? strings.textTooLong : undefined),\n [contentValueOverflow, strings.textTooLong]\n );\n\n const setContent = useCallback((newValue?: string): void => {\n if (newValue === undefined) {\n return;\n }\n\n setContentValueOverflow(isMessageTooLong(newValue.length));\n setContentValue(newValue);\n }, []);\n\n const sendMessageOnClick = useCallback((): void => {\n if (disabled || contentValueOverflow) {\n return;\n }\n // Don't send message until all files have been uploaded successfully\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n setFileUploadsPendingError(undefined);\n\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n if (hasIncompleteFileUploads(activeFileUploads)) {\n setFileUploadsPendingError({ message: strings.attachmentUploadsPendingError, timestamp: Date.now() });\n return;\n }\n\n const message = contentValue;\n // we don't want to send empty messages including spaces, newlines, tabs\n // Message can be empty if there is a valid file upload\n if (\n sanitizeText(message).length > 0 ||\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */ hasCompletedFileUploads(\n activeFileUploads\n )\n ) {\n onSendMessage(message);\n setContentValue('');\n editorComponentRef.current?.setEmptyContent();\n }\n editorComponentRef.current?.focus();\n }, [\n contentValue,\n contentValueOverflow,\n disabled,\n onSendMessage,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */ activeFileUploads,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */ strings.attachmentUploadsPendingError\n ]);\n\n const hasErrorMessage = useMemo(() => {\n return (\n !!systemMessage ||\n !!contentTooLongMessage ||\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n !!attachmentUploadsPendingError ||\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n !!activeFileUploads?.filter((attachmentUpload) => attachmentUpload.error).pop()?.error\n );\n }, [\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n activeFileUploads,\n contentTooLongMessage,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n attachmentUploadsPendingError,\n systemMessage\n ]);\n\n const onRenderSendIcon = useCallback(\n (isHover: boolean) => (\n <Icon\n iconName={isHover && contentValue ? 'SendBoxSendHovered' : 'SendBoxSend'}\n className={sendIconStyle({\n theme,\n hasText: !!contentValue,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n hasFile: false,\n hasErrorMessage: hasErrorMessage,\n defaultTextColor: theme.palette.neutralSecondary,\n disabled: disabled\n })}\n />\n ),\n [contentValue, disabled, hasErrorMessage, theme]\n );\n\n const sendBoxErrorsProps: RichTextSendBoxErrorsProps = useMemo(() => {\n return {\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n attachmentUploadsPendingError: attachmentUploadsPendingError,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n attachmentUploadError: activeFileUploads?.filter((attachmentUpload) => attachmentUpload.error).pop()?.error,\n systemMessage: systemMessage,\n textTooLongMessage: contentTooLongMessage\n };\n }, [\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n activeFileUploads,\n contentTooLongMessage,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n attachmentUploadsPendingError,\n systemMessage\n ]);\n\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n const onRenderFileUploads = useCallback(() => {\n return (\n <Stack className={attachmentUploadCardsStyles}>\n <FluentV9ThemeProvider v8Theme={theme}>\n <_AttachmentUploadCards\n activeFileUploads={activeFileUploads}\n onCancelFileUpload={onCancelFileUpload}\n strings={{\n removeAttachment: strings.removeAttachment,\n uploading: strings.uploading,\n uploadCompleted: strings.uploadCompleted\n }}\n />\n </FluentV9ThemeProvider>\n </Stack>\n );\n }, [\n activeFileUploads,\n onCancelFileUpload,\n strings.removeAttachment,\n strings.uploadCompleted,\n strings.uploading,\n theme\n ]);\n\n const sendButton = useMemo(() => {\n return (\n <InputBoxButton\n onRenderIcon={onRenderSendIcon}\n onClick={(e) => {\n sendMessageOnClick();\n e.stopPropagation(); // Prevents the click from bubbling up and triggering a focus event on the chat.\n }}\n className={richTextActionButtonsStyle}\n ariaLabel={localeStrings.sendButtonAriaLabel}\n tooltipContent={localeStrings.sendButtonAriaLabel}\n />\n );\n }, [localeStrings.sendButtonAriaLabel, onRenderSendIcon, sendMessageOnClick]);\n\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n const hasFileUploads = useMemo(() => {\n return hasCompletedFileUploads(activeFileUploads) || hasIncompleteFileUploads(activeFileUploads);\n }, [activeFileUploads]);\n\n return (\n <Stack>\n <RichTextSendBoxErrors {...sendBoxErrorsProps} />\n <RichTextInputBoxComponent\n placeholderText={strings.placeholderText}\n onChange={setContent}\n onEnterKeyDown={sendMessageOnClick}\n editorComponentRef={editorComponentRef}\n strings={strings}\n disabled={disabled}\n actionComponents={sendButton}\n richTextEditorStyleProps={sendBoxRichTextEditorStyle}\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n onRenderFileUploads={onRenderFileUploads}\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n hasFiles={hasFileUploads}\n />\n </Stack>\n );\n};\n"]}
|
1
|
+
{"version":3,"file":"RichTextSendBox.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/RichTextEditor/RichTextSendBox.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACtE,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,IAAI,E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AgB,EAAE,UAAU,EAC5B,wBAAwB,EAAE,0BAA0B;YACpD,qGAAqG;YACrG,yBAAyB,EAAE,yBAAyB;YACpD,qGAAqG;YACrG,cAAc,EAAE,oBAAoB,GACpC,CACI,CACT,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport React, { useCallback, useMemo, useRef, useState } from 'react';\nimport { RichTextInputBoxComponent } from './RichTextInputBoxComponent';\nimport { Icon, Stack } from '@fluentui/react';\nimport { useLocale } from '../../localization';\nimport { SendBoxStrings } from '../SendBox';\nimport { sendIconStyle } from '../styles/SendBox.styles';\nimport { InputBoxButton } from '../InputBoxButton';\nimport { RichTextSendBoxErrors, RichTextSendBoxErrorsProps } from './RichTextSendBoxErrors';\nimport { isMessageTooLong, sanitizeText } from '../utils/SendBoxUtils';\nimport { RichTextEditorComponentRef } from './RichTextEditor';\nimport { useTheme } from '../../theming';\nimport { richTextActionButtonsStyle, sendBoxRichTextEditorStyle } from '../styles/RichTextEditor.styles';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { _AttachmentUploadCards } from '../AttachmentUploadCards';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { AttachmentMetadata } from '../../types/Attachment';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { hasCompletedAttachmentUploads, hasIncompleteAttachmentUploads } from '../utils/SendBoxUtils';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { SendBoxErrorBarError } from '../SendBoxErrorBar';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { attachmentUploadCardsStyles } from '../styles/SendBox.styles';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { FluentV9ThemeProvider } from '../../theming/FluentV9ThemeProvider';\n\n/**\n * Strings of {@link RichTextSendBox} that can be overridden.\n *\n * @beta\n */\nexport interface RichTextSendBoxStrings extends SendBoxStrings {\n /**\n * Tooltip text for the bold button.\n */\n boldTooltip: string;\n /**\n * Tooltip text for the italic button.\n */\n italicTooltip: string;\n /**\n * Tooltip text for the underline button.\n */\n underlineTooltip: string;\n /**\n * Tooltip text for the bullet list button.\n */\n bulletListTooltip: string;\n /**\n * Tooltip text for the number list button.\n */\n numberListTooltip: string;\n /**\n * Tooltip text for the increase indent button.\n */\n increaseIndentTooltip: string;\n /**\n * Tooltip text for the decrease indent button.\n */\n decreaseIndentTooltip: string;\n /**\n * Tooltip text insert table button.\n */\n insertTableTooltip: string;\n /**\n * Tooltip text for the rich text format button button.\n */\n richTextFormatButtonTooltip: string;\n /**\n * Text for the insert menu item.\n */\n insertRowOrColumnMenu: string;\n /**\n * Title for the insert table menu.\n */\n insertTableMenuTitle: string;\n /**\n * Text for the insert menu item to insert row above the current selection.\n */\n insertRowAboveMenu: string;\n /**\n * Text for the insert menu item to insert row below the current selection.\n */\n insertRowBelowMenu: string;\n /**\n * Text for the insert menu item to insert column to the left from the current selection.\n */\n insertColumnLeftMenu: string;\n /**\n * Text for the insert menu item to insert column to the right from the current selection.\n */\n insertColumnRightMenu: string;\n /**\n * Text for the delete row or column menu.\n */\n deleteRowOrColumnMenu: string;\n /**\n * Text for the delete column menu.\n */\n deleteColumnMenu: string;\n /**\n * Text for the delete row menu.\n */\n deleteRowMenu: string;\n /**\n * Text for the delete table menu.\n */\n deleteTableMenu: string;\n}\n\n/**\n * Props for {@link RichTextSendBox}.\n *\n * @beta\n */\nexport interface RichTextSendBoxProps {\n /**\n * Optional boolean to disable text box\n * @defaultValue false\n */\n disabled?: boolean;\n /**\n * Optional strings to override in component\n */\n strings?: Partial<RichTextSendBoxStrings>;\n /**\n * Optional text for system message above the text box\n */\n systemMessage?: string;\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n /**\n * Optional array of active attachment uploads where each object has attributes\n * of a attachment upload like name, progress, errorMessage etc.\n * @beta\n */\n activeAttachmentUploads?: AttachmentMetadata[];\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n /**\n * Optional callback to remove the attachment upload before sending by clicking on\n * cancel icon.\n * @beta\n */\n onCancelAttachmentUpload?: (attachmentId: string) => void;\n /**\n * Callback function used when the send button is clicked.\n */\n onSendMessage: (content: string) => Promise<void>;\n}\n\n/**\n * A component to render SendBox with Rich Text Editor support.\n *\n * @beta\n */\nexport const RichTextSendBox = (props: RichTextSendBoxProps): JSX.Element => {\n const {\n disabled = false,\n systemMessage,\n onSendMessage,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n activeAttachmentUploads,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n onCancelAttachmentUpload\n } = props;\n\n const theme = useTheme();\n const locale = useLocale();\n\n const localeStrings = useMemo(() => {\n /* @conditional-compile-remove(rich-text-editor) */\n return locale.strings.richTextSendBox;\n return locale.strings.sendBox;\n }, [/* @conditional-compile-remove(rich-text-editor) */ locale.strings.richTextSendBox, locale.strings.sendBox]);\n\n const strings = useMemo(() => {\n return { ...localeStrings, ...props.strings };\n }, [localeStrings, props.strings]);\n\n const [contentValue, setContentValue] = useState('');\n const [contentValueOverflow, setContentValueOverflow] = useState(false);\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n const [attachmentUploadsPendingError, setAttachmentUploadsPendingError] = useState<SendBoxErrorBarError | undefined>(\n undefined\n );\n const editorComponentRef = useRef<RichTextEditorComponentRef>(null);\n\n const contentTooLongMessage = useMemo(\n () => (contentValueOverflow ? strings.textTooLong : undefined),\n [contentValueOverflow, strings.textTooLong]\n );\n\n const setContent = useCallback((newValue?: string): void => {\n if (newValue === undefined) {\n return;\n }\n\n setContentValueOverflow(isMessageTooLong(newValue.length));\n setContentValue(newValue);\n }, []);\n\n const sendMessageOnClick = useCallback((): void => {\n if (disabled || contentValueOverflow) {\n return;\n }\n // Don't send message until all attachments have been uploaded successfully\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n setAttachmentUploadsPendingError(undefined);\n\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n if (hasIncompleteAttachmentUploads(activeAttachmentUploads)) {\n setAttachmentUploadsPendingError({ message: strings.attachmentUploadsPendingError, timestamp: Date.now() });\n return;\n }\n\n const message = contentValue;\n // we don't want to send empty messages including spaces, newlines, tabs\n // Message can be empty if there is a valid attachment upload\n if (\n sanitizeText(message).length > 0 ||\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */ hasCompletedAttachmentUploads(\n activeAttachmentUploads\n )\n ) {\n onSendMessage(message);\n setContentValue('');\n editorComponentRef.current?.setEmptyContent();\n }\n editorComponentRef.current?.focus();\n }, [\n contentValue,\n contentValueOverflow,\n disabled,\n onSendMessage,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */ activeAttachmentUploads,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */ strings.attachmentUploadsPendingError\n ]);\n\n const hasErrorMessage = useMemo(() => {\n return (\n !!systemMessage ||\n !!contentTooLongMessage ||\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n !!attachmentUploadsPendingError ||\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n !!activeAttachmentUploads?.filter((attachmentUpload) => attachmentUpload.uploadError).pop()?.uploadError\n );\n }, [\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n activeAttachmentUploads,\n contentTooLongMessage,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n attachmentUploadsPendingError,\n systemMessage\n ]);\n\n const onRenderSendIcon = useCallback(\n (isHover: boolean) => (\n <Icon\n iconName={isHover && contentValue ? 'SendBoxSendHovered' : 'SendBoxSend'}\n className={sendIconStyle({\n theme,\n hasText: !!contentValue,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n hasAttachment: false,\n hasErrorMessage: hasErrorMessage,\n defaultTextColor: theme.palette.neutralSecondary,\n disabled: disabled\n })}\n />\n ),\n [contentValue, disabled, hasErrorMessage, theme]\n );\n\n const sendBoxErrorsProps: RichTextSendBoxErrorsProps = useMemo(() => {\n return {\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n attachmentUploadsPendingError: attachmentUploadsPendingError,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n attachmentUploadError: activeAttachmentUploads?.filter((attachmentUpload) => attachmentUpload.uploadError).pop()\n ?.uploadError,\n systemMessage: systemMessage,\n textTooLongMessage: contentTooLongMessage\n };\n }, [\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n activeAttachmentUploads,\n contentTooLongMessage,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n attachmentUploadsPendingError,\n systemMessage\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 activeAttachmentUploads={activeAttachmentUploads}\n onCancelAttachmentUpload={onCancelAttachmentUpload}\n strings={{\n removeAttachment: strings.removeAttachment,\n uploading: strings.uploading,\n uploadCompleted: strings.uploadCompleted\n }}\n />\n </FluentV9ThemeProvider>\n </Stack>\n );\n }, [\n activeAttachmentUploads,\n onCancelAttachmentUpload,\n strings.removeAttachment,\n strings.uploadCompleted,\n strings.uploading,\n theme\n ]);\n\n const sendButton = useMemo(() => {\n return (\n <InputBoxButton\n onRenderIcon={onRenderSendIcon}\n onClick={(e) => {\n sendMessageOnClick();\n e.stopPropagation(); // Prevents the click from bubbling up and triggering a focus event on the chat.\n }}\n className={richTextActionButtonsStyle}\n ariaLabel={localeStrings.sendButtonAriaLabel}\n tooltipContent={localeStrings.sendButtonAriaLabel}\n />\n );\n }, [localeStrings.sendButtonAriaLabel, onRenderSendIcon, sendMessageOnClick]);\n\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n const hasAttachmentUploads = useMemo(() => {\n return (\n hasCompletedAttachmentUploads(activeAttachmentUploads) || hasIncompleteAttachmentUploads(activeAttachmentUploads)\n );\n }, [activeAttachmentUploads]);\n\n return (\n <Stack>\n <RichTextSendBoxErrors {...sendBoxErrorsProps} />\n <RichTextInputBoxComponent\n placeholderText={strings.placeholderText}\n onChange={setContent}\n onEnterKeyDown={sendMessageOnClick}\n editorComponentRef={editorComponentRef}\n strings={strings}\n disabled={disabled}\n actionComponents={sendButton}\n richTextEditorStyleProps={sendBoxRichTextEditorStyle}\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n onRenderAttachmentUploads={onRenderAttachmentUploads}\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n hasAttachments={hasAttachmentUploads}\n />\n </Stack>\n );\n};\n"]}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { IStyle } from '@fluentui/react';
|
3
3
|
import { BaseCustomStyles } from '../types';
|
4
|
-
import {
|
4
|
+
import { AttachmentMetadata } from '../types/Attachment';
|
5
5
|
import { MentionLookupOptions } from './MentionPopover';
|
6
6
|
/**
|
7
7
|
* Fluent styles for {@link Sendbox}.
|
@@ -116,24 +116,24 @@ export interface SendBoxProps {
|
|
116
116
|
*/
|
117
117
|
autoFocus?: 'sendBoxTextField';
|
118
118
|
/**
|
119
|
-
* Optional callback to render uploaded
|
120
|
-
* vertically to accommodate the uploaded
|
119
|
+
* Optional callback to render uploaded attachments in the SendBox. The sendBox will expand
|
120
|
+
* vertically to accommodate the uploaded attachments. Attachment uploads will
|
121
121
|
* be rendered below the text area in sendBox.
|
122
122
|
* @beta
|
123
123
|
*/
|
124
|
-
|
124
|
+
onRenderAttachmentUploads?: () => JSX.Element;
|
125
125
|
/**
|
126
126
|
* Optional array of active attachment uploads where each object has attributes
|
127
127
|
* of a attachment upload like name, progress, errorMessage etc.
|
128
128
|
* @beta
|
129
129
|
*/
|
130
|
-
|
130
|
+
activeAttachmentUploads?: AttachmentMetadata[];
|
131
131
|
/**
|
132
132
|
* Optional callback to remove the attachment upload before sending by clicking on
|
133
133
|
* cancel icon.
|
134
134
|
* @beta
|
135
135
|
*/
|
136
|
-
|
136
|
+
onCancelAttachmentUpload?: (attachmentId: string) => void;
|
137
137
|
}
|
138
138
|
/**
|
139
139
|
* Component for typing and sending messages.
|
@@ -15,7 +15,7 @@ import { _AttachmentUploadCards } from './AttachmentUploadCards';
|
|
15
15
|
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
|
16
16
|
import { attachmentUploadCardsStyles } from './styles/SendBox.styles';
|
17
17
|
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
|
18
|
-
import {
|
18
|
+
import { hasCompletedAttachmentUploads, hasIncompleteAttachmentUploads } from './utils/SendBoxUtils';
|
19
19
|
import { MAXIMUM_LENGTH_OF_MESSAGE, isMessageTooLong, sanitizeText } from './utils/SendBoxUtils';
|
20
20
|
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
|
21
21
|
import { FluentV9ThemeProvider } from '../theming/FluentV9ThemeProvider';
|
@@ -32,7 +32,7 @@ export const SendBox = (props) => {
|
|
32
32
|
/* @conditional-compile-remove(mention) */
|
33
33
|
mentionLookupOptions,
|
34
34
|
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
|
35
|
-
|
35
|
+
activeAttachmentUploads } = props;
|
36
36
|
const theme = useTheme();
|
37
37
|
const localeStrings = useLocale().strings.sendBox;
|
38
38
|
const strings = Object.assign(Object.assign({}, localeStrings), props.strings);
|
@@ -48,11 +48,11 @@ export const SendBox = (props) => {
|
|
48
48
|
if (disabled || textValueOverflow) {
|
49
49
|
return;
|
50
50
|
}
|
51
|
-
// Don't send message until all
|
51
|
+
// Don't send message until all attachments have been uploaded successfully
|
52
52
|
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
|
53
53
|
setAttachmentUploadsPendingError(undefined);
|
54
54
|
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
|
55
|
-
if (
|
55
|
+
if (hasIncompleteAttachmentUploads(activeAttachmentUploads)) {
|
56
56
|
setAttachmentUploadsPendingError({ message: strings.attachmentUploadsPendingError, timestamp: Date.now() });
|
57
57
|
return;
|
58
58
|
}
|
@@ -60,7 +60,7 @@ export const SendBox = (props) => {
|
|
60
60
|
// we don't want to send empty messages including spaces, newlines, tabs
|
61
61
|
// Message can be empty if there is a valid attachment upload
|
62
62
|
if (sanitizeText(message).length > 0 ||
|
63
|
-
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
|
63
|
+
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */ hasCompletedAttachmentUploads(activeAttachmentUploads)) {
|
64
64
|
onSendMessage && onSendMessage(message);
|
65
65
|
setTextValue('');
|
66
66
|
}
|
@@ -80,47 +80,47 @@ export const SendBox = (props) => {
|
|
80
80
|
const mergedSendIconStyle = useMemo(() => sendIconStyle({
|
81
81
|
theme,
|
82
82
|
hasText: !!textValue,
|
83
|
-
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
|
83
|
+
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */ hasAttachment: hasCompletedAttachmentUploads(activeAttachmentUploads),
|
84
84
|
hasErrorMessage: !!errorMessage,
|
85
85
|
customSendIconStyle: styles === null || styles === void 0 ? void 0 : styles.sendMessageIcon
|
86
86
|
}), [
|
87
87
|
theme,
|
88
88
|
textValue,
|
89
|
-
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
|
89
|
+
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */ activeAttachmentUploads,
|
90
90
|
errorMessage,
|
91
91
|
styles === null || styles === void 0 ? void 0 : styles.sendMessageIcon
|
92
92
|
]);
|
93
93
|
const onRenderSendIcon = useCallback((isHover) => onRenderIcon ? (onRenderIcon(isHover)) : (React.createElement(Icon, { iconName: isHover && textValue ? 'SendBoxSendHovered' : 'SendBoxSend', className: mergedSendIconStyle })), [mergedSendIconStyle, onRenderIcon, textValue]);
|
94
|
-
// Ensure that errors are cleared when there are no
|
94
|
+
// Ensure that errors are cleared when there are no attachments in sendBox
|
95
95
|
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
|
96
96
|
React.useEffect(() => {
|
97
|
-
if (!(
|
97
|
+
if (!(activeAttachmentUploads === null || activeAttachmentUploads === void 0 ? void 0 : activeAttachmentUploads.filter((upload) => !upload.uploadError).length)) {
|
98
98
|
setAttachmentUploadsPendingError(undefined);
|
99
99
|
}
|
100
|
-
}, [
|
100
|
+
}, [activeAttachmentUploads]);
|
101
101
|
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
|
102
102
|
const sendBoxErrorsProps = useMemo(() => {
|
103
103
|
var _a;
|
104
104
|
return {
|
105
105
|
attachmentUploadsPendingError: attachmentUploadsPendingError,
|
106
|
-
attachmentUploadError: (_a =
|
106
|
+
attachmentUploadError: (_a = activeAttachmentUploads === null || activeAttachmentUploads === void 0 ? void 0 : activeAttachmentUploads.filter((attachmentUpload) => attachmentUpload.uploadError).pop()) === null || _a === void 0 ? void 0 : _a.uploadError
|
107
107
|
};
|
108
|
-
}, [
|
108
|
+
}, [activeAttachmentUploads, attachmentUploadsPendingError]);
|
109
109
|
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
|
110
|
-
const
|
110
|
+
const onRenderAttachmentUploads = useCallback(() => {
|
111
111
|
var _a, _b, _c, _d, _e, _f;
|
112
|
-
if (!(
|
112
|
+
if (!(activeAttachmentUploads === null || activeAttachmentUploads === void 0 ? void 0 : activeAttachmentUploads.filter((upload) => !upload.uploadError).length)) {
|
113
113
|
return null;
|
114
114
|
}
|
115
|
-
return props.
|
115
|
+
return props.onRenderAttachmentUploads ? (props.onRenderAttachmentUploads()) : (React.createElement(Stack, { className: attachmentUploadCardsStyles },
|
116
116
|
React.createElement(FluentV9ThemeProvider, { v8Theme: theme },
|
117
|
-
React.createElement(_AttachmentUploadCards, {
|
117
|
+
React.createElement(_AttachmentUploadCards, { activeAttachmentUploads: activeAttachmentUploads, onCancelAttachmentUpload: props.onCancelAttachmentUpload, strings: {
|
118
118
|
removeAttachment: (_b = (_a = props.strings) === null || _a === void 0 ? void 0 : _a.removeAttachment) !== null && _b !== void 0 ? _b : localeStrings.removeAttachment,
|
119
119
|
uploading: (_d = (_c = props.strings) === null || _c === void 0 ? void 0 : _c.uploading) !== null && _d !== void 0 ? _d : localeStrings.uploading,
|
120
120
|
uploadCompleted: (_f = (_e = props.strings) === null || _e === void 0 ? void 0 : _e.uploadCompleted) !== null && _f !== void 0 ? _f : localeStrings.uploadCompleted
|
121
121
|
} }))));
|
122
122
|
}, [
|
123
|
-
|
123
|
+
activeAttachmentUploads,
|
124
124
|
props,
|
125
125
|
theme,
|
126
126
|
localeStrings.removeAttachment,
|
@@ -152,6 +152,6 @@ export const SendBox = (props) => {
|
|
152
152
|
e.stopPropagation();
|
153
153
|
}, id: 'sendIconWrapper', className: mergedSendButtonStyle, ariaLabel: localeStrings.sendButtonAriaLabel, tooltipContent: localeStrings.sendButtonAriaLabel })),
|
154
154
|
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
|
155
|
-
|
155
|
+
onRenderAttachmentUploads())));
|
156
156
|
};
|
157
157
|
//# sourceMappingURL=SendBox.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"SendBox.js","sourceRoot":"","sources":["../../../../../../react-components/src/components/SendBox.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AAC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ElB,qGAAqG;YACrG,mBAAmB,EAAE,CAEjB,CACF,CACT,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport React, { useState, useMemo, useCallback } from 'react';\nimport { IStyle, ITextField, mergeStyles, concatStyleSets, Icon, Stack } from '@fluentui/react';\nimport { sendButtonStyle, sendIconStyle, sendBoxWrapperStyles, borderAndBoxShadowStyle } from './styles/SendBox.styles';\nimport { BaseCustomStyles } from '../types';\nimport { useTheme } from '../theming';\nimport { useLocale } from '../localization';\nimport { useIdentifiers } from '../identifiers';\nimport { InputBoxComponent } from './InputBoxComponent';\nimport { InputBoxButton } from './InputBoxButton';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { SendBoxErrors } from './SendBoxErrors';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { ActiveFileUpload, _AttachmentUploadCards } from './AttachmentUploadCards';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { attachmentUploadCardsStyles } from './styles/SendBox.styles';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { SendBoxErrorBarError } from './SendBoxErrorBar';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { hasCompletedFileUploads, hasIncompleteFileUploads } from './utils/SendBoxUtils';\nimport { MAXIMUM_LENGTH_OF_MESSAGE, isMessageTooLong, sanitizeText } from './utils/SendBoxUtils';\n/* @conditional-compile-remove(mention) */\nimport { MentionLookupOptions } from './MentionPopover';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { FluentV9ThemeProvider } from '../theming/FluentV9ThemeProvider';\n\n/**\n * Fluent styles for {@link Sendbox}.\n *\n * @public\n */\nexport interface SendBoxStylesProps extends BaseCustomStyles {\n /** Styles for the text field. */\n textField?: IStyle;\n /** styles for the text field container */\n textFieldContainer?: IStyle;\n /** Styles for the container of the send message icon. */\n sendMessageIconContainer?: IStyle;\n /** Styles for the send message icon; These styles will be ignored when a custom send message icon is provided. */\n sendMessageIcon?: IStyle;\n /** Styles for the system message; These styles will be ignored when a custom system message component is provided. */\n systemMessage?: IStyle;\n}\n\n/**\n * Strings of {@link SendBox} that can be overridden.\n *\n * @public\n */\nexport interface SendBoxStrings {\n /**\n * Placeholder text in SendBox when there is no user input\n */\n placeholderText: string;\n /**\n * The warning message when send box text length is more than max limit\n */\n textTooLong: string;\n /**\n * Aria label for send message button\n */\n sendButtonAriaLabel: string;\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n /**\n * Error message indicating that all attachment uploads are not complete.\n */\n attachmentUploadsPendingError: string;\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n /**\n * Aria label to notify user when focus is on cancel attachment upload button.\n */\n removeAttachment: string;\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n /**\n * Aria label to notify user attachment uploading starts.\n */\n uploading: string;\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n /**\n * Aria label to notify user attachment is uploaded.\n */\n uploadCompleted: string;\n}\n\n/**\n * Props for {@link SendBox}.\n *\n * @public\n */\nexport interface SendBoxProps {\n /**\n * Optional boolean to disable text box\n * @defaultValue false\n */\n disabled?: boolean;\n /**\n * Optional text for system message below text box\n */\n systemMessage?: string;\n /**\n * Optional override behavior on send button click\n */\n onSendMessage?: (content: string) => Promise<void>;\n /* @conditional-compile-remove(mention) */\n /**\n * Optional props needed to lookup suggestions in the mention scenario.\n * @beta\n */\n mentionLookupOptions?: MentionLookupOptions;\n\n /**\n * Optional callback called when user is typing\n */\n onTyping?: () => Promise<void>;\n /**\n * Optional callback to render system message below the SendBox.\n * @defaultValue MessageBar\n */\n onRenderSystemMessage?: (systemMessage: string | undefined) => React.ReactElement;\n /**\n * Optional boolean to support new line in SendBox.\n * @defaultValue false\n */\n supportNewline?: boolean;\n /**\n * Optional callback to render send button icon to the right of the SendBox.\n * @defaultValue SendBoxSendHovered icon when mouse over icon and SendBoxSend icon otherwise\n */\n onRenderIcon?: (isHover: boolean) => JSX.Element;\n /**\n * Allows users to pass in an object contains custom CSS styles.\n * @Example\n * ```\n * <SendBox styles={{ root: { background: 'blue' } }} />\n * ```\n */\n styles?: SendBoxStylesProps;\n /**\n * Optional strings to override in component\n */\n strings?: Partial<SendBoxStrings>;\n /**\n * enumerable to determine if the input box has focus on render or not.\n * When undefined nothing has focus on render\n */\n autoFocus?: 'sendBoxTextField';\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n /**\n * Optional callback to render uploaded files in the SendBox. The sendBox will expand\n * vertically to accommodate the uploaded files. File uploads will\n * be rendered below the text area in sendBox.\n * @beta\n */\n onRenderFileUploads?: () => JSX.Element;\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n /**\n * Optional array of active attachment uploads where each object has attributes\n * of a attachment upload like name, progress, errorMessage etc.\n * @beta\n */\n activeFileUploads?: ActiveFileUpload[];\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n /**\n * Optional callback to remove the attachment upload before sending by clicking on\n * cancel icon.\n * @beta\n */\n onCancelFileUpload?: (fileId: string) => void;\n}\n\n/**\n * Component for typing and sending messages.\n *\n * Supports sending typing notification when user starts entering text.\n * Supports an optional message below the text input field.\n *\n * @public\n */\nexport const SendBox = (props: SendBoxProps): JSX.Element => {\n const {\n disabled,\n systemMessage,\n supportNewline,\n onSendMessage,\n onTyping,\n onRenderIcon,\n onRenderSystemMessage,\n styles,\n autoFocus,\n /* @conditional-compile-remove(mention) */\n mentionLookupOptions,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n activeFileUploads\n } = props;\n const theme = useTheme();\n const localeStrings = useLocale().strings.sendBox;\n const strings = { ...localeStrings, ...props.strings };\n const ids = useIdentifiers();\n\n const [textValue, setTextValue] = useState('');\n const [textValueOverflow, setTextValueOverflow] = useState(false);\n\n const sendTextFieldRef = React.useRef<ITextField>(null);\n\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n const [attachmentUploadsPendingError, setAttachmentUploadsPendingError] = useState<SendBoxErrorBarError | undefined>(\n undefined\n );\n\n const sendMessageOnClick = (): void => {\n // don't send a message when disabled\n if (disabled || textValueOverflow) {\n return;\n }\n\n // Don't send message until all files have been uploaded successfully\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n setAttachmentUploadsPendingError(undefined);\n\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n if (hasIncompleteFileUploads(activeFileUploads)) {\n setAttachmentUploadsPendingError({ message: strings.attachmentUploadsPendingError, timestamp: Date.now() });\n return;\n }\n\n const message = textValue;\n // we don't want to send empty messages including spaces, newlines, tabs\n // Message can be empty if there is a valid attachment upload\n if (\n sanitizeText(message).length > 0 ||\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */ hasCompletedFileUploads(\n activeFileUploads\n )\n ) {\n onSendMessage && onSendMessage(message);\n setTextValue('');\n }\n sendTextFieldRef.current?.focus();\n };\n\n const setText = (newValue?: string | undefined): void => {\n if (newValue === undefined) {\n return;\n }\n\n setTextValueOverflow(isMessageTooLong(newValue.length));\n setTextValue(newValue);\n };\n\n const textTooLongMessage = textValueOverflow ? strings.textTooLong : undefined;\n const errorMessage = systemMessage ?? textTooLongMessage;\n\n const mergedSendButtonStyle = useMemo(\n () => mergeStyles(sendButtonStyle, styles?.sendMessageIconContainer),\n [styles?.sendMessageIconContainer]\n );\n\n const mergedStyles = useMemo(() => concatStyleSets(styles), [styles]);\n\n const mergedSendIconStyle = useMemo(\n () =>\n sendIconStyle({\n theme,\n hasText: !!textValue,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */ hasFile:\n hasCompletedFileUploads(activeFileUploads),\n hasErrorMessage: !!errorMessage,\n customSendIconStyle: styles?.sendMessageIcon\n }),\n [\n theme,\n textValue,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */ activeFileUploads,\n errorMessage,\n styles?.sendMessageIcon\n ]\n );\n\n const onRenderSendIcon = useCallback(\n (isHover: boolean) =>\n onRenderIcon ? (\n onRenderIcon(isHover)\n ) : (\n <Icon iconName={isHover && textValue ? 'SendBoxSendHovered' : 'SendBoxSend'} className={mergedSendIconStyle} />\n ),\n [mergedSendIconStyle, onRenderIcon, textValue]\n );\n\n // Ensure that errors are cleared when there are no files in sendBox\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n React.useEffect(() => {\n if (!activeFileUploads?.filter((upload) => !upload.error).length) {\n setAttachmentUploadsPendingError(undefined);\n }\n }, [activeFileUploads]);\n\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n const sendBoxErrorsProps = useMemo(() => {\n return {\n attachmentUploadsPendingError: attachmentUploadsPendingError,\n attachmentUploadError: activeFileUploads?.filter((attachmentUpload) => attachmentUpload.error).pop()?.error\n };\n }, [activeFileUploads, attachmentUploadsPendingError]);\n\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n const onRenderFileUploads = useCallback(() => {\n if (!activeFileUploads?.filter((upload) => !upload.error).length) {\n return null;\n }\n return props.onRenderFileUploads ? (\n props.onRenderFileUploads()\n ) : (\n <Stack className={attachmentUploadCardsStyles}>\n <FluentV9ThemeProvider v8Theme={theme}>\n <_AttachmentUploadCards\n activeFileUploads={activeFileUploads}\n onCancelFileUpload={props.onCancelFileUpload}\n strings={{\n removeAttachment: props.strings?.removeAttachment ?? localeStrings.removeAttachment,\n uploading: props.strings?.uploading ?? localeStrings.uploading,\n uploadCompleted: props.strings?.uploadCompleted ?? localeStrings.uploadCompleted\n }}\n />\n </FluentV9ThemeProvider>\n </Stack>\n );\n }, [\n activeFileUploads,\n props,\n theme,\n localeStrings.removeAttachment,\n localeStrings.uploading,\n localeStrings.uploadCompleted\n ]);\n\n return (\n <Stack\n className={mergeStyles(\n sendBoxWrapperStyles,\n { overflow: 'visible' } // This is needed for the mention popup to be visible\n )}\n >\n {\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */ <SendBoxErrors\n {...sendBoxErrorsProps}\n />\n }\n <Stack\n className={borderAndBoxShadowStyle({\n theme,\n hasErrorMessage: !!errorMessage,\n disabled: !!disabled\n })}\n >\n <InputBoxComponent\n autoFocus={autoFocus}\n data-ui-id={ids.sendboxTextField}\n disabled={disabled}\n errorMessage={onRenderSystemMessage ? onRenderSystemMessage(errorMessage) : errorMessage}\n textFieldRef={sendTextFieldRef}\n id=\"sendbox\"\n placeholderText={strings.placeholderText}\n textValue={textValue}\n onChange={(_, newValue) => setText(newValue)}\n onKeyDown={(ev) => {\n const keyWasSendingMessage = ev.key === 'Enter' && (ev.shiftKey === false || !supportNewline);\n if (!keyWasSendingMessage) {\n onTyping?.();\n }\n }}\n onEnterKeyDown={() => {\n sendMessageOnClick();\n }}\n styles={mergedStyles}\n supportNewline={supportNewline}\n maxLength={MAXIMUM_LENGTH_OF_MESSAGE}\n /* @conditional-compile-remove(mention) */\n mentionLookupOptions={mentionLookupOptions}\n >\n <InputBoxButton\n onRenderIcon={onRenderSendIcon}\n onClick={(e) => {\n if (!textValueOverflow) {\n sendMessageOnClick();\n }\n e.stopPropagation();\n }}\n id={'sendIconWrapper'}\n className={mergedSendButtonStyle}\n ariaLabel={localeStrings.sendButtonAriaLabel}\n tooltipContent={localeStrings.sendButtonAriaLabel}\n />\n </InputBoxComponent>\n {\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n onRenderFileUploads()\n }\n </Stack>\n </Stack>\n );\n};\n"]}
|
1
|
+
{"version":3,"file":"SendBox.js","sourceRoot":"","sources":["../../../../../../react-components/src/components/SendBox.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;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;YACrG,yBAAyB,EAAE,CAEvB,CACF,CACT,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport React, { useState, useMemo, useCallback } from 'react';\nimport { IStyle, ITextField, mergeStyles, concatStyleSets, Icon, Stack } from '@fluentui/react';\nimport { sendButtonStyle, sendIconStyle, sendBoxWrapperStyles, borderAndBoxShadowStyle } from './styles/SendBox.styles';\nimport { BaseCustomStyles } from '../types';\nimport { useTheme } from '../theming';\nimport { useLocale } from '../localization';\nimport { useIdentifiers } from '../identifiers';\nimport { InputBoxComponent } from './InputBoxComponent';\nimport { InputBoxButton } from './InputBoxButton';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { SendBoxErrors } from './SendBoxErrors';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { _AttachmentUploadCards } from './AttachmentUploadCards';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { AttachmentMetadata } from '../types/Attachment';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { attachmentUploadCardsStyles } from './styles/SendBox.styles';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { SendBoxErrorBarError } from './SendBoxErrorBar';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { hasCompletedAttachmentUploads, hasIncompleteAttachmentUploads } from './utils/SendBoxUtils';\nimport { MAXIMUM_LENGTH_OF_MESSAGE, isMessageTooLong, sanitizeText } from './utils/SendBoxUtils';\n/* @conditional-compile-remove(mention) */\nimport { MentionLookupOptions } from './MentionPopover';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { FluentV9ThemeProvider } from '../theming/FluentV9ThemeProvider';\n\n/**\n * Fluent styles for {@link Sendbox}.\n *\n * @public\n */\nexport interface SendBoxStylesProps extends BaseCustomStyles {\n /** Styles for the text field. */\n textField?: IStyle;\n /** styles for the text field container */\n textFieldContainer?: IStyle;\n /** Styles for the container of the send message icon. */\n sendMessageIconContainer?: IStyle;\n /** Styles for the send message icon; These styles will be ignored when a custom send message icon is provided. */\n sendMessageIcon?: IStyle;\n /** Styles for the system message; These styles will be ignored when a custom system message component is provided. */\n systemMessage?: IStyle;\n}\n\n/**\n * Strings of {@link SendBox} that can be overridden.\n *\n * @public\n */\nexport interface SendBoxStrings {\n /**\n * Placeholder text in SendBox when there is no user input\n */\n placeholderText: string;\n /**\n * The warning message when send box text length is more than max limit\n */\n textTooLong: string;\n /**\n * Aria label for send message button\n */\n sendButtonAriaLabel: string;\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n /**\n * Error message indicating that all attachment uploads are not complete.\n */\n attachmentUploadsPendingError: string;\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n /**\n * Aria label to notify user when focus is on cancel attachment upload button.\n */\n removeAttachment: string;\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n /**\n * Aria label to notify user attachment uploading starts.\n */\n uploading: string;\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n /**\n * Aria label to notify user attachment is uploaded.\n */\n uploadCompleted: string;\n}\n\n/**\n * Props for {@link SendBox}.\n *\n * @public\n */\nexport interface SendBoxProps {\n /**\n * Optional boolean to disable text box\n * @defaultValue false\n */\n disabled?: boolean;\n /**\n * Optional text for system message below text box\n */\n systemMessage?: string;\n /**\n * Optional override behavior on send button click\n */\n onSendMessage?: (content: string) => Promise<void>;\n /* @conditional-compile-remove(mention) */\n /**\n * Optional props needed to lookup suggestions in the mention scenario.\n * @beta\n */\n mentionLookupOptions?: MentionLookupOptions;\n\n /**\n * Optional callback called when user is typing\n */\n onTyping?: () => Promise<void>;\n /**\n * Optional callback to render system message below the SendBox.\n * @defaultValue MessageBar\n */\n onRenderSystemMessage?: (systemMessage: string | undefined) => React.ReactElement;\n /**\n * Optional boolean to support new line in SendBox.\n * @defaultValue false\n */\n supportNewline?: boolean;\n /**\n * Optional callback to render send button icon to the right of the SendBox.\n * @defaultValue SendBoxSendHovered icon when mouse over icon and SendBoxSend icon otherwise\n */\n onRenderIcon?: (isHover: boolean) => JSX.Element;\n /**\n * Allows users to pass in an object contains custom CSS styles.\n * @Example\n * ```\n * <SendBox styles={{ root: { background: 'blue' } }} />\n * ```\n */\n styles?: SendBoxStylesProps;\n /**\n * Optional strings to override in component\n */\n strings?: Partial<SendBoxStrings>;\n /**\n * enumerable to determine if the input box has focus on render or not.\n * When undefined nothing has focus on render\n */\n autoFocus?: 'sendBoxTextField';\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n /**\n * Optional callback to render uploaded attachments in the SendBox. The sendBox will expand\n * vertically to accommodate the uploaded attachments. Attachment uploads will\n * be rendered below the text area in sendBox.\n * @beta\n */\n onRenderAttachmentUploads?: () => JSX.Element;\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n /**\n * Optional array of active attachment uploads where each object has attributes\n * of a attachment upload like name, progress, errorMessage etc.\n * @beta\n */\n activeAttachmentUploads?: AttachmentMetadata[];\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n /**\n * Optional callback to remove the attachment upload before sending by clicking on\n * cancel icon.\n * @beta\n */\n onCancelAttachmentUpload?: (attachmentId: string) => void;\n}\n\n/**\n * Component for typing and sending messages.\n *\n * Supports sending typing notification when user starts entering text.\n * Supports an optional message below the text input field.\n *\n * @public\n */\nexport const SendBox = (props: SendBoxProps): JSX.Element => {\n const {\n disabled,\n systemMessage,\n supportNewline,\n onSendMessage,\n onTyping,\n onRenderIcon,\n onRenderSystemMessage,\n styles,\n autoFocus,\n /* @conditional-compile-remove(mention) */\n mentionLookupOptions,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n activeAttachmentUploads\n } = props;\n const theme = useTheme();\n const localeStrings = useLocale().strings.sendBox;\n const strings = { ...localeStrings, ...props.strings };\n const ids = useIdentifiers();\n\n const [textValue, setTextValue] = useState('');\n const [textValueOverflow, setTextValueOverflow] = useState(false);\n\n const sendTextFieldRef = React.useRef<ITextField>(null);\n\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n const [attachmentUploadsPendingError, setAttachmentUploadsPendingError] = useState<SendBoxErrorBarError | undefined>(\n undefined\n );\n\n const sendMessageOnClick = (): void => {\n // don't send a message when disabled\n if (disabled || textValueOverflow) {\n return;\n }\n\n // Don't send message until all attachments have been uploaded successfully\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n setAttachmentUploadsPendingError(undefined);\n\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n if (hasIncompleteAttachmentUploads(activeAttachmentUploads)) {\n setAttachmentUploadsPendingError({ message: strings.attachmentUploadsPendingError, timestamp: Date.now() });\n return;\n }\n\n const message = textValue;\n // we don't want to send empty messages including spaces, newlines, tabs\n // Message can be empty if there is a valid attachment upload\n if (\n sanitizeText(message).length > 0 ||\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */ hasCompletedAttachmentUploads(\n activeAttachmentUploads\n )\n ) {\n onSendMessage && onSendMessage(message);\n setTextValue('');\n }\n sendTextFieldRef.current?.focus();\n };\n\n const setText = (newValue?: string | undefined): void => {\n if (newValue === undefined) {\n return;\n }\n\n setTextValueOverflow(isMessageTooLong(newValue.length));\n setTextValue(newValue);\n };\n\n const textTooLongMessage = textValueOverflow ? strings.textTooLong : undefined;\n const errorMessage = systemMessage ?? textTooLongMessage;\n\n const mergedSendButtonStyle = useMemo(\n () => mergeStyles(sendButtonStyle, styles?.sendMessageIconContainer),\n [styles?.sendMessageIconContainer]\n );\n\n const mergedStyles = useMemo(() => concatStyleSets(styles), [styles]);\n\n const mergedSendIconStyle = useMemo(\n () =>\n sendIconStyle({\n theme,\n hasText: !!textValue,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */ hasAttachment:\n hasCompletedAttachmentUploads(activeAttachmentUploads),\n hasErrorMessage: !!errorMessage,\n customSendIconStyle: styles?.sendMessageIcon\n }),\n [\n theme,\n textValue,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */ activeAttachmentUploads,\n errorMessage,\n styles?.sendMessageIcon\n ]\n );\n\n const onRenderSendIcon = useCallback(\n (isHover: boolean) =>\n onRenderIcon ? (\n onRenderIcon(isHover)\n ) : (\n <Icon iconName={isHover && textValue ? 'SendBoxSendHovered' : 'SendBoxSend'} className={mergedSendIconStyle} />\n ),\n [mergedSendIconStyle, onRenderIcon, textValue]\n );\n\n // Ensure that errors are cleared when there are no attachments in sendBox\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n React.useEffect(() => {\n if (!activeAttachmentUploads?.filter((upload) => !upload.uploadError).length) {\n setAttachmentUploadsPendingError(undefined);\n }\n }, [activeAttachmentUploads]);\n\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n const sendBoxErrorsProps = useMemo(() => {\n return {\n attachmentUploadsPendingError: attachmentUploadsPendingError,\n attachmentUploadError: activeAttachmentUploads?.filter((attachmentUpload) => attachmentUpload.uploadError).pop()\n ?.uploadError\n };\n }, [activeAttachmentUploads, attachmentUploadsPendingError]);\n\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n const onRenderAttachmentUploads = useCallback(() => {\n if (!activeAttachmentUploads?.filter((upload) => !upload.uploadError).length) {\n return null;\n }\n return props.onRenderAttachmentUploads ? (\n props.onRenderAttachmentUploads()\n ) : (\n <Stack className={attachmentUploadCardsStyles}>\n <FluentV9ThemeProvider v8Theme={theme}>\n <_AttachmentUploadCards\n activeAttachmentUploads={activeAttachmentUploads}\n onCancelAttachmentUpload={props.onCancelAttachmentUpload}\n strings={{\n removeAttachment: props.strings?.removeAttachment ?? localeStrings.removeAttachment,\n uploading: props.strings?.uploading ?? localeStrings.uploading,\n uploadCompleted: props.strings?.uploadCompleted ?? localeStrings.uploadCompleted\n }}\n />\n </FluentV9ThemeProvider>\n </Stack>\n );\n }, [\n activeAttachmentUploads,\n props,\n theme,\n localeStrings.removeAttachment,\n localeStrings.uploading,\n localeStrings.uploadCompleted\n ]);\n\n return (\n <Stack\n className={mergeStyles(\n sendBoxWrapperStyles,\n { overflow: 'visible' } // This is needed for the mention popup to be visible\n )}\n >\n {\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */ <SendBoxErrors\n {...sendBoxErrorsProps}\n />\n }\n <Stack\n className={borderAndBoxShadowStyle({\n theme,\n hasErrorMessage: !!errorMessage,\n disabled: !!disabled\n })}\n >\n <InputBoxComponent\n autoFocus={autoFocus}\n data-ui-id={ids.sendboxTextField}\n disabled={disabled}\n errorMessage={onRenderSystemMessage ? onRenderSystemMessage(errorMessage) : errorMessage}\n textFieldRef={sendTextFieldRef}\n id=\"sendbox\"\n placeholderText={strings.placeholderText}\n textValue={textValue}\n onChange={(_, newValue) => setText(newValue)}\n onKeyDown={(ev) => {\n const keyWasSendingMessage = ev.key === 'Enter' && (ev.shiftKey === false || !supportNewline);\n if (!keyWasSendingMessage) {\n onTyping?.();\n }\n }}\n onEnterKeyDown={() => {\n sendMessageOnClick();\n }}\n styles={mergedStyles}\n supportNewline={supportNewline}\n maxLength={MAXIMUM_LENGTH_OF_MESSAGE}\n /* @conditional-compile-remove(mention) */\n mentionLookupOptions={mentionLookupOptions}\n >\n <InputBoxButton\n onRenderIcon={onRenderSendIcon}\n onClick={(e) => {\n if (!textValueOverflow) {\n sendMessageOnClick();\n }\n e.stopPropagation();\n }}\n id={'sendIconWrapper'}\n className={mergedSendButtonStyle}\n ariaLabel={localeStrings.sendButtonAriaLabel}\n tooltipContent={localeStrings.sendButtonAriaLabel}\n />\n </InputBoxComponent>\n {\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n onRenderAttachmentUploads()\n }\n </Stack>\n </Stack>\n );\n};\n"]}
|
package/dist/dist-esm/react-components/src/components/VideoEffects/VideoBackgroundEffectsPicker.d.ts
CHANGED
@@ -39,6 +39,14 @@ export interface _VideoBackgroundEffectsPickerProps {
|
|
39
39
|
* Styles for the picker.
|
40
40
|
*/
|
41
41
|
styles?: _VideoBackgroundEffectsPickerStyles;
|
42
|
+
/**
|
43
|
+
* Used only for jest tests. If `true`, the autofocus-on-mount will be ignored when the component mounts.
|
44
|
+
* If not, jest tries to cleanup after the first render pass, but the component throws an error because
|
45
|
+
* it tries to display a tooltip after that render pass and after the component is cleaned up.
|
46
|
+
*
|
47
|
+
* This can be removed once: https://github.com/microsoft/fluentui/issues/30896 is fixed.
|
48
|
+
*/
|
49
|
+
ignoreFocusOnMount?: boolean;
|
42
50
|
}
|
43
51
|
/**
|
44
52
|
* Option for the {@link _VideoBackgroundEffectsPicker}.
|
package/dist/dist-esm/react-components/src/components/VideoEffects/VideoBackgroundEffectsPicker.js
CHANGED
@@ -45,7 +45,7 @@ export const _VideoBackgroundEffectsPicker = (props) => {
|
|
45
45
|
return (React.createElement(Stack, { className: mergeStyles((_a = props.styles) === null || _a === void 0 ? void 0 : _a.rowRoot), wrap: props.itemsPerRow === 'wrap', horizontal: true, key: rowIndex, tokens: { childrenGap: '0.5rem' }, "data-ui-id": "video-effects-picker-row" },
|
46
46
|
options.map((option, i) => {
|
47
47
|
if (i === 0 && rowIndex === 0) {
|
48
|
-
return (React.createElement(_VideoEffectsItem, Object.assign({}, option, { itemKey: option.itemKey, key: option.itemKey, focusOnMount: true })));
|
48
|
+
return (React.createElement(_VideoEffectsItem, Object.assign({}, option, { itemKey: option.itemKey, key: option.itemKey, focusOnMount: true && !props.ignoreFocusOnMount })));
|
49
49
|
}
|
50
50
|
return React.createElement(_VideoEffectsItem, Object.assign({}, option, { itemKey: option.itemKey, key: option.itemKey }));
|
51
51
|
}),
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"VideoBackgroundEffectsPicker.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/VideoEffects/VideoBackgroundEffectsPicker.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAU,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAA0B,MAAM,oBAAoB,CAAC;AAC/E,OAAO,EAAE,qCAAqC,EAAE,MAAM,2BAA2B,CAAC;
|
1
|
+
{"version":3,"file":"VideoBackgroundEffectsPicker.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/VideoEffects/VideoBackgroundEffectsPicker.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAU,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAA0B,MAAM,oBAAoB,CAAC;AAC/E,OAAO,EAAE,qCAAqC,EAAE,MAAM,2BAA2B,CAAC;AAoFlF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,KAAyC,EAAe,EAAE;;IACtG,MAAM,CAAC,oCAAoC,EAAE,uCAAuC,CAAC,GAAG,KAAK,CAAC,QAAQ,CAEpG,KAAK,CAAC,wBAAwB,CAAC,CAAC;IAElC,+EAA+E;IAC/E,WAAW,CAAC;QACV,IAAI,EAAE,8BAA8B;QACpC,KAAK;QACL,eAAe,EAA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AC,OAAO,EAAE,QAAQ,EAAE,EAAE;;YAAC,OAAA,CACvC,oBAAC,KAAK,IACJ,SAAS,EAAE,WAAW,CAAC,MAAA,KAAK,CAAC,MAAM,0CAAE,OAAO,CAAC,EAC7C,IAAI,EAAE,KAAK,CAAC,WAAW,KAAK,MAAM,EAClC,UAAU,QACV,GAAG,EAAE,QAAQ,EACb,MAAM,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,gBACtB,0BAA0B;gBAEpC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;oBACzB,IAAI,CAAC,KAAK,CAAC,IAAI,QAAQ,KAAK,CAAC,EAAE,CAAC;wBAC9B,OAAO,CACL,oBAAC,iBAAiB,oBACZ,MAAM,IACV,OAAO,EAAE,MAAM,CAAC,OAAO,EACvB,GAAG,EAAE,MAAM,CAAC,OAAO,EACnB,YAAY,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,kBAAkB,IAC/C,CACH,CAAC;oBACJ,CAAC;oBACD,OAAO,oBAAC,iBAAiB,oBAAK,MAAM,IAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,GAAG,EAAE,MAAM,CAAC,OAAO,IAAI,CAAC;gBACzF,CAAC,CAAC;gBACD,SAAS,GAAG,CAAC;oBACZ,QAAQ,KAAK,YAAY,CAAC,MAAM,GAAG,CAAC;oBACpC,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,CAClD,oBAAC,KAAK,IACJ,GAAG,EAAE,KAAK,EACV,MAAM,EAAE,qCAAqC,gBAClC,2BAA2B,GACtC,CACH,CAAC,CACE,CACT,CAAA;SAAA,CAAC,CACI,CACT,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { IStyle, Label, mergeStyles, Stack } from '@fluentui/react';\nimport { useWarnings } from '@fluentui/react-hooks';\nimport React from 'react';\nimport { chunk } from '../utils';\nimport { _VideoEffectsItem, _VideoEffectsItemProps } from './VideoEffectsItem';\nimport { hiddenVideoEffectsItemContainerStyles } from './VideoEffectsItem.styles';\n\n/**\n * Props for {@link _VideoBackgroundEffectsPicker}\n * @internal\n */\nexport interface _VideoBackgroundEffectsPickerProps {\n /**\n * The options to display in the picker.\n */\n options: _VideoBackgroundEffectChoiceOption[];\n\n /**\n * The key of the current selected Video Background Effect.\n * If you provide this, you must maintain selection state by observing onChange events and passing a new value in when changed.\n */\n selectedEffectKey?: string;\n\n /**\n * Callback to invoke when a Video Background Effect is selected.\n * @param effectKey - The key of the Video Background Effect that was selected.\n */\n onChange?: (effectKey: string) => void;\n\n /**\n * The key of the Video Background Effect that is initially selected.\n * Only provide this if the picker is an uncontrolled component;\n * otherwise, use the `selectedEffectKey` property.\n */\n defaultSelectedEffectKey?: string;\n\n /**\n * The label to display for the picker.\n */\n label?: string;\n\n /**\n * The number of items to display per row.\n * @default 3\n */\n itemsPerRow?: 'wrap' | number;\n\n /**\n * Styles for the picker.\n */\n styles?: _VideoBackgroundEffectsPickerStyles;\n\n /**\n * Used only for jest tests. If `true`, the autofocus-on-mount will be ignored when the component mounts.\n * If not, jest tries to cleanup after the first render pass, but the component throws an error because\n * it tries to display a tooltip after that render pass and after the component is cleaned up.\n *\n * This can be removed once: https://github.com/microsoft/fluentui/issues/30896 is fixed.\n */\n ignoreFocusOnMount?: boolean;\n}\n\n/**\n * Option for the {@link _VideoBackgroundEffectsPicker}.\n * @internal\n */\nexport type _VideoBackgroundEffectChoiceOption = _VideoEffectsItemProps;\n\n/**\n * Styles for the {@link _VideoBackgroundEffectsPicker}.\n * @internal\n */\nexport interface _VideoBackgroundEffectsPickerStyles {\n /**\n * Styles for the root element.\n */\n root?: IStyle;\n\n /**\n * Styles for the label.\n */\n label?: IStyle;\n\n /**\n * Styles for the root of each row element.\n */\n rowRoot?: IStyle;\n}\n\n/**\n * Picker for choosing a Video Background Effect.\n *\n * @remarks\n * This functions similar to a radio group of buttons, where the user can select one of the options.\n *\n * @internal\n */\nexport const _VideoBackgroundEffectsPicker = (props: _VideoBackgroundEffectsPickerProps): JSX.Element => {\n const [componentControlledSelectedEffectKey, setComponentControlledSelectedEffectKey] = React.useState<\n string | undefined\n >(props.defaultSelectedEffectKey);\n\n // Warn the developer if they use the component in an incorrect controlled way.\n useWarnings({\n name: 'VideoBackgroundEffectsPicker',\n props,\n controlledUsage: {\n onChangeProp: 'onChange',\n valueProp: 'selectedEffectKey',\n defaultValueProp: 'defaultSelectedEffectKey'\n }\n });\n\n const selectedEffect = props.selectedEffectKey ?? componentControlledSelectedEffectKey;\n const setSelectedEffect = (selectedEffectKey: string): void => {\n setComponentControlledSelectedEffectKey(selectedEffectKey);\n props.onChange?.(selectedEffectKey);\n };\n\n const convertedOptions: _VideoEffectsItemProps[] = props.options.map((option) => ({\n isSelected: option.itemKey === selectedEffect,\n onSelect: () => setSelectedEffect(option.itemKey),\n ...option\n }));\n\n const itemsPerRow = props.itemsPerRow ?? 3;\n const optionsByRow = itemsPerRow === 'wrap' ? [convertedOptions] : chunk(convertedOptions, itemsPerRow);\n\n // If the final row is not full, fill it with hidden items to ensure layout.\n const fillCount = itemsPerRow === 'wrap' ? 0 : itemsPerRow - optionsByRow[optionsByRow.length - 1].length;\n\n return (\n <Stack tokens={{ childrenGap: '0.5rem' }}>\n <Label className={mergeStyles(props.styles?.label)}>{props.label}</Label>\n {optionsByRow.map((options, rowIndex) => (\n <Stack\n className={mergeStyles(props.styles?.rowRoot)}\n wrap={props.itemsPerRow === 'wrap'}\n horizontal\n key={rowIndex}\n tokens={{ childrenGap: '0.5rem' }}\n data-ui-id=\"video-effects-picker-row\"\n >\n {options.map((option, i) => {\n if (i === 0 && rowIndex === 0) {\n return (\n <_VideoEffectsItem\n {...option}\n itemKey={option.itemKey}\n key={option.itemKey}\n focusOnMount={true && !props.ignoreFocusOnMount}\n />\n );\n }\n return <_VideoEffectsItem {...option} itemKey={option.itemKey} key={option.itemKey} />;\n })}\n {fillCount > 0 &&\n rowIndex === optionsByRow.length - 1 &&\n Array.from({ length: fillCount }).map((_, index) => (\n <Stack\n key={index}\n styles={hiddenVideoEffectsItemContainerStyles}\n data-ui-id=\"video-effects-hidden-item\"\n />\n ))}\n </Stack>\n ))}\n </Stack>\n );\n};\n"]}
|
package/dist/dist-esm/react-components/src/components/VideoGallery/ParticipantVideoTileOverlay.js
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
/* @conditional-compile-remove(reaction) */
|
4
4
|
import React, { useCallback, useEffect, useState } from 'react';
|
5
5
|
/* @conditional-compile-remove(reaction) */
|
6
|
-
import { getEmojiResource } from './utils/videoGalleryLayoutUtils';
|
6
|
+
import { getEmojiFrameCount, getEmojiResource } from './utils/videoGalleryLayoutUtils';
|
7
7
|
/* @conditional-compile-remove(reaction) */
|
8
8
|
import { Stack, mergeStyles } from '@fluentui/react';
|
9
9
|
/* @conditional-compile-remove(reaction) */
|
@@ -23,7 +23,10 @@ export const ParticipantVideoTileOverlay = React.memo((props) => {
|
|
23
23
|
const [isValidImageSource, setIsValidImageSource] = useState(false);
|
24
24
|
const backgroundImageUrl = reaction !== undefined && reactionResources !== undefined
|
25
25
|
? getEmojiResource(reaction === null || reaction === void 0 ? void 0 : reaction.reactionType, reactionResources)
|
26
|
-
:
|
26
|
+
: undefined;
|
27
|
+
const frameCount = reaction !== undefined && reactionResources !== undefined
|
28
|
+
? getEmojiFrameCount(reaction === null || reaction === void 0 ? void 0 : reaction.reactionType, reactionResources)
|
29
|
+
: undefined;
|
27
30
|
const currentUnixTimeStamp = Date.now();
|
28
31
|
const receivedUnixTimestamp = reaction ? getReceivedUnixTime(reaction.receivedOn) : undefined;
|
29
32
|
const canRenderReaction = (receivedUnixTimestamp
|
@@ -43,8 +46,9 @@ export const ParticipantVideoTileOverlay = React.memo((props) => {
|
|
43
46
|
const spriteImageUrl = backgroundImageUrl !== null && backgroundImageUrl !== void 0 ? backgroundImageUrl : undefined;
|
44
47
|
const reactionContainerStyles = useCallback(() => reactionRenderingStyle({
|
45
48
|
spriteImageUrl,
|
46
|
-
emojiSize: emojiSize
|
47
|
-
|
49
|
+
emojiSize: emojiSize,
|
50
|
+
frameCount
|
51
|
+
}), [spriteImageUrl, emojiSize, frameCount]);
|
48
52
|
return (React.createElement(Stack, { className: mergeStyles(videoContainerStyles, {
|
49
53
|
display: 'flex',
|
50
54
|
justifyContent: 'center',
|