@stream-io/video-react-sdk 0.4.26 → 0.5.0

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 (91) hide show
  1. package/CHANGELOG.md +297 -238
  2. package/README.md +5 -5
  3. package/dist/css/styles.css +952 -481
  4. package/dist/css/styles.css.map +1 -1
  5. package/dist/index.cjs.js +946 -639
  6. package/dist/index.cjs.js.map +1 -1
  7. package/dist/index.es.js +939 -639
  8. package/dist/index.es.js.map +1 -1
  9. package/dist/src/components/Button/CompositeButton.d.ts +9 -11
  10. package/dist/src/components/Button/index.d.ts +0 -1
  11. package/dist/src/components/CallControls/CallStatsButton.d.ts +3 -0
  12. package/dist/src/components/CallControls/CancelCallButton.d.ts +1 -0
  13. package/dist/src/components/CallControls/ReactionsButton.d.ts +2 -1
  14. package/dist/src/components/CallControls/RecordCallButton.d.ts +4 -1
  15. package/dist/src/components/CallControls/ToggleAudioButton.d.ts +3 -9
  16. package/dist/src/components/CallControls/ToggleAudioOutputButton.d.ts +2 -5
  17. package/dist/src/components/CallControls/ToggleVideoButton.d.ts +3 -9
  18. package/dist/src/components/CallParticipantsList/CallParticipantListHeader.d.ts +3 -1
  19. package/dist/src/components/CallParticipantsList/CallParticipantListingItem.d.ts +0 -5
  20. package/dist/src/components/CallStats/CallStats.d.ts +25 -2
  21. package/dist/src/components/DeviceSettings/DeviceSelector.d.ts +6 -1
  22. package/dist/src/components/DeviceSettings/DeviceSelectorAudio.d.ts +4 -2
  23. package/dist/src/components/DeviceSettings/DeviceSelectorVideo.d.ts +2 -1
  24. package/dist/src/components/DeviceSettings/DeviceSettings.d.ts +5 -1
  25. package/dist/src/components/DropdownSelect/DropdownSelect.d.ts +14 -0
  26. package/dist/src/components/DropdownSelect/index.d.ts +1 -0
  27. package/dist/src/components/Icon/Icon.d.ts +2 -1
  28. package/dist/src/components/Menu/GenericMenu.d.ts +4 -2
  29. package/dist/src/components/Menu/MenuToggle.d.ts +15 -2
  30. package/dist/src/components/Notification/Notification.d.ts +1 -0
  31. package/dist/src/components/Notification/RecordingInProgressNotification.d.ts +5 -0
  32. package/dist/src/components/Notification/SpeakingWhileMutedNotification.d.ts +3 -1
  33. package/dist/src/components/Notification/index.d.ts +1 -0
  34. package/dist/src/components/index.d.ts +2 -0
  35. package/dist/src/core/components/ParticipantView/DefaultParticipantViewUI.d.ts +7 -1
  36. package/dist/src/core/components/ParticipantView/ParticipantActionsContextMenu.d.ts +1 -0
  37. package/dist/src/core/components/ParticipantView/ParticipantViewContext.d.ts +3 -3
  38. package/dist/src/core/components/ParticipantView/index.d.ts +1 -0
  39. package/dist/src/hooks/useFloatingUIPreset.d.ts +4 -1
  40. package/dist/src/translations/index.d.ts +9 -0
  41. package/package.json +7 -9
  42. package/src/components/Button/CompositeButton.tsx +78 -26
  43. package/src/components/Button/IconButton.tsx +22 -21
  44. package/src/components/Button/index.ts +0 -1
  45. package/src/components/CallControls/AcceptCallButton.tsx +1 -0
  46. package/src/components/CallControls/CallControls.tsx +2 -2
  47. package/src/components/CallControls/CallStatsButton.tsx +24 -7
  48. package/src/components/CallControls/CancelCallButton.tsx +102 -3
  49. package/src/components/CallControls/ReactionsButton.tsx +37 -17
  50. package/src/components/CallControls/RecordCallButton.tsx +131 -21
  51. package/src/components/CallControls/ScreenShareButton.tsx +29 -15
  52. package/src/components/CallControls/ToggleAudioButton.tsx +76 -31
  53. package/src/components/CallControls/ToggleAudioOutputButton.tsx +14 -10
  54. package/src/components/CallControls/ToggleVideoButton.tsx +83 -33
  55. package/src/components/CallParticipantsList/CallParticipantListHeader.tsx +9 -6
  56. package/src/components/CallParticipantsList/CallParticipantListingItem.tsx +17 -281
  57. package/src/components/CallParticipantsList/CallParticipantsList.tsx +2 -32
  58. package/src/components/CallRecordingList/CallRecordingList.tsx +24 -6
  59. package/src/components/CallRecordingList/CallRecordingListHeader.tsx +6 -2
  60. package/src/components/CallRecordingList/CallRecordingListItem.tsx +18 -41
  61. package/src/components/CallStats/CallStats.tsx +167 -10
  62. package/src/components/CallStats/CallStatsLatencyChart.tsx +73 -44
  63. package/src/components/DeviceSettings/DeviceSelector.tsx +107 -12
  64. package/src/components/DeviceSettings/DeviceSelectorAudio.tsx +13 -5
  65. package/src/components/DeviceSettings/DeviceSelectorVideo.tsx +10 -4
  66. package/src/components/DeviceSettings/DeviceSettings.tsx +40 -28
  67. package/src/components/DropdownSelect/DropdownSelect.tsx +214 -0
  68. package/src/components/DropdownSelect/index.ts +1 -0
  69. package/src/components/Icon/Icon.tsx +7 -2
  70. package/src/components/Menu/GenericMenu.tsx +25 -3
  71. package/src/components/Menu/MenuToggle.tsx +79 -14
  72. package/src/components/Notification/Notification.tsx +8 -0
  73. package/src/components/Notification/PermissionNotification.tsx +2 -1
  74. package/src/components/Notification/RecordingInProgressNotification.tsx +40 -0
  75. package/src/components/Notification/SpeakingWhileMutedNotification.tsx +9 -1
  76. package/src/components/Notification/index.ts +1 -0
  77. package/src/components/Permissions/PermissionRequests.tsx +9 -21
  78. package/src/components/Search/hooks/useSearch.ts +5 -1
  79. package/src/components/index.ts +2 -0
  80. package/src/core/components/ParticipantView/DefaultParticipantViewUI.tsx +71 -57
  81. package/src/core/components/ParticipantView/ParticipantActionsContextMenu.tsx +241 -0
  82. package/src/core/components/ParticipantView/ParticipantView.tsx +2 -2
  83. package/src/core/components/ParticipantView/ParticipantViewContext.tsx +3 -3
  84. package/src/core/components/ParticipantView/index.ts +1 -0
  85. package/src/core/components/Video/BaseVideo.tsx +1 -1
  86. package/src/core/components/Video/DefaultVideoPlaceholder.tsx +19 -5
  87. package/src/hooks/useFloatingUIPreset.ts +3 -2
  88. package/src/hooks/useRequestPermission.ts +2 -1
  89. package/src/translations/en.json +9 -0
  90. package/dist/src/components/Button/CopyToClipboardButton.d.ts +0 -27
  91. package/src/components/Button/CopyToClipboardButton.tsx +0 -129
