@stream-io/video-react-sdk 1.0.8 → 1.0.10
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/CHANGELOG.md +16 -0
- package/dist/css/styles.css +44 -52
- package/dist/css/styles.css.map +1 -1
- package/dist/index.cjs.js +12 -10
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +13 -11
- package/dist/index.es.js.map +1 -1
- package/dist/src/hooks/useFloatingUIPreset.d.ts +21 -3
- package/package.json +4 -4
- package/src/components/CallControls/CancelCallButton.tsx +4 -4
- package/src/components/Tooltip/Tooltip.tsx +10 -4
- package/src/hooks/useFloatingUIPreset.ts +8 -3
package/dist/index.es.js
CHANGED
|
@@ -6,7 +6,7 @@ import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
|
6
6
|
import { useState, useEffect, Fragment as Fragment$1, createContext, useContext, useCallback, useRef, useMemo, forwardRef, isValidElement, useLayoutEffect } from 'react';
|
|
7
7
|
import clsx from 'clsx';
|
|
8
8
|
import { isPlatformSupported, loadTFLite, createRenderer } from '@stream-io/video-filters-web';
|
|
9
|
-
import { useFloating, offset, shift, flip, size, autoUpdate, FloatingOverlay, FloatingPortal, useListItem, useListNavigation, useTypeahead, useClick, useDismiss, useRole, useInteractions, FloatingFocusManager, FloatingList, useHover } from '@floating-ui/react';
|
|
9
|
+
import { useFloating, offset, shift, flip, size, autoUpdate, FloatingOverlay, FloatingPortal, arrow, FloatingArrow, useListItem, useListNavigation, useTypeahead, useClick, useDismiss, useRole, useInteractions, FloatingFocusManager, FloatingList, useHover } from '@floating-ui/react';
|
|
10
10
|
import { Chart, CategoryScale, LinearScale, LineElement, PointElement } from 'chart.js';
|
|
11
11
|
import { Line } from 'react-chartjs-2';
|
|
12
12
|
|
|
@@ -216,8 +216,8 @@ const RenderPipeline = (props) => {
|
|
|
216
216
|
return null;
|
|
217
217
|
};
|
|
218
218
|
|
|
219
|
-
const useFloatingUIPreset = ({ placement, strategy, offset: offsetInPx = 10, }) => {
|
|
220
|
-
const { refs, x, y, update, elements: { domReference, floating }, } = useFloating({
|
|
219
|
+
const useFloatingUIPreset = ({ middleware = [], placement, strategy, offset: offsetInPx = 10, }) => {
|
|
220
|
+
const { refs, x, y, update, elements: { domReference, floating }, context, } = useFloating({
|
|
221
221
|
placement,
|
|
222
222
|
strategy,
|
|
223
223
|
middleware: [
|
|
@@ -232,6 +232,7 @@ const useFloatingUIPreset = ({ placement, strategy, offset: offsetInPx = 10, })
|
|
|
232
232
|
});
|
|
233
233
|
},
|
|
234
234
|
}),
|
|
235
|
+
...middleware,
|
|
235
236
|
],
|
|
236
237
|
});
|
|
237
238
|
// handle window resizing
|
|
@@ -241,7 +242,7 @@ const useFloatingUIPreset = ({ placement, strategy, offset: offsetInPx = 10, })
|
|
|
241
242
|
const cleanup = autoUpdate(domReference, floating, update);
|
|
242
243
|
return () => cleanup();
|
|
243
244
|
}, [domReference, floating, update]);
|
|
244
|
-
return { refs, x, y, domReference, floating, strategy };
|
|
245
|
+
return { refs, x, y, domReference, floating, strategy, context };
|
|
245
246
|
};
|
|
246
247
|
|
|
247
248
|
/**
|
|
@@ -716,21 +717,22 @@ const LoadingIndicator = ({ className, type = 'spinner', text, tooltip, }) => {
|
|
|
716
717
|
};
|
|
717
718
|
|
|
718
719
|
const Tooltip = ({ children, referenceElement, tooltipClassName, tooltipPlacement = 'top', visible = false, }) => {
|
|
719
|
-
const
|
|
720
|
+
const arrowRef = useRef(null);
|
|
721
|
+
const { refs, x, y, strategy, context } = useFloatingUIPreset({
|
|
720
722
|
placement: tooltipPlacement,
|
|
721
723
|
strategy: 'absolute',
|
|
724
|
+
middleware: [arrow({ element: arrowRef })],
|
|
722
725
|
});
|
|
723
726
|
useEffect(() => {
|
|
724
727
|
refs.setReference(referenceElement);
|
|
725
728
|
}, [referenceElement, refs]);
|
|
726
729
|
if (!visible)
|
|
727
730
|
return null;
|
|
728
|
-
return (
|
|
731
|
+
return (jsxs("div", { className: clsx('str-video__tooltip', tooltipClassName), ref: refs.setFloating, style: {
|
|
729
732
|
position: strategy,
|
|
730
733
|
top: y ?? 0,
|
|
731
734
|
left: x ?? 0,
|
|
732
|
-
|
|
733
|
-
}, children: children }));
|
|
735
|
+
}, children: [jsx(FloatingArrow, { ref: arrowRef, context: context, fill: "var(--str-video__tooltip--background-color)" }), children] }));
|
|
734
736
|
};
|
|
735
737
|
|
|
736
738
|
const useEnterLeaveHandlers = ({ onMouseEnter, onMouseLeave, } = {}) => {
|
|
@@ -1165,9 +1167,9 @@ const EndCallMenu = (props) => {
|
|
|
1165
1167
|
const { t } = useI18n();
|
|
1166
1168
|
return (jsxs("div", { className: "str-video__end-call__confirmation", children: [jsxs("button", { className: "str-video__button str-video__end-call__leave", type: "button", "data-testid": "leave-call-button", onClick: onLeave, children: [jsx(Icon, { className: "str-video__button__icon str-video__end-call__leave-icon", icon: "logout" }), t('Leave call')] }), jsx(Restricted, { requiredGrants: [OwnCapability.END_CALL], children: jsxs("button", { className: "str-video__button str-video__end-call__end", type: "button", "data-testid": "end-call-for-all-button", onClick: onEnd, children: [jsx(Icon, { className: "str-video__button__icon str-video__end-call__end-icon", icon: "call-end" }), t('End call for all')] }) })] }));
|
|
1167
1169
|
};
|
|
1168
|
-
const CancelCallToggleMenuButton = forwardRef(function CancelCallToggleMenuButton(
|
|
1170
|
+
const CancelCallToggleMenuButton = forwardRef(function CancelCallToggleMenuButton({ menuShown }, ref) {
|
|
1169
1171
|
const { t } = useI18n();
|
|
1170
|
-
return (jsx(WithTooltip, { title: t('Leave call'), children: jsx(IconButton, { icon:
|
|
1172
|
+
return (jsx(WithTooltip, { title: t('Leave call'), tooltipDisabled: menuShown, children: jsx(IconButton, { icon: menuShown ? 'close' : 'call-end', variant: menuShown ? 'active' : 'danger', "data-testid": "leave-call-button", ref: ref }) }));
|
|
1171
1173
|
});
|
|
1172
1174
|
const CancelCallConfirmButton = ({ onClick, onLeave, }) => {
|
|
1173
1175
|
const call = useCall();
|
|
@@ -2567,7 +2569,7 @@ const VerticalScrollButtons = ({ scrollWrapper, }) => {
|
|
|
2567
2569
|
return (jsxs(Fragment, { children: [scrollPosition && scrollPosition !== 'top' && (jsx(IconButton, { onClick: scrollTopClickHandler, icon: "caret-up", className: "str-video__speaker-layout__participants-bar--button-top" })), scrollPosition && scrollPosition !== 'bottom' && (jsx(IconButton, { onClick: scrollBottomClickHandler, icon: "caret-down", className: "str-video__speaker-layout__participants-bar--button-bottom" }))] }));
|
|
2568
2570
|
};
|
|
2569
2571
|
|
|
2570
|
-
const [major, minor, patch] = ("1.0.
|
|
2572
|
+
const [major, minor, patch] = ("1.0.10" ).split('.');
|
|
2571
2573
|
setSdkInfo({
|
|
2572
2574
|
type: SfuModels.SdkType.REACT,
|
|
2573
2575
|
major,
|