@azure/communication-react 1.5.1-alpha-202302250014 → 1.5.1-alpha-202303010017
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 +12 -0
- package/dist/dist-cjs/communication-react/index.js +521 -216
- package/dist/dist-cjs/communication-react/index.js.map +1 -1
- package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
- package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
- package/dist/dist-esm/communication-react/src/index.d.ts +1 -0
- package/dist/dist-esm/communication-react/src/index.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ResponsiveVerticalGallery.d.ts +29 -0
- package/dist/dist-esm/react-components/src/components/ResponsiveVerticalGallery.js +77 -0
- package/dist/dist-esm/react-components/src/components/ResponsiveVerticalGallery.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/VerticalGallery.d.ts +50 -0
- package/dist/dist-esm/react-components/src/components/VerticalGallery.js +85 -0
- package/dist/dist-esm/react-components/src/components/VerticalGallery.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/VideoGallery/DefaultLayout.js +19 -13
- package/dist/dist-esm/react-components/src/components/VideoGallery/DefaultLayout.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery/FloatingLocalVideo.d.ts +10 -3
- package/dist/dist-esm/react-components/src/components/VideoGallery/FloatingLocalVideo.js +6 -8
- package/dist/dist-esm/react-components/src/components/VideoGallery/FloatingLocalVideo.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery/FloatingLocalVideoLayout.js +32 -16
- package/dist/dist-esm/react-components/src/components/VideoGallery/FloatingLocalVideoLayout.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery/Layout.d.ts +6 -0
- package/dist/dist-esm/react-components/src/components/VideoGallery/Layout.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery/{VideoGalleryResponsiveHorizontalGallery.d.ts → OverflowGallery.d.ts} +5 -3
- package/dist/dist-esm/react-components/src/components/VideoGallery/OverflowGallery.js +46 -0
- package/dist/dist-esm/react-components/src/components/VideoGallery/OverflowGallery.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/VideoGallery/styles/FloatingLocalVideo.styles.d.ts +20 -3
- package/dist/dist-esm/react-components/src/components/VideoGallery/styles/FloatingLocalVideo.styles.js +11 -6
- package/dist/dist-esm/react-components/src/components/VideoGallery/styles/FloatingLocalVideo.styles.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery/styles/VideoGalleryResponsiveVerticalGallery.styles.d.ts +38 -0
- package/dist/dist-esm/react-components/src/components/VideoGallery/styles/VideoGalleryResponsiveVerticalGallery.styles.js +44 -0
- package/dist/dist-esm/react-components/src/components/VideoGallery/styles/VideoGalleryResponsiveVerticalGallery.styles.js.map +1 -0
- package/dist/dist-esm/react-components/src/components/VideoGallery.d.ts +11 -0
- package/dist/dist-esm/react-components/src/components/VideoGallery.js +7 -3
- package/dist/dist-esm/react-components/src/components/VideoGallery.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.map +1 -1
- package/dist/dist-esm/react-components/src/components/styles/VerticalGallery.styles.d.ts +32 -0
- package/dist/dist-esm/react-components/src/components/styles/VerticalGallery.styles.js +63 -0
- package/dist/dist-esm/react-components/src/components/styles/VerticalGallery.styles.js.map +1 -0
- package/package.json +8 -8
- package/dist/dist-esm/react-components/src/components/VideoGallery/VideoGalleryResponsiveHorizontalGallery.js +0 -19
- package/dist/dist-esm/react-components/src/components/VideoGallery/VideoGalleryResponsiveHorizontalGallery.js.map +0 -1
@@ -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,0BAA0B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n// GENERATED FILE. DO NOT EDIT MANUALLY.\n\nmodule.exports = '1.5.1-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,0BAA0B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n// GENERATED FILE. DO NOT EDIT MANUALLY.\n\nmodule.exports = '1.5.1-alpha-202303010017';\n"]}
|
@@ -38,6 +38,7 @@ export type { HoldButtonProps, HoldButtonStrings, VideoTileStrings } from '../..
|
|
38
38
|
export type { BrowserPermissionDeniedStrings, BrowserPermissionDeniedProps } from '../../react-components/src';
|
39
39
|
export type { BrowserPermissionDeniedIOSStrings, BrowserPermissionDeniedStyles, BrowserPermissionDeniedIOSProps } from '../../react-components/src';
|
40
40
|
export type { VideoTileContextualMenuProps, VideoTileDrawerMenuProps } from '../../react-components/src';
|
41
|
+
export type { OverflowGalleryLayout } from '../../react-components/src';
|
41
42
|
export * from '../../react-components/src/localization/locales';
|
42
43
|
export * from '../../react-components/src/theming';
|
43
44
|
export * from '../../calling-stateful-client/src/index-public';
|
@@ -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;AA4BzG,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;AAmB9C,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,EACV,MAAM,4BAA4B,CAAC;AACpC,6CAA6C;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAExD,0CAA0C,CAAC,6CAA6C;AACxF,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAErD,iDAAiD;AACjD,OAAO,EACL,kCAAkC,EAClC,yBAAyB,EACzB,qBAAqB,EACtB,MAAM,4BAA4B,CAAC;AAwIpC,cAAc,iDAAiD,CAAC;AAChE,cAAc,oCAAoC,CAAC;AACnD,cAAc,gDAAgD,CAAC;AAG/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAa1E,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';\nexport type {\n ChatClientProviderProps,\n ChatThreadClientProviderProps,\n GetChatSelector,\n ChatHandlers,\n ChatBaseSelectorProps\n} from '../../chat-component-bindings/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} from '../../calling-component-bindings/src';\n/* @conditional-compile-remove(PSTN-calls) */\nexport type { HoldButtonSelector } 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} from '../../react-components/src';\n/* @conditional-compile-remove(PSTN-calls) */\nexport { HoldButton } from '../../react-components/src';\n\n/* @conditional-compile-remove(dialpad) */ /* @conditional-compile-remove(PSTN-calls) */\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\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 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 VideoGalleryLayout,\n VideoGalleryLocalParticipant,\n VideoGalleryParticipant,\n VideoGalleryProps,\n VideoGalleryRemoteParticipant,\n VideoGalleryStream,\n VideoGalleryStrings,\n VideoGalleryStyles,\n VideoStreamOptions,\n VideoTileProps,\n VideoTileStylesProps,\n ViewScalingMode\n} from '../../react-components/src';\n/* @conditional-compile-remove(rooms) */\nexport type { Role } from '../../react-components/src';\n/* @conditional-compile-remove(dialpad) */ /* @conditional-compile-remove(PSTN-calls) */\nexport type { DialpadProps, DialpadStrings, DialpadStyles, DtmfTone } from '../../react-components/src';\n/* @conditional-compile-remove(file-sharing) */\nexport type {\n ActiveFileUpload,\n SendBoxErrorBarError,\n FileDownloadHandler,\n FileDownloadError,\n FileMetadata\n} 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';\n/* @conditional-compile-remove(pinned-participants) */\nexport type { VideoTileContextualMenuProps, VideoTileDrawerMenuProps } 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';\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';\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;AA4BzG,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;AAmB9C,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,EACV,MAAM,4BAA4B,CAAC;AACpC,6CAA6C;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAExD,0CAA0C,CAAC,6CAA6C;AACxF,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAErD,iDAAiD;AACjD,OAAO,EACL,kCAAkC,EAClC,yBAAyB,EACzB,qBAAqB,EACtB,MAAM,4BAA4B,CAAC;AA0IpC,cAAc,iDAAiD,CAAC;AAChE,cAAc,oCAAoC,CAAC;AACnD,cAAc,gDAAgD,CAAC;AAG/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAa1E,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';\nexport type {\n ChatClientProviderProps,\n ChatThreadClientProviderProps,\n GetChatSelector,\n ChatHandlers,\n ChatBaseSelectorProps\n} from '../../chat-component-bindings/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} from '../../calling-component-bindings/src';\n/* @conditional-compile-remove(PSTN-calls) */\nexport type { HoldButtonSelector } 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} from '../../react-components/src';\n/* @conditional-compile-remove(PSTN-calls) */\nexport { HoldButton } from '../../react-components/src';\n\n/* @conditional-compile-remove(dialpad) */ /* @conditional-compile-remove(PSTN-calls) */\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\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 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 VideoGalleryLayout,\n VideoGalleryLocalParticipant,\n VideoGalleryParticipant,\n VideoGalleryProps,\n VideoGalleryRemoteParticipant,\n VideoGalleryStream,\n VideoGalleryStrings,\n VideoGalleryStyles,\n VideoStreamOptions,\n VideoTileProps,\n VideoTileStylesProps,\n ViewScalingMode\n} from '../../react-components/src';\n/* @conditional-compile-remove(rooms) */\nexport type { Role } from '../../react-components/src';\n/* @conditional-compile-remove(dialpad) */ /* @conditional-compile-remove(PSTN-calls) */\nexport type { DialpadProps, DialpadStrings, DialpadStyles, DtmfTone } from '../../react-components/src';\n/* @conditional-compile-remove(file-sharing) */\nexport type {\n ActiveFileUpload,\n SendBoxErrorBarError,\n FileDownloadHandler,\n FileDownloadError,\n FileMetadata\n} 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';\n/* @conditional-compile-remove(pinned-participants) */\nexport type { VideoTileContextualMenuProps, VideoTileDrawerMenuProps } from '../../react-components/src';\n/* @conditional-compile-remove(vertical-gallery) */\nexport type { OverflowGalleryLayout } 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';\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';\n"]}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import { IStyle } from '@fluentui/react';
|
2
|
+
import React from 'react';
|
3
|
+
import { VerticalGalleryStyles } from './VerticalGallery';
|
4
|
+
/**
|
5
|
+
* Props for the Responsive wrapper of the VerticalGallery component
|
6
|
+
*
|
7
|
+
* @beta
|
8
|
+
*/
|
9
|
+
export interface ResponsiveVerticalGalleryProps {
|
10
|
+
/** Video tiles to be rendered in the Vertical Gallery */
|
11
|
+
children: React.ReactNode;
|
12
|
+
/** Styles for the Children space container */
|
13
|
+
containerStyles: IStyle;
|
14
|
+
/** Styles for the VerticalGallery component */
|
15
|
+
verticalGalleryStyles: VerticalGalleryStyles;
|
16
|
+
/** Height of the gap in between the video tiles */
|
17
|
+
gapHeightRem: number;
|
18
|
+
/** Height of the control bar for navigating pages */
|
19
|
+
controlBarHeightRem?: number;
|
20
|
+
}
|
21
|
+
/**
|
22
|
+
* Responsive container for the VerticalGallery Component. Performs calculations for number of children
|
23
|
+
* for the VerticalGallery
|
24
|
+
* @param props
|
25
|
+
*
|
26
|
+
* @beta
|
27
|
+
*/
|
28
|
+
export declare const ResponsiveVerticalGallery: (props: ResponsiveVerticalGalleryProps) => JSX.Element;
|
29
|
+
//# sourceMappingURL=ResponsiveVerticalGallery.d.ts.map
|
@@ -0,0 +1,77 @@
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
2
|
+
// Licensed under the MIT license.
|
3
|
+
import { mergeStyles } from '@fluentui/react';
|
4
|
+
import { _convertRemToPx } from "../../../acs-ui-common/src";
|
5
|
+
import React, { useRef } from 'react';
|
6
|
+
import { _useContainerHeight } from './utils/responsive';
|
7
|
+
import { VerticalGallery } from './VerticalGallery';
|
8
|
+
import { VERTICAL_GALLERY_TILE_SIZE_REM } from './VideoGallery/styles/VideoGalleryResponsiveVerticalGallery.styles';
|
9
|
+
/**
|
10
|
+
* Responsive container for the VerticalGallery Component. Performs calculations for number of children
|
11
|
+
* for the VerticalGallery
|
12
|
+
* @param props
|
13
|
+
*
|
14
|
+
* @beta
|
15
|
+
*/
|
16
|
+
export const ResponsiveVerticalGallery = (props) => {
|
17
|
+
const { children, containerStyles, verticalGalleryStyles, gapHeightRem, controlBarHeightRem } = props;
|
18
|
+
const containerRef = useRef(null);
|
19
|
+
const containerHeight = _useContainerHeight(containerRef);
|
20
|
+
const topPadding = containerRef.current ? parseFloat(getComputedStyle(containerRef.current).paddingTop) : 0;
|
21
|
+
const bottomPadding = containerRef.current ? parseFloat(getComputedStyle(containerRef.current).paddingBottom) : 0;
|
22
|
+
const childrenPerPage = calculateChildrenPerPage({
|
23
|
+
numberOfChildren: React.Children.count(children),
|
24
|
+
containerHeight: (containerHeight !== null && containerHeight !== void 0 ? containerHeight : 0) - topPadding - bottomPadding,
|
25
|
+
gapHeightRem,
|
26
|
+
controlBarHeight: controlBarHeightRem !== null && controlBarHeightRem !== void 0 ? controlBarHeightRem : 2
|
27
|
+
});
|
28
|
+
return (React.createElement("div", { ref: containerRef, className: mergeStyles(containerStyles) },
|
29
|
+
React.createElement(VerticalGallery, { childrenPerPage: childrenPerPage, styles: verticalGalleryStyles }, children)));
|
30
|
+
};
|
31
|
+
/**
|
32
|
+
* Helper function to find the number of children for the VerticalGallery on each page.
|
33
|
+
*/
|
34
|
+
const calculateChildrenPerPage = (args) => {
|
35
|
+
const { numberOfChildren, containerHeight, gapHeightRem, controlBarHeight } = args;
|
36
|
+
const childMinHeightPx = _convertRemToPx(VERTICAL_GALLERY_TILE_SIZE_REM.minHeight);
|
37
|
+
const gapHeightPx = _convertRemToPx(gapHeightRem);
|
38
|
+
const controlBarHeightPx = _convertRemToPx(controlBarHeight);
|
39
|
+
/** First check how many children can fit in containerHeight.
|
40
|
+
*
|
41
|
+
* _________________
|
42
|
+
* | |
|
43
|
+
* | |
|
44
|
+
* |________________|
|
45
|
+
* _________________
|
46
|
+
* | |
|
47
|
+
* | |
|
48
|
+
* |________________|
|
49
|
+
*
|
50
|
+
* < n/m >
|
51
|
+
*
|
52
|
+
* number of children = container height - (2* gap height + button height) / childMinHeight
|
53
|
+
*
|
54
|
+
* we want to find the maximum number of children at the smallest size we can fit in the gallery and then resize them
|
55
|
+
* to fill in the space as much as possible
|
56
|
+
*
|
57
|
+
* First we will find the max number of children without any controls we can fit.
|
58
|
+
*/
|
59
|
+
const maxNumberOfChildrenInContainer = Math.floor((containerHeight + gapHeightPx) / (childMinHeightPx + gapHeightPx));
|
60
|
+
// if all of the children fit in the container just return the number of children
|
61
|
+
if (numberOfChildren <= maxNumberOfChildrenInContainer) {
|
62
|
+
return maxNumberOfChildrenInContainer;
|
63
|
+
}
|
64
|
+
/**
|
65
|
+
* For the pagination we know the container height, the height of the button bar and the 2 times the gap
|
66
|
+
* height, top tile and bottom tile above control bar. So the child space is calculated as:
|
67
|
+
*
|
68
|
+
* space = height - controlbar - (2 * gap)
|
69
|
+
*/
|
70
|
+
const childSpace = containerHeight - controlBarHeightPx - 2 * gapHeightPx;
|
71
|
+
/**
|
72
|
+
* Now that we have the childrenSpace height we can figure out how many Children can fir in the childrenSpace.
|
73
|
+
* childrenSpace = n * childHeightMin + (n - 1) * gapHeight. isolate n and take the floor.
|
74
|
+
*/
|
75
|
+
return Math.floor((childSpace + gapHeightPx) / (childMinHeightPx + gapHeightPx));
|
76
|
+
};
|
77
|
+
//# sourceMappingURL=ResponsiveVerticalGallery.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ResponsiveVerticalGallery.js","sourceRoot":"","sources":["../../../../../../react-components/src/components/ResponsiveVerticalGallery.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OA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H,OAAO,CACL,6BAAK,GAAG,EAAE,YAAY,EAAE,SAAS,EAAE,WAAW,CAAC,eAAe,CAAC;QAC7D,oBAAC,eAAe,IAAC,eAAe,EAAE,eAAe,EAAE,MAAM,EAAE,qBAAqB,IAC7E,QAAQ,CACO,CACd,CACP,CAAC;AACJ,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,wBAAwB,GAAG,CAAC,IAKjC,EAAU,EAAE;IACX,MAAM,EAAE,gBAAgB,EAAE,eAAe,EAAE,YAAY,EAAE,gBAAgB,EAAE,GAAG,IAAI,CAAC;IAEnF,MAAM,gBAAgB,GAAG,eAAe,CAAC,8BAA8B,CAAC,SAAS,CAAC,CAAC;IACnF,MAAM,WAAW,GAAG,eAAe,CAAC,YAAY,CAAC,CAAC;IAClD,MAAM,kBAAkB,GAAG,eAAe,CAAC,gBAAgB,CAAC,CAAC;IAE7D;;;;;;;;;;;;;;;;;;;OAmBG;IAEH,MAAM,8BAA8B,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,eAAe,GAAG,WAAW,CAAC,GAAG,CAAC,gBAAgB,GAAG,WAAW,CAAC,CAAC,CAAC;IACtH,iFAAiF;IACjF,IAAI,gBAAgB,IAAI,8BAA8B,EAAE;QACtD,OAAO,8BAA8B,CAAC;KACvC;IAED;;;;;OAKG;IACH,MAAM,UAAU,GAAG,eAAe,GAAG,kBAAkB,GAAG,CAAC,GAAG,WAAW,CAAC;IAE1E;;;OAGG;IACH,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,UAAU,GAAG,WAAW,CAAC,GAAG,CAAC,gBAAgB,GAAG,WAAW,CAAC,CAAC,CAAC;AACnF,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { IStyle, mergeStyles } from '@fluentui/react';\nimport { _convertRemToPx } from '@internal/acs-ui-common';\nimport React, { useRef } from 'react';\nimport { _useContainerHeight } from './utils/responsive';\nimport { VerticalGallery, VerticalGalleryStyles } from './VerticalGallery';\nimport { VERTICAL_GALLERY_TILE_SIZE_REM } from './VideoGallery/styles/VideoGalleryResponsiveVerticalGallery.styles';\n\n/**\n * Props for the Responsive wrapper of the VerticalGallery component\n *\n * @beta\n */\nexport interface ResponsiveVerticalGalleryProps {\n /** Video tiles to be rendered in the Vertical Gallery */\n children: React.ReactNode;\n /** Styles for the Children space container */\n containerStyles: IStyle;\n /** Styles for the VerticalGallery component */\n verticalGalleryStyles: VerticalGalleryStyles;\n /** Height of the gap in between the video tiles */\n gapHeightRem: number;\n /** Height of the control bar for navigating pages */\n controlBarHeightRem?: number;\n}\n\n/**\n * Responsive container for the VerticalGallery Component. Performs calculations for number of children\n * for the VerticalGallery\n * @param props\n *\n * @beta\n */\nexport const ResponsiveVerticalGallery = (props: ResponsiveVerticalGalleryProps): JSX.Element => {\n const { children, containerStyles, verticalGalleryStyles, gapHeightRem, controlBarHeightRem } = props;\n const containerRef = useRef<HTMLDivElement>(null);\n const containerHeight = _useContainerHeight(containerRef);\n\n const topPadding = containerRef.current ? parseFloat(getComputedStyle(containerRef.current).paddingTop) : 0;\n const bottomPadding = containerRef.current ? parseFloat(getComputedStyle(containerRef.current).paddingBottom) : 0;\n\n const childrenPerPage = calculateChildrenPerPage({\n numberOfChildren: React.Children.count(children),\n containerHeight: (containerHeight ?? 0) - topPadding - bottomPadding,\n gapHeightRem,\n controlBarHeight: controlBarHeightRem ?? 2\n });\n return (\n <div ref={containerRef} className={mergeStyles(containerStyles)}>\n <VerticalGallery childrenPerPage={childrenPerPage} styles={verticalGalleryStyles}>\n {children}\n </VerticalGallery>\n </div>\n );\n};\n\n/**\n * Helper function to find the number of children for the VerticalGallery on each page.\n */\nconst calculateChildrenPerPage = (args: {\n numberOfChildren: number;\n containerHeight: number;\n gapHeightRem: number;\n controlBarHeight: number;\n}): number => {\n const { numberOfChildren, containerHeight, gapHeightRem, controlBarHeight } = args;\n\n const childMinHeightPx = _convertRemToPx(VERTICAL_GALLERY_TILE_SIZE_REM.minHeight);\n const gapHeightPx = _convertRemToPx(gapHeightRem);\n const controlBarHeightPx = _convertRemToPx(controlBarHeight);\n\n /** First check how many children can fit in containerHeight.\n *\n * _________________\n * | |\n * | |\n * |________________|\n * _________________\n * | |\n * | |\n * |________________|\n *\n * < n/m >\n *\n * number of children = container height - (2* gap height + button height) / childMinHeight\n *\n * we want to find the maximum number of children at the smallest size we can fit in the gallery and then resize them\n * to fill in the space as much as possible\n *\n * First we will find the max number of children without any controls we can fit.\n */\n\n const maxNumberOfChildrenInContainer = Math.floor((containerHeight + gapHeightPx) / (childMinHeightPx + gapHeightPx));\n // if all of the children fit in the container just return the number of children\n if (numberOfChildren <= maxNumberOfChildrenInContainer) {\n return maxNumberOfChildrenInContainer;\n }\n\n /**\n * For the pagination we know the container height, the height of the button bar and the 2 times the gap\n * height, top tile and bottom tile above control bar. So the child space is calculated as:\n *\n * space = height - controlbar - (2 * gap)\n */\n const childSpace = containerHeight - controlBarHeightPx - 2 * gapHeightPx;\n\n /**\n * Now that we have the childrenSpace height we can figure out how many Children can fir in the childrenSpace.\n * childrenSpace = n * childHeightMin + (n - 1) * gapHeight. isolate n and take the floor.\n */\n return Math.floor((childSpace + gapHeightPx) / (childMinHeightPx + gapHeightPx));\n};\n\"../../../acs-ui-common/src\""]}
|
@@ -0,0 +1,50 @@
|
|
1
|
+
import { IStyle } from '@fluentui/react';
|
2
|
+
import React from 'react';
|
3
|
+
import { BaseCustomStyles } from '../types';
|
4
|
+
/**
|
5
|
+
* Styles for the VerticalGallery component
|
6
|
+
*/
|
7
|
+
export interface VerticalGalleryStyles extends BaseCustomStyles {
|
8
|
+
/** Styles for each video tile in the vertical gallery */
|
9
|
+
children?: IStyle;
|
10
|
+
/** Styles for the verticalGallery control bar */
|
11
|
+
controlBar?: VerticalGalleryControlBarStyles;
|
12
|
+
}
|
13
|
+
/**
|
14
|
+
* Styles for the control bar inside the VerticalGallery component
|
15
|
+
*/
|
16
|
+
export interface VerticalGalleryControlBarStyles extends BaseCustomStyles {
|
17
|
+
/**
|
18
|
+
* styles for the next button in the VerticalGalleryControlBar
|
19
|
+
*/
|
20
|
+
nextButton?: IStyle;
|
21
|
+
/**
|
22
|
+
* Styles for the previous button in the VerticalGalleryControlBar
|
23
|
+
*/
|
24
|
+
previousButton?: IStyle;
|
25
|
+
/**
|
26
|
+
* Styles for the counter in the VerticalGalleryControlBar
|
27
|
+
*/
|
28
|
+
counter?: IStyle;
|
29
|
+
}
|
30
|
+
/**
|
31
|
+
* Props for the VerticalGallery component
|
32
|
+
*
|
33
|
+
* @beta
|
34
|
+
*/
|
35
|
+
export interface VerticalGalleryProps {
|
36
|
+
/** Video tiles for the remote participants in the vertical gallery */
|
37
|
+
children: React.ReactNode;
|
38
|
+
/** Max number of children per page in the vertical Gallery */
|
39
|
+
childrenPerPage: number;
|
40
|
+
/** Styles to customize the vertical gallery */
|
41
|
+
styles?: VerticalGalleryStyles;
|
42
|
+
}
|
43
|
+
/**
|
44
|
+
* VerticalGallery is a overflow gallery for participants in the {@link VideoGallery} component. Stacks
|
45
|
+
* participants on the Y-axis of the VideoGallery for better use of horizontal space.
|
46
|
+
*
|
47
|
+
* @beta
|
48
|
+
*/
|
49
|
+
export declare const VerticalGallery: (props: VerticalGalleryProps) => JSX.Element;
|
50
|
+
//# sourceMappingURL=VerticalGallery.d.ts.map
|
@@ -0,0 +1,85 @@
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
2
|
+
// Licensed under the MIT license.
|
3
|
+
import { DefaultButton, Icon, mergeStyles, Stack, Text } from '@fluentui/react';
|
4
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
5
|
+
import { useTheme } from '../theming';
|
6
|
+
import { childrenContainerStyle, pageNavigationControlBarContainerStyle, participantPageCounter, leftRightButtonStyles, navIconStyles, rootStyle } from './styles/VerticalGallery.styles';
|
7
|
+
import { bucketize } from './utils/overFlowGalleriesUtils';
|
8
|
+
/**
|
9
|
+
* VerticalGallery is a overflow gallery for participants in the {@link VideoGallery} component. Stacks
|
10
|
+
* participants on the Y-axis of the VideoGallery for better use of horizontal space.
|
11
|
+
*
|
12
|
+
* @beta
|
13
|
+
*/
|
14
|
+
export const VerticalGallery = (props) => {
|
15
|
+
const { children, styles, childrenPerPage } = props;
|
16
|
+
const [page, setPage] = useState(0);
|
17
|
+
const [buttonState, setButtonState] = useState({ previous: true, next: true });
|
18
|
+
const numberOfChildren = React.Children.count(children);
|
19
|
+
const lastPage = Math.ceil(numberOfChildren / childrenPerPage) - 1;
|
20
|
+
const paginatedChildren = useMemo(() => {
|
21
|
+
return bucketize(React.Children.toArray(children), childrenPerPage);
|
22
|
+
}, [children, childrenPerPage]);
|
23
|
+
const firstIndexOfCurrentPage = page * childrenPerPage;
|
24
|
+
const clippedPage = firstIndexOfCurrentPage < numberOfChildren - 1 ? page : lastPage;
|
25
|
+
const childrenOnCurrentPage = paginatedChildren[clippedPage];
|
26
|
+
const showButtons = numberOfChildren > childrenPerPage;
|
27
|
+
const onPreviousButtonClick = () => {
|
28
|
+
setPage(page - 1);
|
29
|
+
};
|
30
|
+
const onNextButtonClick = () => {
|
31
|
+
setPage(page + 1);
|
32
|
+
};
|
33
|
+
useEffect(() => {
|
34
|
+
if (page > 0 && page < lastPage && showButtons) {
|
35
|
+
// we are somewhere in between first and last pages.
|
36
|
+
setButtonState({ previous: false, next: false });
|
37
|
+
}
|
38
|
+
else if (page === 0 && showButtons) {
|
39
|
+
// we are on the first page.
|
40
|
+
setButtonState({ previous: true, next: false });
|
41
|
+
}
|
42
|
+
else if (page === lastPage && showButtons) {
|
43
|
+
// we are on the last page.
|
44
|
+
setButtonState({ previous: false, next: true });
|
45
|
+
}
|
46
|
+
}, [page, numberOfChildren, lastPage, showButtons]);
|
47
|
+
const childContainerStyle = useMemo(() => {
|
48
|
+
return { root: childrenContainerStyle };
|
49
|
+
}, []);
|
50
|
+
const childrenStyles = useMemo(() => {
|
51
|
+
return { root: styles === null || styles === void 0 ? void 0 : styles.children };
|
52
|
+
}, [styles === null || styles === void 0 ? void 0 : styles.children]);
|
53
|
+
if (childrenPerPage <= 0) {
|
54
|
+
return React.createElement(React.Fragment, null);
|
55
|
+
}
|
56
|
+
return (React.createElement(Stack, { className: mergeStyles(rootStyle, styles === null || styles === void 0 ? void 0 : styles.root) },
|
57
|
+
React.createElement(Stack, { styles: childContainerStyle }, childrenOnCurrentPage.map((child, i) => {
|
58
|
+
return (React.createElement(Stack.Item, { key: i, styles: childrenStyles }, child));
|
59
|
+
})),
|
60
|
+
showButtons && (React.createElement(VerticalGalleryControlBar, { buttonsDisabled: buttonState, onPreviousButtonClick: onPreviousButtonClick, onNextButtonClick: onNextButtonClick, totalPages: lastPage, currentPage: page }))));
|
61
|
+
};
|
62
|
+
const VerticalGalleryControlBar = (props) => {
|
63
|
+
const { onNextButtonClick, onPreviousButtonClick, buttonsDisabled, currentPage, totalPages, styles } = props;
|
64
|
+
const theme = useTheme();
|
65
|
+
const pageCounterContainerStyles = useMemo(() => {
|
66
|
+
return mergeStyles(pageNavigationControlBarContainerStyle, styles === null || styles === void 0 ? void 0 : styles.root);
|
67
|
+
}, [styles === null || styles === void 0 ? void 0 : styles.root]);
|
68
|
+
const previousButtonSyles = useMemo(() => {
|
69
|
+
return mergeStyles(leftRightButtonStyles(theme), styles === null || styles === void 0 ? void 0 : styles.previousButton);
|
70
|
+
}, [styles === null || styles === void 0 ? void 0 : styles.previousButton, theme]);
|
71
|
+
const pageCounterStyles = useMemo(() => {
|
72
|
+
return mergeStyles(participantPageCounter, styles === null || styles === void 0 ? void 0 : styles.counter);
|
73
|
+
}, [styles === null || styles === void 0 ? void 0 : styles.counter]);
|
74
|
+
const nextButtonsStyles = useMemo(() => {
|
75
|
+
return mergeStyles(leftRightButtonStyles(theme), styles === null || styles === void 0 ? void 0 : styles.nextButton);
|
76
|
+
}, [styles === null || styles === void 0 ? void 0 : styles.nextButton, theme]);
|
77
|
+
const controlBarSpacing = { childrenGap: '0.5rem' };
|
78
|
+
return (React.createElement(Stack, { horizontalAlign: "center", tokens: controlBarSpacing, horizontal: true, className: pageCounterContainerStyles },
|
79
|
+
React.createElement(DefaultButton, { className: previousButtonSyles, onClick: onPreviousButtonClick, disabled: buttonsDisabled === null || buttonsDisabled === void 0 ? void 0 : buttonsDisabled.previous },
|
80
|
+
React.createElement(Icon, { iconName: "VerticalGalleryLeftButton", styles: navIconStyles })),
|
81
|
+
React.createElement(Text, { className: pageCounterStyles }, `${currentPage} / ${totalPages}`),
|
82
|
+
React.createElement(DefaultButton, { className: nextButtonsStyles, onClick: onNextButtonClick, disabled: buttonsDisabled === null || buttonsDisabled === void 0 ? void 0 : buttonsDisabled.next },
|
83
|
+
React.createElement(Icon, { iconName: "VerticalGalleryRightButton", styles: navIconStyles }))));
|
84
|
+
};
|
85
|
+
//# sourceMappingURL=VerticalGallery.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"VerticalGallery.js","sourceRoot":"","sources":["../../../../../../react-components/src/components/VerticalGallery.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,aAAa,EAAE,IAAI,EAAU,WAAW,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACxF,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EACL,sBAAsB,EACtB,sCAAsC,EACtC,sBAAsB,EACtB,qBAAqB,EACrB,aAAa,EACb,SAAS,EACV,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAoD3D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAA2B,EAAe,EAAE;IAC1E,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,eAAe,EAAE,GAAG,KAAK,CAAC;IAEpD,MAAM,CAAC,IAAI,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W,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,UAAU,CAAC,CAAC;IACvE,CAAC,EAAE,CAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC;IAEhC,MAAM,iBAAiB,GAAG,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC;IAEpD,OAAO,CACL,oBAAC,KAAK,IAAC,eAAe,EAAC,QAAQ,EAAC,MAAM,EAAE,iBAAiB,EAAE,UAAU,QAAC,SAAS,EAAE,0BAA0B;QACzG,oBAAC,aAAa,IACZ,SAAS,EAAE,mBAAmB,EAC9B,OAAO,EAAE,qBAAqB,EAC9B,QAAQ,EAAE,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,QAAQ;YAEnC,oBAAC,IAAI,IAAC,QAAQ,EAAC,2BAA2B,EAAC,MAAM,EAAE,aAAa,GAAI,CACtD;QAChB,oBAAC,IAAI,IAAC,SAAS,EAAE,iBAAiB,IAAG,GAAG,WAAW,MAAM,UAAU,EAAE,CAAQ;QAC7E,oBAAC,aAAa,IAAC,SAAS,EAAE,iBAAiB,EAAE,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,IAAI;YACtG,oBAAC,IAAI,IAAC,QAAQ,EAAC,4BAA4B,EAAC,MAAM,EAAE,aAAa,GAAI,CACvD,CACV,CACT,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { DefaultButton, Icon, IStyle, mergeStyles, Stack, Text } from '@fluentui/react';\nimport React, { useEffect, useMemo, useState } from 'react';\nimport { useTheme } from '../theming';\nimport { BaseCustomStyles } from '../types';\nimport {\n childrenContainerStyle,\n pageNavigationControlBarContainerStyle,\n participantPageCounter,\n leftRightButtonStyles,\n navIconStyles,\n rootStyle\n} from './styles/VerticalGallery.styles';\nimport { bucketize } from './utils/overFlowGalleriesUtils';\n\n/**\n * Styles for the VerticalGallery component\n */\nexport interface VerticalGalleryStyles extends BaseCustomStyles {\n /** Styles for each video tile in the vertical gallery */\n children?: IStyle;\n /** Styles for the verticalGallery control bar */\n controlBar?: VerticalGalleryControlBarStyles;\n}\n\n/**\n * Styles for the control bar inside the VerticalGallery component\n */\nexport interface VerticalGalleryControlBarStyles extends BaseCustomStyles {\n /**\n * styles for the next button in the VerticalGalleryControlBar\n */\n nextButton?: IStyle;\n /**\n * Styles for the previous button in the VerticalGalleryControlBar\n */\n previousButton?: IStyle;\n /**\n * Styles for the counter in the VerticalGalleryControlBar\n */\n counter?: IStyle;\n}\n/**\n * Props for the VerticalGallery component\n *\n * @beta\n */\nexport interface VerticalGalleryProps {\n /** Video tiles for the remote participants in the vertical gallery */\n children: React.ReactNode;\n /** Max number of children per page in the vertical Gallery */\n childrenPerPage: number;\n /** Styles to customize the vertical gallery */\n styles?: VerticalGalleryStyles;\n}\n\ninterface VerticalGalleryControlBarProps {\n onNextButtonClick: () => void;\n onPreviousButtonClick: () => void;\n buttonsDisabled: { next: boolean; previous: boolean };\n totalPages: number;\n currentPage: number;\n styles?: VerticalGalleryControlBarStyles;\n}\n\n/**\n * VerticalGallery is a overflow gallery for participants in the {@link VideoGallery} component. Stacks\n * participants on the Y-axis of the VideoGallery for better use of horizontal space.\n *\n * @beta\n */\nexport const VerticalGallery = (props: VerticalGalleryProps): JSX.Element => {\n const { children, styles, childrenPerPage } = props;\n\n const [page, setPage] = useState(0);\n const [buttonState, setButtonState] = useState<{ previous: boolean; next: boolean }>({ previous: true, next: true });\n\n const numberOfChildren = React.Children.count(children);\n const lastPage = Math.ceil(numberOfChildren / childrenPerPage) - 1;\n\n const paginatedChildren: React.ReactNode[][] = useMemo(() => {\n return bucketize(React.Children.toArray(children), childrenPerPage);\n }, [children, childrenPerPage]);\n\n const firstIndexOfCurrentPage = page * childrenPerPage;\n const clippedPage = firstIndexOfCurrentPage < numberOfChildren - 1 ? page : lastPage;\n const childrenOnCurrentPage = paginatedChildren[clippedPage];\n\n const showButtons = numberOfChildren > childrenPerPage;\n\n const onPreviousButtonClick = (): void => {\n setPage(page - 1);\n };\n const onNextButtonClick = (): void => {\n setPage(page + 1);\n };\n\n useEffect(() => {\n if (page > 0 && page < lastPage && showButtons) {\n // we are somewhere in between first and last pages.\n setButtonState({ previous: false, next: false });\n } else if (page === 0 && showButtons) {\n // we are on the first page.\n setButtonState({ previous: true, next: false });\n } else if (page === lastPage && showButtons) {\n // we are on the last page.\n setButtonState({ previous: false, next: true });\n }\n }, [page, numberOfChildren, lastPage, showButtons]);\n\n const childContainerStyle = useMemo(() => {\n return { root: childrenContainerStyle };\n }, []);\n\n const childrenStyles = useMemo(() => {\n return { root: styles?.children };\n }, [styles?.children]);\n\n if (childrenPerPage <= 0) {\n return <></>;\n }\n\n return (\n <Stack className={mergeStyles(rootStyle, styles?.root)}>\n <Stack styles={childContainerStyle}>\n {childrenOnCurrentPage.map((child, i) => {\n return (\n <Stack.Item key={i} styles={childrenStyles}>\n {child}\n </Stack.Item>\n );\n })}\n </Stack>\n {showButtons && (\n <VerticalGalleryControlBar\n buttonsDisabled={buttonState}\n onPreviousButtonClick={onPreviousButtonClick}\n onNextButtonClick={onNextButtonClick}\n totalPages={lastPage}\n currentPage={page}\n />\n )}\n </Stack>\n );\n};\n\nconst VerticalGalleryControlBar = (props: VerticalGalleryControlBarProps): JSX.Element => {\n const { onNextButtonClick, onPreviousButtonClick, buttonsDisabled, currentPage, totalPages, styles } = props;\n const theme = useTheme();\n\n const pageCounterContainerStyles = useMemo(() => {\n return mergeStyles(pageNavigationControlBarContainerStyle, styles?.root);\n }, [styles?.root]);\n\n const previousButtonSyles = useMemo(() => {\n return mergeStyles(leftRightButtonStyles(theme), styles?.previousButton);\n }, [styles?.previousButton, theme]);\n\n const pageCounterStyles = useMemo(() => {\n return mergeStyles(participantPageCounter, styles?.counter);\n }, [styles?.counter]);\n\n const nextButtonsStyles = useMemo(() => {\n return mergeStyles(leftRightButtonStyles(theme), styles?.nextButton);\n }, [styles?.nextButton, theme]);\n\n const controlBarSpacing = { childrenGap: '0.5rem' };\n\n return (\n <Stack horizontalAlign=\"center\" tokens={controlBarSpacing} horizontal className={pageCounterContainerStyles}>\n <DefaultButton\n className={previousButtonSyles}\n onClick={onPreviousButtonClick}\n disabled={buttonsDisabled?.previous}\n >\n <Icon iconName=\"VerticalGalleryLeftButton\" styles={navIconStyles} />\n </DefaultButton>\n <Text className={pageCounterStyles}>{`${currentPage} / ${totalPages}`}</Text>\n <DefaultButton className={nextButtonsStyles} onClick={onNextButtonClick} disabled={buttonsDisabled?.next}>\n <Icon iconName=\"VerticalGalleryRightButton\" styles={navIconStyles} />\n </DefaultButton>\n </Stack>\n );\n};\n"]}
|
@@ -4,12 +4,10 @@ import { Stack } from '@fluentui/react';
|
|
4
4
|
import React, { useMemo } from 'react';
|
5
5
|
import { GridLayout } from '../GridLayout';
|
6
6
|
import { isNarrowWidth } from '../utils/responsive';
|
7
|
-
/* @conditional-compile-remove(pinned-participants) */
|
8
|
-
import { ScrollableHorizontalGallery } from './ScrollableHorizontalGallery';
|
9
7
|
import { rootLayoutStyle } from './styles/DefaultLayout.styles';
|
10
8
|
import { videoGalleryLayoutGap } from './styles/Layout.styles';
|
11
9
|
import { useOrganizedParticipants } from './utils/videoGalleryLayoutUtils';
|
12
|
-
import {
|
10
|
+
import { OverflowGallery } from './OverflowGallery';
|
13
11
|
/**
|
14
12
|
* DefaultLayout displays remote participants, local video component, and screen sharing component in
|
15
13
|
* a grid and horizontal gallery.
|
@@ -18,7 +16,8 @@ import { VideoGalleryResponsiveHorizontalGallery } from './VideoGalleryResponsiv
|
|
18
16
|
*/
|
19
17
|
export const DefaultLayout = (props) => {
|
20
18
|
const { remoteParticipants = [], dominantSpeakers, localVideoComponent, screenShareComponent, onRenderRemoteParticipant, styles, maxRemoteVideoStreams, parentWidth,
|
21
|
-
/* @conditional-compile-remove(pinned-participants) */ pinnedParticipantUserIds
|
19
|
+
/* @conditional-compile-remove(pinned-participants) */ pinnedParticipantUserIds,
|
20
|
+
/* @conditional-compile-remove(vertical-gallery) */ overflowGalleryLayout = 'HorizontalBottom' } = props;
|
22
21
|
const isNarrow = parentWidth ? isNarrowWidth(parentWidth) : false;
|
23
22
|
const { gridParticipants, horizontalGalleryParticipants } = useOrganizedParticipants({
|
24
23
|
remoteParticipants,
|
@@ -43,18 +42,25 @@ export const DefaultLayout = (props) => {
|
|
43
42
|
if (localVideoComponent) {
|
44
43
|
gridTiles.push(localVideoComponent);
|
45
44
|
}
|
46
|
-
const
|
45
|
+
const overflowGallery = useMemo(() => {
|
47
46
|
if (horizontalGalleryTiles.length === 0) {
|
48
47
|
return null;
|
49
48
|
}
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
49
|
+
return (React.createElement(OverflowGallery, { isNarrow: isNarrow, shouldFloatLocalVideo: false, overflowGalleryElements: horizontalGalleryTiles, styles: styles === null || styles === void 0 ? void 0 : styles.horizontalGallery,
|
50
|
+
/* @conditional-compile-remove(pinned-participants) */
|
51
|
+
overflowGalleryLayout: overflowGalleryLayout }));
|
52
|
+
}, [
|
53
|
+
isNarrow,
|
54
|
+
horizontalGalleryTiles,
|
55
|
+
styles === null || styles === void 0 ? void 0 : styles.horizontalGallery,
|
56
|
+
/* @conditional-compile-remove(vertical-gallery) */ overflowGalleryLayout
|
57
|
+
]);
|
58
|
+
return (React.createElement(Stack
|
59
|
+
/* @conditional-compile-remove(vertical-gallery) */
|
60
|
+
, {
|
61
|
+
/* @conditional-compile-remove(vertical-gallery) */
|
62
|
+
horizontal: overflowGalleryLayout === 'VerticalRight', styles: rootLayoutStyle, tokens: videoGalleryLayoutGap },
|
57
63
|
screenShareComponent ? (screenShareComponent) : (React.createElement(GridLayout, { key: "grid-layout", styles: styles === null || styles === void 0 ? void 0 : styles.gridLayout }, gridTiles)),
|
58
|
-
|
64
|
+
overflowGallery));
|
59
65
|
};
|
60
66
|
//# sourceMappingURL=DefaultLayout.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"DefaultLayout.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/VideoGallery/DefaultLayout.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,
|
1
|
+
{"version":3,"file":"DefaultLayout.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/VideoGallery/DefaultLayout.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AASpD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAyB,EAAe,EAAE;IACtE,MAAM,EACJ,kBAAkB,GAAG,EAAE,EACvB,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,yBAAyB,EACzB,MAAM,EACN,qBAAqB,EACrB,WAAW;IACX,sDAAsD,CAAC,wBAAwB;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AAI,sBAAsB,CAAC,MAAM,KAAK,CAAC,EAAE;YACvC,OAAO,IAAI,CAAC;SACb;QACD,OAAO,CACL,oBAAC,eAAe,IACd,QAAQ,EAAE,QAAQ,EAClB,qBAAqB,EAAE,KAAK,EAC5B,uBAAuB,EAAE,sBAAsB,EAC/C,MAAM,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,iBAAiB;YACjC,sDAAsD;YACtD,qBAAqB,EAAE,qBAAqB,GAC5C,CACH,CAAC;IACJ,CAAC,EAAE;QACD,QAAQ;QACR,sBAAsB;QACtB,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,iBAAiB;QACzB,mDAAmD,CAAC,qBAAqB;KAC1E,CAAC,CAAC;IAEH,OAAO,CACL,oBAAC,KAAK;IACJ,mDAAmD;;QAAnD,mDAAmD;QACnD,UAAU,EAAE,qBAAqB,KAAK,eAAe,EACrD,MAAM,EAAE,eAAe,EACvB,MAAM,EAAE,qBAAqB;QAE5B,oBAAoB,CAAC,CAAC,CAAC,CACtB,oBAAoB,CACrB,CAAC,CAAC,CAAC,CACF,oBAAC,UAAU,IAAC,GAAG,EAAC,aAAa,EAAC,MAAM,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,UAAU,IACrD,SAAS,CACC,CACd;QACA,eAAe,CACV,CACT,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { Stack } from '@fluentui/react';\nimport React, { useMemo } from 'react';\nimport { GridLayout } from '../GridLayout';\nimport { isNarrowWidth } from '../utils/responsive';\nimport { LayoutProps } from './Layout';\nimport { rootLayoutStyle } from './styles/DefaultLayout.styles';\nimport { videoGalleryLayoutGap } from './styles/Layout.styles';\nimport { useOrganizedParticipants } from './utils/videoGalleryLayoutUtils';\nimport { OverflowGallery } from './OverflowGallery';\n\n/**\n * Props for {@link DefaultLayout}.\n *\n * @private\n */\nexport type DefaultLayoutProps = LayoutProps;\n\n/**\n * DefaultLayout displays remote participants, local video component, and screen sharing component in\n * a grid and horizontal gallery.\n *\n * @private\n */\nexport const DefaultLayout = (props: DefaultLayoutProps): JSX.Element => {\n const {\n remoteParticipants = [],\n dominantSpeakers,\n localVideoComponent,\n screenShareComponent,\n onRenderRemoteParticipant,\n styles,\n maxRemoteVideoStreams,\n parentWidth,\n /* @conditional-compile-remove(pinned-participants) */ pinnedParticipantUserIds,\n /* @conditional-compile-remove(vertical-gallery) */ overflowGalleryLayout = 'HorizontalBottom'\n } = props;\n\n const isNarrow = parentWidth ? isNarrowWidth(parentWidth) : false;\n\n const { gridParticipants, horizontalGalleryParticipants } = useOrganizedParticipants({\n remoteParticipants,\n dominantSpeakers,\n maxRemoteVideoStreams,\n isScreenShareActive: !!screenShareComponent,\n /* @conditional-compile-remove(pinned-participants) */ pinnedParticipantUserIds\n });\n\n let activeVideoStreams = 0;\n\n const gridTiles = gridParticipants.map((p) => {\n return onRenderRemoteParticipant(\n p,\n maxRemoteVideoStreams && maxRemoteVideoStreams >= 0\n ? p.videoStream?.isAvailable && activeVideoStreams++ < maxRemoteVideoStreams\n : p.videoStream?.isAvailable\n );\n });\n\n const horizontalGalleryTiles = horizontalGalleryParticipants.map((p) => {\n return onRenderRemoteParticipant(\n p,\n maxRemoteVideoStreams && maxRemoteVideoStreams >= 0\n ? p.videoStream?.isAvailable && activeVideoStreams++ < maxRemoteVideoStreams\n : p.videoStream?.isAvailable\n );\n });\n\n if (localVideoComponent) {\n gridTiles.push(localVideoComponent);\n }\n\n const overflowGallery = useMemo(() => {\n if (horizontalGalleryTiles.length === 0) {\n return null;\n }\n return (\n <OverflowGallery\n isNarrow={isNarrow}\n shouldFloatLocalVideo={false}\n overflowGalleryElements={horizontalGalleryTiles}\n styles={styles?.horizontalGallery}\n /* @conditional-compile-remove(pinned-participants) */\n overflowGalleryLayout={overflowGalleryLayout}\n />\n );\n }, [\n isNarrow,\n horizontalGalleryTiles,\n styles?.horizontalGallery,\n /* @conditional-compile-remove(vertical-gallery) */ overflowGalleryLayout\n ]);\n\n return (\n <Stack\n /* @conditional-compile-remove(vertical-gallery) */\n horizontal={overflowGalleryLayout === 'VerticalRight'}\n styles={rootLayoutStyle}\n tokens={videoGalleryLayoutGap}\n >\n {screenShareComponent ? (\n screenShareComponent\n ) : (\n <GridLayout key=\"grid-layout\" styles={styles?.gridLayout}>\n {gridTiles}\n </GridLayout>\n )}\n {overflowGallery}\n </Stack>\n );\n};\n"]}
|
@@ -2,11 +2,18 @@
|
|
2
2
|
/**
|
3
3
|
* @private
|
4
4
|
*/
|
5
|
-
export
|
5
|
+
export interface FloatingLocalVideoProps {
|
6
6
|
localVideoComponent: JSX.Element;
|
7
7
|
layerHostId: string;
|
8
|
-
isNarrow?: boolean;
|
9
8
|
parentWidth?: number;
|
10
9
|
parentHeight?: number;
|
11
|
-
|
10
|
+
localVideoSize: {
|
11
|
+
width: number;
|
12
|
+
height: number;
|
13
|
+
};
|
14
|
+
}
|
15
|
+
/**
|
16
|
+
* @private
|
17
|
+
*/
|
18
|
+
export declare const FloatingLocalVideo: (props: FloatingLocalVideoProps) => JSX.Element;
|
12
19
|
//# sourceMappingURL=FloatingLocalVideo.d.ts.map
|
@@ -4,7 +4,7 @@ import { ContextualMenu } from '@fluentui/react';
|
|
4
4
|
import React, { useMemo } from 'react';
|
5
5
|
import { useTheme } from '../../theming';
|
6
6
|
import { _ModalClone } from '../ModalClone/ModalClone';
|
7
|
-
import { floatingLocalVideoModalStyle,
|
7
|
+
import { floatingLocalVideoModalStyle, localVideoTileOuterPaddingPX } from './styles/FloatingLocalVideo.styles';
|
8
8
|
const DRAG_OPTIONS = {
|
9
9
|
moveMenuItemText: 'Move',
|
10
10
|
closeMenuItemText: 'Close',
|
@@ -20,21 +20,19 @@ const modalMaxDragPosition = { x: localVideoTileOuterPaddingPX, y: localVideoTil
|
|
20
20
|
* @private
|
21
21
|
*/
|
22
22
|
export const FloatingLocalVideo = (props) => {
|
23
|
-
const { localVideoComponent, layerHostId,
|
23
|
+
const { localVideoComponent, layerHostId, localVideoSize, parentWidth, parentHeight } = props;
|
24
24
|
const theme = useTheme();
|
25
|
-
const modalWidth = isNarrow ? SMALL_FLOATING_MODAL_SIZE_PX.width : LARGE_FLOATING_MODAL_SIZE_PX.width;
|
26
|
-
const modalHeight = isNarrow ? SMALL_FLOATING_MODAL_SIZE_PX.height : LARGE_FLOATING_MODAL_SIZE_PX.height;
|
27
25
|
// The minimum drag position is the top left of the video gallery. i.e. the modal (PiP) should not be able
|
28
26
|
// to be dragged offscreen and these are the top and left bounds of that calculation.
|
29
27
|
const modalMinDragPosition = useMemo(() => parentWidth && parentHeight
|
30
28
|
? {
|
31
29
|
// We use -parentWidth/Height because our modal is positioned to start in the bottom right,
|
32
30
|
// hence (0,0) is the bottom right of the video gallery.
|
33
|
-
x: -parentWidth +
|
34
|
-
y: -parentHeight +
|
31
|
+
x: -parentWidth + localVideoSize.width + localVideoTileOuterPaddingPX,
|
32
|
+
y: -parentHeight + localVideoSize.height + localVideoTileOuterPaddingPX
|
35
33
|
}
|
36
|
-
: undefined, [parentHeight, parentWidth,
|
37
|
-
const modalStyles = useMemo(() => floatingLocalVideoModalStyle(theme,
|
34
|
+
: undefined, [parentHeight, parentWidth, localVideoSize.width, localVideoSize.height]);
|
35
|
+
const modalStyles = useMemo(() => floatingLocalVideoModalStyle(theme, localVideoSize), [theme, localVideoSize]);
|
38
36
|
const layerProps = useMemo(() => ({ hostId: layerHostId }), [layerHostId]);
|
39
37
|
return (React.createElement(_ModalClone, { isOpen: true, isModeless: true, dragOptions: DRAG_OPTIONS, styles: modalStyles, layerProps: layerProps, maxDragPosition: modalMaxDragPosition, minDragPosition: modalMinDragPosition }, localVideoComponent));
|
40
38
|
};
|
package/dist/dist-esm/react-components/src/components/VideoGallery/FloatingLocalVideo.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"FloatingLocalVideo.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/VideoGallery/FloatingLocalVideo.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,cAAc,EAAgB,MAAM,iBAAiB,CAAC;AAC/D,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAiB,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,
|
1
|
+
{"version":3,"file":"FloatingLocalVideo.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/VideoGallery/FloatingLocalVideo.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,cAAc,EAAgB,MAAM,iBAAiB,CAAC;AAC/D,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAiB,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,4BAA4B,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAC;AAEhH,MAAM,YAAY,GAAiB;IACjC,gBAAgB,EAAE,MAAM;IACxB,iBAAiB,EAAE,OAAO;IAC1B,IAAI,EAAE,cAAc;IACpB,YAAY,EAAE,IAAI;CACnB,CAAC;AAEF,4FAA4F;AAC5F,+EAA+E;AAC/E,sHAAsH;AACtH,wCAAwC;AACxC,MAAM,oBAAoB,GAAG,EAAE,CAAC,EAAE,4BAA4B,EAAE,CAAC,EAAE,4BAA4B,EAAE,CAAC;AAqBlG;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAA8B,EAAe,EAAE;IAChF,MAAM,EAAE,mBAAmB,EAAE,WAAW,EAAE,cAAc,EAAE,WAAW,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC;IAE9F,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IAEzB,0GAA0G;IAC1G,qFAAqF;IACrF,MAAM,oBAAoB,GAA8B,OAAO,CAC7D,GAAG,EAAE,CACH,WAAW,IAAI,YAAY;QACzB,CAAC,CAAC;YACE,2FAA2F;YAC3F,wDAAwD;YACxD,CAAC,EAAE,CAAC,WAAW,GAAG,cAAc,CAAC,KAAK,GAAG,4BAA4B;YACrE,CAAC,EAAE,CAAC,YAAY,GAAG,cAAc,CAAC,MAAM,GAAG,4BAA4B;SACxE;QACH,CAAC,CAAC,SAAS,EACf,CAAC,YAAY,EAAE,WAAW,EAAE,cAAc,CAAC,KAAK,EAAE,cAAc,CAAC,MAAM,CAAC,CACzE,CAAC;IAEF,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,4BAA4B,CAAC,KAAK,EAAE,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC;IAChH,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAE3E,OAAO,CACL,oBAAC,WAAW,IACV,MAAM,EAAE,IAAI,EACZ,UAAU,EAAE,IAAI,EAChB,WAAW,EAAE,YAAY,EACzB,MAAM,EAAE,WAAW,EACnB,UAAU,EAAE,UAAU,EACtB,eAAe,EAAE,oBAAoB,EACrC,eAAe,EAAE,oBAAoB,IAEpC,mBAAmB,CACR,CACf,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { ContextualMenu, IDragOptions } from '@fluentui/react';\nimport React, { useMemo } from 'react';\nimport { useTheme } from '../../theming';\nimport { _ICoordinates, _ModalClone } from '../ModalClone/ModalClone';\nimport { floatingLocalVideoModalStyle, localVideoTileOuterPaddingPX } from './styles/FloatingLocalVideo.styles';\n\nconst DRAG_OPTIONS: IDragOptions = {\n moveMenuItemText: 'Move',\n closeMenuItemText: 'Close',\n menu: ContextualMenu,\n keepInBounds: true\n};\n\n// Manually override the max position used to keep the modal in the bounds of its container.\n// This is a workaround for: https://github.com/microsoft/fluentui/issues/20122\n// Because our modal starts in the bottom right corner, we can say that this is the max (i.e. rightmost and bottomost)\n// position the modal can be dragged to.\nconst modalMaxDragPosition = { x: localVideoTileOuterPaddingPX, y: localVideoTileOuterPaddingPX };\n\n/**\n * @private\n */\nexport interface FloatingLocalVideoProps {\n // Local video component to make draggable\n localVideoComponent: JSX.Element;\n // Element id of layer host to constrain the dragging of local video\n layerHostId: string;\n // Parent component width in px\n parentWidth?: number;\n // Parent component height in px\n parentHeight?: number;\n // Local video width and height in px\n localVideoSize: {\n width: number;\n height: number;\n };\n}\n\n/**\n * @private\n */\nexport const FloatingLocalVideo = (props: FloatingLocalVideoProps): JSX.Element => {\n const { localVideoComponent, layerHostId, localVideoSize, parentWidth, parentHeight } = props;\n\n const theme = useTheme();\n\n // The minimum drag position is the top left of the video gallery. i.e. the modal (PiP) should not be able\n // to be dragged offscreen and these are the top and left bounds of that calculation.\n const modalMinDragPosition: _ICoordinates | undefined = useMemo(\n () =>\n parentWidth && parentHeight\n ? {\n // We use -parentWidth/Height because our modal is positioned to start in the bottom right,\n // hence (0,0) is the bottom right of the video gallery.\n x: -parentWidth + localVideoSize.width + localVideoTileOuterPaddingPX,\n y: -parentHeight + localVideoSize.height + localVideoTileOuterPaddingPX\n }\n : undefined,\n [parentHeight, parentWidth, localVideoSize.width, localVideoSize.height]\n );\n\n const modalStyles = useMemo(() => floatingLocalVideoModalStyle(theme, localVideoSize), [theme, localVideoSize]);\n const layerProps = useMemo(() => ({ hostId: layerHostId }), [layerHostId]);\n\n return (\n <_ModalClone\n isOpen={true}\n isModeless={true}\n dragOptions={DRAG_OPTIONS}\n styles={modalStyles}\n layerProps={layerProps}\n maxDragPosition={modalMaxDragPosition}\n minDragPosition={modalMinDragPosition}\n >\n {localVideoComponent}\n </_ModalClone>\n );\n};\n"]}
|