@@ -1,16 +1,14 @@
1
- import { ComponentType, PropsWithChildren } from 'react';
1
+ import { ToggleMenuButtonProps } from '../Menu';
2
+ import { ComponentProps, ComponentType, JSX, PropsWithChildren } from 'react';
2
3
  import { Placement } from '@floating-ui/react';
3
- export type IconButtonWithMenuProps = PropsWithChildren<{
4
+ export type IconButtonWithMenuProps<E extends HTMLElement = HTMLButtonElement> = PropsWithChildren<{
4
5
  active?: boolean;
5
6
  Menu?: ComponentType | JSX.Element;
6
7
  caption?: string;
8
+ className?: string;
7
9
  menuPlacement?: Placement;
8
- }>;
9
- export declare const CompositeButton: import("react").ForwardRefExoticComponent<{
10
- active?: boolean | undefined;
11
- Menu?: JSX.Element | ComponentType | undefined;
12
- caption?: string | undefined;
13
- menuPlacement?: Placement | undefined;
14
- } & {
15
- children?: import("react").ReactNode;
16
- } & import("react").RefAttributes<HTMLDivElement>>;
10
+ menuOffset?: number;
11
+ ToggleMenuButton?: ComponentType<ToggleMenuButtonProps<E>>;
12
+ variant?: 'primary' | 'secondary';
13
+ }> & ComponentProps<'button'>;
14
+ export declare const CompositeButton: import("react").ForwardRefExoticComponent<Omit<IconButtonWithMenuProps<HTMLButtonElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
@@ -1,4 +1,3 @@
1
1
  export * from './CompositeButton';
2
- export * from './CopyToClipboardButton';
3
2
  export * from './IconButton';
4
3
  export * from './TextButton';
@@ -1 +1,4 @@
1
+ export type CallStatsButtonProps = {
2
+ caption?: string;
3
+ };
1
4
  export declare const CallStatsButton: () => import("react/jsx-runtime").JSX.Element;
