@azure/communication-react 1.5.1-alpha-202303230013 → 1.5.1-alpha-202303250012

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/communication-react.d.ts +2 -0
  2. package/dist/dist-cjs/communication-react/index.js +187 -158
  3. package/dist/dist-cjs/communication-react/index.js.map +1 -1
  4. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
  5. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
  6. package/dist/dist-esm/react-components/src/components/HorizontalGallery.js +7 -2
  7. package/dist/dist-esm/react-components/src/components/HorizontalGallery.js.map +1 -1
  8. package/dist/dist-esm/react-components/src/components/ResponsiveHorizontalGallery.d.ts +2 -1
  9. package/dist/dist-esm/react-components/src/components/ResponsiveHorizontalGallery.js +2 -2
  10. package/dist/dist-esm/react-components/src/components/ResponsiveHorizontalGallery.js.map +1 -1
  11. package/dist/dist-esm/react-components/src/components/ResponsiveVerticalGallery.d.ts +2 -0
  12. package/dist/dist-esm/react-components/src/components/ResponsiveVerticalGallery.js +2 -1
  13. package/dist/dist-esm/react-components/src/components/ResponsiveVerticalGallery.js.map +1 -1
  14. package/dist/dist-esm/react-components/src/components/VideoGallery/DefaultLayout.js +11 -4
  15. package/dist/dist-esm/react-components/src/components/VideoGallery/DefaultLayout.js.map +1 -1
  16. package/dist/dist-esm/react-components/src/components/VideoGallery/FloatingLocalVideo.d.ts +1 -1
  17. package/dist/dist-esm/react-components/src/components/VideoGallery/FloatingLocalVideo.js +11 -7
  18. package/dist/dist-esm/react-components/src/components/VideoGallery/FloatingLocalVideo.js.map +1 -1
  19. package/dist/dist-esm/react-components/src/components/VideoGallery/FloatingLocalVideoLayout.js +21 -14
  20. package/dist/dist-esm/react-components/src/components/VideoGallery/FloatingLocalVideoLayout.js.map +1 -1
  21. package/dist/dist-esm/react-components/src/components/VideoGallery/Layout.js.map +1 -1
  22. package/dist/dist-esm/react-components/src/components/VideoGallery/OverflowGallery.d.ts +1 -0
  23. package/dist/dist-esm/react-components/src/components/VideoGallery/OverflowGallery.js +7 -4
  24. package/dist/dist-esm/react-components/src/components/VideoGallery/OverflowGallery.js.map +1 -1
  25. package/dist/dist-esm/react-components/src/components/VideoGallery/styles/FloatingLocalVideo.styles.d.ts +9 -9
  26. package/dist/dist-esm/react-components/src/components/VideoGallery/styles/FloatingLocalVideo.styles.js +15 -15
  27. package/dist/dist-esm/react-components/src/components/VideoGallery/styles/FloatingLocalVideo.styles.js.map +1 -1
  28. package/dist/dist-esm/react-components/src/components/VideoGallery/styles/ScrollableHorizontalGallery.style.js +2 -2
  29. package/dist/dist-esm/react-components/src/components/VideoGallery/styles/ScrollableHorizontalGallery.style.js.map +1 -1
  30. package/dist/dist-esm/react-components/src/components/VideoGallery/styles/VideoGalleryResponsiveHorizontalGallery.styles.d.ts +4 -1
  31. package/dist/dist-esm/react-components/src/components/VideoGallery/styles/VideoGalleryResponsiveHorizontalGallery.styles.js +8 -7
  32. package/dist/dist-esm/react-components/src/components/VideoGallery/styles/VideoGalleryResponsiveHorizontalGallery.styles.js.map +1 -1
  33. package/dist/dist-esm/react-components/src/components/VideoGallery/styles/VideoGalleryResponsiveVerticalGallery.styles.js +4 -7
  34. package/dist/dist-esm/react-components/src/components/VideoGallery/styles/VideoGalleryResponsiveVerticalGallery.styles.js.map +1 -1
  35. package/dist/dist-esm/react-components/src/components/VideoGallery/utils/OverflowGalleryUtils.d.ts +0 -1
  36. package/dist/dist-esm/react-components/src/components/VideoGallery/utils/OverflowGalleryUtils.js +5 -4
  37. package/dist/dist-esm/react-components/src/components/VideoGallery/utils/OverflowGalleryUtils.js.map +1 -1
  38. package/dist/dist-esm/react-components/src/components/VideoGallery/utils/videoGalleryLayoutUtils.d.ts +1 -1
  39. package/dist/dist-esm/react-components/src/components/VideoGallery/utils/videoGalleryLayoutUtils.js +50 -41
  40. package/dist/dist-esm/react-components/src/components/VideoGallery/utils/videoGalleryLayoutUtils.js.map +1 -1
  41. package/dist/dist-esm/react-components/src/components/styles/HorizontalGallery.styles.js +1 -0
  42. package/dist/dist-esm/react-components/src/components/styles/HorizontalGallery.styles.js.map +1 -1
  43. package/dist/dist-esm/react-components/src/gallery/dominantSpeaker.js +6 -14
  44. package/dist/dist-esm/react-components/src/gallery/dominantSpeaker.js.map +1 -1
  45. package/dist/dist-esm/react-components/src/identifiers/IdentifierProvider.d.ts +2 -0
  46. package/dist/dist-esm/react-components/src/identifiers/IdentifierProvider.js +1 -0
  47. package/dist/dist-esm/react-components/src/identifiers/IdentifierProvider.js.map +1 -1
  48. package/package.json +8 -8
@@ -162,7 +162,7 @@ const _toCommunicationIdentifier = (id) => {
162
162
  // Copyright (c) Microsoft Corporation.
163
163
  // Licensed under the MIT license.
164
164
  // GENERATED FILE. DO NOT EDIT MANUALLY.
165
- var telemetryVersion = '1.5.1-alpha-202303230013';
165
+ var telemetryVersion = '1.5.1-alpha-202303250012';
166
166
 
167
167
  // Copyright (c) Microsoft Corporation.
168
168
  /**
@@ -4326,6 +4326,7 @@ const defaultIdentifiers = {
4326
4326
  overflowGalleryRightNavButton: 'overflow-gallery-right-nav-button',
4327
4327
  /* @conditional-compile-remove(vertical-gallery) */
4328
4328
  verticalGalleryVideoTile: 'vertical-gallery-video-tile',
4329
+ horizontalGalleryVideoTile: 'horizontal-gallery-video-tile',
4329
4330
  /* @conditional-compile-remove(vertical-gallery) */
4330
4331
  verticalGalleryPageCounter: 'vertical-gallery-page-counter'
4331
4332
  };
@@ -9223,10 +9224,7 @@ const smartDominantSpeakerParticipants = (args) => {
9223
9224
  }
9224
9225
  const participantsMap = participantsById(participants);
9225
9226
  // Only use the Max allowed dominant speakers that exist in participants
9226
- const dominantSpeakerIds = Array.from(new Set(dominantSpeakers).values())
9227
- .filter((id) => !!participantsMap[id])
9228
- .slice(0, maxDominantSpeakers);
9229
- const lastVisibleParticipantIds = lastVisibleParticipants.map((p) => p.userId);
9227
+ const dominantSpeakerIds = dominantSpeakers.filter((id) => !!participantsMap[id]).slice(0, maxDominantSpeakers);
9230
9228
  const newVisibleParticipantIds = lastVisibleParticipants.map((p) => p.userId).slice(0, maxDominantSpeakers);
