@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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type {
|
|
2
|
+
import type { UseFloatingOptions } from '@floating-ui/react';
|
|
3
3
|
import { offset } from '@floating-ui/react';
|
|
4
|
-
export declare const useFloatingUIPreset: ({ placement, strategy, offset: offsetInPx, }: Pick<
|
|
4
|
+
export declare const useFloatingUIPreset: ({ middleware, placement, strategy, offset: offsetInPx, }: Pick<UseFloatingOptions, 'placement' | 'strategy' | 'middleware'> & {
|
|
5
5
|
offset?: number;
|
|
6
6
|
}) => {
|
|
7
7
|
refs: {
|
|
@@ -14,5 +14,23 @@ export declare const useFloatingUIPreset: ({ placement, strategy, offset: offset
|
|
|
14
14
|
y: number;
|
|
15
15
|
domReference: Element | null;
|
|
16
16
|
floating: HTMLElement | null;
|
|
17
|
-
strategy: import("@floating-ui/utils").Strategy;
|
|
17
|
+
strategy: import("@floating-ui/utils").Strategy | undefined;
|
|
18
|
+
context: {
|
|
19
|
+
x: number;
|
|
20
|
+
y: number;
|
|
21
|
+
placement: import("@floating-ui/utils").Placement;
|
|
22
|
+
strategy: import("@floating-ui/utils").Strategy;
|
|
23
|
+
middlewareData: import("@floating-ui/core").MiddlewareData;
|
|
24
|
+
isPositioned: boolean;
|
|
25
|
+
update: () => void;
|
|
26
|
+
floatingStyles: import("react").CSSProperties;
|
|
27
|
+
open: boolean;
|
|
28
|
+
onOpenChange: (open: boolean, event?: Event | undefined, reason?: import("@floating-ui/react").OpenChangeReason | undefined) => void;
|
|
29
|
+
events: import("@floating-ui/react").FloatingEvents;
|
|
30
|
+
dataRef: import("react").MutableRefObject<import("@floating-ui/react").ContextData>;
|
|
31
|
+
nodeId: string | undefined;
|
|
32
|
+
floatingId: string;
|
|
33
|
+
refs: import("@floating-ui/react").ExtendedRefs<import("@floating-ui/react").ReferenceType>;
|
|
34
|
+
elements: import("@floating-ui/react").ExtendedElements<import("@floating-ui/react").ReferenceType>;
|
|
35
|
+
};
|
|
18
36
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stream-io/video-react-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.10",
|
|
4
4
|
"packageManager": "yarn@3.2.4",
|
|
5
5
|
"main": "./dist/index.cjs.js",
|
|
6
6
|
"module": "./dist/index.es.js",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@floating-ui/react": "^0.26.5",
|
|
32
|
-
"@stream-io/video-client": "1.0.
|
|
32
|
+
"@stream-io/video-client": "1.0.7",
|
|
33
33
|
"@stream-io/video-filters-web": "0.1.0",
|
|
34
|
-
"@stream-io/video-react-bindings": "0.4.
|
|
34
|
+
"@stream-io/video-react-bindings": "0.4.33",
|
|
35
35
|
"chart.js": "^4.4.1",
|
|
36
36
|
"clsx": "^2.0.0",
|
|
37
37
|
"react-chartjs-2": "^5.2.0"
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@rollup/plugin-replace": "^5.0.5",
|
|
46
46
|
"@rollup/plugin-typescript": "^11.1.6",
|
|
47
47
|
"@stream-io/audio-filters-web": "^0.1.0",
|
|
48
|
-
"@stream-io/video-styling": "^1.0.
|
|
48
|
+
"@stream-io/video-styling": "^1.0.4",
|
|
49
49
|
"react": "^18.2.0",
|
|
50
50
|
"react-dom": "^18.2.0",
|
|
51
51
|
"rimraf": "^5.0.5",
|
|
@@ -49,13 +49,13 @@ const EndCallMenu = (props: {
|
|
|
49
49
|
const CancelCallToggleMenuButton = forwardRef<
|
|
50
50
|
HTMLButtonElement,
|
|
51
51
|
ToggleMenuButtonProps
|
|
52
|
-
>(function CancelCallToggleMenuButton(
|
|
52
|
+
>(function CancelCallToggleMenuButton({ menuShown }, ref) {
|
|
53
53
|
const { t } = useI18n();
|
|
54
54
|
return (
|
|
55
|
-
<WithTooltip title={t('Leave call')}>
|
|
55
|
+
<WithTooltip title={t('Leave call')} tooltipDisabled={menuShown}>
|
|
56
56
|
<IconButton
|
|
57
|
-
icon=
|
|
58
|
-
variant=
|
|
57
|
+
icon={menuShown ? 'close' : 'call-end'}
|
|
58
|
+
variant={menuShown ? 'active' : 'danger'}
|
|
59
59
|
data-testid="leave-call-button"
|
|
60
60
|
ref={ref}
|
|
61
61
|
/>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { PropsWithChildren, useEffect } from 'react';
|
|
1
|
+
import { PropsWithChildren, useEffect, useRef } from 'react';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import { useFloatingUIPreset } from '../../hooks';
|
|
4
|
-
import { Placement } from '@floating-ui/react';
|
|
4
|
+
import { FloatingArrow, Placement, arrow } from '@floating-ui/react';
|
|
5
5
|
|
|
6
6
|
export type TooltipProps<T extends HTMLElement> = PropsWithChildren<{
|
|
7
7
|
/** Reference element to which the tooltip should attach to */
|
|
@@ -23,9 +23,11 @@ export const Tooltip = <T extends HTMLElement>({
|
|
|
23
23
|
tooltipPlacement = 'top',
|
|
24
24
|
visible = false,
|
|
25
25
|
}: TooltipProps<T>) => {
|
|
26
|
-
const
|
|
26
|
+
const arrowRef = useRef<SVGSVGElement>(null);
|
|
27
|
+
const { refs, x, y, strategy, context } = useFloatingUIPreset({
|
|
27
28
|
placement: tooltipPlacement,
|
|
28
29
|
strategy: 'absolute',
|
|
30
|
+
middleware: [arrow({ element: arrowRef })],
|
|
29
31
|
});
|
|
30
32
|
|
|
31
33
|
useEffect(() => {
|
|
@@ -42,9 +44,13 @@ export const Tooltip = <T extends HTMLElement>({
|
|
|
42
44
|
position: strategy,
|
|
43
45
|
top: y ?? 0,
|
|
44
46
|
left: x ?? 0,
|
|
45
|
-
overflowY: 'auto',
|
|
46
47
|
}}
|
|
47
48
|
>
|
|
49
|
+
<FloatingArrow
|
|
50
|
+
ref={arrowRef}
|
|
51
|
+
context={context}
|
|
52
|
+
fill="var(--str-video__tooltip--background-color)"
|
|
53
|
+
/>
|
|
48
54
|
{children}
|
|
49
55
|
</div>
|
|
50
56
|
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { UseFloatingOptions } from '@floating-ui/react';
|
|
3
3
|
import {
|
|
4
4
|
autoUpdate,
|
|
5
5
|
flip,
|
|
@@ -10,16 +10,20 @@ import {
|
|
|
10
10
|
} from '@floating-ui/react';
|
|
11
11
|
|
|
12
12
|
export const useFloatingUIPreset = ({
|
|
13
|
+
middleware = [],
|
|
13
14
|
placement,
|
|
14
15
|
strategy,
|
|
15
16
|
offset: offsetInPx = 10,
|
|
16
|
-
}: Pick<
|
|
17
|
+
}: Pick<UseFloatingOptions, 'placement' | 'strategy' | 'middleware'> & {
|
|
18
|
+
offset?: number;
|
|
19
|
+
}) => {
|
|
17
20
|
const {
|
|
18
21
|
refs,
|
|
19
22
|
x,
|
|
20
23
|
y,
|
|
21
24
|
update,
|
|
22
25
|
elements: { domReference, floating },
|
|
26
|
+
context,
|
|
23
27
|
} = useFloating({
|
|
24
28
|
placement,
|
|
25
29
|
strategy,
|
|
@@ -35,6 +39,7 @@ export const useFloatingUIPreset = ({
|
|
|
35
39
|
});
|
|
36
40
|
},
|
|
37
41
|
}),
|
|
42
|
+
...middleware,
|
|
38
43
|
],
|
|
39
44
|
});
|
|
40
45
|
|
|
@@ -47,5 +52,5 @@ export const useFloatingUIPreset = ({
|
|
|
47
52
|
return () => cleanup();
|
|
48
53
|
}, [domReference, floating, update]);
|
|
49
54
|
|
|
50
|
-
return { refs, x, y, domReference, floating, strategy };
|
|
55
|
+
return { refs, x, y, domReference, floating, strategy, context };
|
|
51
56
|
};
|