@azure/communication-react 1.14.1-alpha-202403290012 → 1.14.1-alpha-202404020012
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 +111 -204
- package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-CH6WvEGZ.js → RichTextSendBoxWrapper-BTyywbnH.js} +2 -2
- package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-CH6WvEGZ.js.map → RichTextSendBoxWrapper-BTyywbnH.js.map} +1 -1
- package/dist/dist-cjs/communication-react/{index-qxnuqL7s.js → index-Bj9ORqhl.js} +920 -779
- package/dist/dist-cjs/communication-react/index-Bj9ORqhl.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/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 +15 -24
- package/dist/dist-esm/react-components/src/components/AttachmentUploadCards.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsEditBox.js +4 -8
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsEditBox.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 +8 -5
- 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 +1 -1
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextInputBoxComponent.js +3 -3
- 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 +23 -23
- 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 +5 -5
- package/dist/dist-esm/react-components/src/components/SendBox.js +16 -16
- 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 +1 -1
- package/dist/dist-esm/react-components/src/components/styles/ReactionButton.styles.js +3 -2
- 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/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/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 +15 -88
- package/dist/dist-esm/react-components/src/types/Attachment.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/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/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 +23 -15
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.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 +29 -29
- 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 +4 -4
- 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} +10 -10
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/{FileUpload.js → AttachmentUpload.js} +12 -12
- 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} +11 -9
- 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 +3 -3
- 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 +24 -8
- package/dist/dist-esm/react-composites/src/composites/common/ControlBar/CommonCallControlBar.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 +7 -1
- 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/en-US/strings.json +6 -0
- 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
@@ -1,36 +1,5 @@
|
|
1
1
|
/// <reference types="react" />
|
2
|
-
import {
|
3
|
-
/**
|
4
|
-
* Attributes required for SendBox to show attachment uploads like name, progress etc.
|
5
|
-
* @beta
|
6
|
-
*/
|
7
|
-
export interface ActiveFileUpload {
|
8
|
-
/**
|
9
|
-
* Unique identifier for the file upload.
|
10
|
-
*/
|
11
|
-
id: string;
|
12
|
-
/**
|
13
|
-
* File name to be rendered for uploaded file.
|
14
|
-
*/
|
15
|
-
filename: string;
|
16
|
-
/**
|
17
|
-
* A number between 0 and 1 indicating the progress of the upload.
|
18
|
-
* This is unrelated to the `uploadComplete` property.
|
19
|
-
* It is only used to show the progress of the upload.
|
20
|
-
* Progress of 1 doesn't mark the upload as complete, set the `uploadComplete`
|
21
|
-
* property to true to mark the upload as complete.
|
22
|
-
*/
|
23
|
-
progress: number;
|
24
|
-
/**
|
25
|
-
* Error to be displayed to the user if the upload fails.
|
26
|
-
*/
|
27
|
-
error?: SendBoxErrorBarError;
|
28
|
-
/**
|
29
|
-
* `true` means that the upload is completed.
|
30
|
-
* This is independent of the upload `progress`.
|
31
|
-
*/
|
32
|
-
uploadComplete?: boolean;
|
33
|
-
}
|
2
|
+
import { AttachmentMetadata } from '../types/Attachment';
|
34
3
|
/**
|
35
4
|
* Strings of _AttachmentUploadCards that can be overridden.
|
36
5
|
*
|
@@ -47,17 +16,17 @@ export interface _AttachmentUploadCardsStrings {
|
|
47
16
|
/**
|
48
17
|
* @internal
|
49
18
|
*/
|
50
|
-
export interface
|
19
|
+
export interface AttachmentUploadCardsProps {
|
51
20
|
/**
|
52
21
|
* Optional array of active attachment uploads where each object has attibutes
|
53
22
|
* of a attachment upload like name, progress, errormessage etc.
|
54
23
|
*/
|
55
|
-
|
24
|
+
activeAttachmentUploads?: AttachmentMetadata[];
|
56
25
|
/**
|
57
26
|
* Optional callback to remove the attachment upload before sending by clicking on
|
58
27
|
* cancel icon.
|
59
28
|
*/
|
60
|
-
|
29
|
+
onCancelAttachmentUpload?: (attachmentId: string) => void;
|
61
30
|
/**
|
62
31
|
* Optional arialabel strings for attachment upload cards
|
63
32
|
*/
|
@@ -66,5 +35,5 @@ export interface FileUploadCardsProps {
|
|
66
35
|
/**
|
67
36
|
* @internal
|
68
37
|
*/
|
69
|
-
export declare const _AttachmentUploadCards: (props:
|
38
|
+
export declare const _AttachmentUploadCards: (props: AttachmentUploadCardsProps) => JSX.Element;
|
70
39
|
//# sourceMappingURL=AttachmentUploadCards.d.ts.map
|
@@ -4,7 +4,6 @@ import { Icon, mergeStyles } from '@fluentui/react';
|
|
4
4
|
import React, { useMemo } from 'react';
|
5
5
|
import { _AttachmentCard } from './AttachmentCard';
|
6
6
|
import { _AttachmentCardGroup } from './AttachmentCardGroup';
|
7
|
-
import { extension } from './utils';
|
8
7
|
import { useLocaleAttachmentCardStringsTrampoline } from './utils/common';
|
9
8
|
const actionIconStyle = { height: '1rem' };
|
10
9
|
/**
|
@@ -12,7 +11,7 @@ const actionIconStyle = { height: '1rem' };
|
|
12
11
|
*/
|
13
12
|
export const _AttachmentUploadCards = (props) => {
|
14
13
|
var _a;
|
15
|
-
const attachments = props.
|
14
|
+
const attachments = props.activeAttachmentUploads;
|
16
15
|
const localeStrings = useLocaleAttachmentCardStringsTrampoline();
|
17
16
|
const removeFileButtonString = useMemo(() => () => {
|
18
17
|
var _a, _b;
|
@@ -23,32 +22,24 @@ export const _AttachmentUploadCards = (props) => {
|
|
23
22
|
}
|
24
23
|
return (React.createElement(_AttachmentCardGroup, null, attachments &&
|
25
24
|
attachments
|
26
|
-
.filter((attachment) => !attachment.
|
25
|
+
.filter((attachment) => !attachment.uploadError)
|
27
26
|
.map((attachment) => {
|
28
|
-
var _a, _b
|
29
|
-
return (React.createElement(_AttachmentCard
|
30
|
-
// temp converter before upload is refactored
|
31
|
-
, {
|
32
|
-
// temp converter before upload is refactored
|
33
|
-
attachment: {
|
34
|
-
id: attachment.id,
|
35
|
-
name: attachment.filename,
|
36
|
-
extension: extension(attachment.filename),
|
37
|
-
progress: attachment.progress,
|
38
|
-
uploadStatus: attachment.error
|
39
|
-
? {
|
40
|
-
message: (_a = attachment.error) === null || _a === void 0 ? void 0 : _a.message,
|
41
|
-
timestamp: (_b = attachment.error) === null || _b === void 0 ? void 0 : _b.timestamp
|
42
|
-
}
|
43
|
-
: undefined
|
44
|
-
}, progress: attachment.progress, key: attachment.id, menuActions: [
|
27
|
+
var _a, _b;
|
28
|
+
return (React.createElement(_AttachmentCard, { attachment: attachment, key: attachment.id, menuActions: [
|
45
29
|
{
|
46
|
-
name: (
|
30
|
+
name: (_b = (_a = props.strings) === null || _a === void 0 ? void 0 : _a.removeAttachment) !== null && _b !== void 0 ? _b : 'Remove',
|
47
31
|
icon: (React.createElement("div", { "aria-label": removeFileButtonString() },
|
48
32
|
React.createElement(Icon, { iconName: "CancelAttachmentUpload", className: mergeStyles(actionIconStyle) }))),
|
49
|
-
onClick: () => {
|
50
|
-
|
51
|
-
|
33
|
+
onClick: (attachment) => {
|
34
|
+
return new Promise((resolve, reject) => {
|
35
|
+
try {
|
36
|
+
props.onCancelAttachmentUpload && props.onCancelAttachmentUpload(attachment.id);
|
37
|
+
resolve();
|
38
|
+
}
|
39
|
+
catch (e) {
|
40
|
+
reject(e.message);
|
41
|
+
}
|
42
|
+
});
|
52
43
|
}
|
53
44
|
}
|
54
45
|
], strings: props.strings }));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"AttachmentUploadCards.js","sourceRoot":"","sources":["../../../../../../react-components/src/components/AttachmentUploadCards.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;
|
1
|
+
{"version":3,"file":"AttachmentUploadCards.js","sourceRoot":"","sources":["../../../../../../react-components/src/components/AttachmentUploadCards.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,E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vC,oBAAC,IAAI,IAAC,QAAQ,EAAC,wBAAwB,EAAC,SAAS,EAAE,WAAW,CAAC,eAAe,CAAC,GAAI,CAC/E,CACP;wBACD,OAAO,EAAE,CAAC,UAAU,EAAE,EAAE;4BACtB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;gCACrC,IAAI,CAAC;oCACH,KAAK,CAAC,wBAAwB,IAAI,KAAK,CAAC,wBAAwB,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;oCAChF,OAAO,EAAE,CAAC;gCACZ,CAAC;gCAAC,OAAO,CAAC,EAAE,CAAC;oCACX,MAAM,CAAE,CAAW,CAAC,OAAO,CAAC,CAAC;gCAC/B,CAAC;4BACH,CAAC,CAAC,CAAC;wBACL,CAAC;qBACF;iBACF,EACD,OAAO,EAAE,KAAK,CAAC,OAAO,GACtB,CACH,CAAA;SAAA,CAAC,CACe,CACxB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { Icon, mergeStyles } from '@fluentui/react';\nimport React, { useMemo } from 'react';\nimport { _AttachmentCard } from './AttachmentCard';\nimport { _AttachmentCardGroup } from './AttachmentCardGroup';\nimport { AttachmentMetadata } from '../types/Attachment';\nimport { useLocaleAttachmentCardStringsTrampoline } from './utils/common';\n\n/**\n * Strings of _AttachmentUploadCards that can be overridden.\n *\n * @internal\n */\nexport interface _AttachmentUploadCardsStrings {\n /** Aria label to notify user when focus is on cancel attachment upload button. */\n removeAttachment: string;\n /** Aria label to notify user attachment uploading starts. */\n uploading: string;\n /** Aria label to notify user attachment is uploaded. */\n uploadCompleted: string;\n}\n\n/**\n * @internal\n */\nexport interface AttachmentUploadCardsProps {\n /**\n * Optional array of active attachment uploads where each object has attibutes\n * of a attachment upload like name, progress, errormessage etc.\n */\n activeAttachmentUploads?: AttachmentMetadata[];\n /**\n * Optional callback to remove the attachment upload before sending by clicking on\n * cancel icon.\n */\n onCancelAttachmentUpload?: (attachmentId: string) => void;\n /**\n * Optional arialabel strings for attachment upload cards\n */\n strings?: _AttachmentUploadCardsStrings;\n}\n\nconst actionIconStyle = { height: '1rem' };\n\n/**\n * @internal\n */\nexport const _AttachmentUploadCards = (props: AttachmentUploadCardsProps): JSX.Element => {\n const attachments = props.activeAttachmentUploads;\n const localeStrings = useLocaleAttachmentCardStringsTrampoline();\n const removeFileButtonString = useMemo(\n () => () => {\n return props.strings?.removeAttachment ?? localeStrings.removeAttachment;\n },\n [props.strings?.removeAttachment, localeStrings.removeAttachment]\n );\n\n if (!attachments || attachments.length === 0) {\n return <></>;\n }\n\n return (\n <_AttachmentCardGroup>\n {attachments &&\n attachments\n .filter((attachment) => !attachment.uploadError)\n .map((attachment) => (\n <_AttachmentCard\n attachment={attachment}\n key={attachment.id}\n menuActions={[\n {\n name: props.strings?.removeAttachment ?? 'Remove',\n icon: (\n <div aria-label={removeFileButtonString()}>\n <Icon iconName=\"CancelAttachmentUpload\" className={mergeStyles(actionIconStyle)} />\n </div>\n ),\n onClick: (attachment) => {\n return new Promise((resolve, reject) => {\n try {\n props.onCancelAttachmentUpload && props.onCancelAttachmentUpload(attachment.id);\n resolve();\n } catch (e) {\n reject((e as Error).message);\n }\n });\n }\n }\n ]}\n strings={props.strings}\n />\n ))}\n </_AttachmentCardGroup>\n );\n};\n"]}
|
package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsEditBox.js
CHANGED
@@ -57,15 +57,11 @@ export const ChatMessageComponentAsEditBox = (props) => {
|
|
57
57
|
return concatStyleSets(editBoxStyleSet, { textField: { borderColor: theme.palette.themePrimary } });
|
58
58
|
}, [theme.palette.themePrimary]);
|
59
59
|
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
|
60
|
-
const
|
60
|
+
const onRenderAttachmentUploads = useCallback(() => {
|
61
61
|
return (!!attachmentMetadata &&
|
62
62
|
attachmentMetadata.length > 0 && (React.createElement("div", { style: { margin: '0.25rem' } },
|
63
|
-
React.createElement(_AttachmentUploadCards, {
|
64
|
-
|
65
|
-
filename: file.name,
|
66
|
-
progress: 1
|
67
|
-
})), onCancelFileUpload: (fileId) => {
|
68
|
-
setAttachedFilesMetadata(attachmentMetadata === null || attachmentMetadata === void 0 ? void 0 : attachmentMetadata.filter((file) => file.name !== fileId));
|
63
|
+
React.createElement(_AttachmentUploadCards, { activeAttachmentUploads: attachmentMetadata, onCancelAttachmentUpload: (fileId) => {
|
64
|
+
setAttachedFilesMetadata(attachmentMetadata === null || attachmentMetadata === void 0 ? void 0 : attachmentMetadata.filter((file) => file.id !== fileId));
|
69
65
|
} }))));
|
70
66
|
}, [attachmentMetadata]);
|
71
67
|
const getContent = () => {
|
@@ -99,7 +95,7 @@ export const ChatMessageComponentAsEditBox = (props) => {
|
|
99
95
|
});
|
100
96
|
e.stopPropagation();
|
101
97
|
}, id: 'submitIconWrapper' }))),
|
102
|
-
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
|
98
|
+
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */ onRenderAttachmentUploads()));
|
103
99
|
};
|
104
100
|
const attached = message.attached === true ? 'center' : message.attached === 'bottom' ? 'bottom' : 'top';
|
105
101
|
return (React.createElement(ChatMyMessage, { attached: attached, root: {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ChatMessageComponentAsEditBox.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/ChatMessage/ChatMessageComponentAsEditBox.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,eAAe,EAAc,WAAW,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAClF,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,sCAAgC;AACxD,OAAO,EAAE,QAAQ,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AAO,CAAC,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC,CAAC,mBAAmB,CAAC,WAAW,EACrG,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAClE;SACF,IAEA,UAAU,EAAE,CACC,CACjB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { concatStyleSets, ITextField, mergeStyles, Stack } from '@fluentui/react';\nimport { ChatMyMessage } from '@fluentui-contrib/react-chat';\nimport { mergeClasses } from '@fluentui/react-components';\nimport { _formatString } from '@internal/acs-ui-common';\nimport { useTheme } from '../../theming/FluentThemeProvider';\nimport React, { useCallback, useEffect, useMemo, useState } from 'react';\nimport { editBoxStyle, editingButtonStyle, editBoxStyleSet, inputBoxIcon } from '../styles/EditBox.styles';\nimport { InputBoxComponent } from '../InputBoxComponent';\nimport { InputBoxButton } from '../InputBoxButton';\nimport { MessageThreadStrings } from '../MessageThread';\nimport { useChatMyMessageStyles } from '../styles/MessageThread.styles';\nimport { ChatMessage } from '../../types';\nimport { _AttachmentUploadCards } from '../AttachmentUploadCards';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { AttachmentMetadata } from '../../types/Attachment';\nimport {\n chatMessageFailedTagStyle,\n editChatMessageFailedTagStyle,\n chatMessageFailedTagStackItemStyle,\n editChatMessageButtonsStackStyle,\n useChatMessageEditContainerStyles\n} from '../styles/ChatMessageComponent.styles';\n/* @conditional-compile-remove(mention) */\nimport { MentionLookupOptions } from '../MentionPopover';\nimport { MAXIMUM_LENGTH_OF_MESSAGE } from '../utils/SendBoxUtils';\nimport { getMessageState, onRenderCancelIcon, onRenderSubmitIcon } from '../utils/ChatMessageComponentAsEditBoxUtils';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { getMessageAttachedFilesMetadata } from '../utils/ChatMessageComponentAsEditBoxUtils';\n\n/** @private */\nexport type ChatMessageComponentAsEditBoxProps = {\n onCancel?: (messageId: string) => void;\n onSubmit: (\n text: string,\n metadata?: Record<string, string>,\n options?: {\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n attachmentMetadata?: AttachmentMetadata[];\n }\n ) => void;\n message: ChatMessage;\n strings: MessageThreadStrings;\n /* @conditional-compile-remove(mention) */\n mentionLookupOptions?: MentionLookupOptions;\n};\n\n/**\n * @private\n */\nexport const ChatMessageComponentAsEditBox = (props: ChatMessageComponentAsEditBoxProps): JSX.Element => {\n const { onCancel, onSubmit, strings, message } = props;\n /* @conditional-compile-remove(mention) */\n const { mentionLookupOptions } = props;\n\n const [textValue, setTextValue] = useState<string>(message.content || '');\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n const [attachmentMetadata, setAttachedFilesMetadata] = React.useState(getMessageAttachedFilesMetadata(message));\n const editTextFieldRef = React.useRef<ITextField>(null);\n const theme = useTheme();\n const messageState = getMessageState(\n textValue,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */ attachmentMetadata ??\n []\n );\n const submitEnabled = messageState === 'OK';\n\n const editContainerStyles = useChatMessageEditContainerStyles();\n const chatMyMessageStyles = useChatMyMessageStyles();\n\n useEffect(() => {\n editTextFieldRef.current?.focus();\n }, []);\n\n const setText = (event?: React.FormEvent<HTMLInputElement | HTMLTextAreaElement>, newValue?: string): void => {\n setTextValue(newValue ?? '');\n };\n\n const textTooLongMessage =\n messageState === 'too long'\n ? _formatString(strings.editBoxTextLimit, { limitNumber: `${MAXIMUM_LENGTH_OF_MESSAGE}` })\n : undefined;\n\n const iconClassName = useCallback(\n (isHover: boolean) => {\n const color = isHover ? theme.palette.accent : theme.palette.neutralSecondary;\n return mergeStyles(inputBoxIcon, { color });\n },\n [theme.palette.accent, theme.palette.neutralSecondary]\n );\n\n const onRenderThemedCancelIcon = useCallback(\n (isHover: boolean) => {\n return onRenderCancelIcon(iconClassName(isHover));\n },\n [iconClassName]\n );\n\n const onRenderThemedSubmitIcon = useCallback(\n (isHover: boolean) => {\n return onRenderSubmitIcon(iconClassName(isHover));\n },\n [iconClassName]\n );\n\n const editBoxStyles = useMemo(() => {\n return concatStyleSets(editBoxStyleSet, { textField: { borderColor: theme.palette.themePrimary } });\n }, [theme.palette.themePrimary]);\n\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n const onRenderFileUploads = useCallback(() => {\n return (\n !!attachmentMetadata &&\n attachmentMetadata.length > 0 && (\n <div style={{ margin: '0.25rem' }}>\n <_AttachmentUploadCards\n activeFileUploads={attachmentMetadata?.map((file) => ({\n id: file.name,\n filename: file.name,\n progress: 1\n }))}\n onCancelFileUpload={(fileId) => {\n setAttachedFilesMetadata(attachmentMetadata?.filter((file) => file.name !== fileId));\n }}\n />\n </div>\n )\n );\n }, [attachmentMetadata]);\n\n const getContent = (): JSX.Element => {\n return (\n <>\n <InputBoxComponent\n data-ui-id=\"edit-box\"\n textFieldRef={editTextFieldRef}\n inputClassName={editBoxStyle}\n placeholderText={strings.editBoxPlaceholderText}\n textValue={textValue}\n onChange={setText}\n onKeyDown={(ev) => {\n if (ev.key === 'ArrowUp' || ev.key === 'ArrowDown') {\n ev.stopPropagation();\n }\n }}\n onEnterKeyDown={() => {\n submitEnabled &&\n onSubmit(\n textValue,\n message.metadata,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */ {\n attachmentMetadata\n }\n );\n }}\n supportNewline={false}\n maxLength={MAXIMUM_LENGTH_OF_MESSAGE}\n errorMessage={textTooLongMessage}\n styles={editBoxStyles}\n /* @conditional-compile-remove(mention) */\n mentionLookupOptions={mentionLookupOptions}\n ></InputBoxComponent>\n <Stack\n horizontal\n horizontalAlign=\"end\"\n className={editChatMessageButtonsStackStyle}\n tokens={{ childrenGap: '0.25rem' }}\n >\n {message.failureReason && (\n <Stack.Item grow align=\"stretch\" className={chatMessageFailedTagStackItemStyle}>\n <div className={mergeStyles(chatMessageFailedTagStyle(theme), editChatMessageFailedTagStyle)}>\n {message.failureReason}\n </div>\n </Stack.Item>\n )}\n <Stack.Item align=\"end\">\n <InputBoxButton\n className={editingButtonStyle}\n ariaLabel={strings.editBoxCancelButton}\n tooltipContent={strings.editBoxCancelButton}\n onRenderIcon={onRenderThemedCancelIcon}\n onClick={() => {\n onCancel && onCancel(message.messageId);\n }}\n id={'dismissIconWrapper'}\n />\n </Stack.Item>\n <Stack.Item align=\"end\">\n <InputBoxButton\n className={editingButtonStyle}\n ariaLabel={strings.editBoxSubmitButton}\n tooltipContent={strings.editBoxSubmitButton}\n onRenderIcon={onRenderThemedSubmitIcon}\n onClick={(e) => {\n submitEnabled &&\n onSubmit(\n textValue,\n message.metadata,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */ {\n attachmentMetadata\n }\n );\n e.stopPropagation();\n }}\n id={'submitIconWrapper'}\n />\n </Stack.Item>\n </Stack>\n {\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */ onRenderFileUploads()\n }\n </>\n );\n };\n\n const attached = message.attached === true ? 'center' : message.attached === 'bottom' ? 'bottom' : 'top';\n return (\n <ChatMyMessage\n attached={attached}\n root={{\n className: chatMyMessageStyles.root\n }}\n body={{\n className: mergeClasses(\n editContainerStyles.body,\n message.failureReason !== undefined ? editContainerStyles.bodyError : editContainerStyles.bodyDefault,\n attached !== 'top' ? editContainerStyles.bodyAttached : undefined\n )\n }}\n >\n {getContent()}\n </ChatMyMessage>\n );\n};\n"]}
|
1
|
+
{"version":3,"file":"ChatMessageComponentAsEditBox.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/ChatMessage/ChatMessageComponentAsEditBox.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,eAAe,EAAc,WAAW,EAAE,KAAK,EAAE,MAAM,iBAAiB,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CAAC,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC,CAAC,mBAAmB,CAAC,WAAW,EACrG,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAClE;SACF,IAEA,UAAU,EAAE,CACC,CACjB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { concatStyleSets, ITextField, mergeStyles, Stack } from '@fluentui/react';\nimport { ChatMyMessage } from '@fluentui-contrib/react-chat';\nimport { mergeClasses } from '@fluentui/react-components';\nimport { _formatString } from '@internal/acs-ui-common';\nimport { useTheme } from '../../theming/FluentThemeProvider';\nimport React, { useCallback, useEffect, useMemo, useState } from 'react';\nimport { editBoxStyle, editingButtonStyle, editBoxStyleSet, inputBoxIcon } from '../styles/EditBox.styles';\nimport { InputBoxComponent } from '../InputBoxComponent';\nimport { InputBoxButton } from '../InputBoxButton';\nimport { MessageThreadStrings } from '../MessageThread';\nimport { useChatMyMessageStyles } from '../styles/MessageThread.styles';\nimport { ChatMessage } from '../../types';\nimport { _AttachmentUploadCards } from '../AttachmentUploadCards';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { AttachmentMetadata } from '../../types/Attachment';\nimport {\n chatMessageFailedTagStyle,\n editChatMessageFailedTagStyle,\n chatMessageFailedTagStackItemStyle,\n editChatMessageButtonsStackStyle,\n useChatMessageEditContainerStyles\n} from '../styles/ChatMessageComponent.styles';\n/* @conditional-compile-remove(mention) */\nimport { MentionLookupOptions } from '../MentionPopover';\nimport { MAXIMUM_LENGTH_OF_MESSAGE } from '../utils/SendBoxUtils';\nimport { getMessageState, onRenderCancelIcon, onRenderSubmitIcon } from '../utils/ChatMessageComponentAsEditBoxUtils';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { getMessageAttachedFilesMetadata } from '../utils/ChatMessageComponentAsEditBoxUtils';\n\n/** @private */\nexport type ChatMessageComponentAsEditBoxProps = {\n onCancel?: (messageId: string) => void;\n onSubmit: (\n text: string,\n metadata?: Record<string, string>,\n options?: {\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n attachmentMetadata?: AttachmentMetadata[];\n }\n ) => void;\n message: ChatMessage;\n strings: MessageThreadStrings;\n /* @conditional-compile-remove(mention) */\n mentionLookupOptions?: MentionLookupOptions;\n};\n\n/**\n * @private\n */\nexport const ChatMessageComponentAsEditBox = (props: ChatMessageComponentAsEditBoxProps): JSX.Element => {\n const { onCancel, onSubmit, strings, message } = props;\n /* @conditional-compile-remove(mention) */\n const { mentionLookupOptions } = props;\n\n const [textValue, setTextValue] = useState<string>(message.content || '');\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n const [attachmentMetadata, setAttachedFilesMetadata] = React.useState(getMessageAttachedFilesMetadata(message));\n const editTextFieldRef = React.useRef<ITextField>(null);\n const theme = useTheme();\n const messageState = getMessageState(\n textValue,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */ attachmentMetadata ??\n []\n );\n const submitEnabled = messageState === 'OK';\n\n const editContainerStyles = useChatMessageEditContainerStyles();\n const chatMyMessageStyles = useChatMyMessageStyles();\n\n useEffect(() => {\n editTextFieldRef.current?.focus();\n }, []);\n\n const setText = (event?: React.FormEvent<HTMLInputElement | HTMLTextAreaElement>, newValue?: string): void => {\n setTextValue(newValue ?? '');\n };\n\n const textTooLongMessage =\n messageState === 'too long'\n ? _formatString(strings.editBoxTextLimit, { limitNumber: `${MAXIMUM_LENGTH_OF_MESSAGE}` })\n : undefined;\n\n const iconClassName = useCallback(\n (isHover: boolean) => {\n const color = isHover ? theme.palette.accent : theme.palette.neutralSecondary;\n return mergeStyles(inputBoxIcon, { color });\n },\n [theme.palette.accent, theme.palette.neutralSecondary]\n );\n\n const onRenderThemedCancelIcon = useCallback(\n (isHover: boolean) => {\n return onRenderCancelIcon(iconClassName(isHover));\n },\n [iconClassName]\n );\n\n const onRenderThemedSubmitIcon = useCallback(\n (isHover: boolean) => {\n return onRenderSubmitIcon(iconClassName(isHover));\n },\n [iconClassName]\n );\n\n const editBoxStyles = useMemo(() => {\n return concatStyleSets(editBoxStyleSet, { textField: { borderColor: theme.palette.themePrimary } });\n }, [theme.palette.themePrimary]);\n\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n const onRenderAttachmentUploads = useCallback(() => {\n return (\n !!attachmentMetadata &&\n attachmentMetadata.length > 0 && (\n <div style={{ margin: '0.25rem' }}>\n <_AttachmentUploadCards\n activeAttachmentUploads={attachmentMetadata}\n onCancelAttachmentUpload={(fileId) => {\n setAttachedFilesMetadata(attachmentMetadata?.filter((file) => file.id !== fileId));\n }}\n />\n </div>\n )\n );\n }, [attachmentMetadata]);\n\n const getContent = (): JSX.Element => {\n return (\n <>\n <InputBoxComponent\n data-ui-id=\"edit-box\"\n textFieldRef={editTextFieldRef}\n inputClassName={editBoxStyle}\n placeholderText={strings.editBoxPlaceholderText}\n textValue={textValue}\n onChange={setText}\n onKeyDown={(ev) => {\n if (ev.key === 'ArrowUp' || ev.key === 'ArrowDown') {\n ev.stopPropagation();\n }\n }}\n onEnterKeyDown={() => {\n submitEnabled &&\n onSubmit(\n textValue,\n message.metadata,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */ {\n attachmentMetadata\n }\n );\n }}\n supportNewline={false}\n maxLength={MAXIMUM_LENGTH_OF_MESSAGE}\n errorMessage={textTooLongMessage}\n styles={editBoxStyles}\n /* @conditional-compile-remove(mention) */\n mentionLookupOptions={mentionLookupOptions}\n ></InputBoxComponent>\n <Stack\n horizontal\n horizontalAlign=\"end\"\n className={editChatMessageButtonsStackStyle}\n tokens={{ childrenGap: '0.25rem' }}\n >\n {message.failureReason && (\n <Stack.Item grow align=\"stretch\" className={chatMessageFailedTagStackItemStyle}>\n <div className={mergeStyles(chatMessageFailedTagStyle(theme), editChatMessageFailedTagStyle)}>\n {message.failureReason}\n </div>\n </Stack.Item>\n )}\n <Stack.Item align=\"end\">\n <InputBoxButton\n className={editingButtonStyle}\n ariaLabel={strings.editBoxCancelButton}\n tooltipContent={strings.editBoxCancelButton}\n onRenderIcon={onRenderThemedCancelIcon}\n onClick={() => {\n onCancel && onCancel(message.messageId);\n }}\n id={'dismissIconWrapper'}\n />\n </Stack.Item>\n <Stack.Item align=\"end\">\n <InputBoxButton\n className={editingButtonStyle}\n ariaLabel={strings.editBoxSubmitButton}\n tooltipContent={strings.editBoxSubmitButton}\n onRenderIcon={onRenderThemedSubmitIcon}\n onClick={(e) => {\n submitEnabled &&\n onSubmit(\n textValue,\n message.metadata,\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */ {\n attachmentMetadata\n }\n );\n e.stopPropagation();\n }}\n id={'submitIconWrapper'}\n />\n </Stack.Item>\n </Stack>\n {\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */ onRenderAttachmentUploads()\n }\n </>\n );\n };\n\n const attached = message.attached === true ? 'center' : message.attached === 'bottom' ? 'bottom' : 'top';\n return (\n <ChatMyMessage\n attached={attached}\n root={{\n className: chatMyMessageStyles.root\n }}\n body={{\n className: mergeClasses(\n editContainerStyles.body,\n message.failureReason !== undefined ? editContainerStyles.bodyError : editContainerStyles.bodyDefault,\n attached !== 'top' ? editContainerStyles.bodyAttached : undefined\n )\n }}\n >\n {getContent()}\n </ChatMyMessage>\n );\n};\n"]}
|
@@ -12,6 +12,10 @@ export interface EndCallButtonStrings {
|
|
12
12
|
label: string;
|
13
13
|
/** Tooltip content. */
|
14
14
|
tooltipContent?: string;
|
15
|
+
/** Label for leave option when ending call */
|
16
|
+
leaveOption?: string;
|
17
|
+
/** Label for end the whole call option when ending call */
|
18
|
+
endCallOption?: string;
|
15
19
|
}
|
16
20
|
/**
|
17
21
|
* Props for {@link EndCallButton}.
|
@@ -23,7 +27,12 @@ export interface EndCallButtonProps extends ControlBarButtonProps {
|
|
23
27
|
* Utility property for using this component with `communication react eventHandlers`.
|
24
28
|
* Maps directly to the `onClick` property.
|
25
29
|
*/
|
26
|
-
onHangUp?: () => Promise<void>;
|
30
|
+
onHangUp?: (forEveryone?: boolean) => Promise<void>;
|
31
|
+
/**
|
32
|
+
* Set this to true to make it a split button.
|
33
|
+
* The split arrow will trigger a contextual menu to allow end for everyone or just for the user.
|
34
|
+
*/
|
35
|
+
enableEndCallMenu?: boolean;
|
27
36
|
/**
|
28
37
|
* Optional strings to override in component
|
29
38
|
*/
|
@@ -1,6 +1,5 @@
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
2
2
|
// Licensed under the MIT License.
|
3
|
-
var _a, _b;
|
4
3
|
import { concatStyleSets, Icon } from '@fluentui/react';
|
5
4
|
import React from 'react';
|
6
5
|
import { useLocale } from '../localization';
|
@@ -8,6 +7,8 @@ import { useTheme } from '../theming';
|
|
8
7
|
import { darkTheme, lightTheme } from '../theming/themes';
|
9
8
|
import { isDarkThemed } from '../theming/themeUtils';
|
10
9
|
import { ControlBarButton } from './ControlBarButton';
|
10
|
+
/* @conditional-compile-remove(end-call-options) */
|
11
|
+
import { _preventDismissOnEvent as preventDismissOnEvent } from "../../../acs-ui-common/src";
|
11
12
|
const onRenderEndCallIcon = () => React.createElement(Icon, { iconName: "ControlButtonEndCall" });
|
12
13
|
/**
|
13
14
|
* A button to end an ongoing call.
|
@@ -17,68 +18,109 @@ const onRenderEndCallIcon = () => React.createElement(Icon, { iconName: "Control
|
|
17
18
|
* @public
|
18
19
|
*/
|
19
20
|
export const EndCallButton = (props) => {
|
20
|
-
var _a, _b
|
21
|
-
const { styles } = props;
|
21
|
+
var _a, _b;
|
22
|
+
const { styles, /* @conditional-compile-remove(end-call-options) */ enableEndCallMenu, onHangUp } = props;
|
22
23
|
const localeStrings = useLocale().strings.endCallButton;
|
23
24
|
const strings = Object.assign(Object.assign({}, localeStrings), props.strings);
|
24
25
|
const theme = useTheme();
|
25
26
|
const isDarkTheme = isDarkThemed(theme);
|
26
27
|
const componentStyles = concatStyleSets(isDarkTheme ? darkThemeCallButtonStyles : lightThemeCallButtonStyles, styles !== null && styles !== void 0 ? styles : {});
|
27
|
-
|
28
|
+
/* @conditional-compile-remove(end-call-options) */
|
29
|
+
const defaultMenuProps = {
|
30
|
+
items: [
|
31
|
+
{
|
32
|
+
key: 'endForSelf',
|
33
|
+
text: localeStrings.leaveOption,
|
34
|
+
title: localeStrings.leaveOption,
|
35
|
+
onClick: () => {
|
36
|
+
onHangUp && onHangUp(false);
|
37
|
+
}
|
38
|
+
},
|
39
|
+
{
|
40
|
+
key: 'endForEveryone',
|
41
|
+
text: localeStrings.endCallOption,
|
42
|
+
title: localeStrings.endCallOption,
|
43
|
+
onClick: () => {
|
44
|
+
onHangUp && onHangUp(true);
|
45
|
+
}
|
46
|
+
}
|
47
|
+
],
|
48
|
+
styles: props.styles,
|
49
|
+
calloutProps: {
|
50
|
+
styles: {
|
51
|
+
root: {
|
52
|
+
maxWidth: '95%'
|
53
|
+
}
|
54
|
+
},
|
55
|
+
preventDismissOnEvent
|
56
|
+
}
|
57
|
+
};
|
58
|
+
return (React.createElement(React.Fragment, null,
|
59
|
+
React.createElement(ControlBarButton, Object.assign({}, props, {
|
60
|
+
/* @conditional-compile-remove(end-call-options) */
|
61
|
+
menuProps: enableEndCallMenu ? defaultMenuProps : undefined, onClick: onHangUp ? () => onHangUp() : props.onClick, styles: componentStyles, onRenderIcon: (_a = props.onRenderIcon) !== null && _a !== void 0 ? _a : onRenderEndCallIcon, strings: strings, labelKey: (_b = props.labelKey) !== null && _b !== void 0 ? _b : 'endCallButtonLabel' }))));
|
28
62
|
};
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
63
|
+
const getButtonStyles = (theme) => {
|
64
|
+
var _a;
|
65
|
+
return ({
|
66
|
+
regular: {
|
67
|
+
color: theme.callingPalette.iconWhite,
|
68
|
+
background: theme.callingPalette.callRed,
|
69
|
+
'@media (forced-colors: active)': {
|
70
|
+
forcedColorAdjust: 'auto',
|
71
|
+
border: `1px ${(_a = theme.palette) === null || _a === void 0 ? void 0 : _a.neutralQuaternaryAlt} solid`
|
72
|
+
},
|
73
|
+
' i': {
|
74
|
+
color: theme.callingPalette.iconWhite
|
75
|
+
},
|
76
|
+
':focus::after': { outlineColor: `${theme.callingPalette.iconWhite} !important` } // added !important to avoid override by FluentUI button styles
|
37
77
|
},
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
78
|
+
pressed: {
|
79
|
+
color: theme.callingPalette.iconWhite,
|
80
|
+
background: theme.callingPalette.callRedDarker,
|
81
|
+
border: 'none',
|
82
|
+
' i': {
|
83
|
+
color: theme.callingPalette.iconWhite
|
84
|
+
},
|
85
|
+
'@media (forced-colors: active)': {
|
86
|
+
forcedColorAdjust: 'auto'
|
87
|
+
}
|
88
|
+
},
|
89
|
+
hovered: {
|
90
|
+
color: theme.callingPalette.iconWhite,
|
91
|
+
background: theme.callingPalette.callRedDark,
|
92
|
+
border: 'none',
|
93
|
+
' i': {
|
94
|
+
color: theme.callingPalette.iconWhite
|
95
|
+
},
|
96
|
+
'@media (forced-colors: active)': {
|
97
|
+
forcedColorAdjust: 'auto'
|
98
|
+
}
|
52
99
|
}
|
53
|
-
}
|
100
|
+
});
|
101
|
+
};
|
102
|
+
const darkThemeButtonStyles = getButtonStyles(darkTheme);
|
103
|
+
const lightThemeButtonStyles = getButtonStyles(lightTheme);
|
104
|
+
// using media query to prevent windows from overwriting the button color
|
105
|
+
const darkThemeCallButtonStyles = {
|
106
|
+
root: darkThemeButtonStyles.regular,
|
107
|
+
rootHovered: darkThemeButtonStyles.hovered,
|
108
|
+
rootPressed: darkThemeButtonStyles.pressed,
|
54
109
|
label: {
|
55
110
|
color: darkTheme.callingPalette.iconWhite
|
56
|
-
}
|
111
|
+
},
|
112
|
+
splitButtonMenuButton: Object.assign(Object.assign({}, darkThemeButtonStyles.regular), { borderTop: 'none', borderRight: 'none', borderBottom: 'none', '&:hover': darkThemeButtonStyles.hovered }),
|
113
|
+
splitButtonMenuButtonChecked: darkThemeButtonStyles.hovered,
|
114
|
+
splitButtonMenuButtonExpanded: darkThemeButtonStyles.pressed
|
57
115
|
};
|
58
116
|
const lightThemeCallButtonStyles = {
|
59
|
-
root:
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
':focus::after': { outlineColor: `${lightTheme.callingPalette.iconWhite} !important` } // added !important to avoid override by FluentUI button styles
|
67
|
-
},
|
68
|
-
rootHovered: {
|
69
|
-
color: lightTheme.callingPalette.iconWhite,
|
70
|
-
background: lightTheme.callingPalette.callRed,
|
71
|
-
'@media (forced-colors: active)': {
|
72
|
-
forcedColorAdjust: 'auto'
|
73
|
-
}
|
74
|
-
},
|
75
|
-
rootPressed: {
|
76
|
-
color: lightTheme.callingPalette.iconWhite,
|
77
|
-
background: lightTheme.callingPalette.callRed,
|
78
|
-
'@media (forced-colors: active)': {
|
79
|
-
forcedColorAdjust: 'auto'
|
80
|
-
}
|
81
|
-
},
|
117
|
+
root: lightThemeButtonStyles.regular,
|
118
|
+
rootHovered: lightThemeButtonStyles.hovered,
|
119
|
+
rootPressed: lightThemeButtonStyles.pressed,
|
120
|
+
splitButtonMenuButton: Object.assign(Object.assign({}, lightThemeButtonStyles.regular), { borderTop: 'none', borderRight: 'none', borderBottom: 'none', '&:hover': lightThemeButtonStyles.hovered }),
|
121
|
+
splitButtonMenuButtonChecked: lightThemeButtonStyles.hovered,
|
122
|
+
splitButtonMenuButtonExpanded: lightThemeButtonStyles.pressed,
|
123
|
+
splitButtonMenuFocused: lightThemeButtonStyles.pressed,
|
82
124
|
label: {
|
83
125
|
color: lightTheme.callingPalette.iconWhite
|
84
126
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"EndCallButton.js","sourceRoot":"","sources":["../../../../../../react-components/src/components/EndCallButton.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAElC,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAyB,MAAM,oBAAoB,CAAC;AAkC7E,MAAM,mBAAmB,GAAG,GAAgB,EAAE,CAAC,oBAAC,IAAI,IAAC,QAAQ,EAAC,sBAAsB,GAAG,CAAC;AAExF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAyB,EAAe,EAAE;;IACtE,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IAEzB,MAAM,aAAa,GAAG,SAAS,EAAE,CAAC,OAAO,CAAC,aAAa,CAAC;IACxD,MAAM,OAAO,mCAAQ,aAAa,GAAK,KAAK,CAAC,OAAO,CAAE,CAAC;IAEvD,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,MAAM,WAAW,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;IACxC,MAAM,eAAe,GAAG,eAAe,CACrC,WAAW,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,0BAA0B,EACpE,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,EAAE,CACb,CAAC;IAEF,OAAO,CACL,oBAAC,gBAAgB,oBACX,KAAK,IACT,OAAO,EAAE,MAAA,KAAK,CAAC,QAAQ,mCAAI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EAAE,OAAO,MAAA,UAAU,CAAC,OAAO,0CAAE,oBAAoB,QAAQ;SAChE;QACD,eAAe,EAAE,EAAE,YAAY,EAAE,GAAG,UAAU,CAAC,cAAc,CAAC,SAAS,aAAa,EAAE,CAAC,+DAA+D;KACvJ;IACD,WAAW,EAAE;QACX,KAAK,EAAE,UAAU,CAAC,cAAc,CAAC,SAAS;QAC1C,UAAU,EAAE,UAAU,CAAC,cAAc,CAAC,OAAO;QAC7C,gCAAgC,EAAE;YAChC,iBAAiB,EAAE,MAAM;SAC1B;KACF;IACD,WAAW,EAAE;QACX,KAAK,EAAE,UAAU,CAAC,cAAc,CAAC,SAAS;QAC1C,UAAU,EAAE,UAAU,CAAC,cAAc,CAAC,OAAO;QAC7C,gCAAgC,EAAE;YAChC,iBAAiB,EAAE,MAAM;SAC1B;KACF;IACD,KAAK,EAAE;QACL,KAAK,EAAE,UAAU,CAAC,cAAc,CAAC,SAAS;KAC3C;CACF,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { concatStyleSets, Icon } from '@fluentui/react';\nimport React from 'react';\nimport { useLocale } from '../localization';\nimport { useTheme } from '../theming';\nimport { darkTheme, lightTheme } from '../theming/themes';\nimport { isDarkThemed } from '../theming/themeUtils';\nimport { ControlBarButton, ControlBarButtonProps } from './ControlBarButton';\n\n/**\n * Strings of {@link EndCallButton} that can be overridden.\n *\n * @public\n */\nexport interface EndCallButtonStrings {\n /**\n * Label of button\n */\n label: string;\n /** Tooltip content. */\n tooltipContent?: string;\n}\n\n/**\n * Props for {@link EndCallButton}.\n *\n * @public\n */\nexport interface EndCallButtonProps extends ControlBarButtonProps {\n /**\n * Utility property for using this component with `communication react eventHandlers`.\n * Maps directly to the `onClick` property.\n */\n onHangUp?: () => Promise<void>;\n\n /**\n * Optional strings to override in component\n */\n strings?: EndCallButtonStrings;\n}\n\nconst onRenderEndCallIcon = (): JSX.Element => <Icon iconName=\"ControlButtonEndCall\" />;\n\n/**\n * A button to end an ongoing call.\n *\n * Can be used with {@link ControlBar}.\n *\n * @public\n */\nexport const EndCallButton = (props: EndCallButtonProps): JSX.Element => {\n const { styles } = props;\n\n const localeStrings = useLocale().strings.endCallButton;\n const strings = { ...localeStrings, ...props.strings };\n\n const theme = useTheme();\n const isDarkTheme = isDarkThemed(theme);\n const componentStyles = concatStyleSets(\n isDarkTheme ? darkThemeCallButtonStyles : lightThemeCallButtonStyles,\n styles ?? {}\n );\n\n return (\n <ControlBarButton\n {...props}\n onClick={props.onHangUp ?? props.onClick}\n styles={componentStyles}\n onRenderIcon={props.onRenderIcon ?? onRenderEndCallIcon}\n strings={strings}\n labelKey={props.labelKey ?? 'endCallButtonLabel'}\n />\n );\n};\n// using media query to prevent windows from overwriting the button color\nconst darkThemeCallButtonStyles = {\n root: {\n color: darkTheme.callingPalette.iconWhite,\n background: darkTheme.callingPalette.callRed,\n '@media (forced-colors: active)': {\n forcedColorAdjust: 'auto',\n border: `1px ${lightTheme.palette?.neutralQuaternaryAlt} solid`\n },\n ':focus::after': { outlineColor: `${darkTheme.callingPalette.iconWhite} !important` } // added !important to avoid override by FluentUI button styles\n },\n rootHovered: {\n color: darkTheme.callingPalette.iconWhite,\n background: darkTheme.callingPalette.callRed,\n '@media (forced-colors: active)': {\n forcedColorAdjust: 'auto'\n }\n },\n rootPressed: {\n color: darkTheme.callingPalette.iconWhite,\n background: darkTheme.callingPalette.callRed,\n '@media (forced-colors: active)': {\n forcedColorAdjust: 'auto'\n }\n },\n label: {\n color: darkTheme.callingPalette.iconWhite\n }\n};\n\nconst lightThemeCallButtonStyles = {\n root: {\n color: lightTheme.callingPalette.iconWhite,\n background: lightTheme.callingPalette.callRed,\n '@media (forced-colors: active)': {\n forcedColorAdjust: 'auto',\n border: `1px ${lightTheme.palette?.neutralQuaternaryAlt} solid`\n },\n ':focus::after': { outlineColor: `${lightTheme.callingPalette.iconWhite} !important` } // added !important to avoid override by FluentUI button styles\n },\n rootHovered: {\n color: lightTheme.callingPalette.iconWhite,\n background: lightTheme.callingPalette.callRed,\n '@media (forced-colors: active)': {\n forcedColorAdjust: 'auto'\n }\n },\n rootPressed: {\n color: lightTheme.callingPalette.iconWhite,\n background: lightTheme.callingPalette.callRed,\n '@media (forced-colors: active)': {\n forcedColorAdjust: 'auto'\n }\n },\n label: {\n color: lightTheme.callingPalette.iconWhite\n }\n};\n"]}
|
1
|
+
{"version":3,"file":"EndCallButton.js","sourceRoot":"","sources":["../../../../../../react-components/src/components/EndCallButton.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,eAAe,EAAE,IAAI,EAAwB,MAAM,iBAAiB,CAAC;AAG9E,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAgB,SAAS,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAyB,MAAM,oBAAoB,CAAC;AAC7E,mDAAmD;AACnD,OAAO,EAAE,sBAAsB,IAAI,qBAAqB,EAAE,mCAAgC;AAiD1F,MAAM,mBAAmB,GAAG,GAAgB,EAAE,CAAC,oBAAC,IAAI,IAAC,QAAQ,EAAC,sBAAsB,GAAG,CAAC;AAExF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAyB,EAAe,EAAE;;IACtE,MAAM,EAAE,MAAM,EAAE,mDAAmD,CAAC,iBAAiB,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAE1G,MAAM,aAAa,GAAG,SAAS,EAAE,CAAC,OAAO,CAAC,aAAa,CAAC;IACxD,MAAM,OAAO,mCAAQ,aAAa,GAAK,KAAK,CAAC,OAAO,CAAE,CAAC;IAEvD,MAAM,KAAK,GAA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AAe,CAAC,UAAU,CAAC,CAAC;AAE3D,yEAAyE;AACzE,MAAM,yBAAyB,GAAG;IAChC,IAAI,EAAE,qBAAqB,CAAC,OAAO;IACnC,WAAW,EAAE,qBAAqB,CAAC,OAAO;IAC1C,WAAW,EAAE,qBAAqB,CAAC,OAAO;IAC1C,KAAK,EAAE;QACL,KAAK,EAAE,SAAS,CAAC,cAAc,CAAC,SAAS;KAC1C;IACD,qBAAqB,kCACf,qBAAqB,CAAC,OAAkB,KAC5C,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,qBAAqB,CAAC,OAAO,GACzC;IACD,4BAA4B,EAAE,qBAAqB,CAAC,OAAO;IAC3D,6BAA6B,EAAE,qBAAqB,CAAC,OAAO;CAC7D,CAAC;AAEF,MAAM,0BAA0B,GAAG;IACjC,IAAI,EAAE,sBAAsB,CAAC,OAAO;IACpC,WAAW,EAAE,sBAAsB,CAAC,OAAO;IAC3C,WAAW,EAAE,sBAAsB,CAAC,OAAO;IAC3C,qBAAqB,kCACf,sBAAsB,CAAC,OAAkB,KAC7C,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,sBAAsB,CAAC,OAAO,GAC1C;IACD,4BAA4B,EAAE,sBAAsB,CAAC,OAAO;IAC5D,6BAA6B,EAAE,sBAAsB,CAAC,OAAO;IAC7D,sBAAsB,EAAE,sBAAsB,CAAC,OAAO;IACtD,KAAK,EAAE;QACL,KAAK,EAAE,UAAU,CAAC,cAAc,CAAC,SAAS;KAC3C;CACF,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { concatStyleSets, Icon, IStyle, PartialTheme } from '@fluentui/react';\n/* @conditional-compile-remove(end-call-options) */\nimport { IContextualMenuProps } from '@fluentui/react';\nimport React from 'react';\nimport { useLocale } from '../localization';\nimport { useTheme } from '../theming';\nimport { CallingTheme, darkTheme, lightTheme } from '../theming/themes';\nimport { isDarkThemed } from '../theming/themeUtils';\nimport { ControlBarButton, ControlBarButtonProps } from './ControlBarButton';\n/* @conditional-compile-remove(end-call-options) */\nimport { _preventDismissOnEvent as preventDismissOnEvent } from '@internal/acs-ui-common';\n\n/**\n * Strings of {@link EndCallButton} that can be overridden.\n *\n * @public\n */\nexport interface EndCallButtonStrings {\n /**\n * Label of button\n */\n label: string;\n /** Tooltip content. */\n tooltipContent?: string;\n\n /* @conditional-compile-remove(end-call-options) */\n /** Label for leave option when ending call */\n leaveOption?: string;\n\n /* @conditional-compile-remove(end-call-options) */\n /** Label for end the whole call option when ending call */\n endCallOption?: string;\n}\n\n/**\n * Props for {@link EndCallButton}.\n *\n * @public\n */\nexport interface EndCallButtonProps extends ControlBarButtonProps {\n /**\n * Utility property for using this component with `communication react eventHandlers`.\n * Maps directly to the `onClick` property.\n */\n onHangUp?: (forEveryone?: boolean) => Promise<void>;\n\n /* @conditional-compile-remove(end-call-options) */\n /**\n * Set this to true to make it a split button.\n * The split arrow will trigger a contextual menu to allow end for everyone or just for the user.\n */\n enableEndCallMenu?: boolean;\n\n /**\n * Optional strings to override in component\n */\n strings?: EndCallButtonStrings;\n}\n\nconst onRenderEndCallIcon = (): JSX.Element => <Icon iconName=\"ControlButtonEndCall\" />;\n\n/**\n * A button to end an ongoing call.\n *\n * Can be used with {@link ControlBar}.\n *\n * @public\n */\nexport const EndCallButton = (props: EndCallButtonProps): JSX.Element => {\n const { styles, /* @conditional-compile-remove(end-call-options) */ enableEndCallMenu, onHangUp } = props;\n\n const localeStrings = useLocale().strings.endCallButton;\n const strings = { ...localeStrings, ...props.strings };\n\n const theme = useTheme();\n const isDarkTheme = isDarkThemed(theme);\n const componentStyles = concatStyleSets(\n isDarkTheme ? darkThemeCallButtonStyles : lightThemeCallButtonStyles,\n styles ?? {}\n );\n\n /* @conditional-compile-remove(end-call-options) */\n const defaultMenuProps: IContextualMenuProps = {\n items: [\n {\n key: 'endForSelf',\n text: localeStrings.leaveOption,\n title: localeStrings.leaveOption,\n onClick: () => {\n onHangUp && onHangUp(false);\n }\n },\n {\n key: 'endForEveryone',\n text: localeStrings.endCallOption,\n title: localeStrings.endCallOption,\n onClick: () => {\n onHangUp && onHangUp(true);\n }\n }\n ],\n styles: props.styles,\n calloutProps: {\n styles: {\n root: {\n maxWidth: '95%'\n }\n },\n preventDismissOnEvent\n }\n };\n\n return (\n <>\n <ControlBarButton\n {...props}\n /* @conditional-compile-remove(end-call-options) */\n menuProps={enableEndCallMenu ? defaultMenuProps : undefined}\n onClick={onHangUp ? () => onHangUp() : props.onClick}\n styles={componentStyles}\n onRenderIcon={props.onRenderIcon ?? onRenderEndCallIcon}\n strings={strings}\n labelKey={props.labelKey ?? 'endCallButtonLabel'}\n />\n </>\n );\n};\n\nconst getButtonStyles = (\n theme: PartialTheme & CallingTheme\n): { regular: IStyle; pressed: IStyle; hovered: IStyle } => ({\n regular: {\n color: theme.callingPalette.iconWhite,\n background: theme.callingPalette.callRed,\n '@media (forced-colors: active)': {\n forcedColorAdjust: 'auto',\n border: `1px ${theme.palette?.neutralQuaternaryAlt} solid`\n },\n ' i': {\n color: theme.callingPalette.iconWhite\n },\n ':focus::after': { outlineColor: `${theme.callingPalette.iconWhite} !important` } // added !important to avoid override by FluentUI button styles\n },\n pressed: {\n color: theme.callingPalette.iconWhite,\n background: theme.callingPalette.callRedDarker,\n border: 'none',\n ' i': {\n color: theme.callingPalette.iconWhite\n },\n '@media (forced-colors: active)': {\n forcedColorAdjust: 'auto'\n }\n },\n hovered: {\n color: theme.callingPalette.iconWhite,\n background: theme.callingPalette.callRedDark,\n border: 'none',\n ' i': {\n color: theme.callingPalette.iconWhite\n },\n '@media (forced-colors: active)': {\n forcedColorAdjust: 'auto'\n }\n }\n});\n\nconst darkThemeButtonStyles = getButtonStyles(darkTheme);\nconst lightThemeButtonStyles = getButtonStyles(lightTheme);\n\n// using media query to prevent windows from overwriting the button color\nconst darkThemeCallButtonStyles = {\n root: darkThemeButtonStyles.regular,\n rootHovered: darkThemeButtonStyles.hovered,\n rootPressed: darkThemeButtonStyles.pressed,\n label: {\n color: darkTheme.callingPalette.iconWhite\n },\n splitButtonMenuButton: {\n ...(darkThemeButtonStyles.regular as object),\n borderTop: 'none',\n borderRight: 'none',\n borderBottom: 'none',\n '&:hover': darkThemeButtonStyles.hovered\n },\n splitButtonMenuButtonChecked: darkThemeButtonStyles.hovered,\n splitButtonMenuButtonExpanded: darkThemeButtonStyles.pressed\n};\n\nconst lightThemeCallButtonStyles = {\n root: lightThemeButtonStyles.regular,\n rootHovered: lightThemeButtonStyles.hovered,\n rootPressed: lightThemeButtonStyles.pressed,\n splitButtonMenuButton: {\n ...(lightThemeButtonStyles.regular as object),\n borderTop: 'none',\n borderRight: 'none',\n borderBottom: 'none',\n '&:hover': lightThemeButtonStyles.hovered\n },\n splitButtonMenuButtonChecked: lightThemeButtonStyles.hovered,\n splitButtonMenuButtonExpanded: lightThemeButtonStyles.pressed,\n splitButtonMenuFocused: lightThemeButtonStyles.pressed,\n label: {\n color: lightTheme.callingPalette.iconWhite\n }\n};\n"]}
|
@@ -38,10 +38,10 @@ export interface ReactionButtonStrings {
|
|
38
38
|
likeReactionTooltipContent?: string;
|
39
39
|
/** Tooltip content of heart reaction button. */
|
40
40
|
heartReactionTooltipContent?: string;
|
41
|
-
/** Tooltip content of laugh reaction button. */
|
42
|
-
laughReactionTooltipContent?: string;
|
43
41
|
/** Tooltip content of clap reaction button. */
|
44
42
|
applauseReactionTooltipContent?: string;
|
43
|
+
/** Tooltip content of laugh reaction button. */
|
44
|
+
laughReactionTooltipContent?: string;
|
45
45
|
/** Tooltip content of surprised reaction button. */
|
46
46
|
surprisedReactionTooltipContent?: string;
|
47
47
|
}
|
@@ -15,6 +15,8 @@ import { emojiStyles, reactionEmojiMenuStyles, reactionToolTipHostStyle } from '
|
|
15
15
|
/* @conditional-compile-remove(reaction) */
|
16
16
|
import { isDarkThemed } from '../theming/themeUtils';
|
17
17
|
/* @conditional-compile-remove(reaction) */
|
18
|
+
import { getEmojiFrameCount } from './VideoGallery/utils/videoGalleryLayoutUtils';
|
19
|
+
/* @conditional-compile-remove(reaction) */
|
18
20
|
/**
|
19
21
|
* A button to send reactions.
|
20
22
|
*
|
@@ -30,19 +32,19 @@ export const ReactionButton = (props) => {
|
|
30
32
|
const styles = reactionButtonStyles(theme);
|
31
33
|
const onRenderIcon = () => (React.createElement(_HighContrastAwareIcon, { disabled: props.disabled, iconName: "ReactionButtonIcon" }));
|
32
34
|
const [isHoveredMap, setIsHoveredMap] = useState(new Map());
|
33
|
-
const emojis = ['like', 'heart', '
|
35
|
+
const emojis = ['like', 'heart', 'applause', 'laugh', 'surprised'];
|
34
36
|
const emojiButtonTooltip = new Map([
|
35
37
|
['like', strings.likeReactionTooltipContent],
|
36
38
|
['heart', strings.heartReactionTooltipContent],
|
37
|
-
['laugh', strings.laughReactionTooltipContent],
|
38
39
|
['applause', strings.applauseReactionTooltipContent],
|
40
|
+
['laugh', strings.laughReactionTooltipContent],
|
39
41
|
['surprised', strings.surprisedReactionTooltipContent]
|
40
42
|
]);
|
41
43
|
const emojiResource = new Map([
|
42
44
|
['like', (_a = props.reactionResources.likeReaction) === null || _a === void 0 ? void 0 : _a.url],
|
43
45
|
['heart', (_b = props.reactionResources.heartReaction) === null || _b === void 0 ? void 0 : _b.url],
|
44
|
-
['
|
45
|
-
['
|
46
|
+
['applause', (_c = props.reactionResources.applauseReaction) === null || _c === void 0 ? void 0 : _c.url],
|
47
|
+
['laugh', (_d = props.reactionResources.laughReaction) === null || _d === void 0 ? void 0 : _d.url],
|
46
48
|
['surprised', (_e = props.reactionResources.surprisedReaction) === null || _e === void 0 ? void 0 : _e.url]
|
47
49
|
]);
|
48
50
|
const calloutStyle = { root: { padding: 0 }, calloutMain: { padding: '0.5rem' } };
|
@@ -53,6 +55,7 @@ export const ReactionButton = (props) => {
|
|
53
55
|
};
|
54
56
|
const renderEmoji = (item, dismissMenu) => (React.createElement("div", { style: reactionEmojiMenuStyles() }, emojis.map((emoji, index) => {
|
55
57
|
const resourceUrl = emojiResource.get(emoji);
|
58
|
+
const frameCount = props.reactionResources !== undefined ? getEmojiFrameCount(emoji, props.reactionResources) : 0;
|
56
59
|
return (React.createElement(TooltipHost, { key: index, "data-ui-id": index, hidden: props.disableTooltip, content: emojiButtonTooltip.get(emoji), styles: reactionToolTipHostStyle(), calloutProps: Object.assign({}, calloutProps) },
|
57
60
|
React.createElement(IconButton, { key: index, onClick: () => {
|
58
61
|
props.onReactionClick(emoji);
|
@@ -60,7 +63,7 @@ export const ReactionButton = (props) => {
|
|
60
63
|
return new Map(prevMap).set(emoji, false);
|
61
64
|
});
|
62
65
|
dismissMenu();
|
63
|
-
}, style: emojiStyles(resourceUrl ? resourceUrl : '', isHoveredMap.get(emoji) ? 'running' : 'paused'), onMouseEnter: () => setIsHoveredMap((prevMap) => {
|
66
|
+
}, style: emojiStyles(resourceUrl ? resourceUrl : '', isHoveredMap.get(emoji) ? 'running' : 'paused', frameCount), onMouseEnter: () => setIsHoveredMap((prevMap) => {
|
64
67
|
return new Map(prevMap).set(emoji, true);
|
65
68
|
}), onMouseLeave: () => setIsHoveredMap((prevMap) => {
|
66
69
|
return new Map(prevMap).set(emoji, false);
|