@@ -4,4 +4,5 @@ export type CancelCallButtonProps = {
4
4
  onClick?: MouseEventHandler<HTMLButtonElement>;
5
5
  onLeave?: () => void;
6
6
  };
7
+ export declare const CancelCallConfirmButton: ({ onClick, onLeave, }: CancelCallButtonProps) => import("react/jsx-runtime").JSX.Element;
7
8
  export declare const CancelCallButton: ({ disabled, onClick, onLeave, }: CancelCallButtonProps) => import("react/jsx-runtime").JSX.Element;
@@ -6,5 +6,6 @@ export interface ReactionsButtonProps {
6
6
  export declare const ReactionsButton: ({ reactions, }: ReactionsButtonProps) => import("react/jsx-runtime").JSX.Element;
7
7
  export interface DefaultReactionsMenuProps {
8
8
  reactions: StreamReaction[];
9
+ layout?: 'horizontal' | 'vertical';
9
10
  }
10
- export declare const DefaultReactionsMenu: ({ reactions, }: DefaultReactionsMenuProps) => import("react/jsx-runtime").JSX.Element;
11
+ export declare const DefaultReactionsMenu: ({ reactions, layout, }: DefaultReactionsMenuProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,7 @@
1
1
  export type RecordCallButtonProps = {
2
2
  caption?: string;
3
3
  };
4
- export declare const RecordCallButton: ({ caption, }: RecordCallButtonProps) => import("react/jsx-runtime").JSX.Element;
4
+ export declare const RecordCallConfirmationButton: ({ caption, }: {
5
+ caption?: string | undefined;
6
+ }) => import("react/jsx-runtime").JSX.Element;
7
+ export declare const RecordCallButton: ({ caption }: RecordCallButtonProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,11 +1,5 @@
1
- import { ComponentType } from 'react';
2
- export type ToggleAudioPreviewButtonProps = {
3
- caption?: string;
4
- Menu?: ComponentType;
5
- };
1
+ import { IconButtonWithMenuProps } from '../Button';
2
+ export type ToggleAudioPreviewButtonProps = Pick<IconButtonWithMenuProps, 'caption' | 'Menu' | 'menuPlacement'>;
6
3
  export declare const ToggleAudioPreviewButton: (props: ToggleAudioPreviewButtonProps) => import("react/jsx-runtime").JSX.Element;
7
- export type ToggleAudioPublishingButtonProps = {
8
- caption?: string;
9
- Menu?: ComponentType;
10
- };
4
+ export type ToggleAudioPublishingButtonProps = Pick<IconButtonWithMenuProps, 'caption' | 'Menu' | 'menuPlacement'>;
11
5
  export declare const ToggleAudioPublishingButton: (props: ToggleAudioPublishingButtonProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,3 @@
1
- import { ComponentType } from 'react';
2
- export type ToggleAudioOutputButtonProps = {
3
- caption?: string;
4
- Menu?: ComponentType;
5
- };
1
+ import { IconButtonWithMenuProps } from '../Button';
2
+ export type ToggleAudioOutputButtonProps = Pick<IconButtonWithMenuProps, 'caption' | 'Menu' | 'menuPlacement'>;
6
3
  export declare const ToggleAudioOutputButton: (props: ToggleAudioOutputButtonProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,12 +1,6 @@
1
- import { ComponentType } from 'react';
2
- export type ToggleVideoPreviewButtonProps = {
3
- caption?: string;
4
- Menu?: ComponentType;
5
- };
1
+ import { IconButtonWithMenuProps } from '../Button/';
2
+ export type ToggleVideoPreviewButtonProps = Pick<IconButtonWithMenuProps, 'caption' | 'Menu' | 'menuPlacement'>;
6
3
  export declare const ToggleVideoPreviewButton: (props: ToggleVideoPreviewButtonProps) => import("react/jsx-runtime").JSX.Element;
7
- type ToggleVideoPublishingButtonProps = {
8
- caption?: string;
9
- Menu?: ComponentType;
10
- };
4
+ type ToggleVideoPublishingButtonProps = Pick<IconButtonWithMenuProps, 'caption' | 'Menu' | 'menuPlacement'>;
11
5
  export declare const ToggleVideoPublishingButton: (props: ToggleVideoPublishingButtonProps) => import("react/jsx-runtime").JSX.Element;
12
6
  export {};
@@ -1,5 +1,7 @@
1
1
  export type CallParticipantListHeaderProps = {
2
- /** Click event listener function to be invoked in order to dismiss / hide the CallParticipantsList from the UI */
2
+ /**
3
+ * Click event listener function to be invoked to dismiss / hide the CallParticipantsList from the UI.
4
+ */
3
5
  onClose: () => void;
4
6
  };
5
7
  export declare const CallParticipantListHeader: ({ onClose, }: CallParticipantListHeaderProps) => import("react/jsx-runtime").JSX.Element;
@@ -9,9 +9,4 @@ type CallParticipantListingItemProps = {
9
9
  }>;
10
10
  };
11
11
  export declare const CallParticipantListingItem: ({ participant, DisplayName, }: CallParticipantListingItemProps) => import("react/jsx-runtime").JSX.Element;
12
- export declare const ParticipantActionsContextMenu: ({ participant, participantViewElement, videoElement, }: {
13
- participant: StreamVideoParticipant;
14
- participantViewElement?: HTMLDivElement | null | undefined;
15
- videoElement?: HTMLVideoElement | null | undefined;
16
- }) => import("react/jsx-runtime").JSX.Element;
17
12
  export {};
@@ -1,5 +1,28 @@
1
- export declare const CallStats: () => import("react/jsx-runtime").JSX.Element;
1
+ import { ReactNode } from 'react';
2
+ export declare enum Statuses {
3
+ GOOD = "Good",
4
+ OK = "Ok",
5
+ BAD = "Bad"
6
+ }
7
+ export type Status = Statuses.GOOD | Statuses.OK | Statuses.BAD;
8
+ export declare const CallStats: (props: {
9
+ latencyLowBound?: number;
10
+ latencyHighBound?: number;
11
+ }) => import("react/jsx-runtime").JSX.Element;
12
+ export declare const StatCardExplanation: (props: {
13
+ description: string;
14
+ }) => import("react/jsx-runtime").JSX.Element;
15
+ export declare const StatsTag: ({ children, status, }: {
16
+ children: ReactNode;
17
+ status: Statuses.GOOD | Statuses.OK | Statuses.BAD;
18
+ }) => import("react/jsx-runtime").JSX.Element;
2
19
  export declare const StatCard: (props: {
3
20
  label: string;
4
- value: string;
21
+ value: string | ReactNode;
22
+ description?: string;
23
+ comparison?: {
24
+ value: number;
25
+ highBound: number;
26
+ lowBound: number;
27
+ };
5
28
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,11 @@
1
+ export type DeviceSelectorType = 'audioinput' | 'audiooutput' | 'videoinput';
1
2
  export declare const DeviceSelector: (props: {
2
3
  devices: MediaDeviceInfo[];
4
+ icon: string;
5
+ type: DeviceSelectorType;
3
6
  selectedDeviceId?: string | undefined;
4
- title: string;
7
+ title?: string | undefined;
5
8
  onChange?: ((deviceId: string) => void) | undefined;
9
+ visualType?: "list" | "dropdown" | undefined;
10
+ placeholder?: string | undefined;
6
11
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1,8 +1,10 @@
1
1
  export type DeviceSelectorAudioInputProps = {
2
2
  title?: string;
3
+ visualType?: 'list' | 'dropdown';
3
4
  };
4
- export declare const DeviceSelectorAudioInput: ({ title, }: DeviceSelectorAudioInputProps) => import("react/jsx-runtime").JSX.Element;
5
+ export declare const DeviceSelectorAudioInput: ({ title, visualType, }: DeviceSelectorAudioInputProps) => import("react/jsx-runtime").JSX.Element;
5
6
  export type DeviceSelectorAudioOutputProps = {
6
7
  title?: string;
8
+ visualType?: 'list' | 'dropdown';
7
9
  };
8
- export declare const DeviceSelectorAudioOutput: ({ title, }: DeviceSelectorAudioOutputProps) => import("react/jsx-runtime").JSX.Element | null;
10
+ export declare const DeviceSelectorAudioOutput: ({ title, visualType, }: DeviceSelectorAudioOutputProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -1,4 +1,5 @@
1
1
  export type DeviceSelectorVideoProps = {
2
2
  title?: string;
3
+ visualType?: 'list' | 'dropdown';
3
4
  };
4
- export declare const DeviceSelectorVideo: ({ title }: DeviceSelectorVideoProps) => import("react/jsx-runtime").JSX.Element;
5
+ export declare const DeviceSelectorVideo: ({ title, visualType, }: DeviceSelectorVideoProps) => import("react/jsx-runtime").JSX.Element;
@@ -1 +1,5 @@
1
- export declare const DeviceSettings: () => import("react/jsx-runtime").JSX.Element;
1
+ import { MenuVisualType } from '../Menu';
2
+ export type DeviceSettingsProps = {
3
+ visualType?: MenuVisualType;
4
+ };
5
+ export declare const DeviceSettings: ({ visualType, }: DeviceSettingsProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,14 @@
1
+ import { ReactElement } from 'react';
2
+ export type DropDownSelectOptionProps = {
3
+ label: string;
4
+ selected?: boolean;
5
+ icon: string;
6
+ };
7
+ export declare const DropDownSelectOption: (props: DropDownSelectOptionProps) => import("react/jsx-runtime").JSX.Element;
8
+ export declare const DropDownSelect: (props: {
9
+ icon?: string | undefined;
10
+ defaultSelectedLabel: string;
11
+ defaultSelectedIndex: number;
12
+ handleSelect: (index: number) => void;
13
+ children: ReactElement<DropDownSelectOptionProps> | ReactElement<DropDownSelectOptionProps>[];
14
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export * from './DropdownSelect';
@@ -1,4 +1,5 @@
1
1
  export type IconProps = {
2
2
  icon: string;
3
+ className?: string;
3
4
  };
4
- export declare const Icon: ({ icon }: IconProps) => import("react/jsx-runtime").JSX.Element;
5
+ export declare const Icon: ({ className, icon }: IconProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,3 +1,5 @@
1
- import { ComponentProps, PropsWithChildren } from 'react';
2
- export declare const GenericMenu: ({ children }: PropsWithChildren) => import("react/jsx-runtime").JSX.Element;
1
+ import { ComponentProps, MouseEvent, PropsWithChildren } from 'react';
2
+ export declare const GenericMenu: ({ children, onItemClick, }: PropsWithChildren<{
3
+ onItemClick?: ((e: MouseEvent) => void) | undefined;
4
+ }>) => import("react/jsx-runtime").JSX.Element;
3
5
  export declare const GenericMenuButtonItem: ({ children, ...rest }: Omit<ComponentProps<'button'>, 'ref'>) => import("react/jsx-runtime").JSX.Element;
@@ -1,12 +1,25 @@
1
- import { ComponentType, PropsWithChildren, ForwardedRef } from 'react';
1
+ import { ComponentType, ForwardedRef, PropsWithChildren } from 'react';
2
2
  import { Placement, Strategy } from '@floating-ui/react';
3
3
  export type ToggleMenuButtonProps<E extends HTMLElement = HTMLButtonElement> = {
4
4
  menuShown: boolean;
5
5
  ref: ForwardedRef<E>;
6
6
  };
7
+ export declare enum MenuVisualType {
8
+ PORTAL = "portal",
9
+ MENU = "menu"
10
+ }
7
11
  export type MenuToggleProps<E extends HTMLElement> = PropsWithChildren<{
8
12
  ToggleButton: ComponentType<ToggleMenuButtonProps<E>>;
9
13
  placement?: Placement;
10
14
  strategy?: Strategy;
15
+ offset?: number;
16
+ visualType?: MenuVisualType;
11
17
  }>;
12
- export declare const MenuToggle: <E extends HTMLElement>({ ToggleButton, placement, strategy, children, }: MenuToggleProps<E>) => import("react/jsx-runtime").JSX.Element;
18
+ export type MenuContextValue = {
19
+ close?: () => void;
20
+ };
21
+ /**
22
+ * Access to the closes MenuContext.
23
+ */
24
+ export declare const useMenuContext: () => MenuContextValue;
25
+ export declare const MenuToggle: <E extends HTMLElement>({ ToggleButton, placement, strategy, offset, visualType, children, }: MenuToggleProps<E>) => import("react/jsx-runtime").JSX.Element;
@@ -7,5 +7,6 @@ export type NotificationProps = {
7
7
  resetIsVisible?: () => void;
8
8
  placement?: Placement;
9
9
  iconClassName?: string | null;
10
+ close?: () => void;
10
11
  };
11
12
  export declare const Notification: (props: PropsWithChildren<NotificationProps>) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { PropsWithChildren } from 'react';
2
+ export type RecordingInProgressNotificationProps = {
3
+ text?: string;
4
+ };
5
+ export declare const RecordingInProgressNotification: ({ children, text, }: PropsWithChildren<RecordingInProgressNotificationProps>) => import("react/jsx-runtime").JSX.Element;
@@ -1,8 +1,10 @@
1
1
  import { PropsWithChildren } from 'react';
2
+ import { Placement } from '@floating-ui/react';
2
3
  export type SpeakingWhileMutedNotificationProps = {
3
4
  /**
4
5
  * Text message displayed by the notification.
5
6
  */
6
7
  text?: string;
8
+ placement?: Placement;
7
9
  };
8
- export declare const SpeakingWhileMutedNotification: ({ children, text, }: PropsWithChildren<SpeakingWhileMutedNotificationProps>) => import("react/jsx-runtime").JSX.Element;
10
+ export declare const SpeakingWhileMutedNotification: ({ children, text, placement, }: PropsWithChildren<SpeakingWhileMutedNotificationProps>) => import("react/jsx-runtime").JSX.Element;
@@ -1,3 +1,4 @@
1
1
  export * from './Notification';
2
2
  export * from './PermissionNotification';
3
3
  export * from './SpeakingWhileMutedNotification';
4
+ export * from './RecordingInProgressNotification';
@@ -3,9 +3,11 @@ export * from './Button';
3
3
  export * from './CallControls';
4
4
  export * from './CallParticipantsList';
5
5
  export * from './CallPreview';
6
+ export * from './CallStats';
6
7
  export * from './CallRecordingList';
7
8
  export * from './CallStats';
8
9
  export * from './DeviceSettings';
10
+ export * from './DropdownSelect';
9
11
  export * from './Icon';
10
12
  export * from './LoadingIndicator';
11
13
  export * from './Menu';
@@ -1,3 +1,4 @@
1
+ import { ComponentType } from 'react';
1
2
  import { Placement } from '@floating-ui/react';
2
3
  export type DefaultParticipantViewUIProps = {
3
4
  /**
@@ -12,7 +13,12 @@ export type DefaultParticipantViewUIProps = {
12
13
  * Option to show/hide menu button component
13
14
  */
14
15
  showMenuButton?: boolean;
16
+ /**
17
+ * Custom component to render the context menu
18
+ */
19
+ ParticipantActionsContextMenu?: ComponentType;
15
20
  };
16
21
  export declare const DefaultScreenShareOverlay: () => import("react/jsx-runtime").JSX.Element;
17
- export declare const DefaultParticipantViewUI: ({ indicatorsVisible, menuPlacement, showMenuButton, }: DefaultParticipantViewUIProps) => import("react/jsx-runtime").JSX.Element;
22
+ export declare const DefaultParticipantViewUI: ({ indicatorsVisible, menuPlacement, showMenuButton, ParticipantActionsContextMenu, }: DefaultParticipantViewUIProps) => import("react/jsx-runtime").JSX.Element;
18
23
  export declare const ParticipantDetails: ({ indicatorsVisible, }: Pick<DefaultParticipantViewUIProps, 'indicatorsVisible'>) => import("react/jsx-runtime").JSX.Element;
24
+ export declare const SpeechIndicator: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const ParticipantActionsContextMenu: () => import("react/jsx-runtime").JSX.Element;
@@ -1,9 +1,9 @@
1
1
  /// <reference types="react" />
2
2
  import { ParticipantViewProps } from './ParticipantView';
3
3
  export type ParticipantViewContextValue = Required<Pick<ParticipantViewProps, 'participant' | 'trackType'>> & {
4
- participantViewElement: HTMLDivElement | null;
5
- videoElement: HTMLVideoElement | null;
6
- videoPlaceholderElement: HTMLDivElement | null;
4
+ participantViewElement?: HTMLDivElement | null;
5
+ videoElement?: HTMLVideoElement | null;
6
+ videoPlaceholderElement?: HTMLDivElement | null;
7
7
  };
8
8
  export declare const ParticipantViewContext: import("react").Context<ParticipantViewContextValue | undefined>;
9
9
  export declare const useParticipantViewContext: () => ParticipantViewContextValue;
@@ -1,3 +1,4 @@
1
+ export * from './ParticipantActionsContextMenu';
1
2
  export * from './ParticipantView';
2
3
  export * from './ParticipantViewContext';
3
4
  export * from './DefaultParticipantViewUI';
@@ -1,6 +1,9 @@
1
1
  /// <reference types="react" />
2
2
  import type { UseFloatingData } from '@floating-ui/react';
3
- export declare const useFloatingUIPreset: ({ placement, strategy, }: Pick<UseFloatingData, 'placement' | 'strategy'>) => {
3
+ import { offset } from '@floating-ui/react';
4
+ export declare const useFloatingUIPreset: ({ placement, strategy, offset: offsetInPx, }: Pick<UseFloatingData, 'placement' | 'strategy'> & {
5
+ offset?: number;
6
+ }) => {
4
7
  refs: {
5
8
  reference: import("react").MutableRefObject<import("@floating-ui/react-dom").ReferenceType | null>;
6
9
  floating: import("react").MutableRefObject<HTMLElement | null>;
@@ -23,6 +23,7 @@ export declare const translations: {
23
23
  "Waiting for recording to start...": string;
24
24
  "Record call": string;
25
25
  Reactions: string;
26
+ Statistics: string;
26
27
  "You can now share your screen.": string;
27
28
  "Awaiting for an approval to share screen.": string;
28
29
  "You can no longer share your screen.": string;
@@ -36,6 +37,12 @@ export declare const translations: {
36
37
  Me: string;
37
38
  Unknown: string;
38
39
  "Toggle device menu": string;
40
+ "Call Recordings": string;
41
+ Refresh: string;
42
+ "Check your browser video permissions": string;
43
+ "Video publishing is disabled by the system": string;
44
+ "You have no permission to share your video": string;
45
+ "You have no permission to share your audio": string;
39
46
  "You are presenting your screen": string;
40
47
  "Stop Screen Sharing": string;
41
48
  Allow: string;
@@ -65,6 +72,8 @@ export declare const translations: {
65
72
  "Disable screen sharing": string;
66
73
  Enter: string;
67
74
  Leave: string;
75
+ "Leave call": string;
76
+ "End call for all": string;
68
77
  "{{ direction }} fullscreen": string;
69
78
  "{{ direction }} picture-in-picture": string;
70
79
  "Dominant Speaker": string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stream-io/video-react-sdk",
3
- "version": "0.4.26",
3
+ "version": "0.5.0",
4
4
  "packageManager": "yarn@3.2.4",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.es.js",
@@ -28,13 +28,12 @@
28
28
  "CHANGELOG.md"
29
29
  ],
30
30
  "dependencies": {
31
- "@floating-ui/react": "^0.26.1",
32
- "@nivo/core": "^0.80.0",
33
- "@nivo/line": "^0.80.0",
34
- "@stream-io/video-client": "^0.5.11",
35
- "@stream-io/video-react-bindings": "^0.3.22",
31
+ "@floating-ui/react": "^0.26.5",
32
+ "@stream-io/video-client": "^0.6.0",
33
+ "@stream-io/video-react-bindings": "^0.4.0",
34
+ "chart.js": "^4.4.1",
36
35
  "clsx": "^2.0.0",
37
- "prop-types": "^15.8.1"
36
+ "react-chartjs-2": "^5.2.0"
38
37
  },
39
38
  "peerDependencies": {
40
39
  "react": "^18.0.0",
@@ -44,8 +43,7 @@
44
43
  "@rollup/plugin-json": "^6.0.1",
45
44
  "@rollup/plugin-replace": "^5.0.4",
46
45
  "@rollup/plugin-typescript": "^11.1.5",
47
- "@stream-io/video-styling": "^0.1.14",
48
- "@types/prop-types": "^15.7.8",
46
+ "@stream-io/video-styling": "^0.2.0",
49
47
  "react": "^18.2.0",
50
48
  "react-dom": "^18.2.0",
51
49
  "rimraf": "^5.0.5",
@@ -1,33 +1,85 @@
1
1
  import clsx from 'clsx';
2
2
  import { MenuToggle, ToggleMenuButtonProps } from '../Menu';
3
- import { ComponentType, forwardRef, PropsWithChildren } from 'react';
4
- import { useI18n } from '@stream-io/video-react-bindings';
3
+ import {
4
+ ComponentProps,
5
+ ComponentType,
6
+ forwardRef,
7
+ JSX,
8
+ PropsWithChildren,
9
+ } from 'react';
5
10
  import { Placement } from '@floating-ui/react';
6
11
 
7
12
  import { IconButton } from './IconButton';
8
13
  import { isComponentType } from '../../utilities';
9
14
 
10
- export type IconButtonWithMenuProps = PropsWithChildren<{
11
- active?: boolean;
12
- Menu?: ComponentType | JSX.Element;
13
- caption?: string;
14
- menuPlacement?: Placement;
15
- }>;
15
+ export type IconButtonWithMenuProps<E extends HTMLElement = HTMLButtonElement> =
16
+ PropsWithChildren<{
17
+ active?: boolean;
18
+ Menu?: ComponentType | JSX.Element;
19
+ caption?: string;
20
+ className?: string;
21
+ menuPlacement?: Placement;
22
+ menuOffset?: number;
23
+ ToggleMenuButton?: ComponentType<ToggleMenuButtonProps<E>>;
24
+ variant?: 'primary' | 'secondary';
25
+ }> &
26
+ ComponentProps<'button'>;
16
27
 
17
28
  export const CompositeButton = forwardRef<
18
29
  HTMLDivElement,
19
30
  IconButtonWithMenuProps
20
- >(({ caption, children, active, Menu, menuPlacement }, ref) => {
31
+ >(function CompositeButton(
32
+ {
33
+ caption,
34
+ children,
35
+ className,
36
+ active,
37
+ Menu,
38
+ menuPlacement,
39
+ menuOffset,
40
+ title,
41
+ ToggleMenuButton = DefaultToggleMenuButton,
42
+ variant,
43
+ onClick,
44
+ ...restButtonProps
45
+ },
46
+ ref,
47
+ ) {
21
48
  return (
22
- <div className="str-video__composite-button" ref={ref}>
49
+ <div
50
+ className={clsx('str-video__composite-button', className, {
51
+ 'str-video__composite-button--caption': caption,
52
+ 'str-video__composite-button--menu': Menu,
53
+ })}
54
+ title={title}
55
+ ref={ref}
56
+ >
23
57
  <div
24
58
  className={clsx('str-video__composite-button__button-group', {
25
59
  'str-video__composite-button__button-group--active': active,
60
+ 'str-video__composite-button__button-group--active-primary':
61
+ active && variant === 'primary',
62
+ 'str-video__composite-button__button-group--active-secondary':
63
+ active && variant === 'secondary',
26
64
  })}
27
65
  >
28
- {children}
66
+ <button
67
+ type="button"
68
+ className="str-video__composite-button__button"
69
+ onClick={(e) => {
70
+ e.preventDefault();
71
+ onClick?.(e);
72
+ }}
73
+ {...restButtonProps}
74
+ >
75
+ {children}
76
+ </button>
29
77
  {Menu && (
30
- <MenuToggle placement={menuPlacement} ToggleButton={ToggleMenuButton}>
78
+ <MenuToggle
79
+ offset={menuOffset}
80
+ placement={menuPlacement}
81
+ ToggleButton={ToggleMenuButton}
82
+ >
31
83
  {isComponentType(Menu) ? <Menu /> : Menu}
32
84
  </MenuToggle>
33
85
  )}
@@ -39,17 +91,17 @@ export const CompositeButton = forwardRef<
39
91
  );
40
92
  });
41
93
 
42
- const ToggleMenuButton = forwardRef<HTMLButtonElement, ToggleMenuButtonProps>(
43
- ({ menuShown }, ref) => {
44
- const { t } = useI18n();
45
-
46
- return (
47
- <IconButton
48
- className={'str-video__menu-toggle-button'}
49
- icon={menuShown ? 'caret-down' : 'caret-up'}
50
- title={t('Toggle device menu')}
51
- ref={ref}
52
- />
53
- );
54
- },
55
- );
94
+ const DefaultToggleMenuButton = forwardRef<
95
+ HTMLButtonElement,
96
+ ToggleMenuButtonProps
97
+ >(function DefaultToggleMenuButton({ menuShown }, ref) {
98
+ return (
99
+ <IconButton
100
+ className={clsx('str-video__menu-toggle-button', {
101
+ 'str-video__menu-toggle-button--active': menuShown,
102
+ })}
103
+ icon={menuShown ? 'caret-down' : 'caret-up'}
104
+ ref={ref}
105
+ />
106
+ );
107
+ });
@@ -9,24 +9,25 @@ export type ButtonWithIconProps = {
9
9
  } & ComponentProps<'button'> &
10
10
  IconProps;
11
11
 
12
- export const IconButton = forwardRef(
13
- (props: ButtonWithIconProps, ref: ForwardedRef<HTMLButtonElement>) => {
14
- const { icon, enabled, variant, onClick, className, ...rest } = props;
15
- return (
16
- <button
17
- className={clsx('str-video__call-controls__button', className, {
18
- [`str-video__call-controls__button--variant-${variant}`]: variant,
19
- 'str-video__call-controls__button--enabled': enabled,
20
- })}
21
- onClick={(e) => {
22
- e.preventDefault();
23
- onClick?.(e);
24
- }}
25
- ref={ref}
26
- {...rest}
27
- >
28
- <Icon icon={icon} />
29
- </button>
30
- );
31
- },
32
- );
12
+ export const IconButton = forwardRef(function IconButton(
13
+ props: ButtonWithIconProps,
14
+ ref: ForwardedRef<HTMLButtonElement>,
15
+ ) {
16
+ const { icon, enabled, variant, onClick, className, ...rest } = props;
17
+ return (
18
+ <button
19
+ className={clsx('str-video__call-controls__button', className, {
20
+ [`str-video__call-controls__button--variant-${variant}`]: variant,
21
+ 'str-video__call-controls__button--enabled': enabled,
22
+ })}
23
+ onClick={(e) => {
24
+ e.preventDefault();
25
+ onClick?.(e);
26
+ }}
27
+ ref={ref}
28
+ {...rest}
29
+ >
30
+ <Icon icon={icon} />
31
+ </button>
32
+ );
33
+ });
@@ -1,4 +1,3 @@
1
1
  export * from './CompositeButton';
2
- export * from './CopyToClipboardButton';
3
2
  export * from './IconButton';
4
3
  export * from './TextButton';
@@ -30,6 +30,7 @@ export const AcceptCallButton = ({
30
30
  disabled={disabled}
31
31
  icon="call-accept"
32
32
  variant="success"
33
+ data-testid="accept-call-button"
33
34
  onClick={handleClick}
34
35
  />
35
36
  );