9231
9229
  const newDominantSpeakerIds = dominantSpeakerIds.filter((id) => !newVisibleParticipantIds.includes(id));
9232
9230
  // Remove participants that are no longer dominant and replace them with new dominant speakers.
@@ -9240,17 +9238,12 @@ const smartDominantSpeakerParticipants = (args) => {
9240
9238
  newVisibleParticipantIds[index] = replacement;
9241
9239
  }
9242
9240
  }
9243
- const removedVisibleParticipantIds = lastVisibleParticipantIds.filter((p) => !newVisibleParticipantIds.includes(p));
9244
- removedVisibleParticipantIds.forEach((p) => newVisibleParticipantIds.push(p));
9245
- const newVisibleParticipantIdSet = new Set(newVisibleParticipantIds);
9246
- const leftoverParticipants = participants.filter((p) => !newVisibleParticipantIdSet.has(p.userId));
9247
- leftoverParticipants.forEach((p) => {
9248
- newVisibleParticipantIds.push(p.userId);
9249
- });
9250
- // newVisibleParticipantIds can contain identifiers for participants that are no longer in the call. So we ignore those IDs.
9251
- const newVisibleParticipants = newVisibleParticipantIds
9241
+ let newVisibleParticipants = newVisibleParticipantIds
9252
9242
  .map((participantId) => participantsMap[participantId])
9253
- .filter((p) => !!p);
9243
+ .filter((p) => p !== undefined);
9244
+ const newVisibleParticipantIdsSet = new Set(newVisibleParticipantIds);
9245
+ const remainingParticipants = participants.filter((p) => !newVisibleParticipantIdsSet.has(p.userId));
9246
+ newVisibleParticipants = newVisibleParticipants.concat(remainingParticipants);
9254
9247
  return newVisibleParticipants;
9255
9248
  };
