@100mslive/roomkit-react 0.1.4-alpha.0 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{HLSView-T267ZHOS.js → HLSView-CTAJQUU4.js} +7 -11
- package/dist/{HLSView-T267ZHOS.js.map → HLSView-CTAJQUU4.js.map} +1 -1
- package/dist/PinnedTrackView-CQKONH4O.js +102 -0
- package/dist/PinnedTrackView-CQKONH4O.js.map +7 -0
- package/dist/Popover/index.d.ts +1 -0
- package/dist/Prebuilt/App.d.ts +25 -0
- package/dist/Prebuilt/index.d.ts +1 -0
- package/dist/Prebuilt/provider/roomLayoutProvider/index.d.ts +1 -1
- package/dist/Sheet/Sheet.d.ts +3093 -0
- package/dist/Sheet/index.d.ts +1 -0
- package/dist/Theme/ThemeProvider.d.ts +4 -286
- package/dist/Theme/stitches.config.d.ts +1 -1
- package/dist/{VirtualBackground-BCKXNDTD.js → VirtualBackground-GGGBJYVY.js} +31 -7
- package/dist/VirtualBackground-GGGBJYVY.js.map +7 -0
- package/dist/chunk-I2FJWE74.js +827 -0
- package/dist/chunk-I2FJWE74.js.map +7 -0
- package/dist/{chunk-NLZVUXR3.js → chunk-L2SX7GBO.js} +3020 -2189
- package/dist/chunk-L2SX7GBO.js.map +7 -0
- package/dist/chunk-NOKIGB6Y.js +1100 -0
- package/dist/chunk-NOKIGB6Y.js.map +7 -0
- package/dist/chunk-TJNDX446.js +67 -0
- package/dist/chunk-TJNDX446.js.map +7 -0
- package/dist/{chunk-3HMUOAD6.js → conference-OEO7VOJD.js} +3136 -653
- package/dist/conference-OEO7VOJD.js.map +7 -0
- package/dist/index.cjs.js +15733 -15498
- package/dist/index.cjs.js.map +4 -4
- package/dist/index.js +4 -8
- package/dist/meta.cjs.json +3248 -3039
- package/dist/meta.esbuild.json +3398 -3386
- package/dist/utils/animations.d.ts +16 -0
- package/package.json +8 -11
- package/src/Button/Button.tsx +4 -4
- package/src/Dropdown/Dropdown.tsx +2 -2
- package/src/IconButton/IconButton.tsx +4 -2
- package/src/Pagination/StyledPagination.tsx +1 -0
- package/src/Popover/index.tsx +2 -1
- package/src/Prebuilt/{App.jsx → App.tsx} +95 -48
- package/src/Prebuilt/Prebuilt.stories.tsx +22 -8
- package/src/Prebuilt/common/constants.js +1 -2
- package/src/Prebuilt/common/hooks.js +8 -0
- package/src/Prebuilt/common/utils.js +15 -0
- package/src/Prebuilt/components/AppData/AppData.jsx +1 -2
- package/src/Prebuilt/components/AppData/useUISettings.js +0 -5
- package/src/Prebuilt/components/AudioVideoToggle.jsx +69 -26
- package/src/Prebuilt/components/AuthToken.jsx +3 -2
- package/src/Prebuilt/components/Chat/ChatSelector.jsx +1 -1
- package/src/Prebuilt/components/Connection/TileConnection.jsx +0 -1
- package/src/Prebuilt/components/EmojiReaction.jsx +23 -73
- package/src/Prebuilt/components/EndSessionContent.jsx +57 -0
- package/src/Prebuilt/components/EqualProminence.jsx +180 -0
- package/src/Prebuilt/components/ErrorBoundary.jsx +4 -10
- package/src/Prebuilt/components/Footer/EmojiCard.jsx +34 -0
- package/src/Prebuilt/components/Footer/Footer.jsx +73 -0
- package/src/Prebuilt/components/{Header → Footer}/ParticipantList.jsx +5 -5
- package/src/Prebuilt/components/Header/ConferencingHeader.jsx +27 -7
- package/src/Prebuilt/components/Header/HeaderComponents.jsx +16 -14
- package/src/Prebuilt/components/Header/StreamActions.jsx +101 -36
- package/src/Prebuilt/components/Header/StreamingHeader.jsx +1 -1
- package/src/Prebuilt/components/Header/common.jsx +164 -0
- package/src/Prebuilt/components/IconButtonWithOptions/IconButtonWithOptions.jsx +1 -2
- package/src/Prebuilt/components/LeaveCard.jsx +19 -0
- package/src/Prebuilt/components/LeaveRoom.jsx +35 -143
- package/src/Prebuilt/components/LeaveSessionContent.jsx +45 -0
- package/src/Prebuilt/components/MoreSettings/ActionTile.jsx +55 -0
- package/src/Prebuilt/components/MoreSettings/ChangeNameContent.jsx +96 -0
- package/src/Prebuilt/components/MoreSettings/ChangeNameModal.jsx +31 -54
- package/src/Prebuilt/components/MoreSettings/EmbedUrl.jsx +48 -73
- package/src/Prebuilt/components/MoreSettings/MoreSettings.jsx +5 -221
- package/src/Prebuilt/components/MoreSettings/MuteAllContent.jsx +61 -0
- package/src/Prebuilt/components/MoreSettings/MuteAllModal.jsx +32 -49
- package/src/Prebuilt/components/MoreSettings/SplitComponents/DesktopLeaveRoom.jsx +129 -0
- package/src/Prebuilt/components/MoreSettings/SplitComponents/DesktopOptions.jsx +219 -0
- package/src/Prebuilt/components/MoreSettings/SplitComponents/MwebLeaveRoom.jsx +100 -0
- package/src/Prebuilt/components/MoreSettings/SplitComponents/MwebOptions.jsx +259 -0
- package/src/Prebuilt/components/Notifications/Notifications.jsx +0 -2
- package/src/Prebuilt/components/Notifications/ReconnectNotifications.jsx +0 -4
- package/src/Prebuilt/components/PIP/PIPComponent.jsx +30 -26
- package/src/Prebuilt/components/PIP/PIPManager.js +13 -0
- package/src/Prebuilt/components/PIP/index.jsx +2 -7
- package/src/Prebuilt/components/Pagination.jsx +4 -4
- package/src/Prebuilt/components/Preview/PreviewContainer.jsx +5 -13
- package/src/Prebuilt/components/Preview/PreviewForm.jsx +9 -5
- package/src/Prebuilt/components/Preview/PreviewJoin.jsx +20 -27
- package/src/Prebuilt/components/RaiseHand.jsx +27 -0
- package/src/Prebuilt/components/ScreenShare.jsx +1 -1
- package/src/Prebuilt/components/ScreenshareDisplay.jsx +2 -2
- package/src/Prebuilt/components/ScreenshareTile.jsx +2 -2
- package/src/Prebuilt/components/Settings/DeviceSettings.jsx +2 -1
- package/src/Prebuilt/components/Settings/LayoutSettings.jsx +1 -24
- package/src/Prebuilt/components/Settings/SettingsModal.jsx +152 -17
- package/src/Prebuilt/components/ShareMenuIcon.jsx +1 -0
- package/src/Prebuilt/components/TileMenu/TileMenu.jsx +133 -0
- package/src/Prebuilt/components/TileMenu/TileMenuContent.jsx +313 -0
- package/src/Prebuilt/components/VideoList.jsx +5 -33
- package/src/Prebuilt/components/VideoTile.jsx +30 -8
- package/src/Prebuilt/components/conference.jsx +14 -1
- package/src/Prebuilt/components/init/Init.jsx +0 -27
- package/src/Prebuilt/components/init/initUtils.js +0 -23
- package/src/Prebuilt/components/pdfAnnotator/pdfFileOptions.jsx +2 -1
- package/src/Prebuilt/components/pdfAnnotator/pdfInfo.jsx +1 -1
- package/src/Prebuilt/components/pdfAnnotator/shareScreenOptions.jsx +19 -8
- package/src/Prebuilt/components/pdfAnnotator/uploadedFile.jsx +1 -0
- package/src/Prebuilt/images/pdf-share.png +0 -0
- package/src/Prebuilt/images/screen-share.png +0 -0
- package/src/Prebuilt/index.ts +1 -0
- package/src/Prebuilt/layouts/EmbedView.jsx +0 -1
- package/src/Prebuilt/layouts/InsetView.jsx +65 -24
- package/src/Prebuilt/layouts/PDFView.jsx +0 -1
- package/src/Prebuilt/layouts/SidePane.jsx +8 -7
- package/src/Prebuilt/layouts/WhiteboardView.jsx +2 -4
- package/src/Prebuilt/layouts/mainView.jsx +22 -31
- package/src/Prebuilt/layouts/screenShareView.jsx +0 -2
- package/src/Prebuilt/plugins/VirtualBackground/VirtualBackground.jsx +25 -1
- package/src/Prebuilt/plugins/whiteboard/index.js +1 -1
- package/src/Prebuilt/primitives/DialogContent.jsx +1 -1
- package/src/Prebuilt/provider/roomLayoutProvider/index.tsx +1 -1
- package/src/Sheet/Sheet.mdx +19 -0
- package/src/Sheet/Sheet.stories.tsx +103 -0
- package/src/Sheet/Sheet.tsx +118 -0
- package/src/Sheet/index.ts +1 -0
- package/src/Theme/ThemeProvider.tsx +10 -13
- package/src/Theme/base.config.ts +1 -1
- package/src/Theme/stitches.config.ts +1 -1
- package/src/TileMenu/StyledMenuTile.tsx +2 -2
- package/src/TileMenu/TileMenu.tsx +2 -0
- package/src/VideoTile/StyledVideoTile.tsx +5 -0
- package/src/utils/animations.ts +18 -0
- package/dist/ActiveSpeakerView-AGL73O6U.css +0 -11
- package/dist/ActiveSpeakerView-AGL73O6U.css.map +0 -7
- package/dist/ActiveSpeakerView-UPFD5RXA.js +0 -39
- package/dist/ActiveSpeakerView-UPFD5RXA.js.map +0 -7
- package/dist/HLSView-64OG755F.css +0 -11
- package/dist/HLSView-64OG755F.css.map +0 -7
- package/dist/PinnedTrackView-O4FHHHOV.js +0 -70
- package/dist/PinnedTrackView-O4FHHHOV.js.map +0 -7
- package/dist/PinnedTrackView-YWAZ2342.css +0 -11
- package/dist/PinnedTrackView-YWAZ2342.css.map +0 -7
- package/dist/VirtualBackground-BCKXNDTD.js.map +0 -7
- package/dist/chunk-3HMUOAD6.js.map +0 -7
- package/dist/chunk-6GXDYWD5.js +0 -243
- package/dist/chunk-6GXDYWD5.js.map +0 -7
- package/dist/chunk-NLZVUXR3.js.map +0 -7
- package/dist/chunk-ORPC2GYB.js +0 -58
- package/dist/chunk-ORPC2GYB.js.map +0 -7
- package/dist/chunk-YE4RPJYG.js +0 -811
- package/dist/chunk-YE4RPJYG.js.map +0 -7
- package/dist/conference-7KHWJZLG.css +0 -11
- package/dist/conference-7KHWJZLG.css.map +0 -7
- package/dist/conference-ETISNCLN.js +0 -3697
- package/dist/conference-ETISNCLN.js.map +0 -7
- package/dist/index.cjs.css +0 -11
- package/dist/index.cjs.css.map +0 -7
- package/dist/index.css +0 -11
- package/dist/index.css.map +0 -7
- package/dist/transcription-JJQ4UAIK.js +0 -356
- package/dist/transcription-JJQ4UAIK.js.map +0 -7
- package/src/Prebuilt/common/useSortedPeers.js +0 -28
- package/src/Prebuilt/components/BottomActionSheet/BottomActionSheet.jsx +0 -96
- package/src/Prebuilt/components/BottomActionSheet/BottomActionSheet.stories.tsx +0 -46
- package/src/Prebuilt/components/Footer/ConferencingFooter.jsx +0 -101
- package/src/Prebuilt/components/Footer/StreamingFooter.jsx +0 -71
- package/src/Prebuilt/components/Footer.jsx +0 -8
- package/src/Prebuilt/components/MoreSettings/ChangeSelfRole.jsx +0 -67
- package/src/Prebuilt/components/TileMenu.jsx +0 -268
- package/src/Prebuilt/index.d.ts +0 -20
- package/src/Prebuilt/index.js +0 -2
@@ -1,5 +1,4 @@
|
|
1
1
|
import React, { Suspense, useCallback, useEffect } from 'react';
|
2
|
-
import { JoinForm_JoinBtnType } from '@100mslive/types-prebuilt/elements/join_form';
|
3
2
|
import {
|
4
3
|
selectIsConnectedToRoom,
|
5
4
|
selectLocalPeerRoleName,
|
@@ -7,26 +6,21 @@ import {
|
|
7
6
|
selectPeerSharingAudio,
|
8
7
|
selectPeerSharingVideoPlaylist,
|
9
8
|
selectPermissions,
|
10
|
-
selectTemplateAppData,
|
11
9
|
useHMSActions,
|
12
10
|
useHMSStore,
|
13
11
|
useRecordingStreaming,
|
14
12
|
} from '@100mslive/react-sdk';
|
13
|
+
import { EqualProminence } from '../components/EqualProminence';
|
15
14
|
import FullPageProgress from '../components/FullPageProgress';
|
16
15
|
import { Flex } from '../../Layout';
|
17
|
-
import { useRoomLayout } from '../provider/roomLayoutProvider';
|
18
16
|
import { EmbedView } from './EmbedView';
|
19
|
-
import { InsetView } from './InsetView';
|
20
|
-
import { MainGridView } from './mainGridView';
|
21
17
|
import { PDFView } from './PDFView';
|
22
18
|
import ScreenShareView from './screenShareView';
|
23
19
|
import SidePane from './SidePane';
|
24
20
|
import { WaitingView } from './WaitingView';
|
25
21
|
import { useWhiteboardMetadata } from '../plugins/whiteboard';
|
26
|
-
import { useAppConfig } from '../components/AppData/useAppConfig';
|
27
22
|
import {
|
28
23
|
useHLSViewerRole,
|
29
|
-
useIsHeadless,
|
30
24
|
usePDFAnnotator,
|
31
25
|
usePinnedTrack,
|
32
26
|
useSetAppDataByKey,
|
@@ -34,11 +28,11 @@ import {
|
|
34
28
|
useUrlToEmbed,
|
35
29
|
useWaitingViewerRole,
|
36
30
|
} from '../components/AppData/useUISettings';
|
37
|
-
import {
|
31
|
+
import { useShowStreamingUI } from '../common/hooks';
|
32
|
+
import { APP_DATA, SESSION_STORE_KEY } from '../common/constants';
|
38
33
|
|
39
34
|
// const WhiteboardView = React.lazy(() => import("./WhiteboardView"));
|
40
35
|
const HLSView = React.lazy(() => import('./HLSView'));
|
41
|
-
const ActiveSpeakerView = React.lazy(() => import('./ActiveSpeakerView'));
|
42
36
|
const PinnedTrackView = React.lazy(() => import('./PinnedTrackView'));
|
43
37
|
|
44
38
|
export const ConferenceMainView = () => {
|
@@ -49,21 +43,16 @@ export const ConferenceMainView = () => {
|
|
49
43
|
const peerSharingPlaylist = useHMSStore(selectPeerSharingVideoPlaylist);
|
50
44
|
const { whiteboardOwner: whiteboardShared } = useWhiteboardMetadata();
|
51
45
|
const isConnected = useHMSStore(selectIsConnectedToRoom);
|
52
|
-
const uiMode = useHMSStore(selectTemplateAppData).uiMode;
|
53
46
|
const hmsActions = useHMSActions();
|
54
|
-
const
|
55
|
-
const headlessUIMode = useAppConfig('headlessConfig', 'uiMode');
|
56
|
-
const { uiViewMode, isAudioOnly } = useUISettings();
|
47
|
+
const { isAudioOnly } = useUISettings();
|
57
48
|
const hlsViewerRole = useHLSViewerRole();
|
58
49
|
const waitingViewerRole = useWaitingViewerRole();
|
59
50
|
const urlToIframe = useUrlToEmbed();
|
60
51
|
const pdfAnnotatorActive = usePDFAnnotator();
|
61
|
-
|
62
52
|
const { isHLSRunning } = useRecordingStreaming();
|
63
53
|
const [isHLSStarted, setHLSStarted] = useSetAppDataByKey(APP_DATA.hlsStarted);
|
64
54
|
const permissions = useHMSStore(selectPermissions);
|
65
|
-
const
|
66
|
-
const { join_form: joinForm = {} } = roomLayout?.screens?.preview?.default?.elements || {};
|
55
|
+
const showStreamingUI = useShowStreamingUI();
|
67
56
|
|
68
57
|
const startHLS = useCallback(async () => {
|
69
58
|
try {
|
@@ -73,6 +62,9 @@ export const ConferenceMainView = () => {
|
|
73
62
|
setHLSStarted(true);
|
74
63
|
await hmsActions.startHLSStreaming({});
|
75
64
|
} catch (error) {
|
65
|
+
if (error.message === 'beam already started') {
|
66
|
+
return;
|
67
|
+
}
|
76
68
|
if (error.message.includes('invalid input')) {
|
77
69
|
await startHLS();
|
78
70
|
return;
|
@@ -81,6 +73,17 @@ export const ConferenceMainView = () => {
|
|
81
73
|
}
|
82
74
|
}, [hmsActions, isHLSStarted, setHLSStarted]);
|
83
75
|
|
76
|
+
useEffect(() => {
|
77
|
+
if (!isConnected) {
|
78
|
+
return;
|
79
|
+
}
|
80
|
+
// Is a streaming kit and broadcaster joins
|
81
|
+
if (permissions?.hlsStreaming && !isHLSRunning && showStreamingUI) {
|
82
|
+
startHLS();
|
83
|
+
}
|
84
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
85
|
+
}, [isConnected]);
|
86
|
+
|
84
87
|
useEffect(() => {
|
85
88
|
if (!isConnected) {
|
86
89
|
return;
|
@@ -94,17 +97,9 @@ export const ConferenceMainView = () => {
|
|
94
97
|
hmsActions.audioPlaylist.setList(audioPlaylist);
|
95
98
|
}
|
96
99
|
|
97
|
-
// Is a streaming kit and broadcaster joins
|
98
|
-
if (
|
99
|
-
permissions?.hlsStreaming &&
|
100
|
-
!isHLSRunning &&
|
101
|
-
joinForm.join_btn_type === JoinForm_JoinBtnType.JOIN_BTN_TYPE_JOIN_AND_GO_LIVE
|
102
|
-
) {
|
103
|
-
startHLS();
|
104
|
-
}
|
105
|
-
|
106
100
|
hmsActions.sessionStore.observe([SESSION_STORE_KEY.PINNED_MESSAGE, SESSION_STORE_KEY.SPOTLIGHT]);
|
107
|
-
|
101
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
102
|
+
}, [isConnected, hmsActions]);
|
108
103
|
|
109
104
|
if (!localPeerRole) {
|
110
105
|
// we don't know the role yet to decide how to render UI
|
@@ -122,16 +117,12 @@ export const ConferenceMainView = () => {
|
|
122
117
|
ViewComponent = EmbedView;
|
123
118
|
} else if (whiteboardShared) {
|
124
119
|
// ViewComponent = WhiteboardView;
|
125
|
-
} else if (uiMode === 'inset') {
|
126
|
-
ViewComponent = InsetView;
|
127
120
|
} else if (((peerSharing && peerSharing.id !== peerSharingAudio?.id) || peerSharingPlaylist) && !isAudioOnly) {
|
128
121
|
ViewComponent = ScreenShareView;
|
129
122
|
} else if (pinnedTrack) {
|
130
123
|
ViewComponent = PinnedTrackView;
|
131
|
-
} else if (uiViewMode === UI_MODE_ACTIVE_SPEAKER || (isHeadless && headlessUIMode === UI_MODE_ACTIVE_SPEAKER)) {
|
132
|
-
ViewComponent = ActiveSpeakerView;
|
133
124
|
} else {
|
134
|
-
ViewComponent =
|
125
|
+
ViewComponent = EqualProminence;
|
135
126
|
}
|
136
127
|
|
137
128
|
return (
|
@@ -105,7 +105,6 @@ const ScreenShareComponent = ({ amIPresenting, peerPresenting, peerSharingPlayli
|
|
105
105
|
return (
|
106
106
|
<Box
|
107
107
|
css={{
|
108
|
-
mx: '$8',
|
109
108
|
flex: '3 1 0',
|
110
109
|
'@xl': {
|
111
110
|
flex: '2 1 0',
|
@@ -123,7 +122,6 @@ const ScreenShareComponent = ({ amIPresenting, peerPresenting, peerSharingPlayli
|
|
123
122
|
<Box
|
124
123
|
css={{
|
125
124
|
flex: '3 1 0',
|
126
|
-
mx: '$8',
|
127
125
|
'@xl': { ml: '$4', maxHeight: '80%', minHeight: 0 },
|
128
126
|
}}
|
129
127
|
>
|
@@ -9,6 +9,7 @@ import {
|
|
9
9
|
useHMSStore,
|
10
10
|
} from '@100mslive/react-sdk';
|
11
11
|
import { VirtualBackgroundIcon } from '@100mslive/react-icons';
|
12
|
+
import { ActionTile } from '../../components/MoreSettings/ActionTile';
|
12
13
|
import { Loading } from '../../../Loading';
|
13
14
|
import { Tooltip } from '../../../Tooltip';
|
14
15
|
import IconButton from '../../IconButton';
|
@@ -16,13 +17,19 @@ import { useIsFeatureEnabled } from '../../components/hooks/useFeatures';
|
|
16
17
|
import { getRandomVirtualBackground } from './vbutils';
|
17
18
|
import { FEATURE_LIST } from '../../common/constants';
|
18
19
|
|
19
|
-
export const VirtualBackground = (
|
20
|
+
export const VirtualBackground = ({
|
21
|
+
asActionTile = false,
|
22
|
+
onVBClick = () => {
|
23
|
+
return;
|
24
|
+
},
|
25
|
+
}) => {
|
20
26
|
const pluginRef = useRef(null);
|
21
27
|
const hmsActions = useHMSActions();
|
22
28
|
const isAllowedToPublish = useHMSStore(selectIsAllowedToPublish);
|
23
29
|
const role = useHMSStore(selectLocalPeerRole);
|
24
30
|
const [isVBLoading, setIsVBLoading] = useState(false);
|
25
31
|
const [isVBSupported, setIsVBSupported] = useState(false);
|
32
|
+
const [isVBOn, setIsVBOn] = useState(false);
|
26
33
|
const localPeerVideoTrackID = useHMSStore(selectLocalVideoTrackID);
|
27
34
|
const isVBPresent = useHMSStore(selectIsLocalVideoPluginPresent('HMSVB'));
|
28
35
|
const isFeatureEnabled = useIsFeatureEnabled(FEATURE_LIST.VIDEO_PLUGINS);
|
@@ -68,6 +75,23 @@ export const VirtualBackground = () => {
|
|
68
75
|
if (!isAllowedToPublish.video || !isVBSupported || !isFeatureEnabled) {
|
69
76
|
return null;
|
70
77
|
}
|
78
|
+
if (asActionTile) {
|
79
|
+
return (
|
80
|
+
<ActionTile.Root
|
81
|
+
data-testid="virtual_bg_btn"
|
82
|
+
active={isVBPresent}
|
83
|
+
disabled={isVBLoading}
|
84
|
+
onClick={() => {
|
85
|
+
setIsVBOn(!isVBOn);
|
86
|
+
!isVBPresent ? addPlugin() : removePlugin();
|
87
|
+
onVBClick();
|
88
|
+
}}
|
89
|
+
>
|
90
|
+
<VirtualBackgroundIcon />
|
91
|
+
<ActionTile.Title>Virtual Background</ActionTile.Title>
|
92
|
+
</ActionTile.Root>
|
93
|
+
);
|
94
|
+
}
|
71
95
|
|
72
96
|
return (
|
73
97
|
<Tooltip
|
@@ -172,7 +172,7 @@ export const DialogInput = ({ title, value, onChange, placeholder, disabled, typ
|
|
172
172
|
<DialogRow breakSm>
|
173
173
|
<Label>{title}</Label>
|
174
174
|
<Input
|
175
|
-
css={{ width: '70%', '@sm': { width: '100%' } }}
|
175
|
+
css={{ width: '70%', '@sm': { width: '100%' }, bg: '$surface_bright' }}
|
176
176
|
value={value}
|
177
177
|
onChange={e => onChange(e.target.value)}
|
178
178
|
placeholder={placeholder}
|
@@ -7,7 +7,7 @@ import { useFetchRoomLayout } from './hooks/useFetchRoomLayout';
|
|
7
7
|
|
8
8
|
export type RoomLayoutProviderProps = {
|
9
9
|
roomLayoutEndpoint?: string;
|
10
|
-
overrideLayout?: Layout
|
10
|
+
overrideLayout?: Partial<Layout>;
|
11
11
|
};
|
12
12
|
|
13
13
|
export const RoomLayoutContext = React.createContext<Layout | undefined>(undefined);
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Replacing DocsPage with custom `MDX` content
|
2
|
+
|
3
|
+
This file is a documentation-only `MDX`file to customize Storybook's [DocsPage](https://storybook.js.org/docs/react/writing-docs/docs-page#replacing-docspage).
|
4
|
+
|
5
|
+
It can be further expanded with your own code snippets and include specific information related to your stories.
|
6
|
+
|
7
|
+
For example:
|
8
|
+
|
9
|
+
import { Story } from '@storybook/addon-docs';
|
10
|
+
|
11
|
+
## Sheet
|
12
|
+
|
13
|
+
Sheet is an hover component used to have a focus-mode like UI for users.
|
14
|
+
|
15
|
+
- [Example](#example)
|
16
|
+
|
17
|
+
### Example
|
18
|
+
|
19
|
+
<Story id="sheet--example" />
|
@@ -0,0 +1,103 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { ComponentMeta, ComponentStory } from '@storybook/react';
|
3
|
+
import { CrossIcon, InfoIcon } from '@100mslive/react-icons';
|
4
|
+
import { Button } from '../Button';
|
5
|
+
import { HorizontalDivider } from '../Divider';
|
6
|
+
import { Fieldset } from '../Fieldset';
|
7
|
+
import { Input } from '../Input';
|
8
|
+
import { Label } from '../Label';
|
9
|
+
import { Box, Flex } from '../Layout';
|
10
|
+
import { Text } from '../Text';
|
11
|
+
import { Sheet } from './Sheet';
|
12
|
+
import SheetDocs from './Sheet.mdx';
|
13
|
+
|
14
|
+
export default {
|
15
|
+
title: 'UI Components/Sheet',
|
16
|
+
component: Sheet.Root,
|
17
|
+
argTypes: { onClick: { action: 'clicked' } },
|
18
|
+
parameters: {
|
19
|
+
docs: {
|
20
|
+
page: SheetDocs,
|
21
|
+
},
|
22
|
+
},
|
23
|
+
} as ComponentMeta<typeof Sheet.Root>;
|
24
|
+
|
25
|
+
//👇 We create a “template” of how args map to rendering
|
26
|
+
const Template: ComponentStory<typeof Sheet.Root> = () => (
|
27
|
+
<Sheet.Root>
|
28
|
+
<Sheet.Trigger asChild>
|
29
|
+
<Button variant="standard">Open Sheet</Button>
|
30
|
+
</Sheet.Trigger>
|
31
|
+
<Sheet.Content>
|
32
|
+
<Sheet.Title css={{ p: '$10' }}>
|
33
|
+
<Flex direction="row" justify="between" css={{ w: '100%' }}>
|
34
|
+
<Flex justify="start" align="center" gap="3">
|
35
|
+
<InfoIcon />
|
36
|
+
<Text variant="h5">Sheet Heading</Text>
|
37
|
+
</Flex>
|
38
|
+
<Sheet.Close css={{ color: 'white' }}>
|
39
|
+
<CrossIcon />
|
40
|
+
</Sheet.Close>
|
41
|
+
</Flex>
|
42
|
+
</Sheet.Title>
|
43
|
+
<HorizontalDivider />
|
44
|
+
<Box as="div" css={{ p: '$10', overflowY: 'scroll', maxHeight: '70vh' }}>
|
45
|
+
<Text variant="body1" css={{ c: '$on_surface_medium' }}>
|
46
|
+
Body 2: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
|
47
|
+
dolore magna aliqua. Ut enim ad minim veniam,im venitetur adipiscing elit, sed do eiusmod tempor incididunt ut
|
48
|
+
labore et dolore magna aliqua. Ut enim ad minim veniam,im veni
|
49
|
+
</Text>
|
50
|
+
<Fieldset>
|
51
|
+
<Label htmlFor="name">Name</Label>
|
52
|
+
<Input id="name" defaultValue="Amar" css={{ w: '50%' }} />
|
53
|
+
</Fieldset>
|
54
|
+
<Fieldset>
|
55
|
+
<Label htmlFor="username">Username</Label>
|
56
|
+
<Input id="username" defaultValue="@amar1995" css={{ w: '50%' }} />
|
57
|
+
</Fieldset>
|
58
|
+
<Text variant="body1" css={{ c: '$on_surface_medium' }}>
|
59
|
+
Body 2: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
|
60
|
+
dolore magna aliqua. Ut enim ad minim veniam,im venitetur adipiscing elit, sed do eiusmod tempor incididunt ut
|
61
|
+
labore et dolore magna aliqua. Ut enim ad minim veniam,im veni
|
62
|
+
</Text>
|
63
|
+
<Fieldset>
|
64
|
+
<Label htmlFor="name">Name</Label>
|
65
|
+
<Input id="name" defaultValue="Amar" css={{ w: '50%' }} />
|
66
|
+
</Fieldset>
|
67
|
+
<Fieldset>
|
68
|
+
<Label htmlFor="username">Username</Label>
|
69
|
+
<Input id="username" defaultValue="@amar1995" css={{ w: '50%' }} />
|
70
|
+
</Fieldset>
|
71
|
+
<Text variant="body1" css={{ c: '$on_surface_medium' }}>
|
72
|
+
Body 2: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
|
73
|
+
dolore magna aliqua. Ut enim ad minim veniam,im venitetur adipiscing elit, sed do eiusmod tempor incididunt ut
|
74
|
+
labore et dolore magna aliqua. Ut enim ad minim veniam,im veni
|
75
|
+
</Text>
|
76
|
+
<Fieldset>
|
77
|
+
<Label htmlFor="name">Name</Label>
|
78
|
+
<Input id="name" defaultValue="Amar" css={{ w: '50%' }} />
|
79
|
+
</Fieldset>
|
80
|
+
<Fieldset>
|
81
|
+
<Label htmlFor="username">Username</Label>
|
82
|
+
<Input id="username" defaultValue="@amar1995" css={{ w: '50%' }} />
|
83
|
+
</Fieldset>
|
84
|
+
<Text variant="body1" css={{ c: '$on_surface_medium' }}>
|
85
|
+
Body 2: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
|
86
|
+
dolore magna aliqua. Ut enim ad minim veniam,im venitetur adipiscing elit, sed do eiusmod tempor incididunt ut
|
87
|
+
labore et dolore magna aliqua. Ut enim ad minim veniam,im veni
|
88
|
+
</Text>
|
89
|
+
<Fieldset>
|
90
|
+
<Label htmlFor="name">Name</Label>
|
91
|
+
<Input id="name" defaultValue="Amar" css={{ w: '50%' }} />
|
92
|
+
</Fieldset>
|
93
|
+
<Fieldset>
|
94
|
+
<Label htmlFor="username">Username</Label>
|
95
|
+
<Input id="username" defaultValue="@amar1995" css={{ w: '50%' }} />
|
96
|
+
</Fieldset>
|
97
|
+
</Box>
|
98
|
+
</Sheet.Content>
|
99
|
+
</Sheet.Root>
|
100
|
+
);
|
101
|
+
|
102
|
+
export const Example = Template.bind({});
|
103
|
+
Example.storyName = 'Sheet';
|
@@ -0,0 +1,118 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
3
|
+
import { CSS, VariantProps } from '@stitches/react';
|
4
|
+
import { Dialog } from '../Modal';
|
5
|
+
import { styled } from '../Theme';
|
6
|
+
import { sheetFadeIn, sheetFadeOut, sheetSlideIn, sheetSlideOut } from '../utils';
|
7
|
+
|
8
|
+
const SheetRoot = styled(DialogPrimitive.Root, {
|
9
|
+
minHeight: '240px',
|
10
|
+
maxWidth: '100%',
|
11
|
+
});
|
12
|
+
const SheetTrigger = styled(DialogPrimitive.Trigger, {
|
13
|
+
appearance: 'none !important', // Needed for safari it shows white overlay
|
14
|
+
});
|
15
|
+
|
16
|
+
const StyledOverlay = styled(Dialog.Overlay, {
|
17
|
+
top: 0,
|
18
|
+
right: 0,
|
19
|
+
bottom: 0,
|
20
|
+
left: 0,
|
21
|
+
|
22
|
+
'&[data-state="open"]': {
|
23
|
+
animation: `${sheetFadeIn} 150ms cubic-bezier(0.22, 1, 0.36, 1)`,
|
24
|
+
},
|
25
|
+
|
26
|
+
'&[data-state="closed"]': {
|
27
|
+
animation: `${sheetFadeOut} 150ms cubic-bezier(0.22, 1, 0.36, 1)`,
|
28
|
+
},
|
29
|
+
});
|
30
|
+
|
31
|
+
const StyledContent = styled(DialogPrimitive.Content, {
|
32
|
+
color: '$on_surface_medium',
|
33
|
+
backgroundColor: '$surface_default',
|
34
|
+
borderTopLeftRadius: '$3',
|
35
|
+
borderTopRightRadius: '$3',
|
36
|
+
boxShadow: '0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23)',
|
37
|
+
position: 'fixed',
|
38
|
+
zIndex: 1001,
|
39
|
+
top: 0,
|
40
|
+
right: 0,
|
41
|
+
left: 0,
|
42
|
+
bottom: 0,
|
43
|
+
maxHeight: '96%',
|
44
|
+
|
45
|
+
// Among other things, prevents text alignment inconsistencies when dialog can't be centered in the viewport evenly.
|
46
|
+
// Affects animated and non-animated dialogs alike.
|
47
|
+
willChange: 'transform',
|
48
|
+
|
49
|
+
'&:focus': {
|
50
|
+
outline: 'none',
|
51
|
+
},
|
52
|
+
'@allowMotion': {
|
53
|
+
'&[data-state="open"]': {
|
54
|
+
animation: `${sheetSlideIn} 150ms cubic-bezier(0.22, 1, 0.36, 1)`,
|
55
|
+
},
|
56
|
+
|
57
|
+
'&[data-state="closed"]': {
|
58
|
+
animation: `${sheetSlideOut} 150ms cubic-bezier(0.22, 1, 0.36, 1)`,
|
59
|
+
},
|
60
|
+
},
|
61
|
+
|
62
|
+
variants: {
|
63
|
+
side: {
|
64
|
+
top: {
|
65
|
+
$$transformValue: 'translate3d(0,-100%,0)',
|
66
|
+
bottom: 'auto',
|
67
|
+
},
|
68
|
+
right: {
|
69
|
+
$$transformValue: 'translate3d(100%,0,0)',
|
70
|
+
right: 0,
|
71
|
+
},
|
72
|
+
bottom: {
|
73
|
+
$$transformValue: 'translate3d(0,100%,0)',
|
74
|
+
bottom: 0,
|
75
|
+
top: 'auto',
|
76
|
+
},
|
77
|
+
left: {
|
78
|
+
$$transformValue: 'translate3d(-100%,0,0)',
|
79
|
+
left: 0,
|
80
|
+
},
|
81
|
+
},
|
82
|
+
},
|
83
|
+
|
84
|
+
defaultVariants: {
|
85
|
+
side: 'bottom',
|
86
|
+
},
|
87
|
+
});
|
88
|
+
|
89
|
+
type SheetContentVariants = VariantProps<typeof StyledContent>;
|
90
|
+
type DialogContentPrimitiveProps = React.ComponentProps<typeof DialogPrimitive.Content>;
|
91
|
+
type SheetContentProps = DialogContentPrimitiveProps & SheetContentVariants & { css?: CSS };
|
92
|
+
|
93
|
+
const SheetContent = React.forwardRef<React.ElementRef<typeof StyledContent>, SheetContentProps>(
|
94
|
+
({ children, ...props }, forwardedRef) => (
|
95
|
+
<Dialog.Portal>
|
96
|
+
<StyledOverlay />
|
97
|
+
<StyledContent {...props} ref={forwardedRef}>
|
98
|
+
{children}
|
99
|
+
</StyledContent>
|
100
|
+
</Dialog.Portal>
|
101
|
+
),
|
102
|
+
);
|
103
|
+
const SheetClose = Dialog.Close;
|
104
|
+
const SheetTitle = styled(DialogPrimitive.Title, {
|
105
|
+
margin: 0,
|
106
|
+
});
|
107
|
+
const SheetDescription = Dialog.Description;
|
108
|
+
const SheetDefaultCloseIcon = Dialog.DefaultClose;
|
109
|
+
|
110
|
+
export const Sheet = {
|
111
|
+
Root: SheetRoot,
|
112
|
+
Trigger: SheetTrigger,
|
113
|
+
Content: SheetContent,
|
114
|
+
Description: SheetDescription,
|
115
|
+
Title: SheetTitle,
|
116
|
+
Close: SheetClose,
|
117
|
+
DefaultClose: SheetDefaultCloseIcon,
|
118
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export { Sheet } from './Sheet';
|
@@ -14,7 +14,7 @@ export enum ThemeTypes {
|
|
14
14
|
}
|
15
15
|
|
16
16
|
export type ThemeContextValue = {
|
17
|
-
themeType:
|
17
|
+
themeType: string;
|
18
18
|
theme: Theme;
|
19
19
|
aspectRatio: { width: number; height: number };
|
20
20
|
/**
|
@@ -27,7 +27,7 @@ export type ThemeContextValue = {
|
|
27
27
|
};
|
28
28
|
|
29
29
|
export type ThemeProviderProps = {
|
30
|
-
themeType?:
|
30
|
+
themeType?: string;
|
31
31
|
theme?: Theme;
|
32
32
|
aspectRatio?: { width: number; height: number };
|
33
33
|
};
|
@@ -40,7 +40,7 @@ const defaultContext = {
|
|
40
40
|
return;
|
41
41
|
},
|
42
42
|
};
|
43
|
-
export const ThemeContext = React.createContext(defaultContext);
|
43
|
+
export const ThemeContext = React.createContext<ThemeContextValue>(defaultContext);
|
44
44
|
|
45
45
|
/**
|
46
46
|
* Wrap this around your root component to get access to theme
|
@@ -72,16 +72,13 @@ export const HMSThemeProvider: React.FC<React.PropsWithChildren<ThemeProviderPro
|
|
72
72
|
return updatedTheme;
|
73
73
|
}, [userTheme, currentTheme, isBrowser]);
|
74
74
|
|
75
|
-
const toggleTheme = useCallback(
|
76
|
-
(themeToUpdateTo
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
},
|
83
|
-
[currentTheme],
|
84
|
-
);
|
75
|
+
const toggleTheme = useCallback((themeToUpdateTo?: ThemeTypes) => {
|
76
|
+
if (themeToUpdateTo) {
|
77
|
+
setCurrentTheme(themeToUpdateTo);
|
78
|
+
return;
|
79
|
+
}
|
80
|
+
setCurrentTheme(ThemeTypes.default);
|
81
|
+
}, []);
|
85
82
|
|
86
83
|
useEffect(() => {
|
87
84
|
if (themeType) {
|
package/src/Theme/base.config.ts
CHANGED
@@ -13,7 +13,7 @@ const StyledTrigger = styled(Popover.Trigger, {
|
|
13
13
|
width: '$13',
|
14
14
|
height: '$13',
|
15
15
|
color: '$on_surface_high',
|
16
|
-
borderRadius: '$
|
16
|
+
borderRadius: '$2',
|
17
17
|
backgroundColor: '$surface_bright',
|
18
18
|
cursor: 'pointer',
|
19
19
|
border: 'none',
|
@@ -26,7 +26,7 @@ const StyledTrigger = styled(Popover.Trigger, {
|
|
26
26
|
|
27
27
|
const StyledContent = styled(Popover.Content, {
|
28
28
|
fontFamily: '$sans',
|
29
|
-
backgroundColor: '$
|
29
|
+
backgroundColor: '$surface_dim',
|
30
30
|
padding: '$5 0',
|
31
31
|
display: 'flex',
|
32
32
|
flexDirection: 'column',
|
@@ -33,6 +33,7 @@ export const TileMenu: React.FC<TileMenuProps> = ({ peerId }) => {
|
|
33
33
|
const audioTrack = useHMSStore(selectAudioTrackByPeerID(peerId));
|
34
34
|
const canMuteVideo = videoTrack?.enabled ? permissions?.mute : permissions?.unmute;
|
35
35
|
const canMuteAudio = audioTrack?.enabled ? permissions?.mute : permissions?.unmute;
|
36
|
+
|
36
37
|
const toggleTrackEnabled = async (track?: HMSTrack | null) => {
|
37
38
|
if (track) {
|
38
39
|
try {
|
@@ -55,6 +56,7 @@ export const TileMenu: React.FC<TileMenuProps> = ({ peerId }) => {
|
|
55
56
|
<span>{`${videoTrack?.enabled ? 'Mute' : 'Unmute'} Video`}</span>
|
56
57
|
</StyledMenuTile.ItemButton>
|
57
58
|
) : null}
|
59
|
+
|
58
60
|
{canMuteAudio ? (
|
59
61
|
<StyledMenuTile.ItemButton onClick={() => toggleTrackEnabled(audioTrack)}>
|
60
62
|
{audioTrack?.enabled ? <MicOnIcon /> : <MicOffIcon />}
|
@@ -57,6 +57,11 @@ const Info = styled('div', {
|
|
57
57
|
const AttributeBox = styled('div', {
|
58
58
|
position: 'absolute',
|
59
59
|
color: '$on_primary_high',
|
60
|
+
w: '$12',
|
61
|
+
h: '$12',
|
62
|
+
bg: '$secondary_dim',
|
63
|
+
r: '$round',
|
64
|
+
...flexCenter,
|
60
65
|
});
|
61
66
|
|
62
67
|
const AudioIndicator = styled('div', {
|
package/src/utils/animations.ts
CHANGED
@@ -34,6 +34,24 @@ export const slideRightAndFade = (start = '-2px') =>
|
|
34
34
|
'100%': { opacity: 1, transform: 'translateX(0)' },
|
35
35
|
});
|
36
36
|
|
37
|
+
export const sheetSlideIn = keyframes({
|
38
|
+
from: { transform: '$$transformValue' },
|
39
|
+
to: { transform: 'translate3d(0,0,0)' },
|
40
|
+
});
|
41
|
+
|
42
|
+
export const sheetSlideOut = keyframes({
|
43
|
+
from: { transform: 'translate3d(0,0,0)' },
|
44
|
+
to: { transform: '$$transformValue' },
|
45
|
+
});
|
46
|
+
export const sheetFadeIn = keyframes({
|
47
|
+
from: { opacity: '0' },
|
48
|
+
to: { opacity: '1' },
|
49
|
+
});
|
50
|
+
|
51
|
+
export const sheetFadeOut = keyframes({
|
52
|
+
from: { opacity: '1' },
|
53
|
+
to: { opacity: '0' },
|
54
|
+
});
|
37
55
|
export const slideDownAndFade = (start = '-2px') =>
|
38
56
|
keyframes({
|
39
57
|
'0%': { opacity: 0, transform: `translateY(${start})` },
|
@@ -1,11 +0,0 @@
|
|
1
|
-
/* ../../../../../../../tmp/tmp-2816-dyPVrOHMsbyG/189ed5e7dc41/Whiteboard.css */
|
2
|
-
.c-bUEyht-jvfJsl-side-right > button:nth-child(1) {
|
3
|
-
display: none;
|
4
|
-
}
|
5
|
-
.c-bUEyht-jvfJsl-side-right > button:nth-child(2) {
|
6
|
-
display: none;
|
7
|
-
}
|
8
|
-
#TD-PrimaryTools-Image {
|
9
|
-
display: none;
|
10
|
-
}
|
11
|
-
/*# sourceMappingURL=ActiveSpeakerView-AGL73O6U.css.map */
|
@@ -1,7 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"version": 3,
|
3
|
-
"sources": ["../../../../../../../../tmp/tmp-2816-dyPVrOHMsbyG/189ed5e7dc41/Whiteboard.css"],
|
4
|
-
"sourcesContent": ["/* Hide undo and redo buttons */\n.c-bUEyht-jvfJsl-side-right > button:nth-child(1) {\n display: none;\n}\n\n.c-bUEyht-jvfJsl-side-right > button:nth-child(2) {\n display: none;\n}\n\n#TD-PrimaryTools-Image {\n display: none;\n}\n"],
|
5
|
-
"mappings": ";AACA,CAAC,2BAA2B,EAAE,MAAM;AAClC,WAAS;AACX;AAEA,CAJC,2BAI2B,EAAE,MAAM;AAClC,WAAS;AACX;AAEA,CAAC;AACC,WAAS;AACX;",
|
6
|
-
"names": []
|
7
|
-
}
|