@azure/communication-react 1.17.0-alpha-202405150013 → 1.17.0-alpha-202405160013
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 +32 -4
- package/dist/dist-cjs/communication-react/{ChatMessageComponentAsRichTextEditBox-BkDaUOJU.js → ChatMessageComponentAsRichTextEditBox-LLjD-Jp0.js} +9 -3
- package/dist/dist-cjs/communication-react/ChatMessageComponentAsRichTextEditBox-LLjD-Jp0.js.map +1 -0
- package/dist/dist-cjs/communication-react/RichTextSendBoxWrapper-D7SB5NwN.js +54 -0
- package/dist/dist-cjs/communication-react/RichTextSendBoxWrapper-D7SB5NwN.js.map +1 -0
- package/dist/dist-cjs/communication-react/{index-DJswSfNy.js → index-CfI_of00.js} +247 -76
- package/dist/dist-cjs/communication-react/index-CfI_of00.js.map +1 -0
- package/dist/dist-cjs/communication-react/index.js +2 -2
- package/dist/dist-esm/acs-ui-common/src/common.d.ts +8 -1
- package/dist/dist-esm/acs-ui-common/src/common.js.map +1 -1
- package/dist/dist-esm/acs-ui-common/src/index.d.ts +1 -1
- package/dist/dist-esm/acs-ui-common/src/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/communication-react/src/index.d.ts +1 -1
- package/dist/dist-esm/communication-react/src/index.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/Attachment/AttachmentCard.d.ts +4 -0
- package/dist/dist-esm/react-components/src/components/Attachment/AttachmentCard.js +27 -22
- package/dist/dist-esm/react-components/src/components/Attachment/AttachmentCard.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/Attachment/AttachmentCardGroup.d.ts +15 -0
- package/dist/dist-esm/react-components/src/components/Attachment/AttachmentCardGroup.js +14 -16
- package/dist/dist-esm/react-components/src/components/Attachment/AttachmentCardGroup.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/Attachment/AttachmentDownloadCards.js +16 -15
- package/dist/dist-esm/react-components/src/components/Attachment/AttachmentDownloadCards.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/Attachment/AttachmentUploadCards.js +2 -2
- package/dist/dist-esm/react-components/src/components/Attachment/AttachmentUploadCards.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/ChatMessageComponentAsMessageBubble.js +9 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/ChatMessageComponentAsMessageBubble.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBox.js +8 -2
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBox.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBoxPicker.js +2 -2
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBoxPicker.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsRichTextEditBox.js +8 -2
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsRichTextEditBox.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponentAsMessageBubble.js +9 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponentAsMessageBubble.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ErrorBoundary.d.ts +2 -2
- package/dist/dist-esm/react-components/src/components/ErrorBoundary.js +2 -2
- package/dist/dist-esm/react-components/src/components/ErrorBoundary.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/MessageThread.d.ts +5 -3
- package/dist/dist-esm/react-components/src/components/MessageThread.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/RemoteVideoTile.js +1 -1
- package/dist/dist-esm/react-components/src/components/RemoteVideoTile.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.d.ts +4 -0
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.js +5 -2
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/SendBox.js +5 -2
- package/dist/dist-esm/react-components/src/components/SendBox.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoEffects/VideoEffectsItem.js +6 -4
- package/dist/dist-esm/react-components/src/components/VideoEffects/VideoEffectsItem.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery/RemoteScreenShare.js +2 -2
- package/dist/dist-esm/react-components/src/components/VideoGallery/RemoteScreenShare.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/index.d.ts +1 -0
- package/dist/dist-esm/react-components/src/components/index.js +1 -0
- package/dist/dist-esm/react-components/src/components/index.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/styles/AttachmentCard.styles.d.ts +9 -1
- package/dist/dist-esm/react-components/src/components/styles/AttachmentCard.styles.js +27 -3
- package/dist/dist-esm/react-components/src/components/styles/AttachmentCard.styles.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/styles/AttachmentCardGroup.styles.d.ts +17 -0
- package/dist/dist-esm/react-components/src/components/styles/AttachmentCardGroup.styles.js +47 -0
- package/dist/dist-esm/react-components/src/components/styles/AttachmentCardGroup.styles.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/styles/MessageThread.styles.d.ts +2 -2
- package/dist/dist-esm/react-components/src/components/styles/MessageThread.styles.js +8 -0
- package/dist/dist-esm/react-components/src/components/styles/MessageThread.styles.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentAsEditBoxUtils.d.ts +4 -0
- package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentAsEditBoxUtils.js +9 -0
- package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentAsEditBoxUtils.js.map +1 -1
- package/dist/dist-esm/react-components/src/localization/locales/en-US/strings.json +1 -0
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.d.ts +7 -0
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.js +6 -2
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatComposite.d.ts +7 -0
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatComposite.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js +28 -8
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/RichTextSendBoxWrapper.d.ts +10 -0
- package/dist/dist-esm/react-composites/src/composites/common/RichTextSendBoxWrapper.js +20 -0
- package/dist/dist-esm/react-composites/src/composites/common/RichTextSendBoxWrapper.js.map +1 -0
- package/dist/dist-esm/react-composites/src/composites/common/SendBoxPicker.d.ts +30 -0
- package/dist/dist-esm/react-composites/src/composites/common/SendBoxPicker.js +44 -0
- package/dist/dist-esm/react-composites/src/composites/common/SendBoxPicker.js.map +1 -0
- package/package.json +2 -2
- package/dist/dist-cjs/communication-react/ChatMessageComponentAsRichTextEditBox-BkDaUOJU.js.map +0 -1
- package/dist/dist-cjs/communication-react/index-DJswSfNy.js.map +0 -1
@@ -1,6 +1,6 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
-
var index = require('./index-
|
3
|
+
var index = require('./index-CfI_of00.js');
|
4
4
|
require('react');
|
5
5
|
require('@fluentui/react');
|
6
6
|
require('@fluentui/react-components');
|
@@ -155,7 +155,7 @@ exports.useCallClient = index.useCallClient;
|
|
155
155
|
exports.useChatClient = index.useChatClient;
|
156
156
|
exports.useChatThreadClient = index.useChatThreadClient;
|
157
157
|
exports.useDeviceManager = index.useDeviceManager;
|
158
|
-
exports.usePropsFor = index.usePropsFor;
|
158
|
+
exports.usePropsFor = index.usePropsFor$1;
|
159
159
|
exports.useSelector = index.useSelector;
|
160
160
|
exports.useTeamsCall = index.useTeamsCall;
|
161
161
|
exports.useTeamsCallAdapter = index.useTeamsCallAdapter;
|
@@ -96,11 +96,18 @@ export interface AttachmentProgressError {
|
|
96
96
|
* @beta
|
97
97
|
* Message option that defines properties that can be set when
|
98
98
|
* sending or updating a chat message.
|
99
|
-
* @property metadata - Metadata that contains additional information about the message to be passed
|
99
|
+
* @property metadata - Metadata that contains additional information about the message to be passed between 2 users.
|
100
100
|
* @property attachments - Attachments that contains file attachments attached to the message.
|
101
|
+
* @property type - Type of the message content, either 'text' or 'html'.
|
101
102
|
*/
|
102
103
|
export type MessageOptions = {
|
103
104
|
metadata?: Record<string, string>;
|
104
105
|
attachments?: AttachmentMetadata[];
|
106
|
+
type?: ChatMessageType;
|
105
107
|
};
|
108
|
+
/**
|
109
|
+
* @beta
|
110
|
+
* Type of the message content, either 'text' or 'html'.
|
111
|
+
*/
|
112
|
+
export type ChatMessageType = 'text' | 'html';
|
106
113
|
//# sourceMappingURL=common.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../../acs-ui-common/src/common.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,GAAW,EAAU,EAAE;IACrD,OAAO,GAAG,GAAG,UAAU,CAAC,gBAAgB,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,QAAQ,CAAC,CAAC;AAC/E,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAAU,EAAU,EAAE;IACpD,OAAO,EAAE,GAAG,UAAU,CAAC,gBAAgB,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,QAAQ,CAAC,CAAC;AAC9E,CAAC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,EAAqE,EAC5D,EAAE;IACX,OAAO,EAAE,CAAC,IAAI,KAAK,QAAQ,IAAI,EAAE,CAAC,IAAI,KAAK,QAAQ,CAAC;AACtD,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU,QAAQ,CAAmB,GAAM;IAC/C,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAmB,CAAC;AAC5C,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * @internal\n * Converts units of rem to units of pixels\n * @param rem - units of rem\n * @returns units of pixels\n */\nexport const _convertRemToPx = (rem: number): number => {\n return rem * parseFloat(getComputedStyle(document.documentElement).fontSize);\n};\n\n/**\n * @internal\n * Converts units of pixels to units of rem\n * @param px - units of px\n * @returns units of rem\n */\nexport const _convertPxToRem = (px: number): number => {\n return px / parseFloat(getComputedStyle(document.documentElement).fontSize);\n};\n\n/**\n * @internal\n * Disable dismiss on resize to work around a couple Fluent UI bugs\n * - The Callout is dismissed whenever *any child of window (inclusive)* is resized. In practice, this\n * happens when we change the VideoGallery layout, or even when the video stream element is internally resized\n * by the headless SDK.\n * - We also want to prevent dismiss when chat pane is scrolling especially a new message is added.\n * A side effect of this workaround is that the context menu stays open when window is resized, and may\n * get detached from original target visually. That bug is preferable to the bug when this value is not set -\n * The Callout (frequently) gets dismissed automatically.\n */\nexport const _preventDismissOnEvent = (\n ev: Event | React.FocusEvent | React.KeyboardEvent | React.MouseEvent\n): boolean => {\n return ev.type === 'resize' || ev.type === 'scroll';\n};\n\n/**\n * @internal\n * Helper function to get the keys of an object\n */\nexport function _getKeys<T extends object>(obj: T): (keyof T)[] {\n return Object.keys(obj) as Array<keyof T>;\n}\n\n/**\n * Data model that represents a chat message attachment\n * where it contains an ID to uniquely identify the attachment,\n * a name that represents the name of file, and\n * a URL to download the attachment.\n *\n * @beta\n */\nexport interface AttachmentMetadata {\n /**\n * Unique ID of the attachment.\n */\n id: string;\n /**\n * Attachment name to be displayed.\n */\n name: string;\n /**\n * Download URL for the attachment.\n */\n url: string;\n}\n\n/**\n * Data model that represents a chat message attachment being uploaded\n * where it contains an ID to uniquely identify the attachment,\n * a name that represents the name of file,\n * an optional URL to download the attachment,\n * an optional progress value between 0 and 1 indicating the progress of the upload, and\n * an optional error object that contains error message would be shown to the user.\n *\n *\n * @beta\n */\nexport interface AttachmentMetadataInProgress {\n /**\n * Unique ID of the attachment.\n */\n id: string;\n /**\n * Attachment name to be displayed.\n */\n name: string;\n /**\n * Download URL for the attachment.\n */\n url?: string;\n /**\n * A number between 0 and 1 indicating the progress of the upload.\n */\n progress?: number;\n /**\n * A object contains error message would be shown to the user.\n */\n error?: AttachmentProgressError;\n}\n\n/**\n * @beta\n * A attachment progress error object that contains message to be shown to\n * the user when upload fails.\n */\nexport interface AttachmentProgressError {\n message: string;\n}\n\n/**\n * @beta\n * Message option that defines properties that can be set when\n * sending or updating a chat message.\n * @property metadata - Metadata that contains additional information about the message to be passed
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../../acs-ui-common/src/common.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,GAAW,EAAU,EAAE;IACrD,OAAO,GAAG,GAAG,UAAU,CAAC,gBAAgB,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,QAAQ,CAAC,CAAC;AAC/E,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAAU,EAAU,EAAE;IACpD,OAAO,EAAE,GAAG,UAAU,CAAC,gBAAgB,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,QAAQ,CAAC,CAAC;AAC9E,CAAC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,EAAqE,EAC5D,EAAE;IACX,OAAO,EAAE,CAAC,IAAI,KAAK,QAAQ,IAAI,EAAE,CAAC,IAAI,KAAK,QAAQ,CAAC;AACtD,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU,QAAQ,CAAmB,GAAM;IAC/C,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAmB,CAAC;AAC5C,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * @internal\n * Converts units of rem to units of pixels\n * @param rem - units of rem\n * @returns units of pixels\n */\nexport const _convertRemToPx = (rem: number): number => {\n return rem * parseFloat(getComputedStyle(document.documentElement).fontSize);\n};\n\n/**\n * @internal\n * Converts units of pixels to units of rem\n * @param px - units of px\n * @returns units of rem\n */\nexport const _convertPxToRem = (px: number): number => {\n return px / parseFloat(getComputedStyle(document.documentElement).fontSize);\n};\n\n/**\n * @internal\n * Disable dismiss on resize to work around a couple Fluent UI bugs\n * - The Callout is dismissed whenever *any child of window (inclusive)* is resized. In practice, this\n * happens when we change the VideoGallery layout, or even when the video stream element is internally resized\n * by the headless SDK.\n * - We also want to prevent dismiss when chat pane is scrolling especially a new message is added.\n * A side effect of this workaround is that the context menu stays open when window is resized, and may\n * get detached from original target visually. That bug is preferable to the bug when this value is not set -\n * The Callout (frequently) gets dismissed automatically.\n */\nexport const _preventDismissOnEvent = (\n ev: Event | React.FocusEvent | React.KeyboardEvent | React.MouseEvent\n): boolean => {\n return ev.type === 'resize' || ev.type === 'scroll';\n};\n\n/**\n * @internal\n * Helper function to get the keys of an object\n */\nexport function _getKeys<T extends object>(obj: T): (keyof T)[] {\n return Object.keys(obj) as Array<keyof T>;\n}\n\n/**\n * Data model that represents a chat message attachment\n * where it contains an ID to uniquely identify the attachment,\n * a name that represents the name of file, and\n * a URL to download the attachment.\n *\n * @beta\n */\nexport interface AttachmentMetadata {\n /**\n * Unique ID of the attachment.\n */\n id: string;\n /**\n * Attachment name to be displayed.\n */\n name: string;\n /**\n * Download URL for the attachment.\n */\n url: string;\n}\n\n/**\n * Data model that represents a chat message attachment being uploaded\n * where it contains an ID to uniquely identify the attachment,\n * a name that represents the name of file,\n * an optional URL to download the attachment,\n * an optional progress value between 0 and 1 indicating the progress of the upload, and\n * an optional error object that contains error message would be shown to the user.\n *\n *\n * @beta\n */\nexport interface AttachmentMetadataInProgress {\n /**\n * Unique ID of the attachment.\n */\n id: string;\n /**\n * Attachment name to be displayed.\n */\n name: string;\n /**\n * Download URL for the attachment.\n */\n url?: string;\n /**\n * A number between 0 and 1 indicating the progress of the upload.\n */\n progress?: number;\n /**\n * A object contains error message would be shown to the user.\n */\n error?: AttachmentProgressError;\n}\n\n/**\n * @beta\n * A attachment progress error object that contains message to be shown to\n * the user when upload fails.\n */\nexport interface AttachmentProgressError {\n message: string;\n}\n\n/**\n * @beta\n * Message option that defines properties that can be set when\n * sending or updating a chat message.\n * @property metadata - Metadata that contains additional information about the message to be passed between 2 users.\n * @property attachments - Attachments that contains file attachments attached to the message.\n * @property type - Type of the message content, either 'text' or 'html'.\n */\nexport type MessageOptions = {\n metadata?: Record<string, string>;\n attachments?: AttachmentMetadata[];\n type?: ChatMessageType;\n};\n\n/**\n * @beta\n * Type of the message content, either 'text' or 'html'.\n */\nexport type ChatMessageType = 'text' | 'html';\n"]}
|
@@ -15,5 +15,5 @@ export { _pxToRem } from './cssUtils';
|
|
15
15
|
export { _logEvent } from './logEvent';
|
16
16
|
export type { TelemetryEvent } from './logEvent';
|
17
17
|
export type { AttachmentMetadata, AttachmentMetadataInProgress, AttachmentProgressError } from './common';
|
18
|
-
export type { MessageOptions } from './common';
|
18
|
+
export type { MessageOptions, ChatMessageType } from './common';
|
19
19
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../acs-ui-common/src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EACL,+BAA+B,EAC/B,6BAA6B,EAC7B,0BAA0B,EAC1B,kBAAkB,EACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,sBAAsB,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAS9F,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport { memoizeFnAll } from './memoizeFnAll';\nexport {\n fromFlatCommunicationIdentifier,\n toFlatCommunicationIdentifier,\n _toCommunicationIdentifier,\n _isValidIdentifier\n} from './identifier';\nexport { _getApplicationId } from './telemetry';\nexport { _formatString } from './localizationUtils';\nexport { _safeJSONStringify } from './safeStringify';\nexport { _convertPxToRem, _convertRemToPx, _preventDismissOnEvent, _getKeys } from './common';\n\nexport type { Common, CommonProperties } from './commonProperties';\nexport type { CallbackType, FunctionWithKey } from './memoizeFnAll';\nexport type { AreEqual, AreParamEqual, AreTypeEqual } from './areEqual';\nexport type { MessageStatus } from './MessageStatus';\nexport type { _IObjectMap } from './localizationUtils';\nexport type { _TelemetryImplementationHint } from './telemetry';\n\nexport { _MAX_EVENT_LISTENERS } from './constants';\n\nexport { _pxToRem } from './cssUtils';\n\nexport { _logEvent } from './logEvent';\nexport type { TelemetryEvent } from './logEvent';\n\nexport type { AttachmentMetadata, AttachmentMetadataInProgress, AttachmentProgressError } from './common';\n\nexport type { MessageOptions } from './common';\n"]}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../acs-ui-common/src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EACL,+BAA+B,EAC/B,6BAA6B,EAC7B,0BAA0B,EAC1B,kBAAkB,EACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,sBAAsB,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAS9F,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport { memoizeFnAll } from './memoizeFnAll';\nexport {\n fromFlatCommunicationIdentifier,\n toFlatCommunicationIdentifier,\n _toCommunicationIdentifier,\n _isValidIdentifier\n} from './identifier';\nexport { _getApplicationId } from './telemetry';\nexport { _formatString } from './localizationUtils';\nexport { _safeJSONStringify } from './safeStringify';\nexport { _convertPxToRem, _convertRemToPx, _preventDismissOnEvent, _getKeys } from './common';\n\nexport type { Common, CommonProperties } from './commonProperties';\nexport type { CallbackType, FunctionWithKey } from './memoizeFnAll';\nexport type { AreEqual, AreParamEqual, AreTypeEqual } from './areEqual';\nexport type { MessageStatus } from './MessageStatus';\nexport type { _IObjectMap } from './localizationUtils';\nexport type { _TelemetryImplementationHint } from './telemetry';\n\nexport { _MAX_EVENT_LISTENERS } from './constants';\n\nexport { _pxToRem } from './cssUtils';\n\nexport { _logEvent } from './logEvent';\nexport type { TelemetryEvent } from './logEvent';\n\nexport type { AttachmentMetadata, AttachmentMetadataInProgress, AttachmentProgressError } from './common';\n\nexport type { MessageOptions, ChatMessageType } from './common';\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"telemetryVersion.js","sourceRoot":"","sources":["../../../../../acs-ui-common/src/telemetryVersion.js"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;AAElC,wCAAwC;AAExC,MAAM,CAAC,OAAO,GAAG,2BAA2B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n// GENERATED FILE. DO NOT EDIT MANUALLY.\n\nmodule.exports = '1.17.0-alpha-
|
1
|
+
{"version":3,"file":"telemetryVersion.js","sourceRoot":"","sources":["../../../../../acs-ui-common/src/telemetryVersion.js"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;AAElC,wCAAwC;AAExC,MAAM,CAAC,OAAO,GAAG,2BAA2B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n// GENERATED FILE. DO NOT EDIT MANUALLY.\n\nmodule.exports = '1.17.0-alpha-202405160013';\n"]}
|
@@ -20,7 +20,7 @@ export type { CallClientProviderProps, CallAgentProviderProps, CallProviderProps
|
|
20
20
|
export type { VideoBackgroundEffectsDependency, CallingHandlersOptions } from '../../calling-component-bindings/src';
|
21
21
|
export type { CaptionsOptions } from '../../calling-component-bindings/src';
|
22
22
|
export type { ChatClientProviderProps, ChatThreadClientProviderProps, GetChatSelector, ChatHandlers, ChatBaseSelectorProps } from '../../chat-component-bindings/src';
|
23
|
-
export type { MessageOptions } from '../../acs-ui-common/src';
|
23
|
+
export type { MessageOptions, ChatMessageType } from '../../acs-ui-common/src';
|
24
24
|
export { CallClientProvider, CallAgentProvider, CallProvider, useCallClient, useCallAgent, useCall, useDeviceManager, getCallingSelector, createDefaultCallingHandlers } from '../../calling-component-bindings/src';
|
25
25
|
export { useTeamsCallAgent, useTeamsCall, createDefaultTeamsCallingHandlers } from '../../calling-component-bindings/src';
|
26
26
|
export type { TeamsCallingHandlers } from '../../calling-component-bindings/src';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,+BAA+B,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AAoCzG,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,OAAO,EACP,gBAAgB,EAChB,kBAAkB,EAClB,4BAA4B,EAC7B,MAAM,sCAAsC,CAAC;AAE9C,yDAAyD;AACzD,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,iCAAiC,EAClC,MAAM,sCAAsC,CAAC;AAsB9C,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,aAAa,EACb,mBAAmB,EACnB,eAAe,EACf,yBAAyB,EAC1B,MAAM,mCAAmC,CAAC;AAU3C,OAAO,EACL,mBAAmB,EACnB,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,QAAQ,EACR,UAAU,EACV,oBAAoB,EACpB,sBAAsB,EACtB,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,OAAO,EACP,WAAW,EACX,eAAe,EACf,YAAY,EACZ,SAAS,EACT,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACvB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,6CAA6C;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAExD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE7D,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAErD,iDAAiD;AACjD,OAAO,EACL,kCAAkC,EAClC,yBAAyB,EACzB,qBAAqB,EACtB,MAAM,4BAA4B,CAAC;AA0IpC,mDAAmD;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAsC7D,sDAAsD;AACtD,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AAezE,cAAc,iDAAiD,CAAC;AAChE,cAAc,oCAAoC,CAAC;AACnD,cAAc,gDAAgD,CAAC;AAG/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAe1E,cAAc,yCAAyC,CAAC;AACxD,cAAc,eAAe,CAAC;AAE9B,sDAAsD;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAGhE,sDAAsD;AACtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAGvE,sDAAsD;AACtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * `@azure/communication-react` is an npm package that exports the functionality of the Azure Communication Services - UI Library.\n *\n * This package makes it easy for you to build modern communications user experiences using Azure Communication Services. It gives you a library of production-ready UI components that you can drop into your applications:\n * - Composites: These components are turn-key solutions that implement common communication scenarios. You can quickly add video calling or chat experiences to your applications. Composites are open-source higher order components built using UI components.\n * - UI Components - These components are open-source building blocks that let you build custom communications experience. Components are offered for both calling and chat capabilities that can be combined to build experiences.\n *\n * These UI client libraries all use Microsoft's Fluent design language and assets. Fluent UI provides a foundational layer for the UI Library and is actively used across Microsoft products.\n *\n * In conjunction with the UI components, the UI Library exposes a stateful client library for calling and chat. This client is agnostic to any specific state management framework and can be integrated with common state managers like Redux or React Context.\n * This stateful client library can be used with the UI Components to pass props and methods for the UI Components to render data. For more information, see Stateful Client Overview.\n *\n * For more information visit: https://aka.ms/acsstorybook\n *\n * @packageDocumentation\n */\n\nexport { fromFlatCommunicationIdentifier, toFlatCommunicationIdentifier } from '../../acs-ui-common/src';\nexport type {\n AreEqual,\n CommonProperties,\n MessageStatus,\n Common,\n AreTypeEqual,\n AreParamEqual\n} from '../../acs-ui-common/src';\n\n// Not to export chat/calling specific hook from binding package\nexport type {\n CallClientProviderProps,\n CallAgentProviderProps,\n CallProviderProps,\n GetCallingSelector,\n CallingHandlers,\n CallingBaseSelectorProps,\n CommonCallingHandlers\n} from '../../calling-component-bindings/src';\n\nexport type { VideoBackgroundEffectsDependency, CallingHandlersOptions } from '../../calling-component-bindings/src';\n\nexport type { CaptionsOptions } from '../../calling-component-bindings/src';\n\nexport type {\n ChatClientProviderProps,\n ChatThreadClientProviderProps,\n GetChatSelector,\n ChatHandlers,\n ChatBaseSelectorProps\n} from '../../chat-component-bindings/src';\n\n/* @conditional-compile-remove(attachment-upload) */\nexport type { MessageOptions } from '../../acs-ui-common/src';\n\nexport {\n CallClientProvider,\n CallAgentProvider,\n CallProvider,\n useCallClient,\n useCallAgent,\n useCall,\n useDeviceManager,\n getCallingSelector,\n createDefaultCallingHandlers\n} from '../../calling-component-bindings/src';\n\n/* @conditional-compile-remove(teams-identity-support) */\nexport {\n useTeamsCallAgent,\n useTeamsCall,\n createDefaultTeamsCallingHandlers\n} from '../../calling-component-bindings/src';\n\n/* @conditional-compile-remove(teams-identity-support) */\nexport type { TeamsCallingHandlers } from '../../calling-component-bindings/src';\n\nexport type {\n ScreenShareButtonSelector,\n CameraButtonSelector,\n VideoGallerySelector,\n DevicesButtonSelector,\n EmptySelector,\n ErrorBarSelector as CallErrorBarSelector,\n ParticipantListSelector,\n MicrophoneButtonSelector,\n ParticipantsButtonSelector,\n CreateDefaultCallingHandlers\n} from '../../calling-component-bindings/src';\n/* @conditional-compile-remove(PSTN-calls) */\nexport type { HoldButtonSelector } from '../../calling-component-bindings/src';\n\nexport type { RaiseHandButtonSelector } from '../../calling-component-bindings/src';\n\nexport {\n ChatClientProvider,\n ChatThreadClientProvider,\n useChatClient,\n useChatThreadClient,\n getChatSelector,\n createDefaultChatHandlers\n} from '../../chat-component-bindings/src';\n\nexport type {\n MessageThreadSelector,\n TypingIndicatorSelector,\n ChatParticipantListSelector,\n SendBoxSelector,\n ErrorBarSelector as ChatErrorBarSelector\n} from '../../chat-component-bindings/src';\n\nexport {\n _IdentifierProvider,\n CameraButton,\n ControlBar,\n ControlBarButton,\n DevicesButton,\n EndCallButton,\n ErrorBar,\n GridLayout,\n LocalizationProvider,\n MessageStatusIndicator,\n MessageThread,\n MicrophoneButton,\n ParticipantItem,\n ParticipantList,\n ParticipantsButton,\n ScreenShareButton,\n SendBox,\n StreamMedia,\n TypingIndicator,\n VideoGallery,\n VideoTile,\n COMPONENT_LOCALE_EN_GB,\n COMPONENT_LOCALE_AR_SA,\n COMPONENT_LOCALE_CS_CZ,\n COMPONENT_LOCALE_DE_DE,\n COMPONENT_LOCALE_ES_ES,\n COMPONENT_LOCALE_FI_FI,\n COMPONENT_LOCALE_FR_FR,\n COMPONENT_LOCALE_HE_IL,\n COMPONENT_LOCALE_IT_IT,\n COMPONENT_LOCALE_JA_JP,\n COMPONENT_LOCALE_KO_KR,\n COMPONENT_LOCALE_NB_NO,\n COMPONENT_LOCALE_NL_NL,\n COMPONENT_LOCALE_PL_PL,\n COMPONENT_LOCALE_PT_BR,\n COMPONENT_LOCALE_RU_RU,\n COMPONENT_LOCALE_SV_SE,\n COMPONENT_LOCALE_TR_TR,\n COMPONENT_LOCALE_ZH_CN,\n COMPONENT_LOCALE_ZH_TW\n} from '../../react-components/src';\nexport { ImageOverlay } from '../../react-components/src';\n/* @conditional-compile-remove(PSTN-calls) */\nexport { HoldButton } from '../../react-components/src';\n\nexport { RaiseHandButton } from '../../react-components/src';\n\nexport { Dialpad } from '../../react-components/src';\n\n/* @conditional-compile-remove(call-readiness) */\nexport {\n CameraAndMicrophoneSitePermissions,\n MicrophoneSitePermissions,\n CameraSitePermissions\n} from '../../react-components/src';\n/* @conditional-compile-remove(call-readiness) */\nexport type {\n CameraAndMicrophoneSitePermissionsStrings,\n CameraAndMicrophoneSitePermissionsProps,\n CameraSitePermissionsStrings,\n CameraSitePermissionsProps,\n CommonSitePermissionsProps,\n SitePermissionsStrings,\n SitePermissionsStyles,\n MicrophoneSitePermissionsStrings,\n MicrophoneSitePermissionsProps\n} from '../../react-components/src';\n\n/* @conditional-compile-remove(total-participant-count) */\nexport type { ParticipantListStrings } from '../../react-components/src';\n\n/* @conditional-compile-remove(mention) */\nexport type {\n MentionOptions,\n MentionDisplayOptions,\n MentionLookupOptions,\n Mention,\n MentionPopoverStrings\n} from '../../react-components/src';\n\nexport type {\n _IdentifierProviderProps,\n _Identifiers,\n ActiveErrorMessage,\n BaseCustomStyles,\n CallParticipantListParticipant,\n CameraButtonContextualMenuStyles,\n CameraButtonProps,\n CameraButtonStrings,\n CameraButtonStyles,\n ChatMessage,\n CommunicationParticipant,\n ComponentLocale,\n ComponentSlotStyle,\n ComponentStrings,\n ContentSystemMessage,\n ControlBarButtonProps,\n ControlBarButtonStrings,\n ControlBarButtonStyles,\n ControlBarLayout,\n ControlBarProps,\n CreateVideoStreamViewResult,\n CustomAvatarOptions,\n CustomMessage,\n DevicesButtonContextualMenuStyles,\n DevicesButtonProps,\n DevicesButtonStrings,\n DevicesButtonStyles,\n EndCallButtonProps,\n EndCallButtonStrings,\n ErrorBarProps,\n ErrorBarStrings,\n ErrorType,\n GridLayoutProps,\n GridLayoutStyles,\n HorizontalGalleryStyles,\n JumpToNewMessageButtonProps,\n LocalizationProviderProps,\n LocalVideoCameraCycleButtonProps,\n LoadingState,\n Message,\n MessageAttachedStatus,\n MessageCommon,\n MessageContentType,\n MessageProps,\n MessageRenderer,\n MessageStatusIndicatorProps,\n MessageStatusIndicatorStrings,\n MessageThreadProps,\n MessageThreadStrings,\n MessageThreadStyles,\n MicrophoneButtonContextualMenuStyles,\n MicrophoneButtonProps,\n MicrophoneButtonStrings,\n MicrophoneButtonStyles,\n OnRenderAvatarCallback,\n OptionsDevice,\n ParticipantAddedSystemMessage,\n ParticipantItemProps,\n ParticipantItemStrings,\n ParticipantItemStyles,\n ParticipantListItemStyles,\n ParticipantListParticipant,\n ParticipantListProps,\n ParticipantListStyles,\n ParticipantMenuItemsCallback,\n ParticipantRemovedSystemMessage,\n ParticipantState,\n ParticipantsButtonContextualMenuStyles,\n ParticipantsButtonProps,\n ParticipantsButtonStrings,\n ParticipantsButtonStyles,\n ReadReceiptsBySenderId,\n ScreenShareButtonProps,\n ScreenShareButtonStrings,\n SendBoxProps,\n SendBoxStrings,\n SendBoxStylesProps,\n StreamMediaProps,\n SystemMessage,\n SystemMessageCommon,\n TopicUpdatedSystemMessage,\n TypingIndicatorProps,\n TypingIndicatorStrings,\n TypingIndicatorStylesProps,\n UpdateMessageCallback,\n CancelEditCallback,\n VideoGalleryLayout,\n VideoGalleryLocalParticipant,\n VideoGalleryParticipant,\n VideoGalleryProps,\n VideoGalleryRemoteParticipant,\n VideoGalleryStream,\n VideoGalleryStrings,\n VideoGalleryStyles,\n VideoStreamOptions,\n VideoTileProps,\n VideoTileStylesProps,\n ViewScalingMode,\n VideoTileContextualMenuProps,\n VideoTileDrawerMenuProps,\n VideoTilesOptions\n} from '../../react-components/src';\n\nexport type { RaiseHandButtonProps, RaiseHandButtonStrings, RaisedHand } from '../../react-components/src';\nexport type {\n ReactionButtonStrings,\n Reaction,\n ReactionButtonProps,\n ReactionResources,\n ReactionSprite\n} from '../../react-components/src';\n/* @conditional-compile-remove(rich-text-editor) */\nexport { RichTextSendBox } from '../../react-components/src';\n/* @conditional-compile-remove(rich-text-editor) */\nexport type { RichTextSendBoxProps, RichTextSendBoxStrings, RichTextStrings } from '../../react-components/src';\n/* @conditional-compile-remove(spotlight) */\nexport type { Spotlight } from '../../react-components/src';\nexport type { ImageOverlayProps, ImageOverlayStrings } from '../../react-components/src';\n/* @conditional-compile-remove(data-loss-prevention) */\nexport type { BlockedMessage } from '../../react-components/src';\nexport type {\n DialpadMode,\n DialpadProps,\n DialpadStrings,\n DialpadStyles,\n DtmfTone,\n LongPressTrigger\n} from '../../react-components/src';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nexport type { AttachmentOptions } from '../../react-components/src';\n/* @conditional-compile-remove(attachment-upload) */\nexport type { SendBoxErrorBarError } from '../../react-components/src';\n/* @conditional-compile-remove(attachment-upload) */\nexport type {\n AttachmentActionHandler,\n AttachmentSelectionHandler,\n AttachmentRemovalHandler,\n AttachmentUploadOptions,\n AttachmentUploadTask\n} from '../../react-components/src';\n\n/* @conditional-compile-remove(attachment-upload) */\nexport type {\n AttachmentMetadata,\n AttachmentMetadataInProgress,\n AttachmentProgressError\n} from '../../acs-ui-common/src';\n\n/* @conditional-compile-remove(attachment-download) */\nexport type { AttachmentMenuAction, AttachmentDownloadOptions } from '../../react-components/src';\n/* @conditional-compile-remove(attachment-download) */\nexport { defaultAttachmentMenuAction } from '../../react-components/src';\nexport type { ChatAttachmentType } from '../../react-components/src';\nexport type { InlineImageOptions, InlineImage } from '../../react-components/src';\n/* @conditional-compile-remove(PSTN-calls) */\nexport type { HoldButtonProps, HoldButtonStrings, VideoTileStrings } from '../../react-components/src';\n/* @conditional-compile-remove(call-readiness) */\nexport type { BrowserPermissionDeniedStrings, BrowserPermissionDeniedProps } from '../../react-components/src';\n/* @conditional-compile-remove(call-readiness) */\nexport type {\n BrowserPermissionDeniedIOSStrings,\n BrowserPermissionDeniedStyles,\n BrowserPermissionDeniedIOSProps\n} from '../../react-components/src';\nexport type { OverflowGalleryPosition } from '../../react-components/src';\nexport type { LocalVideoTileSize } from '../../react-components/src';\nexport * from '../../react-components/src/localization/locales';\nexport * from '../../react-components/src/theming';\nexport * from '../../calling-stateful-client/src/index-public';\n/* @conditional-compile-remove(one-to-n-calling) */\nexport type { DeclarativeCallAgent } from '../../calling-stateful-client/src';\nexport { createStatefulChatClient } from '../../chat-stateful-client/src';\nexport type {\n StatefulChatClient,\n StatefulChatClientArgs,\n StatefulChatClientOptions,\n ChatMessageWithStatus,\n ChatClientState,\n ChatError,\n ChatErrors,\n ChatThreadClientState,\n ChatThreadProperties,\n ChatErrorTarget\n} from '../../chat-stateful-client/src';\n\nexport type { ResourceFetchResult } from '../../chat-stateful-client/src';\nexport * from '../../react-composites/src/index-public';\nexport * from './mergedHooks';\n\n/* @conditional-compile-remove(unsupported-browser) */\nexport { UnsupportedBrowser } from '../../react-components/src';\n/* @conditional-compile-remove(unsupported-browser) */\nexport type { UnsupportedBrowserStrings, UnsupportedBrowserProps } from '../../react-components/src';\n/* @conditional-compile-remove(unsupported-browser) */\nexport { UnsupportedBrowserVersion } from '../../react-components/src';\n/* @conditional-compile-remove(unsupported-browser) */\nexport type { UnsupportedBrowserVersionStrings, UnsupportedBrowserVersionProps } from '../../react-components/src';\n/* @conditional-compile-remove(unsupported-browser) */\nexport { UnsupportedOperatingSystem } from '../../react-components/src';\n/* @conditional-compile-remove(unsupported-browser) */\nexport type { UnsupportedOperatingSystemStrings, UnsupportedOperatingSystemProps } from '../../react-components/src';\nexport type {\n VerticalGalleryStyles,\n VerticalGalleryStrings,\n VerticalGalleryControlBarStyles\n} from '../../react-components/src';\n\nexport type { SpokenLanguageStrings, CaptionLanguageStrings } from '../../react-components/src';\n/* @conditional-compile-remove(end-of-call-survey) */\nexport type { SurveyIssues } from '../../react-components/src';\n/* @conditional-compile-remove(end-of-call-survey) */\nexport type { SurveyIssuesHeadingStrings } from '../../react-components/src';\n/* @conditional-compile-remove(end-of-call-survey) */\nexport type { CallSurveyImprovementSuggestions } from '../../react-components/src';\n"]}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,+BAA+B,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AAoCzG,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,OAAO,EACP,gBAAgB,EAChB,kBAAkB,EAClB,4BAA4B,EAC7B,MAAM,sCAAsC,CAAC;AAE9C,yDAAyD;AACzD,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,iCAAiC,EAClC,MAAM,sCAAsC,CAAC;AAsB9C,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,aAAa,EACb,mBAAmB,EACnB,eAAe,EACf,yBAAyB,EAC1B,MAAM,mCAAmC,CAAC;AAU3C,OAAO,EACL,mBAAmB,EACnB,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,QAAQ,EACR,UAAU,EACV,oBAAoB,EACpB,sBAAsB,EACtB,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,OAAO,EACP,WAAW,EACX,eAAe,EACf,YAAY,EACZ,SAAS,EACT,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACvB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,6CAA6C;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAExD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE7D,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAErD,iDAAiD;AACjD,OAAO,EACL,kCAAkC,EAClC,yBAAyB,EACzB,qBAAqB,EACtB,MAAM,4BAA4B,CAAC;AA0IpC,mDAAmD;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAsC7D,sDAAsD;AACtD,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AAezE,cAAc,iDAAiD,CAAC;AAChE,cAAc,oCAAoC,CAAC;AACnD,cAAc,gDAAgD,CAAC;AAG/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAe1E,cAAc,yCAAyC,CAAC;AACxD,cAAc,eAAe,CAAC;AAE9B,sDAAsD;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAGhE,sDAAsD;AACtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAGvE,sDAAsD;AACtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * `@azure/communication-react` is an npm package that exports the functionality of the Azure Communication Services - UI Library.\n *\n * This package makes it easy for you to build modern communications user experiences using Azure Communication Services. It gives you a library of production-ready UI components that you can drop into your applications:\n * - Composites: These components are turn-key solutions that implement common communication scenarios. You can quickly add video calling or chat experiences to your applications. Composites are open-source higher order components built using UI components.\n * - UI Components - These components are open-source building blocks that let you build custom communications experience. Components are offered for both calling and chat capabilities that can be combined to build experiences.\n *\n * These UI client libraries all use Microsoft's Fluent design language and assets. Fluent UI provides a foundational layer for the UI Library and is actively used across Microsoft products.\n *\n * In conjunction with the UI components, the UI Library exposes a stateful client library for calling and chat. This client is agnostic to any specific state management framework and can be integrated with common state managers like Redux or React Context.\n * This stateful client library can be used with the UI Components to pass props and methods for the UI Components to render data. For more information, see Stateful Client Overview.\n *\n * For more information visit: https://aka.ms/acsstorybook\n *\n * @packageDocumentation\n */\n\nexport { fromFlatCommunicationIdentifier, toFlatCommunicationIdentifier } from '../../acs-ui-common/src';\nexport type {\n AreEqual,\n CommonProperties,\n MessageStatus,\n Common,\n AreTypeEqual,\n AreParamEqual\n} from '../../acs-ui-common/src';\n\n// Not to export chat/calling specific hook from binding package\nexport type {\n CallClientProviderProps,\n CallAgentProviderProps,\n CallProviderProps,\n GetCallingSelector,\n CallingHandlers,\n CallingBaseSelectorProps,\n CommonCallingHandlers\n} from '../../calling-component-bindings/src';\n\nexport type { VideoBackgroundEffectsDependency, CallingHandlersOptions } from '../../calling-component-bindings/src';\n\nexport type { CaptionsOptions } from '../../calling-component-bindings/src';\n\nexport type {\n ChatClientProviderProps,\n ChatThreadClientProviderProps,\n GetChatSelector,\n ChatHandlers,\n ChatBaseSelectorProps\n} from '../../chat-component-bindings/src';\n\n/* @conditional-compile-remove(attachment-upload) */\nexport type { MessageOptions, ChatMessageType } from '../../acs-ui-common/src';\n\nexport {\n CallClientProvider,\n CallAgentProvider,\n CallProvider,\n useCallClient,\n useCallAgent,\n useCall,\n useDeviceManager,\n getCallingSelector,\n createDefaultCallingHandlers\n} from '../../calling-component-bindings/src';\n\n/* @conditional-compile-remove(teams-identity-support) */\nexport {\n useTeamsCallAgent,\n useTeamsCall,\n createDefaultTeamsCallingHandlers\n} from '../../calling-component-bindings/src';\n\n/* @conditional-compile-remove(teams-identity-support) */\nexport type { TeamsCallingHandlers } from '../../calling-component-bindings/src';\n\nexport type {\n ScreenShareButtonSelector,\n CameraButtonSelector,\n VideoGallerySelector,\n DevicesButtonSelector,\n EmptySelector,\n ErrorBarSelector as CallErrorBarSelector,\n ParticipantListSelector,\n MicrophoneButtonSelector,\n ParticipantsButtonSelector,\n CreateDefaultCallingHandlers\n} from '../../calling-component-bindings/src';\n/* @conditional-compile-remove(PSTN-calls) */\nexport type { HoldButtonSelector } from '../../calling-component-bindings/src';\n\nexport type { RaiseHandButtonSelector } from '../../calling-component-bindings/src';\n\nexport {\n ChatClientProvider,\n ChatThreadClientProvider,\n useChatClient,\n useChatThreadClient,\n getChatSelector,\n createDefaultChatHandlers\n} from '../../chat-component-bindings/src';\n\nexport type {\n MessageThreadSelector,\n TypingIndicatorSelector,\n ChatParticipantListSelector,\n SendBoxSelector,\n ErrorBarSelector as ChatErrorBarSelector\n} from '../../chat-component-bindings/src';\n\nexport {\n _IdentifierProvider,\n CameraButton,\n ControlBar,\n ControlBarButton,\n DevicesButton,\n EndCallButton,\n ErrorBar,\n GridLayout,\n LocalizationProvider,\n MessageStatusIndicator,\n MessageThread,\n MicrophoneButton,\n ParticipantItem,\n ParticipantList,\n ParticipantsButton,\n ScreenShareButton,\n SendBox,\n StreamMedia,\n TypingIndicator,\n VideoGallery,\n VideoTile,\n COMPONENT_LOCALE_EN_GB,\n COMPONENT_LOCALE_AR_SA,\n COMPONENT_LOCALE_CS_CZ,\n COMPONENT_LOCALE_DE_DE,\n COMPONENT_LOCALE_ES_ES,\n COMPONENT_LOCALE_FI_FI,\n COMPONENT_LOCALE_FR_FR,\n COMPONENT_LOCALE_HE_IL,\n COMPONENT_LOCALE_IT_IT,\n COMPONENT_LOCALE_JA_JP,\n COMPONENT_LOCALE_KO_KR,\n COMPONENT_LOCALE_NB_NO,\n COMPONENT_LOCALE_NL_NL,\n COMPONENT_LOCALE_PL_PL,\n COMPONENT_LOCALE_PT_BR,\n COMPONENT_LOCALE_RU_RU,\n COMPONENT_LOCALE_SV_SE,\n COMPONENT_LOCALE_TR_TR,\n COMPONENT_LOCALE_ZH_CN,\n COMPONENT_LOCALE_ZH_TW\n} from '../../react-components/src';\nexport { ImageOverlay } from '../../react-components/src';\n/* @conditional-compile-remove(PSTN-calls) */\nexport { HoldButton } from '../../react-components/src';\n\nexport { RaiseHandButton } from '../../react-components/src';\n\nexport { Dialpad } from '../../react-components/src';\n\n/* @conditional-compile-remove(call-readiness) */\nexport {\n CameraAndMicrophoneSitePermissions,\n MicrophoneSitePermissions,\n CameraSitePermissions\n} from '../../react-components/src';\n/* @conditional-compile-remove(call-readiness) */\nexport type {\n CameraAndMicrophoneSitePermissionsStrings,\n CameraAndMicrophoneSitePermissionsProps,\n CameraSitePermissionsStrings,\n CameraSitePermissionsProps,\n CommonSitePermissionsProps,\n SitePermissionsStrings,\n SitePermissionsStyles,\n MicrophoneSitePermissionsStrings,\n MicrophoneSitePermissionsProps\n} from '../../react-components/src';\n\n/* @conditional-compile-remove(total-participant-count) */\nexport type { ParticipantListStrings } from '../../react-components/src';\n\n/* @conditional-compile-remove(mention) */\nexport type {\n MentionOptions,\n MentionDisplayOptions,\n MentionLookupOptions,\n Mention,\n MentionPopoverStrings\n} from '../../react-components/src';\n\nexport type {\n _IdentifierProviderProps,\n _Identifiers,\n ActiveErrorMessage,\n BaseCustomStyles,\n CallParticipantListParticipant,\n CameraButtonContextualMenuStyles,\n CameraButtonProps,\n CameraButtonStrings,\n CameraButtonStyles,\n ChatMessage,\n CommunicationParticipant,\n ComponentLocale,\n ComponentSlotStyle,\n ComponentStrings,\n ContentSystemMessage,\n ControlBarButtonProps,\n ControlBarButtonStrings,\n ControlBarButtonStyles,\n ControlBarLayout,\n ControlBarProps,\n CreateVideoStreamViewResult,\n CustomAvatarOptions,\n CustomMessage,\n DevicesButtonContextualMenuStyles,\n DevicesButtonProps,\n DevicesButtonStrings,\n DevicesButtonStyles,\n EndCallButtonProps,\n EndCallButtonStrings,\n ErrorBarProps,\n ErrorBarStrings,\n ErrorType,\n GridLayoutProps,\n GridLayoutStyles,\n HorizontalGalleryStyles,\n JumpToNewMessageButtonProps,\n LocalizationProviderProps,\n LocalVideoCameraCycleButtonProps,\n LoadingState,\n Message,\n MessageAttachedStatus,\n MessageCommon,\n MessageContentType,\n MessageProps,\n MessageRenderer,\n MessageStatusIndicatorProps,\n MessageStatusIndicatorStrings,\n MessageThreadProps,\n MessageThreadStrings,\n MessageThreadStyles,\n MicrophoneButtonContextualMenuStyles,\n MicrophoneButtonProps,\n MicrophoneButtonStrings,\n MicrophoneButtonStyles,\n OnRenderAvatarCallback,\n OptionsDevice,\n ParticipantAddedSystemMessage,\n ParticipantItemProps,\n ParticipantItemStrings,\n ParticipantItemStyles,\n ParticipantListItemStyles,\n ParticipantListParticipant,\n ParticipantListProps,\n ParticipantListStyles,\n ParticipantMenuItemsCallback,\n ParticipantRemovedSystemMessage,\n ParticipantState,\n ParticipantsButtonContextualMenuStyles,\n ParticipantsButtonProps,\n ParticipantsButtonStrings,\n ParticipantsButtonStyles,\n ReadReceiptsBySenderId,\n ScreenShareButtonProps,\n ScreenShareButtonStrings,\n SendBoxProps,\n SendBoxStrings,\n SendBoxStylesProps,\n StreamMediaProps,\n SystemMessage,\n SystemMessageCommon,\n TopicUpdatedSystemMessage,\n TypingIndicatorProps,\n TypingIndicatorStrings,\n TypingIndicatorStylesProps,\n UpdateMessageCallback,\n CancelEditCallback,\n VideoGalleryLayout,\n VideoGalleryLocalParticipant,\n VideoGalleryParticipant,\n VideoGalleryProps,\n VideoGalleryRemoteParticipant,\n VideoGalleryStream,\n VideoGalleryStrings,\n VideoGalleryStyles,\n VideoStreamOptions,\n VideoTileProps,\n VideoTileStylesProps,\n ViewScalingMode,\n VideoTileContextualMenuProps,\n VideoTileDrawerMenuProps,\n VideoTilesOptions\n} from '../../react-components/src';\n\nexport type { RaiseHandButtonProps, RaiseHandButtonStrings, RaisedHand } from '../../react-components/src';\nexport type {\n ReactionButtonStrings,\n Reaction,\n ReactionButtonProps,\n ReactionResources,\n ReactionSprite\n} from '../../react-components/src';\n/* @conditional-compile-remove(rich-text-editor) */\nexport { RichTextSendBox } from '../../react-components/src';\n/* @conditional-compile-remove(rich-text-editor) */\nexport type { RichTextSendBoxProps, RichTextSendBoxStrings, RichTextStrings } from '../../react-components/src';\n/* @conditional-compile-remove(spotlight) */\nexport type { Spotlight } from '../../react-components/src';\nexport type { ImageOverlayProps, ImageOverlayStrings } from '../../react-components/src';\n/* @conditional-compile-remove(data-loss-prevention) */\nexport type { BlockedMessage } from '../../react-components/src';\nexport type {\n DialpadMode,\n DialpadProps,\n DialpadStrings,\n DialpadStyles,\n DtmfTone,\n LongPressTrigger\n} from '../../react-components/src';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nexport type { AttachmentOptions } from '../../react-components/src';\n/* @conditional-compile-remove(attachment-upload) */\nexport type { SendBoxErrorBarError } from '../../react-components/src';\n/* @conditional-compile-remove(attachment-upload) */\nexport type {\n AttachmentActionHandler,\n AttachmentSelectionHandler,\n AttachmentRemovalHandler,\n AttachmentUploadOptions,\n AttachmentUploadTask\n} from '../../react-components/src';\n\n/* @conditional-compile-remove(attachment-upload) */\nexport type {\n AttachmentMetadata,\n AttachmentMetadataInProgress,\n AttachmentProgressError\n} from '../../acs-ui-common/src';\n\n/* @conditional-compile-remove(attachment-download) */\nexport type { AttachmentMenuAction, AttachmentDownloadOptions } from '../../react-components/src';\n/* @conditional-compile-remove(attachment-download) */\nexport { defaultAttachmentMenuAction } from '../../react-components/src';\nexport type { ChatAttachmentType } from '../../react-components/src';\nexport type { InlineImageOptions, InlineImage } from '../../react-components/src';\n/* @conditional-compile-remove(PSTN-calls) */\nexport type { HoldButtonProps, HoldButtonStrings, VideoTileStrings } from '../../react-components/src';\n/* @conditional-compile-remove(call-readiness) */\nexport type { BrowserPermissionDeniedStrings, BrowserPermissionDeniedProps } from '../../react-components/src';\n/* @conditional-compile-remove(call-readiness) */\nexport type {\n BrowserPermissionDeniedIOSStrings,\n BrowserPermissionDeniedStyles,\n BrowserPermissionDeniedIOSProps\n} from '../../react-components/src';\nexport type { OverflowGalleryPosition } from '../../react-components/src';\nexport type { LocalVideoTileSize } from '../../react-components/src';\nexport * from '../../react-components/src/localization/locales';\nexport * from '../../react-components/src/theming';\nexport * from '../../calling-stateful-client/src/index-public';\n/* @conditional-compile-remove(one-to-n-calling) */\nexport type { DeclarativeCallAgent } from '../../calling-stateful-client/src';\nexport { createStatefulChatClient } from '../../chat-stateful-client/src';\nexport type {\n StatefulChatClient,\n StatefulChatClientArgs,\n StatefulChatClientOptions,\n ChatMessageWithStatus,\n ChatClientState,\n ChatError,\n ChatErrors,\n ChatThreadClientState,\n ChatThreadProperties,\n ChatErrorTarget\n} from '../../chat-stateful-client/src';\n\nexport type { ResourceFetchResult } from '../../chat-stateful-client/src';\nexport * from '../../react-composites/src/index-public';\nexport * from './mergedHooks';\n\n/* @conditional-compile-remove(unsupported-browser) */\nexport { UnsupportedBrowser } from '../../react-components/src';\n/* @conditional-compile-remove(unsupported-browser) */\nexport type { UnsupportedBrowserStrings, UnsupportedBrowserProps } from '../../react-components/src';\n/* @conditional-compile-remove(unsupported-browser) */\nexport { UnsupportedBrowserVersion } from '../../react-components/src';\n/* @conditional-compile-remove(unsupported-browser) */\nexport type { UnsupportedBrowserVersionStrings, UnsupportedBrowserVersionProps } from '../../react-components/src';\n/* @conditional-compile-remove(unsupported-browser) */\nexport { UnsupportedOperatingSystem } from '../../react-components/src';\n/* @conditional-compile-remove(unsupported-browser) */\nexport type { UnsupportedOperatingSystemStrings, UnsupportedOperatingSystemProps } from '../../react-components/src';\nexport type {\n VerticalGalleryStyles,\n VerticalGalleryStrings,\n VerticalGalleryControlBarStyles\n} from '../../react-components/src';\n\nexport type { SpokenLanguageStrings, CaptionLanguageStrings } from '../../react-components/src';\n/* @conditional-compile-remove(end-of-call-survey) */\nexport type { SurveyIssues } from '../../react-components/src';\n/* @conditional-compile-remove(end-of-call-survey) */\nexport type { SurveyIssuesHeadingStrings } from '../../react-components/src';\n/* @conditional-compile-remove(end-of-call-survey) */\nexport type { CallSurveyImprovementSuggestions } from '../../react-components/src';\n"]}
|
@@ -23,6 +23,10 @@ export interface _AttachmentCardProps {
|
|
23
23
|
* Optional callback that runs if menu bar action onclick throws.
|
24
24
|
*/
|
25
25
|
onActionHandlerFailed?: (errMsg: string) => void;
|
26
|
+
/**
|
27
|
+
* Optional flag to enable self resizing of the attachment card.
|
28
|
+
*/
|
29
|
+
selfResizing?: boolean;
|
26
30
|
}
|
27
31
|
/**
|
28
32
|
* @internal
|
@@ -9,10 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
9
9
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
10
10
|
});
|
11
11
|
};
|
12
|
-
import {
|
13
|
-
|
14
|
-
Icon } from '@fluentui/react';
|
15
|
-
import { Card, CardHeader, Text, Menu, MenuTrigger, ToolbarButton, MenuPopover, MenuItem, MenuList, Toolbar, CardFooter, ProgressBar } from '@fluentui/react-components';
|
12
|
+
import { Icon, TooltipHost } from '@fluentui/react';
|
13
|
+
import { Card, CardHeader, Text, Menu, MenuTrigger, ToolbarButton, MenuPopover, MenuItem, MenuList, Toolbar, CardFooter, ProgressBar, mergeClasses } from '@fluentui/react-components';
|
16
14
|
import { getFileTypeIconProps } from '@fluentui/react-file-type-icons';
|
17
15
|
import React from 'react';
|
18
16
|
import { Announcer } from '../Announcer';
|
@@ -27,7 +25,7 @@ import { useAttachmentCardStyles, attachmentNameContainerClassName, ATTACHMENT_C
|
|
27
25
|
*/
|
28
26
|
export const _AttachmentCard = (props) => {
|
29
27
|
var _a, _b, _c, _d, _e;
|
30
|
-
const { attachment, menuActions, onActionHandlerFailed } = props;
|
28
|
+
const { attachment, menuActions, onActionHandlerFailed, selfResizing } = props;
|
31
29
|
const attachmentCardStyles = useAttachmentCardStyles();
|
32
30
|
const progress = useMemo(() => {
|
33
31
|
return 'progress' in attachment ? attachment.progress : undefined;
|
@@ -57,13 +55,18 @@ export const _AttachmentCard = (props) => {
|
|
57
55
|
}, [attachment]);
|
58
56
|
return (React.createElement("div", { "data-is-focusable": true },
|
59
57
|
React.createElement(Announcer, { announcementString: announcerString, ariaLive: 'polite' }),
|
60
|
-
React.createElement(Card, { className: attachmentCardStyles.root, size: "small", role: "listitem", appearance: "filled-alternative", "aria-label": attachment.name },
|
61
|
-
React.createElement(CardHeader, { image: React.createElement(
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
58
|
+
React.createElement(Card, { className: mergeClasses(attachmentCardStyles.root, selfResizing ? attachmentCardStyles.dynamicWidth : attachmentCardStyles.staticWidth), size: "small", role: "listitem", appearance: "filled-alternative", "aria-label": attachment.name, "data-testid": 'attachment-card' },
|
59
|
+
React.createElement(CardHeader, { className: attachmentCardStyles.content, image: React.createElement("div", { className: attachmentCardStyles.fileIcon },
|
60
|
+
React.createElement(Icon, { "data-ui-id": 'attachmenttype-icon', iconName: getFileTypeIconProps({
|
61
|
+
extension: extension,
|
62
|
+
size: 24,
|
63
|
+
imageFileType: 'svg'
|
64
|
+
}).iconName })), header: React.createElement("div", { className: attachmentNameContainerClassName, id: 'attachment-' + attachment.id },
|
65
|
+
React.createElement(TooltipHost, { content: attachment.name, calloutProps: {
|
66
|
+
gapSpace: 0,
|
67
|
+
target: '#attachment-' + attachment.id
|
68
|
+
} },
|
69
|
+
React.createElement(Text, { className: attachmentCardStyles.title, title: attachment.name }, attachment.name))), action: MappedMenuItems(menuActions, Object.assign(Object.assign({}, attachment), { url: (_e = attachment.url) !== null && _e !== void 0 ? _e : '' }), onActionHandlerFailed) })),
|
67
70
|
isUploadInProgress ? (React.createElement(CardFooter, null,
|
68
71
|
React.createElement(ProgressBar, { thickness: "medium", value: Math.max(progress !== null && progress !== void 0 ? progress : 0, ATTACHMENT_CARD_MIN_PROGRESS), shape: "rounded" }))) : (React.createElement(React.Fragment, null, " "))));
|
69
72
|
};
|
@@ -72,17 +75,19 @@ const MappedMenuItems = (menuActions, attachment, handleOnClickError) => {
|
|
72
75
|
if (menuActions.length === 0) {
|
73
76
|
return React.createElement(React.Fragment, null);
|
74
77
|
}
|
75
|
-
return menuActions.length === 1 ? (React.createElement(
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
78
|
+
return menuActions.length === 1 ? (React.createElement(TooltipHost, { content: menuActions[0].name },
|
79
|
+
React.createElement(ToolbarButton, { "aria-label": menuActions[0].name, icon: menuActions[0].icon, onClick: () => {
|
80
|
+
try {
|
81
|
+
menuActions[0].onClick(attachment);
|
82
|
+
}
|
83
|
+
catch (e) {
|
84
|
+
handleOnClickError === null || handleOnClickError === void 0 ? void 0 : handleOnClickError(e.message);
|
85
|
+
}
|
86
|
+
} }))) : (React.createElement(Toolbar, null,
|
83
87
|
React.createElement(Menu, null,
|
84
|
-
React.createElement(
|
85
|
-
React.createElement(
|
88
|
+
React.createElement(TooltipHost, { content: localeStrings.attachmentMoreMenu },
|
89
|
+
React.createElement(MenuTrigger, null,
|
90
|
+
React.createElement(ToolbarButton, { icon: React.createElement(Icon, { iconName: "AttachmentMoreMenu", "aria-label": localeStrings.attachmentMoreMenu }) }))),
|
86
91
|
React.createElement(MenuPopover, null,
|
87
92
|
React.createElement(MenuList, null, menuActions.map((menuItem, index) => (React.createElement(MenuItem, { key: index, icon: menuItem.icon, onClick: () => __awaiter(void 0, void 0, void 0, function* () {
|
88
93
|
try {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"AttachmentCard.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/Attachment/AttachmentCard.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAElC,OAAO;AACL,iDAAiD;AACjD,IAAI,EACL,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,IAAI,EACJ,UAAU,EACV,IAAI,EACJ,IAAI,EACJ,WAAW,EACX,aAAa,EACb,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,UAAU,EACV,WAAW,EACZ,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,SAAS,EAAE,MAAM,cA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BAAC,IAAI;YACH,oBAAC,WAAW;gBACV,oBAAC,aAAa,IAAC,IAAI,EAAE,oBAAC,IAAI,IAAC,QAAQ,EAAC,oBAAoB,gBAAa,aAAa,CAAC,kBAAkB,GAAI,GAAI,CACjG;YACd,oBAAC,WAAW;gBACV,oBAAC,QAAQ,QACN,WAAW,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE,CAAC,CACpC,oBAAC,QAAQ,IACP,GAAG,EAAE,KAAK,EACV,IAAI,EAAE,QAAQ,CAAC,IAAI,EACnB,OAAO,EAAE,GAAS,EAAE;wBAClB,IAAI,CAAC;4BACH,MAAM,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;wBACrC,CAAC;wBAAC,OAAO,CAAC,EAAE,CAAC;4BACX,kBAAkB,aAAlB,kBAAkB,uBAAlB,kBAAkB,CAAI,CAAW,CAAC,OAAO,CAAC,CAAC;wBAC7C,CAAC;oBACH,CAAC,CAAA,IAEA,QAAQ,CAAC,IAAI,CACL,CACZ,CAAC,CACO,CACC,CACT,CACC,CACX,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n // eslint-disable-next-line no-restricted-imports\n Icon\n} from '@fluentui/react';\nimport {\n Card,\n CardHeader,\n Text,\n Menu,\n MenuTrigger,\n ToolbarButton,\n MenuPopover,\n MenuItem,\n MenuList,\n Toolbar,\n CardFooter,\n ProgressBar\n} from '@fluentui/react-components';\nimport { getFileTypeIconProps } from '@fluentui/react-file-type-icons';\nimport React from 'react';\nimport { _pxToRem } from '@internal/acs-ui-common';\nimport { Announcer } from '../Announcer';\nimport { useEffect, useState, useMemo } from 'react';\nimport { _AttachmentUploadCardsStrings } from './AttachmentUploadCards';\nimport { useLocaleAttachmentCardStringsTrampoline } from '../utils/common';\nimport { AttachmentMenuAction } from '../../types/Attachment';\nimport { AttachmentMetadata, AttachmentMetadataInProgress } from '@internal/acs-ui-common';\nimport {\n useAttachmentCardStyles,\n attachmentNameContainerClassName,\n ATTACHMENT_CARD_MIN_PROGRESS\n} from '../styles/AttachmentCard.styles';\n\n/**\n * @internal\n * AttachmentCard Component Props.\n */\nexport interface _AttachmentCardProps {\n /**\n * Attachment details including name, extension, url, etc.\n */\n attachment: AttachmentMetadata | AttachmentMetadataInProgress;\n /**\n * An array of menu actions to be displayed in the attachment card.\n */\n menuActions: AttachmentMenuAction[];\n /**\n * Optional aria label strings for attachment upload cards\n */\n strings?: _AttachmentUploadCardsStrings;\n /**\n * Optional callback that runs if menu bar action onclick throws.\n */\n onActionHandlerFailed?: (errMsg: string) => void;\n}\n\n/**\n * @internal\n * A component for displaying an attachment card with attachment icon and progress bar.\n *\n * `_AttachmentCard` internally uses the `Card` component from `@fluentui/react-components`. You can checkout the details about these components [here](https://react.fluentui.dev/?path=/docs/components-card).\n */\nexport const _AttachmentCard = (props: _AttachmentCardProps): JSX.Element => {\n const { attachment, menuActions, onActionHandlerFailed } = props;\n const attachmentCardStyles = useAttachmentCardStyles();\n\n const progress = useMemo(() => {\n return 'progress' in attachment ? attachment.progress : undefined;\n }, [attachment]);\n\n const isUploadInProgress = useMemo(() => {\n return progress !== undefined && progress >= 0 && progress < 1;\n }, [progress]);\n\n const [announcerString, setAnnouncerString] = useState<string | undefined>(undefined);\n const localeStrings = useLocaleAttachmentCardStringsTrampoline();\n const uploadStartedString = props.strings?.uploading ?? localeStrings.uploading;\n const uploadCompletedString = props.strings?.uploadCompleted ?? localeStrings.uploadCompleted;\n\n useEffect(() => {\n if (isUploadInProgress) {\n setAnnouncerString(`${uploadStartedString} ${attachment.name}`);\n } else if (progress === 1) {\n setAnnouncerString(`${attachment.name} ${uploadCompletedString}`);\n } else {\n setAnnouncerString(undefined);\n }\n }, [progress, isUploadInProgress, attachment.name, uploadStartedString, uploadCompletedString]);\n\n const extension = useMemo((): string => {\n const re = /(?:\\.([^.]+))?$/;\n const match = re.exec(attachment.name);\n return match && match[1] ? match[1] : '';\n }, [attachment]);\n return (\n <div data-is-focusable={true}>\n <Announcer announcementString={announcerString} ariaLive={'polite'} />\n <Card\n className={attachmentCardStyles.root}\n size=\"small\"\n role=\"listitem\"\n appearance=\"filled-alternative\"\n aria-label={attachment.name}\n >\n <CardHeader\n image={\n <Icon\n data-ui-id={'attachmenttype-icon'}\n iconName={\n getFileTypeIconProps({\n extension: extension,\n size: 24,\n imageFileType: 'svg'\n }).iconName\n }\n />\n }\n header={\n <div className={attachmentNameContainerClassName}>\n <Text title={attachment.name}>{attachment.name}</Text>\n </div>\n }\n action={MappedMenuItems(\n menuActions,\n {\n ...attachment,\n url: attachment.url ?? ''\n },\n onActionHandlerFailed\n )}\n />\n </Card>\n {isUploadInProgress ? (\n <CardFooter>\n <ProgressBar\n thickness=\"medium\"\n value={Math.max(progress ?? 0, ATTACHMENT_CARD_MIN_PROGRESS)}\n shape=\"rounded\"\n />\n </CardFooter>\n ) : (\n <> </>\n )}\n </div>\n );\n};\n\nconst MappedMenuItems = (\n menuActions: AttachmentMenuAction[],\n attachment: AttachmentMetadata,\n handleOnClickError?: (errMsg: string) => void\n): JSX.Element => {\n const localeStrings = useLocaleAttachmentCardStringsTrampoline();\n\n if (menuActions.length === 0) {\n return <></>;\n }\n return menuActions.length === 1 ? (\n <ToolbarButton\n aria-label={menuActions[0].name}\n icon={menuActions[0].icon}\n onClick={() => {\n try {\n menuActions[0].onClick(attachment);\n } catch (e) {\n handleOnClickError?.((e as Error).message);\n }\n }}\n />\n ) : (\n <Toolbar>\n <Menu>\n <MenuTrigger>\n <ToolbarButton icon={<Icon iconName=\"AttachmentMoreMenu\" aria-label={localeStrings.attachmentMoreMenu} />} />\n </MenuTrigger>\n <MenuPopover>\n <MenuList>\n {menuActions.map((menuItem, index) => (\n <MenuItem\n key={index}\n icon={menuItem.icon}\n onClick={async () => {\n try {\n await menuItem.onClick(attachment);\n } catch (e) {\n handleOnClickError?.((e as Error).message);\n }\n }}\n >\n {menuItem.name}\n </MenuItem>\n ))}\n </MenuList>\n </MenuPopover>\n </Menu>\n </Toolbar>\n );\n};\n"]}
|
1
|
+
{"version":3,"file":"AttachmentCard.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/Attachment/AttachmentCard.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAElC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EACL,IAAI,EACJ,UAAU,EACV,IAAI,EACJ,IAAI,EACJ,WAAW,EACX,aAAa,EACb,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,UAAU,EACV,WAAW,EACX,YAAY,EACb,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAErD,OAAO,EAAE,wCAAwC,EAAE,MAAM,iBAAiB,CAAC;AAG3E,OAAO,EACL,uBAAuB,EACvB,gCAAgC,EAChC,4BAA4B,EAC7B,MAAM,iCAAiC,CAAC;AA6BzC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAA2B,EAAe,EAAE;;IAC1E,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,qBAAqB,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC;IAC/E,MAAM,oBAAoB,GAAG,uBAAuB,EAAE,CAAC;IAEvD,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,EAAE;QAC5B,OAAO,UAAU,IAAI,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;IACpE,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;IAEjB,MAAM,kBAA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AAa,IACZ,IAAI,EAAE,oBAAC,IAAI,IAAC,QAAQ,EAAC,oBAAoB,gBAAa,aAAa,CAAC,kBAAkB,GAAI,GAC1F,CACU,CACF;YACd,oBAAC,WAAW;gBACV,oBAAC,QAAQ,QACN,WAAW,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE,CAAC,CACpC,oBAAC,QAAQ,IACP,GAAG,EAAE,KAAK,EACV,IAAI,EAAE,QAAQ,CAAC,IAAI,EACnB,OAAO,EAAE,GAAS,EAAE;wBAClB,IAAI,CAAC;4BACH,MAAM,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;wBACrC,CAAC;wBAAC,OAAO,CAAC,EAAE,CAAC;4BACX,kBAAkB,aAAlB,kBAAkB,uBAAlB,kBAAkB,CAAI,CAAW,CAAC,OAAO,CAAC,CAAC;wBAC7C,CAAC;oBACH,CAAC,CAAA,IAEA,QAAQ,CAAC,IAAI,CACL,CACZ,CAAC,CACO,CACC,CACT,CACC,CACX,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { Icon, TooltipHost } from '@fluentui/react';\nimport {\n Card,\n CardHeader,\n Text,\n Menu,\n MenuTrigger,\n ToolbarButton,\n MenuPopover,\n MenuItem,\n MenuList,\n Toolbar,\n CardFooter,\n ProgressBar,\n mergeClasses\n} from '@fluentui/react-components';\nimport { getFileTypeIconProps } from '@fluentui/react-file-type-icons';\nimport React from 'react';\nimport { _pxToRem } from '@internal/acs-ui-common';\nimport { Announcer } from '../Announcer';\nimport { useEffect, useState, useMemo } from 'react';\nimport { _AttachmentUploadCardsStrings } from './AttachmentUploadCards';\nimport { useLocaleAttachmentCardStringsTrampoline } from '../utils/common';\nimport { AttachmentMenuAction } from '../../types/Attachment';\nimport { AttachmentMetadata, AttachmentMetadataInProgress } from '@internal/acs-ui-common';\nimport {\n useAttachmentCardStyles,\n attachmentNameContainerClassName,\n ATTACHMENT_CARD_MIN_PROGRESS\n} from '../styles/AttachmentCard.styles';\n\n/**\n * @internal\n * AttachmentCard Component Props.\n */\nexport interface _AttachmentCardProps {\n /**\n * Attachment details including name, extension, url, etc.\n */\n attachment: AttachmentMetadata | AttachmentMetadataInProgress;\n /**\n * An array of menu actions to be displayed in the attachment card.\n */\n menuActions: AttachmentMenuAction[];\n /**\n * Optional aria label strings for attachment upload cards\n */\n strings?: _AttachmentUploadCardsStrings;\n /**\n * Optional callback that runs if menu bar action onclick throws.\n */\n onActionHandlerFailed?: (errMsg: string) => void;\n /**\n * Optional flag to enable self resizing of the attachment card.\n */\n selfResizing?: boolean;\n}\n\n/**\n * @internal\n * A component for displaying an attachment card with attachment icon and progress bar.\n *\n * `_AttachmentCard` internally uses the `Card` component from `@fluentui/react-components`. You can checkout the details about these components [here](https://react.fluentui.dev/?path=/docs/components-card).\n */\nexport const _AttachmentCard = (props: _AttachmentCardProps): JSX.Element => {\n const { attachment, menuActions, onActionHandlerFailed, selfResizing } = props;\n const attachmentCardStyles = useAttachmentCardStyles();\n\n const progress = useMemo(() => {\n return 'progress' in attachment ? attachment.progress : undefined;\n }, [attachment]);\n\n const isUploadInProgress = useMemo(() => {\n return progress !== undefined && progress >= 0 && progress < 1;\n }, [progress]);\n\n const [announcerString, setAnnouncerString] = useState<string | undefined>(undefined);\n const localeStrings = useLocaleAttachmentCardStringsTrampoline();\n const uploadStartedString = props.strings?.uploading ?? localeStrings.uploading;\n const uploadCompletedString = props.strings?.uploadCompleted ?? localeStrings.uploadCompleted;\n\n useEffect(() => {\n if (isUploadInProgress) {\n setAnnouncerString(`${uploadStartedString} ${attachment.name}`);\n } else if (progress === 1) {\n setAnnouncerString(`${attachment.name} ${uploadCompletedString}`);\n } else {\n setAnnouncerString(undefined);\n }\n }, [progress, isUploadInProgress, attachment.name, uploadStartedString, uploadCompletedString]);\n\n const extension = useMemo((): string => {\n const re = /(?:\\.([^.]+))?$/;\n const match = re.exec(attachment.name);\n return match && match[1] ? match[1] : '';\n }, [attachment]);\n return (\n <div data-is-focusable={true}>\n <Announcer announcementString={announcerString} ariaLive={'polite'} />\n <Card\n className={mergeClasses(\n attachmentCardStyles.root,\n selfResizing ? attachmentCardStyles.dynamicWidth : attachmentCardStyles.staticWidth\n )}\n size=\"small\"\n role=\"listitem\"\n appearance=\"filled-alternative\"\n aria-label={attachment.name}\n data-testid={'attachment-card'}\n >\n <CardHeader\n className={attachmentCardStyles.content}\n image={\n <div className={attachmentCardStyles.fileIcon}>\n <Icon\n data-ui-id={'attachmenttype-icon'}\n iconName={\n getFileTypeIconProps({\n extension: extension,\n size: 24,\n imageFileType: 'svg'\n }).iconName\n }\n />\n </div>\n }\n header={\n <div className={attachmentNameContainerClassName} id={'attachment-' + attachment.id}>\n <TooltipHost\n content={attachment.name}\n calloutProps={{\n gapSpace: 0,\n target: '#attachment-' + attachment.id\n }}\n >\n <Text className={attachmentCardStyles.title} title={attachment.name}>\n {attachment.name}\n </Text>\n </TooltipHost>\n </div>\n }\n action={MappedMenuItems(\n menuActions,\n {\n ...attachment,\n url: attachment.url ?? ''\n },\n onActionHandlerFailed\n )}\n />\n </Card>\n {isUploadInProgress ? (\n <CardFooter>\n <ProgressBar\n thickness=\"medium\"\n value={Math.max(progress ?? 0, ATTACHMENT_CARD_MIN_PROGRESS)}\n shape=\"rounded\"\n />\n </CardFooter>\n ) : (\n <> </>\n )}\n </div>\n );\n};\n\nconst MappedMenuItems = (\n menuActions: AttachmentMenuAction[],\n attachment: AttachmentMetadata,\n handleOnClickError?: (errMsg: string) => void\n): JSX.Element => {\n const localeStrings = useLocaleAttachmentCardStringsTrampoline();\n\n if (menuActions.length === 0) {\n return <></>;\n }\n return menuActions.length === 1 ? (\n <TooltipHost content={menuActions[0].name}>\n <ToolbarButton\n aria-label={menuActions[0].name}\n icon={menuActions[0].icon}\n onClick={() => {\n try {\n menuActions[0].onClick(attachment);\n } catch (e) {\n handleOnClickError?.((e as Error).message);\n }\n }}\n />\n </TooltipHost>\n ) : (\n <Toolbar>\n <Menu>\n <TooltipHost content={localeStrings.attachmentMoreMenu}>\n <MenuTrigger>\n <ToolbarButton\n icon={<Icon iconName=\"AttachmentMoreMenu\" aria-label={localeStrings.attachmentMoreMenu} />}\n />\n </MenuTrigger>\n </TooltipHost>\n <MenuPopover>\n <MenuList>\n {menuActions.map((menuItem, index) => (\n <MenuItem\n key={index}\n icon={menuItem.icon}\n onClick={async () => {\n try {\n await menuItem.onClick(attachment);\n } catch (e) {\n handleOnClickError?.((e as Error).message);\n }\n }}\n >\n {menuItem.name}\n </MenuItem>\n ))}\n </MenuList>\n </MenuPopover>\n </Menu>\n </Toolbar>\n );\n};\n"]}
|
@@ -1,4 +1,18 @@
|
|
1
1
|
import React from 'react';
|
2
|
+
/**
|
3
|
+
* @internal
|
4
|
+
* Props for `_AttachmentCardGroup` component.
|
5
|
+
*/
|
6
|
+
export declare enum _AttachmentCardGroupLayout {
|
7
|
+
/**
|
8
|
+
* Children are rendered in a grid layout with self resizing.
|
9
|
+
*/
|
10
|
+
Grid = "grid",
|
11
|
+
/**
|
12
|
+
* Children are rendered in a flex layout with no resizing.
|
13
|
+
*/
|
14
|
+
Flex = "flex"
|
15
|
+
}
|
2
16
|
/**
|
3
17
|
* @internal
|
4
18
|
* Props for `_AttachmentCardGroup` component.
|
@@ -6,6 +20,7 @@ import React from 'react';
|
|
6
20
|
export interface _AttachmentCardGroupProps {
|
7
21
|
children: React.ReactNode;
|
8
22
|
ariaLabel?: string;
|
23
|
+
attachmentGroupLayout?: _AttachmentCardGroupLayout;
|
9
24
|
}
|
10
25
|
/**
|
11
26
|
* @internal
|
@@ -1,35 +1,33 @@
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
2
2
|
// Licensed under the MIT License.
|
3
3
|
import { mergeStyles, Stack } from '@fluentui/react';
|
4
|
-
import { _pxToRem } from "../../../../acs-ui-common/src";
|
5
4
|
import React from 'react';
|
5
|
+
import { attachmentCardBaseStyles, attachmentCardFlexLayout, attachmentCardGirdLayout } from '../styles/AttachmentCardGroup.styles';
|
6
6
|
/**
|
7
|
-
*
|
8
|
-
*
|
9
|
-
* This is a workaround to avoid this issue.
|
7
|
+
* @internal
|
8
|
+
* Props for `_AttachmentCardGroup` component.
|
10
9
|
*/
|
11
|
-
|
12
|
-
|
13
|
-
'& > *': {
|
14
|
-
margin: _pxToRem(2)
|
15
|
-
},
|
10
|
+
export var _AttachmentCardGroupLayout;
|
11
|
+
(function (_AttachmentCardGroupLayout) {
|
16
12
|
/**
|
17
|
-
*
|
13
|
+
* Children are rendered in a grid layout with self resizing.
|
18
14
|
*/
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
15
|
+
_AttachmentCardGroupLayout["Grid"] = "grid";
|
16
|
+
/**
|
17
|
+
* Children are rendered in a flex layout with no resizing.
|
18
|
+
*/
|
19
|
+
_AttachmentCardGroupLayout["Flex"] = "flex";
|
20
|
+
})(_AttachmentCardGroupLayout || (_AttachmentCardGroupLayout = {}));
|
23
21
|
/**
|
24
22
|
* @internal
|
25
23
|
* Used with `_AttachmentCard` component where `_AttachmentCard` components are passed as children.
|
26
24
|
* Renders the children equally spaced in multiple rows.
|
27
25
|
*/
|
28
26
|
export const _AttachmentCardGroup = (props) => {
|
29
|
-
const { children, ariaLabel } = props;
|
27
|
+
const { children, ariaLabel, attachmentGroupLayout } = props;
|
30
28
|
if (!children) {
|
31
29
|
return React.createElement(React.Fragment, null);
|
32
30
|
}
|
33
|
-
return (React.createElement(Stack, { horizontal: true, className:
|
31
|
+
return (React.createElement(Stack, { horizontal: true, className: mergeStyles(attachmentCardBaseStyles, attachmentGroupLayout === _AttachmentCardGroupLayout.Grid ? attachmentCardGirdLayout : attachmentCardFlexLayout), "aria-label": ariaLabel }, children));
|
34
32
|
};
|
35
33
|
//# sourceMappingURL=AttachmentCardGroup.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"AttachmentCardGroup.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/Attachment/AttachmentCardGroup.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;
|
1
|
+
{"version":3,"file":"AttachmentCardGroup.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/Attachment/AttachmentCardGroup.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EACxB,wBAAwB,EACzB,MAAM,sCAAsC,CAAC;AAE9C;;;GAGG;AACH,MAAM,CAAN,IAAY,0BASX;AATD,WAAY,0BAA0B;IACpC;;OAEG;IACH,2CAAa,CAAA;IACb;;OAEG;IACH,2CAAa,CAAA;AACf,CAAC,EATW,0BAA0B,KAA1B,0BAA0B,QASrC;AAYD;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,KAAgC,EAAe,EAAE;IACpF,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,qBAAqB,EAAE,GAAG,KAAK,CAAC;IAC7D,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,yCAAK,CAAC;IACf,CAAC;IACD,OAAO,CACL,oBAAC,KAAK,IACJ,UAAU,QACV,SAAS,EAAE,WAAW,CACpB,wBAAwB,EACxB,qBAAqB,KAAK,0BAA0B,CAAC,IAAI,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,wBAAwB,CAChH,gBACW,SAAS,IAEpB,QAAQ,CACH,CACT,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { mergeStyles, Stack } from '@fluentui/react';\nimport { _pxToRem } from '@internal/acs-ui-common';\nimport React from 'react';\nimport { _ATTACHMENT_CARD_MARGIN_IN_PX, _ATTACHMENT_CARD_WIDTH_IN_REM } from '../styles/AttachmentCard.styles';\nimport {\n attachmentCardBaseStyles,\n attachmentCardFlexLayout,\n attachmentCardGirdLayout\n} from '../styles/AttachmentCardGroup.styles';\n\n/**\n * @internal\n * Props for `_AttachmentCardGroup` component.\n */\nexport enum _AttachmentCardGroupLayout {\n /**\n * Children are rendered in a grid layout with self resizing.\n */\n Grid = 'grid',\n /**\n * Children are rendered in a flex layout with no resizing.\n */\n Flex = 'flex'\n}\n\n/**\n * @internal\n * Props for `_AttachmentCardGroup` component.\n */\nexport interface _AttachmentCardGroupProps {\n children: React.ReactNode;\n ariaLabel?: string;\n attachmentGroupLayout?: _AttachmentCardGroupLayout;\n}\n\n/**\n * @internal\n * Used with `_AttachmentCard` component where `_AttachmentCard` components are passed as children.\n * Renders the children equally spaced in multiple rows.\n */\nexport const _AttachmentCardGroup = (props: _AttachmentCardGroupProps): JSX.Element => {\n const { children, ariaLabel, attachmentGroupLayout } = props;\n if (!children) {\n return <></>;\n }\n return (\n <Stack\n horizontal\n className={mergeStyles(\n attachmentCardBaseStyles,\n attachmentGroupLayout === _AttachmentCardGroupLayout.Grid ? attachmentCardGirdLayout : attachmentCardFlexLayout\n )}\n aria-label={ariaLabel}\n >\n {children}\n </Stack>\n );\n};\n"]}
|
@@ -1,24 +1,24 @@
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
2
2
|
// Licensed under the MIT License.
|
3
|
-
import { Icon
|
3
|
+
import { Icon } from '@fluentui/react';
|
4
4
|
import React, { useCallback } from 'react';
|
5
5
|
import { useMemo } from 'react';
|
6
6
|
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
|
7
7
|
import { useLocale } from '../../localization';
|
8
8
|
import { _AttachmentCard } from './AttachmentCard';
|
9
|
-
import { _AttachmentCardGroup } from './AttachmentCardGroup';
|
9
|
+
import { _AttachmentCardGroup, _AttachmentCardGroupLayout } from './AttachmentCardGroup';
|
10
10
|
/* @conditional-compile-remove(attachment-download) */
|
11
11
|
import { getAttachmentCountLiveMessage } from '../ChatMessage/ChatMessageContent';
|
12
|
-
|
13
|
-
|
14
|
-
};
|
12
|
+
import { mergeClasses } from '@griffel/react';
|
13
|
+
import { useAttachmentCardGroupStyles } from '../styles/AttachmentCardGroup.styles';
|
15
14
|
/**
|
16
15
|
* @internal
|
17
16
|
*/
|
18
17
|
export const _AttachmentDownloadCards = (props) => {
|
19
|
-
var _a
|
18
|
+
var _a;
|
20
19
|
const { attachments, message } = props;
|
21
20
|
const localeStrings = useLocaleStringsTrampoline();
|
21
|
+
const attachmentCardGroupStyles = useAttachmentCardGroupStyles();
|
22
22
|
const getMenuActions = useCallback((attachment, localeStrings, message, action) => {
|
23
23
|
const defaultMenuActions = getDefaultMenuActions(localeStrings, message);
|
24
24
|
try {
|
@@ -34,23 +34,24 @@ export const _AttachmentDownloadCards = (props) => {
|
|
34
34
|
return defaultMenuActions;
|
35
35
|
}
|
36
36
|
}, []);
|
37
|
-
const downloadAttachmentButtonString = useMemo(() => () => {
|
38
|
-
var _a, _b;
|
39
|
-
return (_b = (_a = props.strings) === null || _a === void 0 ? void 0 : _a.downloadAttachment) !== null && _b !== void 0 ? _b : localeStrings.downloadAttachment;
|
40
|
-
}, [(_a = props.strings) === null || _a === void 0 ? void 0 : _a.downloadAttachment, localeStrings.downloadAttachment]);
|
41
37
|
const attachmentCardGroupDescription = useMemo(() => () => {
|
42
38
|
var _a, _b;
|
43
39
|
/* @conditional-compile-remove(attachment-download) */
|
44
40
|
return getAttachmentCountLiveMessage(attachments !== null && attachments !== void 0 ? attachments : [], (_b = (_a = props.strings) === null || _a === void 0 ? void 0 : _a.attachmentCardGroupMessage) !== null && _b !== void 0 ? _b : localeStrings.attachmentCardGroupMessage);
|
45
41
|
return '';
|
46
|
-
}, [(
|
42
|
+
}, [(_a = props.strings) === null || _a === void 0 ? void 0 : _a.attachmentCardGroupMessage, localeStrings.attachmentCardGroupMessage, attachments]);
|
43
|
+
const hasMultipleAttachments = useMemo(() => {
|
44
|
+
var _a, _b;
|
45
|
+
return ((_b = (_a = props.attachments) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 1;
|
46
|
+
}, [props.attachments]);
|
47
47
|
if (!attachments || attachments.length === 0 || !attachments) {
|
48
48
|
return React.createElement(React.Fragment, null);
|
49
49
|
}
|
50
|
-
return (React.createElement("div", {
|
51
|
-
|
52
|
-
|
53
|
-
|
50
|
+
return (React.createElement("div", { className: mergeClasses(attachmentCardGroupStyles.root, hasMultipleAttachments
|
51
|
+
? attachmentCardGroupStyles.multipleAttachments
|
52
|
+
: attachmentCardGroupStyles.singleAttachment), "data-ui-id": "attachment-download-card-group" },
|
53
|
+
React.createElement(_AttachmentCardGroup, { ariaLabel: attachmentCardGroupDescription(), attachmentGroupLayout: _AttachmentCardGroupLayout.Grid }, attachments &&
|
54
|
+
attachments.map((attachment) => (React.createElement(_AttachmentCard, { attachment: attachment, key: attachment.id, menuActions: getMenuActions(attachment, localeStrings, message, props.actionsForAttachment), onActionHandlerFailed: props.onActionHandlerFailed, selfResizing: hasMultipleAttachments }))))));
|
54
55
|
};
|
55
56
|
/**
|
56
57
|
* @private
|
package/dist/dist-esm/react-components/src/components/Attachment/AttachmentDownloadCards.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"AttachmentDownloadCards.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/Attachment/AttachmentDownloadCards.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,qGAAqG;AACrG,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,eA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,EAAE,EAAE,0BAA0B,EAAE,EAAE,EAAE,CAAC;AACxF,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,qBAAqB,GAAG,CAC5B,MAAuC,EACvC,WAAyB,EACD,EAAE;;IAC1B,+EAA+E;IAC/E,IAAI,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,QAAQ,0CAAE,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;QAChD,OAAO;4CAEA,2BAA2B,KAC9B,IAAI,EAAE,MAAM,CAAC,cAAc,EAC3B,IAAI,EAAE,oBAAC,IAAI,IAAC,QAAQ,EAAC,gBAAgB,GAAG;SAE3C,CAAC;IACJ,CAAC;IACD,+CAA+C;IAC/C,OAAO;wCAEA,2BAA2B,KAC9B,IAAI,EAAE,MAAM,CAAC,kBAAkB;KAElC,CAAC;AACJ,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAyB;IAC/D;;;;;;;;;;OAUG;IACH,IAAI,EAAE,UAAU;IAChB,6DAA6D;IAC7D,IAAI,EAAE,oBAAC,IAAI,IAAC,QAAQ,EAAC,oBAAoB,gBAAY,wCAAwC,GAAG;IAChG,wDAAwD;IACxD,OAAO,EAAE,CAAC,UAA8B,EAAE,EAAE;QAC1C,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;YACnC,MAAM,CAAC,IAAI,CAAE,UAAiC,CAAC,GAAG,EAAE,QAAQ,EAAE,qBAAqB,CAAC,CAAC;YACrF,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { Icon, TooltipHost } from '@fluentui/react';\nimport React, { useCallback } from 'react';\nimport { useMemo } from 'react';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { useLocale } from '../../localization';\nimport { _AttachmentCard } from './AttachmentCard';\nimport { _AttachmentCardGroup } from './AttachmentCardGroup';\n/* @conditional-compile-remove(attachment-download) */\nimport { getAttachmentCountLiveMessage } from '../ChatMessage/ChatMessageContent';\nimport { _formatString } from '@internal/acs-ui-common';\nimport { AttachmentMenuAction } from '../../types/Attachment';\nimport { AttachmentMetadata } from '@internal/acs-ui-common';\nimport { ChatMessage } from '../../types';\n\n/**\n * Represents the type of attachment\n * @public\n */\nexport type ChatAttachmentType =\n | 'unknown'\n | 'image'\n | /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */ 'file';\n\n/**\n * Strings of _AttachmentDownloadCards that can be overridden.\n *\n * @internal\n */\nexport interface _AttachmentDownloadCardsStrings {\n /** Aria label to notify user when focus is on attachment download button. */\n downloadAttachment: string;\n /** Aria label to notify user when focus is on attachment open button. */\n openAttachment: string;\n attachmentCardGroupMessage: string;\n}\n\n/**\n * @internal\n */\nexport interface _AttachmentDownloadCardsProps {\n /**\n * A chat message metadata that includes attachment metadata\n */\n attachments?: AttachmentMetadata[];\n /**\n * A chat message metadata that includes attachment metadata\n */\n message?: ChatMessage;\n /**\n * Optional callback to handle attachment download\n */\n actionsForAttachment?: (attachment: AttachmentMetadata, message?: ChatMessage) => AttachmentMenuAction[];\n /**\n * Optional callback that runs if downloadHandler returns an error.\n */\n onActionHandlerFailed?: (errMsg: string) => void;\n /**\n * Optional aria label strings for attachment download cards\n */\n strings?: _AttachmentDownloadCardsStrings;\n}\n\nconst attachmentDownloadCardsStyle = {\n marginTop: '0.25rem'\n};\n\n/**\n * @internal\n */\nexport const _AttachmentDownloadCards = (props: _AttachmentDownloadCardsProps): JSX.Element => {\n const { attachments, message } = props;\n const localeStrings = useLocaleStringsTrampoline();\n\n const getMenuActions = useCallback(\n (\n attachment: AttachmentMetadata,\n localeStrings: _AttachmentDownloadCardsStrings,\n message?: ChatMessage,\n action?: (attachment: AttachmentMetadata, message?: ChatMessage) => AttachmentMenuAction[]\n ): AttachmentMenuAction[] => {\n const defaultMenuActions = getDefaultMenuActions(localeStrings, message);\n try {\n const actions = action?.(attachment, message);\n if (actions && actions.length > 0) {\n return actions;\n } else {\n return defaultMenuActions;\n }\n } catch (error) {\n return defaultMenuActions;\n }\n },\n []\n );\n\n const downloadAttachmentButtonString = useMemo(\n () => () => {\n return props.strings?.downloadAttachment ?? localeStrings.downloadAttachment;\n },\n [props.strings?.downloadAttachment, localeStrings.downloadAttachment]\n );\n\n const attachmentCardGroupDescription = useMemo(\n () => () => {\n /* @conditional-compile-remove(attachment-download) */\n return getAttachmentCountLiveMessage(\n attachments ?? [],\n props.strings?.attachmentCardGroupMessage ?? localeStrings.attachmentCardGroupMessage\n );\n return '';\n },\n [props.strings?.attachmentCardGroupMessage, localeStrings.attachmentCardGroupMessage, attachments]\n );\n\n if (!attachments || attachments.length === 0 || !attachments) {\n return <></>;\n }\n\n return (\n <div style={attachmentDownloadCardsStyle} data-ui-id=\"attachment-download-card-group\">\n <_AttachmentCardGroup ariaLabel={attachmentCardGroupDescription()}>\n {attachments &&\n attachments.map((attachment) => (\n <TooltipHost content={downloadAttachmentButtonString()} key={attachment.name}>\n <_AttachmentCard\n attachment={attachment}\n key={attachment.id}\n menuActions={getMenuActions(attachment, localeStrings, message, props.actionsForAttachment)}\n onActionHandlerFailed={props.onActionHandlerFailed}\n />\n </TooltipHost>\n ))}\n </_AttachmentCardGroup>\n </div>\n );\n};\n\n/**\n * @private\n */\nconst useLocaleStringsTrampoline = (): _AttachmentDownloadCardsStrings => {\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n return useLocale().strings.messageThread;\n return { downloadAttachment: '', openAttachment: '', attachmentCardGroupMessage: '' };\n};\n\n/**\n * @private\n */\nconst getDefaultMenuActions = (\n locale: _AttachmentDownloadCardsStrings,\n chatMessage?: ChatMessage\n): AttachmentMenuAction[] => {\n // if message is sent by a Teams user, we need to use a different icon (\"open\")\n if (chatMessage?.senderId?.includes('8:orgid:')) {\n return [\n {\n ...defaultAttachmentMenuAction,\n name: locale.openAttachment,\n icon: <Icon iconName=\"OpenAttachment\" />\n }\n ];\n }\n // otherwise, use the default icon (\"download\")\n return [\n {\n ...defaultAttachmentMenuAction,\n name: locale.downloadAttachment\n }\n ];\n};\n\n/**\n * @beta\n *\n * The default menu action for downloading attachments. This action will open the attachment's URL in a new tab.\n */\nexport const defaultAttachmentMenuAction: AttachmentMenuAction = {\n /**\n *\n * name is used for aria-label only when there's one button. For multiple buttons, it's used as a label.\n * by default it's an unlocalized string when this is used as a imported constant,\n * but you can overwrite it with your own localized string.\n *\n * i.e. defaultAttachmentMenuAction.name = localize('Download');\n *\n * when no action is provided, the UI library will overwrite this name\n * with a localized string this string when it's used in the UI.\n */\n name: 'Download',\n // this is the icon shown on the right of the attachment card\n icon: <Icon iconName=\"DownloadAttachment\" data-ui-id=\"attachment-download-card-download-icon\" />,\n // this is the action that runs when the icon is clicked\n onClick: (attachment: AttachmentMetadata) => {\n return new Promise<void>((resolve) => {\n window.open((attachment as AttachmentMetadata).url, '_blank', 'noopener,noreferrer');\n resolve();\n });\n }\n};\n"]}
|
1
|
+
{"version":3,"file":"AttachmentDownloadCards.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/Attachment/AttachmentDownloadCards.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,qGAAqG;AACrG,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACzF,sDAAsD;AACtD,OAAO,EAAE,6BAA6B,EAAE,MAAM,mCAAmC,CAAC;AAKlF,OAAO,EAAE,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AE,CAAC;AACxF,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,qBAAqB,GAAG,CAC5B,MAAuC,EACvC,WAAyB,EACD,EAAE;;IAC1B,+EAA+E;IAC/E,IAAI,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,QAAQ,0CAAE,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;QAChD,OAAO;4CAEA,2BAA2B,KAC9B,IAAI,EAAE,MAAM,CAAC,cAAc,EAC3B,IAAI,EAAE,oBAAC,IAAI,IAAC,QAAQ,EAAC,gBAAgB,GAAG;SAE3C,CAAC;IACJ,CAAC;IACD,+CAA+C;IAC/C,OAAO;wCAEA,2BAA2B,KAC9B,IAAI,EAAE,MAAM,CAAC,kBAAkB;KAElC,CAAC;AACJ,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAyB;IAC/D;;;;;;;;;;OAUG;IACH,IAAI,EAAE,UAAU;IAChB,6DAA6D;IAC7D,IAAI,EAAE,oBAAC,IAAI,IAAC,QAAQ,EAAC,oBAAoB,gBAAY,wCAAwC,GAAG;IAChG,wDAAwD;IACxD,OAAO,EAAE,CAAC,UAA8B,EAAE,EAAE;QAC1C,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;YACnC,MAAM,CAAC,IAAI,CAAE,UAAiC,CAAC,GAAG,EAAE,QAAQ,EAAE,qBAAqB,CAAC,CAAC;YACrF,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { Icon } from '@fluentui/react';\nimport React, { useCallback } from 'react';\nimport { useMemo } from 'react';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { useLocale } from '../../localization';\nimport { _AttachmentCard } from './AttachmentCard';\nimport { _AttachmentCardGroup, _AttachmentCardGroupLayout } from './AttachmentCardGroup';\n/* @conditional-compile-remove(attachment-download) */\nimport { getAttachmentCountLiveMessage } from '../ChatMessage/ChatMessageContent';\nimport { _formatString } from '@internal/acs-ui-common';\nimport { AttachmentMenuAction } from '../../types/Attachment';\nimport { AttachmentMetadata } from '@internal/acs-ui-common';\nimport { ChatMessage } from '../../types';\nimport { mergeClasses } from '@griffel/react';\nimport { _ATTACHMENT_CARD_WIDTH_IN_REM } from '../styles/AttachmentCard.styles';\nimport { useAttachmentCardGroupStyles } from '../styles/AttachmentCardGroup.styles';\n\n/**\n * Represents the type of attachment\n * @public\n */\nexport type ChatAttachmentType =\n | 'unknown'\n | 'image'\n | /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */ 'file';\n\n/**\n * Strings of _AttachmentDownloadCards that can be overridden.\n *\n * @internal\n */\nexport interface _AttachmentDownloadCardsStrings {\n /** Aria label to notify user when focus is on attachment download button. */\n downloadAttachment: string;\n /** Aria label to notify user when focus is on attachment open button. */\n openAttachment: string;\n attachmentCardGroupMessage: string;\n}\n\n/**\n * @internal\n */\nexport interface _AttachmentDownloadCardsProps {\n /**\n * A chat message metadata that includes attachment metadata\n */\n attachments?: AttachmentMetadata[];\n /**\n * A chat message metadata that includes attachment metadata\n */\n message?: ChatMessage;\n /**\n * Optional callback to handle attachment download\n */\n actionsForAttachment?: (attachment: AttachmentMetadata, message?: ChatMessage) => AttachmentMenuAction[];\n /**\n * Optional callback that runs if downloadHandler returns an error.\n */\n onActionHandlerFailed?: (errMsg: string) => void;\n /**\n * Optional aria label strings for attachment download cards\n */\n strings?: _AttachmentDownloadCardsStrings;\n}\n\n/**\n * @internal\n */\nexport const _AttachmentDownloadCards = (props: _AttachmentDownloadCardsProps): JSX.Element => {\n const { attachments, message } = props;\n const localeStrings = useLocaleStringsTrampoline();\n const attachmentCardGroupStyles = useAttachmentCardGroupStyles();\n\n const getMenuActions = useCallback(\n (\n attachment: AttachmentMetadata,\n localeStrings: _AttachmentDownloadCardsStrings,\n message?: ChatMessage,\n action?: (attachment: AttachmentMetadata, message?: ChatMessage) => AttachmentMenuAction[]\n ): AttachmentMenuAction[] => {\n const defaultMenuActions = getDefaultMenuActions(localeStrings, message);\n try {\n const actions = action?.(attachment, message);\n if (actions && actions.length > 0) {\n return actions;\n } else {\n return defaultMenuActions;\n }\n } catch (error) {\n return defaultMenuActions;\n }\n },\n []\n );\n\n const attachmentCardGroupDescription = useMemo(\n () => () => {\n /* @conditional-compile-remove(attachment-download) */\n return getAttachmentCountLiveMessage(\n attachments ?? [],\n props.strings?.attachmentCardGroupMessage ?? localeStrings.attachmentCardGroupMessage\n );\n return '';\n },\n [props.strings?.attachmentCardGroupMessage, localeStrings.attachmentCardGroupMessage, attachments]\n );\n\n const hasMultipleAttachments = useMemo(() => {\n return (props.attachments?.length ?? 0) > 1;\n }, [props.attachments]);\n\n if (!attachments || attachments.length === 0 || !attachments) {\n return <></>;\n }\n\n return (\n <div\n className={mergeClasses(\n attachmentCardGroupStyles.root,\n hasMultipleAttachments\n ? attachmentCardGroupStyles.multipleAttachments\n : attachmentCardGroupStyles.singleAttachment\n )}\n data-ui-id=\"attachment-download-card-group\"\n >\n <_AttachmentCardGroup\n ariaLabel={attachmentCardGroupDescription()}\n attachmentGroupLayout={_AttachmentCardGroupLayout.Grid}\n >\n {attachments &&\n attachments.map((attachment) => (\n <_AttachmentCard\n attachment={attachment}\n key={attachment.id}\n menuActions={getMenuActions(attachment, localeStrings, message, props.actionsForAttachment)}\n onActionHandlerFailed={props.onActionHandlerFailed}\n selfResizing={hasMultipleAttachments}\n />\n ))}\n </_AttachmentCardGroup>\n </div>\n );\n};\n\n/**\n * @private\n */\nconst useLocaleStringsTrampoline = (): _AttachmentDownloadCardsStrings => {\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n return useLocale().strings.messageThread;\n return { downloadAttachment: '', openAttachment: '', attachmentCardGroupMessage: '' };\n};\n\n/**\n * @private\n */\nconst getDefaultMenuActions = (\n locale: _AttachmentDownloadCardsStrings,\n chatMessage?: ChatMessage\n): AttachmentMenuAction[] => {\n // if message is sent by a Teams user, we need to use a different icon (\"open\")\n if (chatMessage?.senderId?.includes('8:orgid:')) {\n return [\n {\n ...defaultAttachmentMenuAction,\n name: locale.openAttachment,\n icon: <Icon iconName=\"OpenAttachment\" />\n }\n ];\n }\n // otherwise, use the default icon (\"download\")\n return [\n {\n ...defaultAttachmentMenuAction,\n name: locale.downloadAttachment\n }\n ];\n};\n\n/**\n * @beta\n *\n * The default menu action for downloading attachments. This action will open the attachment's URL in a new tab.\n */\nexport const defaultAttachmentMenuAction: AttachmentMenuAction = {\n /**\n *\n * name is used for aria-label only when there's one button. For multiple buttons, it's used as a label.\n * by default it's an unlocalized string when this is used as a imported constant,\n * but you can overwrite it with your own localized string.\n *\n * i.e. defaultAttachmentMenuAction.name = localize('Download');\n *\n * when no action is provided, the UI library will overwrite this name\n * with a localized string this string when it's used in the UI.\n */\n name: 'Download',\n // this is the icon shown on the right of the attachment card\n icon: <Icon iconName=\"DownloadAttachment\" data-ui-id=\"attachment-download-card-download-icon\" />,\n // this is the action that runs when the icon is clicked\n onClick: (attachment: AttachmentMetadata) => {\n return new Promise<void>((resolve) => {\n window.open((attachment as AttachmentMetadata).url, '_blank', 'noopener,noreferrer');\n resolve();\n });\n }\n};\n"]}
|
@@ -3,7 +3,7 @@
|
|
3
3
|
import { Icon, mergeStyles } from '@fluentui/react';
|
4
4
|
import React, { useMemo } from 'react';
|
5
5
|
import { _AttachmentCard } from './AttachmentCard';
|
6
|
-
import { _AttachmentCardGroup } from './AttachmentCardGroup';
|
6
|
+
import { _AttachmentCardGroup, _AttachmentCardGroupLayout } from './AttachmentCardGroup';
|
7
7
|
import { useLocaleAttachmentCardStringsTrampoline } from '../utils/common';
|
8
8
|
const actionIconStyle = { height: '1rem' };
|
9
9
|
/**
|
@@ -20,7 +20,7 @@ export const _AttachmentUploadCards = (props) => {
|
|
20
20
|
if (!attachments || attachments.length === 0) {
|
21
21
|
return React.createElement(React.Fragment, null);
|
22
22
|
}
|
23
|
-
return (React.createElement(_AttachmentCardGroup,
|
23
|
+
return (React.createElement(_AttachmentCardGroup, { attachmentGroupLayout: _AttachmentCardGroupLayout.Flex }, attachments &&
|
24
24
|
attachments
|
25
25
|
.filter((attachment) => !attachment.error)
|
26
26
|
.map((attachment) => {
|