9256
9249
  const participantsById = (participants) => {
@@ -9261,38 +9254,42 @@ const participantsById = (participants) => {
9261
9254
 
9262
9255
  // Copyright (c) Microsoft Corporation.
9263
9256
  const DEFAULT_MAX_REMOTE_VIDEOSTREAMS = 4;
9264
- const DEFAULT_MAX_AUDIO_DOMINANT_SPEAKERS = 6;
9257
+ const DEFAULT_MAX_HORIZONTAL_GALLERY_DOMINANT_SPEAKERS = 6;
9265
9258
  const _useOrganizedParticipants = (props) => {
9266
- var _a, _b;
9267
- const visibleVideoParticipants = React.useRef([]);
9268
- const visibleAudioParticipants = React.useRef([]);
9269
- const { remoteParticipants, dominantSpeakers, maxRemoteVideoStreams = DEFAULT_MAX_REMOTE_VIDEOSTREAMS, maxAudioDominantSpeakers = DEFAULT_MAX_AUDIO_DOMINANT_SPEAKERS, isScreenShareActive = false } = props;
9270
- visibleVideoParticipants.current = smartDominantSpeakerParticipants({
9271
- participants: (_a = remoteParticipants === null || remoteParticipants === void 0 ? void 0 : remoteParticipants.filter((p) => { var _a; return (_a = p.videoStream) === null || _a === void 0 ? void 0 : _a.isAvailable; })) !== null && _a !== void 0 ? _a : [],
9272
- dominantSpeakers,
9273
- lastVisibleParticipants: visibleVideoParticipants.current,
9274
- maxDominantSpeakers: maxRemoteVideoStreams
9275
- }).slice(0, maxRemoteVideoStreams);
9276
- const visibleVideoParticipantsSet = new Set(visibleVideoParticipants.current.map((p) => p.userId));
9259
+ const visibleGridParticipants = React.useRef([]);
9260
+ const visibleHorizontalGalleryParticipants = React.useRef([]);
9261
+ const { remoteParticipants = [], dominantSpeakers = [], maxRemoteVideoStreams = DEFAULT_MAX_REMOTE_VIDEOSTREAMS, maxHorizontalGalleryDominantSpeakers = DEFAULT_MAX_HORIZONTAL_GALLERY_DOMINANT_SPEAKERS, isScreenShareActive = false, pinnedParticipantUserIds = [] } = props;
9262
+ const videoParticipants = remoteParticipants.filter((p) => { var _a; return (_a = p.videoStream) === null || _a === void 0 ? void 0 : _a.isAvailable; });
9263
+ visibleGridParticipants.current =
9264
+ pinnedParticipantUserIds.length > 0 || isScreenShareActive
9265
+ ? []
9266
+ : smartDominantSpeakerParticipants({
9267
+ participants: videoParticipants,
9268
+ dominantSpeakers,
9269
+ lastVisibleParticipants: visibleGridParticipants.current,
9270
+ maxDominantSpeakers: maxRemoteVideoStreams
9271
+ }).slice(0, maxRemoteVideoStreams);
9272
+ const visibleGridParticipantsSet = new Set(visibleGridParticipants.current.map((p) => p.userId));
9273
+ const remoteParticipantsOrdered = putVideoParticipantsFirst(remoteParticipants);
9277
9274
  /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */
9278
- const callingParticipants = remoteParticipants.filter((p) => p.state === ('Connecting' ));
9275
+ const callingParticipants = remoteParticipantsOrdered.filter((p) => p.state === ('Connecting' ));
9279
9276
  /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */
9280
9277
  const callingParticipantsSet = new Set(callingParticipants.map((p) => p.userId));
9281
- visibleAudioParticipants.current = smartDominantSpeakerParticipants({
9282
- participants: (_b = remoteParticipants === null || remoteParticipants === void 0 ? void 0 : remoteParticipants.filter((p) => !visibleVideoParticipantsSet.has(p.userId) &&
9283
- /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */ !callingParticipantsSet.has(p.userId))) !== null && _b !== void 0 ? _b : [],
9284
- dominantSpeakers,
9285
- lastVisibleParticipants: visibleAudioParticipants.current,
9286
- maxDominantSpeakers: maxAudioDominantSpeakers
9278
+ visibleHorizontalGalleryParticipants.current = smartDominantSpeakerParticipants({
9279
+ participants: remoteParticipantsOrdered.filter((p) => !visibleGridParticipantsSet.has(p.userId) &&
9280
+ /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */ !callingParticipantsSet.has(p.userId)),
9281
+ dominantSpeakers: dominantSpeakers,
9282
+ lastVisibleParticipants: visibleHorizontalGalleryParticipants.current,
9283
+ maxDominantSpeakers: maxHorizontalGalleryDominantSpeakers
9287
9284
  });
9288
9285
  const getGridParticipants = React.useCallback(() => {
9289
9286
  if (isScreenShareActive) {
9290
9287
  return [];
9291
9288
  }
9292
9289
  /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */
9293
- return visibleVideoParticipants.current.length > 0
9294
- ? visibleVideoParticipants.current
9295
- : visibleAudioParticipants.current.concat(callingParticipants);
9290
+ return visibleGridParticipants.current.length > 0
9291
+ ? visibleGridParticipants.current
9292
+ : visibleHorizontalGalleryParticipants.current.concat(callingParticipants);
9296
9293
  }, [
9297
9294
  /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */ callingParticipants,
9298
9295
  isScreenShareActive
@@ -9302,14 +9299,14 @@ const _useOrganizedParticipants = (props) => {
9302
9299
  if (isScreenShareActive) {
9303
9300
  // If screen sharing is active, assign video and audio participants as horizontal gallery participants
9304
9301
  /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */
9305
- return visibleVideoParticipants.current.concat(visibleAudioParticipants.current.concat(callingParticipants));
9302
+ return visibleGridParticipants.current.concat(visibleHorizontalGalleryParticipants.current.concat(callingParticipants));
9306
9303
  }
9307
9304
  else {
9308
9305
  // If screen sharing is not active, then assign all video tiles as grid tiles.
9309
9306
  // If there are no video tiles, then assign audio tiles as grid tiles.
9310
9307
  /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */
9311
- return visibleVideoParticipants.current.length > 0
9312
- ? visibleAudioParticipants.current.concat(callingParticipants)
9308
+ return visibleGridParticipants.current.length > 0
9309
+ ? visibleHorizontalGalleryParticipants.current.concat(callingParticipants)
9313
9310
  : [];
9314
9311
  }
9315
9312
  }, [
@@ -9327,18 +9324,12 @@ const _useOrganizedParticipantsWithPinnedParticipants = (props) => {
9327
9324
  map[remoteParticipant.userId] = remoteParticipant;
9328
9325
  return map;
9329
9326
  }, {});
9330
- // count pinned participants with video
9331
- let pinnedParticipantsWithVideoOnCount = 0;
9332
9327
  // get pinned participants in the same order of pinned participant user ids using remoteParticipantMap
9333
9328
  const pinnedParticipants = [];
9334
9329
  (_a = props.pinnedParticipantUserIds) === null || _a === void 0 ? void 0 : _a.forEach((id) => {
9335
- var _a;
9336
9330
  const pinnedParticipant = remoteParticipantMap[id];
9337
9331
  if (pinnedParticipant) {
9338
9332
  pinnedParticipants.push(pinnedParticipant);
9339
- if ((_a = pinnedParticipant.videoStream) === null || _a === void 0 ? void 0 : _a.isAvailable) {
9340
- pinnedParticipantsWithVideoOnCount++;
9341
- }
9342
9333
  }
9343
9334
  });
9344
9335
  // get unpinned participants by filtering all remote participants using a set of pinned participant user ids
@@ -9346,11 +9337,7 @@ const _useOrganizedParticipantsWithPinnedParticipants = (props) => {
9346
9337
  const unpinnedParticipants = props.remoteParticipants.filter((p) => !pinnedParticipantUserIdSet.has(p.userId));
9347
9338
  const useOrganizedParticipantsProps = Object.assign(Object.assign({}, props), {
9348
9339
  // if there are pinned participants then we should only consider unpinned participants
9349
- remoteParticipants: unpinnedParticipants,
9350
- // if there is a maximum of remote video streams we need to subtract pinned participants with video
9351
- maxRemoteVideoStreams: props.maxRemoteVideoStreams
9352
- ? props.maxRemoteVideoStreams - pinnedParticipantsWithVideoOnCount
9353
- : undefined });
9340
+ remoteParticipants: unpinnedParticipants });
9354
9341
  const useOrganizedParticipantsResult = _useOrganizedParticipants(useOrganizedParticipantsProps);
9355
9342
  if (pinnedParticipants.length === 0) {
9356
9343
  return useOrganizedParticipantsResult;
@@ -9362,6 +9349,21 @@ const _useOrganizedParticipantsWithPinnedParticipants = (props) => {
9362
9349
  : useOrganizedParticipantsResult.gridParticipants.concat(useOrganizedParticipantsResult.horizontalGalleryParticipants)
9363
9350
  };
9364
9351
  };
9352
+ const putVideoParticipantsFirst = (remoteParticipants) => {
9353
+ const videoParticipants = [];
9354
+ const audioParticipants = [];
9355
+ remoteParticipants.forEach((p) => {
9356
+ var _a;
9357
+ if ((_a = p.videoStream) === null || _a === void 0 ? void 0 : _a.isAvailable) {
9358
+ videoParticipants.push(p);
9359
+ }
9360
+ else {
9361
+ audioParticipants.push(p);
9362
+ }
9363
+ });
9364
+ const remoteParticipantSortedByVideo = videoParticipants.concat(audioParticipants);
9365
+ return remoteParticipantSortedByVideo;
9366
+ };
9365
9367
  /**
9366
9368
  * Hook to determine which participants should be in grid and horizontal gallery and their order respectively
9367
9369
  * @private
@@ -9408,6 +9410,7 @@ const rootStyle$1 = {
9408
9410
  */
9409
9411
  const childrenContainerStyle$1 = {
9410
9412
  height: '100%',
9413
+ width: '100%',
9411
9414
  gap: `${HORIZONTAL_GALLERY_GAP}rem`
9412
9415
  };
9413
9416
 
@@ -9444,7 +9447,7 @@ const DEFAULT_CHILDREN_PER_PAGE = 5;
9444
9447
  * @returns
9445
9448
  */
9446
9449
  const HorizontalGallery = (props) => {
9447
- var _a, _b;
9450
+ var _a;
9448
9451
  const { children, childrenPerPage = DEFAULT_CHILDREN_PER_PAGE, styles, onFetchTilesToRender } = props;
9449
9452
  const ids = useIdentifiers();
9450
9453
  const [page, setPage] = React.useState(0);
@@ -9468,13 +9471,18 @@ const HorizontalGallery = (props) => {
9468
9471
  const showButtons = numberOfChildren > childrenPerPage;
9469
9472
  const disablePreviousButton = page === 0;
9470
9473
  const disableNextButton = page === lastPage;
9474
+ const childrenStyles = React.useMemo(() => {
9475
+ return { root: styles === null || styles === void 0 ? void 0 : styles.children };
9476
+ }, [styles === null || styles === void 0 ? void 0 : styles.children]);
9471
9477
  // If children per page is 0 or less return empty element
9472
9478
  if (childrenPerPage <= 0) {
9473
9479
  return React__default['default'].createElement(React__default['default'].Fragment, null);
9474
9480
  }
9475
9481
  return (React__default['default'].createElement(react.Stack, { horizontal: true, className: react.mergeStyles(rootStyle$1, (_a = props.styles) === null || _a === void 0 ? void 0 : _a.root) },
9476
9482
  showButtons && (React__default['default'].createElement(HorizontalGalleryNavigationButton, { key: "previous-nav-button", icon: React__default['default'].createElement(react.Icon, { iconName: "HorizontalGalleryLeftButton" }), styles: styles === null || styles === void 0 ? void 0 : styles.previousButton, onClick: () => setPage(Math.max(0, Math.min(lastPage, page - 1))), disabled: disablePreviousButton, identifier: ids.overflowGalleryLeftNavButton })),
9477
- React__default['default'].createElement(react.Stack, { horizontal: true, className: react.mergeStyles(childrenContainerStyle$1, { '> *': (_b = props.styles) === null || _b === void 0 ? void 0 : _b.children }) }, childrenOnCurrentPage),
9483
+ React__default['default'].createElement(react.Stack, { horizontal: true, className: react.mergeStyles(childrenContainerStyle$1) }, childrenOnCurrentPage.map((child, i) => {
9484
+ return (React__default['default'].createElement(react.Stack.Item, { styles: childrenStyles, key: i, "data-ui-id": ids.horizontalGalleryVideoTile }, child));
9485
+ })),
9478
9486
  showButtons && (React__default['default'].createElement(HorizontalGalleryNavigationButton, { key: "next-nav-button", icon: React__default['default'].createElement(react.Icon, { iconName: "HorizontalGalleryRightButton" }), styles: styles === null || styles === void 0 ? void 0 : styles.nextButton, onClick: () => setPage(Math.min(lastPage, page + 1)), disabled: disableNextButton, identifier: ids.overflowGalleryRightNavButton }))));
9479
9487
  };
9480
9488
  const HorizontalGalleryNavigationButton = (props) => {
@@ -9490,22 +9498,22 @@ react.mergeStyles({ position: 'relative', width: '100%', height: '100%' });
9490
9498
  /**
9491
9499
  * Small floating modal width and height in rem for small screen
9492
9500
  */
9493
- const SMALL_FLOATING_MODAL_SIZE_PX = { width: 58, height: 104 };
9501
+ const SMALL_FLOATING_MODAL_SIZE_REM = { width: 3.625, height: 6.5 };
9494
9502
  /**
9495
9503
  * Large floating modal width and height in rem for large screen
9496
9504
  * Aspect ratio: 16:9
9497
9505
  */
9498
- const LARGE_FLOATING_MODAL_SIZE_PX = { width: 215, height: 120 };
9506
+ const LARGE_FLOATING_MODAL_SIZE_REM = { width: 13.438, height: 7.5 };
9499
9507
  /**
9500
9508
  * Vertical gallery floating modal width and height in rem
9501
9509
  * Aspect ratio: 16:9
9502
9510
  */
9503
- const SHORT_VERTICAL_GALLERY_FLOATING_MODAL_SIZE_PX = { width: 144, height: 81 };
9511
+ const SHORT_VERTICAL_GALLERY_FLOATING_MODAL_SIZE_REM = { width: 9, height: 5.063 };
9504
9512
  /**
9505
9513
  * Vertical gallery floating modal width and height in rem
9506
9514
  * Aspect ratio: 16:9
9507
9515
  */
9508
- const VERTICAL_GALLERY_FLOATING_MODAL_SIZE_PX = { width: 176, height: 100 };
9516
+ const VERTICAL_GALLERY_FLOATING_MODAL_SIZE_REM = { width: 11, height: 6.25 };
9509
9517
  /**
9510
9518
  * @private
9511
9519
  * z-index to ensure that the local video tile is above the video gallery.
@@ -9514,31 +9522,31 @@ const LOCAL_VIDEO_TILE_ZINDEX = 2;
9514
9522
  /**
9515
9523
  * @private
9516
9524
  */
9517
- const localVideoTileContainerStyle = (theme, localVideoTileSize) => {
9525
+ const localVideoTileContainerStyle = (theme, localVideoTileSizeRem) => {
9518
9526
  return {
9519
- minWidth: _pxToRem(localVideoTileSize.width),
9520
- minHeight: _pxToRem(localVideoTileSize.height),
9527
+ minWidth: `${localVideoTileSizeRem.width}rem`,
9528
+ minHeight: `${localVideoTileSizeRem.height}rem`,
9521
9529
  position: 'absolute',
9522
- bottom: _pxToRem(localVideoTileOuterPaddingPX),
9530
+ bottom: `${localVideoTileOuterPaddingRem}rem`,
9523
9531
  borderRadius: theme.effects.roundedCorner4,
9524
9532
  overflow: 'hidden',
9525
- right: _pxToRem(localVideoTileOuterPaddingPX)
9533
+ right: `${localVideoTileOuterPaddingRem}rem`
9526
9534
  };
9527
9535
  };
9528
9536
  /**
9529
9537
  * @private
9530
9538
  */
9531
- const localVideoTileWithControlsContainerStyle = (theme, localVideoTileSize) => {
9532
- return react.concatStyleSets(localVideoTileContainerStyle(theme, localVideoTileSize), {
9539
+ const localVideoTileWithControlsContainerStyle = (theme, localVideoTileSizeRem) => {
9540
+ return react.concatStyleSets(localVideoTileContainerStyle(theme, localVideoTileSizeRem), {
9533
9541
  root: { boxShadow: theme.effects.elevation8 }
9534
9542
  });
9535
9543
  };
9536
9544
  /**
9537
9545
  * @private
9538
9546
  */
9539
- const floatingLocalVideoModalStyle = (theme, modalSize) => {
9547
+ const floatingLocalVideoModalStyle = (theme, modalSizeRem) => {
9540
9548
  return react.concatStyleSets({
9541
- main: localVideoTileContainerStyle(theme, modalSize)
9549
+ main: localVideoTileContainerStyle(theme, modalSizeRem)
9542
9550
  }, {
9543
9551
  main: {
9544
9552
  boxShadow: theme.effects.elevation8,
@@ -9551,10 +9559,10 @@ const floatingLocalVideoModalStyle = (theme, modalSize) => {
9551
9559
  };
9552
9560
  /**
9553
9561
  * Padding equal to the amount the modal should stay inside the bounds of the container.
9554
- * i.e. if this is 8px, the modal should always be at least 8px inside the container at all times on all sides.
9562
+ * i.e. if this is 0.5rem, the modal should always be at least 0.5rem inside the container at all times on all sides.
9555
9563
  * @private
9556
9564
  */
9557
- const localVideoTileOuterPaddingPX = 8;
9565
+ const localVideoTileOuterPaddingRem = 0.5;
9558
9566
  /**
9559
9567
  * @private
9560
9568
  */
@@ -9576,6 +9584,62 @@ const localVideoModalStyles = {
9576
9584
  }
9577
9585
  };
9578
9586
 
9587
+ // Copyright (c) Microsoft Corporation.
9588
+ /**
9589
+ * @private
9590
+ */
9591
+ const horizontalGalleryContainerStyle = (shouldFloatLocalVideo, isNarrow) => {
9592
+ return {
9593
+ minHeight: isNarrow
9594
+ ? `${SMALL_HORIZONTAL_GALLERY_TILE_SIZE_REM.height}rem`
9595
+ : `${LARGE_HORIZONTAL_GALLERY_TILE_SIZE_REM.height}rem`,
9596
+ width: shouldFloatLocalVideo
9597
+ ? isNarrow
9598
+ ? `calc(100% - ${SMALL_FLOATING_MODAL_SIZE_REM.width}rem)`
9599
+ : `calc(100% - ${LARGE_FLOATING_MODAL_SIZE_REM.width}rem)`
9600
+ : '100%',
9601
+ paddingRight: '0.5rem'
9602
+ };
9603
+ };
9604
+ /**
9605
+ * @private
9606
+ */
9607
+ const horizontalGalleryStyle = (isNarrow) => {
9608
+ return {
9609
+ children: isNarrow ? SMALL_HORIZONTAL_GALLERY_TILE_STYLE : LARGE_HORIZONTAL_GALLERY_TILE_STYLE
9610
+ };
9611
+ };
9612
+ /**
9613
+ * Small horizontal gallery tile size in rem
9614
+ * @private
9615
+ */
9616
+ const SMALL_HORIZONTAL_GALLERY_TILE_SIZE_REM = { height: 6.5, width: 6.5 };
9617
+ /**
9618
+ * Large horizontal gallery tile size in rem
9619
+ * @private
9620
+ */
9621
+ const LARGE_HORIZONTAL_GALLERY_TILE_SIZE_REM = { height: 7.5, minWidth: 7.5, maxWidth: 13.43 };
9622
+ /**
9623
+ * @private
9624
+ */
9625
+ const SMALL_HORIZONTAL_GALLERY_TILE_STYLE = {
9626
+ minHeight: `${SMALL_HORIZONTAL_GALLERY_TILE_SIZE_REM.height}rem`,
9627
+ minWidth: `${SMALL_HORIZONTAL_GALLERY_TILE_SIZE_REM.width}rem`,
9628
+ maxHeight: `${SMALL_HORIZONTAL_GALLERY_TILE_SIZE_REM.height}rem`,
9629
+ maxWidth: `${SMALL_HORIZONTAL_GALLERY_TILE_SIZE_REM.width}rem`
9630
+ };
9631
+ /**
9632
+ * @private
9633
+ */
9634
+ const LARGE_HORIZONTAL_GALLERY_TILE_STYLE = {
9635
+ minHeight: `${LARGE_HORIZONTAL_GALLERY_TILE_SIZE_REM.height}rem`,
9636
+ minWidth: `${LARGE_HORIZONTAL_GALLERY_TILE_SIZE_REM.minWidth}rem`,
9637
+ maxHeight: `${LARGE_HORIZONTAL_GALLERY_TILE_SIZE_REM.height}rem`,
9638
+ maxWidth: `${LARGE_HORIZONTAL_GALLERY_TILE_SIZE_REM.maxWidth}rem`,
9639
+ width: '100%',
9640
+ height: '100%'
9641
+ };
9642
+
9579
9643
  // Copyright (c) Microsoft Corporation.
9580
9644
  /**
9581
9645
  * VerticalGallery tile size in rem:
@@ -9609,22 +9673,20 @@ const verticalGalleryContainerStyle = (shouldFloatLocalVideo, isNarrow, isShort)
9609
9673
  return isNarrow && isShort
9610
9674
  ? {
9611
9675
  width: `${SHORT_VERTICAL_GALLERY_TILE_SIZE_REM.width + 1.5}rem`,
9612
- height: shouldFloatLocalVideo ? `calc(100% - ${_pxToRem(SMALL_FLOATING_MODAL_SIZE_PX.height)})` : '100%',
9676
+ height: shouldFloatLocalVideo ? `calc(100% - ${SMALL_FLOATING_MODAL_SIZE_REM.height}rem)` : '100%',
9613
9677
  paddingBottom: '0.5rem'
9614
9678
  }
9615
9679
  : !isNarrow && isShort
9616
9680
  ? {
9617
9681
  width: `${SHORT_VERTICAL_GALLERY_TILE_SIZE_REM.width + 1.5}rem`,
9618
9682
  height: shouldFloatLocalVideo
9619
- ? `calc(100% - ${_pxToRem(SHORT_VERTICAL_GALLERY_FLOATING_MODAL_SIZE_PX.height)})`
9683
+ ? `calc(100% - ${SHORT_VERTICAL_GALLERY_FLOATING_MODAL_SIZE_REM.height}rem)`
9620
9684
  : '100%',
9621
9685
  paddingBottom: '0.5rem'
9622
9686
  }
9623
9687
  : {
9624
9688
  width: `${VERTICAL_GALLERY_TILE_SIZE_REM.width + 1.5}rem`,
9625
- height: shouldFloatLocalVideo
9626
- ? `calc(100% - ${_pxToRem(VERTICAL_GALLERY_FLOATING_MODAL_SIZE_PX.height)})`
9627
- : '100%',
9689
+ height: shouldFloatLocalVideo ? `calc(100% - ${VERTICAL_GALLERY_FLOATING_MODAL_SIZE_REM.height}rem)` : '100%',
9628
9690
  paddingBottom: '0.5rem'
9629
9691
  };
9630
9692
  };
@@ -9665,8 +9727,8 @@ const verticalGalleryStyle = (isShort) => {
9665
9727
  * @private
9666
9728
  */
9667
9729
  const calculateHorizontalChildrenPerPage = (args) => {
9668
- const { numberOfChildren, containerWidth, buttonWidthRem, childWidthRem, gapWidthRem } = args;
9669
- const childWidth = _convertRemToPx(childWidthRem);
9730
+ const { numberOfChildren, containerWidth, buttonWidthRem, gapWidthRem } = args;
9731
+ const childMinWidth = _convertRemToPx(LARGE_HORIZONTAL_GALLERY_TILE_SIZE_REM.minWidth);
9670
9732
  const gapWidth = _convertRemToPx(gapWidthRem);
9671
9733
  /** First check how many children can fit in containerWidth.
9672
9734
  * __________________________________
@@ -9676,7 +9738,7 @@ const calculateHorizontalChildrenPerPage = (args) => {
9676
9738
  * <-----------containerWidth--------->
9677
9739
  * containerWidth = n * childWidth + (n - 1) * gapWidth. Isolate n and take the floor.
9678
9740
  */
9679
- const numberOfChildrenInContainer = Math.floor((containerWidth + gapWidth) / (childWidth + gapWidth));
9741
+ const numberOfChildrenInContainer = Math.floor((containerWidth + gapWidth) / (childMinWidth + gapWidth));
9680
9742
  // If all children fit then return numberOfChildrenInContainer
9681
9743
  if (numberOfChildren <= numberOfChildrenInContainer) {
9682
9744
  return numberOfChildrenInContainer;
@@ -9694,7 +9756,7 @@ const calculateHorizontalChildrenPerPage = (args) => {
9694
9756
  const childrenSpace = containerWidth - 2 * buttonWidth - 2 * gapWidth;
9695
9757
  // Now that we have childrenSpace width we can figure out how many children can fit in childrenSpace.
9696
9758
  // childrenSpace = n * childWidth + (n - 1) * gapWidth. Isolate n and take the floor.
9697
- return Math.max(Math.floor((childrenSpace + gapWidth) / (childWidth + gapWidth)), 1);
9759
+ return Math.max(Math.floor((childrenSpace + gapWidth) / (childMinWidth + gapWidth)), 1);
9698
9760
  };
9699
9761
  /**
9700
9762
  * Helper function to find the number of children for the VerticalGallery on each page.
@@ -9753,7 +9815,7 @@ const calculateVerticalChildrenPerPage = (args) => {
9753
9815
  * available width obtained from a ResizeObserver, width per child, gap width, and button width
9754
9816
  */
9755
9817
  const ResponsiveHorizontalGallery = (props) => {
9756
- const { childWidthRem, gapWidthRem, buttonWidthRem = 0, onFetchTilesToRender } = props;
9818
+ const { gapWidthRem, buttonWidthRem = 0, onFetchTilesToRender, onChildrenPerPageChange } = props;
9757
9819
  const containerRef = React.useRef(null);
9758
9820
  const containerWidth = _useContainerWidth(containerRef);
9759
9821
  const leftPadding = containerRef.current ? parseFloat(getComputedStyle(containerRef.current).paddingLeft) : 0;
@@ -9761,10 +9823,10 @@ const ResponsiveHorizontalGallery = (props) => {
9761
9823
  const childrenPerPage = calculateHorizontalChildrenPerPage({
9762
9824
  numberOfChildren: React__default['default'].Children.count(props.children),
9763
9825
  containerWidth: (containerWidth !== null && containerWidth !== void 0 ? containerWidth : 0) - leftPadding - rightPadding,
9764
- childWidthRem,
9765
9826
  gapWidthRem,
9766
9827
  buttonWidthRem
9767
9828
  });
9829
+ onChildrenPerPageChange === null || onChildrenPerPageChange === void 0 ? void 0 : onChildrenPerPageChange(childrenPerPage);
9768
9830
  return (React__default['default'].createElement("div", { "data-ui-id": "responsive-horizontal-gallery", ref: containerRef, className: react.mergeStyles(props.containerStyles) },
9769
9831
  React__default['default'].createElement(HorizontalGallery, { childrenPerPage: childrenPerPage, styles: props.horizontalGalleryStyles, onFetchTilesToRender: onFetchTilesToRender }, props.children)));
9770
9832
  };
@@ -9947,7 +10009,7 @@ const VerticalGalleryControlBar = (props) => {
9947
10009
  * @beta
9948
10010
  */
9949
10011
  const ResponsiveVerticalGallery = (props) => {
9950
- const { children, containerStyles, verticalGalleryStyles, gapHeightRem, controlBarHeightRem, isShort, onFetchTilesToRender } = props;
10012
+ const { children, containerStyles, verticalGalleryStyles, gapHeightRem, controlBarHeightRem, isShort, onFetchTilesToRender, onChildrenPerPageChange } = props;
9951
10013
  const containerRef = React.useRef(null);
9952
10014
  const containerHeight = _useContainerHeight(containerRef);
9953
10015
  const topPadding = containerRef.current ? parseFloat(getComputedStyle(containerRef.current).paddingTop) : 0;
@@ -9959,64 +10021,11 @@ const ResponsiveVerticalGallery = (props) => {
9959
10021
  controlBarHeight: controlBarHeightRem !== null && controlBarHeightRem !== void 0 ? controlBarHeightRem : 2,
9960
10022
  isShort: isShort !== null && isShort !== void 0 ? isShort : false
9961
10023
  });
10024
+ onChildrenPerPageChange === null || onChildrenPerPageChange === void 0 ? void 0 : onChildrenPerPageChange(childrenPerPage);
9962
10025
  return (React__default['default'].createElement("div", { "data-ui-id": "responsive-vertical-gallery", ref: containerRef, className: react.mergeStyles(containerStyles) },
9963
10026
  React__default['default'].createElement(VerticalGallery, { childrenPerPage: childrenPerPage, styles: verticalGalleryStyles, onFetchTilesToRender: onFetchTilesToRender }, children)));
9964
10027
  };
9965
10028
 
9966
- // Copyright (c) Microsoft Corporation.
9967
- /**
9968
- * @private
9969
- */
9970
- const horizontalGalleryContainerStyle = (shouldFloatLocalVideo, isNarrow) => {
9971
- return {
9972
- minHeight: isNarrow
9973
- ? `${SMALL_HORIZONTAL_GALLERY_TILE_SIZE_REM.height}rem`
9974
- : `${LARGE_HORIZONTAL_GALLERY_TILE_SIZE_REM.height}rem`,
9975
- width: shouldFloatLocalVideo
9976
- ? isNarrow
9977
- ? `calc(100% - ${_pxToRem(SMALL_FLOATING_MODAL_SIZE_PX.width)})`
9978
- : `calc(100% - ${_pxToRem(LARGE_FLOATING_MODAL_SIZE_PX.width)})`
9979
- : '100%',
9980
- paddingRight: '0.5rem'
9981
- };
9982
- };
9983
- /**
9984
- * @private
9985
- */
9986
- const horizontalGalleryStyle = (isNarrow) => {
9987
- return {
9988
- children: isNarrow ? SMALL_HORIZONTAL_GALLERY_TILE_STYLE : LARGE_HORIZONTAL_GALLERY_TILE_STYLE
9989
- };
9990
- };
9991
- /**
9992
- * Small horizontal gallery tile size in rem
9993
- * @private
9994
- */
9995
- const SMALL_HORIZONTAL_GALLERY_TILE_SIZE_REM = { height: 6.5, width: 6.5 };
9996
- /**
9997
- * Large horizontal gallery tile size in rem
9998
- * @private
9999
- */
10000
- const LARGE_HORIZONTAL_GALLERY_TILE_SIZE_REM = { height: 7.5, width: 10 };
10001
- /**
10002
- * @private
10003
- */
10004
- const SMALL_HORIZONTAL_GALLERY_TILE_STYLE = {
10005
- minHeight: `${SMALL_HORIZONTAL_GALLERY_TILE_SIZE_REM.height}rem`,
10006
- minWidth: `${SMALL_HORIZONTAL_GALLERY_TILE_SIZE_REM.width}rem`,
10007
- maxHeight: `${SMALL_HORIZONTAL_GALLERY_TILE_SIZE_REM.height}rem`,
10008
- maxWidth: `${SMALL_HORIZONTAL_GALLERY_TILE_SIZE_REM.width}rem`
10009
- };
10010
- /**
10011
- * @private
10012
- */
10013
- const LARGE_HORIZONTAL_GALLERY_TILE_STYLE = {
10014
- minHeight: `${LARGE_HORIZONTAL_GALLERY_TILE_SIZE_REM.height}rem`,
10015
- minWidth: `${LARGE_HORIZONTAL_GALLERY_TILE_SIZE_REM.width}rem`,
10016
- maxHeight: `${LARGE_HORIZONTAL_GALLERY_TILE_SIZE_REM.height}rem`,
10017
- maxWidth: `${LARGE_HORIZONTAL_GALLERY_TILE_SIZE_REM.width}rem`
10018
- };
10019
-
10020
10029
  // Copyright (c) Microsoft Corporation.
10021
10030
  /**
10022
10031
  * @private
@@ -10034,7 +10043,7 @@ const scrollableHorizontalGalleryStyles = {
10034
10043
  */
10035
10044
  const scrollableHorizontalGalleryContainerStyles = react.mergeStyles({
10036
10045
  display: 'flex',
10037
- width: `calc(100% - ${SMALL_FLOATING_MODAL_SIZE_PX.width}px)`,
10046
+ width: `calc(100% - ${SMALL_FLOATING_MODAL_SIZE_REM.width}rem)`,
10038
10047
  minHeight: `${SMALL_HORIZONTAL_GALLERY_TILE_SIZE_REM.height}rem`,
10039
10048
  overflow: 'scroll',
10040
10049
  '-ms-overflow-style': 'none',
@@ -10072,7 +10081,7 @@ const OverflowGallery = (props) => {
10072
10081
  /* @conditional-compile-remove(vertical-gallery) */
10073
10082
  isShort = false, overflowGalleryElements, horizontalGalleryStyles,
10074
10083
  /* @conditional-compile-remove(vertical-gallery) */ overflowGalleryLayout = 'HorizontalBottom',
10075
- /* @conditional-compile-remove(vertical-gallery) */ veritcalGalleryStyles } = props;
10084
+ /* @conditional-compile-remove(vertical-gallery) */ veritcalGalleryStyles, onChildrenPerPageChange } = props;
10076
10085
  const containerStyles = React.useMemo(() => {
10077
10086
  /* @conditional-compile-remove(vertical-gallery) */
10078
10087
  if (overflowGalleryLayout === 'VerticalRight') {
@@ -10100,13 +10109,16 @@ const OverflowGallery = (props) => {
10100
10109
  ]);
10101
10110
  /* @conditional-compile-remove(vertical-gallery) */
10102
10111
  if (overflowGalleryLayout === 'VerticalRight') {
10103
- return (React__default['default'].createElement(ResponsiveVerticalGallery, { key: "responsive-vertical-gallery", containerStyles: containerStyles, verticalGalleryStyles: galleryStyles, controlBarHeightRem: HORIZONTAL_GALLERY_BUTTON_WIDTH, gapHeightRem: HORIZONTAL_GALLERY_GAP, isShort: isShort, onFetchTilesToRender: onFetchTilesToRender }, overflowGalleryElements));
10112
+ return (React__default['default'].createElement(ResponsiveVerticalGallery, { key: "responsive-vertical-gallery", containerStyles: containerStyles, verticalGalleryStyles: galleryStyles, controlBarHeightRem: HORIZONTAL_GALLERY_BUTTON_WIDTH, gapHeightRem: HORIZONTAL_GALLERY_GAP, isShort: isShort, onFetchTilesToRender: onFetchTilesToRender, onChildrenPerPageChange: onChildrenPerPageChange }, overflowGalleryElements));
10104
10113
  }
10105
10114
  /* @conditional-compile-remove(pinned-participants) */
10106
10115
  if (isNarrow) {
10116
+ // There are no pages for ScrollableHorizontalGallery so we will approximate the first 3 remote
10117
+ // participant tiles are visible
10118
+ onChildrenPerPageChange === null || onChildrenPerPageChange === void 0 ? void 0 : onChildrenPerPageChange(3);
10107
10119
  return (React__default['default'].createElement(ScrollableHorizontalGallery, { horizontalGalleryElements: overflowGalleryElements, onFetchTilesToRender: onFetchTilesToRender, key: "scrollable-horizontal-gallery" }));
10108
10120
  }
10109
- return (React__default['default'].createElement(ResponsiveHorizontalGallery, { key: "responsive-horizontal-gallery", containerStyles: containerStyles, onFetchTilesToRender: onFetchTilesToRender, horizontalGalleryStyles: galleryStyles, childWidthRem: isNarrow ? SMALL_HORIZONTAL_GALLERY_TILE_SIZE_REM.width : LARGE_HORIZONTAL_GALLERY_TILE_SIZE_REM.width, buttonWidthRem: HORIZONTAL_GALLERY_BUTTON_WIDTH, gapWidthRem: HORIZONTAL_GALLERY_GAP }, overflowGalleryElements));
10121
+ return (React__default['default'].createElement(ResponsiveHorizontalGallery, { key: "responsive-horizontal-gallery", containerStyles: containerStyles, onFetchTilesToRender: onFetchTilesToRender, horizontalGalleryStyles: galleryStyles, buttonWidthRem: HORIZONTAL_GALLERY_BUTTON_WIDTH, gapWidthRem: HORIZONTAL_GALLERY_GAP, onChildrenPerPageChange: onChildrenPerPageChange }, overflowGalleryElements));
10110
10122
  };
10111
10123
 
10112
10124
  // Copyright (c) Microsoft Corporation.
@@ -10119,17 +10131,22 @@ const OverflowGallery = (props) => {
10119
10131
  const DefaultLayout = (props) => {
10120
10132
  const { remoteParticipants = [], dominantSpeakers, localVideoComponent, screenShareComponent, onRenderRemoteParticipant, styles, maxRemoteVideoStreams, parentWidth,
10121
10133
  /* @conditional-compile-remove(vertical-gallery) */
10122
- parentHeight,
10123
- /* @conditional-compile-remove(pinned-participants) */ pinnedParticipantUserIds,
10134
+ parentHeight, pinnedParticipantUserIds = [],
10124
10135
  /* @conditional-compile-remove(vertical-gallery) */ overflowGalleryLayout = 'HorizontalBottom' } = props;
10125
10136
  const isNarrow = parentWidth ? isNarrowWidth(parentWidth) : false;
10126
10137
  /* @conditional-compile-remove(vertical-gallery) */
10127
10138
  const isShort = parentHeight ? isShortHeight(parentHeight) : false;
10139
+ // This is for tracking the number of children in the first page of horizontal gallery.
10140
+ // This number will be used for the maxHorizontalDominantSpeakers when organizing the remote participants.
10141
+ const childrenPerPage = React.useRef(4);
10128
10142
  const { gridParticipants, horizontalGalleryParticipants } = useOrganizedParticipants({
10129
10143
  remoteParticipants,
10130
10144
  dominantSpeakers,
10131
10145
  maxRemoteVideoStreams,
10132
10146
  isScreenShareActive: !!screenShareComponent,
10147
+ maxHorizontalGalleryDominantSpeakers: screenShareComponent
10148
+ ? childrenPerPage.current - (pinnedParticipantUserIds.length % childrenPerPage.current)
10149
+ : childrenPerPage.current,
10133
10150
  /* @conditional-compile-remove(pinned-participants) */ pinnedParticipantUserIds
10134
10151
  });
10135
10152
  let activeVideoStreams = 0;
@@ -10168,7 +10185,9 @@ const DefaultLayout = (props) => {
10168
10185
  /* @conditional-compile-remove(vertical-gallery) */
10169
10186
  veritcalGalleryStyles: styles === null || styles === void 0 ? void 0 : styles.verticalGallery,
10170
10187
  /* @conditional-compile-remove(pinned-participants) */
10171
- overflowGalleryLayout: overflowGalleryLayout, onFetchTilesToRender: setIndexesToRender }));
10188
+ overflowGalleryLayout: overflowGalleryLayout, onFetchTilesToRender: setIndexesToRender, onChildrenPerPageChange: (n) => {
10189
+ childrenPerPage.current = n;
10190
+ } }));
10172
10191
  }, [
10173
10192
  isNarrow,
10174
10193
  /* @conditional-compile-remove(vertical-gallery) */ isShort,
@@ -10870,12 +10889,15 @@ const DRAG_OPTIONS$1 = {
10870
10889
  // This is a workaround for: https://github.com/microsoft/fluentui/issues/20122
10871
10890
  // Because our modal starts in the bottom right corner, we can say that this is the max (i.e. rightmost and bottomost)
10872
10891
  // position the modal can be dragged to.
10873
- const modalMaxDragPosition = { x: localVideoTileOuterPaddingPX, y: localVideoTileOuterPaddingPX };
10892
+ const modalMaxDragPosition = {
10893
+ x: _convertRemToPx(localVideoTileOuterPaddingRem),
10894
+ y: _convertRemToPx(localVideoTileOuterPaddingRem)
10895
+ };
10874
10896
  /**
10875
10897
  * @private
10876
10898
  */
10877
10899
  const FloatingLocalVideo = (props) => {
10878
- const { localVideoComponent, layerHostId, localVideoSize, parentWidth, parentHeight } = props;
10900
+ const { localVideoComponent, layerHostId, localVideoSizeRem, parentWidth, parentHeight } = props;
10879
10901
  const theme = useTheme();
10880
10902
  // The minimum drag position is the top left of the video gallery. i.e. the modal (PiP) should not be able
10881
10903
  // to be dragged offscreen and these are the top and left bounds of that calculation.
@@ -10883,11 +10905,11 @@ const FloatingLocalVideo = (props) => {
10883
10905
  ? {
10884
10906
  // We use -parentWidth/Height because our modal is positioned to start in the bottom right,
10885
10907
  // hence (0,0) is the bottom right of the video gallery.
10886
- x: -parentWidth + localVideoSize.width + localVideoTileOuterPaddingPX,
10887
- y: -parentHeight + localVideoSize.height + localVideoTileOuterPaddingPX
10908
+ x: -parentWidth + _convertRemToPx(localVideoSizeRem.width) + _convertRemToPx(localVideoTileOuterPaddingRem),
10909
+ y: -parentHeight + _convertRemToPx(localVideoSizeRem.height) + _convertRemToPx(localVideoTileOuterPaddingRem)
10888
10910
  }
10889
- : undefined, [parentHeight, parentWidth, localVideoSize.width, localVideoSize.height]);
10890
- const modalStyles = React.useMemo(() => floatingLocalVideoModalStyle(theme, localVideoSize), [theme, localVideoSize]);
10911
+ : undefined, [parentHeight, parentWidth, localVideoSizeRem.width, localVideoSizeRem.height]);
10912
+ const modalStyles = React.useMemo(() => floatingLocalVideoModalStyle(theme, localVideoSizeRem), [theme, localVideoSizeRem]);
10891
10913
  const layerProps = React.useMemo(() => ({ hostId: layerHostId }), [layerHostId]);
10892
10914
  return (React__default['default'].createElement(_ModalClone, { isOpen: true, isModeless: true, dragOptions: DRAG_OPTIONS$1, styles: modalStyles, layerProps: layerProps, maxDragPosition: modalMaxDragPosition, minDragPosition: modalMinDragPosition }, localVideoComponent));
10893
10915
  };
@@ -10928,18 +10950,23 @@ const layerHostStyle = {
10928
10950
  * @private
10929
10951
  */
10930
10952
  const FloatingLocalVideoLayout = (props) => {
10931
- const { remoteParticipants = [], dominantSpeakers, localVideoComponent, screenShareComponent, onRenderRemoteParticipant, styles, maxRemoteVideoStreams, showCameraSwitcherInLocalPreview, parentWidth, parentHeight,
10932
- /* @conditional-compile-remove(pinned-participants) */ pinnedParticipantUserIds,
10953
+ const { remoteParticipants = [], dominantSpeakers, localVideoComponent, screenShareComponent, onRenderRemoteParticipant, styles, maxRemoteVideoStreams, showCameraSwitcherInLocalPreview, parentWidth, parentHeight, pinnedParticipantUserIds = [],
10933
10954
  /* @conditional-compile-remove(vertical-gallery) */ overflowGalleryLayout = 'HorizontalBottom' } = props;
10934
10955
  const theme = useTheme();
10935
10956
  const isNarrow = parentWidth ? isNarrowWidth(parentWidth) : false;
10936
10957
  /* @conditional-compile-remove(vertical-gallery) */
10937
10958
  const isShort = parentHeight ? isShortHeight(parentHeight) : false;
10959
+ // This is for tracking the number of children in the first page of horizontal gallery.
10960
+ // This number will be used for the maxHorizontalDominantSpeakers when organizing the remote participants.
10961
+ const childrenPerPage = React.useRef(4);
10938
10962
  const { gridParticipants, horizontalGalleryParticipants } = useOrganizedParticipants({
10939
10963
  remoteParticipants,
10940
10964
  dominantSpeakers,
10941
10965
  maxRemoteVideoStreams,
10942
10966
  isScreenShareActive: !!screenShareComponent,
10967
+ maxHorizontalGalleryDominantSpeakers: screenShareComponent
10968
+ ? childrenPerPage.current - (pinnedParticipantUserIds.length % childrenPerPage.current)
10969
+ : childrenPerPage.current,
10943
10970
  /* @conditional-compile-remove(pinned-participants) */ pinnedParticipantUserIds
10944
10971
  });
10945
10972
  let activeVideoStreams = 0;
@@ -10970,19 +10997,19 @@ const FloatingLocalVideoLayout = (props) => {
10970
10997
  : (_b = p.videoStream) === null || _b === void 0 ? void 0 : _b.isAvailable);
10971
10998
  });
10972
10999
  const layerHostId = reactHooks.useId('layerhost');
10973
- const localVideoSize = React.useMemo(() => {
11000
+ const localVideoSizeRem = React.useMemo(() => {
10974
11001
  if (isNarrow) {
10975
- return SMALL_FLOATING_MODAL_SIZE_PX;
11002
+ return SMALL_FLOATING_MODAL_SIZE_REM;
10976
11003
  }
10977
11004
  /* @conditional-compile-remove(vertical-gallery) */
10978
11005
  if ((horizontalGalleryTiles.length > 0 || !!screenShareComponent) && overflowGalleryLayout === 'VerticalRight') {
10979
11006
  return isNarrow
10980
- ? SMALL_FLOATING_MODAL_SIZE_PX
11007
+ ? SMALL_FLOATING_MODAL_SIZE_REM
10981
11008
  : isShort
10982
- ? SHORT_VERTICAL_GALLERY_FLOATING_MODAL_SIZE_PX
10983
- : VERTICAL_GALLERY_FLOATING_MODAL_SIZE_PX;
11009
+ ? SHORT_VERTICAL_GALLERY_FLOATING_MODAL_SIZE_REM
11010
+ : VERTICAL_GALLERY_FLOATING_MODAL_SIZE_REM;
10984
11011
  }
10985
- return LARGE_FLOATING_MODAL_SIZE_PX;
11012
+ return LARGE_FLOATING_MODAL_SIZE_REM;
10986
11013
  }, [
10987
11014
  horizontalGalleryTiles.length,
10988
11015
  isNarrow,
@@ -10992,10 +11019,10 @@ const FloatingLocalVideoLayout = (props) => {
10992
11019
  ]);
10993
11020
  const wrappedLocalVideoComponent = localVideoComponent && shouldFloatLocalVideo ? (
10994
11021
  // When we use showCameraSwitcherInLocalPreview it disables dragging to allow keyboard navigation.
10995
- showCameraSwitcherInLocalPreview ? (React__default['default'].createElement(react.Stack, { className: react.mergeStyles(localVideoTileWithControlsContainerStyle(theme, localVideoSize), {
11022
+ showCameraSwitcherInLocalPreview ? (React__default['default'].createElement(react.Stack, { className: react.mergeStyles(localVideoTileWithControlsContainerStyle(theme, localVideoSizeRem), {
10996
11023
  boxShadow: theme.effects.elevation8,
10997
11024
  zIndex: LOCAL_VIDEO_TILE_ZINDEX
10998
- }) }, localVideoComponent)) : horizontalGalleryTiles.length > 0 || !!screenShareComponent ? (React__default['default'].createElement(react.Stack, { className: react.mergeStyles(localVideoTileContainerStyle(theme, localVideoSize)) }, localVideoComponent)) : (React__default['default'].createElement(FloatingLocalVideo, { localVideoComponent: localVideoComponent, layerHostId: layerHostId, localVideoSize: localVideoSize, parentWidth: parentWidth, parentHeight: parentHeight }))) : undefined;
11025
+ }) }, localVideoComponent)) : horizontalGalleryTiles.length > 0 || !!screenShareComponent ? (React__default['default'].createElement(react.Stack, { className: react.mergeStyles(localVideoTileContainerStyle(theme, localVideoSizeRem)) }, localVideoComponent)) : (React__default['default'].createElement(FloatingLocalVideo, { localVideoComponent: localVideoComponent, layerHostId: layerHostId, localVideoSizeRem: localVideoSizeRem, parentWidth: parentWidth, parentHeight: parentHeight }))) : undefined;
10999
11026
  const overflowGallery = React.useMemo(() => {
11000
11027
  if (horizontalGalleryTiles.length === 0 && !screenShareComponent) {
11001
11028
  return null;
@@ -11008,7 +11035,9 @@ const FloatingLocalVideoLayout = (props) => {
11008
11035
  /* @conditional-compile-remove(vertical-gallery) */
11009
11036
  veritcalGalleryStyles: styles === null || styles === void 0 ? void 0 : styles.verticalGallery,
11010
11037
  /* @conditional-compile-remove(vertical-gallery) */
11011
- overflowGalleryLayout: overflowGalleryLayout }));
11038
+ overflowGalleryLayout: overflowGalleryLayout, onChildrenPerPageChange: (n) => {
11039
+ childrenPerPage.current = n;
11040
+ } }));
11012
11041
  }, [
11013
11042
  isNarrow,
11014
11043
  /* @conditional-compile-remove(vertical-gallery) */ isShort,